From: Andrea Amorese Date: Wed, 10 Nov 2021 13:55:56 +0000 (+0100) Subject: Built motion from commit 3f4d10cb.|2.5.37 X-Git-Url: http://repos.xcallymotion.com/base//%22api/fax/attachments/%7B%7BfaxAttachment.id%7D%7D/%22?a=commitdiff_plain;h=d1b9cb9ad1262080fec6daae045c7326ddefbc50;p=motion2.git Built motion from commit 3f4d10cb.|2.5.37 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c497adf..ee2c630 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-10T13:30:36.148Z", + "time": "2021-11-10T13:42:19.864Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b38c5ec..6212728 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-10T13:30:36.148Z", + "time": "2021-11-10T13:42:19.864Z", "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 d56adbc..cbacbdc 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 _0xa4e3=['jscripty','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]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','exports','VIRTUAL','STRING','contactManager','integration','motionbar'];(function(_0x16ffb8,_0x17d477){var _0x2b63b2=function(_0x260c86){while(--_0x260c86){_0x16ffb8['push'](_0x16ffb8['shift']());}};_0x2b63b2(++_0x17d477);}(_0xa4e3,0xae));var _0x3a4e=function(_0x182ea3,_0x2b746d){_0x182ea3=_0x182ea3-0x0;var _0x35ef65=_0xa4e3[_0x182ea3];return _0x35ef65;};'use strict';var Sequelize=require('sequelize');module[_0x3a4e('0x0')]={'name':{'type':Sequelize[_0x3a4e('0x1')],'get':function(_0xf52384){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x3a4e('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3a4e('0x3'),_0x3a4e('0x4'),_0x3a4e('0x5'),_0x3a4e('0x6'),'urlForward','browser','bot',_0x3a4e('0x7')]],'msg':_0x3a4e('0x8')}},'comment':_0x3a4e('0x8')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x3a4e('0x9')},'data2':{'type':Sequelize[_0x3a4e('0x2')](0x1000),'comment':_0x3a4e('0xa')},'data3':{'type':Sequelize[_0x3a4e('0x2')](0x1000),'comment':_0x3a4e('0xb')},'data4':{'type':Sequelize[_0x3a4e('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x3a4e('0x2')](0x1000),'comments':_0x3a4e('0xc')},'data6':{'type':Sequelize[_0x3a4e('0x2')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x3a4e('0xd')],'comments':_0x3a4e('0xe')}}; \ No newline at end of file +var _0xba8e=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','integration','motionbar','urlForward','browser','bot'];(function(_0x112c4c,_0x460cab){var _0x43b3cd=function(_0x2a1783){while(--_0x2a1783){_0x112c4c['push'](_0x112c4c['shift']());}};_0x43b3cd(++_0x460cab);}(_0xba8e,0x1e6));var _0xeba8=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0xba8e[_0x2e6c19];return _0x52885d;};'use strict';var Sequelize=require(_0xeba8('0x0'));module[_0xeba8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2cbb99){return this[_0xeba8('0x2')](_0xeba8('0x3'));}},'action':{'type':Sequelize[_0xeba8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xeba8('0x5'),_0xeba8('0x6'),'jscripty',_0xeba8('0x7'),_0xeba8('0x8'),_0xeba8('0x9'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xeba8('0xa')},'data1':{'type':Sequelize[_0xeba8('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xeba8('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xeba8('0x4')](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':_0xeba8('0xb')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xeba8('0xc')},'data6':{'type':Sequelize['STRING'],'comments':_0xeba8('0xd')},'data7':{'type':Sequelize[_0xeba8('0xe')],'comments':_0xeba8('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 0310355..37f7fbf 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 _0xb93e=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','update','body','find','catch','Action','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2134bf,_0x8a11b7){var _0xa70463=function(_0x288a2b){while(--_0x288a2b){_0x2134bf['push'](_0x2134bf['shift']());}};_0xa70463(++_0x8a11b7);}(_0xb93e,0x85));var _0xeb93=function(_0x5cd0e5,_0x3334b0){_0x5cd0e5=_0x5cd0e5-0x0;var _0x19b81f=_0xb93e[_0x5cd0e5];return _0x19b81f;};'use strict';var emlformat=require(_0xeb93('0x0'));var rimraf=require(_0xeb93('0x1'));var zipdir=require(_0xeb93('0x2'));var jsonpatch=require(_0xeb93('0x3'));var rp=require(_0xeb93('0x4'));var moment=require('moment');var BPromise=require(_0xeb93('0x5'));var Mustache=require(_0xeb93('0x6'));var util=require(_0xeb93('0x7'));var path=require('path');var sox=require(_0xeb93('0x8'));var csv=require(_0xeb93('0x9'));var ejs=require(_0xeb93('0xa'));var fs=require('fs');var fs_extra=require(_0xeb93('0xb'));var _=require(_0xeb93('0xc'));var squel=require(_0xeb93('0xd'));var crypto=require(_0xeb93('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeb93('0xf'));var toCsv=require(_0xeb93('0x9'));var querystring=require(_0xeb93('0x10'));var Papa=require(_0xeb93('0x11'));var Redis=require(_0xeb93('0x12'));var authService=require(_0xeb93('0x13'));var qs=require(_0xeb93('0x14'));var as=require(_0xeb93('0x15'));var hardwareService=require(_0xeb93('0x16'));var logger=require(_0xeb93('0x17'))(_0xeb93('0x18'));var utils=require(_0xeb93('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xeb93('0x1a'));var db=require(_0xeb93('0x1b'))['db'];function respondWithStatusCode(_0x3e8e3f,_0x21e679){_0x21e679=_0x21e679||0xcc;return function(_0x3b51f6){if(_0x3b51f6){return _0x3e8e3f[_0xeb93('0x1c')](_0x21e679);}return _0x3e8e3f[_0xeb93('0x1d')](_0x21e679)[_0xeb93('0x1e')]();};}function respondWithResult(_0x237d02,_0x21ad65){_0x21ad65=_0x21ad65||0xc8;return function(_0x52ec1b){if(_0x52ec1b){return _0x237d02[_0xeb93('0x1d')](_0x21ad65)[_0xeb93('0x1f')](_0x52ec1b);}};}function respondWithFilteredResult(_0x3a7185,_0xb777e4){return function(_0x142844){if(_0x142844){var _0x26ff35=typeof _0xb777e4['offset']===_0xeb93('0x20')&&typeof _0xb777e4[_0xeb93('0x21')]===_0xeb93('0x20');var _0x5da5a7=_0x142844[_0xeb93('0x22')];var _0x51f17f=_0x26ff35?0x0:_0xb777e4[_0xeb93('0x23')];var _0x4c35ce=_0x26ff35?_0x142844[_0xeb93('0x22')]:_0xb777e4[_0xeb93('0x23')]+_0xb777e4['limit'];var _0xe7b3f3;if(_0x4c35ce>=_0x5da5a7){_0x4c35ce=_0x5da5a7;_0xe7b3f3=0xc8;}else{_0xe7b3f3=0xce;}_0x3a7185[_0xeb93('0x1d')](_0xe7b3f3);return _0x3a7185[_0xeb93('0x24')]('Content-Range',_0x51f17f+'-'+_0x4c35ce+'/'+_0x5da5a7)[_0xeb93('0x1f')](_0x142844);}return null;};}function patchUpdates(_0x12fb32){return function(_0x2f0592){try{jsonpatch[_0xeb93('0x25')](_0x2f0592,_0x12fb32,!![]);}catch(_0x3d27e2){return BPromise[_0xeb93('0x26')](_0x3d27e2);}return _0x2f0592[_0xeb93('0x27')]();};}function saveUpdates(_0x144965,_0x3744f9){return function(_0x397c49){if(_0x397c49){return _0x397c49['update'](_0x144965)[_0xeb93('0x28')](function(_0x547e40){return _0x547e40;});}return null;};}function removeEntity(_0x323727,_0x304027){return function(_0x188ed0){if(_0x188ed0){return _0x188ed0[_0xeb93('0x29')]()[_0xeb93('0x28')](function(){_0x323727[_0xeb93('0x1d')](0xcc)[_0xeb93('0x1e')]();});}};}function handleEntityNotFound(_0x2b40d6,_0x5e5f0b){return function(_0x3fa881){if(!_0x3fa881){_0x2b40d6[_0xeb93('0x1c')](0x194);}return _0x3fa881;};}function handleError(_0x37d994,_0x135bbc){_0x135bbc=_0x135bbc||0x1f4;return function(_0x2ff2cd){logger[_0xeb93('0x2a')](_0x2ff2cd[_0xeb93('0x2b')]);if(_0x2ff2cd[_0xeb93('0x2c')]){delete _0x2ff2cd['name'];}_0x37d994['status'](_0x135bbc)[_0xeb93('0x2d')](_0x2ff2cd);};}exports[_0xeb93('0x2e')]=function(_0x4e6384,_0x2b56f5){if(_0x4e6384[_0xeb93('0x2f')]['id']){delete _0x4e6384['body']['id'];}return db['Action'][_0xeb93('0x30')]({'where':{'id':_0x4e6384['params']['id']}})['then'](handleEntityNotFound(_0x2b56f5,null))[_0xeb93('0x28')](saveUpdates(_0x4e6384['body'],null))[_0xeb93('0x28')](respondWithResult(_0x2b56f5,null))[_0xeb93('0x31')](handleError(_0x2b56f5,null));};exports[_0xeb93('0x29')]=function(_0x2047bb,_0x29f88e){return db[_0xeb93('0x32')]['find']({'where':{'id':_0x2047bb[_0xeb93('0x33')]['id']}})[_0xeb93('0x28')](handleEntityNotFound(_0x29f88e,null))[_0xeb93('0x28')](removeEntity(_0x29f88e,null))[_0xeb93('0x31')](handleError(_0x29f88e,null));}; \ No newline at end of file +var _0x331f=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x331f,0x86));var _0xf331=function(_0x198bb7,_0x113af0){_0x198bb7=_0x198bb7-0x0;var _0x4895cd=_0x331f[_0x198bb7];return _0x4895cd;};'use strict';var emlformat=require(_0xf331('0x0'));var rimraf=require(_0xf331('0x1'));var zipdir=require(_0xf331('0x2'));var jsonpatch=require(_0xf331('0x3'));var rp=require(_0xf331('0x4'));var moment=require(_0xf331('0x5'));var BPromise=require(_0xf331('0x6'));var Mustache=require(_0xf331('0x7'));var util=require(_0xf331('0x8'));var path=require(_0xf331('0x9'));var sox=require(_0xf331('0xa'));var csv=require(_0xf331('0xb'));var ejs=require(_0xf331('0xc'));var fs=require('fs');var fs_extra=require(_0xf331('0xd'));var _=require(_0xf331('0xe'));var squel=require(_0xf331('0xf'));var crypto=require(_0xf331('0x10'));var jsforce=require(_0xf331('0x11'));var deskjs=require(_0xf331('0x12'));var toCsv=require(_0xf331('0xb'));var querystring=require(_0xf331('0x13'));var Papa=require(_0xf331('0x14'));var Redis=require('ioredis');var authService=require(_0xf331('0x15'));var qs=require(_0xf331('0x16'));var as=require(_0xf331('0x17'));var hardwareService=require(_0xf331('0x18'));var logger=require(_0xf331('0x19'))(_0xf331('0x1a'));var utils=require(_0xf331('0x1b'));var config=require(_0xf331('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ba59d,_0x8a4a72){_0x8a4a72=_0x8a4a72||0xcc;return function(_0x19c3b8){if(_0x19c3b8){return _0x6ba59d[_0xf331('0x1d')](_0x8a4a72);}return _0x6ba59d[_0xf331('0x1e')](_0x8a4a72)['end']();};}function respondWithResult(_0x55583a,_0x3560d6){_0x3560d6=_0x3560d6||0xc8;return function(_0x58fcb7){if(_0x58fcb7){return _0x55583a[_0xf331('0x1e')](_0x3560d6)[_0xf331('0x1f')](_0x58fcb7);}};}function respondWithFilteredResult(_0x4f4a26,_0x12f987){return function(_0x4d7400){if(_0x4d7400){var _0xfd909a=typeof _0x12f987['offset']===_0xf331('0x20')&&typeof _0x12f987['limit']==='undefined';var _0x171464=_0x4d7400[_0xf331('0x21')];var _0x2eff28=_0xfd909a?0x0:_0x12f987[_0xf331('0x22')];var _0x1b3662=_0xfd909a?_0x4d7400[_0xf331('0x21')]:_0x12f987[_0xf331('0x22')]+_0x12f987[_0xf331('0x23')];var _0xe94d;if(_0x1b3662>=_0x171464){_0x1b3662=_0x171464;_0xe94d=0xc8;}else{_0xe94d=0xce;}_0x4f4a26[_0xf331('0x1e')](_0xe94d);return _0x4f4a26[_0xf331('0x24')](_0xf331('0x25'),_0x2eff28+'-'+_0x1b3662+'/'+_0x171464)[_0xf331('0x1f')](_0x4d7400);}return null;};}function patchUpdates(_0x5b722e){return function(_0x3bb02b){try{jsonpatch[_0xf331('0x26')](_0x3bb02b,_0x5b722e,!![]);}catch(_0x36775f){return BPromise['reject'](_0x36775f);}return _0x3bb02b[_0xf331('0x27')]();};}function saveUpdates(_0x5852d2,_0x8e4cae){return function(_0xf63e77){if(_0xf63e77){return _0xf63e77[_0xf331('0x28')](_0x5852d2)[_0xf331('0x29')](function(_0x2b5127){return _0x2b5127;});}return null;};}function removeEntity(_0x10695b,_0x6f29c2){return function(_0x425440){if(_0x425440){return _0x425440[_0xf331('0x2a')]()[_0xf331('0x29')](function(){_0x10695b[_0xf331('0x1e')](0xcc)[_0xf331('0x2b')]();});}};}function handleEntityNotFound(_0x4176ec,_0x5f0c89){return function(_0x10b36e){if(!_0x10b36e){_0x4176ec['sendStatus'](0x194);}return _0x10b36e;};}function handleError(_0x4ea935,_0x2055f7){_0x2055f7=_0x2055f7||0x1f4;return function(_0x3d96eb){logger[_0xf331('0x2c')](_0x3d96eb['stack']);if(_0x3d96eb['name']){delete _0x3d96eb[_0xf331('0x2d')];}_0x4ea935[_0xf331('0x1e')](_0x2055f7)['send'](_0x3d96eb);};}exports[_0xf331('0x28')]=function(_0x5e99ec,_0x26f2ed){if(_0x5e99ec[_0xf331('0x2e')]['id']){delete _0x5e99ec[_0xf331('0x2e')]['id'];}return db['Action'][_0xf331('0x2f')]({'where':{'id':_0x5e99ec[_0xf331('0x30')]['id']}})[_0xf331('0x29')](handleEntityNotFound(_0x26f2ed,null))[_0xf331('0x29')](saveUpdates(_0x5e99ec['body'],null))[_0xf331('0x29')](respondWithResult(_0x26f2ed,null))[_0xf331('0x31')](handleError(_0x26f2ed,null));};exports[_0xf331('0x2a')]=function(_0x229ab7,_0x1db69a){return db[_0xf331('0x32')][_0xf331('0x2f')]({'where':{'id':_0x229ab7[_0xf331('0x30')]['id']}})[_0xf331('0x29')](handleEntityNotFound(_0x1db69a,null))['then'](removeEntity(_0x1db69a,null))['catch'](handleError(_0x1db69a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9f817da..2297e22 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 _0xfb96=['request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','../../config/logger','api','bluebird'];(function(_0xe7c36a,_0x641105){var _0x8b1186=function(_0x29dea0){while(--_0x29dea0){_0xe7c36a['push'](_0xe7c36a['shift']());}};_0x8b1186(++_0x641105);}(_0xfb96,0x17e));var _0x6fb9=function(_0x4fbb37,_0x19a40e){_0x4fbb37=_0x4fbb37-0x0;var _0x4e6613=_0xfb96[_0x4fbb37];return _0x4e6613;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6fb9('0x0'))(_0x6fb9('0x1'));var moment=require('moment');var BPromise=require(_0x6fb9('0x2'));var rp=require(_0x6fb9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fb9('0x4'));var config=require(_0x6fb9('0x5'));var attributes=require(_0x6fb9('0x6'));module[_0x6fb9('0x7')]=function(_0x525c1e,_0x27b935){return _0x525c1e[_0x6fb9('0x8')](_0x6fb9('0x9'),attributes,{'tableName':_0x6fb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7644=['tools_actions','util','../../config/logger','bluebird','request-promise','rimraf','exports','define'];(function(_0x2709bd,_0x274e31){var _0x4b5d5c=function(_0x5f3a3b){while(--_0x5f3a3b){_0x2709bd['push'](_0x2709bd['shift']());}};_0x4b5d5c(++_0x274e31);}(_0x7644,0x1d9));var _0x4764=function(_0x199be9,_0x136c2b){_0x199be9=_0x199be9-0x0;var _0x150c30=_0x7644[_0x199be9];return _0x150c30;};'use strict';var _=require('lodash');var util=require(_0x4764('0x0'));var logger=require(_0x4764('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4764('0x2'));var rp=require(_0x4764('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4764('0x4'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x4764('0x5')]=function(_0x2e2011,_0x436f1f){return _0x2e2011[_0x4764('0x6')]('Action',attributes,{'tableName':_0x4764('0x7'),'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 70c8c28..495329d 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f5ccc,_0x50ff65){var _0x3b0657=function(_0x31ce65){while(--_0x31ce65){_0x5f5ccc['push'](_0x5f5ccc['shift']());}};_0x3b0657(++_0x50ff65);}(_0x326f,0xd1));var _0xf326=function(_0x4ef699,_0xabf23d){_0x4ef699=_0x4ef699-0x0;var _0x444af7=_0x326f[_0x4ef699];return _0x444af7;};'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')]('Action,\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')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +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(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 5537ad7..b46ef43 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 _0xbaed=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy','multer','util'];(function(_0x161234,_0x14daa9){var _0x562991=function(_0x3e3239){while(--_0x3e3239){_0x161234['push'](_0x161234['shift']());}};_0x562991(++_0x14daa9);}(_0xbaed,0x1df));var _0xdbae=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xbaed[_0x515afd];return _0x536d53;};'use strict';var multer=require(_0xdbae('0x0'));var util=require(_0xdbae('0x1'));var path=require('path');var timeout=require(_0xdbae('0x2'));var express=require('express');var router=express[_0xdbae('0x3')]();var fs_extra=require(_0xdbae('0x4'));var auth=require(_0xdbae('0x5'));var interaction=require(_0xdbae('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xdbae('0x7')](_0xdbae('0x8'),auth[_0xdbae('0x9')](),controller[_0xdbae('0xa')]);router[_0xdbae('0xb')](_0xdbae('0x8'),auth['isAuthenticated'](),controller[_0xdbae('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1320=['update','delete','/:id','destroy','multer','util','express','Router','../../components/interaction/service','./action.controller','isAuthenticated'];(function(_0x5afac8,_0x1a1ec4){var _0x59fac4=function(_0x2e25fe){while(--_0x2e25fe){_0x5afac8['push'](_0x5afac8['shift']());}};_0x59fac4(++_0x1a1ec4);}(_0x1320,0x1bc));var _0x0132=function(_0x3a9c44,_0x220fc7){_0x3a9c44=_0x3a9c44-0x0;var _0x2caeee=_0x1320[_0x3a9c44];return _0x2caeee;};'use strict';var multer=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0132('0x2'));var router=express[_0x0132('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0132('0x4'));var config=require('../../config/environment');var controller=require(_0x0132('0x5'));router['put']('/:id',auth[_0x0132('0x6')](),controller[_0x0132('0x7')]);router[_0x0132('0x8')](_0x0132('0x9'),auth[_0x0132('0x6')](),controller[_0x0132('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index fa96fc0..f75d00b 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 _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x3f8b66,_0x3ddd59){var _0x33d104=function(_0x1f20a6){while(--_0x1f20a6){_0x3f8b66['push'](_0x3f8b66['shift']());}};_0x33d104(++_0x3ddd59);}(_0xeda8,0x104));var _0x8eda=function(_0x5a3a4c,_0x23168e){_0x5a3a4c=_0x5a3a4c-0x0;var _0x1c16b9=_0xeda8[_0x5a3a4c];return _0x1c16b9;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x5c14fb,_0x73f97){var _0x6c7c1=function(_0x3bc8a3){while(--_0x3bc8a3){_0x5c14fb['push'](_0x5c14fb['shift']());}};_0x6c7c1(++_0x73f97);}(_0x31f0,0xb7));var _0x031f=function(_0x524710,_0x3e7dcc){_0x524710=_0x524710-0x0;var _0x80b564=_0x31f0[_0x524710];return _0x80b564;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 547e0c5..10f6ef9 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 _0xdfd9=['%s.%s\x20=\x20%s.%s','conditions','group','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','COUNT(%s)','DATE(%s)','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','groupBy','parse','clone','output','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','right_join','SEC_TO_TIME(%s)','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','cross_join','COUNT(DISTINCT\x20%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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','Sequelize','ValidationErrorItem','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey'];(function(_0x5dacb7,_0x6afe3){var _0x6ff906=function(_0x5337ef){while(--_0x5337ef){_0x5dacb7['push'](_0x5dacb7['shift']());}};_0x6ff906(++_0x6afe3);}(_0xdfd9,0xcc));var _0x9dfd=function(_0x2b5cd1,_0x478a84){_0x2b5cd1=_0x2b5cd1-0x0;var _0x1f649c=_0xdfd9[_0x2b5cd1];return _0x1f649c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dfd('0x0'));var zipdir=require(_0x9dfd('0x1'));var jsonpatch=require(_0x9dfd('0x2'));var rp=require('request-promise');var moment=require(_0x9dfd('0x3'));var BPromise=require(_0x9dfd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9dfd('0x5'));var sox=require(_0x9dfd('0x6'));var csv=require(_0x9dfd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9dfd('0x8'));var _=require(_0x9dfd('0x9'));var squel=require(_0x9dfd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9dfd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9dfd('0xc'));var Papa=require(_0x9dfd('0xd'));var Redis=require(_0x9dfd('0xe'));var authService=require(_0x9dfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9dfd('0x10'));var hardwareService=require(_0x9dfd('0x11'));var logger=require(_0x9dfd('0x12'))('api');var utils=require(_0x9dfd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9dfd('0x14'));var db=require(_0x9dfd('0x15'))['db'];var dbH=require(_0x9dfd('0x15'))[_0x9dfd('0x16')];function respondWithStatusCode(_0x264c59,_0x486f0e){_0x486f0e=_0x486f0e||0xcc;return function(_0x10e194){if(_0x10e194){return _0x264c59[_0x9dfd('0x17')](_0x486f0e);}return _0x264c59[_0x9dfd('0x18')](_0x486f0e)[_0x9dfd('0x19')]();};}function respondWithResult(_0x37cdc9,_0x3c8bab){_0x3c8bab=_0x3c8bab||0xc8;return function(_0x1713c7){if(_0x1713c7){return _0x37cdc9['status'](_0x3c8bab)[_0x9dfd('0x1a')](_0x1713c7);}};}function respondWithFilteredResult(_0x5279bf,_0xbd711a){return function(_0x2eb893){if(_0x2eb893){var _0x2e3500=typeof _0xbd711a['offset']===_0x9dfd('0x1b')&&typeof _0xbd711a[_0x9dfd('0x1c')]==='undefined';var _0x43f0de=_0x2eb893['count'];var _0x224325=_0x2e3500?0x0:_0xbd711a['offset'];var _0x3cee4a=_0x2e3500?_0x2eb893[_0x9dfd('0x1d')]:_0xbd711a[_0x9dfd('0x1e')]+_0xbd711a['limit'];var _0x136dbc;if(_0x3cee4a>=_0x43f0de){_0x3cee4a=_0x43f0de;_0x136dbc=0xc8;}else{_0x136dbc=0xce;}_0x5279bf[_0x9dfd('0x18')](_0x136dbc);return _0x5279bf[_0x9dfd('0x1f')](_0x9dfd('0x20'),_0x224325+'-'+_0x3cee4a+'/'+_0x43f0de)[_0x9dfd('0x1a')](_0x2eb893);}return null;};}function patchUpdates(_0x2d4eed){return function(_0x4955ce){try{jsonpatch[_0x9dfd('0x21')](_0x4955ce,_0x2d4eed,!![]);}catch(_0x18b714){return BPromise[_0x9dfd('0x22')](_0x18b714);}return _0x4955ce[_0x9dfd('0x23')]();};}function saveUpdates(_0x246467,_0x3dda5c){return function(_0x3052ac){if(_0x3052ac){return _0x3052ac[_0x9dfd('0x24')](_0x246467)[_0x9dfd('0x25')](function(_0x20558a){return _0x20558a;});}return null;};}function removeEntity(_0xfb2852,_0x5e1bfd){return function(_0x4899c0){if(_0x4899c0){return _0x4899c0[_0x9dfd('0x26')]()[_0x9dfd('0x25')](function(){var _0x3f8a8c=_0x4899c0[_0x9dfd('0x27')]({'plain':!![]});var _0x2aef04=_0x9dfd('0x28');return db[_0x9dfd('0x29')][_0x9dfd('0x26')]({'where':{'type':_0x2aef04,'resourceId':_0x3f8a8c['id']}})[_0x9dfd('0x25')](function(){return _0x4899c0;});})[_0x9dfd('0x25')](function(){_0xfb2852[_0x9dfd('0x18')](0xcc)[_0x9dfd('0x19')]();});}};}function handleEntityNotFound(_0x555aa5,_0x3c4682){return function(_0x62237e){if(!_0x62237e){_0x555aa5[_0x9dfd('0x17')](0x194);}return _0x62237e;};}function handleError(_0x2c3e62,_0x4f7225){_0x4f7225=_0x4f7225||0x1f4;return function(_0x1e0c4a){logger[_0x9dfd('0x2a')](_0x1e0c4a[_0x9dfd('0x2b')]);if(_0x1e0c4a[_0x9dfd('0x2c')]){delete _0x1e0c4a[_0x9dfd('0x2c')];}_0x2c3e62[_0x9dfd('0x18')](_0x4f7225)[_0x9dfd('0x2d')](_0x1e0c4a);};}exports[_0x9dfd('0x2e')]=function(_0x4b5ab6,_0x317fa6){var _0x2c135a={},_0x2e057b={},_0x490dbd={'count':0x0,'rows':[]};var _0x5a0856=_[_0x9dfd('0x2f')](db[_0x9dfd('0x30')][_0x9dfd('0x31')],function(_0x56c176){return{'name':_0x56c176[_0x9dfd('0x32')],'type':_0x56c176[_0x9dfd('0x33')][_0x9dfd('0x34')]};});_0x2e057b['model']=_[_0x9dfd('0x2f')](_0x5a0856,'name');_0x2e057b[_0x9dfd('0x35')]=_[_0x9dfd('0x36')](_0x4b5ab6[_0x9dfd('0x35')]);_0x2e057b[_0x9dfd('0x37')]=_[_0x9dfd('0x38')](_0x2e057b[_0x9dfd('0x39')],_0x2e057b['query']);_0x2c135a[_0x9dfd('0x3a')]=_[_0x9dfd('0x38')](_0x2e057b[_0x9dfd('0x39')],qs[_0x9dfd('0x3b')](_0x4b5ab6['query'][_0x9dfd('0x3b')]));_0x2c135a[_0x9dfd('0x3a')]=_0x2c135a[_0x9dfd('0x3a')]['length']?_0x2c135a[_0x9dfd('0x3a')]:_0x2e057b['model'];if(!_0x4b5ab6[_0x9dfd('0x35')][_0x9dfd('0x3c')]('nolimit')){_0x2c135a[_0x9dfd('0x1c')]=qs[_0x9dfd('0x1c')](_0x4b5ab6[_0x9dfd('0x35')][_0x9dfd('0x1c')]);_0x2c135a[_0x9dfd('0x1e')]=qs[_0x9dfd('0x1e')](_0x4b5ab6[_0x9dfd('0x35')][_0x9dfd('0x1e')]);}_0x2c135a[_0x9dfd('0x3d')]=qs[_0x9dfd('0x3e')](_0x4b5ab6[_0x9dfd('0x35')][_0x9dfd('0x3e')]);_0x2c135a[_0x9dfd('0x3f')]=qs[_0x9dfd('0x37')](_[_0x9dfd('0x40')](_0x4b5ab6['query'],_0x2e057b[_0x9dfd('0x37')]),_0x5a0856);if(_0x4b5ab6['query']['filter']){_0x2c135a['where']=_[_0x9dfd('0x41')](_0x2c135a[_0x9dfd('0x3f')],{'$or':_['map'](_0x5a0856,function(_0x788601){if(_0x788601[_0x9dfd('0x33')]!==_0x9dfd('0x42')){var _0x21519c={};_0x21519c[_0x788601['name']]={'$like':'%'+_0x4b5ab6[_0x9dfd('0x35')][_0x9dfd('0x43')]+'%'};return _0x21519c;}})});}_0x2c135a=_['merge']({},_0x2c135a,_0x4b5ab6[_0x9dfd('0x44')]);var _0x22e827={'where':_0x2c135a['where']};return db['AnalyticCustomReport'][_0x9dfd('0x1d')](_0x22e827)[_0x9dfd('0x25')](function(_0x24df0e){_0x490dbd[_0x9dfd('0x1d')]=_0x24df0e;if(_0x4b5ab6[_0x9dfd('0x35')][_0x9dfd('0x45')]){_0x2c135a[_0x9dfd('0x46')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x9dfd('0x47')](_0x2c135a);})[_0x9dfd('0x25')](function(_0x5b720d){_0x490dbd[_0x9dfd('0x48')]=_0x5b720d;return _0x490dbd;})[_0x9dfd('0x25')](respondWithFilteredResult(_0x317fa6,_0x2c135a))['catch'](handleError(_0x317fa6,null));};exports[_0x9dfd('0x49')]=function(_0x55fb49,_0x1fd90c){var _0x427136={'raw':![],'where':{'id':_0x55fb49['params']['id']}},_0x32ff57={};_0x32ff57[_0x9dfd('0x39')]=_[_0x9dfd('0x36')](db[_0x9dfd('0x30')][_0x9dfd('0x31')]);_0x32ff57[_0x9dfd('0x35')]=_[_0x9dfd('0x36')](_0x55fb49[_0x9dfd('0x35')]);_0x32ff57[_0x9dfd('0x37')]=_[_0x9dfd('0x38')](_0x32ff57[_0x9dfd('0x39')],_0x32ff57[_0x9dfd('0x35')]);_0x427136[_0x9dfd('0x3a')]=_[_0x9dfd('0x38')](_0x32ff57['model'],qs[_0x9dfd('0x3b')](_0x55fb49[_0x9dfd('0x35')][_0x9dfd('0x3b')]));_0x427136[_0x9dfd('0x3a')]=_0x427136[_0x9dfd('0x3a')][_0x9dfd('0x4a')]?_0x427136['attributes']:_0x32ff57[_0x9dfd('0x39')];if(_0x55fb49[_0x9dfd('0x35')][_0x9dfd('0x45')]){_0x427136[_0x9dfd('0x46')]=[{'all':!![]}];}_0x427136=_[_0x9dfd('0x41')]({},_0x427136,_0x55fb49[_0x9dfd('0x44')]);return db[_0x9dfd('0x30')][_0x9dfd('0x4b')](_0x427136)[_0x9dfd('0x25')](handleEntityNotFound(_0x1fd90c,null))[_0x9dfd('0x25')](respondWithResult(_0x1fd90c,null))[_0x9dfd('0x4c')](handleError(_0x1fd90c,null));};exports['create']=function(_0x4b242e,_0x1c8f77){return db['AnalyticCustomReport'][_0x9dfd('0x4d')](_0x4b242e[_0x9dfd('0x4e')],{})['then'](function(_0x3b650e){var _0x25beff=_0x4b242e[_0x9dfd('0x4f')][_0x9dfd('0x27')]({'plain':!![]});if(!_0x25beff)throw new Error(_0x9dfd('0x50'));if(_0x25beff[_0x9dfd('0x51')]===_0x9dfd('0x4f')){var _0x48b0e4=_0x3b650e[_0x9dfd('0x27')]({'plain':!![]});var _0x11278b=_0x9dfd('0x52');return db[_0x9dfd('0x53')][_0x9dfd('0x4b')]({'where':{'name':_0x11278b,'userProfileId':_0x25beff['userProfileId']},'raw':!![]})[_0x9dfd('0x25')](function(_0x380d66){if(_0x380d66&&_0x380d66['autoAssociation']===0x0){return db['UserProfileResource'][_0x9dfd('0x4d')]({'name':_0x48b0e4[_0x9dfd('0x2c')],'resourceId':_0x48b0e4['id'],'type':_0x9dfd('0x28'),'sectionId':_0x380d66['id']},{})[_0x9dfd('0x25')](function(){return _0x3b650e;});}else{return _0x3b650e;}})[_0x9dfd('0x4c')](function(_0x4c7ee8){logger[_0x9dfd('0x2a')](_0x9dfd('0x54'),_0x4c7ee8);throw _0x4c7ee8;});}return _0x3b650e;})[_0x9dfd('0x25')](respondWithResult(_0x1c8f77,0xc9))[_0x9dfd('0x4c')](handleError(_0x1c8f77,null));};exports[_0x9dfd('0x24')]=function(_0xff18a3,_0x2dcd3f){if(_0xff18a3[_0x9dfd('0x4e')]['id']){delete _0xff18a3[_0x9dfd('0x4e')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0xff18a3[_0x9dfd('0x55')]['id']}})['then'](handleEntityNotFound(_0x2dcd3f,null))[_0x9dfd('0x25')](saveUpdates(_0xff18a3[_0x9dfd('0x4e')],null))[_0x9dfd('0x25')](respondWithResult(_0x2dcd3f,null))[_0x9dfd('0x4c')](handleError(_0x2dcd3f,null));};exports[_0x9dfd('0x26')]=function(_0x4b6708,_0x26e235){return db[_0x9dfd('0x30')]['find']({'where':{'id':_0x4b6708[_0x9dfd('0x55')]['id']}})[_0x9dfd('0x25')](handleEntityNotFound(_0x26e235,null))[_0x9dfd('0x25')](removeEntity(_0x26e235,null))[_0x9dfd('0x4c')](handleError(_0x26e235,null));};exports[_0x9dfd('0x56')]=function(_0x222b52,_0x1328d0){var _0x4afdf5=0xa;var _0x48e1fb=[_0x9dfd('0x57'),_0x9dfd('0x58'),'right_join',_0x9dfd('0x59')];var _0x5e697b={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9dfd('0x5a'),'MAX':_0x9dfd('0x5b'),'MIN':_0x9dfd('0x5c'),'AVG':_0x9dfd('0x5d'),'GROUP_CONCAT':_0x9dfd('0x5e'),'GROUP_CONCAT ASC':_0x9dfd('0x5f'),'GROUP_CONCAT DESC':_0x9dfd('0x60')};var _0x1f605d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x9dfd('0x61'),'ROUND':_0x9dfd('0x62'),'UNIX_TIMESTAMP':_0x9dfd('0x63')};var _0x324ec6=function(_0x105aa1){return!_[_0x9dfd('0x64')]([_0x9dfd('0x65'),_0x9dfd('0x66'),_0x9dfd('0x67'),_0x9dfd('0x68')],_0x105aa1);};var _0x119569=function(_0x3afae9){if(!_0x3afae9||!_0x3afae9[_0x9dfd('0x69')][_0x9dfd('0x4a')]){return'';}for(var _0x536386='(',_0x4fe161=0x0;_0x4fe161<_0x3afae9[_0x9dfd('0x69')][_0x9dfd('0x4a')];_0x4fe161+=0x1){_0x4fe161>0x0&&(_0x536386+='\x20'+_0x3afae9[_0x9dfd('0x6a')]+'\x20');_0x536386+=_0x3afae9[_0x9dfd('0x69')][_0x4fe161]['group']?_0x119569(_0x3afae9[_0x9dfd('0x69')][_0x4fe161]['group']):_0x3afae9[_0x9dfd('0x69')][_0x4fe161][_0x9dfd('0x6b')]+'\x20'+_0x3afae9[_0x9dfd('0x69')][_0x4fe161][_0x9dfd('0x6c')]+(_0x324ec6(_0x3afae9[_0x9dfd('0x69')][_0x4fe161][_0x9dfd('0x6c')])?'\x20'+_0x3afae9[_0x9dfd('0x69')][_0x4fe161][_0x9dfd('0x6d')]:'');}return _0x536386+')';};var _0x33ce53={'where':{'id':_0x222b52[_0x9dfd('0x55')]['id']}},_0xbcba07,_0x28972a,_0xbe6892,_0xb78984,_0x4be999;_0x33ce53=_[_0x9dfd('0x41')]({},_0x33ce53,_0x222b52[_0x9dfd('0x44')]);return db[_0x9dfd('0x30')]['find'](_0x33ce53)[_0x9dfd('0x25')](function(_0x3d7bef){if(_0x3d7bef){_0xbcba07=_0x3d7bef;return _0x3d7bef[_0x9dfd('0x6e')]();}return null;})['then'](function(_0x556bfd){if(_0x556bfd){if(!_0x556bfd[_0x9dfd('0x4a')]){throw new db[(_0x9dfd('0x6f'))][(_0x9dfd('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x28972a=_0x556bfd;return db['AnalyticMetric'][_0x9dfd('0x47')]({'raw':!![]});}return null;})['then'](function(_0x1dc3c8){if(_0x1dc3c8){_0xbe6892=_['keyBy'](_0x1dc3c8,'id');var _0x4b77e9;var _0x5f1266=squel[_0x9dfd('0x71')]();_0x5f1266[_0x9dfd('0x72')](_0xbcba07[_0x9dfd('0x73')]);for(var _0x4916c0=0x0;_0x4916c0<_0x28972a[_0x9dfd('0x4a')];_0x4916c0+=0x1){_0x4b77e9=_0x28972a[_0x4916c0][_0x9dfd('0x74')]?_0xbe6892[_0x28972a[_0x4916c0][_0x9dfd('0x74')]][_0x9dfd('0x75')]:_0x28972a[_0x4916c0]['field'];_0x4b77e9=_0x28972a[_0x4916c0][_0x9dfd('0x76')]?_[_0x9dfd('0x77')](_0x5e697b[_0x28972a[_0x4916c0][_0x9dfd('0x76')]],'%s',_0x4b77e9):_0x4b77e9;_0x4b77e9=_0x28972a[_0x4916c0][_0x9dfd('0x78')]?_[_0x9dfd('0x77')](_0x1f605d[_0x28972a[_0x4916c0][_0x9dfd('0x78')]],'%s',_0x4b77e9):_0x4b77e9;if(_0x28972a[_0x4916c0]['groupBy']){_0x5f1266['group'](_0x4b77e9);}_0x28972a[_0x4916c0][_0x9dfd('0x79')]&&_0x5f1266[_0x9dfd('0x3d')](_0x4b77e9,_0x28972a[_0x4916c0][_0x9dfd('0x79')]===_0x9dfd('0x7a')?![]:!![]);_0x5f1266['field'](_0x4b77e9,_0x28972a[_0x4916c0][_0x9dfd('0x7b')]||_0x4b77e9);}if(_0xbcba07['joins']){_0xbcba07['joins']=JSON['parse'](_0xbcba07[_0x9dfd('0x7c')]);for(var _0x28b55e=0x0;_0x28b55e<_0xbcba07[_0x9dfd('0x7c')][_0x9dfd('0x4a')];_0x28b55e+=0x1){if(_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x33')]&&_['includes'](_0x48e1fb,_0xbcba07['joins'][_0x28b55e]['type'])&&_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x7d')]&&_0xbcba07['joins'][_0x28b55e][_0x9dfd('0x7e')]&&_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x7f')]){_0x5f1266[_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x33')]](_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x7e')],null,util[_0x9dfd('0x78')](_0x9dfd('0x80'),_0xbcba07['table'],_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x7d')],_0xbcba07[_0x9dfd('0x7c')][_0x28b55e]['foreignTable'],_0xbcba07[_0x9dfd('0x7c')][_0x28b55e][_0x9dfd('0x7f')]));}}}if(_0xbcba07[_0x9dfd('0x81')]){_0xbcba07[_0x9dfd('0x81')]=JSON['parse'](_0xbcba07[_0x9dfd('0x81')]);_0x5f1266['where'](_0x119569(_0xbcba07[_0x9dfd('0x81')][_0x9dfd('0x82')]));}_0x4be999=_0x5f1266['clone']();_0x5f1266[_0x9dfd('0x1c')](_0x4afdf5);_0x5f1266[_0x9dfd('0x1e')](0x0);logger[_0x9dfd('0x83')](_0x9dfd('0x84'),_0x5f1266[_0x9dfd('0x85')]());return dbH[_0x9dfd('0x86')][_0x9dfd('0x35')](_0x5f1266[_0x9dfd('0x85')](),{'type':dbH[_0x9dfd('0x86')][_0x9dfd('0x87')]['SELECT']});}})[_0x9dfd('0x25')](respondWithResult(_0x1328d0,null))[_0x9dfd('0x4c')](handleError(_0x1328d0,null));};function runReport(_0x3c9a36,_0x425f6d,_0x49df96){var _0x1fa2fc=_0x425f6d[_0x9dfd('0x2c')];var _0xf0e5bf=0xa;var _0x3de06e=[_0x9dfd('0x57'),'left_join','right_join',_0x9dfd('0x59')];var _0x2cadd6={'SUM':_0x9dfd('0x88'),'COUNT':_0x9dfd('0x89'),'COUNT DISTINCT':_0x9dfd('0x5a'),'MAX':_0x9dfd('0x5b'),'MIN':_0x9dfd('0x5c'),'AVG':_0x9dfd('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9dfd('0x5f'),'GROUP_CONCAT DESC':_0x9dfd('0x60')};var _0xb82703={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9dfd('0x8a'),'HOUR':_0x9dfd('0x61'),'ROUND':_0x9dfd('0x62'),'UNIX_TIMESTAMP':_0x9dfd('0x63')};var _0x18f15f=function(_0x5d1c14){return!_['includes']([_0x9dfd('0x65'),_0x9dfd('0x66'),_0x9dfd('0x67'),_0x9dfd('0x68')],_0x5d1c14);};var _0x2efb12=function(_0x35e2d9){if(!_0x35e2d9||!_0x35e2d9[_0x9dfd('0x69')][_0x9dfd('0x4a')]){return'';}for(var _0x15b9f9='(',_0x588440=0x0;_0x588440<_0x35e2d9[_0x9dfd('0x69')]['length'];_0x588440+=0x1){_0x588440>0x0&&(_0x15b9f9+='\x20'+_0x35e2d9[_0x9dfd('0x6a')]+'\x20');_0x15b9f9+=_0x35e2d9['rules'][_0x588440][_0x9dfd('0x82')]?_0x2efb12(_0x35e2d9[_0x9dfd('0x69')][_0x588440]['group']):_0x35e2d9[_0x9dfd('0x69')][_0x588440]['field']+'\x20'+_0x35e2d9[_0x9dfd('0x69')][_0x588440]['condition']+(_0x18f15f(_0x35e2d9[_0x9dfd('0x69')][_0x588440][_0x9dfd('0x6c')])?'\x20'+_0x35e2d9[_0x9dfd('0x69')][_0x588440][_0x9dfd('0x6d')]:'');}return _0x15b9f9+')';};var _0x1eed79={'where':{'id':_0x3c9a36['id']}},_0xa72f63,_0x4d4ca5,_0x2f9396,_0x269f12,_0x155700;_0x1eed79=_['merge']({},_0x1eed79,_0x49df96);return db[_0x9dfd('0x30')]['find'](_0x1eed79)[_0x9dfd('0x25')](function(_0x231439){if(_0x231439){_0xa72f63=_0x231439;return _0x231439[_0x9dfd('0x6e')]();}return null;})[_0x9dfd('0x25')](function(_0xad5cef){if(_0xad5cef){if(!_0xad5cef[_0x9dfd('0x4a')]){throw new db['Sequelize']['ValidationErrorItem'](_0x9dfd('0x8b'),0x193);}_0x4d4ca5=_0xad5cef;return db[_0x9dfd('0x8c')][_0x9dfd('0x47')]({'raw':!![]});}return null;})[_0x9dfd('0x25')](function(_0x1795ec){if(_0x1795ec){_0x2f9396=_[_0x9dfd('0x8d')](_0x1795ec,'id');var _0x5c1dc7;var _0x3d0c43=squel[_0x9dfd('0x71')]();_0x3d0c43[_0x9dfd('0x72')](_0xa72f63[_0x9dfd('0x73')]);for(var _0x9fcce6=0x0;_0x9fcce6<_0x4d4ca5[_0x9dfd('0x4a')];_0x9fcce6+=0x1){_0x5c1dc7=_0x4d4ca5[_0x9fcce6][_0x9dfd('0x74')]?_0x2f9396[_0x4d4ca5[_0x9fcce6][_0x9dfd('0x74')]][_0x9dfd('0x75')]:_0x4d4ca5[_0x9fcce6]['field'];_0x5c1dc7=_0x4d4ca5[_0x9fcce6][_0x9dfd('0x76')]?_['replace'](_0x2cadd6[_0x4d4ca5[_0x9fcce6][_0x9dfd('0x76')]],'%s',_0x5c1dc7):_0x5c1dc7;_0x5c1dc7=_0x4d4ca5[_0x9fcce6][_0x9dfd('0x78')]?_[_0x9dfd('0x77')](_0xb82703[_0x4d4ca5[_0x9fcce6][_0x9dfd('0x78')]],'%s',_0x5c1dc7):_0x5c1dc7;if(_0x4d4ca5[_0x9fcce6][_0x9dfd('0x8e')]){_0x3d0c43[_0x9dfd('0x82')](_0x5c1dc7);}_0x4d4ca5[_0x9fcce6][_0x9dfd('0x79')]&&_0x3d0c43[_0x9dfd('0x3d')](_0x5c1dc7,_0x4d4ca5[_0x9fcce6][_0x9dfd('0x79')]===_0x9dfd('0x7a')?![]:!![]);_0x3d0c43[_0x9dfd('0x6b')](_0x5c1dc7,_0x4d4ca5[_0x9fcce6][_0x9dfd('0x7b')]||_0x5c1dc7);}if(_0xa72f63['joins']){_0xa72f63[_0x9dfd('0x7c')]=JSON[_0x9dfd('0x8f')](_0xa72f63[_0x9dfd('0x7c')]);for(var _0x151b43=0x0;_0x151b43<_0xa72f63[_0x9dfd('0x7c')][_0x9dfd('0x4a')];_0x151b43+=0x1){if(_0xa72f63['joins'][_0x151b43][_0x9dfd('0x33')]&&_[_0x9dfd('0x64')](_0x3de06e,_0xa72f63['joins'][_0x151b43][_0x9dfd('0x33')])&&_0xa72f63[_0x9dfd('0x7c')][_0x151b43][_0x9dfd('0x7d')]&&_0xa72f63[_0x9dfd('0x7c')][_0x151b43]['foreignTable']&&_0xa72f63['joins'][_0x151b43][_0x9dfd('0x7f')]){_0x3d0c43[_0xa72f63[_0x9dfd('0x7c')][_0x151b43][_0x9dfd('0x33')]](_0xa72f63[_0x9dfd('0x7c')][_0x151b43][_0x9dfd('0x7e')],null,util[_0x9dfd('0x78')](_0x9dfd('0x80'),_0xa72f63[_0x9dfd('0x73')],_0xa72f63[_0x9dfd('0x7c')][_0x151b43][_0x9dfd('0x7d')],_0xa72f63[_0x9dfd('0x7c')][_0x151b43][_0x9dfd('0x7e')],_0xa72f63['joins'][_0x151b43][_0x9dfd('0x7f')]));}}}if(_0xa72f63[_0x9dfd('0x81')]){_0xa72f63['conditions']=JSON['parse'](_0xa72f63['conditions']);_0x3d0c43[_0x9dfd('0x3f')](_0x2efb12(_0xa72f63[_0x9dfd('0x81')]['group']));}_0x155700=_0x3d0c43[_0x9dfd('0x90')]();_0x3d0c43[_0x9dfd('0x1c')](_0xf0e5bf);_0x3d0c43[_0x9dfd('0x1e')](0x0);return;}})[_0x9dfd('0x25')](function(){if(_0x425f6d[_0x9dfd('0x91')]==='web'){return null;}var _0x5784c8=_[_0x9dfd('0x41')](_0x425f6d,{'name':_0x425f6d[_0x9dfd('0x92')]||_0x425f6d[_0x9dfd('0x2c')]||_0xa72f63[_0x9dfd('0x2c')],'basename':_0x1fa2fc,'savename':util[_0x9dfd('0x78')]('%s-%s.%s',_0x425f6d['name']||_0xa72f63[_0x9dfd('0x2c')],require(_0x9dfd('0x93'))[_0x9dfd('0x94')](0x4),_0x425f6d[_0x9dfd('0x91')]||_0x9dfd('0x95')),'reportId':_0xa72f63['id'],'reportType':_0x9dfd('0x96')});return db[_0x9dfd('0x97')]['create'](_0x5784c8,{'raw':!![]});})['then'](function(_0x4c79e6){if(_0xa72f63[_0x9dfd('0x73')]===_0x9dfd('0x98')){_0x155700[_0x9dfd('0x3f')](_0xa72f63['table']+_0x9dfd('0x99'),_0x425f6d[_0x9dfd('0x9a')],_0x425f6d['endDate']);}else{_0x155700[_0x9dfd('0x3f')](_0xa72f63['table']+_0x9dfd('0x9b'),_0x425f6d['startDate'],_0x425f6d[_0x9dfd('0x9c')]);}if(_0x4c79e6){logger['info']('Run\x20Query:',_0x155700['toString']());require(_0x9dfd('0x9d'))['fork'](path[_0x9dfd('0x57')](__dirname,_0x9dfd('0x9e'),_0x4c79e6[_0x9dfd('0x91')]),[_0x4c79e6['id'],_0x155700[_0x9dfd('0x85')](),path[_0x9dfd('0x57')](__dirname,_0x9dfd('0x9f'),_0x4c79e6[_0x9dfd('0xa0')]),_0x1fa2fc]);return _0x4c79e6;}else{var _0x871c=squel[_0x9dfd('0x71')]();_0x871c['from']('('+_0x155700[_0x9dfd('0x85')]()+')',_0x9dfd('0xa1'));_0x871c[_0x9dfd('0x6b')](_0x9dfd('0xa2'),_0x9dfd('0x1d'));_0x155700[_0x9dfd('0x1c')](_0x425f6d[_0x9dfd('0x1c')]||_0xf0e5bf);_0x155700[_0x9dfd('0x1e')](_0x425f6d[_0x9dfd('0x1e')]||0x0);return dbH[_0x9dfd('0x86')]['query'](_0x871c['toString'](),{'type':dbH[_0x9dfd('0x86')][_0x9dfd('0x87')]['SELECT']})[_0x9dfd('0x25')](function(_0x210dc2){if(!_0x210dc2[_0x9dfd('0x4a')]){_0x269f12=0x0;}else{_0x269f12=_0x210dc2[0x0][_0x9dfd('0x1d')]||0x0;}return dbH[_0x9dfd('0x86')][_0x9dfd('0x35')](_0x155700[_0x9dfd('0x85')](),{'type':dbH[_0x9dfd('0x86')][_0x9dfd('0x87')]['SELECT']});})[_0x9dfd('0x25')](function(_0x5eb44e){return{'rows':_0x5eb44e||[],'count':_0x269f12};});}});}exports[_0x9dfd('0xa3')]=function(_0x2fbc7d,_0x1fbc7f){return runReport(_0x2fbc7d[_0x9dfd('0x55')],_0x2fbc7d[_0x9dfd('0x35')],_0x2fbc7d[_0x9dfd('0x44')])['then'](respondWithResult(_0x1fbc7f,null))[_0x9dfd('0x4c')](handleError(_0x1fbc7f,null));};exports['runReport']=runReport;exports[_0x9dfd('0x35')]=function(_0x48ada7,_0x5a4f31){var _0x42fd79=0xa;var _0x28a74d=[_0x9dfd('0x57'),_0x9dfd('0x58'),_0x9dfd('0xa4'),_0x9dfd('0x59')];var _0x167acb={'SUM':_0x9dfd('0x88'),'COUNT':_0x9dfd('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9dfd('0x5b'),'MIN':_0x9dfd('0x5c'),'AVG':_0x9dfd('0x5d'),'GROUP_CONCAT':_0x9dfd('0x5e'),'GROUP_CONCAT ASC':_0x9dfd('0x5f'),'GROUP_CONCAT DESC':_0x9dfd('0x60')};var _0x485631={'SEC_TO_TIME':_0x9dfd('0xa5'),'DATE':_0x9dfd('0x8a'),'HOUR':_0x9dfd('0x61'),'ROUND':_0x9dfd('0x62'),'UNIX_TIMESTAMP':_0x9dfd('0x63')};var _0x133a86=function(_0x37c184){return!_[_0x9dfd('0x64')]([_0x9dfd('0x65'),'IS\x20NOT\x20NULL',_0x9dfd('0x67'),_0x9dfd('0x68')],_0x37c184);};var _0x53ab1e=function(_0x2b5490){if(!_0x2b5490||!_0x2b5490[_0x9dfd('0x69')][_0x9dfd('0x4a')]){return'';}for(var _0x3494e2='(',_0x1a2ab6=0x0;_0x1a2ab6<_0x2b5490[_0x9dfd('0x69')][_0x9dfd('0x4a')];_0x1a2ab6+=0x1){_0x1a2ab6>0x0&&(_0x3494e2+='\x20'+_0x2b5490[_0x9dfd('0x6a')]+'\x20');_0x3494e2+=_0x2b5490[_0x9dfd('0x69')][_0x1a2ab6][_0x9dfd('0x82')]?_0x53ab1e(_0x2b5490[_0x9dfd('0x69')][_0x1a2ab6]['group']):_0x2b5490[_0x9dfd('0x69')][_0x1a2ab6][_0x9dfd('0x6b')]+'\x20'+_0x2b5490[_0x9dfd('0x69')][_0x1a2ab6]['condition']+(_0x133a86(_0x2b5490['rules'][_0x1a2ab6]['condition'])?'\x20'+_0x2b5490[_0x9dfd('0x69')][_0x1a2ab6][_0x9dfd('0x6d')]:'');}return _0x3494e2+')';};var _0xb4c8cd={'where':{'id':_0x48ada7[_0x9dfd('0x55')]['id']}},_0x51ffa7,_0x4c495c,_0x20be3e,_0x10a243,_0x395186;_0xb4c8cd=_['merge']({},_0xb4c8cd,_0x48ada7[_0x9dfd('0x44')]);return db[_0x9dfd('0x30')][_0x9dfd('0x4b')](_0xb4c8cd)['then'](function(_0x5d898c){if(_0x5d898c){_0x51ffa7=_0x5d898c;return _0x5d898c[_0x9dfd('0x6e')]();}return null;})[_0x9dfd('0x25')](function(_0x464826){if(_0x464826){if(!_0x464826['length']){throw new db[(_0x9dfd('0x6f'))][(_0x9dfd('0x70'))](_0x9dfd('0x8b'),0x193);}_0x4c495c=_0x464826;return db[_0x9dfd('0x8c')][_0x9dfd('0x47')]({'raw':!![]});}return null;})[_0x9dfd('0x25')](function(_0xaea1f){if(_0xaea1f){_0x20be3e=_[_0x9dfd('0x8d')](_0xaea1f,'id');var _0x1cf344;var _0x57c4c6=squel[_0x9dfd('0x71')]();_0x57c4c6[_0x9dfd('0x72')](_0x51ffa7[_0x9dfd('0x73')]);for(var _0x3b3fb5=0x0;_0x3b3fb5<_0x4c495c[_0x9dfd('0x4a')];_0x3b3fb5+=0x1){_0x1cf344=_0x4c495c[_0x3b3fb5][_0x9dfd('0x74')]?_0x20be3e[_0x4c495c[_0x3b3fb5]['MetricId']][_0x9dfd('0x75')]:_0x4c495c[_0x3b3fb5][_0x9dfd('0x6b')];_0x1cf344=_0x4c495c[_0x3b3fb5][_0x9dfd('0x76')]?_[_0x9dfd('0x77')](_0x167acb[_0x4c495c[_0x3b3fb5][_0x9dfd('0x76')]],'%s',_0x1cf344):_0x1cf344;_0x1cf344=_0x4c495c[_0x3b3fb5][_0x9dfd('0x78')]?_[_0x9dfd('0x77')](_0x485631[_0x4c495c[_0x3b3fb5]['format']],'%s',_0x1cf344):_0x1cf344;if(_0x4c495c[_0x3b3fb5]['groupBy']){_0x57c4c6[_0x9dfd('0x82')](_0x1cf344);}_0x4c495c[_0x3b3fb5][_0x9dfd('0x79')]&&_0x57c4c6[_0x9dfd('0x3d')](_0x1cf344,_0x4c495c[_0x3b3fb5]['orderBy']===_0x9dfd('0x7a')?![]:!![]);_0x57c4c6[_0x9dfd('0x6b')](_0x1cf344,_0x4c495c[_0x3b3fb5][_0x9dfd('0x7b')]||_0x1cf344);}if(_0x51ffa7['joins']){_0x51ffa7['joins']=JSON[_0x9dfd('0x8f')](_0x51ffa7[_0x9dfd('0x7c')]);for(var _0x4aca2f=0x0;_0x4aca2f<_0x51ffa7['joins'][_0x9dfd('0x4a')];_0x4aca2f+=0x1){if(_0x51ffa7[_0x9dfd('0x7c')][_0x4aca2f]['type']&&_[_0x9dfd('0x64')](_0x28a74d,_0x51ffa7[_0x9dfd('0x7c')][_0x4aca2f][_0x9dfd('0x33')])&&_0x51ffa7[_0x9dfd('0x7c')][_0x4aca2f][_0x9dfd('0x7d')]&&_0x51ffa7[_0x9dfd('0x7c')][_0x4aca2f]['foreignTable']&&_0x51ffa7[_0x9dfd('0x7c')][_0x4aca2f][_0x9dfd('0x7f')]){_0x57c4c6[_0x51ffa7['joins'][_0x4aca2f][_0x9dfd('0x33')]](_0x51ffa7['joins'][_0x4aca2f][_0x9dfd('0x7e')],null,util[_0x9dfd('0x78')](_0x9dfd('0x80'),_0x51ffa7[_0x9dfd('0x73')],_0x51ffa7['joins'][_0x4aca2f][_0x9dfd('0x7d')],_0x51ffa7['joins'][_0x4aca2f][_0x9dfd('0x7e')],_0x51ffa7[_0x9dfd('0x7c')][_0x4aca2f]['foreignKey']));}}}if(_0x51ffa7[_0x9dfd('0x81')]){_0x51ffa7['conditions']=JSON['parse'](_0x51ffa7[_0x9dfd('0x81')]);_0x57c4c6[_0x9dfd('0x3f')](_0x53ab1e(_0x51ffa7[_0x9dfd('0x81')][_0x9dfd('0x82')]));}_0x395186=_0x57c4c6['clone']();_0x57c4c6['limit'](_0x42fd79);_0x57c4c6[_0x9dfd('0x1e')](0x0);logger['debug'](_0x9dfd('0x84'),_0x57c4c6[_0x9dfd('0x85')]());return dbH['sequelize'][_0x9dfd('0x35')](_0x57c4c6[_0x9dfd('0x85')](),{'type':dbH[_0x9dfd('0x86')][_0x9dfd('0x87')]['SELECT']});}})[_0x9dfd('0x25')](function(){return{'sql':_0x395186[_0x9dfd('0x85')]()};})['then'](respondWithResult(_0x5a4f31,null))[_0x9dfd('0x4c')](handleError(_0x5a4f31,null));}; \ No newline at end of file +var _0xea56=['groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','replace','output','fullPath','%s-%s.%s','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','value','debug','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomReports','error','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format'];(function(_0x2dc9ea,_0x46bca6){var _0x34c743=function(_0x2a60d2){while(--_0x2a60d2){_0x2dc9ea['push'](_0x2dc9ea['shift']());}};_0x34c743(++_0x46bca6);}(_0xea56,0xd4));var _0x6ea5=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xea56[_0x5cabfd];return _0x4bc06c;};'use strict';var emlformat=require(_0x6ea5('0x0'));var rimraf=require(_0x6ea5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ea5('0x2'));var rp=require(_0x6ea5('0x3'));var moment=require(_0x6ea5('0x4'));var BPromise=require(_0x6ea5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6ea5('0x6'));var sox=require(_0x6ea5('0x7'));var csv=require(_0x6ea5('0x8'));var ejs=require(_0x6ea5('0x9'));var fs=require('fs');var fs_extra=require(_0x6ea5('0xa'));var _=require(_0x6ea5('0xb'));var squel=require(_0x6ea5('0xc'));var crypto=require(_0x6ea5('0xd'));var jsforce=require(_0x6ea5('0xe'));var deskjs=require(_0x6ea5('0xf'));var toCsv=require(_0x6ea5('0x8'));var querystring=require('querystring');var Papa=require(_0x6ea5('0x10'));var Redis=require('ioredis');var authService=require(_0x6ea5('0x11'));var qs=require(_0x6ea5('0x12'));var as=require(_0x6ea5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ea5('0x14'))(_0x6ea5('0x15'));var utils=require(_0x6ea5('0x16'));var config=require(_0x6ea5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ea5('0x18'))['db'];var dbH=require('../../mysqldb')[_0x6ea5('0x19')];function respondWithStatusCode(_0x11a7c2,_0xf75a0b){_0xf75a0b=_0xf75a0b||0xcc;return function(_0x30b2d6){if(_0x30b2d6){return _0x11a7c2[_0x6ea5('0x1a')](_0xf75a0b);}return _0x11a7c2[_0x6ea5('0x1b')](_0xf75a0b)[_0x6ea5('0x1c')]();};}function respondWithResult(_0x57de2d,_0x5815c5){_0x5815c5=_0x5815c5||0xc8;return function(_0x4e986a){if(_0x4e986a){return _0x57de2d[_0x6ea5('0x1b')](_0x5815c5)['json'](_0x4e986a);}};}function respondWithFilteredResult(_0x42a6ad,_0x10bbff){return function(_0x4c7fe4){if(_0x4c7fe4){var _0x4a0298=typeof _0x10bbff[_0x6ea5('0x1d')]===_0x6ea5('0x1e')&&typeof _0x10bbff[_0x6ea5('0x1f')]===_0x6ea5('0x1e');var _0x58d5f5=_0x4c7fe4[_0x6ea5('0x20')];var _0x2eaf8c=_0x4a0298?0x0:_0x10bbff['offset'];var _0x953f1e=_0x4a0298?_0x4c7fe4[_0x6ea5('0x20')]:_0x10bbff[_0x6ea5('0x1d')]+_0x10bbff['limit'];var _0x391e77;if(_0x953f1e>=_0x58d5f5){_0x953f1e=_0x58d5f5;_0x391e77=0xc8;}else{_0x391e77=0xce;}_0x42a6ad[_0x6ea5('0x1b')](_0x391e77);return _0x42a6ad[_0x6ea5('0x21')](_0x6ea5('0x22'),_0x2eaf8c+'-'+_0x953f1e+'/'+_0x58d5f5)['json'](_0x4c7fe4);}return null;};}function patchUpdates(_0x21a6da){return function(_0x2a693f){try{jsonpatch[_0x6ea5('0x23')](_0x2a693f,_0x21a6da,!![]);}catch(_0x30cc2d){return BPromise[_0x6ea5('0x24')](_0x30cc2d);}return _0x2a693f[_0x6ea5('0x25')]();};}function saveUpdates(_0x5a6742,_0x39db3f){return function(_0x3e853c){if(_0x3e853c){return _0x3e853c[_0x6ea5('0x26')](_0x5a6742)['then'](function(_0x52e0df){return _0x52e0df;});}return null;};}function removeEntity(_0x3c56b1,_0x2ae81b){return function(_0x1c9014){if(_0x1c9014){return _0x1c9014[_0x6ea5('0x27')]()[_0x6ea5('0x28')](function(){var _0x1138fd=_0x1c9014[_0x6ea5('0x29')]({'plain':!![]});var _0x30ae01=_0x6ea5('0x2a');return db['UserProfileResource'][_0x6ea5('0x27')]({'where':{'type':_0x30ae01,'resourceId':_0x1138fd['id']}})[_0x6ea5('0x28')](function(){return _0x1c9014;});})[_0x6ea5('0x28')](function(){_0x3c56b1[_0x6ea5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e2dc,_0x9790a3){return function(_0x379384){if(!_0x379384){_0x51e2dc[_0x6ea5('0x1a')](0x194);}return _0x379384;};}function handleError(_0x1aad73,_0x1868b1){_0x1868b1=_0x1868b1||0x1f4;return function(_0x210883){logger[_0x6ea5('0x2b')](_0x210883['stack']);if(_0x210883[_0x6ea5('0x2c')]){delete _0x210883[_0x6ea5('0x2c')];}_0x1aad73[_0x6ea5('0x1b')](_0x1868b1)[_0x6ea5('0x2d')](_0x210883);};}exports[_0x6ea5('0x2e')]=function(_0x404650,_0x2b4135){var _0xe05ef0={},_0x1a89ba={},_0x37079b={'count':0x0,'rows':[]};var _0x29e755=_[_0x6ea5('0x2f')](db[_0x6ea5('0x30')]['rawAttributes'],function(_0x34f8f8){return{'name':_0x34f8f8[_0x6ea5('0x31')],'type':_0x34f8f8[_0x6ea5('0x32')][_0x6ea5('0x33')]};});_0x1a89ba[_0x6ea5('0x34')]=_[_0x6ea5('0x2f')](_0x29e755,'name');_0x1a89ba['query']=_['keys'](_0x404650['query']);_0x1a89ba[_0x6ea5('0x35')]=_[_0x6ea5('0x36')](_0x1a89ba[_0x6ea5('0x34')],_0x1a89ba[_0x6ea5('0x37')]);_0xe05ef0[_0x6ea5('0x38')]=_['intersection'](_0x1a89ba[_0x6ea5('0x34')],qs[_0x6ea5('0x39')](_0x404650[_0x6ea5('0x37')]['fields']));_0xe05ef0[_0x6ea5('0x38')]=_0xe05ef0[_0x6ea5('0x38')]['length']?_0xe05ef0[_0x6ea5('0x38')]:_0x1a89ba[_0x6ea5('0x34')];if(!_0x404650[_0x6ea5('0x37')][_0x6ea5('0x3a')]('nolimit')){_0xe05ef0[_0x6ea5('0x1f')]=qs[_0x6ea5('0x1f')](_0x404650['query']['limit']);_0xe05ef0['offset']=qs['offset'](_0x404650[_0x6ea5('0x37')][_0x6ea5('0x1d')]);}_0xe05ef0[_0x6ea5('0x3b')]=qs[_0x6ea5('0x3c')](_0x404650['query'][_0x6ea5('0x3c')]);_0xe05ef0[_0x6ea5('0x3d')]=qs['filters'](_[_0x6ea5('0x3e')](_0x404650['query'],_0x1a89ba[_0x6ea5('0x35')]),_0x29e755);if(_0x404650['query'][_0x6ea5('0x3f')]){_0xe05ef0['where']=_['merge'](_0xe05ef0[_0x6ea5('0x3d')],{'$or':_[_0x6ea5('0x2f')](_0x29e755,function(_0x335df5){if(_0x335df5[_0x6ea5('0x32')]!==_0x6ea5('0x40')){var _0x19ee48={};_0x19ee48[_0x335df5[_0x6ea5('0x2c')]]={'$like':'%'+_0x404650[_0x6ea5('0x37')]['filter']+'%'};return _0x19ee48;}})});}_0xe05ef0=_[_0x6ea5('0x41')]({},_0xe05ef0,_0x404650[_0x6ea5('0x42')]);var _0x50ab0e={'where':_0xe05ef0['where']};return db['AnalyticCustomReport'][_0x6ea5('0x20')](_0x50ab0e)['then'](function(_0x26720f){_0x37079b[_0x6ea5('0x20')]=_0x26720f;if(_0x404650['query'][_0x6ea5('0x43')]){_0xe05ef0[_0x6ea5('0x44')]=[{'all':!![]}];}return db[_0x6ea5('0x30')][_0x6ea5('0x45')](_0xe05ef0);})[_0x6ea5('0x28')](function(_0x43ba30){_0x37079b[_0x6ea5('0x46')]=_0x43ba30;return _0x37079b;})['then'](respondWithFilteredResult(_0x2b4135,_0xe05ef0))[_0x6ea5('0x47')](handleError(_0x2b4135,null));};exports['show']=function(_0x137c34,_0x4bb7fd){var _0x22f3bd={'raw':![],'where':{'id':_0x137c34[_0x6ea5('0x48')]['id']}},_0x4b9b89={};_0x4b9b89[_0x6ea5('0x34')]=_[_0x6ea5('0x49')](db[_0x6ea5('0x30')][_0x6ea5('0x4a')]);_0x4b9b89['query']=_[_0x6ea5('0x49')](_0x137c34[_0x6ea5('0x37')]);_0x4b9b89[_0x6ea5('0x35')]=_['intersection'](_0x4b9b89[_0x6ea5('0x34')],_0x4b9b89[_0x6ea5('0x37')]);_0x22f3bd[_0x6ea5('0x38')]=_[_0x6ea5('0x36')](_0x4b9b89[_0x6ea5('0x34')],qs['fields'](_0x137c34['query']['fields']));_0x22f3bd[_0x6ea5('0x38')]=_0x22f3bd[_0x6ea5('0x38')][_0x6ea5('0x4b')]?_0x22f3bd[_0x6ea5('0x38')]:_0x4b9b89[_0x6ea5('0x34')];if(_0x137c34['query'][_0x6ea5('0x43')]){_0x22f3bd['include']=[{'all':!![]}];}_0x22f3bd=_[_0x6ea5('0x41')]({},_0x22f3bd,_0x137c34[_0x6ea5('0x42')]);return db[_0x6ea5('0x30')][_0x6ea5('0x4c')](_0x22f3bd)[_0x6ea5('0x28')](handleEntityNotFound(_0x4bb7fd,null))[_0x6ea5('0x28')](respondWithResult(_0x4bb7fd,null))['catch'](handleError(_0x4bb7fd,null));};exports[_0x6ea5('0x4d')]=function(_0x2bc04f,_0x1cdad5){return db['AnalyticCustomReport']['create'](_0x2bc04f[_0x6ea5('0x4e')],{})['then'](function(_0x1706b4){var _0x1c1695=_0x2bc04f['user'][_0x6ea5('0x29')]({'plain':!![]});if(!_0x1c1695)throw new Error(_0x6ea5('0x4f'));if(_0x1c1695[_0x6ea5('0x50')]===_0x6ea5('0x51')){var _0x333de1=_0x1706b4['get']({'plain':!![]});var _0x103b28=_0x6ea5('0x52');return db['UserProfileSection'][_0x6ea5('0x4c')]({'where':{'name':_0x103b28,'userProfileId':_0x1c1695[_0x6ea5('0x53')]},'raw':!![]})[_0x6ea5('0x28')](function(_0x5a54c6){if(_0x5a54c6&&_0x5a54c6[_0x6ea5('0x54')]===0x0){return db['UserProfileResource'][_0x6ea5('0x4d')]({'name':_0x333de1[_0x6ea5('0x2c')],'resourceId':_0x333de1['id'],'type':'CustomReports','sectionId':_0x5a54c6['id']},{})[_0x6ea5('0x28')](function(){return _0x1706b4;});}else{return _0x1706b4;}})['catch'](function(_0x293b60){logger[_0x6ea5('0x2b')](_0x6ea5('0x55'),_0x293b60);throw _0x293b60;});}return _0x1706b4;})[_0x6ea5('0x28')](respondWithResult(_0x1cdad5,0xc9))[_0x6ea5('0x47')](handleError(_0x1cdad5,null));};exports[_0x6ea5('0x26')]=function(_0x3a61d4,_0xcaed2){if(_0x3a61d4['body']['id']){delete _0x3a61d4[_0x6ea5('0x4e')]['id'];}return db[_0x6ea5('0x30')]['find']({'where':{'id':_0x3a61d4[_0x6ea5('0x48')]['id']}})[_0x6ea5('0x28')](handleEntityNotFound(_0xcaed2,null))[_0x6ea5('0x28')](saveUpdates(_0x3a61d4[_0x6ea5('0x4e')],null))['then'](respondWithResult(_0xcaed2,null))['catch'](handleError(_0xcaed2,null));};exports[_0x6ea5('0x27')]=function(_0x16c790,_0x4d8898){return db[_0x6ea5('0x30')][_0x6ea5('0x4c')]({'where':{'id':_0x16c790[_0x6ea5('0x48')]['id']}})[_0x6ea5('0x28')](handleEntityNotFound(_0x4d8898,null))['then'](removeEntity(_0x4d8898,null))[_0x6ea5('0x47')](handleError(_0x4d8898,null));};exports[_0x6ea5('0x56')]=function(_0x44f9c2,_0x1dfa09){var _0x236afc=0xa;var _0x49156c=[_0x6ea5('0x57'),'left_join',_0x6ea5('0x58'),_0x6ea5('0x59')];var _0x4d5861={'SUM':_0x6ea5('0x5a'),'COUNT':_0x6ea5('0x5b'),'COUNT DISTINCT':_0x6ea5('0x5c'),'MAX':_0x6ea5('0x5d'),'MIN':_0x6ea5('0x5e'),'AVG':_0x6ea5('0x5f'),'GROUP_CONCAT':_0x6ea5('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6ea5('0x61')};var _0x339189={'SEC_TO_TIME':_0x6ea5('0x62'),'DATE':'DATE(%s)','HOUR':_0x6ea5('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6ea5('0x64')};var _0x3a0194=function(_0x48d632){return!_[_0x6ea5('0x65')]([_0x6ea5('0x66'),_0x6ea5('0x67'),_0x6ea5('0x68'),_0x6ea5('0x69')],_0x48d632);};var _0x19a29e=function(_0x5e3534){if(!_0x5e3534||!_0x5e3534[_0x6ea5('0x6a')]['length']){return'';}for(var _0x2eacfc='(',_0x1ec5b5=0x0;_0x1ec5b5<_0x5e3534['rules'][_0x6ea5('0x4b')];_0x1ec5b5+=0x1){_0x1ec5b5>0x0&&(_0x2eacfc+='\x20'+_0x5e3534[_0x6ea5('0x6b')]+'\x20');_0x2eacfc+=_0x5e3534[_0x6ea5('0x6a')][_0x1ec5b5][_0x6ea5('0x6c')]?_0x19a29e(_0x5e3534['rules'][_0x1ec5b5]['group']):_0x5e3534['rules'][_0x1ec5b5][_0x6ea5('0x6d')]+'\x20'+_0x5e3534[_0x6ea5('0x6a')][_0x1ec5b5][_0x6ea5('0x6e')]+(_0x3a0194(_0x5e3534[_0x6ea5('0x6a')][_0x1ec5b5][_0x6ea5('0x6e')])?'\x20'+_0x5e3534['rules'][_0x1ec5b5]['value']:'');}return _0x2eacfc+')';};var _0x555d88={'where':{'id':_0x44f9c2[_0x6ea5('0x48')]['id']}},_0x452b2e,_0x564c4c,_0x413c64,_0x1a4954,_0x4e3fec;_0x555d88=_['merge']({},_0x555d88,_0x44f9c2['options']);return db['AnalyticCustomReport'][_0x6ea5('0x4c')](_0x555d88)[_0x6ea5('0x28')](function(_0x333e8f){if(_0x333e8f){_0x452b2e=_0x333e8f;return _0x333e8f[_0x6ea5('0x6f')]();}return null;})[_0x6ea5('0x28')](function(_0x3f878a){if(_0x3f878a){if(!_0x3f878a[_0x6ea5('0x4b')]){throw new db[(_0x6ea5('0x70'))][(_0x6ea5('0x71'))](_0x6ea5('0x72'),0x193);}_0x564c4c=_0x3f878a;return db[_0x6ea5('0x73')][_0x6ea5('0x45')]({'raw':!![]});}return null;})[_0x6ea5('0x28')](function(_0x289499){if(_0x289499){_0x413c64=_[_0x6ea5('0x74')](_0x289499,'id');var _0x501ea5;var _0xfd9436=squel[_0x6ea5('0x75')]();_0xfd9436[_0x6ea5('0x76')](_0x452b2e[_0x6ea5('0x77')]);for(var _0x1405c2=0x0;_0x1405c2<_0x564c4c[_0x6ea5('0x4b')];_0x1405c2+=0x1){_0x501ea5=_0x564c4c[_0x1405c2][_0x6ea5('0x78')]?_0x413c64[_0x564c4c[_0x1405c2]['MetricId']][_0x6ea5('0x79')]:_0x564c4c[_0x1405c2]['field'];_0x501ea5=_0x564c4c[_0x1405c2][_0x6ea5('0x7a')]?_['replace'](_0x4d5861[_0x564c4c[_0x1405c2][_0x6ea5('0x7a')]],'%s',_0x501ea5):_0x501ea5;_0x501ea5=_0x564c4c[_0x1405c2][_0x6ea5('0x7b')]?_['replace'](_0x339189[_0x564c4c[_0x1405c2][_0x6ea5('0x7b')]],'%s',_0x501ea5):_0x501ea5;if(_0x564c4c[_0x1405c2][_0x6ea5('0x7c')]){_0xfd9436[_0x6ea5('0x6c')](_0x501ea5);}_0x564c4c[_0x1405c2][_0x6ea5('0x7d')]&&_0xfd9436[_0x6ea5('0x3b')](_0x501ea5,_0x564c4c[_0x1405c2][_0x6ea5('0x7d')]===_0x6ea5('0x7e')?![]:!![]);_0xfd9436['field'](_0x501ea5,_0x564c4c[_0x1405c2][_0x6ea5('0x7f')]||_0x501ea5);}if(_0x452b2e[_0x6ea5('0x80')]){_0x452b2e[_0x6ea5('0x80')]=JSON[_0x6ea5('0x81')](_0x452b2e[_0x6ea5('0x80')]);for(var _0x31b670=0x0;_0x31b670<_0x452b2e[_0x6ea5('0x80')][_0x6ea5('0x4b')];_0x31b670+=0x1){if(_0x452b2e[_0x6ea5('0x80')][_0x31b670][_0x6ea5('0x32')]&&_[_0x6ea5('0x65')](_0x49156c,_0x452b2e[_0x6ea5('0x80')][_0x31b670][_0x6ea5('0x32')])&&_0x452b2e['joins'][_0x31b670][_0x6ea5('0x82')]&&_0x452b2e[_0x6ea5('0x80')][_0x31b670]['foreignTable']&&_0x452b2e[_0x6ea5('0x80')][_0x31b670][_0x6ea5('0x83')]){_0xfd9436[_0x452b2e[_0x6ea5('0x80')][_0x31b670]['type']](_0x452b2e[_0x6ea5('0x80')][_0x31b670]['foreignTable'],null,util[_0x6ea5('0x7b')](_0x6ea5('0x84'),_0x452b2e[_0x6ea5('0x77')],_0x452b2e['joins'][_0x31b670]['parentKey'],_0x452b2e['joins'][_0x31b670][_0x6ea5('0x85')],_0x452b2e['joins'][_0x31b670][_0x6ea5('0x83')]));}}}if(_0x452b2e[_0x6ea5('0x86')]){_0x452b2e[_0x6ea5('0x86')]=JSON[_0x6ea5('0x81')](_0x452b2e['conditions']);_0xfd9436[_0x6ea5('0x3d')](_0x19a29e(_0x452b2e[_0x6ea5('0x86')][_0x6ea5('0x6c')]));}_0x4e3fec=_0xfd9436[_0x6ea5('0x87')]();_0xfd9436[_0x6ea5('0x1f')](_0x236afc);_0xfd9436['offset'](0x0);logger['debug'](_0x6ea5('0x88'),_0xfd9436[_0x6ea5('0x89')]());return dbH[_0x6ea5('0x8a')][_0x6ea5('0x37')](_0xfd9436[_0x6ea5('0x89')](),{'type':dbH[_0x6ea5('0x8a')][_0x6ea5('0x8b')][_0x6ea5('0x8c')]});}})[_0x6ea5('0x28')](respondWithResult(_0x1dfa09,null))[_0x6ea5('0x47')](handleError(_0x1dfa09,null));};function runReport(_0x5e409a,_0x39825f,_0x301af3){var _0x2ca83f=_0x39825f[_0x6ea5('0x2c')];var _0x1aa8af=0xa;var _0x3e7f28=[_0x6ea5('0x57'),_0x6ea5('0x8d'),_0x6ea5('0x58'),_0x6ea5('0x59')];var _0x3f0286={'SUM':_0x6ea5('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6ea5('0x5d'),'MIN':_0x6ea5('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6ea5('0x60'),'GROUP_CONCAT ASC':_0x6ea5('0x8e'),'GROUP_CONCAT DESC':_0x6ea5('0x61')};var _0x30f21f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6ea5('0x8f'),'HOUR':'HOUR(%s)','ROUND':_0x6ea5('0x90'),'UNIX_TIMESTAMP':_0x6ea5('0x64')};var _0x5069ec=function(_0x59889a){return!_[_0x6ea5('0x65')]([_0x6ea5('0x66'),_0x6ea5('0x67'),'IS\x20EMPTY',_0x6ea5('0x69')],_0x59889a);};var _0x3b4c22=function(_0x557c4e){if(!_0x557c4e||!_0x557c4e[_0x6ea5('0x6a')]['length']){return'';}for(var _0x587f91='(',_0x4d355e=0x0;_0x4d355e<_0x557c4e['rules'][_0x6ea5('0x4b')];_0x4d355e+=0x1){_0x4d355e>0x0&&(_0x587f91+='\x20'+_0x557c4e[_0x6ea5('0x6b')]+'\x20');_0x587f91+=_0x557c4e[_0x6ea5('0x6a')][_0x4d355e]['group']?_0x3b4c22(_0x557c4e[_0x6ea5('0x6a')][_0x4d355e]['group']):_0x557c4e[_0x6ea5('0x6a')][_0x4d355e][_0x6ea5('0x6d')]+'\x20'+_0x557c4e[_0x6ea5('0x6a')][_0x4d355e]['condition']+(_0x5069ec(_0x557c4e[_0x6ea5('0x6a')][_0x4d355e][_0x6ea5('0x6e')])?'\x20'+_0x557c4e[_0x6ea5('0x6a')][_0x4d355e]['value']:'');}return _0x587f91+')';};var _0x18ffd0={'where':{'id':_0x5e409a['id']}},_0x1dc209,_0xd0c406,_0x5c7fc3,_0x4b1ff5,_0x15cfd3;_0x18ffd0=_[_0x6ea5('0x41')]({},_0x18ffd0,_0x301af3);return db[_0x6ea5('0x30')][_0x6ea5('0x4c')](_0x18ffd0)[_0x6ea5('0x28')](function(_0x7877a7){if(_0x7877a7){_0x1dc209=_0x7877a7;return _0x7877a7['getFields']();}return null;})[_0x6ea5('0x28')](function(_0xf6b2e4){if(_0xf6b2e4){if(!_0xf6b2e4['length']){throw new db[(_0x6ea5('0x70'))][(_0x6ea5('0x71'))](_0x6ea5('0x72'),0x193);}_0xd0c406=_0xf6b2e4;return db[_0x6ea5('0x73')]['findAll']({'raw':!![]});}return null;})[_0x6ea5('0x28')](function(_0x1328e5){if(_0x1328e5){_0x5c7fc3=_[_0x6ea5('0x74')](_0x1328e5,'id');var _0x3d4ee5;var _0xa7de8b=squel[_0x6ea5('0x75')]();_0xa7de8b[_0x6ea5('0x76')](_0x1dc209['table']);for(var _0x1babd9=0x0;_0x1babd9<_0xd0c406[_0x6ea5('0x4b')];_0x1babd9+=0x1){_0x3d4ee5=_0xd0c406[_0x1babd9][_0x6ea5('0x78')]?_0x5c7fc3[_0xd0c406[_0x1babd9][_0x6ea5('0x78')]]['metric']:_0xd0c406[_0x1babd9][_0x6ea5('0x6d')];_0x3d4ee5=_0xd0c406[_0x1babd9]['function']?_[_0x6ea5('0x91')](_0x3f0286[_0xd0c406[_0x1babd9][_0x6ea5('0x7a')]],'%s',_0x3d4ee5):_0x3d4ee5;_0x3d4ee5=_0xd0c406[_0x1babd9][_0x6ea5('0x7b')]?_[_0x6ea5('0x91')](_0x30f21f[_0xd0c406[_0x1babd9]['format']],'%s',_0x3d4ee5):_0x3d4ee5;if(_0xd0c406[_0x1babd9][_0x6ea5('0x7c')]){_0xa7de8b[_0x6ea5('0x6c')](_0x3d4ee5);}_0xd0c406[_0x1babd9][_0x6ea5('0x7d')]&&_0xa7de8b[_0x6ea5('0x3b')](_0x3d4ee5,_0xd0c406[_0x1babd9][_0x6ea5('0x7d')]===_0x6ea5('0x7e')?![]:!![]);_0xa7de8b[_0x6ea5('0x6d')](_0x3d4ee5,_0xd0c406[_0x1babd9][_0x6ea5('0x7f')]||_0x3d4ee5);}if(_0x1dc209[_0x6ea5('0x80')]){_0x1dc209['joins']=JSON['parse'](_0x1dc209[_0x6ea5('0x80')]);for(var _0x2a5ca1=0x0;_0x2a5ca1<_0x1dc209[_0x6ea5('0x80')]['length'];_0x2a5ca1+=0x1){if(_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1][_0x6ea5('0x32')]&&_[_0x6ea5('0x65')](_0x3e7f28,_0x1dc209['joins'][_0x2a5ca1][_0x6ea5('0x32')])&&_0x1dc209['joins'][_0x2a5ca1]['parentKey']&&_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1][_0x6ea5('0x85')]&&_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1][_0x6ea5('0x83')]){_0xa7de8b[_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1]['type']](_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1][_0x6ea5('0x85')],null,util[_0x6ea5('0x7b')]('%s.%s\x20=\x20%s.%s',_0x1dc209[_0x6ea5('0x77')],_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1][_0x6ea5('0x82')],_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1]['foreignTable'],_0x1dc209[_0x6ea5('0x80')][_0x2a5ca1][_0x6ea5('0x83')]));}}}if(_0x1dc209[_0x6ea5('0x86')]){_0x1dc209['conditions']=JSON[_0x6ea5('0x81')](_0x1dc209[_0x6ea5('0x86')]);_0xa7de8b[_0x6ea5('0x3d')](_0x3b4c22(_0x1dc209['conditions']['group']));}_0x15cfd3=_0xa7de8b[_0x6ea5('0x87')]();_0xa7de8b[_0x6ea5('0x1f')](_0x1aa8af);_0xa7de8b[_0x6ea5('0x1d')](0x0);return;}})[_0x6ea5('0x28')](function(){if(_0x39825f[_0x6ea5('0x92')]==='web'){return null;}var _0x3cd009=_['merge'](_0x39825f,{'name':_0x39825f[_0x6ea5('0x93')]||_0x39825f[_0x6ea5('0x2c')]||_0x1dc209['name'],'basename':_0x2ca83f,'savename':util[_0x6ea5('0x7b')](_0x6ea5('0x94'),_0x39825f[_0x6ea5('0x2c')]||_0x1dc209[_0x6ea5('0x2c')],require('randomstring')[_0x6ea5('0x95')](0x4),_0x39825f['output']||'csv'),'reportId':_0x1dc209['id'],'reportType':'custom'});return db[_0x6ea5('0x96')][_0x6ea5('0x4d')](_0x3cd009,{'raw':!![]});})['then'](function(_0x5bcad3){if(_0x1dc209[_0x6ea5('0x77')]===_0x6ea5('0x97')){_0x15cfd3[_0x6ea5('0x3d')](_0x1dc209[_0x6ea5('0x77')]+_0x6ea5('0x98'),_0x39825f[_0x6ea5('0x99')],_0x39825f[_0x6ea5('0x9a')]);}else{_0x15cfd3['where'](_0x1dc209['table']+_0x6ea5('0x9b'),_0x39825f['startDate'],_0x39825f[_0x6ea5('0x9a')]);}if(_0x5bcad3){logger[_0x6ea5('0x9c')]('Run\x20Query:',_0x15cfd3[_0x6ea5('0x89')]());require(_0x6ea5('0x9d'))[_0x6ea5('0x9e')](path[_0x6ea5('0x57')](__dirname,_0x6ea5('0x9f'),_0x5bcad3['output']),[_0x5bcad3['id'],_0x15cfd3[_0x6ea5('0x89')](),path[_0x6ea5('0x57')](__dirname,_0x6ea5('0xa0'),_0x5bcad3[_0x6ea5('0xa1')]),_0x2ca83f]);return _0x5bcad3;}else{var _0x3d4d80=squel[_0x6ea5('0x75')]();_0x3d4d80[_0x6ea5('0x76')]('('+_0x15cfd3[_0x6ea5('0x89')]()+')',_0x6ea5('0xa2'));_0x3d4d80[_0x6ea5('0x6d')](_0x6ea5('0xa3'),'count');_0x15cfd3['limit'](_0x39825f['limit']||_0x1aa8af);_0x15cfd3['offset'](_0x39825f[_0x6ea5('0x1d')]||0x0);return dbH[_0x6ea5('0x8a')][_0x6ea5('0x37')](_0x3d4d80[_0x6ea5('0x89')](),{'type':dbH[_0x6ea5('0x8a')][_0x6ea5('0x8b')][_0x6ea5('0x8c')]})[_0x6ea5('0x28')](function(_0x46fb9a){if(!_0x46fb9a[_0x6ea5('0x4b')]){_0x4b1ff5=0x0;}else{_0x4b1ff5=_0x46fb9a[0x0][_0x6ea5('0x20')]||0x0;}return dbH[_0x6ea5('0x8a')][_0x6ea5('0x37')](_0x15cfd3[_0x6ea5('0x89')](),{'type':dbH[_0x6ea5('0x8a')][_0x6ea5('0x8b')]['SELECT']});})['then'](function(_0x28aa63){return{'rows':_0x28aa63||[],'count':_0x4b1ff5};});}});}exports[_0x6ea5('0xa4')]=function(_0x17dc06,_0xd2a14c){return runReport(_0x17dc06[_0x6ea5('0x48')],_0x17dc06['query'],_0x17dc06[_0x6ea5('0x42')])[_0x6ea5('0x28')](respondWithResult(_0xd2a14c,null))[_0x6ea5('0x47')](handleError(_0xd2a14c,null));};exports[_0x6ea5('0xa5')]=runReport;exports[_0x6ea5('0x37')]=function(_0x1fd5a1,_0x4635de){var _0xf177f1=0xa;var _0x43d9f6=[_0x6ea5('0x57'),'left_join',_0x6ea5('0x58'),_0x6ea5('0x59')];var _0x51fa9b={'SUM':_0x6ea5('0x5a'),'COUNT':_0x6ea5('0x5b'),'COUNT DISTINCT':_0x6ea5('0x5c'),'MAX':_0x6ea5('0x5d'),'MIN':'MIN(%s)','AVG':_0x6ea5('0x5f'),'GROUP_CONCAT':_0x6ea5('0x60'),'GROUP_CONCAT ASC':_0x6ea5('0x8e'),'GROUP_CONCAT DESC':_0x6ea5('0x61')};var _0x4f7ac9={'SEC_TO_TIME':_0x6ea5('0x62'),'DATE':'DATE(%s)','HOUR':_0x6ea5('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6ea5('0x64')};var _0x50999d=function(_0x10b861){return!_[_0x6ea5('0x65')]([_0x6ea5('0x66'),'IS\x20NOT\x20NULL',_0x6ea5('0x68'),_0x6ea5('0x69')],_0x10b861);};var _0xbd691c=function(_0x19b991){if(!_0x19b991||!_0x19b991['rules'][_0x6ea5('0x4b')]){return'';}for(var _0xf35054='(',_0x51d347=0x0;_0x51d347<_0x19b991['rules'][_0x6ea5('0x4b')];_0x51d347+=0x1){_0x51d347>0x0&&(_0xf35054+='\x20'+_0x19b991['operator']+'\x20');_0xf35054+=_0x19b991[_0x6ea5('0x6a')][_0x51d347][_0x6ea5('0x6c')]?_0xbd691c(_0x19b991[_0x6ea5('0x6a')][_0x51d347][_0x6ea5('0x6c')]):_0x19b991[_0x6ea5('0x6a')][_0x51d347][_0x6ea5('0x6d')]+'\x20'+_0x19b991[_0x6ea5('0x6a')][_0x51d347]['condition']+(_0x50999d(_0x19b991[_0x6ea5('0x6a')][_0x51d347][_0x6ea5('0x6e')])?'\x20'+_0x19b991['rules'][_0x51d347][_0x6ea5('0xa6')]:'');}return _0xf35054+')';};var _0x5cc013={'where':{'id':_0x1fd5a1[_0x6ea5('0x48')]['id']}},_0x19a1c0,_0xc56589,_0x2b0f9d,_0x22dc4a,_0x110a89;_0x5cc013=_[_0x6ea5('0x41')]({},_0x5cc013,_0x1fd5a1[_0x6ea5('0x42')]);return db[_0x6ea5('0x30')][_0x6ea5('0x4c')](_0x5cc013)['then'](function(_0x4bb7d4){if(_0x4bb7d4){_0x19a1c0=_0x4bb7d4;return _0x4bb7d4[_0x6ea5('0x6f')]();}return null;})['then'](function(_0x360243){if(_0x360243){if(!_0x360243[_0x6ea5('0x4b')]){throw new db[(_0x6ea5('0x70'))][(_0x6ea5('0x71'))](_0x6ea5('0x72'),0x193);}_0xc56589=_0x360243;return db[_0x6ea5('0x73')][_0x6ea5('0x45')]({'raw':!![]});}return null;})['then'](function(_0x52977b){if(_0x52977b){_0x2b0f9d=_[_0x6ea5('0x74')](_0x52977b,'id');var _0x5a61fe;var _0x27e128=squel['select']();_0x27e128[_0x6ea5('0x76')](_0x19a1c0[_0x6ea5('0x77')]);for(var _0x411efc=0x0;_0x411efc<_0xc56589['length'];_0x411efc+=0x1){_0x5a61fe=_0xc56589[_0x411efc]['MetricId']?_0x2b0f9d[_0xc56589[_0x411efc][_0x6ea5('0x78')]]['metric']:_0xc56589[_0x411efc][_0x6ea5('0x6d')];_0x5a61fe=_0xc56589[_0x411efc][_0x6ea5('0x7a')]?_[_0x6ea5('0x91')](_0x51fa9b[_0xc56589[_0x411efc]['function']],'%s',_0x5a61fe):_0x5a61fe;_0x5a61fe=_0xc56589[_0x411efc][_0x6ea5('0x7b')]?_[_0x6ea5('0x91')](_0x4f7ac9[_0xc56589[_0x411efc][_0x6ea5('0x7b')]],'%s',_0x5a61fe):_0x5a61fe;if(_0xc56589[_0x411efc]['groupBy']){_0x27e128['group'](_0x5a61fe);}_0xc56589[_0x411efc]['orderBy']&&_0x27e128['order'](_0x5a61fe,_0xc56589[_0x411efc]['orderBy']===_0x6ea5('0x7e')?![]:!![]);_0x27e128[_0x6ea5('0x6d')](_0x5a61fe,_0xc56589[_0x411efc][_0x6ea5('0x7f')]||_0x5a61fe);}if(_0x19a1c0['joins']){_0x19a1c0[_0x6ea5('0x80')]=JSON['parse'](_0x19a1c0['joins']);for(var _0xc97547=0x0;_0xc97547<_0x19a1c0[_0x6ea5('0x80')][_0x6ea5('0x4b')];_0xc97547+=0x1){if(_0x19a1c0[_0x6ea5('0x80')][_0xc97547][_0x6ea5('0x32')]&&_[_0x6ea5('0x65')](_0x43d9f6,_0x19a1c0[_0x6ea5('0x80')][_0xc97547][_0x6ea5('0x32')])&&_0x19a1c0['joins'][_0xc97547][_0x6ea5('0x82')]&&_0x19a1c0[_0x6ea5('0x80')][_0xc97547]['foreignTable']&&_0x19a1c0['joins'][_0xc97547][_0x6ea5('0x83')]){_0x27e128[_0x19a1c0[_0x6ea5('0x80')][_0xc97547][_0x6ea5('0x32')]](_0x19a1c0[_0x6ea5('0x80')][_0xc97547]['foreignTable'],null,util[_0x6ea5('0x7b')](_0x6ea5('0x84'),_0x19a1c0[_0x6ea5('0x77')],_0x19a1c0[_0x6ea5('0x80')][_0xc97547][_0x6ea5('0x82')],_0x19a1c0[_0x6ea5('0x80')][_0xc97547]['foreignTable'],_0x19a1c0[_0x6ea5('0x80')][_0xc97547][_0x6ea5('0x83')]));}}}if(_0x19a1c0[_0x6ea5('0x86')]){_0x19a1c0[_0x6ea5('0x86')]=JSON[_0x6ea5('0x81')](_0x19a1c0['conditions']);_0x27e128[_0x6ea5('0x3d')](_0xbd691c(_0x19a1c0[_0x6ea5('0x86')]['group']));}_0x110a89=_0x27e128['clone']();_0x27e128[_0x6ea5('0x1f')](_0xf177f1);_0x27e128[_0x6ea5('0x1d')](0x0);logger[_0x6ea5('0xa7')](_0x6ea5('0x88'),_0x27e128[_0x6ea5('0x89')]());return dbH[_0x6ea5('0x8a')][_0x6ea5('0x37')](_0x27e128[_0x6ea5('0x89')](),{'type':dbH[_0x6ea5('0x8a')][_0x6ea5('0x8b')][_0x6ea5('0x8c')]});}})[_0x6ea5('0x28')](function(){return{'sql':_0x110a89[_0x6ea5('0x89')]()};})[_0x6ea5('0x28')](respondWithResult(_0x4635de,null))[_0x6ea5('0x47')](handleError(_0x4635de,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6e7e9f4..e9f78ef 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 _0x2955=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x2955,0x10f));var _0x5295=function(_0x2d227f,_0x1eb359){_0x2d227f=_0x2d227f-0x0;var _0x299670=_0x2955[_0x2d227f];return _0x299670;};'use strict';var _=require(_0x5295('0x0'));var util=require(_0x5295('0x1'));var logger=require(_0x5295('0x2'))(_0x5295('0x3'));var moment=require(_0x5295('0x4'));var BPromise=require('bluebird');var rp=require(_0x5295('0x5'));var fs=require('fs');var path=require(_0x5295('0x6'));var rimraf=require(_0x5295('0x7'));var config=require(_0x5295('0x8'));var attributes=require(_0x5295('0x9'));module[_0x5295('0xa')]=function(_0x45a1db,_0x3df927){return _0x45a1db[_0x5295('0xb')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942d=['analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x5d01e3,_0x580578){var _0x4671b9=function(_0x233638){while(--_0x233638){_0x5d01e3['push'](_0x5d01e3['shift']());}};_0x4671b9(++_0x580578);}(_0x942d,0x1a1));var _0xd942=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x942d[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xd942('0x0'));var util=require(_0xd942('0x1'));var logger=require('../../config/logger')(_0xd942('0x2'));var moment=require(_0xd942('0x3'));var BPromise=require(_0xd942('0x4'));var rp=require(_0xd942('0x5'));var fs=require('fs');var path=require(_0xd942('0x6'));var rimraf=require(_0xd942('0x7'));var config=require('../../config/environment');var attributes=require(_0xd942('0x8'));module[_0xd942('0x9')]=function(_0x11f865,_0x2dda40){return _0x11f865[_0xd942('0xa')](_0xd942('0xb'),attributes,{'tableName':_0xd942('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 809a9bd..c35a50e 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 _0xeabc=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x5da01c,_0x53bf77){var _0x1216c2=function(_0x1d8513){while(--_0x1d8513){_0x5da01c['push'](_0x5da01c['shift']());}};_0x1216c2(++_0x53bf77);}(_0xeabc,0x89));var _0xceab=function(_0x285b7e,_0x2d98ef){_0x285b7e=_0x285b7e-0x0;var _0x40b98a=_0xeabc[_0x285b7e];return _0x40b98a;};'use strict';var _=require(_0xceab('0x0'));var util=require(_0xceab('0x1'));var moment=require(_0xceab('0x2'));var BPromise=require(_0xceab('0x3'));var rs=require(_0xceab('0x4'));var fs=require('fs');var Redis=require(_0xceab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xceab('0x6'));var logger=require(_0xceab('0x7'))('rpc');var config=require(_0xceab('0x8'));var jayson=require(_0xceab('0x9'));var client=jayson[_0xceab('0xa')][_0xceab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a2bf3,_0x21060b,_0x2a00a9){return new BPromise(function(_0x237e6f,_0x1252ed){return client[_0xceab('0xc')](_0x8a2bf3,_0x2a00a9)[_0xceab('0xd')](function(_0x2de1c8){logger['info'](_0xceab('0xe'),_0x21060b,_0xceab('0xf'));logger['debug'](_0xceab('0x10'),_0x21060b,_0xceab('0xf'),JSON['stringify'](_0x2de1c8));if(_0x2de1c8[_0xceab('0x11')]){if(_0x2de1c8[_0xceab('0x11')]['code']===0x1f4){logger['error'](_0xceab('0xe'),_0x21060b,_0x2de1c8[_0xceab('0x11')][_0xceab('0x12')]);return _0x1252ed(_0x2de1c8[_0xceab('0x11')][_0xceab('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x21060b,_0x2de1c8[_0xceab('0x11')]['message']);return _0x237e6f(_0x2de1c8['error']['message']);}else{logger[_0xceab('0x13')](_0xceab('0xe'),_0x21060b,_0xceab('0xf'));_0x237e6f(_0x2de1c8[_0xceab('0x14')][_0xceab('0x12')]);}})[_0xceab('0x15')](function(_0x277aa9){logger[_0xceab('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21060b,_0x277aa9);_0x1252ed(_0x277aa9);});});} \ No newline at end of file +var _0xd403=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd403,0x1f2));var _0x3d40=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xd403[_0x39096d];return _0x13da4f;};'use strict';var _=require('lodash');var util=require(_0x3d40('0x0'));var moment=require(_0x3d40('0x1'));var BPromise=require(_0x3d40('0x2'));var rs=require(_0x3d40('0x3'));var fs=require('fs');var Redis=require(_0x3d40('0x4'));var db=require(_0x3d40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d40('0x6'))(_0x3d40('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d40('0x8'));var client=jayson[_0x3d40('0x9')][_0x3d40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1932bf,_0x5129ef,_0x46f3b1){return new BPromise(function(_0x97edb,_0x411faf){return client[_0x3d40('0xb')](_0x1932bf,_0x46f3b1)[_0x3d40('0xc')](function(_0x1c29ad){logger[_0x3d40('0xd')](_0x3d40('0xe'),_0x5129ef,'request\x20sent');logger[_0x3d40('0xf')](_0x3d40('0x10'),_0x5129ef,_0x3d40('0x11'),JSON[_0x3d40('0x12')](_0x1c29ad));if(_0x1c29ad[_0x3d40('0x13')]){if(_0x1c29ad[_0x3d40('0x13')][_0x3d40('0x14')]===0x1f4){logger[_0x3d40('0x13')](_0x3d40('0xe'),_0x5129ef,_0x1c29ad['error'][_0x3d40('0x15')]);return _0x411faf(_0x1c29ad['error'][_0x3d40('0x15')]);}logger[_0x3d40('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5129ef,_0x1c29ad[_0x3d40('0x13')]['message']);return _0x97edb(_0x1c29ad[_0x3d40('0x13')]['message']);}else{logger[_0x3d40('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5129ef,'request\x20sent');_0x97edb(_0x1c29ad[_0x3d40('0x16')]['message']);}})[_0x3d40('0x17')](function(_0x223543){logger['error'](_0x3d40('0xe'),_0x5129ef,_0x223543);_0x411faf(_0x223543);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6f6c7bc..6f5ec8f 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 _0x952f=['/:id/query','query','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','run'];(function(_0x14c6f2,_0x5676b6){var _0x33dfc6=function(_0x331c90){while(--_0x331c90){_0x14c6f2['push'](_0x14c6f2['shift']());}};_0x33dfc6(++_0x5676b6);}(_0x952f,0x1aa));var _0xf952=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x952f[_0x75f869];return _0x10af8b;};'use strict';var multer=require('multer');var util=require(_0xf952('0x0'));var path=require(_0xf952('0x1'));var timeout=require(_0xf952('0x2'));var express=require(_0xf952('0x3'));var router=express[_0xf952('0x4')]();var fs_extra=require(_0xf952('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf952('0x6'));router[_0xf952('0x7')]('/',auth[_0xf952('0x8')](),controller[_0xf952('0x9')]);router['get'](_0xf952('0xa'),auth[_0xf952('0x8')](),controller[_0xf952('0xb')]);router[_0xf952('0x7')]('/:id/preview',auth[_0xf952('0x8')](),controller[_0xf952('0xc')]);router[_0xf952('0x7')]('/:id/run',auth[_0xf952('0x8')](),controller[_0xf952('0xd')]);router[_0xf952('0x7')](_0xf952('0xe'),auth['isAuthenticated'](),controller[_0xf952('0xf')]);router[_0xf952('0x10')]('/',auth[_0xf952('0x8')](),controller[_0xf952('0x11')]);router[_0xf952('0x12')](_0xf952('0xa'),auth[_0xf952('0x8')](),controller[_0xf952('0x13')]);router['delete'](_0xf952('0xa'),auth[_0xf952('0x8')](),controller[_0xf952('0x14')]);module[_0xf952('0x15')]=router; \ No newline at end of file +var _0xf7a8=['/:id/run','run','/:id/query','create','put','/:id','update','destroy','multer','util','path','express','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview'];(function(_0x2a1569,_0x5c4fb5){var _0x2335f7=function(_0x5639a8){while(--_0x5639a8){_0x2a1569['push'](_0x2a1569['shift']());}};_0x2335f7(++_0x5c4fb5);}(_0xf7a8,0x15e));var _0x8f7a=function(_0x2d67e4,_0x507e9d){_0x2d67e4=_0x2d67e4-0x0;var _0xf6db0a=_0xf7a8[_0x2d67e4];return _0xf6db0a;};'use strict';var multer=require(_0x8f7a('0x0'));var util=require(_0x8f7a('0x1'));var path=require(_0x8f7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f7a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f7a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f7a('0x5'));router[_0x8f7a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8f7a('0x6')]('/:id',auth[_0x8f7a('0x7')](),controller[_0x8f7a('0x8')]);router['get'](_0x8f7a('0x9'),auth['isAuthenticated'](),controller['preview']);router[_0x8f7a('0x6')](_0x8f7a('0xa'),auth['isAuthenticated'](),controller[_0x8f7a('0xb')]);router[_0x8f7a('0x6')](_0x8f7a('0xc'),auth[_0x8f7a('0x7')](),controller['query']);router['post']('/',auth[_0x8f7a('0x7')](),controller[_0x8f7a('0xd')]);router[_0x8f7a('0xe')](_0x8f7a('0xf'),auth['isAuthenticated'](),controller[_0x8f7a('0x10')]);router['delete'](_0x8f7a('0xf'),auth[_0x8f7a('0x7')](),controller[_0x8f7a('0x11')]);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 90b39f3..d4d3e8f 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x188165,_0x4de657){var _0x2ab64a=function(_0x2ac7d2){while(--_0x2ac7d2){_0x188165['push'](_0x188165['shift']());}};_0x2ab64a(++_0x4de657);}(_0xac9d,0x14d));var _0xdac9=function(_0x18a529,_0x2bea53){_0x18a529=_0x18a529-0x0;var _0x216fb8=_0xac9d[_0x18a529];return _0x216fb8;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file +var _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x5d795c,_0x1d07d7){var _0x38113b=function(_0x18c3d1){while(--_0x18c3d1){_0x5d795c['push'](_0x5d795c['shift']());}};_0x38113b(++_0x1d07d7);}(_0x1883,0xab));var _0x3188=function(_0x7bf9f6,_0x10bfe4){_0x7bf9f6=_0x7bf9f6-0x0;var _0x1d2825=_0x1883[_0x7bf9f6];return _0x1d2825;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index b5a4e74..e5aa487 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 _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x326f,0xd1));var _0xf326=function(_0x4485da,_0x1dd99a){_0x4485da=_0x4485da-0x0;var _0x1d19d0=_0x326f[_0x4485da];return _0x1d19d0;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file +var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','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','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x2ae476,_0x133239){var _0x9e65f8=function(_0x1dddfa){while(--_0x1dddfa){_0x2ae476['push'](_0x2ae476['shift']());}};_0x9e65f8(++_0x133239);}(_0x53ec,0x192));var _0xc53e=function(_0x9c173a,_0x461c9c){_0x9c173a=_0x9c173a-0x0;var _0x88d611=_0x53ec[_0x9c173a];return _0x88d611;};'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'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f0c3704..0cd59d0 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 _0xd68e=['analytics_default_reports','lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','AnalyticDefaultReport'];(function(_0xdbfa40,_0x4d3112){var _0x49cca7=function(_0x48ef81){while(--_0x48ef81){_0xdbfa40['push'](_0xdbfa40['shift']());}};_0x49cca7(++_0x4d3112);}(_0xd68e,0x1ae));var _0xed68=function(_0x4180c6,_0x642cf3){_0x4180c6=_0x4180c6-0x0;var _0xe0e5aa=_0xd68e[_0x4180c6];return _0xe0e5aa;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var logger=require('../../config/logger')(_0xed68('0x2'));var moment=require('moment');var BPromise=require(_0xed68('0x3'));var rp=require(_0xed68('0x4'));var fs=require('fs');var path=require(_0xed68('0x5'));var rimraf=require(_0xed68('0x6'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xed68('0x7')]=function(_0x423595,_0x2c7dda){return _0x423595[_0xed68('0x8')](_0xed68('0x9'),attributes,{'tableName':_0xed68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb95=['api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x21a857,_0x195fc0){var _0x4c603c=function(_0x58be53){while(--_0x58be53){_0x21a857['push'](_0x21a857['shift']());}};_0x4c603c(++_0x195fc0);}(_0xcb95,0x1de));var _0x5cb9=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xcb95[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x5cb9('0x0'));var util=require(_0x5cb9('0x1'));var logger=require('../../config/logger')(_0x5cb9('0x2'));var moment=require(_0x5cb9('0x3'));var BPromise=require(_0x5cb9('0x4'));var rp=require(_0x5cb9('0x5'));var fs=require('fs');var path=require(_0x5cb9('0x6'));var rimraf=require(_0x5cb9('0x7'));var config=require('../../config/environment');var attributes=require(_0x5cb9('0x8'));module[_0x5cb9('0x9')]=function(_0x389da4,_0x36d5f4){return _0x389da4['define'](_0x5cb9('0xa'),attributes,{'tableName':_0x5cb9('0xb'),'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 36cf70d..bbfc3ef 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 _0x2159=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x96ad4a,_0x389715){var _0x500736=function(_0x40d2bd){while(--_0x40d2bd){_0x96ad4a['push'](_0x96ad4a['shift']());}};_0x500736(++_0x389715);}(_0x2159,0xc7));var _0x9215=function(_0x19d5fd,_0x32c9ba){_0x19d5fd=_0x19d5fd-0x0;var _0x3fc28a=_0x2159[_0x19d5fd];return _0x3fc28a;};'use strict';var _=require(_0x9215('0x0'));var util=require(_0x9215('0x1'));var moment=require(_0x9215('0x2'));var BPromise=require('bluebird');var rs=require(_0x9215('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9215('0x4'));var logger=require(_0x9215('0x5'))(_0x9215('0x6'));var config=require(_0x9215('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9215('0x8')][_0x9215('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18fa37,_0x130716,_0x4d401d){return new BPromise(function(_0xf6d703,_0x47cb7a){return client[_0x9215('0xa')](_0x18fa37,_0x4d401d)[_0x9215('0xb')](function(_0x724f2){logger[_0x9215('0xc')](_0x9215('0xd'),_0x130716,_0x9215('0xe'));logger['debug'](_0x9215('0xf'),_0x130716,'request\x20sent',JSON[_0x9215('0x10')](_0x724f2));if(_0x724f2['error']){if(_0x724f2[_0x9215('0x11')]['code']===0x1f4){logger['error'](_0x9215('0xd'),_0x130716,_0x724f2[_0x9215('0x11')][_0x9215('0x12')]);return _0x47cb7a(_0x724f2[_0x9215('0x11')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x130716,_0x724f2[_0x9215('0x11')]['message']);return _0xf6d703(_0x724f2[_0x9215('0x11')]['message']);}else{logger[_0x9215('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x130716,'request\x20sent');_0xf6d703(_0x724f2[_0x9215('0x13')][_0x9215('0x12')]);}})[_0x9215('0x14')](function(_0x37094d){logger['error'](_0x9215('0xd'),_0x130716,_0x37094d);_0x47cb7a(_0x37094d);});});} \ No newline at end of file +var _0xb9d6=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x34b595,_0x55bc35){var _0x147bff=function(_0x16e1c4){while(--_0x16e1c4){_0x34b595['push'](_0x34b595['shift']());}};_0x147bff(++_0x55bc35);}(_0xb9d6,0x1b6));var _0x6b9d=function(_0x1266f9,_0xbba76f){_0x1266f9=_0x1266f9-0x0;var _0x282acb=_0xb9d6[_0x1266f9];return _0x282acb;};'use strict';var _=require(_0x6b9d('0x0'));var util=require('util');var moment=require(_0x6b9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x6b9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b9d('0x3'))['db'];var utils=require(_0x6b9d('0x4'));var logger=require(_0x6b9d('0x5'))(_0x6b9d('0x6'));var config=require(_0x6b9d('0x7'));var jayson=require(_0x6b9d('0x8'));var client=jayson[_0x6b9d('0x9')][_0x6b9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4214c1,_0x241c6f,_0x4778d4){return new BPromise(function(_0x1ddda9,_0x35fdd2){return client[_0x6b9d('0xb')](_0x4214c1,_0x4778d4)[_0x6b9d('0xc')](function(_0x3ebde1){logger[_0x6b9d('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x241c6f,'request\x20sent');logger[_0x6b9d('0xe')](_0x6b9d('0xf'),_0x241c6f,'request\x20sent',JSON[_0x6b9d('0x10')](_0x3ebde1));if(_0x3ebde1[_0x6b9d('0x11')]){if(_0x3ebde1[_0x6b9d('0x11')]['code']===0x1f4){logger[_0x6b9d('0x11')](_0x6b9d('0x12'),_0x241c6f,_0x3ebde1[_0x6b9d('0x11')]['message']);return _0x35fdd2(_0x3ebde1[_0x6b9d('0x11')][_0x6b9d('0x13')]);}logger['error'](_0x6b9d('0x12'),_0x241c6f,_0x3ebde1['error']['message']);return _0x1ddda9(_0x3ebde1[_0x6b9d('0x11')]['message']);}else{logger['info'](_0x6b9d('0x12'),_0x241c6f,_0x6b9d('0x14'));_0x1ddda9(_0x3ebde1[_0x6b9d('0x15')]['message']);}})[_0x6b9d('0x16')](function(_0x53233a){logger[_0x6b9d('0x11')](_0x6b9d('0x12'),_0x241c6f,_0x53233a);_0x35fdd2(_0x53233a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4fb9806..b38cfb0 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 _0x94c6=['multer','util','path','connect-timeout','Router','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','create','update','delete','destroy','exports'];(function(_0x1813c5,_0x4e8858){var _0x41c84c=function(_0xcc07bb){while(--_0xcc07bb){_0x1813c5['push'](_0x1813c5['shift']());}};_0x41c84c(++_0x4e8858);}(_0x94c6,0x14a));var _0x694c=function(_0x4554bf,_0x5bcb68){_0x4554bf=_0x4554bf-0x0;var _0x36cbe3=_0x94c6[_0x4554bf];return _0x36cbe3;};'use strict';var multer=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var path=require(_0x694c('0x2'));var timeout=require(_0x694c('0x3'));var express=require('express');var router=express[_0x694c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x694c('0x5'));var config=require('../../config/environment');var controller=require(_0x694c('0x6'));router[_0x694c('0x7')]('/',auth[_0x694c('0x8')](),controller[_0x694c('0x9')]);router[_0x694c('0x7')](_0x694c('0xa'),auth[_0x694c('0x8')](),controller['show']);router[_0x694c('0x7')](_0x694c('0xb'),auth[_0x694c('0x8')](),controller[_0x694c('0xc')]);router[_0x694c('0x7')](_0x694c('0xd'),auth['isAuthenticated'](),controller[_0x694c('0xe')]);router['get']('/:id/query',auth[_0x694c('0x8')](),controller[_0x694c('0xf')]);router[_0x694c('0x10')]('/',auth[_0x694c('0x8')](),controller[_0x694c('0x11')]);router['put'](_0x694c('0xa'),auth[_0x694c('0x8')](),controller[_0x694c('0x12')]);router[_0x694c('0x13')]('/:id',auth[_0x694c('0x8')](),controller[_0x694c('0x14')]);module[_0x694c('0x15')]=router; \ No newline at end of file +var _0x27bd=['/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x27bd,0x11e));var _0xd27b=function(_0x2692d0,_0x3940ef){_0x2692d0=_0x2692d0-0x0;var _0x51e45a=_0x27bd[_0x2692d0];return _0x51e45a;};'use strict';var multer=require(_0xd27b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd27b('0x1'));var router=express[_0xd27b('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd27b('0x3'));var config=require(_0xd27b('0x4'));var controller=require('./analyticDefaultReport.controller');router[_0xd27b('0x5')]('/',auth[_0xd27b('0x6')](),controller[_0xd27b('0x7')]);router['get'](_0xd27b('0x8'),auth['isAuthenticated'](),controller[_0xd27b('0x9')]);router['get'](_0xd27b('0xa'),auth[_0xd27b('0x6')](),controller['preview']);router[_0xd27b('0x5')](_0xd27b('0xb'),auth[_0xd27b('0x6')](),controller[_0xd27b('0xc')]);router[_0xd27b('0x5')](_0xd27b('0xd'),auth['isAuthenticated'](),controller[_0xd27b('0xe')]);router[_0xd27b('0xf')]('/',auth[_0xd27b('0x6')](),controller[_0xd27b('0x10')]);router['put'](_0xd27b('0x8'),auth['isAuthenticated'](),controller[_0xd27b('0x11')]);router[_0xd27b('0x12')](_0xd27b('0x8'),auth[_0xd27b('0x6')](),controller[_0xd27b('0x13')]);module[_0xd27b('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d5957e7..6b4a88d 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 _0xe4b3=['scheduled','manual','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x3fa579,_0x3534e2){var _0xe1666d=function(_0x2f5367){while(--_0x2f5367){_0x3fa579['push'](_0x3fa579['shift']());}};_0xe1666d(++_0x3534e2);}(_0xe4b3,0xcf));var _0x3e4b=function(_0x539c8b,_0x58e0a7){_0x539c8b=_0x539c8b-0x0;var _0x53ffd0=_0xe4b3[_0x539c8b];return _0x53ffd0;};'use strict';var Sequelize=require(_0x3e4b('0x0'));var moment=require(_0x3e4b('0x1'));module[_0x3e4b('0x2')]={'name':{'type':Sequelize[_0x3e4b('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3e4b('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x3e4b('0x4')](_0x3e4b('0x5'),_0x3e4b('0x6'),_0x3e4b('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3e4b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3e4b('0x8')]},'endDate':{'type':Sequelize[_0x3e4b('0x8')]},'status':{'type':Sequelize[_0x3e4b('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x3e4b('0x4')]('manual',_0x3e4b('0x9')),'allowNull':![],'defaultValue':_0x3e4b('0xa')},'reportId':{'type':Sequelize[_0x3e4b('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x3e4b('0x3')]}}; \ No newline at end of file +var _0x67fc=['UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x14f459,_0x26bb05){var _0x5b690a=function(_0xed58b0){while(--_0xed58b0){_0x14f459['push'](_0x14f459['shift']());}};_0x5b690a(++_0x26bb05);}(_0x67fc,0x1ae));var _0xc67f=function(_0x3f7146,_0x824eba){_0x3f7146=_0x3f7146-0x0;var _0x316350=_0x67fc[_0x3f7146];return _0x316350;};'use strict';var Sequelize=require(_0xc67f('0x0'));var moment=require('moment');module[_0xc67f('0x1')]={'name':{'type':Sequelize[_0xc67f('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xc67f('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xc67f('0x3')](_0xc67f('0x4'),_0xc67f('0x5'),_0xc67f('0x6')),'allowNull':![],'defaultValue':_0xc67f('0x4')},'savename':{'type':Sequelize[_0xc67f('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc67f('0x7')]},'endDate':{'type':Sequelize[_0xc67f('0x7')]},'status':{'type':Sequelize[_0xc67f('0x2')],'defaultValue':_0xc67f('0x8')},'type':{'type':Sequelize[_0xc67f('0x3')](_0xc67f('0x9'),_0xc67f('0xa')),'allowNull':![],'defaultValue':_0xc67f('0x9')},'reportId':{'type':Sequelize[_0xc67f('0xb')](0xb)[_0xc67f('0xc')]},'reportType':{'type':Sequelize[_0xc67f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9bca27a..bd70c1a 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 _0x63dc=['intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','join','format','%s.%s','toLowerCase','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x99fc98,_0x4acfe1){var _0x59d220=function(_0x4f1357){while(--_0x4f1357){_0x99fc98['push'](_0x99fc98['shift']());}};_0x59d220(++_0x4acfe1);}(_0x63dc,0x1a0));var _0xc63d=function(_0xdf3b06,_0x5e3984){_0xdf3b06=_0xdf3b06-0x0;var _0x3dc039=_0x63dc[_0xdf3b06];return _0x3dc039;};'use strict';var emlformat=require(_0xc63d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc63d('0x1'));var rp=require('request-promise');var moment=require(_0xc63d('0x2'));var BPromise=require(_0xc63d('0x3'));var Mustache=require('mustache');var util=require(_0xc63d('0x4'));var path=require(_0xc63d('0x5'));var sox=require(_0xc63d('0x6'));var csv=require(_0xc63d('0x7'));var ejs=require(_0xc63d('0x8'));var fs=require('fs');var fs_extra=require(_0xc63d('0x9'));var _=require('lodash');var squel=require(_0xc63d('0xa'));var crypto=require(_0xc63d('0xb'));var jsforce=require(_0xc63d('0xc'));var deskjs=require(_0xc63d('0xd'));var toCsv=require(_0xc63d('0x7'));var querystring=require(_0xc63d('0xe'));var Papa=require('papaparse');var Redis=require(_0xc63d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc63d('0x10'));var as=require(_0xc63d('0x11'));var hardwareService=require(_0xc63d('0x12'));var logger=require(_0xc63d('0x13'))('api');var utils=require(_0xc63d('0x14'));var config=require(_0xc63d('0x15'));var licenseUtil=require(_0xc63d('0x16'));var db=require(_0xc63d('0x17'))['db'];function respondWithStatusCode(_0x171a79,_0x5b3aa0){_0x5b3aa0=_0x5b3aa0||0xcc;return function(_0x570f1c){if(_0x570f1c){return _0x171a79[_0xc63d('0x18')](_0x5b3aa0);}return _0x171a79[_0xc63d('0x19')](_0x5b3aa0)['end']();};}function respondWithResult(_0x348301,_0x3d7aae){_0x3d7aae=_0x3d7aae||0xc8;return function(_0x1dadb0){if(_0x1dadb0){return _0x348301[_0xc63d('0x19')](_0x3d7aae)[_0xc63d('0x1a')](_0x1dadb0);}};}function respondWithFilteredResult(_0x200600,_0x11c3e9){return function(_0x22b55c){if(_0x22b55c){var _0x184397=typeof _0x11c3e9[_0xc63d('0x1b')]==='undefined'&&typeof _0x11c3e9[_0xc63d('0x1c')]===_0xc63d('0x1d');var _0x1926b1=_0x22b55c[_0xc63d('0x1e')];var _0x438e2d=_0x184397?0x0:_0x11c3e9['offset'];var _0x13f92d=_0x184397?_0x22b55c[_0xc63d('0x1e')]:_0x11c3e9['offset']+_0x11c3e9[_0xc63d('0x1c')];var _0x2a1f64;if(_0x13f92d>=_0x1926b1){_0x13f92d=_0x1926b1;_0x2a1f64=0xc8;}else{_0x2a1f64=0xce;}_0x200600[_0xc63d('0x19')](_0x2a1f64);return _0x200600['set'](_0xc63d('0x1f'),_0x438e2d+'-'+_0x13f92d+'/'+_0x1926b1)[_0xc63d('0x1a')](_0x22b55c);}return null;};}function patchUpdates(_0x3c1ec5){return function(_0x382a31){try{jsonpatch[_0xc63d('0x20')](_0x382a31,_0x3c1ec5,!![]);}catch(_0xe5cf83){return BPromise[_0xc63d('0x21')](_0xe5cf83);}return _0x382a31['save']();};}function saveUpdates(_0x482b1f,_0x14a30c){return function(_0x20d9c1){if(_0x20d9c1){return _0x20d9c1[_0xc63d('0x22')](_0x482b1f)[_0xc63d('0x23')](function(_0x4744c4){return _0x4744c4;});}return null;};}function removeEntity(_0x4df413,_0x5ea8e8){return function(_0x16316f){if(_0x16316f){return _0x16316f[_0xc63d('0x24')]()[_0xc63d('0x23')](function(){var _0x1a5f1b=_0x16316f[_0xc63d('0x25')]({'plain':!![]});var _0x4673f0=_0xc63d('0x26');return db[_0xc63d('0x27')][_0xc63d('0x24')]({'where':{'type':_0x4673f0,'resourceId':_0x1a5f1b['id']}})[_0xc63d('0x23')](function(){return _0x16316f;});})[_0xc63d('0x23')](function(){_0x4df413[_0xc63d('0x19')](0xcc)[_0xc63d('0x28')]();});}};}function handleEntityNotFound(_0x94783b,_0x5b774c){return function(_0x132423){if(!_0x132423){_0x94783b[_0xc63d('0x18')](0x194);}return _0x132423;};}function handleError(_0x57a8ea,_0x297f3e){_0x297f3e=_0x297f3e||0x1f4;return function(_0x17ba1a){logger[_0xc63d('0x29')](_0x17ba1a['stack']);if(_0x17ba1a[_0xc63d('0x2a')]){delete _0x17ba1a['name'];}_0x57a8ea[_0xc63d('0x19')](_0x297f3e)[_0xc63d('0x2b')](_0x17ba1a);};}exports[_0xc63d('0x2c')]=function(_0x1b4c4a,_0x16fe52){var _0x164b3b={},_0x1af843={},_0x28a7b0={'count':0x0,'rows':[]};var _0x13d2d2=_[_0xc63d('0x2d')](db[_0xc63d('0x2e')][_0xc63d('0x2f')],function(_0x2649cd){return{'name':_0x2649cd[_0xc63d('0x30')],'type':_0x2649cd[_0xc63d('0x31')]['key']};});_0x1af843[_0xc63d('0x32')]=_[_0xc63d('0x2d')](_0x13d2d2,_0xc63d('0x2a'));_0x1af843[_0xc63d('0x33')]=_[_0xc63d('0x34')](_0x1b4c4a[_0xc63d('0x33')]);_0x1af843[_0xc63d('0x35')]=_[_0xc63d('0x36')](_0x1af843['model'],_0x1af843[_0xc63d('0x33')]);_0x164b3b[_0xc63d('0x37')]=_[_0xc63d('0x36')](_0x1af843[_0xc63d('0x32')],qs['fields'](_0x1b4c4a['query'][_0xc63d('0x38')]));_0x164b3b[_0xc63d('0x37')]=_0x164b3b[_0xc63d('0x37')][_0xc63d('0x39')]?_0x164b3b[_0xc63d('0x37')]:_0x1af843[_0xc63d('0x32')];if(!_0x1b4c4a[_0xc63d('0x33')]['hasOwnProperty'](_0xc63d('0x3a'))){_0x164b3b[_0xc63d('0x1c')]=qs[_0xc63d('0x1c')](_0x1b4c4a[_0xc63d('0x33')][_0xc63d('0x1c')]);_0x164b3b['offset']=qs['offset'](_0x1b4c4a[_0xc63d('0x33')]['offset']);}_0x164b3b['order']=qs[_0xc63d('0x3b')](_0x1b4c4a[_0xc63d('0x33')][_0xc63d('0x3b')]);_0x164b3b[_0xc63d('0x3c')]=qs[_0xc63d('0x35')](_[_0xc63d('0x3d')](_0x1b4c4a[_0xc63d('0x33')],_0x1af843[_0xc63d('0x35')]),_0x13d2d2);if(_0x1b4c4a['query'][_0xc63d('0x3e')]){_0x164b3b[_0xc63d('0x3c')]=_[_0xc63d('0x3f')](_0x164b3b[_0xc63d('0x3c')],{'$or':_['map'](_0x13d2d2,function(_0x26009a){if(_0x26009a[_0xc63d('0x31')]!=='VIRTUAL'){var _0x4cd028={};_0x4cd028[_0x26009a[_0xc63d('0x2a')]]={'$like':'%'+_0x1b4c4a[_0xc63d('0x33')][_0xc63d('0x3e')]+'%'};return _0x4cd028;}})});}_0x164b3b=_[_0xc63d('0x3f')]({},_0x164b3b,_0x1b4c4a[_0xc63d('0x40')]);var _0x2071a5={'where':_0x164b3b[_0xc63d('0x3c')]};return db[_0xc63d('0x2e')]['count'](_0x2071a5)[_0xc63d('0x23')](function(_0x294c6e){_0x28a7b0[_0xc63d('0x1e')]=_0x294c6e;if(_0x1b4c4a[_0xc63d('0x33')][_0xc63d('0x41')]){_0x164b3b[_0xc63d('0x42')]=[{'all':!![]}];}return db[_0xc63d('0x2e')][_0xc63d('0x43')](_0x164b3b);})['then'](function(_0x25004d){_0x28a7b0[_0xc63d('0x44')]=_0x25004d;return _0x28a7b0;})['then'](respondWithFilteredResult(_0x16fe52,_0x164b3b))[_0xc63d('0x45')](handleError(_0x16fe52,null));};exports[_0xc63d('0x46')]=function(_0xef833f,_0x570bc7){var _0x9b2631={'raw':!![],'where':{'id':_0xef833f[_0xc63d('0x47')]['id']}},_0x1caa18={};_0x1caa18[_0xc63d('0x32')]=_[_0xc63d('0x34')](db[_0xc63d('0x2e')][_0xc63d('0x2f')]);_0x1caa18[_0xc63d('0x33')]=_[_0xc63d('0x34')](_0xef833f[_0xc63d('0x33')]);_0x1caa18[_0xc63d('0x35')]=_['intersection'](_0x1caa18[_0xc63d('0x32')],_0x1caa18['query']);_0x9b2631[_0xc63d('0x37')]=_[_0xc63d('0x36')](_0x1caa18[_0xc63d('0x32')],qs[_0xc63d('0x38')](_0xef833f['query'][_0xc63d('0x38')]));_0x9b2631['attributes']=_0x9b2631[_0xc63d('0x37')][_0xc63d('0x39')]?_0x9b2631[_0xc63d('0x37')]:_0x1caa18['model'];if(_0xef833f[_0xc63d('0x33')][_0xc63d('0x41')]){_0x9b2631[_0xc63d('0x42')]=[{'all':!![]}];}_0x9b2631=_[_0xc63d('0x3f')]({},_0x9b2631,_0xef833f[_0xc63d('0x40')]);return db[_0xc63d('0x2e')][_0xc63d('0x48')](_0x9b2631)[_0xc63d('0x23')](handleEntityNotFound(_0x570bc7,null))[_0xc63d('0x23')](respondWithResult(_0x570bc7,null))['catch'](handleError(_0x570bc7,null));};exports[_0xc63d('0x49')]=function(_0x475ede,_0x754978){return db[_0xc63d('0x2e')][_0xc63d('0x49')](_0x475ede[_0xc63d('0x4a')],{})[_0xc63d('0x23')](function(_0xef1ebb){var _0xed8252=_0x475ede[_0xc63d('0x4b')][_0xc63d('0x25')]({'plain':!![]});if(!_0xed8252)throw new Error(_0xc63d('0x4c'));if(_0xed8252[_0xc63d('0x4d')]===_0xc63d('0x4b')){var _0x4072ee=_0xef1ebb['get']({'plain':!![]});var _0x3ab5b1=_0xc63d('0x26');return db['UserProfileSection'][_0xc63d('0x48')]({'where':{'name':_0x3ab5b1,'userProfileId':_0xed8252[_0xc63d('0x4e')]},'raw':!![]})[_0xc63d('0x23')](function(_0x3a2e6d){if(_0x3a2e6d&&_0x3a2e6d[_0xc63d('0x4f')]===0x0){return db[_0xc63d('0x27')]['create']({'name':_0x4072ee[_0xc63d('0x2a')],'resourceId':_0x4072ee['id'],'type':_0x3a2e6d[_0xc63d('0x2a')],'sectionId':_0x3a2e6d['id']},{})[_0xc63d('0x23')](function(){return _0xef1ebb;});}else{return _0xef1ebb;}})[_0xc63d('0x45')](function(_0x5c1e31){logger[_0xc63d('0x29')](_0xc63d('0x50'),_0x5c1e31);throw _0x5c1e31;});}return _0xef1ebb;})[_0xc63d('0x23')](respondWithResult(_0x754978,0xc9))[_0xc63d('0x45')](handleError(_0x754978,null));};exports[_0xc63d('0x22')]=function(_0x5b856f,_0x5ab8af){if(_0x5b856f[_0xc63d('0x4a')]['id']){delete _0x5b856f[_0xc63d('0x4a')]['id'];}return db[_0xc63d('0x2e')]['find']({'where':{'id':_0x5b856f[_0xc63d('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ab8af,null))[_0xc63d('0x23')](saveUpdates(_0x5b856f[_0xc63d('0x4a')],null))[_0xc63d('0x23')](respondWithResult(_0x5ab8af,null))['catch'](handleError(_0x5ab8af,null));};exports[_0xc63d('0x24')]=function(_0x5ec8fc,_0x4b268d){return db['AnalyticExtractedReport'][_0xc63d('0x48')]({'where':{'id':_0x5ec8fc['params']['id']}})['then'](handleEntityNotFound(_0x4b268d,null))[_0xc63d('0x23')](removeEntity(_0x4b268d,null))['catch'](handleError(_0x4b268d,null));};exports['download']=function(_0x1f86be,_0x1b11de,_0x32125c){return db['AnalyticExtractedReport'][_0xc63d('0x48')]({'where':{'id':_0x1f86be[_0xc63d('0x47')]['id']},'attributes':[_0xc63d('0x2a'),_0xc63d('0x51'),_0xc63d('0x52'),_0xc63d('0x53')],'raw':!![]})[_0xc63d('0x23')](handleEntityNotFound(_0x1b11de,null))[_0xc63d('0x23')](function(_0x21795a){if(_0x21795a){if(!fs['existsSync'](path['join'](config[_0xc63d('0x54')],_0xc63d('0x55'),_0x21795a[_0xc63d('0x52')]))){throw new db['Sequelize'][(_0xc63d('0x56'))](_0xc63d('0x57'));}if(_0x1f86be['query'][_0xc63d('0x58')]){return _0x1b11de[_0xc63d('0x18')](0xc8);}return _0x1b11de[_0xc63d('0x59')](path[_0xc63d('0x5a')](config[_0xc63d('0x54')],'server/files/reports',_0x21795a[_0xc63d('0x52')]),util[_0xc63d('0x5b')](_0xc63d('0x5c'),_0x21795a[_0xc63d('0x51')]||_0x21795a[_0xc63d('0x2a')],_0x21795a[_0xc63d('0x53')][_0xc63d('0x5d')]()));}})[_0xc63d('0x45')](handleError(_0x1b11de,null));}; \ No newline at end of file +var _0xc119=['show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','count','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xc119,0x72));var _0x9c11=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xc119[_0x251d9c];return _0x16ae64;};'use strict';var emlformat=require(_0x9c11('0x0'));var rimraf=require(_0x9c11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c11('0x2'));var moment=require(_0x9c11('0x3'));var BPromise=require(_0x9c11('0x4'));var Mustache=require('mustache');var util=require(_0x9c11('0x5'));var path=require(_0x9c11('0x6'));var sox=require(_0x9c11('0x7'));var csv=require(_0x9c11('0x8'));var ejs=require(_0x9c11('0x9'));var fs=require('fs');var fs_extra=require(_0x9c11('0xa'));var _=require(_0x9c11('0xb'));var squel=require(_0x9c11('0xc'));var crypto=require(_0x9c11('0xd'));var jsforce=require(_0x9c11('0xe'));var deskjs=require(_0x9c11('0xf'));var toCsv=require(_0x9c11('0x8'));var querystring=require(_0x9c11('0x10'));var Papa=require(_0x9c11('0x11'));var Redis=require(_0x9c11('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9c11('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c11('0x15'))['db'];function respondWithStatusCode(_0x53c28b,_0x1f0e90){_0x1f0e90=_0x1f0e90||0xcc;return function(_0x4ec92f){if(_0x4ec92f){return _0x53c28b[_0x9c11('0x16')](_0x1f0e90);}return _0x53c28b['status'](_0x1f0e90)[_0x9c11('0x17')]();};}function respondWithResult(_0x3f061d,_0x2e4db7){_0x2e4db7=_0x2e4db7||0xc8;return function(_0x2dad1d){if(_0x2dad1d){return _0x3f061d[_0x9c11('0x18')](_0x2e4db7)['json'](_0x2dad1d);}};}function respondWithFilteredResult(_0x5091d4,_0x316dd0){return function(_0x2d6485){if(_0x2d6485){var _0x44361a=typeof _0x316dd0[_0x9c11('0x19')]==='undefined'&&typeof _0x316dd0[_0x9c11('0x1a')]==='undefined';var _0x50b1d0=_0x2d6485[_0x9c11('0x1b')];var _0x4ae1aa=_0x44361a?0x0:_0x316dd0[_0x9c11('0x19')];var _0x10579=_0x44361a?_0x2d6485[_0x9c11('0x1b')]:_0x316dd0[_0x9c11('0x19')]+_0x316dd0[_0x9c11('0x1a')];var _0x385e98;if(_0x10579>=_0x50b1d0){_0x10579=_0x50b1d0;_0x385e98=0xc8;}else{_0x385e98=0xce;}_0x5091d4[_0x9c11('0x18')](_0x385e98);return _0x5091d4[_0x9c11('0x1c')]('Content-Range',_0x4ae1aa+'-'+_0x10579+'/'+_0x50b1d0)[_0x9c11('0x1d')](_0x2d6485);}return null;};}function patchUpdates(_0x51ca4f){return function(_0x296d9d){try{jsonpatch[_0x9c11('0x1e')](_0x296d9d,_0x51ca4f,!![]);}catch(_0x5d04b7){return BPromise[_0x9c11('0x1f')](_0x5d04b7);}return _0x296d9d[_0x9c11('0x20')]();};}function saveUpdates(_0x35db26,_0x3e0399){return function(_0x15aec3){if(_0x15aec3){return _0x15aec3[_0x9c11('0x21')](_0x35db26)[_0x9c11('0x22')](function(_0x7ac0e5){return _0x7ac0e5;});}return null;};}function removeEntity(_0x583f11,_0xfe507c){return function(_0x5010a8){if(_0x5010a8){return _0x5010a8[_0x9c11('0x23')]()[_0x9c11('0x22')](function(){var _0xabe469=_0x5010a8[_0x9c11('0x24')]({'plain':!![]});var _0x3af786='ExtractedReports';return db[_0x9c11('0x25')]['destroy']({'where':{'type':_0x3af786,'resourceId':_0xabe469['id']}})[_0x9c11('0x22')](function(){return _0x5010a8;});})[_0x9c11('0x22')](function(){_0x583f11[_0x9c11('0x18')](0xcc)[_0x9c11('0x17')]();});}};}function handleEntityNotFound(_0x5c879d,_0x5f36e6){return function(_0x23041f){if(!_0x23041f){_0x5c879d[_0x9c11('0x16')](0x194);}return _0x23041f;};}function handleError(_0x39d856,_0x40a4bc){_0x40a4bc=_0x40a4bc||0x1f4;return function(_0x171adc){logger[_0x9c11('0x26')](_0x171adc['stack']);if(_0x171adc['name']){delete _0x171adc[_0x9c11('0x27')];}_0x39d856['status'](_0x40a4bc)[_0x9c11('0x28')](_0x171adc);};}exports['index']=function(_0x535708,_0x40a02f){var _0x229e93={},_0xa1e2ed={},_0xf16d53={'count':0x0,'rows':[]};var _0x150757=_[_0x9c11('0x29')](db[_0x9c11('0x2a')][_0x9c11('0x2b')],function(_0x558ef9){return{'name':_0x558ef9[_0x9c11('0x2c')],'type':_0x558ef9[_0x9c11('0x2d')]['key']};});_0xa1e2ed[_0x9c11('0x2e')]=_['map'](_0x150757,_0x9c11('0x27'));_0xa1e2ed['query']=_[_0x9c11('0x2f')](_0x535708[_0x9c11('0x30')]);_0xa1e2ed['filters']=_[_0x9c11('0x31')](_0xa1e2ed[_0x9c11('0x2e')],_0xa1e2ed[_0x9c11('0x30')]);_0x229e93[_0x9c11('0x32')]=_[_0x9c11('0x31')](_0xa1e2ed['model'],qs[_0x9c11('0x33')](_0x535708[_0x9c11('0x30')]['fields']));_0x229e93[_0x9c11('0x32')]=_0x229e93['attributes'][_0x9c11('0x34')]?_0x229e93[_0x9c11('0x32')]:_0xa1e2ed[_0x9c11('0x2e')];if(!_0x535708[_0x9c11('0x30')][_0x9c11('0x35')](_0x9c11('0x36'))){_0x229e93[_0x9c11('0x1a')]=qs['limit'](_0x535708[_0x9c11('0x30')][_0x9c11('0x1a')]);_0x229e93[_0x9c11('0x19')]=qs[_0x9c11('0x19')](_0x535708[_0x9c11('0x30')]['offset']);}_0x229e93[_0x9c11('0x37')]=qs[_0x9c11('0x38')](_0x535708['query'][_0x9c11('0x38')]);_0x229e93[_0x9c11('0x39')]=qs['filters'](_['pick'](_0x535708[_0x9c11('0x30')],_0xa1e2ed[_0x9c11('0x3a')]),_0x150757);if(_0x535708[_0x9c11('0x30')][_0x9c11('0x3b')]){_0x229e93[_0x9c11('0x39')]=_[_0x9c11('0x3c')](_0x229e93[_0x9c11('0x39')],{'$or':_[_0x9c11('0x29')](_0x150757,function(_0x5691e6){if(_0x5691e6[_0x9c11('0x2d')]!==_0x9c11('0x3d')){var _0x2096e3={};_0x2096e3[_0x5691e6[_0x9c11('0x27')]]={'$like':'%'+_0x535708[_0x9c11('0x30')][_0x9c11('0x3b')]+'%'};return _0x2096e3;}})});}_0x229e93=_['merge']({},_0x229e93,_0x535708[_0x9c11('0x3e')]);var _0x3e558a={'where':_0x229e93[_0x9c11('0x39')]};return db['AnalyticExtractedReport']['count'](_0x3e558a)[_0x9c11('0x22')](function(_0x191033){_0xf16d53[_0x9c11('0x1b')]=_0x191033;if(_0x535708[_0x9c11('0x30')][_0x9c11('0x3f')]){_0x229e93[_0x9c11('0x40')]=[{'all':!![]}];}return db[_0x9c11('0x2a')][_0x9c11('0x41')](_0x229e93);})['then'](function(_0x4440f8){_0xf16d53[_0x9c11('0x42')]=_0x4440f8;return _0xf16d53;})['then'](respondWithFilteredResult(_0x40a02f,_0x229e93))[_0x9c11('0x43')](handleError(_0x40a02f,null));};exports[_0x9c11('0x44')]=function(_0x29f80b,_0x2fb4b1){var _0x1c9e25={'raw':!![],'where':{'id':_0x29f80b[_0x9c11('0x45')]['id']}},_0x2eaf74={};_0x2eaf74[_0x9c11('0x2e')]=_['keys'](db[_0x9c11('0x2a')]['rawAttributes']);_0x2eaf74[_0x9c11('0x30')]=_[_0x9c11('0x2f')](_0x29f80b['query']);_0x2eaf74['filters']=_[_0x9c11('0x31')](_0x2eaf74['model'],_0x2eaf74[_0x9c11('0x30')]);_0x1c9e25['attributes']=_['intersection'](_0x2eaf74[_0x9c11('0x2e')],qs[_0x9c11('0x33')](_0x29f80b[_0x9c11('0x30')][_0x9c11('0x33')]));_0x1c9e25['attributes']=_0x1c9e25[_0x9c11('0x32')][_0x9c11('0x34')]?_0x1c9e25[_0x9c11('0x32')]:_0x2eaf74[_0x9c11('0x2e')];if(_0x29f80b['query']['includeAll']){_0x1c9e25[_0x9c11('0x40')]=[{'all':!![]}];}_0x1c9e25=_[_0x9c11('0x3c')]({},_0x1c9e25,_0x29f80b[_0x9c11('0x3e')]);return db[_0x9c11('0x2a')]['find'](_0x1c9e25)[_0x9c11('0x22')](handleEntityNotFound(_0x2fb4b1,null))['then'](respondWithResult(_0x2fb4b1,null))[_0x9c11('0x43')](handleError(_0x2fb4b1,null));};exports[_0x9c11('0x46')]=function(_0x3ec3dc,_0x5ce7c3){return db['AnalyticExtractedReport'][_0x9c11('0x46')](_0x3ec3dc[_0x9c11('0x47')],{})['then'](function(_0x1b3403){var _0x182ffb=_0x3ec3dc['user']['get']({'plain':!![]});if(!_0x182ffb)throw new Error(_0x9c11('0x48'));if(_0x182ffb[_0x9c11('0x49')]===_0x9c11('0x4a')){var _0x11656a=_0x1b3403[_0x9c11('0x24')]({'plain':!![]});var _0x3c914e='ExtractedReports';return db[_0x9c11('0x4b')]['find']({'where':{'name':_0x3c914e,'userProfileId':_0x182ffb[_0x9c11('0x4c')]},'raw':!![]})[_0x9c11('0x22')](function(_0x294751){if(_0x294751&&_0x294751['autoAssociation']===0x0){return db['UserProfileResource'][_0x9c11('0x46')]({'name':_0x11656a[_0x9c11('0x27')],'resourceId':_0x11656a['id'],'type':_0x294751[_0x9c11('0x27')],'sectionId':_0x294751['id']},{})[_0x9c11('0x22')](function(){return _0x1b3403;});}else{return _0x1b3403;}})[_0x9c11('0x43')](function(_0x1d60ce){logger['error'](_0x9c11('0x4d'),_0x1d60ce);throw _0x1d60ce;});}return _0x1b3403;})['then'](respondWithResult(_0x5ce7c3,0xc9))[_0x9c11('0x43')](handleError(_0x5ce7c3,null));};exports[_0x9c11('0x21')]=function(_0x461dcf,_0x4f901d){if(_0x461dcf['body']['id']){delete _0x461dcf[_0x9c11('0x47')]['id'];}return db[_0x9c11('0x2a')][_0x9c11('0x4e')]({'where':{'id':_0x461dcf['params']['id']}})[_0x9c11('0x22')](handleEntityNotFound(_0x4f901d,null))[_0x9c11('0x22')](saveUpdates(_0x461dcf[_0x9c11('0x47')],null))[_0x9c11('0x22')](respondWithResult(_0x4f901d,null))['catch'](handleError(_0x4f901d,null));};exports[_0x9c11('0x23')]=function(_0x4bbb07,_0x187214){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4bbb07[_0x9c11('0x45')]['id']}})[_0x9c11('0x22')](handleEntityNotFound(_0x187214,null))[_0x9c11('0x22')](removeEntity(_0x187214,null))[_0x9c11('0x43')](handleError(_0x187214,null));};exports[_0x9c11('0x4f')]=function(_0x46232e,_0x158586,_0x4fbbf9){return db[_0x9c11('0x2a')][_0x9c11('0x4e')]({'where':{'id':_0x46232e['params']['id']},'attributes':['name',_0x9c11('0x50'),_0x9c11('0x51'),'output'],'raw':!![]})[_0x9c11('0x22')](handleEntityNotFound(_0x158586,null))[_0x9c11('0x22')](function(_0xaf4ece){if(_0xaf4ece){if(!fs[_0x9c11('0x52')](path[_0x9c11('0x53')](config[_0x9c11('0x54')],'server/files/reports',_0xaf4ece[_0x9c11('0x51')]))){throw new db[(_0x9c11('0x55'))][(_0x9c11('0x56'))](_0x9c11('0x57'));}if(_0x46232e[_0x9c11('0x30')][_0x9c11('0x58')]){return _0x158586['sendStatus'](0xc8);}return _0x158586[_0x9c11('0x4f')](path[_0x9c11('0x53')](config['root'],'server/files/reports',_0xaf4ece[_0x9c11('0x51')]),util[_0x9c11('0x59')](_0x9c11('0x5a'),_0xaf4ece[_0x9c11('0x50')]||_0xaf4ece[_0x9c11('0x27')],_0xaf4ece['output']['toLowerCase']()));}})[_0x9c11('0x43')](handleError(_0x158586,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4f78bc8..6d88d3a 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 _0x7d7e=['api','request-promise','rimraf','./analyticExtractedReport.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x2007d3,_0x42f58e){var _0x18ab9c=function(_0x42303d){while(--_0x42303d){_0x2007d3['push'](_0x2007d3['shift']());}};_0x18ab9c(++_0x42f58e);}(_0x7d7e,0x12f));var _0xe7d7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7d7e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xe7d7('0x0'));var util=require(_0xe7d7('0x1'));var logger=require(_0xe7d7('0x2'))(_0xe7d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe7d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7d7('0x5'));var config=require('../../config/environment');var attributes=require(_0xe7d7('0x6'));module[_0xe7d7('0x7')]=function(_0x3fdc47,_0x21c42a){return _0x3fdc47[_0xe7d7('0x8')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2571=['exports','define','analytics_extracted_reports','util','api','bluebird','path','../../config/environment'];(function(_0x159688,_0x37e0ad){var _0x5934c1=function(_0x271ef2){while(--_0x271ef2){_0x159688['push'](_0x159688['shift']());}};_0x5934c1(++_0x37e0ad);}(_0x2571,0xd3));var _0x1257=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0x2571[_0x2cde2a];return _0x110f55;};'use strict';var _=require('lodash');var util=require(_0x1257('0x0'));var logger=require('../../config/logger')(_0x1257('0x1'));var moment=require('moment');var BPromise=require(_0x1257('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1257('0x3'));var rimraf=require('rimraf');var config=require(_0x1257('0x4'));var attributes=require('./analyticExtractedReport.attributes');module[_0x1257('0x5')]=function(_0x288c7b,_0x4cfd94){return _0x288c7b[_0x1257('0x6')]('AnalyticExtractedReport',attributes,{'tableName':_0x1257('0x7'),'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 f934d79..3593a07 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 _0x9715=['request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http'];(function(_0x1956a8,_0x10980a){var _0x564fca=function(_0x5defd5){while(--_0x5defd5){_0x1956a8['push'](_0x1956a8['shift']());}};_0x564fca(++_0x10980a);}(_0x9715,0x15f));var _0x5971=function(_0x265ecd,_0xd1d67b){_0x265ecd=_0x265ecd-0x0;var _0x341789=_0x9715[_0x265ecd];return _0x341789;};'use strict';var _=require(_0x5971('0x0'));var util=require(_0x5971('0x1'));var moment=require(_0x5971('0x2'));var BPromise=require(_0x5971('0x3'));var rs=require(_0x5971('0x4'));var fs=require('fs');var Redis=require(_0x5971('0x5'));var db=require(_0x5971('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5971('0x7'));var config=require('../../config/environment');var jayson=require(_0x5971('0x8'));var client=jayson['client'][_0x5971('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48bf46,_0x126806,_0x49da9f){return new BPromise(function(_0xa859cf,_0x3d810f){return client[_0x5971('0xa')](_0x48bf46,_0x49da9f)['then'](function(_0x583d8c){logger[_0x5971('0xb')](_0x5971('0xc'),_0x126806,'request\x20sent');logger[_0x5971('0xd')](_0x5971('0xe'),_0x126806,_0x5971('0xf'),JSON['stringify'](_0x583d8c));if(_0x583d8c[_0x5971('0x10')]){if(_0x583d8c[_0x5971('0x10')]['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x126806,_0x583d8c['error'][_0x5971('0x11')]);return _0x3d810f(_0x583d8c[_0x5971('0x10')][_0x5971('0x11')]);}logger[_0x5971('0x10')](_0x5971('0xc'),_0x126806,_0x583d8c['error'][_0x5971('0x11')]);return _0xa859cf(_0x583d8c[_0x5971('0x10')][_0x5971('0x11')]);}else{logger[_0x5971('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x126806,_0x5971('0xf'));_0xa859cf(_0x583d8c['result'][_0x5971('0x11')]);}})[_0x5971('0x12')](function(_0x450a69){logger[_0x5971('0x10')](_0x5971('0xc'),_0x126806,_0x450a69);_0x3d810f(_0x450a69);});});} \ No newline at end of file +var _0x8d5e=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash'];(function(_0x1f83d0,_0x1bf10c){var _0x1e53bb=function(_0x57490b){while(--_0x57490b){_0x1f83d0['push'](_0x1f83d0['shift']());}};_0x1e53bb(++_0x1bf10c);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x8d5e[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var moment=require(_0xe8d5('0x2'));var BPromise=require(_0xe8d5('0x3'));var rs=require(_0xe8d5('0x4'));var fs=require('fs');var Redis=require(_0xe8d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe8d5('0x6'))(_0xe8d5('0x7'));var config=require(_0xe8d5('0x8'));var jayson=require(_0xe8d5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31ff1a,_0x1c1b96,_0x5252a8){return new BPromise(function(_0x262fae,_0x4348a4){return client[_0xe8d5('0xa')](_0x31ff1a,_0x5252a8)[_0xe8d5('0xb')](function(_0x4e4eae){logger[_0xe8d5('0xc')](_0xe8d5('0xd'),_0x1c1b96,'request\x20sent');logger['debug'](_0xe8d5('0xe'),_0x1c1b96,_0xe8d5('0xf'),JSON['stringify'](_0x4e4eae));if(_0x4e4eae[_0xe8d5('0x10')]){if(_0x4e4eae['error']['code']===0x1f4){logger['error'](_0xe8d5('0xd'),_0x1c1b96,_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);return _0x4348a4(_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);}logger[_0xe8d5('0x10')](_0xe8d5('0xd'),_0x1c1b96,_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);return _0x262fae(_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);}else{logger['info'](_0xe8d5('0xd'),_0x1c1b96,_0xe8d5('0xf'));_0x262fae(_0x4e4eae['result'][_0xe8d5('0x11')]);}})[_0xe8d5('0x12')](function(_0xc877c0){logger[_0xe8d5('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1c1b96,_0xc877c0);_0x4348a4(_0xc877c0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 443d1da..d4fdcac 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 _0xf9c6=['/:id','isAuthenticated','show','download','post','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get'];(function(_0x21d1ce,_0x569c93){var _0x5691bd=function(_0x41f3bc){while(--_0x41f3bc){_0x21d1ce['push'](_0x21d1ce['shift']());}};_0x5691bd(++_0x569c93);}(_0xf9c6,0x1e9));var _0x6f9c=function(_0x4f6f18,_0x3866c8){_0x4f6f18=_0x4f6f18-0x0;var _0x52ef5e=_0xf9c6[_0x4f6f18];return _0x52ef5e;};'use strict';var multer=require('multer');var util=require(_0x6f9c('0x0'));var path=require(_0x6f9c('0x1'));var timeout=require(_0x6f9c('0x2'));var express=require(_0x6f9c('0x3'));var router=express['Router']();var fs_extra=require(_0x6f9c('0x4'));var auth=require(_0x6f9c('0x5'));var interaction=require(_0x6f9c('0x6'));var config=require(_0x6f9c('0x7'));var controller=require(_0x6f9c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6f9c('0x9')]);router[_0x6f9c('0xa')](_0x6f9c('0xb'),auth[_0x6f9c('0xc')](),controller[_0x6f9c('0xd')]);router['get']('/:id/download',auth[_0x6f9c('0xc')](),controller[_0x6f9c('0xe')]);router[_0x6f9c('0xf')]('/',auth[_0x6f9c('0xc')](),controller['create']);router[_0x6f9c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6f9c('0x11')]);router['delete'](_0x6f9c('0xb'),auth[_0x6f9c('0xc')](),controller[_0x6f9c('0x12')]);module[_0x6f9c('0x13')]=router; \ No newline at end of file +var _0x7f97=['Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','exports','multer','connect-timeout','express'];(function(_0x3136f3,_0x30ef8e){var _0x2e5066=function(_0x281b7c){while(--_0x281b7c){_0x3136f3['push'](_0x3136f3['shift']());}};_0x2e5066(++_0x30ef8e);}(_0x7f97,0xe7));var _0x77f9=function(_0x8a9b51,_0x31d46e){_0x8a9b51=_0x8a9b51-0x0;var _0x5b0aa2=_0x7f97[_0x8a9b51];return _0x5b0aa2;};'use strict';var multer=require(_0x77f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77f9('0x1'));var express=require(_0x77f9('0x2'));var router=express[_0x77f9('0x3')]();var fs_extra=require(_0x77f9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77f9('0x5'));var controller=require(_0x77f9('0x6'));router[_0x77f9('0x7')]('/',auth[_0x77f9('0x8')](),controller[_0x77f9('0x9')]);router['get'](_0x77f9('0xa'),auth[_0x77f9('0x8')](),controller[_0x77f9('0xb')]);router[_0x77f9('0x7')](_0x77f9('0xc'),auth[_0x77f9('0x8')](),controller[_0x77f9('0xd')]);router[_0x77f9('0xe')]('/',auth['isAuthenticated'](),controller[_0x77f9('0xf')]);router['put'](_0x77f9('0xa'),auth[_0x77f9('0x8')](),controller[_0x77f9('0x10')]);router['delete'](_0x77f9('0xa'),auth[_0x77f9('0x8')](),controller['destroy']);module[_0x77f9('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8b62eb3..46cb96d 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 _0x6495=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x6495,0x15a));var _0x5649=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6495[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5649('0x0'));module[_0x5649('0x1')]={'field':{'type':Sequelize[_0x5649('0x2')]},'alias':{'type':Sequelize[_0x5649('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x5649('0x3')]},'groupBy':{'type':Sequelize[_0x5649('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5649('0x3')]},'custom':{'type':Sequelize[_0x5649('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0ca2=['BOOLEAN','exports','TEXT','STRING'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x0ca2,0x155));var _0x20ca=function(_0x2ef9e2,_0x376185){_0x2ef9e2=_0x2ef9e2-0x0;var _0x2d4632=_0x0ca2[_0x2ef9e2];return _0x2d4632;};'use strict';var Sequelize=require('sequelize');module[_0x20ca('0x0')]={'field':{'type':Sequelize[_0x20ca('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x20ca('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x20ca('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x20ca('0x2')]},'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 060132f..4077a63 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 _0xd186=['error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','map','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','body','bulkCreate','destroy','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0xd186,0x17a));var _0x6d18=function(_0x5b8b2d,_0x293a69){_0x5b8b2d=_0x5b8b2d-0x0;var _0x44d5f7=_0xd186[_0x5b8b2d];return _0x44d5f7;};'use strict';var emlformat=require(_0x6d18('0x0'));var rimraf=require(_0x6d18('0x1'));var zipdir=require(_0x6d18('0x2'));var jsonpatch=require(_0x6d18('0x3'));var rp=require(_0x6d18('0x4'));var moment=require('moment');var BPromise=require(_0x6d18('0x5'));var Mustache=require(_0x6d18('0x6'));var util=require(_0x6d18('0x7'));var path=require('path');var sox=require(_0x6d18('0x8'));var csv=require(_0x6d18('0x9'));var ejs=require(_0x6d18('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d18('0xb'));var squel=require(_0x6d18('0xc'));var crypto=require(_0x6d18('0xd'));var jsforce=require(_0x6d18('0xe'));var deskjs=require(_0x6d18('0xf'));var toCsv=require(_0x6d18('0x9'));var querystring=require(_0x6d18('0x10'));var Papa=require(_0x6d18('0x11'));var Redis=require(_0x6d18('0x12'));var authService=require(_0x6d18('0x13'));var qs=require(_0x6d18('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6d18('0x15'));var config=require(_0x6d18('0x16'));var licenseUtil=require(_0x6d18('0x17'));var db=require(_0x6d18('0x18'))['db'];function respondWithStatusCode(_0x14efbd,_0x4b4554){_0x4b4554=_0x4b4554||0xcc;return function(_0x3c4eeb){if(_0x3c4eeb){return _0x14efbd[_0x6d18('0x19')](_0x4b4554);}return _0x14efbd[_0x6d18('0x1a')](_0x4b4554)[_0x6d18('0x1b')]();};}function respondWithResult(_0x47fe56,_0x55082e){_0x55082e=_0x55082e||0xc8;return function(_0x5a073b){if(_0x5a073b){return _0x47fe56['status'](_0x55082e)[_0x6d18('0x1c')](_0x5a073b);}};}function respondWithFilteredResult(_0x5b38a2,_0x5c6250){return function(_0x18c270){if(_0x18c270){var _0x3312cd=typeof _0x5c6250[_0x6d18('0x1d')]===_0x6d18('0x1e')&&typeof _0x5c6250['limit']===_0x6d18('0x1e');var _0x518861=_0x18c270['count'];var _0x1817aa=_0x3312cd?0x0:_0x5c6250['offset'];var _0x2e7e15=_0x3312cd?_0x18c270[_0x6d18('0x1f')]:_0x5c6250[_0x6d18('0x1d')]+_0x5c6250[_0x6d18('0x20')];var _0x2f3e5e;if(_0x2e7e15>=_0x518861){_0x2e7e15=_0x518861;_0x2f3e5e=0xc8;}else{_0x2f3e5e=0xce;}_0x5b38a2[_0x6d18('0x1a')](_0x2f3e5e);return _0x5b38a2['set'](_0x6d18('0x21'),_0x1817aa+'-'+_0x2e7e15+'/'+_0x518861)['json'](_0x18c270);}return null;};}function patchUpdates(_0x276ae9){return function(_0x1f3f74){try{jsonpatch[_0x6d18('0x22')](_0x1f3f74,_0x276ae9,!![]);}catch(_0x1339f6){return BPromise['reject'](_0x1339f6);}return _0x1f3f74['save']();};}function saveUpdates(_0x24259a,_0x54d7fe){return function(_0x29df39){if(_0x29df39){return _0x29df39[_0x6d18('0x23')](_0x24259a)['then'](function(_0x59f410){return _0x59f410;});}return null;};}function removeEntity(_0x202f14,_0x2f6120){return function(_0x3023fb){if(_0x3023fb){return _0x3023fb['destroy']()[_0x6d18('0x24')](function(){_0x202f14[_0x6d18('0x1a')](0xcc)[_0x6d18('0x1b')]();});}};}function handleEntityNotFound(_0x4784d6,_0x46cc9d){return function(_0x3886d3){if(!_0x3886d3){_0x4784d6[_0x6d18('0x19')](0x194);}return _0x3886d3;};}function handleError(_0x4dd9ea,_0x4f975a){_0x4f975a=_0x4f975a||0x1f4;return function(_0x29b1b1){logger[_0x6d18('0x25')](_0x29b1b1[_0x6d18('0x26')]);if(_0x29b1b1[_0x6d18('0x27')]){delete _0x29b1b1[_0x6d18('0x27')];}_0x4dd9ea['status'](_0x4f975a)[_0x6d18('0x28')](_0x29b1b1);};}exports[_0x6d18('0x29')]=function(_0x2c041e,_0x51bba6){var _0x2c7584={},_0x5a0d54={},_0x299b6a={'count':0x0,'rows':[]};var _0x343a1b=_['map'](db[_0x6d18('0x2a')][_0x6d18('0x2b')],function(_0x51f0f9){return{'name':_0x51f0f9[_0x6d18('0x2c')],'type':_0x51f0f9['type'][_0x6d18('0x2d')]};});_0x5a0d54[_0x6d18('0x2e')]=_['map'](_0x343a1b,_0x6d18('0x27'));_0x5a0d54['query']=_[_0x6d18('0x2f')](_0x2c041e['query']);_0x5a0d54[_0x6d18('0x30')]=_['intersection'](_0x5a0d54[_0x6d18('0x2e')],_0x5a0d54[_0x6d18('0x31')]);_0x2c7584['attributes']=_[_0x6d18('0x32')](_0x5a0d54[_0x6d18('0x2e')],qs[_0x6d18('0x33')](_0x2c041e[_0x6d18('0x31')][_0x6d18('0x33')]));_0x2c7584[_0x6d18('0x34')]=_0x2c7584[_0x6d18('0x34')][_0x6d18('0x35')]?_0x2c7584[_0x6d18('0x34')]:_0x5a0d54['model'];if(!_0x2c041e['query'][_0x6d18('0x36')](_0x6d18('0x37'))){_0x2c7584[_0x6d18('0x20')]=qs[_0x6d18('0x20')](_0x2c041e[_0x6d18('0x31')][_0x6d18('0x20')]);_0x2c7584['offset']=qs['offset'](_0x2c041e['query'][_0x6d18('0x1d')]);}_0x2c7584['order']=qs[_0x6d18('0x38')](_0x2c041e['query'][_0x6d18('0x38')]);_0x2c7584['where']=qs['filters'](_[_0x6d18('0x39')](_0x2c041e[_0x6d18('0x31')],_0x5a0d54[_0x6d18('0x30')]),_0x343a1b);if(_0x2c041e[_0x6d18('0x31')][_0x6d18('0x3a')]){_0x2c7584[_0x6d18('0x3b')]=_['merge'](_0x2c7584[_0x6d18('0x3b')],{'$or':_[_0x6d18('0x3c')](_0x343a1b,function(_0x32790f){if(_0x32790f[_0x6d18('0x3d')]!==_0x6d18('0x3e')){var _0x14768c={};_0x14768c[_0x32790f['name']]={'$like':'%'+_0x2c041e['query'][_0x6d18('0x3a')]+'%'};return _0x14768c;}})});}_0x2c7584=_[_0x6d18('0x3f')]({},_0x2c7584,_0x2c041e[_0x6d18('0x40')]);var _0x147d5c={'where':_0x2c7584[_0x6d18('0x3b')]};return db['AnalyticFieldReport'][_0x6d18('0x1f')](_0x147d5c)['then'](function(_0x20b59b){_0x299b6a[_0x6d18('0x1f')]=_0x20b59b;if(_0x2c041e[_0x6d18('0x31')][_0x6d18('0x41')]){_0x2c7584[_0x6d18('0x42')]=[{'all':!![]}];}return db[_0x6d18('0x2a')]['findAll'](_0x2c7584);})['then'](function(_0x6a567){_0x299b6a[_0x6d18('0x43')]=_0x6a567;return _0x299b6a;})['then'](respondWithFilteredResult(_0x51bba6,_0x2c7584))['catch'](handleError(_0x51bba6,null));};exports[_0x6d18('0x44')]=function(_0x4ec13f,_0x270b87){var _0xae86cc={'raw':![],'where':{'id':_0x4ec13f[_0x6d18('0x45')]['id']}},_0x40dd21={};_0x40dd21[_0x6d18('0x2e')]=_[_0x6d18('0x2f')](db[_0x6d18('0x2a')][_0x6d18('0x2b')]);_0x40dd21[_0x6d18('0x31')]=_[_0x6d18('0x2f')](_0x4ec13f[_0x6d18('0x31')]);_0x40dd21[_0x6d18('0x30')]=_['intersection'](_0x40dd21[_0x6d18('0x2e')],_0x40dd21[_0x6d18('0x31')]);_0xae86cc[_0x6d18('0x34')]=_['intersection'](_0x40dd21[_0x6d18('0x2e')],qs['fields'](_0x4ec13f[_0x6d18('0x31')][_0x6d18('0x33')]));_0xae86cc['attributes']=_0xae86cc[_0x6d18('0x34')][_0x6d18('0x35')]?_0xae86cc['attributes']:_0x40dd21[_0x6d18('0x2e')];if(_0x4ec13f[_0x6d18('0x31')][_0x6d18('0x41')]){_0xae86cc[_0x6d18('0x42')]=[{'all':!![]}];}_0xae86cc=_['merge']({},_0xae86cc,_0x4ec13f[_0x6d18('0x40')]);return db[_0x6d18('0x2a')]['find'](_0xae86cc)['then'](handleEntityNotFound(_0x270b87,null))[_0x6d18('0x24')](respondWithResult(_0x270b87,null))[_0x6d18('0x46')](handleError(_0x270b87,null));};exports[_0x6d18('0x47')]=function(_0x34c369,_0x47020a){return db['AnalyticFieldReport']['create'](_0x34c369[_0x6d18('0x48')],{})['then'](respondWithResult(_0x47020a,0xc9))[_0x6d18('0x46')](handleError(_0x47020a,null));};exports[_0x6d18('0x49')]=function(_0x5b2eec,_0x2863f1){return db['AnalyticFieldReport'][_0x6d18('0x49')](_0x5b2eec[_0x6d18('0x48')],{'raw':![],'individualHooks':!![]})[_0x6d18('0x24')](respondWithResult(_0x2863f1,0xc9))['catch'](handleError(_0x2863f1,null));};exports['update']=function(_0x5995d5,_0x1f12e1){if(_0x5995d5[_0x6d18('0x48')]['id']){delete _0x5995d5[_0x6d18('0x48')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x5995d5[_0x6d18('0x45')]['id']}})[_0x6d18('0x24')](handleEntityNotFound(_0x1f12e1,null))['then'](saveUpdates(_0x5995d5['body'],null))['then'](respondWithResult(_0x1f12e1,null))[_0x6d18('0x46')](handleError(_0x1f12e1,null));};exports[_0x6d18('0x4a')]=function(_0xf4656,_0x3c5add){return db[_0x6d18('0x2a')][_0x6d18('0x4b')]({'where':{'id':_0xf4656[_0x6d18('0x45')]['id']}})[_0x6d18('0x24')](handleEntityNotFound(_0x3c5add,null))[_0x6d18('0x24')](removeEntity(_0x3c5add,null))[_0x6d18('0x46')](handleError(_0x3c5add,null));};exports[_0x6d18('0x4c')]=function(_0x59dc62,_0x17763e){return db['AnalyticFieldReport'][_0x6d18('0x4a')]({'where':{'id':_0x59dc62[_0x6d18('0x31')][_0x6d18('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x6d18('0x24')](respondWithResult(_0x17763e,0xcc))[_0x6d18('0x46')](handleError(_0x17763e,null));};exports[_0x6d18('0x4e')]=function(_0x3f8e50,_0x18aafa,_0x49b236){return db[_0x6d18('0x4f')][_0x6d18('0x50')]({'where':{'id':_0x3f8e50[_0x6d18('0x45')]['id']}})[_0x6d18('0x24')](handleEntityNotFound(_0x18aafa,null))[_0x6d18('0x24')](function(_0x2773bd){if(_0x2773bd){return db['sequelize'][_0x6d18('0x51')](function(_0x3057d8){return db[_0x6d18('0x2a')][_0x6d18('0x4a')]({'where':{'CustomReportId':_0x3f8e50[_0x6d18('0x45')]['id']},'transaction':_0x3057d8})[_0x6d18('0x24')](function(_0x5ebc9d){var _0x288b48=_[_0x6d18('0x3c')](_0x3f8e50['body'],function(_0x267b26){delete _0x267b26['id'];_0x267b26['CustomReportId']=_0x3f8e50[_0x6d18('0x45')]['id'];return _0x267b26;});return db[_0x6d18('0x2a')]['bulkCreate'](_0x288b48,{'transaction':_0x3057d8});});})[_0x6d18('0x24')](function(){return db[_0x6d18('0x2a')][_0x6d18('0x52')]({'where':{'CustomReportId':_0x3f8e50[_0x6d18('0x45')]['id']}});});}})['then'](respondWithResult(_0x18aafa,null))[_0x6d18('0x46')](handleError(_0x18aafa,null));}; \ No newline at end of file +var _0xfded=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','then','destroy','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','options','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','params','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfded,0xf6));var _0xdfde=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0xfded[_0xa1e3ca];return _0x5005ab;};'use strict';var emlformat=require(_0xdfde('0x0'));var rimraf=require(_0xdfde('0x1'));var zipdir=require(_0xdfde('0x2'));var jsonpatch=require(_0xdfde('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdfde('0x4'));var Mustache=require(_0xdfde('0x5'));var util=require(_0xdfde('0x6'));var path=require(_0xdfde('0x7'));var sox=require(_0xdfde('0x8'));var csv=require(_0xdfde('0x9'));var ejs=require(_0xdfde('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfde('0xb'));var squel=require(_0xdfde('0xc'));var crypto=require(_0xdfde('0xd'));var jsforce=require(_0xdfde('0xe'));var deskjs=require(_0xdfde('0xf'));var toCsv=require(_0xdfde('0x9'));var querystring=require(_0xdfde('0x10'));var Papa=require('papaparse');var Redis=require(_0xdfde('0x11'));var authService=require(_0xdfde('0x12'));var qs=require(_0xdfde('0x13'));var as=require(_0xdfde('0x14'));var hardwareService=require(_0xdfde('0x15'));var logger=require(_0xdfde('0x16'))(_0xdfde('0x17'));var utils=require(_0xdfde('0x18'));var config=require(_0xdfde('0x19'));var licenseUtil=require(_0xdfde('0x1a'));var db=require(_0xdfde('0x1b'))['db'];function respondWithStatusCode(_0x11d48f,_0x235216){_0x235216=_0x235216||0xcc;return function(_0x1c64d3){if(_0x1c64d3){return _0x11d48f[_0xdfde('0x1c')](_0x235216);}return _0x11d48f[_0xdfde('0x1d')](_0x235216)[_0xdfde('0x1e')]();};}function respondWithResult(_0x5240df,_0xc641d7){_0xc641d7=_0xc641d7||0xc8;return function(_0x1c5f4a){if(_0x1c5f4a){return _0x5240df[_0xdfde('0x1d')](_0xc641d7)[_0xdfde('0x1f')](_0x1c5f4a);}};}function respondWithFilteredResult(_0x20ad00,_0x2d32b8){return function(_0x3fed91){if(_0x3fed91){var _0x40d130=typeof _0x2d32b8['offset']==='undefined'&&typeof _0x2d32b8[_0xdfde('0x20')]===_0xdfde('0x21');var _0xef6ba0=_0x3fed91[_0xdfde('0x22')];var _0x263e5b=_0x40d130?0x0:_0x2d32b8[_0xdfde('0x23')];var _0x175a7f=_0x40d130?_0x3fed91[_0xdfde('0x22')]:_0x2d32b8[_0xdfde('0x23')]+_0x2d32b8['limit'];var _0x1d62f5;if(_0x175a7f>=_0xef6ba0){_0x175a7f=_0xef6ba0;_0x1d62f5=0xc8;}else{_0x1d62f5=0xce;}_0x20ad00['status'](_0x1d62f5);return _0x20ad00[_0xdfde('0x24')]('Content-Range',_0x263e5b+'-'+_0x175a7f+'/'+_0xef6ba0)['json'](_0x3fed91);}return null;};}function patchUpdates(_0x41f08a){return function(_0x153c17){try{jsonpatch['apply'](_0x153c17,_0x41f08a,!![]);}catch(_0x3cbc39){return BPromise[_0xdfde('0x25')](_0x3cbc39);}return _0x153c17[_0xdfde('0x26')]();};}function saveUpdates(_0x404fec,_0x4733c4){return function(_0x2e5df6){if(_0x2e5df6){return _0x2e5df6[_0xdfde('0x27')](_0x404fec)[_0xdfde('0x28')](function(_0x1789b1){return _0x1789b1;});}return null;};}function removeEntity(_0x1438e7,_0xdb53f1){return function(_0x58483d){if(_0x58483d){return _0x58483d[_0xdfde('0x29')]()[_0xdfde('0x28')](function(){_0x1438e7['status'](0xcc)[_0xdfde('0x1e')]();});}};}function handleEntityNotFound(_0x45bc01,_0x196dea){return function(_0x3c8800){if(!_0x3c8800){_0x45bc01[_0xdfde('0x1c')](0x194);}return _0x3c8800;};}function handleError(_0x4f6d37,_0x2ce192){_0x2ce192=_0x2ce192||0x1f4;return function(_0x21206d){logger[_0xdfde('0x2a')](_0x21206d[_0xdfde('0x2b')]);if(_0x21206d[_0xdfde('0x2c')]){delete _0x21206d['name'];}_0x4f6d37[_0xdfde('0x1d')](_0x2ce192)['send'](_0x21206d);};}exports[_0xdfde('0x2d')]=function(_0x5b50b4,_0x320a1b){var _0x40ce5d={},_0x4dfaec={},_0x700660={'count':0x0,'rows':[]};var _0x485cb4=_[_0xdfde('0x2e')](db[_0xdfde('0x2f')][_0xdfde('0x30')],function(_0x54042f){return{'name':_0x54042f[_0xdfde('0x31')],'type':_0x54042f[_0xdfde('0x32')][_0xdfde('0x33')]};});_0x4dfaec[_0xdfde('0x34')]=_[_0xdfde('0x2e')](_0x485cb4,_0xdfde('0x2c'));_0x4dfaec[_0xdfde('0x35')]=_[_0xdfde('0x36')](_0x5b50b4['query']);_0x4dfaec['filters']=_[_0xdfde('0x37')](_0x4dfaec[_0xdfde('0x34')],_0x4dfaec[_0xdfde('0x35')]);_0x40ce5d[_0xdfde('0x38')]=_['intersection'](_0x4dfaec[_0xdfde('0x34')],qs[_0xdfde('0x39')](_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x39')]));_0x40ce5d['attributes']=_0x40ce5d[_0xdfde('0x38')][_0xdfde('0x3a')]?_0x40ce5d['attributes']:_0x4dfaec['model'];if(!_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x3b')](_0xdfde('0x3c'))){_0x40ce5d[_0xdfde('0x20')]=qs['limit'](_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x20')]);_0x40ce5d[_0xdfde('0x23')]=qs['offset'](_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x23')]);}_0x40ce5d['order']=qs['sort'](_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x3d')]);_0x40ce5d[_0xdfde('0x3e')]=qs['filters'](_[_0xdfde('0x3f')](_0x5b50b4['query'],_0x4dfaec[_0xdfde('0x40')]),_0x485cb4);if(_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x41')]){_0x40ce5d[_0xdfde('0x3e')]=_['merge'](_0x40ce5d[_0xdfde('0x3e')],{'$or':_[_0xdfde('0x2e')](_0x485cb4,function(_0x5d0727){if(_0x5d0727['type']!==_0xdfde('0x42')){var _0xbd27b0={};_0xbd27b0[_0x5d0727[_0xdfde('0x2c')]]={'$like':'%'+_0x5b50b4[_0xdfde('0x35')][_0xdfde('0x41')]+'%'};return _0xbd27b0;}})});}_0x40ce5d=_[_0xdfde('0x43')]({},_0x40ce5d,_0x5b50b4['options']);var _0x543dec={'where':_0x40ce5d['where']};return db[_0xdfde('0x2f')]['count'](_0x543dec)[_0xdfde('0x28')](function(_0x302da9){_0x700660[_0xdfde('0x22')]=_0x302da9;if(_0x5b50b4['query'][_0xdfde('0x44')]){_0x40ce5d[_0xdfde('0x45')]=[{'all':!![]}];}return db[_0xdfde('0x2f')]['findAll'](_0x40ce5d);})['then'](function(_0x4b7ed5){_0x700660[_0xdfde('0x46')]=_0x4b7ed5;return _0x700660;})[_0xdfde('0x28')](respondWithFilteredResult(_0x320a1b,_0x40ce5d))[_0xdfde('0x47')](handleError(_0x320a1b,null));};exports[_0xdfde('0x48')]=function(_0x2285a9,_0x6e2d01){var _0x47b0ca={'raw':![],'where':{'id':_0x2285a9['params']['id']}},_0x241b39={};_0x241b39[_0xdfde('0x34')]=_[_0xdfde('0x36')](db[_0xdfde('0x2f')][_0xdfde('0x30')]);_0x241b39[_0xdfde('0x35')]=_['keys'](_0x2285a9[_0xdfde('0x35')]);_0x241b39[_0xdfde('0x40')]=_[_0xdfde('0x37')](_0x241b39[_0xdfde('0x34')],_0x241b39[_0xdfde('0x35')]);_0x47b0ca[_0xdfde('0x38')]=_[_0xdfde('0x37')](_0x241b39[_0xdfde('0x34')],qs[_0xdfde('0x39')](_0x2285a9[_0xdfde('0x35')][_0xdfde('0x39')]));_0x47b0ca[_0xdfde('0x38')]=_0x47b0ca[_0xdfde('0x38')][_0xdfde('0x3a')]?_0x47b0ca[_0xdfde('0x38')]:_0x241b39[_0xdfde('0x34')];if(_0x2285a9[_0xdfde('0x35')][_0xdfde('0x44')]){_0x47b0ca['include']=[{'all':!![]}];}_0x47b0ca=_[_0xdfde('0x43')]({},_0x47b0ca,_0x2285a9[_0xdfde('0x49')]);return db[_0xdfde('0x2f')][_0xdfde('0x4a')](_0x47b0ca)[_0xdfde('0x28')](handleEntityNotFound(_0x6e2d01,null))[_0xdfde('0x28')](respondWithResult(_0x6e2d01,null))['catch'](handleError(_0x6e2d01,null));};exports[_0xdfde('0x4b')]=function(_0x504ece,_0x33c7c0){return db['AnalyticFieldReport'][_0xdfde('0x4b')](_0x504ece[_0xdfde('0x4c')],{})[_0xdfde('0x28')](respondWithResult(_0x33c7c0,0xc9))['catch'](handleError(_0x33c7c0,null));};exports['bulkCreate']=function(_0x53b201,_0x596d0d){return db[_0xdfde('0x2f')][_0xdfde('0x4d')](_0x53b201[_0xdfde('0x4c')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x596d0d,0xc9))[_0xdfde('0x47')](handleError(_0x596d0d,null));};exports[_0xdfde('0x27')]=function(_0x1c42df,_0x4ef500){if(_0x1c42df[_0xdfde('0x4c')]['id']){delete _0x1c42df['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x1c42df['params']['id']}})['then'](handleEntityNotFound(_0x4ef500,null))[_0xdfde('0x28')](saveUpdates(_0x1c42df['body'],null))[_0xdfde('0x28')](respondWithResult(_0x4ef500,null))[_0xdfde('0x47')](handleError(_0x4ef500,null));};exports[_0xdfde('0x29')]=function(_0x23ba8e,_0x5270d7){return db[_0xdfde('0x2f')][_0xdfde('0x4a')]({'where':{'id':_0x23ba8e['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x5270d7,null))[_0xdfde('0x28')](removeEntity(_0x5270d7,null))[_0xdfde('0x47')](handleError(_0x5270d7,null));};exports[_0xdfde('0x4e')]=function(_0x2ff3cf,_0x22fe2a){return db[_0xdfde('0x2f')][_0xdfde('0x29')]({'where':{'id':_0x2ff3cf[_0xdfde('0x35')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xdfde('0x28')](respondWithResult(_0x22fe2a,0xcc))[_0xdfde('0x47')](handleError(_0x22fe2a,null));};exports[_0xdfde('0x4f')]=function(_0x263376,_0x4a301b,_0x5cf2bb){return db[_0xdfde('0x50')][_0xdfde('0x51')]({'where':{'id':_0x263376[_0xdfde('0x52')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x4a301b,null))[_0xdfde('0x28')](function(_0x5971dd){if(_0x5971dd){return db[_0xdfde('0x53')][_0xdfde('0x54')](function(_0x3fe4d7){return db[_0xdfde('0x2f')][_0xdfde('0x29')]({'where':{'CustomReportId':_0x263376[_0xdfde('0x52')]['id']},'transaction':_0x3fe4d7})['then'](function(_0xa4b6d8){var _0x35ff09=_[_0xdfde('0x2e')](_0x263376[_0xdfde('0x4c')],function(_0xd1f01a){delete _0xd1f01a['id'];_0xd1f01a[_0xdfde('0x55')]=_0x263376[_0xdfde('0x52')]['id'];return _0xd1f01a;});return db[_0xdfde('0x2f')]['bulkCreate'](_0x35ff09,{'transaction':_0x3fe4d7});});})['then'](function(){return db[_0xdfde('0x2f')]['findAll']({'where':{'CustomReportId':_0x263376[_0xdfde('0x52')]['id']}});});}})[_0xdfde('0x28')](respondWithResult(_0x4a301b,null))[_0xdfde('0x47')](handleError(_0x4a301b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d198904..5185c7b 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 _0x2f77=['./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','util','api','moment','bluebird','request-promise','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2f77,0x176));var _0x72f7=function(_0x3fddf3,_0x571c6b){_0x3fddf3=_0x3fddf3-0x0;var _0x54df5d=_0x2f77[_0x3fddf3];return _0x54df5d;};'use strict';var _=require('lodash');var util=require(_0x72f7('0x0'));var logger=require('../../config/logger')(_0x72f7('0x1'));var moment=require(_0x72f7('0x2'));var BPromise=require(_0x72f7('0x3'));var rp=require(_0x72f7('0x4'));var fs=require('fs');var path=require(_0x72f7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x72f7('0x6'));module[_0x72f7('0x7')]=function(_0x21e4e6,_0x32de0f){return _0x21e4e6['define'](_0x72f7('0x8'),attributes,{'tableName':_0x72f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc78=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util'];(function(_0x27d40c,_0x679f11){var _0xed921a=function(_0x37806f){while(--_0x37806f){_0x27d40c['push'](_0x27d40c['shift']());}};_0xed921a(++_0x679f11);}(_0xbc78,0x16b));var _0x8bc7=function(_0x3bb52d,_0x2a95ac){_0x3bb52d=_0x3bb52d-0x0;var _0x349129=_0xbc78[_0x3bb52d];return _0x349129;};'use strict';var _=require('lodash');var util=require(_0x8bc7('0x0'));var logger=require(_0x8bc7('0x1'))(_0x8bc7('0x2'));var moment=require(_0x8bc7('0x3'));var BPromise=require(_0x8bc7('0x4'));var rp=require(_0x8bc7('0x5'));var fs=require('fs');var path=require(_0x8bc7('0x6'));var rimraf=require(_0x8bc7('0x7'));var config=require(_0x8bc7('0x8'));var attributes=require(_0x8bc7('0x9'));module[_0x8bc7('0xa')]=function(_0x309aaa,_0x35831f){return _0x309aaa[_0x8bc7('0xb')](_0x8bc7('0xc'),attributes,{'tableName':_0x8bc7('0xd'),'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 a9866c8..f5b5484 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 _0xa806=['../../config/environment','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x2ee858,_0x492371){var _0x42cb6d=function(_0x8012b8){while(--_0x8012b8){_0x2ee858['push'](_0x2ee858['shift']());}};_0x42cb6d(++_0x492371);}(_0xa806,0xf5));var _0x6a80=function(_0x29c8c4,_0x2cdf25){_0x29c8c4=_0x29c8c4-0x0;var _0xf11b18=_0xa806[_0x29c8c4];return _0xf11b18;};'use strict';var _=require(_0x6a80('0x0'));var util=require(_0x6a80('0x1'));var moment=require(_0x6a80('0x2'));var BPromise=require(_0x6a80('0x3'));var rs=require(_0x6a80('0x4'));var fs=require('fs');var Redis=require(_0x6a80('0x5'));var db=require(_0x6a80('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a80('0x7'));var config=require(_0x6a80('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a80('0x9')][_0x6a80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x526610,_0x5dd1ce,_0x3b4a5d){return new BPromise(function(_0x10f504,_0x335c20){return client[_0x6a80('0xb')](_0x526610,_0x3b4a5d)['then'](function(_0x5651e2){logger[_0x6a80('0xc')](_0x6a80('0xd'),_0x5dd1ce,_0x6a80('0xe'));logger[_0x6a80('0xf')](_0x6a80('0x10'),_0x5dd1ce,_0x6a80('0xe'),JSON[_0x6a80('0x11')](_0x5651e2));if(_0x5651e2['error']){if(_0x5651e2[_0x6a80('0x12')][_0x6a80('0x13')]===0x1f4){logger[_0x6a80('0x12')](_0x6a80('0xd'),_0x5dd1ce,_0x5651e2[_0x6a80('0x12')][_0x6a80('0x14')]);return _0x335c20(_0x5651e2[_0x6a80('0x12')][_0x6a80('0x14')]);}logger[_0x6a80('0x12')](_0x6a80('0xd'),_0x5dd1ce,_0x5651e2[_0x6a80('0x12')][_0x6a80('0x14')]);return _0x10f504(_0x5651e2[_0x6a80('0x12')]['message']);}else{logger['info'](_0x6a80('0xd'),_0x5dd1ce,_0x6a80('0xe'));_0x10f504(_0x5651e2[_0x6a80('0x15')][_0x6a80('0x14')]);}})[_0x6a80('0x16')](function(_0x3ce5d6){logger['error'](_0x6a80('0xd'),_0x5dd1ce,_0x3ce5d6);_0x335c20(_0x3ce5d6);});});} \ No newline at end of file +var _0x5509=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result'];(function(_0x2091f3,_0xd9fe8e){var _0x21a86a=function(_0x146402){while(--_0x146402){_0x2091f3['push'](_0x2091f3['shift']());}};_0x21a86a(++_0xd9fe8e);}(_0x5509,0x188));var _0x9550=function(_0x3abd03,_0x1a5cb9){_0x3abd03=_0x3abd03-0x0;var _0x4be679=_0x5509[_0x3abd03];return _0x4be679;};'use strict';var _=require(_0x9550('0x0'));var util=require(_0x9550('0x1'));var moment=require('moment');var BPromise=require(_0x9550('0x2'));var rs=require(_0x9550('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9550('0x4'))['db'];var utils=require(_0x9550('0x5'));var logger=require('../../config/logger')(_0x9550('0x6'));var config=require(_0x9550('0x7'));var jayson=require(_0x9550('0x8'));var client=jayson[_0x9550('0x9')][_0x9550('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263978,_0x2aeba4,_0x6cc67f){return new BPromise(function(_0x1fd64a,_0x59ca2b){return client[_0x9550('0xb')](_0x263978,_0x6cc67f)[_0x9550('0xc')](function(_0x131910){logger[_0x9550('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2aeba4,'request\x20sent');logger[_0x9550('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2aeba4,_0x9550('0xf'),JSON[_0x9550('0x10')](_0x131910));if(_0x131910['error']){if(_0x131910[_0x9550('0x11')][_0x9550('0x12')]===0x1f4){logger[_0x9550('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2aeba4,_0x131910[_0x9550('0x11')]['message']);return _0x59ca2b(_0x131910[_0x9550('0x11')][_0x9550('0x13')]);}logger[_0x9550('0x11')](_0x9550('0x14'),_0x2aeba4,_0x131910[_0x9550('0x11')][_0x9550('0x13')]);return _0x1fd64a(_0x131910[_0x9550('0x11')][_0x9550('0x13')]);}else{logger[_0x9550('0xd')](_0x9550('0x14'),_0x2aeba4,_0x9550('0xf'));_0x1fd64a(_0x131910[_0x9550('0x15')][_0x9550('0x13')]);}})[_0x9550('0x16')](function(_0x5174a1){logger[_0x9550('0x11')](_0x9550('0x14'),_0x2aeba4,_0x5174a1);_0x59ca2b(_0x5174a1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 44c06e8..8dd343b 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(_0x5ccc3f,_0x615c30){var _0x3b62b7=function(_0x332590){while(--_0x332590){_0x5ccc3f['push'](_0x5ccc3f['shift']());}};_0x3b62b7(++_0x615c30);}(_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['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(_0x4e2d99,_0x32ea42){var _0x306954=function(_0x530b3a){while(--_0x530b3a){_0x4e2d99['push'](_0x4e2d99['shift']());}};_0x306954(++_0x32ea42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 bbd28e3..4dc2c49 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 _0xd84c=['STRING','name','TEXT','sequelize','exports'];(function(_0x386bbf,_0x29f394){var _0x2df2d3=function(_0x15db7b){while(--_0x15db7b){_0x386bbf['push'](_0x386bbf['shift']());}};_0x2df2d3(++_0x29f394);}(_0xd84c,0x102));var _0xcd84=function(_0x4e4561,_0x5462f6){_0x4e4561=_0x4e4561-0x0;var _0x582b2c=_0xd84c[_0x4e4561];return _0x582b2c;};'use strict';var Sequelize=require(_0xcd84('0x0'));module[_0xcd84('0x1')]={'name':{'type':Sequelize[_0xcd84('0x2')],'allowNull':![],'unique':_0xcd84('0x3')},'table':{'type':Sequelize[_0xcd84('0x2')]},'metric':{'type':Sequelize[_0xcd84('0x4')]},'description':{'type':Sequelize[_0xcd84('0x2')]}}; \ No newline at end of file +var _0xce3a=['exports','STRING','name','TEXT','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xce3a,0x194));var _0xace3=function(_0x23d473,_0x451eec){_0x23d473=_0x23d473-0x0;var _0x456c2e=_0xce3a[_0x23d473];return _0x456c2e;};'use strict';var Sequelize=require(_0xace3('0x0'));module[_0xace3('0x1')]={'name':{'type':Sequelize[_0xace3('0x2')],'allowNull':![],'unique':_0xace3('0x3')},'table':{'type':Sequelize[_0xace3('0x2')]},'metric':{'type':Sequelize[_0xace3('0x4')]},'description':{'type':Sequelize[_0xace3('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 72ab4c3..45b2adf 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 _0xa41a=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','send','map','AnalyticMetric','type','key','model','query','keys','intersection','fields'];(function(_0x1e37f2,_0x254694){var _0x1964f1=function(_0x33a083){while(--_0x33a083){_0x1e37f2['push'](_0x1e37f2['shift']());}};_0x1964f1(++_0x254694);}(_0xa41a,0x6b));var _0xaa41=function(_0x493a96,_0x55d69c){_0x493a96=_0x493a96-0x0;var _0x565afd=_0xa41a[_0x493a96];return _0x565afd;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){var _0x5c3074=_0x21f596['get']({'plain':!![]});var _0x16aec5='Metrics';return db['UserProfileResource'][_0xaa41('0x24')]({'where':{'type':_0x16aec5,'resourceId':_0x5c3074['id']}})['then'](function(){return _0x21f596;});})['then'](function(){_0x43a85c[_0xaa41('0x1a')](0xcc)[_0xaa41('0x1b')]();});}};}function handleEntityNotFound(_0x392214,_0x632fd2){return function(_0x3f5272){if(!_0x3f5272){_0x392214[_0xaa41('0x19')](0x194);}return _0x3f5272;};}function handleError(_0x57ef96,_0x30a174){_0x30a174=_0x30a174||0x1f4;return function(_0x1f0275){logger[_0xaa41('0x26')](_0x1f0275[_0xaa41('0x27')]);if(_0x1f0275[_0xaa41('0x28')]){delete _0x1f0275[_0xaa41('0x28')];}_0x57ef96[_0xaa41('0x1a')](_0x30a174)[_0xaa41('0x29')](_0x1f0275);};}exports['index']=function(_0x377add,_0x48b48b){var _0x5dad80={},_0x714537={},_0x1176bd={'count':0x0,'rows':[]};var _0x534a85=_[_0xaa41('0x2a')](db[_0xaa41('0x2b')]['rawAttributes'],function(_0x5022fb){return{'name':_0x5022fb['fieldName'],'type':_0x5022fb[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x714537[_0xaa41('0x2e')]=_[_0xaa41('0x2a')](_0x534a85,'name');_0x714537[_0xaa41('0x2f')]=_[_0xaa41('0x30')](_0x377add[_0xaa41('0x2f')]);_0x714537['filters']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],_0x714537[_0xaa41('0x2f')]);_0x5dad80['attributes']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],qs['fields'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x5dad80[_0xaa41('0x33')]=_0x5dad80['attributes'][_0xaa41('0x34')]?_0x5dad80['attributes']:_0x714537[_0xaa41('0x2e')];if(!_0x377add[_0xaa41('0x2f')][_0xaa41('0x35')]('nolimit')){_0x5dad80['limit']=qs['limit'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x1e')]);_0x5dad80[_0xaa41('0x20')]=qs[_0xaa41('0x20')](_0x377add['query']['offset']);}_0x5dad80[_0xaa41('0x36')]=qs[_0xaa41('0x37')](_0x377add[_0xaa41('0x2f')][_0xaa41('0x37')]);_0x5dad80[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_[_0xaa41('0x3a')](_0x377add['query'],_0x714537[_0xaa41('0x39')]),_0x534a85);if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]){_0x5dad80[_0xaa41('0x38')]=_['merge'](_0x5dad80['where'],{'$or':_[_0xaa41('0x2a')](_0x534a85,function(_0x275fa3){if(_0x275fa3['type']!==_0xaa41('0x3c')){var _0x563687={};_0x563687[_0x275fa3[_0xaa41('0x28')]]={'$like':'%'+_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]+'%'};return _0x563687;}})});}_0x5dad80=_[_0xaa41('0x3d')]({},_0x5dad80,_0x377add[_0xaa41('0x3e')]);var _0x12ba1a={'where':_0x5dad80[_0xaa41('0x38')]};return db[_0xaa41('0x2b')]['count'](_0x12ba1a)[_0xaa41('0x25')](function(_0x2abf39){_0x1176bd[_0xaa41('0x1f')]=_0x2abf39;if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x5dad80[_0xaa41('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5dad80);})[_0xaa41('0x25')](function(_0x4f9086){_0x1176bd[_0xaa41('0x41')]=_0x4f9086;return _0x1176bd;})[_0xaa41('0x25')](respondWithFilteredResult(_0x48b48b,_0x5dad80))[_0xaa41('0x42')](handleError(_0x48b48b,null));};exports[_0xaa41('0x43')]=function(_0x2aac10,_0x10bf09){var _0x2db8d6={'raw':!![],'where':{'id':_0x2aac10[_0xaa41('0x44')]['id']}},_0x5ee74c={};_0x5ee74c['model']=_['keys'](db[_0xaa41('0x2b')]['rawAttributes']);_0x5ee74c['query']=_['keys'](_0x2aac10[_0xaa41('0x2f')]);_0x5ee74c['filters']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],_0x5ee74c['query']);_0x2db8d6['attributes']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],qs[_0xaa41('0x32')](_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x2db8d6[_0xaa41('0x33')]=_0x2db8d6[_0xaa41('0x33')][_0xaa41('0x34')]?_0x2db8d6[_0xaa41('0x33')]:_0x5ee74c['model'];if(_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x2db8d6[_0xaa41('0x40')]=[{'all':!![]}];}_0x2db8d6=_[_0xaa41('0x3d')]({},_0x2db8d6,_0x2aac10[_0xaa41('0x3e')]);return db[_0xaa41('0x2b')]['find'](_0x2db8d6)[_0xaa41('0x25')](handleEntityNotFound(_0x10bf09,null))[_0xaa41('0x25')](respondWithResult(_0x10bf09,null))[_0xaa41('0x42')](handleError(_0x10bf09,null));};exports[_0xaa41('0x45')]=function(_0x57d1f6,_0x23bc61){return db['AnalyticMetric']['create'](_0x57d1f6[_0xaa41('0x46')],{})[_0xaa41('0x25')](function(_0x3e16ef){var _0x4ca114=_0x57d1f6[_0xaa41('0x47')][_0xaa41('0x48')]({'plain':!![]});if(!_0x4ca114)throw new Error(_0xaa41('0x49'));if(_0x4ca114['role']===_0xaa41('0x47')){var _0x3c4f24=_0x3e16ef[_0xaa41('0x48')]({'plain':!![]});var _0x1378f9=_0xaa41('0x4a');return db[_0xaa41('0x4b')][_0xaa41('0x4c')]({'where':{'name':_0x1378f9,'userProfileId':_0x4ca114[_0xaa41('0x4d')]},'raw':!![]})['then'](function(_0x9f0a81){if(_0x9f0a81&&_0x9f0a81['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x45')]({'name':_0x3c4f24[_0xaa41('0x28')],'resourceId':_0x3c4f24['id'],'type':_0x9f0a81[_0xaa41('0x28')],'sectionId':_0x9f0a81['id']},{})[_0xaa41('0x25')](function(){return _0x3e16ef;});}else{return _0x3e16ef;}})[_0xaa41('0x42')](function(_0x288db3){logger[_0xaa41('0x26')](_0xaa41('0x4e'),_0x288db3);throw _0x288db3;});}return _0x3e16ef;})['then'](respondWithResult(_0x23bc61,0xc9))[_0xaa41('0x42')](handleError(_0x23bc61,null));};exports[_0xaa41('0x23')]=function(_0x1d518f,_0x4f9e92){if(_0x1d518f[_0xaa41('0x46')]['id']){delete _0x1d518f[_0xaa41('0x46')]['id'];}return db['AnalyticMetric'][_0xaa41('0x4c')]({'where':{'id':_0x1d518f[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x4f9e92,null))['then'](saveUpdates(_0x1d518f[_0xaa41('0x46')],null))[_0xaa41('0x25')](respondWithResult(_0x4f9e92,null))['catch'](handleError(_0x4f9e92,null));};exports['destroy']=function(_0x3745ed,_0x3cd14f){return db[_0xaa41('0x2b')]['find']({'where':{'id':_0x3745ed[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x3cd14f,null))[_0xaa41('0x25')](removeEntity(_0x3cd14f,null))[_0xaa41('0x42')](handleError(_0x3cd14f,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x26edbe,_0x5c097c){var _0x16252b=function(_0x5bf6f9){while(--_0x5bf6f9){_0x26edbe['push'](_0x26edbe['shift']());}};_0x16252b(++_0x5c097c);}(_0x9a19,0x114));var _0x99a1=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x9a19[_0x31a576];return _0x30b1d3;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ca3af71..450cf3b 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 _0x5b20=['../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x35a881,_0x4e9bb4){var _0x405349=function(_0x205185){while(--_0x205185){_0x35a881['push'](_0x35a881['shift']());}};_0x405349(++_0x4e9bb4);}(_0x5b20,0x86));var _0x05b2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5b20[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var logger=require(_0x05b2('0x2'))(_0x05b2('0x3'));var moment=require(_0x05b2('0x4'));var BPromise=require(_0x05b2('0x5'));var rp=require(_0x05b2('0x6'));var fs=require('fs');var path=require(_0x05b2('0x7'));var rimraf=require(_0x05b2('0x8'));var config=require(_0x05b2('0x9'));var attributes=require(_0x05b2('0xa'));module['exports']=function(_0x22e0e2,_0x83fd18){return _0x22e0e2['define'](_0x05b2('0xb'),attributes,{'tableName':_0x05b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa786=['moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','../../config/logger','api'];(function(_0xcef799,_0x46b6ed){var _0x56bfd0=function(_0xaf8640){while(--_0xaf8640){_0xcef799['push'](_0xcef799['shift']());}};_0x56bfd0(++_0x46b6ed);}(_0xa786,0x1d2));var _0x6a78=function(_0x3145b8,_0x3a38d1){_0x3145b8=_0x3145b8-0x0;var _0xf67d13=_0xa786[_0x3145b8];return _0xf67d13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a78('0x0'))(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require(_0x6a78('0x3'));var rp=require(_0x6a78('0x4'));var fs=require('fs');var path=require(_0x6a78('0x5'));var rimraf=require(_0x6a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a78('0x7'));module[_0x6a78('0x8')]=function(_0xc0be8b,_0x45470e){return _0xc0be8b[_0x6a78('0x9')](_0x6a78('0xa'),attributes,{'tableName':_0x6a78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index dc821d0..9e4a128 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 _0x171a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis'];(function(_0x272a46,_0x12b300){var _0x2bfd12=function(_0x4a3d5f){while(--_0x4a3d5f){_0x272a46['push'](_0x272a46['shift']());}};_0x2bfd12(++_0x12b300);}(_0x171a,0xc3));var _0xa171=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x171a[_0xf4666e];return _0x1853f1;};'use strict';var _=require(_0xa171('0x0'));var util=require(_0xa171('0x1'));var moment=require(_0xa171('0x2'));var BPromise=require(_0xa171('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa171('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa171('0x5'));var logger=require(_0xa171('0x6'))('rpc');var config=require(_0xa171('0x7'));var jayson=require(_0xa171('0x8'));var client=jayson[_0xa171('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e2eb8,_0x544675,_0x6aa569){return new BPromise(function(_0x1f96b5,_0x2a4f6e){return client[_0xa171('0xa')](_0x3e2eb8,_0x6aa569)[_0xa171('0xb')](function(_0x267e39){logger[_0xa171('0xc')](_0xa171('0xd'),_0x544675,_0xa171('0xe'));logger[_0xa171('0xf')](_0xa171('0x10'),_0x544675,'request\x20sent',JSON[_0xa171('0x11')](_0x267e39));if(_0x267e39[_0xa171('0x12')]){if(_0x267e39[_0xa171('0x12')]['code']===0x1f4){logger[_0xa171('0x12')](_0xa171('0xd'),_0x544675,_0x267e39['error']['message']);return _0x2a4f6e(_0x267e39['error'][_0xa171('0x13')]);}logger[_0xa171('0x12')](_0xa171('0xd'),_0x544675,_0x267e39[_0xa171('0x12')][_0xa171('0x13')]);return _0x1f96b5(_0x267e39[_0xa171('0x12')][_0xa171('0x13')]);}else{logger[_0xa171('0xc')](_0xa171('0xd'),_0x544675,'request\x20sent');_0x1f96b5(_0x267e39['result']['message']);}})['catch'](function(_0x45f876){logger['error'](_0xa171('0xd'),_0x544675,_0x45f876);_0x2a4f6e(_0x45f876);});});} \ No newline at end of file +var _0x7590=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4712ec,_0x1a084d){var _0x195204=function(_0x1a6ec3){while(--_0x1a6ec3){_0x4712ec['push'](_0x4712ec['shift']());}};_0x195204(++_0x1a084d);}(_0x7590,0x18c));var _0x0759=function(_0x1be5a6,_0x50dff7){_0x1be5a6=_0x1be5a6-0x0;var _0x1c3173=_0x7590[_0x1be5a6];return _0x1c3173;};'use strict';var _=require(_0x0759('0x0'));var util=require('util');var moment=require(_0x0759('0x1'));var BPromise=require(_0x0759('0x2'));var rs=require(_0x0759('0x3'));var fs=require('fs');var Redis=require(_0x0759('0x4'));var db=require(_0x0759('0x5'))['db'];var utils=require(_0x0759('0x6'));var logger=require(_0x0759('0x7'))(_0x0759('0x8'));var config=require(_0x0759('0x9'));var jayson=require(_0x0759('0xa'));var client=jayson['client'][_0x0759('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x533e6,_0x5de197,_0x156c24){return new BPromise(function(_0x424cdc,_0x27a135){return client[_0x0759('0xc')](_0x533e6,_0x156c24)['then'](function(_0x31e32d){logger[_0x0759('0xd')](_0x0759('0xe'),_0x5de197,_0x0759('0xf'));logger[_0x0759('0x10')](_0x0759('0x11'),_0x5de197,'request\x20sent',JSON[_0x0759('0x12')](_0x31e32d));if(_0x31e32d['error']){if(_0x31e32d[_0x0759('0x13')]['code']===0x1f4){logger['error'](_0x0759('0xe'),_0x5de197,_0x31e32d['error']['message']);return _0x27a135(_0x31e32d[_0x0759('0x13')][_0x0759('0x14')]);}logger['error'](_0x0759('0xe'),_0x5de197,_0x31e32d[_0x0759('0x13')][_0x0759('0x14')]);return _0x424cdc(_0x31e32d[_0x0759('0x13')][_0x0759('0x14')]);}else{logger['info'](_0x0759('0xe'),_0x5de197,_0x0759('0xf'));_0x424cdc(_0x31e32d['result']['message']);}})[_0x0759('0x15')](function(_0x519a72){logger[_0x0759('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x5de197,_0x519a72);_0x27a135(_0x519a72);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 43cbf3c..02fc16e 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 _0x9c63=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x47bcdc,_0x24e3c2){var _0x134d9c=function(_0x176083){while(--_0x176083){_0x47bcdc['push'](_0x47bcdc['shift']());}};_0x134d9c(++_0x24e3c2);}(_0x9c63,0x1a7));var _0x39c6=function(_0x10efac,_0x24bb07){_0x10efac=_0x10efac-0x0;var _0x2d7537=_0x9c63[_0x10efac];return _0x2d7537;};'use strict';var multer=require(_0x39c6('0x0'));var util=require(_0x39c6('0x1'));var path=require(_0x39c6('0x2'));var timeout=require(_0x39c6('0x3'));var express=require(_0x39c6('0x4'));var router=express['Router']();var fs_extra=require(_0x39c6('0x5'));var auth=require(_0x39c6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39c6('0x7'));router[_0x39c6('0x8')]('/',auth[_0x39c6('0x9')](),controller[_0x39c6('0xa')]);router[_0x39c6('0x8')](_0x39c6('0xb'),auth['isAuthenticated'](),controller[_0x39c6('0xc')]);router[_0x39c6('0xd')]('/',auth[_0x39c6('0x9')](),controller[_0x39c6('0xe')]);router[_0x39c6('0xf')]('/:id',auth[_0x39c6('0x9')](),controller['update']);router[_0x39c6('0x10')]('/:id',auth[_0x39c6('0x9')](),controller[_0x39c6('0x11')]);module[_0x39c6('0x12')]=router; \ No newline at end of file +var _0x7edb=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x20acdb,_0x210c8e){var _0x383b0d=function(_0x5d0919){while(--_0x5d0919){_0x20acdb['push'](_0x20acdb['shift']());}};_0x383b0d(++_0x210c8e);}(_0x7edb,0x158));var _0xb7ed=function(_0x46c6e8,_0x358d99){_0x46c6e8=_0x46c6e8-0x0;var _0x5b1960=_0x7edb[_0x46c6e8];return _0x5b1960;};'use strict';var multer=require('multer');var util=require(_0xb7ed('0x0'));var path=require(_0xb7ed('0x1'));var timeout=require(_0xb7ed('0x2'));var express=require(_0xb7ed('0x3'));var router=express[_0xb7ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7ed('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7ed('0x6'));router[_0xb7ed('0x7')]('/',auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x9')]);router[_0xb7ed('0x7')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xb')]);router[_0xb7ed('0xc')]('/',auth[_0xb7ed('0x8')](),controller['create']);router[_0xb7ed('0xd')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xe')]);router[_0xb7ed('0xf')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller['destroy']);module[_0xb7ed('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 851c383..84fcb41 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 _0xcb39=['sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcb39,0x76));var _0x9cb3=function(_0x1846b8,_0x5e9fd2){_0x1846b8=_0x1846b8-0x0;var _0x5d29ea=_0xcb39[_0x1846b8];return _0x5d29ea;};'use strict';var Sequelize=require(_0x9cb3('0x0'));module[_0x9cb3('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x024a=['exports','TEXT','sequelize'];(function(_0x53d860,_0x1cc203){var _0x5c1faa=function(_0x48173a){while(--_0x48173a){_0x53d860['push'](_0x53d860['shift']());}};_0x5c1faa(++_0x1cc203);}(_0x024a,0x107));var _0xa024=function(_0x44f55e,_0xeb9d0b){_0x44f55e=_0x44f55e-0x0;var _0x4ddf79=_0x024a[_0x44f55e];return _0x4ddf79;};'use strict';var Sequelize=require(_0xa024('0x0'));module[_0xa024('0x1')]={'tree':{'type':Sequelize[_0xa024('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 9795e54..0b87da2 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 _0x0d92=['body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','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','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create'];(function(_0x59d89c,_0x3db9f7){var _0x4e924d=function(_0x32c97c){while(--_0x32c97c){_0x59d89c['push'](_0x59d89c['shift']());}};_0x4e924d(++_0x3db9f7);}(_0x0d92,0xe7));var _0x20d9=function(_0x190712,_0x12a98b){_0x190712=_0x190712-0x0;var _0x4ef92f=_0x0d92[_0x190712];return _0x4ef92f;};'use strict';var emlformat=require(_0x20d9('0x0'));var rimraf=require(_0x20d9('0x1'));var zipdir=require(_0x20d9('0x2'));var jsonpatch=require(_0x20d9('0x3'));var rp=require(_0x20d9('0x4'));var moment=require(_0x20d9('0x5'));var BPromise=require(_0x20d9('0x6'));var Mustache=require(_0x20d9('0x7'));var util=require('util');var path=require('path');var sox=require(_0x20d9('0x8'));var csv=require(_0x20d9('0x9'));var ejs=require(_0x20d9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20d9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x20d9('0xc'));var deskjs=require(_0x20d9('0xd'));var toCsv=require(_0x20d9('0x9'));var querystring=require(_0x20d9('0xe'));var Papa=require(_0x20d9('0xf'));var Redis=require(_0x20d9('0x10'));var authService=require(_0x20d9('0x11'));var qs=require(_0x20d9('0x12'));var as=require(_0x20d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20d9('0x14'))(_0x20d9('0x15'));var utils=require(_0x20d9('0x16'));var config=require(_0x20d9('0x17'));var licenseUtil=require(_0x20d9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14ad27,_0x2b3b90){_0x2b3b90=_0x2b3b90||0xcc;return function(_0x31482e){if(_0x31482e){return _0x14ad27[_0x20d9('0x19')](_0x2b3b90);}return _0x14ad27[_0x20d9('0x1a')](_0x2b3b90)['end']();};}function respondWithResult(_0x4430c4,_0x10ff48){_0x10ff48=_0x10ff48||0xc8;return function(_0x44c004){if(_0x44c004){return _0x4430c4[_0x20d9('0x1a')](_0x10ff48)[_0x20d9('0x1b')](_0x44c004);}};}function respondWithFilteredResult(_0x4a7f7c,_0x259c81){return function(_0x391e2a){if(_0x391e2a){var _0x46a290=typeof _0x259c81[_0x20d9('0x1c')]==='undefined'&&typeof _0x259c81[_0x20d9('0x1d')]===_0x20d9('0x1e');var _0x28b18e=_0x391e2a[_0x20d9('0x1f')];var _0x4721a1=_0x46a290?0x0:_0x259c81['offset'];var _0x2cdce5=_0x46a290?_0x391e2a[_0x20d9('0x1f')]:_0x259c81[_0x20d9('0x1c')]+_0x259c81[_0x20d9('0x1d')];var _0x33a1ac;if(_0x2cdce5>=_0x28b18e){_0x2cdce5=_0x28b18e;_0x33a1ac=0xc8;}else{_0x33a1ac=0xce;}_0x4a7f7c['status'](_0x33a1ac);return _0x4a7f7c[_0x20d9('0x20')](_0x20d9('0x21'),_0x4721a1+'-'+_0x2cdce5+'/'+_0x28b18e)[_0x20d9('0x1b')](_0x391e2a);}return null;};}function patchUpdates(_0x321daa){return function(_0x239b79){try{jsonpatch[_0x20d9('0x22')](_0x239b79,_0x321daa,!![]);}catch(_0x52f52c){return BPromise[_0x20d9('0x23')](_0x52f52c);}return _0x239b79[_0x20d9('0x24')]();};}function saveUpdates(_0x1fe7d9,_0x36b237){return function(_0x44b6ca){if(_0x44b6ca){return _0x44b6ca['update'](_0x1fe7d9)[_0x20d9('0x25')](function(_0x440208){return _0x440208;});}return null;};}function removeEntity(_0x477502,_0x42057e){return function(_0x129f51){if(_0x129f51){return _0x129f51[_0x20d9('0x26')]()['then'](function(){_0x477502['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162484,_0x293565){return function(_0x3fbc2c){if(!_0x3fbc2c){_0x162484[_0x20d9('0x19')](0x194);}return _0x3fbc2c;};}function handleError(_0x1dd1be,_0xe2d432){_0xe2d432=_0xe2d432||0x1f4;return function(_0x2a9d0b){logger['error'](_0x2a9d0b[_0x20d9('0x27')]);if(_0x2a9d0b[_0x20d9('0x28')]){delete _0x2a9d0b['name'];}_0x1dd1be['status'](_0xe2d432)[_0x20d9('0x29')](_0x2a9d0b);};}exports['index']=function(_0x142d7b,_0x332e59){var _0x45aad1={},_0x55428b={},_0x1e3b71={'count':0x0,'rows':[]};var _0x845800=_[_0x20d9('0x2a')](db[_0x20d9('0x2b')][_0x20d9('0x2c')],function(_0x524791){return{'name':_0x524791[_0x20d9('0x2d')],'type':_0x524791[_0x20d9('0x2e')][_0x20d9('0x2f')]};});_0x55428b[_0x20d9('0x30')]=_[_0x20d9('0x2a')](_0x845800,_0x20d9('0x28'));_0x55428b['query']=_['keys'](_0x142d7b[_0x20d9('0x31')]);_0x55428b['filters']=_[_0x20d9('0x32')](_0x55428b[_0x20d9('0x30')],_0x55428b[_0x20d9('0x31')]);_0x45aad1[_0x20d9('0x33')]=_[_0x20d9('0x32')](_0x55428b['model'],qs['fields'](_0x142d7b[_0x20d9('0x31')][_0x20d9('0x34')]));_0x45aad1[_0x20d9('0x33')]=_0x45aad1['attributes'][_0x20d9('0x35')]?_0x45aad1[_0x20d9('0x33')]:_0x55428b[_0x20d9('0x30')];if(!_0x142d7b[_0x20d9('0x31')][_0x20d9('0x36')](_0x20d9('0x37'))){_0x45aad1[_0x20d9('0x1d')]=qs[_0x20d9('0x1d')](_0x142d7b[_0x20d9('0x31')][_0x20d9('0x1d')]);_0x45aad1[_0x20d9('0x1c')]=qs[_0x20d9('0x1c')](_0x142d7b['query']['offset']);}_0x45aad1[_0x20d9('0x38')]=qs[_0x20d9('0x39')](_0x142d7b[_0x20d9('0x31')][_0x20d9('0x39')]);_0x45aad1[_0x20d9('0x3a')]=qs[_0x20d9('0x3b')](_[_0x20d9('0x3c')](_0x142d7b['query'],_0x55428b['filters']),_0x845800);if(_0x142d7b['query'][_0x20d9('0x3d')]){_0x45aad1[_0x20d9('0x3a')]=_[_0x20d9('0x3e')](_0x45aad1[_0x20d9('0x3a')],{'$or':_[_0x20d9('0x2a')](_0x845800,function(_0x2cfb56){if(_0x2cfb56[_0x20d9('0x2e')]!==_0x20d9('0x3f')){var _0x58297a={};_0x58297a[_0x2cfb56[_0x20d9('0x28')]]={'$like':'%'+_0x142d7b[_0x20d9('0x31')][_0x20d9('0x3d')]+'%'};return _0x58297a;}})});}_0x45aad1=_[_0x20d9('0x3e')]({},_0x45aad1,_0x142d7b[_0x20d9('0x40')]);var _0x4c7dd9={'where':_0x45aad1['where']};return db[_0x20d9('0x2b')][_0x20d9('0x1f')](_0x4c7dd9)['then'](function(_0x1e94a5){_0x1e3b71[_0x20d9('0x1f')]=_0x1e94a5;if(_0x142d7b[_0x20d9('0x31')][_0x20d9('0x41')]){_0x45aad1[_0x20d9('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x20d9('0x43')](_0x45aad1);})['then'](function(_0x2ec234){_0x1e3b71['rows']=_0x2ec234;return _0x1e3b71;})['then'](respondWithFilteredResult(_0x332e59,_0x45aad1))[_0x20d9('0x44')](handleError(_0x332e59,null));};exports[_0x20d9('0x45')]=function(_0x214ede,_0x52c0bd){var _0xbb56f9={'raw':!![],'where':{'id':_0x214ede[_0x20d9('0x46')]['id']}},_0x227e9b={};_0x227e9b['model']=_[_0x20d9('0x47')](db['AnalyticTreeReport'][_0x20d9('0x2c')]);_0x227e9b[_0x20d9('0x31')]=_[_0x20d9('0x47')](_0x214ede['query']);_0x227e9b[_0x20d9('0x3b')]=_[_0x20d9('0x32')](_0x227e9b['model'],_0x227e9b[_0x20d9('0x31')]);_0xbb56f9[_0x20d9('0x33')]=_[_0x20d9('0x32')](_0x227e9b['model'],qs[_0x20d9('0x34')](_0x214ede['query'][_0x20d9('0x34')]));_0xbb56f9[_0x20d9('0x33')]=_0xbb56f9[_0x20d9('0x33')][_0x20d9('0x35')]?_0xbb56f9[_0x20d9('0x33')]:_0x227e9b['model'];if(_0x214ede[_0x20d9('0x31')]['includeAll']){_0xbb56f9[_0x20d9('0x42')]=[{'all':!![]}];}_0xbb56f9=_['merge']({},_0xbb56f9,_0x214ede[_0x20d9('0x40')]);return db[_0x20d9('0x2b')]['find'](_0xbb56f9)[_0x20d9('0x25')](handleEntityNotFound(_0x52c0bd,null))[_0x20d9('0x25')](respondWithResult(_0x52c0bd,null))['catch'](handleError(_0x52c0bd,null));};exports[_0x20d9('0x48')]=function(_0x2caa2f,_0x407d18){return db[_0x20d9('0x2b')][_0x20d9('0x48')](_0x2caa2f[_0x20d9('0x49')],{})['then'](respondWithResult(_0x407d18,0xc9))['catch'](handleError(_0x407d18,null));};exports[_0x20d9('0x4a')]=function(_0x19a53b,_0x31add1){if(_0x19a53b[_0x20d9('0x49')]['id']){delete _0x19a53b['body']['id'];}return db[_0x20d9('0x2b')][_0x20d9('0x4b')]({'where':{'id':_0x19a53b[_0x20d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x31add1,null))[_0x20d9('0x25')](saveUpdates(_0x19a53b[_0x20d9('0x49')],null))[_0x20d9('0x25')](respondWithResult(_0x31add1,null))[_0x20d9('0x44')](handleError(_0x31add1,null));};exports[_0x20d9('0x26')]=function(_0x32e1ae,_0xd4369d){return db[_0x20d9('0x2b')][_0x20d9('0x4b')]({'where':{'id':_0x32e1ae[_0x20d9('0x46')]['id']}})[_0x20d9('0x25')](handleEntityNotFound(_0xd4369d,null))[_0x20d9('0x25')](removeEntity(_0xd4369d,null))[_0x20d9('0x44')](handleError(_0xd4369d,null));}; \ No newline at end of file +var _0xcd1a=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','catch','show','params','include','find','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','reject','update','then','destroy','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcd1a,0xa7));var _0xacd1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcd1a[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xacd1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacd1('0x1'));var rp=require(_0xacd1('0x2'));var moment=require(_0xacd1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xacd1('0x4'));var util=require(_0xacd1('0x5'));var path=require(_0xacd1('0x6'));var sox=require(_0xacd1('0x7'));var csv=require(_0xacd1('0x8'));var ejs=require(_0xacd1('0x9'));var fs=require('fs');var fs_extra=require(_0xacd1('0xa'));var _=require('lodash');var squel=require(_0xacd1('0xb'));var crypto=require('crypto');var jsforce=require(_0xacd1('0xc'));var deskjs=require(_0xacd1('0xd'));var toCsv=require(_0xacd1('0x8'));var querystring=require('querystring');var Papa=require(_0xacd1('0xe'));var Redis=require(_0xacd1('0xf'));var authService=require(_0xacd1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacd1('0x11'));var logger=require(_0xacd1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xacd1('0x13'));var licenseUtil=require(_0xacd1('0x14'));var db=require(_0xacd1('0x15'))['db'];function respondWithStatusCode(_0x583657,_0x49669f){_0x49669f=_0x49669f||0xcc;return function(_0x47c2a9){if(_0x47c2a9){return _0x583657[_0xacd1('0x16')](_0x49669f);}return _0x583657[_0xacd1('0x17')](_0x49669f)[_0xacd1('0x18')]();};}function respondWithResult(_0x3a40c0,_0x25f0e8){_0x25f0e8=_0x25f0e8||0xc8;return function(_0x67c8da){if(_0x67c8da){return _0x3a40c0[_0xacd1('0x17')](_0x25f0e8)[_0xacd1('0x19')](_0x67c8da);}};}function respondWithFilteredResult(_0x2a9fb3,_0x22eb97){return function(_0x48cf1c){if(_0x48cf1c){var _0x292de6=typeof _0x22eb97[_0xacd1('0x1a')]===_0xacd1('0x1b')&&typeof _0x22eb97['limit']==='undefined';var _0x34ad6c=_0x48cf1c['count'];var _0x2fb74b=_0x292de6?0x0:_0x22eb97['offset'];var _0x100e38=_0x292de6?_0x48cf1c['count']:_0x22eb97[_0xacd1('0x1a')]+_0x22eb97['limit'];var _0x12f0ca;if(_0x100e38>=_0x34ad6c){_0x100e38=_0x34ad6c;_0x12f0ca=0xc8;}else{_0x12f0ca=0xce;}_0x2a9fb3[_0xacd1('0x17')](_0x12f0ca);return _0x2a9fb3[_0xacd1('0x1c')]('Content-Range',_0x2fb74b+'-'+_0x100e38+'/'+_0x34ad6c)['json'](_0x48cf1c);}return null;};}function patchUpdates(_0x1cc327){return function(_0x4e7fff){try{jsonpatch['apply'](_0x4e7fff,_0x1cc327,!![]);}catch(_0x2e100a){return BPromise[_0xacd1('0x1d')](_0x2e100a);}return _0x4e7fff['save']();};}function saveUpdates(_0x3af431,_0x46d81c){return function(_0x27c9ea){if(_0x27c9ea){return _0x27c9ea[_0xacd1('0x1e')](_0x3af431)[_0xacd1('0x1f')](function(_0x52f109){return _0x52f109;});}return null;};}function removeEntity(_0x5b2778,_0x5bbd7b){return function(_0x46e19b){if(_0x46e19b){return _0x46e19b[_0xacd1('0x20')]()[_0xacd1('0x1f')](function(){_0x5b2778[_0xacd1('0x17')](0xcc)[_0xacd1('0x18')]();});}};}function handleEntityNotFound(_0x37b2ab,_0x44ec63){return function(_0x2ad179){if(!_0x2ad179){_0x37b2ab[_0xacd1('0x16')](0x194);}return _0x2ad179;};}function handleError(_0x247988,_0x5d9c16){_0x5d9c16=_0x5d9c16||0x1f4;return function(_0x4fcece){logger[_0xacd1('0x21')](_0x4fcece['stack']);if(_0x4fcece[_0xacd1('0x22')]){delete _0x4fcece[_0xacd1('0x22')];}_0x247988[_0xacd1('0x17')](_0x5d9c16)['send'](_0x4fcece);};}exports[_0xacd1('0x23')]=function(_0x4af640,_0x4f3808){var _0x57e910={},_0x522394={},_0x2ed6fc={'count':0x0,'rows':[]};var _0x31bb2a=_[_0xacd1('0x24')](db[_0xacd1('0x25')][_0xacd1('0x26')],function(_0x46cd54){return{'name':_0x46cd54[_0xacd1('0x27')],'type':_0x46cd54[_0xacd1('0x28')][_0xacd1('0x29')]};});_0x522394[_0xacd1('0x2a')]=_[_0xacd1('0x24')](_0x31bb2a,_0xacd1('0x22'));_0x522394[_0xacd1('0x2b')]=_[_0xacd1('0x2c')](_0x4af640[_0xacd1('0x2b')]);_0x522394[_0xacd1('0x2d')]=_[_0xacd1('0x2e')](_0x522394[_0xacd1('0x2a')],_0x522394[_0xacd1('0x2b')]);_0x57e910[_0xacd1('0x2f')]=_[_0xacd1('0x2e')](_0x522394[_0xacd1('0x2a')],qs['fields'](_0x4af640[_0xacd1('0x2b')][_0xacd1('0x30')]));_0x57e910['attributes']=_0x57e910[_0xacd1('0x2f')][_0xacd1('0x31')]?_0x57e910[_0xacd1('0x2f')]:_0x522394[_0xacd1('0x2a')];if(!_0x4af640[_0xacd1('0x2b')][_0xacd1('0x32')](_0xacd1('0x33'))){_0x57e910[_0xacd1('0x34')]=qs[_0xacd1('0x34')](_0x4af640[_0xacd1('0x2b')][_0xacd1('0x34')]);_0x57e910[_0xacd1('0x1a')]=qs[_0xacd1('0x1a')](_0x4af640[_0xacd1('0x2b')][_0xacd1('0x1a')]);}_0x57e910[_0xacd1('0x35')]=qs[_0xacd1('0x36')](_0x4af640[_0xacd1('0x2b')][_0xacd1('0x36')]);_0x57e910['where']=qs[_0xacd1('0x2d')](_[_0xacd1('0x37')](_0x4af640[_0xacd1('0x2b')],_0x522394['filters']),_0x31bb2a);if(_0x4af640['query'][_0xacd1('0x38')]){_0x57e910[_0xacd1('0x39')]=_[_0xacd1('0x3a')](_0x57e910[_0xacd1('0x39')],{'$or':_['map'](_0x31bb2a,function(_0x2ce777){if(_0x2ce777[_0xacd1('0x28')]!==_0xacd1('0x3b')){var _0x34a61e={};_0x34a61e[_0x2ce777[_0xacd1('0x22')]]={'$like':'%'+_0x4af640[_0xacd1('0x2b')][_0xacd1('0x38')]+'%'};return _0x34a61e;}})});}_0x57e910=_[_0xacd1('0x3a')]({},_0x57e910,_0x4af640[_0xacd1('0x3c')]);var _0x5e7e6b={'where':_0x57e910['where']};return db[_0xacd1('0x25')]['count'](_0x5e7e6b)[_0xacd1('0x1f')](function(_0x34a581){_0x2ed6fc[_0xacd1('0x3d')]=_0x34a581;if(_0x4af640[_0xacd1('0x2b')][_0xacd1('0x3e')]){_0x57e910['include']=[{'all':!![]}];}return db[_0xacd1('0x25')]['findAll'](_0x57e910);})[_0xacd1('0x1f')](function(_0xba481){_0x2ed6fc['rows']=_0xba481;return _0x2ed6fc;})[_0xacd1('0x1f')](respondWithFilteredResult(_0x4f3808,_0x57e910))[_0xacd1('0x3f')](handleError(_0x4f3808,null));};exports[_0xacd1('0x40')]=function(_0x43606c,_0x8decd1){var _0x1e3e29={'raw':!![],'where':{'id':_0x43606c[_0xacd1('0x41')]['id']}},_0x4fb24d={};_0x4fb24d['model']=_[_0xacd1('0x2c')](db[_0xacd1('0x25')][_0xacd1('0x26')]);_0x4fb24d['query']=_[_0xacd1('0x2c')](_0x43606c[_0xacd1('0x2b')]);_0x4fb24d['filters']=_['intersection'](_0x4fb24d[_0xacd1('0x2a')],_0x4fb24d[_0xacd1('0x2b')]);_0x1e3e29[_0xacd1('0x2f')]=_[_0xacd1('0x2e')](_0x4fb24d[_0xacd1('0x2a')],qs['fields'](_0x43606c[_0xacd1('0x2b')][_0xacd1('0x30')]));_0x1e3e29[_0xacd1('0x2f')]=_0x1e3e29[_0xacd1('0x2f')]['length']?_0x1e3e29[_0xacd1('0x2f')]:_0x4fb24d[_0xacd1('0x2a')];if(_0x43606c['query'][_0xacd1('0x3e')]){_0x1e3e29[_0xacd1('0x42')]=[{'all':!![]}];}_0x1e3e29=_[_0xacd1('0x3a')]({},_0x1e3e29,_0x43606c[_0xacd1('0x3c')]);return db[_0xacd1('0x25')][_0xacd1('0x43')](_0x1e3e29)[_0xacd1('0x1f')](handleEntityNotFound(_0x8decd1,null))[_0xacd1('0x1f')](respondWithResult(_0x8decd1,null))[_0xacd1('0x3f')](handleError(_0x8decd1,null));};exports[_0xacd1('0x44')]=function(_0x2594f9,_0x8e5271){return db[_0xacd1('0x25')][_0xacd1('0x44')](_0x2594f9[_0xacd1('0x45')],{})[_0xacd1('0x1f')](respondWithResult(_0x8e5271,0xc9))[_0xacd1('0x3f')](handleError(_0x8e5271,null));};exports['update']=function(_0x3a2568,_0x14f2bf){if(_0x3a2568[_0xacd1('0x45')]['id']){delete _0x3a2568['body']['id'];}return db[_0xacd1('0x25')][_0xacd1('0x43')]({'where':{'id':_0x3a2568[_0xacd1('0x41')]['id']}})[_0xacd1('0x1f')](handleEntityNotFound(_0x14f2bf,null))['then'](saveUpdates(_0x3a2568[_0xacd1('0x45')],null))[_0xacd1('0x1f')](respondWithResult(_0x14f2bf,null))[_0xacd1('0x3f')](handleError(_0x14f2bf,null));};exports['destroy']=function(_0xbc2c35,_0x4ab0dc){return db[_0xacd1('0x25')][_0xacd1('0x43')]({'where':{'id':_0xbc2c35[_0xacd1('0x41')]['id']}})[_0xacd1('0x1f')](handleEntityNotFound(_0x4ab0dc,null))[_0xacd1('0x1f')](removeEntity(_0x4ab0dc,null))[_0xacd1('0x3f')](handleError(_0x4ab0dc,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3e512ae..5b33a97 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 _0x6261=['api','request-promise','path','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x42e25e,_0x46cfd1){var _0x1ed3a6=function(_0x3558e8){while(--_0x3558e8){_0x42e25e['push'](_0x42e25e['shift']());}};_0x1ed3a6(++_0x46cfd1);}(_0x6261,0x1d3));var _0x1626=function(_0x99818c,_0xd8169e){_0x99818c=_0x99818c-0x0;var _0x3cf4d9=_0x6261[_0x99818c];return _0x3cf4d9;};'use strict';var _=require(_0x1626('0x0'));var util=require(_0x1626('0x1'));var logger=require(_0x1626('0x2'))(_0x1626('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1626('0x4'));var fs=require('fs');var path=require(_0x1626('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1626('0x6'));module['exports']=function(_0x1f0950,_0x132b3f){return _0x1f0950[_0x1626('0x7')](_0x1626('0x8'),attributes,{'tableName':_0x1626('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6930=['analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x292eea,_0x557599){var _0x533816=function(_0x33ec38){while(--_0x33ec38){_0x292eea['push'](_0x292eea['shift']());}};_0x533816(++_0x557599);}(_0x6930,0x114));var _0x0693=function(_0xf03003,_0x422d16){_0xf03003=_0xf03003-0x0;var _0x616b45=_0x6930[_0xf03003];return _0x616b45;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var logger=require('../../config/logger')(_0x0693('0x2'));var moment=require(_0x0693('0x3'));var BPromise=require(_0x0693('0x4'));var rp=require(_0x0693('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0693('0x6'));var attributes=require(_0x0693('0x7'));module[_0x0693('0x8')]=function(_0x34cdca,_0x5eaece){return _0x34cdca[_0x0693('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x0693('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 3b18eb5..b732df0 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4f5650,_0x23448b){_0x4f5650=_0x4f5650-0x0;var _0x40103a=_0x7a54[_0x4f5650];return _0x40103a;};'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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x122c93,_0x194c01){var _0x1ef831=function(_0x54cd46){while(--_0x54cd46){_0x122c93['push'](_0x122c93['shift']());}};_0x1ef831(++_0x194c01);}(_0xdb28,0x106));var _0x8db2=function(_0x222ad9,_0x3ddb8a){_0x222ad9=_0x222ad9-0x0;var _0x9d2428=_0xdb28[_0x222ad9];return _0x9d2428;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 26120c6..f3efe5e 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 _0xc4bd=['./analyticTreeReport.controller','get','isAuthenticated','index','show','post','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc4bd,0x15e));var _0xdc4b=function(_0x1beb06,_0xdf3f2d){_0x1beb06=_0x1beb06-0x0;var _0x4072fe=_0xc4bd[_0x1beb06];return _0x4072fe;};'use strict';var multer=require(_0xdc4b('0x0'));var util=require(_0xdc4b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc4b('0x2'));var router=express['Router']();var fs_extra=require(_0xdc4b('0x3'));var auth=require(_0xdc4b('0x4'));var interaction=require(_0xdc4b('0x5'));var config=require(_0xdc4b('0x6'));var controller=require(_0xdc4b('0x7'));router[_0xdc4b('0x8')]('/',auth[_0xdc4b('0x9')](),controller[_0xdc4b('0xa')]);router['get']('/:id',auth[_0xdc4b('0x9')](),controller[_0xdc4b('0xb')]);router[_0xdc4b('0xc')]('/',auth[_0xdc4b('0x9')](),controller['create']);router['put']('/:id',auth[_0xdc4b('0x9')](),controller[_0xdc4b('0xd')]);router[_0xdc4b('0xe')]('/:id',auth[_0xdc4b('0x9')](),controller[_0xdc4b('0xf')]);module[_0xdc4b('0x10')]=router; \ No newline at end of file +var _0x5e7f=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','post','isAuthenticated','create','update','delete','destroy','multer','util','express','Router','../../components/auth/service'];(function(_0xa1fabd,_0x9dc396){var _0x5c129d=function(_0x49582a){while(--_0x49582a){_0xa1fabd['push'](_0xa1fabd['shift']());}};_0x5c129d(++_0x9dc396);}(_0x5e7f,0xfa));var _0xf5e7=function(_0x49f6eb,_0x26a104){_0x49f6eb=_0x49f6eb-0x0;var _0x361fbb=_0x5e7f[_0x49f6eb];return _0x361fbb;};'use strict';var multer=require(_0xf5e7('0x0'));var util=require(_0xf5e7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf5e7('0x2'));var router=express[_0xf5e7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf5e7('0x4'));var interaction=require(_0xf5e7('0x5'));var config=require(_0xf5e7('0x6'));var controller=require(_0xf5e7('0x7'));router[_0xf5e7('0x8')]('/',auth['isAuthenticated'](),controller[_0xf5e7('0x9')]);router['get'](_0xf5e7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf5e7('0xb')]('/',auth[_0xf5e7('0xc')](),controller[_0xf5e7('0xd')]);router['put'](_0xf5e7('0xa'),auth[_0xf5e7('0xc')](),controller[_0xf5e7('0xe')]);router[_0xf5e7('0xf')](_0xf5e7('0xa'),auth[_0xf5e7('0xc')](),controller[_0xf5e7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5dc9d04..6989fe5 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 _0x4f6f=['STRING','sequelize','exports'];(function(_0x4a8834,_0x4eb544){var _0x5881ec=function(_0x1658c8){while(--_0x1658c8){_0x4a8834['push'](_0x4a8834['shift']());}};_0x5881ec(++_0x4eb544);}(_0x4f6f,0x157));var _0xf4f6=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x4f6f[_0x2797c6];return _0x54809f;};'use strict';var Sequelize=require(_0xf4f6('0x0'));module[_0xf4f6('0x1')]={'name':{'type':Sequelize[_0xf4f6('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf4f6('0x2')]}}; \ No newline at end of file +var _0x7a72=['exports','STRING'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x7a72,0x1be));var _0x27a7=function(_0x15c0e9,_0x5dd7ae){_0x15c0e9=_0x15c0e9-0x0;var _0x33a555=_0x7a72[_0x15c0e9];return _0x33a555;};'use strict';var Sequelize=require('sequelize');module[_0x27a7('0x0')]={'name':{'type':Sequelize[_0x27a7('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x27a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3425877..497eefd 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 _0x5d05=['offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Attachment','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','rows','catch','show','params','rawAttributes','include','find','clone','length','get','omit','createdAt','updatedAt','body','file','originalname','basename','filename','mimetype','create','download','findOne','ChatOfflineMessageId','join','root','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x51ddcb,_0x5e7739){var _0x105f30=function(_0x1a88c5){while(--_0x1a88c5){_0x51ddcb['push'](_0x51ddcb['shift']());}};_0x105f30(++_0x5e7739);}(_0x5d05,0x94));var _0x55d0=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0x5d05[_0x69752e];return _0x506a36;};'use strict';var emlformat=require(_0x55d0('0x0'));var rimraf=require(_0x55d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x55d0('0x2'));var BPromise=require(_0x55d0('0x3'));var Mustache=require(_0x55d0('0x4'));var util=require('util');var path=require(_0x55d0('0x5'));var sox=require(_0x55d0('0x6'));var csv=require('to-csv');var ejs=require(_0x55d0('0x7'));var fs=require('fs');var fs_extra=require(_0x55d0('0x8'));var _=require(_0x55d0('0x9'));var squel=require(_0x55d0('0xa'));var crypto=require(_0x55d0('0xb'));var jsforce=require(_0x55d0('0xc'));var deskjs=require(_0x55d0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x55d0('0xe'));var authService=require(_0x55d0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x55d0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55d0('0x11'))('api');var utils=require(_0x55d0('0x12'));var config=require(_0x55d0('0x13'));var licenseUtil=require(_0x55d0('0x14'));var db=require(_0x55d0('0x15'))['db'];function respondWithStatusCode(_0x357013,_0x352c42){_0x352c42=_0x352c42||0xcc;return function(_0x3a47ba){if(_0x3a47ba){return _0x357013[_0x55d0('0x16')](_0x352c42);}return _0x357013[_0x55d0('0x17')](_0x352c42)[_0x55d0('0x18')]();};}function respondWithResult(_0x106d9e,_0x5212a2){_0x5212a2=_0x5212a2||0xc8;return function(_0x546259){if(_0x546259){return _0x106d9e['status'](_0x5212a2)[_0x55d0('0x19')](_0x546259);}};}function respondWithFilteredResult(_0x25a931,_0x293c14){return function(_0x542481){if(_0x542481){var _0x647b2a=typeof _0x293c14[_0x55d0('0x1a')]===_0x55d0('0x1b')&&typeof _0x293c14[_0x55d0('0x1c')]===_0x55d0('0x1b');var _0x44d29f=_0x542481['count'];var _0x32bed8=_0x647b2a?0x0:_0x293c14[_0x55d0('0x1a')];var _0x5d5589=_0x647b2a?_0x542481['count']:_0x293c14[_0x55d0('0x1a')]+_0x293c14[_0x55d0('0x1c')];var _0x55791e;if(_0x5d5589>=_0x44d29f){_0x5d5589=_0x44d29f;_0x55791e=0xc8;}else{_0x55791e=0xce;}_0x25a931['status'](_0x55791e);return _0x25a931[_0x55d0('0x1d')](_0x55d0('0x1e'),_0x32bed8+'-'+_0x5d5589+'/'+_0x44d29f)[_0x55d0('0x19')](_0x542481);}return null;};}function patchUpdates(_0x1e506a){return function(_0x45d7fb){try{jsonpatch[_0x55d0('0x1f')](_0x45d7fb,_0x1e506a,!![]);}catch(_0x100504){return BPromise[_0x55d0('0x20')](_0x100504);}return _0x45d7fb['save']();};}function saveUpdates(_0x188aee,_0x24270c){return function(_0x53d4ef){if(_0x53d4ef){return _0x53d4ef[_0x55d0('0x21')](_0x188aee)[_0x55d0('0x22')](function(_0x1cec0d){return _0x1cec0d;});}return null;};}function removeEntity(_0x1da15c,_0x5d9591){return function(_0x58fb0b){if(_0x58fb0b){return _0x58fb0b[_0x55d0('0x23')]()['then'](function(){_0x1da15c['status'](0xcc)[_0x55d0('0x18')]();});}};}function handleEntityNotFound(_0x496273,_0x41b1dc){return function(_0x271d77){if(!_0x271d77){_0x496273['sendStatus'](0x194);}return _0x271d77;};}function handleError(_0x1d75a8,_0x3080c4){_0x3080c4=_0x3080c4||0x1f4;return function(_0x3d1dd2){logger[_0x55d0('0x24')](_0x3d1dd2['stack']);if(_0x3d1dd2['name']){delete _0x3d1dd2[_0x55d0('0x25')];}_0x1d75a8[_0x55d0('0x17')](_0x3080c4)[_0x55d0('0x26')](_0x3d1dd2);};}exports[_0x55d0('0x27')]=function(_0x237c28,_0x43cbbb){var _0x5902fa={},_0x7b0492={},_0x1e7dc1={'count':0x0,'rows':[]};var _0x59905c=_[_0x55d0('0x28')](db[_0x55d0('0x29')]['rawAttributes'],function(_0x3ae967){return{'name':_0x3ae967[_0x55d0('0x2a')],'type':_0x3ae967[_0x55d0('0x2b')][_0x55d0('0x2c')]};});_0x7b0492[_0x55d0('0x2d')]=_['map'](_0x59905c,_0x55d0('0x25'));_0x7b0492['query']=_[_0x55d0('0x2e')](_0x237c28[_0x55d0('0x2f')]);_0x7b0492[_0x55d0('0x30')]=_['intersection'](_0x7b0492['model'],_0x7b0492[_0x55d0('0x2f')]);_0x5902fa[_0x55d0('0x31')]=_[_0x55d0('0x32')](_0x7b0492[_0x55d0('0x2d')],qs[_0x55d0('0x33')](_0x237c28[_0x55d0('0x2f')][_0x55d0('0x33')]));_0x5902fa[_0x55d0('0x31')]=_0x5902fa[_0x55d0('0x31')]['length']?_0x5902fa[_0x55d0('0x31')]:_0x7b0492[_0x55d0('0x2d')];if(!_0x237c28['query'][_0x55d0('0x34')](_0x55d0('0x35'))){_0x5902fa[_0x55d0('0x1c')]=qs['limit'](_0x237c28[_0x55d0('0x2f')][_0x55d0('0x1c')]);_0x5902fa[_0x55d0('0x1a')]=qs[_0x55d0('0x1a')](_0x237c28[_0x55d0('0x2f')][_0x55d0('0x1a')]);}_0x5902fa[_0x55d0('0x36')]=qs['sort'](_0x237c28[_0x55d0('0x2f')]['sort']);_0x5902fa[_0x55d0('0x37')]=qs[_0x55d0('0x30')](_[_0x55d0('0x38')](_0x237c28[_0x55d0('0x2f')],_0x7b0492[_0x55d0('0x30')]),_0x59905c);if(_0x237c28['query'][_0x55d0('0x39')]){_0x5902fa['where']=_[_0x55d0('0x3a')](_0x5902fa[_0x55d0('0x37')],{'$or':_[_0x55d0('0x28')](_0x59905c,function(_0x2ab114){if(_0x2ab114[_0x55d0('0x2b')]!==_0x55d0('0x3b')){var _0x5f01f0={};_0x5f01f0[_0x2ab114['name']]={'$like':'%'+_0x237c28[_0x55d0('0x2f')][_0x55d0('0x39')]+'%'};return _0x5f01f0;}})});}_0x5902fa=_[_0x55d0('0x3a')]({},_0x5902fa,_0x237c28[_0x55d0('0x3c')]);var _0x37ef77={'where':_0x5902fa[_0x55d0('0x37')]};return db[_0x55d0('0x29')]['count'](_0x37ef77)[_0x55d0('0x22')](function(_0x30b72f){_0x1e7dc1[_0x55d0('0x3d')]=_0x30b72f;if(_0x237c28[_0x55d0('0x2f')]['includeAll']){_0x5902fa['include']=[{'all':!![]}];}return db[_0x55d0('0x29')]['findAll'](_0x5902fa);})[_0x55d0('0x22')](function(_0x32b288){_0x1e7dc1[_0x55d0('0x3e')]=_0x32b288;return _0x1e7dc1;})[_0x55d0('0x22')](respondWithFilteredResult(_0x43cbbb,_0x5902fa))[_0x55d0('0x3f')](handleError(_0x43cbbb,null));};exports[_0x55d0('0x40')]=function(_0x2697f8,_0xb217ee){var _0xbf8395={'raw':!![],'where':{'id':_0x2697f8[_0x55d0('0x41')]['id']}},_0xd49b45={};_0xd49b45[_0x55d0('0x2d')]=_[_0x55d0('0x2e')](db['Attachment'][_0x55d0('0x42')]);_0xd49b45['query']=_[_0x55d0('0x2e')](_0x2697f8[_0x55d0('0x2f')]);_0xd49b45[_0x55d0('0x30')]=_[_0x55d0('0x32')](_0xd49b45[_0x55d0('0x2d')],_0xd49b45[_0x55d0('0x2f')]);_0xbf8395[_0x55d0('0x31')]=_[_0x55d0('0x32')](_0xd49b45[_0x55d0('0x2d')],qs['fields'](_0x2697f8[_0x55d0('0x2f')][_0x55d0('0x33')]));_0xbf8395['attributes']=_0xbf8395[_0x55d0('0x31')]['length']?_0xbf8395[_0x55d0('0x31')]:_0xd49b45[_0x55d0('0x2d')];if(_0x2697f8['query']['includeAll']){_0xbf8395[_0x55d0('0x43')]=[{'all':!![]}];}_0xbf8395=_[_0x55d0('0x3a')]({},_0xbf8395,_0x2697f8[_0x55d0('0x3c')]);return db['Attachment'][_0x55d0('0x44')](_0xbf8395)['then'](handleEntityNotFound(_0xb217ee,null))[_0x55d0('0x22')](respondWithResult(_0xb217ee,null))[_0x55d0('0x3f')](handleError(_0xb217ee,null));};exports[_0x55d0('0x45')]=function(_0x249cf9,_0x23e257){var _0x1937bc={'where':{'id':_0x249cf9['params']['id']}},_0x471d75={};_0x471d75[_0x55d0('0x2d')]=_[_0x55d0('0x2e')](db['Attachment'][_0x55d0('0x42')]);_0x1937bc['attributes']=_[_0x55d0('0x32')](_0x471d75[_0x55d0('0x2d')],qs[_0x55d0('0x33')](_0x249cf9['query'][_0x55d0('0x33')]));_0x1937bc[_0x55d0('0x31')]=_0x1937bc[_0x55d0('0x31')][_0x55d0('0x46')]?_0x1937bc[_0x55d0('0x31')]:_0x471d75['model'];if(_0x249cf9[_0x55d0('0x2f')]['includeAll']){_0x1937bc[_0x55d0('0x43')]=[{'all':!![]}];}_0x1937bc=_[_0x55d0('0x3a')]({},_0x1937bc,_0x249cf9[_0x55d0('0x3c')]);return db['Attachment'][_0x55d0('0x44')](_0x1937bc)[_0x55d0('0x22')](handleEntityNotFound(_0x23e257,null))[_0x55d0('0x22')](function(_0x46ecd2){if(_0x46ecd2){var _0x2130b1=_0x46ecd2[_0x55d0('0x47')]({'plain':!![]});_0x2130b1=qs[_0x55d0('0x48')](_0x2130b1,['id',_0x55d0('0x49'),_0x55d0('0x4a')]);_0x249cf9['body']=_[_0x55d0('0x48')](_0x249cf9[_0x55d0('0x4b')],['id',_0x55d0('0x49'),'updatedAt']);return db[_0x55d0('0x29')]['create'](_['merge'](_0x2130b1,_0x249cf9['body']),{'include':_0x249cf9['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x55d0('0x22')](respondWithResult(_0x23e257,0xc9))['catch'](handleError(_0x23e257,null));};exports['update']=function(_0xeb2ab8,_0x5baacc){if(_0xeb2ab8[_0x55d0('0x4b')]['id']){delete _0xeb2ab8[_0x55d0('0x4b')]['id'];}return db['Attachment']['find']({'where':{'id':_0xeb2ab8[_0x55d0('0x41')]['id']}})[_0x55d0('0x22')](handleEntityNotFound(_0x5baacc,null))[_0x55d0('0x22')](saveUpdates(_0xeb2ab8[_0x55d0('0x4b')],null))[_0x55d0('0x22')](respondWithResult(_0x5baacc,null))[_0x55d0('0x3f')](handleError(_0x5baacc,null));};exports['destroy']=function(_0x1ab526,_0x71fd38){return db[_0x55d0('0x29')]['find']({'where':{'id':_0x1ab526[_0x55d0('0x41')]['id']}})[_0x55d0('0x22')](handleEntityNotFound(_0x71fd38,null))[_0x55d0('0x22')](removeEntity(_0x71fd38,null))[_0x55d0('0x3f')](handleError(_0x71fd38,null));};exports['create']=function(_0x49ce84,_0x55a1a2,_0x587589){_0x49ce84['body'][_0x55d0('0x25')]=_0x49ce84[_0x55d0('0x4c')][_0x55d0('0x4d')];_0x49ce84[_0x55d0('0x4b')][_0x55d0('0x4e')]=_0x49ce84[_0x55d0('0x4c')][_0x55d0('0x4f')];_0x49ce84['body'][_0x55d0('0x2b')]=_0x49ce84[_0x55d0('0x4c')][_0x55d0('0x50')];return db['Attachment'][_0x55d0('0x51')](_0x49ce84['body'])[_0x55d0('0x22')](respondWithResult(_0x55a1a2,0xc9))[_0x55d0('0x3f')](handleError(_0x55a1a2,null));};exports[_0x55d0('0x52')]=function(_0x41c788,_0x507d88,_0x508501){return db[_0x55d0('0x29')][_0x55d0('0x53')]({'where':{'id':_0x41c788[_0x55d0('0x41')]['id']},'raw':!![]})[_0x55d0('0x22')](handleEntityNotFound(_0x507d88,null))[_0x55d0('0x22')](function(_0x1cd4c1){if(_0x1cd4c1){var _0x2a8837=_0x1cd4c1[_0x55d0('0x54')]!==null;var _0xc2ccdb=path[_0x55d0('0x55')](config[_0x55d0('0x56')],'server/files/attachments/');if(_0x2a8837){_0xc2ccdb=path[_0x55d0('0x55')](_0xc2ccdb,'offline-chat/');}var _0x32bcb5=path[_0x55d0('0x55')](_0xc2ccdb,_0x1cd4c1[_0x55d0('0x4e')]);return _0x507d88[_0x55d0('0x52')](_0x32bcb5);}})[_0x55d0('0x3f')](handleError(_0x507d88,null));}; \ No newline at end of file +var _0x721a=['../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','Attachment','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','findAll','rows','catch','params','include','find','get','omit','createdAt','updatedAt','body','create','file','originalname','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x64bec,_0x37225c){var _0x46b9c6=function(_0x4cd9af){while(--_0x4cd9af){_0x64bec['push'](_0x64bec['shift']());}};_0x46b9c6(++_0x37225c);}(_0x721a,0xf4));var _0xa721=function(_0x570a4e,_0x46c81a){_0x570a4e=_0x570a4e-0x0;var _0x74c587=_0x721a[_0x570a4e];return _0x74c587;};'use strict';var emlformat=require(_0xa721('0x0'));var rimraf=require(_0xa721('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa721('0x2'));var rp=require('request-promise');var moment=require(_0xa721('0x3'));var BPromise=require(_0xa721('0x4'));var Mustache=require(_0xa721('0x5'));var util=require(_0xa721('0x6'));var path=require('path');var sox=require(_0xa721('0x7'));var csv=require('to-csv');var ejs=require(_0xa721('0x8'));var fs=require('fs');var fs_extra=require(_0xa721('0x9'));var _=require('lodash');var squel=require(_0xa721('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa721('0xb'));var toCsv=require(_0xa721('0xc'));var querystring=require(_0xa721('0xd'));var Papa=require(_0xa721('0xe'));var Redis=require(_0xa721('0xf'));var authService=require(_0xa721('0x10'));var qs=require(_0xa721('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa721('0x12'))(_0xa721('0x13'));var utils=require(_0xa721('0x14'));var config=require(_0xa721('0x15'));var licenseUtil=require(_0xa721('0x16'));var db=require(_0xa721('0x17'))['db'];function respondWithStatusCode(_0xbfe402,_0x61c63b){_0x61c63b=_0x61c63b||0xcc;return function(_0xd06d0a){if(_0xd06d0a){return _0xbfe402['sendStatus'](_0x61c63b);}return _0xbfe402['status'](_0x61c63b)[_0xa721('0x18')]();};}function respondWithResult(_0x12c23e,_0x15bf1e){_0x15bf1e=_0x15bf1e||0xc8;return function(_0x96b3a){if(_0x96b3a){return _0x12c23e[_0xa721('0x19')](_0x15bf1e)[_0xa721('0x1a')](_0x96b3a);}};}function respondWithFilteredResult(_0x3ef72f,_0x599e14){return function(_0x2ad190){if(_0x2ad190){var _0x5dc4c2=typeof _0x599e14['offset']===_0xa721('0x1b')&&typeof _0x599e14[_0xa721('0x1c')]===_0xa721('0x1b');var _0x44c956=_0x2ad190[_0xa721('0x1d')];var _0x5a333e=_0x5dc4c2?0x0:_0x599e14[_0xa721('0x1e')];var _0x4b100a=_0x5dc4c2?_0x2ad190[_0xa721('0x1d')]:_0x599e14['offset']+_0x599e14[_0xa721('0x1c')];var _0x1f1ee9;if(_0x4b100a>=_0x44c956){_0x4b100a=_0x44c956;_0x1f1ee9=0xc8;}else{_0x1f1ee9=0xce;}_0x3ef72f[_0xa721('0x19')](_0x1f1ee9);return _0x3ef72f[_0xa721('0x1f')](_0xa721('0x20'),_0x5a333e+'-'+_0x4b100a+'/'+_0x44c956)[_0xa721('0x1a')](_0x2ad190);}return null;};}function patchUpdates(_0x33f42a){return function(_0x270133){try{jsonpatch[_0xa721('0x21')](_0x270133,_0x33f42a,!![]);}catch(_0x454479){return BPromise[_0xa721('0x22')](_0x454479);}return _0x270133[_0xa721('0x23')]();};}function saveUpdates(_0x56614a,_0x31bd28){return function(_0x437a46){if(_0x437a46){return _0x437a46[_0xa721('0x24')](_0x56614a)[_0xa721('0x25')](function(_0x35f8a4){return _0x35f8a4;});}return null;};}function removeEntity(_0x14a490,_0x26434f){return function(_0xc0bc79){if(_0xc0bc79){return _0xc0bc79[_0xa721('0x26')]()['then'](function(){_0x14a490[_0xa721('0x19')](0xcc)[_0xa721('0x18')]();});}};}function handleEntityNotFound(_0x36c2e9,_0x4e1deb){return function(_0x178477){if(!_0x178477){_0x36c2e9[_0xa721('0x27')](0x194);}return _0x178477;};}function handleError(_0xf8e1bb,_0x4f66ca){_0x4f66ca=_0x4f66ca||0x1f4;return function(_0xe6afb4){logger['error'](_0xe6afb4[_0xa721('0x28')]);if(_0xe6afb4[_0xa721('0x29')]){delete _0xe6afb4['name'];}_0xf8e1bb['status'](_0x4f66ca)[_0xa721('0x2a')](_0xe6afb4);};}exports['index']=function(_0x3e5093,_0xdd2ae3){var _0x5885f5={},_0x584bed={},_0x4d2764={'count':0x0,'rows':[]};var _0x2f9e2b=_['map'](db[_0xa721('0x2b')][_0xa721('0x2c')],function(_0x46b69d){return{'name':_0x46b69d[_0xa721('0x2d')],'type':_0x46b69d[_0xa721('0x2e')][_0xa721('0x2f')]};});_0x584bed['model']=_[_0xa721('0x30')](_0x2f9e2b,_0xa721('0x29'));_0x584bed['query']=_[_0xa721('0x31')](_0x3e5093[_0xa721('0x32')]);_0x584bed['filters']=_[_0xa721('0x33')](_0x584bed[_0xa721('0x34')],_0x584bed[_0xa721('0x32')]);_0x5885f5[_0xa721('0x35')]=_[_0xa721('0x33')](_0x584bed['model'],qs[_0xa721('0x36')](_0x3e5093[_0xa721('0x32')][_0xa721('0x36')]));_0x5885f5[_0xa721('0x35')]=_0x5885f5['attributes'][_0xa721('0x37')]?_0x5885f5['attributes']:_0x584bed[_0xa721('0x34')];if(!_0x3e5093[_0xa721('0x32')][_0xa721('0x38')](_0xa721('0x39'))){_0x5885f5[_0xa721('0x1c')]=qs['limit'](_0x3e5093['query']['limit']);_0x5885f5[_0xa721('0x1e')]=qs[_0xa721('0x1e')](_0x3e5093[_0xa721('0x32')][_0xa721('0x1e')]);}_0x5885f5[_0xa721('0x3a')]=qs[_0xa721('0x3b')](_0x3e5093[_0xa721('0x32')][_0xa721('0x3b')]);_0x5885f5[_0xa721('0x3c')]=qs[_0xa721('0x3d')](_[_0xa721('0x3e')](_0x3e5093['query'],_0x584bed[_0xa721('0x3d')]),_0x2f9e2b);if(_0x3e5093['query']['filter']){_0x5885f5[_0xa721('0x3c')]=_['merge'](_0x5885f5[_0xa721('0x3c')],{'$or':_[_0xa721('0x30')](_0x2f9e2b,function(_0x31955f){if(_0x31955f[_0xa721('0x2e')]!=='VIRTUAL'){var _0x4dad44={};_0x4dad44[_0x31955f[_0xa721('0x29')]]={'$like':'%'+_0x3e5093[_0xa721('0x32')][_0xa721('0x3f')]+'%'};return _0x4dad44;}})});}_0x5885f5=_['merge']({},_0x5885f5,_0x3e5093[_0xa721('0x40')]);var _0x3e24ba={'where':_0x5885f5[_0xa721('0x3c')]};return db[_0xa721('0x2b')]['count'](_0x3e24ba)[_0xa721('0x25')](function(_0x50bc3e){_0x4d2764[_0xa721('0x1d')]=_0x50bc3e;if(_0x3e5093[_0xa721('0x32')][_0xa721('0x41')]){_0x5885f5['include']=[{'all':!![]}];}return db[_0xa721('0x2b')][_0xa721('0x42')](_0x5885f5);})[_0xa721('0x25')](function(_0x1bdf75){_0x4d2764[_0xa721('0x43')]=_0x1bdf75;return _0x4d2764;})[_0xa721('0x25')](respondWithFilteredResult(_0xdd2ae3,_0x5885f5))[_0xa721('0x44')](handleError(_0xdd2ae3,null));};exports['show']=function(_0x2fbf0b,_0x534a4f){var _0x51b5f1={'raw':!![],'where':{'id':_0x2fbf0b[_0xa721('0x45')]['id']}},_0x469bc9={};_0x469bc9[_0xa721('0x34')]=_[_0xa721('0x31')](db[_0xa721('0x2b')][_0xa721('0x2c')]);_0x469bc9[_0xa721('0x32')]=_[_0xa721('0x31')](_0x2fbf0b['query']);_0x469bc9[_0xa721('0x3d')]=_['intersection'](_0x469bc9['model'],_0x469bc9[_0xa721('0x32')]);_0x51b5f1[_0xa721('0x35')]=_[_0xa721('0x33')](_0x469bc9[_0xa721('0x34')],qs['fields'](_0x2fbf0b[_0xa721('0x32')][_0xa721('0x36')]));_0x51b5f1['attributes']=_0x51b5f1[_0xa721('0x35')]['length']?_0x51b5f1[_0xa721('0x35')]:_0x469bc9[_0xa721('0x34')];if(_0x2fbf0b[_0xa721('0x32')][_0xa721('0x41')]){_0x51b5f1[_0xa721('0x46')]=[{'all':!![]}];}_0x51b5f1=_['merge']({},_0x51b5f1,_0x2fbf0b[_0xa721('0x40')]);return db[_0xa721('0x2b')][_0xa721('0x47')](_0x51b5f1)['then'](handleEntityNotFound(_0x534a4f,null))['then'](respondWithResult(_0x534a4f,null))[_0xa721('0x44')](handleError(_0x534a4f,null));};exports['clone']=function(_0x3852d9,_0x3671f1){var _0x11e9ad={'where':{'id':_0x3852d9[_0xa721('0x45')]['id']}},_0xb37599={};_0xb37599[_0xa721('0x34')]=_[_0xa721('0x31')](db[_0xa721('0x2b')][_0xa721('0x2c')]);_0x11e9ad['attributes']=_['intersection'](_0xb37599[_0xa721('0x34')],qs[_0xa721('0x36')](_0x3852d9[_0xa721('0x32')]['fields']));_0x11e9ad['attributes']=_0x11e9ad[_0xa721('0x35')][_0xa721('0x37')]?_0x11e9ad['attributes']:_0xb37599[_0xa721('0x34')];if(_0x3852d9[_0xa721('0x32')][_0xa721('0x41')]){_0x11e9ad[_0xa721('0x46')]=[{'all':!![]}];}_0x11e9ad=_['merge']({},_0x11e9ad,_0x3852d9[_0xa721('0x40')]);return db['Attachment']['find'](_0x11e9ad)[_0xa721('0x25')](handleEntityNotFound(_0x3671f1,null))['then'](function(_0x22585d){if(_0x22585d){var _0x34ce3f=_0x22585d[_0xa721('0x48')]({'plain':!![]});_0x34ce3f=qs[_0xa721('0x49')](_0x34ce3f,['id',_0xa721('0x4a'),_0xa721('0x4b')]);_0x3852d9[_0xa721('0x4c')]=_[_0xa721('0x49')](_0x3852d9[_0xa721('0x4c')],['id',_0xa721('0x4a'),_0xa721('0x4b')]);return db[_0xa721('0x2b')]['create'](_['merge'](_0x34ce3f,_0x3852d9['body']),{'include':_0x3852d9[_0xa721('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xa721('0x25')](respondWithResult(_0x3671f1,0xc9))[_0xa721('0x44')](handleError(_0x3671f1,null));};exports[_0xa721('0x24')]=function(_0x955e97,_0x26f288){if(_0x955e97['body']['id']){delete _0x955e97[_0xa721('0x4c')]['id'];}return db[_0xa721('0x2b')]['find']({'where':{'id':_0x955e97[_0xa721('0x45')]['id']}})['then'](handleEntityNotFound(_0x26f288,null))[_0xa721('0x25')](saveUpdates(_0x955e97[_0xa721('0x4c')],null))[_0xa721('0x25')](respondWithResult(_0x26f288,null))[_0xa721('0x44')](handleError(_0x26f288,null));};exports['destroy']=function(_0x55963a,_0x38270f){return db[_0xa721('0x2b')][_0xa721('0x47')]({'where':{'id':_0x55963a['params']['id']}})[_0xa721('0x25')](handleEntityNotFound(_0x38270f,null))[_0xa721('0x25')](removeEntity(_0x38270f,null))[_0xa721('0x44')](handleError(_0x38270f,null));};exports[_0xa721('0x4d')]=function(_0x87d11f,_0x200819,_0x5deae7){_0x87d11f[_0xa721('0x4c')][_0xa721('0x29')]=_0x87d11f[_0xa721('0x4e')][_0xa721('0x4f')];_0x87d11f['body']['basename']=_0x87d11f[_0xa721('0x4e')][_0xa721('0x50')];_0x87d11f[_0xa721('0x4c')][_0xa721('0x2e')]=_0x87d11f[_0xa721('0x4e')][_0xa721('0x51')];return db['Attachment']['create'](_0x87d11f[_0xa721('0x4c')])[_0xa721('0x25')](respondWithResult(_0x200819,0xc9))[_0xa721('0x44')](handleError(_0x200819,null));};exports[_0xa721('0x52')]=function(_0x3818e7,_0x4a9939,_0x5807d1){return db[_0xa721('0x2b')]['findOne']({'where':{'id':_0x3818e7[_0xa721('0x45')]['id']},'raw':!![]})[_0xa721('0x25')](handleEntityNotFound(_0x4a9939,null))[_0xa721('0x25')](function(_0xc5f7e4){if(_0xc5f7e4){var _0x4291e1=_0xc5f7e4[_0xa721('0x53')]!==null;var _0x3716c4=path[_0xa721('0x54')](config[_0xa721('0x55')],_0xa721('0x56'));if(_0x4291e1){_0x3716c4=path[_0xa721('0x54')](_0x3716c4,_0xa721('0x57'));}var _0x20c0fb=path[_0xa721('0x54')](_0x3716c4,_0xc5f7e4[_0xa721('0x58')]);return _0x4a9939['download'](_0x20c0fb);}})['catch'](handleError(_0x4a9939,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 2848580..d655751 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 _0x6c1f=['rimraf','../../config/environment','exports','Attachment','attachments','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1e7a9e,_0x4605fb){var _0x2c3c83=function(_0x3858b6){while(--_0x3858b6){_0x1e7a9e['push'](_0x1e7a9e['shift']());}};_0x2c3c83(++_0x4605fb);}(_0x6c1f,0x19c));var _0xf6c1=function(_0x1477cf,_0xa2f31d){_0x1477cf=_0x1477cf-0x0;var _0xe3e3ac=_0x6c1f[_0x1477cf];return _0xe3e3ac;};'use strict';var _=require(_0xf6c1('0x0'));var util=require(_0xf6c1('0x1'));var logger=require(_0xf6c1('0x2'))('api');var moment=require(_0xf6c1('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6c1('0x4'));var fs=require('fs');var path=require(_0xf6c1('0x5'));var rimraf=require(_0xf6c1('0x6'));var config=require(_0xf6c1('0x7'));var attributes=require('./attachment.attributes');module[_0xf6c1('0x8')]=function(_0x47006a,_0x3776e4){return _0x47006a['define'](_0xf6c1('0x9'),attributes,{'tableName':_0xf6c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x448a=['Attachment','attachments','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x423797,_0x3d393b){var _0x57ec0c=function(_0x24c145){while(--_0x24c145){_0x423797['push'](_0x423797['shift']());}};_0x57ec0c(++_0x3d393b);}(_0x448a,0x98));var _0xa448=function(_0x5d93bf,_0x157933){_0x5d93bf=_0x5d93bf-0x0;var _0x2239ce=_0x448a[_0x5d93bf];return _0x2239ce;};'use strict';var _=require(_0xa448('0x0'));var util=require('util');var logger=require(_0xa448('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa448('0x2'));var rp=require(_0xa448('0x3'));var fs=require('fs');var path=require(_0xa448('0x4'));var rimraf=require('rimraf');var config=require(_0xa448('0x5'));var attributes=require('./attachment.attributes');module[_0xa448('0x6')]=function(_0x131a2b,_0x32cd12){return _0x131a2b[_0xa448('0x7')](_0xa448('0x8'),attributes,{'tableName':_0xa448('0x9'),'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 367b08e..3f1aea9 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 _0x1339=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','options','raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x11b90e,_0x14006b){var _0xb537a3=function(_0x1b64aa){while(--_0x1b64aa){_0x11b90e['push'](_0x11b90e['shift']());}};_0xb537a3(++_0x14006b);}(_0x1339,0x1ed));var _0x9133=function(_0x47268d,_0x360244){_0x47268d=_0x47268d-0x0;var _0x30b718=_0x1339[_0x47268d];return _0x30b718;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('Attachment,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}exports['CreateAttachment']=function(_0x1f3484){var _0x573998=this;return new Promise(function(_0x3c48ef,_0x5d4a77){return db[_0x9133('0x17')][_0x9133('0x18')](_0x1f3484['body'],{'raw':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options'][_0x9133('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5e4f0c){logger[_0x9133('0xd')]('CreateAttachment',_0x1f3484);logger[_0x9133('0x1b')]('CreateAttachment',_0x1f3484,JSON['stringify'](_0x5e4f0c));_0x3c48ef(_0x5e4f0c);})['catch'](function(_0x2e99a1){logger[_0x9133('0x12')]('CreateAttachment',_0x2e99a1[_0x9133('0x14')],_0x1f3484);_0x5d4a77(_0x573998[_0x9133('0x12')](0x1f4,_0x2e99a1[_0x9133('0x14')]));});});}; \ No newline at end of file +var _0x028d=['body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','create'];(function(_0x4f9fdc,_0x5d1320){var _0x3a35db=function(_0x23522f){while(--_0x23522f){_0x4f9fdc['push'](_0x4f9fdc['shift']());}};_0x3a35db(++_0x5d1320);}(_0x028d,0xff));var _0xd028=function(_0x4b6a4b,_0x271355){_0x4b6a4b=_0x4b6a4b-0x0;var _0xe002d1=_0x028d[_0x4b6a4b];return _0xe002d1;};'use strict';var _=require('lodash');var util=require(_0xd028('0x0'));var moment=require(_0xd028('0x1'));var BPromise=require('bluebird');var rs=require(_0xd028('0x2'));var fs=require('fs');var Redis=require(_0xd028('0x3'));var db=require(_0xd028('0x4'))['db'];var utils=require(_0xd028('0x5'));var logger=require(_0xd028('0x6'))(_0xd028('0x7'));var config=require('../../config/environment');var jayson=require(_0xd028('0x8'));var client=jayson[_0xd028('0x9')][_0xd028('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35b879,_0x110b50,_0xb35f34){return new BPromise(function(_0xab6e68,_0x487e07){return client[_0xd028('0xb')](_0x35b879,_0xb35f34)[_0xd028('0xc')](function(_0xb9d983){logger[_0xd028('0xd')](_0xd028('0xe'),_0x110b50,_0xd028('0xf'));logger['debug'](_0xd028('0x10'),_0x110b50,_0xd028('0xf'),JSON[_0xd028('0x11')](_0xb9d983));if(_0xb9d983[_0xd028('0x12')]){if(_0xb9d983[_0xd028('0x12')][_0xd028('0x13')]===0x1f4){logger['error'](_0xd028('0xe'),_0x110b50,_0xb9d983[_0xd028('0x12')]['message']);return _0x487e07(_0xb9d983[_0xd028('0x12')][_0xd028('0x14')]);}logger[_0xd028('0x12')](_0xd028('0xe'),_0x110b50,_0xb9d983[_0xd028('0x12')][_0xd028('0x14')]);return _0xab6e68(_0xb9d983[_0xd028('0x12')][_0xd028('0x14')]);}else{logger[_0xd028('0xd')](_0xd028('0xe'),_0x110b50,_0xd028('0xf'));_0xab6e68(_0xb9d983[_0xd028('0x15')]['message']);}})[_0xd028('0x16')](function(_0x5a6670){logger[_0xd028('0x12')](_0xd028('0xe'),_0x110b50,_0x5a6670);_0x487e07(_0x5a6670);});});}exports[_0xd028('0x17')]=function(_0x4df54f){var _0x3e846e=this;return new Promise(function(_0x5a47a6,_0x285bf8){return db['Attachment'][_0xd028('0x18')](_0x4df54f[_0xd028('0x19')],{'raw':_0x4df54f[_0xd028('0x1a')]?_0x4df54f['options'][_0xd028('0x1b')]===undefined?!![]:![]:!![]})[_0xd028('0xc')](function(_0x1a2767){logger[_0xd028('0xd')](_0xd028('0x17'),_0x4df54f);logger['debug'](_0xd028('0x17'),_0x4df54f,JSON[_0xd028('0x11')](_0x1a2767));_0x5a47a6(_0x1a2767);})[_0xd028('0x16')](function(_0x75657f){logger[_0xd028('0x12')](_0xd028('0x17'),_0x75657f[_0xd028('0x14')],_0x4df54f);_0x285bf8(_0x3e846e['error'](0x1f4,_0x75657f[_0xd028('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0b7b3f4..dedc280 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(_0x36c95b,_0x104110){var _0x58859d=function(_0x41f945){while(--_0x41f945){_0x36c95b['push'](_0x36c95b['shift']());}};_0x58859d(++_0x104110);}(_0xadb5,0xad));var _0x5adb=function(_0x470299,_0x5cc467){_0x470299=_0x470299-0x0;var _0x1452e6=_0xadb5[_0x470299];return _0x1452e6;};'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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x5c83f7,_0x16bb18){_0x5c83f7=_0x5c83f7-0x0;var _0x314c53=_0xdb28[_0x5c83f7];return _0x314c53;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 7d681b4..6e35eff 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 _0xf60a=['admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','minutes','then','getLicense','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','email','callback','authenticate','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','find','map','emails','value'];(function(_0xd8768d,_0xfb9413){var _0x244b15=function(_0x52972b){while(--_0x52972b){_0xd8768d['push'](_0xd8768d['shift']());}};_0x244b15(++_0xfb9413);}(_0xf60a,0x10d));var _0xaf60=function(_0x559b69,_0x5b98bd){_0x559b69=_0x559b69-0x0;var _0x2ff0eb=_0xf60a[_0x559b69];return _0x2ff0eb;};'use strict';var _=require(_0xaf60('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xaf60('0x1'))[_0xaf60('0x2')];var moment=require(_0xaf60('0x3'));var db=require(_0xaf60('0x4'))['db'];var config=require(_0xaf60('0x5'));var signToken=require(_0xaf60('0x6'))[_0xaf60('0x7')];var utils=require(_0xaf60('0x8'));exports[_0xaf60('0x9')]=passport['authenticate'](_0xaf60('0xa'),{'failureRedirect':_0xaf60('0xb'),'scope':[_0xaf60('0xc'),_0xaf60('0xd')],'session':![]});exports[_0xaf60('0xe')]=passport[_0xaf60('0xf')](_0xaf60('0xa'),{'failureRedirect':_0xaf60('0xb'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0xaf60('0xa')]?config['google'][_0xaf60('0x10')]:'id','clientSecret':config['google']?config['google'][_0xaf60('0x11')]:_0xaf60('0x12'),'callbackURL':config[_0xaf60('0xa')]?config['google'][_0xaf60('0x13')]:''},function(_0x478af6,_0x480cd1,_0x2121d3,_0x3c3079){var _0x295967,_0x3ffdc8;return db[_0xaf60('0x14')][_0xaf60('0x15')]({'where':{'id':0x1},'attributes':[_0xaf60('0x16'),'blockDuration'],'raw':!![]})['then'](function(_0xb4368b){_0x295967=_0xb4368b;return db['User'][_0xaf60('0x17')]({'where':{'email':_[_0xaf60('0x18')](_0x2121d3[_0xaf60('0x19')],_0xaf60('0x1a')),'role':{'$or':[_0xaf60('0x1b'),_0xaf60('0x1c'),_0xaf60('0x1d')]}}});})['then'](function(_0xc4dcd8){_0x3ffdc8=_0xc4dcd8;if(_0x3ffdc8){if(_0x3ffdc8['disabled']){return _0x3c3079(_0xaf60('0x1e'));}else if(_0x295967[_0xaf60('0x1f')]>0x0){if(_0x3ffdc8['blocked']){if(moment(_0x3ffdc8[_0xaf60('0x20')])[_0xaf60('0x21')](_0x295967[_0xaf60('0x1f')],_0xaf60('0x22'))>moment()){return _0x3c3079(_0xaf60('0x1e'));}else{return utils['clearBlockUser'](_0x3ffdc8,0x0,![],null)[_0xaf60('0x23')](function(){return utils[_0xaf60('0x24')](_0x3ffdc8);})[_0xaf60('0x23')](function(){return _0x3c3079(null,_0x3ffdc8);});}}else{return utils[_0xaf60('0x24')](_0x3ffdc8)[_0xaf60('0x23')](function(){return _0x3c3079(null,_0x3ffdc8);});}}else{return utils[_0xaf60('0x24')](_0x3ffdc8)[_0xaf60('0x23')](function(){return _0x3c3079(null,_0x3ffdc8);});}}return _0x3c3079(_0xaf60('0x1e'));})['catch'](function(_0x4aa490){_0x3c3079(_0x4aa490);});})); \ No newline at end of file +var _0x1689=['/login','profile','google','use','clientSecret','secret','callbackURL','Setting','blockDuration','then','User','find','map','emails','admin','disabled','blockedAt','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1689,0x1d5));var _0x9168=function(_0x40d2a3,_0x57faf6){_0x40d2a3=_0x40d2a3-0x0;var _0x2a0360=_0x1689[_0x40d2a3];return _0x2a0360;};'use strict';var _=require(_0x9168('0x0'));var passport=require(_0x9168('0x1'));var GoogleStrategy=require(_0x9168('0x2'))[_0x9168('0x3')];var moment=require(_0x9168('0x4'));var db=require(_0x9168('0x5'))['db'];var config=require(_0x9168('0x6'));var signToken=require(_0x9168('0x7'))[_0x9168('0x8')];var utils=require('../../config/utils');exports[_0x9168('0x9')]=passport[_0x9168('0xa')]('google',{'failureRedirect':_0x9168('0xb'),'scope':[_0x9168('0xc'),'email'],'session':![]});exports['callback']=passport[_0x9168('0xa')](_0x9168('0xd'),{'failureRedirect':_0x9168('0xb'),'session':![]});passport[_0x9168('0xe')](new GoogleStrategy({'clientID':config[_0x9168('0xd')]?config[_0x9168('0xd')]['clientID']:'id','clientSecret':config[_0x9168('0xd')]?config['google'][_0x9168('0xf')]:_0x9168('0x10'),'callbackURL':config['google']?config['google'][_0x9168('0x11')]:''},function(_0x421c38,_0x638430,_0x526fab,_0x443554){var _0x13e5fa,_0x2bc116;return db[_0x9168('0x12')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9168('0x13')],'raw':!![]})[_0x9168('0x14')](function(_0x227929){_0x13e5fa=_0x227929;return db[_0x9168('0x15')][_0x9168('0x16')]({'where':{'email':_[_0x9168('0x17')](_0x526fab[_0x9168('0x18')],'value'),'role':{'$or':[_0x9168('0x19'),'user','agent']}}});})[_0x9168('0x14')](function(_0x23ad34){_0x2bc116=_0x23ad34;if(_0x2bc116){if(_0x2bc116[_0x9168('0x1a')]){return _0x443554('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x13e5fa[_0x9168('0x13')]>0x0){if(_0x2bc116['blocked']){if(moment(_0x2bc116[_0x9168('0x1b')])['add'](_0x13e5fa[_0x9168('0x13')],'minutes')>moment()){return _0x443554('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x2bc116,0x0,![],null)[_0x9168('0x14')](function(){return utils[_0x9168('0x1c')](_0x2bc116);})[_0x9168('0x14')](function(){return _0x443554(null,_0x2bc116);});}}else{return utils[_0x9168('0x1c')](_0x2bc116)[_0x9168('0x14')](function(){return _0x443554(null,_0x2bc116);});}}else{return utils['getLicense'](_0x2bc116)[_0x9168('0x14')](function(){return _0x443554(null,_0x2bc116);});}}return _0x443554(_0x9168('0x1d'));})['catch'](function(_0x41c712){_0x443554(_0x41c712);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0a32ecc..072f379 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 _0x4ace=['exports','express','passport','./authGoogle.controller','../user/user.controller.js','get','login','/callback','setTokenCookie'];(function(_0x42968b,_0x3f235c){var _0x3f94ba=function(_0x1c5c68){while(--_0x1c5c68){_0x42968b['push'](_0x42968b['shift']());}};_0x3f94ba(++_0x3f235c);}(_0x4ace,0x14e));var _0xe4ac=function(_0x3aa471,_0x323bad){_0x3aa471=_0x3aa471-0x0;var _0x27da79=_0x4ace[_0x3aa471];return _0x27da79;};'use strict';var express=require(_0xe4ac('0x0'));var passport=require(_0xe4ac('0x1'));var router=express['Router']();var controller=require(_0xe4ac('0x2'));var userController=require(_0xe4ac('0x3'));var authService=require('../../components/auth/service');router[_0xe4ac('0x4')]('/',controller[_0xe4ac('0x5')]);router['get'](_0xe4ac('0x6'),controller['callback'],authService['isMiddleware'],userController[_0xe4ac('0x5')],authService[_0xe4ac('0x7')]);module[_0xe4ac('0x8')]=router; \ No newline at end of file +var _0x0d6a=['callback','isMiddleware','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x3efe9b,_0x5b41a8){var _0x132073=function(_0x34459e){while(--_0x34459e){_0x3efe9b['push'](_0x3efe9b['shift']());}};_0x132073(++_0x5b41a8);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x0d6a[_0x243b59];return _0x3e1676;};'use strict';var express=require(_0xa0d6('0x0'));var passport=require(_0xa0d6('0x1'));var router=express['Router']();var controller=require(_0xa0d6('0x2'));var userController=require(_0xa0d6('0x3'));var authService=require(_0xa0d6('0x4'));router[_0xa0d6('0x5')]('/',controller[_0xa0d6('0x6')]);router[_0xa0d6('0x5')](_0xa0d6('0x7'),controller[_0xa0d6('0x8')],authService[_0xa0d6('0x9')],userController[_0xa0d6('0x6')],authService['setTokenCookie']);module[_0xa0d6('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index af83c69..fa3be63 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 _0x4731=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','status','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0xd70344,_0x304eac){var _0x338d4b=function(_0x4d42a8){while(--_0x4d42a8){_0xd70344['push'](_0xd70344['shift']());}};_0x338d4b(++_0x304eac);}(_0x4731,0xce));var _0x1473=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x4731[_0x9cd4c3];return _0x4c9025;};'use strict';var util=require(_0x1473('0x0'));var passport=require(_0x1473('0x1'));var LocalStrategy=require(_0x1473('0x2'))[_0x1473('0x3')];var jayson=require(_0x1473('0x4'));var _=require('lodash');var rs=require(_0x1473('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x1473('0x6'));var utils=require(_0x1473('0x7'));var client=jayson[_0x1473('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x169ee1,_0x2c210a,_0x2b5f36,_0x6f4474){var _0x332abb,_0x4c3e0c;return db[_0x1473('0x9')][_0x1473('0xa')]({'where':{'id':0x1},'attributes':[_0x1473('0xb'),_0x1473('0xc')],'raw':!![]})['then'](function(_0x6c082b){_0x332abb=_0x6c082b;return _0x169ee1[_0x1473('0xa')]({'attributes':['id',_0x1473('0xd'),_0x1473('0xe'),_0x1473('0xf'),_0x1473('0x10'),_0x1473('0x11'),_0x1473('0x12'),'blockedAt',_0x1473('0x13')],'where':{'name':_0x2c210a,'role':{'$or':[_0x1473('0x14'),_0x1473('0x15'),_0x1473('0x16')]}}});})[_0x1473('0x17')](function(_0x59d7f9){if(!_0x59d7f9||_0x59d7f9&&_0x59d7f9[_0x1473('0xd')]!==_0x2c210a){throw new Error(_0x1473('0x18'));}else{_0x4c3e0c=_0x59d7f9;return _0x4c3e0c;}})[_0x1473('0x17')](function(){_0x4c3e0c[_0x1473('0x19')](_0x2b5f36,function(_0x2208ca,_0x55db75){var _0x137b59=_0x4c3e0c['loginAttempts']+0x1;if(_0x2208ca){return _0x6f4474(_0x2208ca);}else if(!_0x55db75){if(_0x4c3e0c[_0x1473('0x11')]){return _0x6f4474(null,![],{'message':_0x1473('0x18')});}else if(_0x332abb[_0x1473('0xb')]>0x0){if(_0x4c3e0c[_0x1473('0x12')]){if(_0x332abb[_0x1473('0xc')]>0x0){if(moment(_0x4c3e0c[_0x1473('0x1a')])[_0x1473('0x1b')](_0x332abb[_0x1473('0xc')],_0x1473('0x1c'))>moment()){return _0x6f4474(null,![],{'message':_0x1473('0x18')});}else{return utils[_0x1473('0x1d')](_0x4c3e0c,_0x137b59,![],null)[_0x1473('0x17')](function(){return _0x6f4474(null,![],{'message':_0x1473('0x18')});});}}else{return _0x6f4474(null,![],{'message':_0x1473('0x18')});}}else{if(_0x137b59>=_0x332abb[_0x1473('0xb')]){return utils['clearBlockUser'](_0x4c3e0c,0x0,!![],moment())[_0x1473('0x17')](function(){return _0x6f4474(null,![],{'message':_0x1473('0x18')});});}else{return utils[_0x1473('0x1d')](_0x4c3e0c,_0x137b59,![],null)['then'](function(){return _0x6f4474(null,![],{'message':_0x1473('0x18')});});}}}else{return _0x6f4474(null,![],{'message':_0x1473('0x18')});}}else{if(_0x4c3e0c[_0x1473('0x11')]){return _0x6f4474(null,![],{'message':_0x1473('0x18')});}else if(_0x332abb[_0x1473('0xb')]>0x0){if(_0x4c3e0c[_0x1473('0x12')]){if(_0x332abb[_0x1473('0xc')]>0x0){if(moment(_0x4c3e0c[_0x1473('0x1a')])[_0x1473('0x1b')](_0x332abb[_0x1473('0xc')],_0x1473('0x1c'))>moment()){return _0x6f4474(null,![],{'message':_0x1473('0x18')});}else{return utils[_0x1473('0x1d')](_0x4c3e0c,0x0,![],null)['then'](function(){return utils[_0x1473('0x1e')](_0x4c3e0c);})['then'](function(){return _0x6f4474(null,_0x4c3e0c);});}}else{return _0x6f4474(null,![],{'message':_0x1473('0x18')});}}else{return utils[_0x1473('0x1d')](_0x4c3e0c,0x0,![],null)[_0x1473('0x17')](function(){return utils[_0x1473('0x1e')](_0x4c3e0c);})['then'](function(){return _0x6f4474(null,_0x4c3e0c);})[_0x1473('0x1f')](function(_0xde9af3){return _0x6f4474(null,![],_0xde9af3);});}}else{if(_0x4c3e0c[_0x1473('0x12')]){return _0x6f4474(null,![],{'message':_0x1473('0x18')});}else{return utils[_0x1473('0x1e')](_0x4c3e0c)[_0x1473('0x17')](function(){return _0x6f4474(null,_0x4c3e0c);});}}}});})['catch'](function(_0x3bfd2b){return _0x6f4474(null,![],_0x3bfd2b);});}function sendServiceMail(_0x52ad4d){return db[_0x1473('0x20')][_0x1473('0x21')]({'where':{'service':!![]},'attributes':['id',_0x1473('0xd'),_0x1473('0x22')],'include':[{'model':db[_0x1473('0x23')],'as':_0x1473('0x24')}]})[_0x1473('0x17')](function(_0x4b03ad){if(!_0x4b03ad){throw new Error(_0x1473('0x25'));}var _0x3c6384={'tls':{'rejectUnauthorized':![]}};if(_0x4b03ad['Smtp']['service']){_0x3c6384[_0x1473('0x26')]=_0x4b03ad[_0x1473('0x24')][_0x1473('0x26')];}else{_0x3c6384[_0x1473('0x27')]=_0x4b03ad[_0x1473('0x24')][_0x1473('0x27')];_0x3c6384['port']=_0x4b03ad[_0x1473('0x24')][_0x1473('0x28')];_0x3c6384[_0x1473('0x29')]=_0x4b03ad[_0x1473('0x24')][_0x1473('0x29')];}if(_0x4b03ad[_0x1473('0x24')]['authentication']){_0x3c6384[_0x1473('0x2a')]={'user':_0x4b03ad[_0x1473('0x24')][_0x1473('0x15')],'pass':_0x4b03ad['Smtp'][_0x1473('0x2b')]};}var _0x2379fd={'account':_0x3c6384,'message':_[_0x1473('0x2c')]({'from':util['format'](_0x1473('0x2d'),_0x4b03ad['name'],_0x4b03ad[_0x1473('0x22')]||_0x4b03ad[_0x1473('0x24')][_0x1473('0x15')])},_0x52ad4d)};return client[_0x1473('0x2e')](_0x1473('0x2f'),_0x2379fd);})[_0x1473('0x17')](function(_0x2c4eea){if(_0x2c4eea['error']){throw new Error(util['format'](_0x1473('0x30'),_0x2c4eea[_0x1473('0x31')][_0x1473('0x32')]||JSON[_0x1473('0x33')](_0x2c4eea[_0x1473('0x31')])));}return!![];});}function handleError(_0x25da2d,_0x40014b,_0x3325ad){return _0x25da2d['status'](_0x40014b||0x1f4)[_0x1473('0x34')]({'message':_0x3325ad?_0x3325ad[_0x1473('0x32')]||_0x3325ad:''});}exports[_0x1473('0x35')]=function(_0xe325ed,_0x5008a0,_0x43ac69){passport[_0x1473('0x19')]('local',function(_0x440814,_0x258862,_0x81a8aa){var _0x54d5b4=_0x440814||_0x81a8aa;if(_0x54d5b4){return handleError(_0x5008a0,0x191,_0x54d5b4);}if(!_0x258862){return handleError(_0x5008a0,0x194,{'message':_0x1473('0x36')});}else{var _0x11e391={'payload':{'id':_0x258862['id'],'role':_0x258862[_0x1473('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x1473('0x37')](_0x11e391)[_0x1473('0x17')](function(_0x2396ab){_0x5008a0['json']({'id':_0x258862['id'],'token':_0x2396ab,'statusCall':'','isAlreadyLogged':_0x258862[_0x1473('0x38')]});});}})(_0xe325ed,_0x5008a0,_0x43ac69);};exports[_0x1473('0x39')]=function(_0x2233b6,_0x583772,_0x1c50f7){if(!_0x2233b6[_0x1473('0x3a')][_0x1473('0x22')]){return handleError(_0x583772,0x1f4,{'message':_0x1473('0x3b')});}var _0x48096c=rs['generate']();_0x2233b6[_0x1473('0x3a')][_0x1473('0x22')]=_0x2233b6['body'][_0x1473('0x22')][_0x1473('0x3c')]()[_0x1473('0x3d')]();var _0x550721;return db[_0x1473('0x9')][_0x1473('0xa')]({'where':{'id':0x1},'attributes':[_0x1473('0xb'),'blockDuration'],'raw':!![]})[_0x1473('0x17')](function(_0x231a98){_0x550721=_0x231a98;return db['User']['find']({'where':{'email':_0x2233b6[_0x1473('0x3a')][_0x1473('0x22')]}});})['then'](function(_0xdd49b4){if(!_0xdd49b4){throw new Error(_0x1473('0x3e'));}if(_0xdd49b4[_0x1473('0x11')]){throw new Error(_0x1473('0x3f'));}if(_0xdd49b4['blocked']){if(moment(_0xdd49b4[_0x1473('0x1a')])[_0x1473('0x1b')](_0x550721[_0x1473('0xc')],'minutes')>moment()){throw new Error(_0x1473('0x40'));}else{_0xdd49b4[_0x1473('0x12')]=![];_0xdd49b4['blockedAt']=null;}}_0xdd49b4[_0x1473('0x41')]=_0x48096c;_0xdd49b4[_0x1473('0x42')]=Date[_0x1473('0x43')]()+0x36ee80;return _0xdd49b4['save']();})[_0x1473('0x17')](function(){return sendServiceMail({'to':_0x2233b6[_0x1473('0x3a')][_0x1473('0x22')],'subject':_0x1473('0x44'),'text':_0x1473('0x45')+_0x1473('0x46')+_0x1473('0x47')+_0x2233b6[_0x1473('0x48')][_0x1473('0x27')]+_0x1473('0x49')+_0x48096c+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x583772[_0x1473('0x4a')](0xc8)[_0x1473('0x34')]({'message':_0x1473('0x4b')});})[_0x1473('0x1f')](function(_0x3804c7){return handleError(_0x583772,0x1f4,_0x3804c7);});};exports[_0x1473('0x4c')]=function(_0x1958cc,_0x2c1cd3,_0x51f39a){return db[_0x1473('0x4d')][_0x1473('0x21')]({'where':{'resetPasswordToken':_0x1958cc[_0x1473('0x4e')][_0x1473('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x1473('0x43')]()}}})[_0x1473('0x17')](function(_0x4880ea){if(!_0x4880ea){throw new Error(_0x1473('0x50'));}return db['Setting'][_0x1473('0xa')]({'attributes':['id',_0x1473('0x51'),_0x1473('0x52'),_0x1473('0x53')]})[_0x1473('0x17')](function(_0xa3ad48){if(_0xa3ad48[_0x1473('0x51')])authService[_0x1473('0x54')](_0x1958cc[_0x1473('0x3a')][_0x1473('0xe')]);if(!_0xa3ad48[_0x1473('0x52')]||!_0x4880ea[_0x1473('0x55')])return _0x4880ea;authService[_0x1473('0x56')](_0x1958cc[_0x1473('0x3a')]['password'],_0x4880ea[_0x1473('0x55')],_0xa3ad48[_0x1473('0x53')]);return _0x4880ea;})[_0x1473('0x17')](function(){_0x4880ea[_0x1473('0xe')]=_0x1958cc[_0x1473('0x3a')][_0x1473('0xe')];_0x4880ea[_0x1473('0x41')]=null;_0x4880ea[_0x1473('0x42')]=null;return _0x4880ea[_0x1473('0x57')]();});})['then'](function(){_0x2c1cd3[_0x1473('0x4a')](0xc8)[_0x1473('0x34')]({'message':_0x1473('0x58')});})[_0x1473('0x1f')](function(_0x3d0dcc){return handleError(_0x2c1cd3,0x1f4,_0x3d0dcc);});};passport[_0x1473('0x59')](new LocalStrategy({'usernameField':_0x1473('0xd'),'passwordField':_0x1473('0xe')},function(_0x23ec82,_0x4824b3,_0x515221){return localAuthenticate(db['User'],_0x23ec82,_0x4824b3,_0x515221);})); \ No newline at end of file +var _0x79ea=['https://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','send','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','http','Setting','findOne','then','name','password','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blockDuration','add','clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','\x22%s\x22\x20<%s>','email','request','SendMail','error','format','status','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','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'];(function(_0x1da6f8,_0xf5257d){var _0x2f45f5=function(_0x27941a){while(--_0x27941a){_0x1da6f8['push'](_0x1da6f8['shift']());}};_0x2f45f5(++_0xf5257d);}(_0x79ea,0xbb));var _0xa79e=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x79ea[_0x4206f5];return _0xa29cf3;};'use strict';var util=require(_0xa79e('0x0'));var passport=require(_0xa79e('0x1'));var LocalStrategy=require(_0xa79e('0x2'))['Strategy'];var jayson=require(_0xa79e('0x3'));var _=require(_0xa79e('0x4'));var rs=require(_0xa79e('0x5'));var moment=require(_0xa79e('0x6'));var db=require(_0xa79e('0x7'))['db'];var authService=require(_0xa79e('0x8'));var utils=require('../../config/utils');var client=jayson['client'][_0xa79e('0x9')]({'port':0x232b});function localAuthenticate(_0x36c9bf,_0x6b017f,_0x197777,_0x6cc776){var _0xa88b0d,_0xb12a75;return db[_0xa79e('0xa')][_0xa79e('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xa79e('0xc')](function(_0x3b1f72){_0xa88b0d=_0x3b1f72;return _0x36c9bf['findOne']({'attributes':['id',_0xa79e('0xd'),_0xa79e('0xe'),'salt',_0xa79e('0xf'),_0xa79e('0x10'),_0xa79e('0x11'),'blockedAt',_0xa79e('0x12')],'where':{'name':_0x6b017f,'role':{'$or':[_0xa79e('0x13'),_0xa79e('0x14'),_0xa79e('0x15')]}}});})[_0xa79e('0xc')](function(_0xb94613){if(!_0xb94613||_0xb94613&&_0xb94613['name']!==_0x6b017f){throw new Error(_0xa79e('0x16'));}else{_0xb12a75=_0xb94613;return _0xb12a75;}})[_0xa79e('0xc')](function(){_0xb12a75[_0xa79e('0x17')](_0x197777,function(_0x1116d2,_0x10eab9){var _0xde5eb=_0xb12a75[_0xa79e('0x12')]+0x1;if(_0x1116d2){return _0x6cc776(_0x1116d2);}else if(!_0x10eab9){if(_0xb12a75[_0xa79e('0x10')]){return _0x6cc776(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xa88b0d[_0xa79e('0x18')]>0x0){if(_0xb12a75[_0xa79e('0x11')]){if(_0xa88b0d[_0xa79e('0x19')]>0x0){if(moment(_0xb12a75['blockedAt'])[_0xa79e('0x1a')](_0xa88b0d['blockDuration'],'minutes')>moment()){return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}else{return utils[_0xa79e('0x1b')](_0xb12a75,_0xde5eb,![],null)[_0xa79e('0xc')](function(){return _0x6cc776(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}}else{if(_0xde5eb>=_0xa88b0d[_0xa79e('0x18')]){return utils[_0xa79e('0x1b')](_0xb12a75,0x0,!![],moment())[_0xa79e('0xc')](function(){return _0x6cc776(null,![],{'message':_0xa79e('0x16')});});}else{return utils[_0xa79e('0x1b')](_0xb12a75,_0xde5eb,![],null)['then'](function(){return _0x6cc776(null,![],{'message':_0xa79e('0x16')});});}}}else{return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}}else{if(_0xb12a75[_0xa79e('0x10')]){return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}else if(_0xa88b0d['allowedLoginAttempts']>0x0){if(_0xb12a75['blocked']){if(_0xa88b0d[_0xa79e('0x19')]>0x0){if(moment(_0xb12a75[_0xa79e('0x1c')])[_0xa79e('0x1a')](_0xa88b0d[_0xa79e('0x19')],'minutes')>moment()){return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}else{return utils[_0xa79e('0x1b')](_0xb12a75,0x0,![],null)['then'](function(){return utils[_0xa79e('0x1d')](_0xb12a75);})['then'](function(){return _0x6cc776(null,_0xb12a75);});}}else{return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}}else{return utils[_0xa79e('0x1b')](_0xb12a75,0x0,![],null)[_0xa79e('0xc')](function(){return utils['getLicense'](_0xb12a75);})[_0xa79e('0xc')](function(){return _0x6cc776(null,_0xb12a75);})[_0xa79e('0x1e')](function(_0x420112){return _0x6cc776(null,![],_0x420112);});}}else{if(_0xb12a75[_0xa79e('0x11')]){return _0x6cc776(null,![],{'message':_0xa79e('0x16')});}else{return utils['getLicense'](_0xb12a75)['then'](function(){return _0x6cc776(null,_0xb12a75);});}}}});})[_0xa79e('0x1e')](function(_0x19498a){return _0x6cc776(null,![],_0x19498a);});}function sendServiceMail(_0x5a400e){return db[_0xa79e('0x1f')][_0xa79e('0x20')]({'where':{'service':!![]},'attributes':['id',_0xa79e('0xd'),'email'],'include':[{'model':db[_0xa79e('0x21')],'as':_0xa79e('0x22')}]})['then'](function(_0x2857a4){if(!_0x2857a4){throw new Error(_0xa79e('0x23'));}var _0x535e03={'tls':{'rejectUnauthorized':![]}};if(_0x2857a4[_0xa79e('0x22')][_0xa79e('0x24')]){_0x535e03['service']=_0x2857a4[_0xa79e('0x22')][_0xa79e('0x24')];}else{_0x535e03[_0xa79e('0x25')]=_0x2857a4['Smtp'][_0xa79e('0x25')];_0x535e03[_0xa79e('0x26')]=_0x2857a4[_0xa79e('0x22')][_0xa79e('0x26')];_0x535e03[_0xa79e('0x27')]=_0x2857a4[_0xa79e('0x22')][_0xa79e('0x27')];}if(_0x2857a4['Smtp'][_0xa79e('0x28')]){_0x535e03[_0xa79e('0x29')]={'user':_0x2857a4[_0xa79e('0x22')][_0xa79e('0x14')],'pass':_0x2857a4[_0xa79e('0x22')]['pass']};}var _0x46be68={'account':_0x535e03,'message':_[_0xa79e('0x2a')]({'from':util['format'](_0xa79e('0x2b'),_0x2857a4[_0xa79e('0xd')],_0x2857a4[_0xa79e('0x2c')]||_0x2857a4[_0xa79e('0x22')][_0xa79e('0x14')])},_0x5a400e)};return client[_0xa79e('0x2d')](_0xa79e('0x2e'),_0x46be68);})[_0xa79e('0xc')](function(_0x287b32){if(_0x287b32[_0xa79e('0x2f')]){throw new Error(util[_0xa79e('0x30')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x287b32[_0xa79e('0x2f')]['message']||JSON['stringify'](_0x287b32['error'])));}return!![];});}function handleError(_0x5bfdb4,_0x2824f2,_0x23e4ac){return _0x5bfdb4[_0xa79e('0x31')](_0x2824f2||0x1f4)['send']({'message':_0x23e4ac?_0x23e4ac[_0xa79e('0x32')]||_0x23e4ac:''});}exports['login']=function(_0x282fbb,_0xde72e9,_0x26ad11){passport[_0xa79e('0x17')]('local',function(_0x303bef,_0x14749b,_0x356fcf){var _0x349a1c=_0x303bef||_0x356fcf;if(_0x349a1c){return handleError(_0xde72e9,0x191,_0x349a1c);}if(!_0x14749b){return handleError(_0xde72e9,0x194,{'message':_0xa79e('0x33')});}else{var _0x442c57={'payload':{'id':_0x14749b['id'],'role':_0x14749b['role']},'options':{'expiresIn':0x15180}};return authService[_0xa79e('0x34')](_0x442c57)[_0xa79e('0xc')](function(_0x4d6674){_0xde72e9[_0xa79e('0x35')]({'id':_0x14749b['id'],'token':_0x4d6674,'statusCall':'','isAlreadyLogged':_0x14749b[_0xa79e('0x36')]});});}})(_0x282fbb,_0xde72e9,_0x26ad11);};exports[_0xa79e('0x37')]=function(_0xd0ce17,_0x370bf8,_0x1a2b0e){if(!_0xd0ce17[_0xa79e('0x38')][_0xa79e('0x2c')]){return handleError(_0x370bf8,0x1f4,{'message':_0xa79e('0x39')});}var _0x2336b7=rs[_0xa79e('0x3a')]();_0xd0ce17[_0xa79e('0x38')][_0xa79e('0x2c')]=_0xd0ce17[_0xa79e('0x38')][_0xa79e('0x2c')][_0xa79e('0x3b')]()[_0xa79e('0x3c')]();var _0x19b7dc;return db[_0xa79e('0xa')][_0xa79e('0xb')]({'where':{'id':0x1},'attributes':[_0xa79e('0x18'),_0xa79e('0x19')],'raw':!![]})['then'](function(_0x568e2a){_0x19b7dc=_0x568e2a;return db['User'][_0xa79e('0x20')]({'where':{'email':_0xd0ce17[_0xa79e('0x38')][_0xa79e('0x2c')]}});})[_0xa79e('0xc')](function(_0x5bec5b){if(!_0x5bec5b){throw new Error(_0xa79e('0x3d'));}if(_0x5bec5b[_0xa79e('0x10')]){throw new Error(_0xa79e('0x3e'));}if(_0x5bec5b['blocked']){if(moment(_0x5bec5b['blockedAt'])['add'](_0x19b7dc[_0xa79e('0x19')],_0xa79e('0x3f'))>moment()){throw new Error(_0xa79e('0x40'));}else{_0x5bec5b[_0xa79e('0x11')]=![];_0x5bec5b[_0xa79e('0x1c')]=null;}}_0x5bec5b[_0xa79e('0x41')]=_0x2336b7;_0x5bec5b[_0xa79e('0x42')]=Date[_0xa79e('0x43')]()+0x36ee80;return _0x5bec5b[_0xa79e('0x44')]();})[_0xa79e('0xc')](function(){return sendServiceMail({'to':_0xd0ce17[_0xa79e('0x38')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xa79e('0x45')+_0xa79e('0x46')+_0xa79e('0x47')+_0xd0ce17['headers'][_0xa79e('0x25')]+'/reset/'+_0x2336b7+'\x0a\x0a'+_0xa79e('0x48')});})[_0xa79e('0xc')](function(){_0x370bf8['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x57a133){return handleError(_0x370bf8,0x1f4,_0x57a133);});};exports['reset']=function(_0x514f51,_0xfe8dcf,_0x2dd600){return db[_0xa79e('0x49')]['find']({'where':{'resetPasswordToken':_0x514f51[_0xa79e('0x4a')][_0xa79e('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x4e3bb9){if(!_0x4e3bb9){throw new Error(_0xa79e('0x4c'));}return db[_0xa79e('0xa')]['findOne']({'attributes':['id','securePassword',_0xa79e('0x4d'),_0xa79e('0x4e')]})['then'](function(_0x35aba8){if(_0x35aba8[_0xa79e('0x4f')])authService[_0xa79e('0x50')](_0x514f51[_0xa79e('0x38')][_0xa79e('0xe')]);if(!_0x35aba8['enforcePasswordHistory']||!_0x4e3bb9['previousPasswords'])return _0x4e3bb9;authService[_0xa79e('0x51')](_0x514f51[_0xa79e('0x38')][_0xa79e('0xe')],_0x4e3bb9[_0xa79e('0x52')],_0x35aba8[_0xa79e('0x4e')]);return _0x4e3bb9;})['then'](function(){_0x4e3bb9['password']=_0x514f51[_0xa79e('0x38')][_0xa79e('0xe')];_0x4e3bb9[_0xa79e('0x41')]=null;_0x4e3bb9['resetPasswordExpires']=null;return _0x4e3bb9[_0xa79e('0x44')]();});})['then'](function(){_0xfe8dcf['status'](0xc8)[_0xa79e('0x53')]({'message':_0xa79e('0x54')});})[_0xa79e('0x1e')](function(_0x36ddc5){return handleError(_0xfe8dcf,0x1f4,_0x36ddc5);});};passport[_0xa79e('0x55')](new LocalStrategy({'usernameField':'name','passwordField':_0xa79e('0xe')},function(_0x89f182,_0x171946,_0x1b0181){return localAuthenticate(db[_0xa79e('0x49')],_0x89f182,_0x171946,_0x1b0181);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c1f0d3d..8135e8c 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 _0xd979=['/forgot','reset','exports','express','Router','./authLocal.controller','post','login'];(function(_0x642cb7,_0x1f6d33){var _0x2bf59f=function(_0x2c3c48){while(--_0x2c3c48){_0x642cb7['push'](_0x642cb7['shift']());}};_0x2bf59f(++_0x1f6d33);}(_0xd979,0xc3));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x9d97('0x0'));var router=express[_0x9d97('0x1')]();var controller=require(_0x9d97('0x2'));router[_0x9d97('0x3')]('/',controller[_0x9d97('0x4')]);router[_0x9d97('0x3')](_0x9d97('0x5'),controller['forgot']);router['post']('/reset/:token',controller[_0x9d97('0x6')]);module[_0x9d97('0x7')]=router; \ No newline at end of file +var _0x19c0=['post','login','/forgot','forgot','/reset/:token','exports','express','Router'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x19c0,0x11e));var _0x019c=function(_0x95e583,_0x55a48f){_0x95e583=_0x95e583-0x0;var _0x219957=_0x19c0[_0x95e583];return _0x219957;};'use strict';var express=require(_0x019c('0x0'));var router=express[_0x019c('0x1')]();var controller=require('./authLocal.controller');router[_0x019c('0x2')]('/',controller[_0x019c('0x3')]);router[_0x019c('0x2')](_0x019c('0x4'),controller[_0x019c('0x5')]);router[_0x019c('0x2')](_0x019c('0x6'),controller['reset']);module[_0x019c('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index a7c1e84..ba2a50b 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 _0xecde=['STRING','INTEGER'];(function(_0x3d7730,_0x669028){var _0x45fe1a=function(_0x21267d){while(--_0x21267d){_0x3d7730['push'](_0x3d7730['shift']());}};_0x45fe1a(++_0x669028);}(_0xecde,0x17a));var _0xeecd=function(_0x4fa87b,_0xdb6adc){_0x4fa87b=_0x4fa87b-0x0;var _0x4130d9=_0xecde[_0x4fa87b];return _0x4130d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeecd('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xeecd('0x0')]},'description':{'type':Sequelize[_0xeecd('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xeecd('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5afd=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x423a9a,_0x2ec223){var _0x564475=function(_0x33b25a){while(--_0x33b25a){_0x423a9a['push'](_0x423a9a['shift']());}};_0x564475(++_0x2ec223);}(_0x5afd,0xf7));var _0xd5af=function(_0x1e0d61,_0x3307c9){_0x1e0d61=_0x1e0d61-0x0;var _0x2d1237=_0x5afd[_0x1e0d61];return _0x2d1237;};'use strict';var Sequelize=require(_0xd5af('0x0'));module[_0xd5af('0x1')]={'name':{'type':Sequelize[_0xd5af('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd5af('0x2')]},'description':{'type':Sequelize[_0xd5af('0x2')]},'status':{'type':Sequelize[_0xd5af('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd5af('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 8eeec56..7716e90 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 _0x194e=['pick','filter','merge','VIRTUAL','options','includeAll','include','Automation','findAll','catch','show','params','create','body','find','addConditions','Condition','omit','ids','getConditions','findOne','order','hasOwnProperty','Action','addActions','getActions','length','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where'];(function(_0x3466e5,_0x149a31){var _0x2eb661=function(_0x35fcbb){while(--_0x35fcbb){_0x3466e5['push'](_0x3466e5['shift']());}};_0x2eb661(++_0x149a31);}(_0x194e,0xc9));var _0xe194=function(_0x4c62a0,_0x2c49f1){_0x4c62a0=_0x4c62a0-0x0;var _0x5556e7=_0x194e[_0x4c62a0];return _0x5556e7;};'use strict';var emlformat=require(_0xe194('0x0'));var rimraf=require(_0xe194('0x1'));var zipdir=require(_0xe194('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe194('0x3'));var Mustache=require(_0xe194('0x4'));var util=require(_0xe194('0x5'));var path=require(_0xe194('0x6'));var sox=require('sox');var csv=require(_0xe194('0x7'));var ejs=require(_0xe194('0x8'));var fs=require('fs');var fs_extra=require(_0xe194('0x9'));var _=require(_0xe194('0xa'));var squel=require(_0xe194('0xb'));var crypto=require(_0xe194('0xc'));var jsforce=require(_0xe194('0xd'));var deskjs=require(_0xe194('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe194('0xf'));var Redis=require('ioredis');var authService=require(_0xe194('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe194('0x11'));var hardwareService=require(_0xe194('0x12'));var logger=require('../../config/logger')(_0xe194('0x13'));var utils=require(_0xe194('0x14'));var config=require(_0xe194('0x15'));var licenseUtil=require(_0xe194('0x16'));var db=require(_0xe194('0x17'))['db'];function respondWithStatusCode(_0x1aaaf0,_0x45c08){_0x45c08=_0x45c08||0xcc;return function(_0x50d476){if(_0x50d476){return _0x1aaaf0[_0xe194('0x18')](_0x45c08);}return _0x1aaaf0[_0xe194('0x19')](_0x45c08)[_0xe194('0x1a')]();};}function respondWithResult(_0x499395,_0x454e2d){_0x454e2d=_0x454e2d||0xc8;return function(_0x3fec30){if(_0x3fec30){return _0x499395['status'](_0x454e2d)[_0xe194('0x1b')](_0x3fec30);}};}function respondWithFilteredResult(_0x503fe2,_0x2b9453){return function(_0x277cfc){if(_0x277cfc){var _0x1e7f5b=typeof _0x2b9453['offset']===_0xe194('0x1c')&&typeof _0x2b9453[_0xe194('0x1d')]===_0xe194('0x1c');var _0x40405b=_0x277cfc[_0xe194('0x1e')];var _0x501942=_0x1e7f5b?0x0:_0x2b9453['offset'];var _0x5527ef=_0x1e7f5b?_0x277cfc[_0xe194('0x1e')]:_0x2b9453[_0xe194('0x1f')]+_0x2b9453[_0xe194('0x1d')];var _0x499568;if(_0x5527ef>=_0x40405b){_0x5527ef=_0x40405b;_0x499568=0xc8;}else{_0x499568=0xce;}_0x503fe2[_0xe194('0x19')](_0x499568);return _0x503fe2[_0xe194('0x20')](_0xe194('0x21'),_0x501942+'-'+_0x5527ef+'/'+_0x40405b)[_0xe194('0x1b')](_0x277cfc);}return null;};}function patchUpdates(_0x413658){return function(_0x3ef452){try{jsonpatch[_0xe194('0x22')](_0x3ef452,_0x413658,!![]);}catch(_0x2d08a1){return BPromise[_0xe194('0x23')](_0x2d08a1);}return _0x3ef452[_0xe194('0x24')]();};}function saveUpdates(_0x237f6a,_0x4ff5a5){return function(_0x1a4175){if(_0x1a4175){return _0x1a4175[_0xe194('0x25')](_0x237f6a)[_0xe194('0x26')](function(_0x4385a6){return _0x4385a6;});}return null;};}function removeEntity(_0x329aa2,_0x186e75){return function(_0x539713){if(_0x539713){return _0x539713[_0xe194('0x27')]()[_0xe194('0x26')](function(){_0x329aa2[_0xe194('0x19')](0xcc)[_0xe194('0x1a')]();});}};}function handleEntityNotFound(_0x49490a,_0x4c1981){return function(_0x2e33a2){if(!_0x2e33a2){_0x49490a[_0xe194('0x18')](0x194);}return _0x2e33a2;};}function handleError(_0x493f6,_0xfe8f10){_0xfe8f10=_0xfe8f10||0x1f4;return function(_0xfa3bc7){logger[_0xe194('0x28')](_0xfa3bc7[_0xe194('0x29')]);if(_0xfa3bc7[_0xe194('0x2a')]){delete _0xfa3bc7[_0xe194('0x2a')];}_0x493f6[_0xe194('0x19')](_0xfe8f10)[_0xe194('0x2b')](_0xfa3bc7);};}exports[_0xe194('0x2c')]=function(_0x30b885,_0x4cdceb){var _0x5cc1ba={},_0x24a365={},_0x239160={'count':0x0,'rows':[]};var _0x506c75=_[_0xe194('0x2d')](db['Automation'][_0xe194('0x2e')],function(_0x3abcc3){return{'name':_0x3abcc3[_0xe194('0x2f')],'type':_0x3abcc3[_0xe194('0x30')][_0xe194('0x31')]};});_0x24a365[_0xe194('0x32')]=_[_0xe194('0x2d')](_0x506c75,_0xe194('0x2a'));_0x24a365[_0xe194('0x33')]=_[_0xe194('0x34')](_0x30b885[_0xe194('0x33')]);_0x24a365[_0xe194('0x35')]=_[_0xe194('0x36')](_0x24a365['model'],_0x24a365[_0xe194('0x33')]);_0x5cc1ba[_0xe194('0x37')]=_[_0xe194('0x36')](_0x24a365['model'],qs[_0xe194('0x38')](_0x30b885[_0xe194('0x33')][_0xe194('0x38')]));_0x5cc1ba['attributes']=_0x5cc1ba[_0xe194('0x37')]['length']?_0x5cc1ba[_0xe194('0x37')]:_0x24a365['model'];if(!_0x30b885['query']['hasOwnProperty'](_0xe194('0x39'))){_0x5cc1ba['limit']=qs[_0xe194('0x1d')](_0x30b885['query'][_0xe194('0x1d')]);_0x5cc1ba[_0xe194('0x1f')]=qs['offset'](_0x30b885[_0xe194('0x33')][_0xe194('0x1f')]);}_0x5cc1ba['order']=qs[_0xe194('0x3a')](_0x30b885[_0xe194('0x33')]['sort']);_0x5cc1ba[_0xe194('0x3b')]=qs[_0xe194('0x35')](_[_0xe194('0x3c')](_0x30b885[_0xe194('0x33')],_0x24a365[_0xe194('0x35')]),_0x506c75);if(_0x30b885[_0xe194('0x33')][_0xe194('0x3d')]){_0x5cc1ba['where']=_[_0xe194('0x3e')](_0x5cc1ba[_0xe194('0x3b')],{'$or':_[_0xe194('0x2d')](_0x506c75,function(_0x1e973c){if(_0x1e973c[_0xe194('0x30')]!==_0xe194('0x3f')){var _0x417ef5={};_0x417ef5[_0x1e973c['name']]={'$like':'%'+_0x30b885[_0xe194('0x33')][_0xe194('0x3d')]+'%'};return _0x417ef5;}})});}_0x5cc1ba=_[_0xe194('0x3e')]({},_0x5cc1ba,_0x30b885[_0xe194('0x40')]);var _0x2fd936={'where':_0x5cc1ba[_0xe194('0x3b')]};return db['Automation'][_0xe194('0x1e')](_0x2fd936)['then'](function(_0x54ab59){_0x239160[_0xe194('0x1e')]=_0x54ab59;if(_0x30b885[_0xe194('0x33')][_0xe194('0x41')]){_0x5cc1ba[_0xe194('0x42')]=[{'all':!![]}];}return db[_0xe194('0x43')][_0xe194('0x44')](_0x5cc1ba);})[_0xe194('0x26')](function(_0x5e08de){_0x239160['rows']=_0x5e08de;return _0x239160;})['then'](respondWithFilteredResult(_0x4cdceb,_0x5cc1ba))[_0xe194('0x45')](handleError(_0x4cdceb,null));};exports[_0xe194('0x46')]=function(_0xee0a1d,_0x27d5a1){var _0xa7f9d8={'raw':![],'where':{'id':_0xee0a1d[_0xe194('0x47')]['id']}},_0x3d34d9={};_0x3d34d9[_0xe194('0x32')]=_[_0xe194('0x34')](db[_0xe194('0x43')][_0xe194('0x2e')]);_0x3d34d9[_0xe194('0x33')]=_['keys'](_0xee0a1d['query']);_0x3d34d9['filters']=_[_0xe194('0x36')](_0x3d34d9[_0xe194('0x32')],_0x3d34d9[_0xe194('0x33')]);_0xa7f9d8[_0xe194('0x37')]=_[_0xe194('0x36')](_0x3d34d9[_0xe194('0x32')],qs['fields'](_0xee0a1d['query'][_0xe194('0x38')]));_0xa7f9d8[_0xe194('0x37')]=_0xa7f9d8[_0xe194('0x37')]['length']?_0xa7f9d8[_0xe194('0x37')]:_0x3d34d9[_0xe194('0x32')];if(_0xee0a1d[_0xe194('0x33')]['includeAll']){_0xa7f9d8['include']=[{'all':!![]}];}_0xa7f9d8=_[_0xe194('0x3e')]({},_0xa7f9d8,_0xee0a1d['options']);return db['Automation']['find'](_0xa7f9d8)[_0xe194('0x26')](handleEntityNotFound(_0x27d5a1,null))[_0xe194('0x26')](respondWithResult(_0x27d5a1,null))[_0xe194('0x45')](handleError(_0x27d5a1,null));};exports[_0xe194('0x48')]=function(_0x532d5b,_0x2e0ee0){return db['Automation'][_0xe194('0x48')](_0x532d5b[_0xe194('0x49')],{})[_0xe194('0x26')](respondWithResult(_0x2e0ee0,0xc9))[_0xe194('0x45')](handleError(_0x2e0ee0,null));};exports['update']=function(_0x2f3d33,_0x1ddc3f){if(_0x2f3d33[_0xe194('0x49')]['id']){delete _0x2f3d33[_0xe194('0x49')]['id'];}return db[_0xe194('0x43')][_0xe194('0x4a')]({'where':{'id':_0x2f3d33[_0xe194('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ddc3f,null))['then'](saveUpdates(_0x2f3d33['body'],null))[_0xe194('0x26')](respondWithResult(_0x1ddc3f,null))[_0xe194('0x45')](handleError(_0x1ddc3f,null));};exports['destroy']=function(_0x5b70e1,_0x2b51f5){return db['Automation'][_0xe194('0x4a')]({'where':{'id':_0x5b70e1[_0xe194('0x47')]['id']}})[_0xe194('0x26')](handleEntityNotFound(_0x2b51f5,null))['then'](removeEntity(_0x2b51f5,null))['catch'](handleError(_0x2b51f5,null));};exports[_0xe194('0x4b')]=function(_0x19d52b,_0x4dfb90,_0x456837){return db[_0xe194('0x4c')]['find']({'where':{'id':_0x19d52b[_0xe194('0x47')]['id']}})[_0xe194('0x26')](handleEntityNotFound(_0x4dfb90,null))[_0xe194('0x26')](function(_0x480139){if(_0x480139){return _0x480139[_0xe194('0x4b')](_0x19d52b['body']['ids'],_[_0xe194('0x4d')](_0x19d52b[_0xe194('0x49')],[_0xe194('0x4e'),'id'])||{});}})[_0xe194('0x26')](respondWithResult(_0x4dfb90,null))[_0xe194('0x45')](handleError(_0x4dfb90,null));};exports[_0xe194('0x4f')]=function(_0x25c147,_0x26a3d0,_0x243de8){var _0x2f8648={};var _0x57a530={};var _0x5379e0;var _0x2bd613;return db[_0xe194('0x43')][_0xe194('0x50')]({'where':{'id':_0x25c147[_0xe194('0x47')]['id']}})[_0xe194('0x26')](handleEntityNotFound(_0x26a3d0,null))['then'](function(_0x4bc0df){if(_0x4bc0df){_0x5379e0=_0x4bc0df;_0x57a530['model']=_[_0xe194('0x34')](db[_0xe194('0x4c')][_0xe194('0x2e')]);_0x57a530[_0xe194('0x33')]=_[_0xe194('0x34')](_0x25c147[_0xe194('0x33')]);_0x57a530[_0xe194('0x35')]=_[_0xe194('0x36')](_0x57a530['model'],_0x57a530[_0xe194('0x33')]);_0x2f8648['attributes']=_[_0xe194('0x36')](_0x57a530[_0xe194('0x32')],qs[_0xe194('0x38')](_0x25c147['query']['fields']));_0x2f8648[_0xe194('0x37')]=_0x2f8648[_0xe194('0x37')]['length']?_0x2f8648[_0xe194('0x37')]:_0x57a530['model'];_0x2f8648[_0xe194('0x51')]=qs[_0xe194('0x3a')](_0x25c147[_0xe194('0x33')][_0xe194('0x3a')]);_0x2f8648['where']=qs[_0xe194('0x35')](_[_0xe194('0x3c')](_0x25c147[_0xe194('0x33')],_0x57a530[_0xe194('0x35')]));if(_0x25c147[_0xe194('0x33')]['filter']){_0x2f8648['where']=_[_0xe194('0x3e')](_0x2f8648[_0xe194('0x3b')],{'$or':_[_0xe194('0x2d')](_0x2f8648[_0xe194('0x37')],function(_0x4c7db1){var _0xe8ea80={};_0xe8ea80[_0x4c7db1]={'$like':'%'+_0x25c147[_0xe194('0x33')][_0xe194('0x3d')]+'%'};return _0xe8ea80;})});}_0x2f8648=_[_0xe194('0x3e')]({},_0x2f8648,_0x25c147['options']);return _0x5379e0['getConditions'](_0x2f8648);}})[_0xe194('0x26')](function(_0x1266d4){if(_0x1266d4){_0x2bd613=_0x1266d4['length'];if(!_0x25c147[_0xe194('0x33')][_0xe194('0x52')](_0xe194('0x39'))){_0x2f8648['limit']=qs[_0xe194('0x1d')](_0x25c147[_0xe194('0x33')]['limit']);_0x2f8648[_0xe194('0x1f')]=qs[_0xe194('0x1f')](_0x25c147[_0xe194('0x33')]['offset']);}return _0x5379e0[_0xe194('0x4f')](_0x2f8648);}})[_0xe194('0x26')](function(_0x26c004){if(_0x26c004){return _0x26c004?{'count':_0x2bd613,'rows':_0x26c004}:null;}})[_0xe194('0x26')](respondWithResult(_0x26a3d0,null))[_0xe194('0x45')](handleError(_0x26a3d0,null));};exports['addActions']=function(_0x6de0c,_0x4cbb80,_0x1e4692){return db[_0xe194('0x53')][_0xe194('0x4a')]({'where':{'id':_0x6de0c['params']['id']}})[_0xe194('0x26')](handleEntityNotFound(_0x4cbb80,null))['then'](function(_0x1cb1e7){if(_0x1cb1e7){return _0x1cb1e7[_0xe194('0x54')](_0x6de0c[_0xe194('0x49')][_0xe194('0x4e')],_[_0xe194('0x4d')](_0x6de0c[_0xe194('0x49')],[_0xe194('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4cbb80,null))[_0xe194('0x45')](handleError(_0x4cbb80,null));};exports[_0xe194('0x55')]=function(_0x1aa6f2,_0x1b958c,_0x2d0ba9){var _0x1625dc={};var _0x2aa32b={};var _0x33cedf;var _0x8f6773;return db[_0xe194('0x43')]['findOne']({'where':{'id':_0x1aa6f2[_0xe194('0x47')]['id']}})[_0xe194('0x26')](handleEntityNotFound(_0x1b958c,null))[_0xe194('0x26')](function(_0x323e7d){if(_0x323e7d){_0x33cedf=_0x323e7d;_0x2aa32b[_0xe194('0x32')]=_[_0xe194('0x34')](db[_0xe194('0x53')][_0xe194('0x2e')]);_0x2aa32b[_0xe194('0x33')]=_[_0xe194('0x34')](_0x1aa6f2[_0xe194('0x33')]);_0x2aa32b[_0xe194('0x35')]=_[_0xe194('0x36')](_0x2aa32b[_0xe194('0x32')],_0x2aa32b[_0xe194('0x33')]);_0x1625dc[_0xe194('0x37')]=_[_0xe194('0x36')](_0x2aa32b[_0xe194('0x32')],qs[_0xe194('0x38')](_0x1aa6f2['query']['fields']));_0x1625dc[_0xe194('0x37')]=_0x1625dc[_0xe194('0x37')][_0xe194('0x56')]?_0x1625dc[_0xe194('0x37')]:_0x2aa32b[_0xe194('0x32')];_0x1625dc[_0xe194('0x51')]=qs[_0xe194('0x3a')](_0x1aa6f2['query']['sort']);_0x1625dc[_0xe194('0x3b')]=qs['filters'](_[_0xe194('0x3c')](_0x1aa6f2['query'],_0x2aa32b[_0xe194('0x35')]));if(_0x1aa6f2[_0xe194('0x33')][_0xe194('0x3d')]){_0x1625dc['where']=_[_0xe194('0x3e')](_0x1625dc[_0xe194('0x3b')],{'$or':_[_0xe194('0x2d')](_0x1625dc[_0xe194('0x37')],function(_0x2eb8f2){var _0x185ea7={};_0x185ea7[_0x2eb8f2]={'$like':'%'+_0x1aa6f2[_0xe194('0x33')][_0xe194('0x3d')]+'%'};return _0x185ea7;})});}_0x1625dc=_[_0xe194('0x3e')]({},_0x1625dc,_0x1aa6f2[_0xe194('0x40')]);return _0x33cedf['getActions'](_0x1625dc);}})[_0xe194('0x26')](function(_0x2fa46f){if(_0x2fa46f){_0x8f6773=_0x2fa46f[_0xe194('0x56')];if(!_0x1aa6f2['query']['hasOwnProperty']('nolimit')){_0x1625dc[_0xe194('0x1d')]=qs[_0xe194('0x1d')](_0x1aa6f2[_0xe194('0x33')][_0xe194('0x1d')]);_0x1625dc[_0xe194('0x1f')]=qs['offset'](_0x1aa6f2[_0xe194('0x33')][_0xe194('0x1f')]);}return _0x33cedf['getActions'](_0x1625dc);}})[_0xe194('0x26')](function(_0x4c6791){if(_0x4c6791){return _0x4c6791?{'count':_0x8f6773,'rows':_0x4c6791}:null;}})[_0xe194('0x26')](respondWithResult(_0x1b958c,null))[_0xe194('0x45')](handleError(_0x1b958c,null));}; \ No newline at end of file +var _0x0d33=['then','error','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Automation','include','findAll','rows','catch','show','params','rawAttributes','fields','length','create','body','find','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy'];(function(_0x49ce5c,_0x59c6fe){var _0x219815=function(_0x1b5778){while(--_0x1b5778){_0x49ce5c['push'](_0x49ce5c['shift']());}};_0x219815(++_0x59c6fe);}(_0x0d33,0xd2));var _0x30d3=function(_0x350c87,_0x2b44ef){_0x350c87=_0x350c87-0x0;var _0x163800=_0x0d33[_0x350c87];return _0x163800;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30d3('0x0'));var zipdir=require(_0x30d3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30d3('0x2'));var moment=require(_0x30d3('0x3'));var BPromise=require(_0x30d3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x30d3('0x5'));var sox=require(_0x30d3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30d3('0x7'));var _=require(_0x30d3('0x8'));var squel=require(_0x30d3('0x9'));var crypto=require(_0x30d3('0xa'));var jsforce=require(_0x30d3('0xb'));var deskjs=require(_0x30d3('0xc'));var toCsv=require(_0x30d3('0xd'));var querystring=require(_0x30d3('0xe'));var Papa=require('papaparse');var Redis=require(_0x30d3('0xf'));var authService=require(_0x30d3('0x10'));var qs=require(_0x30d3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30d3('0x12'));var logger=require(_0x30d3('0x13'))(_0x30d3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x30d3('0x15'));var db=require(_0x30d3('0x16'))['db'];function respondWithStatusCode(_0x5489d8,_0x55805f){_0x55805f=_0x55805f||0xcc;return function(_0x30236d){if(_0x30236d){return _0x5489d8[_0x30d3('0x17')](_0x55805f);}return _0x5489d8[_0x30d3('0x18')](_0x55805f)[_0x30d3('0x19')]();};}function respondWithResult(_0x1ce43c,_0x441756){_0x441756=_0x441756||0xc8;return function(_0x37a054){if(_0x37a054){return _0x1ce43c[_0x30d3('0x18')](_0x441756)[_0x30d3('0x1a')](_0x37a054);}};}function respondWithFilteredResult(_0x187d65,_0x505644){return function(_0x231f13){if(_0x231f13){var _0xfdd0a7=typeof _0x505644[_0x30d3('0x1b')]==='undefined'&&typeof _0x505644[_0x30d3('0x1c')]===_0x30d3('0x1d');var _0xa5e6b2=_0x231f13[_0x30d3('0x1e')];var _0x5e1d56=_0xfdd0a7?0x0:_0x505644[_0x30d3('0x1b')];var _0x48a5b7=_0xfdd0a7?_0x231f13['count']:_0x505644[_0x30d3('0x1b')]+_0x505644['limit'];var _0x197fd9;if(_0x48a5b7>=_0xa5e6b2){_0x48a5b7=_0xa5e6b2;_0x197fd9=0xc8;}else{_0x197fd9=0xce;}_0x187d65['status'](_0x197fd9);return _0x187d65[_0x30d3('0x1f')]('Content-Range',_0x5e1d56+'-'+_0x48a5b7+'/'+_0xa5e6b2)[_0x30d3('0x1a')](_0x231f13);}return null;};}function patchUpdates(_0x3395bd){return function(_0x24a327){try{jsonpatch['apply'](_0x24a327,_0x3395bd,!![]);}catch(_0x2ddb6f){return BPromise[_0x30d3('0x20')](_0x2ddb6f);}return _0x24a327[_0x30d3('0x21')]();};}function saveUpdates(_0x40395b,_0x3572ed){return function(_0x5d3be5){if(_0x5d3be5){return _0x5d3be5[_0x30d3('0x22')](_0x40395b)['then'](function(_0x562b46){return _0x562b46;});}return null;};}function removeEntity(_0x1daa55,_0x300d53){return function(_0x124b1d){if(_0x124b1d){return _0x124b1d[_0x30d3('0x23')]()[_0x30d3('0x24')](function(){_0x1daa55[_0x30d3('0x18')](0xcc)[_0x30d3('0x19')]();});}};}function handleEntityNotFound(_0x53ee0d,_0x3af489){return function(_0x41c932){if(!_0x41c932){_0x53ee0d['sendStatus'](0x194);}return _0x41c932;};}function handleError(_0x4800bf,_0x5dba34){_0x5dba34=_0x5dba34||0x1f4;return function(_0x3f7b18){logger[_0x30d3('0x25')](_0x3f7b18['stack']);if(_0x3f7b18[_0x30d3('0x26')]){delete _0x3f7b18[_0x30d3('0x26')];}_0x4800bf[_0x30d3('0x18')](_0x5dba34)['send'](_0x3f7b18);};}exports[_0x30d3('0x27')]=function(_0x13cc7c,_0x5efcdd){var _0x3399e5={},_0xec8d95={},_0x323acb={'count':0x0,'rows':[]};var _0x17fe2c=_[_0x30d3('0x28')](db['Automation']['rawAttributes'],function(_0x10a4ba){return{'name':_0x10a4ba[_0x30d3('0x29')],'type':_0x10a4ba['type'][_0x30d3('0x2a')]};});_0xec8d95[_0x30d3('0x2b')]=_[_0x30d3('0x28')](_0x17fe2c,_0x30d3('0x26'));_0xec8d95[_0x30d3('0x2c')]=_[_0x30d3('0x2d')](_0x13cc7c[_0x30d3('0x2c')]);_0xec8d95[_0x30d3('0x2e')]=_[_0x30d3('0x2f')](_0xec8d95['model'],_0xec8d95['query']);_0x3399e5[_0x30d3('0x30')]=_[_0x30d3('0x2f')](_0xec8d95[_0x30d3('0x2b')],qs['fields'](_0x13cc7c[_0x30d3('0x2c')]['fields']));_0x3399e5['attributes']=_0x3399e5[_0x30d3('0x30')]['length']?_0x3399e5[_0x30d3('0x30')]:_0xec8d95[_0x30d3('0x2b')];if(!_0x13cc7c[_0x30d3('0x2c')][_0x30d3('0x31')](_0x30d3('0x32'))){_0x3399e5['limit']=qs[_0x30d3('0x1c')](_0x13cc7c[_0x30d3('0x2c')][_0x30d3('0x1c')]);_0x3399e5[_0x30d3('0x1b')]=qs[_0x30d3('0x1b')](_0x13cc7c['query'][_0x30d3('0x1b')]);}_0x3399e5[_0x30d3('0x33')]=qs[_0x30d3('0x34')](_0x13cc7c[_0x30d3('0x2c')]['sort']);_0x3399e5[_0x30d3('0x35')]=qs[_0x30d3('0x2e')](_[_0x30d3('0x36')](_0x13cc7c[_0x30d3('0x2c')],_0xec8d95['filters']),_0x17fe2c);if(_0x13cc7c['query']['filter']){_0x3399e5['where']=_[_0x30d3('0x37')](_0x3399e5[_0x30d3('0x35')],{'$or':_[_0x30d3('0x28')](_0x17fe2c,function(_0x4ac241){if(_0x4ac241[_0x30d3('0x38')]!==_0x30d3('0x39')){var _0x217289={};_0x217289[_0x4ac241['name']]={'$like':'%'+_0x13cc7c[_0x30d3('0x2c')][_0x30d3('0x3a')]+'%'};return _0x217289;}})});}_0x3399e5=_[_0x30d3('0x37')]({},_0x3399e5,_0x13cc7c[_0x30d3('0x3b')]);var _0x124dfd={'where':_0x3399e5[_0x30d3('0x35')]};return db[_0x30d3('0x3c')][_0x30d3('0x1e')](_0x124dfd)[_0x30d3('0x24')](function(_0x399d00){_0x323acb[_0x30d3('0x1e')]=_0x399d00;if(_0x13cc7c[_0x30d3('0x2c')]['includeAll']){_0x3399e5[_0x30d3('0x3d')]=[{'all':!![]}];}return db['Automation'][_0x30d3('0x3e')](_0x3399e5);})['then'](function(_0x4af624){_0x323acb[_0x30d3('0x3f')]=_0x4af624;return _0x323acb;})[_0x30d3('0x24')](respondWithFilteredResult(_0x5efcdd,_0x3399e5))[_0x30d3('0x40')](handleError(_0x5efcdd,null));};exports[_0x30d3('0x41')]=function(_0x508f62,_0x90a954){var _0x2a9137={'raw':![],'where':{'id':_0x508f62[_0x30d3('0x42')]['id']}},_0x1a4b6f={};_0x1a4b6f[_0x30d3('0x2b')]=_[_0x30d3('0x2d')](db[_0x30d3('0x3c')][_0x30d3('0x43')]);_0x1a4b6f['query']=_[_0x30d3('0x2d')](_0x508f62[_0x30d3('0x2c')]);_0x1a4b6f[_0x30d3('0x2e')]=_[_0x30d3('0x2f')](_0x1a4b6f['model'],_0x1a4b6f['query']);_0x2a9137['attributes']=_[_0x30d3('0x2f')](_0x1a4b6f[_0x30d3('0x2b')],qs[_0x30d3('0x44')](_0x508f62[_0x30d3('0x2c')][_0x30d3('0x44')]));_0x2a9137['attributes']=_0x2a9137[_0x30d3('0x30')][_0x30d3('0x45')]?_0x2a9137[_0x30d3('0x30')]:_0x1a4b6f[_0x30d3('0x2b')];if(_0x508f62[_0x30d3('0x2c')]['includeAll']){_0x2a9137[_0x30d3('0x3d')]=[{'all':!![]}];}_0x2a9137=_['merge']({},_0x2a9137,_0x508f62[_0x30d3('0x3b')]);return db[_0x30d3('0x3c')]['find'](_0x2a9137)['then'](handleEntityNotFound(_0x90a954,null))['then'](respondWithResult(_0x90a954,null))['catch'](handleError(_0x90a954,null));};exports[_0x30d3('0x46')]=function(_0x38b840,_0x32f16b){return db[_0x30d3('0x3c')]['create'](_0x38b840[_0x30d3('0x47')],{})[_0x30d3('0x24')](respondWithResult(_0x32f16b,0xc9))['catch'](handleError(_0x32f16b,null));};exports[_0x30d3('0x22')]=function(_0x4c3d52,_0x5d8ada){if(_0x4c3d52[_0x30d3('0x47')]['id']){delete _0x4c3d52[_0x30d3('0x47')]['id'];}return db['Automation'][_0x30d3('0x48')]({'where':{'id':_0x4c3d52['params']['id']}})[_0x30d3('0x24')](handleEntityNotFound(_0x5d8ada,null))[_0x30d3('0x24')](saveUpdates(_0x4c3d52[_0x30d3('0x47')],null))[_0x30d3('0x24')](respondWithResult(_0x5d8ada,null))[_0x30d3('0x40')](handleError(_0x5d8ada,null));};exports['destroy']=function(_0x58e663,_0x1b78cb){return db[_0x30d3('0x3c')][_0x30d3('0x48')]({'where':{'id':_0x58e663['params']['id']}})[_0x30d3('0x24')](handleEntityNotFound(_0x1b78cb,null))[_0x30d3('0x24')](removeEntity(_0x1b78cb,null))['catch'](handleError(_0x1b78cb,null));};exports[_0x30d3('0x49')]=function(_0x1886a2,_0x20139b,_0x3c5332){return db[_0x30d3('0x4a')][_0x30d3('0x48')]({'where':{'id':_0x1886a2[_0x30d3('0x42')]['id']}})[_0x30d3('0x24')](handleEntityNotFound(_0x20139b,null))[_0x30d3('0x24')](function(_0x21b39a){if(_0x21b39a){return _0x21b39a['addConditions'](_0x1886a2[_0x30d3('0x47')]['ids'],_[_0x30d3('0x4b')](_0x1886a2[_0x30d3('0x47')],[_0x30d3('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x20139b,null))['catch'](handleError(_0x20139b,null));};exports[_0x30d3('0x4d')]=function(_0x4ec935,_0x3bea99,_0x41ffe9){var _0x4dbcf9={};var _0x3cd366={};var _0x217685;var _0x375be6;return db[_0x30d3('0x3c')][_0x30d3('0x4e')]({'where':{'id':_0x4ec935[_0x30d3('0x42')]['id']}})[_0x30d3('0x24')](handleEntityNotFound(_0x3bea99,null))['then'](function(_0x418b6b){if(_0x418b6b){_0x217685=_0x418b6b;_0x3cd366[_0x30d3('0x2b')]=_[_0x30d3('0x2d')](db[_0x30d3('0x4a')][_0x30d3('0x43')]);_0x3cd366[_0x30d3('0x2c')]=_[_0x30d3('0x2d')](_0x4ec935[_0x30d3('0x2c')]);_0x3cd366[_0x30d3('0x2e')]=_['intersection'](_0x3cd366[_0x30d3('0x2b')],_0x3cd366['query']);_0x4dbcf9[_0x30d3('0x30')]=_[_0x30d3('0x2f')](_0x3cd366[_0x30d3('0x2b')],qs['fields'](_0x4ec935[_0x30d3('0x2c')][_0x30d3('0x44')]));_0x4dbcf9['attributes']=_0x4dbcf9[_0x30d3('0x30')]['length']?_0x4dbcf9[_0x30d3('0x30')]:_0x3cd366['model'];_0x4dbcf9[_0x30d3('0x33')]=qs[_0x30d3('0x34')](_0x4ec935[_0x30d3('0x2c')]['sort']);_0x4dbcf9['where']=qs[_0x30d3('0x2e')](_[_0x30d3('0x36')](_0x4ec935[_0x30d3('0x2c')],_0x3cd366[_0x30d3('0x2e')]));if(_0x4ec935[_0x30d3('0x2c')]['filter']){_0x4dbcf9[_0x30d3('0x35')]=_[_0x30d3('0x37')](_0x4dbcf9['where'],{'$or':_[_0x30d3('0x28')](_0x4dbcf9[_0x30d3('0x30')],function(_0x532641){var _0x60c56c={};_0x60c56c[_0x532641]={'$like':'%'+_0x4ec935[_0x30d3('0x2c')][_0x30d3('0x3a')]+'%'};return _0x60c56c;})});}_0x4dbcf9=_[_0x30d3('0x37')]({},_0x4dbcf9,_0x4ec935['options']);return _0x217685[_0x30d3('0x4d')](_0x4dbcf9);}})[_0x30d3('0x24')](function(_0x16d610){if(_0x16d610){_0x375be6=_0x16d610['length'];if(!_0x4ec935['query'][_0x30d3('0x31')](_0x30d3('0x32'))){_0x4dbcf9[_0x30d3('0x1c')]=qs[_0x30d3('0x1c')](_0x4ec935[_0x30d3('0x2c')]['limit']);_0x4dbcf9[_0x30d3('0x1b')]=qs[_0x30d3('0x1b')](_0x4ec935['query']['offset']);}return _0x217685[_0x30d3('0x4d')](_0x4dbcf9);}})[_0x30d3('0x24')](function(_0x59e1f3){if(_0x59e1f3){return _0x59e1f3?{'count':_0x375be6,'rows':_0x59e1f3}:null;}})[_0x30d3('0x24')](respondWithResult(_0x3bea99,null))[_0x30d3('0x40')](handleError(_0x3bea99,null));};exports[_0x30d3('0x4f')]=function(_0x153a8d,_0x48d282,_0x21dcae){return db[_0x30d3('0x50')][_0x30d3('0x48')]({'where':{'id':_0x153a8d[_0x30d3('0x42')]['id']}})[_0x30d3('0x24')](handleEntityNotFound(_0x48d282,null))[_0x30d3('0x24')](function(_0x29b53e){if(_0x29b53e){return _0x29b53e[_0x30d3('0x4f')](_0x153a8d[_0x30d3('0x47')][_0x30d3('0x4c')],_[_0x30d3('0x4b')](_0x153a8d[_0x30d3('0x47')],[_0x30d3('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x48d282,null))['catch'](handleError(_0x48d282,null));};exports[_0x30d3('0x51')]=function(_0x270035,_0x230c98,_0x43f051){var _0x15833c={};var _0x159a23={};var _0x4797fe;var _0x1cfa9d;return db[_0x30d3('0x3c')][_0x30d3('0x4e')]({'where':{'id':_0x270035[_0x30d3('0x42')]['id']}})[_0x30d3('0x24')](handleEntityNotFound(_0x230c98,null))[_0x30d3('0x24')](function(_0x422b21){if(_0x422b21){_0x4797fe=_0x422b21;_0x159a23['model']=_['keys'](db[_0x30d3('0x50')]['rawAttributes']);_0x159a23['query']=_[_0x30d3('0x2d')](_0x270035['query']);_0x159a23[_0x30d3('0x2e')]=_[_0x30d3('0x2f')](_0x159a23[_0x30d3('0x2b')],_0x159a23[_0x30d3('0x2c')]);_0x15833c['attributes']=_[_0x30d3('0x2f')](_0x159a23[_0x30d3('0x2b')],qs['fields'](_0x270035[_0x30d3('0x2c')][_0x30d3('0x44')]));_0x15833c[_0x30d3('0x30')]=_0x15833c[_0x30d3('0x30')][_0x30d3('0x45')]?_0x15833c['attributes']:_0x159a23['model'];_0x15833c[_0x30d3('0x33')]=qs['sort'](_0x270035[_0x30d3('0x2c')][_0x30d3('0x34')]);_0x15833c[_0x30d3('0x35')]=qs[_0x30d3('0x2e')](_[_0x30d3('0x36')](_0x270035[_0x30d3('0x2c')],_0x159a23[_0x30d3('0x2e')]));if(_0x270035[_0x30d3('0x2c')]['filter']){_0x15833c[_0x30d3('0x35')]=_[_0x30d3('0x37')](_0x15833c[_0x30d3('0x35')],{'$or':_[_0x30d3('0x28')](_0x15833c['attributes'],function(_0x19a599){var _0x6a817a={};_0x6a817a[_0x19a599]={'$like':'%'+_0x270035[_0x30d3('0x2c')]['filter']+'%'};return _0x6a817a;})});}_0x15833c=_[_0x30d3('0x37')]({},_0x15833c,_0x270035[_0x30d3('0x3b')]);return _0x4797fe['getActions'](_0x15833c);}})[_0x30d3('0x24')](function(_0x1e52b4){if(_0x1e52b4){_0x1cfa9d=_0x1e52b4[_0x30d3('0x45')];if(!_0x270035[_0x30d3('0x2c')][_0x30d3('0x31')](_0x30d3('0x32'))){_0x15833c[_0x30d3('0x1c')]=qs['limit'](_0x270035[_0x30d3('0x2c')][_0x30d3('0x1c')]);_0x15833c[_0x30d3('0x1b')]=qs[_0x30d3('0x1b')](_0x270035['query'][_0x30d3('0x1b')]);}return _0x4797fe[_0x30d3('0x51')](_0x15833c);}})['then'](function(_0x14fea){if(_0x14fea){return _0x14fea?{'count':_0x1cfa9d,'rows':_0x14fea}:null;}})[_0x30d3('0x24')](respondWithResult(_0x230c98,null))['catch'](handleError(_0x230c98,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 5aeb319..58ddbbf 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 _0x6c26=['./automation.attributes','exports','define','Automation','lodash','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1f2950,_0x3b3a56){var _0x3b4254=function(_0x341550){while(--_0x341550){_0x1f2950['push'](_0x1f2950['shift']());}};_0x3b4254(++_0x3b3a56);}(_0x6c26,0x176));var _0x66c2=function(_0x226aa2,_0x370462){_0x226aa2=_0x226aa2-0x0;var _0x4fd674=_0x6c26[_0x226aa2];return _0x4fd674;};'use strict';var _=require(_0x66c2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x66c2('0x1'));var BPromise=require(_0x66c2('0x2'));var rp=require(_0x66c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66c2('0x4'));var config=require(_0x66c2('0x5'));var attributes=require(_0x66c2('0x6'));module[_0x66c2('0x7')]=function(_0x3dd422,_0x4c98bd){return _0x3dd422[_0x66c2('0x8')](_0x66c2('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeb0=['bluebird','request-promise','path','../../config/environment','./automation.attributes','define','Automation','lodash','util','../../config/logger','api','moment'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xaeb0,0x1ab));var _0x0aeb=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xaeb0[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x0aeb('0x0'));var util=require(_0x0aeb('0x1'));var logger=require(_0x0aeb('0x2'))(_0x0aeb('0x3'));var moment=require(_0x0aeb('0x4'));var BPromise=require(_0x0aeb('0x5'));var rp=require(_0x0aeb('0x6'));var fs=require('fs');var path=require(_0x0aeb('0x7'));var rimraf=require('rimraf');var config=require(_0x0aeb('0x8'));var attributes=require(_0x0aeb('0x9'));module['exports']=function(_0x2a3b0a,_0x2548b5){return _0x2a3b0a[_0x0aeb('0xa')](_0x0aeb('0xb'),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 4b594a0..7c0fc2e 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 _0xef0a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x29f439,_0x2099d7){var _0x47560d=function(_0x35d328){while(--_0x35d328){_0x29f439['push'](_0x29f439['shift']());}};_0x47560d(++_0x2099d7);}(_0xef0a,0xdd));var _0xaef0=function(_0x18d814,_0x3eca25){_0x18d814=_0x18d814-0x0;var _0x51880a=_0xef0a[_0x18d814];return _0x51880a;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var moment=require(_0xaef0('0x2'));var BPromise=require(_0xaef0('0x3'));var rs=require(_0xaef0('0x4'));var fs=require('fs');var Redis=require(_0xaef0('0x5'));var db=require(_0xaef0('0x6'))['db'];var utils=require(_0xaef0('0x7'));var logger=require(_0xaef0('0x8'))(_0xaef0('0x9'));var config=require(_0xaef0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xaef0('0xb')][_0xaef0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x273fae,_0x32f86c,_0x5c78d8){return new BPromise(function(_0x47ba50,_0x12ff96){return client[_0xaef0('0xd')](_0x273fae,_0x5c78d8)[_0xaef0('0xe')](function(_0x280d93){logger[_0xaef0('0xf')](_0xaef0('0x10'),_0x32f86c,_0xaef0('0x11'));logger[_0xaef0('0x12')](_0xaef0('0x13'),_0x32f86c,'request\x20sent',JSON[_0xaef0('0x14')](_0x280d93));if(_0x280d93[_0xaef0('0x15')]){if(_0x280d93['error'][_0xaef0('0x16')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x32f86c,_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);return _0x12ff96(_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);}logger[_0xaef0('0x15')](_0xaef0('0x10'),_0x32f86c,_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);return _0x47ba50(_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);}else{logger[_0xaef0('0xf')](_0xaef0('0x10'),_0x32f86c,_0xaef0('0x11'));_0x47ba50(_0x280d93['result'][_0xaef0('0x17')]);}})[_0xaef0('0x18')](function(_0x5c218b){logger[_0xaef0('0x15')](_0xaef0('0x10'),_0x32f86c,_0x5c218b);_0x12ff96(_0x5c218b);});});} \ No newline at end of file +var _0x8383=['stringify','error','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f0398,_0x37a6dd){var _0x3f0ad5=function(_0x415f6c){while(--_0x415f6c){_0x1f0398['push'](_0x1f0398['shift']());}};_0x3f0ad5(++_0x37a6dd);}(_0x8383,0x98));var _0x3838=function(_0x3e00e7,_0x3574d7){_0x3e00e7=_0x3e00e7-0x0;var _0x82a3fd=_0x8383[_0x3e00e7];return _0x82a3fd;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3838('0x1'));var rs=require(_0x3838('0x2'));var fs=require('fs');var Redis=require(_0x3838('0x3'));var db=require(_0x3838('0x4'))['db'];var utils=require(_0x3838('0x5'));var logger=require(_0x3838('0x6'))(_0x3838('0x7'));var config=require(_0x3838('0x8'));var jayson=require(_0x3838('0x9'));var client=jayson[_0x3838('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239750,_0x235001,_0x4cf52b){return new BPromise(function(_0x2abbda,_0x5e2e42){return client[_0x3838('0xb')](_0x239750,_0x4cf52b)[_0x3838('0xc')](function(_0x340c39){logger['info'](_0x3838('0xd'),_0x235001,_0x3838('0xe'));logger[_0x3838('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x235001,_0x3838('0xe'),JSON[_0x3838('0x10')](_0x340c39));if(_0x340c39[_0x3838('0x11')]){if(_0x340c39[_0x3838('0x11')]['code']===0x1f4){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')]['message']);return _0x5e2e42(_0x340c39[_0x3838('0x11')]['message']);}logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')][_0x3838('0x12')]);return _0x2abbda(_0x340c39[_0x3838('0x11')]['message']);}else{logger[_0x3838('0x13')](_0x3838('0xd'),_0x235001,_0x3838('0xe'));_0x2abbda(_0x340c39[_0x3838('0x14')][_0x3838('0x12')]);}})['catch'](function(_0x464fd9){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x464fd9);_0x5e2e42(_0x464fd9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 58c6b4f..11481bc 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 _0xf2a5=['index','/:id','show','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated'];(function(_0xc882de,_0x56312e){var _0x34ae37=function(_0x131d6f){while(--_0x131d6f){_0xc882de['push'](_0xc882de['shift']());}};_0x34ae37(++_0x56312e);}(_0xf2a5,0xc8));var _0x5f2a=function(_0x32301e,_0x407c23){_0x32301e=_0x32301e-0x0;var _0x270ff4=_0xf2a5[_0x32301e];return _0x270ff4;};'use strict';var multer=require('multer');var util=require(_0x5f2a('0x0'));var path=require(_0x5f2a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5f2a('0x2'));var interaction=require(_0x5f2a('0x3'));var config=require(_0x5f2a('0x4'));var controller=require(_0x5f2a('0x5'));router['get']('/',auth[_0x5f2a('0x6')](),controller[_0x5f2a('0x7')]);router['get'](_0x5f2a('0x8'),auth[_0x5f2a('0x6')](),controller[_0x5f2a('0x9')]);router[_0x5f2a('0xa')](_0x5f2a('0xb'),auth[_0x5f2a('0x6')](),controller[_0x5f2a('0xc')]);router[_0x5f2a('0xa')](_0x5f2a('0xd'),auth['isAuthenticated'](),controller[_0x5f2a('0xe')]);router[_0x5f2a('0xf')]('/',auth[_0x5f2a('0x6')](),controller[_0x5f2a('0x10')]);router['post'](_0x5f2a('0xb'),auth[_0x5f2a('0x6')](),controller[_0x5f2a('0x11')]);router[_0x5f2a('0xf')](_0x5f2a('0xd'),auth[_0x5f2a('0x6')](),controller[_0x5f2a('0x12')]);router[_0x5f2a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5f2a('0x14')]);router[_0x5f2a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5f2a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf3ff=['index','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','put','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xf3ff,0xae));var _0xff3f=function(_0x505548,_0x5064f1){_0x505548=_0x505548-0x0;var _0x57e980=_0xf3ff[_0x505548];return _0x57e980;};'use strict';var multer=require(_0xff3f('0x0'));var util=require('util');var path=require(_0xff3f('0x1'));var timeout=require(_0xff3f('0x2'));var express=require(_0xff3f('0x3'));var router=express[_0xff3f('0x4')]();var fs_extra=require(_0xff3f('0x5'));var auth=require(_0xff3f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xff3f('0x7'));var controller=require(_0xff3f('0x8'));router[_0xff3f('0x9')]('/',auth['isAuthenticated'](),controller[_0xff3f('0xa')]);router[_0xff3f('0x9')]('/:id',auth[_0xff3f('0xb')](),controller[_0xff3f('0xc')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller[_0xff3f('0xd')]);router['get'](_0xff3f('0xe'),auth['isAuthenticated'](),controller[_0xff3f('0xf')]);router[_0xff3f('0x10')]('/',auth[_0xff3f('0xb')](),controller[_0xff3f('0x11')]);router[_0xff3f('0x10')](_0xff3f('0x12'),auth[_0xff3f('0xb')](),controller[_0xff3f('0x13')]);router[_0xff3f('0x10')](_0xff3f('0xe'),auth['isAuthenticated'](),controller['addActions']);router[_0xff3f('0x14')](_0xff3f('0x15'),auth[_0xff3f('0xb')](),controller['update']);router['delete'](_0xff3f('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0xff3f('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 77fd57f..e6ccf2e 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 _0xacdd=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','exports','STRING','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\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,*,*,*','ENUM','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x3db211,_0x418f07){var _0x4e0fe8=function(_0x1c627b){while(--_0x1c627b){_0x3db211['push'](_0x3db211['shift']());}};_0x4e0fe8(++_0x418f07);}(_0xacdd,0x16f));var _0xdacd=function(_0x561a36,_0x4226d4){_0x561a36=_0x561a36-0x0;var _0x44353b=_0xacdd[_0x561a36];return _0x44353b;};'use strict';var Sequelize=require('sequelize');module[_0xdacd('0x0')]={'name':{'type':Sequelize[_0xdacd('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdacd('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xdacd('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xdacd('0x3')](0x4)[_0xdacd('0x4')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdacd('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdacd('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xdacd('0x3')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x6')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdacd('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)[_0xdacd('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdacd('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdacd('0xd')},'dialTimezone':{'type':Sequelize[_0xdacd('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdacd('0x1')],'defaultValue':_0xdacd('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xdacd('0xf')](_0xdacd('0x10'),_0xdacd('0x11'),_0xdacd('0x12')),'defaultValue':_0xdacd('0x10')},'dialAMDActive':{'type':Sequelize[_0xdacd('0x13')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xdacd('0x3')](0x9)[_0xdacd('0x4')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdacd('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xdacd('0x3')](0x9)[_0xdacd('0x4')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdacd('0x3')](0x9)[_0xdacd('0x4')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdacd('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdacd('0x3')](0x9)[_0xdacd('0x4')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdacd('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xdacd('0x3')](0x9)[_0xdacd('0x4')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdacd('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdacd('0x4')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdacd('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xdacd('0x4')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdacd('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdacd('0x3')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdacd('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdacd('0xf')](_0xdacd('0x1b'),'ASC'),'defaultValue':_0xdacd('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdacd('0x3')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdacd('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdacd('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xdacd('0x3')](0x3)[_0xdacd('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdacd('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdacd('0x3')](0x5)[_0xdacd('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdacd('0x26')}}; \ No newline at end of file +var _0x8619=['#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x382379,_0x408e61){var _0x52d096=function(_0x4b04bf){while(--_0x4b04bf){_0x382379['push'](_0x382379['shift']());}};_0x52d096(++_0x408e61);}(_0x8619,0x18b));var _0x9861=function(_0x6ab293,_0x2172ff){_0x6ab293=_0x6ab293-0x0;var _0x51b0df=_0x8619[_0x6ab293];return _0x51b0df;};'use strict';var Sequelize=require(_0x9861('0x0'));module[_0x9861('0x1')]={'name':{'type':Sequelize[_0x9861('0x2')],'unique':_0x9861('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9861('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x9861('0x5')},'description':{'type':Sequelize[_0x9861('0x2')]},'active':{'type':Sequelize[_0x9861('0x6')],'defaultValue':0x0,'comment':_0x9861('0x7')},'limitCalls':{'type':Sequelize[_0x9861('0x8')](0x4)[_0x9861('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9861('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9861('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9861('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9861('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9861('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9861('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9861('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x3,'comment':_0x9861('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9861('0x8')](0x5)[_0x9861('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9861('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9861('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9861('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x9861('0x4')](_0x9861('0x11'),'never',_0x9861('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9861('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9861('0x8')](0x9)[_0x9861('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9861('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x9861('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9861('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9861('0x8')](0x9)[_0x9861('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9861('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9861('0x8')](0x9)[_0x9861('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9861('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9861('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9861('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9861('0x8')](0x9)[_0x9861('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9861('0x8')](0x5)[_0x9861('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9861('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9861('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9861('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9861('0x4')](_0x9861('0x1a'),_0x9861('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9861('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9861('0x1c')},'dialCutDigit':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9861('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9861('0x8')](0x5)[_0x9861('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9861('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x9861('0x8')](0x5)[_0x9861('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9861('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9861('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9861('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9861('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9861('0x8')](0x5)[_0x9861('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9861('0x8')](0x3)[_0x9861('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9861('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9861('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7478b5d..8f6c6ee 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 _0xb183=['include','omit','createdAt','updatedAt','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_contacts','phone\x20NOT\x20IN\x20(?)','push','sequelize','all','removeLists','ids','getBlackLists','CmList','addBlackLists','into','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x290344,_0x510703){var _0x3a07ab=function(_0x4f0c71){while(--_0x4f0c71){_0x290344['push'](_0x290344['shift']());}};_0x3a07ab(++_0x510703);}(_0xb183,0x1c0));var _0x3b18=function(_0x406756,_0x2cb008){_0x406756=_0x406756-0x0;var _0x2217af=_0xb183[_0x406756];return _0x2217af;};'use strict';var emlformat=require(_0x3b18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b18('0x1'));var jsonpatch=require(_0x3b18('0x2'));var rp=require('request-promise');var moment=require(_0x3b18('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3b18('0x4'));var sox=require(_0x3b18('0x5'));var csv=require(_0x3b18('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b18('0x7'));var squel=require(_0x3b18('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b18('0x9'));var toCsv=require(_0x3b18('0x6'));var querystring=require(_0x3b18('0xa'));var Papa=require(_0x3b18('0xb'));var Redis=require(_0x3b18('0xc'));var authService=require(_0x3b18('0xd'));var qs=require(_0x3b18('0xe'));var as=require(_0x3b18('0xf'));var hardwareService=require(_0x3b18('0x10'));var logger=require(_0x3b18('0x11'))(_0x3b18('0x12'));var utils=require(_0x3b18('0x13'));var config=require(_0x3b18('0x14'));var licenseUtil=require(_0x3b18('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a2fff,_0x5552ea){_0x5552ea=_0x5552ea||0xcc;return function(_0x2595d9){if(_0x2595d9){return _0x3a2fff[_0x3b18('0x16')](_0x5552ea);}return _0x3a2fff[_0x3b18('0x17')](_0x5552ea)[_0x3b18('0x18')]();};}function respondWithResult(_0x4ebc29,_0x12f913){_0x12f913=_0x12f913||0xc8;return function(_0x595ad4){if(_0x595ad4){return _0x4ebc29[_0x3b18('0x17')](_0x12f913)[_0x3b18('0x19')](_0x595ad4);}};}function respondWithFilteredResult(_0x51cc20,_0x5cfb95){return function(_0x3a8db8){if(_0x3a8db8){var _0x9561ad=typeof _0x5cfb95['offset']==='undefined'&&typeof _0x5cfb95[_0x3b18('0x1a')]===_0x3b18('0x1b');var _0x513174=_0x3a8db8['count'];var _0xc606db=_0x9561ad?0x0:_0x5cfb95[_0x3b18('0x1c')];var _0x3c0ff0=_0x9561ad?_0x3a8db8[_0x3b18('0x1d')]:_0x5cfb95[_0x3b18('0x1c')]+_0x5cfb95[_0x3b18('0x1a')];var _0x40c25c;if(_0x3c0ff0>=_0x513174){_0x3c0ff0=_0x513174;_0x40c25c=0xc8;}else{_0x40c25c=0xce;}_0x51cc20[_0x3b18('0x17')](_0x40c25c);return _0x51cc20['set'](_0x3b18('0x1e'),_0xc606db+'-'+_0x3c0ff0+'/'+_0x513174)[_0x3b18('0x19')](_0x3a8db8);}return null;};}function patchUpdates(_0x981193){return function(_0x5e8621){try{jsonpatch[_0x3b18('0x1f')](_0x5e8621,_0x981193,!![]);}catch(_0x38d8b6){return BPromise[_0x3b18('0x20')](_0x38d8b6);}return _0x5e8621[_0x3b18('0x21')]();};}function saveUpdates(_0x5f27bd,_0x3a4ac7){return function(_0x2c1683){if(_0x2c1683){return _0x2c1683[_0x3b18('0x22')](_0x5f27bd)['then'](function(_0x48ba9a){return _0x48ba9a;});}return null;};}function removeEntity(_0xc483a0,_0x285080){return function(_0x512f14){if(_0x512f14){return _0x512f14[_0x3b18('0x23')]()[_0x3b18('0x24')](function(){var _0x290bf3=_0x512f14[_0x3b18('0x25')]({'plain':!![]});var _0x127f5c=_0x3b18('0x26');return db[_0x3b18('0x27')][_0x3b18('0x23')]({'where':{'type':_0x127f5c,'resourceId':_0x290bf3['id']}})['then'](function(){return _0x512f14;});})[_0x3b18('0x24')](function(){_0xc483a0[_0x3b18('0x17')](0xcc)[_0x3b18('0x18')]();});}};}function handleEntityNotFound(_0xe267a2,_0x56026e){return function(_0x13edc1){if(!_0x13edc1){_0xe267a2[_0x3b18('0x16')](0x194);}return _0x13edc1;};}function handleError(_0x1c7d26,_0x2e5b76){_0x2e5b76=_0x2e5b76||0x1f4;return function(_0x46d5b9){logger[_0x3b18('0x28')](_0x46d5b9['stack']);if(_0x46d5b9[_0x3b18('0x29')]){delete _0x46d5b9[_0x3b18('0x29')];}_0x1c7d26[_0x3b18('0x17')](_0x2e5b76)[_0x3b18('0x2a')](_0x46d5b9);};}exports[_0x3b18('0x2b')]=function(_0x2239fa,_0x352e62){var _0x5afc4b={},_0x5dd8d7={},_0x351daf={'count':0x0,'rows':[]};var _0x2a315a=_['map'](db[_0x3b18('0x2c')][_0x3b18('0x2d')],function(_0x53f87b){return{'name':_0x53f87b[_0x3b18('0x2e')],'type':_0x53f87b[_0x3b18('0x2f')][_0x3b18('0x30')]};});_0x5dd8d7[_0x3b18('0x31')]=_[_0x3b18('0x32')](_0x2a315a,'name');_0x5dd8d7[_0x3b18('0x33')]=_[_0x3b18('0x34')](_0x2239fa[_0x3b18('0x33')]);_0x5dd8d7[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x5dd8d7[_0x3b18('0x31')],_0x5dd8d7[_0x3b18('0x33')]);_0x5afc4b[_0x3b18('0x37')]=_[_0x3b18('0x36')](_0x5dd8d7[_0x3b18('0x31')],qs[_0x3b18('0x38')](_0x2239fa['query'][_0x3b18('0x38')]));_0x5afc4b[_0x3b18('0x37')]=_0x5afc4b['attributes'][_0x3b18('0x39')]?_0x5afc4b[_0x3b18('0x37')]:_0x5dd8d7[_0x3b18('0x31')];if(!_0x2239fa[_0x3b18('0x33')][_0x3b18('0x3a')](_0x3b18('0x3b'))){_0x5afc4b['limit']=qs[_0x3b18('0x1a')](_0x2239fa[_0x3b18('0x33')][_0x3b18('0x1a')]);_0x5afc4b[_0x3b18('0x1c')]=qs['offset'](_0x2239fa[_0x3b18('0x33')][_0x3b18('0x1c')]);}_0x5afc4b[_0x3b18('0x3c')]=qs['sort'](_0x2239fa[_0x3b18('0x33')][_0x3b18('0x3d')]);_0x5afc4b[_0x3b18('0x3e')]=qs['filters'](_[_0x3b18('0x3f')](_0x2239fa['query'],_0x5dd8d7[_0x3b18('0x35')]),_0x2a315a);if(_0x2239fa[_0x3b18('0x33')][_0x3b18('0x40')]){_0x5afc4b[_0x3b18('0x3e')]=_['merge'](_0x5afc4b['where'],{'$or':_[_0x3b18('0x32')](_0x2a315a,function(_0x1ae1d3){if(_0x1ae1d3['type']!==_0x3b18('0x41')){var _0x2d11b3={};_0x2d11b3[_0x1ae1d3['name']]={'$like':'%'+_0x2239fa[_0x3b18('0x33')]['filter']+'%'};return _0x2d11b3;}})});}_0x5afc4b=_[_0x3b18('0x42')]({},_0x5afc4b,_0x2239fa[_0x3b18('0x43')]);var _0x1c4fd3={'where':_0x5afc4b[_0x3b18('0x3e')]};return db['Campaign'][_0x3b18('0x1d')](_0x1c4fd3)['then'](function(_0x4f88d1){_0x351daf['count']=_0x4f88d1;if(_0x2239fa[_0x3b18('0x33')]['includeAll']){_0x5afc4b['include']=[{'all':!![]}];}return db[_0x3b18('0x2c')][_0x3b18('0x44')](_0x5afc4b);})[_0x3b18('0x24')](function(_0x2332dd){_0x351daf[_0x3b18('0x45')]=_0x2332dd;return _0x351daf;})[_0x3b18('0x24')](respondWithFilteredResult(_0x352e62,_0x5afc4b))[_0x3b18('0x46')](handleError(_0x352e62,null));};exports['show']=function(_0x8d6ad5,_0x363c15){var _0x23c67b={'raw':![],'where':{'id':_0x8d6ad5[_0x3b18('0x47')]['id']}},_0x298d96={};_0x298d96[_0x3b18('0x31')]=_[_0x3b18('0x34')](db[_0x3b18('0x2c')][_0x3b18('0x2d')]);_0x298d96[_0x3b18('0x33')]=_[_0x3b18('0x34')](_0x8d6ad5[_0x3b18('0x33')]);_0x298d96[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x298d96['model'],_0x298d96[_0x3b18('0x33')]);_0x23c67b['attributes']=_['intersection'](_0x298d96[_0x3b18('0x31')],qs['fields'](_0x8d6ad5['query']['fields']));_0x23c67b[_0x3b18('0x37')]=_0x23c67b[_0x3b18('0x37')][_0x3b18('0x39')]?_0x23c67b[_0x3b18('0x37')]:_0x298d96[_0x3b18('0x31')];if(_0x8d6ad5[_0x3b18('0x33')][_0x3b18('0x48')]){_0x23c67b['include']=[{'all':!![]}];}_0x23c67b=_[_0x3b18('0x42')]({},_0x23c67b,_0x8d6ad5[_0x3b18('0x43')]);return db[_0x3b18('0x2c')][_0x3b18('0x49')](_0x23c67b)[_0x3b18('0x24')](handleEntityNotFound(_0x363c15,null))[_0x3b18('0x24')](respondWithResult(_0x363c15,null))[_0x3b18('0x46')](handleError(_0x363c15,null));};exports['create']=function(_0x418eb4,_0x49575a){return db[_0x3b18('0x2c')][_0x3b18('0x4a')](_0x418eb4[_0x3b18('0x4b')],{})[_0x3b18('0x24')](function(_0x43b2c5){var _0x47c6a6=_0x418eb4[_0x3b18('0x4c')][_0x3b18('0x25')]({'plain':!![]});if(!_0x47c6a6)throw new Error(_0x3b18('0x4d'));if(_0x47c6a6[_0x3b18('0x4e')]===_0x3b18('0x4c')){var _0x527996=_0x43b2c5[_0x3b18('0x25')]({'plain':!![]});var _0x376b55=_0x3b18('0x26');return db[_0x3b18('0x4f')][_0x3b18('0x49')]({'where':{'name':_0x376b55,'userProfileId':_0x47c6a6[_0x3b18('0x50')]},'raw':!![]})[_0x3b18('0x24')](function(_0x36c67e){if(_0x36c67e&&_0x36c67e[_0x3b18('0x51')]===0x0){return db[_0x3b18('0x27')]['create']({'name':_0x527996[_0x3b18('0x29')],'resourceId':_0x527996['id'],'type':_0x36c67e[_0x3b18('0x29')],'sectionId':_0x36c67e['id']},{})[_0x3b18('0x24')](function(){return _0x43b2c5;});}else{return _0x43b2c5;}})[_0x3b18('0x46')](function(_0x787cc9){logger['error'](_0x3b18('0x52'),_0x787cc9);throw _0x787cc9;});}return _0x43b2c5;})['then'](respondWithResult(_0x49575a,0xc9))['catch'](handleError(_0x49575a,null));};exports[_0x3b18('0x53')]=function(_0x2b941b,_0x321e88){var _0x4c889f={'where':{'id':_0x2b941b[_0x3b18('0x47')]['id']}},_0x2bbdce={};_0x2bbdce[_0x3b18('0x31')]=_['keys'](db[_0x3b18('0x2c')][_0x3b18('0x2d')]);_0x4c889f[_0x3b18('0x37')]=_[_0x3b18('0x36')](_0x2bbdce[_0x3b18('0x31')],qs['fields'](_0x2b941b[_0x3b18('0x33')]['fields']));_0x4c889f['attributes']=_0x4c889f[_0x3b18('0x37')]['length']?_0x4c889f[_0x3b18('0x37')]:_0x2bbdce[_0x3b18('0x31')];if(_0x2b941b[_0x3b18('0x33')][_0x3b18('0x48')]){_0x4c889f[_0x3b18('0x54')]=[{'all':!![]}];}_0x4c889f=_[_0x3b18('0x42')]({},_0x4c889f,_0x2b941b[_0x3b18('0x43')]);return db[_0x3b18('0x2c')]['find'](_0x4c889f)[_0x3b18('0x24')](handleEntityNotFound(_0x321e88,null))[_0x3b18('0x24')](function(_0x353ec){if(_0x353ec){var _0x12720a=_0x353ec[_0x3b18('0x25')]({'plain':!![]});_0x12720a=qs[_0x3b18('0x55')](_0x12720a,['id',_0x3b18('0x56'),_0x3b18('0x57')]);_0x2b941b[_0x3b18('0x4b')]=_[_0x3b18('0x55')](_0x2b941b[_0x3b18('0x4b')],['id',_0x3b18('0x56'),'updatedAt']);return db[_0x3b18('0x2c')][_0x3b18('0x4a')](_[_0x3b18('0x42')](_0x12720a,_0x2b941b[_0x3b18('0x4b')]),{'include':_0x2b941b['query'][_0x3b18('0x48')]?[{'all':!![]}]:undefined})[_0x3b18('0x24')](function(_0x566a8c){var _0x41c9f2=_0x2b941b[_0x3b18('0x4c')][_0x3b18('0x25')]({'plain':!![]});if(!_0x41c9f2)throw new Error(_0x3b18('0x4d'));if(_0x41c9f2['role']==='user'){var _0x1ec4c8=_0x566a8c['get']({'plain':!![]});var _0x5deb69=_0x3b18('0x26');return db['UserProfileSection'][_0x3b18('0x49')]({'where':{'name':_0x5deb69,'userProfileId':_0x41c9f2[_0x3b18('0x50')]},'raw':!![]})[_0x3b18('0x24')](function(_0x12bcd4){if(_0x12bcd4&&_0x12bcd4[_0x3b18('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ec4c8[_0x3b18('0x29')],'resourceId':_0x1ec4c8['id'],'type':_0x12bcd4['name'],'sectionId':_0x12bcd4['id']},{})['then'](function(){return _0x566a8c;});}else{return _0x566a8c;}})['catch'](function(_0x4a9357){logger[_0x3b18('0x28')](_0x3b18('0x52'),_0x4a9357);throw _0x4a9357;});}return _0x566a8c;});}})[_0x3b18('0x24')](respondWithResult(_0x321e88,0xc9))[_0x3b18('0x46')](handleError(_0x321e88,null));};exports[_0x3b18('0x22')]=function(_0x1ad259,_0x204b0c){if(_0x1ad259[_0x3b18('0x4b')]['id']){delete _0x1ad259['body']['id'];}return db[_0x3b18('0x2c')][_0x3b18('0x49')]({'where':{'id':_0x1ad259[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x204b0c,null))['then'](saveUpdates(_0x1ad259['body'],null))[_0x3b18('0x24')](respondWithResult(_0x204b0c,null))['catch'](handleError(_0x204b0c,null));};exports['destroy']=function(_0x7ad73,_0x37c92c){return db['Campaign'][_0x3b18('0x49')]({'where':{'id':_0x7ad73[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x37c92c,null))[_0x3b18('0x24')](removeEntity(_0x37c92c,null))[_0x3b18('0x46')](handleError(_0x37c92c,null));};exports[_0x3b18('0x58')]=function(_0x2bdd1a,_0x5b3372,_0x5b2efd){var _0x127943={'raw':!![],'where':{}};var _0x27a310={};var _0x2667fa={'count':0x0,'rows':[]};return db[_0x3b18('0x2c')][_0x3b18('0x59')]({'where':{'id':_0x2bdd1a['params']['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x5b3372,null))[_0x3b18('0x24')](function(_0x34c892){if(_0x34c892){_0x27a310[_0x3b18('0x31')]=_[_0x3b18('0x34')](db['CmHopper'][_0x3b18('0x2d')]);_0x27a310[_0x3b18('0x33')]=_[_0x3b18('0x34')](_0x2bdd1a[_0x3b18('0x33')]);_0x27a310[_0x3b18('0x35')]=_['intersection'](_0x27a310['model'],_0x27a310[_0x3b18('0x33')]);_0x127943['attributes']=_['intersection'](_0x27a310[_0x3b18('0x31')],qs[_0x3b18('0x38')](_0x2bdd1a[_0x3b18('0x33')]['fields']));_0x127943['attributes']=_0x127943[_0x3b18('0x37')][_0x3b18('0x39')]?_0x127943[_0x3b18('0x37')]:_0x27a310[_0x3b18('0x31')];if(!_0x2bdd1a['query'][_0x3b18('0x3a')](_0x3b18('0x3b'))){_0x127943[_0x3b18('0x1a')]=qs[_0x3b18('0x1a')](_0x2bdd1a[_0x3b18('0x33')][_0x3b18('0x1a')]);_0x127943[_0x3b18('0x1c')]=qs['offset'](_0x2bdd1a['query'][_0x3b18('0x1c')]);}_0x127943[_0x3b18('0x3c')]=qs[_0x3b18('0x3d')](_0x2bdd1a[_0x3b18('0x33')]['sort']);_0x127943['where']=qs['filters'](_['pick'](_0x2bdd1a[_0x3b18('0x33')],_0x27a310[_0x3b18('0x35')]));_0x127943['where'][_0x3b18('0x5a')]=_0x34c892['id'];if(_0x2bdd1a[_0x3b18('0x33')]['filter']){_0x127943[_0x3b18('0x3e')]=_['merge'](_0x127943[_0x3b18('0x3e')],{'$or':_[_0x3b18('0x32')](_0x127943['attributes'],function(_0x740669){var _0x2a7a60={};_0x2a7a60[_0x740669]={'$like':'%'+_0x2bdd1a[_0x3b18('0x33')][_0x3b18('0x40')]+'%'};return _0x2a7a60;})});}_0x127943=_[_0x3b18('0x42')]({},_0x127943,_0x2bdd1a[_0x3b18('0x43')]);return db[_0x3b18('0x5b')][_0x3b18('0x1d')]({'where':_0x127943['where']})['then'](function(_0x4e700f){_0x2667fa[_0x3b18('0x1d')]=_0x4e700f;if(_0x2bdd1a[_0x3b18('0x33')][_0x3b18('0x48')]){_0x127943['include']=[{'all':!![]}];}return db[_0x3b18('0x5b')]['findAll'](_0x127943);})[_0x3b18('0x24')](function(_0x103b92){_0x2667fa[_0x3b18('0x45')]=_0x103b92;return _0x2667fa;});}})[_0x3b18('0x24')](respondWithFilteredResult(_0x5b3372,_0x127943))[_0x3b18('0x46')](handleError(_0x5b3372,null));};exports[_0x3b18('0x5c')]=function(_0x1780a8,_0xfc62f3,_0xd5277c){var _0x607764={'raw':!![],'where':{}};var _0x444ce1={};var _0x208b1d={'count':0x0,'rows':[]};return db['Campaign'][_0x3b18('0x59')]({'where':{'id':_0x1780a8[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0xfc62f3,null))[_0x3b18('0x24')](function(_0x22a25e){if(_0x22a25e){_0x444ce1[_0x3b18('0x31')]=_[_0x3b18('0x34')](db[_0x3b18('0x5d')][_0x3b18('0x2d')]);_0x444ce1['query']=_[_0x3b18('0x34')](_0x1780a8[_0x3b18('0x33')]);_0x444ce1[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x444ce1[_0x3b18('0x31')],_0x444ce1[_0x3b18('0x33')]);_0x607764['attributes']=_[_0x3b18('0x36')](_0x444ce1[_0x3b18('0x31')],qs[_0x3b18('0x38')](_0x1780a8[_0x3b18('0x33')][_0x3b18('0x38')]));_0x607764[_0x3b18('0x37')]=_0x607764[_0x3b18('0x37')][_0x3b18('0x39')]?_0x607764[_0x3b18('0x37')]:_0x444ce1[_0x3b18('0x31')];if(!_0x1780a8[_0x3b18('0x33')][_0x3b18('0x3a')](_0x3b18('0x3b'))){_0x607764[_0x3b18('0x1a')]=qs[_0x3b18('0x1a')](_0x1780a8[_0x3b18('0x33')][_0x3b18('0x1a')]);_0x607764[_0x3b18('0x1c')]=qs['offset'](_0x1780a8[_0x3b18('0x33')][_0x3b18('0x1c')]);}_0x607764[_0x3b18('0x3c')]=qs['sort'](_0x1780a8[_0x3b18('0x33')]['sort']);_0x607764[_0x3b18('0x3e')]=qs[_0x3b18('0x35')](_[_0x3b18('0x3f')](_0x1780a8[_0x3b18('0x33')],_0x444ce1['filters']));_0x607764[_0x3b18('0x3e')][_0x3b18('0x5a')]=_0x22a25e['id'];if(_0x1780a8[_0x3b18('0x33')]['filter']){_0x607764[_0x3b18('0x3e')]=_[_0x3b18('0x42')](_0x607764[_0x3b18('0x3e')],{'$or':_[_0x3b18('0x32')](_0x607764[_0x3b18('0x37')],function(_0x5d28c3){var _0x3a639a={};_0x3a639a[_0x5d28c3]={'$like':'%'+_0x1780a8['query'][_0x3b18('0x40')]+'%'};return _0x3a639a;})});}_0x607764=_[_0x3b18('0x42')]({},_0x607764,_0x1780a8['options']);return db[_0x3b18('0x5d')]['count']({'where':_0x607764[_0x3b18('0x3e')]})[_0x3b18('0x24')](function(_0x15b438){_0x208b1d[_0x3b18('0x1d')]=_0x15b438;if(_0x1780a8[_0x3b18('0x33')][_0x3b18('0x48')]){_0x607764['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3b18('0x44')](_0x607764);})[_0x3b18('0x24')](function(_0x2ab9fb){_0x208b1d[_0x3b18('0x45')]=_0x2ab9fb;return _0x208b1d;});}})[_0x3b18('0x24')](respondWithFilteredResult(_0xfc62f3,_0x607764))[_0x3b18('0x46')](handleError(_0xfc62f3,null));};exports['getHopperFinals']=function(_0x406958,_0x132bbb,_0x285441){var _0x43cf83={'raw':!![],'where':{}};var _0x385a4d={};var _0x4cd81e={'count':0x0,'rows':[]};return db['Campaign'][_0x3b18('0x59')]({'where':{'id':_0x406958[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x132bbb,null))[_0x3b18('0x24')](function(_0xbb758f){if(_0xbb758f){_0x385a4d[_0x3b18('0x31')]=_[_0x3b18('0x34')](db[_0x3b18('0x5e')][_0x3b18('0x2d')]);_0x385a4d[_0x3b18('0x33')]=_[_0x3b18('0x34')](_0x406958[_0x3b18('0x33')]);_0x385a4d[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x385a4d[_0x3b18('0x31')],_0x385a4d[_0x3b18('0x33')]);_0x43cf83[_0x3b18('0x37')]=_[_0x3b18('0x36')](_0x385a4d['model'],qs[_0x3b18('0x38')](_0x406958[_0x3b18('0x33')][_0x3b18('0x38')]));_0x43cf83['attributes']=_0x43cf83[_0x3b18('0x37')][_0x3b18('0x39')]?_0x43cf83[_0x3b18('0x37')]:_0x385a4d[_0x3b18('0x31')];if(!_0x406958[_0x3b18('0x33')][_0x3b18('0x3a')]('nolimit')){_0x43cf83[_0x3b18('0x1a')]=qs[_0x3b18('0x1a')](_0x406958[_0x3b18('0x33')][_0x3b18('0x1a')]);_0x43cf83[_0x3b18('0x1c')]=qs['offset'](_0x406958['query'][_0x3b18('0x1c')]);}_0x43cf83['order']=qs[_0x3b18('0x3d')](_0x406958[_0x3b18('0x33')]['sort']);_0x43cf83['where']=qs[_0x3b18('0x35')](_[_0x3b18('0x3f')](_0x406958[_0x3b18('0x33')],_0x385a4d[_0x3b18('0x35')]));_0x43cf83[_0x3b18('0x3e')]['CampaignId']=_0xbb758f['id'];if(_0x406958[_0x3b18('0x33')][_0x3b18('0x40')]){_0x43cf83['where']=_['merge'](_0x43cf83[_0x3b18('0x3e')],{'$or':_[_0x3b18('0x32')](_0x43cf83['attributes'],function(_0xacfeb9){var _0x1a750d={};_0x1a750d[_0xacfeb9]={'$like':'%'+_0x406958['query']['filter']+'%'};return _0x1a750d;})});}_0x43cf83=_[_0x3b18('0x42')]({},_0x43cf83,_0x406958[_0x3b18('0x43')]);return db[_0x3b18('0x5e')]['count']({'where':_0x43cf83[_0x3b18('0x3e')]})[_0x3b18('0x24')](function(_0x1b7556){_0x4cd81e[_0x3b18('0x1d')]=_0x1b7556;if(_0x406958[_0x3b18('0x33')][_0x3b18('0x48')]){_0x43cf83[_0x3b18('0x54')]=[{'all':!![]}];}return db[_0x3b18('0x5e')][_0x3b18('0x44')](_0x43cf83);})[_0x3b18('0x24')](function(_0x4e879e){_0x4cd81e['rows']=_0x4e879e;return _0x4cd81e;});}})[_0x3b18('0x24')](respondWithFilteredResult(_0x132bbb,_0x43cf83))[_0x3b18('0x46')](handleError(_0x132bbb,null));};exports['getHopperBlacks']=function(_0x20dbe9,_0x4a6b9c,_0x44125c){var _0x819683={'raw':!![],'where':{}};var _0x4fcd68={};var _0x5e19a5={'count':0x0,'rows':[]};return db[_0x3b18('0x2c')][_0x3b18('0x59')]({'where':{'id':_0x20dbe9[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x4a6b9c,null))['then'](function(_0x58d398){if(_0x58d398){_0x4fcd68['model']=_[_0x3b18('0x34')](db[_0x3b18('0x5f')]['rawAttributes']);_0x4fcd68[_0x3b18('0x33')]=_['keys'](_0x20dbe9[_0x3b18('0x33')]);_0x4fcd68[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x4fcd68['model'],_0x4fcd68[_0x3b18('0x33')]);_0x819683[_0x3b18('0x37')]=_[_0x3b18('0x36')](_0x4fcd68[_0x3b18('0x31')],qs['fields'](_0x20dbe9[_0x3b18('0x33')][_0x3b18('0x38')]));_0x819683['attributes']=_0x819683[_0x3b18('0x37')]['length']?_0x819683[_0x3b18('0x37')]:_0x4fcd68[_0x3b18('0x31')];if(!_0x20dbe9[_0x3b18('0x33')]['hasOwnProperty'](_0x3b18('0x3b'))){_0x819683[_0x3b18('0x1a')]=qs[_0x3b18('0x1a')](_0x20dbe9[_0x3b18('0x33')][_0x3b18('0x1a')]);_0x819683[_0x3b18('0x1c')]=qs['offset'](_0x20dbe9[_0x3b18('0x33')]['offset']);}_0x819683[_0x3b18('0x3c')]=qs[_0x3b18('0x3d')](_0x20dbe9[_0x3b18('0x33')]['sort']);_0x819683[_0x3b18('0x3e')]=qs[_0x3b18('0x35')](_[_0x3b18('0x3f')](_0x20dbe9['query'],_0x4fcd68[_0x3b18('0x35')]));_0x819683[_0x3b18('0x3e')]['CampaignId']=_0x58d398['id'];if(_0x20dbe9[_0x3b18('0x33')][_0x3b18('0x40')]){_0x819683[_0x3b18('0x3e')]=_[_0x3b18('0x42')](_0x819683[_0x3b18('0x3e')],{'$or':_[_0x3b18('0x32')](_0x819683[_0x3b18('0x37')],function(_0x577154){var _0x27f4cb={};_0x27f4cb[_0x577154]={'$like':'%'+_0x20dbe9[_0x3b18('0x33')]['filter']+'%'};return _0x27f4cb;})});}_0x819683=_[_0x3b18('0x42')]({},_0x819683,_0x20dbe9[_0x3b18('0x43')]);return db[_0x3b18('0x5f')][_0x3b18('0x1d')]({'where':_0x819683[_0x3b18('0x3e')]})['then'](function(_0x40d699){_0x5e19a5[_0x3b18('0x1d')]=_0x40d699;if(_0x20dbe9[_0x3b18('0x33')][_0x3b18('0x48')]){_0x819683['include']=[{'all':!![]}];}return db[_0x3b18('0x5f')]['findAll'](_0x819683);})[_0x3b18('0x24')](function(_0x5ab952){_0x5e19a5['rows']=_0x5ab952;return _0x5e19a5;});}})[_0x3b18('0x24')](respondWithFilteredResult(_0x4a6b9c,_0x819683))[_0x3b18('0x46')](handleError(_0x4a6b9c,null));};exports[_0x3b18('0x60')]=function(_0x1acd64,_0x25a799,_0x59b69f){var _0x2881e1={};var _0x298147={};var _0xf630bd;var _0x2f5f78;return db[_0x3b18('0x2c')][_0x3b18('0x59')]({'where':{'id':_0x1acd64[_0x3b18('0x47')]['id']}})['then'](handleEntityNotFound(_0x25a799,null))['then'](function(_0xb79e65){if(_0xb79e65){_0xf630bd=_0xb79e65;_0x298147[_0x3b18('0x31')]=_['keys'](db['CmList'][_0x3b18('0x2d')]);_0x298147[_0x3b18('0x33')]=_[_0x3b18('0x34')](_0x1acd64[_0x3b18('0x33')]);_0x298147['filters']=_[_0x3b18('0x36')](_0x298147['model'],_0x298147['query']);_0x2881e1['attributes']=_[_0x3b18('0x36')](_0x298147['model'],qs[_0x3b18('0x38')](_0x1acd64['query'][_0x3b18('0x38')]));_0x2881e1[_0x3b18('0x37')]=_0x2881e1[_0x3b18('0x37')][_0x3b18('0x39')]?_0x2881e1[_0x3b18('0x37')]:_0x298147['model'];_0x2881e1['order']=qs[_0x3b18('0x3d')](_0x1acd64[_0x3b18('0x33')][_0x3b18('0x3d')]);_0x2881e1[_0x3b18('0x3e')]=qs[_0x3b18('0x35')](_[_0x3b18('0x3f')](_0x1acd64[_0x3b18('0x33')],_0x298147[_0x3b18('0x35')]));if(_0x1acd64['query'][_0x3b18('0x40')]){_0x2881e1['where']=_[_0x3b18('0x42')](_0x2881e1[_0x3b18('0x3e')],{'$or':_[_0x3b18('0x32')](_0x2881e1['attributes'],function(_0x5a4ab3){var _0x39ab89={};_0x39ab89[_0x5a4ab3]={'$like':'%'+_0x1acd64[_0x3b18('0x33')][_0x3b18('0x40')]+'%'};return _0x39ab89;})});}_0x2881e1=_[_0x3b18('0x42')]({},_0x2881e1,_0x1acd64[_0x3b18('0x43')]);return _0xf630bd[_0x3b18('0x60')](_0x2881e1);}})[_0x3b18('0x24')](function(_0x427f71){if(_0x427f71){_0x2f5f78=_0x427f71['length'];if(!_0x1acd64[_0x3b18('0x33')][_0x3b18('0x3a')](_0x3b18('0x3b'))){_0x2881e1[_0x3b18('0x1a')]=qs[_0x3b18('0x1a')](_0x1acd64[_0x3b18('0x33')][_0x3b18('0x1a')]);_0x2881e1[_0x3b18('0x1c')]=qs[_0x3b18('0x1c')](_0x1acd64['query'][_0x3b18('0x1c')]);}return _0xf630bd[_0x3b18('0x60')](_0x2881e1);}})[_0x3b18('0x24')](function(_0x5c0a27){if(_0x5c0a27){return _0x5c0a27?{'count':_0x2f5f78,'rows':_0x5c0a27}:null;}})['then'](respondWithResult(_0x25a799,null))[_0x3b18('0x46')](handleError(_0x25a799,null));};exports[_0x3b18('0x61')]=function(_0x21ea1d,_0x1fd4a2,_0x3abead){var _0x1fef4a,_0x5523f1;return db[_0x3b18('0x2c')][_0x3b18('0x49')]({'where':{'id':_0x21ea1d[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x1fd4a2,null))[_0x3b18('0x24')](function(_0x46fdd4){if(_0x46fdd4){_0x5523f1=_0x46fdd4;return _0x46fdd4['addLists'](_0x21ea1d['body']['ids'],_['omit'](_0x21ea1d[_0x3b18('0x4b')],['ids','id'])||{});}return null;})[_0x3b18('0x62')](function(_0x25e4ca){var _0x5b4579;_0x1fef4a=_0x25e4ca||[];var _0x5eedfa=[];if(_0x25e4ca){for(var _0x3ba2db=0x0;_0x3ba2db<_0x25e4ca[_0x3b18('0x39')];_0x3ba2db+=0x1){var _0x359682=_0x25e4ca[_0x3ba2db]['get']({'plain':!![]});_0x5523f1['dialCheckDuplicateType']=_0x21ea1d[_0x3b18('0x4b')][_0x3b18('0x63')]?_0x21ea1d[_0x3b18('0x4b')][_0x3b18('0x63')]:_0x5523f1[_0x3b18('0x63')];switch(_0x5523f1[_0x3b18('0x63')]){case _0x3b18('0x64'):_0x5b4579=squel[_0x3b18('0x65')]()['into'](_0x3b18('0x66'))[_0x3b18('0x67')](['phone',_0x3b18('0x68'),_0x3b18('0x69'),_0x3b18('0x6a'),_0x3b18('0x5a'),_0x3b18('0x56'),_0x3b18('0x57')],squel[_0x3b18('0x6b')]()['field'](_0x3b18('0x6c'),_0x3b18('0x6c'))[_0x3b18('0x6d')]('NOW()',_0x3b18('0x68'))[_0x3b18('0x6d')]('id',_0x3b18('0x69'))[_0x3b18('0x6d')](_0x359682[_0x3b18('0x6e')][_0x3b18('0x6f')](),_0x3b18('0x6a'))[_0x3b18('0x6d')](_0x21ea1d[_0x3b18('0x47')]['id']['toString'](),'CampaignId')[_0x3b18('0x6d')](_0x3b18('0x70'),_0x3b18('0x56'))['field'](_0x3b18('0x70'),_0x3b18('0x57'))[_0x3b18('0x71')]('cm_contacts')[_0x3b18('0x3e')](_0x3b18('0x72'))['where'](_0x3b18('0x73'),_0x359682[_0x3b18('0x6e')]['toString']())[_0x3b18('0x3e')](_0x3b18('0x74'))[_0x3b18('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3b18('0x6b')]()[_0x3b18('0x6d')](_0x3b18('0x75'))['from'](_0x3b18('0x76'))[_0x3b18('0x3e')](_0x3b18('0x77'),_0x21ea1d[_0x3b18('0x47')]['id']['toString']()))[_0x3b18('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x3b18('0x71')](_0x3b18('0x66'))['where'](_0x3b18('0x77'),_0x21ea1d[_0x3b18('0x47')]['id'][_0x3b18('0x6f')]())))[_0x3b18('0x6f')]();break;case'onlyIfOpen':_0x5b4579=squel[_0x3b18('0x65')]()['into']('cm_hopper')[_0x3b18('0x67')]([_0x3b18('0x6c'),_0x3b18('0x68'),_0x3b18('0x69'),'ListId',_0x3b18('0x5a'),_0x3b18('0x56'),_0x3b18('0x57')],squel[_0x3b18('0x6b')]()['field']('phone',_0x3b18('0x6c'))['field'](_0x3b18('0x70'),_0x3b18('0x68'))[_0x3b18('0x6d')]('id',_0x3b18('0x69'))[_0x3b18('0x6d')](_0x359682['CmListId'][_0x3b18('0x6f')](),_0x3b18('0x6a'))[_0x3b18('0x6d')](_0x21ea1d[_0x3b18('0x47')]['id'][_0x3b18('0x6f')](),'CampaignId')['field'](_0x3b18('0x70'),_0x3b18('0x56'))[_0x3b18('0x6d')](_0x3b18('0x70'),_0x3b18('0x57'))['from'](_0x3b18('0x78'))['where']('deletedAt\x20IS\x20NULL')[_0x3b18('0x3e')](_0x3b18('0x73'),_0x359682[_0x3b18('0x6e')][_0x3b18('0x6f')]())[_0x3b18('0x3e')](_0x3b18('0x74'))[_0x3b18('0x3e')](_0x3b18('0x79'),squel[_0x3b18('0x6b')]()[_0x3b18('0x6d')]('COALESCE(phone,\x27\x27)')['from'](_0x3b18('0x66'))['where'](_0x3b18('0x77'),_0x21ea1d[_0x3b18('0x47')]['id'][_0x3b18('0x6f')]())))[_0x3b18('0x6f')]();break;default:_0x5b4579=squel[_0x3b18('0x65')]()['into'](_0x3b18('0x66'))[_0x3b18('0x67')](['phone',_0x3b18('0x68'),_0x3b18('0x69'),_0x3b18('0x6a'),_0x3b18('0x5a'),'createdAt',_0x3b18('0x57')],squel[_0x3b18('0x6b')]()['field']('phone',_0x3b18('0x6c'))[_0x3b18('0x6d')](_0x3b18('0x70'),'scheduledAt')[_0x3b18('0x6d')]('id',_0x3b18('0x69'))[_0x3b18('0x6d')](_0x359682[_0x3b18('0x6e')]['toString'](),_0x3b18('0x6a'))['field'](_0x21ea1d[_0x3b18('0x47')]['id'][_0x3b18('0x6f')](),_0x3b18('0x5a'))[_0x3b18('0x6d')]('NOW()','createdAt')['field']('NOW()','updatedAt')[_0x3b18('0x71')]('cm_contacts')[_0x3b18('0x3e')]('deletedAt\x20IS\x20NULL')[_0x3b18('0x3e')]('ListId\x20=\x20?',_0x359682[_0x3b18('0x6e')][_0x3b18('0x6f')]())[_0x3b18('0x3e')](_0x3b18('0x74')))[_0x3b18('0x6f')]();}_0x5eedfa[_0x3b18('0x7a')](db[_0x3b18('0x7b')][_0x3b18('0x33')](_0x5b4579));}return BPromise[_0x3b18('0x7c')](_0x5eedfa);}})[_0x3b18('0x24')](function(){return _0x1fef4a;})['then'](respondWithResult(_0x1fd4a2,null))[_0x3b18('0x46')](handleError(_0x1fd4a2,null));};exports[_0x3b18('0x7d')]=function(_0x32c801,_0x214187,_0x2bf2e9){return db[_0x3b18('0x2c')][_0x3b18('0x49')]({'where':{'id':_0x32c801[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x214187,null))[_0x3b18('0x24')](function(_0x58b267){if(_0x58b267){return _0x58b267[_0x3b18('0x7d')](_0x32c801[_0x3b18('0x33')][_0x3b18('0x7e')]);}})[_0x3b18('0x24')](function(_0x486346){if(_0x486346){return db[_0x3b18('0x5b')][_0x3b18('0x23')]({'where':{'ListId':_0x32c801[_0x3b18('0x33')]['ids'],'CampaignId':_0x32c801[_0x3b18('0x47')]['id']}})['then'](function(){return _0x486346;});}})[_0x3b18('0x24')](respondWithStatusCode(_0x214187,null))['catch'](handleError(_0x214187,null));};exports[_0x3b18('0x7f')]=function(_0x57e383,_0x5122f5,_0xa9de9d){var _0x38d830={};var _0x4120d9={};var _0x4c7173;var _0x528e0c;return db['Campaign'][_0x3b18('0x59')]({'where':{'id':_0x57e383[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x5122f5,null))[_0x3b18('0x24')](function(_0x39148b){if(_0x39148b){_0x4c7173=_0x39148b;_0x4120d9[_0x3b18('0x31')]=_[_0x3b18('0x34')](db[_0x3b18('0x80')][_0x3b18('0x2d')]);_0x4120d9[_0x3b18('0x33')]=_['keys'](_0x57e383['query']);_0x4120d9[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x4120d9[_0x3b18('0x31')],_0x4120d9['query']);_0x38d830[_0x3b18('0x37')]=_['intersection'](_0x4120d9['model'],qs['fields'](_0x57e383[_0x3b18('0x33')][_0x3b18('0x38')]));_0x38d830[_0x3b18('0x37')]=_0x38d830['attributes'][_0x3b18('0x39')]?_0x38d830[_0x3b18('0x37')]:_0x4120d9[_0x3b18('0x31')];_0x38d830['order']=qs['sort'](_0x57e383[_0x3b18('0x33')]['sort']);_0x38d830[_0x3b18('0x3e')]=qs[_0x3b18('0x35')](_[_0x3b18('0x3f')](_0x57e383[_0x3b18('0x33')],_0x4120d9[_0x3b18('0x35')]));if(_0x57e383[_0x3b18('0x33')]['filter']){_0x38d830[_0x3b18('0x3e')]=_[_0x3b18('0x42')](_0x38d830[_0x3b18('0x3e')],{'$or':_['map'](_0x38d830[_0x3b18('0x37')],function(_0xfc9528){var _0x72b0c0={};_0x72b0c0[_0xfc9528]={'$like':'%'+_0x57e383['query']['filter']+'%'};return _0x72b0c0;})});}_0x38d830=_[_0x3b18('0x42')]({},_0x38d830,_0x57e383[_0x3b18('0x43')]);return _0x4c7173[_0x3b18('0x7f')](_0x38d830);}})[_0x3b18('0x24')](function(_0x14ede9){if(_0x14ede9){_0x528e0c=_0x14ede9['length'];if(!_0x57e383[_0x3b18('0x33')][_0x3b18('0x3a')]('nolimit')){_0x38d830[_0x3b18('0x1a')]=qs[_0x3b18('0x1a')](_0x57e383['query']['limit']);_0x38d830[_0x3b18('0x1c')]=qs[_0x3b18('0x1c')](_0x57e383[_0x3b18('0x33')][_0x3b18('0x1c')]);}return _0x4c7173['getBlackLists'](_0x38d830);}})['then'](function(_0x19052f){if(_0x19052f){return _0x19052f?{'count':_0x528e0c,'rows':_0x19052f}:null;}})[_0x3b18('0x24')](respondWithResult(_0x5122f5,null))[_0x3b18('0x46')](handleError(_0x5122f5,null));};exports[_0x3b18('0x81')]=function(_0x4d06ce,_0x1d5ac3,_0x5342a7){var _0x221476,_0x3c006f;return db[_0x3b18('0x2c')]['find']({'where':{'id':_0x4d06ce[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x1d5ac3,null))[_0x3b18('0x24')](function(_0x6cf87e){if(_0x6cf87e){_0x3c006f=_0x6cf87e;return _0x6cf87e[_0x3b18('0x81')](_0x4d06ce[_0x3b18('0x4b')]['ids'],_['omit'](_0x4d06ce[_0x3b18('0x4b')],['ids','id'])||{});}return null;})[_0x3b18('0x62')](function(_0x3be783){var _0x5c71f1;_0x221476=_0x3be783||[];var _0x162bb7=[];if(_0x3be783){for(var _0x1d0b65=0x0;_0x1d0b65<_0x3be783['length'];_0x1d0b65+=0x1){var _0x2170b8=_0x3be783[_0x1d0b65]['get']({'plain':!![]});_0x5c71f1=squel['insert']()[_0x3b18('0x82')](_0x3b18('0x83'))[_0x3b18('0x67')]([_0x3b18('0x6c'),'ContactId',_0x3b18('0x6a'),_0x3b18('0x5a'),'createdAt',_0x3b18('0x57')],squel[_0x3b18('0x6b')]()[_0x3b18('0x6d')](_0x3b18('0x6c'),_0x3b18('0x6c'))[_0x3b18('0x6d')]('id',_0x3b18('0x69'))[_0x3b18('0x6d')](_0x2170b8['CmListId'][_0x3b18('0x6f')](),_0x3b18('0x6a'))[_0x3b18('0x6d')](_0x4d06ce[_0x3b18('0x47')]['id'][_0x3b18('0x6f')](),_0x3b18('0x5a'))[_0x3b18('0x6d')](_0x3b18('0x70'),_0x3b18('0x56'))[_0x3b18('0x6d')](_0x3b18('0x70'),_0x3b18('0x57'))[_0x3b18('0x71')](_0x3b18('0x78'))['where'](_0x3b18('0x72'))[_0x3b18('0x3e')](_0x3b18('0x73'),_0x2170b8[_0x3b18('0x6e')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3b18('0x6f')]();_0x162bb7[_0x3b18('0x7a')](db['sequelize'][_0x3b18('0x33')](_0x5c71f1));}return BPromise[_0x3b18('0x7c')](_0x162bb7);}})[_0x3b18('0x24')](function(){return _0x221476;})[_0x3b18('0x24')](respondWithResult(_0x1d5ac3,null))[_0x3b18('0x46')](handleError(_0x1d5ac3,null));};exports[_0x3b18('0x84')]=function(_0x5eaae2,_0x2adf8c,_0x377353){return db[_0x3b18('0x2c')][_0x3b18('0x49')]({'where':{'id':_0x5eaae2['params']['id']}})[_0x3b18('0x24')](handleEntityNotFound(_0x2adf8c,null))[_0x3b18('0x24')](function(_0x39d690){if(_0x39d690){return _0x39d690[_0x3b18('0x84')](_0x5eaae2[_0x3b18('0x33')][_0x3b18('0x7e')]);}})['then'](function(_0x46d2ce){if(_0x46d2ce){return db[_0x3b18('0x5f')][_0x3b18('0x23')]({'where':{'ListId':_0x5eaae2[_0x3b18('0x33')][_0x3b18('0x7e')],'CampaignId':_0x5eaae2[_0x3b18('0x47')]['id']}})[_0x3b18('0x24')](function(){return _0x46d2ce;});}})[_0x3b18('0x24')](respondWithStatusCode(_0x2adf8c,null))['catch'](handleError(_0x2adf8c,null));}; \ No newline at end of file +var _0x562b=['then','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','Campaign','count','includeAll','findAll','rows','catch','rawAttributes','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','role','userProfileId','getHoppers','CmHopper','hasOwnProperty','order','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','select','field','NOW()','CmListId','toString','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','push','sequelize','all','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','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','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','IvrCampaigns','UserProfileResource','destroy'];(function(_0x21da2b,_0x5915af){var _0x3c9e3c=function(_0x1d7cb6){while(--_0x1d7cb6){_0x21da2b['push'](_0x21da2b['shift']());}};_0x3c9e3c(++_0x5915af);}(_0x562b,0x177));var _0xb562=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x562b[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xb562('0x0'));var rimraf=require(_0xb562('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb562('0x2'));var rp=require(_0xb562('0x3'));var moment=require(_0xb562('0x4'));var BPromise=require(_0xb562('0x5'));var Mustache=require('mustache');var util=require(_0xb562('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb562('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb562('0x8'));var _=require(_0xb562('0x9'));var squel=require(_0xb562('0xa'));var crypto=require('crypto');var jsforce=require(_0xb562('0xb'));var deskjs=require(_0xb562('0xc'));var toCsv=require(_0xb562('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb562('0xd'));var authService=require(_0xb562('0xe'));var qs=require(_0xb562('0xf'));var as=require(_0xb562('0x10'));var hardwareService=require(_0xb562('0x11'));var logger=require(_0xb562('0x12'))('api');var utils=require(_0xb562('0x13'));var config=require(_0xb562('0x14'));var licenseUtil=require(_0xb562('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e07fc,_0x39a38b){_0x39a38b=_0x39a38b||0xcc;return function(_0x1e2817){if(_0x1e2817){return _0x4e07fc['sendStatus'](_0x39a38b);}return _0x4e07fc[_0xb562('0x16')](_0x39a38b)['end']();};}function respondWithResult(_0x5c04a9,_0x555653){_0x555653=_0x555653||0xc8;return function(_0x39a2a2){if(_0x39a2a2){return _0x5c04a9[_0xb562('0x16')](_0x555653)[_0xb562('0x17')](_0x39a2a2);}};}function respondWithFilteredResult(_0x39cf7e,_0x30b5a6){return function(_0x235014){if(_0x235014){var _0x4e816e=typeof _0x30b5a6[_0xb562('0x18')]==='undefined'&&typeof _0x30b5a6[_0xb562('0x19')]===_0xb562('0x1a');var _0x44c79a=_0x235014['count'];var _0x508e4e=_0x4e816e?0x0:_0x30b5a6[_0xb562('0x18')];var _0x1c7fd3=_0x4e816e?_0x235014['count']:_0x30b5a6[_0xb562('0x18')]+_0x30b5a6[_0xb562('0x19')];var _0x51868e;if(_0x1c7fd3>=_0x44c79a){_0x1c7fd3=_0x44c79a;_0x51868e=0xc8;}else{_0x51868e=0xce;}_0x39cf7e[_0xb562('0x16')](_0x51868e);return _0x39cf7e[_0xb562('0x1b')](_0xb562('0x1c'),_0x508e4e+'-'+_0x1c7fd3+'/'+_0x44c79a)[_0xb562('0x17')](_0x235014);}return null;};}function patchUpdates(_0x4395ec){return function(_0x23f74c){try{jsonpatch[_0xb562('0x1d')](_0x23f74c,_0x4395ec,!![]);}catch(_0x54c688){return BPromise[_0xb562('0x1e')](_0x54c688);}return _0x23f74c[_0xb562('0x1f')]();};}function saveUpdates(_0x47bdfa,_0x12fc8e){return function(_0x485d69){if(_0x485d69){return _0x485d69[_0xb562('0x20')](_0x47bdfa)['then'](function(_0x593a56){return _0x593a56;});}return null;};}function removeEntity(_0x209e6a,_0x2307d9){return function(_0x4f090d){if(_0x4f090d){return _0x4f090d['destroy']()['then'](function(){var _0x28a52e=_0x4f090d['get']({'plain':!![]});var _0x1eb35a=_0xb562('0x21');return db[_0xb562('0x22')][_0xb562('0x23')]({'where':{'type':_0x1eb35a,'resourceId':_0x28a52e['id']}})[_0xb562('0x24')](function(){return _0x4f090d;});})[_0xb562('0x24')](function(){_0x209e6a[_0xb562('0x16')](0xcc)[_0xb562('0x25')]();});}};}function handleEntityNotFound(_0x4c644b,_0x143e42){return function(_0x217089){if(!_0x217089){_0x4c644b[_0xb562('0x26')](0x194);}return _0x217089;};}function handleError(_0x1537f0,_0x14604d){_0x14604d=_0x14604d||0x1f4;return function(_0x45aad6){logger['error'](_0x45aad6[_0xb562('0x27')]);if(_0x45aad6[_0xb562('0x28')]){delete _0x45aad6[_0xb562('0x28')];}_0x1537f0[_0xb562('0x16')](_0x14604d)[_0xb562('0x29')](_0x45aad6);};}exports[_0xb562('0x2a')]=function(_0x59e978,_0x2612c0){var _0x3b8c58={},_0xa16eb9={},_0x2d3e63={'count':0x0,'rows':[]};var _0x7b95ae=_[_0xb562('0x2b')](db['Campaign']['rawAttributes'],function(_0x17a826){return{'name':_0x17a826[_0xb562('0x2c')],'type':_0x17a826[_0xb562('0x2d')][_0xb562('0x2e')]};});_0xa16eb9[_0xb562('0x2f')]=_[_0xb562('0x2b')](_0x7b95ae,_0xb562('0x28'));_0xa16eb9[_0xb562('0x30')]=_[_0xb562('0x31')](_0x59e978['query']);_0xa16eb9['filters']=_[_0xb562('0x32')](_0xa16eb9['model'],_0xa16eb9[_0xb562('0x30')]);_0x3b8c58[_0xb562('0x33')]=_['intersection'](_0xa16eb9[_0xb562('0x2f')],qs[_0xb562('0x34')](_0x59e978[_0xb562('0x30')][_0xb562('0x34')]));_0x3b8c58[_0xb562('0x33')]=_0x3b8c58[_0xb562('0x33')][_0xb562('0x35')]?_0x3b8c58[_0xb562('0x33')]:_0xa16eb9[_0xb562('0x2f')];if(!_0x59e978[_0xb562('0x30')]['hasOwnProperty'](_0xb562('0x36'))){_0x3b8c58['limit']=qs[_0xb562('0x19')](_0x59e978[_0xb562('0x30')]['limit']);_0x3b8c58[_0xb562('0x18')]=qs[_0xb562('0x18')](_0x59e978['query'][_0xb562('0x18')]);}_0x3b8c58['order']=qs['sort'](_0x59e978[_0xb562('0x30')][_0xb562('0x37')]);_0x3b8c58[_0xb562('0x38')]=qs[_0xb562('0x39')](_[_0xb562('0x3a')](_0x59e978[_0xb562('0x30')],_0xa16eb9['filters']),_0x7b95ae);if(_0x59e978[_0xb562('0x30')][_0xb562('0x3b')]){_0x3b8c58[_0xb562('0x38')]=_[_0xb562('0x3c')](_0x3b8c58[_0xb562('0x38')],{'$or':_['map'](_0x7b95ae,function(_0x2a6c68){if(_0x2a6c68[_0xb562('0x2d')]!==_0xb562('0x3d')){var _0xd70ccf={};_0xd70ccf[_0x2a6c68['name']]={'$like':'%'+_0x59e978[_0xb562('0x30')]['filter']+'%'};return _0xd70ccf;}})});}_0x3b8c58=_[_0xb562('0x3c')]({},_0x3b8c58,_0x59e978['options']);var _0x1ba961={'where':_0x3b8c58[_0xb562('0x38')]};return db[_0xb562('0x3e')][_0xb562('0x3f')](_0x1ba961)[_0xb562('0x24')](function(_0x10600f){_0x2d3e63[_0xb562('0x3f')]=_0x10600f;if(_0x59e978[_0xb562('0x30')][_0xb562('0x40')]){_0x3b8c58['include']=[{'all':!![]}];}return db[_0xb562('0x3e')][_0xb562('0x41')](_0x3b8c58);})[_0xb562('0x24')](function(_0x3d76ff){_0x2d3e63[_0xb562('0x42')]=_0x3d76ff;return _0x2d3e63;})['then'](respondWithFilteredResult(_0x2612c0,_0x3b8c58))[_0xb562('0x43')](handleError(_0x2612c0,null));};exports['show']=function(_0x3ec757,_0x396ad5){var _0x334e2b={'raw':![],'where':{'id':_0x3ec757['params']['id']}},_0x46ec0b={};_0x46ec0b[_0xb562('0x2f')]=_['keys'](db[_0xb562('0x3e')][_0xb562('0x44')]);_0x46ec0b['query']=_[_0xb562('0x31')](_0x3ec757[_0xb562('0x30')]);_0x46ec0b['filters']=_['intersection'](_0x46ec0b['model'],_0x46ec0b[_0xb562('0x30')]);_0x334e2b[_0xb562('0x33')]=_[_0xb562('0x32')](_0x46ec0b[_0xb562('0x2f')],qs['fields'](_0x3ec757[_0xb562('0x30')][_0xb562('0x34')]));_0x334e2b[_0xb562('0x33')]=_0x334e2b[_0xb562('0x33')][_0xb562('0x35')]?_0x334e2b[_0xb562('0x33')]:_0x46ec0b['model'];if(_0x3ec757[_0xb562('0x30')][_0xb562('0x40')]){_0x334e2b[_0xb562('0x45')]=[{'all':!![]}];}_0x334e2b=_[_0xb562('0x3c')]({},_0x334e2b,_0x3ec757[_0xb562('0x46')]);return db['Campaign'][_0xb562('0x47')](_0x334e2b)[_0xb562('0x24')](handleEntityNotFound(_0x396ad5,null))[_0xb562('0x24')](respondWithResult(_0x396ad5,null))[_0xb562('0x43')](handleError(_0x396ad5,null));};exports[_0xb562('0x48')]=function(_0x5a895f,_0x58eb89){return db[_0xb562('0x3e')][_0xb562('0x48')](_0x5a895f[_0xb562('0x49')],{})[_0xb562('0x24')](function(_0x4aef4b){var _0x4e70fd=_0x5a895f[_0xb562('0x4a')][_0xb562('0x4b')]({'plain':!![]});if(!_0x4e70fd)throw new Error(_0xb562('0x4c'));if(_0x4e70fd['role']==='user'){var _0xfbd3b1=_0x4aef4b['get']({'plain':!![]});var _0x560b73=_0xb562('0x21');return db[_0xb562('0x4d')][_0xb562('0x47')]({'where':{'name':_0x560b73,'userProfileId':_0x4e70fd['userProfileId']},'raw':!![]})[_0xb562('0x24')](function(_0x3aa5a4){if(_0x3aa5a4&&_0x3aa5a4[_0xb562('0x4e')]===0x0){return db[_0xb562('0x22')][_0xb562('0x48')]({'name':_0xfbd3b1[_0xb562('0x28')],'resourceId':_0xfbd3b1['id'],'type':_0x3aa5a4[_0xb562('0x28')],'sectionId':_0x3aa5a4['id']},{})[_0xb562('0x24')](function(){return _0x4aef4b;});}else{return _0x4aef4b;}})[_0xb562('0x43')](function(_0x4e463b){logger[_0xb562('0x4f')](_0xb562('0x50'),_0x4e463b);throw _0x4e463b;});}return _0x4aef4b;})[_0xb562('0x24')](respondWithResult(_0x58eb89,0xc9))['catch'](handleError(_0x58eb89,null));};exports[_0xb562('0x51')]=function(_0x30de2d,_0x5cc917){var _0x394d4a={'where':{'id':_0x30de2d[_0xb562('0x52')]['id']}},_0x1f9bab={};_0x1f9bab[_0xb562('0x2f')]=_[_0xb562('0x31')](db[_0xb562('0x3e')][_0xb562('0x44')]);_0x394d4a[_0xb562('0x33')]=_[_0xb562('0x32')](_0x1f9bab[_0xb562('0x2f')],qs[_0xb562('0x34')](_0x30de2d[_0xb562('0x30')]['fields']));_0x394d4a[_0xb562('0x33')]=_0x394d4a[_0xb562('0x33')][_0xb562('0x35')]?_0x394d4a[_0xb562('0x33')]:_0x1f9bab[_0xb562('0x2f')];if(_0x30de2d[_0xb562('0x30')]['includeAll']){_0x394d4a['include']=[{'all':!![]}];}_0x394d4a=_[_0xb562('0x3c')]({},_0x394d4a,_0x30de2d[_0xb562('0x46')]);return db[_0xb562('0x3e')][_0xb562('0x47')](_0x394d4a)['then'](handleEntityNotFound(_0x5cc917,null))[_0xb562('0x24')](function(_0x4c6b5d){if(_0x4c6b5d){var _0x4c8eba=_0x4c6b5d[_0xb562('0x4b')]({'plain':!![]});_0x4c8eba=qs[_0xb562('0x53')](_0x4c8eba,['id','createdAt','updatedAt']);_0x30de2d['body']=_[_0xb562('0x53')](_0x30de2d[_0xb562('0x49')],['id','createdAt',_0xb562('0x54')]);return db[_0xb562('0x3e')]['create'](_[_0xb562('0x3c')](_0x4c8eba,_0x30de2d[_0xb562('0x49')]),{'include':_0x30de2d[_0xb562('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0xb562('0x24')](function(_0x4360ea){var _0x538fea=_0x30de2d['user'][_0xb562('0x4b')]({'plain':!![]});if(!_0x538fea)throw new Error(_0xb562('0x4c'));if(_0x538fea[_0xb562('0x55')]==='user'){var _0x836561=_0x4360ea['get']({'plain':!![]});var _0x37d500=_0xb562('0x21');return db['UserProfileSection'][_0xb562('0x47')]({'where':{'name':_0x37d500,'userProfileId':_0x538fea[_0xb562('0x56')]},'raw':!![]})['then'](function(_0x388ee0){if(_0x388ee0&&_0x388ee0['autoAssociation']===0x0){return db[_0xb562('0x22')][_0xb562('0x48')]({'name':_0x836561[_0xb562('0x28')],'resourceId':_0x836561['id'],'type':_0x388ee0[_0xb562('0x28')],'sectionId':_0x388ee0['id']},{})[_0xb562('0x24')](function(){return _0x4360ea;});}else{return _0x4360ea;}})[_0xb562('0x43')](function(_0x3bf3b7){logger[_0xb562('0x4f')](_0xb562('0x50'),_0x3bf3b7);throw _0x3bf3b7;});}return _0x4360ea;});}})['then'](respondWithResult(_0x5cc917,0xc9))[_0xb562('0x43')](handleError(_0x5cc917,null));};exports[_0xb562('0x20')]=function(_0x51e9aa,_0x23e2d5){if(_0x51e9aa['body']['id']){delete _0x51e9aa[_0xb562('0x49')]['id'];}return db[_0xb562('0x3e')][_0xb562('0x47')]({'where':{'id':_0x51e9aa['params']['id']}})['then'](handleEntityNotFound(_0x23e2d5,null))[_0xb562('0x24')](saveUpdates(_0x51e9aa['body'],null))[_0xb562('0x24')](respondWithResult(_0x23e2d5,null))[_0xb562('0x43')](handleError(_0x23e2d5,null));};exports[_0xb562('0x23')]=function(_0x4ac006,_0x24876b){return db['Campaign'][_0xb562('0x47')]({'where':{'id':_0x4ac006[_0xb562('0x52')]['id']}})['then'](handleEntityNotFound(_0x24876b,null))[_0xb562('0x24')](removeEntity(_0x24876b,null))['catch'](handleError(_0x24876b,null));};exports[_0xb562('0x57')]=function(_0x328735,_0x3d28f5,_0x405a4b){var _0x8dde3c={'raw':!![],'where':{}};var _0x5503c5={};var _0xed789={'count':0x0,'rows':[]};return db[_0xb562('0x3e')]['findOne']({'where':{'id':_0x328735[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x3d28f5,null))[_0xb562('0x24')](function(_0x48aa41){if(_0x48aa41){_0x5503c5[_0xb562('0x2f')]=_[_0xb562('0x31')](db[_0xb562('0x58')]['rawAttributes']);_0x5503c5[_0xb562('0x30')]=_[_0xb562('0x31')](_0x328735[_0xb562('0x30')]);_0x5503c5[_0xb562('0x39')]=_['intersection'](_0x5503c5[_0xb562('0x2f')],_0x5503c5[_0xb562('0x30')]);_0x8dde3c[_0xb562('0x33')]=_[_0xb562('0x32')](_0x5503c5[_0xb562('0x2f')],qs[_0xb562('0x34')](_0x328735[_0xb562('0x30')]['fields']));_0x8dde3c[_0xb562('0x33')]=_0x8dde3c[_0xb562('0x33')][_0xb562('0x35')]?_0x8dde3c['attributes']:_0x5503c5['model'];if(!_0x328735[_0xb562('0x30')][_0xb562('0x59')](_0xb562('0x36'))){_0x8dde3c[_0xb562('0x19')]=qs[_0xb562('0x19')](_0x328735[_0xb562('0x30')][_0xb562('0x19')]);_0x8dde3c[_0xb562('0x18')]=qs[_0xb562('0x18')](_0x328735[_0xb562('0x30')]['offset']);}_0x8dde3c[_0xb562('0x5a')]=qs[_0xb562('0x37')](_0x328735[_0xb562('0x30')][_0xb562('0x37')]);_0x8dde3c[_0xb562('0x38')]=qs['filters'](_[_0xb562('0x3a')](_0x328735[_0xb562('0x30')],_0x5503c5[_0xb562('0x39')]));_0x8dde3c[_0xb562('0x38')][_0xb562('0x5b')]=_0x48aa41['id'];if(_0x328735['query']['filter']){_0x8dde3c[_0xb562('0x38')]=_[_0xb562('0x3c')](_0x8dde3c[_0xb562('0x38')],{'$or':_[_0xb562('0x2b')](_0x8dde3c[_0xb562('0x33')],function(_0x352f9b){var _0x106eee={};_0x106eee[_0x352f9b]={'$like':'%'+_0x328735[_0xb562('0x30')]['filter']+'%'};return _0x106eee;})});}_0x8dde3c=_['merge']({},_0x8dde3c,_0x328735[_0xb562('0x46')]);return db[_0xb562('0x58')][_0xb562('0x3f')]({'where':_0x8dde3c['where']})[_0xb562('0x24')](function(_0x2a0407){_0xed789[_0xb562('0x3f')]=_0x2a0407;if(_0x328735[_0xb562('0x30')][_0xb562('0x40')]){_0x8dde3c[_0xb562('0x45')]=[{'all':!![]}];}return db[_0xb562('0x58')]['findAll'](_0x8dde3c);})[_0xb562('0x24')](function(_0x461456){_0xed789['rows']=_0x461456;return _0xed789;});}})[_0xb562('0x24')](respondWithFilteredResult(_0x3d28f5,_0x8dde3c))['catch'](handleError(_0x3d28f5,null));};exports[_0xb562('0x5c')]=function(_0x176d16,_0x42773a,_0x30793c){var _0x3904b5={'raw':!![],'where':{}};var _0x29c339={};var _0x34d4b7={'count':0x0,'rows':[]};return db[_0xb562('0x3e')][_0xb562('0x5d')]({'where':{'id':_0x176d16[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x42773a,null))[_0xb562('0x24')](function(_0x36e4d0){if(_0x36e4d0){_0x29c339[_0xb562('0x2f')]=_[_0xb562('0x31')](db[_0xb562('0x5e')][_0xb562('0x44')]);_0x29c339[_0xb562('0x30')]=_[_0xb562('0x31')](_0x176d16[_0xb562('0x30')]);_0x29c339[_0xb562('0x39')]=_[_0xb562('0x32')](_0x29c339[_0xb562('0x2f')],_0x29c339['query']);_0x3904b5['attributes']=_['intersection'](_0x29c339['model'],qs['fields'](_0x176d16[_0xb562('0x30')][_0xb562('0x34')]));_0x3904b5[_0xb562('0x33')]=_0x3904b5[_0xb562('0x33')]['length']?_0x3904b5[_0xb562('0x33')]:_0x29c339[_0xb562('0x2f')];if(!_0x176d16['query'][_0xb562('0x59')](_0xb562('0x36'))){_0x3904b5[_0xb562('0x19')]=qs[_0xb562('0x19')](_0x176d16['query'][_0xb562('0x19')]);_0x3904b5['offset']=qs[_0xb562('0x18')](_0x176d16[_0xb562('0x30')][_0xb562('0x18')]);}_0x3904b5[_0xb562('0x5a')]=qs[_0xb562('0x37')](_0x176d16[_0xb562('0x30')][_0xb562('0x37')]);_0x3904b5[_0xb562('0x38')]=qs['filters'](_[_0xb562('0x3a')](_0x176d16[_0xb562('0x30')],_0x29c339[_0xb562('0x39')]));_0x3904b5['where'][_0xb562('0x5b')]=_0x36e4d0['id'];if(_0x176d16[_0xb562('0x30')]['filter']){_0x3904b5[_0xb562('0x38')]=_['merge'](_0x3904b5['where'],{'$or':_[_0xb562('0x2b')](_0x3904b5[_0xb562('0x33')],function(_0x1baf18){var _0x25a729={};_0x25a729[_0x1baf18]={'$like':'%'+_0x176d16[_0xb562('0x30')]['filter']+'%'};return _0x25a729;})});}_0x3904b5=_[_0xb562('0x3c')]({},_0x3904b5,_0x176d16[_0xb562('0x46')]);return db['CmHopperHistory'][_0xb562('0x3f')]({'where':_0x3904b5['where']})[_0xb562('0x24')](function(_0x5f2b4d){_0x34d4b7[_0xb562('0x3f')]=_0x5f2b4d;if(_0x176d16[_0xb562('0x30')][_0xb562('0x40')]){_0x3904b5[_0xb562('0x45')]=[{'all':!![]}];}return db[_0xb562('0x5e')][_0xb562('0x41')](_0x3904b5);})[_0xb562('0x24')](function(_0x3f5f38){_0x34d4b7[_0xb562('0x42')]=_0x3f5f38;return _0x34d4b7;});}})[_0xb562('0x24')](respondWithFilteredResult(_0x42773a,_0x3904b5))[_0xb562('0x43')](handleError(_0x42773a,null));};exports[_0xb562('0x5f')]=function(_0x39c5a4,_0x1e6dfb,_0x54f0dd){var _0x8ab6e3={'raw':!![],'where':{}};var _0x5bd2f0={};var _0x42d0d4={'count':0x0,'rows':[]};return db[_0xb562('0x3e')][_0xb562('0x5d')]({'where':{'id':_0x39c5a4[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x1e6dfb,null))[_0xb562('0x24')](function(_0x3c047d){if(_0x3c047d){_0x5bd2f0['model']=_[_0xb562('0x31')](db['CmHopperFinal'][_0xb562('0x44')]);_0x5bd2f0[_0xb562('0x30')]=_[_0xb562('0x31')](_0x39c5a4['query']);_0x5bd2f0[_0xb562('0x39')]=_[_0xb562('0x32')](_0x5bd2f0[_0xb562('0x2f')],_0x5bd2f0[_0xb562('0x30')]);_0x8ab6e3[_0xb562('0x33')]=_[_0xb562('0x32')](_0x5bd2f0['model'],qs[_0xb562('0x34')](_0x39c5a4['query'][_0xb562('0x34')]));_0x8ab6e3[_0xb562('0x33')]=_0x8ab6e3[_0xb562('0x33')]['length']?_0x8ab6e3[_0xb562('0x33')]:_0x5bd2f0[_0xb562('0x2f')];if(!_0x39c5a4[_0xb562('0x30')]['hasOwnProperty'](_0xb562('0x36'))){_0x8ab6e3['limit']=qs[_0xb562('0x19')](_0x39c5a4['query'][_0xb562('0x19')]);_0x8ab6e3['offset']=qs[_0xb562('0x18')](_0x39c5a4['query'][_0xb562('0x18')]);}_0x8ab6e3['order']=qs[_0xb562('0x37')](_0x39c5a4[_0xb562('0x30')]['sort']);_0x8ab6e3['where']=qs[_0xb562('0x39')](_[_0xb562('0x3a')](_0x39c5a4['query'],_0x5bd2f0['filters']));_0x8ab6e3['where']['CampaignId']=_0x3c047d['id'];if(_0x39c5a4[_0xb562('0x30')][_0xb562('0x3b')]){_0x8ab6e3[_0xb562('0x38')]=_[_0xb562('0x3c')](_0x8ab6e3['where'],{'$or':_[_0xb562('0x2b')](_0x8ab6e3[_0xb562('0x33')],function(_0x3e376f){var _0x629943={};_0x629943[_0x3e376f]={'$like':'%'+_0x39c5a4[_0xb562('0x30')][_0xb562('0x3b')]+'%'};return _0x629943;})});}_0x8ab6e3=_[_0xb562('0x3c')]({},_0x8ab6e3,_0x39c5a4['options']);return db[_0xb562('0x60')]['count']({'where':_0x8ab6e3['where']})[_0xb562('0x24')](function(_0x41c22a){_0x42d0d4[_0xb562('0x3f')]=_0x41c22a;if(_0x39c5a4[_0xb562('0x30')]['includeAll']){_0x8ab6e3[_0xb562('0x45')]=[{'all':!![]}];}return db[_0xb562('0x60')][_0xb562('0x41')](_0x8ab6e3);})[_0xb562('0x24')](function(_0x1810f1){_0x42d0d4[_0xb562('0x42')]=_0x1810f1;return _0x42d0d4;});}})[_0xb562('0x24')](respondWithFilteredResult(_0x1e6dfb,_0x8ab6e3))[_0xb562('0x43')](handleError(_0x1e6dfb,null));};exports[_0xb562('0x61')]=function(_0x578e15,_0x2ecf12,_0x43ab1c){var _0x3163ba={'raw':!![],'where':{}};var _0x40680b={};var _0x334113={'count':0x0,'rows':[]};return db[_0xb562('0x3e')][_0xb562('0x5d')]({'where':{'id':_0x578e15[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x2ecf12,null))['then'](function(_0x2139b4){if(_0x2139b4){_0x40680b[_0xb562('0x2f')]=_[_0xb562('0x31')](db['CmHopperBlack'][_0xb562('0x44')]);_0x40680b[_0xb562('0x30')]=_[_0xb562('0x31')](_0x578e15[_0xb562('0x30')]);_0x40680b['filters']=_[_0xb562('0x32')](_0x40680b[_0xb562('0x2f')],_0x40680b[_0xb562('0x30')]);_0x3163ba[_0xb562('0x33')]=_[_0xb562('0x32')](_0x40680b[_0xb562('0x2f')],qs['fields'](_0x578e15[_0xb562('0x30')][_0xb562('0x34')]));_0x3163ba[_0xb562('0x33')]=_0x3163ba[_0xb562('0x33')][_0xb562('0x35')]?_0x3163ba[_0xb562('0x33')]:_0x40680b['model'];if(!_0x578e15[_0xb562('0x30')][_0xb562('0x59')](_0xb562('0x36'))){_0x3163ba['limit']=qs[_0xb562('0x19')](_0x578e15[_0xb562('0x30')][_0xb562('0x19')]);_0x3163ba[_0xb562('0x18')]=qs[_0xb562('0x18')](_0x578e15['query'][_0xb562('0x18')]);}_0x3163ba[_0xb562('0x5a')]=qs[_0xb562('0x37')](_0x578e15[_0xb562('0x30')][_0xb562('0x37')]);_0x3163ba['where']=qs['filters'](_[_0xb562('0x3a')](_0x578e15[_0xb562('0x30')],_0x40680b[_0xb562('0x39')]));_0x3163ba[_0xb562('0x38')][_0xb562('0x5b')]=_0x2139b4['id'];if(_0x578e15[_0xb562('0x30')]['filter']){_0x3163ba[_0xb562('0x38')]=_[_0xb562('0x3c')](_0x3163ba[_0xb562('0x38')],{'$or':_[_0xb562('0x2b')](_0x3163ba[_0xb562('0x33')],function(_0x1d9203){var _0x451b29={};_0x451b29[_0x1d9203]={'$like':'%'+_0x578e15['query'][_0xb562('0x3b')]+'%'};return _0x451b29;})});}_0x3163ba=_[_0xb562('0x3c')]({},_0x3163ba,_0x578e15[_0xb562('0x46')]);return db[_0xb562('0x62')][_0xb562('0x3f')]({'where':_0x3163ba['where']})[_0xb562('0x24')](function(_0x51e456){_0x334113['count']=_0x51e456;if(_0x578e15['query'][_0xb562('0x40')]){_0x3163ba[_0xb562('0x45')]=[{'all':!![]}];}return db[_0xb562('0x62')]['findAll'](_0x3163ba);})[_0xb562('0x24')](function(_0x5b54f5){_0x334113[_0xb562('0x42')]=_0x5b54f5;return _0x334113;});}})[_0xb562('0x24')](respondWithFilteredResult(_0x2ecf12,_0x3163ba))['catch'](handleError(_0x2ecf12,null));};exports['getLists']=function(_0x1fe48f,_0x26afdf,_0x415556){var _0x186a21={};var _0x467683={};var _0x5b38ea;var _0x4f0f4d;return db[_0xb562('0x3e')][_0xb562('0x5d')]({'where':{'id':_0x1fe48f[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x26afdf,null))[_0xb562('0x24')](function(_0x559c19){if(_0x559c19){_0x5b38ea=_0x559c19;_0x467683[_0xb562('0x2f')]=_[_0xb562('0x31')](db['CmList'][_0xb562('0x44')]);_0x467683['query']=_[_0xb562('0x31')](_0x1fe48f[_0xb562('0x30')]);_0x467683['filters']=_[_0xb562('0x32')](_0x467683[_0xb562('0x2f')],_0x467683['query']);_0x186a21[_0xb562('0x33')]=_[_0xb562('0x32')](_0x467683['model'],qs[_0xb562('0x34')](_0x1fe48f[_0xb562('0x30')][_0xb562('0x34')]));_0x186a21[_0xb562('0x33')]=_0x186a21['attributes'][_0xb562('0x35')]?_0x186a21[_0xb562('0x33')]:_0x467683[_0xb562('0x2f')];_0x186a21['order']=qs[_0xb562('0x37')](_0x1fe48f['query'][_0xb562('0x37')]);_0x186a21['where']=qs['filters'](_['pick'](_0x1fe48f[_0xb562('0x30')],_0x467683[_0xb562('0x39')]));if(_0x1fe48f[_0xb562('0x30')][_0xb562('0x3b')]){_0x186a21[_0xb562('0x38')]=_[_0xb562('0x3c')](_0x186a21[_0xb562('0x38')],{'$or':_['map'](_0x186a21['attributes'],function(_0x28e60d){var _0x37ec65={};_0x37ec65[_0x28e60d]={'$like':'%'+_0x1fe48f[_0xb562('0x30')][_0xb562('0x3b')]+'%'};return _0x37ec65;})});}_0x186a21=_[_0xb562('0x3c')]({},_0x186a21,_0x1fe48f[_0xb562('0x46')]);return _0x5b38ea[_0xb562('0x63')](_0x186a21);}})[_0xb562('0x24')](function(_0xd14ee3){if(_0xd14ee3){_0x4f0f4d=_0xd14ee3[_0xb562('0x35')];if(!_0x1fe48f[_0xb562('0x30')][_0xb562('0x59')](_0xb562('0x36'))){_0x186a21[_0xb562('0x19')]=qs['limit'](_0x1fe48f['query'][_0xb562('0x19')]);_0x186a21[_0xb562('0x18')]=qs[_0xb562('0x18')](_0x1fe48f[_0xb562('0x30')]['offset']);}return _0x5b38ea[_0xb562('0x63')](_0x186a21);}})[_0xb562('0x24')](function(_0x434b85){if(_0x434b85){return _0x434b85?{'count':_0x4f0f4d,'rows':_0x434b85}:null;}})['then'](respondWithResult(_0x26afdf,null))[_0xb562('0x43')](handleError(_0x26afdf,null));};exports['addLists']=function(_0x36095d,_0x202bc5,_0x11e0a5){var _0xb332e1,_0xea4779;return db['Campaign']['find']({'where':{'id':_0x36095d[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x202bc5,null))[_0xb562('0x24')](function(_0x53e5b7){if(_0x53e5b7){_0xea4779=_0x53e5b7;return _0x53e5b7[_0xb562('0x64')](_0x36095d['body']['ids'],_[_0xb562('0x53')](_0x36095d[_0xb562('0x49')],[_0xb562('0x65'),'id'])||{});}return null;})[_0xb562('0x66')](function(_0x111a24){var _0x5bcdd3;_0xb332e1=_0x111a24||[];var _0x333051=[];if(_0x111a24){for(var _0x26dc36=0x0;_0x26dc36<_0x111a24[_0xb562('0x35')];_0x26dc36+=0x1){var _0x515cd1=_0x111a24[_0x26dc36]['get']({'plain':!![]});_0xea4779['dialCheckDuplicateType']=_0x36095d[_0xb562('0x49')]['dialCheckDuplicateType']?_0x36095d['body']['dialCheckDuplicateType']:_0xea4779[_0xb562('0x67')];switch(_0xea4779[_0xb562('0x67')]){case _0xb562('0x68'):_0x5bcdd3=squel[_0xb562('0x69')]()[_0xb562('0x6a')](_0xb562('0x6b'))[_0xb562('0x6c')]([_0xb562('0x6d'),_0xb562('0x6e'),_0xb562('0x6f'),'ListId','CampaignId',_0xb562('0x70'),_0xb562('0x54')],squel[_0xb562('0x71')]()[_0xb562('0x72')](_0xb562('0x6d'),_0xb562('0x6d'))[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x6e'))['field']('id',_0xb562('0x6f'))['field'](_0x515cd1[_0xb562('0x74')][_0xb562('0x75')](),_0xb562('0x76'))[_0xb562('0x72')](_0x36095d[_0xb562('0x52')]['id'][_0xb562('0x75')](),_0xb562('0x5b'))[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x70'))[_0xb562('0x72')](_0xb562('0x73'),'updatedAt')['from']('cm_contacts')[_0xb562('0x38')](_0xb562('0x77'))[_0xb562('0x38')](_0xb562('0x78'),_0x515cd1['CmListId'][_0xb562('0x75')]())[_0xb562('0x38')](_0xb562('0x79'))[_0xb562('0x38')](_0xb562('0x7a'),squel['select']()['field'](_0xb562('0x7b'))[_0xb562('0x7c')](_0xb562('0x7d'))[_0xb562('0x38')](_0xb562('0x7e'),_0x36095d[_0xb562('0x52')]['id'][_0xb562('0x75')]()))[_0xb562('0x38')](_0xb562('0x7a'),squel[_0xb562('0x71')]()[_0xb562('0x72')](_0xb562('0x7f'))[_0xb562('0x7c')](_0xb562('0x6b'))[_0xb562('0x38')]('CampaignId\x20=\x20?',_0x36095d['params']['id'][_0xb562('0x75')]())))[_0xb562('0x75')]();break;case _0xb562('0x80'):_0x5bcdd3=squel['insert']()[_0xb562('0x6a')](_0xb562('0x6b'))['fromQuery']([_0xb562('0x6d'),_0xb562('0x6e'),_0xb562('0x6f'),'ListId',_0xb562('0x5b'),_0xb562('0x70'),_0xb562('0x54')],squel[_0xb562('0x71')]()[_0xb562('0x72')]('phone',_0xb562('0x6d'))['field'](_0xb562('0x73'),_0xb562('0x6e'))['field']('id',_0xb562('0x6f'))['field'](_0x515cd1[_0xb562('0x74')][_0xb562('0x75')](),_0xb562('0x76'))[_0xb562('0x72')](_0x36095d['params']['id'][_0xb562('0x75')](),'CampaignId')[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x70'))[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x54'))[_0xb562('0x7c')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xb562('0x38')](_0xb562('0x78'),_0x515cd1[_0xb562('0x74')][_0xb562('0x75')]())[_0xb562('0x38')](_0xb562('0x79'))['where'](_0xb562('0x7a'),squel['select']()[_0xb562('0x72')](_0xb562('0x7f'))[_0xb562('0x7c')](_0xb562('0x6b'))['where'](_0xb562('0x7e'),_0x36095d[_0xb562('0x52')]['id']['toString']())))['toString']();break;default:_0x5bcdd3=squel['insert']()[_0xb562('0x6a')]('cm_hopper')['fromQuery'](['phone',_0xb562('0x6e'),_0xb562('0x6f'),_0xb562('0x76'),'CampaignId',_0xb562('0x70'),'updatedAt'],squel[_0xb562('0x71')]()[_0xb562('0x72')](_0xb562('0x6d'),_0xb562('0x6d'))[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x6e'))['field']('id','ContactId')[_0xb562('0x72')](_0x515cd1[_0xb562('0x74')][_0xb562('0x75')](),'ListId')[_0xb562('0x72')](_0x36095d[_0xb562('0x52')]['id'][_0xb562('0x75')](),'CampaignId')[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x70'))['field'](_0xb562('0x73'),'updatedAt')[_0xb562('0x7c')](_0xb562('0x81'))[_0xb562('0x38')](_0xb562('0x77'))[_0xb562('0x38')]('ListId\x20=\x20?',_0x515cd1[_0xb562('0x74')]['toString']())[_0xb562('0x38')](_0xb562('0x79')))[_0xb562('0x75')]();}_0x333051[_0xb562('0x82')](db[_0xb562('0x83')][_0xb562('0x30')](_0x5bcdd3));}return BPromise[_0xb562('0x84')](_0x333051);}})[_0xb562('0x24')](function(){return _0xb332e1;})[_0xb562('0x24')](respondWithResult(_0x202bc5,null))['catch'](handleError(_0x202bc5,null));};exports['removeLists']=function(_0xf08372,_0x4d6db6,_0x257c20){return db[_0xb562('0x3e')][_0xb562('0x47')]({'where':{'id':_0xf08372[_0xb562('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d6db6,null))['then'](function(_0x275a1b){if(_0x275a1b){return _0x275a1b['removeLists'](_0xf08372[_0xb562('0x30')][_0xb562('0x65')]);}})[_0xb562('0x24')](function(_0x5570d8){if(_0x5570d8){return db['CmHopper'][_0xb562('0x23')]({'where':{'ListId':_0xf08372[_0xb562('0x30')][_0xb562('0x65')],'CampaignId':_0xf08372[_0xb562('0x52')]['id']}})[_0xb562('0x24')](function(){return _0x5570d8;});}})['then'](respondWithStatusCode(_0x4d6db6,null))['catch'](handleError(_0x4d6db6,null));};exports[_0xb562('0x85')]=function(_0x2377ff,_0x5ca2ee,_0x336ef8){var _0x1bd634={};var _0x17a893={};var _0x296eb5;var _0x106794;return db[_0xb562('0x3e')][_0xb562('0x5d')]({'where':{'id':_0x2377ff[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x5ca2ee,null))[_0xb562('0x24')](function(_0x916013){if(_0x916013){_0x296eb5=_0x916013;_0x17a893[_0xb562('0x2f')]=_[_0xb562('0x31')](db[_0xb562('0x86')][_0xb562('0x44')]);_0x17a893[_0xb562('0x30')]=_['keys'](_0x2377ff[_0xb562('0x30')]);_0x17a893[_0xb562('0x39')]=_['intersection'](_0x17a893[_0xb562('0x2f')],_0x17a893[_0xb562('0x30')]);_0x1bd634[_0xb562('0x33')]=_[_0xb562('0x32')](_0x17a893['model'],qs['fields'](_0x2377ff[_0xb562('0x30')][_0xb562('0x34')]));_0x1bd634[_0xb562('0x33')]=_0x1bd634[_0xb562('0x33')]['length']?_0x1bd634[_0xb562('0x33')]:_0x17a893[_0xb562('0x2f')];_0x1bd634[_0xb562('0x5a')]=qs[_0xb562('0x37')](_0x2377ff[_0xb562('0x30')][_0xb562('0x37')]);_0x1bd634['where']=qs[_0xb562('0x39')](_[_0xb562('0x3a')](_0x2377ff['query'],_0x17a893[_0xb562('0x39')]));if(_0x2377ff[_0xb562('0x30')]['filter']){_0x1bd634['where']=_['merge'](_0x1bd634['where'],{'$or':_[_0xb562('0x2b')](_0x1bd634['attributes'],function(_0x4281fe){var _0x2eaa6a={};_0x2eaa6a[_0x4281fe]={'$like':'%'+_0x2377ff[_0xb562('0x30')][_0xb562('0x3b')]+'%'};return _0x2eaa6a;})});}_0x1bd634=_['merge']({},_0x1bd634,_0x2377ff[_0xb562('0x46')]);return _0x296eb5[_0xb562('0x85')](_0x1bd634);}})[_0xb562('0x24')](function(_0x10cf69){if(_0x10cf69){_0x106794=_0x10cf69[_0xb562('0x35')];if(!_0x2377ff[_0xb562('0x30')][_0xb562('0x59')](_0xb562('0x36'))){_0x1bd634[_0xb562('0x19')]=qs[_0xb562('0x19')](_0x2377ff[_0xb562('0x30')][_0xb562('0x19')]);_0x1bd634['offset']=qs[_0xb562('0x18')](_0x2377ff[_0xb562('0x30')][_0xb562('0x18')]);}return _0x296eb5[_0xb562('0x85')](_0x1bd634);}})['then'](function(_0x3d2e50){if(_0x3d2e50){return _0x3d2e50?{'count':_0x106794,'rows':_0x3d2e50}:null;}})[_0xb562('0x24')](respondWithResult(_0x5ca2ee,null))[_0xb562('0x43')](handleError(_0x5ca2ee,null));};exports[_0xb562('0x87')]=function(_0x66552c,_0x4a4af5,_0xcbae04){var _0x2ac34e,_0x47e4fc;return db[_0xb562('0x3e')][_0xb562('0x47')]({'where':{'id':_0x66552c[_0xb562('0x52')]['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x4a4af5,null))[_0xb562('0x24')](function(_0x48d78b){if(_0x48d78b){_0x47e4fc=_0x48d78b;return _0x48d78b[_0xb562('0x87')](_0x66552c[_0xb562('0x49')]['ids'],_[_0xb562('0x53')](_0x66552c[_0xb562('0x49')],[_0xb562('0x65'),'id'])||{});}return null;})[_0xb562('0x66')](function(_0x59d97c){var _0x236301;_0x2ac34e=_0x59d97c||[];var _0x3fb33b=[];if(_0x59d97c){for(var _0x12d05f=0x0;_0x12d05f<_0x59d97c[_0xb562('0x35')];_0x12d05f+=0x1){var _0x17942c=_0x59d97c[_0x12d05f][_0xb562('0x4b')]({'plain':!![]});_0x236301=squel[_0xb562('0x69')]()[_0xb562('0x6a')]('cm_hopper_black')[_0xb562('0x6c')]([_0xb562('0x6d'),_0xb562('0x6f'),'ListId','CampaignId',_0xb562('0x70'),_0xb562('0x54')],squel['select']()[_0xb562('0x72')](_0xb562('0x6d'),_0xb562('0x6d'))['field']('id',_0xb562('0x6f'))[_0xb562('0x72')](_0x17942c['CmListId']['toString'](),_0xb562('0x76'))['field'](_0x66552c['params']['id'][_0xb562('0x75')](),_0xb562('0x5b'))[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x70'))[_0xb562('0x72')](_0xb562('0x73'),_0xb562('0x54'))[_0xb562('0x7c')]('cm_contacts')[_0xb562('0x38')](_0xb562('0x77'))[_0xb562('0x38')](_0xb562('0x78'),_0x17942c['CmListId']['toString']())['where'](_0xb562('0x79')))[_0xb562('0x75')]();_0x3fb33b['push'](db['sequelize'][_0xb562('0x30')](_0x236301));}return BPromise['all'](_0x3fb33b);}})[_0xb562('0x24')](function(){return _0x2ac34e;})['then'](respondWithResult(_0x4a4af5,null))[_0xb562('0x43')](handleError(_0x4a4af5,null));};exports[_0xb562('0x88')]=function(_0x595b20,_0x2f5fc2,_0x1fdcf0){return db[_0xb562('0x3e')]['find']({'where':{'id':_0x595b20['params']['id']}})[_0xb562('0x24')](handleEntityNotFound(_0x2f5fc2,null))[_0xb562('0x24')](function(_0x4c66d1){if(_0x4c66d1){return _0x4c66d1[_0xb562('0x88')](_0x595b20[_0xb562('0x30')][_0xb562('0x65')]);}})[_0xb562('0x24')](function(_0x3b54be){if(_0x3b54be){return db[_0xb562('0x62')][_0xb562('0x23')]({'where':{'ListId':_0x595b20['query'][_0xb562('0x65')],'CampaignId':_0x595b20[_0xb562('0x52')]['id']}})['then'](function(){return _0x3b54be;});}})[_0xb562('0x24')](respondWithStatusCode(_0x2f5fc2,null))[_0xb562('0x43')](handleError(_0x2f5fc2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1b0b924..f6002d0 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x134de4,_0x49c839){var _0xe97f36=function(_0x2ffa31){while(--_0x2ffa31){_0x134de4['push'](_0x134de4['shift']());}};_0xe97f36(++_0x49c839);}(_0x7a54,0x106));var _0x47a5=function(_0xf6a153,_0x1ba152){_0xf6a153=_0xf6a153-0x0;var _0x2ea5c3=_0x7a54[_0xf6a153];return _0x2ea5c3;};'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 fd6d136..83c7f95 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 _0x2f68=['limit','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','attributes'];(function(_0x5509a8,_0x1a8b93){var _0x5383b1=function(_0x14cde3){while(--_0x14cde3){_0x5509a8['push'](_0x5509a8['shift']());}};_0x5383b1(++_0x1a8b93);}(_0x2f68,0x9a));var _0x82f6=function(_0x3762f9,_0x5bfc36){_0x3762f9=_0x3762f9-0x0;var _0x52c36a=_0x2f68[_0x3762f9];return _0x52c36a;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});}exports[_0x82f6('0x15')]=function(_0xcbc95f){var _0x4072f0=this;return new Promise(function(_0x2bfd57,_0x1c79f9){return db[_0x82f6('0x16')][_0x82f6('0x17')]({'raw':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['where']||null:null,'attributes':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x19')]||null:null,'limit':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f['options'][_0x82f6('0x1a')]||null:null,'include':_0xcbc95f['options']?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x1b')]?_['map'](_0xcbc95f['options'][_0x82f6('0x1b')],function(_0x1d96d5){return{'model':db[_0x1d96d5['model']],'as':_0x1d96d5['as'],'attributes':_0x1d96d5['attributes'],'include':_0x1d96d5[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x1d96d5['include'],function(_0xfd8b68){return{'model':db[_0xfd8b68[_0x82f6('0x1d')]],'as':_0xfd8b68['as'],'attributes':_0xfd8b68['attributes'],'include':_0xfd8b68['include']?_[_0x82f6('0x1c')](_0xfd8b68['include'],function(_0x469b6b){return{'model':db[_0x469b6b[_0x82f6('0x1d')]],'as':_0x469b6b['as'],'attributes':_0x469b6b['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x15c9b7){logger[_0x82f6('0xb')](_0x82f6('0x15'),_0xcbc95f);logger['debug'](_0x82f6('0x15'),_0xcbc95f,JSON[_0x82f6('0x10')](_0x15c9b7));_0x2bfd57(_0x15c9b7);})[_0x82f6('0x14')](function(_0x400137){logger[_0x82f6('0x11')](_0x82f6('0x15'),_0x400137[_0x82f6('0x12')],_0xcbc95f);_0x1c79f9(_0x4072f0[_0x82f6('0x11')](0x1f4,_0x400137[_0x82f6('0x12')]));});});}; \ No newline at end of file +var _0xea70=['info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x295fe9,_0x345828){var _0x3b80df=function(_0x85b4dc){while(--_0x85b4dc){_0x295fe9['push'](_0x295fe9['shift']());}};_0x3b80df(++_0x345828);}(_0xea70,0x175));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var moment=require(_0x0ea7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ea7('0x5'))(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));var jayson=require(_0x0ea7('0x8'));var client=jayson[_0x0ea7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144497,_0x1ebefe,_0x51b516){return new BPromise(function(_0x48dedd,_0xc97410){return client['request'](_0x144497,_0x51b516)[_0x0ea7('0xa')](function(_0x107f04){logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,'request\x20sent');logger[_0x0ea7('0xd')](_0x0ea7('0xe'),_0x1ebefe,_0x0ea7('0xf'),JSON[_0x0ea7('0x10')](_0x107f04));if(_0x107f04[_0x0ea7('0x11')]){if(_0x107f04['error'][_0x0ea7('0x12')]===0x1f4){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04['error']['message']);return _0xc97410(_0x107f04['error'][_0x0ea7('0x13')]);}logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04[_0x0ea7('0x11')]['message']);return _0x48dedd(_0x107f04['error']['message']);}else{logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,_0x0ea7('0xf'));_0x48dedd(_0x107f04['result']['message']);}})[_0x0ea7('0x14')](function(_0x2aa4e9){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x2aa4e9);_0xc97410(_0x2aa4e9);});});}exports[_0x0ea7('0x15')]=function(_0x987032){var _0x1b1cb5=this;return new Promise(function(_0x48f10a,_0x4deb29){return db[_0x0ea7('0x16')][_0x0ea7('0x17')]({'raw':_0x987032['options']?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x19')]===undefined?!![]:![]:!![],'where':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1a')]||null:null,'attributes':_0x987032[_0x0ea7('0x18')]?_0x987032['options'][_0x0ea7('0x1b')]||null:null,'limit':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'include':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1d')]?_[_0x0ea7('0x1e')](_0x987032['options'][_0x0ea7('0x1d')],function(_0x2a0f71){return{'model':db[_0x2a0f71[_0x0ea7('0x1f')]],'as':_0x2a0f71['as'],'attributes':_0x2a0f71['attributes'],'include':_0x2a0f71[_0x0ea7('0x1d')]?_[_0x0ea7('0x1e')](_0x2a0f71['include'],function(_0x3ba808){return{'model':db[_0x3ba808['model']],'as':_0x3ba808['as'],'attributes':_0x3ba808['attributes'],'include':_0x3ba808['include']?_[_0x0ea7('0x1e')](_0x3ba808[_0x0ea7('0x1d')],function(_0x462715){return{'model':db[_0x462715['model']],'as':_0x462715['as'],'attributes':_0x462715[_0x0ea7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ea7('0xa')](function(_0x608119){logger[_0x0ea7('0xb')](_0x0ea7('0x15'),_0x987032);logger[_0x0ea7('0xd')](_0x0ea7('0x15'),_0x987032,JSON[_0x0ea7('0x10')](_0x608119));_0x48f10a(_0x608119);})['catch'](function(_0x27e9fd){logger[_0x0ea7('0x11')]('GetCampaign',_0x27e9fd[_0x0ea7('0x13')],_0x987032);_0x4deb29(_0x1b1cb5[_0x0ea7('0x11')](0x1f4,_0x27e9fd[_0x0ea7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 60edb1f..c4d4b8c 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 _0x8f2a=['express','Router','fs-extra','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','update','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout'];(function(_0x54ee73,_0x4cf85){var _0x332ee9=function(_0x53f5e1){while(--_0x53f5e1){_0x54ee73['push'](_0x54ee73['shift']());}};_0x332ee9(++_0x4cf85);}(_0x8f2a,0x98));var _0xa8f2=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x8f2a[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require('multer');var util=require(_0xa8f2('0x0'));var path=require(_0xa8f2('0x1'));var timeout=require(_0xa8f2('0x2'));var express=require(_0xa8f2('0x3'));var router=express[_0xa8f2('0x4')]();var fs_extra=require(_0xa8f2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8f2('0x6'));router[_0xa8f2('0x7')]('/',auth[_0xa8f2('0x8')](),controller[_0xa8f2('0x9')]);router['get'](_0xa8f2('0xa'),auth[_0xa8f2('0x8')](),controller['show']);router[_0xa8f2('0x7')](_0xa8f2('0xb'),auth['isAuthenticated'](),controller[_0xa8f2('0xc')]);router[_0xa8f2('0x7')](_0xa8f2('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xa8f2('0x7')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xa8f2('0xe')]);router['get']('/:id/hopper_black',auth[_0xa8f2('0x8')](),controller[_0xa8f2('0xf')]);router['get'](_0xa8f2('0x10'),auth['isAuthenticated'](),controller[_0xa8f2('0x11')]);router[_0xa8f2('0x7')](_0xa8f2('0x12'),auth[_0xa8f2('0x8')](),controller[_0xa8f2('0x13')]);router[_0xa8f2('0x14')]('/',auth['isAuthenticated'](),controller[_0xa8f2('0x15')]);router[_0xa8f2('0x14')](_0xa8f2('0x16'),auth[_0xa8f2('0x8')](),controller[_0xa8f2('0x17')]);router[_0xa8f2('0x14')]('/:id/lists',auth['isAuthenticated'](),controller[_0xa8f2('0x18')]);router[_0xa8f2('0x14')](_0xa8f2('0x12'),auth[_0xa8f2('0x8')](),controller['addBlackLists']);router[_0xa8f2('0x19')](_0xa8f2('0xa'),auth['isAuthenticated'](),controller[_0xa8f2('0x1a')]);router[_0xa8f2('0x1b')](_0xa8f2('0xa'),auth[_0xa8f2('0x8')](),controller['destroy']);router[_0xa8f2('0x1b')](_0xa8f2('0x10'),auth[_0xa8f2('0x8')](),controller[_0xa8f2('0x1c')]);router[_0xa8f2('0x1b')](_0xa8f2('0x12'),auth[_0xa8f2('0x8')](),controller[_0xa8f2('0x1d')]);module[_0xa8f2('0x1e')]=router; \ No newline at end of file +var _0xee11=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','/:id/hoppers','getHoppers'];(function(_0x1e5331,_0xf63732){var _0x3538ea=function(_0x39af0a){while(--_0x39af0a){_0x1e5331['push'](_0x1e5331['shift']());}};_0x3538ea(++_0xf63732);}(_0xee11,0x146));var _0x1ee1=function(_0x4b87dc,_0x65bfba){_0x4b87dc=_0x4b87dc-0x0;var _0x4c3b12=_0xee11[_0x4b87dc];return _0x4c3b12;};'use strict';var multer=require(_0x1ee1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1ee1('0x1'));var express=require(_0x1ee1('0x2'));var router=express[_0x1ee1('0x3')]();var fs_extra=require(_0x1ee1('0x4'));var auth=require(_0x1ee1('0x5'));var interaction=require(_0x1ee1('0x6'));var config=require(_0x1ee1('0x7'));var controller=require(_0x1ee1('0x8'));router['get']('/',auth[_0x1ee1('0x9')](),controller[_0x1ee1('0xa')]);router[_0x1ee1('0xb')](_0x1ee1('0xc'),auth[_0x1ee1('0x9')](),controller['show']);router['get'](_0x1ee1('0xd'),auth[_0x1ee1('0x9')](),controller[_0x1ee1('0xe')]);router[_0x1ee1('0xb')]('/:id/hopper_histories',auth[_0x1ee1('0x9')](),controller['getHopperHistories']);router[_0x1ee1('0xb')](_0x1ee1('0xf'),auth[_0x1ee1('0x9')](),controller[_0x1ee1('0x10')]);router['get'](_0x1ee1('0x11'),auth[_0x1ee1('0x9')](),controller['getHopperBlacks']);router[_0x1ee1('0xb')](_0x1ee1('0x12'),auth[_0x1ee1('0x9')](),controller[_0x1ee1('0x13')]);router[_0x1ee1('0xb')](_0x1ee1('0x14'),auth[_0x1ee1('0x9')](),controller[_0x1ee1('0x15')]);router[_0x1ee1('0x16')]('/',auth[_0x1ee1('0x9')](),controller[_0x1ee1('0x17')]);router[_0x1ee1('0x16')](_0x1ee1('0x18'),auth[_0x1ee1('0x9')](),controller['clone']);router['post'](_0x1ee1('0x12'),auth[_0x1ee1('0x9')](),controller[_0x1ee1('0x19')]);router[_0x1ee1('0x16')](_0x1ee1('0x14'),auth[_0x1ee1('0x9')](),controller['addBlackLists']);router[_0x1ee1('0x1a')](_0x1ee1('0xc'),auth['isAuthenticated'](),controller[_0x1ee1('0x1b')]);router[_0x1ee1('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x1ee1('0x1d')]);router[_0x1ee1('0x1c')](_0x1ee1('0x12'),auth[_0x1ee1('0x9')](),controller['removeLists']);router[_0x1ee1('0x1c')](_0x1ee1('0x14'),auth[_0x1ee1('0x9')](),controller['removeBlackLists']);module[_0x1ee1('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 a5ee717..fa56063 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 _0x1efd=['exports','STRING','TEXT','VIRTUAL','key','sequelize'];(function(_0x3b55c6,_0x271aa9){var _0x47b310=function(_0x271dfb){while(--_0x271dfb){_0x3b55c6['push'](_0x3b55c6['shift']());}};_0x47b310(++_0x271aa9);}(_0x1efd,0x1bb));var _0xd1ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1efd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1ef('0x0'));module[_0xd1ef('0x1')]={'key':{'type':Sequelize[_0xd1ef('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd1ef('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xd1ef('0x2')]},'name':{'type':Sequelize[_0xd1ef('0x4')],'get':function(){return this['getDataValue'](_0xd1ef('0x5'));}}}; \ No newline at end of file +var _0x5da9=['key','sequelize','exports','TEXT','VIRTUAL','getDataValue'];(function(_0x44650b,_0x5af069){var _0x13b205=function(_0x404cec){while(--_0x404cec){_0x44650b['push'](_0x44650b['shift']());}};_0x13b205(++_0x5af069);}(_0x5da9,0x169));var _0x95da=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x5da9[_0x4c7b20];return _0x4872bd;};'use strict';var Sequelize=require(_0x95da('0x0'));module[_0x95da('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x95da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x95da('0x3')],'get':function(){return this[_0x95da('0x4')](_0x95da('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 252b9f0..cf7dda4 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 _0x0c9b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CannedAnswers','end','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','where','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0c9b,0x109));var _0xb0c9=function(_0x5cf279,_0x4985de){_0x5cf279=_0x5cf279-0x0;var _0x26acdf=_0x0c9b[_0x5cf279];return _0x26acdf;};'use strict';var emlformat=require(_0xb0c9('0x0'));var rimraf=require(_0xb0c9('0x1'));var zipdir=require(_0xb0c9('0x2'));var jsonpatch=require(_0xb0c9('0x3'));var rp=require(_0xb0c9('0x4'));var moment=require(_0xb0c9('0x5'));var BPromise=require(_0xb0c9('0x6'));var Mustache=require(_0xb0c9('0x7'));var util=require(_0xb0c9('0x8'));var path=require(_0xb0c9('0x9'));var sox=require(_0xb0c9('0xa'));var csv=require(_0xb0c9('0xb'));var ejs=require(_0xb0c9('0xc'));var fs=require('fs');var fs_extra=require(_0xb0c9('0xd'));var _=require(_0xb0c9('0xe'));var squel=require('squel');var crypto=require(_0xb0c9('0xf'));var jsforce=require(_0xb0c9('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb0c9('0xb'));var querystring=require(_0xb0c9('0x11'));var Papa=require(_0xb0c9('0x12'));var Redis=require(_0xb0c9('0x13'));var authService=require(_0xb0c9('0x14'));var qs=require(_0xb0c9('0x15'));var as=require(_0xb0c9('0x16'));var hardwareService=require(_0xb0c9('0x17'));var logger=require(_0xb0c9('0x18'))(_0xb0c9('0x19'));var utils=require(_0xb0c9('0x1a'));var config=require(_0xb0c9('0x1b'));var licenseUtil=require(_0xb0c9('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147b0,_0x22be17){_0x22be17=_0x22be17||0xcc;return function(_0x5a285e){if(_0x5a285e){return _0x147b0[_0xb0c9('0x1d')](_0x22be17);}return _0x147b0[_0xb0c9('0x1e')](_0x22be17)['end']();};}function respondWithResult(_0x3c84d7,_0xa497f8){_0xa497f8=_0xa497f8||0xc8;return function(_0x3050f1){if(_0x3050f1){return _0x3c84d7['status'](_0xa497f8)['json'](_0x3050f1);}};}function respondWithFilteredResult(_0x268818,_0x3a27fc){return function(_0xd1c1f2){if(_0xd1c1f2){var _0xbd6865=typeof _0x3a27fc[_0xb0c9('0x1f')]===_0xb0c9('0x20')&&typeof _0x3a27fc[_0xb0c9('0x21')]===_0xb0c9('0x20');var _0x2d59c1=_0xd1c1f2['count'];var _0x5391e8=_0xbd6865?0x0:_0x3a27fc['offset'];var _0x1f1b54=_0xbd6865?_0xd1c1f2[_0xb0c9('0x22')]:_0x3a27fc['offset']+_0x3a27fc[_0xb0c9('0x21')];var _0x5b540d;if(_0x1f1b54>=_0x2d59c1){_0x1f1b54=_0x2d59c1;_0x5b540d=0xc8;}else{_0x5b540d=0xce;}_0x268818[_0xb0c9('0x1e')](_0x5b540d);return _0x268818[_0xb0c9('0x23')](_0xb0c9('0x24'),_0x5391e8+'-'+_0x1f1b54+'/'+_0x2d59c1)[_0xb0c9('0x25')](_0xd1c1f2);}return null;};}function patchUpdates(_0x7e1148){return function(_0x29316b){try{jsonpatch[_0xb0c9('0x26')](_0x29316b,_0x7e1148,!![]);}catch(_0xd03641){return BPromise[_0xb0c9('0x27')](_0xd03641);}return _0x29316b[_0xb0c9('0x28')]();};}function saveUpdates(_0x493c40,_0x596c93){return function(_0x1e2e4b){if(_0x1e2e4b){return _0x1e2e4b[_0xb0c9('0x29')](_0x493c40)['then'](function(_0x382e02){return _0x382e02;});}return null;};}function removeEntity(_0x4a53d3,_0xd3f7aa){return function(_0x2691f4){if(_0x2691f4){return _0x2691f4[_0xb0c9('0x2a')]()[_0xb0c9('0x2b')](function(){var _0x45be22=_0x2691f4[_0xb0c9('0x2c')]({'plain':!![]});var _0x2a99f5=_0xb0c9('0x2d');return db['UserProfileResource'][_0xb0c9('0x2a')]({'where':{'type':_0x2a99f5,'resourceId':_0x45be22['id']}})[_0xb0c9('0x2b')](function(){return _0x2691f4;});})['then'](function(){_0x4a53d3[_0xb0c9('0x1e')](0xcc)[_0xb0c9('0x2e')]();});}};}function handleEntityNotFound(_0x4dd894,_0x1c166d){return function(_0x5355c2){if(!_0x5355c2){_0x4dd894[_0xb0c9('0x1d')](0x194);}return _0x5355c2;};}function handleError(_0x58bfe0,_0x20b8fb){_0x20b8fb=_0x20b8fb||0x1f4;return function(_0x535a48){logger[_0xb0c9('0x2f')](_0x535a48[_0xb0c9('0x30')]);if(_0x535a48['name']){delete _0x535a48[_0xb0c9('0x31')];}_0x58bfe0[_0xb0c9('0x1e')](_0x20b8fb)['send'](_0x535a48);};}exports['index']=function(_0x33f8b8,_0x519cee){var _0x3dae41={},_0x2f23e1={},_0x19a240={'count':0x0,'rows':[]};var _0x48750b=_['map'](db['CannedAnswer'][_0xb0c9('0x32')],function(_0x1024d6){return{'name':_0x1024d6[_0xb0c9('0x33')],'type':_0x1024d6[_0xb0c9('0x34')][_0xb0c9('0x35')]};});_0x2f23e1[_0xb0c9('0x36')]=_[_0xb0c9('0x37')](_0x48750b,_0xb0c9('0x31'));_0x2f23e1[_0xb0c9('0x38')]=_[_0xb0c9('0x39')](_0x33f8b8[_0xb0c9('0x38')]);_0x2f23e1[_0xb0c9('0x3a')]=_[_0xb0c9('0x3b')](_0x2f23e1[_0xb0c9('0x36')],_0x2f23e1[_0xb0c9('0x38')]);_0x3dae41['attributes']=_[_0xb0c9('0x3b')](_0x2f23e1[_0xb0c9('0x36')],qs['fields'](_0x33f8b8['query'][_0xb0c9('0x3c')]));_0x3dae41['attributes']=_0x3dae41[_0xb0c9('0x3d')]['length']?_0x3dae41[_0xb0c9('0x3d')]:_0x2f23e1[_0xb0c9('0x36')];if(!_0x33f8b8[_0xb0c9('0x38')]['hasOwnProperty'](_0xb0c9('0x3e'))){_0x3dae41[_0xb0c9('0x21')]=qs[_0xb0c9('0x21')](_0x33f8b8[_0xb0c9('0x38')][_0xb0c9('0x21')]);_0x3dae41[_0xb0c9('0x1f')]=qs['offset'](_0x33f8b8[_0xb0c9('0x38')]['offset']);}_0x3dae41[_0xb0c9('0x3f')]=qs['sort'](_0x33f8b8[_0xb0c9('0x38')]['sort']);_0x3dae41[_0xb0c9('0x40')]=qs[_0xb0c9('0x3a')](_[_0xb0c9('0x41')](_0x33f8b8[_0xb0c9('0x38')],_0x2f23e1['filters']),_0x48750b);if(_0x33f8b8[_0xb0c9('0x38')][_0xb0c9('0x42')]){_0x3dae41[_0xb0c9('0x40')]=_[_0xb0c9('0x43')](_0x3dae41['where'],{'$or':[{'key':{'$like':'%'+_0x33f8b8['query'][_0xb0c9('0x42')]+'%'}},{'value':{'$like':'%'+_0x33f8b8[_0xb0c9('0x38')]['filter']+'%'}}]});}_0x3dae41=_[_0xb0c9('0x43')]({},_0x3dae41,_0x33f8b8[_0xb0c9('0x44')]);var _0x4d0ae3={'where':_0x3dae41[_0xb0c9('0x40')]};return db[_0xb0c9('0x45')][_0xb0c9('0x22')](_0x4d0ae3)[_0xb0c9('0x2b')](function(_0x3f8468){_0x19a240[_0xb0c9('0x22')]=_0x3f8468;if(_0x33f8b8[_0xb0c9('0x38')][_0xb0c9('0x46')]){_0x3dae41[_0xb0c9('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb0c9('0x48')](_0x3dae41);})[_0xb0c9('0x2b')](function(_0x31810c){_0x19a240[_0xb0c9('0x49')]=_0x31810c;return _0x19a240;})[_0xb0c9('0x2b')](respondWithFilteredResult(_0x519cee,_0x3dae41))[_0xb0c9('0x4a')](handleError(_0x519cee,null));};exports[_0xb0c9('0x4b')]=function(_0x4e035b,_0x362488){var _0x305e35={'raw':!![],'where':{'id':_0x4e035b[_0xb0c9('0x4c')]['id']}},_0x144839={};_0x144839[_0xb0c9('0x36')]=_[_0xb0c9('0x39')](db['CannedAnswer'][_0xb0c9('0x32')]);_0x144839[_0xb0c9('0x38')]=_[_0xb0c9('0x39')](_0x4e035b[_0xb0c9('0x38')]);_0x144839[_0xb0c9('0x3a')]=_['intersection'](_0x144839[_0xb0c9('0x36')],_0x144839[_0xb0c9('0x38')]);_0x305e35[_0xb0c9('0x3d')]=_[_0xb0c9('0x3b')](_0x144839[_0xb0c9('0x36')],qs[_0xb0c9('0x3c')](_0x4e035b[_0xb0c9('0x38')][_0xb0c9('0x3c')]));_0x305e35[_0xb0c9('0x3d')]=_0x305e35[_0xb0c9('0x3d')][_0xb0c9('0x4d')]?_0x305e35[_0xb0c9('0x3d')]:_0x144839[_0xb0c9('0x36')];if(_0x4e035b[_0xb0c9('0x38')][_0xb0c9('0x46')]){_0x305e35['include']=[{'all':!![]}];}_0x305e35=_[_0xb0c9('0x43')]({},_0x305e35,_0x4e035b[_0xb0c9('0x44')]);return db[_0xb0c9('0x45')][_0xb0c9('0x4e')](_0x305e35)[_0xb0c9('0x2b')](handleEntityNotFound(_0x362488,null))[_0xb0c9('0x2b')](respondWithResult(_0x362488,null))[_0xb0c9('0x4a')](handleError(_0x362488,null));};exports['update']=function(_0x48c7dc,_0x3d81bf){if(_0x48c7dc['body']['id']){delete _0x48c7dc[_0xb0c9('0x4f')]['id'];}return db['CannedAnswer'][_0xb0c9('0x4e')]({'where':{'id':_0x48c7dc['params']['id']}})[_0xb0c9('0x2b')](handleEntityNotFound(_0x3d81bf,null))['then'](saveUpdates(_0x48c7dc[_0xb0c9('0x4f')],null))[_0xb0c9('0x2b')](respondWithResult(_0x3d81bf,null))[_0xb0c9('0x4a')](handleError(_0x3d81bf,null));};exports[_0xb0c9('0x2a')]=function(_0x2898c9,_0x46ebe4){return db[_0xb0c9('0x45')][_0xb0c9('0x4e')]({'where':{'id':_0x2898c9[_0xb0c9('0x4c')]['id']}})[_0xb0c9('0x2b')](handleEntityNotFound(_0x46ebe4,null))['then'](removeEntity(_0x46ebe4,null))[_0xb0c9('0x4a')](handleError(_0x46ebe4,null));};exports[_0xb0c9('0x50')]=function(_0x1c15ab,_0x1d3f60){var _0x2c267c={'key':_0x1c15ab[_0xb0c9('0x4f')]['key']};if(_0x1c15ab[_0xb0c9('0x4f')][_0xb0c9('0x51')]){_0x2c267c['MailAccountId']=_0x1c15ab[_0xb0c9('0x4f')][_0xb0c9('0x51')];}else if(_0x1c15ab[_0xb0c9('0x4f')][_0xb0c9('0x52')]){_0x2c267c[_0xb0c9('0x52')]=_0x1c15ab[_0xb0c9('0x4f')][_0xb0c9('0x52')];}else if(_0x1c15ab['body'][_0xb0c9('0x53')]){_0x2c267c[_0xb0c9('0x53')]=_0x1c15ab['body'][_0xb0c9('0x53')];}else if(_0x1c15ab[_0xb0c9('0x4f')][_0xb0c9('0x54')]){_0x2c267c[_0xb0c9('0x54')]=_0x1c15ab[_0xb0c9('0x4f')][_0xb0c9('0x54')];}return db[_0xb0c9('0x45')]['find']({'where':_0x2c267c})['then'](function(_0x4792b1){if(_0x4792b1){throw new db[(_0xb0c9('0x55'))][(_0xb0c9('0x56'))](_0xb0c9('0x57'));}return db[_0xb0c9('0x45')][_0xb0c9('0x50')](_0x1c15ab[_0xb0c9('0x4f')]);})[_0xb0c9('0x2b')](function(_0x166584){var _0x4fa029=_0x1c15ab[_0xb0c9('0x58')][_0xb0c9('0x2c')]({'plain':!![]});if(!_0x4fa029)throw new Error(_0xb0c9('0x59'));if(_0x4fa029[_0xb0c9('0x5a')]===_0xb0c9('0x58')){var _0x243b4b=_0x166584[_0xb0c9('0x2c')]({'plain':!![]});return db[_0xb0c9('0x5b')][_0xb0c9('0x4e')]({'where':{'name':_0xb0c9('0x2d'),'userProfileId':_0x4fa029[_0xb0c9('0x5c')]},'raw':!![]})[_0xb0c9('0x2b')](function(_0x250e39){if(_0x250e39&&_0x250e39[_0xb0c9('0x5d')]===0x0){return db[_0xb0c9('0x5e')]['create']({'name':_0x243b4b['name'],'resourceId':_0x243b4b['id'],'type':_0x250e39[_0xb0c9('0x31')],'sectionId':_0x250e39['id']},{})[_0xb0c9('0x2b')](function(){return _0x166584;});}else{return _0x166584;}})[_0xb0c9('0x4a')](function(_0x31ba38){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31ba38);throw _0x31ba38;});}return _0x166584;})[_0xb0c9('0x2b')](respondWithResult(_0x1d3f60,0xc9))[_0xb0c9('0x4a')](handleError(_0x1d3f60,null));}; \ No newline at end of file +var _0xd08a=['keys','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','show','intersection','length','catch','body','find','params','destroy','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','stack','name','send','index','map','rawAttributes','type','query'];(function(_0x2e8660,_0x5ca0c2){var _0x3dc331=function(_0x20f7c1){while(--_0x20f7c1){_0x2e8660['push'](_0x2e8660['shift']());}};_0x3dc331(++_0x5ca0c2);}(_0xd08a,0x7f));var _0xad08=function(_0x34560a,_0x2c9041){_0x34560a=_0x34560a-0x0;var _0x4b208b=_0xd08a[_0x34560a];return _0x4b208b;};'use strict';var emlformat=require(_0xad08('0x0'));var rimraf=require(_0xad08('0x1'));var zipdir=require(_0xad08('0x2'));var jsonpatch=require(_0xad08('0x3'));var rp=require(_0xad08('0x4'));var moment=require('moment');var BPromise=require(_0xad08('0x5'));var Mustache=require(_0xad08('0x6'));var util=require(_0xad08('0x7'));var path=require(_0xad08('0x8'));var sox=require(_0xad08('0x9'));var csv=require(_0xad08('0xa'));var ejs=require(_0xad08('0xb'));var fs=require('fs');var fs_extra=require(_0xad08('0xc'));var _=require(_0xad08('0xd'));var squel=require('squel');var crypto=require(_0xad08('0xe'));var jsforce=require(_0xad08('0xf'));var deskjs=require(_0xad08('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad08('0x11'));var Redis=require(_0xad08('0x12'));var authService=require(_0xad08('0x13'));var qs=require(_0xad08('0x14'));var as=require(_0xad08('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad08('0x16'))(_0xad08('0x17'));var utils=require(_0xad08('0x18'));var config=require(_0xad08('0x19'));var licenseUtil=require(_0xad08('0x1a'));var db=require(_0xad08('0x1b'))['db'];function respondWithStatusCode(_0x40bfa7,_0x2e1359){_0x2e1359=_0x2e1359||0xcc;return function(_0x5de9ec){if(_0x5de9ec){return _0x40bfa7[_0xad08('0x1c')](_0x2e1359);}return _0x40bfa7[_0xad08('0x1d')](_0x2e1359)[_0xad08('0x1e')]();};}function respondWithResult(_0x19eb6a,_0x176ec4){_0x176ec4=_0x176ec4||0xc8;return function(_0x58d52c){if(_0x58d52c){return _0x19eb6a[_0xad08('0x1d')](_0x176ec4)['json'](_0x58d52c);}};}function respondWithFilteredResult(_0x3e5daf,_0x260f02){return function(_0x5b8ecd){if(_0x5b8ecd){var _0x1f4e1c=typeof _0x260f02[_0xad08('0x1f')]===_0xad08('0x20')&&typeof _0x260f02[_0xad08('0x21')]===_0xad08('0x20');var _0x150a32=_0x5b8ecd[_0xad08('0x22')];var _0xd27ccf=_0x1f4e1c?0x0:_0x260f02[_0xad08('0x1f')];var _0x4214ce=_0x1f4e1c?_0x5b8ecd[_0xad08('0x22')]:_0x260f02[_0xad08('0x1f')]+_0x260f02[_0xad08('0x21')];var _0x2e1419;if(_0x4214ce>=_0x150a32){_0x4214ce=_0x150a32;_0x2e1419=0xc8;}else{_0x2e1419=0xce;}_0x3e5daf[_0xad08('0x1d')](_0x2e1419);return _0x3e5daf[_0xad08('0x23')](_0xad08('0x24'),_0xd27ccf+'-'+_0x4214ce+'/'+_0x150a32)['json'](_0x5b8ecd);}return null;};}function patchUpdates(_0x21bb3e){return function(_0x1682eb){try{jsonpatch[_0xad08('0x25')](_0x1682eb,_0x21bb3e,!![]);}catch(_0x389bc9){return BPromise[_0xad08('0x26')](_0x389bc9);}return _0x1682eb[_0xad08('0x27')]();};}function saveUpdates(_0x200482,_0x102c0b){return function(_0x2ac414){if(_0x2ac414){return _0x2ac414[_0xad08('0x28')](_0x200482)[_0xad08('0x29')](function(_0x2a5911){return _0x2a5911;});}return null;};}function removeEntity(_0x10c4df,_0x379962){return function(_0x56b57b){if(_0x56b57b){return _0x56b57b['destroy']()[_0xad08('0x29')](function(){var _0x1b9455=_0x56b57b[_0xad08('0x2a')]({'plain':!![]});var _0x172537=_0xad08('0x2b');return db[_0xad08('0x2c')]['destroy']({'where':{'type':_0x172537,'resourceId':_0x1b9455['id']}})[_0xad08('0x29')](function(){return _0x56b57b;});})[_0xad08('0x29')](function(){_0x10c4df['status'](0xcc)[_0xad08('0x1e')]();});}};}function handleEntityNotFound(_0xcb5df9,_0x522fc0){return function(_0x44ddf3){if(!_0x44ddf3){_0xcb5df9[_0xad08('0x1c')](0x194);}return _0x44ddf3;};}function handleError(_0x1ec693,_0x2bf7e8){_0x2bf7e8=_0x2bf7e8||0x1f4;return function(_0x26e53a){logger['error'](_0x26e53a[_0xad08('0x2d')]);if(_0x26e53a[_0xad08('0x2e')]){delete _0x26e53a[_0xad08('0x2e')];}_0x1ec693[_0xad08('0x1d')](_0x2bf7e8)[_0xad08('0x2f')](_0x26e53a);};}exports[_0xad08('0x30')]=function(_0x57f2be,_0xf735b7){var _0x3717f1={},_0x2b1bca={},_0x25d5de={'count':0x0,'rows':[]};var _0x35482b=_[_0xad08('0x31')](db['CannedAnswer'][_0xad08('0x32')],function(_0x1167f0){return{'name':_0x1167f0['fieldName'],'type':_0x1167f0[_0xad08('0x33')]['key']};});_0x2b1bca['model']=_[_0xad08('0x31')](_0x35482b,_0xad08('0x2e'));_0x2b1bca[_0xad08('0x34')]=_[_0xad08('0x35')](_0x57f2be['query']);_0x2b1bca['filters']=_['intersection'](_0x2b1bca[_0xad08('0x36')],_0x2b1bca[_0xad08('0x34')]);_0x3717f1['attributes']=_['intersection'](_0x2b1bca[_0xad08('0x36')],qs[_0xad08('0x37')](_0x57f2be[_0xad08('0x34')]['fields']));_0x3717f1[_0xad08('0x38')]=_0x3717f1[_0xad08('0x38')]['length']?_0x3717f1['attributes']:_0x2b1bca[_0xad08('0x36')];if(!_0x57f2be['query'][_0xad08('0x39')](_0xad08('0x3a'))){_0x3717f1[_0xad08('0x21')]=qs[_0xad08('0x21')](_0x57f2be[_0xad08('0x34')][_0xad08('0x21')]);_0x3717f1['offset']=qs[_0xad08('0x1f')](_0x57f2be['query'][_0xad08('0x1f')]);}_0x3717f1[_0xad08('0x3b')]=qs[_0xad08('0x3c')](_0x57f2be['query'][_0xad08('0x3c')]);_0x3717f1[_0xad08('0x3d')]=qs[_0xad08('0x3e')](_[_0xad08('0x3f')](_0x57f2be['query'],_0x2b1bca['filters']),_0x35482b);if(_0x57f2be[_0xad08('0x34')][_0xad08('0x40')]){_0x3717f1[_0xad08('0x3d')]=_[_0xad08('0x41')](_0x3717f1[_0xad08('0x3d')],{'$or':[{'key':{'$like':'%'+_0x57f2be['query'][_0xad08('0x40')]+'%'}},{'value':{'$like':'%'+_0x57f2be['query'][_0xad08('0x40')]+'%'}}]});}_0x3717f1=_['merge']({},_0x3717f1,_0x57f2be[_0xad08('0x42')]);var _0x2f4612={'where':_0x3717f1['where']};return db[_0xad08('0x43')][_0xad08('0x22')](_0x2f4612)[_0xad08('0x29')](function(_0x4559f1){_0x25d5de['count']=_0x4559f1;if(_0x57f2be[_0xad08('0x34')][_0xad08('0x44')]){_0x3717f1[_0xad08('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0xad08('0x46')](_0x3717f1);})[_0xad08('0x29')](function(_0x5164eb){_0x25d5de[_0xad08('0x47')]=_0x5164eb;return _0x25d5de;})['then'](respondWithFilteredResult(_0xf735b7,_0x3717f1))['catch'](handleError(_0xf735b7,null));};exports[_0xad08('0x48')]=function(_0xb9a8c7,_0x5a4fac){var _0x540515={'raw':!![],'where':{'id':_0xb9a8c7['params']['id']}},_0x153f7e={};_0x153f7e['model']=_[_0xad08('0x35')](db['CannedAnswer'][_0xad08('0x32')]);_0x153f7e[_0xad08('0x34')]=_[_0xad08('0x35')](_0xb9a8c7[_0xad08('0x34')]);_0x153f7e[_0xad08('0x3e')]=_[_0xad08('0x49')](_0x153f7e[_0xad08('0x36')],_0x153f7e['query']);_0x540515[_0xad08('0x38')]=_[_0xad08('0x49')](_0x153f7e[_0xad08('0x36')],qs[_0xad08('0x37')](_0xb9a8c7[_0xad08('0x34')][_0xad08('0x37')]));_0x540515[_0xad08('0x38')]=_0x540515[_0xad08('0x38')][_0xad08('0x4a')]?_0x540515[_0xad08('0x38')]:_0x153f7e[_0xad08('0x36')];if(_0xb9a8c7[_0xad08('0x34')][_0xad08('0x44')]){_0x540515['include']=[{'all':!![]}];}_0x540515=_[_0xad08('0x41')]({},_0x540515,_0xb9a8c7['options']);return db[_0xad08('0x43')]['find'](_0x540515)[_0xad08('0x29')](handleEntityNotFound(_0x5a4fac,null))[_0xad08('0x29')](respondWithResult(_0x5a4fac,null))[_0xad08('0x4b')](handleError(_0x5a4fac,null));};exports[_0xad08('0x28')]=function(_0x396c0f,_0x2a4006){if(_0x396c0f[_0xad08('0x4c')]['id']){delete _0x396c0f['body']['id'];}return db[_0xad08('0x43')][_0xad08('0x4d')]({'where':{'id':_0x396c0f[_0xad08('0x4e')]['id']}})[_0xad08('0x29')](handleEntityNotFound(_0x2a4006,null))[_0xad08('0x29')](saveUpdates(_0x396c0f[_0xad08('0x4c')],null))['then'](respondWithResult(_0x2a4006,null))[_0xad08('0x4b')](handleError(_0x2a4006,null));};exports[_0xad08('0x4f')]=function(_0xf6de3a,_0xcacae3){return db[_0xad08('0x43')][_0xad08('0x4d')]({'where':{'id':_0xf6de3a['params']['id']}})[_0xad08('0x29')](handleEntityNotFound(_0xcacae3,null))[_0xad08('0x29')](removeEntity(_0xcacae3,null))[_0xad08('0x4b')](handleError(_0xcacae3,null));};exports[_0xad08('0x50')]=function(_0x1991b8,_0x41b150){var _0x2a9670={'key':_0x1991b8[_0xad08('0x4c')][_0xad08('0x51')]};if(_0x1991b8[_0xad08('0x4c')][_0xad08('0x52')]){_0x2a9670[_0xad08('0x52')]=_0x1991b8[_0xad08('0x4c')]['MailAccountId'];}else if(_0x1991b8[_0xad08('0x4c')][_0xad08('0x53')]){_0x2a9670[_0xad08('0x53')]=_0x1991b8[_0xad08('0x4c')]['SmsAccountId'];}else if(_0x1991b8[_0xad08('0x4c')][_0xad08('0x54')]){_0x2a9670[_0xad08('0x54')]=_0x1991b8[_0xad08('0x4c')][_0xad08('0x54')];}else if(_0x1991b8[_0xad08('0x4c')][_0xad08('0x55')]){_0x2a9670[_0xad08('0x55')]=_0x1991b8[_0xad08('0x4c')][_0xad08('0x55')];}return db[_0xad08('0x43')]['find']({'where':_0x2a9670})[_0xad08('0x29')](function(_0x383ab7){if(_0x383ab7){throw new db['Sequelize'][(_0xad08('0x56'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xad08('0x43')][_0xad08('0x50')](_0x1991b8['body']);})[_0xad08('0x29')](function(_0x5f5cb5){var _0x3b2055=_0x1991b8[_0xad08('0x57')]['get']({'plain':!![]});if(!_0x3b2055)throw new Error(_0xad08('0x58'));if(_0x3b2055['role']===_0xad08('0x57')){var _0x266c02=_0x5f5cb5['get']({'plain':!![]});return db[_0xad08('0x59')][_0xad08('0x4d')]({'where':{'name':_0xad08('0x2b'),'userProfileId':_0x3b2055['userProfileId']},'raw':!![]})[_0xad08('0x29')](function(_0x5beffa){if(_0x5beffa&&_0x5beffa['autoAssociation']===0x0){return db['UserProfileResource'][_0xad08('0x50')]({'name':_0x266c02[_0xad08('0x2e')],'resourceId':_0x266c02['id'],'type':_0x5beffa[_0xad08('0x2e')],'sectionId':_0x5beffa['id']},{})[_0xad08('0x29')](function(){return _0x5f5cb5;});}else{return _0x5f5cb5;}})[_0xad08('0x4b')](function(_0x5d9e21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d9e21);throw _0x5d9e21;});}return _0x5f5cb5;})[_0xad08('0x29')](respondWithResult(_0x41b150,0xc9))[_0xad08('0x4b')](handleError(_0x41b150,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 34f9ef8..4f17731 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 _0xe6d7=['moment','bluebird','request-promise','rimraf','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0x371125,_0x17e4d5){var _0x5cb7c2=function(_0x30d14f){while(--_0x30d14f){_0x371125['push'](_0x371125['shift']());}};_0x5cb7c2(++_0x17e4d5);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x56a06f,_0x183813){_0x56a06f=_0x56a06f-0x0;var _0x3309ac=_0xe6d7[_0x56a06f];return _0x3309ac;};'use strict';var _=require('lodash');var util=require(_0x7e6d('0x0'));var logger=require('../../config/logger')(_0x7e6d('0x1'));var moment=require(_0x7e6d('0x2'));var BPromise=require(_0x7e6d('0x3'));var rp=require(_0x7e6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e6d('0x5'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x7e6d('0x6')]=function(_0x23c09e,_0x4faafe){return _0x23c09e[_0x7e6d('0x7')](_0x7e6d('0x8'),attributes,{'tableName':_0x7e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e6d('0xa'),'collate':_0x7e6d('0xb')});}; \ No newline at end of file +var _0x6de3=['../../config/logger','api','moment','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util'];(function(_0x2265d4,_0x4f04cb){var _0x4d951b=function(_0x591a87){while(--_0x591a87){_0x2265d4['push'](_0x2265d4['shift']());}};_0x4d951b(++_0x4f04cb);}(_0x6de3,0x17e));var _0x36de=function(_0x249945,_0x1d01ae){_0x249945=_0x249945-0x0;var _0x29e663=_0x6de3[_0x249945];return _0x29e663;};'use strict';var _=require(_0x36de('0x0'));var util=require(_0x36de('0x1'));var logger=require(_0x36de('0x2'))(_0x36de('0x3'));var moment=require(_0x36de('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x36de('0x5'));var rimraf=require('rimraf');var config=require(_0x36de('0x6'));var attributes=require(_0x36de('0x7'));module[_0x36de('0x8')]=function(_0x2750cc,_0x429f4e){return _0x2750cc['define'](_0x36de('0x9'),attributes,{'tableName':_0x36de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x36de('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 618b99a..c7037f4 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(_0x1be012,_0x6096aa){var _0x468448=function(_0x438183){while(--_0x438183){_0x1be012['push'](_0x1be012['shift']());}};_0x468448(++_0x6096aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x16331a,_0x51e8e4){var _0x3475c5=function(_0x3a749f){while(--_0x3a749f){_0x16331a['push'](_0x16331a['shift']());}};_0x3475c5(++_0x51e8e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index af80bce..2b0890c 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 _0xb676=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb676,0x8c));var _0x6b67=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb676[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x6b67('0x0'));var util=require('util');var path=require(_0x6b67('0x1'));var timeout=require(_0x6b67('0x2'));var express=require(_0x6b67('0x3'));var router=express['Router']();var fs_extra=require(_0x6b67('0x4'));var auth=require(_0x6b67('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6b67('0x6'));var controller=require(_0x6b67('0x7'));router[_0x6b67('0x8')]('/',auth[_0x6b67('0x9')](),controller[_0x6b67('0xa')]);router[_0x6b67('0x8')](_0x6b67('0xb'),auth['isAuthenticated'](),controller[_0x6b67('0xc')]);router[_0x6b67('0xd')]('/',auth[_0x6b67('0x9')](),controller[_0x6b67('0xe')]);router[_0x6b67('0xf')](_0x6b67('0xb'),auth['isAuthenticated'](),controller[_0x6b67('0x10')]);router[_0x6b67('0x11')](_0x6b67('0xb'),auth[_0x6b67('0x9')](),controller[_0x6b67('0x12')]);module[_0x6b67('0x13')]=router; \ No newline at end of file +var _0x7725=['get','isAuthenticated','index','post','create','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x7725,0x118));var _0x5772=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x7725[_0x7feb90];return _0x3c5b33;};'use strict';var multer=require(_0x5772('0x0'));var util=require(_0x5772('0x1'));var path=require('path');var timeout=require(_0x5772('0x2'));var express=require(_0x5772('0x3'));var router=express[_0x5772('0x4')]();var fs_extra=require(_0x5772('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5772('0x6'));var config=require(_0x5772('0x7'));var controller=require(_0x5772('0x8'));router[_0x5772('0x9')]('/',auth[_0x5772('0xa')](),controller[_0x5772('0xb')]);router[_0x5772('0x9')]('/:id',auth[_0x5772('0xa')](),controller['show']);router[_0x5772('0xc')]('/',auth[_0x5772('0xa')](),controller[_0x5772('0xd')]);router['put'](_0x5772('0xe'),auth[_0x5772('0xa')](),controller['update']);router['delete'](_0x5772('0xe'),auth[_0x5772('0xa')](),controller[_0x5772('0xf')]);module[_0x5772('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 877b5b9..acc7f77 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 _0xa7a3=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa7a3,0x7c));var _0x3a7a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa7a3[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x3a7a('0x0'));module[_0x3a7a('0x1')]={'calldate':{'type':Sequelize[_0x3a7a('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x3a7a('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x3a7a('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3a7a('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x3a7a('0x3')]},'lastdata':{'type':Sequelize[_0x3a7a('0x3')]},'duration':{'type':Sequelize[_0x3a7a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3a7a('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3a7a('0x3')]},'amaflags':{'type':Sequelize[_0x3a7a('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3a7a('0x3')]},'userfield':{'type':Sequelize[_0x3a7a('0x3')]},'uniqueid':{'type':Sequelize[_0x3a7a('0x3')]},'linkedid':{'type':Sequelize[_0x3a7a('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x3a7a('0x3')]},'type':{'type':Sequelize[_0x3a7a('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6aa0=['exports','DATE','STRING','INTEGER'];(function(_0x54dcce,_0x28c9d1){var _0x537f5a=function(_0x5c533b){while(--_0x5c533b){_0x54dcce['push'](_0x54dcce['shift']());}};_0x537f5a(++_0x28c9d1);}(_0x6aa0,0xb8));var _0x06aa=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x6aa0[_0x3a04ab];return _0x4bff6d;};'use strict';var Sequelize=require('sequelize');module[_0x06aa('0x0')]={'calldate':{'type':Sequelize[_0x06aa('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x06aa('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x06aa('0x2')]},'dcontext':{'type':Sequelize[_0x06aa('0x2')]},'channel':{'type':Sequelize[_0x06aa('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x06aa('0x2')]},'lastdata':{'type':Sequelize[_0x06aa('0x2')]},'duration':{'type':Sequelize[_0x06aa('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x06aa('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x06aa('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x06aa('0x2')]},'userfield':{'type':Sequelize[_0x06aa('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x06aa('0x2')]},'sequence':{'type':Sequelize[_0x06aa('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x06aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 543326c..3931109 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 _0x2eb2=['ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x262eb8,_0x574c0b){var _0x30179c=function(_0x6db3a7){while(--_0x6db3a7){_0x262eb8['push'](_0x262eb8['shift']());}};_0x30179c(++_0x574c0b);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2eb2[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x26')](_0x1599c7,'name');_0x44cf91[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x49dd59[_0x22eb('0x2c')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],_0x44cf91[_0x22eb('0x2c')]);_0x25e5bc[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],qs['fields'](_0x49dd59['query'][_0x22eb('0x32')]));_0x25e5bc['attributes']=_0x25e5bc['attributes'][_0x22eb('0x33')]?_0x25e5bc[_0x22eb('0x31')]:_0x44cf91[_0x22eb('0x30')];if(!_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x25e5bc[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x25e5bc['offset']=qs[_0x22eb('0x19')](_0x49dd59['query']['offset']);}_0x25e5bc[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_[_0x22eb('0x3a')](_0x49dd59[_0x22eb('0x2c')],_0x44cf91['filters']),_0x1599c7);if(_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x3b')]){_0x25e5bc['where']=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x2cc77c){if(_0x2cc77c[_0x22eb('0x2a')]!=='VIRTUAL'){var _0x51c8b5={};_0x51c8b5[_0x2cc77c[_0x22eb('0x24')]]={'$like':'%'+_0x49dd59[_0x22eb('0x2c')]['filter']+'%'};return _0x51c8b5;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59[_0x22eb('0x3d')]);var _0x46c6a1={'where':_0x25e5bc['where']};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x46c6a1)[_0x22eb('0x20')](function(_0x2a8517){_0x7c0119[_0x22eb('0x1b')]=_0x2a8517;if(_0x49dd59[_0x22eb('0x2c')]['includeAll']){_0x25e5bc[_0x22eb('0x3e')]=[{'all':!![]}];}return db[_0x22eb('0x27')]['findAll'](_0x25e5bc);})[_0x22eb('0x20')](function(_0x44d39f){_0x7c0119[_0x22eb('0x3f')]=_0x44d39f;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x40')](handleError(_0x2a950e,null));};exports[_0x22eb('0x41')]=function(_0x1ff04a,_0x78b250){var _0x1bafa3={'raw':!![],'where':{'id':_0x1ff04a[_0x22eb('0x42')]['id']}},_0x82ace8={};_0x82ace8[_0x22eb('0x30')]=_[_0x22eb('0x2d')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x82ace8[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x1ff04a[_0x22eb('0x2c')]);_0x82ace8['filters']=_[_0x22eb('0x2f')](_0x82ace8[_0x22eb('0x30')],_0x82ace8['query']);_0x1bafa3[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x82ace8['model'],qs['fields'](_0x1ff04a['query'][_0x22eb('0x32')]));_0x1bafa3[_0x22eb('0x31')]=_0x1bafa3['attributes']['length']?_0x1bafa3[_0x22eb('0x31')]:_0x82ace8[_0x22eb('0x30')];if(_0x1ff04a[_0x22eb('0x2c')][_0x22eb('0x43')]){_0x1bafa3[_0x22eb('0x3e')]=[{'all':!![]}];}_0x1bafa3=_[_0x22eb('0x3c')]({},_0x1bafa3,_0x1ff04a[_0x22eb('0x3d')]);return db[_0x22eb('0x27')]['find'](_0x1bafa3)['then'](handleEntityNotFound(_0x78b250,null))[_0x22eb('0x20')](respondWithResult(_0x78b250,null))['catch'](handleError(_0x78b250,null));};exports[_0x22eb('0x44')]=function(_0x4bd819,_0x8a2b2c){return db['Cdr']['create'](_0x4bd819['body'],{})['then'](respondWithResult(_0x8a2b2c,0xc9))[_0x22eb('0x40')](handleError(_0x8a2b2c,null));};exports['update']=function(_0x320211,_0x3b35c6){if(_0x320211['body']['id']){delete _0x320211[_0x22eb('0x45')]['id'];}return db['Cdr'][_0x22eb('0x46')]({'where':{'id':_0x320211[_0x22eb('0x42')]['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x3b35c6,null))[_0x22eb('0x20')](saveUpdates(_0x320211[_0x22eb('0x45')],null))[_0x22eb('0x20')](respondWithResult(_0x3b35c6,null))[_0x22eb('0x40')](handleError(_0x3b35c6,null));};exports[_0x22eb('0x21')]=function(_0x11942d,_0x527ef1){return db[_0x22eb('0x27')][_0x22eb('0x46')]({'where':{'id':_0x11942d['params']['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x527ef1,null))[_0x22eb('0x20')](removeEntity(_0x527ef1,null))[_0x22eb('0x40')](handleError(_0x527ef1,null));};exports[_0x22eb('0x47')]=function(_0x4fee5c,_0x6c0600){return db[_0x22eb('0x27')][_0x22eb('0x47')]()[_0x22eb('0x20')](respondWithResult(_0x6c0600,null))[_0x22eb('0x40')](handleError(_0x6c0600,null));}; \ No newline at end of file +var _0xc949=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Cdr','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','catch','rawAttributes','intersection','include','find','create','body','params','describe'];(function(_0x4980e3,_0x50746c){var _0x469ab9=function(_0xd25a01){while(--_0xd25a01){_0x4980e3['push'](_0x4980e3['shift']());}};_0x469ab9(++_0x50746c);}(_0xc949,0x181));var _0x9c94=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xc949[_0x1e3c16];return _0x47a0c9;};'use strict';var emlformat=require(_0x9c94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c94('0x1'));var jsonpatch=require(_0x9c94('0x2'));var rp=require(_0x9c94('0x3'));var moment=require(_0x9c94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c94('0x5'));var util=require(_0x9c94('0x6'));var path=require('path');var sox=require(_0x9c94('0x7'));var csv=require(_0x9c94('0x8'));var ejs=require(_0x9c94('0x9'));var fs=require('fs');var fs_extra=require(_0x9c94('0xa'));var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x8'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=typeof _0x4f0013['offset']===_0x9c94('0x1f')&&typeof _0x4f0013['limit']===_0x9c94('0x1f');var _0x33bd19=_0xe52641['count'];var _0x201e04=_0x4d6308?0x0:_0x4f0013[_0x9c94('0x20')];var _0x412804=_0x4d6308?_0xe52641[_0x9c94('0x21')]:_0x4f0013[_0x9c94('0x20')]+_0x4f0013[_0x9c94('0x22')];var _0x3e361c;if(_0x412804>=_0x33bd19){_0x412804=_0x33bd19;_0x3e361c=0xc8;}else{_0x3e361c=0xce;}_0x26e629['status'](_0x3e361c);return _0x26e629[_0x9c94('0x23')](_0x9c94('0x24'),_0x201e04+'-'+_0x412804+'/'+_0x33bd19)['json'](_0xe52641);}return null;};}function patchUpdates(_0x141801){return function(_0x845304){try{jsonpatch[_0x9c94('0x25')](_0x845304,_0x141801,!![]);}catch(_0x326b38){return BPromise[_0x9c94('0x26')](_0x326b38);}return _0x845304[_0x9c94('0x27')]();};}function saveUpdates(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x28')](_0xadab16)[_0x9c94('0x29')](function(_0xe9280a){return _0xe9280a;});}return null;};}function removeEntity(_0x44d732,_0x8c0b7f){return function(_0x5b1020){if(_0x5b1020){return _0x5b1020[_0x9c94('0x2a')]()[_0x9c94('0x29')](function(){_0x44d732['status'](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x2c3d25,_0x4795bb){return function(_0x335184){if(!_0x335184){_0x2c3d25[_0x9c94('0x1b')](0x194);}return _0x335184;};}function handleError(_0x4dd38e,_0xc18230){_0xc18230=_0xc18230||0x1f4;return function(_0x45cf4d){logger['error'](_0x45cf4d[_0x9c94('0x2b')]);if(_0x45cf4d['name']){delete _0x45cf4d[_0x9c94('0x2c')];}_0x4dd38e[_0x9c94('0x1c')](_0xc18230)[_0x9c94('0x2d')](_0x45cf4d);};}exports[_0x9c94('0x2e')]=function(_0x1581c0,_0x3f2622){var _0xf30dd1={},_0x561fdc={},_0x5a6b1c={'count':0x0,'rows':[]};var _0xc4a819=_[_0x9c94('0x2f')](db[_0x9c94('0x30')]['rawAttributes'],function(_0x25a6b9){return{'name':_0x25a6b9['fieldName'],'type':_0x25a6b9[_0x9c94('0x31')][_0x9c94('0x32')]};});_0x561fdc[_0x9c94('0x33')]=_['map'](_0xc4a819,'name');_0x561fdc[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x1581c0[_0x9c94('0x34')]);_0x561fdc['filters']=_['intersection'](_0x561fdc['model'],_0x561fdc['query']);_0xf30dd1[_0x9c94('0x36')]=_['intersection'](_0x561fdc[_0x9c94('0x33')],qs[_0x9c94('0x37')](_0x1581c0['query']['fields']));_0xf30dd1[_0x9c94('0x36')]=_0xf30dd1[_0x9c94('0x36')][_0x9c94('0x38')]?_0xf30dd1[_0x9c94('0x36')]:_0x561fdc[_0x9c94('0x33')];if(!_0x1581c0[_0x9c94('0x34')][_0x9c94('0x39')](_0x9c94('0x3a'))){_0xf30dd1[_0x9c94('0x22')]=qs[_0x9c94('0x22')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x22')]);_0xf30dd1[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x20')]);}_0xf30dd1[_0x9c94('0x3b')]=qs[_0x9c94('0x3c')](_0x1581c0['query'][_0x9c94('0x3c')]);_0xf30dd1[_0x9c94('0x3d')]=qs[_0x9c94('0x3e')](_[_0x9c94('0x3f')](_0x1581c0[_0x9c94('0x34')],_0x561fdc[_0x9c94('0x3e')]),_0xc4a819);if(_0x1581c0[_0x9c94('0x34')]['filter']){_0xf30dd1[_0x9c94('0x3d')]=_['merge'](_0xf30dd1[_0x9c94('0x3d')],{'$or':_[_0x9c94('0x2f')](_0xc4a819,function(_0x442d46){if(_0x442d46[_0x9c94('0x31')]!=='VIRTUAL'){var _0x245278={};_0x245278[_0x442d46['name']]={'$like':'%'+_0x1581c0[_0x9c94('0x34')][_0x9c94('0x40')]+'%'};return _0x245278;}})});}_0xf30dd1=_[_0x9c94('0x41')]({},_0xf30dd1,_0x1581c0['options']);var _0x21e9f7={'where':_0xf30dd1['where']};return db[_0x9c94('0x30')]['count'](_0x21e9f7)['then'](function(_0x9a75f0){_0x5a6b1c[_0x9c94('0x21')]=_0x9a75f0;if(_0x1581c0[_0x9c94('0x34')][_0x9c94('0x42')]){_0xf30dd1['include']=[{'all':!![]}];}return db[_0x9c94('0x30')][_0x9c94('0x43')](_0xf30dd1);})[_0x9c94('0x29')](function(_0x360960){_0x5a6b1c['rows']=_0x360960;return _0x5a6b1c;})[_0x9c94('0x29')](respondWithFilteredResult(_0x3f2622,_0xf30dd1))[_0x9c94('0x44')](handleError(_0x3f2622,null));};exports['show']=function(_0x24e74c,_0x3d8b31){var _0x2a5bd5={'raw':!![],'where':{'id':_0x24e74c['params']['id']}},_0x5e6a90={};_0x5e6a90[_0x9c94('0x33')]=_[_0x9c94('0x35')](db[_0x9c94('0x30')][_0x9c94('0x45')]);_0x5e6a90[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x24e74c[_0x9c94('0x34')]);_0x5e6a90[_0x9c94('0x3e')]=_[_0x9c94('0x46')](_0x5e6a90[_0x9c94('0x33')],_0x5e6a90[_0x9c94('0x34')]);_0x2a5bd5['attributes']=_[_0x9c94('0x46')](_0x5e6a90['model'],qs[_0x9c94('0x37')](_0x24e74c[_0x9c94('0x34')][_0x9c94('0x37')]));_0x2a5bd5[_0x9c94('0x36')]=_0x2a5bd5[_0x9c94('0x36')][_0x9c94('0x38')]?_0x2a5bd5[_0x9c94('0x36')]:_0x5e6a90['model'];if(_0x24e74c['query'][_0x9c94('0x42')]){_0x2a5bd5[_0x9c94('0x47')]=[{'all':!![]}];}_0x2a5bd5=_[_0x9c94('0x41')]({},_0x2a5bd5,_0x24e74c['options']);return db[_0x9c94('0x30')][_0x9c94('0x48')](_0x2a5bd5)['then'](handleEntityNotFound(_0x3d8b31,null))['then'](respondWithResult(_0x3d8b31,null))['catch'](handleError(_0x3d8b31,null));};exports['create']=function(_0x2b94e0,_0x5362f4){return db['Cdr'][_0x9c94('0x49')](_0x2b94e0['body'],{})[_0x9c94('0x29')](respondWithResult(_0x5362f4,0xc9))[_0x9c94('0x44')](handleError(_0x5362f4,null));};exports[_0x9c94('0x28')]=function(_0x205f51,_0x22eaa4){if(_0x205f51['body']['id']){delete _0x205f51[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x30')][_0x9c94('0x48')]({'where':{'id':_0x205f51[_0x9c94('0x4b')]['id']}})[_0x9c94('0x29')](handleEntityNotFound(_0x22eaa4,null))[_0x9c94('0x29')](saveUpdates(_0x205f51['body'],null))[_0x9c94('0x29')](respondWithResult(_0x22eaa4,null))['catch'](handleError(_0x22eaa4,null));};exports[_0x9c94('0x2a')]=function(_0x38bb48,_0x426c0f){return db['Cdr'][_0x9c94('0x48')]({'where':{'id':_0x38bb48[_0x9c94('0x4b')]['id']}})['then'](handleEntityNotFound(_0x426c0f,null))[_0x9c94('0x29')](removeEntity(_0x426c0f,null))['catch'](handleError(_0x426c0f,null));};exports[_0x9c94('0x4c')]=function(_0x3aa1dd,_0x537c78){return db['Cdr'][_0x9c94('0x4c')]()['then'](respondWithResult(_0x537c78,null))[_0x9c94('0x44')](handleError(_0x537c78,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 16bf0a3..8c8c20d 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(_0x268728,_0x316451){var _0x29b729=function(_0x237a10){while(--_0x237a10){_0x268728['push'](_0x268728['shift']());}};_0x29b729(++_0x316451);}(_0x7a54,0x106));var _0x47a5=function(_0x421eea,_0x18dafd){_0x421eea=_0x421eea-0x0;var _0x54ecf2=_0x7a54[_0x421eea];return _0x54ecf2;};'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x9c5060,_0x1be4d7){var _0x420869=function(_0xf4d781){while(--_0xf4d781){_0x9c5060['push'](_0x9c5060['shift']());}};_0x420869(++_0x1be4d7);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ec4530c..e6519b7 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 _0x34fa=['error','message','request\x20sent','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44f68f,_0x415f98){var _0x2c3c90=function(_0x2876a0){while(--_0x2876a0){_0x44f68f['push'](_0x44f68f['shift']());}};_0x2c3c90(++_0x415f98);}(_0x34fa,0x9e));var _0xa34f=function(_0x2bb449,_0x510a6c){_0x2bb449=_0x2bb449-0x0;var _0x4ded01=_0x34fa[_0x2bb449];return _0x4ded01;};'use strict';var _=require('lodash');var util=require(_0xa34f('0x0'));var moment=require(_0xa34f('0x1'));var BPromise=require('bluebird');var rs=require(_0xa34f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa34f('0x3'))['db'];var utils=require(_0xa34f('0x4'));var logger=require(_0xa34f('0x5'))(_0xa34f('0x6'));var config=require(_0xa34f('0x7'));var jayson=require(_0xa34f('0x8'));var client=jayson[_0xa34f('0x9')][_0xa34f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3751ba,_0x249552,_0x5d800b){return new BPromise(function(_0x57c5a8,_0x3fa968){return client[_0xa34f('0xb')](_0x3751ba,_0x5d800b)[_0xa34f('0xc')](function(_0x389de2){logger[_0xa34f('0xd')](_0xa34f('0xe'),_0x249552,'request\x20sent');logger[_0xa34f('0xf')](_0xa34f('0x10'),_0x249552,'request\x20sent',JSON[_0xa34f('0x11')](_0x389de2));if(_0x389de2[_0xa34f('0x12')]){if(_0x389de2[_0xa34f('0x12')]['code']===0x1f4){logger[_0xa34f('0x12')]('Cdr,\x20%s,\x20%s',_0x249552,_0x389de2[_0xa34f('0x12')]['message']);return _0x3fa968(_0x389de2[_0xa34f('0x12')][_0xa34f('0x13')]);}logger['error'](_0xa34f('0xe'),_0x249552,_0x389de2['error'][_0xa34f('0x13')]);return _0x57c5a8(_0x389de2[_0xa34f('0x12')][_0xa34f('0x13')]);}else{logger[_0xa34f('0xd')](_0xa34f('0xe'),_0x249552,_0xa34f('0x14'));_0x57c5a8(_0x389de2[_0xa34f('0x15')]['message']);}})['catch'](function(_0x4e2f27){logger[_0xa34f('0x12')](_0xa34f('0xe'),_0x249552,_0x4e2f27);_0x3fa968(_0x4e2f27);});});} \ No newline at end of file +var _0xfa8b=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa8b,0xaa));var _0xbfa8=function(_0x52ce4a,_0x510b74){_0x52ce4a=_0x52ce4a-0x0;var _0x5213b4=_0xfa8b[_0x52ce4a];return _0x5213b4;};'use strict';var _=require('lodash');var util=require(_0xbfa8('0x0'));var moment=require(_0xbfa8('0x1'));var BPromise=require(_0xbfa8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfa8('0x3'));var db=require(_0xbfa8('0x4'))['db'];var utils=require(_0xbfa8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbfa8('0x6'));var jayson=require(_0xbfa8('0x7'));var client=jayson[_0xbfa8('0x8')][_0xbfa8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3533fd,_0x5293ac,_0x9e0d1e){return new BPromise(function(_0x2cf258,_0x5b2c30){return client[_0xbfa8('0xa')](_0x3533fd,_0x9e0d1e)[_0xbfa8('0xb')](function(_0x1308af){logger['info'](_0xbfa8('0xc'),_0x5293ac,_0xbfa8('0xd'));logger[_0xbfa8('0xe')](_0xbfa8('0xf'),_0x5293ac,_0xbfa8('0xd'),JSON[_0xbfa8('0x10')](_0x1308af));if(_0x1308af[_0xbfa8('0x11')]){if(_0x1308af[_0xbfa8('0x11')][_0xbfa8('0x12')]===0x1f4){logger[_0xbfa8('0x11')](_0xbfa8('0xc'),_0x5293ac,_0x1308af[_0xbfa8('0x11')][_0xbfa8('0x13')]);return _0x5b2c30(_0x1308af['error'][_0xbfa8('0x13')]);}logger[_0xbfa8('0x11')](_0xbfa8('0xc'),_0x5293ac,_0x1308af[_0xbfa8('0x11')][_0xbfa8('0x13')]);return _0x2cf258(_0x1308af['error']['message']);}else{logger[_0xbfa8('0x14')](_0xbfa8('0xc'),_0x5293ac,_0xbfa8('0xd'));_0x2cf258(_0x1308af[_0xbfa8('0x15')][_0xbfa8('0x13')]);}})[_0xbfa8('0x16')](function(_0x216092){logger[_0xbfa8('0x11')](_0xbfa8('0xc'),_0x5293ac,_0x216092);_0x5b2c30(_0x216092);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 81fb7fb..1a507f7 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x17b7e2,_0x46fd16){var _0x51bf60=function(_0xc7eda8){while(--_0xc7eda8){_0x17b7e2['push'](_0x17b7e2['shift']());}};_0x51bf60(++_0x46fd16);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xb10b[_0x1d70db];return _0x3060c6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _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(_0x2551dd,_0x5ba066){var _0x905704=function(_0x1c7c11){while(--_0x1c7c11){_0x2551dd['push'](_0x2551dd['shift']());}};_0x905704(++_0x5ba066);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 504663f..6ed5d5f 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 _0x2355=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2355,0x1cf));var _0x5235=function(_0x4923c7,_0x850d94){_0x4923c7=_0x4923c7-0x0;var _0x57e137=_0x2355[_0x4923c7];return _0x57e137;};'use strict';var Sequelize=require(_0x5235('0x0'));module[_0x5235('0x1')]={'priority':{'type':Sequelize[_0x5235('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5235('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5235('0x4')}}; \ No newline at end of file +var _0xab25=['noop','TEXT','sequelize','exports','STRING'];(function(_0x559430,_0x5b3a89){var _0x256849=function(_0x255f47){while(--_0x255f47){_0x559430['push'](_0x559430['shift']());}};_0x256849(++_0x5b3a89);}(_0xab25,0x1e7));var _0x5ab2=function(_0x5d0db4,_0x39ce09){_0x5d0db4=_0x5d0db4-0x0;var _0x472887=_0xab25[_0x5d0db4];return _0x472887;};'use strict';var Sequelize=require(_0x5ab2('0x0'));module[_0x5ab2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5ab2('0x2')],'allowNull':![],'defaultValue':_0x5ab2('0x3')},'appdata':{'type':Sequelize[_0x5ab2('0x4')]()},'description':{'type':Sequelize[_0x5ab2('0x2')]},'interval':{'type':Sequelize[_0x5ab2('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 071e327..5882af6 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 _0xe5b5=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','body','ChatApplication','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0xe5b5[_0x13ff53];return _0x290228;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x4da321,_0x1ebb11){return function(_0x75800d){if(!_0x75800d){_0x4da321[_0x5e5b('0x1b')](0x194);}return _0x75800d;};}function handleError(_0x5a2ba8,_0x988e5d){_0x988e5d=_0x988e5d||0x1f4;return function(_0xdb2863){logger['error'](_0xdb2863[_0x5e5b('0x29')]);if(_0xdb2863[_0x5e5b('0x2a')]){delete _0xdb2863[_0x5e5b('0x2a')];}_0x5a2ba8[_0x5e5b('0x1c')](_0x988e5d)[_0x5e5b('0x2b')](_0xdb2863);};}exports[_0x5e5b('0x2c')]=function(_0x2cb695,_0x2b4351){var _0x3f6b25={'raw':!![],'where':{'id':_0x2cb695[_0x5e5b('0x2d')]['id']}},_0x42da3b={};_0x42da3b[_0x5e5b('0x2e')]=_['keys'](db['ChatApplication'][_0x5e5b('0x2f')]);_0x42da3b[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x2cb695[_0x5e5b('0x30')]);_0x42da3b[_0x5e5b('0x32')]=_['intersection'](_0x42da3b[_0x5e5b('0x2e')],_0x42da3b['query']);_0x3f6b25[_0x5e5b('0x33')]=_[_0x5e5b('0x34')](_0x42da3b[_0x5e5b('0x2e')],qs[_0x5e5b('0x35')](_0x2cb695['query'][_0x5e5b('0x35')]));_0x3f6b25[_0x5e5b('0x33')]=_0x3f6b25['attributes'][_0x5e5b('0x36')]?_0x3f6b25[_0x5e5b('0x33')]:_0x42da3b[_0x5e5b('0x2e')];if(_0x2cb695[_0x5e5b('0x30')][_0x5e5b('0x37')]){_0x3f6b25[_0x5e5b('0x38')]=[{'all':!![]}];}_0x3f6b25=_[_0x5e5b('0x39')]({},_0x3f6b25,_0x2cb695[_0x5e5b('0x3a')]);return db['ChatApplication'][_0x5e5b('0x3b')](_0x3f6b25)[_0x5e5b('0x27')](handleEntityNotFound(_0x2b4351,null))[_0x5e5b('0x27')](respondWithResult(_0x2b4351,null))[_0x5e5b('0x3c')](handleError(_0x2b4351,null));};exports[_0x5e5b('0x26')]=function(_0x46cafc,_0x4fec9e){if(_0x46cafc['body']['id']){delete _0x46cafc[_0x5e5b('0x3d')]['id'];}return db[_0x5e5b('0x3e')][_0x5e5b('0x3b')]({'where':{'id':_0x46cafc['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x4fec9e,null))[_0x5e5b('0x27')](saveUpdates(_0x46cafc[_0x5e5b('0x3d')],null))[_0x5e5b('0x27')](respondWithResult(_0x4fec9e,null))['catch'](handleError(_0x4fec9e,null));};exports[_0x5e5b('0x28')]=function(_0x44c6d2,_0x4f5b67){return db['ChatApplication'][_0x5e5b('0x3b')]({'where':{'id':_0x44c6d2[_0x5e5b('0x2d')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x4f5b67,null))['then'](removeEntity(_0x4f5b67,null))[_0x5e5b('0x3c')](handleError(_0x4f5b67,null));}; \ No newline at end of file +var _0xee5b=['../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','includeAll','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xee5b,0x1f4));var _0xbee5=function(_0xcb318d,_0x2af170){_0xcb318d=_0xcb318d-0x0;var _0xaa86b8=_0xee5b[_0xcb318d];return _0xaa86b8;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];function respondWithStatusCode(_0xcef158,_0x48f771){_0x48f771=_0x48f771||0xcc;return function(_0x14e032){if(_0x14e032){return _0xcef158['sendStatus'](_0x48f771);}return _0xcef158[_0xbee5('0x17')](_0x48f771)[_0xbee5('0x18')]();};}function respondWithResult(_0x8a268f,_0x593ecb){_0x593ecb=_0x593ecb||0xc8;return function(_0x5092f2){if(_0x5092f2){return _0x8a268f[_0xbee5('0x17')](_0x593ecb)['json'](_0x5092f2);}};}function respondWithFilteredResult(_0x40afcb,_0x5426c9){return function(_0x1a24bd){if(_0x1a24bd){var _0x141878=typeof _0x5426c9[_0xbee5('0x19')]==='undefined'&&typeof _0x5426c9[_0xbee5('0x1a')]===_0xbee5('0x1b');var _0x5a0ae5=_0x1a24bd[_0xbee5('0x1c')];var _0x538460=_0x141878?0x0:_0x5426c9[_0xbee5('0x19')];var _0x3c3f4e=_0x141878?_0x1a24bd[_0xbee5('0x1c')]:_0x5426c9[_0xbee5('0x19')]+_0x5426c9[_0xbee5('0x1a')];var _0xa50ec9;if(_0x3c3f4e>=_0x5a0ae5){_0x3c3f4e=_0x5a0ae5;_0xa50ec9=0xc8;}else{_0xa50ec9=0xce;}_0x40afcb[_0xbee5('0x17')](_0xa50ec9);return _0x40afcb[_0xbee5('0x1d')](_0xbee5('0x1e'),_0x538460+'-'+_0x3c3f4e+'/'+_0x5a0ae5)[_0xbee5('0x1f')](_0x1a24bd);}return null;};}function patchUpdates(_0x35d7d3){return function(_0x40a06){try{jsonpatch[_0xbee5('0x20')](_0x40a06,_0x35d7d3,!![]);}catch(_0x47af8e){return BPromise['reject'](_0x47af8e);}return _0x40a06[_0xbee5('0x21')]();};}function saveUpdates(_0x48bfb5,_0x205491){return function(_0x117cb3){if(_0x117cb3){return _0x117cb3[_0xbee5('0x22')](_0x48bfb5)[_0xbee5('0x23')](function(_0x3f23c5){return _0x3f23c5;});}return null;};}function removeEntity(_0xb665df,_0x359ccf){return function(_0x3cfa8d){if(_0x3cfa8d){return _0x3cfa8d[_0xbee5('0x24')]()['then'](function(){_0xb665df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x519473,_0x50d774){return function(_0x1af3de){if(!_0x1af3de){_0x519473[_0xbee5('0x25')](0x194);}return _0x1af3de;};}function handleError(_0x3b84c8,_0x28c74d){_0x28c74d=_0x28c74d||0x1f4;return function(_0x169042){logger[_0xbee5('0x26')](_0x169042[_0xbee5('0x27')]);if(_0x169042['name']){delete _0x169042[_0xbee5('0x28')];}_0x3b84c8[_0xbee5('0x17')](_0x28c74d)[_0xbee5('0x29')](_0x169042);};}exports[_0xbee5('0x2a')]=function(_0x1a8bcc,_0x5f0419){var _0x21b993={'raw':!![],'where':{'id':_0x1a8bcc[_0xbee5('0x2b')]['id']}},_0x15ffb1={};_0x15ffb1[_0xbee5('0x2c')]=_[_0xbee5('0x2d')](db[_0xbee5('0x2e')][_0xbee5('0x2f')]);_0x15ffb1[_0xbee5('0x30')]=_[_0xbee5('0x2d')](_0x1a8bcc['query']);_0x15ffb1[_0xbee5('0x31')]=_['intersection'](_0x15ffb1[_0xbee5('0x2c')],_0x15ffb1['query']);_0x21b993[_0xbee5('0x32')]=_['intersection'](_0x15ffb1[_0xbee5('0x2c')],qs['fields'](_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x33')]));_0x21b993[_0xbee5('0x32')]=_0x21b993[_0xbee5('0x32')]['length']?_0x21b993[_0xbee5('0x32')]:_0x15ffb1[_0xbee5('0x2c')];if(_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x34')]){_0x21b993['include']=[{'all':!![]}];}_0x21b993=_[_0xbee5('0x35')]({},_0x21b993,_0x1a8bcc[_0xbee5('0x36')]);return db[_0xbee5('0x2e')][_0xbee5('0x37')](_0x21b993)['then'](handleEntityNotFound(_0x5f0419,null))[_0xbee5('0x23')](respondWithResult(_0x5f0419,null))[_0xbee5('0x38')](handleError(_0x5f0419,null));};exports[_0xbee5('0x22')]=function(_0x33aaba,_0x52ecf1){if(_0x33aaba[_0xbee5('0x39')]['id']){delete _0x33aaba['body']['id'];}return db[_0xbee5('0x2e')]['find']({'where':{'id':_0x33aaba['params']['id']}})['then'](handleEntityNotFound(_0x52ecf1,null))[_0xbee5('0x23')](saveUpdates(_0x33aaba[_0xbee5('0x39')],null))[_0xbee5('0x23')](respondWithResult(_0x52ecf1,null))[_0xbee5('0x38')](handleError(_0x52ecf1,null));};exports[_0xbee5('0x24')]=function(_0x2b83d5,_0x37dfd3){return db[_0xbee5('0x2e')]['find']({'where':{'id':_0x2b83d5[_0xbee5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x37dfd3,null))[_0xbee5('0x23')](removeEntity(_0x37dfd3,null))[_0xbee5('0x38')](handleError(_0x37dfd3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 13e1cd9..571399a 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 _0x10a9=['../../config/logger','api','moment','bluebird','request-promise','path','exports','chat_applications','utf8mb4','lodash','util'];(function(_0x383fb0,_0x532e20){var _0x534beb=function(_0x20bd82){while(--_0x20bd82){_0x383fb0['push'](_0x383fb0['shift']());}};_0x534beb(++_0x532e20);}(_0x10a9,0x18a));var _0x910a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x10a9[_0x432682];return _0x463d05;};'use strict';var _=require(_0x910a('0x0'));var util=require(_0x910a('0x1'));var logger=require(_0x910a('0x2'))(_0x910a('0x3'));var moment=require(_0x910a('0x4'));var BPromise=require(_0x910a('0x5'));var rp=require(_0x910a('0x6'));var fs=require('fs');var path=require(_0x910a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x910a('0x8')]=function(_0x3ff486,_0x4352f1){return _0x3ff486['define']('ChatApplication',attributes,{'tableName':_0x910a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x910a('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd95b=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','util','../../config/logger','api','moment','request-promise','path'];(function(_0x53d496,_0x48dcf6){var _0x45c1b6=function(_0x11231a){while(--_0x11231a){_0x53d496['push'](_0x53d496['shift']());}};_0x45c1b6(++_0x48dcf6);}(_0xd95b,0x126));var _0xbd95=function(_0x20c3a0,_0xa49c6e){_0x20c3a0=_0x20c3a0-0x0;var _0x25fc6e=_0xd95b[_0x20c3a0];return _0x25fc6e;};'use strict';var _=require('lodash');var util=require(_0xbd95('0x0'));var logger=require(_0xbd95('0x1'))(_0xbd95('0x2'));var moment=require(_0xbd95('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd95('0x4'));var fs=require('fs');var path=require(_0xbd95('0x5'));var rimraf=require(_0xbd95('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd95('0x7'));module[_0xbd95('0x8')]=function(_0x53a8b7,_0x36ed0b){return _0x53a8b7[_0xbd95('0x9')](_0xbd95('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd95('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4296dda..51b106f 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 _0x070b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x63f423,_0x545443){var _0x5ed960=function(_0x2f9d86){while(--_0x2f9d86){_0x63f423['push'](_0x63f423['shift']());}};_0x5ed960(++_0x545443);}(_0x070b,0x15c));var _0xb070=function(_0x37c88f,_0x24eb84){_0x37c88f=_0x37c88f-0x0;var _0x190b31=_0x070b[_0x37c88f];return _0x190b31;};'use strict';var _=require('lodash');var util=require(_0xb070('0x0'));var moment=require(_0xb070('0x1'));var BPromise=require(_0xb070('0x2'));var rs=require(_0xb070('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb070('0x4'))['db'];var utils=require(_0xb070('0x5'));var logger=require(_0xb070('0x6'))(_0xb070('0x7'));var config=require(_0xb070('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb070('0x9')][_0xb070('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6bb7,_0x169309,_0x545a44){return new BPromise(function(_0x2522ed,_0x39f262){return client['request'](_0x5a6bb7,_0x545a44)[_0xb070('0xb')](function(_0x3263fb){logger[_0xb070('0xc')](_0xb070('0xd'),_0x169309,_0xb070('0xe'));logger[_0xb070('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x169309,'request\x20sent',JSON[_0xb070('0x10')](_0x3263fb));if(_0x3263fb['error']){if(_0x3263fb[_0xb070('0x11')][_0xb070('0x12')]===0x1f4){logger[_0xb070('0x11')](_0xb070('0xd'),_0x169309,_0x3263fb[_0xb070('0x11')][_0xb070('0x13')]);return _0x39f262(_0x3263fb[_0xb070('0x11')][_0xb070('0x13')]);}logger[_0xb070('0x11')](_0xb070('0xd'),_0x169309,_0x3263fb[_0xb070('0x11')][_0xb070('0x13')]);return _0x2522ed(_0x3263fb[_0xb070('0x11')][_0xb070('0x13')]);}else{logger[_0xb070('0xc')](_0xb070('0xd'),_0x169309,_0xb070('0xe'));_0x2522ed(_0x3263fb[_0xb070('0x14')][_0xb070('0x13')]);}})[_0xb070('0x15')](function(_0x21d1f7){logger[_0xb070('0x11')]('ChatApplication,\x20%s,\x20%s',_0x169309,_0x21d1f7);_0x39f262(_0x21d1f7);});});} \ No newline at end of file +var _0x3be3=['../../config/environment','jayson/promise','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4911ed,_0x476941){var _0x230288=function(_0xcaa9c0){while(--_0xcaa9c0){_0x4911ed['push'](_0x4911ed['shift']());}};_0x230288(++_0x476941);}(_0x3be3,0x189));var _0x33be=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0x3be3[_0x424357];return _0x29c68e;};'use strict';var _=require(_0x33be('0x0'));var util=require('util');var moment=require(_0x33be('0x1'));var BPromise=require(_0x33be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33be('0x3'));var db=require(_0x33be('0x4'))['db'];var utils=require(_0x33be('0x5'));var logger=require(_0x33be('0x6'))('rpc');var config=require(_0x33be('0x7'));var jayson=require(_0x33be('0x8'));var client=jayson['client'][_0x33be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf4485,_0x354016,_0x57f4db){return new BPromise(function(_0x5309af,_0x4d270d){return client['request'](_0xf4485,_0x57f4db)[_0x33be('0xa')](function(_0x38ce16){logger['info'](_0x33be('0xb'),_0x354016,_0x33be('0xc'));logger['debug'](_0x33be('0xd'),_0x354016,_0x33be('0xc'),JSON[_0x33be('0xe')](_0x38ce16));if(_0x38ce16[_0x33be('0xf')]){if(_0x38ce16['error'][_0x33be('0x10')]===0x1f4){logger['error'](_0x33be('0xb'),_0x354016,_0x38ce16[_0x33be('0xf')][_0x33be('0x11')]);return _0x4d270d(_0x38ce16[_0x33be('0xf')][_0x33be('0x11')]);}logger[_0x33be('0xf')](_0x33be('0xb'),_0x354016,_0x38ce16[_0x33be('0xf')][_0x33be('0x11')]);return _0x5309af(_0x38ce16[_0x33be('0xf')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x354016,_0x33be('0xc'));_0x5309af(_0x38ce16[_0x33be('0x12')]['message']);}})[_0x33be('0x13')](function(_0x8a39a7){logger[_0x33be('0xf')](_0x33be('0xb'),_0x354016,_0x8a39a7);_0x4d270d(_0x8a39a7);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5e84bfc..9e50528 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 _0xbfdc=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','destroy','exports','util','path'];(function(_0x37766f,_0x3856d3){var _0x564475=function(_0x3aab53){while(--_0x3aab53){_0x37766f['push'](_0x37766f['shift']());}};_0x564475(++_0x3856d3);}(_0xbfdc,0x17e));var _0xcbfd=function(_0x547fe1,_0x5d0b58){_0x547fe1=_0x547fe1-0x0;var _0x13448b=_0xbfdc[_0x547fe1];return _0x13448b;};'use strict';var multer=require('multer');var util=require(_0xcbfd('0x0'));var path=require(_0xcbfd('0x1'));var timeout=require(_0xcbfd('0x2'));var express=require(_0xcbfd('0x3'));var router=express[_0xcbfd('0x4')]();var fs_extra=require(_0xcbfd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcbfd('0x6'));var config=require(_0xcbfd('0x7'));var controller=require(_0xcbfd('0x8'));router['get'](_0xcbfd('0x9'),auth[_0xcbfd('0xa')](),controller[_0xcbfd('0xb')]);router[_0xcbfd('0xc')]('/:id',auth[_0xcbfd('0xa')](),controller[_0xcbfd('0xd')]);router['delete'](_0xcbfd('0x9'),auth[_0xcbfd('0xa')](),controller[_0xcbfd('0xe')]);module[_0xcbfd('0xf')]=router; \ No newline at end of file +var _0x424d=['delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x424d,0x89));var _0xd424=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x424d[_0x59b439];return _0x521ea3;};'use strict';var multer=require(_0xd424('0x0'));var util=require(_0xd424('0x1'));var path=require(_0xd424('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd424('0x3'));var auth=require(_0xd424('0x4'));var interaction=require(_0xd424('0x5'));var config=require(_0xd424('0x6'));var controller=require(_0xd424('0x7'));router[_0xd424('0x8')](_0xd424('0x9'),auth[_0xd424('0xa')](),controller[_0xd424('0xb')]);router[_0xd424('0xc')](_0xd424('0x9'),auth[_0xd424('0xa')](),controller['update']);router[_0xd424('0xd')]('/:id',auth[_0xd424('0xa')](),controller[_0xd424('0xe')]);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 7d724f2..3f16d0d 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 _0x9ac0=['STRING','BOOLEAN','exports'];(function(_0x329397,_0x102228){var _0x126bf9=function(_0x54215c){while(--_0x54215c){_0x329397['push'](_0x329397['shift']());}};_0x126bf9(++_0x102228);}(_0x9ac0,0x116));var _0x09ac=function(_0x56e137,_0xb2e9f4){_0x56e137=_0x56e137-0x0;var _0x20c13a=_0x9ac0[_0x56e137];return _0x20c13a;};'use strict';var Sequelize=require('sequelize');module[_0x09ac('0x0')]={'name':{'type':Sequelize[_0x09ac('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x09ac('0x1')]},'write':{'type':Sequelize[_0x09ac('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x494e=['sequelize','STRING'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x494e,0xd6));var _0xe494=function(_0x1db02e,_0x208024){_0x1db02e=_0x1db02e-0x0;var _0x38c301=_0x494e[_0x1db02e];return _0x38c301;};'use strict';var Sequelize=require(_0xe494('0x0'));module['exports']={'name':{'type':Sequelize[_0xe494('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 a094e9f..b678be1 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 _0xbe6d=['error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','filter','options','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy'];(function(_0x316b60,_0x1bd9dc){var _0x5e4923=function(_0x59d421){while(--_0x59d421){_0x316b60['push'](_0x316b60['shift']());}};_0x5e4923(++_0x1bd9dc);}(_0xbe6d,0x100));var _0xdbe6=function(_0x42749b,_0x16a7ba){_0x42749b=_0x42749b-0x0;var _0x19db46=_0xbe6d[_0x42749b];return _0x19db46;};'use strict';var emlformat=require(_0xdbe6('0x0'));var rimraf=require(_0xdbe6('0x1'));var zipdir=require(_0xdbe6('0x2'));var jsonpatch=require(_0xdbe6('0x3'));var rp=require(_0xdbe6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbe6('0x5'));var path=require(_0xdbe6('0x6'));var sox=require(_0xdbe6('0x7'));var csv=require(_0xdbe6('0x8'));var ejs=require(_0xdbe6('0x9'));var fs=require('fs');var fs_extra=require(_0xdbe6('0xa'));var _=require(_0xdbe6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbe6('0xc'));var deskjs=require(_0xdbe6('0xd'));var toCsv=require(_0xdbe6('0x8'));var querystring=require(_0xdbe6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbe6('0xf'));var qs=require(_0xdbe6('0x10'));var as=require(_0xdbe6('0x11'));var hardwareService=require(_0xdbe6('0x12'));var logger=require(_0xdbe6('0x13'))(_0xdbe6('0x14'));var utils=require(_0xdbe6('0x15'));var config=require(_0xdbe6('0x16'));var licenseUtil=require(_0xdbe6('0x17'));var db=require(_0xdbe6('0x18'))['db'];config[_0xdbe6('0x19')]=_['defaults'](config[_0xdbe6('0x19')],{'host':_0xdbe6('0x1a'),'port':0x18eb});var socket=require(_0xdbe6('0x1b'))(new Redis(config['redis']));require(_0xdbe6('0x1c'))[_0xdbe6('0x1d')](socket);function respondWithStatusCode(_0x3851be,_0x3f4271){_0x3f4271=_0x3f4271||0xcc;return function(_0x48bea0){if(_0x48bea0){return _0x3851be[_0xdbe6('0x1e')](_0x3f4271);}return _0x3851be['status'](_0x3f4271)[_0xdbe6('0x1f')]();};}function respondWithResult(_0x4f0611,_0x1bfc88){_0x1bfc88=_0x1bfc88||0xc8;return function(_0x384ade){if(_0x384ade){return _0x4f0611[_0xdbe6('0x20')](_0x1bfc88)[_0xdbe6('0x21')](_0x384ade);}};}function respondWithFilteredResult(_0xd0f5cc,_0x10b4d9){return function(_0x208f90){if(_0x208f90){var _0x422830=typeof _0x10b4d9['offset']===_0xdbe6('0x22')&&typeof _0x10b4d9[_0xdbe6('0x23')]===_0xdbe6('0x22');var _0x5c57da=_0x208f90['count'];var _0x6119ab=_0x422830?0x0:_0x10b4d9['offset'];var _0xf5f4e6=_0x422830?_0x208f90[_0xdbe6('0x24')]:_0x10b4d9[_0xdbe6('0x25')]+_0x10b4d9[_0xdbe6('0x23')];var _0x112136;if(_0xf5f4e6>=_0x5c57da){_0xf5f4e6=_0x5c57da;_0x112136=0xc8;}else{_0x112136=0xce;}_0xd0f5cc[_0xdbe6('0x20')](_0x112136);return _0xd0f5cc['set']('Content-Range',_0x6119ab+'-'+_0xf5f4e6+'/'+_0x5c57da)['json'](_0x208f90);}return null;};}function patchUpdates(_0x3f95f5){return function(_0x180491){try{jsonpatch[_0xdbe6('0x26')](_0x180491,_0x3f95f5,!![]);}catch(_0x398159){return BPromise[_0xdbe6('0x27')](_0x398159);}return _0x180491[_0xdbe6('0x28')]();};}function saveUpdates(_0x20e857,_0x5f4dd0){return function(_0x5bac38){if(_0x5bac38){return _0x5bac38[_0xdbe6('0x29')](_0x20e857)[_0xdbe6('0x2a')](function(_0x243c39){return _0x243c39;});}return null;};}function removeEntity(_0x3dc784,_0x1ededc){return function(_0x42b0c7){if(_0x42b0c7){return _0x42b0c7[_0xdbe6('0x2b')]()[_0xdbe6('0x2a')](function(){_0x3dc784[_0xdbe6('0x20')](0xcc)[_0xdbe6('0x1f')]();});}};}function handleEntityNotFound(_0x57f084,_0x3238b1){return function(_0x8b287){if(!_0x8b287){_0x57f084[_0xdbe6('0x1e')](0x194);}return _0x8b287;};}function handleError(_0x470f55,_0x4959b0){_0x4959b0=_0x4959b0||0x1f4;return function(_0x48f59b){logger[_0xdbe6('0x2c')](_0x48f59b[_0xdbe6('0x2d')]);if(_0x48f59b['name']){delete _0x48f59b[_0xdbe6('0x2e')];}_0x470f55[_0xdbe6('0x20')](_0x4959b0)[_0xdbe6('0x2f')](_0x48f59b);};}exports[_0xdbe6('0x30')]=function(_0x2c8d3c,_0x5c3318){var _0x256e47={},_0x46e2db={},_0xebaae4={'count':0x0,'rows':[]};var _0x3fc227=_['map'](db[_0xdbe6('0x31')][_0xdbe6('0x32')],function(_0x1e203d){return{'name':_0x1e203d[_0xdbe6('0x33')],'type':_0x1e203d[_0xdbe6('0x34')][_0xdbe6('0x35')]};});_0x46e2db[_0xdbe6('0x36')]=_[_0xdbe6('0x37')](_0x3fc227,_0xdbe6('0x2e'));_0x46e2db[_0xdbe6('0x38')]=_[_0xdbe6('0x39')](_0x2c8d3c[_0xdbe6('0x38')]);_0x46e2db[_0xdbe6('0x3a')]=_[_0xdbe6('0x3b')](_0x46e2db['model'],_0x46e2db[_0xdbe6('0x38')]);_0x256e47['attributes']=_['intersection'](_0x46e2db['model'],qs['fields'](_0x2c8d3c[_0xdbe6('0x38')][_0xdbe6('0x3c')]));_0x256e47[_0xdbe6('0x3d')]=_0x256e47[_0xdbe6('0x3d')][_0xdbe6('0x3e')]?_0x256e47['attributes']:_0x46e2db[_0xdbe6('0x36')];if(!_0x2c8d3c[_0xdbe6('0x38')][_0xdbe6('0x3f')](_0xdbe6('0x40'))){_0x256e47[_0xdbe6('0x23')]=qs[_0xdbe6('0x23')](_0x2c8d3c[_0xdbe6('0x38')][_0xdbe6('0x23')]);_0x256e47[_0xdbe6('0x25')]=qs[_0xdbe6('0x25')](_0x2c8d3c[_0xdbe6('0x38')][_0xdbe6('0x25')]);}_0x256e47['order']=qs[_0xdbe6('0x41')](_0x2c8d3c[_0xdbe6('0x38')][_0xdbe6('0x41')]);_0x256e47['where']=qs[_0xdbe6('0x3a')](_['pick'](_0x2c8d3c[_0xdbe6('0x38')],_0x46e2db['filters']),_0x3fc227);if(_0x2c8d3c[_0xdbe6('0x38')]['filter']){_0x256e47['where']=_[_0xdbe6('0x42')](_0x256e47[_0xdbe6('0x43')],{'$or':_[_0xdbe6('0x37')](_0x3fc227,function(_0x432ab8){if(_0x432ab8[_0xdbe6('0x34')]!==_0xdbe6('0x44')){var _0x135865={};_0x135865[_0x432ab8[_0xdbe6('0x2e')]]={'$like':'%'+_0x2c8d3c[_0xdbe6('0x38')]['filter']+'%'};return _0x135865;}})});}_0x256e47=_[_0xdbe6('0x42')]({},_0x256e47,_0x2c8d3c['options']);var _0x16c6da={'where':_0x256e47[_0xdbe6('0x43')]};return db[_0xdbe6('0x31')][_0xdbe6('0x24')](_0x16c6da)[_0xdbe6('0x2a')](function(_0x288276){_0xebaae4[_0xdbe6('0x24')]=_0x288276;if(_0x2c8d3c[_0xdbe6('0x38')][_0xdbe6('0x45')]){_0x256e47[_0xdbe6('0x46')]=[{'all':!![]}];}return db[_0xdbe6('0x31')][_0xdbe6('0x47')](_0x256e47);})[_0xdbe6('0x2a')](function(_0x5a60a3){_0xebaae4[_0xdbe6('0x48')]=_0x5a60a3;return _0xebaae4;})[_0xdbe6('0x2a')](respondWithFilteredResult(_0x5c3318,_0x256e47))[_0xdbe6('0x49')](handleError(_0x5c3318,null));};exports[_0xdbe6('0x4a')]=function(_0x550cd7,_0x4db203){var _0x2ebe87={'raw':!![],'where':{'id':_0x550cd7['params']['id']}},_0x1c3d84={};_0x1c3d84[_0xdbe6('0x36')]=_[_0xdbe6('0x39')](db[_0xdbe6('0x31')][_0xdbe6('0x32')]);_0x1c3d84[_0xdbe6('0x38')]=_['keys'](_0x550cd7[_0xdbe6('0x38')]);_0x1c3d84[_0xdbe6('0x3a')]=_[_0xdbe6('0x3b')](_0x1c3d84[_0xdbe6('0x36')],_0x1c3d84[_0xdbe6('0x38')]);_0x2ebe87[_0xdbe6('0x3d')]=_[_0xdbe6('0x3b')](_0x1c3d84[_0xdbe6('0x36')],qs[_0xdbe6('0x3c')](_0x550cd7[_0xdbe6('0x38')][_0xdbe6('0x3c')]));_0x2ebe87[_0xdbe6('0x3d')]=_0x2ebe87[_0xdbe6('0x3d')]['length']?_0x2ebe87['attributes']:_0x1c3d84[_0xdbe6('0x36')];if(_0x550cd7[_0xdbe6('0x38')]['includeAll']){_0x2ebe87['include']=[{'all':!![]}];}_0x2ebe87=_[_0xdbe6('0x42')]({},_0x2ebe87,_0x550cd7['options']);return db[_0xdbe6('0x31')][_0xdbe6('0x4b')](_0x2ebe87)['then'](handleEntityNotFound(_0x4db203,null))['then'](respondWithResult(_0x4db203,null))[_0xdbe6('0x49')](handleError(_0x4db203,null));};exports[_0xdbe6('0x4c')]=function(_0x266c79,_0x342f79){return db[_0xdbe6('0x31')][_0xdbe6('0x4c')](_0x266c79[_0xdbe6('0x4d')],{})[_0xdbe6('0x2a')](respondWithResult(_0x342f79,0xc9))[_0xdbe6('0x49')](handleError(_0x342f79,null));};exports[_0xdbe6('0x29')]=function(_0x1c2b35,_0x4f6f34){if(_0x1c2b35[_0xdbe6('0x4d')]['id']){delete _0x1c2b35[_0xdbe6('0x4d')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1c2b35[_0xdbe6('0x4e')]['id']}})[_0xdbe6('0x2a')](handleEntityNotFound(_0x4f6f34,null))[_0xdbe6('0x2a')](saveUpdates(_0x1c2b35[_0xdbe6('0x4d')],null))[_0xdbe6('0x2a')](respondWithResult(_0x4f6f34,null))[_0xdbe6('0x49')](handleError(_0x4f6f34,null));};exports[_0xdbe6('0x2b')]=function(_0x47e4da,_0x464c2e){return db['ChatGroup'][_0xdbe6('0x4b')]({'where':{'id':_0x47e4da[_0xdbe6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x464c2e,null))[_0xdbe6('0x2a')](removeEntity(_0x464c2e,null))[_0xdbe6('0x49')](handleError(_0x464c2e,null));};exports[_0xdbe6('0x4f')]=function(_0x2157f8,_0x5334c5){return db['ChatGroup'][_0xdbe6('0x4f')]()[_0xdbe6('0x2a')](respondWithResult(_0x5334c5,null))[_0xdbe6('0x49')](handleError(_0x5334c5,null));};exports[_0xdbe6('0x50')]=function(_0x46edd0,_0x12d5ba,_0x3a82a4){return db['ChatInternalMessage'][_0xdbe6('0x24')]({'where':{'ChatGroupId':_0x46edd0[_0xdbe6('0x4e')]['id'],'ToId':_0x46edd0[_0xdbe6('0x51')]['id'],'read':![]}})[_0xdbe6('0x2a')](function(_0x3dc1c7){return{'id':_[_0xdbe6('0x52')](_0x46edd0[_0xdbe6('0x4e')]['id']),'count':_0x3dc1c7};})['then'](respondWithResult(_0x12d5ba,null))[_0xdbe6('0x49')](handleError(_0x12d5ba,null));};exports[_0xdbe6('0x53')]=function(_0x2a9af9,_0x518ee2,_0x3a2622){return db[_0xdbe6('0x31')][_0xdbe6('0x4b')]({'where':{'id':_0x2a9af9['params']['id']}})['then'](handleEntityNotFound(_0x518ee2,null))[_0xdbe6('0x2a')](function(_0x1b8c2d){if(_0x1b8c2d){return _0x1b8c2d[_0xdbe6('0x53')](_0x2a9af9[_0xdbe6('0x4d')][_0xdbe6('0x54')],_[_0xdbe6('0x55')](_0x2a9af9['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x518ee2,null))[_0xdbe6('0x49')](handleError(_0x518ee2,null));};exports[_0xdbe6('0x56')]=function(_0x50c3bb,_0x46ee58,_0x2eb5be){var _0xe55913={};var _0x51c175={};var _0x3d2bc6;var _0x57645b;return db[_0xdbe6('0x31')][_0xdbe6('0x57')]({'where':{'id':_0x50c3bb['params']['id']}})[_0xdbe6('0x2a')](handleEntityNotFound(_0x46ee58,null))[_0xdbe6('0x2a')](function(_0xea236){if(_0xea236){_0x3d2bc6=_0xea236;_0x51c175[_0xdbe6('0x36')]=_[_0xdbe6('0x39')](db[_0xdbe6('0x58')]['rawAttributes']);_0x51c175[_0xdbe6('0x38')]=_[_0xdbe6('0x39')](_0x50c3bb['query']);_0x51c175[_0xdbe6('0x3a')]=_[_0xdbe6('0x3b')](_0x51c175[_0xdbe6('0x36')],_0x51c175[_0xdbe6('0x38')]);_0xe55913[_0xdbe6('0x3d')]=_[_0xdbe6('0x3b')](_0x51c175['model'],qs[_0xdbe6('0x3c')](_0x50c3bb['query']['fields']));_0xe55913[_0xdbe6('0x3d')]=_0xe55913[_0xdbe6('0x3d')][_0xdbe6('0x3e')]?_0xe55913['attributes']:_0x51c175[_0xdbe6('0x36')];_0xe55913[_0xdbe6('0x59')]=qs[_0xdbe6('0x41')](_0x50c3bb[_0xdbe6('0x38')][_0xdbe6('0x41')]);_0xe55913[_0xdbe6('0x43')]=qs['filters'](_['pick'](_0x50c3bb[_0xdbe6('0x38')],_0x51c175['filters']));if(_0x50c3bb[_0xdbe6('0x38')][_0xdbe6('0x5a')]){_0xe55913[_0xdbe6('0x43')]=_[_0xdbe6('0x42')](_0xe55913[_0xdbe6('0x43')],{'$or':_[_0xdbe6('0x37')](_0xe55913[_0xdbe6('0x3d')],function(_0xa8d52e){var _0x200d21={};_0x200d21[_0xa8d52e]={'$like':'%'+_0x50c3bb[_0xdbe6('0x38')][_0xdbe6('0x5a')]+'%'};return _0x200d21;})});}_0xe55913=_['merge']({},_0xe55913,_0x50c3bb[_0xdbe6('0x5b')]);return _0x3d2bc6['getMembers'](_0xe55913);}})[_0xdbe6('0x2a')](function(_0x9cda78){if(_0x9cda78){_0x57645b=_0x9cda78[_0xdbe6('0x3e')];if(!_0x50c3bb['query'][_0xdbe6('0x3f')](_0xdbe6('0x40'))){_0xe55913[_0xdbe6('0x23')]=qs[_0xdbe6('0x23')](_0x50c3bb['query'][_0xdbe6('0x23')]);_0xe55913[_0xdbe6('0x25')]=qs[_0xdbe6('0x25')](_0x50c3bb['query']['offset']);}return _0x3d2bc6[_0xdbe6('0x56')](_0xe55913);}})[_0xdbe6('0x2a')](function(_0x40223e){if(_0x40223e){return _0x40223e?{'count':_0x57645b,'rows':_0x40223e}:null;}})[_0xdbe6('0x2a')](respondWithResult(_0x46ee58,null))[_0xdbe6('0x49')](handleError(_0x46ee58,null));};exports[_0xdbe6('0x5c')]=function(_0x427f29,_0x27f291,_0x4bba65){return db[_0xdbe6('0x31')][_0xdbe6('0x4b')]({'where':{'id':_0x427f29[_0xdbe6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27f291,null))[_0xdbe6('0x2a')](function(_0x34bcd5){if(_0x34bcd5){return _0x34bcd5[_0xdbe6('0x5c')](_0x427f29[_0xdbe6('0x38')][_0xdbe6('0x54')]);}})[_0xdbe6('0x2a')](respondWithStatusCode(_0x27f291,null))[_0xdbe6('0x49')](handleError(_0x27f291,null));};exports[_0xdbe6('0x5d')]=function(_0x42213d,_0x4de423,_0xad0d87){if(_0x42213d[_0xdbe6('0x4d')]['id']){delete _0x42213d[_0xdbe6('0x4d')]['id'];}return db[_0xdbe6('0x31')][_0xdbe6('0x4b')]({'where':{'id':_0x42213d[_0xdbe6('0x4e')]['id']}})[_0xdbe6('0x2a')](handleEntityNotFound(_0x4de423,null))['then'](function(_0x4d50a1){if(_0x4d50a1){_0x42213d[_0xdbe6('0x4d')]['ChatGroupId']=_0x4d50a1['id'];return db[_0xdbe6('0x5e')][_0xdbe6('0x4c')](_0x42213d[_0xdbe6('0x4d')]);}})[_0xdbe6('0x2a')](respondWithResult(_0x4de423,null))['catch'](handleError(_0x4de423,null));};exports[_0xdbe6('0x5f')]=function(_0x1a9ac4,_0x1cf568,_0x7e9bb6){var _0x42a229={};var _0x1bfaee={};var _0x12f692;var _0x4552c6;return db[_0xdbe6('0x31')]['findOne']({'where':{'id':_0x1a9ac4['params']['id']}})['then'](handleEntityNotFound(_0x1cf568,null))['then'](function(_0x5d525d){if(_0x5d525d){_0x12f692=_0x5d525d;_0x1bfaee[_0xdbe6('0x36')]=_[_0xdbe6('0x39')](db[_0xdbe6('0x5e')][_0xdbe6('0x32')]);_0x1bfaee[_0xdbe6('0x38')]=_[_0xdbe6('0x39')](_0x1a9ac4['query']);_0x1bfaee[_0xdbe6('0x3a')]=_[_0xdbe6('0x3b')](_0x1bfaee[_0xdbe6('0x36')],_0x1bfaee[_0xdbe6('0x38')]);_0x42a229[_0xdbe6('0x3d')]=_[_0xdbe6('0x3b')](_0x1bfaee[_0xdbe6('0x36')],qs[_0xdbe6('0x3c')](_0x1a9ac4[_0xdbe6('0x38')][_0xdbe6('0x3c')]));_0x42a229[_0xdbe6('0x3d')]=_0x42a229['attributes'][_0xdbe6('0x3e')]?_0x42a229['attributes']:_0x1bfaee[_0xdbe6('0x36')];_0x42a229[_0xdbe6('0x59')]=qs[_0xdbe6('0x41')](_0x1a9ac4['query'][_0xdbe6('0x41')]);_0x42a229[_0xdbe6('0x43')]=qs[_0xdbe6('0x3a')](_['pick'](_0x1a9ac4[_0xdbe6('0x38')],_0x1bfaee[_0xdbe6('0x3a')]));if(_0x1a9ac4['query'][_0xdbe6('0x5a')]){_0x42a229[_0xdbe6('0x43')]=_[_0xdbe6('0x42')](_0x42a229[_0xdbe6('0x43')],{'$or':_['map'](_0x42a229[_0xdbe6('0x3d')],function(_0x1acdf6){var _0x184b27={};_0x184b27[_0x1acdf6]={'$like':'%'+_0x1a9ac4['query'][_0xdbe6('0x5a')]+'%'};return _0x184b27;})});}if(_0x1a9ac4[_0xdbe6('0x38')][_0xdbe6('0x60')]){var _0x5dd93c=_0x1a9ac4[_0xdbe6('0x38')][_0xdbe6('0x60')][_0xdbe6('0x61')](',');var _0x2148c6={};_0x2148c6[_0x5dd93c[0x0]]={'$gte':moment(_0x5dd93c[0x1])[_0xdbe6('0x62')](_0xdbe6('0x63'))};_0x42a229['where']=_[_0xdbe6('0x42')](_0x42a229[_0xdbe6('0x43')],_0x2148c6);}_0x42a229=_[_0xdbe6('0x42')]({},_0x42a229,_0x1a9ac4[_0xdbe6('0x5b')]);return _0x12f692[_0xdbe6('0x5f')](_0x42a229);}})[_0xdbe6('0x2a')](function(_0x52848e){if(_0x52848e){_0x4552c6=_0x52848e[_0xdbe6('0x3e')];if(!_0x1a9ac4[_0xdbe6('0x38')]['hasOwnProperty'](_0xdbe6('0x40'))){_0x42a229[_0xdbe6('0x23')]=qs[_0xdbe6('0x23')](_0x1a9ac4[_0xdbe6('0x38')]['limit']);_0x42a229[_0xdbe6('0x25')]=qs[_0xdbe6('0x25')](_0x1a9ac4['query'][_0xdbe6('0x25')]);}return _0x12f692[_0xdbe6('0x5f')](_0x42a229);}})['then'](function(_0x31dc36){if(_0x31dc36){return _0x31dc36?{'count':_0x4552c6,'rows':_0x31dc36}:null;}})[_0xdbe6('0x2a')](respondWithResult(_0x1cf568,null))['catch'](handleError(_0x1cf568,null));}; \ No newline at end of file +var _0x1c74=['includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options'];(function(_0x13553d,_0x73721){var _0x97d449=function(_0x481517){while(--_0x481517){_0x13553d['push'](_0x13553d['shift']());}};_0x97d449(++_0x73721);}(_0x1c74,0x7d));var _0x41c7=function(_0x57ec4a,_0x4428ec){_0x57ec4a=_0x57ec4a-0x0;var _0x25f4ac=_0x1c74[_0x57ec4a];return _0x25f4ac;};'use strict';var emlformat=require(_0x41c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41c7('0x1'));var jsonpatch=require(_0x41c7('0x2'));var rp=require(_0x41c7('0x3'));var moment=require(_0x41c7('0x4'));var BPromise=require(_0x41c7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x41c7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41c7('0x7'));var _=require(_0x41c7('0x8'));var squel=require('squel');var crypto=require(_0x41c7('0x9'));var jsforce=require(_0x41c7('0xa'));var deskjs=require(_0x41c7('0xb'));var toCsv=require(_0x41c7('0x6'));var querystring=require('querystring');var Papa=require(_0x41c7('0xc'));var Redis=require(_0x41c7('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x41c7('0xe'));var hardwareService=require(_0x41c7('0xf'));var logger=require(_0x41c7('0x10'))(_0x41c7('0x11'));var utils=require(_0x41c7('0x12'));var config=require(_0x41c7('0x13'));var licenseUtil=require(_0x41c7('0x14'));var db=require(_0x41c7('0x15'))['db'];config[_0x41c7('0x16')]=_[_0x41c7('0x17')](config[_0x41c7('0x16')],{'host':_0x41c7('0x18'),'port':0x18eb});var socket=require(_0x41c7('0x19'))(new Redis(config['redis']));require(_0x41c7('0x1a'))['register'](socket);function respondWithStatusCode(_0x69301c,_0x415753){_0x415753=_0x415753||0xcc;return function(_0x59cd93){if(_0x59cd93){return _0x69301c['sendStatus'](_0x415753);}return _0x69301c['status'](_0x415753)[_0x41c7('0x1b')]();};}function respondWithResult(_0x4e858e,_0x655132){_0x655132=_0x655132||0xc8;return function(_0x451d78){if(_0x451d78){return _0x4e858e[_0x41c7('0x1c')](_0x655132)[_0x41c7('0x1d')](_0x451d78);}};}function respondWithFilteredResult(_0x29ca87,_0x277725){return function(_0x153bb2){if(_0x153bb2){var _0x11478a=typeof _0x277725[_0x41c7('0x1e')]===_0x41c7('0x1f')&&typeof _0x277725[_0x41c7('0x20')]===_0x41c7('0x1f');var _0x531530=_0x153bb2[_0x41c7('0x21')];var _0x8ae05f=_0x11478a?0x0:_0x277725[_0x41c7('0x1e')];var _0x2877f2=_0x11478a?_0x153bb2[_0x41c7('0x21')]:_0x277725[_0x41c7('0x1e')]+_0x277725['limit'];var _0x44ffa6;if(_0x2877f2>=_0x531530){_0x2877f2=_0x531530;_0x44ffa6=0xc8;}else{_0x44ffa6=0xce;}_0x29ca87[_0x41c7('0x1c')](_0x44ffa6);return _0x29ca87[_0x41c7('0x22')](_0x41c7('0x23'),_0x8ae05f+'-'+_0x2877f2+'/'+_0x531530)[_0x41c7('0x1d')](_0x153bb2);}return null;};}function patchUpdates(_0x5640db){return function(_0x2ea1af){try{jsonpatch['apply'](_0x2ea1af,_0x5640db,!![]);}catch(_0x6e792f){return BPromise[_0x41c7('0x24')](_0x6e792f);}return _0x2ea1af[_0x41c7('0x25')]();};}function saveUpdates(_0x24898e,_0x534a04){return function(_0xb9b3df){if(_0xb9b3df){return _0xb9b3df[_0x41c7('0x26')](_0x24898e)[_0x41c7('0x27')](function(_0x23e615){return _0x23e615;});}return null;};}function removeEntity(_0x41db3e,_0x3f2807){return function(_0x5a9e7a){if(_0x5a9e7a){return _0x5a9e7a[_0x41c7('0x28')]()[_0x41c7('0x27')](function(){_0x41db3e[_0x41c7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53f068,_0x37acde){return function(_0x2eb5fc){if(!_0x2eb5fc){_0x53f068[_0x41c7('0x29')](0x194);}return _0x2eb5fc;};}function handleError(_0x47e225,_0x49c6c8){_0x49c6c8=_0x49c6c8||0x1f4;return function(_0x4bb518){logger[_0x41c7('0x2a')](_0x4bb518[_0x41c7('0x2b')]);if(_0x4bb518['name']){delete _0x4bb518[_0x41c7('0x2c')];}_0x47e225[_0x41c7('0x1c')](_0x49c6c8)[_0x41c7('0x2d')](_0x4bb518);};}exports[_0x41c7('0x2e')]=function(_0x565985,_0x287db6){var _0x52f15f={},_0x1e87d8={},_0x121a07={'count':0x0,'rows':[]};var _0x2ed4a4=_['map'](db[_0x41c7('0x2f')][_0x41c7('0x30')],function(_0x3c3d45){return{'name':_0x3c3d45[_0x41c7('0x31')],'type':_0x3c3d45['type'][_0x41c7('0x32')]};});_0x1e87d8['model']=_[_0x41c7('0x33')](_0x2ed4a4,_0x41c7('0x2c'));_0x1e87d8[_0x41c7('0x34')]=_['keys'](_0x565985[_0x41c7('0x34')]);_0x1e87d8[_0x41c7('0x35')]=_[_0x41c7('0x36')](_0x1e87d8[_0x41c7('0x37')],_0x1e87d8[_0x41c7('0x34')]);_0x52f15f[_0x41c7('0x38')]=_[_0x41c7('0x36')](_0x1e87d8['model'],qs[_0x41c7('0x39')](_0x565985[_0x41c7('0x34')][_0x41c7('0x39')]));_0x52f15f[_0x41c7('0x38')]=_0x52f15f[_0x41c7('0x38')][_0x41c7('0x3a')]?_0x52f15f['attributes']:_0x1e87d8[_0x41c7('0x37')];if(!_0x565985[_0x41c7('0x34')]['hasOwnProperty'](_0x41c7('0x3b'))){_0x52f15f['limit']=qs[_0x41c7('0x20')](_0x565985[_0x41c7('0x34')][_0x41c7('0x20')]);_0x52f15f['offset']=qs[_0x41c7('0x1e')](_0x565985['query']['offset']);}_0x52f15f[_0x41c7('0x3c')]=qs[_0x41c7('0x3d')](_0x565985['query'][_0x41c7('0x3d')]);_0x52f15f[_0x41c7('0x3e')]=qs['filters'](_[_0x41c7('0x3f')](_0x565985[_0x41c7('0x34')],_0x1e87d8[_0x41c7('0x35')]),_0x2ed4a4);if(_0x565985[_0x41c7('0x34')][_0x41c7('0x40')]){_0x52f15f[_0x41c7('0x3e')]=_['merge'](_0x52f15f[_0x41c7('0x3e')],{'$or':_[_0x41c7('0x33')](_0x2ed4a4,function(_0x56e424){if(_0x56e424[_0x41c7('0x41')]!==_0x41c7('0x42')){var _0xd1c5b3={};_0xd1c5b3[_0x56e424[_0x41c7('0x2c')]]={'$like':'%'+_0x565985[_0x41c7('0x34')][_0x41c7('0x40')]+'%'};return _0xd1c5b3;}})});}_0x52f15f=_[_0x41c7('0x43')]({},_0x52f15f,_0x565985[_0x41c7('0x44')]);var _0x5c004a={'where':_0x52f15f[_0x41c7('0x3e')]};return db['ChatGroup'][_0x41c7('0x21')](_0x5c004a)[_0x41c7('0x27')](function(_0x472992){_0x121a07[_0x41c7('0x21')]=_0x472992;if(_0x565985[_0x41c7('0x34')][_0x41c7('0x45')]){_0x52f15f[_0x41c7('0x46')]=[{'all':!![]}];}return db[_0x41c7('0x2f')][_0x41c7('0x47')](_0x52f15f);})[_0x41c7('0x27')](function(_0x544963){_0x121a07['rows']=_0x544963;return _0x121a07;})[_0x41c7('0x27')](respondWithFilteredResult(_0x287db6,_0x52f15f))[_0x41c7('0x48')](handleError(_0x287db6,null));};exports[_0x41c7('0x49')]=function(_0x3c18cf,_0xff1f6d){var _0x122c87={'raw':!![],'where':{'id':_0x3c18cf[_0x41c7('0x4a')]['id']}},_0x49d5c6={};_0x49d5c6['model']=_['keys'](db['ChatGroup'][_0x41c7('0x30')]);_0x49d5c6[_0x41c7('0x34')]=_[_0x41c7('0x4b')](_0x3c18cf[_0x41c7('0x34')]);_0x49d5c6['filters']=_[_0x41c7('0x36')](_0x49d5c6[_0x41c7('0x37')],_0x49d5c6[_0x41c7('0x34')]);_0x122c87[_0x41c7('0x38')]=_[_0x41c7('0x36')](_0x49d5c6['model'],qs[_0x41c7('0x39')](_0x3c18cf['query']['fields']));_0x122c87[_0x41c7('0x38')]=_0x122c87[_0x41c7('0x38')][_0x41c7('0x3a')]?_0x122c87[_0x41c7('0x38')]:_0x49d5c6[_0x41c7('0x37')];if(_0x3c18cf[_0x41c7('0x34')][_0x41c7('0x45')]){_0x122c87[_0x41c7('0x46')]=[{'all':!![]}];}_0x122c87=_[_0x41c7('0x43')]({},_0x122c87,_0x3c18cf[_0x41c7('0x44')]);return db['ChatGroup'][_0x41c7('0x4c')](_0x122c87)[_0x41c7('0x27')](handleEntityNotFound(_0xff1f6d,null))['then'](respondWithResult(_0xff1f6d,null))[_0x41c7('0x48')](handleError(_0xff1f6d,null));};exports[_0x41c7('0x4d')]=function(_0x27d1d5,_0xa4af1){return db[_0x41c7('0x2f')][_0x41c7('0x4d')](_0x27d1d5['body'],{})[_0x41c7('0x27')](respondWithResult(_0xa4af1,0xc9))[_0x41c7('0x48')](handleError(_0xa4af1,null));};exports[_0x41c7('0x26')]=function(_0x7cc824,_0x50cf76){if(_0x7cc824[_0x41c7('0x4e')]['id']){delete _0x7cc824[_0x41c7('0x4e')]['id'];}return db[_0x41c7('0x2f')]['find']({'where':{'id':_0x7cc824[_0x41c7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50cf76,null))[_0x41c7('0x27')](saveUpdates(_0x7cc824[_0x41c7('0x4e')],null))[_0x41c7('0x27')](respondWithResult(_0x50cf76,null))[_0x41c7('0x48')](handleError(_0x50cf76,null));};exports['destroy']=function(_0x42cc7d,_0xfac05){return db[_0x41c7('0x2f')][_0x41c7('0x4c')]({'where':{'id':_0x42cc7d[_0x41c7('0x4a')]['id']}})[_0x41c7('0x27')](handleEntityNotFound(_0xfac05,null))[_0x41c7('0x27')](removeEntity(_0xfac05,null))[_0x41c7('0x48')](handleError(_0xfac05,null));};exports[_0x41c7('0x4f')]=function(_0x352a62,_0x1d3c62){return db[_0x41c7('0x2f')][_0x41c7('0x4f')]()[_0x41c7('0x27')](respondWithResult(_0x1d3c62,null))[_0x41c7('0x48')](handleError(_0x1d3c62,null));};exports[_0x41c7('0x50')]=function(_0x578337,_0x7b72f7,_0x3b6e6d){return db[_0x41c7('0x51')]['count']({'where':{'ChatGroupId':_0x578337[_0x41c7('0x4a')]['id'],'ToId':_0x578337[_0x41c7('0x52')]['id'],'read':![]}})[_0x41c7('0x27')](function(_0x3db31e){return{'id':_['toInteger'](_0x578337[_0x41c7('0x4a')]['id']),'count':_0x3db31e};})[_0x41c7('0x27')](respondWithResult(_0x7b72f7,null))['catch'](handleError(_0x7b72f7,null));};exports[_0x41c7('0x53')]=function(_0x26d8d7,_0x2f6440,_0x1c88c8){return db[_0x41c7('0x2f')]['find']({'where':{'id':_0x26d8d7[_0x41c7('0x4a')]['id']}})[_0x41c7('0x27')](handleEntityNotFound(_0x2f6440,null))[_0x41c7('0x27')](function(_0x14deea){if(_0x14deea){return _0x14deea[_0x41c7('0x53')](_0x26d8d7[_0x41c7('0x4e')]['ids'],_[_0x41c7('0x54')](_0x26d8d7[_0x41c7('0x4e')],[_0x41c7('0x55'),'id'])||{});}})['then'](respondWithResult(_0x2f6440,null))[_0x41c7('0x48')](handleError(_0x2f6440,null));};exports[_0x41c7('0x56')]=function(_0x4ab95a,_0x39f351,_0x1d7dd1){var _0xab8820={};var _0x2a12d2={};var _0x29b64c;var _0x59e821;return db['ChatGroup'][_0x41c7('0x57')]({'where':{'id':_0x4ab95a['params']['id']}})[_0x41c7('0x27')](handleEntityNotFound(_0x39f351,null))[_0x41c7('0x27')](function(_0x547989){if(_0x547989){_0x29b64c=_0x547989;_0x2a12d2[_0x41c7('0x37')]=_[_0x41c7('0x4b')](db[_0x41c7('0x58')][_0x41c7('0x30')]);_0x2a12d2[_0x41c7('0x34')]=_[_0x41c7('0x4b')](_0x4ab95a['query']);_0x2a12d2[_0x41c7('0x35')]=_['intersection'](_0x2a12d2[_0x41c7('0x37')],_0x2a12d2['query']);_0xab8820['attributes']=_[_0x41c7('0x36')](_0x2a12d2['model'],qs[_0x41c7('0x39')](_0x4ab95a['query'][_0x41c7('0x39')]));_0xab8820[_0x41c7('0x38')]=_0xab8820[_0x41c7('0x38')][_0x41c7('0x3a')]?_0xab8820[_0x41c7('0x38')]:_0x2a12d2[_0x41c7('0x37')];_0xab8820['order']=qs['sort'](_0x4ab95a[_0x41c7('0x34')][_0x41c7('0x3d')]);_0xab8820[_0x41c7('0x3e')]=qs['filters'](_[_0x41c7('0x3f')](_0x4ab95a[_0x41c7('0x34')],_0x2a12d2[_0x41c7('0x35')]));if(_0x4ab95a[_0x41c7('0x34')][_0x41c7('0x40')]){_0xab8820[_0x41c7('0x3e')]=_[_0x41c7('0x43')](_0xab8820[_0x41c7('0x3e')],{'$or':_[_0x41c7('0x33')](_0xab8820['attributes'],function(_0x31eb86){var _0x1baf63={};_0x1baf63[_0x31eb86]={'$like':'%'+_0x4ab95a[_0x41c7('0x34')][_0x41c7('0x40')]+'%'};return _0x1baf63;})});}_0xab8820=_['merge']({},_0xab8820,_0x4ab95a['options']);return _0x29b64c['getMembers'](_0xab8820);}})['then'](function(_0x5c4b94){if(_0x5c4b94){_0x59e821=_0x5c4b94[_0x41c7('0x3a')];if(!_0x4ab95a['query'][_0x41c7('0x59')](_0x41c7('0x3b'))){_0xab8820[_0x41c7('0x20')]=qs[_0x41c7('0x20')](_0x4ab95a[_0x41c7('0x34')][_0x41c7('0x20')]);_0xab8820['offset']=qs[_0x41c7('0x1e')](_0x4ab95a['query']['offset']);}return _0x29b64c[_0x41c7('0x56')](_0xab8820);}})[_0x41c7('0x27')](function(_0x5f3bf2){if(_0x5f3bf2){return _0x5f3bf2?{'count':_0x59e821,'rows':_0x5f3bf2}:null;}})[_0x41c7('0x27')](respondWithResult(_0x39f351,null))[_0x41c7('0x48')](handleError(_0x39f351,null));};exports[_0x41c7('0x5a')]=function(_0x54b69b,_0x170c6d,_0x59256b){return db[_0x41c7('0x2f')][_0x41c7('0x4c')]({'where':{'id':_0x54b69b['params']['id']}})[_0x41c7('0x27')](handleEntityNotFound(_0x170c6d,null))[_0x41c7('0x27')](function(_0x525a19){if(_0x525a19){return _0x525a19[_0x41c7('0x5a')](_0x54b69b[_0x41c7('0x34')][_0x41c7('0x55')]);}})[_0x41c7('0x27')](respondWithStatusCode(_0x170c6d,null))['catch'](handleError(_0x170c6d,null));};exports[_0x41c7('0x5b')]=function(_0x26ff66,_0x409f30,_0x9f1a18){if(_0x26ff66['body']['id']){delete _0x26ff66[_0x41c7('0x4e')]['id'];}return db[_0x41c7('0x2f')][_0x41c7('0x4c')]({'where':{'id':_0x26ff66[_0x41c7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x409f30,null))['then'](function(_0x549edb){if(_0x549edb){_0x26ff66[_0x41c7('0x4e')][_0x41c7('0x5c')]=_0x549edb['id'];return db[_0x41c7('0x51')]['create'](_0x26ff66[_0x41c7('0x4e')]);}})['then'](respondWithResult(_0x409f30,null))[_0x41c7('0x48')](handleError(_0x409f30,null));};exports[_0x41c7('0x5d')]=function(_0x941c48,_0x309d37,_0x2b631){var _0x4cb376={};var _0x47a191={};var _0x250466;var _0x99a44;return db['ChatGroup']['findOne']({'where':{'id':_0x941c48[_0x41c7('0x4a')]['id']}})[_0x41c7('0x27')](handleEntityNotFound(_0x309d37,null))[_0x41c7('0x27')](function(_0x56508b){if(_0x56508b){_0x250466=_0x56508b;_0x47a191['model']=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x47a191['query']=_['keys'](_0x941c48[_0x41c7('0x34')]);_0x47a191['filters']=_['intersection'](_0x47a191[_0x41c7('0x37')],_0x47a191[_0x41c7('0x34')]);_0x4cb376[_0x41c7('0x38')]=_[_0x41c7('0x36')](_0x47a191[_0x41c7('0x37')],qs[_0x41c7('0x39')](_0x941c48['query']['fields']));_0x4cb376[_0x41c7('0x38')]=_0x4cb376[_0x41c7('0x38')][_0x41c7('0x3a')]?_0x4cb376[_0x41c7('0x38')]:_0x47a191['model'];_0x4cb376[_0x41c7('0x3c')]=qs[_0x41c7('0x3d')](_0x941c48[_0x41c7('0x34')][_0x41c7('0x3d')]);_0x4cb376[_0x41c7('0x3e')]=qs['filters'](_[_0x41c7('0x3f')](_0x941c48[_0x41c7('0x34')],_0x47a191[_0x41c7('0x35')]));if(_0x941c48[_0x41c7('0x34')]['filter']){_0x4cb376[_0x41c7('0x3e')]=_['merge'](_0x4cb376[_0x41c7('0x3e')],{'$or':_[_0x41c7('0x33')](_0x4cb376['attributes'],function(_0x3f430e){var _0x473c0c={};_0x473c0c[_0x3f430e]={'$like':'%'+_0x941c48[_0x41c7('0x34')][_0x41c7('0x40')]+'%'};return _0x473c0c;})});}if(_0x941c48['query']['$gte']){var _0x32768e=_0x941c48['query'][_0x41c7('0x5e')]['split'](',');var _0x3d8442={};_0x3d8442[_0x32768e[0x0]]={'$gte':moment(_0x32768e[0x1])[_0x41c7('0x5f')](_0x41c7('0x60'))};_0x4cb376['where']=_[_0x41c7('0x43')](_0x4cb376[_0x41c7('0x3e')],_0x3d8442);}_0x4cb376=_[_0x41c7('0x43')]({},_0x4cb376,_0x941c48['options']);return _0x250466[_0x41c7('0x5d')](_0x4cb376);}})[_0x41c7('0x27')](function(_0x228bc7){if(_0x228bc7){_0x99a44=_0x228bc7[_0x41c7('0x3a')];if(!_0x941c48['query'][_0x41c7('0x59')]('nolimit')){_0x4cb376['limit']=qs[_0x41c7('0x20')](_0x941c48['query']['limit']);_0x4cb376[_0x41c7('0x1e')]=qs[_0x41c7('0x1e')](_0x941c48[_0x41c7('0x34')][_0x41c7('0x1e')]);}return _0x250466[_0x41c7('0x5d')](_0x4cb376);}})[_0x41c7('0x27')](function(_0x41d081){if(_0x41d081){return _0x41d081?{'count':_0x99a44,'rows':_0x41d081}:null;}})[_0x41c7('0x27')](respondWithResult(_0x309d37,null))[_0x41c7('0x48')](handleError(_0x309d37,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e95be8b..825a762 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 _0x1f6f=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x36b217,_0x138b7e){var _0x23365d=function(_0x3a7823){while(--_0x3a7823){_0x36b217['push'](_0x36b217['shift']());}};_0x23365d(++_0x138b7e);}(_0x1f6f,0x1a6));var _0xf1f6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1f6f[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0xf1f6('0x0'));var ChatGroup=require(_0xf1f6('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf1f6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf1f6('0x3')};function emitEvent(_0x5e0efa){return function(_0x249e18,_0x14c1f7,_0x50fd8c){ChatGroupEvents[_0xf1f6('0x4')](_0x5e0efa+':'+_0x249e18['id'],_0x249e18);ChatGroupEvents['emit'](_0x5e0efa,_0x249e18);_0x50fd8c(null);};}for(var e in events){if(events[_0xf1f6('0x5')](e)){var event=events[e];ChatGroup[_0xf1f6('0x6')](e,emitEvent(event));}}module[_0xf1f6('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x3c8e=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x2d0341,_0x3d810b){var _0x29006a=function(_0x322ecb){while(--_0x322ecb){_0x2d0341['push'](_0x2d0341['shift']());}};_0x29006a(++_0x3d810b);}(_0x3c8e,0x89));var _0xe3c8=function(_0x21ae7b,_0x2fc5a5){_0x21ae7b=_0x21ae7b-0x0;var _0x2878c2=_0x3c8e[_0x21ae7b];return _0x2878c2;};'use strict';var EventEmitter=require(_0xe3c8('0x0'));var ChatGroup=require(_0xe3c8('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe3c8('0x2'),'afterUpdate':_0xe3c8('0x3'),'afterDestroy':_0xe3c8('0x4')};function emitEvent(_0x563970){return function(_0x3f8a4b,_0x21efc9,_0xbd43ef){ChatGroupEvents[_0xe3c8('0x5')](_0x563970+':'+_0x3f8a4b['id'],_0x3f8a4b);ChatGroupEvents['emit'](_0x563970,_0x3f8a4b);_0xbd43ef(null);};}for(var e in events){if(events[_0xe3c8('0x6')](e)){var event=events[e];ChatGroup[_0xe3c8('0x7')](e,emitEvent(event));}}module[_0xe3c8('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 758c853..aae1d57 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 _0x32c2=['api','request-promise','rimraf','../../config/environment','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x5e2759,_0x302112){var _0x175319=function(_0x12c681){while(--_0x12c681){_0x5e2759['push'](_0x5e2759['shift']());}};_0x175319(++_0x302112);}(_0x32c2,0xbb));var _0x232c=function(_0x3be311,_0x284a86){_0x3be311=_0x3be311-0x0;var _0xc5f466=_0x32c2[_0x3be311];return _0xc5f466;};'use strict';var _=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var logger=require(_0x232c('0x2'))(_0x232c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x232c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x232c('0x5'));var config=require(_0x232c('0x6'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x41bf3c,_0x371507){return _0x41bf3c[_0x232c('0x7')](_0x232c('0x8'),attributes,{'tableName':_0x232c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d5=['rimraf','define','lodash','util','api','bluebird','request-promise'];(function(_0x4e4dc4,_0x1113e4){var _0x1cc2ca=function(_0x3f38dc){while(--_0x3f38dc){_0x4e4dc4['push'](_0x4e4dc4['shift']());}};_0x1cc2ca(++_0x1113e4);}(_0x30d5,0x13d));var _0x530d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30d5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x530d('0x0'));var util=require(_0x530d('0x1'));var logger=require('../../config/logger')(_0x530d('0x2'));var moment=require('moment');var BPromise=require(_0x530d('0x3'));var rp=require(_0x530d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x530d('0x5'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x1a8c0c,_0x189787){return _0x1a8c0c[_0x530d('0x6')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index e6ca10a..3038f9a 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 _0x3a0f=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatGroup.socket','register','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3a0f,0x145));var _0xf3a0=function(_0x4e7e33,_0x586e6f){_0x4e7e33=_0x4e7e33-0x0;var _0xa19e0d=_0x3a0f[_0x4e7e33];return _0xa19e0d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3a0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3a0('0x1'));var db=require(_0xf3a0('0x2'))['db'];var utils=require(_0xf3a0('0x3'));var logger=require(_0xf3a0('0x4'))(_0xf3a0('0x5'));var config=require(_0xf3a0('0x6'));var jayson=require(_0xf3a0('0x7'));var client=jayson[_0xf3a0('0x8')]['http']({'port':0x232a});config[_0xf3a0('0x9')]=_[_0xf3a0('0xa')](config[_0xf3a0('0x9')],{'host':_0xf3a0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3a0('0x9')]));require(_0xf3a0('0xc'))[_0xf3a0('0xd')](socket);function respondWithRpcPromise(_0x12970e,_0x4acd91,_0x185cf7){return new BPromise(function(_0x3d2d63,_0x40d12a){return client['request'](_0x12970e,_0x185cf7)[_0xf3a0('0xe')](function(_0x318e6a){logger[_0xf3a0('0xf')]('ChatGroup,\x20%s,\x20%s',_0x4acd91,_0xf3a0('0x10'));logger[_0xf3a0('0x11')](_0xf3a0('0x12'),_0x4acd91,'request\x20sent',JSON['stringify'](_0x318e6a));if(_0x318e6a[_0xf3a0('0x13')]){if(_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x14')]===0x1f4){logger[_0xf3a0('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4acd91,_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);return _0x40d12a(_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);}logger[_0xf3a0('0x13')](_0xf3a0('0x16'),_0x4acd91,_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);return _0x3d2d63(_0x318e6a['error']['message']);}else{logger[_0xf3a0('0xf')](_0xf3a0('0x16'),_0x4acd91,_0xf3a0('0x10'));_0x3d2d63(_0x318e6a[_0xf3a0('0x17')][_0xf3a0('0x15')]);}})[_0xf3a0('0x18')](function(_0x5e04b7){logger['error'](_0xf3a0('0x16'),_0x4acd91,_0x5e04b7);_0x40d12a(_0x5e04b7);});});} \ No newline at end of file +var _0x2234=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x460dae,_0x3a907f){var _0x36e6d0=function(_0x447057){while(--_0x447057){_0x460dae['push'](_0x460dae['shift']());}};_0x36e6d0(++_0x3a907f);}(_0x2234,0x16e));var _0x4223=function(_0x3cbba7,_0x23b17c){_0x3cbba7=_0x3cbba7-0x0;var _0x512e9b=_0x2234[_0x3cbba7];return _0x512e9b;};'use strict';var _=require(_0x4223('0x0'));var util=require(_0x4223('0x1'));var moment=require(_0x4223('0x2'));var BPromise=require(_0x4223('0x3'));var rs=require(_0x4223('0x4'));var fs=require('fs');var Redis=require(_0x4223('0x5'));var db=require(_0x4223('0x6'))['db'];var utils=require(_0x4223('0x7'));var logger=require(_0x4223('0x8'))(_0x4223('0x9'));var config=require('../../config/environment');var jayson=require(_0x4223('0xa'));var client=jayson['client'][_0x4223('0xb')]({'port':0x232a});config[_0x4223('0xc')]=_[_0x4223('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4223('0xc')]));require(_0x4223('0xe'))[_0x4223('0xf')](socket);function respondWithRpcPromise(_0x11e876,_0xd45c53,_0x4edb23){return new BPromise(function(_0x20966d,_0x295378){return client[_0x4223('0x10')](_0x11e876,_0x4edb23)[_0x4223('0x11')](function(_0x243790){logger[_0x4223('0x12')](_0x4223('0x13'),_0xd45c53,_0x4223('0x14'));logger['debug'](_0x4223('0x15'),_0xd45c53,'request\x20sent',JSON[_0x4223('0x16')](_0x243790));if(_0x243790['error']){if(_0x243790[_0x4223('0x17')][_0x4223('0x18')]===0x1f4){logger[_0x4223('0x17')]('ChatGroup,\x20%s,\x20%s',_0xd45c53,_0x243790['error']['message']);return _0x295378(_0x243790[_0x4223('0x17')][_0x4223('0x19')]);}logger[_0x4223('0x17')](_0x4223('0x13'),_0xd45c53,_0x243790[_0x4223('0x17')][_0x4223('0x19')]);return _0x20966d(_0x243790[_0x4223('0x17')][_0x4223('0x19')]);}else{logger[_0x4223('0x12')](_0x4223('0x13'),_0xd45c53,_0x4223('0x14'));_0x20966d(_0x243790[_0x4223('0x1a')][_0x4223('0x19')]);}})[_0x4223('0x1b')](function(_0x313520){logger['error'](_0x4223('0x13'),_0xd45c53,_0x313520);_0x295378(_0x313520);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ba07ecf..9312f44 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 _0x3a73=['save','remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x566fd0,_0x32dbc5){var _0x286694=function(_0x4d8f7c){while(--_0x4d8f7c){_0x566fd0['push'](_0x566fd0['shift']());}};_0x286694(++_0x32dbc5);}(_0x3a73,0x11f));var _0x33a7=function(_0x442fa9,_0x4b274f){_0x442fa9=_0x442fa9-0x0;var _0x27d0ab=_0x3a73[_0x442fa9];return _0x27d0ab;};'use strict';var ChatGroupEvents=require(_0x33a7('0x0'));var events=[_0x33a7('0x1'),_0x33a7('0x2'),_0x33a7('0x3')];function createListener(_0x2ce772,_0x4c981b){return function(_0x5b7f23){_0x4c981b[_0x33a7('0x4')](_0x2ce772,_0x5b7f23);};}function removeListener(_0x323630,_0x17f8df){return function(){ChatGroupEvents[_0x33a7('0x5')](_0x323630,_0x17f8df);};}exports[_0x33a7('0x6')]=function(_0x337c44){for(var _0x331728=0x0,_0x38f15b=events[_0x33a7('0x7')];_0x331728<_0x38f15b;_0x331728++){var _0x1a5f02=events[_0x331728];var _0x2e27d5=createListener(_0x33a7('0x8')+_0x1a5f02,_0x337c44);ChatGroupEvents['on'](_0x1a5f02,_0x2e27d5);}}; \ No newline at end of file +var _0xbf9f=['save','remove','update','removeListener','register','chatGroup:','./chatGroup.events'];(function(_0x1209db,_0x3a865e){var _0x4ecfc5=function(_0x334c6e){while(--_0x334c6e){_0x1209db['push'](_0x1209db['shift']());}};_0x4ecfc5(++_0x3a865e);}(_0xbf9f,0x1bf));var _0xfbf9=function(_0x3d6586,_0x3699d6){_0x3d6586=_0x3d6586-0x0;var _0x2af1c9=_0xbf9f[_0x3d6586];return _0x2af1c9;};'use strict';var ChatGroupEvents=require(_0xfbf9('0x0'));var events=[_0xfbf9('0x1'),_0xfbf9('0x2'),_0xfbf9('0x3')];function createListener(_0x24dfb1,_0x1c8050){return function(_0x25d1d4){_0x1c8050['emit'](_0x24dfb1,_0x25d1d4);};}function removeListener(_0x42f396,_0x30ef2f){return function(){ChatGroupEvents[_0xfbf9('0x4')](_0x42f396,_0x30ef2f);};}exports[_0xfbf9('0x5')]=function(_0x1cc273){for(var _0xd6b581=0x0,_0x568b65=events['length'];_0xd6b581<_0x568b65;_0xd6b581++){var _0x378a84=events[_0xd6b581];var _0x3941c4=createListener(_0xfbf9('0x6')+_0x378a84,_0x1cc273);ChatGroupEvents['on'](_0x378a84,_0x3941c4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 933cd31..848da7e 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 _0xd1ae=['/:id/unread','getMembers','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatGroup.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x2cb642,_0x248ad5){var _0x346dad=function(_0x1905fb){while(--_0x1905fb){_0x2cb642['push'](_0x2cb642['shift']());}};_0x346dad(++_0x248ad5);}(_0xd1ae,0x196));var _0xed1a=function(_0x1efc1b,_0x263414){_0x1efc1b=_0x1efc1b-0x0;var _0x247234=_0xd1ae[_0x1efc1b];return _0x247234;};'use strict';var multer=require(_0xed1a('0x0'));var util=require(_0xed1a('0x1'));var path=require(_0xed1a('0x2'));var timeout=require(_0xed1a('0x3'));var express=require(_0xed1a('0x4'));var router=express[_0xed1a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed1a('0x6'));var config=require('../../config/environment');var controller=require(_0xed1a('0x7'));router[_0xed1a('0x8')]('/',auth['isAuthenticated'](),controller[_0xed1a('0x9')]);router['get'](_0xed1a('0xa'),auth[_0xed1a('0xb')](),controller['describe']);router[_0xed1a('0x8')](_0xed1a('0xc'),auth['isAuthenticated'](),controller[_0xed1a('0xd')]);router[_0xed1a('0x8')](_0xed1a('0xe'),auth[_0xed1a('0xb')](),controller['getUnread']);router[_0xed1a('0x8')]('/:id/members',auth[_0xed1a('0xb')](),controller[_0xed1a('0xf')]);router[_0xed1a('0x8')]('/:id/messages',auth[_0xed1a('0xb')](),controller[_0xed1a('0x10')]);router[_0xed1a('0x11')]('/',auth['isAuthenticated'](),controller[_0xed1a('0x12')]);router[_0xed1a('0x11')](_0xed1a('0x13'),auth[_0xed1a('0xb')](),controller[_0xed1a('0x14')]);router[_0xed1a('0x11')](_0xed1a('0x15'),auth[_0xed1a('0xb')](),controller[_0xed1a('0x16')]);router[_0xed1a('0x17')](_0xed1a('0xc'),auth[_0xed1a('0xb')](),controller['update']);router[_0xed1a('0x18')](_0xed1a('0xc'),auth[_0xed1a('0xb')](),controller[_0xed1a('0x19')]);router[_0xed1a('0x18')]('/:id/members',auth[_0xed1a('0xb')](),controller[_0xed1a('0x1a')]);module[_0xed1a('0x1b')]=router; \ No newline at end of file +var _0x4bd4=['./chatGroup.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','addMembers','put','update','destroy','delete','removeMembers','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0x4bd4,0x123));var _0x44bd=function(_0x13ff50,_0x2bb270){_0x13ff50=_0x13ff50-0x0;var _0x87a17b=_0x4bd4[_0x13ff50];return _0x87a17b;};'use strict';var multer=require(_0x44bd('0x0'));var util=require('util');var path=require(_0x44bd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x44bd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x44bd('0x3'));var interaction=require(_0x44bd('0x4'));var config=require(_0x44bd('0x5'));var controller=require(_0x44bd('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x44bd('0x7')]);router[_0x44bd('0x8')](_0x44bd('0x9'),auth[_0x44bd('0xa')](),controller[_0x44bd('0xb')]);router[_0x44bd('0x8')](_0x44bd('0xc'),auth[_0x44bd('0xa')](),controller[_0x44bd('0xd')]);router[_0x44bd('0x8')](_0x44bd('0xe'),auth[_0x44bd('0xa')](),controller[_0x44bd('0xf')]);router[_0x44bd('0x8')](_0x44bd('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0x44bd('0x8')](_0x44bd('0x11'),auth[_0x44bd('0xa')](),controller[_0x44bd('0x12')]);router[_0x44bd('0x13')]('/',auth[_0x44bd('0xa')](),controller['create']);router['post'](_0x44bd('0x10'),auth[_0x44bd('0xa')](),controller[_0x44bd('0x14')]);router[_0x44bd('0x13')](_0x44bd('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0x44bd('0x15')](_0x44bd('0xc'),auth[_0x44bd('0xa')](),controller[_0x44bd('0x16')]);router['delete'](_0x44bd('0xc'),auth[_0x44bd('0xa')](),controller[_0x44bd('0x17')]);router[_0x44bd('0x18')](_0x44bd('0x10'),auth[_0x44bd('0xa')](),controller[_0x44bd('0x19')]);module[_0x44bd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f029225..df24588 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 _0x867f=['sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','out'];(function(_0x1f96bf,_0x2d3391){var _0x167865=function(_0x5c24ff){while(--_0x5c24ff){_0x1f96bf['push'](_0x1f96bf['shift']());}};_0x167865(++_0x2d3391);}(_0x867f,0xdc));var _0xf867=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0x867f[_0x3b0c9d];return _0xcfc8d7;};'use strict';var Sequelize=require(_0xf867('0x0'));module[_0xf867('0x1')]={'closed':{'type':Sequelize[_0xf867('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xf867('0x3')](_0xf867('0x4'),_0xf867('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf867('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xf867('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf867('0x8')]},'disposition':{'type':Sequelize[_0xf867('0x7')]},'secondDisposition':{'type':Sequelize[_0xf867('0x7')]},'thirdDisposition':{'type':Sequelize[_0xf867('0x7')]},'note':{'type':Sequelize[_0xf867('0x7')]},'browserName':{'type':Sequelize[_0xf867('0x7')]},'browserVersion':{'type':Sequelize[_0xf867('0x7')]},'osName':{'type':Sequelize[_0xf867('0x7')]},'osVersion':{'type':Sequelize[_0xf867('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xf867('0x7')]},'referer':{'type':Sequelize[_0xf867('0x6')]},'customerIp':{'type':Sequelize[_0xf867('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0xf867('0x8')]},'lastMsgAt':{'type':Sequelize[_0xf867('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf867('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf867('0x7')]},'customerPort':{'type':Sequelize[_0xf867('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xf867('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaf4c=['long','DATE','out','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING'];(function(_0x4c60c8,_0x3b1b1e){var _0x5d63a9=function(_0x4a1029){while(--_0x4a1029){_0x4c60c8['push'](_0x4c60c8['shift']());}};_0x5d63a9(++_0x3b1b1e);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0xb75d6a,_0x79af9e){_0xb75d6a=_0xb75d6a-0x0;var _0x2e4198=_0xaf4c[_0xb75d6a];return _0x2e4198;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'closed':{'type':Sequelize[_0xcaf4('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xcaf4('0x2')](_0xcaf4('0x3'),_0xcaf4('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xcaf4('0x5')]},'pathTranscript':{'type':Sequelize[_0xcaf4('0x5')]},'mailTranscript':{'type':Sequelize[_0xcaf4('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcaf4('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcaf4('0x6')]},'note':{'type':Sequelize[_0xcaf4('0x6')]},'browserName':{'type':Sequelize[_0xcaf4('0x6')]},'browserVersion':{'type':Sequelize[_0xcaf4('0x6')]},'osName':{'type':Sequelize[_0xcaf4('0x6')]},'osVersion':{'type':Sequelize[_0xcaf4('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xcaf4('0x6')]},'referer':{'type':Sequelize[_0xcaf4('0x5')]},'customerIp':{'type':Sequelize[_0xcaf4('0x6')]},'formData':{'type':Sequelize[_0xcaf4('0x5')](_0xcaf4('0x7'))},'read1stAt':{'type':Sequelize[_0xcaf4('0x8')]},'lastMsgAt':{'type':Sequelize[_0xcaf4('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xcaf4('0x2')]('in',_0xcaf4('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xcaf4('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xcaf4('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 432b30d..ef3f648 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 _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x27e415,_0x230611){var _0x160fb5=function(_0x4cd4f4){while(--_0x4cd4f4){_0x27e415['push'](_0x27e415['shift']());}};_0x160fb5(++_0x230611);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file +var _0x955f=['CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','ChatInteraction','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','ChatInteractionId','all','rows','includeAll','include','options','create','params','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','update','disposition','AbandonInteraction','attachmentUpload','originalname','file','mimetype','attachmentDownload','findOne','closed','Unauthorized','Attachment','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','pick','includeAgent','findAll','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','direction','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','YYYY-MM-DD\x20HH:mm:ss','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','merge','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x1e5b58,_0xce949a){var _0x16bb52=function(_0x2f74d2){while(--_0x2f74d2){_0x1e5b58['push'](_0x1e5b58['shift']());}};_0x16bb52(++_0xce949a);}(_0x955f,0x1eb));var _0xf955=function(_0x412c6f,_0x45084c){_0x412c6f=_0x412c6f-0x0;var _0x165fb5=_0x955f[_0x412c6f];return _0x165fb5;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf955('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf955('0x13'))(_0xf955('0x14'));var utils=require(_0xf955('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf955('0x16'));var db=require('../../mysqldb')['db'];config[_0xf955('0x17')]=_['defaults'](config[_0xf955('0x17')],{'host':_0xf955('0x18'),'port':0x18eb});var socket=require(_0xf955('0x19'))(new Redis(config[_0xf955('0x17')]));require(_0xf955('0x1a'))[_0xf955('0x1b')](socket);var jayson=require(_0xf955('0x1c'));var client=jayson[_0xf955('0x1d')][_0xf955('0x1e')]({'port':0x232b});var client9004=jayson[_0xf955('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc29b35,_0x54e60b,_0x3139d5,_0x3a814f){return new BPromise(function(_0x2f881b,_0x15c07c){var _0x50930d=_0x3a814f||client;return _0x50930d['request'](_0xc29b35,_0x3139d5)[_0xf955('0x1f')](function(_0xe6de5c){logger[_0xf955('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x54e60b,_0xf955('0x21'));logger[_0xf955('0x22')](_0xf955('0x23'),_0x54e60b,_0xf955('0x21'),JSON[_0xf955('0x24')](_0xe6de5c));if(_0xe6de5c['error']){if(_0xe6de5c[_0xf955('0x25')][_0xf955('0x26')]===0x1f4){logger[_0xf955('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x54e60b,_0xe6de5c[_0xf955('0x25')]['message']);return _0x15c07c(_0xe6de5c[_0xf955('0x25')][_0xf955('0x27')]);}logger[_0xf955('0x25')](_0xf955('0x28'),_0x54e60b,_0xe6de5c[_0xf955('0x25')]['message']);return _0x2f881b(_0xe6de5c[_0xf955('0x25')][_0xf955('0x27')]);}else{logger[_0xf955('0x20')](_0xf955('0x28'),_0x54e60b,_0xf955('0x21'));_0x2f881b(_0xe6de5c[_0xf955('0x29')][_0xf955('0x27')]);}})['catch'](function(_0x18f435){logger[_0xf955('0x25')](_0xf955('0x28'),_0x54e60b,_0x18f435);_0x15c07c(_0x18f435);});});}function respondWithStatusCode(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0xcc;return function(_0x13a86d){if(_0x13a86d){return _0x406632[_0xf955('0x2a')](_0x2dcd55);}return _0x406632['status'](_0x2dcd55)[_0xf955('0x2b')]();};}function respondWithResult(_0x145098,_0x41c9f6){_0x41c9f6=_0x41c9f6||0xc8;return function(_0xbd0b74){if(_0xbd0b74){return _0x145098[_0xf955('0x2c')](_0x41c9f6)[_0xf955('0x2d')](_0xbd0b74);}};}function respondWithFilteredResult(_0x4d4af0,_0x2232a7){return function(_0x1e5d37){if(_0x1e5d37){var _0x4ec3e8=typeof _0x2232a7[_0xf955('0x2e')]===_0xf955('0x2f')&&typeof _0x2232a7[_0xf955('0x30')]===_0xf955('0x2f');var _0x59bfb5=_0x1e5d37[_0xf955('0x31')];var _0x518fb3=_0x4ec3e8?0x0:_0x2232a7[_0xf955('0x2e')];var _0x2c222a=_0x4ec3e8?_0x1e5d37[_0xf955('0x31')]:_0x2232a7[_0xf955('0x2e')]+_0x2232a7[_0xf955('0x30')];var _0x32121b;if(_0x2c222a>=_0x59bfb5){_0x2c222a=_0x59bfb5;_0x32121b=0xc8;}else{_0x32121b=0xce;}_0x4d4af0[_0xf955('0x2c')](_0x32121b);return _0x4d4af0[_0xf955('0x32')]('Content-Range',_0x518fb3+'-'+_0x2c222a+'/'+_0x59bfb5)[_0xf955('0x2d')](_0x1e5d37);}return null;};}function patchUpdates(_0x165cc4){return function(_0x3964d3){try{jsonpatch[_0xf955('0x33')](_0x3964d3,_0x165cc4,!![]);}catch(_0x4fea0c){return BPromise[_0xf955('0x34')](_0x4fea0c);}return _0x3964d3[_0xf955('0x35')]();};}function saveUpdates(_0x3c81bc,_0xe1b436){return function(_0xdbc53e){if(_0xdbc53e){return _0xdbc53e['update'](_0x3c81bc)['then'](function(_0x5480db){return _0x5480db;});}return null;};}function removeEntity(_0x2626cb,_0x3783dc){return function(_0x374e95){if(_0x374e95){return _0x374e95[_0xf955('0x36')]()[_0xf955('0x1f')](function(){_0x2626cb[_0xf955('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3acc4b,_0x515dc6){return function(_0x8f842f){if(!_0x8f842f){_0x3acc4b[_0xf955('0x2a')](0x194);}return _0x8f842f;};}function handleError(_0xe33ef2,_0x51762d){_0x51762d=_0x51762d||0x1f4;return function(_0x60a421){logger['error'](_0x60a421[_0xf955('0x37')]);if(_0x60a421[_0xf955('0x38')]){delete _0x60a421[_0xf955('0x38')];}_0xe33ef2[_0xf955('0x2c')](_0x51762d)['send'](_0x60a421);};}function getMustacheRender(_0xf35170,_0x118c92){return Mustache['render'](_0xf35170,_[_0xf955('0x39')](_0x118c92[_0xf955('0x3a')],{'contact':_0x118c92[_0xf955('0x3b')],'message':_0x118c92['message'],'agent':_0x118c92[_0xf955('0x3c')],'interaction':_0x118c92[_0xf955('0x3d')],'account':_0x118c92[_0xf955('0x3e')]}))||'';}function getInteractionUsers(_0x488b6e,_0x97e8ff){return new BPromise(function(_0x195faa,_0x21e4a6){try{if(_0x97e8ff[_0x488b6e['id']]){_0x488b6e[_0xf955('0x3f')]=_[_0xf955('0x40')](_0x97e8ff[_0x488b6e['id']],function(_0x3c4b29){return{'id':_0x3c4b29['id'],'fullname':_0x3c4b29[_0xf955('0x41')]};});}}catch(_0x228dae){_0x21e4a6(_0x228dae);}_0x195faa(_0x488b6e);});}function getInteractionTags(_0x5671c7,_0x8fa41b){return new BPromise(function(_0x7123c1,_0x2aacdf){try{if(_0x5671c7[_0xf955('0x42')]){_0x5671c7[_0xf955('0x43')]=[];_0x5671c7[_0xf955('0x42')][_0xf955('0x44')](',')[_0xf955('0x45')](function(_0x47651b){_0x5671c7[_0xf955('0x43')][_0xf955('0x46')](_0x8fa41b[_0x47651b]);});}delete _0x5671c7[_0xf955('0x42')];}catch(_0x40d7e9){_0x2aacdf(_0x40d7e9);}_0x7123c1(_0x5671c7);});}function updateChatInteraction(_0x159ae3,_0x3557b5,_0x248f60){return new BPromise(function(_0x356ec2,_0x34f0f1){return getInteractionUsers(_0x159ae3,_0x248f60)[_0xf955('0x1f')](function(_0x5dd300){return getInteractionTags(_0x5dd300,_0x3557b5);})[_0xf955('0x1f')](function(_0x25d809){_0x356ec2(_0x25d809);})[_0xf955('0x47')](function(_0x5f0ef9){_0x34f0f1(_0x5f0ef9);});});}exports[_0xf955('0x48')]=function(_0x485e77,_0x398224){var _0x56a4ca={},_0x103ac2={},_0x24cb74={'count':0x0,'rows':[]};var _0x213136=_[_0xf955('0x40')](db['ChatInteraction'][_0xf955('0x49')],function(_0xdb1cc){return{'name':_0xdb1cc[_0xf955('0x4a')],'type':_0xdb1cc['type']['key']};});_0x103ac2[_0xf955('0x4b')]=_[_0xf955('0x40')](_0x213136,_0xf955('0x38'));_0x103ac2[_0xf955('0x4c')]=_['keys'](_0x485e77[_0xf955('0x4c')]);_0x103ac2[_0xf955('0x4d')]=_[_0xf955('0x4e')](_0x103ac2['model'],_0x103ac2[_0xf955('0x4c')]);_0x56a4ca['attributes']=_[_0xf955('0x4e')](_0x103ac2[_0xf955('0x4b')],qs[_0xf955('0x4f')](_0x485e77['query'][_0xf955('0x4f')]));_0x56a4ca[_0xf955('0x50')]=_0x56a4ca[_0xf955('0x50')][_0xf955('0x51')]?_0x56a4ca['attributes']:_0x103ac2[_0xf955('0x4b')];if(!_0x485e77[_0xf955('0x4c')][_0xf955('0x52')](_0xf955('0x53'))){_0x56a4ca[_0xf955('0x30')]=qs['limit'](_0x485e77[_0xf955('0x4c')]['limit']);_0x56a4ca[_0xf955('0x2e')]=qs['offset'](_0x485e77[_0xf955('0x4c')]['offset']);}_0x56a4ca['order']=qs[_0xf955('0x54')](_0x485e77[_0xf955('0x4c')]['sort']);_0x56a4ca[_0xf955('0x55')]=qs['filters'](_['pick'](_0x485e77['query'],_0x103ac2['filters']),_0x213136);var _0x3c37e2=[];var _0x1abe1c=squel['select']()['field']('id')[_0xf955('0x56')](_0xf955('0x38'))[_0xf955('0x56')](_0xf955('0x57'))[_0xf955('0x58')](_0xf955('0x59'));var _0x190500=squel[_0xf955('0x5a')]()[_0xf955('0x56')](_0xf955('0x5b'))[_0xf955('0x56')](_0xf955('0x5c'))['field'](_0xf955('0x5d'))[_0xf955('0x58')](_0xf955('0x5e'),'ui')[_0xf955('0x5f')](_0xf955('0x60'),'u','u.id\x20=\x20ui.UserId');var _0xf5d575=squel[_0xf955('0x5a')]()[_0xf955('0x58')](_0xf955('0x61'),'i')[_0xf955('0x5f')](_0xf955('0x62'),'c',_0xf955('0x63'))[_0xf955('0x5f')](_0xf955('0x60'),'o',_0xf955('0x64'))['left_join'](_0xf955('0x65'),'a',_0xf955('0x66'))[_0xf955('0x5f')](_0xf955('0x67'),'me',_0xf955('0x68'))[_0xf955('0x5f')](_0xf955('0x69'),'it',_0xf955('0x6a'))[_0xf955('0x5f')](_0xf955('0x59'),'t',_0xf955('0x6b'));var _0x2b8173=squel['expr']();var _0x1388a0=[];var _0x452de9=squel[_0xf955('0x6c')]();var _0x3eb727;if(_0x485e77[_0xf955('0x4c')][_0xf955('0x6d')]){_0x3eb727=as[_0xf955('0x6e')](_0x485e77['query']['search']);var _0x5e73ff=_0x3eb727[_0xf955('0x6f')];for(var _0x530ec7=0x0;_0x530ec7<_0x3eb727['conditions'][_0xf955('0x51')];_0x530ec7++){var _0x533e0f=_0x3eb727[_0xf955('0x70')][_0x530ec7];var _0x3fa5b5='i';var _0x158469=_[_0xf955('0x71')](_0x213136,['name',_0x533e0f[_0xf955('0x56')]]);if(!_0x158469){switch(_0x533e0f[_0xf955('0x56')]){case _0xf955('0x72'):if(_0x533e0f[_0xf955('0x73')]==0x1){_0xf5d575[_0xf955('0x74')]('`'+_0x533e0f['field']+_0xf955('0x75'));}else{_0xf5d575['having']('`'+_0x533e0f[_0xf955('0x56')]+_0xf955('0x76'));}break;case _0xf955('0x77'):if(_0x533e0f['operator']===_0xf955('0x78')){if(_0x533e0f[_0xf955('0x73')][_0xf955('0x44')]('\x20')[_0xf955('0x51')]>0x1){_0x2b8173[_0x5e73ff](_0xf955('0x79'),qs[_0xf955('0x7a')](_0x533e0f[_0xf955('0x73')]),null);}else{var _0x47e5de='%'+_0x533e0f['value']+'%';_0x2b8173[_0x5e73ff](_0xf955('0x7b'),_0x47e5de,_0x47e5de,_0x47e5de);}}else{_0x158469=_[_0xf955('0x71')](_0x213136,[_0xf955('0x38'),_0xf955('0x7c')]);_0x533e0f[_0xf955('0x56')]=_0xf955('0x7c');_0x4b85c2=as[_0xf955('0x7d')](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')][_0xf955('0x80')],_0x4b85c2['value'][_0xf955('0x2b')]);}break;case'Tag':var _0x431729=_0x533e0f['value']['split'](',')[_0xf955('0x40')](function(_0x20f11c){return Number(_0x20f11c);});_0x431729['forEach'](function(_0x1e95c3){_0x452de9['or'](_0xf955('0x81'),'%,'+_0x1e95c3+',%');});_0x1388a0=_['union'](_0x1388a0,_0x431729);break;case'User':if(_0x533e0f[_0xf955('0x82')]===_0xf955('0x78')){_0x2b8173[_0x5e73ff](_0xf955('0x83'),'%'+_0x533e0f['value']+'%',null);}else{_0x158469=_[_0xf955('0x71')](_0x213136,[_0xf955('0x38'),_0xf955('0x84')]);_0x533e0f[_0xf955('0x56')]=_0xf955('0x84');_0x4b85c2=as[_0xf955('0x7d')](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2['value'][_0xf955('0x80')],_0x4b85c2[_0xf955('0x73')]['end']);}break;case _0xf955('0x3a'):_0x4b85c2=as[_0xf955('0x7d')]('me',null,_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')]['start'],_0x4b85c2[_0xf955('0x73')][_0xf955('0x2b')]);break;}}else{var _0x4b85c2=as['buildExpression'](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')][_0xf955('0x80')],_0x4b85c2['value'][_0xf955('0x2b')]);}}}else{var _0x430571=_(_0x485e77[_0xf955('0x4c')])[_0xf955('0x85')]()[_0xf955('0x40')](function(_0x3e9c6e){return _[_0xf955('0x86')](_0x213136,[_0xf955('0x38'),_0x3e9c6e])?_0x3e9c6e:undefined;})[_0xf955('0x87')]()[_0xf955('0x73')]();if(!_[_0xf955('0x88')](_0x430571)){_0x430571[_0xf955('0x45')](function(_0x4254a2){if(_0x4254a2==='ChatWebsiteId'){_0xf5d575[_0xf955('0x55')](_0xf955('0x89'),[][_0xf955('0x8a')](_0x485e77[_0xf955('0x4c')][_0x4254a2]));}else if(_0x4254a2==='createdAt'){var _0xcf6900=JSON[_0xf955('0x8b')](_0x485e77[_0xf955('0x4c')][_0x4254a2])[_0xf955('0x8c')];var _0x2b266d=JSON[_0xf955('0x8b')](_0x485e77[_0xf955('0x4c')][_0x4254a2])[_0xf955('0x8d')];_0xf5d575[_0xf955('0x55')](_0xf955('0x8e'),_0xcf6900,_0x2b266d);}else{if(_0x485e77[_0xf955('0x4c')][_0x4254a2]==='null'){_0xf5d575[_0xf955('0x55')]('i.'+_0x4254a2+_0xf955('0x8f'));}else{_0xf5d575[_0xf955('0x55')]('i.'+_0x4254a2+_0xf955('0x90'),_0x485e77[_0xf955('0x4c')][_0x4254a2]);}}});}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x91')]){if(_0x485e77['query'][_0xf955('0x91')]==0x1){_0xf5d575['having'](_0xf955('0x92'));}else{_0xf5d575['having'](_0xf955('0x93'));}}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x94')]){_0x1388a0=_[_0xf955('0x95')](_0x485e77[_0xf955('0x4c')][_0xf955('0x94')])?_0x485e77['query'][_0xf955('0x94')]:new Array(_0x485e77[_0xf955('0x4c')][_0xf955('0x94')]);_0x1388a0['forEach'](function(_0x526346){_0x452de9['or'](_0xf955('0x81'),'%,'+_0x526346+',%');});}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x96')]){var _0x595d60=_0x485e77[_0xf955('0x4c')]['filter'][_0xf955('0x97')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf955('0x98')](_0x595d60)){_0x2b8173['or'](_0xf955('0x99'),_0x595d60+'%');}else{_0x2b8173['or'](_0xf955('0x9a'),qs['getFullTextValue'](_0x595d60))['or'](_0xf955('0x9b'),_0x595d60+'%');}}}_0xf5d575[_0xf955('0x55')](_0x2b8173);_0xf5d575[_0xf955('0x9c')]('i.id');var _0xba62d0={'type':db[_0xf955('0x9d')][_0xf955('0x9e')][_0xf955('0x9f')],'raw':!![]};var _0x419da5=_0xf5d575[_0xf955('0xa0')]();_0x419da5[_0xf955('0x56')]('i.id');_0x419da5[_0xf955('0x56')](_0xf955('0xa1'),_0xf955('0x72'));if(_0x56a4ca[_0xf955('0xa2')]){_0x56a4ca[_0xf955('0xa2')]['forEach'](function(_0x15c3e1){var _0x23f90c=_0x15c3e1[0x0]==='contactName'?_0x15c3e1[0x0]:'i.'+_0x15c3e1[0x0];_0xf5d575['order'](_0x23f90c,_0x15c3e1[0x1]===_0xf955('0xa3')?![]:!![]);});}if(!_[_0xf955('0x88')](_0x1388a0)){_0xf5d575[_0xf955('0x74')](_0x452de9);_0x419da5[_0xf955('0x55')]('t.id\x20IN\x20?',_0x1388a0);}BPromise[_0xf955('0xa4')]()['then'](function(){if(!_0x3eb727){if(_0x485e77['query'][_0xf955('0xa5')])return;_0x419da5[_0xf955('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xf5d575['where'](_0xf955('0xa6'));return;}if(_0x485e77[_0xf955('0xa7')][_0xf955('0xa8')]!=='agent')return;return _0x485e77['user'][_0xf955('0xa9')]({'attributes':['id'],'raw':!![]})[_0xf955('0x1f')](function(_0x15fc7e){if(_['isEmpty'](_0x15fc7e)){_0x419da5['where']('i.ChatWebsiteId\x20IS\x20NULL');_0xf5d575['where'](_0xf955('0xaa'));}else{_0x419da5['where'](_0xf955('0x89'),_[_0xf955('0x40')](_0x15fc7e,'id'));_0xf5d575[_0xf955('0x55')](_0xf955('0x89'),_[_0xf955('0x40')](_0x15fc7e,'id'));}});})['then'](function(){if(_0x485e77[_0xf955('0xa7')][_0xf955('0xa8')]===_0xf955('0x3c')&&!_0x3eb727&&!_0x485e77[_0xf955('0x4c')]['ChatWebsiteId'])return[];return db[_0xf955('0xab')][_0xf955('0x4c')](_0x419da5['toString'](),_0xba62d0);})[_0xf955('0x1f')](function(_0x1819f6){_0x24cb74[_0xf955('0x31')]=_0x1819f6[_0xf955('0x51')];if(_0x24cb74[_0xf955('0x31')]===0x0)return[];return db[_0xf955('0xab')]['query'](_0x1abe1c['toString'](),_0xba62d0)[_0xf955('0x1f')](function(_0x545275){_0x3c37e2=_[_0xf955('0xac')](_0x545275,'id');_0xba62d0=_[_0xf955('0x39')](_0xba62d0,{'model':db[_0xf955('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x485e77[_0xf955('0x4c')]['fields']){_0x56a4ca['attributes'][_0xf955('0x45')](function(_0x12b9f8){_0xf5d575[_0xf955('0x56')]('i.'+_0x12b9f8);});}else{_0xf5d575[_0xf955('0x56')](_0xf955('0xa1'),'unreadMessages');_0xf5d575[_0xf955('0x56')](_0xf955('0xae'),_0xf955('0xaf'));_0xf5d575[_0xf955('0x56')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xf5d575[_0xf955('0x56')](_0xf955('0xb0'),'contactName');_0xf5d575[_0xf955('0x56')](_0xf955('0xb1'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb2'),'Contact.firstName');_0xf5d575[_0xf955('0x56')](_0xf955('0xb3'),_0xf955('0xb4'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb5'),_0xf955('0xb6'));_0xf5d575[_0xf955('0x56')]('c.phone','Contact.phone');_0xf5d575['field'](_0xf955('0xb7'),_0xf955('0xb8'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb9'),_0xf955('0xba'));_0xf5d575[_0xf955('0x56')](_0xf955('0xbb'),'Owner.fullname');_0xf5d575[_0xf955('0x56')](_0xf955('0xbc'),'Owner.internal');_0xf5d575[_0xf955('0x56')](_0xf955('0xbd'),_0xf955('0x42'));}if(_0x56a4ca[_0xf955('0x30')])_0xf5d575[_0xf955('0x30')](_0x56a4ca[_0xf955('0x30')]);if(_0x56a4ca[_0xf955('0x2e')])_0xf5d575[_0xf955('0x2e')](_0x56a4ca['offset']);return db['sequelize']['query'](_0xf5d575[_0xf955('0xbe')](),_0xba62d0);})[_0xf955('0x1f')](function(_0x210666){if(_0x210666[_0xf955('0x51')]>0x0)_0x190500[_0xf955('0x55')]('ui.ChatInteractionId\x20IN\x20?',_[_0xf955('0x40')](_0x210666,'id'));return db[_0xf955('0xab')][_0xf955('0x4c')](_0x190500[_0xf955('0xbe')](),_0xba62d0)[_0xf955('0x1f')](function(_0x36731b){var _0x11f6f8=_[_0xf955('0xbf')](_0x36731b,_0xf955('0xc0'));var _0x4a71e5=[];_0x210666[_0xf955('0x45')](function(_0x47daca){_0x4a71e5[_0xf955('0x46')](updateChatInteraction(_0x47daca,_0x3c37e2,_0x11f6f8));});return BPromise[_0xf955('0xc1')](_0x4a71e5);});});})[_0xf955('0x1f')](function(_0x427ab9){_0x24cb74[_0xf955('0xc2')]=_0x427ab9;return _0x24cb74;})[_0xf955('0x1f')](respondWithFilteredResult(_0x398224,_0x56a4ca))[_0xf955('0x47')](handleError(_0x398224,null));};exports['show']=function(_0x1ef189,_0x4bb590){var _0x222df2={'raw':![],'where':{'id':_0x1ef189['params']['id']}},_0x40d7c7={};_0x40d7c7[_0xf955('0x4b')]=_[_0xf955('0x85')](db[_0xf955('0xad')][_0xf955('0x49')]);_0x40d7c7[_0xf955('0x4c')]=_[_0xf955('0x85')](_0x1ef189[_0xf955('0x4c')]);_0x40d7c7['filters']=_[_0xf955('0x4e')](_0x40d7c7[_0xf955('0x4b')],_0x40d7c7['query']);_0x222df2[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x40d7c7['model'],qs['fields'](_0x1ef189[_0xf955('0x4c')][_0xf955('0x4f')]));_0x222df2[_0xf955('0x50')]=_0x222df2['attributes'][_0xf955('0x51')]?_0x222df2[_0xf955('0x50')]:_0x40d7c7[_0xf955('0x4b')];if(_0x1ef189[_0xf955('0x4c')][_0xf955('0xc3')]){_0x222df2[_0xf955('0xc4')]=[{'all':!![]}];}_0x222df2=_[_0xf955('0x39')]({},_0x222df2,_0x1ef189[_0xf955('0xc5')]);return db[_0xf955('0xad')][_0xf955('0x71')](_0x222df2)[_0xf955('0x1f')](handleEntityNotFound(_0x4bb590,null))[_0xf955('0x1f')](respondWithResult(_0x4bb590,null))[_0xf955('0x47')](handleError(_0x4bb590,null));};exports[_0xf955('0xc6')]=function(_0x490981,_0x58464d){return db[_0xf955('0xad')][_0xf955('0xc6')](_0x490981[_0xf955('0x3a')],{})[_0xf955('0x1f')](respondWithResult(_0x58464d,0xc9))[_0xf955('0x47')](handleError(_0x58464d,null));};exports['update']=function(_0x161d06,_0x3bab0d){if(_0x161d06['body']['id']){delete _0x161d06[_0xf955('0x3a')]['id'];}return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x161d06[_0xf955('0xc7')]['id']}})['then'](handleEntityNotFound(_0x3bab0d,null))[_0xf955('0x1f')](saveUpdates(_0x161d06['body'],null))[_0xf955('0x1f')](respondWithResult(_0x3bab0d,null))[_0xf955('0x47')](handleError(_0x3bab0d,null));};exports[_0xf955('0x36')]=function(_0xe9f9a8,_0x5aff59){return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0xe9f9a8[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x5aff59,null))[_0xf955('0x1f')](removeEntity(_0x5aff59,null))['catch'](handleError(_0x5aff59,null));};exports[_0xf955('0xc8')]=function(_0x1f38db,_0x395013){return db['ChatInteraction'][_0xf955('0xc8')]()[_0xf955('0x1f')](respondWithResult(_0x395013,null))[_0xf955('0x47')](handleError(_0x395013,null));};exports[_0xf955('0xc9')]=function(_0x19665c,_0x437020){var _0x12d158=_0x19665c['params']['id'];var _0x5a6abe;var _0x4e3013;var _0x345a7c;return db[_0xf955('0xad')]['findOne']({'where':{'id':_0x12d158}})[_0xf955('0x1f')](function(_0x42ba43){_0x5a6abe=_0x42ba43;return db[_0xf955('0xca')]['findOne']({'where':{'id':_0x42ba43[_0xf955('0xa5')]},'attributes':['id',_0xf955('0xcb'),'vidaooEscalation','vidaooTopic',_0xf955('0xcc'),_0xf955('0xcd')],'raw':!![]});})[_0xf955('0x1f')](function(_0x30baa1){if(_0x30baa1&&_0x30baa1[_0xf955('0xcb')]&&_0x30baa1['vidaooEscalation']){_0x4e3013=_0x30baa1;var _0xc881d4={'interaction':{'id':_0x12d158},'agent':{'id':_0x19665c[_0xf955('0xa7')]['id'],'name':_0x19665c[_0xf955('0xa7')][_0xf955('0x38')],'fullname':_0x19665c[_0xf955('0xa7')]['fullname'],'email':_0x19665c[_0xf955('0xa7')][_0xf955('0xce')]},'contact':_0x19665c[_0xf955('0x3a')][_0xf955('0x3b')],'account':_0x19665c['body'][_0xf955('0x3e')]};var _0x410d1f={'rejectUnauthorized':![],'method':_0xf955('0xcf'),'url':_0xf955('0xd0'),'headers':{'X-APIKEY':_0x30baa1[_0xf955('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x19665c['user'][_0xf955('0xce')]],'buttons':null,'topic':_0x4e3013[_0xf955('0xd1')],'note':_['isNull'](_0x4e3013[_0xf955('0xcc')])?null:getMustacheRender(_0x4e3013[_0xf955('0xcc')],_0xc881d4),'metadata':null},'redirect':_0xf955('0xd2'),'json':!![]};try{if(!_[_0xf955('0xd3')](_0x4e3013[_0xf955('0xcd')])){var _0x38e031=getMustacheRender(_0x4e3013[_0xf955('0xcd')],_0xc881d4);var _0x4f53ef=JSON[_0xf955('0x8b')](_0x38e031);_0x410d1f[_0xf955('0x3a')]['metadata']=_0x4f53ef;}}catch(_0x5395aa){throw new db[(_0xf955('0x9d'))][(_0xf955('0xd4'))](_0xf955('0xd5'));}return rp(_0x410d1f);}else{throw new db[(_0xf955('0x9d'))]['ValidationError'](_0xf955('0xd6'));}})[_0xf955('0x1f')](function(_0x57e0d7){_0x345a7c=_0x57e0d7;if(_0x345a7c['id']){var _0x54903a={'body':_0x345a7c[_0xf955('0xd7')],'ChatWebsiteId':_0x4e3013['id'],'ChatInteractionId':_0x5a6abe['id'],'direction':_0xf955('0xd8'),'UserId':_0x19665c[_0xf955('0xa7')]['id']};return db[_0xf955('0xd9')]['create'](_0x54903a,{});}else{throw new db[(_0xf955('0x9d'))][(_0xf955('0xd4'))](_0xf955('0xda'));}})[_0xf955('0x1f')](function(){return _0x5a6abe[_0xf955('0xdb')]({'vidaooSessionId':_0x345a7c['id']});})[_0xf955('0x1f')](respondWithResult(_0x437020,null))[_0xf955('0x47')](handleError(_0x437020,null));};exports[_0xf955('0xdc')]=function(_0x4c7a54,_0xde084e){if(_0x4c7a54[_0xf955('0x3a')]['id']){delete _0x4c7a54[_0xf955('0x3a')]['id'];}return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x4c7a54[_0xf955('0xc7')]['id']},'include':[{'model':db[_0xf955('0xdd')],'as':_0xf955('0x77')}]})[_0xf955('0x1f')](handleEntityNotFound(_0xde084e,null))[_0xf955('0x1f')](saveUpdates(_0x4c7a54['body'],null))[_0xf955('0x1f')](respondWithResult(_0xde084e,null))[_0xf955('0x47')](handleError(_0xde084e,null));};exports[_0xf955('0xde')]=function(_0x27391f,_0x269ae2,_0x3250df){if(_0x27391f[_0xf955('0x3a')]['id']){delete _0x27391f['body']['id'];}return db[_0xf955('0xad')]['find']({'where':{'id':_0x27391f[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](function(_0x14cde9){if(!_0x14cde9){logger[_0xf955('0x25')](_0xf955('0xdf'),_0xf955('0xde'),0x194,_0xf955('0xe0'));_0x269ae2[_0xf955('0x2a')](0x194);}else{if(_0x14cde9[_0xf955('0x84')]){throw new db['Sequelize'][(_0xf955('0xd4'))](_0xf955('0xe1'));}}return _0x14cde9;})[_0xf955('0x1f')](function(_0x3d5c15){if(_0x3d5c15){return _0x3d5c15[_0xf955('0xe2')]({'closed':_0x27391f[_0xf955('0x3a')]['closed'],'disposition':_0x27391f[_0xf955('0x3a')][_0xf955('0xe3')]})[_0xf955('0x1f')](function(_0x5c8a3f){return _0x5c8a3f;});}})[_0xf955('0x1f')](function(_0x471223){return respondWithRpcPromise(_0xf955('0xe4'),_0xf955('0xde'),_0x27391f[_0xf955('0x3a')],client9004);})[_0xf955('0x1f')](respondWithResult(_0x269ae2,null))['catch'](handleError(_0x269ae2,null));};exports[_0xf955('0xe5')]=function(_0x4775bd,_0x2a862f,_0x42e3eb){_0x4775bd[_0xf955('0x3a')][_0xf955('0x38')]=_0x4775bd['file'][_0xf955('0xe6')];_0x4775bd['body']['basename']=_0x4775bd['file']['filename'];_0x4775bd[_0xf955('0x3a')]['type']=_0x4775bd[_0xf955('0xe7')][_0xf955('0xe8')];return db['Attachment'][_0xf955('0xc6')](_0x4775bd['body'])[_0xf955('0x1f')](respondWithResult(_0x2a862f,0xc9))['catch'](handleError(_0x2a862f,null));};exports[_0xf955('0xe9')]=function(_0x267963,_0x28ce39,_0x43a5c3){return db['ChatInteraction'][_0xf955('0xea')]({'where':{'id':_0x267963['params']['id']},'raw':!![]})[_0xf955('0x1f')](handleEntityNotFound(_0x28ce39,null))[_0xf955('0x1f')](function(_0x30fd01){if(_0x30fd01){if(_0x30fd01[_0xf955('0xeb')]){return _0x28ce39[_0xf955('0x2c')](0x193)[_0xf955('0x2d')]({'status':0x193,'message':_0xf955('0xec')});}return db[_0xf955('0xed')][_0xf955('0xea')]({'where':{'id':_0x267963[_0xf955('0x4c')]['attachId']},'raw':!![]})[_0xf955('0x1f')](handleEntityNotFound(_0x28ce39,null));}})[_0xf955('0x1f')](function(_0x444e24){if(_0x444e24){var _0x2fb11a=_0x444e24[_0xf955('0xee')]!==null;var _0x2ce35c=path[_0xf955('0xef')](config['root'],_0xf955('0xf0'));if(_0x2fb11a){_0x2ce35c=path[_0xf955('0xef')](_0x2ce35c,_0xf955('0xf1'));}var _0x1e35d7=path[_0xf955('0xef')](_0x2ce35c,_0x444e24[_0xf955('0xf2')]);return _0x28ce39[_0xf955('0xf3')](_0x1e35d7);}})[_0xf955('0x47')](handleError(_0x28ce39,null));};exports[_0xf955('0xf4')]=function(_0x38016a,_0x52ad4d){var _0x1620ec=null;var _0x2c8e49=null;var _0x2b3deb=null;var _0x1ae12a=null;if(_0x38016a[_0xf955('0x3a')]['id']){delete _0x38016a[_0xf955('0x3a')]['id'];}if(_0x38016a[_0xf955('0x3a')][_0xf955('0xf5')]){_0x1ae12a=path['join'](config[_0xf955('0xf6')],_0xf955('0xf7'),util[_0xf955('0xf8')](_0xf955('0xf9'),Date[_0xf955('0xfa')]()));_0x38016a[_0xf955('0x3a')][_0xf955('0xfb')]=_0x1ae12a;}return db[_0xf955('0xad')]['find']({'where':{'id':_0x38016a['params']['id']},'include':[{'model':db[_0xf955('0xd9')],'as':_0xf955('0xfc'),'include':[{'model':db[_0xf955('0xfd')],'as':_0xf955('0xfd')}]}]})['then'](handleEntityNotFound(_0x52ad4d,null))['then'](saveUpdates(_0x38016a[_0xf955('0x3a')],null))[_0xf955('0x1f')](function(_0x4860ad){if(_0x4860ad){_0x1620ec=_0x4860ad;return db[_0xf955('0xca')][_0xf955('0x71')]({'where':{'id':_0x1620ec[_0xf955('0xa5')]}});}})[_0xf955('0x1f')](function(_0x1c0211){if(_0x1c0211){_0x2b3deb=_0x1c0211;return db['CmContact'][_0xf955('0x71')]({'where':{'id':_0x1620ec[_0xf955('0x7c')]}});}})[_0xf955('0x1f')](function(_0x106640){if(_0x106640){_0x2c8e49=_0x106640;if(_0x1ae12a){var _0x101722=null;for(var _0x479dc0=0x1;_0x479dc0<_0x1620ec[_0xf955('0xfc')]['length'];++_0x479dc0){_0x101722=_0x1620ec[_0xf955('0xfc')][_0x479dc0];var _0x570005=_0x101722[_0xf955('0x84')]?util[_0xf955('0xf8')](_0xf955('0xfe'),_0x2b3deb[_0xf955('0xff')],_0x101722[_0xf955('0x84')]):_0xf955('0x100');var _0x85661f=_0x38016a[_0xf955('0x3a')][_0xf955('0x101')]||util[_0xf955('0xf8')]('%s%d','Visitor',_0x101722[_0xf955('0x7c')]);switch(_0x2b3deb[_0xf955('0x102')]){case _0xf955('0x103'):_0x570005=_0x101722[_0xf955('0x84')]?util['format']('%s%d',_0x2b3deb[_0xf955('0xff')],_0x101722['UserId']):'System';break;case _0xf955('0x104'):_0x570005=_0x101722['UserId']?_0x101722[_0xf955('0xfd')][_0xf955('0x105')]||_0x101722['User']['fullname']:_0xf955('0x100');break;case _0xf955('0x106'):_0x570005=_0x101722[_0xf955('0x84')]?_0x101722[_0xf955('0xfd')][_0xf955('0x41')]:'System';break;default:_0x570005=_0x101722[_0xf955('0x84')]?util['format']('%s%d',_0x2b3deb['agentAlias'],_0x101722[_0xf955('0x84')]):_0xf955('0x100');}var _0x23d382=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x101722[_0xf955('0x107')])['format'](_0xf955('0x108')),_0x101722['direction']==='in'?_0x85661f:_0x570005,_0x101722[_0xf955('0x3a')]);if(!_0x101722[_0xf955('0x109')]){fs['appendFileSync'](_0x1ae12a,_0x23d382);}}return db[_0xf955('0x10a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf955('0x10b')],'as':_0xf955('0x10c'),'raw':!![]}]});}}})[_0xf955('0x1f')](function(_0x1e6165){if(_0x1e6165&&_0x1e6165[_0xf955('0x10c')]&&_0x38016a['body']){var _0x4a6338={'tls':{'rejectUnauthorized':![]}};if(_0x1e6165[_0xf955('0x10c')][_0xf955('0x10d')]){_0x4a6338[_0xf955('0x10d')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x10d')];}else{_0x4a6338[_0xf955('0x10e')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x10e')];_0x4a6338[_0xf955('0x10f')]=_0x1e6165['Smtp'][_0xf955('0x10f')];_0x4a6338[_0xf955('0x110')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x110')];}if(_0x1e6165[_0xf955('0x10c')]['authentication']){_0x4a6338[_0xf955('0x111')]={'user':_0x1e6165[_0xf955('0x10c')]['user'],'pass':_0x1e6165[_0xf955('0x10c')]['pass']};}return respondWithRpcPromise('SendMail',_0xf955('0x112'),{'account':_0x4a6338,'message':{'from':util[_0xf955('0xf8')](_0xf955('0x113'),_0x1e6165[_0xf955('0x38')],_0x1e6165['email']||_0x1e6165[_0xf955('0x10c')][_0xf955('0xa7')]),'to':_0x38016a[_0xf955('0x3a')][_0xf955('0xf5')],'subject':'Mail\x20Transcript','text':util[_0xf955('0xf8')](_0xf955('0x114'),_0x38016a['body'][_0xf955('0xf5')]),'attachments':[{'path':_0x1ae12a}]}})[_0xf955('0x1f')](function(){return _0x1620ec;})[_0xf955('0x47')](function(_0x50502a){console[_0xf955('0x25')](_0x50502a);});}else{return _0x1620ec;}})[_0xf955('0x1f')](respondWithStatusCode(_0x52ad4d,0xc8))[_0xf955('0x47')](handleError(_0x52ad4d,null));};exports['addMessage']=function(_0x1d2e9c,_0x49718e,_0x5aeba7){return db['ChatMessage'][_0xf955('0x71')]({'where':{'id':_0x1d2e9c[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x49718e,null))[_0xf955('0x1f')](function(_0x10cd8e){if(_0x10cd8e){return _0x10cd8e[_0xf955('0x115')](_0x1d2e9c['body'][_0xf955('0x116')],_[_0xf955('0x117')](_0x1d2e9c[_0xf955('0x3a')],[_0xf955('0x116'),'id'])||{});}})[_0xf955('0x1f')](respondWithResult(_0x49718e,null))[_0xf955('0x47')](handleError(_0x49718e,null));};exports[_0xf955('0x118')]=function(_0x287adf,_0x38177d,_0x56a307){var _0x49c6ca={'raw':![],'where':{}};var _0x36f3b3={};var _0x252118={'count':0x0,'rows':[]};return db[_0xf955('0xad')]['findOne']({'where':{'id':_0x287adf['params']['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x38177d,null))['then'](function(_0x1dd4b4){if(_0x1dd4b4){_0x36f3b3[_0xf955('0x4b')]=_[_0xf955('0x85')](db[_0xf955('0xd9')]['rawAttributes']);_0x36f3b3[_0xf955('0x4c')]=_[_0xf955('0x85')](_0x287adf[_0xf955('0x4c')]);_0x36f3b3['filters']=_[_0xf955('0x4e')](_0x36f3b3['model'],_0x36f3b3[_0xf955('0x4c')]);_0x49c6ca[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x36f3b3[_0xf955('0x4b')],qs['fields'](_0x287adf[_0xf955('0x4c')][_0xf955('0x4f')]));_0x49c6ca[_0xf955('0x50')]=_0x49c6ca['attributes'][_0xf955('0x51')]?_0x49c6ca['attributes']:_0x36f3b3[_0xf955('0x4b')];if(!_0x287adf['query'][_0xf955('0x52')]('nolimit')){_0x49c6ca[_0xf955('0x30')]=qs['limit'](_0x287adf['query']['limit']);_0x49c6ca[_0xf955('0x2e')]=qs['offset'](_0x287adf['query'][_0xf955('0x2e')]);}_0x49c6ca[_0xf955('0xa2')]=qs[_0xf955('0x54')](_0x287adf[_0xf955('0x4c')][_0xf955('0x54')]);_0x49c6ca[_0xf955('0x55')]=qs[_0xf955('0x4d')](_[_0xf955('0x119')](_0x287adf['query'],_0x36f3b3[_0xf955('0x4d')]));_0x49c6ca[_0xf955('0x55')][_0xf955('0xc0')]=_0x1dd4b4['id'];if(_0x287adf[_0xf955('0x4c')][_0xf955('0x96')]){_0x49c6ca[_0xf955('0x55')]=_[_0xf955('0x39')](_0x49c6ca[_0xf955('0x55')],{'$or':_[_0xf955('0x40')](_0x49c6ca['attributes'],function(_0x1d1df4){var _0x1b7a62={};_0x1b7a62[_0x1d1df4]={'$like':'%'+_0x287adf[_0xf955('0x4c')][_0xf955('0x96')]+'%'};return _0x1b7a62;})});}if(_0x287adf[_0xf955('0x4c')][_0xf955('0x8c')]){var _0x547464=_0x287adf[_0xf955('0x4c')][_0xf955('0x8c')][_0xf955('0x44')](',');var _0x280d1c={};_0x280d1c[_0x547464[0x0]]={'$gte':moment(_0x547464[0x1])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49c6ca[_0xf955('0x55')]=_[_0xf955('0x39')](_0x49c6ca['where'],_0x280d1c);}_0x49c6ca=_['merge']({},_0x49c6ca,_0x287adf['options']);return db[_0xf955('0xd9')][_0xf955('0x31')]({'where':_0x49c6ca[_0xf955('0x55')]})[_0xf955('0x1f')](function(_0x14bed6){_0x252118[_0xf955('0x31')]=_0x14bed6;if(_0x287adf[_0xf955('0x4c')][_0xf955('0xc3')]){_0x49c6ca[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xd9')]['findAll'](_0x49c6ca);})[_0xf955('0x1f')](function(_0x7996b8){_0x252118[_0xf955('0xc2')]=_0x7996b8;return _0x252118;});}})[_0xf955('0x1f')](respondWithFilteredResult(_0x38177d,_0x49c6ca))[_0xf955('0x47')](handleError(_0x38177d,null));};exports['getMyMessages']=function(_0xac8cdf,_0x70fa9f,_0x5e650f){var _0x39d911={'where':{}},_0x2fbf0c={},_0x1612e4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf955('0xea')]({'where':{'id':_0xac8cdf[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x70fa9f,null))[_0xf955('0x1f')](function(_0x1a7da8){if(_0x1a7da8){_0x2fbf0c[_0xf955('0x4b')]=_[_0xf955('0x85')](db['ChatMessage'][_0xf955('0x49')]);_0x2fbf0c['query']=_['keys'](_0xac8cdf['query']);_0x2fbf0c[_0xf955('0x4d')]=_[_0xf955('0x4e')](_0x2fbf0c[_0xf955('0x4b')],_0x2fbf0c[_0xf955('0x4c')]);_0x39d911[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x2fbf0c[_0xf955('0x4b')],qs['fields'](_0xac8cdf['query'][_0xf955('0x4f')]));_0x39d911[_0xf955('0x50')]=_0x39d911['attributes']['length']?_0x39d911[_0xf955('0x50')]:_0x2fbf0c[_0xf955('0x4b')];if(!_0xac8cdf[_0xf955('0x4c')]['hasOwnProperty']('nolimit')){_0x39d911[_0xf955('0x30')]=qs[_0xf955('0x30')](_0xac8cdf[_0xf955('0x4c')][_0xf955('0x30')]);_0x39d911[_0xf955('0x2e')]=qs['offset'](_0xac8cdf['query'][_0xf955('0x2e')]);}_0x39d911[_0xf955('0xa2')]=qs[_0xf955('0x54')](_0xac8cdf[_0xf955('0x4c')]['sort']);_0x39d911[_0xf955('0x55')]=qs[_0xf955('0x4d')](_[_0xf955('0x119')](_0xac8cdf[_0xf955('0x4c')],_0x2fbf0c[_0xf955('0x4d')]));_0x39d911[_0xf955('0x55')]['ChatInteractionId']=_0x1a7da8['id'];if(_0xac8cdf['query'][_0xf955('0x96')]){_0x39d911['where']=_[_0xf955('0x39')](_0x39d911[_0xf955('0x55')],{'$or':_['map'](_0x39d911['attributes'],function(_0x4a3d8c){var _0x170ea7={};_0x170ea7[_0x4a3d8c]={'$like':'%'+_0xac8cdf[_0xf955('0x4c')][_0xf955('0x96')]+'%'};return _0x170ea7;})});}_0x39d911[_0xf955('0x55')][_0xf955('0x109')]=![];if(_0xac8cdf[_0xf955('0x4c')]['id']){_0x39d911[_0xf955('0x55')]['id']={'$gt':_0xac8cdf[_0xf955('0x4c')]['id']};}_0x39d911=_[_0xf955('0x39')]({},_0x39d911,_0xac8cdf['options']);return db[_0xf955('0xd9')]['count']({'where':_0x39d911['where']})[_0xf955('0x1f')](function(_0x36327c){_0x1612e4[_0xf955('0x31')]=_0x36327c;_0x39d911[_0xf955('0xc4')]=[];if(_0xac8cdf['query'][_0xf955('0x11a')]){_0x39d911['include'][_0xf955('0x46')]({'model':db[_0xf955('0xfd')],'as':_0xf955('0xfd'),'attributes':['id',_0xf955('0x41'),'alias']});}if(_0xac8cdf[_0xf955('0x4c')][_0xf955('0xc3')]){_0x39d911[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xd9')][_0xf955('0x11b')](_0x39d911);})[_0xf955('0x1f')](function(_0x3e4239){_0x1612e4[_0xf955('0xc2')]=_0x3e4239;return _0x1612e4;});}})[_0xf955('0x1f')](respondWithFilteredResult(_0x70fa9f,_0x39d911))['catch'](handleError(_0x70fa9f,null));};exports[_0xf955('0x11c')]=function(_0x11a228,_0x2d37c2,_0x932b98){return db[_0xf955('0xad')]['find']({'where':{'id':_0x11a228[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x2d37c2,null))[_0xf955('0x1f')](function(_0x147f3c){if(_0x147f3c){return _0x147f3c[_0xf955('0x11d')](_0x11a228[_0xf955('0x3a')]['ids'],_[_0xf955('0x117')](_0x11a228[_0xf955('0x3a')],[_0xf955('0x116'),'id'])||{})[_0xf955('0x11e')](function(){return db[_0xf955('0x11f')]['findAll']({'attributes':['id',_0xf955('0x38'),_0xf955('0x57')],'where':{'id':_0x11a228[_0xf955('0x3a')]['ids']}});})[_0xf955('0x1f')](function(_0xfcaf21){socket['emit'](_0xf955('0x120'),{'id':Number(_0x11a228[_0xf955('0xc7')]['id']),'tags':_0xfcaf21||[]});return{'id':Number(_0x11a228[_0xf955('0xc7')]['id']),'tags':_0xfcaf21||[]};});}})[_0xf955('0x1f')](respondWithResult(_0x2d37c2,null))[_0xf955('0x47')](handleError(_0x2d37c2,null));};exports['removeTags']=function(_0x572efd,_0x357dbc,_0x2b9880){return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x572efd[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x357dbc,null))['then'](function(_0x23968f){if(_0x23968f){return _0x23968f[_0xf955('0x121')](_0x572efd[_0xf955('0x4c')][_0xf955('0x116')]);}})['then'](respondWithStatusCode(_0x357dbc,null))[_0xf955('0x47')](handleError(_0x357dbc,null));};exports[_0xf955('0xf3')]=function(_0x3842e1,_0x204e4e){var _0x47b877=moment()[_0xf955('0x122')]()[_0xf955('0xbe')]();var _0x1624e9=path[_0xf955('0xef')](config[_0xf955('0xf6')],_0xf955('0x123'),_0xf955('0x124'),'tmp');var _0x3ccc35=path[_0xf955('0xef')](config[_0xf955('0xf6')],_0xf955('0x123'),_0xf955('0x124'),_0xf955('0x125'));var _0x72b500=path[_0xf955('0xef')](_0x1624e9,_0x47b877);var _0x1d4aa6=util[_0xf955('0xf8')](_0xf955('0x126'),_0x3842e1[_0xf955('0xc7')]['id'],_0x47b877);var _0x4896ae=path[_0xf955('0xef')](_0x1624e9,_0x1d4aa6);var _0x3b67e3=[];_0x3b67e3[_0xf955('0x46')]({'model':db['User'],'as':_0xf955('0xfd'),'attributes':['id','fullname'],'raw':!![]});_0x3b67e3[_0xf955('0x46')]({'model':db[_0xf955('0xdd')],'as':_0xf955('0x77'),'attributes':['id',_0xf955('0x127'),'lastName'],'raw':!![]});if(_0x3842e1['query']['attachments']){_0x3b67e3[_0xf955('0x46')]({'model':db[_0xf955('0xed')],'as':_0xf955('0xed'),'raw':!![]});}var _0x21b589=[{'model':db[_0xf955('0xd9')],'as':'Messages','attributes':['id',_0xf955('0x3a'),_0xf955('0x107'),_0xf955('0x128'),_0xf955('0x109'),'read'],'include':_0x3b67e3}];_0x21b589[_0xf955('0x46')]({'model':db[_0xf955('0xca')],'as':_0xf955('0x129'),'attributes':['id',_0xf955('0x38')]});_0x21b589[_0xf955('0x46')]({'model':db[_0xf955('0xfd')],'as':'Owner','attributes':['id',_0xf955('0x41')]});return db['ChatInteraction'][_0xf955('0x71')]({'where':{'id':_0x3842e1['params']['id']},'include':_0x21b589})[_0xf955('0x1f')](handleEntityNotFound(_0x204e4e,null))[_0xf955('0x1f')](function(_0x1ed31c){if(_0x1ed31c){var _0x2e8dc2=_0x1ed31c[_0xf955('0x12a')]({'plain':!![]});fs[_0xf955('0x12b')](_0x72b500);var _0x58b727={'channel':_0xf955('0x12c'),'account':_0x2e8dc2[_0xf955('0x129')][_0xf955('0x38')],'agent':_0x2e8dc2[_0xf955('0x12d')]?_0x2e8dc2[_0xf955('0x12d')][_0xf955('0x41')]:_0xf955('0x12e'),'createdAt':moment(_0x2e8dc2['createdAt'])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf955('0xbe')](),'closedAt':_0x2e8dc2['closed']?moment(_0x2e8dc2[_0xf955('0x12f')])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf955('0xbe')]():'','disposition':_0x2e8dc2['disposition'],'chatInfo':{'browser':_0x2e8dc2[_0xf955('0x130')],'os':_0x2e8dc2['osName'],'referer':_0x2e8dc2[_0xf955('0x131')],'customerIp':_0x2e8dc2[_0xf955('0x132')],'customerPort':_0x2e8dc2[_0xf955('0x133')]?_0x2e8dc2[_0xf955('0x133')]:'N.A.'},'messages':_(_0x2e8dc2[_0xf955('0xfc')])[_0xf955('0x134')]()[_0xf955('0x96')]({'secret':![]})[_0xf955('0x40')](function(_0x1307a6){if(_0x1307a6[_0xf955('0xed')]){var _0x3328b9=path[_0xf955('0xef')](_0x3ccc35,_0x1307a6['Attachment'][_0xf955('0xf2')]);if(fs[_0xf955('0x135')](_0x3328b9)){fs[_0xf955('0x136')](_0x3328b9)[_0xf955('0x137')](fs['createWriteStream'](path[_0xf955('0xef')](_0x72b500,_0x1307a6[_0xf955('0xed')][_0xf955('0xf2')])));}}return{'date':moment(_0x1307a6[_0xf955('0x107')])[_0xf955('0xf8')](_0xf955('0x138'))['toString'](),'sender':_0x1307a6[_0xf955('0x128')]===_0xf955('0xd8')?_0x1307a6['User']?_0x1307a6[_0xf955('0xfd')][_0xf955('0x41')]:_0xf955('0x100'):_0x1307a6[_0xf955('0x77')][_0xf955('0x127')]+(_0x1307a6[_0xf955('0x77')][_0xf955('0x139')]?'\x20'+_0x1307a6['Contact'][_0xf955('0x139')]:''),'body':_0x1307a6[_0xf955('0xed')]?_0x1307a6[_0xf955('0xed')][_0xf955('0xf2')]:_0x1307a6[_0xf955('0x3a')],'direction':_0x1307a6[_0xf955('0x128')]===_0xf955('0xd8')?'A':'C','secret':_0x1307a6['secret'],'read':_0x1307a6[_0xf955('0x91')],'attachment':_0x1307a6[_0xf955('0xed')]};})[_0xf955('0x73')]()};return ejs[_0xf955('0x13a')](path[_0xf955('0xef')](config[_0xf955('0xf6')],'server',_0xf955('0x13b'),_0xf955('0x13c')),{'interaction':_0x58b727})[_0xf955('0x1f')](function(_0x385676){var _0x5a9193=path['join'](_0x72b500,_0xf955('0x13d')+_0x2e8dc2['id']+'-'+_0x47b877+_0xf955('0x13e'));var _0x157508={'path':_0x5a9193,'channel':'Chat','interactionId':_0x2e8dc2['id']};return pdf[_0xf955('0x13f')](_0x385676,_0x157508);})['then'](function(){return new BPromise(function(_0x37bdd4,_0x4f8fc8){zipdir(_0x72b500,{'saveTo':_0x4896ae},function(_0x5f3e0f,_0x4ad147){if(_0x5f3e0f)return _0x4f8fc8(_0x5f3e0f);return _0x37bdd4(_0x4ad147);});})[_0xf955('0x1f')](function(){return new BPromise(function(_0x2dc607,_0x355871){rimraf(_0x72b500,function(_0x1c5b1d){if(_0x1c5b1d)_0x355871(_0x1c5b1d);return _0x2dc607();});});})[_0xf955('0x1f')](function(){return _0x204e4e[_0xf955('0xf3')](_0x4896ae,_0x1d4aa6,function(_0x5eac2b){if(_0x5eac2b){console[_0xf955('0x140')](_0xf955('0x141'),_0x5eac2b);}else{fs[_0xf955('0x142')](_0x4896ae);}});});});}else{return _0x204e4e[_0xf955('0x2a')](0xc8);}})[_0xf955('0x47')](handleError(_0x204e4e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index df0e287..b11d754 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 _0x9fcf=['emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x96b097,_0x2bfc68){var _0xcbca3=function(_0x269d58){while(--_0x269d58){_0x96b097['push'](_0x96b097['shift']());}};_0xcbca3(++_0x2bfc68);}(_0x9fcf,0x1ae));var _0xf9fc=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x9fcf[_0x45d3f0];return _0x314b79;};'use strict';var EventEmitter=require(_0xf9fc('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xf9fc('0x1')];var ChatMessage=require(_0xf9fc('0x2'))['db'][_0xf9fc('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf9fc('0x4'),'afterDestroy':_0xf9fc('0x5')};function emitEvent(_0x1da718){return function(_0x25b2ea,_0x333594,_0x26a018){_0x25b2ea[_0xf9fc('0x6')]({'attributes':['id'],'raw':!![]})[_0xf9fc('0x7')](function(_0x5c7ba6){_0x25b2ea[_0xf9fc('0x8')]('Users',_0x5c7ba6[_0xf9fc('0x9')](function(_0x2339c9){return{'id':_0x2339c9['id']};}));return ChatMessage[_0xf9fc('0xa')]({'where':{'ChatInteractionId':_0x25b2ea['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf9fc('0x7')](function(_0x3a2545){_0x25b2ea[_0xf9fc('0x8')](_0xf9fc('0xb'),_0x3a2545['length']);ChatInteractionEvents['emit'](_0x1da718+':'+_0x25b2ea['id'],_0x25b2ea);ChatInteractionEvents[_0xf9fc('0xc')](_0x1da718,_0x25b2ea);_0x26a018(null);})[_0xf9fc('0xd')](_0x26a018(null));};}for(var e in events){if(events[_0xf9fc('0xe')](e)){var event=events[e];ChatInteraction[_0xf9fc('0xf')](e,emitEvent(event));}}module[_0xf9fc('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xd6aa=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x513254,_0x1305ca){var _0x384c92=function(_0xb22823){while(--_0xb22823){_0x513254['push'](_0x513254['shift']());}};_0x384c92(++_0x1305ca);}(_0xd6aa,0x148));var _0xad6a=function(_0x17449a,_0x2dc222){_0x17449a=_0x17449a-0x0;var _0x15bcd8=_0xd6aa[_0x17449a];return _0x15bcd8;};'use strict';var EventEmitter=require(_0xad6a('0x0'));var ChatInteraction=require(_0xad6a('0x1'))['db'][_0xad6a('0x2')];var ChatMessage=require(_0xad6a('0x1'))['db'][_0xad6a('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xad6a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2b0b3f){return function(_0x59fd77,_0x1c89b2,_0x29d2d9){_0x59fd77[_0xad6a('0x5')]({'attributes':['id'],'raw':!![]})[_0xad6a('0x6')](function(_0xc17af6){_0x59fd77[_0xad6a('0x7')](_0xad6a('0x8'),_0xc17af6[_0xad6a('0x9')](function(_0x2976af){return{'id':_0x2976af['id']};}));return ChatMessage[_0xad6a('0xa')]({'where':{'ChatInteractionId':_0x59fd77['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5aefe6){_0x59fd77[_0xad6a('0x7')](_0xad6a('0xb'),_0x5aefe6[_0xad6a('0xc')]);ChatInteractionEvents[_0xad6a('0xd')](_0x2b0b3f+':'+_0x59fd77['id'],_0x59fd77);ChatInteractionEvents[_0xad6a('0xd')](_0x2b0b3f,_0x59fd77);_0x29d2d9(null);})[_0xad6a('0xe')](_0x29d2d9(null));};}for(var e in events){if(events[_0xad6a('0xf')](e)){var event=events[e];ChatInteraction[_0xad6a('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c0cf8dc..621f921 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 _0x0e80=['./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x198da3,_0xe59bd){var _0x5664e0=function(_0x105d62){while(--_0x105d62){_0x198da3['push'](_0x198da3['shift']());}};_0x5664e0(++_0xe59bd);}(_0x0e80,0x75));var _0x00e8=function(_0x116c11,_0x4a99c2){_0x116c11=_0x116c11-0x0;var _0x20407c=_0x0e80[_0x116c11];return _0x20407c;};'use strict';var _=require(_0x00e8('0x0'));var util=require(_0x00e8('0x1'));var logger=require('../../config/logger')(_0x00e8('0x2'));var moment=require(_0x00e8('0x3'));var BPromise=require(_0x00e8('0x4'));var rp=require(_0x00e8('0x5'));var fs=require('fs');var path=require(_0x00e8('0x6'));var rimraf=require(_0x00e8('0x7'));var config=require(_0x00e8('0x8'));var attributes=require(_0x00e8('0x9'));module[_0x00e8('0xa')]=function(_0x4cc260,_0x5a8361){return _0x4cc260[_0x00e8('0xb')]('ChatInteraction',attributes,{'tableName':_0x00e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38a731,_0x27f770,_0x133dc7){if(_0x38a731[_0x00e8('0xd')](_0x00e8('0xe'))){_0x38a731['closedAt']=moment()['format'](_0x00e8('0xf'));}_0x133dc7(null,_0x38a731);}},'charset':_0x00e8('0x10'),'collate':_0x00e8('0x11')});}; \ No newline at end of file +var _0x140a=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x140a,0x126));var _0xa140=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x140a[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xa140('0x0'));var util=require('util');var logger=require(_0xa140('0x1'))('api');var moment=require(_0xa140('0x2'));var BPromise=require(_0xa140('0x3'));var rp=require(_0xa140('0x4'));var fs=require('fs');var path=require(_0xa140('0x5'));var rimraf=require(_0xa140('0x6'));var config=require(_0xa140('0x7'));var attributes=require(_0xa140('0x8'));module[_0xa140('0x9')]=function(_0x2edb95,_0x7a783d){return _0x2edb95['define'](_0xa140('0xa'),attributes,{'tableName':_0xa140('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x542f4b,_0x351a8a,_0x4c8916){if(_0x542f4b[_0xa140('0xc')](_0xa140('0xd'))){_0x542f4b[_0xa140('0xe')]=moment()[_0xa140('0xf')](_0xa140('0x10'));}_0x4c8916(null,_0x542f4b);}},'charset':_0xa140('0x11'),'collate':_0xa140('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 60396df..ebf8477 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 _0x2925=['options','where','limit','UpdateChatInteraction','catch','AddTagsToChatInteraction','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ChatInteraction','update'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x2925,0x1af));var _0x5292=function(_0x245edc,_0x110b97){_0x245edc=_0x245edc-0x0;var _0x16adea=_0x2925[_0x245edc];return _0x16adea;};'use strict';var _=require(_0x5292('0x0'));var util=require(_0x5292('0x1'));var moment=require(_0x5292('0x2'));var BPromise=require(_0x5292('0x3'));var rs=require(_0x5292('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5292('0x5'))['db'];var utils=require(_0x5292('0x6'));var logger=require('../../config/logger')(_0x5292('0x7'));var config=require(_0x5292('0x8'));var jayson=require(_0x5292('0x9'));var client=jayson['client'][_0x5292('0xa')]({'port':0x232a});config[_0x5292('0xb')]=_[_0x5292('0xc')](config[_0x5292('0xb')],{'host':_0x5292('0xd'),'port':0x18eb});var socket=require(_0x5292('0xe'))(new Redis(config[_0x5292('0xb')]));require(_0x5292('0xf'))[_0x5292('0x10')](socket);function respondWithRpcPromise(_0x3dbc32,_0x25dac4,_0x25ba1e){return new BPromise(function(_0xc4c2d7,_0x40259e){return client[_0x5292('0x11')](_0x3dbc32,_0x25ba1e)[_0x5292('0x12')](function(_0x1413f0){logger['info'](_0x5292('0x13'),_0x25dac4,_0x5292('0x14'));logger[_0x5292('0x15')](_0x5292('0x16'),_0x25dac4,_0x5292('0x14'),JSON[_0x5292('0x17')](_0x1413f0));if(_0x1413f0[_0x5292('0x18')]){if(_0x1413f0['error'][_0x5292('0x19')]===0x1f4){logger[_0x5292('0x18')](_0x5292('0x13'),_0x25dac4,_0x1413f0['error']['message']);return _0x40259e(_0x1413f0[_0x5292('0x18')][_0x5292('0x1a')]);}logger[_0x5292('0x18')](_0x5292('0x13'),_0x25dac4,_0x1413f0[_0x5292('0x18')][_0x5292('0x1a')]);return _0xc4c2d7(_0x1413f0[_0x5292('0x18')]['message']);}else{logger[_0x5292('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x25dac4,_0x5292('0x14'));_0xc4c2d7(_0x1413f0[_0x5292('0x1c')]['message']);}})['catch'](function(_0x54f1c9){logger['error'](_0x5292('0x13'),_0x25dac4,_0x54f1c9);_0x40259e(_0x54f1c9);});});}exports['UpdateChatInteraction']=function(_0x5568c4){var _0xa9827a=this;return new Promise(function(_0x404a93,_0x26c9b3){return db[_0x5292('0x1d')][_0x5292('0x1e')](_0x5568c4['body'],{'raw':_0x5568c4['options']?_0x5568c4[_0x5292('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5568c4[_0x5292('0x1f')]?_0x5568c4[_0x5292('0x1f')][_0x5292('0x20')]||null:null,'attributes':_0x5568c4[_0x5292('0x1f')]?_0x5568c4[_0x5292('0x1f')]['attributes']||null:null,'limit':_0x5568c4[_0x5292('0x1f')]?_0x5568c4[_0x5292('0x1f')][_0x5292('0x21')]||null:null})[_0x5292('0x12')](function(_0x28ea23){logger[_0x5292('0x1b')](_0x5292('0x22'),_0x5568c4);logger[_0x5292('0x15')]('UpdateChatInteraction',_0x5568c4,JSON[_0x5292('0x17')](_0x28ea23));_0x404a93(_0x28ea23);})[_0x5292('0x23')](function(_0x423477){logger[_0x5292('0x18')](_0x5292('0x22'),_0x423477[_0x5292('0x1a')],_0x5568c4);_0x26c9b3(_0xa9827a['error'](0x1f4,_0x423477['message']));});});};exports[_0x5292('0x24')]=function(_0x387d72){return new Promise(function(_0x36fa5f,_0x281a1f){return db['ChatInteraction']['find']({'where':_0x387d72[_0x5292('0x1f')]?_0x387d72['options'][_0x5292('0x20')]||null:null})[_0x5292('0x12')](function(_0x3eb41a){if(_0x3eb41a){return _0x3eb41a[_0x5292('0x25')](_0x387d72[_0x5292('0x26')][_0x5292('0x27')],_[_0x5292('0x28')](_0x387d72[_0x5292('0x26')],['ids','id'])||{});}})['spread'](function(_0x531578){logger[_0x5292('0x1b')]('AddTags',_0x387d72);logger['debug'](_0x5292('0x29'),_0x387d72,JSON[_0x5292('0x17')](_0x531578));_0x36fa5f(_0x531578);})[_0x5292('0x23')](function(_0xfb317d){logger['error'](_0x5292('0x29'),_0xfb317d[_0x5292('0x1a')],_0x387d72);_0x281a1f(_this['error'](0x1f4,_0xfb317d[_0x5292('0x1a')]));});});}; \ No newline at end of file +var _0xcf55=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x2a3567,_0x16f237){var _0x48ac06=function(_0x5c4234){while(--_0x5c4234){_0x2a3567['push'](_0x2a3567['shift']());}};_0x48ac06(++_0x16f237);}(_0xcf55,0x178));var _0x5cf5=function(_0x1ad7fc,_0x444145){_0x1ad7fc=_0x1ad7fc-0x0;var _0x3bb433=_0xcf55[_0x1ad7fc];return _0x3bb433;};'use strict';var _=require(_0x5cf5('0x0'));var util=require('util');var moment=require(_0x5cf5('0x1'));var BPromise=require(_0x5cf5('0x2'));var rs=require(_0x5cf5('0x3'));var fs=require('fs');var Redis=require(_0x5cf5('0x4'));var db=require(_0x5cf5('0x5'))['db'];var utils=require(_0x5cf5('0x6'));var logger=require(_0x5cf5('0x7'))(_0x5cf5('0x8'));var config=require(_0x5cf5('0x9'));var jayson=require(_0x5cf5('0xa'));var client=jayson[_0x5cf5('0xb')]['http']({'port':0x232a});config[_0x5cf5('0xc')]=_['defaults'](config['redis'],{'host':_0x5cf5('0xd'),'port':0x18eb});var socket=require(_0x5cf5('0xe'))(new Redis(config[_0x5cf5('0xc')]));require(_0x5cf5('0xf'))['register'](socket);function respondWithRpcPromise(_0x81a34c,_0x3655c6,_0x58e609){return new BPromise(function(_0x198035,_0x3ee2fa){return client[_0x5cf5('0x10')](_0x81a34c,_0x58e609)[_0x5cf5('0x11')](function(_0x3e6730){logger[_0x5cf5('0x12')](_0x5cf5('0x13'),_0x3655c6,_0x5cf5('0x14'));logger[_0x5cf5('0x15')](_0x5cf5('0x16'),_0x3655c6,'request\x20sent',JSON[_0x5cf5('0x17')](_0x3e6730));if(_0x3e6730['error']){if(_0x3e6730['error'][_0x5cf5('0x18')]===0x1f4){logger[_0x5cf5('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x3655c6,_0x3e6730['error'][_0x5cf5('0x1a')]);return _0x3ee2fa(_0x3e6730[_0x5cf5('0x19')][_0x5cf5('0x1a')]);}logger[_0x5cf5('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x3655c6,_0x3e6730[_0x5cf5('0x19')][_0x5cf5('0x1a')]);return _0x198035(_0x3e6730['error'][_0x5cf5('0x1a')]);}else{logger[_0x5cf5('0x12')](_0x5cf5('0x13'),_0x3655c6,_0x5cf5('0x14'));_0x198035(_0x3e6730['result']['message']);}})[_0x5cf5('0x1b')](function(_0x1d24b1){logger[_0x5cf5('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x3655c6,_0x1d24b1);_0x3ee2fa(_0x1d24b1);});});}exports[_0x5cf5('0x1c')]=function(_0x3df566){var _0xa5e292=this;return new Promise(function(_0x1c8dc5,_0x37d95f){return db[_0x5cf5('0x1d')][_0x5cf5('0x1e')](_0x3df566[_0x5cf5('0x1f')],{'raw':_0x3df566[_0x5cf5('0x20')]?_0x3df566['options'][_0x5cf5('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3df566['options']?_0x3df566[_0x5cf5('0x20')][_0x5cf5('0x22')]||null:null,'attributes':_0x3df566[_0x5cf5('0x20')]?_0x3df566[_0x5cf5('0x20')][_0x5cf5('0x23')]||null:null,'limit':_0x3df566[_0x5cf5('0x20')]?_0x3df566[_0x5cf5('0x20')][_0x5cf5('0x24')]||null:null})['then'](function(_0x3bea73){logger['info'](_0x5cf5('0x1c'),_0x3df566);logger[_0x5cf5('0x15')]('UpdateChatInteraction',_0x3df566,JSON['stringify'](_0x3bea73));_0x1c8dc5(_0x3bea73);})[_0x5cf5('0x1b')](function(_0x28a75e){logger[_0x5cf5('0x19')]('UpdateChatInteraction',_0x28a75e[_0x5cf5('0x1a')],_0x3df566);_0x37d95f(_0xa5e292['error'](0x1f4,_0x28a75e[_0x5cf5('0x1a')]));});});};exports[_0x5cf5('0x25')]=function(_0x5e1b7f){return new Promise(function(_0x3ec355,_0x4cf8c1){return db['ChatInteraction'][_0x5cf5('0x26')]({'where':_0x5e1b7f[_0x5cf5('0x20')]?_0x5e1b7f[_0x5cf5('0x20')][_0x5cf5('0x22')]||null:null})['then'](function(_0x2ff910){if(_0x2ff910){return _0x2ff910[_0x5cf5('0x27')](_0x5e1b7f['body'][_0x5cf5('0x28')],_[_0x5cf5('0x29')](_0x5e1b7f[_0x5cf5('0x1f')],[_0x5cf5('0x28'),'id'])||{});}})[_0x5cf5('0x2a')](function(_0xa20ec0){logger[_0x5cf5('0x12')](_0x5cf5('0x2b'),_0x5e1b7f);logger[_0x5cf5('0x15')](_0x5cf5('0x2b'),_0x5e1b7f,JSON[_0x5cf5('0x17')](_0xa20ec0));_0x3ec355(_0xa20ec0);})[_0x5cf5('0x1b')](function(_0xb75b74){logger[_0x5cf5('0x19')](_0x5cf5('0x2b'),_0xb75b74[_0x5cf5('0x1a')],_0x5e1b7f);_0x4cf8c1(_this[_0x5cf5('0x19')](0x1f4,_0xb75b74[_0x5cf5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f4a4d14..e6a33f2 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 _0xe2ba=['register','length','./chatInteraction.events','save','update','emit','removeListener'];(function(_0xe25406,_0x3af285){var _0x236d35=function(_0x2d4428){while(--_0x2d4428){_0xe25406['push'](_0xe25406['shift']());}};_0x236d35(++_0x3af285);}(_0xe2ba,0x18a));var _0xae2b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe2ba[_0x1694f5];return _0x5b4321;};'use strict';var ChatInteractionEvents=require(_0xae2b('0x0'));var events=[_0xae2b('0x1'),'remove',_0xae2b('0x2')];function createListener(_0x1bb06a,_0xaa6f8){return function(_0x36c641){_0xaa6f8[_0xae2b('0x3')](_0x1bb06a,_0x36c641);};}function removeListener(_0x2b3da5,_0x33552e){return function(){ChatInteractionEvents[_0xae2b('0x4')](_0x2b3da5,_0x33552e);};}exports[_0xae2b('0x5')]=function(_0x3fc5e4){for(var _0x5c53db=0x0,_0x270cb4=events[_0xae2b('0x6')];_0x5c53db<_0x270cb4;_0x5c53db++){var _0x5f1da1=events[_0x5c53db];var _0x49f0c4=createListener('chatInteraction:'+_0x5f1da1,_0x3fc5e4);ChatInteractionEvents['on'](_0x5f1da1,_0x49f0c4);}}; \ No newline at end of file +var _0xcb1c=['remove','update','emit','removeListener','register','length','./chatInteraction.events'];(function(_0x4fa2d8,_0x5c4fea){var _0x496829=function(_0x1cce84){while(--_0x1cce84){_0x4fa2d8['push'](_0x4fa2d8['shift']());}};_0x496829(++_0x5c4fea);}(_0xcb1c,0x1f0));var _0xccb1=function(_0x2caedc,_0x208068){_0x2caedc=_0x2caedc-0x0;var _0x3f2ec3=_0xcb1c[_0x2caedc];return _0x3f2ec3;};'use strict';var ChatInteractionEvents=require(_0xccb1('0x0'));var events=['save',_0xccb1('0x1'),_0xccb1('0x2')];function createListener(_0x4ee6b7,_0x57fd9c){return function(_0x3732e1){_0x57fd9c[_0xccb1('0x3')](_0x4ee6b7,_0x3732e1);};}function removeListener(_0x3199c2,_0x2d28fc){return function(){ChatInteractionEvents[_0xccb1('0x4')](_0x3199c2,_0x2d28fc);};}exports[_0xccb1('0x5')]=function(_0x3b74c5){for(var _0x977812=0x0,_0x14f9bb=events[_0xccb1('0x6')];_0x977812<_0x14f9bb;_0x977812++){var _0x5015e6=events[_0x977812];var _0x430e7e=createListener('chatInteraction:'+_0x5015e6,_0x3b74c5);ChatInteractionEvents['on'](_0x5015e6,_0x430e7e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0f7142e..ff788f2 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 _0x7da3=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','tracked','update','put','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','multer'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x7da3,0x164));var _0x37da=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7da3[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x37da('0x0'));var util=require(_0x37da('0x1'));var path=require(_0x37da('0x2'));var timeout=require(_0x37da('0x3'));var express=require('express');var router=express[_0x37da('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x37da('0x5'));var config=require(_0x37da('0x6'));var controller=require(_0x37da('0x7'));router[_0x37da('0x8')]('/',auth[_0x37da('0x9')](),controller[_0x37da('0xa')]);router[_0x37da('0x8')](_0x37da('0xb'),auth[_0x37da('0x9')](),controller['describe']);router[_0x37da('0x8')](_0x37da('0xc'),auth[_0x37da('0xd')](),controller[_0x37da('0xe')]);router[_0x37da('0x8')](_0x37da('0xf'),auth[_0x37da('0xd')](),controller[_0x37da('0x10')]);router['get'](_0x37da('0x11'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x37da('0x12')]);router[_0x37da('0x8')](_0x37da('0x13'),auth[_0x37da('0x9')](),controller['download']);router[_0x37da('0x14')]('/',auth[_0x37da('0x9')](),controller[_0x37da('0x15')]);router[_0x37da('0x14')](_0x37da('0x16'),auth[_0x37da('0x9')](),controller[_0x37da('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x573b7c,_0x58cafd,_0x226c9f){_0x226c9f(null,path[_0x37da('0x18')](config[_0x37da('0x19')],_0x37da('0x1a')));},'filename':function(_0x1b0fe6,_0xc1493,_0xac368e){_0xac368e(null,util[_0x37da('0x1b')](_0x37da('0x1c'),Date[_0x37da('0x1d')](),_0xc1493[_0x37da('0x1e')][_0x37da('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x37da('0x20'),upload[_0x37da('0x21')]('file'),controller[_0x37da('0x22')]);router['post'](_0x37da('0x11'),auth[_0x37da('0xd')](),controller[_0x37da('0x23')]);router[_0x37da('0x14')](_0x37da('0x24'),auth['isAuthenticated'](),interaction['tracked'](_0x37da('0x25'),_0x37da('0x26')),controller['addTags']);router['put'](_0x37da('0xc'),auth[_0x37da('0x9')](),interaction[_0x37da('0x27')]('chat','chatinteraction:update'),controller[_0x37da('0x28')]);router[_0x37da('0x29')](_0x37da('0x2a'),controller['customUpdate']);router['put'](_0x37da('0x2b'),auth[_0x37da('0xd')](),controller[_0x37da('0x2c')]);router['put'](_0x37da('0x2d'),controller[_0x37da('0x2e')]);router['delete'](_0x37da('0xc'),auth[_0x37da('0x9')](),interaction['tracked'](_0x37da('0x25'),_0x37da('0x2f')),controller[_0x37da('0x30')]);router[_0x37da('0x31')]('/:id/tags',auth['isAuthenticated'](),controller[_0x37da('0x32')]);module['exports']=router; \ No newline at end of file +var _0xd759=['diskStorage','root','server/files/attachments/','format','now','originalname','/:id/attachment_upload','single','file','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','attachmentDownload','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession'];(function(_0x21775c,_0x160bdd){var _0x2e6351=function(_0x5d19e7){while(--_0x5d19e7){_0x21775c['push'](_0x21775c['shift']());}};_0x2e6351(++_0x160bdd);}(_0xd759,0x1a8));var _0x9d75=function(_0x43a602,_0x4fe4ef){_0x43a602=_0x43a602-0x0;var _0x5b085c=_0xd759[_0x43a602];return _0x5b085c;};'use strict';var multer=require(_0x9d75('0x0'));var util=require(_0x9d75('0x1'));var path=require(_0x9d75('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d75('0x3'));var router=express[_0x9d75('0x4')]();var fs_extra=require(_0x9d75('0x5'));var auth=require(_0x9d75('0x6'));var interaction=require(_0x9d75('0x7'));var config=require('../../config/environment');var controller=require(_0x9d75('0x8'));router[_0x9d75('0x9')]('/',auth[_0x9d75('0xa')](),controller['index']);router['get'](_0x9d75('0xb'),auth[_0x9d75('0xa')](),controller[_0x9d75('0xc')]);router['get'](_0x9d75('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x9d75('0xe')]);router[_0x9d75('0x9')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x9d75('0xf')]);router[_0x9d75('0x9')]('/:id/messages',auth[_0x9d75('0xa')](),controller[_0x9d75('0x10')]);router['get'](_0x9d75('0x11'),auth[_0x9d75('0x12')](),controller[_0x9d75('0x13')]);router[_0x9d75('0x9')](_0x9d75('0x14'),auth[_0x9d75('0xa')](),controller[_0x9d75('0x15')]);router[_0x9d75('0x16')]('/',auth[_0x9d75('0xa')](),controller[_0x9d75('0x17')]);router[_0x9d75('0x16')](_0x9d75('0x18'),auth[_0x9d75('0xa')](),controller[_0x9d75('0x19')]);var upload=multer({'storage':multer[_0x9d75('0x1a')]({'destination':function(_0x54322e,_0x1f9a2a,_0x316bd1){_0x316bd1(null,path['join'](config[_0x9d75('0x1b')],_0x9d75('0x1c')));},'filename':function(_0x498200,_0x2a566e,_0x4bf011){_0x4bf011(null,util[_0x9d75('0x1d')]('%s-%s',Date[_0x9d75('0x1e')](),_0x2a566e[_0x9d75('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x9d75('0x20'),upload[_0x9d75('0x21')](_0x9d75('0x22')),controller['attachmentUpload']);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x9d75('0x23')]);router['post'](_0x9d75('0x24'),auth[_0x9d75('0xa')](),interaction['tracked'](_0x9d75('0x25'),_0x9d75('0x26')),controller[_0x9d75('0x27')]);router[_0x9d75('0x28')](_0x9d75('0xd'),auth[_0x9d75('0xa')](),interaction[_0x9d75('0x29')]('chat','chatinteraction:update'),controller['update']);router[_0x9d75('0x28')]('/:id/custom_update',controller[_0x9d75('0x2a')]);router[_0x9d75('0x28')](_0x9d75('0x2b'),auth[_0x9d75('0x12')](),controller['abandon']);router[_0x9d75('0x28')](_0x9d75('0x2c'),controller[_0x9d75('0x2d')]);router[_0x9d75('0x2e')](_0x9d75('0xd'),auth['isAuthenticated'](),interaction[_0x9d75('0x29')](_0x9d75('0x25'),_0x9d75('0x2f')),controller[_0x9d75('0x30')]);router[_0x9d75('0x2e')](_0x9d75('0x24'),auth[_0x9d75('0xa')](),controller['removeTags']);module[_0x9d75('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a89011c..67f9a8c 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc58c=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xc58c,0x197));var _0xcc58=function(_0x56cfd2,_0x2ae924){_0x56cfd2=_0x56cfd2-0x0;var _0x22a89a=_0xc58c[_0x56cfd2];return _0x22a89a;};'use strict';var Sequelize=require(_0xcc58('0x0'));module[_0xcc58('0x1')]={'body':{'type':Sequelize['TEXT'](_0xcc58('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcc58('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xcc58('0x4')]}}; \ No newline at end of file +var _0xe24a=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x516ae8,_0x1a757c){var _0x1732bb=function(_0x364bab){while(--_0x364bab){_0x516ae8['push'](_0x516ae8['shift']());}};_0x1732bb(++_0x1a757c);}(_0xe24a,0x85));var _0xae24=function(_0x55cd75,_0x52f8cf){_0x55cd75=_0x55cd75-0x0;var _0xac29a5=_0xe24a[_0x55cd75];return _0xac29a5;};'use strict';var Sequelize=require(_0xae24('0x0'));module[_0xae24('0x1')]={'body':{'type':Sequelize['TEXT'](_0xae24('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xae24('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xae24('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 135d58a..f69a061 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 _0x8aa5=['rows','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','admin','fullname','role','userpic','internal','VoiceQueue','VoiceQueues','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','agent','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll'];(function(_0x541d06,_0x28a363){var _0x48b86d=function(_0x46340b){while(--_0x46340b){_0x541d06['push'](_0x541d06['shift']());}};_0x48b86d(++_0x28a363);}(_0x8aa5,0x91));var _0x58aa=function(_0x4812ba,_0x4d1a16){_0x4812ba=_0x4812ba-0x0;var _0x185538=_0x8aa5[_0x4812ba];return _0x185538;};'use strict';var emlformat=require(_0x58aa('0x0'));var rimraf=require(_0x58aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58aa('0x2'));var rp=require(_0x58aa('0x3'));var moment=require('moment');var BPromise=require(_0x58aa('0x4'));var Mustache=require(_0x58aa('0x5'));var util=require(_0x58aa('0x6'));var path=require(_0x58aa('0x7'));var sox=require('sox');var csv=require(_0x58aa('0x8'));var ejs=require(_0x58aa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58aa('0xa'));var squel=require(_0x58aa('0xb'));var crypto=require(_0x58aa('0xc'));var jsforce=require(_0x58aa('0xd'));var deskjs=require(_0x58aa('0xe'));var toCsv=require(_0x58aa('0x8'));var querystring=require('querystring');var Papa=require(_0x58aa('0xf'));var Redis=require(_0x58aa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x58aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58aa('0x12'));var logger=require('../../config/logger')(_0x58aa('0x13'));var utils=require(_0x58aa('0x14'));var config=require(_0x58aa('0x15'));var licenseUtil=require(_0x58aa('0x16'));var db=require(_0x58aa('0x17'))['db'];config[_0x58aa('0x18')]=_[_0x58aa('0x19')](config[_0x58aa('0x18')],{'host':_0x58aa('0x1a'),'port':0x18eb});var socket=require(_0x58aa('0x1b'))(new Redis(config['redis']));require(_0x58aa('0x1c'))['register'](socket);function respondWithStatusCode(_0x3bbf5d,_0x926b3e){_0x926b3e=_0x926b3e||0xcc;return function(_0x53e175){if(_0x53e175){return _0x3bbf5d[_0x58aa('0x1d')](_0x926b3e);}return _0x3bbf5d[_0x58aa('0x1e')](_0x926b3e)[_0x58aa('0x1f')]();};}function respondWithResult(_0x207c70,_0x495c17){_0x495c17=_0x495c17||0xc8;return function(_0x117e15){if(_0x117e15){return _0x207c70[_0x58aa('0x1e')](_0x495c17)[_0x58aa('0x20')](_0x117e15);}};}function respondWithFilteredResult(_0x55dda0,_0x2c55f8){return function(_0x4ead6f){if(_0x4ead6f){var _0x3d67ff=typeof _0x2c55f8['offset']===_0x58aa('0x21')&&typeof _0x2c55f8[_0x58aa('0x22')]==='undefined';var _0x5dcc5b=_0x4ead6f['count'];var _0x2553f6=_0x3d67ff?0x0:_0x2c55f8[_0x58aa('0x23')];var _0x3edf22=_0x3d67ff?_0x4ead6f[_0x58aa('0x24')]:_0x2c55f8[_0x58aa('0x23')]+_0x2c55f8[_0x58aa('0x22')];var _0x30a491;if(_0x3edf22>=_0x5dcc5b){_0x3edf22=_0x5dcc5b;_0x30a491=0xc8;}else{_0x30a491=0xce;}_0x55dda0['status'](_0x30a491);return _0x55dda0['set'](_0x58aa('0x25'),_0x2553f6+'-'+_0x3edf22+'/'+_0x5dcc5b)['json'](_0x4ead6f);}return null;};}function patchUpdates(_0x28ff69){return function(_0x5c0a8a){try{jsonpatch['apply'](_0x5c0a8a,_0x28ff69,!![]);}catch(_0x87dcaf){return BPromise['reject'](_0x87dcaf);}return _0x5c0a8a[_0x58aa('0x26')]();};}function saveUpdates(_0x1e12d8,_0xf73513){return function(_0x2e964a){if(_0x2e964a){return _0x2e964a[_0x58aa('0x27')](_0x1e12d8)[_0x58aa('0x28')](function(_0x472903){return _0x472903;});}return null;};}function removeEntity(_0x53ea69,_0x4be463){return function(_0x3fa82d){if(_0x3fa82d){return _0x3fa82d[_0x58aa('0x29')]()[_0x58aa('0x28')](function(){_0x53ea69[_0x58aa('0x1e')](0xcc)[_0x58aa('0x1f')]();});}};}function handleEntityNotFound(_0x34eef5,_0x139e74){return function(_0x3268a1){if(!_0x3268a1){_0x34eef5[_0x58aa('0x1d')](0x194);}return _0x3268a1;};}function handleError(_0x48f2cd,_0x5d0cc5){_0x5d0cc5=_0x5d0cc5||0x1f4;return function(_0x25a9ed){logger[_0x58aa('0x2a')](_0x25a9ed[_0x58aa('0x2b')]);if(_0x25a9ed[_0x58aa('0x2c')]){delete _0x25a9ed[_0x58aa('0x2c')];}_0x48f2cd[_0x58aa('0x1e')](_0x5d0cc5)[_0x58aa('0x2d')](_0x25a9ed);};}exports[_0x58aa('0x2e')]=function(_0x15409b,_0x392a1a){var _0x14bc0a={},_0x1ac823={},_0x1019c5={'count':0x0,'rows':[]};var _0x3e5951=_[_0x58aa('0x2f')](db[_0x58aa('0x30')]['rawAttributes'],function(_0x319a29){return{'name':_0x319a29[_0x58aa('0x31')],'type':_0x319a29[_0x58aa('0x32')][_0x58aa('0x33')]};});_0x1ac823[_0x58aa('0x34')]=_[_0x58aa('0x2f')](_0x3e5951,_0x58aa('0x2c'));_0x1ac823[_0x58aa('0x35')]=_[_0x58aa('0x36')](_0x15409b[_0x58aa('0x35')]);_0x1ac823[_0x58aa('0x37')]=_[_0x58aa('0x38')](_0x1ac823[_0x58aa('0x34')],_0x1ac823[_0x58aa('0x35')]);_0x14bc0a[_0x58aa('0x39')]=_[_0x58aa('0x38')](_0x1ac823['model'],qs[_0x58aa('0x3a')](_0x15409b[_0x58aa('0x35')][_0x58aa('0x3a')]));_0x14bc0a[_0x58aa('0x39')]=_0x14bc0a[_0x58aa('0x39')][_0x58aa('0x3b')]?_0x14bc0a[_0x58aa('0x39')]:_0x1ac823[_0x58aa('0x34')];if(!_0x15409b[_0x58aa('0x35')][_0x58aa('0x3c')](_0x58aa('0x3d'))){_0x14bc0a[_0x58aa('0x22')]=qs[_0x58aa('0x22')](_0x15409b[_0x58aa('0x35')][_0x58aa('0x22')]);_0x14bc0a[_0x58aa('0x23')]=qs[_0x58aa('0x23')](_0x15409b[_0x58aa('0x35')][_0x58aa('0x23')]);}_0x14bc0a[_0x58aa('0x3e')]=qs[_0x58aa('0x3f')](_0x15409b[_0x58aa('0x35')][_0x58aa('0x3f')]);_0x14bc0a[_0x58aa('0x40')]=qs[_0x58aa('0x37')](_[_0x58aa('0x41')](_0x15409b[_0x58aa('0x35')],_0x1ac823[_0x58aa('0x37')]),_0x3e5951);if(_0x15409b[_0x58aa('0x35')][_0x58aa('0x42')]){_0x14bc0a[_0x58aa('0x40')]=_['merge'](_0x14bc0a[_0x58aa('0x40')],{'$or':_['map'](_0x3e5951,function(_0x50fe30){if(_0x50fe30[_0x58aa('0x32')]!=='VIRTUAL'){var _0x4e219c={};_0x4e219c[_0x50fe30['name']]={'$like':'%'+_0x15409b[_0x58aa('0x35')][_0x58aa('0x42')]+'%'};return _0x4e219c;}})});}_0x14bc0a=_[_0x58aa('0x43')]({},_0x14bc0a,_0x15409b['options']);var _0x42514f={'where':_0x14bc0a[_0x58aa('0x40')]};return db[_0x58aa('0x30')]['count'](_0x42514f)[_0x58aa('0x28')](function(_0xdcbf35){_0x1019c5['count']=_0xdcbf35;if(_0x15409b[_0x58aa('0x35')][_0x58aa('0x44')]){_0x14bc0a[_0x58aa('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x58aa('0x46')](_0x14bc0a);})[_0x58aa('0x28')](function(_0x423f33){_0x1019c5[_0x58aa('0x47')]=_0x423f33;return _0x1019c5;})[_0x58aa('0x28')](respondWithFilteredResult(_0x392a1a,_0x14bc0a))[_0x58aa('0x48')](handleError(_0x392a1a,null));};exports[_0x58aa('0x49')]=function(_0x49fe6a,_0x146aa9){var _0xc97068={'raw':!![],'where':{'id':_0x49fe6a[_0x58aa('0x4a')]['id']}},_0x2f1ba6={};_0x2f1ba6[_0x58aa('0x34')]=_[_0x58aa('0x36')](db[_0x58aa('0x30')]['rawAttributes']);_0x2f1ba6[_0x58aa('0x35')]=_['keys'](_0x49fe6a[_0x58aa('0x35')]);_0x2f1ba6[_0x58aa('0x37')]=_['intersection'](_0x2f1ba6['model'],_0x2f1ba6[_0x58aa('0x35')]);_0xc97068[_0x58aa('0x39')]=_['intersection'](_0x2f1ba6[_0x58aa('0x34')],qs[_0x58aa('0x3a')](_0x49fe6a[_0x58aa('0x35')][_0x58aa('0x3a')]));_0xc97068[_0x58aa('0x39')]=_0xc97068[_0x58aa('0x39')][_0x58aa('0x3b')]?_0xc97068[_0x58aa('0x39')]:_0x2f1ba6[_0x58aa('0x34')];if(_0x49fe6a[_0x58aa('0x35')]['includeAll']){_0xc97068[_0x58aa('0x45')]=[{'all':!![]}];}_0xc97068=_[_0x58aa('0x43')]({},_0xc97068,_0x49fe6a['options']);return db[_0x58aa('0x30')][_0x58aa('0x4b')](_0xc97068)['then'](handleEntityNotFound(_0x146aa9,null))[_0x58aa('0x28')](respondWithResult(_0x146aa9,null))[_0x58aa('0x48')](handleError(_0x146aa9,null));};exports[_0x58aa('0x4c')]=function(_0x4a265b,_0x176a94){return db['ChatInternalMessage'][_0x58aa('0x4c')](_0x4a265b[_0x58aa('0x4d')],{})[_0x58aa('0x28')](respondWithResult(_0x176a94,0xc9))[_0x58aa('0x48')](handleError(_0x176a94,null));};exports['update']=function(_0x5692a5,_0x4e3996){if(_0x5692a5[_0x58aa('0x4d')]['id']){delete _0x5692a5[_0x58aa('0x4d')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x5692a5[_0x58aa('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4e3996,null))[_0x58aa('0x28')](saveUpdates(_0x5692a5[_0x58aa('0x4d')],null))[_0x58aa('0x28')](respondWithResult(_0x4e3996,null))['catch'](handleError(_0x4e3996,null));};exports['destroy']=function(_0x3ad790,_0x6918c0){return db['ChatInternalMessage'][_0x58aa('0x4b')]({'where':{'id':_0x3ad790['params']['id']}})[_0x58aa('0x28')](handleEntityNotFound(_0x6918c0,null))[_0x58aa('0x28')](removeEntity(_0x6918c0,null))[_0x58aa('0x48')](handleError(_0x6918c0,null));};exports[_0x58aa('0x4e')]=function(_0x50dd7f,_0x51ddb2){return db['ChatInternalMessage'][_0x58aa('0x4e')]()[_0x58aa('0x28')](respondWithResult(_0x51ddb2,null))[_0x58aa('0x48')](handleError(_0x51ddb2,null));};function wrapUser(_0x2721bd){return function(_0x4518a3){var _0x3c3fce=_0x2721bd[_0x58aa('0x4f')]({'plain':!![]});_0x3c3fce[_0x58aa('0x50')]=[];if(_0x4518a3){_0x3c3fce[_0x58aa('0x51')]=_0x4518a3[_0x58aa('0x52')];_0x3c3fce['lastMessage']=_0x4518a3;}else{_0x3c3fce[_0x58aa('0x51')]=moment(0x0)['format'](_0x58aa('0x53'));_0x3c3fce[_0x58aa('0x54')]={};}return _0x3c3fce;};}exports[_0x58aa('0x55')]=function(_0x5d5209,_0x427d6e,_0x2ff9d7){var _0x287cf1=[];return db[_0x58aa('0x56')][_0x58aa('0x46')]({'where':{'role':['agent',_0x58aa('0x57'),'user']},'attributes':['id',_0x58aa('0x58'),'name',_0x58aa('0x59'),_0x58aa('0x5a'),_0x58aa('0x5b'),'online','lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0x58aa('0x3f')]('-online'),'include':[{'model':db[_0x58aa('0x5c')],'as':_0x58aa('0x5d'),'attributes':['id',_0x58aa('0x2c'),_0x58aa('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x3b1ef6){if(_0x3b1ef6){var _0x4be064=_0x5d5209['user'][_0x58aa('0x4f')]({'plain':!![]});if(!_0x4be064)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4be064[_0x58aa('0x59')]===_0x58aa('0x5e')){return db[_0x58aa('0x5f')][_0x58aa('0x4b')]({'where':{'name':_0x58aa('0x60'),'userProfileId':_0x4be064[_0x58aa('0x61')]},'raw':!![]})[_0x58aa('0x28')](function(_0x243631){if(_0x243631){if(_0x243631[_0x58aa('0x62')]===0x0){return db[_0x58aa('0x63')][_0x58aa('0x46')]({'where':{'sectionId':_0x243631['id']},'raw':!![]})[_0x58aa('0x28')](function(_0xb42840){var _0x446cf9=[];if(_['isEmpty'](_0xb42840)){_0x446cf9=_[_0x58aa('0x42')](_0x3b1ef6,function(_0x55a292){if(_0x55a292[_0x58aa('0x59')]!==_0x58aa('0x64')){return _0x55a292;}});return _0x446cf9;}else{for(var _0x44a7f4=0x0;_0x44a7f4<_0x3b1ef6[_0x58aa('0x3b')];_0x44a7f4++){var _0x113796=_0x3b1ef6[_0x44a7f4];if(_0x113796[_0x58aa('0x59')]===_0x58aa('0x64')){var _0x1c612d=_[_0x58aa('0x4b')](_0xb42840,function(_0x10352b){return _0x10352b[_0x58aa('0x65')]===_0x113796['id'];});if(_0x1c612d)_0x446cf9[_0x58aa('0x66')](_0x113796);}else{_0x446cf9[_0x58aa('0x66')](_0x113796);}}return _0x446cf9;}});}else{return _0x3b1ef6;}}else{var _0x5e88ee=_[_0x58aa('0x42')](_0x3b1ef6,function(_0x1c3c18){if(_0x1c3c18['role']!==_0x58aa('0x64')){return _0x1c3c18;}});return _0x5e88ee;}});}else{return _0x3b1ef6;}}})[_0x58aa('0x28')](function(_0x4158a9){var _0xa5eb43=[];if(_0x4158a9){_0x287cf1=_0x4158a9;for(var _0x4c5c5f=0x0;_0x4c5c5f<_0x4158a9['length'];_0x4c5c5f+=0x1){_0x287cf1[_0x4c5c5f][_0x58aa('0x50')]=[];_0xa5eb43[_0x58aa('0x66')](db['ChatInternalMessage'][_0x58aa('0x4b')]({'where':{'FromId':[_0x5d5209[_0x58aa('0x5e')]['id'],_0x4158a9[_0x4c5c5f]['id']],'ToId':[_0x5d5209[_0x58aa('0x5e')]['id'],_0x4158a9[_0x4c5c5f]['id']],'ChatGroupId':null},'attributes':['id',_0x58aa('0x52'),_0x58aa('0x67'),_0x58aa('0x68'),_0x58aa('0x69'),_0x58aa('0x4d')],'order':qs[_0x58aa('0x3f')](_0x58aa('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x58aa('0x28')](wrapUser(_0x4158a9[_0x4c5c5f])));}return BPromise[_0x58aa('0x6b')](_0xa5eb43);}return[];})[_0x58aa('0x28')](function(_0x5e7b6e){return{'rows':_0x5e7b6e,'count':_0x5e7b6e[_0x58aa('0x3b')]};})[_0x58aa('0x28')](respondWithResult(_0x427d6e,null))['catch'](handleError(_0x427d6e,null));}; \ No newline at end of file +var _0x954d=['user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','json','offset','limit','count','reject','update','destroy','then','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','intersection','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x954d,0xec));var _0xd954=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x954d[_0x4063a4];return _0x17908d;};'use strict';var emlformat=require(_0xd954('0x0'));var rimraf=require(_0xd954('0x1'));var zipdir=require(_0xd954('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd954('0x3'));var moment=require(_0xd954('0x4'));var BPromise=require(_0xd954('0x5'));var Mustache=require(_0xd954('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd954('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd954('0x8'));var _=require(_0xd954('0x9'));var squel=require(_0xd954('0xa'));var crypto=require('crypto');var jsforce=require(_0xd954('0xb'));var deskjs=require(_0xd954('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd954('0xd'));var Papa=require(_0xd954('0xe'));var Redis=require(_0xd954('0xf'));var authService=require(_0xd954('0x10'));var qs=require(_0xd954('0x11'));var as=require(_0xd954('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd954('0x13'));var utils=require(_0xd954('0x14'));var config=require(_0xd954('0x15'));var licenseUtil=require(_0xd954('0x16'));var db=require(_0xd954('0x17'))['db'];config[_0xd954('0x18')]=_[_0xd954('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd954('0x18')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x3b2374,_0x29e6a0){_0x29e6a0=_0x29e6a0||0xcc;return function(_0x5b19ec){if(_0x5b19ec){return _0x3b2374[_0xd954('0x1a')](_0x29e6a0);}return _0x3b2374['status'](_0x29e6a0)['end']();};}function respondWithResult(_0x28fa93,_0x2af59a){_0x2af59a=_0x2af59a||0xc8;return function(_0x5eadb4){if(_0x5eadb4){return _0x28fa93[_0xd954('0x1b')](_0x2af59a)[_0xd954('0x1c')](_0x5eadb4);}};}function respondWithFilteredResult(_0x46889e,_0x343c3d){return function(_0x400435){if(_0x400435){var _0x290666=typeof _0x343c3d[_0xd954('0x1d')]==='undefined'&&typeof _0x343c3d[_0xd954('0x1e')]==='undefined';var _0x971ea5=_0x400435[_0xd954('0x1f')];var _0x26aca7=_0x290666?0x0:_0x343c3d[_0xd954('0x1d')];var _0x1633cf=_0x290666?_0x400435[_0xd954('0x1f')]:_0x343c3d['offset']+_0x343c3d['limit'];var _0x27c4f4;if(_0x1633cf>=_0x971ea5){_0x1633cf=_0x971ea5;_0x27c4f4=0xc8;}else{_0x27c4f4=0xce;}_0x46889e[_0xd954('0x1b')](_0x27c4f4);return _0x46889e['set']('Content-Range',_0x26aca7+'-'+_0x1633cf+'/'+_0x971ea5)[_0xd954('0x1c')](_0x400435);}return null;};}function patchUpdates(_0x1b864f){return function(_0x2c5210){try{jsonpatch['apply'](_0x2c5210,_0x1b864f,!![]);}catch(_0x463e75){return BPromise[_0xd954('0x20')](_0x463e75);}return _0x2c5210['save']();};}function saveUpdates(_0x569c6c,_0x1a5772){return function(_0x520928){if(_0x520928){return _0x520928[_0xd954('0x21')](_0x569c6c)['then'](function(_0x5d2141){return _0x5d2141;});}return null;};}function removeEntity(_0x67530f,_0x28c350){return function(_0x472380){if(_0x472380){return _0x472380[_0xd954('0x22')]()[_0xd954('0x23')](function(){_0x67530f['status'](0xcc)[_0xd954('0x24')]();});}};}function handleEntityNotFound(_0x35ae93,_0x229b07){return function(_0x9c2a59){if(!_0x9c2a59){_0x35ae93[_0xd954('0x1a')](0x194);}return _0x9c2a59;};}function handleError(_0x2e49a2,_0x2517ae){_0x2517ae=_0x2517ae||0x1f4;return function(_0x3918b5){logger[_0xd954('0x25')](_0x3918b5[_0xd954('0x26')]);if(_0x3918b5[_0xd954('0x27')]){delete _0x3918b5['name'];}_0x2e49a2['status'](_0x2517ae)[_0xd954('0x28')](_0x3918b5);};}exports[_0xd954('0x29')]=function(_0x36d243,_0x128d85){var _0x37a6da={},_0x2b82d3={},_0x4b51e1={'count':0x0,'rows':[]};var _0x2da92d=_[_0xd954('0x2a')](db[_0xd954('0x2b')][_0xd954('0x2c')],function(_0x5b203d){return{'name':_0x5b203d[_0xd954('0x2d')],'type':_0x5b203d[_0xd954('0x2e')]['key']};});_0x2b82d3[_0xd954('0x2f')]=_[_0xd954('0x2a')](_0x2da92d,_0xd954('0x27'));_0x2b82d3[_0xd954('0x30')]=_[_0xd954('0x31')](_0x36d243[_0xd954('0x30')]);_0x2b82d3[_0xd954('0x32')]=_['intersection'](_0x2b82d3[_0xd954('0x2f')],_0x2b82d3['query']);_0x37a6da['attributes']=_['intersection'](_0x2b82d3[_0xd954('0x2f')],qs['fields'](_0x36d243['query'][_0xd954('0x33')]));_0x37a6da['attributes']=_0x37a6da[_0xd954('0x34')][_0xd954('0x35')]?_0x37a6da['attributes']:_0x2b82d3[_0xd954('0x2f')];if(!_0x36d243[_0xd954('0x30')][_0xd954('0x36')](_0xd954('0x37'))){_0x37a6da[_0xd954('0x1e')]=qs['limit'](_0x36d243[_0xd954('0x30')][_0xd954('0x1e')]);_0x37a6da[_0xd954('0x1d')]=qs[_0xd954('0x1d')](_0x36d243['query'][_0xd954('0x1d')]);}_0x37a6da[_0xd954('0x38')]=qs[_0xd954('0x39')](_0x36d243[_0xd954('0x30')][_0xd954('0x39')]);_0x37a6da[_0xd954('0x3a')]=qs[_0xd954('0x32')](_['pick'](_0x36d243[_0xd954('0x30')],_0x2b82d3['filters']),_0x2da92d);if(_0x36d243[_0xd954('0x30')][_0xd954('0x3b')]){_0x37a6da['where']=_[_0xd954('0x3c')](_0x37a6da[_0xd954('0x3a')],{'$or':_[_0xd954('0x2a')](_0x2da92d,function(_0x2761f1){if(_0x2761f1['type']!==_0xd954('0x3d')){var _0xbb45a2={};_0xbb45a2[_0x2761f1[_0xd954('0x27')]]={'$like':'%'+_0x36d243[_0xd954('0x30')][_0xd954('0x3b')]+'%'};return _0xbb45a2;}})});}_0x37a6da=_[_0xd954('0x3c')]({},_0x37a6da,_0x36d243[_0xd954('0x3e')]);var _0x44c749={'where':_0x37a6da[_0xd954('0x3a')]};return db[_0xd954('0x2b')]['count'](_0x44c749)[_0xd954('0x23')](function(_0x76fff5){_0x4b51e1[_0xd954('0x1f')]=_0x76fff5;if(_0x36d243['query'][_0xd954('0x3f')]){_0x37a6da[_0xd954('0x40')]=[{'all':!![]}];}return db[_0xd954('0x2b')][_0xd954('0x41')](_0x37a6da);})[_0xd954('0x23')](function(_0x24b3ee){_0x4b51e1['rows']=_0x24b3ee;return _0x4b51e1;})[_0xd954('0x23')](respondWithFilteredResult(_0x128d85,_0x37a6da))[_0xd954('0x42')](handleError(_0x128d85,null));};exports[_0xd954('0x43')]=function(_0x3e9ee9,_0x4efb9d){var _0x4aef00={'raw':!![],'where':{'id':_0x3e9ee9['params']['id']}},_0x5006b1={};_0x5006b1[_0xd954('0x2f')]=_['keys'](db[_0xd954('0x2b')][_0xd954('0x2c')]);_0x5006b1[_0xd954('0x30')]=_[_0xd954('0x31')](_0x3e9ee9['query']);_0x5006b1[_0xd954('0x32')]=_[_0xd954('0x44')](_0x5006b1[_0xd954('0x2f')],_0x5006b1[_0xd954('0x30')]);_0x4aef00[_0xd954('0x34')]=_[_0xd954('0x44')](_0x5006b1[_0xd954('0x2f')],qs[_0xd954('0x33')](_0x3e9ee9[_0xd954('0x30')][_0xd954('0x33')]));_0x4aef00['attributes']=_0x4aef00['attributes'][_0xd954('0x35')]?_0x4aef00['attributes']:_0x5006b1[_0xd954('0x2f')];if(_0x3e9ee9['query'][_0xd954('0x3f')]){_0x4aef00[_0xd954('0x40')]=[{'all':!![]}];}_0x4aef00=_[_0xd954('0x3c')]({},_0x4aef00,_0x3e9ee9[_0xd954('0x3e')]);return db[_0xd954('0x2b')][_0xd954('0x45')](_0x4aef00)[_0xd954('0x23')](handleEntityNotFound(_0x4efb9d,null))[_0xd954('0x23')](respondWithResult(_0x4efb9d,null))[_0xd954('0x42')](handleError(_0x4efb9d,null));};exports[_0xd954('0x46')]=function(_0xd6b801,_0x4ad9f8){return db['ChatInternalMessage']['create'](_0xd6b801[_0xd954('0x47')],{})[_0xd954('0x23')](respondWithResult(_0x4ad9f8,0xc9))[_0xd954('0x42')](handleError(_0x4ad9f8,null));};exports['update']=function(_0x5e524a,_0xd830f7){if(_0x5e524a['body']['id']){delete _0x5e524a['body']['id'];}return db[_0xd954('0x2b')][_0xd954('0x45')]({'where':{'id':_0x5e524a[_0xd954('0x48')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0xd830f7,null))[_0xd954('0x23')](saveUpdates(_0x5e524a[_0xd954('0x47')],null))['then'](respondWithResult(_0xd830f7,null))[_0xd954('0x42')](handleError(_0xd830f7,null));};exports[_0xd954('0x22')]=function(_0x3d3808,_0x5571dd){return db[_0xd954('0x2b')][_0xd954('0x45')]({'where':{'id':_0x3d3808['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x5571dd,null))['then'](removeEntity(_0x5571dd,null))[_0xd954('0x42')](handleError(_0x5571dd,null));};exports[_0xd954('0x49')]=function(_0x4e63c0,_0x331d68){return db[_0xd954('0x2b')][_0xd954('0x49')]()[_0xd954('0x23')](respondWithResult(_0x331d68,null))[_0xd954('0x42')](handleError(_0x331d68,null));};function wrapUser(_0x46fb1b){return function(_0x5f4f42){var _0x283e28=_0x46fb1b[_0xd954('0x4a')]({'plain':!![]});_0x283e28[_0xd954('0x4b')]=[];if(_0x5f4f42){_0x283e28[_0xd954('0x4c')]=_0x5f4f42[_0xd954('0x4d')];_0x283e28[_0xd954('0x4e')]=_0x5f4f42;}else{_0x283e28[_0xd954('0x4c')]=moment(0x0)[_0xd954('0x4f')](_0xd954('0x50'));_0x283e28[_0xd954('0x4e')]={};}return _0x283e28;};}exports[_0xd954('0x51')]=function(_0x554a01,_0x3a7cd6,_0x37def3){var _0x5a8d60=[];return db[_0xd954('0x52')][_0xd954('0x41')]({'where':{'role':[_0xd954('0x53'),_0xd954('0x54'),_0xd954('0x55')]},'attributes':['id',_0xd954('0x56'),_0xd954('0x27'),_0xd954('0x57'),_0xd954('0x58'),_0xd954('0x59'),_0xd954('0x5a'),_0xd954('0x5b'),_0xd954('0x5c'),'showWebBar'],'order':qs[_0xd954('0x39')]('-online'),'include':[{'model':db[_0xd954('0x5d')],'as':_0xd954('0x5e'),'attributes':['id',_0xd954('0x27'),_0xd954('0x2e')],'through':{'attributes':[]}}]})[_0xd954('0x23')](function(_0x5df3b1){if(_0x5df3b1){var _0xd32010=_0x554a01[_0xd954('0x55')]['get']({'plain':!![]});if(!_0xd32010)throw new Error(_0xd954('0x5f'));if(_0xd32010[_0xd954('0x57')]===_0xd954('0x55')){return db[_0xd954('0x60')][_0xd954('0x45')]({'where':{'name':_0xd954('0x61'),'userProfileId':_0xd32010[_0xd954('0x62')]},'raw':!![]})[_0xd954('0x23')](function(_0x5e8d78){if(_0x5e8d78){if(_0x5e8d78['autoAssociation']===0x0){return db['UserProfileResource'][_0xd954('0x41')]({'where':{'sectionId':_0x5e8d78['id']},'raw':!![]})['then'](function(_0x348b84){var _0xd06f8e=[];if(_[_0xd954('0x63')](_0x348b84)){_0xd06f8e=_['filter'](_0x5df3b1,function(_0x187178){if(_0x187178[_0xd954('0x57')]!=='agent'){return _0x187178;}});return _0xd06f8e;}else{for(var _0x49c752=0x0;_0x49c752<_0x5df3b1['length'];_0x49c752++){var _0x3f1850=_0x5df3b1[_0x49c752];if(_0x3f1850[_0xd954('0x57')]==='agent'){var _0x12ee43=_['find'](_0x348b84,function(_0x20e823){return _0x20e823[_0xd954('0x64')]===_0x3f1850['id'];});if(_0x12ee43)_0xd06f8e[_0xd954('0x65')](_0x3f1850);}else{_0xd06f8e['push'](_0x3f1850);}}return _0xd06f8e;}});}else{return _0x5df3b1;}}else{var _0x308dec=_[_0xd954('0x3b')](_0x5df3b1,function(_0x9b170){if(_0x9b170[_0xd954('0x57')]!==_0xd954('0x53')){return _0x9b170;}});return _0x308dec;}});}else{return _0x5df3b1;}}})[_0xd954('0x23')](function(_0x1925f5){var _0x399544=[];if(_0x1925f5){_0x5a8d60=_0x1925f5;for(var _0x161f72=0x0;_0x161f72<_0x1925f5[_0xd954('0x35')];_0x161f72+=0x1){_0x5a8d60[_0x161f72]['messages']=[];_0x399544[_0xd954('0x65')](db[_0xd954('0x2b')][_0xd954('0x45')]({'where':{'FromId':[_0x554a01['user']['id'],_0x1925f5[_0x161f72]['id']],'ToId':[_0x554a01[_0xd954('0x55')]['id'],_0x1925f5[_0x161f72]['id']],'ChatGroupId':null},'attributes':['id',_0xd954('0x4d'),_0xd954('0x66'),_0xd954('0x67'),_0xd954('0x68'),_0xd954('0x47')],'order':qs[_0xd954('0x39')](_0xd954('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd954('0x23')](wrapUser(_0x1925f5[_0x161f72])));}return BPromise[_0xd954('0x6a')](_0x399544);}return[];})[_0xd954('0x23')](function(_0x2a42e6){return{'rows':_0x2a42e6,'count':_0x2a42e6['length']};})['then'](respondWithResult(_0x3a7cd6,null))[_0xd954('0x42')](handleError(_0x3a7cd6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f17f88f..8cba77d 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 _0xf4ad=['exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x30890d,_0x290555){var _0x237465=function(_0x4bd60d){while(--_0x4bd60d){_0x30890d['push'](_0x30890d['shift']());}};_0x237465(++_0x290555);}(_0xf4ad,0x6f));var _0xdf4a=function(_0xee588,_0x368239){_0xee588=_0xee588-0x0;var _0x58dd1a=_0xf4ad[_0xee588];return _0x58dd1a;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xdf4a('0x0'))['db'][_0xdf4a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdf4a('0x2')](0x0);var events={'afterCreate':_0xdf4a('0x3'),'afterUpdate':_0xdf4a('0x4'),'afterDestroy':_0xdf4a('0x5')};function emitEvent(_0x2344df){return function(_0x592b94,_0xe8d9e,_0x568be5){ChatInternalMessageEvents[_0xdf4a('0x6')](_0x2344df+':'+_0x592b94['id'],_0x592b94);ChatInternalMessageEvents[_0xdf4a('0x6')](_0x2344df,_0x592b94);_0x568be5(null);};}for(var e in events){if(events[_0xdf4a('0x7')](e)){var event=events[e];ChatInternalMessage[_0xdf4a('0x8')](e,emitEvent(event));}}module[_0xdf4a('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3c42=['emit','hook','ChatInternalMessage','save'];(function(_0xbef5b0,_0x3da2d4){var _0x1c3e81=function(_0x38eae0){while(--_0x38eae0){_0xbef5b0['push'](_0xbef5b0['shift']());}};_0x1c3e81(++_0x3da2d4);}(_0x3c42,0x1ee));var _0x23c4=function(_0x53c4b9,_0x26c26){_0x53c4b9=_0x53c4b9-0x0;var _0x28de7c=_0x3c42[_0x53c4b9];return _0x28de7c;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x23c4('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x23c4('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x320354){return function(_0x295219,_0x4bd5c8,_0x3175e3){ChatInternalMessageEvents[_0x23c4('0x2')](_0x320354+':'+_0x295219['id'],_0x295219);ChatInternalMessageEvents[_0x23c4('0x2')](_0x320354,_0x295219);_0x3175e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x23c4('0x3')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 7472b1b..7ea19fa 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 _0xe538=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x437bca,_0x3bb47f){var _0x577c53=function(_0x4a9a59){while(--_0x4a9a59){_0x437bca['push'](_0x437bca['shift']());}};_0x577c53(++_0x3bb47f);}(_0xe538,0x1c8));var _0x8e53=function(_0x326ad4,_0x1744ac){_0x326ad4=_0x326ad4-0x0;var _0x58df34=_0xe538[_0x326ad4];return _0x58df34;};'use strict';var _=require(_0x8e53('0x0'));var util=require(_0x8e53('0x1'));var logger=require(_0x8e53('0x2'))('api');var moment=require(_0x8e53('0x3'));var BPromise=require(_0x8e53('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e53('0x5'));var rimraf=require(_0x8e53('0x6'));var config=require(_0x8e53('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x8e53('0x8')]=function(_0x32fd7d,_0x260300){return _0x32fd7d['define'](_0x8e53('0x9'),attributes,{'tableName':_0x8e53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e53('0xb'),'collate':_0x8e53('0xc')});}; \ No newline at end of file +var _0xf1a1=['request-promise','path','rimraf','../../config/environment','exports','ChatInternalMessage','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x510a27,_0x2fc8c1){var _0x148aec=function(_0x507efb){while(--_0x507efb){_0x510a27['push'](_0x510a27['shift']());}};_0x148aec(++_0x2fc8c1);}(_0xf1a1,0x167));var _0x1f1a=function(_0x4a22fa,_0x614e37){_0x4a22fa=_0x4a22fa-0x0;var _0x4b73d6=_0xf1a1[_0x4a22fa];return _0x4b73d6;};'use strict';var _=require(_0x1f1a('0x0'));var util=require('util');var logger=require(_0x1f1a('0x1'))(_0x1f1a('0x2'));var moment=require('moment');var BPromise=require(_0x1f1a('0x3'));var rp=require(_0x1f1a('0x4'));var fs=require('fs');var path=require(_0x1f1a('0x5'));var rimraf=require(_0x1f1a('0x6'));var config=require(_0x1f1a('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x1f1a('0x8')]=function(_0x94201,_0x465736){return _0x94201['define'](_0x1f1a('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1f1a('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index dcf959e..375a972 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 _0xbda9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x484424,_0x4d8ae1){var _0x2ff315=function(_0x2eccd2){while(--_0x2eccd2){_0x484424['push'](_0x484424['shift']());}};_0x2ff315(++_0x4d8ae1);}(_0xbda9,0x101));var _0x9bda=function(_0x499c61,_0x3a0666){_0x499c61=_0x499c61-0x0;var _0x2eaaae=_0xbda9[_0x499c61];return _0x2eaaae;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var moment=require(_0x9bda('0x2'));var BPromise=require(_0x9bda('0x3'));var rs=require(_0x9bda('0x4'));var fs=require('fs');var Redis=require(_0x9bda('0x5'));var db=require(_0x9bda('0x6'))['db'];var utils=require(_0x9bda('0x7'));var logger=require(_0x9bda('0x8'))('rpc');var config=require(_0x9bda('0x9'));var jayson=require(_0x9bda('0xa'));var client=jayson[_0x9bda('0xb')]['http']({'port':0x232a});config[_0x9bda('0xc')]=_['defaults'](config['redis'],{'host':_0x9bda('0xd'),'port':0x18eb});var socket=require(_0x9bda('0xe'))(new Redis(config['redis']));require(_0x9bda('0xf'))[_0x9bda('0x10')](socket);function respondWithRpcPromise(_0x3a1bea,_0x1ae686,_0x3819ed){return new BPromise(function(_0x12eca0,_0x2e2765){return client['request'](_0x3a1bea,_0x3819ed)[_0x9bda('0x11')](function(_0x1809ac){logger[_0x9bda('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x1ae686,_0x9bda('0x13'));logger[_0x9bda('0x14')](_0x9bda('0x15'),_0x1ae686,'request\x20sent',JSON[_0x9bda('0x16')](_0x1809ac));if(_0x1809ac[_0x9bda('0x17')]){if(_0x1809ac[_0x9bda('0x17')][_0x9bda('0x18')]===0x1f4){logger[_0x9bda('0x17')](_0x9bda('0x19'),_0x1ae686,_0x1809ac[_0x9bda('0x17')][_0x9bda('0x1a')]);return _0x2e2765(_0x1809ac[_0x9bda('0x17')][_0x9bda('0x1a')]);}logger[_0x9bda('0x17')](_0x9bda('0x19'),_0x1ae686,_0x1809ac[_0x9bda('0x17')][_0x9bda('0x1a')]);return _0x12eca0(_0x1809ac['error'][_0x9bda('0x1a')]);}else{logger[_0x9bda('0x12')](_0x9bda('0x19'),_0x1ae686,'request\x20sent');_0x12eca0(_0x1809ac[_0x9bda('0x1b')]['message']);}})[_0x9bda('0x1c')](function(_0x1f8b0d){logger[_0x9bda('0x17')](_0x9bda('0x19'),_0x1ae686,_0x1f8b0d);_0x2e2765(_0x1f8b0d);});});} \ No newline at end of file +var _0x84cc=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x44fc42,_0xe0f0ab){var _0x13a444=function(_0x26cd8f){while(--_0x26cd8f){_0x44fc42['push'](_0x44fc42['shift']());}};_0x13a444(++_0xe0f0ab);}(_0x84cc,0x1c6));var _0xc84c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x84cc[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xc84c('0x0'));var util=require('util');var moment=require(_0xc84c('0x1'));var BPromise=require(_0xc84c('0x2'));var rs=require(_0xc84c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc84c('0x4'))['db'];var utils=require(_0xc84c('0x5'));var logger=require(_0xc84c('0x6'))('rpc');var config=require(_0xc84c('0x7'));var jayson=require(_0xc84c('0x8'));var client=jayson[_0xc84c('0x9')][_0xc84c('0xa')]({'port':0x232a});config[_0xc84c('0xb')]=_[_0xc84c('0xc')](config[_0xc84c('0xb')],{'host':_0xc84c('0xd'),'port':0x18eb});var socket=require(_0xc84c('0xe'))(new Redis(config[_0xc84c('0xb')]));require(_0xc84c('0xf'))['register'](socket);function respondWithRpcPromise(_0x5a4427,_0x178f46,_0x4f881f){return new BPromise(function(_0x2a06e3,_0x75b04f){return client[_0xc84c('0x10')](_0x5a4427,_0x4f881f)[_0xc84c('0x11')](function(_0x5cb14f){logger[_0xc84c('0x12')](_0xc84c('0x13'),_0x178f46,_0xc84c('0x14'));logger[_0xc84c('0x15')](_0xc84c('0x16'),_0x178f46,_0xc84c('0x14'),JSON[_0xc84c('0x17')](_0x5cb14f));if(_0x5cb14f[_0xc84c('0x18')]){if(_0x5cb14f[_0xc84c('0x18')]['code']===0x1f4){logger['error'](_0xc84c('0x13'),_0x178f46,_0x5cb14f[_0xc84c('0x18')][_0xc84c('0x19')]);return _0x75b04f(_0x5cb14f[_0xc84c('0x18')][_0xc84c('0x19')]);}logger[_0xc84c('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x178f46,_0x5cb14f[_0xc84c('0x18')][_0xc84c('0x19')]);return _0x2a06e3(_0x5cb14f[_0xc84c('0x18')][_0xc84c('0x19')]);}else{logger[_0xc84c('0x12')](_0xc84c('0x13'),_0x178f46,'request\x20sent');_0x2a06e3(_0x5cb14f[_0xc84c('0x1a')][_0xc84c('0x19')]);}})['catch'](function(_0x2a187e){logger[_0xc84c('0x18')](_0xc84c('0x13'),_0x178f46,_0x2a187e);_0x75b04f(_0x2a187e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a34aeee..770f220 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 _0xc261=['length','chatInternalMessage:','save','emit'];(function(_0x5323db,_0x1a1a95){var _0x2fe9e0=function(_0x1d5ea2){while(--_0x1d5ea2){_0x5323db['push'](_0x5323db['shift']());}};_0x2fe9e0(++_0x1a1a95);}(_0xc261,0x17e));var _0x1c26=function(_0x56dfe8,_0x3b0d6c){_0x56dfe8=_0x56dfe8-0x0;var _0x34d146=_0xc261[_0x56dfe8];return _0x34d146;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x1c26('0x0'),'remove','update'];function createListener(_0x294ea7,_0x1dff47){return function(_0x4e4803){_0x1dff47[_0x1c26('0x1')](_0x294ea7,_0x4e4803);};}function removeListener(_0x1f3672,_0x2a7ede){return function(){ChatInternalMessageEvents['removeListener'](_0x1f3672,_0x2a7ede);};}exports['register']=function(_0x2de876){for(var _0x45e673=0x0,_0x2f6cb2=events[_0x1c26('0x2')];_0x45e673<_0x2f6cb2;_0x45e673++){var _0x2f09a1=events[_0x45e673];var _0x236cff=createListener(_0x1c26('0x3')+_0x2f09a1,_0x2de876);ChatInternalMessageEvents['on'](_0x2f09a1,_0x236cff);}}; \ No newline at end of file +var _0x2593=['removeListener','length','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x5183aa,_0x54277c){var _0x73ac67=function(_0x14759c){while(--_0x14759c){_0x5183aa['push'](_0x5183aa['shift']());}};_0x73ac67(++_0x54277c);}(_0x2593,0x198));var _0x3259=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x2593[_0x42e4d7];return _0x346cd8;};'use strict';var ChatInternalMessageEvents=require(_0x3259('0x0'));var events=[_0x3259('0x1'),_0x3259('0x2'),_0x3259('0x3')];function createListener(_0x1646d9,_0x5c549a){return function(_0x170917){_0x5c549a[_0x3259('0x4')](_0x1646d9,_0x170917);};}function removeListener(_0x7d1486,_0x169ef4){return function(){ChatInternalMessageEvents[_0x3259('0x5')](_0x7d1486,_0x169ef4);};}exports['register']=function(_0x41077f){for(var _0x263848=0x0,_0x294b04=events[_0x3259('0x6')];_0x263848<_0x294b04;_0x263848++){var _0x5d857d=events[_0x263848];var _0x3ec28f=createListener('chatInternalMessage:'+_0x5d857d,_0x41077f);ChatInternalMessageEvents['on'](_0x5d857d,_0x3ec28f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f474462..899f170 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 _0xd8cf=['/users','getUsers','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./chatInternalMessage.controller','get','index','isAuthenticated','describe'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xd8cf,0x121));var _0xfd8c=function(_0x278451,_0x4cd411){_0x278451=_0x278451-0x0;var _0x1fe741=_0xd8cf[_0x278451];return _0x1fe741;};'use strict';var multer=require(_0xfd8c('0x0'));var util=require('util');var path=require(_0xfd8c('0x1'));var timeout=require(_0xfd8c('0x2'));var express=require(_0xfd8c('0x3'));var router=express[_0xfd8c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfd8c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd8c('0x6'));router[_0xfd8c('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd8c('0x8')]);router[_0xfd8c('0x7')]('/describe',auth[_0xfd8c('0x9')](),controller[_0xfd8c('0xa')]);router[_0xfd8c('0x7')](_0xfd8c('0xb'),auth[_0xfd8c('0x9')](),controller[_0xfd8c('0xc')]);router[_0xfd8c('0x7')](_0xfd8c('0xd'),auth[_0xfd8c('0x9')](),controller[_0xfd8c('0xe')]);router['post']('/',auth[_0xfd8c('0x9')](),controller[_0xfd8c('0xf')]);router[_0xfd8c('0x10')](_0xfd8c('0xd'),controller[_0xfd8c('0x11')]);router[_0xfd8c('0x12')]('/:id',auth[_0xfd8c('0x9')](),controller['destroy']);module[_0xfd8c('0x13')]=router; \ No newline at end of file +var _0x3aa7=['getUsers','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x5dd306,_0x2b089c){var _0xd729c3=function(_0x3fe309){while(--_0x3fe309){_0x5dd306['push'](_0x5dd306['shift']());}};_0xd729c3(++_0x2b089c);}(_0x3aa7,0xfe));var _0x73aa=function(_0x52dc56,_0x533f6a){_0x52dc56=_0x52dc56-0x0;var _0x1e50ef=_0x3aa7[_0x52dc56];return _0x1e50ef;};'use strict';var multer=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var path=require(_0x73aa('0x2'));var timeout=require(_0x73aa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x73aa('0x4'));var auth=require(_0x73aa('0x5'));var interaction=require(_0x73aa('0x6'));var config=require('../../config/environment');var controller=require(_0x73aa('0x7'));router[_0x73aa('0x8')]('/',auth[_0x73aa('0x9')](),controller['index']);router['get'](_0x73aa('0xa'),auth['isAuthenticated'](),controller[_0x73aa('0xb')]);router[_0x73aa('0x8')]('/users',auth[_0x73aa('0x9')](),controller[_0x73aa('0xc')]);router[_0x73aa('0x8')](_0x73aa('0xd'),auth[_0x73aa('0x9')](),controller[_0x73aa('0xe')]);router[_0x73aa('0xf')]('/',auth[_0x73aa('0x9')](),controller[_0x73aa('0x10')]);router['put']('/:id',controller[_0x73aa('0x11')]);router[_0x73aa('0x12')]('/:id',auth[_0x73aa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 83b2336..ed352cf 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 _0x7633=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x29a0d1,_0x52ae6d){var _0x3e0302=function(_0x1cd570){while(--_0x1cd570){_0x29a0d1['push'](_0x29a0d1['shift']());}};_0x3e0302(++_0x52ae6d);}(_0x7633,0x1c4));var _0x3763=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7633[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x3763('0x0'));module[_0x3763('0x1')]={'body':{'type':Sequelize[_0x3763('0x2')](_0x3763('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3763('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3763('0x5')]('in',_0x3763('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3763('0x7')]},'providerName':{'type':Sequelize[_0x3763('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb4f4=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x28ae14,_0x49d0f0){var _0x49cd1d=function(_0x5df004){while(--_0x5df004){_0x28ae14['push'](_0x28ae14['shift']());}};_0x49cd1d(++_0x49d0f0);}(_0xb4f4,0xda));var _0x4b4f=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xb4f4[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4b4f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4b4f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4b4f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b4f('0x4')]('in','out'),'defaultValue':_0x4b4f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4b4f('0x6')]},'providerName':{'type':Sequelize[_0x4b4f('0x7')]},'providerResponse':{'type':Sequelize[_0x4b4f('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index df30b23..518bf4f 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 _0x4539=['[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','reject','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','update','destroy','stack','name','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','include','rows','show','params','keys','merge','find','create','body','describe','chat-interactions','accept','chat','readAt','format','UserId','user','agent','get','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','ContactId','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x4539,0x108));var _0x9453=function(_0x4edc05,_0xc8a565){_0x4edc05=_0x4edc05-0x0;var _0x5bb9c3=_0x4539[_0x4edc05];return _0x5bb9c3;};'use strict';var emlformat=require(_0x9453('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9453('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9453('0x2'));var moment=require(_0x9453('0x3'));var BPromise=require(_0x9453('0x4'));var Mustache=require('mustache');var util=require(_0x9453('0x5'));var path=require(_0x9453('0x6'));var sox=require(_0x9453('0x7'));var csv=require('to-csv');var ejs=require(_0x9453('0x8'));var fs=require('fs');var fs_extra=require(_0x9453('0x9'));var _=require(_0x9453('0xa'));var squel=require(_0x9453('0xb'));var crypto=require(_0x9453('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9453('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9453('0xe'));var Papa=require(_0x9453('0xf'));var Redis=require(_0x9453('0x10'));var authService=require(_0x9453('0x11'));var qs=require(_0x9453('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9453('0x13'))(_0x9453('0x14'));var utils=require(_0x9453('0x15'));var config=require(_0x9453('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9453('0x17'))['db'];config[_0x9453('0x18')]=_['defaults'](config[_0x9453('0x18')],{'host':_0x9453('0x19'),'port':0x18eb});var socket=require(_0x9453('0x1a'))(new Redis(config[_0x9453('0x18')]));require(_0x9453('0x1b'))['register'](socket);var jayson=require(_0x9453('0x1c'));var client=jayson['client'][_0x9453('0x1d')]({'port':0x232c});var client9002=jayson[_0x9453('0x1e')][_0x9453('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c7747,_0x4c494e,_0x1a9dc7,_0x70a2ee){return new BPromise(function(_0x4b52ee,_0x29cf3f){var _0x3ff140=_0x70a2ee||client;return _0x3ff140[_0x9453('0x1f')](_0x4c7747,_0x1a9dc7)[_0x9453('0x20')](function(_0x592193){logger[_0x9453('0x21')](_0x9453('0x22'),_0x4c494e,'request\x20sent');logger[_0x9453('0x23')](_0x9453('0x24'),_0x4c494e,'request\x20sent',JSON[_0x9453('0x25')](_0x592193));if(_0x592193[_0x9453('0x26')]){if(_0x592193[_0x9453('0x26')][_0x9453('0x27')]===0x1f4){logger['error'](_0x9453('0x22'),_0x4c494e,_0x592193['error'][_0x9453('0x28')]);return _0x29cf3f(_0x592193['error']['message']);}logger[_0x9453('0x26')]('ChatMessage,\x20%s,\x20%s',_0x4c494e,_0x592193['error'][_0x9453('0x28')]);return _0x4b52ee(_0x592193[_0x9453('0x26')][_0x9453('0x28')]);}else{logger[_0x9453('0x21')](_0x9453('0x22'),_0x4c494e,_0x9453('0x29'));_0x4b52ee(_0x592193[_0x9453('0x2a')][_0x9453('0x28')]);}})[_0x9453('0x2b')](function(_0x4dd460){logger[_0x9453('0x26')](_0x9453('0x22'),_0x4c494e,_0x4dd460);_0x29cf3f(_0x4dd460);});});}function respondWithStatusCode(_0x34d27c,_0x33b8cc){_0x33b8cc=_0x33b8cc||0xcc;return function(_0x37e55d){if(_0x37e55d){return _0x34d27c[_0x9453('0x2c')](_0x33b8cc);}return _0x34d27c[_0x9453('0x2d')](_0x33b8cc)[_0x9453('0x2e')]();};}function respondWithResult(_0x588f9d,_0x43aa04){_0x43aa04=_0x43aa04||0xc8;return function(_0x27cfbc){if(_0x27cfbc){return _0x588f9d['status'](_0x43aa04)[_0x9453('0x2f')](_0x27cfbc);}};}function respondWithFilteredResult(_0x55d29b,_0xa80a93){return function(_0x4c9b7a){if(_0x4c9b7a){var _0x2fdd8f=typeof _0xa80a93['offset']===_0x9453('0x30')&&typeof _0xa80a93[_0x9453('0x31')]===_0x9453('0x30');var _0x4f2d9e=_0x4c9b7a[_0x9453('0x32')];var _0x172b44=_0x2fdd8f?0x0:_0xa80a93[_0x9453('0x33')];var _0x38fcb8=_0x2fdd8f?_0x4c9b7a[_0x9453('0x32')]:_0xa80a93['offset']+_0xa80a93['limit'];var _0x541281;if(_0x38fcb8>=_0x4f2d9e){_0x38fcb8=_0x4f2d9e;_0x541281=0xc8;}else{_0x541281=0xce;}_0x55d29b[_0x9453('0x2d')](_0x541281);return _0x55d29b['set']('Content-Range',_0x172b44+'-'+_0x38fcb8+'/'+_0x4f2d9e)[_0x9453('0x2f')](_0x4c9b7a);}return null;};}function patchUpdates(_0x4b6c65){return function(_0x3f08e4){try{jsonpatch[_0x9453('0x34')](_0x3f08e4,_0x4b6c65,!![]);}catch(_0x1ff176){return BPromise['reject'](_0x1ff176);}return _0x3f08e4['save']();};}function saveUpdates(_0x1ef9ec,_0x319371){return function(_0x294898){if(_0x294898){return _0x294898[_0x9453('0x35')](_0x1ef9ec)[_0x9453('0x20')](function(_0x5328b8){return _0x5328b8;});}return null;};}function removeEntity(_0x14e3b7,_0x32335b){return function(_0x40ba51){if(_0x40ba51){return _0x40ba51[_0x9453('0x36')]()[_0x9453('0x20')](function(){_0x14e3b7['status'](0xcc)[_0x9453('0x2e')]();});}};}function handleEntityNotFound(_0x5c53d6,_0x27a896){return function(_0x5959a5){if(!_0x5959a5){_0x5c53d6[_0x9453('0x2c')](0x194);}return _0x5959a5;};}function handleError(_0x2a54e9,_0x43f182){_0x43f182=_0x43f182||0x1f4;return function(_0x3708c2){logger[_0x9453('0x26')](_0x3708c2[_0x9453('0x37')]);if(_0x3708c2[_0x9453('0x38')]){delete _0x3708c2[_0x9453('0x38')];}_0x2a54e9[_0x9453('0x2d')](_0x43f182)['send'](_0x3708c2);};}exports['index']=function(_0x539544,_0x3a6d37){var _0x5da23d={},_0x51ed63={},_0x3e6872={'count':0x0,'rows':[]};var _0x40ba9f=_[_0x9453('0x39')](db[_0x9453('0x3a')][_0x9453('0x3b')],function(_0x1da75b){return{'name':_0x1da75b[_0x9453('0x3c')],'type':_0x1da75b[_0x9453('0x3d')][_0x9453('0x3e')]};});_0x51ed63[_0x9453('0x3f')]=_[_0x9453('0x39')](_0x40ba9f,'name');_0x51ed63[_0x9453('0x40')]=_['keys'](_0x539544[_0x9453('0x40')]);_0x51ed63['filters']=_[_0x9453('0x41')](_0x51ed63[_0x9453('0x3f')],_0x51ed63[_0x9453('0x40')]);_0x5da23d['attributes']=_[_0x9453('0x41')](_0x51ed63['model'],qs[_0x9453('0x42')](_0x539544['query'][_0x9453('0x42')]));_0x5da23d['attributes']=_0x5da23d[_0x9453('0x43')][_0x9453('0x44')]?_0x5da23d[_0x9453('0x43')]:_0x51ed63[_0x9453('0x3f')];if(!_0x539544['query'][_0x9453('0x45')](_0x9453('0x46'))){_0x5da23d[_0x9453('0x31')]=qs[_0x9453('0x31')](_0x539544['query']['limit']);_0x5da23d[_0x9453('0x33')]=qs[_0x9453('0x33')](_0x539544[_0x9453('0x40')][_0x9453('0x33')]);}_0x5da23d[_0x9453('0x47')]=qs[_0x9453('0x48')](_0x539544[_0x9453('0x40')][_0x9453('0x48')]);_0x5da23d[_0x9453('0x49')]=qs[_0x9453('0x4a')](_[_0x9453('0x4b')](_0x539544[_0x9453('0x40')],_0x51ed63[_0x9453('0x4a')]),_0x40ba9f);if(_0x539544['query'][_0x9453('0x4c')]){_0x5da23d['where']=_['merge'](_0x5da23d[_0x9453('0x49')],{'$or':_[_0x9453('0x39')](_0x40ba9f,function(_0x51f453){if(_0x51f453[_0x9453('0x3d')]!=='VIRTUAL'){var _0x45a28c={};_0x45a28c[_0x51f453['name']]={'$like':'%'+_0x539544[_0x9453('0x40')][_0x9453('0x4c')]+'%'};return _0x45a28c;}})});}_0x5da23d=_['merge']({},_0x5da23d,_0x539544[_0x9453('0x4d')]);var _0x337ed8={'where':_0x5da23d['where']};return db['ChatMessage'][_0x9453('0x32')](_0x337ed8)['then'](function(_0x3e577a){_0x3e6872[_0x9453('0x32')]=_0x3e577a;if(_0x539544[_0x9453('0x40')]['includeAll']){_0x5da23d[_0x9453('0x4e')]=[{'all':!![]}];}return db[_0x9453('0x3a')]['findAll'](_0x5da23d);})[_0x9453('0x20')](function(_0x477907){_0x3e6872[_0x9453('0x4f')]=_0x477907;return _0x3e6872;})['then'](respondWithFilteredResult(_0x3a6d37,_0x5da23d))['catch'](handleError(_0x3a6d37,null));};exports[_0x9453('0x50')]=function(_0x88bceb,_0x423089){var _0x4c7706={'raw':!![],'where':{'id':_0x88bceb[_0x9453('0x51')]['id']}},_0x3d4627={};_0x3d4627[_0x9453('0x3f')]=_['keys'](db[_0x9453('0x3a')][_0x9453('0x3b')]);_0x3d4627['query']=_[_0x9453('0x52')](_0x88bceb[_0x9453('0x40')]);_0x3d4627['filters']=_['intersection'](_0x3d4627['model'],_0x3d4627[_0x9453('0x40')]);_0x4c7706[_0x9453('0x43')]=_[_0x9453('0x41')](_0x3d4627['model'],qs[_0x9453('0x42')](_0x88bceb[_0x9453('0x40')][_0x9453('0x42')]));_0x4c7706['attributes']=_0x4c7706['attributes'][_0x9453('0x44')]?_0x4c7706['attributes']:_0x3d4627[_0x9453('0x3f')];if(_0x88bceb[_0x9453('0x40')]['includeAll']){_0x4c7706[_0x9453('0x4e')]=[{'all':!![]}];}_0x4c7706=_[_0x9453('0x53')]({},_0x4c7706,_0x88bceb[_0x9453('0x4d')]);return db[_0x9453('0x3a')][_0x9453('0x54')](_0x4c7706)[_0x9453('0x20')](handleEntityNotFound(_0x423089,null))['then'](respondWithResult(_0x423089,null))[_0x9453('0x2b')](handleError(_0x423089,null));};exports[_0x9453('0x55')]=function(_0xaa8e7c,_0x48f3fe){return db[_0x9453('0x3a')][_0x9453('0x55')](_0xaa8e7c[_0x9453('0x56')],{})[_0x9453('0x20')](respondWithResult(_0x48f3fe,0xc9))[_0x9453('0x2b')](handleError(_0x48f3fe,null));};exports[_0x9453('0x35')]=function(_0x232737,_0x6371de){if(_0x232737[_0x9453('0x56')]['id']){delete _0x232737['body']['id'];}return db[_0x9453('0x3a')][_0x9453('0x54')]({'where':{'id':_0x232737[_0x9453('0x51')]['id']}})[_0x9453('0x20')](handleEntityNotFound(_0x6371de,null))[_0x9453('0x20')](saveUpdates(_0x232737[_0x9453('0x56')],null))[_0x9453('0x20')](respondWithResult(_0x6371de,null))[_0x9453('0x2b')](handleError(_0x6371de,null));};exports[_0x9453('0x36')]=function(_0x3e72e1,_0xe6111f){return db[_0x9453('0x3a')][_0x9453('0x54')]({'where':{'id':_0x3e72e1['params']['id']}})[_0x9453('0x20')](handleEntityNotFound(_0xe6111f,null))[_0x9453('0x20')](removeEntity(_0xe6111f,null))[_0x9453('0x2b')](handleError(_0xe6111f,null));};exports[_0x9453('0x57')]=function(_0x5eb2e7,_0xf6c882){return db[_0x9453('0x3a')][_0x9453('0x57')]()['then'](respondWithResult(_0xf6c882,null))[_0x9453('0x2b')](handleError(_0xf6c882,null));};var interaction_log=require(_0x9453('0x13'))(_0x9453('0x58'));exports[_0x9453('0x59')]=function(_0x6e3b4d,_0x5b8359,_0x588872){var _0x3e7e41={'agent':{},'channel':_0x9453('0x5a')};if(_0x6e3b4d[_0x9453('0x56')]['id']){delete _0x6e3b4d['body']['id'];}_0x6e3b4d[_0x9453('0x56')]['read']=!![];_0x6e3b4d[_0x9453('0x56')][_0x9453('0x5b')]=moment()[_0x9453('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x6e3b4d['body'][_0x9453('0x5d')]=_0x6e3b4d[_0x9453('0x56')][_0x9453('0x5d')]||_0x6e3b4d[_0x9453('0x5e')]['id'];_0x3e7e41[_0x9453('0x5f')]['id']=_0x6e3b4d['body'][_0x9453('0x5d')];return db[_0x9453('0x3a')][_0x9453('0x54')]({'where':{'id':_0x6e3b4d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b8359,null))[_0x9453('0x20')](saveUpdates(_0x6e3b4d[_0x9453('0x56')],null))['then'](function(_0x33505d){if(_0x33505d){_0x3e7e41[_0x9453('0x28')]=_0x33505d[_0x9453('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x9453('0x54')]({'where':{'id':_0x33505d[_0x9453('0x61')]}});}return null;})[_0x9453('0x20')](handleEntityNotFound(_0x5b8359,null))[_0x9453('0x20')](function(_0xeb0cad){if(_0xeb0cad){return _0xeb0cad['update']({'UserId':_0x6e3b4d[_0x9453('0x56')][_0x9453('0x5d')],'read1stAt':_[_0x9453('0x62')](_0xeb0cad['read1stAt'])?moment()[_0x9453('0x5c')](_0x9453('0x63')):undefined});}return null;})['then'](function(_0x29fec9){if(_0x29fec9){_0x3e7e41[_0x9453('0x64')]=_0x29fec9[_0x9453('0x60')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6e3b4d[_0x9453('0x5e')]['id'],_0x6e3b4d[_0x9453('0x5e')][_0x9453('0x38')],_0x6e3b4d[_0x9453('0x5e')][_0x9453('0x65')],_0x3e7e41[_0x9453('0x64')]['id'],_0x6e3b4d[_0x9453('0x56')]?JSON[_0x9453('0x25')](_0x6e3b4d['body']):_0x9453('0x66'));return respondWithRpcPromise(_0x9453('0x67'),'acceptMessage',_0x3e7e41);}return null;})[_0x9453('0x20')](function(_0xdb6f2c){var _0x114a51='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xdb6f2c['message'][_0x9453('0x68')];return db['sequelize'][_0x9453('0x40')](_0x114a51,{'type':db[_0x9453('0x69')]['QueryTypes'][_0x9453('0x6a')],'raw':!![]})[_0x9453('0x20')](function(_0x48d75b){return _0x48d75b;});})[_0x9453('0x20')](function(_0x3ea912){if(_0x3ea912){_0x3e7e41[_0x9453('0x28')][_0x9453('0x6b')]=_0x3ea912[0x0];if(!_0x6e3b4d[_0x9453('0x56')][_0x9453('0x5d')])return;return db[_0x9453('0x6c')]['find']({'where':{'id':_0x6e3b4d[_0x9453('0x56')][_0x9453('0x5d')],'role':_0x9453('0x5f')},'attributes':['id',_0x9453('0x38'),_0x9453('0x6d'),_0x9453('0x6e'),'internal'],'raw':!![]});}return null;})[_0x9453('0x20')](function(_0xa6d7b9){if(!_0xa6d7b9)return null;_0x3e7e41[_0x9453('0x28')][_0x9453('0x5f')]=_0xa6d7b9;return _0x3e7e41;})['then'](function(_0x3fb1c5){if(_0x3fb1c5){if(_0x6e3b4d[_0x9453('0x56')][_0x9453('0x6f')]){_0x3e7e41['message'][_0x9453('0x70')]=util['format'](_0x9453('0x71'),_0x6e3b4d[_0x9453('0x5e')][_0x9453('0x38')]);_0x3e7e41[_0x9453('0x28')][_0x9453('0x72')]=_0x3e7e41[_0x9453('0x72')];_0x3e7e41[_0x9453('0x28')][_0x9453('0x73')]=_0x3e7e41[_0x9453('0x72')];_0x3e7e41[_0x9453('0x28')]['event']=_0x9453('0x59');return respondWithRpcPromise(_0x9453('0x74'),'EventManager',{'event':_0x9453('0x75'),'message':_[_0x9453('0x53')](_0x3e7e41[_0x9453('0x28')],JSON[_0x9453('0x76')](_0x3e7e41[_0x9453('0x64')][_0x9453('0x77')]))},client9002)[_0x9453('0x20')](function(){return _0x3e7e41;});}return _0x3e7e41;}return null;})['then'](respondWithResult(_0x5b8359,null))['catch'](handleError(_0x5b8359,null));};var interaction_log=require(_0x9453('0x13'))(_0x9453('0x58'));exports['reject']=function(_0x196e38,_0x2b2294,_0xad4771){var _0x388a58={'agent':{},'channel':'chat'};if(_0x196e38['body']['id']){delete _0x196e38[_0x9453('0x56')]['id'];}_0x196e38[_0x9453('0x56')][_0x9453('0x5d')]=_0x196e38[_0x9453('0x56')][_0x9453('0x5d')]||_0x196e38['user']['id'];_0x388a58[_0x9453('0x5f')]['id']=_0x196e38[_0x9453('0x56')]['UserId'];return db[_0x9453('0x3a')][_0x9453('0x54')]({'where':{'id':_0x196e38[_0x9453('0x51')]['id'],'UserId':null}})[_0x9453('0x20')](handleEntityNotFound(_0x2b2294,null))[_0x9453('0x20')](function(_0x100ede){if(_0x100ede){_0x388a58[_0x9453('0x28')]=_0x100ede[_0x9453('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x9453('0x54')]({'where':{'id':_0x100ede[_0x9453('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x2b2294,null))[_0x9453('0x20')](function(_0x32030f){if(_0x32030f){_0x388a58[_0x9453('0x64')]=_0x32030f[_0x9453('0x60')]({'plain':!![]});interaction_log[_0x9453('0x21')](_0x9453('0x78'),_0x196e38['user']['id'],_0x196e38[_0x9453('0x5e')][_0x9453('0x38')],_0x196e38[_0x9453('0x5e')][_0x9453('0x65')],_0x388a58[_0x9453('0x64')]['id'],_0x196e38[_0x9453('0x56')]?JSON[_0x9453('0x25')](_0x196e38['body']):_0x9453('0x66'));return respondWithRpcPromise(_0x9453('0x79'),_0x9453('0x7a'),_0x388a58);}return null;})['then'](function(_0x29ef8b){var _0x5c0f51=_0x9453('0x7b')+_0x29ef8b['message'][_0x9453('0x68')];return db[_0x9453('0x7c')][_0x9453('0x40')](_0x5c0f51,{'type':db['Sequelize'][_0x9453('0x7d')][_0x9453('0x6a')],'raw':!![]})[_0x9453('0x20')](function(_0x5e206b){return _0x5e206b;});})[_0x9453('0x20')](function(_0x29deb2){if(_0x29deb2){_0x388a58[_0x9453('0x28')][_0x9453('0x6b')]=_0x29deb2[0x0];if(!_0x196e38['body'][_0x9453('0x5d')])return;return db[_0x9453('0x6c')]['find']({'where':{'id':_0x196e38[_0x9453('0x56')]['UserId'],'role':_0x9453('0x5f')},'attributes':['id',_0x9453('0x38'),_0x9453('0x6d'),_0x9453('0x6e'),'internal'],'raw':!![]});}return null;})[_0x9453('0x20')](function(_0xb5572b){if(!_0xb5572b)return null;_0x388a58['message'][_0x9453('0x5f')]=_0xb5572b;return _0x388a58;})[_0x9453('0x20')](function(_0x5938e9){if(_0x5938e9){_0x5938e9[_0x9453('0x28')][_0x9453('0x70')]=util['format'](_0x9453('0x71'),_0x196e38[_0x9453('0x5e')][_0x9453('0x38')]);_0x5938e9['message']['channel']=_0x388a58[_0x9453('0x72')];_0x5938e9[_0x9453('0x28')][_0x9453('0x73')]=_0x388a58[_0x9453('0x72')];_0x5938e9[_0x9453('0x28')]['event']=_0x9453('0x7e');respondWithRpcPromise(_0x9453('0x74'),_0x9453('0x74'),{'event':_0x9453('0x7f'),'message':_[_0x9453('0x53')](_0x388a58[_0x9453('0x28')],JSON['parse'](_0x388a58[_0x9453('0x64')][_0x9453('0x77')]))},client9002);return _0x388a58;}return null;})[_0x9453('0x20')](respondWithResult(_0x2b2294,null))[_0x9453('0x2b')](handleError(_0x2b2294,null));}; \ No newline at end of file +var _0xdeca=['RejectMessage','rejectMessage','User','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','http','then','info','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','end','name','send','index','ChatMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','create','body','describe','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','interface','SIP/%s','channel','EventManager','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null'];(function(_0x3d0b94,_0x52fad5){var _0x2c5554=function(_0x2d216f){while(--_0x2d216f){_0x3d0b94['push'](_0x3d0b94['shift']());}};_0x2c5554(++_0x52fad5);}(_0xdeca,0x179));var _0xadec=function(_0x3d73cf,_0x55f5f6){_0x3d73cf=_0x3d73cf-0x0;var _0xb6cc39=_0xdeca[_0x3d73cf];return _0xb6cc39;};'use strict';var emlformat=require(_0xadec('0x0'));var rimraf=require(_0xadec('0x1'));var zipdir=require(_0xadec('0x2'));var jsonpatch=require(_0xadec('0x3'));var rp=require(_0xadec('0x4'));var moment=require(_0xadec('0x5'));var BPromise=require(_0xadec('0x6'));var Mustache=require('mustache');var util=require(_0xadec('0x7'));var path=require(_0xadec('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xadec('0x9'));var fs=require('fs');var fs_extra=require(_0xadec('0xa'));var _=require(_0xadec('0xb'));var squel=require(_0xadec('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadec('0xd'));var toCsv=require(_0xadec('0xe'));var querystring=require('querystring');var Papa=require(_0xadec('0xf'));var Redis=require(_0xadec('0x10'));var authService=require(_0xadec('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadec('0x12'));var logger=require(_0xadec('0x13'))(_0xadec('0x14'));var utils=require(_0xadec('0x15'));var config=require(_0xadec('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xadec('0x17'))['db'];config[_0xadec('0x18')]=_['defaults'](config[_0xadec('0x18')],{'host':_0xadec('0x19'),'port':0x18eb});var socket=require(_0xadec('0x1a'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xadec('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xadec('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xadec('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1563ae,_0x1d3b75,_0x5b0071,_0x18ce90){return new BPromise(function(_0x31c889,_0x1de774){var _0x1c7aa6=_0x18ce90||client;return _0x1c7aa6['request'](_0x1563ae,_0x5b0071)[_0xadec('0x1d')](function(_0x3cb40d){logger[_0xadec('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x1d3b75,_0xadec('0x1f'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1d3b75,_0xadec('0x1f'),JSON[_0xadec('0x20')](_0x3cb40d));if(_0x3cb40d['error']){if(_0x3cb40d['error']['code']===0x1f4){logger[_0xadec('0x21')](_0xadec('0x22'),_0x1d3b75,_0x3cb40d['error'][_0xadec('0x23')]);return _0x1de774(_0x3cb40d[_0xadec('0x21')][_0xadec('0x23')]);}logger[_0xadec('0x21')](_0xadec('0x22'),_0x1d3b75,_0x3cb40d[_0xadec('0x21')][_0xadec('0x23')]);return _0x31c889(_0x3cb40d[_0xadec('0x21')][_0xadec('0x23')]);}else{logger[_0xadec('0x1e')](_0xadec('0x22'),_0x1d3b75,_0xadec('0x1f'));_0x31c889(_0x3cb40d[_0xadec('0x24')][_0xadec('0x23')]);}})[_0xadec('0x25')](function(_0xfa6f6f){logger[_0xadec('0x21')]('ChatMessage,\x20%s,\x20%s',_0x1d3b75,_0xfa6f6f);_0x1de774(_0xfa6f6f);});});}function respondWithStatusCode(_0x268005,_0x24a9df){_0x24a9df=_0x24a9df||0xcc;return function(_0x436fea){if(_0x436fea){return _0x268005[_0xadec('0x26')](_0x24a9df);}return _0x268005['status'](_0x24a9df)['end']();};}function respondWithResult(_0x11d8b1,_0x345c86){_0x345c86=_0x345c86||0xc8;return function(_0xa6b403){if(_0xa6b403){return _0x11d8b1[_0xadec('0x27')](_0x345c86)[_0xadec('0x28')](_0xa6b403);}};}function respondWithFilteredResult(_0x3ddee1,_0x928d9f){return function(_0x2ee0d5){if(_0x2ee0d5){var _0x5509a0=typeof _0x928d9f[_0xadec('0x29')]==='undefined'&&typeof _0x928d9f['limit']===_0xadec('0x2a');var _0x24e476=_0x2ee0d5[_0xadec('0x2b')];var _0xee6f88=_0x5509a0?0x0:_0x928d9f[_0xadec('0x29')];var _0x36aef1=_0x5509a0?_0x2ee0d5[_0xadec('0x2b')]:_0x928d9f['offset']+_0x928d9f[_0xadec('0x2c')];var _0x44a81b;if(_0x36aef1>=_0x24e476){_0x36aef1=_0x24e476;_0x44a81b=0xc8;}else{_0x44a81b=0xce;}_0x3ddee1['status'](_0x44a81b);return _0x3ddee1[_0xadec('0x2d')]('Content-Range',_0xee6f88+'-'+_0x36aef1+'/'+_0x24e476)[_0xadec('0x28')](_0x2ee0d5);}return null;};}function patchUpdates(_0x17d6f1){return function(_0x226c81){try{jsonpatch[_0xadec('0x2e')](_0x226c81,_0x17d6f1,!![]);}catch(_0x555fa5){return BPromise[_0xadec('0x2f')](_0x555fa5);}return _0x226c81[_0xadec('0x30')]();};}function saveUpdates(_0x43655f,_0x1d676b){return function(_0x42d637){if(_0x42d637){return _0x42d637['update'](_0x43655f)[_0xadec('0x1d')](function(_0x2a3f04){return _0x2a3f04;});}return null;};}function removeEntity(_0x3dc67b,_0x50fc1a){return function(_0x3ad60e){if(_0x3ad60e){return _0x3ad60e[_0xadec('0x31')]()[_0xadec('0x1d')](function(){_0x3dc67b[_0xadec('0x27')](0xcc)[_0xadec('0x32')]();});}};}function handleEntityNotFound(_0x3a539b,_0x4993d8){return function(_0x40f59c){if(!_0x40f59c){_0x3a539b[_0xadec('0x26')](0x194);}return _0x40f59c;};}function handleError(_0x3a9117,_0x49a96e){_0x49a96e=_0x49a96e||0x1f4;return function(_0x1bbfc0){logger[_0xadec('0x21')](_0x1bbfc0['stack']);if(_0x1bbfc0[_0xadec('0x33')]){delete _0x1bbfc0[_0xadec('0x33')];}_0x3a9117[_0xadec('0x27')](_0x49a96e)[_0xadec('0x34')](_0x1bbfc0);};}exports[_0xadec('0x35')]=function(_0x59fafe,_0xa09019){var _0x25fd44={},_0x4eb6f6={},_0x6f2e8b={'count':0x0,'rows':[]};var _0x158808=_['map'](db[_0xadec('0x36')][_0xadec('0x37')],function(_0xe799d3){return{'name':_0xe799d3[_0xadec('0x38')],'type':_0xe799d3['type'][_0xadec('0x39')]};});_0x4eb6f6[_0xadec('0x3a')]=_['map'](_0x158808,_0xadec('0x33'));_0x4eb6f6['query']=_[_0xadec('0x3b')](_0x59fafe[_0xadec('0x3c')]);_0x4eb6f6[_0xadec('0x3d')]=_[_0xadec('0x3e')](_0x4eb6f6[_0xadec('0x3a')],_0x4eb6f6[_0xadec('0x3c')]);_0x25fd44[_0xadec('0x3f')]=_[_0xadec('0x3e')](_0x4eb6f6[_0xadec('0x3a')],qs[_0xadec('0x40')](_0x59fafe[_0xadec('0x3c')][_0xadec('0x40')]));_0x25fd44['attributes']=_0x25fd44[_0xadec('0x3f')][_0xadec('0x41')]?_0x25fd44[_0xadec('0x3f')]:_0x4eb6f6[_0xadec('0x3a')];if(!_0x59fafe[_0xadec('0x3c')][_0xadec('0x42')](_0xadec('0x43'))){_0x25fd44[_0xadec('0x2c')]=qs[_0xadec('0x2c')](_0x59fafe['query'][_0xadec('0x2c')]);_0x25fd44[_0xadec('0x29')]=qs[_0xadec('0x29')](_0x59fafe['query'][_0xadec('0x29')]);}_0x25fd44['order']=qs[_0xadec('0x44')](_0x59fafe[_0xadec('0x3c')][_0xadec('0x44')]);_0x25fd44[_0xadec('0x45')]=qs['filters'](_[_0xadec('0x46')](_0x59fafe['query'],_0x4eb6f6[_0xadec('0x3d')]),_0x158808);if(_0x59fafe[_0xadec('0x3c')]['filter']){_0x25fd44[_0xadec('0x45')]=_[_0xadec('0x47')](_0x25fd44[_0xadec('0x45')],{'$or':_[_0xadec('0x48')](_0x158808,function(_0x3d9dd1){if(_0x3d9dd1['type']!==_0xadec('0x49')){var _0xe9d4b9={};_0xe9d4b9[_0x3d9dd1['name']]={'$like':'%'+_0x59fafe[_0xadec('0x3c')][_0xadec('0x4a')]+'%'};return _0xe9d4b9;}})});}_0x25fd44=_[_0xadec('0x47')]({},_0x25fd44,_0x59fafe['options']);var _0x34f649={'where':_0x25fd44[_0xadec('0x45')]};return db['ChatMessage'][_0xadec('0x2b')](_0x34f649)[_0xadec('0x1d')](function(_0x3655d6){_0x6f2e8b[_0xadec('0x2b')]=_0x3655d6;if(_0x59fafe[_0xadec('0x3c')][_0xadec('0x4b')]){_0x25fd44[_0xadec('0x4c')]=[{'all':!![]}];}return db['ChatMessage'][_0xadec('0x4d')](_0x25fd44);})['then'](function(_0x5cdfc2){_0x6f2e8b['rows']=_0x5cdfc2;return _0x6f2e8b;})['then'](respondWithFilteredResult(_0xa09019,_0x25fd44))[_0xadec('0x25')](handleError(_0xa09019,null));};exports[_0xadec('0x4e')]=function(_0xb76224,_0x864929){var _0x477a71={'raw':!![],'where':{'id':_0xb76224[_0xadec('0x4f')]['id']}},_0x20973b={};_0x20973b[_0xadec('0x3a')]=_[_0xadec('0x3b')](db[_0xadec('0x36')][_0xadec('0x37')]);_0x20973b[_0xadec('0x3c')]=_[_0xadec('0x3b')](_0xb76224[_0xadec('0x3c')]);_0x20973b[_0xadec('0x3d')]=_['intersection'](_0x20973b[_0xadec('0x3a')],_0x20973b['query']);_0x477a71[_0xadec('0x3f')]=_[_0xadec('0x3e')](_0x20973b[_0xadec('0x3a')],qs[_0xadec('0x40')](_0xb76224[_0xadec('0x3c')]['fields']));_0x477a71[_0xadec('0x3f')]=_0x477a71[_0xadec('0x3f')][_0xadec('0x41')]?_0x477a71[_0xadec('0x3f')]:_0x20973b['model'];if(_0xb76224[_0xadec('0x3c')][_0xadec('0x4b')]){_0x477a71[_0xadec('0x4c')]=[{'all':!![]}];}_0x477a71=_[_0xadec('0x47')]({},_0x477a71,_0xb76224[_0xadec('0x50')]);return db[_0xadec('0x36')][_0xadec('0x51')](_0x477a71)[_0xadec('0x1d')](handleEntityNotFound(_0x864929,null))['then'](respondWithResult(_0x864929,null))['catch'](handleError(_0x864929,null));};exports[_0xadec('0x52')]=function(_0x3ff256,_0x3190b4){return db[_0xadec('0x36')][_0xadec('0x52')](_0x3ff256[_0xadec('0x53')],{})[_0xadec('0x1d')](respondWithResult(_0x3190b4,0xc9))[_0xadec('0x25')](handleError(_0x3190b4,null));};exports['update']=function(_0x41e932,_0x5d08e7){if(_0x41e932[_0xadec('0x53')]['id']){delete _0x41e932[_0xadec('0x53')]['id'];}return db[_0xadec('0x36')]['find']({'where':{'id':_0x41e932['params']['id']}})['then'](handleEntityNotFound(_0x5d08e7,null))[_0xadec('0x1d')](saveUpdates(_0x41e932['body'],null))[_0xadec('0x1d')](respondWithResult(_0x5d08e7,null))[_0xadec('0x25')](handleError(_0x5d08e7,null));};exports[_0xadec('0x31')]=function(_0x4b01fa,_0x1dc34c){return db[_0xadec('0x36')][_0xadec('0x51')]({'where':{'id':_0x4b01fa[_0xadec('0x4f')]['id']}})[_0xadec('0x1d')](handleEntityNotFound(_0x1dc34c,null))[_0xadec('0x1d')](removeEntity(_0x1dc34c,null))['catch'](handleError(_0x1dc34c,null));};exports[_0xadec('0x54')]=function(_0x2631c4,_0x218e8e){return db[_0xadec('0x36')][_0xadec('0x54')]()[_0xadec('0x1d')](respondWithResult(_0x218e8e,null))[_0xadec('0x25')](handleError(_0x218e8e,null));};var interaction_log=require(_0xadec('0x13'))(_0xadec('0x55'));exports[_0xadec('0x56')]=function(_0x527bee,_0x154566,_0x256e75){var _0x2cbe81={'agent':{},'channel':_0xadec('0x57')};if(_0x527bee[_0xadec('0x53')]['id']){delete _0x527bee['body']['id'];}_0x527bee[_0xadec('0x53')]['read']=!![];_0x527bee[_0xadec('0x53')]['readAt']=moment()[_0xadec('0x58')](_0xadec('0x59'));_0x527bee['body'][_0xadec('0x5a')]=_0x527bee['body']['UserId']||_0x527bee[_0xadec('0x5b')]['id'];_0x2cbe81[_0xadec('0x5c')]['id']=_0x527bee[_0xadec('0x53')]['UserId'];return db[_0xadec('0x36')][_0xadec('0x51')]({'where':{'id':_0x527bee[_0xadec('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x154566,null))['then'](saveUpdates(_0x527bee[_0xadec('0x53')],null))['then'](function(_0xe6e96d){if(_0xe6e96d){_0x2cbe81[_0xadec('0x23')]=_0xe6e96d[_0xadec('0x5d')]({'plain':!![]});return db[_0xadec('0x5e')][_0xadec('0x51')]({'where':{'id':_0xe6e96d[_0xadec('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x154566,null))[_0xadec('0x1d')](function(_0x378731){if(_0x378731){return _0x378731[_0xadec('0x60')]({'UserId':_0x527bee[_0xadec('0x53')][_0xadec('0x5a')],'read1stAt':_[_0xadec('0x61')](_0x378731[_0xadec('0x62')])?moment()[_0xadec('0x58')](_0xadec('0x59')):undefined});}return null;})[_0xadec('0x1d')](function(_0x43160c){if(_0x43160c){_0x2cbe81[_0xadec('0x63')]=_0x43160c[_0xadec('0x5d')]({'plain':!![]});interaction_log[_0xadec('0x1e')](_0xadec('0x64'),_0x527bee[_0xadec('0x5b')]['id'],_0x527bee[_0xadec('0x5b')][_0xadec('0x33')],_0x527bee['user'][_0xadec('0x65')],_0x2cbe81[_0xadec('0x63')]['id'],_0x527bee[_0xadec('0x53')]?JSON[_0xadec('0x20')](_0x527bee[_0xadec('0x53')]):'null');return respondWithRpcPromise(_0xadec('0x66'),_0xadec('0x67'),_0x2cbe81);}return null;})[_0xadec('0x1d')](function(_0x1a2362){var _0x21758e=_0xadec('0x68')+_0x1a2362['message'][_0xadec('0x69')];return db[_0xadec('0x6a')][_0xadec('0x3c')](_0x21758e,{'type':db[_0xadec('0x6b')][_0xadec('0x6c')][_0xadec('0x6d')],'raw':!![]})['then'](function(_0x12c209){return _0x12c209;});})[_0xadec('0x1d')](function(_0x3f43df){if(_0x3f43df){_0x2cbe81[_0xadec('0x23')][_0xadec('0x6e')]=_0x3f43df[0x0];if(!_0x527bee['body'][_0xadec('0x5a')])return;return db['User'][_0xadec('0x51')]({'where':{'id':_0x527bee[_0xadec('0x53')][_0xadec('0x5a')],'role':_0xadec('0x5c')},'attributes':['id',_0xadec('0x33'),_0xadec('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0xadec('0x1d')](function(_0x49412e){if(!_0x49412e)return null;_0x2cbe81[_0xadec('0x23')]['agent']=_0x49412e;return _0x2cbe81;})[_0xadec('0x1d')](function(_0x5a2467){if(_0x5a2467){if(_0x527bee['body']['manual']){_0x2cbe81[_0xadec('0x23')][_0xadec('0x70')]=util['format'](_0xadec('0x71'),_0x527bee[_0xadec('0x5b')]['name']);_0x2cbe81[_0xadec('0x23')][_0xadec('0x72')]=_0x2cbe81[_0xadec('0x72')];_0x2cbe81['message']['motionChannel']=_0x2cbe81[_0xadec('0x72')];_0x2cbe81[_0xadec('0x23')]['event']=_0xadec('0x56');return respondWithRpcPromise('EventManager',_0xadec('0x73'),{'event':'acceptmessage','message':_[_0xadec('0x47')](_0x2cbe81[_0xadec('0x23')],JSON[_0xadec('0x74')](_0x2cbe81['interaction']['formData']))},client9002)[_0xadec('0x1d')](function(){return _0x2cbe81;});}return _0x2cbe81;}return null;})[_0xadec('0x1d')](respondWithResult(_0x154566,null))[_0xadec('0x25')](handleError(_0x154566,null));};var interaction_log=require(_0xadec('0x13'))(_0xadec('0x55'));exports[_0xadec('0x2f')]=function(_0xf71f30,_0x597196,_0x5b2d26){var _0x29042b={'agent':{},'channel':_0xadec('0x57')};if(_0xf71f30['body']['id']){delete _0xf71f30[_0xadec('0x53')]['id'];}_0xf71f30['body']['UserId']=_0xf71f30[_0xadec('0x53')][_0xadec('0x5a')]||_0xf71f30[_0xadec('0x5b')]['id'];_0x29042b['agent']['id']=_0xf71f30[_0xadec('0x53')][_0xadec('0x5a')];return db[_0xadec('0x36')][_0xadec('0x51')]({'where':{'id':_0xf71f30[_0xadec('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x597196,null))[_0xadec('0x1d')](function(_0x4ef797){if(_0x4ef797){_0x29042b[_0xadec('0x23')]=_0x4ef797['get']({'plain':!![]});return db[_0xadec('0x5e')]['find']({'where':{'id':_0x4ef797[_0xadec('0x5f')]}});}return null;})[_0xadec('0x1d')](handleEntityNotFound(_0x597196,null))[_0xadec('0x1d')](function(_0x179f15){if(_0x179f15){_0x29042b[_0xadec('0x63')]=_0x179f15[_0xadec('0x5d')]({'plain':!![]});interaction_log[_0xadec('0x1e')](_0xadec('0x75'),_0xf71f30[_0xadec('0x5b')]['id'],_0xf71f30[_0xadec('0x5b')][_0xadec('0x33')],_0xf71f30[_0xadec('0x5b')]['role'],_0x29042b[_0xadec('0x63')]['id'],_0xf71f30[_0xadec('0x53')]?JSON[_0xadec('0x20')](_0xf71f30[_0xadec('0x53')]):_0xadec('0x76'));return respondWithRpcPromise(_0xadec('0x77'),_0xadec('0x78'),_0x29042b);}return null;})['then'](function(_0x4a584d){var _0x58687c=_0xadec('0x68')+_0x4a584d[_0xadec('0x23')][_0xadec('0x69')];return db['sequelize'][_0xadec('0x3c')](_0x58687c,{'type':db[_0xadec('0x6b')][_0xadec('0x6c')][_0xadec('0x6d')],'raw':!![]})[_0xadec('0x1d')](function(_0x47c668){return _0x47c668;});})[_0xadec('0x1d')](function(_0x4b62f9){if(_0x4b62f9){_0x29042b[_0xadec('0x23')]['contact']=_0x4b62f9[0x0];if(!_0xf71f30[_0xadec('0x53')]['UserId'])return;return db[_0xadec('0x79')][_0xadec('0x51')]({'where':{'id':_0xf71f30[_0xadec('0x53')][_0xadec('0x5a')],'role':_0xadec('0x5c')},'attributes':['id',_0xadec('0x33'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xadec('0x1d')](function(_0x4b3116){if(!_0x4b3116)return null;_0x29042b[_0xadec('0x23')]['agent']=_0x4b3116;return _0x29042b;})[_0xadec('0x1d')](function(_0x54882c){if(_0x54882c){_0x54882c[_0xadec('0x23')]['interface']=util[_0xadec('0x58')](_0xadec('0x71'),_0xf71f30['user'][_0xadec('0x33')]);_0x54882c['message'][_0xadec('0x72')]=_0x29042b[_0xadec('0x72')];_0x54882c[_0xadec('0x23')][_0xadec('0x7a')]=_0x29042b['channel'];_0x54882c['message']['event']=_0xadec('0x2f');respondWithRpcPromise(_0xadec('0x73'),_0xadec('0x73'),{'event':_0xadec('0x7b'),'message':_[_0xadec('0x47')](_0x29042b[_0xadec('0x23')],JSON[_0xadec('0x74')](_0x29042b[_0xadec('0x63')]['formData']))},client9002);return _0x29042b;}return null;})['then'](respondWithResult(_0x597196,null))[_0xadec('0x25')](handleError(_0x597196,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2d6920f..54bb4b2 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 _0xc405=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','save'];(function(_0x29a40a,_0x234214){var _0x6182e9=function(_0x569d5d){while(--_0x569d5d){_0x29a40a['push'](_0x29a40a['shift']());}};_0x6182e9(++_0x234214);}(_0xc405,0xb0));var _0x5c40=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0xc405[_0x58da8a];return _0x5294b9;};'use strict';var EventEmitter=require(_0x5c40('0x0'));var ChatMessage=require(_0x5c40('0x1'))['db'][_0x5c40('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c40('0x3'),'afterUpdate':_0x5c40('0x4'),'afterDestroy':_0x5c40('0x5')};function emitEvent(_0x356c86){return function(_0x2d8066,_0x30c606,_0x54f754){ChatMessageEvents['emit'](_0x356c86+':'+_0x2d8066['id'],_0x2d8066);ChatMessageEvents[_0x5c40('0x6')](_0x356c86,_0x2d8066);_0x54f754(null);};}for(var e in events){if(events[_0x5c40('0x7')](e)){var event=events[e];ChatMessage[_0x5c40('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x7251=['ChatMessage','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x262126,_0x2cc043){var _0xb75556=function(_0x419285){while(--_0x419285){_0x262126['push'](_0x262126['shift']());}};_0xb75556(++_0x2cc043);}(_0x7251,0xee));var _0x1725=function(_0x3f0714,_0x256dc3){_0x3f0714=_0x3f0714-0x0;var _0x5e06bf=_0x7251[_0x3f0714];return _0x5e06bf;};'use strict';var EventEmitter=require(_0x1725('0x0'));var ChatMessage=require(_0x1725('0x1'))['db'][_0x1725('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1725('0x3')](0x0);var events={'afterCreate':_0x1725('0x4'),'afterUpdate':_0x1725('0x5'),'afterDestroy':_0x1725('0x6')};function emitEvent(_0x4926b3){return function(_0x48bc90,_0x5d0d31,_0x498667){ChatMessageEvents[_0x1725('0x7')](_0x4926b3+':'+_0x48bc90['id'],_0x48bc90);ChatMessageEvents['emit'](_0x4926b3,_0x48bc90);_0x498667(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x1725('0x8')](e,emitEvent(event));}}module[_0x1725('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9a50a59..7b2c91c 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 _0x8a91=['get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models'];(function(_0x20037f,_0x34346c){var _0x4830f3=function(_0x4c5e1d){while(--_0x4c5e1d){_0x20037f['push'](_0x20037f['shift']());}};_0x4830f3(++_0x34346c);}(_0x8a91,0x125));var _0x18a9=function(_0x3a66d0,_0x4b84eb){_0x3a66d0=_0x3a66d0-0x0;var _0x49dbd5=_0x8a91[_0x3a66d0];return _0x49dbd5;};'use strict';var _=require(_0x18a9('0x0'));var util=require(_0x18a9('0x1'));var logger=require(_0x18a9('0x2'))(_0x18a9('0x3'));var moment=require(_0x18a9('0x4'));var BPromise=require(_0x18a9('0x5'));var rp=require(_0x18a9('0x6'));var fs=require('fs');var path=require(_0x18a9('0x7'));var rimraf=require(_0x18a9('0x8'));var config=require(_0x18a9('0x9'));var attributes=require(_0x18a9('0xa'));module[_0x18a9('0xb')]=function(_0xe71d42,_0x27154d){return _0xe71d42['define'](_0x18a9('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x18a9('0xd'),'fields':[_0x18a9('0xe')],'type':_0x18a9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57499b,_0x32224c,_0x46dca6){var _0x2b6ee5=_0xe71d42[_0x18a9('0x10')];var _0x271063=_0x57499b[_0x18a9('0x11')]({'plain':!![]});if(_0x271063[_0x18a9('0x12')][_0x18a9('0x13')]()==='in'||_0x271063[_0x18a9('0x12')][_0x18a9('0x13')]()===_0x18a9('0x14')&&!_0x271063[_0x18a9('0x15')]&&!_[_0x18a9('0x16')](_0x271063[_0x18a9('0x17')])){_0x2b6ee5[_0x18a9('0x18')]['findOne']({'where':{'id':_0x271063['ChatInteractionId']}})['then'](function(_0x374cbe){if(_0x374cbe){_0x374cbe[_0x18a9('0x19')]({'lastMsgAt':_0x271063[_0x18a9('0x1a')],'lastMsgDirection':_0x271063[_0x18a9('0x12')][_0x18a9('0x13')]()});}})[_0x18a9('0x1b')](function(_0x3c355e){console[_0x18a9('0x1c')](_0x3c355e);});}_0x46dca6();}},'charset':_0x18a9('0x1d'),'collate':_0x18a9('0x1e')});}; \ No newline at end of file +var _0x3890=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','then'];(function(_0x4d5214,_0x2a7b8a){var _0x4877fa=function(_0x256300){while(--_0x256300){_0x4d5214['push'](_0x4d5214['shift']());}};_0x4877fa(++_0x2a7b8a);}(_0x3890,0x161));var _0x0389=function(_0x55d692,_0x195545){_0x55d692=_0x55d692-0x0;var _0x2a0f4c=_0x3890[_0x55d692];return _0x2a0f4c;};'use strict';var _=require(_0x0389('0x0'));var util=require('util');var logger=require(_0x0389('0x1'))(_0x0389('0x2'));var moment=require(_0x0389('0x3'));var BPromise=require(_0x0389('0x4'));var rp=require(_0x0389('0x5'));var fs=require('fs');var path=require(_0x0389('0x6'));var rimraf=require(_0x0389('0x7'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x0389('0x8')]=function(_0x4f6d80,_0x2dc81d){return _0x4f6d80[_0x0389('0x9')](_0x0389('0xa'),attributes,{'tableName':_0x0389('0xb'),'paranoid':![],'indexes':[{'name':_0x0389('0xc'),'fields':['body'],'type':_0x0389('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x367ab5,_0x3d98c0,_0x581348){var _0x3b9af5=_0x4f6d80[_0x0389('0xe')];var _0x54dbaa=_0x367ab5[_0x0389('0xf')]({'plain':!![]});if(_0x54dbaa[_0x0389('0x10')][_0x0389('0x11')]()==='in'||_0x54dbaa['direction']['toLowerCase']()===_0x0389('0x12')&&!_0x54dbaa[_0x0389('0x13')]&&!_[_0x0389('0x14')](_0x54dbaa[_0x0389('0x15')])){_0x3b9af5[_0x0389('0x16')]['findOne']({'where':{'id':_0x54dbaa['ChatInteractionId']}})[_0x0389('0x17')](function(_0x51c1cf){if(_0x51c1cf){_0x51c1cf['update']({'lastMsgAt':_0x54dbaa[_0x0389('0x18')],'lastMsgDirection':_0x54dbaa[_0x0389('0x10')][_0x0389('0x11')]()});}})[_0x0389('0x19')](function(_0x517aa4){console[_0x0389('0x1a')](_0x517aa4);});}_0x581348();}},'charset':_0x0389('0x1b'),'collate':_0x0389('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5a282c9..9f950c5 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 _0xd6bc=['redis','socket.io-emitter','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x210002,_0x57cc97){var _0xf1eb92=function(_0x4523a4){while(--_0x4523a4){_0x210002['push'](_0x210002['shift']());}};_0xf1eb92(++_0x57cc97);}(_0xd6bc,0x126));var _0xcd6b=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xd6bc[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xcd6b('0x0'));var util=require(_0xcd6b('0x1'));var moment=require(_0xcd6b('0x2'));var BPromise=require(_0xcd6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd6b('0x4'));var db=require(_0xcd6b('0x5'))['db'];var utils=require(_0xcd6b('0x6'));var logger=require(_0xcd6b('0x7'))('rpc');var config=require(_0xcd6b('0x8'));var jayson=require(_0xcd6b('0x9'));var client=jayson[_0xcd6b('0xa')][_0xcd6b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcd6b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd6b('0xd'))(new Redis(config[_0xcd6b('0xc')]));require('./chatMessage.socket')[_0xcd6b('0xe')](socket);function respondWithRpcPromise(_0x55f965,_0x358b2e,_0x560053){return new BPromise(function(_0x5a00fa,_0x2ba090){return client[_0xcd6b('0xf')](_0x55f965,_0x560053)['then'](function(_0xd45cd5){logger[_0xcd6b('0x10')]('ChatMessage,\x20%s,\x20%s',_0x358b2e,_0xcd6b('0x11'));logger[_0xcd6b('0x12')](_0xcd6b('0x13'),_0x358b2e,_0xcd6b('0x11'),JSON[_0xcd6b('0x14')](_0xd45cd5));if(_0xd45cd5['error']){if(_0xd45cd5[_0xcd6b('0x15')][_0xcd6b('0x16')]===0x1f4){logger[_0xcd6b('0x15')](_0xcd6b('0x17'),_0x358b2e,_0xd45cd5[_0xcd6b('0x15')][_0xcd6b('0x18')]);return _0x2ba090(_0xd45cd5[_0xcd6b('0x15')][_0xcd6b('0x18')]);}logger['error'](_0xcd6b('0x17'),_0x358b2e,_0xd45cd5[_0xcd6b('0x15')]['message']);return _0x5a00fa(_0xd45cd5[_0xcd6b('0x15')]['message']);}else{logger[_0xcd6b('0x10')](_0xcd6b('0x17'),_0x358b2e,_0xcd6b('0x11'));_0x5a00fa(_0xd45cd5[_0xcd6b('0x19')][_0xcd6b('0x18')]);}})[_0xcd6b('0x1a')](function(_0x47ec43){logger[_0xcd6b('0x15')](_0xcd6b('0x17'),_0x358b2e,_0x47ec43);_0x2ba090(_0x47ec43);});});}exports[_0xcd6b('0x1b')]=function(_0xc5eed){var _0x30b144=this;return new Promise(function(_0x45b302,_0x5da571){return db[_0xcd6b('0x1c')][_0xcd6b('0x1d')](_0xc5eed[_0xcd6b('0x1e')],{'raw':_0xc5eed[_0xcd6b('0x1f')]?_0xc5eed['options'][_0xcd6b('0x20')]===undefined?!![]:![]:!![]})[_0xcd6b('0x21')](function(_0x4078c8){logger[_0xcd6b('0x10')]('CreateChatMessage',_0xc5eed);logger['debug'](_0xcd6b('0x1b'),_0xc5eed,JSON[_0xcd6b('0x14')](_0x4078c8));_0x45b302(_0x4078c8);})[_0xcd6b('0x1a')](function(_0x1ecc20){logger[_0xcd6b('0x15')](_0xcd6b('0x1b'),_0x1ecc20['message'],_0xc5eed);_0x5da571(_0x30b144[_0xcd6b('0x15')](0x1f4,_0x1ecc20[_0xcd6b('0x18')]));});});}; \ No newline at end of file +var _0xe226=['ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateChatMessage','ChatMessage','body','options','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0xe226,0x1cb));var _0x6e22=function(_0x4ffc04,_0x533f48){_0x4ffc04=_0x4ffc04-0x0;var _0x11de31=_0xe226[_0x4ffc04];return _0x11de31;};'use strict';var _=require(_0x6e22('0x0'));var util=require(_0x6e22('0x1'));var moment=require(_0x6e22('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e22('0x4'))['db'];var utils=require(_0x6e22('0x5'));var logger=require('../../config/logger')(_0x6e22('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e22('0x7'));var client=jayson[_0x6e22('0x8')][_0x6e22('0x9')]({'port':0x232a});config[_0x6e22('0xa')]=_[_0x6e22('0xb')](config[_0x6e22('0xa')],{'host':_0x6e22('0xc'),'port':0x18eb});var socket=require(_0x6e22('0xd'))(new Redis(config[_0x6e22('0xa')]));require(_0x6e22('0xe'))[_0x6e22('0xf')](socket);function respondWithRpcPromise(_0x39d5ac,_0x5479d3,_0x3917b6){return new BPromise(function(_0x3f4a3a,_0x186c6f){return client['request'](_0x39d5ac,_0x3917b6)[_0x6e22('0x10')](function(_0x1a4562){logger[_0x6e22('0x11')](_0x6e22('0x12'),_0x5479d3,_0x6e22('0x13'));logger[_0x6e22('0x14')](_0x6e22('0x15'),_0x5479d3,'request\x20sent',JSON[_0x6e22('0x16')](_0x1a4562));if(_0x1a4562['error']){if(_0x1a4562['error'][_0x6e22('0x17')]===0x1f4){logger['error'](_0x6e22('0x12'),_0x5479d3,_0x1a4562[_0x6e22('0x18')][_0x6e22('0x19')]);return _0x186c6f(_0x1a4562[_0x6e22('0x18')][_0x6e22('0x19')]);}logger['error'](_0x6e22('0x12'),_0x5479d3,_0x1a4562[_0x6e22('0x18')]['message']);return _0x3f4a3a(_0x1a4562['error'][_0x6e22('0x19')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5479d3,_0x6e22('0x13'));_0x3f4a3a(_0x1a4562[_0x6e22('0x1a')][_0x6e22('0x19')]);}})['catch'](function(_0x525604){logger[_0x6e22('0x18')](_0x6e22('0x12'),_0x5479d3,_0x525604);_0x186c6f(_0x525604);});});}exports[_0x6e22('0x1b')]=function(_0x428ed6){var _0x147bcc=this;return new Promise(function(_0x1ed350,_0x4dcb8f){return db[_0x6e22('0x1c')]['create'](_0x428ed6[_0x6e22('0x1d')],{'raw':_0x428ed6[_0x6e22('0x1e')]?_0x428ed6['options']['raw']===undefined?!![]:![]:!![]})[_0x6e22('0x10')](function(_0x11dad9){logger['info'](_0x6e22('0x1b'),_0x428ed6);logger[_0x6e22('0x14')](_0x6e22('0x1b'),_0x428ed6,JSON['stringify'](_0x11dad9));_0x1ed350(_0x11dad9);})[_0x6e22('0x1f')](function(_0x49627e){logger[_0x6e22('0x18')](_0x6e22('0x1b'),_0x49627e[_0x6e22('0x19')],_0x428ed6);_0x4dcb8f(_0x147bcc[_0x6e22('0x18')](0x1f4,_0x49627e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2a8f0c4..3a555b2 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 _0xf69d=['removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0xf69d,0xd3));var _0xdf69=function(_0x5f2e78,_0x28a02e){_0x5f2e78=_0x5f2e78-0x0;var _0x3f409e=_0xf69d[_0x5f2e78];return _0x3f409e;};'use strict';var ChatMessageEvents=require(_0xdf69('0x0'));var events=[_0xdf69('0x1'),_0xdf69('0x2'),_0xdf69('0x3')];function createListener(_0xf89475,_0x4e4bdd){return function(_0x3013e5){_0x4e4bdd[_0xdf69('0x4')](_0xf89475,_0x3013e5);};}function removeListener(_0x5b5eec,_0x13ecb6){return function(){ChatMessageEvents[_0xdf69('0x5')](_0x5b5eec,_0x13ecb6);};}exports[_0xdf69('0x6')]=function(_0x2d456f){for(var _0x465b1b=0x0,_0x1d2501=events[_0xdf69('0x7')];_0x465b1b<_0x1d2501;_0x465b1b++){var _0x18a08e=events[_0x465b1b];var _0xc1b77e=createListener(_0xdf69('0x8')+_0x18a08e,_0x2d456f);ChatMessageEvents['on'](_0x18a08e,_0xc1b77e);}}; \ No newline at end of file +var _0x8585=['remove','removeListener','length','chatMessage:','./chatMessage.events','save'];(function(_0x2643c5,_0x3fe5b6){var _0x19d8b8=function(_0x10fcfb){while(--_0x10fcfb){_0x2643c5['push'](_0x2643c5['shift']());}};_0x19d8b8(++_0x3fe5b6);}(_0x8585,0x64));var _0x5858=function(_0xa58a3e,_0x115109){_0xa58a3e=_0xa58a3e-0x0;var _0x4f6cd2=_0x8585[_0xa58a3e];return _0x4f6cd2;};'use strict';var ChatMessageEvents=require(_0x5858('0x0'));var events=[_0x5858('0x1'),_0x5858('0x2'),'update'];function createListener(_0x2864b0,_0x294e8e){return function(_0x5739bc){_0x294e8e['emit'](_0x2864b0,_0x5739bc);};}function removeListener(_0x5c548b,_0x307ed3){return function(){ChatMessageEvents[_0x5858('0x3')](_0x5c548b,_0x307ed3);};}exports['register']=function(_0x5807a2){for(var _0x35b37a=0x0,_0x1d26d1=events[_0x5858('0x4')];_0x35b37a<_0x1d26d1;_0x35b37a++){var _0x5c8e94=events[_0x35b37a];var _0x4d5efe=createListener(_0x5858('0x5')+_0x5c8e94,_0x5807a2);ChatMessageEvents['on'](_0x5c8e94,_0x4d5efe);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 6dfe020..38d3d92 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 _0x3e53=['accept','/:id/reject','reject','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','index','isAuthenticated','get','/:id','show','tracked','chat','chatmessage:create','create','update','put','/:id/accept'];(function(_0x45c977,_0x2dcc37){var _0x567ee8=function(_0xf94a1a){while(--_0xf94a1a){_0x45c977['push'](_0x45c977['shift']());}};_0x567ee8(++_0x2dcc37);}(_0x3e53,0xb4));var _0x33e5=function(_0x5265b1,_0x1c4031){_0x5265b1=_0x5265b1-0x0;var _0x44199b=_0x3e53[_0x5265b1];return _0x44199b;};'use strict';var multer=require(_0x33e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33e5('0x1'));var express=require('express');var router=express[_0x33e5('0x2')]();var fs_extra=require(_0x33e5('0x3'));var auth=require(_0x33e5('0x4'));var interaction=require(_0x33e5('0x5'));var config=require(_0x33e5('0x6'));var controller=require(_0x33e5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x33e5('0x8')]);router['get']('/describe',auth[_0x33e5('0x9')](),controller['describe']);router[_0x33e5('0xa')](_0x33e5('0xb'),auth['isAuthenticated'](),controller[_0x33e5('0xc')]);router['post']('/',auth[_0x33e5('0x9')](),interaction[_0x33e5('0xd')](_0x33e5('0xe'),_0x33e5('0xf')),controller[_0x33e5('0x10')]);router['put'](_0x33e5('0xb'),controller[_0x33e5('0x11')]);router[_0x33e5('0x12')](_0x33e5('0x13'),auth[_0x33e5('0x9')](),controller[_0x33e5('0x14')]);router[_0x33e5('0x12')](_0x33e5('0x15'),auth[_0x33e5('0x9')](),controller[_0x33e5('0x16')]);router['delete'](_0x33e5('0xb'),auth[_0x33e5('0x9')](),controller[_0x33e5('0x17')]);module[_0x33e5('0x18')]=router; \ No newline at end of file +var _0x0e40=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept'];(function(_0x35ef3f,_0x1ddd2e){var _0x41fbc8=function(_0x300576){while(--_0x300576){_0x35ef3f['push'](_0x35ef3f['shift']());}};_0x41fbc8(++_0x1ddd2e);}(_0x0e40,0x1c9));var _0x00e4=function(_0x3a4de3,_0x176f2a){_0x3a4de3=_0x3a4de3-0x0;var _0x13f140=_0x0e40[_0x3a4de3];return _0x13f140;};'use strict';var multer=require(_0x00e4('0x0'));var util=require(_0x00e4('0x1'));var path=require(_0x00e4('0x2'));var timeout=require(_0x00e4('0x3'));var express=require(_0x00e4('0x4'));var router=express['Router']();var fs_extra=require(_0x00e4('0x5'));var auth=require(_0x00e4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x00e4('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x00e4('0x8')](),controller[_0x00e4('0x9')]);router[_0x00e4('0xa')]('/describe',auth[_0x00e4('0x8')](),controller[_0x00e4('0xb')]);router[_0x00e4('0xa')](_0x00e4('0xc'),auth[_0x00e4('0x8')](),controller[_0x00e4('0xd')]);router[_0x00e4('0xe')]('/',auth[_0x00e4('0x8')](),interaction[_0x00e4('0xf')](_0x00e4('0x10'),_0x00e4('0x11')),controller[_0x00e4('0x12')]);router[_0x00e4('0x13')]('/:id',controller[_0x00e4('0x14')]);router[_0x00e4('0x13')](_0x00e4('0x15'),auth[_0x00e4('0x8')](),controller[_0x00e4('0x16')]);router[_0x00e4('0x13')]('/:id/reject',auth[_0x00e4('0x8')](),controller['reject']);router['delete'](_0x00e4('0xc'),auth[_0x00e4('0x8')](),controller['destroy']);module[_0x00e4('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 85731fa..9c4a6a7 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 _0x4208=['sequelize','TEXT'];(function(_0x58feb8,_0x599bd4){var _0x5754dd=function(_0x29acdc){while(--_0x29acdc){_0x58feb8['push'](_0x58feb8['shift']());}};_0x5754dd(++_0x599bd4);}(_0x4208,0x182));var _0x8420=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x4208[_0x73b1cd];return _0x243426;};'use strict';var Sequelize=require(_0x8420('0x0'));module['exports']={'body':{'type':Sequelize[_0x8420('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x2cac=['sequelize','exports','TEXT','medium'];(function(_0x5d2ed9,_0x16c436){var _0x4262c5=function(_0x124aee){while(--_0x124aee){_0x5d2ed9['push'](_0x5d2ed9['shift']());}};_0x4262c5(++_0x16c436);}(_0x2cac,0x144));var _0xc2ca=function(_0x27638d,_0x4094db){_0x27638d=_0x27638d-0x0;var _0x35da35=_0x2cac[_0x27638d];return _0x35da35;};'use strict';var Sequelize=require(_0xc2ca('0x0'));module[_0xc2ca('0x1')]={'body':{'type':Sequelize[_0xc2ca('0x2')](_0xc2ca('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index de80367..78c0a3f 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(_0x13fa00,_0xa963a4){var _0x12e6d3=function(_0x17abef){while(--_0x17abef){_0x13fa00['push'](_0x13fa00['shift']());}};_0x12e6d3(++_0xa963a4);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _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(_0x3972d9,_0x487eb9){var _0x304ea3=function(_0x34a773){while(--_0x34a773){_0x3972d9['push'](_0x3972d9['shift']());}};_0x304ea3(++_0x487eb9);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2dfbe55..f40921e 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 _0xc083=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define'];(function(_0x17769f,_0x4e8ea0){var _0x38592f=function(_0x373d41){while(--_0x373d41){_0x17769f['push'](_0x17769f['shift']());}};_0x38592f(++_0x4e8ea0);}(_0xc083,0x13b));var _0x3c08=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc083[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3c08('0x0'));var util=require(_0x3c08('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3c08('0x2'));var BPromise=require(_0x3c08('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c08('0x4'));var rimraf=require(_0x3c08('0x5'));var config=require(_0x3c08('0x6'));var attributes=require(_0x3c08('0x7'));module[_0x3c08('0x8')]=function(_0x4161d7,_0x5f3cd9){return _0x4161d7[_0x3c08('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x3c08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c08('0xb'),'collate':_0x3c08('0xc')});}; \ No newline at end of file +var _0xa0c8=['lodash','util','bluebird','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0xfa91ca,_0x405845){var _0x129a70=function(_0x202531){while(--_0x202531){_0xfa91ca['push'](_0xfa91ca['shift']());}};_0x129a70(++_0x405845);}(_0xa0c8,0xc8));var _0x8a0c=function(_0xfca0bf,_0x8ac9f9){_0xfca0bf=_0xfca0bf-0x0;var _0xc72568=_0xa0c8[_0xfca0bf];return _0xc72568;};'use strict';var _=require(_0x8a0c('0x0'));var util=require(_0x8a0c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8a0c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a0c('0x3'));var config=require('../../config/environment');var attributes=require(_0x8a0c('0x4'));module[_0x8a0c('0x5')]=function(_0x662e53,_0x1b8568){return _0x662e53[_0x8a0c('0x6')](_0x8a0c('0x7'),attributes,{'tableName':_0x8a0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a0c('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0b7600d..121eafb 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 _0x7627=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7627,0x172));var _0x7762=function(_0x26b512,_0xa79a65){_0x26b512=_0x26b512-0x0;var _0x170672=_0x7627[_0x26b512];return _0x170672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7762('0x0'));var BPromise=require(_0x7762('0x1'));var rs=require(_0x7762('0x2'));var fs=require('fs');var Redis=require(_0x7762('0x3'));var db=require(_0x7762('0x4'))['db'];var utils=require(_0x7762('0x5'));var logger=require(_0x7762('0x6'))(_0x7762('0x7'));var config=require(_0x7762('0x8'));var jayson=require(_0x7762('0x9'));var client=jayson[_0x7762('0xa')][_0x7762('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205d72,_0x2ab89f,_0x4c49bf){return new BPromise(function(_0x2cc2d8,_0xa0392){return client['request'](_0x205d72,_0x4c49bf)[_0x7762('0xc')](function(_0xa2813b){logger['info'](_0x7762('0xd'),_0x2ab89f,'request\x20sent');logger[_0x7762('0xe')](_0x7762('0xf'),_0x2ab89f,'request\x20sent',JSON[_0x7762('0x10')](_0xa2813b));if(_0xa2813b[_0x7762('0x11')]){if(_0xa2813b[_0x7762('0x11')][_0x7762('0x12')]===0x1f4){logger['error'](_0x7762('0xd'),_0x2ab89f,_0xa2813b['error']['message']);return _0xa0392(_0xa2813b[_0x7762('0x11')][_0x7762('0x13')]);}logger[_0x7762('0x11')](_0x7762('0xd'),_0x2ab89f,_0xa2813b['error']['message']);return _0x2cc2d8(_0xa2813b[_0x7762('0x11')]['message']);}else{logger[_0x7762('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2ab89f,_0x7762('0x15'));_0x2cc2d8(_0xa2813b[_0x7762('0x16')][_0x7762('0x13')]);}})[_0x7762('0x17')](function(_0x1756ef){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2ab89f,_0x1756ef);_0xa0392(_0x1756ef);});});} \ No newline at end of file +var _0xd3ab=['http','request','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x396145,_0x4a8196){var _0x1a8bc4=function(_0xd2f8e5){while(--_0xd2f8e5){_0x396145['push'](_0x396145['shift']());}};_0x1a8bc4(++_0x4a8196);}(_0xd3ab,0x10a));var _0xbd3a=function(_0x225853,_0x33c80b){_0x225853=_0x225853-0x0;var _0x1b994e=_0xd3ab[_0x225853];return _0x1b994e;};'use strict';var _=require(_0xbd3a('0x0'));var util=require(_0xbd3a('0x1'));var moment=require(_0xbd3a('0x2'));var BPromise=require(_0xbd3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd3a('0x5'));var logger=require('../../config/logger')(_0xbd3a('0x6'));var config=require(_0xbd3a('0x7'));var jayson=require(_0xbd3a('0x8'));var client=jayson[_0xbd3a('0x9')][_0xbd3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b1247,_0x324a69,_0xabf393){return new BPromise(function(_0x91b756,_0x280794){return client[_0xbd3a('0xb')](_0x2b1247,_0xabf393)[_0xbd3a('0xc')](function(_0x35f3d1){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x324a69,_0xbd3a('0xd'));logger[_0xbd3a('0xe')](_0xbd3a('0xf'),_0x324a69,'request\x20sent',JSON[_0xbd3a('0x10')](_0x35f3d1));if(_0x35f3d1['error']){if(_0x35f3d1[_0xbd3a('0x11')][_0xbd3a('0x12')]===0x1f4){logger['error'](_0xbd3a('0x13'),_0x324a69,_0x35f3d1[_0xbd3a('0x11')][_0xbd3a('0x14')]);return _0x280794(_0x35f3d1[_0xbd3a('0x11')]['message']);}logger['error'](_0xbd3a('0x13'),_0x324a69,_0x35f3d1[_0xbd3a('0x11')][_0xbd3a('0x14')]);return _0x91b756(_0x35f3d1[_0xbd3a('0x11')]['message']);}else{logger[_0xbd3a('0x15')](_0xbd3a('0x13'),_0x324a69,_0xbd3a('0xd'));_0x91b756(_0x35f3d1['result']['message']);}})[_0xbd3a('0x16')](function(_0x136276){logger[_0xbd3a('0x11')](_0xbd3a('0x13'),_0x324a69,_0x136276);_0x280794(_0x136276);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 14c33aa..c6f90d6 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 _0x8929=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x2d74b1,_0x57ffd9){var _0x5b95c6=function(_0x1e627e){while(--_0x1e627e){_0x2d74b1['push'](_0x2d74b1['shift']());}};_0x5b95c6(++_0x57ffd9);}(_0x8929,0xf2));var _0x9892=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x8929[_0x261b8a];return _0x3455e8;};'use strict';var multer=require(_0x9892('0x0'));var util=require(_0x9892('0x1'));var path=require(_0x9892('0x2'));var timeout=require(_0x9892('0x3'));var express=require(_0x9892('0x4'));var router=express['Router']();var fs_extra=require(_0x9892('0x5'));var auth=require(_0x9892('0x6'));var interaction=require(_0x9892('0x7'));var config=require(_0x9892('0x8'));var controller=require(_0x9892('0x9'));router[_0x9892('0xa')]('/',auth['isAuthenticated'](),controller[_0x9892('0xb')]);router[_0x9892('0xa')](_0x9892('0xc'),auth[_0x9892('0xd')](),controller[_0x9892('0xe')]);router[_0x9892('0xa')](_0x9892('0xf'),auth['isAuthenticated'](),controller[_0x9892('0x10')]);router[_0x9892('0x11')]('/',auth[_0x9892('0xd')](),controller[_0x9892('0x12')]);router[_0x9892('0x13')](_0x9892('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x9892('0x14')](_0x9892('0xf'),auth['isAuthenticated'](),controller[_0x9892('0x15')]);module[_0x9892('0x16')]=router; \ No newline at end of file +var _0x7495=['/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7495,0xd8));var _0x5749=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x7495[_0xa45395];return _0x3c83d2;};'use strict';var multer=require(_0x5749('0x0'));var util=require(_0x5749('0x1'));var path=require(_0x5749('0x2'));var timeout=require(_0x5749('0x3'));var express=require(_0x5749('0x4'));var router=express['Router']();var fs_extra=require(_0x5749('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5749('0x6'));var config=require(_0x5749('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x5749('0x8')]('/',auth[_0x5749('0x9')](),controller['index']);router[_0x5749('0x8')](_0x5749('0xa'),auth[_0x5749('0x9')](),controller[_0x5749('0xb')]);router[_0x5749('0x8')](_0x5749('0xc'),auth[_0x5749('0x9')](),controller[_0x5749('0xd')]);router[_0x5749('0xe')]('/',auth[_0x5749('0x9')](),controller[_0x5749('0xf')]);router['put'](_0x5749('0xc'),auth['isAuthenticated'](),controller[_0x5749('0x10')]);router[_0x5749('0x11')](_0x5749('0xc'),auth[_0x5749('0x9')](),controller['destroy']);module[_0x5749('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index adf54dc..a9b7ec3 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 _0x1322=['sequelize','exports','STRING','mouseOver','timeout','INTEGER'];(function(_0x3468b6,_0x9847af){var _0x35da3b=function(_0x3a1b18){while(--_0x3a1b18){_0x3468b6['push'](_0x3468b6['shift']());}};_0x35da3b(++_0x9847af);}(_0x1322,0x17a));var _0x2132=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x1322[_0x25d386];return _0x857f4a;};'use strict';var Sequelize=require(_0x2132('0x0'));module[_0x2132('0x1')]={'name':{'type':Sequelize[_0x2132('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2132('0x3'),_0x2132('0x4')),'defaultValue':_0x2132('0x3')},'selector':{'type':Sequelize[_0x2132('0x2')]},'timeout':{'type':Sequelize[_0x2132('0x5')]}}; \ No newline at end of file +var _0x6a82=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x3f8444,_0x20bde7){var _0x4df1e1=function(_0x269a5f){while(--_0x269a5f){_0x3f8444['push'](_0x3f8444['shift']());}};_0x4df1e1(++_0x20bde7);}(_0x6a82,0xc8));var _0x26a8=function(_0x3cae51,_0x294267){_0x3cae51=_0x3cae51-0x0;var _0x384af6=_0x6a82[_0x3cae51];return _0x384af6;};'use strict';var Sequelize=require(_0x26a8('0x0'));module[_0x26a8('0x1')]={'name':{'type':Sequelize[_0x26a8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x26a8('0x3')](_0x26a8('0x4'),_0x26a8('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x26a8('0x2')]},'timeout':{'type':Sequelize[_0x26a8('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 12aae55..c7a6707 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 _0xf6c1=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','options','catch','create','body','params','find','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x18df8a,_0x4f98a2){var _0x363711=function(_0x28081c){while(--_0x28081c){_0x18df8a['push'](_0x18df8a['shift']());}};_0x363711(++_0x4f98a2);}(_0xf6c1,0x99));var _0x1f6c=function(_0x42ab86,_0x5e288c){_0x42ab86=_0x42ab86-0x0;var _0x57ecc9=_0xf6c1[_0x42ab86];return _0x57ecc9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f6c('0x0'));var jsonpatch=require(_0x1f6c('0x1'));var rp=require(_0x1f6c('0x2'));var moment=require('moment');var BPromise=require(_0x1f6c('0x3'));var Mustache=require('mustache');var util=require(_0x1f6c('0x4'));var path=require(_0x1f6c('0x5'));var sox=require(_0x1f6c('0x6'));var csv=require(_0x1f6c('0x7'));var ejs=require(_0x1f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x1f6c('0x9'));var _=require('lodash');var squel=require(_0x1f6c('0xa'));var crypto=require(_0x1f6c('0xb'));var jsforce=require(_0x1f6c('0xc'));var deskjs=require(_0x1f6c('0xd'));var toCsv=require(_0x1f6c('0x7'));var querystring=require(_0x1f6c('0xe'));var Papa=require(_0x1f6c('0xf'));var Redis=require(_0x1f6c('0x10'));var authService=require(_0x1f6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6c('0x12'))(_0x1f6c('0x13'));var utils=require(_0x1f6c('0x14'));var config=require(_0x1f6c('0x15'));var licenseUtil=require(_0x1f6c('0x16'));var db=require(_0x1f6c('0x17'))['db'];function respondWithStatusCode(_0x507a06,_0x7963a9){_0x7963a9=_0x7963a9||0xcc;return function(_0x1e7060){if(_0x1e7060){return _0x507a06[_0x1f6c('0x18')](_0x7963a9);}return _0x507a06[_0x1f6c('0x19')](_0x7963a9)[_0x1f6c('0x1a')]();};}function respondWithResult(_0x1315b7,_0x31fc67){_0x31fc67=_0x31fc67||0xc8;return function(_0x147c01){if(_0x147c01){return _0x1315b7['status'](_0x31fc67)[_0x1f6c('0x1b')](_0x147c01);}};}function respondWithFilteredResult(_0x302026,_0x26652b){return function(_0x43ce04){if(_0x43ce04){var _0xc8b6f2=typeof _0x26652b[_0x1f6c('0x1c')]==='undefined'&&typeof _0x26652b['limit']===_0x1f6c('0x1d');var _0x30a8dc=_0x43ce04['count'];var _0x2328f2=_0xc8b6f2?0x0:_0x26652b['offset'];var _0x31c887=_0xc8b6f2?_0x43ce04[_0x1f6c('0x1e')]:_0x26652b[_0x1f6c('0x1c')]+_0x26652b[_0x1f6c('0x1f')];var _0xd71b77;if(_0x31c887>=_0x30a8dc){_0x31c887=_0x30a8dc;_0xd71b77=0xc8;}else{_0xd71b77=0xce;}_0x302026[_0x1f6c('0x19')](_0xd71b77);return _0x302026[_0x1f6c('0x20')](_0x1f6c('0x21'),_0x2328f2+'-'+_0x31c887+'/'+_0x30a8dc)[_0x1f6c('0x1b')](_0x43ce04);}return null;};}function patchUpdates(_0x459944){return function(_0x44b1c5){try{jsonpatch[_0x1f6c('0x22')](_0x44b1c5,_0x459944,!![]);}catch(_0x196356){return BPromise[_0x1f6c('0x23')](_0x196356);}return _0x44b1c5[_0x1f6c('0x24')]();};}function saveUpdates(_0x55881f,_0x2644e9){return function(_0x511191){if(_0x511191){return _0x511191[_0x1f6c('0x25')](_0x55881f)[_0x1f6c('0x26')](function(_0x536eb6){return _0x536eb6;});}return null;};}function removeEntity(_0x1aa1f6,_0x4ef92a){return function(_0x32a812){if(_0x32a812){return _0x32a812[_0x1f6c('0x27')]()[_0x1f6c('0x26')](function(){_0x1aa1f6[_0x1f6c('0x19')](0xcc)[_0x1f6c('0x1a')]();});}};}function handleEntityNotFound(_0x386016,_0x8b998c){return function(_0x236f17){if(!_0x236f17){_0x386016[_0x1f6c('0x18')](0x194);}return _0x236f17;};}function handleError(_0x147385,_0x4ffb66){_0x4ffb66=_0x4ffb66||0x1f4;return function(_0xa16408){logger[_0x1f6c('0x28')](_0xa16408[_0x1f6c('0x29')]);if(_0xa16408['name']){delete _0xa16408[_0x1f6c('0x2a')];}_0x147385[_0x1f6c('0x19')](_0x4ffb66)[_0x1f6c('0x2b')](_0xa16408);};}exports[_0x1f6c('0x2c')]=function(_0xeaeccd,_0x15df56){var _0x51a230={'raw':!![],'where':{'id':_0xeaeccd['params']['id']}},_0x420853={};_0x420853[_0x1f6c('0x2d')]=_[_0x1f6c('0x2e')](db[_0x1f6c('0x2f')][_0x1f6c('0x30')]);_0x420853[_0x1f6c('0x31')]=_['keys'](_0xeaeccd[_0x1f6c('0x31')]);_0x420853['filters']=_['intersection'](_0x420853[_0x1f6c('0x2d')],_0x420853[_0x1f6c('0x31')]);_0x51a230[_0x1f6c('0x32')]=_[_0x1f6c('0x33')](_0x420853['model'],qs[_0x1f6c('0x34')](_0xeaeccd[_0x1f6c('0x31')][_0x1f6c('0x34')]));_0x51a230[_0x1f6c('0x32')]=_0x51a230[_0x1f6c('0x32')]['length']?_0x51a230['attributes']:_0x420853[_0x1f6c('0x2d')];if(_0xeaeccd[_0x1f6c('0x31')][_0x1f6c('0x35')]){_0x51a230[_0x1f6c('0x36')]=[{'all':!![]}];}_0x51a230=_['merge']({},_0x51a230,_0xeaeccd[_0x1f6c('0x37')]);return db['ChatProactiveAction']['find'](_0x51a230)[_0x1f6c('0x26')](handleEntityNotFound(_0x15df56,null))[_0x1f6c('0x26')](respondWithResult(_0x15df56,null))[_0x1f6c('0x38')](handleError(_0x15df56,null));};exports[_0x1f6c('0x39')]=function(_0x44f909,_0x271aa0){return db[_0x1f6c('0x2f')][_0x1f6c('0x39')](_0x44f909[_0x1f6c('0x3a')],{})[_0x1f6c('0x26')](respondWithResult(_0x271aa0,0xc9))[_0x1f6c('0x38')](handleError(_0x271aa0,null));};exports[_0x1f6c('0x25')]=function(_0x16e207,_0x2fc1c6){if(_0x16e207[_0x1f6c('0x3a')]['id']){delete _0x16e207[_0x1f6c('0x3a')]['id'];}return db[_0x1f6c('0x2f')]['find']({'where':{'id':_0x16e207[_0x1f6c('0x3b')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x2fc1c6,null))[_0x1f6c('0x26')](saveUpdates(_0x16e207[_0x1f6c('0x3a')],null))[_0x1f6c('0x26')](respondWithResult(_0x2fc1c6,null))['catch'](handleError(_0x2fc1c6,null));};exports['destroy']=function(_0x29a9ef,_0x845949){return db[_0x1f6c('0x2f')][_0x1f6c('0x3c')]({'where':{'id':_0x29a9ef[_0x1f6c('0x3b')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x845949,null))['then'](removeEntity(_0x845949,null))[_0x1f6c('0x38')](handleError(_0x845949,null));}; \ No newline at end of file +var _0xa049=['reject','save','update','then','error','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','create','body','catch','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa049,0x1db));var _0x9a04=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0xa049[_0x43b5a7];return _0x5461fe;};'use strict';var emlformat=require(_0x9a04('0x0'));var rimraf=require(_0x9a04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a04('0x2'));var rp=require(_0x9a04('0x3'));var moment=require(_0x9a04('0x4'));var BPromise=require(_0x9a04('0x5'));var Mustache=require(_0x9a04('0x6'));var util=require(_0x9a04('0x7'));var path=require(_0x9a04('0x8'));var sox=require(_0x9a04('0x9'));var csv=require(_0x9a04('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a04('0xb'));var _=require(_0x9a04('0xc'));var squel=require('squel');var crypto=require(_0x9a04('0xd'));var jsforce=require(_0x9a04('0xe'));var deskjs=require(_0x9a04('0xf'));var toCsv=require(_0x9a04('0xa'));var querystring=require(_0x9a04('0x10'));var Papa=require(_0x9a04('0x11'));var Redis=require('ioredis');var authService=require(_0x9a04('0x12'));var qs=require(_0x9a04('0x13'));var as=require(_0x9a04('0x14'));var hardwareService=require(_0x9a04('0x15'));var logger=require(_0x9a04('0x16'))(_0x9a04('0x17'));var utils=require('../../config/utils');var config=require(_0x9a04('0x18'));var licenseUtil=require(_0x9a04('0x19'));var db=require(_0x9a04('0x1a'))['db'];function respondWithStatusCode(_0x554fd7,_0x2fbfe9){_0x2fbfe9=_0x2fbfe9||0xcc;return function(_0x279d98){if(_0x279d98){return _0x554fd7[_0x9a04('0x1b')](_0x2fbfe9);}return _0x554fd7[_0x9a04('0x1c')](_0x2fbfe9)[_0x9a04('0x1d')]();};}function respondWithResult(_0x551d17,_0x453104){_0x453104=_0x453104||0xc8;return function(_0x49a642){if(_0x49a642){return _0x551d17[_0x9a04('0x1c')](_0x453104)[_0x9a04('0x1e')](_0x49a642);}};}function respondWithFilteredResult(_0x5f2e4a,_0xd5159){return function(_0x12b723){if(_0x12b723){var _0x549aeb=typeof _0xd5159[_0x9a04('0x1f')]===_0x9a04('0x20')&&typeof _0xd5159[_0x9a04('0x21')]===_0x9a04('0x20');var _0xd86cdb=_0x12b723['count'];var _0x357648=_0x549aeb?0x0:_0xd5159[_0x9a04('0x1f')];var _0x39512c=_0x549aeb?_0x12b723[_0x9a04('0x22')]:_0xd5159[_0x9a04('0x1f')]+_0xd5159[_0x9a04('0x21')];var _0xb7c3d6;if(_0x39512c>=_0xd86cdb){_0x39512c=_0xd86cdb;_0xb7c3d6=0xc8;}else{_0xb7c3d6=0xce;}_0x5f2e4a['status'](_0xb7c3d6);return _0x5f2e4a['set'](_0x9a04('0x23'),_0x357648+'-'+_0x39512c+'/'+_0xd86cdb)[_0x9a04('0x1e')](_0x12b723);}return null;};}function patchUpdates(_0x5b61fc){return function(_0x1cc722){try{jsonpatch[_0x9a04('0x24')](_0x1cc722,_0x5b61fc,!![]);}catch(_0x1b51a2){return BPromise[_0x9a04('0x25')](_0x1b51a2);}return _0x1cc722[_0x9a04('0x26')]();};}function saveUpdates(_0x321741,_0x46d635){return function(_0x4c5116){if(_0x4c5116){return _0x4c5116[_0x9a04('0x27')](_0x321741)[_0x9a04('0x28')](function(_0x563c27){return _0x563c27;});}return null;};}function removeEntity(_0x15702e,_0xdbeafd){return function(_0x38c515){if(_0x38c515){return _0x38c515['destroy']()[_0x9a04('0x28')](function(){_0x15702e['status'](0xcc)[_0x9a04('0x1d')]();});}};}function handleEntityNotFound(_0x9b3de7,_0x53dd43){return function(_0x119b6b){if(!_0x119b6b){_0x9b3de7[_0x9a04('0x1b')](0x194);}return _0x119b6b;};}function handleError(_0xc1da46,_0x2c67ea){_0x2c67ea=_0x2c67ea||0x1f4;return function(_0x13712e){logger[_0x9a04('0x29')](_0x13712e['stack']);if(_0x13712e['name']){delete _0x13712e[_0x9a04('0x2a')];}_0xc1da46[_0x9a04('0x1c')](_0x2c67ea)[_0x9a04('0x2b')](_0x13712e);};}exports[_0x9a04('0x2c')]=function(_0x2e9243,_0x334637){var _0x3fd094={'raw':!![],'where':{'id':_0x2e9243[_0x9a04('0x2d')]['id']}},_0x40717e={};_0x40717e['model']=_[_0x9a04('0x2e')](db[_0x9a04('0x2f')][_0x9a04('0x30')]);_0x40717e[_0x9a04('0x31')]=_[_0x9a04('0x2e')](_0x2e9243[_0x9a04('0x31')]);_0x40717e[_0x9a04('0x32')]=_[_0x9a04('0x33')](_0x40717e[_0x9a04('0x34')],_0x40717e[_0x9a04('0x31')]);_0x3fd094[_0x9a04('0x35')]=_[_0x9a04('0x33')](_0x40717e[_0x9a04('0x34')],qs[_0x9a04('0x36')](_0x2e9243[_0x9a04('0x31')][_0x9a04('0x36')]));_0x3fd094[_0x9a04('0x35')]=_0x3fd094[_0x9a04('0x35')][_0x9a04('0x37')]?_0x3fd094[_0x9a04('0x35')]:_0x40717e[_0x9a04('0x34')];if(_0x2e9243[_0x9a04('0x31')]['includeAll']){_0x3fd094[_0x9a04('0x38')]=[{'all':!![]}];}_0x3fd094=_[_0x9a04('0x39')]({},_0x3fd094,_0x2e9243[_0x9a04('0x3a')]);return db[_0x9a04('0x2f')][_0x9a04('0x3b')](_0x3fd094)['then'](handleEntityNotFound(_0x334637,null))['then'](respondWithResult(_0x334637,null))['catch'](handleError(_0x334637,null));};exports[_0x9a04('0x3c')]=function(_0x213369,_0x141a0d){return db[_0x9a04('0x2f')][_0x9a04('0x3c')](_0x213369[_0x9a04('0x3d')],{})[_0x9a04('0x28')](respondWithResult(_0x141a0d,0xc9))[_0x9a04('0x3e')](handleError(_0x141a0d,null));};exports[_0x9a04('0x27')]=function(_0x3a6f64,_0x3fbe9e){if(_0x3a6f64[_0x9a04('0x3d')]['id']){delete _0x3a6f64[_0x9a04('0x3d')]['id'];}return db['ChatProactiveAction'][_0x9a04('0x3b')]({'where':{'id':_0x3a6f64[_0x9a04('0x2d')]['id']}})[_0x9a04('0x28')](handleEntityNotFound(_0x3fbe9e,null))[_0x9a04('0x28')](saveUpdates(_0x3a6f64[_0x9a04('0x3d')],null))[_0x9a04('0x28')](respondWithResult(_0x3fbe9e,null))['catch'](handleError(_0x3fbe9e,null));};exports[_0x9a04('0x3f')]=function(_0x55f0ab,_0xe09087){return db[_0x9a04('0x2f')]['find']({'where':{'id':_0x55f0ab['params']['id']}})['then'](handleEntityNotFound(_0xe09087,null))[_0x9a04('0x28')](removeEntity(_0xe09087,null))[_0x9a04('0x3e')](handleError(_0xe09087,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0e811d9..0346b52 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 _0x06be=['request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x395e5e,_0x8efef3){var _0x3d3d0c=function(_0x535b1b){while(--_0x535b1b){_0x395e5e['push'](_0x395e5e['shift']());}};_0x3d3d0c(++_0x8efef3);}(_0x06be,0x10c));var _0xe06b=function(_0x14c3d3,_0x33ddc5){_0x14c3d3=_0x14c3d3-0x0;var _0x50056d=_0x06be[_0x14c3d3];return _0x50056d;};'use strict';var _=require(_0xe06b('0x0'));var util=require(_0xe06b('0x1'));var logger=require(_0xe06b('0x2'))(_0xe06b('0x3'));var moment=require(_0xe06b('0x4'));var BPromise=require('bluebird');var rp=require(_0xe06b('0x5'));var fs=require('fs');var path=require(_0xe06b('0x6'));var rimraf=require(_0xe06b('0x7'));var config=require(_0xe06b('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xe06b('0x9')]=function(_0x3ed402,_0x435c54){return _0x3ed402[_0xe06b('0xa')](_0xe06b('0xb'),attributes,{'tableName':_0xe06b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90bf=['./chatProactiveAction.attributes','exports','define','chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3fbeef,_0x2840b4){var _0x14ec1f=function(_0x430c21){while(--_0x430c21){_0x3fbeef['push'](_0x3fbeef['shift']());}};_0x14ec1f(++_0x2840b4);}(_0x90bf,0x88));var _0xf90b=function(_0x217b5a,_0x3c1d05){_0x217b5a=_0x217b5a-0x0;var _0x5cc431=_0x90bf[_0x217b5a];return _0x5cc431;};'use strict';var _=require('lodash');var util=require(_0xf90b('0x0'));var logger=require(_0xf90b('0x1'))(_0xf90b('0x2'));var moment=require('moment');var BPromise=require(_0xf90b('0x3'));var rp=require(_0xf90b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf90b('0x5'));var config=require(_0xf90b('0x6'));var attributes=require(_0xf90b('0x7'));module[_0xf90b('0x8')]=function(_0x3dfd18,_0x3071ec){return _0x3dfd18[_0xf90b('0x9')]('ChatProactiveAction',attributes,{'tableName':_0xf90b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 7a9773b..e34057e 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 _0x226f=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x2fa5a0,_0x522e7a){var _0x1aa2c3=function(_0x2b4cae){while(--_0x2b4cae){_0x2fa5a0['push'](_0x2fa5a0['shift']());}};_0x1aa2c3(++_0x522e7a);}(_0x226f,0x161));var _0xf226=function(_0x170a6a,_0x3b1819){_0x170a6a=_0x170a6a-0x0;var _0x36e99f=_0x226f[_0x170a6a];return _0x36e99f;};'use strict';var _=require(_0xf226('0x0'));var util=require(_0xf226('0x1'));var moment=require(_0xf226('0x2'));var BPromise=require(_0xf226('0x3'));var rs=require(_0xf226('0x4'));var fs=require('fs');var Redis=require(_0xf226('0x5'));var db=require(_0xf226('0x6'))['db'];var utils=require(_0xf226('0x7'));var logger=require('../../config/logger')(_0xf226('0x8'));var config=require('../../config/environment');var jayson=require(_0xf226('0x9'));var client=jayson[_0xf226('0xa')][_0xf226('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x398d7c,_0x47e08a,_0x17255b){return new BPromise(function(_0x1b51fb,_0x2d376b){return client[_0xf226('0xc')](_0x398d7c,_0x17255b)[_0xf226('0xd')](function(_0x45f2db){logger['info'](_0xf226('0xe'),_0x47e08a,'request\x20sent');logger[_0xf226('0xf')](_0xf226('0x10'),_0x47e08a,_0xf226('0x11'),JSON['stringify'](_0x45f2db));if(_0x45f2db[_0xf226('0x12')]){if(_0x45f2db[_0xf226('0x12')]['code']===0x1f4){logger[_0xf226('0x12')](_0xf226('0xe'),_0x47e08a,_0x45f2db['error'][_0xf226('0x13')]);return _0x2d376b(_0x45f2db['error'][_0xf226('0x13')]);}logger[_0xf226('0x12')](_0xf226('0xe'),_0x47e08a,_0x45f2db['error'][_0xf226('0x13')]);return _0x1b51fb(_0x45f2db['error'][_0xf226('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x47e08a,'request\x20sent');_0x1b51fb(_0x45f2db[_0xf226('0x14')][_0xf226('0x13')]);}})[_0xf226('0x15')](function(_0x184510){logger[_0xf226('0x12')](_0xf226('0xe'),_0x47e08a,_0x184510);_0x2d376b(_0x184510);});});} \ No newline at end of file +var _0xb514=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb514,0x1df));var _0x4b51=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xb514[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0x4b51('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4b51('0x1'));var rs=require(_0x4b51('0x2'));var fs=require('fs');var Redis=require(_0x4b51('0x3'));var db=require(_0x4b51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b51('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b51('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389715,_0x34b9a1,_0x25191e){return new BPromise(function(_0x25003,_0x47029f){return client[_0x4b51('0x7')](_0x389715,_0x25191e)[_0x4b51('0x8')](function(_0x530f22){logger[_0x4b51('0x9')](_0x4b51('0xa'),_0x34b9a1,_0x4b51('0xb'));logger[_0x4b51('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x34b9a1,_0x4b51('0xb'),JSON[_0x4b51('0xd')](_0x530f22));if(_0x530f22[_0x4b51('0xe')]){if(_0x530f22[_0x4b51('0xe')][_0x4b51('0xf')]===0x1f4){logger['error'](_0x4b51('0xa'),_0x34b9a1,_0x530f22[_0x4b51('0xe')][_0x4b51('0x10')]);return _0x47029f(_0x530f22[_0x4b51('0xe')][_0x4b51('0x10')]);}logger[_0x4b51('0xe')](_0x4b51('0xa'),_0x34b9a1,_0x530f22[_0x4b51('0xe')][_0x4b51('0x10')]);return _0x25003(_0x530f22[_0x4b51('0xe')]['message']);}else{logger[_0x4b51('0x9')](_0x4b51('0xa'),_0x34b9a1,_0x4b51('0xb'));_0x25003(_0x530f22[_0x4b51('0x11')][_0x4b51('0x10')]);}})['catch'](function(_0x34d94e){logger[_0x4b51('0xe')](_0x4b51('0xa'),_0x34b9a1,_0x34d94e);_0x47029f(_0x34d94e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 44832bc..d826ffb 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 _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file +var _0x7c09=['delete','/:id','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','show','post','isAuthenticated','create','put'];(function(_0x2ce6c4,_0x1493e0){var _0x3fa5ef=function(_0x462a6a){while(--_0x462a6a){_0x2ce6c4['push'](_0x2ce6c4['shift']());}};_0x3fa5ef(++_0x1493e0);}(_0x7c09,0x102));var _0x97c0=function(_0x1f2656,_0x5a784a){_0x1f2656=_0x1f2656-0x0;var _0x7b6257=_0x7c09[_0x1f2656];return _0x7b6257;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x97c0('0x9')]);router[_0x97c0('0xa')]('/',auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xb')](),controller['update']);router[_0x97c0('0xe')](_0x97c0('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x97c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 98d1f55..9366b57 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 _0xbe2a=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x509a17,_0x497b29){var _0x2e4919=function(_0x52e5d2){while(--_0x52e5d2){_0x509a17['push'](_0x509a17['shift']());}};_0x2e4919(++_0x497b29);}(_0xbe2a,0x7d));var _0xabe2=function(_0x5366e7,_0x334d63){_0x5366e7=_0x5366e7-0x0;var _0x4d0c10=_0xbe2a[_0x5366e7];return _0x4d0c10;};'use strict';var Sequelize=require(_0xabe2('0x0'));module['exports']={'name':{'type':Sequelize[_0xabe2('0x1')],'unique':_0xabe2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xabe2('0x1')]},'timeout':{'type':Sequelize[_0xabe2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabe2('0x4')](_0xabe2('0x5'),'beepall',_0xabe2('0x6'))}}; \ No newline at end of file +var _0xc166=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0xc166,0xa4));var _0x6c16=function(_0x14082d,_0x537698){_0x14082d=_0x14082d-0x0;var _0x19bcea=_0xc166[_0x14082d];return _0x19bcea;};'use strict';var Sequelize=require(_0x6c16('0x0'));module[_0x6c16('0x1')]={'name':{'type':Sequelize[_0x6c16('0x2')],'unique':_0x6c16('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c16('0x2')]},'timeout':{'type':Sequelize[_0x6c16('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c16('0x5')](_0x6c16('0x6'),'beepall',_0x6c16('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 6588238..d184d77 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 _0x471f=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','ChatQueueId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','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','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status'];(function(_0x11d767,_0x149bca){var _0xf5f44f=function(_0x2ea3b3){while(--_0x2ea3b3){_0x11d767['push'](_0x11d767['shift']());}};_0xf5f44f(++_0x149bca);}(_0x471f,0x1b1));var _0xf471=function(_0x383440,_0x19bb4c){_0x383440=_0x383440-0x0;var _0x4ffc43=_0x471f[_0x383440];return _0x4ffc43;};'use strict';var emlformat=require(_0xf471('0x0'));var rimraf=require(_0xf471('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf471('0x2'));var rp=require(_0xf471('0x3'));var moment=require(_0xf471('0x4'));var BPromise=require(_0xf471('0x5'));var Mustache=require('mustache');var util=require(_0xf471('0x6'));var path=require(_0xf471('0x7'));var sox=require(_0xf471('0x8'));var csv=require(_0xf471('0x9'));var ejs=require(_0xf471('0xa'));var fs=require('fs');var fs_extra=require(_0xf471('0xb'));var _=require(_0xf471('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf471('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf471('0xe'));var Papa=require(_0xf471('0xf'));var Redis=require('ioredis');var authService=require(_0xf471('0x10'));var qs=require(_0xf471('0x11'));var as=require(_0xf471('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf471('0x13'))(_0xf471('0x14'));var utils=require('../../config/utils');var config=require(_0xf471('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf471('0x16'))['db'];config['redis']=_[_0xf471('0x17')](config[_0xf471('0x18')],{'host':_0xf471('0x19'),'port':0x18eb});var socket=require(_0xf471('0x1a'))(new Redis(config['redis']));require(_0xf471('0x1b'))[_0xf471('0x1c')](socket);var jayson=require(_0xf471('0x1d'));var client=jayson[_0xf471('0x1e')][_0xf471('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4eb0dc,_0xfe578c,_0x5ba2a7,_0x32bdba){return new BPromise(function(_0xbe8204,_0xb66ab8){var _0x25575c=_0x32bdba||client;return _0x25575c[_0xf471('0x20')](_0x4eb0dc,_0x5ba2a7)['then'](function(_0x62ed5){logger[_0xf471('0x21')](_0xf471('0x22'),_0xfe578c,'request\x20sent');logger[_0xf471('0x23')](_0xf471('0x24'),_0xfe578c,_0xf471('0x25'),JSON[_0xf471('0x26')](_0x62ed5));if(_0x62ed5[_0xf471('0x27')]){if(_0x62ed5[_0xf471('0x27')][_0xf471('0x28')]===0x1f4){logger[_0xf471('0x27')](_0xf471('0x22'),_0xfe578c,_0x62ed5[_0xf471('0x27')][_0xf471('0x29')]);return _0xb66ab8(_0x62ed5[_0xf471('0x27')][_0xf471('0x29')]);}logger[_0xf471('0x27')](_0xf471('0x22'),_0xfe578c,_0x62ed5['error'][_0xf471('0x29')]);return _0xbe8204(_0x62ed5['error'][_0xf471('0x29')]);}else{logger[_0xf471('0x21')](_0xf471('0x22'),_0xfe578c,_0xf471('0x25'));_0xbe8204(_0x62ed5[_0xf471('0x2a')]['message']);}})[_0xf471('0x2b')](function(_0x35f3c4){logger[_0xf471('0x27')](_0xf471('0x22'),_0xfe578c,_0x35f3c4);_0xb66ab8(_0x35f3c4);});});}function respondWithStatusCode(_0x5c15bc,_0x252dcb){_0x252dcb=_0x252dcb||0xcc;return function(_0x4f8981){if(_0x4f8981){return _0x5c15bc[_0xf471('0x2c')](_0x252dcb);}return _0x5c15bc['status'](_0x252dcb)[_0xf471('0x2d')]();};}function respondWithResult(_0x34e9e2,_0x387a34){_0x387a34=_0x387a34||0xc8;return function(_0x105040){if(_0x105040){return _0x34e9e2[_0xf471('0x2e')](_0x387a34)[_0xf471('0x2f')](_0x105040);}};}function respondWithFilteredResult(_0xe4d3b8,_0x5dd61b){return function(_0x873d87){if(_0x873d87){var _0x48a0a0=typeof _0x5dd61b[_0xf471('0x30')]===_0xf471('0x31')&&typeof _0x5dd61b[_0xf471('0x32')]==='undefined';var _0x450e33=_0x873d87['count'];var _0x452f03=_0x48a0a0?0x0:_0x5dd61b[_0xf471('0x30')];var _0x2fabfc=_0x48a0a0?_0x873d87[_0xf471('0x33')]:_0x5dd61b['offset']+_0x5dd61b['limit'];var _0x55e7e7;if(_0x2fabfc>=_0x450e33){_0x2fabfc=_0x450e33;_0x55e7e7=0xc8;}else{_0x55e7e7=0xce;}_0xe4d3b8[_0xf471('0x2e')](_0x55e7e7);return _0xe4d3b8[_0xf471('0x34')](_0xf471('0x35'),_0x452f03+'-'+_0x2fabfc+'/'+_0x450e33)['json'](_0x873d87);}return null;};}function patchUpdates(_0x15c401){return function(_0x14ca71){try{jsonpatch[_0xf471('0x36')](_0x14ca71,_0x15c401,!![]);}catch(_0x357654){return BPromise[_0xf471('0x37')](_0x357654);}return _0x14ca71[_0xf471('0x38')]();};}function saveUpdates(_0x4d187f,_0x45b6b3){return function(_0x4b6941){if(_0x4b6941){return _0x4b6941[_0xf471('0x39')](_0x4d187f)[_0xf471('0x3a')](function(_0x41774b){return _0x41774b;});}return null;};}function removeEntity(_0x2438c8,_0x1b66dc){return function(_0x4327af){if(_0x4327af){return _0x4327af[_0xf471('0x3b')]()[_0xf471('0x3a')](function(){var _0x126a5b=_0x4327af[_0xf471('0x3c')]({'plain':!![]});var _0x53fa48='ChatQueues';return db[_0xf471('0x3d')][_0xf471('0x3b')]({'where':{'type':_0x53fa48,'resourceId':_0x126a5b['id']}})[_0xf471('0x3a')](function(){return _0x4327af;});})['then'](function(){_0x2438c8[_0xf471('0x2e')](0xcc)[_0xf471('0x2d')]();});}};}function handleEntityNotFound(_0x3bac9d,_0x17026a){return function(_0x299867){if(!_0x299867){_0x3bac9d[_0xf471('0x2c')](0x194);}return _0x299867;};}function handleError(_0x619d34,_0x32cdd3){_0x32cdd3=_0x32cdd3||0x1f4;return function(_0x421103){logger[_0xf471('0x27')](_0x421103[_0xf471('0x3e')]);if(_0x421103[_0xf471('0x3f')]){delete _0x421103['name'];}_0x619d34['status'](_0x32cdd3)[_0xf471('0x40')](_0x421103);};}exports[_0xf471('0x41')]=function(_0x47b288,_0x1f5449){var _0x984cbb={},_0x11019e={},_0x44f9c6={'count':0x0,'rows':[]};var _0x268130=_[_0xf471('0x42')](db[_0xf471('0x43')][_0xf471('0x44')],function(_0x11bd64){return{'name':_0x11bd64[_0xf471('0x45')],'type':_0x11bd64[_0xf471('0x46')][_0xf471('0x47')]};});_0x11019e['model']=_[_0xf471('0x42')](_0x268130,'name');_0x11019e[_0xf471('0x48')]=_[_0xf471('0x49')](_0x47b288[_0xf471('0x48')]);_0x11019e[_0xf471('0x4a')]=_[_0xf471('0x4b')](_0x11019e[_0xf471('0x4c')],_0x11019e[_0xf471('0x48')]);_0x984cbb[_0xf471('0x4d')]=_[_0xf471('0x4b')](_0x11019e[_0xf471('0x4c')],qs[_0xf471('0x4e')](_0x47b288['query'][_0xf471('0x4e')]));_0x984cbb[_0xf471('0x4d')]=_0x984cbb[_0xf471('0x4d')][_0xf471('0x4f')]?_0x984cbb[_0xf471('0x4d')]:_0x11019e[_0xf471('0x4c')];if(!_0x47b288[_0xf471('0x48')]['hasOwnProperty']('nolimit')){_0x984cbb[_0xf471('0x32')]=qs['limit'](_0x47b288[_0xf471('0x48')][_0xf471('0x32')]);_0x984cbb['offset']=qs[_0xf471('0x30')](_0x47b288['query'][_0xf471('0x30')]);}_0x984cbb[_0xf471('0x50')]=qs[_0xf471('0x51')](_0x47b288['query'][_0xf471('0x51')]);_0x984cbb[_0xf471('0x52')]=qs[_0xf471('0x4a')](_[_0xf471('0x53')](_0x47b288[_0xf471('0x48')],_0x11019e['filters']),_0x268130);if(_0x47b288[_0xf471('0x48')]['filter']){_0x984cbb[_0xf471('0x52')]=_[_0xf471('0x54')](_0x984cbb[_0xf471('0x52')],{'$or':_[_0xf471('0x42')](_0x268130,function(_0x50e54f){if(_0x50e54f[_0xf471('0x46')]!==_0xf471('0x55')){var _0x38feb1={};_0x38feb1[_0x50e54f[_0xf471('0x3f')]]={'$like':'%'+_0x47b288[_0xf471('0x48')][_0xf471('0x56')]+'%'};return _0x38feb1;}})});}_0x984cbb=_['merge']({},_0x984cbb,_0x47b288[_0xf471('0x57')]);var _0x2a5b9b={'where':_0x984cbb[_0xf471('0x52')]};return db[_0xf471('0x43')]['count'](_0x2a5b9b)[_0xf471('0x3a')](function(_0x5c9067){_0x44f9c6[_0xf471('0x33')]=_0x5c9067;if(_0x47b288[_0xf471('0x48')][_0xf471('0x58')]){_0x984cbb[_0xf471('0x59')]=[{'all':!![]}];}return db['ChatQueue'][_0xf471('0x5a')](_0x984cbb);})[_0xf471('0x3a')](function(_0x5f3100){_0x44f9c6[_0xf471('0x5b')]=_0x5f3100;return _0x44f9c6;})[_0xf471('0x3a')](respondWithFilteredResult(_0x1f5449,_0x984cbb))[_0xf471('0x2b')](handleError(_0x1f5449,null));};exports[_0xf471('0x5c')]=function(_0x10d42f,_0x1c14bf){var _0x1329bf={'raw':!![],'where':{'id':_0x10d42f[_0xf471('0x5d')]['id']}},_0x26b83b={};_0x26b83b['model']=_[_0xf471('0x49')](db[_0xf471('0x43')]['rawAttributes']);_0x26b83b[_0xf471('0x48')]=_[_0xf471('0x49')](_0x10d42f[_0xf471('0x48')]);_0x26b83b[_0xf471('0x4a')]=_['intersection'](_0x26b83b[_0xf471('0x4c')],_0x26b83b[_0xf471('0x48')]);_0x1329bf['attributes']=_[_0xf471('0x4b')](_0x26b83b['model'],qs[_0xf471('0x4e')](_0x10d42f[_0xf471('0x48')][_0xf471('0x4e')]));_0x1329bf[_0xf471('0x4d')]=_0x1329bf[_0xf471('0x4d')][_0xf471('0x4f')]?_0x1329bf[_0xf471('0x4d')]:_0x26b83b[_0xf471('0x4c')];if(_0x10d42f[_0xf471('0x48')][_0xf471('0x58')]){_0x1329bf[_0xf471('0x59')]=[{'all':!![]}];}_0x1329bf=_[_0xf471('0x54')]({},_0x1329bf,_0x10d42f[_0xf471('0x57')]);return db[_0xf471('0x43')][_0xf471('0x5e')](_0x1329bf)[_0xf471('0x3a')](handleEntityNotFound(_0x1c14bf,null))[_0xf471('0x3a')](respondWithResult(_0x1c14bf,null))['catch'](handleError(_0x1c14bf,null));};exports[_0xf471('0x5f')]=function(_0x3869ff,_0x34f212){return db[_0xf471('0x43')][_0xf471('0x5f')](_0x3869ff[_0xf471('0x60')],{})['then'](function(_0x3c53c7){var _0x1eddb4=_0x3869ff[_0xf471('0x61')][_0xf471('0x3c')]({'plain':!![]});if(!_0x1eddb4)throw new Error(_0xf471('0x62'));if(_0x1eddb4[_0xf471('0x63')]==='user'){var _0x472c62=_0x3c53c7[_0xf471('0x3c')]({'plain':!![]});var _0x498a5b='ChatQueues';return db[_0xf471('0x64')][_0xf471('0x5e')]({'where':{'name':_0x498a5b,'userProfileId':_0x1eddb4['userProfileId']},'raw':!![]})[_0xf471('0x3a')](function(_0x105d8b){if(_0x105d8b&&_0x105d8b[_0xf471('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x472c62['name'],'resourceId':_0x472c62['id'],'type':_0x105d8b[_0xf471('0x3f')],'sectionId':_0x105d8b['id']},{})[_0xf471('0x3a')](function(){return _0x3c53c7;});}else{return _0x3c53c7;}})[_0xf471('0x2b')](function(_0x3b6af4){logger[_0xf471('0x27')](_0xf471('0x66'),_0x3b6af4);throw _0x3b6af4;});}return _0x3c53c7;})[_0xf471('0x3a')](respondWithResult(_0x34f212,0xc9))[_0xf471('0x2b')](handleError(_0x34f212,null));};exports[_0xf471('0x39')]=function(_0x3e8130,_0x22622e){if(_0x3e8130[_0xf471('0x60')]['id']){delete _0x3e8130[_0xf471('0x60')]['id'];}return db['ChatQueue'][_0xf471('0x5e')]({'where':{'id':_0x3e8130['params']['id']}})[_0xf471('0x3a')](handleEntityNotFound(_0x22622e,null))['then'](saveUpdates(_0x3e8130['body'],null))[_0xf471('0x3a')](respondWithResult(_0x22622e,null))[_0xf471('0x2b')](handleError(_0x22622e,null));};exports[_0xf471('0x3b')]=function(_0x403683,_0x5d2b91){return db[_0xf471('0x43')][_0xf471('0x5e')]({'where':{'id':_0x403683[_0xf471('0x5d')]['id']}})[_0xf471('0x3a')](handleEntityNotFound(_0x5d2b91,null))[_0xf471('0x3a')](removeEntity(_0x5d2b91,null))[_0xf471('0x2b')](handleError(_0x5d2b91,null));};exports[_0xf471('0x67')]=function(_0x3774f0,_0x1b17d1){return db[_0xf471('0x43')][_0xf471('0x67')]()[_0xf471('0x3a')](respondWithResult(_0x1b17d1,null))[_0xf471('0x2b')](handleError(_0x1b17d1,null));};exports['getMembers']=function(_0x324bd2,_0x3323c7,_0x432426){var _0x46e60e={'raw':!![],'where':{}},_0x417e1d={},_0x2dc130;return db[_0xf471('0x43')][_0xf471('0x68')]({'where':{'id':_0x324bd2[_0xf471('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3323c7,null))[_0xf471('0x3a')](function(_0x367e42){if(_0x367e42){_0x2dc130=_0x367e42[_0xf471('0x3c')]({'plain':!![]});_0x417e1d[_0xf471('0x4c')]=_['keys'](db[_0xf471('0x69')][_0xf471('0x44')]);_0x417e1d[_0xf471('0x48')]=_[_0xf471('0x49')](_0x324bd2[_0xf471('0x48')]);_0x417e1d[_0xf471('0x4a')]=_['intersection'](_0x417e1d[_0xf471('0x4c')],_0x417e1d[_0xf471('0x48')]);_0x46e60e['attributes']=_[_0xf471('0x4b')](_0x417e1d['model'],qs[_0xf471('0x4e')](_0x324bd2['query'][_0xf471('0x4e')]));_0x46e60e[_0xf471('0x4d')]=_0x46e60e[_0xf471('0x4d')][_0xf471('0x4f')]?_0x46e60e['attributes']:_0x417e1d[_0xf471('0x4c')];if(!_0x324bd2[_0xf471('0x48')][_0xf471('0x6a')](_0xf471('0x6b'))){_0x46e60e['limit']=qs[_0xf471('0x32')](_0x324bd2[_0xf471('0x48')]['limit']);_0x46e60e[_0xf471('0x30')]=qs[_0xf471('0x30')](_0x324bd2[_0xf471('0x48')]['offset']);}_0x46e60e[_0xf471('0x50')]=qs['sort'](_0x324bd2[_0xf471('0x48')][_0xf471('0x51')]);_0x46e60e[_0xf471('0x52')]=qs[_0xf471('0x4a')](_['pick'](_0x324bd2[_0xf471('0x48')],_0x417e1d[_0xf471('0x4a')]));_0x46e60e[_0xf471('0x52')][_0xf471('0x6c')]=_0x367e42['id'];if(_0x324bd2['query'][_0xf471('0x56')]){_0x46e60e[_0xf471('0x52')]=_[_0xf471('0x54')](_0x46e60e[_0xf471('0x52')],{'$or':_[_0xf471('0x42')](_0x46e60e['attributes'],function(_0x36bebf){var _0x3f609c={};_0x3f609c[_0x36bebf]={'$like':'%'+_0x324bd2[_0xf471('0x48')][_0xf471('0x56')]+'%'};return _0x3f609c;})});}_0x46e60e=_['merge']({},_0x46e60e,_0x324bd2[_0xf471('0x57')]);return db['UserChatQueue'][_0xf471('0x5a')](_0x46e60e);}})[_0xf471('0x3a')](function(_0x508804){if(_0x508804){return db['User']['findAndCountAll']({'where':{'id':_[_0xf471('0x42')](_0x508804,'UserId'),'role':_0xf471('0x6d')},'attributes':['id','name',_0xf471('0x6e'),_0xf471('0x6f'),_0xf471('0x70')]});}})[_0xf471('0x3a')](function(_0x3dc871){if(_0x3dc871){return{'count':_0x3dc871[_0xf471('0x33')],'rows':_[_0xf471('0x42')](_0x3dc871['rows'],function(_0x196075){return{'membername':_0x196075['name'],'UserId':_0x196075['id'],'queue_name':_0x2dc130[_0xf471('0x3f')],'ChatQueueId':_0x2dc130['id'],'interface':util[_0xf471('0x71')]('%s/%s',_0xf471('0x72'),_0x196075[_0xf471('0x3f')]),'penalty':0x0,'paused':_0x196075[_0xf471('0x6e')],'createdAt':_0x196075[_0xf471('0x70')],'updatedAt':_0x196075[_0xf471('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf471('0x3a')](respondWithFilteredResult(_0x3323c7,_0x46e60e))[_0xf471('0x2b')](handleError(_0x3323c7,null));};exports['getTeams']=function(_0x505cb4,_0x5ace78,_0x3d6941){var _0x373e65={};var _0x5d7f54={};var _0x193081;var _0x2f8755;return db['ChatQueue'][_0xf471('0x68')]({'where':{'id':_0x505cb4[_0xf471('0x5d')]['id']}})[_0xf471('0x3a')](handleEntityNotFound(_0x5ace78,null))['then'](function(_0x1dba73){if(_0x1dba73){_0x193081=_0x1dba73;_0x5d7f54['model']=_[_0xf471('0x49')](db['Team'][_0xf471('0x44')]);_0x5d7f54['query']=_['keys'](_0x505cb4[_0xf471('0x48')]);_0x5d7f54[_0xf471('0x4a')]=_[_0xf471('0x4b')](_0x5d7f54[_0xf471('0x4c')],_0x5d7f54[_0xf471('0x48')]);_0x373e65['attributes']=_['intersection'](_0x5d7f54['model'],qs[_0xf471('0x4e')](_0x505cb4[_0xf471('0x48')][_0xf471('0x4e')]));_0x373e65[_0xf471('0x4d')]=_0x373e65[_0xf471('0x4d')][_0xf471('0x4f')]?_0x373e65[_0xf471('0x4d')]:_0x5d7f54['model'];_0x373e65['order']=qs[_0xf471('0x51')](_0x505cb4['query'][_0xf471('0x51')]);_0x373e65[_0xf471('0x52')]=qs[_0xf471('0x4a')](_[_0xf471('0x53')](_0x505cb4[_0xf471('0x48')],_0x5d7f54[_0xf471('0x4a')]));if(_0x505cb4[_0xf471('0x48')][_0xf471('0x56')]){_0x373e65[_0xf471('0x52')]=_[_0xf471('0x54')](_0x373e65[_0xf471('0x52')],{'$or':_[_0xf471('0x42')](_0x373e65[_0xf471('0x4d')],function(_0x3b780c){var _0x5ac764={};_0x5ac764[_0x3b780c]={'$like':'%'+_0x505cb4[_0xf471('0x48')][_0xf471('0x56')]+'%'};return _0x5ac764;})});}_0x373e65=_[_0xf471('0x54')]({},_0x373e65,_0x505cb4[_0xf471('0x57')]);return _0x193081[_0xf471('0x73')](_0x373e65);}})[_0xf471('0x3a')](function(_0x4161b0){if(_0x4161b0){_0x2f8755=_0x4161b0['length'];if(!_0x505cb4['query'][_0xf471('0x6a')](_0xf471('0x6b'))){_0x373e65['limit']=qs[_0xf471('0x32')](_0x505cb4['query']['limit']);_0x373e65[_0xf471('0x30')]=qs[_0xf471('0x30')](_0x505cb4[_0xf471('0x48')]['offset']);}return _0x193081[_0xf471('0x73')](_0x373e65);}})[_0xf471('0x3a')](function(_0x1b46bc){if(_0x1b46bc){return _0x1b46bc?{'count':_0x2f8755,'rows':_0x1b46bc}:null;}})[_0xf471('0x3a')](respondWithResult(_0x5ace78,null))[_0xf471('0x2b')](handleError(_0x5ace78,null));};exports[_0xf471('0x74')]=function(_0x55d34d,_0x4df2e2,_0x131e4c){var _0x575af0=_0x55d34d[_0xf471('0x60')][_0xf471('0x75')];return db[_0xf471('0x76')][_0xf471('0x5a')]({'where':{'id':_0x575af0},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf471('0x77'),'attributes':['id',_0xf471('0x3f'),_0xf471('0x78'),'voicePause',_0xf471('0x79')],'raw':!![]}]})['then'](function(_0x46f987){if(_0x46f987){var _0x1fd919=_[_0xf471('0x7a')](_0x46f987,function(_0x4988dc){var _0x4ecddc=_0x4988dc['get']({'plain':!![]});return _0x4ecddc[_0xf471('0x77')];});return db[_0xf471('0x43')]['find']({'where':{'id':_0x55d34d['params']['id']}})[_0xf471('0x3a')](function(_0x1ce014){return db[_0xf471('0x7b')][_0xf471('0x7c')](function(_0x3c8de0){return _0x1ce014[_0xf471('0x74')](_0x575af0,{'transaction':_0x3c8de0})[_0xf471('0x3a')](function(){return BPromise['each'](_0x1fd919,function(_0x5daad4){return db[_0xf471('0x69')][_0xf471('0x7d')]({'where':{'UserId':_0x5daad4['id'],'ChatQueueId':_0x55d34d[_0xf471('0x5d')]['id']},'transaction':_0x3c8de0});});})[_0xf471('0x3a')](function(){_0x1fd919[_0xf471('0x7e')](function(_0x2cce6d){socket[_0xf471('0x7f')](_0xf471('0x80'),{'UserId':_0x2cce6d['id'],'ChatQueueId':_0x1ce014['id']});});});});});}})[_0xf471('0x3a')](respondWithStatusCode(_0x4df2e2,null))['catch'](handleError(_0x4df2e2,null));};exports[_0xf471('0x81')]=function(_0x38c0f6,_0x436cb3,_0x5db70f){return db[_0xf471('0x76')][_0xf471('0x5a')]({'where':{'id':_0x38c0f6[_0xf471('0x48')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf471('0x77'),'attributes':['id'],'raw':!![]}]})[_0xf471('0x3a')](handleEntityNotFound(_0x436cb3,null))['then'](function(_0x155494){var _0x46b2a2=_[_0xf471('0x42')](_0x155494,'id');var _0x58a311=[];var _0x501fb3=[];var _0x5e7a42=squel[_0xf471('0x82')]();_0x5e7a42[_0xf471('0x83')](_0xf471('0x84'))[_0xf471('0x85')](_0xf471('0x86'),'tq')[_0xf471('0x87')](_0xf471('0x88'),'ut',_0xf471('0x89'))[_0xf471('0x52')](_0xf471('0x8a'),_0x38c0f6['params']['id']);for(var _0x1adaa2=0x0;_0x1adaa2<_0x155494[_0xf471('0x4f')];_0x1adaa2+=0x1){let _0x275664=_0x155494[_0x1adaa2];for(var _0xa55f5a=0x0;_0xa55f5a<_0x275664[_0xf471('0x77')][_0xf471('0x4f')];_0xa55f5a+=0x1){let _0x31bc0b=_0x275664[_0xf471('0x77')][_0xa55f5a];var _0x22a60c=_0x5e7a42[_0xf471('0x8b')]();_0x22a60c['where'](_0xf471('0x8c'),_0x31bc0b['id']);_0x501fb3[_0xf471('0x8d')](db[_0xf471('0x7b')][_0xf471('0x48')](_0x22a60c[_0xf471('0x8e')](),{'type':db[_0xf471('0x7b')][_0xf471('0x8f')][_0xf471('0x90')]})[_0xf471('0x3a')](function(_0x450856){if(_0x450856['length']===0x1){return _0x31bc0b['id'];}else{var _0x35e9c6=_[_0xf471('0x91')](_[_0xf471('0x42')](_0x450856,_0xf471('0x92')),function(_0x6ed3d6){return _[_0xf471('0x93')](_0x46b2a2,_0x6ed3d6);});if(_0x35e9c6){return _0x31bc0b['id'];}}}));}}return BPromise[_0xf471('0x94')](_0x501fb3)[_0xf471('0x3a')](function(_0x2339f4){_0x58a311=_(_0x58a311)[_0xf471('0x95')](_0x2339f4)[_0xf471('0x96')]()[_0xf471('0x97')]();return db[_0xf471('0x43')][_0xf471('0x5e')]({'where':{'id':_0x38c0f6['params']['id']}})['then'](function(_0x23b7b0){return db[_0xf471('0x7b')]['transaction'](function(_0x4be0f8){return _0x23b7b0[_0xf471('0x81')](_0x38c0f6['query']['ids'],{'transaction':_0x4be0f8})[_0xf471('0x3a')](function(){if(!_[_0xf471('0x98')](_0x58a311)){return _0x23b7b0[_0xf471('0x99')](_0x58a311,{'transaction':_0x4be0f8});}})[_0xf471('0x3a')](function(){_0x58a311[_0xf471('0x7e')](function(_0x18994c){socket[_0xf471('0x7f')](_0xf471('0x9a'),{'UserId':_0x18994c,'ChatQueueId':_0x23b7b0['id']});});});});});});})[_0xf471('0x3a')](respondWithStatusCode(_0x436cb3,null))[_0xf471('0x2b')](handleError(_0x436cb3,null));};exports[_0xf471('0x9b')]=function(_0xfe4365,_0x59b575,_0x472c73){return db[_0xf471('0x43')]['find']({'where':{'id':_0xfe4365[_0xf471('0x5d')]['id']}})[_0xf471('0x3a')](handleEntityNotFound(_0x59b575,null))[_0xf471('0x3a')](function(_0x5d217f){if(_0x5d217f){return _0x5d217f['addAgents'](_0xfe4365['body'][_0xf471('0x75')],_[_0xf471('0x9c')](_0xfe4365[_0xf471('0x60')],['ids','id'])||{})['spread'](function(_0x54f86b){for(var _0x42a037=0x0;_0x42a037<_0xfe4365[_0xf471('0x60')][_0xf471('0x75')][_0xf471('0x4f')];_0x42a037+=0x1){socket[_0xf471('0x7f')](_0xf471('0x80'),{'UserId':Number(_0xfe4365[_0xf471('0x60')]['ids'][_0x42a037]),'ChatQueueId':Number(_0xfe4365[_0xf471('0x5d')]['id'])});}return _0x54f86b;});}})[_0xf471('0x3a')](respondWithResult(_0x59b575,null))[_0xf471('0x2b')](handleError(_0x59b575,null));};exports[_0xf471('0x99')]=function(_0x129da7,_0x214228,_0x337787){return db[_0xf471('0x43')][_0xf471('0x5e')]({'where':{'id':_0x129da7[_0xf471('0x5d')]['id']}})[_0xf471('0x3a')](handleEntityNotFound(_0x214228,null))[_0xf471('0x3a')](function(_0x286249){if(_0x286249){return _0x286249[_0xf471('0x99')](_0x129da7[_0xf471('0x48')][_0xf471('0x75')])[_0xf471('0x3a')](function(){if(_[_0xf471('0x9d')](_0x129da7[_0xf471('0x48')][_0xf471('0x75')])){for(var _0x3c3c75=0x0;_0x3c3c75<_0x129da7[_0xf471('0x48')][_0xf471('0x75')][_0xf471('0x4f')];_0x3c3c75+=0x1){socket['emit'](_0xf471('0x9a'),{'UserId':Number(_0x129da7['query'][_0xf471('0x75')][_0x3c3c75]),'ChatQueueId':Number(_0x129da7['params']['id'])});}}else{socket[_0xf471('0x7f')](_0xf471('0x9a'),{'UserId':Number(_0x129da7[_0xf471('0x48')]['ids']),'ChatQueueId':Number(_0x129da7[_0xf471('0x5d')]['id'])});}});}})[_0xf471('0x3a')](respondWithStatusCode(_0x214228,null))[_0xf471('0x2b')](handleError(_0x214228,null));};exports[_0xf471('0x9e')]=function(_0xfa64e0,_0x5080ff,_0x30ccee){var _0x5207c7={};var _0x4cb8d4={};var _0x4b5fc5;var _0x241924;return db[_0xf471('0x43')][_0xf471('0x68')]({'where':{'id':_0xfa64e0[_0xf471('0x5d')]['id']}})[_0xf471('0x3a')](handleEntityNotFound(_0x5080ff,null))['then'](function(_0x312ea1){if(_0x312ea1){_0x4b5fc5=_0x312ea1;_0x4cb8d4['model']=_['keys'](db[_0xf471('0x9f')][_0xf471('0x44')]);_0x4cb8d4['query']=_[_0xf471('0x49')](_0xfa64e0[_0xf471('0x48')]);_0x4cb8d4[_0xf471('0x4a')]=_[_0xf471('0x4b')](_0x4cb8d4[_0xf471('0x4c')],_0x4cb8d4[_0xf471('0x48')]);_0x5207c7[_0xf471('0x4d')]=_['intersection'](_0x4cb8d4[_0xf471('0x4c')],qs[_0xf471('0x4e')](_0xfa64e0[_0xf471('0x48')][_0xf471('0x4e')]));_0x5207c7[_0xf471('0x4d')]=_0x5207c7['attributes'][_0xf471('0x4f')]?_0x5207c7[_0xf471('0x4d')]:_0x4cb8d4[_0xf471('0x4c')];_0x5207c7[_0xf471('0x50')]=qs[_0xf471('0x51')](_0xfa64e0[_0xf471('0x48')][_0xf471('0x51')]);_0x5207c7[_0xf471('0x52')]=qs[_0xf471('0x4a')](_[_0xf471('0x53')](_0xfa64e0['query'],_0x4cb8d4[_0xf471('0x4a')]));if(_0xfa64e0[_0xf471('0x48')][_0xf471('0x56')]){_0x5207c7['where']=_[_0xf471('0x54')](_0x5207c7['where'],{'$or':_[_0xf471('0x42')](_0x5207c7[_0xf471('0x4d')],function(_0x3ce1a7){var _0x48163a={};_0x48163a[_0x3ce1a7]={'$like':'%'+_0xfa64e0['query'][_0xf471('0x56')]+'%'};return _0x48163a;})});}_0x5207c7=_[_0xf471('0x54')]({},_0x5207c7,_0xfa64e0[_0xf471('0x57')]);return _0x4b5fc5[_0xf471('0x9e')](_0x5207c7);}})[_0xf471('0x3a')](function(_0xd0679c){if(_0xd0679c){_0x241924=_0xd0679c[_0xf471('0x4f')];if(!_0xfa64e0[_0xf471('0x48')][_0xf471('0x6a')]('nolimit')){_0x5207c7['limit']=qs['limit'](_0xfa64e0[_0xf471('0x48')][_0xf471('0x32')]);_0x5207c7[_0xf471('0x30')]=qs['offset'](_0xfa64e0['query'][_0xf471('0x30')]);}return _0x4b5fc5[_0xf471('0x9e')](_0x5207c7);}})[_0xf471('0x3a')](function(_0x5b8cb7){if(_0x5b8cb7){return _0x5b8cb7?{'count':_0x241924,'rows':_0x5b8cb7}:null;}})[_0xf471('0x3a')](respondWithResult(_0x5080ff,null))[_0xf471('0x2b')](handleError(_0x5080ff,null));}; \ No newline at end of file +var _0xc015=['json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','ChatQueue','findAll','rows','keys','find','create','body','user','role','userProfileId','autoAssociation','update','params','describe','getMembers','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end'];(function(_0x4c6a72,_0xdd07f7){var _0x404240=function(_0x53998b){while(--_0x53998b){_0x4c6a72['push'](_0x4c6a72['shift']());}};_0x404240(++_0xdd07f7);}(_0xc015,0x19d));var _0x5c01=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0xc015[_0x246115];return _0x385878;};'use strict';var emlformat=require(_0x5c01('0x0'));var rimraf=require(_0x5c01('0x1'));var zipdir=require(_0x5c01('0x2'));var jsonpatch=require(_0x5c01('0x3'));var rp=require(_0x5c01('0x4'));var moment=require(_0x5c01('0x5'));var BPromise=require(_0x5c01('0x6'));var Mustache=require(_0x5c01('0x7'));var util=require(_0x5c01('0x8'));var path=require(_0x5c01('0x9'));var sox=require(_0x5c01('0xa'));var csv=require('to-csv');var ejs=require(_0x5c01('0xb'));var fs=require('fs');var fs_extra=require(_0x5c01('0xc'));var _=require(_0x5c01('0xd'));var squel=require('squel');var crypto=require(_0x5c01('0xe'));var jsforce=require(_0x5c01('0xf'));var deskjs=require(_0x5c01('0x10'));var toCsv=require(_0x5c01('0x11'));var querystring=require(_0x5c01('0x12'));var Papa=require(_0x5c01('0x13'));var Redis=require(_0x5c01('0x14'));var authService=require(_0x5c01('0x15'));var qs=require(_0x5c01('0x16'));var as=require(_0x5c01('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c01('0x18'));var utils=require(_0x5c01('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5c01('0x1a'));var db=require(_0x5c01('0x1b'))['db'];config[_0x5c01('0x1c')]=_[_0x5c01('0x1d')](config[_0x5c01('0x1c')],{'host':_0x5c01('0x1e'),'port':0x18eb});var socket=require(_0x5c01('0x1f'))(new Redis(config[_0x5c01('0x1c')]));require(_0x5c01('0x20'))[_0x5c01('0x21')](socket);var jayson=require(_0x5c01('0x22'));var client=jayson['client'][_0x5c01('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x45a560,_0x97ba80,_0x58dde4,_0x1f4617){return new BPromise(function(_0x3a51c8,_0x425a6e){var _0x48c890=_0x1f4617||client;return _0x48c890['request'](_0x45a560,_0x58dde4)['then'](function(_0x17230a){logger[_0x5c01('0x24')](_0x5c01('0x25'),_0x97ba80,_0x5c01('0x26'));logger['debug'](_0x5c01('0x27'),_0x97ba80,_0x5c01('0x26'),JSON[_0x5c01('0x28')](_0x17230a));if(_0x17230a[_0x5c01('0x29')]){if(_0x17230a['error'][_0x5c01('0x2a')]===0x1f4){logger[_0x5c01('0x29')](_0x5c01('0x25'),_0x97ba80,_0x17230a[_0x5c01('0x29')][_0x5c01('0x2b')]);return _0x425a6e(_0x17230a[_0x5c01('0x29')]['message']);}logger[_0x5c01('0x29')](_0x5c01('0x25'),_0x97ba80,_0x17230a['error'][_0x5c01('0x2b')]);return _0x3a51c8(_0x17230a[_0x5c01('0x29')]['message']);}else{logger['info'](_0x5c01('0x25'),_0x97ba80,_0x5c01('0x26'));_0x3a51c8(_0x17230a[_0x5c01('0x2c')][_0x5c01('0x2b')]);}})[_0x5c01('0x2d')](function(_0x487931){logger['error'](_0x5c01('0x25'),_0x97ba80,_0x487931);_0x425a6e(_0x487931);});});}function respondWithStatusCode(_0xe521c3,_0x165265){_0x165265=_0x165265||0xcc;return function(_0x342602){if(_0x342602){return _0xe521c3[_0x5c01('0x2e')](_0x165265);}return _0xe521c3[_0x5c01('0x2f')](_0x165265)[_0x5c01('0x30')]();};}function respondWithResult(_0xb1ad44,_0x1ac5d2){_0x1ac5d2=_0x1ac5d2||0xc8;return function(_0x5422f5){if(_0x5422f5){return _0xb1ad44[_0x5c01('0x2f')](_0x1ac5d2)[_0x5c01('0x31')](_0x5422f5);}};}function respondWithFilteredResult(_0x407480,_0x5a074e){return function(_0x7e7fe0){if(_0x7e7fe0){var _0xe2da0d=typeof _0x5a074e[_0x5c01('0x32')]==='undefined'&&typeof _0x5a074e[_0x5c01('0x33')]===_0x5c01('0x34');var _0x34b1b6=_0x7e7fe0[_0x5c01('0x35')];var _0x4dd236=_0xe2da0d?0x0:_0x5a074e[_0x5c01('0x32')];var _0x3e0c34=_0xe2da0d?_0x7e7fe0[_0x5c01('0x35')]:_0x5a074e[_0x5c01('0x32')]+_0x5a074e[_0x5c01('0x33')];var _0x245dca;if(_0x3e0c34>=_0x34b1b6){_0x3e0c34=_0x34b1b6;_0x245dca=0xc8;}else{_0x245dca=0xce;}_0x407480[_0x5c01('0x2f')](_0x245dca);return _0x407480['set'](_0x5c01('0x36'),_0x4dd236+'-'+_0x3e0c34+'/'+_0x34b1b6)['json'](_0x7e7fe0);}return null;};}function patchUpdates(_0x1f2ed1){return function(_0x1b44b9){try{jsonpatch[_0x5c01('0x37')](_0x1b44b9,_0x1f2ed1,!![]);}catch(_0x583984){return BPromise['reject'](_0x583984);}return _0x1b44b9[_0x5c01('0x38')]();};}function saveUpdates(_0x3567ab,_0x994b8a){return function(_0x27ae86){if(_0x27ae86){return _0x27ae86['update'](_0x3567ab)[_0x5c01('0x39')](function(_0xef668f){return _0xef668f;});}return null;};}function removeEntity(_0x39579a,_0x2aa70b){return function(_0x5948c0){if(_0x5948c0){return _0x5948c0[_0x5c01('0x3a')]()[_0x5c01('0x39')](function(){var _0x4197b9=_0x5948c0[_0x5c01('0x3b')]({'plain':!![]});var _0x570f37=_0x5c01('0x3c');return db[_0x5c01('0x3d')][_0x5c01('0x3a')]({'where':{'type':_0x570f37,'resourceId':_0x4197b9['id']}})[_0x5c01('0x39')](function(){return _0x5948c0;});})[_0x5c01('0x39')](function(){_0x39579a[_0x5c01('0x2f')](0xcc)[_0x5c01('0x30')]();});}};}function handleEntityNotFound(_0x4e803e,_0xd30821){return function(_0x69cbc4){if(!_0x69cbc4){_0x4e803e[_0x5c01('0x2e')](0x194);}return _0x69cbc4;};}function handleError(_0x3231d8,_0x2a44b4){_0x2a44b4=_0x2a44b4||0x1f4;return function(_0x537014){logger[_0x5c01('0x29')](_0x537014[_0x5c01('0x3e')]);if(_0x537014[_0x5c01('0x3f')]){delete _0x537014['name'];}_0x3231d8[_0x5c01('0x2f')](_0x2a44b4)[_0x5c01('0x40')](_0x537014);};}exports[_0x5c01('0x41')]=function(_0x5ce6c3,_0xf9423c){var _0x5eff75={},_0x1b0f1d={},_0x5c40d3={'count':0x0,'rows':[]};var _0xff81ac=_[_0x5c01('0x42')](db['ChatQueue'][_0x5c01('0x43')],function(_0x4b7c52){return{'name':_0x4b7c52[_0x5c01('0x44')],'type':_0x4b7c52['type'][_0x5c01('0x45')]};});_0x1b0f1d[_0x5c01('0x46')]=_[_0x5c01('0x42')](_0xff81ac,_0x5c01('0x3f'));_0x1b0f1d[_0x5c01('0x47')]=_['keys'](_0x5ce6c3[_0x5c01('0x47')]);_0x1b0f1d['filters']=_[_0x5c01('0x48')](_0x1b0f1d[_0x5c01('0x46')],_0x1b0f1d[_0x5c01('0x47')]);_0x5eff75[_0x5c01('0x49')]=_[_0x5c01('0x48')](_0x1b0f1d[_0x5c01('0x46')],qs[_0x5c01('0x4a')](_0x5ce6c3[_0x5c01('0x47')][_0x5c01('0x4a')]));_0x5eff75[_0x5c01('0x49')]=_0x5eff75['attributes'][_0x5c01('0x4b')]?_0x5eff75[_0x5c01('0x49')]:_0x1b0f1d['model'];if(!_0x5ce6c3['query'][_0x5c01('0x4c')](_0x5c01('0x4d'))){_0x5eff75[_0x5c01('0x33')]=qs[_0x5c01('0x33')](_0x5ce6c3[_0x5c01('0x47')][_0x5c01('0x33')]);_0x5eff75[_0x5c01('0x32')]=qs[_0x5c01('0x32')](_0x5ce6c3['query'][_0x5c01('0x32')]);}_0x5eff75[_0x5c01('0x4e')]=qs[_0x5c01('0x4f')](_0x5ce6c3[_0x5c01('0x47')][_0x5c01('0x4f')]);_0x5eff75[_0x5c01('0x50')]=qs[_0x5c01('0x51')](_[_0x5c01('0x52')](_0x5ce6c3['query'],_0x1b0f1d[_0x5c01('0x51')]),_0xff81ac);if(_0x5ce6c3[_0x5c01('0x47')][_0x5c01('0x53')]){_0x5eff75[_0x5c01('0x50')]=_[_0x5c01('0x54')](_0x5eff75[_0x5c01('0x50')],{'$or':_[_0x5c01('0x42')](_0xff81ac,function(_0x5a87a9){if(_0x5a87a9['type']!=='VIRTUAL'){var _0x3f8961={};_0x3f8961[_0x5a87a9[_0x5c01('0x3f')]]={'$like':'%'+_0x5ce6c3[_0x5c01('0x47')][_0x5c01('0x53')]+'%'};return _0x3f8961;}})});}_0x5eff75=_[_0x5c01('0x54')]({},_0x5eff75,_0x5ce6c3[_0x5c01('0x55')]);var _0x557a40={'where':_0x5eff75[_0x5c01('0x50')]};return db['ChatQueue']['count'](_0x557a40)['then'](function(_0x1d593c){_0x5c40d3[_0x5c01('0x35')]=_0x1d593c;if(_0x5ce6c3[_0x5c01('0x47')][_0x5c01('0x56')]){_0x5eff75['include']=[{'all':!![]}];}return db[_0x5c01('0x57')][_0x5c01('0x58')](_0x5eff75);})[_0x5c01('0x39')](function(_0x2908cf){_0x5c40d3[_0x5c01('0x59')]=_0x2908cf;return _0x5c40d3;})[_0x5c01('0x39')](respondWithFilteredResult(_0xf9423c,_0x5eff75))['catch'](handleError(_0xf9423c,null));};exports['show']=function(_0x26e2e2,_0x3609c3){var _0x1a1187={'raw':!![],'where':{'id':_0x26e2e2['params']['id']}},_0x5c0b1a={};_0x5c0b1a[_0x5c01('0x46')]=_[_0x5c01('0x5a')](db[_0x5c01('0x57')][_0x5c01('0x43')]);_0x5c0b1a[_0x5c01('0x47')]=_[_0x5c01('0x5a')](_0x26e2e2[_0x5c01('0x47')]);_0x5c0b1a[_0x5c01('0x51')]=_['intersection'](_0x5c0b1a[_0x5c01('0x46')],_0x5c0b1a[_0x5c01('0x47')]);_0x1a1187['attributes']=_[_0x5c01('0x48')](_0x5c0b1a['model'],qs['fields'](_0x26e2e2[_0x5c01('0x47')]['fields']));_0x1a1187[_0x5c01('0x49')]=_0x1a1187['attributes']['length']?_0x1a1187['attributes']:_0x5c0b1a[_0x5c01('0x46')];if(_0x26e2e2[_0x5c01('0x47')][_0x5c01('0x56')]){_0x1a1187['include']=[{'all':!![]}];}_0x1a1187=_[_0x5c01('0x54')]({},_0x1a1187,_0x26e2e2['options']);return db[_0x5c01('0x57')][_0x5c01('0x5b')](_0x1a1187)[_0x5c01('0x39')](handleEntityNotFound(_0x3609c3,null))[_0x5c01('0x39')](respondWithResult(_0x3609c3,null))[_0x5c01('0x2d')](handleError(_0x3609c3,null));};exports[_0x5c01('0x5c')]=function(_0x45b7f3,_0x350b34){return db[_0x5c01('0x57')][_0x5c01('0x5c')](_0x45b7f3[_0x5c01('0x5d')],{})[_0x5c01('0x39')](function(_0x3e69ab){var _0x365c8c=_0x45b7f3[_0x5c01('0x5e')][_0x5c01('0x3b')]({'plain':!![]});if(!_0x365c8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x365c8c[_0x5c01('0x5f')]==='user'){var _0x5f18cb=_0x3e69ab['get']({'plain':!![]});var _0x21b9b2=_0x5c01('0x3c');return db['UserProfileSection'][_0x5c01('0x5b')]({'where':{'name':_0x21b9b2,'userProfileId':_0x365c8c[_0x5c01('0x60')]},'raw':!![]})[_0x5c01('0x39')](function(_0x322e8f){if(_0x322e8f&&_0x322e8f[_0x5c01('0x61')]===0x0){return db[_0x5c01('0x3d')][_0x5c01('0x5c')]({'name':_0x5f18cb[_0x5c01('0x3f')],'resourceId':_0x5f18cb['id'],'type':_0x322e8f[_0x5c01('0x3f')],'sectionId':_0x322e8f['id']},{})['then'](function(){return _0x3e69ab;});}else{return _0x3e69ab;}})[_0x5c01('0x2d')](function(_0x5807d1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5807d1);throw _0x5807d1;});}return _0x3e69ab;})['then'](respondWithResult(_0x350b34,0xc9))[_0x5c01('0x2d')](handleError(_0x350b34,null));};exports[_0x5c01('0x62')]=function(_0x9ea81e,_0x232480){if(_0x9ea81e[_0x5c01('0x5d')]['id']){delete _0x9ea81e[_0x5c01('0x5d')]['id'];}return db[_0x5c01('0x57')][_0x5c01('0x5b')]({'where':{'id':_0x9ea81e[_0x5c01('0x63')]['id']}})[_0x5c01('0x39')](handleEntityNotFound(_0x232480,null))[_0x5c01('0x39')](saveUpdates(_0x9ea81e[_0x5c01('0x5d')],null))['then'](respondWithResult(_0x232480,null))['catch'](handleError(_0x232480,null));};exports['destroy']=function(_0x55e07f,_0x8cd975){return db[_0x5c01('0x57')][_0x5c01('0x5b')]({'where':{'id':_0x55e07f['params']['id']}})[_0x5c01('0x39')](handleEntityNotFound(_0x8cd975,null))['then'](removeEntity(_0x8cd975,null))['catch'](handleError(_0x8cd975,null));};exports[_0x5c01('0x64')]=function(_0x208320,_0x5884fe){return db['ChatQueue'][_0x5c01('0x64')]()[_0x5c01('0x39')](respondWithResult(_0x5884fe,null))[_0x5c01('0x2d')](handleError(_0x5884fe,null));};exports[_0x5c01('0x65')]=function(_0xba9fd9,_0x4abe6e,_0x5b3bc8){var _0x493628={'raw':!![],'where':{}},_0xf26e5b={},_0x2e19a8;return db[_0x5c01('0x57')]['findOne']({'where':{'id':_0xba9fd9[_0x5c01('0x63')]['id']}})[_0x5c01('0x39')](handleEntityNotFound(_0x4abe6e,null))['then'](function(_0x49743b){if(_0x49743b){_0x2e19a8=_0x49743b[_0x5c01('0x3b')]({'plain':!![]});_0xf26e5b[_0x5c01('0x46')]=_[_0x5c01('0x5a')](db[_0x5c01('0x66')][_0x5c01('0x43')]);_0xf26e5b['query']=_[_0x5c01('0x5a')](_0xba9fd9[_0x5c01('0x47')]);_0xf26e5b['filters']=_[_0x5c01('0x48')](_0xf26e5b[_0x5c01('0x46')],_0xf26e5b[_0x5c01('0x47')]);_0x493628[_0x5c01('0x49')]=_[_0x5c01('0x48')](_0xf26e5b['model'],qs[_0x5c01('0x4a')](_0xba9fd9[_0x5c01('0x47')][_0x5c01('0x4a')]));_0x493628[_0x5c01('0x49')]=_0x493628['attributes'][_0x5c01('0x4b')]?_0x493628[_0x5c01('0x49')]:_0xf26e5b[_0x5c01('0x46')];if(!_0xba9fd9[_0x5c01('0x47')]['hasOwnProperty'](_0x5c01('0x4d'))){_0x493628['limit']=qs[_0x5c01('0x33')](_0xba9fd9['query'][_0x5c01('0x33')]);_0x493628[_0x5c01('0x32')]=qs[_0x5c01('0x32')](_0xba9fd9[_0x5c01('0x47')][_0x5c01('0x32')]);}_0x493628[_0x5c01('0x4e')]=qs[_0x5c01('0x4f')](_0xba9fd9[_0x5c01('0x47')][_0x5c01('0x4f')]);_0x493628[_0x5c01('0x50')]=qs[_0x5c01('0x51')](_[_0x5c01('0x52')](_0xba9fd9[_0x5c01('0x47')],_0xf26e5b[_0x5c01('0x51')]));_0x493628[_0x5c01('0x50')][_0x5c01('0x67')]=_0x49743b['id'];if(_0xba9fd9[_0x5c01('0x47')][_0x5c01('0x53')]){_0x493628[_0x5c01('0x50')]=_[_0x5c01('0x54')](_0x493628[_0x5c01('0x50')],{'$or':_[_0x5c01('0x42')](_0x493628[_0x5c01('0x49')],function(_0x53f098){var _0x1c84e4={};_0x1c84e4[_0x53f098]={'$like':'%'+_0xba9fd9['query']['filter']+'%'};return _0x1c84e4;})});}_0x493628=_['merge']({},_0x493628,_0xba9fd9['options']);return db[_0x5c01('0x66')]['findAll'](_0x493628);}})[_0x5c01('0x39')](function(_0x11708a){if(_0x11708a){return db['User'][_0x5c01('0x68')]({'where':{'id':_[_0x5c01('0x42')](_0x11708a,_0x5c01('0x69')),'role':_0x5c01('0x6a')},'attributes':['id',_0x5c01('0x3f'),_0x5c01('0x6b'),_0x5c01('0x6c'),_0x5c01('0x6d')]});}})['then'](function(_0x407874){if(_0x407874){return{'count':_0x407874[_0x5c01('0x35')],'rows':_[_0x5c01('0x42')](_0x407874['rows'],function(_0x800c66){return{'membername':_0x800c66['name'],'UserId':_0x800c66['id'],'queue_name':_0x2e19a8[_0x5c01('0x3f')],'ChatQueueId':_0x2e19a8['id'],'interface':util[_0x5c01('0x6e')](_0x5c01('0x6f'),'SIP',_0x800c66[_0x5c01('0x3f')]),'penalty':0x0,'paused':_0x800c66['chatPause'],'createdAt':_0x800c66[_0x5c01('0x6d')],'updatedAt':_0x800c66['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c01('0x39')](respondWithFilteredResult(_0x4abe6e,_0x493628))['catch'](handleError(_0x4abe6e,null));};exports[_0x5c01('0x70')]=function(_0xeb7b48,_0x2515e0,_0x2a2991){var _0x4c4c63={};var _0x410618={};var _0x4dd00c;var _0x46f602;return db[_0x5c01('0x57')]['findOne']({'where':{'id':_0xeb7b48[_0x5c01('0x63')]['id']}})[_0x5c01('0x39')](handleEntityNotFound(_0x2515e0,null))['then'](function(_0x1e37cb){if(_0x1e37cb){_0x4dd00c=_0x1e37cb;_0x410618[_0x5c01('0x46')]=_[_0x5c01('0x5a')](db[_0x5c01('0x71')][_0x5c01('0x43')]);_0x410618[_0x5c01('0x47')]=_[_0x5c01('0x5a')](_0xeb7b48[_0x5c01('0x47')]);_0x410618[_0x5c01('0x51')]=_[_0x5c01('0x48')](_0x410618[_0x5c01('0x46')],_0x410618['query']);_0x4c4c63[_0x5c01('0x49')]=_['intersection'](_0x410618['model'],qs[_0x5c01('0x4a')](_0xeb7b48[_0x5c01('0x47')][_0x5c01('0x4a')]));_0x4c4c63[_0x5c01('0x49')]=_0x4c4c63[_0x5c01('0x49')][_0x5c01('0x4b')]?_0x4c4c63[_0x5c01('0x49')]:_0x410618[_0x5c01('0x46')];_0x4c4c63['order']=qs[_0x5c01('0x4f')](_0xeb7b48[_0x5c01('0x47')][_0x5c01('0x4f')]);_0x4c4c63[_0x5c01('0x50')]=qs['filters'](_[_0x5c01('0x52')](_0xeb7b48[_0x5c01('0x47')],_0x410618[_0x5c01('0x51')]));if(_0xeb7b48['query'][_0x5c01('0x53')]){_0x4c4c63[_0x5c01('0x50')]=_[_0x5c01('0x54')](_0x4c4c63[_0x5c01('0x50')],{'$or':_[_0x5c01('0x42')](_0x4c4c63[_0x5c01('0x49')],function(_0x246f40){var _0x32f389={};_0x32f389[_0x246f40]={'$like':'%'+_0xeb7b48[_0x5c01('0x47')][_0x5c01('0x53')]+'%'};return _0x32f389;})});}_0x4c4c63=_['merge']({},_0x4c4c63,_0xeb7b48['options']);return _0x4dd00c[_0x5c01('0x70')](_0x4c4c63);}})[_0x5c01('0x39')](function(_0x287d0c){if(_0x287d0c){_0x46f602=_0x287d0c[_0x5c01('0x4b')];if(!_0xeb7b48['query']['hasOwnProperty'](_0x5c01('0x4d'))){_0x4c4c63[_0x5c01('0x33')]=qs[_0x5c01('0x33')](_0xeb7b48['query'][_0x5c01('0x33')]);_0x4c4c63[_0x5c01('0x32')]=qs['offset'](_0xeb7b48[_0x5c01('0x47')][_0x5c01('0x32')]);}return _0x4dd00c[_0x5c01('0x70')](_0x4c4c63);}})[_0x5c01('0x39')](function(_0xcd4119){if(_0xcd4119){return _0xcd4119?{'count':_0x46f602,'rows':_0xcd4119}:null;}})['then'](respondWithResult(_0x2515e0,null))[_0x5c01('0x2d')](handleError(_0x2515e0,null));};exports[_0x5c01('0x72')]=function(_0x463ff1,_0x3aed2e,_0x4b15db){var _0x2984a4=_0x463ff1['body'][_0x5c01('0x73')];return db['Team']['findAll']({'where':{'id':_0x2984a4},'attributes':['id'],'include':[{'model':db[_0x5c01('0x74')],'as':_0x5c01('0x75'),'attributes':['id','name',_0x5c01('0x76'),'voicePause',_0x5c01('0x77')],'raw':!![]}]})['then'](function(_0x5be8cc){if(_0x5be8cc){var _0xfae3a4=_[_0x5c01('0x78')](_0x5be8cc,function(_0x161436){var _0x5ca4d1=_0x161436['get']({'plain':!![]});return _0x5ca4d1['Agents'];});return db[_0x5c01('0x57')][_0x5c01('0x5b')]({'where':{'id':_0x463ff1[_0x5c01('0x63')]['id']}})['then'](function(_0x5e31e0){return db[_0x5c01('0x79')][_0x5c01('0x7a')](function(_0x1c70de){return _0x5e31e0[_0x5c01('0x72')](_0x2984a4,{'transaction':_0x1c70de})[_0x5c01('0x39')](function(){return BPromise[_0x5c01('0x7b')](_0xfae3a4,function(_0x26e0e9){return db[_0x5c01('0x66')]['findOrCreate']({'where':{'UserId':_0x26e0e9['id'],'ChatQueueId':_0x463ff1['params']['id']},'transaction':_0x1c70de});});})[_0x5c01('0x39')](function(){_0xfae3a4[_0x5c01('0x7c')](function(_0x2f39b7){socket[_0x5c01('0x7d')](_0x5c01('0x7e'),{'UserId':_0x2f39b7['id'],'ChatQueueId':_0x5e31e0['id']});});});});});}})[_0x5c01('0x39')](respondWithStatusCode(_0x3aed2e,null))[_0x5c01('0x2d')](handleError(_0x3aed2e,null));};exports['removeTeams']=function(_0x150ca9,_0x107988,_0x666d77){return db[_0x5c01('0x71')][_0x5c01('0x58')]({'where':{'id':_0x150ca9[_0x5c01('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5c01('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x107988,null))[_0x5c01('0x39')](function(_0x2e8e39){var _0x327ee3=_['map'](_0x2e8e39,'id');var _0x4d7342=[];var _0x408824=[];var _0x1e3b65=squel[_0x5c01('0x7f')]();_0x1e3b65['field'](_0x5c01('0x80'))[_0x5c01('0x81')](_0x5c01('0x82'),'tq')[_0x5c01('0x83')](_0x5c01('0x84'),'ut',_0x5c01('0x85'))[_0x5c01('0x50')]('ChatQueueId\x20=\x20?',_0x150ca9[_0x5c01('0x63')]['id']);for(var _0x1d85ff=0x0;_0x1d85ff<_0x2e8e39[_0x5c01('0x4b')];_0x1d85ff+=0x1){let _0x389110=_0x2e8e39[_0x1d85ff];for(var _0x38e649=0x0;_0x38e649<_0x389110['Agents'][_0x5c01('0x4b')];_0x38e649+=0x1){let _0x26485f=_0x389110[_0x5c01('0x75')][_0x38e649];var _0x446183=_0x1e3b65[_0x5c01('0x86')]();_0x446183['where'](_0x5c01('0x87'),_0x26485f['id']);_0x408824[_0x5c01('0x88')](db[_0x5c01('0x79')][_0x5c01('0x47')](_0x446183['toString'](),{'type':db['sequelize'][_0x5c01('0x89')][_0x5c01('0x8a')]})[_0x5c01('0x39')](function(_0x2dded6){if(_0x2dded6[_0x5c01('0x4b')]===0x1){return _0x26485f['id'];}else{var _0xa18dc1=_[_0x5c01('0x8b')](_[_0x5c01('0x42')](_0x2dded6,'TeamId'),function(_0x37d729){return _['includes'](_0x327ee3,_0x37d729);});if(_0xa18dc1){return _0x26485f['id'];}}}));}}return BPromise[_0x5c01('0x8c')](_0x408824)[_0x5c01('0x39')](function(_0x355fd4){_0x4d7342=_(_0x4d7342)[_0x5c01('0x8d')](_0x355fd4)[_0x5c01('0x8e')]()[_0x5c01('0x8f')]();return db[_0x5c01('0x57')][_0x5c01('0x5b')]({'where':{'id':_0x150ca9[_0x5c01('0x63')]['id']}})[_0x5c01('0x39')](function(_0x2f3873){return db[_0x5c01('0x79')][_0x5c01('0x7a')](function(_0x2e6483){return _0x2f3873[_0x5c01('0x90')](_0x150ca9[_0x5c01('0x47')]['ids'],{'transaction':_0x2e6483})['then'](function(){if(!_[_0x5c01('0x91')](_0x4d7342)){return _0x2f3873[_0x5c01('0x92')](_0x4d7342,{'transaction':_0x2e6483});}})['then'](function(){_0x4d7342[_0x5c01('0x7c')](function(_0x3d5ed8){socket[_0x5c01('0x7d')](_0x5c01('0x93'),{'UserId':_0x3d5ed8,'ChatQueueId':_0x2f3873['id']});});});});});});})[_0x5c01('0x39')](respondWithStatusCode(_0x107988,null))[_0x5c01('0x2d')](handleError(_0x107988,null));};exports[_0x5c01('0x94')]=function(_0x1b8988,_0x318bd4,_0x291d13){return db[_0x5c01('0x57')][_0x5c01('0x5b')]({'where':{'id':_0x1b8988['params']['id']}})[_0x5c01('0x39')](handleEntityNotFound(_0x318bd4,null))[_0x5c01('0x39')](function(_0x294522){if(_0x294522){return _0x294522[_0x5c01('0x94')](_0x1b8988[_0x5c01('0x5d')]['ids'],_[_0x5c01('0x95')](_0x1b8988[_0x5c01('0x5d')],[_0x5c01('0x73'),'id'])||{})[_0x5c01('0x96')](function(_0x2179e5){for(var _0x13f772=0x0;_0x13f772<_0x1b8988['body'][_0x5c01('0x73')][_0x5c01('0x4b')];_0x13f772+=0x1){socket[_0x5c01('0x7d')](_0x5c01('0x7e'),{'UserId':Number(_0x1b8988[_0x5c01('0x5d')][_0x5c01('0x73')][_0x13f772]),'ChatQueueId':Number(_0x1b8988[_0x5c01('0x63')]['id'])});}return _0x2179e5;});}})[_0x5c01('0x39')](respondWithResult(_0x318bd4,null))[_0x5c01('0x2d')](handleError(_0x318bd4,null));};exports[_0x5c01('0x92')]=function(_0x400b1b,_0xc77989,_0x4ff9fa){return db[_0x5c01('0x57')]['find']({'where':{'id':_0x400b1b[_0x5c01('0x63')]['id']}})['then'](handleEntityNotFound(_0xc77989,null))[_0x5c01('0x39')](function(_0x18ae2d){if(_0x18ae2d){return _0x18ae2d['removeAgents'](_0x400b1b['query'][_0x5c01('0x73')])[_0x5c01('0x39')](function(){if(_[_0x5c01('0x97')](_0x400b1b[_0x5c01('0x47')][_0x5c01('0x73')])){for(var _0x232310=0x0;_0x232310<_0x400b1b[_0x5c01('0x47')]['ids'][_0x5c01('0x4b')];_0x232310+=0x1){socket[_0x5c01('0x7d')](_0x5c01('0x93'),{'UserId':Number(_0x400b1b[_0x5c01('0x47')][_0x5c01('0x73')][_0x232310]),'ChatQueueId':Number(_0x400b1b[_0x5c01('0x63')]['id'])});}}else{socket[_0x5c01('0x7d')](_0x5c01('0x93'),{'UserId':Number(_0x400b1b[_0x5c01('0x47')][_0x5c01('0x73')]),'ChatQueueId':Number(_0x400b1b[_0x5c01('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0xc77989,null))[_0x5c01('0x2d')](handleError(_0xc77989,null));};exports[_0x5c01('0x98')]=function(_0x5b3ce1,_0x55fb38,_0xfd6870){var _0x554d01={};var _0x185530={};var _0x2b4595;var _0x446f8a;return db[_0x5c01('0x57')][_0x5c01('0x99')]({'where':{'id':_0x5b3ce1['params']['id']}})['then'](handleEntityNotFound(_0x55fb38,null))[_0x5c01('0x39')](function(_0x10ff7c){if(_0x10ff7c){_0x2b4595=_0x10ff7c;_0x185530[_0x5c01('0x46')]=_[_0x5c01('0x5a')](db[_0x5c01('0x74')]['rawAttributes']);_0x185530[_0x5c01('0x47')]=_['keys'](_0x5b3ce1[_0x5c01('0x47')]);_0x185530[_0x5c01('0x51')]=_[_0x5c01('0x48')](_0x185530[_0x5c01('0x46')],_0x185530[_0x5c01('0x47')]);_0x554d01[_0x5c01('0x49')]=_[_0x5c01('0x48')](_0x185530[_0x5c01('0x46')],qs[_0x5c01('0x4a')](_0x5b3ce1[_0x5c01('0x47')][_0x5c01('0x4a')]));_0x554d01[_0x5c01('0x49')]=_0x554d01[_0x5c01('0x49')][_0x5c01('0x4b')]?_0x554d01['attributes']:_0x185530[_0x5c01('0x46')];_0x554d01[_0x5c01('0x4e')]=qs[_0x5c01('0x4f')](_0x5b3ce1[_0x5c01('0x47')][_0x5c01('0x4f')]);_0x554d01[_0x5c01('0x50')]=qs[_0x5c01('0x51')](_[_0x5c01('0x52')](_0x5b3ce1[_0x5c01('0x47')],_0x185530['filters']));if(_0x5b3ce1[_0x5c01('0x47')][_0x5c01('0x53')]){_0x554d01['where']=_[_0x5c01('0x54')](_0x554d01[_0x5c01('0x50')],{'$or':_[_0x5c01('0x42')](_0x554d01[_0x5c01('0x49')],function(_0x1b54f2){var _0x414241={};_0x414241[_0x1b54f2]={'$like':'%'+_0x5b3ce1[_0x5c01('0x47')]['filter']+'%'};return _0x414241;})});}_0x554d01=_[_0x5c01('0x54')]({},_0x554d01,_0x5b3ce1['options']);return _0x2b4595[_0x5c01('0x98')](_0x554d01);}})[_0x5c01('0x39')](function(_0x345437){if(_0x345437){_0x446f8a=_0x345437['length'];if(!_0x5b3ce1[_0x5c01('0x47')][_0x5c01('0x4c')]('nolimit')){_0x554d01[_0x5c01('0x33')]=qs[_0x5c01('0x33')](_0x5b3ce1[_0x5c01('0x47')]['limit']);_0x554d01[_0x5c01('0x32')]=qs[_0x5c01('0x32')](_0x5b3ce1[_0x5c01('0x47')][_0x5c01('0x32')]);}return _0x2b4595[_0x5c01('0x98')](_0x554d01);}})['then'](function(_0x403b04){if(_0x403b04){return _0x403b04?{'count':_0x446f8a,'rows':_0x403b04}:null;}})[_0x5c01('0x39')](respondWithResult(_0x55fb38,null))[_0x5c01('0x2d')](handleError(_0x55fb38,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 42baf9a..8c96994 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 _0x49d4=['hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x49d4,0x6d));var _0x449d=function(_0x333880,_0x54cb86){_0x333880=_0x333880-0x0;var _0x2926c0=_0x49d4[_0x333880];return _0x2926c0;};'use strict';var EventEmitter=require(_0x449d('0x0'));var ChatQueue=require(_0x449d('0x1'))['db'][_0x449d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x449d('0x3')](0x0);var events={'afterCreate':_0x449d('0x4'),'afterUpdate':_0x449d('0x5'),'afterDestroy':_0x449d('0x6')};function emitEvent(_0x41b796){return function(_0x43a8e9,_0x47f196,_0x3c4d9e){ChatQueueEvents['emit'](_0x41b796+':'+_0x43a8e9['id'],_0x43a8e9);ChatQueueEvents['emit'](_0x41b796,_0x43a8e9);_0x3c4d9e(null);};}for(var e in events){if(events[_0x449d('0x7')](e)){var event=events[e];ChatQueue[_0x449d('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x167e=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5e73e4,_0x88da45){var _0x543578=function(_0x337b68){while(--_0x337b68){_0x5e73e4['push'](_0x5e73e4['shift']());}};_0x543578(++_0x88da45);}(_0x167e,0xa3));var _0xe167=function(_0x379120,_0x438c60){_0x379120=_0x379120-0x0;var _0x16ded2=_0x167e[_0x379120];return _0x16ded2;};'use strict';var EventEmitter=require(_0xe167('0x0'));var ChatQueue=require(_0xe167('0x1'))['db'][_0xe167('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe167('0x3')](0x0);var events={'afterCreate':_0xe167('0x4'),'afterUpdate':_0xe167('0x5'),'afterDestroy':_0xe167('0x6')};function emitEvent(_0x62d76c){return function(_0x5e4863,_0x287097,_0x5d1f39){ChatQueueEvents[_0xe167('0x7')](_0x62d76c+':'+_0x5e4863['id'],_0x5e4863);ChatQueueEvents[_0xe167('0x7')](_0x62d76c,_0x5e4863);_0x5d1f39(null);};}for(var e in events){if(events[_0xe167('0x8')](e)){var event=events[e];ChatQueue[_0xe167('0x9')](e,emitEvent(event));}}module[_0xe167('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6771470..e860da3 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 _0x6336=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x16c694,_0x1009e8){var _0x8440d0=function(_0x4859ca){while(--_0x4859ca){_0x16c694['push'](_0x16c694['shift']());}};_0x8440d0(++_0x1009e8);}(_0x6336,0x1f2));var _0x6633=function(_0x57e056,_0x557075){_0x57e056=_0x57e056-0x0;var _0x32ae48=_0x6336[_0x57e056];return _0x32ae48;};'use strict';var _=require(_0x6633('0x0'));var util=require(_0x6633('0x1'));var logger=require(_0x6633('0x2'))('api');var moment=require(_0x6633('0x3'));var BPromise=require(_0x6633('0x4'));var rp=require(_0x6633('0x5'));var fs=require('fs');var path=require(_0x6633('0x6'));var rimraf=require(_0x6633('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module['exports']=function(_0x3119b3,_0x56b395){return _0x3119b3[_0x6633('0x8')](_0x6633('0x9'),attributes,{'tableName':_0x6633('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x741d=['request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x4bf4d3,_0x1af167){var _0x464fe5=function(_0x245273){while(--_0x245273){_0x4bf4d3['push'](_0x4bf4d3['shift']());}};_0x464fe5(++_0x1af167);}(_0x741d,0xe0));var _0xd741=function(_0x51bee9,_0x44f14d){_0x51bee9=_0x51bee9-0x0;var _0x3cc82b=_0x741d[_0x51bee9];return _0x3cc82b;};'use strict';var _=require(_0xd741('0x0'));var util=require('util');var logger=require(_0xd741('0x1'))(_0xd741('0x2'));var moment=require('moment');var BPromise=require(_0xd741('0x3'));var rp=require(_0xd741('0x4'));var fs=require('fs');var path=require(_0xd741('0x5'));var rimraf=require('rimraf');var config=require(_0xd741('0x6'));var attributes=require(_0xd741('0x7'));module[_0xd741('0x8')]=function(_0x232b53,_0x4d82ee){return _0x232b53[_0xd741('0x9')](_0xd741('0xa'),attributes,{'tableName':_0xd741('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 8953a74..bef5b5b 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 _0x0c99=['GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x0c99,0x1af));var _0x90c9=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x0c99[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0x90c9('0x0'));var util=require(_0x90c9('0x1'));var moment=require(_0x90c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x90c9('0x3'));var fs=require('fs');var Redis=require(_0x90c9('0x4'));var db=require(_0x90c9('0x5'))['db'];var utils=require(_0x90c9('0x6'));var logger=require('../../config/logger')(_0x90c9('0x7'));var config=require(_0x90c9('0x8'));var jayson=require(_0x90c9('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x90c9('0xa')]=_[_0x90c9('0xb')](config[_0x90c9('0xa')],{'host':_0x90c9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x90c9('0xd')](socket);function respondWithRpcPromise(_0x3772d6,_0x1a91cc,_0x5d7ff3){return new BPromise(function(_0x3f0d74,_0x1221ba){return client[_0x90c9('0xe')](_0x3772d6,_0x5d7ff3)[_0x90c9('0xf')](function(_0x29e6e1){logger[_0x90c9('0x10')]('ChatQueue,\x20%s,\x20%s',_0x1a91cc,_0x90c9('0x11'));logger[_0x90c9('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1a91cc,_0x90c9('0x11'),JSON[_0x90c9('0x13')](_0x29e6e1));if(_0x29e6e1[_0x90c9('0x14')]){if(_0x29e6e1[_0x90c9('0x14')][_0x90c9('0x15')]===0x1f4){logger[_0x90c9('0x14')]('ChatQueue,\x20%s,\x20%s',_0x1a91cc,_0x29e6e1[_0x90c9('0x14')][_0x90c9('0x16')]);return _0x1221ba(_0x29e6e1['error'][_0x90c9('0x16')]);}logger[_0x90c9('0x14')](_0x90c9('0x17'),_0x1a91cc,_0x29e6e1[_0x90c9('0x14')]['message']);return _0x3f0d74(_0x29e6e1[_0x90c9('0x14')][_0x90c9('0x16')]);}else{logger[_0x90c9('0x10')](_0x90c9('0x17'),_0x1a91cc,_0x90c9('0x11'));_0x3f0d74(_0x29e6e1[_0x90c9('0x18')][_0x90c9('0x16')]);}})['catch'](function(_0x4af472){logger[_0x90c9('0x14')](_0x90c9('0x17'),_0x1a91cc,_0x4af472);_0x1221ba(_0x4af472);});});}exports[_0x90c9('0x19')]=function(_0x1316f2){var _0x5b28c1=this;return new Promise(function(_0x3ef928,_0x1244c1){return db[_0x90c9('0x1a')]['findAll']({'raw':_0x1316f2[_0x90c9('0x1b')]?_0x1316f2[_0x90c9('0x1b')][_0x90c9('0x1c')]===undefined?!![]:![]:!![],'where':_0x1316f2[_0x90c9('0x1b')]?_0x1316f2[_0x90c9('0x1b')][_0x90c9('0x1d')]||null:null,'attributes':_0x1316f2[_0x90c9('0x1b')]?_0x1316f2[_0x90c9('0x1b')][_0x90c9('0x1e')]||null:null,'limit':_0x1316f2[_0x90c9('0x1b')]?_0x1316f2[_0x90c9('0x1b')][_0x90c9('0x1f')]||null:null,'include':_0x1316f2['options']?_0x1316f2[_0x90c9('0x1b')][_0x90c9('0x20')]?_[_0x90c9('0x21')](_0x1316f2[_0x90c9('0x1b')][_0x90c9('0x20')],function(_0x5b3238){return{'model':db[_0x5b3238['model']],'as':_0x5b3238['as'],'attributes':_0x5b3238[_0x90c9('0x1e')],'include':_0x5b3238[_0x90c9('0x20')]?_['map'](_0x5b3238[_0x90c9('0x20')],function(_0x5470c4){return{'model':db[_0x5470c4['model']],'as':_0x5470c4['as'],'attributes':_0x5470c4[_0x90c9('0x1e')],'include':_0x5470c4['include']?_[_0x90c9('0x21')](_0x5470c4['include'],function(_0x4e855f){return{'model':db[_0x4e855f[_0x90c9('0x22')]],'as':_0x4e855f['as'],'attributes':_0x4e855f[_0x90c9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x90c9('0xf')](function(_0x2b0da3){logger[_0x90c9('0x10')](_0x90c9('0x19'),_0x1316f2);logger[_0x90c9('0x12')](_0x90c9('0x19'),_0x1316f2,JSON['stringify'](_0x2b0da3));_0x3ef928(_0x2b0da3);})[_0x90c9('0x23')](function(_0x1492b0){logger[_0x90c9('0x14')]('GetChatQueue',_0x1492b0[_0x90c9('0x16')],_0x1316f2);_0x1244c1(_0x5b28c1[_0x90c9('0x14')](0x1f4,_0x1492b0['message']));});});};exports[_0x90c9('0x24')]=function(_0x470226){var _0x2f57b3=this;return new Promise(function(_0x44bf91,_0x4ce9e6){return db[_0x90c9('0x1a')][_0x90c9('0x25')]({'raw':_0x470226[_0x90c9('0x1b')]?_0x470226[_0x90c9('0x1b')][_0x90c9('0x1c')]===undefined?!![]:![]:!![],'where':_0x470226['options']?_0x470226[_0x90c9('0x1b')]['where']||null:null,'attributes':_0x470226[_0x90c9('0x1b')]?_0x470226[_0x90c9('0x1b')]['attributes']||null:null,'include':_0x470226[_0x90c9('0x1b')]?_0x470226[_0x90c9('0x1b')][_0x90c9('0x20')]?_['map'](_0x470226['options'][_0x90c9('0x20')],function(_0x2da529){return{'model':db[_0x2da529[_0x90c9('0x22')]],'as':_0x2da529['as'],'attributes':_0x2da529[_0x90c9('0x1e')],'include':_0x2da529['include']?_[_0x90c9('0x21')](_0x2da529[_0x90c9('0x20')],function(_0xec5d2c){return{'model':db[_0xec5d2c['model']],'as':_0xec5d2c['as'],'attributes':_0xec5d2c[_0x90c9('0x1e')],'include':_0xec5d2c[_0x90c9('0x20')]?_[_0x90c9('0x21')](_0xec5d2c[_0x90c9('0x20')],function(_0x1378c4){return{'model':db[_0x1378c4['model']],'as':_0x1378c4['as'],'attributes':_0x1378c4[_0x90c9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e9477){logger[_0x90c9('0x10')]('ShowChatQueue',_0x470226);logger[_0x90c9('0x12')]('ShowChatQueue',_0x470226,JSON[_0x90c9('0x13')](_0x3e9477));_0x44bf91(_0x3e9477);})[_0x90c9('0x23')](function(_0x3c342b){logger[_0x90c9('0x14')]('ShowChatQueue',_0x3c342b['message'],_0x470226);_0x4ce9e6(_0x2f57b3[_0x90c9('0x14')](0x1f4,_0x3c342b['message']));});});}; \ No newline at end of file +var _0xb974=['ShowChatQueue','ChatQueue','find','where','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','options','raw','include','model','map','attributes','then','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb974,0xb3));var _0x4b97=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb974[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4b97('0x0'));var util=require(_0x4b97('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b97('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b97('0x3'))(_0x4b97('0x4'));var config=require(_0x4b97('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4b97('0x6')]['http']({'port':0x232a});config[_0x4b97('0x7')]=_['defaults'](config[_0x4b97('0x7')],{'host':_0x4b97('0x8'),'port':0x18eb});var socket=require(_0x4b97('0x9'))(new Redis(config[_0x4b97('0x7')]));require('./chatQueue.socket')[_0x4b97('0xa')](socket);function respondWithRpcPromise(_0xfb45df,_0x4cb1be,_0x409dec){return new BPromise(function(_0x4b32a8,_0xe5ccbd){return client[_0x4b97('0xb')](_0xfb45df,_0x409dec)['then'](function(_0x2dc86a){logger[_0x4b97('0xc')]('ChatQueue,\x20%s,\x20%s',_0x4cb1be,_0x4b97('0xd'));logger[_0x4b97('0xe')](_0x4b97('0xf'),_0x4cb1be,'request\x20sent',JSON['stringify'](_0x2dc86a));if(_0x2dc86a[_0x4b97('0x10')]){if(_0x2dc86a[_0x4b97('0x10')][_0x4b97('0x11')]===0x1f4){logger[_0x4b97('0x10')](_0x4b97('0x12'),_0x4cb1be,_0x2dc86a[_0x4b97('0x10')][_0x4b97('0x13')]);return _0xe5ccbd(_0x2dc86a[_0x4b97('0x10')]['message']);}logger[_0x4b97('0x10')](_0x4b97('0x12'),_0x4cb1be,_0x2dc86a[_0x4b97('0x10')][_0x4b97('0x13')]);return _0x4b32a8(_0x2dc86a[_0x4b97('0x10')][_0x4b97('0x13')]);}else{logger[_0x4b97('0xc')](_0x4b97('0x12'),_0x4cb1be,'request\x20sent');_0x4b32a8(_0x2dc86a[_0x4b97('0x14')][_0x4b97('0x13')]);}})[_0x4b97('0x15')](function(_0x3e8b92){logger[_0x4b97('0x10')](_0x4b97('0x12'),_0x4cb1be,_0x3e8b92);_0xe5ccbd(_0x3e8b92);});});}exports[_0x4b97('0x16')]=function(_0x429f24){var _0x51e38a=this;return new Promise(function(_0x3b1e62,_0x580bad){return db['ChatQueue']['findAll']({'raw':_0x429f24['options']?_0x429f24[_0x4b97('0x17')][_0x4b97('0x18')]===undefined?!![]:![]:!![],'where':_0x429f24[_0x4b97('0x17')]?_0x429f24['options']['where']||null:null,'attributes':_0x429f24[_0x4b97('0x17')]?_0x429f24[_0x4b97('0x17')]['attributes']||null:null,'limit':_0x429f24['options']?_0x429f24['options']['limit']||null:null,'include':_0x429f24['options']?_0x429f24[_0x4b97('0x17')]['include']?_['map'](_0x429f24[_0x4b97('0x17')][_0x4b97('0x19')],function(_0x38d07b){return{'model':db[_0x38d07b[_0x4b97('0x1a')]],'as':_0x38d07b['as'],'attributes':_0x38d07b['attributes'],'include':_0x38d07b['include']?_[_0x4b97('0x1b')](_0x38d07b[_0x4b97('0x19')],function(_0x40a928){return{'model':db[_0x40a928['model']],'as':_0x40a928['as'],'attributes':_0x40a928['attributes'],'include':_0x40a928[_0x4b97('0x19')]?_[_0x4b97('0x1b')](_0x40a928[_0x4b97('0x19')],function(_0xb8e15c){return{'model':db[_0xb8e15c[_0x4b97('0x1a')]],'as':_0xb8e15c['as'],'attributes':_0xb8e15c[_0x4b97('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4b97('0x1d')](function(_0x4583f9){logger[_0x4b97('0xc')](_0x4b97('0x16'),_0x429f24);logger['debug'](_0x4b97('0x16'),_0x429f24,JSON[_0x4b97('0x1e')](_0x4583f9));_0x3b1e62(_0x4583f9);})[_0x4b97('0x15')](function(_0x100839){logger[_0x4b97('0x10')](_0x4b97('0x16'),_0x100839['message'],_0x429f24);_0x580bad(_0x51e38a['error'](0x1f4,_0x100839[_0x4b97('0x13')]));});});};exports[_0x4b97('0x1f')]=function(_0x4560da){var _0x3cff48=this;return new Promise(function(_0xc603a1,_0x1883f0){return db[_0x4b97('0x20')][_0x4b97('0x21')]({'raw':_0x4560da[_0x4b97('0x17')]?_0x4560da[_0x4b97('0x17')][_0x4b97('0x18')]===undefined?!![]:![]:!![],'where':_0x4560da[_0x4b97('0x17')]?_0x4560da[_0x4b97('0x17')][_0x4b97('0x22')]||null:null,'attributes':_0x4560da[_0x4b97('0x17')]?_0x4560da[_0x4b97('0x17')][_0x4b97('0x1c')]||null:null,'include':_0x4560da[_0x4b97('0x17')]?_0x4560da['options'][_0x4b97('0x19')]?_['map'](_0x4560da[_0x4b97('0x17')][_0x4b97('0x19')],function(_0x455c60){return{'model':db[_0x455c60[_0x4b97('0x1a')]],'as':_0x455c60['as'],'attributes':_0x455c60[_0x4b97('0x1c')],'include':_0x455c60[_0x4b97('0x19')]?_[_0x4b97('0x1b')](_0x455c60[_0x4b97('0x19')],function(_0x57bdd3){return{'model':db[_0x57bdd3[_0x4b97('0x1a')]],'as':_0x57bdd3['as'],'attributes':_0x57bdd3['attributes'],'include':_0x57bdd3[_0x4b97('0x19')]?_[_0x4b97('0x1b')](_0x57bdd3[_0x4b97('0x19')],function(_0x572c62){return{'model':db[_0x572c62[_0x4b97('0x1a')]],'as':_0x572c62['as'],'attributes':_0x572c62[_0x4b97('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4b97('0x1d')](function(_0x43323f){logger['info'](_0x4b97('0x1f'),_0x4560da);logger[_0x4b97('0xe')](_0x4b97('0x1f'),_0x4560da,JSON[_0x4b97('0x1e')](_0x43323f));_0xc603a1(_0x43323f);})[_0x4b97('0x15')](function(_0x1598b8){logger[_0x4b97('0x10')]('ShowChatQueue',_0x1598b8['message'],_0x4560da);_0x1883f0(_0x3cff48[_0x4b97('0x10')](0x1f4,_0x1598b8[_0x4b97('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 98a1307..dba7e9c 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 _0xb903=['update','emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xb903,0x185));var _0x3b90=function(_0x306a7a,_0x5d4434){_0x306a7a=_0x306a7a-0x0;var _0x48f18e=_0xb903[_0x306a7a];return _0x48f18e;};'use strict';var ChatQueueEvents=require(_0x3b90('0x0'));var events=[_0x3b90('0x1'),_0x3b90('0x2'),_0x3b90('0x3')];function createListener(_0x5191d8,_0x3312ca){return function(_0xf414f4){_0x3312ca[_0x3b90('0x4')](_0x5191d8,_0xf414f4);};}function removeListener(_0x1cd5d8,_0x30d8db){return function(){ChatQueueEvents[_0x3b90('0x5')](_0x1cd5d8,_0x30d8db);};}exports[_0x3b90('0x6')]=function(_0x5acd76){for(var _0x15b68f=0x0,_0x5e845a=events['length'];_0x15b68f<_0x5e845a;_0x15b68f++){var _0x153283=events[_0x15b68f];var _0x2e4c06=createListener(_0x3b90('0x7')+_0x153283,_0x5acd76);ChatQueueEvents['on'](_0x153283,_0x2e4c06);}}; \ No newline at end of file +var _0x7bae=['remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x42dd53,_0xec94a){var _0x3d77cb=function(_0x3d29c7){while(--_0x3d29c7){_0x42dd53['push'](_0x42dd53['shift']());}};_0x3d77cb(++_0xec94a);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7bae[_0x4baae2];return _0x1a2285;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){ChatQueueEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);ChatQueueEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9a5dbb8..c3bf7d3 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(_0x538946,_0x56a711){var _0x1b69da=function(_0x411b4d){while(--_0x411b4d){_0x538946['push'](_0x538946['shift']());}};_0x1b69da(++_0x56a711);}(_0x008c,0x188));var _0xc008=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0x008c[_0x11c4b6];return _0x2cb405;};'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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x38e919,_0xb59a62){var _0x35b6cb=function(_0x45999a){while(--_0x45999a){_0x38e919['push'](_0x38e919['shift']());}};_0x35b6cb(++_0xb59a62);}(_0xe14b,0x93));var _0xbe14=function(_0x40eb15,_0x5b439b){_0x40eb15=_0x40eb15-0x0;var _0x3a6f86=_0xe14b[_0x40eb15];return _0x3a6f86;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1b32a61..8d3c8b1 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 _0xad66=['moment','sequelize','exports','DATE'];(function(_0x1f7e09,_0x1a1003){var _0x5c30b4=function(_0xc757cc){while(--_0xc757cc){_0x1f7e09['push'](_0x1f7e09['shift']());}};_0x5c30b4(++_0x1a1003);}(_0xad66,0x8c));var _0x6ad6=function(_0x4c5d45,_0x59c320){_0x4c5d45=_0x4c5d45-0x0;var _0x7a4a8b=_0xad66[_0x4c5d45];return _0x7a4a8b;};'use strict';var moment=require(_0x6ad6('0x0'));var Sequelize=require(_0x6ad6('0x1'));module[_0x6ad6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6ad6('0x3')]},'leaveAt':{'type':Sequelize[_0x6ad6('0x3')]},'acceptAt':{'type':Sequelize[_0x6ad6('0x3')]},'exitAt':{'type':Sequelize[_0x6ad6('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41c5=['DATE','moment','sequelize','exports','STRING'];(function(_0x1fd597,_0x4d1d31){var _0x441c67=function(_0x4ae701){while(--_0x4ae701){_0x1fd597['push'](_0x1fd597['shift']());}};_0x441c67(++_0x4d1d31);}(_0x41c5,0x146));var _0x541c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x41c5[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0x541c('0x0'));var Sequelize=require(_0x541c('0x1'));module[_0x541c('0x2')]={'uniqueid':{'type':Sequelize[_0x541c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x541c('0x4')]},'leaveAt':{'type':Sequelize[_0x541c('0x4')]},'acceptAt':{'type':Sequelize[_0x541c('0x4')]},'exitAt':{'type':Sequelize[_0x541c('0x4')]},'reason':{'type':Sequelize[_0x541c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f2c947a..59d97e4 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 _0xed54=['destroy','then','end','error','name','index','map','fieldName','type','key','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','ChatQueueReport','catch','params','model','rawAttributes','includeAll','include','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x2ad063,_0x1f2848){var _0x529619=function(_0x5398e8){while(--_0x5398e8){_0x2ad063['push'](_0x2ad063['shift']());}};_0x529619(++_0x1f2848);}(_0xed54,0xfc));var _0x4ed5=function(_0x1d36dc,_0x19555b){_0x1d36dc=_0x1d36dc-0x0;var _0x36ca0c=_0xed54[_0x1d36dc];return _0x36ca0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ed5('0x0'));var zipdir=require(_0x4ed5('0x1'));var jsonpatch=require(_0x4ed5('0x2'));var rp=require(_0x4ed5('0x3'));var moment=require('moment');var BPromise=require(_0x4ed5('0x4'));var Mustache=require(_0x4ed5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4ed5('0x6'));var csv=require(_0x4ed5('0x7'));var ejs=require(_0x4ed5('0x8'));var fs=require('fs');var fs_extra=require(_0x4ed5('0x9'));var _=require(_0x4ed5('0xa'));var squel=require(_0x4ed5('0xb'));var crypto=require(_0x4ed5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ed5('0xd'));var toCsv=require(_0x4ed5('0x7'));var querystring=require(_0x4ed5('0xe'));var Papa=require(_0x4ed5('0xf'));var Redis=require(_0x4ed5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ed5('0x11'));var as=require(_0x4ed5('0x12'));var hardwareService=require(_0x4ed5('0x13'));var logger=require(_0x4ed5('0x14'))(_0x4ed5('0x15'));var utils=require('../../config/utils');var config=require(_0x4ed5('0x16'));var licenseUtil=require(_0x4ed5('0x17'));var db=require(_0x4ed5('0x18'))['db'];function respondWithStatusCode(_0x72b1bd,_0x409d5b){_0x409d5b=_0x409d5b||0xcc;return function(_0x2f9ddd){if(_0x2f9ddd){return _0x72b1bd[_0x4ed5('0x19')](_0x409d5b);}return _0x72b1bd[_0x4ed5('0x1a')](_0x409d5b)['end']();};}function respondWithResult(_0x4c9fc0,_0xc946a1){_0xc946a1=_0xc946a1||0xc8;return function(_0x3468df){if(_0x3468df){return _0x4c9fc0[_0x4ed5('0x1a')](_0xc946a1)[_0x4ed5('0x1b')](_0x3468df);}};}function respondWithFilteredResult(_0x27469b,_0x148458){return function(_0x44b770){if(_0x44b770){var _0x234373=typeof _0x148458[_0x4ed5('0x1c')]===_0x4ed5('0x1d')&&typeof _0x148458[_0x4ed5('0x1e')]===_0x4ed5('0x1d');var _0x10a16c=_0x44b770[_0x4ed5('0x1f')];var _0x16a940=_0x234373?0x0:_0x148458[_0x4ed5('0x1c')];var _0x584745=_0x234373?_0x44b770[_0x4ed5('0x1f')]:_0x148458[_0x4ed5('0x1c')]+_0x148458[_0x4ed5('0x1e')];var _0x4cad03;if(_0x584745>=_0x10a16c){_0x584745=_0x10a16c;_0x4cad03=0xc8;}else{_0x4cad03=0xce;}_0x27469b[_0x4ed5('0x1a')](_0x4cad03);return _0x27469b[_0x4ed5('0x20')](_0x4ed5('0x21'),_0x16a940+'-'+_0x584745+'/'+_0x10a16c)[_0x4ed5('0x1b')](_0x44b770);}return null;};}function patchUpdates(_0x1b4707){return function(_0xb734f7){try{jsonpatch[_0x4ed5('0x22')](_0xb734f7,_0x1b4707,!![]);}catch(_0x372452){return BPromise['reject'](_0x372452);}return _0xb734f7[_0x4ed5('0x23')]();};}function saveUpdates(_0x2a2166,_0x4f59d2){return function(_0x32d181){if(_0x32d181){return _0x32d181['update'](_0x2a2166)['then'](function(_0x576458){return _0x576458;});}return null;};}function removeEntity(_0x1377ef,_0x506906){return function(_0x367593){if(_0x367593){return _0x367593[_0x4ed5('0x24')]()[_0x4ed5('0x25')](function(){_0x1377ef[_0x4ed5('0x1a')](0xcc)[_0x4ed5('0x26')]();});}};}function handleEntityNotFound(_0x28667a,_0x25833e){return function(_0x4f23c3){if(!_0x4f23c3){_0x28667a[_0x4ed5('0x19')](0x194);}return _0x4f23c3;};}function handleError(_0x35d980,_0x33edef){_0x33edef=_0x33edef||0x1f4;return function(_0x3a60bc){logger[_0x4ed5('0x27')](_0x3a60bc['stack']);if(_0x3a60bc[_0x4ed5('0x28')]){delete _0x3a60bc[_0x4ed5('0x28')];}_0x35d980[_0x4ed5('0x1a')](_0x33edef)['send'](_0x3a60bc);};}exports[_0x4ed5('0x29')]=function(_0x4baa26,_0x53dec6){var _0x2f3f5b={},_0x18d3d0={},_0x59de67={'count':0x0,'rows':[]};var _0x3cfcb1=_[_0x4ed5('0x2a')](db['ChatQueueReport']['rawAttributes'],function(_0x2e40be){return{'name':_0x2e40be[_0x4ed5('0x2b')],'type':_0x2e40be[_0x4ed5('0x2c')][_0x4ed5('0x2d')]};});_0x18d3d0['model']=_[_0x4ed5('0x2a')](_0x3cfcb1,_0x4ed5('0x28'));_0x18d3d0[_0x4ed5('0x2e')]=_[_0x4ed5('0x2f')](_0x4baa26['query']);_0x18d3d0[_0x4ed5('0x30')]=_['intersection'](_0x18d3d0['model'],_0x18d3d0[_0x4ed5('0x2e')]);_0x2f3f5b[_0x4ed5('0x31')]=_['intersection'](_0x18d3d0['model'],qs[_0x4ed5('0x32')](_0x4baa26[_0x4ed5('0x2e')][_0x4ed5('0x32')]));_0x2f3f5b['attributes']=_0x2f3f5b[_0x4ed5('0x31')][_0x4ed5('0x33')]?_0x2f3f5b[_0x4ed5('0x31')]:_0x18d3d0['model'];if(!_0x4baa26['query']['hasOwnProperty'](_0x4ed5('0x34'))){_0x2f3f5b[_0x4ed5('0x1e')]=qs['limit'](_0x4baa26[_0x4ed5('0x2e')]['limit']);_0x2f3f5b['offset']=qs[_0x4ed5('0x1c')](_0x4baa26['query'][_0x4ed5('0x1c')]);}_0x2f3f5b[_0x4ed5('0x35')]=qs[_0x4ed5('0x36')](_0x4baa26[_0x4ed5('0x2e')][_0x4ed5('0x36')]);_0x2f3f5b[_0x4ed5('0x37')]=qs[_0x4ed5('0x30')](_[_0x4ed5('0x38')](_0x4baa26[_0x4ed5('0x2e')],_0x18d3d0['filters']),_0x3cfcb1);if(_0x4baa26[_0x4ed5('0x2e')][_0x4ed5('0x39')]){_0x2f3f5b[_0x4ed5('0x37')]=_['merge'](_0x2f3f5b['where'],{'$or':_['map'](_0x3cfcb1,function(_0x246112){if(_0x246112['type']!=='VIRTUAL'){var _0x184187={};_0x184187[_0x246112[_0x4ed5('0x28')]]={'$like':'%'+_0x4baa26[_0x4ed5('0x2e')][_0x4ed5('0x39')]+'%'};return _0x184187;}})});}_0x2f3f5b=_[_0x4ed5('0x3a')]({},_0x2f3f5b,_0x4baa26[_0x4ed5('0x3b')]);var _0x3b1805={'where':_0x2f3f5b[_0x4ed5('0x37')]};return db[_0x4ed5('0x3c')][_0x4ed5('0x1f')](_0x3b1805)[_0x4ed5('0x25')](function(_0x3bf099){_0x59de67[_0x4ed5('0x1f')]=_0x3bf099;if(_0x4baa26['query']['includeAll']){_0x2f3f5b['include']=[{'all':!![]}];}return db[_0x4ed5('0x3c')]['findAll'](_0x2f3f5b);})[_0x4ed5('0x25')](function(_0xbf9c15){_0x59de67['rows']=_0xbf9c15;return _0x59de67;})[_0x4ed5('0x25')](respondWithFilteredResult(_0x53dec6,_0x2f3f5b))[_0x4ed5('0x3d')](handleError(_0x53dec6,null));};exports['show']=function(_0x1abc98,_0x4a0b8d){var _0xbaf044={'raw':!![],'where':{'id':_0x1abc98[_0x4ed5('0x3e')]['id']}},_0x33d7ea={};_0x33d7ea[_0x4ed5('0x3f')]=_[_0x4ed5('0x2f')](db[_0x4ed5('0x3c')][_0x4ed5('0x40')]);_0x33d7ea[_0x4ed5('0x2e')]=_[_0x4ed5('0x2f')](_0x1abc98[_0x4ed5('0x2e')]);_0x33d7ea[_0x4ed5('0x30')]=_['intersection'](_0x33d7ea[_0x4ed5('0x3f')],_0x33d7ea['query']);_0xbaf044['attributes']=_['intersection'](_0x33d7ea[_0x4ed5('0x3f')],qs[_0x4ed5('0x32')](_0x1abc98[_0x4ed5('0x2e')][_0x4ed5('0x32')]));_0xbaf044[_0x4ed5('0x31')]=_0xbaf044['attributes'][_0x4ed5('0x33')]?_0xbaf044[_0x4ed5('0x31')]:_0x33d7ea[_0x4ed5('0x3f')];if(_0x1abc98[_0x4ed5('0x2e')][_0x4ed5('0x41')]){_0xbaf044[_0x4ed5('0x42')]=[{'all':!![]}];}_0xbaf044=_[_0x4ed5('0x3a')]({},_0xbaf044,_0x1abc98['options']);return db[_0x4ed5('0x3c')][_0x4ed5('0x43')](_0xbaf044)[_0x4ed5('0x25')](handleEntityNotFound(_0x4a0b8d,null))['then'](respondWithResult(_0x4a0b8d,null))[_0x4ed5('0x3d')](handleError(_0x4a0b8d,null));};exports['create']=function(_0x19ea01,_0x5c71ec){return db[_0x4ed5('0x3c')][_0x4ed5('0x44')](_0x19ea01['body'],{})[_0x4ed5('0x25')](respondWithResult(_0x5c71ec,0xc9))[_0x4ed5('0x3d')](handleError(_0x5c71ec,null));};exports[_0x4ed5('0x45')]=function(_0x55b0ba,_0x27b4d5){if(_0x55b0ba[_0x4ed5('0x46')]['id']){delete _0x55b0ba[_0x4ed5('0x46')]['id'];}return db[_0x4ed5('0x3c')][_0x4ed5('0x43')]({'where':{'id':_0x55b0ba[_0x4ed5('0x3e')]['id']}})[_0x4ed5('0x25')](handleEntityNotFound(_0x27b4d5,null))[_0x4ed5('0x25')](saveUpdates(_0x55b0ba['body'],null))['then'](respondWithResult(_0x27b4d5,null))[_0x4ed5('0x3d')](handleError(_0x27b4d5,null));};exports['destroy']=function(_0x34326d,_0x422609){return db[_0x4ed5('0x3c')][_0x4ed5('0x43')]({'where':{'id':_0x34326d['params']['id']}})[_0x4ed5('0x25')](handleEntityNotFound(_0x422609,null))[_0x4ed5('0x25')](removeEntity(_0x422609,null))[_0x4ed5('0x3d')](handleError(_0x422609,null));};exports[_0x4ed5('0x47')]=function(_0x412f29,_0x344a89){return db[_0x4ed5('0x3c')][_0x4ed5('0x47')]()[_0x4ed5('0x25')](respondWithResult(_0x344a89,null))[_0x4ed5('0x3d')](handleError(_0x344a89,null));}; \ No newline at end of file +var _0xe451=['count','update','then','destroy','sendStatus','error','name','send','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit'];(function(_0x550ba0,_0x3d6294){var _0xe97e7b=function(_0x49aeb1){while(--_0x49aeb1){_0x550ba0['push'](_0x550ba0['shift']());}};_0xe97e7b(++_0x3d6294);}(_0xe451,0xec));var _0x1e45=function(_0x238f26,_0x317421){_0x238f26=_0x238f26-0x0;var _0x7798e7=_0xe451[_0x238f26];return _0x7798e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e45('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e45('0x1'));var Mustache=require(_0x1e45('0x2'));var util=require(_0x1e45('0x3'));var path=require(_0x1e45('0x4'));var sox=require('sox');var csv=require(_0x1e45('0x5'));var ejs=require(_0x1e45('0x6'));var fs=require('fs');var fs_extra=require(_0x1e45('0x7'));var _=require('lodash');var squel=require(_0x1e45('0x8'));var crypto=require(_0x1e45('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e45('0x5'));var querystring=require(_0x1e45('0xa'));var Papa=require(_0x1e45('0xb'));var Redis=require('ioredis');var authService=require(_0x1e45('0xc'));var qs=require(_0x1e45('0xd'));var as=require(_0x1e45('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e45('0xf'));var utils=require(_0x1e45('0x10'));var config=require(_0x1e45('0x11'));var licenseUtil=require(_0x1e45('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cafc,_0x2ec564){_0x2ec564=_0x2ec564||0xcc;return function(_0x3d25a8){if(_0x3d25a8){return _0x16cafc['sendStatus'](_0x2ec564);}return _0x16cafc[_0x1e45('0x13')](_0x2ec564)[_0x1e45('0x14')]();};}function respondWithResult(_0x31215a,_0x21f68d){_0x21f68d=_0x21f68d||0xc8;return function(_0x5b3ee1){if(_0x5b3ee1){return _0x31215a[_0x1e45('0x13')](_0x21f68d)['json'](_0x5b3ee1);}};}function respondWithFilteredResult(_0xf66042,_0x2c7ace){return function(_0x4e1400){if(_0x4e1400){var _0xfdeae3=typeof _0x2c7ace[_0x1e45('0x15')]===_0x1e45('0x16')&&typeof _0x2c7ace[_0x1e45('0x17')]===_0x1e45('0x16');var _0x308c29=_0x4e1400[_0x1e45('0x18')];var _0x2a6f47=_0xfdeae3?0x0:_0x2c7ace[_0x1e45('0x15')];var _0x5d24a7=_0xfdeae3?_0x4e1400[_0x1e45('0x18')]:_0x2c7ace['offset']+_0x2c7ace['limit'];var _0x17c63a;if(_0x5d24a7>=_0x308c29){_0x5d24a7=_0x308c29;_0x17c63a=0xc8;}else{_0x17c63a=0xce;}_0xf66042['status'](_0x17c63a);return _0xf66042['set']('Content-Range',_0x2a6f47+'-'+_0x5d24a7+'/'+_0x308c29)['json'](_0x4e1400);}return null;};}function patchUpdates(_0x207335){return function(_0x4476eb){try{jsonpatch['apply'](_0x4476eb,_0x207335,!![]);}catch(_0xc0deec){return BPromise['reject'](_0xc0deec);}return _0x4476eb['save']();};}function saveUpdates(_0x41cfae,_0x59aaa7){return function(_0x4ffe97){if(_0x4ffe97){return _0x4ffe97[_0x1e45('0x19')](_0x41cfae)[_0x1e45('0x1a')](function(_0x4ce4c5){return _0x4ce4c5;});}return null;};}function removeEntity(_0x48209a,_0x2fb478){return function(_0x40c216){if(_0x40c216){return _0x40c216[_0x1e45('0x1b')]()[_0x1e45('0x1a')](function(){_0x48209a[_0x1e45('0x13')](0xcc)[_0x1e45('0x14')]();});}};}function handleEntityNotFound(_0x55e968,_0x3f6771){return function(_0x394f7e){if(!_0x394f7e){_0x55e968[_0x1e45('0x1c')](0x194);}return _0x394f7e;};}function handleError(_0x25b131,_0x1a8355){_0x1a8355=_0x1a8355||0x1f4;return function(_0xfd7633){logger[_0x1e45('0x1d')](_0xfd7633['stack']);if(_0xfd7633[_0x1e45('0x1e')]){delete _0xfd7633[_0x1e45('0x1e')];}_0x25b131[_0x1e45('0x13')](_0x1a8355)[_0x1e45('0x1f')](_0xfd7633);};}exports['index']=function(_0xe7cdcf,_0x34046e){var _0x3dd6c3={},_0x5229e7={},_0x3def67={'count':0x0,'rows':[]};var _0x4a04aa=_[_0x1e45('0x20')](db['ChatQueueReport']['rawAttributes'],function(_0x34d75e){return{'name':_0x34d75e[_0x1e45('0x21')],'type':_0x34d75e[_0x1e45('0x22')][_0x1e45('0x23')]};});_0x5229e7['model']=_[_0x1e45('0x20')](_0x4a04aa,'name');_0x5229e7[_0x1e45('0x24')]=_[_0x1e45('0x25')](_0xe7cdcf[_0x1e45('0x24')]);_0x5229e7['filters']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],_0x5229e7[_0x1e45('0x24')]);_0x3dd6c3['attributes']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],qs[_0x1e45('0x28')](_0xe7cdcf[_0x1e45('0x24')]['fields']));_0x3dd6c3[_0x1e45('0x29')]=_0x3dd6c3[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x3dd6c3[_0x1e45('0x29')]:_0x5229e7[_0x1e45('0x27')];if(!_0xe7cdcf['query']['hasOwnProperty']('nolimit')){_0x3dd6c3['limit']=qs[_0x1e45('0x17')](_0xe7cdcf['query'][_0x1e45('0x17')]);_0x3dd6c3[_0x1e45('0x15')]=qs['offset'](_0xe7cdcf['query'][_0x1e45('0x15')]);}_0x3dd6c3[_0x1e45('0x2b')]=qs[_0x1e45('0x2c')](_0xe7cdcf[_0x1e45('0x24')]['sort']);_0x3dd6c3[_0x1e45('0x2d')]=qs[_0x1e45('0x2e')](_[_0x1e45('0x2f')](_0xe7cdcf[_0x1e45('0x24')],_0x5229e7['filters']),_0x4a04aa);if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]){_0x3dd6c3[_0x1e45('0x2d')]=_['merge'](_0x3dd6c3['where'],{'$or':_[_0x1e45('0x20')](_0x4a04aa,function(_0x47c200){if(_0x47c200['type']!==_0x1e45('0x31')){var _0x587a0a={};_0x587a0a[_0x47c200['name']]={'$like':'%'+_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]+'%'};return _0x587a0a;}})});}_0x3dd6c3=_[_0x1e45('0x32')]({},_0x3dd6c3,_0xe7cdcf[_0x1e45('0x33')]);var _0x11a327={'where':_0x3dd6c3[_0x1e45('0x2d')]};return db[_0x1e45('0x34')][_0x1e45('0x18')](_0x11a327)[_0x1e45('0x1a')](function(_0x53713a){_0x3def67[_0x1e45('0x18')]=_0x53713a;if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x35')]){_0x3dd6c3[_0x1e45('0x36')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x1e45('0x37')](_0x3dd6c3);})[_0x1e45('0x1a')](function(_0x2984ae){_0x3def67[_0x1e45('0x38')]=_0x2984ae;return _0x3def67;})['then'](respondWithFilteredResult(_0x34046e,_0x3dd6c3))[_0x1e45('0x39')](handleError(_0x34046e,null));};exports[_0x1e45('0x3a')]=function(_0x32a42a,_0x393a50){var _0x522b40={'raw':!![],'where':{'id':_0x32a42a[_0x1e45('0x3b')]['id']}},_0x460d38={};_0x460d38[_0x1e45('0x27')]=_[_0x1e45('0x25')](db[_0x1e45('0x34')][_0x1e45('0x3c')]);_0x460d38['query']=_[_0x1e45('0x25')](_0x32a42a['query']);_0x460d38[_0x1e45('0x2e')]=_[_0x1e45('0x26')](_0x460d38[_0x1e45('0x27')],_0x460d38[_0x1e45('0x24')]);_0x522b40[_0x1e45('0x29')]=_[_0x1e45('0x26')](_0x460d38['model'],qs[_0x1e45('0x28')](_0x32a42a[_0x1e45('0x24')][_0x1e45('0x28')]));_0x522b40['attributes']=_0x522b40[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x522b40[_0x1e45('0x29')]:_0x460d38['model'];if(_0x32a42a['query']['includeAll']){_0x522b40[_0x1e45('0x36')]=[{'all':!![]}];}_0x522b40=_[_0x1e45('0x32')]({},_0x522b40,_0x32a42a[_0x1e45('0x33')]);return db[_0x1e45('0x34')]['find'](_0x522b40)[_0x1e45('0x1a')](handleEntityNotFound(_0x393a50,null))[_0x1e45('0x1a')](respondWithResult(_0x393a50,null))[_0x1e45('0x39')](handleError(_0x393a50,null));};exports[_0x1e45('0x3d')]=function(_0x3994d8,_0x53e41b){return db[_0x1e45('0x34')][_0x1e45('0x3d')](_0x3994d8[_0x1e45('0x3e')],{})[_0x1e45('0x1a')](respondWithResult(_0x53e41b,0xc9))[_0x1e45('0x39')](handleError(_0x53e41b,null));};exports['update']=function(_0x374c32,_0x14b06f){if(_0x374c32[_0x1e45('0x3e')]['id']){delete _0x374c32[_0x1e45('0x3e')]['id'];}return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x374c32['params']['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x14b06f,null))[_0x1e45('0x1a')](saveUpdates(_0x374c32['body'],null))[_0x1e45('0x1a')](respondWithResult(_0x14b06f,null))['catch'](handleError(_0x14b06f,null));};exports[_0x1e45('0x1b')]=function(_0x3e6845,_0x5bafc7){return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x3e6845[_0x1e45('0x3b')]['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x5bafc7,null))[_0x1e45('0x1a')](removeEntity(_0x5bafc7,null))[_0x1e45('0x39')](handleError(_0x5bafc7,null));};exports[_0x1e45('0x40')]=function(_0x4cdf47,_0x2f19f3){return db[_0x1e45('0x34')]['describe']()['then'](respondWithResult(_0x2f19f3,null))[_0x1e45('0x39')](handleError(_0x2f19f3,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2dd4da3..fe6f0d6 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x151796,_0x45ef38){var _0x75ebc0=function(_0x1715c8){while(--_0x1715c8){_0x151796['push'](_0x151796['shift']());}};_0x75ebc0(++_0x45ef38);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1940b5,_0x110ba0){var _0x31e95e=function(_0x3491b0){while(--_0x3491b0){_0x1940b5['push'](_0x1940b5['shift']());}};_0x31e95e(++_0x110ba0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xcb91[_0x3e182f];return _0x23edc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e25f87d..38945e3 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 _0xbef7=['ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x2dc11f,_0xc8e133){var _0x5417a3=function(_0xeb3f3a){while(--_0xeb3f3a){_0x2dc11f['push'](_0x2dc11f['shift']());}};_0x5417a3(++_0xc8e133);}(_0xbef7,0x10d));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7bef('0x0'));var util=require('util');var moment=require(_0x7bef('0x1'));var BPromise=require('bluebird');var rs=require(_0x7bef('0x2'));var fs=require('fs');var Redis=require(_0x7bef('0x3'));var db=require(_0x7bef('0x4'))['db'];var utils=require(_0x7bef('0x5'));var logger=require(_0x7bef('0x6'))(_0x7bef('0x7'));var config=require(_0x7bef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7bef('0x9')][_0x7bef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52a343,_0x3dc0ed,_0x95b336){return new BPromise(function(_0x56c3ec,_0x1c8933){return client[_0x7bef('0xb')](_0x52a343,_0x95b336)[_0x7bef('0xc')](function(_0x65a09b){logger[_0x7bef('0xd')](_0x7bef('0xe'),_0x3dc0ed,_0x7bef('0xf'));logger[_0x7bef('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3dc0ed,_0x7bef('0xf'),JSON[_0x7bef('0x11')](_0x65a09b));if(_0x65a09b['error']){if(_0x65a09b[_0x7bef('0x12')]['code']===0x1f4){logger[_0x7bef('0x12')](_0x7bef('0xe'),_0x3dc0ed,_0x65a09b[_0x7bef('0x12')][_0x7bef('0x13')]);return _0x1c8933(_0x65a09b[_0x7bef('0x12')][_0x7bef('0x13')]);}logger[_0x7bef('0x12')](_0x7bef('0xe'),_0x3dc0ed,_0x65a09b[_0x7bef('0x12')]['message']);return _0x56c3ec(_0x65a09b[_0x7bef('0x12')][_0x7bef('0x13')]);}else{logger[_0x7bef('0xd')](_0x7bef('0xe'),_0x3dc0ed,_0x7bef('0xf'));_0x56c3ec(_0x65a09b['result'][_0x7bef('0x13')]);}})[_0x7bef('0x14')](function(_0x133370){logger[_0x7bef('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3dc0ed,_0x133370);_0x1c8933(_0x133370);});});}exports['CreateChatQueueReport']=function(_0x595cbc){var _0x31a6e3=this;return new Promise(function(_0x5d3192,_0x3ec256){return db[_0x7bef('0x15')][_0x7bef('0x16')](_0x595cbc[_0x7bef('0x17')],{'raw':_0x595cbc['options']?_0x595cbc[_0x7bef('0x18')][_0x7bef('0x19')]===undefined?!![]:![]:!![]})[_0x7bef('0xc')](function(_0x2f2e65){logger[_0x7bef('0xd')](_0x7bef('0x1a'),_0x595cbc);logger['debug'](_0x7bef('0x1a'),_0x595cbc,JSON[_0x7bef('0x11')](_0x2f2e65));_0x5d3192(_0x2f2e65);})[_0x7bef('0x14')](function(_0xe4e6b0){logger['error'](_0x7bef('0x1a'),_0xe4e6b0[_0x7bef('0x13')],_0x595cbc);_0x3ec256(_0x31a6e3[_0x7bef('0x12')](0x1f4,_0xe4e6b0['message']));});});};exports[_0x7bef('0x1b')]=function(_0x291abb){var _0x3289fe=this;return new Promise(function(_0x424ff3,_0x47df2e){return db[_0x7bef('0x15')]['update'](_0x291abb['body'],{'raw':_0x291abb['options']?_0x291abb[_0x7bef('0x18')][_0x7bef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291abb['options']?_0x291abb[_0x7bef('0x18')]['where']||null:null,'attributes':_0x291abb[_0x7bef('0x18')]?_0x291abb[_0x7bef('0x18')]['attributes']||null:null,'limit':_0x291abb[_0x7bef('0x18')]?_0x291abb[_0x7bef('0x18')][_0x7bef('0x1c')]||null:null})[_0x7bef('0xc')](function(_0x3bbca2){logger[_0x7bef('0xd')](_0x7bef('0x1b'),_0x291abb);logger[_0x7bef('0x10')]('UpdateChatQueueReport',_0x291abb,JSON[_0x7bef('0x11')](_0x3bbca2));_0x424ff3(_0x3bbca2);})['catch'](function(_0x32b1d1){logger[_0x7bef('0x12')](_0x7bef('0x1b'),_0x32b1d1[_0x7bef('0x13')],_0x291abb);_0x47df2e(_0x3289fe[_0x7bef('0x12')](0x1f4,_0x32b1d1[_0x7bef('0x13')]));});});}; \ No newline at end of file +var _0x079f=['raw','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ChatQueueReport','create','options','then','CreateChatQueueReport','update'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x079f,0x17a));var _0xf079=function(_0x16ffe3,_0x166556){_0x16ffe3=_0x16ffe3-0x0;var _0x2ac040=_0x079f[_0x16ffe3];return _0x2ac040;};'use strict';var _=require(_0xf079('0x0'));var util=require(_0xf079('0x1'));var moment=require(_0xf079('0x2'));var BPromise=require(_0xf079('0x3'));var rs=require(_0xf079('0x4'));var fs=require('fs');var Redis=require(_0xf079('0x5'));var db=require(_0xf079('0x6'))['db'];var utils=require(_0xf079('0x7'));var logger=require('../../config/logger')(_0xf079('0x8'));var config=require(_0xf079('0x9'));var jayson=require(_0xf079('0xa'));var client=jayson[_0xf079('0xb')][_0xf079('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd5aef4,_0x500701,_0x2c0b48){return new BPromise(function(_0x557c8d,_0x30b91f){return client['request'](_0xd5aef4,_0x2c0b48)['then'](function(_0x3ffe92){logger[_0xf079('0xd')](_0xf079('0xe'),_0x500701,'request\x20sent');logger[_0xf079('0xf')](_0xf079('0x10'),_0x500701,'request\x20sent',JSON[_0xf079('0x11')](_0x3ffe92));if(_0x3ffe92['error']){if(_0x3ffe92[_0xf079('0x12')][_0xf079('0x13')]===0x1f4){logger[_0xf079('0x12')](_0xf079('0xe'),_0x500701,_0x3ffe92[_0xf079('0x12')][_0xf079('0x14')]);return _0x30b91f(_0x3ffe92[_0xf079('0x12')]['message']);}logger[_0xf079('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x500701,_0x3ffe92[_0xf079('0x12')][_0xf079('0x14')]);return _0x557c8d(_0x3ffe92[_0xf079('0x12')][_0xf079('0x14')]);}else{logger[_0xf079('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x500701,_0xf079('0x15'));_0x557c8d(_0x3ffe92[_0xf079('0x16')][_0xf079('0x14')]);}})[_0xf079('0x17')](function(_0x87c70b){logger[_0xf079('0x12')](_0xf079('0xe'),_0x500701,_0x87c70b);_0x30b91f(_0x87c70b);});});}exports['CreateChatQueueReport']=function(_0x3df2ac){var _0x510253=this;return new Promise(function(_0xb2ff91,_0x42df10){return db[_0xf079('0x18')][_0xf079('0x19')](_0x3df2ac['body'],{'raw':_0x3df2ac['options']?_0x3df2ac[_0xf079('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf079('0x1b')](function(_0x14165f){logger[_0xf079('0xd')](_0xf079('0x1c'),_0x3df2ac);logger[_0xf079('0xf')](_0xf079('0x1c'),_0x3df2ac,JSON['stringify'](_0x14165f));_0xb2ff91(_0x14165f);})['catch'](function(_0x457c4d){logger[_0xf079('0x12')](_0xf079('0x1c'),_0x457c4d[_0xf079('0x14')],_0x3df2ac);_0x42df10(_0x510253['error'](0x1f4,_0x457c4d[_0xf079('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x5769ef){var _0xe99de6=this;return new Promise(function(_0x525df1,_0x5b1f4a){return db['ChatQueueReport'][_0xf079('0x1d')](_0x5769ef['body'],{'raw':_0x5769ef[_0xf079('0x1a')]?_0x5769ef[_0xf079('0x1a')][_0xf079('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5769ef[_0xf079('0x1a')]?_0x5769ef[_0xf079('0x1a')][_0xf079('0x1f')]||null:null,'attributes':_0x5769ef[_0xf079('0x1a')]?_0x5769ef[_0xf079('0x1a')]['attributes']||null:null,'limit':_0x5769ef[_0xf079('0x1a')]?_0x5769ef['options'][_0xf079('0x20')]||null:null})[_0xf079('0x1b')](function(_0x40c929){logger[_0xf079('0xd')](_0xf079('0x21'),_0x5769ef);logger['debug'](_0xf079('0x21'),_0x5769ef,JSON['stringify'](_0x40c929));_0x525df1(_0x40c929);})['catch'](function(_0x43b0ea){logger[_0xf079('0x12')](_0xf079('0x21'),_0x43b0ea[_0xf079('0x14')],_0x5769ef);_0x5b1f4a(_0xe99de6[_0xf079('0x12')](0x1f4,_0x43b0ea[_0xf079('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2dbd4e5..5b6b0f1 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 _0xbae0=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','show','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xbae0,0x1d4));var _0x0bae=function(_0x3d7811,_0x59daeb){_0x3d7811=_0x3d7811-0x0;var _0x927cfa=_0xbae0[_0x3d7811];return _0x927cfa;};'use strict';var multer=require(_0x0bae('0x0'));var util=require(_0x0bae('0x1'));var path=require(_0x0bae('0x2'));var timeout=require(_0x0bae('0x3'));var express=require(_0x0bae('0x4'));var router=express['Router']();var fs_extra=require(_0x0bae('0x5'));var auth=require(_0x0bae('0x6'));var interaction=require(_0x0bae('0x7'));var config=require(_0x0bae('0x8'));var controller=require(_0x0bae('0x9'));router[_0x0bae('0xa')]('/',auth[_0x0bae('0xb')](),controller['index']);router[_0x0bae('0xa')](_0x0bae('0xc'),auth[_0x0bae('0xb')](),controller[_0x0bae('0xd')]);router[_0x0bae('0xa')]('/:id',auth[_0x0bae('0xb')](),controller[_0x0bae('0xe')]);router['post']('/',auth[_0x0bae('0xb')](),controller['create']);router['put'](_0x0bae('0xf'),auth[_0x0bae('0xb')](),controller['update']);router[_0x0bae('0x10')](_0x0bae('0xf'),auth[_0x0bae('0xb')](),controller[_0x0bae('0x11')]);module[_0x0bae('0x12')]=router; \ No newline at end of file +var _0x6bee=['put','update','/:id','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x59e5e4,_0x393157){var _0x181b20=function(_0x421945){while(--_0x421945){_0x59e5e4['push'](_0x59e5e4['shift']());}};_0x181b20(++_0x393157);}(_0x6bee,0x1e1));var _0xe6be=function(_0x3d01c4,_0x176582){_0x3d01c4=_0x3d01c4-0x0;var _0x1152e4=_0x6bee[_0x3d01c4];return _0x1152e4;};'use strict';var multer=require(_0xe6be('0x0'));var util=require('util');var path=require(_0xe6be('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6be('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe6be('0x3'));var interaction=require(_0xe6be('0x4'));var config=require(_0xe6be('0x5'));var controller=require('./chatQueueReport.controller');router[_0xe6be('0x6')]('/',auth[_0xe6be('0x7')](),controller[_0xe6be('0x8')]);router[_0xe6be('0x6')](_0xe6be('0x9'),auth[_0xe6be('0x7')](),controller[_0xe6be('0xa')]);router['get']('/:id',auth[_0xe6be('0x7')](),controller[_0xe6be('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe6be('0xc')]('/:id',auth[_0xe6be('0x7')](),controller[_0xe6be('0xd')]);router['delete'](_0xe6be('0xe'),auth[_0xe6be('0x7')](),controller[_0xe6be('0xf')]);module[_0xe6be('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a1eac43..bb96229 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3a850a,_0x3a95c5){var _0x36c998=function(_0xb9a6e){while(--_0xb9a6e){_0x3a850a['push'](_0x3a850a['shift']());}};_0x36c998(++_0x3a95c5);}(_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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x10e9d7,_0x5ecc1c){var _0x20639b=function(_0x1f8a8f){while(--_0x1f8a8f){_0x10e9d7['push'](_0x10e9d7['shift']());}};_0x20639b(++_0x5ecc1c);}(_0xaa88,0x137));var _0x8aa8=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0xaa88[_0x30f030];return _0xf7614f;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7bfc010..e278442 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 _0x1a40=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','save','update','end','sendStatus','error','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1a40,0xf3));var _0x01a4=function(_0x57039e,_0x30dc8d){_0x57039e=_0x57039e-0x0;var _0x1d3cd3=_0x1a40[_0x57039e];return _0x1d3cd3;};'use strict';var emlformat=require(_0x01a4('0x0'));var rimraf=require(_0x01a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01a4('0x2'));var rp=require(_0x01a4('0x3'));var moment=require('moment');var BPromise=require(_0x01a4('0x4'));var Mustache=require(_0x01a4('0x5'));var util=require(_0x01a4('0x6'));var path=require(_0x01a4('0x7'));var sox=require('sox');var csv=require(_0x01a4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01a4('0x9'));var _=require(_0x01a4('0xa'));var squel=require(_0x01a4('0xb'));var crypto=require(_0x01a4('0xc'));var jsforce=require(_0x01a4('0xd'));var deskjs=require(_0x01a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01a4('0xf'));var Papa=require(_0x01a4('0x10'));var Redis=require(_0x01a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x01a4('0x12'));var as=require(_0x01a4('0x13'));var hardwareService=require(_0x01a4('0x14'));var logger=require(_0x01a4('0x15'))('api');var utils=require(_0x01a4('0x16'));var config=require(_0x01a4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x01a4('0x18'))['db'];function respondWithStatusCode(_0xc2db05,_0x313455){_0x313455=_0x313455||0xcc;return function(_0x4f1ce6){if(_0x4f1ce6){return _0xc2db05['sendStatus'](_0x313455);}return _0xc2db05[_0x01a4('0x19')](_0x313455)['end']();};}function respondWithResult(_0x103f50,_0x4c98a0){_0x4c98a0=_0x4c98a0||0xc8;return function(_0x2ea346){if(_0x2ea346){return _0x103f50['status'](_0x4c98a0)[_0x01a4('0x1a')](_0x2ea346);}};}function respondWithFilteredResult(_0x31e331,_0x51821a){return function(_0x2d58d5){if(_0x2d58d5){var _0x15928b=typeof _0x51821a[_0x01a4('0x1b')]===_0x01a4('0x1c')&&typeof _0x51821a[_0x01a4('0x1d')]===_0x01a4('0x1c');var _0x4a0fe5=_0x2d58d5['count'];var _0x2c5201=_0x15928b?0x0:_0x51821a[_0x01a4('0x1b')];var _0x1c40a0=_0x15928b?_0x2d58d5[_0x01a4('0x1e')]:_0x51821a[_0x01a4('0x1b')]+_0x51821a[_0x01a4('0x1d')];var _0x469d9d;if(_0x1c40a0>=_0x4a0fe5){_0x1c40a0=_0x4a0fe5;_0x469d9d=0xc8;}else{_0x469d9d=0xce;}_0x31e331[_0x01a4('0x19')](_0x469d9d);return _0x31e331[_0x01a4('0x1f')]('Content-Range',_0x2c5201+'-'+_0x1c40a0+'/'+_0x4a0fe5)[_0x01a4('0x1a')](_0x2d58d5);}return null;};}function patchUpdates(_0x54e3f4){return function(_0x3e50ec){try{jsonpatch['apply'](_0x3e50ec,_0x54e3f4,!![]);}catch(_0x250f21){return BPromise['reject'](_0x250f21);}return _0x3e50ec[_0x01a4('0x20')]();};}function saveUpdates(_0x12179e,_0x92069c){return function(_0x2e726f){if(_0x2e726f){return _0x2e726f[_0x01a4('0x21')](_0x12179e)['then'](function(_0x5f05d4){return _0x5f05d4;});}return null;};}function removeEntity(_0x5bfa0d,_0x8cef18){return function(_0x3755d7){if(_0x3755d7){return _0x3755d7['destroy']()['then'](function(){_0x5bfa0d['status'](0xcc)[_0x01a4('0x22')]();});}};}function handleEntityNotFound(_0x23101a,_0x11efc0){return function(_0x2c8492){if(!_0x2c8492){_0x23101a[_0x01a4('0x23')](0x194);}return _0x2c8492;};}function handleError(_0x4f8f8c,_0x4d02ea){_0x4d02ea=_0x4d02ea||0x1f4;return function(_0x467ab6){logger[_0x01a4('0x24')](_0x467ab6['stack']);if(_0x467ab6[_0x01a4('0x25')]){delete _0x467ab6[_0x01a4('0x25')];}_0x4f8f8c[_0x01a4('0x19')](_0x4d02ea)['send'](_0x467ab6);};}exports['index']=function(_0x2b8c89,_0x1b6f19){var _0x31a573={},_0x5f2726={},_0x5f4be0={'count':0x0,'rows':[]};var _0x4af660=_[_0x01a4('0x26')](db[_0x01a4('0x27')][_0x01a4('0x28')],function(_0x1e6b2f){return{'name':_0x1e6b2f[_0x01a4('0x29')],'type':_0x1e6b2f[_0x01a4('0x2a')][_0x01a4('0x2b')]};});_0x5f2726[_0x01a4('0x2c')]=_[_0x01a4('0x26')](_0x4af660,_0x01a4('0x25'));_0x5f2726[_0x01a4('0x2d')]=_[_0x01a4('0x2e')](_0x2b8c89[_0x01a4('0x2d')]);_0x5f2726[_0x01a4('0x2f')]=_['intersection'](_0x5f2726['model'],_0x5f2726['query']);_0x31a573[_0x01a4('0x30')]=_[_0x01a4('0x31')](_0x5f2726['model'],qs[_0x01a4('0x32')](_0x2b8c89[_0x01a4('0x2d')]['fields']));_0x31a573[_0x01a4('0x30')]=_0x31a573[_0x01a4('0x30')][_0x01a4('0x33')]?_0x31a573[_0x01a4('0x30')]:_0x5f2726[_0x01a4('0x2c')];if(!_0x2b8c89[_0x01a4('0x2d')][_0x01a4('0x34')](_0x01a4('0x35'))){_0x31a573[_0x01a4('0x1d')]=qs['limit'](_0x2b8c89[_0x01a4('0x2d')][_0x01a4('0x1d')]);_0x31a573[_0x01a4('0x1b')]=qs[_0x01a4('0x1b')](_0x2b8c89[_0x01a4('0x2d')][_0x01a4('0x1b')]);}_0x31a573[_0x01a4('0x36')]=qs[_0x01a4('0x37')](_0x2b8c89[_0x01a4('0x2d')][_0x01a4('0x37')]);_0x31a573[_0x01a4('0x38')]=qs[_0x01a4('0x2f')](_['pick'](_0x2b8c89[_0x01a4('0x2d')],_0x5f2726[_0x01a4('0x2f')]),_0x4af660);if(_0x2b8c89[_0x01a4('0x2d')][_0x01a4('0x39')]){_0x31a573[_0x01a4('0x38')]=_[_0x01a4('0x3a')](_0x31a573[_0x01a4('0x38')],{'$or':_[_0x01a4('0x26')](_0x4af660,function(_0x17a14e){if(_0x17a14e['type']!==_0x01a4('0x3b')){var _0x19fb34={};_0x19fb34[_0x17a14e[_0x01a4('0x25')]]={'$like':'%'+_0x2b8c89[_0x01a4('0x2d')][_0x01a4('0x39')]+'%'};return _0x19fb34;}})});}_0x31a573=_[_0x01a4('0x3a')]({},_0x31a573,_0x2b8c89[_0x01a4('0x3c')]);var _0x41f9b6={'where':_0x31a573[_0x01a4('0x38')]};return db[_0x01a4('0x27')][_0x01a4('0x1e')](_0x41f9b6)[_0x01a4('0x3d')](function(_0x21308d){_0x5f4be0['count']=_0x21308d;if(_0x2b8c89['query']['includeAll']){_0x31a573[_0x01a4('0x3e')]=[{'all':!![]}];}return db[_0x01a4('0x27')][_0x01a4('0x3f')](_0x31a573);})[_0x01a4('0x3d')](function(_0x1cda28){_0x5f4be0[_0x01a4('0x40')]=_0x1cda28;return _0x5f4be0;})[_0x01a4('0x3d')](respondWithFilteredResult(_0x1b6f19,_0x31a573))[_0x01a4('0x41')](handleError(_0x1b6f19,null));};exports[_0x01a4('0x42')]=function(_0x4ee023,_0x55704e){var _0x28e77f={'raw':!![],'where':{'id':_0x4ee023[_0x01a4('0x43')]['id']}},_0x64167f={};_0x64167f[_0x01a4('0x2c')]=_[_0x01a4('0x2e')](db[_0x01a4('0x27')]['rawAttributes']);_0x64167f['query']=_[_0x01a4('0x2e')](_0x4ee023[_0x01a4('0x2d')]);_0x64167f[_0x01a4('0x2f')]=_[_0x01a4('0x31')](_0x64167f[_0x01a4('0x2c')],_0x64167f[_0x01a4('0x2d')]);_0x28e77f[_0x01a4('0x30')]=_[_0x01a4('0x31')](_0x64167f[_0x01a4('0x2c')],qs[_0x01a4('0x32')](_0x4ee023[_0x01a4('0x2d')][_0x01a4('0x32')]));_0x28e77f[_0x01a4('0x30')]=_0x28e77f['attributes'][_0x01a4('0x33')]?_0x28e77f[_0x01a4('0x30')]:_0x64167f[_0x01a4('0x2c')];if(_0x4ee023['query'][_0x01a4('0x44')]){_0x28e77f['include']=[{'all':!![]}];}_0x28e77f=_[_0x01a4('0x3a')]({},_0x28e77f,_0x4ee023['options']);return db[_0x01a4('0x27')]['find'](_0x28e77f)[_0x01a4('0x3d')](handleEntityNotFound(_0x55704e,null))[_0x01a4('0x3d')](respondWithResult(_0x55704e,null))[_0x01a4('0x41')](handleError(_0x55704e,null));};exports[_0x01a4('0x45')]=function(_0xf5efb2,_0x5deee9){return db[_0x01a4('0x27')][_0x01a4('0x45')](_0xf5efb2['body'],{})[_0x01a4('0x3d')](respondWithResult(_0x5deee9,0xc9))[_0x01a4('0x41')](handleError(_0x5deee9,null));};exports[_0x01a4('0x21')]=function(_0x44bb23,_0x5c5067){if(_0x44bb23[_0x01a4('0x46')]['id']){delete _0x44bb23[_0x01a4('0x46')]['id'];}return db['ChatTransferReport'][_0x01a4('0x47')]({'where':{'id':_0x44bb23['params']['id']}})[_0x01a4('0x3d')](handleEntityNotFound(_0x5c5067,null))[_0x01a4('0x3d')](saveUpdates(_0x44bb23['body'],null))[_0x01a4('0x3d')](respondWithResult(_0x5c5067,null))['catch'](handleError(_0x5c5067,null));};exports[_0x01a4('0x48')]=function(_0x495d68,_0x4997fb){return db[_0x01a4('0x27')][_0x01a4('0x47')]({'where':{'id':_0x495d68[_0x01a4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4997fb,null))[_0x01a4('0x3d')](removeEntity(_0x4997fb,null))[_0x01a4('0x41')](handleError(_0x4997fb,null));};exports[_0x01a4('0x49')]=function(_0x377e14,_0x56b7a2){return db[_0x01a4('0x27')]['describe']()[_0x01a4('0x3d')](respondWithResult(_0x56b7a2,null))[_0x01a4('0x41')](handleError(_0x56b7a2,null));}; \ No newline at end of file +var _0x39c3=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','catch','find','describe','rimraf','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','error','name','send','map','ChatTransferReport','rawAttributes','type','key','model','query'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x39c3,0x179));var _0x339c=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x39c3[_0x3f2d02];return _0x54092b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x339c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x339c('0x1'));var util=require('util');var path=require(_0x339c('0x2'));var sox=require(_0x339c('0x3'));var csv=require(_0x339c('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x339c('0x5'));var _=require(_0x339c('0x6'));var squel=require(_0x339c('0x7'));var crypto=require(_0x339c('0x8'));var jsforce=require(_0x339c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x339c('0x4'));var querystring=require(_0x339c('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x339c('0xb'));var qs=require(_0x339c('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x339c('0xd'));var logger=require(_0x339c('0xe'))(_0x339c('0xf'));var utils=require(_0x339c('0x10'));var config=require(_0x339c('0x11'));var licenseUtil=require(_0x339c('0x12'));var db=require(_0x339c('0x13'))['db'];function respondWithStatusCode(_0x18446c,_0x301755){_0x301755=_0x301755||0xcc;return function(_0x1926b9){if(_0x1926b9){return _0x18446c[_0x339c('0x14')](_0x301755);}return _0x18446c['status'](_0x301755)[_0x339c('0x15')]();};}function respondWithResult(_0x556d82,_0x17b15e){_0x17b15e=_0x17b15e||0xc8;return function(_0x3d8afd){if(_0x3d8afd){return _0x556d82['status'](_0x17b15e)[_0x339c('0x16')](_0x3d8afd);}};}function respondWithFilteredResult(_0x32df21,_0x24d8d2){return function(_0x55b1ea){if(_0x55b1ea){var _0x109818=typeof _0x24d8d2[_0x339c('0x17')]===_0x339c('0x18')&&typeof _0x24d8d2[_0x339c('0x19')]==='undefined';var _0x4681bc=_0x55b1ea[_0x339c('0x1a')];var _0x2fd363=_0x109818?0x0:_0x24d8d2[_0x339c('0x17')];var _0x3afaf3=_0x109818?_0x55b1ea[_0x339c('0x1a')]:_0x24d8d2['offset']+_0x24d8d2[_0x339c('0x19')];var _0x557219;if(_0x3afaf3>=_0x4681bc){_0x3afaf3=_0x4681bc;_0x557219=0xc8;}else{_0x557219=0xce;}_0x32df21[_0x339c('0x1b')](_0x557219);return _0x32df21[_0x339c('0x1c')]('Content-Range',_0x2fd363+'-'+_0x3afaf3+'/'+_0x4681bc)[_0x339c('0x16')](_0x55b1ea);}return null;};}function patchUpdates(_0x1cf022){return function(_0x1753e9){try{jsonpatch[_0x339c('0x1d')](_0x1753e9,_0x1cf022,!![]);}catch(_0x325b84){return BPromise[_0x339c('0x1e')](_0x325b84);}return _0x1753e9['save']();};}function saveUpdates(_0x53ee73,_0x1f071c){return function(_0x1265e0){if(_0x1265e0){return _0x1265e0[_0x339c('0x1f')](_0x53ee73)[_0x339c('0x20')](function(_0x144268){return _0x144268;});}return null;};}function removeEntity(_0x47410e,_0x279291){return function(_0x2f1005){if(_0x2f1005){return _0x2f1005['destroy']()[_0x339c('0x20')](function(){_0x47410e[_0x339c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfec179,_0x11ff64){return function(_0x198195){if(!_0x198195){_0xfec179[_0x339c('0x14')](0x194);}return _0x198195;};}function handleError(_0xef43f,_0x4d8a74){_0x4d8a74=_0x4d8a74||0x1f4;return function(_0x345dab){logger[_0x339c('0x21')](_0x345dab['stack']);if(_0x345dab[_0x339c('0x22')]){delete _0x345dab[_0x339c('0x22')];}_0xef43f[_0x339c('0x1b')](_0x4d8a74)[_0x339c('0x23')](_0x345dab);};}exports['index']=function(_0x793141,_0x3a4e35){var _0x36d9a5={},_0x264a50={},_0x2dfaf1={'count':0x0,'rows':[]};var _0x26a2ae=_[_0x339c('0x24')](db[_0x339c('0x25')][_0x339c('0x26')],function(_0x7095fc){return{'name':_0x7095fc['fieldName'],'type':_0x7095fc[_0x339c('0x27')][_0x339c('0x28')]};});_0x264a50[_0x339c('0x29')]=_[_0x339c('0x24')](_0x26a2ae,'name');_0x264a50[_0x339c('0x2a')]=_[_0x339c('0x2b')](_0x793141[_0x339c('0x2a')]);_0x264a50['filters']=_[_0x339c('0x2c')](_0x264a50['model'],_0x264a50[_0x339c('0x2a')]);_0x36d9a5[_0x339c('0x2d')]=_[_0x339c('0x2c')](_0x264a50[_0x339c('0x29')],qs['fields'](_0x793141[_0x339c('0x2a')][_0x339c('0x2e')]));_0x36d9a5[_0x339c('0x2d')]=_0x36d9a5[_0x339c('0x2d')][_0x339c('0x2f')]?_0x36d9a5['attributes']:_0x264a50[_0x339c('0x29')];if(!_0x793141[_0x339c('0x2a')][_0x339c('0x30')](_0x339c('0x31'))){_0x36d9a5['limit']=qs['limit'](_0x793141[_0x339c('0x2a')][_0x339c('0x19')]);_0x36d9a5[_0x339c('0x17')]=qs[_0x339c('0x17')](_0x793141[_0x339c('0x2a')][_0x339c('0x17')]);}_0x36d9a5[_0x339c('0x32')]=qs[_0x339c('0x33')](_0x793141[_0x339c('0x2a')][_0x339c('0x33')]);_0x36d9a5[_0x339c('0x34')]=qs[_0x339c('0x35')](_[_0x339c('0x36')](_0x793141[_0x339c('0x2a')],_0x264a50[_0x339c('0x35')]),_0x26a2ae);if(_0x793141[_0x339c('0x2a')][_0x339c('0x37')]){_0x36d9a5[_0x339c('0x34')]=_[_0x339c('0x38')](_0x36d9a5[_0x339c('0x34')],{'$or':_[_0x339c('0x24')](_0x26a2ae,function(_0x1e8e21){if(_0x1e8e21['type']!==_0x339c('0x39')){var _0x773838={};_0x773838[_0x1e8e21[_0x339c('0x22')]]={'$like':'%'+_0x793141[_0x339c('0x2a')][_0x339c('0x37')]+'%'};return _0x773838;}})});}_0x36d9a5=_[_0x339c('0x38')]({},_0x36d9a5,_0x793141['options']);var _0x3e3f87={'where':_0x36d9a5['where']};return db[_0x339c('0x25')][_0x339c('0x1a')](_0x3e3f87)[_0x339c('0x20')](function(_0x45e4ce){_0x2dfaf1[_0x339c('0x1a')]=_0x45e4ce;if(_0x793141['query'][_0x339c('0x3a')]){_0x36d9a5[_0x339c('0x3b')]=[{'all':!![]}];}return db[_0x339c('0x25')][_0x339c('0x3c')](_0x36d9a5);})[_0x339c('0x20')](function(_0x57c1d6){_0x2dfaf1[_0x339c('0x3d')]=_0x57c1d6;return _0x2dfaf1;})[_0x339c('0x20')](respondWithFilteredResult(_0x3a4e35,_0x36d9a5))['catch'](handleError(_0x3a4e35,null));};exports[_0x339c('0x3e')]=function(_0x1257a3,_0x3062e6){var _0x4c09f3={'raw':!![],'where':{'id':_0x1257a3[_0x339c('0x3f')]['id']}},_0x3048f3={};_0x3048f3[_0x339c('0x29')]=_['keys'](db[_0x339c('0x25')][_0x339c('0x26')]);_0x3048f3[_0x339c('0x2a')]=_[_0x339c('0x2b')](_0x1257a3[_0x339c('0x2a')]);_0x3048f3[_0x339c('0x35')]=_[_0x339c('0x2c')](_0x3048f3['model'],_0x3048f3['query']);_0x4c09f3[_0x339c('0x2d')]=_[_0x339c('0x2c')](_0x3048f3[_0x339c('0x29')],qs[_0x339c('0x2e')](_0x1257a3[_0x339c('0x2a')][_0x339c('0x2e')]));_0x4c09f3[_0x339c('0x2d')]=_0x4c09f3[_0x339c('0x2d')]['length']?_0x4c09f3['attributes']:_0x3048f3['model'];if(_0x1257a3[_0x339c('0x2a')]['includeAll']){_0x4c09f3[_0x339c('0x3b')]=[{'all':!![]}];}_0x4c09f3=_[_0x339c('0x38')]({},_0x4c09f3,_0x1257a3[_0x339c('0x40')]);return db['ChatTransferReport']['find'](_0x4c09f3)[_0x339c('0x20')](handleEntityNotFound(_0x3062e6,null))['then'](respondWithResult(_0x3062e6,null))['catch'](handleError(_0x3062e6,null));};exports[_0x339c('0x41')]=function(_0x22ff72,_0x16cf7f){return db['ChatTransferReport'][_0x339c('0x41')](_0x22ff72[_0x339c('0x42')],{})[_0x339c('0x20')](respondWithResult(_0x16cf7f,0xc9))[_0x339c('0x43')](handleError(_0x16cf7f,null));};exports[_0x339c('0x1f')]=function(_0x2820e2,_0x291fac){if(_0x2820e2[_0x339c('0x42')]['id']){delete _0x2820e2[_0x339c('0x42')]['id'];}return db[_0x339c('0x25')][_0x339c('0x44')]({'where':{'id':_0x2820e2['params']['id']}})['then'](handleEntityNotFound(_0x291fac,null))[_0x339c('0x20')](saveUpdates(_0x2820e2[_0x339c('0x42')],null))[_0x339c('0x20')](respondWithResult(_0x291fac,null))[_0x339c('0x43')](handleError(_0x291fac,null));};exports['destroy']=function(_0x27fd80,_0x264c79){return db[_0x339c('0x25')][_0x339c('0x44')]({'where':{'id':_0x27fd80[_0x339c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x264c79,null))[_0x339c('0x20')](removeEntity(_0x264c79,null))[_0x339c('0x43')](handleError(_0x264c79,null));};exports[_0x339c('0x45')]=function(_0x52a6e9,_0x377966){return db['ChatTransferReport'][_0x339c('0x45')]()['then'](respondWithResult(_0x377966,null))[_0x339c('0x43')](handleError(_0x377966,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8ffdbb2..b3ad699 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 _0x3931=['define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','../../config/environment','./chatTransferReport.attributes'];(function(_0xe2314e,_0x4a51a9){var _0x58e6f9=function(_0x428bad){while(--_0x428bad){_0xe2314e['push'](_0xe2314e['shift']());}};_0x58e6f9(++_0x4a51a9);}(_0x3931,0x164));var _0x1393=function(_0x4b9e94,_0x2af3ae){_0x4b9e94=_0x4b9e94-0x0;var _0x51dd0e=_0x3931[_0x4b9e94];return _0x51dd0e;};'use strict';var _=require('lodash');var util=require(_0x1393('0x0'));var logger=require(_0x1393('0x1'))(_0x1393('0x2'));var moment=require(_0x1393('0x3'));var BPromise=require('bluebird');var rp=require(_0x1393('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1393('0x5'));var attributes=require(_0x1393('0x6'));module['exports']=function(_0x45b72c,_0x2c8a3c){return _0x45b72c[_0x1393('0x7')](_0x1393('0x8'),attributes,{'tableName':_0x1393('0x9'),'paranoid':![],'indexes':[{'name':_0x1393('0xa'),'fields':[_0x1393('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe996=['request-promise','path','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x2492dc,_0x3284a7){var _0x310431=function(_0x2e7d91){while(--_0x2e7d91){_0x2492dc['push'](_0x2492dc['shift']());}};_0x310431(++_0x3284a7);}(_0xe996,0xa8));var _0x6e99=function(_0x45f773,_0x3b6f55){_0x45f773=_0x45f773-0x0;var _0x5c87c6=_0xe996[_0x45f773];return _0x5c87c6;};'use strict';var _=require(_0x6e99('0x0'));var util=require(_0x6e99('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6e99('0x2'));var fs=require('fs');var path=require(_0x6e99('0x3'));var rimraf=require('rimraf');var config=require(_0x6e99('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0x6e99('0x5')]=function(_0x4f52c4,_0x548522){return _0x4f52c4[_0x6e99('0x6')](_0x6e99('0x7'),attributes,{'tableName':_0x6e99('0x8'),'paranoid':![],'indexes':[{'name':_0x6e99('0x9'),'fields':[_0x6e99('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 65d8f13..dcff18c 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 _0xed97=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','ioredis'];(function(_0x23e5ce,_0x57584d){var _0x2ce19b=function(_0x318e1f){while(--_0x318e1f){_0x23e5ce['push'](_0x23e5ce['shift']());}};_0x2ce19b(++_0x57584d);}(_0xed97,0x1a0));var _0x7ed9=function(_0x597743,_0x94f64c){_0x597743=_0x597743-0x0;var _0x42fbb2=_0xed97[_0x597743];return _0x42fbb2;};'use strict';var _=require('lodash');var util=require(_0x7ed9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ed9('0x1'));var db=require(_0x7ed9('0x2'))['db'];var utils=require(_0x7ed9('0x3'));var logger=require(_0x7ed9('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ed9('0x5'));var client=jayson[_0x7ed9('0x6')][_0x7ed9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14dd17,_0x28eb1d,_0x202d06){return new BPromise(function(_0xc573a,_0x447efd){return client['request'](_0x14dd17,_0x202d06)[_0x7ed9('0x8')](function(_0xa970ac){logger[_0x7ed9('0x9')](_0x7ed9('0xa'),_0x28eb1d,_0x7ed9('0xb'));logger[_0x7ed9('0xc')](_0x7ed9('0xd'),_0x28eb1d,_0x7ed9('0xb'),JSON['stringify'](_0xa970ac));if(_0xa970ac[_0x7ed9('0xe')]){if(_0xa970ac[_0x7ed9('0xe')][_0x7ed9('0xf')]===0x1f4){logger[_0x7ed9('0xe')](_0x7ed9('0xa'),_0x28eb1d,_0xa970ac[_0x7ed9('0xe')]['message']);return _0x447efd(_0xa970ac[_0x7ed9('0xe')]['message']);}logger[_0x7ed9('0xe')](_0x7ed9('0xa'),_0x28eb1d,_0xa970ac['error'][_0x7ed9('0x10')]);return _0xc573a(_0xa970ac[_0x7ed9('0xe')][_0x7ed9('0x10')]);}else{logger[_0x7ed9('0x9')](_0x7ed9('0xa'),_0x28eb1d,_0x7ed9('0xb'));_0xc573a(_0xa970ac[_0x7ed9('0x11')][_0x7ed9('0x10')]);}})[_0x7ed9('0x12')](function(_0x546718){logger[_0x7ed9('0xe')](_0x7ed9('0xa'),_0x28eb1d,_0x546718);_0x447efd(_0x546718);});});} \ No newline at end of file +var _0xf388=['error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2354ba,_0x14c8b0){var _0x28ec41=function(_0x50ba6d){while(--_0x50ba6d){_0x2354ba['push'](_0x2354ba['shift']());}};_0x28ec41(++_0x14c8b0);}(_0xf388,0xad));var _0x8f38=function(_0x90270e,_0x5171ef){_0x90270e=_0x90270e-0x0;var _0x3dd03a=_0xf388[_0x90270e];return _0x3dd03a;};'use strict';var _=require(_0x8f38('0x0'));var util=require(_0x8f38('0x1'));var moment=require('moment');var BPromise=require(_0x8f38('0x2'));var rs=require(_0x8f38('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f38('0x4'))['db'];var utils=require(_0x8f38('0x5'));var logger=require('../../config/logger')(_0x8f38('0x6'));var config=require(_0x8f38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8f38('0x8')][_0x8f38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157c74,_0x532d56,_0x599f7e){return new BPromise(function(_0x7a7859,_0x351e28){return client['request'](_0x157c74,_0x599f7e)[_0x8f38('0xa')](function(_0x2143ed){logger[_0x8f38('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x532d56,_0x8f38('0xc'));logger[_0x8f38('0xd')](_0x8f38('0xe'),_0x532d56,'request\x20sent',JSON[_0x8f38('0xf')](_0x2143ed));if(_0x2143ed[_0x8f38('0x10')]){if(_0x2143ed['error'][_0x8f38('0x11')]===0x1f4){logger[_0x8f38('0x10')](_0x8f38('0x12'),_0x532d56,_0x2143ed[_0x8f38('0x10')][_0x8f38('0x13')]);return _0x351e28(_0x2143ed[_0x8f38('0x10')][_0x8f38('0x13')]);}logger[_0x8f38('0x10')](_0x8f38('0x12'),_0x532d56,_0x2143ed['error'][_0x8f38('0x13')]);return _0x7a7859(_0x2143ed[_0x8f38('0x10')][_0x8f38('0x13')]);}else{logger[_0x8f38('0xb')](_0x8f38('0x12'),_0x532d56,_0x8f38('0xc'));_0x7a7859(_0x2143ed['result']['message']);}})[_0x8f38('0x14')](function(_0x437a65){logger['error'](_0x8f38('0x12'),_0x532d56,_0x437a65);_0x351e28(_0x437a65);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 38defc2..e8dc6c4 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 _0xad4f=['exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x559aab,_0x4b7dc4){var _0x5e5801=function(_0xb3a24f){while(--_0xb3a24f){_0x559aab['push'](_0x559aab['shift']());}};_0x5e5801(++_0x4b7dc4);}(_0xad4f,0xf1));var _0xfad4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xad4f[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xfad4('0x0'));var util=require('util');var path=require(_0xfad4('0x1'));var timeout=require(_0xfad4('0x2'));var express=require(_0xfad4('0x3'));var router=express['Router']();var fs_extra=require(_0xfad4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfad4('0x5'));var controller=require('./chatTransferReport.controller');router[_0xfad4('0x6')]('/',auth[_0xfad4('0x7')](),controller[_0xfad4('0x8')]);router[_0xfad4('0x6')](_0xfad4('0x9'),auth[_0xfad4('0x7')](),controller[_0xfad4('0xa')]);router[_0xfad4('0x6')]('/:id',auth[_0xfad4('0x7')](),controller[_0xfad4('0xb')]);router[_0xfad4('0xc')]('/',auth[_0xfad4('0x7')](),controller[_0xfad4('0xd')]);router[_0xfad4('0xe')](_0xfad4('0xf'),auth['isAuthenticated'](),controller[_0xfad4('0x10')]);router[_0xfad4('0x11')](_0xfad4('0xf'),auth['isAuthenticated'](),controller[_0xfad4('0x12')]);module[_0xfad4('0x13')]=router; \ No newline at end of file +var _0xac5c=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete'];(function(_0x24872b,_0x5c318b){var _0x427d0f=function(_0x1c74d4){while(--_0x1c74d4){_0x24872b['push'](_0x24872b['shift']());}};_0x427d0f(++_0x5c318b);}(_0xac5c,0x144));var _0xcac5=function(_0x5d6e5e,_0x1f8a9b){_0x5d6e5e=_0x5d6e5e-0x0;var _0x28830c=_0xac5c[_0x5d6e5e];return _0x28830c;};'use strict';var multer=require('multer');var util=require(_0xcac5('0x0'));var path=require(_0xcac5('0x1'));var timeout=require(_0xcac5('0x2'));var express=require('express');var router=express[_0xcac5('0x3')]();var fs_extra=require(_0xcac5('0x4'));var auth=require(_0xcac5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcac5('0x6'));var controller=require(_0xcac5('0x7'));router[_0xcac5('0x8')]('/',auth[_0xcac5('0x9')](),controller[_0xcac5('0xa')]);router[_0xcac5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xcac5('0xb')]);router[_0xcac5('0x8')](_0xcac5('0xc'),auth['isAuthenticated'](),controller[_0xcac5('0xd')]);router[_0xcac5('0xe')]('/',auth[_0xcac5('0x9')](),controller[_0xcac5('0xf')]);router[_0xcac5('0x10')](_0xcac5('0xc'),auth[_0xcac5('0x9')](),controller['update']);router[_0xcac5('0x11')](_0xcac5('0xc'),auth['isAuthenticated'](),controller[_0xcac5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 494eaf0..fae4687 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 _0x2138=['input','name','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','stringify'];(function(_0x30e01f,_0x4b4c42){var _0x54b90e=function(_0x503bec){while(--_0x503bec){_0x30e01f['push'](_0x30e01f['shift']());}};_0x54b90e(++_0x4b4c42);}(_0x2138,0x9b));var _0x8213=function(_0x440e53,_0xda816){_0x440e53=_0x440e53-0x0;var _0x3ff676=_0x2138[_0x440e53];return _0x3ff676;};'use strict';var Sequelize=require(_0x8213('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x8213('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8213('0x1')]},'mapKey':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x2')},'mapKeyOffline':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x8213('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x3')},'customerAlias':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8213('0x1')],'allowNull':![],'defaultValue':_0x8213('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8213('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8213('0x1')],'allowNull':![],'defaultValue':_0x8213('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8213('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8213('0x1')]},'animation':{'type':Sequelize[_0x8213('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8213('0x8')]('rounded',_0x8213('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0xc')},'header_offline':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8213('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x8213('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8213('0xe')]},'closingQuestion':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0x10')},'closingMessage':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0xc')},'skipMessageButton':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x8213('0x12'),_0x8213('0x13')),'defaultValue':_0x8213('0x12')},'ratingStarsNumber':{'type':Sequelize[_0x8213('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8213('0xe')],'defaultValue':function(){return JSON[_0x8213('0x14')]({'items':[{'type':_0x8213('0x15'),'variable':null,'config':{'placeholder':_0x8213('0x16'),'type':_0x8213('0x17'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8213('0x15'),'props':{'title':_0x8213('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x8213('0x2'),'type':_0x8213('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8213('0x18')](_0x8213('0x19'))?JSON[_0x8213('0x1a')](this[_0x8213('0x18')]('onlineForm')):{};},'set':function(_0x544001){return this['setDataValue'](_0x8213('0x19'),JSON[_0x8213('0x14')](_0x544001));}},'offlineForm':{'type':Sequelize[_0x8213('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8213('0x15'),'props':{'title':_0x8213('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8213('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x8213('0x1b'),'helpText':_0x8213('0x1c')}}],'fromKey':0x0});},'get':function(){return this[_0x8213('0x18')]('offlineForm')?JSON[_0x8213('0x1a')](this[_0x8213('0x18')](_0x8213('0x1d'))):{};},'set':function(_0x253471){return this[_0x8213('0x1e')](_0x8213('0x1d'),JSON[_0x8213('0x14')](_0x253471));}},'token':{'type':Sequelize[_0x8213('0x1')],'defaultValue':function(){return rs[_0x8213('0x1f')]();}},'autoclose':{'type':Sequelize[_0x8213('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8213('0x1')]},'forwardOffline':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8213('0x1')]},'waitingTitle':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0x20')},'offlineMessageBody':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x21')},'enableUnmanagedNote':{'type':Sequelize[_0x8213('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x22')},'skipUnmanaged':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x23')},'sendUnmanaged':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8213('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8213('0x24');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x25')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8213('0x26')},'verticalAlignment':{'type':Sequelize[_0x8213('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8213('0x1')],'defaultValue':_0x8213('0x27')},'defaultTitle':{'type':Sequelize[_0x8213('0x1')]},'customerAvatar':{'type':Sequelize[_0x8213('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8213('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8213('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8213('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8213('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8213('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8213('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x37bee8){if(!_0x37bee8)this[_0x8213('0x1e')](_0x8213('0x29'),null);this['setDataValue']('mandatoryDisposition',_0x37bee8);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8213('0x1')]},'vidaooTopic':{'type':Sequelize[_0x8213('0x1')],'allowNull':![],'defaultValue':_0x8213('0x2a')},'vidaooNote':{'type':Sequelize[_0x8213('0x1')],'defaultValue':function(){return _0x8213('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x8213('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8213('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8213('0xe')]}}; \ No newline at end of file +var _0x60ff=['STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','TEXT','textarea','Comments','offlineForm','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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports'];(function(_0x4e1d0c,_0x1ee7f8){var _0x447d33=function(_0x5ed127){while(--_0x5ed127){_0x4e1d0c['push'](_0x4e1d0c['shift']());}};_0x447d33(++_0x1ee7f8);}(_0x60ff,0x94));var _0xf60f=function(_0x2dc33d,_0x2ec144){_0x2dc33d=_0x2dc33d-0x0;var _0x566f03=_0x60ff[_0x2dc33d];return _0x566f03;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf60f('0x0'));module[_0xf60f('0x1')]={'name':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![],'unique':_0xf60f('0x3')},'description':{'type':Sequelize[_0xf60f('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf60f('0x4')},'mapKeyOffline':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x4')},'key':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x5')},'customerAlias':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![],'defaultValue':_0xf60f('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf60f('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![],'defaultValue':_0xf60f('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf60f('0x2')]},'animation':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf60f('0x9')]('rounded',_0xf60f('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0xb')},'start_chat_button':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf60f('0xd')},'header_offline':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf60f('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x12')},'noteTitle':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x13')},'placeholderMessage':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf60f('0x15')},'closingMessageButton':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0xd')},'skipMessageButton':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x16')},'conditionAgreement':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0xf60f('0x18'),_0xf60f('0x19')),'defaultValue':_0xf60f('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf60f('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf60f('0x1a')]({'items':[{'type':_0xf60f('0x1b'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xf60f('0x1c'),'helpText':''}},{'type':_0xf60f('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf60f('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf60f('0x1d')](_0xf60f('0x1e'))?JSON[_0xf60f('0x1f')](this['getDataValue']('onlineForm')):{};},'set':function(_0x15046f){return this[_0xf60f('0x20')](_0xf60f('0x1e'),JSON['stringify'](_0x15046f));}},'offlineForm':{'type':Sequelize[_0xf60f('0x21')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf60f('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf60f('0x4'),'type':'email'},'variable':null},{'type':_0xf60f('0x22'),'config':{'placeholder':_0xf60f('0x23')},'props':{'title':_0xf60f('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xf60f('0x1d')](_0xf60f('0x24'))?JSON[_0xf60f('0x1f')](this[_0xf60f('0x1d')](_0xf60f('0x24'))):{};},'set':function(_0x3a46d2){return this[_0xf60f('0x20')](_0xf60f('0x24'),JSON['stringify'](_0x3a46d2));}},'token':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':function(){return rs[_0xf60f('0x25')]();}},'autoclose':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf60f('0x2')]},'forwardOffline':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf60f('0x2')]},'waitingTitle':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xf60f('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xf60f('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf60f('0x21')]},'showAgentAvatar':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf60f('0x21')],'defaultValue':function(){return _0xf60f('0x29');}},'notificationSound':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xf60f('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf60f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x2b')},'verticalAlignment':{'type':Sequelize[_0xf60f('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':_0xf60f('0x2c')},'defaultTitle':{'type':Sequelize[_0xf60f('0x2')]},'customerAvatar':{'type':Sequelize[_0xf60f('0x21')]},'showCustomerAvatar':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf60f('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf60f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf60f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xf60f('0x21')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf60f('0xe')],'comment':_0xf60f('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![],'comment':_0xf60f('0x2e'),'set':function(_0xa7e7be){if(!_0xa7e7be)this['setDataValue'](_0xf60f('0x2f'),null);this['setDataValue'](_0xf60f('0x30'),_0xa7e7be);}},'vidaooEscalation':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf60f('0x2')]},'vidaooTopic':{'type':Sequelize[_0xf60f('0x2')],'allowNull':![],'defaultValue':_0xf60f('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf60f('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf60f('0x21')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8b749f0..d191d72 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 _0xa732=['end','stack','name','index','Pause','map','ChatWebsite','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','CmList','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','send','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','MailServerOut','forwardOffline','forwardOfflineAddress','Smtp','service','host','port','secure','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','Chat','notifyMail','addInteraction','omit','Contact','fullname','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','backgroundColor','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','http','client','request','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ChatWebsite,\x20%s,\x20%s','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','get','ChatWebsites','UserProfileResource'];(function(_0x149fde,_0x15cd8f){var _0x6fce14=function(_0x200aaa){while(--_0x200aaa){_0x149fde['push'](_0x149fde['shift']());}};_0x6fce14(++_0x15cd8f);}(_0xa732,0xf9));var _0x2a73=function(_0x8f580a,_0x1af768){_0x8f580a=_0x8f580a-0x0;var _0x295826=_0xa732[_0x8f580a];return _0x295826;};'use strict';var BPromise=require(_0x2a73('0x0'));var Mustache=require('mustache');var util=require(_0x2a73('0x1'));var path=require(_0x2a73('0x2'));var ejs=require(_0x2a73('0x3'));var fs=require('fs');var fs_extra=require(_0x2a73('0x4'));var _=require(_0x2a73('0x5'));var querystring=require(_0x2a73('0x6'));var Redis=require(_0x2a73('0x7'));var qs=require(_0x2a73('0x8'));var logger=require(_0x2a73('0x9'))('api');var config=require(_0x2a73('0xa'));var db=require(_0x2a73('0xb'))['db'];config['redis']=_[_0x2a73('0xc')](config['redis'],{'host':_0x2a73('0xd'),'port':0x18eb});var socket=require(_0x2a73('0xe'))(new Redis(config[_0x2a73('0xf')]));require(_0x2a73('0x10'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2a73('0x11')]({'port':0x232c});var client9002=jayson[_0x2a73('0x12')][_0x2a73('0x11')]({'port':0x232a});var client9003=jayson[_0x2a73('0x12')][_0x2a73('0x11')]({'port':0x232b});var client9001=jayson[_0x2a73('0x12')][_0x2a73('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x3a4094,_0x42f506,_0x40d944,_0x47082a){return new BPromise(function(_0x34e23d,_0x2e16c3){var _0xb6cae=_0x47082a||client;return _0xb6cae[_0x2a73('0x13')](_0x3a4094,_0x40d944)['then'](function(_0x164639){logger[_0x2a73('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x42f506,'request\x20sent');logger[_0x2a73('0x15')](_0x2a73('0x16'),_0x42f506,_0x2a73('0x17'),JSON[_0x2a73('0x18')](_0x164639));if(_0x164639[_0x2a73('0x19')]){if(_0x164639[_0x2a73('0x19')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x42f506,_0x164639[_0x2a73('0x19')]['message']);return _0x2e16c3(_0x164639[_0x2a73('0x19')][_0x2a73('0x1a')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x42f506,_0x164639[_0x2a73('0x19')][_0x2a73('0x1a')]);return _0x34e23d(_0x164639['error'][_0x2a73('0x1a')]);}else{logger[_0x2a73('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x42f506,_0x2a73('0x17'));_0x34e23d(_0x164639[_0x2a73('0x1b')][_0x2a73('0x1a')]);}})[_0x2a73('0x1c')](function(_0x257ae2){logger[_0x2a73('0x19')](_0x2a73('0x1d'),_0x42f506,_0x257ae2);_0x2e16c3(_0x257ae2);});});}function respondWithStatusCode(_0x7d5641,_0xf436af){_0xf436af=_0xf436af||0xcc;return function(_0x2bc29f){if(_0x2bc29f){return _0x7d5641[_0x2a73('0x1e')](_0xf436af);}return _0x7d5641['status'](_0xf436af)['end']();};}function respondWithResult(_0x4ae74d,_0x211792){_0x211792=_0x211792||0xc8;return function(_0x5a735f){if(_0x5a735f){return _0x4ae74d['status'](_0x211792)[_0x2a73('0x1f')](_0x5a735f);}};}function respondWithFilteredResult(_0x4f814a,_0x1d9ab5){return function(_0x18e0e1){if(_0x18e0e1){var _0x18834a=typeof _0x1d9ab5[_0x2a73('0x20')]===_0x2a73('0x21')&&typeof _0x1d9ab5[_0x2a73('0x22')]==='undefined';var _0x41fe31=_0x18e0e1[_0x2a73('0x23')];var _0xd3ef3e=_0x18834a?0x0:_0x1d9ab5[_0x2a73('0x20')];var _0x2319d7=_0x18834a?_0x18e0e1[_0x2a73('0x23')]:_0x1d9ab5[_0x2a73('0x20')]+_0x1d9ab5[_0x2a73('0x22')];var _0x2d0d17;if(_0x2319d7>=_0x41fe31){_0x2319d7=_0x41fe31;_0x2d0d17=0xc8;}else{_0x2d0d17=0xce;}_0x4f814a[_0x2a73('0x24')](_0x2d0d17);return _0x4f814a[_0x2a73('0x25')](_0x2a73('0x26'),_0xd3ef3e+'-'+_0x2319d7+'/'+_0x41fe31)[_0x2a73('0x1f')](_0x18e0e1);}return null;};}function saveUpdates(_0x4c6192){return function(_0xf35f63){if(_0xf35f63){return _0xf35f63['update'](_0x4c6192)[_0x2a73('0x27')](function(_0x3f192c){return _0x3f192c;});}return null;};}function removeEntity(_0x57c054){return function(_0x287652){if(_0x287652){return _0x287652[_0x2a73('0x28')]()[_0x2a73('0x27')](function(){var _0x3a5a08=_0x287652[_0x2a73('0x29')]({'plain':!![]});var _0x418d7c=_0x2a73('0x2a');return db[_0x2a73('0x2b')][_0x2a73('0x28')]({'where':{'type':_0x418d7c,'resourceId':_0x3a5a08['id']}})[_0x2a73('0x27')](function(){return _0x287652;});})[_0x2a73('0x27')](function(){_0x57c054[_0x2a73('0x24')](0xcc)[_0x2a73('0x2c')]();});}};}function handleEntityNotFound(_0x4563c6){return function(_0x3ebc1f){if(!_0x3ebc1f){_0x4563c6[_0x2a73('0x1e')](0x194);}return _0x3ebc1f;};}function handleError(_0x55025e,_0x18bd24){_0x18bd24=_0x18bd24||0x1f4;return function(_0x2ac8ba){logger[_0x2a73('0x19')](_0x2ac8ba[_0x2a73('0x2d')]);if(_0x2ac8ba[_0x2a73('0x2e')]){delete _0x2ac8ba[_0x2a73('0x2e')];}_0x55025e['status'](_0x18bd24)['send'](_0x2ac8ba);};}exports[_0x2a73('0x2f')]=function(_0x10b0ec,_0x5deb47){var _0x35b72d={'include':[{'model':db[_0x2a73('0x30')],'as':'mandatoryDispositionPause'}]},_0x42e047={},_0x4ca2b8={'count':0x0,'rows':[]};var _0x28df06=_[_0x2a73('0x31')](db[_0x2a73('0x32')]['rawAttributes'],function(_0x169c8f){return{'name':_0x169c8f[_0x2a73('0x33')],'type':_0x169c8f[_0x2a73('0x34')]['key']};});_0x42e047['model']=_['map'](_0x28df06,_0x2a73('0x2e'));_0x42e047['query']=_['keys'](_0x10b0ec[_0x2a73('0x35')]);_0x42e047[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x42e047[_0x2a73('0x38')],_0x42e047[_0x2a73('0x35')]);_0x35b72d[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x42e047[_0x2a73('0x38')],qs[_0x2a73('0x3a')](_0x10b0ec[_0x2a73('0x35')][_0x2a73('0x3a')]));_0x35b72d[_0x2a73('0x39')]=_0x35b72d[_0x2a73('0x39')][_0x2a73('0x3b')]?_0x35b72d[_0x2a73('0x39')]:_0x42e047[_0x2a73('0x38')];if(!_0x10b0ec[_0x2a73('0x35')][_0x2a73('0x3c')](_0x2a73('0x3d'))){_0x35b72d[_0x2a73('0x22')]=qs[_0x2a73('0x22')](_0x10b0ec['query'][_0x2a73('0x22')]);_0x35b72d[_0x2a73('0x20')]=qs['offset'](_0x10b0ec[_0x2a73('0x35')][_0x2a73('0x20')]);}_0x35b72d[_0x2a73('0x3e')]=qs[_0x2a73('0x3f')](_0x10b0ec[_0x2a73('0x35')]['sort']);_0x35b72d[_0x2a73('0x40')]=qs[_0x2a73('0x36')](_['pick'](_0x10b0ec['query'],_0x42e047[_0x2a73('0x36')]),_0x28df06);if(_0x10b0ec[_0x2a73('0x35')]['filter']){_0x35b72d[_0x2a73('0x40')]=_['merge'](_0x35b72d[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0x28df06,function(_0x4f0b34){if(_0x4f0b34['type']!==_0x2a73('0x41')){var _0x1b19e4={};_0x1b19e4[_0x4f0b34['name']]={'$like':'%'+_0x10b0ec[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x1b19e4;}})});}_0x35b72d=_[_0x2a73('0x43')]({},_0x35b72d,_0x10b0ec[_0x2a73('0x44')]);var _0x2c575b={'where':_0x35b72d[_0x2a73('0x40')]};return db[_0x2a73('0x32')][_0x2a73('0x23')](_0x2c575b)[_0x2a73('0x27')](function(_0x100f35){_0x4ca2b8[_0x2a73('0x23')]=_0x100f35;if(_0x10b0ec[_0x2a73('0x35')][_0x2a73('0x45')]){_0x35b72d[_0x2a73('0x46')]=[{'all':!![]}];}return db[_0x2a73('0x32')][_0x2a73('0x47')](_0x35b72d);})[_0x2a73('0x27')](function(_0x3e5fa0){_0x4ca2b8['rows']=_0x3e5fa0;return _0x4ca2b8;})[_0x2a73('0x27')](respondWithFilteredResult(_0x5deb47,_0x35b72d))[_0x2a73('0x1c')](handleError(_0x5deb47,null));};exports[_0x2a73('0x48')]=function(_0x237ab2,_0x358377){var _0x4550ab={'raw':![],'where':{'id':_0x237ab2[_0x2a73('0x49')]['id']},'include':[{'model':db[_0x2a73('0x30')],'as':_0x2a73('0x4a')}]},_0x3587ca={};_0x3587ca[_0x2a73('0x38')]=_[_0x2a73('0x4b')](db[_0x2a73('0x32')][_0x2a73('0x4c')]);_0x3587ca[_0x2a73('0x35')]=_[_0x2a73('0x4b')](_0x237ab2[_0x2a73('0x35')]);_0x3587ca[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x3587ca[_0x2a73('0x38')],_0x3587ca[_0x2a73('0x35')]);_0x4550ab[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x3587ca['model'],qs[_0x2a73('0x3a')](_0x237ab2[_0x2a73('0x35')][_0x2a73('0x3a')]));_0x4550ab[_0x2a73('0x39')]=_0x4550ab[_0x2a73('0x39')][_0x2a73('0x3b')]?_0x4550ab[_0x2a73('0x39')]:_0x3587ca[_0x2a73('0x38')];if(_0x237ab2[_0x2a73('0x35')][_0x2a73('0x45')]){_0x4550ab[_0x2a73('0x46')]=[{'all':!![]}];}_0x4550ab=_[_0x2a73('0x43')]({},_0x4550ab,_0x237ab2[_0x2a73('0x44')]);return db['ChatWebsite'][_0x2a73('0x4d')](_0x4550ab)[_0x2a73('0x27')](handleEntityNotFound(_0x358377,null))[_0x2a73('0x27')](respondWithResult(_0x358377,null))[_0x2a73('0x1c')](handleError(_0x358377,null));};exports[_0x2a73('0x4e')]=function(_0x1ac43e,_0x27c550){return db['ChatWebsite'][_0x2a73('0x4e')](_0x1ac43e[_0x2a73('0x4f')],{})[_0x2a73('0x27')](function(_0x5d3c1a){var _0x1537fe=_0x1ac43e[_0x2a73('0x50')]['get']({'plain':!![]});if(!_0x1537fe)throw new Error(_0x2a73('0x51'));if(_0x1537fe[_0x2a73('0x52')]===_0x2a73('0x50')){var _0x563108=_0x5d3c1a[_0x2a73('0x29')]({'plain':!![]});var _0x3de5b6=_0x2a73('0x2a');return db[_0x2a73('0x53')][_0x2a73('0x4d')]({'where':{'name':_0x3de5b6,'userProfileId':_0x1537fe['userProfileId']},'raw':!![]})[_0x2a73('0x27')](function(_0x147f49){if(_0x147f49&&_0x147f49[_0x2a73('0x54')]===0x0){return db[_0x2a73('0x2b')]['create']({'name':_0x563108[_0x2a73('0x2e')],'resourceId':_0x563108['id'],'type':_0x147f49[_0x2a73('0x2e')],'sectionId':_0x147f49['id']},{})['then'](function(){return _0x5d3c1a;});}else{return _0x5d3c1a;}})['catch'](function(_0x2c517a){logger[_0x2a73('0x19')](_0x2a73('0x55'),_0x2c517a);throw _0x2c517a;});}return _0x5d3c1a;})['then'](respondWithResult(_0x27c550,0xc9))['catch'](handleError(_0x27c550,null));};exports[_0x2a73('0x56')]=function(_0x431508,_0x598f4c){if(_0x431508[_0x2a73('0x4f')]['id']){delete _0x431508[_0x2a73('0x4f')]['id'];}return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x431508[_0x2a73('0x49')]['id']},'include':[{'model':db[_0x2a73('0x30')],'as':'mandatoryDispositionPause'}]})[_0x2a73('0x27')](handleEntityNotFound(_0x598f4c,null))[_0x2a73('0x27')](saveUpdates(_0x431508[_0x2a73('0x4f')],null))[_0x2a73('0x27')](respondWithResult(_0x598f4c,null))[_0x2a73('0x1c')](handleError(_0x598f4c,null));};exports[_0x2a73('0x28')]=function(_0x28d67a,_0xa0af82){return db[_0x2a73('0x32')]['find']({'where':{'id':_0x28d67a['params']['id']}})['then'](handleEntityNotFound(_0xa0af82,null))['then'](removeEntity(_0xa0af82,null))['catch'](handleError(_0xa0af82,null));};exports[_0x2a73('0x57')]=function(_0x58d44a,_0x1efc09){return db[_0x2a73('0x32')]['describe']()['then'](respondWithResult(_0x1efc09,null))[_0x2a73('0x1c')](handleError(_0x1efc09,null));};exports[_0x2a73('0x58')]=function(_0x5a102e,_0x201181){if(_0x5a102e[_0x2a73('0x4f')]['id']){delete _0x5a102e[_0x2a73('0x4f')]['id'];}return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x5a102e[_0x2a73('0x49')]['id']}})['then'](handleEntityNotFound(_0x201181,null))[_0x2a73('0x27')](function(_0x5dd317){if(_0x5dd317){_0x5a102e[_0x2a73('0x4f')][_0x2a73('0x59')]=_0x5dd317['id'];return db[_0x2a73('0x5a')][_0x2a73('0x4e')](_0x5a102e['body']);}})[_0x2a73('0x27')](respondWithResult(_0x201181,null))[_0x2a73('0x1c')](handleError(_0x201181,null));};exports[_0x2a73('0x5b')]=function(_0x58765e,_0x574b92){var _0x5d190f={'raw':![],'where':{}};var _0x47597f={};var _0x5d6513={'count':0x0,'rows':[]};return db[_0x2a73('0x32')][_0x2a73('0x5c')]({'where':{'id':_0x58765e[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x574b92,null))['then'](function(_0x67a17b){if(_0x67a17b){_0x47597f[_0x2a73('0x38')]=_[_0x2a73('0x4b')](db[_0x2a73('0x5a')][_0x2a73('0x4c')]);_0x47597f[_0x2a73('0x35')]=_['keys'](_0x58765e['query']);_0x47597f[_0x2a73('0x36')]=_['intersection'](_0x47597f[_0x2a73('0x38')],_0x47597f[_0x2a73('0x35')]);_0x5d190f[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x47597f[_0x2a73('0x38')],qs['fields'](_0x58765e['query'][_0x2a73('0x3a')]));_0x5d190f[_0x2a73('0x39')]=_0x5d190f[_0x2a73('0x39')][_0x2a73('0x3b')]?_0x5d190f[_0x2a73('0x39')]:_0x47597f[_0x2a73('0x38')];if(!_0x58765e[_0x2a73('0x35')][_0x2a73('0x3c')](_0x2a73('0x3d'))){_0x5d190f[_0x2a73('0x22')]=qs[_0x2a73('0x22')](_0x58765e[_0x2a73('0x35')][_0x2a73('0x22')]);_0x5d190f[_0x2a73('0x20')]=qs[_0x2a73('0x20')](_0x58765e[_0x2a73('0x35')][_0x2a73('0x20')]);}_0x5d190f[_0x2a73('0x3e')]=qs[_0x2a73('0x3f')](_0x58765e[_0x2a73('0x35')][_0x2a73('0x3f')]);_0x5d190f[_0x2a73('0x40')]=qs[_0x2a73('0x36')](_[_0x2a73('0x5d')](_0x58765e[_0x2a73('0x35')],_0x47597f[_0x2a73('0x36')]));_0x5d190f[_0x2a73('0x40')]['ChatWebsiteId']=_0x67a17b['id'];if(_0x58765e['query'][_0x2a73('0x42')]){_0x5d190f[_0x2a73('0x40')]=_[_0x2a73('0x43')](_0x5d190f[_0x2a73('0x40')],{'$or':_['map'](_0x5d190f['attributes'],function(_0x17f280){var _0x117aee={};_0x117aee[_0x17f280]={'$like':'%'+_0x58765e[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x117aee;})});}_0x5d190f=_[_0x2a73('0x43')]({},_0x5d190f,_0x58765e[_0x2a73('0x44')]);return db[_0x2a73('0x5a')]['count']({'where':_0x5d190f[_0x2a73('0x40')]})[_0x2a73('0x27')](function(_0x118d60){_0x5d6513[_0x2a73('0x23')]=_0x118d60;if(_0x58765e[_0x2a73('0x35')][_0x2a73('0x45')]){_0x5d190f['include']=[{'all':!![]}];}return db[_0x2a73('0x5a')]['findAll'](_0x5d190f);})[_0x2a73('0x27')](function(_0x51b12e){_0x5d6513[_0x2a73('0x5e')]=_0x51b12e;return _0x5d6513;});}})[_0x2a73('0x27')](respondWithFilteredResult(_0x574b92,_0x5d190f))[_0x2a73('0x1c')](handleError(_0x574b92,null));};exports[_0x2a73('0x5f')]=function(_0xa7af96,_0x1a3671){return db['ChatWebsite'][_0x2a73('0x4d')]({'where':{'id':_0xa7af96[_0x2a73('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a3671,null))['then'](function(_0x5386ec){if(_0x5386ec){return _0x5386ec['removeDispositions'](_0xa7af96[_0x2a73('0x35')][_0x2a73('0x60')]);}})[_0x2a73('0x27')](respondWithStatusCode(_0x1a3671,null))[_0x2a73('0x1c')](handleError(_0x1a3671,null));};exports['addAnswer']=function(_0x2f39da,_0x439175){if(_0x2f39da[_0x2a73('0x4f')]['id']){delete _0x2f39da[_0x2a73('0x4f')]['id'];}return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x2f39da[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x439175,null))[_0x2a73('0x27')](function(_0x37d2dd){if(_0x37d2dd){_0x2f39da[_0x2a73('0x4f')][_0x2a73('0x59')]=_0x37d2dd['id'];return db['CannedAnswer'][_0x2a73('0x4e')](_0x2f39da[_0x2a73('0x4f')]);}})[_0x2a73('0x27')](respondWithResult(_0x439175,null))[_0x2a73('0x1c')](handleError(_0x439175,null));};exports[_0x2a73('0x61')]=function(_0x3647bc,_0x5dcb4c){var _0x71d681={'raw':![],'where':{}};var _0x20a1d0={};var _0x4b968c={'count':0x0,'rows':[]};return db[_0x2a73('0x32')]['findOne']({'where':{'id':_0x3647bc['params']['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x5dcb4c,null))['then'](function(_0x2616ab){if(_0x2616ab){_0x20a1d0[_0x2a73('0x38')]=_['keys'](db[_0x2a73('0x62')][_0x2a73('0x4c')]);_0x20a1d0[_0x2a73('0x35')]=_[_0x2a73('0x4b')](_0x3647bc[_0x2a73('0x35')]);_0x20a1d0[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x20a1d0[_0x2a73('0x38')],_0x20a1d0[_0x2a73('0x35')]);_0x71d681[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x20a1d0['model'],qs['fields'](_0x3647bc[_0x2a73('0x35')]['fields']));_0x71d681[_0x2a73('0x39')]=_0x71d681[_0x2a73('0x39')]['length']?_0x71d681[_0x2a73('0x39')]:_0x20a1d0['model'];if(!_0x3647bc[_0x2a73('0x35')][_0x2a73('0x3c')](_0x2a73('0x3d'))){_0x71d681[_0x2a73('0x22')]=qs[_0x2a73('0x22')](_0x3647bc['query'][_0x2a73('0x22')]);_0x71d681[_0x2a73('0x20')]=qs[_0x2a73('0x20')](_0x3647bc[_0x2a73('0x35')]['offset']);}_0x71d681[_0x2a73('0x3e')]=qs[_0x2a73('0x3f')](_0x3647bc['query'][_0x2a73('0x3f')]);_0x71d681['where']=qs[_0x2a73('0x36')](_[_0x2a73('0x5d')](_0x3647bc['query'],_0x20a1d0[_0x2a73('0x36')]));_0x71d681[_0x2a73('0x40')][_0x2a73('0x59')]=_0x2616ab['id'];if(_0x3647bc['query'][_0x2a73('0x42')]){_0x71d681[_0x2a73('0x40')]=_[_0x2a73('0x43')](_0x71d681[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0x71d681['attributes'],function(_0x3d31dc){var _0x19f388={};_0x19f388[_0x3d31dc]={'$like':'%'+_0x3647bc[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x19f388;})});}_0x71d681=_['merge']({},_0x71d681,_0x3647bc[_0x2a73('0x44')]);return db[_0x2a73('0x62')]['count']({'where':_0x71d681[_0x2a73('0x40')]})[_0x2a73('0x27')](function(_0x5a8db4){_0x4b968c[_0x2a73('0x23')]=_0x5a8db4;if(_0x3647bc[_0x2a73('0x35')][_0x2a73('0x45')]){_0x71d681[_0x2a73('0x46')]=[{'all':!![]}];}return db[_0x2a73('0x62')][_0x2a73('0x47')](_0x71d681);})[_0x2a73('0x27')](function(_0x44deb5){_0x4b968c[_0x2a73('0x5e')]=_0x44deb5;return _0x4b968c;});}})[_0x2a73('0x27')](respondWithFilteredResult(_0x5dcb4c,_0x71d681))[_0x2a73('0x1c')](handleError(_0x5dcb4c,null));};exports[_0x2a73('0x63')]=function(_0x317fca,_0x2ceecf){return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x317fca[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x2ceecf,null))['then'](function(_0x2e50f7){if(_0x2e50f7){return _0x2e50f7[_0x2a73('0x63')](_0x317fca['query'][_0x2a73('0x60')]);}})['then'](respondWithStatusCode(_0x2ceecf,null))['catch'](handleError(_0x2ceecf,null));};exports[_0x2a73('0x64')]=function(_0x3f67b6,_0x321684){_0x3f67b6[_0x2a73('0x4f')][_0x2a73('0x65')]=_0x3f67b6[_0x2a73('0x66')]['filename'];return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x3f67b6['params']['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x321684,null))['then'](saveUpdates(_0x3f67b6['body'],null))[_0x2a73('0x27')](respondWithResult(_0x321684,null))[_0x2a73('0x1c')](handleError(_0x321684,null));};exports[_0x2a73('0x67')]=function(_0x25a2ec,_0x4aad2b){_0x25a2ec[_0x2a73('0x4f')][_0x2a73('0x68')]=_0x25a2ec[_0x2a73('0x66')][_0x2a73('0x69')];return db['ChatWebsite'][_0x2a73('0x4d')]({'where':{'id':_0x25a2ec[_0x2a73('0x49')]['id']}})['then'](handleEntityNotFound(_0x4aad2b,null))[_0x2a73('0x27')](saveUpdates(_0x25a2ec['body'],null))[_0x2a73('0x27')](respondWithResult(_0x4aad2b,null))[_0x2a73('0x1c')](handleError(_0x4aad2b,null));};exports[_0x2a73('0x6a')]=function(_0x345a37,_0x3e7e60){_0x345a37[_0x2a73('0x4f')][_0x2a73('0x6b')]=_0x345a37[_0x2a73('0x66')][_0x2a73('0x69')];return db[_0x2a73('0x32')]['find']({'where':{'id':_0x345a37[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x3e7e60,null))[_0x2a73('0x27')](saveUpdates(_0x345a37[_0x2a73('0x4f')],null))[_0x2a73('0x27')](respondWithResult(_0x3e7e60,null))[_0x2a73('0x1c')](handleError(_0x3e7e60,null));};exports['addSystemAvatar']=function(_0x500cb5,_0x39aefa){_0x500cb5[_0x2a73('0x4f')]['systemAvatar']=_0x500cb5['file'][_0x2a73('0x69')];return db['ChatWebsite']['find']({'where':{'id':_0x500cb5[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x39aefa,null))[_0x2a73('0x27')](saveUpdates(_0x500cb5['body'],null))[_0x2a73('0x27')](respondWithResult(_0x39aefa,null))['catch'](handleError(_0x39aefa,null));};exports[_0x2a73('0x6c')]=function(_0x213f45,_0xa7bf78){var _0xb872d6=path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],'server/files/images/logos/default_logo.svg');var _0x4123b5={'where':{'id':_0x213f45['params']['id']},'attributes':['id',_0x2a73('0x65')],'raw':!![]};var _0x48bb2f=![];return require(_0x2a73('0x6f'))[_0x2a73('0x70')]()[_0x2a73('0x27')](function(_0x3889bb){if(_0x3889bb){_0x48bb2f=_0x3889bb[_0x2a73('0x71')];}})[_0x2a73('0x27')](function(){return db['ChatWebsite'][_0x2a73('0x4d')](_0x4123b5);})[_0x2a73('0x27')](handleEntityNotFound(_0xa7bf78,null))[_0x2a73('0x27')](function(_0x5c46ac){if(_0x5c46ac){if(!_[_0x2a73('0x72')](_0x5c46ac['sitepic'])){if(fs[_0x2a73('0x73')](path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x74'),_0x5c46ac[_0x2a73('0x65')]))&&_0x48bb2f){_0xb872d6=path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x74'),_0x5c46ac[_0x2a73('0x65')]);}}return _0xa7bf78[_0x2a73('0x75')](_0xb872d6);}})[_0x2a73('0x1c')](handleError(_0xa7bf78,null));};exports[_0x2a73('0x76')]=function(_0x4ee30b,_0x19d7b4){var _0x4bf80c=path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x77'));var _0x1fc490={'where':{'id':_0x4ee30b['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x2a73('0x32')][_0x2a73('0x4d')](_0x1fc490)[_0x2a73('0x27')](handleEntityNotFound(_0x19d7b4,null))[_0x2a73('0x27')](function(_0x540407){if(_0x540407){if(!_[_0x2a73('0x72')](_0x540407[_0x2a73('0x68')])){if(fs['existsSync'](path[_0x2a73('0x6d')](config['root'],'server/files/images/avatars/',_0x540407[_0x2a73('0x68')]))){_0x4bf80c=path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x78'),_0x540407[_0x2a73('0x68')]);}}return _0x19d7b4[_0x2a73('0x75')](_0x4bf80c);}})[_0x2a73('0x1c')](handleError(_0x19d7b4,null));};exports[_0x2a73('0x79')]=function(_0x325d20,_0x50efde){var _0x4abcd8=path['join'](config[_0x2a73('0x6e')],_0x2a73('0x7a'));var _0x374ba1={'where':{'id':_0x325d20[_0x2a73('0x49')]['id']},'attributes':['id','customerAvatar',_0x2a73('0x7b')],'raw':!![]};return db[_0x2a73('0x32')]['find'](_0x374ba1)[_0x2a73('0x27')](handleEntityNotFound(_0x50efde,null))[_0x2a73('0x27')](function(_0x2a2eb4){if(_0x2a2eb4){if(!_[_0x2a73('0x72')](_0x2a2eb4['customerAvatar'])){if(fs[_0x2a73('0x73')](path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x78'),_0x2a2eb4[_0x2a73('0x6b')]))&&_0x2a2eb4['showCustomerAvatar']){_0x4abcd8=path[_0x2a73('0x6d')](config['root'],_0x2a73('0x78'),_0x2a2eb4[_0x2a73('0x6b')]);}}return _0x50efde[_0x2a73('0x75')](_0x4abcd8);}})[_0x2a73('0x1c')](handleError(_0x50efde,null));};exports[_0x2a73('0x7c')]=function(_0x431073,_0x28305d){var _0x2d94b1=path[_0x2a73('0x6d')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x632ad9={'where':{'id':_0x431073[_0x2a73('0x49')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x2a73('0x4d')](_0x632ad9)[_0x2a73('0x27')](handleEntityNotFound(_0x28305d,null))[_0x2a73('0x27')](function(_0x3ec910){if(_0x3ec910){if(!_['isNil'](_0x3ec910['systemAvatar'])){if(fs[_0x2a73('0x73')](path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x78'),_0x3ec910['systemAvatar']))){_0x2d94b1=path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x78'),_0x3ec910['systemAvatar']);}}return _0x28305d[_0x2a73('0x75')](_0x2d94b1);}})[_0x2a73('0x1c')](handleError(_0x28305d,null));};exports[_0x2a73('0x7d')]=function(_0x445aee,_0x5b2fd8){var _0x56dfa9=require(_0x2a73('0x7e'));var _0x5d3286=new _0x56dfa9();var _0x1dc1eb=_0x5d3286[_0x2a73('0x7f')](_0x445aee[_0x2a73('0x80')][_0x2a73('0x81')])[_0x2a73('0x82')]();var _0x123af1={'body':_0x445aee['body'],'channel':_0x2a73('0x83')};var _0x3106b8=[];var _0x718c95=[];var _0x40fd1d={};var _0x309b56=![];return db[_0x2a73('0x84')][_0x2a73('0x57')]()[_0x2a73('0x27')](function(_0x323ccd){if(!_0x323ccd){throw new db['Sequelize']['ValidationError'](_0x2a73('0x85'));}_0x3106b8=_[_0x2a73('0x86')](_['keys'](_0x323ccd),['createdAt',_0x2a73('0x87')]);_0x718c95=_[_0x2a73('0x86')](_[_0x2a73('0x4b')](_0x323ccd),[_0x2a73('0x88'),_0x2a73('0x87'),_0x2a73('0x89'),'ListId']);if(_0x445aee[_0x2a73('0x4f')]['id']){delete _0x445aee[_0x2a73('0x4f')]['id'];}if(_['isNil'](_0x445aee[_0x2a73('0x4f')][_0x2a73('0x8a')])){throw new db[(_0x2a73('0x8b'))][(_0x2a73('0x8c'))](_0x2a73('0x8d'));}if(_[_0x2a73('0x72')](_0x445aee['body'][_0x2a73('0x4f')])||_0x445aee[_0x2a73('0x4f')][_0x2a73('0x4f')]===''){throw new db['Sequelize'][(_0x2a73('0x8c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2a73('0x72')](_0x445aee[_0x2a73('0x4f')][_0x2a73('0x8e')])){throw new db[(_0x2a73('0x8b'))][(_0x2a73('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x718c95);}if(!_['includes'](_0x718c95,_0x445aee[_0x2a73('0x4f')]['mapKey'])){throw new db[(_0x2a73('0x8b'))][(_0x2a73('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x718c95);}_0x40fd1d[_0x445aee[_0x2a73('0x4f')]['mapKey']]=_0x445aee[_0x2a73('0x4f')][_0x2a73('0x8a')];})[_0x2a73('0x27')](function(){return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x445aee[_0x2a73('0x49')]['id']},'include':[{'model':db[_0x2a73('0x8f')],'as':'List','include':[{'model':db[_0x2a73('0x84')],'as':_0x2a73('0x90'),'where':_0x40fd1d,'limit':0x1,'order':[[_0x2a73('0x87'),_0x2a73('0x91')]]}]},{'model':db[_0x2a73('0x92')],'as':_0x2a73('0x93')}]});})[_0x2a73('0x27')](handleEntityNotFound(_0x5b2fd8,null))['then'](function(_0x510c62){if(_0x510c62&&_0x510c62[_0x2a73('0x94')]){_0x123af1[_0x2a73('0x95')]=_0x510c62;_0x123af1[_0x2a73('0x96')]=_0x510c62[_0x2a73('0x93')];_0x123af1[_0x2a73('0x97')]=_0x510c62[_0x2a73('0x94')];_0x123af1[_0x2a73('0x96')]=_[_0x2a73('0x98')](_0x123af1[_0x2a73('0x96')],[_0x2a73('0x99')],[_0x2a73('0x9a')]);if(_0x123af1[_0x2a73('0x95')]['Applications']){delete _0x123af1[_0x2a73('0x95')][_0x2a73('0x93')];}if(_0x123af1[_0x2a73('0x95')][_0x2a73('0x94')]&&_0x123af1['account'][_0x2a73('0x94')][_0x2a73('0x90')][_0x2a73('0x3b')]){return _0x123af1[_0x2a73('0x95')][_0x2a73('0x94')][_0x2a73('0x90')][0x0];}var _0x39c6ec=_[_0x2a73('0xc')](_0x445aee['body'],{'firstName':_0x445aee['body'][_0x2a73('0x8a')],'ListId':_0x510c62[_0x2a73('0x9b')]});_0x39c6ec[_0x445aee[_0x2a73('0x4f')][_0x2a73('0x8e')]]=_0x445aee[_0x2a73('0x4f')][_0x2a73('0x8a')];return db[_0x2a73('0x84')][_0x2a73('0x4e')](_0x39c6ec,{'fields':_0x3106b8,'raw':!![]});}})['then'](handleEntityNotFound(_0x5b2fd8,null))[_0x2a73('0x27')](function(_0x2126ce){_0x123af1[_0x2a73('0x9c')]=_0x2126ce;var _0x4ab935=_0x445aee[_0x2a73('0x4f')][_0x2a73('0x9d')];if(_0x445aee[_0x2a73('0x80')][_0x2a73('0x9e')]){_0x4ab935=_0x445aee[_0x2a73('0x80')][_0x2a73('0x9e')];}else if(_0x445aee['headers'][_0x2a73('0x9f')]){_0x4ab935=_[_0x2a73('0xa0')](_0x445aee['headers'][_0x2a73('0x9f')][_0x2a73('0xa1')](','));}if(_0x2126ce){var _0x2b43cb={'ContactId':_0x2126ce['id'],'ChatWebsiteId':_0x445aee[_0x2a73('0x49')]['id'],'from':(_0x2126ce[_0x2a73('0xa2')]||'')+'\x20'+(_0x2126ce[_0x2a73('0xa3')]||''),'customerIp':_0x4ab935,'customerPort':_0x445aee[_0x2a73('0x80')][_0x2a73('0xa4')]?_0x445aee[_0x2a73('0x80')][_0x2a73('0xa4')]:null,'referer':_0x445aee[_0x2a73('0x4f')][_0x2a73('0xa5')],'browserName':_0x1dc1eb[_0x2a73('0xa6')][_0x2a73('0x2e')]&&_0x1dc1eb[_0x2a73('0xa6')][_0x2a73('0xa7')]?util[_0x2a73('0xa8')]('%s\x20%s',_0x1dc1eb[_0x2a73('0xa6')]['name'],_0x1dc1eb['browser']['version']):_0x2a73('0xa9'),'browserVersion':_0x1dc1eb['browser'][_0x2a73('0xa7')]||'unknown','osName':util[_0x2a73('0xa8')](_0x2a73('0xaa'),_0x1dc1eb['os'][_0x2a73('0x2e')],_0x1dc1eb['os']['version']),'osVersion':_0x1dc1eb['os']['version'],'deviceModel':_0x1dc1eb['device']['model']&&_0x1dc1eb[_0x2a73('0xab')][_0x2a73('0xac')]?util[_0x2a73('0xa8')]('%s\x20%s\x20%s',_0x1dc1eb[_0x2a73('0xab')][_0x2a73('0x38')],_0x1dc1eb[_0x2a73('0xab')][_0x2a73('0xac')],_0x1dc1eb[_0x2a73('0xab')][_0x2a73('0x34')]):null,'deviceVendor':_0x1dc1eb['device'][_0x2a73('0xac')],'deviceType':_0x1dc1eb[_0x2a73('0xab')]['type'],'formData':JSON[_0x2a73('0x18')](_0x445aee['body'])};var _0x3dcd89={'ChatWebsiteId':_0x445aee[_0x2a73('0x49')]['id'],'closed':![]};if(_0x445aee[_0x2a73('0x4f')][_0x2a73('0xad')]){_0x3dcd89['threadId']=_0x445aee[_0x2a73('0x4f')]['threadId'];return db[_0x2a73('0xae')]['find']({'where':_0x3dcd89})['then'](function(_0x34342d){if(_0x34342d){return[_0x34342d,![]];}_0x2b43cb[_0x2a73('0xad')]=_0x445aee[_0x2a73('0x4f')][_0x2a73('0xad')];_0x2b43cb[_0x2a73('0xaf')]=_0x445aee[_0x2a73('0x4f')][_0x2a73('0xaf')];return db[_0x2a73('0xae')][_0x2a73('0x4e')](_0x2b43cb)[_0x2a73('0x27')](function(_0x46b773){return[_0x46b773,!![]];});});}_0x3dcd89[_0x2a73('0xb0')]=_0x2126ce['id'];if(_0x445aee[_0x2a73('0x4f')][_0x2a73('0xb1')]&&_0x445aee[_0x2a73('0x4f')][_0x2a73('0xb1')]['id']){_0x3dcd89['id']=_0x445aee['body'][_0x2a73('0xb1')]['id'];return db[_0x2a73('0xae')][_0x2a73('0x4d')]({'where':_0x3dcd89})[_0x2a73('0x27')](function(_0x56eae3){if(_0x56eae3){return[_0x56eae3,![]];}return db[_0x2a73('0xae')][_0x2a73('0x4e')](_0x2b43cb)[_0x2a73('0x27')](function(_0x14f218){return[_0x14f218,!![]];});});}return db[_0x2a73('0xae')][_0x2a73('0x4e')](_0x2b43cb)[_0x2a73('0x27')](function(_0x2a057e){return[_0x2a057e,!![]];});}})[_0x2a73('0xb2')](function(_0x6db390,_0x4a1d83){if(_0x6db390){_0x309b56=_0x4a1d83;if(!_0x4a1d83){var _0x312ab5={'from':(_0x123af1[_0x2a73('0x9c')]['firstName']||'')+'\x20'+(_0x123af1[_0x2a73('0x9c')][_0x2a73('0xa3')]||'')};if(_0x445aee[_0x2a73('0x4f')][_0x2a73('0xad')]&&_0x445aee['body'][_0x2a73('0xb3')]&&_0x445aee['body']['threadId']!=_0x445aee[_0x2a73('0x4f')]['messageId']){_0x312ab5['threadId']=_0x445aee[_0x2a73('0x4f')]['messageId'];}return _0x6db390[_0x2a73('0x56')](_0x312ab5);}else{return _0x6db390;}}})['then'](function(_0x3e2896){_0x123af1[_0x2a73('0xb1')]=_0x3e2896[_0x2a73('0x29')]({'plain':!![]});_0x123af1['interaction'][_0x2a73('0xb4')]=_0x309b56;if(_0x123af1[_0x2a73('0xb1')][_0x2a73('0xb4')]){if(_0x123af1['account'][_0x2a73('0xb5')]){_0x123af1[_0x2a73('0x96')]['push']({'id':0x0,'priority':_0x123af1[_0x2a73('0x96')][_0x2a73('0x3b')]+0x1,'app':_0x2a73('0xb6'),'appdata':_0x2a73('0xb7'),'interval':_0x2a73('0xb8')});}}return db[_0x2a73('0xb9')][_0x2a73('0x4e')]({'body':_0x445aee['body'][_0x2a73('0x4f')],'ChatWebsiteId':_0x445aee[_0x2a73('0x49')]['id'],'ChatInteractionId':_0x3e2896['id'],'direction':'in','ContactId':_0x123af1[_0x2a73('0x9c')]['id'],'AttachmentId':_0x445aee[_0x2a73('0x4f')]['AttachmentId']});})[_0x2a73('0x27')](function(_0x42da0e){_0x123af1[_0x2a73('0x1a')]=_0x42da0e;if(_0x123af1[_0x2a73('0xb1')][_0x2a73('0xba')]){return db[_0x2a73('0xbb')][_0x2a73('0x4d')]({'attributes':['id',_0x2a73('0x2e')],'where':{'id':_0x123af1[_0x2a73('0xb1')][_0x2a73('0xba')]}})[_0x2a73('0x27')](function(_0xc25cbd){if(_0xc25cbd){_0x123af1['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2a73('0xbc'),'appdata':_0xc25cbd[_0x2a73('0x2e')]+','+(_0x123af1[_0x2a73('0x95')][_0x2a73('0xbd')]||0xa),'interval':_0x2a73('0xb8')});_0x123af1['forcedOwnership']=!![];}return respondWithRpcPromise(_0x2a73('0xbe'),_0x2a73('0xbf'),_0x123af1);});}return respondWithRpcPromise(_0x2a73('0xbe'),_0x2a73('0xbf'),_0x123af1);})[_0x2a73('0x27')](function(_0xe2be1b){respondWithRpcPromise(_0x2a73('0xc0'),'EventManager',{'event':'notify','message':_0xe2be1b},client9002);return _0xe2be1b;})[_0x2a73('0x27')](respondWithResult(_0x5b2fd8,null))[_0x2a73('0x1c')](handleError(_0x5b2fd8,null));};exports[_0x2a73('0xc1')]=function(_0x214f94,_0x25a97e){var _0x35e879,_0x32d471,_0x3ac23e;var _0x134c62=[];var _0x2c0695={};var _0x3c150a=_0x214f94[_0x2a73('0xc2')]||[];var _0x281d9e=[];var _0x115d45;return db[_0x2a73('0x84')]['describe']()['then'](function(_0x19354d){if(!_0x19354d){throw new db[(_0x2a73('0x8b'))][(_0x2a73('0x8c'))]('no\x20available\x20attributes');}_0x134c62=_[_0x2a73('0x86')](_[_0x2a73('0x4b')](_0x19354d),[_0x2a73('0x88'),_0x2a73('0x87'),_0x2a73('0x89'),_0x2a73('0x9b')]);if(_0x214f94[_0x2a73('0x4f')]['id']){delete _0x214f94[_0x2a73('0x4f')]['id'];}if(_['isNil'](_0x214f94[_0x2a73('0x4f')][_0x2a73('0x8a')])){throw _0x25a97e['status'](0x1f4)[_0x2a73('0xc3')](new db[(_0x2a73('0x8b'))][(_0x2a73('0x8c'))](_0x2a73('0x8d')));}if(_[_0x2a73('0x72')](_0x214f94[_0x2a73('0x4f')][_0x2a73('0x4f')])||_0x214f94[_0x2a73('0x4f')][_0x2a73('0x4f')]===''){throw _0x25a97e[_0x2a73('0x24')](0x1f4)[_0x2a73('0xc3')](new db[(_0x2a73('0x8b'))][(_0x2a73('0x8c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2a73('0x72')](_0x214f94['body'][_0x2a73('0xc4')])){throw _0x25a97e['status'](0x1f4)[_0x2a73('0xc3')](new db[(_0x2a73('0x8b'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x134c62));}if(!_[_0x2a73('0xc5')](_0x134c62,_0x214f94[_0x2a73('0x4f')][_0x2a73('0xc4')])){throw _0x25a97e[_0x2a73('0x24')](0x1f4)['send'](new db[(_0x2a73('0x8b'))]['ValidationError'](_0x2a73('0xc6')+_0x134c62));}_0x2c0695[_0x214f94[_0x2a73('0x4f')][_0x2a73('0xc4')]]=_0x214f94[_0x2a73('0x4f')][_0x2a73('0x8a')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x214f94[_0x2a73('0x49')]['id']},'include':[{'model':db[_0x2a73('0x8f')],'as':_0x2a73('0x94')},{'model':db[_0x2a73('0xc7')],'as':_0x2a73('0xc7')}]});})['then'](handleEntityNotFound(_0x25a97e,null))[_0x2a73('0x27')](function(_0x355cc6){if(_0x355cc6&&_0x355cc6['List']){_0x32d471=_0x355cc6;var _0x529c42=_[_0x2a73('0xc')](_0x214f94[_0x2a73('0x4f')],{'firstName':_0x214f94['body']['from'],'phone':_0x214f94[_0x2a73('0x4f')][_0x2a73('0x8a')],'ListId':_0x355cc6['ListId']});_0x529c42[_0x214f94[_0x2a73('0x4f')][_0x2a73('0xc4')]]=_0x214f94[_0x2a73('0x4f')][_0x2a73('0x8a')];return db[_0x2a73('0x84')][_0x2a73('0xc8')]({'where':_0x2c0695,'defaults':_0x529c42});}})[_0x2a73('0xb2')](function(_0x47be1e){if(_0x47be1e){_0x3ac23e=_0x47be1e;var _0x40ccd2=fs[_0x2a73('0xc9')](path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0xca')),'utf8');var _0x593cac=ejs[_0x2a73('0xcb')](_0x40ccd2,{'body':_['toPairs'](_0x214f94[_0x2a73('0x4f')][_0x2a73('0x4f')]),'bodyTitle':_0x32d471[_0x2a73('0xcc')]});return db[_0x2a73('0xcd')][_0x2a73('0x4e')]({'body':_0x593cac,'ContactId':_0x47be1e['id'],'ChatWebsiteId':_0x32d471['id']});}})[_0x2a73('0x27')](function(_0x57351a){_0x115d45=_0x57351a;if(_0x3c150a['length']){var _0x262a34=_0x3c150a[_0x2a73('0x31')](function(_0x10cceb){return{'name':_0x10cceb[_0x2a73('0xce')],'basename':_0x10cceb[_0x2a73('0x69')],'type':_0x10cceb['mimetype'],'ChatOfflineMessageId':_0x57351a['id']};});_0x281d9e=_0x262a34['map'](_0x3c5caf=>{var _0x1d8131={'filename':_0x3c5caf['name'],'path':path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0xcf'),_0x2a73('0xc2'),_0x2a73('0xd0'),_0x2a73('0xd1'),_0x3c5caf[_0x2a73('0xd2')])};return _0x1d8131;});if(!_0x32d471[_0x2a73('0xd3')]){return db['sequelize'][_0x2a73('0xd4')](function(_0x1cdfe2){return db[_0x2a73('0xd5')]['bulkCreate'](_0x262a34,{'transaction':_0x1cdfe2});});}}})[_0x2a73('0x27')](function(){if(_0x115d45){_0x35e879=_0x115d45;return db[_0x2a73('0xc7')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x2a73('0xd6')],'as':'Smtp','raw':!![]}]});}})[_0x2a73('0x27')](function(_0x182ec2){if(_0x182ec2&&_0x182ec2['Smtp']&&_0x32d471[_0x2a73('0xd7')]&&_0x32d471[_0x2a73('0xd8')]){var _0x161828={'tls':{'rejectUnauthorized':![]}};if(_0x182ec2[_0x2a73('0xd9')]['service']){_0x161828[_0x2a73('0xda')]=_0x182ec2[_0x2a73('0xd9')]['service'];}else{_0x161828[_0x2a73('0xdb')]=_0x182ec2[_0x2a73('0xd9')][_0x2a73('0xdb')];_0x161828[_0x2a73('0xdc')]=_0x182ec2['Smtp'][_0x2a73('0xdc')];_0x161828['secure']=_0x182ec2[_0x2a73('0xd9')][_0x2a73('0xdd')];}if(_0x182ec2[_0x2a73('0xd9')]['authentication']){_0x161828['auth']={'user':_0x182ec2[_0x2a73('0xd9')][_0x2a73('0x50')],'pass':_0x182ec2[_0x2a73('0xd9')]['pass']};}return respondWithRpcPromise('SendMail',_0x2a73('0xde'),{'account':_0x161828,'message':{'from':util[_0x2a73('0xa8')](_0x2a73('0xdf'),_0x182ec2[_0x2a73('0x2e')],_0x182ec2[_0x2a73('0xe0')]||_0x182ec2['Smtp'][_0x2a73('0x50')]),'to':_0x32d471[_0x2a73('0xd8')],'subject':_0x32d471[_0x2a73('0xe1')],'html':_0x35e879[_0x2a73('0x4f')],'attachments':_0x281d9e}},client9003)[_0x2a73('0x27')](function(){return _0x35e879;})['catch'](function(_0x339d4e){console[_0x2a73('0x19')](_0x339d4e);});}})[_0x2a73('0x27')](function(){if(_0x32d471&&_0x32d471[_0x2a73('0xd3')]&&_0x32d471[_0x2a73('0xe2')]){var _0x33ebfa=[];if(_0x3c150a['length']){_0x33ebfa=_0x3c150a[_0x2a73('0x31')](function(_0x55890b){return{'name':_0x55890b[_0x2a73('0xce')],'basename':_0x55890b[_0x2a73('0x69')],'type':_0x55890b[_0x2a73('0xe3')],'ChatOfflineMessageId':_0x115d45['id']};});}var _0x1776a8;if(!_[_0x2a73('0x72')](_0x32d471[_0x2a73('0xe4')])){var _0x493245=_[_0x2a73('0x31')](_0x214f94[_0x2a73('0x4f')],function(_0x126b46){return _0x126b46;});var _0x33ed9d=_[_0x2a73('0xe5')](_0x493245)[0x0];var _0x1114e7=_[_0x2a73('0xe6')](_0x33ed9d,function(_0x2123dd){return _0x2123dd;});_0x1776a8=_0x1114e7[0x1][_0x32d471['subjectOffline']];}var _0x36b775={'from':_0x3ac23e[_0x2a73('0xe0')],'firstName':_0x3ac23e[_0x2a73('0xa2')],'lastName':_0x3ac23e[_0x2a73('0xa3')],'mapKey':_0x2a73('0xe0'),'message':{'from':_0x3ac23e[_0x2a73('0xe0')],'to':_0x32d471[_0x2a73('0xc7')][_0x2a73('0xe0')],'cc':'','subject':_[_0x2a73('0x72')](_0x1776a8)?_0x32d471[_0x2a73('0xe1')]:_0x1776a8,'messageId':'','sentAt':new Date(),'attach':_0x33ebfa['length'],'attachments':_0x33ebfa,'originChannel':_0x2a73('0xe7'),'ChatWebsiteId':_0x32d471['id'],'ChatOfflineMessageId':_0x35e879['id'],'originTo':_0x32d471[_0x2a73('0xc7')][_0x2a73('0xe0')]},'body':_0x35e879[_0x2a73('0x4f')]};var _0x10f97d={'account':{'id':_0x32d471['MailAccountId']},'body':_0x36b775,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x2a73('0xe8'),_0x10f97d,client9001)[_0x2a73('0x27')](function(){return _0x35e879;})['catch'](function(_0x1bf01c){console[_0x2a73('0x19')](_0x1bf01c);});}return;})[_0x2a73('0x27')](function(){if(_0x35e879){return _0x35e879;}})[_0x2a73('0x27')](respondWithResult(_0x25a97e,null))[_0x2a73('0x1c')](function(_0x564cf2){console[_0x2a73('0x19')]('catch',_0x564cf2);for(var _0x9b8778 of _0x3c150a){var _0x46425f=path['join'](config[_0x2a73('0x6e')],_0x2a73('0xcf'),'files','attachments','offline-chat',_0x9b8778[_0x2a73('0x69')]);fs_extra['remove'](_0x46425f)[_0x2a73('0x1c')](function(_0x48234e){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x46425f,_0x48234e);});}});};exports[_0x2a73('0xe9')]=function(_0x1f0970,_0x2894e5){return db[_0x2a73('0xae')][_0x2a73('0x4d')]({'where':{'id':_0x1f0970[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x2894e5,null))[_0x2a73('0x27')](function(_0x38124d){if(_0x38124d){return _0x38124d[_0x2a73('0xe9')](_0x1f0970[_0x2a73('0x4f')][_0x2a73('0x60')],_[_0x2a73('0xea')](_0x1f0970[_0x2a73('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x2894e5,null))[_0x2a73('0x1c')](handleError(_0x2894e5,null));};exports['getInteractions']=function(_0x1445b0,_0x333db6){var _0x2b9e49={'raw':![],'where':{}};var _0x5cf8ea={};var _0x1f984d={'count':0x0,'rows':[]};return db[_0x2a73('0x32')]['findOne']({'where':{'id':_0x1445b0['params']['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x333db6,null))[_0x2a73('0x27')](function(_0x23ed95){if(_0x23ed95){_0x5cf8ea[_0x2a73('0x38')]=_[_0x2a73('0x4b')](db['ChatInteraction'][_0x2a73('0x4c')]);_0x5cf8ea[_0x2a73('0x35')]=_[_0x2a73('0x4b')](_0x1445b0[_0x2a73('0x35')]);_0x5cf8ea[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x5cf8ea[_0x2a73('0x38')],_0x5cf8ea[_0x2a73('0x35')]);_0x2b9e49[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x5cf8ea[_0x2a73('0x38')],qs[_0x2a73('0x3a')](_0x1445b0[_0x2a73('0x35')][_0x2a73('0x3a')]));_0x2b9e49[_0x2a73('0x39')]=_0x2b9e49[_0x2a73('0x39')][_0x2a73('0x3b')]?_0x2b9e49[_0x2a73('0x39')]:_0x5cf8ea[_0x2a73('0x38')];if(!_0x1445b0['query'][_0x2a73('0x3c')](_0x2a73('0x3d'))){_0x2b9e49['limit']=qs['limit'](_0x1445b0[_0x2a73('0x35')]['limit']);_0x2b9e49[_0x2a73('0x20')]=qs[_0x2a73('0x20')](_0x1445b0[_0x2a73('0x35')][_0x2a73('0x20')]);}_0x2b9e49[_0x2a73('0x3e')]=qs[_0x2a73('0x3f')](_0x1445b0[_0x2a73('0x35')][_0x2a73('0x3f')]);_0x2b9e49[_0x2a73('0x40')]=qs[_0x2a73('0x36')](_[_0x2a73('0x5d')](_0x1445b0[_0x2a73('0x35')],_0x5cf8ea[_0x2a73('0x36')]));_0x2b9e49[_0x2a73('0x40')][_0x2a73('0x59')]=_0x23ed95['id'];if(_0x1445b0[_0x2a73('0x35')]['filter']){_0x2b9e49['where']=_[_0x2a73('0x43')](_0x2b9e49[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0x2b9e49[_0x2a73('0x39')],function(_0x5cc9bb){var _0x14165a={};_0x14165a[_0x5cc9bb]={'$like':'%'+_0x1445b0[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x14165a;})});}_0x2b9e49=_['merge']({},_0x2b9e49,_0x1445b0['options']);return db['ChatInteraction'][_0x2a73('0x23')]({'where':_0x2b9e49[_0x2a73('0x40')]})[_0x2a73('0x27')](function(_0x4fb60e){_0x1f984d[_0x2a73('0x23')]=_0x4fb60e;if(_0x1445b0[_0x2a73('0x35')][_0x2a73('0x45')]){_0x2b9e49[_0x2a73('0x46')]=[{'model':db[_0x2a73('0x84')],'as':_0x2a73('0xeb'),'required':![]},{'model':db[_0x2a73('0xbb')],'as':'Owner','attributes':[_0x2a73('0x2e'),_0x2a73('0xec'),_0x2a73('0xed')],'required':![]},{'model':db['Tag'],'as':_0x2a73('0xee'),'attributes':['id',_0x2a73('0x2e'),_0x2a73('0xef')],'where':_0x1445b0['query'][_0x2a73('0xf0')]?{'id':_0x1445b0[_0x2a73('0x35')][_0x2a73('0xf0')]}:undefined,'required':_0x1445b0[_0x2a73('0x35')][_0x2a73('0xf0')]?!![]:![]}];}return db[_0x2a73('0xae')][_0x2a73('0x47')](_0x2b9e49);})[_0x2a73('0x27')](function(_0x1e60d0){_0x1f984d[_0x2a73('0x5e')]=_0x1e60d0;return _0x1f984d;});}})[_0x2a73('0x27')](respondWithFilteredResult(_0x333db6,_0x2b9e49))[_0x2a73('0x1c')](handleError(_0x333db6,null));};function iftimePromise(_0x366293,_0x227127){return respondWithRpcPromise('Command',_0x2a73('0xf1'),{'command':_0x227127[_0x2a73('0xf2')]?util[_0x2a73('0xa8')](_0x2a73('0xf3'),_0x366293['interval'],_0x227127[_0x2a73('0xf2')]):util[_0x2a73('0xa8')]('iftime\x20%s',_0x366293[_0x2a73('0xf4')])},client9002)['then'](function(_0x471641){var _0x48cc72=_0x471641&&_0x471641[_0x2a73('0xf5')](_0x2a73('0xf6'))>=0x0?!![]:![];logger[_0x2a73('0x14')](_0x2a73('0xf7'),_0x227127['id'],_0x366293['id'],_0x366293['interval'],_0x48cc72?_0x2a73('0xf8'):_0x2a73('0xf9'),_0x227127['timezone']?_0x227127['timezone']:_0x2a73('0xfa'));return _0x48cc72;})[_0x2a73('0x1c')](function(_0x2b4bbc){logger[_0x2a73('0x19')](_0x2a73('0xf7'),_0x227127['id'],_0x366293['id'],_0x366293[_0x2a73('0xf4')],util['inspect'](_0x2b4bbc,{'showHidden':![],'depth':null}),_0x227127['timezone']?_0x227127['timezone']:_0x2a73('0xfa'));return![];});}exports['getSnippet']=function(_0x2199c2,_0x41cd33){var _0x8a4a6=0x0;var _0x4cbaf3=0x0;var _0x32bada=![];var _0x4fc1c0;var _0x352871;return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x2199c2['params']['id']},'include':[{'model':db[_0x2a73('0xfb')],'as':'Interval','include':[{'model':db[_0x2a73('0xfb')],'as':'Intervals','attributes':['id',_0x2a73('0xf4')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x41cd33,null))[_0x2a73('0x27')](function(_0x3057ac){if(_0x3057ac){_0x4fc1c0=_0x3057ac;return _0x3057ac[_0x2a73('0xfc')]({'raw':!![]});}})[_0x2a73('0x27')](function(_0x5b2146){if(_0x4fc1c0){if(_0x5b2146){_0x352871=_0x5b2146;}}return require(_0x2a73('0x6f'))[_0x2a73('0x70')]();})[_0x2a73('0x27')](function(_0x45f72c){if(_0x45f72c){_0x4cbaf3=_0x45f72c['virtual'];_0x32bada=_0x45f72c[_0x2a73('0x71')];}})[_0x2a73('0x27')](function(){return db[_0x2a73('0xae')][_0x2a73('0x23')]({'where':{'closed':![]}});})['then'](function(_0x537753){_0x8a4a6=_0x537753;if(_0x4cbaf3&&_0x537753>_0x4cbaf3){return db['License'][_0x2a73('0x5c')]({'where':{'id':0x1}})[_0x2a73('0x27')](function(_0x1ae88b){if(_0x1ae88b){_0x1ae88b['increment'](_0x2a73('0xfd'));}});}})[_0x2a73('0x27')](function(){if(_0x4fc1c0[_0x2a73('0xfb')]&&_0x4fc1c0['Interval'][_0x2a73('0xfe')]){var _0x523a3d=[];for(var _0x10e0da=0x0;_0x10e0da<_0x4fc1c0[_0x2a73('0xfb')][_0x2a73('0xfe')][_0x2a73('0x3b')];_0x10e0da++){var _0x2e7a6f=_0x4fc1c0['Interval'][_0x2a73('0xfe')][_0x10e0da]['get']({'plain':!![]});_0x523a3d[_0x2a73('0xff')](iftimePromise(_0x2e7a6f,_0x4fc1c0));}return BPromise[_0x2a73('0x100')](_0x523a3d)[_0x2a73('0x27')](function(_0x304f71){return _[_0x2a73('0x101')](_0x304f71);});}else{return!![];}})[_0x2a73('0x27')](function(_0x383a82){var _0x30942d=fs[_0x2a73('0xc9')](path[_0x2a73('0x6d')](config[_0x2a73('0x6e')],_0x2a73('0x102')),'utf8');var _0x5de5cc={'remote':_0x4fc1c0[_0x2a73('0x103')],'query':querystring['stringify'](_[_0x2a73('0x43')](_0x4fc1c0[_0x2a73('0x29')]({'plain':!![]}),{'customerIp':_0x2199c2[_0x2a73('0x80')][_0x2a73('0x9f')]||_0x2199c2[_0x2a73('0x80')][_0x2a73('0x104')]||_0x2199c2[_0x2a73('0x105')]['remoteAddress']||_0x2199c2['ip'],'referer':_0x2199c2[_0x2a73('0x80')][_0x2a73('0xa5')],'openedInteractions':_0x8a4a6,'maxInteractions':_0x4cbaf3,'virtual':_0x32bada['virtual'],'online':_0x383a82,'custom':_0x32bada}))[_0x2a73('0x106')](/'/g,'\x5c\x27')};_0x41cd33[_0x2a73('0xc3')](ejs[_0x2a73('0xcb')](Mustache[_0x2a73('0xcb')](_0x30942d,_0x5de5cc),{'proactiveActions':_0x352871,'alignment':_0x4fc1c0[_0x2a73('0x107')],'verticalAlignment':_0x4fc1c0[_0x2a73('0x108')],'div_color':_0x4fc1c0['color'],'text_color':_0x4fc1c0[_0x2a73('0x109')],'button_color':_0x4fc1c0['color_button'],'background_color':_0x4fc1c0[_0x2a73('0x10a')]}));})[_0x2a73('0x1c')](handleError(_0x41cd33,null));};exports['addApplications']=function(_0x18fb3b,_0x1f47fc){var _0x5e32df=_0x18fb3b['params']['id'];var _0x8db3d2=_0x18fb3b[_0x2a73('0x4f')];var _0x99415c=0xc8;var _0x3e57db=null;return db[_0x2a73('0x10b')][_0x2a73('0xd4')]({'isolationLevel':db[_0x2a73('0x10b')][_0x2a73('0x10c')][_0x2a73('0x10d')][_0x2a73('0x10e')]},function(_0x440e3d){return db[_0x2a73('0x32')][_0x2a73('0x5c')]({'where':{'id':_0x5e32df},'transaction':_0x440e3d})[_0x2a73('0x27')](function(_0x6c03b3){if(_0x6c03b3){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x5e32df},'transaction':_0x440e3d})['then'](function(){var _0x4a25ec=_[_0x2a73('0x31')](_0x8db3d2,function(_0x4f68e1){_0x4f68e1[_0x2a73('0x59')]=_0x5e32df;return _0x4f68e1;});return db[_0x2a73('0x92')]['bulkCreate'](_0x4a25ec,{'transaction':_0x440e3d});});}else{_0x99415c=0x194;_0x3e57db=[];}});})['then'](function(){if(_0x99415c!==0x194){return db[_0x2a73('0x92')][_0x2a73('0x10f')]({'where':{'ChatWebsiteId':_0x5e32df},'order':_0x2a73('0x99')})[_0x2a73('0x27')](function(_0x1e29f2){_0x3e57db=_0x1e29f2;});}})[_0x2a73('0x1c')](function(_0x411b25){_0x99415c=0x1f4;logger['error'](_0x411b25[_0x2a73('0x2d')]);if(_0x411b25[_0x2a73('0x2e')]){delete _0x411b25[_0x2a73('0x2e')];}_0x3e57db=_0x411b25;})[_0x2a73('0x110')](function(){if(_0x3e57db===null){_0x1f47fc[_0x2a73('0x1e')](_0x99415c);}else{if(_0x99415c===0x1f4){_0x1f47fc[_0x2a73('0x24')](_0x99415c)[_0x2a73('0xc3')](_0x3e57db);}else{_0x1f47fc[_0x2a73('0x24')](_0x99415c)[_0x2a73('0x1f')](_0x3e57db);}}});};exports[_0x2a73('0x111')]=function(_0x5412a9,_0xc91aee){var _0x191419={};var _0x5d8258={};var _0x1ccf02;var _0x19d4ec;return db[_0x2a73('0x32')][_0x2a73('0x5c')]({'where':{'id':_0x5412a9[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0xc91aee,null))['then'](function(_0x3c2a14){if(_0x3c2a14){_0x1ccf02=_0x3c2a14;_0x5d8258['model']=_[_0x2a73('0x4b')](db['ChatApplication'][_0x2a73('0x4c')]);_0x5d8258[_0x2a73('0x35')]=_[_0x2a73('0x4b')](_0x5412a9['query']);_0x5d8258[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x5d8258[_0x2a73('0x38')],_0x5d8258[_0x2a73('0x35')]);_0x191419[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x5d8258['model'],qs[_0x2a73('0x3a')](_0x5412a9[_0x2a73('0x35')]['fields']));_0x191419[_0x2a73('0x39')]=_0x191419[_0x2a73('0x39')][_0x2a73('0x3b')]?_0x191419[_0x2a73('0x39')]:_0x5d8258[_0x2a73('0x38')];_0x191419[_0x2a73('0x3e')]=qs[_0x2a73('0x3f')](_0x5412a9['query'][_0x2a73('0x3f')]);_0x191419[_0x2a73('0x40')]=qs['filters'](_[_0x2a73('0x5d')](_0x5412a9[_0x2a73('0x35')],_0x5d8258[_0x2a73('0x36')]));if(_0x5412a9[_0x2a73('0x35')]['filter']){_0x191419[_0x2a73('0x40')]=_[_0x2a73('0x43')](_0x191419[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0x191419[_0x2a73('0x39')],function(_0x396b6e){var _0x4783a6={};_0x4783a6[_0x396b6e]={'$like':'%'+_0x5412a9[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x4783a6;})});}_0x191419=_[_0x2a73('0x43')]({},_0x191419,_0x5412a9['options']);return _0x1ccf02[_0x2a73('0x111')](_0x191419);}})[_0x2a73('0x27')](function(_0x64f661){if(_0x64f661){_0x19d4ec=_0x64f661[_0x2a73('0x3b')];if(!_0x5412a9[_0x2a73('0x35')][_0x2a73('0x3c')](_0x2a73('0x3d'))){_0x191419['limit']=qs[_0x2a73('0x22')](_0x5412a9[_0x2a73('0x35')][_0x2a73('0x22')]);_0x191419[_0x2a73('0x20')]=qs[_0x2a73('0x20')](_0x5412a9[_0x2a73('0x35')][_0x2a73('0x20')]);}return _0x1ccf02['getApplications'](_0x191419);}})[_0x2a73('0x27')](function(_0x18500d){if(_0x18500d){return _0x18500d?{'count':_0x19d4ec,'rows':_0x18500d}:null;}})[_0x2a73('0x27')](respondWithResult(_0xc91aee,null))['catch'](handleError(_0xc91aee,null));};exports[_0x2a73('0x112')]=function(_0x106224,_0x3d1106){return db[_0x2a73('0x113')][_0x2a73('0x4d')]({'where':{'id':_0x106224[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x3d1106,null))[_0x2a73('0x27')](function(_0x5147c2){if(_0x5147c2){return _0x5147c2[_0x2a73('0x112')](_0x106224['body'][_0x2a73('0x60')],_[_0x2a73('0xea')](_0x106224['body'],['ids','id'])||{});}})[_0x2a73('0x27')](respondWithResult(_0x3d1106,null))[_0x2a73('0x1c')](handleError(_0x3d1106,null));};exports[_0x2a73('0xfc')]=function(_0x2d0bad,_0x66afa){var _0x18cc91={};var _0x545038={};var _0x48904a;var _0xa3261f;return db[_0x2a73('0x32')][_0x2a73('0x5c')]({'where':{'id':_0x2d0bad[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x66afa,null))[_0x2a73('0x27')](function(_0x457d2b){if(_0x457d2b){_0x48904a=_0x457d2b;_0x545038['model']=_[_0x2a73('0x4b')](db[_0x2a73('0x114')][_0x2a73('0x4c')]);_0x545038[_0x2a73('0x35')]=_[_0x2a73('0x4b')](_0x2d0bad[_0x2a73('0x35')]);_0x545038[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x545038[_0x2a73('0x38')],_0x545038['query']);_0x18cc91[_0x2a73('0x39')]=_['intersection'](_0x545038[_0x2a73('0x38')],qs['fields'](_0x2d0bad[_0x2a73('0x35')][_0x2a73('0x3a')]));_0x18cc91[_0x2a73('0x39')]=_0x18cc91[_0x2a73('0x39')][_0x2a73('0x3b')]?_0x18cc91[_0x2a73('0x39')]:_0x545038['model'];_0x18cc91['order']=qs[_0x2a73('0x3f')](_0x2d0bad[_0x2a73('0x35')][_0x2a73('0x3f')]);_0x18cc91[_0x2a73('0x40')]=qs[_0x2a73('0x36')](_['pick'](_0x2d0bad[_0x2a73('0x35')],_0x545038[_0x2a73('0x36')]));if(_0x2d0bad[_0x2a73('0x35')][_0x2a73('0x42')]){_0x18cc91[_0x2a73('0x40')]=_[_0x2a73('0x43')](_0x18cc91[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0x18cc91[_0x2a73('0x39')],function(_0x187ec0){var _0x4dbea6={};_0x4dbea6[_0x187ec0]={'$like':'%'+_0x2d0bad[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x4dbea6;})});}_0x18cc91=_[_0x2a73('0x43')]({},_0x18cc91,_0x2d0bad[_0x2a73('0x44')]);return _0x48904a[_0x2a73('0xfc')](_0x18cc91);}})['then'](function(_0x2b5a96){if(_0x2b5a96){_0xa3261f=_0x2b5a96[_0x2a73('0x3b')];if(!_0x2d0bad[_0x2a73('0x35')][_0x2a73('0x3c')](_0x2a73('0x3d'))){_0x18cc91[_0x2a73('0x22')]=qs[_0x2a73('0x22')](_0x2d0bad['query'][_0x2a73('0x22')]);_0x18cc91['offset']=qs[_0x2a73('0x20')](_0x2d0bad['query']['offset']);}return _0x48904a[_0x2a73('0xfc')](_0x18cc91);}})[_0x2a73('0x27')](function(_0x3b3fe4){if(_0x3b3fe4){return _0x3b3fe4?{'count':_0xa3261f,'rows':_0x3b3fe4}:null;}})['then'](respondWithResult(_0x66afa,null))[_0x2a73('0x1c')](handleError(_0x66afa,null));};exports[_0x2a73('0x115')]=function(_0x5de859,_0x4c8191){var _0x4d2cf2=_0x5de859[_0x2a73('0x35')][_0x2a73('0x116')]===_0x2a73('0x117')?_0x2a73('0x118'):_0x2a73('0x119');return db['ChatWebsite'][_0x2a73('0x4d')]({'attributes':['id',_0x4d2cf2],'where':{'id':_0x5de859[_0x2a73('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c8191,null))[_0x2a73('0x27')](function(_0x1283f0){if(_0x1283f0){var _0x1262e4=_0x1283f0[_0x4d2cf2];var _0x1dbca8=_0x1262e4&&_0x1262e4[_0x2a73('0x11a')]?_0x1262e4[_0x2a73('0x11a')]:[];_0x4c8191['send']({'fromKey':_['isNil'](_0x1262e4[_0x2a73('0x11b')])?undefined:_0x1262e4['fromKey'],'count':_0x1dbca8[_0x2a73('0x3b')],'rows':_0x1dbca8});}})[_0x2a73('0x1c')](handleError(_0x4c8191,null));};exports[_0x2a73('0x11c')]=function(_0x1b6f94,_0x2c5cf4){var _0x18d6cf={'raw':![],'where':{}};var _0x30aa4c={};var _0x381502={'count':0x0,'rows':[]};return db[_0x2a73('0x32')][_0x2a73('0x5c')]({'where':{'id':_0x1b6f94[_0x2a73('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c5cf4,null))[_0x2a73('0x27')](function(_0x3bf155){if(_0x3bf155){_0x30aa4c['model']=_[_0x2a73('0x4b')](db['ChatOfflineMessage'][_0x2a73('0x4c')]);_0x30aa4c[_0x2a73('0x35')]=_[_0x2a73('0x4b')](_0x1b6f94[_0x2a73('0x35')]);_0x30aa4c[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x30aa4c[_0x2a73('0x38')],_0x30aa4c[_0x2a73('0x35')]);_0x18d6cf[_0x2a73('0x39')]=_[_0x2a73('0x37')](_0x30aa4c['model'],qs[_0x2a73('0x3a')](_0x1b6f94[_0x2a73('0x35')][_0x2a73('0x3a')]));_0x18d6cf[_0x2a73('0x39')]=_0x18d6cf['attributes']['length']?_0x18d6cf[_0x2a73('0x39')]:_0x30aa4c[_0x2a73('0x38')];if(!_0x1b6f94[_0x2a73('0x35')][_0x2a73('0x3c')]('nolimit')){_0x18d6cf['limit']=qs[_0x2a73('0x22')](_0x1b6f94['query'][_0x2a73('0x22')]);_0x18d6cf[_0x2a73('0x20')]=qs['offset'](_0x1b6f94['query'][_0x2a73('0x20')]);}_0x18d6cf['order']=qs[_0x2a73('0x3f')](_0x1b6f94[_0x2a73('0x35')][_0x2a73('0x3f')]);_0x18d6cf[_0x2a73('0x40')]=qs[_0x2a73('0x36')](_[_0x2a73('0x5d')](_0x1b6f94[_0x2a73('0x35')],_0x30aa4c[_0x2a73('0x36')]));_0x18d6cf[_0x2a73('0x40')][_0x2a73('0x59')]=_0x3bf155['id'];if(_0x1b6f94[_0x2a73('0x35')][_0x2a73('0x42')]){_0x18d6cf[_0x2a73('0x40')]=_['merge'](_0x18d6cf[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0x18d6cf[_0x2a73('0x39')],function(_0x410c1f){var _0xb6955c={};_0xb6955c[_0x410c1f]={'$like':'%'+_0x1b6f94[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0xb6955c;})});}_0x18d6cf=_['merge']({},_0x18d6cf,_0x1b6f94[_0x2a73('0x44')]);return db[_0x2a73('0xcd')][_0x2a73('0x23')]({'where':_0x18d6cf[_0x2a73('0x40')]})[_0x2a73('0x27')](function(_0x2fda1b){_0x381502['count']=_0x2fda1b;if(_0x1b6f94[_0x2a73('0x35')][_0x2a73('0x45')]){_0x18d6cf[_0x2a73('0x46')]=[{'all':!![]}];}else{_0x18d6cf[_0x2a73('0x46')]=[{'model':db['CmContact'],'as':_0x2a73('0xeb'),'required':![]},{'model':db['Attachment'],'as':_0x2a73('0x11d'),'required':![]}];}return db[_0x2a73('0xcd')][_0x2a73('0x47')](_0x18d6cf);})[_0x2a73('0x27')](function(_0x521e4a){_0x381502['rows']=_0x521e4a;return _0x381502;});}})[_0x2a73('0x27')](respondWithFilteredResult(_0x2c5cf4,_0x18d6cf))[_0x2a73('0x1c')](handleError(_0x2c5cf4,null));};exports[_0x2a73('0x11e')]=function(_0x1d943c,_0x47f792){return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x1d943c['params']['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x47f792,null))[_0x2a73('0x27')](function(_0x5c3d1a){if(_0x5c3d1a){return _0x5c3d1a[_0x2a73('0x11e')](_0x1d943c[_0x2a73('0x4f')]['ids'],_['omit'](_0x1d943c['body'],[_0x2a73('0x60'),'id'])||{})['spread'](function(_0x91aa41){for(var _0x43e271=0x0;_0x43e271<_0x1d943c['body'][_0x2a73('0x60')]['length'];_0x43e271+=0x1){socket[_0x2a73('0x11f')](_0x2a73('0x120'),{'UserId':Number(_0x1d943c['body'][_0x2a73('0x60')][_0x43e271]),'ChatWebsiteId':Number(_0x1d943c[_0x2a73('0x49')]['id'])});}return _0x91aa41;});}})['then'](respondWithResult(_0x47f792,null))[_0x2a73('0x1c')](handleError(_0x47f792,null));};exports[_0x2a73('0x121')]=function(_0x21fb6f,_0x87a9b2){return db[_0x2a73('0x32')][_0x2a73('0x4d')]({'where':{'id':_0x21fb6f[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x87a9b2,null))['then'](function(_0x374674){if(_0x374674){return _0x374674[_0x2a73('0x121')](_0x21fb6f[_0x2a73('0x35')][_0x2a73('0x60')])[_0x2a73('0x27')](function(){if(_[_0x2a73('0x122')](_0x21fb6f[_0x2a73('0x35')][_0x2a73('0x60')])){for(var _0x3ebd0c=0x0;_0x3ebd0c<_0x21fb6f[_0x2a73('0x35')]['ids'][_0x2a73('0x3b')];_0x3ebd0c+=0x1){socket[_0x2a73('0x11f')](_0x2a73('0x123'),{'UserId':Number(_0x21fb6f['query'][_0x2a73('0x60')][_0x3ebd0c]),'ChatWebsiteId':Number(_0x21fb6f[_0x2a73('0x49')]['id'])});}}else{socket[_0x2a73('0x11f')](_0x2a73('0x123'),{'UserId':Number(_0x21fb6f['query'][_0x2a73('0x60')]),'ChatWebsiteId':Number(_0x21fb6f[_0x2a73('0x49')]['id'])});}});}})[_0x2a73('0x27')](respondWithStatusCode(_0x87a9b2,null))[_0x2a73('0x1c')](handleError(_0x87a9b2,null));};exports[_0x2a73('0x124')]=function(_0x42ccce,_0x1e2846){var _0xfaee07={};var _0x227a84={};var _0x434694;var _0x301a3c;return db['ChatWebsite'][_0x2a73('0x5c')]({'where':{'id':_0x42ccce[_0x2a73('0x49')]['id']}})[_0x2a73('0x27')](handleEntityNotFound(_0x1e2846,null))[_0x2a73('0x27')](function(_0x40b0d9){if(_0x40b0d9){_0x434694=_0x40b0d9;_0x227a84[_0x2a73('0x38')]=_[_0x2a73('0x4b')](db['User'][_0x2a73('0x4c')]);_0x227a84['query']=_['keys'](_0x42ccce[_0x2a73('0x35')]);_0x227a84[_0x2a73('0x36')]=_[_0x2a73('0x37')](_0x227a84[_0x2a73('0x38')],_0x227a84['query']);_0xfaee07[_0x2a73('0x39')]=_['intersection'](_0x227a84[_0x2a73('0x38')],qs['fields'](_0x42ccce['query'][_0x2a73('0x3a')]));_0xfaee07[_0x2a73('0x39')]=_0xfaee07['attributes'][_0x2a73('0x3b')]?_0xfaee07['attributes']:_0x227a84['model'];_0xfaee07[_0x2a73('0x3e')]=qs['sort'](_0x42ccce[_0x2a73('0x35')][_0x2a73('0x3f')]);_0xfaee07['where']=qs['filters'](_[_0x2a73('0x5d')](_0x42ccce[_0x2a73('0x35')],_0x227a84['filters']));if(_0x42ccce[_0x2a73('0x35')]['filter']){_0xfaee07[_0x2a73('0x40')]=_[_0x2a73('0x43')](_0xfaee07[_0x2a73('0x40')],{'$or':_[_0x2a73('0x31')](_0xfaee07[_0x2a73('0x39')],function(_0x350064){var _0x4c0ed1={};_0x4c0ed1[_0x350064]={'$like':'%'+_0x42ccce[_0x2a73('0x35')][_0x2a73('0x42')]+'%'};return _0x4c0ed1;})});}_0xfaee07=_[_0x2a73('0x43')]({},_0xfaee07,_0x42ccce[_0x2a73('0x44')]);return _0x434694[_0x2a73('0x124')](_0xfaee07);}})[_0x2a73('0x27')](function(_0x429732){if(_0x429732){_0x301a3c=_0x429732['length'];if(!_0x42ccce[_0x2a73('0x35')]['hasOwnProperty'](_0x2a73('0x3d'))){_0xfaee07[_0x2a73('0x22')]=qs[_0x2a73('0x22')](_0x42ccce['query']['limit']);_0xfaee07['offset']=qs[_0x2a73('0x20')](_0x42ccce['query'][_0x2a73('0x20')]);}return _0x434694[_0x2a73('0x124')](_0xfaee07);}})[_0x2a73('0x27')](function(_0x32165e){if(_0x32165e){return _0x32165e?{'count':_0x301a3c,'rows':_0x32165e}:null;}})[_0x2a73('0x27')](respondWithResult(_0x1e2846,null))['catch'](handleError(_0x1e2846,null));}; \ No newline at end of file +var _0xa727=['true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','timezone','No\x20timezone','inspect','Interval','Intervals','getLicense','custom','increment','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','virtual','alignment','verticalAlignment','textColor','color_button','addApplications','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','isNil','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','messageId','created','push','close','unmanaged','ChatMessage','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','files','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s','interval','indexOf'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0xa727,0x14e));var _0x7a72=function(_0x57dd31,_0x49f160){_0x57dd31=_0x57dd31-0x0;var _0x4f7e6d=_0xa727[_0x57dd31];return _0x4f7e6d;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x7a72('0x0'));var util=require(_0x7a72('0x1'));var path=require(_0x7a72('0x2'));var ejs=require(_0x7a72('0x3'));var fs=require('fs');var fs_extra=require(_0x7a72('0x4'));var _=require('lodash');var querystring=require(_0x7a72('0x5'));var Redis=require(_0x7a72('0x6'));var qs=require(_0x7a72('0x7'));var logger=require(_0x7a72('0x8'))(_0x7a72('0x9'));var config=require(_0x7a72('0xa'));var db=require(_0x7a72('0xb'))['db'];config[_0x7a72('0xc')]=_[_0x7a72('0xd')](config[_0x7a72('0xc')],{'host':_0x7a72('0xe'),'port':0x18eb});var socket=require(_0x7a72('0xf'))(new Redis(config[_0x7a72('0xc')]));require(_0x7a72('0x10'))[_0x7a72('0x11')](socket);var jayson=require(_0x7a72('0x12'));var client=jayson[_0x7a72('0x13')][_0x7a72('0x14')]({'port':0x232c});var client9002=jayson[_0x7a72('0x13')]['http']({'port':0x232a});var client9003=jayson[_0x7a72('0x13')][_0x7a72('0x14')]({'port':0x232b});var client9001=jayson[_0x7a72('0x13')][_0x7a72('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x4f1e18,_0xb682df,_0x2d68f4,_0x952ce0){return new BPromise(function(_0x858d23,_0x42278e){var _0x1a4eda=_0x952ce0||client;return _0x1a4eda['request'](_0x4f1e18,_0x2d68f4)[_0x7a72('0x15')](function(_0x18eb9c){logger[_0x7a72('0x16')](_0x7a72('0x17'),_0xb682df,_0x7a72('0x18'));logger['debug'](_0x7a72('0x19'),_0xb682df,_0x7a72('0x18'),JSON[_0x7a72('0x1a')](_0x18eb9c));if(_0x18eb9c[_0x7a72('0x1b')]){if(_0x18eb9c[_0x7a72('0x1b')][_0x7a72('0x1c')]===0x1f4){logger[_0x7a72('0x1b')](_0x7a72('0x17'),_0xb682df,_0x18eb9c['error'][_0x7a72('0x1d')]);return _0x42278e(_0x18eb9c[_0x7a72('0x1b')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0xb682df,_0x18eb9c[_0x7a72('0x1b')][_0x7a72('0x1d')]);return _0x858d23(_0x18eb9c[_0x7a72('0x1b')]['message']);}else{logger[_0x7a72('0x16')](_0x7a72('0x17'),_0xb682df,_0x7a72('0x18'));_0x858d23(_0x18eb9c['result'][_0x7a72('0x1d')]);}})['catch'](function(_0x2801d1){logger[_0x7a72('0x1b')](_0x7a72('0x17'),_0xb682df,_0x2801d1);_0x42278e(_0x2801d1);});});}function respondWithStatusCode(_0x45e5ef,_0x97a16c){_0x97a16c=_0x97a16c||0xcc;return function(_0x1c0758){if(_0x1c0758){return _0x45e5ef[_0x7a72('0x1e')](_0x97a16c);}return _0x45e5ef[_0x7a72('0x1f')](_0x97a16c)[_0x7a72('0x20')]();};}function respondWithResult(_0x4f06dc,_0x283cc2){_0x283cc2=_0x283cc2||0xc8;return function(_0x5ebeaa){if(_0x5ebeaa){return _0x4f06dc[_0x7a72('0x1f')](_0x283cc2)[_0x7a72('0x21')](_0x5ebeaa);}};}function respondWithFilteredResult(_0x3fbe18,_0x27883b){return function(_0x59042a){if(_0x59042a){var _0x2b880b=typeof _0x27883b['offset']===_0x7a72('0x22')&&typeof _0x27883b[_0x7a72('0x23')]===_0x7a72('0x22');var _0xdd4b53=_0x59042a[_0x7a72('0x24')];var _0x210d24=_0x2b880b?0x0:_0x27883b[_0x7a72('0x25')];var _0x413d11=_0x2b880b?_0x59042a[_0x7a72('0x24')]:_0x27883b['offset']+_0x27883b[_0x7a72('0x23')];var _0x196fe7;if(_0x413d11>=_0xdd4b53){_0x413d11=_0xdd4b53;_0x196fe7=0xc8;}else{_0x196fe7=0xce;}_0x3fbe18[_0x7a72('0x1f')](_0x196fe7);return _0x3fbe18['set'](_0x7a72('0x26'),_0x210d24+'-'+_0x413d11+'/'+_0xdd4b53)['json'](_0x59042a);}return null;};}function saveUpdates(_0x9aa7f7){return function(_0x19409d){if(_0x19409d){return _0x19409d['update'](_0x9aa7f7)[_0x7a72('0x15')](function(_0x1ec57f){return _0x1ec57f;});}return null;};}function removeEntity(_0x52b9e3){return function(_0x13e427){if(_0x13e427){return _0x13e427[_0x7a72('0x27')]()[_0x7a72('0x15')](function(){var _0x558384=_0x13e427[_0x7a72('0x28')]({'plain':!![]});var _0x1d05d9=_0x7a72('0x29');return db[_0x7a72('0x2a')][_0x7a72('0x27')]({'where':{'type':_0x1d05d9,'resourceId':_0x558384['id']}})[_0x7a72('0x15')](function(){return _0x13e427;});})[_0x7a72('0x15')](function(){_0x52b9e3['status'](0xcc)[_0x7a72('0x20')]();});}};}function handleEntityNotFound(_0x7c8bd5){return function(_0xa5b7f5){if(!_0xa5b7f5){_0x7c8bd5[_0x7a72('0x1e')](0x194);}return _0xa5b7f5;};}function handleError(_0x11fc1e,_0x38f130){_0x38f130=_0x38f130||0x1f4;return function(_0x40196c){logger['error'](_0x40196c[_0x7a72('0x2b')]);if(_0x40196c[_0x7a72('0x2c')]){delete _0x40196c[_0x7a72('0x2c')];}_0x11fc1e[_0x7a72('0x1f')](_0x38f130)[_0x7a72('0x2d')](_0x40196c);};}exports[_0x7a72('0x2e')]=function(_0x5950d2,_0x360945){var _0x377c63={'include':[{'model':db[_0x7a72('0x2f')],'as':_0x7a72('0x30')}]},_0x13b744={},_0x14bb32={'count':0x0,'rows':[]};var _0x5a9350=_[_0x7a72('0x31')](db[_0x7a72('0x32')][_0x7a72('0x33')],function(_0x5dbe0a){return{'name':_0x5dbe0a[_0x7a72('0x34')],'type':_0x5dbe0a['type'][_0x7a72('0x35')]};});_0x13b744[_0x7a72('0x36')]=_[_0x7a72('0x31')](_0x5a9350,_0x7a72('0x2c'));_0x13b744[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x5950d2['query']);_0x13b744['filters']=_['intersection'](_0x13b744[_0x7a72('0x36')],_0x13b744[_0x7a72('0x37')]);_0x377c63[_0x7a72('0x39')]=_[_0x7a72('0x3a')](_0x13b744[_0x7a72('0x36')],qs[_0x7a72('0x3b')](_0x5950d2[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x377c63[_0x7a72('0x39')]=_0x377c63[_0x7a72('0x39')][_0x7a72('0x3c')]?_0x377c63[_0x7a72('0x39')]:_0x13b744[_0x7a72('0x36')];if(!_0x5950d2[_0x7a72('0x37')][_0x7a72('0x3d')](_0x7a72('0x3e'))){_0x377c63['limit']=qs['limit'](_0x5950d2['query'][_0x7a72('0x23')]);_0x377c63[_0x7a72('0x25')]=qs['offset'](_0x5950d2[_0x7a72('0x37')][_0x7a72('0x25')]);}_0x377c63[_0x7a72('0x3f')]=qs[_0x7a72('0x40')](_0x5950d2[_0x7a72('0x37')]['sort']);_0x377c63[_0x7a72('0x41')]=qs[_0x7a72('0x42')](_[_0x7a72('0x43')](_0x5950d2[_0x7a72('0x37')],_0x13b744[_0x7a72('0x42')]),_0x5a9350);if(_0x5950d2[_0x7a72('0x37')][_0x7a72('0x44')]){_0x377c63['where']=_[_0x7a72('0x45')](_0x377c63[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x5a9350,function(_0x25009d){if(_0x25009d['type']!==_0x7a72('0x46')){var _0x179522={};_0x179522[_0x25009d[_0x7a72('0x2c')]]={'$like':'%'+_0x5950d2[_0x7a72('0x37')][_0x7a72('0x44')]+'%'};return _0x179522;}})});}_0x377c63=_[_0x7a72('0x45')]({},_0x377c63,_0x5950d2[_0x7a72('0x47')]);var _0x2f09e6={'where':_0x377c63[_0x7a72('0x41')]};return db[_0x7a72('0x32')][_0x7a72('0x24')](_0x2f09e6)[_0x7a72('0x15')](function(_0x428a16){_0x14bb32['count']=_0x428a16;if(_0x5950d2[_0x7a72('0x37')]['includeAll']){_0x377c63[_0x7a72('0x48')]=[{'all':!![]}];}return db[_0x7a72('0x32')][_0x7a72('0x49')](_0x377c63);})[_0x7a72('0x15')](function(_0x2bd5d2){_0x14bb32[_0x7a72('0x4a')]=_0x2bd5d2;return _0x14bb32;})['then'](respondWithFilteredResult(_0x360945,_0x377c63))['catch'](handleError(_0x360945,null));};exports[_0x7a72('0x4b')]=function(_0x328929,_0x50eab3){var _0x1b5a41={'raw':![],'where':{'id':_0x328929['params']['id']},'include':[{'model':db[_0x7a72('0x2f')],'as':'mandatoryDispositionPause'}]},_0x53a86f={};_0x53a86f[_0x7a72('0x36')]=_[_0x7a72('0x38')](db[_0x7a72('0x32')][_0x7a72('0x33')]);_0x53a86f[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x328929[_0x7a72('0x37')]);_0x53a86f[_0x7a72('0x42')]=_[_0x7a72('0x3a')](_0x53a86f['model'],_0x53a86f['query']);_0x1b5a41['attributes']=_[_0x7a72('0x3a')](_0x53a86f['model'],qs['fields'](_0x328929[_0x7a72('0x37')]['fields']));_0x1b5a41[_0x7a72('0x39')]=_0x1b5a41[_0x7a72('0x39')][_0x7a72('0x3c')]?_0x1b5a41[_0x7a72('0x39')]:_0x53a86f['model'];if(_0x328929['query'][_0x7a72('0x4c')]){_0x1b5a41[_0x7a72('0x48')]=[{'all':!![]}];}_0x1b5a41=_[_0x7a72('0x45')]({},_0x1b5a41,_0x328929[_0x7a72('0x47')]);return db[_0x7a72('0x32')][_0x7a72('0x4d')](_0x1b5a41)[_0x7a72('0x15')](handleEntityNotFound(_0x50eab3,null))[_0x7a72('0x15')](respondWithResult(_0x50eab3,null))['catch'](handleError(_0x50eab3,null));};exports['create']=function(_0x3fba5d,_0x2c2659){return db[_0x7a72('0x32')][_0x7a72('0x4e')](_0x3fba5d['body'],{})[_0x7a72('0x15')](function(_0x2c20fc){var _0x5a45ac=_0x3fba5d['user'][_0x7a72('0x28')]({'plain':!![]});if(!_0x5a45ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a45ac[_0x7a72('0x4f')]===_0x7a72('0x50')){var _0x187617=_0x2c20fc[_0x7a72('0x28')]({'plain':!![]});var _0x385698='ChatWebsites';return db[_0x7a72('0x51')][_0x7a72('0x4d')]({'where':{'name':_0x385698,'userProfileId':_0x5a45ac[_0x7a72('0x52')]},'raw':!![]})[_0x7a72('0x15')](function(_0xeb953c){if(_0xeb953c&&_0xeb953c[_0x7a72('0x53')]===0x0){return db[_0x7a72('0x2a')]['create']({'name':_0x187617['name'],'resourceId':_0x187617['id'],'type':_0xeb953c[_0x7a72('0x2c')],'sectionId':_0xeb953c['id']},{})[_0x7a72('0x15')](function(){return _0x2c20fc;});}else{return _0x2c20fc;}})[_0x7a72('0x54')](function(_0x2e6df8){logger[_0x7a72('0x1b')](_0x7a72('0x55'),_0x2e6df8);throw _0x2e6df8;});}return _0x2c20fc;})[_0x7a72('0x15')](respondWithResult(_0x2c2659,0xc9))[_0x7a72('0x54')](handleError(_0x2c2659,null));};exports[_0x7a72('0x56')]=function(_0x31b304,_0x564fee){if(_0x31b304[_0x7a72('0x57')]['id']){delete _0x31b304[_0x7a72('0x57')]['id'];}return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x31b304[_0x7a72('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x7a72('0x30')}]})['then'](handleEntityNotFound(_0x564fee,null))['then'](saveUpdates(_0x31b304[_0x7a72('0x57')],null))[_0x7a72('0x15')](respondWithResult(_0x564fee,null))[_0x7a72('0x54')](handleError(_0x564fee,null));};exports[_0x7a72('0x27')]=function(_0xc3b520,_0x4e0b32){return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0xc3b520['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x4e0b32,null))[_0x7a72('0x15')](removeEntity(_0x4e0b32,null))['catch'](handleError(_0x4e0b32,null));};exports[_0x7a72('0x59')]=function(_0x4ba718,_0x499842){return db['ChatWebsite'][_0x7a72('0x59')]()['then'](respondWithResult(_0x499842,null))[_0x7a72('0x54')](handleError(_0x499842,null));};exports[_0x7a72('0x5a')]=function(_0x2e1434,_0x2ec1dd){if(_0x2e1434[_0x7a72('0x57')]['id']){delete _0x2e1434['body']['id'];}return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x2e1434[_0x7a72('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ec1dd,null))[_0x7a72('0x15')](function(_0x760be9){if(_0x760be9){_0x2e1434[_0x7a72('0x57')][_0x7a72('0x5b')]=_0x760be9['id'];return db['Disposition']['create'](_0x2e1434[_0x7a72('0x57')]);}})[_0x7a72('0x15')](respondWithResult(_0x2ec1dd,null))[_0x7a72('0x54')](handleError(_0x2ec1dd,null));};exports[_0x7a72('0x5c')]=function(_0x50b84c,_0x1f9b81){var _0x5ec444={'raw':![],'where':{}};var _0x33ff5c={};var _0x4eb53e={'count':0x0,'rows':[]};return db[_0x7a72('0x32')]['findOne']({'where':{'id':_0x50b84c[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x1f9b81,null))[_0x7a72('0x15')](function(_0x2ddfef){if(_0x2ddfef){_0x33ff5c[_0x7a72('0x36')]=_[_0x7a72('0x38')](db[_0x7a72('0x5d')][_0x7a72('0x33')]);_0x33ff5c[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x50b84c[_0x7a72('0x37')]);_0x33ff5c[_0x7a72('0x42')]=_['intersection'](_0x33ff5c[_0x7a72('0x36')],_0x33ff5c['query']);_0x5ec444[_0x7a72('0x39')]=_[_0x7a72('0x3a')](_0x33ff5c[_0x7a72('0x36')],qs['fields'](_0x50b84c[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x5ec444[_0x7a72('0x39')]=_0x5ec444[_0x7a72('0x39')][_0x7a72('0x3c')]?_0x5ec444['attributes']:_0x33ff5c['model'];if(!_0x50b84c[_0x7a72('0x37')][_0x7a72('0x3d')](_0x7a72('0x3e'))){_0x5ec444['limit']=qs[_0x7a72('0x23')](_0x50b84c[_0x7a72('0x37')][_0x7a72('0x23')]);_0x5ec444['offset']=qs[_0x7a72('0x25')](_0x50b84c[_0x7a72('0x37')]['offset']);}_0x5ec444[_0x7a72('0x3f')]=qs[_0x7a72('0x40')](_0x50b84c[_0x7a72('0x37')][_0x7a72('0x40')]);_0x5ec444[_0x7a72('0x41')]=qs[_0x7a72('0x42')](_[_0x7a72('0x43')](_0x50b84c[_0x7a72('0x37')],_0x33ff5c[_0x7a72('0x42')]));_0x5ec444[_0x7a72('0x41')][_0x7a72('0x5b')]=_0x2ddfef['id'];if(_0x50b84c['query'][_0x7a72('0x44')]){_0x5ec444[_0x7a72('0x41')]=_['merge'](_0x5ec444[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x5ec444[_0x7a72('0x39')],function(_0x3c153d){var _0x127d9f={};_0x127d9f[_0x3c153d]={'$like':'%'+_0x50b84c[_0x7a72('0x37')][_0x7a72('0x44')]+'%'};return _0x127d9f;})});}_0x5ec444=_['merge']({},_0x5ec444,_0x50b84c[_0x7a72('0x47')]);return db[_0x7a72('0x5d')]['count']({'where':_0x5ec444[_0x7a72('0x41')]})[_0x7a72('0x15')](function(_0x412fe2){_0x4eb53e[_0x7a72('0x24')]=_0x412fe2;if(_0x50b84c[_0x7a72('0x37')][_0x7a72('0x4c')]){_0x5ec444[_0x7a72('0x48')]=[{'all':!![]}];}return db[_0x7a72('0x5d')][_0x7a72('0x49')](_0x5ec444);})[_0x7a72('0x15')](function(_0x25effb){_0x4eb53e[_0x7a72('0x4a')]=_0x25effb;return _0x4eb53e;});}})[_0x7a72('0x15')](respondWithFilteredResult(_0x1f9b81,_0x5ec444))[_0x7a72('0x54')](handleError(_0x1f9b81,null));};exports[_0x7a72('0x5e')]=function(_0x27f194,_0x1e085f){return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x27f194['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x1e085f,null))[_0x7a72('0x15')](function(_0x56324a){if(_0x56324a){return _0x56324a[_0x7a72('0x5e')](_0x27f194[_0x7a72('0x37')][_0x7a72('0x5f')]);}})[_0x7a72('0x15')](respondWithStatusCode(_0x1e085f,null))['catch'](handleError(_0x1e085f,null));};exports[_0x7a72('0x60')]=function(_0x352970,_0x7252df){if(_0x352970[_0x7a72('0x57')]['id']){delete _0x352970[_0x7a72('0x57')]['id'];}return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x352970[_0x7a72('0x58')]['id']}})['then'](handleEntityNotFound(_0x7252df,null))[_0x7a72('0x15')](function(_0x22c7ad){if(_0x22c7ad){_0x352970[_0x7a72('0x57')]['ChatWebsiteId']=_0x22c7ad['id'];return db['CannedAnswer'][_0x7a72('0x4e')](_0x352970[_0x7a72('0x57')]);}})['then'](respondWithResult(_0x7252df,null))[_0x7a72('0x54')](handleError(_0x7252df,null));};exports[_0x7a72('0x61')]=function(_0x5baeec,_0x10925c){var _0x113b7a={'raw':![],'where':{}};var _0x20244d={};var _0x3bab0f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7a72('0x62')]({'where':{'id':_0x5baeec['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x10925c,null))['then'](function(_0x5592fa){if(_0x5592fa){_0x20244d[_0x7a72('0x36')]=_[_0x7a72('0x38')](db[_0x7a72('0x63')][_0x7a72('0x33')]);_0x20244d[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x5baeec[_0x7a72('0x37')]);_0x20244d[_0x7a72('0x42')]=_[_0x7a72('0x3a')](_0x20244d[_0x7a72('0x36')],_0x20244d[_0x7a72('0x37')]);_0x113b7a[_0x7a72('0x39')]=_[_0x7a72('0x3a')](_0x20244d[_0x7a72('0x36')],qs[_0x7a72('0x3b')](_0x5baeec[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x113b7a['attributes']=_0x113b7a['attributes'][_0x7a72('0x3c')]?_0x113b7a[_0x7a72('0x39')]:_0x20244d[_0x7a72('0x36')];if(!_0x5baeec[_0x7a72('0x37')][_0x7a72('0x3d')]('nolimit')){_0x113b7a[_0x7a72('0x23')]=qs[_0x7a72('0x23')](_0x5baeec[_0x7a72('0x37')][_0x7a72('0x23')]);_0x113b7a[_0x7a72('0x25')]=qs[_0x7a72('0x25')](_0x5baeec[_0x7a72('0x37')][_0x7a72('0x25')]);}_0x113b7a[_0x7a72('0x3f')]=qs[_0x7a72('0x40')](_0x5baeec[_0x7a72('0x37')][_0x7a72('0x40')]);_0x113b7a[_0x7a72('0x41')]=qs[_0x7a72('0x42')](_['pick'](_0x5baeec['query'],_0x20244d[_0x7a72('0x42')]));_0x113b7a[_0x7a72('0x41')][_0x7a72('0x5b')]=_0x5592fa['id'];if(_0x5baeec['query'][_0x7a72('0x44')]){_0x113b7a[_0x7a72('0x41')]=_[_0x7a72('0x45')](_0x113b7a[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x113b7a[_0x7a72('0x39')],function(_0x32ac01){var _0x5dffaa={};_0x5dffaa[_0x32ac01]={'$like':'%'+_0x5baeec[_0x7a72('0x37')][_0x7a72('0x44')]+'%'};return _0x5dffaa;})});}_0x113b7a=_[_0x7a72('0x45')]({},_0x113b7a,_0x5baeec[_0x7a72('0x47')]);return db['CannedAnswer'][_0x7a72('0x24')]({'where':_0x113b7a[_0x7a72('0x41')]})[_0x7a72('0x15')](function(_0x8fcb04){_0x3bab0f['count']=_0x8fcb04;if(_0x5baeec[_0x7a72('0x37')][_0x7a72('0x4c')]){_0x113b7a[_0x7a72('0x48')]=[{'all':!![]}];}return db[_0x7a72('0x63')][_0x7a72('0x49')](_0x113b7a);})[_0x7a72('0x15')](function(_0x2a62ca){_0x3bab0f[_0x7a72('0x4a')]=_0x2a62ca;return _0x3bab0f;});}})[_0x7a72('0x15')](respondWithFilteredResult(_0x10925c,_0x113b7a))['catch'](handleError(_0x10925c,null));};exports[_0x7a72('0x64')]=function(_0x561a63,_0x3a21c2){return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x561a63[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x3a21c2,null))['then'](function(_0x113895){if(_0x113895){return _0x113895[_0x7a72('0x64')](_0x561a63[_0x7a72('0x37')][_0x7a72('0x5f')]);}})[_0x7a72('0x15')](respondWithStatusCode(_0x3a21c2,null))['catch'](handleError(_0x3a21c2,null));};exports[_0x7a72('0x65')]=function(_0x5032f3,_0x25a532){_0x5032f3[_0x7a72('0x57')][_0x7a72('0x66')]=_0x5032f3[_0x7a72('0x67')][_0x7a72('0x68')];return db['ChatWebsite'][_0x7a72('0x4d')]({'where':{'id':_0x5032f3[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x25a532,null))[_0x7a72('0x15')](saveUpdates(_0x5032f3[_0x7a72('0x57')],null))['then'](respondWithResult(_0x25a532,null))[_0x7a72('0x54')](handleError(_0x25a532,null));};exports['addAvatar']=function(_0x32c8fc,_0x7b386b){_0x32c8fc[_0x7a72('0x57')][_0x7a72('0x69')]=_0x32c8fc[_0x7a72('0x67')][_0x7a72('0x68')];return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x32c8fc['params']['id']}})['then'](handleEntityNotFound(_0x7b386b,null))['then'](saveUpdates(_0x32c8fc['body'],null))[_0x7a72('0x15')](respondWithResult(_0x7b386b,null))[_0x7a72('0x54')](handleError(_0x7b386b,null));};exports[_0x7a72('0x6a')]=function(_0x240c9c,_0x106748){_0x240c9c[_0x7a72('0x57')][_0x7a72('0x6b')]=_0x240c9c[_0x7a72('0x67')][_0x7a72('0x68')];return db['ChatWebsite'][_0x7a72('0x4d')]({'where':{'id':_0x240c9c[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x106748,null))[_0x7a72('0x15')](saveUpdates(_0x240c9c[_0x7a72('0x57')],null))['then'](respondWithResult(_0x106748,null))[_0x7a72('0x54')](handleError(_0x106748,null));};exports[_0x7a72('0x6c')]=function(_0x362c86,_0x178a57){_0x362c86[_0x7a72('0x57')][_0x7a72('0x6d')]=_0x362c86['file'][_0x7a72('0x68')];return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x362c86['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x178a57,null))[_0x7a72('0x15')](saveUpdates(_0x362c86[_0x7a72('0x57')],null))[_0x7a72('0x15')](respondWithResult(_0x178a57,null))[_0x7a72('0x54')](handleError(_0x178a57,null));};exports[_0x7a72('0x6e')]=function(_0xbe42a0,_0x51793b){var _0x10c985=path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0x71'));var _0x2736d3={'where':{'id':_0xbe42a0['params']['id']},'attributes':['id',_0x7a72('0x66')],'raw':!![]};var _0x2fd292=![];return require(_0x7a72('0x72'))['getLicense']()[_0x7a72('0x15')](function(_0x53eafc){if(_0x53eafc){_0x2fd292=_0x53eafc['custom'];}})[_0x7a72('0x15')](function(){return db[_0x7a72('0x32')][_0x7a72('0x4d')](_0x2736d3);})[_0x7a72('0x15')](handleEntityNotFound(_0x51793b,null))[_0x7a72('0x15')](function(_0x2e1e8f){if(_0x2e1e8f){if(!_[_0x7a72('0x73')](_0x2e1e8f[_0x7a72('0x66')])){if(fs['existsSync'](path['join'](config[_0x7a72('0x70')],_0x7a72('0x74'),_0x2e1e8f[_0x7a72('0x66')]))&&_0x2fd292){_0x10c985=path[_0x7a72('0x6f')](config[_0x7a72('0x70')],'server/files/images/logos/',_0x2e1e8f['sitepic']);}}return _0x51793b[_0x7a72('0x75')](_0x10c985);}})['catch'](handleError(_0x51793b,null));};exports['getAvatar']=function(_0x16ad6d,_0x13d07b){var _0x40e351=path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0x76'));var _0xb1044c={'where':{'id':_0x16ad6d['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x7a72('0x4d')](_0xb1044c)[_0x7a72('0x15')](handleEntityNotFound(_0x13d07b,null))[_0x7a72('0x15')](function(_0x531ecc){if(_0x531ecc){if(!_[_0x7a72('0x73')](_0x531ecc[_0x7a72('0x69')])){if(fs[_0x7a72('0x77')](path[_0x7a72('0x6f')](config['root'],_0x7a72('0x78'),_0x531ecc['agentAvatar']))){_0x40e351=path['join'](config[_0x7a72('0x70')],_0x7a72('0x78'),_0x531ecc[_0x7a72('0x69')]);}}return _0x13d07b[_0x7a72('0x75')](_0x40e351);}})[_0x7a72('0x54')](handleError(_0x13d07b,null));};exports['getCustomerAvatar']=function(_0x8fb550,_0x58d293){var _0x2a7df5=path['join'](config[_0x7a72('0x70')],_0x7a72('0x79'));var _0x19c180={'where':{'id':_0x8fb550[_0x7a72('0x58')]['id']},'attributes':['id',_0x7a72('0x6b'),'showCustomerAvatar'],'raw':!![]};return db[_0x7a72('0x32')][_0x7a72('0x4d')](_0x19c180)[_0x7a72('0x15')](handleEntityNotFound(_0x58d293,null))[_0x7a72('0x15')](function(_0x1db09c){if(_0x1db09c){if(!_[_0x7a72('0x73')](_0x1db09c[_0x7a72('0x6b')])){if(fs['existsSync'](path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0x78'),_0x1db09c[_0x7a72('0x6b')]))&&_0x1db09c[_0x7a72('0x7a')]){_0x2a7df5=path['join'](config[_0x7a72('0x70')],'server/files/images/avatars/',_0x1db09c[_0x7a72('0x6b')]);}}return _0x58d293[_0x7a72('0x75')](_0x2a7df5);}})[_0x7a72('0x54')](handleError(_0x58d293,null));};exports['getSystemAvatar']=function(_0x4a786f,_0x4e90a0){var _0x402f35=path['join'](config[_0x7a72('0x70')],_0x7a72('0x7b'));var _0x6c6187={'where':{'id':_0x4a786f[_0x7a72('0x58')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x7a72('0x4d')](_0x6c6187)['then'](handleEntityNotFound(_0x4e90a0,null))[_0x7a72('0x15')](function(_0x3a105f){if(_0x3a105f){if(!_[_0x7a72('0x73')](_0x3a105f[_0x7a72('0x6d')])){if(fs[_0x7a72('0x77')](path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0x78'),_0x3a105f[_0x7a72('0x6d')]))){_0x402f35=path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0x78'),_0x3a105f[_0x7a72('0x6d')]);}}return _0x4e90a0[_0x7a72('0x75')](_0x402f35);}})[_0x7a72('0x54')](handleError(_0x4e90a0,null));};exports['notify']=function(_0x55bd25,_0x50fad9){var _0x11614e=require('user-agent-parser');var _0x22bf4a=new _0x11614e();var _0x2cbb2e=_0x22bf4a['setUA'](_0x55bd25['headers'][_0x7a72('0x7c')])[_0x7a72('0x7d')]();var _0x1cc136={'body':_0x55bd25[_0x7a72('0x57')],'channel':_0x7a72('0x7e')};var _0x52219b=[];var _0x5f50f8=[];var _0x18ccaf={};var _0x42d0b1=![];return db[_0x7a72('0x7f')][_0x7a72('0x59')]()['then'](function(_0x139ab6){if(!_0x139ab6){throw new db[(_0x7a72('0x80'))][(_0x7a72('0x81'))](_0x7a72('0x82'));}_0x52219b=_[_0x7a72('0x83')](_[_0x7a72('0x38')](_0x139ab6),[_0x7a72('0x84'),_0x7a72('0x85')]);_0x5f50f8=_[_0x7a72('0x83')](_['keys'](_0x139ab6),[_0x7a72('0x84'),_0x7a72('0x85'),_0x7a72('0x86'),_0x7a72('0x87')]);if(_0x55bd25['body']['id']){delete _0x55bd25['body']['id'];}if(_[_0x7a72('0x73')](_0x55bd25['body']['from'])){throw new db[(_0x7a72('0x80'))][(_0x7a72('0x81'))]('from\x20is\x20mandatory');}if(_[_0x7a72('0x73')](_0x55bd25[_0x7a72('0x57')][_0x7a72('0x57')])||_0x55bd25[_0x7a72('0x57')][_0x7a72('0x57')]===''){throw new db[(_0x7a72('0x80'))][(_0x7a72('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x55bd25[_0x7a72('0x57')][_0x7a72('0x88')])){throw new db[(_0x7a72('0x80'))][(_0x7a72('0x81'))](_0x7a72('0x89')+_0x5f50f8);}if(!_[_0x7a72('0x8a')](_0x5f50f8,_0x55bd25[_0x7a72('0x57')][_0x7a72('0x88')])){throw new db['Sequelize'][(_0x7a72('0x81'))](_0x7a72('0x8b')+_0x5f50f8);}_0x18ccaf[_0x55bd25['body'][_0x7a72('0x88')]]=_0x55bd25['body'][_0x7a72('0x8c')];})[_0x7a72('0x15')](function(){return db['ChatWebsite'][_0x7a72('0x4d')]({'where':{'id':_0x55bd25[_0x7a72('0x58')]['id']},'include':[{'model':db[_0x7a72('0x8d')],'as':'List','include':[{'model':db['CmContact'],'as':_0x7a72('0x8e'),'where':_0x18ccaf,'limit':0x1,'order':[[_0x7a72('0x85'),_0x7a72('0x8f')]]}]},{'model':db[_0x7a72('0x90')],'as':_0x7a72('0x91')}]});})[_0x7a72('0x15')](handleEntityNotFound(_0x50fad9,null))[_0x7a72('0x15')](function(_0x573a06){if(_0x573a06&&_0x573a06[_0x7a72('0x92')]){_0x1cc136[_0x7a72('0x93')]=_0x573a06;_0x1cc136[_0x7a72('0x94')]=_0x573a06['Applications'];_0x1cc136[_0x7a72('0x95')]=_0x573a06[_0x7a72('0x92')];_0x1cc136[_0x7a72('0x94')]=_[_0x7a72('0x96')](_0x1cc136['applications'],[_0x7a72('0x97')],['asc']);if(_0x1cc136['account'][_0x7a72('0x91')]){delete _0x1cc136[_0x7a72('0x93')][_0x7a72('0x91')];}if(_0x1cc136[_0x7a72('0x93')]['List']&&_0x1cc136[_0x7a72('0x93')][_0x7a72('0x92')][_0x7a72('0x8e')]['length']){return _0x1cc136[_0x7a72('0x93')]['List'][_0x7a72('0x8e')][0x0];}var _0x1548ae=_[_0x7a72('0xd')](_0x55bd25['body'],{'firstName':_0x55bd25[_0x7a72('0x57')][_0x7a72('0x8c')],'ListId':_0x573a06[_0x7a72('0x87')]});_0x1548ae[_0x55bd25[_0x7a72('0x57')][_0x7a72('0x88')]]=_0x55bd25[_0x7a72('0x57')][_0x7a72('0x8c')];return db['CmContact'][_0x7a72('0x4e')](_0x1548ae,{'fields':_0x52219b,'raw':!![]});}})['then'](handleEntityNotFound(_0x50fad9,null))['then'](function(_0x4e65a3){_0x1cc136[_0x7a72('0x98')]=_0x4e65a3;var _0x396b66=_0x55bd25[_0x7a72('0x57')][_0x7a72('0x99')];if(_0x55bd25[_0x7a72('0x9a')]['cf-connecting-ip']){_0x396b66=_0x55bd25[_0x7a72('0x9a')][_0x7a72('0x9b')];}else if(_0x55bd25[_0x7a72('0x9a')][_0x7a72('0x9c')]){_0x396b66=_['first'](_0x55bd25[_0x7a72('0x9a')][_0x7a72('0x9c')]['split'](','));}if(_0x4e65a3){var _0x4e8003={'ContactId':_0x4e65a3['id'],'ChatWebsiteId':_0x55bd25[_0x7a72('0x58')]['id'],'from':(_0x4e65a3['firstName']||'')+'\x20'+(_0x4e65a3['lastName']||''),'customerIp':_0x396b66,'customerPort':_0x55bd25['headers'][_0x7a72('0x9d')]?_0x55bd25['headers'][_0x7a72('0x9d')]:null,'referer':_0x55bd25[_0x7a72('0x57')][_0x7a72('0x9e')],'browserName':_0x2cbb2e[_0x7a72('0x9f')][_0x7a72('0x2c')]&&_0x2cbb2e[_0x7a72('0x9f')][_0x7a72('0xa0')]?util[_0x7a72('0xa1')]('%s\x20%s',_0x2cbb2e[_0x7a72('0x9f')][_0x7a72('0x2c')],_0x2cbb2e[_0x7a72('0x9f')][_0x7a72('0xa0')]):_0x7a72('0xa2'),'browserVersion':_0x2cbb2e[_0x7a72('0x9f')]['version']||'unknown','osName':util['format'](_0x7a72('0xa3'),_0x2cbb2e['os'][_0x7a72('0x2c')],_0x2cbb2e['os'][_0x7a72('0xa0')]),'osVersion':_0x2cbb2e['os'][_0x7a72('0xa0')],'deviceModel':_0x2cbb2e['device'][_0x7a72('0x36')]&&_0x2cbb2e[_0x7a72('0xa4')][_0x7a72('0xa5')]?util[_0x7a72('0xa1')](_0x7a72('0xa6'),_0x2cbb2e['device'][_0x7a72('0x36')],_0x2cbb2e['device'][_0x7a72('0xa5')],_0x2cbb2e[_0x7a72('0xa4')][_0x7a72('0xa7')]):null,'deviceVendor':_0x2cbb2e[_0x7a72('0xa4')][_0x7a72('0xa5')],'deviceType':_0x2cbb2e[_0x7a72('0xa4')]['type'],'formData':JSON[_0x7a72('0x1a')](_0x55bd25['body'])};var _0x3d7948={'ChatWebsiteId':_0x55bd25['params']['id'],'closed':![]};if(_0x55bd25['body']['threadId']){_0x3d7948[_0x7a72('0xa8')]=_0x55bd25[_0x7a72('0x57')][_0x7a72('0xa8')];return db[_0x7a72('0xa9')]['find']({'where':_0x3d7948})['then'](function(_0x5d6932){if(_0x5d6932){return[_0x5d6932,![]];}_0x4e8003['threadId']=_0x55bd25['body'][_0x7a72('0xa8')];_0x4e8003[_0x7a72('0xaa')]=_0x55bd25[_0x7a72('0x57')][_0x7a72('0xaa')];return db['ChatInteraction'][_0x7a72('0x4e')](_0x4e8003)[_0x7a72('0x15')](function(_0x275cb2){return[_0x275cb2,!![]];});});}_0x3d7948[_0x7a72('0xab')]=_0x4e65a3['id'];if(_0x55bd25[_0x7a72('0x57')][_0x7a72('0xac')]&&_0x55bd25[_0x7a72('0x57')]['interaction']['id']){_0x3d7948['id']=_0x55bd25['body'][_0x7a72('0xac')]['id'];return db['ChatInteraction'][_0x7a72('0x4d')]({'where':_0x3d7948})[_0x7a72('0x15')](function(_0x3ea600){if(_0x3ea600){return[_0x3ea600,![]];}return db[_0x7a72('0xa9')][_0x7a72('0x4e')](_0x4e8003)[_0x7a72('0x15')](function(_0x1afb8c){return[_0x1afb8c,!![]];});});}return db[_0x7a72('0xa9')][_0x7a72('0x4e')](_0x4e8003)[_0x7a72('0x15')](function(_0x3bdcb0){return[_0x3bdcb0,!![]];});}})[_0x7a72('0xad')](function(_0x328eb7,_0x41b2c9){if(_0x328eb7){_0x42d0b1=_0x41b2c9;if(!_0x41b2c9){var _0x5a4e5d={'from':(_0x1cc136[_0x7a72('0x98')][_0x7a72('0xae')]||'')+'\x20'+(_0x1cc136['contact'][_0x7a72('0xaf')]||'')};if(_0x55bd25['body'][_0x7a72('0xa8')]&&_0x55bd25[_0x7a72('0x57')][_0x7a72('0xb0')]&&_0x55bd25[_0x7a72('0x57')][_0x7a72('0xa8')]!=_0x55bd25[_0x7a72('0x57')][_0x7a72('0xb0')]){_0x5a4e5d[_0x7a72('0xa8')]=_0x55bd25[_0x7a72('0x57')][_0x7a72('0xb0')];}return _0x328eb7[_0x7a72('0x56')](_0x5a4e5d);}else{return _0x328eb7;}}})['then'](function(_0x28f97f){_0x1cc136[_0x7a72('0xac')]=_0x28f97f[_0x7a72('0x28')]({'plain':!![]});_0x1cc136['interaction']['created']=_0x42d0b1;if(_0x1cc136[_0x7a72('0xac')][_0x7a72('0xb1')]){if(_0x1cc136[_0x7a72('0x93')]['autoclose']){_0x1cc136['applications'][_0x7a72('0xb2')]({'id':0x0,'priority':_0x1cc136[_0x7a72('0x94')][_0x7a72('0x3c')]+0x1,'app':_0x7a72('0xb3'),'appdata':_0x7a72('0xb4'),'interval':'*,*,*,*'});}}return db[_0x7a72('0xb5')][_0x7a72('0x4e')]({'body':_0x55bd25['body'][_0x7a72('0x57')],'ChatWebsiteId':_0x55bd25[_0x7a72('0x58')]['id'],'ChatInteractionId':_0x28f97f['id'],'direction':'in','ContactId':_0x1cc136[_0x7a72('0x98')]['id'],'AttachmentId':_0x55bd25[_0x7a72('0x57')]['AttachmentId']});})[_0x7a72('0x15')](function(_0x50d301){_0x1cc136[_0x7a72('0x1d')]=_0x50d301;if(_0x1cc136['interaction'][_0x7a72('0xb6')]){return db[_0x7a72('0xb7')][_0x7a72('0x4d')]({'attributes':['id',_0x7a72('0x2c')],'where':{'id':_0x1cc136[_0x7a72('0xac')]['UserId']}})[_0x7a72('0x15')](function(_0x2cb8af){if(_0x2cb8af){_0x1cc136[_0x7a72('0x94')][_0x7a72('0xb8')]({'id':0x0,'priority':0x0,'app':_0x7a72('0xb9'),'appdata':_0x2cb8af[_0x7a72('0x2c')]+','+(_0x1cc136[_0x7a72('0x93')]['waitForTheAssignedAgent']||0xa),'interval':_0x7a72('0xba')});_0x1cc136[_0x7a72('0xbb')]=!![];}return respondWithRpcPromise(_0x7a72('0xbc'),_0x7a72('0xbd'),_0x1cc136);});}return respondWithRpcPromise(_0x7a72('0xbc'),_0x7a72('0xbd'),_0x1cc136);})[_0x7a72('0x15')](function(_0x22302a){respondWithRpcPromise(_0x7a72('0xbe'),_0x7a72('0xbe'),{'event':_0x7a72('0xbf'),'message':_0x22302a},client9002);return _0x22302a;})[_0x7a72('0x15')](respondWithResult(_0x50fad9,null))['catch'](handleError(_0x50fad9,null));};exports[_0x7a72('0xc0')]=function(_0x17f14e,_0x3ec70f){var _0x1d798b,_0x5f3463,_0x1be494;var _0x4b8352=[];var _0x16e761={};var _0x128000=_0x17f14e['files']||[];var _0x216045=[];var _0x41040d;return db[_0x7a72('0x7f')][_0x7a72('0x59')]()['then'](function(_0x4cf6f0){if(!_0x4cf6f0){throw new db[(_0x7a72('0x80'))][(_0x7a72('0x81'))](_0x7a72('0x82'));}_0x4b8352=_[_0x7a72('0x83')](_[_0x7a72('0x38')](_0x4cf6f0),[_0x7a72('0x84'),_0x7a72('0x85'),'CompanyId','ListId']);if(_0x17f14e['body']['id']){delete _0x17f14e['body']['id'];}if(_[_0x7a72('0x73')](_0x17f14e['body']['from'])){throw _0x3ec70f[_0x7a72('0x1f')](0x1f4)[_0x7a72('0x2d')](new db['Sequelize'][(_0x7a72('0x81'))]('from\x20is\x20mandatory'));}if(_[_0x7a72('0x73')](_0x17f14e[_0x7a72('0x57')][_0x7a72('0x57')])||_0x17f14e[_0x7a72('0x57')]['body']===''){throw _0x3ec70f[_0x7a72('0x1f')](0x1f4)['send'](new db[(_0x7a72('0x80'))][(_0x7a72('0x81'))](_0x7a72('0xc1')));}if(_[_0x7a72('0x73')](_0x17f14e['body'][_0x7a72('0xc2')])){throw _0x3ec70f[_0x7a72('0x1f')](0x1f4)[_0x7a72('0x2d')](new db['Sequelize'][(_0x7a72('0x81'))](_0x7a72('0xc3')+_0x4b8352));}if(!_[_0x7a72('0x8a')](_0x4b8352,_0x17f14e[_0x7a72('0x57')][_0x7a72('0xc2')])){throw _0x3ec70f[_0x7a72('0x1f')](0x1f4)['send'](new db[(_0x7a72('0x80'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b8352));}_0x16e761[_0x17f14e[_0x7a72('0x57')][_0x7a72('0xc2')]]=_0x17f14e[_0x7a72('0x57')][_0x7a72('0x8c')];})[_0x7a72('0x15')](function(){return db[_0x7a72('0x32')]['find']({'where':{'id':_0x17f14e[_0x7a72('0x58')]['id']},'include':[{'model':db[_0x7a72('0x8d')],'as':_0x7a72('0x92')},{'model':db[_0x7a72('0xc4')],'as':'MailAccount'}]});})[_0x7a72('0x15')](handleEntityNotFound(_0x3ec70f,null))[_0x7a72('0x15')](function(_0x106f1a){if(_0x106f1a&&_0x106f1a[_0x7a72('0x92')]){_0x5f3463=_0x106f1a;var _0x447a75=_[_0x7a72('0xd')](_0x17f14e['body'],{'firstName':_0x17f14e['body'][_0x7a72('0x8c')],'phone':_0x17f14e[_0x7a72('0x57')][_0x7a72('0x8c')],'ListId':_0x106f1a[_0x7a72('0x87')]});_0x447a75[_0x17f14e['body'][_0x7a72('0xc2')]]=_0x17f14e[_0x7a72('0x57')][_0x7a72('0x8c')];return db[_0x7a72('0x7f')][_0x7a72('0xc5')]({'where':_0x16e761,'defaults':_0x447a75});}})[_0x7a72('0xad')](function(_0x4f6138){if(_0x4f6138){_0x1be494=_0x4f6138;var _0x32a4f9=fs['readFileSync'](path[_0x7a72('0x6f')](config['root'],_0x7a72('0xc6')),_0x7a72('0xc7'));var _0x17b0ec=ejs[_0x7a72('0xc8')](_0x32a4f9,{'body':_[_0x7a72('0xc9')](_0x17f14e[_0x7a72('0x57')][_0x7a72('0x57')]),'bodyTitle':_0x5f3463[_0x7a72('0xca')]});return db[_0x7a72('0xcb')][_0x7a72('0x4e')]({'body':_0x17b0ec,'ContactId':_0x4f6138['id'],'ChatWebsiteId':_0x5f3463['id']});}})[_0x7a72('0x15')](function(_0x4482d4){_0x41040d=_0x4482d4;if(_0x128000['length']){var _0x1da1b=_0x128000[_0x7a72('0x31')](function(_0x47b4cb){return{'name':_0x47b4cb[_0x7a72('0xcc')],'basename':_0x47b4cb[_0x7a72('0x68')],'type':_0x47b4cb['mimetype'],'ChatOfflineMessageId':_0x4482d4['id']};});_0x216045=_0x1da1b[_0x7a72('0x31')](_0x435195=>{var _0x50b4f1={'filename':_0x435195[_0x7a72('0x2c')],'path':path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0xcd'),'files',_0x7a72('0xce'),'offline-chat',_0x435195[_0x7a72('0xcf')])};return _0x50b4f1;});if(!_0x5f3463[_0x7a72('0xd0')]){return db[_0x7a72('0xd1')][_0x7a72('0xd2')](function(_0x3d40a1){return db[_0x7a72('0xd3')][_0x7a72('0xd4')](_0x1da1b,{'transaction':_0x3d40a1});});}}})[_0x7a72('0x15')](function(){if(_0x41040d){_0x1d798b=_0x41040d;return db[_0x7a72('0xc4')][_0x7a72('0x62')]({'where':{'active':!![]},'include':[{'model':db[_0x7a72('0xd5')],'as':'Smtp','raw':!![]}]});}})[_0x7a72('0x15')](function(_0x51bbe5){if(_0x51bbe5&&_0x51bbe5[_0x7a72('0xd6')]&&_0x5f3463['forwardOffline']&&_0x5f3463[_0x7a72('0xd7')]){var _0x58fefd={'tls':{'rejectUnauthorized':![]}};if(_0x51bbe5[_0x7a72('0xd6')][_0x7a72('0xd8')]){_0x58fefd[_0x7a72('0xd8')]=_0x51bbe5[_0x7a72('0xd6')][_0x7a72('0xd8')];}else{_0x58fefd['host']=_0x51bbe5[_0x7a72('0xd6')]['host'];_0x58fefd[_0x7a72('0xd9')]=_0x51bbe5[_0x7a72('0xd6')]['port'];_0x58fefd[_0x7a72('0xda')]=_0x51bbe5[_0x7a72('0xd6')]['secure'];}if(_0x51bbe5[_0x7a72('0xd6')][_0x7a72('0xdb')]){_0x58fefd[_0x7a72('0xdc')]={'user':_0x51bbe5[_0x7a72('0xd6')][_0x7a72('0x50')],'pass':_0x51bbe5[_0x7a72('0xd6')][_0x7a72('0xdd')]};}return respondWithRpcPromise(_0x7a72('0xde'),_0x7a72('0xdf'),{'account':_0x58fefd,'message':{'from':util[_0x7a72('0xa1')](_0x7a72('0xe0'),_0x51bbe5[_0x7a72('0x2c')],_0x51bbe5[_0x7a72('0xe1')]||_0x51bbe5[_0x7a72('0xd6')][_0x7a72('0x50')]),'to':_0x5f3463[_0x7a72('0xd7')],'subject':_0x5f3463[_0x7a72('0xe2')],'html':_0x1d798b['body'],'attachments':_0x216045}},client9003)[_0x7a72('0x15')](function(){return _0x1d798b;})['catch'](function(_0x202979){console[_0x7a72('0x1b')](_0x202979);});}})[_0x7a72('0x15')](function(){if(_0x5f3463&&_0x5f3463[_0x7a72('0xd0')]&&_0x5f3463[_0x7a72('0xe3')]){var _0x43c029=[];if(_0x128000[_0x7a72('0x3c')]){_0x43c029=_0x128000['map'](function(_0xf2d298){return{'name':_0xf2d298[_0x7a72('0xcc')],'basename':_0xf2d298[_0x7a72('0x68')],'type':_0xf2d298['mimetype'],'ChatOfflineMessageId':_0x41040d['id']};});}var _0x2def11;if(!_['isNil'](_0x5f3463['subjectOffline'])){var _0x55bbc4=_[_0x7a72('0x31')](_0x17f14e[_0x7a72('0x57')],function(_0xffb0ce){return _0xffb0ce;});var _0x4d5d59=_[_0x7a72('0xe4')](_0x55bbc4)[0x0];var _0x406478=_[_0x7a72('0xe5')](_0x4d5d59,function(_0x571748){return _0x571748;});_0x2def11=_0x406478[0x1][_0x5f3463[_0x7a72('0xe6')]];}var _0x4d0fd0={'from':_0x1be494[_0x7a72('0xe1')],'firstName':_0x1be494['firstName'],'lastName':_0x1be494[_0x7a72('0xaf')],'mapKey':_0x7a72('0xe1'),'message':{'from':_0x1be494['email'],'to':_0x5f3463[_0x7a72('0xc4')][_0x7a72('0xe1')],'cc':'','subject':_[_0x7a72('0x73')](_0x2def11)?_0x5f3463[_0x7a72('0xe2')]:_0x2def11,'messageId':'','sentAt':new Date(),'attach':_0x43c029[_0x7a72('0x3c')],'attachments':_0x43c029,'originChannel':_0x7a72('0xe7'),'ChatWebsiteId':_0x5f3463['id'],'ChatOfflineMessageId':_0x1d798b['id'],'originTo':_0x5f3463[_0x7a72('0xc4')]['email']},'body':_0x1d798b['body']};var _0x58b70c={'account':{'id':_0x5f3463[_0x7a72('0xe3')]},'body':_0x4d0fd0,'log':_0x7a72('0xe8')};return respondWithRpcPromise('NotifyMailAccount',_0x7a72('0xe9'),_0x58b70c,client9001)[_0x7a72('0x15')](function(){return _0x1d798b;})[_0x7a72('0x54')](function(_0x4cf335){console[_0x7a72('0x1b')](_0x4cf335);});}return;})[_0x7a72('0x15')](function(){if(_0x1d798b){return _0x1d798b;}})[_0x7a72('0x15')](respondWithResult(_0x3ec70f,null))[_0x7a72('0x54')](function(_0x68f0d7){console[_0x7a72('0x1b')](_0x7a72('0x54'),_0x68f0d7);for(var _0xaab420 of _0x128000){var _0x47a330=path[_0x7a72('0x6f')](config[_0x7a72('0x70')],_0x7a72('0xcd'),_0x7a72('0xea'),'attachments','offline-chat',_0xaab420[_0x7a72('0x68')]);fs_extra['remove'](_0x47a330)[_0x7a72('0x54')](function(_0x580fbe){console['error'](_0x7a72('0xeb'),_0x47a330,_0x580fbe);});}});};exports['addInteraction']=function(_0x2542d6,_0x186223){return db['ChatInteraction'][_0x7a72('0x4d')]({'where':{'id':_0x2542d6[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x186223,null))[_0x7a72('0x15')](function(_0x3c95bb){if(_0x3c95bb){return _0x3c95bb[_0x7a72('0xec')](_0x2542d6[_0x7a72('0x57')]['ids'],_[_0x7a72('0xed')](_0x2542d6['body'],[_0x7a72('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x186223,null))[_0x7a72('0x54')](handleError(_0x186223,null));};exports[_0x7a72('0xee')]=function(_0x4db15a,_0x1ab70e){var _0x4c8817={'raw':![],'where':{}};var _0x4d70b1={};var _0x45cb2c={'count':0x0,'rows':[]};return db[_0x7a72('0x32')]['findOne']({'where':{'id':_0x4db15a[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x1ab70e,null))['then'](function(_0x39e95d){if(_0x39e95d){_0x4d70b1['model']=_[_0x7a72('0x38')](db[_0x7a72('0xa9')][_0x7a72('0x33')]);_0x4d70b1[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x4db15a[_0x7a72('0x37')]);_0x4d70b1[_0x7a72('0x42')]=_[_0x7a72('0x3a')](_0x4d70b1[_0x7a72('0x36')],_0x4d70b1['query']);_0x4c8817['attributes']=_[_0x7a72('0x3a')](_0x4d70b1[_0x7a72('0x36')],qs['fields'](_0x4db15a[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x4c8817['attributes']=_0x4c8817['attributes'][_0x7a72('0x3c')]?_0x4c8817[_0x7a72('0x39')]:_0x4d70b1[_0x7a72('0x36')];if(!_0x4db15a['query'][_0x7a72('0x3d')]('nolimit')){_0x4c8817[_0x7a72('0x23')]=qs[_0x7a72('0x23')](_0x4db15a['query'][_0x7a72('0x23')]);_0x4c8817['offset']=qs[_0x7a72('0x25')](_0x4db15a[_0x7a72('0x37')]['offset']);}_0x4c8817['order']=qs[_0x7a72('0x40')](_0x4db15a[_0x7a72('0x37')][_0x7a72('0x40')]);_0x4c8817[_0x7a72('0x41')]=qs[_0x7a72('0x42')](_['pick'](_0x4db15a[_0x7a72('0x37')],_0x4d70b1[_0x7a72('0x42')]));_0x4c8817[_0x7a72('0x41')][_0x7a72('0x5b')]=_0x39e95d['id'];if(_0x4db15a[_0x7a72('0x37')][_0x7a72('0x44')]){_0x4c8817[_0x7a72('0x41')]=_['merge'](_0x4c8817[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x4c8817[_0x7a72('0x39')],function(_0x16a6f4){var _0x14e56e={};_0x14e56e[_0x16a6f4]={'$like':'%'+_0x4db15a[_0x7a72('0x37')]['filter']+'%'};return _0x14e56e;})});}_0x4c8817=_[_0x7a72('0x45')]({},_0x4c8817,_0x4db15a[_0x7a72('0x47')]);return db[_0x7a72('0xa9')][_0x7a72('0x24')]({'where':_0x4c8817[_0x7a72('0x41')]})[_0x7a72('0x15')](function(_0xcc5563){_0x45cb2c[_0x7a72('0x24')]=_0xcc5563;if(_0x4db15a[_0x7a72('0x37')]['includeAll']){_0x4c8817[_0x7a72('0x48')]=[{'model':db[_0x7a72('0x7f')],'as':_0x7a72('0xef'),'required':![]},{'model':db['User'],'as':_0x7a72('0xf0'),'attributes':[_0x7a72('0x2c'),_0x7a72('0xf1'),_0x7a72('0xf2')],'required':![]},{'model':db[_0x7a72('0xf3')],'as':_0x7a72('0xf4'),'attributes':['id',_0x7a72('0x2c'),_0x7a72('0xf5')],'where':_0x4db15a['query'][_0x7a72('0xf6')]?{'id':_0x4db15a[_0x7a72('0x37')]['tag']}:undefined,'required':_0x4db15a['query']['tag']?!![]:![]}];}return db['ChatInteraction'][_0x7a72('0x49')](_0x4c8817);})['then'](function(_0x103f77){_0x45cb2c['rows']=_0x103f77;return _0x45cb2c;});}})['then'](respondWithFilteredResult(_0x1ab70e,_0x4c8817))[_0x7a72('0x54')](handleError(_0x1ab70e,null));};function iftimePromise(_0x55cef8,_0xaad314){return respondWithRpcPromise(_0x7a72('0xf7'),_0x7a72('0xf8'),{'command':_0xaad314['timezone']?util[_0x7a72('0xa1')]('iftime\x20%s,%s',_0x55cef8['interval'],_0xaad314['timezone']):util[_0x7a72('0xa1')](_0x7a72('0xf9'),_0x55cef8[_0x7a72('0xfa')])},client9002)[_0x7a72('0x15')](function(_0x1e2213){var _0x441efc=_0x1e2213&&_0x1e2213[_0x7a72('0xfb')](_0x7a72('0xfc'))>=0x0?!![]:![];logger['info'](_0x7a72('0xfd'),_0xaad314['id'],_0x55cef8['id'],_0x55cef8['interval'],_0x441efc?'ONLINE':'OFFLINE',_0xaad314[_0x7a72('0xfe')]?_0xaad314[_0x7a72('0xfe')]:_0x7a72('0xff'));return _0x441efc;})['catch'](function(_0x58be99){logger['error'](_0x7a72('0xfd'),_0xaad314['id'],_0x55cef8['id'],_0x55cef8['interval'],util[_0x7a72('0x100')](_0x58be99,{'showHidden':![],'depth':null}),_0xaad314[_0x7a72('0xfe')]?_0xaad314['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x183ed2,_0x2f1de2){var _0x23539f=0x0;var _0x13f2bf=0x0;var _0x2d1ad5=![];var _0x44ef18;var _0x2fb945;return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x183ed2[_0x7a72('0x58')]['id']},'include':[{'model':db[_0x7a72('0x101')],'as':_0x7a72('0x101'),'include':[{'model':db[_0x7a72('0x101')],'as':_0x7a72('0x102'),'attributes':['id',_0x7a72('0xfa')],'raw':!![]}]}]})[_0x7a72('0x15')](handleEntityNotFound(_0x2f1de2,null))['then'](function(_0x4f150c){if(_0x4f150c){_0x44ef18=_0x4f150c;return _0x4f150c['getProactiveActions']({'raw':!![]});}})[_0x7a72('0x15')](function(_0x47f1a2){if(_0x44ef18){if(_0x47f1a2){_0x2fb945=_0x47f1a2;}}return require(_0x7a72('0x72'))[_0x7a72('0x103')]();})[_0x7a72('0x15')](function(_0xead989){if(_0xead989){_0x13f2bf=_0xead989['virtual'];_0x2d1ad5=_0xead989[_0x7a72('0x104')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x7a72('0x15')](function(_0x156e82){_0x23539f=_0x156e82;if(_0x13f2bf&&_0x156e82>_0x13f2bf){return db['License']['findOne']({'where':{'id':0x1}})[_0x7a72('0x15')](function(_0x2aad9e){if(_0x2aad9e){_0x2aad9e[_0x7a72('0x105')]('chatLicenseExceeded');}});}})[_0x7a72('0x15')](function(){if(_0x44ef18['Interval']&&_0x44ef18[_0x7a72('0x101')][_0x7a72('0x102')]){var _0x74f5b3=[];for(var _0x5baf84=0x0;_0x5baf84<_0x44ef18[_0x7a72('0x101')][_0x7a72('0x102')][_0x7a72('0x3c')];_0x5baf84++){var _0x2efbd1=_0x44ef18[_0x7a72('0x101')]['Intervals'][_0x5baf84][_0x7a72('0x28')]({'plain':!![]});_0x74f5b3[_0x7a72('0xb2')](iftimePromise(_0x2efbd1,_0x44ef18));}return BPromise[_0x7a72('0x106')](_0x74f5b3)[_0x7a72('0x15')](function(_0x4d2bbc){return _[_0x7a72('0x107')](_0x4d2bbc);});}else{return!![];}})[_0x7a72('0x15')](function(_0x3ef77a){var _0x35e06a=fs[_0x7a72('0x108')](path['join'](config[_0x7a72('0x70')],_0x7a72('0x109')),_0x7a72('0xc7'));var _0x14f6e4={'remote':_0x44ef18[_0x7a72('0x10a')],'query':querystring['stringify'](_['merge'](_0x44ef18[_0x7a72('0x28')]({'plain':!![]}),{'customerIp':_0x183ed2[_0x7a72('0x9a')]['x-forwarded-for']||_0x183ed2['headers'][_0x7a72('0x10b')]||_0x183ed2['connection']['remoteAddress']||_0x183ed2['ip'],'referer':_0x183ed2[_0x7a72('0x9a')][_0x7a72('0x9e')],'openedInteractions':_0x23539f,'maxInteractions':_0x13f2bf,'virtual':_0x2d1ad5[_0x7a72('0x10c')],'online':_0x3ef77a,'custom':_0x2d1ad5}))['replace'](/'/g,'\x5c\x27')};_0x2f1de2['send'](ejs[_0x7a72('0xc8')](Mustache[_0x7a72('0xc8')](_0x35e06a,_0x14f6e4),{'proactiveActions':_0x2fb945,'alignment':_0x44ef18[_0x7a72('0x10d')],'verticalAlignment':_0x44ef18[_0x7a72('0x10e')],'div_color':_0x44ef18[_0x7a72('0xf5')],'text_color':_0x44ef18[_0x7a72('0x10f')],'button_color':_0x44ef18[_0x7a72('0x110')],'background_color':_0x44ef18['backgroundColor']}));})[_0x7a72('0x54')](handleError(_0x2f1de2,null));};exports[_0x7a72('0x111')]=function(_0x7a925d,_0x3723e8){var _0x430f4a=_0x7a925d[_0x7a72('0x58')]['id'];var _0x3c9474=_0x7a925d[_0x7a72('0x57')];var _0x2a7b3d=0xc8;var _0x1ffefd=null;return db[_0x7a72('0xd1')][_0x7a72('0xd2')]({'isolationLevel':db[_0x7a72('0xd1')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1dcb49){return db['ChatWebsite']['findOne']({'where':{'id':_0x430f4a},'transaction':_0x1dcb49})[_0x7a72('0x15')](function(_0x40d0a1){if(_0x40d0a1){return db[_0x7a72('0x90')][_0x7a72('0x27')]({'where':{'ChatWebsiteId':_0x430f4a},'transaction':_0x1dcb49})[_0x7a72('0x15')](function(){var _0x201cd3=_[_0x7a72('0x31')](_0x3c9474,function(_0x5be291){_0x5be291['ChatWebsiteId']=_0x430f4a;return _0x5be291;});return db[_0x7a72('0x90')][_0x7a72('0xd4')](_0x201cd3,{'transaction':_0x1dcb49});});}else{_0x2a7b3d=0x194;_0x1ffefd=[];}});})[_0x7a72('0x15')](function(){if(_0x2a7b3d!==0x194){return db[_0x7a72('0x90')][_0x7a72('0x112')]({'where':{'ChatWebsiteId':_0x430f4a},'order':'priority'})['then'](function(_0x532aa2){_0x1ffefd=_0x532aa2;});}})[_0x7a72('0x54')](function(_0x4b4c06){_0x2a7b3d=0x1f4;logger[_0x7a72('0x1b')](_0x4b4c06[_0x7a72('0x2b')]);if(_0x4b4c06[_0x7a72('0x2c')]){delete _0x4b4c06['name'];}_0x1ffefd=_0x4b4c06;})['finally'](function(){if(_0x1ffefd===null){_0x3723e8['sendStatus'](_0x2a7b3d);}else{if(_0x2a7b3d===0x1f4){_0x3723e8[_0x7a72('0x1f')](_0x2a7b3d)['send'](_0x1ffefd);}else{_0x3723e8[_0x7a72('0x1f')](_0x2a7b3d)['json'](_0x1ffefd);}}});};exports['getApplications']=function(_0x2916bf,_0x26e6e2){var _0x2d92aa={};var _0x184d84={};var _0x10f263;var _0x140fbf;return db['ChatWebsite'][_0x7a72('0x62')]({'where':{'id':_0x2916bf['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x26e6e2,null))[_0x7a72('0x15')](function(_0x58eb48){if(_0x58eb48){_0x10f263=_0x58eb48;_0x184d84[_0x7a72('0x36')]=_['keys'](db[_0x7a72('0x90')][_0x7a72('0x33')]);_0x184d84[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x2916bf[_0x7a72('0x37')]);_0x184d84[_0x7a72('0x42')]=_['intersection'](_0x184d84[_0x7a72('0x36')],_0x184d84['query']);_0x2d92aa[_0x7a72('0x39')]=_['intersection'](_0x184d84[_0x7a72('0x36')],qs[_0x7a72('0x3b')](_0x2916bf[_0x7a72('0x37')]['fields']));_0x2d92aa[_0x7a72('0x39')]=_0x2d92aa[_0x7a72('0x39')]['length']?_0x2d92aa[_0x7a72('0x39')]:_0x184d84[_0x7a72('0x36')];_0x2d92aa[_0x7a72('0x3f')]=qs[_0x7a72('0x40')](_0x2916bf[_0x7a72('0x37')]['sort']);_0x2d92aa[_0x7a72('0x41')]=qs['filters'](_[_0x7a72('0x43')](_0x2916bf[_0x7a72('0x37')],_0x184d84[_0x7a72('0x42')]));if(_0x2916bf[_0x7a72('0x37')][_0x7a72('0x44')]){_0x2d92aa[_0x7a72('0x41')]=_[_0x7a72('0x45')](_0x2d92aa[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x2d92aa[_0x7a72('0x39')],function(_0x2d8811){var _0x1d459f={};_0x1d459f[_0x2d8811]={'$like':'%'+_0x2916bf[_0x7a72('0x37')]['filter']+'%'};return _0x1d459f;})});}_0x2d92aa=_[_0x7a72('0x45')]({},_0x2d92aa,_0x2916bf[_0x7a72('0x47')]);return _0x10f263[_0x7a72('0x113')](_0x2d92aa);}})[_0x7a72('0x15')](function(_0x22d799){if(_0x22d799){_0x140fbf=_0x22d799[_0x7a72('0x3c')];if(!_0x2916bf[_0x7a72('0x37')][_0x7a72('0x3d')](_0x7a72('0x3e'))){_0x2d92aa['limit']=qs[_0x7a72('0x23')](_0x2916bf['query']['limit']);_0x2d92aa[_0x7a72('0x25')]=qs[_0x7a72('0x25')](_0x2916bf['query'][_0x7a72('0x25')]);}return _0x10f263[_0x7a72('0x113')](_0x2d92aa);}})[_0x7a72('0x15')](function(_0x41a010){if(_0x41a010){return _0x41a010?{'count':_0x140fbf,'rows':_0x41a010}:null;}})[_0x7a72('0x15')](respondWithResult(_0x26e6e2,null))[_0x7a72('0x54')](handleError(_0x26e6e2,null));};exports['addProactiveActions']=function(_0x34fa0d,_0x16ce96){return db[_0x7a72('0x114')][_0x7a72('0x4d')]({'where':{'id':_0x34fa0d[_0x7a72('0x58')]['id']}})['then'](handleEntityNotFound(_0x16ce96,null))[_0x7a72('0x15')](function(_0x167364){if(_0x167364){return _0x167364[_0x7a72('0x115')](_0x34fa0d[_0x7a72('0x57')]['ids'],_[_0x7a72('0xed')](_0x34fa0d['body'],[_0x7a72('0x5f'),'id'])||{});}})[_0x7a72('0x15')](respondWithResult(_0x16ce96,null))['catch'](handleError(_0x16ce96,null));};exports['getProactiveActions']=function(_0x40ad3a,_0x465a3e){var _0x4ae7cb={};var _0x56631a={};var _0x3ac826;var _0x7a7cd2;return db[_0x7a72('0x32')][_0x7a72('0x62')]({'where':{'id':_0x40ad3a['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x465a3e,null))['then'](function(_0x5bf6cb){if(_0x5bf6cb){_0x3ac826=_0x5bf6cb;_0x56631a['model']=_['keys'](db['ChatProactiveAction'][_0x7a72('0x33')]);_0x56631a['query']=_[_0x7a72('0x38')](_0x40ad3a[_0x7a72('0x37')]);_0x56631a['filters']=_[_0x7a72('0x3a')](_0x56631a[_0x7a72('0x36')],_0x56631a[_0x7a72('0x37')]);_0x4ae7cb[_0x7a72('0x39')]=_['intersection'](_0x56631a[_0x7a72('0x36')],qs['fields'](_0x40ad3a[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x4ae7cb[_0x7a72('0x39')]=_0x4ae7cb[_0x7a72('0x39')][_0x7a72('0x3c')]?_0x4ae7cb[_0x7a72('0x39')]:_0x56631a[_0x7a72('0x36')];_0x4ae7cb[_0x7a72('0x3f')]=qs[_0x7a72('0x40')](_0x40ad3a[_0x7a72('0x37')][_0x7a72('0x40')]);_0x4ae7cb[_0x7a72('0x41')]=qs[_0x7a72('0x42')](_[_0x7a72('0x43')](_0x40ad3a[_0x7a72('0x37')],_0x56631a['filters']));if(_0x40ad3a['query'][_0x7a72('0x44')]){_0x4ae7cb[_0x7a72('0x41')]=_[_0x7a72('0x45')](_0x4ae7cb['where'],{'$or':_[_0x7a72('0x31')](_0x4ae7cb[_0x7a72('0x39')],function(_0x278e33){var _0x52882e={};_0x52882e[_0x278e33]={'$like':'%'+_0x40ad3a[_0x7a72('0x37')][_0x7a72('0x44')]+'%'};return _0x52882e;})});}_0x4ae7cb=_[_0x7a72('0x45')]({},_0x4ae7cb,_0x40ad3a[_0x7a72('0x47')]);return _0x3ac826[_0x7a72('0x116')](_0x4ae7cb);}})[_0x7a72('0x15')](function(_0xb31a58){if(_0xb31a58){_0x7a7cd2=_0xb31a58[_0x7a72('0x3c')];if(!_0x40ad3a[_0x7a72('0x37')][_0x7a72('0x3d')](_0x7a72('0x3e'))){_0x4ae7cb[_0x7a72('0x23')]=qs['limit'](_0x40ad3a['query'][_0x7a72('0x23')]);_0x4ae7cb[_0x7a72('0x25')]=qs[_0x7a72('0x25')](_0x40ad3a[_0x7a72('0x37')][_0x7a72('0x25')]);}return _0x3ac826[_0x7a72('0x116')](_0x4ae7cb);}})['then'](function(_0xd5c0ea){if(_0xd5c0ea){return _0xd5c0ea?{'count':_0x7a7cd2,'rows':_0xd5c0ea}:null;}})[_0x7a72('0x15')](respondWithResult(_0x465a3e,null))['catch'](handleError(_0x465a3e,null));};exports[_0x7a72('0x117')]=function(_0xb9dc77,_0x1b0f7e){var _0x2ea755=_0xb9dc77[_0x7a72('0x37')]['online']===_0x7a72('0x118')?_0x7a72('0x119'):_0x7a72('0x11a');return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'attributes':['id',_0x2ea755],'where':{'id':_0xb9dc77[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x1b0f7e,null))[_0x7a72('0x15')](function(_0x90f96f){if(_0x90f96f){var _0x56f424=_0x90f96f[_0x2ea755];var _0x33c232=_0x56f424&&_0x56f424[_0x7a72('0x11b')]?_0x56f424[_0x7a72('0x11b')]:[];_0x1b0f7e[_0x7a72('0x2d')]({'fromKey':_['isNil'](_0x56f424[_0x7a72('0x11c')])?undefined:_0x56f424[_0x7a72('0x11c')],'count':_0x33c232[_0x7a72('0x3c')],'rows':_0x33c232});}})[_0x7a72('0x54')](handleError(_0x1b0f7e,null));};exports[_0x7a72('0x11d')]=function(_0x32b18b,_0x3adeff){var _0x464035={'raw':![],'where':{}};var _0x55064c={};var _0x31aec1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7a72('0x62')]({'where':{'id':_0x32b18b[_0x7a72('0x58')]['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x3adeff,null))[_0x7a72('0x15')](function(_0x34e54d){if(_0x34e54d){_0x55064c['model']=_[_0x7a72('0x38')](db['ChatOfflineMessage'][_0x7a72('0x33')]);_0x55064c['query']=_[_0x7a72('0x38')](_0x32b18b['query']);_0x55064c[_0x7a72('0x42')]=_['intersection'](_0x55064c[_0x7a72('0x36')],_0x55064c['query']);_0x464035['attributes']=_['intersection'](_0x55064c[_0x7a72('0x36')],qs[_0x7a72('0x3b')](_0x32b18b[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x464035[_0x7a72('0x39')]=_0x464035[_0x7a72('0x39')][_0x7a72('0x3c')]?_0x464035['attributes']:_0x55064c[_0x7a72('0x36')];if(!_0x32b18b[_0x7a72('0x37')]['hasOwnProperty']('nolimit')){_0x464035[_0x7a72('0x23')]=qs['limit'](_0x32b18b['query'][_0x7a72('0x23')]);_0x464035[_0x7a72('0x25')]=qs[_0x7a72('0x25')](_0x32b18b[_0x7a72('0x37')]['offset']);}_0x464035[_0x7a72('0x3f')]=qs[_0x7a72('0x40')](_0x32b18b[_0x7a72('0x37')][_0x7a72('0x40')]);_0x464035[_0x7a72('0x41')]=qs[_0x7a72('0x42')](_[_0x7a72('0x43')](_0x32b18b[_0x7a72('0x37')],_0x55064c[_0x7a72('0x42')]));_0x464035[_0x7a72('0x41')][_0x7a72('0x5b')]=_0x34e54d['id'];if(_0x32b18b[_0x7a72('0x37')][_0x7a72('0x44')]){_0x464035[_0x7a72('0x41')]=_[_0x7a72('0x45')](_0x464035[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x464035[_0x7a72('0x39')],function(_0x40bf10){var _0x946f00={};_0x946f00[_0x40bf10]={'$like':'%'+_0x32b18b[_0x7a72('0x37')][_0x7a72('0x44')]+'%'};return _0x946f00;})});}_0x464035=_[_0x7a72('0x45')]({},_0x464035,_0x32b18b[_0x7a72('0x47')]);return db[_0x7a72('0xcb')][_0x7a72('0x24')]({'where':_0x464035[_0x7a72('0x41')]})['then'](function(_0x586331){_0x31aec1[_0x7a72('0x24')]=_0x586331;if(_0x32b18b['query'][_0x7a72('0x4c')]){_0x464035[_0x7a72('0x48')]=[{'all':!![]}];}else{_0x464035[_0x7a72('0x48')]=[{'model':db[_0x7a72('0x7f')],'as':_0x7a72('0xef'),'required':![]},{'model':db[_0x7a72('0xd3')],'as':_0x7a72('0x11e'),'required':![]}];}return db[_0x7a72('0xcb')][_0x7a72('0x49')](_0x464035);})[_0x7a72('0x15')](function(_0x3b8dc6){_0x31aec1[_0x7a72('0x4a')]=_0x3b8dc6;return _0x31aec1;});}})[_0x7a72('0x15')](respondWithFilteredResult(_0x3adeff,_0x464035))[_0x7a72('0x54')](handleError(_0x3adeff,null));};exports[_0x7a72('0x11f')]=function(_0x245e2e,_0x36d3b7){return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x245e2e['params']['id']}})['then'](handleEntityNotFound(_0x36d3b7,null))[_0x7a72('0x15')](function(_0x1ceae8){if(_0x1ceae8){return _0x1ceae8[_0x7a72('0x11f')](_0x245e2e[_0x7a72('0x57')][_0x7a72('0x5f')],_[_0x7a72('0xed')](_0x245e2e[_0x7a72('0x57')],[_0x7a72('0x5f'),'id'])||{})['spread'](function(_0x52c564){for(var _0x3f3e1d=0x0;_0x3f3e1d<_0x245e2e['body'][_0x7a72('0x5f')]['length'];_0x3f3e1d+=0x1){socket[_0x7a72('0x120')](_0x7a72('0x121'),{'UserId':Number(_0x245e2e[_0x7a72('0x57')][_0x7a72('0x5f')][_0x3f3e1d]),'ChatWebsiteId':Number(_0x245e2e[_0x7a72('0x58')]['id'])});}return _0x52c564;});}})[_0x7a72('0x15')](respondWithResult(_0x36d3b7,null))[_0x7a72('0x54')](handleError(_0x36d3b7,null));};exports['removeAgents']=function(_0x2cc956,_0x28a14f){return db[_0x7a72('0x32')][_0x7a72('0x4d')]({'where':{'id':_0x2cc956[_0x7a72('0x58')]['id']}})['then'](handleEntityNotFound(_0x28a14f,null))[_0x7a72('0x15')](function(_0x1ffae6){if(_0x1ffae6){return _0x1ffae6['removeAgents'](_0x2cc956[_0x7a72('0x37')][_0x7a72('0x5f')])[_0x7a72('0x15')](function(){if(_[_0x7a72('0x122')](_0x2cc956[_0x7a72('0x37')][_0x7a72('0x5f')])){for(var _0x349c60=0x0;_0x349c60<_0x2cc956[_0x7a72('0x37')]['ids'][_0x7a72('0x3c')];_0x349c60+=0x1){socket[_0x7a72('0x120')](_0x7a72('0x123'),{'UserId':Number(_0x2cc956[_0x7a72('0x37')][_0x7a72('0x5f')][_0x349c60]),'ChatWebsiteId':Number(_0x2cc956[_0x7a72('0x58')]['id'])});}}else{socket[_0x7a72('0x120')](_0x7a72('0x123'),{'UserId':Number(_0x2cc956[_0x7a72('0x37')][_0x7a72('0x5f')]),'ChatWebsiteId':Number(_0x2cc956[_0x7a72('0x58')]['id'])});}});}})[_0x7a72('0x15')](respondWithStatusCode(_0x28a14f,null))[_0x7a72('0x54')](handleError(_0x28a14f,null));};exports['getAgents']=function(_0x588e5b,_0x299eee){var _0x2cd62d={};var _0x5cd2a6={};var _0x591afc;var _0x1e057a;return db[_0x7a72('0x32')]['findOne']({'where':{'id':_0x588e5b['params']['id']}})[_0x7a72('0x15')](handleEntityNotFound(_0x299eee,null))[_0x7a72('0x15')](function(_0x4ee472){if(_0x4ee472){_0x591afc=_0x4ee472;_0x5cd2a6['model']=_['keys'](db[_0x7a72('0xb7')][_0x7a72('0x33')]);_0x5cd2a6[_0x7a72('0x37')]=_[_0x7a72('0x38')](_0x588e5b[_0x7a72('0x37')]);_0x5cd2a6[_0x7a72('0x42')]=_[_0x7a72('0x3a')](_0x5cd2a6[_0x7a72('0x36')],_0x5cd2a6[_0x7a72('0x37')]);_0x2cd62d[_0x7a72('0x39')]=_['intersection'](_0x5cd2a6['model'],qs['fields'](_0x588e5b[_0x7a72('0x37')][_0x7a72('0x3b')]));_0x2cd62d[_0x7a72('0x39')]=_0x2cd62d[_0x7a72('0x39')][_0x7a72('0x3c')]?_0x2cd62d[_0x7a72('0x39')]:_0x5cd2a6[_0x7a72('0x36')];_0x2cd62d[_0x7a72('0x3f')]=qs['sort'](_0x588e5b['query'][_0x7a72('0x40')]);_0x2cd62d['where']=qs['filters'](_[_0x7a72('0x43')](_0x588e5b['query'],_0x5cd2a6[_0x7a72('0x42')]));if(_0x588e5b['query'][_0x7a72('0x44')]){_0x2cd62d[_0x7a72('0x41')]=_[_0x7a72('0x45')](_0x2cd62d[_0x7a72('0x41')],{'$or':_[_0x7a72('0x31')](_0x2cd62d[_0x7a72('0x39')],function(_0x5bc966){var _0x4caac1={};_0x4caac1[_0x5bc966]={'$like':'%'+_0x588e5b[_0x7a72('0x37')][_0x7a72('0x44')]+'%'};return _0x4caac1;})});}_0x2cd62d=_['merge']({},_0x2cd62d,_0x588e5b['options']);return _0x591afc[_0x7a72('0x124')](_0x2cd62d);}})['then'](function(_0x2f44f5){if(_0x2f44f5){_0x1e057a=_0x2f44f5[_0x7a72('0x3c')];if(!_0x588e5b['query'][_0x7a72('0x3d')]('nolimit')){_0x2cd62d[_0x7a72('0x23')]=qs[_0x7a72('0x23')](_0x588e5b[_0x7a72('0x37')]['limit']);_0x2cd62d[_0x7a72('0x25')]=qs['offset'](_0x588e5b[_0x7a72('0x37')]['offset']);}return _0x591afc['getAgents'](_0x2cd62d);}})[_0x7a72('0x15')](function(_0xe11d34){if(_0xe11d34){return _0xe11d34?{'count':_0x1e057a,'rows':_0xe11d34}:null;}})[_0x7a72('0x15')](respondWithResult(_0x299eee,null))[_0x7a72('0x54')](handleError(_0x299eee,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e1043e1..da6b640 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 _0xa22a=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xa22a,0x153));var _0xaa22=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa22a[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xaa22('0x0'));var ChatWebsite=require(_0xaa22('0x1'))['db'][_0xaa22('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xaa22('0x3')](0x0);var events={'afterCreate':_0xaa22('0x4'),'afterUpdate':'update','afterDestroy':_0xaa22('0x5')};function emitEvent(_0x280c73){return function(_0x1912a3,_0x454829,_0xc8f622){ChatWebsiteEvents[_0xaa22('0x6')](_0x280c73+':'+_0x1912a3['id'],_0x1912a3);ChatWebsiteEvents['emit'](_0x280c73,_0x1912a3);_0xc8f622(null);};}for(var e in events){if(events[_0xaa22('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xaa22('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x1e69=['save','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x2c3ba5,_0x4a8ee9){var _0x100b9f=function(_0x4212d1){while(--_0x4212d1){_0x2c3ba5['push'](_0x2c3ba5['shift']());}};_0x100b9f(++_0x4a8ee9);}(_0x1e69,0x85));var _0x91e6=function(_0x22e34e,_0x598a1d){_0x22e34e=_0x22e34e-0x0;var _0x411e59=_0x1e69[_0x22e34e];return _0x411e59;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x91e6('0x0'))['db'][_0x91e6('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x91e6('0x2')](0x0);var events={'afterCreate':_0x91e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x192f10){return function(_0x351c1d,_0x2b53b6,_0x15545c){ChatWebsiteEvents[_0x91e6('0x4')](_0x192f10+':'+_0x351c1d['id'],_0x351c1d);ChatWebsiteEvents[_0x91e6('0x4')](_0x192f10,_0x351c1d);_0x15545c(null);};}for(var e in events){if(events[_0x91e6('0x5')](e)){var event=events[e];ChatWebsite[_0x91e6('0x6')](e,emitEvent(event));}}module[_0x91e6('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 bb78f61..258de89 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 _0xe49a=['path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xd99a7f,_0x561138){var _0x20bae0=function(_0x1fbabe){while(--_0x1fbabe){_0xd99a7f['push'](_0xd99a7f['shift']());}};_0x20bae0(++_0x561138);}(_0xe49a,0xd3));var _0xae49=function(_0x23e5d2,_0x415e7a){_0x23e5d2=_0x23e5d2-0x0;var _0x51ee49=_0xe49a[_0x23e5d2];return _0x51ee49;};'use strict';var _=require(_0xae49('0x0'));var util=require('util');var logger=require(_0xae49('0x1'))(_0xae49('0x2'));var moment=require('moment');var BPromise=require(_0xae49('0x3'));var rp=require(_0xae49('0x4'));var fs=require('fs');var path=require(_0xae49('0x5'));var rimraf=require(_0xae49('0x6'));var config=require(_0xae49('0x7'));var attributes=require(_0xae49('0x8'));module[_0xae49('0x9')]=function(_0x207557,_0x56fa61){return _0x207557[_0xae49('0xa')](_0xae49('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd91=['./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xcd91,0x185));var _0x1cd9=function(_0x124474,_0x35c8b4){_0x124474=_0x124474-0x0;var _0x266b33=_0xcd91[_0x124474];return _0x266b33;};'use strict';var _=require(_0x1cd9('0x0'));var util=require(_0x1cd9('0x1'));var logger=require(_0x1cd9('0x2'))(_0x1cd9('0x3'));var moment=require(_0x1cd9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1cd9('0x5'));var config=require(_0x1cd9('0x6'));var attributes=require(_0x1cd9('0x7'));module[_0x1cd9('0x8')]=function(_0x314d94,_0x4b90e4){return _0x314d94[_0x1cd9('0x9')]('ChatWebsite',attributes,{'tableName':_0x1cd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index bc35a5f..7137a75 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 _0x77ec=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4e15e8,_0x3544f4){var _0x1b9825=function(_0x670a90){while(--_0x670a90){_0x4e15e8['push'](_0x4e15e8['shift']());}};_0x1b9825(++_0x3544f4);}(_0x77ec,0x165));var _0xc77e=function(_0x201865,_0x6c9303){_0x201865=_0x201865-0x0;var _0x6146e4=_0x77ec[_0x201865];return _0x6146e4;};'use strict';var _=require(_0xc77e('0x0'));var util=require(_0xc77e('0x1'));var moment=require(_0xc77e('0x2'));var BPromise=require(_0xc77e('0x3'));var rs=require(_0xc77e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc77e('0x5'))['db'];var utils=require(_0xc77e('0x6'));var logger=require(_0xc77e('0x7'))(_0xc77e('0x8'));var config=require(_0xc77e('0x9'));var jayson=require(_0xc77e('0xa'));var client=jayson[_0xc77e('0xb')][_0xc77e('0xc')]({'port':0x232a});config[_0xc77e('0xd')]=_[_0xc77e('0xe')](config[_0xc77e('0xd')],{'host':_0xc77e('0xf'),'port':0x18eb});var socket=require(_0xc77e('0x10'))(new Redis(config['redis']));require(_0xc77e('0x11'))[_0xc77e('0x12')](socket);function respondWithRpcPromise(_0x2b09d9,_0x4f7301,_0x6e5a53){return new BPromise(function(_0x29801c,_0x452bb1){return client[_0xc77e('0x13')](_0x2b09d9,_0x6e5a53)['then'](function(_0x23600d){logger[_0xc77e('0x14')](_0xc77e('0x15'),_0x4f7301,_0xc77e('0x16'));logger[_0xc77e('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4f7301,_0xc77e('0x16'),JSON[_0xc77e('0x18')](_0x23600d));if(_0x23600d['error']){if(_0x23600d[_0xc77e('0x19')]['code']===0x1f4){logger[_0xc77e('0x19')](_0xc77e('0x15'),_0x4f7301,_0x23600d['error']['message']);return _0x452bb1(_0x23600d[_0xc77e('0x19')][_0xc77e('0x1a')]);}logger[_0xc77e('0x19')](_0xc77e('0x15'),_0x4f7301,_0x23600d['error'][_0xc77e('0x1a')]);return _0x29801c(_0x23600d[_0xc77e('0x19')][_0xc77e('0x1a')]);}else{logger[_0xc77e('0x14')](_0xc77e('0x15'),_0x4f7301,_0xc77e('0x16'));_0x29801c(_0x23600d[_0xc77e('0x1b')][_0xc77e('0x1a')]);}})['catch'](function(_0x13c05a){logger['error'](_0xc77e('0x15'),_0x4f7301,_0x13c05a);_0x452bb1(_0x13c05a);});});} \ No newline at end of file +var _0xe4d8=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x251dba,_0x2e2073){var _0x3e03f0=function(_0x35efd3){while(--_0x35efd3){_0x251dba['push'](_0x251dba['shift']());}};_0x3e03f0(++_0x2e2073);}(_0xe4d8,0xbc));var _0x8e4d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe4d8[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8e4d('0x0'));var util=require(_0x8e4d('0x1'));var moment=require(_0x8e4d('0x2'));var BPromise=require(_0x8e4d('0x3'));var rs=require(_0x8e4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e4d('0x5'))['db'];var utils=require(_0x8e4d('0x6'));var logger=require(_0x8e4d('0x7'))('rpc');var config=require(_0x8e4d('0x8'));var jayson=require(_0x8e4d('0x9'));var client=jayson[_0x8e4d('0xa')][_0x8e4d('0xb')]({'port':0x232a});config[_0x8e4d('0xc')]=_['defaults'](config['redis'],{'host':_0x8e4d('0xd'),'port':0x18eb});var socket=require(_0x8e4d('0xe'))(new Redis(config[_0x8e4d('0xc')]));require(_0x8e4d('0xf'))[_0x8e4d('0x10')](socket);function respondWithRpcPromise(_0x2c7370,_0x4a94a1,_0x1c371e){return new BPromise(function(_0x3fe389,_0x553c9e){return client[_0x8e4d('0x11')](_0x2c7370,_0x1c371e)[_0x8e4d('0x12')](function(_0x527bf1){logger[_0x8e4d('0x13')](_0x8e4d('0x14'),_0x4a94a1,'request\x20sent');logger['debug'](_0x8e4d('0x15'),_0x4a94a1,_0x8e4d('0x16'),JSON[_0x8e4d('0x17')](_0x527bf1));if(_0x527bf1[_0x8e4d('0x18')]){if(_0x527bf1['error'][_0x8e4d('0x19')]===0x1f4){logger[_0x8e4d('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x4a94a1,_0x527bf1[_0x8e4d('0x18')][_0x8e4d('0x1a')]);return _0x553c9e(_0x527bf1['error'][_0x8e4d('0x1a')]);}logger['error'](_0x8e4d('0x14'),_0x4a94a1,_0x527bf1[_0x8e4d('0x18')]['message']);return _0x3fe389(_0x527bf1[_0x8e4d('0x18')][_0x8e4d('0x1a')]);}else{logger['info'](_0x8e4d('0x14'),_0x4a94a1,_0x8e4d('0x16'));_0x3fe389(_0x527bf1['result'][_0x8e4d('0x1a')]);}})[_0x8e4d('0x1b')](function(_0x1dd2a){logger['error'](_0x8e4d('0x14'),_0x4a94a1,_0x1dd2a);_0x553c9e(_0x1dd2a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ef778e2..84dba0f 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 _0x76d7=['register','chatWebsite:','./chatWebsite.events','save','update','removeListener'];(function(_0xdf6837,_0x440887){var _0x254cfa=function(_0x3bcbc2){while(--_0x3bcbc2){_0xdf6837['push'](_0xdf6837['shift']());}};_0x254cfa(++_0x440887);}(_0x76d7,0x1e2));var _0x776d=function(_0x2bf156,_0x437254){_0x2bf156=_0x2bf156-0x0;var _0x346925=_0x76d7[_0x2bf156];return _0x346925;};'use strict';var ChatWebsiteEvents=require(_0x776d('0x0'));var events=[_0x776d('0x1'),'remove',_0x776d('0x2')];function createListener(_0x10eea6,_0x488f61){return function(_0x5f074b){_0x488f61['emit'](_0x10eea6,_0x5f074b);};}function removeListener(_0x11769d,_0x210224){return function(){ChatWebsiteEvents[_0x776d('0x3')](_0x11769d,_0x210224);};}exports[_0x776d('0x4')]=function(_0xb90ceb){for(var _0x1cdbee=0x0,_0x128e70=events['length'];_0x1cdbee<_0x128e70;_0x1cdbee++){var _0x3e5428=events[_0x1cdbee];var _0x5bedab=createListener(_0x776d('0x5')+_0x3e5428,_0xb90ceb);ChatWebsiteEvents['on'](_0x3e5428,_0x5bedab);}}; \ No newline at end of file +var _0x3955=['remove','update','removeListener','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x3955,0x178));var _0x5395=function(_0x22fcb5,_0x4434a1){_0x22fcb5=_0x22fcb5-0x0;var _0x326899=_0x3955[_0x22fcb5];return _0x326899;};'use strict';var ChatWebsiteEvents=require(_0x5395('0x0'));var events=[_0x5395('0x1'),_0x5395('0x2'),_0x5395('0x3')];function createListener(_0x378455,_0x1532f0){return function(_0x36c99e){_0x1532f0['emit'](_0x378455,_0x36c99e);};}function removeListener(_0x5777a7,_0x212a90){return function(){ChatWebsiteEvents[_0x5395('0x4')](_0x5777a7,_0x212a90);};}exports['register']=function(_0x24727f){for(var _0x3aa94c=0x0,_0x3d43eb=events[_0x5395('0x5')];_0x3aa94c<_0x3d43eb;_0x3aa94c++){var _0xed40ab=events[_0x3aa94c];var _0x255e73=createListener(_0x5395('0x6')+_0xed40ab,_0x24727f);ChatWebsiteEvents['on'](_0xed40ab,_0x255e73);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 4ad468d..2a06405 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 _0xf0c1=['/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getInteractions','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','file','server/files/images/avatars/','single','format','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline'];(function(_0x45ca21,_0x38e303){var _0x48c9ba=function(_0x3e157f){while(--_0x3e157f){_0x45ca21['push'](_0x45ca21['shift']());}};_0x48c9ba(++_0x38e303);}(_0xf0c1,0xe3));var _0x1f0c=function(_0x229d7e,_0x5bc489){_0x229d7e=_0x229d7e-0x0;var _0xa78280=_0xf0c1[_0x229d7e];return _0xa78280;};'use strict';var multer=require(_0x1f0c('0x0'));var util=require(_0x1f0c('0x1'));var path=require(_0x1f0c('0x2'));var timeout=require(_0x1f0c('0x3'));var express=require('express');var router=express[_0x1f0c('0x4')]();var fs_extra=require(_0x1f0c('0x5'));var auth=require(_0x1f0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f0c('0x7'));var controller=require(_0x1f0c('0x8'));router[_0x1f0c('0x9')]('/',auth[_0x1f0c('0xa')](),controller[_0x1f0c('0xb')]);router[_0x1f0c('0x9')](_0x1f0c('0xc'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0xd')]);router['get'](_0x1f0c('0xe'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0xf')]);router[_0x1f0c('0x9')](_0x1f0c('0x10'),auth['isAuthenticated'](),controller[_0x1f0c('0x11')]);router[_0x1f0c('0x9')](_0x1f0c('0x12'),auth[_0x1f0c('0xa')](),controller['getAnswers']);router['get'](_0x1f0c('0x13'),controller['getLogo']);router[_0x1f0c('0x9')](_0x1f0c('0x14'),controller[_0x1f0c('0x15')]);router['get'](_0x1f0c('0x16'),controller[_0x1f0c('0x17')]);router[_0x1f0c('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x1f0c('0x18')]);router[_0x1f0c('0x9')]('/:id/snippet',controller['getSnippet']);router[_0x1f0c('0x9')](_0x1f0c('0x19'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x1a')]);router[_0x1f0c('0x9')]('/:id/proactive_actions',auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x1b')]);router[_0x1f0c('0x9')](_0x1f0c('0x1c'),controller['getFields']);router[_0x1f0c('0x9')](_0x1f0c('0x1d'),auth['isAuthenticated'](),controller[_0x1f0c('0x1e')]);router['get'](_0x1f0c('0x1f'),auth[_0x1f0c('0xa')](),controller['getAgents']);router[_0x1f0c('0x20')]('/',auth[_0x1f0c('0xa')](),controller['create']);router[_0x1f0c('0x20')](_0x1f0c('0x10'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x21')]);router[_0x1f0c('0x20')]('/:id/canned_answers',auth[_0x1f0c('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x1f0c('0x22')]({'destination':function(_0x422d1e,_0x103a1c,_0x34efd9){_0x34efd9(null,path[_0x1f0c('0x23')](config[_0x1f0c('0x24')],_0x1f0c('0x25')));},'filename':function(_0x5a57c1,_0xd075f7,_0x56278c){_0x56278c(null,util['format'](_0x1f0c('0x26'),Date[_0x1f0c('0x27')](),_0xd075f7[_0x1f0c('0x28')]));}})});router[_0x1f0c('0x20')](_0x1f0c('0x13'),upload['single'](_0x1f0c('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x1f0c('0x22')]({'destination':function(_0x101119,_0x592526,_0x4737d4){_0x4737d4(null,path[_0x1f0c('0x23')](config[_0x1f0c('0x24')],_0x1f0c('0x2a')));},'filename':function(_0x216bb9,_0x3b4f33,_0x57fbeb){_0x57fbeb(null,util['format'](_0x1f0c('0x26'),Date['now'](),_0x3b4f33['originalname']));}})});router[_0x1f0c('0x20')](_0x1f0c('0x14'),upload[_0x1f0c('0x2b')](_0x1f0c('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1f0c('0x22')]({'destination':function(_0x2ec445,_0x150bf1,_0x3d91fc){_0x3d91fc(null,path[_0x1f0c('0x23')](config[_0x1f0c('0x24')],_0x1f0c('0x2a')));},'filename':function(_0x4013f4,_0x452041,_0x19d949){_0x19d949(null,util[_0x1f0c('0x2c')](_0x1f0c('0x26'),Date[_0x1f0c('0x27')](),_0x452041[_0x1f0c('0x28')]));}})});router[_0x1f0c('0x20')](_0x1f0c('0x16'),upload['single'](_0x1f0c('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x1f0c('0x22')]({'destination':function(_0x5dc25a,_0x5a987c,_0x23e378){_0x23e378(null,path[_0x1f0c('0x23')](config[_0x1f0c('0x24')],'server/files/images/avatars/'));},'filename':function(_0x3ffc58,_0x4114a3,_0x217fc1){_0x217fc1(null,util[_0x1f0c('0x2c')](_0x1f0c('0x26'),Date[_0x1f0c('0x27')](),_0x4114a3[_0x1f0c('0x28')]));}})});router['post']('/:id/system_avatar',upload[_0x1f0c('0x2b')](_0x1f0c('0x29')),controller[_0x1f0c('0x2d')]);router['post'](_0x1f0c('0x2e'),controller[_0x1f0c('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0x1f0c('0x22')]({'destination':function(_0x254f89,_0x57f953,_0x36948b){const _0x2ee038=path[_0x1f0c('0x23')](config[_0x1f0c('0x24')],_0x1f0c('0x30'),_0x1f0c('0x31'),_0x1f0c('0x32'));fs_extra[_0x1f0c('0x33')](_0x2ee038,function(){_0x36948b(null,_0x2ee038);});},'filename':function(_0x270c21,_0x5b66c5,_0x54e2ee){const _0x2481e9=_0x5b66c5['originalname'][_0x1f0c('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x483f44=path[_0x1f0c('0x35')](_0x2481e9);const _0x141dcf=Date['now']()+'-'+_0x2481e9[_0x1f0c('0x34')](_0x483f44,'')+_0x483f44;_0x54e2ee(null,_0x141dcf);}})});router[_0x1f0c('0x20')](_0x1f0c('0x36'),offlineUploadMulter[_0x1f0c('0x37')](),controller[_0x1f0c('0x38')]);router['post'](_0x1f0c('0x39'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x3a')]);router[_0x1f0c('0x20')](_0x1f0c('0x19'),auth['isAuthenticated'](),controller[_0x1f0c('0x3b')]);router[_0x1f0c('0x20')](_0x1f0c('0x3c'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x3d')]);router['post']('/:id/users',auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x3e')]);router[_0x1f0c('0x3f')](_0x1f0c('0xe'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x40')]);router['delete'](_0x1f0c('0xe'),auth['isAuthenticated'](),controller[_0x1f0c('0x41')]);router[_0x1f0c('0x42')](_0x1f0c('0x10'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x43')]);router[_0x1f0c('0x42')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1f0c('0x44')]);router['delete'](_0x1f0c('0x1f'),auth[_0x1f0c('0xa')](),controller[_0x1f0c('0x45')]);module[_0x1f0c('0x46')]=router; \ No newline at end of file +var _0x1bb1=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','file','addLogo','originalname','/:id/avatar','single','addAvatar','join','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x2b872,_0x4a3d29){var _0xd2425c=function(_0x439eff){while(--_0x439eff){_0x2b872['push'](_0x2b872['shift']());}};_0xd2425c(++_0x4a3d29);}(_0x1bb1,0x113));var _0x11bb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bb1[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x11bb('0x0'));var util=require('util');var path=require(_0x11bb('0x1'));var timeout=require(_0x11bb('0x2'));var express=require(_0x11bb('0x3'));var router=express[_0x11bb('0x4')]();var fs_extra=require(_0x11bb('0x5'));var auth=require(_0x11bb('0x6'));var interaction=require(_0x11bb('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x11bb('0x8')]('/',auth[_0x11bb('0x9')](),controller[_0x11bb('0xa')]);router[_0x11bb('0x8')](_0x11bb('0xb'),auth[_0x11bb('0x9')](),controller[_0x11bb('0xc')]);router['get'](_0x11bb('0xd'),auth['isAuthenticated'](),controller[_0x11bb('0xe')]);router[_0x11bb('0x8')](_0x11bb('0xf'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x10')]);router[_0x11bb('0x8')](_0x11bb('0x11'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x12')]);router['get'](_0x11bb('0x13'),controller['getLogo']);router[_0x11bb('0x8')]('/:id/avatar',controller[_0x11bb('0x14')]);router[_0x11bb('0x8')](_0x11bb('0x15'),controller[_0x11bb('0x16')]);router[_0x11bb('0x8')](_0x11bb('0x17'),controller[_0x11bb('0x18')]);router['get'](_0x11bb('0x19'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x1a')]);router['get'](_0x11bb('0x1b'),controller[_0x11bb('0x1c')]);router[_0x11bb('0x8')](_0x11bb('0x1d'),auth[_0x11bb('0x9')](),controller['getApplications']);router[_0x11bb('0x8')](_0x11bb('0x1e'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x1f')]);router['get'](_0x11bb('0x20'),controller['getFields']);router[_0x11bb('0x8')](_0x11bb('0x21'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x22')]);router[_0x11bb('0x8')]('/:id/users',auth[_0x11bb('0x9')](),controller['getAgents']);router[_0x11bb('0x23')]('/',auth[_0x11bb('0x9')](),controller['create']);router[_0x11bb('0x23')](_0x11bb('0xf'),auth['isAuthenticated'](),controller[_0x11bb('0x24')]);router[_0x11bb('0x23')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x11bb('0x25')]);var upload=multer({'storage':multer[_0x11bb('0x26')]({'destination':function(_0x407567,_0x249610,_0x391299){_0x391299(null,path['join'](config[_0x11bb('0x27')],_0x11bb('0x28')));},'filename':function(_0xb6903d,_0x1850dd,_0x18afdc){_0x18afdc(null,util[_0x11bb('0x29')](_0x11bb('0x2a'),Date[_0x11bb('0x2b')](),_0x1850dd['originalname']));}})});router[_0x11bb('0x23')](_0x11bb('0x13'),upload['single'](_0x11bb('0x2c')),controller[_0x11bb('0x2d')]);var upload=multer({'storage':multer[_0x11bb('0x26')]({'destination':function(_0xbe3af9,_0x3da1c7,_0x20f9d9){_0x20f9d9(null,path['join'](config[_0x11bb('0x27')],'server/files/images/avatars/'));},'filename':function(_0x4ba955,_0x53457f,_0x21c810){_0x21c810(null,util[_0x11bb('0x29')]('%s-%s',Date[_0x11bb('0x2b')](),_0x53457f[_0x11bb('0x2e')]));}})});router[_0x11bb('0x23')](_0x11bb('0x2f'),upload[_0x11bb('0x30')](_0x11bb('0x2c')),controller[_0x11bb('0x31')]);var upload=multer({'storage':multer[_0x11bb('0x26')]({'destination':function(_0x443674,_0x6c277d,_0x471a2f){_0x471a2f(null,path[_0x11bb('0x32')](config[_0x11bb('0x27')],_0x11bb('0x33')));},'filename':function(_0x5120bf,_0xb05138,_0xa9872d){_0xa9872d(null,util[_0x11bb('0x29')](_0x11bb('0x2a'),Date[_0x11bb('0x2b')](),_0xb05138['originalname']));}})});router[_0x11bb('0x23')](_0x11bb('0x15'),upload[_0x11bb('0x30')](_0x11bb('0x2c')),controller[_0x11bb('0x34')]);var upload=multer({'storage':multer[_0x11bb('0x26')]({'destination':function(_0xbaafec,_0x27b30d,_0x5ecba2){_0x5ecba2(null,path[_0x11bb('0x32')](config[_0x11bb('0x27')],'server/files/images/avatars/'));},'filename':function(_0x5c4774,_0x5ef523,_0x14bf50){_0x14bf50(null,util[_0x11bb('0x29')](_0x11bb('0x2a'),Date[_0x11bb('0x2b')](),_0x5ef523[_0x11bb('0x2e')]));}})});router[_0x11bb('0x23')](_0x11bb('0x17'),upload['single'](_0x11bb('0x2c')),controller[_0x11bb('0x35')]);router[_0x11bb('0x23')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x11bb('0x26')]({'destination':function(_0x1d81a9,_0x4efb55,_0x44add2){const _0x12f895=path[_0x11bb('0x32')](config[_0x11bb('0x27')],_0x11bb('0x36'),_0x11bb('0x37'),_0x11bb('0x38'));fs_extra[_0x11bb('0x39')](_0x12f895,function(){_0x44add2(null,_0x12f895);});},'filename':function(_0x1d267b,_0x1675df,_0x25b8a4){const _0x4246dd=_0x1675df[_0x11bb('0x2e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3734bf=path[_0x11bb('0x3a')](_0x4246dd);const _0x49cf13=Date[_0x11bb('0x2b')]()+'-'+_0x4246dd[_0x11bb('0x3b')](_0x3734bf,'')+_0x3734bf;_0x25b8a4(null,_0x49cf13);}})});router['post'](_0x11bb('0x3c'),offlineUploadMulter[_0x11bb('0x3d')](),controller[_0x11bb('0x3e')]);router[_0x11bb('0x23')](_0x11bb('0x19'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x3f')]);router[_0x11bb('0x23')]('/:id/applications',auth['isAuthenticated'](),controller[_0x11bb('0x40')]);router[_0x11bb('0x23')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x11bb('0x23')](_0x11bb('0x41'),auth['isAuthenticated'](),controller[_0x11bb('0x42')]);router[_0x11bb('0x43')](_0x11bb('0xd'),auth[_0x11bb('0x9')](),controller['update']);router[_0x11bb('0x44')](_0x11bb('0xd'),auth[_0x11bb('0x9')](),controller[_0x11bb('0x45')]);router[_0x11bb('0x44')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x11bb('0x46')]);router['delete'](_0x11bb('0x11'),auth[_0x11bb('0x9')](),controller['removeAnswers']);router[_0x11bb('0x44')]('/:id/users',auth[_0x11bb('0x9')](),controller[_0x11bb('0x47')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index cd815eb..21d1a2e 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 _0x83d0=['ENUM','AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x133e2a,_0x3f75c4){var _0x121ad7=function(_0x12fa2f){while(--_0x12fa2f){_0x133e2a['push'](_0x133e2a['shift']());}};_0x121ad7(++_0x3f75c4);}(_0x83d0,0xb7));var _0x083d=function(_0x2c84af,_0x18f100){_0x2c84af=_0x2c84af-0x0;var _0x56bb4a=_0x83d0[_0x2c84af];return _0x56bb4a;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize[_0x083d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x083d('0x3')](_0x083d('0x4'),_0x083d('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x083d('0x2')]}}; \ No newline at end of file +var _0x6c14=['exports','STRING','ENUM','AmazonAWS','sequelize'];(function(_0x3fe064,_0x29b179){var _0x1a1d87=function(_0x56d8d0){while(--_0x56d8d0){_0x3fe064['push'](_0x3fe064['shift']());}};_0x1a1d87(++_0x29b179);}(_0x6c14,0xd1));var _0x46c1=function(_0x5bb514,_0x94fd17){_0x5bb514=_0x5bb514-0x0;var _0x31cf7f=_0x6c14[_0x5bb514];return _0x31cf7f;};'use strict';var Sequelize=require(_0x46c1('0x0'));module[_0x46c1('0x1')]={'name':{'type':Sequelize[_0x46c1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x46c1('0x3')](_0x46c1('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x46c1('0x2')]},'data2':{'type':Sequelize[_0x46c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6a06d01..6cda0dd 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x26d02a,_0x592533){var _0x4419aa=function(_0x406898){while(--_0x406898){_0x26d02a['push'](_0x26d02a['shift']());}};_0x4419aa(++_0x592533);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c5ad6,_0x47b7bf){_0x3c5ad6=_0x3c5ad6-0x0;var _0x3154f2=_0x0b0e[_0x3c5ad6];return _0x3154f2;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38b634,_0x4948a4){_0x38b634=_0x38b634-0x0;var _0x3b43dc=_0x5f2f[_0x38b634];return _0x3b43dc;};'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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3f323bd..ef8fe22 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 _0xb99c=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider'];(function(_0x244532,_0x1bcae7){var _0x4c8035=function(_0x42afc0){while(--_0x42afc0){_0x244532['push'](_0x244532['shift']());}};_0x4c8035(++_0x1bcae7);}(_0xb99c,0x1ce));var _0xcb99=function(_0x18e639,_0x56b853){_0x18e639=_0x18e639-0x0;var _0x15636a=_0xb99c[_0x18e639];return _0x15636a;};'use strict';var _=require(_0xcb99('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcb99('0x1'));var moment=require(_0xcb99('0x2'));var BPromise=require(_0xcb99('0x3'));var rp=require(_0xcb99('0x4'));var fs=require('fs');var path=require(_0xcb99('0x5'));var rimraf=require(_0xcb99('0x6'));var config=require(_0xcb99('0x7'));var attributes=require(_0xcb99('0x8'));module[_0xcb99('0x9')]=function(_0x3acfa6,_0x21dd95){return _0x3acfa6['define'](_0xcb99('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3cd=['../../config/environment','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3e0135,_0x342171){var _0x4c0ef9=function(_0x519244){while(--_0x519244){_0x3e0135['push'](_0x3e0135['shift']());}};_0x4c0ef9(++_0x342171);}(_0xd3cd,0x19b));var _0xdd3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3cd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdd3c('0x0'));var util=require('util');var logger=require(_0xdd3c('0x1'))(_0xdd3c('0x2'));var moment=require(_0xdd3c('0x3'));var BPromise=require(_0xdd3c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd3c('0x5'));var rimraf=require(_0xdd3c('0x6'));var config=require(_0xdd3c('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x1c93ca,_0x319d4e){return _0x1c93ca[_0xdd3c('0x8')](_0xdd3c('0x9'),attributes,{'tableName':_0xdd3c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index e179803..c89c232 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 _0x3266=['../../config/environment','client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x3266,0x6a));var _0x6326=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x3266[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14208e,_0x5402e5,_0x161f4e){return new BPromise(function(_0x5730e7,_0x2af571){return client[_0x6326('0xc')](_0x14208e,_0x161f4e)[_0x6326('0xd')](function(_0x1aee60){logger[_0x6326('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5402e5,_0x6326('0xf'));logger[_0x6326('0x10')](_0x6326('0x11'),_0x5402e5,_0x6326('0xf'),JSON[_0x6326('0x12')](_0x1aee60));if(_0x1aee60[_0x6326('0x13')]){if(_0x1aee60[_0x6326('0x13')][_0x6326('0x14')]===0x1f4){logger[_0x6326('0x13')](_0x6326('0x15'),_0x5402e5,_0x1aee60['error']['message']);return _0x2af571(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}logger['error'](_0x6326('0x15'),_0x5402e5,_0x1aee60['error'][_0x6326('0x16')]);return _0x5730e7(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}else{logger[_0x6326('0xe')](_0x6326('0x15'),_0x5402e5,_0x6326('0xf'));_0x5730e7(_0x1aee60['result'][_0x6326('0x16')]);}})['catch'](function(_0x5945ee){logger['error']('CloudProvider,\x20%s,\x20%s',_0x5402e5,_0x5945ee);_0x2af571(_0x5945ee);});});} \ No newline at end of file +var _0xc23d=['stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xc23d,0x7f));var _0xdc23=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xc23d[_0x52ea08];return _0x28d546;};'use strict';var _=require(_0xdc23('0x0'));var util=require(_0xdc23('0x1'));var moment=require(_0xdc23('0x2'));var BPromise=require(_0xdc23('0x3'));var rs=require(_0xdc23('0x4'));var fs=require('fs');var Redis=require(_0xdc23('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc23('0x6'));var logger=require(_0xdc23('0x7'))(_0xdc23('0x8'));var config=require(_0xdc23('0x9'));var jayson=require(_0xdc23('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17cb48,_0x47c9cd,_0x2a5303){return new BPromise(function(_0x4d16cf,_0x459f6d){return client[_0xdc23('0xb')](_0x17cb48,_0x2a5303)[_0xdc23('0xc')](function(_0x43ba94){logger[_0xdc23('0xd')]('CloudProvider,\x20%s,\x20%s',_0x47c9cd,_0xdc23('0xe'));logger[_0xdc23('0xf')](_0xdc23('0x10'),_0x47c9cd,_0xdc23('0xe'),JSON[_0xdc23('0x11')](_0x43ba94));if(_0x43ba94[_0xdc23('0x12')]){if(_0x43ba94['error'][_0xdc23('0x13')]===0x1f4){logger[_0xdc23('0x12')](_0xdc23('0x14'),_0x47c9cd,_0x43ba94[_0xdc23('0x12')]['message']);return _0x459f6d(_0x43ba94[_0xdc23('0x12')][_0xdc23('0x15')]);}logger[_0xdc23('0x12')](_0xdc23('0x14'),_0x47c9cd,_0x43ba94[_0xdc23('0x12')][_0xdc23('0x15')]);return _0x4d16cf(_0x43ba94['error'][_0xdc23('0x15')]);}else{logger['info'](_0xdc23('0x14'),_0x47c9cd,_0xdc23('0xe'));_0x4d16cf(_0x43ba94[_0xdc23('0x16')]['message']);}})[_0xdc23('0x17')](function(_0x476654){logger[_0xdc23('0x12')](_0xdc23('0x14'),_0x47c9cd,_0x476654);_0x459f6d(_0x476654);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2d68ede..eef87c3 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 _0x7f43=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x371827,_0x26730f){var _0x5da100=function(_0x304fc3){while(--_0x304fc3){_0x371827['push'](_0x371827['shift']());}};_0x5da100(++_0x26730f);}(_0x7f43,0x1a0));var _0x37f4=function(_0x224566,_0x8c2f2d){_0x224566=_0x224566-0x0;var _0x12f2b1=_0x7f43[_0x224566];return _0x12f2b1;};'use strict';var multer=require(_0x37f4('0x0'));var util=require(_0x37f4('0x1'));var path=require(_0x37f4('0x2'));var timeout=require(_0x37f4('0x3'));var express=require('express');var router=express[_0x37f4('0x4')]();var fs_extra=require(_0x37f4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x37f4('0x6'));var config=require('../../config/environment');var controller=require(_0x37f4('0x7'));router['get']('/',auth[_0x37f4('0x8')](),controller[_0x37f4('0x9')]);router[_0x37f4('0xa')](_0x37f4('0xb'),auth[_0x37f4('0x8')](),controller[_0x37f4('0xc')]);router[_0x37f4('0xd')]('/',auth[_0x37f4('0x8')](),controller['create']);router[_0x37f4('0xe')](_0x37f4('0xb'),auth[_0x37f4('0x8')](),controller[_0x37f4('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x37f4('0x10')]);module[_0x37f4('0x11')]=router; \ No newline at end of file +var _0xbd6b=['index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','isAuthenticated'];(function(_0xbe5c92,_0x2b5f70){var _0x584597=function(_0x2376f1){while(--_0x2376f1){_0xbe5c92['push'](_0xbe5c92['shift']());}};_0x584597(++_0x2b5f70);}(_0xbd6b,0x1ad));var _0xbbd6=function(_0x1dcd38,_0x4199d0){_0x1dcd38=_0x1dcd38-0x0;var _0x5743c2=_0xbd6b[_0x1dcd38];return _0x5743c2;};'use strict';var multer=require(_0xbbd6('0x0'));var util=require('util');var path=require(_0xbbd6('0x1'));var timeout=require(_0xbbd6('0x2'));var express=require(_0xbbd6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbd6('0x4'));var interaction=require(_0xbbd6('0x5'));var config=require('../../config/environment');var controller=require(_0xbbd6('0x6'));router['get']('/',auth[_0xbbd6('0x7')](),controller[_0xbbd6('0x8')]);router[_0xbbd6('0x9')](_0xbbd6('0xa'),auth['isAuthenticated'](),controller[_0xbbd6('0xb')]);router[_0xbbd6('0xc')]('/',auth[_0xbbd6('0x7')](),controller[_0xbbd6('0xd')]);router[_0xbbd6('0xe')]('/:id',auth[_0xbbd6('0x7')](),controller[_0xbbd6('0xf')]);router[_0xbbd6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbbd6('0x11')]);module[_0xbbd6('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8608551..d5e3f46 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 _0xc1fa=['name','STRING'];(function(_0x39fbbc,_0x9d36ab){var _0x1c171d=function(_0x2d00e7){while(--_0x2d00e7){_0x39fbbc['push'](_0x39fbbc['shift']());}};_0x1c171d(++_0x9d36ab);}(_0xc1fa,0xe5));var _0xac1f=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xc1fa[_0x5d30b4];return _0x1acfb8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xac1f('0x0')],'unique':_0xac1f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xac1f('0x0')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xac1f('0x0')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xac1f('0x0')]},'type':{'type':Sequelize[_0xac1f('0x0')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xac1f('0x0')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xac1f('0x0')]},'email':{'type':Sequelize[_0xac1f('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xac1f('0x0')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xac1f('0x0')]},'sCountry':{'type':Sequelize[_0xac1f('0x0')]},'description':{'type':Sequelize[_0xac1f('0x0')]}}; \ No newline at end of file +var _0xcef4=['STRING','sequelize'];(function(_0x5497ba,_0x218490){var _0x355659=function(_0x48a31b){while(--_0x48a31b){_0x5497ba['push'](_0x5497ba['shift']());}};_0x355659(++_0x218490);}(_0xcef4,0x1e9));var _0x4cef=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xcef4[_0x34d346];return _0x122d76;};'use strict';var Sequelize=require(_0x4cef('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x4cef('0x1')]},'website':{'type':Sequelize[_0x4cef('0x1')]},'phone':{'type':Sequelize[_0x4cef('0x1')]},'fax':{'type':Sequelize[_0x4cef('0x1')]},'type':{'type':Sequelize[_0x4cef('0x1')]},'street':{'type':Sequelize[_0x4cef('0x1')]},'postalCode':{'type':Sequelize[_0x4cef('0x1')]},'city':{'type':Sequelize[_0x4cef('0x1')]},'country':{'type':Sequelize[_0x4cef('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x4cef('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4cef('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0fcabb8..3670141 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 _0x787a=['rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','send','CmCompany','describe','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','find','userProfileId','autoAssociation','addContacts','ids','getContacts','findOne','CmContact','rawAttributes','length','map'];(function(_0x2d285a,_0x3404d6){var _0x438199=function(_0x113299){while(--_0x113299){_0x2d285a['push'](_0x2d285a['shift']());}};_0x438199(++_0x3404d6);}(_0x787a,0x160));var _0xa787=function(_0x8d0e1d,_0x13517d){_0x8d0e1d=_0x8d0e1d-0x0;var _0x2e38ec=_0x787a[_0x8d0e1d];return _0x2e38ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa787('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa787('0x1'));var rp=require('request-promise');var moment=require(_0xa787('0x2'));var BPromise=require(_0xa787('0x3'));var Mustache=require('mustache');var util=require(_0xa787('0x4'));var path=require(_0xa787('0x5'));var sox=require(_0xa787('0x6'));var csv=require(_0xa787('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa787('0x8'));var _=require(_0xa787('0x9'));var squel=require(_0xa787('0xa'));var crypto=require(_0xa787('0xb'));var jsforce=require(_0xa787('0xc'));var deskjs=require(_0xa787('0xd'));var toCsv=require(_0xa787('0x7'));var querystring=require('querystring');var Papa=require(_0xa787('0xe'));var Redis=require(_0xa787('0xf'));var authService=require(_0xa787('0x10'));var qs=require(_0xa787('0x11'));var as=require(_0xa787('0x12'));var hardwareService=require(_0xa787('0x13'));var logger=require(_0xa787('0x14'))(_0xa787('0x15'));var utils=require(_0xa787('0x16'));var config=require(_0xa787('0x17'));var licenseUtil=require(_0xa787('0x18'));var db=require(_0xa787('0x19'))['db'];function respondWithStatusCode(_0x473a3f,_0xd0bd70){_0xd0bd70=_0xd0bd70||0xcc;return function(_0x295355){if(_0x295355){return _0x473a3f[_0xa787('0x1a')](_0xd0bd70);}return _0x473a3f[_0xa787('0x1b')](_0xd0bd70)[_0xa787('0x1c')]();};}function respondWithResult(_0x5ed011,_0x5ecedd){_0x5ecedd=_0x5ecedd||0xc8;return function(_0x24faa5){if(_0x24faa5){return _0x5ed011[_0xa787('0x1b')](_0x5ecedd)[_0xa787('0x1d')](_0x24faa5);}};}function respondWithFilteredResult(_0x1ebdc6,_0x46e914){return function(_0x262f87){if(_0x262f87){var _0x389fa5=typeof _0x46e914[_0xa787('0x1e')]==='undefined'&&typeof _0x46e914[_0xa787('0x1f')]===_0xa787('0x20');var _0x37c4b1=_0x262f87[_0xa787('0x21')];var _0x6de1f8=_0x389fa5?0x0:_0x46e914['offset'];var _0x44257d=_0x389fa5?_0x262f87[_0xa787('0x21')]:_0x46e914[_0xa787('0x1e')]+_0x46e914[_0xa787('0x1f')];var _0x4c5a98;if(_0x44257d>=_0x37c4b1){_0x44257d=_0x37c4b1;_0x4c5a98=0xc8;}else{_0x4c5a98=0xce;}_0x1ebdc6[_0xa787('0x1b')](_0x4c5a98);return _0x1ebdc6[_0xa787('0x22')](_0xa787('0x23'),_0x6de1f8+'-'+_0x44257d+'/'+_0x37c4b1)['json'](_0x262f87);}return null;};}function patchUpdates(_0x5d394a){return function(_0x457a5c){try{jsonpatch[_0xa787('0x24')](_0x457a5c,_0x5d394a,!![]);}catch(_0x709d00){return BPromise[_0xa787('0x25')](_0x709d00);}return _0x457a5c[_0xa787('0x26')]();};}function saveUpdates(_0x278dc2,_0x4e659c){return function(_0x23028a){if(_0x23028a){return _0x23028a['update'](_0x278dc2)['then'](function(_0xb0b458){return _0xb0b458;});}return null;};}function removeEntity(_0x1cbfd9,_0x3a76d6){return function(_0xbc8555){if(_0xbc8555){return _0xbc8555[_0xa787('0x27')]()[_0xa787('0x28')](function(){var _0x4cf7e5=_0xbc8555[_0xa787('0x29')]({'plain':!![]});var _0x2bf86e='Companies';return db[_0xa787('0x2a')][_0xa787('0x27')]({'where':{'type':_0x2bf86e,'resourceId':_0x4cf7e5['id']}})[_0xa787('0x28')](function(){return _0xbc8555;});})['then'](function(){_0x1cbfd9[_0xa787('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x343727,_0x3ec824){return function(_0x31a28e){if(!_0x31a28e){_0x343727[_0xa787('0x1a')](0x194);}return _0x31a28e;};}function handleError(_0x137b6d,_0x4e6e3c){_0x4e6e3c=_0x4e6e3c||0x1f4;return function(_0x41be3e){logger[_0xa787('0x2b')](_0x41be3e[_0xa787('0x2c')]);if(_0x41be3e[_0xa787('0x2d')]){delete _0x41be3e[_0xa787('0x2d')];}_0x137b6d['status'](_0x4e6e3c)[_0xa787('0x2e')](_0x41be3e);};}exports['index']=function(_0x2a4df6,_0x597c43){var _0x5a2f1c={},_0x58b8b4={},_0x3defeb={'count':0x0,'rows':[]};return db[_0xa787('0x2f')][_0xa787('0x30')]()['then'](function(_0x174c6d){_0x58b8b4[_0xa787('0x31')]=_['keys'](_0x174c6d);_0x58b8b4[_0xa787('0x32')]=_[_0xa787('0x33')](_0x2a4df6[_0xa787('0x32')]);_0x58b8b4['filters']=_[_0xa787('0x34')](_0x58b8b4[_0xa787('0x31')],_0x58b8b4[_0xa787('0x32')]);_0x5a2f1c['attributes']=_[_0xa787('0x34')](_0x58b8b4[_0xa787('0x31')],qs[_0xa787('0x35')](_0x2a4df6[_0xa787('0x32')][_0xa787('0x35')]));_0x5a2f1c[_0xa787('0x36')]=_0x5a2f1c['attributes']['length']?_0x5a2f1c['attributes']:_0x58b8b4[_0xa787('0x31')];if(!_0x2a4df6[_0xa787('0x32')][_0xa787('0x37')](_0xa787('0x38'))){_0x5a2f1c[_0xa787('0x1f')]=qs['limit'](_0x2a4df6[_0xa787('0x32')][_0xa787('0x1f')]);_0x5a2f1c['offset']=qs[_0xa787('0x1e')](_0x2a4df6[_0xa787('0x32')]['offset']);}_0x5a2f1c[_0xa787('0x39')]=qs[_0xa787('0x3a')](_0x2a4df6[_0xa787('0x32')][_0xa787('0x3a')]);_0x5a2f1c[_0xa787('0x3b')]=qs[_0xa787('0x3c')](_[_0xa787('0x3d')](_0x2a4df6[_0xa787('0x32')],_0x58b8b4[_0xa787('0x3c')]),_0x174c6d);if(_0x2a4df6[_0xa787('0x32')]['filter']){_0x5a2f1c[_0xa787('0x3b')]=_[_0xa787('0x3e')](_0x5a2f1c[_0xa787('0x3b')],{'$or':_['map'](_0x5a2f1c['attributes'],function(_0x48e131){var _0x1a1bbb={};_0x1a1bbb[_0x48e131]={'$like':'%'+_0x2a4df6[_0xa787('0x32')][_0xa787('0x3f')]+'%'};return _0x1a1bbb;})});}_0x5a2f1c=_[_0xa787('0x3e')]({},_0x5a2f1c,_0x2a4df6[_0xa787('0x40')]);var _0x51d3a4={'where':_0x5a2f1c[_0xa787('0x3b')]};return db[_0xa787('0x2f')][_0xa787('0x21')](_0x51d3a4)[_0xa787('0x28')](function(_0x3b1d00){_0x3defeb[_0xa787('0x21')]=_0x3b1d00;if(_0x2a4df6['query'][_0xa787('0x41')]){_0x5a2f1c[_0xa787('0x42')]=[{'all':!![]}];}return db[_0xa787('0x2f')][_0xa787('0x43')](_0x5a2f1c);})['then'](function(_0x4948ae){_0x3defeb['rows']=_0x4948ae;return _0x3defeb;})[_0xa787('0x28')](respondWithFilteredResult(_0x597c43,_0x5a2f1c))['catch'](handleError(_0x597c43,null));})[_0xa787('0x44')](handleError(_0x597c43,null));};exports[_0xa787('0x45')]=function(_0x50dcea,_0x122a95){var _0x32155c={'raw':![],'where':{'id':_0x50dcea[_0xa787('0x46')]['id']}},_0x4921e4={};_0x4921e4[_0xa787('0x31')]=_[_0xa787('0x33')](db['CmCompany']['rawAttributes']);_0x4921e4['query']=_[_0xa787('0x33')](_0x50dcea[_0xa787('0x32')]);_0x4921e4[_0xa787('0x3c')]=_[_0xa787('0x34')](_0x4921e4[_0xa787('0x31')],_0x4921e4[_0xa787('0x32')]);_0x32155c[_0xa787('0x36')]=_[_0xa787('0x34')](_0x4921e4[_0xa787('0x31')],qs[_0xa787('0x35')](_0x50dcea['query']['fields']));_0x32155c[_0xa787('0x36')]=_0x32155c[_0xa787('0x36')]['length']?_0x32155c[_0xa787('0x36')]:_0x4921e4[_0xa787('0x31')];if(_0x50dcea['query'][_0xa787('0x41')]){_0x32155c[_0xa787('0x42')]=[{'all':!![]}];}_0x32155c=_['merge']({},_0x32155c,_0x50dcea['options']);return db[_0xa787('0x2f')]['find'](_0x32155c)[_0xa787('0x28')](handleEntityNotFound(_0x122a95,null))[_0xa787('0x28')](respondWithResult(_0x122a95,null))[_0xa787('0x44')](handleError(_0x122a95,null));};exports[_0xa787('0x47')]=function(_0x3bb8b1,_0x1a61ac){return db[_0xa787('0x2f')][_0xa787('0x47')](_0x3bb8b1[_0xa787('0x48')],{})['then'](function(_0x306e24){var _0x1adb73=_0x3bb8b1[_0xa787('0x49')][_0xa787('0x29')]({'plain':!![]});if(!_0x1adb73)throw new Error(_0xa787('0x4a'));if(_0x1adb73['role']==='user'){var _0x44d668=_0x306e24[_0xa787('0x29')]({'plain':!![]});var _0x263f79=_0xa787('0x4b');return db[_0xa787('0x4c')][_0xa787('0x4d')]({'where':{'name':_0x263f79,'userProfileId':_0x1adb73[_0xa787('0x4e')]},'raw':!![]})[_0xa787('0x28')](function(_0x1ab47f){if(_0x1ab47f&&_0x1ab47f[_0xa787('0x4f')]===0x0){return db[_0xa787('0x2a')][_0xa787('0x47')]({'name':_0x44d668[_0xa787('0x2d')],'resourceId':_0x44d668['id'],'type':_0x1ab47f[_0xa787('0x2d')],'sectionId':_0x1ab47f['id']},{})[_0xa787('0x28')](function(){return _0x306e24;});}else{return _0x306e24;}})[_0xa787('0x44')](function(_0x43aedd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43aedd);throw _0x43aedd;});}return _0x306e24;})[_0xa787('0x28')](respondWithResult(_0x1a61ac,0xc9))[_0xa787('0x44')](handleError(_0x1a61ac,null));};exports['update']=function(_0x434b2d,_0x139fe8){if(_0x434b2d[_0xa787('0x48')]['id']){delete _0x434b2d[_0xa787('0x48')]['id'];}return db[_0xa787('0x2f')]['find']({'where':{'id':_0x434b2d[_0xa787('0x46')]['id']}})[_0xa787('0x28')](handleEntityNotFound(_0x139fe8,null))['then'](saveUpdates(_0x434b2d['body'],null))[_0xa787('0x28')](respondWithResult(_0x139fe8,null))[_0xa787('0x44')](handleError(_0x139fe8,null));};exports[_0xa787('0x27')]=function(_0x38c2ad,_0x6daf24){return db[_0xa787('0x2f')]['find']({'where':{'id':_0x38c2ad[_0xa787('0x46')]['id']}})[_0xa787('0x28')](handleEntityNotFound(_0x6daf24,null))[_0xa787('0x28')](removeEntity(_0x6daf24,null))['catch'](handleError(_0x6daf24,null));};exports[_0xa787('0x30')]=function(_0x3cf691,_0x139629){return db[_0xa787('0x2f')][_0xa787('0x30')]()[_0xa787('0x28')](respondWithResult(_0x139629,null))['catch'](handleError(_0x139629,null));};exports[_0xa787('0x50')]=function(_0x117488,_0x4027ec,_0x3be8ed){return db['CmContact'][_0xa787('0x4d')]({'where':{'id':_0x117488[_0xa787('0x46')]['id']}})[_0xa787('0x28')](handleEntityNotFound(_0x4027ec,null))['then'](function(_0x5287a8){if(_0x5287a8){return _0x5287a8['addContacts'](_0x117488[_0xa787('0x48')]['ids'],_['omit'](_0x117488[_0xa787('0x48')],[_0xa787('0x51'),'id'])||{});}})['then'](respondWithResult(_0x4027ec,null))[_0xa787('0x44')](handleError(_0x4027ec,null));};exports[_0xa787('0x52')]=function(_0x57676f,_0xce7c0,_0x1ebecf){var _0x441cc6={};var _0x4e56e2={};var _0x4441ca;var _0x36dcf4;return db['CmCompany'][_0xa787('0x53')]({'where':{'id':_0x57676f[_0xa787('0x46')]['id']}})[_0xa787('0x28')](handleEntityNotFound(_0xce7c0,null))[_0xa787('0x28')](function(_0x2895f4){if(_0x2895f4){_0x4441ca=_0x2895f4;_0x4e56e2[_0xa787('0x31')]=_[_0xa787('0x33')](db[_0xa787('0x54')][_0xa787('0x55')]);_0x4e56e2[_0xa787('0x32')]=_['keys'](_0x57676f[_0xa787('0x32')]);_0x4e56e2['filters']=_['intersection'](_0x4e56e2['model'],_0x4e56e2[_0xa787('0x32')]);_0x441cc6[_0xa787('0x36')]=_[_0xa787('0x34')](_0x4e56e2[_0xa787('0x31')],qs[_0xa787('0x35')](_0x57676f[_0xa787('0x32')][_0xa787('0x35')]));_0x441cc6['attributes']=_0x441cc6[_0xa787('0x36')][_0xa787('0x56')]?_0x441cc6['attributes']:_0x4e56e2[_0xa787('0x31')];_0x441cc6[_0xa787('0x39')]=qs[_0xa787('0x3a')](_0x57676f[_0xa787('0x32')]['sort']);_0x441cc6[_0xa787('0x3b')]=qs[_0xa787('0x3c')](_['pick'](_0x57676f[_0xa787('0x32')],_0x4e56e2['filters']));if(_0x57676f[_0xa787('0x32')]['filter']){_0x441cc6['where']=_[_0xa787('0x3e')](_0x441cc6['where'],{'$or':_[_0xa787('0x57')](_0x441cc6[_0xa787('0x36')],function(_0x51256b){var _0x20ce51={};_0x20ce51[_0x51256b]={'$like':'%'+_0x57676f[_0xa787('0x32')][_0xa787('0x3f')]+'%'};return _0x20ce51;})});}_0x441cc6=_[_0xa787('0x3e')]({},_0x441cc6,_0x57676f[_0xa787('0x40')]);return _0x4441ca[_0xa787('0x52')](_0x441cc6);}})['then'](function(_0x2a9fb5){if(_0x2a9fb5){_0x36dcf4=_0x2a9fb5[_0xa787('0x56')];if(!_0x57676f[_0xa787('0x32')]['hasOwnProperty']('nolimit')){_0x441cc6[_0xa787('0x1f')]=qs[_0xa787('0x1f')](_0x57676f['query'][_0xa787('0x1f')]);_0x441cc6['offset']=qs[_0xa787('0x1e')](_0x57676f['query'][_0xa787('0x1e')]);}return _0x4441ca[_0xa787('0x52')](_0x441cc6);}})['then'](function(_0x3e2641){if(_0x3e2641){return _0x3e2641?{'count':_0x36dcf4,'rows':_0x3e2641}:null;}})[_0xa787('0x28')](respondWithResult(_0xce7c0,null))[_0xa787('0x44')](handleError(_0xce7c0,null));}; \ No newline at end of file +var _0xb9da=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','omit','getContacts','findOne','CmContact','rawAttributes','pick','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','describe','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','CmCompany','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb9da,0x16e));var _0xab9d=function(_0x263f76,_0x2ee49f){_0x263f76=_0x263f76-0x0;var _0x4112de=_0xb9da[_0x263f76];return _0x4112de;};'use strict';var emlformat=require(_0xab9d('0x0'));var rimraf=require(_0xab9d('0x1'));var zipdir=require(_0xab9d('0x2'));var jsonpatch=require(_0xab9d('0x3'));var rp=require(_0xab9d('0x4'));var moment=require('moment');var BPromise=require(_0xab9d('0x5'));var Mustache=require(_0xab9d('0x6'));var util=require(_0xab9d('0x7'));var path=require(_0xab9d('0x8'));var sox=require(_0xab9d('0x9'));var csv=require(_0xab9d('0xa'));var ejs=require(_0xab9d('0xb'));var fs=require('fs');var fs_extra=require(_0xab9d('0xc'));var _=require(_0xab9d('0xd'));var squel=require('squel');var crypto=require(_0xab9d('0xe'));var jsforce=require(_0xab9d('0xf'));var deskjs=require(_0xab9d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xab9d('0x11'));var Papa=require('papaparse');var Redis=require(_0xab9d('0x12'));var authService=require(_0xab9d('0x13'));var qs=require(_0xab9d('0x14'));var as=require(_0xab9d('0x15'));var hardwareService=require(_0xab9d('0x16'));var logger=require(_0xab9d('0x17'))(_0xab9d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab9d('0x19'))['db'];function respondWithStatusCode(_0x2ac377,_0x4bc46e){_0x4bc46e=_0x4bc46e||0xcc;return function(_0x392ca4){if(_0x392ca4){return _0x2ac377[_0xab9d('0x1a')](_0x4bc46e);}return _0x2ac377['status'](_0x4bc46e)['end']();};}function respondWithResult(_0xd50044,_0xde8285){_0xde8285=_0xde8285||0xc8;return function(_0x2a1334){if(_0x2a1334){return _0xd50044[_0xab9d('0x1b')](_0xde8285)[_0xab9d('0x1c')](_0x2a1334);}};}function respondWithFilteredResult(_0xe0e724,_0x5a79b7){return function(_0x5f0194){if(_0x5f0194){var _0x28b7e1=typeof _0x5a79b7[_0xab9d('0x1d')]===_0xab9d('0x1e')&&typeof _0x5a79b7[_0xab9d('0x1f')]===_0xab9d('0x1e');var _0x2189f4=_0x5f0194[_0xab9d('0x20')];var _0x51ba7c=_0x28b7e1?0x0:_0x5a79b7['offset'];var _0x32a009=_0x28b7e1?_0x5f0194[_0xab9d('0x20')]:_0x5a79b7[_0xab9d('0x1d')]+_0x5a79b7[_0xab9d('0x1f')];var _0x321826;if(_0x32a009>=_0x2189f4){_0x32a009=_0x2189f4;_0x321826=0xc8;}else{_0x321826=0xce;}_0xe0e724['status'](_0x321826);return _0xe0e724['set'](_0xab9d('0x21'),_0x51ba7c+'-'+_0x32a009+'/'+_0x2189f4)[_0xab9d('0x1c')](_0x5f0194);}return null;};}function patchUpdates(_0x5598bd){return function(_0x524259){try{jsonpatch['apply'](_0x524259,_0x5598bd,!![]);}catch(_0x3b799f){return BPromise['reject'](_0x3b799f);}return _0x524259[_0xab9d('0x22')]();};}function saveUpdates(_0x4c4977,_0x2febd7){return function(_0x4df7f0){if(_0x4df7f0){return _0x4df7f0[_0xab9d('0x23')](_0x4c4977)[_0xab9d('0x24')](function(_0x5a3f1d){return _0x5a3f1d;});}return null;};}function removeEntity(_0x379729,_0x5c9210){return function(_0x26602d){if(_0x26602d){return _0x26602d[_0xab9d('0x25')]()[_0xab9d('0x24')](function(){var _0x177a91=_0x26602d[_0xab9d('0x26')]({'plain':!![]});var _0xab73e2='Companies';return db[_0xab9d('0x27')][_0xab9d('0x25')]({'where':{'type':_0xab73e2,'resourceId':_0x177a91['id']}})[_0xab9d('0x24')](function(){return _0x26602d;});})['then'](function(){_0x379729[_0xab9d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35304d,_0x18c2aa){return function(_0x46ae87){if(!_0x46ae87){_0x35304d['sendStatus'](0x194);}return _0x46ae87;};}function handleError(_0x714926,_0x3be6a0){_0x3be6a0=_0x3be6a0||0x1f4;return function(_0x6e90ef){logger[_0xab9d('0x28')](_0x6e90ef[_0xab9d('0x29')]);if(_0x6e90ef[_0xab9d('0x2a')]){delete _0x6e90ef['name'];}_0x714926['status'](_0x3be6a0)['send'](_0x6e90ef);};}exports['index']=function(_0x45b301,_0x16f275){var _0x1f6e86={},_0x329b0d={},_0x418727={'count':0x0,'rows':[]};return db['CmCompany'][_0xab9d('0x2b')]()[_0xab9d('0x24')](function(_0x4d0bc4){_0x329b0d['model']=_[_0xab9d('0x2c')](_0x4d0bc4);_0x329b0d['query']=_[_0xab9d('0x2c')](_0x45b301[_0xab9d('0x2d')]);_0x329b0d[_0xab9d('0x2e')]=_[_0xab9d('0x2f')](_0x329b0d['model'],_0x329b0d[_0xab9d('0x2d')]);_0x1f6e86[_0xab9d('0x30')]=_['intersection'](_0x329b0d[_0xab9d('0x31')],qs['fields'](_0x45b301[_0xab9d('0x2d')][_0xab9d('0x32')]));_0x1f6e86[_0xab9d('0x30')]=_0x1f6e86['attributes'][_0xab9d('0x33')]?_0x1f6e86[_0xab9d('0x30')]:_0x329b0d['model'];if(!_0x45b301[_0xab9d('0x2d')][_0xab9d('0x34')](_0xab9d('0x35'))){_0x1f6e86['limit']=qs[_0xab9d('0x1f')](_0x45b301['query'][_0xab9d('0x1f')]);_0x1f6e86[_0xab9d('0x1d')]=qs[_0xab9d('0x1d')](_0x45b301[_0xab9d('0x2d')]['offset']);}_0x1f6e86[_0xab9d('0x36')]=qs['sort'](_0x45b301[_0xab9d('0x2d')][_0xab9d('0x37')]);_0x1f6e86[_0xab9d('0x38')]=qs['filters'](_['pick'](_0x45b301['query'],_0x329b0d[_0xab9d('0x2e')]),_0x4d0bc4);if(_0x45b301[_0xab9d('0x2d')][_0xab9d('0x39')]){_0x1f6e86[_0xab9d('0x38')]=_[_0xab9d('0x3a')](_0x1f6e86['where'],{'$or':_['map'](_0x1f6e86[_0xab9d('0x30')],function(_0x4e21dd){var _0x4c8d1d={};_0x4c8d1d[_0x4e21dd]={'$like':'%'+_0x45b301[_0xab9d('0x2d')]['filter']+'%'};return _0x4c8d1d;})});}_0x1f6e86=_[_0xab9d('0x3a')]({},_0x1f6e86,_0x45b301[_0xab9d('0x3b')]);var _0x20c30b={'where':_0x1f6e86[_0xab9d('0x38')]};return db['CmCompany'][_0xab9d('0x20')](_0x20c30b)[_0xab9d('0x24')](function(_0xb39997){_0x418727[_0xab9d('0x20')]=_0xb39997;if(_0x45b301['query'][_0xab9d('0x3c')]){_0x1f6e86[_0xab9d('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xab9d('0x3e')](_0x1f6e86);})[_0xab9d('0x24')](function(_0x6d92ec){_0x418727[_0xab9d('0x3f')]=_0x6d92ec;return _0x418727;})[_0xab9d('0x24')](respondWithFilteredResult(_0x16f275,_0x1f6e86))[_0xab9d('0x40')](handleError(_0x16f275,null));})[_0xab9d('0x40')](handleError(_0x16f275,null));};exports[_0xab9d('0x41')]=function(_0x9b740,_0x377402){var _0x162574={'raw':![],'where':{'id':_0x9b740['params']['id']}},_0x5dbc8a={};_0x5dbc8a[_0xab9d('0x31')]=_[_0xab9d('0x2c')](db[_0xab9d('0x42')]['rawAttributes']);_0x5dbc8a[_0xab9d('0x2d')]=_['keys'](_0x9b740[_0xab9d('0x2d')]);_0x5dbc8a[_0xab9d('0x2e')]=_[_0xab9d('0x2f')](_0x5dbc8a[_0xab9d('0x31')],_0x5dbc8a[_0xab9d('0x2d')]);_0x162574[_0xab9d('0x30')]=_[_0xab9d('0x2f')](_0x5dbc8a[_0xab9d('0x31')],qs[_0xab9d('0x32')](_0x9b740['query'][_0xab9d('0x32')]));_0x162574['attributes']=_0x162574[_0xab9d('0x30')][_0xab9d('0x33')]?_0x162574[_0xab9d('0x30')]:_0x5dbc8a['model'];if(_0x9b740[_0xab9d('0x2d')]['includeAll']){_0x162574[_0xab9d('0x3d')]=[{'all':!![]}];}_0x162574=_[_0xab9d('0x3a')]({},_0x162574,_0x9b740['options']);return db['CmCompany'][_0xab9d('0x43')](_0x162574)[_0xab9d('0x24')](handleEntityNotFound(_0x377402,null))[_0xab9d('0x24')](respondWithResult(_0x377402,null))['catch'](handleError(_0x377402,null));};exports['create']=function(_0x20e921,_0x566968){return db['CmCompany'][_0xab9d('0x44')](_0x20e921[_0xab9d('0x45')],{})[_0xab9d('0x24')](function(_0x6db5d0){var _0x34ea66=_0x20e921[_0xab9d('0x46')]['get']({'plain':!![]});if(!_0x34ea66)throw new Error(_0xab9d('0x47'));if(_0x34ea66[_0xab9d('0x48')]==='user'){var _0xba8de1=_0x6db5d0['get']({'plain':!![]});var _0x17c583=_0xab9d('0x49');return db[_0xab9d('0x4a')][_0xab9d('0x43')]({'where':{'name':_0x17c583,'userProfileId':_0x34ea66[_0xab9d('0x4b')]},'raw':!![]})[_0xab9d('0x24')](function(_0x333fd8){if(_0x333fd8&&_0x333fd8[_0xab9d('0x4c')]===0x0){return db[_0xab9d('0x27')]['create']({'name':_0xba8de1[_0xab9d('0x2a')],'resourceId':_0xba8de1['id'],'type':_0x333fd8['name'],'sectionId':_0x333fd8['id']},{})[_0xab9d('0x24')](function(){return _0x6db5d0;});}else{return _0x6db5d0;}})['catch'](function(_0x1fd0cc){logger[_0xab9d('0x28')](_0xab9d('0x4d'),_0x1fd0cc);throw _0x1fd0cc;});}return _0x6db5d0;})['then'](respondWithResult(_0x566968,0xc9))['catch'](handleError(_0x566968,null));};exports[_0xab9d('0x23')]=function(_0x1f6932,_0x2da979){if(_0x1f6932['body']['id']){delete _0x1f6932[_0xab9d('0x45')]['id'];}return db[_0xab9d('0x42')][_0xab9d('0x43')]({'where':{'id':_0x1f6932[_0xab9d('0x4e')]['id']}})[_0xab9d('0x24')](handleEntityNotFound(_0x2da979,null))[_0xab9d('0x24')](saveUpdates(_0x1f6932[_0xab9d('0x45')],null))['then'](respondWithResult(_0x2da979,null))[_0xab9d('0x40')](handleError(_0x2da979,null));};exports[_0xab9d('0x25')]=function(_0x5bcb03,_0x2aedec){return db[_0xab9d('0x42')][_0xab9d('0x43')]({'where':{'id':_0x5bcb03['params']['id']}})[_0xab9d('0x24')](handleEntityNotFound(_0x2aedec,null))[_0xab9d('0x24')](removeEntity(_0x2aedec,null))[_0xab9d('0x40')](handleError(_0x2aedec,null));};exports[_0xab9d('0x2b')]=function(_0x516cd2,_0x1f8245){return db[_0xab9d('0x42')][_0xab9d('0x2b')]()[_0xab9d('0x24')](respondWithResult(_0x1f8245,null))[_0xab9d('0x40')](handleError(_0x1f8245,null));};exports['addContacts']=function(_0x5d2e80,_0x5acd1d,_0x7a0584){return db['CmContact'][_0xab9d('0x43')]({'where':{'id':_0x5d2e80['params']['id']}})['then'](handleEntityNotFound(_0x5acd1d,null))[_0xab9d('0x24')](function(_0x41084c){if(_0x41084c){return _0x41084c[_0xab9d('0x4f')](_0x5d2e80[_0xab9d('0x45')][_0xab9d('0x50')],_[_0xab9d('0x51')](_0x5d2e80['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5acd1d,null))[_0xab9d('0x40')](handleError(_0x5acd1d,null));};exports[_0xab9d('0x52')]=function(_0x354240,_0x1fcaa4,_0x56a6b5){var _0x18ccd0={};var _0x297a3b={};var _0x114aaa;var _0x514f6a;return db[_0xab9d('0x42')][_0xab9d('0x53')]({'where':{'id':_0x354240[_0xab9d('0x4e')]['id']}})[_0xab9d('0x24')](handleEntityNotFound(_0x1fcaa4,null))[_0xab9d('0x24')](function(_0x1842ce){if(_0x1842ce){_0x114aaa=_0x1842ce;_0x297a3b[_0xab9d('0x31')]=_[_0xab9d('0x2c')](db[_0xab9d('0x54')][_0xab9d('0x55')]);_0x297a3b['query']=_[_0xab9d('0x2c')](_0x354240[_0xab9d('0x2d')]);_0x297a3b['filters']=_[_0xab9d('0x2f')](_0x297a3b[_0xab9d('0x31')],_0x297a3b[_0xab9d('0x2d')]);_0x18ccd0[_0xab9d('0x30')]=_[_0xab9d('0x2f')](_0x297a3b[_0xab9d('0x31')],qs['fields'](_0x354240[_0xab9d('0x2d')][_0xab9d('0x32')]));_0x18ccd0[_0xab9d('0x30')]=_0x18ccd0[_0xab9d('0x30')]['length']?_0x18ccd0[_0xab9d('0x30')]:_0x297a3b[_0xab9d('0x31')];_0x18ccd0[_0xab9d('0x36')]=qs[_0xab9d('0x37')](_0x354240[_0xab9d('0x2d')][_0xab9d('0x37')]);_0x18ccd0[_0xab9d('0x38')]=qs['filters'](_[_0xab9d('0x56')](_0x354240[_0xab9d('0x2d')],_0x297a3b[_0xab9d('0x2e')]));if(_0x354240[_0xab9d('0x2d')][_0xab9d('0x39')]){_0x18ccd0[_0xab9d('0x38')]=_[_0xab9d('0x3a')](_0x18ccd0['where'],{'$or':_[_0xab9d('0x57')](_0x18ccd0['attributes'],function(_0xc880f6){var _0x36ca73={};_0x36ca73[_0xc880f6]={'$like':'%'+_0x354240['query'][_0xab9d('0x39')]+'%'};return _0x36ca73;})});}_0x18ccd0=_[_0xab9d('0x3a')]({},_0x18ccd0,_0x354240['options']);return _0x114aaa[_0xab9d('0x52')](_0x18ccd0);}})[_0xab9d('0x24')](function(_0x154aef){if(_0x154aef){_0x514f6a=_0x154aef[_0xab9d('0x33')];if(!_0x354240[_0xab9d('0x2d')][_0xab9d('0x34')]('nolimit')){_0x18ccd0[_0xab9d('0x1f')]=qs[_0xab9d('0x1f')](_0x354240[_0xab9d('0x2d')][_0xab9d('0x1f')]);_0x18ccd0['offset']=qs[_0xab9d('0x1d')](_0x354240['query'][_0xab9d('0x1d')]);}return _0x114aaa['getContacts'](_0x18ccd0);}})[_0xab9d('0x24')](function(_0x3268de){if(_0x3268de){return _0x3268de?{'count':_0x514f6a,'rows':_0x3268de}:null;}})[_0xab9d('0x24')](respondWithResult(_0x1fcaa4,null))['catch'](handleError(_0x1fcaa4,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c08a7bc..9725872 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 _0x1896=['moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x48a17b,_0x15fe4b){var _0x3170db=function(_0x46bee6){while(--_0x46bee6){_0x48a17b['push'](_0x48a17b['shift']());}};_0x3170db(++_0x15fe4b);}(_0x1896,0x1a1));var _0x6189=function(_0x4a202d,_0x47a350){_0x4a202d=_0x4a202d-0x0;var _0x511c02=_0x1896[_0x4a202d];return _0x511c02;};'use strict';var _=require(_0x6189('0x0'));var util=require(_0x6189('0x1'));var logger=require(_0x6189('0x2'))('api');var moment=require(_0x6189('0x3'));var BPromise=require(_0x6189('0x4'));var rp=require(_0x6189('0x5'));var fs=require('fs');var path=require(_0x6189('0x6'));var rimraf=require('rimraf');var config=require(_0x6189('0x7'));var attributes=require(_0x6189('0x8'));module['exports']=function(_0x395611,_0x1e1b8e){return _0x395611[_0x6189('0x9')](_0x6189('0xa'),attributes,{'tableName':_0x6189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d55=['api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x9d55,0x75));var _0x59d5=function(_0x6777ad,_0x2e6dd7){_0x6777ad=_0x6777ad-0x0;var _0x15cf4c=_0x9d55[_0x6777ad];return _0x15cf4c;};'use strict';var _=require(_0x59d5('0x0'));var util=require(_0x59d5('0x1'));var logger=require(_0x59d5('0x2'))(_0x59d5('0x3'));var moment=require(_0x59d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x59d5('0x5'));var fs=require('fs');var path=require(_0x59d5('0x6'));var rimraf=require('rimraf');var config=require(_0x59d5('0x7'));var attributes=require(_0x59d5('0x8'));module[_0x59d5('0x9')]=function(_0x3bfff3,_0x46b062){return _0x3bfff3[_0x59d5('0xa')]('CmCompany',attributes,{'tableName':_0x59d5('0xb'),'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 22f0e33..6ebf36d 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 _0xe218=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch'];(function(_0x2b4d69,_0x13e822){var _0xf3919a=function(_0x3817ac){while(--_0x3817ac){_0x2b4d69['push'](_0x2b4d69['shift']());}};_0xf3919a(++_0x13e822);}(_0xe218,0x18c));var _0x8e21=function(_0x538452,_0x3f0c4d){_0x538452=_0x538452-0x0;var _0x2f51e6=_0xe218[_0x538452];return _0x2f51e6;};'use strict';var _=require(_0x8e21('0x0'));var util=require(_0x8e21('0x1'));var moment=require(_0x8e21('0x2'));var BPromise=require(_0x8e21('0x3'));var rs=require(_0x8e21('0x4'));var fs=require('fs');var Redis=require(_0x8e21('0x5'));var db=require(_0x8e21('0x6'))['db'];var utils=require(_0x8e21('0x7'));var logger=require(_0x8e21('0x8'))(_0x8e21('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e21('0xa')][_0x8e21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402c15,_0x9b19bd,_0x4eb261){return new BPromise(function(_0x36d346,_0x1ea097){return client['request'](_0x402c15,_0x4eb261)[_0x8e21('0xc')](function(_0xfbeb94){logger['info']('CmCompany,\x20%s,\x20%s',_0x9b19bd,_0x8e21('0xd'));logger[_0x8e21('0xe')](_0x8e21('0xf'),_0x9b19bd,_0x8e21('0xd'),JSON[_0x8e21('0x10')](_0xfbeb94));if(_0xfbeb94[_0x8e21('0x11')]){if(_0xfbeb94['error']['code']===0x1f4){logger[_0x8e21('0x11')](_0x8e21('0x12'),_0x9b19bd,_0xfbeb94['error'][_0x8e21('0x13')]);return _0x1ea097(_0xfbeb94[_0x8e21('0x11')]['message']);}logger[_0x8e21('0x11')](_0x8e21('0x12'),_0x9b19bd,_0xfbeb94['error'][_0x8e21('0x13')]);return _0x36d346(_0xfbeb94[_0x8e21('0x11')][_0x8e21('0x13')]);}else{logger['info'](_0x8e21('0x12'),_0x9b19bd,_0x8e21('0xd'));_0x36d346(_0xfbeb94[_0x8e21('0x14')][_0x8e21('0x13')]);}})[_0x8e21('0x15')](function(_0xd2f930){logger[_0x8e21('0x11')]('CmCompany,\x20%s,\x20%s',_0x9b19bd,_0xd2f930);_0x1ea097(_0xd2f930);});});} \ No newline at end of file +var _0x2978=['info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2978,0xfb));var _0x8297=function(_0x1ac6eb,_0x20f18d){_0x1ac6eb=_0x1ac6eb-0x0;var _0x1b95f4=_0x2978[_0x1ac6eb];return _0x1b95f4;};'use strict';var _=require(_0x8297('0x0'));var util=require(_0x8297('0x1'));var moment=require(_0x8297('0x2'));var BPromise=require(_0x8297('0x3'));var rs=require(_0x8297('0x4'));var fs=require('fs');var Redis=require(_0x8297('0x5'));var db=require(_0x8297('0x6'))['db'];var utils=require(_0x8297('0x7'));var logger=require(_0x8297('0x8'))(_0x8297('0x9'));var config=require(_0x8297('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8297('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d5042,_0x3e2546,_0xc0e1dc){return new BPromise(function(_0x117728,_0x50482d){return client[_0x8297('0xc')](_0x5d5042,_0xc0e1dc)['then'](function(_0x4cb0da){logger[_0x8297('0xd')](_0x8297('0xe'),_0x3e2546,'request\x20sent');logger[_0x8297('0xf')](_0x8297('0x10'),_0x3e2546,_0x8297('0x11'),JSON[_0x8297('0x12')](_0x4cb0da));if(_0x4cb0da[_0x8297('0x13')]){if(_0x4cb0da[_0x8297('0x13')][_0x8297('0x14')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x3e2546,_0x4cb0da[_0x8297('0x13')]['message']);return _0x50482d(_0x4cb0da['error']['message']);}logger[_0x8297('0x13')]('CmCompany,\x20%s,\x20%s',_0x3e2546,_0x4cb0da[_0x8297('0x13')][_0x8297('0x15')]);return _0x117728(_0x4cb0da[_0x8297('0x13')]['message']);}else{logger['info'](_0x8297('0xe'),_0x3e2546,_0x8297('0x11'));_0x117728(_0x4cb0da[_0x8297('0x16')][_0x8297('0x15')]);}})[_0x8297('0x17')](function(_0x2ac5d0){logger[_0x8297('0x13')](_0x8297('0xe'),_0x3e2546,_0x2ac5d0);_0x50482d(_0x2ac5d0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8848a40..924ca73 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 _0x31c2=['isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x31c2,0x183));var _0x231c=function(_0x5c7fb0,_0x4a0c6d){_0x5c7fb0=_0x5c7fb0-0x0;var _0x3b1002=_0x31c2[_0x5c7fb0];return _0x3b1002;};'use strict';var multer=require(_0x231c('0x0'));var util=require('util');var path=require(_0x231c('0x1'));var timeout=require('connect-timeout');var express=require(_0x231c('0x2'));var router=express[_0x231c('0x3')]();var fs_extra=require(_0x231c('0x4'));var auth=require(_0x231c('0x5'));var interaction=require(_0x231c('0x6'));var config=require('../../config/environment');var controller=require(_0x231c('0x7'));router[_0x231c('0x8')]('/',auth[_0x231c('0x9')](),controller['index']);router[_0x231c('0x8')]('/describe',auth[_0x231c('0x9')](),controller[_0x231c('0xa')]);router[_0x231c('0x8')](_0x231c('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x231c('0xc'),auth['isAuthenticated'](),controller[_0x231c('0xd')]);router[_0x231c('0xe')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xf')]);router[_0x231c('0xe')]('/:id/contacts',auth[_0x231c('0x9')](),controller[_0x231c('0x10')]);router[_0x231c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x231c('0x12')]);router[_0x231c('0x13')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x14')]);module[_0x231c('0x15')]=router; \ No newline at end of file +var _0x45df=['../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x354803,_0x3b56d8){var _0x2e30ba=function(_0x24e9b7){while(--_0x24e9b7){_0x354803['push'](_0x354803['shift']());}};_0x2e30ba(++_0x3b56d8);}(_0x45df,0x1c5));var _0xf45d=function(_0x45cccb,_0x180f00){_0x45cccb=_0x45cccb-0x0;var _0x18bc60=_0x45df[_0x45cccb];return _0x18bc60;};'use strict';var multer=require(_0xf45d('0x0'));var util=require(_0xf45d('0x1'));var path=require('path');var timeout=require(_0xf45d('0x2'));var express=require(_0xf45d('0x3'));var router=express[_0xf45d('0x4')]();var fs_extra=require(_0xf45d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf45d('0x6'));var config=require(_0xf45d('0x7'));var controller=require(_0xf45d('0x8'));router['get']('/',auth[_0xf45d('0x9')](),controller[_0xf45d('0xa')]);router[_0xf45d('0xb')](_0xf45d('0xc'),auth[_0xf45d('0x9')](),controller['describe']);router['get'](_0xf45d('0xd'),auth['isAuthenticated'](),controller[_0xf45d('0xe')]);router[_0xf45d('0xb')](_0xf45d('0xf'),auth[_0xf45d('0x9')](),controller[_0xf45d('0x10')]);router[_0xf45d('0x11')]('/',auth[_0xf45d('0x9')](),controller['create']);router[_0xf45d('0x11')](_0xf45d('0xf'),auth[_0xf45d('0x9')](),controller[_0xf45d('0x12')]);router[_0xf45d('0x13')](_0xf45d('0xd'),auth[_0xf45d('0x9')](),controller['update']);router[_0xf45d('0x14')](_0xf45d('0xd'),auth[_0xf45d('0x9')](),controller[_0xf45d('0x15')]);module[_0xf45d('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ca66e99..026e590 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 _0xe82c=['TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING'];(function(_0x443dc0,_0x2185cb){var _0x4bb9e8=function(_0x565380){while(--_0x565380){_0x443dc0['push'](_0x443dc0['shift']());}};_0x4bb9e8(++_0x2185cb);}(_0xe82c,0xc4));var _0xce82=function(_0x48efc8,_0x3941c0){_0x48efc8=_0x48efc8-0x0;var _0x3f5755=_0xe82c[_0x48efc8];return _0x3f5755;};'use strict';var _=require(_0xce82('0x0'));var Sequelize=require(_0xce82('0x1'));module[_0xce82('0x2')]={'firstName':{'type':Sequelize[_0xce82('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xce82('0x3')]},'street':{'type':Sequelize[_0xce82('0x3')]},'postalCode':{'type':Sequelize[_0xce82('0x3')]},'city':{'type':Sequelize[_0xce82('0x3')]},'country':{'type':Sequelize[_0xce82('0x3')]},'dateOfBirth':{'type':Sequelize[_0xce82('0x3')]},'description':{'type':Sequelize[_0xce82('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xce82('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xce82('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xce82('0x3')]},'fb_data':{'type':Sequelize[_0xce82('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xce82('0x3')]},'teams':{'type':Sequelize[_0xce82('0x3')]},'viber':{'type':Sequelize[_0xce82('0x3')]},'line':{'type':Sequelize[_0xce82('0x3')]},'wechat':{'type':Sequelize[_0xce82('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xce82('0x5')]},'priority':{'type':Sequelize[_0xce82('0x5')](0x2)[_0xce82('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xce82('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x61eb=['STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x1a6a4d,_0x226eb6){var _0x2a8b69=function(_0x3a48ed){while(--_0x3a48ed){_0x1a6a4d['push'](_0x1a6a4d['shift']());}};_0x2a8b69(++_0x226eb6);}(_0x61eb,0x1cd));var _0xb61e=function(_0x3cabfc,_0x5ab3dc){_0x3cabfc=_0x3cabfc-0x0;var _0x1dc0f3=_0x61eb[_0x3cabfc];return _0x1dc0f3;};'use strict';var _=require(_0xb61e('0x0'));var Sequelize=require(_0xb61e('0x1'));module[_0xb61e('0x2')]={'firstName':{'type':Sequelize[_0xb61e('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb61e('0x3')]},'street':{'type':Sequelize[_0xb61e('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb61e('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb61e('0x4')]},'phone':{'type':Sequelize[_0xb61e('0x3')]},'mobile':{'type':Sequelize[_0xb61e('0x3')]},'fax':{'type':Sequelize[_0xb61e('0x3')]},'email':{'type':Sequelize[_0xb61e('0x3')]},'url':{'type':Sequelize[_0xb61e('0x3')]},'facebook':{'type':Sequelize[_0xb61e('0x3')]},'fb_data':{'type':Sequelize[_0xb61e('0x3')]},'twitter':{'type':Sequelize[_0xb61e('0x3')]},'skype':{'type':Sequelize[_0xb61e('0x3')]},'teams':{'type':Sequelize[_0xb61e('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xb61e('0x3')]},'wechat':{'type':Sequelize[_0xb61e('0x3')]},'telegram':{'type':Sequelize[_0xb61e('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xb61e('0x5')](0x2)[_0xb61e('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb61e('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index dd48ff5..94a71c3 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 _0x02c4=['getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','c.id','DESC','t.id\x20IN\x20?','user','role','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','destroy','params','tags','columnName','analytics','findAll','catch','body','get','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','each','duplicates','$or','spread','show','$and','omit','format','cf_%d','table','cm_contacts','id\x20=\x20?','toParam','text','values','phone','getTags','options','setTags','ids','rawAttributes','includeAll','getHopperHistories','ContactId','getHopperFinals','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','chmodSync','0777','child_process','fork','join','../../components/import/cm/csv','CompanyId','path','parse','meta','import','User','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','getJourney','chat','sms','openchannel','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','destination','callerid','starttime','duration','note','userDisposition','userSecondDisposition','UserId','fullname','alias','createdAt','findAndCountAll','startCase','Website','Account','closed','closedAt','secondDisposition','key','Owner','customerIp','customerPort','ratingMessage','ratingValue','referer','mail','subject','substatus','threadId','Interaction','flatten','sortBy','reverse','slice','util','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','offset','undefined','limit','count','status','Content-Range','json','update','then','end','sendStatus','error','stack','name','send','index','describe','keys','length','startsWith','cf_','CmCustomField','findOne','trimStart','all','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','from','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','parseSearch','conditions','find','Tag','value','split','map','forEach','union','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','start','isNil','Contact','push','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x2d4b14,_0x212dc8){var _0x2c95f2=function(_0x3a7397){while(--_0x3a7397){_0x2d4b14['push'](_0x2d4b14['shift']());}};_0x2c95f2(++_0x212dc8);}(_0x02c4,0xb4));var _0x402c=function(_0x330886,_0x5e3ccb){_0x330886=_0x330886-0x0;var _0x4c673a=_0x02c4[_0x330886];return _0x4c673a;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x402c('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x402c('0x1'));var Papa=require(_0x402c('0x2'));var Redis=require('ioredis');var qs=require(_0x402c('0x3'));var as=require(_0x402c('0x4'));var logger=require(_0x402c('0x5'))(_0x402c('0x6'));var config=require(_0x402c('0x7'));var db=require(_0x402c('0x8'))['db'];config[_0x402c('0x9')]=_['defaults'](config[_0x402c('0x9')],{'host':_0x402c('0xa'),'port':0x18eb});var socket=require(_0x402c('0xb'))(new Redis(config['redis']));require(_0x402c('0xc'))[_0x402c('0xd')](socket);function respondWithResult(_0x409ca9,_0x3a0717){_0x3a0717=_0x3a0717||0xc8;return function(_0x4bcc24){if(_0x4bcc24){return _0x409ca9['status'](_0x3a0717)['json'](_0x4bcc24);}};}function respondWithFilteredResult(_0x3de5a5,_0x39f8d6){return function(_0x1df438){if(_0x1df438){var _0x5b8cb0=typeof _0x39f8d6[_0x402c('0xe')]===_0x402c('0xf')&&typeof _0x39f8d6[_0x402c('0x10')]==='undefined';var _0xa2a138=_0x1df438[_0x402c('0x11')];var _0x2fca21=_0x5b8cb0?0x0:_0x39f8d6[_0x402c('0xe')];var _0x2fed7c=_0x5b8cb0?_0x1df438[_0x402c('0x11')]:_0x39f8d6[_0x402c('0xe')]+_0x39f8d6['limit'];var _0x5cec11;if(_0x2fed7c>=_0xa2a138){_0x2fed7c=_0xa2a138;_0x5cec11=0xc8;}else{_0x5cec11=0xce;}_0x3de5a5[_0x402c('0x12')](_0x5cec11);return _0x3de5a5['set'](_0x402c('0x13'),_0x2fca21+'-'+_0x2fed7c+'/'+_0xa2a138)[_0x402c('0x14')](_0x1df438);}return null;};}function saveUpdates(_0x14ca5c){return function(_0x1ed05d){if(_0x1ed05d){return _0x1ed05d[_0x402c('0x15')](_0x14ca5c)[_0x402c('0x16')](function(_0x112cab){return _0x112cab;});}return null;};}function removeEntity(_0x31a819){return function(_0x5f39cd){if(_0x5f39cd){return _0x5f39cd['destroy']()[_0x402c('0x16')](function(){_0x31a819['status'](0xcc)[_0x402c('0x17')]();});}};}function handleEntityNotFound(_0x3adaea){return function(_0x4a8b9c){if(!_0x4a8b9c){_0x3adaea[_0x402c('0x18')](0x194);}return _0x4a8b9c;};}function handleError(_0x4175fb,_0x43e810){_0x43e810=_0x43e810||0x1f4;return function(_0x22fc36){logger[_0x402c('0x19')](_0x22fc36[_0x402c('0x1a')]);if(_0x22fc36[_0x402c('0x1b')]){delete _0x22fc36['name'];}_0x4175fb[_0x402c('0x12')](_0x43e810)[_0x402c('0x1c')](_0x22fc36);};}exports[_0x402c('0x1d')]=function(_0x478a88,_0x48386a){var _0x928831={},_0x55e1cf={},_0x52aa1d={'count':0x0,'rows':[]};return db['CmContact'][_0x402c('0x1e')]()[_0x402c('0x16')](function(_0x12b9c3){var _0x2c493e=[];for(var _0x4fbf64=0x0;_0x4fbf640x1){_0x4901ef['or'](_0x402c('0x5a'),qs[_0x402c('0x5b')](_0x8405c2),null);}else{if(qs[_0x402c('0x5c')](_0x8405c2)){_0x4901ef['or'](_0x402c('0x5d'),_0x8405c2+'%');_0x4901ef['or'](_0x402c('0x5e'),_0x8405c2+'%');_0x4901ef['or'](_0x402c('0x5f'),_0x8405c2+'%');_0x4901ef['or']('c.fax\x20LIKE\x20?',_0x8405c2+'%');}else if(qs['isEmail'](_0x8405c2)){_0x4901ef['or'](_0x402c('0x60'),_0x8405c2+'%');}else{_0x4901ef['or'](_0x402c('0x61'),'%'+_0x8405c2+'%');_0x4901ef['or'](_0x402c('0x62'),'%'+_0x8405c2+'%');_0x4901ef['or'](_0x402c('0x60'),'%'+_0x8405c2+'%');}}}}_0x2a791b['where'](_0x4901ef);_0x2a791b[_0x402c('0x63')]('c.id');var _0x5bfe8e={'type':db[_0x402c('0x64')][_0x402c('0x65')][_0x402c('0x66')],'raw':!![]};var _0x470679=_0x2a791b[_0x402c('0x67')]()[_0x402c('0x34')](_0x402c('0x68'));if(_0x928831[_0x402c('0x2f')]){_0x928831[_0x402c('0x2f')][_0x402c('0x46')](function(_0x20b9e1){_0x2a791b[_0x402c('0x2f')]('c.'+_0x20b9e1[0x0],_0x20b9e1[0x1]===_0x402c('0x69')?![]:!![]);});}if(!_['isEmpty'](_0x51590e)){_0x2a791b['having'](_0x174d90);_0x470679[_0x402c('0x31')](_0x402c('0x6a'),_0x51590e);}BPromise['resolve']()[_0x402c('0x16')](function(){if(!_0x445fa7)return;if(_0x478a88[_0x402c('0x6b')][_0x402c('0x6c')]!==_0x402c('0x6d'))return;if(!_[_0x402c('0x6e')](_0x445fa7[_0x402c('0x40')],[_0x402c('0x34'),'User'])){return _0x478a88[_0x402c('0x6b')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x56761e){if(_[_0x402c('0x52')](_0x56761e)){_0x470679['where']('c.ListId\x20IS\x20NULL');_0x2a791b[_0x402c('0x31')](_0x402c('0x6f'));}else{_0x470679[_0x402c('0x31')]('c.ListId\x20IN\x20?',_['map'](_0x56761e,'id'));_0x2a791b[_0x402c('0x31')](_0x402c('0x70'),_[_0x402c('0x45')](_0x56761e,'id'));}});}})[_0x402c('0x16')](function(){if(_0x478a88[_0x402c('0x6b')]['role']===_0x402c('0x6d')&&!_0x445fa7&&!_0x478a88[_0x402c('0x28')]['ListId'])return[];return db[_0x402c('0x71')][_0x402c('0x28')](_0x470679['toString'](),_0x5bfe8e);})['then'](function(_0x2d0cf9){_0x52aa1d[_0x402c('0x11')]=_0x2d0cf9[_0x402c('0x20')];if(_0x52aa1d[_0x402c('0x11')]===0x0)return[];return db[_0x402c('0x71')][_0x402c('0x28')](_0x21aa8e[_0x402c('0x72')](),_0x5bfe8e)[_0x402c('0x16')](function(_0x4e449c){_0x513055=_[_0x402c('0x73')](_0x4e449c,'id');_0x5bfe8e=_[_0x402c('0x74')](_0x5bfe8e,{'model':db[_0x402c('0x75')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x478a88[_0x402c('0x28')][_0x402c('0x2b')]){_0x928831[_0x402c('0x2c')][_0x402c('0x46')](function(_0x1fed95){_0x2a791b[_0x402c('0x34')]('c.'+_0x1fed95);});}else{_0x2a791b[_0x402c('0x34')](_0x402c('0x68'));_0x2a791b[_0x402c('0x34')](_0x402c('0x76'));_0x2a791b['field'](_0x402c('0x77'));_0x2a791b[_0x402c('0x34')](_0x402c('0x78'));_0x2a791b['field'](_0x402c('0x79'));_0x2a791b[_0x402c('0x34')](_0x402c('0x7a'));_0x2a791b['field'](_0x402c('0x7b'));_0x2a791b[_0x402c('0x34')](_0x402c('0x7c'));_0x2a791b['field'](_0x402c('0x7d'));_0x2a791b[_0x402c('0x34')]('c.deletedAt');_0x2a791b[_0x402c('0x34')](_0x402c('0x7e'));_0x2a791b[_0x402c('0x34')](_0x402c('0x7f'),_0x402c('0x80'));}if(_0x928831['limit'])_0x2a791b[_0x402c('0x10')](_0x928831[_0x402c('0x10')]);if(_0x928831[_0x402c('0xe')])_0x2a791b[_0x402c('0xe')](_0x928831[_0x402c('0xe')]);return db[_0x402c('0x71')][_0x402c('0x28')](_0x2a791b[_0x402c('0x72')](),_0x5bfe8e);});})[_0x402c('0x16')](function(_0x3e36d5){_0x3e36d5[_0x402c('0x46')](function(_0x1d86df){if(_0x1d86df[_0x402c('0x80')]){_0x1d86df[_0x402c('0x81')]=[];_0x1d86df[_0x402c('0x80')][_0x402c('0x44')](',')['forEach'](function(_0x39295d){_0x1d86df[_0x402c('0x81')][_0x402c('0x51')](_0x513055[_0x39295d]);});}delete _0x1d86df[_0x402c('0x80')];});_0x52aa1d[_0x402c('0x82')]=_0x3e36d5;return _0x52aa1d;})[_0x402c('0x16')](respondWithFilteredResult(_0x48386a,_0x928831));})['catch'](handleError(_0x48386a,null));};exports[_0x402c('0x83')]=function(_0x37313b,_0x3f77cc){return db[_0x402c('0x75')][_0x402c('0x41')]({'where':{'id':_0x37313b[_0x402c('0x84')]['id']}})[_0x402c('0x16')](handleEntityNotFound(_0x3f77cc,null))[_0x402c('0x16')](removeEntity(_0x3f77cc,null))['catch'](handleError(_0x3f77cc,null));};exports[_0x402c('0x1e')]=function(_0x202a5c,_0x225683){return db['CmContact']['describe']()[_0x402c('0x16')](function(_0x34fed2){delete _0x34fed2[_0x402c('0x85')];for(var _0xa71e21=0x0;_0xa71e21=_0xd5c7bc){_0x3cb2ae=_0xd5c7bc;_0x21f57c=0xc8;}else{_0x21f57c=0xce;}_0x44cbb8[_0xde3a('0x11')](_0x21f57c);return _0x44cbb8[_0xde3a('0x12')](_0xde3a('0x13'),_0x50ca5d+'-'+_0x3cb2ae+'/'+_0xd5c7bc)[_0xde3a('0xc')](_0x4e5295);}return null;};}function saveUpdates(_0x1fc431){return function(_0x3d9cb9){if(_0x3d9cb9){return _0x3d9cb9[_0xde3a('0x14')](_0x1fc431)[_0xde3a('0x15')](function(_0x15a3a6){return _0x15a3a6;});}return null;};}function removeEntity(_0x3435ba){return function(_0x92f272){if(_0x92f272){return _0x92f272[_0xde3a('0x16')]()['then'](function(){_0x3435ba['status'](0xcc)[_0xde3a('0x17')]();});}};}function handleEntityNotFound(_0x4b1732){return function(_0x1245fd){if(!_0x1245fd){_0x4b1732['sendStatus'](0x194);}return _0x1245fd;};}function handleError(_0x565ffc,_0x4148b7){_0x4148b7=_0x4148b7||0x1f4;return function(_0x27f3aa){logger[_0xde3a('0x18')](_0x27f3aa['stack']);if(_0x27f3aa[_0xde3a('0x19')]){delete _0x27f3aa['name'];}_0x565ffc[_0xde3a('0x11')](_0x4148b7)[_0xde3a('0x1a')](_0x27f3aa);};}exports[_0xde3a('0x1b')]=function(_0x5955b0,_0x31d088){var _0x49474b={},_0x2bc339={},_0x17a962={'count':0x0,'rows':[]};return db['CmContact']['describe']()['then'](function(_0x5b25b7){var _0x2342f5=[];for(var _0x3330b4=0x0;_0x3330b40x1){_0x4ccc46['or'](_0xde3a('0x57'),qs[_0xde3a('0x58')](_0x87ad83),null);}else{if(qs[_0xde3a('0x59')](_0x87ad83)){_0x4ccc46['or'](_0xde3a('0x5a'),_0x87ad83+'%');_0x4ccc46['or']('c.phone\x20LIKE\x20?',_0x87ad83+'%');_0x4ccc46['or'](_0xde3a('0x5b'),_0x87ad83+'%');_0x4ccc46['or']('c.fax\x20LIKE\x20?',_0x87ad83+'%');}else if(qs[_0xde3a('0x5c')](_0x87ad83)){_0x4ccc46['or']('c.email\x20LIKE\x20?',_0x87ad83+'%');}else{_0x4ccc46['or'](_0xde3a('0x5d'),'%'+_0x87ad83+'%');_0x4ccc46['or']('c.lastName\x20LIKE\x20?','%'+_0x87ad83+'%');_0x4ccc46['or']('c.email\x20LIKE\x20?','%'+_0x87ad83+'%');}}}}_0x49e30c[_0xde3a('0x36')](_0x4ccc46);_0x49e30c[_0xde3a('0x5e')]('c.id');var _0x391f04={'type':db[_0xde3a('0x5f')][_0xde3a('0x60')][_0xde3a('0x61')],'raw':!![]};var _0x57b741=_0x49e30c['clone']()['field']('c.id');if(_0x49474b[_0xde3a('0x62')]){_0x49474b['order'][_0xde3a('0x40')](function(_0x59c879){_0x49e30c['order']('c.'+_0x59c879[0x0],_0x59c879[0x1]===_0xde3a('0x63')?![]:!![]);});}if(!_[_0xde3a('0x64')](_0x3b95ca)){_0x49e30c['having'](_0x2da0c8);_0x57b741['where'](_0xde3a('0x65'),_0x3b95ca);}BPromise['resolve']()['then'](function(){if(!_0x9579da)return;if(_0x5955b0[_0xde3a('0x66')][_0xde3a('0x67')]!==_0xde3a('0x68'))return;if(!_['some'](_0x9579da[_0xde3a('0x3b')],[_0xde3a('0x2d'),'User'])){return _0x5955b0['user'][_0xde3a('0x69')]({'attributes':['id'],'raw':!![]})[_0xde3a('0x15')](function(_0x533f81){if(_[_0xde3a('0x64')](_0x533f81)){_0x57b741[_0xde3a('0x36')](_0xde3a('0x6a'));_0x49e30c[_0xde3a('0x36')](_0xde3a('0x6a'));}else{_0x57b741[_0xde3a('0x36')](_0xde3a('0x4f'),_['map'](_0x533f81,'id'));_0x49e30c['where']('c.ListId\x20IN\x20?',_[_0xde3a('0x3f')](_0x533f81,'id'));}});}})[_0xde3a('0x15')](function(){if(_0x5955b0[_0xde3a('0x66')]['role']===_0xde3a('0x68')&&!_0x9579da&&!_0x5955b0[_0xde3a('0x24')][_0xde3a('0x4e')])return[];return db[_0xde3a('0x6b')][_0xde3a('0x24')](_0x57b741[_0xde3a('0x6c')](),_0x391f04);})[_0xde3a('0x15')](function(_0x24ab0f){_0x17a962['count']=_0x24ab0f['length'];if(_0x17a962[_0xde3a('0x10')]===0x0)return[];return db['sequelize'][_0xde3a('0x24')](_0x48d700[_0xde3a('0x6c')](),_0x391f04)['then'](function(_0x12d36b){_0xb7ea65=_[_0xde3a('0x6d')](_0x12d36b,'id');_0x391f04=_[_0xde3a('0x6e')](_0x391f04,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5955b0['query'][_0xde3a('0x28')]){_0x49474b[_0xde3a('0x27')]['forEach'](function(_0x1d5766){_0x49e30c[_0xde3a('0x2d')]('c.'+_0x1d5766);});}else{_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x6f'));_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x70'));_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x71'));_0x49e30c['field'](_0xde3a('0x72'));_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x73'));_0x49e30c['field'](_0xde3a('0x74'));_0x49e30c[_0xde3a('0x2d')]('c.email');_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x75'));_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x76'));_0x49e30c['field'](_0xde3a('0x77'));_0x49e30c[_0xde3a('0x2d')](_0xde3a('0x78'));_0x49e30c[_0xde3a('0x2d')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x49474b[_0xde3a('0xf')])_0x49e30c[_0xde3a('0xf')](_0x49474b[_0xde3a('0xf')]);if(_0x49474b[_0xde3a('0xd')])_0x49e30c[_0xde3a('0xd')](_0x49474b[_0xde3a('0xd')]);return db[_0xde3a('0x6b')][_0xde3a('0x24')](_0x49e30c['toString'](),_0x391f04);});})['then'](function(_0x446c15){_0x446c15[_0xde3a('0x40')](function(_0x4be5b9){if(_0x4be5b9[_0xde3a('0x79')]){_0x4be5b9['Tags']=[];_0x4be5b9[_0xde3a('0x79')]['split'](',')[_0xde3a('0x40')](function(_0x3a8c28){_0x4be5b9[_0xde3a('0x7a')][_0xde3a('0x4d')](_0xb7ea65[_0x3a8c28]);});}delete _0x4be5b9[_0xde3a('0x79')];});_0x17a962[_0xde3a('0x7b')]=_0x446c15;return _0x17a962;})[_0xde3a('0x15')](respondWithFilteredResult(_0x31d088,_0x49474b));})['catch'](handleError(_0x31d088,null));};exports[_0xde3a('0x16')]=function(_0x4a8412,_0x28a135){return db[_0xde3a('0x7c')]['find']({'where':{'id':_0x4a8412[_0xde3a('0x7d')]['id']}})[_0xde3a('0x15')](handleEntityNotFound(_0x28a135,null))[_0xde3a('0x15')](removeEntity(_0x28a135,null))['catch'](handleError(_0x28a135,null));};exports[_0xde3a('0x7e')]=function(_0x5d01ac,_0x3cbd71){return db['CmContact'][_0xde3a('0x7e')]()['then'](function(_0x3ac1fa){delete _0x3ac1fa['tags'];for(var _0x304ecb=0x0;_0x304ecb{}\s\\|]/g,'-');_0x1aa24b(null,util[_0xcad0('0x24')](_0xcad0('0x25'),path[_0xcad0('0x26')](_0x4ee514[_0xcad0('0x22')],path[_0xcad0('0x27')](_0x4ee514[_0xcad0('0x22')])),Date[_0xcad0('0x28')](),path[_0xcad0('0x27')](_0x4ee514[_0xcad0('0x22')])));}})});router[_0xcad0('0x19')]('/csv',upload[_0xcad0('0x29')](_0xcad0('0x2a')),controller[_0xcad0('0x2b')]);var upload=multer({'storage':multer[_0xcad0('0x1e')]({'destination':function(_0x5b772e,_0x655af2,_0xc41de8){_0xc41de8(null,path[_0xcad0('0x1f')](config[_0xcad0('0x20')],_0xcad0('0x21')));},'filename':function(_0x184112,_0x1a6e21,_0x253b90){_0x1a6e21[_0xcad0('0x22')]=_0x1a6e21[_0xcad0('0x22')][_0xcad0('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x253b90(null,util['format'](_0xcad0('0x25'),path[_0xcad0('0x26')](_0x1a6e21['originalname'],path[_0xcad0('0x27')](_0x1a6e21[_0xcad0('0x22')])),Date[_0xcad0('0x28')](),path[_0xcad0('0x27')](_0x1a6e21['originalname'])));}})});router[_0xcad0('0x19')](_0xcad0('0x2c'),upload[_0xcad0('0x29')]('file'),controller['upload']);router[_0xcad0('0x19')](_0xcad0('0x2d'),auth[_0xcad0('0xd')](),controller[_0xcad0('0x2e')]);router[_0xcad0('0x2f')]('/:id',auth[_0xcad0('0xd')](),controller['update']);router['delete'](_0xcad0('0xe'),auth[_0xcad0('0xd')](),controller['destroy']);module[_0xcad0('0x30')]=router; \ No newline at end of file +var _0x1712=['merge','create','/create_many','setTags','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','/csv','single','file','diskStorage','join','root','format','now','/upload','upload','/upload/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','./cmContact.controller','index','get','/describe','/:id','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post'];(function(_0x58c303,_0x44213a){var _0x5fb0c1=function(_0x4edda8){while(--_0x4edda8){_0x58c303['push'](_0x58c303['shift']());}};_0x5fb0c1(++_0x44213a);}(_0x1712,0x1a1));var _0x2171=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x1712[_0x2f0057];return _0x17f2c3;};'use strict';var multer=require('multer');var util=require(_0x2171('0x0'));var path=require(_0x2171('0x1'));var timeout=require('connect-timeout');var express=require(_0x2171('0x2'));var router=express[_0x2171('0x3')]();var fs_extra=require(_0x2171('0x4'));var auth=require(_0x2171('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2171('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2171('0x7')]);router[_0x2171('0x8')](_0x2171('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2171('0x8')](_0x2171('0xa'),auth['isAuthenticated'](),controller[_0x2171('0xb')]);router[_0x2171('0x8')](_0x2171('0xc'),auth[_0x2171('0xd')](),controller[_0x2171('0xe')]);router[_0x2171('0x8')](_0x2171('0xf'),auth[_0x2171('0xd')](),controller[_0x2171('0x10')]);router[_0x2171('0x8')]('/:id/hopper_histories',auth[_0x2171('0xd')](),controller[_0x2171('0x11')]);router[_0x2171('0x8')](_0x2171('0x12'),auth['isAuthenticated'](),controller[_0x2171('0x13')]);router[_0x2171('0x8')]('/:id/jscripty_sessions',auth[_0x2171('0xd')](),controller[_0x2171('0x14')]);router[_0x2171('0x8')](_0x2171('0x15'),auth['isAuthenticated'](),controller[_0x2171('0x16')]);router[_0x2171('0x17')]('/merge',auth[_0x2171('0xd')](),controller[_0x2171('0x18')]);router[_0x2171('0x17')]('/',auth[_0x2171('0xd')](),controller[_0x2171('0x19')]);router[_0x2171('0x17')](_0x2171('0x1a'),auth[_0x2171('0xd')](),controller['bulkCreate']);router[_0x2171('0x17')](_0x2171('0xc'),auth[_0x2171('0xd')](),controller[_0x2171('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x45657b,_0x414d91,_0x53c756){_0x53c756(null,path['join'](config['root'],_0x2171('0x1c')));},'filename':function(_0x329973,_0x2b420b,_0x1e8739){_0x2b420b[_0x2171('0x1d')]=_0x2b420b[_0x2171('0x1d')][_0x2171('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e8739(null,util['format'](_0x2171('0x1f'),path[_0x2171('0x20')](_0x2b420b['originalname'],path[_0x2171('0x21')](_0x2b420b['originalname'])),Date['now'](),path[_0x2171('0x21')](_0x2b420b[_0x2171('0x1d')])));}})});router[_0x2171('0x17')](_0x2171('0x22'),upload[_0x2171('0x23')](_0x2171('0x24')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x2171('0x25')]({'destination':function(_0x493e6b,_0x44a81c,_0x30ef2f){_0x30ef2f(null,path[_0x2171('0x26')](config[_0x2171('0x27')],_0x2171('0x1c')));},'filename':function(_0x40f09f,_0x1c1f60,_0x2ef0c9){_0x1c1f60['originalname']=_0x1c1f60['originalname'][_0x2171('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ef0c9(null,util[_0x2171('0x28')](_0x2171('0x1f'),path[_0x2171('0x20')](_0x1c1f60[_0x2171('0x1d')],path[_0x2171('0x21')](_0x1c1f60[_0x2171('0x1d')])),Date[_0x2171('0x29')](),path[_0x2171('0x21')](_0x1c1f60[_0x2171('0x1d')])));}})});router['post'](_0x2171('0x2a'),upload[_0x2171('0x23')](_0x2171('0x24')),controller[_0x2171('0x2b')]);router[_0x2171('0x17')](_0x2171('0x2c'),auth[_0x2171('0xd')](),controller['import']);router['put'](_0x2171('0xa'),auth[_0x2171('0xd')](),controller[_0x2171('0x2d')]);router[_0x2171('0x2e')](_0x2171('0xa'),auth[_0x2171('0xd')](),controller[_0x2171('0x2f')]);module[_0x2171('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index cc9673f..25283e1 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 _0xa3d0=['isArray','ENUM','voice','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','parse','values'];(function(_0x4d21c1,_0x1732cb){var _0x152c7f=function(_0x4d521c){while(--_0x4d521c){_0x4d21c1['push'](_0x4d21c1['shift']());}};_0x152c7f(++_0x1732cb);}(_0xa3d0,0xc7));var _0x0a3d=function(_0x11a9c8,_0x29b0d5){_0x11a9c8=_0x11a9c8-0x0;var _0x4a9b10=_0xa3d0[_0x11a9c8];return _0x4a9b10;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a3d('0x0')],'get':function(_0x4d72e5){return this[_0x0a3d('0x1')](_0x0a3d('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x383d6c){this[_0x0a3d('0x3')](_0x0a3d('0x2'),_0x383d6c?_0x383d6c:this[_0x0a3d('0x1')](_0x0a3d('0x4')));}},'type':{'type':Sequelize[_0x0a3d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x0a3d('0x6')](_0x0a3d('0x7')),'get':function(){if(this[_0x0a3d('0x1')](_0x0a3d('0x8'))==='select'){return JSON[_0x0a3d('0x9')](this[_0x0a3d('0x1')]('values'));}else{return this[_0x0a3d('0x1')](_0x0a3d('0xa'));}},'set':function(_0x29ec0d){if(Array[_0x0a3d('0xb')](_0x29ec0d)){this[_0x0a3d('0x3')]('values',JSON['stringify'](_0x29ec0d));}else{this[_0x0a3d('0x3')](_0x0a3d('0xa'),_0x29ec0d);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0a3d('0xc')](_0x0a3d('0xd'))}}; \ No newline at end of file +var _0x3158=['alias','STRING','getDataValue','name','TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL'];(function(_0xa5c64c,_0x329701){var _0x1b54e9=function(_0x27e76f){while(--_0x27e76f){_0xa5c64c['push'](_0xa5c64c['shift']());}};_0x1b54e9(++_0x329701);}(_0x3158,0xd8));var _0x8315=function(_0x4094c2,_0x4d06b4){_0x4094c2=_0x4094c2-0x0;var _0x414a9a=_0x3158[_0x4094c2];return _0x414a9a;};'use strict';var Sequelize=require(_0x8315('0x0'));var _=require(_0x8315('0x1'));module[_0x8315('0x2')]={'name':{'type':Sequelize[_0x8315('0x3')],'get':function(_0x1b7a7b){return this['getDataValue'](_0x8315('0x4'));}},'alias':{'type':Sequelize[_0x8315('0x5')],'allowNull':![],'set':function(_0x4f66ba){this['setDataValue'](_0x8315('0x4'),_0x4f66ba?_0x4f66ba:this[_0x8315('0x6')](_0x8315('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x8315('0x8')](_0x8315('0x9')),'get':function(){if(this[_0x8315('0x6')](_0x8315('0xa'))===_0x8315('0xb')){return JSON[_0x8315('0xc')](this[_0x8315('0x6')]('values'));}else{return this[_0x8315('0x6')](_0x8315('0xd'));}},'set':function(_0x1f0457){if(Array[_0x8315('0xe')](_0x1f0457)){this[_0x8315('0xf')](_0x8315('0xd'),JSON[_0x8315('0x10')](_0x1f0457));}else{this[_0x8315('0xf')](_0x8315('0xd'),_0x1f0457);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8315('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8315('0x12')](_0x8315('0x13'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d7b33db..662b485 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 _0x5c2a=['CmCustomField','rawAttributes','key','differenceBy','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','update','body','destroy','transaction','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','save','then','end','sendStatus','error','stack','name','send','index'];(function(_0x25207d,_0x5cce53){var _0x547923=function(_0x12d6a4){while(--_0x12d6a4){_0x25207d['push'](_0x25207d['shift']());}};_0x547923(++_0x5cce53);}(_0x5c2a,0x187));var _0xa5c2=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x5c2a[_0x254abd];return _0x31bf1b;};'use strict';var emlformat=require(_0xa5c2('0x0'));var rimraf=require(_0xa5c2('0x1'));var zipdir=require(_0xa5c2('0x2'));var jsonpatch=require(_0xa5c2('0x3'));var rp=require(_0xa5c2('0x4'));var moment=require(_0xa5c2('0x5'));var BPromise=require(_0xa5c2('0x6'));var Mustache=require(_0xa5c2('0x7'));var util=require(_0xa5c2('0x8'));var path=require(_0xa5c2('0x9'));var sox=require(_0xa5c2('0xa'));var csv=require(_0xa5c2('0xb'));var ejs=require(_0xa5c2('0xc'));var fs=require('fs');var fs_extra=require(_0xa5c2('0xd'));var _=require(_0xa5c2('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5c2('0xf'));var toCsv=require(_0xa5c2('0xb'));var querystring=require('querystring');var Papa=require(_0xa5c2('0x10'));var Redis=require('ioredis');var authService=require(_0xa5c2('0x11'));var qs=require(_0xa5c2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5c2('0x13'));var logger=require(_0xa5c2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa5c2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5c2('0x16'))['db'];function respondWithStatusCode(_0x524588,_0x4c4302){_0x4c4302=_0x4c4302||0xcc;return function(_0x4aff0c){if(_0x4aff0c){return _0x524588['sendStatus'](_0x4c4302);}return _0x524588[_0xa5c2('0x17')](_0x4c4302)['end']();};}function respondWithResult(_0x574139,_0x150b41){_0x150b41=_0x150b41||0xc8;return function(_0x2bcb48){if(_0x2bcb48){return _0x574139['status'](_0x150b41)[_0xa5c2('0x18')](_0x2bcb48);}};}function respondWithFilteredResult(_0x126556,_0x190f05){return function(_0x28b2a0){if(_0x28b2a0){var _0x18a7a8=typeof _0x190f05[_0xa5c2('0x19')]===_0xa5c2('0x1a')&&typeof _0x190f05['limit']==='undefined';var _0x4b7ed6=_0x28b2a0['count'];var _0x2388a1=_0x18a7a8?0x0:_0x190f05[_0xa5c2('0x19')];var _0x40ef56=_0x18a7a8?_0x28b2a0[_0xa5c2('0x1b')]:_0x190f05[_0xa5c2('0x19')]+_0x190f05['limit'];var _0x31e689;if(_0x40ef56>=_0x4b7ed6){_0x40ef56=_0x4b7ed6;_0x31e689=0xc8;}else{_0x31e689=0xce;}_0x126556['status'](_0x31e689);return _0x126556['set'](_0xa5c2('0x1c'),_0x2388a1+'-'+_0x40ef56+'/'+_0x4b7ed6)[_0xa5c2('0x18')](_0x28b2a0);}return null;};}function patchUpdates(_0x420262){return function(_0x32af70){try{jsonpatch[_0xa5c2('0x1d')](_0x32af70,_0x420262,!![]);}catch(_0xde65cc){return BPromise['reject'](_0xde65cc);}return _0x32af70[_0xa5c2('0x1e')]();};}function saveUpdates(_0x3463bc,_0x386627){return function(_0x215d5f){if(_0x215d5f){return _0x215d5f['update'](_0x3463bc)[_0xa5c2('0x1f')](function(_0x5eed30){return _0x5eed30;});}return null;};}function removeEntity(_0x24294b,_0x26627e){return function(_0x4c3f2c){if(_0x4c3f2c){return _0x4c3f2c['destroy']()[_0xa5c2('0x1f')](function(){_0x24294b['status'](0xcc)[_0xa5c2('0x20')]();});}};}function handleEntityNotFound(_0x554621,_0x59eaa6){return function(_0x133dbb){if(!_0x133dbb){_0x554621[_0xa5c2('0x21')](0x194);}return _0x133dbb;};}function handleError(_0x49d62c,_0x463721){_0x463721=_0x463721||0x1f4;return function(_0x213e19){logger[_0xa5c2('0x22')](_0x213e19[_0xa5c2('0x23')]);if(_0x213e19['name']){delete _0x213e19[_0xa5c2('0x24')];}_0x49d62c[_0xa5c2('0x17')](_0x463721)[_0xa5c2('0x25')](_0x213e19);};}exports[_0xa5c2('0x26')]=function(_0x481fd0,_0x416f19){var _0x443603={},_0x53659a={},_0x5bf6b3={'count':0x0,'rows':[]};var _0x4a9433=_['map'](db[_0xa5c2('0x27')][_0xa5c2('0x28')],function(_0x440241){return{'name':_0x440241['fieldName'],'type':_0x440241['type'][_0xa5c2('0x29')]};});_0x53659a['model']=_[_0xa5c2('0x2a')](_['map'](_0x4a9433,_0xa5c2('0x24')),[_0xa5c2('0x24')]);_0x53659a['query']=_['keys'](_0x481fd0['query']);_0x53659a[_0xa5c2('0x2b')]=_['intersection'](_0x53659a[_0xa5c2('0x2c')],_0x53659a[_0xa5c2('0x2d')]);_0x443603[_0xa5c2('0x2e')]=_[_0xa5c2('0x2f')](_0x53659a['model'],qs[_0xa5c2('0x30')](_0x481fd0['query'][_0xa5c2('0x30')]));_0x443603[_0xa5c2('0x2e')]=_0x443603['attributes'][_0xa5c2('0x31')]?_0x443603['attributes']:_0x53659a['model'];if(!_0x481fd0[_0xa5c2('0x2d')][_0xa5c2('0x32')](_0xa5c2('0x33'))){_0x443603[_0xa5c2('0x34')]=qs[_0xa5c2('0x34')](_0x481fd0[_0xa5c2('0x2d')]['limit']);_0x443603[_0xa5c2('0x19')]=qs['offset'](_0x481fd0[_0xa5c2('0x2d')]['offset']);}_0x443603[_0xa5c2('0x35')]=qs[_0xa5c2('0x36')](_0x481fd0[_0xa5c2('0x2d')][_0xa5c2('0x36')]);_0x443603['where']=qs[_0xa5c2('0x2b')](_[_0xa5c2('0x37')](_0x481fd0['query'],_0x53659a[_0xa5c2('0x2b')]),_0x4a9433);if(_0x481fd0[_0xa5c2('0x2d')]['filter']){_0x443603[_0xa5c2('0x38')]=_['merge'](_0x443603['where'],{'$or':_['map'](_0x4a9433,function(_0x348ec8){if(_0x348ec8[_0xa5c2('0x39')]!==_0xa5c2('0x3a')){var _0x1fb4d2={};_0x1fb4d2[_0x348ec8[_0xa5c2('0x24')]]={'$like':'%'+_0x481fd0[_0xa5c2('0x2d')]['filter']+'%'};return _0x1fb4d2;}})});}_0x443603=_[_0xa5c2('0x3b')]({},_0x443603,_0x481fd0[_0xa5c2('0x3c')]);var _0x4e8550={'where':_0x443603[_0xa5c2('0x38')]};return db[_0xa5c2('0x27')][_0xa5c2('0x1b')](_0x4e8550)[_0xa5c2('0x1f')](function(_0x5e629){_0x5bf6b3[_0xa5c2('0x1b')]=_0x5e629;if(_0x481fd0[_0xa5c2('0x2d')][_0xa5c2('0x3d')]){_0x443603[_0xa5c2('0x3e')]=[{'all':!![]}];}return db[_0xa5c2('0x27')][_0xa5c2('0x3f')](_0x443603);})[_0xa5c2('0x1f')](function(_0x4e72fe){_0x5bf6b3['rows']=_0x4e72fe;return _0x5bf6b3;})[_0xa5c2('0x1f')](respondWithFilteredResult(_0x416f19,_0x443603))[_0xa5c2('0x40')](handleError(_0x416f19,null));};exports[_0xa5c2('0x41')]=function(_0x17693d,_0x2f514a){var _0x2bb2ba={'raw':!![],'where':{'id':_0x17693d[_0xa5c2('0x42')]['id']}},_0x199f34={};_0x199f34[_0xa5c2('0x2c')]=_['keys'](db[_0xa5c2('0x27')]['rawAttributes']);_0x199f34[_0xa5c2('0x2d')]=_[_0xa5c2('0x43')](_0x17693d[_0xa5c2('0x2d')]);_0x199f34['filters']=_['intersection'](_0x199f34[_0xa5c2('0x2c')],_0x199f34[_0xa5c2('0x2d')]);_0x2bb2ba[_0xa5c2('0x2e')]=_[_0xa5c2('0x2f')](_0x199f34['model'],qs[_0xa5c2('0x30')](_0x17693d[_0xa5c2('0x2d')][_0xa5c2('0x30')]));_0x2bb2ba[_0xa5c2('0x2e')]=_0x2bb2ba[_0xa5c2('0x2e')][_0xa5c2('0x31')]?_0x2bb2ba[_0xa5c2('0x2e')]:_0x199f34[_0xa5c2('0x2c')];if(_0x17693d['query'][_0xa5c2('0x3d')]){_0x2bb2ba['include']=[{'all':!![]}];}_0x2bb2ba=_[_0xa5c2('0x3b')]({},_0x2bb2ba,_0x17693d[_0xa5c2('0x3c')]);return db[_0xa5c2('0x27')][_0xa5c2('0x44')](_0x2bb2ba)[_0xa5c2('0x1f')](handleEntityNotFound(_0x2f514a,null))[_0xa5c2('0x1f')](respondWithResult(_0x2f514a,null))[_0xa5c2('0x40')](handleError(_0x2f514a,null));};exports[_0xa5c2('0x45')]=function(_0x4eb772,_0x15cd03){if(_0x4eb772[_0xa5c2('0x46')]['id']){delete _0x4eb772[_0xa5c2('0x46')]['id'];}return db[_0xa5c2('0x27')][_0xa5c2('0x44')]({'where':{'id':_0x4eb772[_0xa5c2('0x42')]['id']}})[_0xa5c2('0x1f')](handleEntityNotFound(_0x15cd03,null))[_0xa5c2('0x1f')](saveUpdates(_0x4eb772['body'],null))[_0xa5c2('0x1f')](respondWithResult(_0x15cd03,null))[_0xa5c2('0x40')](handleError(_0x15cd03,null));};exports[_0xa5c2('0x47')]=function(_0x44bf19,_0x428728){return db[_0xa5c2('0x27')][_0xa5c2('0x44')]({'where':{'id':_0x44bf19[_0xa5c2('0x42')]['id']}})[_0xa5c2('0x1f')](handleEntityNotFound(_0x428728,null))[_0xa5c2('0x1f')](removeEntity(_0x428728,null))[_0xa5c2('0x40')](handleError(_0x428728,null));};exports['create']=function(_0x1d4ad4,_0x4474f6){var _0x46f7f4;return db['sequelize'][_0xa5c2('0x48')](function(_0x28eff5){return db[_0xa5c2('0x27')][_0xa5c2('0x49')](_0x1d4ad4[_0xa5c2('0x46')],{'transaction':_0x28eff5})[_0xa5c2('0x1f')](function(_0x3eb7c1){_0x46f7f4=_0x3eb7c1;var _0x266520={'type':db[_0xa5c2('0x4a')][_0xa5c2('0x4b')],'transaction':_0x28eff5};switch(_0x1d4ad4['body']['type']){case'text':_0x266520[_0xa5c2('0x39')]=db[_0xa5c2('0x4a')]['TEXT'];break;case _0xa5c2('0x4c'):_0x266520[_0xa5c2('0x39')]=db['Sequelize'][_0xa5c2('0x4d')];break;case _0xa5c2('0x4e'):_0x266520[_0xa5c2('0x39')]=db[_0xa5c2('0x4a')][_0xa5c2('0x4f')];_0x266520[_0xa5c2('0x50')]=![];break;default:}return db[_0xa5c2('0x51')][_0xa5c2('0x52')][_0xa5c2('0x53')]('cm_contacts',util[_0xa5c2('0x54')](_0xa5c2('0x55'),_0x46f7f4['id']),_0x266520);})[_0xa5c2('0x1f')](function(){return _0x46f7f4;});})['then'](respondWithResult(_0x4474f6,0xc9))[_0xa5c2('0x40')](handleError(_0x4474f6,null));}; \ No newline at end of file +var _0xce86=['json','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','sequelize','transaction','Sequelize','type','text','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','Content-Range'];(function(_0x1f6cf9,_0x2f735a){var _0x418e03=function(_0x2cad42){while(--_0x2cad42){_0x1f6cf9['push'](_0x1f6cf9['shift']());}};_0x418e03(++_0x2f735a);}(_0xce86,0x19b));var _0x6ce8=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xce86[_0x16337a];return _0x422365;};'use strict';var emlformat=require(_0x6ce8('0x0'));var rimraf=require(_0x6ce8('0x1'));var zipdir=require(_0x6ce8('0x2'));var jsonpatch=require(_0x6ce8('0x3'));var rp=require(_0x6ce8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ce8('0x5'));var util=require('util');var path=require(_0x6ce8('0x6'));var sox=require(_0x6ce8('0x7'));var csv=require(_0x6ce8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ce8('0x9'));var _=require('lodash');var squel=require(_0x6ce8('0xa'));var crypto=require(_0x6ce8('0xb'));var jsforce=require(_0x6ce8('0xc'));var deskjs=require(_0x6ce8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6ce8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ce8('0xf'));var hardwareService=require(_0x6ce8('0x10'));var logger=require('../../config/logger')(_0x6ce8('0x11'));var utils=require(_0x6ce8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6ce8('0x13'));var db=require(_0x6ce8('0x14'))['db'];function respondWithStatusCode(_0x18489f,_0x3cf5ce){_0x3cf5ce=_0x3cf5ce||0xcc;return function(_0x191857){if(_0x191857){return _0x18489f[_0x6ce8('0x15')](_0x3cf5ce);}return _0x18489f['status'](_0x3cf5ce)[_0x6ce8('0x16')]();};}function respondWithResult(_0x34d08a,_0x4c71fd){_0x4c71fd=_0x4c71fd||0xc8;return function(_0x19a1f7){if(_0x19a1f7){return _0x34d08a['status'](_0x4c71fd)['json'](_0x19a1f7);}};}function respondWithFilteredResult(_0x23b38d,_0x2b9f54){return function(_0x573215){if(_0x573215){var _0xa84390=typeof _0x2b9f54[_0x6ce8('0x17')]==='undefined'&&typeof _0x2b9f54[_0x6ce8('0x18')]===_0x6ce8('0x19');var _0x3280d8=_0x573215[_0x6ce8('0x1a')];var _0x9bdd27=_0xa84390?0x0:_0x2b9f54[_0x6ce8('0x17')];var _0xbde430=_0xa84390?_0x573215[_0x6ce8('0x1a')]:_0x2b9f54[_0x6ce8('0x17')]+_0x2b9f54[_0x6ce8('0x18')];var _0x167876;if(_0xbde430>=_0x3280d8){_0xbde430=_0x3280d8;_0x167876=0xc8;}else{_0x167876=0xce;}_0x23b38d[_0x6ce8('0x1b')](_0x167876);return _0x23b38d['set'](_0x6ce8('0x1c'),_0x9bdd27+'-'+_0xbde430+'/'+_0x3280d8)[_0x6ce8('0x1d')](_0x573215);}return null;};}function patchUpdates(_0x3e6191){return function(_0x455a8e){try{jsonpatch['apply'](_0x455a8e,_0x3e6191,!![]);}catch(_0x5cfdf1){return BPromise[_0x6ce8('0x1e')](_0x5cfdf1);}return _0x455a8e[_0x6ce8('0x1f')]();};}function saveUpdates(_0x1fb3ad,_0x383d43){return function(_0x3d04a7){if(_0x3d04a7){return _0x3d04a7[_0x6ce8('0x20')](_0x1fb3ad)[_0x6ce8('0x21')](function(_0x2c5c5b){return _0x2c5c5b;});}return null;};}function removeEntity(_0x2315dc,_0x118aaf){return function(_0x4823bf){if(_0x4823bf){return _0x4823bf[_0x6ce8('0x22')]()['then'](function(){_0x2315dc['status'](0xcc)[_0x6ce8('0x16')]();});}};}function handleEntityNotFound(_0x996a80,_0x19582d){return function(_0x5a5227){if(!_0x5a5227){_0x996a80[_0x6ce8('0x15')](0x194);}return _0x5a5227;};}function handleError(_0x418b50,_0x508e92){_0x508e92=_0x508e92||0x1f4;return function(_0x41809c){logger[_0x6ce8('0x23')](_0x41809c[_0x6ce8('0x24')]);if(_0x41809c['name']){delete _0x41809c[_0x6ce8('0x25')];}_0x418b50['status'](_0x508e92)[_0x6ce8('0x26')](_0x41809c);};}exports[_0x6ce8('0x27')]=function(_0x37c643,_0x2eabb6){var _0x2dffae={},_0x277875={},_0x1936f0={'count':0x0,'rows':[]};var _0x5e71f8=_[_0x6ce8('0x28')](db[_0x6ce8('0x29')]['rawAttributes'],function(_0x108ac2){return{'name':_0x108ac2[_0x6ce8('0x2a')],'type':_0x108ac2['type'][_0x6ce8('0x2b')]};});_0x277875[_0x6ce8('0x2c')]=_[_0x6ce8('0x2d')](_['map'](_0x5e71f8,_0x6ce8('0x25')),['name']);_0x277875[_0x6ce8('0x2e')]=_[_0x6ce8('0x2f')](_0x37c643[_0x6ce8('0x2e')]);_0x277875[_0x6ce8('0x30')]=_[_0x6ce8('0x31')](_0x277875[_0x6ce8('0x2c')],_0x277875['query']);_0x2dffae[_0x6ce8('0x32')]=_[_0x6ce8('0x31')](_0x277875[_0x6ce8('0x2c')],qs[_0x6ce8('0x33')](_0x37c643['query'][_0x6ce8('0x33')]));_0x2dffae[_0x6ce8('0x32')]=_0x2dffae[_0x6ce8('0x32')][_0x6ce8('0x34')]?_0x2dffae[_0x6ce8('0x32')]:_0x277875['model'];if(!_0x37c643[_0x6ce8('0x2e')][_0x6ce8('0x35')](_0x6ce8('0x36'))){_0x2dffae[_0x6ce8('0x18')]=qs[_0x6ce8('0x18')](_0x37c643[_0x6ce8('0x2e')][_0x6ce8('0x18')]);_0x2dffae['offset']=qs[_0x6ce8('0x17')](_0x37c643[_0x6ce8('0x2e')][_0x6ce8('0x17')]);}_0x2dffae[_0x6ce8('0x37')]=qs[_0x6ce8('0x38')](_0x37c643['query'][_0x6ce8('0x38')]);_0x2dffae[_0x6ce8('0x39')]=qs['filters'](_[_0x6ce8('0x3a')](_0x37c643[_0x6ce8('0x2e')],_0x277875[_0x6ce8('0x30')]),_0x5e71f8);if(_0x37c643['query'][_0x6ce8('0x3b')]){_0x2dffae[_0x6ce8('0x39')]=_[_0x6ce8('0x3c')](_0x2dffae['where'],{'$or':_[_0x6ce8('0x28')](_0x5e71f8,function(_0x21a640){if(_0x21a640['type']!==_0x6ce8('0x3d')){var _0x36cda0={};_0x36cda0[_0x21a640['name']]={'$like':'%'+_0x37c643[_0x6ce8('0x2e')]['filter']+'%'};return _0x36cda0;}})});}_0x2dffae=_[_0x6ce8('0x3c')]({},_0x2dffae,_0x37c643[_0x6ce8('0x3e')]);var _0x5cab16={'where':_0x2dffae[_0x6ce8('0x39')]};return db[_0x6ce8('0x29')][_0x6ce8('0x1a')](_0x5cab16)[_0x6ce8('0x21')](function(_0x53ad6a){_0x1936f0[_0x6ce8('0x1a')]=_0x53ad6a;if(_0x37c643[_0x6ce8('0x2e')][_0x6ce8('0x3f')]){_0x2dffae[_0x6ce8('0x40')]=[{'all':!![]}];}return db[_0x6ce8('0x29')][_0x6ce8('0x41')](_0x2dffae);})[_0x6ce8('0x21')](function(_0x5b5214){_0x1936f0[_0x6ce8('0x42')]=_0x5b5214;return _0x1936f0;})[_0x6ce8('0x21')](respondWithFilteredResult(_0x2eabb6,_0x2dffae))[_0x6ce8('0x43')](handleError(_0x2eabb6,null));};exports[_0x6ce8('0x44')]=function(_0x2fb1e6,_0x1d248b){var _0x5bb769={'raw':!![],'where':{'id':_0x2fb1e6[_0x6ce8('0x45')]['id']}},_0x56fb9c={};_0x56fb9c[_0x6ce8('0x2c')]=_[_0x6ce8('0x2f')](db[_0x6ce8('0x29')][_0x6ce8('0x46')]);_0x56fb9c[_0x6ce8('0x2e')]=_[_0x6ce8('0x2f')](_0x2fb1e6[_0x6ce8('0x2e')]);_0x56fb9c[_0x6ce8('0x30')]=_[_0x6ce8('0x31')](_0x56fb9c[_0x6ce8('0x2c')],_0x56fb9c[_0x6ce8('0x2e')]);_0x5bb769[_0x6ce8('0x32')]=_['intersection'](_0x56fb9c[_0x6ce8('0x2c')],qs[_0x6ce8('0x33')](_0x2fb1e6[_0x6ce8('0x2e')][_0x6ce8('0x33')]));_0x5bb769[_0x6ce8('0x32')]=_0x5bb769[_0x6ce8('0x32')][_0x6ce8('0x34')]?_0x5bb769[_0x6ce8('0x32')]:_0x56fb9c['model'];if(_0x2fb1e6['query'][_0x6ce8('0x3f')]){_0x5bb769['include']=[{'all':!![]}];}_0x5bb769=_['merge']({},_0x5bb769,_0x2fb1e6[_0x6ce8('0x3e')]);return db['CmCustomField'][_0x6ce8('0x47')](_0x5bb769)[_0x6ce8('0x21')](handleEntityNotFound(_0x1d248b,null))[_0x6ce8('0x21')](respondWithResult(_0x1d248b,null))[_0x6ce8('0x43')](handleError(_0x1d248b,null));};exports[_0x6ce8('0x20')]=function(_0x2be115,_0x170c35){if(_0x2be115[_0x6ce8('0x48')]['id']){delete _0x2be115[_0x6ce8('0x48')]['id'];}return db[_0x6ce8('0x29')]['find']({'where':{'id':_0x2be115[_0x6ce8('0x45')]['id']}})[_0x6ce8('0x21')](handleEntityNotFound(_0x170c35,null))[_0x6ce8('0x21')](saveUpdates(_0x2be115[_0x6ce8('0x48')],null))['then'](respondWithResult(_0x170c35,null))[_0x6ce8('0x43')](handleError(_0x170c35,null));};exports[_0x6ce8('0x22')]=function(_0x4ad066,_0x19ef92){return db[_0x6ce8('0x29')][_0x6ce8('0x47')]({'where':{'id':_0x4ad066[_0x6ce8('0x45')]['id']}})['then'](handleEntityNotFound(_0x19ef92,null))[_0x6ce8('0x21')](removeEntity(_0x19ef92,null))[_0x6ce8('0x43')](handleError(_0x19ef92,null));};exports['create']=function(_0xd4039a,_0x576085){var _0x343589;return db[_0x6ce8('0x49')][_0x6ce8('0x4a')](function(_0x543b2b){return db[_0x6ce8('0x29')]['create'](_0xd4039a[_0x6ce8('0x48')],{'transaction':_0x543b2b})[_0x6ce8('0x21')](function(_0x269c90){_0x343589=_0x269c90;var _0x4f5ee6={'type':db[_0x6ce8('0x4b')]['TEXT'],'transaction':_0x543b2b};switch(_0xd4039a[_0x6ce8('0x48')][_0x6ce8('0x4c')]){case _0x6ce8('0x4d'):_0x4f5ee6['type']=db['Sequelize'][_0x6ce8('0x4e')];break;case _0x6ce8('0x4f'):_0x4f5ee6['type']=db[_0x6ce8('0x4b')][_0x6ce8('0x50')];break;case'switch':_0x4f5ee6['type']=db['Sequelize'][_0x6ce8('0x51')];_0x4f5ee6[_0x6ce8('0x52')]=![];break;default:}return db[_0x6ce8('0x49')][_0x6ce8('0x53')][_0x6ce8('0x54')](_0x6ce8('0x55'),util[_0x6ce8('0x56')](_0x6ce8('0x57'),_0x343589['id']),_0x4f5ee6);})['then'](function(){return _0x343589;});})['then'](respondWithResult(_0x576085,0xc9))[_0x6ce8('0x43')](handleError(_0x576085,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5f8c0b4..c83b1d0 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 _0xca90=['CmCustomField','cm_custom_fields','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x453dc0,_0x3ef716){var _0x371d8a=function(_0x5616c0){while(--_0x5616c0){_0x453dc0['push'](_0x453dc0['shift']());}};_0x371d8a(++_0x3ef716);}(_0xca90,0x134));var _0x0ca9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xca90[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ca9('0x0'))('api');var moment=require(_0x0ca9('0x1'));var BPromise=require(_0x0ca9('0x2'));var rp=require(_0x0ca9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0ca9('0x4'));var attributes=require(_0x0ca9('0x5'));module[_0x0ca9('0x6')]=function(_0x2e324c,_0x57c8e5){return _0x2e324c['define'](_0x0ca9('0x7'),attributes,{'tableName':_0x0ca9('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ee0=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x1ee0,0x67));var _0x01ee=function(_0x38e6cd,_0x32637b){_0x38e6cd=_0x38e6cd-0x0;var _0x2fa526=_0x1ee0[_0x38e6cd];return _0x2fa526;};'use strict';var _=require(_0x01ee('0x0'));var util=require(_0x01ee('0x1'));var logger=require(_0x01ee('0x2'))(_0x01ee('0x3'));var moment=require(_0x01ee('0x4'));var BPromise=require(_0x01ee('0x5'));var rp=require(_0x01ee('0x6'));var fs=require('fs');var path=require(_0x01ee('0x7'));var rimraf=require('rimraf');var config=require(_0x01ee('0x8'));var attributes=require(_0x01ee('0x9'));module[_0x01ee('0xa')]=function(_0x460735,_0x1159e1){return _0x460735[_0x01ee('0xb')](_0x01ee('0xc'),attributes,{'tableName':_0x01ee('0xd'),'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 cdb45c5..fdf8dda 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 _0x2ca8=['rpc','../../config/environment','jayson/promise','client','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x38f842,_0x57fef8){var _0x222432=function(_0x3d27a6){while(--_0x3d27a6){_0x38f842['push'](_0x38f842['shift']());}};_0x222432(++_0x57fef8);}(_0x2ca8,0x12b));var _0x82ca=function(_0x1372d7,_0x1cdd6f){_0x1372d7=_0x1372d7-0x0;var _0x3293c5=_0x2ca8[_0x1372d7];return _0x3293c5;};'use strict';var _=require(_0x82ca('0x0'));var util=require(_0x82ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82ca('0x2'));var db=require(_0x82ca('0x3'))['db'];var utils=require(_0x82ca('0x4'));var logger=require('../../config/logger')(_0x82ca('0x5'));var config=require(_0x82ca('0x6'));var jayson=require(_0x82ca('0x7'));var client=jayson[_0x82ca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a763a,_0x4b797e,_0xe994e7){return new BPromise(function(_0x3e192d,_0x42bfca){return client['request'](_0x4a763a,_0xe994e7)['then'](function(_0x19078a){logger['info'](_0x82ca('0x9'),_0x4b797e,_0x82ca('0xa'));logger[_0x82ca('0xb')](_0x82ca('0xc'),_0x4b797e,_0x82ca('0xa'),JSON[_0x82ca('0xd')](_0x19078a));if(_0x19078a[_0x82ca('0xe')]){if(_0x19078a[_0x82ca('0xe')]['code']===0x1f4){logger[_0x82ca('0xe')]('CmCustomField,\x20%s,\x20%s',_0x4b797e,_0x19078a[_0x82ca('0xe')][_0x82ca('0xf')]);return _0x42bfca(_0x19078a['error'][_0x82ca('0xf')]);}logger[_0x82ca('0xe')](_0x82ca('0x9'),_0x4b797e,_0x19078a[_0x82ca('0xe')]['message']);return _0x3e192d(_0x19078a[_0x82ca('0xe')][_0x82ca('0xf')]);}else{logger[_0x82ca('0x10')]('CmCustomField,\x20%s,\x20%s',_0x4b797e,'request\x20sent');_0x3e192d(_0x19078a[_0x82ca('0x11')][_0x82ca('0xf')]);}})[_0x82ca('0x12')](function(_0x9b9855){logger[_0x82ca('0xe')](_0x82ca('0x9'),_0x4b797e,_0x9b9855);_0x42bfca(_0x9b9855);});});} \ No newline at end of file +var _0x1122=['CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3d9498,_0x268f2a){var _0x1db6ea=function(_0x4a5f91){while(--_0x4a5f91){_0x3d9498['push'](_0x3d9498['shift']());}};_0x1db6ea(++_0x268f2a);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var moment=require(_0x2112('0x1'));var BPromise=require(_0x2112('0x2'));var rs=require(_0x2112('0x3'));var fs=require('fs');var Redis=require(_0x2112('0x4'));var db=require(_0x2112('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2112('0x6'));var config=require('../../config/environment');var jayson=require(_0x2112('0x7'));var client=jayson[_0x2112('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcca285,_0x2ad731,_0x3f0a81){return new BPromise(function(_0x272bdb,_0x4190c7){return client[_0x2112('0x9')](_0xcca285,_0x3f0a81)[_0x2112('0xa')](function(_0x2f7142){logger[_0x2112('0xb')]('CmCustomField,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));logger[_0x2112('0xd')](_0x2112('0xe'),_0x2ad731,_0x2112('0xc'),JSON['stringify'](_0x2f7142));if(_0x2f7142[_0x2112('0xf')]){if(_0x2f7142[_0x2112('0xf')][_0x2112('0x10')]===0x1f4){logger[_0x2112('0xf')](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')][_0x2112('0x12')]);return _0x4190c7(_0x2f7142['error'][_0x2112('0x12')]);}logger['error'](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')]['message']);return _0x272bdb(_0x2f7142[_0x2112('0xf')]['message']);}else{logger[_0x2112('0xb')]('CmCustomField,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));_0x272bdb(_0x2f7142[_0x2112('0x13')]['message']);}})[_0x2112('0x14')](function(_0x4db5c3){logger[_0x2112('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2ad731,_0x4db5c3);_0x4190c7(_0x4db5c3);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1456ba2..599a5f7 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 _0x6d4f=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','show','create','put'];(function(_0x359377,_0x1a63ef){var _0x8be18a=function(_0x246390){while(--_0x246390){_0x359377['push'](_0x359377['shift']());}};_0x8be18a(++_0x1a63ef);}(_0x6d4f,0x121));var _0xf6d4=function(_0x1907cd,_0x202496){_0x1907cd=_0x1907cd-0x0;var _0xc77506=_0x6d4f[_0x1907cd];return _0xc77506;};'use strict';var multer=require(_0xf6d4('0x0'));var util=require(_0xf6d4('0x1'));var path=require(_0xf6d4('0x2'));var timeout=require(_0xf6d4('0x3'));var express=require(_0xf6d4('0x4'));var router=express[_0xf6d4('0x5')]();var fs_extra=require(_0xf6d4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf6d4('0x7'));var config=require(_0xf6d4('0x8'));var controller=require(_0xf6d4('0x9'));router[_0xf6d4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf6d4('0xa')](_0xf6d4('0xb'),auth['isAuthenticated'](),controller[_0xf6d4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf6d4('0xd')]);router[_0xf6d4('0xe')](_0xf6d4('0xb'),auth[_0xf6d4('0xf')](),controller[_0xf6d4('0x10')]);router['delete'](_0xf6d4('0xb'),auth['isAuthenticated'](),controller[_0xf6d4('0x11')]);module[_0xf6d4('0x12')]=router; \ No newline at end of file +var _0x3d9f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','show','post','isAuthenticated','create','put','/:id','delete','destroy'];(function(_0xfe328a,_0x40602a){var _0x54d9a4=function(_0x591e40){while(--_0x591e40){_0xfe328a['push'](_0xfe328a['shift']());}};_0x54d9a4(++_0x40602a);}(_0x3d9f,0xd2));var _0xf3d9=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3d9f[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xf3d9('0x0'));var util=require(_0xf3d9('0x1'));var path=require(_0xf3d9('0x2'));var timeout=require(_0xf3d9('0x3'));var express=require(_0xf3d9('0x4'));var router=express[_0xf3d9('0x5')]();var fs_extra=require(_0xf3d9('0x6'));var auth=require(_0xf3d9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xf3d9('0x8')]('/',auth['isAuthenticated'](),controller[_0xf3d9('0x9')]);router[_0xf3d9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf3d9('0xa')]);router[_0xf3d9('0xb')]('/',auth[_0xf3d9('0xc')](),controller[_0xf3d9('0xd')]);router[_0xf3d9('0xe')](_0xf3d9('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf3d9('0x10')](_0xf3d9('0xf'),auth[_0xf3d9('0xc')](),controller[_0xf3d9('0x11')]);module[_0xf3d9('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c581b63..d2a4320 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 _0xefe3=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports','BOOLEAN'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xefe3,0xd0));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3efe('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x3efe('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3efe('0x2')],'defaultValue':moment()['format'](_0x3efe('0x3'))},'countbusyretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3efe('0x2')]},'priority':{'type':Sequelize[_0x3efe('0x4')](0x2)[_0x3efe('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3efe('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3efe('0x4')],'unique':_0x3efe('0x6')},'UserId':{'type':Sequelize[_0x3efe('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x3efe('0x4')],'unique':_0x3efe('0x6')},'CampaignId':{'type':Sequelize[_0x3efe('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3efe('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd250=['STRING','UNSIGNED','contactListQueue','moment','exports','BOOLEAN','DATE','format','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd250,0x198));var _0x0d25=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0xd250[_0x3d5351];return _0x1db4db;};'use strict';var moment=require(_0x0d25('0x0'));var Sequelize=require('sequelize');module[_0x0d25('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x0d25('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0d25('0x3')],'defaultValue':moment()[_0x0d25('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x0d25('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0d25('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0d25('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0d25('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0d25('0x3')]},'priority':{'type':Sequelize[_0x0d25('0x5')](0x2)[_0x0d25('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0d25('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0d25('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x0d25('0x5')],'unique':_0x0d25('0x8')},'UserId':{'type':Sequelize[_0x0d25('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x0d25('0x5')],'unique':_0x0d25('0x8')},'CampaignId':{'type':Sequelize[_0x0d25('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0d25('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0d25('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0d25('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0d25('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 48924ef..2e2c558 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 _0xed01=['create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','statedesc','deleted','membername','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','format','getOpenContacts','entity\x20not\x20found','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x96834,_0x292346){var _0x2252cf=function(_0x54762d){while(--_0x54762d){_0x96834['push'](_0x96834['shift']());}};_0x2252cf(++_0x292346);}(_0xed01,0xd0));var _0x1ed0=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0xed01[_0x64b31d];return _0x42c45b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1ed0('0x0'));var jsonpatch=require(_0x1ed0('0x1'));var rp=require(_0x1ed0('0x2'));var moment=require(_0x1ed0('0x3'));var BPromise=require(_0x1ed0('0x4'));var Mustache=require(_0x1ed0('0x5'));var util=require(_0x1ed0('0x6'));var path=require('path');var sox=require(_0x1ed0('0x7'));var csv=require(_0x1ed0('0x8'));var ejs=require(_0x1ed0('0x9'));var fs=require('fs');var fs_extra=require(_0x1ed0('0xa'));var _=require(_0x1ed0('0xb'));var squel=require(_0x1ed0('0xc'));var crypto=require(_0x1ed0('0xd'));var jsforce=require(_0x1ed0('0xe'));var deskjs=require(_0x1ed0('0xf'));var toCsv=require(_0x1ed0('0x8'));var querystring=require(_0x1ed0('0x10'));var Papa=require(_0x1ed0('0x11'));var Redis=require(_0x1ed0('0x12'));var authService=require(_0x1ed0('0x13'));var qs=require(_0x1ed0('0x14'));var as=require(_0x1ed0('0x15'));var hardwareService=require(_0x1ed0('0x16'));var logger=require('../../config/logger')(_0x1ed0('0x17'));var utils=require(_0x1ed0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ed0('0x19'));var db=require(_0x1ed0('0x1a'))['db'];function respondWithStatusCode(_0x30e885,_0x35364d){_0x35364d=_0x35364d||0xcc;return function(_0x27d8d9){if(_0x27d8d9){return _0x30e885[_0x1ed0('0x1b')](_0x35364d);}return _0x30e885[_0x1ed0('0x1c')](_0x35364d)['end']();};}function respondWithResult(_0x4b2c7e,_0x1f81e1){_0x1f81e1=_0x1f81e1||0xc8;return function(_0x5b2278){if(_0x5b2278){return _0x4b2c7e['status'](_0x1f81e1)['json'](_0x5b2278);}};}function respondWithFilteredResult(_0x23b813,_0x39f483){return function(_0xd9d6b4){if(_0xd9d6b4){var _0x233e34=typeof _0x39f483[_0x1ed0('0x1d')]===_0x1ed0('0x1e')&&typeof _0x39f483['limit']===_0x1ed0('0x1e');var _0x311677=_0xd9d6b4[_0x1ed0('0x1f')];var _0x5111f=_0x233e34?0x0:_0x39f483[_0x1ed0('0x1d')];var _0x1a4148=_0x233e34?_0xd9d6b4['count']:_0x39f483['offset']+_0x39f483[_0x1ed0('0x20')];var _0xab2613;if(_0x1a4148>=_0x311677){_0x1a4148=_0x311677;_0xab2613=0xc8;}else{_0xab2613=0xce;}_0x23b813[_0x1ed0('0x1c')](_0xab2613);return _0x23b813['set'](_0x1ed0('0x21'),_0x5111f+'-'+_0x1a4148+'/'+_0x311677)[_0x1ed0('0x22')](_0xd9d6b4);}return null;};}function patchUpdates(_0x2e7366){return function(_0x51c20f){try{jsonpatch['apply'](_0x51c20f,_0x2e7366,!![]);}catch(_0x4b4278){return BPromise[_0x1ed0('0x23')](_0x4b4278);}return _0x51c20f[_0x1ed0('0x24')]();};}function saveUpdates(_0x54f201,_0x4c33d1){return function(_0x4e022f){if(_0x4e022f){return _0x4e022f[_0x1ed0('0x25')](_0x54f201)[_0x1ed0('0x26')](function(_0x28ef6e){return _0x28ef6e;});}return null;};}function removeEntity(_0x42b1ad,_0x226136){return function(_0x172bf8){if(_0x172bf8){return _0x172bf8[_0x1ed0('0x27')]()[_0x1ed0('0x26')](function(){_0x42b1ad['status'](0xcc)[_0x1ed0('0x28')]();});}};}function handleEntityNotFound(_0x5d6b73,_0x1b400b){return function(_0x211689){if(!_0x211689){_0x5d6b73[_0x1ed0('0x1b')](0x194);}return _0x211689;};}function handleError(_0x52a3cc,_0x301ab3){_0x301ab3=_0x301ab3||0x1f4;return function(_0x189d78){logger[_0x1ed0('0x29')](_0x189d78['stack']);if(_0x189d78[_0x1ed0('0x2a')]){delete _0x189d78[_0x1ed0('0x2a')];}_0x52a3cc[_0x1ed0('0x1c')](_0x301ab3)[_0x1ed0('0x2b')](_0x189d78);};}exports[_0x1ed0('0x2c')]=function(_0x4555de,_0x2451a2){var _0x49715f={},_0x3262d8={},_0x579dfc={'count':0x0,'rows':[]};var _0x22cf24=_[_0x1ed0('0x2d')](db[_0x1ed0('0x2e')][_0x1ed0('0x2f')],function(_0x37335b){return{'name':_0x37335b[_0x1ed0('0x30')],'type':_0x37335b[_0x1ed0('0x31')][_0x1ed0('0x32')]};});_0x3262d8[_0x1ed0('0x33')]=_[_0x1ed0('0x2d')](_0x22cf24,_0x1ed0('0x2a'));_0x3262d8[_0x1ed0('0x34')]=_[_0x1ed0('0x35')](_0x4555de[_0x1ed0('0x34')]);_0x3262d8[_0x1ed0('0x36')]=_['intersection'](_0x3262d8[_0x1ed0('0x33')],_0x3262d8[_0x1ed0('0x34')]);_0x3262d8[_0x1ed0('0x36')]=_[_0x1ed0('0x37')](_0x3262d8[_0x1ed0('0x36')],[_0x1ed0('0x38'),_0x1ed0('0x39'),_0x1ed0('0x3a'),_0x1ed0('0x3b'),_0x1ed0('0x3c'),_0x1ed0('0x3d'),_0x1ed0('0x3e'),_0x1ed0('0x3f'),_0x1ed0('0x40'),_0x1ed0('0x41'),_0x1ed0('0x42'),_0x1ed0('0x43'),_0x1ed0('0x44'),_0x1ed0('0x45'),_0x1ed0('0x46'),_0x1ed0('0x47'),_0x1ed0('0x48'),_0x1ed0('0x45'),'$overlap','$contains',_0x1ed0('0x49'),_0x1ed0('0x4a')]);_0x49715f[_0x1ed0('0x4b')]=_[_0x1ed0('0x4c')](_0x3262d8[_0x1ed0('0x33')],qs[_0x1ed0('0x4d')](_0x4555de[_0x1ed0('0x34')]['fields']));_0x49715f[_0x1ed0('0x4b')]=_0x49715f[_0x1ed0('0x4b')][_0x1ed0('0x4e')]?_0x49715f[_0x1ed0('0x4b')]:_0x3262d8['model'];if(!_0x4555de[_0x1ed0('0x34')][_0x1ed0('0x4f')]('nolimit')){_0x49715f[_0x1ed0('0x20')]=qs['limit'](_0x4555de[_0x1ed0('0x34')]['limit']);_0x49715f[_0x1ed0('0x1d')]=qs[_0x1ed0('0x1d')](_0x4555de[_0x1ed0('0x34')]['offset']);}_0x49715f['order']=qs[_0x1ed0('0x50')](_0x4555de[_0x1ed0('0x34')][_0x1ed0('0x50')]);_0x49715f[_0x1ed0('0x51')]=qs[_0x1ed0('0x36')](_['pick'](_0x4555de[_0x1ed0('0x34')],_0x3262d8[_0x1ed0('0x36')]),_0x22cf24);if(_0x4555de['query'][_0x1ed0('0x52')]){_0x49715f['where']=_[_0x1ed0('0x53')](_0x49715f[_0x1ed0('0x51')],{'$or':_[_0x1ed0('0x2d')](_0x22cf24,function(_0x2028d4){if(_0x2028d4[_0x1ed0('0x31')]!==_0x1ed0('0x54')){var _0x50d8e8={};_0x50d8e8[_0x2028d4[_0x1ed0('0x2a')]]={'$like':'%'+_0x4555de[_0x1ed0('0x34')][_0x1ed0('0x52')]+'%'};return _0x50d8e8;}})});}_0x49715f=_[_0x1ed0('0x53')]({},_0x49715f,_0x4555de[_0x1ed0('0x55')]);var _0x196ea4={'where':_0x49715f[_0x1ed0('0x51')]};return db[_0x1ed0('0x2e')][_0x1ed0('0x1f')](_0x196ea4)[_0x1ed0('0x26')](function(_0x5103c2){_0x579dfc[_0x1ed0('0x1f')]=_0x5103c2;if(_0x4555de[_0x1ed0('0x34')][_0x1ed0('0x56')]){_0x49715f[_0x1ed0('0x57')]=[{'all':!![]}];}return db[_0x1ed0('0x2e')][_0x1ed0('0x58')](_0x49715f);})['then'](function(_0x47bd9b){_0x579dfc[_0x1ed0('0x59')]=_0x47bd9b;return _0x579dfc;})[_0x1ed0('0x26')](respondWithFilteredResult(_0x2451a2,_0x49715f))[_0x1ed0('0x5a')](handleError(_0x2451a2,null));};exports[_0x1ed0('0x5b')]=function(_0x344d2a,_0x36f726){var _0x9b5808={'raw':!![],'where':{'id':_0x344d2a[_0x1ed0('0x5c')]['id']}},_0x10b114={};_0x10b114[_0x1ed0('0x33')]=_[_0x1ed0('0x35')](db['CmHopper'][_0x1ed0('0x2f')]);_0x10b114[_0x1ed0('0x34')]=_[_0x1ed0('0x35')](_0x344d2a['query']);_0x10b114['filters']=_[_0x1ed0('0x4c')](_0x10b114[_0x1ed0('0x33')],_0x10b114['query']);_0x9b5808[_0x1ed0('0x4b')]=_[_0x1ed0('0x4c')](_0x10b114[_0x1ed0('0x33')],qs['fields'](_0x344d2a[_0x1ed0('0x34')]['fields']));_0x9b5808[_0x1ed0('0x4b')]=_0x9b5808[_0x1ed0('0x4b')][_0x1ed0('0x4e')]?_0x9b5808['attributes']:_0x10b114[_0x1ed0('0x33')];if(_0x344d2a[_0x1ed0('0x34')]['includeAll']){_0x9b5808[_0x1ed0('0x57')]=[{'all':!![]}];}_0x9b5808=_[_0x1ed0('0x53')]({},_0x9b5808,_0x344d2a['options']);return db[_0x1ed0('0x2e')][_0x1ed0('0x5d')](_0x9b5808)[_0x1ed0('0x26')](handleEntityNotFound(_0x36f726,null))[_0x1ed0('0x26')](respondWithResult(_0x36f726,null))[_0x1ed0('0x5a')](handleError(_0x36f726,null));};exports[_0x1ed0('0x5e')]=function(_0x5cfc54,_0x4bc3a3){return db['CmHopper'][_0x1ed0('0x5e')](_0x5cfc54[_0x1ed0('0x5f')],{})[_0x1ed0('0x26')](respondWithResult(_0x4bc3a3,0xc9))[_0x1ed0('0x5a')](handleError(_0x4bc3a3,null));};exports[_0x1ed0('0x25')]=function(_0x41dee3,_0x2aaa04){if(_0x41dee3['body']['id']){delete _0x41dee3[_0x1ed0('0x5f')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x41dee3[_0x1ed0('0x5c')]['id']}})[_0x1ed0('0x26')](handleEntityNotFound(_0x2aaa04,null))[_0x1ed0('0x26')](saveUpdates(_0x41dee3[_0x1ed0('0x5f')],null))[_0x1ed0('0x26')](respondWithResult(_0x2aaa04,null))['catch'](handleError(_0x2aaa04,null));};exports['describe']=function(_0x166d58,_0x4ce25c){return db[_0x1ed0('0x2e')][_0x1ed0('0x60')]()[_0x1ed0('0x26')](respondWithResult(_0x4ce25c,null))[_0x1ed0('0x5a')](handleError(_0x4ce25c,null));};exports['destroy']=function(_0x3edc89,_0x1144f6){var _0x4b2c86;return db[_0x1ed0('0x2e')][_0x1ed0('0x5d')]({'where':{'id':_0x3edc89[_0x1ed0('0x5c')]['id']}})[_0x1ed0('0x26')](handleEntityNotFound(_0x1144f6,null))['then'](function(_0xd43e5f){if(_0xd43e5f){return _0xd43e5f[_0x1ed0('0x27')]()[_0x1ed0('0x26')](function(_0x57ec54){return _0x57ec54;});}})[_0x1ed0('0x26')](function(_0x9049a4){_0x4b2c86=_0x9049a4;if(_0x9049a4){if(_0x9049a4[_0x1ed0('0x61')]||_0x9049a4[_0x1ed0('0x62')]){return db[_0x9049a4['VoiceQueueId']?_0x1ed0('0x63'):_0x1ed0('0x64')]['find']({'where':{'id':_0x9049a4[_0x1ed0('0x61')]?_0x9049a4[_0x1ed0('0x61')]:_0x9049a4[_0x1ed0('0x62')]},'attributes':['id',_0x1ed0('0x2a')],'raw':!![]});}}})[_0x1ed0('0x26')](function(_0x27831c){var _0x5ead98={};if(_0x27831c){_['merge'](_0x5ead98,_[_0x1ed0('0x65')](_0x4b2c86[_0x1ed0('0x66')],[_0x1ed0('0x67'),'updatedAt','id']));_0x5ead98['state']=0x15;_0x5ead98[_0x1ed0('0x68')]=_0x1ed0('0x69');_0x5ead98['campaign']=_0x27831c[_0x1ed0('0x2a')];_0x5ead98[_0x1ed0('0x6a')]=_0x3edc89[_0x1ed0('0x6b')][_0x1ed0('0x2a')];_0x5ead98['UserId']=_0x3edc89[_0x1ed0('0x6b')]['id'];_0x5ead98['deleted']=!![];_0x5ead98[_0x1ed0('0x6c')]=moment()['format'](_0x1ed0('0x6d'));_0x5ead98['calleridnum']=_0x4b2c86['phone'];_0x5ead98[_0x1ed0('0x6e')]=_0x4b2c86[_0x1ed0('0x61')]?_0x1ed0('0x6f'):_0x1ed0('0x70');return db[_0x1ed0('0x71')][_0x1ed0('0x5d')]({'where':{'id':_0x5ead98[_0x1ed0('0x72')]},'attributes':[_0x1ed0('0x73'),'lastName']})[_0x1ed0('0x26')](function(_0xc6cefe){if(!_[_0x1ed0('0x74')](_0x1144f6)&&!_[_0x1ed0('0x74')](_0xc6cefe[_0x1ed0('0x73')])){_0x5ead98[_0x1ed0('0x75')]=_0xc6cefe[_0x1ed0('0x73')];if(!_[_0x1ed0('0x74')](_0xc6cefe['lastName'])){_0x5ead98[_0x1ed0('0x75')]+='\x20'+_0xc6cefe[_0x1ed0('0x76')];}}})[_0x1ed0('0x77')](function(){return db[_0x1ed0('0x78')]['create'](_0x5ead98);});}})[_0x1ed0('0x26')](function(){return _0x1144f6[_0x1ed0('0x1c')](0xcc)['end']();})[_0x1ed0('0x5a')](handleError(_0x1144f6,null));};exports[_0x1ed0('0x79')]=function(_0x31c405,_0x5a4d9b,_0x419275){var _0x39a9fa=[];return db[_0x1ed0('0x71')][_0x1ed0('0x60')]()[_0x1ed0('0x26')](function(_0x51b91b){_0x39a9fa=_[_0x1ed0('0x35')](_0x51b91b);return _0x31c405['user']['getVoiceQueues']({'where':{'type':_0x1ed0('0x7a'),'dialActive':!![],'dialMethod':_0x1ed0('0x7b')},'attributes':['id',_0x1ed0('0x7c'),_0x1ed0('0x7d')],'raw':!![]});})[_0x1ed0('0x26')](function(_0x1e48f2){if(_0x1e48f2&&_0x1e48f2[_0x1ed0('0x4e')]){return db['sequelize'][_0x1ed0('0x7e')](function(_0x577258){var _0x3784a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x1ed0('0x2d')](_0x1e48f2,'id')},'$or':[{'UserId':null},{'UserId':_0x31c405[_0x1ed0('0x6b')]['id']}]};var _0x2d73f0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1e48f2)[_0x1ed0('0x52')](['dialPreviewAutoRecallMe',0x0])[_0x1ed0('0x2d')]('id')[_0x1ed0('0x7f')]()},'$or':[{'UserId':null},{'UserId':_0x31c405[_0x1ed0('0x6b')]['id']}]};var _0x21dc84={'$or':[_0x3784a,_0x2d73f0]};var _0x52e6a6=[];if(_0x31c405['body'][_0x1ed0('0x80')]&&_0x31c405['body'][_0x1ed0('0x80')]==='prev'){if(!_['isEmpty'](_0x31c405[_0x1ed0('0x5f')][_0x1ed0('0x81')])){_0x21dc84['id']={'$in':_0x31c405[_0x1ed0('0x5f')][_0x1ed0('0x81')]};}_0x52e6a6=[[_0x1ed0('0x82'),_0x1ed0('0x83')],[_0x1ed0('0x84'),_0x1e48f2[0x0]['dialOrderByScheduledAt']===_0x1ed0('0x83')?_0x1ed0('0x85'):_0x1ed0('0x83')],db['sequelize']['literal'](_0x1ed0('0x86')),['id',_0x1ed0('0x85')]];}else{if(!_['isEmpty'](_0x31c405[_0x1ed0('0x5f')][_0x1ed0('0x81')])){_0x21dc84['id']={'$notIn':_0x31c405[_0x1ed0('0x5f')]['hopperIds']};}_0x52e6a6=[[_0x1ed0('0x82'),_0x1ed0('0x85')],[_0x1ed0('0x84'),_0x1e48f2[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x1ed0('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x1ed0('0x83')]];}return db[_0x1ed0('0x2e')][_0x1ed0('0x88')]({'attributes':['id',_0x1ed0('0x89'),_0x1ed0('0x8a')],'where':_0x21dc84,'order':_0x52e6a6,'transaction':_0x577258,'lock':_0x577258[_0x1ed0('0x8b')][_0x1ed0('0x8c')],'include':[{'model':db[_0x1ed0('0x71')],'as':_0x1ed0('0x8d'),'attributes':_0x39a9fa,'include':[{'model':db[_0x1ed0('0x8e')],'as':_0x1ed0('0x8f'),'attributes':['id',_0x1ed0('0x2a')]}]},{'model':db[_0x1ed0('0x90')],'as':_0x1ed0('0x91'),'attributes':['id','name']},{'model':db[_0x1ed0('0x63')],'as':_0x1ed0('0x92'),'attributes':['id',_0x1ed0('0x2a'),_0x1ed0('0x93')]}]})[_0x1ed0('0x26')](function(_0xe44ead){if(_0xe44ead){return _0xe44ead['update']({'UserId':_0x31c405[_0x1ed0('0x6b')]['id']},{'transaction':_0x577258});}});});}})[_0x1ed0('0x26')](handleEntityNotFound(_0x5a4d9b,null))[_0x1ed0('0x26')](respondWithResult(_0x5a4d9b,null))['catch'](handleError(_0x5a4d9b,null));};exports['getOpenContacts']=function(_0x136881,_0x985f22,_0x37b3d3){return _0x136881[_0x1ed0('0x6b')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x1ed0('0x26')](function(_0x39c7a4){if(_0x39c7a4&&_0x39c7a4[_0x1ed0('0x4e')]){return db[_0x1ed0('0x2e')][_0x1ed0('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1ed0('0x94')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x1ed0('0x2d')](_0x39c7a4,'id')},'$or':[{'UserId':null},{'UserId':_0x136881[_0x1ed0('0x6b')]['id']}]}});}return 0x0;})[_0x1ed0('0x26')](function(_0x2a9c3c){if(!_[_0x1ed0('0x74')](_0x2a9c3c)&&_['isNumber'](_0x2a9c3c)){return _0x985f22[_0x1ed0('0x1c')](0xc8)[_0x1ed0('0x22')]({'contacts':_0x2a9c3c});}else{logger[_0x1ed0('0x29')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1ed0('0x95'),0x194,_0x1ed0('0x96'));_0x985f22['sendStatus'](0x194);}})[_0x1ed0('0x5a')](handleError(_0x985f22,null));}; \ No newline at end of file +var _0xebff=['then','sendStatus','error','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','concat','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','CmHopper','find','create','body','describe','VoiceQueueId','VoiceQueue','omit','createdAt','updatedAt','state','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','lastName','isNil','firstName','calleridname','CmHopperFinal','getPreview','CmContact','getVoiceQueues','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','priority','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company','List','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','save','update','destroy'];(function(_0x2a9117,_0x584f1d){var _0x1ce236=function(_0x2551ad){while(--_0x2551ad){_0x2a9117['push'](_0x2a9117['shift']());}};_0x1ce236(++_0x584f1d);}(_0xebff,0xf8));var _0xfebf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xebff[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xfebf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfebf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfebf('0x2'));var moment=require(_0xfebf('0x3'));var BPromise=require(_0xfebf('0x4'));var Mustache=require(_0xfebf('0x5'));var util=require('util');var path=require(_0xfebf('0x6'));var sox=require(_0xfebf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfebf('0x8'));var squel=require('squel');var crypto=require(_0xfebf('0x9'));var jsforce=require(_0xfebf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfebf('0xb'));var Redis=require(_0xfebf('0xc'));var authService=require(_0xfebf('0xd'));var qs=require(_0xfebf('0xe'));var as=require(_0xfebf('0xf'));var hardwareService=require(_0xfebf('0x10'));var logger=require(_0xfebf('0x11'))('api');var utils=require(_0xfebf('0x12'));var config=require(_0xfebf('0x13'));var licenseUtil=require(_0xfebf('0x14'));var db=require(_0xfebf('0x15'))['db'];function respondWithStatusCode(_0x21323e,_0x5e1902){_0x5e1902=_0x5e1902||0xcc;return function(_0xaa120){if(_0xaa120){return _0x21323e['sendStatus'](_0x5e1902);}return _0x21323e['status'](_0x5e1902)[_0xfebf('0x16')]();};}function respondWithResult(_0x4443f5,_0x2b6133){_0x2b6133=_0x2b6133||0xc8;return function(_0x4e7d05){if(_0x4e7d05){return _0x4443f5[_0xfebf('0x17')](_0x2b6133)[_0xfebf('0x18')](_0x4e7d05);}};}function respondWithFilteredResult(_0x117ed1,_0x4ed826){return function(_0x2dae8e){if(_0x2dae8e){var _0x182aa5=typeof _0x4ed826[_0xfebf('0x19')]==='undefined'&&typeof _0x4ed826[_0xfebf('0x1a')]===_0xfebf('0x1b');var _0x4a2e1a=_0x2dae8e[_0xfebf('0x1c')];var _0x117fec=_0x182aa5?0x0:_0x4ed826['offset'];var _0x36c333=_0x182aa5?_0x2dae8e[_0xfebf('0x1c')]:_0x4ed826[_0xfebf('0x19')]+_0x4ed826['limit'];var _0x200804;if(_0x36c333>=_0x4a2e1a){_0x36c333=_0x4a2e1a;_0x200804=0xc8;}else{_0x200804=0xce;}_0x117ed1[_0xfebf('0x17')](_0x200804);return _0x117ed1[_0xfebf('0x1d')](_0xfebf('0x1e'),_0x117fec+'-'+_0x36c333+'/'+_0x4a2e1a)['json'](_0x2dae8e);}return null;};}function patchUpdates(_0x20adc6){return function(_0x4105d5){try{jsonpatch['apply'](_0x4105d5,_0x20adc6,!![]);}catch(_0x4622bd){return BPromise['reject'](_0x4622bd);}return _0x4105d5[_0xfebf('0x1f')]();};}function saveUpdates(_0x277afd,_0x9bcc08){return function(_0x21da17){if(_0x21da17){return _0x21da17[_0xfebf('0x20')](_0x277afd)['then'](function(_0x59d479){return _0x59d479;});}return null;};}function removeEntity(_0x3ad7f3,_0x44ce08){return function(_0x5ee622){if(_0x5ee622){return _0x5ee622[_0xfebf('0x21')]()[_0xfebf('0x22')](function(){_0x3ad7f3[_0xfebf('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2a29,_0x461337){return function(_0x24a0c9){if(!_0x24a0c9){_0x3a2a29[_0xfebf('0x23')](0x194);}return _0x24a0c9;};}function handleError(_0x4d7e68,_0x14eba7){_0x14eba7=_0x14eba7||0x1f4;return function(_0x29ef2f){logger[_0xfebf('0x24')](_0x29ef2f['stack']);if(_0x29ef2f[_0xfebf('0x25')]){delete _0x29ef2f[_0xfebf('0x25')];}_0x4d7e68[_0xfebf('0x17')](_0x14eba7)['send'](_0x29ef2f);};}exports[_0xfebf('0x26')]=function(_0x4bb877,_0x52c79c){var _0x515e08={},_0x4089f9={},_0x597332={'count':0x0,'rows':[]};var _0x5e46de=_['map'](db['CmHopper'][_0xfebf('0x27')],function(_0x193123){return{'name':_0x193123[_0xfebf('0x28')],'type':_0x193123['type'][_0xfebf('0x29')]};});_0x4089f9[_0xfebf('0x2a')]=_[_0xfebf('0x2b')](_0x5e46de,_0xfebf('0x25'));_0x4089f9[_0xfebf('0x2c')]=_[_0xfebf('0x2d')](_0x4bb877[_0xfebf('0x2c')]);_0x4089f9[_0xfebf('0x2e')]=_['intersection'](_0x4089f9[_0xfebf('0x2a')],_0x4089f9[_0xfebf('0x2c')]);_0x4089f9[_0xfebf('0x2e')]=_[_0xfebf('0x2f')](_0x4089f9[_0xfebf('0x2e')],['$and',_0xfebf('0x30'),_0xfebf('0x31'),'$gte',_0xfebf('0x32'),_0xfebf('0x33'),_0xfebf('0x34'),_0xfebf('0x35'),_0xfebf('0x36'),_0xfebf('0x37'),_0xfebf('0x38'),_0xfebf('0x39'),_0xfebf('0x3a'),'$like',_0xfebf('0x3b'),_0xfebf('0x3c'),_0xfebf('0x3d'),_0xfebf('0x3e'),_0xfebf('0x3f'),_0xfebf('0x40'),_0xfebf('0x41'),_0xfebf('0x42')]);_0x515e08[_0xfebf('0x43')]=_[_0xfebf('0x44')](_0x4089f9[_0xfebf('0x2a')],qs['fields'](_0x4bb877[_0xfebf('0x2c')][_0xfebf('0x45')]));_0x515e08[_0xfebf('0x43')]=_0x515e08[_0xfebf('0x43')][_0xfebf('0x46')]?_0x515e08[_0xfebf('0x43')]:_0x4089f9['model'];if(!_0x4bb877[_0xfebf('0x2c')][_0xfebf('0x47')](_0xfebf('0x48'))){_0x515e08['limit']=qs['limit'](_0x4bb877[_0xfebf('0x2c')][_0xfebf('0x1a')]);_0x515e08[_0xfebf('0x19')]=qs[_0xfebf('0x19')](_0x4bb877[_0xfebf('0x2c')][_0xfebf('0x19')]);}_0x515e08['order']=qs['sort'](_0x4bb877['query'][_0xfebf('0x49')]);_0x515e08[_0xfebf('0x4a')]=qs[_0xfebf('0x2e')](_['pick'](_0x4bb877['query'],_0x4089f9[_0xfebf('0x2e')]),_0x5e46de);if(_0x4bb877[_0xfebf('0x2c')]['filter']){_0x515e08[_0xfebf('0x4a')]=_[_0xfebf('0x4b')](_0x515e08[_0xfebf('0x4a')],{'$or':_[_0xfebf('0x2b')](_0x5e46de,function(_0x57330c){if(_0x57330c[_0xfebf('0x4c')]!==_0xfebf('0x4d')){var _0x3a9b0f={};_0x3a9b0f[_0x57330c['name']]={'$like':'%'+_0x4bb877[_0xfebf('0x2c')][_0xfebf('0x4e')]+'%'};return _0x3a9b0f;}})});}_0x515e08=_[_0xfebf('0x4b')]({},_0x515e08,_0x4bb877[_0xfebf('0x4f')]);var _0x3e97bf={'where':_0x515e08[_0xfebf('0x4a')]};return db['CmHopper'][_0xfebf('0x1c')](_0x3e97bf)[_0xfebf('0x22')](function(_0x4b2c98){_0x597332[_0xfebf('0x1c')]=_0x4b2c98;if(_0x4bb877[_0xfebf('0x2c')][_0xfebf('0x50')]){_0x515e08[_0xfebf('0x51')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x515e08);})['then'](function(_0x3be436){_0x597332[_0xfebf('0x52')]=_0x3be436;return _0x597332;})[_0xfebf('0x22')](respondWithFilteredResult(_0x52c79c,_0x515e08))[_0xfebf('0x53')](handleError(_0x52c79c,null));};exports['show']=function(_0x185579,_0x224ba5){var _0x7886b3={'raw':!![],'where':{'id':_0x185579[_0xfebf('0x54')]['id']}},_0xc72ea5={};_0xc72ea5[_0xfebf('0x2a')]=_[_0xfebf('0x2d')](db[_0xfebf('0x55')]['rawAttributes']);_0xc72ea5[_0xfebf('0x2c')]=_['keys'](_0x185579[_0xfebf('0x2c')]);_0xc72ea5[_0xfebf('0x2e')]=_[_0xfebf('0x44')](_0xc72ea5[_0xfebf('0x2a')],_0xc72ea5[_0xfebf('0x2c')]);_0x7886b3[_0xfebf('0x43')]=_['intersection'](_0xc72ea5['model'],qs['fields'](_0x185579['query'][_0xfebf('0x45')]));_0x7886b3['attributes']=_0x7886b3[_0xfebf('0x43')][_0xfebf('0x46')]?_0x7886b3[_0xfebf('0x43')]:_0xc72ea5['model'];if(_0x185579['query'][_0xfebf('0x50')]){_0x7886b3['include']=[{'all':!![]}];}_0x7886b3=_[_0xfebf('0x4b')]({},_0x7886b3,_0x185579['options']);return db[_0xfebf('0x55')][_0xfebf('0x56')](_0x7886b3)[_0xfebf('0x22')](handleEntityNotFound(_0x224ba5,null))['then'](respondWithResult(_0x224ba5,null))['catch'](handleError(_0x224ba5,null));};exports[_0xfebf('0x57')]=function(_0x3d58d5,_0x3ed3e0){return db[_0xfebf('0x55')][_0xfebf('0x57')](_0x3d58d5[_0xfebf('0x58')],{})[_0xfebf('0x22')](respondWithResult(_0x3ed3e0,0xc9))[_0xfebf('0x53')](handleError(_0x3ed3e0,null));};exports[_0xfebf('0x20')]=function(_0x47a479,_0x236224){if(_0x47a479[_0xfebf('0x58')]['id']){delete _0x47a479[_0xfebf('0x58')]['id'];}return db[_0xfebf('0x55')][_0xfebf('0x56')]({'where':{'id':_0x47a479['params']['id']}})[_0xfebf('0x22')](handleEntityNotFound(_0x236224,null))[_0xfebf('0x22')](saveUpdates(_0x47a479[_0xfebf('0x58')],null))['then'](respondWithResult(_0x236224,null))[_0xfebf('0x53')](handleError(_0x236224,null));};exports[_0xfebf('0x59')]=function(_0xc34dad,_0x200ba5){return db[_0xfebf('0x55')][_0xfebf('0x59')]()['then'](respondWithResult(_0x200ba5,null))[_0xfebf('0x53')](handleError(_0x200ba5,null));};exports[_0xfebf('0x21')]=function(_0x3c6a7d,_0x525cb3){var _0x5168f8;return db[_0xfebf('0x55')][_0xfebf('0x56')]({'where':{'id':_0x3c6a7d[_0xfebf('0x54')]['id']}})['then'](handleEntityNotFound(_0x525cb3,null))[_0xfebf('0x22')](function(_0x13d2e4){if(_0x13d2e4){return _0x13d2e4['destroy']()[_0xfebf('0x22')](function(_0x3579f6){return _0x3579f6;});}})['then'](function(_0x5556d5){_0x5168f8=_0x5556d5;if(_0x5556d5){if(_0x5556d5['VoiceQueueId']||_0x5556d5['CampaignId']){return db[_0x5556d5[_0xfebf('0x5a')]?_0xfebf('0x5b'):'Campaign']['find']({'where':{'id':_0x5556d5['VoiceQueueId']?_0x5556d5[_0xfebf('0x5a')]:_0x5556d5['CampaignId']},'attributes':['id',_0xfebf('0x25')],'raw':!![]});}}})[_0xfebf('0x22')](function(_0xcd72f){var _0x399481={};if(_0xcd72f){_[_0xfebf('0x4b')](_0x399481,_[_0xfebf('0x5c')](_0x5168f8['dataValues'],[_0xfebf('0x5d'),_0xfebf('0x5e'),'id']));_0x399481[_0xfebf('0x5f')]=0x15;_0x399481['statedesc']='deleted';_0x399481['campaign']=_0xcd72f['name'];_0x399481[_0xfebf('0x60')]=_0x3c6a7d[_0xfebf('0x61')][_0xfebf('0x25')];_0x399481[_0xfebf('0x62')]=_0x3c6a7d['user']['id'];_0x399481['deleted']=!![];_0x399481[_0xfebf('0x63')]=moment()[_0xfebf('0x64')](_0xfebf('0x65'));_0x399481[_0xfebf('0x66')]=_0x5168f8['phone'];_0x399481[_0xfebf('0x67')]=_0x5168f8[_0xfebf('0x5a')]?_0xfebf('0x68'):_0xfebf('0x69');return db['CmContact']['find']({'where':{'id':_0x399481['ContactId']},'attributes':['firstName',_0xfebf('0x6a')]})[_0xfebf('0x22')](function(_0x5646da){if(!_[_0xfebf('0x6b')](_0x525cb3)&&!_[_0xfebf('0x6b')](_0x5646da['firstName'])){_0x399481['calleridname']=_0x5646da[_0xfebf('0x6c')];if(!_[_0xfebf('0x6b')](_0x5646da['lastName'])){_0x399481[_0xfebf('0x6d')]+='\x20'+_0x5646da['lastName'];}}})['finally'](function(){return db[_0xfebf('0x6e')][_0xfebf('0x57')](_0x399481);});}})[_0xfebf('0x22')](function(){return _0x525cb3[_0xfebf('0x17')](0xcc)[_0xfebf('0x16')]();})[_0xfebf('0x53')](handleError(_0x525cb3,null));};exports[_0xfebf('0x6f')]=function(_0x5dd54e,_0x136359,_0x483507){var _0x187cad=[];return db[_0xfebf('0x70')][_0xfebf('0x59')]()[_0xfebf('0x22')](function(_0x2cded4){_0x187cad=_[_0xfebf('0x2d')](_0x2cded4);return _0x5dd54e[_0xfebf('0x61')][_0xfebf('0x71')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xfebf('0x72'),_0xfebf('0x73')],'raw':!![]});})[_0xfebf('0x22')](function(_0x31f78b){if(_0x31f78b&&_0x31f78b['length']){return db['sequelize'][_0xfebf('0x74')](function(_0x33b72a){var _0x3ea99a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfebf('0x64')](_0xfebf('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x31f78b,'id')},'$or':[{'UserId':null},{'UserId':_0x5dd54e['user']['id']}]};var _0x4a85fb={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x31f78b)[_0xfebf('0x4e')]([_0xfebf('0x73'),0x0])[_0xfebf('0x2b')]('id')[_0xfebf('0x75')]()},'$or':[{'UserId':null},{'UserId':_0x5dd54e[_0xfebf('0x61')]['id']}]};var _0x184913={'$or':[_0x3ea99a,_0x4a85fb]};var _0x536519=[];if(_0x5dd54e[_0xfebf('0x58')][_0xfebf('0x76')]&&_0x5dd54e[_0xfebf('0x58')][_0xfebf('0x76')]===_0xfebf('0x77')){if(!_[_0xfebf('0x78')](_0x5dd54e['body'][_0xfebf('0x79')])){_0x184913['id']={'$in':_0x5dd54e[_0xfebf('0x58')][_0xfebf('0x79')]};}_0x536519=[['priority',_0xfebf('0x7a')],[_0xfebf('0x7b'),_0x31f78b[0x0]['dialOrderByScheduledAt']===_0xfebf('0x7a')?_0xfebf('0x7c'):'ASC'],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xfebf('0x7c')]];}else{if(!_[_0xfebf('0x78')](_0x5dd54e[_0xfebf('0x58')][_0xfebf('0x79')])){_0x184913['id']={'$notIn':_0x5dd54e[_0xfebf('0x58')][_0xfebf('0x79')]};}_0x536519=[[_0xfebf('0x7d'),'DESC'],['scheduledAt',_0x31f78b[0x0][_0xfebf('0x72')]],db[_0xfebf('0x7e')][_0xfebf('0x7f')](_0xfebf('0x80')),['id',_0xfebf('0x7a')]];}return db[_0xfebf('0x55')][_0xfebf('0x81')]({'attributes':['id',_0xfebf('0x82'),'recallme'],'where':_0x184913,'order':_0x536519,'transaction':_0x33b72a,'lock':_0x33b72a['LOCK'][_0xfebf('0x83')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x187cad,'include':[{'model':db[_0xfebf('0x84')],'as':_0xfebf('0x85'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xfebf('0x86'),'attributes':['id',_0xfebf('0x25')]},{'model':db[_0xfebf('0x5b')],'as':'Queue','attributes':['id',_0xfebf('0x25'),_0xfebf('0x87')]}]})[_0xfebf('0x22')](function(_0x1b5e9f){if(_0x1b5e9f){return _0x1b5e9f['update']({'UserId':_0x5dd54e['user']['id']},{'transaction':_0x33b72a});}});});}})[_0xfebf('0x22')](handleEntityNotFound(_0x136359,null))['then'](respondWithResult(_0x136359,null))['catch'](handleError(_0x136359,null));};exports[_0xfebf('0x88')]=function(_0x3fab04,_0x59f6f1,_0x3d32a8){return _0x3fab04['user'][_0xfebf('0x71')]({'where':{'type':_0xfebf('0x89'),'dialActive':!![],'dialMethod':_0xfebf('0x8a')},'attributes':['id'],'raw':!![]})['then'](function(_0x4a4d59){if(_0x4a4d59&&_0x4a4d59['length']){return db[_0xfebf('0x55')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfebf('0x64')](_0xfebf('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x4a4d59,'id')},'$or':[{'UserId':null},{'UserId':_0x3fab04[_0xfebf('0x61')]['id']}]}});}return 0x0;})['then'](function(_0x160703){if(!_[_0xfebf('0x6b')](_0x160703)&&_[_0xfebf('0x8b')](_0x160703)){return _0x59f6f1['status'](0xc8)[_0xfebf('0x18')]({'contacts':_0x160703});}else{logger[_0xfebf('0x24')](_0xfebf('0x8c'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x59f6f1[_0xfebf('0x23')](0x194);}})[_0xfebf('0x53')](handleError(_0x59f6f1,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 507d1ae..ac8741a 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x3f6b67,_0x2736d1){var _0x3d2b4c=function(_0x402dd4){while(--_0x402dd4){_0x3f6b67['push'](_0x3f6b67['shift']());}};_0x3d2b4c(++_0x2736d1);}(_0x2a07,0x74));var _0x72a0=function(_0x27fcf0,_0x2abcbe){_0x27fcf0=_0x27fcf0-0x0;var _0x47ab65=_0x2a07[_0x27fcf0];return _0x47ab65;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4d48e6,_0x22c224){var _0x29f0de=function(_0x7d1129){while(--_0x7d1129){_0x4d48e6['push'](_0x4d48e6['shift']());}};_0x29f0de(++_0x22c224);}(_0x2542,0x169));var _0x2254=function(_0x18e993,_0x4cf588){_0x18e993=_0x18e993-0x0;var _0x23f4e2=_0x2542[_0x18e993];return _0x23f4e2;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7794fdd..482c56d 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 _0xf738=['order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','length','update','includes','push','all','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','transaction','GetCmHopperPreview','ResetActiveCalls','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowCmHopper','find','debug','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','describe','sequelize'];(function(_0x124617,_0x3e0524){var _0x3839f4=function(_0x302790){while(--_0x302790){_0x124617['push'](_0x124617['shift']());}};_0x3839f4(++_0x3e0524);}(_0xf738,0xb4));var _0x8f73=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf738[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x8f73('0x0'));var util=require(_0x8f73('0x1'));var moment=require(_0x8f73('0x2'));var BPromise=require(_0x8f73('0x3'));var rs=require(_0x8f73('0x4'));var fs=require('fs');var Redis=require(_0x8f73('0x5'));var db=require(_0x8f73('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8f73('0x7'));var client=jayson[_0x8f73('0x8')][_0x8f73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24defd,_0x162e19,_0x6cf489){return new BPromise(function(_0x271f4f,_0x23b76b){return client['request'](_0x24defd,_0x6cf489)[_0x8f73('0xa')](function(_0x35a4ce){logger[_0x8f73('0xb')](_0x8f73('0xc'),_0x162e19,_0x8f73('0xd'));logger['debug'](_0x8f73('0xe'),_0x162e19,_0x8f73('0xd'),JSON[_0x8f73('0xf')](_0x35a4ce));if(_0x35a4ce[_0x8f73('0x10')]){if(_0x35a4ce[_0x8f73('0x10')][_0x8f73('0x11')]===0x1f4){logger['error'](_0x8f73('0xc'),_0x162e19,_0x35a4ce[_0x8f73('0x10')][_0x8f73('0x12')]);return _0x23b76b(_0x35a4ce['error'][_0x8f73('0x12')]);}logger[_0x8f73('0x10')](_0x8f73('0xc'),_0x162e19,_0x35a4ce[_0x8f73('0x10')]['message']);return _0x271f4f(_0x35a4ce[_0x8f73('0x10')]['message']);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x162e19,_0x8f73('0xd'));_0x271f4f(_0x35a4ce[_0x8f73('0x13')][_0x8f73('0x12')]);}})['catch'](function(_0x33309d){logger['error'](_0x8f73('0xc'),_0x162e19,_0x33309d);_0x23b76b(_0x33309d);});});}exports[_0x8f73('0x14')]=function(_0xa6a8e8){var _0xdfe8f1=this;return new Promise(function(_0x294fd0,_0x173b59){return db[_0x8f73('0x15')][_0x8f73('0x16')]({'raw':_0xa6a8e8[_0x8f73('0x17')]?_0xa6a8e8[_0x8f73('0x17')][_0x8f73('0x18')]===undefined?!![]:![]:!![],'where':_0xa6a8e8[_0x8f73('0x17')]?_0xa6a8e8[_0x8f73('0x17')][_0x8f73('0x19')]||null:null,'attributes':_0xa6a8e8[_0x8f73('0x17')]?_0xa6a8e8[_0x8f73('0x17')][_0x8f73('0x1a')]||null:null,'limit':_0xa6a8e8[_0x8f73('0x17')]?_0xa6a8e8[_0x8f73('0x17')][_0x8f73('0x1b')]||null:null,'include':_0xa6a8e8[_0x8f73('0x17')]?_0xa6a8e8[_0x8f73('0x17')]['include']?_['map'](_0xa6a8e8[_0x8f73('0x17')][_0x8f73('0x1c')],function(_0x32cf3d){return{'model':db[_0x32cf3d[_0x8f73('0x1d')]],'as':_0x32cf3d['as'],'attributes':_0x32cf3d[_0x8f73('0x1a')],'include':_0x32cf3d[_0x8f73('0x1c')]?_['map'](_0x32cf3d[_0x8f73('0x1c')],function(_0x3ae3a0){return{'model':db[_0x3ae3a0[_0x8f73('0x1d')]],'as':_0x3ae3a0['as'],'attributes':_0x3ae3a0[_0x8f73('0x1a')],'include':_0x3ae3a0[_0x8f73('0x1c')]?_[_0x8f73('0x1e')](_0x3ae3a0[_0x8f73('0x1c')],function(_0xb3513a){return{'model':db[_0xb3513a[_0x8f73('0x1d')]],'as':_0xb3513a['as'],'attributes':_0xb3513a[_0x8f73('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8f73('0xa')](function(_0x1b51c1){logger[_0x8f73('0xb')](_0x8f73('0x14'),_0xa6a8e8);logger['debug'](_0x8f73('0x14'),_0xa6a8e8,JSON[_0x8f73('0xf')](_0x1b51c1));_0x294fd0(_0x1b51c1);})[_0x8f73('0x1f')](function(_0x1d4b92){logger[_0x8f73('0x10')](_0x8f73('0x14'),_0x1d4b92[_0x8f73('0x12')],_0xa6a8e8);_0x173b59(_0xdfe8f1[_0x8f73('0x10')](0x1f4,_0x1d4b92['message']));});});};exports[_0x8f73('0x20')]=function(_0x1899d1){var _0x4eadd3=this;return new Promise(function(_0x48954d,_0x4ca5f4){return db['CmHopper'][_0x8f73('0x21')]({'raw':_0x1899d1[_0x8f73('0x17')]?_0x1899d1['options'][_0x8f73('0x18')]===undefined?!![]:![]:!![],'where':_0x1899d1[_0x8f73('0x17')]?_0x1899d1[_0x8f73('0x17')][_0x8f73('0x19')]||null:null,'attributes':_0x1899d1[_0x8f73('0x17')]?_0x1899d1[_0x8f73('0x17')]['attributes']||null:null,'include':_0x1899d1['options']?_0x1899d1[_0x8f73('0x17')]['include']?_[_0x8f73('0x1e')](_0x1899d1[_0x8f73('0x17')]['include'],function(_0x3cbd31){return{'model':db[_0x3cbd31[_0x8f73('0x1d')]],'as':_0x3cbd31['as'],'attributes':_0x3cbd31[_0x8f73('0x1a')],'include':_0x3cbd31['include']?_[_0x8f73('0x1e')](_0x3cbd31[_0x8f73('0x1c')],function(_0x4b0acf){return{'model':db[_0x4b0acf[_0x8f73('0x1d')]],'as':_0x4b0acf['as'],'attributes':_0x4b0acf['attributes'],'include':_0x4b0acf[_0x8f73('0x1c')]?_['map'](_0x4b0acf[_0x8f73('0x1c')],function(_0x3d4bbc){return{'model':db[_0x3d4bbc[_0x8f73('0x1d')]],'as':_0x3d4bbc['as'],'attributes':_0x3d4bbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f73('0xa')](function(_0x8cd6d8){logger[_0x8f73('0xb')](_0x8f73('0x20'),_0x1899d1);logger[_0x8f73('0x22')]('ShowCmHopper',_0x1899d1,JSON[_0x8f73('0xf')](_0x8cd6d8));_0x48954d(_0x8cd6d8);})[_0x8f73('0x1f')](function(_0xfe236c){logger[_0x8f73('0x10')](_0x8f73('0x20'),_0xfe236c[_0x8f73('0x12')],_0x1899d1);_0x4ca5f4(_0x4eadd3[_0x8f73('0x10')](0x1f4,_0xfe236c[_0x8f73('0x12')]));});});};exports[_0x8f73('0x23')]=function(_0x35797e){var _0x3385cd=this;return new Promise(function(_0xd437b2,_0x42f076){return db[_0x8f73('0x15')][_0x8f73('0x24')](_0x35797e[_0x8f73('0x25')],{'raw':_0x35797e['options']?_0x35797e[_0x8f73('0x17')][_0x8f73('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2c3eea){logger[_0x8f73('0xb')](_0x8f73('0x23'),_0x35797e);logger[_0x8f73('0x22')](_0x8f73('0x23'),_0x35797e,JSON['stringify'](_0x2c3eea));_0xd437b2(_0x2c3eea);})[_0x8f73('0x1f')](function(_0x18e31d){logger[_0x8f73('0x10')](_0x8f73('0x23'),_0x18e31d[_0x8f73('0x12')],_0x35797e);_0x42f076(_0x3385cd[_0x8f73('0x10')](0x1f4,_0x18e31d[_0x8f73('0x12')]));});});};exports[_0x8f73('0x26')]=function(_0x2ad003){var _0x5640c4=this;return new Promise(function(_0x5185f5,_0x504330){return db[_0x8f73('0x15')]['update'](_0x2ad003[_0x8f73('0x25')],{'raw':_0x2ad003[_0x8f73('0x17')]?_0x2ad003['options'][_0x8f73('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad003[_0x8f73('0x17')]?_0x2ad003['options'][_0x8f73('0x19')]||null:null,'attributes':_0x2ad003['options']?_0x2ad003['options'][_0x8f73('0x1a')]||null:null,'limit':_0x2ad003[_0x8f73('0x17')]?_0x2ad003['options'][_0x8f73('0x1b')]||null:null})['then'](function(_0xc35377){logger['info'](_0x8f73('0x26'),_0x2ad003);logger['info'](_0x8f73('0x27'),JSON[_0x8f73('0xf')](_0x2ad003[_0x8f73('0x17')][_0x8f73('0x19')]),_0x2ad003[_0x8f73('0x25')][_0x8f73('0x28')]);logger[_0x8f73('0x22')](_0x8f73('0x26'),_0x2ad003,JSON[_0x8f73('0xf')](_0xc35377));_0x5185f5(_0xc35377);})[_0x8f73('0x1f')](function(_0x4b5dbe){logger['error']('UpdateCmHopper',_0x4b5dbe[_0x8f73('0x12')],_0x2ad003);_0x504330(_0x5640c4[_0x8f73('0x10')](0x1f4,_0x4b5dbe[_0x8f73('0x12')]));});});};exports['DestroyCmHopper']=function(_0x46e8fb){var _0x37c759=this;return new Promise(function(_0x5763a4,_0x58c18a){return db[_0x8f73('0x15')]['destroy']({'where':_0x46e8fb[_0x8f73('0x17')]?_0x46e8fb['options'][_0x8f73('0x19')]||null:null})[_0x8f73('0xa')](function(_0x5b4f08){logger[_0x8f73('0xb')](_0x8f73('0x29'),_0x46e8fb);logger[_0x8f73('0x22')]('DestroyCmHopper',_0x46e8fb,JSON[_0x8f73('0xf')](_0x5b4f08));_0x5763a4(_0x5b4f08);})[_0x8f73('0x1f')](function(_0x58e50b){logger['error'](_0x8f73('0x29'),_0x58e50b['message'],_0x46e8fb);_0x58c18a(_0x37c759['error'](0x1f4,_0x58e50b[_0x8f73('0x12')]));});});};exports[_0x8f73('0x2a')]=function(_0x4e26ff){var _0x1f06d9=this;return new Promise(function(_0x2a007d,_0x5ea2b0){return db['CmContact'][_0x8f73('0x2b')]()[_0x8f73('0xa')](function(_0x318b4d){return db[_0x8f73('0x2c')]['transaction'](function(_0xc85260){return db['CmHopper'][_0x8f73('0x16')]({'where':_0x4e26ff[_0x8f73('0x17')]?_0x4e26ff['options'][_0x8f73('0x19')]||null:null,'attributes':_0x4e26ff[_0x8f73('0x17')]?_0x4e26ff[_0x8f73('0x17')][_0x8f73('0x1a')]||null:null,'limit':_0x4e26ff['options']?_0x4e26ff['options'][_0x8f73('0x1b')]||null:null,'order':_0x4e26ff[_0x8f73('0x17')]?_0x4e26ff[_0x8f73('0x17')][_0x8f73('0x2d')]||null:null,'transaction':_0xc85260,'lock':_0xc85260[_0x8f73('0x2e')][_0x8f73('0x2f')],'include':[{'model':db[_0x8f73('0x30')],'as':_0x8f73('0x31'),'attributes':_[_0x8f73('0x32')](_0x318b4d)},{'model':db[_0x8f73('0x33')],'as':_0x8f73('0x34'),'attributes':['id',_0x8f73('0x35'),_0x8f73('0x36')]}]})[_0x8f73('0xa')](function(_0x32970e){var _0x1874fd=[];var _0x2e4083=[];for(var _0x26d64f=0x0;_0x26d64f<_0x32970e[_0x8f73('0x37')];_0x26d64f+=0x1){var _0x22fcbf=_0x32970e[_0x26d64f]['UserId'];if(_0x22fcbf===null){_0x1874fd['push'](_0x32970e[_0x26d64f][_0x8f73('0x38')](_0x4e26ff['body'],{'transaction':_0xc85260}));}else if(!_0x2e4083[_0x8f73('0x39')](_0x22fcbf)){_0x2e4083[_0x8f73('0x3a')](_0x22fcbf);_0x1874fd[_0x8f73('0x3a')](_0x32970e[_0x26d64f][_0x8f73('0x38')](_0x4e26ff[_0x8f73('0x25')],{'transaction':_0xc85260}));}}return BPromise[_0x8f73('0x3b')](_0x1874fd);});})[_0x8f73('0xa')](function(_0x50ea12){logger[_0x8f73('0xb')](_0x8f73('0x2a'),_0x4e26ff);if(_0x50ea12[_0x8f73('0x37')]>0x0){logger[_0x8f73('0xb')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x50ea12[0x0][_0x8f73('0x3c')]['id'],_0x50ea12[0x0][_0x8f73('0x3c')][_0x8f73('0x3d')],_0x50ea12[0x0][_0x8f73('0x3c')][_0x8f73('0x28')]);}logger[_0x8f73('0x22')](_0x8f73('0x2a'),_0x4e26ff,JSON[_0x8f73('0xf')](_0x50ea12));_0x2a007d(_0x50ea12);})['catch'](function(_0x496ac9){logger[_0x8f73('0x10')](_0x8f73('0x2a'),_0x496ac9[_0x8f73('0x12')],_0x4e26ff);_0x5ea2b0(_0x1f06d9[_0x8f73('0x10')](0x1f4,_0x496ac9[_0x8f73('0x12')]));});});});};exports[_0x8f73('0x3e')]=function(_0x503fbb){var _0x4c7796=this;return new Promise(function(_0x10dfac,_0x22691a){return db[_0x8f73('0x2c')]['transaction'](function(_0x155779){return db['CmHopperFinal'][_0x8f73('0x24')](_0x503fbb[_0x8f73('0x25')],{'raw':_0x503fbb[_0x8f73('0x17')]?_0x503fbb[_0x8f73('0x17')][_0x8f73('0x18')]===undefined?!![]:![]:!![],'transaction':_0x155779})[_0x8f73('0xa')](function(){logger[_0x8f73('0xb')](_0x8f73('0x3f'),JSON['stringify'](_0x503fbb[_0x8f73('0x17')][_0x8f73('0x19')]),_0x503fbb[_0x8f73('0x17')]['where'][_0x8f73('0x28')]);return db['CmHopper']['destroy']({'where':_0x503fbb[_0x8f73('0x17')]?_0x503fbb[_0x8f73('0x17')]['where']||null:null,'transaction':_0x155779});});})['then'](function(_0x44f151){logger['info'](_0x8f73('0x3e'),_0x503fbb);logger['debug'](_0x8f73('0x3e'),_0x503fbb,JSON['stringify'](_0x44f151));_0x10dfac(_0x44f151);})[_0x8f73('0x1f')](function(_0x53c5df){logger[_0x8f73('0x10')](_0x8f73('0x3e'),_0x53c5df[_0x8f73('0x12')],_0x503fbb);_0x22691a(_0x4c7796[_0x8f73('0x10')](0x1f4,_0x53c5df[_0x8f73('0x12')]));});});};exports['CountReScheduled']=function(_0x1524fc){var _0x496c1c=this;return new Promise(function(_0xf001b8,_0x2d4733){return db['CmHopper'][_0x8f73('0x16')]({'raw':_0x1524fc['options']?_0x1524fc[_0x8f73('0x17')][_0x8f73('0x18')]===undefined?!![]:![]:!![],'where':_0x1524fc['options']?_0x1524fc[_0x8f73('0x17')]['where']||null:null,'attributes':[[db[_0x8f73('0x2c')]['fn']('COUNT',db[_0x8f73('0x2c')]['fn']('IF',db['sequelize']['literal'](_0x8f73('0x40')+util[_0x8f73('0x41')](_0x8f73('0x42'),moment()[_0x8f73('0x41')](_0x8f73('0x43')))+_0x8f73('0x44')))),_0x8f73('0x45')]]})[_0x8f73('0xa')](function(_0x32d56f){logger[_0x8f73('0xb')](_0x8f73('0x46'),_0x1524fc);logger[_0x8f73('0x22')](_0x8f73('0x46'),_0x1524fc,JSON['stringify'](_0x32d56f));_0xf001b8(_0x32d56f);})[_0x8f73('0x1f')](function(_0x1e0796){logger['error'](_0x8f73('0x46'),_0x1e0796[_0x8f73('0x12')],_0x1524fc);_0x2d4733(_0x496c1c[_0x8f73('0x10')](0x1f4,_0x1e0796[_0x8f73('0x12')]));});});};exports[_0x8f73('0x47')]=function(_0x37855e){var _0x25dc79=this;return new Promise(function(_0x186d38,_0x239735){return db[_0x8f73('0x30')][_0x8f73('0x2b')]()[_0x8f73('0xa')](function(_0x280746){return db[_0x8f73('0x2c')][_0x8f73('0x48')](function(_0x3847e8){return db['CmHopper'][_0x8f73('0x16')]({'where':_0x37855e[_0x8f73('0x17')]?_0x37855e[_0x8f73('0x17')][_0x8f73('0x19')]||null:null,'attributes':_0x37855e['options']?_0x37855e[_0x8f73('0x17')][_0x8f73('0x1a')]||null:null,'limit':0x1,'order':_0x37855e[_0x8f73('0x17')]?_0x37855e['options']['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x3847e8,'lock':_0x3847e8['LOCK'][_0x8f73('0x2f')],'include':_0x37855e[_0x8f73('0x17')]?_0x37855e[_0x8f73('0x17')][_0x8f73('0x1c')]?_['map'](_0x37855e[_0x8f73('0x17')][_0x8f73('0x1c')],function(_0x45beae){return{'model':db[_0x45beae[_0x8f73('0x1d')]],'as':_0x45beae['as'],'attributes':_0x45beae[_0x8f73('0x1a')],'include':_0x45beae[_0x8f73('0x1c')]?_['map'](_0x45beae[_0x8f73('0x1c')],function(_0x46ab54){return{'model':db[_0x46ab54[_0x8f73('0x1d')]],'as':_0x46ab54['as'],'attributes':_0x46ab54['attributes'],'include':_0x46ab54[_0x8f73('0x1c')]?_['map'](_0x46ab54['include'],function(_0x10ff83){return{'model':db[_0x10ff83[_0x8f73('0x1d')]],'as':_0x10ff83['as'],'attributes':_0x10ff83[_0x8f73('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8f73('0xa')](function(_0x5e30ca){var _0x423f84=[];for(var _0x19d71e=0x0;_0x19d71e<_0x5e30ca[_0x8f73('0x37')];_0x19d71e+=0x1){_0x423f84[_0x8f73('0x3a')](_0x5e30ca[_0x19d71e][_0x8f73('0x38')](_0x37855e['body'],{'transaction':_0x3847e8}));}return BPromise[_0x8f73('0x3b')](_0x423f84);});})[_0x8f73('0xa')](function(_0x11545c){logger[_0x8f73('0xb')](_0x8f73('0x47'),_0x37855e);logger['debug'](_0x8f73('0x47'),_0x37855e,JSON['stringify'](_0x11545c));_0x186d38(_0x11545c);})[_0x8f73('0x1f')](function(_0x2cae5f){logger[_0x8f73('0x10')](_0x8f73('0x47'),_0x2cae5f[_0x8f73('0x12')],_0x37855e);_0x239735(_0x25dc79[_0x8f73('0x10')](0x1f4,_0x2cae5f[_0x8f73('0x12')]));});});});};exports[_0x8f73('0x49')]=function(_0x575c2e){var _0x178eaa=this;return new Promise(function(_0x7fa963,_0x419a46){db[_0x8f73('0x30')]['describe']()[_0x8f73('0xa')](function(_0x4ee84a){return db[_0x8f73('0x15')]['findAll']({'raw':_0x575c2e[_0x8f73('0x17')]?_0x575c2e[_0x8f73('0x17')][_0x8f73('0x18')]===undefined?!![]:![]:!![],'where':_0x575c2e[_0x8f73('0x17')]?_0x575c2e[_0x8f73('0x17')][_0x8f73('0x19')]||null:null,'attributes':_0x575c2e[_0x8f73('0x17')]?_0x575c2e[_0x8f73('0x17')][_0x8f73('0x1a')]||null:null,'limit':_0x575c2e[_0x8f73('0x17')]?_0x575c2e[_0x8f73('0x17')]['limit']||null:null,'include':_0x575c2e[_0x8f73('0x17')]?_0x575c2e[_0x8f73('0x17')]['include']?_[_0x8f73('0x1e')](_0x575c2e['options']['include'],function(_0x3f35fc){return{'model':db[_0x3f35fc['model']],'as':_0x3f35fc['as'],'attributes':_0x3f35fc['as']===_0x8f73('0x31')?_[_0x8f73('0x32')](_0x4ee84a):_0x3f35fc[_0x8f73('0x1a')],'include':_0x3f35fc[_0x8f73('0x1c')]?_[_0x8f73('0x1e')](_0x3f35fc[_0x8f73('0x1c')],function(_0x370a98){return{'model':db[_0x370a98[_0x8f73('0x1d')]],'as':_0x370a98['as'],'attributes':_0x370a98[_0x8f73('0x1a')],'include':_0x370a98[_0x8f73('0x1c')]?_[_0x8f73('0x1e')](_0x370a98[_0x8f73('0x1c')],function(_0x375945){return{'model':db[_0x375945[_0x8f73('0x1d')]],'as':_0x375945['as'],'attributes':_0x375945[_0x8f73('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8f73('0xa')](function(_0xba450c){logger[_0x8f73('0xb')](_0x8f73('0x14'),_0x575c2e);logger[_0x8f73('0x22')](_0x8f73('0x14'),_0x575c2e,JSON[_0x8f73('0xf')](_0xba450c));_0x7fa963(_0xba450c);})[_0x8f73('0x1f')](function(_0x462d5a){logger[_0x8f73('0x10')](_0x8f73('0x14'),_0x462d5a[_0x8f73('0x12')],_0x575c2e);_0x419a46(_0x178eaa['error'](0x1f4,_0x462d5a['message']));});});});};exports[_0x8f73('0x4a')]=function(_0x3fa6ab){var _0x133795=this;return new Promise(function(_0x5198ad,_0x2f9e4d){return db[_0x8f73('0x2c')][_0x8f73('0x48')](function(_0x46732f){return db['CmHopper'][_0x8f73('0x38')]({'active':![]},{'where':{},'transaction':_0x46732f})[_0x8f73('0xa')](function(_0x4dd509){logger[_0x8f73('0xb')](_0x8f73('0x4a'),_0x3fa6ab);logger[_0x8f73('0x22')]('ResetActiveCalls',_0x3fa6ab,JSON[_0x8f73('0xf')](_0x4dd509));_0x5198ad(_0x4dd509);})[_0x8f73('0x1f')](function(_0x59a018){logger[_0x8f73('0x10')](_0x8f73('0x4a'),_0x59a018['message'],_0x3fa6ab);_0x2f9e4d(_0x133795[_0x8f73('0x10')](0x1f4,_0x59a018[_0x8f73('0x12')]));});});});}; \ No newline at end of file +var _0x4422=['GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','UserId','includes','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','ResetActiveCalls','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','options','where','attributes','limit','include','map','model','ShowCmHopper','CmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','raw','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy'];(function(_0x44e6a9,_0x29ffe1){var _0x55629f=function(_0x195e46){while(--_0x195e46){_0x44e6a9['push'](_0x44e6a9['shift']());}};_0x55629f(++_0x29ffe1);}(_0x4422,0x1be));var _0x2442=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4422[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2442('0x0'));var util=require(_0x2442('0x1'));var moment=require(_0x2442('0x2'));var BPromise=require(_0x2442('0x3'));var rs=require(_0x2442('0x4'));var fs=require('fs');var Redis=require(_0x2442('0x5'));var db=require(_0x2442('0x6'))['db'];var utils=require(_0x2442('0x7'));var logger=require(_0x2442('0x8'))(_0x2442('0x9'));var config=require(_0x2442('0xa'));var jayson=require(_0x2442('0xb'));var client=jayson[_0x2442('0xc')][_0x2442('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21510d,_0x29a485,_0x4ff1ed){return new BPromise(function(_0x17e387,_0x180b95){return client[_0x2442('0xe')](_0x21510d,_0x4ff1ed)[_0x2442('0xf')](function(_0x1fb4de){logger[_0x2442('0x10')]('CmHopper,\x20%s,\x20%s',_0x29a485,_0x2442('0x11'));logger[_0x2442('0x12')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x29a485,'request\x20sent',JSON[_0x2442('0x13')](_0x1fb4de));if(_0x1fb4de[_0x2442('0x14')]){if(_0x1fb4de[_0x2442('0x14')][_0x2442('0x15')]===0x1f4){logger[_0x2442('0x14')](_0x2442('0x16'),_0x29a485,_0x1fb4de['error'][_0x2442('0x17')]);return _0x180b95(_0x1fb4de[_0x2442('0x14')]['message']);}logger[_0x2442('0x14')]('CmHopper,\x20%s,\x20%s',_0x29a485,_0x1fb4de[_0x2442('0x14')]['message']);return _0x17e387(_0x1fb4de['error'][_0x2442('0x17')]);}else{logger[_0x2442('0x10')](_0x2442('0x16'),_0x29a485,_0x2442('0x11'));_0x17e387(_0x1fb4de[_0x2442('0x18')][_0x2442('0x17')]);}})[_0x2442('0x19')](function(_0x4ce774){logger['error']('CmHopper,\x20%s,\x20%s',_0x29a485,_0x4ce774);_0x180b95(_0x4ce774);});});}exports[_0x2442('0x1a')]=function(_0x38b2f1){var _0x9c3b4c=this;return new Promise(function(_0x464fd4,_0x341424){return db['CmHopper']['findAll']({'raw':_0x38b2f1[_0x2442('0x1b')]?_0x38b2f1[_0x2442('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x38b2f1[_0x2442('0x1b')]?_0x38b2f1[_0x2442('0x1b')][_0x2442('0x1c')]||null:null,'attributes':_0x38b2f1[_0x2442('0x1b')]?_0x38b2f1[_0x2442('0x1b')][_0x2442('0x1d')]||null:null,'limit':_0x38b2f1[_0x2442('0x1b')]?_0x38b2f1[_0x2442('0x1b')][_0x2442('0x1e')]||null:null,'include':_0x38b2f1[_0x2442('0x1b')]?_0x38b2f1[_0x2442('0x1b')][_0x2442('0x1f')]?_[_0x2442('0x20')](_0x38b2f1['options']['include'],function(_0x14d1d8){return{'model':db[_0x14d1d8[_0x2442('0x21')]],'as':_0x14d1d8['as'],'attributes':_0x14d1d8['attributes'],'include':_0x14d1d8[_0x2442('0x1f')]?_[_0x2442('0x20')](_0x14d1d8[_0x2442('0x1f')],function(_0x25aaf4){return{'model':db[_0x25aaf4[_0x2442('0x21')]],'as':_0x25aaf4['as'],'attributes':_0x25aaf4[_0x2442('0x1d')],'include':_0x25aaf4[_0x2442('0x1f')]?_[_0x2442('0x20')](_0x25aaf4[_0x2442('0x1f')],function(_0x4550b3){return{'model':db[_0x4550b3[_0x2442('0x21')]],'as':_0x4550b3['as'],'attributes':_0x4550b3[_0x2442('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2442('0xf')](function(_0x520307){logger[_0x2442('0x10')]('GetCmHopper',_0x38b2f1);logger[_0x2442('0x12')](_0x2442('0x1a'),_0x38b2f1,JSON['stringify'](_0x520307));_0x464fd4(_0x520307);})[_0x2442('0x19')](function(_0x3cd733){logger[_0x2442('0x14')]('GetCmHopper',_0x3cd733[_0x2442('0x17')],_0x38b2f1);_0x341424(_0x9c3b4c[_0x2442('0x14')](0x1f4,_0x3cd733[_0x2442('0x17')]));});});};exports[_0x2442('0x22')]=function(_0x584e0d){var _0x2e7a5f=this;return new Promise(function(_0x13a92a,_0x2593b1){return db[_0x2442('0x23')][_0x2442('0x24')]({'raw':_0x584e0d[_0x2442('0x1b')]?_0x584e0d[_0x2442('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x584e0d[_0x2442('0x1b')]?_0x584e0d[_0x2442('0x1b')]['where']||null:null,'attributes':_0x584e0d['options']?_0x584e0d[_0x2442('0x1b')][_0x2442('0x1d')]||null:null,'include':_0x584e0d['options']?_0x584e0d[_0x2442('0x1b')][_0x2442('0x1f')]?_[_0x2442('0x20')](_0x584e0d[_0x2442('0x1b')][_0x2442('0x1f')],function(_0x79f4d1){return{'model':db[_0x79f4d1[_0x2442('0x21')]],'as':_0x79f4d1['as'],'attributes':_0x79f4d1[_0x2442('0x1d')],'include':_0x79f4d1[_0x2442('0x1f')]?_[_0x2442('0x20')](_0x79f4d1[_0x2442('0x1f')],function(_0x2604c1){return{'model':db[_0x2604c1[_0x2442('0x21')]],'as':_0x2604c1['as'],'attributes':_0x2604c1['attributes'],'include':_0x2604c1['include']?_['map'](_0x2604c1[_0x2442('0x1f')],function(_0x2b73d5){return{'model':db[_0x2b73d5[_0x2442('0x21')]],'as':_0x2b73d5['as'],'attributes':_0x2b73d5[_0x2442('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2442('0xf')](function(_0x5ad2e1){logger[_0x2442('0x10')](_0x2442('0x22'),_0x584e0d);logger[_0x2442('0x12')]('ShowCmHopper',_0x584e0d,JSON['stringify'](_0x5ad2e1));_0x13a92a(_0x5ad2e1);})[_0x2442('0x19')](function(_0x2981b6){logger['error']('ShowCmHopper',_0x2981b6[_0x2442('0x17')],_0x584e0d);_0x2593b1(_0x2e7a5f[_0x2442('0x14')](0x1f4,_0x2981b6['message']));});});};exports['CreateCmHopper']=function(_0x3c14f6){var _0xea9e6e=this;return new Promise(function(_0x5bd7c7,_0x58dc27){return db[_0x2442('0x23')][_0x2442('0x25')](_0x3c14f6[_0x2442('0x26')],{'raw':_0x3c14f6[_0x2442('0x1b')]?_0x3c14f6[_0x2442('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4dad20){logger[_0x2442('0x10')]('CreateCmHopper',_0x3c14f6);logger['debug'](_0x2442('0x27'),_0x3c14f6,JSON[_0x2442('0x13')](_0x4dad20));_0x5bd7c7(_0x4dad20);})['catch'](function(_0x24be36){logger[_0x2442('0x14')]('CreateCmHopper',_0x24be36[_0x2442('0x17')],_0x3c14f6);_0x58dc27(_0xea9e6e['error'](0x1f4,_0x24be36[_0x2442('0x17')]));});});};exports[_0x2442('0x28')]=function(_0x54aaa7){var _0x30007b=this;return new Promise(function(_0x36c7b3,_0x152e86){return db[_0x2442('0x23')][_0x2442('0x29')](_0x54aaa7['body'],{'raw':_0x54aaa7[_0x2442('0x1b')]?_0x54aaa7[_0x2442('0x1b')][_0x2442('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54aaa7[_0x2442('0x1b')]?_0x54aaa7[_0x2442('0x1b')][_0x2442('0x1c')]||null:null,'attributes':_0x54aaa7[_0x2442('0x1b')]?_0x54aaa7[_0x2442('0x1b')][_0x2442('0x1d')]||null:null,'limit':_0x54aaa7[_0x2442('0x1b')]?_0x54aaa7[_0x2442('0x1b')][_0x2442('0x1e')]||null:null})['then'](function(_0x56c0e0){logger[_0x2442('0x10')]('UpdateCmHopper',_0x54aaa7);logger[_0x2442('0x10')](_0x2442('0x2b'),JSON[_0x2442('0x13')](_0x54aaa7[_0x2442('0x1b')]['where']),_0x54aaa7[_0x2442('0x26')]['active']);logger[_0x2442('0x12')](_0x2442('0x28'),_0x54aaa7,JSON[_0x2442('0x13')](_0x56c0e0));_0x36c7b3(_0x56c0e0);})['catch'](function(_0x37455b){logger[_0x2442('0x14')](_0x2442('0x28'),_0x37455b['message'],_0x54aaa7);_0x152e86(_0x30007b['error'](0x1f4,_0x37455b[_0x2442('0x17')]));});});};exports[_0x2442('0x2c')]=function(_0x43e490){var _0x34acfa=this;return new Promise(function(_0x11048c,_0xb9cb05){return db['CmHopper'][_0x2442('0x2d')]({'where':_0x43e490[_0x2442('0x1b')]?_0x43e490[_0x2442('0x1b')]['where']||null:null})['then'](function(_0x55f439){logger[_0x2442('0x10')](_0x2442('0x2c'),_0x43e490);logger['debug'](_0x2442('0x2c'),_0x43e490,JSON[_0x2442('0x13')](_0x55f439));_0x11048c(_0x55f439);})[_0x2442('0x19')](function(_0x34b085){logger[_0x2442('0x14')](_0x2442('0x2c'),_0x34b085[_0x2442('0x17')],_0x43e490);_0xb9cb05(_0x34acfa['error'](0x1f4,_0x34b085[_0x2442('0x17')]));});});};exports[_0x2442('0x2e')]=function(_0x2992f3){var _0x27b8db=this;return new Promise(function(_0x2d86c3,_0x486010){return db[_0x2442('0x2f')][_0x2442('0x30')]()[_0x2442('0xf')](function(_0x4e9d49){return db[_0x2442('0x31')]['transaction'](function(_0x266af7){return db[_0x2442('0x23')]['findAll']({'where':_0x2992f3[_0x2442('0x1b')]?_0x2992f3[_0x2442('0x1b')][_0x2442('0x1c')]||null:null,'attributes':_0x2992f3[_0x2442('0x1b')]?_0x2992f3[_0x2442('0x1b')][_0x2442('0x1d')]||null:null,'limit':_0x2992f3['options']?_0x2992f3[_0x2442('0x1b')][_0x2442('0x1e')]||null:null,'order':_0x2992f3[_0x2442('0x1b')]?_0x2992f3[_0x2442('0x1b')][_0x2442('0x32')]||null:null,'transaction':_0x266af7,'lock':_0x266af7[_0x2442('0x33')][_0x2442('0x34')],'include':[{'model':db[_0x2442('0x2f')],'as':'Contact','attributes':_[_0x2442('0x35')](_0x4e9d49)},{'model':db[_0x2442('0x36')],'as':_0x2442('0x37'),'attributes':['id',_0x2442('0x38'),_0x2442('0x39')]}]})[_0x2442('0xf')](function(_0x445133){var _0x57a4a0=[];var _0x47038d=[];for(var _0x5e5b2f=0x0;_0x5e5b2f<_0x445133['length'];_0x5e5b2f+=0x1){var _0x38c861=_0x445133[_0x5e5b2f][_0x2442('0x3a')];if(_0x38c861===null){_0x57a4a0['push'](_0x445133[_0x5e5b2f]['update'](_0x2992f3[_0x2442('0x26')],{'transaction':_0x266af7}));}else if(!_0x47038d[_0x2442('0x3b')](_0x38c861)){_0x47038d['push'](_0x38c861);_0x57a4a0[_0x2442('0x3c')](_0x445133[_0x5e5b2f][_0x2442('0x29')](_0x2992f3['body'],{'transaction':_0x266af7}));}}return BPromise[_0x2442('0x3d')](_0x57a4a0);});})[_0x2442('0xf')](function(_0x53c12b){logger[_0x2442('0x10')](_0x2442('0x2e'),_0x2992f3);if(_0x53c12b[_0x2442('0x3e')]>0x0){logger[_0x2442('0x10')](_0x2442('0x3f'),_0x53c12b[0x0][_0x2442('0x40')]['id'],_0x53c12b[0x0]['dataValues'][_0x2442('0x41')],_0x53c12b[0x0][_0x2442('0x40')]['active']);}logger['debug'](_0x2442('0x2e'),_0x2992f3,JSON['stringify'](_0x53c12b));_0x2d86c3(_0x53c12b);})[_0x2442('0x19')](function(_0x51e09c){logger['error'](_0x2442('0x2e'),_0x51e09c[_0x2442('0x17')],_0x2992f3);_0x486010(_0x27b8db['error'](0x1f4,_0x51e09c[_0x2442('0x17')]));});});});};exports['MoveContactManagedDialer']=function(_0x204886){var _0x25ee3e=this;return new Promise(function(_0x4adc23,_0x54e10e){return db[_0x2442('0x31')][_0x2442('0x42')](function(_0x2cda5b){return db['CmHopperFinal'][_0x2442('0x25')](_0x204886[_0x2442('0x26')],{'raw':_0x204886['options']?_0x204886[_0x2442('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2cda5b})[_0x2442('0xf')](function(){logger['info'](_0x2442('0x43'),JSON[_0x2442('0x13')](_0x204886[_0x2442('0x1b')][_0x2442('0x1c')]),_0x204886[_0x2442('0x1b')][_0x2442('0x1c')][_0x2442('0x44')]);return db[_0x2442('0x23')][_0x2442('0x2d')]({'where':_0x204886['options']?_0x204886[_0x2442('0x1b')][_0x2442('0x1c')]||null:null,'transaction':_0x2cda5b});});})[_0x2442('0xf')](function(_0x17e26b){logger['info'](_0x2442('0x45'),_0x204886);logger[_0x2442('0x12')](_0x2442('0x45'),_0x204886,JSON['stringify'](_0x17e26b));_0x4adc23(_0x17e26b);})[_0x2442('0x19')](function(_0x4bf7c5){logger[_0x2442('0x14')](_0x2442('0x45'),_0x4bf7c5[_0x2442('0x17')],_0x204886);_0x54e10e(_0x25ee3e[_0x2442('0x14')](0x1f4,_0x4bf7c5[_0x2442('0x17')]));});});};exports[_0x2442('0x46')]=function(_0x406e88){var _0x368fed=this;return new Promise(function(_0x4bef9a,_0x10c98c){return db[_0x2442('0x23')][_0x2442('0x47')]({'raw':_0x406e88[_0x2442('0x1b')]?_0x406e88[_0x2442('0x1b')][_0x2442('0x2a')]===undefined?!![]:![]:!![],'where':_0x406e88[_0x2442('0x1b')]?_0x406e88['options'][_0x2442('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2442('0x48'),db['sequelize']['fn']('IF',db[_0x2442('0x31')][_0x2442('0x49')]('`scheduledat`\x20>=\x20'+util[_0x2442('0x4a')](_0x2442('0x4b'),moment()[_0x2442('0x4a')](_0x2442('0x4c')))+_0x2442('0x4d')))),_0x2442('0x4e')]]})[_0x2442('0xf')](function(_0x74f0a5){logger[_0x2442('0x10')](_0x2442('0x46'),_0x406e88);logger[_0x2442('0x12')](_0x2442('0x46'),_0x406e88,JSON['stringify'](_0x74f0a5));_0x4bef9a(_0x74f0a5);})[_0x2442('0x19')](function(_0x3558e6){logger[_0x2442('0x14')](_0x2442('0x46'),_0x3558e6[_0x2442('0x17')],_0x406e88);_0x10c98c(_0x368fed[_0x2442('0x14')](0x1f4,_0x3558e6[_0x2442('0x17')]));});});};exports[_0x2442('0x4f')]=function(_0x41609b){var _0xad3ffb=this;return new Promise(function(_0x36c610,_0x1e09b0){return db['CmContact'][_0x2442('0x30')]()['then'](function(_0x48df61){return db[_0x2442('0x31')][_0x2442('0x42')](function(_0x6832ba){return db[_0x2442('0x23')][_0x2442('0x47')]({'where':_0x41609b[_0x2442('0x1b')]?_0x41609b[_0x2442('0x1b')]['where']||null:null,'attributes':_0x41609b[_0x2442('0x1b')]?_0x41609b[_0x2442('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x41609b['options']?_0x41609b[_0x2442('0x1b')]['order']||null:null,'group':db[_0x2442('0x23')][_0x2442('0x3a')],'transaction':_0x6832ba,'lock':_0x6832ba[_0x2442('0x33')][_0x2442('0x34')],'include':_0x41609b[_0x2442('0x1b')]?_0x41609b[_0x2442('0x1b')][_0x2442('0x1f')]?_['map'](_0x41609b['options'][_0x2442('0x1f')],function(_0x41ba13){return{'model':db[_0x41ba13[_0x2442('0x21')]],'as':_0x41ba13['as'],'attributes':_0x41ba13[_0x2442('0x1d')],'include':_0x41ba13[_0x2442('0x1f')]?_[_0x2442('0x20')](_0x41ba13[_0x2442('0x1f')],function(_0x4c6878){return{'model':db[_0x4c6878[_0x2442('0x21')]],'as':_0x4c6878['as'],'attributes':_0x4c6878['attributes'],'include':_0x4c6878['include']?_['map'](_0x4c6878['include'],function(_0x2d49e6){return{'model':db[_0x2d49e6[_0x2442('0x21')]],'as':_0x2d49e6['as'],'attributes':_0x2d49e6[_0x2442('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2442('0xf')](function(_0x5e8208){var _0x52f107=[];for(var _0x4505b3=0x0;_0x4505b3<_0x5e8208[_0x2442('0x3e')];_0x4505b3+=0x1){_0x52f107[_0x2442('0x3c')](_0x5e8208[_0x4505b3]['update'](_0x41609b[_0x2442('0x26')],{'transaction':_0x6832ba}));}return BPromise[_0x2442('0x3d')](_0x52f107);});})['then'](function(_0x3b22e2){logger['info'](_0x2442('0x4f'),_0x41609b);logger['debug'](_0x2442('0x4f'),_0x41609b,JSON[_0x2442('0x13')](_0x3b22e2));_0x36c610(_0x3b22e2);})['catch'](function(_0x3a97f9){logger['error'](_0x2442('0x4f'),_0x3a97f9['message'],_0x41609b);_0x1e09b0(_0xad3ffb[_0x2442('0x14')](0x1f4,_0x3a97f9['message']));});});});};exports[_0x2442('0x50')]=function(_0x556e52){var _0x211efd=this;return new Promise(function(_0x25f6f0,_0x1d97ea){db[_0x2442('0x2f')]['describe']()[_0x2442('0xf')](function(_0x33a426){return db[_0x2442('0x23')][_0x2442('0x47')]({'raw':_0x556e52[_0x2442('0x1b')]?_0x556e52[_0x2442('0x1b')][_0x2442('0x2a')]===undefined?!![]:![]:!![],'where':_0x556e52[_0x2442('0x1b')]?_0x556e52[_0x2442('0x1b')][_0x2442('0x1c')]||null:null,'attributes':_0x556e52['options']?_0x556e52[_0x2442('0x1b')][_0x2442('0x1d')]||null:null,'limit':_0x556e52[_0x2442('0x1b')]?_0x556e52[_0x2442('0x1b')][_0x2442('0x1e')]||null:null,'include':_0x556e52[_0x2442('0x1b')]?_0x556e52[_0x2442('0x1b')][_0x2442('0x1f')]?_[_0x2442('0x20')](_0x556e52[_0x2442('0x1b')]['include'],function(_0x494edd){return{'model':db[_0x494edd[_0x2442('0x21')]],'as':_0x494edd['as'],'attributes':_0x494edd['as']==='Contact'?_[_0x2442('0x35')](_0x33a426):_0x494edd[_0x2442('0x1d')],'include':_0x494edd[_0x2442('0x1f')]?_['map'](_0x494edd[_0x2442('0x1f')],function(_0x40387a){return{'model':db[_0x40387a[_0x2442('0x21')]],'as':_0x40387a['as'],'attributes':_0x40387a[_0x2442('0x1d')],'include':_0x40387a[_0x2442('0x1f')]?_[_0x2442('0x20')](_0x40387a[_0x2442('0x1f')],function(_0x1c3312){return{'model':db[_0x1c3312[_0x2442('0x21')]],'as':_0x1c3312['as'],'attributes':_0x1c3312[_0x2442('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x493fcc){logger['info']('GetCmHopper',_0x556e52);logger[_0x2442('0x12')](_0x2442('0x1a'),_0x556e52,JSON[_0x2442('0x13')](_0x493fcc));_0x25f6f0(_0x493fcc);})['catch'](function(_0x315ab7){logger[_0x2442('0x14')](_0x2442('0x1a'),_0x315ab7[_0x2442('0x17')],_0x556e52);_0x1d97ea(_0x211efd[_0x2442('0x14')](0x1f4,_0x315ab7[_0x2442('0x17')]));});});});};exports[_0x2442('0x51')]=function(_0x58fba7){var _0x15a9b1=this;return new Promise(function(_0x102e2b,_0x2b5b57){return db[_0x2442('0x31')][_0x2442('0x42')](function(_0x5e168e){return db[_0x2442('0x23')][_0x2442('0x29')]({'active':![]},{'where':{},'transaction':_0x5e168e})[_0x2442('0xf')](function(_0x3184c2){logger[_0x2442('0x10')]('ResetActiveCalls',_0x58fba7);logger[_0x2442('0x12')](_0x2442('0x51'),_0x58fba7,JSON[_0x2442('0x13')](_0x3184c2));_0x102e2b(_0x3184c2);})[_0x2442('0x19')](function(_0x27bdd8){logger[_0x2442('0x14')]('ResetActiveCalls',_0x27bdd8[_0x2442('0x17')],_0x58fba7);_0x2b5b57(_0x15a9b1[_0x2442('0x14')](0x1f4,_0x27bdd8[_0x2442('0x17')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 79db7cf..f6940c2 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 _0x7c57=['index','/describe','getOpenContacts','/:id','post','create','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x498aa1,_0x3bf75d){var _0x50b3f4=function(_0x14112d){while(--_0x14112d){_0x498aa1['push'](_0x498aa1['shift']());}};_0x50b3f4(++_0x3bf75d);}(_0x7c57,0x12a));var _0x77c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c57[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x77c5('0x0'));var util=require(_0x77c5('0x1'));var path=require(_0x77c5('0x2'));var timeout=require(_0x77c5('0x3'));var express=require(_0x77c5('0x4'));var router=express[_0x77c5('0x5')]();var fs_extra=require(_0x77c5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77c5('0x7'));var controller=require('./cmHopper.controller');router[_0x77c5('0x8')]('/',auth[_0x77c5('0x9')](),controller[_0x77c5('0xa')]);router['get'](_0x77c5('0xb'),auth[_0x77c5('0x9')](),controller['describe']);router['get']('/opencontacts',auth[_0x77c5('0x9')](),controller[_0x77c5('0xc')]);router[_0x77c5('0x8')](_0x77c5('0xd'),auth[_0x77c5('0x9')](),controller['show']);router[_0x77c5('0xe')]('/',auth[_0x77c5('0x9')](),controller[_0x77c5('0xf')]);router[_0x77c5('0xe')]('/preview',auth[_0x77c5('0x9')](),controller[_0x77c5('0x10')]);router[_0x77c5('0x11')]('/:id',auth[_0x77c5('0x9')](),controller[_0x77c5('0x12')]);router[_0x77c5('0x13')](_0x77c5('0xd'),auth[_0x77c5('0x9')](),controller[_0x77c5('0x14')]);module[_0x77c5('0x15')]=router; \ No newline at end of file +var _0xf05f=['./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','create','/preview','put','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2762ce,_0x4505a0){var _0x444b75=function(_0xad562a){while(--_0xad562a){_0x2762ce['push'](_0x2762ce['shift']());}};_0x444b75(++_0x4505a0);}(_0xf05f,0xcb));var _0xff05=function(_0x245ec8,_0x5b1248){_0x245ec8=_0x245ec8-0x0;var _0xe64046=_0xf05f[_0x245ec8];return _0xe64046;};'use strict';var multer=require(_0xff05('0x0'));var util=require(_0xff05('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff05('0x2')]();var fs_extra=require(_0xff05('0x3'));var auth=require(_0xff05('0x4'));var interaction=require(_0xff05('0x5'));var config=require(_0xff05('0x6'));var controller=require(_0xff05('0x7'));router[_0xff05('0x8')]('/',auth[_0xff05('0x9')](),controller[_0xff05('0xa')]);router['get'](_0xff05('0xb'),auth[_0xff05('0x9')](),controller[_0xff05('0xc')]);router[_0xff05('0x8')](_0xff05('0xd'),auth[_0xff05('0x9')](),controller[_0xff05('0xe')]);router[_0xff05('0x8')](_0xff05('0xf'),auth[_0xff05('0x9')](),controller[_0xff05('0x10')]);router['post']('/',auth[_0xff05('0x9')](),controller[_0xff05('0x11')]);router['post'](_0xff05('0x12'),auth['isAuthenticated'](),controller['getPreview']);router[_0xff05('0x13')](_0xff05('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xff05('0xf'),auth[_0xff05('0x9')](),controller[_0xff05('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 08b85eb..47478a2 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 _0xf426=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xf426,0x168));var _0x6f42=function(_0x4f067e,_0x406536){_0x4f067e=_0x4f067e-0x0;var _0x3930d1=_0xf426[_0x4f067e];return _0x3930d1;};'use strict';var moment=require(_0x6f42('0x0'));var Sequelize=require(_0x6f42('0x1'));module['exports']={'phone':{'type':Sequelize[_0x6f42('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6f42('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6f42('0x3')],'unique':_0x6f42('0x4')},'VoiceQueueId':{'type':Sequelize[_0x6f42('0x3')],'unique':_0x6f42('0x4')}}; \ No newline at end of file +var _0xe93a=['sequelize','INTEGER','contactListQueue','moment'];(function(_0x3f97fc,_0xa00b9){var _0x2f854c=function(_0x3eff23){while(--_0x3eff23){_0x3f97fc['push'](_0x3f97fc['shift']());}};_0x2f854c(++_0xa00b9);}(_0xe93a,0x1a7));var _0xae93=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xe93a[_0x376b45];return _0x2341b3;};'use strict';var moment=require(_0xae93('0x0'));var Sequelize=require(_0xae93('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xae93('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xae93('0x2')],'unique':_0xae93('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a5c45c2..f931d53 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 _0x0ecd=['describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','then','rows','show','find','catch','body','params'];(function(_0x1d473b,_0x112b8e){var _0x31e010=function(_0x3d185e){while(--_0x3d185e){_0x1d473b['push'](_0x1d473b['shift']());}};_0x31e010(++_0x112b8e);}(_0x0ecd,0xd3));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd0ec('0x0'));var rimraf=require(_0xd0ec('0x1'));var zipdir=require(_0xd0ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0ec('0x3'));var moment=require(_0xd0ec('0x4'));var BPromise=require(_0xd0ec('0x5'));var Mustache=require('mustache');var util=require(_0xd0ec('0x6'));var path=require(_0xd0ec('0x7'));var sox=require(_0xd0ec('0x8'));var csv=require('to-csv');var ejs=require(_0xd0ec('0x9'));var fs=require('fs');var fs_extra=require(_0xd0ec('0xa'));var _=require('lodash');var squel=require(_0xd0ec('0xb'));var crypto=require(_0xd0ec('0xc'));var jsforce=require(_0xd0ec('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0ec('0xe'));var Papa=require(_0xd0ec('0xf'));var Redis=require('ioredis');var authService=require(_0xd0ec('0x10'));var qs=require(_0xd0ec('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0ec('0x12'))('api');var utils=require(_0xd0ec('0x13'));var config=require(_0xd0ec('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0ec('0x15'))['db'];function respondWithStatusCode(_0x535258,_0x47316f){_0x47316f=_0x47316f||0xcc;return function(_0x409515){if(_0x409515){return _0x535258['sendStatus'](_0x47316f);}return _0x535258[_0xd0ec('0x16')](_0x47316f)['end']();};}function respondWithResult(_0x2c3841,_0x159a41){_0x159a41=_0x159a41||0xc8;return function(_0x420c15){if(_0x420c15){return _0x2c3841[_0xd0ec('0x16')](_0x159a41)[_0xd0ec('0x17')](_0x420c15);}};}function respondWithFilteredResult(_0x503980,_0x3b8cb1){return function(_0x14d366){if(_0x14d366){var _0x41ef05=typeof _0x3b8cb1[_0xd0ec('0x18')]===_0xd0ec('0x19')&&typeof _0x3b8cb1['limit']==='undefined';var _0x286206=_0x14d366[_0xd0ec('0x1a')];var _0x29fdfb=_0x41ef05?0x0:_0x3b8cb1[_0xd0ec('0x18')];var _0xaa2d06=_0x41ef05?_0x14d366['count']:_0x3b8cb1[_0xd0ec('0x18')]+_0x3b8cb1[_0xd0ec('0x1b')];var _0x127dd2;if(_0xaa2d06>=_0x286206){_0xaa2d06=_0x286206;_0x127dd2=0xc8;}else{_0x127dd2=0xce;}_0x503980[_0xd0ec('0x16')](_0x127dd2);return _0x503980[_0xd0ec('0x1c')]('Content-Range',_0x29fdfb+'-'+_0xaa2d06+'/'+_0x286206)['json'](_0x14d366);}return null;};}function patchUpdates(_0x39d180){return function(_0x5551ad){try{jsonpatch[_0xd0ec('0x1d')](_0x5551ad,_0x39d180,!![]);}catch(_0x4bd837){return BPromise[_0xd0ec('0x1e')](_0x4bd837);}return _0x5551ad[_0xd0ec('0x1f')]();};}function saveUpdates(_0x38de66,_0x594d85){return function(_0x372ece){if(_0x372ece){return _0x372ece[_0xd0ec('0x20')](_0x38de66)['then'](function(_0x54c29e){return _0x54c29e;});}return null;};}function removeEntity(_0x514342,_0x181d0e){return function(_0x1ed04d){if(_0x1ed04d){return _0x1ed04d[_0xd0ec('0x21')]()['then'](function(){_0x514342[_0xd0ec('0x16')](0xcc)[_0xd0ec('0x22')]();});}};}function handleEntityNotFound(_0x3abfcd,_0x3a502c){return function(_0x1a584a){if(!_0x1a584a){_0x3abfcd[_0xd0ec('0x23')](0x194);}return _0x1a584a;};}function handleError(_0x7d147d,_0x2b40ca){_0x2b40ca=_0x2b40ca||0x1f4;return function(_0x10d1e3){logger[_0xd0ec('0x24')](_0x10d1e3[_0xd0ec('0x25')]);if(_0x10d1e3[_0xd0ec('0x26')]){delete _0x10d1e3[_0xd0ec('0x26')];}_0x7d147d['status'](_0x2b40ca)[_0xd0ec('0x27')](_0x10d1e3);};}exports[_0xd0ec('0x28')]=function(_0x13e295,_0x40ee6d){var _0x179f71={},_0x50ff45={},_0x2d6f92={'count':0x0,'rows':[]};var _0x15b6d1=_[_0xd0ec('0x29')](db[_0xd0ec('0x2a')][_0xd0ec('0x2b')],function(_0x24245b){return{'name':_0x24245b['fieldName'],'type':_0x24245b[_0xd0ec('0x2c')]['key']};});_0x50ff45[_0xd0ec('0x2d')]=_[_0xd0ec('0x29')](_0x15b6d1,_0xd0ec('0x26'));_0x50ff45[_0xd0ec('0x2e')]=_[_0xd0ec('0x2f')](_0x13e295[_0xd0ec('0x2e')]);_0x50ff45[_0xd0ec('0x30')]=_[_0xd0ec('0x31')](_0x50ff45[_0xd0ec('0x2d')],_0x50ff45[_0xd0ec('0x2e')]);_0x179f71[_0xd0ec('0x32')]=_[_0xd0ec('0x31')](_0x50ff45['model'],qs[_0xd0ec('0x33')](_0x13e295[_0xd0ec('0x2e')][_0xd0ec('0x33')]));_0x179f71[_0xd0ec('0x32')]=_0x179f71[_0xd0ec('0x32')][_0xd0ec('0x34')]?_0x179f71[_0xd0ec('0x32')]:_0x50ff45[_0xd0ec('0x2d')];if(!_0x13e295['query']['hasOwnProperty'](_0xd0ec('0x35'))){_0x179f71[_0xd0ec('0x1b')]=qs[_0xd0ec('0x1b')](_0x13e295[_0xd0ec('0x2e')][_0xd0ec('0x1b')]);_0x179f71['offset']=qs[_0xd0ec('0x18')](_0x13e295[_0xd0ec('0x2e')][_0xd0ec('0x18')]);}_0x179f71[_0xd0ec('0x36')]=qs[_0xd0ec('0x37')](_0x13e295[_0xd0ec('0x2e')]['sort']);_0x179f71[_0xd0ec('0x38')]=qs[_0xd0ec('0x30')](_['pick'](_0x13e295[_0xd0ec('0x2e')],_0x50ff45[_0xd0ec('0x30')]),_0x15b6d1);if(_0x13e295[_0xd0ec('0x2e')][_0xd0ec('0x39')]){_0x179f71[_0xd0ec('0x38')]=_[_0xd0ec('0x3a')](_0x179f71['where'],{'$or':_[_0xd0ec('0x29')](_0x15b6d1,function(_0x37f447){if(_0x37f447[_0xd0ec('0x2c')]!==_0xd0ec('0x3b')){var _0xedeea5={};_0xedeea5[_0x37f447['name']]={'$like':'%'+_0x13e295['query']['filter']+'%'};return _0xedeea5;}})});}_0x179f71=_[_0xd0ec('0x3a')]({},_0x179f71,_0x13e295[_0xd0ec('0x3c')]);var _0xb13726={'where':_0x179f71[_0xd0ec('0x38')]};return db[_0xd0ec('0x2a')]['count'](_0xb13726)['then'](function(_0x4cba1c){_0x2d6f92['count']=_0x4cba1c;if(_0x13e295[_0xd0ec('0x2e')][_0xd0ec('0x3d')]){_0x179f71['include']=[{'all':!![]}];}return db[_0xd0ec('0x2a')]['findAll'](_0x179f71);})[_0xd0ec('0x3e')](function(_0x24a182){_0x2d6f92[_0xd0ec('0x3f')]=_0x24a182;return _0x2d6f92;})[_0xd0ec('0x3e')](respondWithFilteredResult(_0x40ee6d,_0x179f71))['catch'](handleError(_0x40ee6d,null));};exports[_0xd0ec('0x40')]=function(_0x40fdc0,_0x441649){var _0x5b34c8={'raw':!![],'where':{'id':_0x40fdc0['params']['id']}},_0x39ee18={};_0x39ee18['model']=_[_0xd0ec('0x2f')](db[_0xd0ec('0x2a')][_0xd0ec('0x2b')]);_0x39ee18[_0xd0ec('0x2e')]=_[_0xd0ec('0x2f')](_0x40fdc0[_0xd0ec('0x2e')]);_0x39ee18[_0xd0ec('0x30')]=_['intersection'](_0x39ee18[_0xd0ec('0x2d')],_0x39ee18[_0xd0ec('0x2e')]);_0x5b34c8['attributes']=_[_0xd0ec('0x31')](_0x39ee18['model'],qs[_0xd0ec('0x33')](_0x40fdc0[_0xd0ec('0x2e')]['fields']));_0x5b34c8[_0xd0ec('0x32')]=_0x5b34c8['attributes'][_0xd0ec('0x34')]?_0x5b34c8[_0xd0ec('0x32')]:_0x39ee18[_0xd0ec('0x2d')];if(_0x40fdc0[_0xd0ec('0x2e')]['includeAll']){_0x5b34c8['include']=[{'all':!![]}];}_0x5b34c8=_[_0xd0ec('0x3a')]({},_0x5b34c8,_0x40fdc0[_0xd0ec('0x3c')]);return db['CmHopperBlack'][_0xd0ec('0x41')](_0x5b34c8)['then'](handleEntityNotFound(_0x441649,null))['then'](respondWithResult(_0x441649,null))[_0xd0ec('0x42')](handleError(_0x441649,null));};exports[_0xd0ec('0x20')]=function(_0x1f55be,_0x5ca4a8){if(_0x1f55be[_0xd0ec('0x43')]['id']){delete _0x1f55be[_0xd0ec('0x43')]['id'];}return db['CmHopperBlack'][_0xd0ec('0x41')]({'where':{'id':_0x1f55be[_0xd0ec('0x44')]['id']}})[_0xd0ec('0x3e')](handleEntityNotFound(_0x5ca4a8,null))['then'](saveUpdates(_0x1f55be[_0xd0ec('0x43')],null))['then'](respondWithResult(_0x5ca4a8,null))['catch'](handleError(_0x5ca4a8,null));};exports['destroy']=function(_0x1808ca,_0x488cfe){return db[_0xd0ec('0x2a')][_0xd0ec('0x41')]({'where':{'id':_0x1808ca[_0xd0ec('0x44')]['id']}})[_0xd0ec('0x3e')](handleEntityNotFound(_0x488cfe,null))[_0xd0ec('0x3e')](removeEntity(_0x488cfe,null))[_0xd0ec('0x42')](handleError(_0x488cfe,null));};exports[_0xd0ec('0x45')]=function(_0x49e2cc,_0x4d8cc6){return db[_0xd0ec('0x2a')][_0xd0ec('0x45')]()[_0xd0ec('0x3e')](respondWithResult(_0x4d8cc6,null))[_0xd0ec('0x42')](handleError(_0x4d8cc6,null));}; \ No newline at end of file +var _0xc70a=['../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','rows','show','find','catch','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x461986,_0x45caf0){var _0x3554e5=function(_0x3b8a90){while(--_0x3b8a90){_0x461986['push'](_0x461986['shift']());}};_0x3554e5(++_0x45caf0);}(_0xc70a,0x74));var _0xac70=function(_0xa071ad,_0x268ebd){_0xa071ad=_0xa071ad-0x0;var _0x14354c=_0xc70a[_0xa071ad];return _0x14354c;};'use strict';var emlformat=require(_0xac70('0x0'));var rimraf=require(_0xac70('0x1'));var zipdir=require(_0xac70('0x2'));var jsonpatch=require(_0xac70('0x3'));var rp=require(_0xac70('0x4'));var moment=require(_0xac70('0x5'));var BPromise=require(_0xac70('0x6'));var Mustache=require(_0xac70('0x7'));var util=require(_0xac70('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xac70('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac70('0xa'));var squel=require('squel');var crypto=require(_0xac70('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac70('0x9'));var querystring=require(_0xac70('0xc'));var Papa=require('papaparse');var Redis=require(_0xac70('0xd'));var authService=require(_0xac70('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xac70('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac70('0x10'))('api');var utils=require(_0xac70('0x11'));var config=require(_0xac70('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xac70('0x13'))['db'];function respondWithStatusCode(_0x613e4b,_0x90b91a){_0x90b91a=_0x90b91a||0xcc;return function(_0x27f1b8){if(_0x27f1b8){return _0x613e4b['sendStatus'](_0x90b91a);}return _0x613e4b[_0xac70('0x14')](_0x90b91a)[_0xac70('0x15')]();};}function respondWithResult(_0x148015,_0x2a014c){_0x2a014c=_0x2a014c||0xc8;return function(_0x232333){if(_0x232333){return _0x148015['status'](_0x2a014c)[_0xac70('0x16')](_0x232333);}};}function respondWithFilteredResult(_0xb8610d,_0x121e6e){return function(_0x4681a4){if(_0x4681a4){var _0x469b52=typeof _0x121e6e[_0xac70('0x17')]===_0xac70('0x18')&&typeof _0x121e6e[_0xac70('0x19')]==='undefined';var _0x5a0a13=_0x4681a4[_0xac70('0x1a')];var _0x547fd9=_0x469b52?0x0:_0x121e6e[_0xac70('0x17')];var _0x156c41=_0x469b52?_0x4681a4[_0xac70('0x1a')]:_0x121e6e['offset']+_0x121e6e[_0xac70('0x19')];var _0x579893;if(_0x156c41>=_0x5a0a13){_0x156c41=_0x5a0a13;_0x579893=0xc8;}else{_0x579893=0xce;}_0xb8610d[_0xac70('0x14')](_0x579893);return _0xb8610d['set'](_0xac70('0x1b'),_0x547fd9+'-'+_0x156c41+'/'+_0x5a0a13)[_0xac70('0x16')](_0x4681a4);}return null;};}function patchUpdates(_0x12d0f5){return function(_0x8e12e){try{jsonpatch[_0xac70('0x1c')](_0x8e12e,_0x12d0f5,!![]);}catch(_0x52717a){return BPromise['reject'](_0x52717a);}return _0x8e12e[_0xac70('0x1d')]();};}function saveUpdates(_0x333ba4,_0x151070){return function(_0x170e0c){if(_0x170e0c){return _0x170e0c['update'](_0x333ba4)[_0xac70('0x1e')](function(_0x58dff4){return _0x58dff4;});}return null;};}function removeEntity(_0x45573e,_0x1b68de){return function(_0x2b8d3d){if(_0x2b8d3d){return _0x2b8d3d[_0xac70('0x1f')]()[_0xac70('0x1e')](function(){_0x45573e[_0xac70('0x14')](0xcc)[_0xac70('0x15')]();});}};}function handleEntityNotFound(_0x31ebf6,_0x26bfff){return function(_0x155d0f){if(!_0x155d0f){_0x31ebf6[_0xac70('0x20')](0x194);}return _0x155d0f;};}function handleError(_0x161684,_0x5382bb){_0x5382bb=_0x5382bb||0x1f4;return function(_0x142359){logger[_0xac70('0x21')](_0x142359[_0xac70('0x22')]);if(_0x142359['name']){delete _0x142359[_0xac70('0x23')];}_0x161684[_0xac70('0x14')](_0x5382bb)[_0xac70('0x24')](_0x142359);};}exports[_0xac70('0x25')]=function(_0x57ff4f,_0x21b1a2){var _0x485180={},_0x248a78={},_0x2815e7={'count':0x0,'rows':[]};var _0x1f3c2f=_['map'](db[_0xac70('0x26')][_0xac70('0x27')],function(_0x50560b){return{'name':_0x50560b[_0xac70('0x28')],'type':_0x50560b[_0xac70('0x29')]['key']};});_0x248a78[_0xac70('0x2a')]=_[_0xac70('0x2b')](_0x1f3c2f,_0xac70('0x23'));_0x248a78[_0xac70('0x2c')]=_[_0xac70('0x2d')](_0x57ff4f[_0xac70('0x2c')]);_0x248a78[_0xac70('0x2e')]=_['intersection'](_0x248a78[_0xac70('0x2a')],_0x248a78[_0xac70('0x2c')]);_0x485180[_0xac70('0x2f')]=_[_0xac70('0x30')](_0x248a78[_0xac70('0x2a')],qs[_0xac70('0x31')](_0x57ff4f[_0xac70('0x2c')][_0xac70('0x31')]));_0x485180[_0xac70('0x2f')]=_0x485180[_0xac70('0x2f')][_0xac70('0x32')]?_0x485180['attributes']:_0x248a78[_0xac70('0x2a')];if(!_0x57ff4f[_0xac70('0x2c')][_0xac70('0x33')](_0xac70('0x34'))){_0x485180[_0xac70('0x19')]=qs['limit'](_0x57ff4f[_0xac70('0x2c')][_0xac70('0x19')]);_0x485180[_0xac70('0x17')]=qs[_0xac70('0x17')](_0x57ff4f[_0xac70('0x2c')][_0xac70('0x17')]);}_0x485180['order']=qs['sort'](_0x57ff4f['query'][_0xac70('0x35')]);_0x485180['where']=qs['filters'](_['pick'](_0x57ff4f['query'],_0x248a78['filters']),_0x1f3c2f);if(_0x57ff4f[_0xac70('0x2c')][_0xac70('0x36')]){_0x485180[_0xac70('0x37')]=_[_0xac70('0x38')](_0x485180[_0xac70('0x37')],{'$or':_[_0xac70('0x2b')](_0x1f3c2f,function(_0x2d5601){if(_0x2d5601[_0xac70('0x29')]!==_0xac70('0x39')){var _0x170323={};_0x170323[_0x2d5601['name']]={'$like':'%'+_0x57ff4f[_0xac70('0x2c')][_0xac70('0x36')]+'%'};return _0x170323;}})});}_0x485180=_['merge']({},_0x485180,_0x57ff4f[_0xac70('0x3a')]);var _0x20f106={'where':_0x485180[_0xac70('0x37')]};return db[_0xac70('0x26')][_0xac70('0x1a')](_0x20f106)[_0xac70('0x1e')](function(_0x1caee5){_0x2815e7[_0xac70('0x1a')]=_0x1caee5;if(_0x57ff4f[_0xac70('0x2c')]['includeAll']){_0x485180['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x485180);})['then'](function(_0x48c46d){_0x2815e7[_0xac70('0x3b')]=_0x48c46d;return _0x2815e7;})['then'](respondWithFilteredResult(_0x21b1a2,_0x485180))['catch'](handleError(_0x21b1a2,null));};exports[_0xac70('0x3c')]=function(_0x4c0445,_0x2defb7){var _0x5ea2e1={'raw':!![],'where':{'id':_0x4c0445['params']['id']}},_0xec67f3={};_0xec67f3[_0xac70('0x2a')]=_[_0xac70('0x2d')](db['CmHopperBlack']['rawAttributes']);_0xec67f3[_0xac70('0x2c')]=_['keys'](_0x4c0445[_0xac70('0x2c')]);_0xec67f3[_0xac70('0x2e')]=_[_0xac70('0x30')](_0xec67f3[_0xac70('0x2a')],_0xec67f3[_0xac70('0x2c')]);_0x5ea2e1[_0xac70('0x2f')]=_[_0xac70('0x30')](_0xec67f3[_0xac70('0x2a')],qs[_0xac70('0x31')](_0x4c0445[_0xac70('0x2c')][_0xac70('0x31')]));_0x5ea2e1[_0xac70('0x2f')]=_0x5ea2e1[_0xac70('0x2f')]['length']?_0x5ea2e1[_0xac70('0x2f')]:_0xec67f3[_0xac70('0x2a')];if(_0x4c0445[_0xac70('0x2c')]['includeAll']){_0x5ea2e1['include']=[{'all':!![]}];}_0x5ea2e1=_[_0xac70('0x38')]({},_0x5ea2e1,_0x4c0445['options']);return db['CmHopperBlack'][_0xac70('0x3d')](_0x5ea2e1)[_0xac70('0x1e')](handleEntityNotFound(_0x2defb7,null))[_0xac70('0x1e')](respondWithResult(_0x2defb7,null))[_0xac70('0x3e')](handleError(_0x2defb7,null));};exports[_0xac70('0x3f')]=function(_0x5f34d6,_0x8bddea){if(_0x5f34d6[_0xac70('0x40')]['id']){delete _0x5f34d6[_0xac70('0x40')]['id'];}return db[_0xac70('0x26')][_0xac70('0x3d')]({'where':{'id':_0x5f34d6[_0xac70('0x41')]['id']}})[_0xac70('0x1e')](handleEntityNotFound(_0x8bddea,null))[_0xac70('0x1e')](saveUpdates(_0x5f34d6[_0xac70('0x40')],null))[_0xac70('0x1e')](respondWithResult(_0x8bddea,null))[_0xac70('0x3e')](handleError(_0x8bddea,null));};exports['destroy']=function(_0xf6dac6,_0x50eb2c){return db[_0xac70('0x26')]['find']({'where':{'id':_0xf6dac6['params']['id']}})[_0xac70('0x1e')](handleEntityNotFound(_0x50eb2c,null))[_0xac70('0x1e')](removeEntity(_0x50eb2c,null))[_0xac70('0x3e')](handleError(_0x50eb2c,null));};exports['describe']=function(_0x429ce3,_0x18a18b){return db['CmHopperBlack'][_0xac70('0x42')]()[_0xac70('0x1e')](respondWithResult(_0x18a18b,null))['catch'](handleError(_0x18a18b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ba9db66..6fd78ad 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 _0x8705=['define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x206b6a,_0x38f625){var _0x47f499=function(_0x2b6618){while(--_0x2b6618){_0x206b6a['push'](_0x206b6a['shift']());}};_0x47f499(++_0x38f625);}(_0x8705,0xc3));var _0x5870=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8705[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5870('0x0'));var logger=require(_0x5870('0x1'))(_0x5870('0x2'));var moment=require(_0x5870('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5870('0x4'));var rimraf=require(_0x5870('0x5'));var config=require(_0x5870('0x6'));var attributes=require(_0x5870('0x7'));module[_0x5870('0x8')]=function(_0x3a3ac9,_0x44be42){return _0x3a3ac9[_0x5870('0x9')](_0x5870('0xa'),attributes,{'tableName':_0x5870('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0db6=['./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x0db6,0xca));var _0x60db=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0x0db6[_0x446e61];return _0x4160a8;};'use strict';var _=require(_0x60db('0x0'));var util=require('util');var logger=require(_0x60db('0x1'))(_0x60db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x60db('0x3'));var fs=require('fs');var path=require(_0x60db('0x4'));var rimraf=require(_0x60db('0x5'));var config=require(_0x60db('0x6'));var attributes=require(_0x60db('0x7'));module['exports']=function(_0x368117,_0x5a679d){return _0x368117[_0x60db('0x8')](_0x60db('0x9'),attributes,{'tableName':_0x60db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 1647504..0da1b23 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 _0x8bfd=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','attributes','include','map','model','UpdateCmHopperBlack','update','body','where','limit','DestroyCmHopperBlack','destroy','lodash'];(function(_0x707c13,_0x43d1cf){var _0x12986b=function(_0x2dec51){while(--_0x2dec51){_0x707c13['push'](_0x707c13['shift']());}};_0x12986b(++_0x43d1cf);}(_0x8bfd,0x6e));var _0xd8bf=function(_0x31826c,_0x1995c5){_0x31826c=_0x31826c-0x0;var _0x20bbd7=_0x8bfd[_0x31826c];return _0x20bbd7;};'use strict';var _=require(_0xd8bf('0x0'));var util=require(_0xd8bf('0x1'));var moment=require('moment');var BPromise=require(_0xd8bf('0x2'));var rs=require(_0xd8bf('0x3'));var fs=require('fs');var Redis=require(_0xd8bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8bf('0x5'));var logger=require(_0xd8bf('0x6'))(_0xd8bf('0x7'));var config=require(_0xd8bf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8bf('0x9')][_0xd8bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507667,_0x24adb5,_0x32291a){return new BPromise(function(_0x405137,_0x4c02cc){return client[_0xd8bf('0xb')](_0x507667,_0x32291a)[_0xd8bf('0xc')](function(_0xf087b0){logger['info'](_0xd8bf('0xd'),_0x24adb5,_0xd8bf('0xe'));logger[_0xd8bf('0xf')](_0xd8bf('0x10'),_0x24adb5,_0xd8bf('0xe'),JSON['stringify'](_0xf087b0));if(_0xf087b0['error']){if(_0xf087b0[_0xd8bf('0x11')][_0xd8bf('0x12')]===0x1f4){logger[_0xd8bf('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x24adb5,_0xf087b0[_0xd8bf('0x11')][_0xd8bf('0x13')]);return _0x4c02cc(_0xf087b0[_0xd8bf('0x11')][_0xd8bf('0x13')]);}logger[_0xd8bf('0x11')](_0xd8bf('0xd'),_0x24adb5,_0xf087b0[_0xd8bf('0x11')]['message']);return _0x405137(_0xf087b0[_0xd8bf('0x11')][_0xd8bf('0x13')]);}else{logger[_0xd8bf('0x14')](_0xd8bf('0xd'),_0x24adb5,_0xd8bf('0xe'));_0x405137(_0xf087b0[_0xd8bf('0x15')][_0xd8bf('0x13')]);}})[_0xd8bf('0x16')](function(_0x5877cb){logger[_0xd8bf('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x24adb5,_0x5877cb);_0x4c02cc(_0x5877cb);});});}exports[_0xd8bf('0x17')]=function(_0x158ee2){var _0x46152c=this;return new Promise(function(_0x2c5c84,_0x586a83){return db[_0xd8bf('0x18')]['findAll']({'raw':_0x158ee2[_0xd8bf('0x19')]?_0x158ee2[_0xd8bf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x158ee2['options']?_0x158ee2[_0xd8bf('0x19')]['where']||null:null,'attributes':_0x158ee2['options']?_0x158ee2[_0xd8bf('0x19')][_0xd8bf('0x1a')]||null:null,'limit':_0x158ee2['options']?_0x158ee2[_0xd8bf('0x19')]['limit']||null:null,'include':_0x158ee2[_0xd8bf('0x19')]?_0x158ee2[_0xd8bf('0x19')][_0xd8bf('0x1b')]?_[_0xd8bf('0x1c')](_0x158ee2[_0xd8bf('0x19')][_0xd8bf('0x1b')],function(_0x504bee){return{'model':db[_0x504bee[_0xd8bf('0x1d')]],'as':_0x504bee['as'],'attributes':_0x504bee[_0xd8bf('0x1a')],'include':_0x504bee['include']?_[_0xd8bf('0x1c')](_0x504bee[_0xd8bf('0x1b')],function(_0xc92fb8){return{'model':db[_0xc92fb8[_0xd8bf('0x1d')]],'as':_0xc92fb8['as'],'attributes':_0xc92fb8['attributes'],'include':_0xc92fb8[_0xd8bf('0x1b')]?_[_0xd8bf('0x1c')](_0xc92fb8[_0xd8bf('0x1b')],function(_0x53fdbd){return{'model':db[_0x53fdbd['model']],'as':_0x53fdbd['as'],'attributes':_0x53fdbd[_0xd8bf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd8bf('0xc')](function(_0x1190c2){logger[_0xd8bf('0x14')](_0xd8bf('0x17'),_0x158ee2);logger[_0xd8bf('0xf')]('GetCmHopperBlack',_0x158ee2,JSON['stringify'](_0x1190c2));_0x2c5c84(_0x1190c2);})[_0xd8bf('0x16')](function(_0x59f72e){logger['error']('GetCmHopperBlack',_0x59f72e['message'],_0x158ee2);_0x586a83(_0x46152c[_0xd8bf('0x11')](0x1f4,_0x59f72e[_0xd8bf('0x13')]));});});};exports[_0xd8bf('0x1e')]=function(_0x20d656){var _0x215529=this;return new Promise(function(_0x27ab39,_0x367653){return db[_0xd8bf('0x18')][_0xd8bf('0x1f')](_0x20d656[_0xd8bf('0x20')],{'raw':_0x20d656['options']?_0x20d656[_0xd8bf('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d656[_0xd8bf('0x19')]?_0x20d656[_0xd8bf('0x19')][_0xd8bf('0x21')]||null:null,'attributes':_0x20d656[_0xd8bf('0x19')]?_0x20d656[_0xd8bf('0x19')][_0xd8bf('0x1a')]||null:null,'limit':_0x20d656[_0xd8bf('0x19')]?_0x20d656[_0xd8bf('0x19')][_0xd8bf('0x22')]||null:null})['then'](function(_0x22e3ef){logger[_0xd8bf('0x14')](_0xd8bf('0x1e'),_0x20d656);logger[_0xd8bf('0xf')]('UpdateCmHopperBlack',_0x20d656,JSON['stringify'](_0x22e3ef));_0x27ab39(_0x22e3ef);})[_0xd8bf('0x16')](function(_0x2f6f24){logger['error'](_0xd8bf('0x1e'),_0x2f6f24[_0xd8bf('0x13')],_0x20d656);_0x367653(_0x215529[_0xd8bf('0x11')](0x1f4,_0x2f6f24[_0xd8bf('0x13')]));});});};exports[_0xd8bf('0x23')]=function(_0x12235d){var _0x2295d5=this;return new Promise(function(_0x3fd50e,_0xf5c483){return db['CmHopperBlack'][_0xd8bf('0x24')]({'where':_0x12235d[_0xd8bf('0x19')]?_0x12235d[_0xd8bf('0x19')]['where']||null:null})[_0xd8bf('0xc')](function(_0x35272a){logger[_0xd8bf('0x14')](_0xd8bf('0x23'),_0x12235d);logger['debug'](_0xd8bf('0x23'),_0x12235d,JSON['stringify'](_0x35272a));_0x3fd50e(_0x35272a);})[_0xd8bf('0x16')](function(_0x4c5112){logger[_0xd8bf('0x11')]('DestroyCmHopperBlack',_0x4c5112[_0xd8bf('0x13')],_0x12235d);_0xf5c483(_0x2295d5['error'](0x1f4,_0x4c5112[_0xd8bf('0x13')]));});});}; \ No newline at end of file +var _0xc40c=['jayson/promise','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','limit','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','destroy','where','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc40c,0xf5));var _0xcc40=function(_0x182fd7,_0x504649){_0x182fd7=_0x182fd7-0x0;var _0x415ec2=_0xc40c[_0x182fd7];return _0x415ec2;};'use strict';var _=require(_0xcc40('0x0'));var util=require(_0xcc40('0x1'));var moment=require(_0xcc40('0x2'));var BPromise=require(_0xcc40('0x3'));var rs=require(_0xcc40('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc40('0x5'));var config=require(_0xcc40('0x6'));var jayson=require(_0xcc40('0x7'));var client=jayson['client'][_0xcc40('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fe1b6,_0x3e37d4,_0xd354f2){return new BPromise(function(_0x3d4621,_0x43c7ce){return client['request'](_0x1fe1b6,_0xd354f2)[_0xcc40('0x9')](function(_0x3334cf){logger[_0xcc40('0xa')](_0xcc40('0xb'),_0x3e37d4,_0xcc40('0xc'));logger[_0xcc40('0xd')](_0xcc40('0xe'),_0x3e37d4,_0xcc40('0xc'),JSON[_0xcc40('0xf')](_0x3334cf));if(_0x3334cf['error']){if(_0x3334cf[_0xcc40('0x10')][_0xcc40('0x11')]===0x1f4){logger[_0xcc40('0x10')](_0xcc40('0xb'),_0x3e37d4,_0x3334cf[_0xcc40('0x10')][_0xcc40('0x12')]);return _0x43c7ce(_0x3334cf[_0xcc40('0x10')][_0xcc40('0x12')]);}logger[_0xcc40('0x10')](_0xcc40('0xb'),_0x3e37d4,_0x3334cf[_0xcc40('0x10')][_0xcc40('0x12')]);return _0x3d4621(_0x3334cf[_0xcc40('0x10')]['message']);}else{logger[_0xcc40('0xa')](_0xcc40('0xb'),_0x3e37d4,_0xcc40('0xc'));_0x3d4621(_0x3334cf[_0xcc40('0x13')]['message']);}})[_0xcc40('0x14')](function(_0x3c54bc){logger[_0xcc40('0x10')](_0xcc40('0xb'),_0x3e37d4,_0x3c54bc);_0x43c7ce(_0x3c54bc);});});}exports['GetCmHopperBlack']=function(_0x50843c){var _0x4eb5b4=this;return new Promise(function(_0x21bd6d,_0x42cd4c){return db[_0xcc40('0x15')][_0xcc40('0x16')]({'raw':_0x50843c[_0xcc40('0x17')]?_0x50843c['options'][_0xcc40('0x18')]===undefined?!![]:![]:!![],'where':_0x50843c['options']?_0x50843c[_0xcc40('0x17')]['where']||null:null,'attributes':_0x50843c[_0xcc40('0x17')]?_0x50843c[_0xcc40('0x17')]['attributes']||null:null,'limit':_0x50843c['options']?_0x50843c[_0xcc40('0x17')][_0xcc40('0x19')]||null:null,'include':_0x50843c[_0xcc40('0x17')]?_0x50843c[_0xcc40('0x17')]['include']?_['map'](_0x50843c[_0xcc40('0x17')]['include'],function(_0x38b33b){return{'model':db[_0x38b33b['model']],'as':_0x38b33b['as'],'attributes':_0x38b33b[_0xcc40('0x1a')],'include':_0x38b33b[_0xcc40('0x1b')]?_['map'](_0x38b33b['include'],function(_0x1f90c3){return{'model':db[_0x1f90c3['model']],'as':_0x1f90c3['as'],'attributes':_0x1f90c3[_0xcc40('0x1a')],'include':_0x1f90c3[_0xcc40('0x1b')]?_[_0xcc40('0x1c')](_0x1f90c3[_0xcc40('0x1b')],function(_0x4b2c75){return{'model':db[_0x4b2c75[_0xcc40('0x1d')]],'as':_0x4b2c75['as'],'attributes':_0x4b2c75['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x64f6a6){logger['info'](_0xcc40('0x1e'),_0x50843c);logger[_0xcc40('0xd')](_0xcc40('0x1e'),_0x50843c,JSON[_0xcc40('0xf')](_0x64f6a6));_0x21bd6d(_0x64f6a6);})[_0xcc40('0x14')](function(_0x5a55ad){logger['error'](_0xcc40('0x1e'),_0x5a55ad[_0xcc40('0x12')],_0x50843c);_0x42cd4c(_0x4eb5b4['error'](0x1f4,_0x5a55ad[_0xcc40('0x12')]));});});};exports[_0xcc40('0x1f')]=function(_0x2d7c1e){var _0x25a0b7=this;return new Promise(function(_0x198c1a,_0x4c4a98){return db[_0xcc40('0x15')][_0xcc40('0x20')](_0x2d7c1e['body'],{'raw':_0x2d7c1e['options']?_0x2d7c1e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7c1e[_0xcc40('0x17')]?_0x2d7c1e['options']['where']||null:null,'attributes':_0x2d7c1e[_0xcc40('0x17')]?_0x2d7c1e[_0xcc40('0x17')]['attributes']||null:null,'limit':_0x2d7c1e[_0xcc40('0x17')]?_0x2d7c1e['options'][_0xcc40('0x19')]||null:null})[_0xcc40('0x9')](function(_0x7f5054){logger['info'](_0xcc40('0x1f'),_0x2d7c1e);logger[_0xcc40('0xd')](_0xcc40('0x1f'),_0x2d7c1e,JSON[_0xcc40('0xf')](_0x7f5054));_0x198c1a(_0x7f5054);})[_0xcc40('0x14')](function(_0x258aac){logger['error']('UpdateCmHopperBlack',_0x258aac[_0xcc40('0x12')],_0x2d7c1e);_0x4c4a98(_0x25a0b7['error'](0x1f4,_0x258aac[_0xcc40('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x2756f2){var _0x5a5d11=this;return new Promise(function(_0x3f9077,_0x4f8a34){return db['CmHopperBlack'][_0xcc40('0x21')]({'where':_0x2756f2['options']?_0x2756f2[_0xcc40('0x17')][_0xcc40('0x22')]||null:null})[_0xcc40('0x9')](function(_0x201ea0){logger[_0xcc40('0xa')](_0xcc40('0x23'),_0x2756f2);logger['debug']('DestroyCmHopperBlack',_0x2756f2,JSON['stringify'](_0x201ea0));_0x3f9077(_0x201ea0);})[_0xcc40('0x14')](function(_0x107e2b){logger[_0xcc40('0x10')](_0xcc40('0x23'),_0x107e2b[_0xcc40('0x12')],_0x2756f2);_0x4f8a34(_0x5a5d11['error'](0x1f4,_0x107e2b[_0xcc40('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 437dbcd..63682fd 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 _0x0424=['isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperBlack.controller','get'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0x0424,0x159));var _0x4042=function(_0x3aac69,_0x81d09f){_0x3aac69=_0x3aac69-0x0;var _0x38d35b=_0x0424[_0x3aac69];return _0x38d35b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['describe']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['put'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file +var _0xacf4=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','put','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xacf4,0xe7));var _0x4acf=function(_0x58f370,_0x2036cf){_0x58f370=_0x58f370-0x0;var _0x47ac1b=_0xacf4[_0x58f370];return _0x47ac1b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0xd')](_0x4acf('0xe'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0xf')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 55e9b83..84a2cc7 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 _0xb528=['followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0xdffdd1,_0x2b4a16){var _0x1f12ec=function(_0x20e311){while(--_0x20e311){_0xdffdd1['push'](_0xdffdd1['shift']());}};_0x1f12ec(++_0x2b4a16);}(_0xb528,0x1f2));var _0x8b52=function(_0x50fbc5,_0x56c73b){_0x50fbc5=_0x50fbc5-0x0;var _0x57c8a3=_0xb528[_0x50fbc5];return _0x57c8a3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8b52('0x0'));module['exports']={'state':{'type':Sequelize[_0x8b52('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8b52('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8b52('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8b52('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8b52('0x2')]},'starttime':{'type':Sequelize[_0x8b52('0x3')]},'responsetime':{'type':Sequelize[_0x8b52('0x3')]},'answertime':{'type':Sequelize[_0x8b52('0x3')]},'droptime':{'type':Sequelize[_0x8b52('0x3')]},'endtime':{'type':Sequelize[_0x8b52('0x3')]},'ringtime':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8b52('0x2')]},'campaign':{'type':Sequelize[_0x8b52('0x2')]},'campaigntype':{'type':Sequelize[_0x8b52('0x2')]},'membername':{'type':Sequelize[_0x8b52('0x2')]},'reason':{'type':Sequelize[_0x8b52('0x2')]},'disposition':{'type':Sequelize[_0x8b52('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8b52('0x2')]},'dispositionat':{'type':Sequelize[_0x8b52('0x3')],'set':function(_0x31735a){var _0x155f9e=this[_0x8b52('0x4')](_0x8b52('0x5'));if(_0x155f9e&&_0x31735a){this['setDataValue'](_0x8b52('0x6'),moment(_0x31735a)[_0x8b52('0x7')](moment(_0x155f9e),_0x8b52('0x8')));}return this[_0x8b52('0x9')](_0x8b52('0xa'),_0x31735a);}},'amd':{'type':Sequelize[_0x8b52('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8b52('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8b52('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8b52('0x3')]},'callback':{'type':Sequelize[_0x8b52('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8b52('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8b52('0x3')]},'deleted':{'type':Sequelize[_0x8b52('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8b52('0x3')]},'recallme':{'type':Sequelize[_0x8b52('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8b52('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8b52('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x497b=['diff','seconds','dispositionat','BOOLEAN','sequelize','INTEGER','DATE','STRING','getDataValue','setDataValue','followuptime'];(function(_0x142156,_0x5169f8){var _0x5b1ea3=function(_0x26080b){while(--_0x26080b){_0x142156['push'](_0x142156['shift']());}};_0x5b1ea3(++_0x5169f8);}(_0x497b,0x138));var _0xb497=function(_0x34a169,_0x4f6d81){_0x34a169=_0x34a169-0x0;var _0x391af4=_0x497b[_0x34a169];return _0x391af4;};'use strict';var Sequelize=require(_0xb497('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xb497('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb497('0x2')]},'countbusyretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb497('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb497('0x3')]},'calleridnum':{'type':Sequelize[_0xb497('0x3')]},'calleridname':{'type':Sequelize[_0xb497('0x3')]},'starttime':{'type':Sequelize[_0xb497('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb497('0x2')]},'droptime':{'type':Sequelize[_0xb497('0x2')]},'endtime':{'type':Sequelize[_0xb497('0x2')]},'ringtime':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb497('0x3')]},'campaign':{'type':Sequelize[_0xb497('0x3')]},'campaigntype':{'type':Sequelize[_0xb497('0x3')]},'membername':{'type':Sequelize[_0xb497('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb497('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb497('0x3')]},'dispositionat':{'type':Sequelize[_0xb497('0x2')],'set':function(_0x57bcdf){var _0x14f07b=this[_0xb497('0x4')]('endtime');if(_0x14f07b&&_0x57bcdf){this[_0xb497('0x5')](_0xb497('0x6'),moment(_0x57bcdf)[_0xb497('0x7')](moment(_0x14f07b),_0xb497('0x8')));}return this[_0xb497('0x5')](_0xb497('0x9'),_0x57bcdf);}},'amd':{'type':Sequelize[_0xb497('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb497('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb497('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb497('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb497('0x2')]},'callback':{'type':Sequelize[_0xb497('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb497('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb497('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb497('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb497('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb497('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 93f030e..9dae1e8 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 _0x2675=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','describe','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','phone','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','group','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x2ada5b,_0x36a127){var _0x56f265=function(_0xb92a8){while(--_0xb92a8){_0x2ada5b['push'](_0x2ada5b['shift']());}};_0x56f265(++_0x36a127);}(_0x2675,0x75));var _0x5267=function(_0x4690e9,_0x2818c4){_0x4690e9=_0x4690e9-0x0;var _0x3a013b=_0x2675[_0x4690e9];return _0x3a013b;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['CmHopperFinal'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['CmHopperFinal'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['describe']=function(_0x12d6a8,_0x4ee826){return db['CmHopperFinal'][_0x5267('0x43')]()[_0x5267('0x22')](respondWithResult(_0x4ee826,null))['catch'](handleError(_0x4ee826,null));};exports['update']=function(_0x383ebe,_0xe0439e){if(_0x383ebe[_0x5267('0x44')][_0x5267('0x45')]){delete _0x383ebe[_0x5267('0x44')][_0x5267('0x45')];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'uniqueid':_0x383ebe[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0xe0439e,null))[_0x5267('0x22')](saveUpdates(_0x383ebe[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0xe0439e,null))[_0x5267('0x3d')](handleError(_0xe0439e,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x8636d0,_0x466d46,_0x371486){return db['CmHopperFinal'][_0x5267('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x8636d0[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4a')))),'noSuchContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x51')))),_0x5267('0x52')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x53')))),'abandonedContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x54')))),_0x5267('0x55')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x466d46,null))['then'](respondWithResult(_0x466d46,null))['catch'](handleError(_0x466d46,null));};exports[_0x5267('0x58')]=function(_0x5393e9,_0x3f5cda,_0x47059c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5393e9[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4a')))),_0x5267('0x59')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),_0x5267('0x5a')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x51')))),_0x5267('0x52')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x53')))),_0x5267('0x5b')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x3f5cda,null))[_0x5267('0x22')](respondWithResult(_0x3f5cda,null))[_0x5267('0x3d')](handleError(_0x3f5cda,null));};exports[_0x5267('0x5c')]=function(_0x21338f,_0x1103c5,_0x489b9a){return db['VoiceQueue']['find']({'where':{'id':_0x21338f[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x1103c5,null))[_0x5267('0x22')](function(_0x457d84){var _0x4974d1;if(_0x457d84){_0x4974d1=squel[_0x5267('0x5d')]()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')](['phone',_0x5267('0x61'),_0x5267('0x62'),'ListId',_0x5267('0x63'),_0x5267('0x64'),'updatedAt'],squel['select']()[_0x5267('0x65')](_0x5267('0x66'),'phone')['field'](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')](_0x5267('0x68'),_0x5267('0x62'))['field'](_0x5267('0x69'),_0x5267('0x6a'))['field'](_0x5267('0x6b'),_0x5267('0x63'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))['from']('cm_hopper_final')[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())['where'](_0x5267('0x6f'),_0x21338f['body'][_0x5267('0x70')][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x73'))[_0x5267('0x74')](_0x5267('0x5f'))[_0x5267('0x34')]('VoiceQueueId\x20=\x20?',_0x21338f[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))['group'](_0x5267('0x62')))[_0x5267('0x6e')]();return db['sequelize'][_0x5267('0x2c')](_0x4974d1);}return[];})[_0x5267('0x22')](respondWithResult(_0x1103c5,null))[_0x5267('0x3d')](handleError(_0x1103c5,null));};exports[_0x5267('0x78')]=function(_0xd18795,_0x37b007,_0x358543){return db['Campaign'][_0x5267('0x42')]({'where':{'id':_0xd18795[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x37b007,null))[_0x5267('0x22')](function(_0x1cdf9f){var _0x4dbaa2;if(_0x1cdf9f){_0x4dbaa2=squel['insert']()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')]([_0x5267('0x73'),'scheduledAt',_0x5267('0x62'),_0x5267('0x6a'),_0x5267('0x79'),_0x5267('0x64'),_0x5267('0x6c')],squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x66'),_0x5267('0x73'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')]('ANY_VALUE(ContactId)',_0x5267('0x62'))[_0x5267('0x65')](_0x5267('0x69'),_0x5267('0x6a'))[_0x5267('0x65')](_0x5267('0x7a'),_0x5267('0x79'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x7b'),_0xd18795[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x6f'),_0xd18795[_0x5267('0x44')][_0x5267('0x70')]['toString']())[_0x5267('0x34')](_0x5267('0x71'))[_0x5267('0x34')](_0x5267('0x7c'),squel[_0x5267('0x72')]()['field'](_0x5267('0x73'))[_0x5267('0x74')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd18795[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')]('CampaignId\x20=\x20?',_0xd18795['params']['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))[_0x5267('0x7d')](_0x5267('0x62')))['toString']();return db[_0x5267('0x48')]['query'](_0x4dbaa2);}return[];})['then'](respondWithResult(_0x37b007,null))[_0x5267('0x3d')](handleError(_0x37b007,null));};exports['checkContactHopper']=function(_0x5da8d6,_0x3ebe63,_0x321322){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x5da8d6['body'][_0x5267('0x63')],'CampaignId':_0x5da8d6['body'][_0x5267('0x79')],'ContactId':_0x5da8d6['body'][_0x5267('0x62')]}})[_0x5267('0x22')](handleEntityNotFound(_0x3ebe63,null))['then'](function(_0x1ae9fe){if(_0x1ae9fe){return _0x1ae9fe;}return null;})[_0x5267('0x22')](respondWithResult(_0x3ebe63,null))[_0x5267('0x3d')](handleError(_0x3ebe63,null));}; \ No newline at end of file +var _0xafc4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','CmHopperFinal','includeAll','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ContactId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','CampaignId\x20=\x20?','group','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x4eb828,_0x346e9f){var _0xecfa09=function(_0x2eb71c){while(--_0x2eb71c){_0x4eb828['push'](_0x4eb828['shift']());}};_0xecfa09(++_0x346e9f);}(_0xafc4,0x69));var _0x4afc=function(_0x5a50af,_0x47c3ea){_0x5a50af=_0x5a50af-0x0;var _0x3893ef=_0xafc4[_0x5a50af];return _0x3893ef;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['CmHopperFinal'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x19a0ac,null))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x42e274,_0x269c24){if(_0x42e274[_0x4afc('0x43')][_0x4afc('0x44')]){delete _0x42e274[_0x4afc('0x43')][_0x4afc('0x44')];}return db[_0x4afc('0x3d')][_0x4afc('0x45')]({'where':{'uniqueid':_0x42e274['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x269c24,null))['then'](saveUpdates(_0x42e274['body'],null))[_0x4afc('0x25')](respondWithResult(_0x269c24,null))['catch'](handleError(_0x269c24,null));};exports[_0x4afc('0x46')]=function(_0x355198,_0x2fe2ae,_0x2cafc3){return db['CmHopperFinal'][_0x4afc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x355198['params']['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x4afc('0x4d')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x4afc('0x50')],[db['sequelize']['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x51')))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x53')))),_0x4afc('0x54')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})[_0x4afc('0x25')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x25')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x3f')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x57')]=function(_0x4985c6,_0x1771e8,_0x323c65){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x4985c6[_0x4afc('0x41')]['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x58')))),'noAnswerContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db['sequelize']['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x59')))),_0x4afc('0x50')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x5a')))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})['then'](handleEntityNotFound(_0x1771e8,null))[_0x4afc('0x25')](respondWithResult(_0x1771e8,null))[_0x4afc('0x3f')](handleError(_0x1771e8,null));};exports[_0x4afc('0x5b')]=function(_0x392252,_0x1f652a,_0x481263){return db['VoiceQueue'][_0x4afc('0x45')]({'where':{'id':_0x392252[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x1f652a,null))['then'](function(_0x380c56){var _0x14a216;if(_0x380c56){_0x14a216=squel[_0x4afc('0x5c')]()[_0x4afc('0x5d')](_0x4afc('0x5e'))['fromQuery']([_0x4afc('0x5f'),_0x4afc('0x60'),'ContactId',_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),'updatedAt'],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))['field']('ANY_VALUE(ListId)',_0x4afc('0x61'))[_0x4afc('0x65')](_0x4afc('0x69'),'VoiceQueueId')['field'](_0x4afc('0x67'),_0x4afc('0x63'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x6a'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x392252[_0x4afc('0x43')][_0x4afc('0x70')][_0x4afc('0x6e')]())['where'](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))[_0x4afc('0x37')]('VoiceQueueId\x20=\x20?',_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x74')))['group'](_0x4afc('0x68')))[_0x4afc('0x6e')]();return db['sequelize'][_0x4afc('0x2d')](_0x14a216);}return[];})[_0x4afc('0x25')](respondWithResult(_0x1f652a,null))[_0x4afc('0x3f')](handleError(_0x1f652a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1c3d20,_0x3478aa,_0x24553b){return db[_0x4afc('0x75')]['find']({'where':{'id':_0x1c3d20[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x3478aa,null))['then'](function(_0x2dc8a1){var _0x36f3ea;if(_0x2dc8a1){_0x36f3ea=squel[_0x4afc('0x5c')]()['into']('cm_hopper')[_0x4afc('0x76')]([_0x4afc('0x5f'),_0x4afc('0x60'),_0x4afc('0x68'),_0x4afc('0x61'),_0x4afc('0x77'),_0x4afc('0x63'),_0x4afc('0x6a')],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))[_0x4afc('0x65')]('ANY_VALUE(ListId)',_0x4afc('0x61'))['field']('ANY_VALUE(CampaignId)',_0x4afc('0x77'))['field']('NOW()',_0x4afc('0x63'))['field'](_0x4afc('0x67'),'updatedAt')[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x1c3d20['body']['state'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))['where'](_0x4afc('0x78'),_0x1c3d20['params']['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')]('state\x20=\x204'))[_0x4afc('0x79')]('ContactId'))['toString']();return db[_0x4afc('0x48')]['query'](_0x36f3ea);}return[];})['then'](respondWithResult(_0x3478aa,null))[_0x4afc('0x3f')](handleError(_0x3478aa,null));};exports['checkContactHopper']=function(_0x272e36,_0x24bf53,_0x5b1421){return db[_0x4afc('0x7a')][_0x4afc('0x7b')]({'where':{'VoiceQueueId':_0x272e36['body'][_0x4afc('0x62')],'CampaignId':_0x272e36[_0x4afc('0x43')][_0x4afc('0x77')],'ContactId':_0x272e36['body'][_0x4afc('0x68')]}})[_0x4afc('0x25')](handleEntityNotFound(_0x24bf53,null))[_0x4afc('0x25')](function(_0x16eb6d){if(_0x16eb6d){return _0x16eb6d;}return null;})[_0x4afc('0x25')](respondWithResult(_0x24bf53,null))[_0x4afc('0x3f')](handleError(_0x24bf53,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 31c53b5..051c754 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 _0xc2e8=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc2e8,0xb9));var _0x8c2e=function(_0x271fae,_0x61bbaf){_0x271fae=_0x271fae-0x0;var _0x49c416=_0xc2e8[_0x271fae];return _0x49c416;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var logger=require(_0x8c2e('0x2'))(_0x8c2e('0x3'));var moment=require(_0x8c2e('0x4'));var BPromise=require(_0x8c2e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8c2e('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x8c2e('0x7')]=function(_0x16c96d,_0x3dc1a1){return _0x16c96d['define'](_0x8c2e('0x8'),attributes,{'tableName':_0x8c2e('0x9'),'paranoid':![],'indexes':[{'name':_0x8c2e('0xa'),'fields':[_0x8c2e('0xa')]},{'name':_0x8c2e('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x03dc=['path','rimraf','../../config/environment','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x03dc,0x1ab));var _0xc03d=function(_0x462bf7,_0x14e2a5){_0x462bf7=_0x462bf7-0x0;var _0x38664c=_0x03dc[_0x462bf7];return _0x38664c;};'use strict';var _=require(_0xc03d('0x0'));var util=require(_0xc03d('0x1'));var logger=require(_0xc03d('0x2'))(_0xc03d('0x3'));var moment=require(_0xc03d('0x4'));var BPromise=require(_0xc03d('0x5'));var rp=require(_0xc03d('0x6'));var fs=require('fs');var path=require(_0xc03d('0x7'));var rimraf=require(_0xc03d('0x8'));var config=require(_0xc03d('0x9'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0xa183c1,_0x5bc985){return _0xa183c1['define'](_0xc03d('0xa'),attributes,{'tableName':_0xc03d('0xb'),'paranoid':![],'indexes':[{'name':_0xc03d('0xc'),'fields':[_0xc03d('0xc')]},{'name':_0xc03d('0xd'),'fields':[_0xc03d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index f8e497f..2091bc2 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(_0x142f17,_0x20a0b3){var _0x4e5688=function(_0x3133d5){while(--_0x3133d5){_0x142f17['push'](_0x142f17['shift']());}};_0x4e5688(++_0x20a0b3);}(_0x7a54,0x106));var _0x47a5=function(_0x20c83b,_0x23f8fc){_0x20c83b=_0x20c83b-0x0;var _0x1a829d=_0x7a54[_0x20c83b];return _0x1a829d;};'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(_0x37f24f,_0x5a1c94){var _0x254ec3=function(_0x2c6d7f){while(--_0x2c6d7f){_0x37f24f['push'](_0x37f24f['shift']());}};_0x254ec3(++_0x5a1c94);}(_0x7a54,0x106));var _0x47a5=function(_0x234af7,_0x4673fb){_0x234af7=_0x234af7-0x0;var _0x2925c0=_0x7a54[_0x234af7];return _0x2925c0;};'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 e2ad13c..c4a7d0e 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 _0xf92b=['connect-timeout','express','Router','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','path'];(function(_0x4fb3fb,_0x423db7){var _0x5a9bf3=function(_0x45c7af){while(--_0x45c7af){_0x4fb3fb['push'](_0x4fb3fb['shift']());}};_0x5a9bf3(++_0x423db7);}(_0xf92b,0x111));var _0xbf92=function(_0x5273be,_0x39ed2b){_0x5273be=_0x5273be-0x0;var _0x53f3d7=_0xf92b[_0x5273be];return _0x53f3d7;};'use strict';var multer=require(_0xbf92('0x0'));var util=require('util');var path=require(_0xbf92('0x1'));var timeout=require(_0xbf92('0x2'));var express=require(_0xbf92('0x3'));var router=express[_0xbf92('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf92('0x5'));var config=require('../../config/environment');var controller=require(_0xbf92('0x6'));router[_0xbf92('0x7')]('/',auth[_0xbf92('0x8')](),controller[_0xbf92('0x9')]);router[_0xbf92('0x7')](_0xbf92('0xa'),auth[_0xbf92('0x8')](),controller[_0xbf92('0xb')]);router[_0xbf92('0x7')](_0xbf92('0xc'),auth[_0xbf92('0x8')](),controller[_0xbf92('0xd')]);router[_0xbf92('0x7')](_0xbf92('0xe'),auth[_0xbf92('0x8')](),controller[_0xbf92('0xf')]);router[_0xbf92('0x7')](_0xbf92('0x10'),auth[_0xbf92('0x8')](),controller[_0xbf92('0x11')]);router[_0xbf92('0x12')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xbf92('0x13')]);router[_0xbf92('0x12')](_0xbf92('0x14'),auth[_0xbf92('0x8')](),controller[_0xbf92('0x15')]);router[_0xbf92('0x12')](_0xbf92('0x16'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xbf92('0x17')](_0xbf92('0xc'),auth[_0xbf92('0x8')](),controller['update']);module[_0xbf92('0x18')]=router; \ No newline at end of file +var _0x63a2=['post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal'];(function(_0x179ea2,_0x1f944e){var _0x21653d=function(_0x1e8681){while(--_0x1e8681){_0x179ea2['push'](_0x179ea2['shift']());}};_0x21653d(++_0x1f944e);}(_0x63a2,0x1e1));var _0x263a=function(_0x5e615e,_0x37fb87){_0x5e615e=_0x5e615e-0x0;var _0x2acf77=_0x63a2[_0x5e615e];return _0x2acf77;};'use strict';var multer=require(_0x263a('0x0'));var util=require(_0x263a('0x1'));var path=require('path');var timeout=require(_0x263a('0x2'));var express=require('express');var router=express[_0x263a('0x3')]();var fs_extra=require(_0x263a('0x4'));var auth=require(_0x263a('0x5'));var interaction=require(_0x263a('0x6'));var config=require(_0x263a('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x263a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x263a('0x8')](_0x263a('0x9'),auth['isAuthenticated'](),controller[_0x263a('0xa')]);router['get'](_0x263a('0xb'),auth[_0x263a('0xc')](),controller[_0x263a('0xd')]);router[_0x263a('0x8')](_0x263a('0xe'),auth['isAuthenticated'](),controller[_0x263a('0xf')]);router['get'](_0x263a('0x10'),auth['isAuthenticated'](),controller[_0x263a('0x11')]);router['post']('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x263a('0x12')]);router[_0x263a('0x13')](_0x263a('0x14'),auth[_0x263a('0xc')](),controller[_0x263a('0x15')]);router[_0x263a('0x13')](_0x263a('0x16'),auth[_0x263a('0xc')](),controller['checkContactHopper']);router[_0x263a('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x263a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e404910..8eb79e4 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 _0x2404=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2404,0x12c));var _0x4240=function(_0x175a69,_0x37a8b9){_0x175a69=_0x175a69-0x0;var _0x417cf9=_0x2404[_0x175a69];return _0x417cf9;};'use strict';var Sequelize=require('sequelize');module[_0x4240('0x0')]={'state':{'type':Sequelize[_0x4240('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4240('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4240('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x4240('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4240('0x2')]},'starttime':{'type':Sequelize[_0x4240('0x3')]},'responsetime':{'type':Sequelize[_0x4240('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4240('0x3')]},'endtime':{'type':Sequelize[_0x4240('0x3')]},'ringtime':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4240('0x2')]},'campaign':{'type':Sequelize[_0x4240('0x2')]},'campaigntype':{'type':Sequelize[_0x4240('0x2')]},'membername':{'type':Sequelize[_0x4240('0x2')]},'reason':{'type':Sequelize[_0x4240('0x2')]},'amd':{'type':Sequelize[_0x4240('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4240('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4240('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4240('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4240('0x3')]},'recallme':{'type':Sequelize[_0x4240('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4240('0x3')]},'edited':{'type':Sequelize[_0x4240('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4240('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x71d8=['INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x50e3e4,_0x1f884c){var _0x2060a8=function(_0x36845e){while(--_0x36845e){_0x50e3e4['push'](_0x50e3e4['shift']());}};_0x2060a8(++_0x1f884c);}(_0x71d8,0x19e));var _0x871d=function(_0x373c6e,_0x3a53d8){_0x373c6e=_0x373c6e-0x0;var _0x1c80cb=_0x71d8[_0x373c6e];return _0x1c80cb;};'use strict';var Sequelize=require(_0x871d('0x0'));module['exports']={'state':{'type':Sequelize[_0x871d('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x871d('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x871d('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x871d('0x3')]},'calleridnum':{'type':Sequelize[_0x871d('0x3')]},'calleridname':{'type':Sequelize[_0x871d('0x3')]},'starttime':{'type':Sequelize[_0x871d('0x2')]},'responsetime':{'type':Sequelize[_0x871d('0x2')]},'answertime':{'type':Sequelize[_0x871d('0x2')]},'droptime':{'type':Sequelize[_0x871d('0x2')]},'endtime':{'type':Sequelize[_0x871d('0x2')]},'ringtime':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x871d('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x871d('0x3')]},'membername':{'type':Sequelize[_0x871d('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x871d('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x871d('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x871d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x871d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x871d('0x2')]},'recallme':{'type':Sequelize[_0x871d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x871d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x871d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9dc2082..42f6e06 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 _0x957b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','describe','uniqueid','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory'];(function(_0x4852b0,_0x12d34c){var _0x150773=function(_0x57dfca){while(--_0x57dfca){_0x4852b0['push'](_0x4852b0['shift']());}};_0x150773(++_0x12d34c);}(_0x957b,0x6c));var _0xb957=function(_0x12ac1f,_0x461a52){_0x12ac1f=_0x12ac1f-0x0;var _0x724467=_0x957b[_0x12ac1f];return _0x724467;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb957('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb957('0x1'));var moment=require(_0xb957('0x2'));var BPromise=require(_0xb957('0x3'));var Mustache=require(_0xb957('0x4'));var util=require(_0xb957('0x5'));var path=require(_0xb957('0x6'));var sox=require(_0xb957('0x7'));var csv=require(_0xb957('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb957('0x9'));var squel=require(_0xb957('0xa'));var crypto=require('crypto');var jsforce=require(_0xb957('0xb'));var deskjs=require(_0xb957('0xc'));var toCsv=require(_0xb957('0x8'));var querystring=require(_0xb957('0xd'));var Papa=require(_0xb957('0xe'));var Redis=require(_0xb957('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb957('0x10'));var as=require(_0xb957('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb957('0x12'))(_0xb957('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb957('0x14'));var db=require(_0xb957('0x15'))['db'];function respondWithStatusCode(_0x50febc,_0x4842b6){_0x4842b6=_0x4842b6||0xcc;return function(_0x340e00){if(_0x340e00){return _0x50febc['sendStatus'](_0x4842b6);}return _0x50febc['status'](_0x4842b6)['end']();};}function respondWithResult(_0x4bd7bf,_0x42a83d){_0x42a83d=_0x42a83d||0xc8;return function(_0x1ccaef){if(_0x1ccaef){return _0x4bd7bf[_0xb957('0x16')](_0x42a83d)[_0xb957('0x17')](_0x1ccaef);}};}function respondWithFilteredResult(_0xbf9202,_0x29ef4a){return function(_0x3b1c2b){if(_0x3b1c2b){var _0x201c28=typeof _0x29ef4a[_0xb957('0x18')]==='undefined'&&typeof _0x29ef4a['limit']===_0xb957('0x19');var _0x149069=_0x3b1c2b[_0xb957('0x1a')];var _0x2c797a=_0x201c28?0x0:_0x29ef4a[_0xb957('0x18')];var _0x2d5934=_0x201c28?_0x3b1c2b['count']:_0x29ef4a[_0xb957('0x18')]+_0x29ef4a[_0xb957('0x1b')];var _0x489cf1;if(_0x2d5934>=_0x149069){_0x2d5934=_0x149069;_0x489cf1=0xc8;}else{_0x489cf1=0xce;}_0xbf9202[_0xb957('0x16')](_0x489cf1);return _0xbf9202[_0xb957('0x1c')](_0xb957('0x1d'),_0x2c797a+'-'+_0x2d5934+'/'+_0x149069)[_0xb957('0x17')](_0x3b1c2b);}return null;};}function patchUpdates(_0x103fbc){return function(_0x27973a){try{jsonpatch[_0xb957('0x1e')](_0x27973a,_0x103fbc,!![]);}catch(_0x177bb9){return BPromise[_0xb957('0x1f')](_0x177bb9);}return _0x27973a[_0xb957('0x20')]();};}function saveUpdates(_0xb0bab5,_0xd5f81b){return function(_0x159cd1){if(_0x159cd1){return _0x159cd1[_0xb957('0x21')](_0xb0bab5)[_0xb957('0x22')](function(_0x224f0b){return _0x224f0b;});}return null;};}function removeEntity(_0x2284e2,_0x143eaf){return function(_0xdb3aff){if(_0xdb3aff){return _0xdb3aff[_0xb957('0x23')]()[_0xb957('0x22')](function(){_0x2284e2[_0xb957('0x16')](0xcc)[_0xb957('0x24')]();});}};}function handleEntityNotFound(_0x10a31b,_0x5eb409){return function(_0x42c6db){if(!_0x42c6db){_0x10a31b['sendStatus'](0x194);}return _0x42c6db;};}function handleError(_0x401ea3,_0x44bc36){_0x44bc36=_0x44bc36||0x1f4;return function(_0x11dcb1){logger[_0xb957('0x25')](_0x11dcb1[_0xb957('0x26')]);if(_0x11dcb1[_0xb957('0x27')]){delete _0x11dcb1[_0xb957('0x27')];}_0x401ea3[_0xb957('0x16')](_0x44bc36)[_0xb957('0x28')](_0x11dcb1);};}exports[_0xb957('0x29')]=function(_0x9dbaed,_0x32f016){var _0x38b924={},_0x26c366={},_0x3b38f1={'count':0x0,'rows':[]};var _0x59304c=_[_0xb957('0x2a')](db[_0xb957('0x2b')]['rawAttributes'],function(_0x26dd08){return{'name':_0x26dd08[_0xb957('0x2c')],'type':_0x26dd08[_0xb957('0x2d')][_0xb957('0x2e')]};});_0x26c366[_0xb957('0x2f')]=_[_0xb957('0x2a')](_0x59304c,'name');_0x26c366[_0xb957('0x30')]=_[_0xb957('0x31')](_0x9dbaed[_0xb957('0x30')]);_0x26c366[_0xb957('0x32')]=_[_0xb957('0x33')](_0x26c366['model'],_0x26c366[_0xb957('0x30')]);_0x38b924[_0xb957('0x34')]=_['intersection'](_0x26c366[_0xb957('0x2f')],qs[_0xb957('0x35')](_0x9dbaed[_0xb957('0x30')][_0xb957('0x35')]));_0x38b924[_0xb957('0x34')]=_0x38b924[_0xb957('0x34')][_0xb957('0x36')]?_0x38b924[_0xb957('0x34')]:_0x26c366[_0xb957('0x2f')];if(!_0x9dbaed['query'][_0xb957('0x37')](_0xb957('0x38'))){_0x38b924['limit']=qs['limit'](_0x9dbaed[_0xb957('0x30')]['limit']);_0x38b924[_0xb957('0x18')]=qs[_0xb957('0x18')](_0x9dbaed[_0xb957('0x30')][_0xb957('0x18')]);}_0x38b924[_0xb957('0x39')]=qs[_0xb957('0x3a')](_0x9dbaed[_0xb957('0x30')][_0xb957('0x3a')]);_0x38b924[_0xb957('0x3b')]=qs['filters'](_[_0xb957('0x3c')](_0x9dbaed[_0xb957('0x30')],_0x26c366[_0xb957('0x32')]),_0x59304c);if(_0x9dbaed[_0xb957('0x30')][_0xb957('0x3d')]){_0x38b924['where']=_[_0xb957('0x3e')](_0x38b924[_0xb957('0x3b')],{'$or':_[_0xb957('0x2a')](_0x59304c,function(_0x46f174){if(_0x46f174[_0xb957('0x2d')]!=='VIRTUAL'){var _0x42153e={};_0x42153e[_0x46f174[_0xb957('0x27')]]={'$like':'%'+_0x9dbaed[_0xb957('0x30')]['filter']+'%'};return _0x42153e;}})});}_0x38b924=_['merge']({},_0x38b924,_0x9dbaed[_0xb957('0x3f')]);var _0x1cbf35={'where':_0x38b924[_0xb957('0x3b')]};return db[_0xb957('0x2b')][_0xb957('0x1a')](_0x1cbf35)[_0xb957('0x22')](function(_0x348cd2){_0x3b38f1['count']=_0x348cd2;if(_0x9dbaed[_0xb957('0x30')][_0xb957('0x40')]){_0x38b924[_0xb957('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb957('0x42')](_0x38b924);})[_0xb957('0x22')](function(_0x323f81){_0x3b38f1[_0xb957('0x43')]=_0x323f81;return _0x3b38f1;})['then'](respondWithFilteredResult(_0x32f016,_0x38b924))[_0xb957('0x44')](handleError(_0x32f016,null));};exports['show']=function(_0x468db6,_0x1d46a1){var _0x5a89dd={'raw':!![],'where':{'id':_0x468db6['params']['id']}},_0x55458f={};_0x55458f[_0xb957('0x2f')]=_[_0xb957('0x31')](db[_0xb957('0x2b')][_0xb957('0x45')]);_0x55458f[_0xb957('0x30')]=_[_0xb957('0x31')](_0x468db6[_0xb957('0x30')]);_0x55458f['filters']=_[_0xb957('0x33')](_0x55458f[_0xb957('0x2f')],_0x55458f[_0xb957('0x30')]);_0x5a89dd[_0xb957('0x34')]=_['intersection'](_0x55458f[_0xb957('0x2f')],qs[_0xb957('0x35')](_0x468db6[_0xb957('0x30')][_0xb957('0x35')]));_0x5a89dd['attributes']=_0x5a89dd[_0xb957('0x34')]['length']?_0x5a89dd[_0xb957('0x34')]:_0x55458f[_0xb957('0x2f')];if(_0x468db6[_0xb957('0x30')][_0xb957('0x40')]){_0x5a89dd[_0xb957('0x41')]=[{'all':!![]}];}_0x5a89dd=_['merge']({},_0x5a89dd,_0x468db6['options']);return db[_0xb957('0x2b')][_0xb957('0x46')](_0x5a89dd)['then'](handleEntityNotFound(_0x1d46a1,null))['then'](respondWithResult(_0x1d46a1,null))['catch'](handleError(_0x1d46a1,null));};exports[_0xb957('0x47')]=function(_0x386273,_0x4d03b5){return db['CmHopperHistory'][_0xb957('0x47')](_0x386273[_0xb957('0x48')],{})[_0xb957('0x22')](respondWithResult(_0x4d03b5,0xc9))[_0xb957('0x44')](handleError(_0x4d03b5,null));};exports[_0xb957('0x49')]=function(_0x47a9e4,_0x36920c){return db[_0xb957('0x2b')][_0xb957('0x49')]()[_0xb957('0x22')](respondWithResult(_0x36920c,null))[_0xb957('0x44')](handleError(_0x36920c,null));};exports[_0xb957('0x21')]=function(_0x4d6138,_0x4d6f52){if(_0x4d6138[_0xb957('0x48')][_0xb957('0x4a')]){delete _0x4d6138[_0xb957('0x48')][_0xb957('0x4a')];}return db[_0xb957('0x2b')]['find']({'where':{'uniqueid':_0x4d6138[_0xb957('0x4b')]['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x4d6f52,null))[_0xb957('0x22')](saveUpdates(_0x4d6138[_0xb957('0x48')],null))[_0xb957('0x22')](respondWithResult(_0x4d6f52,null))[_0xb957('0x44')](handleError(_0x4d6f52,null));}; \ No newline at end of file +var _0x3586=['filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','fields','options','find','create','describe','body','uniqueid','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x3dc07e,_0x47df59){var _0x89d6b8=function(_0x43ffd8){while(--_0x43ffd8){_0x3dc07e['push'](_0x3dc07e['shift']());}};_0x89d6b8(++_0x47df59);}(_0x3586,0xfa));var _0x6358=function(_0x43606b,_0x2f2292){_0x43606b=_0x43606b-0x0;var _0xbfd21a=_0x3586[_0x43606b];return _0xbfd21a;};'use strict';var emlformat=require(_0x6358('0x0'));var rimraf=require(_0x6358('0x1'));var zipdir=require(_0x6358('0x2'));var jsonpatch=require(_0x6358('0x3'));var rp=require(_0x6358('0x4'));var moment=require(_0x6358('0x5'));var BPromise=require(_0x6358('0x6'));var Mustache=require(_0x6358('0x7'));var util=require(_0x6358('0x8'));var path=require(_0x6358('0x9'));var sox=require(_0x6358('0xa'));var csv=require(_0x6358('0xb'));var ejs=require(_0x6358('0xc'));var fs=require('fs');var fs_extra=require(_0x6358('0xd'));var _=require('lodash');var squel=require(_0x6358('0xe'));var crypto=require(_0x6358('0xf'));var jsforce=require(_0x6358('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6358('0xb'));var querystring=require(_0x6358('0x11'));var Papa=require(_0x6358('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6358('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6358('0x14'))(_0x6358('0x15'));var utils=require(_0x6358('0x16'));var config=require(_0x6358('0x17'));var licenseUtil=require(_0x6358('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45a652,_0x1201e4){_0x1201e4=_0x1201e4||0xcc;return function(_0x56e0a2){if(_0x56e0a2){return _0x45a652['sendStatus'](_0x1201e4);}return _0x45a652[_0x6358('0x19')](_0x1201e4)[_0x6358('0x1a')]();};}function respondWithResult(_0x592bc8,_0x242cd7){_0x242cd7=_0x242cd7||0xc8;return function(_0x6a6634){if(_0x6a6634){return _0x592bc8[_0x6358('0x19')](_0x242cd7)[_0x6358('0x1b')](_0x6a6634);}};}function respondWithFilteredResult(_0x5f00fc,_0x2acab4){return function(_0x1021cb){if(_0x1021cb){var _0x491db7=typeof _0x2acab4[_0x6358('0x1c')]===_0x6358('0x1d')&&typeof _0x2acab4['limit']===_0x6358('0x1d');var _0x5704b9=_0x1021cb[_0x6358('0x1e')];var _0x205fdc=_0x491db7?0x0:_0x2acab4[_0x6358('0x1c')];var _0x1b1486=_0x491db7?_0x1021cb[_0x6358('0x1e')]:_0x2acab4[_0x6358('0x1c')]+_0x2acab4[_0x6358('0x1f')];var _0x149b59;if(_0x1b1486>=_0x5704b9){_0x1b1486=_0x5704b9;_0x149b59=0xc8;}else{_0x149b59=0xce;}_0x5f00fc[_0x6358('0x19')](_0x149b59);return _0x5f00fc[_0x6358('0x20')](_0x6358('0x21'),_0x205fdc+'-'+_0x1b1486+'/'+_0x5704b9)[_0x6358('0x1b')](_0x1021cb);}return null;};}function patchUpdates(_0x42992c){return function(_0x33e917){try{jsonpatch[_0x6358('0x22')](_0x33e917,_0x42992c,!![]);}catch(_0x92ae68){return BPromise[_0x6358('0x23')](_0x92ae68);}return _0x33e917['save']();};}function saveUpdates(_0x5a7dc5,_0x4e3c88){return function(_0x2251c0){if(_0x2251c0){return _0x2251c0[_0x6358('0x24')](_0x5a7dc5)[_0x6358('0x25')](function(_0x58ded7){return _0x58ded7;});}return null;};}function removeEntity(_0x3b71d4,_0x55eade){return function(_0x5c8df4){if(_0x5c8df4){return _0x5c8df4['destroy']()[_0x6358('0x25')](function(){_0x3b71d4[_0x6358('0x19')](0xcc)[_0x6358('0x1a')]();});}};}function handleEntityNotFound(_0x429270,_0x340828){return function(_0x8f9d23){if(!_0x8f9d23){_0x429270[_0x6358('0x26')](0x194);}return _0x8f9d23;};}function handleError(_0x4177e9,_0x2c9481){_0x2c9481=_0x2c9481||0x1f4;return function(_0x31679b){logger[_0x6358('0x27')](_0x31679b[_0x6358('0x28')]);if(_0x31679b[_0x6358('0x29')]){delete _0x31679b['name'];}_0x4177e9[_0x6358('0x19')](_0x2c9481)[_0x6358('0x2a')](_0x31679b);};}exports[_0x6358('0x2b')]=function(_0x4798ef,_0x4d7a70){var _0x3d0f29={},_0x2f2b42={},_0x7f6133={'count':0x0,'rows':[]};var _0x591131=_[_0x6358('0x2c')](db[_0x6358('0x2d')][_0x6358('0x2e')],function(_0x59a527){return{'name':_0x59a527['fieldName'],'type':_0x59a527[_0x6358('0x2f')][_0x6358('0x30')]};});_0x2f2b42[_0x6358('0x31')]=_[_0x6358('0x2c')](_0x591131,_0x6358('0x29'));_0x2f2b42[_0x6358('0x32')]=_[_0x6358('0x33')](_0x4798ef[_0x6358('0x32')]);_0x2f2b42['filters']=_[_0x6358('0x34')](_0x2f2b42[_0x6358('0x31')],_0x2f2b42[_0x6358('0x32')]);_0x3d0f29[_0x6358('0x35')]=_[_0x6358('0x34')](_0x2f2b42[_0x6358('0x31')],qs['fields'](_0x4798ef['query']['fields']));_0x3d0f29[_0x6358('0x35')]=_0x3d0f29[_0x6358('0x35')][_0x6358('0x36')]?_0x3d0f29['attributes']:_0x2f2b42['model'];if(!_0x4798ef[_0x6358('0x32')][_0x6358('0x37')](_0x6358('0x38'))){_0x3d0f29[_0x6358('0x1f')]=qs[_0x6358('0x1f')](_0x4798ef['query'][_0x6358('0x1f')]);_0x3d0f29[_0x6358('0x1c')]=qs['offset'](_0x4798ef[_0x6358('0x32')][_0x6358('0x1c')]);}_0x3d0f29[_0x6358('0x39')]=qs[_0x6358('0x3a')](_0x4798ef[_0x6358('0x32')][_0x6358('0x3a')]);_0x3d0f29[_0x6358('0x3b')]=qs[_0x6358('0x3c')](_[_0x6358('0x3d')](_0x4798ef[_0x6358('0x32')],_0x2f2b42[_0x6358('0x3c')]),_0x591131);if(_0x4798ef[_0x6358('0x32')][_0x6358('0x3e')]){_0x3d0f29['where']=_[_0x6358('0x3f')](_0x3d0f29['where'],{'$or':_[_0x6358('0x2c')](_0x591131,function(_0x53fea3){if(_0x53fea3[_0x6358('0x2f')]!==_0x6358('0x40')){var _0x176406={};_0x176406[_0x53fea3[_0x6358('0x29')]]={'$like':'%'+_0x4798ef[_0x6358('0x32')][_0x6358('0x3e')]+'%'};return _0x176406;}})});}_0x3d0f29=_[_0x6358('0x3f')]({},_0x3d0f29,_0x4798ef['options']);var _0x2ce393={'where':_0x3d0f29['where']};return db[_0x6358('0x2d')][_0x6358('0x1e')](_0x2ce393)[_0x6358('0x25')](function(_0x3898b4){_0x7f6133['count']=_0x3898b4;if(_0x4798ef[_0x6358('0x32')]['includeAll']){_0x3d0f29[_0x6358('0x41')]=[{'all':!![]}];}return db[_0x6358('0x2d')][_0x6358('0x42')](_0x3d0f29);})[_0x6358('0x25')](function(_0x774d6f){_0x7f6133[_0x6358('0x43')]=_0x774d6f;return _0x7f6133;})[_0x6358('0x25')](respondWithFilteredResult(_0x4d7a70,_0x3d0f29))[_0x6358('0x44')](handleError(_0x4d7a70,null));};exports[_0x6358('0x45')]=function(_0x373473,_0x5a78b3){var _0x422cab={'raw':!![],'where':{'id':_0x373473[_0x6358('0x46')]['id']}},_0x401979={};_0x401979[_0x6358('0x31')]=_[_0x6358('0x33')](db[_0x6358('0x2d')][_0x6358('0x2e')]);_0x401979['query']=_[_0x6358('0x33')](_0x373473[_0x6358('0x32')]);_0x401979['filters']=_['intersection'](_0x401979[_0x6358('0x31')],_0x401979['query']);_0x422cab[_0x6358('0x35')]=_['intersection'](_0x401979[_0x6358('0x31')],qs[_0x6358('0x47')](_0x373473[_0x6358('0x32')][_0x6358('0x47')]));_0x422cab['attributes']=_0x422cab[_0x6358('0x35')][_0x6358('0x36')]?_0x422cab['attributes']:_0x401979['model'];if(_0x373473[_0x6358('0x32')]['includeAll']){_0x422cab[_0x6358('0x41')]=[{'all':!![]}];}_0x422cab=_[_0x6358('0x3f')]({},_0x422cab,_0x373473[_0x6358('0x48')]);return db['CmHopperHistory'][_0x6358('0x49')](_0x422cab)[_0x6358('0x25')](handleEntityNotFound(_0x5a78b3,null))[_0x6358('0x25')](respondWithResult(_0x5a78b3,null))[_0x6358('0x44')](handleError(_0x5a78b3,null));};exports[_0x6358('0x4a')]=function(_0x5119bf,_0xc7abba){return db[_0x6358('0x2d')]['create'](_0x5119bf['body'],{})['then'](respondWithResult(_0xc7abba,0xc9))[_0x6358('0x44')](handleError(_0xc7abba,null));};exports[_0x6358('0x4b')]=function(_0x377e39,_0x150e9b){return db['CmHopperHistory'][_0x6358('0x4b')]()[_0x6358('0x25')](respondWithResult(_0x150e9b,null))[_0x6358('0x44')](handleError(_0x150e9b,null));};exports['update']=function(_0x54c7c8,_0x64e54a){if(_0x54c7c8[_0x6358('0x4c')][_0x6358('0x4d')]){delete _0x54c7c8[_0x6358('0x4c')][_0x6358('0x4d')];}return db[_0x6358('0x2d')][_0x6358('0x49')]({'where':{'uniqueid':_0x54c7c8['params']['id']}})[_0x6358('0x25')](handleEntityNotFound(_0x64e54a,null))[_0x6358('0x25')](saveUpdates(_0x54c7c8[_0x6358('0x4c')],null))['then'](respondWithResult(_0x64e54a,null))[_0x6358('0x44')](handleError(_0x64e54a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 93c2bb8..ea83720 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 _0x6829=['../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x5833a3,_0x247c31){var _0x149ef4=function(_0x32a499){while(--_0x32a499){_0x5833a3['push'](_0x5833a3['shift']());}};_0x149ef4(++_0x247c31);}(_0x6829,0x14c));var _0x9682=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6829[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9682('0x2'));var rp=require(_0x9682('0x3'));var fs=require('fs');var path=require(_0x9682('0x4'));var rimraf=require(_0x9682('0x5'));var config=require(_0x9682('0x6'));var attributes=require(_0x9682('0x7'));module[_0x9682('0x8')]=function(_0x1e6fe8,_0x19b909){return _0x1e6fe8[_0x9682('0x9')](_0x9682('0xa'),attributes,{'tableName':_0x9682('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0x9682('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6132=['cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird','rimraf','./cmHopperHistory.attributes','define'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x6132,0xf3));var _0x2613=function(_0x23b905,_0x51ead5){_0x23b905=_0x23b905-0x0;var _0x46ecfb=_0x6132[_0x23b905];return _0x46ecfb;};'use strict';var _=require('lodash');var util=require(_0x2613('0x0'));var logger=require('../../config/logger')(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2613('0x4'));var config=require('../../config/environment');var attributes=require(_0x2613('0x5'));module['exports']=function(_0x4479f6,_0x3f8ef6){return _0x4479f6[_0x2613('0x6')]('CmHopperHistory',attributes,{'tableName':_0x2613('0x7'),'paranoid':![],'indexes':[{'name':_0x2613('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x2613('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7787895..22d0baa 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 _0x4ef1=['`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign'];(function(_0x2292e3,_0x1e42f){var _0x5aba96=function(_0x1df646){while(--_0x1df646){_0x2292e3['push'](_0x2292e3['shift']());}};_0x5aba96(++_0x1e42f);}(_0x4ef1,0xeb));var _0x14ef=function(_0x344eb8,_0x12a8a5){_0x344eb8=_0x344eb8-0x0;var _0x3f197c=_0x4ef1[_0x344eb8];return _0x3f197c;};'use strict';var _=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var moment=require('moment');var BPromise=require(_0x14ef('0x2'));var rs=require(_0x14ef('0x3'));var fs=require('fs');var Redis=require(_0x14ef('0x4'));var db=require(_0x14ef('0x5'))['db'];var utils=require(_0x14ef('0x6'));var logger=require(_0x14ef('0x7'))(_0x14ef('0x8'));var config=require(_0x14ef('0x9'));var jayson=require(_0x14ef('0xa'));var client=jayson[_0x14ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261fa2,_0x2dc335,_0x5b75ad){return new BPromise(function(_0x4175e7,_0x2ab217){return client[_0x14ef('0xc')](_0x261fa2,_0x5b75ad)[_0x14ef('0xd')](function(_0x17acc1){logger['info'](_0x14ef('0xe'),_0x2dc335,'request\x20sent');logger[_0x14ef('0xf')](_0x14ef('0x10'),_0x2dc335,_0x14ef('0x11'),JSON[_0x14ef('0x12')](_0x17acc1));if(_0x17acc1['error']){if(_0x17acc1['error'][_0x14ef('0x13')]===0x1f4){logger[_0x14ef('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x2dc335,_0x17acc1[_0x14ef('0x14')][_0x14ef('0x15')]);return _0x2ab217(_0x17acc1[_0x14ef('0x14')]['message']);}logger[_0x14ef('0x14')](_0x14ef('0xe'),_0x2dc335,_0x17acc1[_0x14ef('0x14')][_0x14ef('0x15')]);return _0x4175e7(_0x17acc1['error'][_0x14ef('0x15')]);}else{logger[_0x14ef('0x16')](_0x14ef('0xe'),_0x2dc335,_0x14ef('0x11'));_0x4175e7(_0x17acc1['result'][_0x14ef('0x15')]);}})[_0x14ef('0x17')](function(_0x24556b){logger[_0x14ef('0x14')](_0x14ef('0xe'),_0x2dc335,_0x24556b);_0x2ab217(_0x24556b);});});}exports[_0x14ef('0x18')]=function(_0x17f63a){var _0x1acc0a=this;return new Promise(function(_0x19b2cb,_0x3b5b23){return db[_0x14ef('0x19')][_0x14ef('0x1a')](_0x17f63a[_0x14ef('0x1b')],{'raw':_0x17f63a[_0x14ef('0x1c')]?_0x17f63a['options']['raw']===undefined?!![]:![]:!![]})[_0x14ef('0xd')](function(_0x34a991){logger[_0x14ef('0x16')](_0x14ef('0x18'),_0x17f63a);logger[_0x14ef('0xf')](_0x14ef('0x18'),_0x17f63a,JSON[_0x14ef('0x12')](_0x34a991));_0x19b2cb(_0x34a991);})[_0x14ef('0x17')](function(_0x52f889){logger[_0x14ef('0x14')]('CreateCmHopperHistory',_0x52f889['message'],_0x17f63a);_0x3b5b23(_0x1acc0a[_0x14ef('0x14')](0x1f4,_0x52f889[_0x14ef('0x15')]));});});};exports[_0x14ef('0x1d')]=function(_0x275cc7){var _0x33e198=this;return new Promise(function(_0x379c2e,_0x1e816f){return db[_0x14ef('0x19')][_0x14ef('0x1e')]({'raw':_0x275cc7[_0x14ef('0x1c')]?_0x275cc7['options'][_0x14ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x275cc7[_0x14ef('0x1c')]?_0x275cc7[_0x14ef('0x1c')][_0x14ef('0x20')]||null:null,'attributes':[[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize'][_0x14ef('0x23')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x25')))),_0x14ef('0x26')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x27')))),_0x14ef('0x28')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x29')))),_0x14ef('0x2a')],[db['sequelize']['fn']('AVG',db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x2b')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x14ef('0x2c'),db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x2d')))),_0x14ef('0x2e')]]})['then'](function(_0x2202e0){logger[_0x14ef('0x16')](_0x14ef('0x1d'),_0x275cc7);logger['debug']('AvgHandleTime',_0x275cc7,JSON['stringify'](_0x2202e0));_0x379c2e(_0x2202e0);})[_0x14ef('0x17')](function(_0x428b46){logger[_0x14ef('0x14')]('AvgHandleTime',_0x428b46['message'],_0x275cc7);_0x1e816f(_0x33e198[_0x14ef('0x14')](0x1f4,_0x428b46['message']));});});};exports[_0x14ef('0x2f')]=function(_0x1a7201){var _0x35f873=this;return new Promise(function(_0x5dcb47,_0x35a63b){return db[_0x14ef('0x19')][_0x14ef('0x1e')]({'raw':_0x1a7201['options']?_0x1a7201[_0x14ef('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7201[_0x14ef('0x1c')]?_0x1a7201[_0x14ef('0x1c')][_0x14ef('0x20')]||null:null,'attributes':[[_0x14ef('0x30'),'name'],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')]['fn']('IF',db['sequelize'][_0x14ef('0x24')](_0x14ef('0x31')))),'outboundNoSuchCallsDay'],[db[_0x14ef('0x21')]['fn']('COUNT',db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x32')))),'outboundNoAnswerCallsDay'],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x14ef('0x33')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x34')))),_0x14ef('0x35')],[db[_0x14ef('0x21')]['fn']('COUNT',db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x14ef('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x14ef('0x24')](_0x14ef('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x14ef('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x14ef('0x24')](_0x14ef('0x37')))),_0x14ef('0x38')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')]['literal'](_0x14ef('0x39')))),_0x14ef('0x3a')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')]['literal'](_0x14ef('0x3b')))),_0x14ef('0x3c')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x3d')))),_0x14ef('0x3e')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db['sequelize']['fn']('IF',db[_0x14ef('0x21')]['literal'](_0x14ef('0x3f')))),_0x14ef('0x40')],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x41')))),'outboundRejectCallsDay'],[db[_0x14ef('0x21')]['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')]['fn']('IF',db['sequelize'][_0x14ef('0x24')](_0x14ef('0x42')))),_0x14ef('0x43')]],'group':[_0x14ef('0x30')]})[_0x14ef('0xd')](function(_0xab2156){logger[_0x14ef('0x16')](_0x14ef('0x2f'),_0x1a7201);logger[_0x14ef('0xf')](_0x14ef('0x2f'),_0x1a7201,JSON[_0x14ef('0x12')](_0xab2156));_0x5dcb47(_0xab2156);})[_0x14ef('0x17')](function(_0x2d89ea){logger[_0x14ef('0x14')](_0x14ef('0x2f'),_0x2d89ea[_0x14ef('0x15')],_0x1a7201);_0x35a63b(_0x35f873[_0x14ef('0x14')](0x1f4,_0x2d89ea['message']));});});};exports[_0x14ef('0x44')]=function(_0xd5401b){var _0x36c38f=this;return new Promise(function(_0x5d6e4e,_0x1ec7e8){return db[_0x14ef('0x19')][_0x14ef('0x1e')]({'raw':_0xd5401b['options']?_0xd5401b[_0x14ef('0x1c')][_0x14ef('0x1f')]===undefined?!![]:![]:!![],'where':_0xd5401b['options']?_0xd5401b[_0x14ef('0x1c')]['where']||null:null,'attributes':[[_0x14ef('0x30'),_0x14ef('0x45')],[db['sequelize']['fn'](_0x14ef('0x22'),db[_0x14ef('0x21')][_0x14ef('0x23')]('id')),_0x14ef('0x46')],[db['sequelize']['fn']('COUNT',db[_0x14ef('0x21')]['fn']('IF',db[_0x14ef('0x21')][_0x14ef('0x24')](_0x14ef('0x25')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x14ef('0xd')](function(_0x1a3557){logger['info']('GetCampaignHopperHistory',_0xd5401b);logger[_0x14ef('0xf')](_0x14ef('0x44'),_0xd5401b,JSON[_0x14ef('0x12')](_0x1a3557));_0x5d6e4e(_0x1a3557);})[_0x14ef('0x17')](function(_0x26d34d){logger[_0x14ef('0x14')](_0x14ef('0x44'),_0x26d34d[_0x14ef('0x15')],_0xd5401b);_0x1ec7e8(_0x36c38f['error'](0x1f4,_0x26d34d[_0x14ef('0x15')]));});});}; \ No newline at end of file +var _0xd403=['debug','catch','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','campaign','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','CreateCmHopperHistory','CmHopperHistory','create','body','options'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xd403,0x1d5));var _0x3d40=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xd403[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var moment=require(_0x3d40('0x2'));var BPromise=require(_0x3d40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d40('0x5'));var logger=require(_0x3d40('0x6'))(_0x3d40('0x7'));var config=require(_0x3d40('0x8'));var jayson=require(_0x3d40('0x9'));var client=jayson[_0x3d40('0xa')][_0x3d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd5569,_0x14dc5b,_0x1f488d){return new BPromise(function(_0x210104,_0x266868){return client[_0x3d40('0xc')](_0xfd5569,_0x1f488d)[_0x3d40('0xd')](function(_0xd96d5e){logger[_0x3d40('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x14dc5b,_0x3d40('0xf'));logger['debug'](_0x3d40('0x10'),_0x14dc5b,_0x3d40('0xf'),JSON[_0x3d40('0x11')](_0xd96d5e));if(_0xd96d5e['error']){if(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x13')]===0x1f4){logger[_0x3d40('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x14dc5b,_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);return _0x266868(_0xd96d5e['error']['message']);}logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0xd96d5e[_0x3d40('0x12')]['message']);return _0x210104(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);}else{logger[_0x3d40('0xe')](_0x3d40('0x15'),_0x14dc5b,_0x3d40('0xf'));_0x210104(_0xd96d5e[_0x3d40('0x16')][_0x3d40('0x14')]);}})['catch'](function(_0x496dfd){logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0x496dfd);_0x266868(_0x496dfd);});});}exports[_0x3d40('0x17')]=function(_0x75437e){var _0x2f71a4=this;return new Promise(function(_0x2f3663,_0x1b9d99){return db[_0x3d40('0x18')][_0x3d40('0x19')](_0x75437e[_0x3d40('0x1a')],{'raw':_0x75437e[_0x3d40('0x1b')]?_0x75437e['options']['raw']===undefined?!![]:![]:!![]})[_0x3d40('0xd')](function(_0x41608f){logger[_0x3d40('0xe')](_0x3d40('0x17'),_0x75437e);logger[_0x3d40('0x1c')](_0x3d40('0x17'),_0x75437e,JSON[_0x3d40('0x11')](_0x41608f));_0x2f3663(_0x41608f);})[_0x3d40('0x1d')](function(_0x3df1f9){logger[_0x3d40('0x12')](_0x3d40('0x17'),_0x3df1f9[_0x3d40('0x14')],_0x75437e);_0x1b9d99(_0x2f71a4[_0x3d40('0x12')](0x1f4,_0x3df1f9['message']));});});};exports[_0x3d40('0x1e')]=function(_0x14cad3){var _0x33015d=this;return new Promise(function(_0x1341c1,_0x645da4){return db['CmHopperHistory'][_0x3d40('0x1f')]({'raw':_0x14cad3[_0x3d40('0x1b')]?_0x14cad3[_0x3d40('0x1b')][_0x3d40('0x20')]===undefined?!![]:![]:!![],'where':_0x14cad3[_0x3d40('0x1b')]?_0x14cad3['options'][_0x3d40('0x21')]||null:null,'attributes':[[db[_0x3d40('0x22')]['fn']('COUNT',db[_0x3d40('0x22')][_0x3d40('0x23')]('id')),_0x3d40('0x24')],[db['sequelize']['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')](_0x3d40('0x27')))),_0x3d40('0x28')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x3d40('0x26')](_0x3d40('0x29')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x3d40('0x22')]['fn']('COUNT',db[_0x3d40('0x22')]['fn']('IF',db['sequelize'][_0x3d40('0x26')](_0x3d40('0x2a')))),_0x3d40('0x2b')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x2c'),db['sequelize']['fn']('IF',db['sequelize'][_0x3d40('0x26')](_0x3d40('0x2d')))),_0x3d40('0x2e')],[db['sequelize']['fn'](_0x3d40('0x2c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3d40('0x2f')))),_0x3d40('0x30')]]})[_0x3d40('0xd')](function(_0x2d523b){logger[_0x3d40('0xe')](_0x3d40('0x1e'),_0x14cad3);logger[_0x3d40('0x1c')](_0x3d40('0x1e'),_0x14cad3,JSON[_0x3d40('0x11')](_0x2d523b));_0x1341c1(_0x2d523b);})['catch'](function(_0x55a276){logger[_0x3d40('0x12')](_0x3d40('0x1e'),_0x55a276[_0x3d40('0x14')],_0x14cad3);_0x645da4(_0x33015d[_0x3d40('0x12')](0x1f4,_0x55a276[_0x3d40('0x14')]));});});};exports[_0x3d40('0x31')]=function(_0x599ac8){var _0x416fe8=this;return new Promise(function(_0x250bb7,_0x3a7f39){return db['CmHopperHistory'][_0x3d40('0x1f')]({'raw':_0x599ac8['options']?_0x599ac8[_0x3d40('0x1b')][_0x3d40('0x20')]===undefined?!![]:![]:!![],'where':_0x599ac8['options']?_0x599ac8[_0x3d40('0x1b')]['where']||null:null,'attributes':[['campaign',_0x3d40('0x32')],[db[_0x3d40('0x22')]['fn']('COUNT',db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')]('`state`\x20=\x200,\x201,\x20null'))),_0x3d40('0x33')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')](_0x3d40('0x34')))),_0x3d40('0x35')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db['sequelize'][_0x3d40('0x26')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')]['literal'](_0x3d40('0x36')))),_0x3d40('0x37')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db['sequelize']['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')](_0x3d40('0x38')))),_0x3d40('0x39')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')](_0x3d40('0x3a')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')](_0x3d40('0x3b')))),_0x3d40('0x3c')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db['sequelize']['literal'](_0x3d40('0x3d')))),_0x3d40('0x3e')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db['sequelize'][_0x3d40('0x26')](_0x3d40('0x3f')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3d40('0x40')],[db['sequelize']['fn']('COUNT',db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')](_0x3d40('0x41')))),'outboundRejectCallsDay'],[db[_0x3d40('0x22')]['fn']('COUNT',db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x3d40('0x42')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x3d40('0x43')],[db[_0x3d40('0x22')]['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db[_0x3d40('0x22')][_0x3d40('0x26')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3d40('0x44')]],'group':[_0x3d40('0x45')]})[_0x3d40('0xd')](function(_0x10223d){logger[_0x3d40('0xe')](_0x3d40('0x31'),_0x599ac8);logger[_0x3d40('0x1c')](_0x3d40('0x31'),_0x599ac8,JSON[_0x3d40('0x11')](_0x10223d));_0x250bb7(_0x10223d);})[_0x3d40('0x1d')](function(_0x40eb86){logger[_0x3d40('0x12')](_0x3d40('0x31'),_0x40eb86[_0x3d40('0x14')],_0x599ac8);_0x3a7f39(_0x416fe8['error'](0x1f4,_0x40eb86['message']));});});};exports['GetCampaignHopperHistory']=function(_0x544869){var _0x538321=this;return new Promise(function(_0x20f2e4,_0x5468ea){return db[_0x3d40('0x18')][_0x3d40('0x1f')]({'raw':_0x544869['options']?_0x544869[_0x3d40('0x1b')][_0x3d40('0x20')]===undefined?!![]:![]:!![],'where':_0x544869['options']?_0x544869[_0x3d40('0x1b')][_0x3d40('0x21')]||null:null,'attributes':[[_0x3d40('0x45'),'name'],[db[_0x3d40('0x22')]['fn']('COUNT',db[_0x3d40('0x22')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3d40('0x25'),db[_0x3d40('0x22')]['fn']('IF',db['sequelize'][_0x3d40('0x26')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x3d40('0x45')]})['then'](function(_0x98c2d3){logger['info']('GetCampaignHopperHistory',_0x544869);logger[_0x3d40('0x1c')]('GetCampaignHopperHistory',_0x544869,JSON[_0x3d40('0x11')](_0x98c2d3));_0x20f2e4(_0x98c2d3);})[_0x3d40('0x1d')](function(_0x191447){logger[_0x3d40('0x12')](_0x3d40('0x46'),_0x191447['message'],_0x544869);_0x5468ea(_0x538321[_0x3d40('0x12')](0x1f4,_0x191447[_0x3d40('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c93b39c..360acf1 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 _0x2351=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','/:id'];(function(_0x48f2ca,_0x9c9128){var _0x50b14c=function(_0x16203f){while(--_0x16203f){_0x48f2ca['push'](_0x48f2ca['shift']());}};_0x50b14c(++_0x9c9128);}(_0x2351,0x144));var _0x1235=function(_0x1eb414,_0x3dc271){_0x1eb414=_0x1eb414-0x0;var _0x3cec69=_0x2351[_0x1eb414];return _0x3cec69;};'use strict';var multer=require('multer');var util=require(_0x1235('0x0'));var path=require(_0x1235('0x1'));var timeout=require(_0x1235('0x2'));var express=require('express');var router=express[_0x1235('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1235('0x4'));var interaction=require(_0x1235('0x5'));var config=require(_0x1235('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1235('0x7')]('/',auth['isAuthenticated'](),controller[_0x1235('0x8')]);router[_0x1235('0x7')](_0x1235('0x9'),auth[_0x1235('0xa')](),controller[_0x1235('0xb')]);router[_0x1235('0x7')]('/:id',auth[_0x1235('0xa')](),controller[_0x1235('0xc')]);router[_0x1235('0xd')]('/',auth[_0x1235('0xa')](),controller[_0x1235('0xe')]);router['put'](_0x1235('0xf'),auth[_0x1235('0xa')](),controller['update']);module[_0x1235('0x10')]=router; \ No newline at end of file +var _0x3e43=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0x3e43,0x1a4));var _0x33e4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3e43[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x33e4('0x0'));var path=require(_0x33e4('0x1'));var timeout=require('connect-timeout');var express=require(_0x33e4('0x2'));var router=express[_0x33e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x33e4('0x4'));var interaction=require(_0x33e4('0x5'));var config=require('../../config/environment');var controller=require(_0x33e4('0x6'));router[_0x33e4('0x7')]('/',auth[_0x33e4('0x8')](),controller[_0x33e4('0x9')]);router[_0x33e4('0x7')](_0x33e4('0xa'),auth['isAuthenticated'](),controller[_0x33e4('0xb')]);router[_0x33e4('0x7')](_0x33e4('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x33e4('0xd')]('/',auth[_0x33e4('0x8')](),controller['create']);router[_0x33e4('0xe')](_0x33e4('0xc'),auth[_0x33e4('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 76bdab3..83fff70 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 _0x50a6=['exports','STRING','sequelize'];(function(_0x299ea5,_0xe9ab75){var _0x51fed1=function(_0x2256aa){while(--_0x2256aa){_0x299ea5['push'](_0x299ea5['shift']());}};_0x51fed1(++_0xe9ab75);}(_0x50a6,0xa4));var _0x650a=function(_0x4aabc6,_0x348818){_0x4aabc6=_0x4aabc6-0x0;var _0xf26471=_0x50a6[_0x4aabc6];return _0xf26471;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x650a('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6732=['STRING','name','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'name':{'type':Sequelize[_0x2673('0x2')],'unique':_0x2673('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x2673('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2bf41bd..687d950 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 _0xfbbe=['update','then','destroy','UserProfileResource','error','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','CmList','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Lists','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','filter','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','errors','message','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','cf_%d','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xfbbe,0x187));var _0xefbb=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfbbe[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xefbb('0x0'));var rimraf=require(_0xefbb('0x1'));var zipdir=require(_0xefbb('0x2'));var jsonpatch=require(_0xefbb('0x3'));var rp=require(_0xefbb('0x4'));var moment=require('moment');var BPromise=require(_0xefbb('0x5'));var Mustache=require(_0xefbb('0x6'));var util=require(_0xefbb('0x7'));var path=require(_0xefbb('0x8'));var sox=require(_0xefbb('0x9'));var csv=require(_0xefbb('0xa'));var ejs=require(_0xefbb('0xb'));var fs=require('fs');var fs_extra=require(_0xefbb('0xc'));var _=require(_0xefbb('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xefbb('0xe'));var deskjs=require(_0xefbb('0xf'));var toCsv=require(_0xefbb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xefbb('0x10'));var authService=require(_0xefbb('0x11'));var qs=require(_0xefbb('0x12'));var as=require(_0xefbb('0x13'));var hardwareService=require(_0xefbb('0x14'));var logger=require(_0xefbb('0x15'))(_0xefbb('0x16'));var utils=require(_0xefbb('0x17'));var config=require(_0xefbb('0x18'));var licenseUtil=require(_0xefbb('0x19'));var db=require(_0xefbb('0x1a'))['db'];config[_0xefbb('0x1b')]=_[_0xefbb('0x1c')](config[_0xefbb('0x1b')],{'host':_0xefbb('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefbb('0x1b')]));require(_0xefbb('0x1e'))[_0xefbb('0x1f')](socket);function respondWithStatusCode(_0xf478b8,_0x45ebf2){_0x45ebf2=_0x45ebf2||0xcc;return function(_0x5d9073){if(_0x5d9073){return _0xf478b8[_0xefbb('0x20')](_0x45ebf2);}return _0xf478b8[_0xefbb('0x21')](_0x45ebf2)[_0xefbb('0x22')]();};}function respondWithResult(_0x100901,_0x519d5b){_0x519d5b=_0x519d5b||0xc8;return function(_0x6f8937){if(_0x6f8937){return _0x100901['status'](_0x519d5b)[_0xefbb('0x23')](_0x6f8937);}};}function respondWithFilteredResult(_0x52d6e2,_0x2ee528){return function(_0x47b5a0){if(_0x47b5a0){var _0x3c4241=typeof _0x2ee528['offset']==='undefined'&&typeof _0x2ee528[_0xefbb('0x24')]==='undefined';var _0x5da7b4=_0x47b5a0[_0xefbb('0x25')];var _0x13aecd=_0x3c4241?0x0:_0x2ee528[_0xefbb('0x26')];var _0x169726=_0x3c4241?_0x47b5a0[_0xefbb('0x25')]:_0x2ee528[_0xefbb('0x26')]+_0x2ee528[_0xefbb('0x24')];var _0x39d86b;if(_0x169726>=_0x5da7b4){_0x169726=_0x5da7b4;_0x39d86b=0xc8;}else{_0x39d86b=0xce;}_0x52d6e2['status'](_0x39d86b);return _0x52d6e2[_0xefbb('0x27')](_0xefbb('0x28'),_0x13aecd+'-'+_0x169726+'/'+_0x5da7b4)[_0xefbb('0x23')](_0x47b5a0);}return null;};}function patchUpdates(_0x5022ee){return function(_0x1b4543){try{jsonpatch[_0xefbb('0x29')](_0x1b4543,_0x5022ee,!![]);}catch(_0x1df894){return BPromise[_0xefbb('0x2a')](_0x1df894);}return _0x1b4543[_0xefbb('0x2b')]();};}function saveUpdates(_0xd8652f,_0x3e4e90){return function(_0xe30099){if(_0xe30099){return _0xe30099[_0xefbb('0x2c')](_0xd8652f)[_0xefbb('0x2d')](function(_0x468326){return _0x468326;});}return null;};}function removeEntity(_0x33af9e,_0x5ddece){return function(_0x12ef56){if(_0x12ef56){return _0x12ef56[_0xefbb('0x2e')]()[_0xefbb('0x2d')](function(){var _0x40dfbc=_0x12ef56['get']({'plain':!![]});var _0x3b1a3b='Lists';return db[_0xefbb('0x2f')]['destroy']({'where':{'type':_0x3b1a3b,'resourceId':_0x40dfbc['id']}})[_0xefbb('0x2d')](function(){return _0x12ef56;});})[_0xefbb('0x2d')](function(){_0x33af9e['status'](0xcc)[_0xefbb('0x22')]();});}};}function handleEntityNotFound(_0x268f0d,_0x290be7){return function(_0xe3326e){if(!_0xe3326e){_0x268f0d[_0xefbb('0x20')](0x194);}return _0xe3326e;};}function handleError(_0x3bc029,_0x31441c){_0x31441c=_0x31441c||0x1f4;return function(_0x4b2c3b){logger[_0xefbb('0x30')](_0x4b2c3b['stack']);if(_0x4b2c3b[_0xefbb('0x31')]){delete _0x4b2c3b[_0xefbb('0x31')];}_0x3bc029['status'](_0x31441c)[_0xefbb('0x32')](_0x4b2c3b);};}exports[_0xefbb('0x33')]=function(_0x20e22d,_0x15c897){var _0x5f1100={},_0x32a394={},_0x35e90e={'count':0x0,'rows':[]};var _0x31d059=_[_0xefbb('0x34')](db['CmList']['rawAttributes'],function(_0x5823d4){return{'name':_0x5823d4['fieldName'],'type':_0x5823d4[_0xefbb('0x35')][_0xefbb('0x36')]};});_0x32a394[_0xefbb('0x37')]=_[_0xefbb('0x34')](_0x31d059,_0xefbb('0x31'));_0x32a394[_0xefbb('0x38')]=_[_0xefbb('0x39')](_0x20e22d[_0xefbb('0x38')]);_0x32a394[_0xefbb('0x3a')]=_[_0xefbb('0x3b')](_0x32a394[_0xefbb('0x37')],_0x32a394[_0xefbb('0x38')]);_0x5f1100[_0xefbb('0x3c')]=_['intersection'](_0x32a394[_0xefbb('0x37')],qs[_0xefbb('0x3d')](_0x20e22d[_0xefbb('0x38')][_0xefbb('0x3d')]));_0x5f1100[_0xefbb('0x3c')]=_0x5f1100['attributes'][_0xefbb('0x3e')]?_0x5f1100[_0xefbb('0x3c')]:_0x32a394[_0xefbb('0x37')];if(!_0x20e22d[_0xefbb('0x38')][_0xefbb('0x3f')](_0xefbb('0x40'))){_0x5f1100[_0xefbb('0x24')]=qs[_0xefbb('0x24')](_0x20e22d[_0xefbb('0x38')][_0xefbb('0x24')]);_0x5f1100[_0xefbb('0x26')]=qs[_0xefbb('0x26')](_0x20e22d['query'][_0xefbb('0x26')]);}_0x5f1100[_0xefbb('0x41')]=qs[_0xefbb('0x42')](_0x20e22d[_0xefbb('0x38')][_0xefbb('0x42')]);_0x5f1100[_0xefbb('0x43')]=qs['filters'](_[_0xefbb('0x44')](_0x20e22d['query'],_0x32a394[_0xefbb('0x3a')]),_0x31d059);if(_0x20e22d['query']['filter']){_0x5f1100[_0xefbb('0x43')]=_['merge'](_0x5f1100['where'],{'$or':_['map'](_0x31d059,function(_0x4226b3){if(_0x4226b3[_0xefbb('0x35')]!==_0xefbb('0x45')){var _0x1bf920={};_0x1bf920[_0x4226b3[_0xefbb('0x31')]]={'$like':'%'+_0x20e22d[_0xefbb('0x38')]['filter']+'%'};return _0x1bf920;}})});}_0x5f1100=_[_0xefbb('0x46')]({},_0x5f1100,_0x20e22d[_0xefbb('0x47')]);var _0x2590b1={'where':_0x5f1100[_0xefbb('0x43')]};return db[_0xefbb('0x48')][_0xefbb('0x25')](_0x2590b1)[_0xefbb('0x2d')](function(_0x5910eb){_0x35e90e[_0xefbb('0x25')]=_0x5910eb;if(_0x20e22d[_0xefbb('0x38')][_0xefbb('0x49')]){_0x5f1100[_0xefbb('0x4a')]=[{'all':!![]}];}return db[_0xefbb('0x48')][_0xefbb('0x4b')](_0x5f1100);})[_0xefbb('0x2d')](function(_0x2d69f0){_0x35e90e[_0xefbb('0x4c')]=_0x2d69f0;return _0x35e90e;})['then'](respondWithFilteredResult(_0x15c897,_0x5f1100))[_0xefbb('0x4d')](handleError(_0x15c897,null));};exports['show']=function(_0x46d15f,_0x41518d){var _0x46ea86={'raw':![],'where':{'id':_0x46d15f[_0xefbb('0x4e')]['id']}},_0x23737a={};_0x23737a[_0xefbb('0x37')]=_[_0xefbb('0x39')](db['CmList'][_0xefbb('0x4f')]);_0x23737a[_0xefbb('0x38')]=_['keys'](_0x46d15f['query']);_0x23737a['filters']=_[_0xefbb('0x3b')](_0x23737a['model'],_0x23737a['query']);_0x46ea86[_0xefbb('0x3c')]=_['intersection'](_0x23737a['model'],qs['fields'](_0x46d15f[_0xefbb('0x38')][_0xefbb('0x3d')]));_0x46ea86[_0xefbb('0x3c')]=_0x46ea86['attributes'][_0xefbb('0x3e')]?_0x46ea86[_0xefbb('0x3c')]:_0x23737a[_0xefbb('0x37')];if(_0x46d15f[_0xefbb('0x38')]['includeAll']){_0x46ea86[_0xefbb('0x4a')]=[{'all':!![]}];}_0x46ea86=_[_0xefbb('0x46')]({},_0x46ea86,_0x46d15f[_0xefbb('0x47')]);return db[_0xefbb('0x48')]['find'](_0x46ea86)['then'](handleEntityNotFound(_0x41518d,null))[_0xefbb('0x2d')](respondWithResult(_0x41518d,null))[_0xefbb('0x4d')](handleError(_0x41518d,null));};exports[_0xefbb('0x50')]=function(_0x5f1382,_0x5a249e){return db[_0xefbb('0x48')][_0xefbb('0x50')](_0x5f1382[_0xefbb('0x51')],{})[_0xefbb('0x2d')](function(_0x53b3d2){var _0x3092fd=_0x5f1382[_0xefbb('0x52')]['get']({'plain':!![]});if(!_0x3092fd)throw new Error(_0xefbb('0x53'));if(_0x3092fd['role']===_0xefbb('0x52')){var _0x321f1b=_0x53b3d2[_0xefbb('0x54')]({'plain':!![]});var _0x50fc37=_0xefbb('0x55');return db[_0xefbb('0x56')][_0xefbb('0x57')]({'where':{'name':_0x50fc37,'userProfileId':_0x3092fd[_0xefbb('0x58')]},'raw':!![]})['then'](function(_0x42328f){if(_0x42328f&&_0x42328f['autoAssociation']===0x0){return db[_0xefbb('0x2f')]['create']({'name':_0x321f1b[_0xefbb('0x31')],'resourceId':_0x321f1b['id'],'type':_0x42328f['name'],'sectionId':_0x42328f['id']},{})[_0xefbb('0x2d')](function(){return _0x53b3d2;});}else{return _0x53b3d2;}})[_0xefbb('0x4d')](function(_0x29c242){logger[_0xefbb('0x30')](_0xefbb('0x59'),_0x29c242);throw _0x29c242;});}return _0x53b3d2;})[_0xefbb('0x2d')](respondWithResult(_0x5a249e,0xc9))[_0xefbb('0x4d')](handleError(_0x5a249e,null));};exports[_0xefbb('0x2c')]=function(_0x4792d9,_0x40893a){if(_0x4792d9['body']['id']){delete _0x4792d9[_0xefbb('0x51')]['id'];}return db['CmList'][_0xefbb('0x57')]({'where':{'id':_0x4792d9[_0xefbb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x40893a,null))['then'](saveUpdates(_0x4792d9['body'],null))[_0xefbb('0x2d')](respondWithResult(_0x40893a,null))[_0xefbb('0x4d')](handleError(_0x40893a,null));};exports[_0xefbb('0x2e')]=function(_0xd27863,_0x585be0){return db['CmList'][_0xefbb('0x57')]({'where':{'id':_0xd27863['params']['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x585be0,null))[_0xefbb('0x2d')](removeEntity(_0x585be0,null))[_0xefbb('0x4d')](handleError(_0x585be0,null));};exports['describe']=function(_0xf6f39e,_0x240e3c){return db[_0xefbb('0x48')][_0xefbb('0x5a')]()[_0xefbb('0x2d')](respondWithResult(_0x240e3c,null))[_0xefbb('0x4d')](handleError(_0x240e3c,null));};exports['addDisposition']=function(_0x4625c6,_0x1bda26,_0x39be7b){if(_0x4625c6[_0xefbb('0x51')]['id']){delete _0x4625c6['body']['id'];}return db[_0xefbb('0x48')][_0xefbb('0x57')]({'where':{'id':_0x4625c6[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x1bda26,null))[_0xefbb('0x2d')](function(_0x3b320c){if(_0x3b320c){_0x4625c6[_0xefbb('0x51')][_0xefbb('0x5b')]=_0x3b320c['id'];return db[_0xefbb('0x5c')]['create'](_0x4625c6[_0xefbb('0x51')]);}})[_0xefbb('0x2d')](respondWithResult(_0x1bda26,null))['catch'](handleError(_0x1bda26,null));};exports[_0xefbb('0x5d')]=function(_0x4dff71,_0x2b276b,_0x10782e){var _0x4ea5df={'raw':![],'where':{}};var _0x101ba7={};var _0x1c0a3a={'count':0x0,'rows':[]};return db[_0xefbb('0x48')]['findOne']({'where':{'id':_0x4dff71[_0xefbb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b276b,null))['then'](function(_0x5f29ed){if(_0x5f29ed){_0x101ba7['model']=_[_0xefbb('0x39')](db['Disposition'][_0xefbb('0x4f')]);_0x101ba7[_0xefbb('0x38')]=_[_0xefbb('0x39')](_0x4dff71[_0xefbb('0x38')]);_0x101ba7['filters']=_[_0xefbb('0x3b')](_0x101ba7[_0xefbb('0x37')],_0x101ba7[_0xefbb('0x38')]);_0x4ea5df[_0xefbb('0x3c')]=_['intersection'](_0x101ba7['model'],qs[_0xefbb('0x3d')](_0x4dff71[_0xefbb('0x38')]['fields']));_0x4ea5df[_0xefbb('0x3c')]=_0x4ea5df[_0xefbb('0x3c')]['length']?_0x4ea5df['attributes']:_0x101ba7[_0xefbb('0x37')];if(!_0x4dff71['query'][_0xefbb('0x3f')](_0xefbb('0x40'))){_0x4ea5df['limit']=qs[_0xefbb('0x24')](_0x4dff71[_0xefbb('0x38')][_0xefbb('0x24')]);_0x4ea5df[_0xefbb('0x26')]=qs['offset'](_0x4dff71['query'][_0xefbb('0x26')]);}_0x4ea5df['order']=qs['sort'](_0x4dff71['query']['sort']);_0x4ea5df[_0xefbb('0x43')]=qs[_0xefbb('0x3a')](_['pick'](_0x4dff71[_0xefbb('0x38')],_0x101ba7['filters']));_0x4ea5df[_0xefbb('0x43')][_0xefbb('0x5b')]=_0x5f29ed['id'];if(_0x4dff71[_0xefbb('0x38')][_0xefbb('0x5e')]){_0x4ea5df['where']=_['merge'](_0x4ea5df[_0xefbb('0x43')],{'$or':_[_0xefbb('0x34')](_0x4ea5df['attributes'],function(_0x469006){var _0x4f8c7f={};_0x4f8c7f[_0x469006]={'$like':'%'+_0x4dff71[_0xefbb('0x38')][_0xefbb('0x5e')]+'%'};return _0x4f8c7f;})});}_0x4ea5df=_[_0xefbb('0x46')]({},_0x4ea5df,_0x4dff71['options']);return db[_0xefbb('0x5c')]['count']({'where':_0x4ea5df['where']})['then'](function(_0xc18391){_0x1c0a3a[_0xefbb('0x25')]=_0xc18391;if(_0x4dff71[_0xefbb('0x38')][_0xefbb('0x49')]){_0x4ea5df[_0xefbb('0x4a')]=[{'all':!![]}];}return db[_0xefbb('0x5c')][_0xefbb('0x4b')](_0x4ea5df);})[_0xefbb('0x2d')](function(_0x328a48){_0x1c0a3a[_0xefbb('0x4c')]=_0x328a48;return _0x1c0a3a;});}})[_0xefbb('0x2d')](respondWithFilteredResult(_0x2b276b,_0x4ea5df))['catch'](handleError(_0x2b276b,null));};exports[_0xefbb('0x5f')]=function(_0x2715ca,_0x7984f6,_0x1c6b87){return db[_0xefbb('0x48')][_0xefbb('0x57')]({'where':{'id':_0x2715ca[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x7984f6,null))[_0xefbb('0x2d')](function(_0x523747){if(_0x523747){return _0x523747[_0xefbb('0x5f')](_0x2715ca[_0xefbb('0x38')][_0xefbb('0x60')]);}})[_0xefbb('0x2d')](respondWithStatusCode(_0x7984f6,null))[_0xefbb('0x4d')](handleError(_0x7984f6,null));};exports[_0xefbb('0x61')]=function(_0x1a158d,_0x41d2d6,_0x8ca4bf){return db[_0xefbb('0x48')][_0xefbb('0x57')]({'where':{'id':_0x1a158d['params']['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x41d2d6,null))['then'](function(_0x5b4552){if(_0x5b4552){var _0x20ea31=[];var _0x52281e={'success':[],'errors':[]};return db[_0xefbb('0x62')][_0xefbb('0x5a')]()['then'](function(_0x37bfb3){if(_0x1a158d[_0xefbb('0x51')][_0xefbb('0x63')]&&_[_0xefbb('0x64')](_0x1a158d[_0xefbb('0x51')][_0xefbb('0x63')])){if(_0x1a158d[_0xefbb('0x51')]['tags'][_0xefbb('0x3e')]){_0x1a158d[_0xefbb('0x51')][_0xefbb('0x63')]=_0x1a158d[_0xefbb('0x51')][_0xefbb('0x63')][_0xefbb('0x65')](';')+';';}else{_0x1a158d['body']['tags']=null;}}else{_0x1a158d[_0xefbb('0x51')][_0xefbb('0x63')]=null;}if(_0x1a158d[_0xefbb('0x51')]&&_[_0xefbb('0x64')](_0x1a158d[_0xefbb('0x51')])){for(var _0x3948bc=0x0;_0x3948bc<_0x1a158d[_0xefbb('0x51')][_0xefbb('0x3e')];_0x3948bc+=0x1){_0x1a158d[_0xefbb('0x51')][_0x3948bc]['ListId']=_0x1a158d[_0xefbb('0x4e')]['id'];_0x20ea31[_0xefbb('0x66')](_0x1a158d[_0xefbb('0x51')][_0x3948bc]);}return BPromise[_0xefbb('0x67')](_0x20ea31,function(_0x5ef192){return db[_0xefbb('0x62')][_0xefbb('0x50')](_[_0xefbb('0x68')](_0x5ef192,['ids','id'])||{},{'fields':_['keys'](_0x37bfb3),'raw':!![]})[_0xefbb('0x2d')](function(_0x229b7d){_0x52281e[_0xefbb('0x69')][_0xefbb('0x66')](_0x229b7d['dataValues']);})[_0xefbb('0x4d')](function(_0x39c901){_0x52281e[_0xefbb('0x6a')][_0xefbb('0x66')]({'data':_0x5ef192,'error':_0x39c901[_0xefbb('0x6b')]});});})[_0xefbb('0x2d')](function(_0x4e0a15){return _0x52281e;})[_0xefbb('0x4d')](function(_0x4f3c31){return _0x4f3c31;});}else{_0x41d2d6[_0xefbb('0x21')](0x190)[_0xefbb('0x23')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xefbb('0x2d')](respondWithResult(_0x41d2d6,null))[_0xefbb('0x4d')](handleError(_0x41d2d6,null));};exports[_0xefbb('0x6c')]=function(_0x53131e,_0x14e7d8,_0x2c9d4b){var _0x4e23eb;return db[_0xefbb('0x48')][_0xefbb('0x57')]({'where':{'id':_0x53131e[_0xefbb('0x4e')]['id']},'include':[{'model':db[_0xefbb('0x6d')],'as':_0xefbb('0x6e')}]})[_0xefbb('0x2d')](handleEntityNotFound(_0x14e7d8,null))[_0xefbb('0x2d')](function(_0x53464b){if(_0x53464b){_0x4e23eb=_0x53464b;return db['CmContact'][_0xefbb('0x4f')];}})[_0xefbb('0x2d')](function(_0x43b1bb){if(_0x43b1bb){var _0x11ad8b={};var _0x26aee1={};_0x26aee1[_0xefbb('0x37')]=_[_0xefbb('0x6f')](_[_0xefbb('0x39')](_0x43b1bb),_[_0xefbb('0x34')](_0x4e23eb[_0xefbb('0x6e')],function(_0x4818ec){return util[_0xefbb('0x70')]('cf_%d',_0x4818ec['id']);}));_0x26aee1[_0xefbb('0x38')]=_[_0xefbb('0x39')](_0x53131e[_0xefbb('0x38')]);_0x26aee1[_0xefbb('0x3a')]=_[_0xefbb('0x3b')](_0x26aee1[_0xefbb('0x37')],_0x26aee1['query']);_0x11ad8b[_0xefbb('0x3c')]=_['intersection'](_0x26aee1[_0xefbb('0x37')],qs['fields'](_0x53131e['query'][_0xefbb('0x3d')]));_0x11ad8b['attributes']=_0x11ad8b[_0xefbb('0x3c')][_0xefbb('0x3e')]?_0x11ad8b[_0xefbb('0x3c')]:_0x26aee1[_0xefbb('0x37')];if(!_0x53131e[_0xefbb('0x38')][_0xefbb('0x3f')](_0xefbb('0x40'))){_0x11ad8b[_0xefbb('0x24')]=qs['limit'](_0x53131e[_0xefbb('0x38')][_0xefbb('0x24')]);_0x11ad8b[_0xefbb('0x26')]=qs['offset'](_0x53131e[_0xefbb('0x38')]['offset']);}_0x11ad8b['order']=qs[_0xefbb('0x42')](_0x53131e[_0xefbb('0x38')][_0xefbb('0x42')]);_0x11ad8b[_0xefbb('0x43')]=qs['filters'](_[_0xefbb('0x44')](_0x53131e[_0xefbb('0x38')],_0x26aee1[_0xefbb('0x3a')]));_0x11ad8b[_0xefbb('0x71')]=!![];if(_0x53131e[_0xefbb('0x38')][_0xefbb('0x5e')]){_0x11ad8b[_0xefbb('0x43')]=_[_0xefbb('0x46')](_0x11ad8b[_0xefbb('0x43')],{'$or':_[_0xefbb('0x34')](_0x11ad8b[_0xefbb('0x3c')],function(_0x2e8654){var _0x22a142={};_0x22a142[_0x2e8654]={'$like':'%'+_0x53131e[_0xefbb('0x38')][_0xefbb('0x5e')]+'%'};return _0x22a142;})});}_0x11ad8b=_[_0xefbb('0x46')]({},_0x11ad8b,_0x53131e[_0xefbb('0x47')]);return _0x4e23eb[_0xefbb('0x6c')](_0x11ad8b);}})[_0xefbb('0x2d')](respondWithResult(_0x14e7d8,null))[_0xefbb('0x4d')](handleError(_0x14e7d8,null));};exports[_0xefbb('0x72')]=function(_0x12a9dc,_0xa73c20,_0x395b95){var _0x442b66;return db['CmList'][_0xefbb('0x57')]({'where':{'id':_0x12a9dc[_0xefbb('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xefbb('0x2d')](handleEntityNotFound(_0xa73c20,null))[_0xefbb('0x2d')](function(_0x4c76f4){if(_0x4c76f4){_0x442b66=_0x4c76f4;return db[_0xefbb('0x62')][_0xefbb('0x4f')];}})[_0xefbb('0x2d')](function(_0x4d93e6){if(_0x4d93e6){var _0x5a11d1={};var _0x11122f={};_0x11122f[_0xefbb('0x37')]=_[_0xefbb('0x6f')](_[_0xefbb('0x39')](_0x4d93e6),_[_0xefbb('0x34')](_0x442b66[_0xefbb('0x6e')],function(_0x1f828d){return util[_0xefbb('0x70')](_0xefbb('0x73'),_0x1f828d['id']);}));_0x11122f['query']=_[_0xefbb('0x39')](_0x12a9dc[_0xefbb('0x38')]);_0x11122f[_0xefbb('0x3a')]=_[_0xefbb('0x3b')](_0x11122f['model'],_0x11122f['query']);_0x5a11d1[_0xefbb('0x3c')]=_[_0xefbb('0x3b')](_0x11122f[_0xefbb('0x37')],qs[_0xefbb('0x3d')](_0x12a9dc[_0xefbb('0x38')][_0xefbb('0x3d')]));_0x5a11d1[_0xefbb('0x3c')]=_0x5a11d1[_0xefbb('0x3c')][_0xefbb('0x3e')]?_0x5a11d1[_0xefbb('0x3c')]:_0x11122f['model'];if(!_0x12a9dc[_0xefbb('0x38')]['hasOwnProperty'](_0xefbb('0x40'))){_0x5a11d1[_0xefbb('0x24')]=qs[_0xefbb('0x24')](_0x12a9dc[_0xefbb('0x38')]['limit']);_0x5a11d1[_0xefbb('0x26')]=qs[_0xefbb('0x26')](_0x12a9dc['query'][_0xefbb('0x26')]);}_0x5a11d1['order']=qs[_0xefbb('0x42')](_0x12a9dc['query'][_0xefbb('0x42')]);_0x5a11d1[_0xefbb('0x43')]=qs['filters'](_['pick'](_0x12a9dc['query'],_0x11122f[_0xefbb('0x3a')]));_0x5a11d1['raw']=!![];if(_0x12a9dc[_0xefbb('0x38')][_0xefbb('0x5e')]){_0x5a11d1[_0xefbb('0x43')]=_[_0xefbb('0x46')](_0x5a11d1[_0xefbb('0x43')],{'$or':_[_0xefbb('0x34')](_0x5a11d1[_0xefbb('0x3c')],function(_0x259e4a){var _0xc374dd={};_0xc374dd[_0x259e4a]={'$like':'%'+_0x12a9dc[_0xefbb('0x38')]['filter']+'%'};return _0xc374dd;})});}_0x5a11d1=_[_0xefbb('0x46')]({},_0x5a11d1,_0x12a9dc[_0xefbb('0x47')]);return _0x442b66[_0xefbb('0x6c')](_0x5a11d1);}})[_0xefbb('0x2d')](function(_0x310f06){if(!_[_0xefbb('0x74')](_0x310f06)){var _0x3bfcd3=toCsv(_0x310f06);var _0x50d5b6=Date['now']();fs[_0xefbb('0x75')](util['format'](_0xefbb('0x76'),_0x442b66['id'],_0x50d5b6),_0x3bfcd3);_0xa73c20[_0xefbb('0x77')](_0xefbb('0x78'),_0xefbb('0x79')+util[_0xefbb('0x70')](_0xefbb('0x7a'),_0x442b66['id'],_0x50d5b6));_0xa73c20[_0xefbb('0x77')]('Content-type','text/csv');return _0xa73c20['download'](util[_0xefbb('0x70')]('/tmp/list_%d_%s.csv',_0x442b66['id'],_0x50d5b6));}else{return _0xa73c20['sendStatus'](0xcc);}})['catch'](handleError(_0xa73c20,null));};exports[_0xefbb('0x7b')]=function(_0x47fadf,_0x4b9083,_0x10c160){var _0x354819;delete _0x47fadf['body']['id'];return db['CmList'][_0xefbb('0x7c')]({'where':{'id':_0x47fadf[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x4b9083,null))['then'](function(_0x524752){if(_0x524752){return db[_0xefbb('0x7d')][_0xefbb('0x7e')](function(_0x50fefb){return db[_0xefbb('0x6d')][_0xefbb('0x50')](_0x47fadf[_0xefbb('0x51')],{'transaction':_0x50fefb})[_0xefbb('0x2d')](function(_0x7645f4){_0x354819=_0x7645f4;return _0x524752[_0xefbb('0x7f')](_0x7645f4,{'transaction':_0x50fefb});})[_0xefbb('0x2d')](function(){var _0x1fcd6a={'type':db['Sequelize']['TEXT'],'transaction':_0x50fefb};switch(_0x47fadf[_0xefbb('0x51')][_0xefbb('0x35')]){case'text':_0x1fcd6a[_0xefbb('0x35')]=db[_0xefbb('0x80')][_0xefbb('0x81')];break;case _0xefbb('0x82'):_0x1fcd6a[_0xefbb('0x35')]=db[_0xefbb('0x80')][_0xefbb('0x83')];break;case _0xefbb('0x84'):_0x1fcd6a[_0xefbb('0x35')]=db[_0xefbb('0x80')]['BOOLEAN'];_0x1fcd6a[_0xefbb('0x85')]=![];break;default:}return db[_0xefbb('0x7d')][_0xefbb('0x86')]['addColumn']('cm_contacts',util['format'](_0xefbb('0x87'),_0x354819['id']),_0x1fcd6a);})[_0xefbb('0x2d')](function(){return _0x354819;});});}})[_0xefbb('0x2d')](respondWithResult(_0x4b9083,null))[_0xefbb('0x4d')](handleError(_0x4b9083,null));};exports[_0xefbb('0x88')]=function(_0x42943d,_0x486568,_0x5db8dc){var _0x29acb9={};var _0x1c39fb={};var _0x413529;var _0x4086cb;return db[_0xefbb('0x48')][_0xefbb('0x7c')]({'where':{'id':_0x42943d[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x486568,null))['then'](function(_0x1e4125){if(_0x1e4125){_0x413529=_0x1e4125;_0x1c39fb[_0xefbb('0x37')]=_['keys'](db['CmCustomField'][_0xefbb('0x4f')]);_0x1c39fb[_0xefbb('0x38')]=_[_0xefbb('0x39')](_0x42943d[_0xefbb('0x38')]);_0x1c39fb[_0xefbb('0x3a')]=_[_0xefbb('0x3b')](_0x1c39fb[_0xefbb('0x37')],_0x1c39fb[_0xefbb('0x38')]);_0x29acb9['attributes']=_['intersection'](_0x1c39fb['model'],qs['fields'](_0x42943d[_0xefbb('0x38')][_0xefbb('0x3d')]));_0x29acb9[_0xefbb('0x3c')]=_0x29acb9['attributes']['length']?_0x29acb9['attributes']:_0x1c39fb[_0xefbb('0x37')];_0x29acb9[_0xefbb('0x41')]=qs[_0xefbb('0x42')](_0x42943d[_0xefbb('0x38')][_0xefbb('0x42')]);_0x29acb9[_0xefbb('0x43')]=qs[_0xefbb('0x3a')](_[_0xefbb('0x44')](_0x42943d[_0xefbb('0x38')],_0x1c39fb[_0xefbb('0x3a')]));_0x29acb9['where']=_[_0xefbb('0x46')](_0x29acb9['where'],{'$or':[{'ListId':_0x1e4125['id']},{'ListId':null}]});if(_0x42943d[_0xefbb('0x38')][_0xefbb('0x5e')]){_0x29acb9[_0xefbb('0x43')]=_['merge'](_0x29acb9[_0xefbb('0x43')],{'$or':_[_0xefbb('0x34')](_0x29acb9['attributes'],function(_0x1317da){var _0x5992aa={};_0x5992aa[_0x1317da]={'$like':'%'+_0x42943d['query'][_0xefbb('0x5e')]+'%'};return _0x5992aa;})});}_0x29acb9=_[_0xefbb('0x46')]({},_0x29acb9,_0x42943d['options']);return db[_0xefbb('0x6d')][_0xefbb('0x89')](_0x29acb9);}})[_0xefbb('0x2d')](respondWithResult(_0x486568,null))['catch'](handleError(_0x486568,null));};exports['addAgents']=function(_0x4ddec2,_0x4f87e1,_0x1a131b){return db[_0xefbb('0x48')][_0xefbb('0x57')]({'where':{'id':_0x4ddec2[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x4f87e1,null))[_0xefbb('0x2d')](function(_0x499cb3){if(_0x499cb3){return _0x499cb3[_0xefbb('0x8a')](_0x4ddec2[_0xefbb('0x51')]['ids'],_[_0xefbb('0x68')](_0x4ddec2[_0xefbb('0x51')],['ids','id'])||{})['spread'](function(_0x55ac0b){for(var _0x53d91d=0x0;_0x53d91d<_0x4ddec2[_0xefbb('0x51')][_0xefbb('0x60')]['length'];_0x53d91d+=0x1){socket[_0xefbb('0x8b')](_0xefbb('0x8c'),{'UserId':Number(_0x4ddec2[_0xefbb('0x51')][_0xefbb('0x60')][_0x53d91d]),'CmListId':Number(_0x4ddec2['params']['id'])});}return _0x55ac0b;});}})['then'](respondWithResult(_0x4f87e1,null))[_0xefbb('0x4d')](handleError(_0x4f87e1,null));};exports['removeAgents']=function(_0x3d9096,_0x5a9eb2,_0x3ad5d7){return db[_0xefbb('0x48')]['find']({'where':{'id':_0x3d9096[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x5a9eb2,null))['then'](function(_0x4c4a56){if(_0x4c4a56){return _0x4c4a56[_0xefbb('0x8d')](_0x3d9096[_0xefbb('0x38')][_0xefbb('0x60')])['then'](function(){if(_[_0xefbb('0x64')](_0x3d9096[_0xefbb('0x38')]['ids'])){for(var _0x508996=0x0;_0x508996<_0x3d9096['query'][_0xefbb('0x60')][_0xefbb('0x3e')];_0x508996+=0x1){socket[_0xefbb('0x8b')](_0xefbb('0x8e'),{'UserId':Number(_0x3d9096['query'][_0xefbb('0x60')][_0x508996]),'CmListId':Number(_0x3d9096[_0xefbb('0x4e')]['id'])});}}else{socket[_0xefbb('0x8b')](_0xefbb('0x8e'),{'UserId':Number(_0x3d9096['query']['ids']),'CmListId':Number(_0x3d9096[_0xefbb('0x4e')]['id'])});}});}})[_0xefbb('0x2d')](respondWithStatusCode(_0x5a9eb2,null))['catch'](handleError(_0x5a9eb2,null));};exports[_0xefbb('0x8f')]=function(_0x98e4f5,_0x2df150,_0x5134c7){var _0x162a07={};var _0x5512e5={};var _0x868287;var _0x4bc557;return db[_0xefbb('0x48')][_0xefbb('0x7c')]({'where':{'id':_0x98e4f5[_0xefbb('0x4e')]['id']}})[_0xefbb('0x2d')](handleEntityNotFound(_0x2df150,null))[_0xefbb('0x2d')](function(_0x3ce108){if(_0x3ce108){_0x868287=_0x3ce108;_0x5512e5[_0xefbb('0x37')]=_[_0xefbb('0x39')](db[_0xefbb('0x90')][_0xefbb('0x4f')]);_0x5512e5[_0xefbb('0x38')]=_['keys'](_0x98e4f5['query']);_0x5512e5[_0xefbb('0x3a')]=_['intersection'](_0x5512e5[_0xefbb('0x37')],_0x5512e5[_0xefbb('0x38')]);_0x162a07['attributes']=_[_0xefbb('0x3b')](_0x5512e5[_0xefbb('0x37')],qs[_0xefbb('0x3d')](_0x98e4f5[_0xefbb('0x38')][_0xefbb('0x3d')]));_0x162a07[_0xefbb('0x3c')]=_0x162a07[_0xefbb('0x3c')]['length']?_0x162a07['attributes']:_0x5512e5[_0xefbb('0x37')];_0x162a07[_0xefbb('0x41')]=qs['sort'](_0x98e4f5[_0xefbb('0x38')][_0xefbb('0x42')]);_0x162a07[_0xefbb('0x43')]=qs[_0xefbb('0x3a')](_[_0xefbb('0x44')](_0x98e4f5[_0xefbb('0x38')],_0x5512e5['filters']));if(_0x98e4f5['query']['filter']){_0x162a07['where']=_[_0xefbb('0x46')](_0x162a07[_0xefbb('0x43')],{'$or':_[_0xefbb('0x34')](_0x162a07[_0xefbb('0x3c')],function(_0x751536){var _0xeb09dc={};_0xeb09dc[_0x751536]={'$like':'%'+_0x98e4f5[_0xefbb('0x38')][_0xefbb('0x5e')]+'%'};return _0xeb09dc;})});}_0x162a07=_[_0xefbb('0x46')]({},_0x162a07,_0x98e4f5['options']);return _0x868287['getAgents'](_0x162a07);}})[_0xefbb('0x2d')](function(_0x161036){if(_0x161036){_0x4bc557=_0x161036[_0xefbb('0x3e')];if(!_0x98e4f5['query'][_0xefbb('0x3f')](_0xefbb('0x40'))){_0x162a07[_0xefbb('0x24')]=qs[_0xefbb('0x24')](_0x98e4f5['query'][_0xefbb('0x24')]);_0x162a07[_0xefbb('0x26')]=qs[_0xefbb('0x26')](_0x98e4f5['query'][_0xefbb('0x26')]);}return _0x868287['getAgents'](_0x162a07);}})[_0xefbb('0x2d')](function(_0x36d109){if(_0x36d109){return _0x36d109?{'count':_0x4bc557,'rows':_0x36d109}:null;}})[_0xefbb('0x2d')](respondWithResult(_0x2df150,null))['catch'](handleError(_0x2df150,null));}; \ No newline at end of file +var _0xd851=['getContactsCsv','cf_%d','raw','isEmpty','now','format','setHeader','Content-disposition','Content-type','text/csv','/tmp/list_%d_%s.csv','findOne','sequelize','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','destroy','then','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','fieldName','type','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','getDispositions','rawAttributes','hasOwnProperty','include','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','omit','ids','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat'];(function(_0x37c240,_0x2208b3){var _0x20c941=function(_0x269c8b){while(--_0x269c8b){_0x37c240['push'](_0x37c240['shift']());}};_0x20c941(++_0x2208b3);}(_0xd851,0x148));var _0x1d85=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xd851[_0x2a56ad];return _0x425175;};'use strict';var emlformat=require(_0x1d85('0x0'));var rimraf=require(_0x1d85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d85('0x2'));var moment=require(_0x1d85('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1d85('0x4'));var util=require('util');var path=require(_0x1d85('0x5'));var sox=require(_0x1d85('0x6'));var csv=require(_0x1d85('0x7'));var ejs=require(_0x1d85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d85('0x9'));var squel=require(_0x1d85('0xa'));var crypto=require(_0x1d85('0xb'));var jsforce=require(_0x1d85('0xc'));var deskjs=require(_0x1d85('0xd'));var toCsv=require(_0x1d85('0x7'));var querystring=require(_0x1d85('0xe'));var Papa=require(_0x1d85('0xf'));var Redis=require(_0x1d85('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1d85('0x11'));var hardwareService=require(_0x1d85('0x12'));var logger=require(_0x1d85('0x13'))(_0x1d85('0x14'));var utils=require(_0x1d85('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1d85('0x16'));var db=require(_0x1d85('0x17'))['db'];config[_0x1d85('0x18')]=_[_0x1d85('0x19')](config[_0x1d85('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d85('0x1a'))(new Redis(config[_0x1d85('0x18')]));require(_0x1d85('0x1b'))['register'](socket);function respondWithStatusCode(_0x1cd936,_0x591716){_0x591716=_0x591716||0xcc;return function(_0xec68c1){if(_0xec68c1){return _0x1cd936['sendStatus'](_0x591716);}return _0x1cd936[_0x1d85('0x1c')](_0x591716)[_0x1d85('0x1d')]();};}function respondWithResult(_0x462129,_0x276ef2){_0x276ef2=_0x276ef2||0xc8;return function(_0x10269d){if(_0x10269d){return _0x462129['status'](_0x276ef2)[_0x1d85('0x1e')](_0x10269d);}};}function respondWithFilteredResult(_0x1cd315,_0x3261f8){return function(_0x13ac67){if(_0x13ac67){var _0x3a0c17=typeof _0x3261f8['offset']===_0x1d85('0x1f')&&typeof _0x3261f8[_0x1d85('0x20')]===_0x1d85('0x1f');var _0x2b658e=_0x13ac67[_0x1d85('0x21')];var _0x576abc=_0x3a0c17?0x0:_0x3261f8[_0x1d85('0x22')];var _0x3068d5=_0x3a0c17?_0x13ac67[_0x1d85('0x21')]:_0x3261f8[_0x1d85('0x22')]+_0x3261f8[_0x1d85('0x20')];var _0x11d60f;if(_0x3068d5>=_0x2b658e){_0x3068d5=_0x2b658e;_0x11d60f=0xc8;}else{_0x11d60f=0xce;}_0x1cd315[_0x1d85('0x1c')](_0x11d60f);return _0x1cd315[_0x1d85('0x23')](_0x1d85('0x24'),_0x576abc+'-'+_0x3068d5+'/'+_0x2b658e)[_0x1d85('0x1e')](_0x13ac67);}return null;};}function patchUpdates(_0x132062){return function(_0x513fbe){try{jsonpatch['apply'](_0x513fbe,_0x132062,!![]);}catch(_0x51af9d){return BPromise[_0x1d85('0x25')](_0x51af9d);}return _0x513fbe['save']();};}function saveUpdates(_0x2e1643,_0x4fbdc4){return function(_0x3fdc7d){if(_0x3fdc7d){return _0x3fdc7d['update'](_0x2e1643)['then'](function(_0x334e1d){return _0x334e1d;});}return null;};}function removeEntity(_0x2c3b15,_0x4a59bf){return function(_0x52416d){if(_0x52416d){return _0x52416d[_0x1d85('0x26')]()[_0x1d85('0x27')](function(){var _0x3d41db=_0x52416d[_0x1d85('0x28')]({'plain':!![]});var _0x2ed592=_0x1d85('0x29');return db[_0x1d85('0x2a')][_0x1d85('0x26')]({'where':{'type':_0x2ed592,'resourceId':_0x3d41db['id']}})[_0x1d85('0x27')](function(){return _0x52416d;});})[_0x1d85('0x27')](function(){_0x2c3b15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9d9a,_0x2d003e){return function(_0x51066a){if(!_0x51066a){_0x1d9d9a[_0x1d85('0x2b')](0x194);}return _0x51066a;};}function handleError(_0x3a53b8,_0x243a1e){_0x243a1e=_0x243a1e||0x1f4;return function(_0x255137){logger[_0x1d85('0x2c')](_0x255137[_0x1d85('0x2d')]);if(_0x255137[_0x1d85('0x2e')]){delete _0x255137[_0x1d85('0x2e')];}_0x3a53b8[_0x1d85('0x1c')](_0x243a1e)[_0x1d85('0x2f')](_0x255137);};}exports[_0x1d85('0x30')]=function(_0x1acd6f,_0x397b90){var _0x452e6b={},_0x38661c={},_0x142d71={'count':0x0,'rows':[]};var _0x426b1d=_[_0x1d85('0x31')](db[_0x1d85('0x32')]['rawAttributes'],function(_0x28a4bb){return{'name':_0x28a4bb[_0x1d85('0x33')],'type':_0x28a4bb[_0x1d85('0x34')]['key']};});_0x38661c['model']=_[_0x1d85('0x31')](_0x426b1d,_0x1d85('0x2e'));_0x38661c[_0x1d85('0x35')]=_[_0x1d85('0x36')](_0x1acd6f[_0x1d85('0x35')]);_0x38661c[_0x1d85('0x37')]=_[_0x1d85('0x38')](_0x38661c[_0x1d85('0x39')],_0x38661c[_0x1d85('0x35')]);_0x452e6b['attributes']=_[_0x1d85('0x38')](_0x38661c[_0x1d85('0x39')],qs[_0x1d85('0x3a')](_0x1acd6f[_0x1d85('0x35')]['fields']));_0x452e6b[_0x1d85('0x3b')]=_0x452e6b['attributes']['length']?_0x452e6b['attributes']:_0x38661c[_0x1d85('0x39')];if(!_0x1acd6f[_0x1d85('0x35')]['hasOwnProperty'](_0x1d85('0x3c'))){_0x452e6b[_0x1d85('0x20')]=qs[_0x1d85('0x20')](_0x1acd6f['query'][_0x1d85('0x20')]);_0x452e6b[_0x1d85('0x22')]=qs[_0x1d85('0x22')](_0x1acd6f[_0x1d85('0x35')]['offset']);}_0x452e6b[_0x1d85('0x3d')]=qs['sort'](_0x1acd6f[_0x1d85('0x35')][_0x1d85('0x3e')]);_0x452e6b[_0x1d85('0x3f')]=qs[_0x1d85('0x37')](_[_0x1d85('0x40')](_0x1acd6f[_0x1d85('0x35')],_0x38661c['filters']),_0x426b1d);if(_0x1acd6f[_0x1d85('0x35')][_0x1d85('0x41')]){_0x452e6b[_0x1d85('0x3f')]=_[_0x1d85('0x42')](_0x452e6b[_0x1d85('0x3f')],{'$or':_['map'](_0x426b1d,function(_0x40e411){if(_0x40e411[_0x1d85('0x34')]!==_0x1d85('0x43')){var _0x4dd54d={};_0x4dd54d[_0x40e411['name']]={'$like':'%'+_0x1acd6f[_0x1d85('0x35')]['filter']+'%'};return _0x4dd54d;}})});}_0x452e6b=_[_0x1d85('0x42')]({},_0x452e6b,_0x1acd6f[_0x1d85('0x44')]);var _0x4ade04={'where':_0x452e6b[_0x1d85('0x3f')]};return db[_0x1d85('0x32')]['count'](_0x4ade04)[_0x1d85('0x27')](function(_0xdf9ed3){_0x142d71['count']=_0xdf9ed3;if(_0x1acd6f[_0x1d85('0x35')]['includeAll']){_0x452e6b['include']=[{'all':!![]}];}return db[_0x1d85('0x32')][_0x1d85('0x45')](_0x452e6b);})[_0x1d85('0x27')](function(_0x4c8f80){_0x142d71[_0x1d85('0x46')]=_0x4c8f80;return _0x142d71;})[_0x1d85('0x27')](respondWithFilteredResult(_0x397b90,_0x452e6b))[_0x1d85('0x47')](handleError(_0x397b90,null));};exports[_0x1d85('0x48')]=function(_0x30d570,_0x43e0c1){var _0x5c0067={'raw':![],'where':{'id':_0x30d570[_0x1d85('0x49')]['id']}},_0xc40109={};_0xc40109['model']=_[_0x1d85('0x36')](db[_0x1d85('0x32')]['rawAttributes']);_0xc40109[_0x1d85('0x35')]=_[_0x1d85('0x36')](_0x30d570[_0x1d85('0x35')]);_0xc40109[_0x1d85('0x37')]=_['intersection'](_0xc40109[_0x1d85('0x39')],_0xc40109[_0x1d85('0x35')]);_0x5c0067[_0x1d85('0x3b')]=_[_0x1d85('0x38')](_0xc40109[_0x1d85('0x39')],qs[_0x1d85('0x3a')](_0x30d570[_0x1d85('0x35')][_0x1d85('0x3a')]));_0x5c0067['attributes']=_0x5c0067[_0x1d85('0x3b')][_0x1d85('0x4a')]?_0x5c0067['attributes']:_0xc40109[_0x1d85('0x39')];if(_0x30d570[_0x1d85('0x35')][_0x1d85('0x4b')]){_0x5c0067['include']=[{'all':!![]}];}_0x5c0067=_[_0x1d85('0x42')]({},_0x5c0067,_0x30d570[_0x1d85('0x44')]);return db[_0x1d85('0x32')][_0x1d85('0x4c')](_0x5c0067)['then'](handleEntityNotFound(_0x43e0c1,null))['then'](respondWithResult(_0x43e0c1,null))[_0x1d85('0x47')](handleError(_0x43e0c1,null));};exports['create']=function(_0x5ea6ed,_0x587524){return db[_0x1d85('0x32')][_0x1d85('0x4d')](_0x5ea6ed['body'],{})['then'](function(_0x29928e){var _0x248b00=_0x5ea6ed[_0x1d85('0x4e')]['get']({'plain':!![]});if(!_0x248b00)throw new Error(_0x1d85('0x4f'));if(_0x248b00[_0x1d85('0x50')]===_0x1d85('0x4e')){var _0xed8709=_0x29928e['get']({'plain':!![]});var _0x1babd2=_0x1d85('0x29');return db[_0x1d85('0x51')][_0x1d85('0x4c')]({'where':{'name':_0x1babd2,'userProfileId':_0x248b00[_0x1d85('0x52')]},'raw':!![]})['then'](function(_0x384b36){if(_0x384b36&&_0x384b36[_0x1d85('0x53')]===0x0){return db[_0x1d85('0x2a')]['create']({'name':_0xed8709['name'],'resourceId':_0xed8709['id'],'type':_0x384b36[_0x1d85('0x2e')],'sectionId':_0x384b36['id']},{})[_0x1d85('0x27')](function(){return _0x29928e;});}else{return _0x29928e;}})[_0x1d85('0x47')](function(_0x106e9c){logger['error'](_0x1d85('0x54'),_0x106e9c);throw _0x106e9c;});}return _0x29928e;})[_0x1d85('0x27')](respondWithResult(_0x587524,0xc9))[_0x1d85('0x47')](handleError(_0x587524,null));};exports[_0x1d85('0x55')]=function(_0x280a5f,_0x392897){if(_0x280a5f[_0x1d85('0x56')]['id']){delete _0x280a5f['body']['id'];}return db[_0x1d85('0x32')][_0x1d85('0x4c')]({'where':{'id':_0x280a5f[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x392897,null))[_0x1d85('0x27')](saveUpdates(_0x280a5f[_0x1d85('0x56')],null))[_0x1d85('0x27')](respondWithResult(_0x392897,null))[_0x1d85('0x47')](handleError(_0x392897,null));};exports[_0x1d85('0x26')]=function(_0x37f91f,_0x3433e9){return db[_0x1d85('0x32')][_0x1d85('0x4c')]({'where':{'id':_0x37f91f['params']['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x3433e9,null))[_0x1d85('0x27')](removeEntity(_0x3433e9,null))[_0x1d85('0x47')](handleError(_0x3433e9,null));};exports[_0x1d85('0x57')]=function(_0x5d5355,_0x4656c0){return db[_0x1d85('0x32')][_0x1d85('0x57')]()['then'](respondWithResult(_0x4656c0,null))[_0x1d85('0x47')](handleError(_0x4656c0,null));};exports[_0x1d85('0x58')]=function(_0x3d362f,_0x3ea3b2,_0x5bf86d){if(_0x3d362f[_0x1d85('0x56')]['id']){delete _0x3d362f[_0x1d85('0x56')]['id'];}return db[_0x1d85('0x32')]['find']({'where':{'id':_0x3d362f[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x3ea3b2,null))[_0x1d85('0x27')](function(_0x531098){if(_0x531098){_0x3d362f[_0x1d85('0x56')][_0x1d85('0x59')]=_0x531098['id'];return db[_0x1d85('0x5a')][_0x1d85('0x4d')](_0x3d362f[_0x1d85('0x56')]);}})[_0x1d85('0x27')](respondWithResult(_0x3ea3b2,null))[_0x1d85('0x47')](handleError(_0x3ea3b2,null));};exports[_0x1d85('0x5b')]=function(_0x3221ce,_0x106cd9,_0x2f692b){var _0x34d554={'raw':![],'where':{}};var _0x45b365={};var _0x2e6326={'count':0x0,'rows':[]};return db[_0x1d85('0x32')]['findOne']({'where':{'id':_0x3221ce['params']['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x106cd9,null))[_0x1d85('0x27')](function(_0x560eb4){if(_0x560eb4){_0x45b365['model']=_[_0x1d85('0x36')](db[_0x1d85('0x5a')][_0x1d85('0x5c')]);_0x45b365[_0x1d85('0x35')]=_[_0x1d85('0x36')](_0x3221ce[_0x1d85('0x35')]);_0x45b365[_0x1d85('0x37')]=_[_0x1d85('0x38')](_0x45b365[_0x1d85('0x39')],_0x45b365[_0x1d85('0x35')]);_0x34d554['attributes']=_[_0x1d85('0x38')](_0x45b365[_0x1d85('0x39')],qs['fields'](_0x3221ce['query']['fields']));_0x34d554['attributes']=_0x34d554['attributes']['length']?_0x34d554['attributes']:_0x45b365[_0x1d85('0x39')];if(!_0x3221ce[_0x1d85('0x35')][_0x1d85('0x5d')](_0x1d85('0x3c'))){_0x34d554[_0x1d85('0x20')]=qs[_0x1d85('0x20')](_0x3221ce[_0x1d85('0x35')][_0x1d85('0x20')]);_0x34d554[_0x1d85('0x22')]=qs[_0x1d85('0x22')](_0x3221ce[_0x1d85('0x35')][_0x1d85('0x22')]);}_0x34d554[_0x1d85('0x3d')]=qs[_0x1d85('0x3e')](_0x3221ce[_0x1d85('0x35')][_0x1d85('0x3e')]);_0x34d554['where']=qs['filters'](_[_0x1d85('0x40')](_0x3221ce['query'],_0x45b365[_0x1d85('0x37')]));_0x34d554[_0x1d85('0x3f')]['ListId']=_0x560eb4['id'];if(_0x3221ce['query'][_0x1d85('0x41')]){_0x34d554[_0x1d85('0x3f')]=_['merge'](_0x34d554['where'],{'$or':_['map'](_0x34d554[_0x1d85('0x3b')],function(_0x5de6d4){var _0x2e6aee={};_0x2e6aee[_0x5de6d4]={'$like':'%'+_0x3221ce[_0x1d85('0x35')][_0x1d85('0x41')]+'%'};return _0x2e6aee;})});}_0x34d554=_[_0x1d85('0x42')]({},_0x34d554,_0x3221ce[_0x1d85('0x44')]);return db['Disposition']['count']({'where':_0x34d554[_0x1d85('0x3f')]})['then'](function(_0x2e9849){_0x2e6326['count']=_0x2e9849;if(_0x3221ce[_0x1d85('0x35')][_0x1d85('0x4b')]){_0x34d554[_0x1d85('0x5e')]=[{'all':!![]}];}return db[_0x1d85('0x5a')][_0x1d85('0x45')](_0x34d554);})[_0x1d85('0x27')](function(_0x1df9f9){_0x2e6326['rows']=_0x1df9f9;return _0x2e6326;});}})['then'](respondWithFilteredResult(_0x106cd9,_0x34d554))['catch'](handleError(_0x106cd9,null));};exports[_0x1d85('0x5f')]=function(_0x541db3,_0x1d38aa,_0x30b38b){return db['CmList']['find']({'where':{'id':_0x541db3[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x1d38aa,null))[_0x1d85('0x27')](function(_0x5adda5){if(_0x5adda5){return _0x5adda5[_0x1d85('0x5f')](_0x541db3[_0x1d85('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x1d38aa,null))[_0x1d85('0x47')](handleError(_0x1d38aa,null));};exports[_0x1d85('0x60')]=function(_0x3bb826,_0x417faa,_0x567a32){return db[_0x1d85('0x32')][_0x1d85('0x4c')]({'where':{'id':_0x3bb826[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x417faa,null))[_0x1d85('0x27')](function(_0x1f6f98){if(_0x1f6f98){var _0x267a4e=[];var _0x4ee3de={'success':[],'errors':[]};return db[_0x1d85('0x61')][_0x1d85('0x57')]()[_0x1d85('0x27')](function(_0x9f6f49){if(_0x3bb826[_0x1d85('0x56')]['tags']&&_['isArray'](_0x3bb826['body'][_0x1d85('0x62')])){if(_0x3bb826['body']['tags'][_0x1d85('0x4a')]){_0x3bb826[_0x1d85('0x56')][_0x1d85('0x62')]=_0x3bb826['body']['tags'][_0x1d85('0x63')](';')+';';}else{_0x3bb826[_0x1d85('0x56')][_0x1d85('0x62')]=null;}}else{_0x3bb826[_0x1d85('0x56')][_0x1d85('0x62')]=null;}if(_0x3bb826[_0x1d85('0x56')]&&_[_0x1d85('0x64')](_0x3bb826['body'])){for(var _0x47dc86=0x0;_0x47dc86<_0x3bb826[_0x1d85('0x56')][_0x1d85('0x4a')];_0x47dc86+=0x1){_0x3bb826[_0x1d85('0x56')][_0x47dc86][_0x1d85('0x59')]=_0x3bb826[_0x1d85('0x49')]['id'];_0x267a4e[_0x1d85('0x65')](_0x3bb826[_0x1d85('0x56')][_0x47dc86]);}return BPromise[_0x1d85('0x66')](_0x267a4e,function(_0x37cd80){return db[_0x1d85('0x61')][_0x1d85('0x4d')](_[_0x1d85('0x67')](_0x37cd80,[_0x1d85('0x68'),'id'])||{},{'fields':_[_0x1d85('0x36')](_0x9f6f49),'raw':!![]})[_0x1d85('0x27')](function(_0x18aced){_0x4ee3de['success'][_0x1d85('0x65')](_0x18aced[_0x1d85('0x69')]);})['catch'](function(_0x1f539f){_0x4ee3de[_0x1d85('0x6a')][_0x1d85('0x65')]({'data':_0x37cd80,'error':_0x1f539f[_0x1d85('0x6b')]});});})[_0x1d85('0x27')](function(_0x447a17){return _0x4ee3de;})[_0x1d85('0x47')](function(_0x1d9648){return _0x1d9648;});}else{_0x417faa[_0x1d85('0x1c')](0x190)[_0x1d85('0x1e')]({'message':_0x1d85('0x6c')});}});}})['then'](respondWithResult(_0x417faa,null))[_0x1d85('0x47')](handleError(_0x417faa,null));};exports[_0x1d85('0x6d')]=function(_0xfb8aac,_0x159615,_0x247c48){var _0x420c19;return db['CmList'][_0x1d85('0x4c')]({'where':{'id':_0xfb8aac[_0x1d85('0x49')]['id']},'include':[{'model':db[_0x1d85('0x6e')],'as':_0x1d85('0x6f')}]})[_0x1d85('0x27')](handleEntityNotFound(_0x159615,null))[_0x1d85('0x27')](function(_0x33692e){if(_0x33692e){_0x420c19=_0x33692e;return db['CmContact'][_0x1d85('0x5c')];}})[_0x1d85('0x27')](function(_0x2bf6c8){if(_0x2bf6c8){var _0xa8ece={};var _0x311441={};_0x311441[_0x1d85('0x39')]=_[_0x1d85('0x70')](_['keys'](_0x2bf6c8),_[_0x1d85('0x31')](_0x420c19[_0x1d85('0x6f')],function(_0x37637b){return util['format']('cf_%d',_0x37637b['id']);}));_0x311441[_0x1d85('0x35')]=_[_0x1d85('0x36')](_0xfb8aac['query']);_0x311441[_0x1d85('0x37')]=_['intersection'](_0x311441[_0x1d85('0x39')],_0x311441[_0x1d85('0x35')]);_0xa8ece['attributes']=_[_0x1d85('0x38')](_0x311441['model'],qs[_0x1d85('0x3a')](_0xfb8aac[_0x1d85('0x35')][_0x1d85('0x3a')]));_0xa8ece['attributes']=_0xa8ece[_0x1d85('0x3b')][_0x1d85('0x4a')]?_0xa8ece[_0x1d85('0x3b')]:_0x311441[_0x1d85('0x39')];if(!_0xfb8aac[_0x1d85('0x35')][_0x1d85('0x5d')](_0x1d85('0x3c'))){_0xa8ece[_0x1d85('0x20')]=qs[_0x1d85('0x20')](_0xfb8aac[_0x1d85('0x35')][_0x1d85('0x20')]);_0xa8ece[_0x1d85('0x22')]=qs[_0x1d85('0x22')](_0xfb8aac['query']['offset']);}_0xa8ece[_0x1d85('0x3d')]=qs[_0x1d85('0x3e')](_0xfb8aac[_0x1d85('0x35')][_0x1d85('0x3e')]);_0xa8ece['where']=qs[_0x1d85('0x37')](_[_0x1d85('0x40')](_0xfb8aac['query'],_0x311441[_0x1d85('0x37')]));_0xa8ece['raw']=!![];if(_0xfb8aac['query'][_0x1d85('0x41')]){_0xa8ece[_0x1d85('0x3f')]=_['merge'](_0xa8ece[_0x1d85('0x3f')],{'$or':_['map'](_0xa8ece['attributes'],function(_0x3ec922){var _0x4d52b5={};_0x4d52b5[_0x3ec922]={'$like':'%'+_0xfb8aac[_0x1d85('0x35')][_0x1d85('0x41')]+'%'};return _0x4d52b5;})});}_0xa8ece=_[_0x1d85('0x42')]({},_0xa8ece,_0xfb8aac['options']);return _0x420c19[_0x1d85('0x6d')](_0xa8ece);}})[_0x1d85('0x27')](respondWithResult(_0x159615,null))[_0x1d85('0x47')](handleError(_0x159615,null));};exports[_0x1d85('0x71')]=function(_0x921cf5,_0x5e6969,_0x5c2af0){var _0x1674d2;return db['CmList'][_0x1d85('0x4c')]({'where':{'id':_0x921cf5[_0x1d85('0x49')]['id']},'include':[{'model':db[_0x1d85('0x6e')],'as':'CustomFields'}]})[_0x1d85('0x27')](handleEntityNotFound(_0x5e6969,null))[_0x1d85('0x27')](function(_0x1422d8){if(_0x1422d8){_0x1674d2=_0x1422d8;return db['CmContact'][_0x1d85('0x5c')];}})[_0x1d85('0x27')](function(_0x407493){if(_0x407493){var _0x56d16b={};var _0x4c306a={};_0x4c306a['model']=_[_0x1d85('0x70')](_[_0x1d85('0x36')](_0x407493),_[_0x1d85('0x31')](_0x1674d2[_0x1d85('0x6f')],function(_0x9c81bb){return util['format'](_0x1d85('0x72'),_0x9c81bb['id']);}));_0x4c306a[_0x1d85('0x35')]=_['keys'](_0x921cf5[_0x1d85('0x35')]);_0x4c306a[_0x1d85('0x37')]=_[_0x1d85('0x38')](_0x4c306a[_0x1d85('0x39')],_0x4c306a['query']);_0x56d16b[_0x1d85('0x3b')]=_['intersection'](_0x4c306a['model'],qs[_0x1d85('0x3a')](_0x921cf5[_0x1d85('0x35')][_0x1d85('0x3a')]));_0x56d16b[_0x1d85('0x3b')]=_0x56d16b[_0x1d85('0x3b')]['length']?_0x56d16b[_0x1d85('0x3b')]:_0x4c306a[_0x1d85('0x39')];if(!_0x921cf5[_0x1d85('0x35')]['hasOwnProperty']('nolimit')){_0x56d16b['limit']=qs[_0x1d85('0x20')](_0x921cf5[_0x1d85('0x35')][_0x1d85('0x20')]);_0x56d16b[_0x1d85('0x22')]=qs['offset'](_0x921cf5[_0x1d85('0x35')]['offset']);}_0x56d16b[_0x1d85('0x3d')]=qs[_0x1d85('0x3e')](_0x921cf5[_0x1d85('0x35')][_0x1d85('0x3e')]);_0x56d16b[_0x1d85('0x3f')]=qs['filters'](_[_0x1d85('0x40')](_0x921cf5[_0x1d85('0x35')],_0x4c306a[_0x1d85('0x37')]));_0x56d16b[_0x1d85('0x73')]=!![];if(_0x921cf5['query'][_0x1d85('0x41')]){_0x56d16b['where']=_['merge'](_0x56d16b['where'],{'$or':_[_0x1d85('0x31')](_0x56d16b[_0x1d85('0x3b')],function(_0xb06e6){var _0x2cc9c9={};_0x2cc9c9[_0xb06e6]={'$like':'%'+_0x921cf5[_0x1d85('0x35')][_0x1d85('0x41')]+'%'};return _0x2cc9c9;})});}_0x56d16b=_[_0x1d85('0x42')]({},_0x56d16b,_0x921cf5[_0x1d85('0x44')]);return _0x1674d2['getContacts'](_0x56d16b);}})[_0x1d85('0x27')](function(_0x2e76f4){if(!_[_0x1d85('0x74')](_0x2e76f4)){var _0x302c02=toCsv(_0x2e76f4);var _0x377049=Date[_0x1d85('0x75')]();fs['writeFileSync'](util[_0x1d85('0x76')]('/tmp/list_%d_%s.csv',_0x1674d2['id'],_0x377049),_0x302c02);_0x5e6969[_0x1d85('0x77')](_0x1d85('0x78'),'attachment;\x20filename='+util[_0x1d85('0x76')]('list_%d_%s.csv',_0x1674d2['id'],_0x377049));_0x5e6969['setHeader'](_0x1d85('0x79'),_0x1d85('0x7a'));return _0x5e6969['download'](util[_0x1d85('0x76')](_0x1d85('0x7b'),_0x1674d2['id'],_0x377049));}else{return _0x5e6969[_0x1d85('0x2b')](0xcc);}})[_0x1d85('0x47')](handleError(_0x5e6969,null));};exports['addCustomField']=function(_0x1cab39,_0x2ea667,_0x2e5346){var _0x447b41;delete _0x1cab39[_0x1d85('0x56')]['id'];return db['CmList'][_0x1d85('0x7c')]({'where':{'id':_0x1cab39[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x2ea667,null))[_0x1d85('0x27')](function(_0x46e6eb){if(_0x46e6eb){return db[_0x1d85('0x7d')]['transaction'](function(_0x47da90){return db[_0x1d85('0x6e')]['create'](_0x1cab39[_0x1d85('0x56')],{'transaction':_0x47da90})[_0x1d85('0x27')](function(_0x120fe0){_0x447b41=_0x120fe0;return _0x46e6eb[_0x1d85('0x7e')](_0x120fe0,{'transaction':_0x47da90});})['then'](function(){var _0x5f3e26={'type':db[_0x1d85('0x7f')][_0x1d85('0x80')],'transaction':_0x47da90};switch(_0x1cab39['body'][_0x1d85('0x34')]){case'text':_0x5f3e26[_0x1d85('0x34')]=db[_0x1d85('0x7f')]['TEXT'];break;case _0x1d85('0x81'):_0x5f3e26['type']=db['Sequelize'][_0x1d85('0x82')];break;case _0x1d85('0x83'):_0x5f3e26['type']=db[_0x1d85('0x7f')][_0x1d85('0x84')];_0x5f3e26[_0x1d85('0x85')]=![];break;default:}return db[_0x1d85('0x7d')][_0x1d85('0x86')][_0x1d85('0x87')](_0x1d85('0x88'),util[_0x1d85('0x76')](_0x1d85('0x89'),_0x447b41['id']),_0x5f3e26);})[_0x1d85('0x27')](function(){return _0x447b41;});});}})[_0x1d85('0x27')](respondWithResult(_0x2ea667,null))['catch'](handleError(_0x2ea667,null));};exports[_0x1d85('0x8a')]=function(_0x3ac08d,_0x11a66d,_0x2c8152){var _0xffad4f={};var _0x4b2047={};var _0x32a357;var _0x3b45a1;return db[_0x1d85('0x32')]['findOne']({'where':{'id':_0x3ac08d[_0x1d85('0x49')]['id']}})['then'](handleEntityNotFound(_0x11a66d,null))['then'](function(_0xc07f71){if(_0xc07f71){_0x32a357=_0xc07f71;_0x4b2047[_0x1d85('0x39')]=_[_0x1d85('0x36')](db[_0x1d85('0x6e')][_0x1d85('0x5c')]);_0x4b2047[_0x1d85('0x35')]=_[_0x1d85('0x36')](_0x3ac08d[_0x1d85('0x35')]);_0x4b2047[_0x1d85('0x37')]=_[_0x1d85('0x38')](_0x4b2047['model'],_0x4b2047[_0x1d85('0x35')]);_0xffad4f['attributes']=_['intersection'](_0x4b2047[_0x1d85('0x39')],qs[_0x1d85('0x3a')](_0x3ac08d[_0x1d85('0x35')][_0x1d85('0x3a')]));_0xffad4f[_0x1d85('0x3b')]=_0xffad4f[_0x1d85('0x3b')]['length']?_0xffad4f[_0x1d85('0x3b')]:_0x4b2047[_0x1d85('0x39')];_0xffad4f[_0x1d85('0x3d')]=qs[_0x1d85('0x3e')](_0x3ac08d['query'][_0x1d85('0x3e')]);_0xffad4f['where']=qs[_0x1d85('0x37')](_[_0x1d85('0x40')](_0x3ac08d[_0x1d85('0x35')],_0x4b2047[_0x1d85('0x37')]));_0xffad4f[_0x1d85('0x3f')]=_[_0x1d85('0x42')](_0xffad4f[_0x1d85('0x3f')],{'$or':[{'ListId':_0xc07f71['id']},{'ListId':null}]});if(_0x3ac08d['query']['filter']){_0xffad4f[_0x1d85('0x3f')]=_[_0x1d85('0x42')](_0xffad4f[_0x1d85('0x3f')],{'$or':_['map'](_0xffad4f['attributes'],function(_0x81b1c4){var _0x507cf2={};_0x507cf2[_0x81b1c4]={'$like':'%'+_0x3ac08d[_0x1d85('0x35')][_0x1d85('0x41')]+'%'};return _0x507cf2;})});}_0xffad4f=_[_0x1d85('0x42')]({},_0xffad4f,_0x3ac08d[_0x1d85('0x44')]);return db['CmCustomField']['findAndCountAll'](_0xffad4f);}})[_0x1d85('0x27')](respondWithResult(_0x11a66d,null))[_0x1d85('0x47')](handleError(_0x11a66d,null));};exports[_0x1d85('0x8b')]=function(_0x184d35,_0x3d91df,_0x1b6e13){return db['CmList']['find']({'where':{'id':_0x184d35[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x3d91df,null))[_0x1d85('0x27')](function(_0x1f0b90){if(_0x1f0b90){return _0x1f0b90['addAgents'](_0x184d35[_0x1d85('0x56')][_0x1d85('0x68')],_[_0x1d85('0x67')](_0x184d35['body'],['ids','id'])||{})[_0x1d85('0x8c')](function(_0x1d3837){for(var _0x38258c=0x0;_0x38258c<_0x184d35[_0x1d85('0x56')][_0x1d85('0x68')]['length'];_0x38258c+=0x1){socket[_0x1d85('0x8d')](_0x1d85('0x8e'),{'UserId':Number(_0x184d35[_0x1d85('0x56')][_0x1d85('0x68')][_0x38258c]),'CmListId':Number(_0x184d35[_0x1d85('0x49')]['id'])});}return _0x1d3837;});}})[_0x1d85('0x27')](respondWithResult(_0x3d91df,null))['catch'](handleError(_0x3d91df,null));};exports[_0x1d85('0x8f')]=function(_0x45a088,_0x536784,_0x9fcf55){return db[_0x1d85('0x32')]['find']({'where':{'id':_0x45a088[_0x1d85('0x49')]['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x536784,null))['then'](function(_0x248e8f){if(_0x248e8f){return _0x248e8f[_0x1d85('0x8f')](_0x45a088[_0x1d85('0x35')]['ids'])[_0x1d85('0x27')](function(){if(_[_0x1d85('0x64')](_0x45a088['query'][_0x1d85('0x68')])){for(var _0x52712c=0x0;_0x52712c<_0x45a088[_0x1d85('0x35')][_0x1d85('0x68')][_0x1d85('0x4a')];_0x52712c+=0x1){socket[_0x1d85('0x8d')](_0x1d85('0x90'),{'UserId':Number(_0x45a088[_0x1d85('0x35')][_0x1d85('0x68')][_0x52712c]),'CmListId':Number(_0x45a088['params']['id'])});}}else{socket[_0x1d85('0x8d')](_0x1d85('0x90'),{'UserId':Number(_0x45a088[_0x1d85('0x35')][_0x1d85('0x68')]),'CmListId':Number(_0x45a088[_0x1d85('0x49')]['id'])});}});}})[_0x1d85('0x27')](respondWithStatusCode(_0x536784,null))[_0x1d85('0x47')](handleError(_0x536784,null));};exports[_0x1d85('0x91')]=function(_0x29d9ed,_0x37fbb8,_0x46503d){var _0x1bcdc0={};var _0x267457={};var _0x75f748;var _0x251a27;return db[_0x1d85('0x32')][_0x1d85('0x7c')]({'where':{'id':_0x29d9ed['params']['id']}})[_0x1d85('0x27')](handleEntityNotFound(_0x37fbb8,null))['then'](function(_0x15e313){if(_0x15e313){_0x75f748=_0x15e313;_0x267457[_0x1d85('0x39')]=_[_0x1d85('0x36')](db[_0x1d85('0x92')]['rawAttributes']);_0x267457[_0x1d85('0x35')]=_[_0x1d85('0x36')](_0x29d9ed[_0x1d85('0x35')]);_0x267457['filters']=_['intersection'](_0x267457['model'],_0x267457['query']);_0x1bcdc0[_0x1d85('0x3b')]=_[_0x1d85('0x38')](_0x267457[_0x1d85('0x39')],qs[_0x1d85('0x3a')](_0x29d9ed[_0x1d85('0x35')][_0x1d85('0x3a')]));_0x1bcdc0[_0x1d85('0x3b')]=_0x1bcdc0[_0x1d85('0x3b')][_0x1d85('0x4a')]?_0x1bcdc0['attributes']:_0x267457['model'];_0x1bcdc0[_0x1d85('0x3d')]=qs[_0x1d85('0x3e')](_0x29d9ed[_0x1d85('0x35')][_0x1d85('0x3e')]);_0x1bcdc0[_0x1d85('0x3f')]=qs[_0x1d85('0x37')](_[_0x1d85('0x40')](_0x29d9ed[_0x1d85('0x35')],_0x267457['filters']));if(_0x29d9ed['query'][_0x1d85('0x41')]){_0x1bcdc0['where']=_[_0x1d85('0x42')](_0x1bcdc0[_0x1d85('0x3f')],{'$or':_[_0x1d85('0x31')](_0x1bcdc0[_0x1d85('0x3b')],function(_0x5c3f19){var _0x42df75={};_0x42df75[_0x5c3f19]={'$like':'%'+_0x29d9ed[_0x1d85('0x35')][_0x1d85('0x41')]+'%'};return _0x42df75;})});}_0x1bcdc0=_[_0x1d85('0x42')]({},_0x1bcdc0,_0x29d9ed[_0x1d85('0x44')]);return _0x75f748[_0x1d85('0x91')](_0x1bcdc0);}})[_0x1d85('0x27')](function(_0x4211e3){if(_0x4211e3){_0x251a27=_0x4211e3[_0x1d85('0x4a')];if(!_0x29d9ed[_0x1d85('0x35')][_0x1d85('0x5d')]('nolimit')){_0x1bcdc0['limit']=qs['limit'](_0x29d9ed[_0x1d85('0x35')][_0x1d85('0x20')]);_0x1bcdc0[_0x1d85('0x22')]=qs['offset'](_0x29d9ed[_0x1d85('0x35')][_0x1d85('0x22')]);}return _0x75f748[_0x1d85('0x91')](_0x1bcdc0);}})['then'](function(_0x28972f){if(_0x28972f){return _0x28972f?{'count':_0x251a27,'rows':_0x28972f}:null;}})[_0x1d85('0x27')](respondWithResult(_0x37fbb8,null))[_0x1d85('0x47')](handleError(_0x37fbb8,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8cfa675..10e6a00 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x43d0a8,_0xc7c072){_0x43d0a8=_0x43d0a8-0x0;var _0xa30f31=_0xe14b[_0x43d0a8];return _0xa30f31;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x1acbf3,_0x5eab92){_0x1acbf3=_0x1acbf3-0x0;var _0x4a0f49=_0x3e74[_0x1acbf3];return _0x4a0f49;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e8469df..c64c2e8 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(_0x55794e,_0x3d7dd1){var _0x3b026c=function(_0x237aaa){while(--_0x237aaa){_0x55794e['push'](_0x55794e['shift']());}};_0x3b026c(++_0x3d7dd1);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3f991e,_0x35ba92){_0x3f991e=_0x3f991e-0x0;var _0x236883=_0xa8a8[_0x3f991e];return _0x236883;};'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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xe14d,0x1ee));var _0xde14=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xe14d[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('CmList',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 4c0c813..f567d8b 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 _0xd918=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x5aa018,_0x5c2a31){var _0x4a57ea=function(_0x1e26dc){while(--_0x1e26dc){_0x5aa018['push'](_0x5aa018['shift']());}};_0x4a57ea(++_0x5c2a31);}(_0xd918,0x85));var _0x8d91=function(_0x2f77d6,_0x815a1d){_0x2f77d6=_0x2f77d6-0x0;var _0x5bf9eb=_0xd918[_0x2f77d6];return _0x5bf9eb;};'use strict';var _=require(_0x8d91('0x0'));var util=require(_0x8d91('0x1'));var moment=require(_0x8d91('0x2'));var BPromise=require(_0x8d91('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d91('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d91('0x5'));var logger=require('../../config/logger')(_0x8d91('0x6'));var config=require(_0x8d91('0x7'));var jayson=require(_0x8d91('0x8'));var client=jayson[_0x8d91('0x9')][_0x8d91('0xa')]({'port':0x232a});config[_0x8d91('0xb')]=_[_0x8d91('0xc')](config['redis'],{'host':_0x8d91('0xd'),'port':0x18eb});var socket=require(_0x8d91('0xe'))(new Redis(config[_0x8d91('0xb')]));require(_0x8d91('0xf'))[_0x8d91('0x10')](socket);function respondWithRpcPromise(_0x33fd38,_0x3ba36c,_0x5a7f94){return new BPromise(function(_0x1e5517,_0x3ae21e){return client[_0x8d91('0x11')](_0x33fd38,_0x5a7f94)[_0x8d91('0x12')](function(_0x13b82e){logger[_0x8d91('0x13')](_0x8d91('0x14'),_0x3ba36c,_0x8d91('0x15'));logger[_0x8d91('0x16')](_0x8d91('0x17'),_0x3ba36c,_0x8d91('0x15'),JSON[_0x8d91('0x18')](_0x13b82e));if(_0x13b82e[_0x8d91('0x19')]){if(_0x13b82e[_0x8d91('0x19')][_0x8d91('0x1a')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3ba36c,_0x13b82e[_0x8d91('0x19')][_0x8d91('0x1b')]);return _0x3ae21e(_0x13b82e[_0x8d91('0x19')][_0x8d91('0x1b')]);}logger[_0x8d91('0x19')]('CmList,\x20%s,\x20%s',_0x3ba36c,_0x13b82e['error']['message']);return _0x1e5517(_0x13b82e[_0x8d91('0x19')]['message']);}else{logger[_0x8d91('0x13')]('CmList,\x20%s,\x20%s',_0x3ba36c,_0x8d91('0x15'));_0x1e5517(_0x13b82e['result'][_0x8d91('0x1b')]);}})['catch'](function(_0xae38c3){logger[_0x8d91('0x19')]('CmList,\x20%s,\x20%s',_0x3ba36c,_0xae38c3);_0x3ae21e(_0xae38c3);});});} \ No newline at end of file +var _0x4327=['http','defaults','redis','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x253ade,_0x26ce96){var _0x222ea7=function(_0x47ae96){while(--_0x47ae96){_0x253ade['push'](_0x253ade['shift']());}};_0x222ea7(++_0x26ce96);}(_0x4327,0xc0));var _0x7432=function(_0x192331,_0x535ca2){_0x192331=_0x192331-0x0;var _0x403fb4=_0x4327[_0x192331];return _0x403fb4;};'use strict';var _=require(_0x7432('0x0'));var util=require(_0x7432('0x1'));var moment=require('moment');var BPromise=require(_0x7432('0x2'));var rs=require(_0x7432('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7432('0x4'))['db'];var utils=require(_0x7432('0x5'));var logger=require(_0x7432('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7432('0x7')][_0x7432('0x8')]({'port':0x232a});config['redis']=_[_0x7432('0x9')](config[_0x7432('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7432('0xb'))(new Redis(config[_0x7432('0xa')]));require(_0x7432('0xc'))['register'](socket);function respondWithRpcPromise(_0x1a37e,_0x35292f,_0x4f9ab0){return new BPromise(function(_0x38584d,_0x4a2302){return client[_0x7432('0xd')](_0x1a37e,_0x4f9ab0)['then'](function(_0x12a267){logger[_0x7432('0xe')](_0x7432('0xf'),_0x35292f,_0x7432('0x10'));logger[_0x7432('0x11')](_0x7432('0x12'),_0x35292f,_0x7432('0x10'),JSON[_0x7432('0x13')](_0x12a267));if(_0x12a267['error']){if(_0x12a267[_0x7432('0x14')][_0x7432('0x15')]===0x1f4){logger[_0x7432('0x14')](_0x7432('0xf'),_0x35292f,_0x12a267[_0x7432('0x14')]['message']);return _0x4a2302(_0x12a267[_0x7432('0x14')]['message']);}logger[_0x7432('0x14')]('CmList,\x20%s,\x20%s',_0x35292f,_0x12a267[_0x7432('0x14')]['message']);return _0x38584d(_0x12a267[_0x7432('0x14')][_0x7432('0x16')]);}else{logger['info'](_0x7432('0xf'),_0x35292f,'request\x20sent');_0x38584d(_0x12a267[_0x7432('0x17')][_0x7432('0x16')]);}})[_0x7432('0x18')](function(_0x238f7c){logger[_0x7432('0x14')]('CmList,\x20%s,\x20%s',_0x35292f,_0x238f7c);_0x4a2302(_0x238f7c);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 8a79736..1e046b6 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 _0x16c6=['save','remove','removeListener','register','length','cmList:','./cmList.events'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x16c6,0x1f0));var _0x616c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x16c6[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require(_0x616c('0x0'));var events=[_0x616c('0x1'),_0x616c('0x2'),'update'];function createListener(_0x3f582,_0x217257){return function(_0x44304e){_0x217257['emit'](_0x3f582,_0x44304e);};}function removeListener(_0x358bb1,_0x2ce6f7){return function(){CmListEvents[_0x616c('0x3')](_0x358bb1,_0x2ce6f7);};}exports[_0x616c('0x4')]=function(_0x233cbb){for(var _0x1f1830=0x0,_0x55f455=events[_0x616c('0x5')];_0x1f1830<_0x55f455;_0x1f1830++){var _0x48f6ff=events[_0x1f1830];var _0x75ce64=createListener(_0x616c('0x6')+_0x48f6ff,_0x233cbb);CmListEvents['on'](_0x48f6ff,_0x75ce64);}}; \ No newline at end of file +var _0x4633=['removeListener','register','length','cmList:','./cmList.events','save','emit'];(function(_0xc258b0,_0x2863ac){var _0x1e0ae3=function(_0x1aff0b){while(--_0x1aff0b){_0xc258b0['push'](_0xc258b0['shift']());}};_0x1e0ae3(++_0x2863ac);}(_0x4633,0x1e7));var _0x3463=function(_0x2ff27d,_0x3781a8){_0x2ff27d=_0x2ff27d-0x0;var _0x98222b=_0x4633[_0x2ff27d];return _0x98222b;};'use strict';var CmListEvents=require(_0x3463('0x0'));var events=[_0x3463('0x1'),'remove','update'];function createListener(_0x4e176e,_0x1f7d21){return function(_0x4c4b87){_0x1f7d21[_0x3463('0x2')](_0x4e176e,_0x4c4b87);};}function removeListener(_0x5cd003,_0x4ce297){return function(){CmListEvents[_0x3463('0x3')](_0x5cd003,_0x4ce297);};}exports[_0x3463('0x4')]=function(_0x4a1205){for(var _0x4bad05=0x0,_0x444f15=events[_0x3463('0x5')];_0x4bad05<_0x444f15;_0x4bad05++){var _0x381a47=events[_0x4bad05];var _0x58efb3=createListener(_0x3463('0x6')+_0x381a47,_0x4a1205);CmListEvents['on'](_0x381a47,_0x58efb3);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b2eb626..120a9fd 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 _0xfebd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','path','connect-timeout','Router'];(function(_0x3ee47b,_0x2e50f4){var _0x36c8d6=function(_0x4fb303){while(--_0x4fb303){_0x3ee47b['push'](_0x3ee47b['shift']());}};_0x36c8d6(++_0x2e50f4);}(_0xfebd,0x126));var _0xdfeb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfebd[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdfeb('0x0'));var timeout=require(_0xdfeb('0x1'));var express=require('express');var router=express[_0xdfeb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdfeb('0x3'));var interaction=require(_0xdfeb('0x4'));var config=require(_0xdfeb('0x5'));var controller=require(_0xdfeb('0x6'));router[_0xdfeb('0x7')]('/',auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x9')]);router[_0xdfeb('0x7')](_0xdfeb('0xa'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0xb')]);router['get']('/:id',auth[_0xdfeb('0x8')](),controller[_0xdfeb('0xc')]);router['get'](_0xdfeb('0xd'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0xe')]);router[_0xdfeb('0x7')](_0xdfeb('0xf'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x10')]);router[_0xdfeb('0x7')](_0xdfeb('0x11'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x12')]);router[_0xdfeb('0x7')](_0xdfeb('0x13'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x14')]);router[_0xdfeb('0x7')](_0xdfeb('0x15'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x16')]);router[_0xdfeb('0x17')]('/',auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x18')]);router['post'](_0xdfeb('0xd'),auth[_0xdfeb('0x8')](),controller['addDisposition']);router[_0xdfeb('0x17')](_0xdfeb('0xf'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x19')]);router[_0xdfeb('0x17')](_0xdfeb('0x13'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x1a')]);router[_0xdfeb('0x17')](_0xdfeb('0x15'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x1b')]);router[_0xdfeb('0x1c')](_0xdfeb('0x1d'),auth['isAuthenticated'](),controller[_0xdfeb('0x1e')]);router[_0xdfeb('0x1f')](_0xdfeb('0x1d'),auth[_0xdfeb('0x8')](),controller[_0xdfeb('0x20')]);router[_0xdfeb('0x1f')](_0xdfeb('0xd'),auth[_0xdfeb('0x8')](),controller['removeDispositions']);router[_0xdfeb('0x1f')](_0xdfeb('0x15'),auth[_0xdfeb('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6d9b=['/:id/fields','getCustomFields','getAgents','post','create','addCustomField','/:id/users','addAgents','update','delete','destroy','removeAgents','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv'];(function(_0x270546,_0x5dc863){var _0x1c7ffc=function(_0x51e319){while(--_0x51e319){_0x270546['push'](_0x270546['shift']());}};_0x1c7ffc(++_0x5dc863);}(_0x6d9b,0x1be));var _0xb6d9=function(_0x1e9fb1,_0x2fc459){_0x1e9fb1=_0x1e9fb1-0x0;var _0x5377d0=_0x6d9b[_0x1e9fb1];return _0x5377d0;};'use strict';var multer=require(_0xb6d9('0x0'));var util=require(_0xb6d9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb6d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb6d9('0x3'));var interaction=require(_0xb6d9('0x4'));var config=require(_0xb6d9('0x5'));var controller=require('./cmList.controller');router[_0xb6d9('0x6')]('/',auth[_0xb6d9('0x7')](),controller[_0xb6d9('0x8')]);router[_0xb6d9('0x6')](_0xb6d9('0x9'),auth[_0xb6d9('0x7')](),controller[_0xb6d9('0xa')]);router[_0xb6d9('0x6')](_0xb6d9('0xb'),auth['isAuthenticated'](),controller[_0xb6d9('0xc')]);router[_0xb6d9('0x6')](_0xb6d9('0xd'),auth[_0xb6d9('0x7')](),controller[_0xb6d9('0xe')]);router[_0xb6d9('0x6')](_0xb6d9('0xf'),auth['isAuthenticated'](),controller[_0xb6d9('0x10')]);router[_0xb6d9('0x6')](_0xb6d9('0x11'),auth['isAuthenticated'](),controller[_0xb6d9('0x12')]);router[_0xb6d9('0x6')](_0xb6d9('0x13'),auth['isAuthenticated'](),controller[_0xb6d9('0x14')]);router['get']('/:id/users',auth[_0xb6d9('0x7')](),controller[_0xb6d9('0x15')]);router[_0xb6d9('0x16')]('/',auth[_0xb6d9('0x7')](),controller[_0xb6d9('0x17')]);router[_0xb6d9('0x16')](_0xb6d9('0xd'),auth[_0xb6d9('0x7')](),controller['addDisposition']);router[_0xb6d9('0x16')](_0xb6d9('0xf'),auth[_0xb6d9('0x7')](),controller['addContacts']);router['post'](_0xb6d9('0x13'),auth[_0xb6d9('0x7')](),controller[_0xb6d9('0x18')]);router[_0xb6d9('0x16')](_0xb6d9('0x19'),auth['isAuthenticated'](),controller[_0xb6d9('0x1a')]);router['put'](_0xb6d9('0xb'),auth[_0xb6d9('0x7')](),controller[_0xb6d9('0x1b')]);router[_0xb6d9('0x1c')](_0xb6d9('0xb'),auth['isAuthenticated'](),controller[_0xb6d9('0x1d')]);router[_0xb6d9('0x1c')](_0xb6d9('0xd'),auth[_0xb6d9('0x7')](),controller['removeDispositions']);router[_0xb6d9('0x1c')](_0xb6d9('0x19'),auth[_0xb6d9('0x7')](),controller[_0xb6d9('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 44b0ebb..9d2b472 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 _0x1341=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0xad9f0c,_0x2677c3){var _0x1ec91c=function(_0x287afe){while(--_0x287afe){_0xad9f0c['push'](_0xad9f0c['shift']());}};_0x1ec91c(++_0x2677c3);}(_0x1341,0xa7));var _0x1134=function(_0xdb0dbf,_0x1d84d3){_0xdb0dbf=_0xdb0dbf-0x0;var _0x5bb8a0=_0x1341[_0xdb0dbf];return _0x5bb8a0;};'use strict';var Sequelize=require(_0x1134('0x0'));module[_0x1134('0x1')]={'name':{'type':Sequelize[_0x1134('0x2')],'get':function(_0x5cb455){return this[_0x1134('0x3')](_0x1134('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x1134('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x1134('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x7de3=['STRING','sequelize','getDataValue','field'];(function(_0x649af8,_0x5aa37e){var _0xe67c56=function(_0x359904){while(--_0x359904){_0x649af8['push'](_0x649af8['shift']());}};_0xe67c56(++_0x5aa37e);}(_0x7de3,0x1ed));var _0x37de=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7de3[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0x37de('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5985e6){return this[_0x37de('0x1')](_0x37de('0x2'));}},'field':{'type':Sequelize[_0x37de('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x37de('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x37de('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 06df0c0..4b8a33c 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(_0x4a71fb,_0x381296){var _0xf356d2=function(_0x32dea7){while(--_0x32dea7){_0x4a71fb['push'](_0x4a71fb['shift']());}};_0xf356d2(++_0x381296);}(_0x7a54,0x106));var _0x47a5=function(_0x3334d1,_0x153c51){_0x3334d1=_0x3334d1-0x0;var _0x1ccfc0=_0x7a54[_0x3334d1];return _0x1ccfc0;};'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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x310f5f,_0x8e3d71){var _0x22ddde=function(_0x2d73ca){while(--_0x2d73ca){_0x310f5f['push'](_0x310f5f['shift']());}};_0x22ddde(++_0x8e3d71);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c5f532e..a9a3cbb 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 _0x77ab=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./condition.attributes','define','tools_conditions','lodash'];(function(_0x3984a6,_0x4adaba){var _0x2cc75f=function(_0x4a3849){while(--_0x4a3849){_0x3984a6['push'](_0x3984a6['shift']());}};_0x2cc75f(++_0x4adaba);}(_0x77ab,0x1bb));var _0xb77a=function(_0x1f949e,_0x1d5f14){_0x1f949e=_0x1f949e-0x0;var _0x2decb2=_0x77ab[_0x1f949e];return _0x2decb2;};'use strict';var _=require(_0xb77a('0x0'));var util=require(_0xb77a('0x1'));var logger=require(_0xb77a('0x2'))(_0xb77a('0x3'));var moment=require(_0xb77a('0x4'));var BPromise=require(_0xb77a('0x5'));var rp=require(_0xb77a('0x6'));var fs=require('fs');var path=require(_0xb77a('0x7'));var rimraf=require(_0xb77a('0x8'));var config=require('../../config/environment');var attributes=require(_0xb77a('0x9'));module['exports']=function(_0x5968d8,_0x12a559){return _0x5968d8[_0xb77a('0xa')]('Condition',attributes,{'tableName':_0xb77a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed04=['define','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x4fa97c,_0x4aa6ab){var _0x518c7f=function(_0x2bd135){while(--_0x2bd135){_0x4fa97c['push'](_0x4fa97c['shift']());}};_0x518c7f(++_0x4aa6ab);}(_0xed04,0x147));var _0x4ed0=function(_0x1d3453,_0x49bc9d){_0x1d3453=_0x1d3453-0x0;var _0x5554ad=_0xed04[_0x1d3453];return _0x5554ad;};'use strict';var _=require(_0x4ed0('0x0'));var util=require(_0x4ed0('0x1'));var logger=require(_0x4ed0('0x2'))(_0x4ed0('0x3'));var moment=require('moment');var BPromise=require(_0x4ed0('0x4'));var rp=require(_0x4ed0('0x5'));var fs=require('fs');var path=require(_0x4ed0('0x6'));var rimraf=require(_0x4ed0('0x7'));var config=require(_0x4ed0('0x8'));var attributes=require(_0x4ed0('0x9'));module[_0x4ed0('0xa')]=function(_0x247b6d,_0x1a2ff7){return _0x247b6d[_0x4ed0('0xb')]('Condition',attributes,{'tableName':_0x4ed0('0xc'),'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 5059908..e481636 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 _0x366f=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x377c1b,_0x1831c1){var _0x5b0b7f=function(_0x559338){while(--_0x559338){_0x377c1b['push'](_0x377c1b['shift']());}};_0x5b0b7f(++_0x1831c1);}(_0x366f,0x198));var _0xf366=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x366f[_0x1abb09];return _0xea1c07;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf366('0x0'));var rs=require(_0xf366('0x1'));var fs=require('fs');var Redis=require(_0xf366('0x2'));var db=require(_0xf366('0x3'))['db'];var utils=require(_0xf366('0x4'));var logger=require(_0xf366('0x5'))(_0xf366('0x6'));var config=require(_0xf366('0x7'));var jayson=require(_0xf366('0x8'));var client=jayson[_0xf366('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x584cca,_0x118bd5,_0x13a875){return new BPromise(function(_0x54a87b,_0x471411){return client[_0xf366('0xa')](_0x584cca,_0x13a875)[_0xf366('0xb')](function(_0x137b04){logger[_0xf366('0xc')](_0xf366('0xd'),_0x118bd5,_0xf366('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x118bd5,_0xf366('0xe'),JSON[_0xf366('0xf')](_0x137b04));if(_0x137b04[_0xf366('0x10')]){if(_0x137b04['error'][_0xf366('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x118bd5,_0x137b04[_0xf366('0x10')][_0xf366('0x12')]);return _0x471411(_0x137b04['error'][_0xf366('0x12')]);}logger['error'](_0xf366('0xd'),_0x118bd5,_0x137b04[_0xf366('0x10')]['message']);return _0x54a87b(_0x137b04[_0xf366('0x10')][_0xf366('0x12')]);}else{logger[_0xf366('0xc')](_0xf366('0xd'),_0x118bd5,_0xf366('0xe'));_0x54a87b(_0x137b04['result'][_0xf366('0x12')]);}})['catch'](function(_0xb60c9f){logger[_0xf366('0x10')](_0xf366('0xd'),_0x118bd5,_0xb60c9f);_0x471411(_0xb60c9f);});});} \ No newline at end of file +var _0x68a9=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','Condition,\x20%s,\x20%s','message','result'];(function(_0x113cf1,_0x190ec9){var _0x408564=function(_0x166e4b){while(--_0x166e4b){_0x113cf1['push'](_0x113cf1['shift']());}};_0x408564(++_0x190ec9);}(_0x68a9,0x8b));var _0x968a=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x68a9[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x968a('0x0'));var util=require('util');var moment=require(_0x968a('0x1'));var BPromise=require(_0x968a('0x2'));var rs=require(_0x968a('0x3'));var fs=require('fs');var Redis=require(_0x968a('0x4'));var db=require(_0x968a('0x5'))['db'];var utils=require(_0x968a('0x6'));var logger=require(_0x968a('0x7'))(_0x968a('0x8'));var config=require(_0x968a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x968a('0xa')][_0x968a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x269242,_0x58d7c5,_0x4e0a2b){return new BPromise(function(_0x1538f5,_0x1d8ab5){return client[_0x968a('0xc')](_0x269242,_0x4e0a2b)[_0x968a('0xd')](function(_0x8f994a){logger[_0x968a('0xe')]('Condition,\x20%s,\x20%s',_0x58d7c5,'request\x20sent');logger[_0x968a('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x58d7c5,_0x968a('0x10'),JSON[_0x968a('0x11')](_0x8f994a));if(_0x8f994a[_0x968a('0x12')]){if(_0x8f994a[_0x968a('0x12')]['code']===0x1f4){logger[_0x968a('0x12')](_0x968a('0x13'),_0x58d7c5,_0x8f994a[_0x968a('0x12')]['message']);return _0x1d8ab5(_0x8f994a['error'][_0x968a('0x14')]);}logger[_0x968a('0x12')](_0x968a('0x13'),_0x58d7c5,_0x8f994a['error']['message']);return _0x1538f5(_0x8f994a[_0x968a('0x12')]['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x58d7c5,'request\x20sent');_0x1538f5(_0x8f994a[_0x968a('0x15')][_0x968a('0x14')]);}})[_0x968a('0x16')](function(_0x372389){logger[_0x968a('0x12')](_0x968a('0x13'),_0x58d7c5,_0x372389);_0x1d8ab5(_0x372389);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bccb142..684cbb6 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 _0x2fc5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4d9912,_0x3aba10){var _0x1d0266=function(_0x28d744){while(--_0x28d744){_0x4d9912['push'](_0x4d9912['shift']());}};_0x1d0266(++_0x3aba10);}(_0x2fc5,0xec));var _0x52fc=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x2fc5[_0x4ea955];return _0x558561;};'use strict';var multer=require(_0x52fc('0x0'));var util=require('util');var path=require(_0x52fc('0x1'));var timeout=require(_0x52fc('0x2'));var express=require(_0x52fc('0x3'));var router=express[_0x52fc('0x4')]();var fs_extra=require(_0x52fc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x52fc('0x6'));var config=require(_0x52fc('0x7'));var controller=require(_0x52fc('0x8'));router[_0x52fc('0x9')](_0x52fc('0xa'),auth[_0x52fc('0xb')](),controller[_0x52fc('0xc')]);router[_0x52fc('0xd')]('/:id',auth[_0x52fc('0xb')](),controller[_0x52fc('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb9a7=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x5d6d30,_0x40c84d){var _0x1fd16c=function(_0x559cdc){while(--_0x559cdc){_0x5d6d30['push'](_0x5d6d30['shift']());}};_0x1fd16c(++_0x40c84d);}(_0xb9a7,0x172));var _0x7b9a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xb9a7[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x7b9a('0x0'));var util=require('util');var path=require(_0x7b9a('0x1'));var timeout=require(_0x7b9a('0x2'));var express=require(_0x7b9a('0x3'));var router=express[_0x7b9a('0x4')]();var fs_extra=require(_0x7b9a('0x5'));var auth=require(_0x7b9a('0x6'));var interaction=require(_0x7b9a('0x7'));var config=require(_0x7b9a('0x8'));var controller=require(_0x7b9a('0x9'));router[_0x7b9a('0xa')](_0x7b9a('0xb'),auth[_0x7b9a('0xc')](),controller[_0x7b9a('0xd')]);router[_0x7b9a('0xe')](_0x7b9a('0xb'),auth[_0x7b9a('0xc')](),controller['destroy']);module[_0x7b9a('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9ea37c3..b4c2ed0 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 _0xb7e7=['STRING','sequelize'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b3c44f3..e144359 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 _0x3de6=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','update','then','get','CustomDashboards','destroy','end','name','send','Dashboard','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','error','clone','omit','updatedAt','createdAt','UserProfileSection','userProfileId','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','pick','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x543794,_0x31b8f9){var _0x5158d6=function(_0x184b83){while(--_0x184b83){_0x543794['push'](_0x543794['shift']());}};_0x5158d6(++_0x31b8f9);}(_0x3de6,0x14b));var _0x63de=function(_0x222a48,_0xdfec3c){_0x222a48=_0x222a48-0x0;var _0x3368e0=_0x3de6[_0x222a48];return _0x3368e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63de('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63de('0x1'));var rp=require('request-promise');var moment=require(_0x63de('0x2'));var BPromise=require(_0x63de('0x3'));var Mustache=require('mustache');var util=require(_0x63de('0x4'));var path=require(_0x63de('0x5'));var sox=require(_0x63de('0x6'));var csv=require(_0x63de('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63de('0x8'));var _=require(_0x63de('0x9'));var squel=require(_0x63de('0xa'));var crypto=require(_0x63de('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x63de('0x7'));var querystring=require(_0x63de('0xc'));var Papa=require(_0x63de('0xd'));var Redis=require(_0x63de('0xe'));var authService=require(_0x63de('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63de('0x10'));var logger=require(_0x63de('0x11'))(_0x63de('0x12'));var utils=require(_0x63de('0x13'));var config=require(_0x63de('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x63de('0x15'))['db'];config[_0x63de('0x16')]=_[_0x63de('0x17')](config['redis'],{'host':_0x63de('0x18'),'port':0x18eb});var socket=require(_0x63de('0x19'))(new Redis(config[_0x63de('0x16')]));require(_0x63de('0x1a'))[_0x63de('0x1b')](socket);function respondWithStatusCode(_0x120037,_0xc3f7d6){_0xc3f7d6=_0xc3f7d6||0xcc;return function(_0x2a167d){if(_0x2a167d){return _0x120037[_0x63de('0x1c')](_0xc3f7d6);}return _0x120037[_0x63de('0x1d')](_0xc3f7d6)['end']();};}function respondWithResult(_0x389dfd,_0x31b226){_0x31b226=_0x31b226||0xc8;return function(_0x15101a){if(_0x15101a){return _0x389dfd[_0x63de('0x1d')](_0x31b226)[_0x63de('0x1e')](_0x15101a);}};}function respondWithFilteredResult(_0x5255ed,_0x3e8027){return function(_0x3b8bdb){if(_0x3b8bdb){var _0x50f888=typeof _0x3e8027[_0x63de('0x1f')]==='undefined'&&typeof _0x3e8027[_0x63de('0x20')]===_0x63de('0x21');var _0x58622e=_0x3b8bdb[_0x63de('0x22')];var _0x49ff26=_0x50f888?0x0:_0x3e8027['offset'];var _0x2d5c66=_0x50f888?_0x3b8bdb[_0x63de('0x22')]:_0x3e8027['offset']+_0x3e8027[_0x63de('0x20')];var _0x40fb9c;if(_0x2d5c66>=_0x58622e){_0x2d5c66=_0x58622e;_0x40fb9c=0xc8;}else{_0x40fb9c=0xce;}_0x5255ed['status'](_0x40fb9c);return _0x5255ed[_0x63de('0x23')]('Content-Range',_0x49ff26+'-'+_0x2d5c66+'/'+_0x58622e)[_0x63de('0x1e')](_0x3b8bdb);}return null;};}function patchUpdates(_0x237e4f){return function(_0x1f0c34){try{jsonpatch[_0x63de('0x24')](_0x1f0c34,_0x237e4f,!![]);}catch(_0x67ed49){return BPromise['reject'](_0x67ed49);}return _0x1f0c34['save']();};}function saveUpdates(_0x24c664,_0x3c02a7){return function(_0x4c94db){if(_0x4c94db){return _0x4c94db[_0x63de('0x25')](_0x24c664)['then'](function(_0x582634){return _0x582634;});}return null;};}function removeEntity(_0x17af46,_0x30b1d4){return function(_0x19845b){if(_0x19845b){return _0x19845b['destroy']()[_0x63de('0x26')](function(){var _0x34610f=_0x19845b[_0x63de('0x27')]({'plain':!![]});var _0x2f7600=_0x63de('0x28');return db['UserProfileResource'][_0x63de('0x29')]({'where':{'type':_0x2f7600,'resourceId':_0x34610f['id']}})[_0x63de('0x26')](function(){return _0x19845b;});})['then'](function(){_0x17af46[_0x63de('0x1d')](0xcc)[_0x63de('0x2a')]();});}};}function handleEntityNotFound(_0x13bf79,_0x2e322c){return function(_0x59ae8f){if(!_0x59ae8f){_0x13bf79[_0x63de('0x1c')](0x194);}return _0x59ae8f;};}function handleError(_0xaf2384,_0xd562a0){_0xd562a0=_0xd562a0||0x1f4;return function(_0x1a6780){logger['error'](_0x1a6780['stack']);if(_0x1a6780[_0x63de('0x2b')]){delete _0x1a6780[_0x63de('0x2b')];}_0xaf2384[_0x63de('0x1d')](_0xd562a0)[_0x63de('0x2c')](_0x1a6780);};}exports['index']=function(_0x2805f0,_0x1f6a5a){var _0x2af50e={},_0x3f6bb6={},_0x3ec1de={'count':0x0,'rows':[]};var _0xaab908=_['map'](db[_0x63de('0x2d')][_0x63de('0x2e')],function(_0x3d95fe){return{'name':_0x3d95fe[_0x63de('0x2f')],'type':_0x3d95fe[_0x63de('0x30')][_0x63de('0x31')]};});_0x3f6bb6[_0x63de('0x32')]=_[_0x63de('0x33')](_0xaab908,'name');_0x3f6bb6['query']=_[_0x63de('0x34')](_0x2805f0['query']);_0x3f6bb6[_0x63de('0x35')]=_[_0x63de('0x36')](_0x3f6bb6[_0x63de('0x32')],_0x3f6bb6['query']);_0x2af50e[_0x63de('0x37')]=_[_0x63de('0x36')](_0x3f6bb6[_0x63de('0x32')],qs[_0x63de('0x38')](_0x2805f0[_0x63de('0x39')]['fields']));_0x2af50e[_0x63de('0x37')]=_0x2af50e[_0x63de('0x37')][_0x63de('0x3a')]?_0x2af50e[_0x63de('0x37')]:_0x3f6bb6[_0x63de('0x32')];if(!_0x2805f0[_0x63de('0x39')][_0x63de('0x3b')](_0x63de('0x3c'))){_0x2af50e[_0x63de('0x20')]=qs[_0x63de('0x20')](_0x2805f0['query'][_0x63de('0x20')]);_0x2af50e[_0x63de('0x1f')]=qs[_0x63de('0x1f')](_0x2805f0[_0x63de('0x39')][_0x63de('0x1f')]);}_0x2af50e[_0x63de('0x3d')]=qs[_0x63de('0x3e')](_0x2805f0[_0x63de('0x39')][_0x63de('0x3e')]);_0x2af50e[_0x63de('0x3f')]=qs[_0x63de('0x35')](_['pick'](_0x2805f0[_0x63de('0x39')],_0x3f6bb6[_0x63de('0x35')]),_0xaab908);if(_0x2805f0[_0x63de('0x39')][_0x63de('0x40')]){_0x2af50e[_0x63de('0x3f')]=_[_0x63de('0x41')](_0x2af50e['where'],{'$or':_[_0x63de('0x33')](_0xaab908,function(_0x1b622a){if(_0x1b622a[_0x63de('0x30')]!==_0x63de('0x42')){var _0x58f519={};_0x58f519[_0x1b622a[_0x63de('0x2b')]]={'$like':'%'+_0x2805f0[_0x63de('0x39')][_0x63de('0x40')]+'%'};return _0x58f519;}})});}_0x2af50e=_[_0x63de('0x41')]({},_0x2af50e,_0x2805f0[_0x63de('0x43')]);var _0x288117={'where':_0x2af50e[_0x63de('0x3f')]};return db[_0x63de('0x2d')][_0x63de('0x22')](_0x288117)[_0x63de('0x26')](function(_0x277b97){_0x3ec1de[_0x63de('0x22')]=_0x277b97;if(_0x2805f0[_0x63de('0x39')][_0x63de('0x44')]){_0x2af50e['include']=[{'all':!![]}];}return db[_0x63de('0x2d')][_0x63de('0x45')](_0x2af50e);})[_0x63de('0x26')](function(_0x3bac78){_0x3ec1de[_0x63de('0x46')]=_0x3bac78;return _0x3ec1de;})[_0x63de('0x26')](respondWithFilteredResult(_0x1f6a5a,_0x2af50e))[_0x63de('0x47')](handleError(_0x1f6a5a,null));};exports['show']=function(_0x5d5fb0,_0x17fedc){var _0x4d0ae8={'raw':![],'where':{'id':_0x5d5fb0[_0x63de('0x48')]['id']}},_0x4001f2={};_0x4001f2[_0x63de('0x32')]=_[_0x63de('0x34')](db[_0x63de('0x2d')][_0x63de('0x2e')]);_0x4001f2[_0x63de('0x39')]=_[_0x63de('0x34')](_0x5d5fb0[_0x63de('0x39')]);_0x4001f2['filters']=_[_0x63de('0x36')](_0x4001f2['model'],_0x4001f2['query']);_0x4d0ae8[_0x63de('0x37')]=_[_0x63de('0x36')](_0x4001f2['model'],qs[_0x63de('0x38')](_0x5d5fb0['query'][_0x63de('0x38')]));_0x4d0ae8[_0x63de('0x37')]=_0x4d0ae8['attributes'][_0x63de('0x3a')]?_0x4d0ae8[_0x63de('0x37')]:_0x4001f2[_0x63de('0x32')];if(_0x5d5fb0['query'][_0x63de('0x44')]){_0x4d0ae8[_0x63de('0x49')]=[{'all':!![]}];}_0x4d0ae8=_[_0x63de('0x41')]({},_0x4d0ae8,_0x5d5fb0[_0x63de('0x43')]);return db[_0x63de('0x2d')]['find'](_0x4d0ae8)[_0x63de('0x26')](handleEntityNotFound(_0x17fedc,null))['then'](respondWithResult(_0x17fedc,null))[_0x63de('0x47')](handleError(_0x17fedc,null));};exports[_0x63de('0x4a')]=function(_0x317aed,_0x371d33){return db[_0x63de('0x2d')][_0x63de('0x4a')](_0x317aed[_0x63de('0x4b')],{})['then'](function(_0x1a150e){var _0x56b04f=_0x317aed[_0x63de('0x4c')]['get']({'plain':!![]});if(!_0x56b04f)throw new Error(_0x63de('0x4d'));if(_0x56b04f[_0x63de('0x4e')]===_0x63de('0x4c')){var _0x4f8ab5=_0x1a150e[_0x63de('0x27')]({'plain':!![]});var _0x5cbe9f=_0x63de('0x28');return db['UserProfileSection'][_0x63de('0x4f')]({'where':{'name':_0x5cbe9f,'userProfileId':_0x56b04f['userProfileId']},'raw':!![]})[_0x63de('0x26')](function(_0x491a38){if(_0x491a38&&_0x491a38[_0x63de('0x50')]===0x0){return db[_0x63de('0x51')][_0x63de('0x4a')]({'name':_0x4f8ab5[_0x63de('0x2b')],'resourceId':_0x4f8ab5['id'],'type':_0x491a38['name'],'sectionId':_0x491a38['id']},{})[_0x63de('0x26')](function(){return _0x1a150e;});}else{return _0x1a150e;}})[_0x63de('0x47')](function(_0x43ad83){logger[_0x63de('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43ad83);throw _0x43ad83;});}return _0x1a150e;})[_0x63de('0x26')](respondWithResult(_0x371d33,0xc9))[_0x63de('0x47')](handleError(_0x371d33,null));};exports[_0x63de('0x53')]=function(_0x4c5ffc,_0x32eb17){var _0x530a20={'where':{'id':_0x4c5ffc[_0x63de('0x48')]['id']}},_0x5311a9={};_0x5311a9[_0x63de('0x32')]=_['keys'](db[_0x63de('0x2d')][_0x63de('0x2e')]);_0x530a20['attributes']=_[_0x63de('0x36')](_0x5311a9['model'],qs[_0x63de('0x38')](_0x4c5ffc['query'][_0x63de('0x38')]));_0x530a20[_0x63de('0x37')]=_0x530a20[_0x63de('0x37')][_0x63de('0x3a')]?_0x530a20[_0x63de('0x37')]:_0x5311a9['model'];if(_0x4c5ffc[_0x63de('0x39')]['includeAll']){_0x530a20['include']=[{'all':!![]}];}_0x530a20=_['merge']({},_0x530a20,_0x4c5ffc[_0x63de('0x43')]);return db[_0x63de('0x2d')]['find'](_0x530a20)[_0x63de('0x26')](handleEntityNotFound(_0x32eb17,null))[_0x63de('0x26')](function(_0x10709b){if(_0x10709b){var _0x3e0d7e=_0x10709b[_0x63de('0x27')]({'plain':!![]});_0x3e0d7e=qs[_0x63de('0x54')](_0x3e0d7e,['id','createdAt',_0x63de('0x55')]);_0x4c5ffc['body']=_[_0x63de('0x54')](_0x4c5ffc['body'],['id',_0x63de('0x56'),_0x63de('0x55')]);return db[_0x63de('0x2d')][_0x63de('0x4a')](_[_0x63de('0x41')](_0x3e0d7e,_0x4c5ffc[_0x63de('0x4b')]),{'include':_0x4c5ffc['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x233727){var _0x2de588=_0x4c5ffc['user'][_0x63de('0x27')]({'plain':!![]});if(!_0x2de588)throw new Error(_0x63de('0x4d'));if(_0x2de588[_0x63de('0x4e')]===_0x63de('0x4c')){var _0x4e04e4=_0x233727['get']({'plain':!![]});var _0x23d0f8=_0x63de('0x28');return db[_0x63de('0x57')][_0x63de('0x4f')]({'where':{'name':_0x23d0f8,'userProfileId':_0x2de588[_0x63de('0x58')]},'raw':!![]})[_0x63de('0x26')](function(_0x12de0c){if(_0x12de0c&&_0x12de0c[_0x63de('0x50')]===0x0){return db[_0x63de('0x51')][_0x63de('0x4a')]({'name':_0x4e04e4[_0x63de('0x2b')],'resourceId':_0x4e04e4['id'],'type':_0x12de0c[_0x63de('0x2b')],'sectionId':_0x12de0c['id']},{})[_0x63de('0x26')](function(){return _0x233727;});}else{return _0x233727;}})[_0x63de('0x47')](function(_0x429e18){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429e18);throw _0x429e18;});}return _0x233727;});}})[_0x63de('0x26')](respondWithResult(_0x32eb17,0xc9))[_0x63de('0x47')](handleError(_0x32eb17,null));};exports[_0x63de('0x25')]=function(_0x378e30,_0x2f1c50){if(_0x378e30[_0x63de('0x4b')]['id']){delete _0x378e30['body']['id'];}return db[_0x63de('0x2d')][_0x63de('0x4f')]({'where':{'id':_0x378e30['params']['id']}})[_0x63de('0x26')](handleEntityNotFound(_0x2f1c50,null))[_0x63de('0x26')](saveUpdates(_0x378e30[_0x63de('0x4b')],null))['then'](respondWithResult(_0x2f1c50,null))[_0x63de('0x47')](handleError(_0x2f1c50,null));};exports[_0x63de('0x29')]=function(_0x505ec4,_0x1fc914){return db[_0x63de('0x2d')][_0x63de('0x4f')]({'where':{'id':_0x505ec4[_0x63de('0x48')]['id']}})[_0x63de('0x26')](handleEntityNotFound(_0x1fc914,null))['then'](removeEntity(_0x1fc914,null))[_0x63de('0x47')](handleError(_0x1fc914,null));};function widgetAttributes(_0x55c280){try{switch(_0x55c280[_0x63de('0x30')]){case _0x63de('0x59'):return[{'name':'attrUrl','value':_0x55c280[_0x63de('0x5a')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280['attrs'][0x0]['value']:undefined)||_0x63de('0x5c')}];case'custom':return[{'name':'attrPath','value':_0x55c280[_0x63de('0x5d')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280['attrs'][0x0][_0x63de('0x5e')]:undefined)||''}];case _0x63de('0x5f'):return[{'name':_0x63de('0x60'),'value':_0x55c280[_0x63de('0x60')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280[_0x63de('0x5b')][0x0][_0x63de('0x5e')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x55c280[_0x63de('0x61')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x1]?_0x55c280[_0x63de('0x5b')][0x1]['value']:undefined)||_0x63de('0x62')},{'name':'attrFontSize','value':_0x55c280[_0x63de('0x63')]||(_0x55c280['attrs']&&_0x55c280[_0x63de('0x5b')][0x2]?_0x55c280['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x63de('0x64'),'value':_0x55c280[_0x63de('0x64')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280['attrs'][0x0][_0x63de('0x5e')]:undefined)||_0x63de('0x65')},{'name':_0x63de('0x66'),'value':_0x55c280[_0x63de('0x66')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x1]?_0x55c280[_0x63de('0x5b')][0x1][_0x63de('0x5e')]:undefined)||[]},{'name':_0x63de('0x63'),'value':_0x55c280[_0x63de('0x63')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x2]?_0x55c280[_0x63de('0x5b')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x63de('0x67'),'value':_0x55c280[_0x63de('0x67')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280['attrs'][0x0][_0x63de('0x5e')]:undefined)||_0x63de('0x65')},{'name':_0x63de('0x68'),'value':_0x55c280[_0x63de('0x68')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x1]?_0x55c280[_0x63de('0x5b')][0x1][_0x63de('0x5e')]:undefined)||null},{'name':_0x63de('0x69'),'value':_0x55c280['attrSerie3']||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x2]?_0x55c280['attrs'][0x2][_0x63de('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x55c280['attrVoiceQueues']||(_0x55c280[_0x63de('0x5b')]&&_0x55c280['attrs'][0x3]?_0x55c280['attrs'][0x3][_0x63de('0x5e')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x55c280[_0x63de('0x6a')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280['attrs'][0x0][_0x63de('0x30')]:undefined)||null,'value':_0x55c280[_0x63de('0x6b')]||(_0x55c280[_0x63de('0x5b')]&&_0x55c280[_0x63de('0x5b')][0x0]?_0x55c280['attrs'][0x0][_0x63de('0x5e')]:undefined)||null},{'name':_0x63de('0x6c'),'value':_0x55c280[_0x63de('0x6c')]||(_0x55c280['attrs']&&_0x55c280[_0x63de('0x5b')][0x1]?_0x55c280[_0x63de('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x468e65){logger[_0x63de('0x52')](_0x63de('0x6d'),JSON[_0x63de('0x6e')](_0x468e65));return[];}}exports['addItem']=function(_0x319a3b,_0x8e67be,_0x42c31c){if(_0x319a3b[_0x63de('0x4b')]['id']){delete _0x319a3b['body']['id'];}return db['Dashboard'][_0x63de('0x4f')]({'where':{'id':_0x319a3b[_0x63de('0x48')]['id']}})['then'](handleEntityNotFound(_0x8e67be,null))[_0x63de('0x26')](function(_0x58e0f2){if(_0x58e0f2){_0x319a3b['body'][_0x63de('0x6f')]=_0x58e0f2['id'];_0x319a3b[_0x63de('0x4b')][_0x63de('0x5b')]=widgetAttributes(_0x319a3b[_0x63de('0x4b')]);return db[_0x63de('0x70')][_0x63de('0x4a')](_0x319a3b[_0x63de('0x4b')]);}})[_0x63de('0x26')](respondWithResult(_0x8e67be,null))['catch'](handleError(_0x8e67be,null));};exports[_0x63de('0x71')]=function(_0x502d99,_0x56d217,_0x10b7ea){var _0x2ee87b={};var _0x47293c={};var _0x4beb62;var _0x4787c8;return db[_0x63de('0x2d')]['findOne']({'where':{'id':_0x502d99[_0x63de('0x48')]['id']}})[_0x63de('0x26')](handleEntityNotFound(_0x56d217,null))[_0x63de('0x26')](function(_0x575737){if(_0x575737){_0x4beb62=_0x575737;_0x47293c[_0x63de('0x32')]=_[_0x63de('0x34')](db[_0x63de('0x70')]['rawAttributes']);_0x47293c['query']=_[_0x63de('0x34')](_0x502d99[_0x63de('0x39')]);_0x47293c[_0x63de('0x35')]=_[_0x63de('0x36')](_0x47293c[_0x63de('0x32')],_0x47293c[_0x63de('0x39')]);_0x2ee87b[_0x63de('0x37')]=_[_0x63de('0x36')](_0x47293c[_0x63de('0x32')],qs[_0x63de('0x38')](_0x502d99[_0x63de('0x39')][_0x63de('0x38')]));_0x2ee87b[_0x63de('0x37')]=_0x2ee87b[_0x63de('0x37')][_0x63de('0x3a')]?_0x2ee87b[_0x63de('0x37')]:_0x47293c[_0x63de('0x32')];_0x2ee87b[_0x63de('0x3d')]=qs[_0x63de('0x3e')](_0x502d99[_0x63de('0x39')][_0x63de('0x3e')]);_0x2ee87b[_0x63de('0x3f')]=qs[_0x63de('0x35')](_[_0x63de('0x72')](_0x502d99['query'],_0x47293c[_0x63de('0x35')]));if(_0x502d99[_0x63de('0x39')][_0x63de('0x40')]){_0x2ee87b[_0x63de('0x3f')]=_[_0x63de('0x41')](_0x2ee87b[_0x63de('0x3f')],{'$or':_[_0x63de('0x33')](_0x2ee87b[_0x63de('0x37')],function(_0x7d5b4a){var _0x250e9f={};_0x250e9f[_0x7d5b4a]={'$like':'%'+_0x502d99[_0x63de('0x39')][_0x63de('0x40')]+'%'};return _0x250e9f;})});}_0x2ee87b=_[_0x63de('0x41')]({},_0x2ee87b,_0x502d99[_0x63de('0x43')]);return _0x4beb62[_0x63de('0x71')](_0x2ee87b);}})[_0x63de('0x26')](function(_0x32d1bb){if(_0x32d1bb){_0x4787c8=_0x32d1bb[_0x63de('0x3a')];if(!_0x502d99[_0x63de('0x39')][_0x63de('0x3b')](_0x63de('0x3c'))){_0x2ee87b[_0x63de('0x20')]=qs[_0x63de('0x20')](_0x502d99[_0x63de('0x39')]['limit']);_0x2ee87b[_0x63de('0x1f')]=qs[_0x63de('0x1f')](_0x502d99[_0x63de('0x39')][_0x63de('0x1f')]);}return _0x4beb62[_0x63de('0x71')](_0x2ee87b);}})[_0x63de('0x26')](function(_0x487cb4){if(_0x487cb4){return _0x487cb4?{'count':_0x4787c8,'rows':_0x487cb4}:null;}})[_0x63de('0x26')](respondWithResult(_0x56d217,null))[_0x63de('0x47')](handleError(_0x56d217,null));}; \ No newline at end of file +var _0x1fb1=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','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','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','get','CustomDashboards','destroy','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileResource','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x1fb1,0x8c));var _0x11fb=function(_0x25b9a1,_0x3e141b){_0x25b9a1=_0x25b9a1-0x0;var _0x2dff67=_0x1fb1[_0x25b9a1];return _0x2dff67;};'use strict';var emlformat=require(_0x11fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x11fb('0x1'));var rp=require(_0x11fb('0x2'));var moment=require('moment');var BPromise=require(_0x11fb('0x3'));var Mustache=require(_0x11fb('0x4'));var util=require(_0x11fb('0x5'));var path=require('path');var sox=require(_0x11fb('0x6'));var csv=require(_0x11fb('0x7'));var ejs=require(_0x11fb('0x8'));var fs=require('fs');var fs_extra=require(_0x11fb('0x9'));var _=require(_0x11fb('0xa'));var squel=require(_0x11fb('0xb'));var crypto=require(_0x11fb('0xc'));var jsforce=require(_0x11fb('0xd'));var deskjs=require(_0x11fb('0xe'));var toCsv=require(_0x11fb('0x7'));var querystring=require(_0x11fb('0xf'));var Papa=require(_0x11fb('0x10'));var Redis=require(_0x11fb('0x11'));var authService=require(_0x11fb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x11fb('0x13'));var hardwareService=require(_0x11fb('0x14'));var logger=require(_0x11fb('0x15'))(_0x11fb('0x16'));var utils=require(_0x11fb('0x17'));var config=require(_0x11fb('0x18'));var licenseUtil=require(_0x11fb('0x19'));var db=require(_0x11fb('0x1a'))['db'];config[_0x11fb('0x1b')]=_[_0x11fb('0x1c')](config[_0x11fb('0x1b')],{'host':_0x11fb('0x1d'),'port':0x18eb});var socket=require(_0x11fb('0x1e'))(new Redis(config['redis']));require(_0x11fb('0x1f'))['register'](socket);function respondWithStatusCode(_0x57a2ba,_0x2986c8){_0x2986c8=_0x2986c8||0xcc;return function(_0xc6c9bc){if(_0xc6c9bc){return _0x57a2ba[_0x11fb('0x20')](_0x2986c8);}return _0x57a2ba['status'](_0x2986c8)['end']();};}function respondWithResult(_0x1c3a03,_0x22f30f){_0x22f30f=_0x22f30f||0xc8;return function(_0x359fe7){if(_0x359fe7){return _0x1c3a03['status'](_0x22f30f)['json'](_0x359fe7);}};}function respondWithFilteredResult(_0x4398a1,_0x4cd21b){return function(_0x180285){if(_0x180285){var _0x1cb53b=typeof _0x4cd21b[_0x11fb('0x21')]===_0x11fb('0x22')&&typeof _0x4cd21b[_0x11fb('0x23')]===_0x11fb('0x22');var _0x287733=_0x180285[_0x11fb('0x24')];var _0x33ca51=_0x1cb53b?0x0:_0x4cd21b[_0x11fb('0x21')];var _0x2a1082=_0x1cb53b?_0x180285[_0x11fb('0x24')]:_0x4cd21b[_0x11fb('0x21')]+_0x4cd21b['limit'];var _0x34dd19;if(_0x2a1082>=_0x287733){_0x2a1082=_0x287733;_0x34dd19=0xc8;}else{_0x34dd19=0xce;}_0x4398a1[_0x11fb('0x25')](_0x34dd19);return _0x4398a1[_0x11fb('0x26')]('Content-Range',_0x33ca51+'-'+_0x2a1082+'/'+_0x287733)[_0x11fb('0x27')](_0x180285);}return null;};}function patchUpdates(_0x477c03){return function(_0x5afc65){try{jsonpatch[_0x11fb('0x28')](_0x5afc65,_0x477c03,!![]);}catch(_0x4067a9){return BPromise[_0x11fb('0x29')](_0x4067a9);}return _0x5afc65[_0x11fb('0x2a')]();};}function saveUpdates(_0x71b8c4,_0x29daca){return function(_0x55af7c){if(_0x55af7c){return _0x55af7c[_0x11fb('0x2b')](_0x71b8c4)[_0x11fb('0x2c')](function(_0x4bded3){return _0x4bded3;});}return null;};}function removeEntity(_0x5541c1,_0x374795){return function(_0xff5004){if(_0xff5004){return _0xff5004['destroy']()[_0x11fb('0x2c')](function(){var _0x3f4afd=_0xff5004[_0x11fb('0x2d')]({'plain':!![]});var _0x1a7e0f=_0x11fb('0x2e');return db['UserProfileResource'][_0x11fb('0x2f')]({'where':{'type':_0x1a7e0f,'resourceId':_0x3f4afd['id']}})[_0x11fb('0x2c')](function(){return _0xff5004;});})[_0x11fb('0x2c')](function(){_0x5541c1['status'](0xcc)[_0x11fb('0x30')]();});}};}function handleEntityNotFound(_0xa40d78,_0x34d04d){return function(_0x4c6749){if(!_0x4c6749){_0xa40d78[_0x11fb('0x20')](0x194);}return _0x4c6749;};}function handleError(_0x3b01ee,_0x33aafe){_0x33aafe=_0x33aafe||0x1f4;return function(_0x4b14dc){logger[_0x11fb('0x31')](_0x4b14dc[_0x11fb('0x32')]);if(_0x4b14dc[_0x11fb('0x33')]){delete _0x4b14dc[_0x11fb('0x33')];}_0x3b01ee['status'](_0x33aafe)[_0x11fb('0x34')](_0x4b14dc);};}exports[_0x11fb('0x35')]=function(_0x50a58e,_0x59d6d6){var _0x5a6db8={},_0x1e371b={},_0x2ca922={'count':0x0,'rows':[]};var _0x46e047=_[_0x11fb('0x36')](db[_0x11fb('0x37')][_0x11fb('0x38')],function(_0x1d50b6){return{'name':_0x1d50b6[_0x11fb('0x39')],'type':_0x1d50b6[_0x11fb('0x3a')][_0x11fb('0x3b')]};});_0x1e371b[_0x11fb('0x3c')]=_[_0x11fb('0x36')](_0x46e047,'name');_0x1e371b[_0x11fb('0x3d')]=_['keys'](_0x50a58e[_0x11fb('0x3d')]);_0x1e371b[_0x11fb('0x3e')]=_['intersection'](_0x1e371b[_0x11fb('0x3c')],_0x1e371b['query']);_0x5a6db8['attributes']=_[_0x11fb('0x3f')](_0x1e371b[_0x11fb('0x3c')],qs[_0x11fb('0x40')](_0x50a58e[_0x11fb('0x3d')]['fields']));_0x5a6db8[_0x11fb('0x41')]=_0x5a6db8['attributes'][_0x11fb('0x42')]?_0x5a6db8['attributes']:_0x1e371b[_0x11fb('0x3c')];if(!_0x50a58e[_0x11fb('0x3d')][_0x11fb('0x43')](_0x11fb('0x44'))){_0x5a6db8[_0x11fb('0x23')]=qs['limit'](_0x50a58e[_0x11fb('0x3d')][_0x11fb('0x23')]);_0x5a6db8[_0x11fb('0x21')]=qs[_0x11fb('0x21')](_0x50a58e['query']['offset']);}_0x5a6db8[_0x11fb('0x45')]=qs[_0x11fb('0x46')](_0x50a58e[_0x11fb('0x3d')]['sort']);_0x5a6db8[_0x11fb('0x47')]=qs[_0x11fb('0x3e')](_[_0x11fb('0x48')](_0x50a58e[_0x11fb('0x3d')],_0x1e371b[_0x11fb('0x3e')]),_0x46e047);if(_0x50a58e['query'][_0x11fb('0x49')]){_0x5a6db8['where']=_[_0x11fb('0x4a')](_0x5a6db8[_0x11fb('0x47')],{'$or':_[_0x11fb('0x36')](_0x46e047,function(_0x193376){if(_0x193376[_0x11fb('0x3a')]!==_0x11fb('0x4b')){var _0x1c8ef0={};_0x1c8ef0[_0x193376['name']]={'$like':'%'+_0x50a58e[_0x11fb('0x3d')][_0x11fb('0x49')]+'%'};return _0x1c8ef0;}})});}_0x5a6db8=_['merge']({},_0x5a6db8,_0x50a58e[_0x11fb('0x4c')]);var _0x10d0e1={'where':_0x5a6db8['where']};return db[_0x11fb('0x37')][_0x11fb('0x24')](_0x10d0e1)['then'](function(_0x4927d7){_0x2ca922[_0x11fb('0x24')]=_0x4927d7;if(_0x50a58e['query']['includeAll']){_0x5a6db8[_0x11fb('0x4d')]=[{'all':!![]}];}return db[_0x11fb('0x37')][_0x11fb('0x4e')](_0x5a6db8);})['then'](function(_0x2da3a0){_0x2ca922['rows']=_0x2da3a0;return _0x2ca922;})[_0x11fb('0x2c')](respondWithFilteredResult(_0x59d6d6,_0x5a6db8))[_0x11fb('0x4f')](handleError(_0x59d6d6,null));};exports[_0x11fb('0x50')]=function(_0x3ac3a8,_0x2a6926){var _0x412af7={'raw':![],'where':{'id':_0x3ac3a8[_0x11fb('0x51')]['id']}},_0x5b5092={};_0x5b5092[_0x11fb('0x3c')]=_['keys'](db['Dashboard'][_0x11fb('0x38')]);_0x5b5092[_0x11fb('0x3d')]=_[_0x11fb('0x52')](_0x3ac3a8[_0x11fb('0x3d')]);_0x5b5092[_0x11fb('0x3e')]=_[_0x11fb('0x3f')](_0x5b5092['model'],_0x5b5092['query']);_0x412af7[_0x11fb('0x41')]=_[_0x11fb('0x3f')](_0x5b5092['model'],qs['fields'](_0x3ac3a8[_0x11fb('0x3d')][_0x11fb('0x40')]));_0x412af7[_0x11fb('0x41')]=_0x412af7['attributes'][_0x11fb('0x42')]?_0x412af7[_0x11fb('0x41')]:_0x5b5092[_0x11fb('0x3c')];if(_0x3ac3a8[_0x11fb('0x3d')][_0x11fb('0x53')]){_0x412af7['include']=[{'all':!![]}];}_0x412af7=_[_0x11fb('0x4a')]({},_0x412af7,_0x3ac3a8[_0x11fb('0x4c')]);return db[_0x11fb('0x37')][_0x11fb('0x54')](_0x412af7)[_0x11fb('0x2c')](handleEntityNotFound(_0x2a6926,null))[_0x11fb('0x2c')](respondWithResult(_0x2a6926,null))[_0x11fb('0x4f')](handleError(_0x2a6926,null));};exports[_0x11fb('0x55')]=function(_0x139a6b,_0x33ee8f){return db[_0x11fb('0x37')]['create'](_0x139a6b[_0x11fb('0x56')],{})[_0x11fb('0x2c')](function(_0x383297){var _0x1ab19a=_0x139a6b[_0x11fb('0x57')]['get']({'plain':!![]});if(!_0x1ab19a)throw new Error(_0x11fb('0x58'));if(_0x1ab19a[_0x11fb('0x59')]===_0x11fb('0x57')){var _0x5f4544=_0x383297[_0x11fb('0x2d')]({'plain':!![]});var _0x123812=_0x11fb('0x2e');return db[_0x11fb('0x5a')]['find']({'where':{'name':_0x123812,'userProfileId':_0x1ab19a[_0x11fb('0x5b')]},'raw':!![]})[_0x11fb('0x2c')](function(_0x47a362){if(_0x47a362&&_0x47a362[_0x11fb('0x5c')]===0x0){return db['UserProfileResource'][_0x11fb('0x55')]({'name':_0x5f4544[_0x11fb('0x33')],'resourceId':_0x5f4544['id'],'type':_0x47a362[_0x11fb('0x33')],'sectionId':_0x47a362['id']},{})[_0x11fb('0x2c')](function(){return _0x383297;});}else{return _0x383297;}})[_0x11fb('0x4f')](function(_0x18984e){logger[_0x11fb('0x31')](_0x11fb('0x5d'),_0x18984e);throw _0x18984e;});}return _0x383297;})[_0x11fb('0x2c')](respondWithResult(_0x33ee8f,0xc9))[_0x11fb('0x4f')](handleError(_0x33ee8f,null));};exports['clone']=function(_0x260a90,_0x411920){var _0x1078a2={'where':{'id':_0x260a90[_0x11fb('0x51')]['id']}},_0xfe1c65={};_0xfe1c65[_0x11fb('0x3c')]=_[_0x11fb('0x52')](db[_0x11fb('0x37')][_0x11fb('0x38')]);_0x1078a2[_0x11fb('0x41')]=_[_0x11fb('0x3f')](_0xfe1c65['model'],qs['fields'](_0x260a90[_0x11fb('0x3d')][_0x11fb('0x40')]));_0x1078a2[_0x11fb('0x41')]=_0x1078a2[_0x11fb('0x41')][_0x11fb('0x42')]?_0x1078a2[_0x11fb('0x41')]:_0xfe1c65[_0x11fb('0x3c')];if(_0x260a90[_0x11fb('0x3d')][_0x11fb('0x53')]){_0x1078a2['include']=[{'all':!![]}];}_0x1078a2=_[_0x11fb('0x4a')]({},_0x1078a2,_0x260a90['options']);return db['Dashboard'][_0x11fb('0x54')](_0x1078a2)[_0x11fb('0x2c')](handleEntityNotFound(_0x411920,null))[_0x11fb('0x2c')](function(_0x12b04f){if(_0x12b04f){var _0x4865d9=_0x12b04f[_0x11fb('0x2d')]({'plain':!![]});_0x4865d9=qs[_0x11fb('0x5e')](_0x4865d9,['id',_0x11fb('0x5f'),_0x11fb('0x60')]);_0x260a90[_0x11fb('0x56')]=_['omit'](_0x260a90[_0x11fb('0x56')],['id',_0x11fb('0x5f'),'updatedAt']);return db['Dashboard']['create'](_[_0x11fb('0x4a')](_0x4865d9,_0x260a90['body']),{'include':_0x260a90['query'][_0x11fb('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x2398ef){var _0x3147af=_0x260a90[_0x11fb('0x57')]['get']({'plain':!![]});if(!_0x3147af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3147af[_0x11fb('0x59')]===_0x11fb('0x57')){var _0x4b630b=_0x2398ef['get']({'plain':!![]});var _0x2c0e88=_0x11fb('0x2e');return db[_0x11fb('0x5a')]['find']({'where':{'name':_0x2c0e88,'userProfileId':_0x3147af[_0x11fb('0x5b')]},'raw':!![]})[_0x11fb('0x2c')](function(_0x45361c){if(_0x45361c&&_0x45361c[_0x11fb('0x5c')]===0x0){return db[_0x11fb('0x61')][_0x11fb('0x55')]({'name':_0x4b630b[_0x11fb('0x33')],'resourceId':_0x4b630b['id'],'type':_0x45361c[_0x11fb('0x33')],'sectionId':_0x45361c['id']},{})[_0x11fb('0x2c')](function(){return _0x2398ef;});}else{return _0x2398ef;}})[_0x11fb('0x4f')](function(_0xa9fa77){logger[_0x11fb('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa9fa77);throw _0xa9fa77;});}return _0x2398ef;});}})['then'](respondWithResult(_0x411920,0xc9))[_0x11fb('0x4f')](handleError(_0x411920,null));};exports[_0x11fb('0x2b')]=function(_0x11b0f5,_0x53955e){if(_0x11b0f5[_0x11fb('0x56')]['id']){delete _0x11b0f5[_0x11fb('0x56')]['id'];}return db[_0x11fb('0x37')][_0x11fb('0x54')]({'where':{'id':_0x11b0f5[_0x11fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x53955e,null))[_0x11fb('0x2c')](saveUpdates(_0x11b0f5[_0x11fb('0x56')],null))['then'](respondWithResult(_0x53955e,null))[_0x11fb('0x4f')](handleError(_0x53955e,null));};exports['destroy']=function(_0x4071b6,_0x4a21b9){return db[_0x11fb('0x37')][_0x11fb('0x54')]({'where':{'id':_0x4071b6[_0x11fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a21b9,null))[_0x11fb('0x2c')](removeEntity(_0x4a21b9,null))[_0x11fb('0x4f')](handleError(_0x4a21b9,null));};function widgetAttributes(_0x4874cf){try{switch(_0x4874cf[_0x11fb('0x3a')]){case'iframe':return[{'name':'attrUrl','value':_0x4874cf[_0x11fb('0x62')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf[_0x11fb('0x63')][0x0][_0x11fb('0x64')]:undefined)||'https://'}];case _0x11fb('0x65'):return[{'name':_0x11fb('0x66'),'value':_0x4874cf['attrPath']||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf['attrs'][0x0][_0x11fb('0x64')]:undefined)||''}];case _0x11fb('0x67'):return[{'name':'attrHourFormat','value':_0x4874cf[_0x11fb('0x68')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf[_0x11fb('0x63')][0x0]['value']:undefined)||_0x11fb('0x69')},{'name':'attrTimezone','value':_0x4874cf[_0x11fb('0x6a')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x1]?_0x4874cf[_0x11fb('0x63')][0x1][_0x11fb('0x64')]:undefined)||'0.00'},{'name':_0x11fb('0x6b'),'value':_0x4874cf['attrFontSize']||(_0x4874cf['attrs']&&_0x4874cf['attrs'][0x2]?_0x4874cf['attrs'][0x2][_0x11fb('0x64')]:undefined)||0xc}];case _0x11fb('0x6c'):return[{'name':'attrMetric','value':_0x4874cf[_0x11fb('0x6d')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf[_0x11fb('0x63')][0x0][_0x11fb('0x64')]:undefined)||_0x11fb('0x6e')},{'name':_0x11fb('0x6f'),'value':_0x4874cf[_0x11fb('0x6f')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x1]?_0x4874cf[_0x11fb('0x63')][0x1][_0x11fb('0x64')]:undefined)||[]},{'name':_0x11fb('0x6b'),'value':_0x4874cf[_0x11fb('0x6b')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x2]?_0x4874cf['attrs'][0x2][_0x11fb('0x64')]:undefined)||0x14}];case'multibar-chart':case _0x11fb('0x70'):return[{'name':_0x11fb('0x71'),'value':_0x4874cf[_0x11fb('0x71')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf[_0x11fb('0x63')][0x0][_0x11fb('0x64')]:undefined)||_0x11fb('0x6e')},{'name':_0x11fb('0x72'),'value':_0x4874cf['attrSerie2']||(_0x4874cf['attrs']&&_0x4874cf[_0x11fb('0x63')][0x1]?_0x4874cf['attrs'][0x1][_0x11fb('0x64')]:undefined)||null},{'name':_0x11fb('0x73'),'value':_0x4874cf[_0x11fb('0x73')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x2]?_0x4874cf[_0x11fb('0x63')][0x2][_0x11fb('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4874cf[_0x11fb('0x6f')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x3]?_0x4874cf[_0x11fb('0x63')][0x3][_0x11fb('0x64')]:undefined)||[]}];case _0x11fb('0x74'):return[{'name':_0x11fb('0x75'),'type':_0x4874cf['reportType']||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf[_0x11fb('0x63')][0x0]['type']:undefined)||null,'value':_0x4874cf[_0x11fb('0x75')]||(_0x4874cf['attrs']&&_0x4874cf[_0x11fb('0x63')][0x0]?_0x4874cf['attrs'][0x0][_0x11fb('0x64')]:undefined)||null},{'name':_0x11fb('0x76'),'value':_0x4874cf[_0x11fb('0x76')]||(_0x4874cf[_0x11fb('0x63')]&&_0x4874cf[_0x11fb('0x63')][0x1]?_0x4874cf['attrs'][0x1][_0x11fb('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x57713c){logger['error'](_0x11fb('0x77'),JSON[_0x11fb('0x78')](_0x57713c));return[];}}exports[_0x11fb('0x79')]=function(_0x52d1c9,_0x5c79f5,_0x53d58f){if(_0x52d1c9[_0x11fb('0x56')]['id']){delete _0x52d1c9[_0x11fb('0x56')]['id'];}return db[_0x11fb('0x37')][_0x11fb('0x54')]({'where':{'id':_0x52d1c9[_0x11fb('0x51')]['id']}})[_0x11fb('0x2c')](handleEntityNotFound(_0x5c79f5,null))[_0x11fb('0x2c')](function(_0x4e2665){if(_0x4e2665){_0x52d1c9[_0x11fb('0x56')][_0x11fb('0x7a')]=_0x4e2665['id'];_0x52d1c9[_0x11fb('0x56')][_0x11fb('0x63')]=widgetAttributes(_0x52d1c9[_0x11fb('0x56')]);return db[_0x11fb('0x7b')][_0x11fb('0x55')](_0x52d1c9[_0x11fb('0x56')]);}})['then'](respondWithResult(_0x5c79f5,null))[_0x11fb('0x4f')](handleError(_0x5c79f5,null));};exports[_0x11fb('0x7c')]=function(_0x3d827a,_0x3bfdd4,_0x47b3b2){var _0x566c55={};var _0x24a70c={};var _0x2a98e5;var _0x34e446;return db[_0x11fb('0x37')][_0x11fb('0x7d')]({'where':{'id':_0x3d827a[_0x11fb('0x51')]['id']}})[_0x11fb('0x2c')](handleEntityNotFound(_0x3bfdd4,null))[_0x11fb('0x2c')](function(_0x54ea21){if(_0x54ea21){_0x2a98e5=_0x54ea21;_0x24a70c[_0x11fb('0x3c')]=_['keys'](db[_0x11fb('0x7b')][_0x11fb('0x38')]);_0x24a70c[_0x11fb('0x3d')]=_[_0x11fb('0x52')](_0x3d827a['query']);_0x24a70c['filters']=_[_0x11fb('0x3f')](_0x24a70c[_0x11fb('0x3c')],_0x24a70c[_0x11fb('0x3d')]);_0x566c55['attributes']=_[_0x11fb('0x3f')](_0x24a70c['model'],qs[_0x11fb('0x40')](_0x3d827a[_0x11fb('0x3d')][_0x11fb('0x40')]));_0x566c55[_0x11fb('0x41')]=_0x566c55[_0x11fb('0x41')]['length']?_0x566c55[_0x11fb('0x41')]:_0x24a70c[_0x11fb('0x3c')];_0x566c55[_0x11fb('0x45')]=qs[_0x11fb('0x46')](_0x3d827a['query'][_0x11fb('0x46')]);_0x566c55[_0x11fb('0x47')]=qs[_0x11fb('0x3e')](_[_0x11fb('0x48')](_0x3d827a[_0x11fb('0x3d')],_0x24a70c[_0x11fb('0x3e')]));if(_0x3d827a[_0x11fb('0x3d')][_0x11fb('0x49')]){_0x566c55[_0x11fb('0x47')]=_[_0x11fb('0x4a')](_0x566c55[_0x11fb('0x47')],{'$or':_['map'](_0x566c55[_0x11fb('0x41')],function(_0x311b0e){var _0x21db58={};_0x21db58[_0x311b0e]={'$like':'%'+_0x3d827a['query']['filter']+'%'};return _0x21db58;})});}_0x566c55=_[_0x11fb('0x4a')]({},_0x566c55,_0x3d827a[_0x11fb('0x4c')]);return _0x2a98e5[_0x11fb('0x7c')](_0x566c55);}})[_0x11fb('0x2c')](function(_0x3fea0a){if(_0x3fea0a){_0x34e446=_0x3fea0a[_0x11fb('0x42')];if(!_0x3d827a['query'][_0x11fb('0x43')]('nolimit')){_0x566c55[_0x11fb('0x23')]=qs[_0x11fb('0x23')](_0x3d827a[_0x11fb('0x3d')][_0x11fb('0x23')]);_0x566c55['offset']=qs[_0x11fb('0x21')](_0x3d827a[_0x11fb('0x3d')][_0x11fb('0x21')]);}return _0x2a98e5[_0x11fb('0x7c')](_0x566c55);}})[_0x11fb('0x2c')](function(_0x31946b){if(_0x31946b){return _0x31946b?{'count':_0x34e446,'rows':_0x31946b}:null;}})[_0x11fb('0x2c')](respondWithResult(_0x3bfdd4,null))[_0x11fb('0x4f')](handleError(_0x3bfdd4,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5a1a0ed..7d36340 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 _0xe714=['hasOwnProperty','hook','events','Dashboard','setMaxListeners','save','update','emit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe714,0xe2));var _0x4e71=function(_0x502187,_0x43010d){_0x502187=_0x502187-0x0;var _0x49b14e=_0xe714[_0x502187];return _0x49b14e;};'use strict';var EventEmitter=require(_0x4e71('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x4e71('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4e71('0x2')](0x0);var events={'afterCreate':_0x4e71('0x3'),'afterUpdate':_0x4e71('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ae210){return function(_0x59a685,_0xad5224,_0x19e056){DashboardEvents[_0x4e71('0x5')](_0x2ae210+':'+_0x59a685['id'],_0x59a685);DashboardEvents[_0x4e71('0x5')](_0x2ae210,_0x59a685);_0x19e056(null);};}for(var e in events){if(events[_0x4e71('0x6')](e)){var event=events[e];Dashboard[_0x4e71('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x4bd66a,_0x56393e){var _0x587a91=function(_0x2026b9){while(--_0x2026b9){_0x4bd66a['push'](_0x4bd66a['shift']());}};_0x587a91(++_0x56393e);}(_0x814b,0x1a2));var _0xb814=function(_0x5016c9,_0x57cdf0){_0x5016c9=_0x5016c9-0x0;var _0x5371ee=_0x814b[_0x5016c9];return _0x5371ee;};'use strict';var EventEmitter=require(_0xb814('0x0'));var Dashboard=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){DashboardEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);DashboardEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index dd6053a..a1baf1d 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 _0x4d7e=['bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x4d7e,0x14e));var _0xe4d7=function(_0x214126,_0x25704f){_0x214126=_0x214126-0x0;var _0x12a7cc=_0x4d7e[_0x214126];return _0x12a7cc;};'use strict';var _=require(_0xe4d7('0x0'));var util=require(_0xe4d7('0x1'));var logger=require(_0xe4d7('0x2'))(_0xe4d7('0x3'));var moment=require('moment');var BPromise=require(_0xe4d7('0x4'));var rp=require(_0xe4d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4d7('0x6'));var config=require(_0xe4d7('0x7'));var attributes=require(_0xe4d7('0x8'));module[_0xe4d7('0x9')]=function(_0x56b259,_0x72d186){return _0x56b259[_0xe4d7('0xa')](_0xe4d7('0xb'),attributes,{'tableName':_0xe4d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x208f=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x16683a,_0x460dca){var _0x480406=function(_0x5bb1e5){while(--_0x5bb1e5){_0x16683a['push'](_0x16683a['shift']());}};_0x480406(++_0x460dca);}(_0x208f,0x180));var _0xf208=function(_0x4ba92f,_0x3b9f3d){_0x4ba92f=_0x4ba92f-0x0;var _0x30eb5a=_0x208f[_0x4ba92f];return _0x30eb5a;};'use strict';var _=require(_0xf208('0x0'));var util=require(_0xf208('0x1'));var logger=require('../../config/logger')(_0xf208('0x2'));var moment=require(_0xf208('0x3'));var BPromise=require(_0xf208('0x4'));var rp=require(_0xf208('0x5'));var fs=require('fs');var path=require(_0xf208('0x6'));var rimraf=require('rimraf');var config=require(_0xf208('0x7'));var attributes=require(_0xf208('0x8'));module[_0xf208('0x9')]=function(_0x4a541d,_0x312e93){return _0x4a541d[_0xf208('0xa')](_0xf208('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ae8d40c..312663d 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 _0xd2f0=['lodash','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3eff4d,_0x430ab5){var _0x18fb98=function(_0x25adf2){while(--_0x25adf2){_0x3eff4d['push'](_0x3eff4d['shift']());}};_0x18fb98(++_0x430ab5);}(_0xd2f0,0x8a));var _0x0d2f=function(_0x3bf8a3,_0x4817ff){_0x3bf8a3=_0x3bf8a3-0x0;var _0x45152a=_0xd2f0[_0x3bf8a3];return _0x45152a;};'use strict';var _=require(_0x0d2f('0x0'));var util=require('util');var moment=require(_0x0d2f('0x1'));var BPromise=require(_0x0d2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d2f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d2f('0x4'));var config=require('../../config/environment');var jayson=require(_0x0d2f('0x5'));var client=jayson[_0x0d2f('0x6')][_0x0d2f('0x7')]({'port':0x232a});config[_0x0d2f('0x8')]=_[_0x0d2f('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0d2f('0xa'))(new Redis(config[_0x0d2f('0x8')]));require('./dashboard.socket')[_0x0d2f('0xb')](socket);function respondWithRpcPromise(_0x2f7c69,_0x50ed19,_0x231173){return new BPromise(function(_0x1ceca5,_0x2b3130){return client[_0x0d2f('0xc')](_0x2f7c69,_0x231173)[_0x0d2f('0xd')](function(_0x24f80c){logger[_0x0d2f('0xe')](_0x0d2f('0xf'),_0x50ed19,_0x0d2f('0x10'));logger['debug'](_0x0d2f('0x11'),_0x50ed19,_0x0d2f('0x10'),JSON[_0x0d2f('0x12')](_0x24f80c));if(_0x24f80c[_0x0d2f('0x13')]){if(_0x24f80c[_0x0d2f('0x13')][_0x0d2f('0x14')]===0x1f4){logger[_0x0d2f('0x13')](_0x0d2f('0xf'),_0x50ed19,_0x24f80c['error']['message']);return _0x2b3130(_0x24f80c[_0x0d2f('0x13')]['message']);}logger[_0x0d2f('0x13')]('Dashboard,\x20%s,\x20%s',_0x50ed19,_0x24f80c['error'][_0x0d2f('0x15')]);return _0x1ceca5(_0x24f80c['error'][_0x0d2f('0x15')]);}else{logger[_0x0d2f('0xe')](_0x0d2f('0xf'),_0x50ed19,'request\x20sent');_0x1ceca5(_0x24f80c['result'][_0x0d2f('0x15')]);}})[_0x0d2f('0x16')](function(_0x15bdbb){logger[_0x0d2f('0x13')](_0x0d2f('0xf'),_0x50ed19,_0x15bdbb);_0x2b3130(_0x15bdbb);});});} \ No newline at end of file +var _0x2c87=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','redis','./dashboard.socket','register','request','then','info','request\x20sent','debug'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x2c87,0x64));var _0x72c8=function(_0x263483,_0x3c873a){_0x263483=_0x263483-0x0;var _0x276f66=_0x2c87[_0x263483];return _0x276f66;};'use strict';var _=require(_0x72c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x72c8('0x1'));var rs=require(_0x72c8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x72c8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x72c8('0x4'));var jayson=require(_0x72c8('0x5'));var client=jayson[_0x72c8('0x6')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x72c8('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72c8('0x7')]));require(_0x72c8('0x8'))[_0x72c8('0x9')](socket);function respondWithRpcPromise(_0x101a2d,_0x33e5fc,_0x4bbb0f){return new BPromise(function(_0x4a8129,_0x43bbcf){return client[_0x72c8('0xa')](_0x101a2d,_0x4bbb0f)[_0x72c8('0xb')](function(_0x1e8098){logger[_0x72c8('0xc')]('Dashboard,\x20%s,\x20%s',_0x33e5fc,_0x72c8('0xd'));logger[_0x72c8('0xe')](_0x72c8('0xf'),_0x33e5fc,_0x72c8('0xd'),JSON[_0x72c8('0x10')](_0x1e8098));if(_0x1e8098[_0x72c8('0x11')]){if(_0x1e8098['error'][_0x72c8('0x12')]===0x1f4){logger[_0x72c8('0x11')](_0x72c8('0x13'),_0x33e5fc,_0x1e8098[_0x72c8('0x11')][_0x72c8('0x14')]);return _0x43bbcf(_0x1e8098['error']['message']);}logger[_0x72c8('0x11')](_0x72c8('0x13'),_0x33e5fc,_0x1e8098[_0x72c8('0x11')][_0x72c8('0x14')]);return _0x4a8129(_0x1e8098[_0x72c8('0x11')][_0x72c8('0x14')]);}else{logger[_0x72c8('0xc')]('Dashboard,\x20%s,\x20%s',_0x33e5fc,_0x72c8('0xd'));_0x4a8129(_0x1e8098[_0x72c8('0x15')][_0x72c8('0x14')]);}})[_0x72c8('0x16')](function(_0x217f3a){logger[_0x72c8('0x11')](_0x72c8('0x13'),_0x33e5fc,_0x217f3a);_0x43bbcf(_0x217f3a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b937837..2af566e 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 _0xf7c0=['./dashboard.events','save','update','removeListener','register','dashboard:'];(function(_0x400eea,_0x2c9f16){var _0x2a0e26=function(_0xd4e46d){while(--_0xd4e46d){_0x400eea['push'](_0x400eea['shift']());}};_0x2a0e26(++_0x2c9f16);}(_0xf7c0,0x120));var _0x0f7c=function(_0x3ae619,_0x4172e8){_0x3ae619=_0x3ae619-0x0;var _0x53fcb7=_0xf7c0[_0x3ae619];return _0x53fcb7;};'use strict';var DashboardEvents=require(_0x0f7c('0x0'));var events=[_0x0f7c('0x1'),'remove',_0x0f7c('0x2')];function createListener(_0x54c024,_0x59f821){return function(_0x3e6988){_0x59f821['emit'](_0x54c024,_0x3e6988);};}function removeListener(_0x1b7c94,_0x2d1ab3){return function(){DashboardEvents[_0x0f7c('0x3')](_0x1b7c94,_0x2d1ab3);};}exports[_0x0f7c('0x4')]=function(_0x4861c2){for(var _0xd89960=0x0,_0x5512b2=events['length'];_0xd89960<_0x5512b2;_0xd89960++){var _0x36c007=events[_0xd89960];var _0x38082a=createListener(_0x0f7c('0x5')+_0x36c007,_0x4861c2);DashboardEvents['on'](_0x36c007,_0x38082a);}}; \ No newline at end of file +var _0x2c73=['./dashboard.events','remove','emit','removeListener','register','length','dashboard:'];(function(_0x83edd0,_0x5ad955){var _0x21fd9a=function(_0x591512){while(--_0x591512){_0x83edd0['push'](_0x83edd0['shift']());}};_0x21fd9a(++_0x5ad955);}(_0x2c73,0x188));var _0x32c7=function(_0x12b580,_0xb50037){_0x12b580=_0x12b580-0x0;var _0x2b7809=_0x2c73[_0x12b580];return _0x2b7809;};'use strict';var DashboardEvents=require(_0x32c7('0x0'));var events=['save',_0x32c7('0x1'),'update'];function createListener(_0x54e603,_0x2303c9){return function(_0x1a084e){_0x2303c9[_0x32c7('0x2')](_0x54e603,_0x1a084e);};}function removeListener(_0x4f1fee,_0x1a858d){return function(){DashboardEvents[_0x32c7('0x3')](_0x4f1fee,_0x1a858d);};}exports[_0x32c7('0x4')]=function(_0x1c2c52){for(var _0x26688d=0x0,_0x56d321=events[_0x32c7('0x5')];_0x26688d<_0x56d321;_0x26688d++){var _0x56f4c3=events[_0x26688d];var _0x9ab78f=createListener(_0x32c7('0x6')+_0x56f4c3,_0x1c2c52);DashboardEvents['on'](_0x56f4c3,_0x9ab78f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d1da248..fa8f76c 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 _0x517f=['../../config/environment','get','isAuthenticated','index','show','/:id/items','post','create','/:id/clone','clone','addItem','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4f4cb,_0x101b02){var _0x3c9a66=function(_0x26dc4d){while(--_0x26dc4d){_0x4f4cb['push'](_0x4f4cb['shift']());}};_0x3c9a66(++_0x101b02);}(_0x517f,0x75));var _0xf517=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x517f[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0xf517('0x0'));var util=require(_0xf517('0x1'));var path=require(_0xf517('0x2'));var timeout=require(_0xf517('0x3'));var express=require(_0xf517('0x4'));var router=express['Router']();var fs_extra=require(_0xf517('0x5'));var auth=require(_0xf517('0x6'));var interaction=require(_0xf517('0x7'));var config=require(_0xf517('0x8'));var controller=require('./dashboard.controller');router[_0xf517('0x9')]('/',auth[_0xf517('0xa')](),controller[_0xf517('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf517('0xc')]);router[_0xf517('0x9')](_0xf517('0xd'),auth[_0xf517('0xa')](),controller['getItems']);router[_0xf517('0xe')]('/',auth[_0xf517('0xa')](),controller[_0xf517('0xf')]);router[_0xf517('0xe')](_0xf517('0x10'),auth[_0xf517('0xa')](),controller[_0xf517('0x11')]);router['post'](_0xf517('0xd'),auth[_0xf517('0xa')](),controller[_0xf517('0x12')]);router[_0xf517('0x13')](_0xf517('0x14'),auth[_0xf517('0xa')](),controller[_0xf517('0x15')]);router[_0xf517('0x16')]('/:id',auth[_0xf517('0xa')](),controller[_0xf517('0x17')]);module[_0xf517('0x18')]=router; \ No newline at end of file +var _0xd47d=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','create','/:id/clone','clone','post','addItem','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f5e19,_0x290a16){var _0x2d13c0=function(_0x4309af){while(--_0x4309af){_0x1f5e19['push'](_0x1f5e19['shift']());}};_0x2d13c0(++_0x290a16);}(_0xd47d,0xd8));var _0xdd47=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xd47d[_0x3f25b2];return _0xd8caeb;};'use strict';var multer=require(_0xdd47('0x0'));var util=require(_0xdd47('0x1'));var path=require('path');var timeout=require(_0xdd47('0x2'));var express=require(_0xdd47('0x3'));var router=express[_0xdd47('0x4')]();var fs_extra=require(_0xdd47('0x5'));var auth=require(_0xdd47('0x6'));var interaction=require(_0xdd47('0x7'));var config=require(_0xdd47('0x8'));var controller=require(_0xdd47('0x9'));router[_0xdd47('0xa')]('/',auth[_0xdd47('0xb')](),controller[_0xdd47('0xc')]);router[_0xdd47('0xa')](_0xdd47('0xd'),auth[_0xdd47('0xb')](),controller[_0xdd47('0xe')]);router[_0xdd47('0xa')](_0xdd47('0xf'),auth[_0xdd47('0xb')](),controller['getItems']);router['post']('/',auth[_0xdd47('0xb')](),controller[_0xdd47('0x10')]);router['post'](_0xdd47('0x11'),auth['isAuthenticated'](),controller[_0xdd47('0x12')]);router[_0xdd47('0x13')]('/:id/items',auth[_0xdd47('0xb')](),controller[_0xdd47('0x14')]);router[_0xdd47('0x15')](_0xdd47('0xd'),auth[_0xdd47('0xb')](),controller[_0xdd47('0x16')]);router['delete'](_0xdd47('0xd'),auth[_0xdd47('0xb')](),controller[_0xdd47('0x17')]);module[_0xdd47('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d0ff900..86e2d04 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 _0x01d9=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x901d('0x0'));var squel=require(_0x901d('0x1'));var _=require(_0x901d('0x2'));module[_0x901d('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6')),'get':function(){try{return JSON[_0x901d('0x7')](this[_0x901d('0x8')](_0x901d('0x9')));}catch(_0xb96b86){return[];}},'set':function(_0x4e7842){try{this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')](_0x4e7842));}catch(_0x12c39f){this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x901d('0xc')]},'col':{'type':Sequelize[_0x901d('0xc')]},'background':{'type':Sequelize[_0x901d('0x4')],'allowNull':![],'defaultValue':_0x901d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x901d('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x901d('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0x538e6a,_0x248aee){var _0x35b4e7=function(_0x1b76cc){while(--_0x1b76cc){_0x538e6a['push'](_0x538e6a['shift']());}};_0x35b4e7(++_0x248aee);}(_0x524e,0x15e));var _0xe524=function(_0x297803,_0x282614){_0x297803=_0x297803-0x0;var _0x2b925c=_0x524e[_0x297803];return _0x2b925c;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'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 e4cf7e4..3dc8174 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 _0x4f5a=['eml-format','zip-dir','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','then','destroy','error','stack','name','send','show','params','keys','rawAttributes','filters','intersection','model','fields','query','attributes','length','includeAll','merge','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body'];(function(_0x302839,_0x5f3500){var _0x2bbc3e=function(_0x1cd9a9){while(--_0x1cd9a9){_0x302839['push'](_0x302839['shift']());}};_0x2bbc3e(++_0x5f3500);}(_0x4f5a,0x10e));var _0xa4f5=function(_0x29944e,_0x4751ea){_0x29944e=_0x29944e-0x0;var _0x420d11=_0x4f5a[_0x29944e];return _0x420d11;};'use strict';var emlformat=require(_0xa4f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa4f5('0x2'));var Mustache=require('mustache');var util=require(_0xa4f5('0x3'));var path=require(_0xa4f5('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4f5('0x5'));var fs=require('fs');var fs_extra=require(_0xa4f5('0x6'));var _=require(_0xa4f5('0x7'));var squel=require(_0xa4f5('0x8'));var crypto=require('crypto');var jsforce=require(_0xa4f5('0x9'));var deskjs=require(_0xa4f5('0xa'));var toCsv=require(_0xa4f5('0xb'));var querystring=require(_0xa4f5('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa4f5('0xd'));var as=require(_0xa4f5('0xe'));var hardwareService=require(_0xa4f5('0xf'));var logger=require('../../config/logger')(_0xa4f5('0x10'));var utils=require(_0xa4f5('0x11'));var config=require(_0xa4f5('0x12'));var licenseUtil=require(_0xa4f5('0x13'));var db=require(_0xa4f5('0x14'))['db'];config[_0xa4f5('0x15')]=_[_0xa4f5('0x16')](config[_0xa4f5('0x15')],{'host':_0xa4f5('0x17'),'port':0x18eb});var socket=require(_0xa4f5('0x18'))(new Redis(config[_0xa4f5('0x15')]));require(_0xa4f5('0x19'))[_0xa4f5('0x1a')](socket);function respondWithStatusCode(_0x350c64,_0x5beea9){_0x5beea9=_0x5beea9||0xcc;return function(_0x181e47){if(_0x181e47){return _0x350c64[_0xa4f5('0x1b')](_0x5beea9);}return _0x350c64['status'](_0x5beea9)[_0xa4f5('0x1c')]();};}function respondWithResult(_0x5d1a5a,_0x297c4e){_0x297c4e=_0x297c4e||0xc8;return function(_0x38f260){if(_0x38f260){return _0x5d1a5a[_0xa4f5('0x1d')](_0x297c4e)[_0xa4f5('0x1e')](_0x38f260);}};}function respondWithFilteredResult(_0x481811,_0x31cca2){return function(_0x245602){if(_0x245602){var _0x2c2de8=typeof _0x31cca2[_0xa4f5('0x1f')]===_0xa4f5('0x20')&&typeof _0x31cca2[_0xa4f5('0x21')]===_0xa4f5('0x20');var _0xc7bc43=_0x245602['count'];var _0x42cb3d=_0x2c2de8?0x0:_0x31cca2['offset'];var _0x38442d=_0x2c2de8?_0x245602['count']:_0x31cca2['offset']+_0x31cca2[_0xa4f5('0x21')];var _0x287af8;if(_0x38442d>=_0xc7bc43){_0x38442d=_0xc7bc43;_0x287af8=0xc8;}else{_0x287af8=0xce;}_0x481811['status'](_0x287af8);return _0x481811['set'](_0xa4f5('0x22'),_0x42cb3d+'-'+_0x38442d+'/'+_0xc7bc43)[_0xa4f5('0x1e')](_0x245602);}return null;};}function patchUpdates(_0x3635e4){return function(_0x1f1e41){try{jsonpatch[_0xa4f5('0x23')](_0x1f1e41,_0x3635e4,!![]);}catch(_0x24a71a){return BPromise['reject'](_0x24a71a);}return _0x1f1e41[_0xa4f5('0x24')]();};}function saveUpdates(_0x571157,_0x3db6c7){return function(_0x50b520){if(_0x50b520){return _0x50b520['update'](_0x571157)[_0xa4f5('0x25')](function(_0x1888c0){return _0x1888c0;});}return null;};}function removeEntity(_0x1258e2,_0x2d5422){return function(_0xef8292){if(_0xef8292){return _0xef8292[_0xa4f5('0x26')]()['then'](function(){_0x1258e2[_0xa4f5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7cde6,_0x5bbf1e){return function(_0x566744){if(!_0x566744){_0xc7cde6['sendStatus'](0x194);}return _0x566744;};}function handleError(_0x5b7d0d,_0x516307){_0x516307=_0x516307||0x1f4;return function(_0x32e6ba){logger[_0xa4f5('0x27')](_0x32e6ba[_0xa4f5('0x28')]);if(_0x32e6ba[_0xa4f5('0x29')]){delete _0x32e6ba['name'];}_0x5b7d0d[_0xa4f5('0x1d')](_0x516307)[_0xa4f5('0x2a')](_0x32e6ba);};}exports[_0xa4f5('0x2b')]=function(_0x1e63af,_0x650f7e){var _0xea4725={'raw':![],'where':{'id':_0x1e63af[_0xa4f5('0x2c')]['id']}},_0x464cef={};_0x464cef['model']=_[_0xa4f5('0x2d')](db['DashboardItem'][_0xa4f5('0x2e')]);_0x464cef['query']=_[_0xa4f5('0x2d')](_0x1e63af['query']);_0x464cef[_0xa4f5('0x2f')]=_[_0xa4f5('0x30')](_0x464cef['model'],_0x464cef['query']);_0xea4725['attributes']=_[_0xa4f5('0x30')](_0x464cef[_0xa4f5('0x31')],qs[_0xa4f5('0x32')](_0x1e63af[_0xa4f5('0x33')][_0xa4f5('0x32')]));_0xea4725[_0xa4f5('0x34')]=_0xea4725[_0xa4f5('0x34')][_0xa4f5('0x35')]?_0xea4725[_0xa4f5('0x34')]:_0x464cef[_0xa4f5('0x31')];if(_0x1e63af[_0xa4f5('0x33')][_0xa4f5('0x36')]){_0xea4725['include']=[{'all':!![]}];}_0xea4725=_[_0xa4f5('0x37')]({},_0xea4725,_0x1e63af[_0xa4f5('0x38')]);return db['DashboardItem'][_0xa4f5('0x39')](_0xea4725)[_0xa4f5('0x25')](handleEntityNotFound(_0x650f7e,null))['then'](respondWithResult(_0x650f7e,null))[_0xa4f5('0x3a')](handleError(_0x650f7e,null));};exports[_0xa4f5('0x26')]=function(_0x3fb230,_0x3a8391){return db[_0xa4f5('0x3b')][_0xa4f5('0x39')]({'where':{'id':_0x3fb230[_0xa4f5('0x2c')]['id']}})[_0xa4f5('0x25')](handleEntityNotFound(_0x3a8391,null))[_0xa4f5('0x25')](removeEntity(_0x3a8391,null))[_0xa4f5('0x3a')](handleError(_0x3a8391,null));};function widgetAttributes(_0xe6bc85){try{switch(_0xe6bc85[_0xa4f5('0x3c')]){case _0xa4f5('0x3d'):return[{'name':_0xa4f5('0x3e'),'value':_0xe6bc85['attrUrl']||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x0]?_0xe6bc85[_0xa4f5('0x3f')][0x0][_0xa4f5('0x40')]:undefined)||_0xa4f5('0x41')}];case _0xa4f5('0x42'):return[{'name':_0xa4f5('0x43'),'value':_0xe6bc85[_0xa4f5('0x43')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85['attrs'][0x0]?_0xe6bc85['attrs'][0x0][_0xa4f5('0x40')]:undefined)||''}];case _0xa4f5('0x44'):return[{'name':'attrHourFormat','value':_0xe6bc85['attrHourFormat']||(_0xe6bc85['attrs']&&_0xe6bc85['attrs'][0x0]?_0xe6bc85[_0xa4f5('0x3f')][0x0][_0xa4f5('0x40')]:undefined)||_0xa4f5('0x45')},{'name':_0xa4f5('0x46'),'value':_0xe6bc85['attrTimezone']||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x1]?_0xe6bc85['attrs'][0x1][_0xa4f5('0x40')]:undefined)||_0xa4f5('0x47')},{'name':_0xa4f5('0x48'),'value':_0xe6bc85[_0xa4f5('0x48')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x2]?_0xe6bc85[_0xa4f5('0x3f')][0x2][_0xa4f5('0x40')]:undefined)||0xc}];case _0xa4f5('0x49'):return[{'name':_0xa4f5('0x4a'),'value':_0xe6bc85[_0xa4f5('0x4a')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85['attrs'][0x0]?_0xe6bc85['attrs'][0x0]['value']:undefined)||_0xa4f5('0x4b')},{'name':_0xa4f5('0x4c'),'value':_0xe6bc85['attrVoiceQueues']||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x1]?_0xe6bc85[_0xa4f5('0x3f')][0x1]['value']:undefined)||[]},{'name':_0xa4f5('0x48'),'value':_0xe6bc85[_0xa4f5('0x48')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85['attrs'][0x2]?_0xe6bc85['attrs'][0x2][_0xa4f5('0x40')]:undefined)||0x14}];case _0xa4f5('0x4d'):case _0xa4f5('0x4e'):return[{'name':_0xa4f5('0x4f'),'value':_0xe6bc85[_0xa4f5('0x4f')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x0]?_0xe6bc85['attrs'][0x0][_0xa4f5('0x40')]:undefined)||_0xa4f5('0x4b')},{'name':_0xa4f5('0x50'),'value':_0xe6bc85[_0xa4f5('0x50')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x1]?_0xe6bc85['attrs'][0x1][_0xa4f5('0x40')]:undefined)||null},{'name':_0xa4f5('0x51'),'value':_0xe6bc85[_0xa4f5('0x51')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x2]?_0xe6bc85['attrs'][0x2]['value']:undefined)||null},{'name':_0xa4f5('0x4c'),'value':_0xe6bc85[_0xa4f5('0x4c')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x3]?_0xe6bc85['attrs'][0x3][_0xa4f5('0x40')]:undefined)||[]}];case _0xa4f5('0x52'):return[{'name':_0xa4f5('0x53'),'type':_0xe6bc85[_0xa4f5('0x54')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85['attrs'][0x0]?_0xe6bc85[_0xa4f5('0x3f')][0x0]['type']:undefined)||null,'value':_0xe6bc85[_0xa4f5('0x53')]||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85['attrs'][0x0]?_0xe6bc85[_0xa4f5('0x3f')][0x0][_0xa4f5('0x40')]:undefined)||null},{'name':_0xa4f5('0x55'),'value':_0xe6bc85['attrRefresh']||(_0xe6bc85[_0xa4f5('0x3f')]&&_0xe6bc85[_0xa4f5('0x3f')][0x1]?_0xe6bc85['attrs'][0x1][_0xa4f5('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x4a036e){logger[_0xa4f5('0x27')](_0xa4f5('0x56'),JSON[_0xa4f5('0x57')](_0x4a036e));return[];}}exports[_0xa4f5('0x58')]=function(_0x5f1340,_0x33929d){if(_0x5f1340[_0xa4f5('0x59')]){_0x5f1340[_0xa4f5('0x59')][_0xa4f5('0x3f')]=widgetAttributes(_0x5f1340[_0xa4f5('0x59')]);}return db[_0xa4f5('0x3b')][_0xa4f5('0x58')](_0x5f1340['body'],{})[_0xa4f5('0x25')](respondWithResult(_0x33929d,0xc9))['catch'](handleError(_0x33929d,null));};exports['update']=function(_0x112fba,_0x48d088){if(_0x112fba[_0xa4f5('0x59')]['id']){delete _0x112fba[_0xa4f5('0x59')]['id'];}_0x112fba[_0xa4f5('0x59')]['attrs']=widgetAttributes(_0x112fba['body']);return db[_0xa4f5('0x3b')][_0xa4f5('0x39')]({'where':{'id':_0x112fba[_0xa4f5('0x2c')]['id']}})[_0xa4f5('0x25')](handleEntityNotFound(_0x48d088,null))[_0xa4f5('0x25')](saveUpdates(_0x112fba[_0xa4f5('0x59')],null))[_0xa4f5('0x25')](respondWithResult(_0x48d088,null))[_0xa4f5('0x3a')](handleError(_0x48d088,null));}; \ No newline at end of file +var _0x260b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','merge','find','destroy','catch','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4dcf0d,_0x3f8341){var _0x57d2d6=function(_0x42b337){while(--_0x42b337){_0x4dcf0d['push'](_0x4dcf0d['shift']());}};_0x57d2d6(++_0x3f8341);}(_0x260b,0x1e8));var _0xb260=function(_0x1edc03,_0x77eced){_0x1edc03=_0x1edc03-0x0;var _0x103106=_0x260b[_0x1edc03];return _0x103106;};'use strict';var emlformat=require(_0xb260('0x0'));var rimraf=require(_0xb260('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb260('0x2'));var rp=require(_0xb260('0x3'));var moment=require(_0xb260('0x4'));var BPromise=require(_0xb260('0x5'));var Mustache=require(_0xb260('0x6'));var util=require(_0xb260('0x7'));var path=require(_0xb260('0x8'));var sox=require(_0xb260('0x9'));var csv=require(_0xb260('0xa'));var ejs=require(_0xb260('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb260('0xc'));var Papa=require('papaparse');var Redis=require(_0xb260('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb260('0xe'));var as=require(_0xb260('0xf'));var hardwareService=require(_0xb260('0x10'));var logger=require(_0xb260('0x11'))(_0xb260('0x12'));var utils=require(_0xb260('0x13'));var config=require(_0xb260('0x14'));var licenseUtil=require(_0xb260('0x15'));var db=require(_0xb260('0x16'))['db'];config[_0xb260('0x17')]=_['defaults'](config[_0xb260('0x17')],{'host':_0xb260('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb260('0x17')]));require(_0xb260('0x19'))[_0xb260('0x1a')](socket);function respondWithStatusCode(_0x1060ab,_0x152bc6){_0x152bc6=_0x152bc6||0xcc;return function(_0xeb3e48){if(_0xeb3e48){return _0x1060ab[_0xb260('0x1b')](_0x152bc6);}return _0x1060ab[_0xb260('0x1c')](_0x152bc6)[_0xb260('0x1d')]();};}function respondWithResult(_0x5f41fe,_0x36eb3c){_0x36eb3c=_0x36eb3c||0xc8;return function(_0xdfff40){if(_0xdfff40){return _0x5f41fe[_0xb260('0x1c')](_0x36eb3c)[_0xb260('0x1e')](_0xdfff40);}};}function respondWithFilteredResult(_0x59073a,_0x3fd218){return function(_0x54ede9){if(_0x54ede9){var _0x7885b4=typeof _0x3fd218[_0xb260('0x1f')]==='undefined'&&typeof _0x3fd218[_0xb260('0x20')]===_0xb260('0x21');var _0x34a8b4=_0x54ede9[_0xb260('0x22')];var _0xdaff08=_0x7885b4?0x0:_0x3fd218[_0xb260('0x1f')];var _0x86b092=_0x7885b4?_0x54ede9[_0xb260('0x22')]:_0x3fd218[_0xb260('0x1f')]+_0x3fd218[_0xb260('0x20')];var _0x5c9b62;if(_0x86b092>=_0x34a8b4){_0x86b092=_0x34a8b4;_0x5c9b62=0xc8;}else{_0x5c9b62=0xce;}_0x59073a[_0xb260('0x1c')](_0x5c9b62);return _0x59073a['set'](_0xb260('0x23'),_0xdaff08+'-'+_0x86b092+'/'+_0x34a8b4)[_0xb260('0x1e')](_0x54ede9);}return null;};}function patchUpdates(_0x23f28f){return function(_0x553069){try{jsonpatch[_0xb260('0x24')](_0x553069,_0x23f28f,!![]);}catch(_0xc3adb){return BPromise[_0xb260('0x25')](_0xc3adb);}return _0x553069['save']();};}function saveUpdates(_0x16b447,_0x5f509e){return function(_0x4f9f96){if(_0x4f9f96){return _0x4f9f96[_0xb260('0x26')](_0x16b447)[_0xb260('0x27')](function(_0x5b252b){return _0x5b252b;});}return null;};}function removeEntity(_0x558bda,_0x524faf){return function(_0xd1f08c){if(_0xd1f08c){return _0xd1f08c['destroy']()[_0xb260('0x27')](function(){_0x558bda[_0xb260('0x1c')](0xcc)[_0xb260('0x1d')]();});}};}function handleEntityNotFound(_0x48d641,_0x3b6cb7){return function(_0xc1741b){if(!_0xc1741b){_0x48d641[_0xb260('0x1b')](0x194);}return _0xc1741b;};}function handleError(_0x5400c5,_0x451349){_0x451349=_0x451349||0x1f4;return function(_0x41eea8){logger[_0xb260('0x28')](_0x41eea8[_0xb260('0x29')]);if(_0x41eea8['name']){delete _0x41eea8[_0xb260('0x2a')];}_0x5400c5[_0xb260('0x1c')](_0x451349)['send'](_0x41eea8);};}exports[_0xb260('0x2b')]=function(_0x48aaee,_0x4fc454){var _0x301c5b={'raw':![],'where':{'id':_0x48aaee['params']['id']}},_0x288a99={};_0x288a99[_0xb260('0x2c')]=_[_0xb260('0x2d')](db[_0xb260('0x2e')][_0xb260('0x2f')]);_0x288a99[_0xb260('0x30')]=_[_0xb260('0x2d')](_0x48aaee[_0xb260('0x30')]);_0x288a99['filters']=_[_0xb260('0x31')](_0x288a99[_0xb260('0x2c')],_0x288a99[_0xb260('0x30')]);_0x301c5b[_0xb260('0x32')]=_[_0xb260('0x31')](_0x288a99[_0xb260('0x2c')],qs[_0xb260('0x33')](_0x48aaee[_0xb260('0x30')][_0xb260('0x33')]));_0x301c5b[_0xb260('0x32')]=_0x301c5b[_0xb260('0x32')]['length']?_0x301c5b['attributes']:_0x288a99[_0xb260('0x2c')];if(_0x48aaee[_0xb260('0x30')]['includeAll']){_0x301c5b['include']=[{'all':!![]}];}_0x301c5b=_[_0xb260('0x34')]({},_0x301c5b,_0x48aaee['options']);return db['DashboardItem'][_0xb260('0x35')](_0x301c5b)['then'](handleEntityNotFound(_0x4fc454,null))[_0xb260('0x27')](respondWithResult(_0x4fc454,null))['catch'](handleError(_0x4fc454,null));};exports[_0xb260('0x36')]=function(_0x373516,_0x3c6ede){return db[_0xb260('0x2e')][_0xb260('0x35')]({'where':{'id':_0x373516['params']['id']}})['then'](handleEntityNotFound(_0x3c6ede,null))[_0xb260('0x27')](removeEntity(_0x3c6ede,null))[_0xb260('0x37')](handleError(_0x3c6ede,null));};function widgetAttributes(_0x7567b6){try{switch(_0x7567b6[_0xb260('0x38')]){case _0xb260('0x39'):return[{'name':'attrUrl','value':_0x7567b6['attrUrl']||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x0]?_0x7567b6['attrs'][0x0][_0xb260('0x3b')]:undefined)||_0xb260('0x3c')}];case _0xb260('0x3d'):return[{'name':_0xb260('0x3e'),'value':_0x7567b6['attrPath']||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x0]?_0x7567b6['attrs'][0x0][_0xb260('0x3b')]:undefined)||''}];case _0xb260('0x3f'):return[{'name':'attrHourFormat','value':_0x7567b6[_0xb260('0x40')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x0]?_0x7567b6[_0xb260('0x3a')][0x0][_0xb260('0x3b')]:undefined)||_0xb260('0x41')},{'name':_0xb260('0x42'),'value':_0x7567b6['attrTimezone']||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6['attrs'][0x1]?_0x7567b6['attrs'][0x1][_0xb260('0x3b')]:undefined)||_0xb260('0x43')},{'name':'attrFontSize','value':_0x7567b6[_0xb260('0x44')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x2]?_0x7567b6[_0xb260('0x3a')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xb260('0x45'),'value':_0x7567b6[_0xb260('0x45')]||(_0x7567b6['attrs']&&_0x7567b6[_0xb260('0x3a')][0x0]?_0x7567b6[_0xb260('0x3a')][0x0][_0xb260('0x3b')]:undefined)||_0xb260('0x46')},{'name':'attrVoiceQueues','value':_0x7567b6[_0xb260('0x47')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x1]?_0x7567b6[_0xb260('0x3a')][0x1]['value']:undefined)||[]},{'name':_0xb260('0x44'),'value':_0x7567b6[_0xb260('0x44')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x2]?_0x7567b6[_0xb260('0x3a')][0x2][_0xb260('0x3b')]:undefined)||0x14}];case'multibar-chart':case _0xb260('0x48'):return[{'name':_0xb260('0x49'),'value':_0x7567b6[_0xb260('0x49')]||(_0x7567b6['attrs']&&_0x7567b6['attrs'][0x0]?_0x7567b6[_0xb260('0x3a')][0x0]['value']:undefined)||'total'},{'name':_0xb260('0x4a'),'value':_0x7567b6[_0xb260('0x4a')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x1]?_0x7567b6[_0xb260('0x3a')][0x1][_0xb260('0x3b')]:undefined)||null},{'name':_0xb260('0x4b'),'value':_0x7567b6[_0xb260('0x4b')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x2]?_0x7567b6[_0xb260('0x3a')][0x2][_0xb260('0x3b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x7567b6[_0xb260('0x47')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x3]?_0x7567b6[_0xb260('0x3a')][0x3]['value']:undefined)||[]}];case _0xb260('0x4c'):return[{'name':'attrReport','type':_0x7567b6[_0xb260('0x4d')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x0]?_0x7567b6['attrs'][0x0][_0xb260('0x38')]:undefined)||null,'value':_0x7567b6[_0xb260('0x4e')]||(_0x7567b6[_0xb260('0x3a')]&&_0x7567b6[_0xb260('0x3a')][0x0]?_0x7567b6[_0xb260('0x3a')][0x0]['value']:undefined)||null},{'name':_0xb260('0x4f'),'value':_0x7567b6[_0xb260('0x4f')]||(_0x7567b6['attrs']&&_0x7567b6[_0xb260('0x3a')][0x1]?_0x7567b6[_0xb260('0x3a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x546d50){logger[_0xb260('0x28')](_0xb260('0x50'),JSON[_0xb260('0x51')](_0x546d50));return[];}}exports[_0xb260('0x52')]=function(_0x5384c4,_0x2cef23){if(_0x5384c4[_0xb260('0x53')]){_0x5384c4['body']['attrs']=widgetAttributes(_0x5384c4[_0xb260('0x53')]);}return db['DashboardItem'][_0xb260('0x52')](_0x5384c4['body'],{})['then'](respondWithResult(_0x2cef23,0xc9))[_0xb260('0x37')](handleError(_0x2cef23,null));};exports['update']=function(_0x4bbfab,_0x2d0c07){if(_0x4bbfab[_0xb260('0x53')]['id']){delete _0x4bbfab[_0xb260('0x53')]['id'];}_0x4bbfab[_0xb260('0x53')][_0xb260('0x3a')]=widgetAttributes(_0x4bbfab['body']);return db[_0xb260('0x2e')]['find']({'where':{'id':_0x4bbfab['params']['id']}})[_0xb260('0x27')](handleEntityNotFound(_0x2d0c07,null))[_0xb260('0x27')](saveUpdates(_0x4bbfab[_0xb260('0x53')],null))[_0xb260('0x27')](respondWithResult(_0x2d0c07,null))[_0xb260('0x37')](handleError(_0x2d0c07,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8028b26..7288ce0 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 _0x85de=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','hasOwnProperty'];(function(_0x27db0d,_0xbc7096){var _0xf46215=function(_0x4383e8){while(--_0x4383e8){_0x27db0d['push'](_0x27db0d['shift']());}};_0xf46215(++_0xbc7096);}(_0x85de,0x65));var _0xe85d=function(_0x4e1a1a,_0x17f45a){_0x4e1a1a=_0x4e1a1a-0x0;var _0x158ce9=_0x85de[_0x4e1a1a];return _0x158ce9;};'use strict';var EventEmitter=require(_0xe85d('0x0'));var DashboardItem=require(_0xe85d('0x1'))['db'][_0xe85d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe85d('0x3')](0x0);var events={'afterCreate':_0xe85d('0x4'),'afterUpdate':_0xe85d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x244fdd){return function(_0x241b12,_0x2c4902,_0x5de80e){DashboardItemEvents['emit'](_0x244fdd+':'+_0x241b12['id'],_0x241b12);DashboardItemEvents['emit'](_0x244fdd,_0x241b12);_0x5de80e(null);};}for(var e in events){if(events[_0xe85d('0x6')](e)){var event=events[e];DashboardItem[_0xe85d('0x7')](e,emitEvent(event));}}module[_0xe85d('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xae12=['../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae12,0x1d0));var _0x2ae1=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0xae12[_0x1fcf1b];return _0x5d2952;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x2ae1('0x0'))['db'][_0x2ae1('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2ae1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ae1('0x3'),'afterDestroy':_0x2ae1('0x4')};function emitEvent(_0x34e3b6){return function(_0x243cee,_0xea28,_0x9865c2){DashboardItemEvents[_0x2ae1('0x5')](_0x34e3b6+':'+_0x243cee['id'],_0x243cee);DashboardItemEvents['emit'](_0x34e3b6,_0x243cee);_0x9865c2(null);};}for(var e in events){if(events[_0x2ae1('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x2ae1('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index db0ba73..4db516f 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 _0x0971=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x453897,_0x1fe55a){var _0x458569=function(_0x500c1c){while(--_0x500c1c){_0x453897['push'](_0x453897['shift']());}};_0x458569(++_0x1fe55a);}(_0x0971,0xee));var _0x1097=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x0971[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0x1097('0x0'));var util=require(_0x1097('0x1'));var logger=require(_0x1097('0x2'))(_0x1097('0x3'));var moment=require(_0x1097('0x4'));var BPromise=require(_0x1097('0x5'));var rp=require(_0x1097('0x6'));var fs=require('fs');var path=require(_0x1097('0x7'));var rimraf=require(_0x1097('0x8'));var config=require(_0x1097('0x9'));var attributes=require(_0x1097('0xa'));module['exports']=function(_0x3d9a51,_0x733f76){return _0x3d9a51[_0x1097('0xb')](_0x1097('0xc'),attributes,{'tableName':_0x1097('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88ce=['path','rimraf','./dashboardItem.attributes','exports','define','dashboard_items','util','api','moment','bluebird','request-promise'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x88ce,0xab));var _0xe88c=function(_0xc36d1f,_0x1d9ffa){_0xc36d1f=_0xc36d1f-0x0;var _0x17676d=_0x88ce[_0xc36d1f];return _0x17676d;};'use strict';var _=require('lodash');var util=require(_0xe88c('0x0'));var logger=require('../../config/logger')(_0xe88c('0x1'));var moment=require(_0xe88c('0x2'));var BPromise=require(_0xe88c('0x3'));var rp=require(_0xe88c('0x4'));var fs=require('fs');var path=require(_0xe88c('0x5'));var rimraf=require(_0xe88c('0x6'));var config=require('../../config/environment');var attributes=require(_0xe88c('0x7'));module[_0xe88c('0x8')]=function(_0x8af413,_0x422448){return _0x8af413[_0xe88c('0x9')]('DashboardItem',attributes,{'tableName':_0xe88c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fab262e..8d22125 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 _0xdeac=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','request','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DashboardItem,\x20%s,\x20%s','message'];(function(_0x5a746e,_0x19e0f7){var _0x278566=function(_0x584c05){while(--_0x584c05){_0x5a746e['push'](_0x5a746e['shift']());}};_0x278566(++_0x19e0f7);}(_0xdeac,0x11a));var _0xcdea=function(_0x955365,_0x4d3c86){_0x955365=_0x955365-0x0;var _0x5e5830=_0xdeac[_0x955365];return _0x5e5830;};'use strict';var _=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var moment=require('moment');var BPromise=require(_0xcdea('0x2'));var rs=require(_0xcdea('0x3'));var fs=require('fs');var Redis=require(_0xcdea('0x4'));var db=require(_0xcdea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdea('0x6'))(_0xcdea('0x7'));var config=require(_0xcdea('0x8'));var jayson=require(_0xcdea('0x9'));var client=jayson[_0xcdea('0xa')][_0xcdea('0xb')]({'port':0x232a});config['redis']=_[_0xcdea('0xc')](config['redis'],{'host':_0xcdea('0xd'),'port':0x18eb});var socket=require(_0xcdea('0xe'))(new Redis(config[_0xcdea('0xf')]));require(_0xcdea('0x10'))[_0xcdea('0x11')](socket);function respondWithRpcPromise(_0x136dc7,_0x40eb2d,_0x36deec){return new BPromise(function(_0x43d5ef,_0x6251db){return client[_0xcdea('0x12')](_0x136dc7,_0x36deec)['then'](function(_0x5def31){logger['info']('DashboardItem,\x20%s,\x20%s',_0x40eb2d,'request\x20sent');logger[_0xcdea('0x13')](_0xcdea('0x14'),_0x40eb2d,_0xcdea('0x15'),JSON['stringify'](_0x5def31));if(_0x5def31[_0xcdea('0x16')]){if(_0x5def31[_0xcdea('0x16')][_0xcdea('0x17')]===0x1f4){logger[_0xcdea('0x16')](_0xcdea('0x18'),_0x40eb2d,_0x5def31[_0xcdea('0x16')][_0xcdea('0x19')]);return _0x6251db(_0x5def31[_0xcdea('0x16')][_0xcdea('0x19')]);}logger['error'](_0xcdea('0x18'),_0x40eb2d,_0x5def31[_0xcdea('0x16')]['message']);return _0x43d5ef(_0x5def31[_0xcdea('0x16')][_0xcdea('0x19')]);}else{logger['info'](_0xcdea('0x18'),_0x40eb2d,'request\x20sent');_0x43d5ef(_0x5def31[_0xcdea('0x1a')][_0xcdea('0x19')]);}})[_0xcdea('0x1b')](function(_0x38ecd4){logger[_0xcdea('0x16')](_0xcdea('0x18'),_0x40eb2d,_0x38ecd4);_0x6251db(_0x38ecd4);});});} \ No newline at end of file +var _0x7447=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x24cfd2,_0x599afb){var _0x56e85e=function(_0x218694){while(--_0x218694){_0x24cfd2['push'](_0x24cfd2['shift']());}};_0x56e85e(++_0x599afb);}(_0x7447,0x65));var _0x7744=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x7447[_0x737a1f];return _0x16eba1;};'use strict';var _=require(_0x7744('0x0'));var util=require(_0x7744('0x1'));var moment=require(_0x7744('0x2'));var BPromise=require(_0x7744('0x3'));var rs=require(_0x7744('0x4'));var fs=require('fs');var Redis=require(_0x7744('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7744('0x6'));var logger=require(_0x7744('0x7'))('rpc');var config=require(_0x7744('0x8'));var jayson=require(_0x7744('0x9'));var client=jayson[_0x7744('0xa')][_0x7744('0xb')]({'port':0x232a});config[_0x7744('0xc')]=_[_0x7744('0xd')](config[_0x7744('0xc')],{'host':_0x7744('0xe'),'port':0x18eb});var socket=require(_0x7744('0xf'))(new Redis(config[_0x7744('0xc')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x3b9208,_0x2c5c6a,_0x22566c){return new BPromise(function(_0x19b361,_0x2fea5f){return client[_0x7744('0x10')](_0x3b9208,_0x22566c)['then'](function(_0x332695){logger[_0x7744('0x11')](_0x7744('0x12'),_0x2c5c6a,_0x7744('0x13'));logger[_0x7744('0x14')](_0x7744('0x15'),_0x2c5c6a,'request\x20sent',JSON['stringify'](_0x332695));if(_0x332695['error']){if(_0x332695[_0x7744('0x16')][_0x7744('0x17')]===0x1f4){logger[_0x7744('0x16')](_0x7744('0x12'),_0x2c5c6a,_0x332695[_0x7744('0x16')][_0x7744('0x18')]);return _0x2fea5f(_0x332695[_0x7744('0x16')][_0x7744('0x18')]);}logger[_0x7744('0x16')]('DashboardItem,\x20%s,\x20%s',_0x2c5c6a,_0x332695[_0x7744('0x16')]['message']);return _0x19b361(_0x332695[_0x7744('0x16')][_0x7744('0x18')]);}else{logger['info'](_0x7744('0x12'),_0x2c5c6a,_0x7744('0x13'));_0x19b361(_0x332695[_0x7744('0x19')]['message']);}})[_0x7744('0x1a')](function(_0x372501){logger['error'](_0x7744('0x12'),_0x2c5c6a,_0x372501);_0x2fea5f(_0x372501);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 28f14f9..77cbfa2 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 _0x9e64=['update','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e64,0xf9));var _0x49e6=function(_0x3d6c6b,_0x498730){_0x3d6c6b=_0x3d6c6b-0x0;var _0x358af1=_0x9e64[_0x3d6c6b];return _0x358af1;};'use strict';var DashboardItemEvents=require(_0x49e6('0x0'));var events=[_0x49e6('0x1'),_0x49e6('0x2'),_0x49e6('0x3')];function createListener(_0x3f3c32,_0x330763){return function(_0xca7b6b){_0x330763['emit'](_0x3f3c32,_0xca7b6b);};}function removeListener(_0x429fbb,_0x21c3e0){return function(){DashboardItemEvents[_0x49e6('0x4')](_0x429fbb,_0x21c3e0);};}exports['register']=function(_0x322284){for(var _0x235012=0x0,_0x26b30d=events[_0x49e6('0x5')];_0x235012<_0x26b30d;_0x235012++){var _0x4c4f29=events[_0x235012];var _0x201d19=createListener(_0x49e6('0x6')+_0x4c4f29,_0x322284);DashboardItemEvents['on'](_0x4c4f29,_0x201d19);}}; \ No newline at end of file +var _0xa782=['save','update','emit','register','length','dashboardItem:'];(function(_0x24f0fd,_0x3b444c){var _0x5e1f87=function(_0x1321f7){while(--_0x1321f7){_0x24f0fd['push'](_0x24f0fd['shift']());}};_0x5e1f87(++_0x3b444c);}(_0xa782,0xea));var _0x2a78=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa782[_0x49b207];return _0x2dc8fa;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x2a78('0x0'),'remove',_0x2a78('0x1')];function createListener(_0x3269b4,_0x3ea99c){return function(_0x4dabd1){_0x3ea99c[_0x2a78('0x2')](_0x3269b4,_0x4dabd1);};}function removeListener(_0x3e4845,_0x19fc89){return function(){DashboardItemEvents['removeListener'](_0x3e4845,_0x19fc89);};}exports[_0x2a78('0x3')]=function(_0x44af09){for(var _0x43d812=0x0,_0x228a7f=events[_0x2a78('0x4')];_0x43d812<_0x228a7f;_0x43d812++){var _0x991916=events[_0x43d812];var _0x3da108=createListener(_0x2a78('0x5')+_0x991916,_0x44af09);DashboardItemEvents['on'](_0x991916,_0x3da108);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d1cf1ad..07ce944 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 _0xa239=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util'];(function(_0x4cdbdc,_0x4f78da){var _0x5007cf=function(_0x158413){while(--_0x158413){_0x4cdbdc['push'](_0x4cdbdc['shift']());}};_0x5007cf(++_0x4f78da);}(_0xa239,0x6a));var _0x9a23=function(_0x36db16,_0xbce8bd){_0x36db16=_0x36db16-0x0;var _0x5f3d61=_0xa239[_0x36db16];return _0x5f3d61;};'use strict';var multer=require(_0x9a23('0x0'));var util=require(_0x9a23('0x1'));var path=require('path');var timeout=require(_0x9a23('0x2'));var express=require(_0x9a23('0x3'));var router=express[_0x9a23('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a23('0x5'));var interaction=require(_0x9a23('0x6'));var config=require(_0x9a23('0x7'));var controller=require(_0x9a23('0x8'));router['get'](_0x9a23('0x9'),auth['isAuthenticated'](),controller[_0x9a23('0xa')]);router[_0x9a23('0xb')]('/',auth[_0x9a23('0xc')](),controller[_0x9a23('0xd')]);router[_0x9a23('0xe')](_0x9a23('0x9'),auth[_0x9a23('0xc')](),controller[_0x9a23('0xf')]);router[_0x9a23('0x10')](_0x9a23('0x9'),auth['isAuthenticated'](),controller[_0x9a23('0x11')]);module['exports']=router; \ No newline at end of file +var _0x578f=['create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x2a2ad0,_0x5f544d){var _0x16628e=function(_0x1fdae2){while(--_0x1fdae2){_0x2a2ad0['push'](_0x2a2ad0['shift']());}};_0x16628e(++_0x5f544d);}(_0x578f,0x1c0));var _0xf578=function(_0x7ad9e3,_0xd2e5cf){_0x7ad9e3=_0x7ad9e3-0x0;var _0x3daa36=_0x578f[_0x7ad9e3];return _0x3daa36;};'use strict';var multer=require(_0xf578('0x0'));var util=require('util');var path=require(_0xf578('0x1'));var timeout=require('connect-timeout');var express=require(_0xf578('0x2'));var router=express['Router']();var fs_extra=require(_0xf578('0x3'));var auth=require(_0xf578('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf578('0x5'));router[_0xf578('0x6')](_0xf578('0x7'),auth[_0xf578('0x8')](),controller[_0xf578('0x9')]);router[_0xf578('0xa')]('/',auth['isAuthenticated'](),controller[_0xf578('0xb')]);router[_0xf578('0xc')](_0xf578('0x7'),auth[_0xf578('0x8')](),controller[_0xf578('0xd')]);router[_0xf578('0xe')]('/:id',auth[_0xf578('0x8')](),controller[_0xf578('0xf')]);module[_0xf578('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0f16edb..aa3ee82 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 _0x9929=['sequelize','exports','first','STRING'];(function(_0x5ed756,_0x17ce2a){var _0x134220=function(_0x471327){while(--_0x471327){_0x5ed756['push'](_0x5ed756['shift']());}};_0x134220(++_0x17ce2a);}(_0x9929,0x150));var _0x9992=function(_0x18fd9c,_0x219b5b){_0x18fd9c=_0x18fd9c-0x0;var _0x4b81ac=_0x9929[_0x18fd9c];return _0x4b81ac;};'use strict';var Sequelize=require(_0x9992('0x0'));module[_0x9992('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x9992('0x2'),'second','third'),'allowNull':![],'defaultValue':_0x9992('0x2')},'description':{'type':Sequelize[_0x9992('0x3')]}}; \ No newline at end of file +var _0xc35d=['ENUM','first','second','exports','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xc35d,0xa3));var _0xdc35=function(_0x4ea435,_0x1db4b2){_0x4ea435=_0x4ea435-0x0;var _0x1a2f13=_0xc35d[_0x4ea435];return _0x1a2f13;};'use strict';var Sequelize=require('sequelize');module[_0xdc35('0x0')]={'name':{'type':Sequelize[_0xdc35('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xdc35('0x2')](_0xdc35('0x3'),_0xdc35('0x4'),'third'),'allowNull':![],'defaultValue':_0xdc35('0x3')},'description':{'type':Sequelize[_0xdc35('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1c45f18..cd7329a 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 _0x8343=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','Disposition','rawAttributes','type','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create'];(function(_0xf7f4f,_0x23deca){var _0x256a3f=function(_0x5c393c){while(--_0x5c393c){_0xf7f4f['push'](_0xf7f4f['shift']());}};_0x256a3f(++_0x23deca);}(_0x8343,0xa9));var _0x3834=function(_0x4e2f87,_0x117f52){_0x4e2f87=_0x4e2f87-0x0;var _0x81dc6a=_0x8343[_0x4e2f87];return _0x81dc6a;};'use strict';var emlformat=require(_0x3834('0x0'));var rimraf=require(_0x3834('0x1'));var zipdir=require(_0x3834('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3834('0x3'));var moment=require('moment');var BPromise=require(_0x3834('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3834('0x5'));var csv=require(_0x3834('0x6'));var ejs=require(_0x3834('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3834('0x8'));var squel=require(_0x3834('0x9'));var crypto=require(_0x3834('0xa'));var jsforce=require(_0x3834('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3834('0xc'));var Papa=require(_0x3834('0xd'));var Redis=require(_0x3834('0xe'));var authService=require(_0x3834('0xf'));var qs=require(_0x3834('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3834('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3834('0x12'));var licenseUtil=require(_0x3834('0x13'));var db=require(_0x3834('0x14'))['db'];function respondWithStatusCode(_0x107f4f,_0xf47d94){_0xf47d94=_0xf47d94||0xcc;return function(_0x1eeabd){if(_0x1eeabd){return _0x107f4f[_0x3834('0x15')](_0xf47d94);}return _0x107f4f[_0x3834('0x16')](_0xf47d94)[_0x3834('0x17')]();};}function respondWithResult(_0x179c98,_0xd97d8e){_0xd97d8e=_0xd97d8e||0xc8;return function(_0x94eec1){if(_0x94eec1){return _0x179c98['status'](_0xd97d8e)[_0x3834('0x18')](_0x94eec1);}};}function respondWithFilteredResult(_0x2056b8,_0x10dbf8){return function(_0x1ecce9){if(_0x1ecce9){var _0x3b1831=typeof _0x10dbf8[_0x3834('0x19')]===_0x3834('0x1a')&&typeof _0x10dbf8[_0x3834('0x1b')]===_0x3834('0x1a');var _0x4c2ddb=_0x1ecce9[_0x3834('0x1c')];var _0x82ab35=_0x3b1831?0x0:_0x10dbf8[_0x3834('0x19')];var _0x46fd33=_0x3b1831?_0x1ecce9['count']:_0x10dbf8[_0x3834('0x19')]+_0x10dbf8[_0x3834('0x1b')];var _0x1bf0b9;if(_0x46fd33>=_0x4c2ddb){_0x46fd33=_0x4c2ddb;_0x1bf0b9=0xc8;}else{_0x1bf0b9=0xce;}_0x2056b8[_0x3834('0x16')](_0x1bf0b9);return _0x2056b8[_0x3834('0x1d')](_0x3834('0x1e'),_0x82ab35+'-'+_0x46fd33+'/'+_0x4c2ddb)[_0x3834('0x18')](_0x1ecce9);}return null;};}function patchUpdates(_0xceade4){return function(_0x28b472){try{jsonpatch[_0x3834('0x1f')](_0x28b472,_0xceade4,!![]);}catch(_0x18dae7){return BPromise['reject'](_0x18dae7);}return _0x28b472[_0x3834('0x20')]();};}function saveUpdates(_0x1c537b,_0x3fd128){return function(_0x3e441d){if(_0x3e441d){return _0x3e441d['update'](_0x1c537b)[_0x3834('0x21')](function(_0x38734f){return _0x38734f;});}return null;};}function removeEntity(_0x5681dd,_0x5b33b5){return function(_0x185677){if(_0x185677){return _0x185677[_0x3834('0x22')]()[_0x3834('0x21')](function(){var _0x5c3c6e=_0x185677[_0x3834('0x23')]({'plain':!![]});var _0x49f763=_0x3834('0x24');return db[_0x3834('0x25')][_0x3834('0x22')]({'where':{'type':_0x49f763,'resourceId':_0x5c3c6e['id']}})['then'](function(){return _0x185677;});})[_0x3834('0x21')](function(){_0x5681dd[_0x3834('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7fac8,_0x335667){return function(_0x1ff1ed){if(!_0x1ff1ed){_0xb7fac8[_0x3834('0x15')](0x194);}return _0x1ff1ed;};}function handleError(_0x24296a,_0x4b858f){_0x4b858f=_0x4b858f||0x1f4;return function(_0x119db6){logger['error'](_0x119db6[_0x3834('0x26')]);if(_0x119db6[_0x3834('0x27')]){delete _0x119db6['name'];}_0x24296a[_0x3834('0x16')](_0x4b858f)[_0x3834('0x28')](_0x119db6);};}exports[_0x3834('0x29')]=function(_0x3b5a48,_0x593ad1){var _0x40289e={},_0x338057={},_0x40fc1a={'count':0x0,'rows':[]};var _0x12065e=_['map'](db[_0x3834('0x2a')][_0x3834('0x2b')],function(_0xf8cb3b){return{'name':_0xf8cb3b['fieldName'],'type':_0xf8cb3b[_0x3834('0x2c')]['key']};});_0x338057[_0x3834('0x2d')]=_[_0x3834('0x2e')](_0x12065e,_0x3834('0x27'));_0x338057[_0x3834('0x2f')]=_[_0x3834('0x30')](_0x3b5a48[_0x3834('0x2f')]);_0x338057['filters']=_['intersection'](_0x338057[_0x3834('0x2d')],_0x338057[_0x3834('0x2f')]);_0x40289e['attributes']=_[_0x3834('0x31')](_0x338057['model'],qs[_0x3834('0x32')](_0x3b5a48[_0x3834('0x2f')]['fields']));_0x40289e[_0x3834('0x33')]=_0x40289e[_0x3834('0x33')]['length']?_0x40289e[_0x3834('0x33')]:_0x338057[_0x3834('0x2d')];if(!_0x3b5a48[_0x3834('0x2f')][_0x3834('0x34')]('nolimit')){_0x40289e[_0x3834('0x1b')]=qs[_0x3834('0x1b')](_0x3b5a48[_0x3834('0x2f')]['limit']);_0x40289e[_0x3834('0x19')]=qs[_0x3834('0x19')](_0x3b5a48['query'][_0x3834('0x19')]);}_0x40289e[_0x3834('0x35')]=qs['sort'](_0x3b5a48['query']['sort']);_0x40289e[_0x3834('0x36')]=qs[_0x3834('0x37')](_[_0x3834('0x38')](_0x3b5a48[_0x3834('0x2f')],_0x338057[_0x3834('0x37')]),_0x12065e);if(_0x3b5a48[_0x3834('0x2f')][_0x3834('0x39')]){_0x40289e['where']=_[_0x3834('0x3a')](_0x40289e[_0x3834('0x36')],{'$or':_[_0x3834('0x2e')](_0x12065e,function(_0x431f8e){if(_0x431f8e[_0x3834('0x2c')]!==_0x3834('0x3b')){var _0x446515={};_0x446515[_0x431f8e[_0x3834('0x27')]]={'$like':'%'+_0x3b5a48['query'][_0x3834('0x39')]+'%'};return _0x446515;}})});}_0x40289e=_[_0x3834('0x3a')]({},_0x40289e,_0x3b5a48[_0x3834('0x3c')]);var _0x357bd8={'where':_0x40289e[_0x3834('0x36')]};return db[_0x3834('0x2a')][_0x3834('0x1c')](_0x357bd8)[_0x3834('0x21')](function(_0x19a1ab){_0x40fc1a[_0x3834('0x1c')]=_0x19a1ab;if(_0x3b5a48[_0x3834('0x2f')][_0x3834('0x3d')]){_0x40289e[_0x3834('0x3e')]=[{'all':!![]}];}return db[_0x3834('0x2a')][_0x3834('0x3f')](_0x40289e);})['then'](function(_0x3348a2){_0x40fc1a[_0x3834('0x40')]=_0x3348a2;return _0x40fc1a;})[_0x3834('0x21')](respondWithFilteredResult(_0x593ad1,_0x40289e))[_0x3834('0x41')](handleError(_0x593ad1,null));};exports[_0x3834('0x42')]=function(_0x478e25,_0x47ff2b){var _0x467e9e={'raw':!![],'where':{'id':_0x478e25[_0x3834('0x43')]['id']}},_0x58f038={};_0x58f038[_0x3834('0x2d')]=_['keys'](db[_0x3834('0x2a')][_0x3834('0x2b')]);_0x58f038[_0x3834('0x2f')]=_[_0x3834('0x30')](_0x478e25[_0x3834('0x2f')]);_0x58f038['filters']=_[_0x3834('0x31')](_0x58f038['model'],_0x58f038['query']);_0x467e9e[_0x3834('0x33')]=_['intersection'](_0x58f038[_0x3834('0x2d')],qs['fields'](_0x478e25[_0x3834('0x2f')]['fields']));_0x467e9e[_0x3834('0x33')]=_0x467e9e[_0x3834('0x33')][_0x3834('0x44')]?_0x467e9e[_0x3834('0x33')]:_0x58f038['model'];if(_0x478e25['query'][_0x3834('0x3d')]){_0x467e9e[_0x3834('0x3e')]=[{'all':!![]}];}_0x467e9e=_['merge']({},_0x467e9e,_0x478e25[_0x3834('0x3c')]);return db[_0x3834('0x2a')][_0x3834('0x45')](_0x467e9e)[_0x3834('0x21')](handleEntityNotFound(_0x47ff2b,null))['then'](respondWithResult(_0x47ff2b,null))['catch'](handleError(_0x47ff2b,null));};exports['create']=function(_0x22f1a8,_0x3793f8){return db[_0x3834('0x2a')][_0x3834('0x46')](_0x22f1a8[_0x3834('0x47')],{})[_0x3834('0x21')](function(_0x3fb20a){var _0x176146=_0x22f1a8[_0x3834('0x48')][_0x3834('0x23')]({'plain':!![]});if(!_0x176146)throw new Error(_0x3834('0x49'));if(_0x176146[_0x3834('0x4a')]==='user'){var _0x3f3da8=_0x3fb20a[_0x3834('0x23')]({'plain':!![]});var _0x1dba6=_0x3834('0x24');return db[_0x3834('0x4b')][_0x3834('0x45')]({'where':{'name':_0x1dba6,'userProfileId':_0x176146[_0x3834('0x4c')]},'raw':!![]})[_0x3834('0x21')](function(_0xd562ee){if(_0xd562ee&&_0xd562ee[_0x3834('0x4d')]===0x0){return db['UserProfileResource'][_0x3834('0x46')]({'name':_0x3f3da8['name'],'resourceId':_0x3f3da8['id'],'type':_0xd562ee[_0x3834('0x27')],'sectionId':_0xd562ee['id']},{})[_0x3834('0x21')](function(){return _0x3fb20a;});}else{return _0x3fb20a;}})[_0x3834('0x41')](function(_0x412685){logger[_0x3834('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x412685);throw _0x412685;});}return _0x3fb20a;})['then'](respondWithResult(_0x3793f8,0xc9))[_0x3834('0x41')](handleError(_0x3793f8,null));};exports[_0x3834('0x4f')]=function(_0xb0ef69,_0xd4f365){if(_0xb0ef69[_0x3834('0x47')]['id']){delete _0xb0ef69[_0x3834('0x47')]['id'];}return db['Disposition'][_0x3834('0x45')]({'where':{'id':_0xb0ef69[_0x3834('0x43')]['id']}})[_0x3834('0x21')](handleEntityNotFound(_0xd4f365,null))[_0x3834('0x21')](saveUpdates(_0xb0ef69[_0x3834('0x47')],null))[_0x3834('0x21')](respondWithResult(_0xd4f365,null))['catch'](handleError(_0xd4f365,null));};exports['destroy']=function(_0x312b0e,_0xb710e){return db[_0x3834('0x2a')][_0x3834('0x45')]({'where':{'id':_0x312b0e[_0x3834('0x43')]['id']}})[_0x3834('0x21')](handleEntityNotFound(_0xb710e,null))[_0x3834('0x21')](removeEntity(_0xb710e,null))[_0x3834('0x41')](handleError(_0xb710e,null));}; \ No newline at end of file +var _0x3809=['Content-Range','apply','reject','update','destroy','then','get','Dispositions','UserProfileResource','error','name','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x13d538,_0x5c09b5){var _0x2d1323=function(_0x43a6f7){while(--_0x43a6f7){_0x13d538['push'](_0x13d538['shift']());}};_0x2d1323(++_0x5c09b5);}(_0x3809,0xca));var _0x9380=function(_0x2715b6,_0xac1aa8){_0x2715b6=_0x2715b6-0x0;var _0xc93f5c=_0x3809[_0x2715b6];return _0xc93f5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9380('0x0'));var zipdir=require(_0x9380('0x1'));var jsonpatch=require(_0x9380('0x2'));var rp=require('request-promise');var moment=require(_0x9380('0x3'));var BPromise=require(_0x9380('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9380('0x5'));var sox=require(_0x9380('0x6'));var csv=require(_0x9380('0x7'));var ejs=require(_0x9380('0x8'));var fs=require('fs');var fs_extra=require(_0x9380('0x9'));var _=require(_0x9380('0xa'));var squel=require(_0x9380('0xb'));var crypto=require(_0x9380('0xc'));var jsforce=require(_0x9380('0xd'));var deskjs=require(_0x9380('0xe'));var toCsv=require(_0x9380('0x7'));var querystring=require('querystring');var Papa=require(_0x9380('0xf'));var Redis=require(_0x9380('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9380('0x11'));var as=require(_0x9380('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9380('0x13'))('api');var utils=require(_0x9380('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9380('0x15'));var db=require(_0x9380('0x16'))['db'];function respondWithStatusCode(_0x3a4a27,_0x26e95e){_0x26e95e=_0x26e95e||0xcc;return function(_0x3aa059){if(_0x3aa059){return _0x3a4a27[_0x9380('0x17')](_0x26e95e);}return _0x3a4a27[_0x9380('0x18')](_0x26e95e)[_0x9380('0x19')]();};}function respondWithResult(_0x2d2e9b,_0x48bf69){_0x48bf69=_0x48bf69||0xc8;return function(_0x5cae94){if(_0x5cae94){return _0x2d2e9b[_0x9380('0x18')](_0x48bf69)[_0x9380('0x1a')](_0x5cae94);}};}function respondWithFilteredResult(_0x3d2dd1,_0x144349){return function(_0x2bdc45){if(_0x2bdc45){var _0x4fdef6=typeof _0x144349['offset']===_0x9380('0x1b')&&typeof _0x144349[_0x9380('0x1c')]==='undefined';var _0x4d0cbc=_0x2bdc45[_0x9380('0x1d')];var _0x1e04cf=_0x4fdef6?0x0:_0x144349[_0x9380('0x1e')];var _0x8b62d4=_0x4fdef6?_0x2bdc45[_0x9380('0x1d')]:_0x144349['offset']+_0x144349[_0x9380('0x1c')];var _0x3e282c;if(_0x8b62d4>=_0x4d0cbc){_0x8b62d4=_0x4d0cbc;_0x3e282c=0xc8;}else{_0x3e282c=0xce;}_0x3d2dd1[_0x9380('0x18')](_0x3e282c);return _0x3d2dd1[_0x9380('0x1f')](_0x9380('0x20'),_0x1e04cf+'-'+_0x8b62d4+'/'+_0x4d0cbc)[_0x9380('0x1a')](_0x2bdc45);}return null;};}function patchUpdates(_0x51b45f){return function(_0x4a06a9){try{jsonpatch[_0x9380('0x21')](_0x4a06a9,_0x51b45f,!![]);}catch(_0x3e59ee){return BPromise[_0x9380('0x22')](_0x3e59ee);}return _0x4a06a9['save']();};}function saveUpdates(_0x1ba538,_0x3d444c){return function(_0x1524d9){if(_0x1524d9){return _0x1524d9[_0x9380('0x23')](_0x1ba538)['then'](function(_0xe6ceb7){return _0xe6ceb7;});}return null;};}function removeEntity(_0x212718,_0x1d662e){return function(_0xd7b16e){if(_0xd7b16e){return _0xd7b16e[_0x9380('0x24')]()[_0x9380('0x25')](function(){var _0x13c6b9=_0xd7b16e[_0x9380('0x26')]({'plain':!![]});var _0x34bd9d=_0x9380('0x27');return db[_0x9380('0x28')]['destroy']({'where':{'type':_0x34bd9d,'resourceId':_0x13c6b9['id']}})[_0x9380('0x25')](function(){return _0xd7b16e;});})['then'](function(){_0x212718[_0x9380('0x18')](0xcc)[_0x9380('0x19')]();});}};}function handleEntityNotFound(_0x34ac34,_0x43840b){return function(_0x1a6c10){if(!_0x1a6c10){_0x34ac34['sendStatus'](0x194);}return _0x1a6c10;};}function handleError(_0xb53a72,_0x35d089){_0x35d089=_0x35d089||0x1f4;return function(_0x27a95c){logger[_0x9380('0x29')](_0x27a95c['stack']);if(_0x27a95c[_0x9380('0x2a')]){delete _0x27a95c[_0x9380('0x2a')];}_0xb53a72[_0x9380('0x18')](_0x35d089)['send'](_0x27a95c);};}exports['index']=function(_0xd8db52,_0x410452){var _0x2e0112={},_0x35310f={},_0xc3adaa={'count':0x0,'rows':[]};var _0x3424a9=_[_0x9380('0x2b')](db[_0x9380('0x2c')][_0x9380('0x2d')],function(_0x5a358b){return{'name':_0x5a358b[_0x9380('0x2e')],'type':_0x5a358b[_0x9380('0x2f')][_0x9380('0x30')]};});_0x35310f[_0x9380('0x31')]=_['map'](_0x3424a9,_0x9380('0x2a'));_0x35310f[_0x9380('0x32')]=_[_0x9380('0x33')](_0xd8db52['query']);_0x35310f['filters']=_['intersection'](_0x35310f['model'],_0x35310f[_0x9380('0x32')]);_0x2e0112[_0x9380('0x34')]=_[_0x9380('0x35')](_0x35310f[_0x9380('0x31')],qs[_0x9380('0x36')](_0xd8db52[_0x9380('0x32')]['fields']));_0x2e0112['attributes']=_0x2e0112['attributes'][_0x9380('0x37')]?_0x2e0112[_0x9380('0x34')]:_0x35310f[_0x9380('0x31')];if(!_0xd8db52[_0x9380('0x32')]['hasOwnProperty']('nolimit')){_0x2e0112[_0x9380('0x1c')]=qs['limit'](_0xd8db52[_0x9380('0x32')]['limit']);_0x2e0112[_0x9380('0x1e')]=qs[_0x9380('0x1e')](_0xd8db52['query'][_0x9380('0x1e')]);}_0x2e0112[_0x9380('0x38')]=qs[_0x9380('0x39')](_0xd8db52['query'][_0x9380('0x39')]);_0x2e0112['where']=qs[_0x9380('0x3a')](_['pick'](_0xd8db52[_0x9380('0x32')],_0x35310f[_0x9380('0x3a')]),_0x3424a9);if(_0xd8db52[_0x9380('0x32')][_0x9380('0x3b')]){_0x2e0112['where']=_[_0x9380('0x3c')](_0x2e0112[_0x9380('0x3d')],{'$or':_['map'](_0x3424a9,function(_0x4add35){if(_0x4add35[_0x9380('0x2f')]!==_0x9380('0x3e')){var _0x2297a3={};_0x2297a3[_0x4add35[_0x9380('0x2a')]]={'$like':'%'+_0xd8db52[_0x9380('0x32')]['filter']+'%'};return _0x2297a3;}})});}_0x2e0112=_[_0x9380('0x3c')]({},_0x2e0112,_0xd8db52[_0x9380('0x3f')]);var _0x1c1726={'where':_0x2e0112[_0x9380('0x3d')]};return db[_0x9380('0x2c')][_0x9380('0x1d')](_0x1c1726)[_0x9380('0x25')](function(_0x1018eb){_0xc3adaa[_0x9380('0x1d')]=_0x1018eb;if(_0xd8db52[_0x9380('0x32')][_0x9380('0x40')]){_0x2e0112['include']=[{'all':!![]}];}return db['Disposition'][_0x9380('0x41')](_0x2e0112);})['then'](function(_0x4d37b1){_0xc3adaa[_0x9380('0x42')]=_0x4d37b1;return _0xc3adaa;})['then'](respondWithFilteredResult(_0x410452,_0x2e0112))['catch'](handleError(_0x410452,null));};exports[_0x9380('0x43')]=function(_0x34e05b,_0x3eff2e){var _0x475d46={'raw':!![],'where':{'id':_0x34e05b[_0x9380('0x44')]['id']}},_0x1ae757={};_0x1ae757['model']=_[_0x9380('0x33')](db['Disposition'][_0x9380('0x2d')]);_0x1ae757['query']=_[_0x9380('0x33')](_0x34e05b[_0x9380('0x32')]);_0x1ae757[_0x9380('0x3a')]=_['intersection'](_0x1ae757[_0x9380('0x31')],_0x1ae757['query']);_0x475d46[_0x9380('0x34')]=_[_0x9380('0x35')](_0x1ae757['model'],qs[_0x9380('0x36')](_0x34e05b[_0x9380('0x32')]['fields']));_0x475d46[_0x9380('0x34')]=_0x475d46[_0x9380('0x34')][_0x9380('0x37')]?_0x475d46[_0x9380('0x34')]:_0x1ae757[_0x9380('0x31')];if(_0x34e05b[_0x9380('0x32')]['includeAll']){_0x475d46['include']=[{'all':!![]}];}_0x475d46=_[_0x9380('0x3c')]({},_0x475d46,_0x34e05b[_0x9380('0x3f')]);return db[_0x9380('0x2c')][_0x9380('0x45')](_0x475d46)['then'](handleEntityNotFound(_0x3eff2e,null))[_0x9380('0x25')](respondWithResult(_0x3eff2e,null))['catch'](handleError(_0x3eff2e,null));};exports['create']=function(_0x3ee343,_0x59d4a8){return db['Disposition'][_0x9380('0x46')](_0x3ee343[_0x9380('0x47')],{})[_0x9380('0x25')](function(_0x231a50){var _0x355d5c=_0x3ee343[_0x9380('0x48')]['get']({'plain':!![]});if(!_0x355d5c)throw new Error(_0x9380('0x49'));if(_0x355d5c[_0x9380('0x4a')]==='user'){var _0x5d3901=_0x231a50[_0x9380('0x26')]({'plain':!![]});var _0x2e4ccb=_0x9380('0x27');return db['UserProfileSection'][_0x9380('0x45')]({'where':{'name':_0x2e4ccb,'userProfileId':_0x355d5c[_0x9380('0x4b')]},'raw':!![]})[_0x9380('0x25')](function(_0x2260a1){if(_0x2260a1&&_0x2260a1['autoAssociation']===0x0){return db[_0x9380('0x28')]['create']({'name':_0x5d3901[_0x9380('0x2a')],'resourceId':_0x5d3901['id'],'type':_0x2260a1[_0x9380('0x2a')],'sectionId':_0x2260a1['id']},{})[_0x9380('0x25')](function(){return _0x231a50;});}else{return _0x231a50;}})['catch'](function(_0x1a038f){logger[_0x9380('0x29')](_0x9380('0x4c'),_0x1a038f);throw _0x1a038f;});}return _0x231a50;})[_0x9380('0x25')](respondWithResult(_0x59d4a8,0xc9))['catch'](handleError(_0x59d4a8,null));};exports[_0x9380('0x23')]=function(_0x3d4bf8,_0x475d29){if(_0x3d4bf8[_0x9380('0x47')]['id']){delete _0x3d4bf8[_0x9380('0x47')]['id'];}return db['Disposition']['find']({'where':{'id':_0x3d4bf8[_0x9380('0x44')]['id']}})['then'](handleEntityNotFound(_0x475d29,null))[_0x9380('0x25')](saveUpdates(_0x3d4bf8['body'],null))[_0x9380('0x25')](respondWithResult(_0x475d29,null))[_0x9380('0x4d')](handleError(_0x475d29,null));};exports['destroy']=function(_0x4a1c7d,_0x97fd2b){return db[_0x9380('0x2c')]['find']({'where':{'id':_0x4a1c7d[_0x9380('0x44')]['id']}})[_0x9380('0x25')](handleEntityNotFound(_0x97fd2b,null))[_0x9380('0x25')](removeEntity(_0x97fd2b,null))[_0x9380('0x4d')](handleError(_0x97fd2b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index baeac70..454ec5d 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 _0xeea1=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','ListId','name_chat','name','ChatWebsiteId'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xeea1,0x197));var _0x1eea=function(_0x5c37c4,_0x21ceb1){_0x5c37c4=_0x5c37c4-0x0;var _0x3c8a78=_0xeea1[_0x5c37c4];return _0x3c8a78;};'use strict';var _=require(_0x1eea('0x0'));var util=require(_0x1eea('0x1'));var logger=require(_0x1eea('0x2'))(_0x1eea('0x3'));var moment=require(_0x1eea('0x4'));var BPromise=require('bluebird');var rp=require(_0x1eea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1eea('0x6'));var config=require(_0x1eea('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x9050a0,_0x4b545c){return _0x9050a0[_0x1eea('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x1eea('0x9')]},{'unique':!![],'name':_0x1eea('0xa'),'fields':[_0x1eea('0xb'),_0x1eea('0xc')]},{'unique':!![],'name':_0x1eea('0xd'),'fields':[_0x1eea('0xb'),_0x1eea('0xe')]},{'unique':!![],'name':_0x1eea('0xf'),'fields':['name',_0x1eea('0x10')]},{'unique':!![],'name':_0x1eea('0x11'),'fields':[_0x1eea('0xb'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x1eea('0xb'),_0x1eea('0x12')]},{'unique':!![],'name':_0x1eea('0x13'),'fields':[_0x1eea('0xb'),_0x1eea('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc7e=['name_chat','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','lodash','api','moment','bluebird','path','./disposition.attributes','exports','define','Disposition','name_voice','ListId'];(function(_0x55d364,_0x2fc3fd){var _0x27ac99=function(_0x378f6f){while(--_0x378f6f){_0x55d364['push'](_0x55d364['shift']());}};_0x27ac99(++_0x2fc3fd);}(_0xfc7e,0x1bd));var _0xefc7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc7e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xefc7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefc7('0x1'));var moment=require(_0xefc7('0x2'));var BPromise=require(_0xefc7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefc7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xefc7('0x5'));module[_0xefc7('0x6')]=function(_0x180191,_0x5ebc65){return _0x180191[_0xefc7('0x7')](_0xefc7('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xefc7('0x9'),'fields':['name',_0xefc7('0xa')]},{'unique':!![],'name':_0xefc7('0xb'),'fields':[_0xefc7('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0xefc7('0xd'),'fields':[_0xefc7('0xc'),_0xefc7('0xe')]},{'unique':!![],'name':_0xefc7('0xf'),'fields':[_0xefc7('0xc'),_0xefc7('0x10')]},{'unique':!![],'name':_0xefc7('0x11'),'fields':[_0xefc7('0xc'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xefc7('0xc'),_0xefc7('0x12')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xefc7('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7530bd5..08cbb32 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(_0x46f902,_0x1a97e6){var _0x3b2a12=function(_0x59050e){while(--_0x59050e){_0x46f902['push'](_0x46f902['shift']());}};_0x3b2a12(++_0x1a97e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x260ace,_0x2952f1){var _0xf7e0c2=function(_0x1cc810){while(--_0x1cc810){_0x260ace['push'](_0x260ace['shift']());}};_0xf7e0c2(++_0x2952f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 3aad331..b0c8e5c 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 _0x72dc=['destroy','exports','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','post','create','put','update','delete'];(function(_0x4955f8,_0x58650f){var _0x3775b4=function(_0x21c3ea){while(--_0x21c3ea){_0x4955f8['push'](_0x4955f8['shift']());}};_0x3775b4(++_0x58650f);}(_0x72dc,0x1a2));var _0xc72d=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x72dc[_0x43f881];return _0x365c14;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc72d('0x0'));var router=express[_0xc72d('0x1')]();var fs_extra=require(_0xc72d('0x2'));var auth=require(_0xc72d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc72d('0x4'));var controller=require(_0xc72d('0x5'));router[_0xc72d('0x6')]('/',auth[_0xc72d('0x7')](),controller['index']);router[_0xc72d('0x6')](_0xc72d('0x8'),auth[_0xc72d('0x7')](),controller['show']);router[_0xc72d('0x9')]('/',auth[_0xc72d('0x7')](),controller[_0xc72d('0xa')]);router[_0xc72d('0xb')](_0xc72d('0x8'),auth[_0xc72d('0x7')](),controller[_0xc72d('0xc')]);router[_0xc72d('0xd')]('/:id',auth[_0xc72d('0x7')](),controller[_0xc72d('0xe')]);module[_0xc72d('0xf')]=router; \ No newline at end of file +var _0xba88=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x1ec591,_0x2a6fbb){var _0x3c9432=function(_0x40c0b6){while(--_0x40c0b6){_0x1ec591['push'](_0x1ec591['shift']());}};_0x3c9432(++_0x2a6fbb);}(_0xba88,0xa7));var _0x8ba8=function(_0x44b65e,_0x10bf5b){_0x44b65e=_0x44b65e-0x0;var _0x12d3ff=_0xba88[_0x44b65e];return _0x12d3ff;};'use strict';var multer=require(_0x8ba8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ba8('0x1'));var express=require(_0x8ba8('0x2'));var router=express[_0x8ba8('0x3')]();var fs_extra=require(_0x8ba8('0x4'));var auth=require(_0x8ba8('0x5'));var interaction=require(_0x8ba8('0x6'));var config=require(_0x8ba8('0x7'));var controller=require(_0x8ba8('0x8'));router[_0x8ba8('0x9')]('/',auth['isAuthenticated'](),controller[_0x8ba8('0xa')]);router[_0x8ba8('0x9')](_0x8ba8('0xb'),auth[_0x8ba8('0xc')](),controller[_0x8ba8('0xd')]);router['post']('/',auth[_0x8ba8('0xc')](),controller['create']);router[_0x8ba8('0xe')](_0x8ba8('0xb'),auth['isAuthenticated'](),controller[_0x8ba8('0xf')]);router[_0x8ba8('0x10')]('/:id',auth[_0x8ba8('0xc')](),controller[_0x8ba8('0x11')]);module[_0x8ba8('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 9c3ef29..b7d27c4 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 _0x3d33=['4800','9600','12000','14400','7200','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400'];(function(_0x3d6af3,_0x257969){var _0x976478=function(_0xe36e44){while(--_0xe36e44){_0x3d6af3['push'](_0x3d6af3['shift']());}};_0x976478(++_0x257969);}(_0x3d33,0x1ae));var _0x33d3=function(_0x4938ae,_0xa6036a){_0x4938ae=_0x4938ae-0x0;var _0xc070e8=_0x3d33[_0x4938ae];return _0xc070e8;};'use strict';var Sequelize=require(_0x33d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x33d3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x33d3('0x1')]},'ecm':{'type':Sequelize[_0x33d3('0x2')]('yes','no'),'defaultValue':_0x33d3('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x33d3('0x4')},'localstationid':{'type':Sequelize[_0x33d3('0x1')],'unique':_0x33d3('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x33d3('0x6'),_0x33d3('0x7'),'7200',_0x33d3('0x8'),_0x33d3('0x9'),_0x33d3('0xa')),'defaultValue':_0x33d3('0x7')},'maxrate':{'type':Sequelize[_0x33d3('0x2')](_0x33d3('0x6'),'4800',_0x33d3('0xb'),_0x33d3('0x8'),_0x33d3('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x33d3('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x33d3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x33d3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x33d3('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x33d3('0xd'),_0x33d3('0xe'),_0x33d3('0xf'),'KHOMP'),'defaultValue':_0x33d3('0xd')},'key':{'type':Sequelize[_0x33d3('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x33d3('0x10')],'defaultValue':function(){return _0x33d3('0x11');}},'notificationSound':{'type':Sequelize[_0x33d3('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x33d3('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x33d3('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x33d3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x33d3('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x33d3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x33d3('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b9108){if(!_0x1b9108)this[_0x33d3('0x14')](_0x33d3('0x15'),null);this[_0x33d3('0x14')](_0x33d3('0x16'),_0x1b9108);}}}; \ No newline at end of file +var _0xf5f6=['setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','2400','4800','9600','14400','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x39f055,_0x5776b2){var _0x221f14=function(_0x1a6c0a){while(--_0x1a6c0a){_0x39f055['push'](_0x39f055['shift']());}};_0x221f14(++_0x5776b2);}(_0xf5f6,0x167));var _0x6f5f=function(_0x4d6804,_0x32486c){_0x4d6804=_0x4d6804-0x0;var _0x2c71e9=_0xf5f6[_0x4d6804];return _0x2c71e9;};'use strict';var Sequelize=require('sequelize');module[_0x6f5f('0x0')]={'name':{'type':Sequelize[_0x6f5f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6f5f('0x1')]},'ecm':{'type':Sequelize[_0x6f5f('0x2')](_0x6f5f('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6f5f('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6f5f('0x4')},'minrate':{'type':Sequelize[_0x6f5f('0x2')](_0x6f5f('0x5'),_0x6f5f('0x6'),'7200',_0x6f5f('0x7'),'12000',_0x6f5f('0x8')),'defaultValue':_0x6f5f('0x6')},'maxrate':{'type':Sequelize[_0x6f5f('0x2')]('2400',_0x6f5f('0x6'),'7200',_0x6f5f('0x7'),'12000','14400'),'defaultValue':_0x6f5f('0x8')},'modem':{'type':Sequelize[_0x6f5f('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6f5f('0x1')],'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[_0x6f5f('0x9')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6f5f('0x2')](_0x6f5f('0xa'),_0x6f5f('0xb'),'DADHI',_0x6f5f('0xc')),'defaultValue':_0x6f5f('0xa')},'key':{'type':Sequelize[_0x6f5f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6f5f('0xd')],'defaultValue':function(){return _0x6f5f('0xe');}},'notificationSound':{'type':Sequelize[_0x6f5f('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6f5f('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6f5f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6f5f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6f5f('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x6f5f('0xf')],'defaultValue':![],'comment':_0x6f5f('0x11'),'set':function(_0x43389a){if(!_0x43389a)this['setDataValue'](_0x6f5f('0x12'),null);this[_0x6f5f('0x13')](_0x6f5f('0x14'),_0x43389a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ba59438..d5868c1 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 _0x1ca9=['getAnswers','findOne','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','finally','send','getApplications','context','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','t38timeout','FAXOPT(','Wait','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','isArray','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','Pause','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','merge','options','FaxAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer'];(function(_0xeaa3bd,_0x166691){var _0x2e1174=function(_0x310580){while(--_0x310580){_0xeaa3bd['push'](_0xeaa3bd['shift']());}};_0x2e1174(++_0x166691);}(_0x1ca9,0x121));var _0x91ca=function(_0xc0ece3,_0x56be51){_0xc0ece3=_0xc0ece3-0x0;var _0x106ff3=_0x1ca9[_0xc0ece3];return _0x106ff3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x91ca('0x0'));var rp=require(_0x91ca('0x1'));var moment=require('moment');var BPromise=require(_0x91ca('0x2'));var Mustache=require(_0x91ca('0x3'));var util=require(_0x91ca('0x4'));var path=require('path');var sox=require(_0x91ca('0x5'));var csv=require(_0x91ca('0x6'));var ejs=require(_0x91ca('0x7'));var fs=require('fs');var fs_extra=require(_0x91ca('0x8'));var _=require(_0x91ca('0x9'));var squel=require(_0x91ca('0xa'));var crypto=require(_0x91ca('0xb'));var jsforce=require(_0x91ca('0xc'));var deskjs=require(_0x91ca('0xd'));var toCsv=require(_0x91ca('0x6'));var querystring=require('querystring');var Papa=require(_0x91ca('0xe'));var Redis=require(_0x91ca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x91ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91ca('0x11'));var logger=require(_0x91ca('0x12'))(_0x91ca('0x13'));var utils=require(_0x91ca('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x91ca('0x15')](config[_0x91ca('0x16')],{'host':_0x91ca('0x17'),'port':0x18eb});var socket=require(_0x91ca('0x18'))(new Redis(config[_0x91ca('0x16')]));require(_0x91ca('0x19'))[_0x91ca('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91ca('0x1b')][_0x91ca('0x1c')]({'port':0x232c});var client9002=jayson[_0x91ca('0x1b')][_0x91ca('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x37a719,_0xeaa087,_0x8d009d,_0x26cfe7){return new BPromise(function(_0x5b44fc,_0x48ffa9){var _0x3f660e=_0x26cfe7||client;return _0x3f660e[_0x91ca('0x1d')](_0x37a719,_0x8d009d)[_0x91ca('0x1e')](function(_0x540789){logger[_0x91ca('0x1f')](_0x91ca('0x20'),_0xeaa087,'request\x20sent');logger[_0x91ca('0x21')](_0x91ca('0x22'),_0xeaa087,_0x91ca('0x23'),JSON['stringify'](_0x540789));if(_0x540789[_0x91ca('0x24')]){if(_0x540789[_0x91ca('0x24')]['code']===0x1f4){logger[_0x91ca('0x24')](_0x91ca('0x20'),_0xeaa087,_0x540789['error'][_0x91ca('0x25')]);return _0x48ffa9(_0x540789[_0x91ca('0x24')]['message']);}logger[_0x91ca('0x24')](_0x91ca('0x20'),_0xeaa087,_0x540789[_0x91ca('0x24')][_0x91ca('0x25')]);return _0x5b44fc(_0x540789[_0x91ca('0x24')]['message']);}else{logger[_0x91ca('0x1f')](_0x91ca('0x20'),_0xeaa087,_0x91ca('0x23'));_0x5b44fc(_0x540789[_0x91ca('0x26')][_0x91ca('0x25')]);}})[_0x91ca('0x27')](function(_0x1a0a27){logger[_0x91ca('0x24')]('FaxAccount,\x20%s,\x20%s',_0xeaa087,_0x1a0a27);_0x48ffa9(_0x1a0a27);});});}function respondWithStatusCode(_0x1608a2,_0xc92e38){_0xc92e38=_0xc92e38||0xcc;return function(_0x4b2ebf){if(_0x4b2ebf){return _0x1608a2[_0x91ca('0x28')](_0xc92e38);}return _0x1608a2[_0x91ca('0x29')](_0xc92e38)[_0x91ca('0x2a')]();};}function respondWithResult(_0x46e5b9,_0x14a3a6){_0x14a3a6=_0x14a3a6||0xc8;return function(_0x3ac267){if(_0x3ac267){return _0x46e5b9[_0x91ca('0x29')](_0x14a3a6)[_0x91ca('0x2b')](_0x3ac267);}};}function respondWithFilteredResult(_0x178e53,_0x22ac24){return function(_0x6d4877){if(_0x6d4877){var _0x5c75d9=typeof _0x22ac24['offset']===_0x91ca('0x2c')&&typeof _0x22ac24[_0x91ca('0x2d')]===_0x91ca('0x2c');var _0x5388e4=_0x6d4877[_0x91ca('0x2e')];var _0x4e5f02=_0x5c75d9?0x0:_0x22ac24[_0x91ca('0x2f')];var _0x2a0b28=_0x5c75d9?_0x6d4877[_0x91ca('0x2e')]:_0x22ac24[_0x91ca('0x2f')]+_0x22ac24['limit'];var _0x4f4341;if(_0x2a0b28>=_0x5388e4){_0x2a0b28=_0x5388e4;_0x4f4341=0xc8;}else{_0x4f4341=0xce;}_0x178e53['status'](_0x4f4341);return _0x178e53[_0x91ca('0x30')](_0x91ca('0x31'),_0x4e5f02+'-'+_0x2a0b28+'/'+_0x5388e4)[_0x91ca('0x2b')](_0x6d4877);}return null;};}function patchUpdates(_0x44d2e6){return function(_0x9168ba){try{jsonpatch['apply'](_0x9168ba,_0x44d2e6,!![]);}catch(_0x45bb80){return BPromise[_0x91ca('0x32')](_0x45bb80);}return _0x9168ba[_0x91ca('0x33')]();};}function saveUpdates(_0x5268ed,_0x351309){return function(_0x1e54da){if(_0x1e54da){return _0x1e54da[_0x91ca('0x34')](_0x5268ed)[_0x91ca('0x1e')](function(_0x2f94e5){return _0x2f94e5;});}return null;};}function removeEntity(_0x4d2c85,_0x4abba5){return function(_0x3ad539){if(_0x3ad539){return _0x3ad539[_0x91ca('0x35')]()[_0x91ca('0x1e')](function(){var _0x4a67da=_0x3ad539[_0x91ca('0x36')]({'plain':!![]});var _0x53d22b='FaxAccounts';return db[_0x91ca('0x37')][_0x91ca('0x35')]({'where':{'type':_0x53d22b,'resourceId':_0x4a67da['id']}})['then'](function(){return _0x3ad539;});})['then'](function(){_0x4d2c85[_0x91ca('0x29')](0xcc)[_0x91ca('0x2a')]();});}};}function handleEntityNotFound(_0x569596,_0x102fc7){return function(_0x5b3d75){if(!_0x5b3d75){_0x569596['sendStatus'](0x194);}return _0x5b3d75;};}function handleError(_0x59e0d3,_0x24edf0){_0x24edf0=_0x24edf0||0x1f4;return function(_0x1d32d1){logger[_0x91ca('0x24')](_0x1d32d1['stack']);if(_0x1d32d1['name']){delete _0x1d32d1['name'];}_0x59e0d3[_0x91ca('0x29')](_0x24edf0)['send'](_0x1d32d1);};}exports['index']=function(_0x24eb77,_0x392447){var _0x3e7bfc={'include':[{'model':db[_0x91ca('0x38')],'as':'mandatoryDispositionPause'}]},_0x47abd8={},_0x5104f6={'count':0x0,'rows':[]};var _0x2d464e=_['map'](db['FaxAccount'][_0x91ca('0x39')],function(_0xa65723){return{'name':_0xa65723[_0x91ca('0x3a')],'type':_0xa65723[_0x91ca('0x3b')][_0x91ca('0x3c')]};});_0x47abd8['model']=_[_0x91ca('0x3d')](_0x2d464e,'name');_0x47abd8[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x24eb77[_0x91ca('0x3e')]);_0x47abd8['filters']=_[_0x91ca('0x40')](_0x47abd8[_0x91ca('0x41')],_0x47abd8[_0x91ca('0x3e')]);_0x3e7bfc[_0x91ca('0x42')]=_['intersection'](_0x47abd8[_0x91ca('0x41')],qs['fields'](_0x24eb77[_0x91ca('0x3e')][_0x91ca('0x43')]));_0x3e7bfc[_0x91ca('0x42')]=_0x3e7bfc[_0x91ca('0x42')]['length']?_0x3e7bfc[_0x91ca('0x42')]:_0x47abd8[_0x91ca('0x41')];if(!_0x24eb77[_0x91ca('0x3e')][_0x91ca('0x44')]('nolimit')){_0x3e7bfc[_0x91ca('0x2d')]=qs['limit'](_0x24eb77[_0x91ca('0x3e')]['limit']);_0x3e7bfc['offset']=qs[_0x91ca('0x2f')](_0x24eb77[_0x91ca('0x3e')][_0x91ca('0x2f')]);}_0x3e7bfc[_0x91ca('0x45')]=qs['sort'](_0x24eb77[_0x91ca('0x3e')][_0x91ca('0x46')]);_0x3e7bfc[_0x91ca('0x47')]=qs['filters'](_[_0x91ca('0x48')](_0x24eb77[_0x91ca('0x3e')],_0x47abd8['filters']),_0x2d464e);if(_0x24eb77[_0x91ca('0x3e')][_0x91ca('0x49')]){_0x3e7bfc['where']=_['merge'](_0x3e7bfc[_0x91ca('0x47')],{'$or':_['map'](_0x2d464e,function(_0x3d55ae){if(_0x3d55ae[_0x91ca('0x3b')]!==_0x91ca('0x4a')){var _0x4f4712={};_0x4f4712[_0x3d55ae[_0x91ca('0x4b')]]={'$like':'%'+_0x24eb77[_0x91ca('0x3e')][_0x91ca('0x49')]+'%'};return _0x4f4712;}})});}_0x3e7bfc=_[_0x91ca('0x4c')]({},_0x3e7bfc,_0x24eb77[_0x91ca('0x4d')]);var _0x1fef28={'where':_0x3e7bfc[_0x91ca('0x47')]};return db[_0x91ca('0x4e')][_0x91ca('0x2e')](_0x1fef28)[_0x91ca('0x1e')](function(_0x2b9aa3){_0x5104f6[_0x91ca('0x2e')]=_0x2b9aa3;if(_0x24eb77['query'][_0x91ca('0x4f')]){_0x3e7bfc[_0x91ca('0x50')]=[{'all':!![]}];}return db[_0x91ca('0x4e')][_0x91ca('0x51')](_0x3e7bfc);})[_0x91ca('0x1e')](function(_0x4b5a59){_0x5104f6[_0x91ca('0x52')]=_0x4b5a59;return _0x5104f6;})[_0x91ca('0x1e')](respondWithFilteredResult(_0x392447,_0x3e7bfc))['catch'](handleError(_0x392447,null));};exports[_0x91ca('0x53')]=function(_0x10718a,_0x35f10a){var _0x1a24cd={'raw':![],'where':{'id':_0x10718a[_0x91ca('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x91ca('0x55')}]},_0x5d1adb={};_0x5d1adb['model']=_[_0x91ca('0x3f')](db[_0x91ca('0x4e')][_0x91ca('0x39')]);_0x5d1adb[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x10718a['query']);_0x5d1adb[_0x91ca('0x56')]=_[_0x91ca('0x40')](_0x5d1adb[_0x91ca('0x41')],_0x5d1adb[_0x91ca('0x3e')]);_0x1a24cd['attributes']=_[_0x91ca('0x40')](_0x5d1adb['model'],qs['fields'](_0x10718a[_0x91ca('0x3e')]['fields']));_0x1a24cd[_0x91ca('0x42')]=_0x1a24cd[_0x91ca('0x42')]['length']?_0x1a24cd[_0x91ca('0x42')]:_0x5d1adb['model'];if(_0x10718a['query'][_0x91ca('0x4f')]){_0x1a24cd[_0x91ca('0x50')]=[{'all':!![]}];}_0x1a24cd=_[_0x91ca('0x4c')]({},_0x1a24cd,_0x10718a['options']);return db[_0x91ca('0x4e')][_0x91ca('0x57')](_0x1a24cd)[_0x91ca('0x1e')](handleEntityNotFound(_0x35f10a,null))[_0x91ca('0x1e')](respondWithResult(_0x35f10a,null))[_0x91ca('0x27')](handleError(_0x35f10a,null));};exports['create']=function(_0x1cf26b,_0x3dcb7c){return db[_0x91ca('0x4e')][_0x91ca('0x58')](_0x1cf26b[_0x91ca('0x59')],{})[_0x91ca('0x1e')](function(_0x224900){var _0x47be93=_0x1cf26b[_0x91ca('0x5a')][_0x91ca('0x36')]({'plain':!![]});if(!_0x47be93)throw new Error(_0x91ca('0x5b'));if(_0x47be93[_0x91ca('0x5c')]===_0x91ca('0x5a')){var _0x189152=_0x224900[_0x91ca('0x36')]({'plain':!![]});var _0x12683e=_0x91ca('0x5d');return db[_0x91ca('0x5e')][_0x91ca('0x57')]({'where':{'name':_0x12683e,'userProfileId':_0x47be93[_0x91ca('0x5f')]},'raw':!![]})[_0x91ca('0x1e')](function(_0x4db249){if(_0x4db249&&_0x4db249['autoAssociation']===0x0){return db[_0x91ca('0x37')][_0x91ca('0x58')]({'name':_0x189152[_0x91ca('0x4b')],'resourceId':_0x189152['id'],'type':_0x4db249[_0x91ca('0x4b')],'sectionId':_0x4db249['id']},{})[_0x91ca('0x1e')](function(){return _0x224900;});}else{return _0x224900;}})[_0x91ca('0x27')](function(_0x5c8bf4){logger[_0x91ca('0x24')](_0x91ca('0x60'),_0x5c8bf4);throw _0x5c8bf4;});}return _0x224900;})[_0x91ca('0x1e')](respondWithResult(_0x3dcb7c,0xc9))[_0x91ca('0x27')](handleError(_0x3dcb7c,null));};exports['update']=function(_0x57a1f1,_0x525652){if(_0x57a1f1[_0x91ca('0x59')]['id']){delete _0x57a1f1['body']['id'];}return db[_0x91ca('0x4e')]['find']({'where':{'id':_0x57a1f1['params']['id']},'include':[{'model':db[_0x91ca('0x38')],'as':_0x91ca('0x55')}]})[_0x91ca('0x1e')](handleEntityNotFound(_0x525652,null))['then'](saveUpdates(_0x57a1f1[_0x91ca('0x59')],null))[_0x91ca('0x1e')](respondWithResult(_0x525652,null))['catch'](handleError(_0x525652,null));};exports[_0x91ca('0x35')]=function(_0x38ecd4,_0x22dbe3){return db[_0x91ca('0x4e')][_0x91ca('0x57')]({'where':{'id':_0x38ecd4['params']['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x22dbe3,null))[_0x91ca('0x1e')](removeEntity(_0x22dbe3,null))[_0x91ca('0x27')](handleError(_0x22dbe3,null));};exports['describe']=function(_0x14e8aa,_0x3b5e3e){return db['FaxAccount'][_0x91ca('0x61')]()[_0x91ca('0x1e')](respondWithResult(_0x3b5e3e,null))[_0x91ca('0x27')](handleError(_0x3b5e3e,null));};exports['addDisposition']=function(_0x47a014,_0x205d73,_0x3ffa88){if(_0x47a014[_0x91ca('0x59')]['id']){delete _0x47a014[_0x91ca('0x59')]['id'];}return db[_0x91ca('0x4e')]['find']({'where':{'id':_0x47a014[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x205d73,null))['then'](function(_0x357372){if(_0x357372){_0x47a014[_0x91ca('0x59')][_0x91ca('0x62')]=_0x357372['id'];return db[_0x91ca('0x63')][_0x91ca('0x58')](_0x47a014[_0x91ca('0x59')]);}})['then'](respondWithResult(_0x205d73,null))[_0x91ca('0x27')](handleError(_0x205d73,null));};exports[_0x91ca('0x64')]=function(_0x130ee2,_0x5f449f,_0x4b2301){var _0x4c8e32={'raw':![],'where':{}};var _0x1d5dc1={};var _0x17334e={'count':0x0,'rows':[]};return db[_0x91ca('0x4e')]['findOne']({'where':{'id':_0x130ee2[_0x91ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x5f449f,null))[_0x91ca('0x1e')](function(_0x5f3ca0){if(_0x5f3ca0){_0x1d5dc1[_0x91ca('0x41')]=_['keys'](db[_0x91ca('0x63')]['rawAttributes']);_0x1d5dc1[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x130ee2[_0x91ca('0x3e')]);_0x1d5dc1[_0x91ca('0x56')]=_[_0x91ca('0x40')](_0x1d5dc1[_0x91ca('0x41')],_0x1d5dc1[_0x91ca('0x3e')]);_0x4c8e32[_0x91ca('0x42')]=_[_0x91ca('0x40')](_0x1d5dc1[_0x91ca('0x41')],qs['fields'](_0x130ee2[_0x91ca('0x3e')][_0x91ca('0x43')]));_0x4c8e32[_0x91ca('0x42')]=_0x4c8e32[_0x91ca('0x42')][_0x91ca('0x65')]?_0x4c8e32['attributes']:_0x1d5dc1[_0x91ca('0x41')];if(!_0x130ee2['query'][_0x91ca('0x44')](_0x91ca('0x66'))){_0x4c8e32[_0x91ca('0x2d')]=qs[_0x91ca('0x2d')](_0x130ee2['query'][_0x91ca('0x2d')]);_0x4c8e32[_0x91ca('0x2f')]=qs[_0x91ca('0x2f')](_0x130ee2[_0x91ca('0x3e')][_0x91ca('0x2f')]);}_0x4c8e32[_0x91ca('0x45')]=qs[_0x91ca('0x46')](_0x130ee2['query'][_0x91ca('0x46')]);_0x4c8e32[_0x91ca('0x47')]=qs[_0x91ca('0x56')](_['pick'](_0x130ee2['query'],_0x1d5dc1['filters']));_0x4c8e32[_0x91ca('0x47')]['FaxAccountId']=_0x5f3ca0['id'];if(_0x130ee2['query'][_0x91ca('0x49')]){_0x4c8e32[_0x91ca('0x47')]=_[_0x91ca('0x4c')](_0x4c8e32[_0x91ca('0x47')],{'$or':_[_0x91ca('0x3d')](_0x4c8e32[_0x91ca('0x42')],function(_0x4b264a){var _0x374866={};_0x374866[_0x4b264a]={'$like':'%'+_0x130ee2[_0x91ca('0x3e')][_0x91ca('0x49')]+'%'};return _0x374866;})});}_0x4c8e32=_[_0x91ca('0x4c')]({},_0x4c8e32,_0x130ee2[_0x91ca('0x4d')]);return db[_0x91ca('0x63')][_0x91ca('0x2e')]({'where':_0x4c8e32['where']})['then'](function(_0x5f2731){_0x17334e[_0x91ca('0x2e')]=_0x5f2731;if(_0x130ee2[_0x91ca('0x3e')]['includeAll']){_0x4c8e32[_0x91ca('0x50')]=[{'all':!![]}];}return db[_0x91ca('0x63')][_0x91ca('0x51')](_0x4c8e32);})[_0x91ca('0x1e')](function(_0x2ae80f){_0x17334e[_0x91ca('0x52')]=_0x2ae80f;return _0x17334e;});}})[_0x91ca('0x1e')](respondWithFilteredResult(_0x5f449f,_0x4c8e32))['catch'](handleError(_0x5f449f,null));};exports[_0x91ca('0x67')]=function(_0x352a36,_0x697eba,_0x44c1a1){return db['FaxAccount'][_0x91ca('0x57')]({'where':{'id':_0x352a36[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x697eba,null))[_0x91ca('0x1e')](function(_0xd0e020){if(_0xd0e020){return _0xd0e020['removeDispositions'](_0x352a36[_0x91ca('0x3e')][_0x91ca('0x68')]);}})[_0x91ca('0x1e')](respondWithStatusCode(_0x697eba,null))['catch'](handleError(_0x697eba,null));};exports[_0x91ca('0x69')]=function(_0xfdafbc,_0x11c80a,_0x4b8069){if(_0xfdafbc[_0x91ca('0x59')]['id']){delete _0xfdafbc[_0x91ca('0x59')]['id'];}return db[_0x91ca('0x4e')][_0x91ca('0x57')]({'where':{'id':_0xfdafbc[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x11c80a,null))['then'](function(_0x3af4ac){if(_0x3af4ac){_0xfdafbc[_0x91ca('0x59')]['FaxAccountId']=_0x3af4ac['id'];return db[_0x91ca('0x6a')][_0x91ca('0x58')](_0xfdafbc[_0x91ca('0x59')]);}})[_0x91ca('0x1e')](respondWithResult(_0x11c80a,null))[_0x91ca('0x27')](handleError(_0x11c80a,null));};exports[_0x91ca('0x6b')]=function(_0x5b638b,_0x247a1c,_0x2f14f7){var _0x21ac7c={'raw':![],'where':{}};var _0x462db1={};var _0x31cd1a={'count':0x0,'rows':[]};return db[_0x91ca('0x4e')][_0x91ca('0x6c')]({'where':{'id':_0x5b638b[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x247a1c,null))[_0x91ca('0x1e')](function(_0x1056e3){if(_0x1056e3){_0x462db1['model']=_[_0x91ca('0x3f')](db[_0x91ca('0x6a')]['rawAttributes']);_0x462db1[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x5b638b[_0x91ca('0x3e')]);_0x462db1[_0x91ca('0x56')]=_[_0x91ca('0x40')](_0x462db1[_0x91ca('0x41')],_0x462db1[_0x91ca('0x3e')]);_0x21ac7c[_0x91ca('0x42')]=_['intersection'](_0x462db1[_0x91ca('0x41')],qs[_0x91ca('0x43')](_0x5b638b['query'][_0x91ca('0x43')]));_0x21ac7c[_0x91ca('0x42')]=_0x21ac7c[_0x91ca('0x42')][_0x91ca('0x65')]?_0x21ac7c[_0x91ca('0x42')]:_0x462db1['model'];if(!_0x5b638b[_0x91ca('0x3e')][_0x91ca('0x44')]('nolimit')){_0x21ac7c['limit']=qs[_0x91ca('0x2d')](_0x5b638b[_0x91ca('0x3e')][_0x91ca('0x2d')]);_0x21ac7c[_0x91ca('0x2f')]=qs['offset'](_0x5b638b['query'][_0x91ca('0x2f')]);}_0x21ac7c[_0x91ca('0x45')]=qs[_0x91ca('0x46')](_0x5b638b[_0x91ca('0x3e')]['sort']);_0x21ac7c[_0x91ca('0x47')]=qs[_0x91ca('0x56')](_['pick'](_0x5b638b['query'],_0x462db1[_0x91ca('0x56')]));_0x21ac7c[_0x91ca('0x47')][_0x91ca('0x62')]=_0x1056e3['id'];if(_0x5b638b[_0x91ca('0x3e')][_0x91ca('0x49')]){_0x21ac7c['where']=_['merge'](_0x21ac7c[_0x91ca('0x47')],{'$or':_[_0x91ca('0x3d')](_0x21ac7c[_0x91ca('0x42')],function(_0x584e63){var _0x5f0956={};_0x5f0956[_0x584e63]={'$like':'%'+_0x5b638b['query']['filter']+'%'};return _0x5f0956;})});}_0x21ac7c=_[_0x91ca('0x4c')]({},_0x21ac7c,_0x5b638b[_0x91ca('0x4d')]);return db[_0x91ca('0x6a')][_0x91ca('0x2e')]({'where':_0x21ac7c[_0x91ca('0x47')]})['then'](function(_0x3f0967){_0x31cd1a[_0x91ca('0x2e')]=_0x3f0967;if(_0x5b638b[_0x91ca('0x3e')][_0x91ca('0x4f')]){_0x21ac7c['include']=[{'all':!![]}];}return db[_0x91ca('0x6a')]['findAll'](_0x21ac7c);})[_0x91ca('0x1e')](function(_0x240b86){_0x31cd1a[_0x91ca('0x52')]=_0x240b86;return _0x31cd1a;});}})['then'](respondWithFilteredResult(_0x247a1c,_0x21ac7c))[_0x91ca('0x27')](handleError(_0x247a1c,null));};exports['removeAnswers']=function(_0x18abdf,_0x1b959e,_0xec51ec){return db[_0x91ca('0x4e')][_0x91ca('0x57')]({'where':{'id':_0x18abdf['params']['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x1b959e,null))[_0x91ca('0x1e')](function(_0xb83ae7){if(_0xb83ae7){return _0xb83ae7[_0x91ca('0x6d')](_0x18abdf[_0x91ca('0x3e')][_0x91ca('0x68')]);}})[_0x91ca('0x1e')](respondWithStatusCode(_0x1b959e,null))[_0x91ca('0x27')](handleError(_0x1b959e,null));};exports['addInteraction']=function(_0x4b4389,_0x4af235,_0x284227){return db[_0x91ca('0x6e')][_0x91ca('0x57')]({'where':{'id':_0x4b4389[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x4af235,null))[_0x91ca('0x1e')](function(_0x3d08e2){if(_0x3d08e2){return _0x3d08e2[_0x91ca('0x6f')](_0x4b4389[_0x91ca('0x59')]['ids'],_[_0x91ca('0x70')](_0x4b4389['body'],[_0x91ca('0x68'),'id'])||{});}})['then'](respondWithResult(_0x4af235,null))[_0x91ca('0x27')](handleError(_0x4af235,null));};exports[_0x91ca('0x71')]=function(_0x201b6d,_0x28d928,_0x175b0e){var _0x22e5eb={'raw':![],'where':{}};var _0x4608bf={};var _0x277801={'count':0x0,'rows':[]};return db[_0x91ca('0x4e')][_0x91ca('0x6c')]({'where':{'id':_0x201b6d[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x28d928,null))[_0x91ca('0x1e')](function(_0x31f1ff){if(_0x31f1ff){_0x4608bf[_0x91ca('0x41')]=_['keys'](db[_0x91ca('0x6e')][_0x91ca('0x39')]);_0x4608bf[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x201b6d[_0x91ca('0x3e')]);_0x4608bf[_0x91ca('0x56')]=_['intersection'](_0x4608bf[_0x91ca('0x41')],_0x4608bf['query']);_0x22e5eb['attributes']=_[_0x91ca('0x40')](_0x4608bf[_0x91ca('0x41')],qs[_0x91ca('0x43')](_0x201b6d['query']['fields']));_0x22e5eb[_0x91ca('0x42')]=_0x22e5eb['attributes'][_0x91ca('0x65')]?_0x22e5eb[_0x91ca('0x42')]:_0x4608bf[_0x91ca('0x41')];if(!_0x201b6d[_0x91ca('0x3e')][_0x91ca('0x44')]('nolimit')){_0x22e5eb[_0x91ca('0x2d')]=qs[_0x91ca('0x2d')](_0x201b6d[_0x91ca('0x3e')]['limit']);_0x22e5eb[_0x91ca('0x2f')]=qs['offset'](_0x201b6d[_0x91ca('0x3e')][_0x91ca('0x2f')]);}_0x22e5eb['order']=qs[_0x91ca('0x46')](_0x201b6d[_0x91ca('0x3e')][_0x91ca('0x46')]);_0x22e5eb[_0x91ca('0x47')]=qs[_0x91ca('0x56')](_[_0x91ca('0x48')](_0x201b6d[_0x91ca('0x3e')],_0x4608bf[_0x91ca('0x56')]));_0x22e5eb[_0x91ca('0x47')][_0x91ca('0x62')]=_0x31f1ff['id'];if(_0x201b6d[_0x91ca('0x3e')][_0x91ca('0x49')]){_0x22e5eb[_0x91ca('0x47')]=_[_0x91ca('0x4c')](_0x22e5eb[_0x91ca('0x47')],{'$or':_[_0x91ca('0x3d')](_0x22e5eb[_0x91ca('0x42')],function(_0x529300){var _0x290431={};_0x290431[_0x529300]={'$like':'%'+_0x201b6d[_0x91ca('0x3e')]['filter']+'%'};return _0x290431;})});}_0x22e5eb=_['merge']({},_0x22e5eb,_0x201b6d[_0x91ca('0x4d')]);return db[_0x91ca('0x6e')][_0x91ca('0x2e')]({'where':_0x22e5eb[_0x91ca('0x47')]})[_0x91ca('0x1e')](function(_0x3369ac){_0x277801[_0x91ca('0x2e')]=_0x3369ac;if(_0x201b6d[_0x91ca('0x3e')][_0x91ca('0x4f')]){_0x22e5eb[_0x91ca('0x50')]=[{'model':db[_0x91ca('0x72')],'as':_0x91ca('0x73'),'required':![]},{'model':db[_0x91ca('0x74')],'as':_0x91ca('0x75'),'attributes':[_0x91ca('0x4b'),_0x91ca('0x76'),_0x91ca('0x77')],'required':![]},{'model':db[_0x91ca('0x78')],'as':_0x91ca('0x79'),'attributes':['id','name','color'],'where':_0x201b6d[_0x91ca('0x3e')][_0x91ca('0x7a')]?{'id':_0x201b6d[_0x91ca('0x3e')]['tag']}:undefined,'required':_0x201b6d[_0x91ca('0x3e')]['tag']?!![]:![]}];}return db[_0x91ca('0x6e')][_0x91ca('0x51')](_0x22e5eb);})[_0x91ca('0x1e')](function(_0x2a0a43){_0x277801[_0x91ca('0x52')]=_0x2a0a43;return _0x277801;});}})[_0x91ca('0x1e')](respondWithFilteredResult(_0x28d928,_0x22e5eb))[_0x91ca('0x27')](handleError(_0x28d928,null));};exports[_0x91ca('0x7b')]=function(_0x4191fb,_0x36f30f){var _0x497cb1=_0x4191fb[_0x91ca('0x54')]['id'];var _0xd909f0=_0x4191fb[_0x91ca('0x59')];var _0x2d57bf=0xc8;var _0x15d928=null;return db[_0x91ca('0x7c')][_0x91ca('0x7d')]({'isolationLevel':db[_0x91ca('0x7c')][_0x91ca('0x7e')][_0x91ca('0x7f')][_0x91ca('0x80')]},function(_0x2d32db){return db[_0x91ca('0x4e')][_0x91ca('0x6c')]({'where':{'id':_0x497cb1},'transaction':_0x2d32db})[_0x91ca('0x1e')](function(_0x5094cf){if(_0x5094cf){return db['FaxApplication'][_0x91ca('0x35')]({'where':{'FaxAccountId':_0x497cb1},'transaction':_0x2d32db})[_0x91ca('0x1e')](function(){var _0x3cc859=_['map'](_0xd909f0,function(_0x4304dc){_0x4304dc['FaxAccountId']=_0x497cb1;return _0x4304dc;});return db[_0x91ca('0x81')][_0x91ca('0x82')](_0x3cc859,{'transaction':_0x2d32db});});}else{_0x2d57bf=0x194;_0x15d928=[];}});})['then'](function(){if(_0x2d57bf!==0x194){return db[_0x91ca('0x81')][_0x91ca('0x83')]({'where':{'FaxAccountId':_0x497cb1},'order':'priority'})[_0x91ca('0x1e')](function(_0x187aa6){_0x15d928=_0x187aa6;});}})[_0x91ca('0x27')](function(_0x4e39ae){_0x2d57bf=0x1f4;logger[_0x91ca('0x24')](_0x4e39ae[_0x91ca('0x84')]);if(_0x4e39ae['name']){delete _0x4e39ae[_0x91ca('0x4b')];}_0x15d928=_0x4e39ae;})[_0x91ca('0x85')](function(){if(_0x15d928===null){_0x36f30f[_0x91ca('0x28')](_0x2d57bf);}else{if(_0x2d57bf===0x1f4){_0x36f30f['status'](_0x2d57bf)[_0x91ca('0x86')](_0x15d928);}else{_0x36f30f[_0x91ca('0x29')](_0x2d57bf)[_0x91ca('0x2b')](_0x15d928);}}});};exports['getApplications']=function(_0x39f50b,_0x592a51,_0x13459c){var _0x3b6111={};var _0x3e1159={};var _0x129403;var _0x1e304e;return db[_0x91ca('0x4e')][_0x91ca('0x6c')]({'where':{'id':_0x39f50b[_0x91ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x592a51,null))['then'](function(_0x3d8943){if(_0x3d8943){_0x129403=_0x3d8943;_0x3e1159[_0x91ca('0x41')]=_['keys'](db[_0x91ca('0x81')][_0x91ca('0x39')]);_0x3e1159['query']=_['keys'](_0x39f50b['query']);_0x3e1159[_0x91ca('0x56')]=_[_0x91ca('0x40')](_0x3e1159['model'],_0x3e1159[_0x91ca('0x3e')]);_0x3b6111[_0x91ca('0x42')]=_[_0x91ca('0x40')](_0x3e1159[_0x91ca('0x41')],qs[_0x91ca('0x43')](_0x39f50b['query']['fields']));_0x3b6111[_0x91ca('0x42')]=_0x3b6111[_0x91ca('0x42')][_0x91ca('0x65')]?_0x3b6111[_0x91ca('0x42')]:_0x3e1159[_0x91ca('0x41')];_0x3b6111[_0x91ca('0x45')]=qs['sort'](_0x39f50b['query'][_0x91ca('0x46')]);_0x3b6111[_0x91ca('0x47')]=qs[_0x91ca('0x56')](_[_0x91ca('0x48')](_0x39f50b['query'],_0x3e1159[_0x91ca('0x56')]));if(_0x39f50b[_0x91ca('0x3e')][_0x91ca('0x49')]){_0x3b6111[_0x91ca('0x47')]=_[_0x91ca('0x4c')](_0x3b6111[_0x91ca('0x47')],{'$or':_[_0x91ca('0x3d')](_0x3b6111[_0x91ca('0x42')],function(_0x26e6e0){var _0x56f460={};_0x56f460[_0x26e6e0]={'$like':'%'+_0x39f50b[_0x91ca('0x3e')][_0x91ca('0x49')]+'%'};return _0x56f460;})});}_0x3b6111=_[_0x91ca('0x4c')]({},_0x3b6111,_0x39f50b[_0x91ca('0x4d')]);return _0x129403[_0x91ca('0x87')](_0x3b6111);}})[_0x91ca('0x1e')](function(_0x576183){if(_0x576183){_0x1e304e=_0x576183[_0x91ca('0x65')];if(!_0x39f50b[_0x91ca('0x3e')][_0x91ca('0x44')](_0x91ca('0x66'))){_0x3b6111[_0x91ca('0x2d')]=qs[_0x91ca('0x2d')](_0x39f50b[_0x91ca('0x3e')][_0x91ca('0x2d')]);_0x3b6111[_0x91ca('0x2f')]=qs[_0x91ca('0x2f')](_0x39f50b[_0x91ca('0x3e')][_0x91ca('0x2f')]);}return _0x129403[_0x91ca('0x87')](_0x3b6111);}})['then'](function(_0xdcf655){if(_0xdcf655){return _0xdcf655?{'count':_0x1e304e,'rows':_0xdcf655}:null;}})[_0x91ca('0x1e')](respondWithResult(_0x592a51,null))[_0x91ca('0x27')](handleError(_0x592a51,null));};function Extension(_0x156508,_0x47da12,_0x50a9e0,_0x4d5ea9){this[_0x91ca('0x88')]='from-voip-provider';this['exten']=_0x156508[_0x91ca('0x89')];this[_0x91ca('0x8a')]=_0x4d5ea9;this[_0x91ca('0x3b')]=_0x91ca('0x8b');this[_0x91ca('0x8c')]=_0x91ca('0x8d');this[_0x91ca('0x62')]=_0x156508['id'];this[_0x91ca('0x8e')]=_0x47da12;this[_0x91ca('0x8f')]=_0x50a9e0;}function createExtensionsReciveFax(_0x59dcbb){var _0x1c8061=0x1;var _0x29f179=[];_0x29f179[_0x91ca('0x90')](new Extension(_0x59dcbb,_0x1c8061,'',_0x91ca('0x91')));_0x1c8061+=0x1;_0x29f179['push'](new Extension(_0x59dcbb,_0x1c8061,_0x91ca('0x92'),_0x91ca('0x93')));_0x1c8061+=0x1;for(var _0x2c688e in _0x59dcbb){if(_0x59dcbb[_0x91ca('0x44')](_0x2c688e)&&(_0x2c688e===_0x91ca('0x94')||_0x2c688e==='localstationid'||_0x2c688e===_0x91ca('0x95')||_0x2c688e===_0x91ca('0x96')||_0x2c688e===_0x91ca('0x97')||_0x2c688e===_0x91ca('0x98')||_0x2c688e==='minrate'||_0x2c688e==='modem'||_0x2c688e===_0x91ca('0x99'))){_0x29f179[_0x91ca('0x90')](new Extension(_0x59dcbb,_0x1c8061,_0x91ca('0x9a')+_0x2c688e+')='+_0x59dcbb[_0x2c688e],_0x91ca('0x93')));_0x1c8061+=0x1;}}_0x29f179[_0x91ca('0x90')](new Extension(_0x59dcbb,_0x1c8061,'6',_0x91ca('0x9b')));_0x1c8061+=0x1;_0x29f179[_0x91ca('0x90')](new Extension(_0x59dcbb,_0x1c8061,'/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'));_0x1c8061=0x0;return _0x29f179;}exports[_0x91ca('0x9c')]=function(_0x10668c,_0xf302fe,_0x3c1259){var _0x4b0126;return db[_0x91ca('0x7c')][_0x91ca('0x7d')](function(_0x3deff0){return db[_0x91ca('0x4e')][_0x91ca('0x58')](_0x10668c[_0x91ca('0x59')],{'transaction':_0x3deff0})['then'](function(_0x23ff49){_0x4b0126=_0x23ff49['get']({'plain':!![]});return db[_0x91ca('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x4b0126),{'transaction':_0x3deff0});});})[_0x91ca('0x1e')](function(){return _0x4b0126;})[_0x91ca('0x1e')](respondWithResult(_0xf302fe,null))[_0x91ca('0x27')](handleError(_0xf302fe,null));};exports[_0x91ca('0x9e')]=function(_0x319e23,_0x242de6,_0x2e4ba7){var _0x1f42b9;return db[_0x91ca('0x7c')][_0x91ca('0x7d')](function(_0x2c0953){return db[_0x91ca('0x4e')][_0x91ca('0x34')](_0x319e23[_0x91ca('0x59')],{'where':{'id':_0x319e23[_0x91ca('0x59')]['id']},'transaction':_0x2c0953})[_0x91ca('0x1e')](function(_0x570458){return db[_0x91ca('0x9d')][_0x91ca('0x35')]({'where':{'FaxAccountId':_0x319e23[_0x91ca('0x59')]['id']},'transaction':_0x2c0953})[_0x91ca('0x1e')](function(_0x825da9){return db[_0x91ca('0x9d')][_0x91ca('0x82')](createExtensionsReciveFax(_[_0x91ca('0x70')](_0x319e23[_0x91ca('0x59')],[_0x91ca('0x9f'),_0x91ca('0x3c'),_0x91ca('0xa0'),_0x91ca('0xa1'),_0x91ca('0xa2'),_0x91ca('0xa3')])),{'transaction':_0x2c0953});});});})[_0x91ca('0x1e')](function(){return db[_0x91ca('0x4e')][_0x91ca('0xa4')](_0x319e23[_0x91ca('0x59')]['id']);})[_0x91ca('0x1e')](respondWithResult(_0x242de6,null))[_0x91ca('0x27')](handleError(_0x242de6,null));};exports[_0x91ca('0xa5')]=function(_0x3c344b,_0x3b881c,_0x5ab2ab){var _0x10c7ac={'raw':!![],'where':{}};var _0x5e342f={};var _0x52f5c0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x91ca('0x6c')]({'where':{'id':_0x3c344b[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x3b881c,null))[_0x91ca('0x1e')](function(_0x5b971d){if(_0x5b971d){_0x5e342f['model']=_[_0x91ca('0x3f')](db['FaxMessage'][_0x91ca('0x39')]);_0x5e342f[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x3c344b['query']);_0x5e342f[_0x91ca('0x56')]=_['intersection'](_0x5e342f['model'],_0x5e342f[_0x91ca('0x3e')]);_0x10c7ac['attributes']=_[_0x91ca('0x40')](_0x5e342f[_0x91ca('0x41')],qs['fields'](_0x3c344b['query']['fields']));_0x10c7ac[_0x91ca('0x42')]=_0x10c7ac[_0x91ca('0x42')]['length']?_0x10c7ac[_0x91ca('0x42')]:_0x5e342f[_0x91ca('0x41')];if(!_0x3c344b[_0x91ca('0x3e')][_0x91ca('0x44')]('nolimit')){_0x10c7ac['limit']=qs[_0x91ca('0x2d')](_0x3c344b['query'][_0x91ca('0x2d')]);_0x10c7ac[_0x91ca('0x2f')]=qs[_0x91ca('0x2f')](_0x3c344b[_0x91ca('0x3e')][_0x91ca('0x2f')]);}_0x10c7ac[_0x91ca('0x45')]=qs[_0x91ca('0x46')](_0x3c344b[_0x91ca('0x3e')]['sort']);_0x10c7ac[_0x91ca('0x47')]=qs['filters'](_[_0x91ca('0x48')](_0x3c344b[_0x91ca('0x3e')],_0x5e342f[_0x91ca('0x56')]));_0x10c7ac['where']['FaxAccountId']=_0x5b971d['id'];if(_0x3c344b[_0x91ca('0x3e')][_0x91ca('0x49')]){_0x10c7ac[_0x91ca('0x47')]=_[_0x91ca('0x4c')](_0x10c7ac[_0x91ca('0x47')],{'$or':_[_0x91ca('0x3d')](_0x10c7ac[_0x91ca('0x42')],function(_0x3afc08){var _0x103366={};_0x103366[_0x3afc08]={'$like':'%'+_0x3c344b[_0x91ca('0x3e')]['filter']+'%'};return _0x103366;})});}if(_0x3c344b[_0x91ca('0x3e')]['$gte']){var _0x3a12a8=_0x3c344b[_0x91ca('0x3e')][_0x91ca('0xa6')]['split'](',');var _0x30a721={};_0x30a721[_0x3a12a8[0x0]]={'$gte':moment(_0x3a12a8[0x1])[_0x91ca('0xa7')](_0x91ca('0xa8'))};_0x10c7ac['where']=_['merge'](_0x10c7ac['where'],_0x30a721);}_0x10c7ac=_[_0x91ca('0x4c')]({},_0x10c7ac,_0x3c344b[_0x91ca('0x4d')]);return db[_0x91ca('0xa9')][_0x91ca('0x2e')]({'where':_0x10c7ac['where']})[_0x91ca('0x1e')](function(_0x190ee0){_0x52f5c0[_0x91ca('0x2e')]=_0x190ee0;if(_0x3c344b[_0x91ca('0x3e')]['includeAll']){_0x10c7ac[_0x91ca('0x50')]=[{'all':!![]}];}return db[_0x91ca('0xa9')]['findAll'](_0x10c7ac);})[_0x91ca('0x1e')](function(_0x234a90){_0x52f5c0[_0x91ca('0x52')]=_0x234a90;return _0x52f5c0;});}})[_0x91ca('0x1e')](respondWithFilteredResult(_0x3b881c,_0x10c7ac))[_0x91ca('0x27')](handleError(_0x3b881c,null));};exports[_0x91ca('0x86')]=function(_0x533075,_0x3c7c5c,_0x16f2e0){var _0x457b22,_0x3d8cc0={},_0x444823;if(_0x533075[_0x91ca('0x59')]['to']){_0x444823=_0x533075[_0x91ca('0x59')]['to'][0x0];}return db[_0x91ca('0x4e')][_0x91ca('0x57')]({'where':{'id':_0x533075[_0x91ca('0x54')]['id']},'include':[{'model':db[_0x91ca('0xaa')],'as':_0x91ca('0xab'),'include':[{'model':db[_0x91ca('0x72')],'as':_0x91ca('0xac'),'where':{'fax':_0x444823},'limit':0x1,'order':[[_0x91ca('0xa1'),'DESC']]}]}]})[_0x91ca('0x1e')](handleEntityNotFound(_0x3c7c5c,null))['then'](function(_0x4c86c1){_0x457b22=_0x4c86c1;if(_0x533075[_0x91ca('0x59')]['attachments']&&_0x533075['body'][_0x91ca('0xad')][_0x91ca('0x65')]){for(var _0x5f2e80=0x0;_0x5f2e80<_0x533075[_0x91ca('0x59')][_0x91ca('0xad')]['length'];_0x5f2e80+=0x1){_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][_0x5f2e80]={'filename':_0x533075['body'][_0x91ca('0xad')][_0x5f2e80][_0x91ca('0x4b')],'id':_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][_0x5f2e80]['id'],'path':path[_0x91ca('0xae')](config[_0x91ca('0xaf')],_0x91ca('0xb0'),_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][_0x5f2e80]['basename'])};}}return respondWithRpcPromise(_0x91ca('0xb1'),_0x91ca('0xb1'),{'FaxAccountId':_[_0x91ca('0xb2')](_0x533075[_0x91ca('0x54')]['id'])?undefined:_0x533075[_0x91ca('0x54')]['id'],'path':_[_0x91ca('0xb2')](_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][0x0][_0x91ca('0xb3')])?undefined:_0x533075[_0x91ca('0x59')]['attachments'][0x0][_0x91ca('0xb3')],'fax':_['isNil'](_0x533075[_0x91ca('0x59')]['to'][0x0])?undefined:_0x533075[_0x91ca('0x59')]['to'][0x0]},client9002);})[_0x91ca('0x1e')](function(){if(_0x457b22){if(_[_0x91ca('0xb2')](_0x533075['body'][_0x91ca('0xb4')])){_0x533075[_0x91ca('0x59')][_0x91ca('0xb4')]=util[_0x91ca('0xa7')]('\x22%s\x22\x20<%s>',_0x457b22[_0x91ca('0x4b')],_0x457b22['fax']);}if(_0x457b22[_0x91ca('0xab')]){if(_0x457b22['List'][_0x91ca('0xac')]['length']){return _0x457b22[_0x91ca('0xab')]['Contacts'][0x0];}else{return db[_0x91ca('0x72')][_0x91ca('0x58')](_['defaults'](_0x533075[_0x91ca('0x59')],{'firstName':_0x533075['body']['to'][0x0],'phone':_0x533075[_0x91ca('0x59')]['to'][0x0],'fax':_0x533075['body']['to'][0x0],'ListId':_0x457b22[_0x91ca('0xa3')]}));}}else{throw new Error(_0x91ca('0xb5'));}}else{throw new Error(_0x91ca('0xb6'));}})[_0x91ca('0x1e')](function(_0x4a1020){if(_0x4a1020){return db[_0x91ca('0x6e')][_0x91ca('0x57')]({'where':{'ContactId':_0x4a1020['id'],'closed':![],'FaxAccountId':_0x457b22['id']}})[_0x91ca('0x1e')](function(_0x55cfc5){if(_0x55cfc5){return[_0x55cfc5,![]];}return db[_0x91ca('0x6e')][_0x91ca('0x58')]({'UserId':_0x533075[_0x91ca('0x5a')]['id'],'ContactId':_0x4a1020['id'],'FaxAccountId':_0x457b22['id'],'fax':_0x533075['body']['to'][0x0],'firstMsgDirection':_0x91ca('0xb7'),'Messages':[_['merge'](_0x533075[_0x91ca('0x59')],{'read':![],'body':_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][0x0]['filename'],'FaxAccountId':_0x457b22['id'],'UserId':_0x533075['user']['id'],'ContactId':_0x4a1020['id'],'AttachmentId':_0x533075['body'][_0x91ca('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x91ca('0xa9')],'as':_0x91ca('0xb8')}]})[_0x91ca('0x1e')](function(_0x2fd87b){return[_0x2fd87b,!![]];});});}else{throw new Error(_0x91ca('0xb9'));}})[_0x91ca('0xba')](function(_0x647b6a,_0x3a6d04){if(_0x3a6d04){return _0x647b6a;}return db[_0x91ca('0xa9')][_0x91ca('0x58')]({'direction':_0x91ca('0xb7'),'read':![],'body':_0x533075['body'][_0x91ca('0xad')][0x0][_0x91ca('0xbb')],'FaxAccountId':_0x457b22['id'],'FaxInteractionId':_0x647b6a['id'],'UserId':_0x533075[_0x91ca('0x5a')]['id'],'ContactId':_0x647b6a[_0x91ca('0xbc')],'AttachmentId':_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][0x0]['id']})[_0x91ca('0x1e')](function(_0xd6d0dd){_0x647b6a['dataValues'][_0x91ca('0xb8')]=[];_0x647b6a[_0x91ca('0xbd')][_0x91ca('0xb8')][_0x91ca('0x90')](_0xd6d0dd[_0x91ca('0xbd')]);return _0x647b6a;});})[_0x91ca('0x1e')](function(_0x28d160){respondWithRpcPromise('SendFax',_0x91ca('0xbe'),{'FaxAccountId':_[_0x91ca('0xb2')](_0x533075[_0x91ca('0x54')]['id'])?undefined:_0x533075[_0x91ca('0x54')]['id'],'path':_[_0x91ca('0xb2')](_0x533075['body'][_0x91ca('0xad')][0x0]['path'])?undefined:_0x533075['body'][_0x91ca('0xad')][0x0][_0x91ca('0xb3')],'fax':_[_0x91ca('0xb2')](_0x533075[_0x91ca('0x59')]['to'][0x0])?undefined:_0x533075['body']['to'][0x0],'AttachmentId':_0x533075[_0x91ca('0x59')][_0x91ca('0xad')][0x0]['id']},client9002)['then'](function(_0x3f5669){logger[_0x91ca('0x1f')](_0x91ca('0xbf'),_0x3f5669);})[_0x91ca('0x27')](function(_0xf3b168){logger[_0x91ca('0x1f')](_0x91ca('0xbf'),_0xf3b168);});return _0x28d160;})['then'](respondWithResult(_0x3c7c5c,null))[_0x91ca('0x27')](handleError(_0x3c7c5c,null));};exports['addAgents']=function(_0x48c02b,_0x2e0534,_0x36707c){return db[_0x91ca('0x4e')][_0x91ca('0x57')]({'where':{'id':_0x48c02b[_0x91ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e0534,null))[_0x91ca('0x1e')](function(_0xc29f24){if(_0xc29f24){return _0xc29f24[_0x91ca('0xc0')](_0x48c02b['body'][_0x91ca('0x68')],_[_0x91ca('0x70')](_0x48c02b['body'],[_0x91ca('0x68'),'id'])||{})[_0x91ca('0xba')](function(_0x844b01){for(var _0x1d5854=0x0;_0x1d5854<_0x48c02b['body'][_0x91ca('0x68')][_0x91ca('0x65')];_0x1d5854+=0x1){socket[_0x91ca('0xc1')](_0x91ca('0xc2'),{'UserId':Number(_0x48c02b[_0x91ca('0x59')]['ids'][_0x1d5854]),'FaxAccountId':Number(_0x48c02b[_0x91ca('0x54')]['id'])});}return _0x844b01;});}})[_0x91ca('0x1e')](respondWithResult(_0x2e0534,null))[_0x91ca('0x27')](handleError(_0x2e0534,null));};exports['removeAgents']=function(_0x209bab,_0x1c4207,_0x365f7c){return db[_0x91ca('0x4e')]['find']({'where':{'id':_0x209bab[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x1c4207,null))['then'](function(_0x144048){if(_0x144048){return _0x144048['removeAgents'](_0x209bab[_0x91ca('0x3e')]['ids'])[_0x91ca('0x1e')](function(){if(_[_0x91ca('0xc3')](_0x209bab['query'][_0x91ca('0x68')])){for(var _0x2e84f4=0x0;_0x2e84f4<_0x209bab[_0x91ca('0x3e')][_0x91ca('0x68')][_0x91ca('0x65')];_0x2e84f4+=0x1){socket[_0x91ca('0xc1')](_0x91ca('0xc4'),{'UserId':Number(_0x209bab[_0x91ca('0x3e')][_0x91ca('0x68')][_0x2e84f4]),'FaxAccountId':Number(_0x209bab[_0x91ca('0x54')]['id'])});}}else{socket[_0x91ca('0xc1')](_0x91ca('0xc4'),{'UserId':Number(_0x209bab['query'][_0x91ca('0x68')]),'FaxAccountId':Number(_0x209bab[_0x91ca('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x1c4207,null))[_0x91ca('0x27')](handleError(_0x1c4207,null));};exports[_0x91ca('0xc5')]=function(_0x25eee5,_0x188f6e,_0x2d2642){var _0x239f32={};var _0x20e6a6={};var _0x26a89b;var _0x182adb;return db[_0x91ca('0x4e')][_0x91ca('0x6c')]({'where':{'id':_0x25eee5[_0x91ca('0x54')]['id']}})[_0x91ca('0x1e')](handleEntityNotFound(_0x188f6e,null))['then'](function(_0x3ae428){if(_0x3ae428){_0x26a89b=_0x3ae428;_0x20e6a6[_0x91ca('0x41')]=_[_0x91ca('0x3f')](db[_0x91ca('0x74')]['rawAttributes']);_0x20e6a6[_0x91ca('0x3e')]=_[_0x91ca('0x3f')](_0x25eee5[_0x91ca('0x3e')]);_0x20e6a6[_0x91ca('0x56')]=_[_0x91ca('0x40')](_0x20e6a6[_0x91ca('0x41')],_0x20e6a6['query']);_0x239f32[_0x91ca('0x42')]=_['intersection'](_0x20e6a6[_0x91ca('0x41')],qs[_0x91ca('0x43')](_0x25eee5['query'][_0x91ca('0x43')]));_0x239f32[_0x91ca('0x42')]=_0x239f32['attributes'][_0x91ca('0x65')]?_0x239f32[_0x91ca('0x42')]:_0x20e6a6[_0x91ca('0x41')];_0x239f32[_0x91ca('0x45')]=qs[_0x91ca('0x46')](_0x25eee5[_0x91ca('0x3e')][_0x91ca('0x46')]);_0x239f32['where']=qs[_0x91ca('0x56')](_[_0x91ca('0x48')](_0x25eee5['query'],_0x20e6a6['filters']));if(_0x25eee5[_0x91ca('0x3e')][_0x91ca('0x49')]){_0x239f32[_0x91ca('0x47')]=_[_0x91ca('0x4c')](_0x239f32[_0x91ca('0x47')],{'$or':_[_0x91ca('0x3d')](_0x239f32['attributes'],function(_0x2abaca){var _0x388d88={};_0x388d88[_0x2abaca]={'$like':'%'+_0x25eee5[_0x91ca('0x3e')][_0x91ca('0x49')]+'%'};return _0x388d88;})});}_0x239f32=_['merge']({},_0x239f32,_0x25eee5[_0x91ca('0x4d')]);return _0x26a89b[_0x91ca('0xc5')](_0x239f32);}})[_0x91ca('0x1e')](function(_0x2b6d76){if(_0x2b6d76){_0x182adb=_0x2b6d76[_0x91ca('0x65')];if(!_0x25eee5[_0x91ca('0x3e')][_0x91ca('0x44')](_0x91ca('0x66'))){_0x239f32[_0x91ca('0x2d')]=qs['limit'](_0x25eee5[_0x91ca('0x3e')]['limit']);_0x239f32['offset']=qs[_0x91ca('0x2f')](_0x25eee5[_0x91ca('0x3e')][_0x91ca('0x2f')]);}return _0x26a89b[_0x91ca('0xc5')](_0x239f32);}})[_0x91ca('0x1e')](function(_0x3f8a74){if(_0x3f8a74){return _0x3f8a74?{'count':_0x182adb,'rows':_0x3f8a74}:null;}})[_0x91ca('0x1e')](respondWithResult(_0x188f6e,null))['catch'](handleError(_0x188f6e,null));}; \ No newline at end of file +var _0x03cc=['pick','filter','merge','where','VIRTUAL','include','findAll','rows','show','find','create','body','user','role','FaxAccounts','UserProfileSection','userProfileId','mandatoryDispositionPause','params','describe','FaxAccountId','Disposition','getDispositions','findOne','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','addInteraction','FaxInteraction','ids','getInteractions','CmContact','Owner','fullname','internal','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','Set','ecm','faxdetect','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','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','send','Pause','map','FaxAccount','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x03cc,0x71));var _0xc03c=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x03cc[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0xc03c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc03c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc03c('0x2'));var BPromise=require(_0xc03c('0x3'));var Mustache=require(_0xc03c('0x4'));var util=require('util');var path=require(_0xc03c('0x5'));var sox=require(_0xc03c('0x6'));var csv=require(_0xc03c('0x7'));var ejs=require(_0xc03c('0x8'));var fs=require('fs');var fs_extra=require(_0xc03c('0x9'));var _=require(_0xc03c('0xa'));var squel=require(_0xc03c('0xb'));var crypto=require(_0xc03c('0xc'));var jsforce=require(_0xc03c('0xd'));var deskjs=require(_0xc03c('0xe'));var toCsv=require(_0xc03c('0x7'));var querystring=require(_0xc03c('0xf'));var Papa=require(_0xc03c('0x10'));var Redis=require(_0xc03c('0x11'));var authService=require(_0xc03c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc03c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc03c('0x14'))(_0xc03c('0x15'));var utils=require(_0xc03c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc03c('0x17'));var db=require(_0xc03c('0x18'))['db'];config[_0xc03c('0x19')]=_[_0xc03c('0x1a')](config[_0xc03c('0x19')],{'host':_0xc03c('0x1b'),'port':0x18eb});var socket=require(_0xc03c('0x1c'))(new Redis(config[_0xc03c('0x19')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0xc03c('0x1d'));var client=jayson[_0xc03c('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xc03c('0x1e')][_0xc03c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x256642,_0x3c8342,_0x431b49,_0x368efd){return new BPromise(function(_0x40eb5b,_0x701f1e){var _0x4b7dec=_0x368efd||client;return _0x4b7dec['request'](_0x256642,_0x431b49)[_0xc03c('0x20')](function(_0x5b7118){logger['info'](_0xc03c('0x21'),_0x3c8342,_0xc03c('0x22'));logger[_0xc03c('0x23')](_0xc03c('0x24'),_0x3c8342,_0xc03c('0x22'),JSON[_0xc03c('0x25')](_0x5b7118));if(_0x5b7118[_0xc03c('0x26')]){if(_0x5b7118['error']['code']===0x1f4){logger[_0xc03c('0x26')](_0xc03c('0x21'),_0x3c8342,_0x5b7118[_0xc03c('0x26')][_0xc03c('0x27')]);return _0x701f1e(_0x5b7118[_0xc03c('0x26')][_0xc03c('0x27')]);}logger[_0xc03c('0x26')](_0xc03c('0x21'),_0x3c8342,_0x5b7118[_0xc03c('0x26')][_0xc03c('0x27')]);return _0x40eb5b(_0x5b7118[_0xc03c('0x26')][_0xc03c('0x27')]);}else{logger[_0xc03c('0x28')]('FaxAccount,\x20%s,\x20%s',_0x3c8342,_0xc03c('0x22'));_0x40eb5b(_0x5b7118[_0xc03c('0x29')]['message']);}})[_0xc03c('0x2a')](function(_0x45945e){logger[_0xc03c('0x26')](_0xc03c('0x21'),_0x3c8342,_0x45945e);_0x701f1e(_0x45945e);});});}function respondWithStatusCode(_0x386c38,_0x1e045f){_0x1e045f=_0x1e045f||0xcc;return function(_0x5b38fa){if(_0x5b38fa){return _0x386c38[_0xc03c('0x2b')](_0x1e045f);}return _0x386c38[_0xc03c('0x2c')](_0x1e045f)[_0xc03c('0x2d')]();};}function respondWithResult(_0x54a993,_0x78f293){_0x78f293=_0x78f293||0xc8;return function(_0xdf91ec){if(_0xdf91ec){return _0x54a993['status'](_0x78f293)[_0xc03c('0x2e')](_0xdf91ec);}};}function respondWithFilteredResult(_0x525e54,_0x3ee46f){return function(_0x19bd06){if(_0x19bd06){var _0x21363b=typeof _0x3ee46f[_0xc03c('0x2f')]==='undefined'&&typeof _0x3ee46f[_0xc03c('0x30')]===_0xc03c('0x31');var _0x2eb289=_0x19bd06[_0xc03c('0x32')];var _0x528bce=_0x21363b?0x0:_0x3ee46f['offset'];var _0x37c44c=_0x21363b?_0x19bd06[_0xc03c('0x32')]:_0x3ee46f['offset']+_0x3ee46f[_0xc03c('0x30')];var _0xbdfaeb;if(_0x37c44c>=_0x2eb289){_0x37c44c=_0x2eb289;_0xbdfaeb=0xc8;}else{_0xbdfaeb=0xce;}_0x525e54['status'](_0xbdfaeb);return _0x525e54[_0xc03c('0x33')](_0xc03c('0x34'),_0x528bce+'-'+_0x37c44c+'/'+_0x2eb289)['json'](_0x19bd06);}return null;};}function patchUpdates(_0x557929){return function(_0xf02604){try{jsonpatch['apply'](_0xf02604,_0x557929,!![]);}catch(_0x2ef3f3){return BPromise[_0xc03c('0x35')](_0x2ef3f3);}return _0xf02604[_0xc03c('0x36')]();};}function saveUpdates(_0x496b92,_0x4d62e8){return function(_0x465c8c){if(_0x465c8c){return _0x465c8c[_0xc03c('0x37')](_0x496b92)[_0xc03c('0x20')](function(_0x4723c1){return _0x4723c1;});}return null;};}function removeEntity(_0xeab5fd,_0x1149d2){return function(_0x50daef){if(_0x50daef){return _0x50daef[_0xc03c('0x38')]()[_0xc03c('0x20')](function(){var _0x41a383=_0x50daef[_0xc03c('0x39')]({'plain':!![]});var _0x38c703='FaxAccounts';return db[_0xc03c('0x3a')][_0xc03c('0x38')]({'where':{'type':_0x38c703,'resourceId':_0x41a383['id']}})[_0xc03c('0x20')](function(){return _0x50daef;});})[_0xc03c('0x20')](function(){_0xeab5fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e61c2,_0x302694){return function(_0x5b6f02){if(!_0x5b6f02){_0x5e61c2['sendStatus'](0x194);}return _0x5b6f02;};}function handleError(_0x579d17,_0x5c498e){_0x5c498e=_0x5c498e||0x1f4;return function(_0x809cdc){logger[_0xc03c('0x26')](_0x809cdc[_0xc03c('0x3b')]);if(_0x809cdc['name']){delete _0x809cdc['name'];}_0x579d17[_0xc03c('0x2c')](_0x5c498e)[_0xc03c('0x3c')](_0x809cdc);};}exports['index']=function(_0x4ee97d,_0x4f357d){var _0x5ea45e={'include':[{'model':db[_0xc03c('0x3d')],'as':'mandatoryDispositionPause'}]},_0x881320={},_0x48a7ba={'count':0x0,'rows':[]};var _0x182f47=_[_0xc03c('0x3e')](db[_0xc03c('0x3f')][_0xc03c('0x40')],function(_0x5ba438){return{'name':_0x5ba438['fieldName'],'type':_0x5ba438[_0xc03c('0x41')][_0xc03c('0x42')]};});_0x881320[_0xc03c('0x43')]=_['map'](_0x182f47,_0xc03c('0x44'));_0x881320[_0xc03c('0x45')]=_[_0xc03c('0x46')](_0x4ee97d[_0xc03c('0x45')]);_0x881320[_0xc03c('0x47')]=_[_0xc03c('0x48')](_0x881320[_0xc03c('0x43')],_0x881320[_0xc03c('0x45')]);_0x5ea45e[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x881320['model'],qs[_0xc03c('0x4a')](_0x4ee97d[_0xc03c('0x45')]['fields']));_0x5ea45e[_0xc03c('0x49')]=_0x5ea45e[_0xc03c('0x49')][_0xc03c('0x4b')]?_0x5ea45e[_0xc03c('0x49')]:_0x881320[_0xc03c('0x43')];if(!_0x4ee97d[_0xc03c('0x45')][_0xc03c('0x4c')](_0xc03c('0x4d'))){_0x5ea45e[_0xc03c('0x30')]=qs['limit'](_0x4ee97d[_0xc03c('0x45')][_0xc03c('0x30')]);_0x5ea45e[_0xc03c('0x2f')]=qs[_0xc03c('0x2f')](_0x4ee97d[_0xc03c('0x45')][_0xc03c('0x2f')]);}_0x5ea45e[_0xc03c('0x4e')]=qs[_0xc03c('0x4f')](_0x4ee97d[_0xc03c('0x45')][_0xc03c('0x4f')]);_0x5ea45e['where']=qs['filters'](_[_0xc03c('0x50')](_0x4ee97d[_0xc03c('0x45')],_0x881320[_0xc03c('0x47')]),_0x182f47);if(_0x4ee97d[_0xc03c('0x45')][_0xc03c('0x51')]){_0x5ea45e['where']=_[_0xc03c('0x52')](_0x5ea45e[_0xc03c('0x53')],{'$or':_[_0xc03c('0x3e')](_0x182f47,function(_0x29d713){if(_0x29d713[_0xc03c('0x41')]!==_0xc03c('0x54')){var _0x695de1={};_0x695de1[_0x29d713[_0xc03c('0x44')]]={'$like':'%'+_0x4ee97d[_0xc03c('0x45')][_0xc03c('0x51')]+'%'};return _0x695de1;}})});}_0x5ea45e=_[_0xc03c('0x52')]({},_0x5ea45e,_0x4ee97d['options']);var _0x2ee438={'where':_0x5ea45e[_0xc03c('0x53')]};return db[_0xc03c('0x3f')]['count'](_0x2ee438)[_0xc03c('0x20')](function(_0x3fc6f3){_0x48a7ba[_0xc03c('0x32')]=_0x3fc6f3;if(_0x4ee97d[_0xc03c('0x45')]['includeAll']){_0x5ea45e[_0xc03c('0x55')]=[{'all':!![]}];}return db['FaxAccount'][_0xc03c('0x56')](_0x5ea45e);})[_0xc03c('0x20')](function(_0x2188f5){_0x48a7ba[_0xc03c('0x57')]=_0x2188f5;return _0x48a7ba;})['then'](respondWithFilteredResult(_0x4f357d,_0x5ea45e))[_0xc03c('0x2a')](handleError(_0x4f357d,null));};exports[_0xc03c('0x58')]=function(_0x55910f,_0x168969){var _0xeb9cf4={'raw':![],'where':{'id':_0x55910f['params']['id']},'include':[{'model':db[_0xc03c('0x3d')],'as':'mandatoryDispositionPause'}]},_0x51a87a={};_0x51a87a[_0xc03c('0x43')]=_[_0xc03c('0x46')](db['FaxAccount'][_0xc03c('0x40')]);_0x51a87a[_0xc03c('0x45')]=_[_0xc03c('0x46')](_0x55910f[_0xc03c('0x45')]);_0x51a87a[_0xc03c('0x47')]=_[_0xc03c('0x48')](_0x51a87a[_0xc03c('0x43')],_0x51a87a[_0xc03c('0x45')]);_0xeb9cf4[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x51a87a[_0xc03c('0x43')],qs[_0xc03c('0x4a')](_0x55910f[_0xc03c('0x45')][_0xc03c('0x4a')]));_0xeb9cf4[_0xc03c('0x49')]=_0xeb9cf4[_0xc03c('0x49')][_0xc03c('0x4b')]?_0xeb9cf4[_0xc03c('0x49')]:_0x51a87a['model'];if(_0x55910f[_0xc03c('0x45')]['includeAll']){_0xeb9cf4[_0xc03c('0x55')]=[{'all':!![]}];}_0xeb9cf4=_[_0xc03c('0x52')]({},_0xeb9cf4,_0x55910f['options']);return db[_0xc03c('0x3f')][_0xc03c('0x59')](_0xeb9cf4)[_0xc03c('0x20')](handleEntityNotFound(_0x168969,null))[_0xc03c('0x20')](respondWithResult(_0x168969,null))[_0xc03c('0x2a')](handleError(_0x168969,null));};exports[_0xc03c('0x5a')]=function(_0x1a14f2,_0x284255){return db[_0xc03c('0x3f')][_0xc03c('0x5a')](_0x1a14f2[_0xc03c('0x5b')],{})['then'](function(_0x428c29){var _0x304bcd=_0x1a14f2[_0xc03c('0x5c')][_0xc03c('0x39')]({'plain':!![]});if(!_0x304bcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x304bcd[_0xc03c('0x5d')]==='user'){var _0x10d1d9=_0x428c29[_0xc03c('0x39')]({'plain':!![]});var _0x1e2fb1=_0xc03c('0x5e');return db[_0xc03c('0x5f')]['find']({'where':{'name':_0x1e2fb1,'userProfileId':_0x304bcd[_0xc03c('0x60')]},'raw':!![]})[_0xc03c('0x20')](function(_0x5bc882){if(_0x5bc882&&_0x5bc882['autoAssociation']===0x0){return db[_0xc03c('0x3a')][_0xc03c('0x5a')]({'name':_0x10d1d9['name'],'resourceId':_0x10d1d9['id'],'type':_0x5bc882[_0xc03c('0x44')],'sectionId':_0x5bc882['id']},{})[_0xc03c('0x20')](function(){return _0x428c29;});}else{return _0x428c29;}})[_0xc03c('0x2a')](function(_0x26e42a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26e42a);throw _0x26e42a;});}return _0x428c29;})['then'](respondWithResult(_0x284255,0xc9))[_0xc03c('0x2a')](handleError(_0x284255,null));};exports[_0xc03c('0x37')]=function(_0x3a3fab,_0x13fe7f){if(_0x3a3fab[_0xc03c('0x5b')]['id']){delete _0x3a3fab[_0xc03c('0x5b')]['id'];}return db[_0xc03c('0x3f')][_0xc03c('0x59')]({'where':{'id':_0x3a3fab['params']['id']},'include':[{'model':db['Pause'],'as':_0xc03c('0x61')}]})['then'](handleEntityNotFound(_0x13fe7f,null))[_0xc03c('0x20')](saveUpdates(_0x3a3fab[_0xc03c('0x5b')],null))[_0xc03c('0x20')](respondWithResult(_0x13fe7f,null))[_0xc03c('0x2a')](handleError(_0x13fe7f,null));};exports[_0xc03c('0x38')]=function(_0xa8730a,_0x2f0a11){return db['FaxAccount'][_0xc03c('0x59')]({'where':{'id':_0xa8730a[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x2f0a11,null))['then'](removeEntity(_0x2f0a11,null))[_0xc03c('0x2a')](handleError(_0x2f0a11,null));};exports[_0xc03c('0x63')]=function(_0x5ab7d5,_0x3ce6a0){return db['FaxAccount'][_0xc03c('0x63')]()['then'](respondWithResult(_0x3ce6a0,null))[_0xc03c('0x2a')](handleError(_0x3ce6a0,null));};exports['addDisposition']=function(_0x365883,_0x2b7685,_0x5bcb08){if(_0x365883[_0xc03c('0x5b')]['id']){delete _0x365883['body']['id'];}return db[_0xc03c('0x3f')]['find']({'where':{'id':_0x365883[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x2b7685,null))[_0xc03c('0x20')](function(_0x5bcd26){if(_0x5bcd26){_0x365883['body'][_0xc03c('0x64')]=_0x5bcd26['id'];return db[_0xc03c('0x65')][_0xc03c('0x5a')](_0x365883[_0xc03c('0x5b')]);}})[_0xc03c('0x20')](respondWithResult(_0x2b7685,null))[_0xc03c('0x2a')](handleError(_0x2b7685,null));};exports[_0xc03c('0x66')]=function(_0x55b4a8,_0xd03c50,_0x4f13d6){var _0x26f37d={'raw':![],'where':{}};var _0x267916={};var _0x528056={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc03c('0x67')]({'where':{'id':_0x55b4a8['params']['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0xd03c50,null))[_0xc03c('0x20')](function(_0x5a7b17){if(_0x5a7b17){_0x267916['model']=_['keys'](db[_0xc03c('0x65')][_0xc03c('0x40')]);_0x267916['query']=_[_0xc03c('0x46')](_0x55b4a8[_0xc03c('0x45')]);_0x267916[_0xc03c('0x47')]=_[_0xc03c('0x48')](_0x267916[_0xc03c('0x43')],_0x267916[_0xc03c('0x45')]);_0x26f37d[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x267916['model'],qs[_0xc03c('0x4a')](_0x55b4a8[_0xc03c('0x45')][_0xc03c('0x4a')]));_0x26f37d[_0xc03c('0x49')]=_0x26f37d[_0xc03c('0x49')]['length']?_0x26f37d[_0xc03c('0x49')]:_0x267916['model'];if(!_0x55b4a8[_0xc03c('0x45')][_0xc03c('0x4c')]('nolimit')){_0x26f37d['limit']=qs[_0xc03c('0x30')](_0x55b4a8['query']['limit']);_0x26f37d[_0xc03c('0x2f')]=qs['offset'](_0x55b4a8['query'][_0xc03c('0x2f')]);}_0x26f37d[_0xc03c('0x4e')]=qs[_0xc03c('0x4f')](_0x55b4a8[_0xc03c('0x45')][_0xc03c('0x4f')]);_0x26f37d['where']=qs[_0xc03c('0x47')](_[_0xc03c('0x50')](_0x55b4a8['query'],_0x267916[_0xc03c('0x47')]));_0x26f37d[_0xc03c('0x53')][_0xc03c('0x64')]=_0x5a7b17['id'];if(_0x55b4a8[_0xc03c('0x45')][_0xc03c('0x51')]){_0x26f37d[_0xc03c('0x53')]=_[_0xc03c('0x52')](_0x26f37d[_0xc03c('0x53')],{'$or':_[_0xc03c('0x3e')](_0x26f37d[_0xc03c('0x49')],function(_0x23b154){var _0x5c44bb={};_0x5c44bb[_0x23b154]={'$like':'%'+_0x55b4a8['query']['filter']+'%'};return _0x5c44bb;})});}_0x26f37d=_[_0xc03c('0x52')]({},_0x26f37d,_0x55b4a8['options']);return db[_0xc03c('0x65')][_0xc03c('0x32')]({'where':_0x26f37d[_0xc03c('0x53')]})['then'](function(_0xec3adc){_0x528056[_0xc03c('0x32')]=_0xec3adc;if(_0x55b4a8[_0xc03c('0x45')][_0xc03c('0x68')]){_0x26f37d['include']=[{'all':!![]}];}return db[_0xc03c('0x65')][_0xc03c('0x56')](_0x26f37d);})['then'](function(_0x4715a5){_0x528056[_0xc03c('0x57')]=_0x4715a5;return _0x528056;});}})[_0xc03c('0x20')](respondWithFilteredResult(_0xd03c50,_0x26f37d))[_0xc03c('0x2a')](handleError(_0xd03c50,null));};exports['removeDispositions']=function(_0x7434c6,_0x3780d2,_0x47dba3){return db[_0xc03c('0x3f')][_0xc03c('0x59')]({'where':{'id':_0x7434c6[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x3780d2,null))[_0xc03c('0x20')](function(_0x27dc3c){if(_0x27dc3c){return _0x27dc3c[_0xc03c('0x69')](_0x7434c6['query']['ids']);}})[_0xc03c('0x20')](respondWithStatusCode(_0x3780d2,null))[_0xc03c('0x2a')](handleError(_0x3780d2,null));};exports[_0xc03c('0x6a')]=function(_0x2edd68,_0x2f44fe,_0x1aee71){if(_0x2edd68[_0xc03c('0x5b')]['id']){delete _0x2edd68['body']['id'];}return db[_0xc03c('0x3f')][_0xc03c('0x59')]({'where':{'id':_0x2edd68['params']['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x2f44fe,null))[_0xc03c('0x20')](function(_0x343d12){if(_0x343d12){_0x2edd68[_0xc03c('0x5b')][_0xc03c('0x64')]=_0x343d12['id'];return db[_0xc03c('0x6b')][_0xc03c('0x5a')](_0x2edd68[_0xc03c('0x5b')]);}})[_0xc03c('0x20')](respondWithResult(_0x2f44fe,null))['catch'](handleError(_0x2f44fe,null));};exports[_0xc03c('0x6c')]=function(_0x328ae2,_0x336e72,_0x4dcbee){var _0x48de66={'raw':![],'where':{}};var _0x4ab71c={};var _0x11b639={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc03c('0x67')]({'where':{'id':_0x328ae2[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x336e72,null))[_0xc03c('0x20')](function(_0x2557d9){if(_0x2557d9){_0x4ab71c[_0xc03c('0x43')]=_[_0xc03c('0x46')](db[_0xc03c('0x6b')]['rawAttributes']);_0x4ab71c[_0xc03c('0x45')]=_[_0xc03c('0x46')](_0x328ae2[_0xc03c('0x45')]);_0x4ab71c[_0xc03c('0x47')]=_[_0xc03c('0x48')](_0x4ab71c[_0xc03c('0x43')],_0x4ab71c[_0xc03c('0x45')]);_0x48de66[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x4ab71c[_0xc03c('0x43')],qs[_0xc03c('0x4a')](_0x328ae2[_0xc03c('0x45')][_0xc03c('0x4a')]));_0x48de66[_0xc03c('0x49')]=_0x48de66[_0xc03c('0x49')][_0xc03c('0x4b')]?_0x48de66['attributes']:_0x4ab71c[_0xc03c('0x43')];if(!_0x328ae2[_0xc03c('0x45')][_0xc03c('0x4c')](_0xc03c('0x4d'))){_0x48de66[_0xc03c('0x30')]=qs[_0xc03c('0x30')](_0x328ae2['query'][_0xc03c('0x30')]);_0x48de66[_0xc03c('0x2f')]=qs[_0xc03c('0x2f')](_0x328ae2[_0xc03c('0x45')][_0xc03c('0x2f')]);}_0x48de66[_0xc03c('0x4e')]=qs['sort'](_0x328ae2['query']['sort']);_0x48de66[_0xc03c('0x53')]=qs[_0xc03c('0x47')](_[_0xc03c('0x50')](_0x328ae2['query'],_0x4ab71c[_0xc03c('0x47')]));_0x48de66[_0xc03c('0x53')]['FaxAccountId']=_0x2557d9['id'];if(_0x328ae2[_0xc03c('0x45')][_0xc03c('0x51')]){_0x48de66[_0xc03c('0x53')]=_[_0xc03c('0x52')](_0x48de66[_0xc03c('0x53')],{'$or':_[_0xc03c('0x3e')](_0x48de66[_0xc03c('0x49')],function(_0x2ef91e){var _0x2dc9b6={};_0x2dc9b6[_0x2ef91e]={'$like':'%'+_0x328ae2['query']['filter']+'%'};return _0x2dc9b6;})});}_0x48de66=_[_0xc03c('0x52')]({},_0x48de66,_0x328ae2[_0xc03c('0x6d')]);return db[_0xc03c('0x6b')][_0xc03c('0x32')]({'where':_0x48de66[_0xc03c('0x53')]})['then'](function(_0x247dee){_0x11b639[_0xc03c('0x32')]=_0x247dee;if(_0x328ae2[_0xc03c('0x45')][_0xc03c('0x68')]){_0x48de66[_0xc03c('0x55')]=[{'all':!![]}];}return db[_0xc03c('0x6b')][_0xc03c('0x56')](_0x48de66);})[_0xc03c('0x20')](function(_0x1cf102){_0x11b639[_0xc03c('0x57')]=_0x1cf102;return _0x11b639;});}})[_0xc03c('0x20')](respondWithFilteredResult(_0x336e72,_0x48de66))[_0xc03c('0x2a')](handleError(_0x336e72,null));};exports[_0xc03c('0x6e')]=function(_0x1413e5,_0x4dd2fd,_0x4e6df5){return db[_0xc03c('0x3f')][_0xc03c('0x59')]({'where':{'id':_0x1413e5[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x4dd2fd,null))[_0xc03c('0x20')](function(_0x196381){if(_0x196381){return _0x196381['removeAnswers'](_0x1413e5[_0xc03c('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x4dd2fd,null))['catch'](handleError(_0x4dd2fd,null));};exports[_0xc03c('0x6f')]=function(_0x21fa71,_0x108a02,_0x365b9e){return db[_0xc03c('0x70')]['find']({'where':{'id':_0x21fa71['params']['id']}})['then'](handleEntityNotFound(_0x108a02,null))['then'](function(_0x3ab726){if(_0x3ab726){return _0x3ab726['addInteraction'](_0x21fa71[_0xc03c('0x5b')][_0xc03c('0x71')],_['omit'](_0x21fa71['body'],[_0xc03c('0x71'),'id'])||{});}})[_0xc03c('0x20')](respondWithResult(_0x108a02,null))[_0xc03c('0x2a')](handleError(_0x108a02,null));};exports[_0xc03c('0x72')]=function(_0x4d969e,_0x30998b,_0x3c68e2){var _0x3433aa={'raw':![],'where':{}};var _0x46c29c={};var _0x431dce={'count':0x0,'rows':[]};return db[_0xc03c('0x3f')]['findOne']({'where':{'id':_0x4d969e[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x30998b,null))[_0xc03c('0x20')](function(_0x258260){if(_0x258260){_0x46c29c[_0xc03c('0x43')]=_[_0xc03c('0x46')](db[_0xc03c('0x70')][_0xc03c('0x40')]);_0x46c29c[_0xc03c('0x45')]=_[_0xc03c('0x46')](_0x4d969e[_0xc03c('0x45')]);_0x46c29c['filters']=_[_0xc03c('0x48')](_0x46c29c[_0xc03c('0x43')],_0x46c29c[_0xc03c('0x45')]);_0x3433aa[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x46c29c[_0xc03c('0x43')],qs[_0xc03c('0x4a')](_0x4d969e[_0xc03c('0x45')]['fields']));_0x3433aa[_0xc03c('0x49')]=_0x3433aa[_0xc03c('0x49')]['length']?_0x3433aa[_0xc03c('0x49')]:_0x46c29c[_0xc03c('0x43')];if(!_0x4d969e[_0xc03c('0x45')][_0xc03c('0x4c')]('nolimit')){_0x3433aa[_0xc03c('0x30')]=qs['limit'](_0x4d969e['query'][_0xc03c('0x30')]);_0x3433aa[_0xc03c('0x2f')]=qs[_0xc03c('0x2f')](_0x4d969e[_0xc03c('0x45')][_0xc03c('0x2f')]);}_0x3433aa[_0xc03c('0x4e')]=qs[_0xc03c('0x4f')](_0x4d969e[_0xc03c('0x45')]['sort']);_0x3433aa[_0xc03c('0x53')]=qs['filters'](_[_0xc03c('0x50')](_0x4d969e[_0xc03c('0x45')],_0x46c29c[_0xc03c('0x47')]));_0x3433aa[_0xc03c('0x53')][_0xc03c('0x64')]=_0x258260['id'];if(_0x4d969e[_0xc03c('0x45')]['filter']){_0x3433aa['where']=_[_0xc03c('0x52')](_0x3433aa[_0xc03c('0x53')],{'$or':_['map'](_0x3433aa['attributes'],function(_0x341a12){var _0x31eacd={};_0x31eacd[_0x341a12]={'$like':'%'+_0x4d969e[_0xc03c('0x45')][_0xc03c('0x51')]+'%'};return _0x31eacd;})});}_0x3433aa=_[_0xc03c('0x52')]({},_0x3433aa,_0x4d969e[_0xc03c('0x6d')]);return db[_0xc03c('0x70')][_0xc03c('0x32')]({'where':_0x3433aa[_0xc03c('0x53')]})['then'](function(_0x5e1f78){_0x431dce[_0xc03c('0x32')]=_0x5e1f78;if(_0x4d969e['query'][_0xc03c('0x68')]){_0x3433aa[_0xc03c('0x55')]=[{'model':db[_0xc03c('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xc03c('0x74'),'attributes':['name',_0xc03c('0x75'),_0xc03c('0x76')],'required':![]},{'model':db['Tag'],'as':_0xc03c('0x77'),'attributes':['id',_0xc03c('0x44'),'color'],'where':_0x4d969e['query'][_0xc03c('0x78')]?{'id':_0x4d969e[_0xc03c('0x45')]['tag']}:undefined,'required':_0x4d969e[_0xc03c('0x45')][_0xc03c('0x78')]?!![]:![]}];}return db[_0xc03c('0x70')][_0xc03c('0x56')](_0x3433aa);})[_0xc03c('0x20')](function(_0x1d0928){_0x431dce[_0xc03c('0x57')]=_0x1d0928;return _0x431dce;});}})[_0xc03c('0x20')](respondWithFilteredResult(_0x30998b,_0x3433aa))[_0xc03c('0x2a')](handleError(_0x30998b,null));};exports['addApplications']=function(_0x5aad71,_0x18fd62){var _0x31de27=_0x5aad71[_0xc03c('0x62')]['id'];var _0x351f19=_0x5aad71['body'];var _0x33f4ae=0xc8;var _0x1fefc9=null;return db[_0xc03c('0x79')][_0xc03c('0x7a')]({'isolationLevel':db[_0xc03c('0x79')][_0xc03c('0x7b')][_0xc03c('0x7c')]['READ_COMMITTED']},function(_0xeb7088){return db['FaxAccount'][_0xc03c('0x67')]({'where':{'id':_0x31de27},'transaction':_0xeb7088})[_0xc03c('0x20')](function(_0xb7f35f){if(_0xb7f35f){return db[_0xc03c('0x7d')]['destroy']({'where':{'FaxAccountId':_0x31de27},'transaction':_0xeb7088})[_0xc03c('0x20')](function(){var _0x274f3c=_[_0xc03c('0x3e')](_0x351f19,function(_0x17c906){_0x17c906['FaxAccountId']=_0x31de27;return _0x17c906;});return db[_0xc03c('0x7d')]['bulkCreate'](_0x274f3c,{'transaction':_0xeb7088});});}else{_0x33f4ae=0x194;_0x1fefc9=[];}});})[_0xc03c('0x20')](function(){if(_0x33f4ae!==0x194){return db['FaxApplication'][_0xc03c('0x7e')]({'where':{'FaxAccountId':_0x31de27},'order':_0xc03c('0x7f')})[_0xc03c('0x20')](function(_0x48dfb0){_0x1fefc9=_0x48dfb0;});}})['catch'](function(_0x4c17e4){_0x33f4ae=0x1f4;logger[_0xc03c('0x26')](_0x4c17e4[_0xc03c('0x3b')]);if(_0x4c17e4[_0xc03c('0x44')]){delete _0x4c17e4[_0xc03c('0x44')];}_0x1fefc9=_0x4c17e4;})[_0xc03c('0x80')](function(){if(_0x1fefc9===null){_0x18fd62[_0xc03c('0x2b')](_0x33f4ae);}else{if(_0x33f4ae===0x1f4){_0x18fd62['status'](_0x33f4ae)[_0xc03c('0x3c')](_0x1fefc9);}else{_0x18fd62['status'](_0x33f4ae)['json'](_0x1fefc9);}}});};exports[_0xc03c('0x81')]=function(_0x1a8b05,_0x2b03b9,_0xac8250){var _0x509365={};var _0x2d4892={};var _0x47786c;var _0x24989a;return db['FaxAccount']['findOne']({'where':{'id':_0x1a8b05[_0xc03c('0x62')]['id']}})['then'](handleEntityNotFound(_0x2b03b9,null))['then'](function(_0x1273ba){if(_0x1273ba){_0x47786c=_0x1273ba;_0x2d4892['model']=_['keys'](db[_0xc03c('0x7d')][_0xc03c('0x40')]);_0x2d4892[_0xc03c('0x45')]=_[_0xc03c('0x46')](_0x1a8b05['query']);_0x2d4892[_0xc03c('0x47')]=_['intersection'](_0x2d4892[_0xc03c('0x43')],_0x2d4892['query']);_0x509365[_0xc03c('0x49')]=_['intersection'](_0x2d4892[_0xc03c('0x43')],qs[_0xc03c('0x4a')](_0x1a8b05['query']['fields']));_0x509365[_0xc03c('0x49')]=_0x509365['attributes'][_0xc03c('0x4b')]?_0x509365['attributes']:_0x2d4892[_0xc03c('0x43')];_0x509365[_0xc03c('0x4e')]=qs['sort'](_0x1a8b05[_0xc03c('0x45')][_0xc03c('0x4f')]);_0x509365['where']=qs[_0xc03c('0x47')](_[_0xc03c('0x50')](_0x1a8b05[_0xc03c('0x45')],_0x2d4892[_0xc03c('0x47')]));if(_0x1a8b05[_0xc03c('0x45')][_0xc03c('0x51')]){_0x509365[_0xc03c('0x53')]=_[_0xc03c('0x52')](_0x509365[_0xc03c('0x53')],{'$or':_[_0xc03c('0x3e')](_0x509365[_0xc03c('0x49')],function(_0x2e7861){var _0x2579f9={};_0x2579f9[_0x2e7861]={'$like':'%'+_0x1a8b05['query']['filter']+'%'};return _0x2579f9;})});}_0x509365=_['merge']({},_0x509365,_0x1a8b05[_0xc03c('0x6d')]);return _0x47786c[_0xc03c('0x81')](_0x509365);}})[_0xc03c('0x20')](function(_0x514cae){if(_0x514cae){_0x24989a=_0x514cae[_0xc03c('0x4b')];if(!_0x1a8b05[_0xc03c('0x45')][_0xc03c('0x4c')](_0xc03c('0x4d'))){_0x509365['limit']=qs[_0xc03c('0x30')](_0x1a8b05[_0xc03c('0x45')][_0xc03c('0x30')]);_0x509365[_0xc03c('0x2f')]=qs['offset'](_0x1a8b05[_0xc03c('0x45')][_0xc03c('0x2f')]);}return _0x47786c[_0xc03c('0x81')](_0x509365);}})[_0xc03c('0x20')](function(_0x2fa2b1){if(_0x2fa2b1){return _0x2fa2b1?{'count':_0x24989a,'rows':_0x2fa2b1}:null;}})[_0xc03c('0x20')](respondWithResult(_0x2b03b9,null))[_0xc03c('0x2a')](handleError(_0x2b03b9,null));};function Extension(_0x984e60,_0x446a7f,_0x28f05f,_0x5134cc){this[_0xc03c('0x82')]=_0xc03c('0x83');this[_0xc03c('0x84')]=_0x984e60[_0xc03c('0x85')];this['app']=_0x5134cc;this['type']='system';this[_0xc03c('0x86')]=_0xc03c('0x87');this[_0xc03c('0x64')]=_0x984e60['id'];this['priority']=_0x446a7f;this[_0xc03c('0x88')]=_0x28f05f;}function createExtensionsReciveFax(_0x359112){var _0x4f86e4=0x1;var _0x5e4714=[];_0x5e4714[_0xc03c('0x89')](new Extension(_0x359112,_0x4f86e4,'','Answer'));_0x4f86e4+=0x1;_0x5e4714[_0xc03c('0x89')](new Extension(_0x359112,_0x4f86e4,'CDR(type)=inbound-fax',_0xc03c('0x8a')));_0x4f86e4+=0x1;for(var _0x49459b in _0x359112){if(_0x359112[_0xc03c('0x4c')](_0x49459b)&&(_0x49459b===_0xc03c('0x8b')||_0x49459b===_0xc03c('0x85')||_0x49459b==='gateway'||_0x49459b===_0xc03c('0x8c')||_0x49459b===_0xc03c('0x8d')||_0x49459b===_0xc03c('0x8e')||_0x49459b===_0xc03c('0x8f')||_0x49459b===_0xc03c('0x90')||_0x49459b===_0xc03c('0x91'))){_0x5e4714[_0xc03c('0x89')](new Extension(_0x359112,_0x4f86e4,_0xc03c('0x92')+_0x49459b+')='+_0x359112[_0x49459b],_0xc03c('0x8a')));_0x4f86e4+=0x1;}}_0x5e4714['push'](new Extension(_0x359112,_0x4f86e4,'6',_0xc03c('0x93')));_0x4f86e4+=0x1;_0x5e4714[_0xc03c('0x89')](new Extension(_0x359112,_0x4f86e4,_0xc03c('0x94'),_0xc03c('0x95')));_0x4f86e4=0x0;return _0x5e4714;}exports[_0xc03c('0x96')]=function(_0x230d48,_0x2d133a,_0x4e2d9d){var _0x5094ce;return db[_0xc03c('0x79')][_0xc03c('0x7a')](function(_0x263da4){return db['FaxAccount'][_0xc03c('0x5a')](_0x230d48[_0xc03c('0x5b')],{'transaction':_0x263da4})[_0xc03c('0x20')](function(_0x5363ef){_0x5094ce=_0x5363ef[_0xc03c('0x39')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x5094ce),{'transaction':_0x263da4});});})['then'](function(){return _0x5094ce;})[_0xc03c('0x20')](respondWithResult(_0x2d133a,null))[_0xc03c('0x2a')](handleError(_0x2d133a,null));};exports[_0xc03c('0x97')]=function(_0xa29fe6,_0x18e6a2,_0x126765){var _0xd3a186;return db[_0xc03c('0x79')]['transaction'](function(_0xbb6d2b){return db[_0xc03c('0x3f')][_0xc03c('0x37')](_0xa29fe6[_0xc03c('0x5b')],{'where':{'id':_0xa29fe6[_0xc03c('0x5b')]['id']},'transaction':_0xbb6d2b})['then'](function(_0x386925){return db[_0xc03c('0x98')]['destroy']({'where':{'FaxAccountId':_0xa29fe6['body']['id']},'transaction':_0xbb6d2b})[_0xc03c('0x20')](function(_0x245c62){return db[_0xc03c('0x98')]['bulkCreate'](createExtensionsReciveFax(_[_0xc03c('0x99')](_0xa29fe6[_0xc03c('0x5b')],[_0xc03c('0x9a'),_0xc03c('0x42'),_0xc03c('0x9b'),_0xc03c('0x9c'),_0xc03c('0x9d'),_0xc03c('0x9e')])),{'transaction':_0xbb6d2b});});});})[_0xc03c('0x20')](function(){return db[_0xc03c('0x3f')]['findById'](_0xa29fe6[_0xc03c('0x5b')]['id']);})[_0xc03c('0x20')](respondWithResult(_0x18e6a2,null))[_0xc03c('0x2a')](handleError(_0x18e6a2,null));};exports['getMessages']=function(_0x34b8d8,_0x21e756,_0x33b849){var _0xda5f8c={'raw':!![],'where':{}};var _0x1bd801={};var _0x28dd82={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc03c('0x67')]({'where':{'id':_0x34b8d8['params']['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x21e756,null))[_0xc03c('0x20')](function(_0x5c3482){if(_0x5c3482){_0x1bd801[_0xc03c('0x43')]=_[_0xc03c('0x46')](db[_0xc03c('0x9f')][_0xc03c('0x40')]);_0x1bd801['query']=_['keys'](_0x34b8d8[_0xc03c('0x45')]);_0x1bd801[_0xc03c('0x47')]=_[_0xc03c('0x48')](_0x1bd801[_0xc03c('0x43')],_0x1bd801[_0xc03c('0x45')]);_0xda5f8c[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x1bd801['model'],qs[_0xc03c('0x4a')](_0x34b8d8[_0xc03c('0x45')][_0xc03c('0x4a')]));_0xda5f8c[_0xc03c('0x49')]=_0xda5f8c[_0xc03c('0x49')][_0xc03c('0x4b')]?_0xda5f8c[_0xc03c('0x49')]:_0x1bd801['model'];if(!_0x34b8d8[_0xc03c('0x45')][_0xc03c('0x4c')](_0xc03c('0x4d'))){_0xda5f8c[_0xc03c('0x30')]=qs['limit'](_0x34b8d8[_0xc03c('0x45')][_0xc03c('0x30')]);_0xda5f8c[_0xc03c('0x2f')]=qs[_0xc03c('0x2f')](_0x34b8d8['query'][_0xc03c('0x2f')]);}_0xda5f8c[_0xc03c('0x4e')]=qs[_0xc03c('0x4f')](_0x34b8d8[_0xc03c('0x45')]['sort']);_0xda5f8c['where']=qs[_0xc03c('0x47')](_[_0xc03c('0x50')](_0x34b8d8[_0xc03c('0x45')],_0x1bd801[_0xc03c('0x47')]));_0xda5f8c[_0xc03c('0x53')][_0xc03c('0x64')]=_0x5c3482['id'];if(_0x34b8d8[_0xc03c('0x45')][_0xc03c('0x51')]){_0xda5f8c[_0xc03c('0x53')]=_[_0xc03c('0x52')](_0xda5f8c[_0xc03c('0x53')],{'$or':_[_0xc03c('0x3e')](_0xda5f8c[_0xc03c('0x49')],function(_0x5b3eba){var _0x2e488d={};_0x2e488d[_0x5b3eba]={'$like':'%'+_0x34b8d8[_0xc03c('0x45')][_0xc03c('0x51')]+'%'};return _0x2e488d;})});}if(_0x34b8d8['query'][_0xc03c('0xa0')]){var _0x40ff27=_0x34b8d8[_0xc03c('0x45')][_0xc03c('0xa0')][_0xc03c('0xa1')](',');var _0x2fa59a={};_0x2fa59a[_0x40ff27[0x0]]={'$gte':moment(_0x40ff27[0x1])[_0xc03c('0xa2')](_0xc03c('0xa3'))};_0xda5f8c[_0xc03c('0x53')]=_['merge'](_0xda5f8c['where'],_0x2fa59a);}_0xda5f8c=_[_0xc03c('0x52')]({},_0xda5f8c,_0x34b8d8[_0xc03c('0x6d')]);return db[_0xc03c('0x9f')][_0xc03c('0x32')]({'where':_0xda5f8c[_0xc03c('0x53')]})[_0xc03c('0x20')](function(_0x4ad802){_0x28dd82[_0xc03c('0x32')]=_0x4ad802;if(_0x34b8d8['query'][_0xc03c('0x68')]){_0xda5f8c[_0xc03c('0x55')]=[{'all':!![]}];}return db[_0xc03c('0x9f')][_0xc03c('0x56')](_0xda5f8c);})[_0xc03c('0x20')](function(_0x1dfbb2){_0x28dd82[_0xc03c('0x57')]=_0x1dfbb2;return _0x28dd82;});}})[_0xc03c('0x20')](respondWithFilteredResult(_0x21e756,_0xda5f8c))['catch'](handleError(_0x21e756,null));};exports['send']=function(_0x1d0bd2,_0x58bdef,_0x39f727){var _0x1790e5,_0x3e7760={},_0x2af8f1;if(_0x1d0bd2[_0xc03c('0x5b')]['to']){_0x2af8f1=_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0];}return db['FaxAccount'][_0xc03c('0x59')]({'where':{'id':_0x1d0bd2[_0xc03c('0x62')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xc03c('0xa4'),'where':{'fax':_0x2af8f1},'limit':0x1,'order':[[_0xc03c('0x9c'),_0xc03c('0xa5')]]}]}]})[_0xc03c('0x20')](handleEntityNotFound(_0x58bdef,null))[_0xc03c('0x20')](function(_0x3a978e){_0x1790e5=_0x3a978e;if(_0x1d0bd2[_0xc03c('0x5b')]['attachments']&&_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xa6')][_0xc03c('0x4b')]){for(var _0xf5c464=0x0;_0xf5c464<_0x1d0bd2[_0xc03c('0x5b')]['attachments'][_0xc03c('0x4b')];_0xf5c464+=0x1){_0x1d0bd2[_0xc03c('0x5b')]['attachments'][_0xf5c464]={'filename':_0x1d0bd2['body']['attachments'][_0xf5c464][_0xc03c('0x44')],'id':_0x1d0bd2['body'][_0xc03c('0xa6')][_0xf5c464]['id'],'path':path[_0xc03c('0xa7')](config['root'],_0xc03c('0xa8'),_0x1d0bd2['body'][_0xc03c('0xa6')][_0xf5c464][_0xc03c('0xa9')])};}}return respondWithRpcPromise(_0xc03c('0xaa'),_0xc03c('0xaa'),{'FaxAccountId':_[_0xc03c('0xab')](_0x1d0bd2['params']['id'])?undefined:_0x1d0bd2[_0xc03c('0x62')]['id'],'path':_[_0xc03c('0xab')](_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xa6')][0x0][_0xc03c('0x5')])?undefined:_0x1d0bd2['body'][_0xc03c('0xa6')][0x0][_0xc03c('0x5')],'fax':_[_0xc03c('0xab')](_0x1d0bd2['body']['to'][0x0])?undefined:_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0]},client9002);})['then'](function(){if(_0x1790e5){if(_[_0xc03c('0xab')](_0x1d0bd2[_0xc03c('0x5b')]['from'])){_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xac')]=util['format'](_0xc03c('0xad'),_0x1790e5[_0xc03c('0x44')],_0x1790e5['fax']);}if(_0x1790e5['List']){if(_0x1790e5[_0xc03c('0xae')][_0xc03c('0xa4')][_0xc03c('0x4b')]){return _0x1790e5[_0xc03c('0xae')][_0xc03c('0xa4')][0x0];}else{return db[_0xc03c('0x73')][_0xc03c('0x5a')](_[_0xc03c('0x1a')](_0x1d0bd2[_0xc03c('0x5b')],{'firstName':_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0],'phone':_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0],'fax':_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0],'ListId':_0x1790e5[_0xc03c('0x9e')]}));}}else{throw new Error(_0xc03c('0xaf'));}}else{throw new Error(_0xc03c('0xb0'));}})[_0xc03c('0x20')](function(_0x503ff6){if(_0x503ff6){return db[_0xc03c('0x70')][_0xc03c('0x59')]({'where':{'ContactId':_0x503ff6['id'],'closed':![],'FaxAccountId':_0x1790e5['id']}})[_0xc03c('0x20')](function(_0x2ead83){if(_0x2ead83){return[_0x2ead83,![]];}return db[_0xc03c('0x70')][_0xc03c('0x5a')]({'UserId':_0x1d0bd2[_0xc03c('0x5c')]['id'],'ContactId':_0x503ff6['id'],'FaxAccountId':_0x1790e5['id'],'fax':_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0],'firstMsgDirection':_0xc03c('0xb1'),'Messages':[_[_0xc03c('0x52')](_0x1d0bd2[_0xc03c('0x5b')],{'read':![],'body':_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xa6')][0x0][_0xc03c('0xb2')],'FaxAccountId':_0x1790e5['id'],'UserId':_0x1d0bd2[_0xc03c('0x5c')]['id'],'ContactId':_0x503ff6['id'],'AttachmentId':_0x1d0bd2[_0xc03c('0x5b')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xc03c('0x9f')],'as':'Messages'}]})[_0xc03c('0x20')](function(_0xb29b05){return[_0xb29b05,!![]];});});}else{throw new Error(_0xc03c('0xb3'));}})[_0xc03c('0xb4')](function(_0x57fffc,_0x433e9f){if(_0x433e9f){return _0x57fffc;}return db[_0xc03c('0x9f')][_0xc03c('0x5a')]({'direction':_0xc03c('0xb1'),'read':![],'body':_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xa6')][0x0]['filename'],'FaxAccountId':_0x1790e5['id'],'FaxInteractionId':_0x57fffc['id'],'UserId':_0x1d0bd2['user']['id'],'ContactId':_0x57fffc[_0xc03c('0xb5')],'AttachmentId':_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xa6')][0x0]['id']})[_0xc03c('0x20')](function(_0x591734){_0x57fffc[_0xc03c('0xb6')]['Messages']=[];_0x57fffc['dataValues'][_0xc03c('0xb7')][_0xc03c('0x89')](_0x591734['dataValues']);return _0x57fffc;});})[_0xc03c('0x20')](function(_0x5047d4){respondWithRpcPromise(_0xc03c('0xb8'),_0xc03c('0xb8'),{'FaxAccountId':_[_0xc03c('0xab')](_0x1d0bd2['params']['id'])?undefined:_0x1d0bd2[_0xc03c('0x62')]['id'],'path':_[_0xc03c('0xab')](_0x1d0bd2[_0xc03c('0x5b')][_0xc03c('0xa6')][0x0]['path'])?undefined:_0x1d0bd2[_0xc03c('0x5b')]['attachments'][0x0][_0xc03c('0x5')],'fax':_[_0xc03c('0xab')](_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0])?undefined:_0x1d0bd2[_0xc03c('0x5b')]['to'][0x0],'AttachmentId':_0x1d0bd2['body'][_0xc03c('0xa6')][0x0]['id']},client9002)[_0xc03c('0x20')](function(_0x32f89c){logger[_0xc03c('0x28')](_0xc03c('0xb9'),_0x32f89c);})[_0xc03c('0x2a')](function(_0x38ff43){logger[_0xc03c('0x28')](_0xc03c('0xb9'),_0x38ff43);});return _0x5047d4;})[_0xc03c('0x20')](respondWithResult(_0x58bdef,null))[_0xc03c('0x2a')](handleError(_0x58bdef,null));};exports[_0xc03c('0xba')]=function(_0x218dcf,_0x2b10f9,_0xcc1932){return db['FaxAccount']['find']({'where':{'id':_0x218dcf['params']['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x2b10f9,null))[_0xc03c('0x20')](function(_0x5b3792){if(_0x5b3792){return _0x5b3792[_0xc03c('0xba')](_0x218dcf[_0xc03c('0x5b')][_0xc03c('0x71')],_[_0xc03c('0x99')](_0x218dcf['body'],[_0xc03c('0x71'),'id'])||{})[_0xc03c('0xb4')](function(_0xe4572b){for(var _0x416621=0x0;_0x416621<_0x218dcf[_0xc03c('0x5b')]['ids']['length'];_0x416621+=0x1){socket[_0xc03c('0xbb')](_0xc03c('0xbc'),{'UserId':Number(_0x218dcf['body'][_0xc03c('0x71')][_0x416621]),'FaxAccountId':Number(_0x218dcf[_0xc03c('0x62')]['id'])});}return _0xe4572b;});}})[_0xc03c('0x20')](respondWithResult(_0x2b10f9,null))['catch'](handleError(_0x2b10f9,null));};exports[_0xc03c('0xbd')]=function(_0x258e92,_0x52b124,_0x6ff4b4){return db[_0xc03c('0x3f')][_0xc03c('0x59')]({'where':{'id':_0x258e92[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x52b124,null))[_0xc03c('0x20')](function(_0x338075){if(_0x338075){return _0x338075[_0xc03c('0xbd')](_0x258e92[_0xc03c('0x45')][_0xc03c('0x71')])[_0xc03c('0x20')](function(){if(_[_0xc03c('0xbe')](_0x258e92[_0xc03c('0x45')]['ids'])){for(var _0x2a7b32=0x0;_0x2a7b32<_0x258e92[_0xc03c('0x45')]['ids'][_0xc03c('0x4b')];_0x2a7b32+=0x1){socket[_0xc03c('0xbb')](_0xc03c('0xbf'),{'UserId':Number(_0x258e92['query'][_0xc03c('0x71')][_0x2a7b32]),'FaxAccountId':Number(_0x258e92['params']['id'])});}}else{socket[_0xc03c('0xbb')](_0xc03c('0xbf'),{'UserId':Number(_0x258e92['query'][_0xc03c('0x71')]),'FaxAccountId':Number(_0x258e92[_0xc03c('0x62')]['id'])});}});}})[_0xc03c('0x20')](respondWithStatusCode(_0x52b124,null))[_0xc03c('0x2a')](handleError(_0x52b124,null));};exports['getAgents']=function(_0x21f73c,_0x4dabdc,_0x4bc9f8){var _0x1a64af={};var _0x36305e={};var _0x6d0ac4;var _0x28457a;return db[_0xc03c('0x3f')][_0xc03c('0x67')]({'where':{'id':_0x21f73c[_0xc03c('0x62')]['id']}})[_0xc03c('0x20')](handleEntityNotFound(_0x4dabdc,null))[_0xc03c('0x20')](function(_0x2bf2cf){if(_0x2bf2cf){_0x6d0ac4=_0x2bf2cf;_0x36305e[_0xc03c('0x43')]=_['keys'](db['User'][_0xc03c('0x40')]);_0x36305e['query']=_[_0xc03c('0x46')](_0x21f73c[_0xc03c('0x45')]);_0x36305e['filters']=_[_0xc03c('0x48')](_0x36305e[_0xc03c('0x43')],_0x36305e[_0xc03c('0x45')]);_0x1a64af[_0xc03c('0x49')]=_[_0xc03c('0x48')](_0x36305e[_0xc03c('0x43')],qs[_0xc03c('0x4a')](_0x21f73c[_0xc03c('0x45')][_0xc03c('0x4a')]));_0x1a64af[_0xc03c('0x49')]=_0x1a64af[_0xc03c('0x49')][_0xc03c('0x4b')]?_0x1a64af[_0xc03c('0x49')]:_0x36305e['model'];_0x1a64af[_0xc03c('0x4e')]=qs[_0xc03c('0x4f')](_0x21f73c['query']['sort']);_0x1a64af[_0xc03c('0x53')]=qs['filters'](_[_0xc03c('0x50')](_0x21f73c['query'],_0x36305e[_0xc03c('0x47')]));if(_0x21f73c['query'][_0xc03c('0x51')]){_0x1a64af[_0xc03c('0x53')]=_[_0xc03c('0x52')](_0x1a64af['where'],{'$or':_[_0xc03c('0x3e')](_0x1a64af['attributes'],function(_0xcdbdfc){var _0x563f94={};_0x563f94[_0xcdbdfc]={'$like':'%'+_0x21f73c['query'][_0xc03c('0x51')]+'%'};return _0x563f94;})});}_0x1a64af=_[_0xc03c('0x52')]({},_0x1a64af,_0x21f73c[_0xc03c('0x6d')]);return _0x6d0ac4[_0xc03c('0xc0')](_0x1a64af);}})[_0xc03c('0x20')](function(_0x21895f){if(_0x21895f){_0x28457a=_0x21895f[_0xc03c('0x4b')];if(!_0x21f73c['query'][_0xc03c('0x4c')]('nolimit')){_0x1a64af['limit']=qs[_0xc03c('0x30')](_0x21f73c[_0xc03c('0x45')][_0xc03c('0x30')]);_0x1a64af[_0xc03c('0x2f')]=qs['offset'](_0x21f73c[_0xc03c('0x45')][_0xc03c('0x2f')]);}return _0x6d0ac4[_0xc03c('0xc0')](_0x1a64af);}})['then'](function(_0x38152f){if(_0x38152f){return _0x38152f?{'count':_0x28457a,'rows':_0x38152f}:null;}})[_0xc03c('0x20')](respondWithResult(_0x4dabdc,null))[_0xc03c('0x2a')](handleError(_0x4dabdc,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6121f66..069c4e6 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 _0x860c=['FaxAccount','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x31dd7d,_0x41e269){var _0x3f8100=function(_0x93301b){while(--_0x93301b){_0x31dd7d['push'](_0x31dd7d['shift']());}};_0x3f8100(++_0x41e269);}(_0x860c,0x14f));var _0xc860=function(_0x5cebc0,_0x77fd1c){_0x5cebc0=_0x5cebc0-0x0;var _0x5bb978=_0x860c[_0x5cebc0];return _0x5bb978;};'use strict';var EventEmitter=require(_0xc860('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xc860('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc860('0x2'),'afterDestroy':'remove'};function emitEvent(_0x42dc7d){return function(_0x5ac2cd,_0x150848,_0x4c1cfd){FaxAccountEvents[_0xc860('0x3')](_0x42dc7d+':'+_0x5ac2cd['id'],_0x5ac2cd);FaxAccountEvents[_0xc860('0x3')](_0x42dc7d,_0x5ac2cd);_0x4c1cfd(null);};}for(var e in events){if(events[_0xc860('0x4')](e)){var event=events[e];FaxAccount[_0xc860('0x5')](e,emitEvent(event));}}module[_0xc860('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x9d27=['hasOwnProperty','hook','events','../../mysqldb','save','remove','emit'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x9d27,0xcd));var _0x79d2=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x9d27[_0x1806d4];return _0x392c2c;};'use strict';var EventEmitter=require(_0x79d2('0x0'));var FaxAccount=require(_0x79d2('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79d2('0x2'),'afterUpdate':'update','afterDestroy':_0x79d2('0x3')};function emitEvent(_0xaa3034){return function(_0x4c6f94,_0x461fa4,_0x2b767b){FaxAccountEvents[_0x79d2('0x4')](_0xaa3034+':'+_0x4c6f94['id'],_0x4c6f94);FaxAccountEvents['emit'](_0xaa3034,_0x4c6f94);_0x2b767b(null);};}for(var e in events){if(events[_0x79d2('0x5')](e)){var event=events[e];FaxAccount[_0x79d2('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 8cd49f2..fcde3b3 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 _0x81e9=['./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x81e9,0x139));var _0x981e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x81e9[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x981e('0x0'));var util=require(_0x981e('0x1'));var logger=require(_0x981e('0x2'))(_0x981e('0x3'));var moment=require(_0x981e('0x4'));var BPromise=require('bluebird');var rp=require(_0x981e('0x5'));var fs=require('fs');var path=require(_0x981e('0x6'));var rimraf=require(_0x981e('0x7'));var config=require(_0x981e('0x8'));var attributes=require(_0x981e('0x9'));module[_0x981e('0xa')]=function(_0x12dc59,_0x38cbb5){return _0x12dc59[_0x981e('0xb')](_0x981e('0xc'),attributes,{'tableName':_0x981e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3a5=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxAccount.attributes','define'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0xe3a5,0x18e));var _0x5e3a=function(_0x6b35fe,_0x45c9dc){_0x6b35fe=_0x6b35fe-0x0;var _0x30215d=_0xe3a5[_0x6b35fe];return _0x30215d;};'use strict';var _=require(_0x5e3a('0x0'));var util=require(_0x5e3a('0x1'));var logger=require(_0x5e3a('0x2'))(_0x5e3a('0x3'));var moment=require(_0x5e3a('0x4'));var BPromise=require(_0x5e3a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3a('0x6'));var rimraf=require('rimraf');var config=require(_0x5e3a('0x7'));var attributes=require(_0x5e3a('0x8'));module['exports']=function(_0x50766b,_0x46c849){return _0x50766b[_0x5e3a('0x9')](_0x5e3a('0xa'),attributes,{'tableName':_0x5e3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index f1b2def..7d215aa 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 _0x923b=['close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','agent','startRouting','Start','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','NotifyFaxAccount','body','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','get','applications','asc','length','defaults','contact','fax','FaxInteraction','create','Contact\x20not\x20found','spread','push'];(function(_0x4566e9,_0x516a1f){var _0x220c28=function(_0x1e0f47){while(--_0x1e0f47){_0x4566e9['push'](_0x4566e9['shift']());}};_0x220c28(++_0x516a1f);}(_0x923b,0xb9));var _0xb923=function(_0x1bcc92,_0x4929b8){_0x1bcc92=_0x1bcc92-0x0;var _0x88406a=_0x923b[_0x1bcc92];return _0x88406a;};'use strict';var _=require(_0xb923('0x0'));var util=require(_0xb923('0x1'));var moment=require(_0xb923('0x2'));var BPromise=require('bluebird');var rs=require(_0xb923('0x3'));var fs=require('fs');var Redis=require(_0xb923('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb923('0x5'));var logger=require(_0xb923('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config[_0xb923('0x7')]=_['defaults'](config[_0xb923('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb923('0x7')]));require(_0xb923('0x8'))[_0xb923('0x9')](socket);function respondWithRpcPromise(_0x978391,_0xa3f9d8,_0xc3c9fc){return new BPromise(function(_0x592021,_0x272807){return client[_0xb923('0xa')](_0x978391,_0xc3c9fc)[_0xb923('0xb')](function(_0x18c617){logger[_0xb923('0xc')](_0xb923('0xd'),_0xa3f9d8,_0xb923('0xe'));logger[_0xb923('0xf')](_0xb923('0x10'),_0xa3f9d8,_0xb923('0xe'),JSON[_0xb923('0x11')](_0x18c617));if(_0x18c617[_0xb923('0x12')]){if(_0x18c617[_0xb923('0x12')][_0xb923('0x13')]===0x1f4){logger[_0xb923('0x12')](_0xb923('0xd'),_0xa3f9d8,_0x18c617[_0xb923('0x12')][_0xb923('0x14')]);return _0x272807(_0x18c617[_0xb923('0x12')][_0xb923('0x14')]);}logger[_0xb923('0x12')](_0xb923('0xd'),_0xa3f9d8,_0x18c617[_0xb923('0x12')]['message']);return _0x592021(_0x18c617[_0xb923('0x12')][_0xb923('0x14')]);}else{logger[_0xb923('0xc')](_0xb923('0xd'),_0xa3f9d8,_0xb923('0xe'));_0x592021(_0x18c617[_0xb923('0x15')]['message']);}})[_0xb923('0x16')](function(_0x3b50af){logger['error'](_0xb923('0xd'),_0xa3f9d8,_0x3b50af);_0x272807(_0x3b50af);});});}exports[_0xb923('0x17')]=function(_0x1b9491){var _0x382863=this;return new Promise(function(_0x3023f0,_0x42ffc6){return db[_0xb923('0x18')][_0xb923('0x19')]({'raw':_0x1b9491['options']?_0x1b9491[_0xb923('0x1a')][_0xb923('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b9491[_0xb923('0x1a')]?_0x1b9491[_0xb923('0x1a')][_0xb923('0x1c')]||null:null,'attributes':_0x1b9491['options']?_0x1b9491[_0xb923('0x1a')][_0xb923('0x1d')]||null:null,'limit':_0x1b9491[_0xb923('0x1a')]?_0x1b9491[_0xb923('0x1a')][_0xb923('0x1e')]||null:null,'include':_0x1b9491[_0xb923('0x1a')]?_0x1b9491[_0xb923('0x1a')]['include']?_[_0xb923('0x1f')](_0x1b9491[_0xb923('0x1a')][_0xb923('0x20')],function(_0x1f6940){return{'model':db[_0x1f6940[_0xb923('0x21')]],'as':_0x1f6940['as'],'attributes':_0x1f6940[_0xb923('0x1d')],'include':_0x1f6940['include']?_['map'](_0x1f6940[_0xb923('0x20')],function(_0x14eef0){return{'model':db[_0x14eef0[_0xb923('0x21')]],'as':_0x14eef0['as'],'attributes':_0x14eef0['attributes'],'include':_0x14eef0[_0xb923('0x20')]?_['map'](_0x14eef0[_0xb923('0x20')],function(_0x2349f7){return{'model':db[_0x2349f7[_0xb923('0x21')]],'as':_0x2349f7['as'],'attributes':_0x2349f7[_0xb923('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb923('0xb')](function(_0x305081){logger[_0xb923('0xc')](_0xb923('0x17'),_0x1b9491);logger['debug'](_0xb923('0x17'),_0x1b9491,JSON[_0xb923('0x11')](_0x305081));_0x3023f0(_0x305081);})[_0xb923('0x16')](function(_0xea1881){logger[_0xb923('0x12')](_0xb923('0x17'),_0xea1881[_0xb923('0x14')],_0x1b9491);_0x42ffc6(_0x382863[_0xb923('0x12')](0x1f4,_0xea1881[_0xb923('0x14')]));});});};exports[_0xb923('0x22')]=function(_0x1c2459,_0x5873e1,_0x1b1a04){var _0xf23815=this;return new Promise(function(_0x1268b5,_0x20c75e){var _0x1df40d={'body':_0x1c2459[_0xb923('0x23')],'channel':'fax'};var _0xd4f829=[];var _0x776863=[];var _0x11e717={};return db['CmContact']['describe']()[_0xb923('0xb')](function(_0x4cb7ea){if(!_0x4cb7ea){throw new db[(_0xb923('0x24'))][(_0xb923('0x25'))](_0xb923('0x26'));}_0xd4f829=_[_0xb923('0x27')](_[_0xb923('0x28')](_0x4cb7ea),[_0xb923('0x29'),_0xb923('0x2a')]);_0x776863=_[_0xb923('0x27')](_['keys'](_0x4cb7ea),[_0xb923('0x29'),'updatedAt',_0xb923('0x2b'),_0xb923('0x2c')]);if(_0x1c2459[_0xb923('0x23')]['id']){delete _0x1c2459[_0xb923('0x23')]['id'];}if(_[_0xb923('0x2d')](_0x1c2459['body'][_0xb923('0x2e')])){throw new db[(_0xb923('0x24'))][(_0xb923('0x25'))](_0xb923('0x2f'));}if(_[_0xb923('0x2d')](_0x1c2459['body']['body'])||_0x1c2459[_0xb923('0x23')][_0xb923('0x23')]===''){throw new db[(_0xb923('0x24'))][(_0xb923('0x25'))](_0xb923('0x30'));}if(_[_0xb923('0x2d')](_0x1c2459[_0xb923('0x23')]['mapKey'])){throw new db[(_0xb923('0x24'))]['ValidationError'](_0xb923('0x31')+_0x776863);}if(!_[_0xb923('0x32')](_0x776863,_0x1c2459[_0xb923('0x23')][_0xb923('0x33')])){throw new db[(_0xb923('0x24'))][(_0xb923('0x25'))](_0xb923('0x34')+_0x776863);}_0x11e717[_0x1c2459['body'][_0xb923('0x33')]]=_0x1c2459[_0xb923('0x23')][_0xb923('0x2e')];})[_0xb923('0xb')](function(){return db[_0xb923('0x18')][_0xb923('0x35')]({'where':{'id':_0x1c2459[_0xb923('0x36')]['id']},'include':[{'model':db[_0xb923('0x37')],'as':_0xb923('0x38'),'include':[{'model':db[_0xb923('0x39')],'as':_0xb923('0x3a'),'where':_0x11e717,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xb923('0x3b')],'as':_0xb923('0x3c')}]});})[_0xb923('0xb')](function(_0x480733){if(_0x480733&&_0x480733[_0xb923('0x38')]){var _0xf79847=_0x480733[_0xb923('0x3d')]({'plain':!![]});_0x1df40d['account']=_0xf79847;_0x1df40d[_0xb923('0x3e')]=_0xf79847[_0xb923('0x3c')];_0x1df40d['list']=_0xf79847[_0xb923('0x38')];_0x1df40d['applications']=_['orderBy'](_0x1df40d[_0xb923('0x3e')],['priority'],[_0xb923('0x3f')]);if(_0x1df40d[_0xb923('0x36')][_0xb923('0x3c')]){delete _0x1df40d[_0xb923('0x36')][_0xb923('0x3c')];}if(_0x1df40d[_0xb923('0x36')][_0xb923('0x38')]&&_0x1df40d[_0xb923('0x36')][_0xb923('0x38')][_0xb923('0x3a')][_0xb923('0x40')]){return _0x1df40d['account']['List'][_0xb923('0x3a')][0x0];}var _0x1487f5=_[_0xb923('0x41')](_0x1c2459[_0xb923('0x23')],{'firstName':_0x1c2459['body'][_0xb923('0x2e')],'ListId':_0xf79847[_0xb923('0x2c')]});_0x1487f5[_0x1c2459[_0xb923('0x23')][_0xb923('0x33')]]=_0x1c2459[_0xb923('0x23')]['from'];return db[_0xb923('0x39')]['create'](_0x1487f5,{'fields':_0xd4f829,'raw':!![]});}})['then'](function(_0x3c4025){_0x1df40d[_0xb923('0x42')]=_0x3c4025;if(_0x3c4025){var _0x241bc5={'ContactId':_0x3c4025['id'],'FaxAccountId':_0x1c2459[_0xb923('0x36')]['id'],'fax':_0x3c4025[_0xb923('0x43')]};return db[_0xb923('0x44')]['find']({'where':{'ContactId':_0x3c4025['id'],'closed':![],'FaxAccountId':_0x1c2459[_0xb923('0x36')]['id']}})[_0xb923('0xb')](function(_0x5ec8cd){if(_0x5ec8cd){return[_0x5ec8cd,![]];}return db['FaxInteraction'][_0xb923('0x45')](_0x241bc5)[_0xb923('0xb')](function(_0x48a88a){return[_0x48a88a,!![]];});});}else{throw new Error(_0xb923('0x46'));}})[_0xb923('0x47')](function(_0x39e3c0,_0x1d199a){var _0x5e3fc8=_0x39e3c0[_0xb923('0x3d')]({'plain':!![]});if(_0x1d199a){if(_0x1df40d[_0xb923('0x36')]['autoclose']){_0x1df40d[_0xb923('0x3e')][_0xb923('0x48')]({'id':0x0,'priority':_0x1df40d[_0xb923('0x3e')][_0xb923('0x40')]+0x1,'app':_0xb923('0x49'),'appdata':_0xb923('0x4a'),'interval':_0xb923('0x4b')});}_0x5e3fc8[_0xb923('0x4c')]=!![];}else{_0x5e3fc8['created']=![];}_0x1df40d[_0xb923('0x4d')]=_0x5e3fc8;return db[_0xb923('0x4e')]['create']({'body':_0x1c2459['body']['body'],'FaxAccountId':_0x1c2459[_0xb923('0x36')]['id'],'FaxInteractionId':_0x39e3c0['id'],'direction':'in','ContactId':_0x39e3c0[_0xb923('0x4f')],'AttachmentId':_0x1c2459[_0xb923('0x23')]['AttachmentId']});})[_0xb923('0xb')](function(_0x17c0db){_0x1df40d[_0xb923('0x14')]=_0x17c0db;if(_0x1df40d['interaction'][_0xb923('0x50')]){return db[_0xb923('0x51')][_0xb923('0x35')]({'attributes':['id',_0xb923('0x52')],'where':{'id':_0x1df40d[_0xb923('0x4d')][_0xb923('0x50')]}})[_0xb923('0xb')](function(_0x1cba68){if(_0x1cba68){_0x1df40d[_0xb923('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb923('0x53'),'appdata':_0x1cba68[_0xb923('0x52')]+','+(_0x1df40d['account']['waitForTheAssignedAgent']||0xa),'interval':_0xb923('0x4b')});}return respondWithRpcPromise('Start',_0xb923('0x54'),_0x1df40d);});}return respondWithRpcPromise(_0xb923('0x55'),'startRouting',_0x1df40d);})[_0xb923('0xb')](function(_0x335cc9){_0x1268b5(_0x335cc9);})['catch'](function(_0x2e1210){_0x20c75e(_0xf23815[_0xb923('0x12')](0x1f4,_0x2e1210[_0xb923('0x14')]));});});}; \ No newline at end of file +var _0x873d=['lodash','bluebird','../../mysqldb','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','options','where','limit','include','map','model','attributes','body','fax','describe','Sequelize','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','defaults','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','AttachmentId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x873d,0x14c));var _0xd873=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x873d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd873('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd873('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd873('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd873('0x3'))('rpc');var config=require(_0xd873('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd873('0x5')]({'port':0x232c});config[_0xd873('0x6')]=_['defaults'](config[_0xd873('0x6')],{'host':_0xd873('0x7'),'port':0x18eb});var socket=require(_0xd873('0x8'))(new Redis(config[_0xd873('0x6')]));require(_0xd873('0x9'))[_0xd873('0xa')](socket);function respondWithRpcPromise(_0x28d86e,_0x3a1688,_0x3f73f6){return new BPromise(function(_0x5d498b,_0x224ae5){return client[_0xd873('0xb')](_0x28d86e,_0x3f73f6)[_0xd873('0xc')](function(_0x33ca9e){logger[_0xd873('0xd')](_0xd873('0xe'),_0x3a1688,_0xd873('0xf'));logger[_0xd873('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3a1688,_0xd873('0xf'),JSON[_0xd873('0x11')](_0x33ca9e));if(_0x33ca9e[_0xd873('0x12')]){if(_0x33ca9e[_0xd873('0x12')][_0xd873('0x13')]===0x1f4){logger[_0xd873('0x12')]('FaxAccount,\x20%s,\x20%s',_0x3a1688,_0x33ca9e[_0xd873('0x12')][_0xd873('0x14')]);return _0x224ae5(_0x33ca9e['error'][_0xd873('0x14')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x3a1688,_0x33ca9e[_0xd873('0x12')][_0xd873('0x14')]);return _0x5d498b(_0x33ca9e[_0xd873('0x12')][_0xd873('0x14')]);}else{logger[_0xd873('0xd')](_0xd873('0xe'),_0x3a1688,_0xd873('0xf'));_0x5d498b(_0x33ca9e[_0xd873('0x15')][_0xd873('0x14')]);}})[_0xd873('0x16')](function(_0x4329e2){logger['error'](_0xd873('0xe'),_0x3a1688,_0x4329e2);_0x224ae5(_0x4329e2);});});}exports[_0xd873('0x17')]=function(_0x5e06de){var _0x39818c=this;return new Promise(function(_0x1c5ef0,_0x135264){return db['FaxAccount']['findAll']({'raw':_0x5e06de[_0xd873('0x18')]?_0x5e06de['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e06de[_0xd873('0x18')]?_0x5e06de['options'][_0xd873('0x19')]||null:null,'attributes':_0x5e06de[_0xd873('0x18')]?_0x5e06de['options']['attributes']||null:null,'limit':_0x5e06de['options']?_0x5e06de[_0xd873('0x18')][_0xd873('0x1a')]||null:null,'include':_0x5e06de[_0xd873('0x18')]?_0x5e06de[_0xd873('0x18')][_0xd873('0x1b')]?_[_0xd873('0x1c')](_0x5e06de[_0xd873('0x18')]['include'],function(_0x4f8945){return{'model':db[_0x4f8945[_0xd873('0x1d')]],'as':_0x4f8945['as'],'attributes':_0x4f8945['attributes'],'include':_0x4f8945['include']?_[_0xd873('0x1c')](_0x4f8945[_0xd873('0x1b')],function(_0x227167){return{'model':db[_0x227167[_0xd873('0x1d')]],'as':_0x227167['as'],'attributes':_0x227167[_0xd873('0x1e')],'include':_0x227167[_0xd873('0x1b')]?_[_0xd873('0x1c')](_0x227167[_0xd873('0x1b')],function(_0x13fa33){return{'model':db[_0x13fa33[_0xd873('0x1d')]],'as':_0x13fa33['as'],'attributes':_0x13fa33['attributes']};}):[]};}):[]};}):[]:[]})[_0xd873('0xc')](function(_0x3ec9d7){logger['info']('GetFaxAccount',_0x5e06de);logger[_0xd873('0x10')](_0xd873('0x17'),_0x5e06de,JSON[_0xd873('0x11')](_0x3ec9d7));_0x1c5ef0(_0x3ec9d7);})[_0xd873('0x16')](function(_0x5770d6){logger[_0xd873('0x12')](_0xd873('0x17'),_0x5770d6[_0xd873('0x14')],_0x5e06de);_0x135264(_0x39818c[_0xd873('0x12')](0x1f4,_0x5770d6[_0xd873('0x14')]));});});};exports['NotifyFaxAccount']=function(_0x783716,_0x8312ca,_0x42d7cd){var _0x5ec1e1=this;return new Promise(function(_0x24944e,_0x120221){var _0x2d44d0={'body':_0x783716[_0xd873('0x1f')],'channel':_0xd873('0x20')};var _0x2240ba=[];var _0xfffbaf=[];var _0x2cfd00={};return db['CmContact'][_0xd873('0x21')]()['then'](function(_0x284d91){if(!_0x284d91){throw new db[(_0xd873('0x22'))]['ValidationError']('no\x20available\x20attributes');}_0x2240ba=_[_0xd873('0x23')](_[_0xd873('0x24')](_0x284d91),[_0xd873('0x25'),_0xd873('0x26')]);_0xfffbaf=_['difference'](_[_0xd873('0x24')](_0x284d91),[_0xd873('0x25'),_0xd873('0x26'),_0xd873('0x27'),_0xd873('0x28')]);if(_0x783716[_0xd873('0x1f')]['id']){delete _0x783716[_0xd873('0x1f')]['id'];}if(_[_0xd873('0x29')](_0x783716[_0xd873('0x1f')]['from'])){throw new db[(_0xd873('0x22'))]['ValidationError'](_0xd873('0x2a'));}if(_[_0xd873('0x29')](_0x783716[_0xd873('0x1f')][_0xd873('0x1f')])||_0x783716['body'][_0xd873('0x1f')]===''){throw new db[(_0xd873('0x22'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x783716['body'][_0xd873('0x2b')])){throw new db['Sequelize'][(_0xd873('0x2c'))](_0xd873('0x2d')+_0xfffbaf);}if(!_[_0xd873('0x2e')](_0xfffbaf,_0x783716[_0xd873('0x1f')][_0xd873('0x2b')])){throw new db['Sequelize']['ValidationError'](_0xd873('0x2f')+_0xfffbaf);}_0x2cfd00[_0x783716[_0xd873('0x1f')][_0xd873('0x2b')]]=_0x783716[_0xd873('0x1f')][_0xd873('0x30')];})[_0xd873('0xc')](function(){return db['FaxAccount'][_0xd873('0x31')]({'where':{'id':_0x783716[_0xd873('0x32')]['id']},'include':[{'model':db[_0xd873('0x33')],'as':_0xd873('0x34'),'include':[{'model':db[_0xd873('0x35')],'as':_0xd873('0x36'),'where':_0x2cfd00,'limit':0x1,'order':[['updatedAt',_0xd873('0x37')]]}]},{'model':db[_0xd873('0x38')],'as':_0xd873('0x39')}]});})[_0xd873('0xc')](function(_0x3f5891){if(_0x3f5891&&_0x3f5891[_0xd873('0x34')]){var _0x43c423=_0x3f5891[_0xd873('0x3a')]({'plain':!![]});_0x2d44d0[_0xd873('0x32')]=_0x43c423;_0x2d44d0[_0xd873('0x3b')]=_0x43c423[_0xd873('0x39')];_0x2d44d0[_0xd873('0x3c')]=_0x43c423[_0xd873('0x34')];_0x2d44d0[_0xd873('0x3b')]=_[_0xd873('0x3d')](_0x2d44d0[_0xd873('0x3b')],['priority'],[_0xd873('0x3e')]);if(_0x2d44d0['account'][_0xd873('0x39')]){delete _0x2d44d0[_0xd873('0x32')][_0xd873('0x39')];}if(_0x2d44d0['account'][_0xd873('0x34')]&&_0x2d44d0[_0xd873('0x32')]['List']['Contacts'][_0xd873('0x3f')]){return _0x2d44d0[_0xd873('0x32')]['List'][_0xd873('0x36')][0x0];}var _0x3e7d96=_[_0xd873('0x40')](_0x783716['body'],{'firstName':_0x783716[_0xd873('0x1f')][_0xd873('0x30')],'ListId':_0x43c423[_0xd873('0x28')]});_0x3e7d96[_0x783716[_0xd873('0x1f')]['mapKey']]=_0x783716[_0xd873('0x1f')][_0xd873('0x30')];return db[_0xd873('0x35')][_0xd873('0x41')](_0x3e7d96,{'fields':_0x2240ba,'raw':!![]});}})['then'](function(_0x328754){_0x2d44d0['contact']=_0x328754;if(_0x328754){var _0xa3444e={'ContactId':_0x328754['id'],'FaxAccountId':_0x783716['account']['id'],'fax':_0x328754[_0xd873('0x20')]};return db['FaxInteraction'][_0xd873('0x31')]({'where':{'ContactId':_0x328754['id'],'closed':![],'FaxAccountId':_0x783716[_0xd873('0x32')]['id']}})['then'](function(_0x4e158f){if(_0x4e158f){return[_0x4e158f,![]];}return db[_0xd873('0x42')][_0xd873('0x41')](_0xa3444e)['then'](function(_0x4004d5){return[_0x4004d5,!![]];});});}else{throw new Error(_0xd873('0x43'));}})[_0xd873('0x44')](function(_0x50c32d,_0x2f4302){var _0x574000=_0x50c32d['get']({'plain':!![]});if(_0x2f4302){if(_0x2d44d0['account'][_0xd873('0x45')]){_0x2d44d0['applications'][_0xd873('0x46')]({'id':0x0,'priority':_0x2d44d0[_0xd873('0x3b')][_0xd873('0x3f')]+0x1,'app':_0xd873('0x47'),'appdata':_0xd873('0x48'),'interval':_0xd873('0x49')});}_0x574000[_0xd873('0x4a')]=!![];}else{_0x574000[_0xd873('0x4a')]=![];}_0x2d44d0[_0xd873('0x4b')]=_0x574000;return db['FaxMessage']['create']({'body':_0x783716[_0xd873('0x1f')][_0xd873('0x1f')],'FaxAccountId':_0x783716['account']['id'],'FaxInteractionId':_0x50c32d['id'],'direction':'in','ContactId':_0x50c32d['ContactId'],'AttachmentId':_0x783716[_0xd873('0x1f')][_0xd873('0x4c')]});})[_0xd873('0xc')](function(_0x47e718){_0x2d44d0[_0xd873('0x14')]=_0x47e718;if(_0x2d44d0['interaction']['UserId']){return db[_0xd873('0x4d')][_0xd873('0x31')]({'attributes':['id',_0xd873('0x4e')],'where':{'id':_0x2d44d0[_0xd873('0x4b')]['UserId']}})['then'](function(_0x1bea6e){if(_0x1bea6e){_0x2d44d0[_0xd873('0x3b')][_0xd873('0x4f')]({'id':0x0,'priority':0x0,'app':_0xd873('0x50'),'appdata':_0x1bea6e[_0xd873('0x4e')]+','+(_0x2d44d0[_0xd873('0x32')][_0xd873('0x51')]||0xa),'interval':_0xd873('0x49')});}return respondWithRpcPromise('Start','startRouting',_0x2d44d0);});}return respondWithRpcPromise('Start',_0xd873('0x52'),_0x2d44d0);})[_0xd873('0xc')](function(_0x346bd8){_0x24944e(_0x346bd8);})[_0xd873('0x16')](function(_0x4adb55){_0x120221(_0x5ec1e1[_0xd873('0x12')](0x1f4,_0x4adb55[_0xd873('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7920d4d..85f7a15 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 _0x7087=['removeListener','register','length','faxAccount:','./faxAccount.events','remove','update','emit'];(function(_0x2189d9,_0x41fe7b){var _0x4e6468=function(_0x24eff5){while(--_0x24eff5){_0x2189d9['push'](_0x2189d9['shift']());}};_0x4e6468(++_0x41fe7b);}(_0x7087,0x1cc));var _0x7708=function(_0x508787,_0x1870b4){_0x508787=_0x508787-0x0;var _0x474fa4=_0x7087[_0x508787];return _0x474fa4;};'use strict';var FaxAccountEvents=require(_0x7708('0x0'));var events=['save',_0x7708('0x1'),_0x7708('0x2')];function createListener(_0x417d4a,_0xfbd63e){return function(_0x9a94c5){_0xfbd63e[_0x7708('0x3')](_0x417d4a,_0x9a94c5);};}function removeListener(_0x1bebc7,_0x43cde8){return function(){FaxAccountEvents[_0x7708('0x4')](_0x1bebc7,_0x43cde8);};}exports[_0x7708('0x5')]=function(_0x93495d){for(var _0x3a5ba8=0x0,_0xb0c29a=events[_0x7708('0x6')];_0x3a5ba8<_0xb0c29a;_0x3a5ba8++){var _0x1cc494=events[_0x3a5ba8];var _0x1204c2=createListener(_0x7708('0x7')+_0x1cc494,_0x93495d);FaxAccountEvents['on'](_0x1cc494,_0x1204c2);}}; \ No newline at end of file +var _0xdd51=['./faxAccount.events','save','remove','emit','removeListener','register','length','faxAccount:'];(function(_0x22ca1a,_0x2bab3d){var _0x126a15=function(_0x46d35a){while(--_0x46d35a){_0x22ca1a['push'](_0x22ca1a['shift']());}};_0x126a15(++_0x2bab3d);}(_0xdd51,0x140));var _0x1dd5=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xdd51[_0x47b58b];return _0x46bebe;};'use strict';var FaxAccountEvents=require(_0x1dd5('0x0'));var events=[_0x1dd5('0x1'),_0x1dd5('0x2'),'update'];function createListener(_0x34a6ac,_0xf63ec1){return function(_0x28af08){_0xf63ec1[_0x1dd5('0x3')](_0x34a6ac,_0x28af08);};}function removeListener(_0x5e8f19,_0x6234d0){return function(){FaxAccountEvents[_0x1dd5('0x4')](_0x5e8f19,_0x6234d0);};}exports[_0x1dd5('0x5')]=function(_0x368197){for(var _0x2a0066=0x0,_0x3b42d6=events[_0x1dd5('0x6')];_0x2a0066<_0x3b42d6;_0x2a0066++){var _0x4a606b=events[_0x2a0066];var _0x4fe31c=createListener(_0x1dd5('0x7')+_0x4a606b,_0x368197);FaxAccountEvents['on'](_0x4a606b,_0x4fe31c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3e0a9ea..08a6f9a 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(_0x5ce315,_0x46b899){var _0x414621=function(_0x2d363a){while(--_0x2d363a){_0x5ce315['push'](_0x5ce315['shift']());}};_0x414621(++_0x46b899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x1d6053,_0x1cdc32){var _0x5cde2f=function(_0x5c67d9){while(--_0x5c67d9){_0x1d6053['push'](_0x1d6053['shift']());}};_0x5cde2f(++_0x1cdc32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 c50d87b..be711cd 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 _0x5b9a=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0x5b9a,0x138));var _0xa5b9=function(_0x247bb7,_0x4b3541){_0x247bb7=_0x247bb7-0x0;var _0x31c8ae=_0x5b9a[_0x247bb7];return _0x31c8ae;};'use strict';var Sequelize=require(_0xa5b9('0x0'));module[_0xa5b9('0x1')]={'priority':{'type':Sequelize[_0xa5b9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa5b9('0x3')],'allowNull':![],'defaultValue':_0xa5b9('0x4')},'appdata':{'type':Sequelize[_0xa5b9('0x5')]()},'description':{'type':Sequelize[_0xa5b9('0x3')]},'interval':{'type':Sequelize[_0xa5b9('0x3')],'defaultValue':_0xa5b9('0x6')}}; \ No newline at end of file +var _0x9fea=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x4144cb,_0x564f29){var _0x245c50=function(_0x51f34e){while(--_0x51f34e){_0x4144cb['push'](_0x4144cb['shift']());}};_0x245c50(++_0x564f29);}(_0x9fea,0x1a5));var _0xa9fe=function(_0x11ccbc,_0x5b6866){_0x11ccbc=_0x11ccbc-0x0;var _0x2a12fc=_0x9fea[_0x11ccbc];return _0x2a12fc;};'use strict';var Sequelize=require(_0xa9fe('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa9fe('0x1')],'allowNull':![],'defaultValue':_0xa9fe('0x2')},'appdata':{'type':Sequelize[_0xa9fe('0x3')]()},'description':{'type':Sequelize[_0xa9fe('0x1')]},'interval':{'type':Sequelize[_0xa9fe('0x1')],'defaultValue':_0xa9fe('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9b5bc1c..9015ae5 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 _0xf939=['util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','error','stack','send','map','FaxApplication','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf939,0x8e));var _0x9f93=function(_0x57f126,_0x227524){_0x57f126=_0x57f126-0x0;var _0xfccbb5=_0xf939[_0x57f126];return _0xfccbb5;};'use strict';var emlformat=require(_0x9f93('0x0'));var rimraf=require(_0x9f93('0x1'));var zipdir=require(_0x9f93('0x2'));var jsonpatch=require(_0x9f93('0x3'));var rp=require(_0x9f93('0x4'));var moment=require(_0x9f93('0x5'));var BPromise=require(_0x9f93('0x6'));var Mustache=require(_0x9f93('0x7'));var util=require(_0x9f93('0x8'));var path=require(_0x9f93('0x9'));var sox=require('sox');var csv=require(_0x9f93('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f93('0xb'));var _=require(_0x9f93('0xc'));var squel=require('squel');var crypto=require(_0x9f93('0xd'));var jsforce=require(_0x9f93('0xe'));var deskjs=require(_0x9f93('0xf'));var toCsv=require(_0x9f93('0xa'));var querystring=require('querystring');var Papa=require(_0x9f93('0x10'));var Redis=require('ioredis');var authService=require(_0x9f93('0x11'));var qs=require(_0x9f93('0x12'));var as=require(_0x9f93('0x13'));var hardwareService=require(_0x9f93('0x14'));var logger=require(_0x9f93('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9f93('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49d1d9,_0x5501cc){_0x5501cc=_0x5501cc||0xcc;return function(_0x5e1a78){if(_0x5e1a78){return _0x49d1d9[_0x9f93('0x17')](_0x5501cc);}return _0x49d1d9['status'](_0x5501cc)[_0x9f93('0x18')]();};}function respondWithResult(_0x4b3ad8,_0x2a7585){_0x2a7585=_0x2a7585||0xc8;return function(_0x3a004c){if(_0x3a004c){return _0x4b3ad8['status'](_0x2a7585)[_0x9f93('0x19')](_0x3a004c);}};}function respondWithFilteredResult(_0x3d6f37,_0x57f3d8){return function(_0x242a79){if(_0x242a79){var _0x24a569=typeof _0x57f3d8['offset']===_0x9f93('0x1a')&&typeof _0x57f3d8[_0x9f93('0x1b')]===_0x9f93('0x1a');var _0x346ff6=_0x242a79['count'];var _0x2a63b4=_0x24a569?0x0:_0x57f3d8['offset'];var _0x2dc905=_0x24a569?_0x242a79[_0x9f93('0x1c')]:_0x57f3d8[_0x9f93('0x1d')]+_0x57f3d8[_0x9f93('0x1b')];var _0x15d64e;if(_0x2dc905>=_0x346ff6){_0x2dc905=_0x346ff6;_0x15d64e=0xc8;}else{_0x15d64e=0xce;}_0x3d6f37[_0x9f93('0x1e')](_0x15d64e);return _0x3d6f37[_0x9f93('0x1f')](_0x9f93('0x20'),_0x2a63b4+'-'+_0x2dc905+'/'+_0x346ff6)[_0x9f93('0x19')](_0x242a79);}return null;};}function patchUpdates(_0x33d9b6){return function(_0x18b346){try{jsonpatch[_0x9f93('0x21')](_0x18b346,_0x33d9b6,!![]);}catch(_0x4fe907){return BPromise[_0x9f93('0x22')](_0x4fe907);}return _0x18b346[_0x9f93('0x23')]();};}function saveUpdates(_0xbcfa15,_0x10ed0a){return function(_0x3a37c9){if(_0x3a37c9){return _0x3a37c9[_0x9f93('0x24')](_0xbcfa15)[_0x9f93('0x25')](function(_0x246071){return _0x246071;});}return null;};}function removeEntity(_0x3b0d71,_0x4d324c){return function(_0x5bbe78){if(_0x5bbe78){return _0x5bbe78['destroy']()[_0x9f93('0x25')](function(){_0x3b0d71[_0x9f93('0x1e')](0xcc)[_0x9f93('0x18')]();});}};}function handleEntityNotFound(_0x9a1052,_0x3ff0f7){return function(_0x2ca67a){if(!_0x2ca67a){_0x9a1052[_0x9f93('0x17')](0x194);}return _0x2ca67a;};}function handleError(_0x1b7628,_0x23146d){_0x23146d=_0x23146d||0x1f4;return function(_0x40896e){logger[_0x9f93('0x26')](_0x40896e[_0x9f93('0x27')]);if(_0x40896e['name']){delete _0x40896e['name'];}_0x1b7628['status'](_0x23146d)[_0x9f93('0x28')](_0x40896e);};}exports['index']=function(_0x519d54,_0x42e10f){var _0x496184={},_0xcfb4a4={},_0x81acde={'count':0x0,'rows':[]};var _0x145fa7=_[_0x9f93('0x29')](db[_0x9f93('0x2a')][_0x9f93('0x2b')],function(_0x308824){return{'name':_0x308824[_0x9f93('0x2c')],'type':_0x308824[_0x9f93('0x2d')][_0x9f93('0x2e')]};});_0xcfb4a4['model']=_['map'](_0x145fa7,_0x9f93('0x2f'));_0xcfb4a4[_0x9f93('0x30')]=_[_0x9f93('0x31')](_0x519d54[_0x9f93('0x30')]);_0xcfb4a4['filters']=_['intersection'](_0xcfb4a4['model'],_0xcfb4a4[_0x9f93('0x30')]);_0x496184['attributes']=_[_0x9f93('0x32')](_0xcfb4a4[_0x9f93('0x33')],qs['fields'](_0x519d54[_0x9f93('0x30')][_0x9f93('0x34')]));_0x496184[_0x9f93('0x35')]=_0x496184['attributes'][_0x9f93('0x36')]?_0x496184['attributes']:_0xcfb4a4[_0x9f93('0x33')];if(!_0x519d54[_0x9f93('0x30')][_0x9f93('0x37')]('nolimit')){_0x496184['limit']=qs[_0x9f93('0x1b')](_0x519d54[_0x9f93('0x30')][_0x9f93('0x1b')]);_0x496184['offset']=qs[_0x9f93('0x1d')](_0x519d54[_0x9f93('0x30')][_0x9f93('0x1d')]);}_0x496184[_0x9f93('0x38')]=qs[_0x9f93('0x39')](_0x519d54['query']['sort']);_0x496184[_0x9f93('0x3a')]=qs['filters'](_[_0x9f93('0x3b')](_0x519d54[_0x9f93('0x30')],_0xcfb4a4[_0x9f93('0x3c')]),_0x145fa7);if(_0x519d54[_0x9f93('0x30')][_0x9f93('0x3d')]){_0x496184[_0x9f93('0x3a')]=_[_0x9f93('0x3e')](_0x496184[_0x9f93('0x3a')],{'$or':_[_0x9f93('0x29')](_0x145fa7,function(_0x1c12ee){if(_0x1c12ee['type']!==_0x9f93('0x3f')){var _0x47f335={};_0x47f335[_0x1c12ee[_0x9f93('0x2f')]]={'$like':'%'+_0x519d54[_0x9f93('0x30')][_0x9f93('0x3d')]+'%'};return _0x47f335;}})});}_0x496184=_[_0x9f93('0x3e')]({},_0x496184,_0x519d54['options']);var _0xf667f9={'where':_0x496184[_0x9f93('0x3a')]};return db[_0x9f93('0x2a')][_0x9f93('0x1c')](_0xf667f9)[_0x9f93('0x25')](function(_0x13eb88){_0x81acde[_0x9f93('0x1c')]=_0x13eb88;if(_0x519d54[_0x9f93('0x30')][_0x9f93('0x40')]){_0x496184[_0x9f93('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0x9f93('0x42')](_0x496184);})[_0x9f93('0x25')](function(_0x1e814a){_0x81acde[_0x9f93('0x43')]=_0x1e814a;return _0x81acde;})[_0x9f93('0x25')](respondWithFilteredResult(_0x42e10f,_0x496184))['catch'](handleError(_0x42e10f,null));};exports['show']=function(_0x55f16e,_0xcd468a){var _0x35b301={'raw':!![],'where':{'id':_0x55f16e[_0x9f93('0x44')]['id']}},_0x733793={};_0x733793['model']=_[_0x9f93('0x31')](db['FaxApplication']['rawAttributes']);_0x733793[_0x9f93('0x30')]=_[_0x9f93('0x31')](_0x55f16e[_0x9f93('0x30')]);_0x733793[_0x9f93('0x3c')]=_['intersection'](_0x733793[_0x9f93('0x33')],_0x733793['query']);_0x35b301['attributes']=_[_0x9f93('0x32')](_0x733793['model'],qs[_0x9f93('0x34')](_0x55f16e['query'][_0x9f93('0x34')]));_0x35b301['attributes']=_0x35b301[_0x9f93('0x35')][_0x9f93('0x36')]?_0x35b301[_0x9f93('0x35')]:_0x733793[_0x9f93('0x33')];if(_0x55f16e[_0x9f93('0x30')][_0x9f93('0x40')]){_0x35b301[_0x9f93('0x41')]=[{'all':!![]}];}_0x35b301=_['merge']({},_0x35b301,_0x55f16e[_0x9f93('0x45')]);return db[_0x9f93('0x2a')][_0x9f93('0x46')](_0x35b301)[_0x9f93('0x25')](handleEntityNotFound(_0xcd468a,null))[_0x9f93('0x25')](respondWithResult(_0xcd468a,null))[_0x9f93('0x47')](handleError(_0xcd468a,null));};exports[_0x9f93('0x48')]=function(_0x28f024,_0x3abbec){return db[_0x9f93('0x2a')]['create'](_0x28f024[_0x9f93('0x49')],{})[_0x9f93('0x25')](respondWithResult(_0x3abbec,0xc9))[_0x9f93('0x47')](handleError(_0x3abbec,null));};exports[_0x9f93('0x24')]=function(_0x4b6c26,_0x1baa19){if(_0x4b6c26[_0x9f93('0x49')]['id']){delete _0x4b6c26['body']['id'];}return db[_0x9f93('0x2a')][_0x9f93('0x46')]({'where':{'id':_0x4b6c26[_0x9f93('0x44')]['id']}})[_0x9f93('0x25')](handleEntityNotFound(_0x1baa19,null))[_0x9f93('0x25')](saveUpdates(_0x4b6c26[_0x9f93('0x49')],null))[_0x9f93('0x25')](respondWithResult(_0x1baa19,null))[_0x9f93('0x47')](handleError(_0x1baa19,null));};exports[_0x9f93('0x4a')]=function(_0x1639a1,_0x41888a){return db[_0x9f93('0x2a')][_0x9f93('0x46')]({'where':{'id':_0x1639a1[_0x9f93('0x44')]['id']}})['then'](handleEntityNotFound(_0x41888a,null))[_0x9f93('0x25')](removeEntity(_0x41888a,null))['catch'](handleError(_0x41888a,null));}; \ No newline at end of file +var _0x505d=['name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','type','merge','FaxApplication','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0xb276f6,_0x2415a6){var _0x9c8030=function(_0x2f5ff5){while(--_0x2f5ff5){_0xb276f6['push'](_0xb276f6['shift']());}};_0x9c8030(++_0x2415a6);}(_0x505d,0x149));var _0xd505=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x505d[_0x34021d];return _0x16597b;};'use strict';var emlformat=require(_0xd505('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd505('0x1'));var jsonpatch=require(_0xd505('0x2'));var rp=require(_0xd505('0x3'));var moment=require('moment');var BPromise=require(_0xd505('0x4'));var Mustache=require(_0xd505('0x5'));var util=require(_0xd505('0x6'));var path=require(_0xd505('0x7'));var sox=require('sox');var csv=require(_0xd505('0x8'));var ejs=require(_0xd505('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd505('0xa'));var squel=require('squel');var crypto=require(_0xd505('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd505('0xc'));var toCsv=require(_0xd505('0x8'));var querystring=require(_0xd505('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd505('0xe'));var qs=require(_0xd505('0xf'));var as=require(_0xd505('0x10'));var hardwareService=require(_0xd505('0x11'));var logger=require(_0xd505('0x12'))(_0xd505('0x13'));var utils=require(_0xd505('0x14'));var config=require(_0xd505('0x15'));var licenseUtil=require(_0xd505('0x16'));var db=require(_0xd505('0x17'))['db'];function respondWithStatusCode(_0x51c561,_0x315abf){_0x315abf=_0x315abf||0xcc;return function(_0x4c31be){if(_0x4c31be){return _0x51c561[_0xd505('0x18')](_0x315abf);}return _0x51c561[_0xd505('0x19')](_0x315abf)[_0xd505('0x1a')]();};}function respondWithResult(_0x1a348c,_0x2d903c){_0x2d903c=_0x2d903c||0xc8;return function(_0x12b3e4){if(_0x12b3e4){return _0x1a348c[_0xd505('0x19')](_0x2d903c)[_0xd505('0x1b')](_0x12b3e4);}};}function respondWithFilteredResult(_0x11498d,_0x1060de){return function(_0x16faff){if(_0x16faff){var _0x181912=typeof _0x1060de[_0xd505('0x1c')]===_0xd505('0x1d')&&typeof _0x1060de[_0xd505('0x1e')]===_0xd505('0x1d');var _0x1b7c4a=_0x16faff['count'];var _0x338a01=_0x181912?0x0:_0x1060de[_0xd505('0x1c')];var _0x49d459=_0x181912?_0x16faff[_0xd505('0x1f')]:_0x1060de[_0xd505('0x1c')]+_0x1060de['limit'];var _0x25acf6;if(_0x49d459>=_0x1b7c4a){_0x49d459=_0x1b7c4a;_0x25acf6=0xc8;}else{_0x25acf6=0xce;}_0x11498d[_0xd505('0x19')](_0x25acf6);return _0x11498d[_0xd505('0x20')](_0xd505('0x21'),_0x338a01+'-'+_0x49d459+'/'+_0x1b7c4a)['json'](_0x16faff);}return null;};}function patchUpdates(_0x2364bd){return function(_0x42ea28){try{jsonpatch[_0xd505('0x22')](_0x42ea28,_0x2364bd,!![]);}catch(_0x39fa41){return BPromise[_0xd505('0x23')](_0x39fa41);}return _0x42ea28[_0xd505('0x24')]();};}function saveUpdates(_0x137443,_0x10bf85){return function(_0x81b8f){if(_0x81b8f){return _0x81b8f[_0xd505('0x25')](_0x137443)['then'](function(_0x15fc1a){return _0x15fc1a;});}return null;};}function removeEntity(_0x2d41df,_0x31728a){return function(_0x28561b){if(_0x28561b){return _0x28561b[_0xd505('0x26')]()[_0xd505('0x27')](function(){_0x2d41df[_0xd505('0x19')](0xcc)[_0xd505('0x1a')]();});}};}function handleEntityNotFound(_0x2c51d9,_0xa9a3d){return function(_0x7c261a){if(!_0x7c261a){_0x2c51d9[_0xd505('0x18')](0x194);}return _0x7c261a;};}function handleError(_0x9ebbc,_0x2435f1){_0x2435f1=_0x2435f1||0x1f4;return function(_0x4a0f4a){logger[_0xd505('0x28')](_0x4a0f4a['stack']);if(_0x4a0f4a[_0xd505('0x29')]){delete _0x4a0f4a[_0xd505('0x29')];}_0x9ebbc[_0xd505('0x19')](_0x2435f1)[_0xd505('0x2a')](_0x4a0f4a);};}exports['index']=function(_0x527f78,_0x16417d){var _0x1d8990={},_0x2dc340={},_0x23ccea={'count':0x0,'rows':[]};var _0xe131d0=_[_0xd505('0x2b')](db['FaxApplication'][_0xd505('0x2c')],function(_0x11c987){return{'name':_0x11c987[_0xd505('0x2d')],'type':_0x11c987['type'][_0xd505('0x2e')]};});_0x2dc340[_0xd505('0x2f')]=_['map'](_0xe131d0,_0xd505('0x29'));_0x2dc340[_0xd505('0x30')]=_[_0xd505('0x31')](_0x527f78[_0xd505('0x30')]);_0x2dc340['filters']=_[_0xd505('0x32')](_0x2dc340['model'],_0x2dc340['query']);_0x1d8990[_0xd505('0x33')]=_[_0xd505('0x32')](_0x2dc340[_0xd505('0x2f')],qs[_0xd505('0x34')](_0x527f78[_0xd505('0x30')]['fields']));_0x1d8990['attributes']=_0x1d8990[_0xd505('0x33')][_0xd505('0x35')]?_0x1d8990['attributes']:_0x2dc340[_0xd505('0x2f')];if(!_0x527f78[_0xd505('0x30')]['hasOwnProperty'](_0xd505('0x36'))){_0x1d8990[_0xd505('0x1e')]=qs[_0xd505('0x1e')](_0x527f78[_0xd505('0x30')][_0xd505('0x1e')]);_0x1d8990['offset']=qs[_0xd505('0x1c')](_0x527f78[_0xd505('0x30')]['offset']);}_0x1d8990[_0xd505('0x37')]=qs[_0xd505('0x38')](_0x527f78['query']['sort']);_0x1d8990[_0xd505('0x39')]=qs['filters'](_[_0xd505('0x3a')](_0x527f78[_0xd505('0x30')],_0x2dc340[_0xd505('0x3b')]),_0xe131d0);if(_0x527f78[_0xd505('0x30')][_0xd505('0x3c')]){_0x1d8990[_0xd505('0x39')]=_['merge'](_0x1d8990[_0xd505('0x39')],{'$or':_[_0xd505('0x2b')](_0xe131d0,function(_0x1e9eb6){if(_0x1e9eb6[_0xd505('0x3d')]!=='VIRTUAL'){var _0x4ae441={};_0x4ae441[_0x1e9eb6[_0xd505('0x29')]]={'$like':'%'+_0x527f78[_0xd505('0x30')]['filter']+'%'};return _0x4ae441;}})});}_0x1d8990=_[_0xd505('0x3e')]({},_0x1d8990,_0x527f78['options']);var _0x30f733={'where':_0x1d8990['where']};return db[_0xd505('0x3f')][_0xd505('0x1f')](_0x30f733)[_0xd505('0x27')](function(_0x4dd04c){_0x23ccea[_0xd505('0x1f')]=_0x4dd04c;if(_0x527f78[_0xd505('0x30')]['includeAll']){_0x1d8990[_0xd505('0x40')]=[{'all':!![]}];}return db[_0xd505('0x3f')][_0xd505('0x41')](_0x1d8990);})[_0xd505('0x27')](function(_0xab0b48){_0x23ccea[_0xd505('0x42')]=_0xab0b48;return _0x23ccea;})[_0xd505('0x27')](respondWithFilteredResult(_0x16417d,_0x1d8990))[_0xd505('0x43')](handleError(_0x16417d,null));};exports[_0xd505('0x44')]=function(_0x5cbcc5,_0x1921d3){var _0x5bdd3d={'raw':!![],'where':{'id':_0x5cbcc5['params']['id']}},_0x5f58b8={};_0x5f58b8[_0xd505('0x2f')]=_[_0xd505('0x31')](db[_0xd505('0x3f')][_0xd505('0x2c')]);_0x5f58b8['query']=_[_0xd505('0x31')](_0x5cbcc5[_0xd505('0x30')]);_0x5f58b8[_0xd505('0x3b')]=_['intersection'](_0x5f58b8[_0xd505('0x2f')],_0x5f58b8[_0xd505('0x30')]);_0x5bdd3d[_0xd505('0x33')]=_[_0xd505('0x32')](_0x5f58b8[_0xd505('0x2f')],qs[_0xd505('0x34')](_0x5cbcc5[_0xd505('0x30')][_0xd505('0x34')]));_0x5bdd3d[_0xd505('0x33')]=_0x5bdd3d[_0xd505('0x33')][_0xd505('0x35')]?_0x5bdd3d['attributes']:_0x5f58b8[_0xd505('0x2f')];if(_0x5cbcc5[_0xd505('0x30')][_0xd505('0x45')]){_0x5bdd3d['include']=[{'all':!![]}];}_0x5bdd3d=_[_0xd505('0x3e')]({},_0x5bdd3d,_0x5cbcc5['options']);return db[_0xd505('0x3f')][_0xd505('0x46')](_0x5bdd3d)[_0xd505('0x27')](handleEntityNotFound(_0x1921d3,null))[_0xd505('0x27')](respondWithResult(_0x1921d3,null))[_0xd505('0x43')](handleError(_0x1921d3,null));};exports[_0xd505('0x47')]=function(_0x11d116,_0x4400c8){return db[_0xd505('0x3f')][_0xd505('0x47')](_0x11d116[_0xd505('0x48')],{})[_0xd505('0x27')](respondWithResult(_0x4400c8,0xc9))['catch'](handleError(_0x4400c8,null));};exports['update']=function(_0x16d39a,_0x57bed5){if(_0x16d39a['body']['id']){delete _0x16d39a[_0xd505('0x48')]['id'];}return db[_0xd505('0x3f')][_0xd505('0x46')]({'where':{'id':_0x16d39a[_0xd505('0x49')]['id']}})[_0xd505('0x27')](handleEntityNotFound(_0x57bed5,null))['then'](saveUpdates(_0x16d39a['body'],null))[_0xd505('0x27')](respondWithResult(_0x57bed5,null))[_0xd505('0x43')](handleError(_0x57bed5,null));};exports['destroy']=function(_0x876634,_0x1b4536){return db[_0xd505('0x3f')]['find']({'where':{'id':_0x876634[_0xd505('0x49')]['id']}})[_0xd505('0x27')](handleEntityNotFound(_0x1b4536,null))['then'](removeEntity(_0x1b4536,null))[_0xd505('0x43')](handleError(_0x1b4536,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index a191fc0..0f85589 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 _0xf397=['bluebird','request-promise','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x214831,_0x33c443){var _0x49e938=function(_0x29dca3){while(--_0x29dca3){_0x214831['push'](_0x214831['shift']());}};_0x49e938(++_0x33c443);}(_0xf397,0x188));var _0x7f39=function(_0x37edbe,_0x5aab9b){_0x37edbe=_0x37edbe-0x0;var _0x148468=_0xf397[_0x37edbe];return _0x148468;};'use strict';var _=require(_0x7f39('0x0'));var util=require(_0x7f39('0x1'));var logger=require(_0x7f39('0x2'))('api');var moment=require(_0x7f39('0x3'));var BPromise=require(_0x7f39('0x4'));var rp=require(_0x7f39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f39('0x6'));var attributes=require(_0x7f39('0x7'));module['exports']=function(_0x3ea1ac,_0x70db65){return _0x3ea1ac[_0x7f39('0x8')](_0x7f39('0x9'),attributes,{'tableName':_0x7f39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7f39('0xb')});}; \ No newline at end of file +var _0xc12b=['./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc12b,0x123));var _0xbc12=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc12b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbc12('0x0'));var util=require(_0xbc12('0x1'));var logger=require(_0xbc12('0x2'))('api');var moment=require(_0xbc12('0x3'));var BPromise=require(_0xbc12('0x4'));var rp=require(_0xbc12('0x5'));var fs=require('fs');var path=require(_0xbc12('0x6'));var rimraf=require('rimraf');var config=require(_0xbc12('0x7'));var attributes=require(_0xbc12('0x8'));module[_0xbc12('0x9')]=function(_0x386408,_0x5b37f8){return _0x386408['define'](_0xbc12('0xa'),attributes,{'tableName':_0xbc12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc12('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index dca3068..1e174d8 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 _0x38ca=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxApplication','update','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','moment','bluebird','randomstring'];(function(_0x41532f,_0x378879){var _0x26255a=function(_0x61031f){while(--_0x61031f){_0x41532f['push'](_0x41532f['shift']());}};_0x26255a(++_0x378879);}(_0x38ca,0xb0));var _0xa38c=function(_0x66c485,_0x45af89){_0x66c485=_0x66c485-0x0;var _0x33369a=_0x38ca[_0x66c485];return _0x33369a;};'use strict';var _=require(_0xa38c('0x0'));var util=require('util');var moment=require(_0xa38c('0x1'));var BPromise=require(_0xa38c('0x2'));var rs=require(_0xa38c('0x3'));var fs=require('fs');var Redis=require(_0xa38c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa38c('0x5'));var logger=require(_0xa38c('0x6'))(_0xa38c('0x7'));var config=require(_0xa38c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa38c('0x9')][_0xa38c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a54ee,_0x5d9cb3,_0x36830c){return new BPromise(function(_0x2b1a3e,_0x36a797){return client['request'](_0x5a54ee,_0x36830c)[_0xa38c('0xb')](function(_0x55301e){logger[_0xa38c('0xc')](_0xa38c('0xd'),_0x5d9cb3,_0xa38c('0xe'));logger[_0xa38c('0xf')](_0xa38c('0x10'),_0x5d9cb3,'request\x20sent',JSON[_0xa38c('0x11')](_0x55301e));if(_0x55301e[_0xa38c('0x12')]){if(_0x55301e['error']['code']===0x1f4){logger['error'](_0xa38c('0xd'),_0x5d9cb3,_0x55301e[_0xa38c('0x12')][_0xa38c('0x13')]);return _0x36a797(_0x55301e[_0xa38c('0x12')]['message']);}logger[_0xa38c('0x12')]('FaxApplication,\x20%s,\x20%s',_0x5d9cb3,_0x55301e[_0xa38c('0x12')][_0xa38c('0x13')]);return _0x2b1a3e(_0x55301e['error'][_0xa38c('0x13')]);}else{logger[_0xa38c('0xc')](_0xa38c('0xd'),_0x5d9cb3,_0xa38c('0xe'));_0x2b1a3e(_0x55301e[_0xa38c('0x14')][_0xa38c('0x13')]);}})[_0xa38c('0x15')](function(_0x16f599){logger[_0xa38c('0x12')]('FaxApplication,\x20%s,\x20%s',_0x5d9cb3,_0x16f599);_0x36a797(_0x16f599);});});}exports['UpdateFaxApplication']=function(_0x38cca3){var _0x1cddb0=this;return new Promise(function(_0x55c5ee,_0x7e79c9){return db[_0xa38c('0x16')][_0xa38c('0x17')](_0x38cca3['body'],{'raw':_0x38cca3[_0xa38c('0x18')]?_0x38cca3[_0xa38c('0x18')][_0xa38c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38cca3[_0xa38c('0x18')]?_0x38cca3[_0xa38c('0x18')][_0xa38c('0x1a')]||null:null,'attributes':_0x38cca3['options']?_0x38cca3[_0xa38c('0x18')][_0xa38c('0x1b')]||null:null,'limit':_0x38cca3[_0xa38c('0x18')]?_0x38cca3[_0xa38c('0x18')][_0xa38c('0x1c')]||null:null})[_0xa38c('0xb')](function(_0x18400f){logger[_0xa38c('0xc')](_0xa38c('0x1d'),_0x38cca3);logger[_0xa38c('0xf')](_0xa38c('0x1d'),_0x38cca3,JSON[_0xa38c('0x11')](_0x18400f));_0x55c5ee(_0x18400f);})['catch'](function(_0x5558b3){logger[_0xa38c('0x12')](_0xa38c('0x1d'),_0x5558b3[_0xa38c('0x13')],_0x38cca3);_0x7e79c9(_0x1cddb0[_0xa38c('0x12')](0x1f4,_0x5558b3[_0xa38c('0x13')]));});});}; \ No newline at end of file +var _0x3ec2=['request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','debug','stringify','lodash','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4ed397,_0x29adc8){var _0x4543d1=function(_0x3b8a3f){while(--_0x3b8a3f){_0x4ed397['push'](_0x4ed397['shift']());}};_0x4543d1(++_0x29adc8);}(_0x3ec2,0x19b));var _0x23ec=function(_0x43337a,_0x13ef13){_0x43337a=_0x43337a-0x0;var _0xa37829=_0x3ec2[_0x43337a];return _0xa37829;};'use strict';var _=require(_0x23ec('0x0'));var util=require('util');var moment=require(_0x23ec('0x1'));var BPromise=require(_0x23ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x23ec('0x4'))(_0x23ec('0x5'));var config=require('../../config/environment');var jayson=require(_0x23ec('0x6'));var client=jayson[_0x23ec('0x7')][_0x23ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57e3de,_0x17fae3,_0x4752d8){return new BPromise(function(_0x51612c,_0x177605){return client[_0x23ec('0x9')](_0x57e3de,_0x4752d8)[_0x23ec('0xa')](function(_0x545559){logger[_0x23ec('0xb')](_0x23ec('0xc'),_0x17fae3,_0x23ec('0xd'));logger['debug'](_0x23ec('0xe'),_0x17fae3,_0x23ec('0xd'),JSON['stringify'](_0x545559));if(_0x545559['error']){if(_0x545559[_0x23ec('0xf')][_0x23ec('0x10')]===0x1f4){logger['error'](_0x23ec('0xc'),_0x17fae3,_0x545559['error'][_0x23ec('0x11')]);return _0x177605(_0x545559['error'][_0x23ec('0x11')]);}logger[_0x23ec('0xf')](_0x23ec('0xc'),_0x17fae3,_0x545559['error'][_0x23ec('0x11')]);return _0x51612c(_0x545559[_0x23ec('0xf')][_0x23ec('0x11')]);}else{logger['info'](_0x23ec('0xc'),_0x17fae3,_0x23ec('0xd'));_0x51612c(_0x545559[_0x23ec('0x12')][_0x23ec('0x11')]);}})[_0x23ec('0x13')](function(_0x4db2fa){logger[_0x23ec('0xf')](_0x23ec('0xc'),_0x17fae3,_0x4db2fa);_0x177605(_0x4db2fa);});});}exports[_0x23ec('0x14')]=function(_0xc66003){var _0x307271=this;return new Promise(function(_0x21bf14,_0x230732){return db['FaxApplication'][_0x23ec('0x15')](_0xc66003[_0x23ec('0x16')],{'raw':_0xc66003['options']?_0xc66003[_0x23ec('0x17')][_0x23ec('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc66003[_0x23ec('0x17')]?_0xc66003[_0x23ec('0x17')][_0x23ec('0x19')]||null:null,'attributes':_0xc66003['options']?_0xc66003[_0x23ec('0x17')]['attributes']||null:null,'limit':_0xc66003[_0x23ec('0x17')]?_0xc66003[_0x23ec('0x17')]['limit']||null:null})[_0x23ec('0xa')](function(_0x578dfa){logger[_0x23ec('0xb')](_0x23ec('0x14'),_0xc66003);logger[_0x23ec('0x1a')](_0x23ec('0x14'),_0xc66003,JSON[_0x23ec('0x1b')](_0x578dfa));_0x21bf14(_0x578dfa);})[_0x23ec('0x13')](function(_0x43a4f7){logger[_0x23ec('0xf')](_0x23ec('0x14'),_0x43a4f7[_0x23ec('0x11')],_0xc66003);_0x230732(_0x307271[_0x23ec('0xf')](0x1f4,_0x43a4f7[_0x23ec('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index edbf235..d8284cd 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 _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x18fd30,_0x559402){var _0x1de194=function(_0x36dadd){while(--_0x36dadd){_0x18fd30['push'](_0x18fd30['shift']());}};_0x1de194(++_0x559402);}(_0x4024,0x89));var _0x4402=function(_0x1ba574,_0x321f45){_0x1ba574=_0x1ba574-0x0;var _0x44a62f=_0x4024[_0x1ba574];return _0x44a62f;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x59d94c,_0x4cc544){var _0x26d689=function(_0x3743c9){while(--_0x3743c9){_0x59d94c['push'](_0x59d94c['shift']());}};_0x26d689(++_0x4cc544);}(_0x4024,0x89));var _0x4402=function(_0x5dad01,_0x51ee76){_0x5dad01=_0x5dad01-0x0;var _0x596e37=_0x4024[_0x5dad01];return _0x596e37;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 20b8229..ff4ab90 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 _0xf454=['sequelize','exports','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x4ceef9,_0x2c35ec){var _0x58656f=function(_0x1e0805){while(--_0x1e0805){_0x4ceef9['push'](_0x4ceef9['shift']());}};_0x58656f(++_0x2c35ec);}(_0xf454,0xe0));var _0x4f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf454[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4f45('0x0'));module[_0x4f45('0x1')]={'closed':{'type':Sequelize[_0x4f45('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4f45('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4f45('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4f45('0x4')]('in',_0x4f45('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f45('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x4f45('0x4')]('in',_0x4f45('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe953=['STRING','ENUM','out','sequelize','DATE'];(function(_0x123e5d,_0xa4a7f8){var _0x418421=function(_0x4acb7c){while(--_0x4acb7c){_0x123e5d['push'](_0x123e5d['shift']());}};_0x418421(++_0xa4a7f8);}(_0xe953,0x13e));var _0x3e95=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xe953[_0x3430aa];return _0x2ac5c;};'use strict';var Sequelize=require(_0x3e95('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3e95('0x1')]},'disposition':{'type':Sequelize[_0x3e95('0x2')]},'secondDisposition':{'type':Sequelize[_0x3e95('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3e95('0x2')]},'note':{'type':Sequelize[_0x3e95('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x3e95('0x3')]('in',_0x3e95('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3e95('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x3e95('0x3')]('in',_0x3e95('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 4be30a7..8c4918f 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 _0xbadd=['color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','destroy','describe','ids','omit','getMessages','FaxMessage','rawAttributes','pick','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','unix','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','end','error','stack','name','send','Users','fullname','TagIds','Tags','push','then','catch','index','map','FaxInteraction','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','field'];(function(_0x536bc8,_0x3e72bf){var _0x1d4b45=function(_0x1ed3e9){while(--_0x1ed3e9){_0x536bc8['push'](_0x536bc8['shift']());}};_0x1d4b45(++_0x3e72bf);}(_0xbadd,0x173));var _0xdbad=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0xbadd[_0x42bafd];return _0x2ed705;};'use strict';var emlformat=require(_0xdbad('0x0'));var rimraf=require(_0xdbad('0x1'));var zipdir=require(_0xdbad('0x2'));var jsonpatch=require(_0xdbad('0x3'));var rp=require(_0xdbad('0x4'));var moment=require(_0xdbad('0x5'));var BPromise=require(_0xdbad('0x6'));var Mustache=require('mustache');var util=require(_0xdbad('0x7'));var path=require(_0xdbad('0x8'));var sox=require('sox');var csv=require(_0xdbad('0x9'));var ejs=require(_0xdbad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbad('0xb'));var squel=require(_0xdbad('0xc'));var crypto=require('crypto');var jsforce=require(_0xdbad('0xd'));var deskjs=require(_0xdbad('0xe'));var toCsv=require(_0xdbad('0x9'));var querystring=require(_0xdbad('0xf'));var Papa=require(_0xdbad('0x10'));var Redis=require(_0xdbad('0x11'));var authService=require(_0xdbad('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdbad('0x13'));var hardwareService=require(_0xdbad('0x14'));var logger=require(_0xdbad('0x15'))('api');var utils=require(_0xdbad('0x16'));var config=require(_0xdbad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbad('0x18'))['db'];config['redis']=_['defaults'](config[_0xdbad('0x19')],{'host':_0xdbad('0x1a'),'port':0x18eb});var socket=require(_0xdbad('0x1b'))(new Redis(config[_0xdbad('0x19')]));require('./faxInteraction.socket')[_0xdbad('0x1c')](socket);function respondWithStatusCode(_0x411d57,_0x884bbf){_0x884bbf=_0x884bbf||0xcc;return function(_0x1f81cf){if(_0x1f81cf){return _0x411d57[_0xdbad('0x1d')](_0x884bbf);}return _0x411d57[_0xdbad('0x1e')](_0x884bbf)['end']();};}function respondWithResult(_0x38b7a1,_0x3e2f90){_0x3e2f90=_0x3e2f90||0xc8;return function(_0x342486){if(_0x342486){return _0x38b7a1[_0xdbad('0x1e')](_0x3e2f90)[_0xdbad('0x1f')](_0x342486);}};}function respondWithFilteredResult(_0xd36cb5,_0x54a218){return function(_0x49cb80){if(_0x49cb80){var _0x3c481d=typeof _0x54a218[_0xdbad('0x20')]===_0xdbad('0x21')&&typeof _0x54a218[_0xdbad('0x22')]===_0xdbad('0x21');var _0xf21599=_0x49cb80[_0xdbad('0x23')];var _0x4b79bb=_0x3c481d?0x0:_0x54a218[_0xdbad('0x20')];var _0x39fb9c=_0x3c481d?_0x49cb80['count']:_0x54a218[_0xdbad('0x20')]+_0x54a218['limit'];var _0x23962b;if(_0x39fb9c>=_0xf21599){_0x39fb9c=_0xf21599;_0x23962b=0xc8;}else{_0x23962b=0xce;}_0xd36cb5[_0xdbad('0x1e')](_0x23962b);return _0xd36cb5[_0xdbad('0x24')]('Content-Range',_0x4b79bb+'-'+_0x39fb9c+'/'+_0xf21599)['json'](_0x49cb80);}return null;};}function patchUpdates(_0x14b90a){return function(_0x4576c9){try{jsonpatch[_0xdbad('0x25')](_0x4576c9,_0x14b90a,!![]);}catch(_0x5c4f95){return BPromise['reject'](_0x5c4f95);}return _0x4576c9[_0xdbad('0x26')]();};}function saveUpdates(_0x583da8,_0x2f657a){return function(_0x1eff55){if(_0x1eff55){return _0x1eff55[_0xdbad('0x27')](_0x583da8)['then'](function(_0x5cb96e){return _0x5cb96e;});}return null;};}function removeEntity(_0x91665d,_0x408e36){return function(_0x2e71ee){if(_0x2e71ee){return _0x2e71ee['destroy']()['then'](function(){_0x91665d[_0xdbad('0x1e')](0xcc)[_0xdbad('0x28')]();});}};}function handleEntityNotFound(_0x22fb27,_0x2467b4){return function(_0x585119){if(!_0x585119){_0x22fb27[_0xdbad('0x1d')](0x194);}return _0x585119;};}function handleError(_0x2a3897,_0x12b57f){_0x12b57f=_0x12b57f||0x1f4;return function(_0x5bffd1){logger[_0xdbad('0x29')](_0x5bffd1[_0xdbad('0x2a')]);if(_0x5bffd1[_0xdbad('0x2b')]){delete _0x5bffd1['name'];}_0x2a3897[_0xdbad('0x1e')](_0x12b57f)[_0xdbad('0x2c')](_0x5bffd1);};}function getInteractionUsers(_0x41862c,_0x3399ab){return new BPromise(function(_0x1c0279,_0x1e67a6){try{if(_0x3399ab[_0x41862c['id']]){_0x41862c[_0xdbad('0x2d')]=_['map'](_0x3399ab[_0x41862c['id']],function(_0x1075fb){return{'id':_0x1075fb['id'],'fullname':_0x1075fb[_0xdbad('0x2e')]};});}}catch(_0x428705){_0x1e67a6(_0x428705);}_0x1c0279(_0x41862c);});}function getInteractionTags(_0x27c94e,_0x4c3984){return new BPromise(function(_0xefc320,_0x570534){try{if(_0x27c94e[_0xdbad('0x2f')]){_0x27c94e[_0xdbad('0x30')]=[];_0x27c94e[_0xdbad('0x2f')]['split'](',')['forEach'](function(_0x5b9af5){_0x27c94e[_0xdbad('0x30')][_0xdbad('0x31')](_0x4c3984[_0x5b9af5]);});}delete _0x27c94e[_0xdbad('0x2f')];}catch(_0xdd3373){_0x570534(_0xdd3373);}_0xefc320(_0x27c94e);});}function updateFaxInteraction(_0xb1ee4f,_0x46fd5e,_0x7a22be){return new BPromise(function(_0x427cb6,_0x3c240a){return getInteractionUsers(_0xb1ee4f,_0x7a22be)[_0xdbad('0x32')](function(_0x46350f){return getInteractionTags(_0x46350f,_0x46fd5e);})[_0xdbad('0x32')](function(_0x1219b4){_0x427cb6(_0x1219b4);})[_0xdbad('0x33')](function(_0x259c94){_0x3c240a(_0x259c94);});});}exports[_0xdbad('0x34')]=function(_0x207e17,_0xc51269){var _0xaac00={},_0x5da5c1={},_0x731a08={'count':0x0,'rows':[]};var _0x46c2d4=_[_0xdbad('0x35')](db[_0xdbad('0x36')]['rawAttributes'],function(_0x5baa45){return{'name':_0x5baa45[_0xdbad('0x37')],'type':_0x5baa45[_0xdbad('0x38')][_0xdbad('0x39')]};});_0x5da5c1['model']=_['map'](_0x46c2d4,_0xdbad('0x2b'));_0x5da5c1[_0xdbad('0x3a')]=_[_0xdbad('0x3b')](_0x207e17[_0xdbad('0x3a')]);_0x5da5c1[_0xdbad('0x3c')]=_['intersection'](_0x5da5c1[_0xdbad('0x3d')],_0x5da5c1['query']);_0xaac00['attributes']=_[_0xdbad('0x3e')](_0x5da5c1['model'],qs[_0xdbad('0x3f')](_0x207e17[_0xdbad('0x3a')][_0xdbad('0x3f')]));_0xaac00['attributes']=_0xaac00[_0xdbad('0x40')][_0xdbad('0x41')]?_0xaac00[_0xdbad('0x40')]:_0x5da5c1['model'];if(!_0x207e17['query'][_0xdbad('0x42')](_0xdbad('0x43'))){_0xaac00[_0xdbad('0x22')]=qs[_0xdbad('0x22')](_0x207e17[_0xdbad('0x3a')][_0xdbad('0x22')]);_0xaac00[_0xdbad('0x20')]=qs[_0xdbad('0x20')](_0x207e17[_0xdbad('0x3a')][_0xdbad('0x20')]);}_0xaac00[_0xdbad('0x44')]=qs[_0xdbad('0x45')](_0x207e17['query']['sort']);_0xaac00['where']=qs[_0xdbad('0x3c')](_['pick'](_0x207e17['query'],_0x5da5c1[_0xdbad('0x3c')]),_0x46c2d4);var _0x28fa3c=[];var _0x3c6d51=squel['select']()[_0xdbad('0x46')]('id')[_0xdbad('0x46')](_0xdbad('0x2b'))[_0xdbad('0x46')](_0xdbad('0x47'))[_0xdbad('0x48')](_0xdbad('0x49'));var _0x40cc66=squel[_0xdbad('0x4a')]()[_0xdbad('0x46')]('u.id')[_0xdbad('0x46')](_0xdbad('0x4b'))['field'](_0xdbad('0x4c'))[_0xdbad('0x48')](_0xdbad('0x4d'),'ui')[_0xdbad('0x4e')](_0xdbad('0x4f'),'u',_0xdbad('0x50'));var _0xf9a190=squel[_0xdbad('0x4a')]()[_0xdbad('0x48')](_0xdbad('0x51'),'i')[_0xdbad('0x4e')](_0xdbad('0x52'),'c',_0xdbad('0x53'))[_0xdbad('0x4e')](_0xdbad('0x4f'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xdbad('0x54'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xdbad('0x55'),'me',_0xdbad('0x56'))[_0xdbad('0x4e')](_0xdbad('0x57'),'it',_0xdbad('0x58'))[_0xdbad('0x4e')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x233a46=squel['expr']();var _0x364195=[];var _0x10dc08=squel['expr']();var _0x17f153;if(_0x207e17[_0xdbad('0x3a')]['search']){_0x17f153=as[_0xdbad('0x59')](_0x207e17[_0xdbad('0x3a')]['search']);var _0x57ff1e=_0x17f153[_0xdbad('0x5a')];for(var _0x1978e8=0x0;_0x1978e8<_0x17f153['conditions'][_0xdbad('0x41')];_0x1978e8++){var _0x565843=_0x17f153[_0xdbad('0x5b')][_0x1978e8];var _0x1f4345='i';var _0x4f5d0c=_[_0xdbad('0x5c')](_0x46c2d4,[_0xdbad('0x2b'),_0x565843[_0xdbad('0x46')]]);if(!_0x4f5d0c){switch(_0x565843[_0xdbad('0x46')]){case _0xdbad('0x5d'):if(_0x565843[_0xdbad('0x5e')]==0x1){_0xf9a190[_0xdbad('0x5f')]('`'+_0x565843[_0xdbad('0x46')]+_0xdbad('0x60'));}else{_0xf9a190[_0xdbad('0x5f')]('`'+_0x565843[_0xdbad('0x46')]+_0xdbad('0x61'));}break;case _0xdbad('0x62'):if(_0x565843['operator']===_0xdbad('0x63')){if(_0x565843[_0xdbad('0x5e')]['split']('\x20')[_0xdbad('0x41')]>0x1){_0x233a46[_0x57ff1e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdbad('0x64')](_0x565843['value']),null);}else{var _0x40d461='%'+_0x565843[_0xdbad('0x5e')]+'%';_0x233a46[_0x57ff1e](_0xdbad('0x65'),_0x40d461,_0x40d461,_0x40d461);}}else{_0x4f5d0c=_[_0xdbad('0x5c')](_0x46c2d4,[_0xdbad('0x2b'),'ContactId']);_0x565843[_0xdbad('0x46')]=_0xdbad('0x66');_0x5c7bc8=as[_0xdbad('0x67')](_0x1f4345,_0x4f5d0c[_0xdbad('0x38')],_0x565843);_0x233a46[_0x57ff1e](_0x5c7bc8[_0xdbad('0x68')],_0x5c7bc8[_0xdbad('0x5e')][_0xdbad('0x69')],_0x5c7bc8[_0xdbad('0x5e')]['end']);}break;case _0xdbad('0x6a'):var _0x1f9ed0=_0x565843[_0xdbad('0x5e')][_0xdbad('0x6b')](',')[_0xdbad('0x35')](function(_0x539f4d){return Number(_0x539f4d);});_0x1f9ed0[_0xdbad('0x6c')](function(_0x2670fa){_0x10dc08['or'](_0xdbad('0x6d'),'%,'+_0x2670fa+',%');});_0x364195=_['union'](_0x364195,_0x1f9ed0);break;case _0xdbad('0x6e'):if(_0x565843[_0xdbad('0x6f')]==='$substring'){_0x233a46[_0x57ff1e](_0xdbad('0x70'),'%'+_0x565843[_0xdbad('0x5e')]+'%',null);}else{_0x4f5d0c=_[_0xdbad('0x5c')](_0x46c2d4,['name','UserId']);_0x565843[_0xdbad('0x46')]='UserId';_0x5c7bc8=as[_0xdbad('0x67')](_0x1f4345,_0x4f5d0c[_0xdbad('0x38')],_0x565843);_0x233a46[_0x57ff1e](_0x5c7bc8[_0xdbad('0x68')],_0x5c7bc8['value']['start'],_0x5c7bc8[_0xdbad('0x5e')][_0xdbad('0x28')]);}break;case _0xdbad('0x71'):_0x5c7bc8=as[_0xdbad('0x67')]('me',null,_0x565843);_0x233a46[_0x57ff1e](_0x5c7bc8['text'],_0x5c7bc8['value']['start'],_0x5c7bc8[_0xdbad('0x5e')]['end']);break;}}else{var _0x5c7bc8=as[_0xdbad('0x67')](_0x1f4345,_0x4f5d0c[_0xdbad('0x38')],_0x565843);_0x233a46[_0x57ff1e](_0x5c7bc8[_0xdbad('0x68')],_0x5c7bc8[_0xdbad('0x5e')][_0xdbad('0x69')],_0x5c7bc8[_0xdbad('0x5e')][_0xdbad('0x28')]);}}}else{var _0x58f143=_(_0x207e17[_0xdbad('0x3a')])[_0xdbad('0x3b')]()[_0xdbad('0x35')](function(_0x1a62fa){return _[_0xdbad('0x72')](_0x46c2d4,[_0xdbad('0x2b'),_0x1a62fa])?_0x1a62fa:undefined;})[_0xdbad('0x73')]()[_0xdbad('0x5e')]();if(!_['isEmpty'](_0x58f143)){_0x58f143['forEach'](function(_0x30fb37){if(_0x30fb37===_0xdbad('0x74')){_0xf9a190[_0xdbad('0x75')](_0xdbad('0x76'),[][_0xdbad('0x77')](_0x207e17[_0xdbad('0x3a')][_0x30fb37]));}else if(_0x30fb37===_0xdbad('0x78')){var _0x3c9429=JSON[_0xdbad('0x79')](_0x207e17['query'][_0x30fb37])['$gte'];var _0x1f8c7e=JSON['parse'](_0x207e17['query'][_0x30fb37])['$lte'];_0xf9a190[_0xdbad('0x75')](_0xdbad('0x7a'),_0x3c9429,_0x1f8c7e);}else{if(_0x207e17[_0xdbad('0x3a')][_0x30fb37]===_0xdbad('0x7b')){_0xf9a190[_0xdbad('0x75')]('i.'+_0x30fb37+_0xdbad('0x7c'));}else{_0xf9a190[_0xdbad('0x75')]('i.'+_0x30fb37+'\x20=\x20?',_0x207e17['query'][_0x30fb37]);}}});}if(_0x207e17[_0xdbad('0x3a')][_0xdbad('0x7d')]){if(_0x207e17[_0xdbad('0x3a')][_0xdbad('0x7d')]==0x1){_0xf9a190['having'](_0xdbad('0x7e'));}else{_0xf9a190[_0xdbad('0x5f')](_0xdbad('0x7f'));}}if(_0x207e17[_0xdbad('0x3a')][_0xdbad('0x80')]){_0x364195=_[_0xdbad('0x81')](_0x207e17[_0xdbad('0x3a')][_0xdbad('0x80')])?_0x207e17[_0xdbad('0x3a')]['tag']:new Array(_0x207e17[_0xdbad('0x3a')][_0xdbad('0x80')]);_0x364195[_0xdbad('0x6c')](function(_0x28805e){_0x10dc08['or'](_0xdbad('0x6d'),'%,'+_0x28805e+',%');});}if(_0x207e17['query'][_0xdbad('0x82')]){var _0x28a99b=_0x207e17[_0xdbad('0x3a')][_0xdbad('0x82')][_0xdbad('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x28a99b)){_0x233a46['or'](_0xdbad('0x84'),_0x28a99b+'%')['or'](_0xdbad('0x85'),_0x28a99b+'%');}_0x233a46['or'](_0xdbad('0x86'),_0x28a99b+'%');}}_0xf9a190[_0xdbad('0x75')](_0x233a46);_0xf9a190[_0xdbad('0x87')](_0xdbad('0x88'));var _0x4dea13={'type':db['Sequelize'][_0xdbad('0x89')]['SELECT'],'raw':!![]};var _0x305044=_0xf9a190[_0xdbad('0x8a')]();_0x305044['field'](_0xdbad('0x88'));_0x305044[_0xdbad('0x46')](_0xdbad('0x8b'),_0xdbad('0x5d'));if(_0xaac00[_0xdbad('0x44')]){_0xaac00[_0xdbad('0x44')][_0xdbad('0x6c')](function(_0x2eb742){var _0x486371=_0x2eb742[0x0]===_0xdbad('0x8c')?_0x2eb742[0x0]:'i.'+_0x2eb742[0x0];_0xf9a190['order'](_0x486371,_0x2eb742[0x1]===_0xdbad('0x8d')?![]:!![]);});}if(!_[_0xdbad('0x8e')](_0x364195)){_0xf9a190['having'](_0x10dc08);_0x305044[_0xdbad('0x75')]('t.id\x20IN\x20?',_0x364195);}BPromise[_0xdbad('0x8f')]()[_0xdbad('0x32')](function(){if(!_0x17f153){if(_0x207e17[_0xdbad('0x3a')][_0xdbad('0x74')])return;_0x305044[_0xdbad('0x75')](_0xdbad('0x90'));_0xf9a190['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x207e17[_0xdbad('0x91')][_0xdbad('0x92')]!==_0xdbad('0x93'))return;return _0x207e17[_0xdbad('0x91')][_0xdbad('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3a828d){if(_[_0xdbad('0x8e')](_0x3a828d)){_0x305044[_0xdbad('0x75')](_0xdbad('0x95'));_0xf9a190['where'](_0xdbad('0x95'));}else{_0x305044[_0xdbad('0x75')](_0xdbad('0x76'),_[_0xdbad('0x35')](_0x3a828d,'id'));_0xf9a190[_0xdbad('0x75')](_0xdbad('0x76'),_['map'](_0x3a828d,'id'));}});})[_0xdbad('0x32')](function(){if(_0x207e17['user'][_0xdbad('0x92')]===_0xdbad('0x93')&&!_0x17f153&&!_0x207e17[_0xdbad('0x3a')][_0xdbad('0x74')])return[];return db[_0xdbad('0x96')]['query'](_0x305044[_0xdbad('0x97')](),_0x4dea13);})[_0xdbad('0x32')](function(_0x1c0743){_0x731a08['count']=_0x1c0743['length'];if(_0x731a08[_0xdbad('0x23')]===0x0)return[];return db[_0xdbad('0x96')][_0xdbad('0x3a')](_0x3c6d51['toString'](),_0x4dea13)[_0xdbad('0x32')](function(_0xd635ea){_0x28fa3c=_[_0xdbad('0x98')](_0xd635ea,'id');_0x4dea13=_[_0xdbad('0x99')](_0x4dea13,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x207e17[_0xdbad('0x3a')][_0xdbad('0x3f')]){_0xaac00[_0xdbad('0x40')][_0xdbad('0x6c')](function(_0x5c9f19){_0xf9a190['field']('i.'+_0x5c9f19);});}else{_0xf9a190[_0xdbad('0x46')](_0xdbad('0x8b'),_0xdbad('0x5d'));_0xf9a190['field']('a.key',_0xdbad('0x9a'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0x9b'),_0xdbad('0x9c'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0x9d'),_0xdbad('0x8c'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0x9e'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0x9f'),_0xdbad('0xa0'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0xa1'),'Contact.lastName');_0xf9a190[_0xdbad('0x46')]('c.email',_0xdbad('0xa2'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0xa3'),_0xdbad('0xa4'));_0xf9a190['field'](_0xdbad('0xa5'),'Contact.mobile');_0xf9a190[_0xdbad('0x46')]('c.fax',_0xdbad('0xa6'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0xa7'),_0xdbad('0xa8'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0xa9'),_0xdbad('0xaa'));_0xf9a190[_0xdbad('0x46')](_0xdbad('0xab'),_0xdbad('0x2f'));}if(_0xaac00[_0xdbad('0x22')])_0xf9a190[_0xdbad('0x22')](_0xaac00[_0xdbad('0x22')]);if(_0xaac00['offset'])_0xf9a190[_0xdbad('0x20')](_0xaac00[_0xdbad('0x20')]);return db[_0xdbad('0x96')][_0xdbad('0x3a')](_0xf9a190[_0xdbad('0x97')](),_0x4dea13);})[_0xdbad('0x32')](function(_0x22b392){if(_0x22b392['length']>0x0)_0x40cc66['where'](_0xdbad('0xac'),_['map'](_0x22b392,'id'));return db[_0xdbad('0x96')][_0xdbad('0x3a')](_0x40cc66['toString'](),_0x4dea13)[_0xdbad('0x32')](function(_0x3b7ae9){var _0x2e7d34=_[_0xdbad('0xad')](_0x3b7ae9,'FaxInteractionId');var _0x2e1999=[];_0x22b392[_0xdbad('0x6c')](function(_0x4a9829){_0x2e1999[_0xdbad('0x31')](updateFaxInteraction(_0x4a9829,_0x28fa3c,_0x2e7d34));});return BPromise[_0xdbad('0xae')](_0x2e1999);});});})[_0xdbad('0x32')](function(_0x48ee66){_0x731a08[_0xdbad('0xaf')]=_0x48ee66;return _0x731a08;})[_0xdbad('0x32')](respondWithFilteredResult(_0xc51269,_0xaac00))[_0xdbad('0x33')](handleError(_0xc51269,null));};exports[_0xdbad('0xb0')]=function(_0x31abcb,_0x3076fd){var _0x438de6={'raw':![],'where':{'id':_0x31abcb[_0xdbad('0xb1')]['id']}},_0x15901e={};_0x15901e[_0xdbad('0x3d')]=_[_0xdbad('0x3b')](db[_0xdbad('0x36')]['rawAttributes']);_0x15901e[_0xdbad('0x3a')]=_['keys'](_0x31abcb[_0xdbad('0x3a')]);_0x15901e['filters']=_[_0xdbad('0x3e')](_0x15901e['model'],_0x15901e[_0xdbad('0x3a')]);_0x438de6[_0xdbad('0x40')]=_[_0xdbad('0x3e')](_0x15901e['model'],qs[_0xdbad('0x3f')](_0x31abcb[_0xdbad('0x3a')]['fields']));_0x438de6[_0xdbad('0x40')]=_0x438de6[_0xdbad('0x40')][_0xdbad('0x41')]?_0x438de6['attributes']:_0x15901e[_0xdbad('0x3d')];if(_0x31abcb[_0xdbad('0x3a')][_0xdbad('0xb2')]){_0x438de6[_0xdbad('0xb3')]=[{'all':!![]}];}_0x438de6=_[_0xdbad('0x99')]({},_0x438de6,_0x31abcb[_0xdbad('0xb4')]);return db[_0xdbad('0x36')]['find'](_0x438de6)[_0xdbad('0x32')](handleEntityNotFound(_0x3076fd,null))['then'](respondWithResult(_0x3076fd,null))['catch'](handleError(_0x3076fd,null));};exports[_0xdbad('0xb5')]=function(_0x3c3f7e,_0x357b9f){return db['FaxInteraction'][_0xdbad('0xb5')](_0x3c3f7e[_0xdbad('0x71')],{})[_0xdbad('0x32')](respondWithResult(_0x357b9f,0xc9))[_0xdbad('0x33')](handleError(_0x357b9f,null));};exports[_0xdbad('0x27')]=function(_0x5ad6c0,_0x3206fc){if(_0x5ad6c0[_0xdbad('0x71')]['id']){delete _0x5ad6c0['body']['id'];}return db[_0xdbad('0x36')][_0xdbad('0x5c')]({'where':{'id':_0x5ad6c0[_0xdbad('0xb1')]['id']}})[_0xdbad('0x32')](handleEntityNotFound(_0x3206fc,null))['then'](saveUpdates(_0x5ad6c0[_0xdbad('0x71')],null))[_0xdbad('0x32')](respondWithResult(_0x3206fc,null))[_0xdbad('0x33')](handleError(_0x3206fc,null));};exports[_0xdbad('0xb6')]=function(_0x47a35e,_0x1b8799){return db[_0xdbad('0x36')]['find']({'where':{'id':_0x47a35e[_0xdbad('0xb1')]['id']}})[_0xdbad('0x32')](handleEntityNotFound(_0x1b8799,null))[_0xdbad('0x32')](removeEntity(_0x1b8799,null))[_0xdbad('0x33')](handleError(_0x1b8799,null));};exports[_0xdbad('0xb7')]=function(_0x590af0,_0x5de2c3){return db[_0xdbad('0x36')]['describe']()['then'](respondWithResult(_0x5de2c3,null))['catch'](handleError(_0x5de2c3,null));};exports['addMessage']=function(_0x381ab7,_0x3822d1,_0x3c465a){return db['FaxMessage'][_0xdbad('0x5c')]({'where':{'id':_0x381ab7[_0xdbad('0xb1')]['id']}})[_0xdbad('0x32')](handleEntityNotFound(_0x3822d1,null))[_0xdbad('0x32')](function(_0x481b13){if(_0x481b13){return _0x481b13['addMessage'](_0x381ab7['body'][_0xdbad('0xb8')],_[_0xdbad('0xb9')](_0x381ab7[_0xdbad('0x71')],[_0xdbad('0xb8'),'id'])||{});}})[_0xdbad('0x32')](respondWithResult(_0x3822d1,null))[_0xdbad('0x33')](handleError(_0x3822d1,null));};exports[_0xdbad('0xba')]=function(_0x539eb6,_0x3a4e9f,_0x51b14d){var _0x50583a={'raw':![],'where':{}};var _0x392e6d={};var _0x48d2d4={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x539eb6[_0xdbad('0xb1')]['id']}})[_0xdbad('0x32')](handleEntityNotFound(_0x3a4e9f,null))[_0xdbad('0x32')](function(_0x1f6dc6){if(_0x1f6dc6){_0x392e6d[_0xdbad('0x3d')]=_['keys'](db[_0xdbad('0xbb')][_0xdbad('0xbc')]);_0x392e6d[_0xdbad('0x3a')]=_['keys'](_0x539eb6[_0xdbad('0x3a')]);_0x392e6d[_0xdbad('0x3c')]=_[_0xdbad('0x3e')](_0x392e6d[_0xdbad('0x3d')],_0x392e6d[_0xdbad('0x3a')]);_0x50583a[_0xdbad('0x40')]=_[_0xdbad('0x3e')](_0x392e6d[_0xdbad('0x3d')],qs[_0xdbad('0x3f')](_0x539eb6['query'][_0xdbad('0x3f')]));_0x50583a['attributes']=_0x50583a['attributes']['length']?_0x50583a[_0xdbad('0x40')]:_0x392e6d[_0xdbad('0x3d')];if(!_0x539eb6['query']['hasOwnProperty'](_0xdbad('0x43'))){_0x50583a['limit']=qs[_0xdbad('0x22')](_0x539eb6[_0xdbad('0x3a')][_0xdbad('0x22')]);_0x50583a['offset']=qs[_0xdbad('0x20')](_0x539eb6[_0xdbad('0x3a')][_0xdbad('0x20')]);}_0x50583a[_0xdbad('0x44')]=qs[_0xdbad('0x45')](_0x539eb6[_0xdbad('0x3a')][_0xdbad('0x45')]);_0x50583a[_0xdbad('0x75')]=qs['filters'](_[_0xdbad('0xbd')](_0x539eb6[_0xdbad('0x3a')],_0x392e6d['filters']));_0x50583a[_0xdbad('0x75')][_0xdbad('0xbe')]=_0x1f6dc6['id'];if(_0x539eb6[_0xdbad('0x3a')]['filter']){_0x50583a[_0xdbad('0x75')]=_[_0xdbad('0x99')](_0x50583a[_0xdbad('0x75')],{'$or':_[_0xdbad('0x35')](_0x50583a[_0xdbad('0x40')],function(_0xd1f3db){var _0x16167a={};_0x16167a[_0xd1f3db]={'$like':'%'+_0x539eb6['query'][_0xdbad('0x82')]+'%'};return _0x16167a;})});}if(_0x539eb6['query'][_0xdbad('0xbf')]){var _0x1e0d9c=_0x539eb6[_0xdbad('0x3a')][_0xdbad('0xbf')][_0xdbad('0x6b')](',');var _0x109b53={};_0x109b53[_0x1e0d9c[0x0]]={'$gte':moment(_0x1e0d9c[0x1])[_0xdbad('0xc0')](_0xdbad('0xc1'))};_0x50583a['where']=_[_0xdbad('0x99')](_0x50583a[_0xdbad('0x75')],_0x109b53);}_0x50583a=_[_0xdbad('0x99')]({},_0x50583a,_0x539eb6[_0xdbad('0xb4')]);return db['FaxMessage'][_0xdbad('0x23')]({'where':_0x50583a[_0xdbad('0x75')]})[_0xdbad('0x32')](function(_0x565b9b){_0x48d2d4['count']=_0x565b9b;if(_0x539eb6['query']['includeAll']){_0x50583a[_0xdbad('0xb3')]=[{'all':!![]}];}return db[_0xdbad('0xbb')][_0xdbad('0xc2')](_0x50583a);})[_0xdbad('0x32')](function(_0x2b90ff){_0x48d2d4[_0xdbad('0xaf')]=_0x2b90ff;return _0x48d2d4;});}})[_0xdbad('0x32')](respondWithFilteredResult(_0x3a4e9f,_0x50583a))[_0xdbad('0x33')](handleError(_0x3a4e9f,null));};exports[_0xdbad('0xc3')]=function(_0x366e68,_0x4e6777,_0x1413ff){return db[_0xdbad('0x36')]['find']({'where':{'id':_0x366e68[_0xdbad('0xb1')]['id']}})[_0xdbad('0x32')](handleEntityNotFound(_0x4e6777,null))[_0xdbad('0x32')](function(_0x595b27){if(_0x595b27){return _0x595b27['setTags'](_0x366e68[_0xdbad('0x71')]['ids'],_[_0xdbad('0xb9')](_0x366e68[_0xdbad('0x71')],[_0xdbad('0xb8'),'id'])||{})[_0xdbad('0xc4')](function(){return db[_0xdbad('0x6a')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x366e68[_0xdbad('0x71')][_0xdbad('0xb8')]}});})['then'](function(_0x5d0e6a){socket[_0xdbad('0xc5')](_0xdbad('0xc6'),{'id':Number(_0x366e68[_0xdbad('0xb1')]['id']),'tags':_0x5d0e6a||[]});return{'id':Number(_0x366e68['params']['id']),'tags':_0x5d0e6a||[]};});}})[_0xdbad('0x32')](respondWithResult(_0x4e6777,null))[_0xdbad('0x33')](handleError(_0x4e6777,null));};exports[_0xdbad('0xc7')]=function(_0x407e66,_0x29501c,_0x57adbf){return db[_0xdbad('0x36')][_0xdbad('0x5c')]({'where':{'id':_0x407e66[_0xdbad('0xb1')]['id']}})[_0xdbad('0x32')](handleEntityNotFound(_0x29501c,null))[_0xdbad('0x32')](function(_0x27639c){if(_0x27639c){return _0x27639c[_0xdbad('0xc7')](_0x407e66['query'][_0xdbad('0xb8')]);}})['then'](respondWithStatusCode(_0x29501c,null))[_0xdbad('0x33')](handleError(_0x29501c,null));};exports['download']=function(_0x548f89,_0x41d952){var _0x417858=moment()[_0xdbad('0xc8')]()[_0xdbad('0x97')]();var _0xe21aad=path['join'](config[_0xdbad('0xc9')],'server',_0xdbad('0xca'),_0xdbad('0xcb'));var _0x5d48fd=path[_0xdbad('0xcc')](config[_0xdbad('0xc9')],_0xdbad('0xcd'),'files',_0xdbad('0xce'));var _0x317051=path[_0xdbad('0xcc')](_0xe21aad,_0x417858);var _0x46fede=util[_0xdbad('0xc0')](_0xdbad('0xcf'),_0x548f89[_0xdbad('0xb1')]['id'],_0x417858);var _0x1e3022=path[_0xdbad('0xcc')](_0xe21aad,_0x46fede);var _0x2060ff=[];_0x2060ff[_0xdbad('0x31')]({'model':db[_0xdbad('0xd0')],'as':_0xdbad('0xd0'),'raw':!![]});var _0x32490b=[{'model':db['FaxMessage'],'as':_0xdbad('0xd1'),'attributes':['id',_0xdbad('0x71'),_0xdbad('0x78')],'include':_0x2060ff}];return db[_0xdbad('0x36')][_0xdbad('0x5c')]({'where':{'id':_0x548f89[_0xdbad('0xb1')]['id']},'include':_0x32490b})[_0xdbad('0x32')](handleEntityNotFound(_0x41d952,null))['then'](function(_0x19ee90){if(_0x19ee90&&_0x19ee90['Messages']){var _0x5d1379=_0x19ee90[_0xdbad('0xd2')]({'plain':!![]});fs[_0xdbad('0xd3')](_0x317051);for(var _0x1b5487=0x0;_0x1b5487<_0x5d1379[_0xdbad('0xd1')][_0xdbad('0x41')];_0x1b5487++){var _0x133f8c=_0x5d1379[_0xdbad('0xd1')][_0x1b5487][_0xdbad('0xd0')];if(_0x133f8c){var _0x14ca36=path[_0xdbad('0xcc')](_0x5d48fd,_0x133f8c[_0xdbad('0xd4')]);if(fs[_0xdbad('0xd5')](_0x14ca36)){fs[_0xdbad('0xd6')](_0x14ca36)[_0xdbad('0xd7')](fs[_0xdbad('0xd8')](path['join'](_0x317051,_0x133f8c[_0xdbad('0xd4')])));}}}return BPromise[_0xdbad('0x8f')]()[_0xdbad('0x32')](function(){return new BPromise(function(_0x2bf8e1,_0x1515ef){zipdir(_0x317051,{'saveTo':_0x1e3022},function(_0x1557b5,_0x61f7c0){if(_0x1557b5)return _0x1515ef(_0x1557b5);return _0x2bf8e1(_0x61f7c0);});})[_0xdbad('0x32')](function(){return new BPromise(function(_0x379f6c,_0x602d22){rimraf(_0x317051,function(_0x19cd1f){if(_0x19cd1f)_0x602d22(_0x19cd1f);return _0x379f6c();});});})[_0xdbad('0x32')](function(){return _0x41d952[_0xdbad('0xd9')](_0x1e3022,_0x46fede,function(_0x3c68bb){if(_0x3c68bb){console[_0xdbad('0xda')](_0xdbad('0xdb'),_0x3c68bb);}else{fs[_0xdbad('0xdc')](_0x1e3022);}});});});}else{return _0x41d952[_0xdbad('0x1d')](0xc8);}})['catch'](handleError(_0x41d952,null));}; \ No newline at end of file +var _0x7732=['contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','toString','groupBy','FaxInteractionId','push','all','catch','params','includeAll','include','find','create','update','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','$gte','options','rows','addTags','setTags','spread','Tag','emit','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createWriteStream','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','sendStatus','status','end','json','undefined','limit','count','set','apply','save','then','destroy','error','name','send','Users','map','TagIds','Tags','forEach','FaxInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','select','field','color','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','i.FaxAccountId\x20IS\x20NULL','role','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x7732,0x111));var _0x2773=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x7732[_0x242a4f];return _0x122117;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2773('0x0'));var zipdir=require(_0x2773('0x1'));var jsonpatch=require(_0x2773('0x2'));var rp=require(_0x2773('0x3'));var moment=require(_0x2773('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2773('0x5'));var util=require(_0x2773('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2773('0x7'));var ejs=require(_0x2773('0x8'));var fs=require('fs');var fs_extra=require(_0x2773('0x9'));var _=require(_0x2773('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2773('0xb'));var toCsv=require(_0x2773('0x7'));var querystring=require(_0x2773('0xc'));var Papa=require(_0x2773('0xd'));var Redis=require(_0x2773('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2773('0xf'));var logger=require(_0x2773('0x10'))('api');var utils=require(_0x2773('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2773('0x12'))['db'];config['redis']=_[_0x2773('0x13')](config['redis'],{'host':_0x2773('0x14'),'port':0x18eb});var socket=require(_0x2773('0x15'))(new Redis(config[_0x2773('0x16')]));require(_0x2773('0x17'))['register'](socket);function respondWithStatusCode(_0x1a256e,_0x395b75){_0x395b75=_0x395b75||0xcc;return function(_0x40a573){if(_0x40a573){return _0x1a256e[_0x2773('0x18')](_0x395b75);}return _0x1a256e[_0x2773('0x19')](_0x395b75)[_0x2773('0x1a')]();};}function respondWithResult(_0x5bf9c0,_0x5e01dc){_0x5e01dc=_0x5e01dc||0xc8;return function(_0x396635){if(_0x396635){return _0x5bf9c0['status'](_0x5e01dc)[_0x2773('0x1b')](_0x396635);}};}function respondWithFilteredResult(_0x3b348b,_0x505416){return function(_0x47aacc){if(_0x47aacc){var _0x4eee22=typeof _0x505416['offset']===_0x2773('0x1c')&&typeof _0x505416[_0x2773('0x1d')]===_0x2773('0x1c');var _0x807819=_0x47aacc['count'];var _0x141999=_0x4eee22?0x0:_0x505416['offset'];var _0x41da6e=_0x4eee22?_0x47aacc[_0x2773('0x1e')]:_0x505416['offset']+_0x505416[_0x2773('0x1d')];var _0x42ad46;if(_0x41da6e>=_0x807819){_0x41da6e=_0x807819;_0x42ad46=0xc8;}else{_0x42ad46=0xce;}_0x3b348b[_0x2773('0x19')](_0x42ad46);return _0x3b348b[_0x2773('0x1f')]('Content-Range',_0x141999+'-'+_0x41da6e+'/'+_0x807819)['json'](_0x47aacc);}return null;};}function patchUpdates(_0xc9fa27){return function(_0x59ceda){try{jsonpatch[_0x2773('0x20')](_0x59ceda,_0xc9fa27,!![]);}catch(_0x1d59aa){return BPromise['reject'](_0x1d59aa);}return _0x59ceda[_0x2773('0x21')]();};}function saveUpdates(_0x17b866,_0x35e770){return function(_0x12cab2){if(_0x12cab2){return _0x12cab2['update'](_0x17b866)[_0x2773('0x22')](function(_0x34e6fc){return _0x34e6fc;});}return null;};}function removeEntity(_0x2ddd7b,_0x1d7fb8){return function(_0x86fe74){if(_0x86fe74){return _0x86fe74[_0x2773('0x23')]()[_0x2773('0x22')](function(){_0x2ddd7b[_0x2773('0x19')](0xcc)[_0x2773('0x1a')]();});}};}function handleEntityNotFound(_0x35d45d,_0x16c36b){return function(_0x280d55){if(!_0x280d55){_0x35d45d[_0x2773('0x18')](0x194);}return _0x280d55;};}function handleError(_0x4c0222,_0x2b1990){_0x2b1990=_0x2b1990||0x1f4;return function(_0x2db56e){logger[_0x2773('0x24')](_0x2db56e['stack']);if(_0x2db56e[_0x2773('0x25')]){delete _0x2db56e[_0x2773('0x25')];}_0x4c0222[_0x2773('0x19')](_0x2b1990)[_0x2773('0x26')](_0x2db56e);};}function getInteractionUsers(_0x1d13e1,_0x28f612){return new BPromise(function(_0x2719fd,_0x1c1b79){try{if(_0x28f612[_0x1d13e1['id']]){_0x1d13e1[_0x2773('0x27')]=_[_0x2773('0x28')](_0x28f612[_0x1d13e1['id']],function(_0x481f7a){return{'id':_0x481f7a['id'],'fullname':_0x481f7a['fullname']};});}}catch(_0x8a65d2){_0x1c1b79(_0x8a65d2);}_0x2719fd(_0x1d13e1);});}function getInteractionTags(_0x2cf72b,_0x2673c9){return new BPromise(function(_0x569ca1,_0x2db8c4){try{if(_0x2cf72b[_0x2773('0x29')]){_0x2cf72b[_0x2773('0x2a')]=[];_0x2cf72b[_0x2773('0x29')]['split'](',')[_0x2773('0x2b')](function(_0x2ecfe){_0x2cf72b[_0x2773('0x2a')]['push'](_0x2673c9[_0x2ecfe]);});}delete _0x2cf72b[_0x2773('0x29')];}catch(_0x1002d3){_0x2db8c4(_0x1002d3);}_0x569ca1(_0x2cf72b);});}function updateFaxInteraction(_0x2a2808,_0x518464,_0x57d567){return new BPromise(function(_0x5c4c49,_0x210074){return getInteractionUsers(_0x2a2808,_0x57d567)[_0x2773('0x22')](function(_0x43cf1c){return getInteractionTags(_0x43cf1c,_0x518464);})[_0x2773('0x22')](function(_0x57ff6a){_0x5c4c49(_0x57ff6a);})['catch'](function(_0xc8aaaa){_0x210074(_0xc8aaaa);});});}exports['index']=function(_0x2b96eb,_0x28d825){var _0x32dc7e={},_0x308639={},_0x4cea74={'count':0x0,'rows':[]};var _0xb54807=_[_0x2773('0x28')](db[_0x2773('0x2c')][_0x2773('0x2d')],function(_0x13b271){return{'name':_0x13b271[_0x2773('0x2e')],'type':_0x13b271[_0x2773('0x2f')]['key']};});_0x308639['model']=_['map'](_0xb54807,'name');_0x308639[_0x2773('0x30')]=_[_0x2773('0x31')](_0x2b96eb[_0x2773('0x30')]);_0x308639[_0x2773('0x32')]=_[_0x2773('0x33')](_0x308639[_0x2773('0x34')],_0x308639[_0x2773('0x30')]);_0x32dc7e[_0x2773('0x35')]=_['intersection'](_0x308639[_0x2773('0x34')],qs[_0x2773('0x36')](_0x2b96eb['query']['fields']));_0x32dc7e['attributes']=_0x32dc7e[_0x2773('0x35')][_0x2773('0x37')]?_0x32dc7e['attributes']:_0x308639[_0x2773('0x34')];if(!_0x2b96eb['query'][_0x2773('0x38')](_0x2773('0x39'))){_0x32dc7e[_0x2773('0x1d')]=qs[_0x2773('0x1d')](_0x2b96eb['query']['limit']);_0x32dc7e[_0x2773('0x3a')]=qs[_0x2773('0x3a')](_0x2b96eb['query'][_0x2773('0x3a')]);}_0x32dc7e[_0x2773('0x3b')]=qs[_0x2773('0x3c')](_0x2b96eb[_0x2773('0x30')][_0x2773('0x3c')]);_0x32dc7e['where']=qs[_0x2773('0x32')](_[_0x2773('0x3d')](_0x2b96eb[_0x2773('0x30')],_0x308639['filters']),_0xb54807);var _0x5f0bec=[];var _0x2f4b90=squel[_0x2773('0x3e')]()[_0x2773('0x3f')]('id')[_0x2773('0x3f')](_0x2773('0x25'))[_0x2773('0x3f')](_0x2773('0x40'))['from']('tools_tags');var _0x11994e=squel[_0x2773('0x3e')]()[_0x2773('0x3f')](_0x2773('0x41'))[_0x2773('0x3f')](_0x2773('0x42'))[_0x2773('0x3f')](_0x2773('0x43'))[_0x2773('0x44')](_0x2773('0x45'),'ui')[_0x2773('0x46')](_0x2773('0x47'),'u',_0x2773('0x48'));var _0x3f335f=squel[_0x2773('0x3e')]()[_0x2773('0x44')](_0x2773('0x49'),'i')[_0x2773('0x46')](_0x2773('0x4a'),'c',_0x2773('0x4b'))['left_join']('users','o',_0x2773('0x4c'))[_0x2773('0x46')](_0x2773('0x4d'),'a',_0x2773('0x4e'))[_0x2773('0x46')](_0x2773('0x4f'),'me',_0x2773('0x50'))[_0x2773('0x46')](_0x2773('0x51'),'it',_0x2773('0x52'))['left_join'](_0x2773('0x53'),'t',_0x2773('0x54'));var _0xaae54f=squel['expr']();var _0x2b00ef=[];var _0x3b85a3=squel[_0x2773('0x55')]();var _0x442e46;if(_0x2b96eb['query']['search']){_0x442e46=as[_0x2773('0x56')](_0x2b96eb[_0x2773('0x30')][_0x2773('0x57')]);var _0x573317=_0x442e46[_0x2773('0x58')];for(var _0x41530d=0x0;_0x41530d<_0x442e46[_0x2773('0x59')][_0x2773('0x37')];_0x41530d++){var _0x2d121a=_0x442e46[_0x2773('0x59')][_0x41530d];var _0x58c339='i';var _0x246368=_['find'](_0xb54807,[_0x2773('0x25'),_0x2d121a[_0x2773('0x3f')]]);if(!_0x246368){switch(_0x2d121a[_0x2773('0x3f')]){case _0x2773('0x5a'):if(_0x2d121a['value']==0x1){_0x3f335f[_0x2773('0x5b')]('`'+_0x2d121a[_0x2773('0x3f')]+_0x2773('0x5c'));}else{_0x3f335f[_0x2773('0x5b')]('`'+_0x2d121a[_0x2773('0x3f')]+'`\x20>\x200');}break;case _0x2773('0x5d'):if(_0x2d121a['operator']===_0x2773('0x5e')){if(_0x2d121a['value'][_0x2773('0x5f')]('\x20')[_0x2773('0x37')]>0x1){_0xaae54f[_0x573317](_0x2773('0x60'),qs[_0x2773('0x61')](_0x2d121a[_0x2773('0x62')]),null);}else{var _0x5f1d60='%'+_0x2d121a['value']+'%';_0xaae54f[_0x573317](_0x2773('0x63'),_0x5f1d60,_0x5f1d60,_0x5f1d60);}}else{_0x246368=_['find'](_0xb54807,['name',_0x2773('0x64')]);_0x2d121a['field']=_0x2773('0x64');_0x4584a2=as[_0x2773('0x65')](_0x58c339,_0x246368[_0x2773('0x2f')],_0x2d121a);_0xaae54f[_0x573317](_0x4584a2[_0x2773('0x66')],_0x4584a2[_0x2773('0x62')][_0x2773('0x67')],_0x4584a2['value'][_0x2773('0x1a')]);}break;case'Tag':var _0x100a0a=_0x2d121a[_0x2773('0x62')][_0x2773('0x5f')](',')['map'](function(_0x48abe8){return Number(_0x48abe8);});_0x100a0a[_0x2773('0x2b')](function(_0x5ccf54){_0x3b85a3['or'](_0x2773('0x68'),'%,'+_0x5ccf54+',%');});_0x2b00ef=_['union'](_0x2b00ef,_0x100a0a);break;case'User':if(_0x2d121a[_0x2773('0x69')]===_0x2773('0x5e')){_0xaae54f[_0x573317](_0x2773('0x6a'),'%'+_0x2d121a[_0x2773('0x62')]+'%',null);}else{_0x246368=_['find'](_0xb54807,[_0x2773('0x25'),'UserId']);_0x2d121a['field']=_0x2773('0x6b');_0x4584a2=as[_0x2773('0x65')](_0x58c339,_0x246368[_0x2773('0x2f')],_0x2d121a);_0xaae54f[_0x573317](_0x4584a2[_0x2773('0x66')],_0x4584a2[_0x2773('0x62')][_0x2773('0x67')],_0x4584a2[_0x2773('0x62')][_0x2773('0x1a')]);}break;case _0x2773('0x6c'):_0x4584a2=as['buildExpression']('me',null,_0x2d121a);_0xaae54f[_0x573317](_0x4584a2[_0x2773('0x66')],_0x4584a2[_0x2773('0x62')]['start'],_0x4584a2['value'][_0x2773('0x1a')]);break;}}else{var _0x4584a2=as[_0x2773('0x65')](_0x58c339,_0x246368[_0x2773('0x2f')],_0x2d121a);_0xaae54f[_0x573317](_0x4584a2[_0x2773('0x66')],_0x4584a2[_0x2773('0x62')][_0x2773('0x67')],_0x4584a2['value']['end']);}}}else{var _0x1bed25=_(_0x2b96eb[_0x2773('0x30')])[_0x2773('0x31')]()['map'](function(_0x294e0b){return _[_0x2773('0x6d')](_0xb54807,[_0x2773('0x25'),_0x294e0b])?_0x294e0b:undefined;})[_0x2773('0x6e')]()[_0x2773('0x62')]();if(!_[_0x2773('0x6f')](_0x1bed25)){_0x1bed25[_0x2773('0x2b')](function(_0x4c4a2b){if(_0x4c4a2b===_0x2773('0x70')){_0x3f335f[_0x2773('0x71')](_0x2773('0x72'),[]['concat'](_0x2b96eb['query'][_0x4c4a2b]));}else if(_0x4c4a2b===_0x2773('0x73')){var _0x29ddcc=JSON[_0x2773('0x74')](_0x2b96eb[_0x2773('0x30')][_0x4c4a2b])['$gte'];var _0x56a5e6=JSON[_0x2773('0x74')](_0x2b96eb[_0x2773('0x30')][_0x4c4a2b])[_0x2773('0x75')];_0x3f335f[_0x2773('0x71')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x29ddcc,_0x56a5e6);}else{if(_0x2b96eb['query'][_0x4c4a2b]==='null'){_0x3f335f[_0x2773('0x71')]('i.'+_0x4c4a2b+_0x2773('0x76'));}else{_0x3f335f[_0x2773('0x71')]('i.'+_0x4c4a2b+'\x20=\x20?',_0x2b96eb[_0x2773('0x30')][_0x4c4a2b]);}}});}if(_0x2b96eb['query']['read']){if(_0x2b96eb[_0x2773('0x30')][_0x2773('0x77')]==0x1){_0x3f335f[_0x2773('0x5b')](_0x2773('0x78'));}else{_0x3f335f[_0x2773('0x5b')](_0x2773('0x79'));}}if(_0x2b96eb['query'][_0x2773('0x7a')]){_0x2b00ef=_[_0x2773('0x7b')](_0x2b96eb[_0x2773('0x30')][_0x2773('0x7a')])?_0x2b96eb['query'][_0x2773('0x7a')]:new Array(_0x2b96eb[_0x2773('0x30')][_0x2773('0x7a')]);_0x2b00ef['forEach'](function(_0x57a6d7){_0x3b85a3['or'](_0x2773('0x68'),'%,'+_0x57a6d7+',%');});}if(_0x2b96eb[_0x2773('0x30')]['filter']){var _0x5dee8a=_0x2b96eb[_0x2773('0x30')][_0x2773('0x7c')][_0x2773('0x7d')]('\x5c','\x5c\x5c')[_0x2773('0x7d')](/'/g,'\x27\x27');if(qs[_0x2773('0x7e')](_0x5dee8a)){_0xaae54f['or']('i.id\x20LIKE\x20?',_0x5dee8a+'%')['or'](_0x2773('0x7f'),_0x5dee8a+'%');}_0xaae54f['or'](_0x2773('0x80'),_0x5dee8a+'%');}}_0x3f335f['where'](_0xaae54f);_0x3f335f[_0x2773('0x81')](_0x2773('0x82'));var _0x259ee4={'type':db[_0x2773('0x83')][_0x2773('0x84')][_0x2773('0x85')],'raw':!![]};var _0x4ebe0f=_0x3f335f[_0x2773('0x86')]();_0x4ebe0f[_0x2773('0x3f')](_0x2773('0x82'));_0x4ebe0f[_0x2773('0x3f')](_0x2773('0x87'),_0x2773('0x5a'));if(_0x32dc7e[_0x2773('0x3b')]){_0x32dc7e['order'][_0x2773('0x2b')](function(_0x29b474){var _0x290d3c=_0x29b474[0x0]==='contactName'?_0x29b474[0x0]:'i.'+_0x29b474[0x0];_0x3f335f['order'](_0x290d3c,_0x29b474[0x1]===_0x2773('0x88')?![]:!![]);});}if(!_[_0x2773('0x6f')](_0x2b00ef)){_0x3f335f['having'](_0x3b85a3);_0x4ebe0f[_0x2773('0x71')](_0x2773('0x89'),_0x2b00ef);}BPromise[_0x2773('0x8a')]()[_0x2773('0x22')](function(){if(!_0x442e46){if(_0x2b96eb[_0x2773('0x30')][_0x2773('0x70')])return;_0x4ebe0f[_0x2773('0x71')](_0x2773('0x8b'));_0x3f335f[_0x2773('0x71')](_0x2773('0x8b'));return;}if(_0x2b96eb[_0x2773('0x8c')]['role']!==_0x2773('0x8d'))return;return _0x2b96eb[_0x2773('0x8c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x271f0b){if(_[_0x2773('0x6f')](_0x271f0b)){_0x4ebe0f[_0x2773('0x71')](_0x2773('0x8e'));_0x3f335f[_0x2773('0x71')](_0x2773('0x8e'));}else{_0x4ebe0f[_0x2773('0x71')](_0x2773('0x72'),_[_0x2773('0x28')](_0x271f0b,'id'));_0x3f335f[_0x2773('0x71')](_0x2773('0x72'),_[_0x2773('0x28')](_0x271f0b,'id'));}});})[_0x2773('0x22')](function(){if(_0x2b96eb['user'][_0x2773('0x8f')]===_0x2773('0x8d')&&!_0x442e46&&!_0x2b96eb['query'][_0x2773('0x70')])return[];return db[_0x2773('0x90')][_0x2773('0x30')](_0x4ebe0f['toString'](),_0x259ee4);})[_0x2773('0x22')](function(_0x4e812a){_0x4cea74[_0x2773('0x1e')]=_0x4e812a[_0x2773('0x37')];if(_0x4cea74[_0x2773('0x1e')]===0x0)return[];return db[_0x2773('0x90')][_0x2773('0x30')](_0x2f4b90['toString'](),_0x259ee4)[_0x2773('0x22')](function(_0x2d4c52){_0x5f0bec=_[_0x2773('0x91')](_0x2d4c52,'id');_0x259ee4=_[_0x2773('0x92')](_0x259ee4,{'model':db[_0x2773('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b96eb[_0x2773('0x30')][_0x2773('0x36')]){_0x32dc7e[_0x2773('0x35')][_0x2773('0x2b')](function(_0x2a2e21){_0x3f335f[_0x2773('0x3f')]('i.'+_0x2a2e21);});}else{_0x3f335f[_0x2773('0x3f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3f335f[_0x2773('0x3f')](_0x2773('0x93'),_0x2773('0x94'));_0x3f335f[_0x2773('0x3f')](_0x2773('0x95'),'Account.mandatoryDisposition');_0x3f335f['field'](_0x2773('0x96'),_0x2773('0x97'));_0x3f335f[_0x2773('0x3f')](_0x2773('0x98'));_0x3f335f[_0x2773('0x3f')](_0x2773('0x99'),_0x2773('0x9a'));_0x3f335f[_0x2773('0x3f')](_0x2773('0x9b'),_0x2773('0x9c'));_0x3f335f['field'](_0x2773('0x9d'),_0x2773('0x9e'));_0x3f335f[_0x2773('0x3f')]('c.phone',_0x2773('0x9f'));_0x3f335f[_0x2773('0x3f')](_0x2773('0xa0'),'Contact.mobile');_0x3f335f[_0x2773('0x3f')]('c.fax',_0x2773('0xa1'));_0x3f335f[_0x2773('0x3f')](_0x2773('0xa2'),_0x2773('0xa3'));_0x3f335f[_0x2773('0x3f')]('o.internal',_0x2773('0xa4'));_0x3f335f[_0x2773('0x3f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2773('0x29'));}if(_0x32dc7e['limit'])_0x3f335f['limit'](_0x32dc7e[_0x2773('0x1d')]);if(_0x32dc7e[_0x2773('0x3a')])_0x3f335f['offset'](_0x32dc7e[_0x2773('0x3a')]);return db['sequelize'][_0x2773('0x30')](_0x3f335f['toString'](),_0x259ee4);})[_0x2773('0x22')](function(_0x592987){if(_0x592987['length']>0x0)_0x11994e['where'](_0x2773('0xa5'),_[_0x2773('0x28')](_0x592987,'id'));return db[_0x2773('0x90')][_0x2773('0x30')](_0x11994e[_0x2773('0xa6')](),_0x259ee4)[_0x2773('0x22')](function(_0x348354){var _0x1a5d87=_[_0x2773('0xa7')](_0x348354,_0x2773('0xa8'));var _0x153e5a=[];_0x592987[_0x2773('0x2b')](function(_0x52fb17){_0x153e5a[_0x2773('0xa9')](updateFaxInteraction(_0x52fb17,_0x5f0bec,_0x1a5d87));});return BPromise[_0x2773('0xaa')](_0x153e5a);});});})['then'](function(_0x3fe892){_0x4cea74['rows']=_0x3fe892;return _0x4cea74;})['then'](respondWithFilteredResult(_0x28d825,_0x32dc7e))[_0x2773('0xab')](handleError(_0x28d825,null));};exports['show']=function(_0x342a36,_0x334506){var _0x2906aa={'raw':![],'where':{'id':_0x342a36[_0x2773('0xac')]['id']}},_0x31d4b2={};_0x31d4b2[_0x2773('0x34')]=_['keys'](db[_0x2773('0x2c')][_0x2773('0x2d')]);_0x31d4b2[_0x2773('0x30')]=_[_0x2773('0x31')](_0x342a36['query']);_0x31d4b2[_0x2773('0x32')]=_[_0x2773('0x33')](_0x31d4b2[_0x2773('0x34')],_0x31d4b2[_0x2773('0x30')]);_0x2906aa[_0x2773('0x35')]=_[_0x2773('0x33')](_0x31d4b2[_0x2773('0x34')],qs['fields'](_0x342a36[_0x2773('0x30')]['fields']));_0x2906aa['attributes']=_0x2906aa[_0x2773('0x35')][_0x2773('0x37')]?_0x2906aa['attributes']:_0x31d4b2[_0x2773('0x34')];if(_0x342a36['query'][_0x2773('0xad')]){_0x2906aa[_0x2773('0xae')]=[{'all':!![]}];}_0x2906aa=_['merge']({},_0x2906aa,_0x342a36['options']);return db[_0x2773('0x2c')][_0x2773('0xaf')](_0x2906aa)[_0x2773('0x22')](handleEntityNotFound(_0x334506,null))[_0x2773('0x22')](respondWithResult(_0x334506,null))[_0x2773('0xab')](handleError(_0x334506,null));};exports[_0x2773('0xb0')]=function(_0x53c22e,_0x105182){return db[_0x2773('0x2c')]['create'](_0x53c22e[_0x2773('0x6c')],{})['then'](respondWithResult(_0x105182,0xc9))[_0x2773('0xab')](handleError(_0x105182,null));};exports[_0x2773('0xb1')]=function(_0x5ee42d,_0x42fdb1){if(_0x5ee42d[_0x2773('0x6c')]['id']){delete _0x5ee42d[_0x2773('0x6c')]['id'];}return db[_0x2773('0x2c')][_0x2773('0xaf')]({'where':{'id':_0x5ee42d[_0x2773('0xac')]['id']}})[_0x2773('0x22')](handleEntityNotFound(_0x42fdb1,null))[_0x2773('0x22')](saveUpdates(_0x5ee42d['body'],null))[_0x2773('0x22')](respondWithResult(_0x42fdb1,null))[_0x2773('0xab')](handleError(_0x42fdb1,null));};exports['destroy']=function(_0x4dc117,_0x2fafac){return db['FaxInteraction'][_0x2773('0xaf')]({'where':{'id':_0x4dc117[_0x2773('0xac')]['id']}})[_0x2773('0x22')](handleEntityNotFound(_0x2fafac,null))[_0x2773('0x22')](removeEntity(_0x2fafac,null))['catch'](handleError(_0x2fafac,null));};exports[_0x2773('0xb2')]=function(_0xa4cf5b,_0x2152ac){return db[_0x2773('0x2c')][_0x2773('0xb2')]()['then'](respondWithResult(_0x2152ac,null))[_0x2773('0xab')](handleError(_0x2152ac,null));};exports[_0x2773('0xb3')]=function(_0x37699,_0x348ce1,_0x3a7c8b){return db['FaxMessage'][_0x2773('0xaf')]({'where':{'id':_0x37699[_0x2773('0xac')]['id']}})[_0x2773('0x22')](handleEntityNotFound(_0x348ce1,null))[_0x2773('0x22')](function(_0xcf5b9a){if(_0xcf5b9a){return _0xcf5b9a[_0x2773('0xb3')](_0x37699[_0x2773('0x6c')][_0x2773('0xb4')],_[_0x2773('0xb5')](_0x37699[_0x2773('0x6c')],['ids','id'])||{});}})[_0x2773('0x22')](respondWithResult(_0x348ce1,null))[_0x2773('0xab')](handleError(_0x348ce1,null));};exports[_0x2773('0xb6')]=function(_0x3b97eb,_0x8c8a5,_0x5d1da3){var _0x540f15={'raw':![],'where':{}};var _0x3e393c={};var _0x8cad5c={'count':0x0,'rows':[]};return db[_0x2773('0x2c')][_0x2773('0xb7')]({'where':{'id':_0x3b97eb[_0x2773('0xac')]['id']}})[_0x2773('0x22')](handleEntityNotFound(_0x8c8a5,null))[_0x2773('0x22')](function(_0xbe2660){if(_0xbe2660){_0x3e393c[_0x2773('0x34')]=_['keys'](db[_0x2773('0xb8')][_0x2773('0x2d')]);_0x3e393c[_0x2773('0x30')]=_[_0x2773('0x31')](_0x3b97eb['query']);_0x3e393c[_0x2773('0x32')]=_[_0x2773('0x33')](_0x3e393c[_0x2773('0x34')],_0x3e393c['query']);_0x540f15[_0x2773('0x35')]=_[_0x2773('0x33')](_0x3e393c['model'],qs[_0x2773('0x36')](_0x3b97eb[_0x2773('0x30')][_0x2773('0x36')]));_0x540f15[_0x2773('0x35')]=_0x540f15[_0x2773('0x35')]['length']?_0x540f15['attributes']:_0x3e393c[_0x2773('0x34')];if(!_0x3b97eb[_0x2773('0x30')][_0x2773('0x38')](_0x2773('0x39'))){_0x540f15[_0x2773('0x1d')]=qs[_0x2773('0x1d')](_0x3b97eb[_0x2773('0x30')]['limit']);_0x540f15[_0x2773('0x3a')]=qs[_0x2773('0x3a')](_0x3b97eb[_0x2773('0x30')][_0x2773('0x3a')]);}_0x540f15[_0x2773('0x3b')]=qs['sort'](_0x3b97eb[_0x2773('0x30')]['sort']);_0x540f15[_0x2773('0x71')]=qs[_0x2773('0x32')](_[_0x2773('0x3d')](_0x3b97eb[_0x2773('0x30')],_0x3e393c[_0x2773('0x32')]));_0x540f15[_0x2773('0x71')][_0x2773('0xa8')]=_0xbe2660['id'];if(_0x3b97eb[_0x2773('0x30')][_0x2773('0x7c')]){_0x540f15[_0x2773('0x71')]=_['merge'](_0x540f15[_0x2773('0x71')],{'$or':_['map'](_0x540f15[_0x2773('0x35')],function(_0x4c10a6){var _0x259d29={};_0x259d29[_0x4c10a6]={'$like':'%'+_0x3b97eb[_0x2773('0x30')][_0x2773('0x7c')]+'%'};return _0x259d29;})});}if(_0x3b97eb['query'][_0x2773('0xb9')]){var _0xc26f65=_0x3b97eb[_0x2773('0x30')][_0x2773('0xb9')]['split'](',');var _0x26fd2c={};_0x26fd2c[_0xc26f65[0x0]]={'$gte':moment(_0xc26f65[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x540f15[_0x2773('0x71')]=_[_0x2773('0x92')](_0x540f15[_0x2773('0x71')],_0x26fd2c);}_0x540f15=_['merge']({},_0x540f15,_0x3b97eb[_0x2773('0xba')]);return db[_0x2773('0xb8')]['count']({'where':_0x540f15[_0x2773('0x71')]})[_0x2773('0x22')](function(_0x328d99){_0x8cad5c[_0x2773('0x1e')]=_0x328d99;if(_0x3b97eb[_0x2773('0x30')][_0x2773('0xad')]){_0x540f15['include']=[{'all':!![]}];}return db[_0x2773('0xb8')]['findAll'](_0x540f15);})[_0x2773('0x22')](function(_0x2dd456){_0x8cad5c[_0x2773('0xbb')]=_0x2dd456;return _0x8cad5c;});}})[_0x2773('0x22')](respondWithFilteredResult(_0x8c8a5,_0x540f15))[_0x2773('0xab')](handleError(_0x8c8a5,null));};exports[_0x2773('0xbc')]=function(_0x441e6e,_0x1deda7,_0x5131f5){return db[_0x2773('0x2c')]['find']({'where':{'id':_0x441e6e[_0x2773('0xac')]['id']}})['then'](handleEntityNotFound(_0x1deda7,null))[_0x2773('0x22')](function(_0x3beed8){if(_0x3beed8){return _0x3beed8[_0x2773('0xbd')](_0x441e6e[_0x2773('0x6c')][_0x2773('0xb4')],_[_0x2773('0xb5')](_0x441e6e[_0x2773('0x6c')],[_0x2773('0xb4'),'id'])||{})[_0x2773('0xbe')](function(){return db[_0x2773('0xbf')]['findAll']({'attributes':['id',_0x2773('0x25'),_0x2773('0x40')],'where':{'id':_0x441e6e[_0x2773('0x6c')]['ids']}});})[_0x2773('0x22')](function(_0x36d5f5){socket[_0x2773('0xc0')]('faxInteractionTags:save',{'id':Number(_0x441e6e[_0x2773('0xac')]['id']),'tags':_0x36d5f5||[]});return{'id':Number(_0x441e6e[_0x2773('0xac')]['id']),'tags':_0x36d5f5||[]};});}})[_0x2773('0x22')](respondWithResult(_0x1deda7,null))[_0x2773('0xab')](handleError(_0x1deda7,null));};exports['removeTags']=function(_0x335b96,_0x23e283,_0x1ccd0c){return db['FaxInteraction'][_0x2773('0xaf')]({'where':{'id':_0x335b96[_0x2773('0xac')]['id']}})['then'](handleEntityNotFound(_0x23e283,null))[_0x2773('0x22')](function(_0x212c4a){if(_0x212c4a){return _0x212c4a['removeTags'](_0x335b96[_0x2773('0x30')][_0x2773('0xb4')]);}})[_0x2773('0x22')](respondWithStatusCode(_0x23e283,null))[_0x2773('0xab')](handleError(_0x23e283,null));};exports['download']=function(_0x5eda62,_0x4836eb){var _0x2c6ceb=moment()[_0x2773('0xc1')]()[_0x2773('0xa6')]();var _0x1b7c89=path[_0x2773('0xc2')](config[_0x2773('0xc3')],_0x2773('0xc4'),_0x2773('0xc5'),_0x2773('0xc6'));var _0x37fb5c=path[_0x2773('0xc2')](config['root'],'server',_0x2773('0xc5'),_0x2773('0xc7'));var _0x56a944=path['join'](_0x1b7c89,_0x2c6ceb);var _0x53ba45=util[_0x2773('0xc8')](_0x2773('0xc9'),_0x5eda62[_0x2773('0xac')]['id'],_0x2c6ceb);var _0x236b2d=path[_0x2773('0xc2')](_0x1b7c89,_0x53ba45);var _0x27210f=[];_0x27210f['push']({'model':db[_0x2773('0xca')],'as':_0x2773('0xca'),'raw':!![]});var _0x53820a=[{'model':db[_0x2773('0xb8')],'as':_0x2773('0xcb'),'attributes':['id',_0x2773('0x6c'),_0x2773('0x73')],'include':_0x27210f}];return db[_0x2773('0x2c')][_0x2773('0xaf')]({'where':{'id':_0x5eda62['params']['id']},'include':_0x53820a})[_0x2773('0x22')](handleEntityNotFound(_0x4836eb,null))['then'](function(_0x5a4c93){if(_0x5a4c93&&_0x5a4c93[_0x2773('0xcb')]){var _0x150693=_0x5a4c93[_0x2773('0xcc')]({'plain':!![]});fs[_0x2773('0xcd')](_0x56a944);for(var _0x59ba1d=0x0;_0x59ba1d<_0x150693[_0x2773('0xcb')][_0x2773('0x37')];_0x59ba1d++){var _0xfc6c6f=_0x150693[_0x2773('0xcb')][_0x59ba1d][_0x2773('0xca')];if(_0xfc6c6f){var _0x5a119a=path[_0x2773('0xc2')](_0x37fb5c,_0xfc6c6f[_0x2773('0xce')]);if(fs['existsSync'](_0x5a119a)){fs['createReadStream'](_0x5a119a)['pipe'](fs[_0x2773('0xcf')](path[_0x2773('0xc2')](_0x56a944,_0xfc6c6f[_0x2773('0xce')])));}}}return BPromise[_0x2773('0x8a')]()[_0x2773('0x22')](function(){return new BPromise(function(_0x2f2f71,_0x4be574){zipdir(_0x56a944,{'saveTo':_0x236b2d},function(_0x3eef72,_0x2527f2){if(_0x3eef72)return _0x4be574(_0x3eef72);return _0x2f2f71(_0x2527f2);});})['then'](function(){return new BPromise(function(_0x3ddcb5,_0xabf4cc){rimraf(_0x56a944,function(_0x5d681e){if(_0x5d681e)_0xabf4cc(_0x5d681e);return _0x3ddcb5();});});})[_0x2773('0x22')](function(){return _0x4836eb[_0x2773('0xd0')](_0x236b2d,_0x53ba45,function(_0x464fb8){if(_0x464fb8){console[_0x2773('0xd1')](_0x2773('0xd2'),_0x464fb8);}else{fs[_0x2773('0xd3')](_0x236b2d);}});});});}else{return _0x4836eb[_0x2773('0x18')](0xc8);}})[_0x2773('0xab')](handleError(_0x4836eb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 10e8fc4..933d132 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 _0xfa2a=['unreadMessages','emit','catch','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xfa2a,0xd1));var _0xafa2=function(_0x5a6ed2,_0xf5f2ef){_0x5a6ed2=_0x5a6ed2-0x0;var _0x3bcdad=_0xfa2a[_0x5a6ed2];return _0x3bcdad;};'use strict';var EventEmitter=require(_0xafa2('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xafa2('0x1')];var FaxMessage=require(_0xafa2('0x2'))['db'][_0xafa2('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xafa2('0x4')](0x0);var events={'afterCreate':_0xafa2('0x5'),'afterUpdate':_0xafa2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3b5173){return function(_0x376d0d,_0xbcc22d,_0x14f52a){_0x376d0d[_0xafa2('0x7')]({'attributes':['id'],'raw':!![]})[_0xafa2('0x8')](function(_0x2275f1){_0x376d0d[_0xafa2('0x9')](_0xafa2('0xa'),_0x2275f1[_0xafa2('0xb')](function(_0x47eb58){return{'id':_0x47eb58['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x376d0d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xafa2('0x8')](function(_0x4c048b){_0x376d0d[_0xafa2('0x9')](_0xafa2('0xc'),_0x4c048b['length']);FaxInteractionEvents[_0xafa2('0xd')](_0x3b5173+':'+_0x376d0d['id'],_0x376d0d);FaxInteractionEvents[_0xafa2('0xd')](_0x3b5173,_0x376d0d);_0x14f52a(null);})[_0xafa2('0xe')](_0x14f52a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xafa2('0xf')](e,emitEvent(event));}}module[_0xafa2('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x66cd=['FaxMessage','setMaxListeners','update','setDataValue','Users','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f7707,_0x313788){var _0x4d1b82=function(_0x3c12da){while(--_0x3c12da){_0x2f7707['push'](_0x2f7707['shift']());}};_0x4d1b82(++_0x313788);}(_0x66cd,0x76));var _0xd66c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x66cd[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0xd66c('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xd66c('0x1'))['db'][_0xd66c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd66c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd66c('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb78ebb){return function(_0x5ccd32,_0x49ef18,_0x19442e){_0x5ccd32['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x598505){_0x5ccd32[_0xd66c('0x5')](_0xd66c('0x6'),_0x598505['map'](function(_0x4ff7bc){return{'id':_0x4ff7bc['id']};}));return FaxMessage[_0xd66c('0x7')]({'where':{'FaxInteractionId':_0x5ccd32['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd66c('0x8')](function(_0x15eac2){_0x5ccd32[_0xd66c('0x5')](_0xd66c('0x9'),_0x15eac2['length']);FaxInteractionEvents[_0xd66c('0xa')](_0xb78ebb+':'+_0x5ccd32['id'],_0x5ccd32);FaxInteractionEvents['emit'](_0xb78ebb,_0x5ccd32);_0x19442e(null);})[_0xd66c('0xb')](_0x19442e(null));};}for(var e in events){if(events[_0xd66c('0xc')](e)){var event=events[e];FaxInteraction[_0xd66c('0xd')](e,emitEvent(event));}}module[_0xd66c('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c455fba..cc987dd 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 _0x9489=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x1800cb,_0xba50f9){var _0x3b5e95=function(_0x556308){while(--_0x556308){_0x1800cb['push'](_0x1800cb['shift']());}};_0x3b5e95(++_0xba50f9);}(_0x9489,0x10b));var _0x9948=function(_0x5c448c,_0x3daadc){_0x5c448c=_0x5c448c-0x0;var _0x45ac8d=_0x9489[_0x5c448c];return _0x45ac8d;};'use strict';var _=require('lodash');var util=require(_0x9948('0x0'));var logger=require(_0x9948('0x1'))(_0x9948('0x2'));var moment=require(_0x9948('0x3'));var BPromise=require(_0x9948('0x4'));var rp=require(_0x9948('0x5'));var fs=require('fs');var path=require(_0x9948('0x6'));var rimraf=require(_0x9948('0x7'));var config=require(_0x9948('0x8'));var attributes=require(_0x9948('0x9'));module[_0x9948('0xa')]=function(_0x18bfe1,_0x40ec0e){return _0x18bfe1[_0x9948('0xb')](_0x9948('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc1ce0,_0x1bab49,_0x4e6a2b){if(_0xc1ce0['changed']('closed')){_0xc1ce0[_0x9948('0xd')]=moment()[_0x9948('0xe')](_0x9948('0xf'));}_0x4e6a2b(null,_0xc1ce0);}}});}; \ No newline at end of file +var _0x1cf5=['fax_interactions','changed','closedAt','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x11da56,_0x537013){var _0x50ada2=function(_0x29deee){while(--_0x29deee){_0x11da56['push'](_0x11da56['shift']());}};_0x50ada2(++_0x537013);}(_0x1cf5,0x78));var _0x51cf=function(_0x4a1fa1,_0x2db06b){_0x4a1fa1=_0x4a1fa1-0x0;var _0x21d32f=_0x1cf5[_0x4a1fa1];return _0x21d32f;};'use strict';var _=require('lodash');var util=require(_0x51cf('0x0'));var logger=require(_0x51cf('0x1'))(_0x51cf('0x2'));var moment=require('moment');var BPromise=require(_0x51cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51cf('0x4'));var rimraf=require(_0x51cf('0x5'));var config=require(_0x51cf('0x6'));var attributes=require(_0x51cf('0x7'));module[_0x51cf('0x8')]=function(_0x3f5b0f,_0x23db61){return _0x3f5b0f['define'](_0x51cf('0x9'),attributes,{'tableName':_0x51cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2659f8,_0x4adb50,_0xde5d7a){if(_0x2659f8[_0x51cf('0xb')]('closed')){_0x2659f8[_0x51cf('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xde5d7a(null,_0x2659f8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9e4b4f3..f881b7a 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 _0x3199=['stringify','error','message','FaxInteraction,\x20%s,\x20%s','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','debug','request\x20sent'];(function(_0x565fbd,_0x4a5c3a){var _0x3782ab=function(_0x59a546){while(--_0x59a546){_0x565fbd['push'](_0x565fbd['shift']());}};_0x3782ab(++_0x4a5c3a);}(_0x3199,0x14b));var _0x9319=function(_0x12a274,_0x1860cd){_0x12a274=_0x12a274-0x0;var _0x55210a=_0x3199[_0x12a274];return _0x55210a;};'use strict';var _=require(_0x9319('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9319('0x1'));var rs=require(_0x9319('0x2'));var fs=require('fs');var Redis=require(_0x9319('0x3'));var db=require(_0x9319('0x4'))['db'];var utils=require(_0x9319('0x5'));var logger=require(_0x9319('0x6'))(_0x9319('0x7'));var config=require(_0x9319('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9319('0x9')]['http']({'port':0x232a});config[_0x9319('0xa')]=_[_0x9319('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9319('0xc'))(new Redis(config[_0x9319('0xa')]));require(_0x9319('0xd'))[_0x9319('0xe')](socket);function respondWithRpcPromise(_0xd4af1e,_0x701a4,_0x249713){return new BPromise(function(_0x1951f0,_0x4f4c7d){return client[_0x9319('0xf')](_0xd4af1e,_0x249713)[_0x9319('0x10')](function(_0xa72390){logger[_0x9319('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x701a4,'request\x20sent');logger[_0x9319('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x701a4,_0x9319('0x13'),JSON[_0x9319('0x14')](_0xa72390));if(_0xa72390[_0x9319('0x15')]){if(_0xa72390['error']['code']===0x1f4){logger[_0x9319('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x701a4,_0xa72390[_0x9319('0x15')]['message']);return _0x4f4c7d(_0xa72390[_0x9319('0x15')][_0x9319('0x16')]);}logger['error'](_0x9319('0x17'),_0x701a4,_0xa72390[_0x9319('0x15')][_0x9319('0x16')]);return _0x1951f0(_0xa72390[_0x9319('0x15')][_0x9319('0x16')]);}else{logger[_0x9319('0x11')](_0x9319('0x17'),_0x701a4,_0x9319('0x13'));_0x1951f0(_0xa72390['result'][_0x9319('0x16')]);}})[_0x9319('0x18')](function(_0x3759f4){logger[_0x9319('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x701a4,_0x3759f4);_0x4f4c7d(_0x3759f4);});});}exports[_0x9319('0x19')]=function(_0x5c7701){var _0x532850=this;return new Promise(function(_0x585abd,_0x437c89){return db[_0x9319('0x1a')][_0x9319('0x1b')](_0x5c7701[_0x9319('0x1c')],{'raw':_0x5c7701[_0x9319('0x1d')]?_0x5c7701[_0x9319('0x1d')][_0x9319('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c7701[_0x9319('0x1d')]?_0x5c7701[_0x9319('0x1d')][_0x9319('0x1f')]||null:null,'attributes':_0x5c7701['options']?_0x5c7701[_0x9319('0x1d')][_0x9319('0x20')]||null:null,'limit':_0x5c7701[_0x9319('0x1d')]?_0x5c7701[_0x9319('0x1d')][_0x9319('0x21')]||null:null})[_0x9319('0x10')](function(_0x2f65ab){logger[_0x9319('0x11')]('UpdateFaxInteraction',_0x5c7701);logger[_0x9319('0x12')](_0x9319('0x19'),_0x5c7701,JSON[_0x9319('0x14')](_0x2f65ab));_0x585abd(_0x2f65ab);})[_0x9319('0x18')](function(_0x3bbdaa){logger[_0x9319('0x15')]('UpdateFaxInteraction',_0x3bbdaa[_0x9319('0x16')],_0x5c7701);_0x437c89(_0x532850['error'](0x1f4,_0x3bbdaa['message']));});});};exports[_0x9319('0x22')]=function(_0x3d7786){return new Promise(function(_0x38f06a,_0x4fb3ae){return db[_0x9319('0x1a')][_0x9319('0x23')]({'where':_0x3d7786['options']?_0x3d7786[_0x9319('0x1d')][_0x9319('0x1f')]||null:null})['then'](function(_0x425856){if(_0x425856){return _0x425856['addTags'](_0x3d7786[_0x9319('0x1c')][_0x9319('0x24')],_['omit'](_0x3d7786[_0x9319('0x1c')],[_0x9319('0x24'),'id'])||{});}})[_0x9319('0x25')](function(_0x303038){logger[_0x9319('0x11')](_0x9319('0x26'),_0x3d7786);logger[_0x9319('0x12')](_0x9319('0x26'),_0x3d7786,JSON[_0x9319('0x14')](_0x303038));_0x38f06a(_0x303038);})['catch'](function(_0xab3fb7){logger['error']('AddTags',_0xab3fb7[_0x9319('0x16')],_0x3d7786);_0x4fb3ae(_this[_0x9319('0x15')](0x1f4,_0xab3fb7['message']));});});}; \ No newline at end of file +var _0x9ed2=['debug','request\x20sent','error','code','message','FaxInteraction,\x20%s,\x20%s','catch','UpdateFaxInteraction','update','body','options','raw','where','limit','stringify','FaxInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0x9ed2,0x1f4));var _0x29ed=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x9ed2[_0x188a93];return _0x23b40d;};'use strict';var _=require(_0x29ed('0x0'));var util=require(_0x29ed('0x1'));var moment=require(_0x29ed('0x2'));var BPromise=require(_0x29ed('0x3'));var rs=require(_0x29ed('0x4'));var fs=require('fs');var Redis=require(_0x29ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x29ed('0x6'));var logger=require(_0x29ed('0x7'))(_0x29ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x29ed('0x9'));var client=jayson[_0x29ed('0xa')][_0x29ed('0xb')]({'port':0x232a});config['redis']=_[_0x29ed('0xc')](config[_0x29ed('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x29ed('0xe'))(new Redis(config['redis']));require(_0x29ed('0xf'))[_0x29ed('0x10')](socket);function respondWithRpcPromise(_0xe9c8e5,_0x362f04,_0xcbda66){return new BPromise(function(_0x4d8d74,_0x5168f2){return client[_0x29ed('0x11')](_0xe9c8e5,_0xcbda66)[_0x29ed('0x12')](function(_0x747f8c){logger[_0x29ed('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x362f04,'request\x20sent');logger[_0x29ed('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x362f04,_0x29ed('0x15'),JSON['stringify'](_0x747f8c));if(_0x747f8c['error']){if(_0x747f8c[_0x29ed('0x16')][_0x29ed('0x17')]===0x1f4){logger[_0x29ed('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x362f04,_0x747f8c[_0x29ed('0x16')]['message']);return _0x5168f2(_0x747f8c[_0x29ed('0x16')][_0x29ed('0x18')]);}logger[_0x29ed('0x16')](_0x29ed('0x19'),_0x362f04,_0x747f8c[_0x29ed('0x16')][_0x29ed('0x18')]);return _0x4d8d74(_0x747f8c[_0x29ed('0x16')]['message']);}else{logger[_0x29ed('0x13')](_0x29ed('0x19'),_0x362f04,_0x29ed('0x15'));_0x4d8d74(_0x747f8c['result']['message']);}})[_0x29ed('0x1a')](function(_0x423a40){logger[_0x29ed('0x16')](_0x29ed('0x19'),_0x362f04,_0x423a40);_0x5168f2(_0x423a40);});});}exports[_0x29ed('0x1b')]=function(_0x13c91c){var _0x231ce5=this;return new Promise(function(_0xf102bd,_0x54efe8){return db['FaxInteraction'][_0x29ed('0x1c')](_0x13c91c[_0x29ed('0x1d')],{'raw':_0x13c91c[_0x29ed('0x1e')]?_0x13c91c['options'][_0x29ed('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13c91c[_0x29ed('0x1e')]?_0x13c91c[_0x29ed('0x1e')][_0x29ed('0x20')]||null:null,'attributes':_0x13c91c[_0x29ed('0x1e')]?_0x13c91c[_0x29ed('0x1e')]['attributes']||null:null,'limit':_0x13c91c[_0x29ed('0x1e')]?_0x13c91c[_0x29ed('0x1e')][_0x29ed('0x21')]||null:null})['then'](function(_0x13730e){logger[_0x29ed('0x13')](_0x29ed('0x1b'),_0x13c91c);logger[_0x29ed('0x14')](_0x29ed('0x1b'),_0x13c91c,JSON[_0x29ed('0x22')](_0x13730e));_0xf102bd(_0x13730e);})[_0x29ed('0x1a')](function(_0x349ce9){logger[_0x29ed('0x16')](_0x29ed('0x1b'),_0x349ce9[_0x29ed('0x18')],_0x13c91c);_0x54efe8(_0x231ce5[_0x29ed('0x16')](0x1f4,_0x349ce9[_0x29ed('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2cd616){return new Promise(function(_0x1d406e,_0x411222){return db[_0x29ed('0x23')]['find']({'where':_0x2cd616[_0x29ed('0x1e')]?_0x2cd616[_0x29ed('0x1e')][_0x29ed('0x20')]||null:null})['then'](function(_0x1c110f){if(_0x1c110f){return _0x1c110f[_0x29ed('0x24')](_0x2cd616['body'][_0x29ed('0x25')],_[_0x29ed('0x26')](_0x2cd616['body'],['ids','id'])||{});}})['spread'](function(_0x2942d3){logger[_0x29ed('0x13')](_0x29ed('0x27'),_0x2cd616);logger['debug'](_0x29ed('0x27'),_0x2cd616,JSON['stringify'](_0x2942d3));_0x1d406e(_0x2942d3);})[_0x29ed('0x1a')](function(_0x2f2bb0){logger[_0x29ed('0x16')]('AddTags',_0x2f2bb0[_0x29ed('0x18')],_0x2cd616);_0x411222(_this[_0x29ed('0x16')](0x1f4,_0x2f2bb0[_0x29ed('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5bd8d2c..eed11df 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 _0x4e07=['./faxInteraction.events','save','length'];(function(_0x111cfe,_0x486cdf){var _0x336fc9=function(_0x5741a3){while(--_0x5741a3){_0x111cfe['push'](_0x111cfe['shift']());}};_0x336fc9(++_0x486cdf);}(_0x4e07,0x8a));var _0x74e0=function(_0x7d903a,_0x54653b){_0x7d903a=_0x7d903a-0x0;var _0x34c089=_0x4e07[_0x7d903a];return _0x34c089;};'use strict';var FaxInteractionEvents=require(_0x74e0('0x0'));var events=[_0x74e0('0x1'),'remove','update'];function createListener(_0xc068a3,_0x6cdbec){return function(_0x3cabb0){_0x6cdbec['emit'](_0xc068a3,_0x3cabb0);};}function removeListener(_0x17d432,_0x4cf143){return function(){FaxInteractionEvents['removeListener'](_0x17d432,_0x4cf143);};}exports['register']=function(_0x1e18df){for(var _0x2b8b3b=0x0,_0x10d307=events[_0x74e0('0x2')];_0x2b8b3b<_0x10d307;_0x2b8b3b++){var _0x12df0f=events[_0x2b8b3b];var _0x367770=createListener('faxInteraction:'+_0x12df0f,_0x1e18df);FaxInteractionEvents['on'](_0x12df0f,_0x367770);}}; \ No newline at end of file +var _0xf277=['length','save','emit','removeListener','register'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf277,0x1aa));var _0x7f27=function(_0x3e41de,_0x40f025){_0x3e41de=_0x3e41de-0x0;var _0x4ea088=_0xf277[_0x3e41de];return _0x4ea088;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7f27('0x0'),'remove','update'];function createListener(_0x2041c9,_0x38faf3){return function(_0x13fd50){_0x38faf3[_0x7f27('0x1')](_0x2041c9,_0x13fd50);};}function removeListener(_0x56ca38,_0x4af9aa){return function(){FaxInteractionEvents[_0x7f27('0x2')](_0x56ca38,_0x4af9aa);};}exports[_0x7f27('0x3')]=function(_0x4c4d1d){for(var _0x3a0fa1=0x0,_0x252561=events[_0x7f27('0x4')];_0x3a0fa1<_0x252561;_0x3a0fa1++){var _0xb872a3=events[_0x3a0fa1];var _0x358d09=createListener('faxInteraction:'+_0xb872a3,_0x4c4d1d);FaxInteractionEvents['on'](_0xb872a3,_0x358d09);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ae35b95..a236428 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 _0xb3ad=['destroy','removeTags','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','update','delete','faxinteraction:destroy'];(function(_0x44672c,_0x37572f){var _0x4a0989=function(_0x412a80){while(--_0x412a80){_0x44672c['push'](_0x44672c['shift']());}};_0x4a0989(++_0x37572f);}(_0xb3ad,0x110));var _0xdb3a=function(_0x5db392,_0x4a03a2){_0x5db392=_0x5db392-0x0;var _0x30bcfd=_0xb3ad[_0x5db392];return _0x30bcfd;};'use strict';var multer=require('multer');var util=require(_0xdb3a('0x0'));var path=require(_0xdb3a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb3a('0x2')]();var fs_extra=require(_0xdb3a('0x3'));var auth=require(_0xdb3a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb3a('0x5'));var controller=require(_0xdb3a('0x6'));router[_0xdb3a('0x7')]('/',auth[_0xdb3a('0x8')](),controller[_0xdb3a('0x9')]);router[_0xdb3a('0x7')](_0xdb3a('0xa'),auth['isAuthenticated'](),controller[_0xdb3a('0xb')]);router[_0xdb3a('0x7')]('/:id',auth[_0xdb3a('0x8')](),controller['show']);router[_0xdb3a('0x7')](_0xdb3a('0xc'),auth[_0xdb3a('0x8')](),controller[_0xdb3a('0xd')]);router['get'](_0xdb3a('0xe'),auth['isAuthenticated'](),controller[_0xdb3a('0xf')]);router[_0xdb3a('0x10')]('/',auth[_0xdb3a('0x8')](),controller['create']);router['post']('/:id/messages',auth[_0xdb3a('0x8')](),controller[_0xdb3a('0x11')]);router[_0xdb3a('0x10')](_0xdb3a('0x12'),auth[_0xdb3a('0x8')](),interaction[_0xdb3a('0x13')](_0xdb3a('0x14'),_0xdb3a('0x15')),controller[_0xdb3a('0x16')]);router[_0xdb3a('0x17')](_0xdb3a('0x18'),auth['isAuthenticated'](),interaction[_0xdb3a('0x13')](_0xdb3a('0x14'),'faxinteraction:update'),controller[_0xdb3a('0x19')]);router[_0xdb3a('0x1a')](_0xdb3a('0x18'),auth[_0xdb3a('0x8')](),interaction[_0xdb3a('0x13')](_0xdb3a('0x14'),_0xdb3a('0x1b')),controller[_0xdb3a('0x1c')]);router['delete'](_0xdb3a('0x12'),auth['isAuthenticated'](),controller[_0xdb3a('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x9474=['/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','delete','faxinteraction:destroy','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x17ff93,_0x1b457c){var _0x1627b9=function(_0x301782){while(--_0x301782){_0x17ff93['push'](_0x17ff93['shift']());}};_0x1627b9(++_0x1b457c);}(_0x9474,0x13b));var _0x4947=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x9474[_0x1ca29f];return _0x576c3b;};'use strict';var multer=require(_0x4947('0x0'));var util=require(_0x4947('0x1'));var path=require(_0x4947('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4947('0x3')]();var fs_extra=require(_0x4947('0x4'));var auth=require(_0x4947('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4947('0x6'));router[_0x4947('0x7')]('/',auth[_0x4947('0x8')](),controller[_0x4947('0x9')]);router[_0x4947('0x7')](_0x4947('0xa'),auth[_0x4947('0x8')](),controller[_0x4947('0xb')]);router[_0x4947('0x7')](_0x4947('0xc'),auth[_0x4947('0x8')](),controller[_0x4947('0xd')]);router[_0x4947('0x7')](_0x4947('0xe'),auth[_0x4947('0x8')](),controller['getMessages']);router['get'](_0x4947('0xf'),auth[_0x4947('0x8')](),controller[_0x4947('0x10')]);router[_0x4947('0x11')]('/',auth[_0x4947('0x8')](),controller[_0x4947('0x12')]);router[_0x4947('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4947('0x13')]);router[_0x4947('0x11')](_0x4947('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x4947('0x15'),_0x4947('0x16')),controller[_0x4947('0x17')]);router[_0x4947('0x18')](_0x4947('0xc'),auth[_0x4947('0x8')](),interaction[_0x4947('0x19')](_0x4947('0x15'),'faxinteraction:update'),controller['update']);router[_0x4947('0x1a')](_0x4947('0xc'),auth[_0x4947('0x8')](),interaction[_0x4947('0x19')](_0x4947('0x15'),_0x4947('0x1b')),controller[_0x4947('0x1c')]);router[_0x4947('0x1a')](_0x4947('0x14'),auth[_0x4947('0x8')](),controller['removeTags']);module[_0x4947('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0427b49..3933b8a 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 _0x99c9=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x5c306e,_0x2751c1){var _0x1a26e4=function(_0x2f8201){while(--_0x2f8201){_0x5c306e['push'](_0x5c306e['shift']());}};_0x1a26e4(++_0x2751c1);}(_0x99c9,0x13c));var _0x999c=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x99c9[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x999c('0x0'));module[_0x999c('0x1')]={'body':{'type':Sequelize[_0x999c('0x2')](_0x999c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x999c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x999c('0x5')]('in',_0x999c('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x999c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x999c('0x7')]}}; \ No newline at end of file +var _0x81d5=['out','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x81d5,0x1ab));var _0x581d=function(_0x18b9fd,_0xcf8c93){_0x18b9fd=_0x18b9fd-0x0;var _0x50d5d6=_0x81d5[_0x18b9fd];return _0x50d5d6;};'use strict';var Sequelize=require(_0x581d('0x0'));module[_0x581d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x581d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x581d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x581d('0x4')]('in',_0x581d('0x5')),'defaultValue':_0x581d('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e5bbf53..1c2b7f9 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 _0x594c=['motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','ContactId','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','join','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','FaxMessage','includeAll','include','findAll','rows','catch','show','params','options','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE: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','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel'];(function(_0x52ce5d,_0x2dda51){var _0x5df3ca=function(_0x5685bc){while(--_0x5685bc){_0x52ce5d['push'](_0x52ce5d['shift']());}};_0x5df3ca(++_0x2dda51);}(_0x594c,0x1d0));var _0xc594=function(_0x4485ce,_0x161251){_0x4485ce=_0x4485ce-0x0;var _0x744ad=_0x594c[_0x4485ce];return _0x744ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc594('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc594('0x1'));var rp=require('request-promise');var moment=require(_0xc594('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc594('0x3'));var path=require('path');var sox=require(_0xc594('0x4'));var csv=require(_0xc594('0x5'));var ejs=require(_0xc594('0x6'));var fs=require('fs');var fs_extra=require(_0xc594('0x7'));var _=require(_0xc594('0x8'));var squel=require('squel');var crypto=require(_0xc594('0x9'));var jsforce=require(_0xc594('0xa'));var deskjs=require(_0xc594('0xb'));var toCsv=require(_0xc594('0x5'));var querystring=require(_0xc594('0xc'));var Papa=require(_0xc594('0xd'));var Redis=require(_0xc594('0xe'));var authService=require(_0xc594('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc594('0x10'));var hardwareService=require(_0xc594('0x11'));var logger=require('../../config/logger')(_0xc594('0x12'));var utils=require(_0xc594('0x13'));var config=require(_0xc594('0x14'));var licenseUtil=require(_0xc594('0x15'));var db=require(_0xc594('0x16'))['db'];config[_0xc594('0x17')]=_[_0xc594('0x18')](config[_0xc594('0x17')],{'host':_0xc594('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc594('0x17')]));require(_0xc594('0x1a'))[_0xc594('0x1b')](socket);var jayson=require(_0xc594('0x1c'));var client=jayson[_0xc594('0x1d')][_0xc594('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xc594('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xbdd430,_0x4be8d8,_0x1fda96,_0x56972e){return new BPromise(function(_0x46f2bb,_0x238419){var _0x6ae1a5=_0x56972e||client;return _0x6ae1a5['request'](_0xbdd430,_0x1fda96)[_0xc594('0x1f')](function(_0x1ce655){logger[_0xc594('0x20')](_0xc594('0x21'),_0x4be8d8,_0xc594('0x22'));logger[_0xc594('0x23')](_0xc594('0x24'),_0x4be8d8,_0xc594('0x22'),JSON['stringify'](_0x1ce655));if(_0x1ce655[_0xc594('0x25')]){if(_0x1ce655[_0xc594('0x25')]['code']===0x1f4){logger['error'](_0xc594('0x21'),_0x4be8d8,_0x1ce655[_0xc594('0x25')][_0xc594('0x26')]);return _0x238419(_0x1ce655[_0xc594('0x25')][_0xc594('0x26')]);}logger[_0xc594('0x25')](_0xc594('0x21'),_0x4be8d8,_0x1ce655[_0xc594('0x25')][_0xc594('0x26')]);return _0x46f2bb(_0x1ce655['error']['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x4be8d8,_0xc594('0x22'));_0x46f2bb(_0x1ce655[_0xc594('0x27')][_0xc594('0x26')]);}})['catch'](function(_0xa8849c){logger[_0xc594('0x25')](_0xc594('0x21'),_0x4be8d8,_0xa8849c);_0x238419(_0xa8849c);});});}function respondWithStatusCode(_0x24137f,_0x24a54d){_0x24a54d=_0x24a54d||0xcc;return function(_0x2a53f9){if(_0x2a53f9){return _0x24137f[_0xc594('0x28')](_0x24a54d);}return _0x24137f['status'](_0x24a54d)[_0xc594('0x29')]();};}function respondWithResult(_0x16f369,_0x19f898){_0x19f898=_0x19f898||0xc8;return function(_0x3f6f05){if(_0x3f6f05){return _0x16f369[_0xc594('0x2a')](_0x19f898)[_0xc594('0x2b')](_0x3f6f05);}};}function respondWithFilteredResult(_0x208f49,_0x51b9be){return function(_0x57858f){if(_0x57858f){var _0xcfb733=typeof _0x51b9be[_0xc594('0x2c')]===_0xc594('0x2d')&&typeof _0x51b9be['limit']===_0xc594('0x2d');var _0x4e7428=_0x57858f[_0xc594('0x2e')];var _0x3bd772=_0xcfb733?0x0:_0x51b9be[_0xc594('0x2c')];var _0x14b45a=_0xcfb733?_0x57858f[_0xc594('0x2e')]:_0x51b9be[_0xc594('0x2c')]+_0x51b9be[_0xc594('0x2f')];var _0x3f8af6;if(_0x14b45a>=_0x4e7428){_0x14b45a=_0x4e7428;_0x3f8af6=0xc8;}else{_0x3f8af6=0xce;}_0x208f49['status'](_0x3f8af6);return _0x208f49[_0xc594('0x30')](_0xc594('0x31'),_0x3bd772+'-'+_0x14b45a+'/'+_0x4e7428)[_0xc594('0x2b')](_0x57858f);}return null;};}function patchUpdates(_0x1963ac){return function(_0x9b96f8){try{jsonpatch[_0xc594('0x32')](_0x9b96f8,_0x1963ac,!![]);}catch(_0x38def4){return BPromise[_0xc594('0x33')](_0x38def4);}return _0x9b96f8['save']();};}function saveUpdates(_0x2d4c93,_0x26908b){return function(_0x4b69ce){if(_0x4b69ce){return _0x4b69ce[_0xc594('0x34')](_0x2d4c93)[_0xc594('0x1f')](function(_0x2918d8){return _0x2918d8;});}return null;};}function removeEntity(_0x5f4fd5,_0x52916e){return function(_0x188a90){if(_0x188a90){return _0x188a90[_0xc594('0x35')]()[_0xc594('0x1f')](function(){_0x5f4fd5[_0xc594('0x2a')](0xcc)[_0xc594('0x29')]();});}};}function handleEntityNotFound(_0x2d51a3,_0x1df831){return function(_0x59fdd3){if(!_0x59fdd3){_0x2d51a3[_0xc594('0x28')](0x194);}return _0x59fdd3;};}function handleError(_0x2a2b60,_0xdfd41d){_0xdfd41d=_0xdfd41d||0x1f4;return function(_0x36dc7c){logger[_0xc594('0x25')](_0x36dc7c['stack']);if(_0x36dc7c['name']){delete _0x36dc7c[_0xc594('0x36')];}_0x2a2b60[_0xc594('0x2a')](_0xdfd41d)[_0xc594('0x37')](_0x36dc7c);};}exports[_0xc594('0x38')]=function(_0x2862e2,_0x3a8ca0){var _0x118d6d={},_0x3543e7={},_0x1135ed={'count':0x0,'rows':[]};var _0x361f47=_[_0xc594('0x39')](db['FaxMessage'][_0xc594('0x3a')],function(_0x2664f6){return{'name':_0x2664f6[_0xc594('0x3b')],'type':_0x2664f6[_0xc594('0x3c')][_0xc594('0x3d')]};});_0x3543e7[_0xc594('0x3e')]=_[_0xc594('0x39')](_0x361f47,'name');_0x3543e7[_0xc594('0x3f')]=_[_0xc594('0x40')](_0x2862e2[_0xc594('0x3f')]);_0x3543e7[_0xc594('0x41')]=_[_0xc594('0x42')](_0x3543e7[_0xc594('0x3e')],_0x3543e7['query']);_0x118d6d[_0xc594('0x43')]=_[_0xc594('0x42')](_0x3543e7[_0xc594('0x3e')],qs[_0xc594('0x44')](_0x2862e2['query'][_0xc594('0x44')]));_0x118d6d[_0xc594('0x43')]=_0x118d6d[_0xc594('0x43')][_0xc594('0x45')]?_0x118d6d[_0xc594('0x43')]:_0x3543e7[_0xc594('0x3e')];if(!_0x2862e2[_0xc594('0x3f')][_0xc594('0x46')](_0xc594('0x47'))){_0x118d6d['limit']=qs['limit'](_0x2862e2[_0xc594('0x3f')]['limit']);_0x118d6d['offset']=qs['offset'](_0x2862e2['query'][_0xc594('0x2c')]);}_0x118d6d['order']=qs['sort'](_0x2862e2[_0xc594('0x3f')][_0xc594('0x48')]);_0x118d6d[_0xc594('0x49')]=qs['filters'](_[_0xc594('0x4a')](_0x2862e2['query'],_0x3543e7['filters']),_0x361f47);if(_0x2862e2['query'][_0xc594('0x4b')]){_0x118d6d[_0xc594('0x49')]=_[_0xc594('0x4c')](_0x118d6d[_0xc594('0x49')],{'$or':_['map'](_0x361f47,function(_0x5e2d92){if(_0x5e2d92[_0xc594('0x3c')]!==_0xc594('0x4d')){var _0x51db39={};_0x51db39[_0x5e2d92[_0xc594('0x36')]]={'$like':'%'+_0x2862e2['query'][_0xc594('0x4b')]+'%'};return _0x51db39;}})});}_0x118d6d=_['merge']({},_0x118d6d,_0x2862e2['options']);var _0x4d491b={'where':_0x118d6d[_0xc594('0x49')]};return db[_0xc594('0x4e')][_0xc594('0x2e')](_0x4d491b)[_0xc594('0x1f')](function(_0x14d25a){_0x1135ed[_0xc594('0x2e')]=_0x14d25a;if(_0x2862e2[_0xc594('0x3f')][_0xc594('0x4f')]){_0x118d6d[_0xc594('0x50')]=[{'all':!![]}];}return db[_0xc594('0x4e')][_0xc594('0x51')](_0x118d6d);})[_0xc594('0x1f')](function(_0x4cfbca){_0x1135ed[_0xc594('0x52')]=_0x4cfbca;return _0x1135ed;})[_0xc594('0x1f')](respondWithFilteredResult(_0x3a8ca0,_0x118d6d))[_0xc594('0x53')](handleError(_0x3a8ca0,null));};exports[_0xc594('0x54')]=function(_0x5529b0,_0x309be2){var _0x5c8bab={'raw':!![],'where':{'id':_0x5529b0[_0xc594('0x55')]['id']}},_0x5c1119={};_0x5c1119[_0xc594('0x3e')]=_[_0xc594('0x40')](db[_0xc594('0x4e')][_0xc594('0x3a')]);_0x5c1119[_0xc594('0x3f')]=_[_0xc594('0x40')](_0x5529b0[_0xc594('0x3f')]);_0x5c1119[_0xc594('0x41')]=_['intersection'](_0x5c1119[_0xc594('0x3e')],_0x5c1119[_0xc594('0x3f')]);_0x5c8bab[_0xc594('0x43')]=_[_0xc594('0x42')](_0x5c1119[_0xc594('0x3e')],qs[_0xc594('0x44')](_0x5529b0[_0xc594('0x3f')]['fields']));_0x5c8bab[_0xc594('0x43')]=_0x5c8bab[_0xc594('0x43')][_0xc594('0x45')]?_0x5c8bab[_0xc594('0x43')]:_0x5c1119[_0xc594('0x3e')];if(_0x5529b0['query'][_0xc594('0x4f')]){_0x5c8bab[_0xc594('0x50')]=[{'all':!![]}];}_0x5c8bab=_['merge']({},_0x5c8bab,_0x5529b0[_0xc594('0x56')]);return db[_0xc594('0x4e')][_0xc594('0x57')](_0x5c8bab)[_0xc594('0x1f')](handleEntityNotFound(_0x309be2,null))['then'](respondWithResult(_0x309be2,null))[_0xc594('0x53')](handleError(_0x309be2,null));};exports[_0xc594('0x34')]=function(_0x1b0e97,_0x38a83e){if(_0x1b0e97[_0xc594('0x58')]['id']){delete _0x1b0e97[_0xc594('0x58')]['id'];}return db[_0xc594('0x4e')][_0xc594('0x57')]({'where':{'id':_0x1b0e97[_0xc594('0x55')]['id']}})[_0xc594('0x1f')](handleEntityNotFound(_0x38a83e,null))['then'](saveUpdates(_0x1b0e97[_0xc594('0x58')],null))['then'](respondWithResult(_0x38a83e,null))[_0xc594('0x53')](handleError(_0x38a83e,null));};exports[_0xc594('0x35')]=function(_0x5b195d,_0x3c1e23){return db[_0xc594('0x4e')][_0xc594('0x57')]({'where':{'id':_0x5b195d[_0xc594('0x55')]['id']}})[_0xc594('0x1f')](handleEntityNotFound(_0x3c1e23,null))['then'](removeEntity(_0x3c1e23,null))[_0xc594('0x53')](handleError(_0x3c1e23,null));};exports['describe']=function(_0x54c22d,_0x4cc8be){return db[_0xc594('0x4e')][_0xc594('0x59')]()[_0xc594('0x1f')](respondWithResult(_0x4cc8be,null))[_0xc594('0x53')](handleError(_0x4cc8be,null));};var interaction_log=require('../../config/logger')(_0xc594('0x5a'));exports[_0xc594('0x5b')]=function(_0x2c7d3e,_0x333468,_0xab0d32){var _0x4fb5a7={'agent':{},'channel':_0xc594('0x5c')};if(_0x2c7d3e[_0xc594('0x58')]['id']){delete _0x2c7d3e[_0xc594('0x58')]['id'];}_0x2c7d3e[_0xc594('0x58')][_0xc594('0x5d')]=!![];_0x2c7d3e[_0xc594('0x58')][_0xc594('0x5e')]=moment()[_0xc594('0x5f')](_0xc594('0x60'));_0x2c7d3e[_0xc594('0x58')]['UserId']=_0x2c7d3e[_0xc594('0x58')][_0xc594('0x61')]||_0x2c7d3e['user']['id'];_0x4fb5a7[_0xc594('0x62')]['id']=_0x2c7d3e['body'][_0xc594('0x61')];return db[_0xc594('0x4e')][_0xc594('0x57')]({'where':{'id':_0x2c7d3e[_0xc594('0x55')]['id'],'UserId':null}})[_0xc594('0x1f')](handleEntityNotFound(_0x333468,null))[_0xc594('0x1f')](saveUpdates(_0x2c7d3e[_0xc594('0x58')],null))['then'](function(_0xee8a3d){if(_0xee8a3d){_0x4fb5a7['message']=_0xee8a3d[_0xc594('0x63')]({'plain':!![]});return db[_0xc594('0x64')][_0xc594('0x57')]({'where':{'id':_0xee8a3d[_0xc594('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x333468,null))['then'](function(_0x15df47){if(_0x15df47){return _0x15df47['update']({'UserId':_0x2c7d3e[_0xc594('0x58')][_0xc594('0x61')],'read1stAt':_[_0xc594('0x66')](_0x15df47['read1stAt'])?moment()[_0xc594('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc594('0x1f')](function(_0x47c91e){if(_0x47c91e){_0x4fb5a7[_0xc594('0x67')]=_0x47c91e[_0xc594('0x63')]({'plain':!![]});interaction_log[_0xc594('0x20')](_0xc594('0x68'),_0x2c7d3e[_0xc594('0x69')]['id'],_0x2c7d3e[_0xc594('0x69')]['name'],_0x2c7d3e[_0xc594('0x69')][_0xc594('0x6a')],_0x4fb5a7[_0xc594('0x67')]['id'],_0x2c7d3e[_0xc594('0x58')]?JSON['stringify'](_0x2c7d3e[_0xc594('0x58')]):_0xc594('0x6b'));return respondWithRpcPromise(_0xc594('0x6c'),_0xc594('0x6d'),_0x4fb5a7);}return null;})[_0xc594('0x1f')](function(_0x5ee5a5){var _0x16f492=_0xc594('0x6e')+_0x5ee5a5[_0xc594('0x26')]['ContactId'];return db[_0xc594('0x6f')]['query'](_0x16f492,{'type':db[_0xc594('0x70')][_0xc594('0x71')][_0xc594('0x72')],'raw':!![]})[_0xc594('0x1f')](function(_0x4d20e2){return _0x4d20e2;});})['then'](function(_0x339a3f){if(_0x339a3f){_0x4fb5a7[_0xc594('0x26')][_0xc594('0x73')]=_0x339a3f[0x0];if(!_0x2c7d3e[_0xc594('0x58')][_0xc594('0x61')])return;return db[_0xc594('0x74')]['find']({'where':{'id':_0x2c7d3e[_0xc594('0x58')][_0xc594('0x61')],'role':_0xc594('0x62')},'attributes':['id','name',_0xc594('0x75'),_0xc594('0x76'),_0xc594('0x77')],'raw':!![]});}return null;})['then'](function(_0x56eb6d){if(!_0x56eb6d)return null;_0x4fb5a7[_0xc594('0x26')][_0xc594('0x62')]=_0x56eb6d;return _0x4fb5a7;})[_0xc594('0x1f')](function(_0x5559c9){if(_0x5559c9){if(_0x2c7d3e[_0xc594('0x58')][_0xc594('0x78')]){_0x4fb5a7[_0xc594('0x26')][_0xc594('0x79')]=util[_0xc594('0x5f')](_0xc594('0x7a'),_0x2c7d3e[_0xc594('0x69')]['name']);_0x4fb5a7[_0xc594('0x26')][_0xc594('0x7b')]=_0x4fb5a7[_0xc594('0x7b')];_0x4fb5a7['message'][_0xc594('0x7c')]=_0x4fb5a7[_0xc594('0x7b')];_0x4fb5a7['message'][_0xc594('0x7d')]=_0xc594('0x5b');return respondWithRpcPromise(_0xc594('0x7e'),_0xc594('0x7e'),{'event':_0xc594('0x7f'),'message':_0x4fb5a7[_0xc594('0x26')]},client9002)[_0xc594('0x1f')](function(){return _0x4fb5a7;});}return _0x4fb5a7;}return null;})[_0xc594('0x1f')](respondWithResult(_0x333468,null))[_0xc594('0x53')](handleError(_0x333468,null));};var interaction_log=require('../../config/logger')(_0xc594('0x5a'));exports[_0xc594('0x33')]=function(_0x12298f,_0x295aa2,_0x51b45e){var _0x415257={'agent':{},'channel':_0xc594('0x5c')};if(_0x12298f['body']['id']){delete _0x12298f[_0xc594('0x58')]['id'];}_0x12298f[_0xc594('0x58')][_0xc594('0x61')]=_0x12298f['body'][_0xc594('0x61')]||_0x12298f[_0xc594('0x69')]['id'];_0x415257[_0xc594('0x62')]['id']=_0x12298f[_0xc594('0x58')][_0xc594('0x61')];return db['FaxMessage'][_0xc594('0x57')]({'where':{'id':_0x12298f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x295aa2,null))[_0xc594('0x1f')](function(_0xd692aa){if(_0xd692aa){_0x415257[_0xc594('0x26')]=_0xd692aa['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0xd692aa[_0xc594('0x65')]}});}return null;})[_0xc594('0x1f')](handleEntityNotFound(_0x295aa2,null))[_0xc594('0x1f')](function(_0x9bdc39){if(_0x9bdc39){_0x415257[_0xc594('0x67')]=_0x9bdc39[_0xc594('0x63')]({'plain':!![]});interaction_log[_0xc594('0x20')](_0xc594('0x80'),_0x12298f[_0xc594('0x69')]['id'],_0x12298f[_0xc594('0x69')][_0xc594('0x36')],_0x12298f[_0xc594('0x69')][_0xc594('0x6a')],_0x415257[_0xc594('0x67')]['id'],_0x12298f[_0xc594('0x58')]?JSON[_0xc594('0x81')](_0x12298f[_0xc594('0x58')]):_0xc594('0x6b'));return respondWithRpcPromise(_0xc594('0x82'),_0xc594('0x83'),_0x415257);}return null;})[_0xc594('0x1f')](function(_0x451208){var _0x52bc85=_0xc594('0x6e')+_0x451208[_0xc594('0x26')][_0xc594('0x84')];return db[_0xc594('0x6f')][_0xc594('0x3f')](_0x52bc85,{'type':db[_0xc594('0x70')]['QueryTypes'][_0xc594('0x72')],'raw':!![]})[_0xc594('0x1f')](function(_0x57e19e){return _0x57e19e;});})[_0xc594('0x1f')](function(_0x5bb1c5){if(_0x5bb1c5){_0x415257[_0xc594('0x26')][_0xc594('0x73')]=_0x5bb1c5[0x0];if(!_0x12298f[_0xc594('0x58')][_0xc594('0x61')])return;return db[_0xc594('0x74')][_0xc594('0x57')]({'where':{'id':_0x12298f[_0xc594('0x58')][_0xc594('0x61')],'role':_0xc594('0x62')},'attributes':['id',_0xc594('0x36'),_0xc594('0x75'),_0xc594('0x76'),_0xc594('0x77')],'raw':!![]});}return null;})[_0xc594('0x1f')](function(_0x4cb405){if(!_0x4cb405)return null;_0x415257['message'][_0xc594('0x62')]=_0x4cb405;return _0x415257;})[_0xc594('0x1f')](function(_0x88d245){if(_0x88d245){_0x88d245[_0xc594('0x26')][_0xc594('0x79')]=util[_0xc594('0x5f')]('SIP/%s',_0x12298f[_0xc594('0x69')][_0xc594('0x36')]);_0x88d245[_0xc594('0x26')][_0xc594('0x7b')]=_0x415257[_0xc594('0x7b')];_0x88d245[_0xc594('0x26')][_0xc594('0x7c')]=_0x415257[_0xc594('0x7b')];_0x88d245[_0xc594('0x26')][_0xc594('0x7d')]=_0xc594('0x33');respondWithRpcPromise(_0xc594('0x7e'),'EventManager',{'event':_0xc594('0x85'),'message':_0x88d245[_0xc594('0x26')]},client9002);return _0x415257;}return null;})['then'](respondWithResult(_0x295aa2,null))[_0xc594('0x53')](handleError(_0x295aa2,null));};exports[_0xc594('0x86')]=function(_0x27826d,_0x26625b){var _0x7f0ce6;return db[_0xc594('0x4e')][_0xc594('0x86')](_0x27826d[_0xc594('0x58')],{})['then'](function(_0x4aa925){_0x7f0ce6=_0x4aa925;return db[_0xc594('0x87')][_0xc594('0x88')]({'where':{'id':_0x7f0ce6[_0xc594('0x84')]}});})[_0xc594('0x1f')](function(_0x24a230){if(_[_0xc594('0x66')](_0x24a230)){return;}else{_0x7f0ce6[_0xc594('0x5c')]=_0x24a230[_0xc594('0x5c')];return db[_0xc594('0x89')][_0xc594('0x88')]({'where':{'id':_0x7f0ce6[_0xc594('0x8a')]}});}})[_0xc594('0x1f')](function(_0x1737e7){return respondWithRpcPromise(_0xc594('0x8b'),'SendFax',{'FaxAccountId':_[_0xc594('0x66')](_0x27826d[_0xc594('0x58')])?undefined:_0x27826d[_0xc594('0x58')][_0xc594('0x8c')],'path':_[_0xc594('0x66')](_0x1737e7)?undefined:util[_0xc594('0x5f')](_0xc594('0x8d'),_0x1737e7[_0xc594('0x8e')]),'fax':_[_0xc594('0x66')](_0x7f0ce6['fax'])?undefined:_0x7f0ce6[_0xc594('0x5c')],'AttachmentId':_0x7f0ce6[_0xc594('0x8a')]},client9002);})[_0xc594('0x1f')](respondWithResult(_0x26625b,0xc9))['catch'](handleError(_0x26625b,null));};exports[_0xc594('0x8f')]=function(_0x306d18,_0x585590){var _0x30f87d=path['join'](config['root'],_0xc594('0x90'),_0xc594('0x91'),'attachments');return db[_0xc594('0x4e')][_0xc594('0x57')]({'where':{'id':_0x306d18[_0xc594('0x55')]['id']},'include':[{'model':db[_0xc594('0x89')],'as':_0xc594('0x89')}]})[_0xc594('0x1f')](handleEntityNotFound(_0x585590,null))[_0xc594('0x1f')](function(_0x24939c){if(_0x24939c){return _0x585590['download'](path[_0xc594('0x92')](_0x30f87d,_0x24939c[_0xc594('0x89')][_0xc594('0x8e')]));}})[_0xc594('0x53')](handleError(_0x585590,null));}; \ No newline at end of file +var _0xb73a=['basename','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','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','redis','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','include','body','params','describe','fax-interactions','fax','read','readAt','format','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[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','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','motionChannel','event','accept','EventManager','acceptmessage','find','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','interface','SIP/%s','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s'];(function(_0x41c4a6,_0xae9564){var _0x14d706=function(_0x229c97){while(--_0x229c97){_0x41c4a6['push'](_0x41c4a6['shift']());}};_0x14d706(++_0xae9564);}(_0xb73a,0x1ba));var _0xab73=function(_0xd83287,_0x1a8c39){_0xd83287=_0xd83287-0x0;var _0x419937=_0xb73a[_0xd83287];return _0x419937;};'use strict';var emlformat=require(_0xab73('0x0'));var rimraf=require(_0xab73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab73('0x2'));var rp=require(_0xab73('0x3'));var moment=require(_0xab73('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab73('0x5'));var util=require('util');var path=require(_0xab73('0x6'));var sox=require(_0xab73('0x7'));var csv=require(_0xab73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab73('0x9'));var _=require(_0xab73('0xa'));var squel=require(_0xab73('0xb'));var crypto=require('crypto');var jsforce=require(_0xab73('0xc'));var deskjs=require(_0xab73('0xd'));var toCsv=require(_0xab73('0x8'));var querystring=require('querystring');var Papa=require(_0xab73('0xe'));var Redis=require(_0xab73('0xf'));var authService=require(_0xab73('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xab73('0x11'));var hardwareService=require(_0xab73('0x12'));var logger=require(_0xab73('0x13'))(_0xab73('0x14'));var utils=require(_0xab73('0x15'));var config=require(_0xab73('0x16'));var licenseUtil=require(_0xab73('0x17'));var db=require(_0xab73('0x18'))['db'];config['redis']=_['defaults'](config[_0xab73('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xab73('0x1a'))(new Redis(config[_0xab73('0x19')]));require(_0xab73('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xab73('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xab73('0x1c')][_0xab73('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4a6150,_0x17dbe0,_0x4736a5,_0x2d9b5a){return new BPromise(function(_0xdba6f3,_0x1c52bd){var _0x585154=_0x2d9b5a||client;return _0x585154[_0xab73('0x1e')](_0x4a6150,_0x4736a5)[_0xab73('0x1f')](function(_0x2c13d1){logger[_0xab73('0x20')](_0xab73('0x21'),_0x17dbe0,_0xab73('0x22'));logger[_0xab73('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17dbe0,_0xab73('0x22'),JSON[_0xab73('0x24')](_0x2c13d1));if(_0x2c13d1[_0xab73('0x25')]){if(_0x2c13d1[_0xab73('0x25')][_0xab73('0x26')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x17dbe0,_0x2c13d1[_0xab73('0x25')][_0xab73('0x27')]);return _0x1c52bd(_0x2c13d1['error']['message']);}logger['error'](_0xab73('0x21'),_0x17dbe0,_0x2c13d1[_0xab73('0x25')][_0xab73('0x27')]);return _0xdba6f3(_0x2c13d1[_0xab73('0x25')][_0xab73('0x27')]);}else{logger[_0xab73('0x20')](_0xab73('0x21'),_0x17dbe0,_0xab73('0x22'));_0xdba6f3(_0x2c13d1[_0xab73('0x28')]['message']);}})[_0xab73('0x29')](function(_0xdf28d1){logger[_0xab73('0x25')](_0xab73('0x21'),_0x17dbe0,_0xdf28d1);_0x1c52bd(_0xdf28d1);});});}function respondWithStatusCode(_0xb56cfe,_0x45bbaf){_0x45bbaf=_0x45bbaf||0xcc;return function(_0x24b67a){if(_0x24b67a){return _0xb56cfe[_0xab73('0x2a')](_0x45bbaf);}return _0xb56cfe[_0xab73('0x2b')](_0x45bbaf)['end']();};}function respondWithResult(_0x5e147e,_0x2755cc){_0x2755cc=_0x2755cc||0xc8;return function(_0x497306){if(_0x497306){return _0x5e147e['status'](_0x2755cc)['json'](_0x497306);}};}function respondWithFilteredResult(_0x53916f,_0x390431){return function(_0x5e24a5){if(_0x5e24a5){var _0x4f69e3=typeof _0x390431[_0xab73('0x2c')]===_0xab73('0x2d')&&typeof _0x390431[_0xab73('0x2e')]===_0xab73('0x2d');var _0x1a307a=_0x5e24a5[_0xab73('0x2f')];var _0x4f512e=_0x4f69e3?0x0:_0x390431[_0xab73('0x2c')];var _0x33569a=_0x4f69e3?_0x5e24a5[_0xab73('0x2f')]:_0x390431[_0xab73('0x2c')]+_0x390431[_0xab73('0x2e')];var _0x4d823a;if(_0x33569a>=_0x1a307a){_0x33569a=_0x1a307a;_0x4d823a=0xc8;}else{_0x4d823a=0xce;}_0x53916f[_0xab73('0x2b')](_0x4d823a);return _0x53916f[_0xab73('0x30')](_0xab73('0x31'),_0x4f512e+'-'+_0x33569a+'/'+_0x1a307a)[_0xab73('0x32')](_0x5e24a5);}return null;};}function patchUpdates(_0x1c7d5f){return function(_0x5a9cb5){try{jsonpatch[_0xab73('0x33')](_0x5a9cb5,_0x1c7d5f,!![]);}catch(_0x1172e2){return BPromise[_0xab73('0x34')](_0x1172e2);}return _0x5a9cb5[_0xab73('0x35')]();};}function saveUpdates(_0x1502f0,_0x54a008){return function(_0x1abf22){if(_0x1abf22){return _0x1abf22[_0xab73('0x36')](_0x1502f0)[_0xab73('0x1f')](function(_0x53f9dc){return _0x53f9dc;});}return null;};}function removeEntity(_0x5725a9,_0x15e541){return function(_0x5a429f){if(_0x5a429f){return _0x5a429f[_0xab73('0x37')]()[_0xab73('0x1f')](function(){_0x5725a9[_0xab73('0x2b')](0xcc)[_0xab73('0x38')]();});}};}function handleEntityNotFound(_0x44719a,_0x4c924b){return function(_0x2647a9){if(!_0x2647a9){_0x44719a['sendStatus'](0x194);}return _0x2647a9;};}function handleError(_0x3a5981,_0x3b3aeb){_0x3b3aeb=_0x3b3aeb||0x1f4;return function(_0x379c07){logger[_0xab73('0x25')](_0x379c07['stack']);if(_0x379c07[_0xab73('0x39')]){delete _0x379c07[_0xab73('0x39')];}_0x3a5981[_0xab73('0x2b')](_0x3b3aeb)[_0xab73('0x3a')](_0x379c07);};}exports['index']=function(_0xb9d826,_0x4a12a4){var _0x39ecac={},_0x5e5d78={},_0x4a89c8={'count':0x0,'rows':[]};var _0x2517a8=_[_0xab73('0x3b')](db[_0xab73('0x3c')][_0xab73('0x3d')],function(_0x5064ef){return{'name':_0x5064ef[_0xab73('0x3e')],'type':_0x5064ef[_0xab73('0x3f')][_0xab73('0x40')]};});_0x5e5d78[_0xab73('0x41')]=_['map'](_0x2517a8,_0xab73('0x39'));_0x5e5d78[_0xab73('0x42')]=_[_0xab73('0x43')](_0xb9d826[_0xab73('0x42')]);_0x5e5d78[_0xab73('0x44')]=_[_0xab73('0x45')](_0x5e5d78[_0xab73('0x41')],_0x5e5d78[_0xab73('0x42')]);_0x39ecac[_0xab73('0x46')]=_[_0xab73('0x45')](_0x5e5d78[_0xab73('0x41')],qs['fields'](_0xb9d826['query'][_0xab73('0x47')]));_0x39ecac[_0xab73('0x46')]=_0x39ecac[_0xab73('0x46')]['length']?_0x39ecac['attributes']:_0x5e5d78[_0xab73('0x41')];if(!_0xb9d826[_0xab73('0x42')][_0xab73('0x48')](_0xab73('0x49'))){_0x39ecac[_0xab73('0x2e')]=qs['limit'](_0xb9d826[_0xab73('0x42')][_0xab73('0x2e')]);_0x39ecac['offset']=qs[_0xab73('0x2c')](_0xb9d826['query'][_0xab73('0x2c')]);}_0x39ecac[_0xab73('0x4a')]=qs[_0xab73('0x4b')](_0xb9d826[_0xab73('0x42')]['sort']);_0x39ecac[_0xab73('0x4c')]=qs[_0xab73('0x44')](_[_0xab73('0x4d')](_0xb9d826[_0xab73('0x42')],_0x5e5d78[_0xab73('0x44')]),_0x2517a8);if(_0xb9d826[_0xab73('0x42')][_0xab73('0x4e')]){_0x39ecac[_0xab73('0x4c')]=_[_0xab73('0x4f')](_0x39ecac[_0xab73('0x4c')],{'$or':_[_0xab73('0x3b')](_0x2517a8,function(_0x12ab34){if(_0x12ab34[_0xab73('0x3f')]!=='VIRTUAL'){var _0x445929={};_0x445929[_0x12ab34[_0xab73('0x39')]]={'$like':'%'+_0xb9d826[_0xab73('0x42')][_0xab73('0x4e')]+'%'};return _0x445929;}})});}_0x39ecac=_[_0xab73('0x4f')]({},_0x39ecac,_0xb9d826[_0xab73('0x50')]);var _0x515112={'where':_0x39ecac[_0xab73('0x4c')]};return db['FaxMessage']['count'](_0x515112)[_0xab73('0x1f')](function(_0x338b4b){_0x4a89c8[_0xab73('0x2f')]=_0x338b4b;if(_0xb9d826[_0xab73('0x42')][_0xab73('0x51')]){_0x39ecac['include']=[{'all':!![]}];}return db[_0xab73('0x3c')][_0xab73('0x52')](_0x39ecac);})[_0xab73('0x1f')](function(_0x5c3e9d){_0x4a89c8[_0xab73('0x53')]=_0x5c3e9d;return _0x4a89c8;})['then'](respondWithFilteredResult(_0x4a12a4,_0x39ecac))[_0xab73('0x29')](handleError(_0x4a12a4,null));};exports['show']=function(_0x36c332,_0x4eb4ad){var _0x19e41d={'raw':!![],'where':{'id':_0x36c332['params']['id']}},_0x1b2641={};_0x1b2641['model']=_['keys'](db[_0xab73('0x3c')][_0xab73('0x3d')]);_0x1b2641[_0xab73('0x42')]=_[_0xab73('0x43')](_0x36c332[_0xab73('0x42')]);_0x1b2641['filters']=_['intersection'](_0x1b2641[_0xab73('0x41')],_0x1b2641['query']);_0x19e41d[_0xab73('0x46')]=_[_0xab73('0x45')](_0x1b2641[_0xab73('0x41')],qs[_0xab73('0x47')](_0x36c332['query']['fields']));_0x19e41d['attributes']=_0x19e41d['attributes']['length']?_0x19e41d[_0xab73('0x46')]:_0x1b2641[_0xab73('0x41')];if(_0x36c332[_0xab73('0x42')][_0xab73('0x51')]){_0x19e41d[_0xab73('0x54')]=[{'all':!![]}];}_0x19e41d=_[_0xab73('0x4f')]({},_0x19e41d,_0x36c332['options']);return db[_0xab73('0x3c')]['find'](_0x19e41d)[_0xab73('0x1f')](handleEntityNotFound(_0x4eb4ad,null))[_0xab73('0x1f')](respondWithResult(_0x4eb4ad,null))[_0xab73('0x29')](handleError(_0x4eb4ad,null));};exports[_0xab73('0x36')]=function(_0x354976,_0x1e14d3){if(_0x354976[_0xab73('0x55')]['id']){delete _0x354976[_0xab73('0x55')]['id'];}return db[_0xab73('0x3c')]['find']({'where':{'id':_0x354976[_0xab73('0x56')]['id']}})['then'](handleEntityNotFound(_0x1e14d3,null))[_0xab73('0x1f')](saveUpdates(_0x354976[_0xab73('0x55')],null))[_0xab73('0x1f')](respondWithResult(_0x1e14d3,null))['catch'](handleError(_0x1e14d3,null));};exports[_0xab73('0x37')]=function(_0x279e64,_0x5523ba){return db[_0xab73('0x3c')]['find']({'where':{'id':_0x279e64['params']['id']}})['then'](handleEntityNotFound(_0x5523ba,null))[_0xab73('0x1f')](removeEntity(_0x5523ba,null))[_0xab73('0x29')](handleError(_0x5523ba,null));};exports[_0xab73('0x57')]=function(_0x365527,_0x52f250){return db[_0xab73('0x3c')][_0xab73('0x57')]()['then'](respondWithResult(_0x52f250,null))[_0xab73('0x29')](handleError(_0x52f250,null));};var interaction_log=require(_0xab73('0x13'))(_0xab73('0x58'));exports['accept']=function(_0x534202,_0x45f1ad,_0x320839){var _0x490a13={'agent':{},'channel':_0xab73('0x59')};if(_0x534202[_0xab73('0x55')]['id']){delete _0x534202['body']['id'];}_0x534202[_0xab73('0x55')][_0xab73('0x5a')]=!![];_0x534202[_0xab73('0x55')][_0xab73('0x5b')]=moment()[_0xab73('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x534202[_0xab73('0x55')][_0xab73('0x5d')]=_0x534202[_0xab73('0x55')]['UserId']||_0x534202[_0xab73('0x5e')]['id'];_0x490a13[_0xab73('0x5f')]['id']=_0x534202[_0xab73('0x55')][_0xab73('0x5d')];return db[_0xab73('0x3c')]['find']({'where':{'id':_0x534202[_0xab73('0x56')]['id'],'UserId':null}})[_0xab73('0x1f')](handleEntityNotFound(_0x45f1ad,null))[_0xab73('0x1f')](saveUpdates(_0x534202[_0xab73('0x55')],null))['then'](function(_0x40850b){if(_0x40850b){_0x490a13[_0xab73('0x27')]=_0x40850b['get']({'plain':!![]});return db[_0xab73('0x60')]['find']({'where':{'id':_0x40850b[_0xab73('0x61')]}});}return null;})[_0xab73('0x1f')](handleEntityNotFound(_0x45f1ad,null))[_0xab73('0x1f')](function(_0x5266d4){if(_0x5266d4){return _0x5266d4[_0xab73('0x36')]({'UserId':_0x534202[_0xab73('0x55')][_0xab73('0x5d')],'read1stAt':_[_0xab73('0x62')](_0x5266d4[_0xab73('0x63')])?moment()['format'](_0xab73('0x64')):undefined});}return null;})[_0xab73('0x1f')](function(_0x1f759d){if(_0x1f759d){_0x490a13[_0xab73('0x65')]=_0x1f759d[_0xab73('0x66')]({'plain':!![]});interaction_log[_0xab73('0x20')](_0xab73('0x67'),_0x534202['user']['id'],_0x534202[_0xab73('0x5e')][_0xab73('0x39')],_0x534202['user'][_0xab73('0x68')],_0x490a13['interaction']['id'],_0x534202[_0xab73('0x55')]?JSON[_0xab73('0x24')](_0x534202[_0xab73('0x55')]):_0xab73('0x69'));return respondWithRpcPromise(_0xab73('0x6a'),'acceptMessage',_0x490a13);}return null;})[_0xab73('0x1f')](function(_0x57470d){var _0x19f043=_0xab73('0x6b')+_0x57470d[_0xab73('0x27')][_0xab73('0x6c')];return db['sequelize']['query'](_0x19f043,{'type':db[_0xab73('0x6d')][_0xab73('0x6e')][_0xab73('0x6f')],'raw':!![]})[_0xab73('0x1f')](function(_0x470810){return _0x470810;});})[_0xab73('0x1f')](function(_0x3b6f4d){if(_0x3b6f4d){_0x490a13[_0xab73('0x27')][_0xab73('0x70')]=_0x3b6f4d[0x0];if(!_0x534202['body']['UserId'])return;return db[_0xab73('0x71')]['find']({'where':{'id':_0x534202[_0xab73('0x55')]['UserId'],'role':_0xab73('0x5f')},'attributes':['id',_0xab73('0x39'),_0xab73('0x72'),_0xab73('0x73'),_0xab73('0x74')],'raw':!![]});}return null;})[_0xab73('0x1f')](function(_0x458624){if(!_0x458624)return null;_0x490a13[_0xab73('0x27')]['agent']=_0x458624;return _0x490a13;})[_0xab73('0x1f')](function(_0x15fcc7){if(_0x15fcc7){if(_0x534202[_0xab73('0x55')][_0xab73('0x75')]){_0x490a13['message']['interface']=util[_0xab73('0x5c')]('SIP/%s',_0x534202['user'][_0xab73('0x39')]);_0x490a13[_0xab73('0x27')][_0xab73('0x76')]=_0x490a13[_0xab73('0x76')];_0x490a13['message'][_0xab73('0x77')]=_0x490a13[_0xab73('0x76')];_0x490a13[_0xab73('0x27')][_0xab73('0x78')]=_0xab73('0x79');return respondWithRpcPromise('EventManager',_0xab73('0x7a'),{'event':_0xab73('0x7b'),'message':_0x490a13[_0xab73('0x27')]},client9002)[_0xab73('0x1f')](function(){return _0x490a13;});}return _0x490a13;}return null;})['then'](respondWithResult(_0x45f1ad,null))[_0xab73('0x29')](handleError(_0x45f1ad,null));};var interaction_log=require(_0xab73('0x13'))(_0xab73('0x58'));exports[_0xab73('0x34')]=function(_0xe1d73a,_0x3ca6c2,_0x82933e){var _0x4a6ec2={'agent':{},'channel':_0xab73('0x59')};if(_0xe1d73a[_0xab73('0x55')]['id']){delete _0xe1d73a[_0xab73('0x55')]['id'];}_0xe1d73a['body'][_0xab73('0x5d')]=_0xe1d73a[_0xab73('0x55')][_0xab73('0x5d')]||_0xe1d73a[_0xab73('0x5e')]['id'];_0x4a6ec2[_0xab73('0x5f')]['id']=_0xe1d73a[_0xab73('0x55')][_0xab73('0x5d')];return db[_0xab73('0x3c')][_0xab73('0x7c')]({'where':{'id':_0xe1d73a[_0xab73('0x56')]['id'],'UserId':null}})[_0xab73('0x1f')](handleEntityNotFound(_0x3ca6c2,null))['then'](function(_0x5ecea1){if(_0x5ecea1){_0x4a6ec2[_0xab73('0x27')]=_0x5ecea1[_0xab73('0x66')]({'plain':!![]});return db[_0xab73('0x60')]['find']({'where':{'id':_0x5ecea1[_0xab73('0x61')]}});}return null;})[_0xab73('0x1f')](handleEntityNotFound(_0x3ca6c2,null))[_0xab73('0x1f')](function(_0x3f67ae){if(_0x3f67ae){_0x4a6ec2['interaction']=_0x3f67ae[_0xab73('0x66')]({'plain':!![]});interaction_log[_0xab73('0x20')](_0xab73('0x7d'),_0xe1d73a[_0xab73('0x5e')]['id'],_0xe1d73a['user'][_0xab73('0x39')],_0xe1d73a['user'][_0xab73('0x68')],_0x4a6ec2[_0xab73('0x65')]['id'],_0xe1d73a['body']?JSON[_0xab73('0x24')](_0xe1d73a[_0xab73('0x55')]):_0xab73('0x69'));return respondWithRpcPromise(_0xab73('0x7e'),'rejectMessage',_0x4a6ec2);}return null;})[_0xab73('0x1f')](function(_0x1337eb){var _0x4f2f98='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1337eb[_0xab73('0x27')][_0xab73('0x6c')];return db[_0xab73('0x7f')][_0xab73('0x42')](_0x4f2f98,{'type':db[_0xab73('0x6d')][_0xab73('0x6e')][_0xab73('0x6f')],'raw':!![]})['then'](function(_0x51a262){return _0x51a262;});})[_0xab73('0x1f')](function(_0x3f079e){if(_0x3f079e){_0x4a6ec2[_0xab73('0x27')][_0xab73('0x70')]=_0x3f079e[0x0];if(!_0xe1d73a[_0xab73('0x55')]['UserId'])return;return db[_0xab73('0x71')]['find']({'where':{'id':_0xe1d73a[_0xab73('0x55')][_0xab73('0x5d')],'role':'agent'},'attributes':['id',_0xab73('0x39'),_0xab73('0x72'),'email',_0xab73('0x74')],'raw':!![]});}return null;})[_0xab73('0x1f')](function(_0x449d55){if(!_0x449d55)return null;_0x4a6ec2[_0xab73('0x27')]['agent']=_0x449d55;return _0x4a6ec2;})[_0xab73('0x1f')](function(_0x391359){if(_0x391359){_0x391359[_0xab73('0x27')][_0xab73('0x80')]=util[_0xab73('0x5c')](_0xab73('0x81'),_0xe1d73a[_0xab73('0x5e')][_0xab73('0x39')]);_0x391359[_0xab73('0x27')][_0xab73('0x76')]=_0x4a6ec2[_0xab73('0x76')];_0x391359[_0xab73('0x27')][_0xab73('0x77')]=_0x4a6ec2['channel'];_0x391359[_0xab73('0x27')][_0xab73('0x78')]=_0xab73('0x34');respondWithRpcPromise(_0xab73('0x7a'),_0xab73('0x7a'),{'event':'rejectmessage','message':_0x391359[_0xab73('0x27')]},client9002);return _0x4a6ec2;}return null;})[_0xab73('0x1f')](respondWithResult(_0x3ca6c2,null))[_0xab73('0x29')](handleError(_0x3ca6c2,null));};exports[_0xab73('0x82')]=function(_0x275a5a,_0x37361d){var _0x50735d;return db[_0xab73('0x3c')]['create'](_0x275a5a[_0xab73('0x55')],{})[_0xab73('0x1f')](function(_0x13417a){_0x50735d=_0x13417a;return db[_0xab73('0x83')]['findOne']({'where':{'id':_0x50735d[_0xab73('0x6c')]}});})[_0xab73('0x1f')](function(_0x2b4c6a){if(_['isNil'](_0x2b4c6a)){return;}else{_0x50735d[_0xab73('0x59')]=_0x2b4c6a[_0xab73('0x59')];return db[_0xab73('0x84')][_0xab73('0x85')]({'where':{'id':_0x50735d[_0xab73('0x86')]}});}})[_0xab73('0x1f')](function(_0x596654){return respondWithRpcPromise('SendFax',_0xab73('0x87'),{'FaxAccountId':_['isNil'](_0x275a5a[_0xab73('0x55')])?undefined:_0x275a5a['body'][_0xab73('0x88')],'path':_[_0xab73('0x62')](_0x596654)?undefined:util['format'](_0xab73('0x89'),_0x596654[_0xab73('0x8a')]),'fax':_[_0xab73('0x62')](_0x50735d[_0xab73('0x59')])?undefined:_0x50735d['fax'],'AttachmentId':_0x50735d[_0xab73('0x86')]},client9002);})[_0xab73('0x1f')](respondWithResult(_0x37361d,0xc9))[_0xab73('0x29')](handleError(_0x37361d,null));};exports[_0xab73('0x8b')]=function(_0x2a751e,_0x471837){var _0x548a63=path[_0xab73('0x8c')](config[_0xab73('0x8d')],_0xab73('0x8e'),_0xab73('0x8f'),_0xab73('0x90'));return db[_0xab73('0x3c')]['find']({'where':{'id':_0x2a751e[_0xab73('0x56')]['id']},'include':[{'model':db[_0xab73('0x84')],'as':_0xab73('0x84')}]})[_0xab73('0x1f')](handleEntityNotFound(_0x471837,null))['then'](function(_0x509917){if(_0x509917){return _0x471837['download'](path[_0xab73('0x8c')](_0x548a63,_0x509917[_0xab73('0x84')][_0xab73('0x8a')]));}})[_0xab73('0x29')](handleError(_0x471837,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 83b89f3..d65cb5f 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 _0x6132=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x14d737,_0xfe42f0){var _0xb3a324=function(_0x152966){while(--_0x152966){_0x14d737['push'](_0x14d737['shift']());}};_0xb3a324(++_0xfe42f0);}(_0x6132,0x13a));var _0x2613=function(_0x25e4a2,_0x2beacf){_0x25e4a2=_0x25e4a2-0x0;var _0x25c92d=_0x6132[_0x25e4a2];return _0x25c92d;};'use strict';var EventEmitter=require(_0x2613('0x0'));var FaxMessage=require(_0x2613('0x1'))['db'][_0x2613('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2613('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2613('0x4'),'afterDestroy':_0x2613('0x5')};function emitEvent(_0x2890f9){return function(_0x35c979,_0x555746,_0x8d00d8){FaxMessageEvents['emit'](_0x2890f9+':'+_0x35c979['id'],_0x35c979);FaxMessageEvents['emit'](_0x2890f9,_0x35c979);_0x8d00d8(null);};}for(var e in events){if(events[_0x2613('0x6')](e)){var event=events[e];FaxMessage[_0x2613('0x7')](e,emitEvent(event));}}module[_0x2613('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xd9ce=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x227d62,_0x1a9c9e){var _0x1a9d18=function(_0x376c93){while(--_0x376c93){_0x227d62['push'](_0x227d62['shift']());}};_0x1a9d18(++_0x1a9c9e);}(_0xd9ce,0xeb));var _0xed9c=function(_0x2245c7,_0x47951d){_0x2245c7=_0x2245c7-0x0;var _0x267daa=_0xd9ce[_0x2245c7];return _0x267daa;};'use strict';var EventEmitter=require(_0xed9c('0x0'));var FaxMessage=require(_0xed9c('0x1'))['db'][_0xed9c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xed9c('0x3')](0x0);var events={'afterCreate':_0xed9c('0x4'),'afterUpdate':_0xed9c('0x5'),'afterDestroy':_0xed9c('0x6')};function emitEvent(_0x1cd5b5){return function(_0x5903b6,_0x3c9c4a,_0xd13461){FaxMessageEvents[_0xed9c('0x7')](_0x1cd5b5+':'+_0x5903b6['id'],_0x5903b6);FaxMessageEvents[_0xed9c('0x7')](_0x1cd5b5,_0x5903b6);_0xd13461(null);};}for(var e in events){if(events[_0xed9c('0x8')](e)){var event=events[e];FaxMessage[_0xed9c('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 1ed6f45..94be400 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 _0x1b4a=['then','update','createdAt','error','utf8mb4','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne'];(function(_0x176332,_0x402630){var _0x1112ef=function(_0x1b1b78){while(--_0x1b1b78){_0x176332['push'](_0x176332['shift']());}};_0x1112ef(++_0x402630);}(_0x1b4a,0x195));var _0xa1b4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1b4a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1b4('0x0'))(_0xa1b4('0x1'));var moment=require('moment');var BPromise=require(_0xa1b4('0x2'));var rp=require(_0xa1b4('0x3'));var fs=require('fs');var path=require(_0xa1b4('0x4'));var rimraf=require(_0xa1b4('0x5'));var config=require(_0xa1b4('0x6'));var attributes=require('./faxMessage.attributes');module[_0xa1b4('0x7')]=function(_0x2c41fe,_0x285f6f){return _0x2c41fe[_0xa1b4('0x8')](_0xa1b4('0x9'),attributes,{'tableName':_0xa1b4('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xa1b4('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x211c74,_0x480901,_0x30d1ce){var _0x2fd1a8=_0x2c41fe['models'];var _0x501f1a=_0x211c74[_0xa1b4('0xc')]({'plain':!![]});if(_0x501f1a[_0xa1b4('0xd')][_0xa1b4('0xe')]()==='in'||_0x501f1a['direction']['toLowerCase']()===_0xa1b4('0xf')&&!_0x501f1a['secret']&&!_[_0xa1b4('0x10')](_0x501f1a[_0xa1b4('0x11')])){_0x2fd1a8[_0xa1b4('0x12')][_0xa1b4('0x13')]({'where':{'id':_0x501f1a['FaxInteractionId']}})[_0xa1b4('0x14')](function(_0x4f77f3){if(_0x4f77f3){_0x4f77f3[_0xa1b4('0x15')]({'lastMsgAt':_0x501f1a[_0xa1b4('0x16')],'lastMsgDirection':_0x501f1a[_0xa1b4('0xd')][_0xa1b4('0xe')]()});}})['catch'](function(_0x1604c8){console[_0xa1b4('0x17')](_0x1604c8);});}_0x30d1ce();}},'charset':_0xa1b4('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9a75=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','catch','error','utf8mb4'];(function(_0x3e9155,_0x38e9d2){var _0x5de67a=function(_0x177031){while(--_0x177031){_0x3e9155['push'](_0x3e9155['shift']());}};_0x5de67a(++_0x38e9d2);}(_0x9a75,0x6d));var _0x59a7=function(_0x595a9f,_0x4f728e){_0x595a9f=_0x595a9f-0x0;var _0x4fcafb=_0x9a75[_0x595a9f];return _0x4fcafb;};'use strict';var _=require(_0x59a7('0x0'));var util=require(_0x59a7('0x1'));var logger=require(_0x59a7('0x2'))('api');var moment=require(_0x59a7('0x3'));var BPromise=require(_0x59a7('0x4'));var rp=require(_0x59a7('0x5'));var fs=require('fs');var path=require(_0x59a7('0x6'));var rimraf=require(_0x59a7('0x7'));var config=require('../../config/environment');var attributes=require(_0x59a7('0x8'));module[_0x59a7('0x9')]=function(_0x220677,_0x1ceb54){return _0x220677[_0x59a7('0xa')](_0x59a7('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x59a7('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x563282,_0x4a00fa,_0xdddc07){var _0x369d39=_0x220677['models'];var _0x304452=_0x563282[_0x59a7('0xd')]({'plain':!![]});if(_0x304452[_0x59a7('0xe')]['toLowerCase']()==='in'||_0x304452[_0x59a7('0xe')][_0x59a7('0xf')]()==='out'&&!_0x304452[_0x59a7('0x10')]&&!_[_0x59a7('0x11')](_0x304452[_0x59a7('0x12')])){_0x369d39[_0x59a7('0x13')]['findOne']({'where':{'id':_0x304452[_0x59a7('0x14')]}})[_0x59a7('0x15')](function(_0x114cbc){if(_0x114cbc){_0x114cbc['update']({'lastMsgAt':_0x304452[_0x59a7('0x16')],'lastMsgDirection':_0x304452[_0x59a7('0xe')][_0x59a7('0xf')]()});}})[_0x59a7('0x17')](function(_0x3414e1){console[_0x59a7('0x18')](_0x3414e1);});}_0xdddc07();}},'charset':_0x59a7('0x19'),'collate':_0x59a7('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d76a44e..3aa3213 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 _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','code','error','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','ioredis'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x55ca,0x126));var _0xa55c=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x55ca[_0x17b0d4];return _0x2d02c7;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});config[_0xa55c('0xa')]=_['defaults'](config[_0xa55c('0xa')],{'host':_0xa55c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0xa')]));require(_0xa55c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5849ad,_0x473d0e,_0x20c76a){return new BPromise(function(_0x381d07,_0x5d8e5a){return client[_0xa55c('0xd')](_0x5849ad,_0x20c76a)[_0xa55c('0xe')](function(_0x508342){logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x473d0e,_0xa55c('0x11'),JSON['stringify'](_0x508342));if(_0x508342['error']){if(_0x508342['error'][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x5d8e5a(_0x508342[_0xa55c('0x13')]['message']);}logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x381d07(_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);}else{logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));_0x381d07(_0x508342['result'][_0xa55c('0x14')]);}})[_0xa55c('0x15')](function(_0x461284){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x461284);_0x5d8e5a(_0x461284);});});}exports[_0xa55c('0x16')]=function(_0x4c0daf){var _0x5f5158=this;return new Promise(function(_0xd643cc,_0x3776ac){return db[_0xa55c('0x17')]['create'](_0x4c0daf[_0xa55c('0x18')],{'raw':_0x4c0daf[_0xa55c('0x19')]?_0x4c0daf['options'][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})[_0xa55c('0xe')](function(_0x940f28){logger[_0xa55c('0xf')](_0xa55c('0x16'),_0x4c0daf);logger['debug'](_0xa55c('0x16'),_0x4c0daf,JSON['stringify'](_0x940f28));_0xd643cc(_0x940f28);})['catch'](function(_0x59d89a){logger[_0xa55c('0x13')]('CreateFaxMessage',_0x59d89a[_0xa55c('0x14')],_0x4c0daf);_0x3776ac(_0x5f5158[_0xa55c('0x13')](0x1f4,_0x59d89a[_0xa55c('0x14')]));});});};exports[_0xa55c('0x1b')]=function(_0x2313a9){var _0x170ba4=this;return new Promise(function(_0x1da633,_0x11e7f7){return db[_0xa55c('0x17')][_0xa55c('0x1c')](_0x2313a9[_0xa55c('0x18')],{'raw':_0x2313a9['options']?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')]['where']||null:null,'attributes':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1d')]||null:null,'limit':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1e')]||null:null})['then'](function(_0x23e698){logger['info'](_0xa55c('0x1b'),_0x2313a9);logger[_0xa55c('0x1f')](_0xa55c('0x1b'),_0x2313a9,JSON[_0xa55c('0x20')](_0x23e698));_0x1da633(_0x23e698);})['catch'](function(_0x3d28fb){logger[_0xa55c('0x13')](_0xa55c('0x1b'),_0x3d28fb[_0xa55c('0x14')],_0x2313a9);_0x11e7f7(_0x170ba4[_0xa55c('0x13')](0x1f4,_0x3d28fb[_0xa55c('0x14')]));});});}; \ No newline at end of file +var _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x179195,_0x56b7d2){var _0x3dd26e=function(_0x4554f5){while(--_0x4554f5){_0x179195['push'](_0x179195['shift']());}};_0x3dd26e(++_0x56b7d2);}(_0x032e,0x124));var _0xe032=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x032e[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4daeeec..13ac472 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 _0x5cfe=['emit','register','length','./faxMessage.events','save','remove','update'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5cfe,0x199));var _0xe5cf=function(_0x39cd83,_0x1bc1c2){_0x39cd83=_0x39cd83-0x0;var _0xb864ea=_0x5cfe[_0x39cd83];return _0xb864ea;};'use strict';var FaxMessageEvents=require(_0xe5cf('0x0'));var events=[_0xe5cf('0x1'),_0xe5cf('0x2'),_0xe5cf('0x3')];function createListener(_0x29e3b5,_0x3b656f){return function(_0x380543){_0x3b656f[_0xe5cf('0x4')](_0x29e3b5,_0x380543);};}function removeListener(_0x565cf1,_0x3a450a){return function(){FaxMessageEvents['removeListener'](_0x565cf1,_0x3a450a);};}exports[_0xe5cf('0x5')]=function(_0x13f9cc){for(var _0x592771=0x0,_0x470c41=events[_0xe5cf('0x6')];_0x592771<_0x470c41;_0x592771++){var _0x523c26=events[_0x592771];var _0x1a65a1=createListener('faxMessage:'+_0x523c26,_0x13f9cc);FaxMessageEvents['on'](_0x523c26,_0x1a65a1);}}; \ No newline at end of file +var _0xb977=['./faxMessage.events','remove','emit','length','faxMessage:'];(function(_0x2b18d8,_0x21778e){var _0x2bcce2=function(_0xc14e4b){while(--_0xc14e4b){_0x2b18d8['push'](_0x2b18d8['shift']());}};_0x2bcce2(++_0x21778e);}(_0xb977,0xa5));var _0x7b97=function(_0x331bbd,_0x25112e){_0x331bbd=_0x331bbd-0x0;var _0x467262=_0xb977[_0x331bbd];return _0x467262;};'use strict';var FaxMessageEvents=require(_0x7b97('0x0'));var events=['save',_0x7b97('0x1'),'update'];function createListener(_0x4264b6,_0x3d12c3){return function(_0x3f4036){_0x3d12c3[_0x7b97('0x2')](_0x4264b6,_0x3f4036);};}function removeListener(_0x57e344,_0x258f0d){return function(){FaxMessageEvents['removeListener'](_0x57e344,_0x258f0d);};}exports['register']=function(_0x38b8b1){for(var _0x3530c3=0x0,_0x2ab54f=events[_0x7b97('0x3')];_0x3530c3<_0x2ab54f;_0x3530c3++){var _0x145ad3=events[_0x3530c3];var _0xb40471=createListener(_0x7b97('0x4')+_0x145ad3,_0x38b8b1);FaxMessageEvents['on'](_0x145ad3,_0xb40471);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 07f387d..dc7c6f8 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 _0xde2c=['/describe','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0x52a505,_0x17aca7){var _0x1a4057=function(_0xe1b13f){while(--_0xe1b13f){_0x52a505['push'](_0x52a505['shift']());}};_0x1a4057(++_0x17aca7);}(_0xde2c,0x7f));var _0xcde2=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xde2c[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xcde2('0x13'),_0xcde2('0x14')),controller[_0xcde2('0x15')]);router[_0xcde2('0x16')](_0xcde2('0x17'),auth[_0xcde2('0xb')](),controller['update']);router[_0xcde2('0x16')]('/:id/accept',auth[_0xcde2('0xb')](),controller['accept']);router['put'](_0xcde2('0x18'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x19')]);router[_0xcde2('0x1a')](_0xcde2('0x17'),auth['isAuthenticated'](),controller[_0xcde2('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x44ad13,_0x1957d2){var _0x425366=function(_0x2a9fb8){while(--_0x2a9fb8){_0x44ad13['push'](_0x44ad13['shift']());}};_0x425366(++_0x1957d2);}(_0x0fd9,0xa3));var _0x90fd=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x0fd9[_0x18cac4];return _0x2227c6;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e49810e..b80a259 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 _0x36c3=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x143e8f,_0x380477){var _0x2b42f4=function(_0x149103){while(--_0x149103){_0x143e8f['push'](_0x143e8f['shift']());}};_0x2b42f4(++_0x380477);}(_0x36c3,0x1a6));var _0x336c=function(_0x511dd6,_0x5d294d){_0x511dd6=_0x511dd6-0x0;var _0x39f16b=_0x36c3[_0x511dd6];return _0x39f16b;};'use strict';var Sequelize=require(_0x336c('0x0'));module[_0x336c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x336c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x336c('0x3')]},'timeout':{'type':Sequelize[_0x336c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x336c('0x5')](_0x336c('0x6'),_0x336c('0x7'),_0x336c('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc69e=['rrmemory','beepall','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x4faec0,_0x17626a){var _0x2132a4=function(_0x389324){while(--_0x389324){_0x4faec0['push'](_0x4faec0['shift']());}};_0x2132a4(++_0x17626a);}(_0xc69e,0x1a7));var _0xec69=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc69e[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xec69('0x0'));module[_0xec69('0x1')]={'name':{'type':Sequelize[_0xec69('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xec69('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xec69('0x3')](_0xec69('0x4'),_0xec69('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xec69('0x6')],'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 8845296..24bca84 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 _0xa5ee=['Agents','sequelize','transaction','each','forEach','emit','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','value','removeTeams','isEmpty','addAgents','omit','spread','userFaxQueue:save','removeAgents','userFaxQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','get','FaxQueues','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','FaxQueue','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap'];(function(_0x56c4de,_0xf1c874){var _0xd799af=function(_0x30fb9){while(--_0x30fb9){_0x56c4de['push'](_0x56c4de['shift']());}};_0xd799af(++_0xf1c874);}(_0xa5ee,0xa9));var _0xea5e=function(_0x1702de,_0x3dcace){_0x1702de=_0x1702de-0x0;var _0x2a8b21=_0xa5ee[_0x1702de];return _0x2a8b21;};'use strict';var emlformat=require(_0xea5e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xea5e('0x1'));var rp=require(_0xea5e('0x2'));var moment=require('moment');var BPromise=require(_0xea5e('0x3'));var Mustache=require('mustache');var util=require(_0xea5e('0x4'));var path=require(_0xea5e('0x5'));var sox=require(_0xea5e('0x6'));var csv=require(_0xea5e('0x7'));var ejs=require(_0xea5e('0x8'));var fs=require('fs');var fs_extra=require(_0xea5e('0x9'));var _=require(_0xea5e('0xa'));var squel=require('squel');var crypto=require(_0xea5e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xea5e('0xc'));var toCsv=require(_0xea5e('0x7'));var querystring=require(_0xea5e('0xd'));var Papa=require(_0xea5e('0xe'));var Redis=require(_0xea5e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xea5e('0x10'));var as=require(_0xea5e('0x11'));var hardwareService=require(_0xea5e('0x12'));var logger=require(_0xea5e('0x13'))('api');var utils=require(_0xea5e('0x14'));var config=require(_0xea5e('0x15'));var licenseUtil=require(_0xea5e('0x16'));var db=require(_0xea5e('0x17'))['db'];config['redis']=_[_0xea5e('0x18')](config[_0xea5e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xea5e('0x1a'))(new Redis(config[_0xea5e('0x19')]));require('./faxQueue.socket')[_0xea5e('0x1b')](socket);function respondWithStatusCode(_0xc5b8d0,_0x1fe44c){_0x1fe44c=_0x1fe44c||0xcc;return function(_0x586be1){if(_0x586be1){return _0xc5b8d0[_0xea5e('0x1c')](_0x1fe44c);}return _0xc5b8d0['status'](_0x1fe44c)['end']();};}function respondWithResult(_0x30241b,_0x50509c){_0x50509c=_0x50509c||0xc8;return function(_0x5684f1){if(_0x5684f1){return _0x30241b['status'](_0x50509c)[_0xea5e('0x1d')](_0x5684f1);}};}function respondWithFilteredResult(_0x5b4431,_0x5716e3){return function(_0x4b1300){if(_0x4b1300){var _0x20a1c3=typeof _0x5716e3[_0xea5e('0x1e')]===_0xea5e('0x1f')&&typeof _0x5716e3[_0xea5e('0x20')]===_0xea5e('0x1f');var _0x522281=_0x4b1300[_0xea5e('0x21')];var _0xcb1d49=_0x20a1c3?0x0:_0x5716e3[_0xea5e('0x1e')];var _0x5b6e19=_0x20a1c3?_0x4b1300[_0xea5e('0x21')]:_0x5716e3['offset']+_0x5716e3[_0xea5e('0x20')];var _0x2d095b;if(_0x5b6e19>=_0x522281){_0x5b6e19=_0x522281;_0x2d095b=0xc8;}else{_0x2d095b=0xce;}_0x5b4431[_0xea5e('0x22')](_0x2d095b);return _0x5b4431[_0xea5e('0x23')](_0xea5e('0x24'),_0xcb1d49+'-'+_0x5b6e19+'/'+_0x522281)[_0xea5e('0x1d')](_0x4b1300);}return null;};}function patchUpdates(_0x5dc325){return function(_0x195877){try{jsonpatch[_0xea5e('0x25')](_0x195877,_0x5dc325,!![]);}catch(_0x3b368b){return BPromise[_0xea5e('0x26')](_0x3b368b);}return _0x195877[_0xea5e('0x27')]();};}function saveUpdates(_0x4a4c7e,_0xc4b40e){return function(_0x371500){if(_0x371500){return _0x371500[_0xea5e('0x28')](_0x4a4c7e)['then'](function(_0x9f75b6){return _0x9f75b6;});}return null;};}function removeEntity(_0x1bd640,_0x13c221){return function(_0x402da6){if(_0x402da6){return _0x402da6['destroy']()['then'](function(){var _0x2a8b79=_0x402da6[_0xea5e('0x29')]({'plain':!![]});var _0xca55c=_0xea5e('0x2a');return db['UserProfileResource'][_0xea5e('0x2b')]({'where':{'type':_0xca55c,'resourceId':_0x2a8b79['id']}})[_0xea5e('0x2c')](function(){return _0x402da6;});})[_0xea5e('0x2c')](function(){_0x1bd640[_0xea5e('0x22')](0xcc)[_0xea5e('0x2d')]();});}};}function handleEntityNotFound(_0x540cb2,_0x1bbf08){return function(_0x51f0b2){if(!_0x51f0b2){_0x540cb2[_0xea5e('0x1c')](0x194);}return _0x51f0b2;};}function handleError(_0x54e455,_0x10207c){_0x10207c=_0x10207c||0x1f4;return function(_0x3ec89a){logger[_0xea5e('0x2e')](_0x3ec89a[_0xea5e('0x2f')]);if(_0x3ec89a[_0xea5e('0x30')]){delete _0x3ec89a['name'];}_0x54e455[_0xea5e('0x22')](_0x10207c)[_0xea5e('0x31')](_0x3ec89a);};}exports[_0xea5e('0x32')]=function(_0x542c87,_0x1985da){var _0x45f126={},_0x420f0d={},_0x242df6={'count':0x0,'rows':[]};var _0x2845e9=_[_0xea5e('0x33')](db['FaxQueue'][_0xea5e('0x34')],function(_0x2c8389){return{'name':_0x2c8389['fieldName'],'type':_0x2c8389[_0xea5e('0x35')][_0xea5e('0x36')]};});_0x420f0d[_0xea5e('0x37')]=_[_0xea5e('0x33')](_0x2845e9,_0xea5e('0x30'));_0x420f0d[_0xea5e('0x38')]=_[_0xea5e('0x39')](_0x542c87[_0xea5e('0x38')]);_0x420f0d[_0xea5e('0x3a')]=_[_0xea5e('0x3b')](_0x420f0d[_0xea5e('0x37')],_0x420f0d[_0xea5e('0x38')]);_0x45f126[_0xea5e('0x3c')]=_[_0xea5e('0x3b')](_0x420f0d[_0xea5e('0x37')],qs['fields'](_0x542c87['query'][_0xea5e('0x3d')]));_0x45f126['attributes']=_0x45f126[_0xea5e('0x3c')][_0xea5e('0x3e')]?_0x45f126['attributes']:_0x420f0d[_0xea5e('0x37')];if(!_0x542c87[_0xea5e('0x38')][_0xea5e('0x3f')](_0xea5e('0x40'))){_0x45f126[_0xea5e('0x20')]=qs[_0xea5e('0x20')](_0x542c87[_0xea5e('0x38')]['limit']);_0x45f126[_0xea5e('0x1e')]=qs[_0xea5e('0x1e')](_0x542c87[_0xea5e('0x38')]['offset']);}_0x45f126[_0xea5e('0x41')]=qs['sort'](_0x542c87[_0xea5e('0x38')][_0xea5e('0x42')]);_0x45f126['where']=qs[_0xea5e('0x3a')](_[_0xea5e('0x43')](_0x542c87[_0xea5e('0x38')],_0x420f0d['filters']),_0x2845e9);if(_0x542c87[_0xea5e('0x38')]['filter']){_0x45f126[_0xea5e('0x44')]=_['merge'](_0x45f126[_0xea5e('0x44')],{'$or':_[_0xea5e('0x33')](_0x2845e9,function(_0x5e2a42){if(_0x5e2a42[_0xea5e('0x35')]!==_0xea5e('0x45')){var _0x490ac6={};_0x490ac6[_0x5e2a42[_0xea5e('0x30')]]={'$like':'%'+_0x542c87['query'][_0xea5e('0x46')]+'%'};return _0x490ac6;}})});}_0x45f126=_[_0xea5e('0x47')]({},_0x45f126,_0x542c87[_0xea5e('0x48')]);var _0x3c3815={'where':_0x45f126['where']};return db[_0xea5e('0x49')]['count'](_0x3c3815)[_0xea5e('0x2c')](function(_0x3d2312){_0x242df6['count']=_0x3d2312;if(_0x542c87[_0xea5e('0x38')][_0xea5e('0x4a')]){_0x45f126['include']=[{'all':!![]}];}return db[_0xea5e('0x49')][_0xea5e('0x4b')](_0x45f126);})[_0xea5e('0x2c')](function(_0x1ed4a7){_0x242df6[_0xea5e('0x4c')]=_0x1ed4a7;return _0x242df6;})['then'](respondWithFilteredResult(_0x1985da,_0x45f126))[_0xea5e('0x4d')](handleError(_0x1985da,null));};exports[_0xea5e('0x4e')]=function(_0x488150,_0x4fcd70){var _0x65c809={'raw':!![],'where':{'id':_0x488150[_0xea5e('0x4f')]['id']}},_0x2b330e={};_0x2b330e[_0xea5e('0x37')]=_[_0xea5e('0x39')](db[_0xea5e('0x49')][_0xea5e('0x34')]);_0x2b330e[_0xea5e('0x38')]=_[_0xea5e('0x39')](_0x488150['query']);_0x2b330e['filters']=_['intersection'](_0x2b330e[_0xea5e('0x37')],_0x2b330e[_0xea5e('0x38')]);_0x65c809[_0xea5e('0x3c')]=_[_0xea5e('0x3b')](_0x2b330e[_0xea5e('0x37')],qs['fields'](_0x488150[_0xea5e('0x38')][_0xea5e('0x3d')]));_0x65c809['attributes']=_0x65c809[_0xea5e('0x3c')][_0xea5e('0x3e')]?_0x65c809[_0xea5e('0x3c')]:_0x2b330e[_0xea5e('0x37')];if(_0x488150[_0xea5e('0x38')][_0xea5e('0x4a')]){_0x65c809[_0xea5e('0x50')]=[{'all':!![]}];}_0x65c809=_['merge']({},_0x65c809,_0x488150[_0xea5e('0x48')]);return db[_0xea5e('0x49')][_0xea5e('0x51')](_0x65c809)[_0xea5e('0x2c')](handleEntityNotFound(_0x4fcd70,null))[_0xea5e('0x2c')](respondWithResult(_0x4fcd70,null))['catch'](handleError(_0x4fcd70,null));};exports[_0xea5e('0x52')]=function(_0x420675,_0x5790ec){return db[_0xea5e('0x49')][_0xea5e('0x52')](_0x420675[_0xea5e('0x53')],{})[_0xea5e('0x2c')](function(_0x45bff0){var _0x295505=_0x420675[_0xea5e('0x54')][_0xea5e('0x29')]({'plain':!![]});if(!_0x295505)throw new Error(_0xea5e('0x55'));if(_0x295505[_0xea5e('0x56')]==='user'){var _0x423909=_0x45bff0[_0xea5e('0x29')]({'plain':!![]});var _0x2cb7ab=_0xea5e('0x2a');return db['UserProfileSection'][_0xea5e('0x51')]({'where':{'name':_0x2cb7ab,'userProfileId':_0x295505['userProfileId']},'raw':!![]})[_0xea5e('0x2c')](function(_0x5d4c2f){if(_0x5d4c2f&&_0x5d4c2f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x423909[_0xea5e('0x30')],'resourceId':_0x423909['id'],'type':_0x5d4c2f[_0xea5e('0x30')],'sectionId':_0x5d4c2f['id']},{})['then'](function(){return _0x45bff0;});}else{return _0x45bff0;}})[_0xea5e('0x4d')](function(_0x4caa9b){logger[_0xea5e('0x2e')](_0xea5e('0x57'),_0x4caa9b);throw _0x4caa9b;});}return _0x45bff0;})[_0xea5e('0x2c')](respondWithResult(_0x5790ec,0xc9))[_0xea5e('0x4d')](handleError(_0x5790ec,null));};exports[_0xea5e('0x28')]=function(_0x3e2ce1,_0x19547d){if(_0x3e2ce1[_0xea5e('0x53')]['id']){delete _0x3e2ce1[_0xea5e('0x53')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x3e2ce1[_0xea5e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x19547d,null))['then'](saveUpdates(_0x3e2ce1[_0xea5e('0x53')],null))[_0xea5e('0x2c')](respondWithResult(_0x19547d,null))[_0xea5e('0x4d')](handleError(_0x19547d,null));};exports[_0xea5e('0x2b')]=function(_0xfbd124,_0x224d35){return db[_0xea5e('0x49')][_0xea5e('0x51')]({'where':{'id':_0xfbd124[_0xea5e('0x4f')]['id']}})[_0xea5e('0x2c')](handleEntityNotFound(_0x224d35,null))['then'](removeEntity(_0x224d35,null))[_0xea5e('0x4d')](handleError(_0x224d35,null));};exports[_0xea5e('0x58')]=function(_0x1cecf2,_0x434d02){return db['FaxQueue'][_0xea5e('0x58')]()[_0xea5e('0x2c')](respondWithResult(_0x434d02,null))[_0xea5e('0x4d')](handleError(_0x434d02,null));};exports[_0xea5e('0x59')]=function(_0x22b2a1,_0x48a441,_0x2b6385){var _0xa58b07={'raw':!![],'where':{}},_0x8342e6={},_0xd4b144;return db[_0xea5e('0x49')][_0xea5e('0x5a')]({'where':{'id':_0x22b2a1[_0xea5e('0x4f')]['id']}})[_0xea5e('0x2c')](handleEntityNotFound(_0x48a441,null))['then'](function(_0x40d25e){if(_0x40d25e){_0xd4b144=_0x40d25e['get']({'plain':!![]});_0x8342e6[_0xea5e('0x37')]=_['keys'](db[_0xea5e('0x5b')][_0xea5e('0x34')]);_0x8342e6['query']=_[_0xea5e('0x39')](_0x22b2a1[_0xea5e('0x38')]);_0x8342e6[_0xea5e('0x3a')]=_[_0xea5e('0x3b')](_0x8342e6[_0xea5e('0x37')],_0x8342e6['query']);_0xa58b07['attributes']=_['intersection'](_0x8342e6[_0xea5e('0x37')],qs[_0xea5e('0x3d')](_0x22b2a1[_0xea5e('0x38')][_0xea5e('0x3d')]));_0xa58b07[_0xea5e('0x3c')]=_0xa58b07['attributes'][_0xea5e('0x3e')]?_0xa58b07[_0xea5e('0x3c')]:_0x8342e6[_0xea5e('0x37')];if(!_0x22b2a1[_0xea5e('0x38')][_0xea5e('0x3f')](_0xea5e('0x40'))){_0xa58b07[_0xea5e('0x20')]=qs[_0xea5e('0x20')](_0x22b2a1[_0xea5e('0x38')]['limit']);_0xa58b07[_0xea5e('0x1e')]=qs['offset'](_0x22b2a1['query'][_0xea5e('0x1e')]);}_0xa58b07['order']=qs['sort'](_0x22b2a1[_0xea5e('0x38')]['sort']);_0xa58b07[_0xea5e('0x44')]=qs['filters'](_[_0xea5e('0x43')](_0x22b2a1[_0xea5e('0x38')],_0x8342e6[_0xea5e('0x3a')]));_0xa58b07[_0xea5e('0x44')][_0xea5e('0x5c')]=_0x40d25e['id'];if(_0x22b2a1[_0xea5e('0x38')]['filter']){_0xa58b07[_0xea5e('0x44')]=_['merge'](_0xa58b07[_0xea5e('0x44')],{'$or':_['map'](_0xa58b07['attributes'],function(_0xe63e61){var _0x52dd82={};_0x52dd82[_0xe63e61]={'$like':'%'+_0x22b2a1['query'][_0xea5e('0x46')]+'%'};return _0x52dd82;})});}_0xa58b07=_['merge']({},_0xa58b07,_0x22b2a1[_0xea5e('0x48')]);return db[_0xea5e('0x5b')][_0xea5e('0x4b')](_0xa58b07);}})[_0xea5e('0x2c')](function(_0x34b6eb){if(_0x34b6eb){return db[_0xea5e('0x5d')][_0xea5e('0x5e')]({'where':{'id':_[_0xea5e('0x33')](_0x34b6eb,_0xea5e('0x5f')),'role':'agent'},'attributes':['id','name',_0xea5e('0x60'),_0xea5e('0x61'),'createdAt']});}})['then'](function(_0x3b4d8b){if(_0x3b4d8b){return{'count':_0x3b4d8b[_0xea5e('0x21')],'rows':_['map'](_0x3b4d8b[_0xea5e('0x4c')],function(_0x198615){return{'membername':_0x198615['name'],'UserId':_0x198615['id'],'queue_name':_0xd4b144[_0xea5e('0x30')],'FaxQueueId':_0xd4b144['id'],'interface':util[_0xea5e('0x62')](_0xea5e('0x63'),_0xea5e('0x64'),_0x198615[_0xea5e('0x30')]),'penalty':0x0,'paused':_0x198615[_0xea5e('0x60')],'createdAt':_0x198615['createdAt'],'updatedAt':_0x198615[_0xea5e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48a441,_0xa58b07))[_0xea5e('0x4d')](handleError(_0x48a441,null));};exports[_0xea5e('0x65')]=function(_0x1a9a10,_0x1de37f,_0x12f493){var _0xe018b={};var _0x3edc15={};var _0x488b42;var _0x31d295;return db[_0xea5e('0x49')][_0xea5e('0x5a')]({'where':{'id':_0x1a9a10[_0xea5e('0x4f')]['id']}})[_0xea5e('0x2c')](handleEntityNotFound(_0x1de37f,null))[_0xea5e('0x2c')](function(_0x1b5aea){if(_0x1b5aea){_0x488b42=_0x1b5aea;_0x3edc15[_0xea5e('0x37')]=_[_0xea5e('0x39')](db['Team'][_0xea5e('0x34')]);_0x3edc15[_0xea5e('0x38')]=_[_0xea5e('0x39')](_0x1a9a10['query']);_0x3edc15[_0xea5e('0x3a')]=_[_0xea5e('0x3b')](_0x3edc15[_0xea5e('0x37')],_0x3edc15[_0xea5e('0x38')]);_0xe018b[_0xea5e('0x3c')]=_[_0xea5e('0x3b')](_0x3edc15['model'],qs[_0xea5e('0x3d')](_0x1a9a10[_0xea5e('0x38')]['fields']));_0xe018b[_0xea5e('0x3c')]=_0xe018b[_0xea5e('0x3c')]['length']?_0xe018b[_0xea5e('0x3c')]:_0x3edc15['model'];_0xe018b[_0xea5e('0x41')]=qs[_0xea5e('0x42')](_0x1a9a10['query'][_0xea5e('0x42')]);_0xe018b[_0xea5e('0x44')]=qs[_0xea5e('0x3a')](_['pick'](_0x1a9a10[_0xea5e('0x38')],_0x3edc15[_0xea5e('0x3a')]));if(_0x1a9a10['query'][_0xea5e('0x46')]){_0xe018b[_0xea5e('0x44')]=_[_0xea5e('0x47')](_0xe018b[_0xea5e('0x44')],{'$or':_[_0xea5e('0x33')](_0xe018b[_0xea5e('0x3c')],function(_0x259508){var _0x3f38ca={};_0x3f38ca[_0x259508]={'$like':'%'+_0x1a9a10[_0xea5e('0x38')]['filter']+'%'};return _0x3f38ca;})});}_0xe018b=_[_0xea5e('0x47')]({},_0xe018b,_0x1a9a10[_0xea5e('0x48')]);return _0x488b42[_0xea5e('0x65')](_0xe018b);}})['then'](function(_0x3b4c75){if(_0x3b4c75){_0x31d295=_0x3b4c75[_0xea5e('0x3e')];if(!_0x1a9a10['query'][_0xea5e('0x3f')](_0xea5e('0x40'))){_0xe018b[_0xea5e('0x20')]=qs[_0xea5e('0x20')](_0x1a9a10['query'][_0xea5e('0x20')]);_0xe018b[_0xea5e('0x1e')]=qs[_0xea5e('0x1e')](_0x1a9a10[_0xea5e('0x38')][_0xea5e('0x1e')]);}return _0x488b42[_0xea5e('0x65')](_0xe018b);}})[_0xea5e('0x2c')](function(_0x549d42){if(_0x549d42){return _0x549d42?{'count':_0x31d295,'rows':_0x549d42}:null;}})[_0xea5e('0x2c')](respondWithResult(_0x1de37f,null))[_0xea5e('0x4d')](handleError(_0x1de37f,null));};exports[_0xea5e('0x66')]=function(_0x5a41d0,_0x15a346,_0x44c66d){var _0x149e76=_0x5a41d0['body'][_0xea5e('0x67')];return db[_0xea5e('0x68')][_0xea5e('0x4b')]({'where':{'id':_0x149e76},'attributes':['id'],'include':[{'model':db[_0xea5e('0x5d')],'as':'Agents','attributes':['id','name',_0xea5e('0x69'),_0xea5e('0x6a'),_0xea5e('0x6b')],'raw':!![]}]})[_0xea5e('0x2c')](function(_0x416036){if(_0x416036){var _0x4e0230=_[_0xea5e('0x6c')](_0x416036,function(_0x29fa03){var _0x49d2be=_0x29fa03[_0xea5e('0x29')]({'plain':!![]});return _0x49d2be[_0xea5e('0x6d')];});return db[_0xea5e('0x49')][_0xea5e('0x51')]({'where':{'id':_0x5a41d0[_0xea5e('0x4f')]['id']}})[_0xea5e('0x2c')](function(_0x57cc2e){return db[_0xea5e('0x6e')][_0xea5e('0x6f')](function(_0x4dbdb1){return _0x57cc2e['addTeams'](_0x149e76,{'transaction':_0x4dbdb1})[_0xea5e('0x2c')](function(){return BPromise[_0xea5e('0x70')](_0x4e0230,function(_0x2f6301){return db[_0xea5e('0x5b')]['findOrCreate']({'where':{'UserId':_0x2f6301['id'],'FaxQueueId':_0x5a41d0['params']['id']},'transaction':_0x4dbdb1});});})[_0xea5e('0x2c')](function(){_0x4e0230[_0xea5e('0x71')](function(_0x54b6c6){socket[_0xea5e('0x72')]('userFaxQueue:save',{'UserId':_0x54b6c6['id'],'FaxQueueId':_0x57cc2e['id']});});});});});}})[_0xea5e('0x2c')](respondWithStatusCode(_0x15a346,null))[_0xea5e('0x4d')](handleError(_0x15a346,null));};exports['removeTeams']=function(_0x2ee893,_0x163e64,_0x2eda9e){return db[_0xea5e('0x68')][_0xea5e('0x4b')]({'where':{'id':_0x2ee893[_0xea5e('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xea5e('0x5d')],'as':_0xea5e('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xea5e('0x2c')](handleEntityNotFound(_0x163e64,null))[_0xea5e('0x2c')](function(_0x197adf){var _0x5ae67c=_[_0xea5e('0x33')](_0x197adf,'id');var _0x581dbf=[];var _0x3b5597=[];var _0x11bdc2=squel[_0xea5e('0x73')]();_0x11bdc2[_0xea5e('0x74')](_0xea5e('0x75'))['from']('team_has_fax_queues','tq')['join'](_0xea5e('0x76'),'ut',_0xea5e('0x77'))[_0xea5e('0x44')](_0xea5e('0x78'),_0x2ee893[_0xea5e('0x4f')]['id']);for(var _0x54a738=0x0;_0x54a738<_0x197adf[_0xea5e('0x3e')];_0x54a738+=0x1){let _0x4c7a1a=_0x197adf[_0x54a738];for(var _0x575e77=0x0;_0x575e77<_0x4c7a1a[_0xea5e('0x6d')][_0xea5e('0x3e')];_0x575e77+=0x1){let _0x5e529d=_0x4c7a1a[_0xea5e('0x6d')][_0x575e77];var _0xb0b667=_0x11bdc2[_0xea5e('0x79')]();_0xb0b667[_0xea5e('0x44')](_0xea5e('0x7a'),_0x5e529d['id']);_0x3b5597['push'](db['sequelize'][_0xea5e('0x38')](_0xb0b667['toString'](),{'type':db[_0xea5e('0x6e')][_0xea5e('0x7b')][_0xea5e('0x7c')]})['then'](function(_0x5ce5c5){if(_0x5ce5c5['length']===0x1){return _0x5e529d['id'];}else{var _0x51f8c1=_[_0xea5e('0x7d')](_[_0xea5e('0x33')](_0x5ce5c5,_0xea5e('0x7e')),function(_0xf00c3c){return _['includes'](_0x5ae67c,_0xf00c3c);});if(_0x51f8c1){return _0x5e529d['id'];}}}));}}return BPromise[_0xea5e('0x7f')](_0x3b5597)[_0xea5e('0x2c')](function(_0x197688){_0x581dbf=_(_0x581dbf)[_0xea5e('0x80')](_0x197688)['compact']()[_0xea5e('0x81')]();return db[_0xea5e('0x49')][_0xea5e('0x51')]({'where':{'id':_0x2ee893['params']['id']}})[_0xea5e('0x2c')](function(_0x4429a4){return db[_0xea5e('0x6e')][_0xea5e('0x6f')](function(_0x29a266){return _0x4429a4[_0xea5e('0x82')](_0x2ee893[_0xea5e('0x38')]['ids'],{'transaction':_0x29a266})[_0xea5e('0x2c')](function(){if(!_[_0xea5e('0x83')](_0x581dbf)){return _0x4429a4['removeAgents'](_0x581dbf,{'transaction':_0x29a266});}})['then'](function(){_0x581dbf['forEach'](function(_0x2fe3f5){socket[_0xea5e('0x72')]('userFaxQueue:remove',{'UserId':_0x2fe3f5,'FaxQueueId':_0x4429a4['id']});});});});});});})[_0xea5e('0x2c')](respondWithStatusCode(_0x163e64,null))[_0xea5e('0x4d')](handleError(_0x163e64,null));};exports[_0xea5e('0x84')]=function(_0x88fdee,_0x370fca,_0x44bf70){return db[_0xea5e('0x49')][_0xea5e('0x51')]({'where':{'id':_0x88fdee['params']['id']}})[_0xea5e('0x2c')](handleEntityNotFound(_0x370fca,null))[_0xea5e('0x2c')](function(_0x4219e0){if(_0x4219e0){return _0x4219e0[_0xea5e('0x84')](_0x88fdee[_0xea5e('0x53')][_0xea5e('0x67')],_[_0xea5e('0x85')](_0x88fdee[_0xea5e('0x53')],[_0xea5e('0x67'),'id'])||{})[_0xea5e('0x86')](function(_0x260aef){for(var _0x5aca09=0x0;_0x5aca09<_0x88fdee[_0xea5e('0x53')]['ids'][_0xea5e('0x3e')];_0x5aca09+=0x1){socket[_0xea5e('0x72')](_0xea5e('0x87'),{'UserId':Number(_0x88fdee[_0xea5e('0x53')][_0xea5e('0x67')][_0x5aca09]),'FaxQueueId':Number(_0x88fdee[_0xea5e('0x4f')]['id'])});}return _0x260aef;});}})[_0xea5e('0x2c')](respondWithResult(_0x370fca,null))['catch'](handleError(_0x370fca,null));};exports[_0xea5e('0x88')]=function(_0x518f28,_0x3752a9,_0x2fdd5d){return db[_0xea5e('0x49')][_0xea5e('0x51')]({'where':{'id':_0x518f28[_0xea5e('0x4f')]['id']}})[_0xea5e('0x2c')](handleEntityNotFound(_0x3752a9,null))[_0xea5e('0x2c')](function(_0x51c118){if(_0x51c118){return _0x51c118[_0xea5e('0x88')](_0x518f28['query']['ids'])[_0xea5e('0x2c')](function(){if(_['isArray'](_0x518f28[_0xea5e('0x38')][_0xea5e('0x67')])){for(var _0x242cf3=0x0;_0x242cf3<_0x518f28[_0xea5e('0x38')]['ids'][_0xea5e('0x3e')];_0x242cf3+=0x1){socket[_0xea5e('0x72')](_0xea5e('0x89'),{'UserId':Number(_0x518f28[_0xea5e('0x38')]['ids'][_0x242cf3]),'FaxQueueId':Number(_0x518f28[_0xea5e('0x4f')]['id'])});}}else{socket['emit'](_0xea5e('0x89'),{'UserId':Number(_0x518f28[_0xea5e('0x38')][_0xea5e('0x67')]),'FaxQueueId':Number(_0x518f28[_0xea5e('0x4f')]['id'])});}});}})[_0xea5e('0x2c')](respondWithStatusCode(_0x3752a9,null))[_0xea5e('0x4d')](handleError(_0x3752a9,null));};exports['getAgents']=function(_0x1a067e,_0x259ad3,_0x40232b){var _0x3a5be6={};var _0x5e11ab={};var _0x27f907;var _0xba5fa5;return db[_0xea5e('0x49')][_0xea5e('0x5a')]({'where':{'id':_0x1a067e[_0xea5e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x259ad3,null))[_0xea5e('0x2c')](function(_0x21481d){if(_0x21481d){_0x27f907=_0x21481d;_0x5e11ab['model']=_[_0xea5e('0x39')](db[_0xea5e('0x5d')][_0xea5e('0x34')]);_0x5e11ab[_0xea5e('0x38')]=_[_0xea5e('0x39')](_0x1a067e[_0xea5e('0x38')]);_0x5e11ab[_0xea5e('0x3a')]=_['intersection'](_0x5e11ab[_0xea5e('0x37')],_0x5e11ab[_0xea5e('0x38')]);_0x3a5be6[_0xea5e('0x3c')]=_['intersection'](_0x5e11ab[_0xea5e('0x37')],qs[_0xea5e('0x3d')](_0x1a067e[_0xea5e('0x38')][_0xea5e('0x3d')]));_0x3a5be6[_0xea5e('0x3c')]=_0x3a5be6[_0xea5e('0x3c')][_0xea5e('0x3e')]?_0x3a5be6[_0xea5e('0x3c')]:_0x5e11ab[_0xea5e('0x37')];_0x3a5be6[_0xea5e('0x41')]=qs[_0xea5e('0x42')](_0x1a067e['query'][_0xea5e('0x42')]);_0x3a5be6['where']=qs[_0xea5e('0x3a')](_[_0xea5e('0x43')](_0x1a067e['query'],_0x5e11ab[_0xea5e('0x3a')]));if(_0x1a067e[_0xea5e('0x38')]['filter']){_0x3a5be6[_0xea5e('0x44')]=_[_0xea5e('0x47')](_0x3a5be6[_0xea5e('0x44')],{'$or':_[_0xea5e('0x33')](_0x3a5be6[_0xea5e('0x3c')],function(_0x4af35d){var _0x36f767={};_0x36f767[_0x4af35d]={'$like':'%'+_0x1a067e[_0xea5e('0x38')][_0xea5e('0x46')]+'%'};return _0x36f767;})});}_0x3a5be6=_[_0xea5e('0x47')]({},_0x3a5be6,_0x1a067e[_0xea5e('0x48')]);return _0x27f907['getAgents'](_0x3a5be6);}})[_0xea5e('0x2c')](function(_0x30691f){if(_0x30691f){_0xba5fa5=_0x30691f[_0xea5e('0x3e')];if(!_0x1a067e['query'][_0xea5e('0x3f')]('nolimit')){_0x3a5be6[_0xea5e('0x20')]=qs[_0xea5e('0x20')](_0x1a067e[_0xea5e('0x38')]['limit']);_0x3a5be6[_0xea5e('0x1e')]=qs[_0xea5e('0x1e')](_0x1a067e['query'][_0xea5e('0x1e')]);}return _0x27f907[_0xea5e('0x8a')](_0x3a5be6);}})[_0xea5e('0x2c')](function(_0x3eb055){if(_0x3eb055){return _0x3eb055?{'count':_0xba5fa5,'rows':_0x3eb055}:null;}})[_0xea5e('0x2c')](respondWithResult(_0x259ad3,null))[_0xea5e('0x4d')](handleError(_0x259ad3,null));}; \ No newline at end of file +var _0xb29f=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','rawAttributes','FaxQueueId','findAndCountAll','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','User','online','voicePause','interface','Agents','transaction','each','forEach','emit','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','FaxQueues','end','stack','name','index','map','FaxQueue','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb29f,0xce));var _0xfb29=function(_0x189812,_0x5c38ca){_0x189812=_0x189812-0x0;var _0x52afa7=_0xb29f[_0x189812];return _0x52afa7;};'use strict';var emlformat=require(_0xfb29('0x0'));var rimraf=require(_0xfb29('0x1'));var zipdir=require(_0xfb29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb29('0x3'));var BPromise=require(_0xfb29('0x4'));var Mustache=require(_0xfb29('0x5'));var util=require(_0xfb29('0x6'));var path=require('path');var sox=require(_0xfb29('0x7'));var csv=require(_0xfb29('0x8'));var ejs=require(_0xfb29('0x9'));var fs=require('fs');var fs_extra=require(_0xfb29('0xa'));var _=require(_0xfb29('0xb'));var squel=require(_0xfb29('0xc'));var crypto=require(_0xfb29('0xd'));var jsforce=require(_0xfb29('0xe'));var deskjs=require(_0xfb29('0xf'));var toCsv=require(_0xfb29('0x8'));var querystring=require(_0xfb29('0x10'));var Papa=require(_0xfb29('0x11'));var Redis=require('ioredis');var authService=require(_0xfb29('0x12'));var qs=require(_0xfb29('0x13'));var as=require(_0xfb29('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb29('0x15'))(_0xfb29('0x16'));var utils=require('../../config/utils');var config=require(_0xfb29('0x17'));var licenseUtil=require(_0xfb29('0x18'));var db=require(_0xfb29('0x19'))['db'];config[_0xfb29('0x1a')]=_['defaults'](config[_0xfb29('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb29('0x1b'))(new Redis(config[_0xfb29('0x1a')]));require(_0xfb29('0x1c'))[_0xfb29('0x1d')](socket);function respondWithStatusCode(_0x4f4978,_0x1d41b5){_0x1d41b5=_0x1d41b5||0xcc;return function(_0x3ddf10){if(_0x3ddf10){return _0x4f4978[_0xfb29('0x1e')](_0x1d41b5);}return _0x4f4978[_0xfb29('0x1f')](_0x1d41b5)['end']();};}function respondWithResult(_0x19f803,_0x2641e8){_0x2641e8=_0x2641e8||0xc8;return function(_0x4a3e3b){if(_0x4a3e3b){return _0x19f803['status'](_0x2641e8)[_0xfb29('0x20')](_0x4a3e3b);}};}function respondWithFilteredResult(_0x50b24f,_0x36f20a){return function(_0x28d96f){if(_0x28d96f){var _0x218db2=typeof _0x36f20a[_0xfb29('0x21')]===_0xfb29('0x22')&&typeof _0x36f20a[_0xfb29('0x23')]===_0xfb29('0x22');var _0xcb788e=_0x28d96f[_0xfb29('0x24')];var _0x48e21a=_0x218db2?0x0:_0x36f20a[_0xfb29('0x21')];var _0x503719=_0x218db2?_0x28d96f[_0xfb29('0x24')]:_0x36f20a[_0xfb29('0x21')]+_0x36f20a[_0xfb29('0x23')];var _0x50fab1;if(_0x503719>=_0xcb788e){_0x503719=_0xcb788e;_0x50fab1=0xc8;}else{_0x50fab1=0xce;}_0x50b24f[_0xfb29('0x1f')](_0x50fab1);return _0x50b24f[_0xfb29('0x25')](_0xfb29('0x26'),_0x48e21a+'-'+_0x503719+'/'+_0xcb788e)[_0xfb29('0x20')](_0x28d96f);}return null;};}function patchUpdates(_0x2cefae){return function(_0x22ea79){try{jsonpatch[_0xfb29('0x27')](_0x22ea79,_0x2cefae,!![]);}catch(_0x2b074b){return BPromise['reject'](_0x2b074b);}return _0x22ea79[_0xfb29('0x28')]();};}function saveUpdates(_0xd8ab79,_0x2a5b7a){return function(_0x455fed){if(_0x455fed){return _0x455fed['update'](_0xd8ab79)[_0xfb29('0x29')](function(_0x417430){return _0x417430;});}return null;};}function removeEntity(_0x3dd1bd,_0x12ec6b){return function(_0x4b3633){if(_0x4b3633){return _0x4b3633[_0xfb29('0x2a')]()[_0xfb29('0x29')](function(){var _0xd90136=_0x4b3633[_0xfb29('0x2b')]({'plain':!![]});var _0x3fb63d=_0xfb29('0x2c');return db['UserProfileResource'][_0xfb29('0x2a')]({'where':{'type':_0x3fb63d,'resourceId':_0xd90136['id']}})[_0xfb29('0x29')](function(){return _0x4b3633;});})[_0xfb29('0x29')](function(){_0x3dd1bd[_0xfb29('0x1f')](0xcc)[_0xfb29('0x2d')]();});}};}function handleEntityNotFound(_0x30664d,_0x1fb7d){return function(_0x74f93d){if(!_0x74f93d){_0x30664d[_0xfb29('0x1e')](0x194);}return _0x74f93d;};}function handleError(_0x561bab,_0x366265){_0x366265=_0x366265||0x1f4;return function(_0x4fa184){logger['error'](_0x4fa184[_0xfb29('0x2e')]);if(_0x4fa184['name']){delete _0x4fa184[_0xfb29('0x2f')];}_0x561bab[_0xfb29('0x1f')](_0x366265)['send'](_0x4fa184);};}exports[_0xfb29('0x30')]=function(_0xae91a2,_0x27a099){var _0x6e2423={},_0x25b99d={},_0x514808={'count':0x0,'rows':[]};var _0x5656a6=_[_0xfb29('0x31')](db[_0xfb29('0x32')]['rawAttributes'],function(_0x29dc1a){return{'name':_0x29dc1a['fieldName'],'type':_0x29dc1a[_0xfb29('0x33')][_0xfb29('0x34')]};});_0x25b99d[_0xfb29('0x35')]=_['map'](_0x5656a6,_0xfb29('0x2f'));_0x25b99d[_0xfb29('0x36')]=_[_0xfb29('0x37')](_0xae91a2[_0xfb29('0x36')]);_0x25b99d[_0xfb29('0x38')]=_[_0xfb29('0x39')](_0x25b99d[_0xfb29('0x35')],_0x25b99d[_0xfb29('0x36')]);_0x6e2423[_0xfb29('0x3a')]=_[_0xfb29('0x39')](_0x25b99d[_0xfb29('0x35')],qs[_0xfb29('0x3b')](_0xae91a2[_0xfb29('0x36')]['fields']));_0x6e2423[_0xfb29('0x3a')]=_0x6e2423[_0xfb29('0x3a')]['length']?_0x6e2423[_0xfb29('0x3a')]:_0x25b99d[_0xfb29('0x35')];if(!_0xae91a2[_0xfb29('0x36')][_0xfb29('0x3c')](_0xfb29('0x3d'))){_0x6e2423[_0xfb29('0x23')]=qs['limit'](_0xae91a2[_0xfb29('0x36')][_0xfb29('0x23')]);_0x6e2423[_0xfb29('0x21')]=qs[_0xfb29('0x21')](_0xae91a2[_0xfb29('0x36')][_0xfb29('0x21')]);}_0x6e2423[_0xfb29('0x3e')]=qs[_0xfb29('0x3f')](_0xae91a2['query'][_0xfb29('0x3f')]);_0x6e2423[_0xfb29('0x40')]=qs[_0xfb29('0x38')](_[_0xfb29('0x41')](_0xae91a2[_0xfb29('0x36')],_0x25b99d['filters']),_0x5656a6);if(_0xae91a2[_0xfb29('0x36')][_0xfb29('0x42')]){_0x6e2423[_0xfb29('0x40')]=_[_0xfb29('0x43')](_0x6e2423[_0xfb29('0x40')],{'$or':_[_0xfb29('0x31')](_0x5656a6,function(_0x539d3f){if(_0x539d3f[_0xfb29('0x33')]!==_0xfb29('0x44')){var _0x11d76b={};_0x11d76b[_0x539d3f[_0xfb29('0x2f')]]={'$like':'%'+_0xae91a2['query'][_0xfb29('0x42')]+'%'};return _0x11d76b;}})});}_0x6e2423=_[_0xfb29('0x43')]({},_0x6e2423,_0xae91a2['options']);var _0x121241={'where':_0x6e2423[_0xfb29('0x40')]};return db[_0xfb29('0x32')][_0xfb29('0x24')](_0x121241)[_0xfb29('0x29')](function(_0x1e8cd4){_0x514808[_0xfb29('0x24')]=_0x1e8cd4;if(_0xae91a2['query'][_0xfb29('0x45')]){_0x6e2423[_0xfb29('0x46')]=[{'all':!![]}];}return db[_0xfb29('0x32')][_0xfb29('0x47')](_0x6e2423);})[_0xfb29('0x29')](function(_0x3f8f17){_0x514808[_0xfb29('0x48')]=_0x3f8f17;return _0x514808;})[_0xfb29('0x29')](respondWithFilteredResult(_0x27a099,_0x6e2423))[_0xfb29('0x49')](handleError(_0x27a099,null));};exports[_0xfb29('0x4a')]=function(_0x1dfdc0,_0x1e5dcb){var _0x2294f4={'raw':!![],'where':{'id':_0x1dfdc0['params']['id']}},_0x4f8ad5={};_0x4f8ad5[_0xfb29('0x35')]=_[_0xfb29('0x37')](db[_0xfb29('0x32')]['rawAttributes']);_0x4f8ad5[_0xfb29('0x36')]=_[_0xfb29('0x37')](_0x1dfdc0[_0xfb29('0x36')]);_0x4f8ad5[_0xfb29('0x38')]=_[_0xfb29('0x39')](_0x4f8ad5[_0xfb29('0x35')],_0x4f8ad5[_0xfb29('0x36')]);_0x2294f4[_0xfb29('0x3a')]=_[_0xfb29('0x39')](_0x4f8ad5[_0xfb29('0x35')],qs[_0xfb29('0x3b')](_0x1dfdc0[_0xfb29('0x36')][_0xfb29('0x3b')]));_0x2294f4['attributes']=_0x2294f4[_0xfb29('0x3a')][_0xfb29('0x4b')]?_0x2294f4[_0xfb29('0x3a')]:_0x4f8ad5[_0xfb29('0x35')];if(_0x1dfdc0['query'][_0xfb29('0x45')]){_0x2294f4[_0xfb29('0x46')]=[{'all':!![]}];}_0x2294f4=_[_0xfb29('0x43')]({},_0x2294f4,_0x1dfdc0[_0xfb29('0x4c')]);return db[_0xfb29('0x32')][_0xfb29('0x4d')](_0x2294f4)[_0xfb29('0x29')](handleEntityNotFound(_0x1e5dcb,null))[_0xfb29('0x29')](respondWithResult(_0x1e5dcb,null))['catch'](handleError(_0x1e5dcb,null));};exports[_0xfb29('0x4e')]=function(_0x27acf3,_0x1952ce){return db[_0xfb29('0x32')][_0xfb29('0x4e')](_0x27acf3[_0xfb29('0x4f')],{})[_0xfb29('0x29')](function(_0x430f9d){var _0x54508b=_0x27acf3['user'][_0xfb29('0x2b')]({'plain':!![]});if(!_0x54508b)throw new Error(_0xfb29('0x50'));if(_0x54508b[_0xfb29('0x51')]===_0xfb29('0x52')){var _0x278c5a=_0x430f9d[_0xfb29('0x2b')]({'plain':!![]});var _0x5ad2d5=_0xfb29('0x2c');return db[_0xfb29('0x53')]['find']({'where':{'name':_0x5ad2d5,'userProfileId':_0x54508b[_0xfb29('0x54')]},'raw':!![]})['then'](function(_0x5b9c41){if(_0x5b9c41&&_0x5b9c41[_0xfb29('0x55')]===0x0){return db[_0xfb29('0x56')][_0xfb29('0x4e')]({'name':_0x278c5a['name'],'resourceId':_0x278c5a['id'],'type':_0x5b9c41[_0xfb29('0x2f')],'sectionId':_0x5b9c41['id']},{})[_0xfb29('0x29')](function(){return _0x430f9d;});}else{return _0x430f9d;}})[_0xfb29('0x49')](function(_0x23d822){logger[_0xfb29('0x57')](_0xfb29('0x58'),_0x23d822);throw _0x23d822;});}return _0x430f9d;})['then'](respondWithResult(_0x1952ce,0xc9))[_0xfb29('0x49')](handleError(_0x1952ce,null));};exports['update']=function(_0x37341c,_0xca5f9d){if(_0x37341c[_0xfb29('0x4f')]['id']){delete _0x37341c[_0xfb29('0x4f')]['id'];}return db[_0xfb29('0x32')][_0xfb29('0x4d')]({'where':{'id':_0x37341c[_0xfb29('0x59')]['id']}})[_0xfb29('0x29')](handleEntityNotFound(_0xca5f9d,null))[_0xfb29('0x29')](saveUpdates(_0x37341c[_0xfb29('0x4f')],null))[_0xfb29('0x29')](respondWithResult(_0xca5f9d,null))['catch'](handleError(_0xca5f9d,null));};exports[_0xfb29('0x2a')]=function(_0x4980a0,_0x199cfc){return db[_0xfb29('0x32')][_0xfb29('0x4d')]({'where':{'id':_0x4980a0[_0xfb29('0x59')]['id']}})[_0xfb29('0x29')](handleEntityNotFound(_0x199cfc,null))[_0xfb29('0x29')](removeEntity(_0x199cfc,null))['catch'](handleError(_0x199cfc,null));};exports['describe']=function(_0x18ca83,_0x3dd237){return db[_0xfb29('0x32')][_0xfb29('0x5a')]()[_0xfb29('0x29')](respondWithResult(_0x3dd237,null))[_0xfb29('0x49')](handleError(_0x3dd237,null));};exports[_0xfb29('0x5b')]=function(_0x56c58e,_0x8753a4,_0x5a4e81){var _0x544f31={'raw':!![],'where':{}},_0x153d11={},_0x33ac36;return db[_0xfb29('0x32')][_0xfb29('0x5c')]({'where':{'id':_0x56c58e[_0xfb29('0x59')]['id']}})['then'](handleEntityNotFound(_0x8753a4,null))['then'](function(_0x274de6){if(_0x274de6){_0x33ac36=_0x274de6[_0xfb29('0x2b')]({'plain':!![]});_0x153d11[_0xfb29('0x35')]=_[_0xfb29('0x37')](db[_0xfb29('0x5d')][_0xfb29('0x5e')]);_0x153d11[_0xfb29('0x36')]=_[_0xfb29('0x37')](_0x56c58e[_0xfb29('0x36')]);_0x153d11['filters']=_['intersection'](_0x153d11[_0xfb29('0x35')],_0x153d11[_0xfb29('0x36')]);_0x544f31[_0xfb29('0x3a')]=_[_0xfb29('0x39')](_0x153d11[_0xfb29('0x35')],qs[_0xfb29('0x3b')](_0x56c58e[_0xfb29('0x36')][_0xfb29('0x3b')]));_0x544f31['attributes']=_0x544f31[_0xfb29('0x3a')]['length']?_0x544f31['attributes']:_0x153d11[_0xfb29('0x35')];if(!_0x56c58e['query'][_0xfb29('0x3c')]('nolimit')){_0x544f31[_0xfb29('0x23')]=qs[_0xfb29('0x23')](_0x56c58e[_0xfb29('0x36')][_0xfb29('0x23')]);_0x544f31[_0xfb29('0x21')]=qs['offset'](_0x56c58e[_0xfb29('0x36')]['offset']);}_0x544f31[_0xfb29('0x3e')]=qs[_0xfb29('0x3f')](_0x56c58e['query'][_0xfb29('0x3f')]);_0x544f31[_0xfb29('0x40')]=qs[_0xfb29('0x38')](_[_0xfb29('0x41')](_0x56c58e[_0xfb29('0x36')],_0x153d11[_0xfb29('0x38')]));_0x544f31[_0xfb29('0x40')][_0xfb29('0x5f')]=_0x274de6['id'];if(_0x56c58e[_0xfb29('0x36')]['filter']){_0x544f31[_0xfb29('0x40')]=_[_0xfb29('0x43')](_0x544f31[_0xfb29('0x40')],{'$or':_[_0xfb29('0x31')](_0x544f31[_0xfb29('0x3a')],function(_0x5c1ed7){var _0x189f96={};_0x189f96[_0x5c1ed7]={'$like':'%'+_0x56c58e['query'][_0xfb29('0x42')]+'%'};return _0x189f96;})});}_0x544f31=_[_0xfb29('0x43')]({},_0x544f31,_0x56c58e[_0xfb29('0x4c')]);return db[_0xfb29('0x5d')][_0xfb29('0x47')](_0x544f31);}})[_0xfb29('0x29')](function(_0x41022d){if(_0x41022d){return db['User'][_0xfb29('0x60')]({'where':{'id':_[_0xfb29('0x31')](_0x41022d,'UserId'),'role':'agent'},'attributes':['id','name',_0xfb29('0x61'),'updatedAt',_0xfb29('0x62')]});}})[_0xfb29('0x29')](function(_0x4e5882){if(_0x4e5882){return{'count':_0x4e5882[_0xfb29('0x24')],'rows':_[_0xfb29('0x31')](_0x4e5882[_0xfb29('0x48')],function(_0x726bf1){return{'membername':_0x726bf1[_0xfb29('0x2f')],'UserId':_0x726bf1['id'],'queue_name':_0x33ac36['name'],'FaxQueueId':_0x33ac36['id'],'interface':util['format'](_0xfb29('0x63'),_0xfb29('0x64'),_0x726bf1[_0xfb29('0x2f')]),'penalty':0x0,'paused':_0x726bf1[_0xfb29('0x61')],'createdAt':_0x726bf1[_0xfb29('0x62')],'updatedAt':_0x726bf1[_0xfb29('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb29('0x29')](respondWithFilteredResult(_0x8753a4,_0x544f31))[_0xfb29('0x49')](handleError(_0x8753a4,null));};exports[_0xfb29('0x66')]=function(_0x2c7eed,_0x159667,_0x283c0b){var _0x4b4ccd={};var _0x13f9b1={};var _0x101159;var _0x536d17;return db[_0xfb29('0x32')][_0xfb29('0x5c')]({'where':{'id':_0x2c7eed['params']['id']}})['then'](handleEntityNotFound(_0x159667,null))[_0xfb29('0x29')](function(_0x32fc07){if(_0x32fc07){_0x101159=_0x32fc07;_0x13f9b1[_0xfb29('0x35')]=_[_0xfb29('0x37')](db[_0xfb29('0x67')][_0xfb29('0x5e')]);_0x13f9b1['query']=_[_0xfb29('0x37')](_0x2c7eed[_0xfb29('0x36')]);_0x13f9b1[_0xfb29('0x38')]=_[_0xfb29('0x39')](_0x13f9b1['model'],_0x13f9b1[_0xfb29('0x36')]);_0x4b4ccd[_0xfb29('0x3a')]=_[_0xfb29('0x39')](_0x13f9b1[_0xfb29('0x35')],qs['fields'](_0x2c7eed[_0xfb29('0x36')][_0xfb29('0x3b')]));_0x4b4ccd[_0xfb29('0x3a')]=_0x4b4ccd[_0xfb29('0x3a')]['length']?_0x4b4ccd[_0xfb29('0x3a')]:_0x13f9b1['model'];_0x4b4ccd[_0xfb29('0x3e')]=qs[_0xfb29('0x3f')](_0x2c7eed[_0xfb29('0x36')][_0xfb29('0x3f')]);_0x4b4ccd[_0xfb29('0x40')]=qs['filters'](_[_0xfb29('0x41')](_0x2c7eed[_0xfb29('0x36')],_0x13f9b1['filters']));if(_0x2c7eed['query'][_0xfb29('0x42')]){_0x4b4ccd[_0xfb29('0x40')]=_[_0xfb29('0x43')](_0x4b4ccd[_0xfb29('0x40')],{'$or':_[_0xfb29('0x31')](_0x4b4ccd['attributes'],function(_0x1f9256){var _0x1d1854={};_0x1d1854[_0x1f9256]={'$like':'%'+_0x2c7eed[_0xfb29('0x36')]['filter']+'%'};return _0x1d1854;})});}_0x4b4ccd=_[_0xfb29('0x43')]({},_0x4b4ccd,_0x2c7eed[_0xfb29('0x4c')]);return _0x101159[_0xfb29('0x66')](_0x4b4ccd);}})[_0xfb29('0x29')](function(_0x40dff4){if(_0x40dff4){_0x536d17=_0x40dff4[_0xfb29('0x4b')];if(!_0x2c7eed[_0xfb29('0x36')][_0xfb29('0x3c')](_0xfb29('0x3d'))){_0x4b4ccd[_0xfb29('0x23')]=qs[_0xfb29('0x23')](_0x2c7eed[_0xfb29('0x36')][_0xfb29('0x23')]);_0x4b4ccd[_0xfb29('0x21')]=qs['offset'](_0x2c7eed['query'][_0xfb29('0x21')]);}return _0x101159['getTeams'](_0x4b4ccd);}})[_0xfb29('0x29')](function(_0x2296b8){if(_0x2296b8){return _0x2296b8?{'count':_0x536d17,'rows':_0x2296b8}:null;}})[_0xfb29('0x29')](respondWithResult(_0x159667,null))[_0xfb29('0x49')](handleError(_0x159667,null));};exports[_0xfb29('0x68')]=function(_0x52d38b,_0x5212a8,_0x1dd763){var _0x400609=_0x52d38b[_0xfb29('0x4f')][_0xfb29('0x69')];return db[_0xfb29('0x67')][_0xfb29('0x47')]({'where':{'id':_0x400609},'attributes':['id'],'include':[{'model':db[_0xfb29('0x6a')],'as':'Agents','attributes':['id',_0xfb29('0x2f'),_0xfb29('0x6b'),_0xfb29('0x6c'),_0xfb29('0x6d')],'raw':!![]}]})['then'](function(_0x2c436c){if(_0x2c436c){var _0x325e2b=_['flatMap'](_0x2c436c,function(_0x4242cf){var _0x460295=_0x4242cf[_0xfb29('0x2b')]({'plain':!![]});return _0x460295[_0xfb29('0x6e')];});return db[_0xfb29('0x32')][_0xfb29('0x4d')]({'where':{'id':_0x52d38b['params']['id']}})[_0xfb29('0x29')](function(_0x476629){return db['sequelize'][_0xfb29('0x6f')](function(_0xcb226c){return _0x476629['addTeams'](_0x400609,{'transaction':_0xcb226c})['then'](function(){return BPromise[_0xfb29('0x70')](_0x325e2b,function(_0x3b4cd8){return db[_0xfb29('0x5d')]['findOrCreate']({'where':{'UserId':_0x3b4cd8['id'],'FaxQueueId':_0x52d38b[_0xfb29('0x59')]['id']},'transaction':_0xcb226c});});})['then'](function(){_0x325e2b[_0xfb29('0x71')](function(_0x3df183){socket[_0xfb29('0x72')]('userFaxQueue:save',{'UserId':_0x3df183['id'],'FaxQueueId':_0x476629['id']});});});});});}})[_0xfb29('0x29')](respondWithStatusCode(_0x5212a8,null))[_0xfb29('0x49')](handleError(_0x5212a8,null));};exports['removeTeams']=function(_0x162217,_0x1700a3,_0x489719){return db[_0xfb29('0x67')][_0xfb29('0x47')]({'where':{'id':_0x162217['query'][_0xfb29('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfb29('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xfb29('0x29')](handleEntityNotFound(_0x1700a3,null))[_0xfb29('0x29')](function(_0xdf0770){var _0x58b1d8=_[_0xfb29('0x31')](_0xdf0770,'id');var _0x22f113=[];var _0x361c6b=[];var _0x2a0401=squel[_0xfb29('0x73')]();_0x2a0401['field'](_0xfb29('0x74'))[_0xfb29('0x75')](_0xfb29('0x76'),'tq')[_0xfb29('0x77')]('user_has_teams','ut',_0xfb29('0x78'))[_0xfb29('0x40')](_0xfb29('0x79'),_0x162217[_0xfb29('0x59')]['id']);for(var _0x32d9bb=0x0;_0x32d9bb<_0xdf0770[_0xfb29('0x4b')];_0x32d9bb+=0x1){let _0x12cc64=_0xdf0770[_0x32d9bb];for(var _0x14c4e7=0x0;_0x14c4e7<_0x12cc64[_0xfb29('0x6e')][_0xfb29('0x4b')];_0x14c4e7+=0x1){let _0x38968e=_0x12cc64[_0xfb29('0x6e')][_0x14c4e7];var _0x1c7be2=_0x2a0401[_0xfb29('0x7a')]();_0x1c7be2[_0xfb29('0x40')](_0xfb29('0x7b'),_0x38968e['id']);_0x361c6b[_0xfb29('0x7c')](db[_0xfb29('0x7d')][_0xfb29('0x36')](_0x1c7be2[_0xfb29('0x7e')](),{'type':db[_0xfb29('0x7d')][_0xfb29('0x7f')][_0xfb29('0x80')]})['then'](function(_0x5d534d){if(_0x5d534d[_0xfb29('0x4b')]===0x1){return _0x38968e['id'];}else{var _0x10fe23=_['every'](_[_0xfb29('0x31')](_0x5d534d,_0xfb29('0x81')),function(_0x13d428){return _[_0xfb29('0x82')](_0x58b1d8,_0x13d428);});if(_0x10fe23){return _0x38968e['id'];}}}));}}return BPromise[_0xfb29('0x83')](_0x361c6b)['then'](function(_0x5530b6){_0x22f113=_(_0x22f113)[_0xfb29('0x84')](_0x5530b6)[_0xfb29('0x85')]()['value']();return db[_0xfb29('0x32')]['find']({'where':{'id':_0x162217[_0xfb29('0x59')]['id']}})[_0xfb29('0x29')](function(_0x39afb6){return db[_0xfb29('0x7d')][_0xfb29('0x6f')](function(_0x590a33){return _0x39afb6[_0xfb29('0x86')](_0x162217['query'][_0xfb29('0x69')],{'transaction':_0x590a33})[_0xfb29('0x29')](function(){if(!_[_0xfb29('0x87')](_0x22f113)){return _0x39afb6[_0xfb29('0x88')](_0x22f113,{'transaction':_0x590a33});}})[_0xfb29('0x29')](function(){_0x22f113[_0xfb29('0x71')](function(_0x2db97a){socket[_0xfb29('0x72')](_0xfb29('0x89'),{'UserId':_0x2db97a,'FaxQueueId':_0x39afb6['id']});});});});});});})[_0xfb29('0x29')](respondWithStatusCode(_0x1700a3,null))[_0xfb29('0x49')](handleError(_0x1700a3,null));};exports[_0xfb29('0x8a')]=function(_0x548896,_0x599b6f,_0x5ecae9){return db['FaxQueue']['find']({'where':{'id':_0x548896[_0xfb29('0x59')]['id']}})['then'](handleEntityNotFound(_0x599b6f,null))[_0xfb29('0x29')](function(_0x354973){if(_0x354973){return _0x354973['addAgents'](_0x548896[_0xfb29('0x4f')][_0xfb29('0x69')],_[_0xfb29('0x8b')](_0x548896[_0xfb29('0x4f')],['ids','id'])||{})[_0xfb29('0x8c')](function(_0x5ca65b){for(var _0x44a371=0x0;_0x44a371<_0x548896[_0xfb29('0x4f')][_0xfb29('0x69')][_0xfb29('0x4b')];_0x44a371+=0x1){socket[_0xfb29('0x72')](_0xfb29('0x8d'),{'UserId':Number(_0x548896['body'][_0xfb29('0x69')][_0x44a371]),'FaxQueueId':Number(_0x548896[_0xfb29('0x59')]['id'])});}return _0x5ca65b;});}})['then'](respondWithResult(_0x599b6f,null))['catch'](handleError(_0x599b6f,null));};exports[_0xfb29('0x88')]=function(_0x40b909,_0x45901e,_0x1a296c){return db[_0xfb29('0x32')][_0xfb29('0x4d')]({'where':{'id':_0x40b909['params']['id']}})[_0xfb29('0x29')](handleEntityNotFound(_0x45901e,null))['then'](function(_0x1059ed){if(_0x1059ed){return _0x1059ed['removeAgents'](_0x40b909[_0xfb29('0x36')][_0xfb29('0x69')])[_0xfb29('0x29')](function(){if(_['isArray'](_0x40b909[_0xfb29('0x36')]['ids'])){for(var _0x216fb7=0x0;_0x216fb7<_0x40b909['query']['ids']['length'];_0x216fb7+=0x1){socket[_0xfb29('0x72')](_0xfb29('0x89'),{'UserId':Number(_0x40b909['query'][_0xfb29('0x69')][_0x216fb7]),'FaxQueueId':Number(_0x40b909[_0xfb29('0x59')]['id'])});}}else{socket[_0xfb29('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x40b909['query'][_0xfb29('0x69')]),'FaxQueueId':Number(_0x40b909[_0xfb29('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x45901e,null))[_0xfb29('0x49')](handleError(_0x45901e,null));};exports[_0xfb29('0x8e')]=function(_0x2a4866,_0x3190f2,_0x46a35d){var _0x3fcea8={};var _0x1e2306={};var _0x4bee85;var _0x430e10;return db[_0xfb29('0x32')]['findOne']({'where':{'id':_0x2a4866['params']['id']}})[_0xfb29('0x29')](handleEntityNotFound(_0x3190f2,null))['then'](function(_0x3be254){if(_0x3be254){_0x4bee85=_0x3be254;_0x1e2306[_0xfb29('0x35')]=_[_0xfb29('0x37')](db[_0xfb29('0x6a')][_0xfb29('0x5e')]);_0x1e2306['query']=_[_0xfb29('0x37')](_0x2a4866[_0xfb29('0x36')]);_0x1e2306[_0xfb29('0x38')]=_[_0xfb29('0x39')](_0x1e2306[_0xfb29('0x35')],_0x1e2306[_0xfb29('0x36')]);_0x3fcea8[_0xfb29('0x3a')]=_[_0xfb29('0x39')](_0x1e2306[_0xfb29('0x35')],qs[_0xfb29('0x3b')](_0x2a4866[_0xfb29('0x36')]['fields']));_0x3fcea8[_0xfb29('0x3a')]=_0x3fcea8[_0xfb29('0x3a')][_0xfb29('0x4b')]?_0x3fcea8[_0xfb29('0x3a')]:_0x1e2306[_0xfb29('0x35')];_0x3fcea8[_0xfb29('0x3e')]=qs[_0xfb29('0x3f')](_0x2a4866['query'][_0xfb29('0x3f')]);_0x3fcea8[_0xfb29('0x40')]=qs[_0xfb29('0x38')](_[_0xfb29('0x41')](_0x2a4866[_0xfb29('0x36')],_0x1e2306[_0xfb29('0x38')]));if(_0x2a4866['query'][_0xfb29('0x42')]){_0x3fcea8['where']=_['merge'](_0x3fcea8['where'],{'$or':_['map'](_0x3fcea8[_0xfb29('0x3a')],function(_0x46d89a){var _0x3fb141={};_0x3fb141[_0x46d89a]={'$like':'%'+_0x2a4866['query'][_0xfb29('0x42')]+'%'};return _0x3fb141;})});}_0x3fcea8=_[_0xfb29('0x43')]({},_0x3fcea8,_0x2a4866[_0xfb29('0x4c')]);return _0x4bee85[_0xfb29('0x8e')](_0x3fcea8);}})[_0xfb29('0x29')](function(_0x4947a8){if(_0x4947a8){_0x430e10=_0x4947a8['length'];if(!_0x2a4866['query']['hasOwnProperty'](_0xfb29('0x3d'))){_0x3fcea8[_0xfb29('0x23')]=qs[_0xfb29('0x23')](_0x2a4866[_0xfb29('0x36')][_0xfb29('0x23')]);_0x3fcea8[_0xfb29('0x21')]=qs[_0xfb29('0x21')](_0x2a4866[_0xfb29('0x36')]['offset']);}return _0x4bee85[_0xfb29('0x8e')](_0x3fcea8);}})[_0xfb29('0x29')](function(_0x107f2e){if(_0x107f2e){return _0x107f2e?{'count':_0x430e10,'rows':_0x107f2e}:null;}})[_0xfb29('0x29')](respondWithResult(_0x3190f2,null))['catch'](handleError(_0x3190f2,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 58c6bb9..b134979 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 _0xe026=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','update','emit'];(function(_0x186d25,_0x1e8ade){var _0x50b90b=function(_0x35e109){while(--_0x35e109){_0x186d25['push'](_0x186d25['shift']());}};_0x50b90b(++_0x1e8ade);}(_0xe026,0xb3));var _0x6e02=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xe026[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0x6e02('0x0'));var FaxQueue=require(_0x6e02('0x1'))['db'][_0x6e02('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e02('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2e1414){return function(_0x52051b,_0x1d6c15,_0x43a9ce){FaxQueueEvents[_0x6e02('0x4')](_0x2e1414+':'+_0x52051b['id'],_0x52051b);FaxQueueEvents[_0x6e02('0x4')](_0x2e1414,_0x52051b);_0x43a9ce(null);};}for(var e in events){if(events[_0x6e02('0x5')](e)){var event=events[e];FaxQueue[_0x6e02('0x6')](e,emitEvent(event));}}module[_0x6e02('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xf1d7=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x69752e,_0x2579f6){var _0x506a36=function(_0x1793bc){while(--_0x1793bc){_0x69752e['push'](_0x69752e['shift']());}};_0x506a36(++_0x2579f6);}(_0xf1d7,0x149));var _0x7f1d=function(_0x31da6f,_0x73589f){_0x31da6f=_0x31da6f-0x0;var _0x5c55bf=_0xf1d7[_0x31da6f];return _0x5c55bf;};'use strict';var EventEmitter=require(_0x7f1d('0x0'));var FaxQueue=require(_0x7f1d('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7f1d('0x2')](0x0);var events={'afterCreate':_0x7f1d('0x3'),'afterUpdate':_0x7f1d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d3de2){return function(_0x3ea0a4,_0x44abe1,_0x527c47){FaxQueueEvents['emit'](_0x3d3de2+':'+_0x3ea0a4['id'],_0x3ea0a4);FaxQueueEvents['emit'](_0x3d3de2,_0x3ea0a4);_0x527c47(null);};}for(var e in events){if(events[_0x7f1d('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x7f1d('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 7088b77..0a2f0d7 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 _0xe690=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x1fcd34,_0x4ed6f4){var _0x29c7f2=function(_0x1500b0){while(--_0x1500b0){_0x1fcd34['push'](_0x1fcd34['shift']());}};_0x29c7f2(++_0x4ed6f4);}(_0xe690,0x155));var _0x0e69=function(_0x1cd349,_0x129ba5){_0x1cd349=_0x1cd349-0x0;var _0x5b8ad6=_0xe690[_0x1cd349];return _0x5b8ad6;};'use strict';var _=require(_0x0e69('0x0'));var util=require(_0x0e69('0x1'));var logger=require(_0x0e69('0x2'))(_0x0e69('0x3'));var moment=require(_0x0e69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e69('0x5'));var rimraf=require('rimraf');var config=require(_0x0e69('0x6'));var attributes=require(_0x0e69('0x7'));module[_0x0e69('0x8')]=function(_0x166332,_0x218deb){return _0x166332[_0x0e69('0x9')](_0x0e69('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3a0=['request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api','bluebird'];(function(_0x195bf3,_0x2f0134){var _0x367508=function(_0x2dbcbf){while(--_0x2dbcbf){_0x195bf3['push'](_0x195bf3['shift']());}};_0x367508(++_0x2f0134);}(_0xb3a0,0x1dd));var _0x0b3a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb3a0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0b3a('0x0'));var util=require('util');var logger=require(_0x0b3a('0x1'))(_0x0b3a('0x2'));var moment=require('moment');var BPromise=require(_0x0b3a('0x3'));var rp=require(_0x0b3a('0x4'));var fs=require('fs');var path=require(_0x0b3a('0x5'));var rimraf=require(_0x0b3a('0x6'));var config=require(_0x0b3a('0x7'));var attributes=require(_0x0b3a('0x8'));module[_0x0b3a('0x9')]=function(_0x2fba9c,_0x196c1a){return _0x2fba9c[_0x0b3a('0xa')](_0x0b3a('0xb'),attributes,{'tableName':_0x0b3a('0xc'),'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 8b41770..7844741 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 _0x5a2a=['model','map','attributes','GetFaxQueue','ShowFaxQueue','find','raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','FaxQueue','findAll','options','where','limit','include'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x5a2a,0x79));var _0xa5a2=function(_0x545b8b,_0x4863df){_0x545b8b=_0x545b8b-0x0;var _0x295ea2=_0x5a2a[_0x545b8b];return _0x295ea2;};'use strict';var _=require('lodash');var util=require(_0xa5a2('0x0'));var moment=require(_0xa5a2('0x1'));var BPromise=require(_0xa5a2('0x2'));var rs=require(_0xa5a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa5a2('0x4'));var logger=require(_0xa5a2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa5a2('0x6'));var client=jayson[_0xa5a2('0x7')]['http']({'port':0x232a});config[_0xa5a2('0x8')]=_[_0xa5a2('0x9')](config[_0xa5a2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa5a2('0xa'))(new Redis(config[_0xa5a2('0x8')]));require(_0xa5a2('0xb'))[_0xa5a2('0xc')](socket);function respondWithRpcPromise(_0x81a0b7,_0x135a30,_0x37b667){return new BPromise(function(_0x561e4a,_0x155cee){return client[_0xa5a2('0xd')](_0x81a0b7,_0x37b667)[_0xa5a2('0xe')](function(_0x37ced0){logger[_0xa5a2('0xf')](_0xa5a2('0x10'),_0x135a30,'request\x20sent');logger[_0xa5a2('0x11')](_0xa5a2('0x12'),_0x135a30,'request\x20sent',JSON[_0xa5a2('0x13')](_0x37ced0));if(_0x37ced0[_0xa5a2('0x14')]){if(_0x37ced0[_0xa5a2('0x14')][_0xa5a2('0x15')]===0x1f4){logger[_0xa5a2('0x14')](_0xa5a2('0x10'),_0x135a30,_0x37ced0[_0xa5a2('0x14')][_0xa5a2('0x16')]);return _0x155cee(_0x37ced0['error']['message']);}logger[_0xa5a2('0x14')]('FaxQueue,\x20%s,\x20%s',_0x135a30,_0x37ced0[_0xa5a2('0x14')][_0xa5a2('0x16')]);return _0x561e4a(_0x37ced0[_0xa5a2('0x14')][_0xa5a2('0x16')]);}else{logger[_0xa5a2('0xf')](_0xa5a2('0x10'),_0x135a30,_0xa5a2('0x17'));_0x561e4a(_0x37ced0['result'][_0xa5a2('0x16')]);}})[_0xa5a2('0x18')](function(_0x216efa){logger[_0xa5a2('0x14')](_0xa5a2('0x10'),_0x135a30,_0x216efa);_0x155cee(_0x216efa);});});}exports['GetFaxQueue']=function(_0x45ab34){var _0x107907=this;return new Promise(function(_0x9b2bbc,_0x44d586){return db[_0xa5a2('0x19')][_0xa5a2('0x1a')]({'raw':_0x45ab34[_0xa5a2('0x1b')]?_0x45ab34[_0xa5a2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45ab34['options']?_0x45ab34[_0xa5a2('0x1b')][_0xa5a2('0x1c')]||null:null,'attributes':_0x45ab34[_0xa5a2('0x1b')]?_0x45ab34[_0xa5a2('0x1b')]['attributes']||null:null,'limit':_0x45ab34[_0xa5a2('0x1b')]?_0x45ab34['options'][_0xa5a2('0x1d')]||null:null,'include':_0x45ab34[_0xa5a2('0x1b')]?_0x45ab34[_0xa5a2('0x1b')]['include']?_['map'](_0x45ab34[_0xa5a2('0x1b')][_0xa5a2('0x1e')],function(_0x2c9ad0){return{'model':db[_0x2c9ad0[_0xa5a2('0x1f')]],'as':_0x2c9ad0['as'],'attributes':_0x2c9ad0['attributes'],'include':_0x2c9ad0[_0xa5a2('0x1e')]?_[_0xa5a2('0x20')](_0x2c9ad0['include'],function(_0x481912){return{'model':db[_0x481912[_0xa5a2('0x1f')]],'as':_0x481912['as'],'attributes':_0x481912[_0xa5a2('0x21')],'include':_0x481912[_0xa5a2('0x1e')]?_[_0xa5a2('0x20')](_0x481912[_0xa5a2('0x1e')],function(_0x152aaf){return{'model':db[_0x152aaf[_0xa5a2('0x1f')]],'as':_0x152aaf['as'],'attributes':_0x152aaf[_0xa5a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa5a2('0xe')](function(_0x1d9f04){logger[_0xa5a2('0xf')](_0xa5a2('0x22'),_0x45ab34);logger['debug']('GetFaxQueue',_0x45ab34,JSON['stringify'](_0x1d9f04));_0x9b2bbc(_0x1d9f04);})[_0xa5a2('0x18')](function(_0x1a5252){logger[_0xa5a2('0x14')](_0xa5a2('0x22'),_0x1a5252[_0xa5a2('0x16')],_0x45ab34);_0x44d586(_0x107907['error'](0x1f4,_0x1a5252['message']));});});};exports[_0xa5a2('0x23')]=function(_0x210dd9){var _0xdeb78f=this;return new Promise(function(_0x216e1b,_0x5749b3){return db[_0xa5a2('0x19')][_0xa5a2('0x24')]({'raw':_0x210dd9[_0xa5a2('0x1b')]?_0x210dd9['options'][_0xa5a2('0x25')]===undefined?!![]:![]:!![],'where':_0x210dd9[_0xa5a2('0x1b')]?_0x210dd9[_0xa5a2('0x1b')][_0xa5a2('0x1c')]||null:null,'attributes':_0x210dd9[_0xa5a2('0x1b')]?_0x210dd9['options']['attributes']||null:null,'include':_0x210dd9['options']?_0x210dd9[_0xa5a2('0x1b')][_0xa5a2('0x1e')]?_['map'](_0x210dd9[_0xa5a2('0x1b')][_0xa5a2('0x1e')],function(_0x542407){return{'model':db[_0x542407[_0xa5a2('0x1f')]],'as':_0x542407['as'],'attributes':_0x542407[_0xa5a2('0x21')],'include':_0x542407[_0xa5a2('0x1e')]?_['map'](_0x542407[_0xa5a2('0x1e')],function(_0x2c8a29){return{'model':db[_0x2c8a29[_0xa5a2('0x1f')]],'as':_0x2c8a29['as'],'attributes':_0x2c8a29[_0xa5a2('0x21')],'include':_0x2c8a29[_0xa5a2('0x1e')]?_['map'](_0x2c8a29[_0xa5a2('0x1e')],function(_0x2290a2){return{'model':db[_0x2290a2['model']],'as':_0x2290a2['as'],'attributes':_0x2290a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5a2('0xe')](function(_0x514cc8){logger['info'](_0xa5a2('0x23'),_0x210dd9);logger['debug'](_0xa5a2('0x23'),_0x210dd9,JSON['stringify'](_0x514cc8));_0x216e1b(_0x514cc8);})[_0xa5a2('0x18')](function(_0x370c98){logger[_0xa5a2('0x14')]('ShowFaxQueue',_0x370c98[_0xa5a2('0x16')],_0x210dd9);_0x5749b3(_0xdeb78f['error'](0x1f4,_0x370c98[_0xa5a2('0x16')]));});});}; \ No newline at end of file +var _0x1ace=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','stringify','ShowFaxQueue','find','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','socket.io-emitter','./faxQueue.socket','request'];(function(_0x33cd42,_0x37725a){var _0x234c55=function(_0x569257){while(--_0x569257){_0x33cd42['push'](_0x33cd42['shift']());}};_0x234c55(++_0x37725a);}(_0x1ace,0xcc));var _0xe1ac=function(_0x5ecbe8,_0x42522f){_0x5ecbe8=_0x5ecbe8-0x0;var _0x1c6e21=_0x1ace[_0x5ecbe8];return _0x1c6e21;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1ac('0x0'));var BPromise=require(_0xe1ac('0x1'));var rs=require(_0xe1ac('0x2'));var fs=require('fs');var Redis=require(_0xe1ac('0x3'));var db=require(_0xe1ac('0x4'))['db'];var utils=require(_0xe1ac('0x5'));var logger=require(_0xe1ac('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe1ac('0x7')]['http']({'port':0x232a});config[_0xe1ac('0x8')]=_['defaults'](config[_0xe1ac('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1ac('0x9'))(new Redis(config[_0xe1ac('0x8')]));require(_0xe1ac('0xa'))['register'](socket);function respondWithRpcPromise(_0x57c02d,_0x2c39fe,_0x494b75){return new BPromise(function(_0x466911,_0x4dbe71){return client[_0xe1ac('0xb')](_0x57c02d,_0x494b75)['then'](function(_0x14cda7){logger['info'](_0xe1ac('0xc'),_0x2c39fe,_0xe1ac('0xd'));logger[_0xe1ac('0xe')](_0xe1ac('0xf'),_0x2c39fe,_0xe1ac('0xd'),JSON['stringify'](_0x14cda7));if(_0x14cda7[_0xe1ac('0x10')]){if(_0x14cda7['error'][_0xe1ac('0x11')]===0x1f4){logger['error'](_0xe1ac('0xc'),_0x2c39fe,_0x14cda7[_0xe1ac('0x10')][_0xe1ac('0x12')]);return _0x4dbe71(_0x14cda7[_0xe1ac('0x10')]['message']);}logger['error'](_0xe1ac('0xc'),_0x2c39fe,_0x14cda7[_0xe1ac('0x10')][_0xe1ac('0x12')]);return _0x466911(_0x14cda7[_0xe1ac('0x10')][_0xe1ac('0x12')]);}else{logger[_0xe1ac('0x13')](_0xe1ac('0xc'),_0x2c39fe,_0xe1ac('0xd'));_0x466911(_0x14cda7['result']['message']);}})[_0xe1ac('0x14')](function(_0x5c58db){logger[_0xe1ac('0x10')](_0xe1ac('0xc'),_0x2c39fe,_0x5c58db);_0x4dbe71(_0x5c58db);});});}exports[_0xe1ac('0x15')]=function(_0x555f5d){var _0x5cc6ee=this;return new Promise(function(_0x1a4442,_0x55672a){return db[_0xe1ac('0x16')][_0xe1ac('0x17')]({'raw':_0x555f5d['options']?_0x555f5d[_0xe1ac('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x555f5d['options']?_0x555f5d[_0xe1ac('0x18')][_0xe1ac('0x19')]||null:null,'attributes':_0x555f5d['options']?_0x555f5d['options'][_0xe1ac('0x1a')]||null:null,'limit':_0x555f5d[_0xe1ac('0x18')]?_0x555f5d['options'][_0xe1ac('0x1b')]||null:null,'include':_0x555f5d[_0xe1ac('0x18')]?_0x555f5d[_0xe1ac('0x18')]['include']?_['map'](_0x555f5d[_0xe1ac('0x18')]['include'],function(_0x7e3292){return{'model':db[_0x7e3292['model']],'as':_0x7e3292['as'],'attributes':_0x7e3292[_0xe1ac('0x1a')],'include':_0x7e3292[_0xe1ac('0x1c')]?_[_0xe1ac('0x1d')](_0x7e3292[_0xe1ac('0x1c')],function(_0x4d93a8){return{'model':db[_0x4d93a8['model']],'as':_0x4d93a8['as'],'attributes':_0x4d93a8[_0xe1ac('0x1a')],'include':_0x4d93a8['include']?_[_0xe1ac('0x1d')](_0x4d93a8['include'],function(_0x420191){return{'model':db[_0x420191[_0xe1ac('0x1e')]],'as':_0x420191['as'],'attributes':_0x420191[_0xe1ac('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102a33){logger[_0xe1ac('0x13')](_0xe1ac('0x15'),_0x555f5d);logger[_0xe1ac('0xe')](_0xe1ac('0x15'),_0x555f5d,JSON[_0xe1ac('0x1f')](_0x102a33));_0x1a4442(_0x102a33);})[_0xe1ac('0x14')](function(_0x2a1c06){logger[_0xe1ac('0x10')]('GetFaxQueue',_0x2a1c06[_0xe1ac('0x12')],_0x555f5d);_0x55672a(_0x5cc6ee[_0xe1ac('0x10')](0x1f4,_0x2a1c06[_0xe1ac('0x12')]));});});};exports[_0xe1ac('0x20')]=function(_0x21c1b3){var _0x344d71=this;return new Promise(function(_0x353d33,_0x4dbf59){return db['FaxQueue'][_0xe1ac('0x21')]({'raw':_0x21c1b3[_0xe1ac('0x18')]?_0x21c1b3[_0xe1ac('0x18')][_0xe1ac('0x22')]===undefined?!![]:![]:!![],'where':_0x21c1b3[_0xe1ac('0x18')]?_0x21c1b3[_0xe1ac('0x18')][_0xe1ac('0x19')]||null:null,'attributes':_0x21c1b3['options']?_0x21c1b3[_0xe1ac('0x18')][_0xe1ac('0x1a')]||null:null,'include':_0x21c1b3[_0xe1ac('0x18')]?_0x21c1b3[_0xe1ac('0x18')][_0xe1ac('0x1c')]?_['map'](_0x21c1b3['options'][_0xe1ac('0x1c')],function(_0x17b84d){return{'model':db[_0x17b84d[_0xe1ac('0x1e')]],'as':_0x17b84d['as'],'attributes':_0x17b84d[_0xe1ac('0x1a')],'include':_0x17b84d[_0xe1ac('0x1c')]?_[_0xe1ac('0x1d')](_0x17b84d[_0xe1ac('0x1c')],function(_0x20d8e0){return{'model':db[_0x20d8e0['model']],'as':_0x20d8e0['as'],'attributes':_0x20d8e0[_0xe1ac('0x1a')],'include':_0x20d8e0[_0xe1ac('0x1c')]?_['map'](_0x20d8e0[_0xe1ac('0x1c')],function(_0x2c2ddb){return{'model':db[_0x2c2ddb[_0xe1ac('0x1e')]],'as':_0x2c2ddb['as'],'attributes':_0x2c2ddb[_0xe1ac('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ac('0x23')](function(_0x2ed7b9){logger[_0xe1ac('0x13')]('ShowFaxQueue',_0x21c1b3);logger['debug']('ShowFaxQueue',_0x21c1b3,JSON['stringify'](_0x2ed7b9));_0x353d33(_0x2ed7b9);})['catch'](function(_0x51476a){logger[_0xe1ac('0x10')](_0xe1ac('0x20'),_0x51476a[_0xe1ac('0x12')],_0x21c1b3);_0x4dbf59(_0x344d71['error'](0x1f4,_0x51476a[_0xe1ac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 074310d..b21ef3f 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 _0x8bea=['./faxQueue.events','save','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x8bea,0xfc));var _0xa8be=function(_0x5b209d,_0x2ea0fe){_0x5b209d=_0x5b209d-0x0;var _0x5cbe9d=_0x8bea[_0x5b209d];return _0x5cbe9d;};'use strict';var FaxQueueEvents=require(_0xa8be('0x0'));var events=[_0xa8be('0x1'),_0xa8be('0x2'),_0xa8be('0x3')];function createListener(_0x2fe52e,_0x7b1d84){return function(_0x5ac9c1){_0x7b1d84[_0xa8be('0x4')](_0x2fe52e,_0x5ac9c1);};}function removeListener(_0x2ef761,_0x1fc3a0){return function(){FaxQueueEvents[_0xa8be('0x5')](_0x2ef761,_0x1fc3a0);};}exports[_0xa8be('0x6')]=function(_0x39d97b){for(var _0x381ef6=0x0,_0x200872=events[_0xa8be('0x7')];_0x381ef6<_0x200872;_0x381ef6++){var _0x5e726d=events[_0x381ef6];var _0x20b355=createListener(_0xa8be('0x8')+_0x5e726d,_0x39d97b);FaxQueueEvents['on'](_0x5e726d,_0x20b355);}}; \ No newline at end of file +var _0x6c47=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x550651,_0x32926b){var _0x53edcf=function(_0x1ebc42){while(--_0x1ebc42){_0x550651['push'](_0x550651['shift']());}};_0x53edcf(++_0x32926b);}(_0x6c47,0xae));var _0x76c4=function(_0x2df39c,_0x122585){_0x2df39c=_0x2df39c-0x0;var _0x405e8d=_0x6c47[_0x2df39c];return _0x405e8d;};'use strict';var FaxQueueEvents=require(_0x76c4('0x0'));var events=[_0x76c4('0x1'),'remove',_0x76c4('0x2')];function createListener(_0x10d0dc,_0x14123){return function(_0x38cc91){_0x14123[_0x76c4('0x3')](_0x10d0dc,_0x38cc91);};}function removeListener(_0x578919,_0x35ba5f){return function(){FaxQueueEvents[_0x76c4('0x4')](_0x578919,_0x35ba5f);};}exports[_0x76c4('0x5')]=function(_0x5b66fb){for(var _0x1cf8e0=0x0,_0x12f0f1=events[_0x76c4('0x6')];_0x1cf8e0<_0x12f0f1;_0x1cf8e0++){var _0x1aec6e=events[_0x1cf8e0];var _0x5ee361=createListener(_0x76c4('0x7')+_0x1aec6e,_0x5b66fb);FaxQueueEvents['on'](_0x1aec6e,_0x5ee361);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a044ab3..a4f714c 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 _0xc2c7=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0xc2c7,0x134));var _0x7c2c=function(_0x22ca15,_0x50b861){_0x22ca15=_0x22ca15-0x0;var _0x5ccd00=_0xc2c7[_0x22ca15];return _0x5ccd00;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x14')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7c2c('0x14')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['addAgents']);router[_0x7c2c('0x16')](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['delete'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x19')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1a')]);router[_0x7c2c('0x19')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1b')]);module[_0x7c2c('0x1c')]=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(_0x4178df,_0x1b1cc6){var _0x2388aa=function(_0x4da147){while(--_0x4da147){_0x4178df['push'](_0x4178df['shift']());}};_0x2388aa(++_0x1b1cc6);}(_0x53ec,0x192));var _0xc53e=function(_0x2bf258,_0x5e0bb2){_0x2bf258=_0x2bf258-0x0;var _0x3b43af=_0x53ec[_0x2bf258];return _0x3b43af;};'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 1046bfa..be33147 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 _0xae69=['exports','STRING','DATE','moment','sequelize'];(function(_0x472e23,_0x28b306){var _0x3e2d77=function(_0xaf0b79){while(--_0xaf0b79){_0x472e23['push'](_0x472e23['shift']());}};_0x3e2d77(++_0x28b306);}(_0xae69,0xa3));var _0x9ae6=function(_0x12745d,_0x1464c0){_0x12745d=_0x12745d-0x0;var _0xdd100e=_0xae69[_0x12745d];return _0xdd100e;};'use strict';var moment=require(_0x9ae6('0x0'));var Sequelize=require(_0x9ae6('0x1'));module[_0x9ae6('0x2')]={'uniqueid':{'type':Sequelize[_0x9ae6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9ae6('0x3')]},'joinAt':{'type':Sequelize[_0x9ae6('0x4')]},'leaveAt':{'type':Sequelize[_0x9ae6('0x4')]},'acceptAt':{'type':Sequelize[_0x9ae6('0x4')]},'exitAt':{'type':Sequelize[_0x9ae6('0x4')]},'reason':{'type':Sequelize[_0x9ae6('0x3')]}}; \ No newline at end of file +var _0x9f7a=['DATE','moment','sequelize','exports','STRING'];(function(_0x36888d,_0x22988e){var _0x14f524=function(_0x5cdbfe){while(--_0x5cdbfe){_0x36888d['push'](_0x36888d['shift']());}};_0x14f524(++_0x22988e);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9f7a[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0xa9f7('0x0'));var Sequelize=require(_0xa9f7('0x1'));module[_0xa9f7('0x2')]={'uniqueid':{'type':Sequelize[_0xa9f7('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa9f7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa9f7('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index aee5440..0deea21 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 _0x702d=['nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','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','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x410152,_0x4472d7){var _0x232156=function(_0x55573c){while(--_0x55573c){_0x410152['push'](_0x410152['shift']());}};_0x232156(++_0x4472d7);}(_0x702d,0x147));var _0xd702=function(_0x58f601,_0x1237bf){_0x58f601=_0x58f601-0x0;var _0x1e89b8=_0x702d[_0x58f601];return _0x1e89b8;};'use strict';var emlformat=require(_0xd702('0x0'));var rimraf=require(_0xd702('0x1'));var zipdir=require(_0xd702('0x2'));var jsonpatch=require(_0xd702('0x3'));var rp=require(_0xd702('0x4'));var moment=require('moment');var BPromise=require(_0xd702('0x5'));var Mustache=require(_0xd702('0x6'));var util=require(_0xd702('0x7'));var path=require(_0xd702('0x8'));var sox=require('sox');var csv=require(_0xd702('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd702('0xa'));var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0x9'));var querystring=require(_0xd702('0xe'));var Papa=require(_0xd702('0xf'));var Redis=require(_0xd702('0x10'));var authService=require(_0xd702('0x11'));var qs=require(_0xd702('0x12'));var as=require(_0xd702('0x13'));var hardwareService=require(_0xd702('0x14'));var logger=require(_0xd702('0x15'))(_0xd702('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd702('0x17'));var db=require(_0xd702('0x18'))['db'];function respondWithStatusCode(_0x273577,_0x5c0dad){_0x5c0dad=_0x5c0dad||0xcc;return function(_0x13ee5a){if(_0x13ee5a){return _0x273577[_0xd702('0x19')](_0x5c0dad);}return _0x273577[_0xd702('0x1a')](_0x5c0dad)[_0xd702('0x1b')]();};}function respondWithResult(_0x3948f8,_0x181ff2){_0x181ff2=_0x181ff2||0xc8;return function(_0x59dd33){if(_0x59dd33){return _0x3948f8[_0xd702('0x1a')](_0x181ff2)[_0xd702('0x1c')](_0x59dd33);}};}function respondWithFilteredResult(_0x5d7978,_0x707b9){return function(_0x4922f8){if(_0x4922f8){var _0x268c66=typeof _0x707b9[_0xd702('0x1d')]==='undefined'&&typeof _0x707b9[_0xd702('0x1e')]===_0xd702('0x1f');var _0x2a87f2=_0x4922f8['count'];var _0x5b3b1d=_0x268c66?0x0:_0x707b9[_0xd702('0x1d')];var _0x5a296e=_0x268c66?_0x4922f8[_0xd702('0x20')]:_0x707b9[_0xd702('0x1d')]+_0x707b9[_0xd702('0x1e')];var _0x265b1b;if(_0x5a296e>=_0x2a87f2){_0x5a296e=_0x2a87f2;_0x265b1b=0xc8;}else{_0x265b1b=0xce;}_0x5d7978[_0xd702('0x1a')](_0x265b1b);return _0x5d7978[_0xd702('0x21')](_0xd702('0x22'),_0x5b3b1d+'-'+_0x5a296e+'/'+_0x2a87f2)['json'](_0x4922f8);}return null;};}function patchUpdates(_0x4be140){return function(_0x536ca8){try{jsonpatch[_0xd702('0x23')](_0x536ca8,_0x4be140,!![]);}catch(_0x109284){return BPromise['reject'](_0x109284);}return _0x536ca8[_0xd702('0x24')]();};}function saveUpdates(_0x5d91fd,_0xc4c246){return function(_0x5824ec){if(_0x5824ec){return _0x5824ec['update'](_0x5d91fd)['then'](function(_0x21c00e){return _0x21c00e;});}return null;};}function removeEntity(_0xeec2e4,_0x459184){return function(_0x49761c){if(_0x49761c){return _0x49761c[_0xd702('0x25')]()[_0xd702('0x26')](function(){_0xeec2e4[_0xd702('0x1a')](0xcc)[_0xd702('0x1b')]();});}};}function handleEntityNotFound(_0x1200ed,_0x146f35){return function(_0x94c58d){if(!_0x94c58d){_0x1200ed[_0xd702('0x19')](0x194);}return _0x94c58d;};}function handleError(_0x22328a,_0x50d7ad){_0x50d7ad=_0x50d7ad||0x1f4;return function(_0x116b2f){logger[_0xd702('0x27')](_0x116b2f[_0xd702('0x28')]);if(_0x116b2f[_0xd702('0x29')]){delete _0x116b2f[_0xd702('0x29')];}_0x22328a[_0xd702('0x1a')](_0x50d7ad)[_0xd702('0x2a')](_0x116b2f);};}exports[_0xd702('0x2b')]=function(_0x5f1084,_0x47c9a2){var _0x1870b7={},_0x43cd38={},_0x56bc8d={'count':0x0,'rows':[]};var _0x45cd22=_[_0xd702('0x2c')](db[_0xd702('0x2d')][_0xd702('0x2e')],function(_0x56e9cd){return{'name':_0x56e9cd[_0xd702('0x2f')],'type':_0x56e9cd[_0xd702('0x30')][_0xd702('0x31')]};});_0x43cd38[_0xd702('0x32')]=_[_0xd702('0x2c')](_0x45cd22,'name');_0x43cd38[_0xd702('0x33')]=_[_0xd702('0x34')](_0x5f1084[_0xd702('0x33')]);_0x43cd38['filters']=_[_0xd702('0x35')](_0x43cd38['model'],_0x43cd38['query']);_0x1870b7[_0xd702('0x36')]=_[_0xd702('0x35')](_0x43cd38[_0xd702('0x32')],qs['fields'](_0x5f1084[_0xd702('0x33')][_0xd702('0x37')]));_0x1870b7['attributes']=_0x1870b7[_0xd702('0x36')][_0xd702('0x38')]?_0x1870b7[_0xd702('0x36')]:_0x43cd38[_0xd702('0x32')];if(!_0x5f1084[_0xd702('0x33')][_0xd702('0x39')](_0xd702('0x3a'))){_0x1870b7[_0xd702('0x1e')]=qs[_0xd702('0x1e')](_0x5f1084[_0xd702('0x33')][_0xd702('0x1e')]);_0x1870b7[_0xd702('0x1d')]=qs[_0xd702('0x1d')](_0x5f1084['query'][_0xd702('0x1d')]);}_0x1870b7[_0xd702('0x3b')]=qs[_0xd702('0x3c')](_0x5f1084[_0xd702('0x33')][_0xd702('0x3c')]);_0x1870b7[_0xd702('0x3d')]=qs[_0xd702('0x3e')](_['pick'](_0x5f1084['query'],_0x43cd38[_0xd702('0x3e')]),_0x45cd22);if(_0x5f1084[_0xd702('0x33')]['filter']){_0x1870b7['where']=_[_0xd702('0x3f')](_0x1870b7[_0xd702('0x3d')],{'$or':_['map'](_0x45cd22,function(_0x3a7aee){if(_0x3a7aee[_0xd702('0x30')]!==_0xd702('0x40')){var _0x4822d9={};_0x4822d9[_0x3a7aee[_0xd702('0x29')]]={'$like':'%'+_0x5f1084[_0xd702('0x33')][_0xd702('0x41')]+'%'};return _0x4822d9;}})});}_0x1870b7=_['merge']({},_0x1870b7,_0x5f1084[_0xd702('0x42')]);var _0x512854={'where':_0x1870b7[_0xd702('0x3d')]};return db[_0xd702('0x2d')][_0xd702('0x20')](_0x512854)[_0xd702('0x26')](function(_0x6af8d6){_0x56bc8d[_0xd702('0x20')]=_0x6af8d6;if(_0x5f1084[_0xd702('0x33')][_0xd702('0x43')]){_0x1870b7['include']=[{'all':!![]}];}return db[_0xd702('0x2d')][_0xd702('0x44')](_0x1870b7);})[_0xd702('0x26')](function(_0x3d703e){_0x56bc8d[_0xd702('0x45')]=_0x3d703e;return _0x56bc8d;})['then'](respondWithFilteredResult(_0x47c9a2,_0x1870b7))[_0xd702('0x46')](handleError(_0x47c9a2,null));};exports[_0xd702('0x47')]=function(_0x3424a3,_0x4c56ae){var _0xd48ad0={'raw':!![],'where':{'id':_0x3424a3[_0xd702('0x48')]['id']}},_0x3a1ed5={};_0x3a1ed5[_0xd702('0x32')]=_['keys'](db[_0xd702('0x2d')][_0xd702('0x2e')]);_0x3a1ed5[_0xd702('0x33')]=_[_0xd702('0x34')](_0x3424a3[_0xd702('0x33')]);_0x3a1ed5['filters']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],_0x3a1ed5['query']);_0xd48ad0['attributes']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],qs[_0xd702('0x37')](_0x3424a3[_0xd702('0x33')][_0xd702('0x37')]));_0xd48ad0[_0xd702('0x36')]=_0xd48ad0[_0xd702('0x36')][_0xd702('0x38')]?_0xd48ad0[_0xd702('0x36')]:_0x3a1ed5['model'];if(_0x3424a3['query'][_0xd702('0x43')]){_0xd48ad0['include']=[{'all':!![]}];}_0xd48ad0=_[_0xd702('0x3f')]({},_0xd48ad0,_0x3424a3['options']);return db[_0xd702('0x2d')]['find'](_0xd48ad0)[_0xd702('0x26')](handleEntityNotFound(_0x4c56ae,null))['then'](respondWithResult(_0x4c56ae,null))[_0xd702('0x46')](handleError(_0x4c56ae,null));};exports[_0xd702('0x49')]=function(_0x543b8f,_0x160f5e){return db[_0xd702('0x2d')][_0xd702('0x49')](_0x543b8f[_0xd702('0x4a')],{})[_0xd702('0x26')](respondWithResult(_0x160f5e,0xc9))['catch'](handleError(_0x160f5e,null));};exports[_0xd702('0x4b')]=function(_0x14c1db,_0x2d09be){if(_0x14c1db['body']['id']){delete _0x14c1db[_0xd702('0x4a')]['id'];}return db['FaxQueueReport'][_0xd702('0x4c')]({'where':{'id':_0x14c1db[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x2d09be,null))['then'](saveUpdates(_0x14c1db['body'],null))[_0xd702('0x26')](respondWithResult(_0x2d09be,null))[_0xd702('0x46')](handleError(_0x2d09be,null));};exports[_0xd702('0x25')]=function(_0x397e91,_0x16e59b){return db[_0xd702('0x2d')][_0xd702('0x4c')]({'where':{'id':_0x397e91[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x16e59b,null))[_0xd702('0x26')](removeEntity(_0x16e59b,null))['catch'](handleError(_0x16e59b,null));};exports['describe']=function(_0x2980d5,_0x11260a){return db[_0xd702('0x2d')]['describe']()['then'](respondWithResult(_0x11260a,null))[_0xd702('0x46')](handleError(_0x11260a,null));}; \ No newline at end of file +var _0xf403=['fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','params','intersection','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf403,0x1d3));var _0x3f40=function(_0x42f19d,_0x502198){_0x42f19d=_0x42f19d-0x0;var _0x1ee0b9=_0xf403[_0x42f19d];return _0x1ee0b9;};'use strict';var emlformat=require(_0x3f40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f40('0x1'));var jsonpatch=require(_0x3f40('0x2'));var rp=require(_0x3f40('0x3'));var moment=require(_0x3f40('0x4'));var BPromise=require(_0x3f40('0x5'));var Mustache=require(_0x3f40('0x6'));var util=require(_0x3f40('0x7'));var path=require(_0x3f40('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f40('0x9'));var fs=require('fs');var fs_extra=require(_0x3f40('0xa'));var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332635,_0x509c02){_0x509c02=_0x509c02||0xcc;return function(_0x116460){if(_0x116460){return _0x332635[_0x3f40('0x17')](_0x509c02);}return _0x332635[_0x3f40('0x18')](_0x509c02)[_0x3f40('0x19')]();};}function respondWithResult(_0x569c6e,_0x2b2bfe){_0x2b2bfe=_0x2b2bfe||0xc8;return function(_0x308e97){if(_0x308e97){return _0x569c6e[_0x3f40('0x18')](_0x2b2bfe)[_0x3f40('0x1a')](_0x308e97);}};}function respondWithFilteredResult(_0x232241,_0x4e28b9){return function(_0x2e51ed){if(_0x2e51ed){var _0x3d11c9=typeof _0x4e28b9['offset']==='undefined'&&typeof _0x4e28b9['limit']===_0x3f40('0x1b');var _0x13b950=_0x2e51ed[_0x3f40('0x1c')];var _0x131e55=_0x3d11c9?0x0:_0x4e28b9[_0x3f40('0x1d')];var _0x5b4ebc=_0x3d11c9?_0x2e51ed[_0x3f40('0x1c')]:_0x4e28b9[_0x3f40('0x1d')]+_0x4e28b9[_0x3f40('0x1e')];var _0x29405a;if(_0x5b4ebc>=_0x13b950){_0x5b4ebc=_0x13b950;_0x29405a=0xc8;}else{_0x29405a=0xce;}_0x232241[_0x3f40('0x18')](_0x29405a);return _0x232241['set'](_0x3f40('0x1f'),_0x131e55+'-'+_0x5b4ebc+'/'+_0x13b950)['json'](_0x2e51ed);}return null;};}function patchUpdates(_0x12aabf){return function(_0x32b945){try{jsonpatch[_0x3f40('0x20')](_0x32b945,_0x12aabf,!![]);}catch(_0x113293){return BPromise[_0x3f40('0x21')](_0x113293);}return _0x32b945['save']();};}function saveUpdates(_0x27f5a5,_0x379b4e){return function(_0x117823){if(_0x117823){return _0x117823[_0x3f40('0x22')](_0x27f5a5)[_0x3f40('0x23')](function(_0xa1f39d){return _0xa1f39d;});}return null;};}function removeEntity(_0x4e1f47,_0x31fc91){return function(_0x59eb32){if(_0x59eb32){return _0x59eb32[_0x3f40('0x24')]()['then'](function(){_0x4e1f47[_0x3f40('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b47e,_0x5ae235){return function(_0x4b206b){if(!_0x4b206b){_0x37b47e['sendStatus'](0x194);}return _0x4b206b;};}function handleError(_0x30a945,_0x26e46b){_0x26e46b=_0x26e46b||0x1f4;return function(_0x140044){logger[_0x3f40('0x25')](_0x140044['stack']);if(_0x140044[_0x3f40('0x26')]){delete _0x140044['name'];}_0x30a945[_0x3f40('0x18')](_0x26e46b)[_0x3f40('0x27')](_0x140044);};}exports[_0x3f40('0x28')]=function(_0x5e0f25,_0x287632){var _0x4b5ef7={},_0x1cab5c={},_0x5b9079={'count':0x0,'rows':[]};var _0x49057b=_[_0x3f40('0x29')](db[_0x3f40('0x2a')][_0x3f40('0x2b')],function(_0xb23186){return{'name':_0xb23186[_0x3f40('0x2c')],'type':_0xb23186[_0x3f40('0x2d')][_0x3f40('0x2e')]};});_0x1cab5c[_0x3f40('0x2f')]=_['map'](_0x49057b,_0x3f40('0x26'));_0x1cab5c[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x5e0f25[_0x3f40('0x30')]);_0x1cab5c[_0x3f40('0x32')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],_0x1cab5c[_0x3f40('0x30')]);_0x4b5ef7[_0x3f40('0x33')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],qs[_0x3f40('0x34')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x34')]));_0x4b5ef7[_0x3f40('0x33')]=_0x4b5ef7[_0x3f40('0x33')][_0x3f40('0x35')]?_0x4b5ef7[_0x3f40('0x33')]:_0x1cab5c[_0x3f40('0x2f')];if(!_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x36')](_0x3f40('0x37'))){_0x4b5ef7[_0x3f40('0x1e')]=qs[_0x3f40('0x1e')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1e')]);_0x4b5ef7[_0x3f40('0x1d')]=qs[_0x3f40('0x1d')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1d')]);}_0x4b5ef7[_0x3f40('0x38')]=qs[_0x3f40('0x39')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x39')]);_0x4b5ef7[_0x3f40('0x3a')]=qs[_0x3f40('0x32')](_[_0x3f40('0x3b')](_0x5e0f25[_0x3f40('0x30')],_0x1cab5c[_0x3f40('0x32')]),_0x49057b);if(_0x5e0f25[_0x3f40('0x30')]['filter']){_0x4b5ef7['where']=_[_0x3f40('0x3c')](_0x4b5ef7[_0x3f40('0x3a')],{'$or':_[_0x3f40('0x29')](_0x49057b,function(_0x4778ec){if(_0x4778ec[_0x3f40('0x2d')]!==_0x3f40('0x3d')){var _0x1ffa33={};_0x1ffa33[_0x4778ec['name']]={'$like':'%'+_0x5e0f25[_0x3f40('0x30')]['filter']+'%'};return _0x1ffa33;}})});}_0x4b5ef7=_[_0x3f40('0x3c')]({},_0x4b5ef7,_0x5e0f25[_0x3f40('0x3e')]);var _0xec24e4={'where':_0x4b5ef7['where']};return db[_0x3f40('0x2a')][_0x3f40('0x1c')](_0xec24e4)['then'](function(_0x1eb15c){_0x5b9079[_0x3f40('0x1c')]=_0x1eb15c;if(_0x5e0f25['query'][_0x3f40('0x3f')]){_0x4b5ef7['include']=[{'all':!![]}];}return db[_0x3f40('0x2a')]['findAll'](_0x4b5ef7);})['then'](function(_0x8e89a){_0x5b9079['rows']=_0x8e89a;return _0x5b9079;})[_0x3f40('0x23')](respondWithFilteredResult(_0x287632,_0x4b5ef7))[_0x3f40('0x40')](handleError(_0x287632,null));};exports[_0x3f40('0x41')]=function(_0x460237,_0x48b65e){var _0x237c91={'raw':!![],'where':{'id':_0x460237[_0x3f40('0x42')]['id']}},_0x5b0eaa={};_0x5b0eaa[_0x3f40('0x2f')]=_[_0x3f40('0x31')](db['FaxQueueReport']['rawAttributes']);_0x5b0eaa[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x460237[_0x3f40('0x30')]);_0x5b0eaa[_0x3f40('0x32')]=_[_0x3f40('0x43')](_0x5b0eaa[_0x3f40('0x2f')],_0x5b0eaa[_0x3f40('0x30')]);_0x237c91[_0x3f40('0x33')]=_['intersection'](_0x5b0eaa[_0x3f40('0x2f')],qs['fields'](_0x460237['query'][_0x3f40('0x34')]));_0x237c91[_0x3f40('0x33')]=_0x237c91[_0x3f40('0x33')][_0x3f40('0x35')]?_0x237c91[_0x3f40('0x33')]:_0x5b0eaa[_0x3f40('0x2f')];if(_0x460237[_0x3f40('0x30')][_0x3f40('0x3f')]){_0x237c91[_0x3f40('0x44')]=[{'all':!![]}];}_0x237c91=_[_0x3f40('0x3c')]({},_0x237c91,_0x460237[_0x3f40('0x3e')]);return db[_0x3f40('0x2a')][_0x3f40('0x45')](_0x237c91)[_0x3f40('0x23')](handleEntityNotFound(_0x48b65e,null))['then'](respondWithResult(_0x48b65e,null))[_0x3f40('0x40')](handleError(_0x48b65e,null));};exports['create']=function(_0x2c1fa2,_0x2f16d6){return db['FaxQueueReport'][_0x3f40('0x46')](_0x2c1fa2[_0x3f40('0x47')],{})[_0x3f40('0x23')](respondWithResult(_0x2f16d6,0xc9))[_0x3f40('0x40')](handleError(_0x2f16d6,null));};exports[_0x3f40('0x22')]=function(_0x268ae4,_0x851bfc){if(_0x268ae4[_0x3f40('0x47')]['id']){delete _0x268ae4[_0x3f40('0x47')]['id'];}return db[_0x3f40('0x2a')][_0x3f40('0x45')]({'where':{'id':_0x268ae4[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x851bfc,null))[_0x3f40('0x23')](saveUpdates(_0x268ae4[_0x3f40('0x47')],null))[_0x3f40('0x23')](respondWithResult(_0x851bfc,null))[_0x3f40('0x40')](handleError(_0x851bfc,null));};exports[_0x3f40('0x24')]=function(_0x32bd05,_0x2d7e66){return db[_0x3f40('0x2a')]['find']({'where':{'id':_0x32bd05[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x2d7e66,null))[_0x3f40('0x23')](removeEntity(_0x2d7e66,null))[_0x3f40('0x40')](handleError(_0x2d7e66,null));};exports[_0x3f40('0x48')]=function(_0x551395,_0x4f5d45){return db['FaxQueueReport'][_0x3f40('0x48')]()[_0x3f40('0x23')](respondWithResult(_0x4f5d45,null))['catch'](handleError(_0x4f5d45,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index caa9592..b67cb6d 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x44199b,_0x34a07a){var _0x3ea0e8=function(_0x252740){while(--_0x252740){_0x44199b['push'](_0x44199b['shift']());}};_0x3ea0e8(++_0x34a07a);}(_0x4975,0x86));var _0x5497=function(_0x3a4836,_0x364cd7){_0x3a4836=_0x3a4836-0x0;var _0x8691a4=_0x4975[_0x3a4836];return _0x8691a4;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x10d4b3,_0x426dd5){var _0x18dc1e=function(_0x37c748){while(--_0x37c748){_0x10d4b3['push'](_0x10d4b3['shift']());}};_0x18dc1e(++_0x426dd5);}(_0xabce,0x103));var _0xeabc=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xabce[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b499e5c..047562a 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 _0x912b=['body','options','raw','stringify','update','where','attributes','limit','UpdateFaxQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','debug','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0xa8b541,_0x3275fd){var _0x57265c=function(_0x206db5){while(--_0x206db5){_0xa8b541['push'](_0xa8b541['shift']());}};_0x57265c(++_0x3275fd);}(_0x912b,0x101));var _0xb912=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x912b[_0x622035];return _0x326cf2;};'use strict';var _=require('lodash');var util=require(_0xb912('0x0'));var moment=require('moment');var BPromise=require(_0xb912('0x1'));var rs=require(_0xb912('0x2'));var fs=require('fs');var Redis=require(_0xb912('0x3'));var db=require(_0xb912('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb912('0x5'))('rpc');var config=require(_0xb912('0x6'));var jayson=require(_0xb912('0x7'));var client=jayson[_0xb912('0x8')][_0xb912('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa1f6f,_0x5460be,_0x1647ac){return new BPromise(function(_0xca829,_0x3f3a6f){return client['request'](_0xa1f6f,_0x1647ac)[_0xb912('0xa')](function(_0x3ac4ad){logger['info'](_0xb912('0xb'),_0x5460be,'request\x20sent');logger[_0xb912('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5460be,'request\x20sent',JSON['stringify'](_0x3ac4ad));if(_0x3ac4ad[_0xb912('0xd')]){if(_0x3ac4ad[_0xb912('0xd')][_0xb912('0xe')]===0x1f4){logger[_0xb912('0xd')](_0xb912('0xb'),_0x5460be,_0x3ac4ad[_0xb912('0xd')][_0xb912('0xf')]);return _0x3f3a6f(_0x3ac4ad['error'][_0xb912('0xf')]);}logger[_0xb912('0xd')](_0xb912('0xb'),_0x5460be,_0x3ac4ad[_0xb912('0xd')][_0xb912('0xf')]);return _0xca829(_0x3ac4ad['error'][_0xb912('0xf')]);}else{logger[_0xb912('0x10')](_0xb912('0xb'),_0x5460be,'request\x20sent');_0xca829(_0x3ac4ad[_0xb912('0x11')][_0xb912('0xf')]);}})[_0xb912('0x12')](function(_0x134c02){logger['error'](_0xb912('0xb'),_0x5460be,_0x134c02);_0x3f3a6f(_0x134c02);});});}exports[_0xb912('0x13')]=function(_0x377dd1){var _0x27647b=this;return new Promise(function(_0x1f5ab1,_0x3a19b1){return db[_0xb912('0x14')][_0xb912('0x15')](_0x377dd1[_0xb912('0x16')],{'raw':_0x377dd1[_0xb912('0x17')]?_0x377dd1[_0xb912('0x17')][_0xb912('0x18')]===undefined?!![]:![]:!![]})[_0xb912('0xa')](function(_0x54d897){logger[_0xb912('0x10')]('CreateFaxQueueReport',_0x377dd1);logger[_0xb912('0xc')](_0xb912('0x13'),_0x377dd1,JSON[_0xb912('0x19')](_0x54d897));_0x1f5ab1(_0x54d897);})[_0xb912('0x12')](function(_0x552d63){logger[_0xb912('0xd')](_0xb912('0x13'),_0x552d63[_0xb912('0xf')],_0x377dd1);_0x3a19b1(_0x27647b[_0xb912('0xd')](0x1f4,_0x552d63[_0xb912('0xf')]));});});};exports['UpdateFaxQueueReport']=function(_0x117058){var _0x4f3ca2=this;return new Promise(function(_0x43ecf8,_0x1600ea){return db[_0xb912('0x14')][_0xb912('0x1a')](_0x117058[_0xb912('0x16')],{'raw':_0x117058[_0xb912('0x17')]?_0x117058['options'][_0xb912('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x117058[_0xb912('0x17')]?_0x117058[_0xb912('0x17')][_0xb912('0x1b')]||null:null,'attributes':_0x117058['options']?_0x117058['options'][_0xb912('0x1c')]||null:null,'limit':_0x117058[_0xb912('0x17')]?_0x117058['options'][_0xb912('0x1d')]||null:null})[_0xb912('0xa')](function(_0x863653){logger['info'](_0xb912('0x1e'),_0x117058);logger[_0xb912('0xc')](_0xb912('0x1e'),_0x117058,JSON[_0xb912('0x19')](_0x863653));_0x43ecf8(_0x863653);})[_0xb912('0x12')](function(_0x1f80a3){logger[_0xb912('0xd')](_0xb912('0x1e'),_0x1f80a3[_0xb912('0xf')],_0x117058);_0x1600ea(_0x4f3ca2['error'](0x1f4,_0x1f80a3['message']));});});}; \ No newline at end of file +var _0x5a4a=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','where','attributes','limit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5a4a,0x1e0));var _0xa5a4=function(_0x23c554,_0x38741c){_0x23c554=_0x23c554-0x0;var _0x118600=_0x5a4a[_0x23c554];return _0x118600;};'use strict';var _=require(_0xa5a4('0x0'));var util=require(_0xa5a4('0x1'));var moment=require(_0xa5a4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a4('0x4'));var logger=require(_0xa5a4('0x5'))('rpc');var config=require(_0xa5a4('0x6'));var jayson=require(_0xa5a4('0x7'));var client=jayson[_0xa5a4('0x8')][_0xa5a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a6c46,_0x4e31fe,_0x3a9914){return new BPromise(function(_0x25af69,_0x3b297c){return client[_0xa5a4('0xa')](_0x3a6c46,_0x3a9914)[_0xa5a4('0xb')](function(_0xbfb9c2){logger['info'](_0xa5a4('0xc'),_0x4e31fe,_0xa5a4('0xd'));logger[_0xa5a4('0xe')](_0xa5a4('0xf'),_0x4e31fe,_0xa5a4('0xd'),JSON[_0xa5a4('0x10')](_0xbfb9c2));if(_0xbfb9c2[_0xa5a4('0x11')]){if(_0xbfb9c2[_0xa5a4('0x11')]['code']===0x1f4){logger['error'](_0xa5a4('0xc'),_0x4e31fe,_0xbfb9c2[_0xa5a4('0x11')]['message']);return _0x3b297c(_0xbfb9c2['error'][_0xa5a4('0x12')]);}logger[_0xa5a4('0x11')](_0xa5a4('0xc'),_0x4e31fe,_0xbfb9c2[_0xa5a4('0x11')][_0xa5a4('0x12')]);return _0x25af69(_0xbfb9c2[_0xa5a4('0x11')]['message']);}else{logger[_0xa5a4('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x4e31fe,_0xa5a4('0xd'));_0x25af69(_0xbfb9c2[_0xa5a4('0x14')][_0xa5a4('0x12')]);}})[_0xa5a4('0x15')](function(_0x10d8ff){logger[_0xa5a4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4e31fe,_0x10d8ff);_0x3b297c(_0x10d8ff);});});}exports[_0xa5a4('0x16')]=function(_0x3151fb){var _0xa449f7=this;return new Promise(function(_0x33b9e5,_0x2f746f){return db[_0xa5a4('0x17')][_0xa5a4('0x18')](_0x3151fb[_0xa5a4('0x19')],{'raw':_0x3151fb[_0xa5a4('0x1a')]?_0x3151fb[_0xa5a4('0x1a')][_0xa5a4('0x1b')]===undefined?!![]:![]:!![]})[_0xa5a4('0xb')](function(_0x48666b){logger[_0xa5a4('0x13')](_0xa5a4('0x16'),_0x3151fb);logger['debug'](_0xa5a4('0x16'),_0x3151fb,JSON[_0xa5a4('0x10')](_0x48666b));_0x33b9e5(_0x48666b);})[_0xa5a4('0x15')](function(_0x154145){logger['error'](_0xa5a4('0x16'),_0x154145[_0xa5a4('0x12')],_0x3151fb);_0x2f746f(_0xa449f7['error'](0x1f4,_0x154145[_0xa5a4('0x12')]));});});};exports[_0xa5a4('0x1c')]=function(_0x1236b3){var _0x5748d7=this;return new Promise(function(_0x534ec6,_0x30fdab){return db['FaxQueueReport']['update'](_0x1236b3['body'],{'raw':_0x1236b3[_0xa5a4('0x1a')]?_0x1236b3[_0xa5a4('0x1a')][_0xa5a4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1236b3[_0xa5a4('0x1a')]?_0x1236b3['options'][_0xa5a4('0x1d')]||null:null,'attributes':_0x1236b3[_0xa5a4('0x1a')]?_0x1236b3[_0xa5a4('0x1a')][_0xa5a4('0x1e')]||null:null,'limit':_0x1236b3[_0xa5a4('0x1a')]?_0x1236b3['options'][_0xa5a4('0x1f')]||null:null})[_0xa5a4('0xb')](function(_0x13f075){logger['info'](_0xa5a4('0x1c'),_0x1236b3);logger[_0xa5a4('0xe')]('UpdateFaxQueueReport',_0x1236b3,JSON[_0xa5a4('0x10')](_0x13f075));_0x534ec6(_0x13f075);})[_0xa5a4('0x15')](function(_0x1889f6){logger[_0xa5a4('0x11')](_0xa5a4('0x1c'),_0x1889f6[_0xa5a4('0x12')],_0x1236b3);_0x30fdab(_0x5748d7[_0xa5a4('0x11')](0x1f4,_0x1889f6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 7d53c2e..de5567b 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 _0x9418=['/describe','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index'];(function(_0x41d19d,_0x546f12){var _0x5bc9ac=function(_0x2e0bbd){while(--_0x2e0bbd){_0x41d19d['push'](_0x41d19d['shift']());}};_0x5bc9ac(++_0x546f12);}(_0x9418,0x1e4));var _0x8941=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0x9418[_0x4812e0];return _0x252e0f;};'use strict';var multer=require(_0x8941('0x0'));var util=require(_0x8941('0x1'));var path=require(_0x8941('0x2'));var timeout=require(_0x8941('0x3'));var express=require('express');var router=express[_0x8941('0x4')]();var fs_extra=require(_0x8941('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8941('0x6'));var config=require(_0x8941('0x7'));var controller=require('./faxQueueReport.controller');router[_0x8941('0x8')]('/',auth['isAuthenticated'](),controller[_0x8941('0x9')]);router[_0x8941('0x8')](_0x8941('0xa'),auth[_0x8941('0xb')](),controller['describe']);router[_0x8941('0x8')](_0x8941('0xc'),auth[_0x8941('0xb')](),controller[_0x8941('0xd')]);router[_0x8941('0xe')]('/',auth[_0x8941('0xb')](),controller[_0x8941('0xf')]);router[_0x8941('0x10')](_0x8941('0xc'),auth[_0x8941('0xb')](),controller[_0x8941('0x11')]);router['delete'](_0x8941('0xc'),auth[_0x8941('0xb')](),controller[_0x8941('0x12')]);module['exports']=router; \ No newline at end of file +var _0x24e7=['create','update','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x435296,_0x48432c){var _0x194eaa=function(_0xe6e4f1){while(--_0xe6e4f1){_0x435296['push'](_0x435296['shift']());}};_0x194eaa(++_0x48432c);}(_0x24e7,0x113));var _0x724e=function(_0x42946c,_0x577d97){_0x42946c=_0x42946c-0x0;var _0x5d7687=_0x24e7[_0x42946c];return _0x5d7687;};'use strict';var multer=require(_0x724e('0x0'));var util=require(_0x724e('0x1'));var path=require(_0x724e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x724e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x724e('0x4'));var config=require(_0x724e('0x5'));var controller=require(_0x724e('0x6'));router[_0x724e('0x7')]('/',auth[_0x724e('0x8')](),controller[_0x724e('0x9')]);router[_0x724e('0x7')]('/describe',auth[_0x724e('0x8')](),controller[_0x724e('0xa')]);router[_0x724e('0x7')](_0x724e('0xb'),auth['isAuthenticated'](),controller[_0x724e('0xc')]);router[_0x724e('0xd')]('/',auth[_0x724e('0x8')](),controller[_0x724e('0xe')]);router['put'](_0x724e('0xb'),auth[_0x724e('0x8')](),controller[_0x724e('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x724e('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 18f3ac8..a801912 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1a7881,_0x55020e){var _0x2174da=function(_0x56b2ab){while(--_0x56b2ab){_0x1a7881['push'](_0x1a7881['shift']());}};_0x2174da(++_0x55020e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0xf3cd[_0x1e9d62];return _0x56c490;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x11c032,_0x4ca503){var _0x55919f=function(_0x97e42c){while(--_0x97e42c){_0x11c032['push'](_0x11c032['shift']());}};_0x55919f(++_0x4ca503);}(_0x34e8,0x12c));var _0x834e=function(_0x183f3c,_0x22ad03){_0x183f3c=_0x183f3c-0x0;var _0xf73bdd=_0x34e8[_0x183f3c];return _0xf73bdd;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6109353..a5c3de8 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 _0xd776=['index','map','FaxTransferReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','merge','type','filter','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd776,0xb7));var _0x6d77=function(_0x4e0ec5,_0x44f702){_0x4e0ec5=_0x4e0ec5-0x0;var _0x40a25c=_0xd776[_0x4e0ec5];return _0x40a25c;};'use strict';var emlformat=require(_0x6d77('0x0'));var rimraf=require(_0x6d77('0x1'));var zipdir=require(_0x6d77('0x2'));var jsonpatch=require(_0x6d77('0x3'));var rp=require(_0x6d77('0x4'));var moment=require(_0x6d77('0x5'));var BPromise=require(_0x6d77('0x6'));var Mustache=require(_0x6d77('0x7'));var util=require('util');var path=require(_0x6d77('0x8'));var sox=require(_0x6d77('0x9'));var csv=require(_0x6d77('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d77('0xb'));var _=require(_0x6d77('0xc'));var squel=require(_0x6d77('0xd'));var crypto=require(_0x6d77('0xe'));var jsforce=require(_0x6d77('0xf'));var deskjs=require(_0x6d77('0x10'));var toCsv=require(_0x6d77('0xa'));var querystring=require('querystring');var Papa=require(_0x6d77('0x11'));var Redis=require('ioredis');var authService=require(_0x6d77('0x12'));var qs=require(_0x6d77('0x13'));var as=require(_0x6d77('0x14'));var hardwareService=require(_0x6d77('0x15'));var logger=require('../../config/logger')(_0x6d77('0x16'));var utils=require(_0x6d77('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6d77('0x18'));var db=require(_0x6d77('0x19'))['db'];function respondWithStatusCode(_0x1c20a1,_0xc50b51){_0xc50b51=_0xc50b51||0xcc;return function(_0x1c9bfc){if(_0x1c9bfc){return _0x1c20a1[_0x6d77('0x1a')](_0xc50b51);}return _0x1c20a1['status'](_0xc50b51)[_0x6d77('0x1b')]();};}function respondWithResult(_0x4ae982,_0x2cfbdb){_0x2cfbdb=_0x2cfbdb||0xc8;return function(_0x52d4e1){if(_0x52d4e1){return _0x4ae982[_0x6d77('0x1c')](_0x2cfbdb)[_0x6d77('0x1d')](_0x52d4e1);}};}function respondWithFilteredResult(_0x4a0eac,_0x3f08a7){return function(_0x27bf8c){if(_0x27bf8c){var _0x2e0f25=typeof _0x3f08a7[_0x6d77('0x1e')]===_0x6d77('0x1f')&&typeof _0x3f08a7[_0x6d77('0x20')]==='undefined';var _0x3f2c64=_0x27bf8c[_0x6d77('0x21')];var _0x57ea47=_0x2e0f25?0x0:_0x3f08a7['offset'];var _0x1fc48a=_0x2e0f25?_0x27bf8c[_0x6d77('0x21')]:_0x3f08a7[_0x6d77('0x1e')]+_0x3f08a7[_0x6d77('0x20')];var _0x555498;if(_0x1fc48a>=_0x3f2c64){_0x1fc48a=_0x3f2c64;_0x555498=0xc8;}else{_0x555498=0xce;}_0x4a0eac['status'](_0x555498);return _0x4a0eac[_0x6d77('0x22')](_0x6d77('0x23'),_0x57ea47+'-'+_0x1fc48a+'/'+_0x3f2c64)[_0x6d77('0x1d')](_0x27bf8c);}return null;};}function patchUpdates(_0x5a8780){return function(_0x2b6d71){try{jsonpatch[_0x6d77('0x24')](_0x2b6d71,_0x5a8780,!![]);}catch(_0x324209){return BPromise[_0x6d77('0x25')](_0x324209);}return _0x2b6d71[_0x6d77('0x26')]();};}function saveUpdates(_0x3dc0be,_0x3e8f13){return function(_0x44658e){if(_0x44658e){return _0x44658e[_0x6d77('0x27')](_0x3dc0be)[_0x6d77('0x28')](function(_0x446851){return _0x446851;});}return null;};}function removeEntity(_0x19214c,_0x4fac74){return function(_0x10f7ea){if(_0x10f7ea){return _0x10f7ea['destroy']()['then'](function(){_0x19214c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3dc4,_0x37358e){return function(_0x326273){if(!_0x326273){_0x1d3dc4[_0x6d77('0x1a')](0x194);}return _0x326273;};}function handleError(_0x5f4c50,_0x56ed0e){_0x56ed0e=_0x56ed0e||0x1f4;return function(_0x1fb044){logger[_0x6d77('0x29')](_0x1fb044[_0x6d77('0x2a')]);if(_0x1fb044[_0x6d77('0x2b')]){delete _0x1fb044[_0x6d77('0x2b')];}_0x5f4c50[_0x6d77('0x1c')](_0x56ed0e)[_0x6d77('0x2c')](_0x1fb044);};}exports[_0x6d77('0x2d')]=function(_0x1a208d,_0x7b51f2){var _0x1531c2={},_0x179595={},_0x10eb27={'count':0x0,'rows':[]};var _0x5806d1=_[_0x6d77('0x2e')](db[_0x6d77('0x2f')][_0x6d77('0x30')],function(_0x31a21a){return{'name':_0x31a21a[_0x6d77('0x31')],'type':_0x31a21a['type']['key']};});_0x179595['model']=_[_0x6d77('0x2e')](_0x5806d1,_0x6d77('0x2b'));_0x179595[_0x6d77('0x32')]=_[_0x6d77('0x33')](_0x1a208d[_0x6d77('0x32')]);_0x179595[_0x6d77('0x34')]=_[_0x6d77('0x35')](_0x179595[_0x6d77('0x36')],_0x179595[_0x6d77('0x32')]);_0x1531c2[_0x6d77('0x37')]=_[_0x6d77('0x35')](_0x179595['model'],qs[_0x6d77('0x38')](_0x1a208d[_0x6d77('0x32')][_0x6d77('0x38')]));_0x1531c2['attributes']=_0x1531c2[_0x6d77('0x37')][_0x6d77('0x39')]?_0x1531c2[_0x6d77('0x37')]:_0x179595['model'];if(!_0x1a208d[_0x6d77('0x32')]['hasOwnProperty']('nolimit')){_0x1531c2[_0x6d77('0x20')]=qs['limit'](_0x1a208d['query'][_0x6d77('0x20')]);_0x1531c2[_0x6d77('0x1e')]=qs[_0x6d77('0x1e')](_0x1a208d['query'][_0x6d77('0x1e')]);}_0x1531c2['order']=qs[_0x6d77('0x3a')](_0x1a208d[_0x6d77('0x32')]['sort']);_0x1531c2[_0x6d77('0x3b')]=qs[_0x6d77('0x34')](_[_0x6d77('0x3c')](_0x1a208d[_0x6d77('0x32')],_0x179595['filters']),_0x5806d1);if(_0x1a208d[_0x6d77('0x32')]['filter']){_0x1531c2['where']=_[_0x6d77('0x3d')](_0x1531c2[_0x6d77('0x3b')],{'$or':_[_0x6d77('0x2e')](_0x5806d1,function(_0x350437){if(_0x350437[_0x6d77('0x3e')]!=='VIRTUAL'){var _0x5458d={};_0x5458d[_0x350437[_0x6d77('0x2b')]]={'$like':'%'+_0x1a208d[_0x6d77('0x32')][_0x6d77('0x3f')]+'%'};return _0x5458d;}})});}_0x1531c2=_[_0x6d77('0x3d')]({},_0x1531c2,_0x1a208d[_0x6d77('0x40')]);var _0xc439b8={'where':_0x1531c2[_0x6d77('0x3b')]};return db[_0x6d77('0x2f')][_0x6d77('0x21')](_0xc439b8)[_0x6d77('0x28')](function(_0x5db1e4){_0x10eb27['count']=_0x5db1e4;if(_0x1a208d['query'][_0x6d77('0x41')]){_0x1531c2[_0x6d77('0x42')]=[{'all':!![]}];}return db[_0x6d77('0x2f')]['findAll'](_0x1531c2);})[_0x6d77('0x28')](function(_0x42f551){_0x10eb27[_0x6d77('0x43')]=_0x42f551;return _0x10eb27;})[_0x6d77('0x28')](respondWithFilteredResult(_0x7b51f2,_0x1531c2))[_0x6d77('0x44')](handleError(_0x7b51f2,null));};exports[_0x6d77('0x45')]=function(_0x3cd662,_0xf6bcfd){var _0x433189={'raw':!![],'where':{'id':_0x3cd662['params']['id']}},_0x5f3262={};_0x5f3262[_0x6d77('0x36')]=_[_0x6d77('0x33')](db[_0x6d77('0x2f')][_0x6d77('0x30')]);_0x5f3262[_0x6d77('0x32')]=_[_0x6d77('0x33')](_0x3cd662[_0x6d77('0x32')]);_0x5f3262[_0x6d77('0x34')]=_[_0x6d77('0x35')](_0x5f3262[_0x6d77('0x36')],_0x5f3262['query']);_0x433189['attributes']=_[_0x6d77('0x35')](_0x5f3262[_0x6d77('0x36')],qs['fields'](_0x3cd662[_0x6d77('0x32')]['fields']));_0x433189[_0x6d77('0x37')]=_0x433189[_0x6d77('0x37')][_0x6d77('0x39')]?_0x433189[_0x6d77('0x37')]:_0x5f3262[_0x6d77('0x36')];if(_0x3cd662[_0x6d77('0x32')][_0x6d77('0x41')]){_0x433189[_0x6d77('0x42')]=[{'all':!![]}];}_0x433189=_[_0x6d77('0x3d')]({},_0x433189,_0x3cd662['options']);return db[_0x6d77('0x2f')][_0x6d77('0x46')](_0x433189)[_0x6d77('0x28')](handleEntityNotFound(_0xf6bcfd,null))['then'](respondWithResult(_0xf6bcfd,null))['catch'](handleError(_0xf6bcfd,null));};exports[_0x6d77('0x47')]=function(_0x362bcc,_0x211dc3){return db[_0x6d77('0x2f')]['create'](_0x362bcc[_0x6d77('0x48')],{})['then'](respondWithResult(_0x211dc3,0xc9))[_0x6d77('0x44')](handleError(_0x211dc3,null));};exports[_0x6d77('0x27')]=function(_0x4a13c9,_0x63f53e){if(_0x4a13c9[_0x6d77('0x48')]['id']){delete _0x4a13c9[_0x6d77('0x48')]['id'];}return db[_0x6d77('0x2f')][_0x6d77('0x46')]({'where':{'id':_0x4a13c9[_0x6d77('0x49')]['id']}})[_0x6d77('0x28')](handleEntityNotFound(_0x63f53e,null))[_0x6d77('0x28')](saveUpdates(_0x4a13c9[_0x6d77('0x48')],null))[_0x6d77('0x28')](respondWithResult(_0x63f53e,null))['catch'](handleError(_0x63f53e,null));};exports[_0x6d77('0x4a')]=function(_0x1d51f5,_0x1a0dc4){return db['FaxTransferReport']['find']({'where':{'id':_0x1d51f5['params']['id']}})[_0x6d77('0x28')](handleEntityNotFound(_0x1a0dc4,null))['then'](removeEntity(_0x1a0dc4,null))['catch'](handleError(_0x1a0dc4,null));};exports[_0x6d77('0x4b')]=function(_0x2c0fcd,_0x1ceb46){return db['FaxTransferReport'][_0x6d77('0x4b')]()[_0x6d77('0x28')](respondWithResult(_0x1ceb46,null))[_0x6d77('0x44')](handleError(_0x1ceb46,null));}; \ No newline at end of file +var _0xfb35=['fieldName','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','type','VIRTUAL','filter','options','where','include','findAll','rows','show','params','keys','intersection','includeAll','find','catch','create','body','describe','rimraf','request-promise','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','update','then','destroy','stack','name','send','index','map','FaxTransferReport'];(function(_0x54eb6e,_0x3db77b){var _0x58e8c5=function(_0xbbfdc4){while(--_0xbbfdc4){_0x54eb6e['push'](_0x54eb6e['shift']());}};_0x58e8c5(++_0x3db77b);}(_0xfb35,0x65));var _0x5fb3=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xfb35[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fb3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5fb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5fb3('0x2'));var path=require(_0x5fb3('0x3'));var sox=require(_0x5fb3('0x4'));var csv=require(_0x5fb3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fb3('0x6'));var squel=require(_0x5fb3('0x7'));var crypto=require(_0x5fb3('0x8'));var jsforce=require(_0x5fb3('0x9'));var deskjs=require(_0x5fb3('0xa'));var toCsv=require(_0x5fb3('0x5'));var querystring=require('querystring');var Papa=require(_0x5fb3('0xb'));var Redis=require(_0x5fb3('0xc'));var authService=require(_0x5fb3('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fb3('0xe'))(_0x5fb3('0xf'));var utils=require(_0x5fb3('0x10'));var config=require(_0x5fb3('0x11'));var licenseUtil=require(_0x5fb3('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd249,_0x31b701){_0x31b701=_0x31b701||0xcc;return function(_0xb5f8da){if(_0xb5f8da){return _0x2bd249[_0x5fb3('0x13')](_0x31b701);}return _0x2bd249[_0x5fb3('0x14')](_0x31b701)[_0x5fb3('0x15')]();};}function respondWithResult(_0x7a2016,_0x42ea67){_0x42ea67=_0x42ea67||0xc8;return function(_0xc9ba2d){if(_0xc9ba2d){return _0x7a2016[_0x5fb3('0x14')](_0x42ea67)['json'](_0xc9ba2d);}};}function respondWithFilteredResult(_0x47081d,_0x41e73d){return function(_0x4c08d3){if(_0x4c08d3){var _0x4ad0c2=typeof _0x41e73d['offset']===_0x5fb3('0x16')&&typeof _0x41e73d[_0x5fb3('0x17')]===_0x5fb3('0x16');var _0x14a2b9=_0x4c08d3[_0x5fb3('0x18')];var _0x21e469=_0x4ad0c2?0x0:_0x41e73d[_0x5fb3('0x19')];var _0x3e240e=_0x4ad0c2?_0x4c08d3['count']:_0x41e73d[_0x5fb3('0x19')]+_0x41e73d[_0x5fb3('0x17')];var _0x5493f1;if(_0x3e240e>=_0x14a2b9){_0x3e240e=_0x14a2b9;_0x5493f1=0xc8;}else{_0x5493f1=0xce;}_0x47081d[_0x5fb3('0x14')](_0x5493f1);return _0x47081d[_0x5fb3('0x1a')]('Content-Range',_0x21e469+'-'+_0x3e240e+'/'+_0x14a2b9)[_0x5fb3('0x1b')](_0x4c08d3);}return null;};}function patchUpdates(_0x59f88e){return function(_0x1b1752){try{jsonpatch[_0x5fb3('0x1c')](_0x1b1752,_0x59f88e,!![]);}catch(_0x33b7df){return BPromise[_0x5fb3('0x1d')](_0x33b7df);}return _0x1b1752['save']();};}function saveUpdates(_0x11438e,_0x47400c){return function(_0x3b3676){if(_0x3b3676){return _0x3b3676[_0x5fb3('0x1e')](_0x11438e)[_0x5fb3('0x1f')](function(_0x2f67f2){return _0x2f67f2;});}return null;};}function removeEntity(_0x258e11,_0xce59dd){return function(_0x31166b){if(_0x31166b){return _0x31166b[_0x5fb3('0x20')]()[_0x5fb3('0x1f')](function(){_0x258e11[_0x5fb3('0x14')](0xcc)[_0x5fb3('0x15')]();});}};}function handleEntityNotFound(_0x4a752c,_0x1b8d4a){return function(_0x1313d0){if(!_0x1313d0){_0x4a752c[_0x5fb3('0x13')](0x194);}return _0x1313d0;};}function handleError(_0x406c1e,_0xcbfdc1){_0xcbfdc1=_0xcbfdc1||0x1f4;return function(_0x493982){logger['error'](_0x493982[_0x5fb3('0x21')]);if(_0x493982[_0x5fb3('0x22')]){delete _0x493982[_0x5fb3('0x22')];}_0x406c1e[_0x5fb3('0x14')](_0xcbfdc1)[_0x5fb3('0x23')](_0x493982);};}exports[_0x5fb3('0x24')]=function(_0x4cc315,_0x282b31){var _0x590755={},_0x3eecdd={},_0x3ff7c7={'count':0x0,'rows':[]};var _0x1db5de=_[_0x5fb3('0x25')](db[_0x5fb3('0x26')]['rawAttributes'],function(_0xdf7bb8){return{'name':_0xdf7bb8[_0x5fb3('0x27')],'type':_0xdf7bb8['type']['key']};});_0x3eecdd[_0x5fb3('0x28')]=_[_0x5fb3('0x25')](_0x1db5de,_0x5fb3('0x22'));_0x3eecdd[_0x5fb3('0x29')]=_['keys'](_0x4cc315[_0x5fb3('0x29')]);_0x3eecdd['filters']=_['intersection'](_0x3eecdd['model'],_0x3eecdd[_0x5fb3('0x29')]);_0x590755['attributes']=_['intersection'](_0x3eecdd[_0x5fb3('0x28')],qs['fields'](_0x4cc315[_0x5fb3('0x29')][_0x5fb3('0x2a')]));_0x590755[_0x5fb3('0x2b')]=_0x590755[_0x5fb3('0x2b')][_0x5fb3('0x2c')]?_0x590755['attributes']:_0x3eecdd[_0x5fb3('0x28')];if(!_0x4cc315[_0x5fb3('0x29')][_0x5fb3('0x2d')](_0x5fb3('0x2e'))){_0x590755[_0x5fb3('0x17')]=qs[_0x5fb3('0x17')](_0x4cc315['query']['limit']);_0x590755[_0x5fb3('0x19')]=qs[_0x5fb3('0x19')](_0x4cc315[_0x5fb3('0x29')][_0x5fb3('0x19')]);}_0x590755[_0x5fb3('0x2f')]=qs[_0x5fb3('0x30')](_0x4cc315[_0x5fb3('0x29')][_0x5fb3('0x30')]);_0x590755['where']=qs[_0x5fb3('0x31')](_[_0x5fb3('0x32')](_0x4cc315['query'],_0x3eecdd['filters']),_0x1db5de);if(_0x4cc315['query']['filter']){_0x590755['where']=_[_0x5fb3('0x33')](_0x590755['where'],{'$or':_[_0x5fb3('0x25')](_0x1db5de,function(_0x1760c4){if(_0x1760c4[_0x5fb3('0x34')]!==_0x5fb3('0x35')){var _0x1bc9ce={};_0x1bc9ce[_0x1760c4[_0x5fb3('0x22')]]={'$like':'%'+_0x4cc315[_0x5fb3('0x29')][_0x5fb3('0x36')]+'%'};return _0x1bc9ce;}})});}_0x590755=_[_0x5fb3('0x33')]({},_0x590755,_0x4cc315[_0x5fb3('0x37')]);var _0x334b70={'where':_0x590755[_0x5fb3('0x38')]};return db[_0x5fb3('0x26')][_0x5fb3('0x18')](_0x334b70)['then'](function(_0x496d9b){_0x3ff7c7[_0x5fb3('0x18')]=_0x496d9b;if(_0x4cc315[_0x5fb3('0x29')]['includeAll']){_0x590755[_0x5fb3('0x39')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5fb3('0x3a')](_0x590755);})['then'](function(_0x40736b){_0x3ff7c7[_0x5fb3('0x3b')]=_0x40736b;return _0x3ff7c7;})[_0x5fb3('0x1f')](respondWithFilteredResult(_0x282b31,_0x590755))['catch'](handleError(_0x282b31,null));};exports[_0x5fb3('0x3c')]=function(_0x46e5fa,_0x3b4ac0){var _0x384823={'raw':!![],'where':{'id':_0x46e5fa[_0x5fb3('0x3d')]['id']}},_0x1ca5bf={};_0x1ca5bf['model']=_[_0x5fb3('0x3e')](db['FaxTransferReport']['rawAttributes']);_0x1ca5bf[_0x5fb3('0x29')]=_[_0x5fb3('0x3e')](_0x46e5fa['query']);_0x1ca5bf[_0x5fb3('0x31')]=_[_0x5fb3('0x3f')](_0x1ca5bf[_0x5fb3('0x28')],_0x1ca5bf[_0x5fb3('0x29')]);_0x384823[_0x5fb3('0x2b')]=_[_0x5fb3('0x3f')](_0x1ca5bf[_0x5fb3('0x28')],qs[_0x5fb3('0x2a')](_0x46e5fa[_0x5fb3('0x29')][_0x5fb3('0x2a')]));_0x384823[_0x5fb3('0x2b')]=_0x384823[_0x5fb3('0x2b')]['length']?_0x384823[_0x5fb3('0x2b')]:_0x1ca5bf['model'];if(_0x46e5fa[_0x5fb3('0x29')][_0x5fb3('0x40')]){_0x384823[_0x5fb3('0x39')]=[{'all':!![]}];}_0x384823=_[_0x5fb3('0x33')]({},_0x384823,_0x46e5fa[_0x5fb3('0x37')]);return db[_0x5fb3('0x26')][_0x5fb3('0x41')](_0x384823)[_0x5fb3('0x1f')](handleEntityNotFound(_0x3b4ac0,null))[_0x5fb3('0x1f')](respondWithResult(_0x3b4ac0,null))[_0x5fb3('0x42')](handleError(_0x3b4ac0,null));};exports[_0x5fb3('0x43')]=function(_0x362275,_0x1ec69e){return db[_0x5fb3('0x26')][_0x5fb3('0x43')](_0x362275[_0x5fb3('0x44')],{})['then'](respondWithResult(_0x1ec69e,0xc9))[_0x5fb3('0x42')](handleError(_0x1ec69e,null));};exports[_0x5fb3('0x1e')]=function(_0x3d5ae4,_0x223145){if(_0x3d5ae4['body']['id']){delete _0x3d5ae4['body']['id'];}return db[_0x5fb3('0x26')][_0x5fb3('0x41')]({'where':{'id':_0x3d5ae4['params']['id']}})[_0x5fb3('0x1f')](handleEntityNotFound(_0x223145,null))[_0x5fb3('0x1f')](saveUpdates(_0x3d5ae4[_0x5fb3('0x44')],null))[_0x5fb3('0x1f')](respondWithResult(_0x223145,null))['catch'](handleError(_0x223145,null));};exports['destroy']=function(_0x2933b3,_0x2cc24f){return db[_0x5fb3('0x26')][_0x5fb3('0x41')]({'where':{'id':_0x2933b3[_0x5fb3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2cc24f,null))[_0x5fb3('0x1f')](removeEntity(_0x2cc24f,null))[_0x5fb3('0x42')](handleError(_0x2cc24f,null));};exports[_0x5fb3('0x45')]=function(_0x233f94,_0x5a7ec7){return db[_0x5fb3('0x26')]['describe']()[_0x5fb3('0x1f')](respondWithResult(_0x5a7ec7,null))[_0x5fb3('0x42')](handleError(_0x5a7ec7,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index b7526bb..3ce1231 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 _0xa606=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer'];(function(_0xb214b5,_0x3b0eae){var _0x34a215=function(_0x1e52f6){while(--_0x1e52f6){_0xb214b5['push'](_0xb214b5['shift']());}};_0x34a215(++_0x3b0eae);}(_0xa606,0x10b));var _0x6a60=function(_0x5d4c85,_0xe978e3){_0x5d4c85=_0x5d4c85-0x0;var _0x3fa747=_0xa606[_0x5d4c85];return _0x3fa747;};'use strict';var _=require(_0x6a60('0x0'));var util=require(_0x6a60('0x1'));var logger=require(_0x6a60('0x2'))(_0x6a60('0x3'));var moment=require(_0x6a60('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a60('0x5'));var fs=require('fs');var path=require(_0x6a60('0x6'));var rimraf=require(_0x6a60('0x7'));var config=require(_0x6a60('0x8'));var attributes=require(_0x6a60('0x9'));module[_0x6a60('0xa')]=function(_0xd67b9f,_0x16e4bc){return _0xd67b9f[_0x6a60('0xb')]('FaxTransferReport',attributes,{'tableName':_0x6a60('0xc'),'paranoid':![],'indexes':[{'name':_0x6a60('0xd'),'fields':[_0x6a60('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b22=['api','moment','request-promise','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4b06b2,_0x295685){var _0x2fa80a=function(_0x468988){while(--_0x468988){_0x4b06b2['push'](_0x4b06b2['shift']());}};_0x2fa80a(++_0x295685);}(_0x2b22,0xf4));var _0x22b2=function(_0x2b9a20,_0x4881e8){_0x2b9a20=_0x2b9a20-0x0;var _0x4e3665=_0x2b22[_0x2b9a20];return _0x4e3665;};'use strict';var _=require(_0x22b2('0x0'));var util=require(_0x22b2('0x1'));var logger=require(_0x22b2('0x2'))(_0x22b2('0x3'));var moment=require(_0x22b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x22b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22b2('0x6'));var config=require('../../config/environment');var attributes=require(_0x22b2('0x7'));module[_0x22b2('0x8')]=function(_0x3e1b03,_0x489d0e){return _0x3e1b03[_0x22b2('0x9')](_0x22b2('0xa'),attributes,{'tableName':_0x22b2('0xb'),'paranoid':![],'indexes':[{'name':_0x22b2('0xc'),'fields':[_0x22b2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1c8acfb..1627ad5 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 _0x3cbd=['http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3cbd,0x1c4));var _0xd3cb=function(_0x135e73,_0x53d25e){_0x135e73=_0x135e73-0x0;var _0x207d86=_0x3cbd[_0x135e73];return _0x207d86;};'use strict';var _=require(_0xd3cb('0x0'));var util=require(_0xd3cb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3cb('0x2'));var fs=require('fs');var Redis=require(_0xd3cb('0x3'));var db=require(_0xd3cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3cb('0x5'));var config=require(_0xd3cb('0x6'));var jayson=require(_0xd3cb('0x7'));var client=jayson['client'][_0xd3cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29a27e,_0x1dc334,_0x493f08){return new BPromise(function(_0x3b2614,_0x2b77d9){return client[_0xd3cb('0x9')](_0x29a27e,_0x493f08)['then'](function(_0x1b5fe8){logger[_0xd3cb('0xa')](_0xd3cb('0xb'),_0x1dc334,_0xd3cb('0xc'));logger['debug'](_0xd3cb('0xd'),_0x1dc334,_0xd3cb('0xc'),JSON[_0xd3cb('0xe')](_0x1b5fe8));if(_0x1b5fe8[_0xd3cb('0xf')]){if(_0x1b5fe8[_0xd3cb('0xf')][_0xd3cb('0x10')]===0x1f4){logger[_0xd3cb('0xf')](_0xd3cb('0xb'),_0x1dc334,_0x1b5fe8[_0xd3cb('0xf')][_0xd3cb('0x11')]);return _0x2b77d9(_0x1b5fe8[_0xd3cb('0xf')][_0xd3cb('0x11')]);}logger[_0xd3cb('0xf')](_0xd3cb('0xb'),_0x1dc334,_0x1b5fe8[_0xd3cb('0xf')][_0xd3cb('0x11')]);return _0x3b2614(_0x1b5fe8[_0xd3cb('0xf')][_0xd3cb('0x11')]);}else{logger[_0xd3cb('0xa')](_0xd3cb('0xb'),_0x1dc334,_0xd3cb('0xc'));_0x3b2614(_0x1b5fe8[_0xd3cb('0x12')][_0xd3cb('0x11')]);}})[_0xd3cb('0x13')](function(_0x5cc674){logger[_0xd3cb('0xf')](_0xd3cb('0xb'),_0x1dc334,_0x5cc674);_0x2b77d9(_0x5cc674);});});} \ No newline at end of file +var _0x4181=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring'];(function(_0x16931b,_0x3cc8a3){var _0x51f6c4=function(_0x59a478){while(--_0x59a478){_0x16931b['push'](_0x16931b['shift']());}};_0x51f6c4(++_0x3cc8a3);}(_0x4181,0x1b4));var _0x1418=function(_0x3be76f,_0x385568){_0x3be76f=_0x3be76f-0x0;var _0x13affb=_0x4181[_0x3be76f];return _0x13affb;};'use strict';var _=require('lodash');var util=require(_0x1418('0x0'));var moment=require(_0x1418('0x1'));var BPromise=require(_0x1418('0x2'));var rs=require(_0x1418('0x3'));var fs=require('fs');var Redis=require(_0x1418('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1418('0x5'));var logger=require(_0x1418('0x6'))(_0x1418('0x7'));var config=require(_0x1418('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1418('0x9')][_0x1418('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aba54,_0x11e072,_0x1c36a6){return new BPromise(function(_0x16d0fa,_0x4dc628){return client['request'](_0x2aba54,_0x1c36a6)[_0x1418('0xb')](function(_0x3c7e1d){logger[_0x1418('0xc')](_0x1418('0xd'),_0x11e072,'request\x20sent');logger[_0x1418('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x11e072,_0x1418('0xf'),JSON[_0x1418('0x10')](_0x3c7e1d));if(_0x3c7e1d['error']){if(_0x3c7e1d['error']['code']===0x1f4){logger[_0x1418('0x11')](_0x1418('0xd'),_0x11e072,_0x3c7e1d[_0x1418('0x11')][_0x1418('0x12')]);return _0x4dc628(_0x3c7e1d[_0x1418('0x11')][_0x1418('0x12')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x11e072,_0x3c7e1d[_0x1418('0x11')][_0x1418('0x12')]);return _0x16d0fa(_0x3c7e1d['error']['message']);}else{logger[_0x1418('0xc')](_0x1418('0xd'),_0x11e072,'request\x20sent');_0x16d0fa(_0x3c7e1d[_0x1418('0x13')][_0x1418('0x12')]);}})['catch'](function(_0x269cf1){logger[_0x1418('0x11')](_0x1418('0xd'),_0x11e072,_0x269cf1);_0x4dc628(_0x269cf1);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 9bbec20..ba9916a 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 _0xa4aa=['get','isAuthenticated','/describe','describe','put','/:id','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4aa,0x87));var _0xaa4a=function(_0x41749a,_0x4106f4){_0x41749a=_0x41749a-0x0;var _0x4c0505=_0xa4aa[_0x41749a];return _0x4c0505;};'use strict';var multer=require('multer');var util=require(_0xaa4a('0x0'));var path=require(_0xaa4a('0x1'));var timeout=require(_0xaa4a('0x2'));var express=require(_0xaa4a('0x3'));var router=express[_0xaa4a('0x4')]();var fs_extra=require(_0xaa4a('0x5'));var auth=require(_0xaa4a('0x6'));var interaction=require(_0xaa4a('0x7'));var config=require('../../config/environment');var controller=require(_0xaa4a('0x8'));router[_0xaa4a('0x9')]('/',auth[_0xaa4a('0xa')](),controller['index']);router[_0xaa4a('0x9')](_0xaa4a('0xb'),auth[_0xaa4a('0xa')](),controller[_0xaa4a('0xc')]);router['get']('/:id',auth[_0xaa4a('0xa')](),controller['show']);router['post']('/',auth[_0xaa4a('0xa')](),controller['create']);router[_0xaa4a('0xd')](_0xaa4a('0xe'),auth['isAuthenticated'](),controller[_0xaa4a('0xf')]);router['delete'](_0xaa4a('0xe'),auth[_0xaa4a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf63c=['isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x248e31,_0x3ace9b){var _0x141c0e=function(_0x1c7681){while(--_0x1c7681){_0x248e31['push'](_0x248e31['shift']());}};_0x141c0e(++_0x3ace9b);}(_0xf63c,0xf1));var _0xcf63=function(_0x314109,_0xb7523f){_0x314109=_0x314109-0x0;var _0x3c54c1=_0xf63c[_0x314109];return _0x3c54c1;};'use strict';var multer=require(_0xcf63('0x0'));var util=require(_0xcf63('0x1'));var path=require(_0xcf63('0x2'));var timeout=require(_0xcf63('0x3'));var express=require(_0xcf63('0x4'));var router=express[_0xcf63('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcf63('0x6'));var interaction=require(_0xcf63('0x7'));var config=require(_0xcf63('0x8'));var controller=require(_0xcf63('0x9'));router[_0xcf63('0xa')]('/',auth[_0xcf63('0xb')](),controller[_0xcf63('0xc')]);router[_0xcf63('0xa')](_0xcf63('0xd'),auth[_0xcf63('0xb')](),controller['describe']);router[_0xcf63('0xa')](_0xcf63('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xcf63('0xf')]('/',auth['isAuthenticated'](),controller[_0xcf63('0x10')]);router[_0xcf63('0x11')](_0xcf63('0xe'),auth['isAuthenticated'](),controller[_0xcf63('0x12')]);router[_0xcf63('0x13')](_0xcf63('0xe'),auth['isAuthenticated'](),controller[_0xcf63('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c928e9b..dafeb90 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 _0xed8a=['addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post'];(function(_0x433ae0,_0x209a59){var _0x7b57dc=function(_0x10ad47){while(--_0x10ad47){_0x433ae0['push'](_0x433ae0['shift']());}};_0x7b57dc(++_0x209a59);}(_0xed8a,0x6e));var _0xaed8=function(_0x55baa6,_0x28db92){_0x55baa6=_0x55baa6-0x0;var _0x3fe272=_0xed8a[_0x55baa6];return _0x3fe272;};'use strict';var multer=require('multer');var util=require(_0xaed8('0x0'));var path=require(_0xaed8('0x1'));var timeout=require(_0xaed8('0x2'));var express=require(_0xaed8('0x3'));var router=express[_0xaed8('0x4')]();var fs_extra=require(_0xaed8('0x5'));var auth=require(_0xaed8('0x6'));var interaction=require(_0xaed8('0x7'));var config=require(_0xaed8('0x8'));var controller=require(_0xaed8('0x9'));router[_0xaed8('0xa')]('/',auth[_0xaed8('0xb')](),controller[_0xaed8('0xc')]);router['get'](_0xaed8('0xd'),auth['isAuthenticated'](),controller[_0xaed8('0xe')]);router[_0xaed8('0xa')](_0xaed8('0xf'),auth[_0xaed8('0xb')](),controller[_0xaed8('0x10')]);router[_0xaed8('0xa')](_0xaed8('0x11'),auth[_0xaed8('0xb')](),controller['getFields']);router['post']('/',auth[_0xaed8('0xb')](),controller[_0xaed8('0x12')]);router[_0xaed8('0x13')](_0xaed8('0xf'),auth[_0xaed8('0xb')](),controller[_0xaed8('0x14')]);router[_0xaed8('0x15')](_0xaed8('0xd'),auth['isAuthenticated'](),controller[_0xaed8('0x16')]);router[_0xaed8('0x17')]('/:id',auth[_0xaed8('0xb')](),controller[_0xaed8('0x18')]);module[_0xaed8('0x19')]=router; \ No newline at end of file +var _0x74f6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x17515c,_0x40990b){var _0x4856e4=function(_0x483e65){while(--_0x483e65){_0x17515c['push'](_0x17515c['shift']());}};_0x4856e4(++_0x40990b);}(_0x74f6,0x7f));var _0x674f=function(_0x4b1773,_0x551ca2){_0x4b1773=_0x4b1773-0x0;var _0x7c5902=_0x74f6[_0x4b1773];return _0x7c5902;};'use strict';var multer=require(_0x674f('0x0'));var util=require(_0x674f('0x1'));var path=require(_0x674f('0x2'));var timeout=require(_0x674f('0x3'));var express=require(_0x674f('0x4'));var router=express[_0x674f('0x5')]();var fs_extra=require(_0x674f('0x6'));var auth=require(_0x674f('0x7'));var interaction=require(_0x674f('0x8'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x674f('0x9')]('/',auth[_0x674f('0xa')](),controller[_0x674f('0xb')]);router[_0x674f('0x9')]('/:id',auth[_0x674f('0xa')](),controller[_0x674f('0xc')]);router[_0x674f('0x9')](_0x674f('0xd'),auth['isAuthenticated'](),controller[_0x674f('0xe')]);router['get'](_0x674f('0xf'),auth['isAuthenticated'](),controller[_0x674f('0x10')]);router[_0x674f('0x11')]('/',auth[_0x674f('0xa')](),controller[_0x674f('0x12')]);router['post'](_0x674f('0xd'),auth[_0x674f('0xa')](),controller[_0x674f('0x13')]);router[_0x674f('0x14')]('/:id',auth[_0x674f('0xa')](),controller[_0x674f('0x15')]);router[_0x674f('0x16')](_0x674f('0x17'),auth['isAuthenticated'](),controller[_0x674f('0x18')]);module[_0x674f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e2ffd54..da69e46 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 _0x22b6=['STRING','basic','ENUM','integrationTab','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22b6,0xdc));var _0x622b=function(_0x47a0dd,_0x5a719f){_0x47a0dd=_0x47a0dd-0x0;var _0x4487a6=_0x22b6[_0x47a0dd];return _0x4487a6;};'use strict';var Sequelize=require(_0x622b('0x0'));module[_0x622b('0x1')]={'name':{'type':Sequelize[_0x622b('0x2')]},'description':{'type':Sequelize[_0x622b('0x2')]},'username':{'type':Sequelize[_0x622b('0x2')]},'remoteUri':{'type':Sequelize[_0x622b('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x622b('0x3')),'defaultValue':_0x622b('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x622b('0x2')]},'tokenSecret':{'type':Sequelize[_0x622b('0x2')]},'serverUrl':{'type':Sequelize[_0x622b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x622b('0x4')](_0x622b('0x5'),'newTab'),'defaultValue':_0x622b('0x5')}}; \ No newline at end of file +var _0xd92b=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x2e1387,_0x2fd52a){var _0xda65a6=function(_0x59d3f5){while(--_0x59d3f5){_0x2e1387['push'](_0x2e1387['shift']());}};_0xda65a6(++_0x2fd52a);}(_0xd92b,0x1df));var _0xbd92=function(_0x2cdd2c,_0x1cda09){_0x2cdd2c=_0x2cdd2c-0x0;var _0xa2f722=_0xd92b[_0x2cdd2c];return _0xa2f722;};'use strict';var Sequelize=require(_0xbd92('0x0'));module[_0xbd92('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd92('0x2')]},'username':{'type':Sequelize[_0xbd92('0x2')]},'remoteUri':{'type':Sequelize[_0xbd92('0x2')]},'authType':{'type':Sequelize[_0xbd92('0x3')]('basic'),'defaultValue':_0xbd92('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xbd92('0x2')]},'consumerSecret':{'type':Sequelize[_0xbd92('0x2')]},'token':{'type':Sequelize[_0xbd92('0x2')]},'tokenSecret':{'type':Sequelize[_0xbd92('0x2')]},'serverUrl':{'type':Sequelize[_0xbd92('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbd92('0x3')]('integrationTab','newTab'),'defaultValue':_0xbd92('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 102fc1d..f8cec5e 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 _0x031b=['concat','_embedded','active','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','create','body','update','params','find','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString'];(function(_0xebbad4,_0x20e652){var _0x81c465=function(_0x56a045){while(--_0x56a045){_0xebbad4['push'](_0xebbad4['shift']());}};_0x81c465(++_0x20e652);}(_0x031b,0x7e));var _0xb031=function(_0x11abd5,_0x36a8a6){_0x11abd5=_0x11abd5-0x0;var _0x2c80d1=_0x031b[_0x11abd5];return _0x2c80d1;};'use strict';var emlformat=require(_0xb031('0x0'));var rimraf=require(_0xb031('0x1'));var zipdir=require(_0xb031('0x2'));var jsonpatch=require(_0xb031('0x3'));var rp=require(_0xb031('0x4'));var moment=require(_0xb031('0x5'));var BPromise=require(_0xb031('0x6'));var Mustache=require(_0xb031('0x7'));var util=require(_0xb031('0x8'));var path=require(_0xb031('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb031('0xa'));var fs=require('fs');var fs_extra=require(_0xb031('0xb'));var _=require('lodash');var squel=require(_0xb031('0xc'));var crypto=require(_0xb031('0xd'));var jsforce=require(_0xb031('0xe'));var deskjs=require(_0xb031('0xf'));var toCsv=require(_0xb031('0x10'));var querystring=require(_0xb031('0x11'));var Papa=require(_0xb031('0x12'));var Redis=require(_0xb031('0x13'));var authService=require(_0xb031('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb031('0x15'));var hardwareService=require(_0xb031('0x16'));var logger=require(_0xb031('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xb031('0x18'));var licenseUtil=require(_0xb031('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb031('0x1a'));function respondWithStatusCode(_0x18e461,_0x26dc58){_0x26dc58=_0x26dc58||0xcc;return function(_0x9b57ea){if(_0x9b57ea){return _0x18e461[_0xb031('0x1b')](_0x26dc58);}return _0x18e461['status'](_0x26dc58)[_0xb031('0x1c')]();};}function respondWithResult(_0x35d771,_0xeeac93){_0xeeac93=_0xeeac93||0xc8;return function(_0x13e310){if(_0x13e310){return _0x35d771['status'](_0xeeac93)[_0xb031('0x1d')](_0x13e310);}};}function respondWithFilteredResult(_0x38af62,_0x115d4b){return function(_0x245ef0){if(_0x245ef0){var _0x28774d=typeof _0x115d4b[_0xb031('0x1e')]===_0xb031('0x1f')&&typeof _0x115d4b[_0xb031('0x20')]===_0xb031('0x1f');var _0x4489f8=_0x245ef0['count'];var _0x352014=_0x28774d?0x0:_0x115d4b[_0xb031('0x1e')];var _0x517362=_0x28774d?_0x245ef0[_0xb031('0x21')]:_0x115d4b[_0xb031('0x1e')]+_0x115d4b[_0xb031('0x20')];var _0x45d358;if(_0x517362>=_0x4489f8){_0x517362=_0x4489f8;_0x45d358=0xc8;}else{_0x45d358=0xce;}_0x38af62[_0xb031('0x22')](_0x45d358);return _0x38af62[_0xb031('0x23')](_0xb031('0x24'),_0x352014+'-'+_0x517362+'/'+_0x4489f8)[_0xb031('0x1d')](_0x245ef0);}return null;};}function patchUpdates(_0x45e41c){return function(_0x486d89){try{jsonpatch[_0xb031('0x25')](_0x486d89,_0x45e41c,!![]);}catch(_0xf8c012){return BPromise[_0xb031('0x26')](_0xf8c012);}return _0x486d89[_0xb031('0x27')]();};}function saveUpdates(_0x5009d1,_0x54757a){return function(_0x546664){if(_0x546664){return _0x546664['update'](_0x5009d1)[_0xb031('0x28')](function(_0x20e1a3){return _0x20e1a3;});}return null;};}function removeEntity(_0x47f4de,_0x5c7cbc){return function(_0x247a2e){if(_0x247a2e){return _0x247a2e[_0xb031('0x29')]()[_0xb031('0x28')](function(){_0x47f4de[_0xb031('0x22')](0xcc)[_0xb031('0x1c')]();});}};}function handleEntityNotFound(_0x57badf,_0x1ffb02){return function(_0x40b0ef){if(!_0x40b0ef){_0x57badf[_0xb031('0x1b')](0x194);}return _0x40b0ef;};}function handleError(_0x5a5a44,_0xeaa57d){_0xeaa57d=_0xeaa57d||0x1f4;return function(_0x5f4874){logger['error'](_0x5f4874[_0xb031('0x2a')]);if(_0x5f4874[_0xb031('0x2b')]){delete _0x5f4874[_0xb031('0x2b')];}_0x5a5a44[_0xb031('0x22')](_0xeaa57d)[_0xb031('0x2c')](_0x5f4874);};}exports[_0xb031('0x2d')]=function(_0x1149a4,_0x439a93){var _0x154496={},_0x12048c={},_0x169dac={'count':0x0,'rows':[]};var _0x1bac68=_[_0xb031('0x2e')](db[_0xb031('0x2f')][_0xb031('0x30')],function(_0xb24afb){return{'name':_0xb24afb[_0xb031('0x31')],'type':_0xb24afb['type'][_0xb031('0x32')]};});_0x12048c[_0xb031('0x33')]=_['map'](_0x1bac68,_0xb031('0x2b'));_0x12048c['query']=_[_0xb031('0x34')](_0x1149a4[_0xb031('0x35')]);_0x12048c['filters']=_[_0xb031('0x36')](_0x12048c[_0xb031('0x33')],_0x12048c[_0xb031('0x35')]);_0x154496[_0xb031('0x37')]=_[_0xb031('0x36')](_0x12048c[_0xb031('0x33')],qs['fields'](_0x1149a4[_0xb031('0x35')][_0xb031('0x38')]));_0x154496[_0xb031('0x37')]=_0x154496[_0xb031('0x37')][_0xb031('0x39')]?_0x154496['attributes']:_0x12048c[_0xb031('0x33')];if(!_0x1149a4[_0xb031('0x35')][_0xb031('0x3a')](_0xb031('0x3b'))){_0x154496[_0xb031('0x20')]=qs[_0xb031('0x20')](_0x1149a4[_0xb031('0x35')][_0xb031('0x20')]);_0x154496[_0xb031('0x1e')]=qs[_0xb031('0x1e')](_0x1149a4[_0xb031('0x35')][_0xb031('0x1e')]);}_0x154496[_0xb031('0x3c')]=qs[_0xb031('0x3d')](_0x1149a4[_0xb031('0x35')][_0xb031('0x3d')]);_0x154496['where']=qs[_0xb031('0x3e')](_['pick'](_0x1149a4['query'],_0x12048c[_0xb031('0x3e')]),_0x1bac68);if(_0x1149a4[_0xb031('0x35')][_0xb031('0x3f')]){_0x154496[_0xb031('0x40')]=_[_0xb031('0x41')](_0x154496[_0xb031('0x40')],{'$or':_[_0xb031('0x2e')](_0x1bac68,function(_0x26b8f5){if(_0x26b8f5[_0xb031('0x42')]!==_0xb031('0x43')){var _0x2b0bc3={};_0x2b0bc3[_0x26b8f5['name']]={'$like':'%'+_0x1149a4[_0xb031('0x35')][_0xb031('0x3f')]+'%'};return _0x2b0bc3;}})});}_0x154496=_[_0xb031('0x41')]({},_0x154496,_0x1149a4[_0xb031('0x44')]);var _0x3763bf={'where':_0x154496['where']};return db[_0xb031('0x2f')][_0xb031('0x21')](_0x3763bf)[_0xb031('0x28')](function(_0x5185e8){_0x169dac[_0xb031('0x21')]=_0x5185e8;if(_0x1149a4['query'][_0xb031('0x45')]){_0x154496['include']=[{'all':!![]}];}return db[_0xb031('0x2f')][_0xb031('0x46')](_0x154496);})[_0xb031('0x28')](function(_0x245ba7){_0x169dac[_0xb031('0x47')]=_0x245ba7;return _0x169dac;})[_0xb031('0x28')](respondWithFilteredResult(_0x439a93,_0x154496))[_0xb031('0x48')](handleError(_0x439a93,null));};exports['show']=function(_0x159104,_0x53133c){var _0x561e17={'raw':![],'where':{'id':_0x159104['params']['id']}},_0x25af4a={};_0x25af4a[_0xb031('0x33')]=_['keys'](db['DeskAccount'][_0xb031('0x30')]);_0x25af4a[_0xb031('0x35')]=_[_0xb031('0x34')](_0x159104[_0xb031('0x35')]);_0x25af4a[_0xb031('0x3e')]=_[_0xb031('0x36')](_0x25af4a[_0xb031('0x33')],_0x25af4a[_0xb031('0x35')]);_0x561e17[_0xb031('0x37')]=_[_0xb031('0x36')](_0x25af4a[_0xb031('0x33')],qs[_0xb031('0x38')](_0x159104[_0xb031('0x35')][_0xb031('0x38')]));_0x561e17['attributes']=_0x561e17[_0xb031('0x37')][_0xb031('0x39')]?_0x561e17[_0xb031('0x37')]:_0x25af4a['model'];if(_0x159104[_0xb031('0x35')][_0xb031('0x45')]){_0x561e17['include']=[{'all':!![]}];}_0x561e17=_[_0xb031('0x41')]({},_0x561e17,_0x159104[_0xb031('0x44')]);return db[_0xb031('0x2f')]['find'](_0x561e17)[_0xb031('0x28')](handleEntityNotFound(_0x53133c,null))[_0xb031('0x28')](respondWithResult(_0x53133c,null))[_0xb031('0x48')](handleError(_0x53133c,null));};exports['create']=function(_0x650dd6,_0x12bad4){return db[_0xb031('0x2f')][_0xb031('0x49')](_0x650dd6[_0xb031('0x4a')],{})[_0xb031('0x28')](respondWithResult(_0x12bad4,0xc9))[_0xb031('0x48')](handleError(_0x12bad4,null));};exports[_0xb031('0x4b')]=function(_0x3c8b3a,_0x4f16cf){if(_0x3c8b3a[_0xb031('0x4a')]['id']){delete _0x3c8b3a['body']['id'];}return db[_0xb031('0x2f')]['find']({'where':{'id':_0x3c8b3a[_0xb031('0x4c')]['id']}})[_0xb031('0x28')](handleEntityNotFound(_0x4f16cf,null))[_0xb031('0x28')](saveUpdates(_0x3c8b3a[_0xb031('0x4a')],null))[_0xb031('0x28')](respondWithResult(_0x4f16cf,null))['catch'](handleError(_0x4f16cf,null));};exports[_0xb031('0x29')]=function(_0x2fa355,_0x3887fa){return db[_0xb031('0x2f')][_0xb031('0x4d')]({'where':{'id':_0x2fa355[_0xb031('0x4c')]['id']}})[_0xb031('0x28')](handleEntityNotFound(_0x3887fa,null))[_0xb031('0x28')](removeEntity(_0x3887fa,null))[_0xb031('0x48')](handleError(_0x3887fa,null));};exports[_0xb031('0x4e')]=function(_0x1f462f,_0x3c8e25,_0x5a3136){var _0x4be4bd={};var _0x1b1526={};var _0x37b437;var _0x524445;return db[_0xb031('0x2f')][_0xb031('0x4f')]({'where':{'id':_0x1f462f['params']['id']}})[_0xb031('0x28')](handleEntityNotFound(_0x3c8e25,null))[_0xb031('0x28')](function(_0x4b5ad7){if(_0x4b5ad7){_0x37b437=_0x4b5ad7;_0x1b1526[_0xb031('0x33')]=_[_0xb031('0x34')](db[_0xb031('0x50')][_0xb031('0x30')]);_0x1b1526['query']=_[_0xb031('0x34')](_0x1f462f['query']);_0x1b1526['filters']=_['intersection'](_0x1b1526[_0xb031('0x33')],_0x1b1526['query']);_0x4be4bd['attributes']=_[_0xb031('0x36')](_0x1b1526[_0xb031('0x33')],qs[_0xb031('0x38')](_0x1f462f[_0xb031('0x35')][_0xb031('0x38')]));_0x4be4bd[_0xb031('0x37')]=_0x4be4bd[_0xb031('0x37')][_0xb031('0x39')]?_0x4be4bd[_0xb031('0x37')]:_0x1b1526[_0xb031('0x33')];_0x4be4bd[_0xb031('0x3c')]=qs[_0xb031('0x3d')](_0x1f462f[_0xb031('0x35')][_0xb031('0x3d')]);_0x4be4bd[_0xb031('0x40')]=qs[_0xb031('0x3e')](_[_0xb031('0x51')](_0x1f462f['query'],_0x1b1526[_0xb031('0x3e')]));if(_0x1f462f['query'][_0xb031('0x3f')]){_0x4be4bd['where']=_[_0xb031('0x41')](_0x4be4bd[_0xb031('0x40')],{'$or':_[_0xb031('0x2e')](_0x4be4bd[_0xb031('0x37')],function(_0x41ea12){var _0x42a3ae={};_0x42a3ae[_0x41ea12]={'$like':'%'+_0x1f462f[_0xb031('0x35')][_0xb031('0x3f')]+'%'};return _0x42a3ae;})});}_0x4be4bd=_[_0xb031('0x41')]({},_0x4be4bd,_0x1f462f[_0xb031('0x44')]);return _0x37b437['getConfigurations'](_0x4be4bd);}})['then'](function(_0x209384){if(_0x209384){_0x524445=_0x209384['length'];if(!_0x1f462f['query']['hasOwnProperty'](_0xb031('0x3b'))){_0x4be4bd[_0xb031('0x20')]=qs[_0xb031('0x20')](_0x1f462f['query'][_0xb031('0x20')]);_0x4be4bd[_0xb031('0x1e')]=qs[_0xb031('0x1e')](_0x1f462f[_0xb031('0x35')][_0xb031('0x1e')]);}return _0x37b437[_0xb031('0x4e')](_0x4be4bd);}})['then'](function(_0x548315){if(_0x548315){return _0x548315?{'count':_0x524445,'rows':_0x548315}:null;}})[_0xb031('0x28')](respondWithResult(_0x3c8e25,null))[_0xb031('0x48')](handleError(_0x3c8e25,null));};exports[_0xb031('0x52')]=function(_0x28d18e,_0x15ab40,_0x47a634){if(_0x28d18e['body']['id']){delete _0x28d18e[_0xb031('0x4a')]['id'];}return db[_0xb031('0x2f')][_0xb031('0x4f')]({'where':{'id':_0x28d18e[_0xb031('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15ab40,null))[_0xb031('0x28')](function(_0xc9d083){if(_0xc9d083){_0x28d18e[_0xb031('0x4a')]['AccountId']=_0xc9d083['id'];_0x28d18e['body'][_0xb031('0x53')]=integrations[_0xb031('0x54')](_0x28d18e['body'][_0xb031('0x55')],_0x28d18e[_0xb031('0x4a')][_0xb031('0x42')]);_0x28d18e[_0xb031('0x4a')]['Descriptions']=integrations[_0xb031('0x56')](_0x28d18e[_0xb031('0x4a')][_0xb031('0x55')],_0x28d18e[_0xb031('0x4a')][_0xb031('0x42')]);return db[_0xb031('0x50')][_0xb031('0x49')](_0x28d18e[_0xb031('0x4a')],{'include':[{'model':db[_0xb031('0x57')],'as':_0xb031('0x53')},{'model':db[_0xb031('0x57')],'as':'Descriptions'}]});}return null;})[_0xb031('0x28')](respondWithResult(_0x15ab40,null))[_0xb031('0x48')](handleError(_0x15ab40,null));};exports[_0xb031('0x58')]=function(_0x29231e,_0x5dcbc,_0x2c16bb){var _0x5cc487=[{'name':_0xb031('0x59'),'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 _0x2462fc='';return db['DeskAccount'][_0xb031('0x4f')]({'where':{'id':_0x29231e[_0xb031('0x4c')]['id']},'attributes':['id',_0xb031('0x5a'),'authType',_0xb031('0x5b'),_0xb031('0x5c'),_0xb031('0x5d'),_0xb031('0x5e'),_0xb031('0x5f'),'tokenSecret']})['then'](handleEntityNotFound(_0x5dcbc,null))['then'](function(_0x50966e){if(_0x50966e){_0x2462fc=_0x50966e['remoteUri'];var _0x9d3f43=_0x2462fc[_0xb031('0x60')](-0x1);if(_0x9d3f43==='/'){_0x2462fc=_0x2462fc[_0xb031('0x61')](0x0,_0x2462fc[_0xb031('0x62')](_0x9d3f43));}var _0x349b0a={'method':_0xb031('0x63'),'uri':util[_0xb031('0x64')](_0xb031('0x65'),_0x2462fc),'headers':{'Content-Type':_0xb031('0x66'),'Accept':_0xb031('0x66')},'json':!![]};if(_0x50966e[_0xb031('0x67')]===_0xb031('0x68')){_0x349b0a[_0xb031('0x69')][_0xb031('0x6a')]=util['format'](_0xb031('0x6b'),new Buffer(util[_0xb031('0x64')](_0xb031('0x6c'),_0x50966e[_0xb031('0x5b')],_0x50966e[_0xb031('0x5c')]))[_0xb031('0x6d')]('base64'));}return rp(_0x349b0a)[_0xb031('0x28')](function(_0x39c24a){return _0x5cc487[_0xb031('0x6e')](_['map'](_0x39c24a[_0xb031('0x6f')]['entries'],function(_0x4464e8){return{'id':_0x4464e8[_0xb031('0x2b')],'name':_0x4464e8['name'],'type':_0x4464e8[_0xb031('0x42')],'active':_0x4464e8[_0xb031('0x70')],'label':_0x4464e8['label'],'custom':!![]};}));});}})[_0xb031('0x28')](function(_0x31df22){return{'count':_0x31df22[_0xb031('0x39')],'rows':_0x31df22};})[_0xb031('0x28')](respondWithResult(_0x5dcbc,null))['catch'](function(_0x25f8fa){var _0xff171=_0x29231e[_0xb031('0x35')][_0xb031('0x71')]?0x1f4:_0x25f8fa[_0xb031('0x72')]||0x1f4;logger[_0xb031('0x73')](_0xb031('0x74'),_0xb031('0x58'),_0xff171,JSON['stringify'](_0x25f8fa));delete _0x25f8fa[_0xb031('0x2b')];if(_0xff171===0x191){_0xff171=0x190;}_0x5dcbc['status'](_0xff171)[_0xb031('0x2c')](_0x29231e[_0xb031('0x35')][_0xb031('0x71')]?{'message':_0xb031('0x75'),'statusCode':_0x25f8fa[_0xb031('0x72')]}:_0x25f8fa);});}; \ No newline at end of file +var _0x6d96=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Basic\x20%s','username','toString','base64','concat','_embedded','entries','active','label','test','send','Wrong\x20credentials','statusCode','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','name','index','DeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x5317c5,_0xf94d07){var _0x432604=function(_0x2e5abd){while(--_0x2e5abd){_0x5317c5['push'](_0x5317c5['shift']());}};_0x432604(++_0xf94d07);}(_0x6d96,0x18f));var _0x66d9=function(_0xac8440,_0x243e61){_0xac8440=_0xac8440-0x0;var _0x4cc668=_0x6d96[_0xac8440];return _0x4cc668;};'use strict';var emlformat=require(_0x66d9('0x0'));var rimraf=require(_0x66d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x66d9('0x2'));var BPromise=require(_0x66d9('0x3'));var Mustache=require(_0x66d9('0x4'));var util=require(_0x66d9('0x5'));var path=require('path');var sox=require(_0x66d9('0x6'));var csv=require(_0x66d9('0x7'));var ejs=require(_0x66d9('0x8'));var fs=require('fs');var fs_extra=require(_0x66d9('0x9'));var _=require(_0x66d9('0xa'));var squel=require(_0x66d9('0xb'));var crypto=require(_0x66d9('0xc'));var jsforce=require(_0x66d9('0xd'));var deskjs=require(_0x66d9('0xe'));var toCsv=require(_0x66d9('0x7'));var querystring=require('querystring');var Papa=require(_0x66d9('0xf'));var Redis=require('ioredis');var authService=require(_0x66d9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x66d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66d9('0x12'))(_0x66d9('0x13'));var utils=require(_0x66d9('0x14'));var config=require(_0x66d9('0x15'));var licenseUtil=require(_0x66d9('0x16'));var db=require(_0x66d9('0x17'))['db'];var integrations=require(_0x66d9('0x18'));function respondWithStatusCode(_0x361be4,_0xf15aa3){_0xf15aa3=_0xf15aa3||0xcc;return function(_0x4a9070){if(_0x4a9070){return _0x361be4[_0x66d9('0x19')](_0xf15aa3);}return _0x361be4[_0x66d9('0x1a')](_0xf15aa3)['end']();};}function respondWithResult(_0x5dacc8,_0x528507){_0x528507=_0x528507||0xc8;return function(_0x424049){if(_0x424049){return _0x5dacc8['status'](_0x528507)[_0x66d9('0x1b')](_0x424049);}};}function respondWithFilteredResult(_0x239062,_0x2bd72f){return function(_0x4b3b91){if(_0x4b3b91){var _0x233649=typeof _0x2bd72f[_0x66d9('0x1c')]===_0x66d9('0x1d')&&typeof _0x2bd72f['limit']===_0x66d9('0x1d');var _0xd2c9dc=_0x4b3b91[_0x66d9('0x1e')];var _0x238b2f=_0x233649?0x0:_0x2bd72f[_0x66d9('0x1c')];var _0x596e4b=_0x233649?_0x4b3b91[_0x66d9('0x1e')]:_0x2bd72f[_0x66d9('0x1c')]+_0x2bd72f[_0x66d9('0x1f')];var _0x42724c;if(_0x596e4b>=_0xd2c9dc){_0x596e4b=_0xd2c9dc;_0x42724c=0xc8;}else{_0x42724c=0xce;}_0x239062[_0x66d9('0x1a')](_0x42724c);return _0x239062['set'](_0x66d9('0x20'),_0x238b2f+'-'+_0x596e4b+'/'+_0xd2c9dc)[_0x66d9('0x1b')](_0x4b3b91);}return null;};}function patchUpdates(_0x5b9796){return function(_0x5b5f51){try{jsonpatch[_0x66d9('0x21')](_0x5b5f51,_0x5b9796,!![]);}catch(_0x236312){return BPromise[_0x66d9('0x22')](_0x236312);}return _0x5b5f51[_0x66d9('0x23')]();};}function saveUpdates(_0x22fbd0,_0x1dad4c){return function(_0x522f7f){if(_0x522f7f){return _0x522f7f[_0x66d9('0x24')](_0x22fbd0)['then'](function(_0x32c488){return _0x32c488;});}return null;};}function removeEntity(_0x50fd8f,_0x3efa78){return function(_0x3763e6){if(_0x3763e6){return _0x3763e6['destroy']()[_0x66d9('0x25')](function(){_0x50fd8f[_0x66d9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d20b,_0x2ee6b6){return function(_0x3ac776){if(!_0x3ac776){_0x17d20b[_0x66d9('0x19')](0x194);}return _0x3ac776;};}function handleError(_0x5c2865,_0x5725b2){_0x5725b2=_0x5725b2||0x1f4;return function(_0x3e8b31){logger[_0x66d9('0x26')](_0x3e8b31['stack']);if(_0x3e8b31['name']){delete _0x3e8b31[_0x66d9('0x27')];}_0x5c2865[_0x66d9('0x1a')](_0x5725b2)['send'](_0x3e8b31);};}exports[_0x66d9('0x28')]=function(_0x5932ab,_0x15d86e){var _0xbd040f={},_0x4caf0f={},_0xe14586={'count':0x0,'rows':[]};var _0x10969e=_['map'](db[_0x66d9('0x29')][_0x66d9('0x2a')],function(_0x9ba1a2){return{'name':_0x9ba1a2[_0x66d9('0x2b')],'type':_0x9ba1a2['type']['key']};});_0x4caf0f[_0x66d9('0x2c')]=_[_0x66d9('0x2d')](_0x10969e,_0x66d9('0x27'));_0x4caf0f[_0x66d9('0x2e')]=_[_0x66d9('0x2f')](_0x5932ab[_0x66d9('0x2e')]);_0x4caf0f[_0x66d9('0x30')]=_[_0x66d9('0x31')](_0x4caf0f[_0x66d9('0x2c')],_0x4caf0f[_0x66d9('0x2e')]);_0xbd040f['attributes']=_[_0x66d9('0x31')](_0x4caf0f[_0x66d9('0x2c')],qs[_0x66d9('0x32')](_0x5932ab[_0x66d9('0x2e')][_0x66d9('0x32')]));_0xbd040f['attributes']=_0xbd040f[_0x66d9('0x33')][_0x66d9('0x34')]?_0xbd040f[_0x66d9('0x33')]:_0x4caf0f[_0x66d9('0x2c')];if(!_0x5932ab[_0x66d9('0x2e')][_0x66d9('0x35')](_0x66d9('0x36'))){_0xbd040f[_0x66d9('0x1f')]=qs[_0x66d9('0x1f')](_0x5932ab[_0x66d9('0x2e')][_0x66d9('0x1f')]);_0xbd040f[_0x66d9('0x1c')]=qs[_0x66d9('0x1c')](_0x5932ab[_0x66d9('0x2e')][_0x66d9('0x1c')]);}_0xbd040f[_0x66d9('0x37')]=qs[_0x66d9('0x38')](_0x5932ab['query'][_0x66d9('0x38')]);_0xbd040f[_0x66d9('0x39')]=qs[_0x66d9('0x30')](_[_0x66d9('0x3a')](_0x5932ab[_0x66d9('0x2e')],_0x4caf0f[_0x66d9('0x30')]),_0x10969e);if(_0x5932ab[_0x66d9('0x2e')][_0x66d9('0x3b')]){_0xbd040f[_0x66d9('0x39')]=_[_0x66d9('0x3c')](_0xbd040f[_0x66d9('0x39')],{'$or':_[_0x66d9('0x2d')](_0x10969e,function(_0x22fee8){if(_0x22fee8['type']!==_0x66d9('0x3d')){var _0x2ea5bf={};_0x2ea5bf[_0x22fee8[_0x66d9('0x27')]]={'$like':'%'+_0x5932ab['query'][_0x66d9('0x3b')]+'%'};return _0x2ea5bf;}})});}_0xbd040f=_[_0x66d9('0x3c')]({},_0xbd040f,_0x5932ab[_0x66d9('0x3e')]);var _0x47c0b={'where':_0xbd040f[_0x66d9('0x39')]};return db[_0x66d9('0x29')][_0x66d9('0x1e')](_0x47c0b)['then'](function(_0x1c6dfc){_0xe14586[_0x66d9('0x1e')]=_0x1c6dfc;if(_0x5932ab[_0x66d9('0x2e')]['includeAll']){_0xbd040f[_0x66d9('0x3f')]=[{'all':!![]}];}return db[_0x66d9('0x29')]['findAll'](_0xbd040f);})[_0x66d9('0x25')](function(_0x39693f){_0xe14586[_0x66d9('0x40')]=_0x39693f;return _0xe14586;})['then'](respondWithFilteredResult(_0x15d86e,_0xbd040f))[_0x66d9('0x41')](handleError(_0x15d86e,null));};exports[_0x66d9('0x42')]=function(_0x51974d,_0x4cfe84){var _0x193995={'raw':![],'where':{'id':_0x51974d[_0x66d9('0x43')]['id']}},_0x33eb55={};_0x33eb55[_0x66d9('0x2c')]=_[_0x66d9('0x2f')](db['DeskAccount'][_0x66d9('0x2a')]);_0x33eb55['query']=_[_0x66d9('0x2f')](_0x51974d[_0x66d9('0x2e')]);_0x33eb55[_0x66d9('0x30')]=_['intersection'](_0x33eb55[_0x66d9('0x2c')],_0x33eb55[_0x66d9('0x2e')]);_0x193995[_0x66d9('0x33')]=_['intersection'](_0x33eb55[_0x66d9('0x2c')],qs[_0x66d9('0x32')](_0x51974d[_0x66d9('0x2e')]['fields']));_0x193995[_0x66d9('0x33')]=_0x193995[_0x66d9('0x33')]['length']?_0x193995[_0x66d9('0x33')]:_0x33eb55[_0x66d9('0x2c')];if(_0x51974d['query'][_0x66d9('0x44')]){_0x193995[_0x66d9('0x3f')]=[{'all':!![]}];}_0x193995=_[_0x66d9('0x3c')]({},_0x193995,_0x51974d['options']);return db[_0x66d9('0x29')][_0x66d9('0x45')](_0x193995)['then'](handleEntityNotFound(_0x4cfe84,null))['then'](respondWithResult(_0x4cfe84,null))[_0x66d9('0x41')](handleError(_0x4cfe84,null));};exports[_0x66d9('0x46')]=function(_0x51c294,_0x50802e){return db[_0x66d9('0x29')][_0x66d9('0x46')](_0x51c294[_0x66d9('0x47')],{})[_0x66d9('0x25')](respondWithResult(_0x50802e,0xc9))[_0x66d9('0x41')](handleError(_0x50802e,null));};exports[_0x66d9('0x24')]=function(_0x20795f,_0x4d9443){if(_0x20795f[_0x66d9('0x47')]['id']){delete _0x20795f['body']['id'];}return db[_0x66d9('0x29')][_0x66d9('0x45')]({'where':{'id':_0x20795f[_0x66d9('0x43')]['id']}})[_0x66d9('0x25')](handleEntityNotFound(_0x4d9443,null))['then'](saveUpdates(_0x20795f[_0x66d9('0x47')],null))[_0x66d9('0x25')](respondWithResult(_0x4d9443,null))[_0x66d9('0x41')](handleError(_0x4d9443,null));};exports['destroy']=function(_0x11ee11,_0x1ad2a8){return db[_0x66d9('0x29')][_0x66d9('0x45')]({'where':{'id':_0x11ee11[_0x66d9('0x43')]['id']}})[_0x66d9('0x25')](handleEntityNotFound(_0x1ad2a8,null))['then'](removeEntity(_0x1ad2a8,null))[_0x66d9('0x41')](handleError(_0x1ad2a8,null));};exports[_0x66d9('0x48')]=function(_0x46a790,_0x11c4a7,_0x450654){var _0xb7983e={};var _0x21b13f={};var _0x31d8e4;var _0x27a240;return db[_0x66d9('0x29')][_0x66d9('0x49')]({'where':{'id':_0x46a790[_0x66d9('0x43')]['id']}})[_0x66d9('0x25')](handleEntityNotFound(_0x11c4a7,null))[_0x66d9('0x25')](function(_0x22f0df){if(_0x22f0df){_0x31d8e4=_0x22f0df;_0x21b13f[_0x66d9('0x2c')]=_[_0x66d9('0x2f')](db['DeskConfiguration']['rawAttributes']);_0x21b13f[_0x66d9('0x2e')]=_['keys'](_0x46a790[_0x66d9('0x2e')]);_0x21b13f[_0x66d9('0x30')]=_[_0x66d9('0x31')](_0x21b13f[_0x66d9('0x2c')],_0x21b13f[_0x66d9('0x2e')]);_0xb7983e[_0x66d9('0x33')]=_[_0x66d9('0x31')](_0x21b13f[_0x66d9('0x2c')],qs['fields'](_0x46a790[_0x66d9('0x2e')][_0x66d9('0x32')]));_0xb7983e[_0x66d9('0x33')]=_0xb7983e[_0x66d9('0x33')]['length']?_0xb7983e[_0x66d9('0x33')]:_0x21b13f[_0x66d9('0x2c')];_0xb7983e['order']=qs[_0x66d9('0x38')](_0x46a790[_0x66d9('0x2e')]['sort']);_0xb7983e[_0x66d9('0x39')]=qs[_0x66d9('0x30')](_['pick'](_0x46a790[_0x66d9('0x2e')],_0x21b13f[_0x66d9('0x30')]));if(_0x46a790[_0x66d9('0x2e')]['filter']){_0xb7983e[_0x66d9('0x39')]=_['merge'](_0xb7983e[_0x66d9('0x39')],{'$or':_[_0x66d9('0x2d')](_0xb7983e[_0x66d9('0x33')],function(_0x17f0db){var _0x556a49={};_0x556a49[_0x17f0db]={'$like':'%'+_0x46a790[_0x66d9('0x2e')]['filter']+'%'};return _0x556a49;})});}_0xb7983e=_['merge']({},_0xb7983e,_0x46a790['options']);return _0x31d8e4['getConfigurations'](_0xb7983e);}})[_0x66d9('0x25')](function(_0x2fc27c){if(_0x2fc27c){_0x27a240=_0x2fc27c[_0x66d9('0x34')];if(!_0x46a790[_0x66d9('0x2e')][_0x66d9('0x35')](_0x66d9('0x36'))){_0xb7983e[_0x66d9('0x1f')]=qs[_0x66d9('0x1f')](_0x46a790['query'][_0x66d9('0x1f')]);_0xb7983e['offset']=qs[_0x66d9('0x1c')](_0x46a790[_0x66d9('0x2e')][_0x66d9('0x1c')]);}return _0x31d8e4[_0x66d9('0x48')](_0xb7983e);}})['then'](function(_0x29d42e){if(_0x29d42e){return _0x29d42e?{'count':_0x27a240,'rows':_0x29d42e}:null;}})[_0x66d9('0x25')](respondWithResult(_0x11c4a7,null))[_0x66d9('0x41')](handleError(_0x11c4a7,null));};exports[_0x66d9('0x4a')]=function(_0xcc7a35,_0x3bdb49,_0x32a802){if(_0xcc7a35[_0x66d9('0x47')]['id']){delete _0xcc7a35['body']['id'];}return db[_0x66d9('0x29')][_0x66d9('0x49')]({'where':{'id':_0xcc7a35['params']['id']}})[_0x66d9('0x25')](handleEntityNotFound(_0x3bdb49,null))[_0x66d9('0x25')](function(_0x3ea3bd){if(_0x3ea3bd){_0xcc7a35[_0x66d9('0x47')][_0x66d9('0x4b')]=_0x3ea3bd['id'];_0xcc7a35[_0x66d9('0x47')][_0x66d9('0x4c')]=integrations[_0x66d9('0x4d')](_0xcc7a35[_0x66d9('0x47')][_0x66d9('0x4e')],_0xcc7a35[_0x66d9('0x47')][_0x66d9('0x4f')]);_0xcc7a35['body'][_0x66d9('0x50')]=integrations[_0x66d9('0x51')](_0xcc7a35[_0x66d9('0x47')][_0x66d9('0x4e')],_0xcc7a35['body'][_0x66d9('0x4f')]);return db[_0x66d9('0x52')]['create'](_0xcc7a35['body'],{'include':[{'model':db[_0x66d9('0x53')],'as':_0x66d9('0x4c')},{'model':db[_0x66d9('0x53')],'as':_0x66d9('0x50')}]});}return null;})[_0x66d9('0x25')](respondWithResult(_0x3bdb49,null))['catch'](handleError(_0x3bdb49,null));};exports[_0x66d9('0x54')]=function(_0x93401,_0x421462,_0x1967e9){var _0x1a7e2c=[{'name':'priority','label':_0x66d9('0x55'),'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 _0x322b3b='';return db['DeskAccount'][_0x66d9('0x49')]({'where':{'id':_0x93401[_0x66d9('0x43')]['id']},'attributes':['id','remoteUri','authType','username',_0x66d9('0x56'),_0x66d9('0x57'),_0x66d9('0x58'),_0x66d9('0x59'),_0x66d9('0x5a')]})[_0x66d9('0x25')](handleEntityNotFound(_0x421462,null))[_0x66d9('0x25')](function(_0x5f1f99){if(_0x5f1f99){_0x322b3b=_0x5f1f99[_0x66d9('0x5b')];var _0x56a8be=_0x322b3b[_0x66d9('0x5c')](-0x1);if(_0x56a8be==='/'){_0x322b3b=_0x322b3b[_0x66d9('0x5d')](0x0,_0x322b3b[_0x66d9('0x5e')](_0x56a8be));}var _0x5d645e={'method':_0x66d9('0x5f'),'uri':util[_0x66d9('0x60')]('%s/custom_fields',_0x322b3b),'headers':{'Content-Type':_0x66d9('0x61'),'Accept':_0x66d9('0x61')},'json':!![]};if(_0x5f1f99['authType']===_0x66d9('0x62')){_0x5d645e[_0x66d9('0x63')]['Authorization']=util[_0x66d9('0x60')](_0x66d9('0x64'),new Buffer(util[_0x66d9('0x60')]('%s:%s',_0x5f1f99[_0x66d9('0x65')],_0x5f1f99[_0x66d9('0x56')]))[_0x66d9('0x66')](_0x66d9('0x67')));}return rp(_0x5d645e)['then'](function(_0x416342){return _0x1a7e2c[_0x66d9('0x68')](_['map'](_0x416342[_0x66d9('0x69')][_0x66d9('0x6a')],function(_0x487e6a){return{'id':_0x487e6a[_0x66d9('0x27')],'name':_0x487e6a[_0x66d9('0x27')],'type':_0x487e6a['type'],'active':_0x487e6a[_0x66d9('0x6b')],'label':_0x487e6a[_0x66d9('0x6c')],'custom':!![]};}));});}})[_0x66d9('0x25')](function(_0x295ecc){return{'count':_0x295ecc['length'],'rows':_0x295ecc};})[_0x66d9('0x25')](respondWithResult(_0x421462,null))[_0x66d9('0x41')](function(_0x3c9dad){var _0x20d1f7=_0x93401[_0x66d9('0x2e')][_0x66d9('0x6d')]?0x1f4:_0x3c9dad['statusCode']||0x1f4;logger[_0x66d9('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x66d9('0x54'),_0x20d1f7,JSON['stringify'](_0x3c9dad));delete _0x3c9dad[_0x66d9('0x27')];if(_0x20d1f7===0x191){_0x20d1f7=0x190;}_0x421462[_0x66d9('0x1a')](_0x20d1f7)[_0x66d9('0x6e')](_0x93401[_0x66d9('0x2e')][_0x66d9('0x6d')]?{'message':_0x66d9('0x6f'),'statusCode':_0x3c9dad[_0x66d9('0x70')]}:_0x3c9dad);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 974bd1e..5ff7890 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 _0xf9e0=['bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','DeskAccount','api','moment'];(function(_0x233076,_0x21ca29){var _0x436378=function(_0x44d764){while(--_0x44d764){_0x233076['push'](_0x233076['shift']());}};_0x436378(++_0x21ca29);}(_0xf9e0,0x1e4));var _0x0f9e=function(_0x45b2e1,_0x4d6280){_0x45b2e1=_0x45b2e1-0x0;var _0x5616e2=_0xf9e0[_0x45b2e1];return _0x5616e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0f9e('0x0'));var moment=require(_0x0f9e('0x1'));var BPromise=require(_0x0f9e('0x2'));var rp=require(_0x0f9e('0x3'));var fs=require('fs');var path=require(_0x0f9e('0x4'));var rimraf=require('rimraf');var config=require(_0x0f9e('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x0f9e('0x6'));module[_0x0f9e('0x7')]=function(_0x41b499,_0x1aca64){return _0x41b499['define'](_0x0f9e('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f19=['exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2e6515,_0x15b634){var _0x335265=function(_0x25cc65){while(--_0x25cc65){_0x2e6515['push'](_0x2e6515['shift']());}};_0x335265(++_0x15b634);}(_0x3f19,0x16c));var _0x93f1=function(_0x4013da,_0xeaf6dc){_0x4013da=_0x4013da-0x0;var _0x434e19=_0x3f19[_0x4013da];return _0x434e19;};'use strict';var _=require(_0x93f1('0x0'));var util=require(_0x93f1('0x1'));var logger=require('../../config/logger')(_0x93f1('0x2'));var moment=require(_0x93f1('0x3'));var BPromise=require(_0x93f1('0x4'));var rp=require(_0x93f1('0x5'));var fs=require('fs');var path=require(_0x93f1('0x6'));var rimraf=require(_0x93f1('0x7'));var config=require(_0x93f1('0x8'));var attributes=require(_0x93f1('0x9'));var integrations=require(_0x93f1('0xa'));module[_0x93f1('0xb')]=function(_0x4d4d45,_0x5ef50f){return _0x4d4d45[_0x93f1('0xc')](_0x93f1('0xd'),attributes,{'tableName':_0x93f1('0xe'),'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 85ba220..dcd5cb7 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 _0xea59=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','model','map','find','ShowDeskAccount','lodash','util','bluebird','randomstring'];(function(_0x12d44e,_0x5d143a){var _0x3706fc=function(_0x38754b){while(--_0x38754b){_0x12d44e['push'](_0x12d44e['shift']());}};_0x3706fc(++_0x5d143a);}(_0xea59,0x193));var _0x9ea5=function(_0x489961,_0x4f7bc0){_0x489961=_0x489961-0x0;var _0x86513a=_0xea59[_0x489961];return _0x86513a;};'use strict';var _=require(_0x9ea5('0x0'));var util=require(_0x9ea5('0x1'));var moment=require('moment');var BPromise=require(_0x9ea5('0x2'));var rs=require(_0x9ea5('0x3'));var fs=require('fs');var Redis=require(_0x9ea5('0x4'));var db=require(_0x9ea5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea5('0x6'))(_0x9ea5('0x7'));var config=require(_0x9ea5('0x8'));var jayson=require(_0x9ea5('0x9'));var client=jayson[_0x9ea5('0xa')][_0x9ea5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c30e0,_0x43c27c,_0x4e443e){return new BPromise(function(_0x2d112f,_0x367f74){return client[_0x9ea5('0xc')](_0x4c30e0,_0x4e443e)[_0x9ea5('0xd')](function(_0x9bc7e0){logger[_0x9ea5('0xe')]('DeskAccount,\x20%s,\x20%s',_0x43c27c,_0x9ea5('0xf'));logger[_0x9ea5('0x10')](_0x9ea5('0x11'),_0x43c27c,_0x9ea5('0xf'),JSON[_0x9ea5('0x12')](_0x9bc7e0));if(_0x9bc7e0[_0x9ea5('0x13')]){if(_0x9bc7e0[_0x9ea5('0x13')][_0x9ea5('0x14')]===0x1f4){logger[_0x9ea5('0x13')](_0x9ea5('0x15'),_0x43c27c,_0x9bc7e0['error']['message']);return _0x367f74(_0x9bc7e0[_0x9ea5('0x13')][_0x9ea5('0x16')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x43c27c,_0x9bc7e0[_0x9ea5('0x13')][_0x9ea5('0x16')]);return _0x2d112f(_0x9bc7e0[_0x9ea5('0x13')][_0x9ea5('0x16')]);}else{logger[_0x9ea5('0xe')](_0x9ea5('0x15'),_0x43c27c,'request\x20sent');_0x2d112f(_0x9bc7e0[_0x9ea5('0x17')][_0x9ea5('0x16')]);}})[_0x9ea5('0x18')](function(_0x4d057c){logger[_0x9ea5('0x13')]('DeskAccount,\x20%s,\x20%s',_0x43c27c,_0x4d057c);_0x367f74(_0x4d057c);});});}exports[_0x9ea5('0x19')]=function(_0x59d9c0){var _0x5b3456=this;return new Promise(function(_0x23328a,_0x3128ed){return db[_0x9ea5('0x1a')][_0x9ea5('0x1b')]({'raw':_0x59d9c0[_0x9ea5('0x1c')]?_0x59d9c0['options'][_0x9ea5('0x1d')]===undefined?!![]:![]:!![],'where':_0x59d9c0[_0x9ea5('0x1c')]?_0x59d9c0[_0x9ea5('0x1c')][_0x9ea5('0x1e')]||null:null,'attributes':_0x59d9c0[_0x9ea5('0x1c')]?_0x59d9c0['options'][_0x9ea5('0x1f')]||null:null,'limit':_0x59d9c0[_0x9ea5('0x1c')]?_0x59d9c0[_0x9ea5('0x1c')]['limit']||null:null,'include':_0x59d9c0[_0x9ea5('0x1c')]?_0x59d9c0['options'][_0x9ea5('0x20')]?_['map'](_0x59d9c0[_0x9ea5('0x1c')][_0x9ea5('0x20')],function(_0x1d716f){return{'model':db[_0x1d716f[_0x9ea5('0x21')]],'as':_0x1d716f['as'],'attributes':_0x1d716f[_0x9ea5('0x1f')],'include':_0x1d716f[_0x9ea5('0x20')]?_[_0x9ea5('0x22')](_0x1d716f[_0x9ea5('0x20')],function(_0x1243d4){return{'model':db[_0x1243d4[_0x9ea5('0x21')]],'as':_0x1243d4['as'],'attributes':_0x1243d4[_0x9ea5('0x1f')],'include':_0x1243d4[_0x9ea5('0x20')]?_[_0x9ea5('0x22')](_0x1243d4['include'],function(_0x2a785f){return{'model':db[_0x2a785f[_0x9ea5('0x21')]],'as':_0x2a785f['as'],'attributes':_0x2a785f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ea5('0xd')](function(_0x49884f){logger['info'](_0x9ea5('0x19'),_0x59d9c0);logger[_0x9ea5('0x10')]('GetDeskAccount',_0x59d9c0,JSON['stringify'](_0x49884f));_0x23328a(_0x49884f);})[_0x9ea5('0x18')](function(_0x4b0421){logger[_0x9ea5('0x13')](_0x9ea5('0x19'),_0x4b0421[_0x9ea5('0x16')],_0x59d9c0);_0x3128ed(_0x5b3456[_0x9ea5('0x13')](0x1f4,_0x4b0421[_0x9ea5('0x16')]));});});};exports['ShowDeskAccount']=function(_0x171bcb){var _0xe7b762=this;return new Promise(function(_0x4fc7c9,_0x5bea08){return db['DeskAccount'][_0x9ea5('0x23')]({'raw':_0x171bcb[_0x9ea5('0x1c')]?_0x171bcb[_0x9ea5('0x1c')][_0x9ea5('0x1d')]===undefined?!![]:![]:!![],'where':_0x171bcb['options']?_0x171bcb[_0x9ea5('0x1c')][_0x9ea5('0x1e')]||null:null,'attributes':_0x171bcb[_0x9ea5('0x1c')]?_0x171bcb['options'][_0x9ea5('0x1f')]||null:null,'include':_0x171bcb['options']?_0x171bcb['options'][_0x9ea5('0x20')]?_[_0x9ea5('0x22')](_0x171bcb[_0x9ea5('0x1c')][_0x9ea5('0x20')],function(_0x2a3c58){return{'model':db[_0x2a3c58[_0x9ea5('0x21')]],'as':_0x2a3c58['as'],'attributes':_0x2a3c58['attributes'],'include':_0x2a3c58[_0x9ea5('0x20')]?_[_0x9ea5('0x22')](_0x2a3c58[_0x9ea5('0x20')],function(_0x233f98){return{'model':db[_0x233f98[_0x9ea5('0x21')]],'as':_0x233f98['as'],'attributes':_0x233f98[_0x9ea5('0x1f')],'include':_0x233f98[_0x9ea5('0x20')]?_[_0x9ea5('0x22')](_0x233f98[_0x9ea5('0x20')],function(_0x3531bf){return{'model':db[_0x3531bf[_0x9ea5('0x21')]],'as':_0x3531bf['as'],'attributes':_0x3531bf[_0x9ea5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9ea5('0xd')](function(_0x56ccd1){logger['info'](_0x9ea5('0x24'),_0x171bcb);logger[_0x9ea5('0x10')](_0x9ea5('0x24'),_0x171bcb,JSON['stringify'](_0x56ccd1));_0x4fc7c9(_0x56ccd1);})[_0x9ea5('0x18')](function(_0x1e0d02){logger[_0x9ea5('0x13')](_0x9ea5('0x24'),_0x1e0d02['message'],_0x171bcb);_0x5bea08(_0xe7b762[_0x9ea5('0x13')](0x1f4,_0x1e0d02[_0x9ea5('0x16')]));});});}; \ No newline at end of file +var _0x4e1f=['model','then','GetDeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','DeskAccount','options','where','attributes','limit','include','map'];(function(_0xdc05aa,_0x340c2a){var _0x349bef=function(_0xc13e9b){while(--_0xc13e9b){_0xdc05aa['push'](_0xdc05aa['shift']());}};_0x349bef(++_0x340c2a);}(_0x4e1f,0x150));var _0xf4e1=function(_0xc93400,_0x43c791){_0xc93400=_0xc93400-0x0;var _0x22021b=_0x4e1f[_0xc93400];return _0x22021b;};'use strict';var _=require(_0xf4e1('0x0'));var util=require(_0xf4e1('0x1'));var moment=require(_0xf4e1('0x2'));var BPromise=require(_0xf4e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4e1('0x4'))['db'];var utils=require(_0xf4e1('0x5'));var logger=require(_0xf4e1('0x6'))(_0xf4e1('0x7'));var config=require(_0xf4e1('0x8'));var jayson=require(_0xf4e1('0x9'));var client=jayson['client'][_0xf4e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40a5db,_0x8d1202,_0x49e485){return new BPromise(function(_0x27e0a8,_0x44d4c7){return client['request'](_0x40a5db,_0x49e485)['then'](function(_0x354ed4){logger[_0xf4e1('0xb')]('DeskAccount,\x20%s,\x20%s',_0x8d1202,_0xf4e1('0xc'));logger[_0xf4e1('0xd')](_0xf4e1('0xe'),_0x8d1202,_0xf4e1('0xc'),JSON[_0xf4e1('0xf')](_0x354ed4));if(_0x354ed4[_0xf4e1('0x10')]){if(_0x354ed4[_0xf4e1('0x10')][_0xf4e1('0x11')]===0x1f4){logger[_0xf4e1('0x10')]('DeskAccount,\x20%s,\x20%s',_0x8d1202,_0x354ed4['error'][_0xf4e1('0x12')]);return _0x44d4c7(_0x354ed4[_0xf4e1('0x10')][_0xf4e1('0x12')]);}logger[_0xf4e1('0x10')]('DeskAccount,\x20%s,\x20%s',_0x8d1202,_0x354ed4[_0xf4e1('0x10')][_0xf4e1('0x12')]);return _0x27e0a8(_0x354ed4[_0xf4e1('0x10')]['message']);}else{logger[_0xf4e1('0xb')](_0xf4e1('0x13'),_0x8d1202,_0xf4e1('0xc'));_0x27e0a8(_0x354ed4['result'][_0xf4e1('0x12')]);}})['catch'](function(_0x13a5c5){logger[_0xf4e1('0x10')]('DeskAccount,\x20%s,\x20%s',_0x8d1202,_0x13a5c5);_0x44d4c7(_0x13a5c5);});});}exports['GetDeskAccount']=function(_0x605fd4){var _0x29a2e1=this;return new Promise(function(_0x2aaf72,_0x45f7d2){return db[_0xf4e1('0x14')]['findAll']({'raw':_0x605fd4[_0xf4e1('0x15')]?_0x605fd4[_0xf4e1('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x605fd4[_0xf4e1('0x15')]?_0x605fd4[_0xf4e1('0x15')][_0xf4e1('0x16')]||null:null,'attributes':_0x605fd4['options']?_0x605fd4[_0xf4e1('0x15')][_0xf4e1('0x17')]||null:null,'limit':_0x605fd4[_0xf4e1('0x15')]?_0x605fd4['options'][_0xf4e1('0x18')]||null:null,'include':_0x605fd4[_0xf4e1('0x15')]?_0x605fd4[_0xf4e1('0x15')][_0xf4e1('0x19')]?_[_0xf4e1('0x1a')](_0x605fd4['options'][_0xf4e1('0x19')],function(_0x2e271a){return{'model':db[_0x2e271a[_0xf4e1('0x1b')]],'as':_0x2e271a['as'],'attributes':_0x2e271a[_0xf4e1('0x17')],'include':_0x2e271a[_0xf4e1('0x19')]?_[_0xf4e1('0x1a')](_0x2e271a[_0xf4e1('0x19')],function(_0xecf3da){return{'model':db[_0xecf3da['model']],'as':_0xecf3da['as'],'attributes':_0xecf3da['attributes'],'include':_0xecf3da['include']?_[_0xf4e1('0x1a')](_0xecf3da[_0xf4e1('0x19')],function(_0xbf4d3e){return{'model':db[_0xbf4d3e[_0xf4e1('0x1b')]],'as':_0xbf4d3e['as'],'attributes':_0xbf4d3e[_0xf4e1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf4e1('0x1c')](function(_0x28cd15){logger[_0xf4e1('0xb')](_0xf4e1('0x1d'),_0x605fd4);logger[_0xf4e1('0xd')](_0xf4e1('0x1d'),_0x605fd4,JSON[_0xf4e1('0xf')](_0x28cd15));_0x2aaf72(_0x28cd15);})['catch'](function(_0x10300c){logger[_0xf4e1('0x10')](_0xf4e1('0x1d'),_0x10300c[_0xf4e1('0x12')],_0x605fd4);_0x45f7d2(_0x29a2e1[_0xf4e1('0x10')](0x1f4,_0x10300c[_0xf4e1('0x12')]));});});};exports['ShowDeskAccount']=function(_0x16b271){var _0x1f8952=this;return new Promise(function(_0x4611b4,_0x4ca892){return db['DeskAccount'][_0xf4e1('0x1e')]({'raw':_0x16b271[_0xf4e1('0x15')]?_0x16b271['options'][_0xf4e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x16b271[_0xf4e1('0x15')]?_0x16b271[_0xf4e1('0x15')][_0xf4e1('0x16')]||null:null,'attributes':_0x16b271[_0xf4e1('0x15')]?_0x16b271[_0xf4e1('0x15')][_0xf4e1('0x17')]||null:null,'include':_0x16b271[_0xf4e1('0x15')]?_0x16b271[_0xf4e1('0x15')][_0xf4e1('0x19')]?_['map'](_0x16b271['options'][_0xf4e1('0x19')],function(_0x38329d){return{'model':db[_0x38329d['model']],'as':_0x38329d['as'],'attributes':_0x38329d[_0xf4e1('0x17')],'include':_0x38329d[_0xf4e1('0x19')]?_[_0xf4e1('0x1a')](_0x38329d['include'],function(_0x4b4422){return{'model':db[_0x4b4422[_0xf4e1('0x1b')]],'as':_0x4b4422['as'],'attributes':_0x4b4422[_0xf4e1('0x17')],'include':_0x4b4422[_0xf4e1('0x19')]?_[_0xf4e1('0x1a')](_0x4b4422[_0xf4e1('0x19')],function(_0x4c13dd){return{'model':db[_0x4c13dd[_0xf4e1('0x1b')]],'as':_0x4c13dd['as'],'attributes':_0x4c13dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4e1('0x1c')](function(_0xef202){logger['info']('ShowDeskAccount',_0x16b271);logger['debug']('ShowDeskAccount',_0x16b271,JSON[_0xf4e1('0xf')](_0xef202));_0x4611b4(_0xef202);})['catch'](function(_0x34f611){logger['error'](_0xf4e1('0x20'),_0x34f611[_0xf4e1('0x12')],_0x16b271);_0x4ca892(_0x1f8952['error'](0x1f4,_0x34f611[_0xf4e1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c3c4e75..bdadead 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x486d86,_0x5409de){var _0x20d752=function(_0x1a1fd1){while(--_0x1a1fd1){_0x486d86['push'](_0x486d86['shift']());}};_0x20d752(++_0x5409de);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xac0552,_0x155c7d){var _0x192564=function(_0x1a2e64){while(--_0x1a2e64){_0xac0552['push'](_0xac0552['shift']());}};_0x192564(++_0x155c7d);}(_0x34e8,0x12c));var _0x834e=function(_0x98bce1,_0x4a9962){_0x98bce1=_0x98bce1-0x0;var _0x2a0852=_0x34e8[_0x98bce1];return _0x2a0852;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 0fb538e..e6bb7e0 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 _0x1dc8=['sequelize','exports','STRING'];(function(_0x442313,_0x3c1417){var _0xd506a4=function(_0x6d24f1){while(--_0x6d24f1){_0x442313['push'](_0x442313['shift']());}};_0xd506a4(++_0x3c1417);}(_0x1dc8,0x114));var _0x81dc=function(_0x3d3469,_0x31e3ee){_0x3d3469=_0x3d3469-0x0;var _0x26b5af=_0x1dc8[_0x3d3469];return _0x26b5af;};'use strict';var Sequelize=require(_0x81dc('0x0'));module[_0x81dc('0x1')]={'name':{'type':Sequelize[_0x81dc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x97c0=['STRING','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x97c0,0x1a2));var _0x097c=function(_0x50d567,_0x515625){_0x50d567=_0x50d567-0x0;var _0x2beb7f=_0x97c0[_0x50d567];return _0x2beb7f;};'use strict';var Sequelize=require(_0x097c('0x0'));module[_0x097c('0x1')]={'name':{'type':Sequelize[_0x097c('0x2')]},'description':{'type':Sequelize[_0x097c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 40a3cfd..57d6698 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 _0x2a84=['util','path','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','undefined','count','limit','status','Content-Range','json','reject','save','update','then','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','merge','options','create','body','find','destroy','getFields','findOne','DeskField','length','nolimit','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a84,0x18c));var _0x42a8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2a84[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x42a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42a8('0x1'));var jsonpatch=require(_0x42a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x42a8('0x3'));var Mustache=require('mustache');var util=require(_0x42a8('0x4'));var path=require(_0x42a8('0x5'));var sox=require('sox');var csv=require(_0x42a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42a8('0x7'));var _=require(_0x42a8('0x8'));var squel=require(_0x42a8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42a8('0x6'));var querystring=require(_0x42a8('0xa'));var Papa=require(_0x42a8('0xb'));var Redis=require(_0x42a8('0xc'));var authService=require(_0x42a8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x42a8('0xe'));var hardwareService=require(_0x42a8('0xf'));var logger=require(_0x42a8('0x10'))(_0x42a8('0x11'));var utils=require(_0x42a8('0x12'));var config=require(_0x42a8('0x13'));var licenseUtil=require(_0x42a8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548646,_0x6eff79){_0x6eff79=_0x6eff79||0xcc;return function(_0x5c8fc5){if(_0x5c8fc5){return _0x548646[_0x42a8('0x15')](_0x6eff79);}return _0x548646['status'](_0x6eff79)['end']();};}function respondWithResult(_0x1204e7,_0x2f7509){_0x2f7509=_0x2f7509||0xc8;return function(_0x46cb78){if(_0x46cb78){return _0x1204e7['status'](_0x2f7509)['json'](_0x46cb78);}};}function respondWithFilteredResult(_0x193bb5,_0x165fea){return function(_0x376c0a){if(_0x376c0a){var _0x296830=typeof _0x165fea[_0x42a8('0x16')]==='undefined'&&typeof _0x165fea['limit']===_0x42a8('0x17');var _0x53e266=_0x376c0a[_0x42a8('0x18')];var _0x20bf27=_0x296830?0x0:_0x165fea[_0x42a8('0x16')];var _0x465bd6=_0x296830?_0x376c0a[_0x42a8('0x18')]:_0x165fea[_0x42a8('0x16')]+_0x165fea[_0x42a8('0x19')];var _0x3bfcf5;if(_0x465bd6>=_0x53e266){_0x465bd6=_0x53e266;_0x3bfcf5=0xc8;}else{_0x3bfcf5=0xce;}_0x193bb5[_0x42a8('0x1a')](_0x3bfcf5);return _0x193bb5['set'](_0x42a8('0x1b'),_0x20bf27+'-'+_0x465bd6+'/'+_0x53e266)[_0x42a8('0x1c')](_0x376c0a);}return null;};}function patchUpdates(_0x296443){return function(_0x5dbcc3){try{jsonpatch['apply'](_0x5dbcc3,_0x296443,!![]);}catch(_0x535cff){return BPromise[_0x42a8('0x1d')](_0x535cff);}return _0x5dbcc3[_0x42a8('0x1e')]();};}function saveUpdates(_0x38671f,_0x439a68){return function(_0x73c068){if(_0x73c068){return _0x73c068[_0x42a8('0x1f')](_0x38671f)[_0x42a8('0x20')](function(_0x5d8e1b){return _0x5d8e1b;});}return null;};}function removeEntity(_0x305bd6,_0x4b0fde){return function(_0x59e9ed){if(_0x59e9ed){return _0x59e9ed['destroy']()[_0x42a8('0x20')](function(){_0x305bd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a6fe,_0x3cb79d){return function(_0x5cc835){if(!_0x5cc835){_0x28a6fe['sendStatus'](0x194);}return _0x5cc835;};}function handleError(_0x256d16,_0x5d8527){_0x5d8527=_0x5d8527||0x1f4;return function(_0x3835a9){logger['error'](_0x3835a9[_0x42a8('0x21')]);if(_0x3835a9[_0x42a8('0x22')]){delete _0x3835a9[_0x42a8('0x22')];}_0x256d16[_0x42a8('0x1a')](_0x5d8527)[_0x42a8('0x23')](_0x3835a9);};}exports[_0x42a8('0x24')]=function(_0xa5be7b,_0x57ffba){var _0x3e3cc2={},_0x351a9e={},_0x10e39f={'count':0x0,'rows':[]};var _0x3e38f2=_[_0x42a8('0x25')](db[_0x42a8('0x26')][_0x42a8('0x27')],function(_0x5006bb){return{'name':_0x5006bb[_0x42a8('0x28')],'type':_0x5006bb['type']['key']};});_0x351a9e[_0x42a8('0x29')]=_['map'](_0x3e38f2,_0x42a8('0x22'));_0x351a9e[_0x42a8('0x2a')]=_[_0x42a8('0x2b')](_0xa5be7b[_0x42a8('0x2a')]);_0x351a9e['filters']=_[_0x42a8('0x2c')](_0x351a9e[_0x42a8('0x29')],_0x351a9e[_0x42a8('0x2a')]);_0x3e3cc2[_0x42a8('0x2d')]=_[_0x42a8('0x2c')](_0x351a9e[_0x42a8('0x29')],qs[_0x42a8('0x2e')](_0xa5be7b[_0x42a8('0x2a')]['fields']));_0x3e3cc2[_0x42a8('0x2d')]=_0x3e3cc2[_0x42a8('0x2d')]['length']?_0x3e3cc2[_0x42a8('0x2d')]:_0x351a9e[_0x42a8('0x29')];if(!_0xa5be7b[_0x42a8('0x2a')][_0x42a8('0x2f')]('nolimit')){_0x3e3cc2[_0x42a8('0x19')]=qs[_0x42a8('0x19')](_0xa5be7b['query']['limit']);_0x3e3cc2[_0x42a8('0x16')]=qs[_0x42a8('0x16')](_0xa5be7b[_0x42a8('0x2a')][_0x42a8('0x16')]);}_0x3e3cc2['order']=qs[_0x42a8('0x30')](_0xa5be7b[_0x42a8('0x2a')]['sort']);_0x3e3cc2[_0x42a8('0x31')]=qs['filters'](_[_0x42a8('0x32')](_0xa5be7b[_0x42a8('0x2a')],_0x351a9e[_0x42a8('0x33')]),_0x3e38f2);if(_0xa5be7b['query']['filter']){_0x3e3cc2[_0x42a8('0x31')]=_['merge'](_0x3e3cc2['where'],{'$or':_['map'](_0x3e38f2,function(_0x35b57e){if(_0x35b57e[_0x42a8('0x34')]!==_0x42a8('0x35')){var _0x1f9f8a={};_0x1f9f8a[_0x35b57e[_0x42a8('0x22')]]={'$like':'%'+_0xa5be7b[_0x42a8('0x2a')][_0x42a8('0x36')]+'%'};return _0x1f9f8a;}})});}_0x3e3cc2=_['merge']({},_0x3e3cc2,_0xa5be7b['options']);var _0x136d16={'where':_0x3e3cc2[_0x42a8('0x31')]};return db[_0x42a8('0x26')]['count'](_0x136d16)[_0x42a8('0x20')](function(_0x8e8c1d){_0x10e39f['count']=_0x8e8c1d;if(_0xa5be7b[_0x42a8('0x2a')][_0x42a8('0x37')]){_0x3e3cc2[_0x42a8('0x38')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x42a8('0x39')](_0x3e3cc2);})[_0x42a8('0x20')](function(_0x409455){_0x10e39f[_0x42a8('0x3a')]=_0x409455;return _0x10e39f;})[_0x42a8('0x20')](respondWithFilteredResult(_0x57ffba,_0x3e3cc2))[_0x42a8('0x3b')](handleError(_0x57ffba,null));};exports[_0x42a8('0x3c')]=function(_0x46940f,_0x1a87ff){var _0x26e052={'raw':![],'where':{'id':_0x46940f[_0x42a8('0x3d')]['id']}},_0x4ca9c4={};_0x4ca9c4[_0x42a8('0x29')]=_[_0x42a8('0x2b')](db[_0x42a8('0x26')]['rawAttributes']);_0x4ca9c4[_0x42a8('0x2a')]=_[_0x42a8('0x2b')](_0x46940f['query']);_0x4ca9c4['filters']=_[_0x42a8('0x2c')](_0x4ca9c4[_0x42a8('0x29')],_0x4ca9c4[_0x42a8('0x2a')]);_0x26e052['attributes']=_['intersection'](_0x4ca9c4['model'],qs[_0x42a8('0x2e')](_0x46940f['query']['fields']));_0x26e052[_0x42a8('0x2d')]=_0x26e052[_0x42a8('0x2d')]['length']?_0x26e052[_0x42a8('0x2d')]:_0x4ca9c4[_0x42a8('0x29')];if(_0x46940f[_0x42a8('0x2a')]['includeAll']){_0x26e052['include']=[{'all':!![]}];}_0x26e052=_[_0x42a8('0x3e')]({},_0x26e052,_0x46940f[_0x42a8('0x3f')]);return db[_0x42a8('0x26')]['find'](_0x26e052)[_0x42a8('0x20')](handleEntityNotFound(_0x1a87ff,null))['then'](respondWithResult(_0x1a87ff,null))[_0x42a8('0x3b')](handleError(_0x1a87ff,null));};exports['create']=function(_0xc93cdd,_0x54f718){return db[_0x42a8('0x26')][_0x42a8('0x40')](_0xc93cdd[_0x42a8('0x41')],{})[_0x42a8('0x20')](respondWithResult(_0x54f718,0xc9))[_0x42a8('0x3b')](handleError(_0x54f718,null));};exports[_0x42a8('0x1f')]=function(_0x23c955,_0xcb4e0b){if(_0x23c955[_0x42a8('0x41')]['id']){delete _0x23c955['body']['id'];}return db[_0x42a8('0x26')][_0x42a8('0x42')]({'where':{'id':_0x23c955[_0x42a8('0x3d')]['id']}})[_0x42a8('0x20')](handleEntityNotFound(_0xcb4e0b,null))[_0x42a8('0x20')](saveUpdates(_0x23c955[_0x42a8('0x41')],null))[_0x42a8('0x20')](respondWithResult(_0xcb4e0b,null))['catch'](handleError(_0xcb4e0b,null));};exports[_0x42a8('0x43')]=function(_0x29d093,_0x50a205){return db[_0x42a8('0x26')][_0x42a8('0x42')]({'where':{'id':_0x29d093[_0x42a8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x50a205,null))[_0x42a8('0x20')](removeEntity(_0x50a205,null))[_0x42a8('0x3b')](handleError(_0x50a205,null));};exports[_0x42a8('0x44')]=function(_0x24fab1,_0xc37e82,_0x5c0c7d){var _0x3de306={};var _0x29048c={};var _0x5712b0;var _0x52f556;return db[_0x42a8('0x26')][_0x42a8('0x45')]({'where':{'id':_0x24fab1['params']['id']}})[_0x42a8('0x20')](handleEntityNotFound(_0xc37e82,null))[_0x42a8('0x20')](function(_0x22113f){if(_0x22113f){_0x5712b0=_0x22113f;_0x29048c[_0x42a8('0x29')]=_[_0x42a8('0x2b')](db[_0x42a8('0x46')][_0x42a8('0x27')]);_0x29048c[_0x42a8('0x2a')]=_[_0x42a8('0x2b')](_0x24fab1[_0x42a8('0x2a')]);_0x29048c[_0x42a8('0x33')]=_[_0x42a8('0x2c')](_0x29048c[_0x42a8('0x29')],_0x29048c[_0x42a8('0x2a')]);_0x3de306[_0x42a8('0x2d')]=_[_0x42a8('0x2c')](_0x29048c[_0x42a8('0x29')],qs[_0x42a8('0x2e')](_0x24fab1[_0x42a8('0x2a')]['fields']));_0x3de306['attributes']=_0x3de306[_0x42a8('0x2d')][_0x42a8('0x47')]?_0x3de306[_0x42a8('0x2d')]:_0x29048c['model'];_0x3de306['order']=qs[_0x42a8('0x30')](_0x24fab1[_0x42a8('0x2a')][_0x42a8('0x30')]);_0x3de306[_0x42a8('0x31')]=qs[_0x42a8('0x33')](_[_0x42a8('0x32')](_0x24fab1[_0x42a8('0x2a')],_0x29048c['filters']));if(_0x24fab1[_0x42a8('0x2a')][_0x42a8('0x36')]){_0x3de306[_0x42a8('0x31')]=_['merge'](_0x3de306[_0x42a8('0x31')],{'$or':_[_0x42a8('0x25')](_0x3de306[_0x42a8('0x2d')],function(_0x3f58ef){var _0x411553={};_0x411553[_0x3f58ef]={'$like':'%'+_0x24fab1[_0x42a8('0x2a')][_0x42a8('0x36')]+'%'};return _0x411553;})});}_0x3de306=_[_0x42a8('0x3e')]({},_0x3de306,_0x24fab1['options']);return _0x5712b0['getFields'](_0x3de306);}})[_0x42a8('0x20')](function(_0x47c32b){if(_0x47c32b){_0x52f556=_0x47c32b[_0x42a8('0x47')];if(!_0x24fab1[_0x42a8('0x2a')][_0x42a8('0x2f')](_0x42a8('0x48'))){_0x3de306[_0x42a8('0x19')]=qs['limit'](_0x24fab1[_0x42a8('0x2a')][_0x42a8('0x19')]);_0x3de306[_0x42a8('0x16')]=qs[_0x42a8('0x16')](_0x24fab1[_0x42a8('0x2a')][_0x42a8('0x16')]);}return _0x5712b0[_0x42a8('0x44')](_0x3de306);}})[_0x42a8('0x20')](function(_0x3c1574){if(_0x3c1574){return _0x3c1574?{'count':_0x52f556,'rows':_0x3c1574}:null;}})[_0x42a8('0x20')](respondWithResult(_0xc37e82,null))[_0x42a8('0x3b')](handleError(_0xc37e82,null));};exports[_0x42a8('0x49')]=function(_0x1f3193,_0x201943,_0x17e54f){var _0xcdbcb1={};var _0x3f1ccb={};var _0x32c152;var _0x510c0e;return db[_0x42a8('0x26')][_0x42a8('0x45')]({'where':{'id':_0x1f3193['params']['id']}})[_0x42a8('0x20')](handleEntityNotFound(_0x201943,null))[_0x42a8('0x20')](function(_0x3e6467){if(_0x3e6467){_0x32c152=_0x3e6467;_0x3f1ccb[_0x42a8('0x29')]=_['keys'](db[_0x42a8('0x46')][_0x42a8('0x27')]);_0x3f1ccb[_0x42a8('0x2a')]=_[_0x42a8('0x2b')](_0x1f3193[_0x42a8('0x2a')]);_0x3f1ccb['filters']=_[_0x42a8('0x2c')](_0x3f1ccb['model'],_0x3f1ccb[_0x42a8('0x2a')]);_0xcdbcb1['attributes']=_[_0x42a8('0x2c')](_0x3f1ccb[_0x42a8('0x29')],qs[_0x42a8('0x2e')](_0x1f3193['query'][_0x42a8('0x2e')]));_0xcdbcb1[_0x42a8('0x2d')]=_0xcdbcb1[_0x42a8('0x2d')][_0x42a8('0x47')]?_0xcdbcb1[_0x42a8('0x2d')]:_0x3f1ccb['model'];_0xcdbcb1[_0x42a8('0x4a')]=qs[_0x42a8('0x30')](_0x1f3193[_0x42a8('0x2a')][_0x42a8('0x30')]);_0xcdbcb1[_0x42a8('0x31')]=qs['filters'](_['pick'](_0x1f3193[_0x42a8('0x2a')],_0x3f1ccb['filters']));if(_0x1f3193[_0x42a8('0x2a')][_0x42a8('0x36')]){_0xcdbcb1[_0x42a8('0x31')]=_[_0x42a8('0x3e')](_0xcdbcb1[_0x42a8('0x31')],{'$or':_['map'](_0xcdbcb1[_0x42a8('0x2d')],function(_0x2d874f){var _0x55faa8={};_0x55faa8[_0x2d874f]={'$like':'%'+_0x1f3193[_0x42a8('0x2a')]['filter']+'%'};return _0x55faa8;})});}_0xcdbcb1=_[_0x42a8('0x3e')]({},_0xcdbcb1,_0x1f3193['options']);return _0x32c152[_0x42a8('0x49')](_0xcdbcb1);}})[_0x42a8('0x20')](function(_0x252875){if(_0x252875){_0x510c0e=_0x252875[_0x42a8('0x47')];if(!_0x1f3193[_0x42a8('0x2a')][_0x42a8('0x2f')](_0x42a8('0x48'))){_0xcdbcb1[_0x42a8('0x19')]=qs['limit'](_0x1f3193[_0x42a8('0x2a')][_0x42a8('0x19')]);_0xcdbcb1[_0x42a8('0x16')]=qs[_0x42a8('0x16')](_0x1f3193['query'][_0x42a8('0x16')]);}return _0x32c152[_0x42a8('0x49')](_0xcdbcb1);}})[_0x42a8('0x20')](function(_0x394ecc){if(_0x394ecc){return _0x394ecc?{'count':_0x510c0e,'rows':_0x394ecc}:null;}})[_0x42a8('0x20')](respondWithResult(_0x201943,null))[_0x42a8('0x3b')](handleError(_0x201943,null));};exports[_0x42a8('0x4b')]=function(_0x97dfc8,_0x2b9c18,_0x4f790d){var _0x2b5e7c={};var _0x32532c={};var _0x5242dc;var _0x476b27;return db[_0x42a8('0x26')][_0x42a8('0x45')]({'where':{'id':_0x97dfc8[_0x42a8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2b9c18,null))[_0x42a8('0x20')](function(_0x4f3eb5){if(_0x4f3eb5){_0x5242dc=_0x4f3eb5;_0x32532c['model']=_['keys'](db[_0x42a8('0x46')]['rawAttributes']);_0x32532c[_0x42a8('0x2a')]=_[_0x42a8('0x2b')](_0x97dfc8['query']);_0x32532c[_0x42a8('0x33')]=_[_0x42a8('0x2c')](_0x32532c[_0x42a8('0x29')],_0x32532c[_0x42a8('0x2a')]);_0x2b5e7c[_0x42a8('0x2d')]=_[_0x42a8('0x2c')](_0x32532c['model'],qs['fields'](_0x97dfc8['query'][_0x42a8('0x2e')]));_0x2b5e7c['attributes']=_0x2b5e7c[_0x42a8('0x2d')][_0x42a8('0x47')]?_0x2b5e7c[_0x42a8('0x2d')]:_0x32532c[_0x42a8('0x29')];_0x2b5e7c[_0x42a8('0x4a')]=qs['sort'](_0x97dfc8[_0x42a8('0x2a')]['sort']);_0x2b5e7c[_0x42a8('0x31')]=qs['filters'](_[_0x42a8('0x32')](_0x97dfc8['query'],_0x32532c[_0x42a8('0x33')]));if(_0x97dfc8[_0x42a8('0x2a')][_0x42a8('0x36')]){_0x2b5e7c[_0x42a8('0x31')]=_[_0x42a8('0x3e')](_0x2b5e7c[_0x42a8('0x31')],{'$or':_['map'](_0x2b5e7c[_0x42a8('0x2d')],function(_0x1c4013){var _0x13a54b={};_0x13a54b[_0x1c4013]={'$like':'%'+_0x97dfc8['query'][_0x42a8('0x36')]+'%'};return _0x13a54b;})});}_0x2b5e7c=_[_0x42a8('0x3e')]({},_0x2b5e7c,_0x97dfc8[_0x42a8('0x3f')]);return _0x5242dc['getDescriptions'](_0x2b5e7c);}})[_0x42a8('0x20')](function(_0x4c5c38){if(_0x4c5c38){_0x476b27=_0x4c5c38[_0x42a8('0x47')];if(!_0x97dfc8[_0x42a8('0x2a')]['hasOwnProperty']('nolimit')){_0x2b5e7c[_0x42a8('0x19')]=qs[_0x42a8('0x19')](_0x97dfc8['query'][_0x42a8('0x19')]);_0x2b5e7c[_0x42a8('0x16')]=qs[_0x42a8('0x16')](_0x97dfc8[_0x42a8('0x2a')][_0x42a8('0x16')]);}return _0x5242dc[_0x42a8('0x4b')](_0x2b5e7c);}})['then'](function(_0x398615){if(_0x398615){return _0x398615?{'count':_0x476b27,'rows':_0x398615}:null;}})['then'](respondWithResult(_0x2b9c18,null))['catch'](handleError(_0x2b9c18,null));};exports[_0x42a8('0x4c')]=function(_0x73494d,_0x433b79,_0x271028){var _0xdd7c5a={};var _0x5401b1={};var _0x1da7dd;var _0x1f4e07;return db[_0x42a8('0x26')][_0x42a8('0x45')]({'where':{'id':_0x73494d[_0x42a8('0x3d')]['id']}})[_0x42a8('0x20')](handleEntityNotFound(_0x433b79,null))[_0x42a8('0x20')](function(_0x3cfdf5){if(_0x3cfdf5){_0x1da7dd=_0x3cfdf5;_0x5401b1[_0x42a8('0x29')]=_[_0x42a8('0x2b')](db[_0x42a8('0x4d')][_0x42a8('0x27')]);_0x5401b1[_0x42a8('0x2a')]=_['keys'](_0x73494d[_0x42a8('0x2a')]);_0x5401b1[_0x42a8('0x33')]=_[_0x42a8('0x2c')](_0x5401b1[_0x42a8('0x29')],_0x5401b1[_0x42a8('0x2a')]);_0xdd7c5a[_0x42a8('0x2d')]=_[_0x42a8('0x2c')](_0x5401b1['model'],qs[_0x42a8('0x2e')](_0x73494d[_0x42a8('0x2a')]['fields']));_0xdd7c5a['attributes']=_0xdd7c5a['attributes'][_0x42a8('0x47')]?_0xdd7c5a[_0x42a8('0x2d')]:_0x5401b1[_0x42a8('0x29')];_0xdd7c5a[_0x42a8('0x4a')]=qs[_0x42a8('0x30')](_0x73494d[_0x42a8('0x2a')]['sort']);_0xdd7c5a[_0x42a8('0x31')]=qs['filters'](_[_0x42a8('0x32')](_0x73494d[_0x42a8('0x2a')],_0x5401b1[_0x42a8('0x33')]));if(_0x73494d[_0x42a8('0x2a')][_0x42a8('0x36')]){_0xdd7c5a[_0x42a8('0x31')]=_[_0x42a8('0x3e')](_0xdd7c5a[_0x42a8('0x31')],{'$or':_[_0x42a8('0x25')](_0xdd7c5a[_0x42a8('0x2d')],function(_0x5d690e){var _0x4f203e={};_0x4f203e[_0x5d690e]={'$like':'%'+_0x73494d['query'][_0x42a8('0x36')]+'%'};return _0x4f203e;})});}_0xdd7c5a=_[_0x42a8('0x3e')]({},_0xdd7c5a,_0x73494d['options']);return _0x1da7dd[_0x42a8('0x4c')](_0xdd7c5a);}})[_0x42a8('0x20')](function(_0x2fdc84){if(_0x2fdc84){_0x1f4e07=_0x2fdc84[_0x42a8('0x47')];if(!_0x73494d[_0x42a8('0x2a')][_0x42a8('0x2f')](_0x42a8('0x48'))){_0xdd7c5a[_0x42a8('0x19')]=qs[_0x42a8('0x19')](_0x73494d[_0x42a8('0x2a')][_0x42a8('0x19')]);_0xdd7c5a['offset']=qs[_0x42a8('0x16')](_0x73494d[_0x42a8('0x2a')][_0x42a8('0x16')]);}return _0x1da7dd[_0x42a8('0x4c')](_0xdd7c5a);}})[_0x42a8('0x20')](function(_0x4afdb5){if(_0x4afdb5){return _0x4afdb5?{'count':_0x1f4e07,'rows':_0x4afdb5}:null;}})['then'](respondWithResult(_0x433b79,null))[_0x42a8('0x3b')](handleError(_0x433b79,null));};exports['setTags']=function(_0x1b11c3,_0x1f5cb1,_0x508516){if(_0x1b11c3['body']['id']){delete _0x1b11c3['body']['id'];}return db[_0x42a8('0x26')][_0x42a8('0x45')]({'where':{'id':_0x1b11c3['params']['id']}})[_0x42a8('0x20')](handleEntityNotFound(_0x1f5cb1,null))['then'](function(_0x16b9c2){if(_0x16b9c2){return _0x16b9c2[_0x42a8('0x4e')](_0x1b11c3[_0x42a8('0x41')][_0x42a8('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x1f5cb1,null))[_0x42a8('0x3b')](handleError(_0x1f5cb1,null));}; \ No newline at end of file +var _0xc9bc=['filter','merge','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','length','find','create','body','getFields','DeskField','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x27f8d6,_0x75e1e7){var _0xf62f03=function(_0x821d21){while(--_0x821d21){_0x27f8d6['push'](_0x27f8d6['shift']());}};_0xf62f03(++_0x75e1e7);}(_0xc9bc,0xc8));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcc9b('0x0'));var rimraf=require(_0xcc9b('0x1'));var zipdir=require(_0xcc9b('0x2'));var jsonpatch=require(_0xcc9b('0x3'));var rp=require(_0xcc9b('0x4'));var moment=require(_0xcc9b('0x5'));var BPromise=require(_0xcc9b('0x6'));var Mustache=require(_0xcc9b('0x7'));var util=require(_0xcc9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xcc9b('0x9'));var ejs=require(_0xcc9b('0xa'));var fs=require('fs');var fs_extra=require(_0xcc9b('0xb'));var _=require(_0xcc9b('0xc'));var squel=require(_0xcc9b('0xd'));var crypto=require(_0xcc9b('0xe'));var jsforce=require(_0xcc9b('0xf'));var deskjs=require(_0xcc9b('0x10'));var toCsv=require(_0xcc9b('0x9'));var querystring=require(_0xcc9b('0x11'));var Papa=require(_0xcc9b('0x12'));var Redis=require(_0xcc9b('0x13'));var authService=require(_0xcc9b('0x14'));var qs=require(_0xcc9b('0x15'));var as=require(_0xcc9b('0x16'));var hardwareService=require(_0xcc9b('0x17'));var logger=require(_0xcc9b('0x18'))(_0xcc9b('0x19'));var utils=require(_0xcc9b('0x1a'));var config=require(_0xcc9b('0x1b'));var licenseUtil=require(_0xcc9b('0x1c'));var db=require(_0xcc9b('0x1d'))['db'];function respondWithStatusCode(_0x1ef21c,_0x287aa8){_0x287aa8=_0x287aa8||0xcc;return function(_0x1acc92){if(_0x1acc92){return _0x1ef21c['sendStatus'](_0x287aa8);}return _0x1ef21c[_0xcc9b('0x1e')](_0x287aa8)[_0xcc9b('0x1f')]();};}function respondWithResult(_0x3abcb6,_0x153857){_0x153857=_0x153857||0xc8;return function(_0xfb5a41){if(_0xfb5a41){return _0x3abcb6[_0xcc9b('0x1e')](_0x153857)[_0xcc9b('0x20')](_0xfb5a41);}};}function respondWithFilteredResult(_0x43b106,_0x391d07){return function(_0x23ac5e){if(_0x23ac5e){var _0x233d93=typeof _0x391d07['offset']==='undefined'&&typeof _0x391d07[_0xcc9b('0x21')]==='undefined';var _0x473514=_0x23ac5e[_0xcc9b('0x22')];var _0x200c4b=_0x233d93?0x0:_0x391d07[_0xcc9b('0x23')];var _0x3d7d8b=_0x233d93?_0x23ac5e[_0xcc9b('0x22')]:_0x391d07[_0xcc9b('0x23')]+_0x391d07[_0xcc9b('0x21')];var _0x1f37b5;if(_0x3d7d8b>=_0x473514){_0x3d7d8b=_0x473514;_0x1f37b5=0xc8;}else{_0x1f37b5=0xce;}_0x43b106['status'](_0x1f37b5);return _0x43b106[_0xcc9b('0x24')](_0xcc9b('0x25'),_0x200c4b+'-'+_0x3d7d8b+'/'+_0x473514)[_0xcc9b('0x20')](_0x23ac5e);}return null;};}function patchUpdates(_0x56dc0b){return function(_0x1f2327){try{jsonpatch[_0xcc9b('0x26')](_0x1f2327,_0x56dc0b,!![]);}catch(_0x53482f){return BPromise['reject'](_0x53482f);}return _0x1f2327[_0xcc9b('0x27')]();};}function saveUpdates(_0xd7008a,_0x282267){return function(_0x1dc3a6){if(_0x1dc3a6){return _0x1dc3a6[_0xcc9b('0x28')](_0xd7008a)[_0xcc9b('0x29')](function(_0xdad156){return _0xdad156;});}return null;};}function removeEntity(_0x58b18,_0x3021ab){return function(_0x1cb7e0){if(_0x1cb7e0){return _0x1cb7e0['destroy']()[_0xcc9b('0x29')](function(){_0x58b18[_0xcc9b('0x1e')](0xcc)[_0xcc9b('0x1f')]();});}};}function handleEntityNotFound(_0x3cff2f,_0x35d18c){return function(_0x439aa5){if(!_0x439aa5){_0x3cff2f['sendStatus'](0x194);}return _0x439aa5;};}function handleError(_0x222d79,_0x1b116b){_0x1b116b=_0x1b116b||0x1f4;return function(_0xd2ae1f){logger[_0xcc9b('0x2a')](_0xd2ae1f[_0xcc9b('0x2b')]);if(_0xd2ae1f[_0xcc9b('0x2c')]){delete _0xd2ae1f[_0xcc9b('0x2c')];}_0x222d79[_0xcc9b('0x1e')](_0x1b116b)[_0xcc9b('0x2d')](_0xd2ae1f);};}exports[_0xcc9b('0x2e')]=function(_0x325841,_0x3e3d37){var _0x45ec75={},_0x26ff00={},_0x5e9ae5={'count':0x0,'rows':[]};var _0x3dc8aa=_[_0xcc9b('0x2f')](db['DeskConfiguration'][_0xcc9b('0x30')],function(_0x32fd46){return{'name':_0x32fd46[_0xcc9b('0x31')],'type':_0x32fd46[_0xcc9b('0x32')][_0xcc9b('0x33')]};});_0x26ff00['model']=_[_0xcc9b('0x2f')](_0x3dc8aa,_0xcc9b('0x2c'));_0x26ff00[_0xcc9b('0x34')]=_[_0xcc9b('0x35')](_0x325841[_0xcc9b('0x34')]);_0x26ff00[_0xcc9b('0x36')]=_[_0xcc9b('0x37')](_0x26ff00['model'],_0x26ff00['query']);_0x45ec75[_0xcc9b('0x38')]=_[_0xcc9b('0x37')](_0x26ff00[_0xcc9b('0x39')],qs[_0xcc9b('0x3a')](_0x325841[_0xcc9b('0x34')]['fields']));_0x45ec75[_0xcc9b('0x38')]=_0x45ec75[_0xcc9b('0x38')]['length']?_0x45ec75[_0xcc9b('0x38')]:_0x26ff00[_0xcc9b('0x39')];if(!_0x325841[_0xcc9b('0x34')][_0xcc9b('0x3b')]('nolimit')){_0x45ec75[_0xcc9b('0x21')]=qs[_0xcc9b('0x21')](_0x325841['query'][_0xcc9b('0x21')]);_0x45ec75[_0xcc9b('0x23')]=qs[_0xcc9b('0x23')](_0x325841[_0xcc9b('0x34')][_0xcc9b('0x23')]);}_0x45ec75[_0xcc9b('0x3c')]=qs[_0xcc9b('0x3d')](_0x325841[_0xcc9b('0x34')][_0xcc9b('0x3d')]);_0x45ec75[_0xcc9b('0x3e')]=qs[_0xcc9b('0x36')](_[_0xcc9b('0x3f')](_0x325841[_0xcc9b('0x34')],_0x26ff00['filters']),_0x3dc8aa);if(_0x325841[_0xcc9b('0x34')][_0xcc9b('0x40')]){_0x45ec75[_0xcc9b('0x3e')]=_[_0xcc9b('0x41')](_0x45ec75[_0xcc9b('0x3e')],{'$or':_[_0xcc9b('0x2f')](_0x3dc8aa,function(_0x2fba8b){if(_0x2fba8b[_0xcc9b('0x32')]!=='VIRTUAL'){var _0x2e2fea={};_0x2e2fea[_0x2fba8b[_0xcc9b('0x2c')]]={'$like':'%'+_0x325841[_0xcc9b('0x34')][_0xcc9b('0x40')]+'%'};return _0x2e2fea;}})});}_0x45ec75=_[_0xcc9b('0x41')]({},_0x45ec75,_0x325841[_0xcc9b('0x42')]);var _0x4c79fb={'where':_0x45ec75['where']};return db[_0xcc9b('0x43')]['count'](_0x4c79fb)['then'](function(_0x1a28c3){_0x5e9ae5[_0xcc9b('0x22')]=_0x1a28c3;if(_0x325841[_0xcc9b('0x34')][_0xcc9b('0x44')]){_0x45ec75[_0xcc9b('0x45')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xcc9b('0x46')](_0x45ec75);})['then'](function(_0x237ebb){_0x5e9ae5['rows']=_0x237ebb;return _0x5e9ae5;})[_0xcc9b('0x29')](respondWithFilteredResult(_0x3e3d37,_0x45ec75))[_0xcc9b('0x47')](handleError(_0x3e3d37,null));};exports[_0xcc9b('0x48')]=function(_0x35dbbb,_0x1eb338){var _0x476b45={'raw':![],'where':{'id':_0x35dbbb[_0xcc9b('0x49')]['id']}},_0x779e78={};_0x779e78[_0xcc9b('0x39')]=_[_0xcc9b('0x35')](db[_0xcc9b('0x43')]['rawAttributes']);_0x779e78[_0xcc9b('0x34')]=_[_0xcc9b('0x35')](_0x35dbbb[_0xcc9b('0x34')]);_0x779e78['filters']=_[_0xcc9b('0x37')](_0x779e78[_0xcc9b('0x39')],_0x779e78['query']);_0x476b45['attributes']=_[_0xcc9b('0x37')](_0x779e78[_0xcc9b('0x39')],qs[_0xcc9b('0x3a')](_0x35dbbb[_0xcc9b('0x34')][_0xcc9b('0x3a')]));_0x476b45[_0xcc9b('0x38')]=_0x476b45[_0xcc9b('0x38')][_0xcc9b('0x4a')]?_0x476b45[_0xcc9b('0x38')]:_0x779e78['model'];if(_0x35dbbb['query'][_0xcc9b('0x44')]){_0x476b45[_0xcc9b('0x45')]=[{'all':!![]}];}_0x476b45=_[_0xcc9b('0x41')]({},_0x476b45,_0x35dbbb[_0xcc9b('0x42')]);return db[_0xcc9b('0x43')][_0xcc9b('0x4b')](_0x476b45)['then'](handleEntityNotFound(_0x1eb338,null))[_0xcc9b('0x29')](respondWithResult(_0x1eb338,null))['catch'](handleError(_0x1eb338,null));};exports[_0xcc9b('0x4c')]=function(_0x56c86c,_0x1966b7){return db['DeskConfiguration']['create'](_0x56c86c[_0xcc9b('0x4d')],{})['then'](respondWithResult(_0x1966b7,0xc9))[_0xcc9b('0x47')](handleError(_0x1966b7,null));};exports['update']=function(_0x94370,_0x1536d1){if(_0x94370[_0xcc9b('0x4d')]['id']){delete _0x94370[_0xcc9b('0x4d')]['id'];}return db[_0xcc9b('0x43')][_0xcc9b('0x4b')]({'where':{'id':_0x94370['params']['id']}})[_0xcc9b('0x29')](handleEntityNotFound(_0x1536d1,null))['then'](saveUpdates(_0x94370[_0xcc9b('0x4d')],null))[_0xcc9b('0x29')](respondWithResult(_0x1536d1,null))[_0xcc9b('0x47')](handleError(_0x1536d1,null));};exports['destroy']=function(_0x1e2eaa,_0x1ba0f5){return db[_0xcc9b('0x43')][_0xcc9b('0x4b')]({'where':{'id':_0x1e2eaa['params']['id']}})['then'](handleEntityNotFound(_0x1ba0f5,null))[_0xcc9b('0x29')](removeEntity(_0x1ba0f5,null))[_0xcc9b('0x47')](handleError(_0x1ba0f5,null));};exports[_0xcc9b('0x4e')]=function(_0x1dcb61,_0x571905,_0x5f5514){var _0x239343={};var _0x11f9be={};var _0x34c0fd;var _0x3a7aed;return db[_0xcc9b('0x43')]['findOne']({'where':{'id':_0x1dcb61[_0xcc9b('0x49')]['id']}})[_0xcc9b('0x29')](handleEntityNotFound(_0x571905,null))[_0xcc9b('0x29')](function(_0x4a5170){if(_0x4a5170){_0x34c0fd=_0x4a5170;_0x11f9be['model']=_[_0xcc9b('0x35')](db[_0xcc9b('0x4f')][_0xcc9b('0x30')]);_0x11f9be[_0xcc9b('0x34')]=_['keys'](_0x1dcb61[_0xcc9b('0x34')]);_0x11f9be[_0xcc9b('0x36')]=_[_0xcc9b('0x37')](_0x11f9be[_0xcc9b('0x39')],_0x11f9be[_0xcc9b('0x34')]);_0x239343[_0xcc9b('0x38')]=_['intersection'](_0x11f9be[_0xcc9b('0x39')],qs[_0xcc9b('0x3a')](_0x1dcb61['query']['fields']));_0x239343[_0xcc9b('0x38')]=_0x239343[_0xcc9b('0x38')]['length']?_0x239343[_0xcc9b('0x38')]:_0x11f9be[_0xcc9b('0x39')];_0x239343[_0xcc9b('0x3c')]=qs['sort'](_0x1dcb61[_0xcc9b('0x34')][_0xcc9b('0x3d')]);_0x239343[_0xcc9b('0x3e')]=qs[_0xcc9b('0x36')](_[_0xcc9b('0x3f')](_0x1dcb61['query'],_0x11f9be['filters']));if(_0x1dcb61[_0xcc9b('0x34')]['filter']){_0x239343[_0xcc9b('0x3e')]=_[_0xcc9b('0x41')](_0x239343[_0xcc9b('0x3e')],{'$or':_[_0xcc9b('0x2f')](_0x239343[_0xcc9b('0x38')],function(_0x29365a){var _0x1b8727={};_0x1b8727[_0x29365a]={'$like':'%'+_0x1dcb61[_0xcc9b('0x34')]['filter']+'%'};return _0x1b8727;})});}_0x239343=_[_0xcc9b('0x41')]({},_0x239343,_0x1dcb61['options']);return _0x34c0fd[_0xcc9b('0x4e')](_0x239343);}})['then'](function(_0x516407){if(_0x516407){_0x3a7aed=_0x516407['length'];if(!_0x1dcb61[_0xcc9b('0x34')][_0xcc9b('0x3b')](_0xcc9b('0x50'))){_0x239343[_0xcc9b('0x21')]=qs[_0xcc9b('0x21')](_0x1dcb61[_0xcc9b('0x34')][_0xcc9b('0x21')]);_0x239343[_0xcc9b('0x23')]=qs[_0xcc9b('0x23')](_0x1dcb61[_0xcc9b('0x34')]['offset']);}return _0x34c0fd[_0xcc9b('0x4e')](_0x239343);}})[_0xcc9b('0x29')](function(_0x38fafe){if(_0x38fafe){return _0x38fafe?{'count':_0x3a7aed,'rows':_0x38fafe}:null;}})['then'](respondWithResult(_0x571905,null))['catch'](handleError(_0x571905,null));};exports[_0xcc9b('0x51')]=function(_0x3fd808,_0x5116eb,_0x5234b8){var _0x232a59={};var _0x107dbe={};var _0x33fb45;var _0x562cab;return db[_0xcc9b('0x43')][_0xcc9b('0x52')]({'where':{'id':_0x3fd808[_0xcc9b('0x49')]['id']}})[_0xcc9b('0x29')](handleEntityNotFound(_0x5116eb,null))[_0xcc9b('0x29')](function(_0x7e8499){if(_0x7e8499){_0x33fb45=_0x7e8499;_0x107dbe['model']=_[_0xcc9b('0x35')](db[_0xcc9b('0x4f')][_0xcc9b('0x30')]);_0x107dbe[_0xcc9b('0x34')]=_[_0xcc9b('0x35')](_0x3fd808[_0xcc9b('0x34')]);_0x107dbe[_0xcc9b('0x36')]=_[_0xcc9b('0x37')](_0x107dbe['model'],_0x107dbe[_0xcc9b('0x34')]);_0x232a59[_0xcc9b('0x38')]=_[_0xcc9b('0x37')](_0x107dbe['model'],qs[_0xcc9b('0x3a')](_0x3fd808[_0xcc9b('0x34')][_0xcc9b('0x3a')]));_0x232a59['attributes']=_0x232a59['attributes'][_0xcc9b('0x4a')]?_0x232a59['attributes']:_0x107dbe[_0xcc9b('0x39')];_0x232a59['order']=qs[_0xcc9b('0x3d')](_0x3fd808[_0xcc9b('0x34')][_0xcc9b('0x3d')]);_0x232a59[_0xcc9b('0x3e')]=qs[_0xcc9b('0x36')](_[_0xcc9b('0x3f')](_0x3fd808[_0xcc9b('0x34')],_0x107dbe['filters']));if(_0x3fd808[_0xcc9b('0x34')][_0xcc9b('0x40')]){_0x232a59[_0xcc9b('0x3e')]=_[_0xcc9b('0x41')](_0x232a59['where'],{'$or':_[_0xcc9b('0x2f')](_0x232a59[_0xcc9b('0x38')],function(_0x2f2de0){var _0x9fdcbd={};_0x9fdcbd[_0x2f2de0]={'$like':'%'+_0x3fd808[_0xcc9b('0x34')][_0xcc9b('0x40')]+'%'};return _0x9fdcbd;})});}_0x232a59=_[_0xcc9b('0x41')]({},_0x232a59,_0x3fd808[_0xcc9b('0x42')]);return _0x33fb45['getSubjects'](_0x232a59);}})[_0xcc9b('0x29')](function(_0x8e5882){if(_0x8e5882){_0x562cab=_0x8e5882[_0xcc9b('0x4a')];if(!_0x3fd808[_0xcc9b('0x34')]['hasOwnProperty'](_0xcc9b('0x50'))){_0x232a59[_0xcc9b('0x21')]=qs[_0xcc9b('0x21')](_0x3fd808[_0xcc9b('0x34')][_0xcc9b('0x21')]);_0x232a59[_0xcc9b('0x23')]=qs[_0xcc9b('0x23')](_0x3fd808[_0xcc9b('0x34')][_0xcc9b('0x23')]);}return _0x33fb45[_0xcc9b('0x51')](_0x232a59);}})[_0xcc9b('0x29')](function(_0x6fe93f){if(_0x6fe93f){return _0x6fe93f?{'count':_0x562cab,'rows':_0x6fe93f}:null;}})['then'](respondWithResult(_0x5116eb,null))[_0xcc9b('0x47')](handleError(_0x5116eb,null));};exports[_0xcc9b('0x53')]=function(_0x438e19,_0x512138,_0x583746){var _0x53d7d5={};var _0x87c7c7={};var _0x534145;var _0x15ab84;return db[_0xcc9b('0x43')][_0xcc9b('0x52')]({'where':{'id':_0x438e19[_0xcc9b('0x49')]['id']}})[_0xcc9b('0x29')](handleEntityNotFound(_0x512138,null))['then'](function(_0x5984fd){if(_0x5984fd){_0x534145=_0x5984fd;_0x87c7c7[_0xcc9b('0x39')]=_[_0xcc9b('0x35')](db[_0xcc9b('0x4f')][_0xcc9b('0x30')]);_0x87c7c7[_0xcc9b('0x34')]=_[_0xcc9b('0x35')](_0x438e19[_0xcc9b('0x34')]);_0x87c7c7['filters']=_[_0xcc9b('0x37')](_0x87c7c7[_0xcc9b('0x39')],_0x87c7c7[_0xcc9b('0x34')]);_0x53d7d5['attributes']=_[_0xcc9b('0x37')](_0x87c7c7[_0xcc9b('0x39')],qs[_0xcc9b('0x3a')](_0x438e19[_0xcc9b('0x34')][_0xcc9b('0x3a')]));_0x53d7d5[_0xcc9b('0x38')]=_0x53d7d5['attributes'][_0xcc9b('0x4a')]?_0x53d7d5[_0xcc9b('0x38')]:_0x87c7c7['model'];_0x53d7d5[_0xcc9b('0x3c')]=qs[_0xcc9b('0x3d')](_0x438e19[_0xcc9b('0x34')]['sort']);_0x53d7d5[_0xcc9b('0x3e')]=qs['filters'](_[_0xcc9b('0x3f')](_0x438e19['query'],_0x87c7c7[_0xcc9b('0x36')]));if(_0x438e19['query'][_0xcc9b('0x40')]){_0x53d7d5[_0xcc9b('0x3e')]=_['merge'](_0x53d7d5['where'],{'$or':_[_0xcc9b('0x2f')](_0x53d7d5[_0xcc9b('0x38')],function(_0x4e0397){var _0x56e15b={};_0x56e15b[_0x4e0397]={'$like':'%'+_0x438e19['query']['filter']+'%'};return _0x56e15b;})});}_0x53d7d5=_[_0xcc9b('0x41')]({},_0x53d7d5,_0x438e19[_0xcc9b('0x42')]);return _0x534145[_0xcc9b('0x53')](_0x53d7d5);}})[_0xcc9b('0x29')](function(_0x437494){if(_0x437494){_0x15ab84=_0x437494[_0xcc9b('0x4a')];if(!_0x438e19['query'][_0xcc9b('0x3b')](_0xcc9b('0x50'))){_0x53d7d5[_0xcc9b('0x21')]=qs[_0xcc9b('0x21')](_0x438e19['query'][_0xcc9b('0x21')]);_0x53d7d5[_0xcc9b('0x23')]=qs['offset'](_0x438e19[_0xcc9b('0x34')][_0xcc9b('0x23')]);}return _0x534145[_0xcc9b('0x53')](_0x53d7d5);}})[_0xcc9b('0x29')](function(_0x115380){if(_0x115380){return _0x115380?{'count':_0x15ab84,'rows':_0x115380}:null;}})[_0xcc9b('0x29')](respondWithResult(_0x512138,null))[_0xcc9b('0x47')](handleError(_0x512138,null));};exports[_0xcc9b('0x54')]=function(_0xbce87d,_0x55cf78,_0x3fca02){var _0xe78f6d={};var _0x355c70={};var _0x125e5b;var _0x586b87;return db[_0xcc9b('0x43')][_0xcc9b('0x52')]({'where':{'id':_0xbce87d[_0xcc9b('0x49')]['id']}})[_0xcc9b('0x29')](handleEntityNotFound(_0x55cf78,null))[_0xcc9b('0x29')](function(_0x2684b7){if(_0x2684b7){_0x125e5b=_0x2684b7;_0x355c70[_0xcc9b('0x39')]=_['keys'](db[_0xcc9b('0x55')]['rawAttributes']);_0x355c70['query']=_[_0xcc9b('0x35')](_0xbce87d[_0xcc9b('0x34')]);_0x355c70[_0xcc9b('0x36')]=_[_0xcc9b('0x37')](_0x355c70[_0xcc9b('0x39')],_0x355c70[_0xcc9b('0x34')]);_0xe78f6d['attributes']=_[_0xcc9b('0x37')](_0x355c70[_0xcc9b('0x39')],qs[_0xcc9b('0x3a')](_0xbce87d['query'][_0xcc9b('0x3a')]));_0xe78f6d[_0xcc9b('0x38')]=_0xe78f6d[_0xcc9b('0x38')][_0xcc9b('0x4a')]?_0xe78f6d[_0xcc9b('0x38')]:_0x355c70[_0xcc9b('0x39')];_0xe78f6d[_0xcc9b('0x3c')]=qs[_0xcc9b('0x3d')](_0xbce87d[_0xcc9b('0x34')][_0xcc9b('0x3d')]);_0xe78f6d[_0xcc9b('0x3e')]=qs[_0xcc9b('0x36')](_[_0xcc9b('0x3f')](_0xbce87d[_0xcc9b('0x34')],_0x355c70[_0xcc9b('0x36')]));if(_0xbce87d[_0xcc9b('0x34')]['filter']){_0xe78f6d[_0xcc9b('0x3e')]=_['merge'](_0xe78f6d[_0xcc9b('0x3e')],{'$or':_[_0xcc9b('0x2f')](_0xe78f6d[_0xcc9b('0x38')],function(_0x422f46){var _0x37f33a={};_0x37f33a[_0x422f46]={'$like':'%'+_0xbce87d['query']['filter']+'%'};return _0x37f33a;})});}_0xe78f6d=_[_0xcc9b('0x41')]({},_0xe78f6d,_0xbce87d[_0xcc9b('0x42')]);return _0x125e5b[_0xcc9b('0x54')](_0xe78f6d);}})['then'](function(_0x46e7dd){if(_0x46e7dd){_0x586b87=_0x46e7dd[_0xcc9b('0x4a')];if(!_0xbce87d[_0xcc9b('0x34')][_0xcc9b('0x3b')](_0xcc9b('0x50'))){_0xe78f6d[_0xcc9b('0x21')]=qs[_0xcc9b('0x21')](_0xbce87d[_0xcc9b('0x34')][_0xcc9b('0x21')]);_0xe78f6d[_0xcc9b('0x23')]=qs[_0xcc9b('0x23')](_0xbce87d[_0xcc9b('0x34')]['offset']);}return _0x125e5b[_0xcc9b('0x54')](_0xe78f6d);}})['then'](function(_0x1f6089){if(_0x1f6089){return _0x1f6089?{'count':_0x586b87,'rows':_0x1f6089}:null;}})[_0xcc9b('0x29')](respondWithResult(_0x55cf78,null))[_0xcc9b('0x47')](handleError(_0x55cf78,null));};exports[_0xcc9b('0x56')]=function(_0x5e421d,_0x2d188e,_0x2e475f){if(_0x5e421d['body']['id']){delete _0x5e421d[_0xcc9b('0x4d')]['id'];}return db[_0xcc9b('0x43')][_0xcc9b('0x52')]({'where':{'id':_0x5e421d['params']['id']}})[_0xcc9b('0x29')](handleEntityNotFound(_0x2d188e,null))['then'](function(_0x869738){if(_0x869738){return _0x869738[_0xcc9b('0x56')](_0x5e421d[_0xcc9b('0x4d')][_0xcc9b('0x57')]||[]);}return null;})[_0xcc9b('0x29')](respondWithResult(_0x2d188e,null))[_0xcc9b('0x47')](handleError(_0x2d188e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 60f42d9..923e365 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 _0x89ff=['moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api'];(function(_0x55a9e5,_0xb8df7b){var _0x16ca50=function(_0x2d753e){while(--_0x2d753e){_0x55a9e5['push'](_0x55a9e5['shift']());}};_0x16ca50(++_0xb8df7b);}(_0x89ff,0x1b7));var _0xf89f=function(_0x7a68b,_0x964789){_0x7a68b=_0x7a68b-0x0;var _0x110d37=_0x89ff[_0x7a68b];return _0x110d37;};'use strict';var _=require('lodash');var util=require(_0xf89f('0x0'));var logger=require(_0xf89f('0x1'))(_0xf89f('0x2'));var moment=require(_0xf89f('0x3'));var BPromise=require(_0xf89f('0x4'));var rp=require(_0xf89f('0x5'));var fs=require('fs');var path=require(_0xf89f('0x6'));var rimraf=require('rimraf');var config=require(_0xf89f('0x7'));var attributes=require(_0xf89f('0x8'));module[_0xf89f('0x9')]=function(_0x2b5987,_0x578695){return _0x2b5987[_0xf89f('0xa')](_0xf89f('0xb'),attributes,{'tableName':_0xf89f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce2=['int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1ce2,0x8d));var _0x21ce=function(_0x1d6f72,_0x3ecbe3){_0x1d6f72=_0x1d6f72-0x0;var _0x444403=_0x1ce2[_0x1d6f72];return _0x444403;};'use strict';var _=require(_0x21ce('0x0'));var util=require(_0x21ce('0x1'));var logger=require(_0x21ce('0x2'))(_0x21ce('0x3'));var moment=require(_0x21ce('0x4'));var BPromise=require(_0x21ce('0x5'));var rp=require(_0x21ce('0x6'));var fs=require('fs');var path=require(_0x21ce('0x7'));var rimraf=require(_0x21ce('0x8'));var config=require(_0x21ce('0x9'));var attributes=require(_0x21ce('0xa'));module[_0x21ce('0xb')]=function(_0x30135c,_0x541b70){return _0x30135c[_0x21ce('0xc')]('DeskConfiguration',attributes,{'tableName':_0x21ce('0xd'),'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 fd8a8e8..666b649 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 _0xb96d=['then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x224409,_0x5db3ff){var _0xea2fa=function(_0x5b4a9a){while(--_0x5b4a9a){_0x224409['push'](_0x224409['shift']());}};_0xea2fa(++_0x5db3ff);}(_0xb96d,0x9e));var _0xdb96=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0xb96d[_0x188a93];return _0x23b40d;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var BPromise=require(_0xdb96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var utils=require(_0xdb96('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb96('0x6'));var jayson=require(_0xdb96('0x7'));var client=jayson[_0xdb96('0x8')][_0xdb96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5e6f,_0x294084,_0x571e0e){return new BPromise(function(_0x5e2e95,_0x3384b4){return client['request'](_0x4f5e6f,_0x571e0e)[_0xdb96('0xa')](function(_0xaea492){logger['info'](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));logger['debug'](_0xdb96('0xd'),_0x294084,_0xdb96('0xc'),JSON[_0xdb96('0xe')](_0xaea492));if(_0xaea492[_0xdb96('0xf')]){if(_0xaea492['error'][_0xdb96('0x10')]===0x1f4){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492['error'][_0xdb96('0x11')]);return _0x3384b4(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);return _0x5e2e95(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}else{logger[_0xdb96('0x12')](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));_0x5e2e95(_0xaea492[_0xdb96('0x13')]['message']);}})[_0xdb96('0x14')](function(_0x2a766e){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0x2a766e);_0x3384b4(_0x2a766e);});});} \ No newline at end of file +var _0xac35=['request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x45278e,_0x1c43bc){var _0xfff26d=function(_0x2ab7bc){while(--_0x2ab7bc){_0x45278e['push'](_0x45278e['shift']());}};_0xfff26d(++_0x1c43bc);}(_0xac35,0x141));var _0x5ac3=function(_0x4044a8,_0x4587f0){_0x4044a8=_0x4044a8-0x0;var _0x5984f5=_0xac35[_0x4044a8];return _0x5984f5;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 86acad2..1988f86 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 _0xc648=['fs-extra','../../components/auth/service','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x52f4cf,_0x514533){var _0x2db42e=function(_0x430618){while(--_0x430618){_0x52f4cf['push'](_0x52f4cf['shift']());}};_0x2db42e(++_0x514533);}(_0xc648,0x171));var _0x8c64=function(_0x547c0b,_0x10a750){_0x547c0b=_0x547c0b-0x0;var _0x32db1f=_0xc648[_0x547c0b];return _0x32db1f;};'use strict';var multer=require('multer');var util=require(_0x8c64('0x0'));var path=require(_0x8c64('0x1'));var timeout=require(_0x8c64('0x2'));var express=require(_0x8c64('0x3'));var router=express[_0x8c64('0x4')]();var fs_extra=require(_0x8c64('0x5'));var auth=require(_0x8c64('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x8c64('0x7')]('/',auth[_0x8c64('0x8')](),controller[_0x8c64('0x9')]);router[_0x8c64('0x7')]('/:id',auth[_0x8c64('0x8')](),controller[_0x8c64('0xa')]);router[_0x8c64('0xb')]('/',auth[_0x8c64('0x8')](),controller[_0x8c64('0xc')]);router['put'](_0x8c64('0xd'),auth[_0x8c64('0x8')](),controller['update']);router[_0x8c64('0xe')](_0x8c64('0xd'),auth[_0x8c64('0x8')](),controller[_0x8c64('0xf')]);module[_0x8c64('0x10')]=router; \ No newline at end of file +var _0xed8c=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','create','/:id','update'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xed8c,0x135));var _0xced8=function(_0xf626be,_0x470732){_0xf626be=_0xf626be-0x0;var _0x39e5c1=_0xed8c[_0xf626be];return _0x39e5c1;};'use strict';var multer=require(_0xced8('0x0'));var util=require(_0xced8('0x1'));var path=require(_0xced8('0x2'));var timeout=require(_0xced8('0x3'));var express=require(_0xced8('0x4'));var router=express[_0xced8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xced8('0x6'));var config=require(_0xced8('0x7'));var controller=require('./intDeskField.controller');router[_0xced8('0x8')]('/',auth['isAuthenticated'](),controller[_0xced8('0x9')]);router[_0xced8('0x8')]('/:id',auth[_0xced8('0xa')](),controller[_0xced8('0xb')]);router['post']('/',auth[_0xced8('0xa')](),controller[_0xced8('0xc')]);router['put'](_0xced8('0xd'),auth[_0xced8('0xa')](),controller[_0xced8('0xe')]);router[_0xced8('0xf')](_0xced8('0xd'),auth[_0xced8('0xa')](),controller[_0xced8('0x10')]);module[_0xced8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 70c944d..cc36348 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 _0x2f01=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x2e0a10,_0x2493ff){var _0xc815d=function(_0x420c1e){while(--_0x420c1e){_0x2e0a10['push'](_0x2e0a10['shift']());}};_0xc815d(++_0x2493ff);}(_0x2f01,0xb5));var _0x12f0=function(_0x38551b,_0x3244d3){_0x38551b=_0x38551b-0x0;var _0x58923d=_0x2f01[_0x38551b];return _0x58923d;};'use strict';var Sequelize=require(_0x12f0('0x0'));module[_0x12f0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x12f0('0x2'),_0x12f0('0x3'),_0x12f0('0x4'),_0x12f0('0x5'),_0x12f0('0x6')),'defaultValue':_0x12f0('0x2')},'content':{'type':Sequelize[_0x12f0('0x7')]},'key':{'type':Sequelize[_0x12f0('0x7')]},'keyType':{'type':Sequelize[_0x12f0('0x8')]('string',_0x12f0('0x3'),_0x12f0('0x4'))},'keyContent':{'type':Sequelize[_0x12f0('0x7')]},'idField':{'type':Sequelize[_0x12f0('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x12f0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x12f0('0x7')]}}; \ No newline at end of file +var _0xd9fa=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','variable'];(function(_0xa6ddd7,_0x46d302){var _0x409344=function(_0x21b1e3){while(--_0x21b1e3){_0xa6ddd7['push'](_0xa6ddd7['shift']());}};_0x409344(++_0x46d302);}(_0xd9fa,0x96));var _0xad9f=function(_0x49b3e0,_0x56bf0c){_0x49b3e0=_0x49b3e0-0x0;var _0x3352cf=_0xd9fa[_0x49b3e0];return _0x3352cf;};'use strict';var Sequelize=require(_0xad9f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xad9f('0x1'),_0xad9f('0x2'),_0xad9f('0x3'),_0xad9f('0x4')),'defaultValue':_0xad9f('0x5')},'content':{'type':Sequelize[_0xad9f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xad9f('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xad9f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xad9f('0x6')]},'customField':{'type':Sequelize[_0xad9f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bfb8a44..2472196 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 _0x8ad5=['attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x14137e,_0x4a8557){var _0x228fe5=function(_0x1e56d7){while(--_0x1e56d7){_0x14137e['push'](_0x14137e['shift']());}};_0x228fe5(++_0x4a8557);}(_0x8ad5,0xf1));var _0x58ad=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8ad5[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0x58ad('0x0'));var rimraf=require(_0x58ad('0x1'));var zipdir=require(_0x58ad('0x2'));var jsonpatch=require(_0x58ad('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58ad('0x4'));var Mustache=require(_0x58ad('0x5'));var util=require(_0x58ad('0x6'));var path=require(_0x58ad('0x7'));var sox=require(_0x58ad('0x8'));var csv=require(_0x58ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58ad('0xa'));var squel=require(_0x58ad('0xb'));var crypto=require(_0x58ad('0xc'));var jsforce=require(_0x58ad('0xd'));var deskjs=require(_0x58ad('0xe'));var toCsv=require(_0x58ad('0x9'));var querystring=require(_0x58ad('0xf'));var Papa=require(_0x58ad('0x10'));var Redis=require(_0x58ad('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x58ad('0x12'));var as=require(_0x58ad('0x13'));var hardwareService=require(_0x58ad('0x14'));var logger=require(_0x58ad('0x15'))(_0x58ad('0x16'));var utils=require(_0x58ad('0x17'));var config=require(_0x58ad('0x18'));var licenseUtil=require(_0x58ad('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x315a24,_0x28290a){_0x28290a=_0x28290a||0xcc;return function(_0x5a208c){if(_0x5a208c){return _0x315a24[_0x58ad('0x1a')](_0x28290a);}return _0x315a24[_0x58ad('0x1b')](_0x28290a)[_0x58ad('0x1c')]();};}function respondWithResult(_0x36caa1,_0x24a1fb){_0x24a1fb=_0x24a1fb||0xc8;return function(_0x5bc297){if(_0x5bc297){return _0x36caa1['status'](_0x24a1fb)['json'](_0x5bc297);}};}function respondWithFilteredResult(_0x57ce95,_0x34bea5){return function(_0x5ba955){if(_0x5ba955){var _0x149583=typeof _0x34bea5[_0x58ad('0x1d')]===_0x58ad('0x1e')&&typeof _0x34bea5[_0x58ad('0x1f')]===_0x58ad('0x1e');var _0x575047=_0x5ba955[_0x58ad('0x20')];var _0x24fbe0=_0x149583?0x0:_0x34bea5[_0x58ad('0x1d')];var _0xc8b034=_0x149583?_0x5ba955[_0x58ad('0x20')]:_0x34bea5[_0x58ad('0x1d')]+_0x34bea5[_0x58ad('0x1f')];var _0xb0e5b1;if(_0xc8b034>=_0x575047){_0xc8b034=_0x575047;_0xb0e5b1=0xc8;}else{_0xb0e5b1=0xce;}_0x57ce95['status'](_0xb0e5b1);return _0x57ce95[_0x58ad('0x21')](_0x58ad('0x22'),_0x24fbe0+'-'+_0xc8b034+'/'+_0x575047)[_0x58ad('0x23')](_0x5ba955);}return null;};}function patchUpdates(_0x5e4ff8){return function(_0x850321){try{jsonpatch[_0x58ad('0x24')](_0x850321,_0x5e4ff8,!![]);}catch(_0x154804){return BPromise['reject'](_0x154804);}return _0x850321[_0x58ad('0x25')]();};}function saveUpdates(_0x32e3cf,_0xb50caf){return function(_0xf2129c){if(_0xf2129c){return _0xf2129c['update'](_0x32e3cf)[_0x58ad('0x26')](function(_0x3f87b2){return _0x3f87b2;});}return null;};}function removeEntity(_0x2bf81e,_0x5f7669){return function(_0x20a572){if(_0x20a572){return _0x20a572[_0x58ad('0x27')]()[_0x58ad('0x26')](function(){_0x2bf81e[_0x58ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13220b,_0x4ec837){return function(_0x3de31f){if(!_0x3de31f){_0x13220b['sendStatus'](0x194);}return _0x3de31f;};}function handleError(_0x50c131,_0x139149){_0x139149=_0x139149||0x1f4;return function(_0x3d7d74){logger[_0x58ad('0x28')](_0x3d7d74[_0x58ad('0x29')]);if(_0x3d7d74[_0x58ad('0x2a')]){delete _0x3d7d74[_0x58ad('0x2a')];}_0x50c131[_0x58ad('0x1b')](_0x139149)[_0x58ad('0x2b')](_0x3d7d74);};}exports[_0x58ad('0x2c')]=function(_0x167485,_0x230880){var _0x50731e={},_0x2bffbd={},_0x3b4a38={'count':0x0,'rows':[]};var _0xc2fa0d=_[_0x58ad('0x2d')](db[_0x58ad('0x2e')]['rawAttributes'],function(_0x3ee7dd){return{'name':_0x3ee7dd[_0x58ad('0x2f')],'type':_0x3ee7dd[_0x58ad('0x30')][_0x58ad('0x31')]};});_0x2bffbd[_0x58ad('0x32')]=_['map'](_0xc2fa0d,'name');_0x2bffbd[_0x58ad('0x33')]=_[_0x58ad('0x34')](_0x167485[_0x58ad('0x33')]);_0x2bffbd[_0x58ad('0x35')]=_[_0x58ad('0x36')](_0x2bffbd[_0x58ad('0x32')],_0x2bffbd[_0x58ad('0x33')]);_0x50731e[_0x58ad('0x37')]=_['intersection'](_0x2bffbd[_0x58ad('0x32')],qs[_0x58ad('0x38')](_0x167485[_0x58ad('0x33')]['fields']));_0x50731e[_0x58ad('0x37')]=_0x50731e['attributes'][_0x58ad('0x39')]?_0x50731e[_0x58ad('0x37')]:_0x2bffbd['model'];if(!_0x167485[_0x58ad('0x33')][_0x58ad('0x3a')]('nolimit')){_0x50731e['limit']=qs[_0x58ad('0x1f')](_0x167485[_0x58ad('0x33')]['limit']);_0x50731e[_0x58ad('0x1d')]=qs['offset'](_0x167485['query'][_0x58ad('0x1d')]);}_0x50731e[_0x58ad('0x3b')]=qs[_0x58ad('0x3c')](_0x167485[_0x58ad('0x33')][_0x58ad('0x3c')]);_0x50731e['where']=qs[_0x58ad('0x35')](_[_0x58ad('0x3d')](_0x167485[_0x58ad('0x33')],_0x2bffbd[_0x58ad('0x35')]),_0xc2fa0d);if(_0x167485[_0x58ad('0x33')]['filter']){_0x50731e[_0x58ad('0x3e')]=_[_0x58ad('0x3f')](_0x50731e[_0x58ad('0x3e')],{'$or':_['map'](_0xc2fa0d,function(_0x574486){if(_0x574486['type']!==_0x58ad('0x40')){var _0x5b0827={};_0x5b0827[_0x574486[_0x58ad('0x2a')]]={'$like':'%'+_0x167485[_0x58ad('0x33')][_0x58ad('0x41')]+'%'};return _0x5b0827;}})});}_0x50731e=_[_0x58ad('0x3f')]({},_0x50731e,_0x167485['options']);var _0x3d2c72={'where':_0x50731e[_0x58ad('0x3e')]};return db[_0x58ad('0x2e')]['count'](_0x3d2c72)['then'](function(_0x3c9fbb){_0x3b4a38[_0x58ad('0x20')]=_0x3c9fbb;if(_0x167485[_0x58ad('0x33')]['includeAll']){_0x50731e[_0x58ad('0x42')]=[{'all':!![]}];}return db['DeskField'][_0x58ad('0x43')](_0x50731e);})[_0x58ad('0x26')](function(_0x240c45){_0x3b4a38[_0x58ad('0x44')]=_0x240c45;return _0x3b4a38;})[_0x58ad('0x26')](respondWithFilteredResult(_0x230880,_0x50731e))[_0x58ad('0x45')](handleError(_0x230880,null));};exports['show']=function(_0x40d337,_0x533f4b){var _0x425964={'raw':!![],'where':{'id':_0x40d337['params']['id']}},_0x2d333e={};_0x2d333e[_0x58ad('0x32')]=_[_0x58ad('0x34')](db['DeskField']['rawAttributes']);_0x2d333e[_0x58ad('0x33')]=_['keys'](_0x40d337[_0x58ad('0x33')]);_0x2d333e[_0x58ad('0x35')]=_['intersection'](_0x2d333e['model'],_0x2d333e[_0x58ad('0x33')]);_0x425964[_0x58ad('0x37')]=_[_0x58ad('0x36')](_0x2d333e[_0x58ad('0x32')],qs[_0x58ad('0x38')](_0x40d337[_0x58ad('0x33')][_0x58ad('0x38')]));_0x425964[_0x58ad('0x37')]=_0x425964[_0x58ad('0x37')][_0x58ad('0x39')]?_0x425964[_0x58ad('0x37')]:_0x2d333e[_0x58ad('0x32')];if(_0x40d337[_0x58ad('0x33')]['includeAll']){_0x425964[_0x58ad('0x42')]=[{'all':!![]}];}_0x425964=_[_0x58ad('0x3f')]({},_0x425964,_0x40d337['options']);return db[_0x58ad('0x2e')]['find'](_0x425964)[_0x58ad('0x26')](handleEntityNotFound(_0x533f4b,null))[_0x58ad('0x26')](respondWithResult(_0x533f4b,null))[_0x58ad('0x45')](handleError(_0x533f4b,null));};exports['create']=function(_0x5b111d,_0x4d9216){return db[_0x58ad('0x2e')][_0x58ad('0x46')](_0x5b111d['body'],{})[_0x58ad('0x26')](respondWithResult(_0x4d9216,0xc9))[_0x58ad('0x45')](handleError(_0x4d9216,null));};exports['update']=function(_0x31592a,_0x2fce8b){if(_0x31592a[_0x58ad('0x47')]['id']){delete _0x31592a[_0x58ad('0x47')]['id'];}return db[_0x58ad('0x2e')][_0x58ad('0x48')]({'where':{'id':_0x31592a[_0x58ad('0x49')]['id']}})[_0x58ad('0x26')](handleEntityNotFound(_0x2fce8b,null))[_0x58ad('0x26')](saveUpdates(_0x31592a[_0x58ad('0x47')],null))['then'](respondWithResult(_0x2fce8b,null))[_0x58ad('0x45')](handleError(_0x2fce8b,null));};exports[_0x58ad('0x27')]=function(_0x12ec50,_0x1d6f05){return db[_0x58ad('0x2e')][_0x58ad('0x48')]({'where':{'id':_0x12ec50[_0x58ad('0x49')]['id']}})[_0x58ad('0x26')](handleEntityNotFound(_0x1d6f05,null))[_0x58ad('0x26')](removeEntity(_0x1d6f05,null))[_0x58ad('0x45')](handleError(_0x1d6f05,null));}; \ No newline at end of file +var _0x889d=['util','path','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','send','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x889d,0x179));var _0xd889=function(_0x1e5999,_0x3dacb1){_0x1e5999=_0x1e5999-0x0;var _0x31bbd3=_0x889d[_0x1e5999];return _0x31bbd3;};'use strict';var emlformat=require(_0xd889('0x0'));var rimraf=require(_0xd889('0x1'));var zipdir=require(_0xd889('0x2'));var jsonpatch=require(_0xd889('0x3'));var rp=require(_0xd889('0x4'));var moment=require(_0xd889('0x5'));var BPromise=require(_0xd889('0x6'));var Mustache=require(_0xd889('0x7'));var util=require(_0xd889('0x8'));var path=require(_0xd889('0x9'));var sox=require(_0xd889('0xa'));var csv=require(_0xd889('0xb'));var ejs=require(_0xd889('0xc'));var fs=require('fs');var fs_extra=require(_0xd889('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd889('0xe'));var jsforce=require(_0xd889('0xf'));var deskjs=require(_0xd889('0x10'));var toCsv=require(_0xd889('0xb'));var querystring=require(_0xd889('0x11'));var Papa=require(_0xd889('0x12'));var Redis=require('ioredis');var authService=require(_0xd889('0x13'));var qs=require(_0xd889('0x14'));var as=require(_0xd889('0x15'));var hardwareService=require(_0xd889('0x16'));var logger=require(_0xd889('0x17'))('api');var utils=require(_0xd889('0x18'));var config=require(_0xd889('0x19'));var licenseUtil=require(_0xd889('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a76d1,_0x2783d8){_0x2783d8=_0x2783d8||0xcc;return function(_0x5a2264){if(_0x5a2264){return _0x1a76d1[_0xd889('0x1b')](_0x2783d8);}return _0x1a76d1[_0xd889('0x1c')](_0x2783d8)[_0xd889('0x1d')]();};}function respondWithResult(_0x5818f1,_0x1a3598){_0x1a3598=_0x1a3598||0xc8;return function(_0x55eb92){if(_0x55eb92){return _0x5818f1[_0xd889('0x1c')](_0x1a3598)[_0xd889('0x1e')](_0x55eb92);}};}function respondWithFilteredResult(_0x4b720d,_0x5ba55d){return function(_0x5379be){if(_0x5379be){var _0x41fe0e=typeof _0x5ba55d[_0xd889('0x1f')]==='undefined'&&typeof _0x5ba55d[_0xd889('0x20')]===_0xd889('0x21');var _0x536ba0=_0x5379be[_0xd889('0x22')];var _0x48c3eb=_0x41fe0e?0x0:_0x5ba55d[_0xd889('0x1f')];var _0x3d3ca7=_0x41fe0e?_0x5379be[_0xd889('0x22')]:_0x5ba55d[_0xd889('0x1f')]+_0x5ba55d[_0xd889('0x20')];var _0x1b4cf7;if(_0x3d3ca7>=_0x536ba0){_0x3d3ca7=_0x536ba0;_0x1b4cf7=0xc8;}else{_0x1b4cf7=0xce;}_0x4b720d['status'](_0x1b4cf7);return _0x4b720d[_0xd889('0x23')]('Content-Range',_0x48c3eb+'-'+_0x3d3ca7+'/'+_0x536ba0)[_0xd889('0x1e')](_0x5379be);}return null;};}function patchUpdates(_0x16cde3){return function(_0x18ee92){try{jsonpatch[_0xd889('0x24')](_0x18ee92,_0x16cde3,!![]);}catch(_0x369d52){return BPromise['reject'](_0x369d52);}return _0x18ee92[_0xd889('0x25')]();};}function saveUpdates(_0x38a578,_0x2349af){return function(_0x575074){if(_0x575074){return _0x575074[_0xd889('0x26')](_0x38a578)[_0xd889('0x27')](function(_0x579119){return _0x579119;});}return null;};}function removeEntity(_0x599592,_0x51e6bf){return function(_0x5548f1){if(_0x5548f1){return _0x5548f1[_0xd889('0x28')]()[_0xd889('0x27')](function(){_0x599592[_0xd889('0x1c')](0xcc)[_0xd889('0x1d')]();});}};}function handleEntityNotFound(_0xc2068e,_0xfcd94c){return function(_0x123feb){if(!_0x123feb){_0xc2068e[_0xd889('0x1b')](0x194);}return _0x123feb;};}function handleError(_0x54a550,_0x4ea842){_0x4ea842=_0x4ea842||0x1f4;return function(_0x2e1c15){logger[_0xd889('0x29')](_0x2e1c15['stack']);if(_0x2e1c15[_0xd889('0x2a')]){delete _0x2e1c15[_0xd889('0x2a')];}_0x54a550[_0xd889('0x1c')](_0x4ea842)[_0xd889('0x2b')](_0x2e1c15);};}exports['index']=function(_0x130765,_0x511cb5){var _0x19d465={},_0x1d3b0d={},_0x4bf5d4={'count':0x0,'rows':[]};var _0x307a04=_['map'](db[_0xd889('0x2c')][_0xd889('0x2d')],function(_0x423bf0){return{'name':_0x423bf0[_0xd889('0x2e')],'type':_0x423bf0[_0xd889('0x2f')][_0xd889('0x30')]};});_0x1d3b0d[_0xd889('0x31')]=_['map'](_0x307a04,_0xd889('0x2a'));_0x1d3b0d[_0xd889('0x32')]=_[_0xd889('0x33')](_0x130765['query']);_0x1d3b0d[_0xd889('0x34')]=_[_0xd889('0x35')](_0x1d3b0d[_0xd889('0x31')],_0x1d3b0d[_0xd889('0x32')]);_0x19d465[_0xd889('0x36')]=_[_0xd889('0x35')](_0x1d3b0d['model'],qs[_0xd889('0x37')](_0x130765['query']['fields']));_0x19d465[_0xd889('0x36')]=_0x19d465['attributes'][_0xd889('0x38')]?_0x19d465[_0xd889('0x36')]:_0x1d3b0d['model'];if(!_0x130765[_0xd889('0x32')][_0xd889('0x39')](_0xd889('0x3a'))){_0x19d465[_0xd889('0x20')]=qs['limit'](_0x130765[_0xd889('0x32')][_0xd889('0x20')]);_0x19d465[_0xd889('0x1f')]=qs[_0xd889('0x1f')](_0x130765[_0xd889('0x32')][_0xd889('0x1f')]);}_0x19d465[_0xd889('0x3b')]=qs[_0xd889('0x3c')](_0x130765[_0xd889('0x32')]['sort']);_0x19d465[_0xd889('0x3d')]=qs[_0xd889('0x34')](_['pick'](_0x130765['query'],_0x1d3b0d[_0xd889('0x34')]),_0x307a04);if(_0x130765[_0xd889('0x32')][_0xd889('0x3e')]){_0x19d465[_0xd889('0x3d')]=_[_0xd889('0x3f')](_0x19d465['where'],{'$or':_[_0xd889('0x40')](_0x307a04,function(_0x53bfd7){if(_0x53bfd7[_0xd889('0x2f')]!==_0xd889('0x41')){var _0x20b61b={};_0x20b61b[_0x53bfd7[_0xd889('0x2a')]]={'$like':'%'+_0x130765['query']['filter']+'%'};return _0x20b61b;}})});}_0x19d465=_[_0xd889('0x3f')]({},_0x19d465,_0x130765[_0xd889('0x42')]);var _0x3f3d22={'where':_0x19d465[_0xd889('0x3d')]};return db['DeskField'][_0xd889('0x22')](_0x3f3d22)[_0xd889('0x27')](function(_0x322659){_0x4bf5d4[_0xd889('0x22')]=_0x322659;if(_0x130765['query']['includeAll']){_0x19d465[_0xd889('0x43')]=[{'all':!![]}];}return db[_0xd889('0x2c')][_0xd889('0x44')](_0x19d465);})[_0xd889('0x27')](function(_0x5c504c){_0x4bf5d4[_0xd889('0x45')]=_0x5c504c;return _0x4bf5d4;})[_0xd889('0x27')](respondWithFilteredResult(_0x511cb5,_0x19d465))['catch'](handleError(_0x511cb5,null));};exports[_0xd889('0x46')]=function(_0x5045bb,_0x333236){var _0xc0be41={'raw':!![],'where':{'id':_0x5045bb[_0xd889('0x47')]['id']}},_0x5875a0={};_0x5875a0['model']=_[_0xd889('0x33')](db['DeskField'][_0xd889('0x2d')]);_0x5875a0['query']=_[_0xd889('0x33')](_0x5045bb['query']);_0x5875a0['filters']=_['intersection'](_0x5875a0['model'],_0x5875a0['query']);_0xc0be41[_0xd889('0x36')]=_[_0xd889('0x35')](_0x5875a0[_0xd889('0x31')],qs[_0xd889('0x37')](_0x5045bb['query'][_0xd889('0x37')]));_0xc0be41[_0xd889('0x36')]=_0xc0be41['attributes'][_0xd889('0x38')]?_0xc0be41[_0xd889('0x36')]:_0x5875a0[_0xd889('0x31')];if(_0x5045bb['query'][_0xd889('0x48')]){_0xc0be41[_0xd889('0x43')]=[{'all':!![]}];}_0xc0be41=_['merge']({},_0xc0be41,_0x5045bb[_0xd889('0x42')]);return db[_0xd889('0x2c')][_0xd889('0x49')](_0xc0be41)[_0xd889('0x27')](handleEntityNotFound(_0x333236,null))[_0xd889('0x27')](respondWithResult(_0x333236,null))[_0xd889('0x4a')](handleError(_0x333236,null));};exports[_0xd889('0x4b')]=function(_0x305b05,_0x334da3){return db[_0xd889('0x2c')][_0xd889('0x4b')](_0x305b05['body'],{})['then'](respondWithResult(_0x334da3,0xc9))['catch'](handleError(_0x334da3,null));};exports[_0xd889('0x26')]=function(_0x3d0745,_0x2fcb0d){if(_0x3d0745['body']['id']){delete _0x3d0745[_0xd889('0x4c')]['id'];}return db[_0xd889('0x2c')]['find']({'where':{'id':_0x3d0745[_0xd889('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fcb0d,null))['then'](saveUpdates(_0x3d0745[_0xd889('0x4c')],null))[_0xd889('0x27')](respondWithResult(_0x2fcb0d,null))[_0xd889('0x4a')](handleError(_0x2fcb0d,null));};exports[_0xd889('0x28')]=function(_0x39e390,_0x48c6b7){return db[_0xd889('0x2c')][_0xd889('0x49')]({'where':{'id':_0x39e390['params']['id']}})['then'](handleEntityNotFound(_0x48c6b7,null))[_0xd889('0x27')](removeEntity(_0x48c6b7,null))[_0xd889('0x4a')](handleError(_0x48c6b7,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a665d28..678f854 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 _0xf87e=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','FieldId','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0xecf9db,_0x3d7ac9){var _0x12c581=function(_0xe89d18){while(--_0xe89d18){_0xecf9db['push'](_0xecf9db['shift']());}};_0x12c581(++_0x3d7ac9);}(_0xf87e,0x72));var _0xef87=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf87e[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xef87('0x0'));var util=require(_0xef87('0x1'));var logger=require(_0xef87('0x2'))('api');var moment=require(_0xef87('0x3'));var BPromise=require('bluebird');var rp=require(_0xef87('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef87('0x5'));var config=require('../../config/environment');var attributes=require(_0xef87('0x6'));module[_0xef87('0x7')]=function(_0x118eaf,_0x4c4e1d){return _0x118eaf[_0xef87('0x8')](_0xef87('0x9'),attributes,{'tableName':_0xef87('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xef87('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2960=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0x2960,0x112));var _0x0296=function(_0x3849ff,_0x4ae25e){_0x3849ff=_0x3849ff-0x0;var _0x3ab676=_0x2960[_0x3849ff];return _0x3ab676;};'use strict';var _=require(_0x0296('0x0'));var util=require('util');var logger=require(_0x0296('0x1'))(_0x0296('0x2'));var moment=require(_0x0296('0x3'));var BPromise=require('bluebird');var rp=require(_0x0296('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0296('0x5'));var config=require('../../config/environment');var attributes=require(_0x0296('0x6'));module[_0x0296('0x7')]=function(_0x5e5766,_0x4957aa){return _0x5e5766[_0x0296('0x8')](_0x0296('0x9'),attributes,{'tableName':_0x0296('0xa'),'paranoid':![],'indexes':[{'name':_0x0296('0xb'),'fields':[_0x0296('0xc'),_0x0296('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e8a6667..195e991 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 _0x7509=['DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x2a0c21,_0x51ad5e){var _0x28f2ff=function(_0x47739f){while(--_0x47739f){_0x2a0c21['push'](_0x2a0c21['shift']());}};_0x28f2ff(++_0x51ad5e);}(_0x7509,0xbb));var _0x9750=function(_0x5b75f1,_0x2d792c){_0x5b75f1=_0x5b75f1-0x0;var _0x2150f5=_0x7509[_0x5b75f1];return _0x2150f5;};'use strict';var _=require(_0x9750('0x0'));var util=require('util');var moment=require(_0x9750('0x1'));var BPromise=require(_0x9750('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9750('0x3'));var db=require(_0x9750('0x4'))['db'];var utils=require(_0x9750('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9750('0x6'));var jayson=require(_0x9750('0x7'));var client=jayson[_0x9750('0x8')][_0x9750('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20f2d4,_0x286614,_0x2d2062){return new BPromise(function(_0x408fa3,_0x254472){return client['request'](_0x20f2d4,_0x2d2062)[_0x9750('0xa')](function(_0x42d6d5){logger['info'](_0x9750('0xb'),_0x286614,_0x9750('0xc'));logger[_0x9750('0xd')](_0x9750('0xe'),_0x286614,_0x9750('0xc'),JSON['stringify'](_0x42d6d5));if(_0x42d6d5[_0x9750('0xf')]){if(_0x42d6d5[_0x9750('0xf')]['code']===0x1f4){logger[_0x9750('0xf')](_0x9750('0xb'),_0x286614,_0x42d6d5[_0x9750('0xf')][_0x9750('0x10')]);return _0x254472(_0x42d6d5[_0x9750('0xf')]['message']);}logger[_0x9750('0xf')](_0x9750('0xb'),_0x286614,_0x42d6d5[_0x9750('0xf')][_0x9750('0x10')]);return _0x408fa3(_0x42d6d5[_0x9750('0xf')]['message']);}else{logger['info'](_0x9750('0xb'),_0x286614,_0x9750('0xc'));_0x408fa3(_0x42d6d5['result']['message']);}})[_0x9750('0x11')](function(_0x120293){logger['error'](_0x9750('0xb'),_0x286614,_0x120293);_0x254472(_0x120293);});});} \ No newline at end of file +var _0xdd72=['info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1ac144,_0x24caed){var _0xfa9afc=function(_0x3e5b36){while(--_0x3e5b36){_0x1ac144['push'](_0x1ac144['shift']());}};_0xfa9afc(++_0x24caed);}(_0xdd72,0x15b));var _0x2dd7=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xdd72[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x2dd7('0x0'));var util=require(_0x2dd7('0x1'));var moment=require(_0x2dd7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dd7('0x3'));var db=require(_0x2dd7('0x4'))['db'];var utils=require(_0x2dd7('0x5'));var logger=require(_0x2dd7('0x6'))(_0x2dd7('0x7'));var config=require(_0x2dd7('0x8'));var jayson=require(_0x2dd7('0x9'));var client=jayson['client'][_0x2dd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43bd73,_0x2a6c1f,_0x559efb){return new BPromise(function(_0x11c863,_0x47f8d8){return client[_0x2dd7('0xb')](_0x43bd73,_0x559efb)[_0x2dd7('0xc')](function(_0x111f9c){logger[_0x2dd7('0xd')](_0x2dd7('0xe'),_0x2a6c1f,'request\x20sent');logger[_0x2dd7('0xf')](_0x2dd7('0x10'),_0x2a6c1f,'request\x20sent',JSON[_0x2dd7('0x11')](_0x111f9c));if(_0x111f9c[_0x2dd7('0x12')]){if(_0x111f9c[_0x2dd7('0x12')][_0x2dd7('0x13')]===0x1f4){logger[_0x2dd7('0x12')](_0x2dd7('0xe'),_0x2a6c1f,_0x111f9c['error'][_0x2dd7('0x14')]);return _0x47f8d8(_0x111f9c['error'][_0x2dd7('0x14')]);}logger[_0x2dd7('0x12')](_0x2dd7('0xe'),_0x2a6c1f,_0x111f9c[_0x2dd7('0x12')][_0x2dd7('0x14')]);return _0x11c863(_0x111f9c[_0x2dd7('0x12')][_0x2dd7('0x14')]);}else{logger[_0x2dd7('0xd')](_0x2dd7('0xe'),_0x2a6c1f,_0x2dd7('0x15'));_0x11c863(_0x111f9c[_0x2dd7('0x16')]['message']);}})[_0x2dd7('0x17')](function(_0x54a2e1){logger[_0x2dd7('0x12')](_0x2dd7('0xe'),_0x2a6c1f,_0x54a2e1);_0x47f8d8(_0x54a2e1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 78baea8..1219e0a 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 _0x104e=['getFields','post','addConfiguration','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5536d0,_0x377783){var _0x181794=function(_0x3335a3){while(--_0x3335a3){_0x5536d0['push'](_0x5536d0['shift']());}};_0x181794(++_0x377783);}(_0x104e,0x18d));var _0xe104=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x104e[_0x41d432];return _0x1650f9;};'use strict';var multer=require('multer');var util=require(_0xe104('0x0'));var path=require('path');var timeout=require(_0xe104('0x1'));var express=require(_0xe104('0x2'));var router=express[_0xe104('0x3')]();var fs_extra=require(_0xe104('0x4'));var auth=require(_0xe104('0x5'));var interaction=require(_0xe104('0x6'));var config=require(_0xe104('0x7'));var controller=require(_0xe104('0x8'));router['get']('/',auth[_0xe104('0x9')](),controller[_0xe104('0xa')]);router[_0xe104('0xb')](_0xe104('0xc'),auth[_0xe104('0x9')](),controller[_0xe104('0xd')]);router[_0xe104('0xb')](_0xe104('0xe'),auth['isAuthenticated'](),controller[_0xe104('0xf')]);router[_0xe104('0xb')](_0xe104('0x10'),auth[_0xe104('0x9')](),controller[_0xe104('0x11')]);router[_0xe104('0x12')]('/',auth[_0xe104('0x9')](),controller['create']);router[_0xe104('0x12')]('/:id/configurations',auth[_0xe104('0x9')](),controller[_0xe104('0x13')]);router[_0xe104('0x14')](_0xe104('0xc'),auth[_0xe104('0x9')](),controller[_0xe104('0x15')]);router['delete'](_0xe104('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe104('0x16')]=router; \ No newline at end of file +var _0xa08e=['../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x1d3157,_0x56e7fd){var _0x57b437=function(_0x2fe16a){while(--_0x2fe16a){_0x1d3157['push'](_0x1d3157['shift']());}};_0x57b437(++_0x56e7fd);}(_0xa08e,0x16b));var _0xea08=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0xa08e[_0x3239f5];return _0x3559c8;};'use strict';var multer=require(_0xea08('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea08('0x1'));var express=require(_0xea08('0x2'));var router=express[_0xea08('0x3')]();var fs_extra=require(_0xea08('0x4'));var auth=require(_0xea08('0x5'));var interaction=require(_0xea08('0x6'));var config=require('../../config/environment');var controller=require(_0xea08('0x7'));router[_0xea08('0x8')]('/',auth[_0xea08('0x9')](),controller[_0xea08('0xa')]);router[_0xea08('0x8')](_0xea08('0xb'),auth[_0xea08('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0xea08('0x9')](),controller[_0xea08('0xc')]);router[_0xea08('0x8')](_0xea08('0xd'),auth[_0xea08('0x9')](),controller[_0xea08('0xe')]);router[_0xea08('0xf')]('/',auth[_0xea08('0x9')](),controller[_0xea08('0x10')]);router[_0xea08('0xf')](_0xea08('0x11'),auth[_0xea08('0x9')](),controller[_0xea08('0x12')]);router['put'](_0xea08('0xb'),auth[_0xea08('0x9')](),controller[_0xea08('0x13')]);router[_0xea08('0x14')](_0xea08('0xb'),auth['isAuthenticated'](),controller[_0xea08('0x15')]);module[_0xea08('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7a137b7..42db1aa 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 _0x40b1=['STRING','sequelize'];(function(_0x4a5ba3,_0x519c8c){var _0x5ae08e=function(_0x18aa15){while(--_0x18aa15){_0x4a5ba3['push'](_0x4a5ba3['shift']());}};_0x5ae08e(++_0x519c8c);}(_0x40b1,0x18f));var _0x140b=function(_0xb38240,_0xb5cc0b){_0xb38240=_0xb38240-0x0;var _0x566a50=_0x40b1[_0xb38240];return _0x566a50;};'use strict';var Sequelize=require(_0x140b('0x0'));module['exports']={'name':{'type':Sequelize[_0x140b('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x140b('0x1')]},'tenantId':{'type':Sequelize[_0x140b('0x1')]},'clientId':{'type':Sequelize[_0x140b('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x140b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x140b('0x1')]}}; \ No newline at end of file +var _0x397b=['STRING','sequelize','exports'];(function(_0x19e015,_0xd4b71e){var _0x19abf1=function(_0x44e795){while(--_0x44e795){_0x19e015['push'](_0x19e015['shift']());}};_0x19abf1(++_0xd4b71e);}(_0x397b,0xeb));var _0xb397=function(_0x13394d,_0x5699b3){_0x13394d=_0x13394d-0x0;var _0x4213d6=_0x397b[_0x13394d];return _0x4213d6;};'use strict';var Sequelize=require(_0xb397('0x0'));module[_0xb397('0x1')]={'name':{'type':Sequelize[_0xb397('0x2')]},'username':{'type':Sequelize[_0xb397('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb397('0x2')]},'clientId':{'type':Sequelize[_0xb397('0x2')]},'clientSecret':{'type':Sequelize[_0xb397('0x2')]},'serverUrl':{'type':Sequelize[_0xb397('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb397('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1de2323..3471f08 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 _0xac55=['transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','POST','https://login.microsoftonline.com/','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','rows','catch','show','params','keys','find','create','body','getConfigurations','Dynamics365Configuration','order','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xac55,0x1c8));var _0x5ac5=function(_0x1f397e,_0x4e20ef){_0x1f397e=_0x1f397e-0x0;var _0x2d7722=_0xac55[_0x1f397e];return _0x2d7722;};'use strict';var emlformat=require(_0x5ac5('0x0'));var rimraf=require(_0x5ac5('0x1'));var zipdir=require(_0x5ac5('0x2'));var jsonpatch=require(_0x5ac5('0x3'));var rp=require('request-promise');var moment=require(_0x5ac5('0x4'));var BPromise=require(_0x5ac5('0x5'));var Mustache=require(_0x5ac5('0x6'));var util=require(_0x5ac5('0x7'));var path=require(_0x5ac5('0x8'));var sox=require(_0x5ac5('0x9'));var csv=require(_0x5ac5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ac5('0xb'));var squel=require(_0x5ac5('0xc'));var crypto=require(_0x5ac5('0xd'));var jsforce=require(_0x5ac5('0xe'));var deskjs=require(_0x5ac5('0xf'));var toCsv=require(_0x5ac5('0xa'));var querystring=require(_0x5ac5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ac5('0x11'));var qs=require(_0x5ac5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ac5('0x13'));var logger=require(_0x5ac5('0x14'))('api');var utils=require(_0x5ac5('0x15'));var config=require(_0x5ac5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ac5('0x17'))['db'];var integrations=require(_0x5ac5('0x18'));function respondWithStatusCode(_0x7c4f62,_0x13fad8){_0x13fad8=_0x13fad8||0xcc;return function(_0x34260c){if(_0x34260c){return _0x7c4f62['sendStatus'](_0x13fad8);}return _0x7c4f62[_0x5ac5('0x19')](_0x13fad8)['end']();};}function respondWithResult(_0x1ce256,_0x40ee8a){_0x40ee8a=_0x40ee8a||0xc8;return function(_0x58e6f7){if(_0x58e6f7){return _0x1ce256[_0x5ac5('0x19')](_0x40ee8a)['json'](_0x58e6f7);}};}function respondWithFilteredResult(_0x2a145d,_0x340195){return function(_0x30244d){if(_0x30244d){var _0x1282be=typeof _0x340195[_0x5ac5('0x1a')]===_0x5ac5('0x1b')&&typeof _0x340195[_0x5ac5('0x1c')]==='undefined';var _0x4e186a=_0x30244d['count'];var _0x3c6062=_0x1282be?0x0:_0x340195[_0x5ac5('0x1a')];var _0x4ece77=_0x1282be?_0x30244d[_0x5ac5('0x1d')]:_0x340195['offset']+_0x340195[_0x5ac5('0x1c')];var _0x5b4b80;if(_0x4ece77>=_0x4e186a){_0x4ece77=_0x4e186a;_0x5b4b80=0xc8;}else{_0x5b4b80=0xce;}_0x2a145d['status'](_0x5b4b80);return _0x2a145d[_0x5ac5('0x1e')]('Content-Range',_0x3c6062+'-'+_0x4ece77+'/'+_0x4e186a)[_0x5ac5('0x1f')](_0x30244d);}return null;};}function patchUpdates(_0x3cb669){return function(_0x5c21d8){try{jsonpatch[_0x5ac5('0x20')](_0x5c21d8,_0x3cb669,!![]);}catch(_0x4ac526){return BPromise[_0x5ac5('0x21')](_0x4ac526);}return _0x5c21d8[_0x5ac5('0x22')]();};}function saveUpdates(_0x47993e,_0x47a898){return function(_0x1bd881){if(_0x1bd881){return _0x1bd881[_0x5ac5('0x23')](_0x47993e)[_0x5ac5('0x24')](function(_0x182683){return _0x182683;});}return null;};}function removeEntity(_0xee1c62,_0x4dec2f){return function(_0x6e1120){if(_0x6e1120){return _0x6e1120[_0x5ac5('0x25')]()[_0x5ac5('0x24')](function(){_0xee1c62[_0x5ac5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22398f,_0x4eda97){return function(_0x17c507){if(!_0x17c507){_0x22398f[_0x5ac5('0x26')](0x194);}return _0x17c507;};}function handleError(_0x1d78cf,_0x2cb82f){_0x2cb82f=_0x2cb82f||0x1f4;return function(_0x3ab796){logger[_0x5ac5('0x27')](_0x3ab796['stack']);if(_0x3ab796[_0x5ac5('0x28')]){delete _0x3ab796['name'];}_0x1d78cf[_0x5ac5('0x19')](_0x2cb82f)[_0x5ac5('0x29')](_0x3ab796);};}exports[_0x5ac5('0x2a')]=function(_0x509db7,_0x283c41){var _0x229941={},_0x21df31={},_0x21307c={'count':0x0,'rows':[]};var _0x4eafa1=_[_0x5ac5('0x2b')](db['Dynamics365Account'][_0x5ac5('0x2c')],function(_0x383d8c){return{'name':_0x383d8c[_0x5ac5('0x2d')],'type':_0x383d8c[_0x5ac5('0x2e')][_0x5ac5('0x2f')]};});_0x21df31['model']=_[_0x5ac5('0x2b')](_0x4eafa1,_0x5ac5('0x28'));_0x21df31[_0x5ac5('0x30')]=_['keys'](_0x509db7[_0x5ac5('0x30')]);_0x21df31['filters']=_[_0x5ac5('0x31')](_0x21df31[_0x5ac5('0x32')],_0x21df31[_0x5ac5('0x30')]);_0x229941[_0x5ac5('0x33')]=_[_0x5ac5('0x31')](_0x21df31['model'],qs[_0x5ac5('0x34')](_0x509db7['query'][_0x5ac5('0x34')]));_0x229941['attributes']=_0x229941[_0x5ac5('0x33')][_0x5ac5('0x35')]?_0x229941['attributes']:_0x21df31[_0x5ac5('0x32')];if(!_0x509db7[_0x5ac5('0x30')]['hasOwnProperty']('nolimit')){_0x229941[_0x5ac5('0x1c')]=qs[_0x5ac5('0x1c')](_0x509db7[_0x5ac5('0x30')][_0x5ac5('0x1c')]);_0x229941[_0x5ac5('0x1a')]=qs[_0x5ac5('0x1a')](_0x509db7['query']['offset']);}_0x229941['order']=qs[_0x5ac5('0x36')](_0x509db7[_0x5ac5('0x30')]['sort']);_0x229941[_0x5ac5('0x37')]=qs[_0x5ac5('0x38')](_[_0x5ac5('0x39')](_0x509db7[_0x5ac5('0x30')],_0x21df31[_0x5ac5('0x38')]),_0x4eafa1);if(_0x509db7[_0x5ac5('0x30')][_0x5ac5('0x3a')]){_0x229941[_0x5ac5('0x37')]=_[_0x5ac5('0x3b')](_0x229941['where'],{'$or':_[_0x5ac5('0x2b')](_0x4eafa1,function(_0x59d999){if(_0x59d999[_0x5ac5('0x2e')]!==_0x5ac5('0x3c')){var _0x1ca0f0={};_0x1ca0f0[_0x59d999[_0x5ac5('0x28')]]={'$like':'%'+_0x509db7[_0x5ac5('0x30')][_0x5ac5('0x3a')]+'%'};return _0x1ca0f0;}})});}_0x229941=_[_0x5ac5('0x3b')]({},_0x229941,_0x509db7[_0x5ac5('0x3d')]);var _0x3ffad6={'where':_0x229941['where']};return db[_0x5ac5('0x3e')][_0x5ac5('0x1d')](_0x3ffad6)['then'](function(_0x552757){_0x21307c[_0x5ac5('0x1d')]=_0x552757;if(_0x509db7['query'][_0x5ac5('0x3f')]){_0x229941[_0x5ac5('0x40')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x229941);})[_0x5ac5('0x24')](function(_0x2097c5){_0x21307c[_0x5ac5('0x41')]=_0x2097c5;return _0x21307c;})[_0x5ac5('0x24')](respondWithFilteredResult(_0x283c41,_0x229941))[_0x5ac5('0x42')](handleError(_0x283c41,null));};exports[_0x5ac5('0x43')]=function(_0x151c5e,_0x5a86a0){var _0x1d4ef5={'raw':![],'where':{'id':_0x151c5e[_0x5ac5('0x44')]['id']}},_0x212f5c={};_0x212f5c[_0x5ac5('0x32')]=_[_0x5ac5('0x45')](db[_0x5ac5('0x3e')]['rawAttributes']);_0x212f5c[_0x5ac5('0x30')]=_[_0x5ac5('0x45')](_0x151c5e[_0x5ac5('0x30')]);_0x212f5c[_0x5ac5('0x38')]=_['intersection'](_0x212f5c[_0x5ac5('0x32')],_0x212f5c[_0x5ac5('0x30')]);_0x1d4ef5[_0x5ac5('0x33')]=_['intersection'](_0x212f5c['model'],qs[_0x5ac5('0x34')](_0x151c5e[_0x5ac5('0x30')][_0x5ac5('0x34')]));_0x1d4ef5[_0x5ac5('0x33')]=_0x1d4ef5['attributes'][_0x5ac5('0x35')]?_0x1d4ef5['attributes']:_0x212f5c[_0x5ac5('0x32')];if(_0x151c5e[_0x5ac5('0x30')]['includeAll']){_0x1d4ef5[_0x5ac5('0x40')]=[{'all':!![]}];}_0x1d4ef5=_['merge']({},_0x1d4ef5,_0x151c5e[_0x5ac5('0x3d')]);return db[_0x5ac5('0x3e')][_0x5ac5('0x46')](_0x1d4ef5)['then'](handleEntityNotFound(_0x5a86a0,null))['then'](respondWithResult(_0x5a86a0,null))[_0x5ac5('0x42')](handleError(_0x5a86a0,null));};exports[_0x5ac5('0x47')]=function(_0xd6ae55,_0x27357b){return db[_0x5ac5('0x3e')][_0x5ac5('0x47')](_0xd6ae55[_0x5ac5('0x48')],{})[_0x5ac5('0x24')](respondWithResult(_0x27357b,0xc9))[_0x5ac5('0x42')](handleError(_0x27357b,null));};exports['update']=function(_0x2d6aa5,_0xe44c3b){if(_0x2d6aa5[_0x5ac5('0x48')]['id']){delete _0x2d6aa5['body']['id'];}return db['Dynamics365Account'][_0x5ac5('0x46')]({'where':{'id':_0x2d6aa5[_0x5ac5('0x44')]['id']}})[_0x5ac5('0x24')](handleEntityNotFound(_0xe44c3b,null))['then'](saveUpdates(_0x2d6aa5[_0x5ac5('0x48')],null))[_0x5ac5('0x24')](respondWithResult(_0xe44c3b,null))[_0x5ac5('0x42')](handleError(_0xe44c3b,null));};exports[_0x5ac5('0x25')]=function(_0x326f60,_0x327952){return db[_0x5ac5('0x3e')]['find']({'where':{'id':_0x326f60['params']['id']}})['then'](handleEntityNotFound(_0x327952,null))[_0x5ac5('0x24')](removeEntity(_0x327952,null))[_0x5ac5('0x42')](handleError(_0x327952,null));};exports[_0x5ac5('0x49')]=function(_0x503623,_0x1973f6,_0x31345e){var _0x270825={};var _0x286304={};var _0x137ec3;var _0x4e89a6;return db['Dynamics365Account']['findOne']({'where':{'id':_0x503623[_0x5ac5('0x44')]['id']}})[_0x5ac5('0x24')](handleEntityNotFound(_0x1973f6,null))[_0x5ac5('0x24')](function(_0x3fb4c1){if(_0x3fb4c1){_0x137ec3=_0x3fb4c1;_0x286304[_0x5ac5('0x32')]=_[_0x5ac5('0x45')](db[_0x5ac5('0x4a')][_0x5ac5('0x2c')]);_0x286304[_0x5ac5('0x30')]=_[_0x5ac5('0x45')](_0x503623[_0x5ac5('0x30')]);_0x286304[_0x5ac5('0x38')]=_[_0x5ac5('0x31')](_0x286304[_0x5ac5('0x32')],_0x286304[_0x5ac5('0x30')]);_0x270825['attributes']=_[_0x5ac5('0x31')](_0x286304[_0x5ac5('0x32')],qs['fields'](_0x503623[_0x5ac5('0x30')][_0x5ac5('0x34')]));_0x270825[_0x5ac5('0x33')]=_0x270825[_0x5ac5('0x33')][_0x5ac5('0x35')]?_0x270825[_0x5ac5('0x33')]:_0x286304['model'];_0x270825[_0x5ac5('0x4b')]=qs[_0x5ac5('0x36')](_0x503623[_0x5ac5('0x30')]['sort']);_0x270825[_0x5ac5('0x37')]=qs[_0x5ac5('0x38')](_['pick'](_0x503623[_0x5ac5('0x30')],_0x286304[_0x5ac5('0x38')]));if(_0x503623['query']['filter']){_0x270825['where']=_[_0x5ac5('0x3b')](_0x270825[_0x5ac5('0x37')],{'$or':_[_0x5ac5('0x2b')](_0x270825[_0x5ac5('0x33')],function(_0x465621){var _0x210b5f={};_0x210b5f[_0x465621]={'$like':'%'+_0x503623['query'][_0x5ac5('0x3a')]+'%'};return _0x210b5f;})});}_0x270825=_[_0x5ac5('0x3b')]({},_0x270825,_0x503623[_0x5ac5('0x3d')]);return _0x137ec3[_0x5ac5('0x49')](_0x270825);}})[_0x5ac5('0x24')](function(_0x4b966f){if(_0x4b966f){_0x4e89a6=_0x4b966f['length'];if(!_0x503623['query'][_0x5ac5('0x4c')](_0x5ac5('0x4d'))){_0x270825[_0x5ac5('0x1c')]=qs[_0x5ac5('0x1c')](_0x503623['query'][_0x5ac5('0x1c')]);_0x270825[_0x5ac5('0x1a')]=qs[_0x5ac5('0x1a')](_0x503623['query']['offset']);}return _0x137ec3['getConfigurations'](_0x270825);}})[_0x5ac5('0x24')](function(_0x2375ae){if(_0x2375ae){return _0x2375ae?{'count':_0x4e89a6,'rows':_0x2375ae}:null;}})[_0x5ac5('0x24')](respondWithResult(_0x1973f6,null))[_0x5ac5('0x42')](handleError(_0x1973f6,null));};exports[_0x5ac5('0x4e')]=function(_0x3b7e70,_0x53a641,_0x8ce51b){if(_0x3b7e70['body']['id']){delete _0x3b7e70['body']['id'];}return db[_0x5ac5('0x3e')][_0x5ac5('0x4f')]({'where':{'id':_0x3b7e70[_0x5ac5('0x44')]['id']}})[_0x5ac5('0x24')](handleEntityNotFound(_0x53a641,null))[_0x5ac5('0x24')](function(_0xc89445){if(_0xc89445){_0x3b7e70[_0x5ac5('0x48')][_0x5ac5('0x50')]=_0xc89445['id'];_0x3b7e70[_0x5ac5('0x48')][_0x5ac5('0x51')]=integrations[_0x5ac5('0x52')](_0x3b7e70[_0x5ac5('0x48')][_0x5ac5('0x53')],_0x3b7e70[_0x5ac5('0x48')][_0x5ac5('0x2e')]);_0x3b7e70[_0x5ac5('0x48')][_0x5ac5('0x54')]=integrations[_0x5ac5('0x55')](_0x3b7e70[_0x5ac5('0x48')][_0x5ac5('0x53')],_0x3b7e70[_0x5ac5('0x48')]['type']);return db[_0x5ac5('0x4a')]['create'](_0x3b7e70[_0x5ac5('0x48')],{'include':[{'model':db['Dynamics365Field'],'as':_0x5ac5('0x51')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x5ac5('0x24')](respondWithResult(_0x53a641,null))['catch'](handleError(_0x53a641,null));};exports[_0x5ac5('0x56')]=function(_0x396c9d,_0x4b04bd,_0x337645){var _0x11c8d4=_0x396c9d[_0x5ac5('0x30')][_0x5ac5('0x57')];var _0xd80c99=_0x11c8d4===_0x5ac5('0x58')?'Incident':_0x5ac5('0x59');var _0x5b5758='';var _0x23cbe6='';var _0x2099a6='';var _0xb7aa89='';var _0x4dd4a4='';var _0x3f1409='';var _0xca16ec='';var _0x3e5b4b='';var _0x4c5c66=[_0x5ac5('0x5a'),_0x5ac5('0x5b'),_0x5ac5('0x5c'),_0x5ac5('0x5d'),_0x5ac5('0x5e'),'subject','phonenumber',_0x5ac5('0x5f'),_0x5ac5('0x60'),_0x5ac5('0x61')];var _0x21d8f5=[_0x5ac5('0x62'),_0x5ac5('0x63'),'actualserviceunits',_0x5ac5('0x64'),_0x5ac5('0x65'),_0x5ac5('0x66'),_0x5ac5('0x67'),_0x5ac5('0x68'),_0x5ac5('0x69'),_0x5ac5('0x6a'),_0x5ac5('0x6b'),_0x5ac5('0x6c'),_0x5ac5('0x6d'),'createdonbehalfbyname',_0x5ac5('0x6e'),_0x5ac5('0x6f'),_0x5ac5('0x70'),'customeridyominame',_0x5ac5('0x71'),_0x5ac5('0x72'),_0x5ac5('0x73'),_0x5ac5('0x74'),_0x5ac5('0x75'),_0x5ac5('0x76'),_0x5ac5('0x77'),'followupby',_0x5ac5('0x78'),'influencescore',_0x5ac5('0x79'),_0x5ac5('0x7a'),_0x5ac5('0x7b'),_0x5ac5('0x7c'),'modifiedbyexternalpartyyominame',_0x5ac5('0x7d'),'modifiedbyyominame',_0x5ac5('0x7e'),_0x5ac5('0x7f'),_0x5ac5('0x80'),'msdyn_incidenttypename',_0x5ac5('0x81'),'numberofchildincidents',_0x5ac5('0x82'),_0x5ac5('0x83'),_0x5ac5('0x84'),_0x5ac5('0x85'),'owneridyominame','parentcaseidname',_0x5ac5('0x86'),'primarycontactidyominame','prioritycodename',_0x5ac5('0x87'),_0x5ac5('0x88'),_0x5ac5('0x89'),_0x5ac5('0x8a'),'responseby',_0x5ac5('0x8b'),_0x5ac5('0x8c'),_0x5ac5('0x8d'),'slainvokedidname',_0x5ac5('0x8e'),_0x5ac5('0x8f'),'statecode',_0x5ac5('0x90'),'subjectidname',_0x5ac5('0x91'),_0x5ac5('0x92'),_0x5ac5('0x93'),_0x5ac5('0x94'),'utcconversiontimezonecode',_0x5ac5('0x95')];var _0x517e24=_0x4c5c66[_0x5ac5('0x96')](_0x21d8f5);return db[_0x5ac5('0x3e')][_0x5ac5('0x4f')]({'where':{'id':_0x396c9d['params']['id']},'attributes':['id',_0x5ac5('0x97'),_0x5ac5('0x98'),_0x5ac5('0x99'),_0x5ac5('0x9a'),_0x5ac5('0x9b'),_0x5ac5('0x9c')]})['then'](handleEntityNotFound(_0x4b04bd,null))[_0x5ac5('0x24')](function(_0x4719b5){if(_0x4719b5){_0x3e5b4b=_0x4719b5['remoteUri'];var _0x38a977=_0x3e5b4b[_0x5ac5('0x9d')](-0x1);if(_0x38a977==='/'){_0x3e5b4b=_0x3e5b4b[_0x5ac5('0x9e')](0x0,_0x3e5b4b['lastIndexOf'](_0x38a977));}_0xca16ec=util['format']('%s/api/data/v9.0/',_0x3e5b4b);var _0x479c71={'method':_0x5ac5('0x9f'),'uri':_0x5ac5('0xa0')+_0x4719b5[_0x5ac5('0x9a')]+'/oauth2/token','form':{'client_id':_0x4719b5[_0x5ac5('0x9b')],'resource':_0x3e5b4b,'username':_0x4719b5['username'],'password':_0x4719b5[_0x5ac5('0x98')],'grant_type':'password','client_secret':_0x4719b5[_0x5ac5('0x9c')]},'json':!![]};return rp(_0x479c71);}})['then'](function(_0x1ac8a8){_0x3f1409=_0x1ac8a8[_0x5ac5('0xa1')];var _0x17faf8={'method':_0x5ac5('0xa2'),'uri':encodeURI(_0xca16ec+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xd80c99+'\x27'),'headers':{'Authorization':_0x5ac5('0xa3')+_0x3f1409,'If-None-Match':null,'OData-Version':_0x5ac5('0xa4')},'json':!![]};return rp(_0x17faf8);})[_0x5ac5('0x24')](function(_0x34c37e){var _0x4f06ca=_0x34c37e[_0x5ac5('0xa5')][0x0];var _0x1f2455=_0x4f06ca[_0x5ac5('0xa6')];var _0x489832={'method':'GET','uri':_0xca16ec+_0x5ac5('0xa7')+_0x1f2455+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x3f1409,'If-None-Match':null,'OData-Version':_0x5ac5('0xa4')},'json':!![]};return rp(_0x489832);})[_0x5ac5('0x24')](function(_0x127b44){_0x5b5758=_0x127b44;_0x23cbe6=_0x5b5758['Attributes'];_0x23cbe6=_[_0x5ac5('0xa8')](_0x23cbe6,function(_0x5e4c11){return!_0x517e24[_0x5ac5('0xa9')](_0x5e4c11[_0x5ac5('0xaa')]);});var _0x1b27f2=[];var _0x482d6f=[];_0x23cbe6['forEach'](function(_0x3cda1b){if(_0x3cda1b[_0x5ac5('0xab')]){var _0x31bdf6=_0x3cda1b[_0x5ac5('0xab')][_0x5ac5('0x9e')](_0x3cda1b[_0x5ac5('0xab')][_0x5ac5('0xac')]('.')+0x1);if(_0x31bdf6===_0x5ac5('0xad')){_0x1b27f2['push'](getSelectList(_0xca16ec,_0x11c8d4,_0x482d6f,_0x5b5758[_0x5ac5('0xa6')],_0x3cda1b[_0x5ac5('0xa6')],_0x3f1409));}}});return Promise[_0x5ac5('0xae')](_0x1b27f2);})[_0x5ac5('0x24')](function(_0x482501){_0x2099a6=_0x482501[0x0];var _0x6345fa=[];var _0x257b83=[];_0x23cbe6[_0x5ac5('0xaf')](function(_0x4fa6b0){if(!_[_0x5ac5('0xb0')](_0x4fa6b0[_0x5ac5('0xab')])){var _0x361e93=_0x4fa6b0[_0x5ac5('0xab')]['substring'](_0x4fa6b0[_0x5ac5('0xab')][_0x5ac5('0xac')]('.')+0x1);if(_0x361e93===_0x5ac5('0xb1')){_0x6345fa[_0x5ac5('0xb2')](getBooleanList(_0xca16ec,_0x11c8d4,_0x257b83,_0x5b5758['MetadataId'],_0x4fa6b0[_0x5ac5('0xa6')],_0x3f1409));}}});return Promise[_0x5ac5('0xae')](_0x6345fa);})[_0x5ac5('0x24')](function(_0x2b9338){_0xb7aa89=_0x2b9338[0x0];var _0x459e0f=[];var _0x21643c=[];_0x23cbe6[_0x5ac5('0xaf')](function(_0x41a3c2){if(_0x41a3c2['@odata.type']){var _0xf2255c=_0x41a3c2[_0x5ac5('0xab')]['substring'](_0x41a3c2[_0x5ac5('0xab')][_0x5ac5('0xac')]('.')+0x1);if(_0xf2255c===_0x5ac5('0xb3')||_0xf2255c==='DoubleAttributeMetadata'||_0xf2255c===_0x5ac5('0xb4')||_0xf2255c===_0x5ac5('0xb5')||_0xf2255c===_0x5ac5('0xb6')||_0xf2255c==='DateTimeAttributeMetadata'||_0xf2255c===_0x5ac5('0xb7')||_0xf2255c===_0x5ac5('0xb8')||_0xf2255c==='StateAttributeMetadata'||_0xf2255c===_0x5ac5('0xb9')){_0x459e0f['push'](getInputList(_0xca16ec,_0x11c8d4,_0xf2255c,_0x21643c,_0x5b5758[_0x5ac5('0xa6')],_0x41a3c2[_0x5ac5('0xa6')],_0x3f1409));}}});return Promise[_0x5ac5('0xae')](_0x459e0f);})[_0x5ac5('0x24')](function(_0x2895de){_0x4dd4a4=_0x2895de[0x0];var _0x1e7b16=_0x2099a6[_0x5ac5('0x96')](_0xb7aa89)[_0x5ac5('0x96')](_0x4dd4a4);var _0x1bba5b={'count':_0x1e7b16['length'],'rows':_0x1e7b16};return _0x1bba5b;})[_0x5ac5('0x24')](respondWithResult(_0x4b04bd,null))['catch'](function(_0x1a22ac){var _0x4e780e=_0x396c9d[_0x5ac5('0x30')][_0x5ac5('0xba')]?0x1f4:_0x1a22ac[_0x5ac5('0xbb')]||0x1f4;logger['error'](_0x1a22ac['stack']);delete _0x1a22ac['name'];if(_0x4e780e===0x191){_0x4e780e=0x190;}_0x4b04bd['status'](_0x4e780e)[_0x5ac5('0x29')](_0x396c9d[_0x5ac5('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1a22ac[_0x5ac5('0xbb')]}:_0x1a22ac);});};function getSelectList(_0x358001,_0x28ccde,_0xab9d7e,_0x1f1f16,_0x5a5bb9,_0x34e5f3){var _0x59aea8={'method':_0x5ac5('0xa2'),'uri':_0x358001+_0x5ac5('0xa7')+_0x1f1f16+')/Attributes('+_0x5a5bb9+_0x5ac5('0xbc')+_0x5ac5('0xbd'),'headers':{'Authorization':_0x5ac5('0xa3')+_0x34e5f3,'If-None-Match':null,'OData-Version':_0x5ac5('0xa4')},'json':!![]};return rp(_0x59aea8)[_0x5ac5('0x24')](function(_0x4fe4ce){var _0x52978b=[];var _0x315d7d=_0x4fe4ce[_0x5ac5('0xbe')][_0x5ac5('0xbf')];_0x315d7d[_0x5ac5('0xaf')](function(_0x2ce0e4){_0x52978b[_0x5ac5('0xb2')]({'name':_0x2ce0e4[_0x5ac5('0xc0')]['UserLocalizedLabel'][_0x5ac5('0xc0')],'value':String(_0x2ce0e4[_0x5ac5('0xc1')])});});var _0x1c4bf6={'id':_0x28ccde+'_'+_0x4fe4ce[_0x5ac5('0xaa')],'name':_0x4fe4ce[_0x5ac5('0xc2')][_0x5ac5('0xc3')][_0x5ac5('0xc0')],'custom':![],'options':_0x52978b};_0xab9d7e[_0x5ac5('0xb2')](_0x1c4bf6);return _0xab9d7e;});}function getBooleanList(_0x5aacb1,_0x4e32ce,_0x1077f6,_0x1a40b1,_0x221448,_0x4dee13){var _0x208f82={'method':_0x5ac5('0xa2'),'uri':_0x5aacb1+_0x5ac5('0xa7')+_0x1a40b1+')/Attributes('+_0x221448+_0x5ac5('0xc4'),'headers':{'Authorization':_0x5ac5('0xa3')+_0x4dee13,'If-None-Match':null,'OData-Version':_0x5ac5('0xa4')},'json':!![]};return rp(_0x208f82)['then'](function(_0x103d28){var _0x323757=[];_0x323757['push']({'name':_0x103d28['OptionSet'][_0x5ac5('0xc5')][_0x5ac5('0xc0')][_0x5ac5('0xc3')]['Label'],'value':_0x5ac5('0xc6')},{'name':_0x103d28[_0x5ac5('0xbe')][_0x5ac5('0xc7')][_0x5ac5('0xc0')][_0x5ac5('0xc3')][_0x5ac5('0xc0')],'value':'false'});var _0x2673ac={'id':_0x4e32ce+'_'+_0x103d28[_0x5ac5('0xaa')],'name':_0x103d28['DisplayName'][_0x5ac5('0xc3')]['Label'],'custom':![],'options':_0x323757};_0x1077f6['push'](_0x2673ac);return _0x1077f6;});}function getInputList(_0x14f547,_0x2523f6,_0x509f25,_0x1620b3,_0xdeaeed,_0xc69a7c,_0x28a8f2){var _0x21daa2={'method':'GET','uri':_0x14f547+_0x5ac5('0xa7')+_0xdeaeed+')/Attributes('+_0xc69a7c+_0x5ac5('0xc8')+_0x509f25+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x5ac5('0xa3')+_0x28a8f2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21daa2)['then'](function(_0x32d25f){var _0x2ec6ad={'id':_0x2523f6+'_'+_0x32d25f[_0x5ac5('0xaa')],'name':_0x32d25f[_0x5ac5('0xc2')][_0x5ac5('0xc3')]?_0x32d25f[_0x5ac5('0xc2')][_0x5ac5('0xc3')][_0x5ac5('0xc0')]:_0x32d25f[_0x5ac5('0xaa')],'custom':![],'options':[]};_0x1620b3[_0x5ac5('0xb2')](_0x2ec6ad);return _0x1620b3;});} \ No newline at end of file +var _0x12c9=['remove','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','stack','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','error','name','send','index','Dynamics365Account','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','getConfigurations','Dynamics365Configuration','map','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','findOne','username','password','remoteUri','tenantId','clientId','slice','substring','format','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(','Attributes'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x12c9,0x1c9));var _0x912c=function(_0x5325a0,_0x41dbf7){_0x5325a0=_0x5325a0-0x0;var _0x27bb2=_0x12c9[_0x5325a0];return _0x27bb2;};'use strict';var emlformat=require(_0x912c('0x0'));var rimraf=require(_0x912c('0x1'));var zipdir=require(_0x912c('0x2'));var jsonpatch=require(_0x912c('0x3'));var rp=require(_0x912c('0x4'));var moment=require('moment');var BPromise=require(_0x912c('0x5'));var Mustache=require(_0x912c('0x6'));var util=require(_0x912c('0x7'));var path=require(_0x912c('0x8'));var sox=require(_0x912c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x912c('0xa'));var _=require(_0x912c('0xb'));var squel=require(_0x912c('0xc'));var crypto=require(_0x912c('0xd'));var jsforce=require(_0x912c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x912c('0xf'));var querystring=require('querystring');var Papa=require(_0x912c('0x10'));var Redis=require('ioredis');var authService=require(_0x912c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x912c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x912c('0x13'))(_0x912c('0x14'));var utils=require('../../config/utils');var config=require(_0x912c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x912c('0x16'))['db'];var integrations=require(_0x912c('0x17'));function respondWithStatusCode(_0x16481f,_0x25abd8){_0x25abd8=_0x25abd8||0xcc;return function(_0x325880){if(_0x325880){return _0x16481f['sendStatus'](_0x25abd8);}return _0x16481f[_0x912c('0x18')](_0x25abd8)['end']();};}function respondWithResult(_0x28cdb4,_0x3682cf){_0x3682cf=_0x3682cf||0xc8;return function(_0x5d9605){if(_0x5d9605){return _0x28cdb4[_0x912c('0x18')](_0x3682cf)[_0x912c('0x19')](_0x5d9605);}};}function respondWithFilteredResult(_0x2ddbf6,_0x2a67db){return function(_0xf102be){if(_0xf102be){var _0x11c2a6=typeof _0x2a67db[_0x912c('0x1a')]===_0x912c('0x1b')&&typeof _0x2a67db[_0x912c('0x1c')]===_0x912c('0x1b');var _0x5934f9=_0xf102be[_0x912c('0x1d')];var _0x32fb2e=_0x11c2a6?0x0:_0x2a67db[_0x912c('0x1a')];var _0x23aff1=_0x11c2a6?_0xf102be[_0x912c('0x1d')]:_0x2a67db[_0x912c('0x1a')]+_0x2a67db[_0x912c('0x1c')];var _0x272010;if(_0x23aff1>=_0x5934f9){_0x23aff1=_0x5934f9;_0x272010=0xc8;}else{_0x272010=0xce;}_0x2ddbf6[_0x912c('0x18')](_0x272010);return _0x2ddbf6['set']('Content-Range',_0x32fb2e+'-'+_0x23aff1+'/'+_0x5934f9)[_0x912c('0x19')](_0xf102be);}return null;};}function patchUpdates(_0xbb397d){return function(_0x4eb20e){try{jsonpatch['apply'](_0x4eb20e,_0xbb397d,!![]);}catch(_0x5f2577){return BPromise[_0x912c('0x1e')](_0x5f2577);}return _0x4eb20e[_0x912c('0x1f')]();};}function saveUpdates(_0x5adca9,_0x5afd32){return function(_0x4f0a39){if(_0x4f0a39){return _0x4f0a39[_0x912c('0x20')](_0x5adca9)[_0x912c('0x21')](function(_0x4293f2){return _0x4293f2;});}return null;};}function removeEntity(_0x1ec8a8,_0x2c964a){return function(_0x11ea1c){if(_0x11ea1c){return _0x11ea1c[_0x912c('0x22')]()['then'](function(){_0x1ec8a8[_0x912c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde247c,_0x44284d){return function(_0x477475){if(!_0x477475){_0xde247c[_0x912c('0x23')](0x194);}return _0x477475;};}function handleError(_0x32b8c5,_0x3a9fc0){_0x3a9fc0=_0x3a9fc0||0x1f4;return function(_0x18a188){logger[_0x912c('0x24')](_0x18a188['stack']);if(_0x18a188['name']){delete _0x18a188[_0x912c('0x25')];}_0x32b8c5['status'](_0x3a9fc0)[_0x912c('0x26')](_0x18a188);};}exports[_0x912c('0x27')]=function(_0x58ed35,_0xefc100){var _0x46e8aa={},_0x2dbf14={},_0x188790={'count':0x0,'rows':[]};var _0x4a3708=_['map'](db[_0x912c('0x28')]['rawAttributes'],function(_0x20b4ae){return{'name':_0x20b4ae[_0x912c('0x29')],'type':_0x20b4ae[_0x912c('0x2a')][_0x912c('0x2b')]};});_0x2dbf14[_0x912c('0x2c')]=_['map'](_0x4a3708,_0x912c('0x25'));_0x2dbf14[_0x912c('0x2d')]=_[_0x912c('0x2e')](_0x58ed35['query']);_0x2dbf14[_0x912c('0x2f')]=_['intersection'](_0x2dbf14['model'],_0x2dbf14['query']);_0x46e8aa[_0x912c('0x30')]=_['intersection'](_0x2dbf14[_0x912c('0x2c')],qs[_0x912c('0x31')](_0x58ed35['query'][_0x912c('0x31')]));_0x46e8aa['attributes']=_0x46e8aa[_0x912c('0x30')][_0x912c('0x32')]?_0x46e8aa[_0x912c('0x30')]:_0x2dbf14[_0x912c('0x2c')];if(!_0x58ed35[_0x912c('0x2d')][_0x912c('0x33')]('nolimit')){_0x46e8aa[_0x912c('0x1c')]=qs[_0x912c('0x1c')](_0x58ed35[_0x912c('0x2d')]['limit']);_0x46e8aa['offset']=qs[_0x912c('0x1a')](_0x58ed35[_0x912c('0x2d')][_0x912c('0x1a')]);}_0x46e8aa[_0x912c('0x34')]=qs[_0x912c('0x35')](_0x58ed35[_0x912c('0x2d')][_0x912c('0x35')]);_0x46e8aa['where']=qs['filters'](_['pick'](_0x58ed35[_0x912c('0x2d')],_0x2dbf14[_0x912c('0x2f')]),_0x4a3708);if(_0x58ed35[_0x912c('0x2d')][_0x912c('0x36')]){_0x46e8aa[_0x912c('0x37')]=_[_0x912c('0x38')](_0x46e8aa[_0x912c('0x37')],{'$or':_['map'](_0x4a3708,function(_0xc18d3c){if(_0xc18d3c[_0x912c('0x2a')]!==_0x912c('0x39')){var _0x4a74e1={};_0x4a74e1[_0xc18d3c['name']]={'$like':'%'+_0x58ed35[_0x912c('0x2d')][_0x912c('0x36')]+'%'};return _0x4a74e1;}})});}_0x46e8aa=_[_0x912c('0x38')]({},_0x46e8aa,_0x58ed35[_0x912c('0x3a')]);var _0x397160={'where':_0x46e8aa[_0x912c('0x37')]};return db[_0x912c('0x28')]['count'](_0x397160)['then'](function(_0x4b1139){_0x188790[_0x912c('0x1d')]=_0x4b1139;if(_0x58ed35[_0x912c('0x2d')][_0x912c('0x3b')]){_0x46e8aa[_0x912c('0x3c')]=[{'all':!![]}];}return db[_0x912c('0x28')][_0x912c('0x3d')](_0x46e8aa);})[_0x912c('0x21')](function(_0x1021ee){_0x188790[_0x912c('0x3e')]=_0x1021ee;return _0x188790;})[_0x912c('0x21')](respondWithFilteredResult(_0xefc100,_0x46e8aa))[_0x912c('0x3f')](handleError(_0xefc100,null));};exports[_0x912c('0x40')]=function(_0x1b83c4,_0x2d3ae5){var _0x47babc={'raw':![],'where':{'id':_0x1b83c4[_0x912c('0x41')]['id']}},_0x1f0d7c={};_0x1f0d7c[_0x912c('0x2c')]=_[_0x912c('0x2e')](db[_0x912c('0x28')][_0x912c('0x42')]);_0x1f0d7c[_0x912c('0x2d')]=_['keys'](_0x1b83c4['query']);_0x1f0d7c[_0x912c('0x2f')]=_['intersection'](_0x1f0d7c[_0x912c('0x2c')],_0x1f0d7c[_0x912c('0x2d')]);_0x47babc[_0x912c('0x30')]=_[_0x912c('0x43')](_0x1f0d7c[_0x912c('0x2c')],qs[_0x912c('0x31')](_0x1b83c4[_0x912c('0x2d')][_0x912c('0x31')]));_0x47babc['attributes']=_0x47babc['attributes'][_0x912c('0x32')]?_0x47babc[_0x912c('0x30')]:_0x1f0d7c[_0x912c('0x2c')];if(_0x1b83c4[_0x912c('0x2d')][_0x912c('0x3b')]){_0x47babc[_0x912c('0x3c')]=[{'all':!![]}];}_0x47babc=_[_0x912c('0x38')]({},_0x47babc,_0x1b83c4['options']);return db[_0x912c('0x28')][_0x912c('0x44')](_0x47babc)[_0x912c('0x21')](handleEntityNotFound(_0x2d3ae5,null))['then'](respondWithResult(_0x2d3ae5,null))['catch'](handleError(_0x2d3ae5,null));};exports[_0x912c('0x45')]=function(_0x13c317,_0x21847b){return db[_0x912c('0x28')][_0x912c('0x45')](_0x13c317[_0x912c('0x46')],{})[_0x912c('0x21')](respondWithResult(_0x21847b,0xc9))['catch'](handleError(_0x21847b,null));};exports[_0x912c('0x20')]=function(_0x121c09,_0x461496){if(_0x121c09[_0x912c('0x46')]['id']){delete _0x121c09['body']['id'];}return db[_0x912c('0x28')]['find']({'where':{'id':_0x121c09[_0x912c('0x41')]['id']}})['then'](handleEntityNotFound(_0x461496,null))['then'](saveUpdates(_0x121c09[_0x912c('0x46')],null))[_0x912c('0x21')](respondWithResult(_0x461496,null))['catch'](handleError(_0x461496,null));};exports[_0x912c('0x22')]=function(_0xdf8253,_0x494ef9){return db['Dynamics365Account'][_0x912c('0x44')]({'where':{'id':_0xdf8253[_0x912c('0x41')]['id']}})[_0x912c('0x21')](handleEntityNotFound(_0x494ef9,null))['then'](removeEntity(_0x494ef9,null))[_0x912c('0x3f')](handleError(_0x494ef9,null));};exports[_0x912c('0x47')]=function(_0x461f51,_0x1cfc15,_0x322d0b){var _0x4bc256={};var _0xfc9754={};var _0x20c521;var _0x50577b;return db[_0x912c('0x28')]['findOne']({'where':{'id':_0x461f51[_0x912c('0x41')]['id']}})['then'](handleEntityNotFound(_0x1cfc15,null))[_0x912c('0x21')](function(_0x9f8310){if(_0x9f8310){_0x20c521=_0x9f8310;_0xfc9754[_0x912c('0x2c')]=_[_0x912c('0x2e')](db[_0x912c('0x48')][_0x912c('0x42')]);_0xfc9754['query']=_[_0x912c('0x2e')](_0x461f51[_0x912c('0x2d')]);_0xfc9754['filters']=_[_0x912c('0x43')](_0xfc9754['model'],_0xfc9754[_0x912c('0x2d')]);_0x4bc256['attributes']=_[_0x912c('0x43')](_0xfc9754[_0x912c('0x2c')],qs[_0x912c('0x31')](_0x461f51['query']['fields']));_0x4bc256[_0x912c('0x30')]=_0x4bc256[_0x912c('0x30')][_0x912c('0x32')]?_0x4bc256[_0x912c('0x30')]:_0xfc9754[_0x912c('0x2c')];_0x4bc256[_0x912c('0x34')]=qs['sort'](_0x461f51['query'][_0x912c('0x35')]);_0x4bc256[_0x912c('0x37')]=qs[_0x912c('0x2f')](_['pick'](_0x461f51[_0x912c('0x2d')],_0xfc9754[_0x912c('0x2f')]));if(_0x461f51[_0x912c('0x2d')][_0x912c('0x36')]){_0x4bc256[_0x912c('0x37')]=_[_0x912c('0x38')](_0x4bc256['where'],{'$or':_[_0x912c('0x49')](_0x4bc256[_0x912c('0x30')],function(_0x251694){var _0xc3719f={};_0xc3719f[_0x251694]={'$like':'%'+_0x461f51['query']['filter']+'%'};return _0xc3719f;})});}_0x4bc256=_[_0x912c('0x38')]({},_0x4bc256,_0x461f51[_0x912c('0x3a')]);return _0x20c521[_0x912c('0x47')](_0x4bc256);}})['then'](function(_0x3dd04d){if(_0x3dd04d){_0x50577b=_0x3dd04d[_0x912c('0x32')];if(!_0x461f51[_0x912c('0x2d')][_0x912c('0x33')]('nolimit')){_0x4bc256[_0x912c('0x1c')]=qs[_0x912c('0x1c')](_0x461f51[_0x912c('0x2d')][_0x912c('0x1c')]);_0x4bc256[_0x912c('0x1a')]=qs[_0x912c('0x1a')](_0x461f51[_0x912c('0x2d')]['offset']);}return _0x20c521[_0x912c('0x47')](_0x4bc256);}})[_0x912c('0x21')](function(_0xbc29f6){if(_0xbc29f6){return _0xbc29f6?{'count':_0x50577b,'rows':_0xbc29f6}:null;}})[_0x912c('0x21')](respondWithResult(_0x1cfc15,null))[_0x912c('0x3f')](handleError(_0x1cfc15,null));};exports[_0x912c('0x4a')]=function(_0x11abf5,_0x546137,_0x59c43e){if(_0x11abf5[_0x912c('0x46')]['id']){delete _0x11abf5[_0x912c('0x46')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x11abf5['params']['id']}})[_0x912c('0x21')](handleEntityNotFound(_0x546137,null))[_0x912c('0x21')](function(_0x3dc4a0){if(_0x3dc4a0){_0x11abf5[_0x912c('0x46')][_0x912c('0x4b')]=_0x3dc4a0['id'];_0x11abf5[_0x912c('0x46')][_0x912c('0x4c')]=integrations[_0x912c('0x4d')](_0x11abf5[_0x912c('0x46')][_0x912c('0x4e')],_0x11abf5[_0x912c('0x46')]['type']);_0x11abf5['body'][_0x912c('0x4f')]=integrations[_0x912c('0x50')](_0x11abf5[_0x912c('0x46')][_0x912c('0x4e')],_0x11abf5[_0x912c('0x46')][_0x912c('0x2a')]);return db[_0x912c('0x48')][_0x912c('0x45')](_0x11abf5['body'],{'include':[{'model':db[_0x912c('0x51')],'as':'Subjects'},{'model':db[_0x912c('0x51')],'as':_0x912c('0x4f')}]});}return null;})['then'](respondWithResult(_0x546137,null))[_0x912c('0x3f')](handleError(_0x546137,null));};exports[_0x912c('0x52')]=function(_0x3993d0,_0x1467b9,_0x4bc105){var _0x1cba54=_0x3993d0[_0x912c('0x2d')][_0x912c('0x53')];var _0x3e148e=_0x1cba54===_0x912c('0x54')?_0x912c('0x55'):_0x912c('0x56');var _0x4dba2d='';var _0x2fbc2b='';var _0x2b5941='';var _0x26f700='';var _0xcc8081='';var _0x23088e='';var _0x2b34df='';var _0x327948='';var _0x3fd635=[_0x912c('0x57'),_0x912c('0x58'),'customerid',_0x912c('0x59'),_0x912c('0x5a'),_0x912c('0x5b'),_0x912c('0x5c'),_0x912c('0x5d'),'directioncode',_0x912c('0x5e')];var _0x17112a=[_0x912c('0x5f'),'accountidyominame',_0x912c('0x60'),_0x912c('0x61'),'contactidname',_0x912c('0x62'),_0x912c('0x63'),'contractidname',_0x912c('0x64'),_0x912c('0x65'),_0x912c('0x66'),'createdbyyominame',_0x912c('0x67'),_0x912c('0x68'),_0x912c('0x69'),_0x912c('0x6a'),'customeridtype',_0x912c('0x6b'),'emailaddress',_0x912c('0x6c'),_0x912c('0x6d'),'entityimage_url',_0x912c('0x6e'),_0x912c('0x6f'),_0x912c('0x70'),'followupby',_0x912c('0x71'),_0x912c('0x72'),_0x912c('0x73'),_0x912c('0x74'),_0x912c('0x75'),_0x912c('0x76'),_0x912c('0x77'),_0x912c('0x78'),_0x912c('0x79'),_0x912c('0x7a'),_0x912c('0x7b'),_0x912c('0x7c'),_0x912c('0x7d'),_0x912c('0x7e'),_0x912c('0x7f'),'onholdtime',_0x912c('0x80'),_0x912c('0x81'),_0x912c('0x82'),_0x912c('0x83'),'parentcaseidname',_0x912c('0x84'),_0x912c('0x85'),_0x912c('0x86'),_0x912c('0x87'),_0x912c('0x88'),_0x912c('0x89'),_0x912c('0x8a'),_0x912c('0x8b'),_0x912c('0x8c'),_0x912c('0x8d'),_0x912c('0x8e'),'slainvokedidname','slaname',_0x912c('0x8f'),_0x912c('0x90'),_0x912c('0x91'),_0x912c('0x92'),_0x912c('0x93'),_0x912c('0x94'),_0x912c('0x95'),_0x912c('0x96'),_0x912c('0x97'),_0x912c('0x98')];var _0x3ed46d=_0x3fd635['concat'](_0x17112a);return db[_0x912c('0x28')][_0x912c('0x99')]({'where':{'id':_0x3993d0['params']['id']},'attributes':['id',_0x912c('0x9a'),_0x912c('0x9b'),_0x912c('0x9c'),_0x912c('0x9d'),_0x912c('0x9e'),'clientSecret']})[_0x912c('0x21')](handleEntityNotFound(_0x1467b9,null))[_0x912c('0x21')](function(_0x43c02a){if(_0x43c02a){_0x327948=_0x43c02a[_0x912c('0x9c')];var _0x1a4c4b=_0x327948[_0x912c('0x9f')](-0x1);if(_0x1a4c4b==='/'){_0x327948=_0x327948[_0x912c('0xa0')](0x0,_0x327948['lastIndexOf'](_0x1a4c4b));}_0x2b34df=util[_0x912c('0xa1')]('%s/api/data/v9.0/',_0x327948);var _0x1a0c03={'method':'POST','uri':_0x912c('0xa2')+_0x43c02a[_0x912c('0x9d')]+_0x912c('0xa3'),'form':{'client_id':_0x43c02a[_0x912c('0x9e')],'resource':_0x327948,'username':_0x43c02a['username'],'password':_0x43c02a[_0x912c('0x9b')],'grant_type':_0x912c('0x9b'),'client_secret':_0x43c02a[_0x912c('0xa4')]},'json':!![]};return rp(_0x1a0c03);}})['then'](function(_0x440310){_0x23088e=_0x440310[_0x912c('0xa5')];var _0x291b08={'method':_0x912c('0xa6'),'uri':encodeURI(_0x2b34df+_0x912c('0xa7')+_0x3e148e+'\x27'),'headers':{'Authorization':_0x912c('0xa8')+_0x23088e,'If-None-Match':null,'OData-Version':_0x912c('0xa9')},'json':!![]};return rp(_0x291b08);})['then'](function(_0x3227c5){var _0x183a47=_0x3227c5[_0x912c('0xaa')][0x0];var _0x266f23=_0x183a47['MetadataId'];var _0x56eeba={'method':_0x912c('0xa6'),'uri':_0x2b34df+_0x912c('0xab')+_0x266f23+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x912c('0xa8')+_0x23088e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56eeba);})[_0x912c('0x21')](function(_0x117bd0){_0x4dba2d=_0x117bd0;_0x2fbc2b=_0x4dba2d[_0x912c('0xac')];_0x2fbc2b=_[_0x912c('0xad')](_0x2fbc2b,function(_0x1447f){return!_0x3ed46d[_0x912c('0xae')](_0x1447f['LogicalName']);});var _0x36e509=[];var _0x51fc93=[];_0x2fbc2b[_0x912c('0xaf')](function(_0x39b19c){if(_0x39b19c[_0x912c('0xb0')]){var _0x28939b=_0x39b19c[_0x912c('0xb0')][_0x912c('0xa0')](_0x39b19c['@odata.type'][_0x912c('0xb1')]('.')+0x1);if(_0x28939b===_0x912c('0xb2')){_0x36e509[_0x912c('0xb3')](getSelectList(_0x2b34df,_0x1cba54,_0x51fc93,_0x4dba2d[_0x912c('0xb4')],_0x39b19c[_0x912c('0xb4')],_0x23088e));}}});return Promise[_0x912c('0xb5')](_0x36e509);})[_0x912c('0x21')](function(_0x5d4601){_0x2b5941=_0x5d4601[0x0];var _0x47767c=[];var _0x5e796c=[];_0x2fbc2b[_0x912c('0xaf')](function(_0x188530){if(!_[_0x912c('0xb6')](_0x188530[_0x912c('0xb0')])){var _0x481164=_0x188530['@odata.type'][_0x912c('0xa0')](_0x188530[_0x912c('0xb0')][_0x912c('0xb1')]('.')+0x1);if(_0x481164===_0x912c('0xb7')){_0x47767c[_0x912c('0xb3')](getBooleanList(_0x2b34df,_0x1cba54,_0x5e796c,_0x4dba2d[_0x912c('0xb4')],_0x188530['MetadataId'],_0x23088e));}}});return Promise[_0x912c('0xb5')](_0x47767c);})['then'](function(_0x2258de){_0x26f700=_0x2258de[0x0];var _0x59defe=[];var _0x198d45=[];_0x2fbc2b[_0x912c('0xaf')](function(_0x228a40){if(_0x228a40['@odata.type']){var _0x345451=_0x228a40[_0x912c('0xb0')][_0x912c('0xa0')](_0x228a40['@odata.type']['lastIndexOf']('.')+0x1);if(_0x345451===_0x912c('0xb8')||_0x345451==='DoubleAttributeMetadata'||_0x345451===_0x912c('0xb9')||_0x345451===_0x912c('0xba')||_0x345451===_0x912c('0xbb')||_0x345451===_0x912c('0xbc')||_0x345451===_0x912c('0xbd')||_0x345451===_0x912c('0xbe')||_0x345451===_0x912c('0xbf')||_0x345451===_0x912c('0xc0')){_0x59defe[_0x912c('0xb3')](getInputList(_0x2b34df,_0x1cba54,_0x345451,_0x198d45,_0x4dba2d[_0x912c('0xb4')],_0x228a40[_0x912c('0xb4')],_0x23088e));}}});return Promise[_0x912c('0xb5')](_0x59defe);})[_0x912c('0x21')](function(_0xf3a1af){_0xcc8081=_0xf3a1af[0x0];var _0x2ebc9d=_0x2b5941[_0x912c('0xc1')](_0x26f700)[_0x912c('0xc1')](_0xcc8081);var _0x22407a={'count':_0x2ebc9d[_0x912c('0x32')],'rows':_0x2ebc9d};return _0x22407a;})[_0x912c('0x21')](respondWithResult(_0x1467b9,null))[_0x912c('0x3f')](function(_0x1bda25){var _0x4f67ee=_0x3993d0[_0x912c('0x2d')]['test']?0x1f4:_0x1bda25['statusCode']||0x1f4;logger['error'](_0x1bda25[_0x912c('0xc2')]);delete _0x1bda25[_0x912c('0x25')];if(_0x4f67ee===0x191){_0x4f67ee=0x190;}_0x1467b9[_0x912c('0x18')](_0x4f67ee)[_0x912c('0x26')](_0x3993d0[_0x912c('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1bda25[_0x912c('0xc3')]}:_0x1bda25);});};function getSelectList(_0x2b3f2e,_0x204e21,_0x4609ca,_0x3bad36,_0x2db68a,_0x1fe1e5){var _0x3e6882={'method':_0x912c('0xa6'),'uri':_0x2b3f2e+_0x912c('0xab')+_0x3bad36+_0x912c('0xc4')+_0x2db68a+_0x912c('0xc5')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x912c('0xa8')+_0x1fe1e5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e6882)['then'](function(_0x54837e){var _0x55ef63=[];var _0x5c5575=_0x54837e[_0x912c('0xc6')][_0x912c('0xc7')];_0x5c5575[_0x912c('0xaf')](function(_0x4e44bb){_0x55ef63[_0x912c('0xb3')]({'name':_0x4e44bb[_0x912c('0xc8')]['UserLocalizedLabel']['Label'],'value':String(_0x4e44bb['Value'])});});var _0x131288={'id':_0x204e21+'_'+_0x54837e[_0x912c('0xc9')],'name':_0x54837e[_0x912c('0xca')][_0x912c('0xcb')][_0x912c('0xc8')],'custom':![],'options':_0x55ef63};_0x4609ca[_0x912c('0xb3')](_0x131288);return _0x4609ca;});}function getBooleanList(_0x341ada,_0xb41f8a,_0x5b4662,_0x50a127,_0x14ac83,_0x259569){var _0x6549f3={'method':_0x912c('0xa6'),'uri':_0x341ada+_0x912c('0xab')+_0x50a127+_0x912c('0xc4')+_0x14ac83+_0x912c('0xcc'),'headers':{'Authorization':_0x912c('0xa8')+_0x259569,'If-None-Match':null,'OData-Version':_0x912c('0xa9')},'json':!![]};return rp(_0x6549f3)['then'](function(_0xce9050){var _0x4dda5e=[];_0x4dda5e[_0x912c('0xb3')]({'name':_0xce9050[_0x912c('0xc6')]['TrueOption'][_0x912c('0xc8')][_0x912c('0xcb')]['Label'],'value':_0x912c('0xcd')},{'name':_0xce9050[_0x912c('0xc6')][_0x912c('0xce')][_0x912c('0xc8')][_0x912c('0xcb')][_0x912c('0xc8')],'value':_0x912c('0xcf')});var _0x22f37f={'id':_0xb41f8a+'_'+_0xce9050['LogicalName'],'name':_0xce9050[_0x912c('0xca')]['UserLocalizedLabel'][_0x912c('0xc8')],'custom':![],'options':_0x4dda5e};_0x5b4662[_0x912c('0xb3')](_0x22f37f);return _0x5b4662;});}function getInputList(_0x1bf7f1,_0x40a09a,_0x43422c,_0x1fa360,_0x17f1dd,_0x14e9ea,_0x452605){var _0xc0ffa={'method':_0x912c('0xa6'),'uri':_0x1bf7f1+_0x912c('0xab')+_0x17f1dd+_0x912c('0xc4')+_0x14e9ea+_0x912c('0xd0')+_0x43422c+_0x912c('0xd1'),'headers':{'Authorization':'Bearer\x20'+_0x452605,'If-None-Match':null,'OData-Version':_0x912c('0xa9')},'json':!![]};return rp(_0xc0ffa)['then'](function(_0x438f41){var _0xc217bd={'id':_0x40a09a+'_'+_0x438f41[_0x912c('0xc9')],'name':_0x438f41[_0x912c('0xca')][_0x912c('0xcb')]?_0x438f41['DisplayName'][_0x912c('0xcb')][_0x912c('0xc8')]:_0x438f41[_0x912c('0xc9')],'custom':![],'options':[]};_0x1fa360[_0x912c('0xb3')](_0xc217bd);return _0x1fa360;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a8285bb..911f737 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x447da8,_0x529281){var _0xc9c2c0=function(_0xede115){while(--_0xede115){_0x447da8['push'](_0x447da8['shift']());}};_0xc9c2c0(++_0x529281);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xb7e7[_0x5834bc];return _0x3e183a;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 732cd66..600cd01 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 _0xbeaa=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2705bc,_0x137163){var _0x1aa5df=function(_0x38cb11){while(--_0x38cb11){_0x2705bc['push'](_0x2705bc['shift']());}};_0x1aa5df(++_0x137163);}(_0xbeaa,0xaa));var _0xabea=function(_0x321058,_0x4088d5){_0x321058=_0x321058-0x0;var _0x4bd88c=_0xbeaa[_0x321058];return _0x4bd88c;};'use strict';var _=require('lodash');var util=require(_0xabea('0x0'));var moment=require('moment');var BPromise=require(_0xabea('0x1'));var rs=require(_0xabea('0x2'));var fs=require('fs');var Redis=require(_0xabea('0x3'));var db=require(_0xabea('0x4'))['db'];var utils=require(_0xabea('0x5'));var logger=require(_0xabea('0x6'))('rpc');var config=require(_0xabea('0x7'));var jayson=require(_0xabea('0x8'));var client=jayson['client'][_0xabea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c017c,_0x2eb1a8,_0x4202d8){return new BPromise(function(_0x59f836,_0x55f2d4){return client[_0xabea('0xa')](_0x4c017c,_0x4202d8)[_0xabea('0xb')](function(_0x233dd6){logger['info'](_0xabea('0xc'),_0x2eb1a8,'request\x20sent');logger[_0xabea('0xd')](_0xabea('0xe'),_0x2eb1a8,_0xabea('0xf'),JSON[_0xabea('0x10')](_0x233dd6));if(_0x233dd6[_0xabea('0x11')]){if(_0x233dd6[_0xabea('0x11')][_0xabea('0x12')]===0x1f4){logger[_0xabea('0x11')](_0xabea('0xc'),_0x2eb1a8,_0x233dd6[_0xabea('0x11')]['message']);return _0x55f2d4(_0x233dd6[_0xabea('0x11')][_0xabea('0x13')]);}logger[_0xabea('0x11')](_0xabea('0xc'),_0x2eb1a8,_0x233dd6[_0xabea('0x11')][_0xabea('0x13')]);return _0x59f836(_0x233dd6[_0xabea('0x11')]['message']);}else{logger[_0xabea('0x14')](_0xabea('0xc'),_0x2eb1a8,'request\x20sent');_0x59f836(_0x233dd6[_0xabea('0x15')][_0xabea('0x13')]);}})['catch'](function(_0x1536f1){logger['error'](_0xabea('0xc'),_0x2eb1a8,_0x1536f1);_0x55f2d4(_0x1536f1);});});}exports[_0xabea('0x16')]=function(_0x49b4ed){var _0x1f65ad=this;return new Promise(function(_0x16c846,_0x227c56){return db[_0xabea('0x17')]['findAll']({'raw':_0x49b4ed[_0xabea('0x18')]?_0x49b4ed[_0xabea('0x18')][_0xabea('0x19')]===undefined?!![]:![]:!![],'where':_0x49b4ed['options']?_0x49b4ed['options'][_0xabea('0x1a')]||null:null,'attributes':_0x49b4ed[_0xabea('0x18')]?_0x49b4ed[_0xabea('0x18')][_0xabea('0x1b')]||null:null,'limit':_0x49b4ed[_0xabea('0x18')]?_0x49b4ed[_0xabea('0x18')][_0xabea('0x1c')]||null:null,'include':_0x49b4ed[_0xabea('0x18')]?_0x49b4ed['options'][_0xabea('0x1d')]?_[_0xabea('0x1e')](_0x49b4ed[_0xabea('0x18')][_0xabea('0x1d')],function(_0x2de939){return{'model':db[_0x2de939[_0xabea('0x1f')]],'as':_0x2de939['as'],'attributes':_0x2de939[_0xabea('0x1b')],'include':_0x2de939['include']?_['map'](_0x2de939[_0xabea('0x1d')],function(_0x822978){return{'model':db[_0x822978['model']],'as':_0x822978['as'],'attributes':_0x822978[_0xabea('0x1b')],'include':_0x822978[_0xabea('0x1d')]?_[_0xabea('0x1e')](_0x822978[_0xabea('0x1d')],function(_0x304e1d){return{'model':db[_0x304e1d[_0xabea('0x1f')]],'as':_0x304e1d['as'],'attributes':_0x304e1d[_0xabea('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5c83){logger[_0xabea('0x14')](_0xabea('0x16'),_0x49b4ed);logger[_0xabea('0xd')]('GetDynamics365Account',_0x49b4ed,JSON[_0xabea('0x10')](_0x3e5c83));_0x16c846(_0x3e5c83);})['catch'](function(_0x5062fa){logger['error'](_0xabea('0x16'),_0x5062fa[_0xabea('0x13')],_0x49b4ed);_0x227c56(_0x1f65ad[_0xabea('0x11')](0x1f4,_0x5062fa[_0xabea('0x13')]));});});};exports[_0xabea('0x20')]=function(_0x57c6ed){var _0x40a37a=this;return new Promise(function(_0x11f1cb,_0x4cf2cf){return db[_0xabea('0x17')][_0xabea('0x21')]({'raw':_0x57c6ed[_0xabea('0x18')]?_0x57c6ed[_0xabea('0x18')][_0xabea('0x19')]===undefined?!![]:![]:!![],'where':_0x57c6ed[_0xabea('0x18')]?_0x57c6ed[_0xabea('0x18')][_0xabea('0x1a')]||null:null,'attributes':_0x57c6ed[_0xabea('0x18')]?_0x57c6ed['options'][_0xabea('0x1b')]||null:null,'include':_0x57c6ed['options']?_0x57c6ed[_0xabea('0x18')]['include']?_[_0xabea('0x1e')](_0x57c6ed[_0xabea('0x18')][_0xabea('0x1d')],function(_0xca348d){return{'model':db[_0xca348d[_0xabea('0x1f')]],'as':_0xca348d['as'],'attributes':_0xca348d['attributes'],'include':_0xca348d[_0xabea('0x1d')]?_[_0xabea('0x1e')](_0xca348d[_0xabea('0x1d')],function(_0x3b3329){return{'model':db[_0x3b3329[_0xabea('0x1f')]],'as':_0x3b3329['as'],'attributes':_0x3b3329[_0xabea('0x1b')],'include':_0x3b3329[_0xabea('0x1d')]?_[_0xabea('0x1e')](_0x3b3329['include'],function(_0x10a437){return{'model':db[_0x10a437['model']],'as':_0x10a437['as'],'attributes':_0x10a437['attributes']};}):[]};}):[]};}):[]:[]})[_0xabea('0xb')](function(_0x4a069c){logger['info'](_0xabea('0x20'),_0x57c6ed);logger[_0xabea('0xd')](_0xabea('0x20'),_0x57c6ed,JSON[_0xabea('0x10')](_0x4a069c));_0x11f1cb(_0x4a069c);})[_0xabea('0x22')](function(_0xf64b02){logger[_0xabea('0x11')](_0xabea('0x20'),_0xf64b02[_0xabea('0x13')],_0x57c6ed);_0x4cf2cf(_0x40a37a['error'](0x1f4,_0xf64b02[_0xabea('0x13')]));});});}; \ No newline at end of file +var _0x3cfb=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x2c5b71,_0x201d96){var _0x27658f=function(_0x3e8e38){while(--_0x3e8e38){_0x2c5b71['push'](_0x2c5b71['shift']());}};_0x27658f(++_0x201d96);}(_0x3cfb,0x14f));var _0xb3cf=function(_0x42c7c0,_0x554243){_0x42c7c0=_0x42c7c0-0x0;var _0x5eeda9=_0x3cfb[_0x42c7c0];return _0x5eeda9;};'use strict';var _=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var moment=require('moment');var BPromise=require(_0xb3cf('0x2'));var rs=require(_0xb3cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3cf('0x4'))['db'];var utils=require(_0xb3cf('0x5'));var logger=require(_0xb3cf('0x6'))(_0xb3cf('0x7'));var config=require('../../config/environment');var jayson=require(_0xb3cf('0x8'));var client=jayson[_0xb3cf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48a9ba,_0x340451,_0x5367f4){return new BPromise(function(_0x3a59f1,_0x3832b6){return client[_0xb3cf('0xa')](_0x48a9ba,_0x5367f4)[_0xb3cf('0xb')](function(_0x1c9c8f){logger['info'](_0xb3cf('0xc'),_0x340451,_0xb3cf('0xd'));logger[_0xb3cf('0xe')](_0xb3cf('0xf'),_0x340451,'request\x20sent',JSON['stringify'](_0x1c9c8f));if(_0x1c9c8f[_0xb3cf('0x10')]){if(_0x1c9c8f[_0xb3cf('0x10')][_0xb3cf('0x11')]===0x1f4){logger[_0xb3cf('0x10')](_0xb3cf('0xc'),_0x340451,_0x1c9c8f['error']['message']);return _0x3832b6(_0x1c9c8f[_0xb3cf('0x10')][_0xb3cf('0x12')]);}logger['error'](_0xb3cf('0xc'),_0x340451,_0x1c9c8f[_0xb3cf('0x10')][_0xb3cf('0x12')]);return _0x3a59f1(_0x1c9c8f[_0xb3cf('0x10')][_0xb3cf('0x12')]);}else{logger[_0xb3cf('0x13')](_0xb3cf('0xc'),_0x340451,'request\x20sent');_0x3a59f1(_0x1c9c8f['result'][_0xb3cf('0x12')]);}})[_0xb3cf('0x14')](function(_0x1e0742){logger[_0xb3cf('0x10')](_0xb3cf('0xc'),_0x340451,_0x1e0742);_0x3832b6(_0x1e0742);});});}exports[_0xb3cf('0x15')]=function(_0x4112e2){var _0x43d7d6=this;return new Promise(function(_0x492780,_0x4fdfbf){return db[_0xb3cf('0x16')][_0xb3cf('0x17')]({'raw':_0x4112e2['options']?_0x4112e2[_0xb3cf('0x18')][_0xb3cf('0x19')]===undefined?!![]:![]:!![],'where':_0x4112e2['options']?_0x4112e2['options'][_0xb3cf('0x1a')]||null:null,'attributes':_0x4112e2[_0xb3cf('0x18')]?_0x4112e2[_0xb3cf('0x18')][_0xb3cf('0x1b')]||null:null,'limit':_0x4112e2[_0xb3cf('0x18')]?_0x4112e2['options'][_0xb3cf('0x1c')]||null:null,'include':_0x4112e2[_0xb3cf('0x18')]?_0x4112e2[_0xb3cf('0x18')][_0xb3cf('0x1d')]?_[_0xb3cf('0x1e')](_0x4112e2[_0xb3cf('0x18')]['include'],function(_0x250914){return{'model':db[_0x250914['model']],'as':_0x250914['as'],'attributes':_0x250914[_0xb3cf('0x1b')],'include':_0x250914[_0xb3cf('0x1d')]?_['map'](_0x250914[_0xb3cf('0x1d')],function(_0x14effe){return{'model':db[_0x14effe[_0xb3cf('0x1f')]],'as':_0x14effe['as'],'attributes':_0x14effe['attributes'],'include':_0x14effe[_0xb3cf('0x1d')]?_['map'](_0x14effe[_0xb3cf('0x1d')],function(_0x5f4ced){return{'model':db[_0x5f4ced[_0xb3cf('0x1f')]],'as':_0x5f4ced['as'],'attributes':_0x5f4ced['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x334a41){logger[_0xb3cf('0x13')](_0xb3cf('0x15'),_0x4112e2);logger[_0xb3cf('0xe')](_0xb3cf('0x15'),_0x4112e2,JSON[_0xb3cf('0x20')](_0x334a41));_0x492780(_0x334a41);})['catch'](function(_0x4957d9){logger['error'](_0xb3cf('0x15'),_0x4957d9[_0xb3cf('0x12')],_0x4112e2);_0x4fdfbf(_0x43d7d6[_0xb3cf('0x10')](0x1f4,_0x4957d9['message']));});});};exports[_0xb3cf('0x21')]=function(_0x31bc28){var _0x2bb59d=this;return new Promise(function(_0x4b8f8f,_0x34c63d){return db[_0xb3cf('0x16')]['find']({'raw':_0x31bc28[_0xb3cf('0x18')]?_0x31bc28['options']['raw']===undefined?!![]:![]:!![],'where':_0x31bc28[_0xb3cf('0x18')]?_0x31bc28[_0xb3cf('0x18')][_0xb3cf('0x1a')]||null:null,'attributes':_0x31bc28[_0xb3cf('0x18')]?_0x31bc28[_0xb3cf('0x18')][_0xb3cf('0x1b')]||null:null,'include':_0x31bc28[_0xb3cf('0x18')]?_0x31bc28[_0xb3cf('0x18')]['include']?_[_0xb3cf('0x1e')](_0x31bc28[_0xb3cf('0x18')][_0xb3cf('0x1d')],function(_0x2cee62){return{'model':db[_0x2cee62[_0xb3cf('0x1f')]],'as':_0x2cee62['as'],'attributes':_0x2cee62[_0xb3cf('0x1b')],'include':_0x2cee62['include']?_[_0xb3cf('0x1e')](_0x2cee62[_0xb3cf('0x1d')],function(_0x3dc99c){return{'model':db[_0x3dc99c[_0xb3cf('0x1f')]],'as':_0x3dc99c['as'],'attributes':_0x3dc99c[_0xb3cf('0x1b')],'include':_0x3dc99c[_0xb3cf('0x1d')]?_['map'](_0x3dc99c[_0xb3cf('0x1d')],function(_0x5e0ecb){return{'model':db[_0x5e0ecb[_0xb3cf('0x1f')]],'as':_0x5e0ecb['as'],'attributes':_0x5e0ecb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb3cf('0xb')](function(_0x294e05){logger[_0xb3cf('0x13')](_0xb3cf('0x21'),_0x31bc28);logger['debug'](_0xb3cf('0x21'),_0x31bc28,JSON[_0xb3cf('0x20')](_0x294e05));_0x4b8f8f(_0x294e05);})[_0xb3cf('0x14')](function(_0x2d7be0){logger[_0xb3cf('0x10')]('ShowDynamics365Account',_0x2d7be0['message'],_0x31bc28);_0x34c63d(_0x2bb59d[_0xb3cf('0x10')](0x1f4,_0x2d7be0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0ee7d01..796882a 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 _0x5229=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','delete','exports','util','path','connect-timeout'];(function(_0x879b42,_0xd6f3f0){var _0x28f127=function(_0x204568){while(--_0x204568){_0x879b42['push'](_0x879b42['shift']());}};_0x28f127(++_0xd6f3f0);}(_0x5229,0xba));var _0x9522=function(_0x5e85b8,_0x8fb66f){_0x5e85b8=_0x5e85b8-0x0;var _0x191950=_0x5229[_0x5e85b8];return _0x191950;};'use strict';var multer=require('multer');var util=require(_0x9522('0x0'));var path=require(_0x9522('0x1'));var timeout=require(_0x9522('0x2'));var express=require(_0x9522('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9522('0x4'));var interaction=require(_0x9522('0x5'));var config=require(_0x9522('0x6'));var controller=require(_0x9522('0x7'));router[_0x9522('0x8')]('/',auth[_0x9522('0x9')](),controller['index']);router[_0x9522('0x8')](_0x9522('0xa'),auth['isAuthenticated'](),controller[_0x9522('0xb')]);router[_0x9522('0x8')](_0x9522('0xc'),auth[_0x9522('0x9')](),controller[_0x9522('0xd')]);router['get'](_0x9522('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9522('0x8')](_0x9522('0xf'),auth[_0x9522('0x9')](),controller['getDescriptions']);router[_0x9522('0x10')]('/',auth[_0x9522('0x9')](),controller[_0x9522('0x11')]);router[_0x9522('0x12')]('/:id',auth[_0x9522('0x9')](),controller['update']);router[_0x9522('0x13')](_0x9522('0xa'),auth[_0x9522('0x9')](),controller['destroy']);module[_0x9522('0x14')]=router; \ No newline at end of file +var _0x4912=['/:id/fields','getSubjects','getDescriptions','create','put','/:id','update','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show'];(function(_0x24129b,_0x511a9f){var _0x23ac49=function(_0x47cfff){while(--_0x47cfff){_0x24129b['push'](_0x24129b['shift']());}};_0x23ac49(++_0x511a9f);}(_0x4912,0x1c0));var _0x2491=function(_0x2766dc,_0x409f27){_0x2766dc=_0x2766dc-0x0;var _0x20c0d1=_0x4912[_0x2766dc];return _0x20c0d1;};'use strict';var multer=require('multer');var util=require(_0x2491('0x0'));var path=require(_0x2491('0x1'));var timeout=require(_0x2491('0x2'));var express=require(_0x2491('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2491('0x4'));var interaction=require(_0x2491('0x5'));var config=require(_0x2491('0x6'));var controller=require(_0x2491('0x7'));router[_0x2491('0x8')]('/',auth[_0x2491('0x9')](),controller[_0x2491('0xa')]);router[_0x2491('0x8')]('/:id',auth[_0x2491('0x9')](),controller[_0x2491('0xb')]);router[_0x2491('0x8')](_0x2491('0xc'),auth[_0x2491('0x9')](),controller['getFields']);router[_0x2491('0x8')]('/:id/subjects',auth[_0x2491('0x9')](),controller[_0x2491('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2491('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2491('0xf')]);router[_0x2491('0x10')](_0x2491('0x11'),auth[_0x2491('0x9')](),controller[_0x2491('0x12')]);router['delete']('/:id',auth[_0x2491('0x9')](),controller['destroy']);module[_0x2491('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 99cfaa2..5a7099d 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 _0xb09a=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0xa7415f,_0x59aa87){var _0x500879=function(_0x28d35e){while(--_0x28d35e){_0xa7415f['push'](_0xa7415f['shift']());}};_0x500879(++_0x59aa87);}(_0xb09a,0x1a9));var _0xab09=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb09a[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0xab09('0x0'));module[_0xab09('0x1')]={'name':{'type':Sequelize[_0xab09('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xab09('0x3')]('incident',_0xab09('0x4')),'defaultValue':_0xab09('0x5')}}; \ No newline at end of file +var _0xcce0=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x186b5c,_0x5a9d49){var _0x399caa=function(_0x28db3e){while(--_0x28db3e){_0x186b5c['push'](_0x186b5c['shift']());}};_0x399caa(++_0x5a9d49);}(_0xcce0,0x14c));var _0x0cce=function(_0x394edc,_0x2c60f4){_0x394edc=_0x394edc-0x0;var _0x513c7f=_0xcce0[_0x394edc];return _0x513c7f;};'use strict';var Sequelize=require(_0x0cce('0x0'));module[_0x0cce('0x1')]={'name':{'type':Sequelize[_0x0cce('0x2')]},'description':{'type':Sequelize[_0x0cce('0x2')]},'ticketType':{'type':Sequelize[_0x0cce('0x3')](_0x0cce('0x4'),_0x0cce('0x5')),'defaultValue':_0x0cce('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c59ca2f..8f5862a 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 _0x84f4=['update','body','getFields','length','getSubjects','findOne','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','fields','find','create'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x84f4,0xfe));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x484f('0x0'));var rimraf=require(_0x484f('0x1'));var zipdir=require(_0x484f('0x2'));var jsonpatch=require(_0x484f('0x3'));var rp=require(_0x484f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x484f('0x5'));var path=require(_0x484f('0x6'));var sox=require(_0x484f('0x7'));var csv=require(_0x484f('0x8'));var ejs=require(_0x484f('0x9'));var fs=require('fs');var fs_extra=require(_0x484f('0xa'));var _=require('lodash');var squel=require(_0x484f('0xb'));var crypto=require(_0x484f('0xc'));var jsforce=require(_0x484f('0xd'));var deskjs=require(_0x484f('0xe'));var toCsv=require(_0x484f('0x8'));var querystring=require(_0x484f('0xf'));var Papa=require('papaparse');var Redis=require(_0x484f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x484f('0x11'));var hardwareService=require(_0x484f('0x12'));var logger=require(_0x484f('0x13'))(_0x484f('0x14'));var utils=require(_0x484f('0x15'));var config=require(_0x484f('0x16'));var licenseUtil=require(_0x484f('0x17'));var db=require(_0x484f('0x18'))['db'];function respondWithStatusCode(_0x3baea0,_0x4dcd9e){_0x4dcd9e=_0x4dcd9e||0xcc;return function(_0xe7475a){if(_0xe7475a){return _0x3baea0[_0x484f('0x19')](_0x4dcd9e);}return _0x3baea0[_0x484f('0x1a')](_0x4dcd9e)[_0x484f('0x1b')]();};}function respondWithResult(_0x5f3cf4,_0xad9e6d){_0xad9e6d=_0xad9e6d||0xc8;return function(_0xc7f1da){if(_0xc7f1da){return _0x5f3cf4[_0x484f('0x1a')](_0xad9e6d)[_0x484f('0x1c')](_0xc7f1da);}};}function respondWithFilteredResult(_0x1dbf28,_0x7d5417){return function(_0x547298){if(_0x547298){var _0xd6852f=typeof _0x7d5417[_0x484f('0x1d')]==='undefined'&&typeof _0x7d5417['limit']===_0x484f('0x1e');var _0x53d1da=_0x547298[_0x484f('0x1f')];var _0x22d402=_0xd6852f?0x0:_0x7d5417['offset'];var _0xff383=_0xd6852f?_0x547298[_0x484f('0x1f')]:_0x7d5417['offset']+_0x7d5417[_0x484f('0x20')];var _0x5674e9;if(_0xff383>=_0x53d1da){_0xff383=_0x53d1da;_0x5674e9=0xc8;}else{_0x5674e9=0xce;}_0x1dbf28[_0x484f('0x1a')](_0x5674e9);return _0x1dbf28[_0x484f('0x21')](_0x484f('0x22'),_0x22d402+'-'+_0xff383+'/'+_0x53d1da)[_0x484f('0x1c')](_0x547298);}return null;};}function patchUpdates(_0xfeccb6){return function(_0x4ce409){try{jsonpatch[_0x484f('0x23')](_0x4ce409,_0xfeccb6,!![]);}catch(_0x317a8b){return BPromise[_0x484f('0x24')](_0x317a8b);}return _0x4ce409[_0x484f('0x25')]();};}function saveUpdates(_0x4b7982,_0x5d4ced){return function(_0x569999){if(_0x569999){return _0x569999['update'](_0x4b7982)[_0x484f('0x26')](function(_0x28c676){return _0x28c676;});}return null;};}function removeEntity(_0x42973f,_0x2d2b5f){return function(_0x41d5f8){if(_0x41d5f8){return _0x41d5f8[_0x484f('0x27')]()['then'](function(){_0x42973f['status'](0xcc)[_0x484f('0x1b')]();});}};}function handleEntityNotFound(_0x1d9752,_0x3e8891){return function(_0x56ccfe){if(!_0x56ccfe){_0x1d9752[_0x484f('0x19')](0x194);}return _0x56ccfe;};}function handleError(_0x336701,_0x44c3ea){_0x44c3ea=_0x44c3ea||0x1f4;return function(_0x8fd83){logger[_0x484f('0x28')](_0x8fd83['stack']);if(_0x8fd83[_0x484f('0x29')]){delete _0x8fd83[_0x484f('0x29')];}_0x336701[_0x484f('0x1a')](_0x44c3ea)[_0x484f('0x2a')](_0x8fd83);};}exports[_0x484f('0x2b')]=function(_0x5eac4e,_0x578727){var _0x3da283={},_0x5857bf={},_0x3863da={'count':0x0,'rows':[]};var _0x55e316=_[_0x484f('0x2c')](db[_0x484f('0x2d')][_0x484f('0x2e')],function(_0x2c3642){return{'name':_0x2c3642[_0x484f('0x2f')],'type':_0x2c3642[_0x484f('0x30')]['key']};});_0x5857bf[_0x484f('0x31')]=_[_0x484f('0x2c')](_0x55e316,_0x484f('0x29'));_0x5857bf[_0x484f('0x32')]=_['keys'](_0x5eac4e[_0x484f('0x32')]);_0x5857bf[_0x484f('0x33')]=_[_0x484f('0x34')](_0x5857bf[_0x484f('0x31')],_0x5857bf[_0x484f('0x32')]);_0x3da283[_0x484f('0x35')]=_[_0x484f('0x34')](_0x5857bf[_0x484f('0x31')],qs['fields'](_0x5eac4e[_0x484f('0x32')]['fields']));_0x3da283['attributes']=_0x3da283[_0x484f('0x35')]['length']?_0x3da283['attributes']:_0x5857bf[_0x484f('0x31')];if(!_0x5eac4e['query'][_0x484f('0x36')](_0x484f('0x37'))){_0x3da283['limit']=qs[_0x484f('0x20')](_0x5eac4e[_0x484f('0x32')]['limit']);_0x3da283[_0x484f('0x1d')]=qs[_0x484f('0x1d')](_0x5eac4e[_0x484f('0x32')]['offset']);}_0x3da283[_0x484f('0x38')]=qs[_0x484f('0x39')](_0x5eac4e[_0x484f('0x32')][_0x484f('0x39')]);_0x3da283[_0x484f('0x3a')]=qs['filters'](_[_0x484f('0x3b')](_0x5eac4e['query'],_0x5857bf[_0x484f('0x33')]),_0x55e316);if(_0x5eac4e[_0x484f('0x32')][_0x484f('0x3c')]){_0x3da283[_0x484f('0x3a')]=_[_0x484f('0x3d')](_0x3da283[_0x484f('0x3a')],{'$or':_[_0x484f('0x2c')](_0x55e316,function(_0x52f820){if(_0x52f820[_0x484f('0x30')]!==_0x484f('0x3e')){var _0x27d3c5={};_0x27d3c5[_0x52f820['name']]={'$like':'%'+_0x5eac4e[_0x484f('0x32')][_0x484f('0x3c')]+'%'};return _0x27d3c5;}})});}_0x3da283=_[_0x484f('0x3d')]({},_0x3da283,_0x5eac4e[_0x484f('0x3f')]);var _0x15787b={'where':_0x3da283['where']};return db['Dynamics365Configuration'][_0x484f('0x1f')](_0x15787b)[_0x484f('0x26')](function(_0x59231a){_0x3863da[_0x484f('0x1f')]=_0x59231a;if(_0x5eac4e[_0x484f('0x32')][_0x484f('0x40')]){_0x3da283[_0x484f('0x41')]=[{'all':!![]}];}return db[_0x484f('0x2d')][_0x484f('0x42')](_0x3da283);})['then'](function(_0x18882a){_0x3863da['rows']=_0x18882a;return _0x3863da;})[_0x484f('0x26')](respondWithFilteredResult(_0x578727,_0x3da283))[_0x484f('0x43')](handleError(_0x578727,null));};exports[_0x484f('0x44')]=function(_0x56b4c5,_0x247621){var _0x533e85={'raw':![],'where':{'id':_0x56b4c5[_0x484f('0x45')]['id']}},_0x4d9095={};_0x4d9095['model']=_[_0x484f('0x46')](db[_0x484f('0x2d')]['rawAttributes']);_0x4d9095[_0x484f('0x32')]=_[_0x484f('0x46')](_0x56b4c5[_0x484f('0x32')]);_0x4d9095[_0x484f('0x33')]=_[_0x484f('0x34')](_0x4d9095[_0x484f('0x31')],_0x4d9095['query']);_0x533e85[_0x484f('0x35')]=_[_0x484f('0x34')](_0x4d9095['model'],qs[_0x484f('0x47')](_0x56b4c5[_0x484f('0x32')]['fields']));_0x533e85[_0x484f('0x35')]=_0x533e85[_0x484f('0x35')]['length']?_0x533e85[_0x484f('0x35')]:_0x4d9095[_0x484f('0x31')];if(_0x56b4c5[_0x484f('0x32')][_0x484f('0x40')]){_0x533e85['include']=[{'all':!![]}];}_0x533e85=_['merge']({},_0x533e85,_0x56b4c5[_0x484f('0x3f')]);return db[_0x484f('0x2d')][_0x484f('0x48')](_0x533e85)[_0x484f('0x26')](handleEntityNotFound(_0x247621,null))['then'](respondWithResult(_0x247621,null))[_0x484f('0x43')](handleError(_0x247621,null));};exports[_0x484f('0x49')]=function(_0x26d96d,_0x1f713a){return db[_0x484f('0x2d')][_0x484f('0x49')](_0x26d96d['body'],{})[_0x484f('0x26')](respondWithResult(_0x1f713a,0xc9))[_0x484f('0x43')](handleError(_0x1f713a,null));};exports[_0x484f('0x4a')]=function(_0x4b50d1,_0xda7463){if(_0x4b50d1[_0x484f('0x4b')]['id']){delete _0x4b50d1[_0x484f('0x4b')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x4b50d1[_0x484f('0x45')]['id']}})[_0x484f('0x26')](handleEntityNotFound(_0xda7463,null))[_0x484f('0x26')](saveUpdates(_0x4b50d1['body'],null))['then'](respondWithResult(_0xda7463,null))['catch'](handleError(_0xda7463,null));};exports['destroy']=function(_0x14274b,_0xcdbc51){return db[_0x484f('0x2d')][_0x484f('0x48')]({'where':{'id':_0x14274b[_0x484f('0x45')]['id']}})[_0x484f('0x26')](handleEntityNotFound(_0xcdbc51,null))['then'](removeEntity(_0xcdbc51,null))['catch'](handleError(_0xcdbc51,null));};exports[_0x484f('0x4c')]=function(_0x241b71,_0x26bf69,_0x4a4946){var _0x489797={};var _0x483cf7={};var _0x4ce6f3;var _0x4d3198;return db[_0x484f('0x2d')]['findOne']({'where':{'id':_0x241b71[_0x484f('0x45')]['id']}})[_0x484f('0x26')](handleEntityNotFound(_0x26bf69,null))[_0x484f('0x26')](function(_0x309d01){if(_0x309d01){_0x4ce6f3=_0x309d01;_0x483cf7['model']=_['keys'](db['Dynamics365Field'][_0x484f('0x2e')]);_0x483cf7[_0x484f('0x32')]=_[_0x484f('0x46')](_0x241b71[_0x484f('0x32')]);_0x483cf7['filters']=_['intersection'](_0x483cf7[_0x484f('0x31')],_0x483cf7[_0x484f('0x32')]);_0x489797[_0x484f('0x35')]=_[_0x484f('0x34')](_0x483cf7[_0x484f('0x31')],qs['fields'](_0x241b71[_0x484f('0x32')][_0x484f('0x47')]));_0x489797['attributes']=_0x489797[_0x484f('0x35')][_0x484f('0x4d')]?_0x489797[_0x484f('0x35')]:_0x483cf7[_0x484f('0x31')];_0x489797[_0x484f('0x38')]=qs[_0x484f('0x39')](_0x241b71['query'][_0x484f('0x39')]);_0x489797[_0x484f('0x3a')]=qs[_0x484f('0x33')](_[_0x484f('0x3b')](_0x241b71[_0x484f('0x32')],_0x483cf7[_0x484f('0x33')]));if(_0x241b71['query'][_0x484f('0x3c')]){_0x489797[_0x484f('0x3a')]=_[_0x484f('0x3d')](_0x489797[_0x484f('0x3a')],{'$or':_[_0x484f('0x2c')](_0x489797[_0x484f('0x35')],function(_0x474ebb){var _0x11ba3d={};_0x11ba3d[_0x474ebb]={'$like':'%'+_0x241b71['query'][_0x484f('0x3c')]+'%'};return _0x11ba3d;})});}_0x489797=_[_0x484f('0x3d')]({},_0x489797,_0x241b71[_0x484f('0x3f')]);return _0x4ce6f3[_0x484f('0x4c')](_0x489797);}})[_0x484f('0x26')](function(_0x2f6a36){if(_0x2f6a36){_0x4d3198=_0x2f6a36[_0x484f('0x4d')];if(!_0x241b71[_0x484f('0x32')]['hasOwnProperty'](_0x484f('0x37'))){_0x489797[_0x484f('0x20')]=qs[_0x484f('0x20')](_0x241b71[_0x484f('0x32')][_0x484f('0x20')]);_0x489797[_0x484f('0x1d')]=qs['offset'](_0x241b71[_0x484f('0x32')][_0x484f('0x1d')]);}return _0x4ce6f3['getFields'](_0x489797);}})[_0x484f('0x26')](function(_0x3460db){if(_0x3460db){return _0x3460db?{'count':_0x4d3198,'rows':_0x3460db}:null;}})['then'](respondWithResult(_0x26bf69,null))[_0x484f('0x43')](handleError(_0x26bf69,null));};exports[_0x484f('0x4e')]=function(_0x3e91a3,_0x475d4a,_0x3be5b6){var _0x2c8bf2={};var _0x6e82ab={};var _0x57c20f;var _0x4c2163;return db[_0x484f('0x2d')][_0x484f('0x4f')]({'where':{'id':_0x3e91a3[_0x484f('0x45')]['id']}})[_0x484f('0x26')](handleEntityNotFound(_0x475d4a,null))[_0x484f('0x26')](function(_0x468a4e){if(_0x468a4e){_0x57c20f=_0x468a4e;_0x6e82ab[_0x484f('0x31')]=_[_0x484f('0x46')](db['Dynamics365Field'][_0x484f('0x2e')]);_0x6e82ab['query']=_['keys'](_0x3e91a3[_0x484f('0x32')]);_0x6e82ab[_0x484f('0x33')]=_[_0x484f('0x34')](_0x6e82ab[_0x484f('0x31')],_0x6e82ab[_0x484f('0x32')]);_0x2c8bf2[_0x484f('0x35')]=_[_0x484f('0x34')](_0x6e82ab[_0x484f('0x31')],qs[_0x484f('0x47')](_0x3e91a3[_0x484f('0x32')][_0x484f('0x47')]));_0x2c8bf2[_0x484f('0x35')]=_0x2c8bf2['attributes']['length']?_0x2c8bf2[_0x484f('0x35')]:_0x6e82ab[_0x484f('0x31')];_0x2c8bf2[_0x484f('0x38')]=qs['sort'](_0x3e91a3[_0x484f('0x32')][_0x484f('0x39')]);_0x2c8bf2[_0x484f('0x3a')]=qs[_0x484f('0x33')](_[_0x484f('0x3b')](_0x3e91a3[_0x484f('0x32')],_0x6e82ab[_0x484f('0x33')]));if(_0x3e91a3['query'][_0x484f('0x3c')]){_0x2c8bf2[_0x484f('0x3a')]=_[_0x484f('0x3d')](_0x2c8bf2['where'],{'$or':_[_0x484f('0x2c')](_0x2c8bf2[_0x484f('0x35')],function(_0x2d109e){var _0x4a34bc={};_0x4a34bc[_0x2d109e]={'$like':'%'+_0x3e91a3[_0x484f('0x32')][_0x484f('0x3c')]+'%'};return _0x4a34bc;})});}_0x2c8bf2=_['merge']({},_0x2c8bf2,_0x3e91a3[_0x484f('0x3f')]);return _0x57c20f['getSubjects'](_0x2c8bf2);}})['then'](function(_0x3c7178){if(_0x3c7178){_0x4c2163=_0x3c7178['length'];if(!_0x3e91a3[_0x484f('0x32')]['hasOwnProperty'](_0x484f('0x37'))){_0x2c8bf2[_0x484f('0x20')]=qs[_0x484f('0x20')](_0x3e91a3[_0x484f('0x32')][_0x484f('0x20')]);_0x2c8bf2[_0x484f('0x1d')]=qs[_0x484f('0x1d')](_0x3e91a3[_0x484f('0x32')][_0x484f('0x1d')]);}return _0x57c20f[_0x484f('0x4e')](_0x2c8bf2);}})['then'](function(_0x1d97bf){if(_0x1d97bf){return _0x1d97bf?{'count':_0x4c2163,'rows':_0x1d97bf}:null;}})[_0x484f('0x26')](respondWithResult(_0x475d4a,null))[_0x484f('0x43')](handleError(_0x475d4a,null));};exports[_0x484f('0x50')]=function(_0x2ad8ba,_0xe8213e,_0x206b33){var _0x5c71e5={};var _0x2bd16d={};var _0x5b20da;var _0x102de9;return db[_0x484f('0x2d')]['findOne']({'where':{'id':_0x2ad8ba['params']['id']}})['then'](handleEntityNotFound(_0xe8213e,null))[_0x484f('0x26')](function(_0x5213d0){if(_0x5213d0){_0x5b20da=_0x5213d0;_0x2bd16d['model']=_[_0x484f('0x46')](db[_0x484f('0x51')]['rawAttributes']);_0x2bd16d['query']=_[_0x484f('0x46')](_0x2ad8ba[_0x484f('0x32')]);_0x2bd16d[_0x484f('0x33')]=_['intersection'](_0x2bd16d[_0x484f('0x31')],_0x2bd16d['query']);_0x5c71e5[_0x484f('0x35')]=_[_0x484f('0x34')](_0x2bd16d[_0x484f('0x31')],qs[_0x484f('0x47')](_0x2ad8ba[_0x484f('0x32')][_0x484f('0x47')]));_0x5c71e5[_0x484f('0x35')]=_0x5c71e5[_0x484f('0x35')][_0x484f('0x4d')]?_0x5c71e5[_0x484f('0x35')]:_0x2bd16d[_0x484f('0x31')];_0x5c71e5[_0x484f('0x38')]=qs['sort'](_0x2ad8ba[_0x484f('0x32')]['sort']);_0x5c71e5[_0x484f('0x3a')]=qs[_0x484f('0x33')](_[_0x484f('0x3b')](_0x2ad8ba[_0x484f('0x32')],_0x2bd16d[_0x484f('0x33')]));if(_0x2ad8ba[_0x484f('0x32')][_0x484f('0x3c')]){_0x5c71e5['where']=_['merge'](_0x5c71e5[_0x484f('0x3a')],{'$or':_[_0x484f('0x2c')](_0x5c71e5[_0x484f('0x35')],function(_0x2cf81b){var _0x10745f={};_0x10745f[_0x2cf81b]={'$like':'%'+_0x2ad8ba[_0x484f('0x32')][_0x484f('0x3c')]+'%'};return _0x10745f;})});}_0x5c71e5=_['merge']({},_0x5c71e5,_0x2ad8ba[_0x484f('0x3f')]);return _0x5b20da[_0x484f('0x50')](_0x5c71e5);}})[_0x484f('0x26')](function(_0x337e3d){if(_0x337e3d){_0x102de9=_0x337e3d[_0x484f('0x4d')];if(!_0x2ad8ba[_0x484f('0x32')]['hasOwnProperty']('nolimit')){_0x5c71e5[_0x484f('0x20')]=qs[_0x484f('0x20')](_0x2ad8ba[_0x484f('0x32')][_0x484f('0x20')]);_0x5c71e5[_0x484f('0x1d')]=qs[_0x484f('0x1d')](_0x2ad8ba[_0x484f('0x32')]['offset']);}return _0x5b20da[_0x484f('0x50')](_0x5c71e5);}})['then'](function(_0x513a85){if(_0x513a85){return _0x513a85?{'count':_0x102de9,'rows':_0x513a85}:null;}})[_0x484f('0x26')](respondWithResult(_0xe8213e,null))[_0x484f('0x43')](handleError(_0xe8213e,null));}; \ No newline at end of file +var _0x45f6=['map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','Dynamics365Field','order','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','apply','save','update','destroy','then','error','stack','name','send','index'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x45f6,0x1f3));var _0x645f=function(_0x2b5ee5,_0x3741bf){_0x2b5ee5=_0x2b5ee5-0x0;var _0x1c480b=_0x45f6[_0x2b5ee5];return _0x1c480b;};'use strict';var emlformat=require(_0x645f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x645f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x645f('0x2'));var moment=require(_0x645f('0x3'));var BPromise=require(_0x645f('0x4'));var Mustache=require(_0x645f('0x5'));var util=require(_0x645f('0x6'));var path=require(_0x645f('0x7'));var sox=require(_0x645f('0x8'));var csv=require(_0x645f('0x9'));var ejs=require(_0x645f('0xa'));var fs=require('fs');var fs_extra=require(_0x645f('0xb'));var _=require(_0x645f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x645f('0xd'));var deskjs=require(_0x645f('0xe'));var toCsv=require(_0x645f('0x9'));var querystring=require('querystring');var Papa=require(_0x645f('0xf'));var Redis=require(_0x645f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x645f('0x11'));var as=require(_0x645f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x645f('0x13'));var utils=require('../../config/utils');var config=require(_0x645f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x645f('0x15'))['db'];function respondWithStatusCode(_0x47c319,_0x612960){_0x612960=_0x612960||0xcc;return function(_0x415d79){if(_0x415d79){return _0x47c319[_0x645f('0x16')](_0x612960);}return _0x47c319['status'](_0x612960)[_0x645f('0x17')]();};}function respondWithResult(_0x48f73c,_0x50240a){_0x50240a=_0x50240a||0xc8;return function(_0xd6a759){if(_0xd6a759){return _0x48f73c[_0x645f('0x18')](_0x50240a)[_0x645f('0x19')](_0xd6a759);}};}function respondWithFilteredResult(_0x53cbc6,_0x935191){return function(_0x3c0347){if(_0x3c0347){var _0x50b356=typeof _0x935191['offset']===_0x645f('0x1a')&&typeof _0x935191['limit']==='undefined';var _0x13f3a6=_0x3c0347[_0x645f('0x1b')];var _0x3a4525=_0x50b356?0x0:_0x935191[_0x645f('0x1c')];var _0x53b178=_0x50b356?_0x3c0347[_0x645f('0x1b')]:_0x935191[_0x645f('0x1c')]+_0x935191[_0x645f('0x1d')];var _0x5e63e3;if(_0x53b178>=_0x13f3a6){_0x53b178=_0x13f3a6;_0x5e63e3=0xc8;}else{_0x5e63e3=0xce;}_0x53cbc6[_0x645f('0x18')](_0x5e63e3);return _0x53cbc6['set']('Content-Range',_0x3a4525+'-'+_0x53b178+'/'+_0x13f3a6)[_0x645f('0x19')](_0x3c0347);}return null;};}function patchUpdates(_0x2f86a9){return function(_0x7e2b14){try{jsonpatch[_0x645f('0x1e')](_0x7e2b14,_0x2f86a9,!![]);}catch(_0x3a4b38){return BPromise['reject'](_0x3a4b38);}return _0x7e2b14[_0x645f('0x1f')]();};}function saveUpdates(_0x1ac91b,_0x3a68f7){return function(_0x3ea18c){if(_0x3ea18c){return _0x3ea18c[_0x645f('0x20')](_0x1ac91b)['then'](function(_0x5dff0b){return _0x5dff0b;});}return null;};}function removeEntity(_0x3f0b74,_0x45f846){return function(_0x50a259){if(_0x50a259){return _0x50a259[_0x645f('0x21')]()[_0x645f('0x22')](function(){_0x3f0b74[_0x645f('0x18')](0xcc)[_0x645f('0x17')]();});}};}function handleEntityNotFound(_0x45839f,_0x511bb7){return function(_0x3b6fda){if(!_0x3b6fda){_0x45839f[_0x645f('0x16')](0x194);}return _0x3b6fda;};}function handleError(_0x26c398,_0x536a10){_0x536a10=_0x536a10||0x1f4;return function(_0x2c1ea9){logger[_0x645f('0x23')](_0x2c1ea9[_0x645f('0x24')]);if(_0x2c1ea9[_0x645f('0x25')]){delete _0x2c1ea9[_0x645f('0x25')];}_0x26c398[_0x645f('0x18')](_0x536a10)[_0x645f('0x26')](_0x2c1ea9);};}exports[_0x645f('0x27')]=function(_0x2de774,_0x54a635){var _0x11dae5={},_0x27c1a8={},_0x4428ca={'count':0x0,'rows':[]};var _0x40229e=_[_0x645f('0x28')](db[_0x645f('0x29')][_0x645f('0x2a')],function(_0x419c17){return{'name':_0x419c17[_0x645f('0x2b')],'type':_0x419c17[_0x645f('0x2c')][_0x645f('0x2d')]};});_0x27c1a8[_0x645f('0x2e')]=_[_0x645f('0x28')](_0x40229e,_0x645f('0x25'));_0x27c1a8['query']=_[_0x645f('0x2f')](_0x2de774[_0x645f('0x30')]);_0x27c1a8[_0x645f('0x31')]=_[_0x645f('0x32')](_0x27c1a8['model'],_0x27c1a8[_0x645f('0x30')]);_0x11dae5[_0x645f('0x33')]=_[_0x645f('0x32')](_0x27c1a8[_0x645f('0x2e')],qs[_0x645f('0x34')](_0x2de774[_0x645f('0x30')]['fields']));_0x11dae5[_0x645f('0x33')]=_0x11dae5[_0x645f('0x33')][_0x645f('0x35')]?_0x11dae5[_0x645f('0x33')]:_0x27c1a8[_0x645f('0x2e')];if(!_0x2de774[_0x645f('0x30')][_0x645f('0x36')]('nolimit')){_0x11dae5[_0x645f('0x1d')]=qs['limit'](_0x2de774[_0x645f('0x30')][_0x645f('0x1d')]);_0x11dae5[_0x645f('0x1c')]=qs[_0x645f('0x1c')](_0x2de774['query'][_0x645f('0x1c')]);}_0x11dae5['order']=qs[_0x645f('0x37')](_0x2de774[_0x645f('0x30')][_0x645f('0x37')]);_0x11dae5['where']=qs['filters'](_[_0x645f('0x38')](_0x2de774[_0x645f('0x30')],_0x27c1a8['filters']),_0x40229e);if(_0x2de774['query'][_0x645f('0x39')]){_0x11dae5[_0x645f('0x3a')]=_[_0x645f('0x3b')](_0x11dae5['where'],{'$or':_[_0x645f('0x28')](_0x40229e,function(_0xea27b3){if(_0xea27b3[_0x645f('0x2c')]!=='VIRTUAL'){var _0x1b9a02={};_0x1b9a02[_0xea27b3['name']]={'$like':'%'+_0x2de774[_0x645f('0x30')][_0x645f('0x39')]+'%'};return _0x1b9a02;}})});}_0x11dae5=_['merge']({},_0x11dae5,_0x2de774[_0x645f('0x3c')]);var _0x403da6={'where':_0x11dae5[_0x645f('0x3a')]};return db['Dynamics365Configuration']['count'](_0x403da6)[_0x645f('0x22')](function(_0x36587d){_0x4428ca[_0x645f('0x1b')]=_0x36587d;if(_0x2de774[_0x645f('0x30')][_0x645f('0x3d')]){_0x11dae5[_0x645f('0x3e')]=[{'all':!![]}];}return db[_0x645f('0x29')][_0x645f('0x3f')](_0x11dae5);})[_0x645f('0x22')](function(_0x7404ca){_0x4428ca[_0x645f('0x40')]=_0x7404ca;return _0x4428ca;})[_0x645f('0x22')](respondWithFilteredResult(_0x54a635,_0x11dae5))[_0x645f('0x41')](handleError(_0x54a635,null));};exports['show']=function(_0x126d24,_0x53bdce){var _0xc892dd={'raw':![],'where':{'id':_0x126d24[_0x645f('0x42')]['id']}},_0x53815e={};_0x53815e[_0x645f('0x2e')]=_['keys'](db[_0x645f('0x29')][_0x645f('0x2a')]);_0x53815e['query']=_['keys'](_0x126d24[_0x645f('0x30')]);_0x53815e['filters']=_[_0x645f('0x32')](_0x53815e[_0x645f('0x2e')],_0x53815e[_0x645f('0x30')]);_0xc892dd['attributes']=_['intersection'](_0x53815e[_0x645f('0x2e')],qs[_0x645f('0x34')](_0x126d24['query']['fields']));_0xc892dd['attributes']=_0xc892dd[_0x645f('0x33')][_0x645f('0x35')]?_0xc892dd[_0x645f('0x33')]:_0x53815e[_0x645f('0x2e')];if(_0x126d24[_0x645f('0x30')][_0x645f('0x3d')]){_0xc892dd['include']=[{'all':!![]}];}_0xc892dd=_[_0x645f('0x3b')]({},_0xc892dd,_0x126d24[_0x645f('0x3c')]);return db[_0x645f('0x29')][_0x645f('0x43')](_0xc892dd)[_0x645f('0x22')](handleEntityNotFound(_0x53bdce,null))[_0x645f('0x22')](respondWithResult(_0x53bdce,null))[_0x645f('0x41')](handleError(_0x53bdce,null));};exports[_0x645f('0x44')]=function(_0x365579,_0x275ba0){return db['Dynamics365Configuration'][_0x645f('0x44')](_0x365579[_0x645f('0x45')],{})['then'](respondWithResult(_0x275ba0,0xc9))[_0x645f('0x41')](handleError(_0x275ba0,null));};exports[_0x645f('0x20')]=function(_0x61edb,_0x4930d6){if(_0x61edb[_0x645f('0x45')]['id']){delete _0x61edb[_0x645f('0x45')]['id'];}return db[_0x645f('0x29')]['find']({'where':{'id':_0x61edb[_0x645f('0x42')]['id']}})[_0x645f('0x22')](handleEntityNotFound(_0x4930d6,null))[_0x645f('0x22')](saveUpdates(_0x61edb['body'],null))[_0x645f('0x22')](respondWithResult(_0x4930d6,null))[_0x645f('0x41')](handleError(_0x4930d6,null));};exports['destroy']=function(_0x2aba6e,_0x32d0f5){return db['Dynamics365Configuration'][_0x645f('0x43')]({'where':{'id':_0x2aba6e[_0x645f('0x42')]['id']}})['then'](handleEntityNotFound(_0x32d0f5,null))[_0x645f('0x22')](removeEntity(_0x32d0f5,null))['catch'](handleError(_0x32d0f5,null));};exports[_0x645f('0x46')]=function(_0x3c37d8,_0x22bcb5,_0x57a0a2){var _0x5248e7={};var _0x4d534b={};var _0x19b9f3;var _0x3b4589;return db['Dynamics365Configuration'][_0x645f('0x47')]({'where':{'id':_0x3c37d8['params']['id']}})[_0x645f('0x22')](handleEntityNotFound(_0x22bcb5,null))[_0x645f('0x22')](function(_0x4e8bc9){if(_0x4e8bc9){_0x19b9f3=_0x4e8bc9;_0x4d534b[_0x645f('0x2e')]=_[_0x645f('0x2f')](db[_0x645f('0x48')][_0x645f('0x2a')]);_0x4d534b[_0x645f('0x30')]=_[_0x645f('0x2f')](_0x3c37d8[_0x645f('0x30')]);_0x4d534b[_0x645f('0x31')]=_[_0x645f('0x32')](_0x4d534b[_0x645f('0x2e')],_0x4d534b[_0x645f('0x30')]);_0x5248e7[_0x645f('0x33')]=_[_0x645f('0x32')](_0x4d534b[_0x645f('0x2e')],qs[_0x645f('0x34')](_0x3c37d8[_0x645f('0x30')][_0x645f('0x34')]));_0x5248e7[_0x645f('0x33')]=_0x5248e7[_0x645f('0x33')]['length']?_0x5248e7[_0x645f('0x33')]:_0x4d534b[_0x645f('0x2e')];_0x5248e7[_0x645f('0x49')]=qs[_0x645f('0x37')](_0x3c37d8[_0x645f('0x30')]['sort']);_0x5248e7[_0x645f('0x3a')]=qs[_0x645f('0x31')](_[_0x645f('0x38')](_0x3c37d8[_0x645f('0x30')],_0x4d534b['filters']));if(_0x3c37d8[_0x645f('0x30')][_0x645f('0x39')]){_0x5248e7[_0x645f('0x3a')]=_[_0x645f('0x3b')](_0x5248e7[_0x645f('0x3a')],{'$or':_[_0x645f('0x28')](_0x5248e7[_0x645f('0x33')],function(_0x259475){var _0x324f7f={};_0x324f7f[_0x259475]={'$like':'%'+_0x3c37d8['query']['filter']+'%'};return _0x324f7f;})});}_0x5248e7=_['merge']({},_0x5248e7,_0x3c37d8[_0x645f('0x3c')]);return _0x19b9f3['getFields'](_0x5248e7);}})['then'](function(_0xae9fd3){if(_0xae9fd3){_0x3b4589=_0xae9fd3[_0x645f('0x35')];if(!_0x3c37d8[_0x645f('0x30')][_0x645f('0x36')]('nolimit')){_0x5248e7[_0x645f('0x1d')]=qs[_0x645f('0x1d')](_0x3c37d8[_0x645f('0x30')][_0x645f('0x1d')]);_0x5248e7['offset']=qs['offset'](_0x3c37d8[_0x645f('0x30')]['offset']);}return _0x19b9f3[_0x645f('0x46')](_0x5248e7);}})['then'](function(_0x3a824d){if(_0x3a824d){return _0x3a824d?{'count':_0x3b4589,'rows':_0x3a824d}:null;}})[_0x645f('0x22')](respondWithResult(_0x22bcb5,null))[_0x645f('0x41')](handleError(_0x22bcb5,null));};exports[_0x645f('0x4a')]=function(_0x2ae66b,_0x55ec69,_0x43bc1e){var _0x46f391={};var _0x1cf25e={};var _0x1ad3a2;var _0x524bac;return db[_0x645f('0x29')][_0x645f('0x47')]({'where':{'id':_0x2ae66b[_0x645f('0x42')]['id']}})[_0x645f('0x22')](handleEntityNotFound(_0x55ec69,null))[_0x645f('0x22')](function(_0x415399){if(_0x415399){_0x1ad3a2=_0x415399;_0x1cf25e['model']=_[_0x645f('0x2f')](db[_0x645f('0x48')]['rawAttributes']);_0x1cf25e[_0x645f('0x30')]=_[_0x645f('0x2f')](_0x2ae66b['query']);_0x1cf25e[_0x645f('0x31')]=_['intersection'](_0x1cf25e[_0x645f('0x2e')],_0x1cf25e[_0x645f('0x30')]);_0x46f391['attributes']=_['intersection'](_0x1cf25e['model'],qs[_0x645f('0x34')](_0x2ae66b[_0x645f('0x30')][_0x645f('0x34')]));_0x46f391['attributes']=_0x46f391[_0x645f('0x33')][_0x645f('0x35')]?_0x46f391[_0x645f('0x33')]:_0x1cf25e[_0x645f('0x2e')];_0x46f391[_0x645f('0x49')]=qs['sort'](_0x2ae66b[_0x645f('0x30')][_0x645f('0x37')]);_0x46f391[_0x645f('0x3a')]=qs['filters'](_[_0x645f('0x38')](_0x2ae66b[_0x645f('0x30')],_0x1cf25e[_0x645f('0x31')]));if(_0x2ae66b['query'][_0x645f('0x39')]){_0x46f391[_0x645f('0x3a')]=_['merge'](_0x46f391[_0x645f('0x3a')],{'$or':_[_0x645f('0x28')](_0x46f391[_0x645f('0x33')],function(_0x17f7da){var _0x16372f={};_0x16372f[_0x17f7da]={'$like':'%'+_0x2ae66b[_0x645f('0x30')][_0x645f('0x39')]+'%'};return _0x16372f;})});}_0x46f391=_[_0x645f('0x3b')]({},_0x46f391,_0x2ae66b['options']);return _0x1ad3a2[_0x645f('0x4a')](_0x46f391);}})[_0x645f('0x22')](function(_0xaebb0a){if(_0xaebb0a){_0x524bac=_0xaebb0a['length'];if(!_0x2ae66b[_0x645f('0x30')][_0x645f('0x36')](_0x645f('0x4b'))){_0x46f391['limit']=qs['limit'](_0x2ae66b[_0x645f('0x30')][_0x645f('0x1d')]);_0x46f391['offset']=qs[_0x645f('0x1c')](_0x2ae66b[_0x645f('0x30')][_0x645f('0x1c')]);}return _0x1ad3a2[_0x645f('0x4a')](_0x46f391);}})[_0x645f('0x22')](function(_0x9a54d3){if(_0x9a54d3){return _0x9a54d3?{'count':_0x524bac,'rows':_0x9a54d3}:null;}})[_0x645f('0x22')](respondWithResult(_0x55ec69,null))[_0x645f('0x41')](handleError(_0x55ec69,null));};exports[_0x645f('0x4c')]=function(_0x5b24d7,_0x37ae3d,_0x30744c){var _0xb567a1={};var _0x2ee8fa={};var _0x17036d;var _0x14387e;return db[_0x645f('0x29')]['findOne']({'where':{'id':_0x5b24d7[_0x645f('0x42')]['id']}})[_0x645f('0x22')](handleEntityNotFound(_0x37ae3d,null))['then'](function(_0xc22cc1){if(_0xc22cc1){_0x17036d=_0xc22cc1;_0x2ee8fa[_0x645f('0x2e')]=_[_0x645f('0x2f')](db[_0x645f('0x48')]['rawAttributes']);_0x2ee8fa[_0x645f('0x30')]=_[_0x645f('0x2f')](_0x5b24d7[_0x645f('0x30')]);_0x2ee8fa[_0x645f('0x31')]=_[_0x645f('0x32')](_0x2ee8fa['model'],_0x2ee8fa['query']);_0xb567a1[_0x645f('0x33')]=_[_0x645f('0x32')](_0x2ee8fa[_0x645f('0x2e')],qs[_0x645f('0x34')](_0x5b24d7[_0x645f('0x30')][_0x645f('0x34')]));_0xb567a1[_0x645f('0x33')]=_0xb567a1[_0x645f('0x33')]['length']?_0xb567a1[_0x645f('0x33')]:_0x2ee8fa[_0x645f('0x2e')];_0xb567a1[_0x645f('0x49')]=qs[_0x645f('0x37')](_0x5b24d7[_0x645f('0x30')][_0x645f('0x37')]);_0xb567a1['where']=qs['filters'](_[_0x645f('0x38')](_0x5b24d7[_0x645f('0x30')],_0x2ee8fa[_0x645f('0x31')]));if(_0x5b24d7[_0x645f('0x30')]['filter']){_0xb567a1[_0x645f('0x3a')]=_[_0x645f('0x3b')](_0xb567a1[_0x645f('0x3a')],{'$or':_[_0x645f('0x28')](_0xb567a1[_0x645f('0x33')],function(_0x54b220){var _0x11e5cb={};_0x11e5cb[_0x54b220]={'$like':'%'+_0x5b24d7['query']['filter']+'%'};return _0x11e5cb;})});}_0xb567a1=_[_0x645f('0x3b')]({},_0xb567a1,_0x5b24d7[_0x645f('0x3c')]);return _0x17036d[_0x645f('0x4c')](_0xb567a1);}})[_0x645f('0x22')](function(_0x1f0756){if(_0x1f0756){_0x14387e=_0x1f0756['length'];if(!_0x5b24d7[_0x645f('0x30')]['hasOwnProperty']('nolimit')){_0xb567a1[_0x645f('0x1d')]=qs[_0x645f('0x1d')](_0x5b24d7[_0x645f('0x30')][_0x645f('0x1d')]);_0xb567a1['offset']=qs[_0x645f('0x1c')](_0x5b24d7[_0x645f('0x30')]['offset']);}return _0x17036d[_0x645f('0x4c')](_0xb567a1);}})[_0x645f('0x22')](function(_0x25c89d){if(_0x25c89d){return _0x25c89d?{'count':_0x14387e,'rows':_0x25c89d}:null;}})[_0x645f('0x22')](respondWithResult(_0x37ae3d,null))[_0x645f('0x41')](handleError(_0x37ae3d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 79f517a..21cc2a4 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x4d0524,_0x54ca74){var _0x4d45ef=function(_0x4d5919){while(--_0x4d5919){_0x4d0524['push'](_0x4d0524['shift']());}};_0x4d45ef(++_0x54ca74);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x449f0b,_0x120e67){_0x449f0b=_0x449f0b-0x0;var _0x479b2b=_0x6f0d[_0x449f0b];return _0x479b2b;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'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 6f3c856..5f5952c 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 _0x8d7e=['message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x45934d,_0x320d8e){var _0x286e59=function(_0x56f3e4){while(--_0x56f3e4){_0x45934d['push'](_0x45934d['shift']());}};_0x286e59(++_0x320d8e);}(_0x8d7e,0xa4));var _0xe8d7=function(_0x33aaa7,_0x4b521f){_0x33aaa7=_0x33aaa7-0x0;var _0x14f59f=_0x8d7e[_0x33aaa7];return _0x14f59f;};'use strict';var _=require('lodash');var util=require(_0xe8d7('0x0'));var moment=require(_0xe8d7('0x1'));var BPromise=require(_0xe8d7('0x2'));var rs=require(_0xe8d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8d7('0x4'));var logger=require(_0xe8d7('0x5'))('rpc');var config=require(_0xe8d7('0x6'));var jayson=require(_0xe8d7('0x7'));var client=jayson[_0xe8d7('0x8')][_0xe8d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x137b34,_0x4a486a,_0x155849){return new BPromise(function(_0x593979,_0x522016){return client[_0xe8d7('0xa')](_0x137b34,_0x155849)[_0xe8d7('0xb')](function(_0x3443b2){logger[_0xe8d7('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4a486a,_0xe8d7('0xd'));logger[_0xe8d7('0xe')](_0xe8d7('0xf'),_0x4a486a,_0xe8d7('0xd'),JSON[_0xe8d7('0x10')](_0x3443b2));if(_0x3443b2[_0xe8d7('0x11')]){if(_0x3443b2['error'][_0xe8d7('0x12')]===0x1f4){logger[_0xe8d7('0x11')](_0xe8d7('0x13'),_0x4a486a,_0x3443b2[_0xe8d7('0x11')][_0xe8d7('0x14')]);return _0x522016(_0x3443b2[_0xe8d7('0x11')][_0xe8d7('0x14')]);}logger[_0xe8d7('0x11')](_0xe8d7('0x13'),_0x4a486a,_0x3443b2[_0xe8d7('0x11')]['message']);return _0x593979(_0x3443b2[_0xe8d7('0x11')][_0xe8d7('0x14')]);}else{logger[_0xe8d7('0xc')](_0xe8d7('0x13'),_0x4a486a,_0xe8d7('0xd'));_0x593979(_0x3443b2[_0xe8d7('0x15')][_0xe8d7('0x14')]);}})[_0xe8d7('0x16')](function(_0x7a407f){logger['error'](_0xe8d7('0x13'),_0x4a486a,_0x7a407f);_0x522016(_0x7a407f);});});} \ No newline at end of file +var _0x74d6=['error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x40d0f1,_0x1e7166){var _0x115a6d=function(_0x150bb7){while(--_0x150bb7){_0x40d0f1['push'](_0x40d0f1['shift']());}};_0x115a6d(++_0x1e7166);}(_0x74d6,0x1e3));var _0x674d=function(_0x5c5970,_0xea1af3){_0x5c5970=_0x5c5970-0x0;var _0x4bf588=_0x74d6[_0x5c5970];return _0x4bf588;};'use strict';var _=require(_0x674d('0x0'));var util=require(_0x674d('0x1'));var moment=require('moment');var BPromise=require(_0x674d('0x2'));var rs=require(_0x674d('0x3'));var fs=require('fs');var Redis=require(_0x674d('0x4'));var db=require(_0x674d('0x5'))['db'];var utils=require(_0x674d('0x6'));var logger=require('../../config/logger')(_0x674d('0x7'));var config=require(_0x674d('0x8'));var jayson=require(_0x674d('0x9'));var client=jayson[_0x674d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x136287,_0x4b29be,_0x33e431){return new BPromise(function(_0x5b262e,_0x4ddfdc){return client[_0x674d('0xb')](_0x136287,_0x33e431)[_0x674d('0xc')](function(_0x255b97){logger['info'](_0x674d('0xd'),_0x4b29be,'request\x20sent');logger['debug'](_0x674d('0xe'),_0x4b29be,_0x674d('0xf'),JSON[_0x674d('0x10')](_0x255b97));if(_0x255b97[_0x674d('0x11')]){if(_0x255b97['error'][_0x674d('0x12')]===0x1f4){logger[_0x674d('0x11')](_0x674d('0xd'),_0x4b29be,_0x255b97[_0x674d('0x11')][_0x674d('0x13')]);return _0x4ddfdc(_0x255b97[_0x674d('0x11')][_0x674d('0x13')]);}logger[_0x674d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4b29be,_0x255b97['error'][_0x674d('0x13')]);return _0x5b262e(_0x255b97[_0x674d('0x11')]['message']);}else{logger['info'](_0x674d('0xd'),_0x4b29be,'request\x20sent');_0x5b262e(_0x255b97['result'][_0x674d('0x13')]);}})['catch'](function(_0x1b61e0){logger['error'](_0x674d('0xd'),_0x4b29be,_0x1b61e0);_0x4ddfdc(_0x1b61e0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 63ef180..e95b4f0 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 _0xd960=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','delete'];(function(_0x340968,_0x11ca07){var _0x22e500=function(_0x44819b){while(--_0x44819b){_0x340968['push'](_0x340968['shift']());}};_0x22e500(++_0x11ca07);}(_0xd960,0x144));var _0x0d96=function(_0x2b2b4d,_0x201a7d){_0x2b2b4d=_0x2b2b4d-0x0;var _0x1dad7c=_0xd960[_0x2b2b4d];return _0x1dad7c;};'use strict';var multer=require(_0x0d96('0x0'));var util=require(_0x0d96('0x1'));var path=require('path');var timeout=require(_0x0d96('0x2'));var express=require(_0x0d96('0x3'));var router=express[_0x0d96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0d96('0x5'));var interaction=require(_0x0d96('0x6'));var config=require('../../config/environment');var controller=require(_0x0d96('0x7'));router[_0x0d96('0x8')]('/',auth[_0x0d96('0x9')](),controller[_0x0d96('0xa')]);router[_0x0d96('0x8')](_0x0d96('0xb'),auth[_0x0d96('0x9')](),controller[_0x0d96('0xc')]);router[_0x0d96('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d96('0xe')]);router['put']('/:id',auth[_0x0d96('0x9')](),controller['update']);router[_0x0d96('0xf')](_0x0d96('0xb'),auth[_0x0d96('0x9')](),controller['destroy']);module[_0x0d96('0x10')]=router; \ No newline at end of file +var _0x80a1=['./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b393d,_0xa634a8){var _0x5dbc9f=function(_0x5befad){while(--_0x5befad){_0x1b393d['push'](_0x1b393d['shift']());}};_0x5dbc9f(++_0xa634a8);}(_0x80a1,0x173));var _0x180a=function(_0x16e844,_0x4120ff){_0x16e844=_0x16e844-0x0;var _0x1dd7b4=_0x80a1[_0x16e844];return _0x1dd7b4;};'use strict';var multer=require(_0x180a('0x0'));var util=require('util');var path=require(_0x180a('0x1'));var timeout=require(_0x180a('0x2'));var express=require(_0x180a('0x3'));var router=express[_0x180a('0x4')]();var fs_extra=require(_0x180a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x180a('0x6'));var config=require('../../config/environment');var controller=require(_0x180a('0x7'));router[_0x180a('0x8')]('/',auth['isAuthenticated'](),controller[_0x180a('0x9')]);router[_0x180a('0x8')](_0x180a('0xa'),auth[_0x180a('0xb')](),controller[_0x180a('0xc')]);router['post']('/',auth[_0x180a('0xb')](),controller[_0x180a('0xd')]);router[_0x180a('0xe')](_0x180a('0xa'),auth[_0x180a('0xb')](),controller[_0x180a('0xf')]);router['delete'](_0x180a('0xa'),auth[_0x180a('0xb')](),controller[_0x180a('0x10')]);module[_0x180a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 64bc7db..ff90cb3 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 _0xd747=['ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x13c737,_0xc1ab62){var _0x34e425=function(_0x3e2ae3){while(--_0x3e2ae3){_0x13c737['push'](_0x13c737['shift']());}};_0x34e425(++_0xc1ab62);}(_0xd747,0xff));var _0x7d74=function(_0x967386,_0x3cabcf){_0x967386=_0x967386-0x0;var _0x3b432c=_0xd747[_0x967386];return _0x3b432c;};'use strict';var Sequelize=require(_0x7d74('0x0'));module['exports']={'type':{'type':Sequelize[_0x7d74('0x1')](_0x7d74('0x2'),'variable',_0x7d74('0x3'),_0x7d74('0x4'),_0x7d74('0x5')),'defaultValue':_0x7d74('0x2')},'content':{'type':Sequelize[_0x7d74('0x6')]},'key':{'type':Sequelize[_0x7d74('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7d74('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7d74('0x6')]},'idField':{'type':Sequelize[_0x7d74('0x6')]},'nameField':{'type':Sequelize[_0x7d74('0x6')]},'customField':{'type':Sequelize[_0x7d74('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x036d=['picklist','STRING','variable','customVariable','BOOLEAN','ENUM','string','keyValue'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x036d,0x1e5));var _0xd036=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x036d[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd036('0x0')](_0xd036('0x1'),'variable','customVariable',_0xd036('0x2'),_0xd036('0x3')),'defaultValue':_0xd036('0x1')},'content':{'type':Sequelize[_0xd036('0x4')]},'key':{'type':Sequelize[_0xd036('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xd036('0x1'),_0xd036('0x5'),_0xd036('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd036('0x4')]},'customField':{'type':Sequelize[_0xd036('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd036('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 39592d4..4c29a37 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 _0x01da=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','eml-format','rimraf','fast-json-patch'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x01da,0x131));var _0xa01d=function(_0x49a5bb,_0x350126){_0x49a5bb=_0x49a5bb-0x0;var _0x2ad845=_0x01da[_0x49a5bb];return _0x2ad845;};'use strict';var emlformat=require(_0xa01d('0x0'));var rimraf=require(_0xa01d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa01d('0x2'));var rp=require(_0xa01d('0x3'));var moment=require(_0xa01d('0x4'));var BPromise=require(_0xa01d('0x5'));var Mustache=require(_0xa01d('0x6'));var util=require(_0xa01d('0x7'));var path=require(_0xa01d('0x8'));var sox=require(_0xa01d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa01d('0xa'));var _=require(_0xa01d('0xb'));var squel=require(_0xa01d('0xc'));var crypto=require(_0xa01d('0xd'));var jsforce=require(_0xa01d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa01d('0xf'));var querystring=require(_0xa01d('0x10'));var Papa=require(_0xa01d('0x11'));var Redis=require(_0xa01d('0x12'));var authService=require(_0xa01d('0x13'));var qs=require(_0xa01d('0x14'));var as=require(_0xa01d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa01d('0x16'))(_0xa01d('0x17'));var utils=require(_0xa01d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa01d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c2c8,_0x18c3a5){_0x18c3a5=_0x18c3a5||0xcc;return function(_0x52d2e7){if(_0x52d2e7){return _0x13c2c8['sendStatus'](_0x18c3a5);}return _0x13c2c8[_0xa01d('0x1a')](_0x18c3a5)['end']();};}function respondWithResult(_0x2c32cd,_0x35c468){_0x35c468=_0x35c468||0xc8;return function(_0x100bec){if(_0x100bec){return _0x2c32cd[_0xa01d('0x1a')](_0x35c468)['json'](_0x100bec);}};}function respondWithFilteredResult(_0xa0a769,_0x414fb4){return function(_0x8f03ae){if(_0x8f03ae){var _0x258857=typeof _0x414fb4[_0xa01d('0x1b')]===_0xa01d('0x1c')&&typeof _0x414fb4[_0xa01d('0x1d')]===_0xa01d('0x1c');var _0x39110f=_0x8f03ae[_0xa01d('0x1e')];var _0x56857c=_0x258857?0x0:_0x414fb4[_0xa01d('0x1b')];var _0xd02ccb=_0x258857?_0x8f03ae['count']:_0x414fb4[_0xa01d('0x1b')]+_0x414fb4[_0xa01d('0x1d')];var _0x1003a4;if(_0xd02ccb>=_0x39110f){_0xd02ccb=_0x39110f;_0x1003a4=0xc8;}else{_0x1003a4=0xce;}_0xa0a769[_0xa01d('0x1a')](_0x1003a4);return _0xa0a769[_0xa01d('0x1f')](_0xa01d('0x20'),_0x56857c+'-'+_0xd02ccb+'/'+_0x39110f)[_0xa01d('0x21')](_0x8f03ae);}return null;};}function patchUpdates(_0x2ebab5){return function(_0x43a70c){try{jsonpatch[_0xa01d('0x22')](_0x43a70c,_0x2ebab5,!![]);}catch(_0x3371ae){return BPromise[_0xa01d('0x23')](_0x3371ae);}return _0x43a70c[_0xa01d('0x24')]();};}function saveUpdates(_0x1bbadc,_0xabb58e){return function(_0x270972){if(_0x270972){return _0x270972[_0xa01d('0x25')](_0x1bbadc)[_0xa01d('0x26')](function(_0x8a5631){return _0x8a5631;});}return null;};}function removeEntity(_0x1ce72e,_0x24892c){return function(_0x1102ac){if(_0x1102ac){return _0x1102ac[_0xa01d('0x27')]()[_0xa01d('0x26')](function(){_0x1ce72e[_0xa01d('0x1a')](0xcc)[_0xa01d('0x28')]();});}};}function handleEntityNotFound(_0x5147f6,_0x26ad73){return function(_0x2eba0c){if(!_0x2eba0c){_0x5147f6['sendStatus'](0x194);}return _0x2eba0c;};}function handleError(_0x12c66d,_0x910f55){_0x910f55=_0x910f55||0x1f4;return function(_0x2b42c8){logger[_0xa01d('0x29')](_0x2b42c8[_0xa01d('0x2a')]);if(_0x2b42c8['name']){delete _0x2b42c8[_0xa01d('0x2b')];}_0x12c66d[_0xa01d('0x1a')](_0x910f55)[_0xa01d('0x2c')](_0x2b42c8);};}exports[_0xa01d('0x2d')]=function(_0x4bab95,_0x3de569){var _0x2d1e93={},_0x1782d0={},_0xb3a849={'count':0x0,'rows':[]};var _0x45b2fb=_[_0xa01d('0x2e')](db[_0xa01d('0x2f')][_0xa01d('0x30')],function(_0x344150){return{'name':_0x344150['fieldName'],'type':_0x344150[_0xa01d('0x31')][_0xa01d('0x32')]};});_0x1782d0[_0xa01d('0x33')]=_[_0xa01d('0x2e')](_0x45b2fb,_0xa01d('0x2b'));_0x1782d0[_0xa01d('0x34')]=_['keys'](_0x4bab95[_0xa01d('0x34')]);_0x1782d0['filters']=_[_0xa01d('0x35')](_0x1782d0[_0xa01d('0x33')],_0x1782d0['query']);_0x2d1e93['attributes']=_[_0xa01d('0x35')](_0x1782d0[_0xa01d('0x33')],qs[_0xa01d('0x36')](_0x4bab95[_0xa01d('0x34')][_0xa01d('0x36')]));_0x2d1e93[_0xa01d('0x37')]=_0x2d1e93[_0xa01d('0x37')][_0xa01d('0x38')]?_0x2d1e93[_0xa01d('0x37')]:_0x1782d0[_0xa01d('0x33')];if(!_0x4bab95[_0xa01d('0x34')][_0xa01d('0x39')](_0xa01d('0x3a'))){_0x2d1e93[_0xa01d('0x1d')]=qs[_0xa01d('0x1d')](_0x4bab95[_0xa01d('0x34')]['limit']);_0x2d1e93[_0xa01d('0x1b')]=qs['offset'](_0x4bab95['query'][_0xa01d('0x1b')]);}_0x2d1e93[_0xa01d('0x3b')]=qs[_0xa01d('0x3c')](_0x4bab95[_0xa01d('0x34')][_0xa01d('0x3c')]);_0x2d1e93[_0xa01d('0x3d')]=qs[_0xa01d('0x3e')](_[_0xa01d('0x3f')](_0x4bab95[_0xa01d('0x34')],_0x1782d0[_0xa01d('0x3e')]),_0x45b2fb);if(_0x4bab95[_0xa01d('0x34')][_0xa01d('0x40')]){_0x2d1e93[_0xa01d('0x3d')]=_['merge'](_0x2d1e93['where'],{'$or':_['map'](_0x45b2fb,function(_0x5dc1fc){if(_0x5dc1fc[_0xa01d('0x31')]!=='VIRTUAL'){var _0x270c26={};_0x270c26[_0x5dc1fc[_0xa01d('0x2b')]]={'$like':'%'+_0x4bab95[_0xa01d('0x34')][_0xa01d('0x40')]+'%'};return _0x270c26;}})});}_0x2d1e93=_[_0xa01d('0x41')]({},_0x2d1e93,_0x4bab95[_0xa01d('0x42')]);var _0xf448ad={'where':_0x2d1e93[_0xa01d('0x3d')]};return db[_0xa01d('0x2f')][_0xa01d('0x1e')](_0xf448ad)['then'](function(_0x2fd963){_0xb3a849['count']=_0x2fd963;if(_0x4bab95[_0xa01d('0x34')][_0xa01d('0x43')]){_0x2d1e93[_0xa01d('0x44')]=[{'all':!![]}];}return db[_0xa01d('0x2f')][_0xa01d('0x45')](_0x2d1e93);})['then'](function(_0x828fb6){_0xb3a849['rows']=_0x828fb6;return _0xb3a849;})[_0xa01d('0x26')](respondWithFilteredResult(_0x3de569,_0x2d1e93))['catch'](handleError(_0x3de569,null));};exports[_0xa01d('0x46')]=function(_0x161363,_0x172c15){var _0x46d9ca={'raw':!![],'where':{'id':_0x161363[_0xa01d('0x47')]['id']}},_0x46c57b={};_0x46c57b[_0xa01d('0x33')]=_[_0xa01d('0x48')](db[_0xa01d('0x2f')]['rawAttributes']);_0x46c57b['query']=_[_0xa01d('0x48')](_0x161363[_0xa01d('0x34')]);_0x46c57b[_0xa01d('0x3e')]=_['intersection'](_0x46c57b[_0xa01d('0x33')],_0x46c57b['query']);_0x46d9ca[_0xa01d('0x37')]=_['intersection'](_0x46c57b[_0xa01d('0x33')],qs[_0xa01d('0x36')](_0x161363['query']['fields']));_0x46d9ca[_0xa01d('0x37')]=_0x46d9ca[_0xa01d('0x37')][_0xa01d('0x38')]?_0x46d9ca[_0xa01d('0x37')]:_0x46c57b[_0xa01d('0x33')];if(_0x161363[_0xa01d('0x34')][_0xa01d('0x43')]){_0x46d9ca['include']=[{'all':!![]}];}_0x46d9ca=_[_0xa01d('0x41')]({},_0x46d9ca,_0x161363[_0xa01d('0x42')]);return db[_0xa01d('0x2f')][_0xa01d('0x49')](_0x46d9ca)['then'](handleEntityNotFound(_0x172c15,null))[_0xa01d('0x26')](respondWithResult(_0x172c15,null))[_0xa01d('0x4a')](handleError(_0x172c15,null));};exports[_0xa01d('0x4b')]=function(_0x4a25ca,_0x13be73){return db['Dynamics365Field'][_0xa01d('0x4b')](_0x4a25ca[_0xa01d('0x4c')],{})[_0xa01d('0x26')](respondWithResult(_0x13be73,0xc9))[_0xa01d('0x4a')](handleError(_0x13be73,null));};exports['update']=function(_0x28e366,_0x23aeb4){if(_0x28e366[_0xa01d('0x4c')]['id']){delete _0x28e366['body']['id'];}return db[_0xa01d('0x2f')]['find']({'where':{'id':_0x28e366[_0xa01d('0x47')]['id']}})['then'](handleEntityNotFound(_0x23aeb4,null))['then'](saveUpdates(_0x28e366[_0xa01d('0x4c')],null))['then'](respondWithResult(_0x23aeb4,null))[_0xa01d('0x4a')](handleError(_0x23aeb4,null));};exports[_0xa01d('0x27')]=function(_0x3fa1ea,_0x196173){return db[_0xa01d('0x2f')][_0xa01d('0x49')]({'where':{'id':_0x3fa1ea[_0xa01d('0x47')]['id']}})[_0xa01d('0x26')](handleEntityNotFound(_0x196173,null))[_0xa01d('0x26')](removeEntity(_0x196173,null))[_0xa01d('0x4a')](handleError(_0x196173,null));}; \ No newline at end of file +var _0xab86=['eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','index','Dynamics365Field','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body'];(function(_0x11da9,_0x321c58){var _0x223a21=function(_0x154e62){while(--_0x154e62){_0x11da9['push'](_0x11da9['shift']());}};_0x223a21(++_0x321c58);}(_0xab86,0x120));var _0x6ab8=function(_0x292805,_0x73f045){_0x292805=_0x292805-0x0;var _0x2579eb=_0xab86[_0x292805];return _0x2579eb;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require(_0x6ab8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ab8('0x2'));var rp=require('request-promise');var moment=require(_0x6ab8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ab8('0x4'));var util=require('util');var path=require(_0x6ab8('0x5'));var sox=require(_0x6ab8('0x6'));var csv=require(_0x6ab8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ab8('0x8'));var _=require(_0x6ab8('0x9'));var squel=require('squel');var crypto=require(_0x6ab8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6ab8('0xb'));var toCsv=require(_0x6ab8('0x7'));var querystring=require(_0x6ab8('0xc'));var Papa=require(_0x6ab8('0xd'));var Redis=require(_0x6ab8('0xe'));var authService=require(_0x6ab8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6ab8('0x10'));var hardwareService=require(_0x6ab8('0x11'));var logger=require(_0x6ab8('0x12'))('api');var utils=require(_0x6ab8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6ab8('0x14'));var db=require(_0x6ab8('0x15'))['db'];function respondWithStatusCode(_0x3ce789,_0x2c23f6){_0x2c23f6=_0x2c23f6||0xcc;return function(_0x1f880e){if(_0x1f880e){return _0x3ce789[_0x6ab8('0x16')](_0x2c23f6);}return _0x3ce789['status'](_0x2c23f6)['end']();};}function respondWithResult(_0x197ec5,_0x6cbac8){_0x6cbac8=_0x6cbac8||0xc8;return function(_0x381867){if(_0x381867){return _0x197ec5[_0x6ab8('0x17')](_0x6cbac8)[_0x6ab8('0x18')](_0x381867);}};}function respondWithFilteredResult(_0x3de500,_0x55ebc5){return function(_0x142441){if(_0x142441){var _0xaf9669=typeof _0x55ebc5[_0x6ab8('0x19')]===_0x6ab8('0x1a')&&typeof _0x55ebc5[_0x6ab8('0x1b')]==='undefined';var _0x38a6b6=_0x142441['count'];var _0x4cf65b=_0xaf9669?0x0:_0x55ebc5[_0x6ab8('0x19')];var _0xe7ef8f=_0xaf9669?_0x142441['count']:_0x55ebc5[_0x6ab8('0x19')]+_0x55ebc5['limit'];var _0x26c3af;if(_0xe7ef8f>=_0x38a6b6){_0xe7ef8f=_0x38a6b6;_0x26c3af=0xc8;}else{_0x26c3af=0xce;}_0x3de500['status'](_0x26c3af);return _0x3de500['set']('Content-Range',_0x4cf65b+'-'+_0xe7ef8f+'/'+_0x38a6b6)[_0x6ab8('0x18')](_0x142441);}return null;};}function patchUpdates(_0x59a73d){return function(_0x5723c9){try{jsonpatch[_0x6ab8('0x1c')](_0x5723c9,_0x59a73d,!![]);}catch(_0x2cc75f){return BPromise[_0x6ab8('0x1d')](_0x2cc75f);}return _0x5723c9[_0x6ab8('0x1e')]();};}function saveUpdates(_0x1aec9d,_0x1b49bd){return function(_0x174513){if(_0x174513){return _0x174513[_0x6ab8('0x1f')](_0x1aec9d)['then'](function(_0x237952){return _0x237952;});}return null;};}function removeEntity(_0x3c877c,_0x3789c4){return function(_0x41fd57){if(_0x41fd57){return _0x41fd57[_0x6ab8('0x20')]()[_0x6ab8('0x21')](function(){_0x3c877c[_0x6ab8('0x17')](0xcc)[_0x6ab8('0x22')]();});}};}function handleEntityNotFound(_0x53789b,_0x53221c){return function(_0x1c48a5){if(!_0x1c48a5){_0x53789b[_0x6ab8('0x16')](0x194);}return _0x1c48a5;};}function handleError(_0x4be09d,_0x38a297){_0x38a297=_0x38a297||0x1f4;return function(_0x130485){logger['error'](_0x130485['stack']);if(_0x130485[_0x6ab8('0x23')]){delete _0x130485[_0x6ab8('0x23')];}_0x4be09d[_0x6ab8('0x17')](_0x38a297)['send'](_0x130485);};}exports[_0x6ab8('0x24')]=function(_0x1c9574,_0xba8952){var _0x51246f={},_0x1014ba={},_0x3601c7={'count':0x0,'rows':[]};var _0xfe9b04=_['map'](db[_0x6ab8('0x25')][_0x6ab8('0x26')],function(_0xddc4a){return{'name':_0xddc4a[_0x6ab8('0x27')],'type':_0xddc4a[_0x6ab8('0x28')][_0x6ab8('0x29')]};});_0x1014ba['model']=_['map'](_0xfe9b04,'name');_0x1014ba['query']=_[_0x6ab8('0x2a')](_0x1c9574[_0x6ab8('0x2b')]);_0x1014ba[_0x6ab8('0x2c')]=_[_0x6ab8('0x2d')](_0x1014ba[_0x6ab8('0x2e')],_0x1014ba[_0x6ab8('0x2b')]);_0x51246f['attributes']=_['intersection'](_0x1014ba[_0x6ab8('0x2e')],qs[_0x6ab8('0x2f')](_0x1c9574[_0x6ab8('0x2b')][_0x6ab8('0x2f')]));_0x51246f[_0x6ab8('0x30')]=_0x51246f[_0x6ab8('0x30')]['length']?_0x51246f['attributes']:_0x1014ba[_0x6ab8('0x2e')];if(!_0x1c9574[_0x6ab8('0x2b')][_0x6ab8('0x31')](_0x6ab8('0x32'))){_0x51246f['limit']=qs['limit'](_0x1c9574[_0x6ab8('0x2b')][_0x6ab8('0x1b')]);_0x51246f[_0x6ab8('0x19')]=qs[_0x6ab8('0x19')](_0x1c9574['query'][_0x6ab8('0x19')]);}_0x51246f[_0x6ab8('0x33')]=qs[_0x6ab8('0x34')](_0x1c9574[_0x6ab8('0x2b')][_0x6ab8('0x34')]);_0x51246f[_0x6ab8('0x35')]=qs['filters'](_[_0x6ab8('0x36')](_0x1c9574['query'],_0x1014ba[_0x6ab8('0x2c')]),_0xfe9b04);if(_0x1c9574[_0x6ab8('0x2b')]['filter']){_0x51246f['where']=_['merge'](_0x51246f['where'],{'$or':_[_0x6ab8('0x37')](_0xfe9b04,function(_0x55eff2){if(_0x55eff2[_0x6ab8('0x28')]!==_0x6ab8('0x38')){var _0xa5ea39={};_0xa5ea39[_0x55eff2[_0x6ab8('0x23')]]={'$like':'%'+_0x1c9574['query'][_0x6ab8('0x39')]+'%'};return _0xa5ea39;}})});}_0x51246f=_[_0x6ab8('0x3a')]({},_0x51246f,_0x1c9574['options']);var _0x3cce63={'where':_0x51246f['where']};return db[_0x6ab8('0x25')][_0x6ab8('0x3b')](_0x3cce63)['then'](function(_0x3111d2){_0x3601c7[_0x6ab8('0x3b')]=_0x3111d2;if(_0x1c9574[_0x6ab8('0x2b')]['includeAll']){_0x51246f[_0x6ab8('0x3c')]=[{'all':!![]}];}return db[_0x6ab8('0x25')][_0x6ab8('0x3d')](_0x51246f);})[_0x6ab8('0x21')](function(_0x495e34){_0x3601c7[_0x6ab8('0x3e')]=_0x495e34;return _0x3601c7;})[_0x6ab8('0x21')](respondWithFilteredResult(_0xba8952,_0x51246f))[_0x6ab8('0x3f')](handleError(_0xba8952,null));};exports[_0x6ab8('0x40')]=function(_0x2c5063,_0x2749dc){var _0x16c2d2={'raw':!![],'where':{'id':_0x2c5063[_0x6ab8('0x41')]['id']}},_0xcf8245={};_0xcf8245[_0x6ab8('0x2e')]=_[_0x6ab8('0x2a')](db['Dynamics365Field'][_0x6ab8('0x26')]);_0xcf8245[_0x6ab8('0x2b')]=_[_0x6ab8('0x2a')](_0x2c5063[_0x6ab8('0x2b')]);_0xcf8245[_0x6ab8('0x2c')]=_[_0x6ab8('0x2d')](_0xcf8245[_0x6ab8('0x2e')],_0xcf8245['query']);_0x16c2d2['attributes']=_[_0x6ab8('0x2d')](_0xcf8245[_0x6ab8('0x2e')],qs[_0x6ab8('0x2f')](_0x2c5063[_0x6ab8('0x2b')][_0x6ab8('0x2f')]));_0x16c2d2[_0x6ab8('0x30')]=_0x16c2d2[_0x6ab8('0x30')][_0x6ab8('0x42')]?_0x16c2d2['attributes']:_0xcf8245[_0x6ab8('0x2e')];if(_0x2c5063[_0x6ab8('0x2b')][_0x6ab8('0x43')]){_0x16c2d2[_0x6ab8('0x3c')]=[{'all':!![]}];}_0x16c2d2=_['merge']({},_0x16c2d2,_0x2c5063[_0x6ab8('0x44')]);return db[_0x6ab8('0x25')][_0x6ab8('0x45')](_0x16c2d2)[_0x6ab8('0x21')](handleEntityNotFound(_0x2749dc,null))[_0x6ab8('0x21')](respondWithResult(_0x2749dc,null))[_0x6ab8('0x3f')](handleError(_0x2749dc,null));};exports['create']=function(_0x368d3a,_0x317bdc){return db[_0x6ab8('0x25')][_0x6ab8('0x46')](_0x368d3a[_0x6ab8('0x47')],{})[_0x6ab8('0x21')](respondWithResult(_0x317bdc,0xc9))['catch'](handleError(_0x317bdc,null));};exports[_0x6ab8('0x1f')]=function(_0x1e365e,_0x564023){if(_0x1e365e[_0x6ab8('0x47')]['id']){delete _0x1e365e[_0x6ab8('0x47')]['id'];}return db[_0x6ab8('0x25')][_0x6ab8('0x45')]({'where':{'id':_0x1e365e['params']['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x564023,null))['then'](saveUpdates(_0x1e365e['body'],null))['then'](respondWithResult(_0x564023,null))[_0x6ab8('0x3f')](handleError(_0x564023,null));};exports['destroy']=function(_0x1a185c,_0x29c5f2){return db[_0x6ab8('0x25')]['find']({'where':{'id':_0x1a185c['params']['id']}})['then'](handleEntityNotFound(_0x29c5f2,null))[_0x6ab8('0x21')](removeEntity(_0x29c5f2,null))['catch'](handleError(_0x29c5f2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fbecb21..e57977c 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 _0xd17e=['exports','define','int_dynamics365_fields','idField','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x2db5c5,_0x10e3c1){var _0x25dbe0=function(_0x9bd18b){while(--_0x9bd18b){_0x2db5c5['push'](_0x2db5c5['shift']());}};_0x25dbe0(++_0x10e3c1);}(_0xd17e,0x1be));var _0xed17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd17e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed17('0x0'));var util=require(_0xed17('0x1'));var logger=require('../../config/logger')(_0xed17('0x2'));var moment=require(_0xed17('0x3'));var BPromise=require(_0xed17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed17('0x5'));var rimraf=require(_0xed17('0x6'));var config=require(_0xed17('0x7'));var attributes=require(_0xed17('0x8'));module[_0xed17('0x9')]=function(_0x16c2b5,_0xd37f8f){return _0x16c2b5[_0xed17('0xa')]('Dynamics365Field',attributes,{'tableName':_0xed17('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xed17('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02d1=['bluebird','rimraf','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','moment'];(function(_0x2b395a,_0x35db69){var _0x1beba0=function(_0x2cb135){while(--_0x2cb135){_0x2b395a['push'](_0x2b395a['shift']());}};_0x1beba0(++_0x35db69);}(_0x02d1,0x1cb));var _0x102d=function(_0x19d885,_0x38d028){_0x19d885=_0x19d885-0x0;var _0x8dd3c2=_0x02d1[_0x19d885];return _0x8dd3c2;};'use strict';var _=require(_0x102d('0x0'));var util=require(_0x102d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x102d('0x2'));var BPromise=require(_0x102d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x102d('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x102d('0x5')]=function(_0x4654a1,_0x13b879){return _0x4654a1[_0x102d('0x6')](_0x102d('0x7'),attributes,{'tableName':_0x102d('0x8'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x102d('0x9'),_0x102d('0xa')],'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 5ef8d4f..ffd27bc 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 _0x3abd=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x471cec,_0x5394b6){var _0x166300=function(_0xca113e){while(--_0xca113e){_0x471cec['push'](_0x471cec['shift']());}};_0x166300(++_0x5394b6);}(_0x3abd,0x74));var _0xd3ab=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x3abd[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require(_0xd3ab('0x0'));var moment=require('moment');var BPromise=require(_0xd3ab('0x1'));var rs=require(_0xd3ab('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3ab('0x3'))['db'];var utils=require(_0xd3ab('0x4'));var logger=require(_0xd3ab('0x5'))(_0xd3ab('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3ab('0x7')][_0xd3ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c59fe,_0x27c98a,_0x681750){return new BPromise(function(_0xef94c9,_0x28fad3){return client[_0xd3ab('0x9')](_0x4c59fe,_0x681750)[_0xd3ab('0xa')](function(_0xa34cef){logger[_0xd3ab('0xb')](_0xd3ab('0xc'),_0x27c98a,_0xd3ab('0xd'));logger[_0xd3ab('0xe')](_0xd3ab('0xf'),_0x27c98a,'request\x20sent',JSON[_0xd3ab('0x10')](_0xa34cef));if(_0xa34cef[_0xd3ab('0x11')]){if(_0xa34cef['error']['code']===0x1f4){logger['error'](_0xd3ab('0xc'),_0x27c98a,_0xa34cef[_0xd3ab('0x11')][_0xd3ab('0x12')]);return _0x28fad3(_0xa34cef[_0xd3ab('0x11')][_0xd3ab('0x12')]);}logger[_0xd3ab('0x11')](_0xd3ab('0xc'),_0x27c98a,_0xa34cef[_0xd3ab('0x11')][_0xd3ab('0x12')]);return _0xef94c9(_0xa34cef[_0xd3ab('0x11')][_0xd3ab('0x12')]);}else{logger['info'](_0xd3ab('0xc'),_0x27c98a,'request\x20sent');_0xef94c9(_0xa34cef[_0xd3ab('0x13')][_0xd3ab('0x12')]);}})[_0xd3ab('0x14')](function(_0x53428a){logger[_0xd3ab('0x11')](_0xd3ab('0xc'),_0x27c98a,_0x53428a);_0x28fad3(_0x53428a);});});} \ No newline at end of file +var _0xcb10=['then','debug','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xcb10,0xac));var _0x0cb1=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcb10[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var moment=require('moment');var BPromise=require(_0x0cb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cb1('0x3'));var db=require(_0x0cb1('0x4'))['db'];var utils=require(_0x0cb1('0x5'));var logger=require(_0x0cb1('0x6'))(_0x0cb1('0x7'));var config=require(_0x0cb1('0x8'));var jayson=require(_0x0cb1('0x9'));var client=jayson[_0x0cb1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d69ac,_0x5200f2,_0x10808a){return new BPromise(function(_0x18b846,_0x22758a){return client[_0x0cb1('0xb')](_0x4d69ac,_0x10808a)[_0x0cb1('0xc')](function(_0x54c398){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5200f2,'request\x20sent');logger[_0x0cb1('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5200f2,'request\x20sent',JSON[_0x0cb1('0xe')](_0x54c398));if(_0x54c398[_0x0cb1('0xf')]){if(_0x54c398[_0x0cb1('0xf')][_0x0cb1('0x10')]===0x1f4){logger[_0x0cb1('0xf')](_0x0cb1('0x11'),_0x5200f2,_0x54c398[_0x0cb1('0xf')]['message']);return _0x22758a(_0x54c398['error'][_0x0cb1('0x12')]);}logger[_0x0cb1('0xf')](_0x0cb1('0x11'),_0x5200f2,_0x54c398[_0x0cb1('0xf')]['message']);return _0x18b846(_0x54c398[_0x0cb1('0xf')][_0x0cb1('0x12')]);}else{logger[_0x0cb1('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x5200f2,_0x0cb1('0x14'));_0x18b846(_0x54c398[_0x0cb1('0x15')]['message']);}})[_0x0cb1('0x16')](function(_0x39ecf5){logger['error'](_0x0cb1('0x11'),_0x5200f2,_0x39ecf5);_0x22758a(_0x39ecf5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ed4dbc4..a99e7ad 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 _0x8b11=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x592d74,_0x4c769e){var _0x5011a6=function(_0x1ac9cc){while(--_0x1ac9cc){_0x592d74['push'](_0x592d74['shift']());}};_0x5011a6(++_0x4c769e);}(_0x8b11,0x69));var _0x18b1=function(_0x34c825,_0x44cad4){_0x34c825=_0x34c825-0x0;var _0x2fde13=_0x8b11[_0x34c825];return _0x2fde13;};'use strict';var multer=require(_0x18b1('0x0'));var util=require('util');var path=require(_0x18b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x18b1('0x2'));var router=express[_0x18b1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x18b1('0x4'));var interaction=require(_0x18b1('0x5'));var config=require(_0x18b1('0x6'));var controller=require(_0x18b1('0x7'));router[_0x18b1('0x8')]('/',auth[_0x18b1('0x9')](),controller[_0x18b1('0xa')]);router['get'](_0x18b1('0xb'),auth[_0x18b1('0x9')](),controller['show']);router['get'](_0x18b1('0xc'),auth[_0x18b1('0x9')](),controller[_0x18b1('0xd')]);router['get'](_0x18b1('0xe'),auth[_0x18b1('0x9')](),controller['getFields']);router[_0x18b1('0xf')]('/',auth[_0x18b1('0x9')](),controller[_0x18b1('0x10')]);router[_0x18b1('0xf')](_0x18b1('0xc'),auth[_0x18b1('0x9')](),controller[_0x18b1('0x11')]);router[_0x18b1('0x12')](_0x18b1('0xb'),auth[_0x18b1('0x9')](),controller[_0x18b1('0x13')]);router[_0x18b1('0x14')](_0x18b1('0xb'),auth[_0x18b1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7987=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','exports'];(function(_0x1c4f1a,_0x1a488a){var _0x1b792b=function(_0x331de3){while(--_0x331de3){_0x1c4f1a['push'](_0x1c4f1a['shift']());}};_0x1b792b(++_0x1a488a);}(_0x7987,0x154));var _0x7798=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x7987[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0x7798('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7798('0x1'));var express=require(_0x7798('0x2'));var router=express[_0x7798('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7798('0x4'));var interaction=require(_0x7798('0x5'));var config=require(_0x7798('0x6'));var controller=require(_0x7798('0x7'));router[_0x7798('0x8')]('/',auth[_0x7798('0x9')](),controller[_0x7798('0xa')]);router[_0x7798('0x8')](_0x7798('0xb'),auth[_0x7798('0x9')](),controller[_0x7798('0xc')]);router[_0x7798('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7798('0x8')](_0x7798('0xd'),auth['isAuthenticated'](),controller[_0x7798('0xe')]);router[_0x7798('0xf')]('/',auth[_0x7798('0x9')](),controller['create']);router['post'](_0x7798('0x10'),auth[_0x7798('0x9')](),controller[_0x7798('0x11')]);router['put'](_0x7798('0xb'),auth[_0x7798('0x9')](),controller[_0x7798('0x12')]);router['delete'](_0x7798('0xb'),auth[_0x7798('0x9')](),controller['destroy']);module[_0x7798('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0d4f4fb..1886279 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 _0x68b3=['sequelize','exports','STRING','remoteUri'];(function(_0x3a84a5,_0x238da3){var _0x1f1e6a=function(_0xe2e720){while(--_0xe2e720){_0x3a84a5['push'](_0x3a84a5['shift']());}};_0x1f1e6a(++_0x238da3);}(_0x68b3,0x1d8));var _0x368b=function(_0x5b553e,_0x29303a){_0x5b553e=_0x5b553e-0x0;var _0x501a10=_0x68b3[_0x5b553e];return _0x501a10;};'use strict';var Sequelize=require(_0x368b('0x0'));module[_0x368b('0x1')]={'name':{'type':Sequelize[_0x368b('0x2')]},'description':{'type':Sequelize[_0x368b('0x2')]},'username':{'type':Sequelize[_0x368b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x368b('0x2')]},'remoteUri':{'type':Sequelize[_0x368b('0x2')],'unique':_0x368b('0x3')},'serverUrl':{'type':Sequelize[_0x368b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','sequelize'];(function(_0x2a8747,_0x47d8bc){var _0x577ffc=function(_0x4fba20){while(--_0x4fba20){_0x2a8747['push'](_0x2a8747['shift']());}};_0x577ffc(++_0x47d8bc);}(_0x583c,0x12b));var _0xc583=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x583c[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8c87bc7..7701eed 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 _0xf257=['Basic\x20%s','%s:X','toString','requester','description','ticket_type','company','remove','default','custom_text','length','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','create','catch','body','find','getConfigurations','rawAttributes','order','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','findOne','apiKey','remoteUri','lastIndexOf','GET','format'];(function(_0x527dcf,_0x5ef852){var _0x26bb9c=function(_0x47aa13){while(--_0x47aa13){_0x527dcf['push'](_0x527dcf['shift']());}};_0x26bb9c(++_0x5ef852);}(_0xf257,0x82));var _0x7f25=function(_0x28972d,_0x5cd0ba){_0x28972d=_0x28972d-0x0;var _0x302084=_0xf257[_0x28972d];return _0x302084;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f25('0x0'));var jsonpatch=require(_0x7f25('0x1'));var rp=require(_0x7f25('0x2'));var moment=require(_0x7f25('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7f25('0x4'));var util=require(_0x7f25('0x5'));var path=require(_0x7f25('0x6'));var sox=require(_0x7f25('0x7'));var csv=require(_0x7f25('0x8'));var ejs=require(_0x7f25('0x9'));var fs=require('fs');var fs_extra=require(_0x7f25('0xa'));var _=require(_0x7f25('0xb'));var squel=require(_0x7f25('0xc'));var crypto=require(_0x7f25('0xd'));var jsforce=require(_0x7f25('0xe'));var deskjs=require(_0x7f25('0xf'));var toCsv=require(_0x7f25('0x8'));var querystring=require(_0x7f25('0x10'));var Papa=require('papaparse');var Redis=require(_0x7f25('0x11'));var authService=require(_0x7f25('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f25('0x13'));var logger=require('../../config/logger')(_0x7f25('0x14'));var utils=require(_0x7f25('0x15'));var config=require(_0x7f25('0x16'));var licenseUtil=require(_0x7f25('0x17'));var db=require(_0x7f25('0x18'))['db'];var integrations=require(_0x7f25('0x19'));function respondWithStatusCode(_0x2c960f,_0x5993ea){_0x5993ea=_0x5993ea||0xcc;return function(_0x4a4957){if(_0x4a4957){return _0x2c960f[_0x7f25('0x1a')](_0x5993ea);}return _0x2c960f['status'](_0x5993ea)[_0x7f25('0x1b')]();};}function respondWithResult(_0x19b76b,_0x3f8ed9){_0x3f8ed9=_0x3f8ed9||0xc8;return function(_0x14d5b3){if(_0x14d5b3){return _0x19b76b[_0x7f25('0x1c')](_0x3f8ed9)['json'](_0x14d5b3);}};}function respondWithFilteredResult(_0x48778d,_0x4eb36e){return function(_0x3b5424){if(_0x3b5424){var _0x230ad6=typeof _0x4eb36e[_0x7f25('0x1d')]===_0x7f25('0x1e')&&typeof _0x4eb36e[_0x7f25('0x1f')]===_0x7f25('0x1e');var _0x19ad80=_0x3b5424[_0x7f25('0x20')];var _0x5e0067=_0x230ad6?0x0:_0x4eb36e[_0x7f25('0x1d')];var _0x1cd6c1=_0x230ad6?_0x3b5424[_0x7f25('0x20')]:_0x4eb36e[_0x7f25('0x1d')]+_0x4eb36e[_0x7f25('0x1f')];var _0x16f9e3;if(_0x1cd6c1>=_0x19ad80){_0x1cd6c1=_0x19ad80;_0x16f9e3=0xc8;}else{_0x16f9e3=0xce;}_0x48778d['status'](_0x16f9e3);return _0x48778d['set'](_0x7f25('0x21'),_0x5e0067+'-'+_0x1cd6c1+'/'+_0x19ad80)[_0x7f25('0x22')](_0x3b5424);}return null;};}function patchUpdates(_0x18f978){return function(_0x3dc0c7){try{jsonpatch[_0x7f25('0x23')](_0x3dc0c7,_0x18f978,!![]);}catch(_0x334802){return BPromise[_0x7f25('0x24')](_0x334802);}return _0x3dc0c7[_0x7f25('0x25')]();};}function saveUpdates(_0x31bf5f,_0x4be8b8){return function(_0x258814){if(_0x258814){return _0x258814[_0x7f25('0x26')](_0x31bf5f)[_0x7f25('0x27')](function(_0x152fe9){return _0x152fe9;});}return null;};}function removeEntity(_0x29039a,_0x4955e0){return function(_0x27ba8d){if(_0x27ba8d){return _0x27ba8d[_0x7f25('0x28')]()[_0x7f25('0x27')](function(){_0x29039a['status'](0xcc)[_0x7f25('0x1b')]();});}};}function handleEntityNotFound(_0x5372eb,_0x467650){return function(_0x2a504e){if(!_0x2a504e){_0x5372eb[_0x7f25('0x1a')](0x194);}return _0x2a504e;};}function handleError(_0x1dad21,_0x382fd4){_0x382fd4=_0x382fd4||0x1f4;return function(_0x1f3880){logger[_0x7f25('0x29')](_0x1f3880[_0x7f25('0x2a')]);if(_0x1f3880[_0x7f25('0x2b')]){delete _0x1f3880[_0x7f25('0x2b')];}_0x1dad21['status'](_0x382fd4)['send'](_0x1f3880);};}exports[_0x7f25('0x2c')]=function(_0x756b80,_0x4934b4){var _0xa373ee={},_0x340f1b={},_0x2bc378={'count':0x0,'rows':[]};var _0x22ecc0=_[_0x7f25('0x2d')](db[_0x7f25('0x2e')]['rawAttributes'],function(_0x32a702){return{'name':_0x32a702['fieldName'],'type':_0x32a702[_0x7f25('0x2f')]['key']};});_0x340f1b[_0x7f25('0x30')]=_[_0x7f25('0x2d')](_0x22ecc0,_0x7f25('0x2b'));_0x340f1b['query']=_[_0x7f25('0x31')](_0x756b80[_0x7f25('0x32')]);_0x340f1b[_0x7f25('0x33')]=_[_0x7f25('0x34')](_0x340f1b[_0x7f25('0x30')],_0x340f1b[_0x7f25('0x32')]);_0xa373ee[_0x7f25('0x35')]=_[_0x7f25('0x34')](_0x340f1b['model'],qs[_0x7f25('0x36')](_0x756b80[_0x7f25('0x32')][_0x7f25('0x36')]));_0xa373ee[_0x7f25('0x35')]=_0xa373ee[_0x7f25('0x35')]['length']?_0xa373ee['attributes']:_0x340f1b['model'];if(!_0x756b80[_0x7f25('0x32')][_0x7f25('0x37')](_0x7f25('0x38'))){_0xa373ee['limit']=qs[_0x7f25('0x1f')](_0x756b80[_0x7f25('0x32')]['limit']);_0xa373ee[_0x7f25('0x1d')]=qs['offset'](_0x756b80[_0x7f25('0x32')][_0x7f25('0x1d')]);}_0xa373ee['order']=qs[_0x7f25('0x39')](_0x756b80[_0x7f25('0x32')][_0x7f25('0x39')]);_0xa373ee[_0x7f25('0x3a')]=qs[_0x7f25('0x33')](_[_0x7f25('0x3b')](_0x756b80['query'],_0x340f1b[_0x7f25('0x33')]),_0x22ecc0);if(_0x756b80[_0x7f25('0x32')][_0x7f25('0x3c')]){_0xa373ee['where']=_[_0x7f25('0x3d')](_0xa373ee[_0x7f25('0x3a')],{'$or':_[_0x7f25('0x2d')](_0x22ecc0,function(_0x979875){if(_0x979875[_0x7f25('0x2f')]!=='VIRTUAL'){var _0x4429b2={};_0x4429b2[_0x979875[_0x7f25('0x2b')]]={'$like':'%'+_0x756b80[_0x7f25('0x32')][_0x7f25('0x3c')]+'%'};return _0x4429b2;}})});}_0xa373ee=_[_0x7f25('0x3d')]({},_0xa373ee,_0x756b80[_0x7f25('0x3e')]);var _0x2f402d={'where':_0xa373ee[_0x7f25('0x3a')]};return db['FreshdeskAccount'][_0x7f25('0x20')](_0x2f402d)['then'](function(_0x15f04d){_0x2bc378[_0x7f25('0x20')]=_0x15f04d;if(_0x756b80[_0x7f25('0x32')][_0x7f25('0x3f')]){_0xa373ee[_0x7f25('0x40')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7f25('0x41')](_0xa373ee);})['then'](function(_0x598afe){_0x2bc378['rows']=_0x598afe;return _0x2bc378;})[_0x7f25('0x27')](respondWithFilteredResult(_0x4934b4,_0xa373ee))['catch'](handleError(_0x4934b4,null));};exports[_0x7f25('0x42')]=function(_0x169bc4,_0x138439){var _0x4b1ba1={'raw':![],'where':{'id':_0x169bc4[_0x7f25('0x43')]['id']}},_0x4eb8ed={};_0x4eb8ed[_0x7f25('0x30')]=_[_0x7f25('0x31')](db[_0x7f25('0x2e')]['rawAttributes']);_0x4eb8ed[_0x7f25('0x32')]=_['keys'](_0x169bc4['query']);_0x4eb8ed['filters']=_[_0x7f25('0x34')](_0x4eb8ed['model'],_0x4eb8ed[_0x7f25('0x32')]);_0x4b1ba1[_0x7f25('0x35')]=_[_0x7f25('0x34')](_0x4eb8ed[_0x7f25('0x30')],qs[_0x7f25('0x36')](_0x169bc4[_0x7f25('0x32')]['fields']));_0x4b1ba1[_0x7f25('0x35')]=_0x4b1ba1['attributes']['length']?_0x4b1ba1[_0x7f25('0x35')]:_0x4eb8ed[_0x7f25('0x30')];if(_0x169bc4[_0x7f25('0x32')][_0x7f25('0x3f')]){_0x4b1ba1[_0x7f25('0x40')]=[{'all':!![]}];}_0x4b1ba1=_[_0x7f25('0x3d')]({},_0x4b1ba1,_0x169bc4[_0x7f25('0x3e')]);return db['FreshdeskAccount']['find'](_0x4b1ba1)[_0x7f25('0x27')](handleEntityNotFound(_0x138439,null))[_0x7f25('0x27')](respondWithResult(_0x138439,null))['catch'](handleError(_0x138439,null));};exports[_0x7f25('0x44')]=function(_0xc5875a,_0x2cebe0){return db['FreshdeskAccount'][_0x7f25('0x44')](_0xc5875a['body'],{})[_0x7f25('0x27')](respondWithResult(_0x2cebe0,0xc9))[_0x7f25('0x45')](handleError(_0x2cebe0,null));};exports[_0x7f25('0x26')]=function(_0x4a372c,_0x353e6b){if(_0x4a372c[_0x7f25('0x46')]['id']){delete _0x4a372c[_0x7f25('0x46')]['id'];}return db[_0x7f25('0x2e')]['find']({'where':{'id':_0x4a372c[_0x7f25('0x43')]['id']}})[_0x7f25('0x27')](handleEntityNotFound(_0x353e6b,null))[_0x7f25('0x27')](saveUpdates(_0x4a372c['body'],null))[_0x7f25('0x27')](respondWithResult(_0x353e6b,null))['catch'](handleError(_0x353e6b,null));};exports['destroy']=function(_0x5677ec,_0x4f5bf6){return db['FreshdeskAccount'][_0x7f25('0x47')]({'where':{'id':_0x5677ec[_0x7f25('0x43')]['id']}})[_0x7f25('0x27')](handleEntityNotFound(_0x4f5bf6,null))[_0x7f25('0x27')](removeEntity(_0x4f5bf6,null))['catch'](handleError(_0x4f5bf6,null));};exports[_0x7f25('0x48')]=function(_0x1aa6d3,_0x4454ae,_0x1dbf7e){var _0x4ae270={};var _0x44f7f5={};var _0x4244f6;var _0x1ef4c0;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x1aa6d3[_0x7f25('0x43')]['id']}})[_0x7f25('0x27')](handleEntityNotFound(_0x4454ae,null))[_0x7f25('0x27')](function(_0xdaff76){if(_0xdaff76){_0x4244f6=_0xdaff76;_0x44f7f5['model']=_[_0x7f25('0x31')](db['FreshdeskConfiguration'][_0x7f25('0x49')]);_0x44f7f5[_0x7f25('0x32')]=_['keys'](_0x1aa6d3[_0x7f25('0x32')]);_0x44f7f5['filters']=_[_0x7f25('0x34')](_0x44f7f5['model'],_0x44f7f5['query']);_0x4ae270['attributes']=_[_0x7f25('0x34')](_0x44f7f5[_0x7f25('0x30')],qs['fields'](_0x1aa6d3[_0x7f25('0x32')][_0x7f25('0x36')]));_0x4ae270[_0x7f25('0x35')]=_0x4ae270['attributes']['length']?_0x4ae270['attributes']:_0x44f7f5['model'];_0x4ae270[_0x7f25('0x4a')]=qs[_0x7f25('0x39')](_0x1aa6d3[_0x7f25('0x32')][_0x7f25('0x39')]);_0x4ae270[_0x7f25('0x3a')]=qs[_0x7f25('0x33')](_[_0x7f25('0x3b')](_0x1aa6d3[_0x7f25('0x32')],_0x44f7f5[_0x7f25('0x33')]));if(_0x1aa6d3[_0x7f25('0x32')][_0x7f25('0x3c')]){_0x4ae270[_0x7f25('0x3a')]=_[_0x7f25('0x3d')](_0x4ae270[_0x7f25('0x3a')],{'$or':_['map'](_0x4ae270[_0x7f25('0x35')],function(_0x176789){var _0xcdc1dd={};_0xcdc1dd[_0x176789]={'$like':'%'+_0x1aa6d3['query'][_0x7f25('0x3c')]+'%'};return _0xcdc1dd;})});}_0x4ae270=_[_0x7f25('0x3d')]({},_0x4ae270,_0x1aa6d3[_0x7f25('0x3e')]);return _0x4244f6['getConfigurations'](_0x4ae270);}})['then'](function(_0x321557){if(_0x321557){_0x1ef4c0=_0x321557['length'];if(!_0x1aa6d3['query']['hasOwnProperty'](_0x7f25('0x38'))){_0x4ae270[_0x7f25('0x1f')]=qs[_0x7f25('0x1f')](_0x1aa6d3[_0x7f25('0x32')]['limit']);_0x4ae270[_0x7f25('0x1d')]=qs['offset'](_0x1aa6d3[_0x7f25('0x32')][_0x7f25('0x1d')]);}return _0x4244f6[_0x7f25('0x48')](_0x4ae270);}})[_0x7f25('0x27')](function(_0x3d3f19){if(_0x3d3f19){return _0x3d3f19?{'count':_0x1ef4c0,'rows':_0x3d3f19}:null;}})[_0x7f25('0x27')](respondWithResult(_0x4454ae,null))['catch'](handleError(_0x4454ae,null));};exports[_0x7f25('0x4b')]=function(_0x15b082,_0x903c7,_0xb0aa08){if(_0x15b082[_0x7f25('0x46')]['id']){delete _0x15b082[_0x7f25('0x46')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x15b082['params']['id']}})[_0x7f25('0x27')](handleEntityNotFound(_0x903c7,null))[_0x7f25('0x27')](function(_0x3fa4cc){if(_0x3fa4cc){_0x15b082['body'][_0x7f25('0x4c')]=_0x3fa4cc['id'];_0x15b082['body'][_0x7f25('0x4d')]=integrations['getSubjects'](_0x15b082[_0x7f25('0x46')]['channel'],_0x15b082[_0x7f25('0x46')][_0x7f25('0x2f')]);_0x15b082[_0x7f25('0x46')][_0x7f25('0x4e')]=integrations[_0x7f25('0x4f')](_0x15b082[_0x7f25('0x46')][_0x7f25('0x50')],_0x15b082[_0x7f25('0x46')][_0x7f25('0x2f')]);return db[_0x7f25('0x51')]['create'](_0x15b082[_0x7f25('0x46')],{'include':[{'model':db[_0x7f25('0x52')],'as':_0x7f25('0x4d')},{'model':db[_0x7f25('0x52')],'as':'Descriptions'}]});}return null;})[_0x7f25('0x27')](respondWithResult(_0x903c7,null))[_0x7f25('0x45')](handleError(_0x903c7,null));};exports[_0x7f25('0x53')]=function(_0x519ece,_0x186672,_0x30ec9a){var _0x1f2b3d='';return db[_0x7f25('0x2e')][_0x7f25('0x54')]({'where':{'id':_0x519ece[_0x7f25('0x43')]['id']},'attributes':['id','remoteUri',_0x7f25('0x55')]})[_0x7f25('0x27')](handleEntityNotFound(_0x186672,null))[_0x7f25('0x27')](function(_0x40a7c8){if(_0x40a7c8){_0x1f2b3d=_0x40a7c8[_0x7f25('0x56')];var _0x3974b3=_0x1f2b3d['slice'](-0x1);if(_0x3974b3==='/'){_0x1f2b3d=_0x1f2b3d['substring'](0x0,_0x1f2b3d[_0x7f25('0x57')](_0x3974b3));}return rp({'method':_0x7f25('0x58'),'uri':util['format']('%s/%s',_0x1f2b3d,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x7f25('0x59')](_0x7f25('0x5a'),new Buffer(util[_0x7f25('0x59')](_0x7f25('0x5b'),_0x40a7c8[_0x7f25('0x55')]))[_0x7f25('0x5c')]('base64'))},'json':!![]});}})[_0x7f25('0x27')](function(_0x2abaf5){if(_0x2abaf5){var _0x149223=[_0x7f25('0x5d'),'subject','agent',_0x7f25('0x5e'),_0x7f25('0x1c'),'priority','group','source',_0x7f25('0x5f'),'group',_0x7f25('0x60')];_[_0x7f25('0x61')](_0x2abaf5,function(_0x2bc09c){return _0x149223['includes'](_0x2bc09c['name'])||!_0x2bc09c[_0x7f25('0x62')]&&_0x2bc09c['type']!==_0x7f25('0x63')&&_0x2bc09c[_0x7f25('0x2f')]!=='custom_dropdown';});return{'count':_0x2abaf5[_0x7f25('0x64')],'rows':_[_0x7f25('0x2d')](_0x2abaf5,function(_0x4c10a2){return{'id':_0x4c10a2[_0x7f25('0x2b')],'name':_0x4c10a2[_0x7f25('0x65')],'custom':!_0x4c10a2[_0x7f25('0x62')],'options':_0x4c10a2[_0x7f25('0x66')]?_[_0x7f25('0x2d')](_0x4c10a2[_0x7f25('0x66')],function(_0x1a42a6){return{'name':_[_0x7f25('0x67')](_0x1a42a6),'value':_0x1a42a6};}):[]};})};}})[_0x7f25('0x27')](respondWithResult(_0x186672,null))[_0x7f25('0x45')](function(_0x29d0f6){var _0x4e7e9c=_0x519ece[_0x7f25('0x32')][_0x7f25('0x68')]?0x1f4:_0x29d0f6[_0x7f25('0x69')]||0x1f4;logger[_0x7f25('0x29')](_0x7f25('0x6a'),_0x7f25('0x53'),_0x4e7e9c,JSON[_0x7f25('0x6b')](_0x29d0f6));delete _0x29d0f6[_0x7f25('0x2b')];if(_0x4e7e9c===0x191){_0x4e7e9c=0x190;}_0x186672[_0x7f25('0x1c')](_0x4e7e9c)[_0x7f25('0x6c')](_0x519ece[_0x7f25('0x32')][_0x7f25('0x68')]?{'message':_0x7f25('0x6d'),'statusCode':_0x29d0f6[_0x7f25('0x69')]}:_0x29d0f6);});}; \ No newline at end of file +var _0x2ec8=['params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch'];(function(_0x3c029f,_0x5deadd){var _0x28aa74=function(_0x340736){while(--_0x340736){_0x3c029f['push'](_0x3c029f['shift']());}};_0x28aa74(++_0x5deadd);}(_0x2ec8,0x188));var _0x82ec=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2ec8[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x82ec('0x0'));var rimraf=require(_0x82ec('0x1'));var zipdir=require(_0x82ec('0x2'));var jsonpatch=require(_0x82ec('0x3'));var rp=require('request-promise');var moment=require(_0x82ec('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82ec('0x5'));var path=require('path');var sox=require(_0x82ec('0x6'));var csv=require(_0x82ec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x82ec('0x8'));var jsforce=require(_0x82ec('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x82ec('0xa'));var Papa=require(_0x82ec('0xb'));var Redis=require('ioredis');var authService=require(_0x82ec('0xc'));var qs=require(_0x82ec('0xd'));var as=require(_0x82ec('0xe'));var hardwareService=require(_0x82ec('0xf'));var logger=require(_0x82ec('0x10'))('api');var utils=require(_0x82ec('0x11'));var config=require(_0x82ec('0x12'));var licenseUtil=require(_0x82ec('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x82ec('0x14'));function respondWithStatusCode(_0x1eb33e,_0x53d03a){_0x53d03a=_0x53d03a||0xcc;return function(_0x26181f){if(_0x26181f){return _0x1eb33e['sendStatus'](_0x53d03a);}return _0x1eb33e[_0x82ec('0x15')](_0x53d03a)[_0x82ec('0x16')]();};}function respondWithResult(_0x20d982,_0x5b7cc2){_0x5b7cc2=_0x5b7cc2||0xc8;return function(_0x39cdfe){if(_0x39cdfe){return _0x20d982['status'](_0x5b7cc2)[_0x82ec('0x17')](_0x39cdfe);}};}function respondWithFilteredResult(_0x4ce834,_0x5dd9d9){return function(_0x57a4f3){if(_0x57a4f3){var _0x2355ad=typeof _0x5dd9d9[_0x82ec('0x18')]===_0x82ec('0x19')&&typeof _0x5dd9d9[_0x82ec('0x1a')]===_0x82ec('0x19');var _0xd07456=_0x57a4f3[_0x82ec('0x1b')];var _0x4866d1=_0x2355ad?0x0:_0x5dd9d9[_0x82ec('0x18')];var _0x2d9aa7=_0x2355ad?_0x57a4f3['count']:_0x5dd9d9['offset']+_0x5dd9d9[_0x82ec('0x1a')];var _0x450e42;if(_0x2d9aa7>=_0xd07456){_0x2d9aa7=_0xd07456;_0x450e42=0xc8;}else{_0x450e42=0xce;}_0x4ce834['status'](_0x450e42);return _0x4ce834[_0x82ec('0x1c')]('Content-Range',_0x4866d1+'-'+_0x2d9aa7+'/'+_0xd07456)[_0x82ec('0x17')](_0x57a4f3);}return null;};}function patchUpdates(_0x52eb20){return function(_0x2c3bd2){try{jsonpatch[_0x82ec('0x1d')](_0x2c3bd2,_0x52eb20,!![]);}catch(_0x1f2e72){return BPromise[_0x82ec('0x1e')](_0x1f2e72);}return _0x2c3bd2[_0x82ec('0x1f')]();};}function saveUpdates(_0x11564f,_0x35d865){return function(_0x550290){if(_0x550290){return _0x550290[_0x82ec('0x20')](_0x11564f)['then'](function(_0x8cb8a0){return _0x8cb8a0;});}return null;};}function removeEntity(_0x1839cf,_0x3e341d){return function(_0x37f86b){if(_0x37f86b){return _0x37f86b[_0x82ec('0x21')]()['then'](function(){_0x1839cf[_0x82ec('0x15')](0xcc)[_0x82ec('0x16')]();});}};}function handleEntityNotFound(_0x3b66d5,_0x22f671){return function(_0x53f110){if(!_0x53f110){_0x3b66d5[_0x82ec('0x22')](0x194);}return _0x53f110;};}function handleError(_0x533a2e,_0x397abc){_0x397abc=_0x397abc||0x1f4;return function(_0x5010a0){logger[_0x82ec('0x23')](_0x5010a0[_0x82ec('0x24')]);if(_0x5010a0[_0x82ec('0x25')]){delete _0x5010a0[_0x82ec('0x25')];}_0x533a2e[_0x82ec('0x15')](_0x397abc)[_0x82ec('0x26')](_0x5010a0);};}exports[_0x82ec('0x27')]=function(_0x21e69d,_0x4b94d1){var _0x12cb9e={},_0x309b2c={},_0xe8c4a2={'count':0x0,'rows':[]};var _0x278016=_['map'](db[_0x82ec('0x28')][_0x82ec('0x29')],function(_0x56fc2a){return{'name':_0x56fc2a[_0x82ec('0x2a')],'type':_0x56fc2a[_0x82ec('0x2b')][_0x82ec('0x2c')]};});_0x309b2c[_0x82ec('0x2d')]=_[_0x82ec('0x2e')](_0x278016,'name');_0x309b2c[_0x82ec('0x2f')]=_[_0x82ec('0x30')](_0x21e69d['query']);_0x309b2c[_0x82ec('0x31')]=_[_0x82ec('0x32')](_0x309b2c[_0x82ec('0x2d')],_0x309b2c['query']);_0x12cb9e[_0x82ec('0x33')]=_[_0x82ec('0x32')](_0x309b2c['model'],qs[_0x82ec('0x34')](_0x21e69d[_0x82ec('0x2f')][_0x82ec('0x34')]));_0x12cb9e['attributes']=_0x12cb9e[_0x82ec('0x33')][_0x82ec('0x35')]?_0x12cb9e[_0x82ec('0x33')]:_0x309b2c[_0x82ec('0x2d')];if(!_0x21e69d[_0x82ec('0x2f')]['hasOwnProperty'](_0x82ec('0x36'))){_0x12cb9e[_0x82ec('0x1a')]=qs[_0x82ec('0x1a')](_0x21e69d[_0x82ec('0x2f')][_0x82ec('0x1a')]);_0x12cb9e[_0x82ec('0x18')]=qs[_0x82ec('0x18')](_0x21e69d['query'][_0x82ec('0x18')]);}_0x12cb9e[_0x82ec('0x37')]=qs[_0x82ec('0x38')](_0x21e69d[_0x82ec('0x2f')][_0x82ec('0x38')]);_0x12cb9e[_0x82ec('0x39')]=qs[_0x82ec('0x31')](_[_0x82ec('0x3a')](_0x21e69d[_0x82ec('0x2f')],_0x309b2c[_0x82ec('0x31')]),_0x278016);if(_0x21e69d['query']['filter']){_0x12cb9e['where']=_[_0x82ec('0x3b')](_0x12cb9e[_0x82ec('0x39')],{'$or':_['map'](_0x278016,function(_0x2e3f7e){if(_0x2e3f7e[_0x82ec('0x2b')]!==_0x82ec('0x3c')){var _0x80a185={};_0x80a185[_0x2e3f7e['name']]={'$like':'%'+_0x21e69d[_0x82ec('0x2f')][_0x82ec('0x3d')]+'%'};return _0x80a185;}})});}_0x12cb9e=_[_0x82ec('0x3b')]({},_0x12cb9e,_0x21e69d[_0x82ec('0x3e')]);var _0x151958={'where':_0x12cb9e[_0x82ec('0x39')]};return db[_0x82ec('0x28')][_0x82ec('0x1b')](_0x151958)[_0x82ec('0x3f')](function(_0x2d22d9){_0xe8c4a2[_0x82ec('0x1b')]=_0x2d22d9;if(_0x21e69d[_0x82ec('0x2f')][_0x82ec('0x40')]){_0x12cb9e[_0x82ec('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x82ec('0x42')](_0x12cb9e);})[_0x82ec('0x3f')](function(_0x5a0c52){_0xe8c4a2['rows']=_0x5a0c52;return _0xe8c4a2;})['then'](respondWithFilteredResult(_0x4b94d1,_0x12cb9e))[_0x82ec('0x43')](handleError(_0x4b94d1,null));};exports['show']=function(_0x2017e7,_0x136f66){var _0x378e12={'raw':![],'where':{'id':_0x2017e7[_0x82ec('0x44')]['id']}},_0x50879c={};_0x50879c[_0x82ec('0x2d')]=_[_0x82ec('0x30')](db[_0x82ec('0x28')][_0x82ec('0x29')]);_0x50879c[_0x82ec('0x2f')]=_[_0x82ec('0x30')](_0x2017e7[_0x82ec('0x2f')]);_0x50879c['filters']=_['intersection'](_0x50879c['model'],_0x50879c[_0x82ec('0x2f')]);_0x378e12[_0x82ec('0x33')]=_[_0x82ec('0x32')](_0x50879c[_0x82ec('0x2d')],qs[_0x82ec('0x34')](_0x2017e7[_0x82ec('0x2f')]['fields']));_0x378e12[_0x82ec('0x33')]=_0x378e12[_0x82ec('0x33')][_0x82ec('0x35')]?_0x378e12[_0x82ec('0x33')]:_0x50879c[_0x82ec('0x2d')];if(_0x2017e7[_0x82ec('0x2f')][_0x82ec('0x40')]){_0x378e12['include']=[{'all':!![]}];}_0x378e12=_[_0x82ec('0x3b')]({},_0x378e12,_0x2017e7[_0x82ec('0x3e')]);return db[_0x82ec('0x28')][_0x82ec('0x45')](_0x378e12)[_0x82ec('0x3f')](handleEntityNotFound(_0x136f66,null))[_0x82ec('0x3f')](respondWithResult(_0x136f66,null))[_0x82ec('0x43')](handleError(_0x136f66,null));};exports['create']=function(_0x2d86b1,_0x3044e8){return db[_0x82ec('0x28')][_0x82ec('0x46')](_0x2d86b1[_0x82ec('0x47')],{})[_0x82ec('0x3f')](respondWithResult(_0x3044e8,0xc9))['catch'](handleError(_0x3044e8,null));};exports[_0x82ec('0x20')]=function(_0x1b707f,_0x3ac2d3){if(_0x1b707f[_0x82ec('0x47')]['id']){delete _0x1b707f[_0x82ec('0x47')]['id'];}return db[_0x82ec('0x28')][_0x82ec('0x45')]({'where':{'id':_0x1b707f['params']['id']}})['then'](handleEntityNotFound(_0x3ac2d3,null))['then'](saveUpdates(_0x1b707f[_0x82ec('0x47')],null))[_0x82ec('0x3f')](respondWithResult(_0x3ac2d3,null))['catch'](handleError(_0x3ac2d3,null));};exports['destroy']=function(_0x1aa064,_0x3baa70){return db[_0x82ec('0x28')][_0x82ec('0x45')]({'where':{'id':_0x1aa064['params']['id']}})[_0x82ec('0x3f')](handleEntityNotFound(_0x3baa70,null))[_0x82ec('0x3f')](removeEntity(_0x3baa70,null))[_0x82ec('0x43')](handleError(_0x3baa70,null));};exports[_0x82ec('0x48')]=function(_0x4ffd79,_0x45015a,_0x14041d){var _0x482052={};var _0x242776={};var _0x4af2e2;var _0x518af8;return db['FreshdeskAccount'][_0x82ec('0x49')]({'where':{'id':_0x4ffd79[_0x82ec('0x44')]['id']}})[_0x82ec('0x3f')](handleEntityNotFound(_0x45015a,null))[_0x82ec('0x3f')](function(_0x11e4f1){if(_0x11e4f1){_0x4af2e2=_0x11e4f1;_0x242776[_0x82ec('0x2d')]=_[_0x82ec('0x30')](db[_0x82ec('0x4a')][_0x82ec('0x29')]);_0x242776[_0x82ec('0x2f')]=_[_0x82ec('0x30')](_0x4ffd79['query']);_0x242776[_0x82ec('0x31')]=_[_0x82ec('0x32')](_0x242776[_0x82ec('0x2d')],_0x242776[_0x82ec('0x2f')]);_0x482052[_0x82ec('0x33')]=_[_0x82ec('0x32')](_0x242776[_0x82ec('0x2d')],qs['fields'](_0x4ffd79[_0x82ec('0x2f')]['fields']));_0x482052['attributes']=_0x482052[_0x82ec('0x33')][_0x82ec('0x35')]?_0x482052[_0x82ec('0x33')]:_0x242776[_0x82ec('0x2d')];_0x482052[_0x82ec('0x37')]=qs[_0x82ec('0x38')](_0x4ffd79[_0x82ec('0x2f')][_0x82ec('0x38')]);_0x482052[_0x82ec('0x39')]=qs['filters'](_[_0x82ec('0x3a')](_0x4ffd79['query'],_0x242776[_0x82ec('0x31')]));if(_0x4ffd79[_0x82ec('0x2f')][_0x82ec('0x3d')]){_0x482052['where']=_[_0x82ec('0x3b')](_0x482052[_0x82ec('0x39')],{'$or':_[_0x82ec('0x2e')](_0x482052[_0x82ec('0x33')],function(_0x58e00c){var _0x142025={};_0x142025[_0x58e00c]={'$like':'%'+_0x4ffd79['query'][_0x82ec('0x3d')]+'%'};return _0x142025;})});}_0x482052=_[_0x82ec('0x3b')]({},_0x482052,_0x4ffd79[_0x82ec('0x3e')]);return _0x4af2e2['getConfigurations'](_0x482052);}})[_0x82ec('0x3f')](function(_0x341a98){if(_0x341a98){_0x518af8=_0x341a98[_0x82ec('0x35')];if(!_0x4ffd79[_0x82ec('0x2f')]['hasOwnProperty'](_0x82ec('0x36'))){_0x482052['limit']=qs[_0x82ec('0x1a')](_0x4ffd79['query'][_0x82ec('0x1a')]);_0x482052[_0x82ec('0x18')]=qs['offset'](_0x4ffd79[_0x82ec('0x2f')]['offset']);}return _0x4af2e2[_0x82ec('0x48')](_0x482052);}})['then'](function(_0xba07cd){if(_0xba07cd){return _0xba07cd?{'count':_0x518af8,'rows':_0xba07cd}:null;}})[_0x82ec('0x3f')](respondWithResult(_0x45015a,null))[_0x82ec('0x43')](handleError(_0x45015a,null));};exports[_0x82ec('0x4b')]=function(_0x247d18,_0x1d589c,_0x154aa7){if(_0x247d18[_0x82ec('0x47')]['id']){delete _0x247d18[_0x82ec('0x47')]['id'];}return db[_0x82ec('0x28')]['findOne']({'where':{'id':_0x247d18['params']['id']}})[_0x82ec('0x3f')](handleEntityNotFound(_0x1d589c,null))['then'](function(_0x34ce45){if(_0x34ce45){_0x247d18[_0x82ec('0x47')][_0x82ec('0x4c')]=_0x34ce45['id'];_0x247d18[_0x82ec('0x47')][_0x82ec('0x4d')]=integrations[_0x82ec('0x4e')](_0x247d18[_0x82ec('0x47')][_0x82ec('0x4f')],_0x247d18[_0x82ec('0x47')][_0x82ec('0x2b')]);_0x247d18['body'][_0x82ec('0x50')]=integrations[_0x82ec('0x51')](_0x247d18['body']['channel'],_0x247d18[_0x82ec('0x47')][_0x82ec('0x2b')]);return db[_0x82ec('0x4a')][_0x82ec('0x46')](_0x247d18[_0x82ec('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0x82ec('0x4d')},{'model':db[_0x82ec('0x52')],'as':_0x82ec('0x50')}]});}return null;})[_0x82ec('0x3f')](respondWithResult(_0x1d589c,null))[_0x82ec('0x43')](handleError(_0x1d589c,null));};exports['getFields']=function(_0x30575e,_0x4c7486,_0x11abd5){var _0x1d3441='';return db['FreshdeskAccount'][_0x82ec('0x49')]({'where':{'id':_0x30575e[_0x82ec('0x44')]['id']},'attributes':['id',_0x82ec('0x53'),_0x82ec('0x54')]})[_0x82ec('0x3f')](handleEntityNotFound(_0x4c7486,null))[_0x82ec('0x3f')](function(_0x44d1eb){if(_0x44d1eb){_0x1d3441=_0x44d1eb['remoteUri'];var _0xd4aaf3=_0x1d3441[_0x82ec('0x55')](-0x1);if(_0xd4aaf3==='/'){_0x1d3441=_0x1d3441[_0x82ec('0x56')](0x0,_0x1d3441[_0x82ec('0x57')](_0xd4aaf3));}return rp({'method':_0x82ec('0x58'),'uri':util[_0x82ec('0x59')](_0x82ec('0x5a'),_0x1d3441,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x82ec('0x59')](_0x82ec('0x5b'),new Buffer(util[_0x82ec('0x59')](_0x82ec('0x5c'),_0x44d1eb['apiKey']))[_0x82ec('0x5d')](_0x82ec('0x5e')))},'json':!![]});}})[_0x82ec('0x3f')](function(_0x1f3756){if(_0x1f3756){var _0x2650f2=[_0x82ec('0x5f'),_0x82ec('0x60'),'agent',_0x82ec('0x61'),_0x82ec('0x15'),_0x82ec('0x62'),_0x82ec('0x63'),_0x82ec('0x64'),_0x82ec('0x65'),'group',_0x82ec('0x66')];_[_0x82ec('0x67')](_0x1f3756,function(_0x279e1b){return _0x2650f2['includes'](_0x279e1b[_0x82ec('0x25')])||!_0x279e1b[_0x82ec('0x68')]&&_0x279e1b[_0x82ec('0x2b')]!==_0x82ec('0x69')&&_0x279e1b['type']!==_0x82ec('0x6a');});return{'count':_0x1f3756[_0x82ec('0x35')],'rows':_[_0x82ec('0x2e')](_0x1f3756,function(_0x3c86f1){return{'id':_0x3c86f1['name'],'name':_0x3c86f1[_0x82ec('0x6b')],'custom':!_0x3c86f1[_0x82ec('0x68')],'options':_0x3c86f1[_0x82ec('0x6c')]?_['map'](_0x3c86f1[_0x82ec('0x6c')],function(_0x349c67){return{'name':_[_0x82ec('0x6d')](_0x349c67),'value':_0x349c67};}):[]};})};}})[_0x82ec('0x3f')](respondWithResult(_0x4c7486,null))['catch'](function(_0x5179f7){var _0x8e293=_0x30575e[_0x82ec('0x2f')][_0x82ec('0x6e')]?0x1f4:_0x5179f7[_0x82ec('0x6f')]||0x1f4;logger['error'](_0x82ec('0x70'),_0x82ec('0x71'),_0x8e293,JSON[_0x82ec('0x72')](_0x5179f7));delete _0x5179f7['name'];if(_0x8e293===0x191){_0x8e293=0x190;}_0x4c7486[_0x82ec('0x15')](_0x8e293)[_0x82ec('0x26')](_0x30575e['query'][_0x82ec('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x5179f7[_0x82ec('0x6f')]}:_0x5179f7);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7c458c3..46d9d2b 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 _0xece2=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3816f3,_0x1c0897){var _0x4df7f3=function(_0x3cc763){while(--_0x3cc763){_0x3816f3['push'](_0x3816f3['shift']());}};_0x4df7f3(++_0x1c0897);}(_0xece2,0x1e5));var _0x2ece=function(_0x1de994,_0x42a78c){_0x1de994=_0x1de994-0x0;var _0x49df2e=_0xece2[_0x1de994];return _0x49df2e;};'use strict';var _=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var logger=require(_0x2ece('0x2'))(_0x2ece('0x3'));var moment=require(_0x2ece('0x4'));var BPromise=require(_0x2ece('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ece('0x6'));var rimraf=require('rimraf');var config=require(_0x2ece('0x7'));var attributes=require(_0x2ece('0x8'));var integrations=require(_0x2ece('0x9'));module[_0x2ece('0xa')]=function(_0xd1ea5e,_0x171187){return _0xd1ea5e['define'](_0x2ece('0xb'),attributes,{'tableName':_0x2ece('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf50e=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xf50e,0xe4));var _0xef50=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xf50e[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0xef50('0x0'));var util=require('util');var logger=require(_0xef50('0x1'))(_0xef50('0x2'));var moment=require(_0xef50('0x3'));var BPromise=require(_0xef50('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef50('0x5'));var rimraf=require(_0xef50('0x6'));var config=require('../../config/environment');var attributes=require(_0xef50('0x7'));var integrations=require(_0xef50('0x8'));module[_0xef50('0x9')]=function(_0x27eb31,_0x36be52){return _0x27eb31['define'](_0xef50('0xa'),attributes,{'tableName':_0xef50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index c425fcc..ce12d45 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 _0xc5da=['client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','model','map','catch','ShowFreshdeskAccount','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x1a6363,_0x205f25){var _0xd22157=function(_0x26e88e){while(--_0x26e88e){_0x1a6363['push'](_0x1a6363['shift']());}};_0xd22157(++_0x205f25);}(_0xc5da,0x1b2));var _0xac5d=function(_0x24e0a3,_0x341409){_0x24e0a3=_0x24e0a3-0x0;var _0x3ff17d=_0xc5da[_0x24e0a3];return _0x3ff17d;};'use strict';var _=require(_0xac5d('0x0'));var util=require('util');var moment=require(_0xac5d('0x1'));var BPromise=require('bluebird');var rs=require(_0xac5d('0x2'));var fs=require('fs');var Redis=require(_0xac5d('0x3'));var db=require(_0xac5d('0x4'))['db'];var utils=require(_0xac5d('0x5'));var logger=require('../../config/logger')(_0xac5d('0x6'));var config=require('../../config/environment');var jayson=require(_0xac5d('0x7'));var client=jayson[_0xac5d('0x8')][_0xac5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3142f2,_0x25bb27,_0x48b0d7){return new BPromise(function(_0x5cf13b,_0x3c5b3c){return client[_0xac5d('0xa')](_0x3142f2,_0x48b0d7)[_0xac5d('0xb')](function(_0x559aea){logger[_0xac5d('0xc')](_0xac5d('0xd'),_0x25bb27,_0xac5d('0xe'));logger[_0xac5d('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x25bb27,_0xac5d('0xe'),JSON[_0xac5d('0x10')](_0x559aea));if(_0x559aea['error']){if(_0x559aea[_0xac5d('0x11')][_0xac5d('0x12')]===0x1f4){logger[_0xac5d('0x11')](_0xac5d('0xd'),_0x25bb27,_0x559aea[_0xac5d('0x11')][_0xac5d('0x13')]);return _0x3c5b3c(_0x559aea[_0xac5d('0x11')][_0xac5d('0x13')]);}logger[_0xac5d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x25bb27,_0x559aea[_0xac5d('0x11')][_0xac5d('0x13')]);return _0x5cf13b(_0x559aea[_0xac5d('0x11')][_0xac5d('0x13')]);}else{logger[_0xac5d('0xc')](_0xac5d('0xd'),_0x25bb27,'request\x20sent');_0x5cf13b(_0x559aea[_0xac5d('0x14')][_0xac5d('0x13')]);}})['catch'](function(_0x4db03b){logger[_0xac5d('0x11')](_0xac5d('0xd'),_0x25bb27,_0x4db03b);_0x3c5b3c(_0x4db03b);});});}exports[_0xac5d('0x15')]=function(_0x504839){var _0x7238a7=this;return new Promise(function(_0x58834e,_0x305bff){return db[_0xac5d('0x16')][_0xac5d('0x17')]({'raw':_0x504839[_0xac5d('0x18')]?_0x504839['options']['raw']===undefined?!![]:![]:!![],'where':_0x504839['options']?_0x504839[_0xac5d('0x18')][_0xac5d('0x19')]||null:null,'attributes':_0x504839[_0xac5d('0x18')]?_0x504839[_0xac5d('0x18')][_0xac5d('0x1a')]||null:null,'limit':_0x504839[_0xac5d('0x18')]?_0x504839['options'][_0xac5d('0x1b')]||null:null,'include':_0x504839[_0xac5d('0x18')]?_0x504839['options'][_0xac5d('0x1c')]?_['map'](_0x504839[_0xac5d('0x18')]['include'],function(_0x55181b){return{'model':db[_0x55181b[_0xac5d('0x1d')]],'as':_0x55181b['as'],'attributes':_0x55181b[_0xac5d('0x1a')],'include':_0x55181b[_0xac5d('0x1c')]?_[_0xac5d('0x1e')](_0x55181b[_0xac5d('0x1c')],function(_0x4164c1){return{'model':db[_0x4164c1[_0xac5d('0x1d')]],'as':_0x4164c1['as'],'attributes':_0x4164c1[_0xac5d('0x1a')],'include':_0x4164c1[_0xac5d('0x1c')]?_['map'](_0x4164c1['include'],function(_0x94cde8){return{'model':db[_0x94cde8[_0xac5d('0x1d')]],'as':_0x94cde8['as'],'attributes':_0x94cde8[_0xac5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac5d('0xb')](function(_0x278197){logger[_0xac5d('0xc')](_0xac5d('0x15'),_0x504839);logger[_0xac5d('0xf')]('GetFreshdeskAccount',_0x504839,JSON[_0xac5d('0x10')](_0x278197));_0x58834e(_0x278197);})[_0xac5d('0x1f')](function(_0x3c4e30){logger['error']('GetFreshdeskAccount',_0x3c4e30[_0xac5d('0x13')],_0x504839);_0x305bff(_0x7238a7[_0xac5d('0x11')](0x1f4,_0x3c4e30[_0xac5d('0x13')]));});});};exports[_0xac5d('0x20')]=function(_0x5ec543){var _0x38c620=this;return new Promise(function(_0x29fb0f,_0x23314f){return db[_0xac5d('0x16')]['find']({'raw':_0x5ec543['options']?_0x5ec543['options'][_0xac5d('0x21')]===undefined?!![]:![]:!![],'where':_0x5ec543[_0xac5d('0x18')]?_0x5ec543[_0xac5d('0x18')][_0xac5d('0x19')]||null:null,'attributes':_0x5ec543['options']?_0x5ec543[_0xac5d('0x18')][_0xac5d('0x1a')]||null:null,'include':_0x5ec543[_0xac5d('0x18')]?_0x5ec543['options'][_0xac5d('0x1c')]?_['map'](_0x5ec543[_0xac5d('0x18')]['include'],function(_0x42e9bd){return{'model':db[_0x42e9bd['model']],'as':_0x42e9bd['as'],'attributes':_0x42e9bd[_0xac5d('0x1a')],'include':_0x42e9bd[_0xac5d('0x1c')]?_['map'](_0x42e9bd[_0xac5d('0x1c')],function(_0x413528){return{'model':db[_0x413528[_0xac5d('0x1d')]],'as':_0x413528['as'],'attributes':_0x413528['attributes'],'include':_0x413528[_0xac5d('0x1c')]?_[_0xac5d('0x1e')](_0x413528['include'],function(_0x3e673b){return{'model':db[_0x3e673b[_0xac5d('0x1d')]],'as':_0x3e673b['as'],'attributes':_0x3e673b[_0xac5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac5d('0xb')](function(_0x51e8f6){logger[_0xac5d('0xc')](_0xac5d('0x20'),_0x5ec543);logger[_0xac5d('0xf')](_0xac5d('0x20'),_0x5ec543,JSON[_0xac5d('0x10')](_0x51e8f6));_0x29fb0f(_0x51e8f6);})['catch'](function(_0x55f1a5){logger[_0xac5d('0x11')](_0xac5d('0x20'),_0x55f1a5[_0xac5d('0x13')],_0x5ec543);_0x23314f(_0x38c620['error'](0x1f4,_0x55f1a5[_0xac5d('0x13')]));});});}; \ No newline at end of file +var _0x580a=['../../config/environment','client','http','then','info','debug','request\x20sent','stringify','code','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','map','include','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1d3e27,_0x51bff5){var _0x4a5917=function(_0x30bb9f){while(--_0x30bb9f){_0x1d3e27['push'](_0x1d3e27['shift']());}};_0x4a5917(++_0x51bff5);}(_0x580a,0x12a));var _0xa580=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x580a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa580('0x0'));var util=require(_0xa580('0x1'));var moment=require(_0xa580('0x2'));var BPromise=require(_0xa580('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa580('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa580('0x5'));var logger=require(_0xa580('0x6'))(_0xa580('0x7'));var config=require(_0xa580('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa580('0x9')][_0xa580('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409322,_0x5ebae5,_0x3c8a95){return new BPromise(function(_0x3a36e7,_0x538aa1){return client['request'](_0x409322,_0x3c8a95)[_0xa580('0xb')](function(_0x2ef6e1){logger[_0xa580('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ebae5,'request\x20sent');logger[_0xa580('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5ebae5,_0xa580('0xe'),JSON[_0xa580('0xf')](_0x2ef6e1));if(_0x2ef6e1['error']){if(_0x2ef6e1['error'][_0xa580('0x10')]===0x1f4){logger[_0xa580('0x11')](_0xa580('0x12'),_0x5ebae5,_0x2ef6e1[_0xa580('0x11')][_0xa580('0x13')]);return _0x538aa1(_0x2ef6e1[_0xa580('0x11')]['message']);}logger[_0xa580('0x11')](_0xa580('0x12'),_0x5ebae5,_0x2ef6e1[_0xa580('0x11')][_0xa580('0x13')]);return _0x3a36e7(_0x2ef6e1[_0xa580('0x11')][_0xa580('0x13')]);}else{logger['info'](_0xa580('0x12'),_0x5ebae5,_0xa580('0xe'));_0x3a36e7(_0x2ef6e1[_0xa580('0x14')][_0xa580('0x13')]);}})[_0xa580('0x15')](function(_0x504db5){logger[_0xa580('0x11')](_0xa580('0x12'),_0x5ebae5,_0x504db5);_0x538aa1(_0x504db5);});});}exports[_0xa580('0x16')]=function(_0x33b225){var _0x1d36ed=this;return new Promise(function(_0x30c721,_0x3e7a1e){return db[_0xa580('0x17')][_0xa580('0x18')]({'raw':_0x33b225[_0xa580('0x19')]?_0x33b225['options'][_0xa580('0x1a')]===undefined?!![]:![]:!![],'where':_0x33b225[_0xa580('0x19')]?_0x33b225[_0xa580('0x19')][_0xa580('0x1b')]||null:null,'attributes':_0x33b225[_0xa580('0x19')]?_0x33b225[_0xa580('0x19')][_0xa580('0x1c')]||null:null,'limit':_0x33b225[_0xa580('0x19')]?_0x33b225['options']['limit']||null:null,'include':_0x33b225[_0xa580('0x19')]?_0x33b225[_0xa580('0x19')]['include']?_[_0xa580('0x1d')](_0x33b225[_0xa580('0x19')][_0xa580('0x1e')],function(_0x1b218e){return{'model':db[_0x1b218e[_0xa580('0x1f')]],'as':_0x1b218e['as'],'attributes':_0x1b218e[_0xa580('0x1c')],'include':_0x1b218e[_0xa580('0x1e')]?_[_0xa580('0x1d')](_0x1b218e[_0xa580('0x1e')],function(_0x26d9b1){return{'model':db[_0x26d9b1['model']],'as':_0x26d9b1['as'],'attributes':_0x26d9b1['attributes'],'include':_0x26d9b1[_0xa580('0x1e')]?_['map'](_0x26d9b1[_0xa580('0x1e')],function(_0x2ce756){return{'model':db[_0x2ce756['model']],'as':_0x2ce756['as'],'attributes':_0x2ce756['attributes']};}):[]};}):[]};}):[]:[]})[_0xa580('0xb')](function(_0x5da23f){logger[_0xa580('0xc')]('GetFreshdeskAccount',_0x33b225);logger['debug']('GetFreshdeskAccount',_0x33b225,JSON['stringify'](_0x5da23f));_0x30c721(_0x5da23f);})[_0xa580('0x15')](function(_0x50a095){logger['error'](_0xa580('0x16'),_0x50a095[_0xa580('0x13')],_0x33b225);_0x3e7a1e(_0x1d36ed['error'](0x1f4,_0x50a095[_0xa580('0x13')]));});});};exports[_0xa580('0x20')]=function(_0x2e8da8){var _0x29922d=this;return new Promise(function(_0x4c0cdd,_0x3ea043){return db[_0xa580('0x17')][_0xa580('0x21')]({'raw':_0x2e8da8[_0xa580('0x19')]?_0x2e8da8[_0xa580('0x19')][_0xa580('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e8da8['options']?_0x2e8da8['options'][_0xa580('0x1b')]||null:null,'attributes':_0x2e8da8['options']?_0x2e8da8[_0xa580('0x19')][_0xa580('0x1c')]||null:null,'include':_0x2e8da8['options']?_0x2e8da8['options']['include']?_[_0xa580('0x1d')](_0x2e8da8['options']['include'],function(_0x3718e7){return{'model':db[_0x3718e7[_0xa580('0x1f')]],'as':_0x3718e7['as'],'attributes':_0x3718e7['attributes'],'include':_0x3718e7[_0xa580('0x1e')]?_[_0xa580('0x1d')](_0x3718e7['include'],function(_0x2f6410){return{'model':db[_0x2f6410['model']],'as':_0x2f6410['as'],'attributes':_0x2f6410[_0xa580('0x1c')],'include':_0x2f6410[_0xa580('0x1e')]?_[_0xa580('0x1d')](_0x2f6410[_0xa580('0x1e')],function(_0x335f4a){return{'model':db[_0x335f4a[_0xa580('0x1f')]],'as':_0x335f4a['as'],'attributes':_0x335f4a[_0xa580('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa580('0xb')](function(_0x17045f){logger[_0xa580('0xc')](_0xa580('0x20'),_0x2e8da8);logger[_0xa580('0xd')]('ShowFreshdeskAccount',_0x2e8da8,JSON[_0xa580('0xf')](_0x17045f));_0x4c0cdd(_0x17045f);})[_0xa580('0x15')](function(_0x3ee44c){logger[_0xa580('0x11')](_0xa580('0x20'),_0x3ee44c[_0xa580('0x13')],_0x2e8da8);_0x3ea043(_0x29922d[_0xa580('0x11')](0x1f4,_0x3ee44c[_0xa580('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 807ee64..1bf37f8 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 _0x1821=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x32e94b,_0x38c7a7){var _0x3b1567=function(_0x282670){while(--_0x282670){_0x32e94b['push'](_0x32e94b['shift']());}};_0x3b1567(++_0x38c7a7);}(_0x1821,0x1ef));var _0x1182=function(_0x346401,_0x3ea59e){_0x346401=_0x346401-0x0;var _0x28affa=_0x1821[_0x346401];return _0x28affa;};'use strict';var multer=require(_0x1182('0x0'));var util=require(_0x1182('0x1'));var path=require('path');var timeout=require(_0x1182('0x2'));var express=require(_0x1182('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1182('0x4'));var interaction=require(_0x1182('0x5'));var config=require(_0x1182('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x1182('0x7')]('/',auth['isAuthenticated'](),controller[_0x1182('0x8')]);router[_0x1182('0x7')](_0x1182('0x9'),auth[_0x1182('0xa')](),controller[_0x1182('0xb')]);router[_0x1182('0x7')](_0x1182('0xc'),auth[_0x1182('0xa')](),controller['getFields']);router[_0x1182('0x7')](_0x1182('0xd'),auth['isAuthenticated'](),controller[_0x1182('0xe')]);router[_0x1182('0x7')](_0x1182('0xf'),auth[_0x1182('0xa')](),controller[_0x1182('0x10')]);router[_0x1182('0x7')](_0x1182('0x11'),auth[_0x1182('0xa')](),controller[_0x1182('0x12')]);router[_0x1182('0x13')]('/',auth[_0x1182('0xa')](),controller[_0x1182('0x14')]);router['post'](_0x1182('0x11'),auth[_0x1182('0xa')](),controller[_0x1182('0x15')]);router[_0x1182('0x16')](_0x1182('0x9'),auth[_0x1182('0xa')](),controller[_0x1182('0x17')]);router['delete'](_0x1182('0x9'),auth['isAuthenticated'](),controller[_0x1182('0x18')]);module['exports']=router; \ No newline at end of file +var _0x5bf3=['index','/:id','isAuthenticated','show','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0xe616b6,_0x1bf3de){var _0x1e4ec1=function(_0x43d940){while(--_0x43d940){_0xe616b6['push'](_0xe616b6['shift']());}};_0x1e4ec1(++_0x1bf3de);}(_0x5bf3,0x119));var _0x35bf=function(_0x57becc,_0x1a668b){_0x57becc=_0x57becc-0x0;var _0x57f493=_0x5bf3[_0x57becc];return _0x57f493;};'use strict';var multer=require(_0x35bf('0x0'));var util=require('util');var path=require(_0x35bf('0x1'));var timeout=require(_0x35bf('0x2'));var express=require(_0x35bf('0x3'));var router=express['Router']();var fs_extra=require(_0x35bf('0x4'));var auth=require(_0x35bf('0x5'));var interaction=require(_0x35bf('0x6'));var config=require(_0x35bf('0x7'));var controller=require(_0x35bf('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x35bf('0x9')]);router['get'](_0x35bf('0xa'),auth[_0x35bf('0xb')](),controller[_0x35bf('0xc')]);router['get'](_0x35bf('0xd'),auth[_0x35bf('0xb')](),controller[_0x35bf('0xe')]);router[_0x35bf('0xf')](_0x35bf('0x10'),auth[_0x35bf('0xb')](),controller[_0x35bf('0x11')]);router[_0x35bf('0xf')](_0x35bf('0x12'),auth[_0x35bf('0xb')](),controller[_0x35bf('0x13')]);router[_0x35bf('0xf')](_0x35bf('0x14'),auth['isAuthenticated'](),controller[_0x35bf('0x15')]);router[_0x35bf('0x16')]('/',auth[_0x35bf('0xb')](),controller['create']);router[_0x35bf('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x35bf('0x17')]);router[_0x35bf('0x18')](_0x35bf('0xa'),auth[_0x35bf('0xb')](),controller[_0x35bf('0x19')]);router[_0x35bf('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x35bf('0x1b')]);module[_0x35bf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 5238ba2..64f74a4 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 _0x921b=['STRING','sequelize'];(function(_0x5aecd1,_0x51075b){var _0x292c92=function(_0xdf1cf6){while(--_0xdf1cf6){_0x5aecd1['push'](_0x5aecd1['shift']());}};_0x292c92(++_0x51075b);}(_0x921b,0x127));var _0xb921=function(_0x1d8866,_0xbbad33){_0x1d8866=_0x1d8866-0x0;var _0x5452c9=_0x921b[_0x1d8866];return _0x5452c9;};'use strict';var Sequelize=require(_0xb921('0x0'));module['exports']={'name':{'type':Sequelize[_0xb921('0x1')]},'description':{'type':Sequelize[_0xb921('0x1')]}}; \ No newline at end of file +var _0xeaff=['STRING','sequelize','exports'];(function(_0x19000b,_0x35c472){var _0x37aa77=function(_0x371cb7){while(--_0x371cb7){_0x19000b['push'](_0x19000b['shift']());}};_0x37aa77(++_0x35c472);}(_0xeaff,0xc7));var _0xfeaf=function(_0x25e7bb,_0x1d9119){_0x25e7bb=_0x25e7bb-0x0;var _0x200e27=_0xeaff[_0x25e7bb];return _0x200e27;};'use strict';var Sequelize=require(_0xfeaf('0x0'));module[_0xfeaf('0x1')]={'name':{'type':Sequelize[_0xfeaf('0x2')]},'description':{'type':Sequelize[_0xfeaf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 9f5a221..b67512d 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 _0x19d0=['params','length','options','catch','create','body','update','find','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show'];(function(_0xc679aa,_0xf9a83d){var _0x70df2c=function(_0xaff459){while(--_0xaff459){_0xc679aa['push'](_0xc679aa['shift']());}};_0x70df2c(++_0xf9a83d);}(_0x19d0,0x11d));var _0x019d=function(_0x539a39,_0x52e43c){_0x539a39=_0x539a39-0x0;var _0x574278=_0x19d0[_0x539a39];return _0x574278;};'use strict';var emlformat=require(_0x019d('0x0'));var rimraf=require(_0x019d('0x1'));var zipdir=require(_0x019d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x019d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x019d('0x4'));var util=require(_0x019d('0x5'));var path=require(_0x019d('0x6'));var sox=require('sox');var csv=require(_0x019d('0x7'));var ejs=require(_0x019d('0x8'));var fs=require('fs');var fs_extra=require(_0x019d('0x9'));var _=require(_0x019d('0xa'));var squel=require(_0x019d('0xb'));var crypto=require(_0x019d('0xc'));var jsforce=require(_0x019d('0xd'));var deskjs=require(_0x019d('0xe'));var toCsv=require(_0x019d('0x7'));var querystring=require(_0x019d('0xf'));var Papa=require(_0x019d('0x10'));var Redis=require(_0x019d('0x11'));var authService=require(_0x019d('0x12'));var qs=require(_0x019d('0x13'));var as=require(_0x019d('0x14'));var hardwareService=require(_0x019d('0x15'));var logger=require(_0x019d('0x16'))(_0x019d('0x17'));var utils=require(_0x019d('0x18'));var config=require(_0x019d('0x19'));var licenseUtil=require(_0x019d('0x1a'));var db=require(_0x019d('0x1b'))['db'];function respondWithStatusCode(_0x413e33,_0x3e7eba){_0x3e7eba=_0x3e7eba||0xcc;return function(_0xe914bb){if(_0xe914bb){return _0x413e33['sendStatus'](_0x3e7eba);}return _0x413e33[_0x019d('0x1c')](_0x3e7eba)[_0x019d('0x1d')]();};}function respondWithResult(_0x232213,_0x3cbc02){_0x3cbc02=_0x3cbc02||0xc8;return function(_0x43cf9f){if(_0x43cf9f){return _0x232213['status'](_0x3cbc02)[_0x019d('0x1e')](_0x43cf9f);}};}function respondWithFilteredResult(_0x4a3ea1,_0x352124){return function(_0x57758b){if(_0x57758b){var _0x47a29c=typeof _0x352124['offset']==='undefined'&&typeof _0x352124[_0x019d('0x1f')]===_0x019d('0x20');var _0x7e702e=_0x57758b[_0x019d('0x21')];var _0x2a0f8a=_0x47a29c?0x0:_0x352124[_0x019d('0x22')];var _0x5c904d=_0x47a29c?_0x57758b[_0x019d('0x21')]:_0x352124[_0x019d('0x22')]+_0x352124['limit'];var _0x41bc2c;if(_0x5c904d>=_0x7e702e){_0x5c904d=_0x7e702e;_0x41bc2c=0xc8;}else{_0x41bc2c=0xce;}_0x4a3ea1[_0x019d('0x1c')](_0x41bc2c);return _0x4a3ea1['set'](_0x019d('0x23'),_0x2a0f8a+'-'+_0x5c904d+'/'+_0x7e702e)['json'](_0x57758b);}return null;};}function patchUpdates(_0x2417c0){return function(_0x4f401f){try{jsonpatch[_0x019d('0x24')](_0x4f401f,_0x2417c0,!![]);}catch(_0x4996b7){return BPromise[_0x019d('0x25')](_0x4996b7);}return _0x4f401f[_0x019d('0x26')]();};}function saveUpdates(_0x4c807b,_0x2a2606){return function(_0x42817e){if(_0x42817e){return _0x42817e['update'](_0x4c807b)['then'](function(_0x3cc5e8){return _0x3cc5e8;});}return null;};}function removeEntity(_0x5af5a1,_0x222cfe){return function(_0x1815b5){if(_0x1815b5){return _0x1815b5[_0x019d('0x27')]()[_0x019d('0x28')](function(){_0x5af5a1[_0x019d('0x1c')](0xcc)[_0x019d('0x1d')]();});}};}function handleEntityNotFound(_0x2766fc,_0x3a444c){return function(_0x270fb3){if(!_0x270fb3){_0x2766fc['sendStatus'](0x194);}return _0x270fb3;};}function handleError(_0x4654f2,_0x177766){_0x177766=_0x177766||0x1f4;return function(_0x5bf845){logger[_0x019d('0x29')](_0x5bf845[_0x019d('0x2a')]);if(_0x5bf845[_0x019d('0x2b')]){delete _0x5bf845[_0x019d('0x2b')];}_0x4654f2['status'](_0x177766)[_0x019d('0x2c')](_0x5bf845);};}exports[_0x019d('0x2d')]=function(_0x275ac4,_0x1c6605){var _0xf554e2={},_0x1d5e49={},_0xb88349={'count':0x0,'rows':[]};var _0x1cc06f=_[_0x019d('0x2e')](db[_0x019d('0x2f')][_0x019d('0x30')],function(_0xbcc6a0){return{'name':_0xbcc6a0['fieldName'],'type':_0xbcc6a0[_0x019d('0x31')][_0x019d('0x32')]};});_0x1d5e49[_0x019d('0x33')]=_[_0x019d('0x2e')](_0x1cc06f,_0x019d('0x2b'));_0x1d5e49[_0x019d('0x34')]=_[_0x019d('0x35')](_0x275ac4[_0x019d('0x34')]);_0x1d5e49[_0x019d('0x36')]=_[_0x019d('0x37')](_0x1d5e49[_0x019d('0x33')],_0x1d5e49[_0x019d('0x34')]);_0xf554e2[_0x019d('0x38')]=_[_0x019d('0x37')](_0x1d5e49[_0x019d('0x33')],qs[_0x019d('0x39')](_0x275ac4[_0x019d('0x34')][_0x019d('0x39')]));_0xf554e2[_0x019d('0x38')]=_0xf554e2[_0x019d('0x38')]['length']?_0xf554e2[_0x019d('0x38')]:_0x1d5e49[_0x019d('0x33')];if(!_0x275ac4[_0x019d('0x34')][_0x019d('0x3a')](_0x019d('0x3b'))){_0xf554e2[_0x019d('0x1f')]=qs['limit'](_0x275ac4[_0x019d('0x34')][_0x019d('0x1f')]);_0xf554e2['offset']=qs[_0x019d('0x22')](_0x275ac4[_0x019d('0x34')]['offset']);}_0xf554e2[_0x019d('0x3c')]=qs[_0x019d('0x3d')](_0x275ac4[_0x019d('0x34')]['sort']);_0xf554e2['where']=qs[_0x019d('0x36')](_['pick'](_0x275ac4[_0x019d('0x34')],_0x1d5e49[_0x019d('0x36')]),_0x1cc06f);if(_0x275ac4[_0x019d('0x34')][_0x019d('0x3e')]){_0xf554e2[_0x019d('0x3f')]=_[_0x019d('0x40')](_0xf554e2[_0x019d('0x3f')],{'$or':_['map'](_0x1cc06f,function(_0x3b56ce){if(_0x3b56ce[_0x019d('0x31')]!==_0x019d('0x41')){var _0x3bcedb={};_0x3bcedb[_0x3b56ce[_0x019d('0x2b')]]={'$like':'%'+_0x275ac4[_0x019d('0x34')]['filter']+'%'};return _0x3bcedb;}})});}_0xf554e2=_[_0x019d('0x40')]({},_0xf554e2,_0x275ac4['options']);var _0x3fdc52={'where':_0xf554e2[_0x019d('0x3f')]};return db['FreshdeskConfiguration'][_0x019d('0x21')](_0x3fdc52)[_0x019d('0x28')](function(_0x385cff){_0xb88349['count']=_0x385cff;if(_0x275ac4[_0x019d('0x34')][_0x019d('0x42')]){_0xf554e2[_0x019d('0x43')]=[{'all':!![]}];}return db[_0x019d('0x2f')][_0x019d('0x44')](_0xf554e2);})[_0x019d('0x28')](function(_0x1d6c55){_0xb88349[_0x019d('0x45')]=_0x1d6c55;return _0xb88349;})[_0x019d('0x28')](respondWithFilteredResult(_0x1c6605,_0xf554e2))['catch'](handleError(_0x1c6605,null));};exports[_0x019d('0x46')]=function(_0x114c40,_0xa8fc22){var _0x2aca72={'raw':![],'where':{'id':_0x114c40[_0x019d('0x47')]['id']}},_0x6ab738={};_0x6ab738[_0x019d('0x33')]=_[_0x019d('0x35')](db['FreshdeskConfiguration']['rawAttributes']);_0x6ab738[_0x019d('0x34')]=_[_0x019d('0x35')](_0x114c40[_0x019d('0x34')]);_0x6ab738[_0x019d('0x36')]=_[_0x019d('0x37')](_0x6ab738['model'],_0x6ab738['query']);_0x2aca72[_0x019d('0x38')]=_[_0x019d('0x37')](_0x6ab738[_0x019d('0x33')],qs['fields'](_0x114c40[_0x019d('0x34')][_0x019d('0x39')]));_0x2aca72[_0x019d('0x38')]=_0x2aca72[_0x019d('0x38')][_0x019d('0x48')]?_0x2aca72[_0x019d('0x38')]:_0x6ab738['model'];if(_0x114c40[_0x019d('0x34')]['includeAll']){_0x2aca72[_0x019d('0x43')]=[{'all':!![]}];}_0x2aca72=_['merge']({},_0x2aca72,_0x114c40[_0x019d('0x49')]);return db[_0x019d('0x2f')]['find'](_0x2aca72)[_0x019d('0x28')](handleEntityNotFound(_0xa8fc22,null))[_0x019d('0x28')](respondWithResult(_0xa8fc22,null))[_0x019d('0x4a')](handleError(_0xa8fc22,null));};exports[_0x019d('0x4b')]=function(_0xd3005c,_0x52015f){return db[_0x019d('0x2f')][_0x019d('0x4b')](_0xd3005c[_0x019d('0x4c')],{})[_0x019d('0x28')](respondWithResult(_0x52015f,0xc9))[_0x019d('0x4a')](handleError(_0x52015f,null));};exports[_0x019d('0x4d')]=function(_0x30da95,_0x2c6399){if(_0x30da95[_0x019d('0x4c')]['id']){delete _0x30da95['body']['id'];}return db['FreshdeskConfiguration'][_0x019d('0x4e')]({'where':{'id':_0x30da95[_0x019d('0x47')]['id']}})[_0x019d('0x28')](handleEntityNotFound(_0x2c6399,null))['then'](saveUpdates(_0x30da95[_0x019d('0x4c')],null))[_0x019d('0x28')](respondWithResult(_0x2c6399,null))['catch'](handleError(_0x2c6399,null));};exports[_0x019d('0x27')]=function(_0x412566,_0x2ca8af){return db[_0x019d('0x2f')][_0x019d('0x4e')]({'where':{'id':_0x412566[_0x019d('0x47')]['id']}})[_0x019d('0x28')](handleEntityNotFound(_0x2ca8af,null))[_0x019d('0x28')](removeEntity(_0x2ca8af,null))['catch'](handleError(_0x2ca8af,null));};exports[_0x019d('0x4f')]=function(_0x132e13,_0x4e1322,_0x5903de){var _0x340c08={};var _0x52aff3={};var _0xc9c954;var _0x54fa7f;return db['FreshdeskConfiguration'][_0x019d('0x50')]({'where':{'id':_0x132e13[_0x019d('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e1322,null))[_0x019d('0x28')](function(_0x41bb7e){if(_0x41bb7e){_0xc9c954=_0x41bb7e;_0x52aff3[_0x019d('0x33')]=_['keys'](db[_0x019d('0x51')][_0x019d('0x30')]);_0x52aff3['query']=_['keys'](_0x132e13[_0x019d('0x34')]);_0x52aff3[_0x019d('0x36')]=_[_0x019d('0x37')](_0x52aff3['model'],_0x52aff3[_0x019d('0x34')]);_0x340c08[_0x019d('0x38')]=_[_0x019d('0x37')](_0x52aff3['model'],qs[_0x019d('0x39')](_0x132e13[_0x019d('0x34')]['fields']));_0x340c08[_0x019d('0x38')]=_0x340c08[_0x019d('0x38')][_0x019d('0x48')]?_0x340c08[_0x019d('0x38')]:_0x52aff3[_0x019d('0x33')];_0x340c08[_0x019d('0x3c')]=qs[_0x019d('0x3d')](_0x132e13[_0x019d('0x34')][_0x019d('0x3d')]);_0x340c08[_0x019d('0x3f')]=qs[_0x019d('0x36')](_[_0x019d('0x52')](_0x132e13['query'],_0x52aff3[_0x019d('0x36')]));if(_0x132e13[_0x019d('0x34')][_0x019d('0x3e')]){_0x340c08[_0x019d('0x3f')]=_[_0x019d('0x40')](_0x340c08[_0x019d('0x3f')],{'$or':_['map'](_0x340c08[_0x019d('0x38')],function(_0x2118c5){var _0x2a74d4={};_0x2a74d4[_0x2118c5]={'$like':'%'+_0x132e13[_0x019d('0x34')][_0x019d('0x3e')]+'%'};return _0x2a74d4;})});}_0x340c08=_[_0x019d('0x40')]({},_0x340c08,_0x132e13[_0x019d('0x49')]);return _0xc9c954[_0x019d('0x4f')](_0x340c08);}})['then'](function(_0x17e2e9){if(_0x17e2e9){_0x54fa7f=_0x17e2e9[_0x019d('0x48')];if(!_0x132e13[_0x019d('0x34')][_0x019d('0x3a')]('nolimit')){_0x340c08[_0x019d('0x1f')]=qs['limit'](_0x132e13['query'][_0x019d('0x1f')]);_0x340c08[_0x019d('0x22')]=qs['offset'](_0x132e13['query'][_0x019d('0x22')]);}return _0xc9c954[_0x019d('0x4f')](_0x340c08);}})[_0x019d('0x28')](function(_0x17f918){if(_0x17f918){return _0x17f918?{'count':_0x54fa7f,'rows':_0x17f918}:null;}})[_0x019d('0x28')](respondWithResult(_0x4e1322,null))[_0x019d('0x4a')](handleError(_0x4e1322,null));};exports['getSubjects']=function(_0x2e59d8,_0x55f0dd,_0x21283b){var _0x5de7ae={};var _0x489eb2={};var _0x20c209;var _0x192624;return db[_0x019d('0x2f')][_0x019d('0x50')]({'where':{'id':_0x2e59d8[_0x019d('0x47')]['id']}})['then'](handleEntityNotFound(_0x55f0dd,null))['then'](function(_0x1b156c){if(_0x1b156c){_0x20c209=_0x1b156c;_0x489eb2[_0x019d('0x33')]=_['keys'](db[_0x019d('0x51')][_0x019d('0x30')]);_0x489eb2[_0x019d('0x34')]=_[_0x019d('0x35')](_0x2e59d8['query']);_0x489eb2['filters']=_['intersection'](_0x489eb2[_0x019d('0x33')],_0x489eb2[_0x019d('0x34')]);_0x5de7ae['attributes']=_['intersection'](_0x489eb2['model'],qs[_0x019d('0x39')](_0x2e59d8[_0x019d('0x34')]['fields']));_0x5de7ae['attributes']=_0x5de7ae[_0x019d('0x38')][_0x019d('0x48')]?_0x5de7ae[_0x019d('0x38')]:_0x489eb2['model'];_0x5de7ae[_0x019d('0x3c')]=qs['sort'](_0x2e59d8[_0x019d('0x34')][_0x019d('0x3d')]);_0x5de7ae[_0x019d('0x3f')]=qs[_0x019d('0x36')](_['pick'](_0x2e59d8[_0x019d('0x34')],_0x489eb2['filters']));if(_0x2e59d8[_0x019d('0x34')]['filter']){_0x5de7ae[_0x019d('0x3f')]=_[_0x019d('0x40')](_0x5de7ae['where'],{'$or':_[_0x019d('0x2e')](_0x5de7ae[_0x019d('0x38')],function(_0x56203f){var _0x496a71={};_0x496a71[_0x56203f]={'$like':'%'+_0x2e59d8[_0x019d('0x34')][_0x019d('0x3e')]+'%'};return _0x496a71;})});}_0x5de7ae=_[_0x019d('0x40')]({},_0x5de7ae,_0x2e59d8[_0x019d('0x49')]);return _0x20c209[_0x019d('0x53')](_0x5de7ae);}})[_0x019d('0x28')](function(_0x4fddc7){if(_0x4fddc7){_0x192624=_0x4fddc7['length'];if(!_0x2e59d8[_0x019d('0x34')][_0x019d('0x3a')](_0x019d('0x3b'))){_0x5de7ae[_0x019d('0x1f')]=qs[_0x019d('0x1f')](_0x2e59d8[_0x019d('0x34')]['limit']);_0x5de7ae[_0x019d('0x22')]=qs[_0x019d('0x22')](_0x2e59d8[_0x019d('0x34')][_0x019d('0x22')]);}return _0x20c209[_0x019d('0x53')](_0x5de7ae);}})[_0x019d('0x28')](function(_0xc17d23){if(_0xc17d23){return _0xc17d23?{'count':_0x192624,'rows':_0xc17d23}:null;}})['then'](respondWithResult(_0x55f0dd,null))[_0x019d('0x4a')](handleError(_0x55f0dd,null));};exports[_0x019d('0x54')]=function(_0x13f6e6,_0x22b333,_0x1fd70c){var _0x5f35da={};var _0x42c543={};var _0x41dca7;var _0xa8078;return db[_0x019d('0x2f')][_0x019d('0x50')]({'where':{'id':_0x13f6e6['params']['id']}})[_0x019d('0x28')](handleEntityNotFound(_0x22b333,null))[_0x019d('0x28')](function(_0x26fd3f){if(_0x26fd3f){_0x41dca7=_0x26fd3f;_0x42c543[_0x019d('0x33')]=_[_0x019d('0x35')](db[_0x019d('0x51')][_0x019d('0x30')]);_0x42c543[_0x019d('0x34')]=_[_0x019d('0x35')](_0x13f6e6[_0x019d('0x34')]);_0x42c543[_0x019d('0x36')]=_['intersection'](_0x42c543[_0x019d('0x33')],_0x42c543[_0x019d('0x34')]);_0x5f35da[_0x019d('0x38')]=_[_0x019d('0x37')](_0x42c543[_0x019d('0x33')],qs[_0x019d('0x39')](_0x13f6e6['query'][_0x019d('0x39')]));_0x5f35da['attributes']=_0x5f35da[_0x019d('0x38')]['length']?_0x5f35da[_0x019d('0x38')]:_0x42c543[_0x019d('0x33')];_0x5f35da[_0x019d('0x3c')]=qs[_0x019d('0x3d')](_0x13f6e6[_0x019d('0x34')][_0x019d('0x3d')]);_0x5f35da[_0x019d('0x3f')]=qs[_0x019d('0x36')](_[_0x019d('0x52')](_0x13f6e6[_0x019d('0x34')],_0x42c543[_0x019d('0x36')]));if(_0x13f6e6[_0x019d('0x34')][_0x019d('0x3e')]){_0x5f35da['where']=_['merge'](_0x5f35da['where'],{'$or':_[_0x019d('0x2e')](_0x5f35da['attributes'],function(_0x44cc31){var _0x74c38d={};_0x74c38d[_0x44cc31]={'$like':'%'+_0x13f6e6[_0x019d('0x34')][_0x019d('0x3e')]+'%'};return _0x74c38d;})});}_0x5f35da=_[_0x019d('0x40')]({},_0x5f35da,_0x13f6e6[_0x019d('0x49')]);return _0x41dca7[_0x019d('0x54')](_0x5f35da);}})[_0x019d('0x28')](function(_0x380afe){if(_0x380afe){_0xa8078=_0x380afe[_0x019d('0x48')];if(!_0x13f6e6[_0x019d('0x34')][_0x019d('0x3a')](_0x019d('0x3b'))){_0x5f35da[_0x019d('0x1f')]=qs[_0x019d('0x1f')](_0x13f6e6[_0x019d('0x34')][_0x019d('0x1f')]);_0x5f35da['offset']=qs['offset'](_0x13f6e6['query'][_0x019d('0x22')]);}return _0x41dca7['getDescriptions'](_0x5f35da);}})[_0x019d('0x28')](function(_0x301cab){if(_0x301cab){return _0x301cab?{'count':_0xa8078,'rows':_0x301cab}:null;}})[_0x019d('0x28')](respondWithResult(_0x22b333,null))['catch'](handleError(_0x22b333,null));};exports[_0x019d('0x55')]=function(_0xe77228,_0x52a507,_0x1025ca){var _0xe4fde1={};var _0xe647d3={};var _0x5bf57e;var _0x5ed9ee;return db[_0x019d('0x2f')][_0x019d('0x50')]({'where':{'id':_0xe77228[_0x019d('0x47')]['id']}})[_0x019d('0x28')](handleEntityNotFound(_0x52a507,null))[_0x019d('0x28')](function(_0x312712){if(_0x312712){_0x5bf57e=_0x312712;_0xe647d3[_0x019d('0x33')]=_[_0x019d('0x35')](db[_0x019d('0x56')][_0x019d('0x30')]);_0xe647d3[_0x019d('0x34')]=_[_0x019d('0x35')](_0xe77228['query']);_0xe647d3[_0x019d('0x36')]=_[_0x019d('0x37')](_0xe647d3['model'],_0xe647d3[_0x019d('0x34')]);_0xe4fde1[_0x019d('0x38')]=_[_0x019d('0x37')](_0xe647d3[_0x019d('0x33')],qs[_0x019d('0x39')](_0xe77228['query']['fields']));_0xe4fde1['attributes']=_0xe4fde1[_0x019d('0x38')]['length']?_0xe4fde1[_0x019d('0x38')]:_0xe647d3[_0x019d('0x33')];_0xe4fde1[_0x019d('0x3c')]=qs[_0x019d('0x3d')](_0xe77228[_0x019d('0x34')]['sort']);_0xe4fde1[_0x019d('0x3f')]=qs[_0x019d('0x36')](_[_0x019d('0x52')](_0xe77228[_0x019d('0x34')],_0xe647d3[_0x019d('0x36')]));if(_0xe77228[_0x019d('0x34')][_0x019d('0x3e')]){_0xe4fde1['where']=_[_0x019d('0x40')](_0xe4fde1[_0x019d('0x3f')],{'$or':_[_0x019d('0x2e')](_0xe4fde1[_0x019d('0x38')],function(_0x2f8c8a){var _0x1fd17a={};_0x1fd17a[_0x2f8c8a]={'$like':'%'+_0xe77228[_0x019d('0x34')][_0x019d('0x3e')]+'%'};return _0x1fd17a;})});}_0xe4fde1=_['merge']({},_0xe4fde1,_0xe77228[_0x019d('0x49')]);return _0x5bf57e['getTags'](_0xe4fde1);}})[_0x019d('0x28')](function(_0x3a818c){if(_0x3a818c){_0x5ed9ee=_0x3a818c[_0x019d('0x48')];if(!_0xe77228[_0x019d('0x34')][_0x019d('0x3a')](_0x019d('0x3b'))){_0xe4fde1[_0x019d('0x1f')]=qs[_0x019d('0x1f')](_0xe77228[_0x019d('0x34')][_0x019d('0x1f')]);_0xe4fde1[_0x019d('0x22')]=qs[_0x019d('0x22')](_0xe77228[_0x019d('0x34')][_0x019d('0x22')]);}return _0x5bf57e[_0x019d('0x55')](_0xe4fde1);}})[_0x019d('0x28')](function(_0x350c8e){if(_0x350c8e){return _0x350c8e?{'count':_0x5ed9ee,'rows':_0x350c8e}:null;}})[_0x019d('0x28')](respondWithResult(_0x52a507,null))[_0x019d('0x4a')](handleError(_0x52a507,null));};exports[_0x019d('0x57')]=function(_0x7b9705,_0x2d7873,_0x6fd11a){if(_0x7b9705[_0x019d('0x4c')]['id']){delete _0x7b9705[_0x019d('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0x019d('0x50')]({'where':{'id':_0x7b9705[_0x019d('0x47')]['id']}})[_0x019d('0x28')](handleEntityNotFound(_0x2d7873,null))['then'](function(_0x100318){if(_0x100318){return _0x100318[_0x019d('0x57')](_0x7b9705['body'][_0x019d('0x58')]||[]);}return null;})[_0x019d('0x28')](respondWithResult(_0x2d7873,null))[_0x019d('0x4a')](handleError(_0x2d7873,null));}; \ No newline at end of file +var _0x47da=['merge','where','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','map','getFields','hasOwnProperty','nolimit','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter'];(function(_0x4cdde6,_0x1dd961){var _0x30faa9=function(_0x308eb3){while(--_0x308eb3){_0x4cdde6['push'](_0x4cdde6['shift']());}};_0x30faa9(++_0x1dd961);}(_0x47da,0x111));var _0xa47d=function(_0x3d8c9d,_0x7c9594){_0x3d8c9d=_0x3d8c9d-0x0;var _0x1ee18e=_0x47da[_0x3d8c9d];return _0x1ee18e;};'use strict';var emlformat=require(_0xa47d('0x0'));var rimraf=require(_0xa47d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa47d('0x2'));var moment=require(_0xa47d('0x3'));var BPromise=require(_0xa47d('0x4'));var Mustache=require(_0xa47d('0x5'));var util=require(_0xa47d('0x6'));var path=require(_0xa47d('0x7'));var sox=require('sox');var csv=require(_0xa47d('0x8'));var ejs=require(_0xa47d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa47d('0xa'));var squel=require(_0xa47d('0xb'));var crypto=require('crypto');var jsforce=require(_0xa47d('0xc'));var deskjs=require(_0xa47d('0xd'));var toCsv=require(_0xa47d('0x8'));var querystring=require('querystring');var Papa=require(_0xa47d('0xe'));var Redis=require(_0xa47d('0xf'));var authService=require(_0xa47d('0x10'));var qs=require(_0xa47d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa47d('0x12'));var logger=require(_0xa47d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa47d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa47d('0x15'))['db'];function respondWithStatusCode(_0x2ca156,_0xb98e62){_0xb98e62=_0xb98e62||0xcc;return function(_0x8f6e95){if(_0x8f6e95){return _0x2ca156[_0xa47d('0x16')](_0xb98e62);}return _0x2ca156[_0xa47d('0x17')](_0xb98e62)[_0xa47d('0x18')]();};}function respondWithResult(_0x430e5b,_0x349fff){_0x349fff=_0x349fff||0xc8;return function(_0x522717){if(_0x522717){return _0x430e5b[_0xa47d('0x17')](_0x349fff)[_0xa47d('0x19')](_0x522717);}};}function respondWithFilteredResult(_0x3852cf,_0x3d5a01){return function(_0x4ac738){if(_0x4ac738){var _0x33d8d0=typeof _0x3d5a01[_0xa47d('0x1a')]==='undefined'&&typeof _0x3d5a01[_0xa47d('0x1b')]===_0xa47d('0x1c');var _0x657acc=_0x4ac738['count'];var _0x21e572=_0x33d8d0?0x0:_0x3d5a01[_0xa47d('0x1a')];var _0x1ffcf5=_0x33d8d0?_0x4ac738[_0xa47d('0x1d')]:_0x3d5a01[_0xa47d('0x1a')]+_0x3d5a01['limit'];var _0x228e53;if(_0x1ffcf5>=_0x657acc){_0x1ffcf5=_0x657acc;_0x228e53=0xc8;}else{_0x228e53=0xce;}_0x3852cf[_0xa47d('0x17')](_0x228e53);return _0x3852cf[_0xa47d('0x1e')](_0xa47d('0x1f'),_0x21e572+'-'+_0x1ffcf5+'/'+_0x657acc)['json'](_0x4ac738);}return null;};}function patchUpdates(_0x28dc5a){return function(_0x1047d2){try{jsonpatch[_0xa47d('0x20')](_0x1047d2,_0x28dc5a,!![]);}catch(_0x463ab5){return BPromise[_0xa47d('0x21')](_0x463ab5);}return _0x1047d2[_0xa47d('0x22')]();};}function saveUpdates(_0x324592,_0x1d068b){return function(_0x36e49a){if(_0x36e49a){return _0x36e49a[_0xa47d('0x23')](_0x324592)[_0xa47d('0x24')](function(_0x48752c){return _0x48752c;});}return null;};}function removeEntity(_0x3927e4,_0x32cb1b){return function(_0x2499fd){if(_0x2499fd){return _0x2499fd[_0xa47d('0x25')]()['then'](function(){_0x3927e4[_0xa47d('0x17')](0xcc)[_0xa47d('0x18')]();});}};}function handleEntityNotFound(_0x41904f,_0xbf02a0){return function(_0x3d57d0){if(!_0x3d57d0){_0x41904f[_0xa47d('0x16')](0x194);}return _0x3d57d0;};}function handleError(_0x412ced,_0x2679e2){_0x2679e2=_0x2679e2||0x1f4;return function(_0x413c2e){logger[_0xa47d('0x26')](_0x413c2e[_0xa47d('0x27')]);if(_0x413c2e[_0xa47d('0x28')]){delete _0x413c2e[_0xa47d('0x28')];}_0x412ced['status'](_0x2679e2)[_0xa47d('0x29')](_0x413c2e);};}exports[_0xa47d('0x2a')]=function(_0x35e992,_0x38989a){var _0x299028={},_0x3cb02f={},_0xe629ad={'count':0x0,'rows':[]};var _0x1ea959=_['map'](db[_0xa47d('0x2b')][_0xa47d('0x2c')],function(_0x4f0683){return{'name':_0x4f0683['fieldName'],'type':_0x4f0683[_0xa47d('0x2d')][_0xa47d('0x2e')]};});_0x3cb02f[_0xa47d('0x2f')]=_['map'](_0x1ea959,_0xa47d('0x28'));_0x3cb02f[_0xa47d('0x30')]=_[_0xa47d('0x31')](_0x35e992[_0xa47d('0x30')]);_0x3cb02f[_0xa47d('0x32')]=_[_0xa47d('0x33')](_0x3cb02f['model'],_0x3cb02f[_0xa47d('0x30')]);_0x299028[_0xa47d('0x34')]=_[_0xa47d('0x33')](_0x3cb02f[_0xa47d('0x2f')],qs[_0xa47d('0x35')](_0x35e992['query'][_0xa47d('0x35')]));_0x299028[_0xa47d('0x34')]=_0x299028[_0xa47d('0x34')][_0xa47d('0x36')]?_0x299028['attributes']:_0x3cb02f[_0xa47d('0x2f')];if(!_0x35e992[_0xa47d('0x30')]['hasOwnProperty']('nolimit')){_0x299028[_0xa47d('0x1b')]=qs[_0xa47d('0x1b')](_0x35e992['query'][_0xa47d('0x1b')]);_0x299028[_0xa47d('0x1a')]=qs[_0xa47d('0x1a')](_0x35e992[_0xa47d('0x30')][_0xa47d('0x1a')]);}_0x299028[_0xa47d('0x37')]=qs[_0xa47d('0x38')](_0x35e992[_0xa47d('0x30')][_0xa47d('0x38')]);_0x299028['where']=qs[_0xa47d('0x32')](_[_0xa47d('0x39')](_0x35e992['query'],_0x3cb02f[_0xa47d('0x32')]),_0x1ea959);if(_0x35e992[_0xa47d('0x30')][_0xa47d('0x3a')]){_0x299028['where']=_[_0xa47d('0x3b')](_0x299028[_0xa47d('0x3c')],{'$or':_['map'](_0x1ea959,function(_0x293d47){if(_0x293d47[_0xa47d('0x2d')]!=='VIRTUAL'){var _0x584a68={};_0x584a68[_0x293d47[_0xa47d('0x28')]]={'$like':'%'+_0x35e992['query'][_0xa47d('0x3a')]+'%'};return _0x584a68;}})});}_0x299028=_[_0xa47d('0x3b')]({},_0x299028,_0x35e992[_0xa47d('0x3d')]);var _0x2a22df={'where':_0x299028[_0xa47d('0x3c')]};return db[_0xa47d('0x2b')][_0xa47d('0x1d')](_0x2a22df)[_0xa47d('0x24')](function(_0x148b24){_0xe629ad[_0xa47d('0x1d')]=_0x148b24;if(_0x35e992[_0xa47d('0x30')][_0xa47d('0x3e')]){_0x299028[_0xa47d('0x3f')]=[{'all':!![]}];}return db[_0xa47d('0x2b')][_0xa47d('0x40')](_0x299028);})['then'](function(_0x50997c){_0xe629ad[_0xa47d('0x41')]=_0x50997c;return _0xe629ad;})[_0xa47d('0x24')](respondWithFilteredResult(_0x38989a,_0x299028))[_0xa47d('0x42')](handleError(_0x38989a,null));};exports[_0xa47d('0x43')]=function(_0x2f95d0,_0x5d9216){var _0x5272d4={'raw':![],'where':{'id':_0x2f95d0[_0xa47d('0x44')]['id']}},_0xa48d23={};_0xa48d23[_0xa47d('0x2f')]=_[_0xa47d('0x31')](db[_0xa47d('0x2b')][_0xa47d('0x2c')]);_0xa48d23[_0xa47d('0x30')]=_[_0xa47d('0x31')](_0x2f95d0[_0xa47d('0x30')]);_0xa48d23['filters']=_[_0xa47d('0x33')](_0xa48d23['model'],_0xa48d23[_0xa47d('0x30')]);_0x5272d4[_0xa47d('0x34')]=_[_0xa47d('0x33')](_0xa48d23[_0xa47d('0x2f')],qs[_0xa47d('0x35')](_0x2f95d0[_0xa47d('0x30')][_0xa47d('0x35')]));_0x5272d4['attributes']=_0x5272d4['attributes']['length']?_0x5272d4[_0xa47d('0x34')]:_0xa48d23[_0xa47d('0x2f')];if(_0x2f95d0['query']['includeAll']){_0x5272d4['include']=[{'all':!![]}];}_0x5272d4=_['merge']({},_0x5272d4,_0x2f95d0[_0xa47d('0x3d')]);return db[_0xa47d('0x2b')][_0xa47d('0x45')](_0x5272d4)[_0xa47d('0x24')](handleEntityNotFound(_0x5d9216,null))[_0xa47d('0x24')](respondWithResult(_0x5d9216,null))['catch'](handleError(_0x5d9216,null));};exports[_0xa47d('0x46')]=function(_0x2e8ced,_0x28e3c5){return db[_0xa47d('0x2b')][_0xa47d('0x46')](_0x2e8ced[_0xa47d('0x47')],{})[_0xa47d('0x24')](respondWithResult(_0x28e3c5,0xc9))[_0xa47d('0x42')](handleError(_0x28e3c5,null));};exports[_0xa47d('0x23')]=function(_0x43dd62,_0x2e3214){if(_0x43dd62[_0xa47d('0x47')]['id']){delete _0x43dd62[_0xa47d('0x47')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x43dd62[_0xa47d('0x44')]['id']}})[_0xa47d('0x24')](handleEntityNotFound(_0x2e3214,null))['then'](saveUpdates(_0x43dd62[_0xa47d('0x47')],null))[_0xa47d('0x24')](respondWithResult(_0x2e3214,null))['catch'](handleError(_0x2e3214,null));};exports[_0xa47d('0x25')]=function(_0x1770c8,_0x1cb345){return db['FreshdeskConfiguration'][_0xa47d('0x45')]({'where':{'id':_0x1770c8[_0xa47d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1cb345,null))[_0xa47d('0x24')](removeEntity(_0x1cb345,null))[_0xa47d('0x42')](handleError(_0x1cb345,null));};exports['getFields']=function(_0x8c96bf,_0x31e051,_0x57675b){var _0xedc1ed={};var _0x32f803={};var _0x2008ee;var _0x2e7147;return db['FreshdeskConfiguration'][_0xa47d('0x48')]({'where':{'id':_0x8c96bf[_0xa47d('0x44')]['id']}})[_0xa47d('0x24')](handleEntityNotFound(_0x31e051,null))[_0xa47d('0x24')](function(_0x1b20fe){if(_0x1b20fe){_0x2008ee=_0x1b20fe;_0x32f803[_0xa47d('0x2f')]=_[_0xa47d('0x31')](db['FreshdeskField'][_0xa47d('0x2c')]);_0x32f803[_0xa47d('0x30')]=_[_0xa47d('0x31')](_0x8c96bf[_0xa47d('0x30')]);_0x32f803[_0xa47d('0x32')]=_['intersection'](_0x32f803[_0xa47d('0x2f')],_0x32f803[_0xa47d('0x30')]);_0xedc1ed[_0xa47d('0x34')]=_[_0xa47d('0x33')](_0x32f803[_0xa47d('0x2f')],qs[_0xa47d('0x35')](_0x8c96bf[_0xa47d('0x30')][_0xa47d('0x35')]));_0xedc1ed['attributes']=_0xedc1ed['attributes'][_0xa47d('0x36')]?_0xedc1ed['attributes']:_0x32f803[_0xa47d('0x2f')];_0xedc1ed[_0xa47d('0x37')]=qs[_0xa47d('0x38')](_0x8c96bf['query']['sort']);_0xedc1ed[_0xa47d('0x3c')]=qs['filters'](_[_0xa47d('0x39')](_0x8c96bf[_0xa47d('0x30')],_0x32f803['filters']));if(_0x8c96bf[_0xa47d('0x30')][_0xa47d('0x3a')]){_0xedc1ed[_0xa47d('0x3c')]=_[_0xa47d('0x3b')](_0xedc1ed[_0xa47d('0x3c')],{'$or':_[_0xa47d('0x49')](_0xedc1ed['attributes'],function(_0x42a080){var _0x2e07f6={};_0x2e07f6[_0x42a080]={'$like':'%'+_0x8c96bf[_0xa47d('0x30')]['filter']+'%'};return _0x2e07f6;})});}_0xedc1ed=_[_0xa47d('0x3b')]({},_0xedc1ed,_0x8c96bf['options']);return _0x2008ee[_0xa47d('0x4a')](_0xedc1ed);}})[_0xa47d('0x24')](function(_0x21a236){if(_0x21a236){_0x2e7147=_0x21a236[_0xa47d('0x36')];if(!_0x8c96bf[_0xa47d('0x30')][_0xa47d('0x4b')](_0xa47d('0x4c'))){_0xedc1ed[_0xa47d('0x1b')]=qs[_0xa47d('0x1b')](_0x8c96bf[_0xa47d('0x30')][_0xa47d('0x1b')]);_0xedc1ed[_0xa47d('0x1a')]=qs[_0xa47d('0x1a')](_0x8c96bf[_0xa47d('0x30')][_0xa47d('0x1a')]);}return _0x2008ee['getFields'](_0xedc1ed);}})[_0xa47d('0x24')](function(_0x5bd75b){if(_0x5bd75b){return _0x5bd75b?{'count':_0x2e7147,'rows':_0x5bd75b}:null;}})[_0xa47d('0x24')](respondWithResult(_0x31e051,null))[_0xa47d('0x42')](handleError(_0x31e051,null));};exports[_0xa47d('0x4d')]=function(_0x3b7420,_0x139004,_0x179985){var _0x10a2df={};var _0x5c51ba={};var _0x4654e3;var _0x313a30;return db[_0xa47d('0x2b')][_0xa47d('0x48')]({'where':{'id':_0x3b7420[_0xa47d('0x44')]['id']}})['then'](handleEntityNotFound(_0x139004,null))[_0xa47d('0x24')](function(_0x1ff88c){if(_0x1ff88c){_0x4654e3=_0x1ff88c;_0x5c51ba[_0xa47d('0x2f')]=_['keys'](db[_0xa47d('0x4e')][_0xa47d('0x2c')]);_0x5c51ba['query']=_['keys'](_0x3b7420[_0xa47d('0x30')]);_0x5c51ba[_0xa47d('0x32')]=_['intersection'](_0x5c51ba[_0xa47d('0x2f')],_0x5c51ba['query']);_0x10a2df[_0xa47d('0x34')]=_['intersection'](_0x5c51ba['model'],qs['fields'](_0x3b7420[_0xa47d('0x30')][_0xa47d('0x35')]));_0x10a2df[_0xa47d('0x34')]=_0x10a2df[_0xa47d('0x34')][_0xa47d('0x36')]?_0x10a2df[_0xa47d('0x34')]:_0x5c51ba[_0xa47d('0x2f')];_0x10a2df[_0xa47d('0x37')]=qs[_0xa47d('0x38')](_0x3b7420['query'][_0xa47d('0x38')]);_0x10a2df[_0xa47d('0x3c')]=qs[_0xa47d('0x32')](_['pick'](_0x3b7420[_0xa47d('0x30')],_0x5c51ba[_0xa47d('0x32')]));if(_0x3b7420[_0xa47d('0x30')][_0xa47d('0x3a')]){_0x10a2df[_0xa47d('0x3c')]=_[_0xa47d('0x3b')](_0x10a2df[_0xa47d('0x3c')],{'$or':_[_0xa47d('0x49')](_0x10a2df['attributes'],function(_0x2c3a5f){var _0x41e3e9={};_0x41e3e9[_0x2c3a5f]={'$like':'%'+_0x3b7420[_0xa47d('0x30')][_0xa47d('0x3a')]+'%'};return _0x41e3e9;})});}_0x10a2df=_[_0xa47d('0x3b')]({},_0x10a2df,_0x3b7420[_0xa47d('0x3d')]);return _0x4654e3[_0xa47d('0x4d')](_0x10a2df);}})[_0xa47d('0x24')](function(_0x51b0d4){if(_0x51b0d4){_0x313a30=_0x51b0d4[_0xa47d('0x36')];if(!_0x3b7420[_0xa47d('0x30')][_0xa47d('0x4b')]('nolimit')){_0x10a2df['limit']=qs[_0xa47d('0x1b')](_0x3b7420[_0xa47d('0x30')][_0xa47d('0x1b')]);_0x10a2df[_0xa47d('0x1a')]=qs[_0xa47d('0x1a')](_0x3b7420[_0xa47d('0x30')][_0xa47d('0x1a')]);}return _0x4654e3[_0xa47d('0x4d')](_0x10a2df);}})['then'](function(_0x4258f5){if(_0x4258f5){return _0x4258f5?{'count':_0x313a30,'rows':_0x4258f5}:null;}})[_0xa47d('0x24')](respondWithResult(_0x139004,null))[_0xa47d('0x42')](handleError(_0x139004,null));};exports[_0xa47d('0x4f')]=function(_0x4d6429,_0x68ca4f,_0x3f21cc){var _0x2a14fa={};var _0x4641e0={};var _0x5d2cb8;var _0x1ad74c;return db['FreshdeskConfiguration'][_0xa47d('0x48')]({'where':{'id':_0x4d6429[_0xa47d('0x44')]['id']}})[_0xa47d('0x24')](handleEntityNotFound(_0x68ca4f,null))[_0xa47d('0x24')](function(_0x2a993b){if(_0x2a993b){_0x5d2cb8=_0x2a993b;_0x4641e0['model']=_['keys'](db[_0xa47d('0x4e')][_0xa47d('0x2c')]);_0x4641e0[_0xa47d('0x30')]=_[_0xa47d('0x31')](_0x4d6429[_0xa47d('0x30')]);_0x4641e0[_0xa47d('0x32')]=_['intersection'](_0x4641e0[_0xa47d('0x2f')],_0x4641e0[_0xa47d('0x30')]);_0x2a14fa[_0xa47d('0x34')]=_[_0xa47d('0x33')](_0x4641e0[_0xa47d('0x2f')],qs[_0xa47d('0x35')](_0x4d6429['query'][_0xa47d('0x35')]));_0x2a14fa['attributes']=_0x2a14fa['attributes'][_0xa47d('0x36')]?_0x2a14fa[_0xa47d('0x34')]:_0x4641e0[_0xa47d('0x2f')];_0x2a14fa[_0xa47d('0x37')]=qs[_0xa47d('0x38')](_0x4d6429[_0xa47d('0x30')]['sort']);_0x2a14fa[_0xa47d('0x3c')]=qs[_0xa47d('0x32')](_[_0xa47d('0x39')](_0x4d6429[_0xa47d('0x30')],_0x4641e0[_0xa47d('0x32')]));if(_0x4d6429['query'][_0xa47d('0x3a')]){_0x2a14fa[_0xa47d('0x3c')]=_[_0xa47d('0x3b')](_0x2a14fa[_0xa47d('0x3c')],{'$or':_[_0xa47d('0x49')](_0x2a14fa[_0xa47d('0x34')],function(_0x4a95e8){var _0x34ef3c={};_0x34ef3c[_0x4a95e8]={'$like':'%'+_0x4d6429[_0xa47d('0x30')][_0xa47d('0x3a')]+'%'};return _0x34ef3c;})});}_0x2a14fa=_[_0xa47d('0x3b')]({},_0x2a14fa,_0x4d6429[_0xa47d('0x3d')]);return _0x5d2cb8[_0xa47d('0x4f')](_0x2a14fa);}})['then'](function(_0x40b8b9){if(_0x40b8b9){_0x1ad74c=_0x40b8b9[_0xa47d('0x36')];if(!_0x4d6429[_0xa47d('0x30')][_0xa47d('0x4b')](_0xa47d('0x4c'))){_0x2a14fa[_0xa47d('0x1b')]=qs[_0xa47d('0x1b')](_0x4d6429[_0xa47d('0x30')][_0xa47d('0x1b')]);_0x2a14fa[_0xa47d('0x1a')]=qs['offset'](_0x4d6429[_0xa47d('0x30')][_0xa47d('0x1a')]);}return _0x5d2cb8['getDescriptions'](_0x2a14fa);}})[_0xa47d('0x24')](function(_0x5b9146){if(_0x5b9146){return _0x5b9146?{'count':_0x1ad74c,'rows':_0x5b9146}:null;}})['then'](respondWithResult(_0x68ca4f,null))[_0xa47d('0x42')](handleError(_0x68ca4f,null));};exports[_0xa47d('0x50')]=function(_0x58107a,_0x34616b,_0x1b458a){var _0x26dd20={};var _0x1901c4={};var _0x3a4678;var _0x33a12a;return db['FreshdeskConfiguration'][_0xa47d('0x48')]({'where':{'id':_0x58107a[_0xa47d('0x44')]['id']}})[_0xa47d('0x24')](handleEntityNotFound(_0x34616b,null))['then'](function(_0x5d0082){if(_0x5d0082){_0x3a4678=_0x5d0082;_0x1901c4['model']=_['keys'](db['Tag'][_0xa47d('0x2c')]);_0x1901c4[_0xa47d('0x30')]=_[_0xa47d('0x31')](_0x58107a['query']);_0x1901c4[_0xa47d('0x32')]=_[_0xa47d('0x33')](_0x1901c4[_0xa47d('0x2f')],_0x1901c4[_0xa47d('0x30')]);_0x26dd20[_0xa47d('0x34')]=_['intersection'](_0x1901c4[_0xa47d('0x2f')],qs[_0xa47d('0x35')](_0x58107a[_0xa47d('0x30')][_0xa47d('0x35')]));_0x26dd20[_0xa47d('0x34')]=_0x26dd20['attributes'][_0xa47d('0x36')]?_0x26dd20[_0xa47d('0x34')]:_0x1901c4['model'];_0x26dd20[_0xa47d('0x37')]=qs[_0xa47d('0x38')](_0x58107a[_0xa47d('0x30')][_0xa47d('0x38')]);_0x26dd20['where']=qs['filters'](_[_0xa47d('0x39')](_0x58107a['query'],_0x1901c4[_0xa47d('0x32')]));if(_0x58107a['query'][_0xa47d('0x3a')]){_0x26dd20[_0xa47d('0x3c')]=_['merge'](_0x26dd20['where'],{'$or':_['map'](_0x26dd20[_0xa47d('0x34')],function(_0x155472){var _0x251fb1={};_0x251fb1[_0x155472]={'$like':'%'+_0x58107a['query']['filter']+'%'};return _0x251fb1;})});}_0x26dd20=_[_0xa47d('0x3b')]({},_0x26dd20,_0x58107a['options']);return _0x3a4678['getTags'](_0x26dd20);}})[_0xa47d('0x24')](function(_0x123eb6){if(_0x123eb6){_0x33a12a=_0x123eb6[_0xa47d('0x36')];if(!_0x58107a['query']['hasOwnProperty'](_0xa47d('0x4c'))){_0x26dd20[_0xa47d('0x1b')]=qs[_0xa47d('0x1b')](_0x58107a[_0xa47d('0x30')][_0xa47d('0x1b')]);_0x26dd20[_0xa47d('0x1a')]=qs['offset'](_0x58107a[_0xa47d('0x30')][_0xa47d('0x1a')]);}return _0x3a4678['getTags'](_0x26dd20);}})[_0xa47d('0x24')](function(_0x1c3251){if(_0x1c3251){return _0x1c3251?{'count':_0x33a12a,'rows':_0x1c3251}:null;}})[_0xa47d('0x24')](respondWithResult(_0x34616b,null))['catch'](handleError(_0x34616b,null));};exports[_0xa47d('0x51')]=function(_0x21bb7b,_0x2c4137,_0x14a75d){if(_0x21bb7b[_0xa47d('0x47')]['id']){delete _0x21bb7b[_0xa47d('0x47')]['id'];}return db[_0xa47d('0x2b')][_0xa47d('0x48')]({'where':{'id':_0x21bb7b[_0xa47d('0x44')]['id']}})[_0xa47d('0x24')](handleEntityNotFound(_0x2c4137,null))[_0xa47d('0x24')](function(_0x39e7ac){if(_0x39e7ac){return _0x39e7ac[_0xa47d('0x51')](_0x21bb7b[_0xa47d('0x47')][_0xa47d('0x52')]||[]);}return null;})['then'](respondWithResult(_0x2c4137,null))[_0xa47d('0x42')](handleError(_0x2c4137,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 212a692..eebf62e 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 _0xbc33=['define','int_freshdesk_configurations','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x149cb,_0x36290c){var _0x1b5f44=function(_0x88b61e){while(--_0x88b61e){_0x149cb['push'](_0x149cb['shift']());}};_0x1b5f44(++_0x36290c);}(_0xbc33,0x65));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3bc3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3bc3('0x1'));var BPromise=require(_0x3bc3('0x2'));var rp=require(_0x3bc3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bc3('0x4'));var config=require(_0x3bc3('0x5'));var attributes=require(_0x3bc3('0x6'));module['exports']=function(_0x3ee509,_0x5aa6e4){return _0x3ee509[_0x3bc3('0x7')]('FreshdeskConfiguration',attributes,{'tableName':_0x3bc3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42be=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0x42be,0x1ec));var _0xe42b=function(_0xe80a17,_0x346624){_0xe80a17=_0xe80a17-0x0;var _0xdad8fa=_0x42be[_0xe80a17];return _0xdad8fa;};'use strict';var _=require(_0xe42b('0x0'));var util=require(_0xe42b('0x1'));var logger=require(_0xe42b('0x2'))(_0xe42b('0x3'));var moment=require(_0xe42b('0x4'));var BPromise=require(_0xe42b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe42b('0x6'));var rimraf=require(_0xe42b('0x7'));var config=require(_0xe42b('0x8'));var attributes=require(_0xe42b('0x9'));module['exports']=function(_0x5e8286,_0xbc415d){return _0x5e8286[_0xe42b('0xa')](_0xe42b('0xb'),attributes,{'tableName':_0xe42b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 034aa46..3725ba3 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 _0x8b3b=['../../config/logger','rpc','../../config/environment','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x56f609,_0x28d976){var _0x552757=function(_0x496cfb){while(--_0x496cfb){_0x56f609['push'](_0x56f609['shift']());}};_0x552757(++_0x28d976);}(_0x8b3b,0x143));var _0xb8b3=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x8b3b[_0x14490c];return _0x2f6825;};'use strict';var _=require(_0xb8b3('0x0'));var util=require(_0xb8b3('0x1'));var moment=require(_0xb8b3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8b3('0x3'));var fs=require('fs');var Redis=require(_0xb8b3('0x4'));var db=require(_0xb8b3('0x5'))['db'];var utils=require(_0xb8b3('0x6'));var logger=require(_0xb8b3('0x7'))(_0xb8b3('0x8'));var config=require(_0xb8b3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb8b3('0xa')][_0xb8b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fb606,_0x740120,_0x4cb3b8){return new BPromise(function(_0x2ef21d,_0x573c95){return client['request'](_0x3fb606,_0x4cb3b8)[_0xb8b3('0xc')](function(_0x3525be){logger[_0xb8b3('0xd')](_0xb8b3('0xe'),_0x740120,_0xb8b3('0xf'));logger['debug'](_0xb8b3('0x10'),_0x740120,_0xb8b3('0xf'),JSON[_0xb8b3('0x11')](_0x3525be));if(_0x3525be[_0xb8b3('0x12')]){if(_0x3525be[_0xb8b3('0x12')][_0xb8b3('0x13')]===0x1f4){logger[_0xb8b3('0x12')](_0xb8b3('0xe'),_0x740120,_0x3525be['error'][_0xb8b3('0x14')]);return _0x573c95(_0x3525be[_0xb8b3('0x12')]['message']);}logger[_0xb8b3('0x12')](_0xb8b3('0xe'),_0x740120,_0x3525be['error']['message']);return _0x2ef21d(_0x3525be[_0xb8b3('0x12')][_0xb8b3('0x14')]);}else{logger['info'](_0xb8b3('0xe'),_0x740120,_0xb8b3('0xf'));_0x2ef21d(_0x3525be['result'][_0xb8b3('0x14')]);}})[_0xb8b3('0x15')](function(_0x5b8e8f){logger[_0xb8b3('0x12')](_0xb8b3('0xe'),_0x740120,_0x5b8e8f);_0x573c95(_0x5b8e8f);});});} \ No newline at end of file +var _0x7cb4=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x587a45,_0x302087){var _0x22561c=function(_0x292083){while(--_0x292083){_0x587a45['push'](_0x587a45['shift']());}};_0x22561c(++_0x302087);}(_0x7cb4,0x110));var _0x47cb=function(_0x5509e6,_0x5f249f){_0x5509e6=_0x5509e6-0x0;var _0x5520f2=_0x7cb4[_0x5509e6];return _0x5520f2;};'use strict';var _=require('lodash');var util=require(_0x47cb('0x0'));var moment=require(_0x47cb('0x1'));var BPromise=require(_0x47cb('0x2'));var rs=require(_0x47cb('0x3'));var fs=require('fs');var Redis=require(_0x47cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x47cb('0x5'));var config=require('../../config/environment');var jayson=require(_0x47cb('0x6'));var client=jayson[_0x47cb('0x7')][_0x47cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x247514,_0x2758cf,_0x36e7cb){return new BPromise(function(_0x387b1d,_0x486a5e){return client[_0x47cb('0x9')](_0x247514,_0x36e7cb)['then'](function(_0x3d4b0b){logger['info'](_0x47cb('0xa'),_0x2758cf,_0x47cb('0xb'));logger[_0x47cb('0xc')](_0x47cb('0xd'),_0x2758cf,_0x47cb('0xb'),JSON['stringify'](_0x3d4b0b));if(_0x3d4b0b[_0x47cb('0xe')]){if(_0x3d4b0b[_0x47cb('0xe')][_0x47cb('0xf')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2758cf,_0x3d4b0b[_0x47cb('0xe')][_0x47cb('0x10')]);return _0x486a5e(_0x3d4b0b[_0x47cb('0xe')][_0x47cb('0x10')]);}logger[_0x47cb('0xe')](_0x47cb('0xa'),_0x2758cf,_0x3d4b0b[_0x47cb('0xe')][_0x47cb('0x10')]);return _0x387b1d(_0x3d4b0b['error'][_0x47cb('0x10')]);}else{logger['info'](_0x47cb('0xa'),_0x2758cf,_0x47cb('0xb'));_0x387b1d(_0x3d4b0b[_0x47cb('0x11')][_0x47cb('0x10')]);}})[_0x47cb('0x12')](function(_0x194f7c){logger[_0x47cb('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2758cf,_0x194f7c);_0x486a5e(_0x194f7c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7207182..936d219 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 _0x1148=['show','create','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x429e96,_0x49fb64){var _0x12432d=function(_0x5806db){while(--_0x5806db){_0x429e96['push'](_0x429e96['shift']());}};_0x12432d(++_0x49fb64);}(_0x1148,0x94));var _0x8114=function(_0x299c4a,_0x13738f){_0x299c4a=_0x299c4a-0x0;var _0x225c00=_0x1148[_0x299c4a];return _0x225c00;};'use strict';var multer=require(_0x8114('0x0'));var util=require(_0x8114('0x1'));var path=require(_0x8114('0x2'));var timeout=require(_0x8114('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8114('0x4'));var interaction=require(_0x8114('0x5'));var config=require(_0x8114('0x6'));var controller=require(_0x8114('0x7'));router[_0x8114('0x8')]('/',auth[_0x8114('0x9')](),controller[_0x8114('0xa')]);router['get'](_0x8114('0xb'),auth['isAuthenticated'](),controller[_0x8114('0xc')]);router['post']('/',auth[_0x8114('0x9')](),controller[_0x8114('0xd')]);router['put'](_0x8114('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8114('0xe')](_0x8114('0xb'),auth[_0x8114('0x9')](),controller[_0x8114('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc7ed=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','put','update','delete'];(function(_0x57dc78,_0x1467c9){var _0x2a3b5f=function(_0x11798e){while(--_0x11798e){_0x57dc78['push'](_0x57dc78['shift']());}};_0x2a3b5f(++_0x1467c9);}(_0xc7ed,0x1eb));var _0xdc7e=function(_0x409186,_0x4b8b73){_0x409186=_0x409186-0x0;var _0x3deb43=_0xc7ed[_0x409186];return _0x3deb43;};'use strict';var multer=require(_0xdc7e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc7e('0x1'));var router=express[_0xdc7e('0x2')]();var fs_extra=require(_0xdc7e('0x3'));var auth=require(_0xdc7e('0x4'));var interaction=require(_0xdc7e('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xdc7e('0x6')]('/',auth[_0xdc7e('0x7')](),controller['index']);router[_0xdc7e('0x6')](_0xdc7e('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xdc7e('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdc7e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xdc7e('0xb')]);router[_0xdc7e('0xc')](_0xdc7e('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xdc7e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7a08c17..2eed0c5 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 _0x3dfa=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','STRING','string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dfa,0x196));var _0xa3df=function(_0x1a7ff6,_0x2022da){_0x1a7ff6=_0x1a7ff6-0x0;var _0x9445e6=_0x3dfa[_0x1a7ff6];return _0x9445e6;};'use strict';var Sequelize=require(_0xa3df('0x0'));module[_0xa3df('0x1')]={'type':{'type':Sequelize[_0xa3df('0x2')]('string',_0xa3df('0x3'),_0xa3df('0x4'),_0xa3df('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa3df('0x6')]},'keyType':{'type':Sequelize[_0xa3df('0x2')](_0xa3df('0x7'),_0xa3df('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa3df('0x6')]},'nameField':{'type':Sequelize[_0xa3df('0x6')]},'customField':{'type':Sequelize[_0xa3df('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa3df('0x6')]}}; \ No newline at end of file +var _0xed26=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x8382bc,_0x18d05b){var _0x27daef=function(_0x42afac){while(--_0x42afac){_0x8382bc['push'](_0x8382bc['shift']());}};_0x27daef(++_0x18d05b);}(_0xed26,0x164));var _0x6ed2=function(_0xf1f6ef,_0x581cd9){_0xf1f6ef=_0xf1f6ef-0x0;var _0x691438=_0xed26[_0xf1f6ef];return _0x691438;};'use strict';var Sequelize=require(_0x6ed2('0x0'));module[_0x6ed2('0x1')]={'type':{'type':Sequelize[_0x6ed2('0x2')](_0x6ed2('0x3'),_0x6ed2('0x4'),_0x6ed2('0x5'),_0x6ed2('0x6'),_0x6ed2('0x7')),'defaultValue':_0x6ed2('0x3')},'content':{'type':Sequelize[_0x6ed2('0x8')]},'key':{'type':Sequelize[_0x6ed2('0x8')]},'keyType':{'type':Sequelize[_0x6ed2('0x2')](_0x6ed2('0x3'),_0x6ed2('0x4'),_0x6ed2('0x5'))},'keyContent':{'type':Sequelize[_0x6ed2('0x8')]},'idField':{'type':Sequelize[_0x6ed2('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6ed2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1f2685b..fcaf1ed 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 _0xcecc=['end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','options','count','FreshdeskField','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x194580,_0x983552){var _0x2f2b6a=function(_0x5879c0){while(--_0x5879c0){_0x194580['push'](_0x194580['shift']());}};_0x2f2b6a(++_0x983552);}(_0xcecc,0x186));var _0xccec=function(_0x1a84dc,_0x380717){_0x1a84dc=_0x1a84dc-0x0;var _0xd14bc=_0xcecc[_0x1a84dc];return _0xd14bc;};'use strict';var emlformat=require(_0xccec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xccec('0x2'));var BPromise=require(_0xccec('0x3'));var Mustache=require(_0xccec('0x4'));var util=require(_0xccec('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xccec('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccec('0x7'));var _=require(_0xccec('0x8'));var squel=require(_0xccec('0x9'));var crypto=require('crypto');var jsforce=require(_0xccec('0xa'));var deskjs=require(_0xccec('0xb'));var toCsv=require('to-csv');var querystring=require(_0xccec('0xc'));var Papa=require(_0xccec('0xd'));var Redis=require(_0xccec('0xe'));var authService=require(_0xccec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccec('0x11'))(_0xccec('0x12'));var utils=require('../../config/utils');var config=require(_0xccec('0x13'));var licenseUtil=require(_0xccec('0x14'));var db=require(_0xccec('0x15'))['db'];function respondWithStatusCode(_0x5ad07a,_0x349054){_0x349054=_0x349054||0xcc;return function(_0x2ac888){if(_0x2ac888){return _0x5ad07a[_0xccec('0x16')](_0x349054);}return _0x5ad07a[_0xccec('0x17')](_0x349054)[_0xccec('0x18')]();};}function respondWithResult(_0x4b4c3d,_0x2882d9){_0x2882d9=_0x2882d9||0xc8;return function(_0x566a81){if(_0x566a81){return _0x4b4c3d['status'](_0x2882d9)['json'](_0x566a81);}};}function respondWithFilteredResult(_0x8ff6a6,_0x3482d4){return function(_0x18e7d0){if(_0x18e7d0){var _0x69a776=typeof _0x3482d4[_0xccec('0x19')]===_0xccec('0x1a')&&typeof _0x3482d4[_0xccec('0x1b')]===_0xccec('0x1a');var _0x199e52=_0x18e7d0['count'];var _0x518016=_0x69a776?0x0:_0x3482d4['offset'];var _0x970c66=_0x69a776?_0x18e7d0['count']:_0x3482d4[_0xccec('0x19')]+_0x3482d4[_0xccec('0x1b')];var _0x88741b;if(_0x970c66>=_0x199e52){_0x970c66=_0x199e52;_0x88741b=0xc8;}else{_0x88741b=0xce;}_0x8ff6a6['status'](_0x88741b);return _0x8ff6a6[_0xccec('0x1c')](_0xccec('0x1d'),_0x518016+'-'+_0x970c66+'/'+_0x199e52)[_0xccec('0x1e')](_0x18e7d0);}return null;};}function patchUpdates(_0x4a7f08){return function(_0x2fedff){try{jsonpatch[_0xccec('0x1f')](_0x2fedff,_0x4a7f08,!![]);}catch(_0x2163e7){return BPromise['reject'](_0x2163e7);}return _0x2fedff[_0xccec('0x20')]();};}function saveUpdates(_0x57c27c,_0x9065a3){return function(_0x4b2666){if(_0x4b2666){return _0x4b2666[_0xccec('0x21')](_0x57c27c)[_0xccec('0x22')](function(_0x312da0){return _0x312da0;});}return null;};}function removeEntity(_0x50794d,_0x3d83e1){return function(_0x6be7ac){if(_0x6be7ac){return _0x6be7ac[_0xccec('0x23')]()[_0xccec('0x22')](function(){_0x50794d[_0xccec('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44bc44,_0xb0b0da){return function(_0x2d8fa0){if(!_0x2d8fa0){_0x44bc44[_0xccec('0x16')](0x194);}return _0x2d8fa0;};}function handleError(_0x4c8dbe,_0x27b541){_0x27b541=_0x27b541||0x1f4;return function(_0x52ddd7){logger['error'](_0x52ddd7['stack']);if(_0x52ddd7[_0xccec('0x24')]){delete _0x52ddd7[_0xccec('0x24')];}_0x4c8dbe[_0xccec('0x17')](_0x27b541)[_0xccec('0x25')](_0x52ddd7);};}exports[_0xccec('0x26')]=function(_0x3e8557,_0x3ca9c7){var _0x59bb66={},_0x11085d={},_0x5ee7c1={'count':0x0,'rows':[]};var _0x23e324=_[_0xccec('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x1e93e3){return{'name':_0x1e93e3[_0xccec('0x28')],'type':_0x1e93e3['type'][_0xccec('0x29')]};});_0x11085d[_0xccec('0x2a')]=_[_0xccec('0x27')](_0x23e324,_0xccec('0x24'));_0x11085d['query']=_[_0xccec('0x2b')](_0x3e8557[_0xccec('0x2c')]);_0x11085d[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x11085d[_0xccec('0x2a')],_0x11085d[_0xccec('0x2c')]);_0x59bb66[_0xccec('0x2f')]=_[_0xccec('0x2e')](_0x11085d['model'],qs[_0xccec('0x30')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x30')]));_0x59bb66['attributes']=_0x59bb66['attributes'][_0xccec('0x31')]?_0x59bb66[_0xccec('0x2f')]:_0x11085d[_0xccec('0x2a')];if(!_0x3e8557[_0xccec('0x2c')]['hasOwnProperty'](_0xccec('0x32'))){_0x59bb66['limit']=qs['limit'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x1b')]);_0x59bb66[_0xccec('0x19')]=qs[_0xccec('0x19')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x19')]);}_0x59bb66['order']=qs['sort'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x33')]);_0x59bb66[_0xccec('0x34')]=qs[_0xccec('0x2d')](_['pick'](_0x3e8557[_0xccec('0x2c')],_0x11085d['filters']),_0x23e324);if(_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]){_0x59bb66[_0xccec('0x34')]=_[_0xccec('0x36')](_0x59bb66[_0xccec('0x34')],{'$or':_['map'](_0x23e324,function(_0x2a3a54){if(_0x2a3a54[_0xccec('0x37')]!=='VIRTUAL'){var _0x3ce4ee={};_0x3ce4ee[_0x2a3a54[_0xccec('0x24')]]={'$like':'%'+_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]+'%'};return _0x3ce4ee;}})});}_0x59bb66=_['merge']({},_0x59bb66,_0x3e8557[_0xccec('0x38')]);var _0x1526ca={'where':_0x59bb66[_0xccec('0x34')]};return db['FreshdeskField'][_0xccec('0x39')](_0x1526ca)['then'](function(_0x256e9b){_0x5ee7c1[_0xccec('0x39')]=_0x256e9b;if(_0x3e8557[_0xccec('0x2c')]['includeAll']){_0x59bb66['include']=[{'all':!![]}];}return db[_0xccec('0x3a')][_0xccec('0x3b')](_0x59bb66);})[_0xccec('0x22')](function(_0x4c0184){_0x5ee7c1[_0xccec('0x3c')]=_0x4c0184;return _0x5ee7c1;})[_0xccec('0x22')](respondWithFilteredResult(_0x3ca9c7,_0x59bb66))[_0xccec('0x3d')](handleError(_0x3ca9c7,null));};exports['show']=function(_0x720b56,_0x3b0472){var _0x262e25={'raw':!![],'where':{'id':_0x720b56['params']['id']}},_0x1dfd34={};_0x1dfd34['model']=_[_0xccec('0x2b')](db[_0xccec('0x3a')][_0xccec('0x3e')]);_0x1dfd34['query']=_[_0xccec('0x2b')](_0x720b56[_0xccec('0x2c')]);_0x1dfd34[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],_0x1dfd34[_0xccec('0x2c')]);_0x262e25['attributes']=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],qs[_0xccec('0x30')](_0x720b56[_0xccec('0x2c')][_0xccec('0x30')]));_0x262e25[_0xccec('0x2f')]=_0x262e25[_0xccec('0x2f')][_0xccec('0x31')]?_0x262e25['attributes']:_0x1dfd34[_0xccec('0x2a')];if(_0x720b56[_0xccec('0x2c')][_0xccec('0x3f')]){_0x262e25[_0xccec('0x40')]=[{'all':!![]}];}_0x262e25=_['merge']({},_0x262e25,_0x720b56[_0xccec('0x38')]);return db[_0xccec('0x3a')][_0xccec('0x41')](_0x262e25)['then'](handleEntityNotFound(_0x3b0472,null))[_0xccec('0x22')](respondWithResult(_0x3b0472,null))['catch'](handleError(_0x3b0472,null));};exports[_0xccec('0x42')]=function(_0xa6ef39,_0x1f6de7){return db['FreshdeskField'][_0xccec('0x42')](_0xa6ef39[_0xccec('0x43')],{})[_0xccec('0x22')](respondWithResult(_0x1f6de7,0xc9))['catch'](handleError(_0x1f6de7,null));};exports[_0xccec('0x21')]=function(_0x28064b,_0x25c627){if(_0x28064b[_0xccec('0x43')]['id']){delete _0x28064b[_0xccec('0x43')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x28064b['params']['id']}})[_0xccec('0x22')](handleEntityNotFound(_0x25c627,null))[_0xccec('0x22')](saveUpdates(_0x28064b[_0xccec('0x43')],null))[_0xccec('0x22')](respondWithResult(_0x25c627,null))[_0xccec('0x3d')](handleError(_0x25c627,null));};exports[_0xccec('0x23')]=function(_0x5b4826,_0x1ddc01){return db['FreshdeskField'][_0xccec('0x41')]({'where':{'id':_0x5b4826[_0xccec('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ddc01,null))[_0xccec('0x22')](removeEntity(_0x1ddc01,null))[_0xccec('0x3d')](handleError(_0x1ddc01,null));}; \ No newline at end of file +var _0xcecc=['end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','options','count','FreshdeskField','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x12ce08,_0x16c193){var _0x1f11d9=function(_0x23cab1){while(--_0x23cab1){_0x12ce08['push'](_0x12ce08['shift']());}};_0x1f11d9(++_0x16c193);}(_0xcecc,0x186));var _0xccec=function(_0x3d9287,_0x5a78c0){_0x3d9287=_0x3d9287-0x0;var _0x2003af=_0xcecc[_0x3d9287];return _0x2003af;};'use strict';var emlformat=require(_0xccec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xccec('0x2'));var BPromise=require(_0xccec('0x3'));var Mustache=require(_0xccec('0x4'));var util=require(_0xccec('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xccec('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccec('0x7'));var _=require(_0xccec('0x8'));var squel=require(_0xccec('0x9'));var crypto=require('crypto');var jsforce=require(_0xccec('0xa'));var deskjs=require(_0xccec('0xb'));var toCsv=require('to-csv');var querystring=require(_0xccec('0xc'));var Papa=require(_0xccec('0xd'));var Redis=require(_0xccec('0xe'));var authService=require(_0xccec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccec('0x11'))(_0xccec('0x12'));var utils=require('../../config/utils');var config=require(_0xccec('0x13'));var licenseUtil=require(_0xccec('0x14'));var db=require(_0xccec('0x15'))['db'];function respondWithStatusCode(_0x5ad07a,_0x349054){_0x349054=_0x349054||0xcc;return function(_0x2ac888){if(_0x2ac888){return _0x5ad07a[_0xccec('0x16')](_0x349054);}return _0x5ad07a[_0xccec('0x17')](_0x349054)[_0xccec('0x18')]();};}function respondWithResult(_0x4b4c3d,_0x2882d9){_0x2882d9=_0x2882d9||0xc8;return function(_0x566a81){if(_0x566a81){return _0x4b4c3d['status'](_0x2882d9)['json'](_0x566a81);}};}function respondWithFilteredResult(_0x8ff6a6,_0x3482d4){return function(_0x18e7d0){if(_0x18e7d0){var _0x69a776=typeof _0x3482d4[_0xccec('0x19')]===_0xccec('0x1a')&&typeof _0x3482d4[_0xccec('0x1b')]===_0xccec('0x1a');var _0x199e52=_0x18e7d0['count'];var _0x518016=_0x69a776?0x0:_0x3482d4['offset'];var _0x970c66=_0x69a776?_0x18e7d0['count']:_0x3482d4[_0xccec('0x19')]+_0x3482d4[_0xccec('0x1b')];var _0x88741b;if(_0x970c66>=_0x199e52){_0x970c66=_0x199e52;_0x88741b=0xc8;}else{_0x88741b=0xce;}_0x8ff6a6['status'](_0x88741b);return _0x8ff6a6[_0xccec('0x1c')](_0xccec('0x1d'),_0x518016+'-'+_0x970c66+'/'+_0x199e52)[_0xccec('0x1e')](_0x18e7d0);}return null;};}function patchUpdates(_0x4a7f08){return function(_0x2fedff){try{jsonpatch[_0xccec('0x1f')](_0x2fedff,_0x4a7f08,!![]);}catch(_0x2163e7){return BPromise['reject'](_0x2163e7);}return _0x2fedff[_0xccec('0x20')]();};}function saveUpdates(_0x57c27c,_0x9065a3){return function(_0x4b2666){if(_0x4b2666){return _0x4b2666[_0xccec('0x21')](_0x57c27c)[_0xccec('0x22')](function(_0x312da0){return _0x312da0;});}return null;};}function removeEntity(_0x50794d,_0x3d83e1){return function(_0x6be7ac){if(_0x6be7ac){return _0x6be7ac[_0xccec('0x23')]()[_0xccec('0x22')](function(){_0x50794d[_0xccec('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44bc44,_0xb0b0da){return function(_0x2d8fa0){if(!_0x2d8fa0){_0x44bc44[_0xccec('0x16')](0x194);}return _0x2d8fa0;};}function handleError(_0x4c8dbe,_0x27b541){_0x27b541=_0x27b541||0x1f4;return function(_0x52ddd7){logger['error'](_0x52ddd7['stack']);if(_0x52ddd7[_0xccec('0x24')]){delete _0x52ddd7[_0xccec('0x24')];}_0x4c8dbe[_0xccec('0x17')](_0x27b541)[_0xccec('0x25')](_0x52ddd7);};}exports[_0xccec('0x26')]=function(_0x3e8557,_0x3ca9c7){var _0x59bb66={},_0x11085d={},_0x5ee7c1={'count':0x0,'rows':[]};var _0x23e324=_[_0xccec('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x1e93e3){return{'name':_0x1e93e3[_0xccec('0x28')],'type':_0x1e93e3['type'][_0xccec('0x29')]};});_0x11085d[_0xccec('0x2a')]=_[_0xccec('0x27')](_0x23e324,_0xccec('0x24'));_0x11085d['query']=_[_0xccec('0x2b')](_0x3e8557[_0xccec('0x2c')]);_0x11085d[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x11085d[_0xccec('0x2a')],_0x11085d[_0xccec('0x2c')]);_0x59bb66[_0xccec('0x2f')]=_[_0xccec('0x2e')](_0x11085d['model'],qs[_0xccec('0x30')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x30')]));_0x59bb66['attributes']=_0x59bb66['attributes'][_0xccec('0x31')]?_0x59bb66[_0xccec('0x2f')]:_0x11085d[_0xccec('0x2a')];if(!_0x3e8557[_0xccec('0x2c')]['hasOwnProperty'](_0xccec('0x32'))){_0x59bb66['limit']=qs['limit'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x1b')]);_0x59bb66[_0xccec('0x19')]=qs[_0xccec('0x19')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x19')]);}_0x59bb66['order']=qs['sort'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x33')]);_0x59bb66[_0xccec('0x34')]=qs[_0xccec('0x2d')](_['pick'](_0x3e8557[_0xccec('0x2c')],_0x11085d['filters']),_0x23e324);if(_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]){_0x59bb66[_0xccec('0x34')]=_[_0xccec('0x36')](_0x59bb66[_0xccec('0x34')],{'$or':_['map'](_0x23e324,function(_0x2a3a54){if(_0x2a3a54[_0xccec('0x37')]!=='VIRTUAL'){var _0x3ce4ee={};_0x3ce4ee[_0x2a3a54[_0xccec('0x24')]]={'$like':'%'+_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]+'%'};return _0x3ce4ee;}})});}_0x59bb66=_['merge']({},_0x59bb66,_0x3e8557[_0xccec('0x38')]);var _0x1526ca={'where':_0x59bb66[_0xccec('0x34')]};return db['FreshdeskField'][_0xccec('0x39')](_0x1526ca)['then'](function(_0x256e9b){_0x5ee7c1[_0xccec('0x39')]=_0x256e9b;if(_0x3e8557[_0xccec('0x2c')]['includeAll']){_0x59bb66['include']=[{'all':!![]}];}return db[_0xccec('0x3a')][_0xccec('0x3b')](_0x59bb66);})[_0xccec('0x22')](function(_0x4c0184){_0x5ee7c1[_0xccec('0x3c')]=_0x4c0184;return _0x5ee7c1;})[_0xccec('0x22')](respondWithFilteredResult(_0x3ca9c7,_0x59bb66))[_0xccec('0x3d')](handleError(_0x3ca9c7,null));};exports['show']=function(_0x720b56,_0x3b0472){var _0x262e25={'raw':!![],'where':{'id':_0x720b56['params']['id']}},_0x1dfd34={};_0x1dfd34['model']=_[_0xccec('0x2b')](db[_0xccec('0x3a')][_0xccec('0x3e')]);_0x1dfd34['query']=_[_0xccec('0x2b')](_0x720b56[_0xccec('0x2c')]);_0x1dfd34[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],_0x1dfd34[_0xccec('0x2c')]);_0x262e25['attributes']=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],qs[_0xccec('0x30')](_0x720b56[_0xccec('0x2c')][_0xccec('0x30')]));_0x262e25[_0xccec('0x2f')]=_0x262e25[_0xccec('0x2f')][_0xccec('0x31')]?_0x262e25['attributes']:_0x1dfd34[_0xccec('0x2a')];if(_0x720b56[_0xccec('0x2c')][_0xccec('0x3f')]){_0x262e25[_0xccec('0x40')]=[{'all':!![]}];}_0x262e25=_['merge']({},_0x262e25,_0x720b56[_0xccec('0x38')]);return db[_0xccec('0x3a')][_0xccec('0x41')](_0x262e25)['then'](handleEntityNotFound(_0x3b0472,null))[_0xccec('0x22')](respondWithResult(_0x3b0472,null))['catch'](handleError(_0x3b0472,null));};exports[_0xccec('0x42')]=function(_0xa6ef39,_0x1f6de7){return db['FreshdeskField'][_0xccec('0x42')](_0xa6ef39[_0xccec('0x43')],{})[_0xccec('0x22')](respondWithResult(_0x1f6de7,0xc9))['catch'](handleError(_0x1f6de7,null));};exports[_0xccec('0x21')]=function(_0x28064b,_0x25c627){if(_0x28064b[_0xccec('0x43')]['id']){delete _0x28064b[_0xccec('0x43')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x28064b['params']['id']}})[_0xccec('0x22')](handleEntityNotFound(_0x25c627,null))[_0xccec('0x22')](saveUpdates(_0x28064b[_0xccec('0x43')],null))[_0xccec('0x22')](respondWithResult(_0x25c627,null))[_0xccec('0x3d')](handleError(_0x25c627,null));};exports[_0xccec('0x23')]=function(_0x5b4826,_0x1ddc01){return db['FreshdeskField'][_0xccec('0x41')]({'where':{'id':_0x5b4826[_0xccec('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ddc01,null))[_0xccec('0x22')](removeEntity(_0x1ddc01,null))[_0xccec('0x3d')](handleError(_0x1ddc01,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 8d50943..c2d52dc 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 _0xecb2=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x334928,_0x5a8621){var _0x454a8e=function(_0x248bb5){while(--_0x248bb5){_0x334928['push'](_0x334928['shift']());}};_0x454a8e(++_0x5a8621);}(_0xecb2,0x112));var _0x2ecb=function(_0x29faf9,_0x295c34){_0x29faf9=_0x29faf9-0x0;var _0x4b3db5=_0xecb2[_0x29faf9];return _0x4b3db5;};'use strict';var _=require(_0x2ecb('0x0'));var util=require(_0x2ecb('0x1'));var logger=require(_0x2ecb('0x2'))('api');var moment=require(_0x2ecb('0x3'));var BPromise=require(_0x2ecb('0x4'));var rp=require(_0x2ecb('0x5'));var fs=require('fs');var path=require(_0x2ecb('0x6'));var rimraf=require(_0x2ecb('0x7'));var config=require(_0x2ecb('0x8'));var attributes=require(_0x2ecb('0x9'));module[_0x2ecb('0xa')]=function(_0x414871,_0x9e6340){return _0x414871['define'](_0x2ecb('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2ecb('0xc'),'fields':[_0x2ecb('0xd'),_0x2ecb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1b6=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x357a2a,_0x4f5327){var _0x3d1979=function(_0x38859){while(--_0x38859){_0x357a2a['push'](_0x357a2a['shift']());}};_0x3d1979(++_0x4f5327);}(_0xe1b6,0x14f));var _0x6e1b=function(_0x5ebe0d,_0x17aae2){_0x5ebe0d=_0x5ebe0d-0x0;var _0x27c9fc=_0xe1b6[_0x5ebe0d];return _0x27c9fc;};'use strict';var _=require(_0x6e1b('0x0'));var util=require('util');var logger=require(_0x6e1b('0x1'))(_0x6e1b('0x2'));var moment=require(_0x6e1b('0x3'));var BPromise=require(_0x6e1b('0x4'));var rp=require(_0x6e1b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6e1b('0x6'));var attributes=require(_0x6e1b('0x7'));module[_0x6e1b('0x8')]=function(_0x30c5b9,_0x46cc06){return _0x30c5b9['define'](_0x6e1b('0x9'),attributes,{'tableName':_0x6e1b('0xa'),'paranoid':![],'indexes':[{'name':_0x6e1b('0xb'),'fields':[_0x6e1b('0xc'),_0x6e1b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 360c2e1..227f2c6 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 _0x4b56=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x547f6f,_0x228dd9){var _0xe7b496=function(_0x18e4eb){while(--_0x18e4eb){_0x547f6f['push'](_0x547f6f['shift']());}};_0xe7b496(++_0x228dd9);}(_0x4b56,0x186));var _0x64b5=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x4b56[_0x2b4448];return _0xb4b465;};'use strict';var _=require(_0x64b5('0x0'));var util=require(_0x64b5('0x1'));var moment=require(_0x64b5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64b5('0x3'));var db=require(_0x64b5('0x4'))['db'];var utils=require(_0x64b5('0x5'));var logger=require('../../config/logger')(_0x64b5('0x6'));var config=require(_0x64b5('0x7'));var jayson=require(_0x64b5('0x8'));var client=jayson['client'][_0x64b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x386d40,_0x5dd7a3,_0x287436){return new BPromise(function(_0xe88ede,_0x463830){return client['request'](_0x386d40,_0x287436)['then'](function(_0xa1b2a7){logger[_0x64b5('0xa')](_0x64b5('0xb'),_0x5dd7a3,_0x64b5('0xc'));logger[_0x64b5('0xd')](_0x64b5('0xe'),_0x5dd7a3,'request\x20sent',JSON['stringify'](_0xa1b2a7));if(_0xa1b2a7[_0x64b5('0xf')]){if(_0xa1b2a7[_0x64b5('0xf')][_0x64b5('0x10')]===0x1f4){logger[_0x64b5('0xf')](_0x64b5('0xb'),_0x5dd7a3,_0xa1b2a7['error'][_0x64b5('0x11')]);return _0x463830(_0xa1b2a7[_0x64b5('0xf')][_0x64b5('0x11')]);}logger[_0x64b5('0xf')](_0x64b5('0xb'),_0x5dd7a3,_0xa1b2a7[_0x64b5('0xf')][_0x64b5('0x11')]);return _0xe88ede(_0xa1b2a7[_0x64b5('0xf')][_0x64b5('0x11')]);}else{logger[_0x64b5('0xa')](_0x64b5('0xb'),_0x5dd7a3,'request\x20sent');_0xe88ede(_0xa1b2a7[_0x64b5('0x12')][_0x64b5('0x11')]);}})[_0x64b5('0x13')](function(_0x247834){logger[_0x64b5('0xf')](_0x64b5('0xb'),_0x5dd7a3,_0x247834);_0x463830(_0x247834);});});} \ No newline at end of file +var _0xb91b=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x4e4ee4,_0x349d7f){var _0x54dde7=function(_0x543ce3){while(--_0x543ce3){_0x4e4ee4['push'](_0x4e4ee4['shift']());}};_0x54dde7(++_0x349d7f);}(_0xb91b,0xf9));var _0xbb91=function(_0x103bf5,_0x2108ae){_0x103bf5=_0x103bf5-0x0;var _0x23eb3b=_0xb91b[_0x103bf5];return _0x23eb3b;};'use strict';var _=require(_0xbb91('0x0'));var util=require(_0xbb91('0x1'));var moment=require(_0xbb91('0x2'));var BPromise=require(_0xbb91('0x3'));var rs=require(_0xbb91('0x4'));var fs=require('fs');var Redis=require(_0xbb91('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb91('0x6'));var logger=require(_0xbb91('0x7'))('rpc');var config=require(_0xbb91('0x8'));var jayson=require(_0xbb91('0x9'));var client=jayson[_0xbb91('0xa')][_0xbb91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a27b,_0x4314a2,_0x311e4f){return new BPromise(function(_0x4dd8a5,_0x22dc89){return client['request'](_0x2a27b,_0x311e4f)[_0xbb91('0xc')](function(_0x241458){logger[_0xbb91('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x4314a2,_0xbb91('0xe'));logger[_0xbb91('0xf')](_0xbb91('0x10'),_0x4314a2,'request\x20sent',JSON[_0xbb91('0x11')](_0x241458));if(_0x241458[_0xbb91('0x12')]){if(_0x241458[_0xbb91('0x12')][_0xbb91('0x13')]===0x1f4){logger[_0xbb91('0x12')](_0xbb91('0x14'),_0x4314a2,_0x241458['error'][_0xbb91('0x15')]);return _0x22dc89(_0x241458[_0xbb91('0x12')][_0xbb91('0x15')]);}logger[_0xbb91('0x12')](_0xbb91('0x14'),_0x4314a2,_0x241458[_0xbb91('0x12')][_0xbb91('0x15')]);return _0x4dd8a5(_0x241458[_0xbb91('0x12')][_0xbb91('0x15')]);}else{logger[_0xbb91('0xd')](_0xbb91('0x14'),_0x4314a2,_0xbb91('0xe'));_0x4dd8a5(_0x241458['result']['message']);}})[_0xbb91('0x16')](function(_0x12c988){logger['error'](_0xbb91('0x14'),_0x4314a2,_0x12c988);_0x22dc89(_0x12c988);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index deab086..4259572 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 _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x591f3d,_0x1c621a){var _0x22c372=function(_0xc34171){while(--_0xc34171){_0x591f3d['push'](_0x591f3d['shift']());}};_0x22c372(++_0x1c621a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x1ab936,_0x397ec6){_0x1ab936=_0x1ab936-0x0;var _0x5b8f76=_0x2e54[_0x1ab936];return _0x5b8f76;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file +var _0xd87e=['post','create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields'];(function(_0x789678,_0x475d97){var _0x57f47c=function(_0x2c990d){while(--_0x2c990d){_0x789678['push'](_0x789678['shift']());}};_0x57f47c(++_0x475d97);}(_0xd87e,0x1bf));var _0xed87=function(_0x16169b,_0x1fe209){_0x16169b=_0x16169b-0x0;var _0x7a7d78=_0xd87e[_0x16169b];return _0x7a7d78;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);router[_0xed87('0xb')](_0xed87('0xd'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')]('/',auth['isAuthenticated'](),controller[_0xed87('0x10')]);router[_0xed87('0xf')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0x11')]);router['put']('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0x12')]);router[_0xed87('0x13')](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 675df46..d0fe765 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 _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfef3,0x118));var _0x3fef=function(_0x21e38c,_0x5cd897){_0x21e38c=_0x21e38c-0x0;var _0x2ba423=_0xfef3[_0x21e38c];return _0x2ba423;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x6a6c47,_0x1c13f1){var _0x237a7b=function(_0x320b65){while(--_0x320b65){_0x6a6c47['push'](_0x6a6c47['shift']());}};_0x237a7b(++_0x1c13f1);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4ff2db,_0x4b7980){_0x4ff2db=_0x4ff2db-0x0;var _0x4324ff=_0x02ce[_0x4ff2db];return _0x4324ff;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('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 399f5af..1586deb 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 _0x2b95=['Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x167117,_0x2dee70){var _0x387b70=function(_0x58f7e0){while(--_0x58f7e0){_0x167117['push'](_0x167117['shift']());}};_0x387b70(++_0x2dee70);}(_0x2b95,0xa9));var _0x52b9=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x2b95[_0x2b737c];return _0x466ed5;};'use strict';var emlformat=require(_0x52b9('0x0'));var rimraf=require(_0x52b9('0x1'));var zipdir=require(_0x52b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52b9('0x3'));var moment=require('moment');var BPromise=require(_0x52b9('0x4'));var Mustache=require(_0x52b9('0x5'));var util=require(_0x52b9('0x6'));var path=require('path');var sox=require(_0x52b9('0x7'));var csv=require(_0x52b9('0x8'));var ejs=require(_0x52b9('0x9'));var fs=require('fs');var fs_extra=require(_0x52b9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x52b9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x52b9('0xc'));var toCsv=require(_0x52b9('0x8'));var querystring=require(_0x52b9('0xd'));var Papa=require(_0x52b9('0xe'));var Redis=require(_0x52b9('0xf'));var authService=require(_0x52b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x52b9('0x11'));var hardwareService=require(_0x52b9('0x12'));var logger=require(_0x52b9('0x13'))('api');var utils=require(_0x52b9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x52b9('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x52b9('0x16'));function respondWithStatusCode(_0x345763,_0xb8934a){_0xb8934a=_0xb8934a||0xcc;return function(_0x35cd49){if(_0x35cd49){return _0x345763[_0x52b9('0x17')](_0xb8934a);}return _0x345763[_0x52b9('0x18')](_0xb8934a)[_0x52b9('0x19')]();};}function respondWithResult(_0x26659d,_0xa7a39d){_0xa7a39d=_0xa7a39d||0xc8;return function(_0x38b975){if(_0x38b975){return _0x26659d['status'](_0xa7a39d)['json'](_0x38b975);}};}function respondWithFilteredResult(_0x325323,_0x1f64e1){return function(_0x27fde2){if(_0x27fde2){var _0x36f683=typeof _0x1f64e1[_0x52b9('0x1a')]===_0x52b9('0x1b')&&typeof _0x1f64e1[_0x52b9('0x1c')]===_0x52b9('0x1b');var _0x3fa0f2=_0x27fde2[_0x52b9('0x1d')];var _0x5c8d22=_0x36f683?0x0:_0x1f64e1['offset'];var _0x42c66b=_0x36f683?_0x27fde2[_0x52b9('0x1d')]:_0x1f64e1[_0x52b9('0x1a')]+_0x1f64e1[_0x52b9('0x1c')];var _0x28af60;if(_0x42c66b>=_0x3fa0f2){_0x42c66b=_0x3fa0f2;_0x28af60=0xc8;}else{_0x28af60=0xce;}_0x325323[_0x52b9('0x18')](_0x28af60);return _0x325323[_0x52b9('0x1e')](_0x52b9('0x1f'),_0x5c8d22+'-'+_0x42c66b+'/'+_0x3fa0f2)[_0x52b9('0x20')](_0x27fde2);}return null;};}function patchUpdates(_0x337f5e){return function(_0x4601b6){try{jsonpatch[_0x52b9('0x21')](_0x4601b6,_0x337f5e,!![]);}catch(_0x47658a){return BPromise[_0x52b9('0x22')](_0x47658a);}return _0x4601b6[_0x52b9('0x23')]();};}function saveUpdates(_0x1f5438,_0x3c5d16){return function(_0x1daeb8){if(_0x1daeb8){return _0x1daeb8[_0x52b9('0x24')](_0x1f5438)[_0x52b9('0x25')](function(_0x2110b3){return _0x2110b3;});}return null;};}function removeEntity(_0x4678d9,_0x10d56a){return function(_0x226cdd){if(_0x226cdd){return _0x226cdd[_0x52b9('0x26')]()['then'](function(){_0x4678d9['status'](0xcc)[_0x52b9('0x19')]();});}};}function handleEntityNotFound(_0x511730,_0x57c9cf){return function(_0x3e73e3){if(!_0x3e73e3){_0x511730[_0x52b9('0x17')](0x194);}return _0x3e73e3;};}function handleError(_0x540b93,_0x1b4e90){_0x1b4e90=_0x1b4e90||0x1f4;return function(_0x3d6731){logger[_0x52b9('0x27')](_0x3d6731[_0x52b9('0x28')]);if(_0x3d6731[_0x52b9('0x29')]){delete _0x3d6731[_0x52b9('0x29')];}_0x540b93[_0x52b9('0x18')](_0x1b4e90)['send'](_0x3d6731);};}exports[_0x52b9('0x2a')]=function(_0x186020,_0x2fe13b){var _0x837b38={},_0x244b6f={},_0x53ea3f={'count':0x0,'rows':[]};var _0x4f7d7c=_[_0x52b9('0x2b')](db[_0x52b9('0x2c')][_0x52b9('0x2d')],function(_0x26beb6){return{'name':_0x26beb6[_0x52b9('0x2e')],'type':_0x26beb6[_0x52b9('0x2f')]['key']};});_0x244b6f[_0x52b9('0x30')]=_[_0x52b9('0x2b')](_0x4f7d7c,_0x52b9('0x29'));_0x244b6f['query']=_[_0x52b9('0x31')](_0x186020[_0x52b9('0x32')]);_0x244b6f[_0x52b9('0x33')]=_[_0x52b9('0x34')](_0x244b6f[_0x52b9('0x30')],_0x244b6f[_0x52b9('0x32')]);_0x837b38['attributes']=_['intersection'](_0x244b6f[_0x52b9('0x30')],qs[_0x52b9('0x35')](_0x186020[_0x52b9('0x32')][_0x52b9('0x35')]));_0x837b38['attributes']=_0x837b38[_0x52b9('0x36')][_0x52b9('0x37')]?_0x837b38[_0x52b9('0x36')]:_0x244b6f[_0x52b9('0x30')];if(!_0x186020[_0x52b9('0x32')]['hasOwnProperty'](_0x52b9('0x38'))){_0x837b38[_0x52b9('0x1c')]=qs['limit'](_0x186020[_0x52b9('0x32')][_0x52b9('0x1c')]);_0x837b38['offset']=qs[_0x52b9('0x1a')](_0x186020[_0x52b9('0x32')][_0x52b9('0x1a')]);}_0x837b38[_0x52b9('0x39')]=qs[_0x52b9('0x3a')](_0x186020['query'][_0x52b9('0x3a')]);_0x837b38['where']=qs[_0x52b9('0x33')](_[_0x52b9('0x3b')](_0x186020[_0x52b9('0x32')],_0x244b6f['filters']),_0x4f7d7c);if(_0x186020[_0x52b9('0x32')][_0x52b9('0x3c')]){_0x837b38[_0x52b9('0x3d')]=_[_0x52b9('0x3e')](_0x837b38[_0x52b9('0x3d')],{'$or':_[_0x52b9('0x2b')](_0x4f7d7c,function(_0x3ac269){if(_0x3ac269[_0x52b9('0x2f')]!==_0x52b9('0x3f')){var _0xb5f15f={};_0xb5f15f[_0x3ac269[_0x52b9('0x29')]]={'$like':'%'+_0x186020[_0x52b9('0x32')][_0x52b9('0x3c')]+'%'};return _0xb5f15f;}})});}_0x837b38=_[_0x52b9('0x3e')]({},_0x837b38,_0x186020[_0x52b9('0x40')]);var _0x4445a1={'where':_0x837b38['where']};return db[_0x52b9('0x2c')][_0x52b9('0x1d')](_0x4445a1)[_0x52b9('0x25')](function(_0x9163f9){_0x53ea3f[_0x52b9('0x1d')]=_0x9163f9;if(_0x186020[_0x52b9('0x32')][_0x52b9('0x41')]){_0x837b38[_0x52b9('0x42')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x837b38);})['then'](function(_0xb2088c){_0x53ea3f[_0x52b9('0x43')]=_0xb2088c;return _0x53ea3f;})[_0x52b9('0x25')](respondWithFilteredResult(_0x2fe13b,_0x837b38))[_0x52b9('0x44')](handleError(_0x2fe13b,null));};exports[_0x52b9('0x45')]=function(_0x5cea55,_0x406963){var _0x299e74={'raw':![],'where':{'id':_0x5cea55[_0x52b9('0x46')]['id']}},_0x5bf4ab={};_0x5bf4ab[_0x52b9('0x30')]=_[_0x52b9('0x31')](db[_0x52b9('0x2c')][_0x52b9('0x2d')]);_0x5bf4ab[_0x52b9('0x32')]=_['keys'](_0x5cea55[_0x52b9('0x32')]);_0x5bf4ab[_0x52b9('0x33')]=_[_0x52b9('0x34')](_0x5bf4ab[_0x52b9('0x30')],_0x5bf4ab[_0x52b9('0x32')]);_0x299e74[_0x52b9('0x36')]=_['intersection'](_0x5bf4ab[_0x52b9('0x30')],qs[_0x52b9('0x35')](_0x5cea55[_0x52b9('0x32')][_0x52b9('0x35')]));_0x299e74[_0x52b9('0x36')]=_0x299e74['attributes'][_0x52b9('0x37')]?_0x299e74[_0x52b9('0x36')]:_0x5bf4ab[_0x52b9('0x30')];if(_0x5cea55[_0x52b9('0x32')][_0x52b9('0x41')]){_0x299e74[_0x52b9('0x42')]=[{'all':!![]}];}_0x299e74=_[_0x52b9('0x3e')]({},_0x299e74,_0x5cea55['options']);return db[_0x52b9('0x2c')]['find'](_0x299e74)['then'](handleEntityNotFound(_0x406963,null))[_0x52b9('0x25')](respondWithResult(_0x406963,null))[_0x52b9('0x44')](handleError(_0x406963,null));};exports['create']=function(_0x5cda8b,_0x493830){return db['FreshsalesAccount']['create'](_0x5cda8b[_0x52b9('0x47')],{})[_0x52b9('0x25')](respondWithResult(_0x493830,0xc9))[_0x52b9('0x44')](handleError(_0x493830,null));};exports[_0x52b9('0x24')]=function(_0x27df01,_0x5f11c1){if(_0x27df01[_0x52b9('0x47')]['id']){delete _0x27df01[_0x52b9('0x47')]['id'];}return db[_0x52b9('0x2c')]['find']({'where':{'id':_0x27df01['params']['id']}})[_0x52b9('0x25')](handleEntityNotFound(_0x5f11c1,null))[_0x52b9('0x25')](saveUpdates(_0x27df01['body'],null))[_0x52b9('0x25')](respondWithResult(_0x5f11c1,null))['catch'](handleError(_0x5f11c1,null));};exports[_0x52b9('0x26')]=function(_0x5c20fe,_0x1febb4){return db[_0x52b9('0x2c')]['find']({'where':{'id':_0x5c20fe['params']['id']}})[_0x52b9('0x25')](handleEntityNotFound(_0x1febb4,null))[_0x52b9('0x25')](removeEntity(_0x1febb4,null))['catch'](handleError(_0x1febb4,null));};exports[_0x52b9('0x48')]=function(_0x268fe1,_0x78853b,_0x26965d){var _0x2a89fe={};var _0x363e3c={};var _0x5e0216;var _0x275800;return db[_0x52b9('0x2c')][_0x52b9('0x49')]({'where':{'id':_0x268fe1['params']['id']}})['then'](handleEntityNotFound(_0x78853b,null))['then'](function(_0x2d3a4b){if(_0x2d3a4b){_0x5e0216=_0x2d3a4b;_0x363e3c[_0x52b9('0x30')]=_[_0x52b9('0x31')](db[_0x52b9('0x4a')][_0x52b9('0x2d')]);_0x363e3c[_0x52b9('0x32')]=_[_0x52b9('0x31')](_0x268fe1[_0x52b9('0x32')]);_0x363e3c['filters']=_['intersection'](_0x363e3c['model'],_0x363e3c['query']);_0x2a89fe['attributes']=_[_0x52b9('0x34')](_0x363e3c['model'],qs[_0x52b9('0x35')](_0x268fe1[_0x52b9('0x32')][_0x52b9('0x35')]));_0x2a89fe[_0x52b9('0x36')]=_0x2a89fe['attributes'][_0x52b9('0x37')]?_0x2a89fe[_0x52b9('0x36')]:_0x363e3c[_0x52b9('0x30')];_0x2a89fe[_0x52b9('0x39')]=qs['sort'](_0x268fe1[_0x52b9('0x32')]['sort']);_0x2a89fe[_0x52b9('0x3d')]=qs[_0x52b9('0x33')](_[_0x52b9('0x3b')](_0x268fe1[_0x52b9('0x32')],_0x363e3c[_0x52b9('0x33')]));if(_0x268fe1[_0x52b9('0x32')][_0x52b9('0x3c')]){_0x2a89fe['where']=_[_0x52b9('0x3e')](_0x2a89fe[_0x52b9('0x3d')],{'$or':_[_0x52b9('0x2b')](_0x2a89fe['attributes'],function(_0x470c16){var _0x358522={};_0x358522[_0x470c16]={'$like':'%'+_0x268fe1[_0x52b9('0x32')]['filter']+'%'};return _0x358522;})});}_0x2a89fe=_['merge']({},_0x2a89fe,_0x268fe1[_0x52b9('0x40')]);return _0x5e0216['getConfigurations'](_0x2a89fe);}})[_0x52b9('0x25')](function(_0x25f7c2){if(_0x25f7c2){_0x275800=_0x25f7c2[_0x52b9('0x37')];if(!_0x268fe1[_0x52b9('0x32')][_0x52b9('0x4b')](_0x52b9('0x38'))){_0x2a89fe[_0x52b9('0x1c')]=qs['limit'](_0x268fe1[_0x52b9('0x32')][_0x52b9('0x1c')]);_0x2a89fe[_0x52b9('0x1a')]=qs[_0x52b9('0x1a')](_0x268fe1[_0x52b9('0x32')]['offset']);}return _0x5e0216['getConfigurations'](_0x2a89fe);}})[_0x52b9('0x25')](function(_0x5de93d){if(_0x5de93d){return _0x5de93d?{'count':_0x275800,'rows':_0x5de93d}:null;}})['then'](respondWithResult(_0x78853b,null))[_0x52b9('0x44')](handleError(_0x78853b,null));};exports[_0x52b9('0x4c')]=function(_0x471d38,_0xb015fc,_0x88787e){if(_0x471d38[_0x52b9('0x47')]['id']){delete _0x471d38[_0x52b9('0x47')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x471d38[_0x52b9('0x46')]['id']}})['then'](handleEntityNotFound(_0xb015fc,null))[_0x52b9('0x25')](function(_0x3d46e3){if(_0x3d46e3){_0x471d38[_0x52b9('0x47')][_0x52b9('0x4d')]=_0x3d46e3['id'];_0x471d38['body'][_0x52b9('0x4e')]=integrations[_0x52b9('0x4f')](_0x471d38[_0x52b9('0x47')]['channel'],_0x471d38['body'][_0x52b9('0x2f')]);_0x471d38[_0x52b9('0x47')][_0x52b9('0x50')]=integrations[_0x52b9('0x51')](_0x471d38[_0x52b9('0x47')]['channel'],_0x471d38[_0x52b9('0x47')][_0x52b9('0x2f')]);return db[_0x52b9('0x4a')][_0x52b9('0x52')](_0x471d38[_0x52b9('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x52b9('0x4e')},{'model':db[_0x52b9('0x53')],'as':_0x52b9('0x50')}]});}return null;})[_0x52b9('0x25')](respondWithResult(_0xb015fc,null))[_0x52b9('0x44')](handleError(_0xb015fc,null));};exports[_0x52b9('0x54')]=function(_0x2a027b,_0x2c0157,_0x14b30d){var _0x12fd02='';var _0x33ef82='';return db[_0x52b9('0x2c')][_0x52b9('0x49')]({'where':{'id':_0x2a027b[_0x52b9('0x46')]['id']},'attributes':['id',_0x52b9('0x55'),_0x52b9('0x56'),_0x52b9('0x57')]})['then'](handleEntityNotFound(_0x2c0157,null))[_0x52b9('0x25')](function(_0x25b635){if(_0x25b635){_0x33ef82=_0x25b635[_0x52b9('0x55')];_0x12fd02=_0x25b635['remoteUri'];var _0x35c2cd=_0x25b635['remoteUri']['slice'](-0x1);if(_0x35c2cd==='/'){_0x12fd02=_0x12fd02[_0x52b9('0x58')](0x0,_0x12fd02[_0x52b9('0x59')](_0x35c2cd));}return rp({'method':_0x52b9('0x5a'),'uri':util['format']('%s%s',_0x12fd02,_0x52b9('0x5b')),'headers':{'Authorization':'Token\x20token='+_0x25b635['apiKey']},'json':!![]});}})[_0x52b9('0x25')](function(_0x13fd0f){if(_0x13fd0f){var _0x45263d=_0x13fd0f[_0x52b9('0x5c')];var _0x4e57a3=![];var _0x5d63a8=null;for(_0x5d63a8=0x0;_0x5d63a8<_0x45263d['length'];_0x5d63a8++){if(_0x45263d[_0x5d63a8][_0x52b9('0x5d')]===_0x33ef82){_0x4e57a3=!![];}}if(_0x4e57a3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x52b9('0x5e')});}}})[_0x52b9('0x25')](respondWithResult(_0x2c0157,null))[_0x52b9('0x44')](function(_0x49168d){var _0x3ce77d=_0x2a027b[_0x52b9('0x32')][_0x52b9('0x5f')]?0x1f4:_0x49168d['statusCode']||0x1f4;logger[_0x52b9('0x27')](_0x52b9('0x60'),_0x52b9('0x54'),_0x3ce77d,JSON[_0x52b9('0x61')](_0x49168d));delete _0x49168d['name'];if(_0x3ce77d===0x191){_0x3ce77d=0x190;}_0x2c0157[_0x52b9('0x18')](_0x3ce77d)['send'](_0x2a027b[_0x52b9('0x32')][_0x52b9('0x5f')]?{'message':_0x52b9('0x62'),'statusCode':_0x49168d[_0x52b9('0x63')]}:_0x49168d);});}; \ No newline at end of file +var _0x5c8b=['limit','undefined','count','set','json','reject','save','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','intersection','catch','create','body','update','find','destroy','params','getConfigurations','FreshsalesConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','remoteUri','apiKey','username','slice','substring','GET','format','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','request-promise','bluebird','mustache','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','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x5c8b,0x176));var _0xb5c8=function(_0x3e66b0,_0x22262f){_0x3e66b0=_0x3e66b0-0x0;var _0x226c79=_0x5c8b[_0x3e66b0];return _0x226c79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5c8('0x0'));var zipdir=require(_0xb5c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5c8('0x2'));var moment=require('moment');var BPromise=require(_0xb5c8('0x3'));var Mustache=require(_0xb5c8('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb5c8('0x5'));var ejs=require(_0xb5c8('0x6'));var fs=require('fs');var fs_extra=require(_0xb5c8('0x7'));var _=require(_0xb5c8('0x8'));var squel=require(_0xb5c8('0x9'));var crypto=require('crypto');var jsforce=require(_0xb5c8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb5c8('0x5'));var querystring=require(_0xb5c8('0xb'));var Papa=require(_0xb5c8('0xc'));var Redis=require(_0xb5c8('0xd'));var authService=require(_0xb5c8('0xe'));var qs=require(_0xb5c8('0xf'));var as=require(_0xb5c8('0x10'));var hardwareService=require(_0xb5c8('0x11'));var logger=require(_0xb5c8('0x12'))('api');var utils=require(_0xb5c8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb5c8('0x14'));var db=require(_0xb5c8('0x15'))['db'];var integrations=require(_0xb5c8('0x16'));function respondWithStatusCode(_0x124e0b,_0x4bb665){_0x4bb665=_0x4bb665||0xcc;return function(_0x53ca0f){if(_0x53ca0f){return _0x124e0b['sendStatus'](_0x4bb665);}return _0x124e0b[_0xb5c8('0x17')](_0x4bb665)[_0xb5c8('0x18')]();};}function respondWithResult(_0x339514,_0x5e8174){_0x5e8174=_0x5e8174||0xc8;return function(_0x21ec01){if(_0x21ec01){return _0x339514[_0xb5c8('0x17')](_0x5e8174)['json'](_0x21ec01);}};}function respondWithFilteredResult(_0x4075e5,_0x50039e){return function(_0x1dcc5c){if(_0x1dcc5c){var _0x45a95b=typeof _0x50039e[_0xb5c8('0x19')]==='undefined'&&typeof _0x50039e[_0xb5c8('0x1a')]===_0xb5c8('0x1b');var _0x375d85=_0x1dcc5c[_0xb5c8('0x1c')];var _0x1c8cdf=_0x45a95b?0x0:_0x50039e[_0xb5c8('0x19')];var _0x1e483b=_0x45a95b?_0x1dcc5c[_0xb5c8('0x1c')]:_0x50039e[_0xb5c8('0x19')]+_0x50039e['limit'];var _0x310c45;if(_0x1e483b>=_0x375d85){_0x1e483b=_0x375d85;_0x310c45=0xc8;}else{_0x310c45=0xce;}_0x4075e5[_0xb5c8('0x17')](_0x310c45);return _0x4075e5[_0xb5c8('0x1d')]('Content-Range',_0x1c8cdf+'-'+_0x1e483b+'/'+_0x375d85)[_0xb5c8('0x1e')](_0x1dcc5c);}return null;};}function patchUpdates(_0x3fd469){return function(_0x53b7ee){try{jsonpatch['apply'](_0x53b7ee,_0x3fd469,!![]);}catch(_0x4c4081){return BPromise[_0xb5c8('0x1f')](_0x4c4081);}return _0x53b7ee[_0xb5c8('0x20')]();};}function saveUpdates(_0x29025c,_0x89b345){return function(_0x4792a8){if(_0x4792a8){return _0x4792a8['update'](_0x29025c)[_0xb5c8('0x21')](function(_0x1ac30e){return _0x1ac30e;});}return null;};}function removeEntity(_0x4ab3e3,_0x45f557){return function(_0x4bb081){if(_0x4bb081){return _0x4bb081['destroy']()[_0xb5c8('0x21')](function(){_0x4ab3e3['status'](0xcc)[_0xb5c8('0x18')]();});}};}function handleEntityNotFound(_0x405220,_0x204512){return function(_0x1b1bb5){if(!_0x1b1bb5){_0x405220['sendStatus'](0x194);}return _0x1b1bb5;};}function handleError(_0x206cc3,_0x4a322c){_0x4a322c=_0x4a322c||0x1f4;return function(_0x338c99){logger[_0xb5c8('0x22')](_0x338c99[_0xb5c8('0x23')]);if(_0x338c99[_0xb5c8('0x24')]){delete _0x338c99[_0xb5c8('0x24')];}_0x206cc3[_0xb5c8('0x17')](_0x4a322c)[_0xb5c8('0x25')](_0x338c99);};}exports[_0xb5c8('0x26')]=function(_0x11bd91,_0x10bead){var _0x538b77={},_0x5bcd10={},_0xcc1c83={'count':0x0,'rows':[]};var _0x3d1657=_[_0xb5c8('0x27')](db[_0xb5c8('0x28')][_0xb5c8('0x29')],function(_0x2e63a4){return{'name':_0x2e63a4[_0xb5c8('0x2a')],'type':_0x2e63a4[_0xb5c8('0x2b')][_0xb5c8('0x2c')]};});_0x5bcd10[_0xb5c8('0x2d')]=_[_0xb5c8('0x27')](_0x3d1657,_0xb5c8('0x24'));_0x5bcd10[_0xb5c8('0x2e')]=_[_0xb5c8('0x2f')](_0x11bd91[_0xb5c8('0x2e')]);_0x5bcd10[_0xb5c8('0x30')]=_['intersection'](_0x5bcd10[_0xb5c8('0x2d')],_0x5bcd10[_0xb5c8('0x2e')]);_0x538b77[_0xb5c8('0x31')]=_['intersection'](_0x5bcd10['model'],qs[_0xb5c8('0x32')](_0x11bd91[_0xb5c8('0x2e')][_0xb5c8('0x32')]));_0x538b77[_0xb5c8('0x31')]=_0x538b77[_0xb5c8('0x31')][_0xb5c8('0x33')]?_0x538b77['attributes']:_0x5bcd10[_0xb5c8('0x2d')];if(!_0x11bd91[_0xb5c8('0x2e')][_0xb5c8('0x34')](_0xb5c8('0x35'))){_0x538b77[_0xb5c8('0x1a')]=qs['limit'](_0x11bd91[_0xb5c8('0x2e')][_0xb5c8('0x1a')]);_0x538b77[_0xb5c8('0x19')]=qs[_0xb5c8('0x19')](_0x11bd91['query'][_0xb5c8('0x19')]);}_0x538b77[_0xb5c8('0x36')]=qs[_0xb5c8('0x37')](_0x11bd91[_0xb5c8('0x2e')]['sort']);_0x538b77[_0xb5c8('0x38')]=qs['filters'](_[_0xb5c8('0x39')](_0x11bd91[_0xb5c8('0x2e')],_0x5bcd10[_0xb5c8('0x30')]),_0x3d1657);if(_0x11bd91[_0xb5c8('0x2e')]['filter']){_0x538b77['where']=_[_0xb5c8('0x3a')](_0x538b77[_0xb5c8('0x38')],{'$or':_[_0xb5c8('0x27')](_0x3d1657,function(_0x33c4ee){if(_0x33c4ee[_0xb5c8('0x2b')]!==_0xb5c8('0x3b')){var _0x56f976={};_0x56f976[_0x33c4ee[_0xb5c8('0x24')]]={'$like':'%'+_0x11bd91['query'][_0xb5c8('0x3c')]+'%'};return _0x56f976;}})});}_0x538b77=_[_0xb5c8('0x3a')]({},_0x538b77,_0x11bd91[_0xb5c8('0x3d')]);var _0x4afa9c={'where':_0x538b77[_0xb5c8('0x38')]};return db[_0xb5c8('0x28')][_0xb5c8('0x1c')](_0x4afa9c)[_0xb5c8('0x21')](function(_0x325f09){_0xcc1c83['count']=_0x325f09;if(_0x11bd91[_0xb5c8('0x2e')][_0xb5c8('0x3e')]){_0x538b77[_0xb5c8('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xb5c8('0x40')](_0x538b77);})[_0xb5c8('0x21')](function(_0x2776d7){_0xcc1c83[_0xb5c8('0x41')]=_0x2776d7;return _0xcc1c83;})[_0xb5c8('0x21')](respondWithFilteredResult(_0x10bead,_0x538b77))['catch'](handleError(_0x10bead,null));};exports[_0xb5c8('0x42')]=function(_0x409f5f,_0x5ade6f){var _0x4d2320={'raw':![],'where':{'id':_0x409f5f['params']['id']}},_0x4e30ab={};_0x4e30ab['model']=_[_0xb5c8('0x2f')](db[_0xb5c8('0x28')][_0xb5c8('0x29')]);_0x4e30ab['query']=_[_0xb5c8('0x2f')](_0x409f5f[_0xb5c8('0x2e')]);_0x4e30ab['filters']=_[_0xb5c8('0x43')](_0x4e30ab[_0xb5c8('0x2d')],_0x4e30ab[_0xb5c8('0x2e')]);_0x4d2320[_0xb5c8('0x31')]=_['intersection'](_0x4e30ab['model'],qs['fields'](_0x409f5f[_0xb5c8('0x2e')][_0xb5c8('0x32')]));_0x4d2320[_0xb5c8('0x31')]=_0x4d2320['attributes']['length']?_0x4d2320[_0xb5c8('0x31')]:_0x4e30ab[_0xb5c8('0x2d')];if(_0x409f5f['query'][_0xb5c8('0x3e')]){_0x4d2320[_0xb5c8('0x3f')]=[{'all':!![]}];}_0x4d2320=_['merge']({},_0x4d2320,_0x409f5f['options']);return db['FreshsalesAccount']['find'](_0x4d2320)[_0xb5c8('0x21')](handleEntityNotFound(_0x5ade6f,null))['then'](respondWithResult(_0x5ade6f,null))[_0xb5c8('0x44')](handleError(_0x5ade6f,null));};exports[_0xb5c8('0x45')]=function(_0x89b8dd,_0x3f2a96){return db['FreshsalesAccount'][_0xb5c8('0x45')](_0x89b8dd[_0xb5c8('0x46')],{})['then'](respondWithResult(_0x3f2a96,0xc9))[_0xb5c8('0x44')](handleError(_0x3f2a96,null));};exports[_0xb5c8('0x47')]=function(_0x66b758,_0x69698f){if(_0x66b758[_0xb5c8('0x46')]['id']){delete _0x66b758[_0xb5c8('0x46')]['id'];}return db['FreshsalesAccount'][_0xb5c8('0x48')]({'where':{'id':_0x66b758['params']['id']}})[_0xb5c8('0x21')](handleEntityNotFound(_0x69698f,null))['then'](saveUpdates(_0x66b758[_0xb5c8('0x46')],null))[_0xb5c8('0x21')](respondWithResult(_0x69698f,null))['catch'](handleError(_0x69698f,null));};exports[_0xb5c8('0x49')]=function(_0x430eb5,_0x578ab3){return db[_0xb5c8('0x28')][_0xb5c8('0x48')]({'where':{'id':_0x430eb5[_0xb5c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x578ab3,null))['then'](removeEntity(_0x578ab3,null))[_0xb5c8('0x44')](handleError(_0x578ab3,null));};exports[_0xb5c8('0x4b')]=function(_0x587104,_0x1d2e05,_0x1f5406){var _0xbf7804={};var _0x1e316b={};var _0x20acc5;var _0xb252f8;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x587104[_0xb5c8('0x4a')]['id']}})[_0xb5c8('0x21')](handleEntityNotFound(_0x1d2e05,null))[_0xb5c8('0x21')](function(_0x8c414a){if(_0x8c414a){_0x20acc5=_0x8c414a;_0x1e316b[_0xb5c8('0x2d')]=_[_0xb5c8('0x2f')](db[_0xb5c8('0x4c')][_0xb5c8('0x29')]);_0x1e316b['query']=_[_0xb5c8('0x2f')](_0x587104['query']);_0x1e316b['filters']=_[_0xb5c8('0x43')](_0x1e316b[_0xb5c8('0x2d')],_0x1e316b[_0xb5c8('0x2e')]);_0xbf7804[_0xb5c8('0x31')]=_['intersection'](_0x1e316b['model'],qs['fields'](_0x587104[_0xb5c8('0x2e')][_0xb5c8('0x32')]));_0xbf7804[_0xb5c8('0x31')]=_0xbf7804['attributes'][_0xb5c8('0x33')]?_0xbf7804[_0xb5c8('0x31')]:_0x1e316b['model'];_0xbf7804[_0xb5c8('0x36')]=qs['sort'](_0x587104[_0xb5c8('0x2e')][_0xb5c8('0x37')]);_0xbf7804[_0xb5c8('0x38')]=qs[_0xb5c8('0x30')](_['pick'](_0x587104[_0xb5c8('0x2e')],_0x1e316b['filters']));if(_0x587104[_0xb5c8('0x2e')][_0xb5c8('0x3c')]){_0xbf7804[_0xb5c8('0x38')]=_[_0xb5c8('0x3a')](_0xbf7804['where'],{'$or':_[_0xb5c8('0x27')](_0xbf7804['attributes'],function(_0x138738){var _0xab2b49={};_0xab2b49[_0x138738]={'$like':'%'+_0x587104[_0xb5c8('0x2e')]['filter']+'%'};return _0xab2b49;})});}_0xbf7804=_[_0xb5c8('0x3a')]({},_0xbf7804,_0x587104[_0xb5c8('0x3d')]);return _0x20acc5[_0xb5c8('0x4b')](_0xbf7804);}})['then'](function(_0x3cc9c4){if(_0x3cc9c4){_0xb252f8=_0x3cc9c4[_0xb5c8('0x33')];if(!_0x587104[_0xb5c8('0x2e')][_0xb5c8('0x34')](_0xb5c8('0x35'))){_0xbf7804[_0xb5c8('0x1a')]=qs['limit'](_0x587104[_0xb5c8('0x2e')][_0xb5c8('0x1a')]);_0xbf7804[_0xb5c8('0x19')]=qs['offset'](_0x587104[_0xb5c8('0x2e')][_0xb5c8('0x19')]);}return _0x20acc5['getConfigurations'](_0xbf7804);}})[_0xb5c8('0x21')](function(_0x5b6d14){if(_0x5b6d14){return _0x5b6d14?{'count':_0xb252f8,'rows':_0x5b6d14}:null;}})['then'](respondWithResult(_0x1d2e05,null))[_0xb5c8('0x44')](handleError(_0x1d2e05,null));};exports['addConfiguration']=function(_0x4d47ef,_0x28e663,_0x653fce){if(_0x4d47ef[_0xb5c8('0x46')]['id']){delete _0x4d47ef[_0xb5c8('0x46')]['id'];}return db[_0xb5c8('0x28')][_0xb5c8('0x4d')]({'where':{'id':_0x4d47ef['params']['id']}})[_0xb5c8('0x21')](handleEntityNotFound(_0x28e663,null))[_0xb5c8('0x21')](function(_0x4eb3f7){if(_0x4eb3f7){_0x4d47ef[_0xb5c8('0x46')][_0xb5c8('0x4e')]=_0x4eb3f7['id'];_0x4d47ef[_0xb5c8('0x46')][_0xb5c8('0x4f')]=integrations['getSubjects'](_0x4d47ef['body'][_0xb5c8('0x50')],_0x4d47ef['body'][_0xb5c8('0x2b')]);_0x4d47ef['body'][_0xb5c8('0x51')]=integrations[_0xb5c8('0x52')](_0x4d47ef[_0xb5c8('0x46')][_0xb5c8('0x50')],_0x4d47ef[_0xb5c8('0x46')][_0xb5c8('0x2b')]);return db[_0xb5c8('0x4c')][_0xb5c8('0x45')](_0x4d47ef[_0xb5c8('0x46')],{'include':[{'model':db[_0xb5c8('0x53')],'as':'Subjects'},{'model':db[_0xb5c8('0x53')],'as':_0xb5c8('0x51')}]});}return null;})['then'](respondWithResult(_0x28e663,null))[_0xb5c8('0x44')](handleError(_0x28e663,null));};exports['getFields']=function(_0x46b61a,_0x4ec915,_0x49c154){var _0x3e9794='';var _0x3f7c1a='';return db[_0xb5c8('0x28')][_0xb5c8('0x4d')]({'where':{'id':_0x46b61a[_0xb5c8('0x4a')]['id']},'attributes':['id','username',_0xb5c8('0x54'),_0xb5c8('0x55')]})['then'](handleEntityNotFound(_0x4ec915,null))[_0xb5c8('0x21')](function(_0x597249){if(_0x597249){_0x3f7c1a=_0x597249[_0xb5c8('0x56')];_0x3e9794=_0x597249[_0xb5c8('0x54')];var _0x24d84a=_0x597249[_0xb5c8('0x54')][_0xb5c8('0x57')](-0x1);if(_0x24d84a==='/'){_0x3e9794=_0x3e9794[_0xb5c8('0x58')](0x0,_0x3e9794['lastIndexOf'](_0x24d84a));}return rp({'method':_0xb5c8('0x59'),'uri':util[_0xb5c8('0x5a')]('%s%s',_0x3e9794,_0xb5c8('0x5b')),'headers':{'Authorization':'Token\x20token='+_0x597249[_0xb5c8('0x55')]},'json':!![]});}})[_0xb5c8('0x21')](function(_0x4c116a){if(_0x4c116a){var _0x58966a=_0x4c116a[_0xb5c8('0x5c')];var _0x1f3c88=![];var _0x4af05d=null;for(_0x4af05d=0x0;_0x4af05d<_0x58966a[_0xb5c8('0x33')];_0x4af05d++){if(_0x58966a[_0x4af05d][_0xb5c8('0x5d')]===_0x3f7c1a){_0x1f3c88=!![];}}if(_0x1f3c88){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb5c8('0x5e')});}}})[_0xb5c8('0x21')](respondWithResult(_0x4ec915,null))[_0xb5c8('0x44')](function(_0x401a7f){var _0x1642d6=_0x46b61a['query'][_0xb5c8('0x5f')]?0x1f4:_0x401a7f[_0xb5c8('0x60')]||0x1f4;logger['error'](_0xb5c8('0x61'),_0xb5c8('0x62'),_0x1642d6,JSON[_0xb5c8('0x63')](_0x401a7f));delete _0x401a7f['name'];if(_0x1642d6===0x191){_0x1642d6=0x190;}_0x4ec915[_0xb5c8('0x17')](_0x1642d6)[_0xb5c8('0x25')](_0x46b61a[_0xb5c8('0x2e')][_0xb5c8('0x5f')]?{'message':'Wrong\x20credentials','statusCode':_0x401a7f[_0xb5c8('0x60')]}:_0x401a7f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 020d731..e595b40 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 _0x7278=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2d6b69,_0x3d0a97){var _0x40b8f1=function(_0x49893c){while(--_0x49893c){_0x2d6b69['push'](_0x2d6b69['shift']());}};_0x40b8f1(++_0x3d0a97);}(_0x7278,0x161));var _0x8727=function(_0x5888f9,_0x5c7fcb){_0x5888f9=_0x5888f9-0x0;var _0x2da799=_0x7278[_0x5888f9];return _0x2da799;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));var integrations=require(_0x8727('0xa'));module[_0x8727('0xb')]=function(_0x5549d5,_0xfd1902){return _0x5549d5[_0x8727('0xc')](_0x8727('0xd'),attributes,{'tableName':_0x8727('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5464=['int_freshsales_accounts','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount'];(function(_0x30f2d3,_0x3c0448){var _0x17f342=function(_0x3d767b){while(--_0x3d767b){_0x30f2d3['push'](_0x30f2d3['shift']());}};_0x17f342(++_0x3c0448);}(_0x5464,0x15d));var _0x4546=function(_0xf1f5ab,_0x21f3d9){_0xf1f5ab=_0xf1f5ab-0x0;var _0x1ee2ea=_0x5464[_0xf1f5ab];return _0x1ee2ea;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));var integrations=require(_0x4546('0x8'));module['exports']=function(_0x57391f,_0x5c5e09){return _0x57391f[_0x4546('0x9')](_0x4546('0xa'),attributes,{'tableName':_0x4546('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 4592271..1f5b22d 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 _0x4325=['stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4c5c5d,_0x379b26){var _0x52a17d=function(_0xf94f31){while(--_0xf94f31){_0x4c5c5d['push'](_0x4c5c5d['shift']());}};_0x52a17d(++_0x379b26);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')]({'raw':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options'][_0x5432('0x1c')]||null:null,'attributes':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'limit':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options']['limit']||null:null,'include':_0x32fe60['options']?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x32fe60[_0x5432('0x1a')]['include'],function(_0x4af5f4){return{'model':db[_0x4af5f4[_0x5432('0x20')]],'as':_0x4af5f4['as'],'attributes':_0x4af5f4[_0x5432('0x1d')],'include':_0x4af5f4['include']?_[_0x5432('0x1f')](_0x4af5f4[_0x5432('0x1e')],function(_0x637582){return{'model':db[_0x637582['model']],'as':_0x637582['as'],'attributes':_0x637582[_0x5432('0x1d')],'include':_0x637582[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x637582['include'],function(_0x4ab09d){return{'model':db[_0x4ab09d[_0x5432('0x20')]],'as':_0x4ab09d['as'],'attributes':_0x4ab09d[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1abe73){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug'](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x1abe73));_0x5f011f(_0x1abe73);})['catch'](function(_0x6fc7f5){logger['error'](_0x5432('0x17'),_0x6fc7f5['message'],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x6fc7f5[_0x5432('0x13')]));});});};exports[_0x5432('0x21')]=function(_0x345b51){var _0x4e92d5=this;return new Promise(function(_0x31490c,_0x1d436c){return db[_0x5432('0x18')][_0x5432('0x22')]({'raw':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')]['where']||null:null,'attributes':_0x345b51['options']?_0x345b51[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'include':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1e')]?_['map'](_0x345b51[_0x5432('0x1a')]['include'],function(_0x2955e0){return{'model':db[_0x2955e0[_0x5432('0x20')]],'as':_0x2955e0['as'],'attributes':_0x2955e0[_0x5432('0x1d')],'include':_0x2955e0[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x2955e0[_0x5432('0x1e')],function(_0x5c3c77){return{'model':db[_0x5c3c77[_0x5432('0x20')]],'as':_0x5c3c77['as'],'attributes':_0x5c3c77[_0x5432('0x1d')],'include':_0x5c3c77[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x5c3c77['include'],function(_0xe01f4b){return{'model':db[_0xe01f4b[_0x5432('0x20')]],'as':_0xe01f4b['as'],'attributes':_0xe01f4b[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5432('0xb')](function(_0x3fb586){logger[_0x5432('0x14')](_0x5432('0x21'),_0x345b51);logger[_0x5432('0xd')](_0x5432('0x21'),_0x345b51,JSON[_0x5432('0x10')](_0x3fb586));_0x31490c(_0x3fb586);})[_0x5432('0x16')](function(_0x1f4679){logger[_0x5432('0x12')](_0x5432('0x21'),_0x1f4679['message'],_0x345b51);_0x1d436c(_0x4e92d5[_0x5432('0x12')](0x1f4,_0x1f4679['message']));});});}; \ No newline at end of file +var _0xbff5=['attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','raw','ShowFreshsalesAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where'];(function(_0x30d233,_0x9741bd){var _0x1a510c=function(_0x1c9a9a){while(--_0x1c9a9a){_0x30d233['push'](_0x30d233['shift']());}};_0x1a510c(++_0x9741bd);}(_0xbff5,0x1bc));var _0x5bff=function(_0xa10a67,_0xe1e601){_0xa10a67=_0xa10a67-0x0;var _0x2c8883=_0xbff5[_0xa10a67];return _0x2c8883;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['GetFreshsalesAccount']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['FreshsalesAccount'][_0x5bff('0x15')]({'raw':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x17')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'include':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')],function(_0x31d26b){return{'model':db[_0x31d26b[_0x5bff('0x1c')]],'as':_0x31d26b['as'],'attributes':_0x31d26b[_0x5bff('0x18')],'include':_0x31d26b['include']?_['map'](_0x31d26b[_0x5bff('0x1a')],function(_0x53bd97){return{'model':db[_0x53bd97[_0x5bff('0x1c')]],'as':_0x53bd97['as'],'attributes':_0x53bd97[_0x5bff('0x18')],'include':_0x53bd97[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x53bd97[_0x5bff('0x1a')],function(_0x1140eb){return{'model':db[_0x1140eb[_0x5bff('0x1c')]],'as':_0x1140eb['as'],'attributes':_0x1140eb[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df57a){logger[_0x5bff('0x13')](_0x5bff('0x1d'),_0xc9fbc3);logger['debug'](_0x5bff('0x1d'),_0xc9fbc3,JSON['stringify'](_0x4df57a));_0x36653b(_0x4df57a);})['catch'](function(_0x3eda3a){logger['error'](_0x5bff('0x1d'),_0x3eda3a[_0x5bff('0x12')],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x3eda3a[_0x5bff('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x71783){var _0x4ee6f1=this;return new Promise(function(_0x3c1405,_0x5a7873){return db[_0x5bff('0x1e')][_0x5bff('0x1f')]({'raw':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x20')]===undefined?!![]:![]:!![],'where':_0x71783[_0x5bff('0x16')]?_0x71783['options'][_0x5bff('0x17')]||null:null,'attributes':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'include':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x71783['options'][_0x5bff('0x1a')],function(_0x16042d){return{'model':db[_0x16042d[_0x5bff('0x1c')]],'as':_0x16042d['as'],'attributes':_0x16042d[_0x5bff('0x18')],'include':_0x16042d['include']?_[_0x5bff('0x1b')](_0x16042d[_0x5bff('0x1a')],function(_0x5a24be){return{'model':db[_0x5a24be[_0x5bff('0x1c')]],'as':_0x5a24be['as'],'attributes':_0x5a24be[_0x5bff('0x18')],'include':_0x5a24be[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x5a24be['include'],function(_0x38245d){return{'model':db[_0x38245d[_0x5bff('0x1c')]],'as':_0x38245d['as'],'attributes':_0x38245d[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1065d1){logger['info'](_0x5bff('0x21'),_0x71783);logger[_0x5bff('0x22')](_0x5bff('0x21'),_0x71783,JSON['stringify'](_0x1065d1));_0x3c1405(_0x1065d1);})[_0x5bff('0x23')](function(_0x1ec079){logger[_0x5bff('0x10')]('ShowFreshsalesAccount',_0x1ec079[_0x5bff('0x12')],_0x71783);_0x5a7873(_0x4ee6f1[_0x5bff('0x10')](0x1f4,_0x1ec079['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3ccfb6e..14a8d7b 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 _0xbae8=['index','/:id','getSubjects','/:id/descriptions','post','create','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x1966ee,_0x470cbe){var _0x11f4b9=function(_0x47df5f){while(--_0x47df5f){_0x1966ee['push'](_0x1966ee['shift']());}};_0x11f4b9(++_0x470cbe);}(_0xbae8,0xbd));var _0x8bae=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xbae8[_0x725a4c];return _0x37b2cc;};'use strict';var multer=require(_0x8bae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8bae('0x1'));var express=require('express');var router=express[_0x8bae('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8bae('0x3'));var interaction=require(_0x8bae('0x4'));var config=require(_0x8bae('0x5'));var controller=require(_0x8bae('0x6'));router[_0x8bae('0x7')]('/',auth[_0x8bae('0x8')](),controller[_0x8bae('0x9')]);router['get'](_0x8bae('0xa'),auth[_0x8bae('0x8')](),controller['show']);router[_0x8bae('0x7')]('/:id/subjects',auth[_0x8bae('0x8')](),controller[_0x8bae('0xb')]);router[_0x8bae('0x7')](_0x8bae('0xc'),auth[_0x8bae('0x8')](),controller['getDescriptions']);router[_0x8bae('0x7')]('/:id/fields',auth[_0x8bae('0x8')](),controller['getFields']);router[_0x8bae('0xd')]('/',auth[_0x8bae('0x8')](),controller[_0x8bae('0xe')]);router['put'](_0x8bae('0xa'),auth[_0x8bae('0x8')](),controller[_0x8bae('0xf')]);router[_0x8bae('0x10')]('/:id',auth[_0x8bae('0x8')](),controller['destroy']);module[_0x8bae('0x11')]=router; \ No newline at end of file +var _0x909f=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create'];(function(_0xcff867,_0x2911c8){var _0xf3808e=function(_0x37abff){while(--_0x37abff){_0xcff867['push'](_0xcff867['shift']());}};_0xf3808e(++_0x2911c8);}(_0x909f,0x16b));var _0xf909=function(_0x581e33,_0x4089fa){_0x581e33=_0x581e33-0x0;var _0x182783=_0x909f[_0x581e33];return _0x182783;};'use strict';var multer=require(_0xf909('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf909('0x1'));var express=require(_0xf909('0x2'));var router=express[_0xf909('0x3')]();var fs_extra=require(_0xf909('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf909('0x5'));var controller=require(_0xf909('0x6'));router[_0xf909('0x7')]('/',auth[_0xf909('0x8')](),controller[_0xf909('0x9')]);router[_0xf909('0x7')](_0xf909('0xa'),auth[_0xf909('0x8')](),controller['show']);router[_0xf909('0x7')](_0xf909('0xb'),auth[_0xf909('0x8')](),controller[_0xf909('0xc')]);router['get'](_0xf909('0xd'),auth['isAuthenticated'](),controller[_0xf909('0xe')]);router[_0xf909('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf909('0xf')]);router['post']('/',auth[_0xf909('0x8')](),controller[_0xf909('0x10')]);router['put'](_0xf909('0xa'),auth[_0xf909('0x8')](),controller[_0xf909('0x11')]);router[_0xf909('0x12')](_0xf909('0xa'),auth[_0xf909('0x8')](),controller[_0xf909('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0b5cf89..562bdbb 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 _0x6beb=['STRING','sequelize'];(function(_0x2203c9,_0x4f4021){var _0x11d2e5=function(_0x472daa){while(--_0x472daa){_0x2203c9['push'](_0x2203c9['shift']());}};_0x11d2e5(++_0x4f4021);}(_0x6beb,0x1a5));var _0xb6be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6beb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb6be('0x0'));module['exports']={'name':{'type':Sequelize[_0xb6be('0x1')]},'description':{'type':Sequelize[_0xb6be('0x1')]}}; \ No newline at end of file +var _0x657c=['exports','STRING'];(function(_0x192a0c,_0x299c0f){var _0x42ac96=function(_0x141b64){while(--_0x141b64){_0x192a0c['push'](_0x192a0c['shift']());}};_0x42ac96(++_0x299c0f);}(_0x657c,0x112));var _0xc657=function(_0xba4026,_0xeaa0f7){_0xba4026=_0xba4026-0x0;var _0x3a8666=_0x657c[_0xba4026];return _0x3a8666;};'use strict';var Sequelize=require('sequelize');module[_0xc657('0x0')]={'name':{'type':Sequelize[_0xc657('0x1')]},'description':{'type':Sequelize[_0xc657('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index cee0747..85cf264 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 _0x7a4b=['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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','FreshsalesConfiguration','findAll','rows','catch','show','params','include','find','create','body','findOne','pick','getSubjects','FreshsalesField','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x7a4b,0x18d));var _0xb7a4=function(_0x34b6e5,_0x3f9bc6){_0x34b6e5=_0x34b6e5-0x0;var _0x14bb6e=_0x7a4b[_0x34b6e5];return _0x14bb6e;};'use strict';var emlformat=require(_0xb7a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7a4('0x1'));var jsonpatch=require(_0xb7a4('0x2'));var rp=require(_0xb7a4('0x3'));var moment=require(_0xb7a4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb7a4('0x5'));var path=require(_0xb7a4('0x6'));var sox=require('sox');var csv=require(_0xb7a4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7a4('0x8'));var _=require(_0xb7a4('0x9'));var squel=require(_0xb7a4('0xa'));var crypto=require(_0xb7a4('0xb'));var jsforce=require(_0xb7a4('0xc'));var deskjs=require(_0xb7a4('0xd'));var toCsv=require(_0xb7a4('0x7'));var querystring=require(_0xb7a4('0xe'));var Papa=require(_0xb7a4('0xf'));var Redis=require(_0xb7a4('0x10'));var authService=require(_0xb7a4('0x11'));var qs=require(_0xb7a4('0x12'));var as=require(_0xb7a4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7a4('0x14'))('api');var utils=require(_0xb7a4('0x15'));var config=require(_0xb7a4('0x16'));var licenseUtil=require(_0xb7a4('0x17'));var db=require(_0xb7a4('0x18'))['db'];function respondWithStatusCode(_0x32cb7e,_0x57a8cf){_0x57a8cf=_0x57a8cf||0xcc;return function(_0xfd1e28){if(_0xfd1e28){return _0x32cb7e['sendStatus'](_0x57a8cf);}return _0x32cb7e[_0xb7a4('0x19')](_0x57a8cf)['end']();};}function respondWithResult(_0x4d693f,_0x1617ac){_0x1617ac=_0x1617ac||0xc8;return function(_0x1fb89a){if(_0x1fb89a){return _0x4d693f['status'](_0x1617ac)[_0xb7a4('0x1a')](_0x1fb89a);}};}function respondWithFilteredResult(_0x39ed1d,_0x4bfa61){return function(_0x147f11){if(_0x147f11){var _0x20ba46=typeof _0x4bfa61[_0xb7a4('0x1b')]===_0xb7a4('0x1c')&&typeof _0x4bfa61[_0xb7a4('0x1d')]===_0xb7a4('0x1c');var _0x5e72f2=_0x147f11[_0xb7a4('0x1e')];var _0x2d6de7=_0x20ba46?0x0:_0x4bfa61[_0xb7a4('0x1b')];var _0x65be02=_0x20ba46?_0x147f11[_0xb7a4('0x1e')]:_0x4bfa61[_0xb7a4('0x1b')]+_0x4bfa61['limit'];var _0x1ff0d0;if(_0x65be02>=_0x5e72f2){_0x65be02=_0x5e72f2;_0x1ff0d0=0xc8;}else{_0x1ff0d0=0xce;}_0x39ed1d['status'](_0x1ff0d0);return _0x39ed1d[_0xb7a4('0x1f')](_0xb7a4('0x20'),_0x2d6de7+'-'+_0x65be02+'/'+_0x5e72f2)[_0xb7a4('0x1a')](_0x147f11);}return null;};}function patchUpdates(_0x384e5e){return function(_0x568fad){try{jsonpatch[_0xb7a4('0x21')](_0x568fad,_0x384e5e,!![]);}catch(_0x58f9c4){return BPromise[_0xb7a4('0x22')](_0x58f9c4);}return _0x568fad[_0xb7a4('0x23')]();};}function saveUpdates(_0x329192,_0x18686b){return function(_0x18abfd){if(_0x18abfd){return _0x18abfd['update'](_0x329192)[_0xb7a4('0x24')](function(_0x5b5531){return _0x5b5531;});}return null;};}function removeEntity(_0x46beea,_0x3bec80){return function(_0x4363e8){if(_0x4363e8){return _0x4363e8[_0xb7a4('0x25')]()[_0xb7a4('0x24')](function(){_0x46beea['status'](0xcc)[_0xb7a4('0x26')]();});}};}function handleEntityNotFound(_0x3644d6,_0x24c739){return function(_0x44a328){if(!_0x44a328){_0x3644d6['sendStatus'](0x194);}return _0x44a328;};}function handleError(_0x547187,_0x4dbaea){_0x4dbaea=_0x4dbaea||0x1f4;return function(_0x11b73e){logger[_0xb7a4('0x27')](_0x11b73e[_0xb7a4('0x28')]);if(_0x11b73e[_0xb7a4('0x29')]){delete _0x11b73e[_0xb7a4('0x29')];}_0x547187[_0xb7a4('0x19')](_0x4dbaea)[_0xb7a4('0x2a')](_0x11b73e);};}exports[_0xb7a4('0x2b')]=function(_0x386c76,_0x44b667){var _0x16d180={},_0x102fc1={},_0x13e808={'count':0x0,'rows':[]};var _0x223207=_[_0xb7a4('0x2c')](db['FreshsalesConfiguration'][_0xb7a4('0x2d')],function(_0x550878){return{'name':_0x550878[_0xb7a4('0x2e')],'type':_0x550878[_0xb7a4('0x2f')]['key']};});_0x102fc1[_0xb7a4('0x30')]=_['map'](_0x223207,_0xb7a4('0x29'));_0x102fc1[_0xb7a4('0x31')]=_[_0xb7a4('0x32')](_0x386c76[_0xb7a4('0x31')]);_0x102fc1[_0xb7a4('0x33')]=_[_0xb7a4('0x34')](_0x102fc1['model'],_0x102fc1[_0xb7a4('0x31')]);_0x16d180[_0xb7a4('0x35')]=_[_0xb7a4('0x34')](_0x102fc1[_0xb7a4('0x30')],qs[_0xb7a4('0x36')](_0x386c76[_0xb7a4('0x31')]['fields']));_0x16d180['attributes']=_0x16d180['attributes'][_0xb7a4('0x37')]?_0x16d180[_0xb7a4('0x35')]:_0x102fc1[_0xb7a4('0x30')];if(!_0x386c76[_0xb7a4('0x31')][_0xb7a4('0x38')](_0xb7a4('0x39'))){_0x16d180[_0xb7a4('0x1d')]=qs[_0xb7a4('0x1d')](_0x386c76['query'][_0xb7a4('0x1d')]);_0x16d180[_0xb7a4('0x1b')]=qs[_0xb7a4('0x1b')](_0x386c76[_0xb7a4('0x31')][_0xb7a4('0x1b')]);}_0x16d180[_0xb7a4('0x3a')]=qs[_0xb7a4('0x3b')](_0x386c76[_0xb7a4('0x31')]['sort']);_0x16d180[_0xb7a4('0x3c')]=qs[_0xb7a4('0x33')](_['pick'](_0x386c76[_0xb7a4('0x31')],_0x102fc1[_0xb7a4('0x33')]),_0x223207);if(_0x386c76[_0xb7a4('0x31')][_0xb7a4('0x3d')]){_0x16d180[_0xb7a4('0x3c')]=_[_0xb7a4('0x3e')](_0x16d180['where'],{'$or':_[_0xb7a4('0x2c')](_0x223207,function(_0x10c06e){if(_0x10c06e[_0xb7a4('0x2f')]!=='VIRTUAL'){var _0x4f6280={};_0x4f6280[_0x10c06e[_0xb7a4('0x29')]]={'$like':'%'+_0x386c76[_0xb7a4('0x31')][_0xb7a4('0x3d')]+'%'};return _0x4f6280;}})});}_0x16d180=_[_0xb7a4('0x3e')]({},_0x16d180,_0x386c76[_0xb7a4('0x3f')]);var _0x3cdec9={'where':_0x16d180['where']};return db['FreshsalesConfiguration']['count'](_0x3cdec9)['then'](function(_0x505996){_0x13e808[_0xb7a4('0x1e')]=_0x505996;if(_0x386c76['query'][_0xb7a4('0x40')]){_0x16d180['include']=[{'all':!![]}];}return db[_0xb7a4('0x41')][_0xb7a4('0x42')](_0x16d180);})[_0xb7a4('0x24')](function(_0x45e0e9){_0x13e808[_0xb7a4('0x43')]=_0x45e0e9;return _0x13e808;})['then'](respondWithFilteredResult(_0x44b667,_0x16d180))[_0xb7a4('0x44')](handleError(_0x44b667,null));};exports[_0xb7a4('0x45')]=function(_0x2fe056,_0x544893){var _0x3b5816={'raw':![],'where':{'id':_0x2fe056[_0xb7a4('0x46')]['id']}},_0x571c24={};_0x571c24[_0xb7a4('0x30')]=_[_0xb7a4('0x32')](db[_0xb7a4('0x41')][_0xb7a4('0x2d')]);_0x571c24[_0xb7a4('0x31')]=_['keys'](_0x2fe056[_0xb7a4('0x31')]);_0x571c24[_0xb7a4('0x33')]=_[_0xb7a4('0x34')](_0x571c24[_0xb7a4('0x30')],_0x571c24['query']);_0x3b5816['attributes']=_['intersection'](_0x571c24[_0xb7a4('0x30')],qs['fields'](_0x2fe056['query'][_0xb7a4('0x36')]));_0x3b5816['attributes']=_0x3b5816['attributes'][_0xb7a4('0x37')]?_0x3b5816['attributes']:_0x571c24[_0xb7a4('0x30')];if(_0x2fe056[_0xb7a4('0x31')][_0xb7a4('0x40')]){_0x3b5816[_0xb7a4('0x47')]=[{'all':!![]}];}_0x3b5816=_[_0xb7a4('0x3e')]({},_0x3b5816,_0x2fe056[_0xb7a4('0x3f')]);return db['FreshsalesConfiguration'][_0xb7a4('0x48')](_0x3b5816)['then'](handleEntityNotFound(_0x544893,null))[_0xb7a4('0x24')](respondWithResult(_0x544893,null))[_0xb7a4('0x44')](handleError(_0x544893,null));};exports['create']=function(_0x4a4120,_0x50c6dd){return db['FreshsalesConfiguration'][_0xb7a4('0x49')](_0x4a4120[_0xb7a4('0x4a')],{})[_0xb7a4('0x24')](respondWithResult(_0x50c6dd,0xc9))[_0xb7a4('0x44')](handleError(_0x50c6dd,null));};exports['update']=function(_0x3d3397,_0x528731){if(_0x3d3397[_0xb7a4('0x4a')]['id']){delete _0x3d3397[_0xb7a4('0x4a')]['id'];}return db[_0xb7a4('0x41')]['find']({'where':{'id':_0x3d3397[_0xb7a4('0x46')]['id']}})[_0xb7a4('0x24')](handleEntityNotFound(_0x528731,null))['then'](saveUpdates(_0x3d3397[_0xb7a4('0x4a')],null))[_0xb7a4('0x24')](respondWithResult(_0x528731,null))['catch'](handleError(_0x528731,null));};exports[_0xb7a4('0x25')]=function(_0x21a177,_0x2095c4){return db[_0xb7a4('0x41')]['find']({'where':{'id':_0x21a177[_0xb7a4('0x46')]['id']}})[_0xb7a4('0x24')](handleEntityNotFound(_0x2095c4,null))['then'](removeEntity(_0x2095c4,null))[_0xb7a4('0x44')](handleError(_0x2095c4,null));};exports['getSubjects']=function(_0x3d9369,_0x45d656,_0xb82fa7){var _0x35f1f2={};var _0x50533e={};var _0x1c6ecc;var _0x4700bc;return db['FreshsalesConfiguration'][_0xb7a4('0x4b')]({'where':{'id':_0x3d9369['params']['id']}})[_0xb7a4('0x24')](handleEntityNotFound(_0x45d656,null))[_0xb7a4('0x24')](function(_0x543693){if(_0x543693){_0x1c6ecc=_0x543693;_0x50533e[_0xb7a4('0x30')]=_[_0xb7a4('0x32')](db['FreshsalesField'][_0xb7a4('0x2d')]);_0x50533e[_0xb7a4('0x31')]=_['keys'](_0x3d9369[_0xb7a4('0x31')]);_0x50533e[_0xb7a4('0x33')]=_[_0xb7a4('0x34')](_0x50533e[_0xb7a4('0x30')],_0x50533e[_0xb7a4('0x31')]);_0x35f1f2[_0xb7a4('0x35')]=_[_0xb7a4('0x34')](_0x50533e[_0xb7a4('0x30')],qs[_0xb7a4('0x36')](_0x3d9369[_0xb7a4('0x31')][_0xb7a4('0x36')]));_0x35f1f2[_0xb7a4('0x35')]=_0x35f1f2['attributes']['length']?_0x35f1f2[_0xb7a4('0x35')]:_0x50533e[_0xb7a4('0x30')];_0x35f1f2[_0xb7a4('0x3a')]=qs[_0xb7a4('0x3b')](_0x3d9369[_0xb7a4('0x31')]['sort']);_0x35f1f2['where']=qs[_0xb7a4('0x33')](_[_0xb7a4('0x4c')](_0x3d9369[_0xb7a4('0x31')],_0x50533e[_0xb7a4('0x33')]));if(_0x3d9369[_0xb7a4('0x31')][_0xb7a4('0x3d')]){_0x35f1f2[_0xb7a4('0x3c')]=_[_0xb7a4('0x3e')](_0x35f1f2[_0xb7a4('0x3c')],{'$or':_[_0xb7a4('0x2c')](_0x35f1f2[_0xb7a4('0x35')],function(_0x22259e){var _0x2006ec={};_0x2006ec[_0x22259e]={'$like':'%'+_0x3d9369['query'][_0xb7a4('0x3d')]+'%'};return _0x2006ec;})});}_0x35f1f2=_[_0xb7a4('0x3e')]({},_0x35f1f2,_0x3d9369['options']);return _0x1c6ecc[_0xb7a4('0x4d')](_0x35f1f2);}})[_0xb7a4('0x24')](function(_0x378123){if(_0x378123){_0x4700bc=_0x378123[_0xb7a4('0x37')];if(!_0x3d9369[_0xb7a4('0x31')][_0xb7a4('0x38')]('nolimit')){_0x35f1f2[_0xb7a4('0x1d')]=qs[_0xb7a4('0x1d')](_0x3d9369['query']['limit']);_0x35f1f2['offset']=qs[_0xb7a4('0x1b')](_0x3d9369[_0xb7a4('0x31')][_0xb7a4('0x1b')]);}return _0x1c6ecc[_0xb7a4('0x4d')](_0x35f1f2);}})[_0xb7a4('0x24')](function(_0x3dccc2){if(_0x3dccc2){return _0x3dccc2?{'count':_0x4700bc,'rows':_0x3dccc2}:null;}})[_0xb7a4('0x24')](respondWithResult(_0x45d656,null))[_0xb7a4('0x44')](handleError(_0x45d656,null));};exports['getDescriptions']=function(_0x586dfe,_0xb10a96,_0x18a9c7){var _0x21641f={};var _0x2da83c={};var _0x49232c;var _0x585193;return db[_0xb7a4('0x41')]['findOne']({'where':{'id':_0x586dfe[_0xb7a4('0x46')]['id']}})[_0xb7a4('0x24')](handleEntityNotFound(_0xb10a96,null))[_0xb7a4('0x24')](function(_0x2cbd83){if(_0x2cbd83){_0x49232c=_0x2cbd83;_0x2da83c[_0xb7a4('0x30')]=_[_0xb7a4('0x32')](db[_0xb7a4('0x4e')]['rawAttributes']);_0x2da83c[_0xb7a4('0x31')]=_[_0xb7a4('0x32')](_0x586dfe['query']);_0x2da83c[_0xb7a4('0x33')]=_[_0xb7a4('0x34')](_0x2da83c[_0xb7a4('0x30')],_0x2da83c[_0xb7a4('0x31')]);_0x21641f[_0xb7a4('0x35')]=_[_0xb7a4('0x34')](_0x2da83c[_0xb7a4('0x30')],qs[_0xb7a4('0x36')](_0x586dfe[_0xb7a4('0x31')]['fields']));_0x21641f[_0xb7a4('0x35')]=_0x21641f[_0xb7a4('0x35')][_0xb7a4('0x37')]?_0x21641f[_0xb7a4('0x35')]:_0x2da83c[_0xb7a4('0x30')];_0x21641f['order']=qs[_0xb7a4('0x3b')](_0x586dfe[_0xb7a4('0x31')][_0xb7a4('0x3b')]);_0x21641f['where']=qs['filters'](_[_0xb7a4('0x4c')](_0x586dfe[_0xb7a4('0x31')],_0x2da83c['filters']));if(_0x586dfe[_0xb7a4('0x31')][_0xb7a4('0x3d')]){_0x21641f[_0xb7a4('0x3c')]=_[_0xb7a4('0x3e')](_0x21641f[_0xb7a4('0x3c')],{'$or':_[_0xb7a4('0x2c')](_0x21641f[_0xb7a4('0x35')],function(_0x70eea9){var _0x22eddd={};_0x22eddd[_0x70eea9]={'$like':'%'+_0x586dfe[_0xb7a4('0x31')][_0xb7a4('0x3d')]+'%'};return _0x22eddd;})});}_0x21641f=_[_0xb7a4('0x3e')]({},_0x21641f,_0x586dfe['options']);return _0x49232c[_0xb7a4('0x4f')](_0x21641f);}})[_0xb7a4('0x24')](function(_0x532bbb){if(_0x532bbb){_0x585193=_0x532bbb['length'];if(!_0x586dfe[_0xb7a4('0x31')][_0xb7a4('0x38')](_0xb7a4('0x39'))){_0x21641f[_0xb7a4('0x1d')]=qs[_0xb7a4('0x1d')](_0x586dfe[_0xb7a4('0x31')][_0xb7a4('0x1d')]);_0x21641f[_0xb7a4('0x1b')]=qs[_0xb7a4('0x1b')](_0x586dfe[_0xb7a4('0x31')][_0xb7a4('0x1b')]);}return _0x49232c['getDescriptions'](_0x21641f);}})[_0xb7a4('0x24')](function(_0x359660){if(_0x359660){return _0x359660?{'count':_0x585193,'rows':_0x359660}:null;}})[_0xb7a4('0x24')](respondWithResult(_0xb10a96,null))[_0xb7a4('0x44')](handleError(_0xb10a96,null));};exports[_0xb7a4('0x50')]=function(_0x25515f,_0x47e9e0,_0xb0375d){var _0x9f8d16={};var _0x1d9782={};var _0x22e095;var _0x279b1c;return db['FreshsalesConfiguration'][_0xb7a4('0x4b')]({'where':{'id':_0x25515f['params']['id']}})[_0xb7a4('0x24')](handleEntityNotFound(_0x47e9e0,null))[_0xb7a4('0x24')](function(_0x1f7510){if(_0x1f7510){_0x22e095=_0x1f7510;_0x1d9782[_0xb7a4('0x30')]=_[_0xb7a4('0x32')](db[_0xb7a4('0x4e')]['rawAttributes']);_0x1d9782[_0xb7a4('0x31')]=_[_0xb7a4('0x32')](_0x25515f[_0xb7a4('0x31')]);_0x1d9782[_0xb7a4('0x33')]=_[_0xb7a4('0x34')](_0x1d9782[_0xb7a4('0x30')],_0x1d9782[_0xb7a4('0x31')]);_0x9f8d16[_0xb7a4('0x35')]=_['intersection'](_0x1d9782[_0xb7a4('0x30')],qs['fields'](_0x25515f[_0xb7a4('0x31')]['fields']));_0x9f8d16['attributes']=_0x9f8d16['attributes'][_0xb7a4('0x37')]?_0x9f8d16['attributes']:_0x1d9782[_0xb7a4('0x30')];_0x9f8d16[_0xb7a4('0x3a')]=qs['sort'](_0x25515f[_0xb7a4('0x31')][_0xb7a4('0x3b')]);_0x9f8d16[_0xb7a4('0x3c')]=qs['filters'](_[_0xb7a4('0x4c')](_0x25515f['query'],_0x1d9782[_0xb7a4('0x33')]));if(_0x25515f[_0xb7a4('0x31')][_0xb7a4('0x3d')]){_0x9f8d16[_0xb7a4('0x3c')]=_[_0xb7a4('0x3e')](_0x9f8d16[_0xb7a4('0x3c')],{'$or':_[_0xb7a4('0x2c')](_0x9f8d16[_0xb7a4('0x35')],function(_0x309cd5){var _0x37c351={};_0x37c351[_0x309cd5]={'$like':'%'+_0x25515f[_0xb7a4('0x31')]['filter']+'%'};return _0x37c351;})});}_0x9f8d16=_[_0xb7a4('0x3e')]({},_0x9f8d16,_0x25515f[_0xb7a4('0x3f')]);return _0x22e095[_0xb7a4('0x50')](_0x9f8d16);}})[_0xb7a4('0x24')](function(_0x9b8b9e){if(_0x9b8b9e){_0x279b1c=_0x9b8b9e[_0xb7a4('0x37')];if(!_0x25515f[_0xb7a4('0x31')]['hasOwnProperty'](_0xb7a4('0x39'))){_0x9f8d16[_0xb7a4('0x1d')]=qs[_0xb7a4('0x1d')](_0x25515f['query'][_0xb7a4('0x1d')]);_0x9f8d16[_0xb7a4('0x1b')]=qs[_0xb7a4('0x1b')](_0x25515f[_0xb7a4('0x31')][_0xb7a4('0x1b')]);}return _0x22e095['getFields'](_0x9f8d16);}})['then'](function(_0x435d34){if(_0x435d34){return _0x435d34?{'count':_0x279b1c,'rows':_0x435d34}:null;}})[_0xb7a4('0x24')](respondWithResult(_0x47e9e0,null))[_0xb7a4('0x44')](handleError(_0x47e9e0,null));}; \ No newline at end of file +var _0xb3f9=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','apply','update','then','destroy','error','stack','name','index','FreshsalesConfiguration','fieldName','type','map','query','keys','model','attributes'];(function(_0x48cd80,_0x9138f5){var _0x356b02=function(_0x4d8774){while(--_0x4d8774){_0x48cd80['push'](_0x48cd80['shift']());}};_0x356b02(++_0x9138f5);}(_0xb3f9,0x65));var _0x9b3f=function(_0x392cbd,_0xe7e111){_0x392cbd=_0x392cbd-0x0;var _0x1ea349=_0xb3f9[_0x392cbd];return _0x1ea349;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b3f('0x0'));var zipdir=require(_0x9b3f('0x1'));var jsonpatch=require(_0x9b3f('0x2'));var rp=require('request-promise');var moment=require(_0x9b3f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9b3f('0x4'));var util=require(_0x9b3f('0x5'));var path=require(_0x9b3f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b3f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b3f('0x8'));var squel=require('squel');var crypto=require(_0x9b3f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9b3f('0xa'));var toCsv=require(_0x9b3f('0xb'));var querystring=require(_0x9b3f('0xc'));var Papa=require(_0x9b3f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9b3f('0xe'));var as=require(_0x9b3f('0xf'));var hardwareService=require(_0x9b3f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x9b3f('0x11'));var config=require(_0x9b3f('0x12'));var licenseUtil=require(_0x9b3f('0x13'));var db=require(_0x9b3f('0x14'))['db'];function respondWithStatusCode(_0x4eebb9,_0x42d9bc){_0x42d9bc=_0x42d9bc||0xcc;return function(_0x350af6){if(_0x350af6){return _0x4eebb9[_0x9b3f('0x15')](_0x42d9bc);}return _0x4eebb9[_0x9b3f('0x16')](_0x42d9bc)[_0x9b3f('0x17')]();};}function respondWithResult(_0x10f238,_0x1a5d3c){_0x1a5d3c=_0x1a5d3c||0xc8;return function(_0x19d6cc){if(_0x19d6cc){return _0x10f238[_0x9b3f('0x16')](_0x1a5d3c)['json'](_0x19d6cc);}};}function respondWithFilteredResult(_0xaf642b,_0x5e2c45){return function(_0x46d614){if(_0x46d614){var _0x517953=typeof _0x5e2c45['offset']===_0x9b3f('0x18')&&typeof _0x5e2c45['limit']===_0x9b3f('0x18');var _0x4e615b=_0x46d614['count'];var _0x49bfcb=_0x517953?0x0:_0x5e2c45[_0x9b3f('0x19')];var _0x4470a6=_0x517953?_0x46d614[_0x9b3f('0x1a')]:_0x5e2c45['offset']+_0x5e2c45[_0x9b3f('0x1b')];var _0x1a0a57;if(_0x4470a6>=_0x4e615b){_0x4470a6=_0x4e615b;_0x1a0a57=0xc8;}else{_0x1a0a57=0xce;}_0xaf642b['status'](_0x1a0a57);return _0xaf642b[_0x9b3f('0x1c')]('Content-Range',_0x49bfcb+'-'+_0x4470a6+'/'+_0x4e615b)['json'](_0x46d614);}return null;};}function patchUpdates(_0x7993b6){return function(_0x119d96){try{jsonpatch[_0x9b3f('0x1d')](_0x119d96,_0x7993b6,!![]);}catch(_0x439be9){return BPromise['reject'](_0x439be9);}return _0x119d96['save']();};}function saveUpdates(_0xb96cfa,_0x5eea3d){return function(_0x365ee7){if(_0x365ee7){return _0x365ee7[_0x9b3f('0x1e')](_0xb96cfa)[_0x9b3f('0x1f')](function(_0x33ab01){return _0x33ab01;});}return null;};}function removeEntity(_0x5f2234,_0xd77584){return function(_0x3cb1de){if(_0x3cb1de){return _0x3cb1de[_0x9b3f('0x20')]()[_0x9b3f('0x1f')](function(){_0x5f2234[_0x9b3f('0x16')](0xcc)[_0x9b3f('0x17')]();});}};}function handleEntityNotFound(_0x36d558,_0x348aeb){return function(_0x1482c2){if(!_0x1482c2){_0x36d558[_0x9b3f('0x15')](0x194);}return _0x1482c2;};}function handleError(_0x30589f,_0x4ca369){_0x4ca369=_0x4ca369||0x1f4;return function(_0x22e9e8){logger[_0x9b3f('0x21')](_0x22e9e8[_0x9b3f('0x22')]);if(_0x22e9e8['name']){delete _0x22e9e8[_0x9b3f('0x23')];}_0x30589f['status'](_0x4ca369)['send'](_0x22e9e8);};}exports[_0x9b3f('0x24')]=function(_0x8fd58f,_0x523739){var _0x191157={},_0x18d531={},_0x326fb3={'count':0x0,'rows':[]};var _0x48206f=_['map'](db[_0x9b3f('0x25')]['rawAttributes'],function(_0x44a723){return{'name':_0x44a723[_0x9b3f('0x26')],'type':_0x44a723[_0x9b3f('0x27')]['key']};});_0x18d531['model']=_[_0x9b3f('0x28')](_0x48206f,_0x9b3f('0x23'));_0x18d531[_0x9b3f('0x29')]=_[_0x9b3f('0x2a')](_0x8fd58f[_0x9b3f('0x29')]);_0x18d531['filters']=_['intersection'](_0x18d531[_0x9b3f('0x2b')],_0x18d531[_0x9b3f('0x29')]);_0x191157[_0x9b3f('0x2c')]=_[_0x9b3f('0x2d')](_0x18d531['model'],qs['fields'](_0x8fd58f[_0x9b3f('0x29')][_0x9b3f('0x2e')]));_0x191157[_0x9b3f('0x2c')]=_0x191157[_0x9b3f('0x2c')][_0x9b3f('0x2f')]?_0x191157[_0x9b3f('0x2c')]:_0x18d531[_0x9b3f('0x2b')];if(!_0x8fd58f[_0x9b3f('0x29')][_0x9b3f('0x30')](_0x9b3f('0x31'))){_0x191157['limit']=qs['limit'](_0x8fd58f[_0x9b3f('0x29')]['limit']);_0x191157[_0x9b3f('0x19')]=qs[_0x9b3f('0x19')](_0x8fd58f[_0x9b3f('0x29')][_0x9b3f('0x19')]);}_0x191157[_0x9b3f('0x32')]=qs['sort'](_0x8fd58f[_0x9b3f('0x29')][_0x9b3f('0x33')]);_0x191157[_0x9b3f('0x34')]=qs[_0x9b3f('0x35')](_[_0x9b3f('0x36')](_0x8fd58f[_0x9b3f('0x29')],_0x18d531[_0x9b3f('0x35')]),_0x48206f);if(_0x8fd58f['query'][_0x9b3f('0x37')]){_0x191157[_0x9b3f('0x34')]=_[_0x9b3f('0x38')](_0x191157[_0x9b3f('0x34')],{'$or':_['map'](_0x48206f,function(_0x1f17d6){if(_0x1f17d6[_0x9b3f('0x27')]!=='VIRTUAL'){var _0x51a9ca={};_0x51a9ca[_0x1f17d6[_0x9b3f('0x23')]]={'$like':'%'+_0x8fd58f[_0x9b3f('0x29')][_0x9b3f('0x37')]+'%'};return _0x51a9ca;}})});}_0x191157=_[_0x9b3f('0x38')]({},_0x191157,_0x8fd58f['options']);var _0x4d5923={'where':_0x191157[_0x9b3f('0x34')]};return db[_0x9b3f('0x25')]['count'](_0x4d5923)[_0x9b3f('0x1f')](function(_0xec62aa){_0x326fb3['count']=_0xec62aa;if(_0x8fd58f[_0x9b3f('0x29')]['includeAll']){_0x191157['include']=[{'all':!![]}];}return db[_0x9b3f('0x25')]['findAll'](_0x191157);})[_0x9b3f('0x1f')](function(_0x391ff2){_0x326fb3[_0x9b3f('0x39')]=_0x391ff2;return _0x326fb3;})[_0x9b3f('0x1f')](respondWithFilteredResult(_0x523739,_0x191157))[_0x9b3f('0x3a')](handleError(_0x523739,null));};exports[_0x9b3f('0x3b')]=function(_0x3b9cd9,_0x4ceefd){var _0x6df911={'raw':![],'where':{'id':_0x3b9cd9[_0x9b3f('0x3c')]['id']}},_0x278dd0={};_0x278dd0[_0x9b3f('0x2b')]=_[_0x9b3f('0x2a')](db[_0x9b3f('0x25')][_0x9b3f('0x3d')]);_0x278dd0[_0x9b3f('0x29')]=_['keys'](_0x3b9cd9[_0x9b3f('0x29')]);_0x278dd0['filters']=_['intersection'](_0x278dd0['model'],_0x278dd0[_0x9b3f('0x29')]);_0x6df911[_0x9b3f('0x2c')]=_[_0x9b3f('0x2d')](_0x278dd0[_0x9b3f('0x2b')],qs[_0x9b3f('0x2e')](_0x3b9cd9[_0x9b3f('0x29')][_0x9b3f('0x2e')]));_0x6df911['attributes']=_0x6df911[_0x9b3f('0x2c')][_0x9b3f('0x2f')]?_0x6df911[_0x9b3f('0x2c')]:_0x278dd0[_0x9b3f('0x2b')];if(_0x3b9cd9[_0x9b3f('0x29')][_0x9b3f('0x3e')]){_0x6df911[_0x9b3f('0x3f')]=[{'all':!![]}];}_0x6df911=_[_0x9b3f('0x38')]({},_0x6df911,_0x3b9cd9[_0x9b3f('0x40')]);return db[_0x9b3f('0x25')][_0x9b3f('0x41')](_0x6df911)[_0x9b3f('0x1f')](handleEntityNotFound(_0x4ceefd,null))[_0x9b3f('0x1f')](respondWithResult(_0x4ceefd,null))[_0x9b3f('0x3a')](handleError(_0x4ceefd,null));};exports[_0x9b3f('0x42')]=function(_0x4bd5ef,_0x19c040){return db[_0x9b3f('0x25')][_0x9b3f('0x42')](_0x4bd5ef[_0x9b3f('0x43')],{})['then'](respondWithResult(_0x19c040,0xc9))['catch'](handleError(_0x19c040,null));};exports[_0x9b3f('0x1e')]=function(_0x33f24e,_0xb5dd5d){if(_0x33f24e[_0x9b3f('0x43')]['id']){delete _0x33f24e[_0x9b3f('0x43')]['id'];}return db[_0x9b3f('0x25')]['find']({'where':{'id':_0x33f24e[_0x9b3f('0x3c')]['id']}})['then'](handleEntityNotFound(_0xb5dd5d,null))['then'](saveUpdates(_0x33f24e[_0x9b3f('0x43')],null))['then'](respondWithResult(_0xb5dd5d,null))[_0x9b3f('0x3a')](handleError(_0xb5dd5d,null));};exports[_0x9b3f('0x20')]=function(_0x3862f7,_0x42ad77){return db[_0x9b3f('0x25')][_0x9b3f('0x41')]({'where':{'id':_0x3862f7[_0x9b3f('0x3c')]['id']}})[_0x9b3f('0x1f')](handleEntityNotFound(_0x42ad77,null))[_0x9b3f('0x1f')](removeEntity(_0x42ad77,null))[_0x9b3f('0x3a')](handleError(_0x42ad77,null));};exports[_0x9b3f('0x44')]=function(_0x38ba70,_0xc8005d,_0x721cc8){var _0x54dd08={};var _0x89191c={};var _0xfc1d97;var _0x28061b;return db[_0x9b3f('0x25')]['findOne']({'where':{'id':_0x38ba70[_0x9b3f('0x3c')]['id']}})[_0x9b3f('0x1f')](handleEntityNotFound(_0xc8005d,null))[_0x9b3f('0x1f')](function(_0x4c892a){if(_0x4c892a){_0xfc1d97=_0x4c892a;_0x89191c[_0x9b3f('0x2b')]=_[_0x9b3f('0x2a')](db[_0x9b3f('0x45')][_0x9b3f('0x3d')]);_0x89191c[_0x9b3f('0x29')]=_['keys'](_0x38ba70[_0x9b3f('0x29')]);_0x89191c[_0x9b3f('0x35')]=_[_0x9b3f('0x2d')](_0x89191c[_0x9b3f('0x2b')],_0x89191c['query']);_0x54dd08[_0x9b3f('0x2c')]=_[_0x9b3f('0x2d')](_0x89191c[_0x9b3f('0x2b')],qs[_0x9b3f('0x2e')](_0x38ba70[_0x9b3f('0x29')][_0x9b3f('0x2e')]));_0x54dd08[_0x9b3f('0x2c')]=_0x54dd08[_0x9b3f('0x2c')][_0x9b3f('0x2f')]?_0x54dd08[_0x9b3f('0x2c')]:_0x89191c['model'];_0x54dd08[_0x9b3f('0x32')]=qs['sort'](_0x38ba70[_0x9b3f('0x29')][_0x9b3f('0x33')]);_0x54dd08[_0x9b3f('0x34')]=qs['filters'](_[_0x9b3f('0x36')](_0x38ba70[_0x9b3f('0x29')],_0x89191c[_0x9b3f('0x35')]));if(_0x38ba70[_0x9b3f('0x29')][_0x9b3f('0x37')]){_0x54dd08[_0x9b3f('0x34')]=_['merge'](_0x54dd08['where'],{'$or':_[_0x9b3f('0x28')](_0x54dd08['attributes'],function(_0x3c649e){var _0x3127f6={};_0x3127f6[_0x3c649e]={'$like':'%'+_0x38ba70[_0x9b3f('0x29')][_0x9b3f('0x37')]+'%'};return _0x3127f6;})});}_0x54dd08=_['merge']({},_0x54dd08,_0x38ba70['options']);return _0xfc1d97[_0x9b3f('0x44')](_0x54dd08);}})[_0x9b3f('0x1f')](function(_0x39c540){if(_0x39c540){_0x28061b=_0x39c540[_0x9b3f('0x2f')];if(!_0x38ba70[_0x9b3f('0x29')][_0x9b3f('0x30')]('nolimit')){_0x54dd08[_0x9b3f('0x1b')]=qs[_0x9b3f('0x1b')](_0x38ba70[_0x9b3f('0x29')][_0x9b3f('0x1b')]);_0x54dd08[_0x9b3f('0x19')]=qs[_0x9b3f('0x19')](_0x38ba70['query'][_0x9b3f('0x19')]);}return _0xfc1d97[_0x9b3f('0x44')](_0x54dd08);}})[_0x9b3f('0x1f')](function(_0x29fa82){if(_0x29fa82){return _0x29fa82?{'count':_0x28061b,'rows':_0x29fa82}:null;}})['then'](respondWithResult(_0xc8005d,null))[_0x9b3f('0x3a')](handleError(_0xc8005d,null));};exports[_0x9b3f('0x46')]=function(_0x1da759,_0x3e1a1f,_0x213e34){var _0x303cb1={};var _0x43d026={};var _0x17bf94;var _0x21aa94;return db[_0x9b3f('0x25')][_0x9b3f('0x47')]({'where':{'id':_0x1da759['params']['id']}})['then'](handleEntityNotFound(_0x3e1a1f,null))[_0x9b3f('0x1f')](function(_0x578aa5){if(_0x578aa5){_0x17bf94=_0x578aa5;_0x43d026[_0x9b3f('0x2b')]=_[_0x9b3f('0x2a')](db[_0x9b3f('0x45')][_0x9b3f('0x3d')]);_0x43d026['query']=_[_0x9b3f('0x2a')](_0x1da759['query']);_0x43d026[_0x9b3f('0x35')]=_[_0x9b3f('0x2d')](_0x43d026['model'],_0x43d026[_0x9b3f('0x29')]);_0x303cb1[_0x9b3f('0x2c')]=_[_0x9b3f('0x2d')](_0x43d026[_0x9b3f('0x2b')],qs[_0x9b3f('0x2e')](_0x1da759['query'][_0x9b3f('0x2e')]));_0x303cb1[_0x9b3f('0x2c')]=_0x303cb1[_0x9b3f('0x2c')][_0x9b3f('0x2f')]?_0x303cb1[_0x9b3f('0x2c')]:_0x43d026[_0x9b3f('0x2b')];_0x303cb1[_0x9b3f('0x32')]=qs[_0x9b3f('0x33')](_0x1da759[_0x9b3f('0x29')][_0x9b3f('0x33')]);_0x303cb1[_0x9b3f('0x34')]=qs[_0x9b3f('0x35')](_[_0x9b3f('0x36')](_0x1da759[_0x9b3f('0x29')],_0x43d026[_0x9b3f('0x35')]));if(_0x1da759[_0x9b3f('0x29')][_0x9b3f('0x37')]){_0x303cb1[_0x9b3f('0x34')]=_['merge'](_0x303cb1['where'],{'$or':_[_0x9b3f('0x28')](_0x303cb1[_0x9b3f('0x2c')],function(_0x3970ee){var _0x5489bb={};_0x5489bb[_0x3970ee]={'$like':'%'+_0x1da759[_0x9b3f('0x29')][_0x9b3f('0x37')]+'%'};return _0x5489bb;})});}_0x303cb1=_[_0x9b3f('0x38')]({},_0x303cb1,_0x1da759['options']);return _0x17bf94['getDescriptions'](_0x303cb1);}})[_0x9b3f('0x1f')](function(_0x27edc6){if(_0x27edc6){_0x21aa94=_0x27edc6[_0x9b3f('0x2f')];if(!_0x1da759[_0x9b3f('0x29')][_0x9b3f('0x30')](_0x9b3f('0x31'))){_0x303cb1[_0x9b3f('0x1b')]=qs[_0x9b3f('0x1b')](_0x1da759[_0x9b3f('0x29')][_0x9b3f('0x1b')]);_0x303cb1[_0x9b3f('0x19')]=qs[_0x9b3f('0x19')](_0x1da759[_0x9b3f('0x29')][_0x9b3f('0x19')]);}return _0x17bf94[_0x9b3f('0x46')](_0x303cb1);}})[_0x9b3f('0x1f')](function(_0x30c050){if(_0x30c050){return _0x30c050?{'count':_0x21aa94,'rows':_0x30c050}:null;}})[_0x9b3f('0x1f')](respondWithResult(_0x3e1a1f,null))[_0x9b3f('0x3a')](handleError(_0x3e1a1f,null));};exports[_0x9b3f('0x48')]=function(_0x539a7b,_0x120627,_0x45edc1){var _0x23f105={};var _0x14e492={};var _0x8bf32a;var _0x2b65db;return db[_0x9b3f('0x25')][_0x9b3f('0x47')]({'where':{'id':_0x539a7b[_0x9b3f('0x3c')]['id']}})[_0x9b3f('0x1f')](handleEntityNotFound(_0x120627,null))['then'](function(_0x1367a5){if(_0x1367a5){_0x8bf32a=_0x1367a5;_0x14e492['model']=_[_0x9b3f('0x2a')](db['FreshsalesField'][_0x9b3f('0x3d')]);_0x14e492[_0x9b3f('0x29')]=_['keys'](_0x539a7b['query']);_0x14e492['filters']=_[_0x9b3f('0x2d')](_0x14e492[_0x9b3f('0x2b')],_0x14e492[_0x9b3f('0x29')]);_0x23f105[_0x9b3f('0x2c')]=_['intersection'](_0x14e492[_0x9b3f('0x2b')],qs[_0x9b3f('0x2e')](_0x539a7b[_0x9b3f('0x29')]['fields']));_0x23f105[_0x9b3f('0x2c')]=_0x23f105[_0x9b3f('0x2c')][_0x9b3f('0x2f')]?_0x23f105[_0x9b3f('0x2c')]:_0x14e492['model'];_0x23f105[_0x9b3f('0x32')]=qs[_0x9b3f('0x33')](_0x539a7b[_0x9b3f('0x29')][_0x9b3f('0x33')]);_0x23f105[_0x9b3f('0x34')]=qs['filters'](_['pick'](_0x539a7b[_0x9b3f('0x29')],_0x14e492[_0x9b3f('0x35')]));if(_0x539a7b['query'][_0x9b3f('0x37')]){_0x23f105[_0x9b3f('0x34')]=_[_0x9b3f('0x38')](_0x23f105['where'],{'$or':_[_0x9b3f('0x28')](_0x23f105['attributes'],function(_0x17d586){var _0x5df1f0={};_0x5df1f0[_0x17d586]={'$like':'%'+_0x539a7b[_0x9b3f('0x29')][_0x9b3f('0x37')]+'%'};return _0x5df1f0;})});}_0x23f105=_[_0x9b3f('0x38')]({},_0x23f105,_0x539a7b[_0x9b3f('0x40')]);return _0x8bf32a['getFields'](_0x23f105);}})['then'](function(_0x29ec8d){if(_0x29ec8d){_0x2b65db=_0x29ec8d[_0x9b3f('0x2f')];if(!_0x539a7b[_0x9b3f('0x29')]['hasOwnProperty'](_0x9b3f('0x31'))){_0x23f105['limit']=qs[_0x9b3f('0x1b')](_0x539a7b[_0x9b3f('0x29')][_0x9b3f('0x1b')]);_0x23f105[_0x9b3f('0x19')]=qs['offset'](_0x539a7b[_0x9b3f('0x29')][_0x9b3f('0x19')]);}return _0x8bf32a['getFields'](_0x23f105);}})[_0x9b3f('0x1f')](function(_0x5be939){if(_0x5be939){return _0x5be939?{'count':_0x2b65db,'rows':_0x5be939}:null;}})[_0x9b3f('0x1f')](respondWithResult(_0x120627,null))[_0x9b3f('0x3a')](handleError(_0x120627,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b2af16b..742e3ef 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 _0x26df=['request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x12c5e2,_0xa8bcfb){var _0x503563=function(_0x31fac8){while(--_0x31fac8){_0x12c5e2['push'](_0x12c5e2['shift']());}};_0x503563(++_0xa8bcfb);}(_0x26df,0x119));var _0xf26d=function(_0x5b36bd,_0x4dfb36){_0x5b36bd=_0x5b36bd-0x0;var _0x1614fe=_0x26df[_0x5b36bd];return _0x1614fe;};'use strict';var _=require(_0xf26d('0x0'));var util=require('util');var logger=require(_0xf26d('0x1'))(_0xf26d('0x2'));var moment=require(_0xf26d('0x3'));var BPromise=require(_0xf26d('0x4'));var rp=require(_0xf26d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf26d('0x6'));var config=require(_0xf26d('0x7'));var attributes=require(_0xf26d('0x8'));module[_0xf26d('0x9')]=function(_0x46d869,_0x3a398b){return _0x46d869[_0xf26d('0xa')](_0xf26d('0xb'),attributes,{'tableName':_0xf26d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x428f=['define','FreshsalesConfiguration','int_freshsales_configurations','util','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x3879f5,_0x5b4fe8){var _0x27ee90=function(_0x46484a){while(--_0x46484a){_0x3879f5['push'](_0x3879f5['shift']());}};_0x27ee90(++_0x5b4fe8);}(_0x428f,0xbe));var _0xf428=function(_0x444321,_0x2a6edd){_0x444321=_0x444321-0x0;var _0x584507=_0x428f[_0x444321];return _0x584507;};'use strict';var _=require('lodash');var util=require(_0xf428('0x0'));var logger=require('../../config/logger')(_0xf428('0x1'));var moment=require(_0xf428('0x2'));var BPromise=require(_0xf428('0x3'));var rp=require(_0xf428('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf428('0x5'));var attributes=require(_0xf428('0x6'));module[_0xf428('0x7')]=function(_0x38ae07,_0x4df5f0){return _0x38ae07[_0xf428('0x8')](_0xf428('0x9'),attributes,{'tableName':_0xf428('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 b28924a..80083d3 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 _0x63a6=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x238de6,_0x4ecff3){var _0x3fc71d=function(_0x80b674){while(--_0x80b674){_0x238de6['push'](_0x238de6['shift']());}};_0x3fc71d(++_0x4ecff3);}(_0x63a6,0xa5));var _0x663a=function(_0x34b863,_0x572731){_0x34b863=_0x34b863-0x0;var _0x42e135=_0x63a6[_0x34b863];return _0x42e135;};'use strict';var _=require('lodash');var util=require(_0x663a('0x0'));var moment=require('moment');var BPromise=require(_0x663a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x663a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x663a('0x3'));var logger=require(_0x663a('0x4'))(_0x663a('0x5'));var config=require(_0x663a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x663a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b154,_0x3ecd36,_0x372b70){return new BPromise(function(_0x1b5ea9,_0x1ffc19){return client[_0x663a('0x8')](_0x53b154,_0x372b70)[_0x663a('0x9')](function(_0x12ee7a){logger[_0x663a('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3ecd36,_0x663a('0xb'));logger[_0x663a('0xc')](_0x663a('0xd'),_0x3ecd36,_0x663a('0xb'),JSON[_0x663a('0xe')](_0x12ee7a));if(_0x12ee7a[_0x663a('0xf')]){if(_0x12ee7a['error'][_0x663a('0x10')]===0x1f4){logger[_0x663a('0xf')](_0x663a('0x11'),_0x3ecd36,_0x12ee7a['error'][_0x663a('0x12')]);return _0x1ffc19(_0x12ee7a['error']['message']);}logger[_0x663a('0xf')](_0x663a('0x11'),_0x3ecd36,_0x12ee7a[_0x663a('0xf')][_0x663a('0x12')]);return _0x1b5ea9(_0x12ee7a['error'][_0x663a('0x12')]);}else{logger[_0x663a('0xa')](_0x663a('0x11'),_0x3ecd36,_0x663a('0xb'));_0x1b5ea9(_0x12ee7a[_0x663a('0x13')]['message']);}})[_0x663a('0x14')](function(_0x227d99){logger[_0x663a('0xf')](_0x663a('0x11'),_0x3ecd36,_0x227d99);_0x1ffc19(_0x227d99);});});} \ No newline at end of file +var _0x69d6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x258b8c,_0x432d66){var _0x551264=function(_0x53fd4e){while(--_0x53fd4e){_0x258b8c['push'](_0x258b8c['shift']());}};_0x551264(++_0x432d66);}(_0x69d6,0xba));var _0x669d=function(_0x34e747,_0x173163){_0x34e747=_0x34e747-0x0;var _0x200a90=_0x69d6[_0x34e747];return _0x200a90;};'use strict';var _=require('lodash');var util=require(_0x669d('0x0'));var moment=require(_0x669d('0x1'));var BPromise=require(_0x669d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x669d('0x3'));var db=require(_0x669d('0x4'))['db'];var utils=require(_0x669d('0x5'));var logger=require(_0x669d('0x6'))('rpc');var config=require(_0x669d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x669d('0x8')][_0x669d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aef19,_0x3718d7,_0x4b11a0){return new BPromise(function(_0x4d1421,_0x2d7759){return client['request'](_0x1aef19,_0x4b11a0)[_0x669d('0xa')](function(_0x424bb1){logger[_0x669d('0xb')](_0x669d('0xc'),_0x3718d7,_0x669d('0xd'));logger[_0x669d('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3718d7,_0x669d('0xd'),JSON[_0x669d('0xf')](_0x424bb1));if(_0x424bb1[_0x669d('0x10')]){if(_0x424bb1['error'][_0x669d('0x11')]===0x1f4){logger[_0x669d('0x10')](_0x669d('0xc'),_0x3718d7,_0x424bb1[_0x669d('0x10')][_0x669d('0x12')]);return _0x2d7759(_0x424bb1[_0x669d('0x10')][_0x669d('0x12')]);}logger[_0x669d('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3718d7,_0x424bb1[_0x669d('0x10')][_0x669d('0x12')]);return _0x4d1421(_0x424bb1['error']['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3718d7,'request\x20sent');_0x4d1421(_0x424bb1[_0x669d('0x13')]['message']);}})[_0x669d('0x14')](function(_0x5817ca){logger['error'](_0x669d('0xc'),_0x3718d7,_0x5817ca);_0x2d7759(_0x5817ca);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b090e45..d29f742 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 _0xe6c1=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x198da7,_0x7e699b){var _0x55749c=function(_0x55bb28){while(--_0x55bb28){_0x198da7['push'](_0x198da7['shift']());}};_0x55749c(++_0x7e699b);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x1e6c('0x0'));var path=require(_0x1e6c('0x1'));var timeout=require(_0x1e6c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e6c('0x3'));var auth=require(_0x1e6c('0x4'));var interaction=require(_0x1e6c('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1e6c('0x6')]);router[_0x1e6c('0x7')](_0x1e6c('0x8'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xa')]);router[_0x1e6c('0xb')]('/',auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xc')]);router[_0x1e6c('0xd')](_0x1e6c('0x8'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xe')]);router[_0x1e6c('0xf')](_0x1e6c('0x8'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0x10')]);module[_0x1e6c('0x11')]=router; \ No newline at end of file +var _0xcb18=['/:id','update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','post','put'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xcb18,0x159));var _0x8cb1=function(_0x5430e2,_0x498079){_0x5430e2=_0x5430e2-0x0;var _0x140ad4=_0xcb18[_0x5430e2];return _0x140ad4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var fs_extra=require(_0x8cb1('0x2'));var auth=require(_0x8cb1('0x3'));var interaction=require(_0x8cb1('0x4'));var config=require(_0x8cb1('0x5'));var controller=require(_0x8cb1('0x6'));router[_0x8cb1('0x7')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0x8')]);router[_0x8cb1('0x7')]('/:id',auth[_0x8cb1('0x9')](),controller['show']);router[_0x8cb1('0xa')]('/',auth[_0x8cb1('0x9')](),controller['create']);router[_0x8cb1('0xb')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xd')]);router[_0x8cb1('0xe')]('/:id',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xf')]);module[_0x8cb1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 7f7a4fe..d5564fd 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 _0x5376=['variable','customVariable','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5376,0x16a));var _0x6537=function(_0x188edb,_0x19fed6){_0x188edb=_0x188edb-0x0;var _0x669a3d=_0x5376[_0x188edb];return _0x669a3d;};'use strict';var Sequelize=require(_0x6537('0x0'));module[_0x6537('0x1')]={'type':{'type':Sequelize[_0x6537('0x2')](_0x6537('0x3'),'variable','customVariable',_0x6537('0x4'),_0x6537('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6537('0x6')]},'key':{'type':Sequelize[_0x6537('0x6')]},'keyType':{'type':Sequelize[_0x6537('0x2')](_0x6537('0x3'),_0x6537('0x7'),_0x6537('0x8'))},'keyContent':{'type':Sequelize[_0x6537('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6537('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6537('0x6')]}}; \ No newline at end of file +var _0x393e=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x58a71a,_0x4b4381){var _0x1ca2da=function(_0x292e5d){while(--_0x292e5d){_0x58a71a['push'](_0x58a71a['shift']());}};_0x1ca2da(++_0x4b4381);}(_0x393e,0x12d));var _0xe393=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x393e[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0xe393('0x0'));module[_0xe393('0x1')]={'type':{'type':Sequelize[_0xe393('0x2')](_0xe393('0x3'),_0xe393('0x4'),_0xe393('0x5'),_0xe393('0x6'),_0xe393('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe393('0x8')]},'key':{'type':Sequelize[_0xe393('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xe393('0x3'),_0xe393('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xe393('0x8')]},'idField':{'type':Sequelize[_0xe393('0x8')]},'nameField':{'type':Sequelize[_0xe393('0x8')]},'customField':{'type':Sequelize[_0xe393('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe393('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e1dac3e..36dded9 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 _0x2436=['sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','error','name','fieldName','type','key','query','intersection','model','attributes','length','hasOwnProperty','nolimit','filters','pick','filter','where','map','VIRTUAL','FreshsalesField','includeAll','include','rows','params','keys','fields','merge','options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x2436,0xc2));var _0x6243=function(_0x17fc47,_0x59522a){_0x17fc47=_0x17fc47-0x0;var _0x4d5c09=_0x2436[_0x17fc47];return _0x4d5c09;};'use strict';var emlformat=require(_0x6243('0x0'));var rimraf=require(_0x6243('0x1'));var zipdir=require(_0x6243('0x2'));var jsonpatch=require(_0x6243('0x3'));var rp=require('request-promise');var moment=require(_0x6243('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6243('0x5'));var util=require(_0x6243('0x6'));var path=require('path');var sox=require(_0x6243('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6243('0x8'));var _=require(_0x6243('0x9'));var squel=require('squel');var crypto=require(_0x6243('0xa'));var jsforce=require(_0x6243('0xb'));var deskjs=require(_0x6243('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6243('0xd'));var Papa=require(_0x6243('0xe'));var Redis=require(_0x6243('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6243('0x10'));var as=require(_0x6243('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6243('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6243('0x13'));var licenseUtil=require(_0x6243('0x14'));var db=require(_0x6243('0x15'))['db'];function respondWithStatusCode(_0x4f002f,_0x292b7a){_0x292b7a=_0x292b7a||0xcc;return function(_0x221a36){if(_0x221a36){return _0x4f002f[_0x6243('0x16')](_0x292b7a);}return _0x4f002f[_0x6243('0x17')](_0x292b7a)['end']();};}function respondWithResult(_0x5e947e,_0x31df52){_0x31df52=_0x31df52||0xc8;return function(_0x4ffc1a){if(_0x4ffc1a){return _0x5e947e[_0x6243('0x17')](_0x31df52)[_0x6243('0x18')](_0x4ffc1a);}};}function respondWithFilteredResult(_0x44a1af,_0x2ef986){return function(_0x5617be){if(_0x5617be){var _0x48c3f0=typeof _0x2ef986[_0x6243('0x19')]===_0x6243('0x1a')&&typeof _0x2ef986[_0x6243('0x1b')]===_0x6243('0x1a');var _0x5ed94c=_0x5617be[_0x6243('0x1c')];var _0x112f96=_0x48c3f0?0x0:_0x2ef986[_0x6243('0x19')];var _0x3ccbea=_0x48c3f0?_0x5617be[_0x6243('0x1c')]:_0x2ef986['offset']+_0x2ef986[_0x6243('0x1b')];var _0x29845d;if(_0x3ccbea>=_0x5ed94c){_0x3ccbea=_0x5ed94c;_0x29845d=0xc8;}else{_0x29845d=0xce;}_0x44a1af['status'](_0x29845d);return _0x44a1af['set']('Content-Range',_0x112f96+'-'+_0x3ccbea+'/'+_0x5ed94c)[_0x6243('0x18')](_0x5617be);}return null;};}function patchUpdates(_0x2cc5cd){return function(_0x2c9b40){try{jsonpatch[_0x6243('0x1d')](_0x2c9b40,_0x2cc5cd,!![]);}catch(_0x36c9d2){return BPromise[_0x6243('0x1e')](_0x36c9d2);}return _0x2c9b40[_0x6243('0x1f')]();};}function saveUpdates(_0x257e0d,_0x4d0bf1){return function(_0xebc23c){if(_0xebc23c){return _0xebc23c[_0x6243('0x20')](_0x257e0d)[_0x6243('0x21')](function(_0x3e0b6d){return _0x3e0b6d;});}return null;};}function removeEntity(_0x3442e6,_0x923172){return function(_0x37481e){if(_0x37481e){return _0x37481e[_0x6243('0x22')]()['then'](function(){_0x3442e6[_0x6243('0x17')](0xcc)[_0x6243('0x23')]();});}};}function handleEntityNotFound(_0x386010,_0x1f6230){return function(_0x1678c5){if(!_0x1678c5){_0x386010[_0x6243('0x16')](0x194);}return _0x1678c5;};}function handleError(_0x3c8942,_0x557457){_0x557457=_0x557457||0x1f4;return function(_0xfcac35){logger[_0x6243('0x24')](_0xfcac35['stack']);if(_0xfcac35[_0x6243('0x25')]){delete _0xfcac35[_0x6243('0x25')];}_0x3c8942[_0x6243('0x17')](_0x557457)['send'](_0xfcac35);};}exports['index']=function(_0x3c5836,_0x12a0ea){var _0x54484a={},_0x2b1efc={},_0x5b10b7={'count':0x0,'rows':[]};var _0x29f1bb=_['map'](db['FreshsalesField']['rawAttributes'],function(_0xca8248){return{'name':_0xca8248[_0x6243('0x26')],'type':_0xca8248[_0x6243('0x27')][_0x6243('0x28')]};});_0x2b1efc['model']=_['map'](_0x29f1bb,_0x6243('0x25'));_0x2b1efc[_0x6243('0x29')]=_['keys'](_0x3c5836[_0x6243('0x29')]);_0x2b1efc['filters']=_[_0x6243('0x2a')](_0x2b1efc[_0x6243('0x2b')],_0x2b1efc[_0x6243('0x29')]);_0x54484a[_0x6243('0x2c')]=_[_0x6243('0x2a')](_0x2b1efc[_0x6243('0x2b')],qs['fields'](_0x3c5836[_0x6243('0x29')]['fields']));_0x54484a['attributes']=_0x54484a[_0x6243('0x2c')][_0x6243('0x2d')]?_0x54484a[_0x6243('0x2c')]:_0x2b1efc[_0x6243('0x2b')];if(!_0x3c5836[_0x6243('0x29')][_0x6243('0x2e')](_0x6243('0x2f'))){_0x54484a[_0x6243('0x1b')]=qs[_0x6243('0x1b')](_0x3c5836[_0x6243('0x29')]['limit']);_0x54484a[_0x6243('0x19')]=qs[_0x6243('0x19')](_0x3c5836['query'][_0x6243('0x19')]);}_0x54484a['order']=qs['sort'](_0x3c5836[_0x6243('0x29')]['sort']);_0x54484a['where']=qs[_0x6243('0x30')](_[_0x6243('0x31')](_0x3c5836[_0x6243('0x29')],_0x2b1efc[_0x6243('0x30')]),_0x29f1bb);if(_0x3c5836[_0x6243('0x29')][_0x6243('0x32')]){_0x54484a[_0x6243('0x33')]=_['merge'](_0x54484a['where'],{'$or':_[_0x6243('0x34')](_0x29f1bb,function(_0x365d99){if(_0x365d99[_0x6243('0x27')]!==_0x6243('0x35')){var _0x53cc04={};_0x53cc04[_0x365d99[_0x6243('0x25')]]={'$like':'%'+_0x3c5836[_0x6243('0x29')][_0x6243('0x32')]+'%'};return _0x53cc04;}})});}_0x54484a=_['merge']({},_0x54484a,_0x3c5836['options']);var _0x239589={'where':_0x54484a['where']};return db[_0x6243('0x36')]['count'](_0x239589)[_0x6243('0x21')](function(_0x52900f){_0x5b10b7[_0x6243('0x1c')]=_0x52900f;if(_0x3c5836[_0x6243('0x29')][_0x6243('0x37')]){_0x54484a[_0x6243('0x38')]=[{'all':!![]}];}return db[_0x6243('0x36')]['findAll'](_0x54484a);})[_0x6243('0x21')](function(_0x3a23ac){_0x5b10b7[_0x6243('0x39')]=_0x3a23ac;return _0x5b10b7;})[_0x6243('0x21')](respondWithFilteredResult(_0x12a0ea,_0x54484a))['catch'](handleError(_0x12a0ea,null));};exports['show']=function(_0x567ab4,_0x2a34cc){var _0x32329d={'raw':!![],'where':{'id':_0x567ab4[_0x6243('0x3a')]['id']}},_0xfa7411={};_0xfa7411['model']=_[_0x6243('0x3b')](db[_0x6243('0x36')]['rawAttributes']);_0xfa7411[_0x6243('0x29')]=_['keys'](_0x567ab4['query']);_0xfa7411[_0x6243('0x30')]=_[_0x6243('0x2a')](_0xfa7411['model'],_0xfa7411[_0x6243('0x29')]);_0x32329d[_0x6243('0x2c')]=_[_0x6243('0x2a')](_0xfa7411['model'],qs[_0x6243('0x3c')](_0x567ab4[_0x6243('0x29')][_0x6243('0x3c')]));_0x32329d['attributes']=_0x32329d[_0x6243('0x2c')][_0x6243('0x2d')]?_0x32329d[_0x6243('0x2c')]:_0xfa7411[_0x6243('0x2b')];if(_0x567ab4[_0x6243('0x29')]['includeAll']){_0x32329d[_0x6243('0x38')]=[{'all':!![]}];}_0x32329d=_[_0x6243('0x3d')]({},_0x32329d,_0x567ab4[_0x6243('0x3e')]);return db['FreshsalesField'][_0x6243('0x3f')](_0x32329d)[_0x6243('0x21')](handleEntityNotFound(_0x2a34cc,null))[_0x6243('0x21')](respondWithResult(_0x2a34cc,null))['catch'](handleError(_0x2a34cc,null));};exports[_0x6243('0x40')]=function(_0x4d9aaa,_0x1d61ca){return db[_0x6243('0x36')][_0x6243('0x40')](_0x4d9aaa['body'],{})[_0x6243('0x21')](respondWithResult(_0x1d61ca,0xc9))['catch'](handleError(_0x1d61ca,null));};exports[_0x6243('0x20')]=function(_0x1b814b,_0x152376){if(_0x1b814b[_0x6243('0x41')]['id']){delete _0x1b814b[_0x6243('0x41')]['id'];}return db[_0x6243('0x36')][_0x6243('0x3f')]({'where':{'id':_0x1b814b[_0x6243('0x3a')]['id']}})['then'](handleEntityNotFound(_0x152376,null))[_0x6243('0x21')](saveUpdates(_0x1b814b['body'],null))['then'](respondWithResult(_0x152376,null))[_0x6243('0x42')](handleError(_0x152376,null));};exports[_0x6243('0x22')]=function(_0x1be8fe,_0x3e15ca){return db[_0x6243('0x36')][_0x6243('0x3f')]({'where':{'id':_0x1be8fe['params']['id']}})['then'](handleEntityNotFound(_0x3e15ca,null))['then'](removeEntity(_0x3e15ca,null))[_0x6243('0x42')](handleError(_0x3e15ca,null));}; \ No newline at end of file +var _0xa682=['stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','error'];(function(_0x3acb90,_0x4ae1fa){var _0x28ee31=function(_0x5094db){while(--_0x5094db){_0x3acb90['push'](_0x3acb90['shift']());}};_0x28ee31(++_0x4ae1fa);}(_0xa682,0x1b1));var _0x2a68=function(_0x14fe54,_0x5b0e57){_0x14fe54=_0x14fe54-0x0;var _0x20e050=_0xa682[_0x14fe54];return _0x20e050;};'use strict';var emlformat=require(_0x2a68('0x0'));var rimraf=require(_0x2a68('0x1'));var zipdir=require(_0x2a68('0x2'));var jsonpatch=require(_0x2a68('0x3'));var rp=require(_0x2a68('0x4'));var moment=require('moment');var BPromise=require(_0x2a68('0x5'));var Mustache=require(_0x2a68('0x6'));var util=require(_0x2a68('0x7'));var path=require(_0x2a68('0x8'));var sox=require('sox');var csv=require(_0x2a68('0x9'));var ejs=require(_0x2a68('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a68('0xb'));var squel=require(_0x2a68('0xc'));var crypto=require(_0x2a68('0xd'));var jsforce=require(_0x2a68('0xe'));var deskjs=require(_0x2a68('0xf'));var toCsv=require(_0x2a68('0x9'));var querystring=require(_0x2a68('0x10'));var Papa=require(_0x2a68('0x11'));var Redis=require(_0x2a68('0x12'));var authService=require(_0x2a68('0x13'));var qs=require(_0x2a68('0x14'));var as=require(_0x2a68('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a68('0x16'));var utils=require(_0x2a68('0x17'));var config=require(_0x2a68('0x18'));var licenseUtil=require(_0x2a68('0x19'));var db=require(_0x2a68('0x1a'))['db'];function respondWithStatusCode(_0x1e5bc7,_0x271986){_0x271986=_0x271986||0xcc;return function(_0x527895){if(_0x527895){return _0x1e5bc7[_0x2a68('0x1b')](_0x271986);}return _0x1e5bc7[_0x2a68('0x1c')](_0x271986)['end']();};}function respondWithResult(_0x1d8322,_0x137910){_0x137910=_0x137910||0xc8;return function(_0x4819fb){if(_0x4819fb){return _0x1d8322[_0x2a68('0x1c')](_0x137910)[_0x2a68('0x1d')](_0x4819fb);}};}function respondWithFilteredResult(_0x2911cd,_0x4c2400){return function(_0x25c4e2){if(_0x25c4e2){var _0x3aa843=typeof _0x4c2400['offset']===_0x2a68('0x1e')&&typeof _0x4c2400[_0x2a68('0x1f')]==='undefined';var _0x5595e3=_0x25c4e2[_0x2a68('0x20')];var _0x51b199=_0x3aa843?0x0:_0x4c2400[_0x2a68('0x21')];var _0x44c385=_0x3aa843?_0x25c4e2[_0x2a68('0x20')]:_0x4c2400['offset']+_0x4c2400[_0x2a68('0x1f')];var _0x1597bb;if(_0x44c385>=_0x5595e3){_0x44c385=_0x5595e3;_0x1597bb=0xc8;}else{_0x1597bb=0xce;}_0x2911cd['status'](_0x1597bb);return _0x2911cd[_0x2a68('0x22')]('Content-Range',_0x51b199+'-'+_0x44c385+'/'+_0x5595e3)['json'](_0x25c4e2);}return null;};}function patchUpdates(_0x164ecc){return function(_0x1a9281){try{jsonpatch[_0x2a68('0x23')](_0x1a9281,_0x164ecc,!![]);}catch(_0xe8a433){return BPromise[_0x2a68('0x24')](_0xe8a433);}return _0x1a9281['save']();};}function saveUpdates(_0x3cf592,_0x199836){return function(_0x425371){if(_0x425371){return _0x425371[_0x2a68('0x25')](_0x3cf592)['then'](function(_0x1fb1a8){return _0x1fb1a8;});}return null;};}function removeEntity(_0x3b7ec2,_0x52a2e7){return function(_0x4bef2c){if(_0x4bef2c){return _0x4bef2c[_0x2a68('0x26')]()[_0x2a68('0x27')](function(){_0x3b7ec2[_0x2a68('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5254b0,_0x15f790){return function(_0x2c1a87){if(!_0x2c1a87){_0x5254b0[_0x2a68('0x1b')](0x194);}return _0x2c1a87;};}function handleError(_0x28cd97,_0x1e4f90){_0x1e4f90=_0x1e4f90||0x1f4;return function(_0x55a935){logger[_0x2a68('0x28')](_0x55a935[_0x2a68('0x29')]);if(_0x55a935[_0x2a68('0x2a')]){delete _0x55a935[_0x2a68('0x2a')];}_0x28cd97[_0x2a68('0x1c')](_0x1e4f90)[_0x2a68('0x2b')](_0x55a935);};}exports[_0x2a68('0x2c')]=function(_0x113407,_0x5a0e1a){var _0x56bf01={},_0x598253={},_0x4dd441={'count':0x0,'rows':[]};var _0x377fba=_[_0x2a68('0x2d')](db[_0x2a68('0x2e')][_0x2a68('0x2f')],function(_0x32e5fb){return{'name':_0x32e5fb[_0x2a68('0x30')],'type':_0x32e5fb[_0x2a68('0x31')][_0x2a68('0x32')]};});_0x598253[_0x2a68('0x33')]=_[_0x2a68('0x2d')](_0x377fba,_0x2a68('0x2a'));_0x598253[_0x2a68('0x34')]=_[_0x2a68('0x35')](_0x113407[_0x2a68('0x34')]);_0x598253[_0x2a68('0x36')]=_[_0x2a68('0x37')](_0x598253[_0x2a68('0x33')],_0x598253[_0x2a68('0x34')]);_0x56bf01['attributes']=_['intersection'](_0x598253[_0x2a68('0x33')],qs[_0x2a68('0x38')](_0x113407[_0x2a68('0x34')][_0x2a68('0x38')]));_0x56bf01[_0x2a68('0x39')]=_0x56bf01[_0x2a68('0x39')][_0x2a68('0x3a')]?_0x56bf01[_0x2a68('0x39')]:_0x598253[_0x2a68('0x33')];if(!_0x113407[_0x2a68('0x34')][_0x2a68('0x3b')](_0x2a68('0x3c'))){_0x56bf01[_0x2a68('0x1f')]=qs[_0x2a68('0x1f')](_0x113407[_0x2a68('0x34')][_0x2a68('0x1f')]);_0x56bf01[_0x2a68('0x21')]=qs[_0x2a68('0x21')](_0x113407[_0x2a68('0x34')][_0x2a68('0x21')]);}_0x56bf01[_0x2a68('0x3d')]=qs[_0x2a68('0x3e')](_0x113407[_0x2a68('0x34')][_0x2a68('0x3e')]);_0x56bf01[_0x2a68('0x3f')]=qs['filters'](_[_0x2a68('0x40')](_0x113407[_0x2a68('0x34')],_0x598253['filters']),_0x377fba);if(_0x113407[_0x2a68('0x34')][_0x2a68('0x41')]){_0x56bf01[_0x2a68('0x3f')]=_['merge'](_0x56bf01[_0x2a68('0x3f')],{'$or':_['map'](_0x377fba,function(_0x657bdc){if(_0x657bdc[_0x2a68('0x31')]!==_0x2a68('0x42')){var _0x35c3b5={};_0x35c3b5[_0x657bdc[_0x2a68('0x2a')]]={'$like':'%'+_0x113407[_0x2a68('0x34')][_0x2a68('0x41')]+'%'};return _0x35c3b5;}})});}_0x56bf01=_[_0x2a68('0x43')]({},_0x56bf01,_0x113407[_0x2a68('0x44')]);var _0x55e434={'where':_0x56bf01['where']};return db[_0x2a68('0x2e')][_0x2a68('0x20')](_0x55e434)[_0x2a68('0x27')](function(_0x5bc6f7){_0x4dd441['count']=_0x5bc6f7;if(_0x113407['query'][_0x2a68('0x45')]){_0x56bf01[_0x2a68('0x46')]=[{'all':!![]}];}return db[_0x2a68('0x2e')][_0x2a68('0x47')](_0x56bf01);})[_0x2a68('0x27')](function(_0x5c13d5){_0x4dd441[_0x2a68('0x48')]=_0x5c13d5;return _0x4dd441;})[_0x2a68('0x27')](respondWithFilteredResult(_0x5a0e1a,_0x56bf01))[_0x2a68('0x49')](handleError(_0x5a0e1a,null));};exports[_0x2a68('0x4a')]=function(_0x270d8f,_0xa9a93e){var _0x45e5db={'raw':!![],'where':{'id':_0x270d8f[_0x2a68('0x4b')]['id']}},_0x7fdcde={};_0x7fdcde[_0x2a68('0x33')]=_[_0x2a68('0x35')](db['FreshsalesField'][_0x2a68('0x2f')]);_0x7fdcde[_0x2a68('0x34')]=_[_0x2a68('0x35')](_0x270d8f[_0x2a68('0x34')]);_0x7fdcde[_0x2a68('0x36')]=_[_0x2a68('0x37')](_0x7fdcde['model'],_0x7fdcde['query']);_0x45e5db[_0x2a68('0x39')]=_[_0x2a68('0x37')](_0x7fdcde[_0x2a68('0x33')],qs[_0x2a68('0x38')](_0x270d8f[_0x2a68('0x34')][_0x2a68('0x38')]));_0x45e5db[_0x2a68('0x39')]=_0x45e5db[_0x2a68('0x39')]['length']?_0x45e5db[_0x2a68('0x39')]:_0x7fdcde[_0x2a68('0x33')];if(_0x270d8f[_0x2a68('0x34')][_0x2a68('0x45')]){_0x45e5db[_0x2a68('0x46')]=[{'all':!![]}];}_0x45e5db=_['merge']({},_0x45e5db,_0x270d8f[_0x2a68('0x44')]);return db[_0x2a68('0x2e')]['find'](_0x45e5db)[_0x2a68('0x27')](handleEntityNotFound(_0xa9a93e,null))[_0x2a68('0x27')](respondWithResult(_0xa9a93e,null))[_0x2a68('0x49')](handleError(_0xa9a93e,null));};exports[_0x2a68('0x4c')]=function(_0x5947d5,_0x334524){return db['FreshsalesField']['create'](_0x5947d5[_0x2a68('0x4d')],{})[_0x2a68('0x27')](respondWithResult(_0x334524,0xc9))[_0x2a68('0x49')](handleError(_0x334524,null));};exports[_0x2a68('0x25')]=function(_0x5ae7c6,_0x2abcc8){if(_0x5ae7c6[_0x2a68('0x4d')]['id']){delete _0x5ae7c6['body']['id'];}return db['FreshsalesField'][_0x2a68('0x4e')]({'where':{'id':_0x5ae7c6[_0x2a68('0x4b')]['id']}})[_0x2a68('0x27')](handleEntityNotFound(_0x2abcc8,null))[_0x2a68('0x27')](saveUpdates(_0x5ae7c6[_0x2a68('0x4d')],null))[_0x2a68('0x27')](respondWithResult(_0x2abcc8,null))[_0x2a68('0x49')](handleError(_0x2abcc8,null));};exports[_0x2a68('0x26')]=function(_0x20e608,_0x377a08){return db[_0x2a68('0x2e')][_0x2a68('0x4e')]({'where':{'id':_0x20e608[_0x2a68('0x4b')]['id']}})[_0x2a68('0x27')](handleEntityNotFound(_0x377a08,null))[_0x2a68('0x27')](removeEntity(_0x377a08,null))[_0x2a68('0x49')](handleError(_0x377a08,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 035e2a6..f69aa77 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 _0xe797=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','FieldId','lodash'];(function(_0x1b7e0c,_0x318d81){var _0x20548d=function(_0x480f97){while(--_0x480f97){_0x1b7e0c['push'](_0x1b7e0c['shift']());}};_0x20548d(++_0x318d81);}(_0xe797,0x12a));var _0x7e79=function(_0x1d0f92,_0x24f91e){_0x1d0f92=_0x1d0f92-0x0;var _0x3de1d4=_0xe797[_0x1d0f92];return _0x3de1d4;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var logger=require(_0x7e79('0x2'))(_0x7e79('0x3'));var moment=require(_0x7e79('0x4'));var BPromise=require(_0x7e79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e79('0x6'));var rimraf=require(_0x7e79('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e79('0x8'));module[_0x7e79('0x9')]=function(_0x3cd4c9,_0x48a8c1){return _0x3cd4c9['define'](_0x7e79('0xa'),attributes,{'tableName':_0x7e79('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x7e79('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['moment','bluebird','request-promise','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api'];(function(_0x4f352c,_0x237f98){var _0x314299=function(_0x409d19){while(--_0x409d19){_0x4f352c['push'](_0x4f352c['shift']());}};_0x314299(++_0x237f98);}(_0x42f4,0x19d));var _0x442f=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x42f4[_0x3e32a8];return _0x2997b0;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[{'name':_0x442f('0xb'),'fields':[_0x442f('0xc'),'FieldId'],'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 b3a32e5..d2d5ced 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x28f0b6,_0x290a14){var _0x44156e=function(_0x4e57de){while(--_0x4e57de){_0x28f0b6['push'](_0x28f0b6['shift']());}};_0x44156e(++_0x290a14);}(_0x5fab,0x177));var _0xb5fa=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x5fab[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30fe18,_0x484547){var _0x1ada0c=function(_0x21c49f){while(--_0x21c49f){_0x30fe18['push'](_0x30fe18['shift']());}};_0x1ada0c(++_0x484547);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xb6d425,_0x417efb){_0xb6d425=_0xb6d425-0x0;var _0x5cd63f=_0xc6ac[_0xb6d425];return _0x5cd63f;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 349bbc4..d3007d2 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(_0x4cb47f,_0x5dadb0){var _0x218dc5=function(_0x5dccc0){while(--_0x5dccc0){_0x4cb47f['push'](_0x4cb47f['shift']());}};_0x218dc5(++_0x5dadb0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x251912,_0x1f09db){var _0xc7df1b=function(_0x1d18a8){while(--_0x1d18a8){_0x251912['push'](_0x251912['shift']());}};_0xc7df1b(++_0x1f09db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ef9e17f..839162f 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 _0xe1d7=['exports','username','STRING','ENUM','integrationTab'];(function(_0x236218,_0x1b6116){var _0x4f0334=function(_0x4eab3f){while(--_0x4eab3f){_0x236218['push'](_0x236218['shift']());}};_0x4f0334(++_0x1b6116);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x3e3255,_0x485196){_0x3e3255=_0x3e3255-0x0;var _0x57368e=_0xe1d7[_0x3e3255];return _0x57368e;};'use strict';var Sequelize=require('sequelize');module[_0x7e1d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x7e1d('0x1')},'remoteUri':{'type':Sequelize[_0x7e1d('0x2')]},'password':{'type':Sequelize[_0x7e1d('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7e1d('0x2')]},'securityToken':{'type':Sequelize[_0x7e1d('0x2')]},'serverUrl':{'type':Sequelize[_0x7e1d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7e1d('0x3')](_0x7e1d('0x4'),'newTab'),'defaultValue':_0x7e1d('0x4')}}; \ No newline at end of file +var _0x6d5e=['exports','STRING','username','integrationTab','sequelize'];(function(_0x513267,_0x16cde5){var _0x459d3d=function(_0x4b5398){while(--_0x4b5398){_0x513267['push'](_0x513267['shift']());}};_0x459d3d(++_0x16cde5);}(_0x6d5e,0x103));var _0xe6d5=function(_0x5475f5,_0x276a2c){_0x5475f5=_0x5475f5-0x0;var _0x3df5d8=_0x6d5e[_0x5475f5];return _0x3df5d8;};'use strict';var Sequelize=require(_0xe6d5('0x0'));module[_0xe6d5('0x1')]={'name':{'type':Sequelize[_0xe6d5('0x2')]},'description':{'type':Sequelize[_0xe6d5('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe6d5('0x3')},'remoteUri':{'type':Sequelize[_0xe6d5('0x2')]},'password':{'type':Sequelize[_0xe6d5('0x2')]},'clientId':{'type':Sequelize[_0xe6d5('0x2')]},'clientSecret':{'type':Sequelize[_0xe6d5('0x2')]},'securityToken':{'type':Sequelize[_0xe6d5('0x2')]},'serverUrl':{'type':Sequelize[_0xe6d5('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe6d5('0x4'),'newTab'),'defaultValue':_0xe6d5('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0c834f9..ed43728 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 _0xba61=['Description','string','picklist','email','textarea','remove','includes','label','custom','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject'];(function(_0x303a07,_0x403a93){var _0x10cfd7=function(_0x1535f2){while(--_0x1535f2){_0x303a07['push'](_0x303a07['shift']());}};_0x10cfd7(++_0x403a93);}(_0xba61,0x11a));var _0x1ba6=function(_0x3cd152,_0x31a1c9){_0x3cd152=_0x3cd152-0x0;var _0x37d28c=_0xba61[_0x3cd152];return _0x37d28c;};'use strict';var emlformat=require(_0x1ba6('0x0'));var rimraf=require(_0x1ba6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ba6('0x2'));var rp=require(_0x1ba6('0x3'));var moment=require(_0x1ba6('0x4'));var BPromise=require(_0x1ba6('0x5'));var Mustache=require(_0x1ba6('0x6'));var util=require(_0x1ba6('0x7'));var path=require(_0x1ba6('0x8'));var sox=require(_0x1ba6('0x9'));var csv=require(_0x1ba6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ba6('0xb'));var _=require(_0x1ba6('0xc'));var squel=require(_0x1ba6('0xd'));var crypto=require('crypto');var jsforce=require(_0x1ba6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ba6('0xf'));var Papa=require(_0x1ba6('0x10'));var Redis=require(_0x1ba6('0x11'));var authService=require(_0x1ba6('0x12'));var qs=require(_0x1ba6('0x13'));var as=require(_0x1ba6('0x14'));var hardwareService=require(_0x1ba6('0x15'));var logger=require(_0x1ba6('0x16'))(_0x1ba6('0x17'));var utils=require(_0x1ba6('0x18'));var config=require(_0x1ba6('0x19'));var licenseUtil=require(_0x1ba6('0x1a'));var db=require(_0x1ba6('0x1b'))['db'];var integrations=require(_0x1ba6('0x1c'));function respondWithStatusCode(_0x272fe0,_0x36f05f){_0x36f05f=_0x36f05f||0xcc;return function(_0x21bc1c){if(_0x21bc1c){return _0x272fe0[_0x1ba6('0x1d')](_0x36f05f);}return _0x272fe0[_0x1ba6('0x1e')](_0x36f05f)['end']();};}function respondWithResult(_0x5bf1ab,_0x4fa1ca){_0x4fa1ca=_0x4fa1ca||0xc8;return function(_0x540c71){if(_0x540c71){return _0x5bf1ab[_0x1ba6('0x1e')](_0x4fa1ca)['json'](_0x540c71);}};}function respondWithFilteredResult(_0x567327,_0x1b6e0c){return function(_0x13abae){if(_0x13abae){var _0x4fcc00=typeof _0x1b6e0c[_0x1ba6('0x1f')]===_0x1ba6('0x20')&&typeof _0x1b6e0c[_0x1ba6('0x21')]===_0x1ba6('0x20');var _0x23d062=_0x13abae[_0x1ba6('0x22')];var _0x2e9b78=_0x4fcc00?0x0:_0x1b6e0c['offset'];var _0x426d83=_0x4fcc00?_0x13abae[_0x1ba6('0x22')]:_0x1b6e0c['offset']+_0x1b6e0c[_0x1ba6('0x21')];var _0x3f9a09;if(_0x426d83>=_0x23d062){_0x426d83=_0x23d062;_0x3f9a09=0xc8;}else{_0x3f9a09=0xce;}_0x567327['status'](_0x3f9a09);return _0x567327['set'](_0x1ba6('0x23'),_0x2e9b78+'-'+_0x426d83+'/'+_0x23d062)[_0x1ba6('0x24')](_0x13abae);}return null;};}function patchUpdates(_0x57a969){return function(_0x49b989){try{jsonpatch[_0x1ba6('0x25')](_0x49b989,_0x57a969,!![]);}catch(_0x3dffc5){return BPromise[_0x1ba6('0x26')](_0x3dffc5);}return _0x49b989[_0x1ba6('0x27')]();};}function saveUpdates(_0x5cfda6,_0x2afe94){return function(_0x3f86c3){if(_0x3f86c3){return _0x3f86c3['update'](_0x5cfda6)[_0x1ba6('0x28')](function(_0x9b91b6){return _0x9b91b6;});}return null;};}function removeEntity(_0x4984d9,_0x4f0165){return function(_0x32d5c0){if(_0x32d5c0){return _0x32d5c0[_0x1ba6('0x29')]()['then'](function(){_0x4984d9[_0x1ba6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44fe55,_0x58dc9c){return function(_0x4612f8){if(!_0x4612f8){_0x44fe55['sendStatus'](0x194);}return _0x4612f8;};}function handleError(_0x1ab669,_0x4d8943){_0x4d8943=_0x4d8943||0x1f4;return function(_0x282c42){logger[_0x1ba6('0x2a')](_0x282c42[_0x1ba6('0x2b')]);if(_0x282c42['name']){delete _0x282c42[_0x1ba6('0x2c')];}_0x1ab669[_0x1ba6('0x1e')](_0x4d8943)[_0x1ba6('0x2d')](_0x282c42);};}exports['index']=function(_0x12bc51,_0x19c8a6){var _0x19a265={},_0x2279d4={},_0x4a67b5={'count':0x0,'rows':[]};var _0x138af3=_[_0x1ba6('0x2e')](db[_0x1ba6('0x2f')][_0x1ba6('0x30')],function(_0x5fee24){return{'name':_0x5fee24[_0x1ba6('0x31')],'type':_0x5fee24['type'][_0x1ba6('0x32')]};});_0x2279d4['model']=_[_0x1ba6('0x2e')](_0x138af3,'name');_0x2279d4[_0x1ba6('0x33')]=_[_0x1ba6('0x34')](_0x12bc51[_0x1ba6('0x33')]);_0x2279d4[_0x1ba6('0x35')]=_[_0x1ba6('0x36')](_0x2279d4[_0x1ba6('0x37')],_0x2279d4[_0x1ba6('0x33')]);_0x19a265[_0x1ba6('0x38')]=_[_0x1ba6('0x36')](_0x2279d4['model'],qs[_0x1ba6('0x39')](_0x12bc51[_0x1ba6('0x33')][_0x1ba6('0x39')]));_0x19a265[_0x1ba6('0x38')]=_0x19a265[_0x1ba6('0x38')][_0x1ba6('0x3a')]?_0x19a265[_0x1ba6('0x38')]:_0x2279d4[_0x1ba6('0x37')];if(!_0x12bc51[_0x1ba6('0x33')][_0x1ba6('0x3b')]('nolimit')){_0x19a265['limit']=qs[_0x1ba6('0x21')](_0x12bc51['query'][_0x1ba6('0x21')]);_0x19a265[_0x1ba6('0x1f')]=qs[_0x1ba6('0x1f')](_0x12bc51[_0x1ba6('0x33')][_0x1ba6('0x1f')]);}_0x19a265[_0x1ba6('0x3c')]=qs[_0x1ba6('0x3d')](_0x12bc51['query'][_0x1ba6('0x3d')]);_0x19a265[_0x1ba6('0x3e')]=qs[_0x1ba6('0x35')](_[_0x1ba6('0x3f')](_0x12bc51[_0x1ba6('0x33')],_0x2279d4[_0x1ba6('0x35')]),_0x138af3);if(_0x12bc51['query']['filter']){_0x19a265[_0x1ba6('0x3e')]=_[_0x1ba6('0x40')](_0x19a265[_0x1ba6('0x3e')],{'$or':_['map'](_0x138af3,function(_0x2cea68){if(_0x2cea68[_0x1ba6('0x41')]!=='VIRTUAL'){var _0x332e35={};_0x332e35[_0x2cea68[_0x1ba6('0x2c')]]={'$like':'%'+_0x12bc51[_0x1ba6('0x33')][_0x1ba6('0x42')]+'%'};return _0x332e35;}})});}_0x19a265=_[_0x1ba6('0x40')]({},_0x19a265,_0x12bc51[_0x1ba6('0x43')]);var _0x4d6aae={'where':_0x19a265['where']};return db['SalesforceAccount'][_0x1ba6('0x22')](_0x4d6aae)[_0x1ba6('0x28')](function(_0x2f4a5b){_0x4a67b5[_0x1ba6('0x22')]=_0x2f4a5b;if(_0x12bc51[_0x1ba6('0x33')][_0x1ba6('0x44')]){_0x19a265[_0x1ba6('0x45')]=[{'all':!![]}];}return db[_0x1ba6('0x2f')][_0x1ba6('0x46')](_0x19a265);})[_0x1ba6('0x28')](function(_0x20cbe6){_0x4a67b5[_0x1ba6('0x47')]=_0x20cbe6;return _0x4a67b5;})['then'](respondWithFilteredResult(_0x19c8a6,_0x19a265))[_0x1ba6('0x48')](handleError(_0x19c8a6,null));};exports[_0x1ba6('0x49')]=function(_0xcacfd6,_0x4ae722){var _0x546a7a={'raw':![],'where':{'id':_0xcacfd6[_0x1ba6('0x4a')]['id']}},_0x25e6eb={};_0x25e6eb['model']=_[_0x1ba6('0x34')](db[_0x1ba6('0x2f')][_0x1ba6('0x30')]);_0x25e6eb[_0x1ba6('0x33')]=_[_0x1ba6('0x34')](_0xcacfd6['query']);_0x25e6eb['filters']=_[_0x1ba6('0x36')](_0x25e6eb[_0x1ba6('0x37')],_0x25e6eb[_0x1ba6('0x33')]);_0x546a7a[_0x1ba6('0x38')]=_[_0x1ba6('0x36')](_0x25e6eb[_0x1ba6('0x37')],qs[_0x1ba6('0x39')](_0xcacfd6['query']['fields']));_0x546a7a[_0x1ba6('0x38')]=_0x546a7a[_0x1ba6('0x38')][_0x1ba6('0x3a')]?_0x546a7a[_0x1ba6('0x38')]:_0x25e6eb['model'];if(_0xcacfd6[_0x1ba6('0x33')][_0x1ba6('0x44')]){_0x546a7a[_0x1ba6('0x45')]=[{'all':!![]}];}_0x546a7a=_[_0x1ba6('0x40')]({},_0x546a7a,_0xcacfd6[_0x1ba6('0x43')]);return db[_0x1ba6('0x2f')][_0x1ba6('0x4b')](_0x546a7a)[_0x1ba6('0x28')](handleEntityNotFound(_0x4ae722,null))[_0x1ba6('0x28')](respondWithResult(_0x4ae722,null))['catch'](handleError(_0x4ae722,null));};exports[_0x1ba6('0x4c')]=function(_0x466f5a,_0x5a07d7){return db[_0x1ba6('0x2f')][_0x1ba6('0x4c')](_0x466f5a[_0x1ba6('0x4d')],{})[_0x1ba6('0x28')](respondWithResult(_0x5a07d7,0xc9))['catch'](handleError(_0x5a07d7,null));};exports['update']=function(_0x4e50a0,_0x4beba0){if(_0x4e50a0['body']['id']){delete _0x4e50a0[_0x1ba6('0x4d')]['id'];}return db[_0x1ba6('0x2f')][_0x1ba6('0x4b')]({'where':{'id':_0x4e50a0[_0x1ba6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4beba0,null))[_0x1ba6('0x28')](saveUpdates(_0x4e50a0[_0x1ba6('0x4d')],null))['then'](respondWithResult(_0x4beba0,null))[_0x1ba6('0x48')](handleError(_0x4beba0,null));};exports[_0x1ba6('0x29')]=function(_0x219aa5,_0x59910e){return db['SalesforceAccount']['find']({'where':{'id':_0x219aa5['params']['id']}})[_0x1ba6('0x28')](handleEntityNotFound(_0x59910e,null))['then'](removeEntity(_0x59910e,null))['catch'](handleError(_0x59910e,null));};exports[_0x1ba6('0x4e')]=function(_0x4a451a,_0x497634,_0x272ddb){var _0x36a487={};var _0x1b220f={};var _0x54716c;var _0x527a50;return db[_0x1ba6('0x2f')][_0x1ba6('0x4f')]({'where':{'id':_0x4a451a[_0x1ba6('0x4a')]['id']}})[_0x1ba6('0x28')](handleEntityNotFound(_0x497634,null))[_0x1ba6('0x28')](function(_0x4eebcc){if(_0x4eebcc){_0x54716c=_0x4eebcc;_0x1b220f[_0x1ba6('0x37')]=_[_0x1ba6('0x34')](db[_0x1ba6('0x50')][_0x1ba6('0x30')]);_0x1b220f[_0x1ba6('0x33')]=_[_0x1ba6('0x34')](_0x4a451a[_0x1ba6('0x33')]);_0x1b220f[_0x1ba6('0x35')]=_[_0x1ba6('0x36')](_0x1b220f['model'],_0x1b220f['query']);_0x36a487['attributes']=_['intersection'](_0x1b220f[_0x1ba6('0x37')],qs[_0x1ba6('0x39')](_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x39')]));_0x36a487[_0x1ba6('0x38')]=_0x36a487[_0x1ba6('0x38')][_0x1ba6('0x3a')]?_0x36a487[_0x1ba6('0x38')]:_0x1b220f['model'];_0x36a487[_0x1ba6('0x3c')]=qs['sort'](_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x3d')]);_0x36a487['where']=qs[_0x1ba6('0x35')](_[_0x1ba6('0x3f')](_0x4a451a['query'],_0x1b220f['filters']));if(_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x42')]){_0x36a487[_0x1ba6('0x3e')]=_[_0x1ba6('0x40')](_0x36a487['where'],{'$or':_[_0x1ba6('0x2e')](_0x36a487[_0x1ba6('0x38')],function(_0xf9fbc){var _0x4b3ea4={};_0x4b3ea4[_0xf9fbc]={'$like':'%'+_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x42')]+'%'};return _0x4b3ea4;})});}_0x36a487=_[_0x1ba6('0x40')]({},_0x36a487,_0x4a451a[_0x1ba6('0x43')]);return _0x54716c[_0x1ba6('0x4e')](_0x36a487);}})[_0x1ba6('0x28')](function(_0x47609b){if(_0x47609b){_0x527a50=_0x47609b['length'];if(!_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x3b')](_0x1ba6('0x51'))){_0x36a487[_0x1ba6('0x21')]=qs[_0x1ba6('0x21')](_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x21')]);_0x36a487['offset']=qs[_0x1ba6('0x1f')](_0x4a451a[_0x1ba6('0x33')][_0x1ba6('0x1f')]);}return _0x54716c[_0x1ba6('0x4e')](_0x36a487);}})[_0x1ba6('0x28')](function(_0x2fd98f){if(_0x2fd98f){return _0x2fd98f?{'count':_0x527a50,'rows':_0x2fd98f}:null;}})[_0x1ba6('0x28')](respondWithResult(_0x497634,null))['catch'](handleError(_0x497634,null));};exports['addConfiguration']=function(_0x3e19da,_0x5c3611,_0xf8ec4d){if(_0x3e19da[_0x1ba6('0x4d')]['id']){delete _0x3e19da['body']['id'];}return db[_0x1ba6('0x2f')]['findOne']({'where':{'id':_0x3e19da['params']['id']}})[_0x1ba6('0x28')](handleEntityNotFound(_0x5c3611,null))[_0x1ba6('0x28')](function(_0x2cdb9e){if(_0x2cdb9e){_0x3e19da[_0x1ba6('0x4d')][_0x1ba6('0x52')]=_0x2cdb9e['id'];_0x3e19da['body'][_0x1ba6('0x53')]=integrations[_0x1ba6('0x54')](_0x3e19da[_0x1ba6('0x4d')][_0x1ba6('0x55')],_0x3e19da[_0x1ba6('0x4d')][_0x1ba6('0x41')]);_0x3e19da['body']['Descriptions']=integrations[_0x1ba6('0x56')](_0x3e19da[_0x1ba6('0x4d')][_0x1ba6('0x55')],_0x3e19da[_0x1ba6('0x4d')]['type']);return db['SalesforceConfiguration'][_0x1ba6('0x4c')](_0x3e19da['body'],{'include':[{'model':db['SalesforceField'],'as':_0x1ba6('0x53')},{'model':db[_0x1ba6('0x57')],'as':_0x1ba6('0x58')}]});}return null;})[_0x1ba6('0x28')](respondWithResult(_0x5c3611,null))[_0x1ba6('0x48')](handleError(_0x5c3611,null));};exports[_0x1ba6('0x59')]=function(_0x5e1319,_0x3c020a,_0x2fa708){var _0x2ed63f;var _0x4971ca='';var _0x4c6e81=_0x1ba6('0x5a');return db[_0x1ba6('0x2f')][_0x1ba6('0x4f')]({'where':{'id':_0x5e1319['params']['id']},'attributes':['id',_0x1ba6('0x5b'),_0x1ba6('0x5c'),_0x1ba6('0x5d'),_0x1ba6('0x5e'),_0x1ba6('0x5f'),_0x1ba6('0x60')]})[_0x1ba6('0x28')](handleEntityNotFound(_0x3c020a,null))[_0x1ba6('0x28')](function(_0x39473f){if(_0x39473f){_0x4971ca=_0x39473f[_0x1ba6('0x5b')];var _0x1626fb=_0x4971ca[_0x1ba6('0x61')](-0x1);if(_0x1626fb==='/'){_0x4971ca=_0x4971ca[_0x1ba6('0x62')](0x0,_0x4971ca['lastIndexOf'](_0x1626fb));}_0x2ed63f=new jsforce[(_0x1ba6('0x63'))]({'oauth2':{'loginUrl':_0x4971ca,'clientId':_0x39473f['clientId'],'clientSecret':_0x39473f[_0x1ba6('0x5d')]}});return _0x2ed63f[_0x1ba6('0x64')](_0x39473f['username'],_0x39473f[_0x1ba6('0x5f')][_0x1ba6('0x65')](_0x39473f['securityToken']));}})[_0x1ba6('0x28')](function(_0x59a8e1){if(_0x59a8e1){if(!_[_0x1ba6('0x66')](_0x5e1319[_0x1ba6('0x33')][_0x1ba6('0x67')])){_0x4c6e81=_0x5e1319[_0x1ba6('0x33')][_0x1ba6('0x67')];}return _0x2ed63f[_0x1ba6('0x68')](_0x4c6e81)[_0x1ba6('0x69')]();}})['then'](function(_0x1f057e){var _0x14124e=[_0x1ba6('0x6a'),_0x1ba6('0x6b'),_0x1ba6('0x6c'),_0x1ba6('0x6d'),_0x1ba6('0x6e'),_0x1ba6('0x6f')];var _0x1ec927=[_0x1ba6('0x70'),'int',_0x1ba6('0x71'),'boolean',_0x1ba6('0x72'),_0x1ba6('0x73'),'phone'];if(_0x1f057e){_[_0x1ba6('0x74')](_0x1f057e[_0x1ba6('0x39')],function(_0x4ae542){return _0x14124e[_0x1ba6('0x75')](_0x4ae542['name'])||!_0x1ec927[_0x1ba6('0x75')](_0x4ae542[_0x1ba6('0x41')]);});return{'count':_0x1f057e['fields']['length'],'rows':_['map'](_0x1f057e['fields'],function(_0x35f898){return{'id':_0x35f898[_0x1ba6('0x2c')],'name':_0x35f898[_0x1ba6('0x76')],'custom':_0x35f898[_0x1ba6('0x77')],'options':_0x35f898[_0x1ba6('0x78')][_0x1ba6('0x3a')]>0x0?_[_0x1ba6('0x2e')](_0x35f898[_0x1ba6('0x78')],function(_0x4de054){return{'name':_0x4de054[_0x1ba6('0x76')],'value':_0x4de054[_0x1ba6('0x79')]};}):_0x35f898['type']==_0x1ba6('0x7a')?[{'name':_0x1ba6('0x7b'),'value':_0x1ba6('0x7c')},{'name':_0x1ba6('0x7d'),'value':_0x1ba6('0x7e')}]:[]};})};}})[_0x1ba6('0x28')](respondWithResult(_0x3c020a,null))[_0x1ba6('0x48')](function(_0x6b05df){var _0x1e18f1=_0x5e1319[_0x1ba6('0x33')]['test']?0x1f4:_0x6b05df[_0x1ba6('0x7f')]||0x1f4;logger[_0x1ba6('0x2a')](_0x1ba6('0x80'),_0x1ba6('0x59'),_0x1e18f1,JSON[_0x1ba6('0x81')](_0x6b05df));delete _0x6b05df['name'];if(_0x1e18f1===0x191){_0x1e18f1=0x190;}_0x3c020a['status'](_0x1e18f1)[_0x1ba6('0x2d')](_0x5e1319[_0x1ba6('0x33')]['test']?{'message':_0x1ba6('0x82'),'statusCode':_0x6b05df[_0x1ba6('0x7f')]}:_0x6b05df);});}; \ No newline at end of file +var _0x37b1=['util','sox','to-csv','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','where','filter','type','VIRTUAL','options','SalesforceAccount','include','findAll','rows','catch','show','includeAll','merge','find','create','body','params','getConfigurations','findOne','sort','pick','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','clientId','clientSecret','username','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','login','password','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','picklist','email','textarea','phone','includes','label','picklistValues','value','boolean','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','mustache'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x37b1,0xe7));var _0x137b=function(_0x4cbeb2,_0x10eeca){_0x4cbeb2=_0x4cbeb2-0x0;var _0x3d0f94=_0x37b1[_0x4cbeb2];return _0x3d0f94;};'use strict';var emlformat=require(_0x137b('0x0'));var rimraf=require(_0x137b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x137b('0x2'));var moment=require(_0x137b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x137b('0x4'));var util=require(_0x137b('0x5'));var path=require('path');var sox=require(_0x137b('0x6'));var csv=require(_0x137b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x137b('0x8'));var toCsv=require(_0x137b('0x7'));var querystring=require(_0x137b('0x9'));var Papa=require(_0x137b('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x137b('0xb'));var as=require(_0x137b('0xc'));var hardwareService=require(_0x137b('0xd'));var logger=require(_0x137b('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x137b('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x137b('0x10'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41db34,_0x430612){_0x430612=_0x430612||0xcc;return function(_0x3c255e){if(_0x3c255e){return _0x41db34[_0x137b('0x11')](_0x430612);}return _0x41db34[_0x137b('0x12')](_0x430612)[_0x137b('0x13')]();};}function respondWithResult(_0xed21af,_0xeab6d3){_0xeab6d3=_0xeab6d3||0xc8;return function(_0x397575){if(_0x397575){return _0xed21af[_0x137b('0x12')](_0xeab6d3)['json'](_0x397575);}};}function respondWithFilteredResult(_0x2bdffa,_0x2fc4a2){return function(_0x584849){if(_0x584849){var _0x3822f7=typeof _0x2fc4a2[_0x137b('0x14')]===_0x137b('0x15')&&typeof _0x2fc4a2[_0x137b('0x16')]===_0x137b('0x15');var _0xa92cd4=_0x584849['count'];var _0x22d2d1=_0x3822f7?0x0:_0x2fc4a2['offset'];var _0x993f0f=_0x3822f7?_0x584849[_0x137b('0x17')]:_0x2fc4a2['offset']+_0x2fc4a2[_0x137b('0x16')];var _0x73c476;if(_0x993f0f>=_0xa92cd4){_0x993f0f=_0xa92cd4;_0x73c476=0xc8;}else{_0x73c476=0xce;}_0x2bdffa[_0x137b('0x12')](_0x73c476);return _0x2bdffa[_0x137b('0x18')](_0x137b('0x19'),_0x22d2d1+'-'+_0x993f0f+'/'+_0xa92cd4)['json'](_0x584849);}return null;};}function patchUpdates(_0x411a14){return function(_0x209793){try{jsonpatch[_0x137b('0x1a')](_0x209793,_0x411a14,!![]);}catch(_0x4eb9d2){return BPromise[_0x137b('0x1b')](_0x4eb9d2);}return _0x209793[_0x137b('0x1c')]();};}function saveUpdates(_0x25b295,_0x34fa1c){return function(_0x1189a1){if(_0x1189a1){return _0x1189a1[_0x137b('0x1d')](_0x25b295)[_0x137b('0x1e')](function(_0x3cf9af){return _0x3cf9af;});}return null;};}function removeEntity(_0x478437,_0x162832){return function(_0x5b93e4){if(_0x5b93e4){return _0x5b93e4['destroy']()[_0x137b('0x1e')](function(){_0x478437[_0x137b('0x12')](0xcc)[_0x137b('0x13')]();});}};}function handleEntityNotFound(_0x5be4e1,_0xa91784){return function(_0x59bb4f){if(!_0x59bb4f){_0x5be4e1[_0x137b('0x11')](0x194);}return _0x59bb4f;};}function handleError(_0x228c93,_0x262fdc){_0x262fdc=_0x262fdc||0x1f4;return function(_0x562df4){logger[_0x137b('0x1f')](_0x562df4['stack']);if(_0x562df4['name']){delete _0x562df4[_0x137b('0x20')];}_0x228c93[_0x137b('0x12')](_0x262fdc)[_0x137b('0x21')](_0x562df4);};}exports[_0x137b('0x22')]=function(_0x3399f5,_0x2657a9){var _0x9b30d4={},_0x568dd6={},_0x4fd47={'count':0x0,'rows':[]};var _0x3e22be=_['map'](db['SalesforceAccount'][_0x137b('0x23')],function(_0x46bb45){return{'name':_0x46bb45['fieldName'],'type':_0x46bb45['type'][_0x137b('0x24')]};});_0x568dd6[_0x137b('0x25')]=_[_0x137b('0x26')](_0x3e22be,_0x137b('0x20'));_0x568dd6[_0x137b('0x27')]=_[_0x137b('0x28')](_0x3399f5[_0x137b('0x27')]);_0x568dd6[_0x137b('0x29')]=_[_0x137b('0x2a')](_0x568dd6[_0x137b('0x25')],_0x568dd6[_0x137b('0x27')]);_0x9b30d4['attributes']=_[_0x137b('0x2a')](_0x568dd6[_0x137b('0x25')],qs[_0x137b('0x2b')](_0x3399f5[_0x137b('0x27')][_0x137b('0x2b')]));_0x9b30d4['attributes']=_0x9b30d4['attributes'][_0x137b('0x2c')]?_0x9b30d4[_0x137b('0x2d')]:_0x568dd6[_0x137b('0x25')];if(!_0x3399f5[_0x137b('0x27')][_0x137b('0x2e')]('nolimit')){_0x9b30d4[_0x137b('0x16')]=qs[_0x137b('0x16')](_0x3399f5['query'][_0x137b('0x16')]);_0x9b30d4[_0x137b('0x14')]=qs['offset'](_0x3399f5[_0x137b('0x27')][_0x137b('0x14')]);}_0x9b30d4[_0x137b('0x2f')]=qs['sort'](_0x3399f5['query']['sort']);_0x9b30d4[_0x137b('0x30')]=qs['filters'](_['pick'](_0x3399f5[_0x137b('0x27')],_0x568dd6[_0x137b('0x29')]),_0x3e22be);if(_0x3399f5[_0x137b('0x27')][_0x137b('0x31')]){_0x9b30d4[_0x137b('0x30')]=_['merge'](_0x9b30d4[_0x137b('0x30')],{'$or':_[_0x137b('0x26')](_0x3e22be,function(_0x4dd8db){if(_0x4dd8db[_0x137b('0x32')]!==_0x137b('0x33')){var _0x10a91c={};_0x10a91c[_0x4dd8db[_0x137b('0x20')]]={'$like':'%'+_0x3399f5['query'][_0x137b('0x31')]+'%'};return _0x10a91c;}})});}_0x9b30d4=_['merge']({},_0x9b30d4,_0x3399f5[_0x137b('0x34')]);var _0x57ce8e={'where':_0x9b30d4['where']};return db[_0x137b('0x35')][_0x137b('0x17')](_0x57ce8e)[_0x137b('0x1e')](function(_0x1fe343){_0x4fd47[_0x137b('0x17')]=_0x1fe343;if(_0x3399f5[_0x137b('0x27')]['includeAll']){_0x9b30d4[_0x137b('0x36')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x137b('0x37')](_0x9b30d4);})['then'](function(_0x2a0280){_0x4fd47[_0x137b('0x38')]=_0x2a0280;return _0x4fd47;})[_0x137b('0x1e')](respondWithFilteredResult(_0x2657a9,_0x9b30d4))[_0x137b('0x39')](handleError(_0x2657a9,null));};exports[_0x137b('0x3a')]=function(_0x3d0df6,_0x55ae50){var _0x767acd={'raw':![],'where':{'id':_0x3d0df6['params']['id']}},_0x3da12b={};_0x3da12b['model']=_['keys'](db[_0x137b('0x35')]['rawAttributes']);_0x3da12b[_0x137b('0x27')]=_[_0x137b('0x28')](_0x3d0df6[_0x137b('0x27')]);_0x3da12b['filters']=_['intersection'](_0x3da12b[_0x137b('0x25')],_0x3da12b[_0x137b('0x27')]);_0x767acd['attributes']=_[_0x137b('0x2a')](_0x3da12b[_0x137b('0x25')],qs['fields'](_0x3d0df6[_0x137b('0x27')][_0x137b('0x2b')]));_0x767acd[_0x137b('0x2d')]=_0x767acd[_0x137b('0x2d')][_0x137b('0x2c')]?_0x767acd['attributes']:_0x3da12b[_0x137b('0x25')];if(_0x3d0df6[_0x137b('0x27')][_0x137b('0x3b')]){_0x767acd[_0x137b('0x36')]=[{'all':!![]}];}_0x767acd=_[_0x137b('0x3c')]({},_0x767acd,_0x3d0df6[_0x137b('0x34')]);return db['SalesforceAccount'][_0x137b('0x3d')](_0x767acd)[_0x137b('0x1e')](handleEntityNotFound(_0x55ae50,null))[_0x137b('0x1e')](respondWithResult(_0x55ae50,null))['catch'](handleError(_0x55ae50,null));};exports[_0x137b('0x3e')]=function(_0x588f39,_0x1e7ff3){return db[_0x137b('0x35')]['create'](_0x588f39[_0x137b('0x3f')],{})['then'](respondWithResult(_0x1e7ff3,0xc9))['catch'](handleError(_0x1e7ff3,null));};exports[_0x137b('0x1d')]=function(_0x16e07d,_0x16043a){if(_0x16e07d[_0x137b('0x3f')]['id']){delete _0x16e07d[_0x137b('0x3f')]['id'];}return db[_0x137b('0x35')][_0x137b('0x3d')]({'where':{'id':_0x16e07d[_0x137b('0x40')]['id']}})[_0x137b('0x1e')](handleEntityNotFound(_0x16043a,null))[_0x137b('0x1e')](saveUpdates(_0x16e07d[_0x137b('0x3f')],null))[_0x137b('0x1e')](respondWithResult(_0x16043a,null))[_0x137b('0x39')](handleError(_0x16043a,null));};exports['destroy']=function(_0x12052f,_0x48962c){return db[_0x137b('0x35')][_0x137b('0x3d')]({'where':{'id':_0x12052f[_0x137b('0x40')]['id']}})[_0x137b('0x1e')](handleEntityNotFound(_0x48962c,null))[_0x137b('0x1e')](removeEntity(_0x48962c,null))[_0x137b('0x39')](handleError(_0x48962c,null));};exports[_0x137b('0x41')]=function(_0x439e23,_0x33899c,_0x43aade){var _0x6f2d01={};var _0x185afb={};var _0x419ba6;var _0xbb3824;return db['SalesforceAccount'][_0x137b('0x42')]({'where':{'id':_0x439e23['params']['id']}})[_0x137b('0x1e')](handleEntityNotFound(_0x33899c,null))[_0x137b('0x1e')](function(_0x51f92c){if(_0x51f92c){_0x419ba6=_0x51f92c;_0x185afb['model']=_[_0x137b('0x28')](db['SalesforceConfiguration'][_0x137b('0x23')]);_0x185afb[_0x137b('0x27')]=_[_0x137b('0x28')](_0x439e23[_0x137b('0x27')]);_0x185afb[_0x137b('0x29')]=_[_0x137b('0x2a')](_0x185afb['model'],_0x185afb['query']);_0x6f2d01[_0x137b('0x2d')]=_[_0x137b('0x2a')](_0x185afb[_0x137b('0x25')],qs['fields'](_0x439e23[_0x137b('0x27')][_0x137b('0x2b')]));_0x6f2d01['attributes']=_0x6f2d01[_0x137b('0x2d')][_0x137b('0x2c')]?_0x6f2d01[_0x137b('0x2d')]:_0x185afb['model'];_0x6f2d01[_0x137b('0x2f')]=qs[_0x137b('0x43')](_0x439e23[_0x137b('0x27')][_0x137b('0x43')]);_0x6f2d01['where']=qs[_0x137b('0x29')](_[_0x137b('0x44')](_0x439e23[_0x137b('0x27')],_0x185afb[_0x137b('0x29')]));if(_0x439e23[_0x137b('0x27')][_0x137b('0x31')]){_0x6f2d01[_0x137b('0x30')]=_['merge'](_0x6f2d01[_0x137b('0x30')],{'$or':_[_0x137b('0x26')](_0x6f2d01[_0x137b('0x2d')],function(_0x52c0e6){var _0x1dcc3b={};_0x1dcc3b[_0x52c0e6]={'$like':'%'+_0x439e23['query'][_0x137b('0x31')]+'%'};return _0x1dcc3b;})});}_0x6f2d01=_[_0x137b('0x3c')]({},_0x6f2d01,_0x439e23[_0x137b('0x34')]);return _0x419ba6['getConfigurations'](_0x6f2d01);}})[_0x137b('0x1e')](function(_0x488047){if(_0x488047){_0xbb3824=_0x488047[_0x137b('0x2c')];if(!_0x439e23['query'][_0x137b('0x2e')](_0x137b('0x45'))){_0x6f2d01['limit']=qs[_0x137b('0x16')](_0x439e23[_0x137b('0x27')][_0x137b('0x16')]);_0x6f2d01[_0x137b('0x14')]=qs[_0x137b('0x14')](_0x439e23[_0x137b('0x27')]['offset']);}return _0x419ba6[_0x137b('0x41')](_0x6f2d01);}})[_0x137b('0x1e')](function(_0xdf021){if(_0xdf021){return _0xdf021?{'count':_0xbb3824,'rows':_0xdf021}:null;}})['then'](respondWithResult(_0x33899c,null))[_0x137b('0x39')](handleError(_0x33899c,null));};exports[_0x137b('0x46')]=function(_0x3e7643,_0x22ba8e,_0x2cf561){if(_0x3e7643[_0x137b('0x3f')]['id']){delete _0x3e7643['body']['id'];}return db['SalesforceAccount'][_0x137b('0x42')]({'where':{'id':_0x3e7643[_0x137b('0x40')]['id']}})[_0x137b('0x1e')](handleEntityNotFound(_0x22ba8e,null))['then'](function(_0x15c817){if(_0x15c817){_0x3e7643[_0x137b('0x3f')]['AccountId']=_0x15c817['id'];_0x3e7643[_0x137b('0x3f')][_0x137b('0x47')]=integrations[_0x137b('0x48')](_0x3e7643['body'][_0x137b('0x49')],_0x3e7643['body']['type']);_0x3e7643[_0x137b('0x3f')][_0x137b('0x4a')]=integrations[_0x137b('0x4b')](_0x3e7643[_0x137b('0x3f')]['channel'],_0x3e7643[_0x137b('0x3f')][_0x137b('0x32')]);return db[_0x137b('0x4c')][_0x137b('0x3e')](_0x3e7643[_0x137b('0x3f')],{'include':[{'model':db[_0x137b('0x4d')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x137b('0x4a')}]});}return null;})[_0x137b('0x1e')](respondWithResult(_0x22ba8e,null))[_0x137b('0x39')](handleError(_0x22ba8e,null));};exports['getFields']=function(_0x7d7641,_0x3af61e,_0x3cad1e){var _0x4792e7;var _0x120e5c='';var _0x164136='Task';return db[_0x137b('0x35')][_0x137b('0x42')]({'where':{'id':_0x7d7641['params']['id']},'attributes':['id','remoteUri',_0x137b('0x4e'),_0x137b('0x4f'),_0x137b('0x50'),'password',_0x137b('0x51')]})[_0x137b('0x1e')](handleEntityNotFound(_0x3af61e,null))[_0x137b('0x1e')](function(_0x13d7f9){if(_0x13d7f9){_0x120e5c=_0x13d7f9[_0x137b('0x52')];var _0x3cbeaf=_0x120e5c[_0x137b('0x53')](-0x1);if(_0x3cbeaf==='/'){_0x120e5c=_0x120e5c[_0x137b('0x54')](0x0,_0x120e5c[_0x137b('0x55')](_0x3cbeaf));}_0x4792e7=new jsforce[(_0x137b('0x56'))]({'oauth2':{'loginUrl':_0x120e5c,'clientId':_0x13d7f9['clientId'],'clientSecret':_0x13d7f9[_0x137b('0x4f')]}});return _0x4792e7[_0x137b('0x57')](_0x13d7f9[_0x137b('0x50')],_0x13d7f9[_0x137b('0x58')]['concat'](_0x13d7f9[_0x137b('0x51')]));}})['then'](function(_0x5443c1){if(_0x5443c1){if(!_[_0x137b('0x59')](_0x7d7641['query'][_0x137b('0x5a')])){_0x164136=_0x7d7641[_0x137b('0x27')][_0x137b('0x5a')];}return _0x4792e7[_0x137b('0x5b')](_0x164136)[_0x137b('0x5c')]();}})[_0x137b('0x1e')](function(_0xe9e5b7){var _0x10ddcc=[_0x137b('0x5d'),_0x137b('0x5e'),_0x137b('0x5f'),_0x137b('0x60'),_0x137b('0x61'),_0x137b('0x62')];var _0x4c06e0=['string','int',_0x137b('0x63'),'boolean',_0x137b('0x64'),_0x137b('0x65'),_0x137b('0x66')];if(_0xe9e5b7){_['remove'](_0xe9e5b7[_0x137b('0x2b')],function(_0x6fc519){return _0x10ddcc['includes'](_0x6fc519[_0x137b('0x20')])||!_0x4c06e0[_0x137b('0x67')](_0x6fc519[_0x137b('0x32')]);});return{'count':_0xe9e5b7[_0x137b('0x2b')][_0x137b('0x2c')],'rows':_[_0x137b('0x26')](_0xe9e5b7[_0x137b('0x2b')],function(_0xdd2da){return{'id':_0xdd2da['name'],'name':_0xdd2da[_0x137b('0x68')],'custom':_0xdd2da['custom'],'options':_0xdd2da['picklistValues']['length']>0x0?_[_0x137b('0x26')](_0xdd2da[_0x137b('0x69')],function(_0x43e11b){return{'name':_0x43e11b[_0x137b('0x68')],'value':_0x43e11b[_0x137b('0x6a')]};}):_0xdd2da[_0x137b('0x32')]==_0x137b('0x6b')?[{'name':_0x137b('0x6c'),'value':_0x137b('0x6d')},{'name':_0x137b('0x6e'),'value':_0x137b('0x6f')}]:[]};})};}})[_0x137b('0x1e')](respondWithResult(_0x3af61e,null))[_0x137b('0x39')](function(_0x1bb76b){var _0x3aa3d8=_0x7d7641[_0x137b('0x27')]['test']?0x1f4:_0x1bb76b['statusCode']||0x1f4;logger['error'](_0x137b('0x70'),_0x137b('0x71'),_0x3aa3d8,JSON[_0x137b('0x72')](_0x1bb76b));delete _0x1bb76b['name'];if(_0x3aa3d8===0x191){_0x3aa3d8=0x190;}_0x3af61e[_0x137b('0x12')](_0x3aa3d8)[_0x137b('0x21')](_0x7d7641[_0x137b('0x27')][_0x137b('0x73')]?{'message':_0x137b('0x74'),'statusCode':_0x1bb76b[_0x137b('0x75')]}:_0x1bb76b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9fe41c8..a157eee 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 _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','lodash','util'];(function(_0x4f8b6a,_0x2ead69){var _0x192d31=function(_0x43058f){while(--_0x43058f){_0x4f8b6a['push'](_0x4f8b6a['shift']());}};_0x192d31(++_0x2ead69);}(_0xa902,0x8d));var _0x2a90=function(_0x1c9890,_0x29cfc2){_0x1c9890=_0x1c9890-0x0;var _0x89a237=_0xa902[_0x1c9890];return _0x89a237;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var moment=require(_0x2a90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a90('0x6'));var attributes=require(_0x2a90('0x7'));var integrations=require(_0x2a90('0x8'));module[_0x2a90('0x9')]=function(_0x4a32c7,_0x25bcfc){return _0x4a32c7['define'](_0x2a90('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb268=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts'];(function(_0x12d870,_0x13e328){var _0x25e3d3=function(_0x49c72a){while(--_0x49c72a){_0x12d870['push'](_0x12d870['shift']());}};_0x25e3d3(++_0x13e328);}(_0xb268,0x114));var _0x8b26=function(_0x2bfda8,_0x74cde){_0x2bfda8=_0x2bfda8-0x0;var _0x4fcbb1=_0xb268[_0x2bfda8];return _0x4fcbb1;};'use strict';var _=require(_0x8b26('0x0'));var util=require(_0x8b26('0x1'));var logger=require(_0x8b26('0x2'))(_0x8b26('0x3'));var moment=require(_0x8b26('0x4'));var BPromise=require(_0x8b26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b26('0x6'));var config=require(_0x8b26('0x7'));var attributes=require(_0x8b26('0x8'));var integrations=require(_0x8b26('0x9'));module[_0x8b26('0xa')]=function(_0x4fb7d6,_0x3b7c98){return _0x4fb7d6['define']('SalesforceAccount',attributes,{'tableName':_0x8b26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 3842160..26d48f7 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 _0x9c0b=['request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','limit','include','model','map','attributes','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x10c8ba,_0xd2d492){var _0x513a60=function(_0x4e8092){while(--_0x4e8092){_0x10c8ba['push'](_0x10c8ba['shift']());}};_0x513a60(++_0xd2d492);}(_0x9c0b,0xc8));var _0xb9c0=function(_0x2b0c4c,_0x3d3bf3){_0x2b0c4c=_0x2b0c4c-0x0;var _0x4901b4=_0x9c0b[_0x2b0c4c];return _0x4901b4;};'use strict';var _=require(_0xb9c0('0x0'));var util=require(_0xb9c0('0x1'));var moment=require('moment');var BPromise=require(_0xb9c0('0x2'));var rs=require(_0xb9c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9c0('0x5'))(_0xb9c0('0x6'));var config=require(_0xb9c0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9c0('0x8')][_0xb9c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c3272,_0x4556dc,_0x334a10){return new BPromise(function(_0x2c6ce5,_0x4bcbf7){return client[_0xb9c0('0xa')](_0x2c3272,_0x334a10)[_0xb9c0('0xb')](function(_0x3e8b88){logger[_0xb9c0('0xc')](_0xb9c0('0xd'),_0x4556dc,_0xb9c0('0xe'));logger[_0xb9c0('0xf')](_0xb9c0('0x10'),_0x4556dc,_0xb9c0('0xe'),JSON[_0xb9c0('0x11')](_0x3e8b88));if(_0x3e8b88[_0xb9c0('0x12')]){if(_0x3e8b88[_0xb9c0('0x12')][_0xb9c0('0x13')]===0x1f4){logger[_0xb9c0('0x12')](_0xb9c0('0xd'),_0x4556dc,_0x3e8b88['error'][_0xb9c0('0x14')]);return _0x4bcbf7(_0x3e8b88[_0xb9c0('0x12')][_0xb9c0('0x14')]);}logger[_0xb9c0('0x12')](_0xb9c0('0xd'),_0x4556dc,_0x3e8b88['error'][_0xb9c0('0x14')]);return _0x2c6ce5(_0x3e8b88[_0xb9c0('0x12')][_0xb9c0('0x14')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4556dc,_0xb9c0('0xe'));_0x2c6ce5(_0x3e8b88[_0xb9c0('0x15')][_0xb9c0('0x14')]);}})[_0xb9c0('0x16')](function(_0x47a7c2){logger[_0xb9c0('0x12')](_0xb9c0('0xd'),_0x4556dc,_0x47a7c2);_0x4bcbf7(_0x47a7c2);});});}exports[_0xb9c0('0x17')]=function(_0x2fd9ad){var _0x2bb45b=this;return new Promise(function(_0x656e52,_0x3b33cf){return db[_0xb9c0('0x18')]['findAll']({'raw':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad['options'][_0xb9c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad[_0xb9c0('0x19')][_0xb9c0('0x1b')]||null:null,'attributes':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad[_0xb9c0('0x19')]['attributes']||null:null,'limit':_0x2fd9ad['options']?_0x2fd9ad[_0xb9c0('0x19')][_0xb9c0('0x1c')]||null:null,'include':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad['options'][_0xb9c0('0x1d')]?_['map'](_0x2fd9ad['options'][_0xb9c0('0x1d')],function(_0xc26998){return{'model':db[_0xc26998[_0xb9c0('0x1e')]],'as':_0xc26998['as'],'attributes':_0xc26998['attributes'],'include':_0xc26998[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0xc26998[_0xb9c0('0x1d')],function(_0xf786ab){return{'model':db[_0xf786ab['model']],'as':_0xf786ab['as'],'attributes':_0xf786ab[_0xb9c0('0x20')],'include':_0xf786ab[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0xf786ab[_0xb9c0('0x1d')],function(_0x14f32c){return{'model':db[_0x14f32c[_0xb9c0('0x1e')]],'as':_0x14f32c['as'],'attributes':_0x14f32c[_0xb9c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb9c0('0xb')](function(_0x2aa5eb){logger[_0xb9c0('0xc')](_0xb9c0('0x17'),_0x2fd9ad);logger[_0xb9c0('0xf')]('GetSalesforceAccount',_0x2fd9ad,JSON['stringify'](_0x2aa5eb));_0x656e52(_0x2aa5eb);})[_0xb9c0('0x16')](function(_0x4fc718){logger['error'](_0xb9c0('0x17'),_0x4fc718[_0xb9c0('0x14')],_0x2fd9ad);_0x3b33cf(_0x2bb45b['error'](0x1f4,_0x4fc718['message']));});});};exports[_0xb9c0('0x21')]=function(_0xd1a6cf){var _0x1f8116=this;return new Promise(function(_0x35fc26,_0x45ad75){return db['SalesforceAccount'][_0xb9c0('0x22')]({'raw':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x1b')]||null:null,'attributes':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x20')]||null:null,'include':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x1d')]?_['map'](_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x1d')],function(_0x4a7a2c){return{'model':db[_0x4a7a2c[_0xb9c0('0x1e')]],'as':_0x4a7a2c['as'],'attributes':_0x4a7a2c[_0xb9c0('0x20')],'include':_0x4a7a2c[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0x4a7a2c['include'],function(_0x27cd64){return{'model':db[_0x27cd64[_0xb9c0('0x1e')]],'as':_0x27cd64['as'],'attributes':_0x27cd64[_0xb9c0('0x20')],'include':_0x27cd64[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0x27cd64[_0xb9c0('0x1d')],function(_0x15f52a){return{'model':db[_0x15f52a[_0xb9c0('0x1e')]],'as':_0x15f52a['as'],'attributes':_0x15f52a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9c0('0xb')](function(_0x266271){logger['info'](_0xb9c0('0x21'),_0xd1a6cf);logger[_0xb9c0('0xf')]('ShowSalesforceAccount',_0xd1a6cf,JSON[_0xb9c0('0x11')](_0x266271));_0x35fc26(_0x266271);})[_0xb9c0('0x16')](function(_0x19a344){logger[_0xb9c0('0x12')](_0xb9c0('0x21'),_0x19a344['message'],_0xd1a6cf);_0x45ad75(_0x1f8116['error'](0x1f4,_0x19a344[_0xb9c0('0x14')]));});});}; \ No newline at end of file +var _0x2a23=['result','catch','SalesforceAccount','options','where','attributes','limit','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','debug','lodash','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3bedeb,_0x58cc17){var _0x2c7b70=function(_0x44b50c){while(--_0x44b50c){_0x3bedeb['push'](_0x3bedeb['shift']());}};_0x2c7b70(++_0x58cc17);}(_0x2a23,0x8b));var _0x32a2=function(_0x697e5e,_0x3ed0e5){_0x697e5e=_0x697e5e-0x0;var _0xec2649=_0x2a23[_0x697e5e];return _0xec2649;};'use strict';var _=require(_0x32a2('0x0'));var util=require('util');var moment=require(_0x32a2('0x1'));var BPromise=require(_0x32a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x32a2('0x4'));var jayson=require(_0x32a2('0x5'));var client=jayson[_0x32a2('0x6')][_0x32a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c56db,_0x291076,_0x28e369){return new BPromise(function(_0x51373e,_0x20b3f1){return client['request'](_0x3c56db,_0x28e369)[_0x32a2('0x8')](function(_0x21780b){logger[_0x32a2('0x9')](_0x32a2('0xa'),_0x291076,_0x32a2('0xb'));logger['debug'](_0x32a2('0xc'),_0x291076,_0x32a2('0xb'),JSON['stringify'](_0x21780b));if(_0x21780b[_0x32a2('0xd')]){if(_0x21780b[_0x32a2('0xd')][_0x32a2('0xe')]===0x1f4){logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x21780b['error'][_0x32a2('0xf')]);return _0x20b3f1(_0x21780b['error'][_0x32a2('0xf')]);}logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x21780b[_0x32a2('0xd')][_0x32a2('0xf')]);return _0x51373e(_0x21780b[_0x32a2('0xd')][_0x32a2('0xf')]);}else{logger[_0x32a2('0x9')](_0x32a2('0xa'),_0x291076,'request\x20sent');_0x51373e(_0x21780b[_0x32a2('0x10')][_0x32a2('0xf')]);}})[_0x32a2('0x11')](function(_0x467c3a){logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x467c3a);_0x20b3f1(_0x467c3a);});});}exports['GetSalesforceAccount']=function(_0x13e95f){var _0x4eb021=this;return new Promise(function(_0x36e23e,_0x37ea93){return db[_0x32a2('0x12')]['findAll']({'raw':_0x13e95f[_0x32a2('0x13')]?_0x13e95f[_0x32a2('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x13e95f[_0x32a2('0x13')]?_0x13e95f[_0x32a2('0x13')][_0x32a2('0x14')]||null:null,'attributes':_0x13e95f[_0x32a2('0x13')]?_0x13e95f['options'][_0x32a2('0x15')]||null:null,'limit':_0x13e95f[_0x32a2('0x13')]?_0x13e95f[_0x32a2('0x13')][_0x32a2('0x16')]||null:null,'include':_0x13e95f[_0x32a2('0x13')]?_0x13e95f['options'][_0x32a2('0x17')]?_[_0x32a2('0x18')](_0x13e95f[_0x32a2('0x13')][_0x32a2('0x17')],function(_0x3bb0c4){return{'model':db[_0x3bb0c4[_0x32a2('0x19')]],'as':_0x3bb0c4['as'],'attributes':_0x3bb0c4[_0x32a2('0x15')],'include':_0x3bb0c4[_0x32a2('0x17')]?_[_0x32a2('0x18')](_0x3bb0c4['include'],function(_0x5b098d){return{'model':db[_0x5b098d[_0x32a2('0x19')]],'as':_0x5b098d['as'],'attributes':_0x5b098d[_0x32a2('0x15')],'include':_0x5b098d[_0x32a2('0x17')]?_[_0x32a2('0x18')](_0x5b098d['include'],function(_0x29a312){return{'model':db[_0x29a312[_0x32a2('0x19')]],'as':_0x29a312['as'],'attributes':_0x29a312[_0x32a2('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41872a){logger[_0x32a2('0x9')](_0x32a2('0x1a'),_0x13e95f);logger['debug'](_0x32a2('0x1a'),_0x13e95f,JSON[_0x32a2('0x1b')](_0x41872a));_0x36e23e(_0x41872a);})[_0x32a2('0x11')](function(_0x532c89){logger['error'](_0x32a2('0x1a'),_0x532c89[_0x32a2('0xf')],_0x13e95f);_0x37ea93(_0x4eb021[_0x32a2('0xd')](0x1f4,_0x532c89[_0x32a2('0xf')]));});});};exports[_0x32a2('0x1c')]=function(_0x3192b2){var _0x371ae6=this;return new Promise(function(_0x25c8d6,_0x24bfa){return db[_0x32a2('0x12')][_0x32a2('0x1d')]({'raw':_0x3192b2['options']?_0x3192b2[_0x32a2('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3192b2[_0x32a2('0x13')]?_0x3192b2['options']['where']||null:null,'attributes':_0x3192b2[_0x32a2('0x13')]?_0x3192b2['options'][_0x32a2('0x15')]||null:null,'include':_0x3192b2[_0x32a2('0x13')]?_0x3192b2[_0x32a2('0x13')][_0x32a2('0x17')]?_[_0x32a2('0x18')](_0x3192b2[_0x32a2('0x13')][_0x32a2('0x17')],function(_0x591d26){return{'model':db[_0x591d26[_0x32a2('0x19')]],'as':_0x591d26['as'],'attributes':_0x591d26[_0x32a2('0x15')],'include':_0x591d26['include']?_['map'](_0x591d26[_0x32a2('0x17')],function(_0x20bbaf){return{'model':db[_0x20bbaf[_0x32a2('0x19')]],'as':_0x20bbaf['as'],'attributes':_0x20bbaf[_0x32a2('0x15')],'include':_0x20bbaf[_0x32a2('0x17')]?_[_0x32a2('0x18')](_0x20bbaf[_0x32a2('0x17')],function(_0x8ed01b){return{'model':db[_0x8ed01b[_0x32a2('0x19')]],'as':_0x8ed01b['as'],'attributes':_0x8ed01b[_0x32a2('0x15')]};}):[]};}):[]};}):[]:[]})[_0x32a2('0x8')](function(_0x5c06eb){logger[_0x32a2('0x9')](_0x32a2('0x1c'),_0x3192b2);logger[_0x32a2('0x1e')]('ShowSalesforceAccount',_0x3192b2,JSON[_0x32a2('0x1b')](_0x5c06eb));_0x25c8d6(_0x5c06eb);})[_0x32a2('0x11')](function(_0x264b1e){logger['error'](_0x32a2('0x1c'),_0x264b1e[_0x32a2('0xf')],_0x3192b2);_0x24bfa(_0x371ae6[_0x32a2('0xd')](0x1f4,_0x264b1e[_0x32a2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c0d8285..51950e2 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x19fd82,_0xc187de){var _0x732a27=function(_0x411cc5){while(--_0x411cc5){_0x19fd82['push'](_0x19fd82['shift']());}};_0x732a27(++_0xc187de);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x37618b,_0x2a8b7a){var _0x47e6c2=function(_0x2c9cc4){while(--_0x2c9cc4){_0x37618b['push'](_0x37618b['shift']());}};_0x47e6c2(++_0x2a8b7a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x129e96,_0x409fde){_0x129e96=_0x129e96-0x0;var _0x5b9588=_0x5f2f[_0x129e96];return _0x5b9588;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5c1ae6c..494685c 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 _0x5117=['Case','contact_lead','contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Task'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5117,0x188));var _0x7511=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x5117[_0x54b283];return _0x2462b3;};'use strict';var Sequelize=require('sequelize');module[_0x7511('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7511('0x1')]},'ticketType':{'type':Sequelize[_0x7511('0x2')](_0x7511('0x3'),_0x7511('0x4')),'defaultValue':_0x7511('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x7511('0x5'),_0x7511('0x6'),_0x7511('0x7'),_0x7511('0x8'),_0x7511('0x9')),'defaultValue':_0x7511('0x5')},'moduleCreate':{'type':Sequelize[_0x7511('0x2')](_0x7511('0xa'),'contact',_0x7511('0x7'),_0x7511('0x9')),'defaultValue':_0x7511('0x7')},'leadId':{'type':Sequelize[_0x7511('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x7511('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x7511('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x7511('0x1')]}}; \ No newline at end of file +var _0xf609=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','exports'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xf609,0x18b));var _0x9f60=function(_0x3bcfe0,_0x514f2f){_0x3bcfe0=_0x3bcfe0-0x0;var _0x2f25ca=_0xf609[_0x3bcfe0];return _0x2f25ca;};'use strict';var Sequelize=require('sequelize');module[_0x9f60('0x0')]={'name':{'type':Sequelize[_0x9f60('0x1')]},'description':{'type':Sequelize[_0x9f60('0x1')]},'ticketType':{'type':Sequelize[_0x9f60('0x2')](_0x9f60('0x3'),_0x9f60('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x9f60('0x5'),_0x9f60('0x6'),_0x9f60('0x7'),_0x9f60('0x8'),_0x9f60('0x9')),'defaultValue':_0x9f60('0x5')},'moduleCreate':{'type':Sequelize[_0x9f60('0x2')](_0x9f60('0xa'),_0x9f60('0x6'),_0x9f60('0x7'),_0x9f60('0x9')),'defaultValue':_0x9f60('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x9f60('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x9f60('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x9f60('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3c979d3..eed067e 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 _0xbd33=['create','body','update','getFields','findOne','SalesforceField','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','stack','send','index','SalesforceConfiguration','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find'];(function(_0x403b2a,_0x158fb0){var _0x55d798=function(_0x4985e2){while(--_0x4985e2){_0x403b2a['push'](_0x403b2a['shift']());}};_0x55d798(++_0x158fb0);}(_0xbd33,0x1dd));var _0x3bd3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbd33[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bd3('0x0'));var zipdir=require(_0x3bd3('0x1'));var jsonpatch=require(_0x3bd3('0x2'));var rp=require(_0x3bd3('0x3'));var moment=require(_0x3bd3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3bd3('0x5'));var util=require(_0x3bd3('0x6'));var path=require(_0x3bd3('0x7'));var sox=require(_0x3bd3('0x8'));var csv=require(_0x3bd3('0x9'));var ejs=require(_0x3bd3('0xa'));var fs=require('fs');var fs_extra=require(_0x3bd3('0xb'));var _=require('lodash');var squel=require(_0x3bd3('0xc'));var crypto=require(_0x3bd3('0xd'));var jsforce=require(_0x3bd3('0xe'));var deskjs=require(_0x3bd3('0xf'));var toCsv=require(_0x3bd3('0x9'));var querystring=require(_0x3bd3('0x10'));var Papa=require(_0x3bd3('0x11'));var Redis=require(_0x3bd3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3bd3('0x13'));var as=require(_0x3bd3('0x14'));var hardwareService=require(_0x3bd3('0x15'));var logger=require(_0x3bd3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x3bd3('0x17'));var licenseUtil=require(_0x3bd3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x232bbd,_0x3dac89){_0x3dac89=_0x3dac89||0xcc;return function(_0x3cc92e){if(_0x3cc92e){return _0x232bbd['sendStatus'](_0x3dac89);}return _0x232bbd[_0x3bd3('0x19')](_0x3dac89)['end']();};}function respondWithResult(_0x1d8142,_0x404324){_0x404324=_0x404324||0xc8;return function(_0x13473c){if(_0x13473c){return _0x1d8142[_0x3bd3('0x19')](_0x404324)['json'](_0x13473c);}};}function respondWithFilteredResult(_0x57b315,_0x3dfa18){return function(_0x506cd6){if(_0x506cd6){var _0x277972=typeof _0x3dfa18[_0x3bd3('0x1a')]===_0x3bd3('0x1b')&&typeof _0x3dfa18[_0x3bd3('0x1c')]===_0x3bd3('0x1b');var _0x3be796=_0x506cd6['count'];var _0x54ed90=_0x277972?0x0:_0x3dfa18[_0x3bd3('0x1a')];var _0x137a95=_0x277972?_0x506cd6[_0x3bd3('0x1d')]:_0x3dfa18[_0x3bd3('0x1a')]+_0x3dfa18[_0x3bd3('0x1c')];var _0x79d9dd;if(_0x137a95>=_0x3be796){_0x137a95=_0x3be796;_0x79d9dd=0xc8;}else{_0x79d9dd=0xce;}_0x57b315[_0x3bd3('0x19')](_0x79d9dd);return _0x57b315[_0x3bd3('0x1e')](_0x3bd3('0x1f'),_0x54ed90+'-'+_0x137a95+'/'+_0x3be796)[_0x3bd3('0x20')](_0x506cd6);}return null;};}function patchUpdates(_0x1b36ca){return function(_0x2e7b29){try{jsonpatch['apply'](_0x2e7b29,_0x1b36ca,!![]);}catch(_0x1cc4cd){return BPromise['reject'](_0x1cc4cd);}return _0x2e7b29[_0x3bd3('0x21')]();};}function saveUpdates(_0x1a3a4c,_0x564c41){return function(_0x160d0){if(_0x160d0){return _0x160d0['update'](_0x1a3a4c)[_0x3bd3('0x22')](function(_0x4f6b5e){return _0x4f6b5e;});}return null;};}function removeEntity(_0x130b9b,_0x1dbeb5){return function(_0x5d3a59){if(_0x5d3a59){return _0x5d3a59[_0x3bd3('0x23')]()[_0x3bd3('0x22')](function(){_0x130b9b[_0x3bd3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef3b1,_0x1dce2){return function(_0x559397){if(!_0x559397){_0x3ef3b1['sendStatus'](0x194);}return _0x559397;};}function handleError(_0x7f19ec,_0x4c8414){_0x4c8414=_0x4c8414||0x1f4;return function(_0x1f82b0){logger['error'](_0x1f82b0[_0x3bd3('0x24')]);if(_0x1f82b0['name']){delete _0x1f82b0['name'];}_0x7f19ec[_0x3bd3('0x19')](_0x4c8414)[_0x3bd3('0x25')](_0x1f82b0);};}exports[_0x3bd3('0x26')]=function(_0x20bf5b,_0x1e1716){var _0x1a0d84={},_0x289f39={},_0x3986f4={'count':0x0,'rows':[]};var _0x1c1b7d=_['map'](db[_0x3bd3('0x27')]['rawAttributes'],function(_0x1b1558){return{'name':_0x1b1558[_0x3bd3('0x28')],'type':_0x1b1558[_0x3bd3('0x29')]['key']};});_0x289f39[_0x3bd3('0x2a')]=_[_0x3bd3('0x2b')](_0x1c1b7d,_0x3bd3('0x2c'));_0x289f39[_0x3bd3('0x2d')]=_[_0x3bd3('0x2e')](_0x20bf5b[_0x3bd3('0x2d')]);_0x289f39['filters']=_[_0x3bd3('0x2f')](_0x289f39[_0x3bd3('0x2a')],_0x289f39[_0x3bd3('0x2d')]);_0x1a0d84[_0x3bd3('0x30')]=_[_0x3bd3('0x2f')](_0x289f39['model'],qs['fields'](_0x20bf5b[_0x3bd3('0x2d')][_0x3bd3('0x31')]));_0x1a0d84[_0x3bd3('0x30')]=_0x1a0d84['attributes'][_0x3bd3('0x32')]?_0x1a0d84['attributes']:_0x289f39[_0x3bd3('0x2a')];if(!_0x20bf5b[_0x3bd3('0x2d')]['hasOwnProperty'](_0x3bd3('0x33'))){_0x1a0d84[_0x3bd3('0x1c')]=qs['limit'](_0x20bf5b[_0x3bd3('0x2d')][_0x3bd3('0x1c')]);_0x1a0d84['offset']=qs[_0x3bd3('0x1a')](_0x20bf5b[_0x3bd3('0x2d')][_0x3bd3('0x1a')]);}_0x1a0d84[_0x3bd3('0x34')]=qs[_0x3bd3('0x35')](_0x20bf5b[_0x3bd3('0x2d')][_0x3bd3('0x35')]);_0x1a0d84['where']=qs[_0x3bd3('0x36')](_[_0x3bd3('0x37')](_0x20bf5b[_0x3bd3('0x2d')],_0x289f39[_0x3bd3('0x36')]),_0x1c1b7d);if(_0x20bf5b[_0x3bd3('0x2d')][_0x3bd3('0x38')]){_0x1a0d84['where']=_['merge'](_0x1a0d84[_0x3bd3('0x39')],{'$or':_[_0x3bd3('0x2b')](_0x1c1b7d,function(_0x507519){if(_0x507519[_0x3bd3('0x29')]!=='VIRTUAL'){var _0x992fa2={};_0x992fa2[_0x507519[_0x3bd3('0x2c')]]={'$like':'%'+_0x20bf5b[_0x3bd3('0x2d')][_0x3bd3('0x38')]+'%'};return _0x992fa2;}})});}_0x1a0d84=_[_0x3bd3('0x3a')]({},_0x1a0d84,_0x20bf5b[_0x3bd3('0x3b')]);var _0x4def55={'where':_0x1a0d84[_0x3bd3('0x39')]};return db[_0x3bd3('0x27')]['count'](_0x4def55)[_0x3bd3('0x22')](function(_0x5bcc3e){_0x3986f4['count']=_0x5bcc3e;if(_0x20bf5b[_0x3bd3('0x2d')]['includeAll']){_0x1a0d84[_0x3bd3('0x3c')]=[{'all':!![]}];}return db[_0x3bd3('0x27')][_0x3bd3('0x3d')](_0x1a0d84);})[_0x3bd3('0x22')](function(_0x32b2d3){_0x3986f4[_0x3bd3('0x3e')]=_0x32b2d3;return _0x3986f4;})[_0x3bd3('0x22')](respondWithFilteredResult(_0x1e1716,_0x1a0d84))[_0x3bd3('0x3f')](handleError(_0x1e1716,null));};exports[_0x3bd3('0x40')]=function(_0x5d9d16,_0x47aa12){var _0x1cb174={'raw':![],'where':{'id':_0x5d9d16[_0x3bd3('0x41')]['id']}},_0x42b5bc={};_0x42b5bc[_0x3bd3('0x2a')]=_[_0x3bd3('0x2e')](db['SalesforceConfiguration'][_0x3bd3('0x42')]);_0x42b5bc['query']=_[_0x3bd3('0x2e')](_0x5d9d16['query']);_0x42b5bc['filters']=_[_0x3bd3('0x2f')](_0x42b5bc[_0x3bd3('0x2a')],_0x42b5bc[_0x3bd3('0x2d')]);_0x1cb174['attributes']=_['intersection'](_0x42b5bc[_0x3bd3('0x2a')],qs[_0x3bd3('0x31')](_0x5d9d16[_0x3bd3('0x2d')][_0x3bd3('0x31')]));_0x1cb174[_0x3bd3('0x30')]=_0x1cb174[_0x3bd3('0x30')][_0x3bd3('0x32')]?_0x1cb174['attributes']:_0x42b5bc[_0x3bd3('0x2a')];if(_0x5d9d16[_0x3bd3('0x2d')][_0x3bd3('0x43')]){_0x1cb174[_0x3bd3('0x3c')]=[{'all':!![]}];}_0x1cb174=_['merge']({},_0x1cb174,_0x5d9d16[_0x3bd3('0x3b')]);return db['SalesforceConfiguration'][_0x3bd3('0x44')](_0x1cb174)[_0x3bd3('0x22')](handleEntityNotFound(_0x47aa12,null))[_0x3bd3('0x22')](respondWithResult(_0x47aa12,null))[_0x3bd3('0x3f')](handleError(_0x47aa12,null));};exports[_0x3bd3('0x45')]=function(_0x26543a,_0x26066e){return db[_0x3bd3('0x27')]['create'](_0x26543a[_0x3bd3('0x46')],{})[_0x3bd3('0x22')](respondWithResult(_0x26066e,0xc9))[_0x3bd3('0x3f')](handleError(_0x26066e,null));};exports[_0x3bd3('0x47')]=function(_0x4f3fcc,_0x338e54){if(_0x4f3fcc['body']['id']){delete _0x4f3fcc['body']['id'];}return db['SalesforceConfiguration'][_0x3bd3('0x44')]({'where':{'id':_0x4f3fcc[_0x3bd3('0x41')]['id']}})['then'](handleEntityNotFound(_0x338e54,null))[_0x3bd3('0x22')](saveUpdates(_0x4f3fcc[_0x3bd3('0x46')],null))[_0x3bd3('0x22')](respondWithResult(_0x338e54,null))['catch'](handleError(_0x338e54,null));};exports[_0x3bd3('0x23')]=function(_0xa606f9,_0x2712ae){return db['SalesforceConfiguration'][_0x3bd3('0x44')]({'where':{'id':_0xa606f9['params']['id']}})['then'](handleEntityNotFound(_0x2712ae,null))[_0x3bd3('0x22')](removeEntity(_0x2712ae,null))[_0x3bd3('0x3f')](handleError(_0x2712ae,null));};exports[_0x3bd3('0x48')]=function(_0x27426d,_0xddc65a,_0x2ce906){var _0x271477={};var _0x12301c={};var _0x87905;var _0x419fdf;return db[_0x3bd3('0x27')][_0x3bd3('0x49')]({'where':{'id':_0x27426d[_0x3bd3('0x41')]['id']}})[_0x3bd3('0x22')](handleEntityNotFound(_0xddc65a,null))['then'](function(_0x21e76a){if(_0x21e76a){_0x87905=_0x21e76a;_0x12301c[_0x3bd3('0x2a')]=_['keys'](db[_0x3bd3('0x4a')][_0x3bd3('0x42')]);_0x12301c[_0x3bd3('0x2d')]=_[_0x3bd3('0x2e')](_0x27426d[_0x3bd3('0x2d')]);_0x12301c[_0x3bd3('0x36')]=_[_0x3bd3('0x2f')](_0x12301c[_0x3bd3('0x2a')],_0x12301c['query']);_0x271477[_0x3bd3('0x30')]=_[_0x3bd3('0x2f')](_0x12301c['model'],qs['fields'](_0x27426d[_0x3bd3('0x2d')][_0x3bd3('0x31')]));_0x271477[_0x3bd3('0x30')]=_0x271477['attributes'][_0x3bd3('0x32')]?_0x271477[_0x3bd3('0x30')]:_0x12301c[_0x3bd3('0x2a')];_0x271477[_0x3bd3('0x34')]=qs['sort'](_0x27426d[_0x3bd3('0x2d')][_0x3bd3('0x35')]);_0x271477['where']=qs[_0x3bd3('0x36')](_[_0x3bd3('0x37')](_0x27426d['query'],_0x12301c['filters']));if(_0x27426d['query'][_0x3bd3('0x38')]){_0x271477[_0x3bd3('0x39')]=_[_0x3bd3('0x3a')](_0x271477[_0x3bd3('0x39')],{'$or':_[_0x3bd3('0x2b')](_0x271477[_0x3bd3('0x30')],function(_0x2b7caf){var _0x2d4f42={};_0x2d4f42[_0x2b7caf]={'$like':'%'+_0x27426d[_0x3bd3('0x2d')][_0x3bd3('0x38')]+'%'};return _0x2d4f42;})});}_0x271477=_[_0x3bd3('0x3a')]({},_0x271477,_0x27426d[_0x3bd3('0x3b')]);return _0x87905[_0x3bd3('0x48')](_0x271477);}})[_0x3bd3('0x22')](function(_0x208c4b){if(_0x208c4b){_0x419fdf=_0x208c4b[_0x3bd3('0x32')];if(!_0x27426d[_0x3bd3('0x2d')]['hasOwnProperty']('nolimit')){_0x271477[_0x3bd3('0x1c')]=qs[_0x3bd3('0x1c')](_0x27426d[_0x3bd3('0x2d')][_0x3bd3('0x1c')]);_0x271477[_0x3bd3('0x1a')]=qs[_0x3bd3('0x1a')](_0x27426d[_0x3bd3('0x2d')][_0x3bd3('0x1a')]);}return _0x87905['getFields'](_0x271477);}})[_0x3bd3('0x22')](function(_0x38787c){if(_0x38787c){return _0x38787c?{'count':_0x419fdf,'rows':_0x38787c}:null;}})[_0x3bd3('0x22')](respondWithResult(_0xddc65a,null))[_0x3bd3('0x3f')](handleError(_0xddc65a,null));};exports[_0x3bd3('0x4b')]=function(_0x35ff35,_0x59e274,_0x1f059b){var _0x4f366f={};var _0xdf66e7={};var _0x3a8ae5;var _0x43908e;return db['SalesforceConfiguration'][_0x3bd3('0x49')]({'where':{'id':_0x35ff35['params']['id']}})[_0x3bd3('0x22')](handleEntityNotFound(_0x59e274,null))[_0x3bd3('0x22')](function(_0x3a13e3){if(_0x3a13e3){_0x3a8ae5=_0x3a13e3;_0xdf66e7[_0x3bd3('0x2a')]=_['keys'](db[_0x3bd3('0x4a')][_0x3bd3('0x42')]);_0xdf66e7[_0x3bd3('0x2d')]=_[_0x3bd3('0x2e')](_0x35ff35[_0x3bd3('0x2d')]);_0xdf66e7['filters']=_[_0x3bd3('0x2f')](_0xdf66e7[_0x3bd3('0x2a')],_0xdf66e7['query']);_0x4f366f[_0x3bd3('0x30')]=_[_0x3bd3('0x2f')](_0xdf66e7['model'],qs['fields'](_0x35ff35[_0x3bd3('0x2d')][_0x3bd3('0x31')]));_0x4f366f[_0x3bd3('0x30')]=_0x4f366f[_0x3bd3('0x30')][_0x3bd3('0x32')]?_0x4f366f[_0x3bd3('0x30')]:_0xdf66e7[_0x3bd3('0x2a')];_0x4f366f['order']=qs[_0x3bd3('0x35')](_0x35ff35[_0x3bd3('0x2d')]['sort']);_0x4f366f[_0x3bd3('0x39')]=qs[_0x3bd3('0x36')](_[_0x3bd3('0x37')](_0x35ff35['query'],_0xdf66e7[_0x3bd3('0x36')]));if(_0x35ff35[_0x3bd3('0x2d')][_0x3bd3('0x38')]){_0x4f366f[_0x3bd3('0x39')]=_[_0x3bd3('0x3a')](_0x4f366f[_0x3bd3('0x39')],{'$or':_['map'](_0x4f366f[_0x3bd3('0x30')],function(_0x1cf027){var _0x413b7f={};_0x413b7f[_0x1cf027]={'$like':'%'+_0x35ff35[_0x3bd3('0x2d')]['filter']+'%'};return _0x413b7f;})});}_0x4f366f=_['merge']({},_0x4f366f,_0x35ff35[_0x3bd3('0x3b')]);return _0x3a8ae5[_0x3bd3('0x4b')](_0x4f366f);}})[_0x3bd3('0x22')](function(_0x46346a){if(_0x46346a){_0x43908e=_0x46346a[_0x3bd3('0x32')];if(!_0x35ff35[_0x3bd3('0x2d')][_0x3bd3('0x4c')](_0x3bd3('0x33'))){_0x4f366f[_0x3bd3('0x1c')]=qs[_0x3bd3('0x1c')](_0x35ff35[_0x3bd3('0x2d')][_0x3bd3('0x1c')]);_0x4f366f['offset']=qs[_0x3bd3('0x1a')](_0x35ff35[_0x3bd3('0x2d')][_0x3bd3('0x1a')]);}return _0x3a8ae5[_0x3bd3('0x4b')](_0x4f366f);}})[_0x3bd3('0x22')](function(_0x1b83dc){if(_0x1b83dc){return _0x1b83dc?{'count':_0x43908e,'rows':_0x1b83dc}:null;}})[_0x3bd3('0x22')](respondWithResult(_0x59e274,null))[_0x3bd3('0x3f')](handleError(_0x59e274,null));};exports[_0x3bd3('0x4d')]=function(_0x1b0ebe,_0x17fb86,_0x28ace5){var _0x57fd3f={};var _0x47d2af={};var _0x45b966;var _0x4ded72;return db[_0x3bd3('0x27')][_0x3bd3('0x49')]({'where':{'id':_0x1b0ebe[_0x3bd3('0x41')]['id']}})[_0x3bd3('0x22')](handleEntityNotFound(_0x17fb86,null))[_0x3bd3('0x22')](function(_0x50d04f){if(_0x50d04f){_0x45b966=_0x50d04f;_0x47d2af[_0x3bd3('0x2a')]=_[_0x3bd3('0x2e')](db[_0x3bd3('0x4a')][_0x3bd3('0x42')]);_0x47d2af[_0x3bd3('0x2d')]=_['keys'](_0x1b0ebe['query']);_0x47d2af[_0x3bd3('0x36')]=_[_0x3bd3('0x2f')](_0x47d2af[_0x3bd3('0x2a')],_0x47d2af[_0x3bd3('0x2d')]);_0x57fd3f[_0x3bd3('0x30')]=_['intersection'](_0x47d2af[_0x3bd3('0x2a')],qs[_0x3bd3('0x31')](_0x1b0ebe[_0x3bd3('0x2d')][_0x3bd3('0x31')]));_0x57fd3f[_0x3bd3('0x30')]=_0x57fd3f[_0x3bd3('0x30')][_0x3bd3('0x32')]?_0x57fd3f['attributes']:_0x47d2af[_0x3bd3('0x2a')];_0x57fd3f['order']=qs[_0x3bd3('0x35')](_0x1b0ebe[_0x3bd3('0x2d')]['sort']);_0x57fd3f[_0x3bd3('0x39')]=qs['filters'](_['pick'](_0x1b0ebe['query'],_0x47d2af['filters']));if(_0x1b0ebe[_0x3bd3('0x2d')][_0x3bd3('0x38')]){_0x57fd3f['where']=_[_0x3bd3('0x3a')](_0x57fd3f['where'],{'$or':_['map'](_0x57fd3f[_0x3bd3('0x30')],function(_0x51920f){var _0x5a21cd={};_0x5a21cd[_0x51920f]={'$like':'%'+_0x1b0ebe[_0x3bd3('0x2d')][_0x3bd3('0x38')]+'%'};return _0x5a21cd;})});}_0x57fd3f=_[_0x3bd3('0x3a')]({},_0x57fd3f,_0x1b0ebe[_0x3bd3('0x3b')]);return _0x45b966['getDescriptions'](_0x57fd3f);}})[_0x3bd3('0x22')](function(_0x383537){if(_0x383537){_0x4ded72=_0x383537[_0x3bd3('0x32')];if(!_0x1b0ebe[_0x3bd3('0x2d')][_0x3bd3('0x4c')](_0x3bd3('0x33'))){_0x57fd3f[_0x3bd3('0x1c')]=qs[_0x3bd3('0x1c')](_0x1b0ebe[_0x3bd3('0x2d')][_0x3bd3('0x1c')]);_0x57fd3f[_0x3bd3('0x1a')]=qs['offset'](_0x1b0ebe['query'][_0x3bd3('0x1a')]);}return _0x45b966[_0x3bd3('0x4d')](_0x57fd3f);}})[_0x3bd3('0x22')](function(_0x3be915){if(_0x3be915){return _0x3be915?{'count':_0x4ded72,'rows':_0x3be915}:null;}})[_0x3bd3('0x22')](respondWithResult(_0x17fb86,null))['catch'](handleError(_0x17fb86,null));}; \ No newline at end of file +var _0x1bb2=['index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','catch','params','length','find','create','body','getFields','SalesforceField','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1bb2,0xc6));var _0x21bb=function(_0x42f305,_0x6b02a){_0x42f305=_0x42f305-0x0;var _0x496f65=_0x1bb2[_0x42f305];return _0x496f65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21bb('0x0'));var zipdir=require(_0x21bb('0x1'));var jsonpatch=require(_0x21bb('0x2'));var rp=require('request-promise');var moment=require(_0x21bb('0x3'));var BPromise=require(_0x21bb('0x4'));var Mustache=require(_0x21bb('0x5'));var util=require(_0x21bb('0x6'));var path=require(_0x21bb('0x7'));var sox=require(_0x21bb('0x8'));var csv=require('to-csv');var ejs=require(_0x21bb('0x9'));var fs=require('fs');var fs_extra=require(_0x21bb('0xa'));var _=require(_0x21bb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21bb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x21bb('0xd'));var querystring=require(_0x21bb('0xe'));var Papa=require(_0x21bb('0xf'));var Redis=require(_0x21bb('0x10'));var authService=require(_0x21bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x21bb('0x12'));var hardwareService=require(_0x21bb('0x13'));var logger=require(_0x21bb('0x14'))(_0x21bb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21bb('0x16'));var db=require(_0x21bb('0x17'))['db'];function respondWithStatusCode(_0x20b6ca,_0x1f7a3e){_0x1f7a3e=_0x1f7a3e||0xcc;return function(_0xdb630b){if(_0xdb630b){return _0x20b6ca['sendStatus'](_0x1f7a3e);}return _0x20b6ca[_0x21bb('0x18')](_0x1f7a3e)['end']();};}function respondWithResult(_0x19143b,_0x20675e){_0x20675e=_0x20675e||0xc8;return function(_0x1f3945){if(_0x1f3945){return _0x19143b['status'](_0x20675e)[_0x21bb('0x19')](_0x1f3945);}};}function respondWithFilteredResult(_0x514b57,_0x547256){return function(_0x1e616c){if(_0x1e616c){var _0x45d055=typeof _0x547256[_0x21bb('0x1a')]==='undefined'&&typeof _0x547256[_0x21bb('0x1b')]===_0x21bb('0x1c');var _0x49ada3=_0x1e616c[_0x21bb('0x1d')];var _0x284baa=_0x45d055?0x0:_0x547256[_0x21bb('0x1a')];var _0x2d2b40=_0x45d055?_0x1e616c['count']:_0x547256['offset']+_0x547256[_0x21bb('0x1b')];var _0x4a550a;if(_0x2d2b40>=_0x49ada3){_0x2d2b40=_0x49ada3;_0x4a550a=0xc8;}else{_0x4a550a=0xce;}_0x514b57[_0x21bb('0x18')](_0x4a550a);return _0x514b57['set'](_0x21bb('0x1e'),_0x284baa+'-'+_0x2d2b40+'/'+_0x49ada3)[_0x21bb('0x19')](_0x1e616c);}return null;};}function patchUpdates(_0x2097d4){return function(_0x4c82fd){try{jsonpatch[_0x21bb('0x1f')](_0x4c82fd,_0x2097d4,!![]);}catch(_0x343780){return BPromise[_0x21bb('0x20')](_0x343780);}return _0x4c82fd[_0x21bb('0x21')]();};}function saveUpdates(_0x175ba4,_0x2fba39){return function(_0x4b816f){if(_0x4b816f){return _0x4b816f[_0x21bb('0x22')](_0x175ba4)[_0x21bb('0x23')](function(_0x2212da){return _0x2212da;});}return null;};}function removeEntity(_0x5eb692,_0x2079d2){return function(_0x88c02c){if(_0x88c02c){return _0x88c02c[_0x21bb('0x24')]()[_0x21bb('0x23')](function(){_0x5eb692[_0x21bb('0x18')](0xcc)[_0x21bb('0x25')]();});}};}function handleEntityNotFound(_0x57f088,_0x19f83e){return function(_0x3fbb93){if(!_0x3fbb93){_0x57f088[_0x21bb('0x26')](0x194);}return _0x3fbb93;};}function handleError(_0x1ebc31,_0x2781f6){_0x2781f6=_0x2781f6||0x1f4;return function(_0x52cb7d){logger['error'](_0x52cb7d[_0x21bb('0x27')]);if(_0x52cb7d[_0x21bb('0x28')]){delete _0x52cb7d['name'];}_0x1ebc31[_0x21bb('0x18')](_0x2781f6)[_0x21bb('0x29')](_0x52cb7d);};}exports[_0x21bb('0x2a')]=function(_0x57ba49,_0xde216f){var _0x270eb5={},_0x1991bf={},_0x1db13b={'count':0x0,'rows':[]};var _0x1af59a=_[_0x21bb('0x2b')](db['SalesforceConfiguration'][_0x21bb('0x2c')],function(_0xb8215f){return{'name':_0xb8215f['fieldName'],'type':_0xb8215f[_0x21bb('0x2d')][_0x21bb('0x2e')]};});_0x1991bf[_0x21bb('0x2f')]=_[_0x21bb('0x2b')](_0x1af59a,'name');_0x1991bf[_0x21bb('0x30')]=_[_0x21bb('0x31')](_0x57ba49[_0x21bb('0x30')]);_0x1991bf[_0x21bb('0x32')]=_[_0x21bb('0x33')](_0x1991bf[_0x21bb('0x2f')],_0x1991bf[_0x21bb('0x30')]);_0x270eb5[_0x21bb('0x34')]=_[_0x21bb('0x33')](_0x1991bf[_0x21bb('0x2f')],qs[_0x21bb('0x35')](_0x57ba49[_0x21bb('0x30')][_0x21bb('0x35')]));_0x270eb5[_0x21bb('0x34')]=_0x270eb5['attributes']['length']?_0x270eb5['attributes']:_0x1991bf['model'];if(!_0x57ba49[_0x21bb('0x30')][_0x21bb('0x36')](_0x21bb('0x37'))){_0x270eb5['limit']=qs[_0x21bb('0x1b')](_0x57ba49[_0x21bb('0x30')]['limit']);_0x270eb5['offset']=qs['offset'](_0x57ba49['query'][_0x21bb('0x1a')]);}_0x270eb5[_0x21bb('0x38')]=qs[_0x21bb('0x39')](_0x57ba49['query']['sort']);_0x270eb5[_0x21bb('0x3a')]=qs[_0x21bb('0x32')](_[_0x21bb('0x3b')](_0x57ba49[_0x21bb('0x30')],_0x1991bf[_0x21bb('0x32')]),_0x1af59a);if(_0x57ba49[_0x21bb('0x30')][_0x21bb('0x3c')]){_0x270eb5[_0x21bb('0x3a')]=_[_0x21bb('0x3d')](_0x270eb5[_0x21bb('0x3a')],{'$or':_['map'](_0x1af59a,function(_0x35f37e){if(_0x35f37e[_0x21bb('0x2d')]!==_0x21bb('0x3e')){var _0xeda8f8={};_0xeda8f8[_0x35f37e[_0x21bb('0x28')]]={'$like':'%'+_0x57ba49['query'][_0x21bb('0x3c')]+'%'};return _0xeda8f8;}})});}_0x270eb5=_[_0x21bb('0x3d')]({},_0x270eb5,_0x57ba49[_0x21bb('0x3f')]);var _0x480010={'where':_0x270eb5['where']};return db['SalesforceConfiguration'][_0x21bb('0x1d')](_0x480010)['then'](function(_0x4f867f){_0x1db13b[_0x21bb('0x1d')]=_0x4f867f;if(_0x57ba49[_0x21bb('0x30')][_0x21bb('0x40')]){_0x270eb5[_0x21bb('0x41')]=[{'all':!![]}];}return db[_0x21bb('0x42')][_0x21bb('0x43')](_0x270eb5);})[_0x21bb('0x23')](function(_0x2a784e){_0x1db13b[_0x21bb('0x44')]=_0x2a784e;return _0x1db13b;})['then'](respondWithFilteredResult(_0xde216f,_0x270eb5))[_0x21bb('0x45')](handleError(_0xde216f,null));};exports['show']=function(_0x43ecd5,_0x31d053){var _0x2f607a={'raw':![],'where':{'id':_0x43ecd5[_0x21bb('0x46')]['id']}},_0x2e23a3={};_0x2e23a3[_0x21bb('0x2f')]=_[_0x21bb('0x31')](db[_0x21bb('0x42')][_0x21bb('0x2c')]);_0x2e23a3[_0x21bb('0x30')]=_[_0x21bb('0x31')](_0x43ecd5[_0x21bb('0x30')]);_0x2e23a3['filters']=_[_0x21bb('0x33')](_0x2e23a3[_0x21bb('0x2f')],_0x2e23a3[_0x21bb('0x30')]);_0x2f607a['attributes']=_[_0x21bb('0x33')](_0x2e23a3[_0x21bb('0x2f')],qs[_0x21bb('0x35')](_0x43ecd5['query'][_0x21bb('0x35')]));_0x2f607a[_0x21bb('0x34')]=_0x2f607a['attributes'][_0x21bb('0x47')]?_0x2f607a[_0x21bb('0x34')]:_0x2e23a3[_0x21bb('0x2f')];if(_0x43ecd5[_0x21bb('0x30')][_0x21bb('0x40')]){_0x2f607a['include']=[{'all':!![]}];}_0x2f607a=_[_0x21bb('0x3d')]({},_0x2f607a,_0x43ecd5[_0x21bb('0x3f')]);return db['SalesforceConfiguration'][_0x21bb('0x48')](_0x2f607a)['then'](handleEntityNotFound(_0x31d053,null))[_0x21bb('0x23')](respondWithResult(_0x31d053,null))[_0x21bb('0x45')](handleError(_0x31d053,null));};exports['create']=function(_0x24d496,_0x5281e9){return db['SalesforceConfiguration'][_0x21bb('0x49')](_0x24d496[_0x21bb('0x4a')],{})[_0x21bb('0x23')](respondWithResult(_0x5281e9,0xc9))[_0x21bb('0x45')](handleError(_0x5281e9,null));};exports[_0x21bb('0x22')]=function(_0x513b8b,_0x43d73a){if(_0x513b8b[_0x21bb('0x4a')]['id']){delete _0x513b8b[_0x21bb('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x21bb('0x48')]({'where':{'id':_0x513b8b[_0x21bb('0x46')]['id']}})[_0x21bb('0x23')](handleEntityNotFound(_0x43d73a,null))[_0x21bb('0x23')](saveUpdates(_0x513b8b[_0x21bb('0x4a')],null))[_0x21bb('0x23')](respondWithResult(_0x43d73a,null))[_0x21bb('0x45')](handleError(_0x43d73a,null));};exports[_0x21bb('0x24')]=function(_0x3a87ed,_0x5e484a){return db[_0x21bb('0x42')][_0x21bb('0x48')]({'where':{'id':_0x3a87ed[_0x21bb('0x46')]['id']}})[_0x21bb('0x23')](handleEntityNotFound(_0x5e484a,null))[_0x21bb('0x23')](removeEntity(_0x5e484a,null))[_0x21bb('0x45')](handleError(_0x5e484a,null));};exports[_0x21bb('0x4b')]=function(_0x49d491,_0x2a326c,_0x492f02){var _0x37012e={};var _0x4e3669={};var _0x149e1d;var _0x24f8cb;return db[_0x21bb('0x42')]['findOne']({'where':{'id':_0x49d491[_0x21bb('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a326c,null))[_0x21bb('0x23')](function(_0x11760b){if(_0x11760b){_0x149e1d=_0x11760b;_0x4e3669[_0x21bb('0x2f')]=_[_0x21bb('0x31')](db[_0x21bb('0x4c')][_0x21bb('0x2c')]);_0x4e3669[_0x21bb('0x30')]=_[_0x21bb('0x31')](_0x49d491[_0x21bb('0x30')]);_0x4e3669[_0x21bb('0x32')]=_[_0x21bb('0x33')](_0x4e3669[_0x21bb('0x2f')],_0x4e3669[_0x21bb('0x30')]);_0x37012e['attributes']=_[_0x21bb('0x33')](_0x4e3669['model'],qs[_0x21bb('0x35')](_0x49d491['query'][_0x21bb('0x35')]));_0x37012e['attributes']=_0x37012e[_0x21bb('0x34')][_0x21bb('0x47')]?_0x37012e['attributes']:_0x4e3669['model'];_0x37012e[_0x21bb('0x38')]=qs[_0x21bb('0x39')](_0x49d491[_0x21bb('0x30')][_0x21bb('0x39')]);_0x37012e[_0x21bb('0x3a')]=qs[_0x21bb('0x32')](_[_0x21bb('0x3b')](_0x49d491[_0x21bb('0x30')],_0x4e3669[_0x21bb('0x32')]));if(_0x49d491['query'][_0x21bb('0x3c')]){_0x37012e[_0x21bb('0x3a')]=_[_0x21bb('0x3d')](_0x37012e['where'],{'$or':_['map'](_0x37012e['attributes'],function(_0x23e80d){var _0x23fa4e={};_0x23fa4e[_0x23e80d]={'$like':'%'+_0x49d491[_0x21bb('0x30')][_0x21bb('0x3c')]+'%'};return _0x23fa4e;})});}_0x37012e=_[_0x21bb('0x3d')]({},_0x37012e,_0x49d491['options']);return _0x149e1d['getFields'](_0x37012e);}})[_0x21bb('0x23')](function(_0x3f95de){if(_0x3f95de){_0x24f8cb=_0x3f95de[_0x21bb('0x47')];if(!_0x49d491[_0x21bb('0x30')]['hasOwnProperty'](_0x21bb('0x37'))){_0x37012e[_0x21bb('0x1b')]=qs[_0x21bb('0x1b')](_0x49d491[_0x21bb('0x30')][_0x21bb('0x1b')]);_0x37012e['offset']=qs[_0x21bb('0x1a')](_0x49d491[_0x21bb('0x30')]['offset']);}return _0x149e1d['getFields'](_0x37012e);}})[_0x21bb('0x23')](function(_0x408de8){if(_0x408de8){return _0x408de8?{'count':_0x24f8cb,'rows':_0x408de8}:null;}})['then'](respondWithResult(_0x2a326c,null))[_0x21bb('0x45')](handleError(_0x2a326c,null));};exports[_0x21bb('0x4d')]=function(_0x1c5819,_0x4ff262,_0x3b237e){var _0x533d82={};var _0x18c413={};var _0x3e56f9;var _0x4b4767;return db[_0x21bb('0x42')][_0x21bb('0x4e')]({'where':{'id':_0x1c5819[_0x21bb('0x46')]['id']}})[_0x21bb('0x23')](handleEntityNotFound(_0x4ff262,null))[_0x21bb('0x23')](function(_0x3a03fd){if(_0x3a03fd){_0x3e56f9=_0x3a03fd;_0x18c413[_0x21bb('0x2f')]=_[_0x21bb('0x31')](db['SalesforceField'][_0x21bb('0x2c')]);_0x18c413[_0x21bb('0x30')]=_[_0x21bb('0x31')](_0x1c5819[_0x21bb('0x30')]);_0x18c413[_0x21bb('0x32')]=_[_0x21bb('0x33')](_0x18c413['model'],_0x18c413[_0x21bb('0x30')]);_0x533d82[_0x21bb('0x34')]=_[_0x21bb('0x33')](_0x18c413['model'],qs[_0x21bb('0x35')](_0x1c5819[_0x21bb('0x30')][_0x21bb('0x35')]));_0x533d82[_0x21bb('0x34')]=_0x533d82['attributes'][_0x21bb('0x47')]?_0x533d82[_0x21bb('0x34')]:_0x18c413[_0x21bb('0x2f')];_0x533d82[_0x21bb('0x38')]=qs[_0x21bb('0x39')](_0x1c5819['query']['sort']);_0x533d82[_0x21bb('0x3a')]=qs[_0x21bb('0x32')](_[_0x21bb('0x3b')](_0x1c5819[_0x21bb('0x30')],_0x18c413[_0x21bb('0x32')]));if(_0x1c5819[_0x21bb('0x30')][_0x21bb('0x3c')]){_0x533d82[_0x21bb('0x3a')]=_[_0x21bb('0x3d')](_0x533d82[_0x21bb('0x3a')],{'$or':_[_0x21bb('0x2b')](_0x533d82[_0x21bb('0x34')],function(_0x44ab11){var _0xbb0d6d={};_0xbb0d6d[_0x44ab11]={'$like':'%'+_0x1c5819['query']['filter']+'%'};return _0xbb0d6d;})});}_0x533d82=_[_0x21bb('0x3d')]({},_0x533d82,_0x1c5819[_0x21bb('0x3f')]);return _0x3e56f9[_0x21bb('0x4d')](_0x533d82);}})[_0x21bb('0x23')](function(_0x5e5cc2){if(_0x5e5cc2){_0x4b4767=_0x5e5cc2[_0x21bb('0x47')];if(!_0x1c5819[_0x21bb('0x30')][_0x21bb('0x36')]('nolimit')){_0x533d82[_0x21bb('0x1b')]=qs[_0x21bb('0x1b')](_0x1c5819[_0x21bb('0x30')][_0x21bb('0x1b')]);_0x533d82[_0x21bb('0x1a')]=qs[_0x21bb('0x1a')](_0x1c5819[_0x21bb('0x30')][_0x21bb('0x1a')]);}return _0x3e56f9['getSubjects'](_0x533d82);}})['then'](function(_0x3e7fdb){if(_0x3e7fdb){return _0x3e7fdb?{'count':_0x4b4767,'rows':_0x3e7fdb}:null;}})[_0x21bb('0x23')](respondWithResult(_0x4ff262,null))[_0x21bb('0x45')](handleError(_0x4ff262,null));};exports[_0x21bb('0x4f')]=function(_0x37062,_0x383faa,_0x3d295d){var _0x517e9b={};var _0x1ad776={};var _0x2e7a70;var _0x301025;return db[_0x21bb('0x42')][_0x21bb('0x4e')]({'where':{'id':_0x37062[_0x21bb('0x46')]['id']}})[_0x21bb('0x23')](handleEntityNotFound(_0x383faa,null))['then'](function(_0x380daf){if(_0x380daf){_0x2e7a70=_0x380daf;_0x1ad776[_0x21bb('0x2f')]=_[_0x21bb('0x31')](db[_0x21bb('0x4c')][_0x21bb('0x2c')]);_0x1ad776[_0x21bb('0x30')]=_[_0x21bb('0x31')](_0x37062[_0x21bb('0x30')]);_0x1ad776[_0x21bb('0x32')]=_[_0x21bb('0x33')](_0x1ad776[_0x21bb('0x2f')],_0x1ad776['query']);_0x517e9b[_0x21bb('0x34')]=_[_0x21bb('0x33')](_0x1ad776['model'],qs[_0x21bb('0x35')](_0x37062['query']['fields']));_0x517e9b[_0x21bb('0x34')]=_0x517e9b[_0x21bb('0x34')]['length']?_0x517e9b['attributes']:_0x1ad776[_0x21bb('0x2f')];_0x517e9b['order']=qs['sort'](_0x37062[_0x21bb('0x30')]['sort']);_0x517e9b[_0x21bb('0x3a')]=qs[_0x21bb('0x32')](_['pick'](_0x37062[_0x21bb('0x30')],_0x1ad776[_0x21bb('0x32')]));if(_0x37062[_0x21bb('0x30')]['filter']){_0x517e9b['where']=_[_0x21bb('0x3d')](_0x517e9b[_0x21bb('0x3a')],{'$or':_[_0x21bb('0x2b')](_0x517e9b['attributes'],function(_0x2f23cc){var _0x2c712e={};_0x2c712e[_0x2f23cc]={'$like':'%'+_0x37062[_0x21bb('0x30')][_0x21bb('0x3c')]+'%'};return _0x2c712e;})});}_0x517e9b=_[_0x21bb('0x3d')]({},_0x517e9b,_0x37062[_0x21bb('0x3f')]);return _0x2e7a70['getDescriptions'](_0x517e9b);}})[_0x21bb('0x23')](function(_0xc17f91){if(_0xc17f91){_0x301025=_0xc17f91['length'];if(!_0x37062[_0x21bb('0x30')][_0x21bb('0x36')](_0x21bb('0x37'))){_0x517e9b[_0x21bb('0x1b')]=qs[_0x21bb('0x1b')](_0x37062[_0x21bb('0x30')]['limit']);_0x517e9b[_0x21bb('0x1a')]=qs[_0x21bb('0x1a')](_0x37062[_0x21bb('0x30')][_0x21bb('0x1a')]);}return _0x2e7a70[_0x21bb('0x4f')](_0x517e9b);}})['then'](function(_0x57c482){if(_0x57c482){return _0x57c482?{'count':_0x301025,'rows':_0x57c482}:null;}})[_0x21bb('0x23')](respondWithResult(_0x383faa,null))[_0x21bb('0x45')](handleError(_0x383faa,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 900170b..a11581e 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 _0x336d=['rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1580f7,_0xf2b31c){var _0x2a5b4f=function(_0x3e8173){while(--_0x3e8173){_0x1580f7['push'](_0x1580f7['shift']());}};_0x2a5b4f(++_0xf2b31c);}(_0x336d,0x14a));var _0xd336=function(_0x1c9eb6,_0x23a464){_0x1c9eb6=_0x1c9eb6-0x0;var _0x54894c=_0x336d[_0x1c9eb6];return _0x54894c;};'use strict';var _=require(_0xd336('0x0'));var util=require(_0xd336('0x1'));var logger=require(_0xd336('0x2'))(_0xd336('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd336('0x4'));var fs=require('fs');var path=require(_0xd336('0x5'));var rimraf=require(_0xd336('0x6'));var config=require(_0xd336('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd336('0x8')]=function(_0x39c889,_0x53325b){return _0x39c889[_0xd336('0x9')](_0xd336('0xa'),attributes,{'tableName':_0xd336('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e5=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','define'];(function(_0x173a6c,_0x18ec0c){var _0x342ae2=function(_0x4da4f5){while(--_0x4da4f5){_0x173a6c['push'](_0x173a6c['shift']());}};_0x342ae2(++_0x18ec0c);}(_0x20e5,0xde));var _0x520e=function(_0x37db35,_0x12904b){_0x37db35=_0x37db35-0x0;var _0x490f53=_0x20e5[_0x37db35];return _0x490f53;};'use strict';var _=require(_0x520e('0x0'));var util=require(_0x520e('0x1'));var logger=require('../../config/logger')(_0x520e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x520e('0x3'));var fs=require('fs');var path=require(_0x520e('0x4'));var rimraf=require(_0x520e('0x5'));var config=require('../../config/environment');var attributes=require(_0x520e('0x6'));module['exports']=function(_0x41d0d1,_0x54ddd1){return _0x41d0d1[_0x520e('0x7')](_0x520e('0x8'),attributes,{'tableName':_0x520e('0x9'),'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 cf303d0..e483aca 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 _0x7828=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x1ed000,_0x2129a8){var _0x566892=function(_0x58d170){while(--_0x58d170){_0x1ed000['push'](_0x1ed000['shift']());}};_0x566892(++_0x2129a8);}(_0x7828,0x6c));var _0x8782=function(_0x340b63,_0x4725e0){_0x340b63=_0x340b63-0x0;var _0x2049f0=_0x7828[_0x340b63];return _0x2049f0;};'use strict';var _=require('lodash');var util=require(_0x8782('0x0'));var moment=require(_0x8782('0x1'));var BPromise=require(_0x8782('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8782('0x3'));var db=require(_0x8782('0x4'))['db'];var utils=require(_0x8782('0x5'));var logger=require('../../config/logger')(_0x8782('0x6'));var config=require(_0x8782('0x7'));var jayson=require(_0x8782('0x8'));var client=jayson[_0x8782('0x9')][_0x8782('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37ec5b,_0x298b96,_0x38ccc5){return new BPromise(function(_0x37ffe7,_0x1d63e3){return client[_0x8782('0xb')](_0x37ec5b,_0x38ccc5)[_0x8782('0xc')](function(_0x347706){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x298b96,_0x8782('0xd'));logger[_0x8782('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x298b96,_0x8782('0xd'),JSON[_0x8782('0xf')](_0x347706));if(_0x347706[_0x8782('0x10')]){if(_0x347706[_0x8782('0x10')][_0x8782('0x11')]===0x1f4){logger[_0x8782('0x10')](_0x8782('0x12'),_0x298b96,_0x347706['error'][_0x8782('0x13')]);return _0x1d63e3(_0x347706[_0x8782('0x10')]['message']);}logger[_0x8782('0x10')](_0x8782('0x12'),_0x298b96,_0x347706[_0x8782('0x10')]['message']);return _0x37ffe7(_0x347706[_0x8782('0x10')][_0x8782('0x13')]);}else{logger['info'](_0x8782('0x12'),_0x298b96,_0x8782('0xd'));_0x37ffe7(_0x347706[_0x8782('0x14')]['message']);}})[_0x8782('0x15')](function(_0x30aeb9){logger[_0x8782('0x10')](_0x8782('0x12'),_0x298b96,_0x30aeb9);_0x1d63e3(_0x30aeb9);});});} \ No newline at end of file +var _0x44da=['stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3516d6,_0x267d11){var _0xed8d6e=function(_0x4bba41){while(--_0x4bba41){_0x3516d6['push'](_0x3516d6['shift']());}};_0xed8d6e(++_0x267d11);}(_0x44da,0x104));var _0xa44d=function(_0x1c6f9f,_0x123e91){_0x1c6f9f=_0x1c6f9f-0x0;var _0x6ed05e=_0x44da[_0x1c6f9f];return _0x6ed05e;};'use strict';var _=require(_0xa44d('0x0'));var util=require(_0xa44d('0x1'));var moment=require(_0xa44d('0x2'));var BPromise=require('bluebird');var rs=require(_0xa44d('0x3'));var fs=require('fs');var Redis=require(_0xa44d('0x4'));var db=require(_0xa44d('0x5'))['db'];var utils=require(_0xa44d('0x6'));var logger=require('../../config/logger')(_0xa44d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa44d('0x8')][_0xa44d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae1c6,_0x4622b2,_0x104949){return new BPromise(function(_0x22365b,_0x5740e3){return client[_0xa44d('0xa')](_0x5ae1c6,_0x104949)[_0xa44d('0xb')](function(_0x4e584f){logger[_0xa44d('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4622b2,_0xa44d('0xd'));logger[_0xa44d('0xe')](_0xa44d('0xf'),_0x4622b2,_0xa44d('0xd'),JSON[_0xa44d('0x10')](_0x4e584f));if(_0x4e584f[_0xa44d('0x11')]){if(_0x4e584f[_0xa44d('0x11')][_0xa44d('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4622b2,_0x4e584f['error'][_0xa44d('0x13')]);return _0x5740e3(_0x4e584f[_0xa44d('0x11')][_0xa44d('0x13')]);}logger[_0xa44d('0x11')](_0xa44d('0x14'),_0x4622b2,_0x4e584f[_0xa44d('0x11')][_0xa44d('0x13')]);return _0x22365b(_0x4e584f[_0xa44d('0x11')][_0xa44d('0x13')]);}else{logger[_0xa44d('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4622b2,_0xa44d('0xd'));_0x22365b(_0x4e584f[_0xa44d('0x15')][_0xa44d('0x13')]);}})[_0xa44d('0x16')](function(_0x18b212){logger[_0xa44d('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4622b2,_0x18b212);_0x5740e3(_0x18b212);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c265688..e8979bd 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 _0x5e69=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd075fd,_0x42a9d1){var _0x367c6c=function(_0x5ccfb3){while(--_0x5ccfb3){_0xd075fd['push'](_0xd075fd['shift']());}};_0x367c6c(++_0x42a9d1);}(_0x5e69,0x91));var _0x95e6=function(_0x4383e9,_0xa4b307){_0x4383e9=_0x4383e9-0x0;var _0x355405=_0x5e69[_0x4383e9];return _0x355405;};'use strict';var multer=require(_0x95e6('0x0'));var util=require(_0x95e6('0x1'));var path=require(_0x95e6('0x2'));var timeout=require(_0x95e6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x95e6('0x4'));var auth=require(_0x95e6('0x5'));var interaction=require(_0x95e6('0x6'));var config=require(_0x95e6('0x7'));var controller=require(_0x95e6('0x8'));router[_0x95e6('0x9')]('/',auth[_0x95e6('0xa')](),controller[_0x95e6('0xb')]);router['get'](_0x95e6('0xc'),auth[_0x95e6('0xa')](),controller[_0x95e6('0xd')]);router['post']('/',auth[_0x95e6('0xa')](),controller['create']);router[_0x95e6('0xe')](_0x95e6('0xc'),auth[_0x95e6('0xa')](),controller[_0x95e6('0xf')]);router[_0x95e6('0x10')](_0x95e6('0xc'),auth[_0x95e6('0xa')](),controller[_0x95e6('0x11')]);module[_0x95e6('0x12')]=router; \ No newline at end of file +var _0x9fd1=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','/:id','show','put','update'];(function(_0x491d7,_0x2de6a7){var _0xedbe9e=function(_0x5f1b0e){while(--_0x5f1b0e){_0x491d7['push'](_0x491d7['shift']());}};_0xedbe9e(++_0x2de6a7);}(_0x9fd1,0x133));var _0x19fd=function(_0x2b5773,_0x2d7385){_0x2b5773=_0x2b5773-0x0;var _0x2bb36d=_0x9fd1[_0x2b5773];return _0x2bb36d;};'use strict';var multer=require(_0x19fd('0x0'));var util=require(_0x19fd('0x1'));var path=require(_0x19fd('0x2'));var timeout=require(_0x19fd('0x3'));var express=require(_0x19fd('0x4'));var router=express[_0x19fd('0x5')]();var fs_extra=require(_0x19fd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x19fd('0x7'));var config=require(_0x19fd('0x8'));var controller=require(_0x19fd('0x9'));router['get']('/',auth[_0x19fd('0xa')](),controller[_0x19fd('0xb')]);router['get'](_0x19fd('0xc'),auth['isAuthenticated'](),controller[_0x19fd('0xd')]);router['post']('/',auth[_0x19fd('0xa')](),controller['create']);router[_0x19fd('0xe')](_0x19fd('0xc'),auth[_0x19fd('0xa')](),controller[_0x19fd('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x19fd('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index df53063..6250478 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 _0x906a=['STRING','string','customVariable','sequelize','exports','ENUM','variable','keyValue','picklist'];(function(_0x383fcc,_0x22d1f9){var _0x299182=function(_0x7c6b8c){while(--_0x7c6b8c){_0x383fcc['push'](_0x383fcc['shift']());}};_0x299182(++_0x22d1f9);}(_0x906a,0xed));var _0xa906=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x906a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xa906('0x0'));module[_0xa906('0x1')]={'type':{'type':Sequelize[_0xa906('0x2')]('string',_0xa906('0x3'),'customVariable',_0xa906('0x4'),_0xa906('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa906('0x6')]},'keyType':{'type':Sequelize[_0xa906('0x2')](_0xa906('0x7'),_0xa906('0x3'),_0xa906('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa906('0x6')]},'variableName':{'type':Sequelize[_0xa906('0x6')]}}; \ No newline at end of file +var _0xc78d=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xc78d,0x1a6));var _0xdc78=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc78d[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xdc78('0x0'));module[_0xdc78('0x1')]={'type':{'type':Sequelize[_0xdc78('0x2')](_0xdc78('0x3'),_0xdc78('0x4'),_0xdc78('0x5'),_0xdc78('0x6'),_0xdc78('0x7')),'defaultValue':_0xdc78('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdc78('0x2')](_0xdc78('0x3'),_0xdc78('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xdc78('0x8')]},'idField':{'type':Sequelize[_0xdc78('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index de24410..7576095 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 _0xc4f2=['apply','reject','save','update','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','show','params','length','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range'];(function(_0x28cb74,_0x5e86ca){var _0x1eb87b=function(_0x3b4eae){while(--_0x3b4eae){_0x28cb74['push'](_0x28cb74['shift']());}};_0x1eb87b(++_0x5e86ca);}(_0xc4f2,0xb9));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2c4f('0x0'));var rimraf=require(_0x2c4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c4f('0x2'));var rp=require(_0x2c4f('0x3'));var moment=require(_0x2c4f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c4f('0x5'));var util=require(_0x2c4f('0x6'));var path=require(_0x2c4f('0x7'));var sox=require(_0x2c4f('0x8'));var csv=require(_0x2c4f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c4f('0xa'));var squel=require(_0x2c4f('0xb'));var crypto=require('crypto');var jsforce=require(_0x2c4f('0xc'));var deskjs=require(_0x2c4f('0xd'));var toCsv=require(_0x2c4f('0x9'));var querystring=require(_0x2c4f('0xe'));var Papa=require(_0x2c4f('0xf'));var Redis=require(_0x2c4f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2c4f('0x11'));var as=require(_0x2c4f('0x12'));var hardwareService=require(_0x2c4f('0x13'));var logger=require('../../config/logger')(_0x2c4f('0x14'));var utils=require('../../config/utils');var config=require(_0x2c4f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c4f('0x16'))['db'];function respondWithStatusCode(_0x32cd9d,_0x1f200b){_0x1f200b=_0x1f200b||0xcc;return function(_0x3065f2){if(_0x3065f2){return _0x32cd9d[_0x2c4f('0x17')](_0x1f200b);}return _0x32cd9d['status'](_0x1f200b)['end']();};}function respondWithResult(_0x12b6b9,_0x3e77b6){_0x3e77b6=_0x3e77b6||0xc8;return function(_0x42dd03){if(_0x42dd03){return _0x12b6b9[_0x2c4f('0x18')](_0x3e77b6)[_0x2c4f('0x19')](_0x42dd03);}};}function respondWithFilteredResult(_0x3723b0,_0x340e52){return function(_0x131d30){if(_0x131d30){var _0x5d1960=typeof _0x340e52[_0x2c4f('0x1a')]===_0x2c4f('0x1b')&&typeof _0x340e52['limit']===_0x2c4f('0x1b');var _0x443379=_0x131d30[_0x2c4f('0x1c')];var _0xe9d167=_0x5d1960?0x0:_0x340e52[_0x2c4f('0x1a')];var _0x1dd53c=_0x5d1960?_0x131d30[_0x2c4f('0x1c')]:_0x340e52[_0x2c4f('0x1a')]+_0x340e52[_0x2c4f('0x1d')];var _0x5ae73c;if(_0x1dd53c>=_0x443379){_0x1dd53c=_0x443379;_0x5ae73c=0xc8;}else{_0x5ae73c=0xce;}_0x3723b0[_0x2c4f('0x18')](_0x5ae73c);return _0x3723b0['set'](_0x2c4f('0x1e'),_0xe9d167+'-'+_0x1dd53c+'/'+_0x443379)['json'](_0x131d30);}return null;};}function patchUpdates(_0x25728c){return function(_0x3d7363){try{jsonpatch[_0x2c4f('0x1f')](_0x3d7363,_0x25728c,!![]);}catch(_0x3ec50e){return BPromise[_0x2c4f('0x20')](_0x3ec50e);}return _0x3d7363[_0x2c4f('0x21')]();};}function saveUpdates(_0x567c11,_0x5d07ff){return function(_0x453a71){if(_0x453a71){return _0x453a71[_0x2c4f('0x22')](_0x567c11)['then'](function(_0x4903e4){return _0x4903e4;});}return null;};}function removeEntity(_0x185c70,_0x3aca4f){return function(_0xe3249f){if(_0xe3249f){return _0xe3249f[_0x2c4f('0x23')]()['then'](function(){_0x185c70[_0x2c4f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a662,_0x307463){return function(_0x3faa79){if(!_0x3faa79){_0x26a662[_0x2c4f('0x17')](0x194);}return _0x3faa79;};}function handleError(_0x11dec0,_0xb2798a){_0xb2798a=_0xb2798a||0x1f4;return function(_0x10e4f2){logger[_0x2c4f('0x24')](_0x10e4f2[_0x2c4f('0x25')]);if(_0x10e4f2[_0x2c4f('0x26')]){delete _0x10e4f2[_0x2c4f('0x26')];}_0x11dec0[_0x2c4f('0x18')](_0xb2798a)[_0x2c4f('0x27')](_0x10e4f2);};}exports['index']=function(_0x3c67b3,_0x5c9fed){var _0x3b32dd={},_0x14e649={},_0x37c9bf={'count':0x0,'rows':[]};var _0x25b439=_[_0x2c4f('0x28')](db[_0x2c4f('0x29')][_0x2c4f('0x2a')],function(_0x259f7b){return{'name':_0x259f7b[_0x2c4f('0x2b')],'type':_0x259f7b[_0x2c4f('0x2c')]['key']};});_0x14e649[_0x2c4f('0x2d')]=_['map'](_0x25b439,_0x2c4f('0x26'));_0x14e649['query']=_[_0x2c4f('0x2e')](_0x3c67b3[_0x2c4f('0x2f')]);_0x14e649[_0x2c4f('0x30')]=_[_0x2c4f('0x31')](_0x14e649[_0x2c4f('0x2d')],_0x14e649[_0x2c4f('0x2f')]);_0x3b32dd[_0x2c4f('0x32')]=_['intersection'](_0x14e649[_0x2c4f('0x2d')],qs[_0x2c4f('0x33')](_0x3c67b3[_0x2c4f('0x2f')]['fields']));_0x3b32dd[_0x2c4f('0x32')]=_0x3b32dd['attributes']['length']?_0x3b32dd[_0x2c4f('0x32')]:_0x14e649[_0x2c4f('0x2d')];if(!_0x3c67b3[_0x2c4f('0x2f')][_0x2c4f('0x34')](_0x2c4f('0x35'))){_0x3b32dd['limit']=qs[_0x2c4f('0x1d')](_0x3c67b3['query'][_0x2c4f('0x1d')]);_0x3b32dd[_0x2c4f('0x1a')]=qs[_0x2c4f('0x1a')](_0x3c67b3[_0x2c4f('0x2f')]['offset']);}_0x3b32dd[_0x2c4f('0x36')]=qs['sort'](_0x3c67b3['query'][_0x2c4f('0x37')]);_0x3b32dd[_0x2c4f('0x38')]=qs[_0x2c4f('0x30')](_[_0x2c4f('0x39')](_0x3c67b3[_0x2c4f('0x2f')],_0x14e649[_0x2c4f('0x30')]),_0x25b439);if(_0x3c67b3['query'][_0x2c4f('0x3a')]){_0x3b32dd[_0x2c4f('0x38')]=_[_0x2c4f('0x3b')](_0x3b32dd['where'],{'$or':_['map'](_0x25b439,function(_0x33887b){if(_0x33887b['type']!=='VIRTUAL'){var _0x3711fa={};_0x3711fa[_0x33887b[_0x2c4f('0x26')]]={'$like':'%'+_0x3c67b3[_0x2c4f('0x2f')][_0x2c4f('0x3a')]+'%'};return _0x3711fa;}})});}_0x3b32dd=_[_0x2c4f('0x3b')]({},_0x3b32dd,_0x3c67b3[_0x2c4f('0x3c')]);var _0x272c3f={'where':_0x3b32dd[_0x2c4f('0x38')]};return db[_0x2c4f('0x29')]['count'](_0x272c3f)[_0x2c4f('0x3d')](function(_0x390f5f){_0x37c9bf['count']=_0x390f5f;if(_0x3c67b3['query'][_0x2c4f('0x3e')]){_0x3b32dd[_0x2c4f('0x3f')]=[{'all':!![]}];}return db[_0x2c4f('0x29')][_0x2c4f('0x40')](_0x3b32dd);})[_0x2c4f('0x3d')](function(_0x6cbc3f){_0x37c9bf[_0x2c4f('0x41')]=_0x6cbc3f;return _0x37c9bf;})[_0x2c4f('0x3d')](respondWithFilteredResult(_0x5c9fed,_0x3b32dd))['catch'](handleError(_0x5c9fed,null));};exports[_0x2c4f('0x42')]=function(_0x5599e1,_0x1883af){var _0x42bed3={'raw':!![],'where':{'id':_0x5599e1[_0x2c4f('0x43')]['id']}},_0x521019={};_0x521019[_0x2c4f('0x2d')]=_['keys'](db['SalesforceField'][_0x2c4f('0x2a')]);_0x521019[_0x2c4f('0x2f')]=_[_0x2c4f('0x2e')](_0x5599e1[_0x2c4f('0x2f')]);_0x521019[_0x2c4f('0x30')]=_[_0x2c4f('0x31')](_0x521019[_0x2c4f('0x2d')],_0x521019[_0x2c4f('0x2f')]);_0x42bed3[_0x2c4f('0x32')]=_[_0x2c4f('0x31')](_0x521019[_0x2c4f('0x2d')],qs['fields'](_0x5599e1[_0x2c4f('0x2f')][_0x2c4f('0x33')]));_0x42bed3['attributes']=_0x42bed3[_0x2c4f('0x32')][_0x2c4f('0x44')]?_0x42bed3[_0x2c4f('0x32')]:_0x521019['model'];if(_0x5599e1[_0x2c4f('0x2f')]['includeAll']){_0x42bed3[_0x2c4f('0x3f')]=[{'all':!![]}];}_0x42bed3=_[_0x2c4f('0x3b')]({},_0x42bed3,_0x5599e1[_0x2c4f('0x3c')]);return db[_0x2c4f('0x29')][_0x2c4f('0x45')](_0x42bed3)[_0x2c4f('0x3d')](handleEntityNotFound(_0x1883af,null))[_0x2c4f('0x3d')](respondWithResult(_0x1883af,null))[_0x2c4f('0x46')](handleError(_0x1883af,null));};exports['create']=function(_0x222319,_0x5782ec){return db[_0x2c4f('0x29')]['create'](_0x222319['body'],{})[_0x2c4f('0x3d')](respondWithResult(_0x5782ec,0xc9))[_0x2c4f('0x46')](handleError(_0x5782ec,null));};exports['update']=function(_0x306937,_0x549d6d){if(_0x306937[_0x2c4f('0x47')]['id']){delete _0x306937[_0x2c4f('0x47')]['id'];}return db[_0x2c4f('0x29')]['find']({'where':{'id':_0x306937[_0x2c4f('0x43')]['id']}})[_0x2c4f('0x3d')](handleEntityNotFound(_0x549d6d,null))['then'](saveUpdates(_0x306937[_0x2c4f('0x47')],null))['then'](respondWithResult(_0x549d6d,null))[_0x2c4f('0x46')](handleError(_0x549d6d,null));};exports['destroy']=function(_0x2dd3b4,_0x44d4d1){return db[_0x2c4f('0x29')][_0x2c4f('0x45')]({'where':{'id':_0x2dd3b4[_0x2c4f('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d4d1,null))[_0x2c4f('0x3d')](removeEntity(_0x44d4d1,null))[_0x2c4f('0x46')](handleError(_0x44d4d1,null));}; \ No newline at end of file +var _0xf254=['util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','SalesforceField','includeAll','catch','show','keys','find','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xf254,0x11a));var _0x4f25=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xf254[_0x30cd7e];return _0x462a02;};'use strict';var emlformat=require(_0x4f25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f25('0x1'));var jsonpatch=require(_0x4f25('0x2'));var rp=require('request-promise');var moment=require(_0x4f25('0x3'));var BPromise=require(_0x4f25('0x4'));var Mustache=require(_0x4f25('0x5'));var util=require(_0x4f25('0x6'));var path=require('path');var sox=require(_0x4f25('0x7'));var csv=require('to-csv');var ejs=require(_0x4f25('0x8'));var fs=require('fs');var fs_extra=require(_0x4f25('0x9'));var _=require(_0x4f25('0xa'));var squel=require('squel');var crypto=require(_0x4f25('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4f25('0xc'));var toCsv=require(_0x4f25('0xd'));var querystring=require(_0x4f25('0xe'));var Papa=require(_0x4f25('0xf'));var Redis=require(_0x4f25('0x10'));var authService=require(_0x4f25('0x11'));var qs=require(_0x4f25('0x12'));var as=require(_0x4f25('0x13'));var hardwareService=require(_0x4f25('0x14'));var logger=require(_0x4f25('0x15'))(_0x4f25('0x16'));var utils=require(_0x4f25('0x17'));var config=require(_0x4f25('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f25('0x19'))['db'];function respondWithStatusCode(_0x66b9fb,_0x195119){_0x195119=_0x195119||0xcc;return function(_0x35b546){if(_0x35b546){return _0x66b9fb[_0x4f25('0x1a')](_0x195119);}return _0x66b9fb[_0x4f25('0x1b')](_0x195119)[_0x4f25('0x1c')]();};}function respondWithResult(_0x5f1a9b,_0x31f19e){_0x31f19e=_0x31f19e||0xc8;return function(_0x3243c2){if(_0x3243c2){return _0x5f1a9b[_0x4f25('0x1b')](_0x31f19e)[_0x4f25('0x1d')](_0x3243c2);}};}function respondWithFilteredResult(_0x55c30a,_0x297f92){return function(_0x10271e){if(_0x10271e){var _0xb9be3e=typeof _0x297f92[_0x4f25('0x1e')]===_0x4f25('0x1f')&&typeof _0x297f92[_0x4f25('0x20')]===_0x4f25('0x1f');var _0x1a9380=_0x10271e[_0x4f25('0x21')];var _0x4feaca=_0xb9be3e?0x0:_0x297f92[_0x4f25('0x1e')];var _0x4c5094=_0xb9be3e?_0x10271e[_0x4f25('0x21')]:_0x297f92[_0x4f25('0x1e')]+_0x297f92[_0x4f25('0x20')];var _0x3bff07;if(_0x4c5094>=_0x1a9380){_0x4c5094=_0x1a9380;_0x3bff07=0xc8;}else{_0x3bff07=0xce;}_0x55c30a[_0x4f25('0x1b')](_0x3bff07);return _0x55c30a[_0x4f25('0x22')](_0x4f25('0x23'),_0x4feaca+'-'+_0x4c5094+'/'+_0x1a9380)['json'](_0x10271e);}return null;};}function patchUpdates(_0x3fc6a3){return function(_0x4aa3d4){try{jsonpatch[_0x4f25('0x24')](_0x4aa3d4,_0x3fc6a3,!![]);}catch(_0x100032){return BPromise[_0x4f25('0x25')](_0x100032);}return _0x4aa3d4['save']();};}function saveUpdates(_0x1f9c36,_0x39b9ef){return function(_0xfe531d){if(_0xfe531d){return _0xfe531d['update'](_0x1f9c36)['then'](function(_0x45a98f){return _0x45a98f;});}return null;};}function removeEntity(_0x446a19,_0x4394eb){return function(_0x1c43ff){if(_0x1c43ff){return _0x1c43ff[_0x4f25('0x26')]()[_0x4f25('0x27')](function(){_0x446a19[_0x4f25('0x1b')](0xcc)[_0x4f25('0x1c')]();});}};}function handleEntityNotFound(_0x441fac,_0x4e951a){return function(_0x195042){if(!_0x195042){_0x441fac['sendStatus'](0x194);}return _0x195042;};}function handleError(_0x493133,_0x3bf1cb){_0x3bf1cb=_0x3bf1cb||0x1f4;return function(_0xac1086){logger[_0x4f25('0x28')](_0xac1086['stack']);if(_0xac1086[_0x4f25('0x29')]){delete _0xac1086[_0x4f25('0x29')];}_0x493133[_0x4f25('0x1b')](_0x3bf1cb)['send'](_0xac1086);};}exports[_0x4f25('0x2a')]=function(_0x4f3037,_0x4b5c81){var _0x189414={},_0x447694={},_0x29107d={'count':0x0,'rows':[]};var _0x2e6dca=_[_0x4f25('0x2b')](db['SalesforceField'][_0x4f25('0x2c')],function(_0x448198){return{'name':_0x448198[_0x4f25('0x2d')],'type':_0x448198[_0x4f25('0x2e')][_0x4f25('0x2f')]};});_0x447694['model']=_[_0x4f25('0x2b')](_0x2e6dca,_0x4f25('0x29'));_0x447694[_0x4f25('0x30')]=_['keys'](_0x4f3037[_0x4f25('0x30')]);_0x447694['filters']=_[_0x4f25('0x31')](_0x447694['model'],_0x447694[_0x4f25('0x30')]);_0x189414['attributes']=_['intersection'](_0x447694[_0x4f25('0x32')],qs['fields'](_0x4f3037[_0x4f25('0x30')][_0x4f25('0x33')]));_0x189414['attributes']=_0x189414[_0x4f25('0x34')][_0x4f25('0x35')]?_0x189414['attributes']:_0x447694['model'];if(!_0x4f3037['query'][_0x4f25('0x36')](_0x4f25('0x37'))){_0x189414['limit']=qs[_0x4f25('0x20')](_0x4f3037['query']['limit']);_0x189414[_0x4f25('0x1e')]=qs[_0x4f25('0x1e')](_0x4f3037['query']['offset']);}_0x189414[_0x4f25('0x38')]=qs[_0x4f25('0x39')](_0x4f3037['query']['sort']);_0x189414[_0x4f25('0x3a')]=qs[_0x4f25('0x3b')](_[_0x4f25('0x3c')](_0x4f3037[_0x4f25('0x30')],_0x447694[_0x4f25('0x3b')]),_0x2e6dca);if(_0x4f3037['query']['filter']){_0x189414[_0x4f25('0x3a')]=_['merge'](_0x189414[_0x4f25('0x3a')],{'$or':_[_0x4f25('0x2b')](_0x2e6dca,function(_0x522d8c){if(_0x522d8c[_0x4f25('0x2e')]!==_0x4f25('0x3d')){var _0x4cef58={};_0x4cef58[_0x522d8c[_0x4f25('0x29')]]={'$like':'%'+_0x4f3037[_0x4f25('0x30')][_0x4f25('0x3e')]+'%'};return _0x4cef58;}})});}_0x189414=_['merge']({},_0x189414,_0x4f3037[_0x4f25('0x3f')]);var _0x5149ed={'where':_0x189414[_0x4f25('0x3a')]};return db[_0x4f25('0x40')][_0x4f25('0x21')](_0x5149ed)['then'](function(_0x15f6d7){_0x29107d[_0x4f25('0x21')]=_0x15f6d7;if(_0x4f3037[_0x4f25('0x30')][_0x4f25('0x41')]){_0x189414['include']=[{'all':!![]}];}return db[_0x4f25('0x40')]['findAll'](_0x189414);})['then'](function(_0x33499a){_0x29107d['rows']=_0x33499a;return _0x29107d;})[_0x4f25('0x27')](respondWithFilteredResult(_0x4b5c81,_0x189414))[_0x4f25('0x42')](handleError(_0x4b5c81,null));};exports[_0x4f25('0x43')]=function(_0x232e28,_0x5a73e4){var _0x26abc0={'raw':!![],'where':{'id':_0x232e28['params']['id']}},_0x59d2bb={};_0x59d2bb[_0x4f25('0x32')]=_[_0x4f25('0x44')](db[_0x4f25('0x40')][_0x4f25('0x2c')]);_0x59d2bb[_0x4f25('0x30')]=_[_0x4f25('0x44')](_0x232e28[_0x4f25('0x30')]);_0x59d2bb[_0x4f25('0x3b')]=_['intersection'](_0x59d2bb[_0x4f25('0x32')],_0x59d2bb[_0x4f25('0x30')]);_0x26abc0[_0x4f25('0x34')]=_[_0x4f25('0x31')](_0x59d2bb[_0x4f25('0x32')],qs[_0x4f25('0x33')](_0x232e28[_0x4f25('0x30')][_0x4f25('0x33')]));_0x26abc0['attributes']=_0x26abc0[_0x4f25('0x34')][_0x4f25('0x35')]?_0x26abc0[_0x4f25('0x34')]:_0x59d2bb[_0x4f25('0x32')];if(_0x232e28[_0x4f25('0x30')]['includeAll']){_0x26abc0['include']=[{'all':!![]}];}_0x26abc0=_['merge']({},_0x26abc0,_0x232e28['options']);return db['SalesforceField'][_0x4f25('0x45')](_0x26abc0)[_0x4f25('0x27')](handleEntityNotFound(_0x5a73e4,null))[_0x4f25('0x27')](respondWithResult(_0x5a73e4,null))[_0x4f25('0x42')](handleError(_0x5a73e4,null));};exports['create']=function(_0x45a2e5,_0x2ff640){return db[_0x4f25('0x40')]['create'](_0x45a2e5[_0x4f25('0x46')],{})['then'](respondWithResult(_0x2ff640,0xc9))[_0x4f25('0x42')](handleError(_0x2ff640,null));};exports[_0x4f25('0x47')]=function(_0x1ce4ea,_0x486966){if(_0x1ce4ea['body']['id']){delete _0x1ce4ea[_0x4f25('0x46')]['id'];}return db[_0x4f25('0x40')][_0x4f25('0x45')]({'where':{'id':_0x1ce4ea['params']['id']}})[_0x4f25('0x27')](handleEntityNotFound(_0x486966,null))[_0x4f25('0x27')](saveUpdates(_0x1ce4ea[_0x4f25('0x46')],null))[_0x4f25('0x27')](respondWithResult(_0x486966,null))[_0x4f25('0x42')](handleError(_0x486966,null));};exports['destroy']=function(_0x1a6558,_0x3039c4){return db[_0x4f25('0x40')][_0x4f25('0x45')]({'where':{'id':_0x1a6558['params']['id']}})[_0x4f25('0x27')](handleEntityNotFound(_0x3039c4,null))[_0x4f25('0x27')](removeEntity(_0x3039c4,null))[_0x4f25('0x42')](handleError(_0x3039c4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 496c1ab..d3a7f30 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 _0xd21d=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','FieldId','../../config/logger','moment'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0xd21d,0xdb));var _0xdd21=function(_0x4f3522,_0x3e9fb){_0x4f3522=_0x4f3522-0x0;var _0x5b4de7=_0xd21d[_0x4f3522];return _0x5b4de7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd21('0x0'))('api');var moment=require(_0xdd21('0x1'));var BPromise=require(_0xdd21('0x2'));var rp=require(_0xdd21('0x3'));var fs=require('fs');var path=require(_0xdd21('0x4'));var rimraf=require(_0xdd21('0x5'));var config=require(_0xdd21('0x6'));var attributes=require(_0xdd21('0x7'));module[_0xdd21('0x8')]=function(_0x4163b8,_0x142dba){return _0x4163b8['define'](_0xdd21('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xdd21('0xa'),'fields':[_0xdd21('0xb'),_0xdd21('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c9b=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x8c9b,0x19c));var _0xb8c9=function(_0x3ab54a,_0xf327f1){_0x3ab54a=_0x3ab54a-0x0;var _0x2b8fcd=_0x8c9b[_0x3ab54a];return _0x2b8fcd;};'use strict';var _=require(_0xb8c9('0x0'));var util=require(_0xb8c9('0x1'));var logger=require(_0xb8c9('0x2'))(_0xb8c9('0x3'));var moment=require(_0xb8c9('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8c9('0x5'));var fs=require('fs');var path=require(_0xb8c9('0x6'));var rimraf=require(_0xb8c9('0x7'));var config=require(_0xb8c9('0x8'));var attributes=require(_0xb8c9('0x9'));module[_0xb8c9('0xa')]=function(_0x37f773,_0x4e3f87){return _0x37f773['define'](_0xb8c9('0xb'),attributes,{'tableName':_0xb8c9('0xc'),'paranoid':![],'indexes':[{'name':_0xb8c9('0xd'),'fields':[_0xb8c9('0xe'),_0xb8c9('0xf')],'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 9522a49..eb53125 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 _0x3ba1=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0x440ada,_0x47c1d3){var _0x31fe2b=function(_0x3d4926){while(--_0x3d4926){_0x440ada['push'](_0x440ada['shift']());}};_0x31fe2b(++_0x47c1d3);}(_0x3ba1,0x10e));var _0x13ba=function(_0x348a1c,_0x473ff2){_0x348a1c=_0x348a1c-0x0;var _0x16b380=_0x3ba1[_0x348a1c];return _0x16b380;};'use strict';var _=require('lodash');var util=require(_0x13ba('0x0'));var moment=require(_0x13ba('0x1'));var BPromise=require(_0x13ba('0x2'));var rs=require(_0x13ba('0x3'));var fs=require('fs');var Redis=require(_0x13ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13ba('0x5'));var logger=require(_0x13ba('0x6'))(_0x13ba('0x7'));var config=require('../../config/environment');var jayson=require(_0x13ba('0x8'));var client=jayson[_0x13ba('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dce92,_0x1a09dc,_0x37856e){return new BPromise(function(_0x353f43,_0x307912){return client[_0x13ba('0xa')](_0x3dce92,_0x37856e)['then'](function(_0x5b4595){logger[_0x13ba('0xb')](_0x13ba('0xc'),_0x1a09dc,_0x13ba('0xd'));logger[_0x13ba('0xe')](_0x13ba('0xf'),_0x1a09dc,'request\x20sent',JSON['stringify'](_0x5b4595));if(_0x5b4595[_0x13ba('0x10')]){if(_0x5b4595['error'][_0x13ba('0x11')]===0x1f4){logger['error'](_0x13ba('0xc'),_0x1a09dc,_0x5b4595['error']['message']);return _0x307912(_0x5b4595['error']['message']);}logger['error'](_0x13ba('0xc'),_0x1a09dc,_0x5b4595[_0x13ba('0x10')][_0x13ba('0x12')]);return _0x353f43(_0x5b4595[_0x13ba('0x10')]['message']);}else{logger[_0x13ba('0xb')](_0x13ba('0xc'),_0x1a09dc,'request\x20sent');_0x353f43(_0x5b4595[_0x13ba('0x13')][_0x13ba('0x12')]);}})[_0x13ba('0x14')](function(_0x38185c){logger[_0x13ba('0x10')](_0x13ba('0xc'),_0x1a09dc,_0x38185c);_0x307912(_0x38185c);});});} \ No newline at end of file +var _0x2f52=['../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30cdf0,_0x337a47){var _0x47629d=function(_0x2c8e05){while(--_0x2c8e05){_0x30cdf0['push'](_0x30cdf0['shift']());}};_0x47629d(++_0x337a47);}(_0x2f52,0xdd));var _0x22f5=function(_0x4f6400,_0x379b1b){_0x4f6400=_0x4f6400-0x0;var _0x4e447=_0x2f52[_0x4f6400];return _0x4e447;};'use strict';var _=require(_0x22f5('0x0'));var util=require(_0x22f5('0x1'));var moment=require(_0x22f5('0x2'));var BPromise=require(_0x22f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22f5('0x4'));var db=require(_0x22f5('0x5'))['db'];var utils=require(_0x22f5('0x6'));var logger=require(_0x22f5('0x7'))(_0x22f5('0x8'));var config=require(_0x22f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x22f5('0xa')][_0x22f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522697,_0x268b5c,_0x125503){return new BPromise(function(_0x3e8d2f,_0x2aa453){return client[_0x22f5('0xc')](_0x522697,_0x125503)[_0x22f5('0xd')](function(_0x290871){logger[_0x22f5('0xe')](_0x22f5('0xf'),_0x268b5c,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x268b5c,_0x22f5('0x10'),JSON[_0x22f5('0x11')](_0x290871));if(_0x290871[_0x22f5('0x12')]){if(_0x290871[_0x22f5('0x12')][_0x22f5('0x13')]===0x1f4){logger['error'](_0x22f5('0xf'),_0x268b5c,_0x290871[_0x22f5('0x12')][_0x22f5('0x14')]);return _0x2aa453(_0x290871['error'][_0x22f5('0x14')]);}logger[_0x22f5('0x12')]('SalesforceField,\x20%s,\x20%s',_0x268b5c,_0x290871[_0x22f5('0x12')]['message']);return _0x3e8d2f(_0x290871[_0x22f5('0x12')][_0x22f5('0x14')]);}else{logger[_0x22f5('0xe')](_0x22f5('0xf'),_0x268b5c,_0x22f5('0x10'));_0x3e8d2f(_0x290871[_0x22f5('0x15')][_0x22f5('0x14')]);}})[_0x22f5('0x16')](function(_0x69c4a0){logger['error'](_0x22f5('0xf'),_0x268b5c,_0x69c4a0);_0x2aa453(_0x69c4a0);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5d8fb97..f514dba 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 _0x3a25=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','delete','exports','multer','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3a25,0x15d));var _0x53a2=function(_0x32bc80,_0x6fa68e){_0x32bc80=_0x32bc80-0x0;var _0x5c1971=_0x3a25[_0x32bc80];return _0x5c1971;};'use strict';var multer=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var path=require(_0x53a2('0x2'));var timeout=require(_0x53a2('0x3'));var express=require(_0x53a2('0x4'));var router=express[_0x53a2('0x5')]();var fs_extra=require(_0x53a2('0x6'));var auth=require(_0x53a2('0x7'));var interaction=require(_0x53a2('0x8'));var config=require(_0x53a2('0x9'));var controller=require(_0x53a2('0xa'));router[_0x53a2('0xb')]('/',auth[_0x53a2('0xc')](),controller[_0x53a2('0xd')]);router[_0x53a2('0xb')]('/:id',auth[_0x53a2('0xc')](),controller['show']);router[_0x53a2('0xb')](_0x53a2('0xe'),auth[_0x53a2('0xc')](),controller[_0x53a2('0xf')]);router[_0x53a2('0xb')](_0x53a2('0x10'),auth[_0x53a2('0xc')](),controller[_0x53a2('0x11')]);router[_0x53a2('0x12')]('/',auth[_0x53a2('0xc')](),controller['create']);router['post'](_0x53a2('0xe'),auth[_0x53a2('0xc')](),controller['addConfiguration']);router['put']('/:id',auth[_0x53a2('0xc')](),controller[_0x53a2('0x13')]);router[_0x53a2('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x53a2('0x15')]=router; \ No newline at end of file +var _0xa581=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x16f143,_0x813860){var _0x1fff62=function(_0x39edce){while(--_0x39edce){_0x16f143['push'](_0x16f143['shift']());}};_0x1fff62(++_0x813860);}(_0xa581,0x90));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1a58('0x0'));var util=require(_0x1a58('0x1'));var path=require(_0x1a58('0x2'));var timeout=require(_0x1a58('0x3'));var express=require(_0x1a58('0x4'));var router=express[_0x1a58('0x5')]();var fs_extra=require(_0x1a58('0x6'));var auth=require(_0x1a58('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1a58('0x8'));var controller=require(_0x1a58('0x9'));router[_0x1a58('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a58('0xa')](_0x1a58('0xb'),auth[_0x1a58('0xc')](),controller[_0x1a58('0xd')]);router[_0x1a58('0xa')]('/:id/configurations',auth[_0x1a58('0xc')](),controller[_0x1a58('0xe')]);router[_0x1a58('0xa')](_0x1a58('0xf'),auth[_0x1a58('0xc')](),controller[_0x1a58('0x10')]);router[_0x1a58('0x11')]('/',auth[_0x1a58('0xc')](),controller[_0x1a58('0x12')]);router['post']('/:id/configurations',auth[_0x1a58('0xc')](),controller[_0x1a58('0x13')]);router[_0x1a58('0x14')](_0x1a58('0xb'),auth[_0x1a58('0xc')](),controller[_0x1a58('0x15')]);router[_0x1a58('0x16')](_0x1a58('0xb'),auth[_0x1a58('0xc')](),controller[_0x1a58('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 07d21c6..410fed4 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 _0xf357=['STRING','username','remoteUri','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf357,0x1c3));var _0x7f35=function(_0x173391,_0x60e99d){_0x173391=_0x173391-0x0;var _0x7eb41e=_0xf357[_0x173391];return _0x7eb41e;};'use strict';var Sequelize=require(_0x7f35('0x0'));module['exports']={'name':{'type':Sequelize[_0x7f35('0x1')]},'description':{'type':Sequelize[_0x7f35('0x1')]},'username':{'type':Sequelize[_0x7f35('0x1')],'unique':_0x7f35('0x2')},'password':{'type':Sequelize[_0x7f35('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7f35('0x1')],'unique':_0x7f35('0x3')},'serverUrl':{'type':Sequelize[_0x7f35('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0c56=['exports','username','STRING','remoteUri','sequelize'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x0c56,0x1c6));var _0x60c5=function(_0x5c35a5,_0x355b5b){_0x5c35a5=_0x5c35a5-0x0;var _0x4fec6f=_0x0c56[_0x5c35a5];return _0x4fec6f;};'use strict';var Sequelize=require(_0x60c5('0x0'));module[_0x60c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x60c5('0x2')},'password':{'type':Sequelize[_0x60c5('0x3')]},'email':{'type':Sequelize[_0x60c5('0x3')]},'remoteUri':{'type':Sequelize[_0x60c5('0x3')],'unique':_0x60c5('0x4')},'serverUrl':{'type':Sequelize[_0x60c5('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 809aaf4..512302d 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 _0xa5aa=['offset','status','Content-Range','apply','update','then','destroy','error','stack','name','index','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','ServicenowConfiguration','rawAttributes','sort','length','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','findOne','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','send','test','boolean','true','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','false','value','push','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','limit','undefined','count'];(function(_0x581460,_0x56f97b){var _0x528dd4=function(_0x26adc4){while(--_0x26adc4){_0x581460['push'](_0x581460['shift']());}};_0x528dd4(++_0x56f97b);}(_0xa5aa,0x9c));var _0xaa5a=function(_0x52387d,_0x34896f){_0x52387d=_0x52387d-0x0;var _0x3fb650=_0xa5aa[_0x52387d];return _0x3fb650;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa5a('0x1'));var rp=require('request-promise');var moment=require(_0xaa5a('0x2'));var BPromise=require(_0xaa5a('0x3'));var Mustache=require('mustache');var util=require(_0xaa5a('0x4'));var path=require(_0xaa5a('0x5'));var sox=require(_0xaa5a('0x6'));var csv=require(_0xaa5a('0x7'));var ejs=require(_0xaa5a('0x8'));var fs=require('fs');var fs_extra=require(_0xaa5a('0x9'));var _=require(_0xaa5a('0xa'));var squel=require(_0xaa5a('0xb'));var crypto=require(_0xaa5a('0xc'));var jsforce=require(_0xaa5a('0xd'));var deskjs=require(_0xaa5a('0xe'));var toCsv=require(_0xaa5a('0x7'));var querystring=require(_0xaa5a('0xf'));var Papa=require(_0xaa5a('0x10'));var Redis=require(_0xaa5a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaa5a('0x12'));var as=require(_0xaa5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa5a('0x14'))('api');var utils=require(_0xaa5a('0x15'));var config=require(_0xaa5a('0x16'));var licenseUtil=require(_0xaa5a('0x17'));var db=require(_0xaa5a('0x18'))['db'];var integrations=require(_0xaa5a('0x19'));function respondWithStatusCode(_0x7af581,_0x20a5ee){_0x20a5ee=_0x20a5ee||0xcc;return function(_0x58c5e6){if(_0x58c5e6){return _0x7af581[_0xaa5a('0x1a')](_0x20a5ee);}return _0x7af581['status'](_0x20a5ee)[_0xaa5a('0x1b')]();};}function respondWithResult(_0xe88749,_0x2b4add){_0x2b4add=_0x2b4add||0xc8;return function(_0x54c755){if(_0x54c755){return _0xe88749['status'](_0x2b4add)[_0xaa5a('0x1c')](_0x54c755);}};}function respondWithFilteredResult(_0x383baf,_0x279419){return function(_0x189e0b){if(_0x189e0b){var _0x537919=typeof _0x279419['offset']==='undefined'&&typeof _0x279419[_0xaa5a('0x1d')]===_0xaa5a('0x1e');var _0xf46663=_0x189e0b[_0xaa5a('0x1f')];var _0x4313f6=_0x537919?0x0:_0x279419[_0xaa5a('0x20')];var _0x5459bf=_0x537919?_0x189e0b[_0xaa5a('0x1f')]:_0x279419[_0xaa5a('0x20')]+_0x279419[_0xaa5a('0x1d')];var _0x32bc06;if(_0x5459bf>=_0xf46663){_0x5459bf=_0xf46663;_0x32bc06=0xc8;}else{_0x32bc06=0xce;}_0x383baf[_0xaa5a('0x21')](_0x32bc06);return _0x383baf['set'](_0xaa5a('0x22'),_0x4313f6+'-'+_0x5459bf+'/'+_0xf46663)[_0xaa5a('0x1c')](_0x189e0b);}return null;};}function patchUpdates(_0x52d259){return function(_0xc8514){try{jsonpatch[_0xaa5a('0x23')](_0xc8514,_0x52d259,!![]);}catch(_0x3b0f1f){return BPromise['reject'](_0x3b0f1f);}return _0xc8514['save']();};}function saveUpdates(_0x1705f4,_0x10f4c3){return function(_0x46a6fd){if(_0x46a6fd){return _0x46a6fd[_0xaa5a('0x24')](_0x1705f4)[_0xaa5a('0x25')](function(_0x3d8152){return _0x3d8152;});}return null;};}function removeEntity(_0x5da71e,_0x425f48){return function(_0x38df5b){if(_0x38df5b){return _0x38df5b[_0xaa5a('0x26')]()['then'](function(){_0x5da71e[_0xaa5a('0x21')](0xcc)[_0xaa5a('0x1b')]();});}};}function handleEntityNotFound(_0x6b9b28,_0x1b4f9a){return function(_0x1740d3){if(!_0x1740d3){_0x6b9b28[_0xaa5a('0x1a')](0x194);}return _0x1740d3;};}function handleError(_0x4a8bdb,_0x1e487b){_0x1e487b=_0x1e487b||0x1f4;return function(_0x586f95){logger[_0xaa5a('0x27')](_0x586f95[_0xaa5a('0x28')]);if(_0x586f95[_0xaa5a('0x29')]){delete _0x586f95[_0xaa5a('0x29')];}_0x4a8bdb['status'](_0x1e487b)['send'](_0x586f95);};}exports[_0xaa5a('0x2a')]=function(_0xf7a406,_0x1dac35){var _0x3fd80c={},_0x24cff1={},_0x7ca451={'count':0x0,'rows':[]};var _0x17f5d6=_[_0xaa5a('0x2b')](db['ServicenowAccount']['rawAttributes'],function(_0x55d45f){return{'name':_0x55d45f['fieldName'],'type':_0x55d45f['type']['key']};});_0x24cff1['model']=_[_0xaa5a('0x2b')](_0x17f5d6,_0xaa5a('0x29'));_0x24cff1[_0xaa5a('0x2c')]=_[_0xaa5a('0x2d')](_0xf7a406['query']);_0x24cff1[_0xaa5a('0x2e')]=_[_0xaa5a('0x2f')](_0x24cff1[_0xaa5a('0x30')],_0x24cff1[_0xaa5a('0x2c')]);_0x3fd80c['attributes']=_[_0xaa5a('0x2f')](_0x24cff1[_0xaa5a('0x30')],qs[_0xaa5a('0x31')](_0xf7a406[_0xaa5a('0x2c')]['fields']));_0x3fd80c['attributes']=_0x3fd80c[_0xaa5a('0x32')]['length']?_0x3fd80c[_0xaa5a('0x32')]:_0x24cff1[_0xaa5a('0x30')];if(!_0xf7a406['query'][_0xaa5a('0x33')](_0xaa5a('0x34'))){_0x3fd80c['limit']=qs[_0xaa5a('0x1d')](_0xf7a406[_0xaa5a('0x2c')][_0xaa5a('0x1d')]);_0x3fd80c['offset']=qs[_0xaa5a('0x20')](_0xf7a406[_0xaa5a('0x2c')][_0xaa5a('0x20')]);}_0x3fd80c[_0xaa5a('0x35')]=qs['sort'](_0xf7a406['query']['sort']);_0x3fd80c[_0xaa5a('0x36')]=qs[_0xaa5a('0x2e')](_[_0xaa5a('0x37')](_0xf7a406['query'],_0x24cff1[_0xaa5a('0x2e')]),_0x17f5d6);if(_0xf7a406['query'][_0xaa5a('0x38')]){_0x3fd80c['where']=_['merge'](_0x3fd80c[_0xaa5a('0x36')],{'$or':_[_0xaa5a('0x2b')](_0x17f5d6,function(_0x691ea6){if(_0x691ea6[_0xaa5a('0x39')]!==_0xaa5a('0x3a')){var _0x4d076c={};_0x4d076c[_0x691ea6[_0xaa5a('0x29')]]={'$like':'%'+_0xf7a406[_0xaa5a('0x2c')][_0xaa5a('0x38')]+'%'};return _0x4d076c;}})});}_0x3fd80c=_[_0xaa5a('0x3b')]({},_0x3fd80c,_0xf7a406[_0xaa5a('0x3c')]);var _0x2c40e0={'where':_0x3fd80c[_0xaa5a('0x36')]};return db[_0xaa5a('0x3d')][_0xaa5a('0x1f')](_0x2c40e0)['then'](function(_0x5632a3){_0x7ca451[_0xaa5a('0x1f')]=_0x5632a3;if(_0xf7a406['query'][_0xaa5a('0x3e')]){_0x3fd80c[_0xaa5a('0x3f')]=[{'all':!![]}];}return db[_0xaa5a('0x3d')][_0xaa5a('0x40')](_0x3fd80c);})[_0xaa5a('0x25')](function(_0x457d34){_0x7ca451[_0xaa5a('0x41')]=_0x457d34;return _0x7ca451;})[_0xaa5a('0x25')](respondWithFilteredResult(_0x1dac35,_0x3fd80c))[_0xaa5a('0x42')](handleError(_0x1dac35,null));};exports[_0xaa5a('0x43')]=function(_0x2c97ee,_0xcbbf45){var _0x256506={'raw':![],'where':{'id':_0x2c97ee[_0xaa5a('0x44')]['id']}},_0x377df9={};_0x377df9[_0xaa5a('0x30')]=_[_0xaa5a('0x2d')](db[_0xaa5a('0x3d')]['rawAttributes']);_0x377df9['query']=_[_0xaa5a('0x2d')](_0x2c97ee[_0xaa5a('0x2c')]);_0x377df9[_0xaa5a('0x2e')]=_[_0xaa5a('0x2f')](_0x377df9[_0xaa5a('0x30')],_0x377df9[_0xaa5a('0x2c')]);_0x256506[_0xaa5a('0x32')]=_[_0xaa5a('0x2f')](_0x377df9['model'],qs[_0xaa5a('0x31')](_0x2c97ee[_0xaa5a('0x2c')][_0xaa5a('0x31')]));_0x256506[_0xaa5a('0x32')]=_0x256506[_0xaa5a('0x32')]['length']?_0x256506[_0xaa5a('0x32')]:_0x377df9['model'];if(_0x2c97ee['query']['includeAll']){_0x256506[_0xaa5a('0x3f')]=[{'all':!![]}];}_0x256506=_[_0xaa5a('0x3b')]({},_0x256506,_0x2c97ee[_0xaa5a('0x3c')]);return db[_0xaa5a('0x3d')][_0xaa5a('0x45')](_0x256506)['then'](handleEntityNotFound(_0xcbbf45,null))[_0xaa5a('0x25')](respondWithResult(_0xcbbf45,null))['catch'](handleError(_0xcbbf45,null));};exports[_0xaa5a('0x46')]=function(_0x2748a3,_0x24ebf3){return db[_0xaa5a('0x3d')][_0xaa5a('0x46')](_0x2748a3[_0xaa5a('0x47')],{})['then'](respondWithResult(_0x24ebf3,0xc9))['catch'](handleError(_0x24ebf3,null));};exports['update']=function(_0x185ec4,_0x1d0436){if(_0x185ec4[_0xaa5a('0x47')]['id']){delete _0x185ec4['body']['id'];}return db[_0xaa5a('0x3d')][_0xaa5a('0x45')]({'where':{'id':_0x185ec4['params']['id']}})[_0xaa5a('0x25')](handleEntityNotFound(_0x1d0436,null))[_0xaa5a('0x25')](saveUpdates(_0x185ec4['body'],null))['then'](respondWithResult(_0x1d0436,null))['catch'](handleError(_0x1d0436,null));};exports[_0xaa5a('0x26')]=function(_0x3caab3,_0x1056e2){return db['ServicenowAccount']['find']({'where':{'id':_0x3caab3[_0xaa5a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1056e2,null))[_0xaa5a('0x25')](removeEntity(_0x1056e2,null))[_0xaa5a('0x42')](handleError(_0x1056e2,null));};exports['getConfigurations']=function(_0x4cdd5a,_0x1ba958,_0x4a6753){var _0x961e45={};var _0x550c80={};var _0x42fe20;var _0x58e021;return db[_0xaa5a('0x3d')]['findOne']({'where':{'id':_0x4cdd5a[_0xaa5a('0x44')]['id']}})[_0xaa5a('0x25')](handleEntityNotFound(_0x1ba958,null))[_0xaa5a('0x25')](function(_0x388701){if(_0x388701){_0x42fe20=_0x388701;_0x550c80['model']=_[_0xaa5a('0x2d')](db[_0xaa5a('0x48')][_0xaa5a('0x49')]);_0x550c80['query']=_[_0xaa5a('0x2d')](_0x4cdd5a[_0xaa5a('0x2c')]);_0x550c80[_0xaa5a('0x2e')]=_[_0xaa5a('0x2f')](_0x550c80['model'],_0x550c80[_0xaa5a('0x2c')]);_0x961e45[_0xaa5a('0x32')]=_[_0xaa5a('0x2f')](_0x550c80['model'],qs[_0xaa5a('0x31')](_0x4cdd5a[_0xaa5a('0x2c')]['fields']));_0x961e45[_0xaa5a('0x32')]=_0x961e45[_0xaa5a('0x32')]['length']?_0x961e45['attributes']:_0x550c80[_0xaa5a('0x30')];_0x961e45[_0xaa5a('0x35')]=qs[_0xaa5a('0x4a')](_0x4cdd5a['query']['sort']);_0x961e45[_0xaa5a('0x36')]=qs[_0xaa5a('0x2e')](_['pick'](_0x4cdd5a[_0xaa5a('0x2c')],_0x550c80[_0xaa5a('0x2e')]));if(_0x4cdd5a['query'][_0xaa5a('0x38')]){_0x961e45[_0xaa5a('0x36')]=_[_0xaa5a('0x3b')](_0x961e45[_0xaa5a('0x36')],{'$or':_['map'](_0x961e45[_0xaa5a('0x32')],function(_0x12d525){var _0x52b0f4={};_0x52b0f4[_0x12d525]={'$like':'%'+_0x4cdd5a['query']['filter']+'%'};return _0x52b0f4;})});}_0x961e45=_[_0xaa5a('0x3b')]({},_0x961e45,_0x4cdd5a['options']);return _0x42fe20['getConfigurations'](_0x961e45);}})[_0xaa5a('0x25')](function(_0x244c30){if(_0x244c30){_0x58e021=_0x244c30[_0xaa5a('0x4b')];if(!_0x4cdd5a[_0xaa5a('0x2c')][_0xaa5a('0x33')](_0xaa5a('0x34'))){_0x961e45[_0xaa5a('0x1d')]=qs[_0xaa5a('0x1d')](_0x4cdd5a[_0xaa5a('0x2c')]['limit']);_0x961e45[_0xaa5a('0x20')]=qs[_0xaa5a('0x20')](_0x4cdd5a[_0xaa5a('0x2c')][_0xaa5a('0x20')]);}return _0x42fe20[_0xaa5a('0x4c')](_0x961e45);}})[_0xaa5a('0x25')](function(_0x491f3f){if(_0x491f3f){return _0x491f3f?{'count':_0x58e021,'rows':_0x491f3f}:null;}})[_0xaa5a('0x25')](respondWithResult(_0x1ba958,null))[_0xaa5a('0x42')](handleError(_0x1ba958,null));};exports[_0xaa5a('0x4d')]=function(_0x46ea2a,_0x2ef04f,_0x59a0ab){if(_0x46ea2a[_0xaa5a('0x47')]['id']){delete _0x46ea2a[_0xaa5a('0x47')]['id'];}return db[_0xaa5a('0x3d')]['findOne']({'where':{'id':_0x46ea2a[_0xaa5a('0x44')]['id']}})[_0xaa5a('0x25')](handleEntityNotFound(_0x2ef04f,null))[_0xaa5a('0x25')](function(_0x4473cd){if(_0x4473cd){_0x46ea2a[_0xaa5a('0x47')][_0xaa5a('0x4e')]=_0x4473cd['id'];_0x46ea2a[_0xaa5a('0x47')][_0xaa5a('0x4f')]=integrations[_0xaa5a('0x50')](_0x46ea2a[_0xaa5a('0x47')][_0xaa5a('0x51')],_0x46ea2a[_0xaa5a('0x47')][_0xaa5a('0x39')]);_0x46ea2a[_0xaa5a('0x47')][_0xaa5a('0x52')]=integrations[_0xaa5a('0x53')](_0x46ea2a['body'][_0xaa5a('0x51')],_0x46ea2a['body'][_0xaa5a('0x39')]);return db[_0xaa5a('0x48')][_0xaa5a('0x46')](_0x46ea2a[_0xaa5a('0x47')],{'include':[{'model':db[_0xaa5a('0x54')],'as':_0xaa5a('0x4f')},{'model':db[_0xaa5a('0x54')],'as':'Descriptions'}]});}return null;})[_0xaa5a('0x25')](respondWithResult(_0x2ef04f,null))[_0xaa5a('0x42')](handleError(_0x2ef04f,null));};exports[_0xaa5a('0x55')]=function(_0x34093c,_0x3f60af,_0x2366fe){var _0xc66383=[_0xaa5a('0x56'),_0xaa5a('0x57'),_0xaa5a('0x58'),'subcategory',_0xaa5a('0x59'),_0xaa5a('0x5a'),_0xaa5a('0x5b'),'severity',_0xaa5a('0x5c')];var _0x49e698=[_0xaa5a('0x5d'),_0xaa5a('0x56'),_0xaa5a('0x5e'),_0xaa5a('0x5f'),_0xaa5a('0x60'),'sys_updated_on',_0xaa5a('0x61'),_0xaa5a('0x57'),_0xaa5a('0x62'),_0xaa5a('0x63'),_0xaa5a('0x64'),_0xaa5a('0x65'),'opened_by',_0xaa5a('0x66'),_0xaa5a('0x67'),'sys_domain',_0xaa5a('0x68'),_0xaa5a('0x69'),'knowledge',_0xaa5a('0x35'),_0xaa5a('0x6a'),'closed_at',_0xaa5a('0x6b'),_0xaa5a('0x6c'),_0xaa5a('0x6d'),_0xaa5a('0x6e'),_0xaa5a('0x6f'),_0xaa5a('0x70'),_0xaa5a('0x71'),_0xaa5a('0x72'),_0xaa5a('0x73'),_0xaa5a('0x74'),'expected_start',_0xaa5a('0x75'),_0xaa5a('0x76'),_0xaa5a('0x77'),_0xaa5a('0x78'),_0xaa5a('0x79'),_0xaa5a('0x7a'),_0xaa5a('0x7b'),_0xaa5a('0x7c'),_0xaa5a('0x7d'),'work_notes','short_description',_0xaa5a('0x59'),_0xaa5a('0x7e'),_0xaa5a('0x7f'),_0xaa5a('0x80'),'assignment_group',_0xaa5a('0x81'),_0xaa5a('0x82'),'description',_0xaa5a('0x83'),_0xaa5a('0x5a'),_0xaa5a('0x84'),_0xaa5a('0x85'),'closed_by',_0xaa5a('0x86'),_0xaa5a('0x87'),_0xaa5a('0x88'),_0xaa5a('0x89'),_0xaa5a('0x8a'),_0xaa5a('0x5b'),_0xaa5a('0x8b'),_0xaa5a('0x8c'),_0xaa5a('0x8d'),_0xaa5a('0x8e'),'activity_due',_0xaa5a('0x8f'),_0xaa5a('0x90'),_0xaa5a('0x91'),'sla_due',_0xaa5a('0x92'),_0xaa5a('0x93'),_0xaa5a('0x94'),_0xaa5a('0x95'),_0xaa5a('0x96'),'sys_tags',_0xaa5a('0x97'),_0xaa5a('0x98'),'correlation_id',_0xaa5a('0x99'),_0xaa5a('0x5c')];var _0x5ef569='';var _0x5e308e='';var _0x42171a=[];var _0x2fe7c2='';var _0x5c42da='';var _0x581b55=[];var _0x3eb8ab='';var _0x16637b='';var _0x23da25={};var _0x5642ca='';return db['ServicenowAccount'][_0xaa5a('0x9a')]({'where':{'id':_0x34093c['params']['id']},'attributes':['id','username',_0xaa5a('0x9b'),'email',_0xaa5a('0x9c'),'serverUrl']})[_0xaa5a('0x25')](handleEntityNotFound(_0x3f60af,null))['then'](function(_0x182845){if(_0x182845){_0x5642ca=_0x182845['remoteUri'];var _0x32b3e6=_0x5642ca[_0xaa5a('0x9d')](-0x1);if(_0x32b3e6==='/'){_0x5642ca=_0x5642ca[_0xaa5a('0x9e')](0x0,_0x5642ca[_0xaa5a('0x9f')](_0x32b3e6));}_0x16637b=util[_0xaa5a('0xa0')]('%s/api/now/doc/table/schema/',_0x5642ca);_0x3eb8ab=util[_0xaa5a('0xa0')](_0xaa5a('0xa1'),_0x5642ca);_0x23da25={'user':_0x182845[_0xaa5a('0xa2')],'pass':_0x182845[_0xaa5a('0x9b')]};var _0x38bcdf={'method':_0xaa5a('0xa3'),'uri':_0x16637b+_0xaa5a('0xa4'),'auth':_0x23da25,'json':!![]};return rp(_0x38bcdf);}})['then'](function(_0x3132e0){if(_0x3132e0['result'][_0xaa5a('0x4b')]>0x0){_0x5ef569=_0x3132e0[_0xaa5a('0xa5')];}console[_0xaa5a('0xa6')](_0xaa5a('0xa7'),_0x5ef569);_0x581b55=[];_0x5e308e=Object[_0xaa5a('0xa8')]([],_0x5ef569);_[_0xaa5a('0xa9')](_0x5e308e,function(_0x57afdd){return!_0xc66383[_0xaa5a('0xaa')](_0x57afdd[_0xaa5a('0x29')]);});_0x5e308e['forEach'](function(_0x68f53c){var _0x19790f=createFieldObject(_0x3eb8ab,_0x23da25,_0x68f53c[_0xaa5a('0xab')],_0x68f53c[_0xaa5a('0x29')],_0x68f53c[_0xaa5a('0xac')],![]);_0x581b55['push'](_0x19790f);});return Promise[_0xaa5a('0xad')](_0x581b55);})[_0xaa5a('0x25')](function(_0x58dd12){_0x42171a=_0x58dd12;_0x2fe7c2=Object[_0xaa5a('0xa8')]([],_0x5ef569);console[_0xaa5a('0xa6')](_0xaa5a('0xae'),_0x5ef569);_[_0xaa5a('0xa9')](_0x2fe7c2,function(_0x209c93){return _0x49e698[_0xaa5a('0xaa')](_0x209c93[_0xaa5a('0x29')]);});console[_0xaa5a('0xa6')](_0xaa5a('0xaf'),_0x2fe7c2);_0x581b55=[];_0x2fe7c2['forEach'](function(_0x25625b){var _0x35befc=createFieldObject(_0x3eb8ab,_0x23da25,_0x25625b[_0xaa5a('0xab')],_0x25625b[_0xaa5a('0x29')],_0x25625b[_0xaa5a('0xac')],!![]);_0x581b55['push'](_0x35befc);});return Promise[_0xaa5a('0xad')](_0x581b55);})[_0xaa5a('0x25')](function(_0x5cc0c9){_0x5c42da=_0x5cc0c9;var _0x2dfe54=_0x42171a['concat'](_0x5c42da);return{'count':_0x2dfe54['length'],'rows':_0x2dfe54};})[_0xaa5a('0x25')](respondWithResult(_0x3f60af,null))['catch'](function(_0x1120b2){console['log'](_0xaa5a('0xb0')+_0x1120b2);var _0x584e6d=_0x34093c['query']['test']?0x1f4:_0x1120b2[_0xaa5a('0xb1')]||0x1f4;logger[_0xaa5a('0x27')](_0x1120b2[_0xaa5a('0x28')]);delete _0x1120b2[_0xaa5a('0x29')];if(_0x584e6d===0x191){_0x584e6d=0x190;}_0x3f60af[_0xaa5a('0x21')](_0x584e6d)[_0xaa5a('0xb2')](_0x34093c[_0xaa5a('0x2c')][_0xaa5a('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0x1120b2[_0xaa5a('0xb1')]}:_0x1120b2);});};function createFieldObject(_0x10e279,_0x2fba32,_0x42b1be,_0x1cf046,_0x1b0c2f,_0x4bc19f){return new Promise(function(_0x3939a1,_0x1d0564){var _0x1d1a10={'id':_0x1cf046,'name':_0x1b0c2f,'custom':_0x4bc19f};if(_0x42b1be===_0xaa5a('0xb4')){_0x1d1a10['options']=[{'name':'True','value':_0xaa5a('0xb5')},{'name':'False','value':'false'}];_0x3939a1(_0x1d1a10);}else{var _0x638a34={'method':'GET','uri':_0x10e279+_0xaa5a('0xb6')+_0x1cf046,'auth':_0x2fba32,'json':!![]};return rp(_0x638a34)[_0xaa5a('0x25')](function(_0x12d8e6){var _0x5025a3=[];if(_0x12d8e6[_0xaa5a('0xa5')][_0xaa5a('0x4b')]>0x0){_0x12d8e6['result'][_0xaa5a('0xb7')](function(_0x456f6d){if(_0x456f6d[_0xaa5a('0xb8')]===_0xaa5a('0xb9')){var _0x1edf9d={'name':_0x456f6d[_0xaa5a('0xac')],'value':_0x456f6d[_0xaa5a('0xba')]};_0x5025a3[_0xaa5a('0xbb')](_0x1edf9d);}});}_0x1d1a10[_0xaa5a('0x3c')]=_0x5025a3;if(_0x1d1a10['options']['length']>0x0){_0x3939a1(_0x1d1a10);}else{if(_0x4bc19f==![]){_0x3939a1();}else{_0x3939a1(_0x1d1a10);}}});}});} \ No newline at end of file +var _0x198f=['fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','update','body','destroy','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','Subjects','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','user_input','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','work_notes','short_description','close_code','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','sys_id','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','sys_mod_count','sys_tags','escalation','correlation_id','username','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','test','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes'];(function(_0x1f9d9f,_0x4971f2){var _0x38ee09=function(_0x3a6344){while(--_0x3a6344){_0x1f9d9f['push'](_0x1f9d9f['shift']());}};_0x38ee09(++_0x4971f2);}(_0x198f,0x7e));var _0xf198=function(_0x4ac4d4,_0x5d7418){_0x4ac4d4=_0x4ac4d4-0x0;var _0x272afb=_0x198f[_0x4ac4d4];return _0x272afb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf198('0x0'));var zipdir=require(_0xf198('0x1'));var jsonpatch=require(_0xf198('0x2'));var rp=require(_0xf198('0x3'));var moment=require(_0xf198('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf198('0x5'));var util=require(_0xf198('0x6'));var path=require(_0xf198('0x7'));var sox=require(_0xf198('0x8'));var csv=require(_0xf198('0x9'));var ejs=require(_0xf198('0xa'));var fs=require('fs');var fs_extra=require(_0xf198('0xb'));var _=require(_0xf198('0xc'));var squel=require(_0xf198('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf198('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf198('0xf'));var Papa=require(_0xf198('0x10'));var Redis=require(_0xf198('0x11'));var authService=require(_0xf198('0x12'));var qs=require(_0xf198('0x13'));var as=require(_0xf198('0x14'));var hardwareService=require(_0xf198('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf198('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf198('0x17'));var db=require(_0xf198('0x18'))['db'];var integrations=require(_0xf198('0x19'));function respondWithStatusCode(_0x3af657,_0x5077c6){_0x5077c6=_0x5077c6||0xcc;return function(_0x5be9fb){if(_0x5be9fb){return _0x3af657[_0xf198('0x1a')](_0x5077c6);}return _0x3af657['status'](_0x5077c6)[_0xf198('0x1b')]();};}function respondWithResult(_0x522089,_0x112040){_0x112040=_0x112040||0xc8;return function(_0x3ea389){if(_0x3ea389){return _0x522089[_0xf198('0x1c')](_0x112040)[_0xf198('0x1d')](_0x3ea389);}};}function respondWithFilteredResult(_0x35a3a2,_0x282aba){return function(_0x3b4c80){if(_0x3b4c80){var _0x24817b=typeof _0x282aba[_0xf198('0x1e')]==='undefined'&&typeof _0x282aba['limit']===_0xf198('0x1f');var _0x57c51d=_0x3b4c80[_0xf198('0x20')];var _0x63f93d=_0x24817b?0x0:_0x282aba[_0xf198('0x1e')];var _0x22608e=_0x24817b?_0x3b4c80['count']:_0x282aba[_0xf198('0x1e')]+_0x282aba['limit'];var _0x8d5c9c;if(_0x22608e>=_0x57c51d){_0x22608e=_0x57c51d;_0x8d5c9c=0xc8;}else{_0x8d5c9c=0xce;}_0x35a3a2[_0xf198('0x1c')](_0x8d5c9c);return _0x35a3a2[_0xf198('0x21')](_0xf198('0x22'),_0x63f93d+'-'+_0x22608e+'/'+_0x57c51d)['json'](_0x3b4c80);}return null;};}function patchUpdates(_0x3ba0a4){return function(_0x1a1da0){try{jsonpatch['apply'](_0x1a1da0,_0x3ba0a4,!![]);}catch(_0x2cdedd){return BPromise[_0xf198('0x23')](_0x2cdedd);}return _0x1a1da0[_0xf198('0x24')]();};}function saveUpdates(_0x2bc2cd,_0x5c000f){return function(_0xafde36){if(_0xafde36){return _0xafde36['update'](_0x2bc2cd)[_0xf198('0x25')](function(_0x1b1c82){return _0x1b1c82;});}return null;};}function removeEntity(_0x515a03,_0x19a3fe){return function(_0x9a0e77){if(_0x9a0e77){return _0x9a0e77['destroy']()[_0xf198('0x25')](function(){_0x515a03[_0xf198('0x1c')](0xcc)[_0xf198('0x1b')]();});}};}function handleEntityNotFound(_0x40d300,_0x54df6b){return function(_0x230001){if(!_0x230001){_0x40d300['sendStatus'](0x194);}return _0x230001;};}function handleError(_0x3ed7f1,_0x9171b6){_0x9171b6=_0x9171b6||0x1f4;return function(_0x4d39ba){logger['error'](_0x4d39ba[_0xf198('0x26')]);if(_0x4d39ba['name']){delete _0x4d39ba['name'];}_0x3ed7f1[_0xf198('0x1c')](_0x9171b6)[_0xf198('0x27')](_0x4d39ba);};}exports[_0xf198('0x28')]=function(_0x425a34,_0x42c9eb){var _0x2ae669={},_0x53f952={},_0x5ce0c0={'count':0x0,'rows':[]};var _0x28a5b5=_[_0xf198('0x29')](db[_0xf198('0x2a')][_0xf198('0x2b')],function(_0x5c249f){return{'name':_0x5c249f[_0xf198('0x2c')],'type':_0x5c249f[_0xf198('0x2d')][_0xf198('0x2e')]};});_0x53f952[_0xf198('0x2f')]=_[_0xf198('0x29')](_0x28a5b5,_0xf198('0x30'));_0x53f952['query']=_[_0xf198('0x31')](_0x425a34['query']);_0x53f952[_0xf198('0x32')]=_[_0xf198('0x33')](_0x53f952[_0xf198('0x2f')],_0x53f952[_0xf198('0x34')]);_0x2ae669[_0xf198('0x35')]=_['intersection'](_0x53f952[_0xf198('0x2f')],qs[_0xf198('0x36')](_0x425a34['query']['fields']));_0x2ae669[_0xf198('0x35')]=_0x2ae669[_0xf198('0x35')][_0xf198('0x37')]?_0x2ae669[_0xf198('0x35')]:_0x53f952[_0xf198('0x2f')];if(!_0x425a34[_0xf198('0x34')]['hasOwnProperty'](_0xf198('0x38'))){_0x2ae669[_0xf198('0x39')]=qs[_0xf198('0x39')](_0x425a34[_0xf198('0x34')][_0xf198('0x39')]);_0x2ae669['offset']=qs[_0xf198('0x1e')](_0x425a34[_0xf198('0x34')][_0xf198('0x1e')]);}_0x2ae669[_0xf198('0x3a')]=qs['sort'](_0x425a34[_0xf198('0x34')][_0xf198('0x3b')]);_0x2ae669[_0xf198('0x3c')]=qs['filters'](_[_0xf198('0x3d')](_0x425a34['query'],_0x53f952['filters']),_0x28a5b5);if(_0x425a34[_0xf198('0x34')][_0xf198('0x3e')]){_0x2ae669['where']=_[_0xf198('0x3f')](_0x2ae669[_0xf198('0x3c')],{'$or':_[_0xf198('0x29')](_0x28a5b5,function(_0x2eb492){if(_0x2eb492['type']!==_0xf198('0x40')){var _0xb69990={};_0xb69990[_0x2eb492[_0xf198('0x30')]]={'$like':'%'+_0x425a34[_0xf198('0x34')]['filter']+'%'};return _0xb69990;}})});}_0x2ae669=_[_0xf198('0x3f')]({},_0x2ae669,_0x425a34[_0xf198('0x41')]);var _0x3ba002={'where':_0x2ae669[_0xf198('0x3c')]};return db['ServicenowAccount'][_0xf198('0x20')](_0x3ba002)[_0xf198('0x25')](function(_0x49c99f){_0x5ce0c0[_0xf198('0x20')]=_0x49c99f;if(_0x425a34['query'][_0xf198('0x42')]){_0x2ae669['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xf198('0x43')](_0x2ae669);})['then'](function(_0x1b0dd4){_0x5ce0c0['rows']=_0x1b0dd4;return _0x5ce0c0;})[_0xf198('0x25')](respondWithFilteredResult(_0x42c9eb,_0x2ae669))[_0xf198('0x44')](handleError(_0x42c9eb,null));};exports[_0xf198('0x45')]=function(_0x1df7b6,_0x27d063){var _0x48f7f5={'raw':![],'where':{'id':_0x1df7b6[_0xf198('0x46')]['id']}},_0x152d3f={};_0x152d3f[_0xf198('0x2f')]=_[_0xf198('0x31')](db[_0xf198('0x2a')]['rawAttributes']);_0x152d3f[_0xf198('0x34')]=_[_0xf198('0x31')](_0x1df7b6[_0xf198('0x34')]);_0x152d3f['filters']=_['intersection'](_0x152d3f[_0xf198('0x2f')],_0x152d3f[_0xf198('0x34')]);_0x48f7f5[_0xf198('0x35')]=_['intersection'](_0x152d3f[_0xf198('0x2f')],qs['fields'](_0x1df7b6[_0xf198('0x34')]['fields']));_0x48f7f5[_0xf198('0x35')]=_0x48f7f5['attributes'][_0xf198('0x37')]?_0x48f7f5[_0xf198('0x35')]:_0x152d3f['model'];if(_0x1df7b6['query'][_0xf198('0x42')]){_0x48f7f5[_0xf198('0x47')]=[{'all':!![]}];}_0x48f7f5=_[_0xf198('0x3f')]({},_0x48f7f5,_0x1df7b6[_0xf198('0x41')]);return db[_0xf198('0x2a')][_0xf198('0x48')](_0x48f7f5)['then'](handleEntityNotFound(_0x27d063,null))[_0xf198('0x25')](respondWithResult(_0x27d063,null))['catch'](handleError(_0x27d063,null));};exports[_0xf198('0x49')]=function(_0x5c7657,_0x4d04b6){return db[_0xf198('0x2a')][_0xf198('0x49')](_0x5c7657['body'],{})['then'](respondWithResult(_0x4d04b6,0xc9))[_0xf198('0x44')](handleError(_0x4d04b6,null));};exports[_0xf198('0x4a')]=function(_0x58acc3,_0x567949){if(_0x58acc3[_0xf198('0x4b')]['id']){delete _0x58acc3[_0xf198('0x4b')]['id'];}return db[_0xf198('0x2a')][_0xf198('0x48')]({'where':{'id':_0x58acc3[_0xf198('0x46')]['id']}})[_0xf198('0x25')](handleEntityNotFound(_0x567949,null))['then'](saveUpdates(_0x58acc3[_0xf198('0x4b')],null))[_0xf198('0x25')](respondWithResult(_0x567949,null))[_0xf198('0x44')](handleError(_0x567949,null));};exports[_0xf198('0x4c')]=function(_0x4ff568,_0x7bd8ba){return db[_0xf198('0x2a')][_0xf198('0x48')]({'where':{'id':_0x4ff568[_0xf198('0x46')]['id']}})[_0xf198('0x25')](handleEntityNotFound(_0x7bd8ba,null))['then'](removeEntity(_0x7bd8ba,null))['catch'](handleError(_0x7bd8ba,null));};exports[_0xf198('0x4d')]=function(_0x55d26e,_0x596c51,_0x27654f){var _0x562f3b={};var _0x29cfcf={};var _0x4bbbc9;var _0xd03284;return db[_0xf198('0x2a')][_0xf198('0x4e')]({'where':{'id':_0x55d26e[_0xf198('0x46')]['id']}})['then'](handleEntityNotFound(_0x596c51,null))[_0xf198('0x25')](function(_0x126a36){if(_0x126a36){_0x4bbbc9=_0x126a36;_0x29cfcf[_0xf198('0x2f')]=_[_0xf198('0x31')](db[_0xf198('0x4f')][_0xf198('0x2b')]);_0x29cfcf[_0xf198('0x34')]=_[_0xf198('0x31')](_0x55d26e['query']);_0x29cfcf['filters']=_[_0xf198('0x33')](_0x29cfcf[_0xf198('0x2f')],_0x29cfcf['query']);_0x562f3b[_0xf198('0x35')]=_[_0xf198('0x33')](_0x29cfcf[_0xf198('0x2f')],qs[_0xf198('0x36')](_0x55d26e[_0xf198('0x34')][_0xf198('0x36')]));_0x562f3b[_0xf198('0x35')]=_0x562f3b[_0xf198('0x35')]['length']?_0x562f3b[_0xf198('0x35')]:_0x29cfcf[_0xf198('0x2f')];_0x562f3b['order']=qs['sort'](_0x55d26e[_0xf198('0x34')][_0xf198('0x3b')]);_0x562f3b[_0xf198('0x3c')]=qs['filters'](_[_0xf198('0x3d')](_0x55d26e[_0xf198('0x34')],_0x29cfcf[_0xf198('0x32')]));if(_0x55d26e[_0xf198('0x34')]['filter']){_0x562f3b['where']=_[_0xf198('0x3f')](_0x562f3b[_0xf198('0x3c')],{'$or':_['map'](_0x562f3b['attributes'],function(_0x583a11){var _0x5418f6={};_0x5418f6[_0x583a11]={'$like':'%'+_0x55d26e[_0xf198('0x34')][_0xf198('0x3e')]+'%'};return _0x5418f6;})});}_0x562f3b=_[_0xf198('0x3f')]({},_0x562f3b,_0x55d26e[_0xf198('0x41')]);return _0x4bbbc9[_0xf198('0x4d')](_0x562f3b);}})[_0xf198('0x25')](function(_0x2d4b43){if(_0x2d4b43){_0xd03284=_0x2d4b43['length'];if(!_0x55d26e[_0xf198('0x34')][_0xf198('0x50')](_0xf198('0x38'))){_0x562f3b[_0xf198('0x39')]=qs[_0xf198('0x39')](_0x55d26e[_0xf198('0x34')]['limit']);_0x562f3b[_0xf198('0x1e')]=qs[_0xf198('0x1e')](_0x55d26e[_0xf198('0x34')][_0xf198('0x1e')]);}return _0x4bbbc9['getConfigurations'](_0x562f3b);}})[_0xf198('0x25')](function(_0x3e7e3b){if(_0x3e7e3b){return _0x3e7e3b?{'count':_0xd03284,'rows':_0x3e7e3b}:null;}})[_0xf198('0x25')](respondWithResult(_0x596c51,null))['catch'](handleError(_0x596c51,null));};exports[_0xf198('0x51')]=function(_0x4e3809,_0x44e3a3,_0x487794){if(_0x4e3809[_0xf198('0x4b')]['id']){delete _0x4e3809[_0xf198('0x4b')]['id'];}return db[_0xf198('0x2a')][_0xf198('0x4e')]({'where':{'id':_0x4e3809[_0xf198('0x46')]['id']}})[_0xf198('0x25')](handleEntityNotFound(_0x44e3a3,null))['then'](function(_0x1d2cea){if(_0x1d2cea){_0x4e3809[_0xf198('0x4b')][_0xf198('0x52')]=_0x1d2cea['id'];_0x4e3809['body']['Subjects']=integrations[_0xf198('0x53')](_0x4e3809['body']['channel'],_0x4e3809['body'][_0xf198('0x2d')]);_0x4e3809[_0xf198('0x4b')][_0xf198('0x54')]=integrations[_0xf198('0x55')](_0x4e3809[_0xf198('0x4b')][_0xf198('0x56')],_0x4e3809[_0xf198('0x4b')][_0xf198('0x2d')]);return db['ServicenowConfiguration']['create'](_0x4e3809[_0xf198('0x4b')],{'include':[{'model':db[_0xf198('0x57')],'as':_0xf198('0x58')},{'model':db[_0xf198('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x44e3a3,null))[_0xf198('0x44')](handleError(_0x44e3a3,null));};exports['getFields']=function(_0x54daa8,_0x62d27c,_0x589ff4){var _0x180355=[_0xf198('0x59'),_0xf198('0x5a'),_0xf198('0x5b'),_0xf198('0x5c'),'close_code',_0xf198('0x5d'),_0xf198('0x5e'),_0xf198('0x5f'),_0xf198('0x60')];var _0x4ff61f=['parent',_0xf198('0x59'),_0xf198('0x61'),_0xf198('0x62'),_0xf198('0x63'),_0xf198('0x64'),_0xf198('0x65'),_0xf198('0x5a'),'approval_history',_0xf198('0x66'),_0xf198('0x67'),'sys_updated_by','opened_by',_0xf198('0x68'),'sys_created_on',_0xf198('0x69'),'state',_0xf198('0x6a'),_0xf198('0x5b'),'order',_0xf198('0x6b'),_0xf198('0x6c'),_0xf198('0x6d'),_0xf198('0x6e'),_0xf198('0x6f'),'active',_0xf198('0x70'),_0xf198('0x71'),_0xf198('0x72'),'sys_domain_path',_0xf198('0x73'),_0xf198('0x74'),_0xf198('0x75'),'opened_at',_0xf198('0x76'),_0xf198('0x77'),_0xf198('0x78'),'reopened_time',_0xf198('0x79'),_0xf198('0x7a'),'approval_set',_0xf198('0x5c'),_0xf198('0x7b'),_0xf198('0x7c'),_0xf198('0x7d'),'correlation_display',_0xf198('0x7e'),_0xf198('0x7f'),'assignment_group',_0xf198('0x80'),_0xf198('0x81'),_0xf198('0x82'),_0xf198('0x83'),_0xf198('0x5d'),'sys_class_name',_0xf198('0x84'),_0xf198('0x85'),_0xf198('0x86'),'parent_incident',_0xf198('0x87'),'contact_type','reopened_by',_0xf198('0x5e'),_0xf198('0x88'),_0xf198('0x89'),_0xf198('0x8a'),_0xf198('0x8b'),_0xf198('0x8c'),_0xf198('0x8d'),_0xf198('0x5f'),'comments',_0xf198('0x8e'),_0xf198('0x8f'),'comments_and_work_notes','due_date',_0xf198('0x90'),'reopen_count',_0xf198('0x91'),_0xf198('0x92'),'upon_approval',_0xf198('0x93'),'location',_0xf198('0x60')];var _0x3ec665='';var _0x53dbb1='';var _0x305c53=[];var _0x4e7cb3='';var _0x2c9aba='';var _0x7e5e24=[];var _0x2feb8a='';var _0x2e6d19='';var _0x254b0e={};var _0x1d2259='';return db[_0xf198('0x2a')][_0xf198('0x4e')]({'where':{'id':_0x54daa8[_0xf198('0x46')]['id']},'attributes':['id',_0xf198('0x94'),_0xf198('0x95'),_0xf198('0x96'),_0xf198('0x97'),'serverUrl']})[_0xf198('0x25')](handleEntityNotFound(_0x62d27c,null))[_0xf198('0x25')](function(_0x88c8f6){if(_0x88c8f6){_0x1d2259=_0x88c8f6[_0xf198('0x97')];var _0x20b65d=_0x1d2259[_0xf198('0x98')](-0x1);if(_0x20b65d==='/'){_0x1d2259=_0x1d2259[_0xf198('0x99')](0x0,_0x1d2259['lastIndexOf'](_0x20b65d));}_0x2e6d19=util[_0xf198('0x9a')](_0xf198('0x9b'),_0x1d2259);_0x2feb8a=util[_0xf198('0x9a')](_0xf198('0x9c'),_0x1d2259);_0x254b0e={'user':_0x88c8f6[_0xf198('0x94')],'pass':_0x88c8f6[_0xf198('0x95')]};var _0x40c3a0={'method':_0xf198('0x9d'),'uri':_0x2e6d19+_0xf198('0x9e'),'auth':_0x254b0e,'json':!![]};return rp(_0x40c3a0);}})[_0xf198('0x25')](function(_0xa3ed4){if(_0xa3ed4[_0xf198('0x9f')][_0xf198('0x37')]>0x0){_0x3ec665=_0xa3ed4[_0xf198('0x9f')];}console[_0xf198('0xa0')](_0xf198('0xa1'),_0x3ec665);_0x7e5e24=[];_0x53dbb1=Object[_0xf198('0xa2')]([],_0x3ec665);_['remove'](_0x53dbb1,function(_0xb05eb4){return!_0x180355[_0xf198('0xa3')](_0xb05eb4[_0xf198('0x30')]);});_0x53dbb1[_0xf198('0xa4')](function(_0x51d5b6){var _0x4745fa=createFieldObject(_0x2feb8a,_0x254b0e,_0x51d5b6[_0xf198('0xa5')],_0x51d5b6[_0xf198('0x30')],_0x51d5b6[_0xf198('0xa6')],![]);_0x7e5e24[_0xf198('0xa7')](_0x4745fa);});return Promise['all'](_0x7e5e24);})[_0xf198('0x25')](function(_0x40e042){_0x305c53=_0x40e042;_0x4e7cb3=Object['assign']([],_0x3ec665);console[_0xf198('0xa0')]('TCL:\x20_object',_0x3ec665);_[_0xf198('0xa8')](_0x4e7cb3,function(_0x622f56){return _0x4ff61f[_0xf198('0xa3')](_0x622f56[_0xf198('0x30')]);});console[_0xf198('0xa0')](_0xf198('0xa9'),_0x4e7cb3);_0x7e5e24=[];_0x4e7cb3[_0xf198('0xa4')](function(_0x437d30){var _0x3a0f10=createFieldObject(_0x2feb8a,_0x254b0e,_0x437d30[_0xf198('0xa5')],_0x437d30['name'],_0x437d30[_0xf198('0xa6')],!![]);_0x7e5e24[_0xf198('0xa7')](_0x3a0f10);});return Promise[_0xf198('0xaa')](_0x7e5e24);})[_0xf198('0x25')](function(_0x142aab){_0x2c9aba=_0x142aab;var _0x49573b=_0x305c53[_0xf198('0xab')](_0x2c9aba);return{'count':_0x49573b[_0xf198('0x37')],'rows':_0x49573b};})[_0xf198('0x25')](respondWithResult(_0x62d27c,null))[_0xf198('0x44')](function(_0xe919c4){console[_0xf198('0xa0')](_0xf198('0xac')+_0xe919c4);var _0x5f377e=_0x54daa8['query']['test']?0x1f4:_0xe919c4[_0xf198('0xad')]||0x1f4;logger['error'](_0xe919c4[_0xf198('0x26')]);delete _0xe919c4[_0xf198('0x30')];if(_0x5f377e===0x191){_0x5f377e=0x190;}_0x62d27c[_0xf198('0x1c')](_0x5f377e)[_0xf198('0x27')](_0x54daa8[_0xf198('0x34')][_0xf198('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0xe919c4[_0xf198('0xad')]}:_0xe919c4);});};function createFieldObject(_0x17d2a5,_0x71ae39,_0x4b1f76,_0x130922,_0x5d00a4,_0x3abcb6){return new Promise(function(_0x5a9ef8,_0x2e7169){var _0x486a9d={'id':_0x130922,'name':_0x5d00a4,'custom':_0x3abcb6};if(_0x4b1f76==='boolean'){_0x486a9d[_0xf198('0x41')]=[{'name':_0xf198('0xaf'),'value':_0xf198('0xb0')},{'name':'False','value':_0xf198('0xb1')}];_0x5a9ef8(_0x486a9d);}else{var _0x4a7fcd={'method':'GET','uri':_0x17d2a5+_0xf198('0xb2')+_0x130922,'auth':_0x71ae39,'json':!![]};return rp(_0x4a7fcd)[_0xf198('0x25')](function(_0xa80303){var _0x141896=[];if(_0xa80303[_0xf198('0x9f')][_0xf198('0x37')]>0x0){_0xa80303['result'][_0xf198('0xa4')](function(_0x3863f6){if(_0x3863f6[_0xf198('0xb3')]==='false'){var _0x4f7d37={'name':_0x3863f6[_0xf198('0xa6')],'value':_0x3863f6['value']};_0x141896[_0xf198('0xa7')](_0x4f7d37);}});}_0x486a9d[_0xf198('0x41')]=_0x141896;if(_0x486a9d[_0xf198('0x41')]['length']>0x0){_0x5a9ef8(_0x486a9d);}else{if(_0x3abcb6==![]){_0x5a9ef8();}else{_0x5a9ef8(_0x486a9d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 546b024..981d8a6 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 _0xda19=['request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment'];(function(_0x25ac0b,_0x5b8f62){var _0x4ce8e3=function(_0x4bd7a6){while(--_0x4bd7a6){_0x25ac0b['push'](_0x25ac0b['shift']());}};_0x4ce8e3(++_0x5b8f62);}(_0xda19,0xd5));var _0x9da1=function(_0x532fd5,_0x2db808){_0x532fd5=_0x532fd5-0x0;var _0x2baee9=_0xda19[_0x532fd5];return _0x2baee9;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));var integrations=require(_0x9da1('0x7'));module[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return _0x2dcbc6[_0x9da1('0x9')](_0x9da1('0xa'),attributes,{'tableName':_0x9da1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x3f8a[_0x2bcddb];return _0x12a9e8;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 6a07c95..241474c 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 _0x9eb2=['http','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','options','raw','where','attributes','include','map','model','then','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x38e730,_0x2e63b6){var _0x29b82e=function(_0x7ab722){while(--_0x7ab722){_0x38e730['push'](_0x38e730['shift']());}};_0x29b82e(++_0x2e63b6);}(_0x9eb2,0x1a9));var _0x29eb=function(_0x2a3e83,_0x2a430f){_0x2a3e83=_0x2a3e83-0x0;var _0x22ac0c=_0x9eb2[_0x2a3e83];return _0x22ac0c;};'use strict';var _=require(_0x29eb('0x0'));var util=require(_0x29eb('0x1'));var moment=require('moment');var BPromise=require(_0x29eb('0x2'));var rs=require(_0x29eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29eb('0x4'))['db'];var utils=require(_0x29eb('0x5'));var logger=require(_0x29eb('0x6'))(_0x29eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x29eb('0x8'));var client=jayson['client'][_0x29eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x433aa9,_0x5939a4,_0x36c3f3){return new BPromise(function(_0x5f543e,_0x34b759){return client['request'](_0x433aa9,_0x36c3f3)['then'](function(_0x1d2a4d){logger[_0x29eb('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x5939a4,_0x29eb('0xb'));logger[_0x29eb('0xc')](_0x29eb('0xd'),_0x5939a4,'request\x20sent',JSON[_0x29eb('0xe')](_0x1d2a4d));if(_0x1d2a4d['error']){if(_0x1d2a4d[_0x29eb('0xf')][_0x29eb('0x10')]===0x1f4){logger[_0x29eb('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x5939a4,_0x1d2a4d[_0x29eb('0xf')]['message']);return _0x34b759(_0x1d2a4d[_0x29eb('0xf')][_0x29eb('0x11')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5939a4,_0x1d2a4d[_0x29eb('0xf')][_0x29eb('0x11')]);return _0x5f543e(_0x1d2a4d[_0x29eb('0xf')]['message']);}else{logger[_0x29eb('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x5939a4,_0x29eb('0xb'));_0x5f543e(_0x1d2a4d[_0x29eb('0x12')]['message']);}})[_0x29eb('0x13')](function(_0x5b27b3){logger[_0x29eb('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x5939a4,_0x5b27b3);_0x34b759(_0x5b27b3);});});}exports[_0x29eb('0x14')]=function(_0x1bc6e3){var _0xf37467=this;return new Promise(function(_0x44cb76,_0x5dee6b){return db['ServicenowAccount']['findAll']({'raw':_0x1bc6e3[_0x29eb('0x15')]?_0x1bc6e3[_0x29eb('0x15')][_0x29eb('0x16')]===undefined?!![]:![]:!![],'where':_0x1bc6e3[_0x29eb('0x15')]?_0x1bc6e3['options'][_0x29eb('0x17')]||null:null,'attributes':_0x1bc6e3[_0x29eb('0x15')]?_0x1bc6e3[_0x29eb('0x15')][_0x29eb('0x18')]||null:null,'limit':_0x1bc6e3[_0x29eb('0x15')]?_0x1bc6e3[_0x29eb('0x15')]['limit']||null:null,'include':_0x1bc6e3['options']?_0x1bc6e3[_0x29eb('0x15')][_0x29eb('0x19')]?_[_0x29eb('0x1a')](_0x1bc6e3[_0x29eb('0x15')]['include'],function(_0x110b76){return{'model':db[_0x110b76[_0x29eb('0x1b')]],'as':_0x110b76['as'],'attributes':_0x110b76[_0x29eb('0x18')],'include':_0x110b76[_0x29eb('0x19')]?_['map'](_0x110b76[_0x29eb('0x19')],function(_0x448d34){return{'model':db[_0x448d34[_0x29eb('0x1b')]],'as':_0x448d34['as'],'attributes':_0x448d34['attributes'],'include':_0x448d34['include']?_['map'](_0x448d34[_0x29eb('0x19')],function(_0x3880a4){return{'model':db[_0x3880a4[_0x29eb('0x1b')]],'as':_0x3880a4['as'],'attributes':_0x3880a4[_0x29eb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x29eb('0x1c')](function(_0x10fb80){logger[_0x29eb('0xa')](_0x29eb('0x14'),_0x1bc6e3);logger[_0x29eb('0xc')](_0x29eb('0x14'),_0x1bc6e3,JSON[_0x29eb('0xe')](_0x10fb80));_0x44cb76(_0x10fb80);})[_0x29eb('0x13')](function(_0x329b30){logger[_0x29eb('0xf')](_0x29eb('0x14'),_0x329b30[_0x29eb('0x11')],_0x1bc6e3);_0x5dee6b(_0xf37467[_0x29eb('0xf')](0x1f4,_0x329b30['message']));});});};exports[_0x29eb('0x1d')]=function(_0x508245){var _0x1d0842=this;return new Promise(function(_0x415c57,_0x43fec4){return db['ServicenowAccount'][_0x29eb('0x1e')]({'raw':_0x508245['options']?_0x508245[_0x29eb('0x15')][_0x29eb('0x16')]===undefined?!![]:![]:!![],'where':_0x508245[_0x29eb('0x15')]?_0x508245[_0x29eb('0x15')]['where']||null:null,'attributes':_0x508245[_0x29eb('0x15')]?_0x508245[_0x29eb('0x15')][_0x29eb('0x18')]||null:null,'include':_0x508245[_0x29eb('0x15')]?_0x508245[_0x29eb('0x15')]['include']?_[_0x29eb('0x1a')](_0x508245['options']['include'],function(_0x41262c){return{'model':db[_0x41262c[_0x29eb('0x1b')]],'as':_0x41262c['as'],'attributes':_0x41262c[_0x29eb('0x18')],'include':_0x41262c[_0x29eb('0x19')]?_[_0x29eb('0x1a')](_0x41262c[_0x29eb('0x19')],function(_0x160352){return{'model':db[_0x160352['model']],'as':_0x160352['as'],'attributes':_0x160352['attributes'],'include':_0x160352[_0x29eb('0x19')]?_[_0x29eb('0x1a')](_0x160352[_0x29eb('0x19')],function(_0x4a1b24){return{'model':db[_0x4a1b24[_0x29eb('0x1b')]],'as':_0x4a1b24['as'],'attributes':_0x4a1b24[_0x29eb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x29eb('0x1c')](function(_0x187ae2){logger[_0x29eb('0xa')](_0x29eb('0x1d'),_0x508245);logger['debug'](_0x29eb('0x1d'),_0x508245,JSON[_0x29eb('0xe')](_0x187ae2));_0x415c57(_0x187ae2);})[_0x29eb('0x13')](function(_0x2fea66){logger[_0x29eb('0xf')](_0x29eb('0x1d'),_0x2fea66[_0x29eb('0x11')],_0x508245);_0x43fec4(_0x1d0842[_0x29eb('0xf')](0x1f4,_0x2fea66[_0x29eb('0x11')]));});});}; \ No newline at end of file +var _0x44ca=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ServicenowAccount','options','attributes','limit','map','include','model','GetServicenowAccount','debug','find','raw','where','then','ShowServicenowAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0x44ca,0x86));var _0xa44c=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x44ca[_0x438912];return _0x18112f;};'use strict';var _=require('lodash');var util=require(_0xa44c('0x0'));var moment=require(_0xa44c('0x1'));var BPromise=require(_0xa44c('0x2'));var rs=require(_0xa44c('0x3'));var fs=require('fs');var Redis=require(_0xa44c('0x4'));var db=require(_0xa44c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa44c('0x6'))(_0xa44c('0x7'));var config=require(_0xa44c('0x8'));var jayson=require(_0xa44c('0x9'));var client=jayson[_0xa44c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad562,_0x3baec2,_0xb3e0e9){return new BPromise(function(_0x20f3ba,_0x4f5b9b){return client[_0xa44c('0xb')](_0x4ad562,_0xb3e0e9)['then'](function(_0x23eb82){logger[_0xa44c('0xc')](_0xa44c('0xd'),_0x3baec2,'request\x20sent');logger['debug'](_0xa44c('0xe'),_0x3baec2,_0xa44c('0xf'),JSON[_0xa44c('0x10')](_0x23eb82));if(_0x23eb82[_0xa44c('0x11')]){if(_0x23eb82[_0xa44c('0x11')]['code']===0x1f4){logger[_0xa44c('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x3baec2,_0x23eb82[_0xa44c('0x11')][_0xa44c('0x12')]);return _0x4f5b9b(_0x23eb82[_0xa44c('0x11')][_0xa44c('0x12')]);}logger['error'](_0xa44c('0xd'),_0x3baec2,_0x23eb82[_0xa44c('0x11')][_0xa44c('0x12')]);return _0x20f3ba(_0x23eb82[_0xa44c('0x11')][_0xa44c('0x12')]);}else{logger[_0xa44c('0xc')](_0xa44c('0xd'),_0x3baec2,_0xa44c('0xf'));_0x20f3ba(_0x23eb82[_0xa44c('0x13')][_0xa44c('0x12')]);}})[_0xa44c('0x14')](function(_0x15798e){logger[_0xa44c('0x11')](_0xa44c('0xd'),_0x3baec2,_0x15798e);_0x4f5b9b(_0x15798e);});});}exports['GetServicenowAccount']=function(_0x214ed2){var _0x31c6b7=this;return new Promise(function(_0x1734fa,_0x1c9441){return db[_0xa44c('0x15')]['findAll']({'raw':_0x214ed2['options']?_0x214ed2[_0xa44c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x214ed2['options']?_0x214ed2[_0xa44c('0x16')]['where']||null:null,'attributes':_0x214ed2[_0xa44c('0x16')]?_0x214ed2['options'][_0xa44c('0x17')]||null:null,'limit':_0x214ed2[_0xa44c('0x16')]?_0x214ed2[_0xa44c('0x16')][_0xa44c('0x18')]||null:null,'include':_0x214ed2[_0xa44c('0x16')]?_0x214ed2[_0xa44c('0x16')]['include']?_[_0xa44c('0x19')](_0x214ed2[_0xa44c('0x16')][_0xa44c('0x1a')],function(_0x146691){return{'model':db[_0x146691[_0xa44c('0x1b')]],'as':_0x146691['as'],'attributes':_0x146691[_0xa44c('0x17')],'include':_0x146691[_0xa44c('0x1a')]?_['map'](_0x146691[_0xa44c('0x1a')],function(_0x1b8743){return{'model':db[_0x1b8743[_0xa44c('0x1b')]],'as':_0x1b8743['as'],'attributes':_0x1b8743[_0xa44c('0x17')],'include':_0x1b8743[_0xa44c('0x1a')]?_[_0xa44c('0x19')](_0x1b8743[_0xa44c('0x1a')],function(_0x130dad){return{'model':db[_0x130dad[_0xa44c('0x1b')]],'as':_0x130dad['as'],'attributes':_0x130dad[_0xa44c('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c8745){logger[_0xa44c('0xc')](_0xa44c('0x1c'),_0x214ed2);logger[_0xa44c('0x1d')](_0xa44c('0x1c'),_0x214ed2,JSON[_0xa44c('0x10')](_0x1c8745));_0x1734fa(_0x1c8745);})[_0xa44c('0x14')](function(_0x3ac71a){logger[_0xa44c('0x11')](_0xa44c('0x1c'),_0x3ac71a[_0xa44c('0x12')],_0x214ed2);_0x1c9441(_0x31c6b7['error'](0x1f4,_0x3ac71a[_0xa44c('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x13c8b2){var _0x401ad6=this;return new Promise(function(_0x3191ea,_0x36b234){return db['ServicenowAccount'][_0xa44c('0x1e')]({'raw':_0x13c8b2[_0xa44c('0x16')]?_0x13c8b2['options'][_0xa44c('0x1f')]===undefined?!![]:![]:!![],'where':_0x13c8b2[_0xa44c('0x16')]?_0x13c8b2[_0xa44c('0x16')][_0xa44c('0x20')]||null:null,'attributes':_0x13c8b2[_0xa44c('0x16')]?_0x13c8b2[_0xa44c('0x16')][_0xa44c('0x17')]||null:null,'include':_0x13c8b2[_0xa44c('0x16')]?_0x13c8b2[_0xa44c('0x16')][_0xa44c('0x1a')]?_[_0xa44c('0x19')](_0x13c8b2['options'][_0xa44c('0x1a')],function(_0x4b8443){return{'model':db[_0x4b8443['model']],'as':_0x4b8443['as'],'attributes':_0x4b8443['attributes'],'include':_0x4b8443[_0xa44c('0x1a')]?_[_0xa44c('0x19')](_0x4b8443[_0xa44c('0x1a')],function(_0x42eaf0){return{'model':db[_0x42eaf0[_0xa44c('0x1b')]],'as':_0x42eaf0['as'],'attributes':_0x42eaf0[_0xa44c('0x17')],'include':_0x42eaf0['include']?_[_0xa44c('0x19')](_0x42eaf0[_0xa44c('0x1a')],function(_0x3c2edd){return{'model':db[_0x3c2edd[_0xa44c('0x1b')]],'as':_0x3c2edd['as'],'attributes':_0x3c2edd[_0xa44c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa44c('0x21')](function(_0x11d721){logger['info'](_0xa44c('0x22'),_0x13c8b2);logger[_0xa44c('0x1d')](_0xa44c('0x22'),_0x13c8b2,JSON[_0xa44c('0x10')](_0x11d721));_0x3191ea(_0x11d721);})[_0xa44c('0x14')](function(_0xff9b25){logger[_0xa44c('0x11')](_0xa44c('0x22'),_0xff9b25[_0xa44c('0x12')],_0x13c8b2);_0x36b234(_0x401ad6[_0xa44c('0x11')](0x1f4,_0xff9b25[_0xa44c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e5af5de..0c19807 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 _0x5f1d=['getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5c5ab6,_0x58c0b0){var _0x1c5035=function(_0x109deb){while(--_0x109deb){_0x5c5ab6['push'](_0x5c5ab6['shift']());}};_0x1c5035(++_0x58c0b0);}(_0x5f1d,0x1c2));var _0xd5f1=function(_0x26ad7b,_0x1648f7){_0x26ad7b=_0x26ad7b-0x0;var _0x57f686=_0x5f1d[_0x26ad7b];return _0x57f686;};'use strict';var multer=require(_0xd5f1('0x0'));var util=require(_0xd5f1('0x1'));var path=require(_0xd5f1('0x2'));var timeout=require(_0xd5f1('0x3'));var express=require(_0xd5f1('0x4'));var router=express[_0xd5f1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd5f1('0x6'));var interaction=require(_0xd5f1('0x7'));var config=require(_0xd5f1('0x8'));var controller=require(_0xd5f1('0x9'));router[_0xd5f1('0xa')]('/',auth['isAuthenticated'](),controller[_0xd5f1('0xb')]);router[_0xd5f1('0xa')](_0xd5f1('0xc'),auth[_0xd5f1('0xd')](),controller[_0xd5f1('0xe')]);router[_0xd5f1('0xa')]('/:id/fields',auth[_0xd5f1('0xd')](),controller['getFields']);router[_0xd5f1('0xa')](_0xd5f1('0xf'),auth[_0xd5f1('0xd')](),controller[_0xd5f1('0x10')]);router[_0xd5f1('0xa')](_0xd5f1('0x11'),auth[_0xd5f1('0xd')](),controller[_0xd5f1('0x12')]);router[_0xd5f1('0x13')]('/',auth[_0xd5f1('0xd')](),controller[_0xd5f1('0x14')]);router[_0xd5f1('0x15')](_0xd5f1('0xc'),auth['isAuthenticated'](),controller[_0xd5f1('0x16')]);router[_0xd5f1('0x17')](_0xd5f1('0xc'),auth['isAuthenticated'](),controller[_0xd5f1('0x18')]);module[_0xd5f1('0x19')]=router; \ No newline at end of file +var _0x40b8=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x40b8,0x65));var _0x840b=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x40b8[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0x840b('0x0'));var util=require(_0x840b('0x1'));var path=require(_0x840b('0x2'));var timeout=require(_0x840b('0x3'));var express=require(_0x840b('0x4'));var router=express[_0x840b('0x5')]();var fs_extra=require(_0x840b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x840b('0x7'));var config=require(_0x840b('0x8'));var controller=require(_0x840b('0x9'));router[_0x840b('0xa')]('/',auth['isAuthenticated'](),controller[_0x840b('0xb')]);router[_0x840b('0xa')](_0x840b('0xc'),auth[_0x840b('0xd')](),controller[_0x840b('0xe')]);router[_0x840b('0xa')](_0x840b('0xf'),auth[_0x840b('0xd')](),controller[_0x840b('0x10')]);router['get'](_0x840b('0x11'),auth[_0x840b('0xd')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x840b('0xd')](),controller[_0x840b('0x12')]);router['post']('/',auth[_0x840b('0xd')](),controller[_0x840b('0x13')]);router[_0x840b('0x14')](_0x840b('0xc'),auth[_0x840b('0xd')](),controller['update']);router[_0x840b('0x15')](_0x840b('0xc'),auth[_0x840b('0xd')](),controller[_0x840b('0x16')]);module[_0x840b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 53d8724..4c29d03 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 _0x2d2e=['exports','STRING'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x2d2e,0xd2));var _0xe2d2=function(_0x4529b3,_0x390ebb){_0x4529b3=_0x4529b3-0x0;var _0x21e907=_0x2d2e[_0x4529b3];return _0x21e907;};'use strict';var Sequelize=require('sequelize');module[_0xe2d2('0x0')]={'name':{'type':Sequelize[_0xe2d2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x39f6=['STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x39f6,0x1c2));var _0x639f=function(_0x490515,_0x180324){_0x490515=_0x490515-0x0;var _0x45a918=_0x39f6[_0x490515];return _0x45a918;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x639f('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1a29626..5b1a0b1 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 _0x82d9=['getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','Content-Range','json','reject','update','then','destroy','sendStatus','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','create','body','catch','find','findOne'];(function(_0x5bfa59,_0x271e14){var _0x493e51=function(_0x163e1a){while(--_0x163e1a){_0x5bfa59['push'](_0x5bfa59['shift']());}};_0x493e51(++_0x271e14);}(_0x82d9,0x1de));var _0x982d=function(_0xa15d20,_0x43f3d6){_0xa15d20=_0xa15d20-0x0;var _0x3030a5=_0x82d9[_0xa15d20];return _0x3030a5;};'use strict';var emlformat=require(_0x982d('0x0'));var rimraf=require(_0x982d('0x1'));var zipdir=require(_0x982d('0x2'));var jsonpatch=require(_0x982d('0x3'));var rp=require(_0x982d('0x4'));var moment=require(_0x982d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x982d('0x6'));var path=require(_0x982d('0x7'));var sox=require('sox');var csv=require(_0x982d('0x8'));var ejs=require(_0x982d('0x9'));var fs=require('fs');var fs_extra=require(_0x982d('0xa'));var _=require('lodash');var squel=require(_0x982d('0xb'));var crypto=require(_0x982d('0xc'));var jsforce=require(_0x982d('0xd'));var deskjs=require(_0x982d('0xe'));var toCsv=require(_0x982d('0x8'));var querystring=require(_0x982d('0xf'));var Papa=require('papaparse');var Redis=require(_0x982d('0x10'));var authService=require(_0x982d('0x11'));var qs=require(_0x982d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x982d('0x13'));var logger=require(_0x982d('0x14'))(_0x982d('0x15'));var utils=require(_0x982d('0x16'));var config=require(_0x982d('0x17'));var licenseUtil=require(_0x982d('0x18'));var db=require(_0x982d('0x19'))['db'];function respondWithStatusCode(_0x1c3b24,_0xdb1ebf){_0xdb1ebf=_0xdb1ebf||0xcc;return function(_0x5e8352){if(_0x5e8352){return _0x1c3b24['sendStatus'](_0xdb1ebf);}return _0x1c3b24['status'](_0xdb1ebf)[_0x982d('0x1a')]();};}function respondWithResult(_0xccf2ab,_0x56ff98){_0x56ff98=_0x56ff98||0xc8;return function(_0x569665){if(_0x569665){return _0xccf2ab[_0x982d('0x1b')](_0x56ff98)['json'](_0x569665);}};}function respondWithFilteredResult(_0x369a1c,_0x303594){return function(_0x9ee675){if(_0x9ee675){var _0x2b9fa2=typeof _0x303594[_0x982d('0x1c')]===_0x982d('0x1d')&&typeof _0x303594[_0x982d('0x1e')]===_0x982d('0x1d');var _0x40f3e1=_0x9ee675['count'];var _0xff8bc2=_0x2b9fa2?0x0:_0x303594[_0x982d('0x1c')];var _0x46d515=_0x2b9fa2?_0x9ee675['count']:_0x303594['offset']+_0x303594[_0x982d('0x1e')];var _0x580823;if(_0x46d515>=_0x40f3e1){_0x46d515=_0x40f3e1;_0x580823=0xc8;}else{_0x580823=0xce;}_0x369a1c[_0x982d('0x1b')](_0x580823);return _0x369a1c['set'](_0x982d('0x1f'),_0xff8bc2+'-'+_0x46d515+'/'+_0x40f3e1)[_0x982d('0x20')](_0x9ee675);}return null;};}function patchUpdates(_0x4a55de){return function(_0x118561){try{jsonpatch['apply'](_0x118561,_0x4a55de,!![]);}catch(_0x31eaff){return BPromise[_0x982d('0x21')](_0x31eaff);}return _0x118561['save']();};}function saveUpdates(_0x2d4a09,_0x3731e0){return function(_0x4f1e00){if(_0x4f1e00){return _0x4f1e00[_0x982d('0x22')](_0x2d4a09)[_0x982d('0x23')](function(_0x3dad54){return _0x3dad54;});}return null;};}function removeEntity(_0x4e94dd,_0x32cf43){return function(_0x55e218){if(_0x55e218){return _0x55e218[_0x982d('0x24')]()[_0x982d('0x23')](function(){_0x4e94dd[_0x982d('0x1b')](0xcc)[_0x982d('0x1a')]();});}};}function handleEntityNotFound(_0x25baea,_0x10044c){return function(_0x1425c6){if(!_0x1425c6){_0x25baea[_0x982d('0x25')](0x194);}return _0x1425c6;};}function handleError(_0x1dfe7b,_0x25349f){_0x25349f=_0x25349f||0x1f4;return function(_0x2de633){logger['error'](_0x2de633[_0x982d('0x26')]);if(_0x2de633[_0x982d('0x27')]){delete _0x2de633[_0x982d('0x27')];}_0x1dfe7b[_0x982d('0x1b')](_0x25349f)[_0x982d('0x28')](_0x2de633);};}exports[_0x982d('0x29')]=function(_0x516fa4,_0x4bea83){var _0x5c1c5c={},_0x460d2e={},_0x5d12b9={'count':0x0,'rows':[]};var _0x3605cc=_[_0x982d('0x2a')](db[_0x982d('0x2b')][_0x982d('0x2c')],function(_0x54552c){return{'name':_0x54552c['fieldName'],'type':_0x54552c[_0x982d('0x2d')][_0x982d('0x2e')]};});_0x460d2e[_0x982d('0x2f')]=_[_0x982d('0x2a')](_0x3605cc,_0x982d('0x27'));_0x460d2e[_0x982d('0x30')]=_[_0x982d('0x31')](_0x516fa4[_0x982d('0x30')]);_0x460d2e[_0x982d('0x32')]=_[_0x982d('0x33')](_0x460d2e[_0x982d('0x2f')],_0x460d2e[_0x982d('0x30')]);_0x5c1c5c[_0x982d('0x34')]=_[_0x982d('0x33')](_0x460d2e[_0x982d('0x2f')],qs['fields'](_0x516fa4[_0x982d('0x30')][_0x982d('0x35')]));_0x5c1c5c[_0x982d('0x34')]=_0x5c1c5c[_0x982d('0x34')][_0x982d('0x36')]?_0x5c1c5c[_0x982d('0x34')]:_0x460d2e['model'];if(!_0x516fa4[_0x982d('0x30')][_0x982d('0x37')](_0x982d('0x38'))){_0x5c1c5c[_0x982d('0x1e')]=qs['limit'](_0x516fa4[_0x982d('0x30')]['limit']);_0x5c1c5c[_0x982d('0x1c')]=qs['offset'](_0x516fa4['query'][_0x982d('0x1c')]);}_0x5c1c5c[_0x982d('0x39')]=qs[_0x982d('0x3a')](_0x516fa4[_0x982d('0x30')][_0x982d('0x3a')]);_0x5c1c5c[_0x982d('0x3b')]=qs[_0x982d('0x32')](_[_0x982d('0x3c')](_0x516fa4[_0x982d('0x30')],_0x460d2e['filters']),_0x3605cc);if(_0x516fa4[_0x982d('0x30')][_0x982d('0x3d')]){_0x5c1c5c[_0x982d('0x3b')]=_['merge'](_0x5c1c5c[_0x982d('0x3b')],{'$or':_[_0x982d('0x2a')](_0x3605cc,function(_0x163741){if(_0x163741[_0x982d('0x2d')]!=='VIRTUAL'){var _0x1a72c5={};_0x1a72c5[_0x163741[_0x982d('0x27')]]={'$like':'%'+_0x516fa4[_0x982d('0x30')][_0x982d('0x3d')]+'%'};return _0x1a72c5;}})});}_0x5c1c5c=_[_0x982d('0x3e')]({},_0x5c1c5c,_0x516fa4[_0x982d('0x3f')]);var _0x58a3a2={'where':_0x5c1c5c[_0x982d('0x3b')]};return db[_0x982d('0x2b')][_0x982d('0x40')](_0x58a3a2)[_0x982d('0x23')](function(_0x12a458){_0x5d12b9[_0x982d('0x40')]=_0x12a458;if(_0x516fa4[_0x982d('0x30')][_0x982d('0x41')]){_0x5c1c5c[_0x982d('0x42')]=[{'all':!![]}];}return db[_0x982d('0x2b')][_0x982d('0x43')](_0x5c1c5c);})[_0x982d('0x23')](function(_0x5d29d8){_0x5d12b9[_0x982d('0x44')]=_0x5d29d8;return _0x5d12b9;})[_0x982d('0x23')](respondWithFilteredResult(_0x4bea83,_0x5c1c5c))['catch'](handleError(_0x4bea83,null));};exports['show']=function(_0x34ca7e,_0x4988fe){var _0x493fd4={'raw':![],'where':{'id':_0x34ca7e[_0x982d('0x45')]['id']}},_0xabc83b={};_0xabc83b[_0x982d('0x2f')]=_[_0x982d('0x31')](db['ServicenowConfiguration']['rawAttributes']);_0xabc83b[_0x982d('0x30')]=_[_0x982d('0x31')](_0x34ca7e[_0x982d('0x30')]);_0xabc83b[_0x982d('0x32')]=_[_0x982d('0x33')](_0xabc83b[_0x982d('0x2f')],_0xabc83b[_0x982d('0x30')]);_0x493fd4[_0x982d('0x34')]=_['intersection'](_0xabc83b[_0x982d('0x2f')],qs[_0x982d('0x35')](_0x34ca7e[_0x982d('0x30')][_0x982d('0x35')]));_0x493fd4[_0x982d('0x34')]=_0x493fd4[_0x982d('0x34')][_0x982d('0x36')]?_0x493fd4[_0x982d('0x34')]:_0xabc83b[_0x982d('0x2f')];if(_0x34ca7e[_0x982d('0x30')][_0x982d('0x41')]){_0x493fd4['include']=[{'all':!![]}];}_0x493fd4=_[_0x982d('0x3e')]({},_0x493fd4,_0x34ca7e['options']);return db[_0x982d('0x2b')]['find'](_0x493fd4)['then'](handleEntityNotFound(_0x4988fe,null))[_0x982d('0x23')](respondWithResult(_0x4988fe,null))['catch'](handleError(_0x4988fe,null));};exports[_0x982d('0x46')]=function(_0x2435a1,_0x4f1280){return db[_0x982d('0x2b')][_0x982d('0x46')](_0x2435a1[_0x982d('0x47')],{})[_0x982d('0x23')](respondWithResult(_0x4f1280,0xc9))[_0x982d('0x48')](handleError(_0x4f1280,null));};exports[_0x982d('0x22')]=function(_0x2dfa83,_0x20f3c7){if(_0x2dfa83[_0x982d('0x47')]['id']){delete _0x2dfa83[_0x982d('0x47')]['id'];}return db[_0x982d('0x2b')][_0x982d('0x49')]({'where':{'id':_0x2dfa83[_0x982d('0x45')]['id']}})[_0x982d('0x23')](handleEntityNotFound(_0x20f3c7,null))[_0x982d('0x23')](saveUpdates(_0x2dfa83[_0x982d('0x47')],null))[_0x982d('0x23')](respondWithResult(_0x20f3c7,null))[_0x982d('0x48')](handleError(_0x20f3c7,null));};exports[_0x982d('0x24')]=function(_0x470167,_0x3c691a){return db[_0x982d('0x2b')][_0x982d('0x49')]({'where':{'id':_0x470167[_0x982d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c691a,null))[_0x982d('0x23')](removeEntity(_0x3c691a,null))['catch'](handleError(_0x3c691a,null));};exports['getFields']=function(_0x2ff0fb,_0xffd8f7,_0x351d9e){var _0x5c75e2={};var _0x5d2544={};var _0x39a6cd;var _0x21206a;return db[_0x982d('0x2b')][_0x982d('0x4a')]({'where':{'id':_0x2ff0fb[_0x982d('0x45')]['id']}})[_0x982d('0x23')](handleEntityNotFound(_0xffd8f7,null))[_0x982d('0x23')](function(_0x3faf53){if(_0x3faf53){_0x39a6cd=_0x3faf53;_0x5d2544[_0x982d('0x2f')]=_[_0x982d('0x31')](db['ServicenowField'][_0x982d('0x2c')]);_0x5d2544['query']=_[_0x982d('0x31')](_0x2ff0fb[_0x982d('0x30')]);_0x5d2544[_0x982d('0x32')]=_[_0x982d('0x33')](_0x5d2544[_0x982d('0x2f')],_0x5d2544[_0x982d('0x30')]);_0x5c75e2['attributes']=_[_0x982d('0x33')](_0x5d2544[_0x982d('0x2f')],qs[_0x982d('0x35')](_0x2ff0fb[_0x982d('0x30')][_0x982d('0x35')]));_0x5c75e2[_0x982d('0x34')]=_0x5c75e2[_0x982d('0x34')][_0x982d('0x36')]?_0x5c75e2[_0x982d('0x34')]:_0x5d2544['model'];_0x5c75e2[_0x982d('0x39')]=qs[_0x982d('0x3a')](_0x2ff0fb['query'][_0x982d('0x3a')]);_0x5c75e2[_0x982d('0x3b')]=qs[_0x982d('0x32')](_[_0x982d('0x3c')](_0x2ff0fb['query'],_0x5d2544['filters']));if(_0x2ff0fb['query'][_0x982d('0x3d')]){_0x5c75e2[_0x982d('0x3b')]=_[_0x982d('0x3e')](_0x5c75e2[_0x982d('0x3b')],{'$or':_['map'](_0x5c75e2[_0x982d('0x34')],function(_0x5b9e7e){var _0x56f157={};_0x56f157[_0x5b9e7e]={'$like':'%'+_0x2ff0fb['query'][_0x982d('0x3d')]+'%'};return _0x56f157;})});}_0x5c75e2=_['merge']({},_0x5c75e2,_0x2ff0fb[_0x982d('0x3f')]);return _0x39a6cd[_0x982d('0x4b')](_0x5c75e2);}})[_0x982d('0x23')](function(_0x3ff00c){if(_0x3ff00c){_0x21206a=_0x3ff00c[_0x982d('0x36')];if(!_0x2ff0fb[_0x982d('0x30')][_0x982d('0x37')]('nolimit')){_0x5c75e2[_0x982d('0x1e')]=qs[_0x982d('0x1e')](_0x2ff0fb[_0x982d('0x30')][_0x982d('0x1e')]);_0x5c75e2[_0x982d('0x1c')]=qs[_0x982d('0x1c')](_0x2ff0fb['query'][_0x982d('0x1c')]);}return _0x39a6cd[_0x982d('0x4b')](_0x5c75e2);}})[_0x982d('0x23')](function(_0x42ba5a){if(_0x42ba5a){return _0x42ba5a?{'count':_0x21206a,'rows':_0x42ba5a}:null;}})[_0x982d('0x23')](respondWithResult(_0xffd8f7,null))[_0x982d('0x48')](handleError(_0xffd8f7,null));};exports[_0x982d('0x4c')]=function(_0x7628b9,_0x419f7c,_0x1e0bfc){var _0x193010={};var _0xaee0c4={};var _0x2bc9c1;var _0x1f6e4a;return db[_0x982d('0x2b')][_0x982d('0x4a')]({'where':{'id':_0x7628b9[_0x982d('0x45')]['id']}})['then'](handleEntityNotFound(_0x419f7c,null))[_0x982d('0x23')](function(_0x16d665){if(_0x16d665){_0x2bc9c1=_0x16d665;_0xaee0c4['model']=_[_0x982d('0x31')](db[_0x982d('0x4d')]['rawAttributes']);_0xaee0c4[_0x982d('0x30')]=_[_0x982d('0x31')](_0x7628b9['query']);_0xaee0c4[_0x982d('0x32')]=_[_0x982d('0x33')](_0xaee0c4[_0x982d('0x2f')],_0xaee0c4[_0x982d('0x30')]);_0x193010['attributes']=_[_0x982d('0x33')](_0xaee0c4['model'],qs['fields'](_0x7628b9[_0x982d('0x30')][_0x982d('0x35')]));_0x193010['attributes']=_0x193010[_0x982d('0x34')][_0x982d('0x36')]?_0x193010[_0x982d('0x34')]:_0xaee0c4[_0x982d('0x2f')];_0x193010['order']=qs[_0x982d('0x3a')](_0x7628b9['query'][_0x982d('0x3a')]);_0x193010[_0x982d('0x3b')]=qs[_0x982d('0x32')](_['pick'](_0x7628b9['query'],_0xaee0c4[_0x982d('0x32')]));if(_0x7628b9[_0x982d('0x30')][_0x982d('0x3d')]){_0x193010[_0x982d('0x3b')]=_[_0x982d('0x3e')](_0x193010[_0x982d('0x3b')],{'$or':_[_0x982d('0x2a')](_0x193010[_0x982d('0x34')],function(_0x3dff09){var _0x59661e={};_0x59661e[_0x3dff09]={'$like':'%'+_0x7628b9['query'][_0x982d('0x3d')]+'%'};return _0x59661e;})});}_0x193010=_[_0x982d('0x3e')]({},_0x193010,_0x7628b9[_0x982d('0x3f')]);return _0x2bc9c1['getSubjects'](_0x193010);}})[_0x982d('0x23')](function(_0x4a8bf5){if(_0x4a8bf5){_0x1f6e4a=_0x4a8bf5[_0x982d('0x36')];if(!_0x7628b9[_0x982d('0x30')][_0x982d('0x37')](_0x982d('0x38'))){_0x193010['limit']=qs[_0x982d('0x1e')](_0x7628b9['query'][_0x982d('0x1e')]);_0x193010[_0x982d('0x1c')]=qs[_0x982d('0x1c')](_0x7628b9['query'][_0x982d('0x1c')]);}return _0x2bc9c1[_0x982d('0x4c')](_0x193010);}})[_0x982d('0x23')](function(_0x4c47f5){if(_0x4c47f5){return _0x4c47f5?{'count':_0x1f6e4a,'rows':_0x4c47f5}:null;}})[_0x982d('0x23')](respondWithResult(_0x419f7c,null))[_0x982d('0x48')](handleError(_0x419f7c,null));};exports[_0x982d('0x4e')]=function(_0x3623f4,_0xd15bb0,_0xe7bf54){var _0x4e07ce={};var _0x19c321={};var _0x43c201;var _0x567491;return db[_0x982d('0x2b')][_0x982d('0x4a')]({'where':{'id':_0x3623f4[_0x982d('0x45')]['id']}})['then'](handleEntityNotFound(_0xd15bb0,null))['then'](function(_0x57d1ec){if(_0x57d1ec){_0x43c201=_0x57d1ec;_0x19c321[_0x982d('0x2f')]=_[_0x982d('0x31')](db[_0x982d('0x4d')][_0x982d('0x2c')]);_0x19c321['query']=_[_0x982d('0x31')](_0x3623f4[_0x982d('0x30')]);_0x19c321[_0x982d('0x32')]=_[_0x982d('0x33')](_0x19c321['model'],_0x19c321[_0x982d('0x30')]);_0x4e07ce[_0x982d('0x34')]=_[_0x982d('0x33')](_0x19c321[_0x982d('0x2f')],qs[_0x982d('0x35')](_0x3623f4['query'][_0x982d('0x35')]));_0x4e07ce[_0x982d('0x34')]=_0x4e07ce[_0x982d('0x34')]['length']?_0x4e07ce[_0x982d('0x34')]:_0x19c321[_0x982d('0x2f')];_0x4e07ce[_0x982d('0x39')]=qs[_0x982d('0x3a')](_0x3623f4[_0x982d('0x30')][_0x982d('0x3a')]);_0x4e07ce[_0x982d('0x3b')]=qs[_0x982d('0x32')](_[_0x982d('0x3c')](_0x3623f4[_0x982d('0x30')],_0x19c321['filters']));if(_0x3623f4[_0x982d('0x30')]['filter']){_0x4e07ce['where']=_[_0x982d('0x3e')](_0x4e07ce[_0x982d('0x3b')],{'$or':_[_0x982d('0x2a')](_0x4e07ce[_0x982d('0x34')],function(_0x161f8d){var _0x22d074={};_0x22d074[_0x161f8d]={'$like':'%'+_0x3623f4['query'][_0x982d('0x3d')]+'%'};return _0x22d074;})});}_0x4e07ce=_['merge']({},_0x4e07ce,_0x3623f4[_0x982d('0x3f')]);return _0x43c201[_0x982d('0x4e')](_0x4e07ce);}})[_0x982d('0x23')](function(_0x1cbcb0){if(_0x1cbcb0){_0x567491=_0x1cbcb0['length'];if(!_0x3623f4[_0x982d('0x30')][_0x982d('0x37')](_0x982d('0x38'))){_0x4e07ce['limit']=qs[_0x982d('0x1e')](_0x3623f4[_0x982d('0x30')][_0x982d('0x1e')]);_0x4e07ce[_0x982d('0x1c')]=qs[_0x982d('0x1c')](_0x3623f4[_0x982d('0x30')][_0x982d('0x1c')]);}return _0x43c201[_0x982d('0x4e')](_0x4e07ce);}})[_0x982d('0x23')](function(_0x1a32d9){if(_0x1a32d9){return _0x1a32d9?{'count':_0x567491,'rows':_0x1a32d9}:null;}})[_0x982d('0x23')](respondWithResult(_0xd15bb0,null))['catch'](handleError(_0xd15bb0,null));}; \ No newline at end of file +var _0xa09f=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','rows','params','create','body','catch','findOne','pick','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0xa09f,0x198));var _0xfa09=function(_0x23a194,_0xf15c24){_0x23a194=_0x23a194-0x0;var _0x5cd67b=_0xa09f[_0x23a194];return _0x5cd67b;};'use strict';var emlformat=require(_0xfa09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa09('0x1'));var jsonpatch=require(_0xfa09('0x2'));var rp=require(_0xfa09('0x3'));var moment=require(_0xfa09('0x4'));var BPromise=require(_0xfa09('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfa09('0x6'));var sox=require(_0xfa09('0x7'));var csv=require(_0xfa09('0x8'));var ejs=require(_0xfa09('0x9'));var fs=require('fs');var fs_extra=require(_0xfa09('0xa'));var _=require(_0xfa09('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa09('0xc'));var deskjs=require(_0xfa09('0xd'));var toCsv=require(_0xfa09('0x8'));var querystring=require(_0xfa09('0xe'));var Papa=require(_0xfa09('0xf'));var Redis=require(_0xfa09('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfa09('0x11'));var as=require(_0xfa09('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa09('0x13'))('api');var utils=require(_0xfa09('0x14'));var config=require(_0xfa09('0x15'));var licenseUtil=require(_0xfa09('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x301474,_0x1477cd){_0x1477cd=_0x1477cd||0xcc;return function(_0x326fa6){if(_0x326fa6){return _0x301474[_0xfa09('0x17')](_0x1477cd);}return _0x301474['status'](_0x1477cd)['end']();};}function respondWithResult(_0x337102,_0x2f83fc){_0x2f83fc=_0x2f83fc||0xc8;return function(_0x141cb9){if(_0x141cb9){return _0x337102[_0xfa09('0x18')](_0x2f83fc)['json'](_0x141cb9);}};}function respondWithFilteredResult(_0x2fd60c,_0x9dae77){return function(_0xeb6f01){if(_0xeb6f01){var _0x570f16=typeof _0x9dae77[_0xfa09('0x19')]===_0xfa09('0x1a')&&typeof _0x9dae77[_0xfa09('0x1b')]==='undefined';var _0x4de431=_0xeb6f01['count'];var _0x1a7e3a=_0x570f16?0x0:_0x9dae77['offset'];var _0x2d33ed=_0x570f16?_0xeb6f01[_0xfa09('0x1c')]:_0x9dae77[_0xfa09('0x19')]+_0x9dae77['limit'];var _0x4ad636;if(_0x2d33ed>=_0x4de431){_0x2d33ed=_0x4de431;_0x4ad636=0xc8;}else{_0x4ad636=0xce;}_0x2fd60c[_0xfa09('0x18')](_0x4ad636);return _0x2fd60c['set'](_0xfa09('0x1d'),_0x1a7e3a+'-'+_0x2d33ed+'/'+_0x4de431)[_0xfa09('0x1e')](_0xeb6f01);}return null;};}function patchUpdates(_0x3b1ca3){return function(_0x49adf5){try{jsonpatch[_0xfa09('0x1f')](_0x49adf5,_0x3b1ca3,!![]);}catch(_0x5e8eca){return BPromise[_0xfa09('0x20')](_0x5e8eca);}return _0x49adf5[_0xfa09('0x21')]();};}function saveUpdates(_0x26dd61,_0x3ff123){return function(_0x16c873){if(_0x16c873){return _0x16c873[_0xfa09('0x22')](_0x26dd61)[_0xfa09('0x23')](function(_0x3eb308){return _0x3eb308;});}return null;};}function removeEntity(_0x6ac7f7,_0x4652bd){return function(_0x1ed437){if(_0x1ed437){return _0x1ed437[_0xfa09('0x24')]()['then'](function(){_0x6ac7f7[_0xfa09('0x18')](0xcc)[_0xfa09('0x25')]();});}};}function handleEntityNotFound(_0x5b8758,_0x45480a){return function(_0x4116e7){if(!_0x4116e7){_0x5b8758[_0xfa09('0x17')](0x194);}return _0x4116e7;};}function handleError(_0x44825e,_0x1c7b47){_0x1c7b47=_0x1c7b47||0x1f4;return function(_0x5301dd){logger['error'](_0x5301dd[_0xfa09('0x26')]);if(_0x5301dd[_0xfa09('0x27')]){delete _0x5301dd['name'];}_0x44825e['status'](_0x1c7b47)['send'](_0x5301dd);};}exports[_0xfa09('0x28')]=function(_0xf60df7,_0x5e3178){var _0x544144={},_0x1d5d2e={},_0x961dcb={'count':0x0,'rows':[]};var _0x43932d=_[_0xfa09('0x29')](db['ServicenowConfiguration'][_0xfa09('0x2a')],function(_0x132974){return{'name':_0x132974[_0xfa09('0x2b')],'type':_0x132974[_0xfa09('0x2c')][_0xfa09('0x2d')]};});_0x1d5d2e[_0xfa09('0x2e')]=_[_0xfa09('0x29')](_0x43932d,_0xfa09('0x27'));_0x1d5d2e[_0xfa09('0x2f')]=_[_0xfa09('0x30')](_0xf60df7[_0xfa09('0x2f')]);_0x1d5d2e[_0xfa09('0x31')]=_['intersection'](_0x1d5d2e[_0xfa09('0x2e')],_0x1d5d2e[_0xfa09('0x2f')]);_0x544144['attributes']=_[_0xfa09('0x32')](_0x1d5d2e[_0xfa09('0x2e')],qs[_0xfa09('0x33')](_0xf60df7[_0xfa09('0x2f')][_0xfa09('0x33')]));_0x544144[_0xfa09('0x34')]=_0x544144[_0xfa09('0x34')][_0xfa09('0x35')]?_0x544144[_0xfa09('0x34')]:_0x1d5d2e[_0xfa09('0x2e')];if(!_0xf60df7['query'][_0xfa09('0x36')](_0xfa09('0x37'))){_0x544144[_0xfa09('0x1b')]=qs[_0xfa09('0x1b')](_0xf60df7[_0xfa09('0x2f')][_0xfa09('0x1b')]);_0x544144[_0xfa09('0x19')]=qs[_0xfa09('0x19')](_0xf60df7[_0xfa09('0x2f')][_0xfa09('0x19')]);}_0x544144[_0xfa09('0x38')]=qs[_0xfa09('0x39')](_0xf60df7[_0xfa09('0x2f')][_0xfa09('0x39')]);_0x544144[_0xfa09('0x3a')]=qs[_0xfa09('0x31')](_['pick'](_0xf60df7[_0xfa09('0x2f')],_0x1d5d2e[_0xfa09('0x31')]),_0x43932d);if(_0xf60df7[_0xfa09('0x2f')][_0xfa09('0x3b')]){_0x544144[_0xfa09('0x3a')]=_[_0xfa09('0x3c')](_0x544144['where'],{'$or':_['map'](_0x43932d,function(_0x4a38c1){if(_0x4a38c1[_0xfa09('0x2c')]!==_0xfa09('0x3d')){var _0x124650={};_0x124650[_0x4a38c1['name']]={'$like':'%'+_0xf60df7[_0xfa09('0x2f')][_0xfa09('0x3b')]+'%'};return _0x124650;}})});}_0x544144=_[_0xfa09('0x3c')]({},_0x544144,_0xf60df7[_0xfa09('0x3e')]);var _0x1d1bb9={'where':_0x544144[_0xfa09('0x3a')]};return db[_0xfa09('0x3f')][_0xfa09('0x1c')](_0x1d1bb9)['then'](function(_0x341c1a){_0x961dcb['count']=_0x341c1a;if(_0xf60df7['query'][_0xfa09('0x40')]){_0x544144[_0xfa09('0x41')]=[{'all':!![]}];}return db[_0xfa09('0x3f')]['findAll'](_0x544144);})[_0xfa09('0x23')](function(_0x1a7452){_0x961dcb[_0xfa09('0x42')]=_0x1a7452;return _0x961dcb;})['then'](respondWithFilteredResult(_0x5e3178,_0x544144))['catch'](handleError(_0x5e3178,null));};exports['show']=function(_0x56b6ab,_0x4c6afa){var _0x284aeb={'raw':![],'where':{'id':_0x56b6ab[_0xfa09('0x43')]['id']}},_0x44f23e={};_0x44f23e[_0xfa09('0x2e')]=_[_0xfa09('0x30')](db[_0xfa09('0x3f')][_0xfa09('0x2a')]);_0x44f23e[_0xfa09('0x2f')]=_[_0xfa09('0x30')](_0x56b6ab[_0xfa09('0x2f')]);_0x44f23e[_0xfa09('0x31')]=_[_0xfa09('0x32')](_0x44f23e[_0xfa09('0x2e')],_0x44f23e['query']);_0x284aeb[_0xfa09('0x34')]=_['intersection'](_0x44f23e[_0xfa09('0x2e')],qs[_0xfa09('0x33')](_0x56b6ab[_0xfa09('0x2f')]['fields']));_0x284aeb[_0xfa09('0x34')]=_0x284aeb[_0xfa09('0x34')][_0xfa09('0x35')]?_0x284aeb[_0xfa09('0x34')]:_0x44f23e[_0xfa09('0x2e')];if(_0x56b6ab[_0xfa09('0x2f')][_0xfa09('0x40')]){_0x284aeb[_0xfa09('0x41')]=[{'all':!![]}];}_0x284aeb=_[_0xfa09('0x3c')]({},_0x284aeb,_0x56b6ab['options']);return db[_0xfa09('0x3f')]['find'](_0x284aeb)['then'](handleEntityNotFound(_0x4c6afa,null))['then'](respondWithResult(_0x4c6afa,null))['catch'](handleError(_0x4c6afa,null));};exports[_0xfa09('0x44')]=function(_0x214e63,_0x2112b6){return db['ServicenowConfiguration']['create'](_0x214e63[_0xfa09('0x45')],{})[_0xfa09('0x23')](respondWithResult(_0x2112b6,0xc9))[_0xfa09('0x46')](handleError(_0x2112b6,null));};exports[_0xfa09('0x22')]=function(_0x34eeea,_0x5455a9){if(_0x34eeea['body']['id']){delete _0x34eeea[_0xfa09('0x45')]['id'];}return db[_0xfa09('0x3f')]['find']({'where':{'id':_0x34eeea[_0xfa09('0x43')]['id']}})[_0xfa09('0x23')](handleEntityNotFound(_0x5455a9,null))[_0xfa09('0x23')](saveUpdates(_0x34eeea[_0xfa09('0x45')],null))[_0xfa09('0x23')](respondWithResult(_0x5455a9,null))[_0xfa09('0x46')](handleError(_0x5455a9,null));};exports['destroy']=function(_0x419013,_0x2ee799){return db['ServicenowConfiguration']['find']({'where':{'id':_0x419013[_0xfa09('0x43')]['id']}})[_0xfa09('0x23')](handleEntityNotFound(_0x2ee799,null))[_0xfa09('0x23')](removeEntity(_0x2ee799,null))[_0xfa09('0x46')](handleError(_0x2ee799,null));};exports['getFields']=function(_0xf357f4,_0x5d13c5,_0x1aacb9){var _0x5c60a2={};var _0x174f4b={};var _0x52d9bc;var _0x695077;return db[_0xfa09('0x3f')][_0xfa09('0x47')]({'where':{'id':_0xf357f4[_0xfa09('0x43')]['id']}})[_0xfa09('0x23')](handleEntityNotFound(_0x5d13c5,null))[_0xfa09('0x23')](function(_0x402000){if(_0x402000){_0x52d9bc=_0x402000;_0x174f4b['model']=_[_0xfa09('0x30')](db['ServicenowField']['rawAttributes']);_0x174f4b[_0xfa09('0x2f')]=_['keys'](_0xf357f4[_0xfa09('0x2f')]);_0x174f4b[_0xfa09('0x31')]=_[_0xfa09('0x32')](_0x174f4b['model'],_0x174f4b[_0xfa09('0x2f')]);_0x5c60a2['attributes']=_[_0xfa09('0x32')](_0x174f4b[_0xfa09('0x2e')],qs[_0xfa09('0x33')](_0xf357f4[_0xfa09('0x2f')][_0xfa09('0x33')]));_0x5c60a2[_0xfa09('0x34')]=_0x5c60a2[_0xfa09('0x34')][_0xfa09('0x35')]?_0x5c60a2[_0xfa09('0x34')]:_0x174f4b['model'];_0x5c60a2['order']=qs['sort'](_0xf357f4[_0xfa09('0x2f')]['sort']);_0x5c60a2[_0xfa09('0x3a')]=qs[_0xfa09('0x31')](_[_0xfa09('0x48')](_0xf357f4[_0xfa09('0x2f')],_0x174f4b[_0xfa09('0x31')]));if(_0xf357f4['query'][_0xfa09('0x3b')]){_0x5c60a2[_0xfa09('0x3a')]=_[_0xfa09('0x3c')](_0x5c60a2['where'],{'$or':_[_0xfa09('0x29')](_0x5c60a2[_0xfa09('0x34')],function(_0x265f81){var _0x13b4a7={};_0x13b4a7[_0x265f81]={'$like':'%'+_0xf357f4['query'][_0xfa09('0x3b')]+'%'};return _0x13b4a7;})});}_0x5c60a2=_['merge']({},_0x5c60a2,_0xf357f4[_0xfa09('0x3e')]);return _0x52d9bc[_0xfa09('0x49')](_0x5c60a2);}})[_0xfa09('0x23')](function(_0x10d4bb){if(_0x10d4bb){_0x695077=_0x10d4bb[_0xfa09('0x35')];if(!_0xf357f4['query'][_0xfa09('0x36')](_0xfa09('0x37'))){_0x5c60a2[_0xfa09('0x1b')]=qs[_0xfa09('0x1b')](_0xf357f4[_0xfa09('0x2f')]['limit']);_0x5c60a2[_0xfa09('0x19')]=qs[_0xfa09('0x19')](_0xf357f4[_0xfa09('0x2f')][_0xfa09('0x19')]);}return _0x52d9bc[_0xfa09('0x49')](_0x5c60a2);}})[_0xfa09('0x23')](function(_0x3dca73){if(_0x3dca73){return _0x3dca73?{'count':_0x695077,'rows':_0x3dca73}:null;}})[_0xfa09('0x23')](respondWithResult(_0x5d13c5,null))[_0xfa09('0x46')](handleError(_0x5d13c5,null));};exports[_0xfa09('0x4a')]=function(_0x3e0bbc,_0x4bfc7c,_0x4a8c20){var _0x248f76={};var _0x2252cc={};var _0x5bb5f7;var _0x2dd403;return db[_0xfa09('0x3f')][_0xfa09('0x47')]({'where':{'id':_0x3e0bbc[_0xfa09('0x43')]['id']}})[_0xfa09('0x23')](handleEntityNotFound(_0x4bfc7c,null))[_0xfa09('0x23')](function(_0x4b8cd0){if(_0x4b8cd0){_0x5bb5f7=_0x4b8cd0;_0x2252cc[_0xfa09('0x2e')]=_[_0xfa09('0x30')](db[_0xfa09('0x4b')]['rawAttributes']);_0x2252cc[_0xfa09('0x2f')]=_['keys'](_0x3e0bbc[_0xfa09('0x2f')]);_0x2252cc[_0xfa09('0x31')]=_[_0xfa09('0x32')](_0x2252cc['model'],_0x2252cc[_0xfa09('0x2f')]);_0x248f76[_0xfa09('0x34')]=_[_0xfa09('0x32')](_0x2252cc[_0xfa09('0x2e')],qs['fields'](_0x3e0bbc[_0xfa09('0x2f')][_0xfa09('0x33')]));_0x248f76[_0xfa09('0x34')]=_0x248f76[_0xfa09('0x34')][_0xfa09('0x35')]?_0x248f76['attributes']:_0x2252cc[_0xfa09('0x2e')];_0x248f76[_0xfa09('0x38')]=qs['sort'](_0x3e0bbc[_0xfa09('0x2f')][_0xfa09('0x39')]);_0x248f76[_0xfa09('0x3a')]=qs[_0xfa09('0x31')](_[_0xfa09('0x48')](_0x3e0bbc[_0xfa09('0x2f')],_0x2252cc['filters']));if(_0x3e0bbc['query'][_0xfa09('0x3b')]){_0x248f76[_0xfa09('0x3a')]=_[_0xfa09('0x3c')](_0x248f76['where'],{'$or':_['map'](_0x248f76[_0xfa09('0x34')],function(_0x1fecbd){var _0x4bb7d3={};_0x4bb7d3[_0x1fecbd]={'$like':'%'+_0x3e0bbc[_0xfa09('0x2f')][_0xfa09('0x3b')]+'%'};return _0x4bb7d3;})});}_0x248f76=_[_0xfa09('0x3c')]({},_0x248f76,_0x3e0bbc[_0xfa09('0x3e')]);return _0x5bb5f7[_0xfa09('0x4a')](_0x248f76);}})[_0xfa09('0x23')](function(_0x8f5897){if(_0x8f5897){_0x2dd403=_0x8f5897['length'];if(!_0x3e0bbc['query']['hasOwnProperty'](_0xfa09('0x37'))){_0x248f76[_0xfa09('0x1b')]=qs[_0xfa09('0x1b')](_0x3e0bbc[_0xfa09('0x2f')][_0xfa09('0x1b')]);_0x248f76[_0xfa09('0x19')]=qs[_0xfa09('0x19')](_0x3e0bbc[_0xfa09('0x2f')][_0xfa09('0x19')]);}return _0x5bb5f7[_0xfa09('0x4a')](_0x248f76);}})[_0xfa09('0x23')](function(_0xb9f5fa){if(_0xb9f5fa){return _0xb9f5fa?{'count':_0x2dd403,'rows':_0xb9f5fa}:null;}})[_0xfa09('0x23')](respondWithResult(_0x4bfc7c,null))['catch'](handleError(_0x4bfc7c,null));};exports[_0xfa09('0x4c')]=function(_0x3a0dbd,_0xb01476,_0x167d14){var _0x5e52c3={};var _0xce71c4={};var _0x22fc85;var _0x4576a3;return db[_0xfa09('0x3f')][_0xfa09('0x47')]({'where':{'id':_0x3a0dbd['params']['id']}})[_0xfa09('0x23')](handleEntityNotFound(_0xb01476,null))['then'](function(_0x2fa718){if(_0x2fa718){_0x22fc85=_0x2fa718;_0xce71c4[_0xfa09('0x2e')]=_['keys'](db[_0xfa09('0x4b')][_0xfa09('0x2a')]);_0xce71c4[_0xfa09('0x2f')]=_[_0xfa09('0x30')](_0x3a0dbd[_0xfa09('0x2f')]);_0xce71c4[_0xfa09('0x31')]=_[_0xfa09('0x32')](_0xce71c4['model'],_0xce71c4[_0xfa09('0x2f')]);_0x5e52c3['attributes']=_[_0xfa09('0x32')](_0xce71c4[_0xfa09('0x2e')],qs[_0xfa09('0x33')](_0x3a0dbd[_0xfa09('0x2f')][_0xfa09('0x33')]));_0x5e52c3[_0xfa09('0x34')]=_0x5e52c3[_0xfa09('0x34')][_0xfa09('0x35')]?_0x5e52c3[_0xfa09('0x34')]:_0xce71c4[_0xfa09('0x2e')];_0x5e52c3['order']=qs[_0xfa09('0x39')](_0x3a0dbd[_0xfa09('0x2f')][_0xfa09('0x39')]);_0x5e52c3['where']=qs['filters'](_[_0xfa09('0x48')](_0x3a0dbd['query'],_0xce71c4[_0xfa09('0x31')]));if(_0x3a0dbd[_0xfa09('0x2f')][_0xfa09('0x3b')]){_0x5e52c3[_0xfa09('0x3a')]=_[_0xfa09('0x3c')](_0x5e52c3['where'],{'$or':_[_0xfa09('0x29')](_0x5e52c3['attributes'],function(_0x321561){var _0x3381d1={};_0x3381d1[_0x321561]={'$like':'%'+_0x3a0dbd['query']['filter']+'%'};return _0x3381d1;})});}_0x5e52c3=_[_0xfa09('0x3c')]({},_0x5e52c3,_0x3a0dbd[_0xfa09('0x3e')]);return _0x22fc85[_0xfa09('0x4c')](_0x5e52c3);}})['then'](function(_0x2d632d){if(_0x2d632d){_0x4576a3=_0x2d632d[_0xfa09('0x35')];if(!_0x3a0dbd[_0xfa09('0x2f')][_0xfa09('0x36')]('nolimit')){_0x5e52c3[_0xfa09('0x1b')]=qs['limit'](_0x3a0dbd[_0xfa09('0x2f')]['limit']);_0x5e52c3[_0xfa09('0x19')]=qs[_0xfa09('0x19')](_0x3a0dbd[_0xfa09('0x2f')]['offset']);}return _0x22fc85[_0xfa09('0x4c')](_0x5e52c3);}})[_0xfa09('0x23')](function(_0x31341c){if(_0x31341c){return _0x31341c?{'count':_0x4576a3,'rows':_0x31341c}:null;}})[_0xfa09('0x23')](respondWithResult(_0xb01476,null))['catch'](handleError(_0xb01476,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4288963..5caf2cc 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 _0xb627=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x49a26b,_0x47331d){var _0x5b5f0b=function(_0x59a76b){while(--_0x59a76b){_0x49a26b['push'](_0x49a26b['shift']());}};_0x5b5f0b(++_0x47331d);}(_0xb627,0x144));var _0x7b62=function(_0x2ece1c,_0x40f0fc){_0x2ece1c=_0x2ece1c-0x0;var _0x43a849=_0xb627[_0x2ece1c];return _0x43a849;};'use strict';var _=require(_0x7b62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7b62('0x1'));var moment=require('moment');var BPromise=require(_0x7b62('0x2'));var rp=require(_0x7b62('0x3'));var fs=require('fs');var path=require(_0x7b62('0x4'));var rimraf=require(_0x7b62('0x5'));var config=require(_0x7b62('0x6'));var attributes=require(_0x7b62('0x7'));module[_0x7b62('0x8')]=function(_0x4ad3e8,_0x71aec9){return _0x4ad3e8['define'](_0x7b62('0x9'),attributes,{'tableName':_0x7b62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2af=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x31d5df,_0x46dbe2){var _0x8fa63a=function(_0x3bc291){while(--_0x3bc291){_0x31d5df['push'](_0x31d5df['shift']());}};_0x8fa63a(++_0x46dbe2);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x11076a,_0x5e9f37){_0x11076a=_0x11076a-0x0;var _0x31ca92=_0xc2af[_0x11076a];return _0x31ca92;};'use strict';var _=require(_0xfc2a('0x0'));var util=require('util');var logger=require(_0xfc2a('0x1'))('api');var moment=require(_0xfc2a('0x2'));var BPromise=require(_0xfc2a('0x3'));var rp=require(_0xfc2a('0x4'));var fs=require('fs');var path=require(_0xfc2a('0x5'));var rimraf=require(_0xfc2a('0x6'));var config=require(_0xfc2a('0x7'));var attributes=require(_0xfc2a('0x8'));module[_0xfc2a('0x9')]=function(_0x4e2d6b,_0x40f855){return _0x4e2d6b['define'](_0xfc2a('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 3f1332d..36d85cf 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 _0x96e8=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x469ce9,_0x484656){var _0xd263d=function(_0x3a731c){while(--_0x3a731c){_0x469ce9['push'](_0x469ce9['shift']());}};_0xd263d(++_0x484656);}(_0x96e8,0x99));var _0x896e=function(_0xa3b39f,_0x1f6984){_0xa3b39f=_0xa3b39f-0x0;var _0x2337b7=_0x96e8[_0xa3b39f];return _0x2337b7;};'use strict';var _=require(_0x896e('0x0'));var util=require(_0x896e('0x1'));var moment=require(_0x896e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x896e('0x3'));var db=require(_0x896e('0x4'))['db'];var utils=require(_0x896e('0x5'));var logger=require(_0x896e('0x6'))(_0x896e('0x7'));var config=require(_0x896e('0x8'));var jayson=require(_0x896e('0x9'));var client=jayson[_0x896e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29dac4,_0x455a76,_0x148d7b){return new BPromise(function(_0x5943b2,_0x2277cf){return client[_0x896e('0xb')](_0x29dac4,_0x148d7b)[_0x896e('0xc')](function(_0x3b4ed3){logger[_0x896e('0xd')](_0x896e('0xe'),_0x455a76,'request\x20sent');logger[_0x896e('0xf')](_0x896e('0x10'),_0x455a76,_0x896e('0x11'),JSON[_0x896e('0x12')](_0x3b4ed3));if(_0x3b4ed3[_0x896e('0x13')]){if(_0x3b4ed3[_0x896e('0x13')]['code']===0x1f4){logger['error'](_0x896e('0xe'),_0x455a76,_0x3b4ed3[_0x896e('0x13')]['message']);return _0x2277cf(_0x3b4ed3['error'][_0x896e('0x14')]);}logger[_0x896e('0x13')](_0x896e('0xe'),_0x455a76,_0x3b4ed3[_0x896e('0x13')][_0x896e('0x14')]);return _0x5943b2(_0x3b4ed3[_0x896e('0x13')]['message']);}else{logger[_0x896e('0xd')](_0x896e('0xe'),_0x455a76,'request\x20sent');_0x5943b2(_0x3b4ed3[_0x896e('0x15')][_0x896e('0x14')]);}})['catch'](function(_0x54a069){logger[_0x896e('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x455a76,_0x54a069);_0x2277cf(_0x54a069);});});} \ No newline at end of file +var _0x0aba=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3ec8d7,_0x271fd1){var _0x55d99f=function(_0x323931){while(--_0x323931){_0x3ec8d7['push'](_0x3ec8d7['shift']());}};_0x55d99f(++_0x271fd1);}(_0x0aba,0x11d));var _0xa0ab=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x0aba[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0xa0ab('0x0'));var util=require('util');var moment=require(_0xa0ab('0x1'));var BPromise=require(_0xa0ab('0x2'));var rs=require(_0xa0ab('0x3'));var fs=require('fs');var Redis=require(_0xa0ab('0x4'));var db=require(_0xa0ab('0x5'))['db'];var utils=require(_0xa0ab('0x6'));var logger=require(_0xa0ab('0x7'))('rpc');var config=require(_0xa0ab('0x8'));var jayson=require(_0xa0ab('0x9'));var client=jayson[_0xa0ab('0xa')][_0xa0ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58b161,_0x523fd2,_0x11054e){return new BPromise(function(_0x3b10ee,_0x481985){return client[_0xa0ab('0xc')](_0x58b161,_0x11054e)[_0xa0ab('0xd')](function(_0x3b4c87){logger[_0xa0ab('0xe')](_0xa0ab('0xf'),_0x523fd2,'request\x20sent');logger[_0xa0ab('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x523fd2,_0xa0ab('0x11'),JSON[_0xa0ab('0x12')](_0x3b4c87));if(_0x3b4c87[_0xa0ab('0x13')]){if(_0x3b4c87[_0xa0ab('0x13')]['code']===0x1f4){logger[_0xa0ab('0x13')](_0xa0ab('0xf'),_0x523fd2,_0x3b4c87[_0xa0ab('0x13')]['message']);return _0x481985(_0x3b4c87[_0xa0ab('0x13')][_0xa0ab('0x14')]);}logger[_0xa0ab('0x13')](_0xa0ab('0xf'),_0x523fd2,_0x3b4c87['error'][_0xa0ab('0x14')]);return _0x3b10ee(_0x3b4c87[_0xa0ab('0x13')][_0xa0ab('0x14')]);}else{logger[_0xa0ab('0xe')](_0xa0ab('0xf'),_0x523fd2,_0xa0ab('0x11'));_0x3b10ee(_0x3b4c87[_0xa0ab('0x15')][_0xa0ab('0x14')]);}})[_0xa0ab('0x16')](function(_0x507567){logger['error'](_0xa0ab('0xf'),_0x523fd2,_0x507567);_0x481985(_0x507567);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c01838e..dfdb884 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 _0xf621=['create','update','delete','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show'];(function(_0x59f4ed,_0x51873a){var _0x2faaf0=function(_0x56d13a){while(--_0x56d13a){_0x59f4ed['push'](_0x59f4ed['shift']());}};_0x2faaf0(++_0x51873a);}(_0xf621,0x74));var _0x1f62=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xf621[_0x134827];return _0x366671;};'use strict';var multer=require('multer');var util=require(_0x1f62('0x0'));var path=require(_0x1f62('0x1'));var timeout=require(_0x1f62('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1f62('0x3'));var interaction=require(_0x1f62('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x1f62('0x5')]('/',auth['isAuthenticated'](),controller[_0x1f62('0x6')]);router[_0x1f62('0x5')](_0x1f62('0x7'),auth[_0x1f62('0x8')](),controller[_0x1f62('0x9')]);router['post']('/',auth[_0x1f62('0x8')](),controller[_0x1f62('0xa')]);router['put'](_0x1f62('0x7'),auth['isAuthenticated'](),controller[_0x1f62('0xb')]);router[_0x1f62('0xc')](_0x1f62('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x1f62('0xd')]=router; \ No newline at end of file +var _0xe243=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0xe243,0x134));var _0x3e24=function(_0x53b37c,_0x1e3dae){_0x53b37c=_0x53b37c-0x0;var _0x912a5=_0xe243[_0x53b37c];return _0x912a5;};'use strict';var multer=require(_0x3e24('0x0'));var util=require(_0x3e24('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3e24('0x2'));var router=express[_0x3e24('0x3')]();var fs_extra=require(_0x3e24('0x4'));var auth=require(_0x3e24('0x5'));var interaction=require(_0x3e24('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x3e24('0x7')]('/',auth['isAuthenticated'](),controller[_0x3e24('0x8')]);router[_0x3e24('0x7')](_0x3e24('0x9'),auth['isAuthenticated'](),controller[_0x3e24('0xa')]);router[_0x3e24('0xb')]('/',auth[_0x3e24('0xc')](),controller[_0x3e24('0xd')]);router[_0x3e24('0xe')]('/:id',auth[_0x3e24('0xc')](),controller[_0x3e24('0xf')]);router['delete'](_0x3e24('0x9'),auth[_0x3e24('0xc')](),controller[_0x3e24('0x10')]);module[_0x3e24('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index d48c8e2..1e0691c 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 _0xde05=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x1e00a5,_0x4b8641){var _0x2096c9=function(_0x45f79a){while(--_0x45f79a){_0x1e00a5['push'](_0x1e00a5['shift']());}};_0x2096c9(++_0x4b8641);}(_0xde05,0x157));var _0x5de0=function(_0x22698f,_0x8c8e02){_0x22698f=_0x22698f-0x0;var _0x414f3e=_0xde05[_0x22698f];return _0x414f3e;};'use strict';var Sequelize=require(_0x5de0('0x0'));module[_0x5de0('0x1')]={'type':{'type':Sequelize[_0x5de0('0x2')]('string',_0x5de0('0x3'),_0x5de0('0x4'),_0x5de0('0x5'),_0x5de0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5de0('0x7')]},'key':{'type':Sequelize[_0x5de0('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5de0('0x8'),_0x5de0('0x3'),_0x5de0('0x4'))},'keyContent':{'type':Sequelize[_0x5de0('0x7')]},'idField':{'type':Sequelize[_0x5de0('0x7')]},'nameField':{'type':Sequelize[_0x5de0('0x7')]},'customField':{'type':Sequelize[_0x5de0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5de0('0x7')]}}; \ No newline at end of file +var _0xe371=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x593ddc,_0x51aa71){var _0xa58a2c=function(_0x1f3d4b){while(--_0x1f3d4b){_0x593ddc['push'](_0x593ddc['shift']());}};_0xa58a2c(++_0x51aa71);}(_0xe371,0x132));var _0x1e37=function(_0xcf8d11,_0x5ec02f){_0xcf8d11=_0xcf8d11-0x0;var _0x3966b3=_0xe371[_0xcf8d11];return _0x3966b3;};'use strict';var Sequelize=require(_0x1e37('0x0'));module[_0x1e37('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1e37('0x2'),_0x1e37('0x3'),_0x1e37('0x4'),_0x1e37('0x5'),'picklist'),'defaultValue':_0x1e37('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1e37('0x2'),_0x1e37('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1e37('0x6')]},'idField':{'type':Sequelize[_0x1e37('0x6')]},'nameField':{'type':Sequelize[_0x1e37('0x6')]},'customField':{'type':Sequelize[_0x1e37('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e37('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b3e7047..ba73a8a 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 _0x13d4=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','type','filter','merge','options','count','include','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','ServicenowField'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x13d4,0xa5));var _0x413d=function(_0x4adead,_0x2d4e63){_0x4adead=_0x4adead-0x0;var _0x9912a=_0x13d4[_0x4adead];return _0x9912a;};'use strict';var emlformat=require(_0x413d('0x0'));var rimraf=require(_0x413d('0x1'));var zipdir=require(_0x413d('0x2'));var jsonpatch=require(_0x413d('0x3'));var rp=require(_0x413d('0x4'));var moment=require(_0x413d('0x5'));var BPromise=require(_0x413d('0x6'));var Mustache=require('mustache');var util=require(_0x413d('0x7'));var path=require(_0x413d('0x8'));var sox=require('sox');var csv=require(_0x413d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x413d('0xa'));var crypto=require(_0x413d('0xb'));var jsforce=require(_0x413d('0xc'));var deskjs=require(_0x413d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x413d('0xe'));var Redis=require(_0x413d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x413d('0x10'));var as=require(_0x413d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x413d('0x12'));var utils=require(_0x413d('0x13'));var config=require(_0x413d('0x14'));var licenseUtil=require(_0x413d('0x15'));var db=require(_0x413d('0x16'))['db'];function respondWithStatusCode(_0x17e1b4,_0xa7758a){_0xa7758a=_0xa7758a||0xcc;return function(_0x4b14bf){if(_0x4b14bf){return _0x17e1b4[_0x413d('0x17')](_0xa7758a);}return _0x17e1b4[_0x413d('0x18')](_0xa7758a)[_0x413d('0x19')]();};}function respondWithResult(_0x31ec00,_0x2dded9){_0x2dded9=_0x2dded9||0xc8;return function(_0x560564){if(_0x560564){return _0x31ec00[_0x413d('0x18')](_0x2dded9)[_0x413d('0x1a')](_0x560564);}};}function respondWithFilteredResult(_0x2ecf40,_0x3c0db3){return function(_0x3e52af){if(_0x3e52af){var _0x19dcb9=typeof _0x3c0db3[_0x413d('0x1b')]===_0x413d('0x1c')&&typeof _0x3c0db3[_0x413d('0x1d')]===_0x413d('0x1c');var _0x33a023=_0x3e52af['count'];var _0x17c1ae=_0x19dcb9?0x0:_0x3c0db3[_0x413d('0x1b')];var _0xf92b52=_0x19dcb9?_0x3e52af['count']:_0x3c0db3[_0x413d('0x1b')]+_0x3c0db3['limit'];var _0x54050b;if(_0xf92b52>=_0x33a023){_0xf92b52=_0x33a023;_0x54050b=0xc8;}else{_0x54050b=0xce;}_0x2ecf40[_0x413d('0x18')](_0x54050b);return _0x2ecf40['set'](_0x413d('0x1e'),_0x17c1ae+'-'+_0xf92b52+'/'+_0x33a023)[_0x413d('0x1a')](_0x3e52af);}return null;};}function patchUpdates(_0x24b727){return function(_0x597e4c){try{jsonpatch[_0x413d('0x1f')](_0x597e4c,_0x24b727,!![]);}catch(_0x65e0c4){return BPromise[_0x413d('0x20')](_0x65e0c4);}return _0x597e4c[_0x413d('0x21')]();};}function saveUpdates(_0x2cd3a0,_0x1cf346){return function(_0x5c9a41){if(_0x5c9a41){return _0x5c9a41[_0x413d('0x22')](_0x2cd3a0)['then'](function(_0x3315f1){return _0x3315f1;});}return null;};}function removeEntity(_0x563b22,_0x2a21f1){return function(_0x804455){if(_0x804455){return _0x804455[_0x413d('0x23')]()[_0x413d('0x24')](function(){_0x563b22[_0x413d('0x18')](0xcc)[_0x413d('0x19')]();});}};}function handleEntityNotFound(_0x16ec76,_0x4c3c7e){return function(_0x29d15f){if(!_0x29d15f){_0x16ec76[_0x413d('0x17')](0x194);}return _0x29d15f;};}function handleError(_0x3dd474,_0x147a33){_0x147a33=_0x147a33||0x1f4;return function(_0x88cebf){logger['error'](_0x88cebf[_0x413d('0x25')]);if(_0x88cebf[_0x413d('0x26')]){delete _0x88cebf['name'];}_0x3dd474[_0x413d('0x18')](_0x147a33)[_0x413d('0x27')](_0x88cebf);};}exports['index']=function(_0x658cbd,_0x56d617){var _0x452bce={},_0x4b9f71={},_0x5abd66={'count':0x0,'rows':[]};var _0x369389=_[_0x413d('0x28')](db[_0x413d('0x29')][_0x413d('0x2a')],function(_0x5d6d29){return{'name':_0x5d6d29[_0x413d('0x2b')],'type':_0x5d6d29['type'][_0x413d('0x2c')]};});_0x4b9f71[_0x413d('0x2d')]=_[_0x413d('0x28')](_0x369389,'name');_0x4b9f71[_0x413d('0x2e')]=_[_0x413d('0x2f')](_0x658cbd['query']);_0x4b9f71['filters']=_[_0x413d('0x30')](_0x4b9f71['model'],_0x4b9f71['query']);_0x452bce['attributes']=_[_0x413d('0x30')](_0x4b9f71[_0x413d('0x2d')],qs[_0x413d('0x31')](_0x658cbd[_0x413d('0x2e')]['fields']));_0x452bce[_0x413d('0x32')]=_0x452bce[_0x413d('0x32')][_0x413d('0x33')]?_0x452bce[_0x413d('0x32')]:_0x4b9f71['model'];if(!_0x658cbd[_0x413d('0x2e')]['hasOwnProperty'](_0x413d('0x34'))){_0x452bce['limit']=qs[_0x413d('0x1d')](_0x658cbd[_0x413d('0x2e')][_0x413d('0x1d')]);_0x452bce[_0x413d('0x1b')]=qs[_0x413d('0x1b')](_0x658cbd[_0x413d('0x2e')][_0x413d('0x1b')]);}_0x452bce[_0x413d('0x35')]=qs[_0x413d('0x36')](_0x658cbd['query']['sort']);_0x452bce[_0x413d('0x37')]=qs[_0x413d('0x38')](_[_0x413d('0x39')](_0x658cbd[_0x413d('0x2e')],_0x4b9f71[_0x413d('0x38')]),_0x369389);if(_0x658cbd[_0x413d('0x2e')]['filter']){_0x452bce[_0x413d('0x37')]=_['merge'](_0x452bce[_0x413d('0x37')],{'$or':_['map'](_0x369389,function(_0x41815a){if(_0x41815a[_0x413d('0x3a')]!=='VIRTUAL'){var _0x1a589b={};_0x1a589b[_0x41815a[_0x413d('0x26')]]={'$like':'%'+_0x658cbd['query'][_0x413d('0x3b')]+'%'};return _0x1a589b;}})});}_0x452bce=_[_0x413d('0x3c')]({},_0x452bce,_0x658cbd[_0x413d('0x3d')]);var _0x55016a={'where':_0x452bce['where']};return db[_0x413d('0x29')][_0x413d('0x3e')](_0x55016a)[_0x413d('0x24')](function(_0x339c1b){_0x5abd66[_0x413d('0x3e')]=_0x339c1b;if(_0x658cbd[_0x413d('0x2e')]['includeAll']){_0x452bce[_0x413d('0x3f')]=[{'all':!![]}];}return db[_0x413d('0x29')]['findAll'](_0x452bce);})[_0x413d('0x24')](function(_0x3e2cbc){_0x5abd66['rows']=_0x3e2cbc;return _0x5abd66;})['then'](respondWithFilteredResult(_0x56d617,_0x452bce))['catch'](handleError(_0x56d617,null));};exports['show']=function(_0x10bee0,_0x3d2960){var _0x1ab141={'raw':!![],'where':{'id':_0x10bee0[_0x413d('0x40')]['id']}},_0x4649ff={};_0x4649ff[_0x413d('0x2d')]=_[_0x413d('0x2f')](db[_0x413d('0x29')][_0x413d('0x2a')]);_0x4649ff[_0x413d('0x2e')]=_[_0x413d('0x2f')](_0x10bee0[_0x413d('0x2e')]);_0x4649ff[_0x413d('0x38')]=_[_0x413d('0x30')](_0x4649ff[_0x413d('0x2d')],_0x4649ff[_0x413d('0x2e')]);_0x1ab141[_0x413d('0x32')]=_[_0x413d('0x30')](_0x4649ff['model'],qs['fields'](_0x10bee0[_0x413d('0x2e')][_0x413d('0x31')]));_0x1ab141[_0x413d('0x32')]=_0x1ab141[_0x413d('0x32')][_0x413d('0x33')]?_0x1ab141[_0x413d('0x32')]:_0x4649ff[_0x413d('0x2d')];if(_0x10bee0[_0x413d('0x2e')]['includeAll']){_0x1ab141[_0x413d('0x3f')]=[{'all':!![]}];}_0x1ab141=_[_0x413d('0x3c')]({},_0x1ab141,_0x10bee0[_0x413d('0x3d')]);return db['ServicenowField'][_0x413d('0x41')](_0x1ab141)[_0x413d('0x24')](handleEntityNotFound(_0x3d2960,null))['then'](respondWithResult(_0x3d2960,null))[_0x413d('0x42')](handleError(_0x3d2960,null));};exports[_0x413d('0x43')]=function(_0x26c01b,_0x2761f9){return db[_0x413d('0x29')][_0x413d('0x43')](_0x26c01b['body'],{})[_0x413d('0x24')](respondWithResult(_0x2761f9,0xc9))['catch'](handleError(_0x2761f9,null));};exports[_0x413d('0x22')]=function(_0x103493,_0x396ff9){if(_0x103493['body']['id']){delete _0x103493['body']['id'];}return db[_0x413d('0x29')]['find']({'where':{'id':_0x103493[_0x413d('0x40')]['id']}})[_0x413d('0x24')](handleEntityNotFound(_0x396ff9,null))[_0x413d('0x24')](saveUpdates(_0x103493[_0x413d('0x44')],null))['then'](respondWithResult(_0x396ff9,null))['catch'](handleError(_0x396ff9,null));};exports[_0x413d('0x23')]=function(_0x25f4be,_0x3254b0){return db[_0x413d('0x29')][_0x413d('0x41')]({'where':{'id':_0x25f4be[_0x413d('0x40')]['id']}})['then'](handleEntityNotFound(_0x3254b0,null))[_0x413d('0x24')](removeEntity(_0x3254b0,null))[_0x413d('0x42')](handleError(_0x3254b0,null));}; \ No newline at end of file +var _0xa878=['rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','filters','filter','merge','includeAll','include','rows','catch','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','ServicenowField'];(function(_0x1a5792,_0x266f94){var _0x3a65e6=function(_0x561500){while(--_0x561500){_0x1a5792['push'](_0x1a5792['shift']());}};_0x3a65e6(++_0x266f94);}(_0xa878,0xb4));var _0x8a87=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa878[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x8a87('0x0'));var rimraf=require(_0x8a87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a87('0x2'));var rp=require(_0x8a87('0x3'));var moment=require(_0x8a87('0x4'));var BPromise=require(_0x8a87('0x5'));var Mustache=require(_0x8a87('0x6'));var util=require(_0x8a87('0x7'));var path=require(_0x8a87('0x8'));var sox=require(_0x8a87('0x9'));var csv=require(_0x8a87('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a87('0xb'));var _=require(_0x8a87('0xc'));var squel=require(_0x8a87('0xd'));var crypto=require('crypto');var jsforce=require(_0x8a87('0xe'));var deskjs=require(_0x8a87('0xf'));var toCsv=require(_0x8a87('0xa'));var querystring=require(_0x8a87('0x10'));var Papa=require(_0x8a87('0x11'));var Redis=require('ioredis');var authService=require(_0x8a87('0x12'));var qs=require(_0x8a87('0x13'));var as=require(_0x8a87('0x14'));var hardwareService=require(_0x8a87('0x15'));var logger=require('../../config/logger')(_0x8a87('0x16'));var utils=require(_0x8a87('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a87('0x18'));var db=require(_0x8a87('0x19'))['db'];function respondWithStatusCode(_0x50a65d,_0x137ed3){_0x137ed3=_0x137ed3||0xcc;return function(_0x13569f){if(_0x13569f){return _0x50a65d['sendStatus'](_0x137ed3);}return _0x50a65d[_0x8a87('0x1a')](_0x137ed3)[_0x8a87('0x1b')]();};}function respondWithResult(_0x141592,_0x11c095){_0x11c095=_0x11c095||0xc8;return function(_0x5a19c2){if(_0x5a19c2){return _0x141592['status'](_0x11c095)[_0x8a87('0x1c')](_0x5a19c2);}};}function respondWithFilteredResult(_0x13a338,_0x47db02){return function(_0x59ac3f){if(_0x59ac3f){var _0x486814=typeof _0x47db02['offset']===_0x8a87('0x1d')&&typeof _0x47db02[_0x8a87('0x1e')]==='undefined';var _0x401f2b=_0x59ac3f[_0x8a87('0x1f')];var _0x39740f=_0x486814?0x0:_0x47db02['offset'];var _0x322619=_0x486814?_0x59ac3f[_0x8a87('0x1f')]:_0x47db02['offset']+_0x47db02[_0x8a87('0x1e')];var _0x55e0d9;if(_0x322619>=_0x401f2b){_0x322619=_0x401f2b;_0x55e0d9=0xc8;}else{_0x55e0d9=0xce;}_0x13a338[_0x8a87('0x1a')](_0x55e0d9);return _0x13a338[_0x8a87('0x20')](_0x8a87('0x21'),_0x39740f+'-'+_0x322619+'/'+_0x401f2b)[_0x8a87('0x1c')](_0x59ac3f);}return null;};}function patchUpdates(_0x253c8e){return function(_0x5759b7){try{jsonpatch[_0x8a87('0x22')](_0x5759b7,_0x253c8e,!![]);}catch(_0xfba4a9){return BPromise['reject'](_0xfba4a9);}return _0x5759b7[_0x8a87('0x23')]();};}function saveUpdates(_0x4e952a,_0x394997){return function(_0x29caa1){if(_0x29caa1){return _0x29caa1['update'](_0x4e952a)[_0x8a87('0x24')](function(_0x30431a){return _0x30431a;});}return null;};}function removeEntity(_0x1b3edf,_0x44addd){return function(_0x4dd043){if(_0x4dd043){return _0x4dd043[_0x8a87('0x25')]()[_0x8a87('0x24')](function(){_0x1b3edf[_0x8a87('0x1a')](0xcc)[_0x8a87('0x1b')]();});}};}function handleEntityNotFound(_0xe1fee5,_0x32d848){return function(_0xcfcb5a){if(!_0xcfcb5a){_0xe1fee5[_0x8a87('0x26')](0x194);}return _0xcfcb5a;};}function handleError(_0x3488c8,_0x1bf28d){_0x1bf28d=_0x1bf28d||0x1f4;return function(_0x32c9e2){logger[_0x8a87('0x27')](_0x32c9e2[_0x8a87('0x28')]);if(_0x32c9e2[_0x8a87('0x29')]){delete _0x32c9e2[_0x8a87('0x29')];}_0x3488c8[_0x8a87('0x1a')](_0x1bf28d)[_0x8a87('0x2a')](_0x32c9e2);};}exports[_0x8a87('0x2b')]=function(_0x796dc6,_0x559884){var _0x4394a0={},_0x3dae76={},_0x4cc683={'count':0x0,'rows':[]};var _0x1779c=_['map'](db[_0x8a87('0x2c')][_0x8a87('0x2d')],function(_0x21200e){return{'name':_0x21200e[_0x8a87('0x2e')],'type':_0x21200e[_0x8a87('0x2f')][_0x8a87('0x30')]};});_0x3dae76[_0x8a87('0x31')]=_[_0x8a87('0x32')](_0x1779c,_0x8a87('0x29'));_0x3dae76[_0x8a87('0x33')]=_[_0x8a87('0x34')](_0x796dc6[_0x8a87('0x33')]);_0x3dae76['filters']=_[_0x8a87('0x35')](_0x3dae76['model'],_0x3dae76[_0x8a87('0x33')]);_0x4394a0['attributes']=_[_0x8a87('0x35')](_0x3dae76[_0x8a87('0x31')],qs[_0x8a87('0x36')](_0x796dc6['query'][_0x8a87('0x36')]));_0x4394a0[_0x8a87('0x37')]=_0x4394a0[_0x8a87('0x37')][_0x8a87('0x38')]?_0x4394a0[_0x8a87('0x37')]:_0x3dae76[_0x8a87('0x31')];if(!_0x796dc6[_0x8a87('0x33')]['hasOwnProperty'](_0x8a87('0x39'))){_0x4394a0[_0x8a87('0x1e')]=qs[_0x8a87('0x1e')](_0x796dc6[_0x8a87('0x33')][_0x8a87('0x1e')]);_0x4394a0[_0x8a87('0x3a')]=qs[_0x8a87('0x3a')](_0x796dc6['query'][_0x8a87('0x3a')]);}_0x4394a0[_0x8a87('0x3b')]=qs['sort'](_0x796dc6[_0x8a87('0x33')][_0x8a87('0x3c')]);_0x4394a0[_0x8a87('0x3d')]=qs['filters'](_[_0x8a87('0x3e')](_0x796dc6[_0x8a87('0x33')],_0x3dae76[_0x8a87('0x3f')]),_0x1779c);if(_0x796dc6[_0x8a87('0x33')][_0x8a87('0x40')]){_0x4394a0[_0x8a87('0x3d')]=_['merge'](_0x4394a0[_0x8a87('0x3d')],{'$or':_[_0x8a87('0x32')](_0x1779c,function(_0x2931d0){if(_0x2931d0['type']!=='VIRTUAL'){var _0x349260={};_0x349260[_0x2931d0[_0x8a87('0x29')]]={'$like':'%'+_0x796dc6[_0x8a87('0x33')][_0x8a87('0x40')]+'%'};return _0x349260;}})});}_0x4394a0=_[_0x8a87('0x41')]({},_0x4394a0,_0x796dc6['options']);var _0x33cfff={'where':_0x4394a0[_0x8a87('0x3d')]};return db[_0x8a87('0x2c')][_0x8a87('0x1f')](_0x33cfff)[_0x8a87('0x24')](function(_0xf1519b){_0x4cc683['count']=_0xf1519b;if(_0x796dc6[_0x8a87('0x33')][_0x8a87('0x42')]){_0x4394a0[_0x8a87('0x43')]=[{'all':!![]}];}return db[_0x8a87('0x2c')]['findAll'](_0x4394a0);})[_0x8a87('0x24')](function(_0x301a2a){_0x4cc683[_0x8a87('0x44')]=_0x301a2a;return _0x4cc683;})[_0x8a87('0x24')](respondWithFilteredResult(_0x559884,_0x4394a0))[_0x8a87('0x45')](handleError(_0x559884,null));};exports['show']=function(_0x4bae68,_0x1787d9){var _0x3c7588={'raw':!![],'where':{'id':_0x4bae68[_0x8a87('0x46')]['id']}},_0x1b12ce={};_0x1b12ce[_0x8a87('0x31')]=_[_0x8a87('0x34')](db[_0x8a87('0x2c')][_0x8a87('0x2d')]);_0x1b12ce['query']=_[_0x8a87('0x34')](_0x4bae68[_0x8a87('0x33')]);_0x1b12ce[_0x8a87('0x3f')]=_[_0x8a87('0x35')](_0x1b12ce['model'],_0x1b12ce[_0x8a87('0x33')]);_0x3c7588[_0x8a87('0x37')]=_['intersection'](_0x1b12ce['model'],qs['fields'](_0x4bae68[_0x8a87('0x33')][_0x8a87('0x36')]));_0x3c7588[_0x8a87('0x37')]=_0x3c7588[_0x8a87('0x37')]['length']?_0x3c7588['attributes']:_0x1b12ce[_0x8a87('0x31')];if(_0x4bae68[_0x8a87('0x33')][_0x8a87('0x42')]){_0x3c7588[_0x8a87('0x43')]=[{'all':!![]}];}_0x3c7588=_[_0x8a87('0x41')]({},_0x3c7588,_0x4bae68['options']);return db[_0x8a87('0x2c')][_0x8a87('0x47')](_0x3c7588)[_0x8a87('0x24')](handleEntityNotFound(_0x1787d9,null))[_0x8a87('0x24')](respondWithResult(_0x1787d9,null))[_0x8a87('0x45')](handleError(_0x1787d9,null));};exports['create']=function(_0x359c4c,_0x5eec23){return db[_0x8a87('0x2c')][_0x8a87('0x48')](_0x359c4c[_0x8a87('0x49')],{})[_0x8a87('0x24')](respondWithResult(_0x5eec23,0xc9))[_0x8a87('0x45')](handleError(_0x5eec23,null));};exports[_0x8a87('0x4a')]=function(_0x5b1940,_0x184996){if(_0x5b1940[_0x8a87('0x49')]['id']){delete _0x5b1940[_0x8a87('0x49')]['id'];}return db[_0x8a87('0x2c')][_0x8a87('0x47')]({'where':{'id':_0x5b1940[_0x8a87('0x46')]['id']}})['then'](handleEntityNotFound(_0x184996,null))[_0x8a87('0x24')](saveUpdates(_0x5b1940[_0x8a87('0x49')],null))[_0x8a87('0x24')](respondWithResult(_0x184996,null))[_0x8a87('0x45')](handleError(_0x184996,null));};exports[_0x8a87('0x25')]=function(_0x3c2688,_0x5bbd10){return db[_0x8a87('0x2c')][_0x8a87('0x47')]({'where':{'id':_0x3c2688[_0x8a87('0x46')]['id']}})[_0x8a87('0x24')](handleEntityNotFound(_0x5bbd10,null))[_0x8a87('0x24')](removeEntity(_0x5bbd10,null))[_0x8a87('0x45')](handleError(_0x5bbd10,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c0b62a3..73efe48 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 _0xc0cd=['int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define'];(function(_0x41dac9,_0xd7025e){var _0x58878f=function(_0x5cf38e){while(--_0x5cf38e){_0x41dac9['push'](_0x41dac9['shift']());}};_0x58878f(++_0xd7025e);}(_0xc0cd,0x7b));var _0xdc0c=function(_0x2a4fa8,_0x4096e2){_0x2a4fa8=_0x2a4fa8-0x0;var _0x1ee7d5=_0xc0cd[_0x2a4fa8];return _0x1ee7d5;};'use strict';var _=require(_0xdc0c('0x0'));var util=require(_0xdc0c('0x1'));var logger=require(_0xdc0c('0x2'))(_0xdc0c('0x3'));var moment=require(_0xdc0c('0x4'));var BPromise=require(_0xdc0c('0x5'));var rp=require(_0xdc0c('0x6'));var fs=require('fs');var path=require(_0xdc0c('0x7'));var rimraf=require(_0xdc0c('0x8'));var config=require(_0xdc0c('0x9'));var attributes=require(_0xdc0c('0xa'));module['exports']=function(_0x162fa5,_0x2ab742){return _0x162fa5[_0xdc0c('0xb')]('ServicenowField',attributes,{'tableName':_0xdc0c('0xc'),'paranoid':![],'indexes':[{'name':_0xdc0c('0xd'),'fields':[_0xdc0c('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23c4=['bluebird','./intServicenowField.attributes','exports','define','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x710c30,_0x528fb5){var _0x4164ed=function(_0x426edd){while(--_0x426edd){_0x710c30['push'](_0x710c30['shift']());}};_0x4164ed(++_0x528fb5);}(_0x23c4,0x88));var _0x423c=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x23c4[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0x423c('0x0'));var util=require('util');var logger=require(_0x423c('0x1'))(_0x423c('0x2'));var moment=require(_0x423c('0x3'));var BPromise=require(_0x423c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x423c('0x5'));module[_0x423c('0x6')]=function(_0x3d065f,_0x1a8671){return _0x3d065f[_0x423c('0x7')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x423c('0x8'),_0x423c('0x9')],'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 14ab991..20e3d81 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x16cce2,_0xf470d4){var _0x213186=function(_0x5dd339){while(--_0x5dd339){_0x16cce2['push'](_0x16cce2['shift']());}};_0x213186(++_0xf470d4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x36b6fd,_0x469701){_0x36b6fd=_0x36b6fd-0x0;var _0x273039=_0xf4eb[_0x36b6fd];return _0x273039;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x493c7a,_0x30ea93){var _0x1ad499=function(_0x5c8318){while(--_0x5c8318){_0x493c7a['push'](_0x493c7a['shift']());}};_0x1ad499(++_0x30ea93);}(_0xaa88,0x137));var _0x8aa8=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xaa88[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e9bcd6b..3fcea02 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1ad5c6,_0x5990ba){var _0x53041a=function(_0x2110e9){while(--_0x2110e9){_0x1ad5c6['push'](_0x1ad5c6['shift']());}};_0x53041a(++_0x5990ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x445aad,_0x479537){var _0x4efc20=function(_0x1efe7f){while(--_0x1efe7f){_0x445aad['push'](_0x445aad['shift']());}};_0x4efc20(++_0x479537);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 59c9415..b172852 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(_0x61c539,_0x21b938){var _0x1fdfa2=function(_0x585aae){while(--_0x585aae){_0x61c539['push'](_0x61c539['shift']());}};_0x1fdfa2(++_0x21b938);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x454268,_0x5d3735){var _0x5b314a=function(_0x3c7c37){while(--_0x3c7c37){_0x454268['push'](_0x454268['shift']());}};_0x5b314a(++_0x5d3735);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 65cb1b0..28cd82b 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 _0x6018=['substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','stringify','values','module_fields','remove','map','label','endsWith','value','test','statusCode','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','reject','update','then','end','error','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SugarcrmAccount','includeAll','include','rows','catch','show','find','create','body','destroy','params','SugarcrmConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice'];(function(_0x367e3c,_0x4b79d3){var _0x3c40ae=function(_0x17f43f){while(--_0x17f43f){_0x367e3c['push'](_0x367e3c['shift']());}};_0x3c40ae(++_0x4b79d3);}(_0x6018,0xfb));var _0x8601=function(_0x43686a,_0x92df16){_0x43686a=_0x43686a-0x0;var _0x48a054=_0x6018[_0x43686a];return _0x48a054;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8601('0x0'));var jsonpatch=require(_0x8601('0x1'));var rp=require('request-promise');var moment=require(_0x8601('0x2'));var BPromise=require(_0x8601('0x3'));var Mustache=require('mustache');var util=require(_0x8601('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8601('0x5'));var ejs=require(_0x8601('0x6'));var fs=require('fs');var fs_extra=require(_0x8601('0x7'));var _=require(_0x8601('0x8'));var squel=require(_0x8601('0x9'));var crypto=require(_0x8601('0xa'));var jsforce=require(_0x8601('0xb'));var deskjs=require(_0x8601('0xc'));var toCsv=require(_0x8601('0x5'));var querystring=require('querystring');var Papa=require(_0x8601('0xd'));var Redis=require(_0x8601('0xe'));var authService=require(_0x8601('0xf'));var qs=require(_0x8601('0x10'));var as=require(_0x8601('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8601('0x12'))(_0x8601('0x13'));var utils=require(_0x8601('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8601('0x15'));var db=require(_0x8601('0x16'))['db'];var integrations=require(_0x8601('0x17'));function respondWithStatusCode(_0xf2f7c9,_0x58395b){_0x58395b=_0x58395b||0xcc;return function(_0x4f677a){if(_0x4f677a){return _0xf2f7c9['sendStatus'](_0x58395b);}return _0xf2f7c9[_0x8601('0x18')](_0x58395b)['end']();};}function respondWithResult(_0x2b3895,_0x51265d){_0x51265d=_0x51265d||0xc8;return function(_0x50f85e){if(_0x50f85e){return _0x2b3895['status'](_0x51265d)['json'](_0x50f85e);}};}function respondWithFilteredResult(_0x47babd,_0x12e261){return function(_0xb2397e){if(_0xb2397e){var _0xc78460=typeof _0x12e261[_0x8601('0x19')]===_0x8601('0x1a')&&typeof _0x12e261['limit']===_0x8601('0x1a');var _0x4f1ec6=_0xb2397e[_0x8601('0x1b')];var _0x5e8393=_0xc78460?0x0:_0x12e261['offset'];var _0x4c7a3c=_0xc78460?_0xb2397e['count']:_0x12e261['offset']+_0x12e261[_0x8601('0x1c')];var _0x27fccc;if(_0x4c7a3c>=_0x4f1ec6){_0x4c7a3c=_0x4f1ec6;_0x27fccc=0xc8;}else{_0x27fccc=0xce;}_0x47babd[_0x8601('0x18')](_0x27fccc);return _0x47babd[_0x8601('0x1d')](_0x8601('0x1e'),_0x5e8393+'-'+_0x4c7a3c+'/'+_0x4f1ec6)['json'](_0xb2397e);}return null;};}function patchUpdates(_0x355d28){return function(_0x313d01){try{jsonpatch['apply'](_0x313d01,_0x355d28,!![]);}catch(_0x225957){return BPromise[_0x8601('0x1f')](_0x225957);}return _0x313d01['save']();};}function saveUpdates(_0x4d1d3e,_0x752405){return function(_0x58f80c){if(_0x58f80c){return _0x58f80c[_0x8601('0x20')](_0x4d1d3e)[_0x8601('0x21')](function(_0xf9ea0){return _0xf9ea0;});}return null;};}function removeEntity(_0xc74c05,_0x4e3a98){return function(_0x4aead7){if(_0x4aead7){return _0x4aead7['destroy']()[_0x8601('0x21')](function(){_0xc74c05['status'](0xcc)[_0x8601('0x22')]();});}};}function handleEntityNotFound(_0x3ca24d,_0x20dacc){return function(_0x1a01bb){if(!_0x1a01bb){_0x3ca24d['sendStatus'](0x194);}return _0x1a01bb;};}function handleError(_0x1e76ef,_0x1105ac){_0x1105ac=_0x1105ac||0x1f4;return function(_0x4241ca){logger[_0x8601('0x23')](_0x4241ca['stack']);if(_0x4241ca[_0x8601('0x24')]){delete _0x4241ca[_0x8601('0x24')];}_0x1e76ef[_0x8601('0x18')](_0x1105ac)[_0x8601('0x25')](_0x4241ca);};}exports[_0x8601('0x26')]=function(_0x1bab5e,_0x4f3538){var _0x2c43cd={},_0x20daa8={},_0x38cc4c={'count':0x0,'rows':[]};var _0x275c3f=_['map'](db['SugarcrmAccount'][_0x8601('0x27')],function(_0x135089){return{'name':_0x135089[_0x8601('0x28')],'type':_0x135089[_0x8601('0x29')][_0x8601('0x2a')]};});_0x20daa8[_0x8601('0x2b')]=_['map'](_0x275c3f,'name');_0x20daa8['query']=_[_0x8601('0x2c')](_0x1bab5e[_0x8601('0x2d')]);_0x20daa8[_0x8601('0x2e')]=_[_0x8601('0x2f')](_0x20daa8[_0x8601('0x2b')],_0x20daa8[_0x8601('0x2d')]);_0x2c43cd[_0x8601('0x30')]=_['intersection'](_0x20daa8[_0x8601('0x2b')],qs[_0x8601('0x31')](_0x1bab5e[_0x8601('0x2d')][_0x8601('0x31')]));_0x2c43cd['attributes']=_0x2c43cd[_0x8601('0x30')][_0x8601('0x32')]?_0x2c43cd[_0x8601('0x30')]:_0x20daa8[_0x8601('0x2b')];if(!_0x1bab5e[_0x8601('0x2d')][_0x8601('0x33')](_0x8601('0x34'))){_0x2c43cd[_0x8601('0x1c')]=qs[_0x8601('0x1c')](_0x1bab5e[_0x8601('0x2d')][_0x8601('0x1c')]);_0x2c43cd['offset']=qs[_0x8601('0x19')](_0x1bab5e[_0x8601('0x2d')][_0x8601('0x19')]);}_0x2c43cd[_0x8601('0x35')]=qs[_0x8601('0x36')](_0x1bab5e[_0x8601('0x2d')][_0x8601('0x36')]);_0x2c43cd[_0x8601('0x37')]=qs[_0x8601('0x2e')](_[_0x8601('0x38')](_0x1bab5e['query'],_0x20daa8['filters']),_0x275c3f);if(_0x1bab5e[_0x8601('0x2d')][_0x8601('0x39')]){_0x2c43cd[_0x8601('0x37')]=_[_0x8601('0x3a')](_0x2c43cd[_0x8601('0x37')],{'$or':_['map'](_0x275c3f,function(_0x1cd51d){if(_0x1cd51d['type']!=='VIRTUAL'){var _0x1211cb={};_0x1211cb[_0x1cd51d['name']]={'$like':'%'+_0x1bab5e[_0x8601('0x2d')][_0x8601('0x39')]+'%'};return _0x1211cb;}})});}_0x2c43cd=_['merge']({},_0x2c43cd,_0x1bab5e[_0x8601('0x3b')]);var _0x53b6e8={'where':_0x2c43cd[_0x8601('0x37')]};return db[_0x8601('0x3c')]['count'](_0x53b6e8)[_0x8601('0x21')](function(_0x5042db){_0x38cc4c[_0x8601('0x1b')]=_0x5042db;if(_0x1bab5e['query'][_0x8601('0x3d')]){_0x2c43cd[_0x8601('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x2c43cd);})['then'](function(_0x11f2a2){_0x38cc4c[_0x8601('0x3f')]=_0x11f2a2;return _0x38cc4c;})['then'](respondWithFilteredResult(_0x4f3538,_0x2c43cd))[_0x8601('0x40')](handleError(_0x4f3538,null));};exports[_0x8601('0x41')]=function(_0x1f4fab,_0x18195a){var _0x3b189a={'raw':![],'where':{'id':_0x1f4fab['params']['id']}},_0x14571b={};_0x14571b['model']=_[_0x8601('0x2c')](db['SugarcrmAccount'][_0x8601('0x27')]);_0x14571b[_0x8601('0x2d')]=_[_0x8601('0x2c')](_0x1f4fab[_0x8601('0x2d')]);_0x14571b['filters']=_['intersection'](_0x14571b['model'],_0x14571b['query']);_0x3b189a[_0x8601('0x30')]=_[_0x8601('0x2f')](_0x14571b[_0x8601('0x2b')],qs[_0x8601('0x31')](_0x1f4fab[_0x8601('0x2d')][_0x8601('0x31')]));_0x3b189a[_0x8601('0x30')]=_0x3b189a[_0x8601('0x30')]['length']?_0x3b189a[_0x8601('0x30')]:_0x14571b[_0x8601('0x2b')];if(_0x1f4fab[_0x8601('0x2d')]['includeAll']){_0x3b189a[_0x8601('0x3e')]=[{'all':!![]}];}_0x3b189a=_[_0x8601('0x3a')]({},_0x3b189a,_0x1f4fab[_0x8601('0x3b')]);return db[_0x8601('0x3c')][_0x8601('0x42')](_0x3b189a)[_0x8601('0x21')](handleEntityNotFound(_0x18195a,null))[_0x8601('0x21')](respondWithResult(_0x18195a,null))[_0x8601('0x40')](handleError(_0x18195a,null));};exports[_0x8601('0x43')]=function(_0x3699d8,_0x422c21){return db[_0x8601('0x3c')][_0x8601('0x43')](_0x3699d8[_0x8601('0x44')],{})[_0x8601('0x21')](respondWithResult(_0x422c21,0xc9))['catch'](handleError(_0x422c21,null));};exports[_0x8601('0x20')]=function(_0x3f84f8,_0x12e763){if(_0x3f84f8[_0x8601('0x44')]['id']){delete _0x3f84f8['body']['id'];}return db[_0x8601('0x3c')]['find']({'where':{'id':_0x3f84f8['params']['id']}})[_0x8601('0x21')](handleEntityNotFound(_0x12e763,null))[_0x8601('0x21')](saveUpdates(_0x3f84f8[_0x8601('0x44')],null))[_0x8601('0x21')](respondWithResult(_0x12e763,null))[_0x8601('0x40')](handleError(_0x12e763,null));};exports[_0x8601('0x45')]=function(_0x7a333b,_0x1ec111){return db[_0x8601('0x3c')][_0x8601('0x42')]({'where':{'id':_0x7a333b[_0x8601('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ec111,null))[_0x8601('0x21')](removeEntity(_0x1ec111,null))[_0x8601('0x40')](handleError(_0x1ec111,null));};exports['getConfigurations']=function(_0x52b9ce,_0x158921,_0x1cc608){var _0x10bd21={};var _0x482bd0={};var _0x24ba50;var _0x40a941;return db[_0x8601('0x3c')]['findOne']({'where':{'id':_0x52b9ce['params']['id']}})[_0x8601('0x21')](handleEntityNotFound(_0x158921,null))['then'](function(_0x1879ff){if(_0x1879ff){_0x24ba50=_0x1879ff;_0x482bd0[_0x8601('0x2b')]=_[_0x8601('0x2c')](db[_0x8601('0x47')][_0x8601('0x27')]);_0x482bd0[_0x8601('0x2d')]=_['keys'](_0x52b9ce[_0x8601('0x2d')]);_0x482bd0['filters']=_['intersection'](_0x482bd0[_0x8601('0x2b')],_0x482bd0[_0x8601('0x2d')]);_0x10bd21[_0x8601('0x30')]=_[_0x8601('0x2f')](_0x482bd0[_0x8601('0x2b')],qs[_0x8601('0x31')](_0x52b9ce[_0x8601('0x2d')][_0x8601('0x31')]));_0x10bd21[_0x8601('0x30')]=_0x10bd21[_0x8601('0x30')]['length']?_0x10bd21[_0x8601('0x30')]:_0x482bd0[_0x8601('0x2b')];_0x10bd21[_0x8601('0x35')]=qs['sort'](_0x52b9ce[_0x8601('0x2d')]['sort']);_0x10bd21['where']=qs[_0x8601('0x2e')](_[_0x8601('0x38')](_0x52b9ce['query'],_0x482bd0[_0x8601('0x2e')]));if(_0x52b9ce['query'][_0x8601('0x39')]){_0x10bd21[_0x8601('0x37')]=_[_0x8601('0x3a')](_0x10bd21['where'],{'$or':_['map'](_0x10bd21[_0x8601('0x30')],function(_0x1dda81){var _0x55b441={};_0x55b441[_0x1dda81]={'$like':'%'+_0x52b9ce[_0x8601('0x2d')][_0x8601('0x39')]+'%'};return _0x55b441;})});}_0x10bd21=_[_0x8601('0x3a')]({},_0x10bd21,_0x52b9ce['options']);return _0x24ba50[_0x8601('0x48')](_0x10bd21);}})['then'](function(_0x284035){if(_0x284035){_0x40a941=_0x284035[_0x8601('0x32')];if(!_0x52b9ce[_0x8601('0x2d')][_0x8601('0x33')](_0x8601('0x34'))){_0x10bd21['limit']=qs[_0x8601('0x1c')](_0x52b9ce[_0x8601('0x2d')]['limit']);_0x10bd21[_0x8601('0x19')]=qs[_0x8601('0x19')](_0x52b9ce[_0x8601('0x2d')][_0x8601('0x19')]);}return _0x24ba50[_0x8601('0x48')](_0x10bd21);}})[_0x8601('0x21')](function(_0x38924b){if(_0x38924b){return _0x38924b?{'count':_0x40a941,'rows':_0x38924b}:null;}})['then'](respondWithResult(_0x158921,null))[_0x8601('0x40')](handleError(_0x158921,null));};exports[_0x8601('0x49')]=function(_0x5b8625,_0x35e36f,_0x5afa55){if(_0x5b8625['body']['id']){delete _0x5b8625[_0x8601('0x44')]['id'];}return db[_0x8601('0x3c')][_0x8601('0x4a')]({'where':{'id':_0x5b8625['params']['id']}})[_0x8601('0x21')](handleEntityNotFound(_0x35e36f,null))[_0x8601('0x21')](function(_0x187bd2){if(_0x187bd2){_0x5b8625[_0x8601('0x44')]['AccountId']=_0x187bd2['id'];_0x5b8625[_0x8601('0x44')][_0x8601('0x4b')]=integrations[_0x8601('0x4c')](_0x5b8625[_0x8601('0x44')]['channel'],_0x5b8625[_0x8601('0x44')][_0x8601('0x29')]);_0x5b8625[_0x8601('0x44')][_0x8601('0x4d')]=integrations[_0x8601('0x4e')](_0x5b8625[_0x8601('0x44')][_0x8601('0x4f')],_0x5b8625[_0x8601('0x44')]['type']);return db[_0x8601('0x47')][_0x8601('0x43')](_0x5b8625[_0x8601('0x44')],{'include':[{'model':db[_0x8601('0x50')],'as':_0x8601('0x4b')},{'model':db[_0x8601('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x35e36f,null))[_0x8601('0x40')](handleError(_0x35e36f,null));};exports[_0x8601('0x51')]=function(_0x5530fe,_0x39bd88,_0x218991){var _0x5751a5='';var _0x2e9e60=['id',_0x8601('0x24'),_0x8601('0x52'),_0x8601('0x53'),'description',_0x8601('0x54'),_0x8601('0x55'),_0x8601('0x56'),_0x8601('0x57'),'parent_type',_0x8601('0x58'),_0x8601('0x59')];return db['SugarcrmAccount'][_0x8601('0x4a')]({'where':{'id':_0x5530fe[_0x8601('0x46')]['id']},'attributes':['id',_0x8601('0x5a'),_0x8601('0x5b'),_0x8601('0x5c')]})[_0x8601('0x21')](handleEntityNotFound(_0x39bd88,null))[_0x8601('0x21')](function(_0x373e83){if(_0x373e83){_0x5751a5=_0x373e83[_0x8601('0x5c')];var _0x3c7342=_0x5751a5[_0x8601('0x5d')](-0x1);if(_0x3c7342==='/'){_0x5751a5=_0x5751a5[_0x8601('0x5e')](0x0,_0x5751a5['lastIndexOf'](_0x3c7342));}return rp({'method':_0x8601('0x5f'),'uri':util[_0x8601('0x60')](_0x8601('0x61'),_0x5751a5,_0x8601('0x62')),'json':!![],'form':{'method':_0x8601('0x63'),'input_type':_0x8601('0x64'),'response_type':_0x8601('0x64'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x373e83[_0x8601('0x5a')],'password':_0x373e83['password'],'encryption':'PLAIN'},'application':_0x8601('0x65')})}});}})['then'](function(_0x5c3a89){if(_0x5c3a89&&_0x5c3a89[_0x8601('0x24')]!=='Invalid\x20Login'&&_0x5c3a89[_0x8601('0x24')]!==_0x8601('0x66')){return rp({'method':_0x8601('0x5f'),'uri':util[_0x8601('0x60')](_0x8601('0x61'),_0x5751a5,_0x8601('0x62')),'json':!![],'form':{'method':_0x8601('0x67'),'input_type':'JSON','response_type':_0x8601('0x64'),'rest_data':JSON[_0x8601('0x68')]({'session':_0x5c3a89['id'],'module_name':'Calls'})}})[_0x8601('0x21')](function(_0x4aad69){if(_0x4aad69){var _0x3152cf=_[_0x8601('0x69')](_0x4aad69[_0x8601('0x6a')]);_[_0x8601('0x6b')](_0x3152cf,function(_0x11c532){return _0x2e9e60['includes'](_0x11c532[_0x8601('0x24')]);});return{'count':_0x3152cf[_0x8601('0x32')],'rows':_[_0x8601('0x6c')](_0x3152cf,function(_0x5b671a){return{'id':_0x5b671a['name'],'name':_0x5b671a[_0x8601('0x6d')],'custom':_[_0x8601('0x6e')](_0x5b671a[_0x8601('0x24')],'_c')?!![]:![],'options':_0x5b671a['options']?_[_0x8601('0x6c')](_[_0x8601('0x69')](_0x5b671a['options']),function(_0x200011){return{'name':_0x200011[_0x8601('0x6f')],'value':_0x200011[_0x8601('0x24')]};}):[]};})};}})[_0x8601('0x21')](respondWithResult(_0x39bd88,null))[_0x8601('0x40')](function(_0x2e1474){var _0x2f500d=_0x5530fe[_0x8601('0x2d')][_0x8601('0x70')]?0x1f4:_0x2e1474[_0x8601('0x71')]||0x1f4;logger[_0x8601('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x8601('0x51'),_0x2f500d,JSON['stringify'](_0x2e1474));delete _0x2e1474[_0x8601('0x24')];if(_0x2f500d===0x191){_0x2f500d=0x190;}_0x39bd88[_0x8601('0x18')](_0x2f500d)['send'](_0x5530fe[_0x8601('0x2d')][_0x8601('0x70')]?{'message':_0x8601('0x72'),'statusCode':_0x2e1474['statusCode']}:_0x2e1474);});}else{var _0xcab9f5=0x1f4;_0x39bd88[_0x8601('0x18')](_0xcab9f5)[_0x8601('0x25')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x5baa=['end','json','offset','count','limit','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','key','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','model','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_name','direction','username','password','remoteUri','slice','substring','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','get_module_fields','stringify','remove','includes','label','endsWith','options','values','value','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5baa,0x1b2));var _0xa5ba=function(_0xcee2d9,_0x296c27){_0xcee2d9=_0xcee2d9-0x0;var _0x3d81ab=_0x5baa[_0xcee2d9];return _0x3d81ab;};'use strict';var emlformat=require(_0xa5ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5ba('0x1'));var jsonpatch=require(_0xa5ba('0x2'));var rp=require(_0xa5ba('0x3'));var moment=require('moment');var BPromise=require(_0xa5ba('0x4'));var Mustache=require(_0xa5ba('0x5'));var util=require(_0xa5ba('0x6'));var path=require(_0xa5ba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5ba('0x8'));var fs=require('fs');var fs_extra=require(_0xa5ba('0x9'));var _=require(_0xa5ba('0xa'));var squel=require('squel');var crypto=require(_0xa5ba('0xb'));var jsforce=require(_0xa5ba('0xc'));var deskjs=require(_0xa5ba('0xd'));var toCsv=require(_0xa5ba('0xe'));var querystring=require(_0xa5ba('0xf'));var Papa=require(_0xa5ba('0x10'));var Redis=require('ioredis');var authService=require(_0xa5ba('0x11'));var qs=require(_0xa5ba('0x12'));var as=require(_0xa5ba('0x13'));var hardwareService=require(_0xa5ba('0x14'));var logger=require(_0xa5ba('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa5ba('0x16'));var db=require(_0xa5ba('0x17'))['db'];var integrations=require(_0xa5ba('0x18'));function respondWithStatusCode(_0x220def,_0x31caab){_0x31caab=_0x31caab||0xcc;return function(_0x535c55){if(_0x535c55){return _0x220def['sendStatus'](_0x31caab);}return _0x220def[_0xa5ba('0x19')](_0x31caab)[_0xa5ba('0x1a')]();};}function respondWithResult(_0x3ed11a,_0x3369c5){_0x3369c5=_0x3369c5||0xc8;return function(_0x320e0a){if(_0x320e0a){return _0x3ed11a[_0xa5ba('0x19')](_0x3369c5)[_0xa5ba('0x1b')](_0x320e0a);}};}function respondWithFilteredResult(_0x587fc0,_0x2cff82){return function(_0x2098fc){if(_0x2098fc){var _0x4f0ee6=typeof _0x2cff82[_0xa5ba('0x1c')]==='undefined'&&typeof _0x2cff82['limit']==='undefined';var _0x6e6f74=_0x2098fc[_0xa5ba('0x1d')];var _0x1f011a=_0x4f0ee6?0x0:_0x2cff82[_0xa5ba('0x1c')];var _0x875f57=_0x4f0ee6?_0x2098fc[_0xa5ba('0x1d')]:_0x2cff82[_0xa5ba('0x1c')]+_0x2cff82[_0xa5ba('0x1e')];var _0xfda229;if(_0x875f57>=_0x6e6f74){_0x875f57=_0x6e6f74;_0xfda229=0xc8;}else{_0xfda229=0xce;}_0x587fc0[_0xa5ba('0x19')](_0xfda229);return _0x587fc0['set']('Content-Range',_0x1f011a+'-'+_0x875f57+'/'+_0x6e6f74)[_0xa5ba('0x1b')](_0x2098fc);}return null;};}function patchUpdates(_0x11f968){return function(_0x1e9dfc){try{jsonpatch[_0xa5ba('0x1f')](_0x1e9dfc,_0x11f968,!![]);}catch(_0x26d389){return BPromise[_0xa5ba('0x20')](_0x26d389);}return _0x1e9dfc[_0xa5ba('0x21')]();};}function saveUpdates(_0x5449c3,_0x573653){return function(_0xa80606){if(_0xa80606){return _0xa80606[_0xa5ba('0x22')](_0x5449c3)[_0xa5ba('0x23')](function(_0x35fabe){return _0x35fabe;});}return null;};}function removeEntity(_0x48d24d,_0x545139){return function(_0x3a4e1b){if(_0x3a4e1b){return _0x3a4e1b[_0xa5ba('0x24')]()[_0xa5ba('0x23')](function(){_0x48d24d['status'](0xcc)[_0xa5ba('0x1a')]();});}};}function handleEntityNotFound(_0x2a4dda,_0x992503){return function(_0x11b904){if(!_0x11b904){_0x2a4dda[_0xa5ba('0x25')](0x194);}return _0x11b904;};}function handleError(_0x8a8749,_0x43376b){_0x43376b=_0x43376b||0x1f4;return function(_0x2c4c3d){logger[_0xa5ba('0x26')](_0x2c4c3d[_0xa5ba('0x27')]);if(_0x2c4c3d[_0xa5ba('0x28')]){delete _0x2c4c3d[_0xa5ba('0x28')];}_0x8a8749[_0xa5ba('0x19')](_0x43376b)[_0xa5ba('0x29')](_0x2c4c3d);};}exports[_0xa5ba('0x2a')]=function(_0x17441c,_0x1d0cbb){var _0x4bf3f9={},_0x5958d5={},_0x4b6cbb={'count':0x0,'rows':[]};var _0x5395c2=_[_0xa5ba('0x2b')](db[_0xa5ba('0x2c')][_0xa5ba('0x2d')],function(_0x428629){return{'name':_0x428629['fieldName'],'type':_0x428629['type'][_0xa5ba('0x2e')]};});_0x5958d5['model']=_[_0xa5ba('0x2b')](_0x5395c2,_0xa5ba('0x28'));_0x5958d5[_0xa5ba('0x2f')]=_[_0xa5ba('0x30')](_0x17441c[_0xa5ba('0x2f')]);_0x5958d5[_0xa5ba('0x31')]=_['intersection'](_0x5958d5['model'],_0x5958d5['query']);_0x4bf3f9['attributes']=_[_0xa5ba('0x32')](_0x5958d5['model'],qs[_0xa5ba('0x33')](_0x17441c['query'][_0xa5ba('0x33')]));_0x4bf3f9[_0xa5ba('0x34')]=_0x4bf3f9[_0xa5ba('0x34')][_0xa5ba('0x35')]?_0x4bf3f9[_0xa5ba('0x34')]:_0x5958d5['model'];if(!_0x17441c[_0xa5ba('0x2f')]['hasOwnProperty'](_0xa5ba('0x36'))){_0x4bf3f9[_0xa5ba('0x1e')]=qs[_0xa5ba('0x1e')](_0x17441c[_0xa5ba('0x2f')]['limit']);_0x4bf3f9['offset']=qs[_0xa5ba('0x1c')](_0x17441c['query'][_0xa5ba('0x1c')]);}_0x4bf3f9[_0xa5ba('0x37')]=qs[_0xa5ba('0x38')](_0x17441c[_0xa5ba('0x2f')]['sort']);_0x4bf3f9[_0xa5ba('0x39')]=qs['filters'](_[_0xa5ba('0x3a')](_0x17441c[_0xa5ba('0x2f')],_0x5958d5['filters']),_0x5395c2);if(_0x17441c['query'][_0xa5ba('0x3b')]){_0x4bf3f9[_0xa5ba('0x39')]=_[_0xa5ba('0x3c')](_0x4bf3f9[_0xa5ba('0x39')],{'$or':_[_0xa5ba('0x2b')](_0x5395c2,function(_0x5c8276){if(_0x5c8276[_0xa5ba('0x3d')]!==_0xa5ba('0x3e')){var _0x2a8dc3={};_0x2a8dc3[_0x5c8276['name']]={'$like':'%'+_0x17441c[_0xa5ba('0x2f')]['filter']+'%'};return _0x2a8dc3;}})});}_0x4bf3f9=_[_0xa5ba('0x3c')]({},_0x4bf3f9,_0x17441c['options']);var _0x5790e9={'where':_0x4bf3f9['where']};return db[_0xa5ba('0x2c')][_0xa5ba('0x1d')](_0x5790e9)[_0xa5ba('0x23')](function(_0x52cbc2){_0x4b6cbb[_0xa5ba('0x1d')]=_0x52cbc2;if(_0x17441c['query'][_0xa5ba('0x3f')]){_0x4bf3f9[_0xa5ba('0x40')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xa5ba('0x41')](_0x4bf3f9);})[_0xa5ba('0x23')](function(_0x5cf185){_0x4b6cbb['rows']=_0x5cf185;return _0x4b6cbb;})[_0xa5ba('0x23')](respondWithFilteredResult(_0x1d0cbb,_0x4bf3f9))['catch'](handleError(_0x1d0cbb,null));};exports[_0xa5ba('0x42')]=function(_0x9268d2,_0x209604){var _0x24a437={'raw':![],'where':{'id':_0x9268d2[_0xa5ba('0x43')]['id']}},_0x3005d6={};_0x3005d6[_0xa5ba('0x44')]=_[_0xa5ba('0x30')](db[_0xa5ba('0x2c')]['rawAttributes']);_0x3005d6[_0xa5ba('0x2f')]=_[_0xa5ba('0x30')](_0x9268d2[_0xa5ba('0x2f')]);_0x3005d6[_0xa5ba('0x31')]=_[_0xa5ba('0x32')](_0x3005d6[_0xa5ba('0x44')],_0x3005d6[_0xa5ba('0x2f')]);_0x24a437[_0xa5ba('0x34')]=_[_0xa5ba('0x32')](_0x3005d6[_0xa5ba('0x44')],qs['fields'](_0x9268d2[_0xa5ba('0x2f')][_0xa5ba('0x33')]));_0x24a437['attributes']=_0x24a437[_0xa5ba('0x34')][_0xa5ba('0x35')]?_0x24a437[_0xa5ba('0x34')]:_0x3005d6[_0xa5ba('0x44')];if(_0x9268d2[_0xa5ba('0x2f')][_0xa5ba('0x3f')]){_0x24a437['include']=[{'all':!![]}];}_0x24a437=_['merge']({},_0x24a437,_0x9268d2['options']);return db['SugarcrmAccount'][_0xa5ba('0x45')](_0x24a437)[_0xa5ba('0x23')](handleEntityNotFound(_0x209604,null))[_0xa5ba('0x23')](respondWithResult(_0x209604,null))[_0xa5ba('0x46')](handleError(_0x209604,null));};exports[_0xa5ba('0x47')]=function(_0x274eb7,_0x45e260){return db['SugarcrmAccount'][_0xa5ba('0x47')](_0x274eb7[_0xa5ba('0x48')],{})[_0xa5ba('0x23')](respondWithResult(_0x45e260,0xc9))[_0xa5ba('0x46')](handleError(_0x45e260,null));};exports['update']=function(_0x51e699,_0x4f1ad2){if(_0x51e699['body']['id']){delete _0x51e699[_0xa5ba('0x48')]['id'];}return db[_0xa5ba('0x2c')][_0xa5ba('0x45')]({'where':{'id':_0x51e699[_0xa5ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f1ad2,null))['then'](saveUpdates(_0x51e699[_0xa5ba('0x48')],null))['then'](respondWithResult(_0x4f1ad2,null))[_0xa5ba('0x46')](handleError(_0x4f1ad2,null));};exports[_0xa5ba('0x24')]=function(_0x20a6d0,_0x90ec74){return db[_0xa5ba('0x2c')][_0xa5ba('0x45')]({'where':{'id':_0x20a6d0[_0xa5ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x90ec74,null))[_0xa5ba('0x23')](removeEntity(_0x90ec74,null))[_0xa5ba('0x46')](handleError(_0x90ec74,null));};exports[_0xa5ba('0x49')]=function(_0x22dc40,_0xeb00f0,_0x48dac5){var _0x2ad315={};var _0xb4105f={};var _0x5733f4;var _0x7bf162;return db[_0xa5ba('0x2c')][_0xa5ba('0x4a')]({'where':{'id':_0x22dc40[_0xa5ba('0x43')]['id']}})[_0xa5ba('0x23')](handleEntityNotFound(_0xeb00f0,null))[_0xa5ba('0x23')](function(_0x2d891f){if(_0x2d891f){_0x5733f4=_0x2d891f;_0xb4105f['model']=_[_0xa5ba('0x30')](db[_0xa5ba('0x4b')][_0xa5ba('0x2d')]);_0xb4105f[_0xa5ba('0x2f')]=_[_0xa5ba('0x30')](_0x22dc40['query']);_0xb4105f[_0xa5ba('0x31')]=_[_0xa5ba('0x32')](_0xb4105f[_0xa5ba('0x44')],_0xb4105f['query']);_0x2ad315[_0xa5ba('0x34')]=_['intersection'](_0xb4105f[_0xa5ba('0x44')],qs[_0xa5ba('0x33')](_0x22dc40[_0xa5ba('0x2f')]['fields']));_0x2ad315[_0xa5ba('0x34')]=_0x2ad315[_0xa5ba('0x34')][_0xa5ba('0x35')]?_0x2ad315[_0xa5ba('0x34')]:_0xb4105f[_0xa5ba('0x44')];_0x2ad315['order']=qs['sort'](_0x22dc40[_0xa5ba('0x2f')][_0xa5ba('0x38')]);_0x2ad315['where']=qs[_0xa5ba('0x31')](_[_0xa5ba('0x3a')](_0x22dc40[_0xa5ba('0x2f')],_0xb4105f[_0xa5ba('0x31')]));if(_0x22dc40[_0xa5ba('0x2f')][_0xa5ba('0x3b')]){_0x2ad315[_0xa5ba('0x39')]=_['merge'](_0x2ad315[_0xa5ba('0x39')],{'$or':_[_0xa5ba('0x2b')](_0x2ad315[_0xa5ba('0x34')],function(_0x7f4eab){var _0x30038d={};_0x30038d[_0x7f4eab]={'$like':'%'+_0x22dc40[_0xa5ba('0x2f')]['filter']+'%'};return _0x30038d;})});}_0x2ad315=_[_0xa5ba('0x3c')]({},_0x2ad315,_0x22dc40['options']);return _0x5733f4[_0xa5ba('0x49')](_0x2ad315);}})[_0xa5ba('0x23')](function(_0x4c70e0){if(_0x4c70e0){_0x7bf162=_0x4c70e0[_0xa5ba('0x35')];if(!_0x22dc40[_0xa5ba('0x2f')]['hasOwnProperty'](_0xa5ba('0x36'))){_0x2ad315[_0xa5ba('0x1e')]=qs[_0xa5ba('0x1e')](_0x22dc40[_0xa5ba('0x2f')][_0xa5ba('0x1e')]);_0x2ad315[_0xa5ba('0x1c')]=qs[_0xa5ba('0x1c')](_0x22dc40[_0xa5ba('0x2f')]['offset']);}return _0x5733f4[_0xa5ba('0x49')](_0x2ad315);}})[_0xa5ba('0x23')](function(_0x400be5){if(_0x400be5){return _0x400be5?{'count':_0x7bf162,'rows':_0x400be5}:null;}})['then'](respondWithResult(_0xeb00f0,null))[_0xa5ba('0x46')](handleError(_0xeb00f0,null));};exports[_0xa5ba('0x4c')]=function(_0x43c2ca,_0x1250f3,_0x6e47fc){if(_0x43c2ca['body']['id']){delete _0x43c2ca[_0xa5ba('0x48')]['id'];}return db[_0xa5ba('0x2c')][_0xa5ba('0x4a')]({'where':{'id':_0x43c2ca['params']['id']}})[_0xa5ba('0x23')](handleEntityNotFound(_0x1250f3,null))[_0xa5ba('0x23')](function(_0xf1c3c7){if(_0xf1c3c7){_0x43c2ca[_0xa5ba('0x48')]['AccountId']=_0xf1c3c7['id'];_0x43c2ca[_0xa5ba('0x48')][_0xa5ba('0x4d')]=integrations[_0xa5ba('0x4e')](_0x43c2ca['body']['channel'],_0x43c2ca['body'][_0xa5ba('0x3d')]);_0x43c2ca['body'][_0xa5ba('0x4f')]=integrations['getDescriptions'](_0x43c2ca[_0xa5ba('0x48')][_0xa5ba('0x50')],_0x43c2ca[_0xa5ba('0x48')][_0xa5ba('0x3d')]);return db[_0xa5ba('0x4b')]['create'](_0x43c2ca[_0xa5ba('0x48')],{'include':[{'model':db[_0xa5ba('0x51')],'as':_0xa5ba('0x4d')},{'model':db[_0xa5ba('0x51')],'as':_0xa5ba('0x4f')}]});}return null;})[_0xa5ba('0x23')](respondWithResult(_0x1250f3,null))[_0xa5ba('0x46')](handleError(_0x1250f3,null));};exports[_0xa5ba('0x52')]=function(_0x3457c0,_0x2e6fee,_0x479f09){var _0x22c8ad='';var _0x100379=['id',_0xa5ba('0x28'),_0xa5ba('0x53'),_0xa5ba('0x54'),_0xa5ba('0x55'),'date_start',_0xa5ba('0x56'),_0xa5ba('0x57'),'parent_id','parent_type',_0xa5ba('0x58'),_0xa5ba('0x59')];return db[_0xa5ba('0x2c')]['findOne']({'where':{'id':_0x3457c0[_0xa5ba('0x43')]['id']},'attributes':['id',_0xa5ba('0x5a'),_0xa5ba('0x5b'),_0xa5ba('0x5c')]})[_0xa5ba('0x23')](handleEntityNotFound(_0x2e6fee,null))[_0xa5ba('0x23')](function(_0x47e831){if(_0x47e831){_0x22c8ad=_0x47e831['remoteUri'];var _0x1037a8=_0x22c8ad[_0xa5ba('0x5d')](-0x1);if(_0x1037a8==='/'){_0x22c8ad=_0x22c8ad[_0xa5ba('0x5e')](0x0,_0x22c8ad['lastIndexOf'](_0x1037a8));}return rp({'method':'POST','uri':util[_0xa5ba('0x5f')]('%s%s',_0x22c8ad,_0xa5ba('0x60')),'json':!![],'form':{'method':_0xa5ba('0x61'),'input_type':_0xa5ba('0x62'),'response_type':_0xa5ba('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x47e831['username'],'password':_0x47e831[_0xa5ba('0x5b')],'encryption':_0xa5ba('0x63')},'application':_0xa5ba('0x64')})}});}})[_0xa5ba('0x23')](function(_0x5b91d8){if(_0x5b91d8&&_0x5b91d8[_0xa5ba('0x28')]!=='Invalid\x20Login'&&_0x5b91d8[_0xa5ba('0x28')]!==_0xa5ba('0x65')){return rp({'method':'POST','uri':util[_0xa5ba('0x5f')](_0xa5ba('0x66'),_0x22c8ad,_0xa5ba('0x60')),'json':!![],'form':{'method':_0xa5ba('0x67'),'input_type':'JSON','response_type':_0xa5ba('0x62'),'rest_data':JSON[_0xa5ba('0x68')]({'session':_0x5b91d8['id'],'module_name':'Calls'})}})[_0xa5ba('0x23')](function(_0x504816){if(_0x504816){var _0x531a8e=_['values'](_0x504816['module_fields']);_[_0xa5ba('0x69')](_0x531a8e,function(_0x16c8c8){return _0x100379[_0xa5ba('0x6a')](_0x16c8c8['name']);});return{'count':_0x531a8e['length'],'rows':_[_0xa5ba('0x2b')](_0x531a8e,function(_0x505da1){return{'id':_0x505da1['name'],'name':_0x505da1[_0xa5ba('0x6b')],'custom':_[_0xa5ba('0x6c')](_0x505da1['name'],'_c')?!![]:![],'options':_0x505da1[_0xa5ba('0x6d')]?_[_0xa5ba('0x2b')](_[_0xa5ba('0x6e')](_0x505da1[_0xa5ba('0x6d')]),function(_0x5f3631){return{'name':_0x5f3631[_0xa5ba('0x6f')],'value':_0x5f3631[_0xa5ba('0x28')]};}):[]};})};}})[_0xa5ba('0x23')](respondWithResult(_0x2e6fee,null))[_0xa5ba('0x46')](function(_0x2668e9){var _0xa41e71=_0x3457c0['query'][_0xa5ba('0x70')]?0x1f4:_0x2668e9[_0xa5ba('0x71')]||0x1f4;logger[_0xa5ba('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xa41e71,JSON[_0xa5ba('0x68')](_0x2668e9));delete _0x2668e9[_0xa5ba('0x28')];if(_0xa41e71===0x191){_0xa41e71=0x190;}_0x2e6fee['status'](_0xa41e71)['send'](_0x3457c0['query'][_0xa5ba('0x70')]?{'message':_0xa5ba('0x72'),'statusCode':_0x2668e9[_0xa5ba('0x71')]}:_0x2668e9);});}else{var _0x31b324=0x1f4;_0x2e6fee[_0xa5ba('0x19')](_0x31b324)[_0xa5ba('0x29')]({'message':_0xa5ba('0x72'),'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 a3216f7..cb17954 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 _0x036f=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x036f,0x109));var _0xf036=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x036f[_0x571a17];return _0x3ef337;};'use strict';var _=require(_0xf036('0x0'));var util=require(_0xf036('0x1'));var logger=require(_0xf036('0x2'))('api');var moment=require(_0xf036('0x3'));var BPromise=require(_0xf036('0x4'));var rp=require(_0xf036('0x5'));var fs=require('fs');var path=require(_0xf036('0x6'));var rimraf=require(_0xf036('0x7'));var config=require(_0xf036('0x8'));var attributes=require(_0xf036('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf036('0xa')]=function(_0x63235,_0x72933e){return _0x63235[_0xf036('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xf036('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7644=['rimraf','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','bluebird','request-promise'];(function(_0x15d60e,_0x4e846d){var _0x5c6452=function(_0x1ca41c){while(--_0x1ca41c){_0x15d60e['push'](_0x15d60e['shift']());}};_0x5c6452(++_0x4e846d);}(_0x7644,0x1d9));var _0x4764=function(_0x395a4d,_0x57837c){_0x395a4d=_0x395a4d-0x0;var _0xe794ea=_0x7644[_0x395a4d];return _0xe794ea;};'use strict';var _=require('lodash');var util=require(_0x4764('0x0'));var logger=require(_0x4764('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4764('0x2'));var rp=require(_0x4764('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4764('0x4'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x4764('0x5'));module[_0x4764('0x6')]=function(_0x436f1f,_0x194686){return _0x436f1f['define'](_0x4764('0x7'),attributes,{'tableName':_0x4764('0x8'),'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 f44eb8f..8155471 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 _0x68fc=['result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','catch','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1a1131,_0x404e25){var _0x2a73ee=function(_0x18690f){while(--_0x18690f){_0x1a1131['push'](_0x1a1131['shift']());}};_0x2a73ee(++_0x404e25);}(_0x68fc,0x179));var _0xc68f=function(_0x203da9,_0x4027f6){_0x203da9=_0x203da9-0x0;var _0x46956b=_0x68fc[_0x203da9];return _0x46956b;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var moment=require(_0xc68f('0x2'));var BPromise=require(_0xc68f('0x3'));var rs=require(_0xc68f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc68f('0x5'))['db'];var utils=require(_0xc68f('0x6'));var logger=require('../../config/logger')(_0xc68f('0x7'));var config=require(_0xc68f('0x8'));var jayson=require(_0xc68f('0x9'));var client=jayson[_0xc68f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x873f1,_0xdc1c88,_0x32f2a0){return new BPromise(function(_0x368b3c,_0x6ca4fd){return client['request'](_0x873f1,_0x32f2a0)[_0xc68f('0xb')](function(_0x110dda){logger['info'](_0xc68f('0xc'),_0xdc1c88,_0xc68f('0xd'));logger[_0xc68f('0xe')](_0xc68f('0xf'),_0xdc1c88,_0xc68f('0xd'),JSON['stringify'](_0x110dda));if(_0x110dda[_0xc68f('0x10')]){if(_0x110dda[_0xc68f('0x10')][_0xc68f('0x11')]===0x1f4){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0xdc1c88,_0x110dda[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x6ca4fd(_0x110dda[_0xc68f('0x10')]['message']);}logger[_0xc68f('0x10')](_0xc68f('0xc'),_0xdc1c88,_0x110dda['error']['message']);return _0x368b3c(_0x110dda[_0xc68f('0x10')][_0xc68f('0x12')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xdc1c88,'request\x20sent');_0x368b3c(_0x110dda[_0xc68f('0x13')]['message']);}})['catch'](function(_0x253ce8){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0xdc1c88,_0x253ce8);_0x6ca4fd(_0x253ce8);});});}exports[_0xc68f('0x14')]=function(_0x2425b2){var _0x24de89=this;return new Promise(function(_0x475990,_0xc2aabd){return db[_0xc68f('0x15')][_0xc68f('0x16')]({'raw':_0x2425b2[_0xc68f('0x17')]?_0x2425b2[_0xc68f('0x17')][_0xc68f('0x18')]===undefined?!![]:![]:!![],'where':_0x2425b2['options']?_0x2425b2[_0xc68f('0x17')][_0xc68f('0x19')]||null:null,'attributes':_0x2425b2[_0xc68f('0x17')]?_0x2425b2[_0xc68f('0x17')][_0xc68f('0x1a')]||null:null,'limit':_0x2425b2[_0xc68f('0x17')]?_0x2425b2['options'][_0xc68f('0x1b')]||null:null,'include':_0x2425b2[_0xc68f('0x17')]?_0x2425b2[_0xc68f('0x17')][_0xc68f('0x1c')]?_[_0xc68f('0x1d')](_0x2425b2[_0xc68f('0x17')][_0xc68f('0x1c')],function(_0x407fe8){return{'model':db[_0x407fe8[_0xc68f('0x1e')]],'as':_0x407fe8['as'],'attributes':_0x407fe8['attributes'],'include':_0x407fe8[_0xc68f('0x1c')]?_['map'](_0x407fe8[_0xc68f('0x1c')],function(_0x2acac1){return{'model':db[_0x2acac1[_0xc68f('0x1e')]],'as':_0x2acac1['as'],'attributes':_0x2acac1['attributes'],'include':_0x2acac1[_0xc68f('0x1c')]?_[_0xc68f('0x1d')](_0x2acac1['include'],function(_0x1b9c0a){return{'model':db[_0x1b9c0a[_0xc68f('0x1e')]],'as':_0x1b9c0a['as'],'attributes':_0x1b9c0a[_0xc68f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc68f('0xb')](function(_0x8e9666){logger[_0xc68f('0x1f')](_0xc68f('0x14'),_0x2425b2);logger[_0xc68f('0xe')]('GetSugarcrmAccount',_0x2425b2,JSON[_0xc68f('0x20')](_0x8e9666));_0x475990(_0x8e9666);})[_0xc68f('0x21')](function(_0x4fd0fb){logger[_0xc68f('0x10')](_0xc68f('0x14'),_0x4fd0fb['message'],_0x2425b2);_0xc2aabd(_0x24de89[_0xc68f('0x10')](0x1f4,_0x4fd0fb[_0xc68f('0x12')]));});});};exports[_0xc68f('0x22')]=function(_0x14f4cd){var _0x3352dc=this;return new Promise(function(_0x377c3d,_0x3bef1f){return db['SugarcrmAccount'][_0xc68f('0x23')]({'raw':_0x14f4cd['options']?_0x14f4cd[_0xc68f('0x17')][_0xc68f('0x18')]===undefined?!![]:![]:!![],'where':_0x14f4cd[_0xc68f('0x17')]?_0x14f4cd[_0xc68f('0x17')][_0xc68f('0x19')]||null:null,'attributes':_0x14f4cd['options']?_0x14f4cd[_0xc68f('0x17')][_0xc68f('0x1a')]||null:null,'include':_0x14f4cd[_0xc68f('0x17')]?_0x14f4cd[_0xc68f('0x17')][_0xc68f('0x1c')]?_['map'](_0x14f4cd[_0xc68f('0x17')][_0xc68f('0x1c')],function(_0x16f6c4){return{'model':db[_0x16f6c4[_0xc68f('0x1e')]],'as':_0x16f6c4['as'],'attributes':_0x16f6c4[_0xc68f('0x1a')],'include':_0x16f6c4[_0xc68f('0x1c')]?_[_0xc68f('0x1d')](_0x16f6c4[_0xc68f('0x1c')],function(_0x5551a0){return{'model':db[_0x5551a0['model']],'as':_0x5551a0['as'],'attributes':_0x5551a0[_0xc68f('0x1a')],'include':_0x5551a0[_0xc68f('0x1c')]?_[_0xc68f('0x1d')](_0x5551a0[_0xc68f('0x1c')],function(_0x5bcecd){return{'model':db[_0x5bcecd['model']],'as':_0x5bcecd['as'],'attributes':_0x5bcecd['attributes']};}):[]};}):[]};}):[]:[]})[_0xc68f('0xb')](function(_0x52a8d6){logger['info'](_0xc68f('0x22'),_0x14f4cd);logger['debug']('ShowSugarcrmAccount',_0x14f4cd,JSON[_0xc68f('0x20')](_0x52a8d6));_0x377c3d(_0x52a8d6);})[_0xc68f('0x21')](function(_0x57bc13){logger['error']('ShowSugarcrmAccount',_0x57bc13[_0xc68f('0x12')],_0x14f4cd);_0x3bef1f(_0x3352dc[_0xc68f('0x10')](0x1f4,_0x57bc13[_0xc68f('0x12')]));});});}; \ No newline at end of file +var _0xcc33=['ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','debug'];(function(_0x7858a9,_0x4911e0){var _0x49b9e3=function(_0x57f199){while(--_0x57f199){_0x7858a9['push'](_0x7858a9['shift']());}};_0x49b9e3(++_0x4911e0);}(_0xcc33,0xba));var _0x3cc3=function(_0x3d4cd0,_0x1ca60a){_0x3d4cd0=_0x3d4cd0-0x0;var _0x11e6d9=_0xcc33[_0x3d4cd0];return _0x11e6d9;};'use strict';var _=require(_0x3cc3('0x0'));var util=require(_0x3cc3('0x1'));var moment=require(_0x3cc3('0x2'));var BPromise=require(_0x3cc3('0x3'));var rs=require(_0x3cc3('0x4'));var fs=require('fs');var Redis=require(_0x3cc3('0x5'));var db=require(_0x3cc3('0x6'))['db'];var utils=require(_0x3cc3('0x7'));var logger=require(_0x3cc3('0x8'))(_0x3cc3('0x9'));var config=require(_0x3cc3('0xa'));var jayson=require(_0x3cc3('0xb'));var client=jayson[_0x3cc3('0xc')][_0x3cc3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x51070f,_0x25a355,_0x1a7ea9){return new BPromise(function(_0x15a580,_0x15dbde){return client['request'](_0x51070f,_0x1a7ea9)[_0x3cc3('0xe')](function(_0x3f1e47){logger['info'](_0x3cc3('0xf'),_0x25a355,_0x3cc3('0x10'));logger['debug'](_0x3cc3('0x11'),_0x25a355,_0x3cc3('0x10'),JSON[_0x3cc3('0x12')](_0x3f1e47));if(_0x3f1e47['error']){if(_0x3f1e47[_0x3cc3('0x13')][_0x3cc3('0x14')]===0x1f4){logger[_0x3cc3('0x13')](_0x3cc3('0xf'),_0x25a355,_0x3f1e47[_0x3cc3('0x13')][_0x3cc3('0x15')]);return _0x15dbde(_0x3f1e47['error'][_0x3cc3('0x15')]);}logger['error'](_0x3cc3('0xf'),_0x25a355,_0x3f1e47[_0x3cc3('0x13')][_0x3cc3('0x15')]);return _0x15a580(_0x3f1e47['error'][_0x3cc3('0x15')]);}else{logger[_0x3cc3('0x16')](_0x3cc3('0xf'),_0x25a355,_0x3cc3('0x10'));_0x15a580(_0x3f1e47[_0x3cc3('0x17')][_0x3cc3('0x15')]);}})[_0x3cc3('0x18')](function(_0x2b87c0){logger[_0x3cc3('0x13')](_0x3cc3('0xf'),_0x25a355,_0x2b87c0);_0x15dbde(_0x2b87c0);});});}exports[_0x3cc3('0x19')]=function(_0x5c2929){var _0x133d88=this;return new Promise(function(_0x2c3411,_0x56226e){return db[_0x3cc3('0x1a')][_0x3cc3('0x1b')]({'raw':_0x5c2929[_0x3cc3('0x1c')]?_0x5c2929[_0x3cc3('0x1c')][_0x3cc3('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c2929[_0x3cc3('0x1c')]?_0x5c2929[_0x3cc3('0x1c')][_0x3cc3('0x1e')]||null:null,'attributes':_0x5c2929[_0x3cc3('0x1c')]?_0x5c2929[_0x3cc3('0x1c')][_0x3cc3('0x1f')]||null:null,'limit':_0x5c2929[_0x3cc3('0x1c')]?_0x5c2929[_0x3cc3('0x1c')]['limit']||null:null,'include':_0x5c2929[_0x3cc3('0x1c')]?_0x5c2929[_0x3cc3('0x1c')][_0x3cc3('0x20')]?_[_0x3cc3('0x21')](_0x5c2929[_0x3cc3('0x1c')][_0x3cc3('0x20')],function(_0x308024){return{'model':db[_0x308024[_0x3cc3('0x22')]],'as':_0x308024['as'],'attributes':_0x308024[_0x3cc3('0x1f')],'include':_0x308024[_0x3cc3('0x20')]?_[_0x3cc3('0x21')](_0x308024[_0x3cc3('0x20')],function(_0x96eae2){return{'model':db[_0x96eae2['model']],'as':_0x96eae2['as'],'attributes':_0x96eae2['attributes'],'include':_0x96eae2[_0x3cc3('0x20')]?_[_0x3cc3('0x21')](_0x96eae2[_0x3cc3('0x20')],function(_0x376050){return{'model':db[_0x376050[_0x3cc3('0x22')]],'as':_0x376050['as'],'attributes':_0x376050[_0x3cc3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3cc3('0xe')](function(_0x79d111){logger[_0x3cc3('0x16')](_0x3cc3('0x19'),_0x5c2929);logger[_0x3cc3('0x23')]('GetSugarcrmAccount',_0x5c2929,JSON[_0x3cc3('0x12')](_0x79d111));_0x2c3411(_0x79d111);})[_0x3cc3('0x18')](function(_0x56d6cd){logger[_0x3cc3('0x13')](_0x3cc3('0x19'),_0x56d6cd[_0x3cc3('0x15')],_0x5c2929);_0x56226e(_0x133d88[_0x3cc3('0x13')](0x1f4,_0x56d6cd['message']));});});};exports[_0x3cc3('0x24')]=function(_0x586a79){var _0x8247bb=this;return new Promise(function(_0x5d2543,_0x3cb636){return db[_0x3cc3('0x1a')]['find']({'raw':_0x586a79[_0x3cc3('0x1c')]?_0x586a79[_0x3cc3('0x1c')][_0x3cc3('0x1d')]===undefined?!![]:![]:!![],'where':_0x586a79['options']?_0x586a79[_0x3cc3('0x1c')]['where']||null:null,'attributes':_0x586a79[_0x3cc3('0x1c')]?_0x586a79[_0x3cc3('0x1c')][_0x3cc3('0x1f')]||null:null,'include':_0x586a79['options']?_0x586a79['options']['include']?_[_0x3cc3('0x21')](_0x586a79[_0x3cc3('0x1c')][_0x3cc3('0x20')],function(_0x50ad63){return{'model':db[_0x50ad63[_0x3cc3('0x22')]],'as':_0x50ad63['as'],'attributes':_0x50ad63[_0x3cc3('0x1f')],'include':_0x50ad63['include']?_[_0x3cc3('0x21')](_0x50ad63['include'],function(_0x556fd6){return{'model':db[_0x556fd6[_0x3cc3('0x22')]],'as':_0x556fd6['as'],'attributes':_0x556fd6[_0x3cc3('0x1f')],'include':_0x556fd6[_0x3cc3('0x20')]?_[_0x3cc3('0x21')](_0x556fd6[_0x3cc3('0x20')],function(_0x294ddc){return{'model':db[_0x294ddc[_0x3cc3('0x22')]],'as':_0x294ddc['as'],'attributes':_0x294ddc[_0x3cc3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3cc3('0xe')](function(_0x53bc57){logger[_0x3cc3('0x16')](_0x3cc3('0x24'),_0x586a79);logger[_0x3cc3('0x23')]('ShowSugarcrmAccount',_0x586a79,JSON['stringify'](_0x53bc57));_0x5d2543(_0x53bc57);})['catch'](function(_0x18e227){logger[_0x3cc3('0x13')](_0x3cc3('0x24'),_0x18e227['message'],_0x586a79);_0x3cb636(_0x8247bb['error'](0x1f4,_0x18e227[_0x3cc3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9637424..feba399 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 _0x1bb0=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getDescriptions','post','create','put','delete','destroy','multer'];(function(_0x3dabd9,_0x5b7d12){var _0x3e7bd5=function(_0x119702){while(--_0x119702){_0x3dabd9['push'](_0x3dabd9['shift']());}};_0x3e7bd5(++_0x5b7d12);}(_0x1bb0,0x153));var _0x01bb=function(_0x3473a6,_0x3bbf1d){_0x3473a6=_0x3473a6-0x0;var _0x587786=_0x1bb0[_0x3473a6];return _0x587786;};'use strict';var multer=require(_0x01bb('0x0'));var util=require(_0x01bb('0x1'));var path=require('path');var timeout=require(_0x01bb('0x2'));var express=require(_0x01bb('0x3'));var router=express[_0x01bb('0x4')]();var fs_extra=require(_0x01bb('0x5'));var auth=require(_0x01bb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x01bb('0x7'));router[_0x01bb('0x8')]('/',auth[_0x01bb('0x9')](),controller[_0x01bb('0xa')]);router[_0x01bb('0x8')](_0x01bb('0xb'),auth[_0x01bb('0x9')](),controller['show']);router[_0x01bb('0x8')]('/:id/fields',auth[_0x01bb('0x9')](),controller[_0x01bb('0xc')]);router[_0x01bb('0x8')](_0x01bb('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x01bb('0xe')]);router[_0x01bb('0xf')]('/',auth[_0x01bb('0x9')](),controller[_0x01bb('0x10')]);router[_0x01bb('0x11')](_0x01bb('0xb'),auth[_0x01bb('0x9')](),controller['update']);router[_0x01bb('0x12')](_0x01bb('0xb'),auth[_0x01bb('0x9')](),controller[_0x01bb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd378=['getDescriptions','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5c6403,_0x53713f){var _0x12a873=function(_0x112ddf){while(--_0x112ddf){_0x5c6403['push'](_0x5c6403['shift']());}};_0x12a873(++_0x53713f);}(_0xd378,0x176));var _0x8d37=function(_0x549e25,_0x181fa9){_0x549e25=_0x549e25-0x0;var _0x554e0d=_0xd378[_0x549e25];return _0x554e0d;};'use strict';var multer=require(_0x8d37('0x0'));var util=require(_0x8d37('0x1'));var path=require('path');var timeout=require(_0x8d37('0x2'));var express=require(_0x8d37('0x3'));var router=express['Router']();var fs_extra=require(_0x8d37('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8d37('0x5'));var config=require(_0x8d37('0x6'));var controller=require(_0x8d37('0x7'));router[_0x8d37('0x8')]('/',auth[_0x8d37('0x9')](),controller[_0x8d37('0xa')]);router[_0x8d37('0x8')](_0x8d37('0xb'),auth[_0x8d37('0x9')](),controller['show']);router['get'](_0x8d37('0xc'),auth['isAuthenticated'](),controller[_0x8d37('0xd')]);router['get'](_0x8d37('0xe'),auth[_0x8d37('0x9')](),controller[_0x8d37('0xf')]);router[_0x8d37('0x8')](_0x8d37('0x10'),auth['isAuthenticated'](),controller[_0x8d37('0x11')]);router['post']('/',auth[_0x8d37('0x9')](),controller['create']);router[_0x8d37('0x12')](_0x8d37('0xb'),auth[_0x8d37('0x9')](),controller[_0x8d37('0x13')]);router[_0x8d37('0x14')]('/:id',auth[_0x8d37('0x9')](),controller[_0x8d37('0x15')]);module[_0x8d37('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 634b73c..e0c23df 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 _0x39f0=['exports','STRING','sequelize'];(function(_0x2ce907,_0x4e669d){var _0xf17ecd=function(_0x28db21){while(--_0x28db21){_0x2ce907['push'](_0x2ce907['shift']());}};_0xf17ecd(++_0x4e669d);}(_0x39f0,0x9b));var _0x039f=function(_0x369a9a,_0x1b4feb){_0x369a9a=_0x369a9a-0x0;var _0x29e746=_0x39f0[_0x369a9a];return _0x29e746;};'use strict';var Sequelize=require(_0x039f('0x0'));module[_0x039f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x039f('0x2')]}}; \ No newline at end of file +var _0x3693=['STRING','sequelize'];(function(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0x3693,0x93));var _0x3369=function(_0x21ced0,_0x6e15a6){_0x21ced0=_0x21ced0-0x0;var _0x3354c6=_0x3693[_0x21ced0];return _0x3354c6;};'use strict';var Sequelize=require(_0x3369('0x0'));module['exports']={'name':{'type':Sequelize[_0x3369('0x1')]},'description':{'type':Sequelize[_0x3369('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b2c90a2..85b536f 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 _0x72c1=['map','SugarcrmConfiguration','rawAttributes','fieldName','keys','query','filters','intersection','fields','attributes','length','model','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','hasOwnProperty','nolimit','getSubjects','SugarcrmField','filter','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index'];(function(_0x8b4de1,_0x49ad8d){var _0x2b57be=function(_0x1fa723){while(--_0x1fa723){_0x8b4de1['push'](_0x8b4de1['shift']());}};_0x2b57be(++_0x49ad8d);}(_0x72c1,0x1ab));var _0x172c=function(_0x108cac,_0x557d71){_0x108cac=_0x108cac-0x0;var _0x5a3b41=_0x72c1[_0x108cac];return _0x5a3b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x172c('0x0'));var zipdir=require(_0x172c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x172c('0x2'));var moment=require(_0x172c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x172c('0x4'));var util=require(_0x172c('0x5'));var path=require(_0x172c('0x6'));var sox=require(_0x172c('0x7'));var csv=require(_0x172c('0x8'));var ejs=require(_0x172c('0x9'));var fs=require('fs');var fs_extra=require(_0x172c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x172c('0xb'));var jsforce=require(_0x172c('0xc'));var deskjs=require(_0x172c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x172c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x172c('0xf'));var as=require(_0x172c('0x10'));var hardwareService=require(_0x172c('0x11'));var logger=require(_0x172c('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x172c('0x13'));var db=require(_0x172c('0x14'))['db'];function respondWithStatusCode(_0x46596f,_0x319a1a){_0x319a1a=_0x319a1a||0xcc;return function(_0x251718){if(_0x251718){return _0x46596f['sendStatus'](_0x319a1a);}return _0x46596f['status'](_0x319a1a)['end']();};}function respondWithResult(_0x3ec4a3,_0x4dda4e){_0x4dda4e=_0x4dda4e||0xc8;return function(_0x429b6d){if(_0x429b6d){return _0x3ec4a3[_0x172c('0x15')](_0x4dda4e)[_0x172c('0x16')](_0x429b6d);}};}function respondWithFilteredResult(_0x25dd08,_0x7341f8){return function(_0x3936b8){if(_0x3936b8){var _0x5c4858=typeof _0x7341f8[_0x172c('0x17')]===_0x172c('0x18')&&typeof _0x7341f8[_0x172c('0x19')]===_0x172c('0x18');var _0x2a5d2f=_0x3936b8[_0x172c('0x1a')];var _0x238539=_0x5c4858?0x0:_0x7341f8[_0x172c('0x17')];var _0x2fe9f1=_0x5c4858?_0x3936b8[_0x172c('0x1a')]:_0x7341f8[_0x172c('0x17')]+_0x7341f8[_0x172c('0x19')];var _0x38ca5a;if(_0x2fe9f1>=_0x2a5d2f){_0x2fe9f1=_0x2a5d2f;_0x38ca5a=0xc8;}else{_0x38ca5a=0xce;}_0x25dd08['status'](_0x38ca5a);return _0x25dd08[_0x172c('0x1b')](_0x172c('0x1c'),_0x238539+'-'+_0x2fe9f1+'/'+_0x2a5d2f)[_0x172c('0x16')](_0x3936b8);}return null;};}function patchUpdates(_0x181a0e){return function(_0xb5185e){try{jsonpatch[_0x172c('0x1d')](_0xb5185e,_0x181a0e,!![]);}catch(_0x5a5725){return BPromise[_0x172c('0x1e')](_0x5a5725);}return _0xb5185e[_0x172c('0x1f')]();};}function saveUpdates(_0x5ac6bb,_0x5941c4){return function(_0x2f6fbf){if(_0x2f6fbf){return _0x2f6fbf[_0x172c('0x20')](_0x5ac6bb)[_0x172c('0x21')](function(_0x525dd4){return _0x525dd4;});}return null;};}function removeEntity(_0x174307,_0x2a51b7){return function(_0x1e19f0){if(_0x1e19f0){return _0x1e19f0[_0x172c('0x22')]()['then'](function(){_0x174307[_0x172c('0x15')](0xcc)[_0x172c('0x23')]();});}};}function handleEntityNotFound(_0x253202,_0x2649ed){return function(_0x3af09f){if(!_0x3af09f){_0x253202['sendStatus'](0x194);}return _0x3af09f;};}function handleError(_0x42d170,_0x430fa0){_0x430fa0=_0x430fa0||0x1f4;return function(_0x4672bf){logger[_0x172c('0x24')](_0x4672bf[_0x172c('0x25')]);if(_0x4672bf[_0x172c('0x26')]){delete _0x4672bf[_0x172c('0x26')];}_0x42d170['status'](_0x430fa0)[_0x172c('0x27')](_0x4672bf);};}exports[_0x172c('0x28')]=function(_0x248dae,_0x985bce){var _0x36b960={},_0x2e2347={},_0x20877c={'count':0x0,'rows':[]};var _0xa37288=_[_0x172c('0x29')](db[_0x172c('0x2a')][_0x172c('0x2b')],function(_0x4733ed){return{'name':_0x4733ed[_0x172c('0x2c')],'type':_0x4733ed['type']['key']};});_0x2e2347['model']=_[_0x172c('0x29')](_0xa37288,'name');_0x2e2347['query']=_[_0x172c('0x2d')](_0x248dae[_0x172c('0x2e')]);_0x2e2347[_0x172c('0x2f')]=_[_0x172c('0x30')](_0x2e2347['model'],_0x2e2347[_0x172c('0x2e')]);_0x36b960['attributes']=_[_0x172c('0x30')](_0x2e2347['model'],qs['fields'](_0x248dae[_0x172c('0x2e')][_0x172c('0x31')]));_0x36b960[_0x172c('0x32')]=_0x36b960[_0x172c('0x32')][_0x172c('0x33')]?_0x36b960[_0x172c('0x32')]:_0x2e2347[_0x172c('0x34')];if(!_0x248dae[_0x172c('0x2e')]['hasOwnProperty']('nolimit')){_0x36b960['limit']=qs[_0x172c('0x19')](_0x248dae[_0x172c('0x2e')][_0x172c('0x19')]);_0x36b960[_0x172c('0x17')]=qs[_0x172c('0x17')](_0x248dae[_0x172c('0x2e')][_0x172c('0x17')]);}_0x36b960[_0x172c('0x35')]=qs[_0x172c('0x36')](_0x248dae[_0x172c('0x2e')][_0x172c('0x36')]);_0x36b960[_0x172c('0x37')]=qs[_0x172c('0x2f')](_[_0x172c('0x38')](_0x248dae[_0x172c('0x2e')],_0x2e2347[_0x172c('0x2f')]),_0xa37288);if(_0x248dae[_0x172c('0x2e')]['filter']){_0x36b960[_0x172c('0x37')]=_[_0x172c('0x39')](_0x36b960['where'],{'$or':_[_0x172c('0x29')](_0xa37288,function(_0x2dae38){if(_0x2dae38['type']!==_0x172c('0x3a')){var _0x366968={};_0x366968[_0x2dae38[_0x172c('0x26')]]={'$like':'%'+_0x248dae[_0x172c('0x2e')]['filter']+'%'};return _0x366968;}})});}_0x36b960=_[_0x172c('0x39')]({},_0x36b960,_0x248dae[_0x172c('0x3b')]);var _0x5d2d02={'where':_0x36b960[_0x172c('0x37')]};return db[_0x172c('0x2a')][_0x172c('0x1a')](_0x5d2d02)[_0x172c('0x21')](function(_0x33a4d3){_0x20877c['count']=_0x33a4d3;if(_0x248dae['query'][_0x172c('0x3c')]){_0x36b960[_0x172c('0x3d')]=[{'all':!![]}];}return db[_0x172c('0x2a')][_0x172c('0x3e')](_0x36b960);})[_0x172c('0x21')](function(_0x936388){_0x20877c[_0x172c('0x3f')]=_0x936388;return _0x20877c;})[_0x172c('0x21')](respondWithFilteredResult(_0x985bce,_0x36b960))[_0x172c('0x40')](handleError(_0x985bce,null));};exports[_0x172c('0x41')]=function(_0x3b7a33,_0x318ab9){var _0xf8e99b={'raw':![],'where':{'id':_0x3b7a33[_0x172c('0x42')]['id']}},_0x11e48a={};_0x11e48a['model']=_[_0x172c('0x2d')](db[_0x172c('0x2a')][_0x172c('0x2b')]);_0x11e48a[_0x172c('0x2e')]=_[_0x172c('0x2d')](_0x3b7a33[_0x172c('0x2e')]);_0x11e48a['filters']=_[_0x172c('0x30')](_0x11e48a[_0x172c('0x34')],_0x11e48a[_0x172c('0x2e')]);_0xf8e99b[_0x172c('0x32')]=_['intersection'](_0x11e48a[_0x172c('0x34')],qs[_0x172c('0x31')](_0x3b7a33[_0x172c('0x2e')][_0x172c('0x31')]));_0xf8e99b[_0x172c('0x32')]=_0xf8e99b[_0x172c('0x32')]['length']?_0xf8e99b['attributes']:_0x11e48a[_0x172c('0x34')];if(_0x3b7a33[_0x172c('0x2e')][_0x172c('0x3c')]){_0xf8e99b[_0x172c('0x3d')]=[{'all':!![]}];}_0xf8e99b=_[_0x172c('0x39')]({},_0xf8e99b,_0x3b7a33[_0x172c('0x3b')]);return db[_0x172c('0x2a')][_0x172c('0x43')](_0xf8e99b)[_0x172c('0x21')](handleEntityNotFound(_0x318ab9,null))['then'](respondWithResult(_0x318ab9,null))[_0x172c('0x40')](handleError(_0x318ab9,null));};exports[_0x172c('0x44')]=function(_0x75b76d,_0xd758c0){return db['SugarcrmConfiguration'][_0x172c('0x44')](_0x75b76d[_0x172c('0x45')],{})[_0x172c('0x21')](respondWithResult(_0xd758c0,0xc9))[_0x172c('0x40')](handleError(_0xd758c0,null));};exports[_0x172c('0x20')]=function(_0x5e37af,_0x33dede){if(_0x5e37af[_0x172c('0x45')]['id']){delete _0x5e37af[_0x172c('0x45')]['id'];}return db['SugarcrmConfiguration'][_0x172c('0x43')]({'where':{'id':_0x5e37af[_0x172c('0x42')]['id']}})[_0x172c('0x21')](handleEntityNotFound(_0x33dede,null))[_0x172c('0x21')](saveUpdates(_0x5e37af[_0x172c('0x45')],null))['then'](respondWithResult(_0x33dede,null))[_0x172c('0x40')](handleError(_0x33dede,null));};exports['destroy']=function(_0x1b2fe8,_0x118e6b){return db[_0x172c('0x2a')][_0x172c('0x43')]({'where':{'id':_0x1b2fe8[_0x172c('0x42')]['id']}})[_0x172c('0x21')](handleEntityNotFound(_0x118e6b,null))[_0x172c('0x21')](removeEntity(_0x118e6b,null))[_0x172c('0x40')](handleError(_0x118e6b,null));};exports[_0x172c('0x46')]=function(_0x4026ae,_0x3c7a54,_0x4a98aa){var _0x215240={};var _0x40efd4={};var _0x2ae3f1;var _0x6b7a26;return db['SugarcrmConfiguration'][_0x172c('0x47')]({'where':{'id':_0x4026ae['params']['id']}})['then'](handleEntityNotFound(_0x3c7a54,null))['then'](function(_0x30f9d4){if(_0x30f9d4){_0x2ae3f1=_0x30f9d4;_0x40efd4['model']=_[_0x172c('0x2d')](db['SugarcrmField'][_0x172c('0x2b')]);_0x40efd4[_0x172c('0x2e')]=_[_0x172c('0x2d')](_0x4026ae[_0x172c('0x2e')]);_0x40efd4[_0x172c('0x2f')]=_[_0x172c('0x30')](_0x40efd4[_0x172c('0x34')],_0x40efd4[_0x172c('0x2e')]);_0x215240['attributes']=_['intersection'](_0x40efd4[_0x172c('0x34')],qs['fields'](_0x4026ae['query'][_0x172c('0x31')]));_0x215240['attributes']=_0x215240[_0x172c('0x32')][_0x172c('0x33')]?_0x215240[_0x172c('0x32')]:_0x40efd4['model'];_0x215240['order']=qs[_0x172c('0x36')](_0x4026ae[_0x172c('0x2e')][_0x172c('0x36')]);_0x215240[_0x172c('0x37')]=qs[_0x172c('0x2f')](_[_0x172c('0x38')](_0x4026ae[_0x172c('0x2e')],_0x40efd4[_0x172c('0x2f')]));if(_0x4026ae[_0x172c('0x2e')]['filter']){_0x215240[_0x172c('0x37')]=_[_0x172c('0x39')](_0x215240[_0x172c('0x37')],{'$or':_[_0x172c('0x29')](_0x215240[_0x172c('0x32')],function(_0x205923){var _0x49c0e1={};_0x49c0e1[_0x205923]={'$like':'%'+_0x4026ae[_0x172c('0x2e')]['filter']+'%'};return _0x49c0e1;})});}_0x215240=_[_0x172c('0x39')]({},_0x215240,_0x4026ae[_0x172c('0x3b')]);return _0x2ae3f1['getFields'](_0x215240);}})['then'](function(_0x48b716){if(_0x48b716){_0x6b7a26=_0x48b716[_0x172c('0x33')];if(!_0x4026ae[_0x172c('0x2e')][_0x172c('0x48')](_0x172c('0x49'))){_0x215240[_0x172c('0x19')]=qs['limit'](_0x4026ae[_0x172c('0x2e')]['limit']);_0x215240['offset']=qs[_0x172c('0x17')](_0x4026ae[_0x172c('0x2e')][_0x172c('0x17')]);}return _0x2ae3f1[_0x172c('0x46')](_0x215240);}})[_0x172c('0x21')](function(_0x5dbc71){if(_0x5dbc71){return _0x5dbc71?{'count':_0x6b7a26,'rows':_0x5dbc71}:null;}})['then'](respondWithResult(_0x3c7a54,null))[_0x172c('0x40')](handleError(_0x3c7a54,null));};exports[_0x172c('0x4a')]=function(_0x18b959,_0x358d1c,_0x12c953){var _0xaf0b7c={};var _0x59d4d2={};var _0x3f0d6b;var _0x343271;return db['SugarcrmConfiguration'][_0x172c('0x47')]({'where':{'id':_0x18b959[_0x172c('0x42')]['id']}})[_0x172c('0x21')](handleEntityNotFound(_0x358d1c,null))['then'](function(_0x398951){if(_0x398951){_0x3f0d6b=_0x398951;_0x59d4d2[_0x172c('0x34')]=_[_0x172c('0x2d')](db[_0x172c('0x4b')][_0x172c('0x2b')]);_0x59d4d2[_0x172c('0x2e')]=_[_0x172c('0x2d')](_0x18b959[_0x172c('0x2e')]);_0x59d4d2[_0x172c('0x2f')]=_['intersection'](_0x59d4d2[_0x172c('0x34')],_0x59d4d2[_0x172c('0x2e')]);_0xaf0b7c[_0x172c('0x32')]=_[_0x172c('0x30')](_0x59d4d2['model'],qs[_0x172c('0x31')](_0x18b959[_0x172c('0x2e')]['fields']));_0xaf0b7c[_0x172c('0x32')]=_0xaf0b7c[_0x172c('0x32')]['length']?_0xaf0b7c['attributes']:_0x59d4d2[_0x172c('0x34')];_0xaf0b7c[_0x172c('0x35')]=qs['sort'](_0x18b959['query'][_0x172c('0x36')]);_0xaf0b7c[_0x172c('0x37')]=qs[_0x172c('0x2f')](_['pick'](_0x18b959[_0x172c('0x2e')],_0x59d4d2[_0x172c('0x2f')]));if(_0x18b959[_0x172c('0x2e')][_0x172c('0x4c')]){_0xaf0b7c[_0x172c('0x37')]=_[_0x172c('0x39')](_0xaf0b7c[_0x172c('0x37')],{'$or':_['map'](_0xaf0b7c['attributes'],function(_0x3ea5b0){var _0x2d4bbb={};_0x2d4bbb[_0x3ea5b0]={'$like':'%'+_0x18b959[_0x172c('0x2e')][_0x172c('0x4c')]+'%'};return _0x2d4bbb;})});}_0xaf0b7c=_['merge']({},_0xaf0b7c,_0x18b959[_0x172c('0x3b')]);return _0x3f0d6b[_0x172c('0x4a')](_0xaf0b7c);}})[_0x172c('0x21')](function(_0x1afe58){if(_0x1afe58){_0x343271=_0x1afe58[_0x172c('0x33')];if(!_0x18b959['query']['hasOwnProperty'](_0x172c('0x49'))){_0xaf0b7c['limit']=qs['limit'](_0x18b959['query']['limit']);_0xaf0b7c[_0x172c('0x17')]=qs['offset'](_0x18b959['query']['offset']);}return _0x3f0d6b[_0x172c('0x4a')](_0xaf0b7c);}})[_0x172c('0x21')](function(_0x11999a){if(_0x11999a){return _0x11999a?{'count':_0x343271,'rows':_0x11999a}:null;}})['then'](respondWithResult(_0x358d1c,null))[_0x172c('0x40')](handleError(_0x358d1c,null));};exports[_0x172c('0x4d')]=function(_0x1ea38f,_0x503502,_0x37c198){var _0x152af4={};var _0x295586={};var _0x403b27;var _0x283c70;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x1ea38f[_0x172c('0x42')]['id']}})['then'](handleEntityNotFound(_0x503502,null))[_0x172c('0x21')](function(_0x9af096){if(_0x9af096){_0x403b27=_0x9af096;_0x295586[_0x172c('0x34')]=_[_0x172c('0x2d')](db[_0x172c('0x4b')][_0x172c('0x2b')]);_0x295586['query']=_[_0x172c('0x2d')](_0x1ea38f[_0x172c('0x2e')]);_0x295586[_0x172c('0x2f')]=_[_0x172c('0x30')](_0x295586[_0x172c('0x34')],_0x295586['query']);_0x152af4['attributes']=_[_0x172c('0x30')](_0x295586[_0x172c('0x34')],qs[_0x172c('0x31')](_0x1ea38f[_0x172c('0x2e')][_0x172c('0x31')]));_0x152af4[_0x172c('0x32')]=_0x152af4['attributes']['length']?_0x152af4[_0x172c('0x32')]:_0x295586[_0x172c('0x34')];_0x152af4['order']=qs[_0x172c('0x36')](_0x1ea38f[_0x172c('0x2e')][_0x172c('0x36')]);_0x152af4[_0x172c('0x37')]=qs[_0x172c('0x2f')](_[_0x172c('0x38')](_0x1ea38f[_0x172c('0x2e')],_0x295586['filters']));if(_0x1ea38f[_0x172c('0x2e')][_0x172c('0x4c')]){_0x152af4['where']=_[_0x172c('0x39')](_0x152af4[_0x172c('0x37')],{'$or':_['map'](_0x152af4[_0x172c('0x32')],function(_0x3d41b3){var _0x3a0962={};_0x3a0962[_0x3d41b3]={'$like':'%'+_0x1ea38f['query'][_0x172c('0x4c')]+'%'};return _0x3a0962;})});}_0x152af4=_['merge']({},_0x152af4,_0x1ea38f[_0x172c('0x3b')]);return _0x403b27[_0x172c('0x4d')](_0x152af4);}})[_0x172c('0x21')](function(_0xa7a055){if(_0xa7a055){_0x283c70=_0xa7a055['length'];if(!_0x1ea38f[_0x172c('0x2e')][_0x172c('0x48')](_0x172c('0x49'))){_0x152af4[_0x172c('0x19')]=qs[_0x172c('0x19')](_0x1ea38f[_0x172c('0x2e')]['limit']);_0x152af4['offset']=qs[_0x172c('0x17')](_0x1ea38f[_0x172c('0x2e')][_0x172c('0x17')]);}return _0x403b27['getDescriptions'](_0x152af4);}})[_0x172c('0x21')](function(_0x71bb66){if(_0x71bb66){return _0x71bb66?{'count':_0x283c70,'rows':_0x71bb66}:null;}})[_0x172c('0x21')](respondWithResult(_0x503502,null))[_0x172c('0x40')](handleError(_0x503502,null));}; \ No newline at end of file +var _0xfdb8=['body','destroy','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create'];(function(_0x1ee865,_0x5c6871){var _0x567efc=function(_0x36df5f){while(--_0x36df5f){_0x1ee865['push'](_0x1ee865['shift']());}};_0x567efc(++_0x5c6871);}(_0xfdb8,0x144));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8fdb('0x0'));var rimraf=require(_0x8fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fdb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8fdb('0x3'));var Mustache=require(_0x8fdb('0x4'));var util=require(_0x8fdb('0x5'));var path=require(_0x8fdb('0x6'));var sox=require(_0x8fdb('0x7'));var csv=require('to-csv');var ejs=require(_0x8fdb('0x8'));var fs=require('fs');var fs_extra=require(_0x8fdb('0x9'));var _=require('lodash');var squel=require(_0x8fdb('0xa'));var crypto=require(_0x8fdb('0xb'));var jsforce=require(_0x8fdb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8fdb('0xd'));var querystring=require(_0x8fdb('0xe'));var Papa=require(_0x8fdb('0xf'));var Redis=require(_0x8fdb('0x10'));var authService=require(_0x8fdb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fdb('0x12'));var logger=require('../../config/logger')(_0x8fdb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8fdb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x154e84,_0x369c80){_0x369c80=_0x369c80||0xcc;return function(_0xe5ba5e){if(_0xe5ba5e){return _0x154e84[_0x8fdb('0x15')](_0x369c80);}return _0x154e84[_0x8fdb('0x16')](_0x369c80)['end']();};}function respondWithResult(_0x2557bb,_0x1d0a3a){_0x1d0a3a=_0x1d0a3a||0xc8;return function(_0x4ec74b){if(_0x4ec74b){return _0x2557bb[_0x8fdb('0x16')](_0x1d0a3a)['json'](_0x4ec74b);}};}function respondWithFilteredResult(_0x46d910,_0x14b3ff){return function(_0x196621){if(_0x196621){var _0x3b3a58=typeof _0x14b3ff[_0x8fdb('0x17')]===_0x8fdb('0x18')&&typeof _0x14b3ff[_0x8fdb('0x19')]===_0x8fdb('0x18');var _0x5e3c9e=_0x196621[_0x8fdb('0x1a')];var _0x123b38=_0x3b3a58?0x0:_0x14b3ff[_0x8fdb('0x17')];var _0x6eb971=_0x3b3a58?_0x196621[_0x8fdb('0x1a')]:_0x14b3ff[_0x8fdb('0x17')]+_0x14b3ff['limit'];var _0x2dc638;if(_0x6eb971>=_0x5e3c9e){_0x6eb971=_0x5e3c9e;_0x2dc638=0xc8;}else{_0x2dc638=0xce;}_0x46d910[_0x8fdb('0x16')](_0x2dc638);return _0x46d910[_0x8fdb('0x1b')](_0x8fdb('0x1c'),_0x123b38+'-'+_0x6eb971+'/'+_0x5e3c9e)[_0x8fdb('0x1d')](_0x196621);}return null;};}function patchUpdates(_0x187779){return function(_0x2234f0){try{jsonpatch[_0x8fdb('0x1e')](_0x2234f0,_0x187779,!![]);}catch(_0x29ce9a){return BPromise[_0x8fdb('0x1f')](_0x29ce9a);}return _0x2234f0[_0x8fdb('0x20')]();};}function saveUpdates(_0x1553a8,_0x2ecc81){return function(_0x42d485){if(_0x42d485){return _0x42d485[_0x8fdb('0x21')](_0x1553a8)[_0x8fdb('0x22')](function(_0x45ac86){return _0x45ac86;});}return null;};}function removeEntity(_0x34327f,_0x2c5973){return function(_0x44b4ec){if(_0x44b4ec){return _0x44b4ec['destroy']()['then'](function(){_0x34327f[_0x8fdb('0x16')](0xcc)[_0x8fdb('0x23')]();});}};}function handleEntityNotFound(_0x18949d,_0x4cc529){return function(_0x563949){if(!_0x563949){_0x18949d[_0x8fdb('0x15')](0x194);}return _0x563949;};}function handleError(_0x5f18de,_0xdd3113){_0xdd3113=_0xdd3113||0x1f4;return function(_0x52b3fd){logger[_0x8fdb('0x24')](_0x52b3fd[_0x8fdb('0x25')]);if(_0x52b3fd['name']){delete _0x52b3fd[_0x8fdb('0x26')];}_0x5f18de['status'](_0xdd3113)[_0x8fdb('0x27')](_0x52b3fd);};}exports[_0x8fdb('0x28')]=function(_0x5b4b90,_0x4d6700){var _0x431383={},_0xff8712={},_0x250315={'count':0x0,'rows':[]};var _0x3f92ba=_[_0x8fdb('0x29')](db[_0x8fdb('0x2a')][_0x8fdb('0x2b')],function(_0x58d986){return{'name':_0x58d986[_0x8fdb('0x2c')],'type':_0x58d986['type'][_0x8fdb('0x2d')]};});_0xff8712['model']=_[_0x8fdb('0x29')](_0x3f92ba,_0x8fdb('0x26'));_0xff8712[_0x8fdb('0x2e')]=_[_0x8fdb('0x2f')](_0x5b4b90['query']);_0xff8712['filters']=_[_0x8fdb('0x30')](_0xff8712[_0x8fdb('0x31')],_0xff8712[_0x8fdb('0x2e')]);_0x431383[_0x8fdb('0x32')]=_[_0x8fdb('0x30')](_0xff8712[_0x8fdb('0x31')],qs[_0x8fdb('0x33')](_0x5b4b90[_0x8fdb('0x2e')][_0x8fdb('0x33')]));_0x431383[_0x8fdb('0x32')]=_0x431383[_0x8fdb('0x32')][_0x8fdb('0x34')]?_0x431383[_0x8fdb('0x32')]:_0xff8712[_0x8fdb('0x31')];if(!_0x5b4b90[_0x8fdb('0x2e')][_0x8fdb('0x35')](_0x8fdb('0x36'))){_0x431383[_0x8fdb('0x19')]=qs[_0x8fdb('0x19')](_0x5b4b90[_0x8fdb('0x2e')][_0x8fdb('0x19')]);_0x431383['offset']=qs[_0x8fdb('0x17')](_0x5b4b90[_0x8fdb('0x2e')][_0x8fdb('0x17')]);}_0x431383['order']=qs[_0x8fdb('0x37')](_0x5b4b90['query']['sort']);_0x431383['where']=qs[_0x8fdb('0x38')](_[_0x8fdb('0x39')](_0x5b4b90[_0x8fdb('0x2e')],_0xff8712[_0x8fdb('0x38')]),_0x3f92ba);if(_0x5b4b90[_0x8fdb('0x2e')][_0x8fdb('0x3a')]){_0x431383[_0x8fdb('0x3b')]=_[_0x8fdb('0x3c')](_0x431383[_0x8fdb('0x3b')],{'$or':_[_0x8fdb('0x29')](_0x3f92ba,function(_0x5b23d0){if(_0x5b23d0['type']!==_0x8fdb('0x3d')){var _0x46385e={};_0x46385e[_0x5b23d0[_0x8fdb('0x26')]]={'$like':'%'+_0x5b4b90[_0x8fdb('0x2e')][_0x8fdb('0x3a')]+'%'};return _0x46385e;}})});}_0x431383=_['merge']({},_0x431383,_0x5b4b90[_0x8fdb('0x3e')]);var _0x2b223a={'where':_0x431383[_0x8fdb('0x3b')]};return db[_0x8fdb('0x2a')][_0x8fdb('0x1a')](_0x2b223a)[_0x8fdb('0x22')](function(_0x110716){_0x250315[_0x8fdb('0x1a')]=_0x110716;if(_0x5b4b90[_0x8fdb('0x2e')]['includeAll']){_0x431383[_0x8fdb('0x3f')]=[{'all':!![]}];}return db[_0x8fdb('0x2a')]['findAll'](_0x431383);})[_0x8fdb('0x22')](function(_0x480ccd){_0x250315[_0x8fdb('0x40')]=_0x480ccd;return _0x250315;})[_0x8fdb('0x22')](respondWithFilteredResult(_0x4d6700,_0x431383))['catch'](handleError(_0x4d6700,null));};exports[_0x8fdb('0x41')]=function(_0x534944,_0x2ced65){var _0x4b93b3={'raw':![],'where':{'id':_0x534944[_0x8fdb('0x42')]['id']}},_0x6d205c={};_0x6d205c[_0x8fdb('0x31')]=_[_0x8fdb('0x2f')](db['SugarcrmConfiguration']['rawAttributes']);_0x6d205c[_0x8fdb('0x2e')]=_[_0x8fdb('0x2f')](_0x534944[_0x8fdb('0x2e')]);_0x6d205c[_0x8fdb('0x38')]=_[_0x8fdb('0x30')](_0x6d205c[_0x8fdb('0x31')],_0x6d205c[_0x8fdb('0x2e')]);_0x4b93b3[_0x8fdb('0x32')]=_[_0x8fdb('0x30')](_0x6d205c['model'],qs[_0x8fdb('0x33')](_0x534944[_0x8fdb('0x2e')][_0x8fdb('0x33')]));_0x4b93b3['attributes']=_0x4b93b3[_0x8fdb('0x32')][_0x8fdb('0x34')]?_0x4b93b3['attributes']:_0x6d205c[_0x8fdb('0x31')];if(_0x534944['query'][_0x8fdb('0x43')]){_0x4b93b3[_0x8fdb('0x3f')]=[{'all':!![]}];}_0x4b93b3=_[_0x8fdb('0x3c')]({},_0x4b93b3,_0x534944['options']);return db[_0x8fdb('0x2a')][_0x8fdb('0x44')](_0x4b93b3)[_0x8fdb('0x22')](handleEntityNotFound(_0x2ced65,null))[_0x8fdb('0x22')](respondWithResult(_0x2ced65,null))[_0x8fdb('0x45')](handleError(_0x2ced65,null));};exports[_0x8fdb('0x46')]=function(_0x89036e,_0x448be2){return db[_0x8fdb('0x2a')][_0x8fdb('0x46')](_0x89036e[_0x8fdb('0x47')],{})[_0x8fdb('0x22')](respondWithResult(_0x448be2,0xc9))[_0x8fdb('0x45')](handleError(_0x448be2,null));};exports['update']=function(_0x2001cb,_0x44b6f4){if(_0x2001cb['body']['id']){delete _0x2001cb[_0x8fdb('0x47')]['id'];}return db['SugarcrmConfiguration'][_0x8fdb('0x44')]({'where':{'id':_0x2001cb[_0x8fdb('0x42')]['id']}})[_0x8fdb('0x22')](handleEntityNotFound(_0x44b6f4,null))[_0x8fdb('0x22')](saveUpdates(_0x2001cb[_0x8fdb('0x47')],null))[_0x8fdb('0x22')](respondWithResult(_0x44b6f4,null))[_0x8fdb('0x45')](handleError(_0x44b6f4,null));};exports[_0x8fdb('0x48')]=function(_0x436d6d,_0x2be8ab){return db['SugarcrmConfiguration'][_0x8fdb('0x44')]({'where':{'id':_0x436d6d[_0x8fdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x2be8ab,null))[_0x8fdb('0x22')](removeEntity(_0x2be8ab,null))[_0x8fdb('0x45')](handleError(_0x2be8ab,null));};exports[_0x8fdb('0x49')]=function(_0x179502,_0x323711,_0x16cbdc){var _0x32bd0c={};var _0x41ee58={};var _0x2ed209;var _0xe97d7c;return db[_0x8fdb('0x2a')][_0x8fdb('0x4a')]({'where':{'id':_0x179502['params']['id']}})[_0x8fdb('0x22')](handleEntityNotFound(_0x323711,null))['then'](function(_0x5a4f43){if(_0x5a4f43){_0x2ed209=_0x5a4f43;_0x41ee58[_0x8fdb('0x31')]=_[_0x8fdb('0x2f')](db[_0x8fdb('0x4b')]['rawAttributes']);_0x41ee58[_0x8fdb('0x2e')]=_['keys'](_0x179502[_0x8fdb('0x2e')]);_0x41ee58[_0x8fdb('0x38')]=_[_0x8fdb('0x30')](_0x41ee58[_0x8fdb('0x31')],_0x41ee58['query']);_0x32bd0c[_0x8fdb('0x32')]=_[_0x8fdb('0x30')](_0x41ee58[_0x8fdb('0x31')],qs[_0x8fdb('0x33')](_0x179502[_0x8fdb('0x2e')][_0x8fdb('0x33')]));_0x32bd0c[_0x8fdb('0x32')]=_0x32bd0c[_0x8fdb('0x32')]['length']?_0x32bd0c[_0x8fdb('0x32')]:_0x41ee58[_0x8fdb('0x31')];_0x32bd0c[_0x8fdb('0x4c')]=qs[_0x8fdb('0x37')](_0x179502[_0x8fdb('0x2e')]['sort']);_0x32bd0c['where']=qs['filters'](_[_0x8fdb('0x39')](_0x179502[_0x8fdb('0x2e')],_0x41ee58[_0x8fdb('0x38')]));if(_0x179502[_0x8fdb('0x2e')][_0x8fdb('0x3a')]){_0x32bd0c[_0x8fdb('0x3b')]=_[_0x8fdb('0x3c')](_0x32bd0c[_0x8fdb('0x3b')],{'$or':_[_0x8fdb('0x29')](_0x32bd0c['attributes'],function(_0x173169){var _0x1d179a={};_0x1d179a[_0x173169]={'$like':'%'+_0x179502[_0x8fdb('0x2e')][_0x8fdb('0x3a')]+'%'};return _0x1d179a;})});}_0x32bd0c=_[_0x8fdb('0x3c')]({},_0x32bd0c,_0x179502[_0x8fdb('0x3e')]);return _0x2ed209[_0x8fdb('0x49')](_0x32bd0c);}})[_0x8fdb('0x22')](function(_0x279e21){if(_0x279e21){_0xe97d7c=_0x279e21['length'];if(!_0x179502['query'][_0x8fdb('0x35')]('nolimit')){_0x32bd0c['limit']=qs[_0x8fdb('0x19')](_0x179502['query'][_0x8fdb('0x19')]);_0x32bd0c['offset']=qs[_0x8fdb('0x17')](_0x179502[_0x8fdb('0x2e')][_0x8fdb('0x17')]);}return _0x2ed209[_0x8fdb('0x49')](_0x32bd0c);}})[_0x8fdb('0x22')](function(_0x286f2a){if(_0x286f2a){return _0x286f2a?{'count':_0xe97d7c,'rows':_0x286f2a}:null;}})[_0x8fdb('0x22')](respondWithResult(_0x323711,null))[_0x8fdb('0x45')](handleError(_0x323711,null));};exports['getSubjects']=function(_0x2ba074,_0x1dc963,_0x1c1815){var _0x5e14d4={};var _0x4a1967={};var _0x533b72;var _0x289032;return db[_0x8fdb('0x2a')][_0x8fdb('0x4a')]({'where':{'id':_0x2ba074['params']['id']}})[_0x8fdb('0x22')](handleEntityNotFound(_0x1dc963,null))[_0x8fdb('0x22')](function(_0x26d2fb){if(_0x26d2fb){_0x533b72=_0x26d2fb;_0x4a1967[_0x8fdb('0x31')]=_['keys'](db[_0x8fdb('0x4b')]['rawAttributes']);_0x4a1967[_0x8fdb('0x2e')]=_[_0x8fdb('0x2f')](_0x2ba074['query']);_0x4a1967[_0x8fdb('0x38')]=_[_0x8fdb('0x30')](_0x4a1967['model'],_0x4a1967[_0x8fdb('0x2e')]);_0x5e14d4['attributes']=_[_0x8fdb('0x30')](_0x4a1967['model'],qs[_0x8fdb('0x33')](_0x2ba074[_0x8fdb('0x2e')][_0x8fdb('0x33')]));_0x5e14d4['attributes']=_0x5e14d4['attributes']['length']?_0x5e14d4[_0x8fdb('0x32')]:_0x4a1967[_0x8fdb('0x31')];_0x5e14d4[_0x8fdb('0x4c')]=qs[_0x8fdb('0x37')](_0x2ba074[_0x8fdb('0x2e')][_0x8fdb('0x37')]);_0x5e14d4[_0x8fdb('0x3b')]=qs[_0x8fdb('0x38')](_[_0x8fdb('0x39')](_0x2ba074[_0x8fdb('0x2e')],_0x4a1967[_0x8fdb('0x38')]));if(_0x2ba074['query']['filter']){_0x5e14d4['where']=_[_0x8fdb('0x3c')](_0x5e14d4[_0x8fdb('0x3b')],{'$or':_[_0x8fdb('0x29')](_0x5e14d4[_0x8fdb('0x32')],function(_0x305ba6){var _0x4ccc3d={};_0x4ccc3d[_0x305ba6]={'$like':'%'+_0x2ba074[_0x8fdb('0x2e')]['filter']+'%'};return _0x4ccc3d;})});}_0x5e14d4=_[_0x8fdb('0x3c')]({},_0x5e14d4,_0x2ba074[_0x8fdb('0x3e')]);return _0x533b72[_0x8fdb('0x4d')](_0x5e14d4);}})[_0x8fdb('0x22')](function(_0x58353a){if(_0x58353a){_0x289032=_0x58353a[_0x8fdb('0x34')];if(!_0x2ba074[_0x8fdb('0x2e')]['hasOwnProperty'](_0x8fdb('0x36'))){_0x5e14d4['limit']=qs[_0x8fdb('0x19')](_0x2ba074[_0x8fdb('0x2e')][_0x8fdb('0x19')]);_0x5e14d4[_0x8fdb('0x17')]=qs[_0x8fdb('0x17')](_0x2ba074['query'][_0x8fdb('0x17')]);}return _0x533b72['getSubjects'](_0x5e14d4);}})['then'](function(_0x28bcfd){if(_0x28bcfd){return _0x28bcfd?{'count':_0x289032,'rows':_0x28bcfd}:null;}})[_0x8fdb('0x22')](respondWithResult(_0x1dc963,null))['catch'](handleError(_0x1dc963,null));};exports[_0x8fdb('0x4e')]=function(_0x3dd736,_0x37773e,_0xf63ff5){var _0x3b7f3f={};var _0x3a89c2={};var _0x15bbb5;var _0x498c95;return db[_0x8fdb('0x2a')][_0x8fdb('0x4a')]({'where':{'id':_0x3dd736[_0x8fdb('0x42')]['id']}})[_0x8fdb('0x22')](handleEntityNotFound(_0x37773e,null))[_0x8fdb('0x22')](function(_0x1e4345){if(_0x1e4345){_0x15bbb5=_0x1e4345;_0x3a89c2[_0x8fdb('0x31')]=_['keys'](db[_0x8fdb('0x4b')]['rawAttributes']);_0x3a89c2[_0x8fdb('0x2e')]=_[_0x8fdb('0x2f')](_0x3dd736[_0x8fdb('0x2e')]);_0x3a89c2[_0x8fdb('0x38')]=_[_0x8fdb('0x30')](_0x3a89c2[_0x8fdb('0x31')],_0x3a89c2[_0x8fdb('0x2e')]);_0x3b7f3f['attributes']=_[_0x8fdb('0x30')](_0x3a89c2[_0x8fdb('0x31')],qs['fields'](_0x3dd736[_0x8fdb('0x2e')][_0x8fdb('0x33')]));_0x3b7f3f[_0x8fdb('0x32')]=_0x3b7f3f['attributes'][_0x8fdb('0x34')]?_0x3b7f3f[_0x8fdb('0x32')]:_0x3a89c2[_0x8fdb('0x31')];_0x3b7f3f[_0x8fdb('0x4c')]=qs[_0x8fdb('0x37')](_0x3dd736['query'][_0x8fdb('0x37')]);_0x3b7f3f[_0x8fdb('0x3b')]=qs[_0x8fdb('0x38')](_[_0x8fdb('0x39')](_0x3dd736[_0x8fdb('0x2e')],_0x3a89c2[_0x8fdb('0x38')]));if(_0x3dd736['query'][_0x8fdb('0x3a')]){_0x3b7f3f['where']=_[_0x8fdb('0x3c')](_0x3b7f3f[_0x8fdb('0x3b')],{'$or':_[_0x8fdb('0x29')](_0x3b7f3f['attributes'],function(_0x47d844){var _0x5384ef={};_0x5384ef[_0x47d844]={'$like':'%'+_0x3dd736[_0x8fdb('0x2e')]['filter']+'%'};return _0x5384ef;})});}_0x3b7f3f=_['merge']({},_0x3b7f3f,_0x3dd736[_0x8fdb('0x3e')]);return _0x15bbb5[_0x8fdb('0x4e')](_0x3b7f3f);}})[_0x8fdb('0x22')](function(_0x40dd8c){if(_0x40dd8c){_0x498c95=_0x40dd8c[_0x8fdb('0x34')];if(!_0x3dd736[_0x8fdb('0x2e')]['hasOwnProperty']('nolimit')){_0x3b7f3f[_0x8fdb('0x19')]=qs[_0x8fdb('0x19')](_0x3dd736[_0x8fdb('0x2e')][_0x8fdb('0x19')]);_0x3b7f3f['offset']=qs[_0x8fdb('0x17')](_0x3dd736[_0x8fdb('0x2e')][_0x8fdb('0x17')]);}return _0x15bbb5['getDescriptions'](_0x3b7f3f);}})[_0x8fdb('0x22')](function(_0x408e1d){if(_0x408e1d){return _0x408e1d?{'count':_0x498c95,'rows':_0x408e1d}:null;}})[_0x8fdb('0x22')](respondWithResult(_0x37773e,null))['catch'](handleError(_0x37773e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f43e4b4..55f981b 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 _0xf865=['api','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x2a7354,_0xb8b565){var _0x2b2797=function(_0x12e21e){while(--_0x12e21e){_0x2a7354['push'](_0x2a7354['shift']());}};_0x2b2797(++_0xb8b565);}(_0xf865,0x1ed));var _0x5f86=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xf865[_0x11b1b3];return _0x437029;};'use strict';var _=require('lodash');var util=require(_0x5f86('0x0'));var logger=require(_0x5f86('0x1'))(_0x5f86('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f86('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f86('0x4'));var config=require(_0x5f86('0x5'));var attributes=require(_0x5f86('0x6'));module[_0x5f86('0x7')]=function(_0x378455,_0x4bf0c5){return _0x378455[_0x5f86('0x8')](_0x5f86('0x9'),attributes,{'tableName':_0x5f86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c13=['bluebird','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment'];(function(_0xbf6bdf,_0x2bac06){var _0x542316=function(_0x269dbc){while(--_0x269dbc){_0xbf6bdf['push'](_0xbf6bdf['shift']());}};_0x542316(++_0x2bac06);}(_0x4c13,0xe3));var _0x34c1=function(_0x4e9795,_0x434f9e){_0x4e9795=_0x4e9795-0x0;var _0x32ca2d=_0x4c13[_0x4e9795];return _0x32ca2d;};'use strict';var _=require(_0x34c1('0x0'));var util=require(_0x34c1('0x1'));var logger=require('../../config/logger')(_0x34c1('0x2'));var moment=require(_0x34c1('0x3'));var BPromise=require(_0x34c1('0x4'));var rp=require(_0x34c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x34c1('0x6'));var attributes=require(_0x34c1('0x7'));module[_0x34c1('0x8')]=function(_0x14c720,_0x5272ee){return _0x14c720['define'](_0x34c1('0x9'),attributes,{'tableName':_0x34c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index e4bf1e4..b0d7c5b 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 _0x3532=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x94d4d7,_0x33c5f7){var _0x169211=function(_0xacb266){while(--_0xacb266){_0x94d4d7['push'](_0x94d4d7['shift']());}};_0x169211(++_0x33c5f7);}(_0x3532,0x1ac));var _0x2353=function(_0x2fc010,_0xd39c5f){_0x2fc010=_0x2fc010-0x0;var _0x168281=_0x3532[_0x2fc010];return _0x168281;};'use strict';var _=require(_0x2353('0x0'));var util=require(_0x2353('0x1'));var moment=require(_0x2353('0x2'));var BPromise=require(_0x2353('0x3'));var rs=require(_0x2353('0x4'));var fs=require('fs');var Redis=require(_0x2353('0x5'));var db=require(_0x2353('0x6'))['db'];var utils=require(_0x2353('0x7'));var logger=require(_0x2353('0x8'))(_0x2353('0x9'));var config=require(_0x2353('0xa'));var jayson=require(_0x2353('0xb'));var client=jayson[_0x2353('0xc')][_0x2353('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x56aef9,_0x4987a2,_0x2c1e0b){return new BPromise(function(_0x5d4b29,_0x49d079){return client[_0x2353('0xe')](_0x56aef9,_0x2c1e0b)[_0x2353('0xf')](function(_0xd901fe){logger[_0x2353('0x10')](_0x2353('0x11'),_0x4987a2,_0x2353('0x12'));logger[_0x2353('0x13')](_0x2353('0x14'),_0x4987a2,_0x2353('0x12'),JSON[_0x2353('0x15')](_0xd901fe));if(_0xd901fe[_0x2353('0x16')]){if(_0xd901fe[_0x2353('0x16')][_0x2353('0x17')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4987a2,_0xd901fe[_0x2353('0x16')][_0x2353('0x18')]);return _0x49d079(_0xd901fe[_0x2353('0x16')][_0x2353('0x18')]);}logger['error'](_0x2353('0x11'),_0x4987a2,_0xd901fe[_0x2353('0x16')][_0x2353('0x18')]);return _0x5d4b29(_0xd901fe['error'][_0x2353('0x18')]);}else{logger[_0x2353('0x10')](_0x2353('0x11'),_0x4987a2,_0x2353('0x12'));_0x5d4b29(_0xd901fe[_0x2353('0x19')][_0x2353('0x18')]);}})['catch'](function(_0xe68775){logger[_0x2353('0x16')](_0x2353('0x11'),_0x4987a2,_0xe68775);_0x49d079(_0xe68775);});});} \ No newline at end of file +var _0xf7c7=['then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x248e85,_0x313681){var _0x1923b4=function(_0x191295){while(--_0x191295){_0x248e85['push'](_0x248e85['shift']());}};_0x1923b4(++_0x313681);}(_0xf7c7,0x183));var _0x7f7c=function(_0x433f86,_0x5a0175){_0x433f86=_0x433f86-0x0;var _0x3767a5=_0xf7c7[_0x433f86];return _0x3767a5;};'use strict';var _=require('lodash');var util=require(_0x7f7c('0x0'));var moment=require(_0x7f7c('0x1'));var BPromise=require(_0x7f7c('0x2'));var rs=require(_0x7f7c('0x3'));var fs=require('fs');var Redis=require(_0x7f7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f7c('0x5'))(_0x7f7c('0x6'));var config=require(_0x7f7c('0x7'));var jayson=require(_0x7f7c('0x8'));var client=jayson[_0x7f7c('0x9')][_0x7f7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475920,_0x5e7d6a,_0x459998){return new BPromise(function(_0x562144,_0x3c7251){return client[_0x7f7c('0xb')](_0x475920,_0x459998)[_0x7f7c('0xc')](function(_0x22aeff){logger[_0x7f7c('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e7d6a,_0x7f7c('0xe'));logger['debug'](_0x7f7c('0xf'),_0x5e7d6a,_0x7f7c('0xe'),JSON['stringify'](_0x22aeff));if(_0x22aeff[_0x7f7c('0x10')]){if(_0x22aeff[_0x7f7c('0x10')][_0x7f7c('0x11')]===0x1f4){logger[_0x7f7c('0x10')](_0x7f7c('0x12'),_0x5e7d6a,_0x22aeff[_0x7f7c('0x10')][_0x7f7c('0x13')]);return _0x3c7251(_0x22aeff[_0x7f7c('0x10')][_0x7f7c('0x13')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e7d6a,_0x22aeff[_0x7f7c('0x10')][_0x7f7c('0x13')]);return _0x562144(_0x22aeff[_0x7f7c('0x10')]['message']);}else{logger[_0x7f7c('0xd')](_0x7f7c('0x12'),_0x5e7d6a,_0x7f7c('0xe'));_0x562144(_0x22aeff['result'][_0x7f7c('0x13')]);}})[_0x7f7c('0x14')](function(_0x594b50){logger[_0x7f7c('0x10')](_0x7f7c('0x12'),_0x5e7d6a,_0x594b50);_0x3c7251(_0x594b50);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 566c565..de57b19 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 _0xe4c0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout'];(function(_0x4b5dad,_0x208a09){var _0x7f0578=function(_0x17dbd2){while(--_0x17dbd2){_0x4b5dad['push'](_0x4b5dad['shift']());}};_0x7f0578(++_0x208a09);}(_0xe4c0,0x9d));var _0x0e4c=function(_0x1c3e42,_0x1a4fe9){_0x1c3e42=_0x1c3e42-0x0;var _0x348fdc=_0xe4c0[_0x1c3e42];return _0x348fdc;};'use strict';var multer=require(_0x0e4c('0x0'));var util=require('util');var path=require(_0x0e4c('0x1'));var timeout=require(_0x0e4c('0x2'));var express=require(_0x0e4c('0x3'));var router=express[_0x0e4c('0x4')]();var fs_extra=require(_0x0e4c('0x5'));var auth=require(_0x0e4c('0x6'));var interaction=require(_0x0e4c('0x7'));var config=require(_0x0e4c('0x8'));var controller=require(_0x0e4c('0x9'));router[_0x0e4c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0e4c('0xa')]('/:id',auth[_0x0e4c('0xb')](),controller[_0x0e4c('0xc')]);router[_0x0e4c('0xd')]('/',auth[_0x0e4c('0xb')](),controller[_0x0e4c('0xe')]);router[_0x0e4c('0xf')](_0x0e4c('0x10'),auth[_0x0e4c('0xb')](),controller[_0x0e4c('0x11')]);router['delete'](_0x0e4c('0x10'),auth[_0x0e4c('0xb')](),controller[_0x0e4c('0x12')]);module[_0x0e4c('0x13')]=router; \ No newline at end of file +var _0xce3b=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x560182,_0x4a76d2){var _0x3737d9=function(_0x39e685){while(--_0x39e685){_0x560182['push'](_0x560182['shift']());}};_0x3737d9(++_0x4a76d2);}(_0xce3b,0x123));var _0xbce3=function(_0x185672,_0x300c61){_0x185672=_0x185672-0x0;var _0x18d6a7=_0xce3b[_0x185672];return _0x18d6a7;};'use strict';var multer=require(_0xbce3('0x0'));var util=require(_0xbce3('0x1'));var path=require(_0xbce3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbce3('0x3'));var router=express[_0xbce3('0x4')]();var fs_extra=require(_0xbce3('0x5'));var auth=require(_0xbce3('0x6'));var interaction=require(_0xbce3('0x7'));var config=require(_0xbce3('0x8'));var controller=require(_0xbce3('0x9'));router[_0xbce3('0xa')]('/',auth[_0xbce3('0xb')](),controller[_0xbce3('0xc')]);router['get'](_0xbce3('0xd'),auth['isAuthenticated'](),controller[_0xbce3('0xe')]);router['post']('/',auth[_0xbce3('0xb')](),controller[_0xbce3('0xf')]);router[_0xbce3('0x10')](_0xbce3('0xd'),auth[_0xbce3('0xb')](),controller[_0xbce3('0x11')]);router[_0xbce3('0x12')]('/:id',auth[_0xbce3('0xb')](),controller[_0xbce3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8fd2a1a..9298e61 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 _0x5bc4=['picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x290fb9,_0xbc4966){var _0x289d53=function(_0x47eb0a){while(--_0x47eb0a){_0x290fb9['push'](_0x290fb9['shift']());}};_0x289d53(++_0xbc4966);}(_0x5bc4,0x1ec));var _0x45bc=function(_0x13b296,_0x41ac87){_0x13b296=_0x13b296-0x0;var _0x3900ae=_0x5bc4[_0x13b296];return _0x3900ae;};'use strict';var Sequelize=require(_0x45bc('0x0'));module[_0x45bc('0x1')]={'type':{'type':Sequelize[_0x45bc('0x2')](_0x45bc('0x3'),_0x45bc('0x4'),'customVariable','keyValue',_0x45bc('0x5')),'defaultValue':_0x45bc('0x3')},'content':{'type':Sequelize[_0x45bc('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x45bc('0x2')](_0x45bc('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x45bc('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45bc('0x6')]}}; \ No newline at end of file +var _0xd8f1=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xd8f1,0xa8));var _0x1d8f=function(_0x264806,_0x5efe45){_0x264806=_0x264806-0x0;var _0x4c2a37=_0xd8f1[_0x264806];return _0x4c2a37;};'use strict';var Sequelize=require(_0x1d8f('0x0'));module[_0x1d8f('0x1')]={'type':{'type':Sequelize[_0x1d8f('0x2')](_0x1d8f('0x3'),_0x1d8f('0x4'),_0x1d8f('0x5'),_0x1d8f('0x6'),_0x1d8f('0x7')),'defaultValue':_0x1d8f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1d8f('0x8')]},'keyType':{'type':Sequelize[_0x1d8f('0x2')](_0x1d8f('0x3'),_0x1d8f('0x4'),_0x1d8f('0x5'))},'keyContent':{'type':Sequelize[_0x1d8f('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1d8f('0x8')]},'customField':{'type':Sequelize[_0x1d8f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d8f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d790a2c..5e02e25 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 _0x97ed=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filters','filter','VIRTUAL','merge','options','SugarcrmField','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','json'];(function(_0xbeb707,_0x13afb8){var _0x8eaa63=function(_0x39ee5e){while(--_0x39ee5e){_0xbeb707['push'](_0xbeb707['shift']());}};_0x8eaa63(++_0x13afb8);}(_0x97ed,0x153));var _0xd97e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x97ed[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xd97e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd97e('0x1'));var jsonpatch=require(_0xd97e('0x2'));var rp=require(_0xd97e('0x3'));var moment=require('moment');var BPromise=require(_0xd97e('0x4'));var Mustache=require(_0xd97e('0x5'));var util=require(_0xd97e('0x6'));var path=require('path');var sox=require(_0xd97e('0x7'));var csv=require(_0xd97e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd97e('0x9'));var _=require('lodash');var squel=require(_0xd97e('0xa'));var crypto=require(_0xd97e('0xb'));var jsforce=require(_0xd97e('0xc'));var deskjs=require(_0xd97e('0xd'));var toCsv=require(_0xd97e('0x8'));var querystring=require(_0xd97e('0xe'));var Papa=require(_0xd97e('0xf'));var Redis=require(_0xd97e('0x10'));var authService=require(_0xd97e('0x11'));var qs=require(_0xd97e('0x12'));var as=require(_0xd97e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd97e('0x14'))(_0xd97e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd97e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb06247,_0x52249f){_0x52249f=_0x52249f||0xcc;return function(_0x1507cc){if(_0x1507cc){return _0xb06247[_0xd97e('0x17')](_0x52249f);}return _0xb06247[_0xd97e('0x18')](_0x52249f)['end']();};}function respondWithResult(_0x4f2b66,_0x2aa1da){_0x2aa1da=_0x2aa1da||0xc8;return function(_0x1f732d){if(_0x1f732d){return _0x4f2b66[_0xd97e('0x18')](_0x2aa1da)[_0xd97e('0x19')](_0x1f732d);}};}function respondWithFilteredResult(_0x44db8c,_0x3c6ff1){return function(_0x3166f8){if(_0x3166f8){var _0x20b727=typeof _0x3c6ff1[_0xd97e('0x1a')]===_0xd97e('0x1b')&&typeof _0x3c6ff1[_0xd97e('0x1c')]===_0xd97e('0x1b');var _0x57fc80=_0x3166f8[_0xd97e('0x1d')];var _0x47b8e7=_0x20b727?0x0:_0x3c6ff1['offset'];var _0x51a1af=_0x20b727?_0x3166f8[_0xd97e('0x1d')]:_0x3c6ff1[_0xd97e('0x1a')]+_0x3c6ff1[_0xd97e('0x1c')];var _0xf29619;if(_0x51a1af>=_0x57fc80){_0x51a1af=_0x57fc80;_0xf29619=0xc8;}else{_0xf29619=0xce;}_0x44db8c[_0xd97e('0x18')](_0xf29619);return _0x44db8c[_0xd97e('0x1e')](_0xd97e('0x1f'),_0x47b8e7+'-'+_0x51a1af+'/'+_0x57fc80)[_0xd97e('0x19')](_0x3166f8);}return null;};}function patchUpdates(_0x47d826){return function(_0x57042d){try{jsonpatch[_0xd97e('0x20')](_0x57042d,_0x47d826,!![]);}catch(_0x3294f8){return BPromise[_0xd97e('0x21')](_0x3294f8);}return _0x57042d[_0xd97e('0x22')]();};}function saveUpdates(_0x57083e,_0x9a44ed){return function(_0x55d1c5){if(_0x55d1c5){return _0x55d1c5[_0xd97e('0x23')](_0x57083e)[_0xd97e('0x24')](function(_0xaa8cd8){return _0xaa8cd8;});}return null;};}function removeEntity(_0x5a1a22,_0x53a52f){return function(_0x159022){if(_0x159022){return _0x159022[_0xd97e('0x25')]()[_0xd97e('0x24')](function(){_0x5a1a22[_0xd97e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16faaa,_0x1b1e74){return function(_0x1f5d29){if(!_0x1f5d29){_0x16faaa[_0xd97e('0x17')](0x194);}return _0x1f5d29;};}function handleError(_0x428cab,_0x5b4296){_0x5b4296=_0x5b4296||0x1f4;return function(_0x366dd3){logger[_0xd97e('0x26')](_0x366dd3[_0xd97e('0x27')]);if(_0x366dd3[_0xd97e('0x28')]){delete _0x366dd3[_0xd97e('0x28')];}_0x428cab['status'](_0x5b4296)[_0xd97e('0x29')](_0x366dd3);};}exports[_0xd97e('0x2a')]=function(_0x714392,_0x199a13){var _0x36ac08={},_0x31901d={},_0xba6129={'count':0x0,'rows':[]};var _0x1a4fa0=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x32ad80){return{'name':_0x32ad80[_0xd97e('0x2b')],'type':_0x32ad80[_0xd97e('0x2c')]['key']};});_0x31901d[_0xd97e('0x2d')]=_[_0xd97e('0x2e')](_0x1a4fa0,_0xd97e('0x28'));_0x31901d['query']=_[_0xd97e('0x2f')](_0x714392[_0xd97e('0x30')]);_0x31901d['filters']=_[_0xd97e('0x31')](_0x31901d[_0xd97e('0x2d')],_0x31901d[_0xd97e('0x30')]);_0x36ac08[_0xd97e('0x32')]=_['intersection'](_0x31901d[_0xd97e('0x2d')],qs[_0xd97e('0x33')](_0x714392[_0xd97e('0x30')][_0xd97e('0x33')]));_0x36ac08['attributes']=_0x36ac08['attributes'][_0xd97e('0x34')]?_0x36ac08['attributes']:_0x31901d[_0xd97e('0x2d')];if(!_0x714392[_0xd97e('0x30')][_0xd97e('0x35')]('nolimit')){_0x36ac08['limit']=qs['limit'](_0x714392[_0xd97e('0x30')]['limit']);_0x36ac08[_0xd97e('0x1a')]=qs[_0xd97e('0x1a')](_0x714392[_0xd97e('0x30')][_0xd97e('0x1a')]);}_0x36ac08[_0xd97e('0x36')]=qs['sort'](_0x714392[_0xd97e('0x30')]['sort']);_0x36ac08[_0xd97e('0x37')]=qs['filters'](_[_0xd97e('0x38')](_0x714392[_0xd97e('0x30')],_0x31901d[_0xd97e('0x39')]),_0x1a4fa0);if(_0x714392['query'][_0xd97e('0x3a')]){_0x36ac08[_0xd97e('0x37')]=_['merge'](_0x36ac08['where'],{'$or':_[_0xd97e('0x2e')](_0x1a4fa0,function(_0x113984){if(_0x113984[_0xd97e('0x2c')]!==_0xd97e('0x3b')){var _0x4625cd={};_0x4625cd[_0x113984['name']]={'$like':'%'+_0x714392['query']['filter']+'%'};return _0x4625cd;}})});}_0x36ac08=_[_0xd97e('0x3c')]({},_0x36ac08,_0x714392[_0xd97e('0x3d')]);var _0x2e9b4d={'where':_0x36ac08[_0xd97e('0x37')]};return db[_0xd97e('0x3e')]['count'](_0x2e9b4d)[_0xd97e('0x24')](function(_0x10a360){_0xba6129[_0xd97e('0x1d')]=_0x10a360;if(_0x714392[_0xd97e('0x30')][_0xd97e('0x3f')]){_0x36ac08[_0xd97e('0x40')]=[{'all':!![]}];}return db['SugarcrmField'][_0xd97e('0x41')](_0x36ac08);})[_0xd97e('0x24')](function(_0x335528){_0xba6129['rows']=_0x335528;return _0xba6129;})['then'](respondWithFilteredResult(_0x199a13,_0x36ac08))[_0xd97e('0x42')](handleError(_0x199a13,null));};exports[_0xd97e('0x43')]=function(_0xb44e0c,_0x5ad04a){var _0x4ff665={'raw':!![],'where':{'id':_0xb44e0c[_0xd97e('0x44')]['id']}},_0x4556db={};_0x4556db['model']=_[_0xd97e('0x2f')](db['SugarcrmField'][_0xd97e('0x45')]);_0x4556db[_0xd97e('0x30')]=_['keys'](_0xb44e0c['query']);_0x4556db['filters']=_[_0xd97e('0x31')](_0x4556db[_0xd97e('0x2d')],_0x4556db[_0xd97e('0x30')]);_0x4ff665[_0xd97e('0x32')]=_[_0xd97e('0x31')](_0x4556db[_0xd97e('0x2d')],qs['fields'](_0xb44e0c[_0xd97e('0x30')]['fields']));_0x4ff665[_0xd97e('0x32')]=_0x4ff665['attributes'][_0xd97e('0x34')]?_0x4ff665[_0xd97e('0x32')]:_0x4556db['model'];if(_0xb44e0c['query'][_0xd97e('0x3f')]){_0x4ff665['include']=[{'all':!![]}];}_0x4ff665=_['merge']({},_0x4ff665,_0xb44e0c['options']);return db[_0xd97e('0x3e')]['find'](_0x4ff665)[_0xd97e('0x24')](handleEntityNotFound(_0x5ad04a,null))['then'](respondWithResult(_0x5ad04a,null))[_0xd97e('0x42')](handleError(_0x5ad04a,null));};exports['create']=function(_0x3dd3df,_0xf5f688){return db[_0xd97e('0x3e')][_0xd97e('0x46')](_0x3dd3df[_0xd97e('0x47')],{})['then'](respondWithResult(_0xf5f688,0xc9))[_0xd97e('0x42')](handleError(_0xf5f688,null));};exports[_0xd97e('0x23')]=function(_0x2ba299,_0x264047){if(_0x2ba299[_0xd97e('0x47')]['id']){delete _0x2ba299[_0xd97e('0x47')]['id'];}return db[_0xd97e('0x3e')][_0xd97e('0x48')]({'where':{'id':_0x2ba299[_0xd97e('0x44')]['id']}})[_0xd97e('0x24')](handleEntityNotFound(_0x264047,null))['then'](saveUpdates(_0x2ba299['body'],null))[_0xd97e('0x24')](respondWithResult(_0x264047,null))[_0xd97e('0x42')](handleError(_0x264047,null));};exports[_0xd97e('0x25')]=function(_0x1aa6c8,_0x2185f1){return db['SugarcrmField'][_0xd97e('0x48')]({'where':{'id':_0x1aa6c8[_0xd97e('0x44')]['id']}})[_0xd97e('0x24')](handleEntityNotFound(_0x2185f1,null))[_0xd97e('0x24')](removeEntity(_0x2185f1,null))['catch'](handleError(_0x2185f1,null));}; \ No newline at end of file +var _0xa7c6=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x263725,_0x270466){var _0x5ba97b=function(_0x18624e){while(--_0x18624e){_0x263725['push'](_0x263725['shift']());}};_0x5ba97b(++_0x270466);}(_0xa7c6,0x91));var _0x6a7c=function(_0x29f931,_0xc09b63){_0x29f931=_0x29f931-0x0;var _0x5c858e=_0xa7c6[_0x29f931];return _0x5c858e;};'use strict';var emlformat=require(_0x6a7c('0x0'));var rimraf=require(_0x6a7c('0x1'));var zipdir=require(_0x6a7c('0x2'));var jsonpatch=require(_0x6a7c('0x3'));var rp=require(_0x6a7c('0x4'));var moment=require(_0x6a7c('0x5'));var BPromise=require(_0x6a7c('0x6'));var Mustache=require(_0x6a7c('0x7'));var util=require(_0x6a7c('0x8'));var path=require(_0x6a7c('0x9'));var sox=require('sox');var csv=require(_0x6a7c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a7c('0xb'));var _=require('lodash');var squel=require(_0x6a7c('0xc'));var crypto=require(_0x6a7c('0xd'));var jsforce=require(_0x6a7c('0xe'));var deskjs=require(_0x6a7c('0xf'));var toCsv=require(_0x6a7c('0xa'));var querystring=require(_0x6a7c('0x10'));var Papa=require(_0x6a7c('0x11'));var Redis=require(_0x6a7c('0x12'));var authService=require(_0x6a7c('0x13'));var qs=require(_0x6a7c('0x14'));var as=require(_0x6a7c('0x15'));var hardwareService=require(_0x6a7c('0x16'));var logger=require(_0x6a7c('0x17'))('api');var utils=require(_0x6a7c('0x18'));var config=require(_0x6a7c('0x19'));var licenseUtil=require(_0x6a7c('0x1a'));var db=require(_0x6a7c('0x1b'))['db'];function respondWithStatusCode(_0x52ed0c,_0xb089e9){_0xb089e9=_0xb089e9||0xcc;return function(_0x46cca0){if(_0x46cca0){return _0x52ed0c[_0x6a7c('0x1c')](_0xb089e9);}return _0x52ed0c[_0x6a7c('0x1d')](_0xb089e9)[_0x6a7c('0x1e')]();};}function respondWithResult(_0x3c35a2,_0xd40d2c){_0xd40d2c=_0xd40d2c||0xc8;return function(_0x1d9632){if(_0x1d9632){return _0x3c35a2[_0x6a7c('0x1d')](_0xd40d2c)[_0x6a7c('0x1f')](_0x1d9632);}};}function respondWithFilteredResult(_0x2eba94,_0x581ffb){return function(_0x9816df){if(_0x9816df){var _0x245b3e=typeof _0x581ffb[_0x6a7c('0x20')]===_0x6a7c('0x21')&&typeof _0x581ffb['limit']==='undefined';var _0x4c8346=_0x9816df[_0x6a7c('0x22')];var _0x5f5003=_0x245b3e?0x0:_0x581ffb[_0x6a7c('0x20')];var _0xa6da45=_0x245b3e?_0x9816df[_0x6a7c('0x22')]:_0x581ffb[_0x6a7c('0x20')]+_0x581ffb[_0x6a7c('0x23')];var _0x166820;if(_0xa6da45>=_0x4c8346){_0xa6da45=_0x4c8346;_0x166820=0xc8;}else{_0x166820=0xce;}_0x2eba94['status'](_0x166820);return _0x2eba94[_0x6a7c('0x24')](_0x6a7c('0x25'),_0x5f5003+'-'+_0xa6da45+'/'+_0x4c8346)[_0x6a7c('0x1f')](_0x9816df);}return null;};}function patchUpdates(_0x296fcc){return function(_0x14caf5){try{jsonpatch[_0x6a7c('0x26')](_0x14caf5,_0x296fcc,!![]);}catch(_0x11b3c9){return BPromise['reject'](_0x11b3c9);}return _0x14caf5[_0x6a7c('0x27')]();};}function saveUpdates(_0x3bc5e5,_0x4c9965){return function(_0x1f0949){if(_0x1f0949){return _0x1f0949[_0x6a7c('0x28')](_0x3bc5e5)[_0x6a7c('0x29')](function(_0x1b7198){return _0x1b7198;});}return null;};}function removeEntity(_0x4f7373,_0x306eed){return function(_0x1cae62){if(_0x1cae62){return _0x1cae62[_0x6a7c('0x2a')]()[_0x6a7c('0x29')](function(){_0x4f7373[_0x6a7c('0x1d')](0xcc)[_0x6a7c('0x1e')]();});}};}function handleEntityNotFound(_0x3bc897,_0x1dadbe){return function(_0x8bcd73){if(!_0x8bcd73){_0x3bc897[_0x6a7c('0x1c')](0x194);}return _0x8bcd73;};}function handleError(_0x4a56ec,_0x12420f){_0x12420f=_0x12420f||0x1f4;return function(_0x20e026){logger[_0x6a7c('0x2b')](_0x20e026[_0x6a7c('0x2c')]);if(_0x20e026[_0x6a7c('0x2d')]){delete _0x20e026['name'];}_0x4a56ec[_0x6a7c('0x1d')](_0x12420f)[_0x6a7c('0x2e')](_0x20e026);};}exports[_0x6a7c('0x2f')]=function(_0x3c6969,_0x17d583){var _0x5cb4d8={},_0x57b284={},_0x519dec={'count':0x0,'rows':[]};var _0x289a65=_[_0x6a7c('0x30')](db[_0x6a7c('0x31')][_0x6a7c('0x32')],function(_0x323522){return{'name':_0x323522[_0x6a7c('0x33')],'type':_0x323522[_0x6a7c('0x34')]['key']};});_0x57b284[_0x6a7c('0x35')]=_[_0x6a7c('0x30')](_0x289a65,_0x6a7c('0x2d'));_0x57b284[_0x6a7c('0x36')]=_[_0x6a7c('0x37')](_0x3c6969[_0x6a7c('0x36')]);_0x57b284['filters']=_['intersection'](_0x57b284[_0x6a7c('0x35')],_0x57b284[_0x6a7c('0x36')]);_0x5cb4d8[_0x6a7c('0x38')]=_[_0x6a7c('0x39')](_0x57b284[_0x6a7c('0x35')],qs[_0x6a7c('0x3a')](_0x3c6969[_0x6a7c('0x36')][_0x6a7c('0x3a')]));_0x5cb4d8[_0x6a7c('0x38')]=_0x5cb4d8[_0x6a7c('0x38')][_0x6a7c('0x3b')]?_0x5cb4d8[_0x6a7c('0x38')]:_0x57b284[_0x6a7c('0x35')];if(!_0x3c6969[_0x6a7c('0x36')][_0x6a7c('0x3c')](_0x6a7c('0x3d'))){_0x5cb4d8[_0x6a7c('0x23')]=qs[_0x6a7c('0x23')](_0x3c6969['query'][_0x6a7c('0x23')]);_0x5cb4d8['offset']=qs[_0x6a7c('0x20')](_0x3c6969['query'][_0x6a7c('0x20')]);}_0x5cb4d8[_0x6a7c('0x3e')]=qs[_0x6a7c('0x3f')](_0x3c6969[_0x6a7c('0x36')][_0x6a7c('0x3f')]);_0x5cb4d8[_0x6a7c('0x40')]=qs[_0x6a7c('0x41')](_[_0x6a7c('0x42')](_0x3c6969[_0x6a7c('0x36')],_0x57b284[_0x6a7c('0x41')]),_0x289a65);if(_0x3c6969['query'][_0x6a7c('0x43')]){_0x5cb4d8['where']=_[_0x6a7c('0x44')](_0x5cb4d8[_0x6a7c('0x40')],{'$or':_[_0x6a7c('0x30')](_0x289a65,function(_0x36b387){if(_0x36b387['type']!=='VIRTUAL'){var _0x1df01a={};_0x1df01a[_0x36b387['name']]={'$like':'%'+_0x3c6969[_0x6a7c('0x36')][_0x6a7c('0x43')]+'%'};return _0x1df01a;}})});}_0x5cb4d8=_[_0x6a7c('0x44')]({},_0x5cb4d8,_0x3c6969[_0x6a7c('0x45')]);var _0x2c0ad2={'where':_0x5cb4d8[_0x6a7c('0x40')]};return db[_0x6a7c('0x31')][_0x6a7c('0x22')](_0x2c0ad2)[_0x6a7c('0x29')](function(_0x38cebc){_0x519dec['count']=_0x38cebc;if(_0x3c6969[_0x6a7c('0x36')]['includeAll']){_0x5cb4d8[_0x6a7c('0x46')]=[{'all':!![]}];}return db[_0x6a7c('0x31')]['findAll'](_0x5cb4d8);})['then'](function(_0x45736c){_0x519dec[_0x6a7c('0x47')]=_0x45736c;return _0x519dec;})['then'](respondWithFilteredResult(_0x17d583,_0x5cb4d8))[_0x6a7c('0x48')](handleError(_0x17d583,null));};exports[_0x6a7c('0x49')]=function(_0xb613f9,_0x3612a1){var _0x2defb1={'raw':!![],'where':{'id':_0xb613f9['params']['id']}},_0x597fa6={};_0x597fa6[_0x6a7c('0x35')]=_['keys'](db[_0x6a7c('0x31')][_0x6a7c('0x32')]);_0x597fa6['query']=_[_0x6a7c('0x37')](_0xb613f9[_0x6a7c('0x36')]);_0x597fa6[_0x6a7c('0x41')]=_[_0x6a7c('0x39')](_0x597fa6[_0x6a7c('0x35')],_0x597fa6[_0x6a7c('0x36')]);_0x2defb1['attributes']=_[_0x6a7c('0x39')](_0x597fa6['model'],qs['fields'](_0xb613f9['query'][_0x6a7c('0x3a')]));_0x2defb1[_0x6a7c('0x38')]=_0x2defb1['attributes'][_0x6a7c('0x3b')]?_0x2defb1[_0x6a7c('0x38')]:_0x597fa6[_0x6a7c('0x35')];if(_0xb613f9[_0x6a7c('0x36')]['includeAll']){_0x2defb1['include']=[{'all':!![]}];}_0x2defb1=_[_0x6a7c('0x44')]({},_0x2defb1,_0xb613f9[_0x6a7c('0x45')]);return db[_0x6a7c('0x31')][_0x6a7c('0x4a')](_0x2defb1)[_0x6a7c('0x29')](handleEntityNotFound(_0x3612a1,null))[_0x6a7c('0x29')](respondWithResult(_0x3612a1,null))['catch'](handleError(_0x3612a1,null));};exports[_0x6a7c('0x4b')]=function(_0xd745d2,_0xb9038c){return db[_0x6a7c('0x31')][_0x6a7c('0x4b')](_0xd745d2[_0x6a7c('0x4c')],{})[_0x6a7c('0x29')](respondWithResult(_0xb9038c,0xc9))[_0x6a7c('0x48')](handleError(_0xb9038c,null));};exports[_0x6a7c('0x28')]=function(_0x4fe0c7,_0x294016){if(_0x4fe0c7[_0x6a7c('0x4c')]['id']){delete _0x4fe0c7[_0x6a7c('0x4c')]['id'];}return db[_0x6a7c('0x31')]['find']({'where':{'id':_0x4fe0c7[_0x6a7c('0x4d')]['id']}})[_0x6a7c('0x29')](handleEntityNotFound(_0x294016,null))[_0x6a7c('0x29')](saveUpdates(_0x4fe0c7[_0x6a7c('0x4c')],null))[_0x6a7c('0x29')](respondWithResult(_0x294016,null))['catch'](handleError(_0x294016,null));};exports[_0x6a7c('0x2a')]=function(_0x123ee0,_0x16a7f0){return db[_0x6a7c('0x31')][_0x6a7c('0x4a')]({'where':{'id':_0x123ee0[_0x6a7c('0x4d')]['id']}})[_0x6a7c('0x29')](handleEntityNotFound(_0x16a7f0,null))[_0x6a7c('0x29')](removeEntity(_0x16a7f0,null))[_0x6a7c('0x48')](handleError(_0x16a7f0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0b7c6bf..33ba3fe 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 _0x8cdb=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField'];(function(_0xae324d,_0xce7397){var _0x102407=function(_0x2b0dd4){while(--_0x2b0dd4){_0xae324d['push'](_0xae324d['shift']());}};_0x102407(++_0xce7397);}(_0x8cdb,0x169));var _0xb8cd=function(_0x38fdac,_0x23c6a3){_0x38fdac=_0x38fdac-0x0;var _0x899d8a=_0x8cdb[_0x38fdac];return _0x899d8a;};'use strict';var _=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var logger=require(_0xb8cd('0x2'))(_0xb8cd('0x3'));var moment=require(_0xb8cd('0x4'));var BPromise=require(_0xb8cd('0x5'));var rp=require(_0xb8cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8cd('0x7'));var config=require(_0xb8cd('0x8'));var attributes=require(_0xb8cd('0x9'));module[_0xb8cd('0xa')]=function(_0x286f4c,_0x3d7f42){return _0x286f4c[_0xb8cd('0xb')]('SugarcrmField',attributes,{'tableName':_0xb8cd('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xb8cd('0xd'),_0xb8cd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba85=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xba85,0x139));var _0x5ba8=function(_0xb957b1,_0x1e4b47){_0xb957b1=_0xb957b1-0x0;var _0x45faf7=_0xba85[_0xb957b1];return _0x45faf7;};'use strict';var _=require(_0x5ba8('0x0'));var util=require(_0x5ba8('0x1'));var logger=require(_0x5ba8('0x2'))(_0x5ba8('0x3'));var moment=require(_0x5ba8('0x4'));var BPromise=require(_0x5ba8('0x5'));var rp=require(_0x5ba8('0x6'));var fs=require('fs');var path=require(_0x5ba8('0x7'));var rimraf=require(_0x5ba8('0x8'));var config=require(_0x5ba8('0x9'));var attributes=require(_0x5ba8('0xa'));module[_0x5ba8('0xb')]=function(_0xc9fba,_0x5e7729){return _0xc9fba['define']('SugarcrmField',attributes,{'tableName':_0x5ba8('0xc'),'paranoid':![],'indexes':[{'name':_0x5ba8('0xd'),'fields':[_0x5ba8('0xe'),_0x5ba8('0xf')],'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 c7fa1eb..6486c60 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 _0xe51f=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xe51f,0xf5));var _0xfe51=function(_0x211de7,_0x39a8df){_0x211de7=_0x211de7-0x0;var _0x1bfc1a=_0xe51f[_0x211de7];return _0x1bfc1a;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var moment=require('moment');var BPromise=require(_0xfe51('0x2'));var rs=require(_0xfe51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe51('0x4'))['db'];var utils=require(_0xfe51('0x5'));var logger=require(_0xfe51('0x6'))(_0xfe51('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe51('0x8'));var client=jayson[_0xfe51('0x9')][_0xfe51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55d1fe,_0x2721d6,_0x551398){return new BPromise(function(_0x14121f,_0x420fb1){return client[_0xfe51('0xb')](_0x55d1fe,_0x551398)[_0xfe51('0xc')](function(_0xa0c056){logger[_0xfe51('0xd')](_0xfe51('0xe'),_0x2721d6,'request\x20sent');logger['debug'](_0xfe51('0xf'),_0x2721d6,_0xfe51('0x10'),JSON[_0xfe51('0x11')](_0xa0c056));if(_0xa0c056[_0xfe51('0x12')]){if(_0xa0c056[_0xfe51('0x12')]['code']===0x1f4){logger[_0xfe51('0x12')](_0xfe51('0xe'),_0x2721d6,_0xa0c056['error'][_0xfe51('0x13')]);return _0x420fb1(_0xa0c056[_0xfe51('0x12')]['message']);}logger[_0xfe51('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x2721d6,_0xa0c056[_0xfe51('0x12')][_0xfe51('0x13')]);return _0x14121f(_0xa0c056['error'][_0xfe51('0x13')]);}else{logger[_0xfe51('0xd')](_0xfe51('0xe'),_0x2721d6,_0xfe51('0x10'));_0x14121f(_0xa0c056[_0xfe51('0x14')][_0xfe51('0x13')]);}})[_0xfe51('0x15')](function(_0x278909){logger[_0xfe51('0x12')](_0xfe51('0xe'),_0x2721d6,_0x278909);_0x420fb1(_0x278909);});});} \ No newline at end of file +var _0x5729=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x6cd400,_0x2600a5){var _0x31cb57=function(_0x2fff63){while(--_0x2fff63){_0x6cd400['push'](_0x6cd400['shift']());}};_0x31cb57(++_0x2600a5);}(_0x5729,0x124));var _0x9572=function(_0x40edbb,_0x4b8e85){_0x40edbb=_0x40edbb-0x0;var _0x1c34e1=_0x5729[_0x40edbb];return _0x1c34e1;};'use strict';var _=require(_0x9572('0x0'));var util=require(_0x9572('0x1'));var moment=require(_0x9572('0x2'));var BPromise=require('bluebird');var rs=require(_0x9572('0x3'));var fs=require('fs');var Redis=require(_0x9572('0x4'));var db=require(_0x9572('0x5'))['db'];var utils=require(_0x9572('0x6'));var logger=require(_0x9572('0x7'))(_0x9572('0x8'));var config=require('../../config/environment');var jayson=require(_0x9572('0x9'));var client=jayson[_0x9572('0xa')][_0x9572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x196764,_0x56c654,_0x511c7e){return new BPromise(function(_0x1321ec,_0x1857e7){return client[_0x9572('0xc')](_0x196764,_0x511c7e)[_0x9572('0xd')](function(_0x2e7e6f){logger[_0x9572('0xe')](_0x9572('0xf'),_0x56c654,_0x9572('0x10'));logger['debug'](_0x9572('0x11'),_0x56c654,'request\x20sent',JSON[_0x9572('0x12')](_0x2e7e6f));if(_0x2e7e6f[_0x9572('0x13')]){if(_0x2e7e6f[_0x9572('0x13')][_0x9572('0x14')]===0x1f4){logger[_0x9572('0x13')](_0x9572('0xf'),_0x56c654,_0x2e7e6f[_0x9572('0x13')]['message']);return _0x1857e7(_0x2e7e6f[_0x9572('0x13')][_0x9572('0x15')]);}logger[_0x9572('0x13')](_0x9572('0xf'),_0x56c654,_0x2e7e6f[_0x9572('0x13')][_0x9572('0x15')]);return _0x1321ec(_0x2e7e6f['error'][_0x9572('0x15')]);}else{logger[_0x9572('0xe')](_0x9572('0xf'),_0x56c654,_0x9572('0x10'));_0x1321ec(_0x2e7e6f[_0x9572('0x16')][_0x9572('0x15')]);}})['catch'](function(_0x7d5fb1){logger['error'](_0x9572('0xf'),_0x56c654,_0x7d5fb1);_0x1857e7(_0x7d5fb1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 815cd8b..fb89523 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 _0x925e=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id'];(function(_0x306296,_0x184326){var _0x2b41bd=function(_0x4a0117){while(--_0x4a0117){_0x306296['push'](_0x306296['shift']());}};_0x2b41bd(++_0x184326);}(_0x925e,0x199));var _0xe925=function(_0x200953,_0x1b67d4){_0x200953=_0x200953-0x0;var _0x3d486e=_0x925e[_0x200953];return _0x3d486e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe925('0x0'));var timeout=require(_0xe925('0x1'));var express=require(_0xe925('0x2'));var router=express['Router']();var fs_extra=require(_0xe925('0x3'));var auth=require(_0xe925('0x4'));var interaction=require(_0xe925('0x5'));var config=require(_0xe925('0x6'));var controller=require(_0xe925('0x7'));router[_0xe925('0x8')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe925('0xb')]);router['get'](_0xe925('0xc'),auth['isAuthenticated'](),controller[_0xe925('0xd')]);router[_0xe925('0x8')](_0xe925('0xe'),auth[_0xe925('0x9')](),controller[_0xe925('0xf')]);router[_0xe925('0x10')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0x11')]);router[_0xe925('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe925('0x12')]);router[_0xe925('0x13')]('/:id',auth[_0xe925('0x9')](),controller[_0xe925('0x14')]);router[_0xe925('0x15')](_0xe925('0x16'),auth[_0xe925('0x9')](),controller['destroy']);module[_0xe925('0x17')]=router; \ No newline at end of file +var _0x99e9=['fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','util','path','connect-timeout','express'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0x99e9,0xb4));var _0x999e=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x99e9[_0x35387d];return _0x3aba56;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xa')](_0x999e('0xf'),auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x13')]);router[_0x999e('0x14')]('/:id',auth[_0x999e('0x8')](),controller['update']);router[_0x999e('0x15')](_0x999e('0xb'),auth[_0x999e('0x8')](),controller['destroy']);module[_0x999e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index f1a1d76..5708464 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 _0x1b21=['exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1b21,0xbc));var _0x11b2=function(_0x49be05,_0x49d2a9){_0x49be05=_0x49be05-0x0;var _0x1ec966=_0x1b21[_0x49be05];return _0x1ec966;};'use strict';var Sequelize=require('sequelize');module[_0x11b2('0x0')]={'name':{'type':Sequelize[_0x11b2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x11b2('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x11b2('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x11b2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x11b2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x11b2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xea09=['STRING','sequelize','exports'];(function(_0x4ede25,_0x5e29ce){var _0x53fcf2=function(_0x4e7b8d){while(--_0x4e7b8d){_0x4ede25['push'](_0x4ede25['shift']());}};_0x53fcf2(++_0x5e29ce);}(_0xea09,0xa9));var _0x9ea0=function(_0x17b90e,_0x2625cb){_0x17b90e=_0x17b90e-0x0;var _0xec9fc=_0xea09[_0x17b90e];return _0xec9fc;};'use strict';var Sequelize=require(_0x9ea0('0x0'));module[_0x9ea0('0x1')]={'name':{'type':Sequelize[_0x9ea0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9ea0('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x9ea0('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9ea0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index de92b97..8a0493b 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 _0x0214=['api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','create','body','update','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','substring','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','includes','false','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x12e949,_0x263b33){var _0x558c33=function(_0x131ebd){while(--_0x131ebd){_0x12e949['push'](_0x12e949['shift']());}};_0x558c33(++_0x263b33);}(_0x0214,0x1d2));var _0x4021=function(_0x1c288b,_0x377b72){_0x1c288b=_0x1c288b-0x0;var _0x5d9225=_0x0214[_0x1c288b];return _0x5d9225;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4021('0x0'));var zipdir=require(_0x4021('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4021('0x2'));var moment=require(_0x4021('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4021('0x4'));var path=require(_0x4021('0x5'));var sox=require(_0x4021('0x6'));var csv=require('to-csv');var ejs=require(_0x4021('0x7'));var fs=require('fs');var fs_extra=require(_0x4021('0x8'));var _=require('lodash');var squel=require(_0x4021('0x9'));var crypto=require(_0x4021('0xa'));var jsforce=require(_0x4021('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4021('0xc'));var Papa=require(_0x4021('0xd'));var Redis=require(_0x4021('0xe'));var authService=require(_0x4021('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4021('0x10'));var hardwareService=require(_0x4021('0x11'));var logger=require('../../config/logger')(_0x4021('0x12'));var utils=require('../../config/utils');var config=require(_0x4021('0x13'));var licenseUtil=require(_0x4021('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4021('0x15'));function respondWithStatusCode(_0x22a24b,_0x4f208b){_0x4f208b=_0x4f208b||0xcc;return function(_0x26df7b){if(_0x26df7b){return _0x22a24b['sendStatus'](_0x4f208b);}return _0x22a24b[_0x4021('0x16')](_0x4f208b)[_0x4021('0x17')]();};}function respondWithResult(_0x24eebc,_0x48e613){_0x48e613=_0x48e613||0xc8;return function(_0x5e5b79){if(_0x5e5b79){return _0x24eebc[_0x4021('0x16')](_0x48e613)[_0x4021('0x18')](_0x5e5b79);}};}function respondWithFilteredResult(_0x146c63,_0x5d09ac){return function(_0x49b4e9){if(_0x49b4e9){var _0x2086ec=typeof _0x5d09ac['offset']===_0x4021('0x19')&&typeof _0x5d09ac[_0x4021('0x1a')]===_0x4021('0x19');var _0x9262d5=_0x49b4e9[_0x4021('0x1b')];var _0x391a86=_0x2086ec?0x0:_0x5d09ac['offset'];var _0x54737e=_0x2086ec?_0x49b4e9[_0x4021('0x1b')]:_0x5d09ac['offset']+_0x5d09ac[_0x4021('0x1a')];var _0x14333f;if(_0x54737e>=_0x9262d5){_0x54737e=_0x9262d5;_0x14333f=0xc8;}else{_0x14333f=0xce;}_0x146c63[_0x4021('0x16')](_0x14333f);return _0x146c63[_0x4021('0x1c')](_0x4021('0x1d'),_0x391a86+'-'+_0x54737e+'/'+_0x9262d5)[_0x4021('0x18')](_0x49b4e9);}return null;};}function patchUpdates(_0x43a450){return function(_0x1da92f){try{jsonpatch[_0x4021('0x1e')](_0x1da92f,_0x43a450,!![]);}catch(_0x13a508){return BPromise[_0x4021('0x1f')](_0x13a508);}return _0x1da92f[_0x4021('0x20')]();};}function saveUpdates(_0x16cf08,_0x4ba1dc){return function(_0x94f5e9){if(_0x94f5e9){return _0x94f5e9['update'](_0x16cf08)[_0x4021('0x21')](function(_0x4e023c){return _0x4e023c;});}return null;};}function removeEntity(_0x5d849c,_0x50b62f){return function(_0x497a15){if(_0x497a15){return _0x497a15[_0x4021('0x22')]()[_0x4021('0x21')](function(){_0x5d849c[_0x4021('0x16')](0xcc)[_0x4021('0x17')]();});}};}function handleEntityNotFound(_0x3f81ea,_0x17d455){return function(_0x3e36ee){if(!_0x3e36ee){_0x3f81ea[_0x4021('0x23')](0x194);}return _0x3e36ee;};}function handleError(_0x2fe56e,_0x2cdee3){_0x2cdee3=_0x2cdee3||0x1f4;return function(_0x8580ca){logger[_0x4021('0x24')](_0x8580ca[_0x4021('0x25')]);if(_0x8580ca['name']){delete _0x8580ca[_0x4021('0x26')];}_0x2fe56e[_0x4021('0x16')](_0x2cdee3)[_0x4021('0x27')](_0x8580ca);};}exports[_0x4021('0x28')]=function(_0x2659ee,_0x3ecb2f){var _0x1c27b8={},_0x411fb9={},_0x3de24b={'count':0x0,'rows':[]};var _0x452ad6=_[_0x4021('0x29')](db[_0x4021('0x2a')][_0x4021('0x2b')],function(_0x176757){return{'name':_0x176757[_0x4021('0x2c')],'type':_0x176757[_0x4021('0x2d')][_0x4021('0x2e')]};});_0x411fb9[_0x4021('0x2f')]=_['map'](_0x452ad6,_0x4021('0x26'));_0x411fb9['query']=_[_0x4021('0x30')](_0x2659ee[_0x4021('0x31')]);_0x411fb9[_0x4021('0x32')]=_[_0x4021('0x33')](_0x411fb9['model'],_0x411fb9['query']);_0x1c27b8['attributes']=_[_0x4021('0x33')](_0x411fb9[_0x4021('0x2f')],qs[_0x4021('0x34')](_0x2659ee[_0x4021('0x31')]['fields']));_0x1c27b8[_0x4021('0x35')]=_0x1c27b8[_0x4021('0x35')][_0x4021('0x36')]?_0x1c27b8['attributes']:_0x411fb9[_0x4021('0x2f')];if(!_0x2659ee[_0x4021('0x31')][_0x4021('0x37')](_0x4021('0x38'))){_0x1c27b8[_0x4021('0x1a')]=qs[_0x4021('0x1a')](_0x2659ee[_0x4021('0x31')]['limit']);_0x1c27b8[_0x4021('0x39')]=qs[_0x4021('0x39')](_0x2659ee[_0x4021('0x31')][_0x4021('0x39')]);}_0x1c27b8[_0x4021('0x3a')]=qs['sort'](_0x2659ee[_0x4021('0x31')][_0x4021('0x3b')]);_0x1c27b8[_0x4021('0x3c')]=qs[_0x4021('0x32')](_[_0x4021('0x3d')](_0x2659ee['query'],_0x411fb9[_0x4021('0x32')]),_0x452ad6);if(_0x2659ee[_0x4021('0x31')][_0x4021('0x3e')]){_0x1c27b8[_0x4021('0x3c')]=_[_0x4021('0x3f')](_0x1c27b8[_0x4021('0x3c')],{'$or':_[_0x4021('0x29')](_0x452ad6,function(_0x208692){if(_0x208692[_0x4021('0x2d')]!==_0x4021('0x40')){var _0x135950={};_0x135950[_0x208692[_0x4021('0x26')]]={'$like':'%'+_0x2659ee[_0x4021('0x31')][_0x4021('0x3e')]+'%'};return _0x135950;}})});}_0x1c27b8=_[_0x4021('0x3f')]({},_0x1c27b8,_0x2659ee[_0x4021('0x41')]);var _0x408d36={'where':_0x1c27b8[_0x4021('0x3c')]};return db[_0x4021('0x2a')][_0x4021('0x1b')](_0x408d36)[_0x4021('0x21')](function(_0x20da62){_0x3de24b[_0x4021('0x1b')]=_0x20da62;if(_0x2659ee['query']['includeAll']){_0x1c27b8['include']=[{'all':!![]}];}return db[_0x4021('0x2a')][_0x4021('0x42')](_0x1c27b8);})[_0x4021('0x21')](function(_0x1d5d2a){_0x3de24b['rows']=_0x1d5d2a;return _0x3de24b;})[_0x4021('0x21')](respondWithFilteredResult(_0x3ecb2f,_0x1c27b8))[_0x4021('0x43')](handleError(_0x3ecb2f,null));};exports[_0x4021('0x44')]=function(_0x2f7e2e,_0x23bbef){var _0x5e823b={'raw':![],'where':{'id':_0x2f7e2e[_0x4021('0x45')]['id']}},_0x1e92f9={};_0x1e92f9[_0x4021('0x2f')]=_['keys'](db[_0x4021('0x2a')][_0x4021('0x2b')]);_0x1e92f9[_0x4021('0x31')]=_['keys'](_0x2f7e2e[_0x4021('0x31')]);_0x1e92f9['filters']=_[_0x4021('0x33')](_0x1e92f9[_0x4021('0x2f')],_0x1e92f9['query']);_0x5e823b[_0x4021('0x35')]=_[_0x4021('0x33')](_0x1e92f9['model'],qs[_0x4021('0x34')](_0x2f7e2e[_0x4021('0x31')][_0x4021('0x34')]));_0x5e823b['attributes']=_0x5e823b['attributes'][_0x4021('0x36')]?_0x5e823b['attributes']:_0x1e92f9[_0x4021('0x2f')];if(_0x2f7e2e[_0x4021('0x31')][_0x4021('0x46')]){_0x5e823b['include']=[{'all':!![]}];}_0x5e823b=_['merge']({},_0x5e823b,_0x2f7e2e[_0x4021('0x41')]);return db[_0x4021('0x2a')]['find'](_0x5e823b)[_0x4021('0x21')](handleEntityNotFound(_0x23bbef,null))['then'](respondWithResult(_0x23bbef,null))['catch'](handleError(_0x23bbef,null));};exports['create']=function(_0x471c19,_0x2cd60a){return db[_0x4021('0x2a')][_0x4021('0x47')](_0x471c19[_0x4021('0x48')],{})['then'](respondWithResult(_0x2cd60a,0xc9))[_0x4021('0x43')](handleError(_0x2cd60a,null));};exports[_0x4021('0x49')]=function(_0x56919c,_0x24aef0){if(_0x56919c[_0x4021('0x48')]['id']){delete _0x56919c[_0x4021('0x48')]['id'];}return db[_0x4021('0x2a')]['find']({'where':{'id':_0x56919c['params']['id']}})[_0x4021('0x21')](handleEntityNotFound(_0x24aef0,null))[_0x4021('0x21')](saveUpdates(_0x56919c[_0x4021('0x48')],null))['then'](respondWithResult(_0x24aef0,null))[_0x4021('0x43')](handleError(_0x24aef0,null));};exports[_0x4021('0x22')]=function(_0x4a3604,_0x7f17c1){return db[_0x4021('0x2a')][_0x4021('0x4a')]({'where':{'id':_0x4a3604[_0x4021('0x45')]['id']}})[_0x4021('0x21')](handleEntityNotFound(_0x7f17c1,null))[_0x4021('0x21')](removeEntity(_0x7f17c1,null))[_0x4021('0x43')](handleError(_0x7f17c1,null));};exports[_0x4021('0x4b')]=function(_0x439978,_0x2d2118,_0x472c90){var _0x1cb7c5={};var _0x545ac8={};var _0x4678d6;var _0x341804;return db[_0x4021('0x2a')]['findOne']({'where':{'id':_0x439978[_0x4021('0x45')]['id']}})[_0x4021('0x21')](handleEntityNotFound(_0x2d2118,null))[_0x4021('0x21')](function(_0x4bea6e){if(_0x4bea6e){_0x4678d6=_0x4bea6e;_0x545ac8[_0x4021('0x2f')]=_[_0x4021('0x30')](db['VtigerConfiguration'][_0x4021('0x2b')]);_0x545ac8['query']=_[_0x4021('0x30')](_0x439978[_0x4021('0x31')]);_0x545ac8[_0x4021('0x32')]=_[_0x4021('0x33')](_0x545ac8[_0x4021('0x2f')],_0x545ac8[_0x4021('0x31')]);_0x1cb7c5[_0x4021('0x35')]=_[_0x4021('0x33')](_0x545ac8[_0x4021('0x2f')],qs[_0x4021('0x34')](_0x439978[_0x4021('0x31')]['fields']));_0x1cb7c5[_0x4021('0x35')]=_0x1cb7c5[_0x4021('0x35')]['length']?_0x1cb7c5[_0x4021('0x35')]:_0x545ac8[_0x4021('0x2f')];_0x1cb7c5[_0x4021('0x3a')]=qs[_0x4021('0x3b')](_0x439978['query'][_0x4021('0x3b')]);_0x1cb7c5[_0x4021('0x3c')]=qs[_0x4021('0x32')](_[_0x4021('0x3d')](_0x439978[_0x4021('0x31')],_0x545ac8['filters']));if(_0x439978[_0x4021('0x31')][_0x4021('0x3e')]){_0x1cb7c5[_0x4021('0x3c')]=_[_0x4021('0x3f')](_0x1cb7c5['where'],{'$or':_['map'](_0x1cb7c5[_0x4021('0x35')],function(_0x55734b){var _0x1d5850={};_0x1d5850[_0x55734b]={'$like':'%'+_0x439978[_0x4021('0x31')][_0x4021('0x3e')]+'%'};return _0x1d5850;})});}_0x1cb7c5=_['merge']({},_0x1cb7c5,_0x439978[_0x4021('0x41')]);return _0x4678d6[_0x4021('0x4b')](_0x1cb7c5);}})[_0x4021('0x21')](function(_0x396c75){if(_0x396c75){_0x341804=_0x396c75[_0x4021('0x36')];if(!_0x439978[_0x4021('0x31')][_0x4021('0x37')](_0x4021('0x38'))){_0x1cb7c5[_0x4021('0x1a')]=qs[_0x4021('0x1a')](_0x439978[_0x4021('0x31')][_0x4021('0x1a')]);_0x1cb7c5[_0x4021('0x39')]=qs['offset'](_0x439978[_0x4021('0x31')][_0x4021('0x39')]);}return _0x4678d6[_0x4021('0x4b')](_0x1cb7c5);}})[_0x4021('0x21')](function(_0x517f4e){if(_0x517f4e){return _0x517f4e?{'count':_0x341804,'rows':_0x517f4e}:null;}})['then'](respondWithResult(_0x2d2118,null))[_0x4021('0x43')](handleError(_0x2d2118,null));};exports[_0x4021('0x4c')]=function(_0x18ef18,_0x17a63c,_0x54e7e8){if(_0x18ef18[_0x4021('0x48')]['id']){delete _0x18ef18[_0x4021('0x48')]['id'];}return db[_0x4021('0x2a')][_0x4021('0x4d')]({'where':{'id':_0x18ef18[_0x4021('0x45')]['id']}})[_0x4021('0x21')](handleEntityNotFound(_0x17a63c,null))['then'](function(_0x3ba406){if(_0x3ba406){_0x18ef18[_0x4021('0x48')][_0x4021('0x4e')]=_0x3ba406['id'];_0x18ef18['body'][_0x4021('0x4f')]=integrations[_0x4021('0x50')](_0x18ef18['body'][_0x4021('0x51')],_0x18ef18[_0x4021('0x48')]['type']);_0x18ef18[_0x4021('0x48')][_0x4021('0x52')]=integrations[_0x4021('0x53')](_0x18ef18['body']['channel'],_0x18ef18[_0x4021('0x48')][_0x4021('0x2d')]);return db[_0x4021('0x54')][_0x4021('0x47')](_0x18ef18[_0x4021('0x48')],{'include':[{'model':db[_0x4021('0x55')],'as':_0x4021('0x4f')},{'model':db['VtigerField'],'as':_0x4021('0x52')}]});}return null;})[_0x4021('0x21')](respondWithResult(_0x17a63c,null))[_0x4021('0x43')](handleError(_0x17a63c,null));};var md5=require(_0x4021('0x56'));exports[_0x4021('0x57')]=function(_0x4884ba,_0x352ebf,_0x22bb8b){var _0x47e0dc=null;var _0x1954a9=null;var _0x4e9e19=null;var _0x1d1e9a=null;var _0x50f1b7='';return db[_0x4021('0x2a')][_0x4021('0x4d')]({'where':{'id':_0x4884ba[_0x4021('0x45')]['id']},'attributes':['id','name',_0x4021('0x58'),_0x4021('0x59'),_0x4021('0x5a'),_0x4021('0x5b'),'serverUrl',_0x4021('0x5c')]})[_0x4021('0x21')](handleEntityNotFound(_0x352ebf,null))[_0x4021('0x21')](function(_0x3310d1){if(_0x3310d1){_0x47e0dc=_0x3310d1[_0x4021('0x58')];_0x1954a9=_0x3310d1[_0x4021('0x5c')];_0x4e9e19=_0x3310d1[_0x4021('0x5a')];_0x50f1b7=_0x3310d1[_0x4021('0x5b')];var _0x51fb86=_0x50f1b7['slice'](-0x1);if(_0x51fb86==='/'){_0x50f1b7=_0x50f1b7[_0x4021('0x5d')](0x0,_0x50f1b7['lastIndexOf'](_0x51fb86));}_0x1d1e9a=util[_0x4021('0x5e')](_0x4021('0x5f'),_0x50f1b7);var _0x9e9e5b={'method':_0x4021('0x60'),'uri':_0x1d1e9a,'qs':{'operation':_0x4021('0x61'),'username':_0x3310d1[_0x4021('0x58')]},'json':!![]};return rp(_0x9e9e5b);}})[_0x4021('0x21')](function(_0x536a30){if(_0x536a30['success']){var _0x5648e3={'method':_0x4021('0x62'),'uri':_0x1d1e9a,'form':{'operation':_0x4021('0x63'),'username':_0x47e0dc,'accessKey':md5(_0x536a30[_0x4021('0x64')][_0x4021('0x65')]+_0x1954a9)},'json':!![]};return rp(_0x5648e3);}})[_0x4021('0x21')](function(_0x51c48d){if(_0x51c48d[_0x4021('0x66')]){var _0x3817f3={'method':_0x4021('0x60'),'uri':_0x1d1e9a,'qs':{'operation':'describe','username':_0x47e0dc,'sessionName':_0x51c48d[_0x4021('0x64')][_0x4021('0x67')],'elementType':_0x4e9e19},'json':!![]};return rp(_0x3817f3);}})[_0x4021('0x21')](function(_0x1a67a3){if(_0x1a67a3[_0x4021('0x66')]){var _0x3a1f8a=[_0x4021('0x68'),_0x4021('0x69'),_0x4021('0x6a')];_[_0x4021('0x6b')](_0x1a67a3[_0x4021('0x64')]['fields'],function(_0x41b5b6){return _0x3a1f8a[_0x4021('0x6c')](_0x41b5b6['type'][_0x4021('0x26')]);});_[_0x4021('0x6b')](_0x1a67a3[_0x4021('0x64')]['fields'],function(_0x379f9c){return _0x379f9c['editable']===_0x4021('0x6d');});return{'count':_0x1a67a3[_0x4021('0x64')][_0x4021('0x34')]['length'],'rows':_[_0x4021('0x29')](_0x1a67a3[_0x4021('0x64')][_0x4021('0x34')],function(_0x24e6b7){return{'id':_0x24e6b7[_0x4021('0x26')],'name':_0x24e6b7['label'],'custom':_[_0x4021('0x6e')](_0x24e6b7[_0x4021('0x26')],_0x4021('0x6f'))?!![]:![],'options':_0x24e6b7[_0x4021('0x2d')][_0x4021('0x26')]===_0x4021('0x70')&&_0x24e6b7[_0x4021('0x2d')][_0x4021('0x71')][_0x4021('0x36')]>0x0?_['map'](_0x24e6b7[_0x4021('0x2d')][_0x4021('0x71')],function(_0x566feb){return{'name':_0x566feb['label'],'value':_0x566feb['value']};}):[]};})};}})['then'](respondWithResult(_0x352ebf,null))[_0x4021('0x43')](function(_0x1f11d1){console[_0x4021('0x72')](_0x4021('0x73')+_0x1f11d1);var _0x68e3e7=_0x4884ba[_0x4021('0x31')]['test']?0x1f4:_0x1f11d1[_0x4021('0x74')]||0x1f4;logger[_0x4021('0x24')](_0x4021('0x75'),_0x4021('0x57'),_0x68e3e7,JSON[_0x4021('0x76')](_0x1f11d1));delete _0x1f11d1[_0x4021('0x26')];if(_0x68e3e7===0x191){_0x68e3e7=0x190;}_0x352ebf['status'](_0x68e3e7)[_0x4021('0x27')](_0x4884ba[_0x4021('0x31')][_0x4021('0x77')]?{'message':_0x4021('0x78'),'statusCode':_0x1f11d1[_0x4021('0x74')]}:_0x1f11d1);});}; \ No newline at end of file +var _0x8da9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','name','index','VtigerAccount','rawAttributes','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','catch','show','params','length','includeAll','create','body','find','getConfigurations','findOne','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerConfiguration','VtigerField','md5','remoteUri','serverUrl','username','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','getFields','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x19a395,_0x1cb49e){var _0x2015f8=function(_0x4ae755){while(--_0x4ae755){_0x19a395['push'](_0x19a395['shift']());}};_0x2015f8(++_0x1cb49e);}(_0x8da9,0x146));var _0x98da=function(_0x59ce09,_0x4a9863){_0x59ce09=_0x59ce09-0x0;var _0x23e766=_0x8da9[_0x59ce09];return _0x23e766;};'use strict';var emlformat=require(_0x98da('0x0'));var rimraf=require(_0x98da('0x1'));var zipdir=require(_0x98da('0x2'));var jsonpatch=require(_0x98da('0x3'));var rp=require(_0x98da('0x4'));var moment=require(_0x98da('0x5'));var BPromise=require(_0x98da('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x98da('0x7'));var csv=require(_0x98da('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98da('0x9'));var _=require(_0x98da('0xa'));var squel=require(_0x98da('0xb'));var crypto=require('crypto');var jsforce=require(_0x98da('0xc'));var deskjs=require(_0x98da('0xd'));var toCsv=require('to-csv');var querystring=require(_0x98da('0xe'));var Papa=require(_0x98da('0xf'));var Redis=require(_0x98da('0x10'));var authService=require(_0x98da('0x11'));var qs=require(_0x98da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98da('0x13'));var logger=require(_0x98da('0x14'))(_0x98da('0x15'));var utils=require(_0x98da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x98da('0x17'));var db=require(_0x98da('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xfabc91,_0x424902){_0x424902=_0x424902||0xcc;return function(_0x2dbbe4){if(_0x2dbbe4){return _0xfabc91['sendStatus'](_0x424902);}return _0xfabc91[_0x98da('0x19')](_0x424902)[_0x98da('0x1a')]();};}function respondWithResult(_0xc41aff,_0x45531e){_0x45531e=_0x45531e||0xc8;return function(_0x31a07c){if(_0x31a07c){return _0xc41aff[_0x98da('0x19')](_0x45531e)['json'](_0x31a07c);}};}function respondWithFilteredResult(_0x28a3b2,_0x34c60f){return function(_0x118e80){if(_0x118e80){var _0x459641=typeof _0x34c60f[_0x98da('0x1b')]===_0x98da('0x1c')&&typeof _0x34c60f[_0x98da('0x1d')]===_0x98da('0x1c');var _0x2d0ccf=_0x118e80['count'];var _0x3a4a2a=_0x459641?0x0:_0x34c60f['offset'];var _0x329c20=_0x459641?_0x118e80[_0x98da('0x1e')]:_0x34c60f[_0x98da('0x1b')]+_0x34c60f[_0x98da('0x1d')];var _0x59ef94;if(_0x329c20>=_0x2d0ccf){_0x329c20=_0x2d0ccf;_0x59ef94=0xc8;}else{_0x59ef94=0xce;}_0x28a3b2[_0x98da('0x19')](_0x59ef94);return _0x28a3b2['set'](_0x98da('0x1f'),_0x3a4a2a+'-'+_0x329c20+'/'+_0x2d0ccf)[_0x98da('0x20')](_0x118e80);}return null;};}function patchUpdates(_0x256a53){return function(_0x5a0bd3){try{jsonpatch[_0x98da('0x21')](_0x5a0bd3,_0x256a53,!![]);}catch(_0x1605f8){return BPromise['reject'](_0x1605f8);}return _0x5a0bd3['save']();};}function saveUpdates(_0x4de18c,_0x3f30c9){return function(_0x39fe6b){if(_0x39fe6b){return _0x39fe6b[_0x98da('0x22')](_0x4de18c)[_0x98da('0x23')](function(_0x5f3f54){return _0x5f3f54;});}return null;};}function removeEntity(_0x123002,_0x49f99f){return function(_0x387154){if(_0x387154){return _0x387154[_0x98da('0x24')]()[_0x98da('0x23')](function(){_0x123002[_0x98da('0x19')](0xcc)[_0x98da('0x1a')]();});}};}function handleEntityNotFound(_0x1d6137,_0x38e200){return function(_0x53d3d5){if(!_0x53d3d5){_0x1d6137['sendStatus'](0x194);}return _0x53d3d5;};}function handleError(_0x3e55f4,_0x299b19){_0x299b19=_0x299b19||0x1f4;return function(_0x58a8bc){logger[_0x98da('0x25')](_0x58a8bc['stack']);if(_0x58a8bc[_0x98da('0x26')]){delete _0x58a8bc[_0x98da('0x26')];}_0x3e55f4[_0x98da('0x19')](_0x299b19)['send'](_0x58a8bc);};}exports[_0x98da('0x27')]=function(_0xf46f36,_0xbb9b4d){var _0x5900da={},_0x342167={},_0x28ce17={'count':0x0,'rows':[]};var _0x322812=_['map'](db[_0x98da('0x28')][_0x98da('0x29')],function(_0x53a5eb){return{'name':_0x53a5eb['fieldName'],'type':_0x53a5eb['type']['key']};});_0x342167[_0x98da('0x2a')]=_[_0x98da('0x2b')](_0x322812,_0x98da('0x26'));_0x342167[_0x98da('0x2c')]=_[_0x98da('0x2d')](_0xf46f36[_0x98da('0x2c')]);_0x342167['filters']=_[_0x98da('0x2e')](_0x342167['model'],_0x342167[_0x98da('0x2c')]);_0x5900da[_0x98da('0x2f')]=_[_0x98da('0x2e')](_0x342167['model'],qs['fields'](_0xf46f36['query'][_0x98da('0x30')]));_0x5900da[_0x98da('0x2f')]=_0x5900da['attributes']['length']?_0x5900da[_0x98da('0x2f')]:_0x342167['model'];if(!_0xf46f36[_0x98da('0x2c')][_0x98da('0x31')](_0x98da('0x32'))){_0x5900da['limit']=qs[_0x98da('0x1d')](_0xf46f36[_0x98da('0x2c')][_0x98da('0x1d')]);_0x5900da[_0x98da('0x1b')]=qs[_0x98da('0x1b')](_0xf46f36[_0x98da('0x2c')]['offset']);}_0x5900da['order']=qs['sort'](_0xf46f36[_0x98da('0x2c')][_0x98da('0x33')]);_0x5900da[_0x98da('0x34')]=qs[_0x98da('0x35')](_[_0x98da('0x36')](_0xf46f36[_0x98da('0x2c')],_0x342167['filters']),_0x322812);if(_0xf46f36[_0x98da('0x2c')][_0x98da('0x37')]){_0x5900da['where']=_[_0x98da('0x38')](_0x5900da['where'],{'$or':_['map'](_0x322812,function(_0x25e29b){if(_0x25e29b[_0x98da('0x39')]!==_0x98da('0x3a')){var _0x2bb7d9={};_0x2bb7d9[_0x25e29b['name']]={'$like':'%'+_0xf46f36['query']['filter']+'%'};return _0x2bb7d9;}})});}_0x5900da=_['merge']({},_0x5900da,_0xf46f36['options']);var _0x41453d={'where':_0x5900da[_0x98da('0x34')]};return db[_0x98da('0x28')][_0x98da('0x1e')](_0x41453d)[_0x98da('0x23')](function(_0x3310d8){_0x28ce17[_0x98da('0x1e')]=_0x3310d8;if(_0xf46f36[_0x98da('0x2c')]['includeAll']){_0x5900da[_0x98da('0x3b')]=[{'all':!![]}];}return db['VtigerAccount'][_0x98da('0x3c')](_0x5900da);})[_0x98da('0x23')](function(_0x777112){_0x28ce17['rows']=_0x777112;return _0x28ce17;})[_0x98da('0x23')](respondWithFilteredResult(_0xbb9b4d,_0x5900da))[_0x98da('0x3d')](handleError(_0xbb9b4d,null));};exports[_0x98da('0x3e')]=function(_0x50acb1,_0x121522){var _0x4848e3={'raw':![],'where':{'id':_0x50acb1[_0x98da('0x3f')]['id']}},_0x7e8171={};_0x7e8171[_0x98da('0x2a')]=_[_0x98da('0x2d')](db[_0x98da('0x28')][_0x98da('0x29')]);_0x7e8171[_0x98da('0x2c')]=_[_0x98da('0x2d')](_0x50acb1['query']);_0x7e8171[_0x98da('0x35')]=_[_0x98da('0x2e')](_0x7e8171[_0x98da('0x2a')],_0x7e8171[_0x98da('0x2c')]);_0x4848e3['attributes']=_['intersection'](_0x7e8171[_0x98da('0x2a')],qs[_0x98da('0x30')](_0x50acb1[_0x98da('0x2c')]['fields']));_0x4848e3[_0x98da('0x2f')]=_0x4848e3[_0x98da('0x2f')][_0x98da('0x40')]?_0x4848e3['attributes']:_0x7e8171['model'];if(_0x50acb1[_0x98da('0x2c')][_0x98da('0x41')]){_0x4848e3['include']=[{'all':!![]}];}_0x4848e3=_[_0x98da('0x38')]({},_0x4848e3,_0x50acb1['options']);return db[_0x98da('0x28')]['find'](_0x4848e3)[_0x98da('0x23')](handleEntityNotFound(_0x121522,null))[_0x98da('0x23')](respondWithResult(_0x121522,null))[_0x98da('0x3d')](handleError(_0x121522,null));};exports['create']=function(_0x1b0a8d,_0x43a4ee){return db[_0x98da('0x28')][_0x98da('0x42')](_0x1b0a8d[_0x98da('0x43')],{})['then'](respondWithResult(_0x43a4ee,0xc9))['catch'](handleError(_0x43a4ee,null));};exports[_0x98da('0x22')]=function(_0x20d5cd,_0x11902d){if(_0x20d5cd['body']['id']){delete _0x20d5cd[_0x98da('0x43')]['id'];}return db['VtigerAccount'][_0x98da('0x44')]({'where':{'id':_0x20d5cd[_0x98da('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11902d,null))[_0x98da('0x23')](saveUpdates(_0x20d5cd['body'],null))[_0x98da('0x23')](respondWithResult(_0x11902d,null))[_0x98da('0x3d')](handleError(_0x11902d,null));};exports[_0x98da('0x24')]=function(_0x1d87c4,_0x523bd5){return db[_0x98da('0x28')][_0x98da('0x44')]({'where':{'id':_0x1d87c4[_0x98da('0x3f')]['id']}})[_0x98da('0x23')](handleEntityNotFound(_0x523bd5,null))[_0x98da('0x23')](removeEntity(_0x523bd5,null))[_0x98da('0x3d')](handleError(_0x523bd5,null));};exports[_0x98da('0x45')]=function(_0x59719f,_0x1740ba,_0x3287c6){var _0x282546={};var _0x54d829={};var _0x52e9ca;var _0x2b7e3b;return db[_0x98da('0x28')][_0x98da('0x46')]({'where':{'id':_0x59719f[_0x98da('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1740ba,null))[_0x98da('0x23')](function(_0x578f7a){if(_0x578f7a){_0x52e9ca=_0x578f7a;_0x54d829['model']=_[_0x98da('0x2d')](db['VtigerConfiguration'][_0x98da('0x29')]);_0x54d829[_0x98da('0x2c')]=_['keys'](_0x59719f[_0x98da('0x2c')]);_0x54d829[_0x98da('0x35')]=_[_0x98da('0x2e')](_0x54d829[_0x98da('0x2a')],_0x54d829['query']);_0x282546[_0x98da('0x2f')]=_[_0x98da('0x2e')](_0x54d829[_0x98da('0x2a')],qs[_0x98da('0x30')](_0x59719f[_0x98da('0x2c')]['fields']));_0x282546[_0x98da('0x2f')]=_0x282546[_0x98da('0x2f')][_0x98da('0x40')]?_0x282546[_0x98da('0x2f')]:_0x54d829[_0x98da('0x2a')];_0x282546[_0x98da('0x47')]=qs['sort'](_0x59719f[_0x98da('0x2c')][_0x98da('0x33')]);_0x282546['where']=qs[_0x98da('0x35')](_[_0x98da('0x36')](_0x59719f[_0x98da('0x2c')],_0x54d829['filters']));if(_0x59719f[_0x98da('0x2c')][_0x98da('0x37')]){_0x282546[_0x98da('0x34')]=_[_0x98da('0x38')](_0x282546[_0x98da('0x34')],{'$or':_[_0x98da('0x2b')](_0x282546[_0x98da('0x2f')],function(_0x24f72c){var _0x2e3e6a={};_0x2e3e6a[_0x24f72c]={'$like':'%'+_0x59719f[_0x98da('0x2c')]['filter']+'%'};return _0x2e3e6a;})});}_0x282546=_['merge']({},_0x282546,_0x59719f[_0x98da('0x48')]);return _0x52e9ca[_0x98da('0x45')](_0x282546);}})['then'](function(_0x5c79ad){if(_0x5c79ad){_0x2b7e3b=_0x5c79ad['length'];if(!_0x59719f[_0x98da('0x2c')][_0x98da('0x31')]('nolimit')){_0x282546[_0x98da('0x1d')]=qs['limit'](_0x59719f[_0x98da('0x2c')]['limit']);_0x282546[_0x98da('0x1b')]=qs[_0x98da('0x1b')](_0x59719f[_0x98da('0x2c')][_0x98da('0x1b')]);}return _0x52e9ca[_0x98da('0x45')](_0x282546);}})[_0x98da('0x23')](function(_0xf7175f){if(_0xf7175f){return _0xf7175f?{'count':_0x2b7e3b,'rows':_0xf7175f}:null;}})[_0x98da('0x23')](respondWithResult(_0x1740ba,null))[_0x98da('0x3d')](handleError(_0x1740ba,null));};exports[_0x98da('0x49')]=function(_0x2f62df,_0x347fbf,_0x39c158){if(_0x2f62df[_0x98da('0x43')]['id']){delete _0x2f62df[_0x98da('0x43')]['id'];}return db[_0x98da('0x28')][_0x98da('0x46')]({'where':{'id':_0x2f62df[_0x98da('0x3f')]['id']}})[_0x98da('0x23')](handleEntityNotFound(_0x347fbf,null))[_0x98da('0x23')](function(_0x2ef5a6){if(_0x2ef5a6){_0x2f62df[_0x98da('0x43')][_0x98da('0x4a')]=_0x2ef5a6['id'];_0x2f62df[_0x98da('0x43')][_0x98da('0x4b')]=integrations[_0x98da('0x4c')](_0x2f62df[_0x98da('0x43')][_0x98da('0x4d')],_0x2f62df[_0x98da('0x43')][_0x98da('0x39')]);_0x2f62df[_0x98da('0x43')][_0x98da('0x4e')]=integrations['getDescriptions'](_0x2f62df[_0x98da('0x43')][_0x98da('0x4d')],_0x2f62df[_0x98da('0x43')]['type']);return db[_0x98da('0x4f')][_0x98da('0x42')](_0x2f62df[_0x98da('0x43')],{'include':[{'model':db[_0x98da('0x50')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x98da('0x4e')}]});}return null;})['then'](respondWithResult(_0x347fbf,null))['catch'](handleError(_0x347fbf,null));};var md5=require(_0x98da('0x51'));exports['getFields']=function(_0x1d8377,_0x293fd2,_0x46bd07){var _0x3984c0=null;var _0x50a12d=null;var _0x48fe0a=null;var _0x1f1fd0=null;var _0x16a9d2='';return db[_0x98da('0x28')][_0x98da('0x46')]({'where':{'id':_0x1d8377[_0x98da('0x3f')]['id']},'attributes':['id',_0x98da('0x26'),'username','description','moduleName',_0x98da('0x52'),_0x98da('0x53'),'accessKey']})[_0x98da('0x23')](handleEntityNotFound(_0x293fd2,null))[_0x98da('0x23')](function(_0x3d61d2){if(_0x3d61d2){_0x3984c0=_0x3d61d2[_0x98da('0x54')];_0x50a12d=_0x3d61d2['accessKey'];_0x48fe0a=_0x3d61d2['moduleName'];_0x16a9d2=_0x3d61d2['remoteUri'];var _0xe41832=_0x16a9d2['slice'](-0x1);if(_0xe41832==='/'){_0x16a9d2=_0x16a9d2[_0x98da('0x55')](0x0,_0x16a9d2[_0x98da('0x56')](_0xe41832));}_0x1f1fd0=util[_0x98da('0x57')](_0x98da('0x58'),_0x16a9d2);var _0x28a1d4={'method':_0x98da('0x59'),'uri':_0x1f1fd0,'qs':{'operation':'getchallenge','username':_0x3d61d2['username']},'json':!![]};return rp(_0x28a1d4);}})[_0x98da('0x23')](function(_0x4a3799){if(_0x4a3799[_0x98da('0x5a')]){var _0x482bf6={'method':_0x98da('0x5b'),'uri':_0x1f1fd0,'form':{'operation':_0x98da('0x5c'),'username':_0x3984c0,'accessKey':md5(_0x4a3799[_0x98da('0x5d')][_0x98da('0x5e')]+_0x50a12d)},'json':!![]};return rp(_0x482bf6);}})[_0x98da('0x23')](function(_0x4ddb1a){if(_0x4ddb1a[_0x98da('0x5a')]){var _0x23c3b1={'method':_0x98da('0x59'),'uri':_0x1f1fd0,'qs':{'operation':_0x98da('0x5f'),'username':_0x3984c0,'sessionName':_0x4ddb1a[_0x98da('0x5d')][_0x98da('0x60')],'elementType':_0x48fe0a},'json':!![]};return rp(_0x23c3b1);}})[_0x98da('0x23')](function(_0x376361){if(_0x376361['success']){var _0x4519ef=[_0x98da('0x61'),_0x98da('0x62'),_0x98da('0x63')];_[_0x98da('0x64')](_0x376361[_0x98da('0x5d')]['fields'],function(_0x1c7d70){return _0x4519ef[_0x98da('0x65')](_0x1c7d70['type'][_0x98da('0x26')]);});_[_0x98da('0x64')](_0x376361[_0x98da('0x5d')][_0x98da('0x30')],function(_0x4e496e){return _0x4e496e[_0x98da('0x66')]===_0x98da('0x67');});return{'count':_0x376361[_0x98da('0x5d')][_0x98da('0x30')]['length'],'rows':_[_0x98da('0x2b')](_0x376361['result'][_0x98da('0x30')],function(_0x21ea5d){return{'id':_0x21ea5d[_0x98da('0x26')],'name':_0x21ea5d['label'],'custom':_[_0x98da('0x68')](_0x21ea5d[_0x98da('0x26')],_0x98da('0x69'))?!![]:![],'options':_0x21ea5d['type'][_0x98da('0x26')]===_0x98da('0x6a')&&_0x21ea5d[_0x98da('0x39')][_0x98da('0x6b')][_0x98da('0x40')]>0x0?_[_0x98da('0x2b')](_0x21ea5d[_0x98da('0x39')][_0x98da('0x6b')],function(_0x490fff){return{'name':_0x490fff[_0x98da('0x6c')],'value':_0x490fff[_0x98da('0x6d')]};}):[]};})};}})[_0x98da('0x23')](respondWithResult(_0x293fd2,null))[_0x98da('0x3d')](function(_0x19e8f4){console[_0x98da('0x6e')]('vTiger\x20error:\x20'+_0x19e8f4);var _0x1539c5=_0x1d8377['query']['test']?0x1f4:_0x19e8f4['statusCode']||0x1f4;logger[_0x98da('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x98da('0x6f'),_0x1539c5,JSON['stringify'](_0x19e8f4));delete _0x19e8f4['name'];if(_0x1539c5===0x191){_0x1539c5=0x190;}_0x293fd2[_0x98da('0x19')](_0x1539c5)[_0x98da('0x70')](_0x1d8377['query'][_0x98da('0x71')]?{'message':_0x98da('0x72'),'statusCode':_0x19e8f4['statusCode']}:_0x19e8f4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 02c2f1e..0933996 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 _0xa858=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa858,0x1c6));var _0x8a85=function(_0x2859ea,_0x52bf5f){_0x2859ea=_0x2859ea-0x0;var _0x1b1d4a=_0xa858[_0x2859ea];return _0x1b1d4a;};'use strict';var _=require(_0x8a85('0x0'));var util=require(_0x8a85('0x1'));var logger=require(_0x8a85('0x2'))(_0x8a85('0x3'));var moment=require('moment');var BPromise=require(_0x8a85('0x4'));var rp=require(_0x8a85('0x5'));var fs=require('fs');var path=require(_0x8a85('0x6'));var rimraf=require(_0x8a85('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a85('0x8'));var integrations=require(_0x8a85('0x9'));module[_0x8a85('0xa')]=function(_0x4fc4d4,_0x2613e6){return _0x4fc4d4[_0x8a85('0xb')]('VtigerAccount',attributes,{'tableName':_0x8a85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8273=['util','api','moment','bluebird','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x8273,0x1d3));var _0x3827=function(_0x16287d,_0x49d61a){_0x16287d=_0x16287d-0x0;var _0x5eed8c=_0x8273[_0x16287d];return _0x5eed8c;};'use strict';var _=require(_0x3827('0x0'));var util=require(_0x3827('0x1'));var logger=require('../../config/logger')(_0x3827('0x2'));var moment=require(_0x3827('0x3'));var BPromise=require(_0x3827('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3827('0x5'));var config=require(_0x3827('0x6'));var attributes=require(_0x3827('0x7'));var integrations=require(_0x3827('0x8'));module[_0x3827('0x9')]=function(_0x58534b,_0x3528a3){return _0x58534b[_0x3827('0xa')](_0x3827('0xb'),attributes,{'tableName':_0x3827('0xc'),'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 c16f8a7..c848197 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 _0x84a0=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment'];(function(_0xa7af59,_0x3856ee){var _0x268bc2=function(_0x24fb0d){while(--_0x24fb0d){_0xa7af59['push'](_0xa7af59['shift']());}};_0x268bc2(++_0x3856ee);}(_0x84a0,0x66));var _0x084a=function(_0x413c42,_0x5d96d5){_0x413c42=_0x413c42-0x0;var _0x2b4a9d=_0x84a0[_0x413c42];return _0x2b4a9d;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['GetVtigerAccount']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')]({'raw':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'limit':_0xf2c333['options']?_0xf2c333[_0x084a('0x18')][_0x084a('0x1c')]||null:null,'include':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')]?_['map'](_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')],function(_0x6346a5){return{'model':db[_0x6346a5[_0x084a('0x1e')]],'as':_0x6346a5['as'],'attributes':_0x6346a5[_0x084a('0x1b')],'include':_0x6346a5[_0x084a('0x1d')]?_['map'](_0x6346a5[_0x084a('0x1d')],function(_0x2af138){return{'model':db[_0x2af138[_0x084a('0x1e')]],'as':_0x2af138['as'],'attributes':_0x2af138['attributes'],'include':_0x2af138[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x2af138[_0x084a('0x1d')],function(_0x4c5658){return{'model':db[_0x4c5658['model']],'as':_0x4c5658['as'],'attributes':_0x4c5658['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b88f){logger['info']('GetVtigerAccount',_0xf2c333);logger['debug'](_0x084a('0x20'),_0xf2c333,JSON[_0x084a('0x10')](_0x33b88f));_0x4134b9(_0x33b88f);})[_0x084a('0x15')](function(_0x2c4149){logger[_0x084a('0x11')](_0x084a('0x20'),_0x2c4149[_0x084a('0x13')],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x2c4149['message']));});});};exports[_0x084a('0x21')]=function(_0x3b2b38){var _0x501a16=this;return new Promise(function(_0xe1980b,_0x24bcf5){return db[_0x084a('0x16')][_0x084a('0x22')]({'raw':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'include':_0x3b2b38['options']?_0x3b2b38['options'][_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x3b2b38[_0x084a('0x18')][_0x084a('0x1d')],function(_0x83f94f){return{'model':db[_0x83f94f['model']],'as':_0x83f94f['as'],'attributes':_0x83f94f[_0x084a('0x1b')],'include':_0x83f94f[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x83f94f['include'],function(_0x109593){return{'model':db[_0x109593[_0x084a('0x1e')]],'as':_0x109593['as'],'attributes':_0x109593[_0x084a('0x1b')],'include':_0x109593['include']?_['map'](_0x109593['include'],function(_0xf97d1b){return{'model':db[_0xf97d1b[_0x084a('0x1e')]],'as':_0xf97d1b['as'],'attributes':_0xf97d1b[_0x084a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c09c3){logger[_0x084a('0xc')](_0x084a('0x21'),_0x3b2b38);logger[_0x084a('0xd')](_0x084a('0x21'),_0x3b2b38,JSON[_0x084a('0x10')](_0x3c09c3));_0xe1980b(_0x3c09c3);})[_0x084a('0x15')](function(_0x19354f){logger[_0x084a('0x11')](_0x084a('0x21'),_0x19354f[_0x084a('0x13')],_0x3b2b38);_0x24bcf5(_0x501a16[_0x084a('0x11')](0x1f4,_0x19354f[_0x084a('0x13')]));});});}; \ No newline at end of file +var _0xd4f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x12a6b3,_0x4ae3a3){var _0x1a343e=function(_0x4123de){while(--_0x4123de){_0x12a6b3['push'](_0x12a6b3['shift']());}};_0x1a343e(++_0x4ae3a3);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x57926a,_0xc5b0a3){_0x57926a=_0x57926a-0x0;var _0x40a513=_0xd4f4[_0x57926a];return _0x40a513;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['VtigerAccount'][_0x4d4f('0x18')]({'raw':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1b')]||null:null,'attributes':_0x51dcf1['options']?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1c')]||null:null,'limit':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1d')]||null:null,'include':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1e')]?_['map'](_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1e')],function(_0x2d2fb3){return{'model':db[_0x2d2fb3[_0x4d4f('0x1f')]],'as':_0x2d2fb3['as'],'attributes':_0x2d2fb3[_0x4d4f('0x1c')],'include':_0x2d2fb3['include']?_[_0x4d4f('0x20')](_0x2d2fb3[_0x4d4f('0x1e')],function(_0x1cf365){return{'model':db[_0x1cf365[_0x4d4f('0x1f')]],'as':_0x1cf365['as'],'attributes':_0x1cf365['attributes'],'include':_0x1cf365['include']?_[_0x4d4f('0x20')](_0x1cf365[_0x4d4f('0x1e')],function(_0xa2492c){return{'model':db[_0xa2492c[_0x4d4f('0x1f')]],'as':_0xa2492c['as'],'attributes':_0xa2492c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x380ebf){logger[_0x4d4f('0xd')](_0x4d4f('0x17'),_0x51dcf1);logger['debug'](_0x4d4f('0x17'),_0x51dcf1,JSON['stringify'](_0x380ebf));_0x519501(_0x380ebf);})[_0x4d4f('0x16')](function(_0x333a40){logger['error'](_0x4d4f('0x17'),_0x333a40[_0x4d4f('0x15')],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x333a40[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x21')]=function(_0x43a704){var _0x4c69cb=this;return new Promise(function(_0x36eede,_0x4578b6){return db[_0x4d4f('0x22')][_0x4d4f('0x23')]({'raw':_0x43a704[_0x4d4f('0x19')]?_0x43a704['options'][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')]['where']||null:null,'attributes':_0x43a704['options']?_0x43a704['options'][_0x4d4f('0x1c')]||null:null,'include':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')][_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x43a704['options'][_0x4d4f('0x1e')],function(_0x1ab7c4){return{'model':db[_0x1ab7c4[_0x4d4f('0x1f')]],'as':_0x1ab7c4['as'],'attributes':_0x1ab7c4['attributes'],'include':_0x1ab7c4[_0x4d4f('0x1e')]?_['map'](_0x1ab7c4[_0x4d4f('0x1e')],function(_0x2f18df){return{'model':db[_0x2f18df[_0x4d4f('0x1f')]],'as':_0x2f18df['as'],'attributes':_0x2f18df[_0x4d4f('0x1c')],'include':_0x2f18df[_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x2f18df[_0x4d4f('0x1e')],function(_0x461900){return{'model':db[_0x461900['model']],'as':_0x461900['as'],'attributes':_0x461900['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x559441){logger['info'](_0x4d4f('0x21'),_0x43a704);logger[_0x4d4f('0x10')](_0x4d4f('0x21'),_0x43a704,JSON[_0x4d4f('0x12')](_0x559441));_0x36eede(_0x559441);})[_0x4d4f('0x16')](function(_0x56eed8){logger[_0x4d4f('0x13')](_0x4d4f('0x21'),_0x56eed8['message'],_0x43a704);_0x4578b6(_0x4c69cb[_0x4d4f('0x13')](0x1f4,_0x56eed8[_0x4d4f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 82a506c..85fd431 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 _0xeb82=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','post','create','update','exports','multer','util','path','express','Router'];(function(_0x4b513c,_0x408e14){var _0x3567bd=function(_0x4d7dd6){while(--_0x4d7dd6){_0x4b513c['push'](_0x4b513c['shift']());}};_0x3567bd(++_0x408e14);}(_0xeb82,0xa3));var _0x2eb8=function(_0x11a5c7,_0x47208f){_0x11a5c7=_0x11a5c7-0x0;var _0x4e5720=_0xeb82[_0x11a5c7];return _0x4e5720;};'use strict';var multer=require(_0x2eb8('0x0'));var util=require(_0x2eb8('0x1'));var path=require(_0x2eb8('0x2'));var timeout=require('connect-timeout');var express=require(_0x2eb8('0x3'));var router=express[_0x2eb8('0x4')]();var fs_extra=require(_0x2eb8('0x5'));var auth=require(_0x2eb8('0x6'));var interaction=require(_0x2eb8('0x7'));var config=require(_0x2eb8('0x8'));var controller=require(_0x2eb8('0x9'));router[_0x2eb8('0xa')]('/',auth[_0x2eb8('0xb')](),controller[_0x2eb8('0xc')]);router[_0x2eb8('0xa')](_0x2eb8('0xd'),auth[_0x2eb8('0xb')](),controller['show']);router[_0x2eb8('0xa')]('/:id/fields',auth[_0x2eb8('0xb')](),controller[_0x2eb8('0xe')]);router['get'](_0x2eb8('0xf'),auth['isAuthenticated'](),controller[_0x2eb8('0x10')]);router[_0x2eb8('0xa')]('/:id/descriptions',auth[_0x2eb8('0xb')](),controller['getDescriptions']);router[_0x2eb8('0x11')]('/',auth[_0x2eb8('0xb')](),controller[_0x2eb8('0x12')]);router['put']('/:id',auth[_0x2eb8('0xb')](),controller[_0x2eb8('0x13')]);router['delete']('/:id',auth[_0x2eb8('0xb')](),controller['destroy']);module[_0x2eb8('0x14')]=router; \ No newline at end of file +var _0x47a0=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields'];(function(_0x2773ac,_0xdc65e2){var _0xa7e341=function(_0x907e78){while(--_0x907e78){_0x2773ac['push'](_0x2773ac['shift']());}};_0xa7e341(++_0xdc65e2);}(_0x47a0,0x18c));var _0x047a=function(_0x22b4c7,_0x153617){_0x22b4c7=_0x22b4c7-0x0;var _0x267b34=_0x47a0[_0x22b4c7];return _0x267b34;};'use strict';var multer=require(_0x047a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x047a('0x1'));var router=express[_0x047a('0x2')]();var fs_extra=require(_0x047a('0x3'));var auth=require(_0x047a('0x4'));var interaction=require(_0x047a('0x5'));var config=require(_0x047a('0x6'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x047a('0x7')](),controller[_0x047a('0x8')]);router[_0x047a('0x9')]('/:id',auth[_0x047a('0x7')](),controller[_0x047a('0xa')]);router[_0x047a('0x9')](_0x047a('0xb'),auth['isAuthenticated'](),controller[_0x047a('0xc')]);router['get'](_0x047a('0xd'),auth[_0x047a('0x7')](),controller[_0x047a('0xe')]);router[_0x047a('0x9')](_0x047a('0xf'),auth[_0x047a('0x7')](),controller[_0x047a('0x10')]);router['post']('/',auth[_0x047a('0x7')](),controller[_0x047a('0x11')]);router[_0x047a('0x12')](_0x047a('0x13'),auth[_0x047a('0x7')](),controller[_0x047a('0x14')]);router[_0x047a('0x15')](_0x047a('0x13'),auth[_0x047a('0x7')](),controller[_0x047a('0x16')]);module[_0x047a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 65d2652..ccbed28 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 _0x8260=['sequelize','exports','STRING'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x8260,0x114));var _0x0826=function(_0x2a0dc9,_0x3802f4){_0x2a0dc9=_0x2a0dc9-0x0;var _0x198be1=_0x8260[_0x2a0dc9];return _0x198be1;};'use strict';var Sequelize=require(_0x0826('0x0'));module[_0x0826('0x1')]={'name':{'type':Sequelize[_0x0826('0x2')]},'description':{'type':Sequelize[_0x0826('0x2')]}}; \ No newline at end of file +var _0x655e=['STRING','exports'];(function(_0x580ed8,_0x3cb30b){var _0x4ab0f0=function(_0x223118){while(--_0x223118){_0x580ed8['push'](_0x580ed8['shift']());}};_0x4ab0f0(++_0x3cb30b);}(_0x655e,0x8d));var _0xe655=function(_0x27ff03,_0x388424){_0x27ff03=_0x27ff03-0x0;var _0x1fc248=_0x655e[_0x27ff03];return _0x1fc248;};'use strict';var Sequelize=require('sequelize');module[_0xe655('0x0')]={'name':{'type':Sequelize[_0xe655('0x1')]},'description':{'type':Sequelize[_0xe655('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 860af6d..84099d0 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 _0x0f94=['offset','Content-Range','json','apply','update','then','destroy','end','sendStatus','error','name','send','index','VtigerConfiguration','type','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','fields','include','find','catch','create','body','findOne','VtigerField','rawAttributes','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','limit','undefined','count'];(function(_0x2f2aa9,_0x35c7a2){var _0x510c2a=function(_0x181ec6){while(--_0x181ec6){_0x2f2aa9['push'](_0x2f2aa9['shift']());}};_0x510c2a(++_0x35c7a2);}(_0x0f94,0x1ad));var _0x40f9=function(_0x3872b6,_0x3c2184){_0x3872b6=_0x3872b6-0x0;var _0x2629d5=_0x0f94[_0x3872b6];return _0x2629d5;};'use strict';var emlformat=require(_0x40f9('0x0'));var rimraf=require(_0x40f9('0x1'));var zipdir=require(_0x40f9('0x2'));var jsonpatch=require(_0x40f9('0x3'));var rp=require(_0x40f9('0x4'));var moment=require(_0x40f9('0x5'));var BPromise=require(_0x40f9('0x6'));var Mustache=require(_0x40f9('0x7'));var util=require(_0x40f9('0x8'));var path=require(_0x40f9('0x9'));var sox=require(_0x40f9('0xa'));var csv=require('to-csv');var ejs=require(_0x40f9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40f9('0xc'));var squel=require(_0x40f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x40f9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x40f9('0xf'));var Papa=require(_0x40f9('0x10'));var Redis=require(_0x40f9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x40f9('0x12'));var hardwareService=require(_0x40f9('0x13'));var logger=require('../../config/logger')(_0x40f9('0x14'));var utils=require('../../config/utils');var config=require(_0x40f9('0x15'));var licenseUtil=require(_0x40f9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3418ed,_0x48c074){_0x48c074=_0x48c074||0xcc;return function(_0x888bcd){if(_0x888bcd){return _0x3418ed['sendStatus'](_0x48c074);}return _0x3418ed[_0x40f9('0x17')](_0x48c074)['end']();};}function respondWithResult(_0x5dc3ec,_0x4eb624){_0x4eb624=_0x4eb624||0xc8;return function(_0x40b245){if(_0x40b245){return _0x5dc3ec[_0x40f9('0x17')](_0x4eb624)['json'](_0x40b245);}};}function respondWithFilteredResult(_0x5c5cfe,_0x57266a){return function(_0x36f7b8){if(_0x36f7b8){var _0x59a941=typeof _0x57266a['offset']==='undefined'&&typeof _0x57266a[_0x40f9('0x18')]===_0x40f9('0x19');var _0x454564=_0x36f7b8[_0x40f9('0x1a')];var _0x396790=_0x59a941?0x0:_0x57266a['offset'];var _0x4b3a1c=_0x59a941?_0x36f7b8[_0x40f9('0x1a')]:_0x57266a[_0x40f9('0x1b')]+_0x57266a['limit'];var _0x5ce6d4;if(_0x4b3a1c>=_0x454564){_0x4b3a1c=_0x454564;_0x5ce6d4=0xc8;}else{_0x5ce6d4=0xce;}_0x5c5cfe[_0x40f9('0x17')](_0x5ce6d4);return _0x5c5cfe['set'](_0x40f9('0x1c'),_0x396790+'-'+_0x4b3a1c+'/'+_0x454564)[_0x40f9('0x1d')](_0x36f7b8);}return null;};}function patchUpdates(_0x3904b8){return function(_0x25afda){try{jsonpatch[_0x40f9('0x1e')](_0x25afda,_0x3904b8,!![]);}catch(_0x55b6b2){return BPromise['reject'](_0x55b6b2);}return _0x25afda['save']();};}function saveUpdates(_0x3569ac,_0x6ec87b){return function(_0x523785){if(_0x523785){return _0x523785[_0x40f9('0x1f')](_0x3569ac)[_0x40f9('0x20')](function(_0x41195a){return _0x41195a;});}return null;};}function removeEntity(_0x51c999,_0x16d17f){return function(_0x353da2){if(_0x353da2){return _0x353da2[_0x40f9('0x21')]()[_0x40f9('0x20')](function(){_0x51c999[_0x40f9('0x17')](0xcc)[_0x40f9('0x22')]();});}};}function handleEntityNotFound(_0x3cd1d0,_0x2eb08e){return function(_0x176899){if(!_0x176899){_0x3cd1d0[_0x40f9('0x23')](0x194);}return _0x176899;};}function handleError(_0x1fc528,_0x38fa83){_0x38fa83=_0x38fa83||0x1f4;return function(_0x2754bc){logger[_0x40f9('0x24')](_0x2754bc['stack']);if(_0x2754bc[_0x40f9('0x25')]){delete _0x2754bc[_0x40f9('0x25')];}_0x1fc528['status'](_0x38fa83)[_0x40f9('0x26')](_0x2754bc);};}exports[_0x40f9('0x27')]=function(_0x495826,_0x4e87b0){var _0x4e71e6={},_0x1f1fb6={},_0x2bb875={'count':0x0,'rows':[]};var _0x3e7f76=_['map'](db[_0x40f9('0x28')]['rawAttributes'],function(_0x1df098){return{'name':_0x1df098['fieldName'],'type':_0x1df098[_0x40f9('0x29')][_0x40f9('0x2a')]};});_0x1f1fb6[_0x40f9('0x2b')]=_[_0x40f9('0x2c')](_0x3e7f76,'name');_0x1f1fb6[_0x40f9('0x2d')]=_[_0x40f9('0x2e')](_0x495826['query']);_0x1f1fb6[_0x40f9('0x2f')]=_['intersection'](_0x1f1fb6['model'],_0x1f1fb6[_0x40f9('0x2d')]);_0x4e71e6[_0x40f9('0x30')]=_[_0x40f9('0x31')](_0x1f1fb6[_0x40f9('0x2b')],qs['fields'](_0x495826[_0x40f9('0x2d')]['fields']));_0x4e71e6[_0x40f9('0x30')]=_0x4e71e6[_0x40f9('0x30')][_0x40f9('0x32')]?_0x4e71e6[_0x40f9('0x30')]:_0x1f1fb6[_0x40f9('0x2b')];if(!_0x495826['query'][_0x40f9('0x33')](_0x40f9('0x34'))){_0x4e71e6['limit']=qs[_0x40f9('0x18')](_0x495826[_0x40f9('0x2d')][_0x40f9('0x18')]);_0x4e71e6[_0x40f9('0x1b')]=qs[_0x40f9('0x1b')](_0x495826[_0x40f9('0x2d')][_0x40f9('0x1b')]);}_0x4e71e6[_0x40f9('0x35')]=qs['sort'](_0x495826[_0x40f9('0x2d')][_0x40f9('0x36')]);_0x4e71e6[_0x40f9('0x37')]=qs['filters'](_[_0x40f9('0x38')](_0x495826[_0x40f9('0x2d')],_0x1f1fb6[_0x40f9('0x2f')]),_0x3e7f76);if(_0x495826[_0x40f9('0x2d')][_0x40f9('0x39')]){_0x4e71e6[_0x40f9('0x37')]=_[_0x40f9('0x3a')](_0x4e71e6[_0x40f9('0x37')],{'$or':_['map'](_0x3e7f76,function(_0x27ba33){if(_0x27ba33[_0x40f9('0x29')]!==_0x40f9('0x3b')){var _0x4fad1e={};_0x4fad1e[_0x27ba33[_0x40f9('0x25')]]={'$like':'%'+_0x495826[_0x40f9('0x2d')][_0x40f9('0x39')]+'%'};return _0x4fad1e;}})});}_0x4e71e6=_['merge']({},_0x4e71e6,_0x495826[_0x40f9('0x3c')]);var _0x28a0d1={'where':_0x4e71e6['where']};return db[_0x40f9('0x28')][_0x40f9('0x1a')](_0x28a0d1)['then'](function(_0x2ceec8){_0x2bb875[_0x40f9('0x1a')]=_0x2ceec8;if(_0x495826['query'][_0x40f9('0x3d')]){_0x4e71e6['include']=[{'all':!![]}];}return db[_0x40f9('0x28')][_0x40f9('0x3e')](_0x4e71e6);})[_0x40f9('0x20')](function(_0x3660fa){_0x2bb875['rows']=_0x3660fa;return _0x2bb875;})[_0x40f9('0x20')](respondWithFilteredResult(_0x4e87b0,_0x4e71e6))['catch'](handleError(_0x4e87b0,null));};exports['show']=function(_0x34d4fc,_0x40a8d2){var _0x227272={'raw':![],'where':{'id':_0x34d4fc[_0x40f9('0x3f')]['id']}},_0x244e62={};_0x244e62['model']=_[_0x40f9('0x2e')](db[_0x40f9('0x28')]['rawAttributes']);_0x244e62[_0x40f9('0x2d')]=_[_0x40f9('0x2e')](_0x34d4fc[_0x40f9('0x2d')]);_0x244e62[_0x40f9('0x2f')]=_[_0x40f9('0x31')](_0x244e62[_0x40f9('0x2b')],_0x244e62['query']);_0x227272[_0x40f9('0x30')]=_['intersection'](_0x244e62['model'],qs[_0x40f9('0x40')](_0x34d4fc[_0x40f9('0x2d')][_0x40f9('0x40')]));_0x227272[_0x40f9('0x30')]=_0x227272[_0x40f9('0x30')][_0x40f9('0x32')]?_0x227272[_0x40f9('0x30')]:_0x244e62[_0x40f9('0x2b')];if(_0x34d4fc['query'][_0x40f9('0x3d')]){_0x227272[_0x40f9('0x41')]=[{'all':!![]}];}_0x227272=_[_0x40f9('0x3a')]({},_0x227272,_0x34d4fc['options']);return db[_0x40f9('0x28')][_0x40f9('0x42')](_0x227272)['then'](handleEntityNotFound(_0x40a8d2,null))[_0x40f9('0x20')](respondWithResult(_0x40a8d2,null))[_0x40f9('0x43')](handleError(_0x40a8d2,null));};exports[_0x40f9('0x44')]=function(_0x462154,_0x11cd1f){return db[_0x40f9('0x28')][_0x40f9('0x44')](_0x462154[_0x40f9('0x45')],{})[_0x40f9('0x20')](respondWithResult(_0x11cd1f,0xc9))['catch'](handleError(_0x11cd1f,null));};exports[_0x40f9('0x1f')]=function(_0x2a1199,_0x281b1f){if(_0x2a1199[_0x40f9('0x45')]['id']){delete _0x2a1199[_0x40f9('0x45')]['id'];}return db[_0x40f9('0x28')][_0x40f9('0x42')]({'where':{'id':_0x2a1199[_0x40f9('0x3f')]['id']}})[_0x40f9('0x20')](handleEntityNotFound(_0x281b1f,null))[_0x40f9('0x20')](saveUpdates(_0x2a1199[_0x40f9('0x45')],null))[_0x40f9('0x20')](respondWithResult(_0x281b1f,null))[_0x40f9('0x43')](handleError(_0x281b1f,null));};exports['destroy']=function(_0xd07b8c,_0x1f38e1){return db[_0x40f9('0x28')]['find']({'where':{'id':_0xd07b8c[_0x40f9('0x3f')]['id']}})[_0x40f9('0x20')](handleEntityNotFound(_0x1f38e1,null))[_0x40f9('0x20')](removeEntity(_0x1f38e1,null))[_0x40f9('0x43')](handleError(_0x1f38e1,null));};exports['getFields']=function(_0x3aa4c9,_0x159ff6,_0x40b977){var _0x359865={};var _0x48fcd6={};var _0xeaed80;var _0x115cd0;return db[_0x40f9('0x28')][_0x40f9('0x46')]({'where':{'id':_0x3aa4c9[_0x40f9('0x3f')]['id']}})[_0x40f9('0x20')](handleEntityNotFound(_0x159ff6,null))['then'](function(_0xe49db5){if(_0xe49db5){_0xeaed80=_0xe49db5;_0x48fcd6[_0x40f9('0x2b')]=_[_0x40f9('0x2e')](db[_0x40f9('0x47')][_0x40f9('0x48')]);_0x48fcd6['query']=_[_0x40f9('0x2e')](_0x3aa4c9['query']);_0x48fcd6['filters']=_['intersection'](_0x48fcd6['model'],_0x48fcd6[_0x40f9('0x2d')]);_0x359865[_0x40f9('0x30')]=_[_0x40f9('0x31')](_0x48fcd6[_0x40f9('0x2b')],qs['fields'](_0x3aa4c9[_0x40f9('0x2d')][_0x40f9('0x40')]));_0x359865['attributes']=_0x359865[_0x40f9('0x30')][_0x40f9('0x32')]?_0x359865[_0x40f9('0x30')]:_0x48fcd6['model'];_0x359865[_0x40f9('0x35')]=qs[_0x40f9('0x36')](_0x3aa4c9[_0x40f9('0x2d')]['sort']);_0x359865[_0x40f9('0x37')]=qs[_0x40f9('0x2f')](_[_0x40f9('0x38')](_0x3aa4c9['query'],_0x48fcd6[_0x40f9('0x2f')]));if(_0x3aa4c9[_0x40f9('0x2d')][_0x40f9('0x39')]){_0x359865[_0x40f9('0x37')]=_[_0x40f9('0x3a')](_0x359865[_0x40f9('0x37')],{'$or':_[_0x40f9('0x2c')](_0x359865[_0x40f9('0x30')],function(_0x40bd9f){var _0x4288da={};_0x4288da[_0x40bd9f]={'$like':'%'+_0x3aa4c9[_0x40f9('0x2d')][_0x40f9('0x39')]+'%'};return _0x4288da;})});}_0x359865=_['merge']({},_0x359865,_0x3aa4c9[_0x40f9('0x3c')]);return _0xeaed80[_0x40f9('0x49')](_0x359865);}})['then'](function(_0x1fefbf){if(_0x1fefbf){_0x115cd0=_0x1fefbf[_0x40f9('0x32')];if(!_0x3aa4c9[_0x40f9('0x2d')][_0x40f9('0x33')]('nolimit')){_0x359865[_0x40f9('0x18')]=qs[_0x40f9('0x18')](_0x3aa4c9[_0x40f9('0x2d')][_0x40f9('0x18')]);_0x359865[_0x40f9('0x1b')]=qs['offset'](_0x3aa4c9[_0x40f9('0x2d')]['offset']);}return _0xeaed80['getFields'](_0x359865);}})['then'](function(_0xcfe6db){if(_0xcfe6db){return _0xcfe6db?{'count':_0x115cd0,'rows':_0xcfe6db}:null;}})[_0x40f9('0x20')](respondWithResult(_0x159ff6,null))[_0x40f9('0x43')](handleError(_0x159ff6,null));};exports['getSubjects']=function(_0x139f57,_0x2d0aa3,_0x38a87b){var _0x300417={};var _0x5bf0f2={};var _0x2d3169;var _0x3fde21;return db[_0x40f9('0x28')]['findOne']({'where':{'id':_0x139f57[_0x40f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2d0aa3,null))[_0x40f9('0x20')](function(_0x426a93){if(_0x426a93){_0x2d3169=_0x426a93;_0x5bf0f2[_0x40f9('0x2b')]=_[_0x40f9('0x2e')](db[_0x40f9('0x47')][_0x40f9('0x48')]);_0x5bf0f2['query']=_[_0x40f9('0x2e')](_0x139f57[_0x40f9('0x2d')]);_0x5bf0f2[_0x40f9('0x2f')]=_[_0x40f9('0x31')](_0x5bf0f2[_0x40f9('0x2b')],_0x5bf0f2[_0x40f9('0x2d')]);_0x300417[_0x40f9('0x30')]=_[_0x40f9('0x31')](_0x5bf0f2[_0x40f9('0x2b')],qs['fields'](_0x139f57['query']['fields']));_0x300417['attributes']=_0x300417['attributes'][_0x40f9('0x32')]?_0x300417[_0x40f9('0x30')]:_0x5bf0f2[_0x40f9('0x2b')];_0x300417['order']=qs[_0x40f9('0x36')](_0x139f57[_0x40f9('0x2d')][_0x40f9('0x36')]);_0x300417[_0x40f9('0x37')]=qs[_0x40f9('0x2f')](_[_0x40f9('0x38')](_0x139f57[_0x40f9('0x2d')],_0x5bf0f2[_0x40f9('0x2f')]));if(_0x139f57[_0x40f9('0x2d')][_0x40f9('0x39')]){_0x300417[_0x40f9('0x37')]=_[_0x40f9('0x3a')](_0x300417[_0x40f9('0x37')],{'$or':_['map'](_0x300417[_0x40f9('0x30')],function(_0x1880b3){var _0x5bdfc8={};_0x5bdfc8[_0x1880b3]={'$like':'%'+_0x139f57[_0x40f9('0x2d')][_0x40f9('0x39')]+'%'};return _0x5bdfc8;})});}_0x300417=_[_0x40f9('0x3a')]({},_0x300417,_0x139f57['options']);return _0x2d3169['getSubjects'](_0x300417);}})[_0x40f9('0x20')](function(_0x421546){if(_0x421546){_0x3fde21=_0x421546[_0x40f9('0x32')];if(!_0x139f57[_0x40f9('0x2d')][_0x40f9('0x33')](_0x40f9('0x34'))){_0x300417[_0x40f9('0x18')]=qs[_0x40f9('0x18')](_0x139f57[_0x40f9('0x2d')][_0x40f9('0x18')]);_0x300417['offset']=qs[_0x40f9('0x1b')](_0x139f57[_0x40f9('0x2d')][_0x40f9('0x1b')]);}return _0x2d3169[_0x40f9('0x4a')](_0x300417);}})[_0x40f9('0x20')](function(_0xd17203){if(_0xd17203){return _0xd17203?{'count':_0x3fde21,'rows':_0xd17203}:null;}})[_0x40f9('0x20')](respondWithResult(_0x2d0aa3,null))[_0x40f9('0x43')](handleError(_0x2d0aa3,null));};exports[_0x40f9('0x4b')]=function(_0x40bcfb,_0x1b2de9,_0x4da424){var _0x30de88={};var _0x992922={};var _0x571629;var _0x21a256;return db[_0x40f9('0x28')][_0x40f9('0x46')]({'where':{'id':_0x40bcfb['params']['id']}})['then'](handleEntityNotFound(_0x1b2de9,null))[_0x40f9('0x20')](function(_0x55e055){if(_0x55e055){_0x571629=_0x55e055;_0x992922['model']=_[_0x40f9('0x2e')](db[_0x40f9('0x47')]['rawAttributes']);_0x992922['query']=_[_0x40f9('0x2e')](_0x40bcfb[_0x40f9('0x2d')]);_0x992922[_0x40f9('0x2f')]=_[_0x40f9('0x31')](_0x992922['model'],_0x992922[_0x40f9('0x2d')]);_0x30de88[_0x40f9('0x30')]=_[_0x40f9('0x31')](_0x992922[_0x40f9('0x2b')],qs['fields'](_0x40bcfb[_0x40f9('0x2d')][_0x40f9('0x40')]));_0x30de88['attributes']=_0x30de88['attributes'][_0x40f9('0x32')]?_0x30de88[_0x40f9('0x30')]:_0x992922[_0x40f9('0x2b')];_0x30de88[_0x40f9('0x35')]=qs[_0x40f9('0x36')](_0x40bcfb['query'][_0x40f9('0x36')]);_0x30de88['where']=qs[_0x40f9('0x2f')](_['pick'](_0x40bcfb[_0x40f9('0x2d')],_0x992922[_0x40f9('0x2f')]));if(_0x40bcfb[_0x40f9('0x2d')][_0x40f9('0x39')]){_0x30de88[_0x40f9('0x37')]=_['merge'](_0x30de88[_0x40f9('0x37')],{'$or':_[_0x40f9('0x2c')](_0x30de88[_0x40f9('0x30')],function(_0xfcdf8d){var _0x5dff5f={};_0x5dff5f[_0xfcdf8d]={'$like':'%'+_0x40bcfb[_0x40f9('0x2d')][_0x40f9('0x39')]+'%'};return _0x5dff5f;})});}_0x30de88=_[_0x40f9('0x3a')]({},_0x30de88,_0x40bcfb['options']);return _0x571629['getDescriptions'](_0x30de88);}})[_0x40f9('0x20')](function(_0x32a5bc){if(_0x32a5bc){_0x21a256=_0x32a5bc[_0x40f9('0x32')];if(!_0x40bcfb[_0x40f9('0x2d')][_0x40f9('0x33')](_0x40f9('0x34'))){_0x30de88[_0x40f9('0x18')]=qs[_0x40f9('0x18')](_0x40bcfb[_0x40f9('0x2d')]['limit']);_0x30de88[_0x40f9('0x1b')]=qs[_0x40f9('0x1b')](_0x40bcfb[_0x40f9('0x2d')]['offset']);}return _0x571629['getDescriptions'](_0x30de88);}})['then'](function(_0x203e64){if(_0x203e64){return _0x203e64?{'count':_0x21a256,'rows':_0x203e64}:null;}})[_0x40f9('0x20')](respondWithResult(_0x1b2de9,null))[_0x40f9('0x43')](handleError(_0x1b2de9,null));}; \ No newline at end of file +var _0xd5cc=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','VtigerField','getFields','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','limit','undefined','count','offset','Content-Range','apply','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order'];(function(_0xfc2bbb,_0xfb15c){var _0x2f26cb=function(_0xb0564c){while(--_0xb0564c){_0xfc2bbb['push'](_0xfc2bbb['shift']());}};_0x2f26cb(++_0xfb15c);}(_0xd5cc,0xfb));var _0xcd5c=function(_0x332731,_0x4d9696){_0x332731=_0x332731-0x0;var _0x31cdf4=_0xd5cc[_0x332731];return _0x31cdf4;};'use strict';var emlformat=require(_0xcd5c('0x0'));var rimraf=require(_0xcd5c('0x1'));var zipdir=require(_0xcd5c('0x2'));var jsonpatch=require(_0xcd5c('0x3'));var rp=require(_0xcd5c('0x4'));var moment=require(_0xcd5c('0x5'));var BPromise=require(_0xcd5c('0x6'));var Mustache=require('mustache');var util=require(_0xcd5c('0x7'));var path=require(_0xcd5c('0x8'));var sox=require(_0xcd5c('0x9'));var csv=require(_0xcd5c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd5c('0xb'));var squel=require(_0xcd5c('0xc'));var crypto=require('crypto');var jsforce=require(_0xcd5c('0xd'));var deskjs=require(_0xcd5c('0xe'));var toCsv=require(_0xcd5c('0xa'));var querystring=require(_0xcd5c('0xf'));var Papa=require('papaparse');var Redis=require(_0xcd5c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd5c('0x11'));var logger=require(_0xcd5c('0x12'))(_0xcd5c('0x13'));var utils=require(_0xcd5c('0x14'));var config=require(_0xcd5c('0x15'));var licenseUtil=require(_0xcd5c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346c85,_0x40aacd){_0x40aacd=_0x40aacd||0xcc;return function(_0x19d2be){if(_0x19d2be){return _0x346c85[_0xcd5c('0x17')](_0x40aacd);}return _0x346c85[_0xcd5c('0x18')](_0x40aacd)['end']();};}function respondWithResult(_0x12a05a,_0x1a5428){_0x1a5428=_0x1a5428||0xc8;return function(_0x17dda4){if(_0x17dda4){return _0x12a05a['status'](_0x1a5428)['json'](_0x17dda4);}};}function respondWithFilteredResult(_0x2060e8,_0xc0abed){return function(_0x182b98){if(_0x182b98){var _0x45e78f=typeof _0xc0abed['offset']==='undefined'&&typeof _0xc0abed[_0xcd5c('0x19')]===_0xcd5c('0x1a');var _0xaeaabc=_0x182b98[_0xcd5c('0x1b')];var _0x49febb=_0x45e78f?0x0:_0xc0abed[_0xcd5c('0x1c')];var _0x42f34e=_0x45e78f?_0x182b98[_0xcd5c('0x1b')]:_0xc0abed[_0xcd5c('0x1c')]+_0xc0abed[_0xcd5c('0x19')];var _0x193ec9;if(_0x42f34e>=_0xaeaabc){_0x42f34e=_0xaeaabc;_0x193ec9=0xc8;}else{_0x193ec9=0xce;}_0x2060e8[_0xcd5c('0x18')](_0x193ec9);return _0x2060e8['set'](_0xcd5c('0x1d'),_0x49febb+'-'+_0x42f34e+'/'+_0xaeaabc)['json'](_0x182b98);}return null;};}function patchUpdates(_0x1fd64c){return function(_0x1d1b68){try{jsonpatch[_0xcd5c('0x1e')](_0x1d1b68,_0x1fd64c,!![]);}catch(_0x13d855){return BPromise['reject'](_0x13d855);}return _0x1d1b68['save']();};}function saveUpdates(_0x5efef4,_0x4a17e3){return function(_0x5408a3){if(_0x5408a3){return _0x5408a3['update'](_0x5efef4)[_0xcd5c('0x1f')](function(_0x201d37){return _0x201d37;});}return null;};}function removeEntity(_0x1e3785,_0x54d45b){return function(_0x2efe90){if(_0x2efe90){return _0x2efe90[_0xcd5c('0x20')]()[_0xcd5c('0x1f')](function(){_0x1e3785[_0xcd5c('0x18')](0xcc)[_0xcd5c('0x21')]();});}};}function handleEntityNotFound(_0x2c7d03,_0x4c3dab){return function(_0x19bd57){if(!_0x19bd57){_0x2c7d03[_0xcd5c('0x17')](0x194);}return _0x19bd57;};}function handleError(_0x59bf01,_0x36d359){_0x36d359=_0x36d359||0x1f4;return function(_0x11713c){logger['error'](_0x11713c[_0xcd5c('0x22')]);if(_0x11713c[_0xcd5c('0x23')]){delete _0x11713c[_0xcd5c('0x23')];}_0x59bf01[_0xcd5c('0x18')](_0x36d359)[_0xcd5c('0x24')](_0x11713c);};}exports[_0xcd5c('0x25')]=function(_0x4f5ac4,_0x2b91cc){var _0x1e9121={},_0x488d8a={},_0x36ead3={'count':0x0,'rows':[]};var _0x390995=_[_0xcd5c('0x26')](db[_0xcd5c('0x27')]['rawAttributes'],function(_0x1127ce){return{'name':_0x1127ce[_0xcd5c('0x28')],'type':_0x1127ce[_0xcd5c('0x29')][_0xcd5c('0x2a')]};});_0x488d8a['model']=_[_0xcd5c('0x26')](_0x390995,'name');_0x488d8a[_0xcd5c('0x2b')]=_[_0xcd5c('0x2c')](_0x4f5ac4['query']);_0x488d8a[_0xcd5c('0x2d')]=_[_0xcd5c('0x2e')](_0x488d8a['model'],_0x488d8a[_0xcd5c('0x2b')]);_0x1e9121[_0xcd5c('0x2f')]=_[_0xcd5c('0x2e')](_0x488d8a['model'],qs[_0xcd5c('0x30')](_0x4f5ac4[_0xcd5c('0x2b')][_0xcd5c('0x30')]));_0x1e9121[_0xcd5c('0x2f')]=_0x1e9121['attributes'][_0xcd5c('0x31')]?_0x1e9121[_0xcd5c('0x2f')]:_0x488d8a[_0xcd5c('0x32')];if(!_0x4f5ac4[_0xcd5c('0x2b')][_0xcd5c('0x33')]('nolimit')){_0x1e9121[_0xcd5c('0x19')]=qs[_0xcd5c('0x19')](_0x4f5ac4[_0xcd5c('0x2b')][_0xcd5c('0x19')]);_0x1e9121['offset']=qs[_0xcd5c('0x1c')](_0x4f5ac4[_0xcd5c('0x2b')]['offset']);}_0x1e9121[_0xcd5c('0x34')]=qs[_0xcd5c('0x35')](_0x4f5ac4[_0xcd5c('0x2b')]['sort']);_0x1e9121[_0xcd5c('0x36')]=qs[_0xcd5c('0x2d')](_[_0xcd5c('0x37')](_0x4f5ac4['query'],_0x488d8a[_0xcd5c('0x2d')]),_0x390995);if(_0x4f5ac4[_0xcd5c('0x2b')][_0xcd5c('0x38')]){_0x1e9121[_0xcd5c('0x36')]=_[_0xcd5c('0x39')](_0x1e9121['where'],{'$or':_['map'](_0x390995,function(_0x31b61a){if(_0x31b61a[_0xcd5c('0x29')]!==_0xcd5c('0x3a')){var _0x3b93d5={};_0x3b93d5[_0x31b61a[_0xcd5c('0x23')]]={'$like':'%'+_0x4f5ac4[_0xcd5c('0x2b')]['filter']+'%'};return _0x3b93d5;}})});}_0x1e9121=_['merge']({},_0x1e9121,_0x4f5ac4[_0xcd5c('0x3b')]);var _0xfa0d50={'where':_0x1e9121[_0xcd5c('0x36')]};return db['VtigerConfiguration'][_0xcd5c('0x1b')](_0xfa0d50)[_0xcd5c('0x1f')](function(_0x2d6d6e){_0x36ead3[_0xcd5c('0x1b')]=_0x2d6d6e;if(_0x4f5ac4[_0xcd5c('0x2b')][_0xcd5c('0x3c')]){_0x1e9121[_0xcd5c('0x3d')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x1e9121);})[_0xcd5c('0x1f')](function(_0x3876de){_0x36ead3[_0xcd5c('0x3e')]=_0x3876de;return _0x36ead3;})['then'](respondWithFilteredResult(_0x2b91cc,_0x1e9121))[_0xcd5c('0x3f')](handleError(_0x2b91cc,null));};exports[_0xcd5c('0x40')]=function(_0x2e308e,_0x3feb12){var _0x2ff20f={'raw':![],'where':{'id':_0x2e308e[_0xcd5c('0x41')]['id']}},_0x5bfdce={};_0x5bfdce[_0xcd5c('0x32')]=_[_0xcd5c('0x2c')](db[_0xcd5c('0x27')][_0xcd5c('0x42')]);_0x5bfdce[_0xcd5c('0x2b')]=_[_0xcd5c('0x2c')](_0x2e308e[_0xcd5c('0x2b')]);_0x5bfdce['filters']=_['intersection'](_0x5bfdce[_0xcd5c('0x32')],_0x5bfdce[_0xcd5c('0x2b')]);_0x2ff20f['attributes']=_[_0xcd5c('0x2e')](_0x5bfdce[_0xcd5c('0x32')],qs[_0xcd5c('0x30')](_0x2e308e[_0xcd5c('0x2b')][_0xcd5c('0x30')]));_0x2ff20f[_0xcd5c('0x2f')]=_0x2ff20f[_0xcd5c('0x2f')][_0xcd5c('0x31')]?_0x2ff20f[_0xcd5c('0x2f')]:_0x5bfdce[_0xcd5c('0x32')];if(_0x2e308e['query'][_0xcd5c('0x3c')]){_0x2ff20f[_0xcd5c('0x3d')]=[{'all':!![]}];}_0x2ff20f=_[_0xcd5c('0x39')]({},_0x2ff20f,_0x2e308e[_0xcd5c('0x3b')]);return db[_0xcd5c('0x27')][_0xcd5c('0x43')](_0x2ff20f)['then'](handleEntityNotFound(_0x3feb12,null))['then'](respondWithResult(_0x3feb12,null))['catch'](handleError(_0x3feb12,null));};exports[_0xcd5c('0x44')]=function(_0x51a419,_0x5481b1){return db[_0xcd5c('0x27')][_0xcd5c('0x44')](_0x51a419[_0xcd5c('0x45')],{})[_0xcd5c('0x1f')](respondWithResult(_0x5481b1,0xc9))['catch'](handleError(_0x5481b1,null));};exports['update']=function(_0x17185c,_0xec088a){if(_0x17185c['body']['id']){delete _0x17185c[_0xcd5c('0x45')]['id'];}return db[_0xcd5c('0x27')]['find']({'where':{'id':_0x17185c[_0xcd5c('0x41')]['id']}})[_0xcd5c('0x1f')](handleEntityNotFound(_0xec088a,null))[_0xcd5c('0x1f')](saveUpdates(_0x17185c[_0xcd5c('0x45')],null))['then'](respondWithResult(_0xec088a,null))[_0xcd5c('0x3f')](handleError(_0xec088a,null));};exports[_0xcd5c('0x20')]=function(_0x50288e,_0x55c502){return db[_0xcd5c('0x27')][_0xcd5c('0x43')]({'where':{'id':_0x50288e[_0xcd5c('0x41')]['id']}})[_0xcd5c('0x1f')](handleEntityNotFound(_0x55c502,null))[_0xcd5c('0x1f')](removeEntity(_0x55c502,null))['catch'](handleError(_0x55c502,null));};exports['getFields']=function(_0x397bd1,_0x1e0cdf,_0x12eea4){var _0x3724e7={};var _0x25cbcc={};var _0x1a725c;var _0x5ba51f;return db[_0xcd5c('0x27')]['findOne']({'where':{'id':_0x397bd1[_0xcd5c('0x41')]['id']}})[_0xcd5c('0x1f')](handleEntityNotFound(_0x1e0cdf,null))[_0xcd5c('0x1f')](function(_0x599dd0){if(_0x599dd0){_0x1a725c=_0x599dd0;_0x25cbcc['model']=_[_0xcd5c('0x2c')](db[_0xcd5c('0x46')][_0xcd5c('0x42')]);_0x25cbcc[_0xcd5c('0x2b')]=_[_0xcd5c('0x2c')](_0x397bd1[_0xcd5c('0x2b')]);_0x25cbcc[_0xcd5c('0x2d')]=_[_0xcd5c('0x2e')](_0x25cbcc[_0xcd5c('0x32')],_0x25cbcc[_0xcd5c('0x2b')]);_0x3724e7[_0xcd5c('0x2f')]=_[_0xcd5c('0x2e')](_0x25cbcc[_0xcd5c('0x32')],qs[_0xcd5c('0x30')](_0x397bd1['query'][_0xcd5c('0x30')]));_0x3724e7[_0xcd5c('0x2f')]=_0x3724e7[_0xcd5c('0x2f')][_0xcd5c('0x31')]?_0x3724e7[_0xcd5c('0x2f')]:_0x25cbcc[_0xcd5c('0x32')];_0x3724e7[_0xcd5c('0x34')]=qs[_0xcd5c('0x35')](_0x397bd1[_0xcd5c('0x2b')][_0xcd5c('0x35')]);_0x3724e7[_0xcd5c('0x36')]=qs['filters'](_['pick'](_0x397bd1[_0xcd5c('0x2b')],_0x25cbcc[_0xcd5c('0x2d')]));if(_0x397bd1[_0xcd5c('0x2b')][_0xcd5c('0x38')]){_0x3724e7[_0xcd5c('0x36')]=_[_0xcd5c('0x39')](_0x3724e7[_0xcd5c('0x36')],{'$or':_[_0xcd5c('0x26')](_0x3724e7[_0xcd5c('0x2f')],function(_0x2ac75f){var _0x27c3cf={};_0x27c3cf[_0x2ac75f]={'$like':'%'+_0x397bd1[_0xcd5c('0x2b')][_0xcd5c('0x38')]+'%'};return _0x27c3cf;})});}_0x3724e7=_[_0xcd5c('0x39')]({},_0x3724e7,_0x397bd1['options']);return _0x1a725c[_0xcd5c('0x47')](_0x3724e7);}})['then'](function(_0x3cc05f){if(_0x3cc05f){_0x5ba51f=_0x3cc05f[_0xcd5c('0x31')];if(!_0x397bd1[_0xcd5c('0x2b')]['hasOwnProperty'](_0xcd5c('0x48'))){_0x3724e7[_0xcd5c('0x19')]=qs[_0xcd5c('0x19')](_0x397bd1[_0xcd5c('0x2b')]['limit']);_0x3724e7[_0xcd5c('0x1c')]=qs[_0xcd5c('0x1c')](_0x397bd1[_0xcd5c('0x2b')]['offset']);}return _0x1a725c[_0xcd5c('0x47')](_0x3724e7);}})[_0xcd5c('0x1f')](function(_0x4491ce){if(_0x4491ce){return _0x4491ce?{'count':_0x5ba51f,'rows':_0x4491ce}:null;}})[_0xcd5c('0x1f')](respondWithResult(_0x1e0cdf,null))[_0xcd5c('0x3f')](handleError(_0x1e0cdf,null));};exports[_0xcd5c('0x49')]=function(_0x5791c9,_0x494b6a,_0x4e43ba){var _0x503e0e={};var _0x3a9523={};var _0x53dfa2;var _0x3d65f8;return db[_0xcd5c('0x27')][_0xcd5c('0x4a')]({'where':{'id':_0x5791c9[_0xcd5c('0x41')]['id']}})[_0xcd5c('0x1f')](handleEntityNotFound(_0x494b6a,null))[_0xcd5c('0x1f')](function(_0x1a2893){if(_0x1a2893){_0x53dfa2=_0x1a2893;_0x3a9523[_0xcd5c('0x32')]=_[_0xcd5c('0x2c')](db[_0xcd5c('0x46')][_0xcd5c('0x42')]);_0x3a9523['query']=_[_0xcd5c('0x2c')](_0x5791c9[_0xcd5c('0x2b')]);_0x3a9523[_0xcd5c('0x2d')]=_['intersection'](_0x3a9523[_0xcd5c('0x32')],_0x3a9523[_0xcd5c('0x2b')]);_0x503e0e['attributes']=_[_0xcd5c('0x2e')](_0x3a9523[_0xcd5c('0x32')],qs[_0xcd5c('0x30')](_0x5791c9[_0xcd5c('0x2b')]['fields']));_0x503e0e[_0xcd5c('0x2f')]=_0x503e0e[_0xcd5c('0x2f')][_0xcd5c('0x31')]?_0x503e0e[_0xcd5c('0x2f')]:_0x3a9523[_0xcd5c('0x32')];_0x503e0e[_0xcd5c('0x34')]=qs[_0xcd5c('0x35')](_0x5791c9[_0xcd5c('0x2b')][_0xcd5c('0x35')]);_0x503e0e[_0xcd5c('0x36')]=qs[_0xcd5c('0x2d')](_[_0xcd5c('0x37')](_0x5791c9[_0xcd5c('0x2b')],_0x3a9523['filters']));if(_0x5791c9[_0xcd5c('0x2b')][_0xcd5c('0x38')]){_0x503e0e['where']=_[_0xcd5c('0x39')](_0x503e0e[_0xcd5c('0x36')],{'$or':_[_0xcd5c('0x26')](_0x503e0e[_0xcd5c('0x2f')],function(_0x4e5579){var _0x530f76={};_0x530f76[_0x4e5579]={'$like':'%'+_0x5791c9[_0xcd5c('0x2b')][_0xcd5c('0x38')]+'%'};return _0x530f76;})});}_0x503e0e=_['merge']({},_0x503e0e,_0x5791c9['options']);return _0x53dfa2[_0xcd5c('0x49')](_0x503e0e);}})[_0xcd5c('0x1f')](function(_0x4e4c88){if(_0x4e4c88){_0x3d65f8=_0x4e4c88['length'];if(!_0x5791c9[_0xcd5c('0x2b')]['hasOwnProperty']('nolimit')){_0x503e0e[_0xcd5c('0x19')]=qs['limit'](_0x5791c9[_0xcd5c('0x2b')][_0xcd5c('0x19')]);_0x503e0e[_0xcd5c('0x1c')]=qs['offset'](_0x5791c9[_0xcd5c('0x2b')][_0xcd5c('0x1c')]);}return _0x53dfa2['getSubjects'](_0x503e0e);}})[_0xcd5c('0x1f')](function(_0x2e0945){if(_0x2e0945){return _0x2e0945?{'count':_0x3d65f8,'rows':_0x2e0945}:null;}})['then'](respondWithResult(_0x494b6a,null))[_0xcd5c('0x3f')](handleError(_0x494b6a,null));};exports[_0xcd5c('0x4b')]=function(_0x3b0734,_0x172565,_0x25d0fc){var _0x3cefe3={};var _0x477870={};var _0x3f18ef;var _0x3a92e7;return db['VtigerConfiguration'][_0xcd5c('0x4a')]({'where':{'id':_0x3b0734['params']['id']}})[_0xcd5c('0x1f')](handleEntityNotFound(_0x172565,null))[_0xcd5c('0x1f')](function(_0xb129df){if(_0xb129df){_0x3f18ef=_0xb129df;_0x477870[_0xcd5c('0x32')]=_[_0xcd5c('0x2c')](db[_0xcd5c('0x46')][_0xcd5c('0x42')]);_0x477870[_0xcd5c('0x2b')]=_['keys'](_0x3b0734['query']);_0x477870[_0xcd5c('0x2d')]=_['intersection'](_0x477870[_0xcd5c('0x32')],_0x477870['query']);_0x3cefe3[_0xcd5c('0x2f')]=_['intersection'](_0x477870[_0xcd5c('0x32')],qs['fields'](_0x3b0734['query'][_0xcd5c('0x30')]));_0x3cefe3['attributes']=_0x3cefe3[_0xcd5c('0x2f')]['length']?_0x3cefe3['attributes']:_0x477870[_0xcd5c('0x32')];_0x3cefe3[_0xcd5c('0x34')]=qs[_0xcd5c('0x35')](_0x3b0734[_0xcd5c('0x2b')]['sort']);_0x3cefe3[_0xcd5c('0x36')]=qs['filters'](_[_0xcd5c('0x37')](_0x3b0734['query'],_0x477870[_0xcd5c('0x2d')]));if(_0x3b0734['query'][_0xcd5c('0x38')]){_0x3cefe3[_0xcd5c('0x36')]=_[_0xcd5c('0x39')](_0x3cefe3[_0xcd5c('0x36')],{'$or':_[_0xcd5c('0x26')](_0x3cefe3[_0xcd5c('0x2f')],function(_0x551fb2){var _0x5bd592={};_0x5bd592[_0x551fb2]={'$like':'%'+_0x3b0734['query'][_0xcd5c('0x38')]+'%'};return _0x5bd592;})});}_0x3cefe3=_[_0xcd5c('0x39')]({},_0x3cefe3,_0x3b0734[_0xcd5c('0x3b')]);return _0x3f18ef['getDescriptions'](_0x3cefe3);}})[_0xcd5c('0x1f')](function(_0x24e995){if(_0x24e995){_0x3a92e7=_0x24e995[_0xcd5c('0x31')];if(!_0x3b0734[_0xcd5c('0x2b')][_0xcd5c('0x33')]('nolimit')){_0x3cefe3[_0xcd5c('0x19')]=qs[_0xcd5c('0x19')](_0x3b0734[_0xcd5c('0x2b')]['limit']);_0x3cefe3[_0xcd5c('0x1c')]=qs[_0xcd5c('0x1c')](_0x3b0734['query'][_0xcd5c('0x1c')]);}return _0x3f18ef['getDescriptions'](_0x3cefe3);}})['then'](function(_0x2243cf){if(_0x2243cf){return _0x2243cf?{'count':_0x3a92e7,'rows':_0x2243cf}:null;}})[_0xcd5c('0x1f')](respondWithResult(_0x172565,null))[_0xcd5c('0x3f')](handleError(_0x172565,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index bf76942..264ebd7 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 _0xe43d=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x22834a,_0x5c4e3e){var _0x4bab30=function(_0x3f1af6){while(--_0x3f1af6){_0x22834a['push'](_0x22834a['shift']());}};_0x4bab30(++_0x5c4e3e);}(_0xe43d,0x1d1));var _0xde43=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0xe43d[_0x58da8a];return _0x5294b9;};'use strict';var _=require(_0xde43('0x0'));var util=require('util');var logger=require(_0xde43('0x1'))(_0xde43('0x2'));var moment=require('moment');var BPromise=require(_0xde43('0x3'));var rp=require(_0xde43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde43('0x5'));var config=require(_0xde43('0x6'));var attributes=require(_0xde43('0x7'));module['exports']=function(_0x8ee85c,_0x3105a9){return _0x8ee85c[_0xde43('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xde43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0499=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4cbf07,_0x27746b){var _0x34b1ff=function(_0x2fd447){while(--_0x2fd447){_0x4cbf07['push'](_0x4cbf07['shift']());}};_0x34b1ff(++_0x27746b);}(_0x0499,0x1bf));var _0x9049=function(_0x13353d,_0x13c1a2){_0x13353d=_0x13353d-0x0;var _0x5715c7=_0x0499[_0x13353d];return _0x5715c7;};'use strict';var _=require(_0x9049('0x0'));var util=require(_0x9049('0x1'));var logger=require(_0x9049('0x2'))(_0x9049('0x3'));var moment=require('moment');var BPromise=require(_0x9049('0x4'));var rp=require(_0x9049('0x5'));var fs=require('fs');var path=require(_0x9049('0x6'));var rimraf=require(_0x9049('0x7'));var config=require(_0x9049('0x8'));var attributes=require(_0x9049('0x9'));module[_0x9049('0xa')]=function(_0x3d36d7,_0xedc92c){return _0x3d36d7[_0x9049('0xb')](_0x9049('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 4266299..d94bb3f 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 _0x8876=['http','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x38096e,_0x10cd71){var _0x1db07f=function(_0xc6fc75){while(--_0xc6fc75){_0x38096e['push'](_0x38096e['shift']());}};_0x1db07f(++_0x10cd71);}(_0x8876,0xfd));var _0x6887=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0x8876[_0x556634];return _0x4429fd;};'use strict';var _=require(_0x6887('0x0'));var util=require(_0x6887('0x1'));var moment=require(_0x6887('0x2'));var BPromise=require(_0x6887('0x3'));var rs=require(_0x6887('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6887('0x5'))['db'];var utils=require(_0x6887('0x6'));var logger=require(_0x6887('0x7'))(_0x6887('0x8'));var config=require(_0x6887('0x9'));var jayson=require(_0x6887('0xa'));var client=jayson['client'][_0x6887('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x102a8a,_0x3eb71e,_0x24beda){return new BPromise(function(_0x58c855,_0x37d6a9){return client['request'](_0x102a8a,_0x24beda)[_0x6887('0xc')](function(_0x262c4c){logger[_0x6887('0xd')](_0x6887('0xe'),_0x3eb71e,'request\x20sent');logger[_0x6887('0xf')](_0x6887('0x10'),_0x3eb71e,'request\x20sent',JSON[_0x6887('0x11')](_0x262c4c));if(_0x262c4c[_0x6887('0x12')]){if(_0x262c4c[_0x6887('0x12')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3eb71e,_0x262c4c[_0x6887('0x12')]['message']);return _0x37d6a9(_0x262c4c['error']['message']);}logger['error'](_0x6887('0xe'),_0x3eb71e,_0x262c4c[_0x6887('0x12')][_0x6887('0x13')]);return _0x58c855(_0x262c4c['error'][_0x6887('0x13')]);}else{logger[_0x6887('0xd')](_0x6887('0xe'),_0x3eb71e,_0x6887('0x14'));_0x58c855(_0x262c4c[_0x6887('0x15')]['message']);}})['catch'](function(_0x350780){logger[_0x6887('0x12')](_0x6887('0xe'),_0x3eb71e,_0x350780);_0x37d6a9(_0x350780);});});} \ No newline at end of file +var _0xd634=['jayson/promise','http','request','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2f5eef,_0x2b40d3){var _0x5ad9fa=function(_0x2e8dd9){while(--_0x2e8dd9){_0x2f5eef['push'](_0x2f5eef['shift']());}};_0x5ad9fa(++_0x2b40d3);}(_0xd634,0x12c));var _0x4d63=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xd634[_0x102977];return _0x15c466;};'use strict';var _=require(_0x4d63('0x0'));var util=require('util');var moment=require(_0x4d63('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d63('0x2'));var fs=require('fs');var Redis=require(_0x4d63('0x3'));var db=require(_0x4d63('0x4'))['db'];var utils=require(_0x4d63('0x5'));var logger=require(_0x4d63('0x6'))(_0x4d63('0x7'));var config=require('../../config/environment');var jayson=require(_0x4d63('0x8'));var client=jayson['client'][_0x4d63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d8f14,_0x5d398b,_0x183222){return new BPromise(function(_0x54530e,_0x5f38e7){return client[_0x4d63('0xa')](_0x6d8f14,_0x183222)['then'](function(_0x4a4cc9){logger[_0x4d63('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x5d398b,'request\x20sent');logger[_0x4d63('0xc')](_0x4d63('0xd'),_0x5d398b,_0x4d63('0xe'),JSON[_0x4d63('0xf')](_0x4a4cc9));if(_0x4a4cc9[_0x4d63('0x10')]){if(_0x4a4cc9[_0x4d63('0x10')][_0x4d63('0x11')]===0x1f4){logger[_0x4d63('0x10')](_0x4d63('0x12'),_0x5d398b,_0x4a4cc9[_0x4d63('0x10')][_0x4d63('0x13')]);return _0x5f38e7(_0x4a4cc9[_0x4d63('0x10')][_0x4d63('0x13')]);}logger[_0x4d63('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x5d398b,_0x4a4cc9[_0x4d63('0x10')][_0x4d63('0x13')]);return _0x54530e(_0x4a4cc9['error'][_0x4d63('0x13')]);}else{logger[_0x4d63('0xb')](_0x4d63('0x12'),_0x5d398b,'request\x20sent');_0x54530e(_0x4a4cc9[_0x4d63('0x14')][_0x4d63('0x13')]);}})[_0x4d63('0x15')](function(_0x1469cc){logger['error'](_0x4d63('0x12'),_0x5d398b,_0x1469cc);_0x5f38e7(_0x1469cc);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ed885b6..cbc2ead 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 _0x830d=['connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x830d,0x9f));var _0xd830=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x830d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd830('0x0'));var util=require(_0xd830('0x1'));var path=require(_0xd830('0x2'));var timeout=require(_0xd830('0x3'));var express=require('express');var router=express[_0xd830('0x4')]();var fs_extra=require(_0xd830('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd830('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd830('0x7')]('/:id',auth[_0xd830('0x8')](),controller[_0xd830('0x9')]);router[_0xd830('0xa')]('/',auth['isAuthenticated'](),controller[_0xd830('0xb')]);router[_0xd830('0xc')](_0xd830('0xd'),auth[_0xd830('0x8')](),controller[_0xd830('0xe')]);router[_0xd830('0xf')](_0xd830('0xd'),auth[_0xd830('0x8')](),controller[_0xd830('0x10')]);module[_0xd830('0x11')]=router; \ No newline at end of file +var _0xcdd0=['Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','create','put','destroy','exports','util','connect-timeout','express'];(function(_0x246e3c,_0x170726){var _0x335ec9=function(_0x52fe4c){while(--_0x52fe4c){_0x246e3c['push'](_0x246e3c['shift']());}};_0x335ec9(++_0x170726);}(_0xcdd0,0xed));var _0x0cdd=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xcdd0[_0x10004e];return _0x5af990;};'use strict';var multer=require('multer');var util=require(_0x0cdd('0x0'));var path=require('path');var timeout=require(_0x0cdd('0x1'));var express=require(_0x0cdd('0x2'));var router=express[_0x0cdd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0cdd('0x4'));var config=require(_0x0cdd('0x5'));var controller=require(_0x0cdd('0x6'));router[_0x0cdd('0x7')]('/',auth['isAuthenticated'](),controller[_0x0cdd('0x8')]);router[_0x0cdd('0x7')](_0x0cdd('0x9'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xb')]);router['post']('/',auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xc')]);router[_0x0cdd('0xd')]('/:id',auth[_0x0cdd('0xa')](),controller['update']);router['delete'](_0x0cdd('0x9'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xe')]);module[_0x0cdd('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 6920f37..0f9c8e3 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 _0x15ab=['string','variable','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports'];(function(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0x15ab,0x10c));var _0xb15a=function(_0x2ebeb0,_0x40a939){_0x2ebeb0=_0x2ebeb0-0x0;var _0x1e4281=_0x15ab[_0x2ebeb0];return _0x1e4281;};'use strict';var Sequelize=require(_0xb15a('0x0'));module[_0xb15a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb15a('0x2'),_0xb15a('0x3'),'customVariable','keyValue',_0xb15a('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb15a('0x5')]},'keyType':{'type':Sequelize[_0xb15a('0x6')](_0xb15a('0x2'),_0xb15a('0x3'),_0xb15a('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb15a('0x5')]},'nameField':{'type':Sequelize[_0xb15a('0x5')]},'customField':{'type':Sequelize[_0xb15a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1fe4=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x1b7bae,_0x4c6eac){var _0x3e1e35=function(_0x45bc4a){while(--_0x45bc4a){_0x1b7bae['push'](_0x1b7bae['shift']());}};_0x3e1e35(++_0x4c6eac);}(_0x1fe4,0x7e));var _0x41fe=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0x1fe4[_0x3ee55a];return _0x581800;};'use strict';var Sequelize=require(_0x41fe('0x0'));module[_0x41fe('0x1')]={'type':{'type':Sequelize[_0x41fe('0x2')]('string',_0x41fe('0x3'),_0x41fe('0x4'),_0x41fe('0x5'),_0x41fe('0x6')),'defaultValue':_0x41fe('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x41fe('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x41fe('0x7'),_0x41fe('0x3'),_0x41fe('0x4'))},'keyContent':{'type':Sequelize[_0x41fe('0x8')]},'idField':{'type':Sequelize[_0x41fe('0x8')]},'nameField':{'type':Sequelize[_0x41fe('0x8')]},'customField':{'type':Sequelize[_0x41fe('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41fe('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cc265fe..effca86 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 _0xda65=['update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','VtigerField','findAll','rows','catch','show','params','includeAll','include','options','body'];(function(_0x40373f,_0x2308a2){var _0x4bff83=function(_0x28cd36){while(--_0x28cd36){_0x40373f['push'](_0x40373f['shift']());}};_0x4bff83(++_0x2308a2);}(_0xda65,0x8d));var _0x5da6=function(_0x41abc7,_0x109de7){_0x41abc7=_0x41abc7-0x0;var _0x2190aa=_0xda65[_0x41abc7];return _0x2190aa;};'use strict';var emlformat=require(_0x5da6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5da6('0x1'));var jsonpatch=require(_0x5da6('0x2'));var rp=require('request-promise');var moment=require(_0x5da6('0x3'));var BPromise=require(_0x5da6('0x4'));var Mustache=require(_0x5da6('0x5'));var util=require(_0x5da6('0x6'));var path=require(_0x5da6('0x7'));var sox=require('sox');var csv=require(_0x5da6('0x8'));var ejs=require(_0x5da6('0x9'));var fs=require('fs');var fs_extra=require(_0x5da6('0xa'));var _=require(_0x5da6('0xb'));var squel=require('squel');var crypto=require(_0x5da6('0xc'));var jsforce=require(_0x5da6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5da6('0x8'));var querystring=require(_0x5da6('0xe'));var Papa=require('papaparse');var Redis=require(_0x5da6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5da6('0x10'));var hardwareService=require(_0x5da6('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5da6('0x12'));var config=require(_0x5da6('0x13'));var licenseUtil=require(_0x5da6('0x14'));var db=require(_0x5da6('0x15'))['db'];function respondWithStatusCode(_0x55f4d3,_0x98f34e){_0x98f34e=_0x98f34e||0xcc;return function(_0x112e70){if(_0x112e70){return _0x55f4d3[_0x5da6('0x16')](_0x98f34e);}return _0x55f4d3[_0x5da6('0x17')](_0x98f34e)[_0x5da6('0x18')]();};}function respondWithResult(_0x24d23f,_0x31e161){_0x31e161=_0x31e161||0xc8;return function(_0x3c8f5e){if(_0x3c8f5e){return _0x24d23f[_0x5da6('0x17')](_0x31e161)['json'](_0x3c8f5e);}};}function respondWithFilteredResult(_0xdf5a2c,_0x1c5d24){return function(_0x9ac937){if(_0x9ac937){var _0x546e38=typeof _0x1c5d24[_0x5da6('0x19')]==='undefined'&&typeof _0x1c5d24[_0x5da6('0x1a')]===_0x5da6('0x1b');var _0x8be4d8=_0x9ac937[_0x5da6('0x1c')];var _0x192dc8=_0x546e38?0x0:_0x1c5d24[_0x5da6('0x19')];var _0x4e17cb=_0x546e38?_0x9ac937[_0x5da6('0x1c')]:_0x1c5d24[_0x5da6('0x19')]+_0x1c5d24['limit'];var _0x1a6131;if(_0x4e17cb>=_0x8be4d8){_0x4e17cb=_0x8be4d8;_0x1a6131=0xc8;}else{_0x1a6131=0xce;}_0xdf5a2c[_0x5da6('0x17')](_0x1a6131);return _0xdf5a2c[_0x5da6('0x1d')](_0x5da6('0x1e'),_0x192dc8+'-'+_0x4e17cb+'/'+_0x8be4d8)['json'](_0x9ac937);}return null;};}function patchUpdates(_0x219646){return function(_0xad2065){try{jsonpatch[_0x5da6('0x1f')](_0xad2065,_0x219646,!![]);}catch(_0x409e21){return BPromise[_0x5da6('0x20')](_0x409e21);}return _0xad2065[_0x5da6('0x21')]();};}function saveUpdates(_0x448993,_0x4e5b3f){return function(_0x52ebcd){if(_0x52ebcd){return _0x52ebcd['update'](_0x448993)[_0x5da6('0x22')](function(_0x30942c){return _0x30942c;});}return null;};}function removeEntity(_0x37d80d,_0x1c1833){return function(_0x339c23){if(_0x339c23){return _0x339c23[_0x5da6('0x23')]()['then'](function(){_0x37d80d[_0x5da6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6733e8,_0x3cba9e){return function(_0x43c6da){if(!_0x43c6da){_0x6733e8['sendStatus'](0x194);}return _0x43c6da;};}function handleError(_0xf9829,_0x169985){_0x169985=_0x169985||0x1f4;return function(_0x112431){logger[_0x5da6('0x24')](_0x112431['stack']);if(_0x112431[_0x5da6('0x25')]){delete _0x112431[_0x5da6('0x25')];}_0xf9829[_0x5da6('0x17')](_0x169985)[_0x5da6('0x26')](_0x112431);};}exports['index']=function(_0x92ffaf,_0x586075){var _0x213e6a={},_0x4c7f79={},_0x42214c={'count':0x0,'rows':[]};var _0x3c1cfc=_[_0x5da6('0x27')](db['VtigerField'][_0x5da6('0x28')],function(_0x140757){return{'name':_0x140757[_0x5da6('0x29')],'type':_0x140757[_0x5da6('0x2a')]['key']};});_0x4c7f79[_0x5da6('0x2b')]=_['map'](_0x3c1cfc,'name');_0x4c7f79[_0x5da6('0x2c')]=_[_0x5da6('0x2d')](_0x92ffaf['query']);_0x4c7f79[_0x5da6('0x2e')]=_[_0x5da6('0x2f')](_0x4c7f79[_0x5da6('0x2b')],_0x4c7f79[_0x5da6('0x2c')]);_0x213e6a[_0x5da6('0x30')]=_[_0x5da6('0x2f')](_0x4c7f79[_0x5da6('0x2b')],qs[_0x5da6('0x31')](_0x92ffaf['query']['fields']));_0x213e6a['attributes']=_0x213e6a[_0x5da6('0x30')][_0x5da6('0x32')]?_0x213e6a[_0x5da6('0x30')]:_0x4c7f79['model'];if(!_0x92ffaf[_0x5da6('0x2c')][_0x5da6('0x33')]('nolimit')){_0x213e6a[_0x5da6('0x1a')]=qs[_0x5da6('0x1a')](_0x92ffaf[_0x5da6('0x2c')][_0x5da6('0x1a')]);_0x213e6a[_0x5da6('0x19')]=qs[_0x5da6('0x19')](_0x92ffaf[_0x5da6('0x2c')]['offset']);}_0x213e6a[_0x5da6('0x34')]=qs[_0x5da6('0x35')](_0x92ffaf['query'][_0x5da6('0x35')]);_0x213e6a['where']=qs[_0x5da6('0x2e')](_[_0x5da6('0x36')](_0x92ffaf[_0x5da6('0x2c')],_0x4c7f79[_0x5da6('0x2e')]),_0x3c1cfc);if(_0x92ffaf[_0x5da6('0x2c')]['filter']){_0x213e6a[_0x5da6('0x37')]=_[_0x5da6('0x38')](_0x213e6a[_0x5da6('0x37')],{'$or':_[_0x5da6('0x27')](_0x3c1cfc,function(_0xeb29fc){if(_0xeb29fc[_0x5da6('0x2a')]!==_0x5da6('0x39')){var _0x7f625f={};_0x7f625f[_0xeb29fc[_0x5da6('0x25')]]={'$like':'%'+_0x92ffaf[_0x5da6('0x2c')][_0x5da6('0x3a')]+'%'};return _0x7f625f;}})});}_0x213e6a=_[_0x5da6('0x38')]({},_0x213e6a,_0x92ffaf['options']);var _0x198bd1={'where':_0x213e6a['where']};return db[_0x5da6('0x3b')][_0x5da6('0x1c')](_0x198bd1)[_0x5da6('0x22')](function(_0x457e04){_0x42214c[_0x5da6('0x1c')]=_0x457e04;if(_0x92ffaf['query']['includeAll']){_0x213e6a['include']=[{'all':!![]}];}return db[_0x5da6('0x3b')][_0x5da6('0x3c')](_0x213e6a);})['then'](function(_0x8f8308){_0x42214c[_0x5da6('0x3d')]=_0x8f8308;return _0x42214c;})[_0x5da6('0x22')](respondWithFilteredResult(_0x586075,_0x213e6a))[_0x5da6('0x3e')](handleError(_0x586075,null));};exports[_0x5da6('0x3f')]=function(_0x36439f,_0x496e0a){var _0x3a398b={'raw':!![],'where':{'id':_0x36439f[_0x5da6('0x40')]['id']}},_0x428c65={};_0x428c65[_0x5da6('0x2b')]=_['keys'](db[_0x5da6('0x3b')][_0x5da6('0x28')]);_0x428c65[_0x5da6('0x2c')]=_[_0x5da6('0x2d')](_0x36439f['query']);_0x428c65[_0x5da6('0x2e')]=_['intersection'](_0x428c65[_0x5da6('0x2b')],_0x428c65[_0x5da6('0x2c')]);_0x3a398b['attributes']=_[_0x5da6('0x2f')](_0x428c65[_0x5da6('0x2b')],qs[_0x5da6('0x31')](_0x36439f[_0x5da6('0x2c')][_0x5da6('0x31')]));_0x3a398b[_0x5da6('0x30')]=_0x3a398b['attributes'][_0x5da6('0x32')]?_0x3a398b[_0x5da6('0x30')]:_0x428c65[_0x5da6('0x2b')];if(_0x36439f[_0x5da6('0x2c')][_0x5da6('0x41')]){_0x3a398b[_0x5da6('0x42')]=[{'all':!![]}];}_0x3a398b=_[_0x5da6('0x38')]({},_0x3a398b,_0x36439f[_0x5da6('0x43')]);return db['VtigerField']['find'](_0x3a398b)['then'](handleEntityNotFound(_0x496e0a,null))[_0x5da6('0x22')](respondWithResult(_0x496e0a,null))[_0x5da6('0x3e')](handleError(_0x496e0a,null));};exports['create']=function(_0x58674e,_0x3d8678){return db[_0x5da6('0x3b')]['create'](_0x58674e[_0x5da6('0x44')],{})[_0x5da6('0x22')](respondWithResult(_0x3d8678,0xc9))[_0x5da6('0x3e')](handleError(_0x3d8678,null));};exports[_0x5da6('0x45')]=function(_0x2bb6a1,_0x56789d){if(_0x2bb6a1[_0x5da6('0x44')]['id']){delete _0x2bb6a1[_0x5da6('0x44')]['id'];}return db[_0x5da6('0x3b')]['find']({'where':{'id':_0x2bb6a1['params']['id']}})['then'](handleEntityNotFound(_0x56789d,null))[_0x5da6('0x22')](saveUpdates(_0x2bb6a1[_0x5da6('0x44')],null))[_0x5da6('0x22')](respondWithResult(_0x56789d,null))[_0x5da6('0x3e')](handleError(_0x56789d,null));};exports[_0x5da6('0x23')]=function(_0x355dac,_0x47c932){return db[_0x5da6('0x3b')]['find']({'where':{'id':_0x355dac[_0x5da6('0x40')]['id']}})['then'](handleEntityNotFound(_0x47c932,null))[_0x5da6('0x22')](removeEntity(_0x47c932,null))['catch'](handleError(_0x47c932,null));}; \ No newline at end of file +var _0x5bf9=['fields','length','order','sort','filter','where','merge','VIRTUAL','options','VtigerField','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x1ae971,_0x426f10){var _0x45a129=function(_0x4da9c5){while(--_0x4da9c5){_0x1ae971['push'](_0x1ae971['shift']());}};_0x45a129(++_0x426f10);}(_0x5bf9,0x1e0));var _0x95bf=function(_0xc94eb3,_0x45bb5c){_0xc94eb3=_0xc94eb3-0x0;var _0x481cf6=_0x5bf9[_0xc94eb3];return _0x481cf6;};'use strict';var emlformat=require(_0x95bf('0x0'));var rimraf=require(_0x95bf('0x1'));var zipdir=require(_0x95bf('0x2'));var jsonpatch=require(_0x95bf('0x3'));var rp=require(_0x95bf('0x4'));var moment=require('moment');var BPromise=require(_0x95bf('0x5'));var Mustache=require(_0x95bf('0x6'));var util=require(_0x95bf('0x7'));var path=require(_0x95bf('0x8'));var sox=require('sox');var csv=require(_0x95bf('0x9'));var ejs=require(_0x95bf('0xa'));var fs=require('fs');var fs_extra=require(_0x95bf('0xb'));var _=require(_0x95bf('0xc'));var squel=require(_0x95bf('0xd'));var crypto=require(_0x95bf('0xe'));var jsforce=require(_0x95bf('0xf'));var deskjs=require(_0x95bf('0x10'));var toCsv=require(_0x95bf('0x9'));var querystring=require(_0x95bf('0x11'));var Papa=require(_0x95bf('0x12'));var Redis=require(_0x95bf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x95bf('0x14'));var as=require(_0x95bf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95bf('0x16'))(_0x95bf('0x17'));var utils=require(_0x95bf('0x18'));var config=require(_0x95bf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x95bf('0x1a'))['db'];function respondWithStatusCode(_0x3be2af,_0x39bad6){_0x39bad6=_0x39bad6||0xcc;return function(_0x3a1af7){if(_0x3a1af7){return _0x3be2af[_0x95bf('0x1b')](_0x39bad6);}return _0x3be2af['status'](_0x39bad6)[_0x95bf('0x1c')]();};}function respondWithResult(_0xbd853f,_0xeaba68){_0xeaba68=_0xeaba68||0xc8;return function(_0x585962){if(_0x585962){return _0xbd853f[_0x95bf('0x1d')](_0xeaba68)[_0x95bf('0x1e')](_0x585962);}};}function respondWithFilteredResult(_0x58db8e,_0x5526e7){return function(_0x4b99e2){if(_0x4b99e2){var _0x5325ae=typeof _0x5526e7['offset']===_0x95bf('0x1f')&&typeof _0x5526e7[_0x95bf('0x20')]===_0x95bf('0x1f');var _0x11fa36=_0x4b99e2[_0x95bf('0x21')];var _0x3ed86f=_0x5325ae?0x0:_0x5526e7['offset'];var _0x4da1dd=_0x5325ae?_0x4b99e2[_0x95bf('0x21')]:_0x5526e7[_0x95bf('0x22')]+_0x5526e7[_0x95bf('0x20')];var _0x48ce8f;if(_0x4da1dd>=_0x11fa36){_0x4da1dd=_0x11fa36;_0x48ce8f=0xc8;}else{_0x48ce8f=0xce;}_0x58db8e[_0x95bf('0x1d')](_0x48ce8f);return _0x58db8e[_0x95bf('0x23')](_0x95bf('0x24'),_0x3ed86f+'-'+_0x4da1dd+'/'+_0x11fa36)[_0x95bf('0x1e')](_0x4b99e2);}return null;};}function patchUpdates(_0x38ea9b){return function(_0x15b58c){try{jsonpatch[_0x95bf('0x25')](_0x15b58c,_0x38ea9b,!![]);}catch(_0xbbc9cb){return BPromise[_0x95bf('0x26')](_0xbbc9cb);}return _0x15b58c[_0x95bf('0x27')]();};}function saveUpdates(_0x24b414,_0x3d4f26){return function(_0x199373){if(_0x199373){return _0x199373[_0x95bf('0x28')](_0x24b414)[_0x95bf('0x29')](function(_0x4f773d){return _0x4f773d;});}return null;};}function removeEntity(_0x3bed97,_0x3bf714){return function(_0x5de97a){if(_0x5de97a){return _0x5de97a[_0x95bf('0x2a')]()['then'](function(){_0x3bed97[_0x95bf('0x1d')](0xcc)[_0x95bf('0x1c')]();});}};}function handleEntityNotFound(_0x10a763,_0x5dafe1){return function(_0x58841b){if(!_0x58841b){_0x10a763[_0x95bf('0x1b')](0x194);}return _0x58841b;};}function handleError(_0x70c0a3,_0x25cbfe){_0x25cbfe=_0x25cbfe||0x1f4;return function(_0x19b8fb){logger[_0x95bf('0x2b')](_0x19b8fb[_0x95bf('0x2c')]);if(_0x19b8fb['name']){delete _0x19b8fb[_0x95bf('0x2d')];}_0x70c0a3[_0x95bf('0x1d')](_0x25cbfe)[_0x95bf('0x2e')](_0x19b8fb);};}exports[_0x95bf('0x2f')]=function(_0x130f1e,_0x16ba63){var _0x3f9430={},_0x279ea4={},_0x4e5ee8={'count':0x0,'rows':[]};var _0x361893=_[_0x95bf('0x30')](db['VtigerField'][_0x95bf('0x31')],function(_0x4348cd){return{'name':_0x4348cd[_0x95bf('0x32')],'type':_0x4348cd[_0x95bf('0x33')][_0x95bf('0x34')]};});_0x279ea4[_0x95bf('0x35')]=_[_0x95bf('0x30')](_0x361893,_0x95bf('0x2d'));_0x279ea4[_0x95bf('0x36')]=_[_0x95bf('0x37')](_0x130f1e[_0x95bf('0x36')]);_0x279ea4[_0x95bf('0x38')]=_[_0x95bf('0x39')](_0x279ea4[_0x95bf('0x35')],_0x279ea4['query']);_0x3f9430[_0x95bf('0x3a')]=_[_0x95bf('0x39')](_0x279ea4[_0x95bf('0x35')],qs['fields'](_0x130f1e['query'][_0x95bf('0x3b')]));_0x3f9430[_0x95bf('0x3a')]=_0x3f9430['attributes'][_0x95bf('0x3c')]?_0x3f9430[_0x95bf('0x3a')]:_0x279ea4['model'];if(!_0x130f1e[_0x95bf('0x36')]['hasOwnProperty']('nolimit')){_0x3f9430['limit']=qs[_0x95bf('0x20')](_0x130f1e[_0x95bf('0x36')][_0x95bf('0x20')]);_0x3f9430['offset']=qs[_0x95bf('0x22')](_0x130f1e['query']['offset']);}_0x3f9430[_0x95bf('0x3d')]=qs[_0x95bf('0x3e')](_0x130f1e['query'][_0x95bf('0x3e')]);_0x3f9430['where']=qs[_0x95bf('0x38')](_['pick'](_0x130f1e[_0x95bf('0x36')],_0x279ea4[_0x95bf('0x38')]),_0x361893);if(_0x130f1e[_0x95bf('0x36')][_0x95bf('0x3f')]){_0x3f9430[_0x95bf('0x40')]=_[_0x95bf('0x41')](_0x3f9430[_0x95bf('0x40')],{'$or':_[_0x95bf('0x30')](_0x361893,function(_0x4f002b){if(_0x4f002b[_0x95bf('0x33')]!==_0x95bf('0x42')){var _0xef9c3d={};_0xef9c3d[_0x4f002b[_0x95bf('0x2d')]]={'$like':'%'+_0x130f1e[_0x95bf('0x36')][_0x95bf('0x3f')]+'%'};return _0xef9c3d;}})});}_0x3f9430=_[_0x95bf('0x41')]({},_0x3f9430,_0x130f1e[_0x95bf('0x43')]);var _0x340467={'where':_0x3f9430['where']};return db[_0x95bf('0x44')]['count'](_0x340467)[_0x95bf('0x29')](function(_0x41953b){_0x4e5ee8[_0x95bf('0x21')]=_0x41953b;if(_0x130f1e['query'][_0x95bf('0x45')]){_0x3f9430[_0x95bf('0x46')]=[{'all':!![]}];}return db[_0x95bf('0x44')]['findAll'](_0x3f9430);})[_0x95bf('0x29')](function(_0x56c2ad){_0x4e5ee8[_0x95bf('0x47')]=_0x56c2ad;return _0x4e5ee8;})[_0x95bf('0x29')](respondWithFilteredResult(_0x16ba63,_0x3f9430))[_0x95bf('0x48')](handleError(_0x16ba63,null));};exports['show']=function(_0x448209,_0x565b76){var _0x3dbd57={'raw':!![],'where':{'id':_0x448209[_0x95bf('0x49')]['id']}},_0x18e4ac={};_0x18e4ac[_0x95bf('0x35')]=_['keys'](db[_0x95bf('0x44')][_0x95bf('0x31')]);_0x18e4ac['query']=_[_0x95bf('0x37')](_0x448209['query']);_0x18e4ac['filters']=_[_0x95bf('0x39')](_0x18e4ac[_0x95bf('0x35')],_0x18e4ac['query']);_0x3dbd57[_0x95bf('0x3a')]=_[_0x95bf('0x39')](_0x18e4ac['model'],qs[_0x95bf('0x3b')](_0x448209[_0x95bf('0x36')][_0x95bf('0x3b')]));_0x3dbd57[_0x95bf('0x3a')]=_0x3dbd57[_0x95bf('0x3a')][_0x95bf('0x3c')]?_0x3dbd57[_0x95bf('0x3a')]:_0x18e4ac['model'];if(_0x448209[_0x95bf('0x36')]['includeAll']){_0x3dbd57[_0x95bf('0x46')]=[{'all':!![]}];}_0x3dbd57=_[_0x95bf('0x41')]({},_0x3dbd57,_0x448209[_0x95bf('0x43')]);return db[_0x95bf('0x44')][_0x95bf('0x4a')](_0x3dbd57)[_0x95bf('0x29')](handleEntityNotFound(_0x565b76,null))['then'](respondWithResult(_0x565b76,null))[_0x95bf('0x48')](handleError(_0x565b76,null));};exports['create']=function(_0x2b500e,_0x5edf72){return db[_0x95bf('0x44')][_0x95bf('0x4b')](_0x2b500e[_0x95bf('0x4c')],{})['then'](respondWithResult(_0x5edf72,0xc9))[_0x95bf('0x48')](handleError(_0x5edf72,null));};exports[_0x95bf('0x28')]=function(_0x44cf82,_0x59295c){if(_0x44cf82[_0x95bf('0x4c')]['id']){delete _0x44cf82[_0x95bf('0x4c')]['id'];}return db['VtigerField'][_0x95bf('0x4a')]({'where':{'id':_0x44cf82['params']['id']}})[_0x95bf('0x29')](handleEntityNotFound(_0x59295c,null))['then'](saveUpdates(_0x44cf82[_0x95bf('0x4c')],null))[_0x95bf('0x29')](respondWithResult(_0x59295c,null))[_0x95bf('0x48')](handleError(_0x59295c,null));};exports[_0x95bf('0x2a')]=function(_0x233c0d,_0x49008b){return db['VtigerField'][_0x95bf('0x4a')]({'where':{'id':_0x233c0d[_0x95bf('0x49')]['id']}})['then'](handleEntityNotFound(_0x49008b,null))['then'](removeEntity(_0x49008b,null))[_0x95bf('0x48')](handleError(_0x49008b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index bc154dc..97bda25 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 _0xffae=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x48994a,_0x20d57e){var _0x1f8c0b=function(_0x120969){while(--_0x120969){_0x48994a['push'](_0x48994a['shift']());}};_0x1f8c0b(++_0x20d57e);}(_0xffae,0xf2));var _0xeffa=function(_0x36e4cd,_0x4495de){_0x36e4cd=_0x36e4cd-0x0;var _0xbebc52=_0xffae[_0x36e4cd];return _0xbebc52;};'use strict';var _=require(_0xeffa('0x0'));var util=require(_0xeffa('0x1'));var logger=require(_0xeffa('0x2'))(_0xeffa('0x3'));var moment=require(_0xeffa('0x4'));var BPromise=require('bluebird');var rp=require(_0xeffa('0x5'));var fs=require('fs');var path=require(_0xeffa('0x6'));var rimraf=require(_0xeffa('0x7'));var config=require(_0xeffa('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xeffa('0x9')]=function(_0x59c1bd,_0x2b1e59){return _0x59c1bd[_0xeffa('0xa')](_0xeffa('0xb'),attributes,{'tableName':_0xeffa('0xc'),'paranoid':![],'indexes':[{'name':_0xeffa('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca13=['rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','FieldId','lodash','util','api','moment','path'];(function(_0x4be770,_0x123584){var _0x59efa1=function(_0x459198){while(--_0x459198){_0x4be770['push'](_0x4be770['shift']());}};_0x59efa1(++_0x123584);}(_0xca13,0x1cf));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3ca1('0x0'));var util=require(_0x3ca1('0x1'));var logger=require('../../config/logger')(_0x3ca1('0x2'));var moment=require(_0x3ca1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ca1('0x4'));var rimraf=require(_0x3ca1('0x5'));var config=require(_0x3ca1('0x6'));var attributes=require(_0x3ca1('0x7'));module[_0x3ca1('0x8')]=function(_0xd8948d,_0x28ad61){return _0xd8948d['define'](_0x3ca1('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x3ca1('0xa'),'fields':['idField',_0x3ca1('0xb')],'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 04010b3..f8c5fe0 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 _0x08ee=['info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x08ee,0x168));var _0xe08e=function(_0x46b65b,_0x51c8c9){_0x46b65b=_0x46b65b-0x0;var _0x813292=_0x08ee[_0x46b65b];return _0x813292;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe08e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe08e('0x1'));var fs=require('fs');var Redis=require(_0xe08e('0x2'));var db=require(_0xe08e('0x3'))['db'];var utils=require(_0xe08e('0x4'));var logger=require(_0xe08e('0x5'))(_0xe08e('0x6'));var config=require(_0xe08e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe08e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e9c59,_0x577883,_0xd4a703){return new BPromise(function(_0x257585,_0x173c30){return client[_0xe08e('0x9')](_0x2e9c59,_0xd4a703)[_0xe08e('0xa')](function(_0x9c60a7){logger['info'](_0xe08e('0xb'),_0x577883,_0xe08e('0xc'));logger['debug'](_0xe08e('0xd'),_0x577883,_0xe08e('0xc'),JSON[_0xe08e('0xe')](_0x9c60a7));if(_0x9c60a7[_0xe08e('0xf')]){if(_0x9c60a7['error'][_0xe08e('0x10')]===0x1f4){logger[_0xe08e('0xf')](_0xe08e('0xb'),_0x577883,_0x9c60a7['error'][_0xe08e('0x11')]);return _0x173c30(_0x9c60a7[_0xe08e('0xf')][_0xe08e('0x11')]);}logger[_0xe08e('0xf')](_0xe08e('0xb'),_0x577883,_0x9c60a7[_0xe08e('0xf')]['message']);return _0x257585(_0x9c60a7['error'][_0xe08e('0x11')]);}else{logger[_0xe08e('0x12')](_0xe08e('0xb'),_0x577883,_0xe08e('0xc'));_0x257585(_0x9c60a7[_0xe08e('0x13')][_0xe08e('0x11')]);}})[_0xe08e('0x14')](function(_0x30cd0a){logger[_0xe08e('0xf')](_0xe08e('0xb'),_0x577883,_0x30cd0a);_0x173c30(_0x30cd0a);});});} \ No newline at end of file +var _0xa781=['stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','request','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x177564,_0x282768){var _0x560cfe=function(_0x5d2c8c){while(--_0x5d2c8c){_0x177564['push'](_0x177564['shift']());}};_0x560cfe(++_0x282768);}(_0xa781,0xfe));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a78('0x0'));var util=require(_0x1a78('0x1'));var moment=require(_0x1a78('0x2'));var BPromise=require(_0x1a78('0x3'));var rs=require(_0x1a78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a78('0x5'))('rpc');var config=require(_0x1a78('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41e3ab,_0x2f1af5,_0x1039d9){return new BPromise(function(_0x31b448,_0x2ad86c){return client[_0x1a78('0x7')](_0x41e3ab,_0x1039d9)[_0x1a78('0x8')](function(_0x3c3f43){logger['info']('VtigerField,\x20%s,\x20%s',_0x2f1af5,'request\x20sent');logger[_0x1a78('0x9')](_0x1a78('0xa'),_0x2f1af5,_0x1a78('0xb'),JSON[_0x1a78('0xc')](_0x3c3f43));if(_0x3c3f43[_0x1a78('0xd')]){if(_0x3c3f43[_0x1a78('0xd')][_0x1a78('0xe')]===0x1f4){logger[_0x1a78('0xd')](_0x1a78('0xf'),_0x2f1af5,_0x3c3f43[_0x1a78('0xd')]['message']);return _0x2ad86c(_0x3c3f43[_0x1a78('0xd')][_0x1a78('0x10')]);}logger[_0x1a78('0xd')](_0x1a78('0xf'),_0x2f1af5,_0x3c3f43[_0x1a78('0xd')][_0x1a78('0x10')]);return _0x31b448(_0x3c3f43['error'][_0x1a78('0x10')]);}else{logger[_0x1a78('0x11')]('VtigerField,\x20%s,\x20%s',_0x2f1af5,_0x1a78('0xb'));_0x31b448(_0x3c3f43['result'][_0x1a78('0x10')]);}})[_0x1a78('0x12')](function(_0x50cf25){logger[_0x1a78('0xd')](_0x1a78('0xf'),_0x2f1af5,_0x50cf25);_0x2ad86c(_0x50cf25);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d7745bb..515fecd 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 _0x7ab6=['/:id/fields','create','post','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations'];(function(_0x39679a,_0x480c93){var _0x1b626a=function(_0xd8241c){while(--_0xd8241c){_0x39679a['push'](_0x39679a['shift']());}};_0x1b626a(++_0x480c93);}(_0x7ab6,0x1bf));var _0x67ab=function(_0x3b1dfc,_0x3f7c2e){_0x3b1dfc=_0x3b1dfc-0x0;var _0x5f0915=_0x7ab6[_0x3b1dfc];return _0x5f0915;};'use strict';var multer=require(_0x67ab('0x0'));var util=require(_0x67ab('0x1'));var path=require(_0x67ab('0x2'));var timeout=require(_0x67ab('0x3'));var express=require(_0x67ab('0x4'));var router=express[_0x67ab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x67ab('0x6'));var interaction=require(_0x67ab('0x7'));var config=require(_0x67ab('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x67ab('0x9')]('/',auth['isAuthenticated'](),controller[_0x67ab('0xa')]);router['get'](_0x67ab('0xb'),auth[_0x67ab('0xc')](),controller['show']);router[_0x67ab('0x9')](_0x67ab('0xd'),auth['isAuthenticated'](),controller[_0x67ab('0xe')]);router['get'](_0x67ab('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x67ab('0x10')]);router[_0x67ab('0x11')](_0x67ab('0xd'),auth[_0x67ab('0xc')](),controller[_0x67ab('0x12')]);router[_0x67ab('0x13')](_0x67ab('0xb'),auth[_0x67ab('0xc')](),controller['update']);router[_0x67ab('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x67ab('0x15')]=router; \ No newline at end of file +var _0xfcb7=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0xfcb7,0xa9));var _0x7fcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcb7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fcb('0x0'));var util=require(_0x7fcb('0x1'));var path=require(_0x7fcb('0x2'));var timeout=require('connect-timeout');var express=require(_0x7fcb('0x3'));var router=express[_0x7fcb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7fcb('0x5'));var interaction=require(_0x7fcb('0x6'));var config=require(_0x7fcb('0x7'));var controller=require(_0x7fcb('0x8'));router[_0x7fcb('0x9')]('/',auth[_0x7fcb('0xa')](),controller[_0x7fcb('0xb')]);router[_0x7fcb('0x9')](_0x7fcb('0xc'),auth[_0x7fcb('0xa')](),controller['show']);router['get']('/:id/configurations',auth[_0x7fcb('0xa')](),controller[_0x7fcb('0xd')]);router[_0x7fcb('0x9')](_0x7fcb('0xe'),auth[_0x7fcb('0xa')](),controller['getFields']);router['post']('/',auth[_0x7fcb('0xa')](),controller['create']);router[_0x7fcb('0xf')](_0x7fcb('0x10'),auth[_0x7fcb('0xa')](),controller[_0x7fcb('0x11')]);router[_0x7fcb('0x12')](_0x7fcb('0xc'),auth[_0x7fcb('0xa')](),controller[_0x7fcb('0x13')]);router['delete']('/:id',auth[_0x7fcb('0xa')](),controller[_0x7fcb('0x14')]);module[_0x7fcb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5178e8c..f4a7294 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 _0xd3c8=['integrationTab','newTab','sequelize','exports','STRING','remoteUri','password','token','ENUM'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xd3c8,0x161));var _0x8d3c=function(_0x1f1d4a,_0x3fb1ba){_0x1f1d4a=_0x1f1d4a-0x0;var _0x5f3b35=_0xd3c8[_0x1f1d4a];return _0x5f3b35;};'use strict';var Sequelize=require(_0x8d3c('0x0'));module[_0x8d3c('0x1')]={'name':{'type':Sequelize[_0x8d3c('0x2')]},'description':{'type':Sequelize[_0x8d3c('0x2')]},'username':{'type':Sequelize[_0x8d3c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x8d3c('0x2')]},'token':{'type':Sequelize[_0x8d3c('0x2')]},'remoteUri':{'type':Sequelize[_0x8d3c('0x2')],'unique':_0x8d3c('0x3')},'authType':{'type':Sequelize['ENUM'](_0x8d3c('0x4'),_0x8d3c('0x5')),'defaultValue':_0x8d3c('0x4')},'serverUrl':{'type':Sequelize[_0x8d3c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8d3c('0x6')](_0x8d3c('0x7'),_0x8d3c('0x8')),'defaultValue':_0x8d3c('0x7')}}; \ No newline at end of file +var _0xf40b=['integrationTab','exports','STRING','remoteUri','ENUM','token','password'];(function(_0x1a819a,_0x332998){var _0x1842a1=function(_0x1c2714){while(--_0x1c2714){_0x1a819a['push'](_0x1a819a['shift']());}};_0x1842a1(++_0x332998);}(_0xf40b,0xb0));var _0xbf40=function(_0x9d77b5,_0x4fcdb3){_0x9d77b5=_0x9d77b5-0x0;var _0x4b26d0=_0xf40b[_0x9d77b5];return _0x4b26d0;};'use strict';var Sequelize=require('sequelize');module[_0xbf40('0x0')]={'name':{'type':Sequelize[_0xbf40('0x1')]},'description':{'type':Sequelize[_0xbf40('0x1')]},'username':{'type':Sequelize[_0xbf40('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xbf40('0x1')]},'token':{'type':Sequelize[_0xbf40('0x1')]},'remoteUri':{'type':Sequelize[_0xbf40('0x1')],'unique':_0xbf40('0x2')},'authType':{'type':Sequelize[_0xbf40('0x3')]('password',_0xbf40('0x4')),'defaultValue':_0xbf40('0x5')},'serverUrl':{'type':Sequelize[_0xbf40('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbf40('0x3')](_0xbf40('0x6'),'newTab'),'defaultValue':_0xbf40('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1c4334e..a9503ae 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 _0x3266=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','merge','options','create','body','find','params','destroy','findOne','ZendeskConfiguration','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','username','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','system_field_options','custom_field_options','test','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0x139359,_0x59b054){var _0x32115f=function(_0x3ca9af){while(--_0x3ca9af){_0x139359['push'](_0x139359['shift']());}};_0x32115f(++_0x59b054);}(_0x3266,0x6a));var _0x6326=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x3266[_0x2272b5];return _0x110156;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];var integrations=require(_0x6326('0x1c'));function respondWithStatusCode(_0x5c07e1,_0x5381d0){_0x5381d0=_0x5381d0||0xcc;return function(_0x301f34){if(_0x301f34){return _0x5c07e1[_0x6326('0x1d')](_0x5381d0);}return _0x5c07e1['status'](_0x5381d0)[_0x6326('0x1e')]();};}function respondWithResult(_0x4caef3,_0x2d2d9b){_0x2d2d9b=_0x2d2d9b||0xc8;return function(_0x20dcc6){if(_0x20dcc6){return _0x4caef3[_0x6326('0x1f')](_0x2d2d9b)[_0x6326('0x20')](_0x20dcc6);}};}function respondWithFilteredResult(_0x1ed3a3,_0x2c1879){return function(_0x55923a){if(_0x55923a){var _0x1104c5=typeof _0x2c1879['offset']==='undefined'&&typeof _0x2c1879['limit']==='undefined';var _0x5d402d=_0x55923a['count'];var _0xdf5ced=_0x1104c5?0x0:_0x2c1879[_0x6326('0x21')];var _0x2be78e=_0x1104c5?_0x55923a['count']:_0x2c1879['offset']+_0x2c1879[_0x6326('0x22')];var _0x42319c;if(_0x2be78e>=_0x5d402d){_0x2be78e=_0x5d402d;_0x42319c=0xc8;}else{_0x42319c=0xce;}_0x1ed3a3[_0x6326('0x1f')](_0x42319c);return _0x1ed3a3[_0x6326('0x23')](_0x6326('0x24'),_0xdf5ced+'-'+_0x2be78e+'/'+_0x5d402d)[_0x6326('0x20')](_0x55923a);}return null;};}function patchUpdates(_0x21ee7d){return function(_0x53b437){try{jsonpatch[_0x6326('0x25')](_0x53b437,_0x21ee7d,!![]);}catch(_0x549f07){return BPromise[_0x6326('0x26')](_0x549f07);}return _0x53b437[_0x6326('0x27')]();};}function saveUpdates(_0x2482ef,_0x24fb78){return function(_0x43cdfc){if(_0x43cdfc){return _0x43cdfc[_0x6326('0x28')](_0x2482ef)[_0x6326('0x29')](function(_0x429bb0){return _0x429bb0;});}return null;};}function removeEntity(_0x4781cc,_0x2d0d00){return function(_0x34954b){if(_0x34954b){return _0x34954b['destroy']()[_0x6326('0x29')](function(){_0x4781cc[_0x6326('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e272b,_0x4d28fd){return function(_0x405474){if(!_0x405474){_0x4e272b['sendStatus'](0x194);}return _0x405474;};}function handleError(_0x33c466,_0x1a48da){_0x1a48da=_0x1a48da||0x1f4;return function(_0x5a907f){logger[_0x6326('0x2a')](_0x5a907f[_0x6326('0x2b')]);if(_0x5a907f[_0x6326('0x2c')]){delete _0x5a907f[_0x6326('0x2c')];}_0x33c466[_0x6326('0x1f')](_0x1a48da)[_0x6326('0x2d')](_0x5a907f);};}exports[_0x6326('0x2e')]=function(_0x27802c,_0x461e0f){var _0x127744={},_0x4980f6={},_0x2a8873={'count':0x0,'rows':[]};var _0x331772=_[_0x6326('0x2f')](db[_0x6326('0x30')][_0x6326('0x31')],function(_0x520e57){return{'name':_0x520e57[_0x6326('0x32')],'type':_0x520e57[_0x6326('0x33')][_0x6326('0x34')]};});_0x4980f6['model']=_[_0x6326('0x2f')](_0x331772,'name');_0x4980f6['query']=_[_0x6326('0x35')](_0x27802c[_0x6326('0x36')]);_0x4980f6[_0x6326('0x37')]=_[_0x6326('0x38')](_0x4980f6[_0x6326('0x39')],_0x4980f6[_0x6326('0x36')]);_0x127744[_0x6326('0x3a')]=_[_0x6326('0x38')](_0x4980f6[_0x6326('0x39')],qs[_0x6326('0x3b')](_0x27802c[_0x6326('0x36')][_0x6326('0x3b')]));_0x127744['attributes']=_0x127744[_0x6326('0x3a')][_0x6326('0x3c')]?_0x127744['attributes']:_0x4980f6[_0x6326('0x39')];if(!_0x27802c[_0x6326('0x36')][_0x6326('0x3d')]('nolimit')){_0x127744[_0x6326('0x22')]=qs['limit'](_0x27802c['query'][_0x6326('0x22')]);_0x127744[_0x6326('0x21')]=qs[_0x6326('0x21')](_0x27802c['query'][_0x6326('0x21')]);}_0x127744['order']=qs[_0x6326('0x3e')](_0x27802c['query'][_0x6326('0x3e')]);_0x127744[_0x6326('0x3f')]=qs[_0x6326('0x37')](_[_0x6326('0x40')](_0x27802c[_0x6326('0x36')],_0x4980f6[_0x6326('0x37')]),_0x331772);if(_0x27802c['query'][_0x6326('0x41')]){_0x127744[_0x6326('0x3f')]=_['merge'](_0x127744[_0x6326('0x3f')],{'$or':_['map'](_0x331772,function(_0x5607ea){if(_0x5607ea[_0x6326('0x33')]!==_0x6326('0x42')){var _0x3c170b={};_0x3c170b[_0x5607ea[_0x6326('0x2c')]]={'$like':'%'+_0x27802c[_0x6326('0x36')][_0x6326('0x41')]+'%'};return _0x3c170b;}})});}_0x127744=_['merge']({},_0x127744,_0x27802c['options']);var _0x32886f={'where':_0x127744['where']};return db[_0x6326('0x30')]['count'](_0x32886f)[_0x6326('0x29')](function(_0x517f6b){_0x2a8873[_0x6326('0x43')]=_0x517f6b;if(_0x27802c[_0x6326('0x36')][_0x6326('0x44')]){_0x127744[_0x6326('0x45')]=[{'all':!![]}];}return db[_0x6326('0x30')][_0x6326('0x46')](_0x127744);})[_0x6326('0x29')](function(_0x3998ba){_0x2a8873[_0x6326('0x47')]=_0x3998ba;return _0x2a8873;})['then'](respondWithFilteredResult(_0x461e0f,_0x127744))[_0x6326('0x48')](handleError(_0x461e0f,null));};exports['show']=function(_0x29f2fd,_0x1d9d4c){var _0x16fc33={'raw':![],'where':{'id':_0x29f2fd['params']['id']}},_0x50582a={};_0x50582a[_0x6326('0x39')]=_[_0x6326('0x35')](db['ZendeskAccount'][_0x6326('0x31')]);_0x50582a[_0x6326('0x36')]=_[_0x6326('0x35')](_0x29f2fd[_0x6326('0x36')]);_0x50582a['filters']=_[_0x6326('0x38')](_0x50582a[_0x6326('0x39')],_0x50582a[_0x6326('0x36')]);_0x16fc33[_0x6326('0x3a')]=_[_0x6326('0x38')](_0x50582a[_0x6326('0x39')],qs[_0x6326('0x3b')](_0x29f2fd['query'][_0x6326('0x3b')]));_0x16fc33[_0x6326('0x3a')]=_0x16fc33[_0x6326('0x3a')][_0x6326('0x3c')]?_0x16fc33['attributes']:_0x50582a[_0x6326('0x39')];if(_0x29f2fd['query'][_0x6326('0x44')]){_0x16fc33[_0x6326('0x45')]=[{'all':!![]}];}_0x16fc33=_[_0x6326('0x49')]({},_0x16fc33,_0x29f2fd[_0x6326('0x4a')]);return db[_0x6326('0x30')]['find'](_0x16fc33)[_0x6326('0x29')](handleEntityNotFound(_0x1d9d4c,null))['then'](respondWithResult(_0x1d9d4c,null))['catch'](handleError(_0x1d9d4c,null));};exports[_0x6326('0x4b')]=function(_0x44cf9d,_0x5b14f4){return db[_0x6326('0x30')][_0x6326('0x4b')](_0x44cf9d[_0x6326('0x4c')],{})[_0x6326('0x29')](respondWithResult(_0x5b14f4,0xc9))[_0x6326('0x48')](handleError(_0x5b14f4,null));};exports['update']=function(_0x4af0ee,_0x2d82c0){if(_0x4af0ee[_0x6326('0x4c')]['id']){delete _0x4af0ee[_0x6326('0x4c')]['id'];}return db[_0x6326('0x30')][_0x6326('0x4d')]({'where':{'id':_0x4af0ee[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x2d82c0,null))['then'](saveUpdates(_0x4af0ee[_0x6326('0x4c')],null))[_0x6326('0x29')](respondWithResult(_0x2d82c0,null))[_0x6326('0x48')](handleError(_0x2d82c0,null));};exports[_0x6326('0x4f')]=function(_0x1b5e9a,_0x4ff8e6){return db[_0x6326('0x30')]['find']({'where':{'id':_0x1b5e9a[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x4ff8e6,null))['then'](removeEntity(_0x4ff8e6,null))[_0x6326('0x48')](handleError(_0x4ff8e6,null));};exports['getConfigurations']=function(_0xaa4c9d,_0x202fd3,_0x2ee8df){var _0x35400e={};var _0x58731d={};var _0x42c8bc;var _0xbe6b3e;return db['ZendeskAccount'][_0x6326('0x50')]({'where':{'id':_0xaa4c9d[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x202fd3,null))['then'](function(_0x2bece1){if(_0x2bece1){_0x42c8bc=_0x2bece1;_0x58731d[_0x6326('0x39')]=_['keys'](db[_0x6326('0x51')]['rawAttributes']);_0x58731d[_0x6326('0x36')]=_[_0x6326('0x35')](_0xaa4c9d[_0x6326('0x36')]);_0x58731d[_0x6326('0x37')]=_[_0x6326('0x38')](_0x58731d[_0x6326('0x39')],_0x58731d[_0x6326('0x36')]);_0x35400e['attributes']=_['intersection'](_0x58731d['model'],qs[_0x6326('0x3b')](_0xaa4c9d['query'][_0x6326('0x3b')]));_0x35400e[_0x6326('0x3a')]=_0x35400e[_0x6326('0x3a')][_0x6326('0x3c')]?_0x35400e[_0x6326('0x3a')]:_0x58731d['model'];_0x35400e[_0x6326('0x52')]=qs[_0x6326('0x3e')](_0xaa4c9d['query'][_0x6326('0x3e')]);_0x35400e[_0x6326('0x3f')]=qs[_0x6326('0x37')](_[_0x6326('0x40')](_0xaa4c9d[_0x6326('0x36')],_0x58731d[_0x6326('0x37')]));if(_0xaa4c9d[_0x6326('0x36')][_0x6326('0x41')]){_0x35400e[_0x6326('0x3f')]=_[_0x6326('0x49')](_0x35400e['where'],{'$or':_[_0x6326('0x2f')](_0x35400e[_0x6326('0x3a')],function(_0x3fc712){var _0x92f535={};_0x92f535[_0x3fc712]={'$like':'%'+_0xaa4c9d['query']['filter']+'%'};return _0x92f535;})});}_0x35400e=_[_0x6326('0x49')]({},_0x35400e,_0xaa4c9d[_0x6326('0x4a')]);return _0x42c8bc[_0x6326('0x53')](_0x35400e);}})[_0x6326('0x29')](function(_0x3ac39d){if(_0x3ac39d){_0xbe6b3e=_0x3ac39d['length'];if(!_0xaa4c9d['query'][_0x6326('0x3d')](_0x6326('0x54'))){_0x35400e[_0x6326('0x22')]=qs[_0x6326('0x22')](_0xaa4c9d['query'][_0x6326('0x22')]);_0x35400e[_0x6326('0x21')]=qs[_0x6326('0x21')](_0xaa4c9d[_0x6326('0x36')][_0x6326('0x21')]);}return _0x42c8bc[_0x6326('0x53')](_0x35400e);}})['then'](function(_0x2bc08a){if(_0x2bc08a){return _0x2bc08a?{'count':_0xbe6b3e,'rows':_0x2bc08a}:null;}})['then'](respondWithResult(_0x202fd3,null))[_0x6326('0x48')](handleError(_0x202fd3,null));};exports[_0x6326('0x55')]=function(_0x57dfde,_0x14d66c,_0x56fb58){if(_0x57dfde[_0x6326('0x4c')]['id']){delete _0x57dfde[_0x6326('0x4c')]['id'];}return db[_0x6326('0x30')][_0x6326('0x50')]({'where':{'id':_0x57dfde[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x14d66c,null))[_0x6326('0x29')](function(_0x3f5e2e){if(_0x3f5e2e){_0x57dfde['body'][_0x6326('0x56')]=_0x3f5e2e['id'];_0x57dfde[_0x6326('0x4c')][_0x6326('0x57')]=integrations[_0x6326('0x58')](_0x57dfde[_0x6326('0x4c')]['channel'],_0x57dfde[_0x6326('0x4c')][_0x6326('0x33')]);_0x57dfde[_0x6326('0x4c')][_0x6326('0x59')]=integrations[_0x6326('0x5a')](_0x57dfde['body'][_0x6326('0x5b')],_0x57dfde['body']['type']);return db[_0x6326('0x51')][_0x6326('0x4b')](_0x57dfde[_0x6326('0x4c')],{'include':[{'model':db[_0x6326('0x5c')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x14d66c,null))[_0x6326('0x48')](handleError(_0x14d66c,null));};exports['getFields']=function(_0x303fef,_0x5f6273,_0x54730e){var _0x4c1d7e='';return db['ZendeskAccount'][_0x6326('0x50')]({'where':{'id':_0x303fef['params']['id']},'attributes':['id',_0x6326('0x5d'),'password','token','authType','remoteUri']})[_0x6326('0x29')](handleEntityNotFound(_0x5f6273,null))['then'](function(_0xe2e249){if(_0xe2e249){_0x4c1d7e=_0xe2e249[_0x6326('0x5e')];var _0x50a1dc=_0x4c1d7e[_0x6326('0x5f')](-0x1);if(_0x50a1dc==='/'){_0x4c1d7e=_0x4c1d7e['substring'](0x0,_0x4c1d7e[_0x6326('0x60')](_0x50a1dc));}var _0x1dda23={'method':_0x6326('0x61'),'uri':util[_0x6326('0x62')](_0x6326('0x63'),_0x4c1d7e,_0x6326('0x64')),'json':!![]};switch(_0xe2e249[_0x6326('0x65')]){case _0x6326('0x66'):_0x1dda23[_0x6326('0x67')]={'Authorization':util[_0x6326('0x62')](_0x6326('0x68'),new Buffer(util[_0x6326('0x62')](_0x6326('0x69'),_0xe2e249[_0x6326('0x5d')],_0xe2e249[_0x6326('0x66')]))[_0x6326('0x6a')](_0x6326('0x6b')))};break;case'token':_0x1dda23['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x6326('0x62')]('%s/token:%s',_0xe2e249['username'],_0xe2e249['token']))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0x6326('0x6c'))](_0x6326('0x6d'));}return rp(_0x1dda23);}})['then'](function(_0x3b4bca){if(_0x3b4bca){var _0x2bfc43=[_0x6326('0x6e'),'description',_0x6326('0x6f'),_0x6326('0x70')];_[_0x6326('0x71')](_0x3b4bca[_0x6326('0x64')],function(_0x3e9477){return _0x2bfc43['includes'](_0x3e9477[_0x6326('0x33')]);});return{'count':_0x3b4bca['ticket_fields']['length'],'rows':_[_0x6326('0x2f')](_0x3b4bca['ticket_fields'],function(_0x57c845){return{'id':_0x57c845['id'],'name':_0x57c845['position']>0x7?_0x57c845['title']:_0x57c845['type'],'custom':_0x57c845['position']>0x7?!![]:![],'options':_0x57c845['system_field_options']?_0x57c845[_0x6326('0x72')]:_0x57c845[_0x6326('0x73')]?_0x57c845[_0x6326('0x73')]:[]};})};}})[_0x6326('0x29')](respondWithResult(_0x5f6273,null))['catch'](function(_0x484866){var _0x4b61c4=_0x303fef[_0x6326('0x36')][_0x6326('0x74')]?0x1f4:_0x484866['statusCode']||0x1f4;logger[_0x6326('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4b61c4,JSON[_0x6326('0x75')](_0x484866));delete _0x484866[_0x6326('0x2c')];if(_0x4b61c4===0x191){_0x4b61c4=0x190;}_0x5f6273[_0x6326('0x1f')](_0x4b61c4)[_0x6326('0x2d')](_0x303fef[_0x6326('0x36')][_0x6326('0x74')]?{'message':_0x6326('0x76'),'statusCode':_0x484866['statusCode']}:_0x484866);});}; \ No newline at end of file +var _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x5f259c,_0x26127d){var _0xddcf04=function(_0x5ea71f){while(--_0x5ea71f){_0x5f259c['push'](_0x5f259c['shift']());}};_0xddcf04(++_0x26127d);}(_0x351d,0x90));var _0xd351=function(_0x5541a0,_0x34daab){_0x5541a0=_0x5541a0-0x0;var _0x52546f=_0x351d[_0x5541a0];return _0x52546f;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 9bd24fd..d70a9ed 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 _0xc651=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x55bede,_0x2c9a51){var _0xa8c3cf=function(_0x2d0673){while(--_0x2d0673){_0x55bede['push'](_0x55bede['shift']());}};_0xa8c3cf(++_0x2c9a51);}(_0xc651,0x105));var _0x1c65=function(_0x5e2976,_0x2cc1ec){_0x5e2976=_0x5e2976-0x0;var _0x5979c9=_0xc651[_0x5e2976];return _0x5979c9;};'use strict';var _=require(_0x1c65('0x0'));var util=require(_0x1c65('0x1'));var logger=require(_0x1c65('0x2'))(_0x1c65('0x3'));var moment=require('moment');var BPromise=require(_0x1c65('0x4'));var rp=require(_0x1c65('0x5'));var fs=require('fs');var path=require(_0x1c65('0x6'));var rimraf=require(_0x1c65('0x7'));var config=require(_0x1c65('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x14f8b5,_0x2be225){return _0x14f8b5[_0x1c65('0x9')](_0x1c65('0xa'),attributes,{'tableName':_0x1c65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x585a=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a126a,_0x4a0134){var _0x5bc54a=function(_0x3f9cfd){while(--_0x3f9cfd){_0x5a126a['push'](_0x5a126a['shift']());}};_0x5bc54a(++_0x4a0134);}(_0x585a,0x180));var _0xa585=function(_0x1baf7b,_0x7d4056){_0x1baf7b=_0x1baf7b-0x0;var _0x4b3bcb=_0x585a[_0x1baf7b];return _0x4b3bcb;};'use strict';var _=require(_0xa585('0x0'));var util=require('util');var logger=require(_0xa585('0x1'))('api');var moment=require(_0xa585('0x2'));var BPromise=require(_0xa585('0x3'));var rp=require(_0xa585('0x4'));var fs=require('fs');var path=require(_0xa585('0x5'));var rimraf=require(_0xa585('0x6'));var config=require(_0xa585('0x7'));var attributes=require(_0xa585('0x8'));var integrations=require(_0xa585('0x9'));module[_0xa585('0xa')]=function(_0x2abb7e,_0x1c27bf){return _0x2abb7e[_0xa585('0xb')](_0xa585('0xc'),attributes,{'tableName':_0xa585('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2326185..78cdbd9 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 _0xcc83=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowZendeskAccount','find','lodash'];(function(_0x2bb7ed,_0x40a427){var _0x509f14=function(_0x5281c6){while(--_0x5281c6){_0x2bb7ed['push'](_0x2bb7ed['shift']());}};_0x509f14(++_0x40a427);}(_0xcc83,0xae));var _0x3cc8=function(_0x359433,_0x2398b0){_0x359433=_0x359433-0x0;var _0x2db8ab=_0xcc83[_0x359433];return _0x2db8ab;};'use strict';var _=require(_0x3cc8('0x0'));var util=require('util');var moment=require(_0x3cc8('0x1'));var BPromise=require(_0x3cc8('0x2'));var rs=require(_0x3cc8('0x3'));var fs=require('fs');var Redis=require(_0x3cc8('0x4'));var db=require(_0x3cc8('0x5'))['db'];var utils=require(_0x3cc8('0x6'));var logger=require('../../config/logger')(_0x3cc8('0x7'));var config=require(_0x3cc8('0x8'));var jayson=require(_0x3cc8('0x9'));var client=jayson['client'][_0x3cc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21aa24,_0x2a1c7e,_0x23b968){return new BPromise(function(_0x252b50,_0x7c2746){return client[_0x3cc8('0xb')](_0x21aa24,_0x23b968)['then'](function(_0x5eb357){logger[_0x3cc8('0xc')](_0x3cc8('0xd'),_0x2a1c7e,'request\x20sent');logger['debug'](_0x3cc8('0xe'),_0x2a1c7e,_0x3cc8('0xf'),JSON[_0x3cc8('0x10')](_0x5eb357));if(_0x5eb357[_0x3cc8('0x11')]){if(_0x5eb357['error']['code']===0x1f4){logger[_0x3cc8('0x11')](_0x3cc8('0xd'),_0x2a1c7e,_0x5eb357['error']['message']);return _0x7c2746(_0x5eb357[_0x3cc8('0x11')][_0x3cc8('0x12')]);}logger[_0x3cc8('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2a1c7e,_0x5eb357[_0x3cc8('0x11')]['message']);return _0x252b50(_0x5eb357[_0x3cc8('0x11')][_0x3cc8('0x12')]);}else{logger[_0x3cc8('0xc')](_0x3cc8('0xd'),_0x2a1c7e,_0x3cc8('0xf'));_0x252b50(_0x5eb357[_0x3cc8('0x13')][_0x3cc8('0x12')]);}})[_0x3cc8('0x14')](function(_0x340d42){logger['error'](_0x3cc8('0xd'),_0x2a1c7e,_0x340d42);_0x7c2746(_0x340d42);});});}exports[_0x3cc8('0x15')]=function(_0x26e6bf){var _0x64b01e=this;return new Promise(function(_0x292979,_0x4e4ab7){return db[_0x3cc8('0x16')][_0x3cc8('0x17')]({'raw':_0x26e6bf[_0x3cc8('0x18')]?_0x26e6bf['options'][_0x3cc8('0x19')]===undefined?!![]:![]:!![],'where':_0x26e6bf[_0x3cc8('0x18')]?_0x26e6bf[_0x3cc8('0x18')][_0x3cc8('0x1a')]||null:null,'attributes':_0x26e6bf[_0x3cc8('0x18')]?_0x26e6bf[_0x3cc8('0x18')][_0x3cc8('0x1b')]||null:null,'limit':_0x26e6bf[_0x3cc8('0x18')]?_0x26e6bf[_0x3cc8('0x18')][_0x3cc8('0x1c')]||null:null,'include':_0x26e6bf['options']?_0x26e6bf[_0x3cc8('0x18')][_0x3cc8('0x1d')]?_['map'](_0x26e6bf[_0x3cc8('0x18')][_0x3cc8('0x1d')],function(_0x5890ad){return{'model':db[_0x5890ad['model']],'as':_0x5890ad['as'],'attributes':_0x5890ad[_0x3cc8('0x1b')],'include':_0x5890ad[_0x3cc8('0x1d')]?_[_0x3cc8('0x1e')](_0x5890ad['include'],function(_0x1f357a){return{'model':db[_0x1f357a[_0x3cc8('0x1f')]],'as':_0x1f357a['as'],'attributes':_0x1f357a['attributes'],'include':_0x1f357a['include']?_[_0x3cc8('0x1e')](_0x1f357a[_0x3cc8('0x1d')],function(_0x1adf4e){return{'model':db[_0x1adf4e['model']],'as':_0x1adf4e['as'],'attributes':_0x1adf4e[_0x3cc8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3cc8('0x20')](function(_0x155217){logger['info'](_0x3cc8('0x15'),_0x26e6bf);logger['debug'](_0x3cc8('0x15'),_0x26e6bf,JSON['stringify'](_0x155217));_0x292979(_0x155217);})['catch'](function(_0x393142){logger[_0x3cc8('0x11')](_0x3cc8('0x15'),_0x393142[_0x3cc8('0x12')],_0x26e6bf);_0x4e4ab7(_0x64b01e['error'](0x1f4,_0x393142[_0x3cc8('0x12')]));});});};exports[_0x3cc8('0x21')]=function(_0x505f46){var _0x5f28a3=this;return new Promise(function(_0x39dabd,_0x1eeeac){return db[_0x3cc8('0x16')][_0x3cc8('0x22')]({'raw':_0x505f46[_0x3cc8('0x18')]?_0x505f46[_0x3cc8('0x18')][_0x3cc8('0x19')]===undefined?!![]:![]:!![],'where':_0x505f46[_0x3cc8('0x18')]?_0x505f46[_0x3cc8('0x18')]['where']||null:null,'attributes':_0x505f46[_0x3cc8('0x18')]?_0x505f46[_0x3cc8('0x18')]['attributes']||null:null,'include':_0x505f46[_0x3cc8('0x18')]?_0x505f46['options'][_0x3cc8('0x1d')]?_[_0x3cc8('0x1e')](_0x505f46[_0x3cc8('0x18')]['include'],function(_0x47b42c){return{'model':db[_0x47b42c[_0x3cc8('0x1f')]],'as':_0x47b42c['as'],'attributes':_0x47b42c[_0x3cc8('0x1b')],'include':_0x47b42c[_0x3cc8('0x1d')]?_[_0x3cc8('0x1e')](_0x47b42c[_0x3cc8('0x1d')],function(_0x44d66a){return{'model':db[_0x44d66a['model']],'as':_0x44d66a['as'],'attributes':_0x44d66a['attributes'],'include':_0x44d66a['include']?_[_0x3cc8('0x1e')](_0x44d66a['include'],function(_0x4c8668){return{'model':db[_0x4c8668['model']],'as':_0x4c8668['as'],'attributes':_0x4c8668[_0x3cc8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3cc8('0x20')](function(_0x496f5c){logger[_0x3cc8('0xc')](_0x3cc8('0x21'),_0x505f46);logger['debug'](_0x3cc8('0x21'),_0x505f46,JSON[_0x3cc8('0x10')](_0x496f5c));_0x39dabd(_0x496f5c);})[_0x3cc8('0x14')](function(_0x53d72c){logger[_0x3cc8('0x11')](_0x3cc8('0x21'),_0x53d72c['message'],_0x505f46);_0x1eeeac(_0x5f28a3[_0x3cc8('0x11')](0x1f4,_0x53d72c[_0x3cc8('0x12')]));});});}; \ No newline at end of file +var _0x100b=['stringify','error','message','ZendeskAccount,\x20%s,\x20%s','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','model','map','ShowZendeskAccount','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x100b,0x171));var _0xb100=function(_0x1185da,_0x46695a){_0x1185da=_0x1185da-0x0;var _0x29cd54=_0x100b[_0x1185da];return _0x29cd54;};'use strict';var _=require(_0xb100('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb100('0x1'));var fs=require('fs');var Redis=require(_0xb100('0x2'));var db=require(_0xb100('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb100('0x4'));var config=require(_0xb100('0x5'));var jayson=require(_0xb100('0x6'));var client=jayson[_0xb100('0x7')][_0xb100('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b2d01,_0x561f12,_0x2915ea){return new BPromise(function(_0x13978d,_0x6aad9d){return client[_0xb100('0x9')](_0x3b2d01,_0x2915ea)[_0xb100('0xa')](function(_0x2e5311){logger[_0xb100('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x561f12,_0xb100('0xc'));logger[_0xb100('0xd')](_0xb100('0xe'),_0x561f12,_0xb100('0xc'),JSON[_0xb100('0xf')](_0x2e5311));if(_0x2e5311[_0xb100('0x10')]){if(_0x2e5311[_0xb100('0x10')]['code']===0x1f4){logger[_0xb100('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x561f12,_0x2e5311['error'][_0xb100('0x11')]);return _0x6aad9d(_0x2e5311[_0xb100('0x10')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x561f12,_0x2e5311[_0xb100('0x10')][_0xb100('0x11')]);return _0x13978d(_0x2e5311[_0xb100('0x10')][_0xb100('0x11')]);}else{logger[_0xb100('0xb')](_0xb100('0x12'),_0x561f12,_0xb100('0xc'));_0x13978d(_0x2e5311[_0xb100('0x13')]['message']);}})[_0xb100('0x14')](function(_0xa962dc){logger[_0xb100('0x10')](_0xb100('0x12'),_0x561f12,_0xa962dc);_0x6aad9d(_0xa962dc);});});}exports[_0xb100('0x15')]=function(_0x3ab46f){var _0xbb85bd=this;return new Promise(function(_0x3c89db,_0x50d1d1){return db[_0xb100('0x16')]['findAll']({'raw':_0x3ab46f[_0xb100('0x17')]?_0x3ab46f[_0xb100('0x17')][_0xb100('0x18')]===undefined?!![]:![]:!![],'where':_0x3ab46f[_0xb100('0x17')]?_0x3ab46f[_0xb100('0x17')][_0xb100('0x19')]||null:null,'attributes':_0x3ab46f[_0xb100('0x17')]?_0x3ab46f[_0xb100('0x17')][_0xb100('0x1a')]||null:null,'limit':_0x3ab46f[_0xb100('0x17')]?_0x3ab46f['options'][_0xb100('0x1b')]||null:null,'include':_0x3ab46f[_0xb100('0x17')]?_0x3ab46f['options']['include']?_['map'](_0x3ab46f[_0xb100('0x17')][_0xb100('0x1c')],function(_0x13905c){return{'model':db[_0x13905c[_0xb100('0x1d')]],'as':_0x13905c['as'],'attributes':_0x13905c['attributes'],'include':_0x13905c[_0xb100('0x1c')]?_[_0xb100('0x1e')](_0x13905c[_0xb100('0x1c')],function(_0x118f7a){return{'model':db[_0x118f7a[_0xb100('0x1d')]],'as':_0x118f7a['as'],'attributes':_0x118f7a['attributes'],'include':_0x118f7a[_0xb100('0x1c')]?_[_0xb100('0x1e')](_0x118f7a[_0xb100('0x1c')],function(_0x39350f){return{'model':db[_0x39350f['model']],'as':_0x39350f['as'],'attributes':_0x39350f[_0xb100('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb100('0xa')](function(_0x3bcbe3){logger[_0xb100('0xb')](_0xb100('0x15'),_0x3ab46f);logger['debug'](_0xb100('0x15'),_0x3ab46f,JSON['stringify'](_0x3bcbe3));_0x3c89db(_0x3bcbe3);})[_0xb100('0x14')](function(_0x16a221){logger[_0xb100('0x10')](_0xb100('0x15'),_0x16a221[_0xb100('0x11')],_0x3ab46f);_0x50d1d1(_0xbb85bd[_0xb100('0x10')](0x1f4,_0x16a221['message']));});});};exports[_0xb100('0x1f')]=function(_0x468bb8){var _0x7a0119=this;return new Promise(function(_0x477272,_0x453723){return db[_0xb100('0x16')]['find']({'raw':_0x468bb8[_0xb100('0x17')]?_0x468bb8[_0xb100('0x17')][_0xb100('0x18')]===undefined?!![]:![]:!![],'where':_0x468bb8['options']?_0x468bb8[_0xb100('0x17')]['where']||null:null,'attributes':_0x468bb8[_0xb100('0x17')]?_0x468bb8[_0xb100('0x17')][_0xb100('0x1a')]||null:null,'include':_0x468bb8[_0xb100('0x17')]?_0x468bb8[_0xb100('0x17')][_0xb100('0x1c')]?_[_0xb100('0x1e')](_0x468bb8[_0xb100('0x17')][_0xb100('0x1c')],function(_0x48ce43){return{'model':db[_0x48ce43[_0xb100('0x1d')]],'as':_0x48ce43['as'],'attributes':_0x48ce43[_0xb100('0x1a')],'include':_0x48ce43[_0xb100('0x1c')]?_[_0xb100('0x1e')](_0x48ce43[_0xb100('0x1c')],function(_0x501dae){return{'model':db[_0x501dae['model']],'as':_0x501dae['as'],'attributes':_0x501dae[_0xb100('0x1a')],'include':_0x501dae[_0xb100('0x1c')]?_['map'](_0x501dae[_0xb100('0x1c')],function(_0xf07bd0){return{'model':db[_0xf07bd0[_0xb100('0x1d')]],'as':_0xf07bd0['as'],'attributes':_0xf07bd0[_0xb100('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb100('0xa')](function(_0x22165e){logger[_0xb100('0xb')](_0xb100('0x1f'),_0x468bb8);logger[_0xb100('0xd')]('ShowZendeskAccount',_0x468bb8,JSON[_0xb100('0xf')](_0x22165e));_0x477272(_0x22165e);})['catch'](function(_0x1d76fb){logger[_0xb100('0x10')](_0xb100('0x1f'),_0x1d76fb[_0xb100('0x11')],_0x468bb8);_0x453723(_0x7a0119[_0xb100('0x10')](0x1f4,_0x1d76fb[_0xb100('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d601245..c75ac97 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x2c3e4d,_0xac66ef){var _0x58b83d=function(_0xd78cd0){while(--_0xd78cd0){_0x2c3e4d['push'](_0x2c3e4d['shift']());}};_0x58b83d(++_0xac66ef);}(_0xe706,0xa3));var _0x6e70=function(_0x5e909d,_0xcb0787){_0x5e909d=_0x5e909d-0x0;var _0x4cf7b5=_0xe706[_0x5e909d];return _0x4cf7b5;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3d5fb2b..0dc0f25 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 _0x631b=['exports','STRING','sequelize'];(function(_0x47299b,_0x3c5a9d){var _0x2129c8=function(_0x1129ee){while(--_0x1129ee){_0x47299b['push'](_0x47299b['shift']());}};_0x2129c8(++_0x3c5a9d);}(_0x631b,0x12e));var _0xb631=function(_0x5b734b,_0x486a7f){_0x5b734b=_0x5b734b-0x0;var _0x2a15a3=_0x631b[_0x5b734b];return _0x2a15a3;};'use strict';var Sequelize=require(_0xb631('0x0'));module[_0xb631('0x1')]={'name':{'type':Sequelize[_0xb631('0x2')]},'description':{'type':Sequelize[_0xb631('0x2')]}}; \ No newline at end of file +var _0xfa65=['sequelize','STRING'];(function(_0x18b26a,_0x41d783){var _0x13aa03=function(_0x36b16a){while(--_0x36b16a){_0x18b26a['push'](_0x18b26a['shift']());}};_0x13aa03(++_0x41d783);}(_0xfa65,0x1cc));var _0x5fa6=function(_0x36c7f5,_0x3996eb){_0x36c7f5=_0x36c7f5-0x0;var _0x34893d=_0xfa65[_0x36c7f5];return _0x34893d;};'use strict';var Sequelize=require(_0x5fa6('0x0'));module['exports']={'name':{'type':Sequelize[_0x5fa6('0x1')]},'description':{'type':Sequelize[_0x5fa6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4efc82e..d1ae5c9 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 _0xd6c3=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','include','rows','catch','show','fields','find','create','body','params','getFields','findOne','ZendeskField','pick','getSubjects','order','hasOwnProperty','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x47c265,_0x42fab5){var _0x3c372a=function(_0x2ac03c){while(--_0x2ac03c){_0x47c265['push'](_0x47c265['shift']());}};_0x3c372a(++_0x42fab5);}(_0xd6c3,0xa2));var _0x3d6c=function(_0x214890,_0x2562c0){_0x214890=_0x214890-0x0;var _0x760050=_0xd6c3[_0x214890];return _0x760050;};'use strict';var emlformat=require(_0x3d6c('0x0'));var rimraf=require(_0x3d6c('0x1'));var zipdir=require(_0x3d6c('0x2'));var jsonpatch=require(_0x3d6c('0x3'));var rp=require(_0x3d6c('0x4'));var moment=require(_0x3d6c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d6c('0x6'));var util=require(_0x3d6c('0x7'));var path=require(_0x3d6c('0x8'));var sox=require('sox');var csv=require(_0x3d6c('0x9'));var ejs=require(_0x3d6c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d6c('0xb'));var squel=require(_0x3d6c('0xc'));var crypto=require(_0x3d6c('0xd'));var jsforce=require(_0x3d6c('0xe'));var deskjs=require(_0x3d6c('0xf'));var toCsv=require(_0x3d6c('0x9'));var querystring=require(_0x3d6c('0x10'));var Papa=require(_0x3d6c('0x11'));var Redis=require('ioredis');var authService=require(_0x3d6c('0x12'));var qs=require(_0x3d6c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d6c('0x14'));var logger=require('../../config/logger')(_0x3d6c('0x15'));var utils=require(_0x3d6c('0x16'));var config=require(_0x3d6c('0x17'));var licenseUtil=require(_0x3d6c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43ebf7,_0x4c26ef){_0x4c26ef=_0x4c26ef||0xcc;return function(_0x5962dd){if(_0x5962dd){return _0x43ebf7[_0x3d6c('0x19')](_0x4c26ef);}return _0x43ebf7['status'](_0x4c26ef)[_0x3d6c('0x1a')]();};}function respondWithResult(_0x368224,_0x5d2452){_0x5d2452=_0x5d2452||0xc8;return function(_0x41c1c1){if(_0x41c1c1){return _0x368224['status'](_0x5d2452)[_0x3d6c('0x1b')](_0x41c1c1);}};}function respondWithFilteredResult(_0x23d223,_0x269a48){return function(_0x1c2907){if(_0x1c2907){var _0x4ebfa2=typeof _0x269a48[_0x3d6c('0x1c')]===_0x3d6c('0x1d')&&typeof _0x269a48['limit']===_0x3d6c('0x1d');var _0xd0b851=_0x1c2907['count'];var _0x22010e=_0x4ebfa2?0x0:_0x269a48[_0x3d6c('0x1c')];var _0x37fd71=_0x4ebfa2?_0x1c2907[_0x3d6c('0x1e')]:_0x269a48['offset']+_0x269a48[_0x3d6c('0x1f')];var _0x948224;if(_0x37fd71>=_0xd0b851){_0x37fd71=_0xd0b851;_0x948224=0xc8;}else{_0x948224=0xce;}_0x23d223[_0x3d6c('0x20')](_0x948224);return _0x23d223[_0x3d6c('0x21')](_0x3d6c('0x22'),_0x22010e+'-'+_0x37fd71+'/'+_0xd0b851)[_0x3d6c('0x1b')](_0x1c2907);}return null;};}function patchUpdates(_0x1a0eb4){return function(_0x1abd86){try{jsonpatch[_0x3d6c('0x23')](_0x1abd86,_0x1a0eb4,!![]);}catch(_0x33b5a2){return BPromise[_0x3d6c('0x24')](_0x33b5a2);}return _0x1abd86[_0x3d6c('0x25')]();};}function saveUpdates(_0x4ba6e6,_0x474404){return function(_0x339f1f){if(_0x339f1f){return _0x339f1f[_0x3d6c('0x26')](_0x4ba6e6)[_0x3d6c('0x27')](function(_0x248286){return _0x248286;});}return null;};}function removeEntity(_0x569b17,_0x4c00c1){return function(_0x4de0ae){if(_0x4de0ae){return _0x4de0ae[_0x3d6c('0x28')]()[_0x3d6c('0x27')](function(){_0x569b17['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x120fc4,_0x26e8b7){return function(_0x50c678){if(!_0x50c678){_0x120fc4[_0x3d6c('0x19')](0x194);}return _0x50c678;};}function handleError(_0x48f764,_0x19ee2b){_0x19ee2b=_0x19ee2b||0x1f4;return function(_0x127455){logger[_0x3d6c('0x29')](_0x127455[_0x3d6c('0x2a')]);if(_0x127455[_0x3d6c('0x2b')]){delete _0x127455[_0x3d6c('0x2b')];}_0x48f764[_0x3d6c('0x20')](_0x19ee2b)[_0x3d6c('0x2c')](_0x127455);};}exports[_0x3d6c('0x2d')]=function(_0x3ba9ca,_0x3c950f){var _0x454cb2={},_0x39704e={},_0x27bff4={'count':0x0,'rows':[]};var _0x3313e8=_[_0x3d6c('0x2e')](db['ZendeskConfiguration'][_0x3d6c('0x2f')],function(_0xb6a54a){return{'name':_0xb6a54a['fieldName'],'type':_0xb6a54a[_0x3d6c('0x30')][_0x3d6c('0x31')]};});_0x39704e[_0x3d6c('0x32')]=_[_0x3d6c('0x2e')](_0x3313e8,_0x3d6c('0x2b'));_0x39704e[_0x3d6c('0x33')]=_[_0x3d6c('0x34')](_0x3ba9ca[_0x3d6c('0x33')]);_0x39704e[_0x3d6c('0x35')]=_[_0x3d6c('0x36')](_0x39704e[_0x3d6c('0x32')],_0x39704e[_0x3d6c('0x33')]);_0x454cb2[_0x3d6c('0x37')]=_[_0x3d6c('0x36')](_0x39704e[_0x3d6c('0x32')],qs['fields'](_0x3ba9ca[_0x3d6c('0x33')]['fields']));_0x454cb2[_0x3d6c('0x37')]=_0x454cb2['attributes'][_0x3d6c('0x38')]?_0x454cb2[_0x3d6c('0x37')]:_0x39704e[_0x3d6c('0x32')];if(!_0x3ba9ca[_0x3d6c('0x33')]['hasOwnProperty'](_0x3d6c('0x39'))){_0x454cb2['limit']=qs['limit'](_0x3ba9ca[_0x3d6c('0x33')][_0x3d6c('0x1f')]);_0x454cb2[_0x3d6c('0x1c')]=qs[_0x3d6c('0x1c')](_0x3ba9ca['query']['offset']);}_0x454cb2['order']=qs[_0x3d6c('0x3a')](_0x3ba9ca['query'][_0x3d6c('0x3a')]);_0x454cb2[_0x3d6c('0x3b')]=qs[_0x3d6c('0x35')](_['pick'](_0x3ba9ca['query'],_0x39704e[_0x3d6c('0x35')]),_0x3313e8);if(_0x3ba9ca[_0x3d6c('0x33')][_0x3d6c('0x3c')]){_0x454cb2[_0x3d6c('0x3b')]=_[_0x3d6c('0x3d')](_0x454cb2[_0x3d6c('0x3b')],{'$or':_['map'](_0x3313e8,function(_0x33b750){if(_0x33b750[_0x3d6c('0x30')]!==_0x3d6c('0x3e')){var _0x48aaca={};_0x48aaca[_0x33b750[_0x3d6c('0x2b')]]={'$like':'%'+_0x3ba9ca['query'][_0x3d6c('0x3c')]+'%'};return _0x48aaca;}})});}_0x454cb2=_[_0x3d6c('0x3d')]({},_0x454cb2,_0x3ba9ca[_0x3d6c('0x3f')]);var _0x3884a6={'where':_0x454cb2['where']};return db[_0x3d6c('0x40')][_0x3d6c('0x1e')](_0x3884a6)[_0x3d6c('0x27')](function(_0xbe26ae){_0x27bff4[_0x3d6c('0x1e')]=_0xbe26ae;if(_0x3ba9ca[_0x3d6c('0x33')][_0x3d6c('0x41')]){_0x454cb2[_0x3d6c('0x42')]=[{'all':!![]}];}return db[_0x3d6c('0x40')]['findAll'](_0x454cb2);})[_0x3d6c('0x27')](function(_0x35331c){_0x27bff4[_0x3d6c('0x43')]=_0x35331c;return _0x27bff4;})[_0x3d6c('0x27')](respondWithFilteredResult(_0x3c950f,_0x454cb2))[_0x3d6c('0x44')](handleError(_0x3c950f,null));};exports[_0x3d6c('0x45')]=function(_0x497800,_0x11f870){var _0x4ced48={'raw':![],'where':{'id':_0x497800['params']['id']}},_0x15ccdc={};_0x15ccdc[_0x3d6c('0x32')]=_['keys'](db[_0x3d6c('0x40')][_0x3d6c('0x2f')]);_0x15ccdc[_0x3d6c('0x33')]=_[_0x3d6c('0x34')](_0x497800['query']);_0x15ccdc['filters']=_[_0x3d6c('0x36')](_0x15ccdc[_0x3d6c('0x32')],_0x15ccdc['query']);_0x4ced48['attributes']=_[_0x3d6c('0x36')](_0x15ccdc['model'],qs[_0x3d6c('0x46')](_0x497800[_0x3d6c('0x33')][_0x3d6c('0x46')]));_0x4ced48['attributes']=_0x4ced48[_0x3d6c('0x37')]['length']?_0x4ced48[_0x3d6c('0x37')]:_0x15ccdc[_0x3d6c('0x32')];if(_0x497800['query'][_0x3d6c('0x41')]){_0x4ced48[_0x3d6c('0x42')]=[{'all':!![]}];}_0x4ced48=_[_0x3d6c('0x3d')]({},_0x4ced48,_0x497800['options']);return db['ZendeskConfiguration'][_0x3d6c('0x47')](_0x4ced48)[_0x3d6c('0x27')](handleEntityNotFound(_0x11f870,null))[_0x3d6c('0x27')](respondWithResult(_0x11f870,null))[_0x3d6c('0x44')](handleError(_0x11f870,null));};exports[_0x3d6c('0x48')]=function(_0x479afc,_0x3536a9){return db[_0x3d6c('0x40')][_0x3d6c('0x48')](_0x479afc[_0x3d6c('0x49')],{})[_0x3d6c('0x27')](respondWithResult(_0x3536a9,0xc9))['catch'](handleError(_0x3536a9,null));};exports[_0x3d6c('0x26')]=function(_0x4146af,_0x3ee273){if(_0x4146af[_0x3d6c('0x49')]['id']){delete _0x4146af[_0x3d6c('0x49')]['id'];}return db[_0x3d6c('0x40')][_0x3d6c('0x47')]({'where':{'id':_0x4146af[_0x3d6c('0x4a')]['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x3ee273,null))[_0x3d6c('0x27')](saveUpdates(_0x4146af[_0x3d6c('0x49')],null))[_0x3d6c('0x27')](respondWithResult(_0x3ee273,null))[_0x3d6c('0x44')](handleError(_0x3ee273,null));};exports[_0x3d6c('0x28')]=function(_0x45aec1,_0x2dd8d7){return db[_0x3d6c('0x40')][_0x3d6c('0x47')]({'where':{'id':_0x45aec1[_0x3d6c('0x4a')]['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x2dd8d7,null))[_0x3d6c('0x27')](removeEntity(_0x2dd8d7,null))['catch'](handleError(_0x2dd8d7,null));};exports[_0x3d6c('0x4b')]=function(_0x3a759e,_0x1879b2,_0x54a93f){var _0x557f85={};var _0x2bf12d={};var _0x1b7d1d;var _0x4124a5;return db[_0x3d6c('0x40')][_0x3d6c('0x4c')]({'where':{'id':_0x3a759e['params']['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x1879b2,null))[_0x3d6c('0x27')](function(_0x1a0215){if(_0x1a0215){_0x1b7d1d=_0x1a0215;_0x2bf12d[_0x3d6c('0x32')]=_['keys'](db[_0x3d6c('0x4d')][_0x3d6c('0x2f')]);_0x2bf12d[_0x3d6c('0x33')]=_[_0x3d6c('0x34')](_0x3a759e['query']);_0x2bf12d[_0x3d6c('0x35')]=_[_0x3d6c('0x36')](_0x2bf12d[_0x3d6c('0x32')],_0x2bf12d[_0x3d6c('0x33')]);_0x557f85[_0x3d6c('0x37')]=_[_0x3d6c('0x36')](_0x2bf12d[_0x3d6c('0x32')],qs['fields'](_0x3a759e['query'][_0x3d6c('0x46')]));_0x557f85[_0x3d6c('0x37')]=_0x557f85[_0x3d6c('0x37')][_0x3d6c('0x38')]?_0x557f85['attributes']:_0x2bf12d['model'];_0x557f85['order']=qs[_0x3d6c('0x3a')](_0x3a759e[_0x3d6c('0x33')][_0x3d6c('0x3a')]);_0x557f85[_0x3d6c('0x3b')]=qs[_0x3d6c('0x35')](_[_0x3d6c('0x4e')](_0x3a759e[_0x3d6c('0x33')],_0x2bf12d[_0x3d6c('0x35')]));if(_0x3a759e[_0x3d6c('0x33')]['filter']){_0x557f85['where']=_['merge'](_0x557f85[_0x3d6c('0x3b')],{'$or':_[_0x3d6c('0x2e')](_0x557f85[_0x3d6c('0x37')],function(_0x401a9b){var _0x389163={};_0x389163[_0x401a9b]={'$like':'%'+_0x3a759e[_0x3d6c('0x33')]['filter']+'%'};return _0x389163;})});}_0x557f85=_[_0x3d6c('0x3d')]({},_0x557f85,_0x3a759e['options']);return _0x1b7d1d[_0x3d6c('0x4b')](_0x557f85);}})['then'](function(_0x495e5e){if(_0x495e5e){_0x4124a5=_0x495e5e['length'];if(!_0x3a759e[_0x3d6c('0x33')]['hasOwnProperty'](_0x3d6c('0x39'))){_0x557f85[_0x3d6c('0x1f')]=qs[_0x3d6c('0x1f')](_0x3a759e[_0x3d6c('0x33')][_0x3d6c('0x1f')]);_0x557f85[_0x3d6c('0x1c')]=qs['offset'](_0x3a759e['query'][_0x3d6c('0x1c')]);}return _0x1b7d1d['getFields'](_0x557f85);}})[_0x3d6c('0x27')](function(_0x52f5e3){if(_0x52f5e3){return _0x52f5e3?{'count':_0x4124a5,'rows':_0x52f5e3}:null;}})['then'](respondWithResult(_0x1879b2,null))['catch'](handleError(_0x1879b2,null));};exports[_0x3d6c('0x4f')]=function(_0x2a0e03,_0x3d9a38,_0x4e863e){var _0x468d0a={};var _0x25da49={};var _0x44fdae;var _0x450ec8;return db[_0x3d6c('0x40')][_0x3d6c('0x4c')]({'where':{'id':_0x2a0e03[_0x3d6c('0x4a')]['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x3d9a38,null))[_0x3d6c('0x27')](function(_0x2c53ee){if(_0x2c53ee){_0x44fdae=_0x2c53ee;_0x25da49[_0x3d6c('0x32')]=_[_0x3d6c('0x34')](db[_0x3d6c('0x4d')][_0x3d6c('0x2f')]);_0x25da49['query']=_[_0x3d6c('0x34')](_0x2a0e03['query']);_0x25da49[_0x3d6c('0x35')]=_[_0x3d6c('0x36')](_0x25da49[_0x3d6c('0x32')],_0x25da49[_0x3d6c('0x33')]);_0x468d0a['attributes']=_[_0x3d6c('0x36')](_0x25da49['model'],qs[_0x3d6c('0x46')](_0x2a0e03[_0x3d6c('0x33')][_0x3d6c('0x46')]));_0x468d0a[_0x3d6c('0x37')]=_0x468d0a[_0x3d6c('0x37')][_0x3d6c('0x38')]?_0x468d0a[_0x3d6c('0x37')]:_0x25da49[_0x3d6c('0x32')];_0x468d0a[_0x3d6c('0x50')]=qs[_0x3d6c('0x3a')](_0x2a0e03[_0x3d6c('0x33')][_0x3d6c('0x3a')]);_0x468d0a[_0x3d6c('0x3b')]=qs[_0x3d6c('0x35')](_['pick'](_0x2a0e03['query'],_0x25da49[_0x3d6c('0x35')]));if(_0x2a0e03[_0x3d6c('0x33')][_0x3d6c('0x3c')]){_0x468d0a['where']=_[_0x3d6c('0x3d')](_0x468d0a[_0x3d6c('0x3b')],{'$or':_['map'](_0x468d0a[_0x3d6c('0x37')],function(_0x264430){var _0x577014={};_0x577014[_0x264430]={'$like':'%'+_0x2a0e03[_0x3d6c('0x33')][_0x3d6c('0x3c')]+'%'};return _0x577014;})});}_0x468d0a=_[_0x3d6c('0x3d')]({},_0x468d0a,_0x2a0e03[_0x3d6c('0x3f')]);return _0x44fdae['getSubjects'](_0x468d0a);}})[_0x3d6c('0x27')](function(_0xf2b645){if(_0xf2b645){_0x450ec8=_0xf2b645[_0x3d6c('0x38')];if(!_0x2a0e03[_0x3d6c('0x33')][_0x3d6c('0x51')](_0x3d6c('0x39'))){_0x468d0a[_0x3d6c('0x1f')]=qs['limit'](_0x2a0e03[_0x3d6c('0x33')]['limit']);_0x468d0a['offset']=qs[_0x3d6c('0x1c')](_0x2a0e03['query'][_0x3d6c('0x1c')]);}return _0x44fdae[_0x3d6c('0x4f')](_0x468d0a);}})[_0x3d6c('0x27')](function(_0x55fde9){if(_0x55fde9){return _0x55fde9?{'count':_0x450ec8,'rows':_0x55fde9}:null;}})['then'](respondWithResult(_0x3d9a38,null))[_0x3d6c('0x44')](handleError(_0x3d9a38,null));};exports['getDescriptions']=function(_0x14f9eb,_0x20d07f,_0x5cf560){var _0xc1e16c={};var _0xf8f99b={};var _0x3fa823;var _0x29d712;return db[_0x3d6c('0x40')][_0x3d6c('0x4c')]({'where':{'id':_0x14f9eb['params']['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x20d07f,null))[_0x3d6c('0x27')](function(_0x3a29e6){if(_0x3a29e6){_0x3fa823=_0x3a29e6;_0xf8f99b[_0x3d6c('0x32')]=_[_0x3d6c('0x34')](db[_0x3d6c('0x4d')][_0x3d6c('0x2f')]);_0xf8f99b[_0x3d6c('0x33')]=_[_0x3d6c('0x34')](_0x14f9eb[_0x3d6c('0x33')]);_0xf8f99b[_0x3d6c('0x35')]=_[_0x3d6c('0x36')](_0xf8f99b[_0x3d6c('0x32')],_0xf8f99b[_0x3d6c('0x33')]);_0xc1e16c[_0x3d6c('0x37')]=_['intersection'](_0xf8f99b['model'],qs['fields'](_0x14f9eb[_0x3d6c('0x33')][_0x3d6c('0x46')]));_0xc1e16c[_0x3d6c('0x37')]=_0xc1e16c['attributes'][_0x3d6c('0x38')]?_0xc1e16c[_0x3d6c('0x37')]:_0xf8f99b[_0x3d6c('0x32')];_0xc1e16c[_0x3d6c('0x50')]=qs[_0x3d6c('0x3a')](_0x14f9eb['query'][_0x3d6c('0x3a')]);_0xc1e16c['where']=qs[_0x3d6c('0x35')](_['pick'](_0x14f9eb[_0x3d6c('0x33')],_0xf8f99b['filters']));if(_0x14f9eb['query'][_0x3d6c('0x3c')]){_0xc1e16c['where']=_['merge'](_0xc1e16c[_0x3d6c('0x3b')],{'$or':_[_0x3d6c('0x2e')](_0xc1e16c[_0x3d6c('0x37')],function(_0x3e6c27){var _0x2a5a28={};_0x2a5a28[_0x3e6c27]={'$like':'%'+_0x14f9eb[_0x3d6c('0x33')][_0x3d6c('0x3c')]+'%'};return _0x2a5a28;})});}_0xc1e16c=_[_0x3d6c('0x3d')]({},_0xc1e16c,_0x14f9eb[_0x3d6c('0x3f')]);return _0x3fa823[_0x3d6c('0x52')](_0xc1e16c);}})[_0x3d6c('0x27')](function(_0x179611){if(_0x179611){_0x29d712=_0x179611['length'];if(!_0x14f9eb[_0x3d6c('0x33')]['hasOwnProperty'](_0x3d6c('0x39'))){_0xc1e16c[_0x3d6c('0x1f')]=qs[_0x3d6c('0x1f')](_0x14f9eb[_0x3d6c('0x33')][_0x3d6c('0x1f')]);_0xc1e16c['offset']=qs[_0x3d6c('0x1c')](_0x14f9eb['query']['offset']);}return _0x3fa823['getDescriptions'](_0xc1e16c);}})[_0x3d6c('0x27')](function(_0x334a80){if(_0x334a80){return _0x334a80?{'count':_0x29d712,'rows':_0x334a80}:null;}})['then'](respondWithResult(_0x20d07f,null))[_0x3d6c('0x44')](handleError(_0x20d07f,null));};exports[_0x3d6c('0x53')]=function(_0xe38e17,_0x3a827d,_0x435581){var _0x36bd02={};var _0x51797d={};var _0x3dba66;var _0x36ec62;return db[_0x3d6c('0x40')][_0x3d6c('0x4c')]({'where':{'id':_0xe38e17[_0x3d6c('0x4a')]['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x3a827d,null))[_0x3d6c('0x27')](function(_0x3bf5b8){if(_0x3bf5b8){_0x3dba66=_0x3bf5b8;_0x51797d['model']=_[_0x3d6c('0x34')](db[_0x3d6c('0x54')][_0x3d6c('0x2f')]);_0x51797d[_0x3d6c('0x33')]=_[_0x3d6c('0x34')](_0xe38e17[_0x3d6c('0x33')]);_0x51797d[_0x3d6c('0x35')]=_[_0x3d6c('0x36')](_0x51797d[_0x3d6c('0x32')],_0x51797d[_0x3d6c('0x33')]);_0x36bd02[_0x3d6c('0x37')]=_[_0x3d6c('0x36')](_0x51797d[_0x3d6c('0x32')],qs['fields'](_0xe38e17[_0x3d6c('0x33')][_0x3d6c('0x46')]));_0x36bd02['attributes']=_0x36bd02['attributes'][_0x3d6c('0x38')]?_0x36bd02[_0x3d6c('0x37')]:_0x51797d['model'];_0x36bd02['order']=qs[_0x3d6c('0x3a')](_0xe38e17['query'][_0x3d6c('0x3a')]);_0x36bd02[_0x3d6c('0x3b')]=qs[_0x3d6c('0x35')](_['pick'](_0xe38e17[_0x3d6c('0x33')],_0x51797d['filters']));if(_0xe38e17[_0x3d6c('0x33')][_0x3d6c('0x3c')]){_0x36bd02[_0x3d6c('0x3b')]=_[_0x3d6c('0x3d')](_0x36bd02[_0x3d6c('0x3b')],{'$or':_[_0x3d6c('0x2e')](_0x36bd02['attributes'],function(_0x5e50d8){var _0x38b313={};_0x38b313[_0x5e50d8]={'$like':'%'+_0xe38e17[_0x3d6c('0x33')]['filter']+'%'};return _0x38b313;})});}_0x36bd02=_[_0x3d6c('0x3d')]({},_0x36bd02,_0xe38e17[_0x3d6c('0x3f')]);return _0x3dba66[_0x3d6c('0x53')](_0x36bd02);}})[_0x3d6c('0x27')](function(_0x3592df){if(_0x3592df){_0x36ec62=_0x3592df[_0x3d6c('0x38')];if(!_0xe38e17['query'][_0x3d6c('0x51')](_0x3d6c('0x39'))){_0x36bd02[_0x3d6c('0x1f')]=qs[_0x3d6c('0x1f')](_0xe38e17[_0x3d6c('0x33')][_0x3d6c('0x1f')]);_0x36bd02[_0x3d6c('0x1c')]=qs['offset'](_0xe38e17[_0x3d6c('0x33')][_0x3d6c('0x1c')]);}return _0x3dba66[_0x3d6c('0x53')](_0x36bd02);}})[_0x3d6c('0x27')](function(_0x101339){if(_0x101339){return _0x101339?{'count':_0x36ec62,'rows':_0x101339}:null;}})[_0x3d6c('0x27')](respondWithResult(_0x3a827d,null))[_0x3d6c('0x44')](handleError(_0x3a827d,null));};exports['setTags']=function(_0x222ce0,_0x3a8750,_0x50acfd){if(_0x222ce0[_0x3d6c('0x49')]['id']){delete _0x222ce0['body']['id'];}return db['ZendeskConfiguration'][_0x3d6c('0x4c')]({'where':{'id':_0x222ce0[_0x3d6c('0x4a')]['id']}})[_0x3d6c('0x27')](handleEntityNotFound(_0x3a8750,null))[_0x3d6c('0x27')](function(_0x216ef8){if(_0x216ef8){return _0x216ef8['setTags'](_0x222ce0[_0x3d6c('0x49')][_0x3d6c('0x55')]||[]);}return null;})['then'](respondWithResult(_0x3a8750,null))[_0x3d6c('0x44')](handleError(_0x3a8750,null));}; \ No newline at end of file +var _0x77e3=['error','stack','send','index','map','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','ZendeskConfiguration','includeAll','findAll','rows','catch','keys','fields','include','find','create','body','params','findOne','options','getFields','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','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/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','destroy','then'];(function(_0x1bab81,_0x2f2730){var _0x2a6032=function(_0x492244){while(--_0x492244){_0x1bab81['push'](_0x1bab81['shift']());}};_0x2a6032(++_0x2f2730);}(_0x77e3,0xcf));var _0x377e=function(_0x14e7cd,_0xdf9c3d){_0x14e7cd=_0x14e7cd-0x0;var _0x15d587=_0x77e3[_0x14e7cd];return _0x15d587;};'use strict';var emlformat=require(_0x377e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x377e('0x1'));var jsonpatch=require(_0x377e('0x2'));var rp=require(_0x377e('0x3'));var moment=require(_0x377e('0x4'));var BPromise=require(_0x377e('0x5'));var Mustache=require(_0x377e('0x6'));var util=require(_0x377e('0x7'));var path=require(_0x377e('0x8'));var sox=require(_0x377e('0x9'));var csv=require(_0x377e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x377e('0xb'));var _=require(_0x377e('0xc'));var squel=require(_0x377e('0xd'));var crypto=require(_0x377e('0xe'));var jsforce=require(_0x377e('0xf'));var deskjs=require(_0x377e('0x10'));var toCsv=require(_0x377e('0xa'));var querystring=require('querystring');var Papa=require(_0x377e('0x11'));var Redis=require(_0x377e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x377e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x377e('0x14'));var config=require(_0x377e('0x15'));var licenseUtil=require(_0x377e('0x16'));var db=require(_0x377e('0x17'))['db'];function respondWithStatusCode(_0x2aea12,_0x1d510c){_0x1d510c=_0x1d510c||0xcc;return function(_0x51f602){if(_0x51f602){return _0x2aea12[_0x377e('0x18')](_0x1d510c);}return _0x2aea12[_0x377e('0x19')](_0x1d510c)[_0x377e('0x1a')]();};}function respondWithResult(_0x104599,_0x54d2ab){_0x54d2ab=_0x54d2ab||0xc8;return function(_0x1ca133){if(_0x1ca133){return _0x104599[_0x377e('0x19')](_0x54d2ab)[_0x377e('0x1b')](_0x1ca133);}};}function respondWithFilteredResult(_0x1f764b,_0x379ccb){return function(_0x289d9f){if(_0x289d9f){var _0x598ea7=typeof _0x379ccb[_0x377e('0x1c')]===_0x377e('0x1d')&&typeof _0x379ccb[_0x377e('0x1e')]==='undefined';var _0x3bb67b=_0x289d9f[_0x377e('0x1f')];var _0x53ea4f=_0x598ea7?0x0:_0x379ccb[_0x377e('0x1c')];var _0x22bf70=_0x598ea7?_0x289d9f[_0x377e('0x1f')]:_0x379ccb[_0x377e('0x1c')]+_0x379ccb[_0x377e('0x1e')];var _0x7c34ec;if(_0x22bf70>=_0x3bb67b){_0x22bf70=_0x3bb67b;_0x7c34ec=0xc8;}else{_0x7c34ec=0xce;}_0x1f764b[_0x377e('0x19')](_0x7c34ec);return _0x1f764b['set']('Content-Range',_0x53ea4f+'-'+_0x22bf70+'/'+_0x3bb67b)[_0x377e('0x1b')](_0x289d9f);}return null;};}function patchUpdates(_0x1c498b){return function(_0x58cca8){try{jsonpatch['apply'](_0x58cca8,_0x1c498b,!![]);}catch(_0xa60399){return BPromise[_0x377e('0x20')](_0xa60399);}return _0x58cca8['save']();};}function saveUpdates(_0x4f0c8e,_0x3b3ba7){return function(_0xfee885){if(_0xfee885){return _0xfee885[_0x377e('0x21')](_0x4f0c8e)['then'](function(_0x1d0199){return _0x1d0199;});}return null;};}function removeEntity(_0x2e45de,_0x3f158c){return function(_0x3f607e){if(_0x3f607e){return _0x3f607e[_0x377e('0x22')]()[_0x377e('0x23')](function(){_0x2e45de['status'](0xcc)[_0x377e('0x1a')]();});}};}function handleEntityNotFound(_0x3f7e34,_0x1a8d41){return function(_0x27763f){if(!_0x27763f){_0x3f7e34[_0x377e('0x18')](0x194);}return _0x27763f;};}function handleError(_0x4f1487,_0x116158){_0x116158=_0x116158||0x1f4;return function(_0x106834){logger[_0x377e('0x24')](_0x106834[_0x377e('0x25')]);if(_0x106834['name']){delete _0x106834['name'];}_0x4f1487['status'](_0x116158)[_0x377e('0x26')](_0x106834);};}exports[_0x377e('0x27')]=function(_0x5c3326,_0x3c96dd){var _0x58375d={},_0x23dd12={},_0x435f96={'count':0x0,'rows':[]};var _0x1517ce=_[_0x377e('0x28')](db['ZendeskConfiguration'][_0x377e('0x29')],function(_0x465b36){return{'name':_0x465b36[_0x377e('0x2a')],'type':_0x465b36['type']['key']};});_0x23dd12[_0x377e('0x2b')]=_[_0x377e('0x28')](_0x1517ce,_0x377e('0x2c'));_0x23dd12[_0x377e('0x2d')]=_['keys'](_0x5c3326[_0x377e('0x2d')]);_0x23dd12[_0x377e('0x2e')]=_[_0x377e('0x2f')](_0x23dd12['model'],_0x23dd12[_0x377e('0x2d')]);_0x58375d[_0x377e('0x30')]=_[_0x377e('0x2f')](_0x23dd12[_0x377e('0x2b')],qs['fields'](_0x5c3326[_0x377e('0x2d')]['fields']));_0x58375d[_0x377e('0x30')]=_0x58375d[_0x377e('0x30')][_0x377e('0x31')]?_0x58375d[_0x377e('0x30')]:_0x23dd12[_0x377e('0x2b')];if(!_0x5c3326[_0x377e('0x2d')][_0x377e('0x32')](_0x377e('0x33'))){_0x58375d[_0x377e('0x1e')]=qs[_0x377e('0x1e')](_0x5c3326[_0x377e('0x2d')][_0x377e('0x1e')]);_0x58375d['offset']=qs[_0x377e('0x1c')](_0x5c3326[_0x377e('0x2d')][_0x377e('0x1c')]);}_0x58375d[_0x377e('0x34')]=qs[_0x377e('0x35')](_0x5c3326[_0x377e('0x2d')][_0x377e('0x35')]);_0x58375d[_0x377e('0x36')]=qs[_0x377e('0x2e')](_[_0x377e('0x37')](_0x5c3326[_0x377e('0x2d')],_0x23dd12[_0x377e('0x2e')]),_0x1517ce);if(_0x5c3326[_0x377e('0x2d')][_0x377e('0x38')]){_0x58375d[_0x377e('0x36')]=_[_0x377e('0x39')](_0x58375d[_0x377e('0x36')],{'$or':_[_0x377e('0x28')](_0x1517ce,function(_0xae0d3e){if(_0xae0d3e[_0x377e('0x3a')]!==_0x377e('0x3b')){var _0xf528ac={};_0xf528ac[_0xae0d3e[_0x377e('0x2c')]]={'$like':'%'+_0x5c3326['query'][_0x377e('0x38')]+'%'};return _0xf528ac;}})});}_0x58375d=_[_0x377e('0x39')]({},_0x58375d,_0x5c3326['options']);var _0x2dd7d5={'where':_0x58375d[_0x377e('0x36')]};return db[_0x377e('0x3c')][_0x377e('0x1f')](_0x2dd7d5)[_0x377e('0x23')](function(_0x3cb54f){_0x435f96[_0x377e('0x1f')]=_0x3cb54f;if(_0x5c3326['query'][_0x377e('0x3d')]){_0x58375d['include']=[{'all':!![]}];}return db[_0x377e('0x3c')][_0x377e('0x3e')](_0x58375d);})['then'](function(_0x249498){_0x435f96[_0x377e('0x3f')]=_0x249498;return _0x435f96;})[_0x377e('0x23')](respondWithFilteredResult(_0x3c96dd,_0x58375d))[_0x377e('0x40')](handleError(_0x3c96dd,null));};exports['show']=function(_0x325706,_0x38082c){var _0x1a3986={'raw':![],'where':{'id':_0x325706['params']['id']}},_0x3ccd91={};_0x3ccd91[_0x377e('0x2b')]=_[_0x377e('0x41')](db[_0x377e('0x3c')][_0x377e('0x29')]);_0x3ccd91[_0x377e('0x2d')]=_['keys'](_0x325706['query']);_0x3ccd91[_0x377e('0x2e')]=_[_0x377e('0x2f')](_0x3ccd91['model'],_0x3ccd91[_0x377e('0x2d')]);_0x1a3986[_0x377e('0x30')]=_[_0x377e('0x2f')](_0x3ccd91[_0x377e('0x2b')],qs[_0x377e('0x42')](_0x325706[_0x377e('0x2d')]['fields']));_0x1a3986['attributes']=_0x1a3986[_0x377e('0x30')][_0x377e('0x31')]?_0x1a3986[_0x377e('0x30')]:_0x3ccd91[_0x377e('0x2b')];if(_0x325706[_0x377e('0x2d')][_0x377e('0x3d')]){_0x1a3986[_0x377e('0x43')]=[{'all':!![]}];}_0x1a3986=_[_0x377e('0x39')]({},_0x1a3986,_0x325706['options']);return db[_0x377e('0x3c')][_0x377e('0x44')](_0x1a3986)[_0x377e('0x23')](handleEntityNotFound(_0x38082c,null))[_0x377e('0x23')](respondWithResult(_0x38082c,null))[_0x377e('0x40')](handleError(_0x38082c,null));};exports[_0x377e('0x45')]=function(_0x578b28,_0x576134){return db['ZendeskConfiguration'][_0x377e('0x45')](_0x578b28[_0x377e('0x46')],{})[_0x377e('0x23')](respondWithResult(_0x576134,0xc9))[_0x377e('0x40')](handleError(_0x576134,null));};exports[_0x377e('0x21')]=function(_0x3a056e,_0x405c48){if(_0x3a056e[_0x377e('0x46')]['id']){delete _0x3a056e['body']['id'];}return db[_0x377e('0x3c')]['find']({'where':{'id':_0x3a056e[_0x377e('0x47')]['id']}})[_0x377e('0x23')](handleEntityNotFound(_0x405c48,null))['then'](saveUpdates(_0x3a056e[_0x377e('0x46')],null))[_0x377e('0x23')](respondWithResult(_0x405c48,null))[_0x377e('0x40')](handleError(_0x405c48,null));};exports[_0x377e('0x22')]=function(_0x60259d,_0x31154f){return db[_0x377e('0x3c')][_0x377e('0x44')]({'where':{'id':_0x60259d[_0x377e('0x47')]['id']}})[_0x377e('0x23')](handleEntityNotFound(_0x31154f,null))[_0x377e('0x23')](removeEntity(_0x31154f,null))[_0x377e('0x40')](handleError(_0x31154f,null));};exports['getFields']=function(_0x37195e,_0xcde2a0,_0x1c4e23){var _0x5b5f86={};var _0x585bdf={};var _0x3b8d02;var _0x44c5b9;return db['ZendeskConfiguration'][_0x377e('0x48')]({'where':{'id':_0x37195e[_0x377e('0x47')]['id']}})['then'](handleEntityNotFound(_0xcde2a0,null))['then'](function(_0x38e3f2){if(_0x38e3f2){_0x3b8d02=_0x38e3f2;_0x585bdf[_0x377e('0x2b')]=_[_0x377e('0x41')](db['ZendeskField'][_0x377e('0x29')]);_0x585bdf[_0x377e('0x2d')]=_['keys'](_0x37195e[_0x377e('0x2d')]);_0x585bdf[_0x377e('0x2e')]=_[_0x377e('0x2f')](_0x585bdf[_0x377e('0x2b')],_0x585bdf['query']);_0x5b5f86[_0x377e('0x30')]=_[_0x377e('0x2f')](_0x585bdf[_0x377e('0x2b')],qs[_0x377e('0x42')](_0x37195e[_0x377e('0x2d')][_0x377e('0x42')]));_0x5b5f86['attributes']=_0x5b5f86[_0x377e('0x30')]['length']?_0x5b5f86['attributes']:_0x585bdf[_0x377e('0x2b')];_0x5b5f86[_0x377e('0x34')]=qs['sort'](_0x37195e[_0x377e('0x2d')][_0x377e('0x35')]);_0x5b5f86['where']=qs[_0x377e('0x2e')](_[_0x377e('0x37')](_0x37195e['query'],_0x585bdf['filters']));if(_0x37195e[_0x377e('0x2d')][_0x377e('0x38')]){_0x5b5f86[_0x377e('0x36')]=_[_0x377e('0x39')](_0x5b5f86['where'],{'$or':_[_0x377e('0x28')](_0x5b5f86[_0x377e('0x30')],function(_0x11b3a8){var _0x34dd5d={};_0x34dd5d[_0x11b3a8]={'$like':'%'+_0x37195e[_0x377e('0x2d')][_0x377e('0x38')]+'%'};return _0x34dd5d;})});}_0x5b5f86=_[_0x377e('0x39')]({},_0x5b5f86,_0x37195e[_0x377e('0x49')]);return _0x3b8d02[_0x377e('0x4a')](_0x5b5f86);}})[_0x377e('0x23')](function(_0xa4db34){if(_0xa4db34){_0x44c5b9=_0xa4db34[_0x377e('0x31')];if(!_0x37195e[_0x377e('0x2d')]['hasOwnProperty'](_0x377e('0x33'))){_0x5b5f86[_0x377e('0x1e')]=qs[_0x377e('0x1e')](_0x37195e[_0x377e('0x2d')][_0x377e('0x1e')]);_0x5b5f86[_0x377e('0x1c')]=qs[_0x377e('0x1c')](_0x37195e[_0x377e('0x2d')][_0x377e('0x1c')]);}return _0x3b8d02['getFields'](_0x5b5f86);}})[_0x377e('0x23')](function(_0x49cf0d){if(_0x49cf0d){return _0x49cf0d?{'count':_0x44c5b9,'rows':_0x49cf0d}:null;}})['then'](respondWithResult(_0xcde2a0,null))['catch'](handleError(_0xcde2a0,null));};exports['getSubjects']=function(_0xedf338,_0x407dea,_0x1e5340){var _0x28accd={};var _0x3b28f9={};var _0x28ddbd;var _0x5800a2;return db[_0x377e('0x3c')][_0x377e('0x48')]({'where':{'id':_0xedf338[_0x377e('0x47')]['id']}})[_0x377e('0x23')](handleEntityNotFound(_0x407dea,null))[_0x377e('0x23')](function(_0x244cae){if(_0x244cae){_0x28ddbd=_0x244cae;_0x3b28f9[_0x377e('0x2b')]=_[_0x377e('0x41')](db[_0x377e('0x4b')][_0x377e('0x29')]);_0x3b28f9[_0x377e('0x2d')]=_['keys'](_0xedf338['query']);_0x3b28f9['filters']=_['intersection'](_0x3b28f9[_0x377e('0x2b')],_0x3b28f9[_0x377e('0x2d')]);_0x28accd['attributes']=_[_0x377e('0x2f')](_0x3b28f9[_0x377e('0x2b')],qs[_0x377e('0x42')](_0xedf338[_0x377e('0x2d')][_0x377e('0x42')]));_0x28accd[_0x377e('0x30')]=_0x28accd[_0x377e('0x30')][_0x377e('0x31')]?_0x28accd[_0x377e('0x30')]:_0x3b28f9[_0x377e('0x2b')];_0x28accd['order']=qs[_0x377e('0x35')](_0xedf338[_0x377e('0x2d')][_0x377e('0x35')]);_0x28accd[_0x377e('0x36')]=qs[_0x377e('0x2e')](_[_0x377e('0x37')](_0xedf338[_0x377e('0x2d')],_0x3b28f9[_0x377e('0x2e')]));if(_0xedf338[_0x377e('0x2d')]['filter']){_0x28accd['where']=_[_0x377e('0x39')](_0x28accd[_0x377e('0x36')],{'$or':_[_0x377e('0x28')](_0x28accd[_0x377e('0x30')],function(_0x113979){var _0x50ca40={};_0x50ca40[_0x113979]={'$like':'%'+_0xedf338['query'][_0x377e('0x38')]+'%'};return _0x50ca40;})});}_0x28accd=_['merge']({},_0x28accd,_0xedf338['options']);return _0x28ddbd['getSubjects'](_0x28accd);}})[_0x377e('0x23')](function(_0x28a4a8){if(_0x28a4a8){_0x5800a2=_0x28a4a8[_0x377e('0x31')];if(!_0xedf338['query']['hasOwnProperty'](_0x377e('0x33'))){_0x28accd[_0x377e('0x1e')]=qs['limit'](_0xedf338[_0x377e('0x2d')][_0x377e('0x1e')]);_0x28accd['offset']=qs[_0x377e('0x1c')](_0xedf338[_0x377e('0x2d')][_0x377e('0x1c')]);}return _0x28ddbd[_0x377e('0x4c')](_0x28accd);}})[_0x377e('0x23')](function(_0x4f72e6){if(_0x4f72e6){return _0x4f72e6?{'count':_0x5800a2,'rows':_0x4f72e6}:null;}})[_0x377e('0x23')](respondWithResult(_0x407dea,null))[_0x377e('0x40')](handleError(_0x407dea,null));};exports[_0x377e('0x4d')]=function(_0x126815,_0xe6a019,_0x58edfe){var _0x18e6e6={};var _0x2e47f5={};var _0x2f2bd5;var _0xcd88b9;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x126815[_0x377e('0x47')]['id']}})['then'](handleEntityNotFound(_0xe6a019,null))[_0x377e('0x23')](function(_0x56d8f2){if(_0x56d8f2){_0x2f2bd5=_0x56d8f2;_0x2e47f5[_0x377e('0x2b')]=_['keys'](db[_0x377e('0x4b')][_0x377e('0x29')]);_0x2e47f5['query']=_['keys'](_0x126815[_0x377e('0x2d')]);_0x2e47f5[_0x377e('0x2e')]=_[_0x377e('0x2f')](_0x2e47f5[_0x377e('0x2b')],_0x2e47f5[_0x377e('0x2d')]);_0x18e6e6[_0x377e('0x30')]=_[_0x377e('0x2f')](_0x2e47f5['model'],qs[_0x377e('0x42')](_0x126815[_0x377e('0x2d')][_0x377e('0x42')]));_0x18e6e6[_0x377e('0x30')]=_0x18e6e6['attributes'][_0x377e('0x31')]?_0x18e6e6[_0x377e('0x30')]:_0x2e47f5['model'];_0x18e6e6[_0x377e('0x34')]=qs['sort'](_0x126815[_0x377e('0x2d')][_0x377e('0x35')]);_0x18e6e6[_0x377e('0x36')]=qs[_0x377e('0x2e')](_[_0x377e('0x37')](_0x126815[_0x377e('0x2d')],_0x2e47f5[_0x377e('0x2e')]));if(_0x126815[_0x377e('0x2d')][_0x377e('0x38')]){_0x18e6e6['where']=_['merge'](_0x18e6e6[_0x377e('0x36')],{'$or':_[_0x377e('0x28')](_0x18e6e6[_0x377e('0x30')],function(_0x1118dc){var _0x2f5f58={};_0x2f5f58[_0x1118dc]={'$like':'%'+_0x126815[_0x377e('0x2d')]['filter']+'%'};return _0x2f5f58;})});}_0x18e6e6=_[_0x377e('0x39')]({},_0x18e6e6,_0x126815[_0x377e('0x49')]);return _0x2f2bd5[_0x377e('0x4d')](_0x18e6e6);}})[_0x377e('0x23')](function(_0x585779){if(_0x585779){_0xcd88b9=_0x585779[_0x377e('0x31')];if(!_0x126815['query']['hasOwnProperty']('nolimit')){_0x18e6e6[_0x377e('0x1e')]=qs[_0x377e('0x1e')](_0x126815['query'][_0x377e('0x1e')]);_0x18e6e6['offset']=qs[_0x377e('0x1c')](_0x126815[_0x377e('0x2d')][_0x377e('0x1c')]);}return _0x2f2bd5[_0x377e('0x4d')](_0x18e6e6);}})[_0x377e('0x23')](function(_0x3f732d){if(_0x3f732d){return _0x3f732d?{'count':_0xcd88b9,'rows':_0x3f732d}:null;}})[_0x377e('0x23')](respondWithResult(_0xe6a019,null))['catch'](handleError(_0xe6a019,null));};exports[_0x377e('0x4e')]=function(_0x1e164a,_0x3dfab4,_0x1e9cfd){var _0x23a916={};var _0x28e5d0={};var _0x191b94;var _0x453f73;return db['ZendeskConfiguration'][_0x377e('0x48')]({'where':{'id':_0x1e164a[_0x377e('0x47')]['id']}})[_0x377e('0x23')](handleEntityNotFound(_0x3dfab4,null))[_0x377e('0x23')](function(_0x1f6184){if(_0x1f6184){_0x191b94=_0x1f6184;_0x28e5d0['model']=_[_0x377e('0x41')](db['Tag'][_0x377e('0x29')]);_0x28e5d0[_0x377e('0x2d')]=_['keys'](_0x1e164a['query']);_0x28e5d0[_0x377e('0x2e')]=_[_0x377e('0x2f')](_0x28e5d0[_0x377e('0x2b')],_0x28e5d0['query']);_0x23a916[_0x377e('0x30')]=_['intersection'](_0x28e5d0['model'],qs['fields'](_0x1e164a[_0x377e('0x2d')][_0x377e('0x42')]));_0x23a916['attributes']=_0x23a916['attributes']['length']?_0x23a916[_0x377e('0x30')]:_0x28e5d0[_0x377e('0x2b')];_0x23a916[_0x377e('0x34')]=qs['sort'](_0x1e164a[_0x377e('0x2d')][_0x377e('0x35')]);_0x23a916[_0x377e('0x36')]=qs['filters'](_[_0x377e('0x37')](_0x1e164a[_0x377e('0x2d')],_0x28e5d0[_0x377e('0x2e')]));if(_0x1e164a[_0x377e('0x2d')][_0x377e('0x38')]){_0x23a916['where']=_[_0x377e('0x39')](_0x23a916[_0x377e('0x36')],{'$or':_[_0x377e('0x28')](_0x23a916[_0x377e('0x30')],function(_0x330b97){var _0x2d761a={};_0x2d761a[_0x330b97]={'$like':'%'+_0x1e164a[_0x377e('0x2d')]['filter']+'%'};return _0x2d761a;})});}_0x23a916=_[_0x377e('0x39')]({},_0x23a916,_0x1e164a[_0x377e('0x49')]);return _0x191b94[_0x377e('0x4e')](_0x23a916);}})[_0x377e('0x23')](function(_0x59fd98){if(_0x59fd98){_0x453f73=_0x59fd98[_0x377e('0x31')];if(!_0x1e164a['query'][_0x377e('0x32')](_0x377e('0x33'))){_0x23a916[_0x377e('0x1e')]=qs[_0x377e('0x1e')](_0x1e164a[_0x377e('0x2d')]['limit']);_0x23a916[_0x377e('0x1c')]=qs[_0x377e('0x1c')](_0x1e164a['query'][_0x377e('0x1c')]);}return _0x191b94[_0x377e('0x4e')](_0x23a916);}})['then'](function(_0x1cbef6){if(_0x1cbef6){return _0x1cbef6?{'count':_0x453f73,'rows':_0x1cbef6}:null;}})['then'](respondWithResult(_0x3dfab4,null))[_0x377e('0x40')](handleError(_0x3dfab4,null));};exports[_0x377e('0x4f')]=function(_0x47b6a6,_0x5610db,_0x208c82){if(_0x47b6a6[_0x377e('0x46')]['id']){delete _0x47b6a6['body']['id'];}return db[_0x377e('0x3c')][_0x377e('0x48')]({'where':{'id':_0x47b6a6[_0x377e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5610db,null))[_0x377e('0x23')](function(_0x11ac85){if(_0x11ac85){return _0x11ac85[_0x377e('0x4f')](_0x47b6a6[_0x377e('0x46')][_0x377e('0x50')]||[]);}return null;})[_0x377e('0x23')](respondWithResult(_0x5610db,null))[_0x377e('0x40')](handleError(_0x5610db,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8814b2a..31cba8e 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 _0x34b7=['request-promise','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x44bf54,_0x5be3d6){var _0x2c4a96=function(_0x2bd0ee){while(--_0x2bd0ee){_0x44bf54['push'](_0x44bf54['shift']());}};_0x2c4a96(++_0x5be3d6);}(_0x34b7,0x196));var _0x734b=function(_0x52b494,_0x144998){_0x52b494=_0x52b494-0x0;var _0x295940=_0x34b7[_0x52b494];return _0x295940;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c00=['moment','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x39aaf5,_0x4561f0){var _0x17e435=function(_0x526701){while(--_0x526701){_0x39aaf5['push'](_0x39aaf5['shift']());}};_0x17e435(++_0x4561f0);}(_0x5c00,0x17e));var _0x05c0=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0x5c00[_0x46aaaa];return _0x26d04e;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index a4d040c..2213509 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 _0x185a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x38d1e4,_0x432df9){var _0x53b3dd=function(_0x3095b8){while(--_0x3095b8){_0x38d1e4['push'](_0x38d1e4['shift']());}};_0x53b3dd(++_0x432df9);}(_0x185a,0x195));var _0xa185=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x185a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa185('0x0'));var util=require(_0xa185('0x1'));var moment=require(_0xa185('0x2'));var BPromise=require(_0xa185('0x3'));var rs=require(_0xa185('0x4'));var fs=require('fs');var Redis=require(_0xa185('0x5'));var db=require(_0xa185('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa185('0x7'))(_0xa185('0x8'));var config=require('../../config/environment');var jayson=require(_0xa185('0x9'));var client=jayson[_0xa185('0xa')][_0xa185('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ebd21,_0x3798f9,_0x43a0d0){return new BPromise(function(_0x108ad3,_0x2bddc5){return client[_0xa185('0xc')](_0x5ebd21,_0x43a0d0)[_0xa185('0xd')](function(_0x588806){logger[_0xa185('0xe')](_0xa185('0xf'),_0x3798f9,_0xa185('0x10'));logger[_0xa185('0x11')](_0xa185('0x12'),_0x3798f9,'request\x20sent',JSON[_0xa185('0x13')](_0x588806));if(_0x588806[_0xa185('0x14')]){if(_0x588806[_0xa185('0x14')][_0xa185('0x15')]===0x1f4){logger[_0xa185('0x14')](_0xa185('0xf'),_0x3798f9,_0x588806['error'][_0xa185('0x16')]);return _0x2bddc5(_0x588806['error']['message']);}logger[_0xa185('0x14')](_0xa185('0xf'),_0x3798f9,_0x588806[_0xa185('0x14')]['message']);return _0x108ad3(_0x588806[_0xa185('0x14')][_0xa185('0x16')]);}else{logger['info'](_0xa185('0xf'),_0x3798f9,'request\x20sent');_0x108ad3(_0x588806[_0xa185('0x17')][_0xa185('0x16')]);}})['catch'](function(_0x240d2f){logger[_0xa185('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3798f9,_0x240d2f);_0x2bddc5(_0x240d2f);});});} \ No newline at end of file +var _0x48eb=['http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2ab924,_0x18eb0a){var _0x31d3d8=function(_0x2d021c){while(--_0x2d021c){_0x2ab924['push'](_0x2ab924['shift']());}};_0x31d3d8(++_0x18eb0a);}(_0x48eb,0x187));var _0xb48e=function(_0x320cc8,_0x295af2){_0x320cc8=_0x320cc8-0x0;var _0x21e554=_0x48eb[_0x320cc8];return _0x21e554;};'use strict';var _=require('lodash');var util=require(_0xb48e('0x0'));var moment=require(_0xb48e('0x1'));var BPromise=require(_0xb48e('0x2'));var rs=require(_0xb48e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb48e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb48e('0x5'))(_0xb48e('0x6'));var config=require(_0xb48e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb48e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48cae1,_0x430c7a,_0x1b649b){return new BPromise(function(_0x2db73a,_0x534b43){return client[_0xb48e('0x9')](_0x48cae1,_0x1b649b)[_0xb48e('0xa')](function(_0xd434c6){logger[_0xb48e('0xb')](_0xb48e('0xc'),_0x430c7a,_0xb48e('0xd'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x430c7a,_0xb48e('0xd'),JSON[_0xb48e('0xe')](_0xd434c6));if(_0xd434c6[_0xb48e('0xf')]){if(_0xd434c6[_0xb48e('0xf')][_0xb48e('0x10')]===0x1f4){logger[_0xb48e('0xf')](_0xb48e('0xc'),_0x430c7a,_0xd434c6[_0xb48e('0xf')]['message']);return _0x534b43(_0xd434c6['error'][_0xb48e('0x11')]);}logger[_0xb48e('0xf')](_0xb48e('0xc'),_0x430c7a,_0xd434c6[_0xb48e('0xf')]['message']);return _0x2db73a(_0xd434c6['error'][_0xb48e('0x11')]);}else{logger[_0xb48e('0xb')](_0xb48e('0xc'),_0x430c7a,'request\x20sent');_0x2db73a(_0xd434c6[_0xb48e('0x12')][_0xb48e('0x11')]);}})['catch'](function(_0x264bf1){logger[_0xb48e('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x430c7a,_0x264bf1);_0x534b43(_0x264bf1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1c6b145..4ba2215 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 _0x02a8=['isAuthenticated','get','/:id','show','create','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0x02a8,0x117));var _0x802a=function(_0x3b5020,_0x733513){_0x3b5020=_0x3b5020-0x0;var _0x5d57c7=_0x02a8[_0x3b5020];return _0x5d57c7;};'use strict';var multer=require(_0x802a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x802a('0x1'));var express=require('express');var router=express[_0x802a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x802a('0x3'));var interaction=require(_0x802a('0x4'));var config=require(_0x802a('0x5'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x802a('0x6')](),controller['index']);router[_0x802a('0x7')](_0x802a('0x8'),auth[_0x802a('0x6')](),controller[_0x802a('0x9')]);router['post']('/',auth[_0x802a('0x6')](),controller[_0x802a('0xa')]);router['put'](_0x802a('0x8'),auth['isAuthenticated'](),controller[_0x802a('0xb')]);router[_0x802a('0xc')](_0x802a('0x8'),auth[_0x802a('0x6')](),controller[_0x802a('0xd')]);module[_0x802a('0xe')]=router; \ No newline at end of file +var _0xff40=['index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x349a75,_0x4b4d26){var _0x1e396e=function(_0x46bd28){while(--_0x46bd28){_0x349a75['push'](_0x349a75['shift']());}};_0x1e396e(++_0x4b4d26);}(_0xff40,0x12f));var _0x0ff4=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0xff40[_0x1e1965];return _0x1a2e96;};'use strict';var multer=require(_0x0ff4('0x0'));var util=require(_0x0ff4('0x1'));var path=require(_0x0ff4('0x2'));var timeout=require(_0x0ff4('0x3'));var express=require(_0x0ff4('0x4'));var router=express[_0x0ff4('0x5')]();var fs_extra=require(_0x0ff4('0x6'));var auth=require(_0x0ff4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0ff4('0x8'));var controller=require(_0x0ff4('0x9'));router[_0x0ff4('0xa')]('/',auth[_0x0ff4('0xb')](),controller[_0x0ff4('0xc')]);router[_0x0ff4('0xa')]('/:id',auth[_0x0ff4('0xb')](),controller['show']);router[_0x0ff4('0xd')]('/',auth[_0x0ff4('0xb')](),controller[_0x0ff4('0xe')]);router[_0x0ff4('0xf')](_0x0ff4('0x10'),auth[_0x0ff4('0xb')](),controller[_0x0ff4('0x11')]);router[_0x0ff4('0x12')](_0x0ff4('0x10'),auth[_0x0ff4('0xb')](),controller[_0x0ff4('0x13')]);module[_0x0ff4('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 5e4b1c1..968ef5b 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 _0xeab9=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x24b70b,_0x5cb89f){var _0xf911ed=function(_0x5a44b1){while(--_0x5a44b1){_0x24b70b['push'](_0x24b70b['shift']());}};_0xf911ed(++_0x5cb89f);}(_0xeab9,0xb8));var _0x9eab=function(_0xdeff57,_0x23872b){_0xdeff57=_0xdeff57-0x0;var _0x2047a3=_0xeab9[_0xdeff57];return _0x2047a3;};'use strict';var Sequelize=require('sequelize');module[_0x9eab('0x0')]={'type':{'type':Sequelize[_0x9eab('0x1')](_0x9eab('0x2'),_0x9eab('0x3'),_0x9eab('0x4'),_0x9eab('0x5'),_0x9eab('0x6')),'defaultValue':_0x9eab('0x2')},'content':{'type':Sequelize[_0x9eab('0x7')]},'key':{'type':Sequelize[_0x9eab('0x7')]},'keyType':{'type':Sequelize[_0x9eab('0x1')](_0x9eab('0x2'),_0x9eab('0x3'),_0x9eab('0x4'))},'keyContent':{'type':Sequelize[_0x9eab('0x7')]},'idField':{'type':Sequelize[_0x9eab('0x7')]},'nameField':{'type':Sequelize[_0x9eab('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9eab('0x7')]}}; \ No newline at end of file +var _0xd329=['exports','string','customVariable','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x1ec638,_0x1e16b7){var _0x43aaf3=function(_0x401260){while(--_0x401260){_0x1ec638['push'](_0x1ec638['shift']());}};_0x43aaf3(++_0x1e16b7);}(_0xd329,0x19c));var _0x9d32=function(_0x32900a,_0x72161c){_0x32900a=_0x32900a-0x0;var _0x14fbcf=_0xd329[_0x32900a];return _0x14fbcf;};'use strict';var Sequelize=require(_0x9d32('0x0'));module[_0x9d32('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9d32('0x2'),'variable',_0x9d32('0x3'),'keyValue','picklist'),'defaultValue':_0x9d32('0x2')},'content':{'type':Sequelize[_0x9d32('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d32('0x5')](_0x9d32('0x2'),'variable',_0x9d32('0x3'))},'keyContent':{'type':Sequelize[_0x9d32('0x4')]},'idField':{'type':Sequelize[_0x9d32('0x4')]},'nameField':{'type':Sequelize[_0x9d32('0x4')]},'customField':{'type':Sequelize[_0x9d32('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d32('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2a43c8e..dd0666c 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 _0x2746=['then','destroy','stack','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2746,0x19c));var _0x6274=function(_0x46718e,_0x4b879c){_0x46718e=_0x46718e-0x0;var _0x5d42f0=_0x2746[_0x46718e];return _0x5d42f0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6274('0x0'));var jsonpatch=require(_0x6274('0x1'));var rp=require(_0x6274('0x2'));var moment=require(_0x6274('0x3'));var BPromise=require(_0x6274('0x4'));var Mustache=require(_0x6274('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6274('0x6'));var csv=require(_0x6274('0x7'));var ejs=require(_0x6274('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6274('0x9'));var squel=require(_0x6274('0xa'));var crypto=require(_0x6274('0xb'));var jsforce=require(_0x6274('0xc'));var deskjs=require(_0x6274('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6274('0xe'));var Papa=require('papaparse');var Redis=require(_0x6274('0xf'));var authService=require(_0x6274('0x10'));var qs=require(_0x6274('0x11'));var as=require(_0x6274('0x12'));var hardwareService=require(_0x6274('0x13'));var logger=require(_0x6274('0x14'))(_0x6274('0x15'));var utils=require(_0x6274('0x16'));var config=require(_0x6274('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a0a1,_0xd3a0a2){_0xd3a0a2=_0xd3a0a2||0xcc;return function(_0x479fdc){if(_0x479fdc){return _0x59a0a1[_0x6274('0x18')](_0xd3a0a2);}return _0x59a0a1[_0x6274('0x19')](_0xd3a0a2)[_0x6274('0x1a')]();};}function respondWithResult(_0x4f4f9e,_0x58a4e3){_0x58a4e3=_0x58a4e3||0xc8;return function(_0x488b60){if(_0x488b60){return _0x4f4f9e[_0x6274('0x19')](_0x58a4e3)[_0x6274('0x1b')](_0x488b60);}};}function respondWithFilteredResult(_0x4b581a,_0x5e6ff8){return function(_0x425c8b){if(_0x425c8b){var _0x1d0dc4=typeof _0x5e6ff8[_0x6274('0x1c')]===_0x6274('0x1d')&&typeof _0x5e6ff8[_0x6274('0x1e')]==='undefined';var _0x3219d1=_0x425c8b[_0x6274('0x1f')];var _0x40cc32=_0x1d0dc4?0x0:_0x5e6ff8['offset'];var _0x5cdf5e=_0x1d0dc4?_0x425c8b[_0x6274('0x1f')]:_0x5e6ff8['offset']+_0x5e6ff8['limit'];var _0x402b97;if(_0x5cdf5e>=_0x3219d1){_0x5cdf5e=_0x3219d1;_0x402b97=0xc8;}else{_0x402b97=0xce;}_0x4b581a['status'](_0x402b97);return _0x4b581a[_0x6274('0x20')](_0x6274('0x21'),_0x40cc32+'-'+_0x5cdf5e+'/'+_0x3219d1)['json'](_0x425c8b);}return null;};}function patchUpdates(_0x55dab9){return function(_0x3e0248){try{jsonpatch[_0x6274('0x22')](_0x3e0248,_0x55dab9,!![]);}catch(_0xe2b388){return BPromise[_0x6274('0x23')](_0xe2b388);}return _0x3e0248[_0x6274('0x24')]();};}function saveUpdates(_0x221c7a,_0x3b8fb6){return function(_0x12df93){if(_0x12df93){return _0x12df93[_0x6274('0x25')](_0x221c7a)[_0x6274('0x26')](function(_0x1d1a09){return _0x1d1a09;});}return null;};}function removeEntity(_0xc49220,_0x125f14){return function(_0xa0c8bd){if(_0xa0c8bd){return _0xa0c8bd[_0x6274('0x27')]()[_0x6274('0x26')](function(){_0xc49220[_0x6274('0x19')](0xcc)[_0x6274('0x1a')]();});}};}function handleEntityNotFound(_0x5228a1,_0x425241){return function(_0x486d1f){if(!_0x486d1f){_0x5228a1[_0x6274('0x18')](0x194);}return _0x486d1f;};}function handleError(_0x543ac7,_0x234149){_0x234149=_0x234149||0x1f4;return function(_0x1513e8){logger['error'](_0x1513e8[_0x6274('0x28')]);if(_0x1513e8['name']){delete _0x1513e8['name'];}_0x543ac7[_0x6274('0x19')](_0x234149)[_0x6274('0x29')](_0x1513e8);};}exports[_0x6274('0x2a')]=function(_0x490541,_0x3feefd){var _0x49df2e={},_0x4818e2={},_0x4c1160={'count':0x0,'rows':[]};var _0x4144ed=_[_0x6274('0x2b')](db[_0x6274('0x2c')][_0x6274('0x2d')],function(_0x3b2598){return{'name':_0x3b2598[_0x6274('0x2e')],'type':_0x3b2598['type'][_0x6274('0x2f')]};});_0x4818e2[_0x6274('0x30')]=_[_0x6274('0x2b')](_0x4144ed,_0x6274('0x31'));_0x4818e2[_0x6274('0x32')]=_[_0x6274('0x33')](_0x490541[_0x6274('0x32')]);_0x4818e2['filters']=_['intersection'](_0x4818e2[_0x6274('0x30')],_0x4818e2[_0x6274('0x32')]);_0x49df2e[_0x6274('0x34')]=_[_0x6274('0x35')](_0x4818e2[_0x6274('0x30')],qs[_0x6274('0x36')](_0x490541[_0x6274('0x32')][_0x6274('0x36')]));_0x49df2e[_0x6274('0x34')]=_0x49df2e[_0x6274('0x34')][_0x6274('0x37')]?_0x49df2e[_0x6274('0x34')]:_0x4818e2['model'];if(!_0x490541[_0x6274('0x32')][_0x6274('0x38')](_0x6274('0x39'))){_0x49df2e[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x490541[_0x6274('0x32')]['limit']);_0x49df2e['offset']=qs['offset'](_0x490541[_0x6274('0x32')][_0x6274('0x1c')]);}_0x49df2e[_0x6274('0x3a')]=qs[_0x6274('0x3b')](_0x490541[_0x6274('0x32')][_0x6274('0x3b')]);_0x49df2e[_0x6274('0x3c')]=qs[_0x6274('0x3d')](_[_0x6274('0x3e')](_0x490541[_0x6274('0x32')],_0x4818e2[_0x6274('0x3d')]),_0x4144ed);if(_0x490541[_0x6274('0x32')][_0x6274('0x3f')]){_0x49df2e[_0x6274('0x3c')]=_[_0x6274('0x40')](_0x49df2e[_0x6274('0x3c')],{'$or':_[_0x6274('0x2b')](_0x4144ed,function(_0x2cb929){if(_0x2cb929['type']!==_0x6274('0x41')){var _0x3737ee={};_0x3737ee[_0x2cb929[_0x6274('0x31')]]={'$like':'%'+_0x490541[_0x6274('0x32')][_0x6274('0x3f')]+'%'};return _0x3737ee;}})});}_0x49df2e=_[_0x6274('0x40')]({},_0x49df2e,_0x490541[_0x6274('0x42')]);var _0x180912={'where':_0x49df2e['where']};return db['ZendeskField'][_0x6274('0x1f')](_0x180912)[_0x6274('0x26')](function(_0x1cee3d){_0x4c1160[_0x6274('0x1f')]=_0x1cee3d;if(_0x490541[_0x6274('0x32')][_0x6274('0x43')]){_0x49df2e['include']=[{'all':!![]}];}return db['ZendeskField'][_0x6274('0x44')](_0x49df2e);})['then'](function(_0x4d3c2a){_0x4c1160['rows']=_0x4d3c2a;return _0x4c1160;})[_0x6274('0x26')](respondWithFilteredResult(_0x3feefd,_0x49df2e))['catch'](handleError(_0x3feefd,null));};exports[_0x6274('0x45')]=function(_0x3b4fd0,_0x7e1062){var _0x24a3d5={'raw':!![],'where':{'id':_0x3b4fd0[_0x6274('0x46')]['id']}},_0x4da418={};_0x4da418[_0x6274('0x30')]=_[_0x6274('0x33')](db['ZendeskField'][_0x6274('0x2d')]);_0x4da418[_0x6274('0x32')]=_[_0x6274('0x33')](_0x3b4fd0[_0x6274('0x32')]);_0x4da418[_0x6274('0x3d')]=_[_0x6274('0x35')](_0x4da418[_0x6274('0x30')],_0x4da418[_0x6274('0x32')]);_0x24a3d5['attributes']=_['intersection'](_0x4da418['model'],qs[_0x6274('0x36')](_0x3b4fd0[_0x6274('0x32')]['fields']));_0x24a3d5[_0x6274('0x34')]=_0x24a3d5[_0x6274('0x34')]['length']?_0x24a3d5[_0x6274('0x34')]:_0x4da418[_0x6274('0x30')];if(_0x3b4fd0[_0x6274('0x32')][_0x6274('0x43')]){_0x24a3d5['include']=[{'all':!![]}];}_0x24a3d5=_[_0x6274('0x40')]({},_0x24a3d5,_0x3b4fd0[_0x6274('0x42')]);return db[_0x6274('0x2c')][_0x6274('0x47')](_0x24a3d5)['then'](handleEntityNotFound(_0x7e1062,null))[_0x6274('0x26')](respondWithResult(_0x7e1062,null))[_0x6274('0x48')](handleError(_0x7e1062,null));};exports['create']=function(_0x582252,_0x2a3ae9){return db[_0x6274('0x2c')][_0x6274('0x49')](_0x582252[_0x6274('0x4a')],{})[_0x6274('0x26')](respondWithResult(_0x2a3ae9,0xc9))['catch'](handleError(_0x2a3ae9,null));};exports[_0x6274('0x25')]=function(_0x18dab3,_0x5bb7bd){if(_0x18dab3[_0x6274('0x4a')]['id']){delete _0x18dab3['body']['id'];}return db[_0x6274('0x2c')]['find']({'where':{'id':_0x18dab3[_0x6274('0x46')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x5bb7bd,null))['then'](saveUpdates(_0x18dab3[_0x6274('0x4a')],null))[_0x6274('0x26')](respondWithResult(_0x5bb7bd,null))['catch'](handleError(_0x5bb7bd,null));};exports['destroy']=function(_0x4cd287,_0x3643e1){return db['ZendeskField']['find']({'where':{'id':_0x4cd287[_0x6274('0x46')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x3643e1,null))[_0x6274('0x26')](removeEntity(_0x3643e1,null))[_0x6274('0x48')](handleError(_0x3643e1,null));}; \ No newline at end of file +var _0x0a9f=['apply','reject','save','update','then','destroy','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','length','includeAll','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','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','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0xfd9c75,_0x124bdf){var _0x34f893=function(_0x163e55){while(--_0x163e55){_0xfd9c75['push'](_0xfd9c75['shift']());}};_0x34f893(++_0x124bdf);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x3c5503,_0x2b568d){_0x3c5503=_0x3c5503-0x0;var _0x5571a6=_0x0a9f[_0x3c5503];return _0x5571a6;};'use strict';var emlformat=require(_0xf0a9('0x0'));var rimraf=require(_0xf0a9('0x1'));var zipdir=require(_0xf0a9('0x2'));var jsonpatch=require(_0xf0a9('0x3'));var rp=require(_0xf0a9('0x4'));var moment=require(_0xf0a9('0x5'));var BPromise=require(_0xf0a9('0x6'));var Mustache=require(_0xf0a9('0x7'));var util=require(_0xf0a9('0x8'));var path=require(_0xf0a9('0x9'));var sox=require(_0xf0a9('0xa'));var csv=require(_0xf0a9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0a9('0xc'));var _=require('lodash');var squel=require(_0xf0a9('0xd'));var crypto=require(_0xf0a9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0a9('0xf'));var toCsv=require(_0xf0a9('0xb'));var querystring=require('querystring');var Papa=require(_0xf0a9('0x10'));var Redis=require(_0xf0a9('0x11'));var authService=require(_0xf0a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf0a9('0x13'));var hardwareService=require(_0xf0a9('0x14'));var logger=require(_0xf0a9('0x15'))(_0xf0a9('0x16'));var utils=require(_0xf0a9('0x17'));var config=require(_0xf0a9('0x18'));var licenseUtil=require(_0xf0a9('0x19'));var db=require(_0xf0a9('0x1a'))['db'];function respondWithStatusCode(_0x2253a5,_0x19b0b8){_0x19b0b8=_0x19b0b8||0xcc;return function(_0x123f9b){if(_0x123f9b){return _0x2253a5[_0xf0a9('0x1b')](_0x19b0b8);}return _0x2253a5['status'](_0x19b0b8)[_0xf0a9('0x1c')]();};}function respondWithResult(_0x3482bf,_0x19c9eb){_0x19c9eb=_0x19c9eb||0xc8;return function(_0x17d869){if(_0x17d869){return _0x3482bf[_0xf0a9('0x1d')](_0x19c9eb)[_0xf0a9('0x1e')](_0x17d869);}};}function respondWithFilteredResult(_0x56ae15,_0x2466c0){return function(_0x3057f3){if(_0x3057f3){var _0x572607=typeof _0x2466c0[_0xf0a9('0x1f')]==='undefined'&&typeof _0x2466c0[_0xf0a9('0x20')]===_0xf0a9('0x21');var _0x19953c=_0x3057f3[_0xf0a9('0x22')];var _0x41e4c3=_0x572607?0x0:_0x2466c0[_0xf0a9('0x1f')];var _0x4c82e7=_0x572607?_0x3057f3[_0xf0a9('0x22')]:_0x2466c0[_0xf0a9('0x1f')]+_0x2466c0[_0xf0a9('0x20')];var _0x7eeafd;if(_0x4c82e7>=_0x19953c){_0x4c82e7=_0x19953c;_0x7eeafd=0xc8;}else{_0x7eeafd=0xce;}_0x56ae15[_0xf0a9('0x1d')](_0x7eeafd);return _0x56ae15[_0xf0a9('0x23')](_0xf0a9('0x24'),_0x41e4c3+'-'+_0x4c82e7+'/'+_0x19953c)['json'](_0x3057f3);}return null;};}function patchUpdates(_0x48c381){return function(_0xff4e26){try{jsonpatch[_0xf0a9('0x25')](_0xff4e26,_0x48c381,!![]);}catch(_0x334ada){return BPromise[_0xf0a9('0x26')](_0x334ada);}return _0xff4e26[_0xf0a9('0x27')]();};}function saveUpdates(_0x130228,_0x18dd39){return function(_0x55b8cc){if(_0x55b8cc){return _0x55b8cc[_0xf0a9('0x28')](_0x130228)[_0xf0a9('0x29')](function(_0x2c3ce3){return _0x2c3ce3;});}return null;};}function removeEntity(_0x54b5ce,_0x4c4bbd){return function(_0x87063e){if(_0x87063e){return _0x87063e[_0xf0a9('0x2a')]()[_0xf0a9('0x29')](function(){_0x54b5ce['status'](0xcc)[_0xf0a9('0x1c')]();});}};}function handleEntityNotFound(_0x2e49ce,_0x26055c){return function(_0x4be839){if(!_0x4be839){_0x2e49ce[_0xf0a9('0x1b')](0x194);}return _0x4be839;};}function handleError(_0x4efe08,_0x2d7e63){_0x2d7e63=_0x2d7e63||0x1f4;return function(_0x508bfd){logger[_0xf0a9('0x2b')](_0x508bfd['stack']);if(_0x508bfd[_0xf0a9('0x2c')]){delete _0x508bfd[_0xf0a9('0x2c')];}_0x4efe08[_0xf0a9('0x1d')](_0x2d7e63)[_0xf0a9('0x2d')](_0x508bfd);};}exports[_0xf0a9('0x2e')]=function(_0x27a04c,_0x132818){var _0x43aa70={},_0x460c00={},_0xbd6f52={'count':0x0,'rows':[]};var _0x3b1c79=_[_0xf0a9('0x2f')](db[_0xf0a9('0x30')][_0xf0a9('0x31')],function(_0x1f5717){return{'name':_0x1f5717[_0xf0a9('0x32')],'type':_0x1f5717[_0xf0a9('0x33')][_0xf0a9('0x34')]};});_0x460c00[_0xf0a9('0x35')]=_[_0xf0a9('0x2f')](_0x3b1c79,_0xf0a9('0x2c'));_0x460c00['query']=_[_0xf0a9('0x36')](_0x27a04c[_0xf0a9('0x37')]);_0x460c00[_0xf0a9('0x38')]=_[_0xf0a9('0x39')](_0x460c00[_0xf0a9('0x35')],_0x460c00[_0xf0a9('0x37')]);_0x43aa70[_0xf0a9('0x3a')]=_['intersection'](_0x460c00['model'],qs[_0xf0a9('0x3b')](_0x27a04c[_0xf0a9('0x37')][_0xf0a9('0x3b')]));_0x43aa70['attributes']=_0x43aa70[_0xf0a9('0x3a')]['length']?_0x43aa70[_0xf0a9('0x3a')]:_0x460c00['model'];if(!_0x27a04c[_0xf0a9('0x37')][_0xf0a9('0x3c')]('nolimit')){_0x43aa70[_0xf0a9('0x20')]=qs['limit'](_0x27a04c['query']['limit']);_0x43aa70[_0xf0a9('0x1f')]=qs[_0xf0a9('0x1f')](_0x27a04c[_0xf0a9('0x37')][_0xf0a9('0x1f')]);}_0x43aa70[_0xf0a9('0x3d')]=qs[_0xf0a9('0x3e')](_0x27a04c['query']['sort']);_0x43aa70[_0xf0a9('0x3f')]=qs[_0xf0a9('0x38')](_[_0xf0a9('0x40')](_0x27a04c[_0xf0a9('0x37')],_0x460c00[_0xf0a9('0x38')]),_0x3b1c79);if(_0x27a04c['query']['filter']){_0x43aa70[_0xf0a9('0x3f')]=_[_0xf0a9('0x41')](_0x43aa70[_0xf0a9('0x3f')],{'$or':_['map'](_0x3b1c79,function(_0x32584e){if(_0x32584e[_0xf0a9('0x33')]!==_0xf0a9('0x42')){var _0x150268={};_0x150268[_0x32584e[_0xf0a9('0x2c')]]={'$like':'%'+_0x27a04c['query'][_0xf0a9('0x43')]+'%'};return _0x150268;}})});}_0x43aa70=_[_0xf0a9('0x41')]({},_0x43aa70,_0x27a04c[_0xf0a9('0x44')]);var _0x397898={'where':_0x43aa70['where']};return db['ZendeskField'][_0xf0a9('0x22')](_0x397898)[_0xf0a9('0x29')](function(_0x19f2fa){_0xbd6f52['count']=_0x19f2fa;if(_0x27a04c[_0xf0a9('0x37')]['includeAll']){_0x43aa70[_0xf0a9('0x45')]=[{'all':!![]}];}return db[_0xf0a9('0x30')]['findAll'](_0x43aa70);})[_0xf0a9('0x29')](function(_0x4861eb){_0xbd6f52[_0xf0a9('0x46')]=_0x4861eb;return _0xbd6f52;})[_0xf0a9('0x29')](respondWithFilteredResult(_0x132818,_0x43aa70))[_0xf0a9('0x47')](handleError(_0x132818,null));};exports[_0xf0a9('0x48')]=function(_0x1000a9,_0x8e9aef){var _0x50932c={'raw':!![],'where':{'id':_0x1000a9['params']['id']}},_0x45931e={};_0x45931e['model']=_[_0xf0a9('0x36')](db['ZendeskField']['rawAttributes']);_0x45931e[_0xf0a9('0x37')]=_['keys'](_0x1000a9[_0xf0a9('0x37')]);_0x45931e[_0xf0a9('0x38')]=_['intersection'](_0x45931e[_0xf0a9('0x35')],_0x45931e[_0xf0a9('0x37')]);_0x50932c[_0xf0a9('0x3a')]=_[_0xf0a9('0x39')](_0x45931e['model'],qs[_0xf0a9('0x3b')](_0x1000a9['query'][_0xf0a9('0x3b')]));_0x50932c[_0xf0a9('0x3a')]=_0x50932c['attributes'][_0xf0a9('0x49')]?_0x50932c[_0xf0a9('0x3a')]:_0x45931e[_0xf0a9('0x35')];if(_0x1000a9[_0xf0a9('0x37')][_0xf0a9('0x4a')]){_0x50932c[_0xf0a9('0x45')]=[{'all':!![]}];}_0x50932c=_[_0xf0a9('0x41')]({},_0x50932c,_0x1000a9[_0xf0a9('0x44')]);return db[_0xf0a9('0x30')]['find'](_0x50932c)[_0xf0a9('0x29')](handleEntityNotFound(_0x8e9aef,null))[_0xf0a9('0x29')](respondWithResult(_0x8e9aef,null))[_0xf0a9('0x47')](handleError(_0x8e9aef,null));};exports[_0xf0a9('0x4b')]=function(_0x4d7cf0,_0x5467a1){return db[_0xf0a9('0x30')]['create'](_0x4d7cf0[_0xf0a9('0x4c')],{})[_0xf0a9('0x29')](respondWithResult(_0x5467a1,0xc9))[_0xf0a9('0x47')](handleError(_0x5467a1,null));};exports[_0xf0a9('0x28')]=function(_0x5ee597,_0x1718e0){if(_0x5ee597[_0xf0a9('0x4c')]['id']){delete _0x5ee597[_0xf0a9('0x4c')]['id'];}return db[_0xf0a9('0x30')][_0xf0a9('0x4d')]({'where':{'id':_0x5ee597[_0xf0a9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1718e0,null))['then'](saveUpdates(_0x5ee597[_0xf0a9('0x4c')],null))[_0xf0a9('0x29')](respondWithResult(_0x1718e0,null))[_0xf0a9('0x47')](handleError(_0x1718e0,null));};exports['destroy']=function(_0x16d8cb,_0x21b622){return db[_0xf0a9('0x30')][_0xf0a9('0x4d')]({'where':{'id':_0x16d8cb[_0xf0a9('0x4e')]['id']}})[_0xf0a9('0x29')](handleEntityNotFound(_0x21b622,null))[_0xf0a9('0x29')](removeEntity(_0x21b622,null))['catch'](handleError(_0x21b622,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7dfe6ff..425cc3c 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 _0x50be=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0xafa93c,_0x3e7f38){var _0x51b7b7=function(_0x2ac237){while(--_0x2ac237){_0xafa93c['push'](_0xafa93c['shift']());}};_0x51b7b7(++_0x3e7f38);}(_0x50be,0x96));var _0xe50b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe50b('0x0'));var util=require(_0xe50b('0x1'));var logger=require(_0xe50b('0x2'))(_0xe50b('0x3'));var moment=require(_0xe50b('0x4'));var BPromise=require(_0xe50b('0x5'));var rp=require(_0xe50b('0x6'));var fs=require('fs');var path=require(_0xe50b('0x7'));var rimraf=require(_0xe50b('0x8'));var config=require(_0xe50b('0x9'));var attributes=require(_0xe50b('0xa'));module['exports']=function(_0xd5815,_0x2e737a){return _0xd5815[_0xe50b('0xb')]('ZendeskField',attributes,{'tableName':_0xe50b('0xc'),'paranoid':![],'indexes':[{'name':_0xe50b('0xd'),'fields':['idField',_0xe50b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8d=['exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x190dbe,_0x13cb87){var _0x158330=function(_0x172fb5){while(--_0x172fb5){_0x190dbe['push'](_0x190dbe['shift']());}};_0x158330(++_0x13cb87);}(_0x2c8d,0x126));var _0xd2c8=function(_0x3b3672,_0x36c56b){_0x3b3672=_0x3b3672-0x0;var _0x3eee38=_0x2c8d[_0x3b3672];return _0x3eee38;};'use strict';var _=require(_0xd2c8('0x0'));var util=require(_0xd2c8('0x1'));var logger=require(_0xd2c8('0x2'))('api');var moment=require(_0xd2c8('0x3'));var BPromise=require(_0xd2c8('0x4'));var rp=require(_0xd2c8('0x5'));var fs=require('fs');var path=require(_0xd2c8('0x6'));var rimraf=require(_0xd2c8('0x7'));var config=require(_0xd2c8('0x8'));var attributes=require(_0xd2c8('0x9'));module[_0xd2c8('0xa')]=function(_0x406f0d,_0x947d70){return _0x406f0d['define'](_0xd2c8('0xb'),attributes,{'tableName':_0xd2c8('0xc'),'paranoid':![],'indexes':[{'name':_0xd2c8('0xd'),'fields':[_0xd2c8('0xe'),_0xd2c8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 1959c4f..ca9ffa0 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 _0xbd37=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x355494,_0x592917){var _0x59d215=function(_0x1c59f7){while(--_0x1c59f7){_0x355494['push'](_0x355494['shift']());}};_0x59d215(++_0x592917);}(_0xbd37,0x111));var _0x7bd3=function(_0x4a5f95,_0x1553d3){_0x4a5f95=_0x4a5f95-0x0;var _0x4dcfa5=_0xbd37[_0x4a5f95];return _0x4dcfa5;};'use strict';var _=require(_0x7bd3('0x0'));var util=require(_0x7bd3('0x1'));var moment=require(_0x7bd3('0x2'));var BPromise=require(_0x7bd3('0x3'));var rs=require(_0x7bd3('0x4'));var fs=require('fs');var Redis=require(_0x7bd3('0x5'));var db=require(_0x7bd3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bd3('0x7'))(_0x7bd3('0x8'));var config=require('../../config/environment');var jayson=require(_0x7bd3('0x9'));var client=jayson[_0x7bd3('0xa')][_0x7bd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x366875,_0x106a73,_0x131337){return new BPromise(function(_0x26b32b,_0x27303d){return client[_0x7bd3('0xc')](_0x366875,_0x131337)['then'](function(_0xd964a6){logger['info'](_0x7bd3('0xd'),_0x106a73,_0x7bd3('0xe'));logger[_0x7bd3('0xf')](_0x7bd3('0x10'),_0x106a73,_0x7bd3('0xe'),JSON[_0x7bd3('0x11')](_0xd964a6));if(_0xd964a6[_0x7bd3('0x12')]){if(_0xd964a6['error'][_0x7bd3('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x106a73,_0xd964a6[_0x7bd3('0x12')][_0x7bd3('0x14')]);return _0x27303d(_0xd964a6['error'][_0x7bd3('0x14')]);}logger[_0x7bd3('0x12')]('ZendeskField,\x20%s,\x20%s',_0x106a73,_0xd964a6[_0x7bd3('0x12')]['message']);return _0x26b32b(_0xd964a6['error']['message']);}else{logger['info'](_0x7bd3('0xd'),_0x106a73,_0x7bd3('0xe'));_0x26b32b(_0xd964a6[_0x7bd3('0x15')][_0x7bd3('0x14')]);}})['catch'](function(_0x4a2b05){logger[_0x7bd3('0x12')](_0x7bd3('0xd'),_0x106a73,_0x4a2b05);_0x27303d(_0x4a2b05);});});} \ No newline at end of file +var _0xa3ca=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x1d7932,_0x5e7bbd){var _0x4be1ac=function(_0x3fdef9){while(--_0x3fdef9){_0x1d7932['push'](_0x1d7932['shift']());}};_0x4be1ac(++_0x5e7bbd);}(_0xa3ca,0xf2));var _0xaa3c=function(_0xcfc35d,_0xc08150){_0xcfc35d=_0xcfc35d-0x0;var _0x4098dc=_0xa3ca[_0xcfc35d];return _0x4098dc;};'use strict';var _=require('lodash');var util=require(_0xaa3c('0x0'));var moment=require(_0xaa3c('0x1'));var BPromise=require(_0xaa3c('0x2'));var rs=require(_0xaa3c('0x3'));var fs=require('fs');var Redis=require(_0xaa3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa3c('0x5'));var logger=require('../../config/logger')(_0xaa3c('0x6'));var config=require(_0xaa3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaa3c('0x8')][_0xaa3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f6a59,_0x2e2f22,_0x4e3ab0){return new BPromise(function(_0x2b014d,_0x4b6601){return client[_0xaa3c('0xa')](_0x1f6a59,_0x4e3ab0)[_0xaa3c('0xb')](function(_0x179eca){logger[_0xaa3c('0xc')](_0xaa3c('0xd'),_0x2e2f22,_0xaa3c('0xe'));logger[_0xaa3c('0xf')](_0xaa3c('0x10'),_0x2e2f22,_0xaa3c('0xe'),JSON['stringify'](_0x179eca));if(_0x179eca[_0xaa3c('0x11')]){if(_0x179eca[_0xaa3c('0x11')][_0xaa3c('0x12')]===0x1f4){logger[_0xaa3c('0x11')]('ZendeskField,\x20%s,\x20%s',_0x2e2f22,_0x179eca[_0xaa3c('0x11')][_0xaa3c('0x13')]);return _0x4b6601(_0x179eca[_0xaa3c('0x11')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x2e2f22,_0x179eca[_0xaa3c('0x11')]['message']);return _0x2b014d(_0x179eca[_0xaa3c('0x11')][_0xaa3c('0x13')]);}else{logger[_0xaa3c('0xc')](_0xaa3c('0xd'),_0x2e2f22,_0xaa3c('0xe'));_0x2b014d(_0x179eca[_0xaa3c('0x14')][_0xaa3c('0x13')]);}})['catch'](function(_0x4d01c4){logger[_0xaa3c('0x11')](_0xaa3c('0xd'),_0x2e2f22,_0x4d01c4);_0x4b6601(_0x4d01c4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 0d247e0..65ed3b8 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 _0x5b5a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','/:id','update','delete','destroy','util','path','express'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5b5a,0xc3));var _0xa5b5=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x5b5a[_0xc40b9f];return _0x535b9c;};'use strict';var multer=require('multer');var util=require(_0xa5b5('0x0'));var path=require(_0xa5b5('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5b5('0x2'));var router=express[_0xa5b5('0x3')]();var fs_extra=require(_0xa5b5('0x4'));var auth=require(_0xa5b5('0x5'));var interaction=require(_0xa5b5('0x6'));var config=require(_0xa5b5('0x7'));var controller=require(_0xa5b5('0x8'));router[_0xa5b5('0x9')]('/',auth['isAuthenticated'](),controller[_0xa5b5('0xa')]);router[_0xa5b5('0x9')]('/:id',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0xc')]);router[_0xa5b5('0x9')](_0xa5b5('0xd'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0xe')]);router[_0xa5b5('0x9')](_0xa5b5('0xf'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa5b5('0xd'),auth['isAuthenticated'](),controller[_0xa5b5('0x11')]);router['put'](_0xa5b5('0x12'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x13')]);router[_0xa5b5('0x14')](_0xa5b5('0x12'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe234=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x5fe5ca,_0x4e92d3){var _0x42f45f=function(_0x2511eb){while(--_0x2511eb){_0x5fe5ca['push'](_0x5fe5ca['shift']());}};_0x42f45f(++_0x4e92d3);}(_0xe234,0x191));var _0x4e23=function(_0x5a4753,_0x58923f){_0x5a4753=_0x5a4753-0x0;var _0x1886bf=_0xe234[_0x5a4753];return _0x1886bf;};'use strict';var multer=require(_0x4e23('0x0'));var util=require(_0x4e23('0x1'));var path=require(_0x4e23('0x2'));var timeout=require(_0x4e23('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e23('0x4'));var auth=require(_0x4e23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e23('0x6'));var controller=require(_0x4e23('0x7'));router[_0x4e23('0x8')]('/',auth[_0x4e23('0x9')](),controller['index']);router[_0x4e23('0x8')]('/:id',auth[_0x4e23('0x9')](),controller[_0x4e23('0xa')]);router['get'](_0x4e23('0xb'),auth[_0x4e23('0x9')](),controller[_0x4e23('0xc')]);router[_0x4e23('0x8')](_0x4e23('0xd'),auth[_0x4e23('0x9')](),controller['getFields']);router[_0x4e23('0xe')]('/',auth[_0x4e23('0x9')](),controller[_0x4e23('0xf')]);router[_0x4e23('0xe')]('/:id/configurations',auth[_0x4e23('0x9')](),controller[_0x4e23('0x10')]);router[_0x4e23('0x11')](_0x4e23('0x12'),auth['isAuthenticated'](),controller[_0x4e23('0x13')]);router[_0x4e23('0x14')](_0x4e23('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e23('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f439b17..4280fc2 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 _0x6f0d=['exports','STRING'];(function(_0x3f39de,_0x4c4a34){var _0x1369fc=function(_0x29eb29){while(--_0x29eb29){_0x3f39de['push'](_0x3f39de['shift']());}};_0x1369fc(++_0x4c4a34);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x585657,_0x1c0492){_0x585657=_0x585657-0x0;var _0x321e0c=_0x6f0d[_0x585657];return _0x321e0c;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file +var _0x5ff3=['STRING','exports'];(function(_0x19a502,_0x524800){var _0x347954=function(_0x4dd5d5){while(--_0x4dd5d5){_0x19a502['push'](_0x19a502['shift']());}};_0x347954(++_0x524800);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1ec7f5,_0x19b149){_0x1ec7f5=_0x1ec7f5-0x0;var _0x121d0f=_0x5ff3[_0x1ec7f5];return _0x121d0f;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35ff('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x35ff('0x1')]},'clientId':{'type':Sequelize[_0x35ff('0x1')]},'clientSecret':{'type':Sequelize[_0x35ff('0x1')]},'serverUrl':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x35ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 41001ca..df2209a 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 _0x1f5a=['access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','stringify','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','end','error','send','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','name','filter','includeAll','findAll','rows','catch','show','include','options','find','body','params','getConfigurations','ZohoConfiguration','pick','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token'];(function(_0x27b01b,_0x11dde8){var _0x20d2f7=function(_0x24a7d6){while(--_0x24a7d6){_0x27b01b['push'](_0x27b01b['shift']());}};_0x20d2f7(++_0x11dde8);}(_0x1f5a,0xa3));var _0xa1f5=function(_0x463c82,_0x1ce9e9){_0x463c82=_0x463c82-0x0;var _0x104245=_0x1f5a[_0x463c82];return _0x104245;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1f5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1f5('0x1'));var rp=require(_0xa1f5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1f5('0x3'));var util=require(_0xa1f5('0x4'));var path=require('path');var sox=require(_0xa1f5('0x5'));var csv=require(_0xa1f5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1f5('0x7'));var _=require(_0xa1f5('0x8'));var squel=require(_0xa1f5('0x9'));var crypto=require(_0xa1f5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa1f5('0x6'));var querystring=require(_0xa1f5('0xb'));var Papa=require(_0xa1f5('0xc'));var Redis=require(_0xa1f5('0xd'));var authService=require(_0xa1f5('0xe'));var qs=require(_0xa1f5('0xf'));var as=require(_0xa1f5('0x10'));var hardwareService=require(_0xa1f5('0x11'));var logger=require(_0xa1f5('0x12'))('api');var utils=require(_0xa1f5('0x13'));var config=require(_0xa1f5('0x14'));var licenseUtil=require(_0xa1f5('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa1f5('0x16'));function respondWithStatusCode(_0x567490,_0xeb3551){_0xeb3551=_0xeb3551||0xcc;return function(_0x1dcbd2){if(_0x1dcbd2){return _0x567490[_0xa1f5('0x17')](_0xeb3551);}return _0x567490[_0xa1f5('0x18')](_0xeb3551)['end']();};}function respondWithResult(_0x29d37e,_0x54ec32){_0x54ec32=_0x54ec32||0xc8;return function(_0x130aed){if(_0x130aed){return _0x29d37e[_0xa1f5('0x18')](_0x54ec32)['json'](_0x130aed);}};}function respondWithFilteredResult(_0x35060f,_0x4e4fef){return function(_0x3236b5){if(_0x3236b5){var _0x1cea6a=typeof _0x4e4fef[_0xa1f5('0x19')]===_0xa1f5('0x1a')&&typeof _0x4e4fef[_0xa1f5('0x1b')]===_0xa1f5('0x1a');var _0x5b512e=_0x3236b5[_0xa1f5('0x1c')];var _0x514ab6=_0x1cea6a?0x0:_0x4e4fef['offset'];var _0x26322a=_0x1cea6a?_0x3236b5[_0xa1f5('0x1c')]:_0x4e4fef[_0xa1f5('0x19')]+_0x4e4fef[_0xa1f5('0x1b')];var _0x4935d3;if(_0x26322a>=_0x5b512e){_0x26322a=_0x5b512e;_0x4935d3=0xc8;}else{_0x4935d3=0xce;}_0x35060f['status'](_0x4935d3);return _0x35060f[_0xa1f5('0x1d')]('Content-Range',_0x514ab6+'-'+_0x26322a+'/'+_0x5b512e)[_0xa1f5('0x1e')](_0x3236b5);}return null;};}function patchUpdates(_0x433972){return function(_0x340449){try{jsonpatch[_0xa1f5('0x1f')](_0x340449,_0x433972,!![]);}catch(_0x14c8ba){return BPromise[_0xa1f5('0x20')](_0x14c8ba);}return _0x340449[_0xa1f5('0x21')]();};}function saveUpdates(_0x18d055,_0x4fdd07){return function(_0xc6f067){if(_0xc6f067){return _0xc6f067[_0xa1f5('0x22')](_0x18d055)['then'](function(_0x1f52d4){return _0x1f52d4;});}return null;};}function removeEntity(_0x142d98,_0x316a1e){return function(_0x275c8a){if(_0x275c8a){return _0x275c8a[_0xa1f5('0x23')]()[_0xa1f5('0x24')](function(){_0x142d98[_0xa1f5('0x18')](0xcc)[_0xa1f5('0x25')]();});}};}function handleEntityNotFound(_0x52b3ba,_0x45b8e2){return function(_0x48d4bc){if(!_0x48d4bc){_0x52b3ba[_0xa1f5('0x17')](0x194);}return _0x48d4bc;};}function handleError(_0x3f7836,_0x49f7d0){_0x49f7d0=_0x49f7d0||0x1f4;return function(_0x59d6e3){logger[_0xa1f5('0x26')](_0x59d6e3['stack']);if(_0x59d6e3['name']){delete _0x59d6e3['name'];}_0x3f7836[_0xa1f5('0x18')](_0x49f7d0)[_0xa1f5('0x27')](_0x59d6e3);};}exports[_0xa1f5('0x28')]=function(_0x51f438,_0x543833){var _0x54b66d={},_0x21101d={},_0x1ad4d0={'count':0x0,'rows':[]};var _0x2e2556=_[_0xa1f5('0x29')](db[_0xa1f5('0x2a')][_0xa1f5('0x2b')],function(_0x29bbe6){return{'name':_0x29bbe6[_0xa1f5('0x2c')],'type':_0x29bbe6['type'][_0xa1f5('0x2d')]};});_0x21101d[_0xa1f5('0x2e')]=_[_0xa1f5('0x29')](_0x2e2556,'name');_0x21101d[_0xa1f5('0x2f')]=_[_0xa1f5('0x30')](_0x51f438['query']);_0x21101d[_0xa1f5('0x31')]=_[_0xa1f5('0x32')](_0x21101d[_0xa1f5('0x2e')],_0x21101d[_0xa1f5('0x2f')]);_0x54b66d[_0xa1f5('0x33')]=_[_0xa1f5('0x32')](_0x21101d['model'],qs[_0xa1f5('0x34')](_0x51f438[_0xa1f5('0x2f')]['fields']));_0x54b66d[_0xa1f5('0x33')]=_0x54b66d[_0xa1f5('0x33')][_0xa1f5('0x35')]?_0x54b66d[_0xa1f5('0x33')]:_0x21101d[_0xa1f5('0x2e')];if(!_0x51f438[_0xa1f5('0x2f')][_0xa1f5('0x36')](_0xa1f5('0x37'))){_0x54b66d['limit']=qs[_0xa1f5('0x1b')](_0x51f438[_0xa1f5('0x2f')][_0xa1f5('0x1b')]);_0x54b66d[_0xa1f5('0x19')]=qs[_0xa1f5('0x19')](_0x51f438['query'][_0xa1f5('0x19')]);}_0x54b66d['order']=qs[_0xa1f5('0x38')](_0x51f438[_0xa1f5('0x2f')]['sort']);_0x54b66d[_0xa1f5('0x39')]=qs['filters'](_['pick'](_0x51f438[_0xa1f5('0x2f')],_0x21101d[_0xa1f5('0x31')]),_0x2e2556);if(_0x51f438[_0xa1f5('0x2f')]['filter']){_0x54b66d[_0xa1f5('0x39')]=_[_0xa1f5('0x3a')](_0x54b66d[_0xa1f5('0x39')],{'$or':_[_0xa1f5('0x29')](_0x2e2556,function(_0x4ea099){if(_0x4ea099[_0xa1f5('0x3b')]!=='VIRTUAL'){var _0x34577d={};_0x34577d[_0x4ea099[_0xa1f5('0x3c')]]={'$like':'%'+_0x51f438[_0xa1f5('0x2f')][_0xa1f5('0x3d')]+'%'};return _0x34577d;}})});}_0x54b66d=_['merge']({},_0x54b66d,_0x51f438['options']);var _0xd35620={'where':_0x54b66d['where']};return db[_0xa1f5('0x2a')][_0xa1f5('0x1c')](_0xd35620)['then'](function(_0x647742){_0x1ad4d0['count']=_0x647742;if(_0x51f438[_0xa1f5('0x2f')][_0xa1f5('0x3e')]){_0x54b66d['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xa1f5('0x3f')](_0x54b66d);})[_0xa1f5('0x24')](function(_0x392369){_0x1ad4d0[_0xa1f5('0x40')]=_0x392369;return _0x1ad4d0;})[_0xa1f5('0x24')](respondWithFilteredResult(_0x543833,_0x54b66d))[_0xa1f5('0x41')](handleError(_0x543833,null));};exports[_0xa1f5('0x42')]=function(_0x4ab719,_0x4dff89){var _0x2faae4={'raw':![],'where':{'id':_0x4ab719['params']['id']}},_0x3a5ddb={};_0x3a5ddb[_0xa1f5('0x2e')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x3a5ddb[_0xa1f5('0x2f')]=_['keys'](_0x4ab719['query']);_0x3a5ddb[_0xa1f5('0x31')]=_[_0xa1f5('0x32')](_0x3a5ddb['model'],_0x3a5ddb[_0xa1f5('0x2f')]);_0x2faae4['attributes']=_[_0xa1f5('0x32')](_0x3a5ddb[_0xa1f5('0x2e')],qs[_0xa1f5('0x34')](_0x4ab719[_0xa1f5('0x2f')][_0xa1f5('0x34')]));_0x2faae4['attributes']=_0x2faae4[_0xa1f5('0x33')][_0xa1f5('0x35')]?_0x2faae4['attributes']:_0x3a5ddb[_0xa1f5('0x2e')];if(_0x4ab719['query'][_0xa1f5('0x3e')]){_0x2faae4[_0xa1f5('0x43')]=[{'all':!![]}];}_0x2faae4=_[_0xa1f5('0x3a')]({},_0x2faae4,_0x4ab719[_0xa1f5('0x44')]);return db[_0xa1f5('0x2a')][_0xa1f5('0x45')](_0x2faae4)[_0xa1f5('0x24')](handleEntityNotFound(_0x4dff89,null))['then'](respondWithResult(_0x4dff89,null))[_0xa1f5('0x41')](handleError(_0x4dff89,null));};exports['create']=function(_0x2c7542,_0x1e687f){return db[_0xa1f5('0x2a')]['create'](_0x2c7542[_0xa1f5('0x46')],{})[_0xa1f5('0x24')](respondWithResult(_0x1e687f,0xc9))[_0xa1f5('0x41')](handleError(_0x1e687f,null));};exports[_0xa1f5('0x22')]=function(_0x4a1f03,_0x268e22){if(_0x4a1f03[_0xa1f5('0x46')]['id']){delete _0x4a1f03[_0xa1f5('0x46')]['id'];}return db[_0xa1f5('0x2a')]['find']({'where':{'id':_0x4a1f03[_0xa1f5('0x47')]['id']}})[_0xa1f5('0x24')](handleEntityNotFound(_0x268e22,null))[_0xa1f5('0x24')](saveUpdates(_0x4a1f03[_0xa1f5('0x46')],null))[_0xa1f5('0x24')](respondWithResult(_0x268e22,null))[_0xa1f5('0x41')](handleError(_0x268e22,null));};exports['destroy']=function(_0x207e37,_0x1a6299){return db[_0xa1f5('0x2a')][_0xa1f5('0x45')]({'where':{'id':_0x207e37[_0xa1f5('0x47')]['id']}})[_0xa1f5('0x24')](handleEntityNotFound(_0x1a6299,null))[_0xa1f5('0x24')](removeEntity(_0x1a6299,null))['catch'](handleError(_0x1a6299,null));};exports[_0xa1f5('0x48')]=function(_0x292e64,_0x5ca09d,_0x2b292c){var _0x4cfcd3={};var _0x42dd83={};var _0x27ad4f;var _0x45d192;return db[_0xa1f5('0x2a')]['findOne']({'where':{'id':_0x292e64[_0xa1f5('0x47')]['id']}})[_0xa1f5('0x24')](handleEntityNotFound(_0x5ca09d,null))[_0xa1f5('0x24')](function(_0x5e1d06){if(_0x5e1d06){_0x27ad4f=_0x5e1d06;_0x42dd83[_0xa1f5('0x2e')]=_[_0xa1f5('0x30')](db[_0xa1f5('0x49')][_0xa1f5('0x2b')]);_0x42dd83[_0xa1f5('0x2f')]=_[_0xa1f5('0x30')](_0x292e64[_0xa1f5('0x2f')]);_0x42dd83[_0xa1f5('0x31')]=_[_0xa1f5('0x32')](_0x42dd83[_0xa1f5('0x2e')],_0x42dd83['query']);_0x4cfcd3[_0xa1f5('0x33')]=_[_0xa1f5('0x32')](_0x42dd83[_0xa1f5('0x2e')],qs[_0xa1f5('0x34')](_0x292e64[_0xa1f5('0x2f')][_0xa1f5('0x34')]));_0x4cfcd3[_0xa1f5('0x33')]=_0x4cfcd3[_0xa1f5('0x33')]['length']?_0x4cfcd3['attributes']:_0x42dd83[_0xa1f5('0x2e')];_0x4cfcd3['order']=qs[_0xa1f5('0x38')](_0x292e64[_0xa1f5('0x2f')][_0xa1f5('0x38')]);_0x4cfcd3[_0xa1f5('0x39')]=qs[_0xa1f5('0x31')](_[_0xa1f5('0x4a')](_0x292e64['query'],_0x42dd83['filters']));if(_0x292e64[_0xa1f5('0x2f')][_0xa1f5('0x3d')]){_0x4cfcd3[_0xa1f5('0x39')]=_['merge'](_0x4cfcd3[_0xa1f5('0x39')],{'$or':_[_0xa1f5('0x29')](_0x4cfcd3['attributes'],function(_0x39ba82){var _0x274e71={};_0x274e71[_0x39ba82]={'$like':'%'+_0x292e64[_0xa1f5('0x2f')][_0xa1f5('0x3d')]+'%'};return _0x274e71;})});}_0x4cfcd3=_[_0xa1f5('0x3a')]({},_0x4cfcd3,_0x292e64[_0xa1f5('0x44')]);return _0x27ad4f[_0xa1f5('0x48')](_0x4cfcd3);}})['then'](function(_0x5bdfc0){if(_0x5bdfc0){_0x45d192=_0x5bdfc0[_0xa1f5('0x35')];if(!_0x292e64[_0xa1f5('0x2f')][_0xa1f5('0x36')]('nolimit')){_0x4cfcd3[_0xa1f5('0x1b')]=qs[_0xa1f5('0x1b')](_0x292e64['query'][_0xa1f5('0x1b')]);_0x4cfcd3[_0xa1f5('0x19')]=qs[_0xa1f5('0x19')](_0x292e64[_0xa1f5('0x2f')][_0xa1f5('0x19')]);}return _0x27ad4f[_0xa1f5('0x48')](_0x4cfcd3);}})['then'](function(_0x26fdd3){if(_0x26fdd3){return _0x26fdd3?{'count':_0x45d192,'rows':_0x26fdd3}:null;}})[_0xa1f5('0x24')](respondWithResult(_0x5ca09d,null))[_0xa1f5('0x41')](handleError(_0x5ca09d,null));};exports[_0xa1f5('0x4b')]=function(_0x34383d,_0x4c94ee,_0x132eff){if(_0x34383d[_0xa1f5('0x46')]['id']){delete _0x34383d[_0xa1f5('0x46')]['id'];}return db[_0xa1f5('0x2a')][_0xa1f5('0x4c')]({'where':{'id':_0x34383d[_0xa1f5('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c94ee,null))['then'](function(_0xd664f){if(_0xd664f){_0x34383d[_0xa1f5('0x46')]['AccountId']=_0xd664f['id'];_0x34383d[_0xa1f5('0x46')]['Subjects']=integrations[_0xa1f5('0x4d')](_0x34383d[_0xa1f5('0x46')][_0xa1f5('0x4e')],_0x34383d[_0xa1f5('0x46')][_0xa1f5('0x3b')]);_0x34383d[_0xa1f5('0x46')][_0xa1f5('0x4f')]=integrations[_0xa1f5('0x50')](_0x34383d['body']['channel'],_0x34383d['body']['type']);return db[_0xa1f5('0x49')][_0xa1f5('0x51')](_0x34383d['body'],{'include':[{'model':db[_0xa1f5('0x52')],'as':_0xa1f5('0x53')},{'model':db[_0xa1f5('0x52')],'as':_0xa1f5('0x4f')}]});}return null;})[_0xa1f5('0x24')](respondWithResult(_0x4c94ee,null))[_0xa1f5('0x41')](handleError(_0x4c94ee,null));};function getAccessToken(_0x310b64){return new Promise(function(_0x582b5c,_0x249a4a){var _0x40522f;switch(_0x310b64[_0xa1f5('0x54')]){case'US':_0x40522f=_0xa1f5('0x55');break;case'AU':_0x40522f=_0xa1f5('0x56');break;case'EU':_0x40522f=_0xa1f5('0x57');break;case'IN':_0x40522f=_0xa1f5('0x58');break;case'CN':_0x40522f=_0xa1f5('0x59');break;default:_0x40522f=_0xa1f5('0x57');break;}var _0x4d980e={'method':'POST','uri':_0x40522f+_0xa1f5('0x5a'),'qs':{'refresh_token':_0x310b64[_0xa1f5('0x5b')],'client_id':_0x310b64[_0xa1f5('0x5c')],'client_secret':_0x310b64[_0xa1f5('0x5d')],'grant_type':_0xa1f5('0x5e')},'json':!![]};return rp(_0x4d980e)[_0xa1f5('0x24')](function(_0x3f3f55){if(_0x3f3f55[_0xa1f5('0x5f')]){_0x582b5c(_0x3f3f55[_0xa1f5('0x5f')]);}else{_0x249a4a(_0xa1f5('0x60'));}})[_0xa1f5('0x41')](function(_0x912bf8){_0x249a4a(_0x912bf8);});});}exports[_0xa1f5('0x61')]=function(_0x1642ff,_0xd57cc9,_0x312d40){var _0x395fd6,_0x29970a,_0x7ace3b,_0x1a23a1,_0x569341;return db[_0xa1f5('0x2a')][_0xa1f5('0x4c')]({'where':{'id':_0x1642ff[_0xa1f5('0x47')]['id']},'attributes':['id',_0xa1f5('0x62'),_0xa1f5('0x54'),_0xa1f5('0x5c'),'clientSecret',_0xa1f5('0x63'),_0xa1f5('0x64'),_0xa1f5('0x5b')]})[_0xa1f5('0x24')](handleEntityNotFound(_0xd57cc9,null))[_0xa1f5('0x24')](function(_0xe81a7f){_0x569341=_0xe81a7f;_0x395fd6=_0x569341['host'];_0x29970a=_0x395fd6==='zoho.eu'?'eu':_0xa1f5('0x65');_0x7ace3b=_0x569341[_0xa1f5('0x63')];var _0x2f60fd=_0x7ace3b[_0xa1f5('0x66')](-0x1);if(_0x2f60fd==='/'||_0x2f60fd==='\x5c'||_0x2f60fd===':'){_0x7ace3b=_0x7ace3b[_0xa1f5('0x67')](0x0,_0x7ace3b['lastIndexOf'](_0x2f60fd));}if(!_0x569341['refreshToken']){throw new Error(_0xa1f5('0x68'));}return getAccessToken(_0x569341);})['then'](function(_0x4c6630){if(_0x4c6630){return rp({'method':_0xa1f5('0x69'),'uri':util[_0xa1f5('0x6a')](_0xa1f5('0x6b'),_0x29970a),'qs':{'module':_0xa1f5('0x6c')},'headers':{'Authorization':_0xa1f5('0x6d')+_0x4c6630},'json':!![]});}})[_0xa1f5('0x24')](function(_0x478dbb){if(_0x478dbb){if(_0x478dbb['response']&&_0x478dbb['response'][_0xa1f5('0x26')]){throw new Error(_0x478dbb['response']['error'][_0xa1f5('0x6e')]);}var _0x8aee31=[];var _0x56462c=[];var _0x3b2e9e=[_0xa1f5('0x6f'),_0xa1f5('0x70'),_0xa1f5('0x71'),_0xa1f5('0x72'),_0xa1f5('0x73'),'Call_Result','Call_Start_Time',_0xa1f5('0x74')];_0x56462c=_[_0xa1f5('0x75')](_0x478dbb['fields'],function(_0x4eaa13){return _0x3b2e9e[_0xa1f5('0x76')](_0x4eaa13[_0xa1f5('0x77')]);});for(var _0x121283=0x0;_0x121283<_0x56462c[_0xa1f5('0x35')];_0x121283++){if(_0x56462c[_0x121283][_0xa1f5('0x78')]===![]){_0x8aee31[_0xa1f5('0x79')]({'id':_0x56462c[_0x121283]['id'],'name':_0x56462c[_0x121283][_0xa1f5('0x7a')],'custom':_0x56462c[_0x121283][_0xa1f5('0x7b')],'options':_0x56462c[_0x121283][_0xa1f5('0x7c')]==='picklist'&&_0x56462c[_0x121283][_0xa1f5('0x7d')][_0xa1f5('0x35')]>-0x1?_['map'](_0x56462c[_0x121283][_0xa1f5('0x7d')],function(_0x434ded){return{'name':_0x434ded,'value':_0x434ded};}):[]});}}return{'count':_0x8aee31[_0xa1f5('0x35')],'rows':_0x8aee31};}else{return{'count':0x0,'rows':[]};}})[_0xa1f5('0x24')](respondWithResult(_0xd57cc9,null))[_0xa1f5('0x41')](function(_0x5c40ab){var _0x57ff3d=_0x1642ff['query'][_0xa1f5('0x7e')]?0x1f4:_0x5c40ab[_0xa1f5('0x7f')]||0x1f4;logger[_0xa1f5('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xa1f5('0x61'),_0x57ff3d,JSON[_0xa1f5('0x80')](_0x5c40ab));delete _0x5c40ab['name'];if(_0x57ff3d===0x191){_0x57ff3d=0x190;}_0xd57cc9['status'](_0x57ff3d)['send'](_0x1642ff[_0xa1f5('0x2f')][_0xa1f5('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x5c40ab[_0xa1f5('0x7f')]}:_0x5c40ab);});}; \ No newline at end of file +var _0x2be5=['Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','Call_Result','Call_Type','remove','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','sendStatus','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','ZohoConfiguration','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','access_token'];(function(_0x5b042a,_0x5897ba){var _0x128711=function(_0x29f285){while(--_0x29f285){_0x5b042a['push'](_0x5b042a['shift']());}};_0x128711(++_0x5897ba);}(_0x2be5,0x1a6));var _0x52be=function(_0x422c78,_0x562821){_0x422c78=_0x422c78-0x0;var _0x191cdf=_0x2be5[_0x422c78];return _0x191cdf;};'use strict';var emlformat=require(_0x52be('0x0'));var rimraf=require(_0x52be('0x1'));var zipdir=require(_0x52be('0x2'));var jsonpatch=require(_0x52be('0x3'));var rp=require(_0x52be('0x4'));var moment=require('moment');var BPromise=require(_0x52be('0x5'));var Mustache=require(_0x52be('0x6'));var util=require(_0x52be('0x7'));var path=require(_0x52be('0x8'));var sox=require(_0x52be('0x9'));var csv=require(_0x52be('0xa'));var ejs=require(_0x52be('0xb'));var fs=require('fs');var fs_extra=require(_0x52be('0xc'));var _=require(_0x52be('0xd'));var squel=require('squel');var crypto=require(_0x52be('0xe'));var jsforce=require(_0x52be('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x52be('0xa'));var querystring=require(_0x52be('0x10'));var Papa=require(_0x52be('0x11'));var Redis=require(_0x52be('0x12'));var authService=require(_0x52be('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x52be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52be('0x15'))(_0x52be('0x16'));var utils=require(_0x52be('0x17'));var config=require(_0x52be('0x18'));var licenseUtil=require(_0x52be('0x19'));var db=require(_0x52be('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x58f841,_0x59cc28){_0x59cc28=_0x59cc28||0xcc;return function(_0x19e26a){if(_0x19e26a){return _0x58f841['sendStatus'](_0x59cc28);}return _0x58f841[_0x52be('0x1b')](_0x59cc28)[_0x52be('0x1c')]();};}function respondWithResult(_0x12346c,_0x2e20c7){_0x2e20c7=_0x2e20c7||0xc8;return function(_0x4c69fd){if(_0x4c69fd){return _0x12346c[_0x52be('0x1b')](_0x2e20c7)[_0x52be('0x1d')](_0x4c69fd);}};}function respondWithFilteredResult(_0x2e6d9d,_0x2840d7){return function(_0x4f6635){if(_0x4f6635){var _0x49c9fd=typeof _0x2840d7[_0x52be('0x1e')]===_0x52be('0x1f')&&typeof _0x2840d7[_0x52be('0x20')]===_0x52be('0x1f');var _0x20c02a=_0x4f6635['count'];var _0x562582=_0x49c9fd?0x0:_0x2840d7[_0x52be('0x1e')];var _0x2695f1=_0x49c9fd?_0x4f6635[_0x52be('0x21')]:_0x2840d7[_0x52be('0x1e')]+_0x2840d7[_0x52be('0x20')];var _0x370fec;if(_0x2695f1>=_0x20c02a){_0x2695f1=_0x20c02a;_0x370fec=0xc8;}else{_0x370fec=0xce;}_0x2e6d9d[_0x52be('0x1b')](_0x370fec);return _0x2e6d9d[_0x52be('0x22')]('Content-Range',_0x562582+'-'+_0x2695f1+'/'+_0x20c02a)['json'](_0x4f6635);}return null;};}function patchUpdates(_0x4df30c){return function(_0x4409ea){try{jsonpatch[_0x52be('0x23')](_0x4409ea,_0x4df30c,!![]);}catch(_0x2db8fd){return BPromise[_0x52be('0x24')](_0x2db8fd);}return _0x4409ea['save']();};}function saveUpdates(_0x24c1a2,_0x3e73f){return function(_0x2dda7d){if(_0x2dda7d){return _0x2dda7d[_0x52be('0x25')](_0x24c1a2)[_0x52be('0x26')](function(_0x31eea0){return _0x31eea0;});}return null;};}function removeEntity(_0xb149d1,_0x1ce924){return function(_0x57c2b8){if(_0x57c2b8){return _0x57c2b8['destroy']()[_0x52be('0x26')](function(){_0xb149d1[_0x52be('0x1b')](0xcc)[_0x52be('0x1c')]();});}};}function handleEntityNotFound(_0x4ac89b,_0x48a500){return function(_0x3b9970){if(!_0x3b9970){_0x4ac89b[_0x52be('0x27')](0x194);}return _0x3b9970;};}function handleError(_0x4baa2a,_0x2a586a){_0x2a586a=_0x2a586a||0x1f4;return function(_0x5b3139){logger[_0x52be('0x28')](_0x5b3139[_0x52be('0x29')]);if(_0x5b3139[_0x52be('0x2a')]){delete _0x5b3139[_0x52be('0x2a')];}_0x4baa2a[_0x52be('0x1b')](_0x2a586a)['send'](_0x5b3139);};}exports[_0x52be('0x2b')]=function(_0x44d498,_0xbd6a2e){var _0x843f1c={},_0x1364f4={},_0x30d12b={'count':0x0,'rows':[]};var _0x1e3c42=_[_0x52be('0x2c')](db[_0x52be('0x2d')][_0x52be('0x2e')],function(_0xde1599){return{'name':_0xde1599[_0x52be('0x2f')],'type':_0xde1599[_0x52be('0x30')]['key']};});_0x1364f4[_0x52be('0x31')]=_['map'](_0x1e3c42,_0x52be('0x2a'));_0x1364f4[_0x52be('0x32')]=_[_0x52be('0x33')](_0x44d498[_0x52be('0x32')]);_0x1364f4['filters']=_[_0x52be('0x34')](_0x1364f4['model'],_0x1364f4[_0x52be('0x32')]);_0x843f1c[_0x52be('0x35')]=_[_0x52be('0x34')](_0x1364f4[_0x52be('0x31')],qs[_0x52be('0x36')](_0x44d498[_0x52be('0x32')]['fields']));_0x843f1c[_0x52be('0x35')]=_0x843f1c[_0x52be('0x35')]['length']?_0x843f1c[_0x52be('0x35')]:_0x1364f4[_0x52be('0x31')];if(!_0x44d498['query'][_0x52be('0x37')](_0x52be('0x38'))){_0x843f1c['limit']=qs[_0x52be('0x20')](_0x44d498['query']['limit']);_0x843f1c['offset']=qs[_0x52be('0x1e')](_0x44d498['query'][_0x52be('0x1e')]);}_0x843f1c[_0x52be('0x39')]=qs[_0x52be('0x3a')](_0x44d498[_0x52be('0x32')][_0x52be('0x3a')]);_0x843f1c['where']=qs[_0x52be('0x3b')](_[_0x52be('0x3c')](_0x44d498[_0x52be('0x32')],_0x1364f4[_0x52be('0x3b')]),_0x1e3c42);if(_0x44d498[_0x52be('0x32')][_0x52be('0x3d')]){_0x843f1c[_0x52be('0x3e')]=_[_0x52be('0x3f')](_0x843f1c[_0x52be('0x3e')],{'$or':_[_0x52be('0x2c')](_0x1e3c42,function(_0x1f06a3){if(_0x1f06a3['type']!==_0x52be('0x40')){var _0x5494c3={};_0x5494c3[_0x1f06a3[_0x52be('0x2a')]]={'$like':'%'+_0x44d498[_0x52be('0x32')][_0x52be('0x3d')]+'%'};return _0x5494c3;}})});}_0x843f1c=_[_0x52be('0x3f')]({},_0x843f1c,_0x44d498[_0x52be('0x41')]);var _0x2594fb={'where':_0x843f1c[_0x52be('0x3e')]};return db[_0x52be('0x2d')]['count'](_0x2594fb)[_0x52be('0x26')](function(_0x27ba34){_0x30d12b[_0x52be('0x21')]=_0x27ba34;if(_0x44d498[_0x52be('0x32')][_0x52be('0x42')]){_0x843f1c[_0x52be('0x43')]=[{'all':!![]}];}return db[_0x52be('0x2d')]['findAll'](_0x843f1c);})[_0x52be('0x26')](function(_0x29834f){_0x30d12b[_0x52be('0x44')]=_0x29834f;return _0x30d12b;})[_0x52be('0x26')](respondWithFilteredResult(_0xbd6a2e,_0x843f1c))[_0x52be('0x45')](handleError(_0xbd6a2e,null));};exports[_0x52be('0x46')]=function(_0x35550a,_0x52f8de){var _0x533387={'raw':![],'where':{'id':_0x35550a[_0x52be('0x47')]['id']}},_0x1ed985={};_0x1ed985[_0x52be('0x31')]=_[_0x52be('0x33')](db[_0x52be('0x2d')]['rawAttributes']);_0x1ed985[_0x52be('0x32')]=_[_0x52be('0x33')](_0x35550a[_0x52be('0x32')]);_0x1ed985[_0x52be('0x3b')]=_[_0x52be('0x34')](_0x1ed985[_0x52be('0x31')],_0x1ed985['query']);_0x533387[_0x52be('0x35')]=_[_0x52be('0x34')](_0x1ed985[_0x52be('0x31')],qs['fields'](_0x35550a[_0x52be('0x32')][_0x52be('0x36')]));_0x533387[_0x52be('0x35')]=_0x533387[_0x52be('0x35')][_0x52be('0x48')]?_0x533387[_0x52be('0x35')]:_0x1ed985[_0x52be('0x31')];if(_0x35550a[_0x52be('0x32')][_0x52be('0x42')]){_0x533387['include']=[{'all':!![]}];}_0x533387=_['merge']({},_0x533387,_0x35550a[_0x52be('0x41')]);return db['ZohoAccount'][_0x52be('0x49')](_0x533387)[_0x52be('0x26')](handleEntityNotFound(_0x52f8de,null))[_0x52be('0x26')](respondWithResult(_0x52f8de,null))[_0x52be('0x45')](handleError(_0x52f8de,null));};exports[_0x52be('0x4a')]=function(_0x359dba,_0x47faa6){return db[_0x52be('0x2d')]['create'](_0x359dba[_0x52be('0x4b')],{})[_0x52be('0x26')](respondWithResult(_0x47faa6,0xc9))[_0x52be('0x45')](handleError(_0x47faa6,null));};exports[_0x52be('0x25')]=function(_0x359313,_0x3ba891){if(_0x359313[_0x52be('0x4b')]['id']){delete _0x359313[_0x52be('0x4b')]['id'];}return db[_0x52be('0x2d')][_0x52be('0x49')]({'where':{'id':_0x359313[_0x52be('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ba891,null))[_0x52be('0x26')](saveUpdates(_0x359313['body'],null))[_0x52be('0x26')](respondWithResult(_0x3ba891,null))['catch'](handleError(_0x3ba891,null));};exports[_0x52be('0x4c')]=function(_0x5f4462,_0xa9a8ae){return db['ZohoAccount']['find']({'where':{'id':_0x5f4462[_0x52be('0x47')]['id']}})[_0x52be('0x26')](handleEntityNotFound(_0xa9a8ae,null))['then'](removeEntity(_0xa9a8ae,null))[_0x52be('0x45')](handleError(_0xa9a8ae,null));};exports['getConfigurations']=function(_0x2c9af7,_0x371f83,_0x324f4a){var _0x1b126b={};var _0x382543={};var _0x2553ba;var _0x417527;return db[_0x52be('0x2d')][_0x52be('0x4d')]({'where':{'id':_0x2c9af7[_0x52be('0x47')]['id']}})[_0x52be('0x26')](handleEntityNotFound(_0x371f83,null))[_0x52be('0x26')](function(_0x33b4bf){if(_0x33b4bf){_0x2553ba=_0x33b4bf;_0x382543[_0x52be('0x31')]=_[_0x52be('0x33')](db['ZohoConfiguration'][_0x52be('0x2e')]);_0x382543[_0x52be('0x32')]=_[_0x52be('0x33')](_0x2c9af7[_0x52be('0x32')]);_0x382543[_0x52be('0x3b')]=_[_0x52be('0x34')](_0x382543[_0x52be('0x31')],_0x382543[_0x52be('0x32')]);_0x1b126b['attributes']=_[_0x52be('0x34')](_0x382543['model'],qs[_0x52be('0x36')](_0x2c9af7[_0x52be('0x32')][_0x52be('0x36')]));_0x1b126b['attributes']=_0x1b126b[_0x52be('0x35')][_0x52be('0x48')]?_0x1b126b['attributes']:_0x382543['model'];_0x1b126b[_0x52be('0x39')]=qs[_0x52be('0x3a')](_0x2c9af7['query'][_0x52be('0x3a')]);_0x1b126b[_0x52be('0x3e')]=qs[_0x52be('0x3b')](_[_0x52be('0x3c')](_0x2c9af7[_0x52be('0x32')],_0x382543[_0x52be('0x3b')]));if(_0x2c9af7['query']['filter']){_0x1b126b[_0x52be('0x3e')]=_[_0x52be('0x3f')](_0x1b126b[_0x52be('0x3e')],{'$or':_[_0x52be('0x2c')](_0x1b126b[_0x52be('0x35')],function(_0x217546){var _0x12342a={};_0x12342a[_0x217546]={'$like':'%'+_0x2c9af7[_0x52be('0x32')]['filter']+'%'};return _0x12342a;})});}_0x1b126b=_[_0x52be('0x3f')]({},_0x1b126b,_0x2c9af7[_0x52be('0x41')]);return _0x2553ba['getConfigurations'](_0x1b126b);}})[_0x52be('0x26')](function(_0x540b2e){if(_0x540b2e){_0x417527=_0x540b2e[_0x52be('0x48')];if(!_0x2c9af7[_0x52be('0x32')][_0x52be('0x37')]('nolimit')){_0x1b126b[_0x52be('0x20')]=qs['limit'](_0x2c9af7['query'][_0x52be('0x20')]);_0x1b126b[_0x52be('0x1e')]=qs[_0x52be('0x1e')](_0x2c9af7[_0x52be('0x32')][_0x52be('0x1e')]);}return _0x2553ba['getConfigurations'](_0x1b126b);}})[_0x52be('0x26')](function(_0x1aa4b8){if(_0x1aa4b8){return _0x1aa4b8?{'count':_0x417527,'rows':_0x1aa4b8}:null;}})['then'](respondWithResult(_0x371f83,null))[_0x52be('0x45')](handleError(_0x371f83,null));};exports[_0x52be('0x4e')]=function(_0x481b6a,_0x268e8e,_0x2481a4){if(_0x481b6a['body']['id']){delete _0x481b6a[_0x52be('0x4b')]['id'];}return db[_0x52be('0x2d')]['findOne']({'where':{'id':_0x481b6a[_0x52be('0x47')]['id']}})[_0x52be('0x26')](handleEntityNotFound(_0x268e8e,null))['then'](function(_0x122bdc){if(_0x122bdc){_0x481b6a[_0x52be('0x4b')][_0x52be('0x4f')]=_0x122bdc['id'];_0x481b6a[_0x52be('0x4b')][_0x52be('0x50')]=integrations[_0x52be('0x51')](_0x481b6a['body'][_0x52be('0x52')],_0x481b6a[_0x52be('0x4b')]['type']);_0x481b6a[_0x52be('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x481b6a[_0x52be('0x4b')]['channel'],_0x481b6a[_0x52be('0x4b')]['type']);return db[_0x52be('0x53')][_0x52be('0x4a')](_0x481b6a[_0x52be('0x4b')],{'include':[{'model':db['ZohoField'],'as':_0x52be('0x50')},{'model':db[_0x52be('0x54')],'as':_0x52be('0x55')}]});}return null;})[_0x52be('0x26')](respondWithResult(_0x268e8e,null))[_0x52be('0x45')](handleError(_0x268e8e,null));};function getAccessToken(_0x5abe98){return new Promise(function(_0xe4fa8a,_0xbce7b2){var _0x2be78d;switch(_0x5abe98[_0x52be('0x56')]){case'US':_0x2be78d=_0x52be('0x57');break;case'AU':_0x2be78d=_0x52be('0x58');break;case'EU':_0x2be78d='https://accounts.zoho.eu';break;case'IN':_0x2be78d=_0x52be('0x59');break;case'CN':_0x2be78d=_0x52be('0x5a');break;default:_0x2be78d=_0x52be('0x5b');break;}var _0x3aaef5={'method':_0x52be('0x5c'),'uri':_0x2be78d+'/oauth/v2/token','qs':{'refresh_token':_0x5abe98[_0x52be('0x5d')],'client_id':_0x5abe98[_0x52be('0x5e')],'client_secret':_0x5abe98[_0x52be('0x5f')],'grant_type':_0x52be('0x60')},'json':!![]};return rp(_0x3aaef5)['then'](function(_0x3627f2){if(_0x3627f2[_0x52be('0x61')]){_0xe4fa8a(_0x3627f2[_0x52be('0x61')]);}else{_0xbce7b2(_0x52be('0x62'));}})[_0x52be('0x45')](function(_0x3c7253){_0xbce7b2(_0x3c7253);});});}exports[_0x52be('0x63')]=function(_0x4f7e80,_0x33c0c2,_0x434f37){var _0x32c3e2,_0x38cea5,_0x595b6d,_0x50f76b,_0x331c11;return db[_0x52be('0x2d')][_0x52be('0x4d')]({'where':{'id':_0x4f7e80[_0x52be('0x47')]['id']},'attributes':['id','host','zone','clientId',_0x52be('0x5f'),_0x52be('0x64'),_0x52be('0x65'),'refreshToken']})['then'](handleEntityNotFound(_0x33c0c2,null))[_0x52be('0x26')](function(_0x206d1e){_0x331c11=_0x206d1e;_0x32c3e2=_0x331c11[_0x52be('0x66')];_0x38cea5=_0x32c3e2===_0x52be('0x67')?'eu':_0x52be('0x68');_0x595b6d=_0x331c11['serverUrl'];var _0x1aa810=_0x595b6d['slice'](-0x1);if(_0x1aa810==='/'||_0x1aa810==='\x5c'||_0x1aa810===':'){_0x595b6d=_0x595b6d[_0x52be('0x69')](0x0,_0x595b6d[_0x52be('0x6a')](_0x1aa810));}if(!_0x331c11[_0x52be('0x5d')]){throw new Error(_0x52be('0x6b'));}return getAccessToken(_0x331c11);})[_0x52be('0x26')](function(_0x4821ed){if(_0x4821ed){return rp({'method':_0x52be('0x6c'),'uri':util['format'](_0x52be('0x6d'),_0x38cea5),'qs':{'module':_0x52be('0x6e')},'headers':{'Authorization':_0x52be('0x6f')+_0x4821ed},'json':!![]});}})[_0x52be('0x26')](function(_0x396a38){if(_0x396a38){if(_0x396a38[_0x52be('0x70')]&&_0x396a38[_0x52be('0x70')][_0x52be('0x28')]){throw new Error(_0x396a38[_0x52be('0x70')][_0x52be('0x28')][_0x52be('0x71')]);}var _0x5a7f38=[];var _0x2c7172=[];var _0x34fdf2=[_0x52be('0x72'),'Subject',_0x52be('0x73'),'WhoId','Call_Duration',_0x52be('0x74'),'Call_Start_Time',_0x52be('0x75')];_0x2c7172=_[_0x52be('0x76')](_0x396a38[_0x52be('0x36')],function(_0x1960dd){return _0x34fdf2['includes'](_0x1960dd[_0x52be('0x77')]);});for(var _0x50bc6d=0x0;_0x50bc6d<_0x2c7172[_0x52be('0x48')];_0x50bc6d++){if(_0x2c7172[_0x50bc6d]['system_mandatory']===![]){_0x5a7f38[_0x52be('0x78')]({'id':_0x2c7172[_0x50bc6d]['id'],'name':_0x2c7172[_0x50bc6d][_0x52be('0x79')],'custom':_0x2c7172[_0x50bc6d][_0x52be('0x7a')],'options':_0x2c7172[_0x50bc6d][_0x52be('0x7b')]===_0x52be('0x7c')&&_0x2c7172[_0x50bc6d][_0x52be('0x7d')][_0x52be('0x48')]>-0x1?_['map'](_0x2c7172[_0x50bc6d][_0x52be('0x7d')],function(_0x27d1a5){return{'name':_0x27d1a5,'value':_0x27d1a5};}):[]});}}return{'count':_0x5a7f38[_0x52be('0x48')],'rows':_0x5a7f38};}else{return{'count':0x0,'rows':[]};}})[_0x52be('0x26')](respondWithResult(_0x33c0c2,null))['catch'](function(_0x25f2f6){var _0x105cc9=_0x4f7e80[_0x52be('0x32')][_0x52be('0x7e')]?0x1f4:_0x25f2f6[_0x52be('0x7f')]||0x1f4;logger[_0x52be('0x28')](_0x52be('0x80'),'getFields',_0x105cc9,JSON['stringify'](_0x25f2f6));delete _0x25f2f6['name'];if(_0x105cc9===0x191){_0x105cc9=0x190;}_0x33c0c2[_0x52be('0x1b')](_0x105cc9)[_0x52be('0x81')](_0x4f7e80[_0x52be('0x32')][_0x52be('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x25f2f6['statusCode']}:_0x25f2f6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c7c4389..471812e 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 _0x3761=['POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','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','catch','https://accounts.zoho.eu','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x2b01f2,_0x1a406c){var _0x4893be=function(_0xa1ae6f){while(--_0xa1ae6f){_0x2b01f2['push'](_0x2b01f2['shift']());}};_0x4893be(++_0x1a406c);}(_0x3761,0x8a));var _0x1376=function(_0x862c70,_0x5ca798){_0x862c70=_0x862c70-0x0;var _0x423b3d=_0x3761[_0x862c70];return _0x423b3d;};'use strict';var _=require('lodash');var util=require(_0x1376('0x0'));var logger=require(_0x1376('0x1'))(_0x1376('0x2'));var moment=require(_0x1376('0x3'));var BPromise=require(_0x1376('0x4'));var rp=require(_0x1376('0x5'));var fs=require('fs');var path=require(_0x1376('0x6'));var rimraf=require('rimraf');var config=require(_0x1376('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x1376('0x8'));module[_0x1376('0x9')]=function(_0x56c703,_0x3df2e3){return _0x56c703['define'](_0x1376('0xa'),attributes,{'tableName':_0x1376('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ec290,_0xf33ff6,_0x40e603){if(_0x2ec290[_0x1376('0xc')](_0x1376('0xd'))||_0x2ec290['changed']('serverUrl')||_0x2ec290[_0x1376('0xc')](_0x1376('0xe'))||_0x2ec290['changed'](_0x1376('0xf'))||_0x2ec290[_0x1376('0xc')](_0x1376('0x10'))||_0x2ec290[_0x1376('0xc')](_0x1376('0x11'))){var _0x27c397,_0x174f43;_0x27c397=_0x2ec290[_0x1376('0x12')];var _0x4e9654=_0x27c397[_0x1376('0x13')](-0x1);if(_0x4e9654==='/'||_0x4e9654==='\x5c'||_0x4e9654===':'){_0x27c397=_0x27c397[_0x1376('0x14')](0x0,_0x27c397[_0x1376('0x15')](_0x4e9654));}switch(_0x2ec290[_0x1376('0xd')]){case'US':_0x174f43=_0x1376('0x16');break;case'AU':_0x174f43=_0x1376('0x17');break;case'IN':_0x174f43=_0x1376('0x18');break;case'CN':_0x174f43=_0x1376('0x19');break;default:_0x174f43='https://accounts.zoho.eu';break;}var _0x2e6a5d={'method':_0x1376('0x1a'),'uri':_0x174f43+_0x1376('0x1b'),'form':{'grant_type':_0x1376('0x1c'),'client_id':_0x2ec290[_0x1376('0xe')],'client_secret':_0x2ec290['clientSecret'],'redirect_uri':_0x2ec290['serverUrl'],'code':_0x2ec290[_0x1376('0x10')]},'headers':{'Content-Type':_0x1376('0x1d')}};return rp(_0x2e6a5d)[_0x1376('0x1e')](function(_0x4b3c01){var _0x302daf=JSON[_0x1376('0x1f')](_0x4b3c01);if(_0x302daf[_0x1376('0x20')]){_0x2ec290['refreshToken']=_0x302daf[_0x1376('0x20')];logger['info'](util[_0x1376('0x21')](_0x1376('0x22'),_0x2ec290[_0x1376('0x23')],_0x2ec290['id']));}else{logger[_0x1376('0x24')](util[_0x1376('0x21')](_0x1376('0x25'),_0x2ec290[_0x1376('0x23')],_0x2ec290['id']),util[_0x1376('0x26')](_0x302daf,{'showHidden':![],'depth':null}));}return _0x40e603(null,_0xf33ff6);})[_0x1376('0x27')](function(_0x4ac7c5){logger[_0x1376('0x24')](util[_0x1376('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2ec290['name'],_0x2ec290['id']),util[_0x1376('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x40e603(_0x4ac7c5);});}else{return _0x40e603(null,_0xf33ff6);}},'beforeUpdate':function(_0x4f82be,_0x1896c2,_0x3ab2f5){if(_0x4f82be['changed']('zone')||_0x4f82be[_0x1376('0xc')](_0x1376('0x12'))||_0x4f82be[_0x1376('0xc')](_0x1376('0xe'))||_0x4f82be['changed'](_0x1376('0xf'))||_0x4f82be[_0x1376('0xc')]('code')||_0x4f82be[_0x1376('0xc')]('host')){var _0x3239db,_0x208f14;_0x3239db=_0x4f82be[_0x1376('0x12')];var _0x45b202=_0x3239db[_0x1376('0x13')](-0x1);if(_0x45b202==='/'||_0x45b202==='\x5c'||_0x45b202===':'){_0x3239db=_0x3239db[_0x1376('0x14')](0x0,_0x3239db['lastIndexOf'](_0x45b202));}switch(_0x4f82be[_0x1376('0xd')]){case'US':_0x208f14=_0x1376('0x16');break;case'AU':_0x208f14='https://accounts.zoho.com.au';break;case'IN':_0x208f14=_0x1376('0x18');break;case'CN':_0x208f14='https://accounts.zoho.com.cn';break;default:_0x208f14=_0x1376('0x28');break;}var _0x14603e={'method':_0x1376('0x1a'),'uri':_0x208f14+_0x1376('0x1b'),'form':{'grant_type':_0x1376('0x1c'),'client_id':_0x4f82be[_0x1376('0xe')],'client_secret':_0x4f82be[_0x1376('0xf')],'redirect_uri':_0x4f82be[_0x1376('0x12')],'code':_0x4f82be[_0x1376('0x10')]},'headers':{'Content-Type':_0x1376('0x1d')}};return rp(_0x14603e)['then'](function(_0xabbbf4){var _0x218d45=JSON[_0x1376('0x1f')](_0xabbbf4);if(_0x218d45[_0x1376('0x20')]){_0x4f82be['refreshToken']=_0x218d45['refresh_token'];logger['info'](util[_0x1376('0x21')](_0x1376('0x22'),_0x4f82be[_0x1376('0x23')],_0x4f82be['id']));}else{logger[_0x1376('0x24')](util[_0x1376('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f82be[_0x1376('0x23')],_0x4f82be['id']),util['inspect'](_0x218d45,{'showHidden':![],'depth':null}));}return _0x3ab2f5(null,_0x1896c2);})['catch'](function(_0x28f548){logger[_0x1376('0x24')](util[_0x1376('0x21')](_0x1376('0x25'),_0x4f82be[_0x1376('0x23')],_0x4f82be['id']),util[_0x1376('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ab2f5(_0x28f548);});}else{return _0x3ab2f5(null,_0x1896c2);}}}});}; \ No newline at end of file +var _0x072c=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','clientId','application/x-www-form-urlencoded','then','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','slice','POST','parse','info','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','substring','lastIndexOf'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x072c,0xe7));var _0xc072=function(_0x2ca030,_0x4363ba){_0x2ca030=_0x2ca030-0x0;var _0x168a6e=_0x072c[_0x2ca030];return _0x168a6e;};'use strict';var _=require(_0xc072('0x0'));var util=require(_0xc072('0x1'));var logger=require(_0xc072('0x2'))(_0xc072('0x3'));var moment=require(_0xc072('0x4'));var BPromise=require(_0xc072('0x5'));var rp=require(_0xc072('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc072('0x7'));var config=require(_0xc072('0x8'));var attributes=require(_0xc072('0x9'));var integrations=require(_0xc072('0xa'));module[_0xc072('0xb')]=function(_0x52beb6,_0x2dd9f1){return _0x52beb6[_0xc072('0xc')]('ZohoAccount',attributes,{'tableName':_0xc072('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x325653,_0x2881e4,_0x305249){if(_0x325653[_0xc072('0xe')](_0xc072('0xf'))||_0x325653[_0xc072('0xe')](_0xc072('0x10'))||_0x325653['changed']('clientId')||_0x325653[_0xc072('0xe')](_0xc072('0x11'))||_0x325653['changed'](_0xc072('0x12'))||_0x325653['changed']('host')){var _0x37ea8e,_0x13e720;_0x37ea8e=_0x325653['serverUrl'];var _0x4da389=_0x37ea8e['slice'](-0x1);if(_0x4da389==='/'||_0x4da389==='\x5c'||_0x4da389===':'){_0x37ea8e=_0x37ea8e[_0xc072('0x13')](0x0,_0x37ea8e[_0xc072('0x14')](_0x4da389));}switch(_0x325653[_0xc072('0xf')]){case'US':_0x13e720=_0xc072('0x15');break;case'AU':_0x13e720=_0xc072('0x16');break;case'IN':_0x13e720=_0xc072('0x17');break;case'CN':_0x13e720=_0xc072('0x18');break;default:_0x13e720=_0xc072('0x19');break;}var _0xe2bd6a={'method':'POST','uri':_0x13e720+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x325653[_0xc072('0x1a')],'client_secret':_0x325653[_0xc072('0x11')],'redirect_uri':_0x325653['serverUrl'],'code':_0x325653['code']},'headers':{'Content-Type':_0xc072('0x1b')}};return rp(_0xe2bd6a)[_0xc072('0x1c')](function(_0x5874ec){var _0x25dda6=JSON['parse'](_0x5874ec);if(_0x25dda6[_0xc072('0x1d')]){_0x325653[_0xc072('0x1e')]=_0x25dda6[_0xc072('0x1d')];logger['info'](util['format'](_0xc072('0x1f'),_0x325653[_0xc072('0x20')],_0x325653['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x325653['name'],_0x325653['id']),util[_0xc072('0x21')](_0x25dda6,{'showHidden':![],'depth':null}));}return _0x305249(null,_0x2881e4);})['catch'](function(_0x38ec40){logger['error'](util[_0xc072('0x22')](_0xc072('0x23'),_0x325653[_0xc072('0x20')],_0x325653['id']),util[_0xc072('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x305249(_0x38ec40);});}else{return _0x305249(null,_0x2881e4);}},'beforeUpdate':function(_0x22ce50,_0x3f0091,_0x22dab4){if(_0x22ce50[_0xc072('0xe')]('zone')||_0x22ce50[_0xc072('0xe')](_0xc072('0x10'))||_0x22ce50[_0xc072('0xe')](_0xc072('0x1a'))||_0x22ce50[_0xc072('0xe')](_0xc072('0x11'))||_0x22ce50['changed'](_0xc072('0x12'))||_0x22ce50[_0xc072('0xe')](_0xc072('0x24'))){var _0x3874fe,_0xc5d0e5;_0x3874fe=_0x22ce50[_0xc072('0x10')];var _0x2b459b=_0x3874fe[_0xc072('0x25')](-0x1);if(_0x2b459b==='/'||_0x2b459b==='\x5c'||_0x2b459b===':'){_0x3874fe=_0x3874fe[_0xc072('0x13')](0x0,_0x3874fe[_0xc072('0x14')](_0x2b459b));}switch(_0x22ce50[_0xc072('0xf')]){case'US':_0xc5d0e5=_0xc072('0x15');break;case'AU':_0xc5d0e5=_0xc072('0x16');break;case'IN':_0xc5d0e5=_0xc072('0x17');break;case'CN':_0xc5d0e5='https://accounts.zoho.com.cn';break;default:_0xc5d0e5=_0xc072('0x19');break;}var _0x4d61ed={'method':_0xc072('0x26'),'uri':_0xc5d0e5+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x22ce50[_0xc072('0x1a')],'client_secret':_0x22ce50[_0xc072('0x11')],'redirect_uri':_0x22ce50[_0xc072('0x10')],'code':_0x22ce50[_0xc072('0x12')]},'headers':{'Content-Type':_0xc072('0x1b')}};return rp(_0x4d61ed)[_0xc072('0x1c')](function(_0x46078b){var _0x3064c3=JSON[_0xc072('0x27')](_0x46078b);if(_0x3064c3[_0xc072('0x1d')]){_0x22ce50[_0xc072('0x1e')]=_0x3064c3[_0xc072('0x1d')];logger[_0xc072('0x28')](util[_0xc072('0x22')](_0xc072('0x1f'),_0x22ce50[_0xc072('0x20')],_0x22ce50['id']));}else{logger['error'](util['format'](_0xc072('0x23'),_0x22ce50[_0xc072('0x20')],_0x22ce50['id']),util[_0xc072('0x21')](_0x3064c3,{'showHidden':![],'depth':null}));}return _0x22dab4(null,_0x3f0091);})['catch'](function(_0x465725){logger[_0xc072('0x29')](util[_0xc072('0x22')](_0xc072('0x23'),_0x22ce50[_0xc072('0x20')],_0x22ce50['id']),util[_0xc072('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x22dab4(_0x465725);});}else{return _0x22dab4(null,_0x3f0091);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index aa2758e..54a39da 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 _0xd08d=['../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','map','model','include','find','ShowZohoAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5774b1,_0x2a2ff5){var _0x6ff39c=function(_0x1796d9){while(--_0x1796d9){_0x5774b1['push'](_0x5774b1['shift']());}};_0x6ff39c(++_0x2a2ff5);}(_0xd08d,0x81));var _0xdd08=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xd08d[_0xbb9dbf];return _0x30223c;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var moment=require(_0xdd08('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd08('0x2'));var fs=require('fs');var Redis=require(_0xdd08('0x3'));var db=require(_0xdd08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd08('0x5'))(_0xdd08('0x6'));var config=require(_0xdd08('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd08('0x8')][_0xdd08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13999f,_0x28d59c,_0x147a23){return new BPromise(function(_0x54a5a3,_0x15416b){return client[_0xdd08('0xa')](_0x13999f,_0x147a23)[_0xdd08('0xb')](function(_0x51ce97){logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));logger[_0xdd08('0xf')](_0xdd08('0x10'),_0x28d59c,_0xdd08('0xe'),JSON[_0xdd08('0x11')](_0x51ce97));if(_0x51ce97[_0xdd08('0x12')]){if(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x13')]===0x1f4){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97['error'][_0xdd08('0x14')]);return _0x15416b(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);return _0x54a5a3(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}else{logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));_0x54a5a3(_0x51ce97[_0xdd08('0x15')][_0xdd08('0x14')]);}})[_0xdd08('0x16')](function(_0x278f5e){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x278f5e);_0x15416b(_0x278f5e);});});}exports[_0xdd08('0x17')]=function(_0x212100){var _0xb658ce=this;return new Promise(function(_0x562b83,_0x549297){return db[_0xdd08('0x18')][_0xdd08('0x19')]({'raw':_0x212100[_0xdd08('0x1a')]?_0x212100['options']['raw']===undefined?!![]:![]:!![],'where':_0x212100[_0xdd08('0x1a')]?_0x212100[_0xdd08('0x1a')][_0xdd08('0x1b')]||null:null,'attributes':_0x212100['options']?_0x212100[_0xdd08('0x1a')][_0xdd08('0x1c')]||null:null,'limit':_0x212100[_0xdd08('0x1a')]?_0x212100[_0xdd08('0x1a')]['limit']||null:null,'include':_0x212100['options']?_0x212100[_0xdd08('0x1a')]['include']?_[_0xdd08('0x1d')](_0x212100[_0xdd08('0x1a')]['include'],function(_0x4b1be1){return{'model':db[_0x4b1be1[_0xdd08('0x1e')]],'as':_0x4b1be1['as'],'attributes':_0x4b1be1[_0xdd08('0x1c')],'include':_0x4b1be1['include']?_[_0xdd08('0x1d')](_0x4b1be1['include'],function(_0x1e84d6){return{'model':db[_0x1e84d6[_0xdd08('0x1e')]],'as':_0x1e84d6['as'],'attributes':_0x1e84d6['attributes'],'include':_0x1e84d6[_0xdd08('0x1f')]?_[_0xdd08('0x1d')](_0x1e84d6[_0xdd08('0x1f')],function(_0x5a8a84){return{'model':db[_0x5a8a84['model']],'as':_0x5a8a84['as'],'attributes':_0x5a8a84[_0xdd08('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdd08('0xb')](function(_0x26cbf8){logger[_0xdd08('0xc')](_0xdd08('0x17'),_0x212100);logger[_0xdd08('0xf')]('GetZohoAccount',_0x212100,JSON['stringify'](_0x26cbf8));_0x562b83(_0x26cbf8);})[_0xdd08('0x16')](function(_0xbed010){logger[_0xdd08('0x12')](_0xdd08('0x17'),_0xbed010[_0xdd08('0x14')],_0x212100);_0x549297(_0xb658ce[_0xdd08('0x12')](0x1f4,_0xbed010[_0xdd08('0x14')]));});});};exports['ShowZohoAccount']=function(_0x283266){var _0xa57f4f=this;return new Promise(function(_0x385480,_0x4163be){return db[_0xdd08('0x18')][_0xdd08('0x20')]({'raw':_0x283266[_0xdd08('0x1a')]?_0x283266[_0xdd08('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x283266['options']?_0x283266[_0xdd08('0x1a')][_0xdd08('0x1b')]||null:null,'attributes':_0x283266[_0xdd08('0x1a')]?_0x283266['options']['attributes']||null:null,'include':_0x283266[_0xdd08('0x1a')]?_0x283266[_0xdd08('0x1a')][_0xdd08('0x1f')]?_[_0xdd08('0x1d')](_0x283266[_0xdd08('0x1a')][_0xdd08('0x1f')],function(_0x7d5fbe){return{'model':db[_0x7d5fbe['model']],'as':_0x7d5fbe['as'],'attributes':_0x7d5fbe[_0xdd08('0x1c')],'include':_0x7d5fbe[_0xdd08('0x1f')]?_[_0xdd08('0x1d')](_0x7d5fbe[_0xdd08('0x1f')],function(_0xd7c4d7){return{'model':db[_0xd7c4d7[_0xdd08('0x1e')]],'as':_0xd7c4d7['as'],'attributes':_0xd7c4d7[_0xdd08('0x1c')],'include':_0xd7c4d7['include']?_[_0xdd08('0x1d')](_0xd7c4d7['include'],function(_0x4b1a39){return{'model':db[_0x4b1a39['model']],'as':_0x4b1a39['as'],'attributes':_0x4b1a39[_0xdd08('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23fc54){logger[_0xdd08('0xc')](_0xdd08('0x21'),_0x283266);logger['debug'](_0xdd08('0x21'),_0x283266,JSON['stringify'](_0x23fc54));_0x385480(_0x23fc54);})[_0xdd08('0x16')](function(_0x50ac2b){logger[_0xdd08('0x12')](_0xdd08('0x21'),_0x50ac2b[_0xdd08('0x14')],_0x283266);_0x4163be(_0xa57f4f[_0xdd08('0x12')](0x1f4,_0x50ac2b[_0xdd08('0x14')]));});});}; \ No newline at end of file +var _0xb5f3=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','raw','options','where','attributes','limit','map','include','model','catch','ShowZohoAccount','find','lodash','util','moment','randomstring'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xb5f3,0x137));var _0x3b5f=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xb5f3[_0x24fa1a];return _0xc5621f;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var moment=require(_0x3b5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b5f('0x3'));var fs=require('fs');var Redis=require(_0x3b5f('0x4'));var db=require(_0x3b5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b5f('0x6'));var config=require(_0x3b5f('0x7'));var jayson=require(_0x3b5f('0x8'));var client=jayson[_0x3b5f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db4ad,_0x1b6d67,_0x4edb1a){return new BPromise(function(_0x2e213c,_0x48597e){return client[_0x3b5f('0xa')](_0x2db4ad,_0x4edb1a)[_0x3b5f('0xb')](function(_0x2c37f6){logger[_0x3b5f('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x1b6d67,_0x3b5f('0xd'));logger[_0x3b5f('0xe')](_0x3b5f('0xf'),_0x1b6d67,_0x3b5f('0xd'),JSON[_0x3b5f('0x10')](_0x2c37f6));if(_0x2c37f6['error']){if(_0x2c37f6['error']['code']===0x1f4){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);return _0x48597e(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6['error'][_0x3b5f('0x13')]);return _0x2e213c(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}else{logger['info'](_0x3b5f('0x12'),_0x1b6d67,'request\x20sent');_0x2e213c(_0x2c37f6[_0x3b5f('0x14')][_0x3b5f('0x13')]);}})['catch'](function(_0x28b6c1){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x28b6c1);_0x48597e(_0x28b6c1);});});}exports[_0x3b5f('0x15')]=function(_0x5ed046){var _0x2db25f=this;return new Promise(function(_0x4933c8,_0x2d3848){return db[_0x3b5f('0x16')][_0x3b5f('0x17')]({'raw':_0x5ed046['options']?_0x5ed046['options'][_0x3b5f('0x18')]===undefined?!![]:![]:!![],'where':_0x5ed046[_0x3b5f('0x19')]?_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1a')]||null:null,'attributes':_0x5ed046['options']?_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1b')]||null:null,'limit':_0x5ed046[_0x3b5f('0x19')]?_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1c')]||null:null,'include':_0x5ed046[_0x3b5f('0x19')]?_0x5ed046['options']['include']?_[_0x3b5f('0x1d')](_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1e')],function(_0x25bcf6){return{'model':db[_0x25bcf6[_0x3b5f('0x1f')]],'as':_0x25bcf6['as'],'attributes':_0x25bcf6[_0x3b5f('0x1b')],'include':_0x25bcf6[_0x3b5f('0x1e')]?_[_0x3b5f('0x1d')](_0x25bcf6[_0x3b5f('0x1e')],function(_0x3267b8){return{'model':db[_0x3267b8['model']],'as':_0x3267b8['as'],'attributes':_0x3267b8['attributes'],'include':_0x3267b8[_0x3b5f('0x1e')]?_[_0x3b5f('0x1d')](_0x3267b8[_0x3b5f('0x1e')],function(_0x26c1e0){return{'model':db[_0x26c1e0[_0x3b5f('0x1f')]],'as':_0x26c1e0['as'],'attributes':_0x26c1e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b5f('0xb')](function(_0x2d5ba1){logger[_0x3b5f('0xc')](_0x3b5f('0x15'),_0x5ed046);logger['debug']('GetZohoAccount',_0x5ed046,JSON[_0x3b5f('0x10')](_0x2d5ba1));_0x4933c8(_0x2d5ba1);})[_0x3b5f('0x20')](function(_0x1533ea){logger['error']('GetZohoAccount',_0x1533ea[_0x3b5f('0x13')],_0x5ed046);_0x2d3848(_0x2db25f[_0x3b5f('0x11')](0x1f4,_0x1533ea['message']));});});};exports[_0x3b5f('0x21')]=function(_0x562f95){var _0xa10ddb=this;return new Promise(function(_0xc266d0,_0x4be2e2){return db['ZohoAccount'][_0x3b5f('0x22')]({'raw':_0x562f95[_0x3b5f('0x19')]?_0x562f95[_0x3b5f('0x19')][_0x3b5f('0x18')]===undefined?!![]:![]:!![],'where':_0x562f95[_0x3b5f('0x19')]?_0x562f95[_0x3b5f('0x19')][_0x3b5f('0x1a')]||null:null,'attributes':_0x562f95[_0x3b5f('0x19')]?_0x562f95['options'][_0x3b5f('0x1b')]||null:null,'include':_0x562f95[_0x3b5f('0x19')]?_0x562f95[_0x3b5f('0x19')]['include']?_[_0x3b5f('0x1d')](_0x562f95[_0x3b5f('0x19')][_0x3b5f('0x1e')],function(_0x214dee){return{'model':db[_0x214dee[_0x3b5f('0x1f')]],'as':_0x214dee['as'],'attributes':_0x214dee['attributes'],'include':_0x214dee['include']?_['map'](_0x214dee[_0x3b5f('0x1e')],function(_0x1f660a){return{'model':db[_0x1f660a[_0x3b5f('0x1f')]],'as':_0x1f660a['as'],'attributes':_0x1f660a[_0x3b5f('0x1b')],'include':_0x1f660a[_0x3b5f('0x1e')]?_[_0x3b5f('0x1d')](_0x1f660a['include'],function(_0x185afb){return{'model':db[_0x185afb[_0x3b5f('0x1f')]],'as':_0x185afb['as'],'attributes':_0x185afb[_0x3b5f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x511671){logger[_0x3b5f('0xc')]('ShowZohoAccount',_0x562f95);logger['debug']('ShowZohoAccount',_0x562f95,JSON[_0x3b5f('0x10')](_0x511671));_0xc266d0(_0x511671);})['catch'](function(_0x2a4356){logger[_0x3b5f('0x11')](_0x3b5f('0x21'),_0x2a4356['message'],_0x562f95);_0x4be2e2(_0xa10ddb[_0x3b5f('0x11')](0x1f4,_0x2a4356['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index af0a02c..f83da9f 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 _0x74e3=['getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show'];(function(_0x40683d,_0x48c75d){var _0x3f92f3=function(_0x3fb2ea){while(--_0x3fb2ea){_0x40683d['push'](_0x40683d['shift']());}};_0x3f92f3(++_0x48c75d);}(_0x74e3,0x138));var _0x374e=function(_0x19eac3,_0x4a9eb3){_0x19eac3=_0x19eac3-0x0;var _0x337ea2=_0x74e3[_0x19eac3];return _0x337ea2;};'use strict';var multer=require('multer');var util=require(_0x374e('0x0'));var path=require('path');var timeout=require(_0x374e('0x1'));var express=require('express');var router=express[_0x374e('0x2')]();var fs_extra=require(_0x374e('0x3'));var auth=require(_0x374e('0x4'));var interaction=require(_0x374e('0x5'));var config=require(_0x374e('0x6'));var controller=require(_0x374e('0x7'));router[_0x374e('0x8')]('/',auth[_0x374e('0x9')](),controller['index']);router[_0x374e('0x8')]('/:id',auth[_0x374e('0x9')](),controller[_0x374e('0xa')]);router[_0x374e('0x8')]('/:id/fields',auth[_0x374e('0x9')](),controller['getFields']);router[_0x374e('0x8')]('/:id/subjects',auth[_0x374e('0x9')](),controller[_0x374e('0xb')]);router[_0x374e('0x8')](_0x374e('0xc'),auth[_0x374e('0x9')](),controller[_0x374e('0xd')]);router['post']('/',auth[_0x374e('0x9')](),controller[_0x374e('0xe')]);router[_0x374e('0xf')]('/:id',auth[_0x374e('0x9')](),controller['update']);router[_0x374e('0x10')]('/:id',auth[_0x374e('0x9')](),controller[_0x374e('0x11')]);module[_0x374e('0x12')]=router; \ No newline at end of file +var _0x2abd=['fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','/:id','update','delete','multer','util','path','express','Router'];(function(_0x1aba3a,_0x232d11){var _0x2cffb4=function(_0x287305){while(--_0x287305){_0x1aba3a['push'](_0x1aba3a['shift']());}};_0x2cffb4(++_0x232d11);}(_0x2abd,0x187));var _0xd2ab=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2abd[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xd2ab('0x0'));var util=require(_0xd2ab('0x1'));var path=require(_0xd2ab('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2ab('0x3'));var router=express[_0xd2ab('0x4')]();var fs_extra=require(_0xd2ab('0x5'));var auth=require(_0xd2ab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd2ab('0x7'));var controller=require(_0xd2ab('0x8'));router[_0xd2ab('0x9')]('/',auth[_0xd2ab('0xa')](),controller[_0xd2ab('0xb')]);router[_0xd2ab('0x9')]('/:id',auth[_0xd2ab('0xa')](),controller[_0xd2ab('0xc')]);router[_0xd2ab('0x9')](_0xd2ab('0xd'),auth['isAuthenticated'](),controller[_0xd2ab('0xe')]);router[_0xd2ab('0x9')](_0xd2ab('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xd2ab('0x10'),auth[_0xd2ab('0xa')](),controller['getDescriptions']);router[_0xd2ab('0x11')]('/',auth[_0xd2ab('0xa')](),controller['create']);router[_0xd2ab('0x12')](_0xd2ab('0x13'),auth[_0xd2ab('0xa')](),controller[_0xd2ab('0x14')]);router[_0xd2ab('0x15')](_0xd2ab('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index fa23d18..c080e7b 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 _0xfecf=['contact_lead','sequelize','exports','STRING','ENUM','lead','contact','nothing'];(function(_0xd686b3,_0x23d47c){var _0x985ea5=function(_0x5e7ade){while(--_0x5e7ade){_0xd686b3['push'](_0xd686b3['shift']());}};_0x985ea5(++_0x23d47c);}(_0xfecf,0x151));var _0xffec=function(_0x247b29,_0x3c3fd1){_0x247b29=_0x247b29-0x0;var _0xbf3ae9=_0xfecf[_0x247b29];return _0xbf3ae9;};'use strict';var Sequelize=require(_0xffec('0x0'));module[_0xffec('0x1')]={'name':{'type':Sequelize[_0xffec('0x2')]},'moduleCreate':{'type':Sequelize[_0xffec('0x3')](_0xffec('0x4'),_0xffec('0x5'),_0xffec('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xffec('0x7'),'contact',_0xffec('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xffec('0x2')]}}; \ No newline at end of file +var _0x68da=['ENUM','contact_lead','STRING','sequelize','exports','lead','contact','nothing'];(function(_0x1897ea,_0x45860a){var _0x35d431=function(_0x329aff){while(--_0x329aff){_0x1897ea['push'](_0x1897ea['shift']());}};_0x35d431(++_0x45860a);}(_0x68da,0x173));var _0xa68d=function(_0xca8958,_0x25eed8){_0xca8958=_0xca8958-0x0;var _0x3d7165=_0x68da[_0xca8958];return _0x3d7165;};'use strict';var Sequelize=require(_0xa68d('0x0'));module[_0xa68d('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xa68d('0x2'),_0xa68d('0x3'),_0xa68d('0x4')),'defaultValue':_0xa68d('0x2')},'moduleSearch':{'type':Sequelize[_0xa68d('0x5')](_0xa68d('0x6'),_0xa68d('0x3'),_0xa68d('0x2')),'defaultValue':_0xa68d('0x6')},'description':{'type':Sequelize[_0xa68d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a17d461..8c73451 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 _0xa710=['merge','where','VIRTUAL','options','findAll','show','params','keys','length','includeAll','include','find','create','body','catch','getFields','ZohoField','order','sort','getSubjects','getDescriptions','findOne','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','status','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','filter'];(function(_0x722188,_0x2b1047){var _0x1b7d33=function(_0x542d01){while(--_0x542d01){_0x722188['push'](_0x722188['shift']());}};_0x1b7d33(++_0x2b1047);}(_0xa710,0x109));var _0x0a71=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0xa710[_0x3ee55a];return _0x581800;};'use strict';var emlformat=require(_0x0a71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a71('0x1'));var rp=require(_0x0a71('0x2'));var moment=require('moment');var BPromise=require(_0x0a71('0x3'));var Mustache=require(_0x0a71('0x4'));var util=require(_0x0a71('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0a71('0x6'));var ejs=require(_0x0a71('0x7'));var fs=require('fs');var fs_extra=require(_0x0a71('0x8'));var _=require(_0x0a71('0x9'));var squel=require(_0x0a71('0xa'));var crypto=require(_0x0a71('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0a71('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0a71('0xd'));var Papa=require(_0x0a71('0xe'));var Redis=require(_0x0a71('0xf'));var authService=require(_0x0a71('0x10'));var qs=require(_0x0a71('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a71('0x12'))(_0x0a71('0x13'));var utils=require('../../config/utils');var config=require(_0x0a71('0x14'));var licenseUtil=require(_0x0a71('0x15'));var db=require(_0x0a71('0x16'))['db'];function respondWithStatusCode(_0x14ddef,_0x53ad86){_0x53ad86=_0x53ad86||0xcc;return function(_0x570a45){if(_0x570a45){return _0x14ddef[_0x0a71('0x17')](_0x53ad86);}return _0x14ddef['status'](_0x53ad86)[_0x0a71('0x18')]();};}function respondWithResult(_0x448b89,_0x5d9a7d){_0x5d9a7d=_0x5d9a7d||0xc8;return function(_0x1d29f0){if(_0x1d29f0){return _0x448b89['status'](_0x5d9a7d)['json'](_0x1d29f0);}};}function respondWithFilteredResult(_0x4b0c1e,_0x3d32a7){return function(_0xad3fe){if(_0xad3fe){var _0x15f848=typeof _0x3d32a7[_0x0a71('0x19')]==='undefined'&&typeof _0x3d32a7[_0x0a71('0x1a')]===_0x0a71('0x1b');var _0x12b1b6=_0xad3fe['count'];var _0x2c0a76=_0x15f848?0x0:_0x3d32a7[_0x0a71('0x19')];var _0x4c5cb5=_0x15f848?_0xad3fe[_0x0a71('0x1c')]:_0x3d32a7['offset']+_0x3d32a7[_0x0a71('0x1a')];var _0x2c577d;if(_0x4c5cb5>=_0x12b1b6){_0x4c5cb5=_0x12b1b6;_0x2c577d=0xc8;}else{_0x2c577d=0xce;}_0x4b0c1e['status'](_0x2c577d);return _0x4b0c1e[_0x0a71('0x1d')](_0x0a71('0x1e'),_0x2c0a76+'-'+_0x4c5cb5+'/'+_0x12b1b6)[_0x0a71('0x1f')](_0xad3fe);}return null;};}function patchUpdates(_0x1940f4){return function(_0x1410bd){try{jsonpatch[_0x0a71('0x20')](_0x1410bd,_0x1940f4,!![]);}catch(_0x5c9873){return BPromise[_0x0a71('0x21')](_0x5c9873);}return _0x1410bd[_0x0a71('0x22')]();};}function saveUpdates(_0x562a7f,_0x26d2cb){return function(_0x4bdc4c){if(_0x4bdc4c){return _0x4bdc4c[_0x0a71('0x23')](_0x562a7f)[_0x0a71('0x24')](function(_0x1c843){return _0x1c843;});}return null;};}function removeEntity(_0x484625,_0x13468c){return function(_0x25bf3a){if(_0x25bf3a){return _0x25bf3a[_0x0a71('0x25')]()[_0x0a71('0x24')](function(){_0x484625[_0x0a71('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d22f5,_0x56b332){return function(_0x45b52f){if(!_0x45b52f){_0x2d22f5['sendStatus'](0x194);}return _0x45b52f;};}function handleError(_0xe6427,_0x201ac0){_0x201ac0=_0x201ac0||0x1f4;return function(_0x3a86a2){logger[_0x0a71('0x27')](_0x3a86a2[_0x0a71('0x28')]);if(_0x3a86a2[_0x0a71('0x29')]){delete _0x3a86a2['name'];}_0xe6427[_0x0a71('0x26')](_0x201ac0)[_0x0a71('0x2a')](_0x3a86a2);};}exports['index']=function(_0x85e1f2,_0x313f37){var _0x2cbd4e={},_0x5c4956={},_0x46d4bd={'count':0x0,'rows':[]};var _0x1316ec=_[_0x0a71('0x2b')](db[_0x0a71('0x2c')][_0x0a71('0x2d')],function(_0x2c9ad2){return{'name':_0x2c9ad2[_0x0a71('0x2e')],'type':_0x2c9ad2[_0x0a71('0x2f')][_0x0a71('0x30')]};});_0x5c4956[_0x0a71('0x31')]=_['map'](_0x1316ec,'name');_0x5c4956[_0x0a71('0x32')]=_['keys'](_0x85e1f2[_0x0a71('0x32')]);_0x5c4956[_0x0a71('0x33')]=_[_0x0a71('0x34')](_0x5c4956[_0x0a71('0x31')],_0x5c4956[_0x0a71('0x32')]);_0x2cbd4e[_0x0a71('0x35')]=_['intersection'](_0x5c4956[_0x0a71('0x31')],qs[_0x0a71('0x36')](_0x85e1f2[_0x0a71('0x32')][_0x0a71('0x36')]));_0x2cbd4e[_0x0a71('0x35')]=_0x2cbd4e[_0x0a71('0x35')]['length']?_0x2cbd4e[_0x0a71('0x35')]:_0x5c4956['model'];if(!_0x85e1f2['query'][_0x0a71('0x37')](_0x0a71('0x38'))){_0x2cbd4e['limit']=qs[_0x0a71('0x1a')](_0x85e1f2[_0x0a71('0x32')][_0x0a71('0x1a')]);_0x2cbd4e['offset']=qs['offset'](_0x85e1f2[_0x0a71('0x32')]['offset']);}_0x2cbd4e['order']=qs['sort'](_0x85e1f2[_0x0a71('0x32')]['sort']);_0x2cbd4e['where']=qs[_0x0a71('0x33')](_[_0x0a71('0x39')](_0x85e1f2[_0x0a71('0x32')],_0x5c4956[_0x0a71('0x33')]),_0x1316ec);if(_0x85e1f2[_0x0a71('0x32')][_0x0a71('0x3a')]){_0x2cbd4e['where']=_[_0x0a71('0x3b')](_0x2cbd4e[_0x0a71('0x3c')],{'$or':_['map'](_0x1316ec,function(_0x57d8ca){if(_0x57d8ca['type']!==_0x0a71('0x3d')){var _0x12c2e1={};_0x12c2e1[_0x57d8ca[_0x0a71('0x29')]]={'$like':'%'+_0x85e1f2[_0x0a71('0x32')][_0x0a71('0x3a')]+'%'};return _0x12c2e1;}})});}_0x2cbd4e=_[_0x0a71('0x3b')]({},_0x2cbd4e,_0x85e1f2[_0x0a71('0x3e')]);var _0x28fd0c={'where':_0x2cbd4e['where']};return db[_0x0a71('0x2c')][_0x0a71('0x1c')](_0x28fd0c)[_0x0a71('0x24')](function(_0x1ea725){_0x46d4bd[_0x0a71('0x1c')]=_0x1ea725;if(_0x85e1f2[_0x0a71('0x32')]['includeAll']){_0x2cbd4e['include']=[{'all':!![]}];}return db[_0x0a71('0x2c')][_0x0a71('0x3f')](_0x2cbd4e);})[_0x0a71('0x24')](function(_0x1a5b91){_0x46d4bd['rows']=_0x1a5b91;return _0x46d4bd;})[_0x0a71('0x24')](respondWithFilteredResult(_0x313f37,_0x2cbd4e))['catch'](handleError(_0x313f37,null));};exports[_0x0a71('0x40')]=function(_0x468882,_0x596e5c){var _0xefe5e3={'raw':![],'where':{'id':_0x468882[_0x0a71('0x41')]['id']}},_0x3a4718={};_0x3a4718[_0x0a71('0x31')]=_[_0x0a71('0x42')](db['ZohoConfiguration']['rawAttributes']);_0x3a4718[_0x0a71('0x32')]=_[_0x0a71('0x42')](_0x468882[_0x0a71('0x32')]);_0x3a4718[_0x0a71('0x33')]=_[_0x0a71('0x34')](_0x3a4718[_0x0a71('0x31')],_0x3a4718[_0x0a71('0x32')]);_0xefe5e3['attributes']=_[_0x0a71('0x34')](_0x3a4718[_0x0a71('0x31')],qs[_0x0a71('0x36')](_0x468882[_0x0a71('0x32')]['fields']));_0xefe5e3['attributes']=_0xefe5e3[_0x0a71('0x35')][_0x0a71('0x43')]?_0xefe5e3['attributes']:_0x3a4718[_0x0a71('0x31')];if(_0x468882['query'][_0x0a71('0x44')]){_0xefe5e3[_0x0a71('0x45')]=[{'all':!![]}];}_0xefe5e3=_[_0x0a71('0x3b')]({},_0xefe5e3,_0x468882[_0x0a71('0x3e')]);return db['ZohoConfiguration'][_0x0a71('0x46')](_0xefe5e3)[_0x0a71('0x24')](handleEntityNotFound(_0x596e5c,null))[_0x0a71('0x24')](respondWithResult(_0x596e5c,null))['catch'](handleError(_0x596e5c,null));};exports['create']=function(_0x22fba1,_0xd001af){return db[_0x0a71('0x2c')][_0x0a71('0x47')](_0x22fba1[_0x0a71('0x48')],{})[_0x0a71('0x24')](respondWithResult(_0xd001af,0xc9))[_0x0a71('0x49')](handleError(_0xd001af,null));};exports[_0x0a71('0x23')]=function(_0x2ff2cd,_0x5aa7b2){if(_0x2ff2cd[_0x0a71('0x48')]['id']){delete _0x2ff2cd[_0x0a71('0x48')]['id'];}return db['ZohoConfiguration'][_0x0a71('0x46')]({'where':{'id':_0x2ff2cd[_0x0a71('0x41')]['id']}})[_0x0a71('0x24')](handleEntityNotFound(_0x5aa7b2,null))['then'](saveUpdates(_0x2ff2cd[_0x0a71('0x48')],null))[_0x0a71('0x24')](respondWithResult(_0x5aa7b2,null))[_0x0a71('0x49')](handleError(_0x5aa7b2,null));};exports[_0x0a71('0x25')]=function(_0x1cc3ca,_0x5b98a4){return db[_0x0a71('0x2c')][_0x0a71('0x46')]({'where':{'id':_0x1cc3ca['params']['id']}})['then'](handleEntityNotFound(_0x5b98a4,null))['then'](removeEntity(_0x5b98a4,null))[_0x0a71('0x49')](handleError(_0x5b98a4,null));};exports[_0x0a71('0x4a')]=function(_0xe384d,_0x5a8d27,_0x3b940a){var _0x2ddfe1={};var _0x3a347c={};var _0x1db1a9;var _0xe0d47b;return db[_0x0a71('0x2c')]['findOne']({'where':{'id':_0xe384d[_0x0a71('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a8d27,null))[_0x0a71('0x24')](function(_0x1c4be6){if(_0x1c4be6){_0x1db1a9=_0x1c4be6;_0x3a347c[_0x0a71('0x31')]=_[_0x0a71('0x42')](db[_0x0a71('0x4b')][_0x0a71('0x2d')]);_0x3a347c[_0x0a71('0x32')]=_['keys'](_0xe384d['query']);_0x3a347c[_0x0a71('0x33')]=_['intersection'](_0x3a347c[_0x0a71('0x31')],_0x3a347c[_0x0a71('0x32')]);_0x2ddfe1[_0x0a71('0x35')]=_['intersection'](_0x3a347c[_0x0a71('0x31')],qs[_0x0a71('0x36')](_0xe384d['query'][_0x0a71('0x36')]));_0x2ddfe1[_0x0a71('0x35')]=_0x2ddfe1[_0x0a71('0x35')][_0x0a71('0x43')]?_0x2ddfe1['attributes']:_0x3a347c[_0x0a71('0x31')];_0x2ddfe1[_0x0a71('0x4c')]=qs['sort'](_0xe384d[_0x0a71('0x32')][_0x0a71('0x4d')]);_0x2ddfe1[_0x0a71('0x3c')]=qs[_0x0a71('0x33')](_[_0x0a71('0x39')](_0xe384d['query'],_0x3a347c['filters']));if(_0xe384d['query']['filter']){_0x2ddfe1[_0x0a71('0x3c')]=_[_0x0a71('0x3b')](_0x2ddfe1['where'],{'$or':_[_0x0a71('0x2b')](_0x2ddfe1[_0x0a71('0x35')],function(_0x1c21a1){var _0x12b8ac={};_0x12b8ac[_0x1c21a1]={'$like':'%'+_0xe384d[_0x0a71('0x32')][_0x0a71('0x3a')]+'%'};return _0x12b8ac;})});}_0x2ddfe1=_[_0x0a71('0x3b')]({},_0x2ddfe1,_0xe384d['options']);return _0x1db1a9['getFields'](_0x2ddfe1);}})[_0x0a71('0x24')](function(_0x5047ff){if(_0x5047ff){_0xe0d47b=_0x5047ff[_0x0a71('0x43')];if(!_0xe384d[_0x0a71('0x32')][_0x0a71('0x37')](_0x0a71('0x38'))){_0x2ddfe1[_0x0a71('0x1a')]=qs[_0x0a71('0x1a')](_0xe384d[_0x0a71('0x32')][_0x0a71('0x1a')]);_0x2ddfe1['offset']=qs[_0x0a71('0x19')](_0xe384d[_0x0a71('0x32')][_0x0a71('0x19')]);}return _0x1db1a9[_0x0a71('0x4a')](_0x2ddfe1);}})[_0x0a71('0x24')](function(_0x51fda5){if(_0x51fda5){return _0x51fda5?{'count':_0xe0d47b,'rows':_0x51fda5}:null;}})[_0x0a71('0x24')](respondWithResult(_0x5a8d27,null))[_0x0a71('0x49')](handleError(_0x5a8d27,null));};exports[_0x0a71('0x4e')]=function(_0x2b2b5a,_0x1ea681,_0x3bc251){var _0x5a6e49={};var _0x5b36e6={};var _0x3719e7;var _0x208440;return db[_0x0a71('0x2c')]['findOne']({'where':{'id':_0x2b2b5a[_0x0a71('0x41')]['id']}})[_0x0a71('0x24')](handleEntityNotFound(_0x1ea681,null))[_0x0a71('0x24')](function(_0x70a3aa){if(_0x70a3aa){_0x3719e7=_0x70a3aa;_0x5b36e6[_0x0a71('0x31')]=_[_0x0a71('0x42')](db['ZohoField'][_0x0a71('0x2d')]);_0x5b36e6[_0x0a71('0x32')]=_[_0x0a71('0x42')](_0x2b2b5a[_0x0a71('0x32')]);_0x5b36e6[_0x0a71('0x33')]=_[_0x0a71('0x34')](_0x5b36e6[_0x0a71('0x31')],_0x5b36e6[_0x0a71('0x32')]);_0x5a6e49[_0x0a71('0x35')]=_[_0x0a71('0x34')](_0x5b36e6[_0x0a71('0x31')],qs[_0x0a71('0x36')](_0x2b2b5a['query']['fields']));_0x5a6e49[_0x0a71('0x35')]=_0x5a6e49[_0x0a71('0x35')]['length']?_0x5a6e49['attributes']:_0x5b36e6[_0x0a71('0x31')];_0x5a6e49['order']=qs[_0x0a71('0x4d')](_0x2b2b5a[_0x0a71('0x32')][_0x0a71('0x4d')]);_0x5a6e49[_0x0a71('0x3c')]=qs[_0x0a71('0x33')](_['pick'](_0x2b2b5a[_0x0a71('0x32')],_0x5b36e6[_0x0a71('0x33')]));if(_0x2b2b5a[_0x0a71('0x32')][_0x0a71('0x3a')]){_0x5a6e49['where']=_['merge'](_0x5a6e49[_0x0a71('0x3c')],{'$or':_[_0x0a71('0x2b')](_0x5a6e49[_0x0a71('0x35')],function(_0xf5d09f){var _0x2b90a8={};_0x2b90a8[_0xf5d09f]={'$like':'%'+_0x2b2b5a[_0x0a71('0x32')][_0x0a71('0x3a')]+'%'};return _0x2b90a8;})});}_0x5a6e49=_[_0x0a71('0x3b')]({},_0x5a6e49,_0x2b2b5a[_0x0a71('0x3e')]);return _0x3719e7['getSubjects'](_0x5a6e49);}})[_0x0a71('0x24')](function(_0x5116f4){if(_0x5116f4){_0x208440=_0x5116f4[_0x0a71('0x43')];if(!_0x2b2b5a[_0x0a71('0x32')][_0x0a71('0x37')](_0x0a71('0x38'))){_0x5a6e49['limit']=qs['limit'](_0x2b2b5a['query'][_0x0a71('0x1a')]);_0x5a6e49[_0x0a71('0x19')]=qs[_0x0a71('0x19')](_0x2b2b5a['query']['offset']);}return _0x3719e7[_0x0a71('0x4e')](_0x5a6e49);}})['then'](function(_0x4cf439){if(_0x4cf439){return _0x4cf439?{'count':_0x208440,'rows':_0x4cf439}:null;}})[_0x0a71('0x24')](respondWithResult(_0x1ea681,null))[_0x0a71('0x49')](handleError(_0x1ea681,null));};exports[_0x0a71('0x4f')]=function(_0x144fce,_0x2cf4f8,_0x2e5f7b){var _0x1e50dc={};var _0x3c8e90={};var _0x29d7a8;var _0x522ff0;return db['ZohoConfiguration'][_0x0a71('0x50')]({'where':{'id':_0x144fce[_0x0a71('0x41')]['id']}})[_0x0a71('0x24')](handleEntityNotFound(_0x2cf4f8,null))[_0x0a71('0x24')](function(_0x41c214){if(_0x41c214){_0x29d7a8=_0x41c214;_0x3c8e90[_0x0a71('0x31')]=_['keys'](db[_0x0a71('0x4b')][_0x0a71('0x2d')]);_0x3c8e90[_0x0a71('0x32')]=_[_0x0a71('0x42')](_0x144fce[_0x0a71('0x32')]);_0x3c8e90[_0x0a71('0x33')]=_[_0x0a71('0x34')](_0x3c8e90[_0x0a71('0x31')],_0x3c8e90[_0x0a71('0x32')]);_0x1e50dc[_0x0a71('0x35')]=_[_0x0a71('0x34')](_0x3c8e90[_0x0a71('0x31')],qs[_0x0a71('0x36')](_0x144fce['query'][_0x0a71('0x36')]));_0x1e50dc[_0x0a71('0x35')]=_0x1e50dc['attributes'][_0x0a71('0x43')]?_0x1e50dc[_0x0a71('0x35')]:_0x3c8e90[_0x0a71('0x31')];_0x1e50dc[_0x0a71('0x4c')]=qs[_0x0a71('0x4d')](_0x144fce[_0x0a71('0x32')]['sort']);_0x1e50dc[_0x0a71('0x3c')]=qs[_0x0a71('0x33')](_['pick'](_0x144fce[_0x0a71('0x32')],_0x3c8e90[_0x0a71('0x33')]));if(_0x144fce['query'][_0x0a71('0x3a')]){_0x1e50dc[_0x0a71('0x3c')]=_[_0x0a71('0x3b')](_0x1e50dc[_0x0a71('0x3c')],{'$or':_[_0x0a71('0x2b')](_0x1e50dc[_0x0a71('0x35')],function(_0x28ea94){var _0x442858={};_0x442858[_0x28ea94]={'$like':'%'+_0x144fce[_0x0a71('0x32')]['filter']+'%'};return _0x442858;})});}_0x1e50dc=_['merge']({},_0x1e50dc,_0x144fce[_0x0a71('0x3e')]);return _0x29d7a8['getDescriptions'](_0x1e50dc);}})[_0x0a71('0x24')](function(_0x34e9ee){if(_0x34e9ee){_0x522ff0=_0x34e9ee[_0x0a71('0x43')];if(!_0x144fce[_0x0a71('0x32')][_0x0a71('0x37')](_0x0a71('0x38'))){_0x1e50dc[_0x0a71('0x1a')]=qs[_0x0a71('0x1a')](_0x144fce[_0x0a71('0x32')]['limit']);_0x1e50dc[_0x0a71('0x19')]=qs[_0x0a71('0x19')](_0x144fce[_0x0a71('0x32')][_0x0a71('0x19')]);}return _0x29d7a8[_0x0a71('0x4f')](_0x1e50dc);}})['then'](function(_0x10b03d){if(_0x10b03d){return _0x10b03d?{'count':_0x522ff0,'rows':_0x10b03d}:null;}})[_0x0a71('0x24')](respondWithResult(_0x2cf4f8,null))[_0x0a71('0x49')](handleError(_0x2cf4f8,null));}; \ No newline at end of file +var _0xe552=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','create','body','find','findOne','params','ZohoField','options','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','end','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection'];(function(_0x3a65d0,_0x6b922a){var _0x5346c8=function(_0x3eb2a0){while(--_0x3eb2a0){_0x3a65d0['push'](_0x3a65d0['shift']());}};_0x5346c8(++_0x6b922a);}(_0xe552,0x113));var _0x2e55=function(_0x3351bf,_0x1acad8){_0x3351bf=_0x3351bf-0x0;var _0x535d15=_0xe552[_0x3351bf];return _0x535d15;};'use strict';var emlformat=require(_0x2e55('0x0'));var rimraf=require(_0x2e55('0x1'));var zipdir=require(_0x2e55('0x2'));var jsonpatch=require(_0x2e55('0x3'));var rp=require(_0x2e55('0x4'));var moment=require(_0x2e55('0x5'));var BPromise=require(_0x2e55('0x6'));var Mustache=require('mustache');var util=require(_0x2e55('0x7'));var path=require(_0x2e55('0x8'));var sox=require(_0x2e55('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e55('0xa'));var _=require(_0x2e55('0xb'));var squel=require(_0x2e55('0xc'));var crypto=require('crypto');var jsforce=require(_0x2e55('0xd'));var deskjs=require(_0x2e55('0xe'));var toCsv=require(_0x2e55('0xf'));var querystring=require(_0x2e55('0x10'));var Papa=require(_0x2e55('0x11'));var Redis=require(_0x2e55('0x12'));var authService=require(_0x2e55('0x13'));var qs=require(_0x2e55('0x14'));var as=require(_0x2e55('0x15'));var hardwareService=require(_0x2e55('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2e55('0x17'));var config=require(_0x2e55('0x18'));var licenseUtil=require(_0x2e55('0x19'));var db=require(_0x2e55('0x1a'))['db'];function respondWithStatusCode(_0x42fdc9,_0x5788cc){_0x5788cc=_0x5788cc||0xcc;return function(_0x18a81a){if(_0x18a81a){return _0x42fdc9[_0x2e55('0x1b')](_0x5788cc);}return _0x42fdc9[_0x2e55('0x1c')](_0x5788cc)['end']();};}function respondWithResult(_0x5f5dd1,_0x2271db){_0x2271db=_0x2271db||0xc8;return function(_0x48744b){if(_0x48744b){return _0x5f5dd1[_0x2e55('0x1c')](_0x2271db)['json'](_0x48744b);}};}function respondWithFilteredResult(_0x3e8d7c,_0x4855f9){return function(_0x346738){if(_0x346738){var _0x28082f=typeof _0x4855f9[_0x2e55('0x1d')]===_0x2e55('0x1e')&&typeof _0x4855f9[_0x2e55('0x1f')]==='undefined';var _0x2f834f=_0x346738['count'];var _0x4bced3=_0x28082f?0x0:_0x4855f9[_0x2e55('0x1d')];var _0x472d6e=_0x28082f?_0x346738[_0x2e55('0x20')]:_0x4855f9[_0x2e55('0x1d')]+_0x4855f9['limit'];var _0x1889c2;if(_0x472d6e>=_0x2f834f){_0x472d6e=_0x2f834f;_0x1889c2=0xc8;}else{_0x1889c2=0xce;}_0x3e8d7c[_0x2e55('0x1c')](_0x1889c2);return _0x3e8d7c[_0x2e55('0x21')](_0x2e55('0x22'),_0x4bced3+'-'+_0x472d6e+'/'+_0x2f834f)['json'](_0x346738);}return null;};}function patchUpdates(_0x5668f6){return function(_0x551639){try{jsonpatch['apply'](_0x551639,_0x5668f6,!![]);}catch(_0x47c213){return BPromise[_0x2e55('0x23')](_0x47c213);}return _0x551639[_0x2e55('0x24')]();};}function saveUpdates(_0x16f900,_0x1a86e4){return function(_0x42a1f0){if(_0x42a1f0){return _0x42a1f0['update'](_0x16f900)['then'](function(_0x2e2b70){return _0x2e2b70;});}return null;};}function removeEntity(_0x482537,_0x2c1716){return function(_0x90964a){if(_0x90964a){return _0x90964a[_0x2e55('0x25')]()['then'](function(){_0x482537[_0x2e55('0x1c')](0xcc)[_0x2e55('0x26')]();});}};}function handleEntityNotFound(_0x456280,_0x5b9fa7){return function(_0x3e9d4e){if(!_0x3e9d4e){_0x456280[_0x2e55('0x1b')](0x194);}return _0x3e9d4e;};}function handleError(_0x8ba078,_0x45a41e){_0x45a41e=_0x45a41e||0x1f4;return function(_0x1329a2){logger['error'](_0x1329a2['stack']);if(_0x1329a2['name']){delete _0x1329a2[_0x2e55('0x27')];}_0x8ba078[_0x2e55('0x1c')](_0x45a41e)[_0x2e55('0x28')](_0x1329a2);};}exports[_0x2e55('0x29')]=function(_0x778577,_0x2c3b28){var _0x598eab={},_0x2a4dab={},_0xd32b87={'count':0x0,'rows':[]};var _0x3f12d0=_[_0x2e55('0x2a')](db[_0x2e55('0x2b')][_0x2e55('0x2c')],function(_0x4a4d2a){return{'name':_0x4a4d2a[_0x2e55('0x2d')],'type':_0x4a4d2a['type'][_0x2e55('0x2e')]};});_0x2a4dab[_0x2e55('0x2f')]=_[_0x2e55('0x2a')](_0x3f12d0,_0x2e55('0x27'));_0x2a4dab[_0x2e55('0x30')]=_[_0x2e55('0x31')](_0x778577['query']);_0x2a4dab[_0x2e55('0x32')]=_['intersection'](_0x2a4dab[_0x2e55('0x2f')],_0x2a4dab[_0x2e55('0x30')]);_0x598eab[_0x2e55('0x33')]=_[_0x2e55('0x34')](_0x2a4dab['model'],qs[_0x2e55('0x35')](_0x778577['query'][_0x2e55('0x35')]));_0x598eab['attributes']=_0x598eab['attributes'][_0x2e55('0x36')]?_0x598eab['attributes']:_0x2a4dab['model'];if(!_0x778577[_0x2e55('0x30')][_0x2e55('0x37')](_0x2e55('0x38'))){_0x598eab['limit']=qs[_0x2e55('0x1f')](_0x778577['query'][_0x2e55('0x1f')]);_0x598eab[_0x2e55('0x1d')]=qs[_0x2e55('0x1d')](_0x778577[_0x2e55('0x30')][_0x2e55('0x1d')]);}_0x598eab[_0x2e55('0x39')]=qs[_0x2e55('0x3a')](_0x778577[_0x2e55('0x30')][_0x2e55('0x3a')]);_0x598eab[_0x2e55('0x3b')]=qs[_0x2e55('0x32')](_[_0x2e55('0x3c')](_0x778577[_0x2e55('0x30')],_0x2a4dab[_0x2e55('0x32')]),_0x3f12d0);if(_0x778577[_0x2e55('0x30')][_0x2e55('0x3d')]){_0x598eab[_0x2e55('0x3b')]=_[_0x2e55('0x3e')](_0x598eab[_0x2e55('0x3b')],{'$or':_['map'](_0x3f12d0,function(_0x3c0e3f){if(_0x3c0e3f[_0x2e55('0x3f')]!==_0x2e55('0x40')){var _0x265029={};_0x265029[_0x3c0e3f[_0x2e55('0x27')]]={'$like':'%'+_0x778577[_0x2e55('0x30')][_0x2e55('0x3d')]+'%'};return _0x265029;}})});}_0x598eab=_[_0x2e55('0x3e')]({},_0x598eab,_0x778577['options']);var _0x993d21={'where':_0x598eab['where']};return db[_0x2e55('0x2b')][_0x2e55('0x20')](_0x993d21)[_0x2e55('0x41')](function(_0x4b5a0a){_0xd32b87['count']=_0x4b5a0a;if(_0x778577[_0x2e55('0x30')][_0x2e55('0x42')]){_0x598eab[_0x2e55('0x43')]=[{'all':!![]}];}return db[_0x2e55('0x2b')][_0x2e55('0x44')](_0x598eab);})[_0x2e55('0x41')](function(_0x4017e8){_0xd32b87[_0x2e55('0x45')]=_0x4017e8;return _0xd32b87;})[_0x2e55('0x41')](respondWithFilteredResult(_0x2c3b28,_0x598eab))[_0x2e55('0x46')](handleError(_0x2c3b28,null));};exports[_0x2e55('0x47')]=function(_0x593cfe,_0x3da15f){var _0xd75a5f={'raw':![],'where':{'id':_0x593cfe['params']['id']}},_0x433cea={};_0x433cea[_0x2e55('0x2f')]=_[_0x2e55('0x31')](db[_0x2e55('0x2b')][_0x2e55('0x2c')]);_0x433cea[_0x2e55('0x30')]=_[_0x2e55('0x31')](_0x593cfe['query']);_0x433cea[_0x2e55('0x32')]=_[_0x2e55('0x34')](_0x433cea[_0x2e55('0x2f')],_0x433cea[_0x2e55('0x30')]);_0xd75a5f['attributes']=_[_0x2e55('0x34')](_0x433cea[_0x2e55('0x2f')],qs[_0x2e55('0x35')](_0x593cfe[_0x2e55('0x30')][_0x2e55('0x35')]));_0xd75a5f[_0x2e55('0x33')]=_0xd75a5f[_0x2e55('0x33')][_0x2e55('0x36')]?_0xd75a5f[_0x2e55('0x33')]:_0x433cea[_0x2e55('0x2f')];if(_0x593cfe[_0x2e55('0x30')][_0x2e55('0x42')]){_0xd75a5f['include']=[{'all':!![]}];}_0xd75a5f=_[_0x2e55('0x3e')]({},_0xd75a5f,_0x593cfe['options']);return db[_0x2e55('0x2b')]['find'](_0xd75a5f)[_0x2e55('0x41')](handleEntityNotFound(_0x3da15f,null))[_0x2e55('0x41')](respondWithResult(_0x3da15f,null))['catch'](handleError(_0x3da15f,null));};exports[_0x2e55('0x48')]=function(_0x4799f0,_0x490db6){return db[_0x2e55('0x2b')][_0x2e55('0x48')](_0x4799f0[_0x2e55('0x49')],{})[_0x2e55('0x41')](respondWithResult(_0x490db6,0xc9))[_0x2e55('0x46')](handleError(_0x490db6,null));};exports['update']=function(_0x244523,_0x7b9335){if(_0x244523[_0x2e55('0x49')]['id']){delete _0x244523[_0x2e55('0x49')]['id'];}return db[_0x2e55('0x2b')][_0x2e55('0x4a')]({'where':{'id':_0x244523['params']['id']}})[_0x2e55('0x41')](handleEntityNotFound(_0x7b9335,null))['then'](saveUpdates(_0x244523[_0x2e55('0x49')],null))['then'](respondWithResult(_0x7b9335,null))[_0x2e55('0x46')](handleError(_0x7b9335,null));};exports['destroy']=function(_0x3b380c,_0x19c471){return db['ZohoConfiguration'][_0x2e55('0x4a')]({'where':{'id':_0x3b380c['params']['id']}})['then'](handleEntityNotFound(_0x19c471,null))[_0x2e55('0x41')](removeEntity(_0x19c471,null))['catch'](handleError(_0x19c471,null));};exports['getFields']=function(_0x32214a,_0xfa48a7,_0xaa7dcb){var _0x3fe8c2={};var _0x1ddc3e={};var _0x1cbe10;var _0x5ac358;return db[_0x2e55('0x2b')][_0x2e55('0x4b')]({'where':{'id':_0x32214a[_0x2e55('0x4c')]['id']}})[_0x2e55('0x41')](handleEntityNotFound(_0xfa48a7,null))['then'](function(_0xa24639){if(_0xa24639){_0x1cbe10=_0xa24639;_0x1ddc3e[_0x2e55('0x2f')]=_[_0x2e55('0x31')](db[_0x2e55('0x4d')][_0x2e55('0x2c')]);_0x1ddc3e[_0x2e55('0x30')]=_['keys'](_0x32214a[_0x2e55('0x30')]);_0x1ddc3e['filters']=_['intersection'](_0x1ddc3e[_0x2e55('0x2f')],_0x1ddc3e[_0x2e55('0x30')]);_0x3fe8c2[_0x2e55('0x33')]=_[_0x2e55('0x34')](_0x1ddc3e[_0x2e55('0x2f')],qs['fields'](_0x32214a['query']['fields']));_0x3fe8c2[_0x2e55('0x33')]=_0x3fe8c2[_0x2e55('0x33')][_0x2e55('0x36')]?_0x3fe8c2['attributes']:_0x1ddc3e[_0x2e55('0x2f')];_0x3fe8c2[_0x2e55('0x39')]=qs[_0x2e55('0x3a')](_0x32214a['query'][_0x2e55('0x3a')]);_0x3fe8c2['where']=qs['filters'](_[_0x2e55('0x3c')](_0x32214a['query'],_0x1ddc3e['filters']));if(_0x32214a[_0x2e55('0x30')][_0x2e55('0x3d')]){_0x3fe8c2[_0x2e55('0x3b')]=_[_0x2e55('0x3e')](_0x3fe8c2[_0x2e55('0x3b')],{'$or':_['map'](_0x3fe8c2[_0x2e55('0x33')],function(_0x26f0b7){var _0x5a988a={};_0x5a988a[_0x26f0b7]={'$like':'%'+_0x32214a[_0x2e55('0x30')][_0x2e55('0x3d')]+'%'};return _0x5a988a;})});}_0x3fe8c2=_['merge']({},_0x3fe8c2,_0x32214a[_0x2e55('0x4e')]);return _0x1cbe10[_0x2e55('0x4f')](_0x3fe8c2);}})[_0x2e55('0x41')](function(_0x4e7fb2){if(_0x4e7fb2){_0x5ac358=_0x4e7fb2[_0x2e55('0x36')];if(!_0x32214a[_0x2e55('0x30')]['hasOwnProperty']('nolimit')){_0x3fe8c2[_0x2e55('0x1f')]=qs[_0x2e55('0x1f')](_0x32214a['query']['limit']);_0x3fe8c2['offset']=qs[_0x2e55('0x1d')](_0x32214a[_0x2e55('0x30')][_0x2e55('0x1d')]);}return _0x1cbe10[_0x2e55('0x4f')](_0x3fe8c2);}})[_0x2e55('0x41')](function(_0x16dba5){if(_0x16dba5){return _0x16dba5?{'count':_0x5ac358,'rows':_0x16dba5}:null;}})[_0x2e55('0x41')](respondWithResult(_0xfa48a7,null))[_0x2e55('0x46')](handleError(_0xfa48a7,null));};exports[_0x2e55('0x50')]=function(_0x33c236,_0x109d4a,_0x4b200d){var _0xe48826={};var _0x4931de={};var _0x5d1ec5;var _0x3c5cde;return db[_0x2e55('0x2b')][_0x2e55('0x4b')]({'where':{'id':_0x33c236[_0x2e55('0x4c')]['id']}})[_0x2e55('0x41')](handleEntityNotFound(_0x109d4a,null))[_0x2e55('0x41')](function(_0x5c7086){if(_0x5c7086){_0x5d1ec5=_0x5c7086;_0x4931de['model']=_[_0x2e55('0x31')](db[_0x2e55('0x4d')][_0x2e55('0x2c')]);_0x4931de[_0x2e55('0x30')]=_[_0x2e55('0x31')](_0x33c236['query']);_0x4931de[_0x2e55('0x32')]=_[_0x2e55('0x34')](_0x4931de[_0x2e55('0x2f')],_0x4931de[_0x2e55('0x30')]);_0xe48826[_0x2e55('0x33')]=_[_0x2e55('0x34')](_0x4931de[_0x2e55('0x2f')],qs[_0x2e55('0x35')](_0x33c236[_0x2e55('0x30')][_0x2e55('0x35')]));_0xe48826[_0x2e55('0x33')]=_0xe48826[_0x2e55('0x33')][_0x2e55('0x36')]?_0xe48826['attributes']:_0x4931de[_0x2e55('0x2f')];_0xe48826[_0x2e55('0x39')]=qs[_0x2e55('0x3a')](_0x33c236[_0x2e55('0x30')][_0x2e55('0x3a')]);_0xe48826['where']=qs[_0x2e55('0x32')](_[_0x2e55('0x3c')](_0x33c236[_0x2e55('0x30')],_0x4931de[_0x2e55('0x32')]));if(_0x33c236['query'][_0x2e55('0x3d')]){_0xe48826[_0x2e55('0x3b')]=_[_0x2e55('0x3e')](_0xe48826[_0x2e55('0x3b')],{'$or':_[_0x2e55('0x2a')](_0xe48826['attributes'],function(_0xe95b3e){var _0x63bc36={};_0x63bc36[_0xe95b3e]={'$like':'%'+_0x33c236[_0x2e55('0x30')][_0x2e55('0x3d')]+'%'};return _0x63bc36;})});}_0xe48826=_[_0x2e55('0x3e')]({},_0xe48826,_0x33c236[_0x2e55('0x4e')]);return _0x5d1ec5[_0x2e55('0x50')](_0xe48826);}})['then'](function(_0x2acf51){if(_0x2acf51){_0x3c5cde=_0x2acf51[_0x2e55('0x36')];if(!_0x33c236[_0x2e55('0x30')][_0x2e55('0x37')](_0x2e55('0x38'))){_0xe48826[_0x2e55('0x1f')]=qs['limit'](_0x33c236['query'][_0x2e55('0x1f')]);_0xe48826[_0x2e55('0x1d')]=qs[_0x2e55('0x1d')](_0x33c236[_0x2e55('0x30')]['offset']);}return _0x5d1ec5['getSubjects'](_0xe48826);}})[_0x2e55('0x41')](function(_0x3d25ea){if(_0x3d25ea){return _0x3d25ea?{'count':_0x3c5cde,'rows':_0x3d25ea}:null;}})[_0x2e55('0x41')](respondWithResult(_0x109d4a,null))['catch'](handleError(_0x109d4a,null));};exports[_0x2e55('0x51')]=function(_0x248887,_0x123ab1,_0x3f614b){var _0x18aa8f={};var _0x3a7820={};var _0x38dba8;var _0x1e33ea;return db['ZohoConfiguration'][_0x2e55('0x4b')]({'where':{'id':_0x248887[_0x2e55('0x4c')]['id']}})[_0x2e55('0x41')](handleEntityNotFound(_0x123ab1,null))[_0x2e55('0x41')](function(_0x2a6965){if(_0x2a6965){_0x38dba8=_0x2a6965;_0x3a7820[_0x2e55('0x2f')]=_[_0x2e55('0x31')](db[_0x2e55('0x4d')][_0x2e55('0x2c')]);_0x3a7820[_0x2e55('0x30')]=_[_0x2e55('0x31')](_0x248887[_0x2e55('0x30')]);_0x3a7820[_0x2e55('0x32')]=_['intersection'](_0x3a7820[_0x2e55('0x2f')],_0x3a7820[_0x2e55('0x30')]);_0x18aa8f[_0x2e55('0x33')]=_['intersection'](_0x3a7820[_0x2e55('0x2f')],qs[_0x2e55('0x35')](_0x248887[_0x2e55('0x30')]['fields']));_0x18aa8f[_0x2e55('0x33')]=_0x18aa8f[_0x2e55('0x33')][_0x2e55('0x36')]?_0x18aa8f[_0x2e55('0x33')]:_0x3a7820[_0x2e55('0x2f')];_0x18aa8f['order']=qs[_0x2e55('0x3a')](_0x248887[_0x2e55('0x30')]['sort']);_0x18aa8f['where']=qs[_0x2e55('0x32')](_[_0x2e55('0x3c')](_0x248887[_0x2e55('0x30')],_0x3a7820[_0x2e55('0x32')]));if(_0x248887['query']['filter']){_0x18aa8f['where']=_[_0x2e55('0x3e')](_0x18aa8f[_0x2e55('0x3b')],{'$or':_[_0x2e55('0x2a')](_0x18aa8f[_0x2e55('0x33')],function(_0x3a564d){var _0x26af1c={};_0x26af1c[_0x3a564d]={'$like':'%'+_0x248887[_0x2e55('0x30')]['filter']+'%'};return _0x26af1c;})});}_0x18aa8f=_[_0x2e55('0x3e')]({},_0x18aa8f,_0x248887[_0x2e55('0x4e')]);return _0x38dba8[_0x2e55('0x51')](_0x18aa8f);}})[_0x2e55('0x41')](function(_0x376f8f){if(_0x376f8f){_0x1e33ea=_0x376f8f[_0x2e55('0x36')];if(!_0x248887[_0x2e55('0x30')][_0x2e55('0x37')](_0x2e55('0x38'))){_0x18aa8f[_0x2e55('0x1f')]=qs[_0x2e55('0x1f')](_0x248887[_0x2e55('0x30')]['limit']);_0x18aa8f[_0x2e55('0x1d')]=qs[_0x2e55('0x1d')](_0x248887['query']['offset']);}return _0x38dba8[_0x2e55('0x51')](_0x18aa8f);}})[_0x2e55('0x41')](function(_0x205c51){if(_0x205c51){return _0x205c51?{'count':_0x1e33ea,'rows':_0x205c51}:null;}})[_0x2e55('0x41')](respondWithResult(_0x123ab1,null))[_0x2e55('0x46')](handleError(_0x123ab1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 15de9d5..4aba76e 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 _0x62ee=['api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x62ee,0x1dd));var _0xe62e=function(_0x1dc591,_0x22643a){_0x1dc591=_0x1dc591-0x0;var _0x2d107b=_0x62ee[_0x1dc591];return _0x2d107b;};'use strict';var _=require(_0xe62e('0x0'));var util=require(_0xe62e('0x1'));var logger=require(_0xe62e('0x2'))(_0xe62e('0x3'));var moment=require(_0xe62e('0x4'));var BPromise=require(_0xe62e('0x5'));var rp=require(_0xe62e('0x6'));var fs=require('fs');var path=require(_0xe62e('0x7'));var rimraf=require('rimraf');var config=require(_0xe62e('0x8'));var attributes=require(_0xe62e('0x9'));module['exports']=function(_0x4ff8ce,_0x3d945e){return _0x4ff8ce[_0xe62e('0xa')]('ZohoConfiguration',attributes,{'tableName':_0xe62e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fad=['exports','ZohoConfiguration','lodash','util','api','request-promise','rimraf','./intZohoConfiguration.attributes'];(function(_0x5312f9,_0x37a6a6){var _0x48a2c2=function(_0x536efe){while(--_0x536efe){_0x5312f9['push'](_0x5312f9['shift']());}};_0x48a2c2(++_0x37a6a6);}(_0x7fad,0xba));var _0xd7fa=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x7fad[_0x16cb03];return _0x10944e;};'use strict';var _=require(_0xd7fa('0x0'));var util=require(_0xd7fa('0x1'));var logger=require('../../config/logger')(_0xd7fa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd7fa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7fa('0x4'));var config=require('../../config/environment');var attributes=require(_0xd7fa('0x5'));module[_0xd7fa('0x6')]=function(_0x4fba4e,_0x215590){return _0x4fba4e['define'](_0xd7fa('0x7'),attributes,{'tableName':'int_zoho_configurations','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 ce66419..8da3820 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 _0xbc48=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x58e590,_0x1c3ffa){var _0x1f2777=function(_0x39b1a0){while(--_0x39b1a0){_0x58e590['push'](_0x58e590['shift']());}};_0x1f2777(++_0x1c3ffa);}(_0xbc48,0xec));var _0x8bc4=function(_0x55fa6b,_0xaa82c4){_0x55fa6b=_0x55fa6b-0x0;var _0x3db186=_0xbc48[_0x55fa6b];return _0x3db186;};'use strict';var _=require(_0x8bc4('0x0'));var util=require('util');var moment=require(_0x8bc4('0x1'));var BPromise=require(_0x8bc4('0x2'));var rs=require(_0x8bc4('0x3'));var fs=require('fs');var Redis=require(_0x8bc4('0x4'));var db=require(_0x8bc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bc4('0x6'))('rpc');var config=require(_0x8bc4('0x7'));var jayson=require(_0x8bc4('0x8'));var client=jayson['client'][_0x8bc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7f21,_0x4641bc,_0x11a9bd){return new BPromise(function(_0x24d788,_0x3f5a4d){return client[_0x8bc4('0xa')](_0x3b7f21,_0x11a9bd)['then'](function(_0x3f9d0d){logger[_0x8bc4('0xb')](_0x8bc4('0xc'),_0x4641bc,_0x8bc4('0xd'));logger[_0x8bc4('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4641bc,_0x8bc4('0xd'),JSON['stringify'](_0x3f9d0d));if(_0x3f9d0d[_0x8bc4('0xf')]){if(_0x3f9d0d[_0x8bc4('0xf')][_0x8bc4('0x10')]===0x1f4){logger[_0x8bc4('0xf')](_0x8bc4('0xc'),_0x4641bc,_0x3f9d0d[_0x8bc4('0xf')][_0x8bc4('0x11')]);return _0x3f5a4d(_0x3f9d0d[_0x8bc4('0xf')][_0x8bc4('0x11')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4641bc,_0x3f9d0d['error'][_0x8bc4('0x11')]);return _0x24d788(_0x3f9d0d[_0x8bc4('0xf')][_0x8bc4('0x11')]);}else{logger[_0x8bc4('0xb')](_0x8bc4('0xc'),_0x4641bc,'request\x20sent');_0x24d788(_0x3f9d0d[_0x8bc4('0x12')][_0x8bc4('0x11')]);}})[_0x8bc4('0x13')](function(_0x116c68){logger[_0x8bc4('0xf')](_0x8bc4('0xc'),_0x4641bc,_0x116c68);_0x3f5a4d(_0x116c68);});});} \ No newline at end of file +var _0xde5e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e8eb4,_0x53a726){var _0x3e3e6e=function(_0x29dbf3){while(--_0x29dbf3){_0x1e8eb4['push'](_0x1e8eb4['shift']());}};_0x3e3e6e(++_0x53a726);}(_0xde5e,0x1b4));var _0xede5=function(_0x30efc4,_0x2ff8d7){_0x30efc4=_0x30efc4-0x0;var _0x1382d3=_0xde5e[_0x30efc4];return _0x1382d3;};'use strict';var _=require(_0xede5('0x0'));var util=require(_0xede5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xede5('0x2'));var db=require(_0xede5('0x3'))['db'];var utils=require(_0xede5('0x4'));var logger=require(_0xede5('0x5'))(_0xede5('0x6'));var config=require(_0xede5('0x7'));var jayson=require(_0xede5('0x8'));var client=jayson[_0xede5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c3aa6,_0x335bef,_0x4524d0){return new BPromise(function(_0x1af4fb,_0x32cc14){return client[_0xede5('0xa')](_0x1c3aa6,_0x4524d0)[_0xede5('0xb')](function(_0x5a743b){logger[_0xede5('0xc')](_0xede5('0xd'),_0x335bef,_0xede5('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x335bef,_0xede5('0xe'),JSON[_0xede5('0xf')](_0x5a743b));if(_0x5a743b['error']){if(_0x5a743b[_0xede5('0x10')][_0xede5('0x11')]===0x1f4){logger[_0xede5('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x335bef,_0x5a743b[_0xede5('0x10')][_0xede5('0x12')]);return _0x32cc14(_0x5a743b[_0xede5('0x10')]['message']);}logger[_0xede5('0x10')](_0xede5('0xd'),_0x335bef,_0x5a743b[_0xede5('0x10')][_0xede5('0x12')]);return _0x1af4fb(_0x5a743b[_0xede5('0x10')][_0xede5('0x12')]);}else{logger['info'](_0xede5('0xd'),_0x335bef,_0xede5('0xe'));_0x1af4fb(_0x5a743b[_0xede5('0x13')][_0xede5('0x12')]);}})[_0xede5('0x14')](function(_0x890006){logger[_0xede5('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x335bef,_0x890006);_0x32cc14(_0x890006);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index beec502..0ff85e8 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 _0xf3b6=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3b6,0x185));var _0x6f3b=function(_0x38b020,_0x14a8a0){_0x38b020=_0x38b020-0x0;var _0x4b3f04=_0xf3b6[_0x38b020];return _0x4b3f04;};'use strict';var multer=require(_0x6f3b('0x0'));var util=require('util');var path=require(_0x6f3b('0x1'));var timeout=require(_0x6f3b('0x2'));var express=require(_0x6f3b('0x3'));var router=express[_0x6f3b('0x4')]();var fs_extra=require(_0x6f3b('0x5'));var auth=require(_0x6f3b('0x6'));var interaction=require(_0x6f3b('0x7'));var config=require(_0x6f3b('0x8'));var controller=require('./intZohoField.controller');router[_0x6f3b('0x9')]('/',auth[_0x6f3b('0xa')](),controller[_0x6f3b('0xb')]);router['get'](_0x6f3b('0xc'),auth[_0x6f3b('0xa')](),controller[_0x6f3b('0xd')]);router[_0x6f3b('0xe')]('/',auth[_0x6f3b('0xa')](),controller[_0x6f3b('0xf')]);router[_0x6f3b('0x10')]('/:id',auth[_0x6f3b('0xa')](),controller['update']);router[_0x6f3b('0x11')]('/:id',auth[_0x6f3b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3008=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x3008,0xd6));var _0x8300=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x3008[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x8300('0x0'));var util=require(_0x8300('0x1'));var path=require(_0x8300('0x2'));var timeout=require(_0x8300('0x3'));var express=require(_0x8300('0x4'));var router=express[_0x8300('0x5')]();var fs_extra=require(_0x8300('0x6'));var auth=require(_0x8300('0x7'));var interaction=require(_0x8300('0x8'));var config=require(_0x8300('0x9'));var controller=require(_0x8300('0xa'));router[_0x8300('0xb')]('/',auth[_0x8300('0xc')](),controller['index']);router[_0x8300('0xb')](_0x8300('0xd'),auth['isAuthenticated'](),controller[_0x8300('0xe')]);router[_0x8300('0xf')]('/',auth[_0x8300('0xc')](),controller[_0x8300('0x10')]);router[_0x8300('0x11')](_0x8300('0xd'),auth[_0x8300('0xc')](),controller['update']);router[_0x8300('0x12')](_0x8300('0xd'),auth[_0x8300('0xc')](),controller[_0x8300('0x13')]);module[_0x8300('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6d397e6..0928a96 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 _0x6c60=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x6c60,0x145));var _0x06c6=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x6c60[_0x412e27];return _0x53da42;};'use strict';var Sequelize=require('sequelize');module[_0x06c6('0x0')]={'type':{'type':Sequelize[_0x06c6('0x1')](_0x06c6('0x2'),_0x06c6('0x3'),_0x06c6('0x4'),_0x06c6('0x5'),_0x06c6('0x6')),'defaultValue':_0x06c6('0x2')},'content':{'type':Sequelize[_0x06c6('0x7')]},'key':{'type':Sequelize[_0x06c6('0x7')]},'keyType':{'type':Sequelize[_0x06c6('0x1')](_0x06c6('0x2'),_0x06c6('0x3'),_0x06c6('0x4'))},'keyContent':{'type':Sequelize[_0x06c6('0x7')]},'idField':{'type':Sequelize[_0x06c6('0x7')]},'nameField':{'type':Sequelize[_0x06c6('0x7')]},'customField':{'type':Sequelize[_0x06c6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x06c6('0x7')]}}; \ No newline at end of file +var _0xf52b=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN'];(function(_0x5bc158,_0x20ba90){var _0x288d43=function(_0x4e1c7f){while(--_0x4e1c7f){_0x5bc158['push'](_0x5bc158['shift']());}};_0x288d43(++_0x20ba90);}(_0xf52b,0x18f));var _0xbf52=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0xf52b[_0xb24fad];return _0x173226;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xbf52('0x0')]('string',_0xbf52('0x1'),_0xbf52('0x2'),'keyValue',_0xbf52('0x3')),'defaultValue':_0xbf52('0x4')},'content':{'type':Sequelize[_0xbf52('0x5')]},'key':{'type':Sequelize[_0xbf52('0x5')]},'keyType':{'type':Sequelize[_0xbf52('0x0')](_0xbf52('0x4'),_0xbf52('0x1'),_0xbf52('0x2'))},'keyContent':{'type':Sequelize[_0xbf52('0x5')]},'idField':{'type':Sequelize[_0xbf52('0x5')]},'nameField':{'type':Sequelize[_0xbf52('0x5')]},'customField':{'type':Sequelize[_0xbf52('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7bcdbb0..2ef383a 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 _0x736b=['name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','create','body','update','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','stack'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x736b,0x1d2));var _0xb736=function(_0x4b594e,_0x59c2d0){_0x4b594e=_0x4b594e-0x0;var _0x1eb121=_0x736b[_0x4b594e];return _0x1eb121;};'use strict';var emlformat=require(_0xb736('0x0'));var rimraf=require(_0xb736('0x1'));var zipdir=require(_0xb736('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb736('0x3'));var BPromise=require(_0xb736('0x4'));var Mustache=require(_0xb736('0x5'));var util=require('util');var path=require(_0xb736('0x6'));var sox=require(_0xb736('0x7'));var csv=require(_0xb736('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb736('0x9'));var squel=require(_0xb736('0xa'));var crypto=require(_0xb736('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb736('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb736('0xd'));var Redis=require('ioredis');var authService=require(_0xb736('0xe'));var qs=require(_0xb736('0xf'));var as=require(_0xb736('0x10'));var hardwareService=require(_0xb736('0x11'));var logger=require(_0xb736('0x12'))(_0xb736('0x13'));var utils=require(_0xb736('0x14'));var config=require(_0xb736('0x15'));var licenseUtil=require(_0xb736('0x16'));var db=require(_0xb736('0x17'))['db'];function respondWithStatusCode(_0x530c72,_0x1384e8){_0x1384e8=_0x1384e8||0xcc;return function(_0x3a8d34){if(_0x3a8d34){return _0x530c72[_0xb736('0x18')](_0x1384e8);}return _0x530c72[_0xb736('0x19')](_0x1384e8)[_0xb736('0x1a')]();};}function respondWithResult(_0x28f04a,_0x2f51fc){_0x2f51fc=_0x2f51fc||0xc8;return function(_0x4fcd06){if(_0x4fcd06){return _0x28f04a['status'](_0x2f51fc)[_0xb736('0x1b')](_0x4fcd06);}};}function respondWithFilteredResult(_0x3aae35,_0x4e69a4){return function(_0x1c5fac){if(_0x1c5fac){var _0x487e38=typeof _0x4e69a4[_0xb736('0x1c')]==='undefined'&&typeof _0x4e69a4[_0xb736('0x1d')]===_0xb736('0x1e');var _0x5dd4f1=_0x1c5fac[_0xb736('0x1f')];var _0x28ebad=_0x487e38?0x0:_0x4e69a4[_0xb736('0x1c')];var _0x4165d5=_0x487e38?_0x1c5fac[_0xb736('0x1f')]:_0x4e69a4[_0xb736('0x1c')]+_0x4e69a4[_0xb736('0x1d')];var _0x78aa14;if(_0x4165d5>=_0x5dd4f1){_0x4165d5=_0x5dd4f1;_0x78aa14=0xc8;}else{_0x78aa14=0xce;}_0x3aae35['status'](_0x78aa14);return _0x3aae35[_0xb736('0x20')](_0xb736('0x21'),_0x28ebad+'-'+_0x4165d5+'/'+_0x5dd4f1)['json'](_0x1c5fac);}return null;};}function patchUpdates(_0x26caf9){return function(_0x23f897){try{jsonpatch[_0xb736('0x22')](_0x23f897,_0x26caf9,!![]);}catch(_0x3972ff){return BPromise['reject'](_0x3972ff);}return _0x23f897['save']();};}function saveUpdates(_0x5562a4,_0x57ecea){return function(_0x2f6750){if(_0x2f6750){return _0x2f6750['update'](_0x5562a4)[_0xb736('0x23')](function(_0x1b4b84){return _0x1b4b84;});}return null;};}function removeEntity(_0xb14cb2,_0x3762cf){return function(_0x4489c1){if(_0x4489c1){return _0x4489c1[_0xb736('0x24')]()[_0xb736('0x23')](function(){_0xb14cb2[_0xb736('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x848894,_0x407731){return function(_0x2a0d01){if(!_0x2a0d01){_0x848894[_0xb736('0x18')](0x194);}return _0x2a0d01;};}function handleError(_0x29c581,_0x13c99e){_0x13c99e=_0x13c99e||0x1f4;return function(_0x3aba30){logger['error'](_0x3aba30[_0xb736('0x25')]);if(_0x3aba30[_0xb736('0x26')]){delete _0x3aba30['name'];}_0x29c581[_0xb736('0x19')](_0x13c99e)[_0xb736('0x27')](_0x3aba30);};}exports[_0xb736('0x28')]=function(_0x2c4ab1,_0x2e0bb0){var _0x701f14={},_0x311c72={},_0x2966c7={'count':0x0,'rows':[]};var _0x2898e5=_[_0xb736('0x29')](db[_0xb736('0x2a')][_0xb736('0x2b')],function(_0x14a1b4){return{'name':_0x14a1b4[_0xb736('0x2c')],'type':_0x14a1b4[_0xb736('0x2d')]['key']};});_0x311c72[_0xb736('0x2e')]=_['map'](_0x2898e5,_0xb736('0x26'));_0x311c72[_0xb736('0x2f')]=_['keys'](_0x2c4ab1[_0xb736('0x2f')]);_0x311c72[_0xb736('0x30')]=_[_0xb736('0x31')](_0x311c72[_0xb736('0x2e')],_0x311c72[_0xb736('0x2f')]);_0x701f14[_0xb736('0x32')]=_[_0xb736('0x31')](_0x311c72[_0xb736('0x2e')],qs[_0xb736('0x33')](_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x33')]));_0x701f14[_0xb736('0x32')]=_0x701f14[_0xb736('0x32')][_0xb736('0x34')]?_0x701f14[_0xb736('0x32')]:_0x311c72[_0xb736('0x2e')];if(!_0x2c4ab1[_0xb736('0x2f')]['hasOwnProperty'](_0xb736('0x35'))){_0x701f14['limit']=qs['limit'](_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x1d')]);_0x701f14['offset']=qs[_0xb736('0x1c')](_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x1c')]);}_0x701f14[_0xb736('0x36')]=qs[_0xb736('0x37')](_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x37')]);_0x701f14[_0xb736('0x38')]=qs[_0xb736('0x30')](_['pick'](_0x2c4ab1[_0xb736('0x2f')],_0x311c72[_0xb736('0x30')]),_0x2898e5);if(_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x39')]){_0x701f14[_0xb736('0x38')]=_[_0xb736('0x3a')](_0x701f14[_0xb736('0x38')],{'$or':_[_0xb736('0x29')](_0x2898e5,function(_0xd301d9){if(_0xd301d9[_0xb736('0x2d')]!==_0xb736('0x3b')){var _0x59747f={};_0x59747f[_0xd301d9[_0xb736('0x26')]]={'$like':'%'+_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x39')]+'%'};return _0x59747f;}})});}_0x701f14=_['merge']({},_0x701f14,_0x2c4ab1[_0xb736('0x3c')]);var _0x2bdf6e={'where':_0x701f14[_0xb736('0x38')]};return db[_0xb736('0x2a')][_0xb736('0x1f')](_0x2bdf6e)[_0xb736('0x23')](function(_0x52d2c0){_0x2966c7[_0xb736('0x1f')]=_0x52d2c0;if(_0x2c4ab1[_0xb736('0x2f')][_0xb736('0x3d')]){_0x701f14['include']=[{'all':!![]}];}return db['ZohoField'][_0xb736('0x3e')](_0x701f14);})[_0xb736('0x23')](function(_0x5b51cc){_0x2966c7[_0xb736('0x3f')]=_0x5b51cc;return _0x2966c7;})[_0xb736('0x23')](respondWithFilteredResult(_0x2e0bb0,_0x701f14))[_0xb736('0x40')](handleError(_0x2e0bb0,null));};exports['show']=function(_0x4d8669,_0x582a0c){var _0x21521d={'raw':!![],'where':{'id':_0x4d8669[_0xb736('0x41')]['id']}},_0x3c1237={};_0x3c1237[_0xb736('0x2e')]=_[_0xb736('0x42')](db[_0xb736('0x2a')][_0xb736('0x2b')]);_0x3c1237[_0xb736('0x2f')]=_[_0xb736('0x42')](_0x4d8669[_0xb736('0x2f')]);_0x3c1237[_0xb736('0x30')]=_['intersection'](_0x3c1237[_0xb736('0x2e')],_0x3c1237[_0xb736('0x2f')]);_0x21521d[_0xb736('0x32')]=_[_0xb736('0x31')](_0x3c1237[_0xb736('0x2e')],qs[_0xb736('0x33')](_0x4d8669[_0xb736('0x2f')]['fields']));_0x21521d[_0xb736('0x32')]=_0x21521d[_0xb736('0x32')][_0xb736('0x34')]?_0x21521d[_0xb736('0x32')]:_0x3c1237[_0xb736('0x2e')];if(_0x4d8669[_0xb736('0x2f')][_0xb736('0x3d')]){_0x21521d[_0xb736('0x43')]=[{'all':!![]}];}_0x21521d=_[_0xb736('0x3a')]({},_0x21521d,_0x4d8669['options']);return db[_0xb736('0x2a')]['find'](_0x21521d)['then'](handleEntityNotFound(_0x582a0c,null))[_0xb736('0x23')](respondWithResult(_0x582a0c,null))[_0xb736('0x40')](handleError(_0x582a0c,null));};exports[_0xb736('0x44')]=function(_0x27d067,_0x53d6e9){return db['ZohoField']['create'](_0x27d067[_0xb736('0x45')],{})[_0xb736('0x23')](respondWithResult(_0x53d6e9,0xc9))[_0xb736('0x40')](handleError(_0x53d6e9,null));};exports[_0xb736('0x46')]=function(_0x15b5ff,_0x325684){if(_0x15b5ff[_0xb736('0x45')]['id']){delete _0x15b5ff[_0xb736('0x45')]['id'];}return db[_0xb736('0x2a')][_0xb736('0x47')]({'where':{'id':_0x15b5ff[_0xb736('0x41')]['id']}})[_0xb736('0x23')](handleEntityNotFound(_0x325684,null))[_0xb736('0x23')](saveUpdates(_0x15b5ff['body'],null))['then'](respondWithResult(_0x325684,null))[_0xb736('0x40')](handleError(_0x325684,null));};exports['destroy']=function(_0xea5927,_0x2fc6c7){return db[_0xb736('0x2a')][_0xb736('0x47')]({'where':{'id':_0xea5927[_0xb736('0x41')]['id']}})[_0xb736('0x23')](handleEntityNotFound(_0x2fc6c7,null))[_0xb736('0x23')](removeEntity(_0x2fc6c7,null))['catch'](handleError(_0x2fc6c7,null));}; \ No newline at end of file +var _0xb8ae=['hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','destroy','then','error','stack','send','index','map','ZohoField','fieldName','type','key','name','query','keys','intersection','model','attributes','fields'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xb8ae,0x1c0));var _0xeb8a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xb8ae[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb8a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb8a('0x1'));var rp=require(_0xeb8a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb8a('0x3'));var util=require(_0xeb8a('0x4'));var path=require('path');var sox=require(_0xeb8a('0x5'));var csv=require('to-csv');var ejs=require(_0xeb8a('0x6'));var fs=require('fs');var fs_extra=require(_0xeb8a('0x7'));var _=require(_0xeb8a('0x8'));var squel=require(_0xeb8a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb8a('0xa'));var toCsv=require(_0xeb8a('0xb'));var querystring=require(_0xeb8a('0xc'));var Papa=require(_0xeb8a('0xd'));var Redis=require('ioredis');var authService=require(_0xeb8a('0xe'));var qs=require(_0xeb8a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb8a('0x10'));var logger=require(_0xeb8a('0x11'))(_0xeb8a('0x12'));var utils=require('../../config/utils');var config=require(_0xeb8a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e7d05,_0x5cb88e){_0x5cb88e=_0x5cb88e||0xcc;return function(_0x3b4301){if(_0x3b4301){return _0x4e7d05[_0xeb8a('0x14')](_0x5cb88e);}return _0x4e7d05[_0xeb8a('0x15')](_0x5cb88e)[_0xeb8a('0x16')]();};}function respondWithResult(_0x45d4ec,_0x191462){_0x191462=_0x191462||0xc8;return function(_0x20e2bc){if(_0x20e2bc){return _0x45d4ec['status'](_0x191462)[_0xeb8a('0x17')](_0x20e2bc);}};}function respondWithFilteredResult(_0x3e2975,_0x28e399){return function(_0x56fd1e){if(_0x56fd1e){var _0x43b947=typeof _0x28e399[_0xeb8a('0x18')]===_0xeb8a('0x19')&&typeof _0x28e399[_0xeb8a('0x1a')]===_0xeb8a('0x19');var _0x43a70a=_0x56fd1e['count'];var _0x1ec2bf=_0x43b947?0x0:_0x28e399[_0xeb8a('0x18')];var _0x43f01b=_0x43b947?_0x56fd1e['count']:_0x28e399['offset']+_0x28e399[_0xeb8a('0x1a')];var _0x3d2946;if(_0x43f01b>=_0x43a70a){_0x43f01b=_0x43a70a;_0x3d2946=0xc8;}else{_0x3d2946=0xce;}_0x3e2975[_0xeb8a('0x15')](_0x3d2946);return _0x3e2975[_0xeb8a('0x1b')]('Content-Range',_0x1ec2bf+'-'+_0x43f01b+'/'+_0x43a70a)[_0xeb8a('0x17')](_0x56fd1e);}return null;};}function patchUpdates(_0x5ed7ac){return function(_0x5320ff){try{jsonpatch[_0xeb8a('0x1c')](_0x5320ff,_0x5ed7ac,!![]);}catch(_0x2d4f71){return BPromise['reject'](_0x2d4f71);}return _0x5320ff[_0xeb8a('0x1d')]();};}function saveUpdates(_0x43c3b6,_0x4e0324){return function(_0x1994b7){if(_0x1994b7){return _0x1994b7[_0xeb8a('0x1e')](_0x43c3b6)['then'](function(_0x5e3f32){return _0x5e3f32;});}return null;};}function removeEntity(_0x1d3e6e,_0x50297a){return function(_0x48a863){if(_0x48a863){return _0x48a863[_0xeb8a('0x1f')]()[_0xeb8a('0x20')](function(){_0x1d3e6e[_0xeb8a('0x15')](0xcc)[_0xeb8a('0x16')]();});}};}function handleEntityNotFound(_0x3e705a,_0x13101b){return function(_0x3418fb){if(!_0x3418fb){_0x3e705a[_0xeb8a('0x14')](0x194);}return _0x3418fb;};}function handleError(_0x4b8d3f,_0x157206){_0x157206=_0x157206||0x1f4;return function(_0x58d35f){logger[_0xeb8a('0x21')](_0x58d35f[_0xeb8a('0x22')]);if(_0x58d35f['name']){delete _0x58d35f['name'];}_0x4b8d3f[_0xeb8a('0x15')](_0x157206)[_0xeb8a('0x23')](_0x58d35f);};}exports[_0xeb8a('0x24')]=function(_0x6ff31d,_0x129efc){var _0x42c904={},_0x2efad2={},_0x5667b0={'count':0x0,'rows':[]};var _0x537b43=_[_0xeb8a('0x25')](db[_0xeb8a('0x26')]['rawAttributes'],function(_0x53d4cc){return{'name':_0x53d4cc[_0xeb8a('0x27')],'type':_0x53d4cc[_0xeb8a('0x28')][_0xeb8a('0x29')]};});_0x2efad2['model']=_[_0xeb8a('0x25')](_0x537b43,_0xeb8a('0x2a'));_0x2efad2[_0xeb8a('0x2b')]=_[_0xeb8a('0x2c')](_0x6ff31d[_0xeb8a('0x2b')]);_0x2efad2['filters']=_[_0xeb8a('0x2d')](_0x2efad2[_0xeb8a('0x2e')],_0x2efad2[_0xeb8a('0x2b')]);_0x42c904[_0xeb8a('0x2f')]=_[_0xeb8a('0x2d')](_0x2efad2['model'],qs[_0xeb8a('0x30')](_0x6ff31d[_0xeb8a('0x2b')][_0xeb8a('0x30')]));_0x42c904[_0xeb8a('0x2f')]=_0x42c904[_0xeb8a('0x2f')]['length']?_0x42c904['attributes']:_0x2efad2[_0xeb8a('0x2e')];if(!_0x6ff31d[_0xeb8a('0x2b')][_0xeb8a('0x31')](_0xeb8a('0x32'))){_0x42c904['limit']=qs[_0xeb8a('0x1a')](_0x6ff31d[_0xeb8a('0x2b')][_0xeb8a('0x1a')]);_0x42c904[_0xeb8a('0x18')]=qs[_0xeb8a('0x18')](_0x6ff31d[_0xeb8a('0x2b')]['offset']);}_0x42c904[_0xeb8a('0x33')]=qs['sort'](_0x6ff31d['query']['sort']);_0x42c904['where']=qs[_0xeb8a('0x34')](_[_0xeb8a('0x35')](_0x6ff31d[_0xeb8a('0x2b')],_0x2efad2['filters']),_0x537b43);if(_0x6ff31d[_0xeb8a('0x2b')][_0xeb8a('0x36')]){_0x42c904[_0xeb8a('0x37')]=_['merge'](_0x42c904[_0xeb8a('0x37')],{'$or':_[_0xeb8a('0x25')](_0x537b43,function(_0x27a919){if(_0x27a919[_0xeb8a('0x28')]!==_0xeb8a('0x38')){var _0x2baf46={};_0x2baf46[_0x27a919['name']]={'$like':'%'+_0x6ff31d[_0xeb8a('0x2b')][_0xeb8a('0x36')]+'%'};return _0x2baf46;}})});}_0x42c904=_[_0xeb8a('0x39')]({},_0x42c904,_0x6ff31d[_0xeb8a('0x3a')]);var _0x30b477={'where':_0x42c904['where']};return db[_0xeb8a('0x26')][_0xeb8a('0x3b')](_0x30b477)['then'](function(_0x590ee2){_0x5667b0[_0xeb8a('0x3b')]=_0x590ee2;if(_0x6ff31d[_0xeb8a('0x2b')]['includeAll']){_0x42c904[_0xeb8a('0x3c')]=[{'all':!![]}];}return db['ZohoField'][_0xeb8a('0x3d')](_0x42c904);})['then'](function(_0x65f8cb){_0x5667b0[_0xeb8a('0x3e')]=_0x65f8cb;return _0x5667b0;})['then'](respondWithFilteredResult(_0x129efc,_0x42c904))[_0xeb8a('0x3f')](handleError(_0x129efc,null));};exports[_0xeb8a('0x40')]=function(_0xb3d300,_0x2f951f){var _0x15c7c1={'raw':!![],'where':{'id':_0xb3d300['params']['id']}},_0x263b40={};_0x263b40['model']=_[_0xeb8a('0x2c')](db[_0xeb8a('0x26')][_0xeb8a('0x41')]);_0x263b40[_0xeb8a('0x2b')]=_[_0xeb8a('0x2c')](_0xb3d300[_0xeb8a('0x2b')]);_0x263b40[_0xeb8a('0x34')]=_['intersection'](_0x263b40[_0xeb8a('0x2e')],_0x263b40[_0xeb8a('0x2b')]);_0x15c7c1[_0xeb8a('0x2f')]=_[_0xeb8a('0x2d')](_0x263b40[_0xeb8a('0x2e')],qs[_0xeb8a('0x30')](_0xb3d300[_0xeb8a('0x2b')][_0xeb8a('0x30')]));_0x15c7c1[_0xeb8a('0x2f')]=_0x15c7c1[_0xeb8a('0x2f')][_0xeb8a('0x42')]?_0x15c7c1[_0xeb8a('0x2f')]:_0x263b40[_0xeb8a('0x2e')];if(_0xb3d300[_0xeb8a('0x2b')]['includeAll']){_0x15c7c1[_0xeb8a('0x3c')]=[{'all':!![]}];}_0x15c7c1=_[_0xeb8a('0x39')]({},_0x15c7c1,_0xb3d300[_0xeb8a('0x3a')]);return db[_0xeb8a('0x26')][_0xeb8a('0x43')](_0x15c7c1)[_0xeb8a('0x20')](handleEntityNotFound(_0x2f951f,null))[_0xeb8a('0x20')](respondWithResult(_0x2f951f,null))[_0xeb8a('0x3f')](handleError(_0x2f951f,null));};exports[_0xeb8a('0x44')]=function(_0x449397,_0x51e18e){return db[_0xeb8a('0x26')][_0xeb8a('0x44')](_0x449397[_0xeb8a('0x45')],{})['then'](respondWithResult(_0x51e18e,0xc9))[_0xeb8a('0x3f')](handleError(_0x51e18e,null));};exports['update']=function(_0x40bf5b,_0xa35dbc){if(_0x40bf5b['body']['id']){delete _0x40bf5b['body']['id'];}return db[_0xeb8a('0x26')][_0xeb8a('0x43')]({'where':{'id':_0x40bf5b[_0xeb8a('0x46')]['id']}})[_0xeb8a('0x20')](handleEntityNotFound(_0xa35dbc,null))[_0xeb8a('0x20')](saveUpdates(_0x40bf5b[_0xeb8a('0x45')],null))[_0xeb8a('0x20')](respondWithResult(_0xa35dbc,null))[_0xeb8a('0x3f')](handleError(_0xa35dbc,null));};exports['destroy']=function(_0x42e83a,_0x547137){return db[_0xeb8a('0x26')][_0xeb8a('0x43')]({'where':{'id':_0x42e83a[_0xeb8a('0x46')]['id']}})[_0xeb8a('0x20')](handleEntityNotFound(_0x547137,null))[_0xeb8a('0x20')](removeEntity(_0x547137,null))[_0xeb8a('0x3f')](handleError(_0x547137,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1e72e39..1ba4eae 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 _0x77e6=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','zoho_unique_index'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x77e6,0x1a6));var _0x677e=function(_0x1d46f6,_0x2cab02){_0x1d46f6=_0x1d46f6-0x0;var _0x151980=_0x77e6[_0x1d46f6];return _0x151980;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x677e('0xb'),'fields':[_0x677e('0xc'),_0x677e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2da6=['api','moment','bluebird','request-promise','path','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x3228d2,_0x477a57){var _0x48cac4=function(_0x4740e7){while(--_0x4740e7){_0x3228d2['push'](_0x3228d2['shift']());}};_0x48cac4(++_0x477a57);}(_0x2da6,0x1dd));var _0x62da=function(_0x563725,_0x16dbe3){_0x563725=_0x563725-0x0;var _0x4bf6e1=_0x2da6[_0x563725];return _0x4bf6e1;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));module[_0x62da('0x9')]=function(_0x3a59f8,_0x30437f){return _0x3a59f8[_0x62da('0xa')](_0x62da('0xb'),attributes,{'tableName':_0x62da('0xc'),'paranoid':![],'indexes':[{'name':_0x62da('0xd'),'fields':[_0x62da('0xe'),'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 ef3a7df..c073807 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 _0xd446=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ZohoField,\x20%s,\x20%s','result','catch'];(function(_0xc298fe,_0x53be01){var _0x2096d3=function(_0x27d6b6){while(--_0x27d6b6){_0xc298fe['push'](_0xc298fe['shift']());}};_0x2096d3(++_0x53be01);}(_0xd446,0x104));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d44('0x0'));var util=require(_0x6d44('0x1'));var moment=require('moment');var BPromise=require(_0x6d44('0x2'));var rs=require(_0x6d44('0x3'));var fs=require('fs');var Redis=require(_0x6d44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d44('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d44('0x6'));var jayson=require(_0x6d44('0x7'));var client=jayson[_0x6d44('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7085,_0x367c96,_0x1d268c){return new BPromise(function(_0x4a848b,_0x333e25){return client[_0x6d44('0x9')](_0x2d7085,_0x1d268c)[_0x6d44('0xa')](function(_0x23679b){logger[_0x6d44('0xb')]('ZohoField,\x20%s,\x20%s',_0x367c96,'request\x20sent');logger['debug'](_0x6d44('0xc'),_0x367c96,_0x6d44('0xd'),JSON[_0x6d44('0xe')](_0x23679b));if(_0x23679b['error']){if(_0x23679b[_0x6d44('0xf')]['code']===0x1f4){logger[_0x6d44('0xf')]('ZohoField,\x20%s,\x20%s',_0x367c96,_0x23679b[_0x6d44('0xf')][_0x6d44('0x10')]);return _0x333e25(_0x23679b['error'][_0x6d44('0x10')]);}logger['error'](_0x6d44('0x11'),_0x367c96,_0x23679b['error']['message']);return _0x4a848b(_0x23679b[_0x6d44('0xf')][_0x6d44('0x10')]);}else{logger[_0x6d44('0xb')](_0x6d44('0x11'),_0x367c96,_0x6d44('0xd'));_0x4a848b(_0x23679b[_0x6d44('0x12')][_0x6d44('0x10')]);}})[_0x6d44('0x13')](function(_0x2c5129){logger[_0x6d44('0xf')]('ZohoField,\x20%s,\x20%s',_0x367c96,_0x2c5129);_0x333e25(_0x2c5129);});});} \ No newline at end of file +var _0x86e1=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZohoField,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring'];(function(_0x5ed4ea,_0x44174e){var _0x15db1a=function(_0x582c60){while(--_0x582c60){_0x5ed4ea['push'](_0x5ed4ea['shift']());}};_0x15db1a(++_0x44174e);}(_0x86e1,0xba));var _0x186e=function(_0x43377c,_0x4a5508){_0x43377c=_0x43377c-0x0;var _0x16a0e8=_0x86e1[_0x43377c];return _0x16a0e8;};'use strict';var _=require(_0x186e('0x0'));var util=require('util');var moment=require(_0x186e('0x1'));var BPromise=require('bluebird');var rs=require(_0x186e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x186e('0x3'))['db'];var utils=require(_0x186e('0x4'));var logger=require(_0x186e('0x5'))(_0x186e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x186e('0x7')][_0x186e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd6b826,_0x51acfd,_0x15dd30){return new BPromise(function(_0x55b0aa,_0x4e140c){return client[_0x186e('0x9')](_0xd6b826,_0x15dd30)[_0x186e('0xa')](function(_0x44ebf9){logger['info']('ZohoField,\x20%s,\x20%s',_0x51acfd,'request\x20sent');logger[_0x186e('0xb')](_0x186e('0xc'),_0x51acfd,_0x186e('0xd'),JSON[_0x186e('0xe')](_0x44ebf9));if(_0x44ebf9[_0x186e('0xf')]){if(_0x44ebf9[_0x186e('0xf')]['code']===0x1f4){logger['error'](_0x186e('0x10'),_0x51acfd,_0x44ebf9[_0x186e('0xf')][_0x186e('0x11')]);return _0x4e140c(_0x44ebf9[_0x186e('0xf')][_0x186e('0x11')]);}logger[_0x186e('0xf')](_0x186e('0x10'),_0x51acfd,_0x44ebf9[_0x186e('0xf')][_0x186e('0x11')]);return _0x55b0aa(_0x44ebf9[_0x186e('0xf')][_0x186e('0x11')]);}else{logger[_0x186e('0x12')](_0x186e('0x10'),_0x51acfd,_0x186e('0xd'));_0x55b0aa(_0x44ebf9[_0x186e('0x13')][_0x186e('0x11')]);}})[_0x186e('0x14')](function(_0x1160ad){logger[_0x186e('0xf')](_0x186e('0x10'),_0x51acfd,_0x1160ad);_0x4e140c(_0x1160ad);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3e90fd6..a5cfe3c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5e7c17,_0x360cbc){var _0x2bebe9=function(_0x1c499e){while(--_0x1c499e){_0x5e7c17['push'](_0x5e7c17['shift']());}};_0x2bebe9(++_0x360cbc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xcb91[_0x199572];return _0x13cfa3;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e0fa0,_0x12cb07){var _0x5a66ff=function(_0x47a02e){while(--_0x47a02e){_0x1e0fa0['push'](_0x1e0fa0['shift']());}};_0x5a66ff(++_0x12cb07);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 175efab..741d770 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 _0xdf97=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x4e22fd,_0xfd9336){var _0x23bdb1=function(_0x1f9793){while(--_0x1f9793){_0x4e22fd['push'](_0x4e22fd['shift']());}};_0x23bdb1(++_0xfd9336);}(_0xdf97,0xfb));var _0x7df9=function(_0xb99bf8,_0xd24865){_0xb99bf8=_0xb99bf8-0x0;var _0x431795=_0xdf97[_0xb99bf8];return _0x431795;};'use strict';var Sequelize=require(_0x7df9('0x0'));module['exports']={'name':{'type':Sequelize[_0x7df9('0x1')],'allowNull':![],'unique':_0x7df9('0x2')},'version':{'type':Sequelize[_0x7df9('0x1')],'allowNull':![],'unique':_0x7df9('0x2')},'main':{'type':Sequelize[_0x7df9('0x1')],'defaultValue':_0x7df9('0x3')},'filename':{'type':Sequelize[_0x7df9('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7df9('0x1')]},'size':{'type':Sequelize[_0x7df9('0x4')]},'active':{'type':Sequelize[_0x7df9('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x7df9('0x1')]},'logo':{'type':Sequelize[_0x7df9('0x1')]},'state':{'type':Sequelize[_0x7df9('0x1')],'unique':_0x7df9('0x6')},'description':{'type':Sequelize[_0x7df9('0x1')]},'title':{'type':Sequelize[_0x7df9('0x1')]},'remoteUri':{'type':Sequelize[_0x7df9('0x1')]},'link':{'type':Sequelize[_0x7df9('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1e50=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x30a7fc,_0x255c56){var _0x34e745=function(_0x56fcae){while(--_0x56fcae){_0x30a7fc['push'](_0x30a7fc['shift']());}};_0x34e745(++_0x255c56);}(_0x1e50,0xa6));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x01e5('0x0')]={'name':{'type':Sequelize[_0x01e5('0x1')],'allowNull':![],'unique':_0x01e5('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x01e5('0x2')},'main':{'type':Sequelize[_0x01e5('0x1')],'defaultValue':_0x01e5('0x3')},'filename':{'type':Sequelize[_0x01e5('0x1')]},'path':{'type':Sequelize[_0x01e5('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x01e5('0x4')]},'active':{'type':Sequelize[_0x01e5('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x01e5('0x1')]},'state':{'type':Sequelize[_0x01e5('0x1')],'unique':_0x01e5('0x6')},'description':{'type':Sequelize[_0x01e5('0x1')]},'title':{'type':Sequelize[_0x01e5('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x01e5('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9cf4a78..5243aed 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 _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5cd860,_0x5e6434){_0x5cd860=_0x5cd860-0x0;var _0x335a30=_0xc2c7[_0x5cd860];return _0x335a30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['Integration'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['Integration'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','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'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1261,0x144));var _0x1126=function(_0x1b6ae1,_0x7265ae){_0x1b6ae1=_0x1b6ae1-0x0;var _0x5843a2=_0x1261[_0x1b6ae1];return _0x5843a2;};'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'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 68f1373..70f0611 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 _0x33f1=['exports','integrations','lodash','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes'];(function(_0xb28cba,_0x50ed44){var _0x3e2852=function(_0x4c203c){while(--_0x4c203c){_0xb28cba['push'](_0xb28cba['shift']());}};_0x3e2852(++_0x50ed44);}(_0x33f1,0x65));var _0x133f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x33f1[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x133f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x133f('0x1'));var BPromise=require(_0x133f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x133f('0x3'));var rimraf=require(_0x133f('0x4'));var config=require(_0x133f('0x5'));var attributes=require(_0x133f('0x6'));module[_0x133f('0x7')]=function(_0x45c692,_0x1a7c41){return _0x45c692['define']('Integration',attributes,{'tableName':_0x133f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6049=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations'];(function(_0x39d907,_0x10eb22){var _0x5f4b23=function(_0x5dec04){while(--_0x5dec04){_0x39d907['push'](_0x39d907['shift']());}};_0x5f4b23(++_0x10eb22);}(_0x6049,0x142));var _0x9604=function(_0x39fb3d,_0xd44fc){_0x39fb3d=_0x39fb3d-0x0;var _0x20b7c1=_0x6049[_0x39fb3d];return _0x20b7c1;};'use strict';var _=require(_0x9604('0x0'));var util=require(_0x9604('0x1'));var logger=require(_0x9604('0x2'))(_0x9604('0x3'));var moment=require(_0x9604('0x4'));var BPromise=require(_0x9604('0x5'));var rp=require(_0x9604('0x6'));var fs=require('fs');var path=require(_0x9604('0x7'));var rimraf=require(_0x9604('0x8'));var config=require(_0x9604('0x9'));var attributes=require(_0x9604('0xa'));module[_0x9604('0xb')]=function(_0x3d0333,_0x303e7e){return _0x3d0333['define'](_0x9604('0xc'),attributes,{'tableName':_0x9604('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index b7691cc..a00969a 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x57bb62,_0x1b5554){var _0x2a0594=function(_0x28bc59){while(--_0x28bc59){_0x57bb62['push'](_0x57bb62['shift']());}};_0x2a0594(++_0x1b5554);}(_0x1a85,0x178));var _0x51a8=function(_0x45413a,_0x281b1c){_0x45413a=_0x45413a-0x0;var _0x27fe7f=_0x1a85[_0x45413a];return _0x27fe7f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x19b6b5,_0x7c2b61){var _0x4a4352=function(_0x378939){while(--_0x378939){_0x19b6b5['push'](_0x19b6b5['shift']());}};_0x4a4352(++_0x7c2b61);}(_0x955f,0x1eb));var _0xf955=function(_0x437556,_0x154cd5){_0x437556=_0x437556-0x0;var _0xd7e31f=_0x955f[_0x437556];return _0xd7e31f;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 63e71cf..fda1d54 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 _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x9bda54,_0x40e70f){var _0x48b949=function(_0x5a64cf){while(--_0x5a64cf){_0x9bda54['push'](_0x9bda54['shift']());}};_0x48b949(++_0x40e70f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5a908f,_0x4fd0d5){_0x5a908f=_0x5a908f-0x0;var _0x2b972d=_0xc2c7[_0x5a908f];return _0x2b972d;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('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 7d7c46e..85f3c21 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 _0x7d0d=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x509f97,_0x442414){var _0x18bbef=function(_0x4787c5){while(--_0x4787c5){_0x509f97['push'](_0x509f97['shift']());}};_0x18bbef(++_0x442414);}(_0x7d0d,0x1b6));var _0xd7d0=function(_0x1294ae,_0x408d2c){_0x1294ae=_0x1294ae-0x0;var _0x2e5b54=_0x7d0d[_0x1294ae];return _0x2e5b54;};'use strict';var Sequelize=require(_0xd7d0('0x0'));module[_0xd7d0('0x1')]={'integration':{'type':Sequelize[_0xd7d0('0x2')]},'eventChannel':{'type':Sequelize[_0xd7d0('0x2')]},'exitStatus':{'type':Sequelize[_0xd7d0('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xd7d0('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd7d0('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd7d0('0x2')]},'queue':{'type':Sequelize[_0xd7d0('0x2')]},'interface':{'type':Sequelize[_0xd7d0('0x2')]},'membername':{'type':Sequelize[_0xd7d0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd7d0('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd7d0('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd7d0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd7d0('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd7d0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd7d0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd7d0('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd7d0('0x2')]},'channel':{'type':Sequelize[_0xd7d0('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd7d0('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd7d0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd7d0('0x2')]},'context':{'type':Sequelize[_0xd7d0('0x2')]},'exten':{'type':Sequelize[_0xd7d0('0x2')]},'priority':{'type':Sequelize[_0xd7d0('0x2')]},'destchannel':{'type':Sequelize[_0xd7d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xd7d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd7d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd7d0('0x2')]},'destcalleridname':{'type':Sequelize[_0xd7d0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd7d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd7d0('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd7d0('0x2')]},'destcontext':{'type':Sequelize[_0xd7d0('0x2')]},'destexten':{'type':Sequelize[_0xd7d0('0x2')]},'destpriority':{'type':Sequelize[_0xd7d0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd7d0('0x2')]},'messageId':{'type':Sequelize[_0xd7d0('0x2')]},'inReplyTo':{'type':Sequelize[_0xd7d0('0x2')]},'subject':{'type':Sequelize[_0xd7d0('0x2')]},'from':{'type':Sequelize[_0xd7d0('0x2')]},'to':{'type':Sequelize[_0xd7d0('0x2')]},'cc':{'type':Sequelize[_0xd7d0('0x2')]},'attachment':{'type':Sequelize[_0xd7d0('0x6')]},'html':{'type':Sequelize[_0xd7d0('0x6')]},'text':{'type':Sequelize[_0xd7d0('0x6')]},'status':{'type':Sequelize[_0xd7d0('0x7')](_0xd7d0('0x8'),_0xd7d0('0x9'),_0xd7d0('0xa'),_0xd7d0('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xd7d0('0x2')]},'appdata':{'type':Sequelize[_0xd7d0('0x2')]},'projectId':{'type':Sequelize[_0xd7d0('0x3')]}}; \ No newline at end of file +var _0xe24f=['STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','exports'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xe24f,0xd1));var _0xfe24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe24f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xfe24('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xfe24('0x1')]},'exitStatus':{'type':Sequelize[_0xfe24('0x1')]},'ticketId':{'type':Sequelize[_0xfe24('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xfe24('0x1')]},'uniqueid':{'type':Sequelize[_0xfe24('0x1')]},'calleridnum':{'type':Sequelize[_0xfe24('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfe24('0x1')]},'interface':{'type':Sequelize[_0xfe24('0x1')]},'membername':{'type':Sequelize[_0xfe24('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfe24('0x2')]},'agentconnectAt':{'type':Sequelize[_0xfe24('0x2')]},'holdtime':{'type':Sequelize[_0xfe24('0x3')]},'agentcomplete':{'type':Sequelize[_0xfe24('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfe24('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfe24('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfe24('0x3')]},'reason':{'type':Sequelize[_0xfe24('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xfe24('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xfe24('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xfe24('0x2')]},'lastevent':{'type':Sequelize[_0xfe24('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfe24('0x3')]},'channelstatedesc':{'type':Sequelize[_0xfe24('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfe24('0x1')]},'language':{'type':Sequelize[_0xfe24('0x1')]},'accountcode':{'type':Sequelize[_0xfe24('0x1')]},'context':{'type':Sequelize[_0xfe24('0x1')]},'exten':{'type':Sequelize[_0xfe24('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xfe24('0x1')]},'destchannelstate':{'type':Sequelize[_0xfe24('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfe24('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfe24('0x1')]},'destcalleridname':{'type':Sequelize[_0xfe24('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfe24('0x1')]},'destlanguage':{'type':Sequelize[_0xfe24('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xfe24('0x1')]},'destexten':{'type':Sequelize[_0xfe24('0x1')]},'destpriority':{'type':Sequelize[_0xfe24('0x1')]},'destuniqueid':{'type':Sequelize[_0xfe24('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xfe24('0x1')]},'subject':{'type':Sequelize[_0xfe24('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfe24('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xfe24('0x5')]},'status':{'type':Sequelize[_0xfe24('0x6')](_0xfe24('0x7'),_0xfe24('0x8'),_0xfe24('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xfe24('0x1')]},'appdata':{'type':Sequelize[_0xfe24('0x1')]},'projectId':{'type':Sequelize[_0xfe24('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 19480f5..7c8a38c 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 _0x88e2=['apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','catch','show','intersection','include','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','end','status','undefined','offset','count','limit','Content-Range','json'];(function(_0x2dbfeb,_0x362a01){var _0x26c643=function(_0x4dd938){while(--_0x4dd938){_0x2dbfeb['push'](_0x2dbfeb['shift']());}};_0x26c643(++_0x362a01);}(_0x88e2,0xcf));var _0x288e=function(_0x4c0946,_0x4ece59){_0x4c0946=_0x4c0946-0x0;var _0x1ee82c=_0x88e2[_0x4c0946];return _0x1ee82c;};'use strict';var emlformat=require(_0x288e('0x0'));var rimraf=require(_0x288e('0x1'));var zipdir=require(_0x288e('0x2'));var jsonpatch=require(_0x288e('0x3'));var rp=require(_0x288e('0x4'));var moment=require('moment');var BPromise=require(_0x288e('0x5'));var Mustache=require(_0x288e('0x6'));var util=require(_0x288e('0x7'));var path=require('path');var sox=require(_0x288e('0x8'));var csv=require(_0x288e('0x9'));var ejs=require(_0x288e('0xa'));var fs=require('fs');var fs_extra=require(_0x288e('0xb'));var _=require('lodash');var squel=require(_0x288e('0xc'));var crypto=require(_0x288e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x288e('0xe'));var toCsv=require(_0x288e('0x9'));var querystring=require(_0x288e('0xf'));var Papa=require(_0x288e('0x10'));var Redis=require(_0x288e('0x11'));var authService=require(_0x288e('0x12'));var qs=require(_0x288e('0x13'));var as=require(_0x288e('0x14'));var hardwareService=require(_0x288e('0x15'));var logger=require(_0x288e('0x16'))(_0x288e('0x17'));var utils=require(_0x288e('0x18'));var config=require(_0x288e('0x19'));var licenseUtil=require(_0x288e('0x1a'));var db=require(_0x288e('0x1b'))['db'];function respondWithStatusCode(_0x2e0fdd,_0x5b3079){_0x5b3079=_0x5b3079||0xcc;return function(_0xc55774){if(_0xc55774){return _0x2e0fdd['sendStatus'](_0x5b3079);}return _0x2e0fdd['status'](_0x5b3079)[_0x288e('0x1c')]();};}function respondWithResult(_0x1e112f,_0x95aedf){_0x95aedf=_0x95aedf||0xc8;return function(_0x2164c8){if(_0x2164c8){return _0x1e112f[_0x288e('0x1d')](_0x95aedf)['json'](_0x2164c8);}};}function respondWithFilteredResult(_0x23bd10,_0x5ba548){return function(_0x528c60){if(_0x528c60){var _0x400bd6=typeof _0x5ba548['offset']===_0x288e('0x1e')&&typeof _0x5ba548['limit']===_0x288e('0x1e');var _0x157f69=_0x528c60['count'];var _0x512fde=_0x400bd6?0x0:_0x5ba548[_0x288e('0x1f')];var _0x33de27=_0x400bd6?_0x528c60[_0x288e('0x20')]:_0x5ba548[_0x288e('0x1f')]+_0x5ba548[_0x288e('0x21')];var _0x5813e8;if(_0x33de27>=_0x157f69){_0x33de27=_0x157f69;_0x5813e8=0xc8;}else{_0x5813e8=0xce;}_0x23bd10['status'](_0x5813e8);return _0x23bd10['set'](_0x288e('0x22'),_0x512fde+'-'+_0x33de27+'/'+_0x157f69)[_0x288e('0x23')](_0x528c60);}return null;};}function patchUpdates(_0xb416b){return function(_0x5ad376){try{jsonpatch[_0x288e('0x24')](_0x5ad376,_0xb416b,!![]);}catch(_0x58d77f){return BPromise[_0x288e('0x25')](_0x58d77f);}return _0x5ad376[_0x288e('0x26')]();};}function saveUpdates(_0x4121d1,_0x441686){return function(_0x44b45b){if(_0x44b45b){return _0x44b45b[_0x288e('0x27')](_0x4121d1)[_0x288e('0x28')](function(_0x1209c1){return _0x1209c1;});}return null;};}function removeEntity(_0x9b9597,_0x5dfdae){return function(_0x285ee5){if(_0x285ee5){return _0x285ee5['destroy']()[_0x288e('0x28')](function(){_0x9b9597[_0x288e('0x1d')](0xcc)[_0x288e('0x1c')]();});}};}function handleEntityNotFound(_0x101130,_0x27d6b5){return function(_0x2352bf){if(!_0x2352bf){_0x101130[_0x288e('0x29')](0x194);}return _0x2352bf;};}function handleError(_0x45336e,_0x5006d5){_0x5006d5=_0x5006d5||0x1f4;return function(_0x2585ea){logger[_0x288e('0x2a')](_0x2585ea['stack']);if(_0x2585ea[_0x288e('0x2b')]){delete _0x2585ea[_0x288e('0x2b')];}_0x45336e[_0x288e('0x1d')](_0x5006d5)[_0x288e('0x2c')](_0x2585ea);};}exports[_0x288e('0x2d')]=function(_0x188e5f,_0x528c83){var _0x357371={},_0x5c9638={},_0x248ca2={'count':0x0,'rows':[]};var _0x495370=_[_0x288e('0x2e')](db['IntegrationReport'][_0x288e('0x2f')],function(_0x5a1d48){return{'name':_0x5a1d48['fieldName'],'type':_0x5a1d48['type'][_0x288e('0x30')]};});_0x5c9638['model']=_[_0x288e('0x2e')](_0x495370,_0x288e('0x2b'));_0x5c9638[_0x288e('0x31')]=_[_0x288e('0x32')](_0x188e5f[_0x288e('0x31')]);_0x5c9638[_0x288e('0x33')]=_['intersection'](_0x5c9638[_0x288e('0x34')],_0x5c9638[_0x288e('0x31')]);_0x357371[_0x288e('0x35')]=_['intersection'](_0x5c9638[_0x288e('0x34')],qs[_0x288e('0x36')](_0x188e5f['query'][_0x288e('0x36')]));_0x357371[_0x288e('0x35')]=_0x357371[_0x288e('0x35')][_0x288e('0x37')]?_0x357371['attributes']:_0x5c9638['model'];if(!_0x188e5f[_0x288e('0x31')][_0x288e('0x38')](_0x288e('0x39'))){_0x357371[_0x288e('0x21')]=qs[_0x288e('0x21')](_0x188e5f[_0x288e('0x31')][_0x288e('0x21')]);_0x357371[_0x288e('0x1f')]=qs['offset'](_0x188e5f[_0x288e('0x31')][_0x288e('0x1f')]);}_0x357371[_0x288e('0x3a')]=qs[_0x288e('0x3b')](_0x188e5f['query'][_0x288e('0x3b')]);_0x357371[_0x288e('0x3c')]=qs['filters'](_[_0x288e('0x3d')](_0x188e5f['query'],_0x5c9638[_0x288e('0x33')]),_0x495370);if(_0x188e5f[_0x288e('0x31')][_0x288e('0x3e')]){_0x357371['where']=_[_0x288e('0x3f')](_0x357371[_0x288e('0x3c')],{'$or':_['map'](_0x495370,function(_0x5e55bb){if(_0x5e55bb[_0x288e('0x40')]!==_0x288e('0x41')){var _0x4fbe92={};_0x4fbe92[_0x5e55bb[_0x288e('0x2b')]]={'$like':'%'+_0x188e5f[_0x288e('0x31')]['filter']+'%'};return _0x4fbe92;}})});}_0x357371=_[_0x288e('0x3f')]({},_0x357371,_0x188e5f[_0x288e('0x42')]);var _0x3b48a7={'where':_0x357371['where']};return db[_0x288e('0x43')][_0x288e('0x20')](_0x3b48a7)[_0x288e('0x28')](function(_0x1f5405){_0x248ca2[_0x288e('0x20')]=_0x1f5405;if(_0x188e5f['query'][_0x288e('0x44')]){_0x357371['include']=[{'all':!![]}];}return db[_0x288e('0x43')][_0x288e('0x45')](_0x357371);})[_0x288e('0x28')](function(_0x5ad3ad){_0x248ca2[_0x288e('0x46')]=_0x5ad3ad;return _0x248ca2;})[_0x288e('0x28')](respondWithFilteredResult(_0x528c83,_0x357371))[_0x288e('0x47')](handleError(_0x528c83,null));};exports[_0x288e('0x48')]=function(_0x5c4037,_0x2a430d){var _0x54921f={'raw':![],'where':{'id':_0x5c4037['params']['id']}},_0x3ba554={};_0x3ba554[_0x288e('0x34')]=_[_0x288e('0x32')](db[_0x288e('0x43')][_0x288e('0x2f')]);_0x3ba554['query']=_['keys'](_0x5c4037[_0x288e('0x31')]);_0x3ba554[_0x288e('0x33')]=_[_0x288e('0x49')](_0x3ba554['model'],_0x3ba554[_0x288e('0x31')]);_0x54921f[_0x288e('0x35')]=_[_0x288e('0x49')](_0x3ba554[_0x288e('0x34')],qs['fields'](_0x5c4037[_0x288e('0x31')][_0x288e('0x36')]));_0x54921f['attributes']=_0x54921f[_0x288e('0x35')]['length']?_0x54921f[_0x288e('0x35')]:_0x3ba554[_0x288e('0x34')];if(_0x5c4037[_0x288e('0x31')][_0x288e('0x44')]){_0x54921f[_0x288e('0x4a')]=[{'all':!![]}];}_0x54921f=_[_0x288e('0x3f')]({},_0x54921f,_0x5c4037['options']);return db['IntegrationReport'][_0x288e('0x4b')](_0x54921f)[_0x288e('0x28')](handleEntityNotFound(_0x2a430d,null))['then'](respondWithResult(_0x2a430d,null))[_0x288e('0x47')](handleError(_0x2a430d,null));};exports[_0x288e('0x4c')]=function(_0x5b21bf,_0x1a4e55){return db[_0x288e('0x43')][_0x288e('0x4c')](_0x5b21bf[_0x288e('0x4d')],{})[_0x288e('0x28')](respondWithResult(_0x1a4e55,0xc9))[_0x288e('0x47')](handleError(_0x1a4e55,null));};exports['update']=function(_0x2cc646,_0x26904f){if(_0x2cc646[_0x288e('0x4d')]['id']){delete _0x2cc646['body']['id'];}return db[_0x288e('0x43')][_0x288e('0x4b')]({'where':{'id':_0x2cc646[_0x288e('0x4e')]['id']}})[_0x288e('0x28')](handleEntityNotFound(_0x26904f,null))[_0x288e('0x28')](saveUpdates(_0x2cc646[_0x288e('0x4d')],null))[_0x288e('0x28')](respondWithResult(_0x26904f,null))['catch'](handleError(_0x26904f,null));};exports[_0x288e('0x4f')]=function(_0x5b1492,_0x3171a6){return db[_0x288e('0x43')]['find']({'where':{'id':_0x5b1492['params']['id']}})['then'](handleEntityNotFound(_0x3171a6,null))[_0x288e('0x28')](removeEntity(_0x3171a6,null))[_0x288e('0x47')](handleError(_0x3171a6,null));};exports[_0x288e('0x50')]=function(_0x10cd90,_0x417679){return db[_0x288e('0x43')][_0x288e('0x50')]()[_0x288e('0x28')](respondWithResult(_0x417679,null))[_0x288e('0x47')](handleError(_0x417679,null));}; \ No newline at end of file +var _0x9d7b=['order','sort','where','pick','filter','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x5397de,_0x257fc2){var _0x52716c=function(_0x1b46d2){while(--_0x1b46d2){_0x5397de['push'](_0x5397de['shift']());}};_0x52716c(++_0x257fc2);}(_0x9d7b,0x1d6));var _0xb9d7=function(_0x16e8ad,_0x5f4726){_0x16e8ad=_0x16e8ad-0x0;var _0xbd3740=_0x9d7b[_0x16e8ad];return _0xbd3740;};'use strict';var emlformat=require(_0xb9d7('0x0'));var rimraf=require(_0xb9d7('0x1'));var zipdir=require(_0xb9d7('0x2'));var jsonpatch=require(_0xb9d7('0x3'));var rp=require(_0xb9d7('0x4'));var moment=require(_0xb9d7('0x5'));var BPromise=require(_0xb9d7('0x6'));var Mustache=require(_0xb9d7('0x7'));var util=require(_0xb9d7('0x8'));var path=require(_0xb9d7('0x9'));var sox=require(_0xb9d7('0xa'));var csv=require(_0xb9d7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9d7('0xc'));var squel=require(_0xb9d7('0xd'));var crypto=require(_0xb9d7('0xe'));var jsforce=require(_0xb9d7('0xf'));var deskjs=require(_0xb9d7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb9d7('0x11'));var Papa=require(_0xb9d7('0x12'));var Redis=require(_0xb9d7('0x13'));var authService=require(_0xb9d7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb9d7('0x15'));var hardwareService=require(_0xb9d7('0x16'));var logger=require(_0xb9d7('0x17'))('api');var utils=require(_0xb9d7('0x18'));var config=require(_0xb9d7('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5eed,_0xca3b7c){_0xca3b7c=_0xca3b7c||0xcc;return function(_0x584249){if(_0x584249){return _0x5e5eed[_0xb9d7('0x1a')](_0xca3b7c);}return _0x5e5eed[_0xb9d7('0x1b')](_0xca3b7c)[_0xb9d7('0x1c')]();};}function respondWithResult(_0xea5982,_0x5515f2){_0x5515f2=_0x5515f2||0xc8;return function(_0x264b3a){if(_0x264b3a){return _0xea5982[_0xb9d7('0x1b')](_0x5515f2)[_0xb9d7('0x1d')](_0x264b3a);}};}function respondWithFilteredResult(_0x2c8fc6,_0x299724){return function(_0x346743){if(_0x346743){var _0x6186b9=typeof _0x299724[_0xb9d7('0x1e')]===_0xb9d7('0x1f')&&typeof _0x299724[_0xb9d7('0x20')]===_0xb9d7('0x1f');var _0x5ef5b6=_0x346743[_0xb9d7('0x21')];var _0x473017=_0x6186b9?0x0:_0x299724[_0xb9d7('0x1e')];var _0x52cb87=_0x6186b9?_0x346743['count']:_0x299724[_0xb9d7('0x1e')]+_0x299724[_0xb9d7('0x20')];var _0x305412;if(_0x52cb87>=_0x5ef5b6){_0x52cb87=_0x5ef5b6;_0x305412=0xc8;}else{_0x305412=0xce;}_0x2c8fc6['status'](_0x305412);return _0x2c8fc6[_0xb9d7('0x22')](_0xb9d7('0x23'),_0x473017+'-'+_0x52cb87+'/'+_0x5ef5b6)['json'](_0x346743);}return null;};}function patchUpdates(_0x4d8871){return function(_0x83e66c){try{jsonpatch['apply'](_0x83e66c,_0x4d8871,!![]);}catch(_0x1d1dc9){return BPromise[_0xb9d7('0x24')](_0x1d1dc9);}return _0x83e66c[_0xb9d7('0x25')]();};}function saveUpdates(_0x20c5a4,_0x33a78d){return function(_0x5c15d7){if(_0x5c15d7){return _0x5c15d7['update'](_0x20c5a4)['then'](function(_0x326ebd){return _0x326ebd;});}return null;};}function removeEntity(_0x36ef6b,_0x6847fd){return function(_0x2fc341){if(_0x2fc341){return _0x2fc341[_0xb9d7('0x26')]()[_0xb9d7('0x27')](function(){_0x36ef6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xce3ab7,_0x5ab5da){return function(_0x31f606){if(!_0x31f606){_0xce3ab7[_0xb9d7('0x1a')](0x194);}return _0x31f606;};}function handleError(_0x2709b0,_0x4b42df){_0x4b42df=_0x4b42df||0x1f4;return function(_0x2469c1){logger['error'](_0x2469c1[_0xb9d7('0x28')]);if(_0x2469c1['name']){delete _0x2469c1[_0xb9d7('0x29')];}_0x2709b0[_0xb9d7('0x1b')](_0x4b42df)[_0xb9d7('0x2a')](_0x2469c1);};}exports['index']=function(_0x9685e2,_0x21ca0f){var _0x226b54={},_0x51987a={},_0xbd561b={'count':0x0,'rows':[]};var _0x63a8ee=_['map'](db['IntegrationReport'][_0xb9d7('0x2b')],function(_0x151aab){return{'name':_0x151aab[_0xb9d7('0x2c')],'type':_0x151aab[_0xb9d7('0x2d')][_0xb9d7('0x2e')]};});_0x51987a[_0xb9d7('0x2f')]=_['map'](_0x63a8ee,_0xb9d7('0x29'));_0x51987a[_0xb9d7('0x30')]=_['keys'](_0x9685e2[_0xb9d7('0x30')]);_0x51987a[_0xb9d7('0x31')]=_[_0xb9d7('0x32')](_0x51987a[_0xb9d7('0x2f')],_0x51987a[_0xb9d7('0x30')]);_0x226b54['attributes']=_['intersection'](_0x51987a[_0xb9d7('0x2f')],qs[_0xb9d7('0x33')](_0x9685e2[_0xb9d7('0x30')][_0xb9d7('0x33')]));_0x226b54['attributes']=_0x226b54[_0xb9d7('0x34')]['length']?_0x226b54[_0xb9d7('0x34')]:_0x51987a[_0xb9d7('0x2f')];if(!_0x9685e2[_0xb9d7('0x30')][_0xb9d7('0x35')](_0xb9d7('0x36'))){_0x226b54[_0xb9d7('0x20')]=qs[_0xb9d7('0x20')](_0x9685e2[_0xb9d7('0x30')][_0xb9d7('0x20')]);_0x226b54[_0xb9d7('0x1e')]=qs[_0xb9d7('0x1e')](_0x9685e2['query'][_0xb9d7('0x1e')]);}_0x226b54[_0xb9d7('0x37')]=qs[_0xb9d7('0x38')](_0x9685e2['query']['sort']);_0x226b54[_0xb9d7('0x39')]=qs[_0xb9d7('0x31')](_[_0xb9d7('0x3a')](_0x9685e2[_0xb9d7('0x30')],_0x51987a[_0xb9d7('0x31')]),_0x63a8ee);if(_0x9685e2['query'][_0xb9d7('0x3b')]){_0x226b54[_0xb9d7('0x39')]=_[_0xb9d7('0x3c')](_0x226b54[_0xb9d7('0x39')],{'$or':_['map'](_0x63a8ee,function(_0x599572){if(_0x599572['type']!=='VIRTUAL'){var _0x4019b4={};_0x4019b4[_0x599572['name']]={'$like':'%'+_0x9685e2[_0xb9d7('0x30')][_0xb9d7('0x3b')]+'%'};return _0x4019b4;}})});}_0x226b54=_[_0xb9d7('0x3c')]({},_0x226b54,_0x9685e2[_0xb9d7('0x3d')]);var _0x4f5ce1={'where':_0x226b54['where']};return db[_0xb9d7('0x3e')][_0xb9d7('0x21')](_0x4f5ce1)[_0xb9d7('0x27')](function(_0x25edae){_0xbd561b['count']=_0x25edae;if(_0x9685e2['query'][_0xb9d7('0x3f')]){_0x226b54[_0xb9d7('0x40')]=[{'all':!![]}];}return db[_0xb9d7('0x3e')][_0xb9d7('0x41')](_0x226b54);})[_0xb9d7('0x27')](function(_0x147885){_0xbd561b[_0xb9d7('0x42')]=_0x147885;return _0xbd561b;})['then'](respondWithFilteredResult(_0x21ca0f,_0x226b54))[_0xb9d7('0x43')](handleError(_0x21ca0f,null));};exports['show']=function(_0x16e116,_0x15ff25){var _0x41af5d={'raw':![],'where':{'id':_0x16e116[_0xb9d7('0x44')]['id']}},_0x2793c6={};_0x2793c6['model']=_[_0xb9d7('0x45')](db[_0xb9d7('0x3e')][_0xb9d7('0x2b')]);_0x2793c6[_0xb9d7('0x30')]=_[_0xb9d7('0x45')](_0x16e116[_0xb9d7('0x30')]);_0x2793c6[_0xb9d7('0x31')]=_[_0xb9d7('0x32')](_0x2793c6['model'],_0x2793c6[_0xb9d7('0x30')]);_0x41af5d[_0xb9d7('0x34')]=_[_0xb9d7('0x32')](_0x2793c6[_0xb9d7('0x2f')],qs[_0xb9d7('0x33')](_0x16e116['query'][_0xb9d7('0x33')]));_0x41af5d[_0xb9d7('0x34')]=_0x41af5d[_0xb9d7('0x34')][_0xb9d7('0x46')]?_0x41af5d[_0xb9d7('0x34')]:_0x2793c6[_0xb9d7('0x2f')];if(_0x16e116[_0xb9d7('0x30')][_0xb9d7('0x3f')]){_0x41af5d[_0xb9d7('0x40')]=[{'all':!![]}];}_0x41af5d=_[_0xb9d7('0x3c')]({},_0x41af5d,_0x16e116['options']);return db[_0xb9d7('0x3e')][_0xb9d7('0x47')](_0x41af5d)[_0xb9d7('0x27')](handleEntityNotFound(_0x15ff25,null))[_0xb9d7('0x27')](respondWithResult(_0x15ff25,null))['catch'](handleError(_0x15ff25,null));};exports[_0xb9d7('0x48')]=function(_0x31a48a,_0x24e4cb){return db[_0xb9d7('0x3e')][_0xb9d7('0x48')](_0x31a48a[_0xb9d7('0x49')],{})[_0xb9d7('0x27')](respondWithResult(_0x24e4cb,0xc9))['catch'](handleError(_0x24e4cb,null));};exports['update']=function(_0xa72867,_0xd4e34e){if(_0xa72867[_0xb9d7('0x49')]['id']){delete _0xa72867[_0xb9d7('0x49')]['id'];}return db[_0xb9d7('0x3e')][_0xb9d7('0x47')]({'where':{'id':_0xa72867[_0xb9d7('0x44')]['id']}})[_0xb9d7('0x27')](handleEntityNotFound(_0xd4e34e,null))[_0xb9d7('0x27')](saveUpdates(_0xa72867[_0xb9d7('0x49')],null))[_0xb9d7('0x27')](respondWithResult(_0xd4e34e,null))[_0xb9d7('0x43')](handleError(_0xd4e34e,null));};exports[_0xb9d7('0x26')]=function(_0x47baf2,_0x5f3722){return db[_0xb9d7('0x3e')][_0xb9d7('0x47')]({'where':{'id':_0x47baf2[_0xb9d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f3722,null))[_0xb9d7('0x27')](removeEntity(_0x5f3722,null))[_0xb9d7('0x43')](handleError(_0x5f3722,null));};exports[_0xb9d7('0x4a')]=function(_0x2377bc,_0x255803){return db[_0xb9d7('0x3e')]['describe']()['then'](respondWithResult(_0x255803,null))[_0xb9d7('0x43')](handleError(_0x255803,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 62ef2a4..eb101f7 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 _0xc21f=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57929b,_0x5a464b){var _0x1cd4e1=function(_0x417cd1){while(--_0x417cd1){_0x57929b['push'](_0x57929b['shift']());}};_0x1cd4e1(++_0x5a464b);}(_0xc21f,0x1c3));var _0xfc21=function(_0x787f6,_0x31e64b){_0x787f6=_0x787f6-0x0;var _0x14ecd6=_0xc21f[_0x787f6];return _0x14ecd6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc21('0x0'))(_0xfc21('0x1'));var moment=require(_0xfc21('0x2'));var BPromise=require(_0xfc21('0x3'));var rp=require(_0xfc21('0x4'));var fs=require('fs');var path=require(_0xfc21('0x5'));var rimraf=require(_0xfc21('0x6'));var config=require(_0xfc21('0x7'));var attributes=require(_0xfc21('0x8'));module[_0xfc21('0x9')]=function(_0x27a82d,_0x18d595){return _0x27a82d[_0xfc21('0xa')]('IntegrationReport',attributes,{'tableName':_0xfc21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb09e=['../../config/environment','./integrationReport.attributes','report_integration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4da9e8,_0x448865){var _0x529c23=function(_0xdd672){while(--_0xdd672){_0x4da9e8['push'](_0x4da9e8['shift']());}};_0x529c23(++_0x448865);}(_0xb09e,0x87));var _0xeb09=function(_0xe80458,_0x5b168f){_0xe80458=_0xe80458-0x0;var _0x25f4ba=_0xb09e[_0xe80458];return _0x25f4ba;};'use strict';var _=require(_0xeb09('0x0'));var util=require(_0xeb09('0x1'));var logger=require(_0xeb09('0x2'))(_0xeb09('0x3'));var moment=require(_0xeb09('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb09('0x5'));var fs=require('fs');var path=require(_0xeb09('0x6'));var rimraf=require(_0xeb09('0x7'));var config=require(_0xeb09('0x8'));var attributes=require(_0xeb09('0x9'));module['exports']=function(_0x2850a4,_0x52df8b){return _0x2850a4['define']('IntegrationReport',attributes,{'tableName':_0xeb09('0xa'),'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 2cd3159..16fd5f7 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 _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3497fb,_0x2b54fa){var _0x59cd7c=function(_0x4c67ac){while(--_0x4c67ac){_0x3497fb['push'](_0x3497fb['shift']());}};_0x59cd7c(++_0x2b54fa);}(_0x31f0,0xb7));var _0x031f=function(_0x515fcd,_0x116cac){_0x515fcd=_0x515fcd-0x0;var _0x468634=_0x31f0[_0x515fcd];return _0x468634;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x53ec,0x192));var _0xc53e=function(_0x44c37d,_0x19119f){_0x44c37d=_0x44c37d-0x0;var _0x29e087=_0x53ec[_0x44c37d];return _0x29e087;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 0836ef6..62d8e8e 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 _0xc627=['../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xc627,0x14a));var _0x7c62=function(_0xa57d89,_0x25cbe8){_0xa57d89=_0xa57d89-0x0;var _0x10697c=_0xc627[_0xa57d89];return _0x10697c;};'use strict';var multer=require('multer');var util=require(_0x7c62('0x0'));var path=require(_0x7c62('0x1'));var timeout=require(_0x7c62('0x2'));var express=require('express');var router=express[_0x7c62('0x3')]();var fs_extra=require(_0x7c62('0x4'));var auth=require(_0x7c62('0x5'));var interaction=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var controller=require(_0x7c62('0x8'));router[_0x7c62('0x9')]('/',auth[_0x7c62('0xa')](),controller[_0x7c62('0xb')]);router[_0x7c62('0x9')](_0x7c62('0xc'),auth[_0x7c62('0xa')](),controller['show']);router['get'](_0x7c62('0xd'),auth[_0x7c62('0xa')](),controller[_0x7c62('0xe')]);router[_0x7c62('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7c62('0xd'),auth['isAuthenticated'](),controller[_0x7c62('0x10')]);router[_0x7c62('0xf')](_0x7c62('0x11'),auth[_0x7c62('0xa')](),controller[_0x7c62('0x12')]);router[_0x7c62('0x13')](_0x7c62('0xc'),auth[_0x7c62('0xa')](),controller[_0x7c62('0x14')]);router[_0x7c62('0x15')](_0x7c62('0xc'),auth[_0x7c62('0xa')](),controller[_0x7c62('0x16')]);module[_0x7c62('0x17')]=router; \ No newline at end of file +var _0x4cc7=['addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many'];(function(_0x1e31a0,_0x38333a){var _0x30f713=function(_0x537fde){while(--_0x537fde){_0x1e31a0['push'](_0x1e31a0['shift']());}};_0x30f713(++_0x38333a);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x50f7fb,_0xd5b534){_0x50f7fb=_0x50f7fb-0x0;var _0x494d7b=_0x4cc7[_0x50f7fb];return _0x494d7b;};'use strict';var multer=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var path=require(_0x74cc('0x2'));var timeout=require(_0x74cc('0x3'));var express=require(_0x74cc('0x4'));var router=express[_0x74cc('0x5')]();var fs_extra=require(_0x74cc('0x6'));var auth=require(_0x74cc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x74cc('0x8'));var controller=require(_0x74cc('0x9'));router[_0x74cc('0xa')]('/',auth[_0x74cc('0xb')](),controller[_0x74cc('0xc')]);router[_0x74cc('0xa')](_0x74cc('0xd'),auth[_0x74cc('0xb')](),controller[_0x74cc('0xe')]);router[_0x74cc('0xa')](_0x74cc('0xf'),auth[_0x74cc('0xb')](),controller[_0x74cc('0x10')]);router['post']('/',auth[_0x74cc('0xb')](),controller[_0x74cc('0x11')]);router[_0x74cc('0x12')](_0x74cc('0xf'),auth[_0x74cc('0xb')](),controller[_0x74cc('0x13')]);router[_0x74cc('0x12')](_0x74cc('0x14'),auth[_0x74cc('0xb')](),controller[_0x74cc('0x15')]);router[_0x74cc('0x16')](_0x74cc('0xd'),auth['isAuthenticated'](),controller[_0x74cc('0x17')]);router[_0x74cc('0x18')](_0x74cc('0xd'),auth['isAuthenticated'](),controller[_0x74cc('0x19')]);module[_0x74cc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3d8cd7f..9500307 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 _0xbbf4=['STRING','sequelize','exports'];(function(_0x2f8c99,_0x1970d0){var _0x47eb13=function(_0x56a94f){while(--_0x56a94f){_0x2f8c99['push'](_0x2f8c99['shift']());}};_0x47eb13(++_0x1970d0);}(_0xbbf4,0x10c));var _0x4bbf=function(_0x1b5740,_0x3ab3da){_0x1b5740=_0x1b5740-0x0;var _0x3648fe=_0xbbf4[_0x1b5740];return _0x3648fe;};'use strict';var Sequelize=require(_0x4bbf('0x0'));module[_0x4bbf('0x1')]={'name':{'type':Sequelize[_0x4bbf('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4bbf('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x5577=['exports','STRING','sequelize'];(function(_0x48fcee,_0x431a8b){var _0x28d65a=function(_0x28b4ad){while(--_0x28b4ad){_0x48fcee['push'](_0x48fcee['shift']());}};_0x28d65a(++_0x431a8b);}(_0x5577,0x1b2));var _0x7557=function(_0x1d9813,_0x79d463){_0x1d9813=_0x1d9813-0x0;var _0x353bd3=_0x5577[_0x1d9813];return _0x353bd3;};'use strict';var Sequelize=require(_0x7557('0x0'));module[_0x7557('0x1')]={'name':{'type':Sequelize[_0x7557('0x2')]},'description':{'type':Sequelize[_0x7557('0x2')]},'interval':{'type':Sequelize[_0x7557('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 78d87a5..31e7b92 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 _0xc800=['addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','Interval','rawAttributes','fieldName','type','model','map','keys','query','attributes','intersection','fields','length','nolimit','sort','filters','pick','merge','where','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','UserProfileSection','userProfileId','addInterval','IntervalId','findOne','options','getIntervals'];(function(_0x51276e,_0x28b616){var _0x1f5f30=function(_0x3ab106){while(--_0x3ab106){_0x51276e['push'](_0x51276e['shift']());}};_0x1f5f30(++_0x28b616);}(_0xc800,0x10e));var _0x0c80=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0xc800[_0x11f249];return _0x5c3656;};'use strict';var emlformat=require(_0x0c80('0x0'));var rimraf=require(_0x0c80('0x1'));var zipdir=require(_0x0c80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c80('0x3'));var moment=require(_0x0c80('0x4'));var BPromise=require(_0x0c80('0x5'));var Mustache=require('mustache');var util=require(_0x0c80('0x6'));var path=require(_0x0c80('0x7'));var sox=require(_0x0c80('0x8'));var csv=require(_0x0c80('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c80('0xa'));var _=require(_0x0c80('0xb'));var squel=require('squel');var crypto=require(_0x0c80('0xc'));var jsforce=require(_0x0c80('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c80('0x9'));var querystring=require(_0x0c80('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c80('0xf'));var qs=require(_0x0c80('0x10'));var as=require(_0x0c80('0x11'));var hardwareService=require(_0x0c80('0x12'));var logger=require('../../config/logger')(_0x0c80('0x13'));var utils=require(_0x0c80('0x14'));var config=require(_0x0c80('0x15'));var licenseUtil=require(_0x0c80('0x16'));var db=require(_0x0c80('0x17'))['db'];var extensions=require(_0x0c80('0x18'));function respondWithStatusCode(_0xb7e103,_0x4ac29d){_0x4ac29d=_0x4ac29d||0xcc;return function(_0x371655){if(_0x371655){return _0xb7e103[_0x0c80('0x19')](_0x4ac29d);}return _0xb7e103[_0x0c80('0x1a')](_0x4ac29d)[_0x0c80('0x1b')]();};}function respondWithResult(_0x2e5268,_0x14e32c){_0x14e32c=_0x14e32c||0xc8;return function(_0x329cc2){if(_0x329cc2){return _0x2e5268[_0x0c80('0x1a')](_0x14e32c)['json'](_0x329cc2);}};}function respondWithFilteredResult(_0x275915,_0xafe7a){return function(_0xe32d57){if(_0xe32d57){var _0x363b12=typeof _0xafe7a[_0x0c80('0x1c')]===_0x0c80('0x1d')&&typeof _0xafe7a[_0x0c80('0x1e')]===_0x0c80('0x1d');var _0x17e38f=_0xe32d57[_0x0c80('0x1f')];var _0x5913a4=_0x363b12?0x0:_0xafe7a[_0x0c80('0x1c')];var _0x1981f7=_0x363b12?_0xe32d57[_0x0c80('0x1f')]:_0xafe7a['offset']+_0xafe7a['limit'];var _0x4a2326;if(_0x1981f7>=_0x17e38f){_0x1981f7=_0x17e38f;_0x4a2326=0xc8;}else{_0x4a2326=0xce;}_0x275915['status'](_0x4a2326);return _0x275915[_0x0c80('0x20')](_0x0c80('0x21'),_0x5913a4+'-'+_0x1981f7+'/'+_0x17e38f)[_0x0c80('0x22')](_0xe32d57);}return null;};}function patchUpdates(_0xac2f08){return function(_0x5b63f5){try{jsonpatch['apply'](_0x5b63f5,_0xac2f08,!![]);}catch(_0x6d8084){return BPromise[_0x0c80('0x23')](_0x6d8084);}return _0x5b63f5[_0x0c80('0x24')]();};}function saveUpdates(_0xed6d8d,_0xa8b2ed){return function(_0x34392e){if(_0x34392e){return _0x34392e[_0x0c80('0x25')](_0xed6d8d)[_0x0c80('0x26')](function(_0x68da8){return _0x68da8;});}return null;};}function removeEntity(_0x5f054b,_0x55e56c){return function(_0x409143){if(_0x409143){return _0x409143['destroy']()[_0x0c80('0x26')](function(){var _0x428832=_0x409143[_0x0c80('0x27')]({'plain':!![]});var _0x1a50d6=_0x0c80('0x28');return db[_0x0c80('0x29')][_0x0c80('0x2a')]({'where':{'type':_0x1a50d6,'resourceId':_0x428832['id']}})[_0x0c80('0x26')](function(){return _0x409143;});})['then'](function(){_0x5f054b['status'](0xcc)[_0x0c80('0x1b')]();});}};}function handleEntityNotFound(_0x2d3daf,_0x2ad756){return function(_0x9dfab9){if(!_0x9dfab9){_0x2d3daf['sendStatus'](0x194);}return _0x9dfab9;};}function handleError(_0x53a73a,_0x34afd4){_0x34afd4=_0x34afd4||0x1f4;return function(_0xa7dd43){logger[_0x0c80('0x2b')](_0xa7dd43[_0x0c80('0x2c')]);if(_0xa7dd43['name']){delete _0xa7dd43[_0x0c80('0x2d')];}_0x53a73a['status'](_0x34afd4)[_0x0c80('0x2e')](_0xa7dd43);};}exports[_0x0c80('0x2f')]=function(_0xb56ec8,_0x1fa1e3){var _0x5b2f4b={},_0x4e15b7={},_0xb5ea70={'count':0x0,'rows':[]};var _0x29d91a=_['map'](db[_0x0c80('0x30')][_0x0c80('0x31')],function(_0x2f4de5){return{'name':_0x2f4de5[_0x0c80('0x32')],'type':_0x2f4de5[_0x0c80('0x33')]['key']};});_0x4e15b7[_0x0c80('0x34')]=_[_0x0c80('0x35')](_0x29d91a,'name');_0x4e15b7['query']=_[_0x0c80('0x36')](_0xb56ec8['query']);_0x4e15b7['filters']=_['intersection'](_0x4e15b7[_0x0c80('0x34')],_0x4e15b7[_0x0c80('0x37')]);_0x5b2f4b[_0x0c80('0x38')]=_[_0x0c80('0x39')](_0x4e15b7[_0x0c80('0x34')],qs[_0x0c80('0x3a')](_0xb56ec8[_0x0c80('0x37')]['fields']));_0x5b2f4b[_0x0c80('0x38')]=_0x5b2f4b['attributes'][_0x0c80('0x3b')]?_0x5b2f4b[_0x0c80('0x38')]:_0x4e15b7[_0x0c80('0x34')];if(!_0xb56ec8[_0x0c80('0x37')]['hasOwnProperty'](_0x0c80('0x3c'))){_0x5b2f4b['limit']=qs[_0x0c80('0x1e')](_0xb56ec8['query'][_0x0c80('0x1e')]);_0x5b2f4b['offset']=qs['offset'](_0xb56ec8[_0x0c80('0x37')]['offset']);}_0x5b2f4b['order']=qs[_0x0c80('0x3d')](_0xb56ec8[_0x0c80('0x37')][_0x0c80('0x3d')]);_0x5b2f4b['where']=qs[_0x0c80('0x3e')](_[_0x0c80('0x3f')](_0xb56ec8[_0x0c80('0x37')],_0x4e15b7[_0x0c80('0x3e')]),_0x29d91a);if(_0xb56ec8['query']['filter']){_0x5b2f4b['where']=_[_0x0c80('0x40')](_0x5b2f4b[_0x0c80('0x41')],{'$or':_[_0x0c80('0x35')](_0x29d91a,function(_0xe317a1){if(_0xe317a1['type']!==_0x0c80('0x42')){var _0xc8b6a2={};_0xc8b6a2[_0xe317a1[_0x0c80('0x2d')]]={'$like':'%'+_0xb56ec8[_0x0c80('0x37')][_0x0c80('0x43')]+'%'};return _0xc8b6a2;}})});}_0x5b2f4b=_[_0x0c80('0x40')]({},_0x5b2f4b,_0xb56ec8['options']);var _0x283477={'where':_0x5b2f4b[_0x0c80('0x41')]};return db[_0x0c80('0x30')][_0x0c80('0x1f')](_0x283477)['then'](function(_0x565f4e){_0xb5ea70[_0x0c80('0x1f')]=_0x565f4e;if(_0xb56ec8[_0x0c80('0x37')]['includeAll']){_0x5b2f4b[_0x0c80('0x44')]=[{'all':!![]}];}return db[_0x0c80('0x30')][_0x0c80('0x45')](_0x5b2f4b);})['then'](function(_0x56f4f8){_0xb5ea70[_0x0c80('0x46')]=_0x56f4f8;return _0xb5ea70;})[_0x0c80('0x26')](respondWithFilteredResult(_0x1fa1e3,_0x5b2f4b))[_0x0c80('0x47')](handleError(_0x1fa1e3,null));};exports[_0x0c80('0x48')]=function(_0x5c87b3,_0x48b1c2){var _0x25f9d5={'raw':!![],'where':{'id':_0x5c87b3[_0x0c80('0x49')]['id']}},_0x420be7={};_0x420be7[_0x0c80('0x34')]=_[_0x0c80('0x36')](db[_0x0c80('0x30')]['rawAttributes']);_0x420be7[_0x0c80('0x37')]=_['keys'](_0x5c87b3[_0x0c80('0x37')]);_0x420be7[_0x0c80('0x3e')]=_[_0x0c80('0x39')](_0x420be7[_0x0c80('0x34')],_0x420be7[_0x0c80('0x37')]);_0x25f9d5[_0x0c80('0x38')]=_[_0x0c80('0x39')](_0x420be7['model'],qs['fields'](_0x5c87b3[_0x0c80('0x37')][_0x0c80('0x3a')]));_0x25f9d5[_0x0c80('0x38')]=_0x25f9d5['attributes'][_0x0c80('0x3b')]?_0x25f9d5[_0x0c80('0x38')]:_0x420be7[_0x0c80('0x34')];if(_0x5c87b3['query'][_0x0c80('0x4a')]){_0x25f9d5[_0x0c80('0x44')]=[{'all':!![]}];}_0x25f9d5=_['merge']({},_0x25f9d5,_0x5c87b3['options']);return db[_0x0c80('0x30')][_0x0c80('0x4b')](_0x25f9d5)[_0x0c80('0x26')](handleEntityNotFound(_0x48b1c2,null))['then'](respondWithResult(_0x48b1c2,null))['catch'](handleError(_0x48b1c2,null));};exports[_0x0c80('0x4c')]=function(_0x27d9af,_0x3e01c3){return db[_0x0c80('0x30')][_0x0c80('0x4c')](_0x27d9af[_0x0c80('0x4d')],{})[_0x0c80('0x26')](function(_0x5282ac){var _0x38e8b8=_0x27d9af['user'][_0x0c80('0x27')]({'plain':!![]});if(!_0x38e8b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38e8b8[_0x0c80('0x4e')]==='user'){var _0x34922b=_0x5282ac[_0x0c80('0x27')]({'plain':!![]});var _0x786e46=_0x0c80('0x28');return db[_0x0c80('0x4f')][_0x0c80('0x4b')]({'where':{'name':_0x786e46,'userProfileId':_0x38e8b8[_0x0c80('0x50')]},'raw':!![]})[_0x0c80('0x26')](function(_0x6ceda6){if(_0x6ceda6&&_0x6ceda6['autoAssociation']===0x0){return db['UserProfileResource'][_0x0c80('0x4c')]({'name':_0x34922b[_0x0c80('0x2d')],'resourceId':_0x34922b['id'],'type':_0x6ceda6[_0x0c80('0x2d')],'sectionId':_0x6ceda6['id']},{})[_0x0c80('0x26')](function(){return _0x5282ac;});}else{return _0x5282ac;}})['catch'](function(_0x1ce5f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ce5f3);throw _0x1ce5f3;});}return _0x5282ac;})[_0x0c80('0x26')](respondWithResult(_0x3e01c3,0xc9))[_0x0c80('0x47')](handleError(_0x3e01c3,null));};exports['update']=function(_0x19a32e,_0x9003bf){if(_0x19a32e[_0x0c80('0x4d')]['id']){delete _0x19a32e[_0x0c80('0x4d')]['id'];}return db[_0x0c80('0x30')][_0x0c80('0x4b')]({'where':{'id':_0x19a32e[_0x0c80('0x49')]['id']}})[_0x0c80('0x26')](handleEntityNotFound(_0x9003bf,null))[_0x0c80('0x26')](saveUpdates(_0x19a32e['body'],null))[_0x0c80('0x26')](respondWithResult(_0x9003bf,null))[_0x0c80('0x47')](handleError(_0x9003bf,null));};exports[_0x0c80('0x2a')]=function(_0xf65bcd,_0x4b1292){return db[_0x0c80('0x30')][_0x0c80('0x4b')]({'where':{'id':_0xf65bcd[_0x0c80('0x49')]['id']}})[_0x0c80('0x26')](handleEntityNotFound(_0x4b1292,null))[_0x0c80('0x26')](removeEntity(_0x4b1292,null))[_0x0c80('0x47')](handleError(_0x4b1292,null));};exports[_0x0c80('0x51')]=function(_0x47dc2c,_0x5028f4,_0x2156a7){if(_0x47dc2c[_0x0c80('0x4d')]['id']){delete _0x47dc2c['body']['id'];}return db[_0x0c80('0x30')][_0x0c80('0x4b')]({'where':{'id':_0x47dc2c[_0x0c80('0x49')]['id']}})[_0x0c80('0x26')](handleEntityNotFound(_0x5028f4,null))[_0x0c80('0x26')](function(_0x1ce9c9){if(_0x1ce9c9){_0x47dc2c[_0x0c80('0x4d')][_0x0c80('0x52')]=_0x1ce9c9['id'];return db[_0x0c80('0x30')][_0x0c80('0x4c')](_0x47dc2c['body']);}})['then'](respondWithResult(_0x5028f4,null))['catch'](handleError(_0x5028f4,null));};exports['getIntervals']=function(_0x16dc42,_0x3ad38c,_0x67cbc1){var _0x5cc353={};var _0x1e212f={};var _0x49e8a7;var _0xffdfb1;return db[_0x0c80('0x30')][_0x0c80('0x53')]({'where':{'id':_0x16dc42[_0x0c80('0x49')]['id']}})[_0x0c80('0x26')](handleEntityNotFound(_0x3ad38c,null))['then'](function(_0x1e7c75){if(_0x1e7c75){_0x49e8a7=_0x1e7c75;_0x1e212f[_0x0c80('0x34')]=_[_0x0c80('0x36')](db[_0x0c80('0x30')][_0x0c80('0x31')]);_0x1e212f[_0x0c80('0x37')]=_[_0x0c80('0x36')](_0x16dc42[_0x0c80('0x37')]);_0x1e212f[_0x0c80('0x3e')]=_[_0x0c80('0x39')](_0x1e212f[_0x0c80('0x34')],_0x1e212f['query']);_0x5cc353[_0x0c80('0x38')]=_[_0x0c80('0x39')](_0x1e212f['model'],qs[_0x0c80('0x3a')](_0x16dc42[_0x0c80('0x37')]['fields']));_0x5cc353[_0x0c80('0x38')]=_0x5cc353['attributes']['length']?_0x5cc353[_0x0c80('0x38')]:_0x1e212f[_0x0c80('0x34')];_0x5cc353['order']=qs[_0x0c80('0x3d')](_0x16dc42[_0x0c80('0x37')]['sort']);_0x5cc353['where']=qs[_0x0c80('0x3e')](_[_0x0c80('0x3f')](_0x16dc42[_0x0c80('0x37')],_0x1e212f[_0x0c80('0x3e')]));if(_0x16dc42[_0x0c80('0x37')][_0x0c80('0x43')]){_0x5cc353[_0x0c80('0x41')]=_[_0x0c80('0x40')](_0x5cc353[_0x0c80('0x41')],{'$or':_[_0x0c80('0x35')](_0x5cc353[_0x0c80('0x38')],function(_0x552f8e){var _0x2d237a={};_0x2d237a[_0x552f8e]={'$like':'%'+_0x16dc42['query'][_0x0c80('0x43')]+'%'};return _0x2d237a;})});}_0x5cc353=_[_0x0c80('0x40')]({},_0x5cc353,_0x16dc42[_0x0c80('0x54')]);return _0x49e8a7['getIntervals'](_0x5cc353);}})[_0x0c80('0x26')](function(_0xe55f59){if(_0xe55f59){_0xffdfb1=_0xe55f59['length'];if(!_0x16dc42[_0x0c80('0x37')]['hasOwnProperty'](_0x0c80('0x3c'))){_0x5cc353[_0x0c80('0x1e')]=qs[_0x0c80('0x1e')](_0x16dc42[_0x0c80('0x37')]['limit']);_0x5cc353[_0x0c80('0x1c')]=qs[_0x0c80('0x1c')](_0x16dc42[_0x0c80('0x37')][_0x0c80('0x1c')]);}return _0x49e8a7[_0x0c80('0x55')](_0x5cc353);}})['then'](function(_0x228fd7){if(_0x228fd7){return _0x228fd7?{'count':_0xffdfb1,'rows':_0x228fd7}:null;}})[_0x0c80('0x26')](respondWithResult(_0x3ad38c,null))['catch'](handleError(_0x3ad38c,null));};exports[_0x0c80('0x56')]=function(_0x1ddcff,_0x25800b,_0x26bd3a){return db[_0x0c80('0x30')][_0x0c80('0x53')]({'where':{'id':_0x1ddcff[_0x0c80('0x49')]['id']}})[_0x0c80('0x26')](handleEntityNotFound(_0x25800b,null))[_0x0c80('0x26')](function(_0x1d798e){if(_0x1d798e){return db[_0x0c80('0x57')]['transaction'](function(_0x41ffb1){return db[_0x0c80('0x30')][_0x0c80('0x2a')]({'where':{'IntervalId':_0x1ddcff[_0x0c80('0x49')]['id']},'transaction':_0x41ffb1})[_0x0c80('0x26')](function(_0x2dc254){var _0x303dfe=_['map'](_0x1ddcff[_0x0c80('0x4d')],function(_0xe3005e){delete _0xe3005e['id'];_0xe3005e[_0x0c80('0x52')]=_0x1ddcff[_0x0c80('0x49')]['id'];return _0xe3005e;});return db[_0x0c80('0x30')][_0x0c80('0x58')](_0x303dfe,{'transaction':_0x41ffb1});});})[_0x0c80('0x26')](function(){return db[_0x0c80('0x30')][_0x0c80('0x45')]({'where':{'IntervalId':_0x1ddcff[_0x0c80('0x49')]['id']}});});}})[_0x0c80('0x26')](respondWithResult(_0x25800b,null))[_0x0c80('0x47')](handleError(_0x25800b,null));}; \ No newline at end of file +var _0xff11=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','UserProfileResource','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','get','role','user','Intervals','UserProfileSection','error','update','destroy','addInterval','getIntervals','findOne','hasOwnProperty','addIntervals','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4a1803,_0x8021e3){var _0x4efc71=function(_0x396e11){while(--_0x396e11){_0x4a1803['push'](_0x4a1803['shift']());}};_0x4efc71(++_0x8021e3);}(_0xff11,0xb3));var _0x1ff1=function(_0x1edfbb,_0x28458e){_0x1edfbb=_0x1edfbb-0x0;var _0x357128=_0xff11[_0x1edfbb];return _0x357128;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ff1('0x0'));var zipdir=require(_0x1ff1('0x1'));var jsonpatch=require(_0x1ff1('0x2'));var rp=require(_0x1ff1('0x3'));var moment=require(_0x1ff1('0x4'));var BPromise=require(_0x1ff1('0x5'));var Mustache=require(_0x1ff1('0x6'));var util=require(_0x1ff1('0x7'));var path=require(_0x1ff1('0x8'));var sox=require(_0x1ff1('0x9'));var csv=require('to-csv');var ejs=require(_0x1ff1('0xa'));var fs=require('fs');var fs_extra=require(_0x1ff1('0xb'));var _=require(_0x1ff1('0xc'));var squel=require(_0x1ff1('0xd'));var crypto=require(_0x1ff1('0xe'));var jsforce=require(_0x1ff1('0xf'));var deskjs=require(_0x1ff1('0x10'));var toCsv=require(_0x1ff1('0x11'));var querystring=require(_0x1ff1('0x12'));var Papa=require(_0x1ff1('0x13'));var Redis=require(_0x1ff1('0x14'));var authService=require(_0x1ff1('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x1ff1('0x16'));var hardwareService=require(_0x1ff1('0x17'));var logger=require(_0x1ff1('0x18'))(_0x1ff1('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1ff1('0x1a'));var db=require(_0x1ff1('0x1b'))['db'];var extensions=require(_0x1ff1('0x1c'));function respondWithStatusCode(_0x43c54a,_0x4f5d32){_0x4f5d32=_0x4f5d32||0xcc;return function(_0x678d1a){if(_0x678d1a){return _0x43c54a[_0x1ff1('0x1d')](_0x4f5d32);}return _0x43c54a[_0x1ff1('0x1e')](_0x4f5d32)[_0x1ff1('0x1f')]();};}function respondWithResult(_0x506b77,_0x3016d0){_0x3016d0=_0x3016d0||0xc8;return function(_0x1ec70c){if(_0x1ec70c){return _0x506b77[_0x1ff1('0x1e')](_0x3016d0)[_0x1ff1('0x20')](_0x1ec70c);}};}function respondWithFilteredResult(_0x13fc11,_0x584d9b){return function(_0x34c0a1){if(_0x34c0a1){var _0x477501=typeof _0x584d9b[_0x1ff1('0x21')]===_0x1ff1('0x22')&&typeof _0x584d9b['limit']===_0x1ff1('0x22');var _0x7a3c1b=_0x34c0a1[_0x1ff1('0x23')];var _0x19f76a=_0x477501?0x0:_0x584d9b[_0x1ff1('0x21')];var _0x5123d7=_0x477501?_0x34c0a1[_0x1ff1('0x23')]:_0x584d9b[_0x1ff1('0x21')]+_0x584d9b[_0x1ff1('0x24')];var _0x1370ae;if(_0x5123d7>=_0x7a3c1b){_0x5123d7=_0x7a3c1b;_0x1370ae=0xc8;}else{_0x1370ae=0xce;}_0x13fc11[_0x1ff1('0x1e')](_0x1370ae);return _0x13fc11[_0x1ff1('0x25')](_0x1ff1('0x26'),_0x19f76a+'-'+_0x5123d7+'/'+_0x7a3c1b)[_0x1ff1('0x20')](_0x34c0a1);}return null;};}function patchUpdates(_0x593621){return function(_0x31b515){try{jsonpatch[_0x1ff1('0x27')](_0x31b515,_0x593621,!![]);}catch(_0x35411d){return BPromise[_0x1ff1('0x28')](_0x35411d);}return _0x31b515['save']();};}function saveUpdates(_0x1acb8d,_0x4325f8){return function(_0x10a215){if(_0x10a215){return _0x10a215['update'](_0x1acb8d)['then'](function(_0xa207c7){return _0xa207c7;});}return null;};}function removeEntity(_0x11cdf7,_0x714581){return function(_0x11549f){if(_0x11549f){return _0x11549f['destroy']()[_0x1ff1('0x29')](function(){var _0x2d1ff2=_0x11549f['get']({'plain':!![]});var _0xd3680e='Intervals';return db[_0x1ff1('0x2a')]['destroy']({'where':{'type':_0xd3680e,'resourceId':_0x2d1ff2['id']}})[_0x1ff1('0x29')](function(){return _0x11549f;});})[_0x1ff1('0x29')](function(){_0x11cdf7['status'](0xcc)[_0x1ff1('0x1f')]();});}};}function handleEntityNotFound(_0x2ffa81,_0x1718f3){return function(_0x4d24af){if(!_0x4d24af){_0x2ffa81[_0x1ff1('0x1d')](0x194);}return _0x4d24af;};}function handleError(_0x3e9be7,_0x354540){_0x354540=_0x354540||0x1f4;return function(_0x2f2ca8){logger['error'](_0x2f2ca8['stack']);if(_0x2f2ca8[_0x1ff1('0x2b')]){delete _0x2f2ca8[_0x1ff1('0x2b')];}_0x3e9be7[_0x1ff1('0x1e')](_0x354540)[_0x1ff1('0x2c')](_0x2f2ca8);};}exports['index']=function(_0x27a631,_0x41defc){var _0x5de860={},_0x8aee1a={},_0x534e6d={'count':0x0,'rows':[]};var _0x436917=_[_0x1ff1('0x2d')](db[_0x1ff1('0x2e')][_0x1ff1('0x2f')],function(_0x8b4c25){return{'name':_0x8b4c25[_0x1ff1('0x30')],'type':_0x8b4c25[_0x1ff1('0x31')][_0x1ff1('0x32')]};});_0x8aee1a[_0x1ff1('0x33')]=_[_0x1ff1('0x2d')](_0x436917,_0x1ff1('0x2b'));_0x8aee1a[_0x1ff1('0x34')]=_[_0x1ff1('0x35')](_0x27a631[_0x1ff1('0x34')]);_0x8aee1a[_0x1ff1('0x36')]=_[_0x1ff1('0x37')](_0x8aee1a[_0x1ff1('0x33')],_0x8aee1a[_0x1ff1('0x34')]);_0x5de860[_0x1ff1('0x38')]=_[_0x1ff1('0x37')](_0x8aee1a[_0x1ff1('0x33')],qs[_0x1ff1('0x39')](_0x27a631[_0x1ff1('0x34')]['fields']));_0x5de860['attributes']=_0x5de860[_0x1ff1('0x38')][_0x1ff1('0x3a')]?_0x5de860[_0x1ff1('0x38')]:_0x8aee1a[_0x1ff1('0x33')];if(!_0x27a631[_0x1ff1('0x34')]['hasOwnProperty'](_0x1ff1('0x3b'))){_0x5de860[_0x1ff1('0x24')]=qs[_0x1ff1('0x24')](_0x27a631[_0x1ff1('0x34')][_0x1ff1('0x24')]);_0x5de860[_0x1ff1('0x21')]=qs[_0x1ff1('0x21')](_0x27a631[_0x1ff1('0x34')][_0x1ff1('0x21')]);}_0x5de860[_0x1ff1('0x3c')]=qs[_0x1ff1('0x3d')](_0x27a631[_0x1ff1('0x34')][_0x1ff1('0x3d')]);_0x5de860[_0x1ff1('0x3e')]=qs[_0x1ff1('0x36')](_[_0x1ff1('0x3f')](_0x27a631[_0x1ff1('0x34')],_0x8aee1a['filters']),_0x436917);if(_0x27a631[_0x1ff1('0x34')]['filter']){_0x5de860[_0x1ff1('0x3e')]=_[_0x1ff1('0x40')](_0x5de860[_0x1ff1('0x3e')],{'$or':_[_0x1ff1('0x2d')](_0x436917,function(_0x1622c6){if(_0x1622c6['type']!==_0x1ff1('0x41')){var _0x1dc7de={};_0x1dc7de[_0x1622c6[_0x1ff1('0x2b')]]={'$like':'%'+_0x27a631[_0x1ff1('0x34')][_0x1ff1('0x42')]+'%'};return _0x1dc7de;}})});}_0x5de860=_[_0x1ff1('0x40')]({},_0x5de860,_0x27a631['options']);var _0x43178d={'where':_0x5de860[_0x1ff1('0x3e')]};return db[_0x1ff1('0x2e')][_0x1ff1('0x23')](_0x43178d)[_0x1ff1('0x29')](function(_0xaa8a40){_0x534e6d[_0x1ff1('0x23')]=_0xaa8a40;if(_0x27a631['query'][_0x1ff1('0x43')]){_0x5de860[_0x1ff1('0x44')]=[{'all':!![]}];}return db[_0x1ff1('0x2e')][_0x1ff1('0x45')](_0x5de860);})['then'](function(_0x29ee52){_0x534e6d[_0x1ff1('0x46')]=_0x29ee52;return _0x534e6d;})[_0x1ff1('0x29')](respondWithFilteredResult(_0x41defc,_0x5de860))[_0x1ff1('0x47')](handleError(_0x41defc,null));};exports[_0x1ff1('0x48')]=function(_0x3138a0,_0x1f2f09){var _0xcc1923={'raw':!![],'where':{'id':_0x3138a0[_0x1ff1('0x49')]['id']}},_0x5ccd33={};_0x5ccd33[_0x1ff1('0x33')]=_[_0x1ff1('0x35')](db[_0x1ff1('0x2e')][_0x1ff1('0x2f')]);_0x5ccd33[_0x1ff1('0x34')]=_[_0x1ff1('0x35')](_0x3138a0[_0x1ff1('0x34')]);_0x5ccd33['filters']=_[_0x1ff1('0x37')](_0x5ccd33[_0x1ff1('0x33')],_0x5ccd33[_0x1ff1('0x34')]);_0xcc1923['attributes']=_[_0x1ff1('0x37')](_0x5ccd33['model'],qs[_0x1ff1('0x39')](_0x3138a0[_0x1ff1('0x34')][_0x1ff1('0x39')]));_0xcc1923[_0x1ff1('0x38')]=_0xcc1923[_0x1ff1('0x38')][_0x1ff1('0x3a')]?_0xcc1923['attributes']:_0x5ccd33['model'];if(_0x3138a0[_0x1ff1('0x34')][_0x1ff1('0x43')]){_0xcc1923[_0x1ff1('0x44')]=[{'all':!![]}];}_0xcc1923=_[_0x1ff1('0x40')]({},_0xcc1923,_0x3138a0[_0x1ff1('0x4a')]);return db[_0x1ff1('0x2e')][_0x1ff1('0x4b')](_0xcc1923)[_0x1ff1('0x29')](handleEntityNotFound(_0x1f2f09,null))['then'](respondWithResult(_0x1f2f09,null))[_0x1ff1('0x47')](handleError(_0x1f2f09,null));};exports['create']=function(_0x3d9ddb,_0x35fb12){return db[_0x1ff1('0x2e')][_0x1ff1('0x4c')](_0x3d9ddb[_0x1ff1('0x4d')],{})[_0x1ff1('0x29')](function(_0x479f23){var _0x4f2eba=_0x3d9ddb['user'][_0x1ff1('0x4e')]({'plain':!![]});if(!_0x4f2eba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f2eba[_0x1ff1('0x4f')]===_0x1ff1('0x50')){var _0x38f6bb=_0x479f23[_0x1ff1('0x4e')]({'plain':!![]});var _0x1f004e=_0x1ff1('0x51');return db[_0x1ff1('0x52')][_0x1ff1('0x4b')]({'where':{'name':_0x1f004e,'userProfileId':_0x4f2eba['userProfileId']},'raw':!![]})[_0x1ff1('0x29')](function(_0x1fcb9b){if(_0x1fcb9b&&_0x1fcb9b['autoAssociation']===0x0){return db['UserProfileResource'][_0x1ff1('0x4c')]({'name':_0x38f6bb['name'],'resourceId':_0x38f6bb['id'],'type':_0x1fcb9b[_0x1ff1('0x2b')],'sectionId':_0x1fcb9b['id']},{})[_0x1ff1('0x29')](function(){return _0x479f23;});}else{return _0x479f23;}})[_0x1ff1('0x47')](function(_0x350e22){logger[_0x1ff1('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x350e22);throw _0x350e22;});}return _0x479f23;})[_0x1ff1('0x29')](respondWithResult(_0x35fb12,0xc9))[_0x1ff1('0x47')](handleError(_0x35fb12,null));};exports[_0x1ff1('0x54')]=function(_0x498de1,_0x4c2be8){if(_0x498de1[_0x1ff1('0x4d')]['id']){delete _0x498de1['body']['id'];}return db[_0x1ff1('0x2e')]['find']({'where':{'id':_0x498de1[_0x1ff1('0x49')]['id']}})[_0x1ff1('0x29')](handleEntityNotFound(_0x4c2be8,null))[_0x1ff1('0x29')](saveUpdates(_0x498de1[_0x1ff1('0x4d')],null))[_0x1ff1('0x29')](respondWithResult(_0x4c2be8,null))[_0x1ff1('0x47')](handleError(_0x4c2be8,null));};exports[_0x1ff1('0x55')]=function(_0x307459,_0x453bd3){return db[_0x1ff1('0x2e')][_0x1ff1('0x4b')]({'where':{'id':_0x307459['params']['id']}})[_0x1ff1('0x29')](handleEntityNotFound(_0x453bd3,null))[_0x1ff1('0x29')](removeEntity(_0x453bd3,null))[_0x1ff1('0x47')](handleError(_0x453bd3,null));};exports[_0x1ff1('0x56')]=function(_0x5717f7,_0x5c9b31,_0x3b32e3){if(_0x5717f7[_0x1ff1('0x4d')]['id']){delete _0x5717f7['body']['id'];}return db[_0x1ff1('0x2e')][_0x1ff1('0x4b')]({'where':{'id':_0x5717f7[_0x1ff1('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c9b31,null))['then'](function(_0x33a79e){if(_0x33a79e){_0x5717f7[_0x1ff1('0x4d')]['IntervalId']=_0x33a79e['id'];return db['Interval'][_0x1ff1('0x4c')](_0x5717f7[_0x1ff1('0x4d')]);}})['then'](respondWithResult(_0x5c9b31,null))['catch'](handleError(_0x5c9b31,null));};exports[_0x1ff1('0x57')]=function(_0x1df595,_0x4eda8c,_0x24af9d){var _0xcc58c0={};var _0x3efe01={};var _0x3cd03f;var _0x5a3531;return db[_0x1ff1('0x2e')][_0x1ff1('0x58')]({'where':{'id':_0x1df595[_0x1ff1('0x49')]['id']}})[_0x1ff1('0x29')](handleEntityNotFound(_0x4eda8c,null))[_0x1ff1('0x29')](function(_0x5d3c6e){if(_0x5d3c6e){_0x3cd03f=_0x5d3c6e;_0x3efe01[_0x1ff1('0x33')]=_[_0x1ff1('0x35')](db['Interval'][_0x1ff1('0x2f')]);_0x3efe01[_0x1ff1('0x34')]=_[_0x1ff1('0x35')](_0x1df595[_0x1ff1('0x34')]);_0x3efe01[_0x1ff1('0x36')]=_[_0x1ff1('0x37')](_0x3efe01[_0x1ff1('0x33')],_0x3efe01['query']);_0xcc58c0[_0x1ff1('0x38')]=_[_0x1ff1('0x37')](_0x3efe01[_0x1ff1('0x33')],qs[_0x1ff1('0x39')](_0x1df595[_0x1ff1('0x34')][_0x1ff1('0x39')]));_0xcc58c0['attributes']=_0xcc58c0[_0x1ff1('0x38')]['length']?_0xcc58c0[_0x1ff1('0x38')]:_0x3efe01[_0x1ff1('0x33')];_0xcc58c0[_0x1ff1('0x3c')]=qs['sort'](_0x1df595['query'][_0x1ff1('0x3d')]);_0xcc58c0['where']=qs[_0x1ff1('0x36')](_[_0x1ff1('0x3f')](_0x1df595[_0x1ff1('0x34')],_0x3efe01[_0x1ff1('0x36')]));if(_0x1df595[_0x1ff1('0x34')]['filter']){_0xcc58c0[_0x1ff1('0x3e')]=_['merge'](_0xcc58c0['where'],{'$or':_[_0x1ff1('0x2d')](_0xcc58c0[_0x1ff1('0x38')],function(_0x1cfc8b){var _0x53a2b7={};_0x53a2b7[_0x1cfc8b]={'$like':'%'+_0x1df595[_0x1ff1('0x34')]['filter']+'%'};return _0x53a2b7;})});}_0xcc58c0=_['merge']({},_0xcc58c0,_0x1df595[_0x1ff1('0x4a')]);return _0x3cd03f[_0x1ff1('0x57')](_0xcc58c0);}})[_0x1ff1('0x29')](function(_0x520879){if(_0x520879){_0x5a3531=_0x520879['length'];if(!_0x1df595[_0x1ff1('0x34')][_0x1ff1('0x59')](_0x1ff1('0x3b'))){_0xcc58c0[_0x1ff1('0x24')]=qs['limit'](_0x1df595[_0x1ff1('0x34')][_0x1ff1('0x24')]);_0xcc58c0['offset']=qs[_0x1ff1('0x21')](_0x1df595[_0x1ff1('0x34')]['offset']);}return _0x3cd03f[_0x1ff1('0x57')](_0xcc58c0);}})['then'](function(_0x36dea3){if(_0x36dea3){return _0x36dea3?{'count':_0x5a3531,'rows':_0x36dea3}:null;}})[_0x1ff1('0x29')](respondWithResult(_0x4eda8c,null))['catch'](handleError(_0x4eda8c,null));};exports[_0x1ff1('0x5a')]=function(_0x4f9c66,_0x2b3791,_0x47df02){return db[_0x1ff1('0x2e')][_0x1ff1('0x58')]({'where':{'id':_0x4f9c66[_0x1ff1('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b3791,null))['then'](function(_0x25a0f7){if(_0x25a0f7){return db['sequelize'][_0x1ff1('0x5b')](function(_0x27b9d8){return db[_0x1ff1('0x2e')]['destroy']({'where':{'IntervalId':_0x4f9c66[_0x1ff1('0x49')]['id']},'transaction':_0x27b9d8})[_0x1ff1('0x29')](function(_0x5598e8){var _0x2838f3=_[_0x1ff1('0x2d')](_0x4f9c66[_0x1ff1('0x4d')],function(_0x2c160f){delete _0x2c160f['id'];_0x2c160f['IntervalId']=_0x4f9c66['params']['id'];return _0x2c160f;});return db['Interval']['bulkCreate'](_0x2838f3,{'transaction':_0x27b9d8});});})[_0x1ff1('0x29')](function(){return db[_0x1ff1('0x2e')][_0x1ff1('0x45')]({'where':{'IntervalId':_0x4f9c66[_0x1ff1('0x49')]['id']}});});}})['then'](respondWithResult(_0x2b3791,null))[_0x1ff1('0x47')](handleError(_0x2b3791,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4890a8f..2432a72 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 _0x2ef3=['define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./interval.attributes','../../components/extensions/rewrite'];(function(_0x23fba0,_0x20d820){var _0x326b7d=function(_0x1608fa){while(--_0x1608fa){_0x23fba0['push'](_0x23fba0['shift']());}};_0x326b7d(++_0x20d820);}(_0x2ef3,0xba));var _0x32ef=function(_0x340209,_0x4e263d){_0x340209=_0x340209-0x0;var _0x480efb=_0x2ef3[_0x340209];return _0x480efb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));var extensions=require(_0x32ef('0x9'));module['exports']=function(_0x5dfa09,_0x2c0089){return _0x5dfa09[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x234863,_0x298066){extensions[_0x32ef('0xd')](_0x5dfa09,_0x234863);},'afterBulkCreate':function(_0x2bbb50,_0x28275c,_0x77df79){_0x77df79();extensions['rewrite'](_0x5dfa09,_0x2bbb50[0x0]);},'afterUpdate':function(_0x5780e9,_0x401d0b){extensions[_0x32ef('0xd')](_0x5dfa09,_0x5780e9);},'afterDestroy':function(_0x45bfd5,_0x1499c2){extensions['rewrite'](_0x5dfa09,_0x45bfd5);}}});}; \ No newline at end of file +var _0xea32=['Interval','tools_intervals','rewrite','util','api','moment','request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x128ca6,_0x81ea4){var _0x4f8dd6=function(_0x7b8584){while(--_0x7b8584){_0x128ca6['push'](_0x128ca6['shift']());}};_0x4f8dd6(++_0x81ea4);}(_0xea32,0xff));var _0x2ea3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea32[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2ea3('0x0'));var logger=require('../../config/logger')(_0x2ea3('0x1'));var moment=require(_0x2ea3('0x2'));var BPromise=require('bluebird');var rp=require(_0x2ea3('0x3'));var fs=require('fs');var path=require(_0x2ea3('0x4'));var rimraf=require(_0x2ea3('0x5'));var config=require('../../config/environment');var attributes=require(_0x2ea3('0x6'));var extensions=require(_0x2ea3('0x7'));module[_0x2ea3('0x8')]=function(_0xd4ad5b,_0x8228c4){return _0xd4ad5b['define'](_0x2ea3('0x9'),attributes,{'tableName':_0x2ea3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x844155,_0x24da44){extensions[_0x2ea3('0xb')](_0xd4ad5b,_0x844155);},'afterBulkCreate':function(_0x4f269b,_0x331825,_0x2f855b){_0x2f855b();extensions[_0x2ea3('0xb')](_0xd4ad5b,_0x4f269b[0x0]);},'afterUpdate':function(_0x563d2e,_0x172f32){extensions[_0x2ea3('0xb')](_0xd4ad5b,_0x563d2e);},'afterDestroy':function(_0x3faceb,_0x4c2f5e){extensions[_0x2ea3('0xb')](_0xd4ad5b,_0x3faceb);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ed085f2..2dcb192 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 366c31c..e974f24 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5827ac,_0x461219){_0x5827ac=_0x5827ac-0x0;var _0x152430=_0x5f2f[_0x5827ac];return _0x152430;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 07beb28..ae681e8 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 _0x9a88=['connection','remoteAddress','socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9a88,0x1d0));var _0x89a8=function(_0x4768e0,_0x29dee6){_0x4768e0=_0x4768e0-0x0;var _0x2af3fd=_0x9a88[_0x4768e0];return _0x2af3fd;};'use strict';var BPromise=require(_0x89a8('0x0'));var https=require(_0x89a8('0x1'));var logger=require(_0x89a8('0x2'))('api');var USERNAME=_0x89a8('0x3');var PASSWORD=_0x89a8('0x4');function openIssue(_0x197645,_0x4c30d3){var _0x5ed106={'fields':{'project':{'key':_0x197645[_0x89a8('0x5')]||_0x89a8('0x6')},'summary':(_0x197645[_0x89a8('0x7')]||_0x89a8('0x8'))+_0x89a8('0x9')+_0x197645['ip'],'description':_0x197645[_0x89a8('0xa')]||JSON[_0x89a8('0xb')](_0x197645),'issuetype':{'name':_0x197645[_0x89a8('0xc')]||_0x89a8('0xd')}}};_0x5ed106[_0x89a8('0xe')]['customfield_11500']=_0x197645[_0x89a8('0xf')];_0x5ed106[_0x89a8('0xe')][_0x89a8('0x10')]=_0x197645[_0x89a8('0x11')];_0x5ed106[_0x89a8('0xe')][_0x89a8('0x12')]=_0x197645[_0x89a8('0x13')];_0x5ed106['fields'][_0x89a8('0x14')]=_0x197645[_0x89a8('0x15')];_0x5ed106[_0x89a8('0xe')][_0x89a8('0x16')]=_0x197645['reason'];_0x5ed106[_0x89a8('0xe')]['customfield_10102']=_0x197645['ip'];var _0xcde858={'host':_0x89a8('0x17'),'port':0x1bb,'path':_0x89a8('0x18'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x89a8('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x89a8('0x1a')](_0x89a8('0x1b'))}};var _0x26730e=JSON[_0x89a8('0xb')](_0x5ed106);var _0x5cea54=https[_0x89a8('0x1c')](_0xcde858,function(_0x59366a){_0x59366a[_0x89a8('0x1d')](_0x89a8('0x1e'));var _0x372656='';_0x59366a['on'](_0x89a8('0x1f'),function(_0x167651){_0x372656+=_0x167651;});_0x59366a['on'](_0x89a8('0x20'),function(){if(_0x4c30d3){return _0x4c30d3[_0x89a8('0x21')](_0x59366a['statusCode'])[_0x89a8('0x22')](JSON[_0x89a8('0x23')](_0x372656));}});});_0x5cea54['on'](_0x89a8('0x24'),function(_0x768393){if(_0x4c30d3){return _0x4c30d3[_0x89a8('0x21')](0x1f4)[_0x89a8('0x22')]({'errors':[{'message':_0x89a8('0x25'),'type':_0x89a8('0x26')}]});}});_0x5cea54[_0x89a8('0x27')](_0x26730e);_0x5cea54['end']();}exports['openIssue']=openIssue;exports[_0x89a8('0x28')]=function(_0x364993,_0x560acf){_0x364993['body']['ip']=_0x364993[_0x89a8('0x29')]['x-forwarded-for']||_0x364993[_0x89a8('0x2a')][_0x89a8('0x2b')]||_0x364993[_0x89a8('0x2c')][_0x89a8('0x2b')]||_0x364993[_0x89a8('0x2a')][_0x89a8('0x2c')][_0x89a8('0x2b')];return openIssue(_0x364993[_0x89a8('0x2d')],_0x560acf);}; \ No newline at end of file +var _0xab2b=['newToken','customfield_11503','reason','POST','application/json','base64','stringify','request','setEncoding','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','issuetype','Bug','fields','oldToken','customfield_11502'];(function(_0x3f4524,_0x238323){var _0x179c91=function(_0x5a49ea){while(--_0x5a49ea){_0x3f4524['push'](_0x3f4524['shift']());}};_0x179c91(++_0x238323);}(_0xab2b,0x1d5));var _0xbab2=function(_0x5e0de8,_0x4fc62c){_0x5e0de8=_0x5e0de8-0x0;var _0x6e9b38=_0xab2b[_0x5e0de8];return _0x6e9b38;};'use strict';var BPromise=require(_0xbab2('0x0'));var https=require(_0xbab2('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0xbab2('0x2');function openIssue(_0x128bb7,_0x4d65bc){var _0x45c402={'fields':{'project':{'key':_0x128bb7['key']||_0xbab2('0x3')},'summary':(_0x128bb7['summary']||_0xbab2('0x4'))+_0xbab2('0x5')+_0x128bb7['ip'],'description':_0x128bb7[_0xbab2('0x6')]||JSON['stringify'](_0x128bb7),'issuetype':{'name':_0x128bb7[_0xbab2('0x7')]||_0xbab2('0x8')}}};_0x45c402['fields']['customfield_11500']=_0x128bb7['email'];_0x45c402[_0xbab2('0x9')]['customfield_11501']=_0x128bb7[_0xbab2('0xa')];_0x45c402[_0xbab2('0x9')][_0xbab2('0xb')]=_0x128bb7[_0xbab2('0xc')];_0x45c402[_0xbab2('0x9')][_0xbab2('0xd')]=_0x128bb7['name'];_0x45c402[_0xbab2('0x9')]['customfield_11504']=_0x128bb7[_0xbab2('0xe')];_0x45c402[_0xbab2('0x9')]['customfield_10102']=_0x128bb7['ip'];var _0x6b0502={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xbab2('0xf'),'timeout':0x4e20,'headers':{'Content-Type':_0xbab2('0x10'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xbab2('0x11'))}};var _0x1102e2=JSON[_0xbab2('0x12')](_0x45c402);var _0x3c9ec1=https[_0xbab2('0x13')](_0x6b0502,function(_0x57b733){_0x57b733[_0xbab2('0x14')]('utf8');var _0x3db486='';_0x57b733['on']('data',function(_0x59a23f){_0x3db486+=_0x59a23f;});_0x57b733['on']('end',function(){if(_0x4d65bc){return _0x4d65bc[_0xbab2('0x15')](_0x57b733[_0xbab2('0x16')])[_0xbab2('0x17')](JSON[_0xbab2('0x18')](_0x3db486));}});});_0x3c9ec1['on'](_0xbab2('0x19'),function(_0x1c4c3e){if(_0x4d65bc){return _0x4d65bc[_0xbab2('0x15')](0x1f4)[_0xbab2('0x17')]({'errors':[{'message':_0xbab2('0x1a'),'type':_0xbab2('0x1b')}]});}});_0x3c9ec1[_0xbab2('0x1c')](_0x1102e2);_0x3c9ec1[_0xbab2('0x1d')]();}exports[_0xbab2('0x1e')]=openIssue;exports['send']=function(_0x5522c5,_0x5ca657){_0x5522c5[_0xbab2('0x1f')]['ip']=_0x5522c5[_0xbab2('0x20')][_0xbab2('0x21')]||_0x5522c5[_0xbab2('0x22')][_0xbab2('0x23')]||_0x5522c5[_0xbab2('0x24')]['remoteAddress']||_0x5522c5[_0xbab2('0x22')][_0xbab2('0x24')][_0xbab2('0x23')];return openIssue(_0x5522c5[_0xbab2('0x1f')],_0x5ca657);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4b49bee..c17496e 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 _0x750a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','util','express','Router'];(function(_0x3f6c2d,_0x343d5a){var _0x2bf9b3=function(_0x339041){while(--_0x339041){_0x3f6c2d['push'](_0x3f6c2d['shift']());}};_0x2bf9b3(++_0x343d5a);}(_0x750a,0x140));var _0xa750=function(_0x5eed63,_0x433df4){_0x5eed63=_0x5eed63-0x0;var _0x529db8=_0x750a[_0x5eed63];return _0x529db8;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['describe']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0xe')]('/',auth['isAuthenticated'](),controller[_0xa750('0xf')]);router[_0xa750('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa750('0x11')]);router['delete'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['destroy']);module[_0xa750('0x12')]=router; \ No newline at end of file +var _0x6c76=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6c76,0x184));var _0x66c7=function(_0x6bbb39,_0x5a6ef9){_0x6bbb39=_0x6bbb39-0x0;var _0x2ead1a=_0x6c76[_0x6bbb39];return _0x2ead1a;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0xc')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xd')]);router['put'](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xf')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1ce8b50..9e03c26 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x37460d,_0x5610bb){_0x37460d=_0x37460d-0x0;var _0x6eedf8=_0x7a54[_0x37460d];return _0x6eedf8;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x51bbff,_0x20f128){_0x51bbff=_0x51bbff-0x0;var _0x274e22=_0x7a54[_0x51bbff];return _0x274e22;};'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 06d36e8..7ee6dc0 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 _0x972c=['attributes','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','intersection','fields'];(function(_0x13e274,_0x5c1212){var _0x312457=function(_0x3f589f){while(--_0x3f589f){_0x13e274['push'](_0x13e274['shift']());}};_0x312457(++_0x5c1212);}(_0x972c,0xf2));var _0xc972=function(_0xfa4d3c,_0xb566dc){_0xfa4d3c=_0xfa4d3c-0x0;var _0x571fe4=_0x972c[_0xfa4d3c];return _0x571fe4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc972('0x0'));var jsonpatch=require(_0xc972('0x1'));var rp=require('request-promise');var moment=require(_0xc972('0x2'));var BPromise=require(_0xc972('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc972('0x4'));var sox=require(_0xc972('0x5'));var csv=require(_0xc972('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc972('0x7'));var _=require('lodash');var squel=require(_0xc972('0x8'));var crypto=require(_0xc972('0x9'));var jsforce=require(_0xc972('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc972('0xb'));var Redis=require('ioredis');var authService=require(_0xc972('0xc'));var qs=require(_0xc972('0xd'));var as=require(_0xc972('0xe'));var hardwareService=require(_0xc972('0xf'));var logger=require(_0xc972('0x10'))(_0xc972('0x11'));var utils=require(_0xc972('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc972('0x13'));var db=require(_0xc972('0x14'))['db'];function respondWithStatusCode(_0x27851c,_0x5829ab){_0x5829ab=_0x5829ab||0xcc;return function(_0x3623ca){if(_0x3623ca){return _0x27851c[_0xc972('0x15')](_0x5829ab);}return _0x27851c[_0xc972('0x16')](_0x5829ab)['end']();};}function respondWithResult(_0x37786e,_0x298f92){_0x298f92=_0x298f92||0xc8;return function(_0x3aa39d){if(_0x3aa39d){return _0x37786e[_0xc972('0x16')](_0x298f92)['json'](_0x3aa39d);}};}function respondWithFilteredResult(_0x665f8f,_0x3d519e){return function(_0x2b20d2){if(_0x2b20d2){var _0x341564=typeof _0x3d519e[_0xc972('0x17')]===_0xc972('0x18')&&typeof _0x3d519e[_0xc972('0x19')]===_0xc972('0x18');var _0x3a7521=_0x2b20d2[_0xc972('0x1a')];var _0x2bfe0e=_0x341564?0x0:_0x3d519e[_0xc972('0x17')];var _0x214417=_0x341564?_0x2b20d2[_0xc972('0x1a')]:_0x3d519e[_0xc972('0x17')]+_0x3d519e[_0xc972('0x19')];var _0x4a2b5f;if(_0x214417>=_0x3a7521){_0x214417=_0x3a7521;_0x4a2b5f=0xc8;}else{_0x4a2b5f=0xce;}_0x665f8f[_0xc972('0x16')](_0x4a2b5f);return _0x665f8f[_0xc972('0x1b')](_0xc972('0x1c'),_0x2bfe0e+'-'+_0x214417+'/'+_0x3a7521)[_0xc972('0x1d')](_0x2b20d2);}return null;};}function patchUpdates(_0x486340){return function(_0x5e1b06){try{jsonpatch[_0xc972('0x1e')](_0x5e1b06,_0x486340,!![]);}catch(_0x3c4b7c){return BPromise['reject'](_0x3c4b7c);}return _0x5e1b06[_0xc972('0x1f')]();};}function saveUpdates(_0x3fdacf,_0x10c6ce){return function(_0x331338){if(_0x331338){return _0x331338[_0xc972('0x20')](_0x3fdacf)[_0xc972('0x21')](function(_0x59cae4){return _0x59cae4;});}return null;};}function removeEntity(_0x11a9f1,_0x5d11e4){return function(_0x5f0c94){if(_0x5f0c94){return _0x5f0c94[_0xc972('0x22')]()[_0xc972('0x21')](function(){_0x11a9f1[_0xc972('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9bed,_0x47332e){return function(_0xf115da){if(!_0xf115da){_0x1f9bed[_0xc972('0x15')](0x194);}return _0xf115da;};}function handleError(_0x228f99,_0x2497d9){_0x2497d9=_0x2497d9||0x1f4;return function(_0x33ced1){logger[_0xc972('0x23')](_0x33ced1[_0xc972('0x24')]);if(_0x33ced1[_0xc972('0x25')]){delete _0x33ced1[_0xc972('0x25')];}_0x228f99[_0xc972('0x16')](_0x2497d9)[_0xc972('0x26')](_0x33ced1);};}exports[_0xc972('0x27')]=function(_0x5ad71d,_0x1203a8){var _0x481026={},_0x164d52={},_0x4efef1={'count':0x0,'rows':[]};var _0x26aa4c=_[_0xc972('0x28')](db[_0xc972('0x29')][_0xc972('0x2a')],function(_0x166779){return{'name':_0x166779['fieldName'],'type':_0x166779[_0xc972('0x2b')][_0xc972('0x2c')]};});_0x164d52[_0xc972('0x2d')]=_[_0xc972('0x28')](_0x26aa4c,'name');_0x164d52[_0xc972('0x2e')]=_[_0xc972('0x2f')](_0x5ad71d['query']);_0x164d52['filters']=_['intersection'](_0x164d52['model'],_0x164d52[_0xc972('0x2e')]);_0x481026['attributes']=_[_0xc972('0x30')](_0x164d52['model'],qs['fields'](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x31')]));_0x481026[_0xc972('0x32')]=_0x481026['attributes'][_0xc972('0x33')]?_0x481026['attributes']:_0x164d52[_0xc972('0x2d')];if(!_0x5ad71d[_0xc972('0x2e')]['hasOwnProperty'](_0xc972('0x34'))){_0x481026[_0xc972('0x19')]=qs[_0xc972('0x19')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x19')]);_0x481026[_0xc972('0x17')]=qs[_0xc972('0x17')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x17')]);}_0x481026[_0xc972('0x35')]=qs[_0xc972('0x36')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x36')]);_0x481026[_0xc972('0x37')]=qs[_0xc972('0x38')](_[_0xc972('0x39')](_0x5ad71d[_0xc972('0x2e')],_0x164d52[_0xc972('0x38')]),_0x26aa4c);if(_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3a')]){_0x481026[_0xc972('0x37')]=_['merge'](_0x481026[_0xc972('0x37')],{'$or':_[_0xc972('0x28')](_0x26aa4c,function(_0x4880f7){if(_0x4880f7[_0xc972('0x2b')]!==_0xc972('0x3b')){var _0x255fcf={};_0x255fcf[_0x4880f7[_0xc972('0x25')]]={'$like':'%'+_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3a')]+'%'};return _0x255fcf;}})});}_0x481026=_[_0xc972('0x3c')]({},_0x481026,_0x5ad71d[_0xc972('0x3d')]);var _0x4bb412={'where':_0x481026[_0xc972('0x37')]};return db[_0xc972('0x29')]['count'](_0x4bb412)[_0xc972('0x21')](function(_0x1bc249){_0x4efef1[_0xc972('0x1a')]=_0x1bc249;if(_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3e')]){_0x481026['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc972('0x3f')](_0x481026);})[_0xc972('0x21')](function(_0x483f11){_0x4efef1[_0xc972('0x40')]=_0x483f11;return _0x4efef1;})[_0xc972('0x21')](respondWithFilteredResult(_0x1203a8,_0x481026))[_0xc972('0x41')](handleError(_0x1203a8,null));};exports[_0xc972('0x42')]=function(_0x3edc1e,_0x498a43){var _0x1f0d3f={'raw':!![],'where':{'id':_0x3edc1e[_0xc972('0x43')]['id']}},_0x21830b={};_0x21830b[_0xc972('0x2d')]=_[_0xc972('0x2f')](db[_0xc972('0x29')][_0xc972('0x2a')]);_0x21830b[_0xc972('0x2e')]=_[_0xc972('0x2f')](_0x3edc1e['query']);_0x21830b[_0xc972('0x38')]=_[_0xc972('0x30')](_0x21830b['model'],_0x21830b['query']);_0x1f0d3f['attributes']=_['intersection'](_0x21830b[_0xc972('0x2d')],qs[_0xc972('0x31')](_0x3edc1e[_0xc972('0x2e')][_0xc972('0x31')]));_0x1f0d3f[_0xc972('0x32')]=_0x1f0d3f[_0xc972('0x32')][_0xc972('0x33')]?_0x1f0d3f[_0xc972('0x32')]:_0x21830b['model'];if(_0x3edc1e[_0xc972('0x2e')][_0xc972('0x3e')]){_0x1f0d3f[_0xc972('0x44')]=[{'all':!![]}];}_0x1f0d3f=_[_0xc972('0x3c')]({},_0x1f0d3f,_0x3edc1e[_0xc972('0x3d')]);return db[_0xc972('0x29')][_0xc972('0x45')](_0x1f0d3f)['then'](handleEntityNotFound(_0x498a43,null))[_0xc972('0x21')](respondWithResult(_0x498a43,null))[_0xc972('0x41')](handleError(_0x498a43,null));};exports['create']=function(_0x48bcbf,_0x215e81){return db['JscriptyAnswerReport'][_0xc972('0x46')](_0x48bcbf[_0xc972('0x47')],{})[_0xc972('0x21')](respondWithResult(_0x215e81,0xc9))[_0xc972('0x41')](handleError(_0x215e81,null));};exports[_0xc972('0x20')]=function(_0x2e921d,_0x2e2afe){if(_0x2e921d['body']['id']){delete _0x2e921d[_0xc972('0x47')]['id'];}return db[_0xc972('0x29')]['find']({'where':{'id':_0x2e921d[_0xc972('0x43')]['id']}})[_0xc972('0x21')](handleEntityNotFound(_0x2e2afe,null))[_0xc972('0x21')](saveUpdates(_0x2e921d[_0xc972('0x47')],null))['then'](respondWithResult(_0x2e2afe,null))['catch'](handleError(_0x2e2afe,null));};exports[_0xc972('0x22')]=function(_0x384ff4,_0x398be7){return db[_0xc972('0x29')][_0xc972('0x45')]({'where':{'id':_0x384ff4[_0xc972('0x43')]['id']}})['then'](handleEntityNotFound(_0x398be7,null))[_0xc972('0x21')](removeEntity(_0x398be7,null))[_0xc972('0x41')](handleError(_0x398be7,null));};exports[_0xc972('0x48')]=function(_0x52f9fd,_0x35fadd){return db[_0xc972('0x29')]['describe']()['then'](respondWithResult(_0x35fadd,null))[_0xc972('0x41')](handleError(_0x35fadd,null));}; \ No newline at end of file +var _0x98a8=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x529c88,_0x2933e2){var _0x1db038=function(_0x3b011e){while(--_0x3b011e){_0x529c88['push'](_0x529c88['shift']());}};_0x1db038(++_0x2933e2);}(_0x98a8,0x12c));var _0x898a=function(_0x4c8a59,_0x248c0d){_0x4c8a59=_0x4c8a59-0x0;var _0x592ddf=_0x98a8[_0x4c8a59];return _0x592ddf;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x2a')](_0x62fe93,_0x898a('0x27'));_0x47f1ed['query']=_[_0x898a('0x31')](_0xd31922[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0x47f1ed[_0x898a('0x30')],_0x47f1ed['query']);_0x4b3e68['attributes']=_[_0x898a('0x34')](_0x47f1ed[_0x898a('0x30')],qs[_0x898a('0x35')](_0xd31922['query'][_0x898a('0x35')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x37')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922[_0x898a('0x32')][_0x898a('0x38')]('nolimit')){_0x4b3e68[_0x898a('0x39')]=qs['limit'](_0xd31922['query'][_0x898a('0x39')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68['order']=qs[_0x898a('0x3a')](_0xd31922[_0x898a('0x32')][_0x898a('0x3a')]);_0x4b3e68['where']=qs['filters'](_['pick'](_0xd31922[_0x898a('0x32')],_0x47f1ed[_0x898a('0x33')]),_0x62fe93);if(_0xd31922['query'][_0x898a('0x3b')]){_0x4b3e68[_0x898a('0x3c')]=_[_0x898a('0x3d')](_0x4b3e68[_0x898a('0x3c')],{'$or':_['map'](_0x62fe93,function(_0x4b07bc){if(_0x4b07bc[_0x898a('0x2e')]!==_0x898a('0x3e')){var _0x4d486b={};_0x4d486b[_0x4b07bc['name']]={'$like':'%'+_0xd31922[_0x898a('0x32')][_0x898a('0x3b')]+'%'};return _0x4d486b;}})});}_0x4b3e68=_[_0x898a('0x3d')]({},_0x4b3e68,_0xd31922[_0x898a('0x3f')]);var _0x51681f={'where':_0x4b3e68[_0x898a('0x3c')]};return db[_0x898a('0x2b')]['count'](_0x51681f)['then'](function(_0x48cc85){_0xe9c33d[_0x898a('0x1d')]=_0x48cc85;if(_0xd31922[_0x898a('0x32')][_0x898a('0x40')]){_0x4b3e68[_0x898a('0x41')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x42')](_0x4b3e68);})[_0x898a('0x23')](function(_0x1432ec){_0xe9c33d[_0x898a('0x43')]=_0x1432ec;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x44')](handleError(_0x58149d,null));};exports[_0x898a('0x45')]=function(_0x32db83,_0x40f037){var _0x21f307={'raw':!![],'where':{'id':_0x32db83[_0x898a('0x46')]['id']}},_0x4c8628={};_0x4c8628[_0x898a('0x30')]=_[_0x898a('0x31')](db['JscriptyAnswerReport'][_0x898a('0x2c')]);_0x4c8628[_0x898a('0x32')]=_[_0x898a('0x31')](_0x32db83[_0x898a('0x32')]);_0x4c8628[_0x898a('0x33')]=_[_0x898a('0x34')](_0x4c8628[_0x898a('0x30')],_0x4c8628[_0x898a('0x32')]);_0x21f307['attributes']=_[_0x898a('0x34')](_0x4c8628[_0x898a('0x30')],qs[_0x898a('0x35')](_0x32db83[_0x898a('0x32')]['fields']));_0x21f307[_0x898a('0x36')]=_0x21f307[_0x898a('0x36')]['length']?_0x21f307[_0x898a('0x36')]:_0x4c8628['model'];if(_0x32db83[_0x898a('0x32')]['includeAll']){_0x21f307['include']=[{'all':!![]}];}_0x21f307=_[_0x898a('0x3d')]({},_0x21f307,_0x32db83['options']);return db[_0x898a('0x2b')][_0x898a('0x47')](_0x21f307)['then'](handleEntityNotFound(_0x40f037,null))[_0x898a('0x23')](respondWithResult(_0x40f037,null))[_0x898a('0x44')](handleError(_0x40f037,null));};exports['create']=function(_0x2cf8a6,_0x199437){return db[_0x898a('0x2b')][_0x898a('0x48')](_0x2cf8a6['body'],{})[_0x898a('0x23')](respondWithResult(_0x199437,0xc9))[_0x898a('0x44')](handleError(_0x199437,null));};exports['update']=function(_0x25adcc,_0x1d8c16){if(_0x25adcc['body']['id']){delete _0x25adcc[_0x898a('0x49')]['id'];}return db['JscriptyAnswerReport'][_0x898a('0x47')]({'where':{'id':_0x25adcc[_0x898a('0x46')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x1d8c16,null))['then'](saveUpdates(_0x25adcc[_0x898a('0x49')],null))[_0x898a('0x23')](respondWithResult(_0x1d8c16,null))[_0x898a('0x44')](handleError(_0x1d8c16,null));};exports[_0x898a('0x24')]=function(_0x5a8a2c,_0x2a21ad){return db['JscriptyAnswerReport'][_0x898a('0x47')]({'where':{'id':_0x5a8a2c[_0x898a('0x46')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x2a21ad,null))['then'](removeEntity(_0x2a21ad,null))[_0x898a('0x44')](handleError(_0x2a21ad,null));};exports[_0x898a('0x4a')]=function(_0x195ac2,_0x5d325a){return db['JscriptyAnswerReport'][_0x898a('0x4a')]()[_0x898a('0x23')](respondWithResult(_0x5d325a,null))[_0x898a('0x44')](handleError(_0x5d325a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 30336e8..a6810f8 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 _0x5956=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x3ac6b9,_0x83ce3a){var _0x564984=function(_0x721956){while(--_0x721956){_0x3ac6b9['push'](_0x3ac6b9['shift']());}};_0x564984(++_0x83ce3a);}(_0x5956,0xa0));var _0x6595=function(_0x582bac,_0x503e30){_0x582bac=_0x582bac-0x0;var _0x4a1b36=_0x5956[_0x582bac];return _0x4a1b36;};'use strict';var _=require(_0x6595('0x0'));var util=require(_0x6595('0x1'));var logger=require(_0x6595('0x2'))('api');var moment=require(_0x6595('0x3'));var BPromise=require(_0x6595('0x4'));var rp=require(_0x6595('0x5'));var fs=require('fs');var path=require(_0x6595('0x6'));var rimraf=require(_0x6595('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x47b783,_0x5d0f95){return _0x47b783['define'](_0x6595('0x8'),attributes,{'tableName':_0x6595('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x799f=['request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util','api','moment','bluebird'];(function(_0x5b2568,_0x186e15){var _0xa533a9=function(_0x432814){while(--_0x432814){_0x5b2568['push'](_0x5b2568['shift']());}};_0xa533a9(++_0x186e15);}(_0x799f,0xd8));var _0xf799=function(_0x87d16a,_0x3b425f){_0x87d16a=_0x87d16a-0x0;var _0x233098=_0x799f[_0x87d16a];return _0x233098;};'use strict';var _=require('lodash');var util=require(_0xf799('0x0'));var logger=require('../../config/logger')(_0xf799('0x1'));var moment=require(_0xf799('0x2'));var BPromise=require(_0xf799('0x3'));var rp=require(_0xf799('0x4'));var fs=require('fs');var path=require(_0xf799('0x5'));var rimraf=require('rimraf');var config=require(_0xf799('0x6'));var attributes=require(_0xf799('0x7'));module[_0xf799('0x8')]=function(_0x412757,_0x3567c1){return _0x412757[_0xf799('0x9')](_0xf799('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 5a7f760..bda72d2 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 _0x385d=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1215d7,_0x2fed53){var _0x127167=function(_0x3b7a46){while(--_0x3b7a46){_0x1215d7['push'](_0x1215d7['shift']());}};_0x127167(++_0x2fed53);}(_0x385d,0x1e8));var _0xd385=function(_0x512335,_0x5414b6){_0x512335=_0x512335-0x0;var _0x40ecfd=_0x385d[_0x512335];return _0x40ecfd;};'use strict';var _=require('lodash');var util=require(_0xd385('0x0'));var moment=require(_0xd385('0x1'));var BPromise=require(_0xd385('0x2'));var rs=require(_0xd385('0x3'));var fs=require('fs');var Redis=require(_0xd385('0x4'));var db=require(_0xd385('0x5'))['db'];var utils=require(_0xd385('0x6'));var logger=require(_0xd385('0x7'))(_0xd385('0x8'));var config=require(_0xd385('0x9'));var jayson=require(_0xd385('0xa'));var client=jayson[_0xd385('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2aad,_0x463a0c,_0x201a35){return new BPromise(function(_0x2f95f4,_0x19f167){return client[_0xd385('0xc')](_0x3a2aad,_0x201a35)['then'](function(_0x398493){logger[_0xd385('0xd')](_0xd385('0xe'),_0x463a0c,_0xd385('0xf'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x463a0c,_0xd385('0xf'),JSON[_0xd385('0x10')](_0x398493));if(_0x398493[_0xd385('0x11')]){if(_0x398493[_0xd385('0x11')][_0xd385('0x12')]===0x1f4){logger[_0xd385('0x11')](_0xd385('0xe'),_0x463a0c,_0x398493['error'][_0xd385('0x13')]);return _0x19f167(_0x398493['error'][_0xd385('0x13')]);}logger[_0xd385('0x11')](_0xd385('0xe'),_0x463a0c,_0x398493[_0xd385('0x11')][_0xd385('0x13')]);return _0x2f95f4(_0x398493[_0xd385('0x11')][_0xd385('0x13')]);}else{logger[_0xd385('0xd')](_0xd385('0xe'),_0x463a0c,_0xd385('0xf'));_0x2f95f4(_0x398493[_0xd385('0x14')]['message']);}})[_0xd385('0x15')](function(_0x62537d){logger[_0xd385('0x11')](_0xd385('0xe'),_0x463a0c,_0x62537d);_0x19f167(_0x62537d);});});} \ No newline at end of file +var _0x9d4c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x130a43,_0xe13e54){var _0x5db864=function(_0x4f6abc){while(--_0x4f6abc){_0x130a43['push'](_0x130a43['shift']());}};_0x5db864(++_0xe13e54);}(_0x9d4c,0x84));var _0xc9d4=function(_0x175ea7,_0x37a68e){_0x175ea7=_0x175ea7-0x0;var _0x4b1437=_0x9d4c[_0x175ea7];return _0x4b1437;};'use strict';var _=require('lodash');var util=require(_0xc9d4('0x0'));var moment=require(_0xc9d4('0x1'));var BPromise=require(_0xc9d4('0x2'));var rs=require(_0xc9d4('0x3'));var fs=require('fs');var Redis=require(_0xc9d4('0x4'));var db=require(_0xc9d4('0x5'))['db'];var utils=require(_0xc9d4('0x6'));var logger=require(_0xc9d4('0x7'))(_0xc9d4('0x8'));var config=require(_0xc9d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc9d4('0xa')][_0xc9d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5983c2,_0x2e1d2b,_0x589d56){return new BPromise(function(_0x23612a,_0x9a0253){return client['request'](_0x5983c2,_0x589d56)[_0xc9d4('0xc')](function(_0x5befbd){logger['info'](_0xc9d4('0xd'),_0x2e1d2b,_0xc9d4('0xe'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2e1d2b,'request\x20sent',JSON[_0xc9d4('0xf')](_0x5befbd));if(_0x5befbd['error']){if(_0x5befbd[_0xc9d4('0x10')][_0xc9d4('0x11')]===0x1f4){logger['error'](_0xc9d4('0xd'),_0x2e1d2b,_0x5befbd[_0xc9d4('0x10')][_0xc9d4('0x12')]);return _0x9a0253(_0x5befbd[_0xc9d4('0x10')]['message']);}logger[_0xc9d4('0x10')](_0xc9d4('0xd'),_0x2e1d2b,_0x5befbd['error'][_0xc9d4('0x12')]);return _0x23612a(_0x5befbd[_0xc9d4('0x10')][_0xc9d4('0x12')]);}else{logger[_0xc9d4('0x13')](_0xc9d4('0xd'),_0x2e1d2b,_0xc9d4('0xe'));_0x23612a(_0x5befbd[_0xc9d4('0x14')][_0xc9d4('0x12')]);}})[_0xc9d4('0x15')](function(_0x439cf6){logger['error'](_0xc9d4('0xd'),_0x2e1d2b,_0x439cf6);_0x9a0253(_0x439cf6);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ca7f542..5fbed89 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 _0x27e2=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x27e2,0x10a));var _0x227e=function(_0x5929a5,_0x38bd2a){_0x5929a5=_0x5929a5-0x0;var _0x1d3f2b=_0x27e2[_0x5929a5];return _0x1d3f2b;};'use strict';var multer=require(_0x227e('0x0'));var util=require(_0x227e('0x1'));var path=require(_0x227e('0x2'));var timeout=require(_0x227e('0x3'));var express=require('express');var router=express[_0x227e('0x4')]();var fs_extra=require(_0x227e('0x5'));var auth=require(_0x227e('0x6'));var interaction=require(_0x227e('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x227e('0x8')]('/',auth[_0x227e('0x9')](),controller['index']);router[_0x227e('0x8')](_0x227e('0xa'),auth['isAuthenticated'](),controller[_0x227e('0xb')]);router[_0x227e('0x8')](_0x227e('0xc'),auth[_0x227e('0x9')](),controller[_0x227e('0xd')]);router[_0x227e('0x8')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x227e('0x8')](_0x227e('0xe'),auth['isAuthenticated'](),timeout(_0x227e('0xf')),controller[_0x227e('0x10')]);router[_0x227e('0x11')]('/',auth[_0x227e('0x9')](),controller[_0x227e('0x12')]);router[_0x227e('0x11')]('/:id/clone',auth[_0x227e('0x9')](),controller['clone']);router['put']('/:id',auth[_0x227e('0x9')](),controller[_0x227e('0x13')]);router[_0x227e('0x14')](_0x227e('0xa'),auth['isAuthenticated'](),controller[_0x227e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6497=['show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','update','delete','destroy','exports','util','connect-timeout','express','Router','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id'];(function(_0x51b5a6,_0x1a6077){var _0x4e6728=function(_0x33003c){while(--_0x33003c){_0x51b5a6['push'](_0x51b5a6['shift']());}};_0x4e6728(++_0x1a6077);}(_0x6497,0x167));var _0x7649=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x6497[_0x2cc569];return _0x1bfc2e;};'use strict';var multer=require('multer');var util=require(_0x7649('0x0'));var path=require('path');var timeout=require(_0x7649('0x1'));var express=require(_0x7649('0x2'));var router=express[_0x7649('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7649('0x4'));var controller=require(_0x7649('0x5'));router[_0x7649('0x6')]('/',auth[_0x7649('0x7')](),controller['index']);router['get'](_0x7649('0x8'),auth[_0x7649('0x7')](),controller[_0x7649('0x9')]);router[_0x7649('0x6')](_0x7649('0xa'),auth[_0x7649('0x7')](),controller[_0x7649('0xb')]);router[_0x7649('0x6')](_0x7649('0xc'),auth['isAuthenticated'](),controller[_0x7649('0xd')]);router[_0x7649('0x6')](_0x7649('0xe'),auth[_0x7649('0x7')](),timeout('30s'),controller[_0x7649('0xf')]);router[_0x7649('0x10')]('/',auth['isAuthenticated'](),controller[_0x7649('0x11')]);router['post'](_0x7649('0x12'),auth['isAuthenticated'](),controller['clone']);router['put']('/:id',auth[_0x7649('0x7')](),controller[_0x7649('0x13')]);router[_0x7649('0x14')](_0x7649('0x8'),auth['isAuthenticated'](),controller[_0x7649('0x15')]);module[_0x7649('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9c782af..1f0ade8 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 _0xfdae=['getDataValue','BOOLEAN','lodash','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x404a58,_0x211fc8){var _0x48d345=function(_0x110c58){while(--_0x110c58){_0x404a58['push'](_0x404a58['shift']());}};_0x48d345(++_0x211fc8);}(_0xfdae,0xaa));var _0xefda=function(_0x7f606f,_0x1e46c0){_0x7f606f=_0x7f606f-0x0;var _0x469d9a=_0xfdae[_0x7f606f];return _0x469d9a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xefda('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xefda('0x1')],'unique':_0xefda('0x2')},'description':{'type':Sequelize[_0xefda('0x1')]},'formData':{'type':Sequelize['TEXT'](_0xefda('0x3')),'set':function(_0x4735c5){if(_[_0xefda('0x4')](_0x4735c5)){this[_0xefda('0x5')](_0xefda('0x6'),JSON[_0xefda('0x7')](_0x4735c5));}else if(_[_0xefda('0x8')](_0x4735c5)){this[_0xefda('0x5')]('formData',_0x4735c5);}else{this['setDataValue'](_0xefda('0x6'),util['format'](_0xefda('0x9'),this[_0xefda('0xa')](_0xefda('0x2'))||'',this[_0xefda('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xefda('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5d74=['description','BOOLEAN','sequelize','util','STRING','name','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x594307,_0xc3a925){var _0x5ca768=function(_0x422ecf){while(--_0x422ecf){_0x594307['push'](_0x594307['shift']());}};_0x5ca768(++_0xc3a925);}(_0x5d74,0x1af));var _0x45d7=function(_0x23188b,_0x269b20){_0x23188b=_0x23188b-0x0;var _0x38d472=_0x5d74[_0x23188b];return _0x38d472;};'use strict';var Sequelize=require(_0x45d7('0x0'));var _=require('lodash');var util=require(_0x45d7('0x1'));module['exports']={'name':{'type':Sequelize[_0x45d7('0x2')],'unique':_0x45d7('0x3')},'description':{'type':Sequelize[_0x45d7('0x2')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0xafbe91){if(_[_0x45d7('0x4')](_0xafbe91)){this[_0x45d7('0x5')]('formData',JSON['stringify'](_0xafbe91));}else if(_[_0x45d7('0x6')](_0xafbe91)){this[_0x45d7('0x5')](_0x45d7('0x7'),_0xafbe91);}else{this[_0x45d7('0x5')](_0x45d7('0x7'),util[_0x45d7('0x8')](_0x45d7('0x9'),this[_0x45d7('0xa')](_0x45d7('0x3'))||'',this[_0x45d7('0xa')](_0x45d7('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x45d7('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x45d7('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c1390d0..c1ef267 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 _0x4b0f=['omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','where','ProjectId','filter','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','Content-type','download','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','error','clone','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x2e5f03,_0x45b348){_0x2e5f03=_0x2e5f03-0x0;var _0x39c200=_0x4b0f[_0x2e5f03];return _0x39c200;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4b0('0x0'));var zipdir=require(_0xf4b0('0x1'));var jsonpatch=require(_0xf4b0('0x2'));var rp=require('request-promise');var moment=require(_0xf4b0('0x3'));var BPromise=require(_0xf4b0('0x4'));var Mustache=require(_0xf4b0('0x5'));var util=require(_0xf4b0('0x6'));var path=require(_0xf4b0('0x7'));var sox=require(_0xf4b0('0x8'));var csv=require(_0xf4b0('0x9'));var ejs=require(_0xf4b0('0xa'));var fs=require('fs');var fs_extra=require(_0xf4b0('0xb'));var _=require(_0xf4b0('0xc'));var squel=require(_0xf4b0('0xd'));var crypto=require(_0xf4b0('0xe'));var jsforce=require(_0xf4b0('0xf'));var deskjs=require(_0xf4b0('0x10'));var toCsv=require(_0xf4b0('0x9'));var querystring=require(_0xf4b0('0x11'));var Papa=require('papaparse');var Redis=require(_0xf4b0('0x12'));var authService=require(_0xf4b0('0x13'));var qs=require(_0xf4b0('0x14'));var as=require(_0xf4b0('0x15'));var hardwareService=require(_0xf4b0('0x16'));var logger=require(_0xf4b0('0x17'))(_0xf4b0('0x18'));var utils=require(_0xf4b0('0x19'));var config=require(_0xf4b0('0x1a'));var licenseUtil=require(_0xf4b0('0x1b'));var db=require(_0xf4b0('0x1c'))['db'];function respondWithStatusCode(_0x40a3fb,_0x3c594c){_0x3c594c=_0x3c594c||0xcc;return function(_0x12480f){if(_0x12480f){return _0x40a3fb[_0xf4b0('0x1d')](_0x3c594c);}return _0x40a3fb[_0xf4b0('0x1e')](_0x3c594c)[_0xf4b0('0x1f')]();};}function respondWithResult(_0x21fe78,_0x3aa005){_0x3aa005=_0x3aa005||0xc8;return function(_0x38f1b4){if(_0x38f1b4){return _0x21fe78[_0xf4b0('0x1e')](_0x3aa005)[_0xf4b0('0x20')](_0x38f1b4);}};}function respondWithFilteredResult(_0x498d8a,_0x2f2a7a){return function(_0x19229f){if(_0x19229f){var _0x22173d=typeof _0x2f2a7a['offset']===_0xf4b0('0x21')&&typeof _0x2f2a7a[_0xf4b0('0x22')]===_0xf4b0('0x21');var _0x52312c=_0x19229f[_0xf4b0('0x23')];var _0x390dbd=_0x22173d?0x0:_0x2f2a7a[_0xf4b0('0x24')];var _0x543c88=_0x22173d?_0x19229f['count']:_0x2f2a7a[_0xf4b0('0x24')]+_0x2f2a7a[_0xf4b0('0x22')];var _0x4f1093;if(_0x543c88>=_0x52312c){_0x543c88=_0x52312c;_0x4f1093=0xc8;}else{_0x4f1093=0xce;}_0x498d8a['status'](_0x4f1093);return _0x498d8a[_0xf4b0('0x25')](_0xf4b0('0x26'),_0x390dbd+'-'+_0x543c88+'/'+_0x52312c)[_0xf4b0('0x20')](_0x19229f);}return null;};}function patchUpdates(_0x4e65cd){return function(_0x3a0b8c){try{jsonpatch[_0xf4b0('0x27')](_0x3a0b8c,_0x4e65cd,!![]);}catch(_0x20ecd9){return BPromise[_0xf4b0('0x28')](_0x20ecd9);}return _0x3a0b8c[_0xf4b0('0x29')]();};}function saveUpdates(_0x2fc6a2,_0x221b1d){return function(_0x4df2b4){if(_0x4df2b4){return _0x4df2b4[_0xf4b0('0x2a')](_0x2fc6a2)[_0xf4b0('0x2b')](function(_0x284809){return _0x284809;});}return null;};}function removeEntity(_0x43b1ac,_0x2670af){return function(_0x338975){if(_0x338975){return _0x338975[_0xf4b0('0x2c')]()[_0xf4b0('0x2b')](function(){var _0x4a0da1=_0x338975[_0xf4b0('0x2d')]({'plain':!![]});var _0x4c9d3c=_0xf4b0('0x2e');return db[_0xf4b0('0x2f')][_0xf4b0('0x2c')]({'where':{'type':_0x4c9d3c,'resourceId':_0x4a0da1['id']}})[_0xf4b0('0x2b')](function(){return _0x338975;});})[_0xf4b0('0x2b')](function(){_0x43b1ac[_0xf4b0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259106,_0x3594d3){return function(_0xcf121){if(!_0xcf121){_0x259106['sendStatus'](0x194);}return _0xcf121;};}function handleError(_0x2d9376,_0x17a14b){_0x17a14b=_0x17a14b||0x1f4;return function(_0x632871){logger['error'](_0x632871[_0xf4b0('0x30')]);if(_0x632871[_0xf4b0('0x31')]){delete _0x632871[_0xf4b0('0x31')];}_0x2d9376[_0xf4b0('0x1e')](_0x17a14b)[_0xf4b0('0x32')](_0x632871);};}exports[_0xf4b0('0x33')]=function(_0xd94c81,_0x347230){var _0x59524e={},_0x8b4528={},_0x1c2550={'count':0x0,'rows':[]};var _0x7f39a9=_[_0xf4b0('0x34')](db[_0xf4b0('0x35')][_0xf4b0('0x36')],function(_0x360e63){return{'name':_0x360e63[_0xf4b0('0x37')],'type':_0x360e63[_0xf4b0('0x38')][_0xf4b0('0x39')]};});_0x8b4528[_0xf4b0('0x3a')]=_[_0xf4b0('0x34')](_0x7f39a9,'name');_0x8b4528['query']=_[_0xf4b0('0x3b')](_0xd94c81[_0xf4b0('0x3c')]);_0x8b4528['filters']=_[_0xf4b0('0x3d')](_0x8b4528[_0xf4b0('0x3a')],_0x8b4528[_0xf4b0('0x3c')]);_0x59524e[_0xf4b0('0x3e')]=_[_0xf4b0('0x3d')](_0x8b4528[_0xf4b0('0x3a')],qs[_0xf4b0('0x3f')](_0xd94c81['query'][_0xf4b0('0x3f')]));_0x59524e['attributes']=_0x59524e[_0xf4b0('0x3e')][_0xf4b0('0x40')]?_0x59524e[_0xf4b0('0x3e')]:_0x8b4528[_0xf4b0('0x3a')];if(!_0xd94c81[_0xf4b0('0x3c')][_0xf4b0('0x41')](_0xf4b0('0x42'))){_0x59524e['limit']=qs[_0xf4b0('0x22')](_0xd94c81[_0xf4b0('0x3c')][_0xf4b0('0x22')]);_0x59524e['offset']=qs[_0xf4b0('0x24')](_0xd94c81[_0xf4b0('0x3c')][_0xf4b0('0x24')]);}_0x59524e[_0xf4b0('0x43')]=qs[_0xf4b0('0x44')](_0xd94c81[_0xf4b0('0x3c')][_0xf4b0('0x44')]);_0x59524e['where']=qs[_0xf4b0('0x45')](_[_0xf4b0('0x46')](_0xd94c81['query'],_0x8b4528[_0xf4b0('0x45')]),_0x7f39a9);if(_0xd94c81[_0xf4b0('0x3c')]['filter']){_0x59524e['where']=_[_0xf4b0('0x47')](_0x59524e['where'],{'$or':_[_0xf4b0('0x34')](_0x7f39a9,function(_0x50df3e){if(_0x50df3e['type']!==_0xf4b0('0x48')){var _0x207836={};_0x207836[_0x50df3e[_0xf4b0('0x31')]]={'$like':'%'+_0xd94c81[_0xf4b0('0x3c')]['filter']+'%'};return _0x207836;}})});}_0x59524e=_[_0xf4b0('0x47')]({},_0x59524e,_0xd94c81[_0xf4b0('0x49')]);var _0x49e9f9={'where':_0x59524e['where']};return db[_0xf4b0('0x35')][_0xf4b0('0x23')](_0x49e9f9)[_0xf4b0('0x2b')](function(_0x18ca44){_0x1c2550['count']=_0x18ca44;if(_0xd94c81[_0xf4b0('0x3c')][_0xf4b0('0x4a')]){_0x59524e[_0xf4b0('0x4b')]=[{'all':!![]}];}return db[_0xf4b0('0x35')][_0xf4b0('0x4c')](_0x59524e);})['then'](function(_0x428b83){_0x1c2550[_0xf4b0('0x4d')]=_0x428b83;return _0x1c2550;})['then'](respondWithFilteredResult(_0x347230,_0x59524e))[_0xf4b0('0x4e')](handleError(_0x347230,null));};exports[_0xf4b0('0x4f')]=function(_0x5c9688,_0x1cee3e){var _0x46794b={'raw':![],'where':{'id':_0x5c9688['params']['id']}},_0x327181={};_0x327181[_0xf4b0('0x3a')]=_['keys'](db[_0xf4b0('0x35')][_0xf4b0('0x36')]);_0x327181['query']=_['keys'](_0x5c9688[_0xf4b0('0x3c')]);_0x327181['filters']=_[_0xf4b0('0x3d')](_0x327181[_0xf4b0('0x3a')],_0x327181[_0xf4b0('0x3c')]);_0x46794b[_0xf4b0('0x3e')]=_[_0xf4b0('0x3d')](_0x327181[_0xf4b0('0x3a')],qs[_0xf4b0('0x3f')](_0x5c9688[_0xf4b0('0x3c')][_0xf4b0('0x3f')]));_0x46794b[_0xf4b0('0x3e')]=_0x46794b[_0xf4b0('0x3e')]['length']?_0x46794b['attributes']:_0x327181[_0xf4b0('0x3a')];if(_0x5c9688[_0xf4b0('0x3c')][_0xf4b0('0x4a')]){_0x46794b[_0xf4b0('0x4b')]=[{'all':!![]}];}_0x46794b=_[_0xf4b0('0x47')]({},_0x46794b,_0x5c9688['options']);return db['JscriptyProject'][_0xf4b0('0x50')](_0x46794b)[_0xf4b0('0x2b')](handleEntityNotFound(_0x1cee3e,null))[_0xf4b0('0x2b')](respondWithResult(_0x1cee3e,null))['catch'](handleError(_0x1cee3e,null));};exports['create']=function(_0x53615c,_0x3a6131){return db[_0xf4b0('0x35')]['create'](_0x53615c[_0xf4b0('0x51')],{})[_0xf4b0('0x2b')](function(_0x2e88b4){var _0x24849b=_0x53615c[_0xf4b0('0x52')][_0xf4b0('0x2d')]({'plain':!![]});if(!_0x24849b)throw new Error(_0xf4b0('0x53'));if(_0x24849b[_0xf4b0('0x54')]===_0xf4b0('0x52')){var _0x3fa9ad=_0x2e88b4['get']({'plain':!![]});var _0x45a6c6='Projects';return db[_0xf4b0('0x55')]['find']({'where':{'name':_0x45a6c6,'userProfileId':_0x24849b['userProfileId']},'raw':!![]})[_0xf4b0('0x2b')](function(_0x392b6f){if(_0x392b6f&&_0x392b6f[_0xf4b0('0x56')]===0x0){return db[_0xf4b0('0x2f')][_0xf4b0('0x57')]({'name':_0x3fa9ad[_0xf4b0('0x31')],'resourceId':_0x3fa9ad['id'],'type':_0x392b6f[_0xf4b0('0x31')],'sectionId':_0x392b6f['id']},{})[_0xf4b0('0x2b')](function(){return _0x2e88b4;});}else{return _0x2e88b4;}})[_0xf4b0('0x4e')](function(_0x15bdae){logger[_0xf4b0('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15bdae);throw _0x15bdae;});}return _0x2e88b4;})['then'](respondWithResult(_0x3a6131,0xc9))[_0xf4b0('0x4e')](handleError(_0x3a6131,null));};exports[_0xf4b0('0x59')]=function(_0x4b3c23,_0x23dd6f){var _0x4bb843={'where':{'id':_0x4b3c23[_0xf4b0('0x5a')]['id']}},_0x5e7922={};_0x5e7922['model']=_[_0xf4b0('0x3b')](db[_0xf4b0('0x35')]['rawAttributes']);_0x4bb843[_0xf4b0('0x3e')]=_['intersection'](_0x5e7922['model'],qs[_0xf4b0('0x3f')](_0x4b3c23[_0xf4b0('0x3c')][_0xf4b0('0x3f')]));_0x4bb843['attributes']=_0x4bb843['attributes'][_0xf4b0('0x40')]?_0x4bb843[_0xf4b0('0x3e')]:_0x5e7922[_0xf4b0('0x3a')];if(_0x4b3c23[_0xf4b0('0x3c')][_0xf4b0('0x4a')]){_0x4bb843[_0xf4b0('0x4b')]=[{'all':!![]}];}_0x4bb843=_['merge']({},_0x4bb843,_0x4b3c23[_0xf4b0('0x49')]);return db[_0xf4b0('0x35')][_0xf4b0('0x50')](_0x4bb843)['then'](handleEntityNotFound(_0x23dd6f,null))[_0xf4b0('0x2b')](function(_0x507985){if(_0x507985){var _0x5287e7=_0x507985[_0xf4b0('0x2d')]({'plain':!![]});_0x5287e7=qs[_0xf4b0('0x5b')](_0x5287e7,['id',_0xf4b0('0x5c'),_0xf4b0('0x5d')]);_0x4b3c23[_0xf4b0('0x51')]=_[_0xf4b0('0x5b')](_0x4b3c23[_0xf4b0('0x51')],['id','createdAt','updatedAt']);return db[_0xf4b0('0x35')][_0xf4b0('0x57')](_[_0xf4b0('0x47')](_0x5287e7,_0x4b3c23['body']),{'include':_0x4b3c23[_0xf4b0('0x3c')][_0xf4b0('0x4a')]?[{'all':!![]}]:undefined})[_0xf4b0('0x2b')](function(_0x323858){var _0x5598bd=_0x4b3c23[_0xf4b0('0x52')][_0xf4b0('0x2d')]({'plain':!![]});if(!_0x5598bd)throw new Error(_0xf4b0('0x53'));if(_0x5598bd['role']===_0xf4b0('0x52')){var _0x2bcd22=_0x323858[_0xf4b0('0x2d')]({'plain':!![]});var _0x36070a=_0xf4b0('0x2e');return db[_0xf4b0('0x55')][_0xf4b0('0x50')]({'where':{'name':_0x36070a,'userProfileId':_0x5598bd['userProfileId']},'raw':!![]})[_0xf4b0('0x2b')](function(_0x3279b0){if(_0x3279b0&&_0x3279b0[_0xf4b0('0x56')]===0x0){return db[_0xf4b0('0x2f')][_0xf4b0('0x57')]({'name':_0x2bcd22['name'],'resourceId':_0x2bcd22['id'],'type':_0x3279b0[_0xf4b0('0x31')],'sectionId':_0x3279b0['id']},{})[_0xf4b0('0x2b')](function(){return _0x323858;});}else{return _0x323858;}})[_0xf4b0('0x4e')](function(_0x425da7){logger['error'](_0xf4b0('0x5e'),_0x425da7);throw _0x425da7;});}return _0x323858;});}})[_0xf4b0('0x2b')](respondWithResult(_0x23dd6f,0xc9))[_0xf4b0('0x4e')](handleError(_0x23dd6f,null));};exports[_0xf4b0('0x2a')]=function(_0x3ce68d,_0x2320c0){if(_0x3ce68d[_0xf4b0('0x51')]['id']){delete _0x3ce68d['body']['id'];}return db[_0xf4b0('0x35')]['find']({'where':{'id':_0x3ce68d[_0xf4b0('0x5a')]['id']}})[_0xf4b0('0x2b')](handleEntityNotFound(_0x2320c0,null))[_0xf4b0('0x2b')](saveUpdates(_0x3ce68d['body'],null))[_0xf4b0('0x2b')](respondWithResult(_0x2320c0,null))[_0xf4b0('0x4e')](handleError(_0x2320c0,null));};exports['destroy']=function(_0x5cbdd2,_0x3f0db6){return db[_0xf4b0('0x35')][_0xf4b0('0x50')]({'where':{'id':_0x5cbdd2[_0xf4b0('0x5a')]['id']}})[_0xf4b0('0x2b')](handleEntityNotFound(_0x3f0db6,null))[_0xf4b0('0x2b')](removeEntity(_0x3f0db6,null))['catch'](handleError(_0x3f0db6,null));};exports[_0xf4b0('0x5f')]=function(_0x52756d,_0x375186,_0x3b9e42){var _0x3cd07c={'raw':!![],'where':{}};var _0x37f53c={};var _0x534ecd={'count':0x0,'rows':[]};return db[_0xf4b0('0x35')][_0xf4b0('0x60')]({'where':{'id':_0x52756d[_0xf4b0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x375186,null))[_0xf4b0('0x2b')](function(_0x219e51){if(_0x219e51){_0x37f53c['model']=_[_0xf4b0('0x3b')](db[_0xf4b0('0x61')][_0xf4b0('0x36')]);_0x37f53c[_0xf4b0('0x3c')]=_[_0xf4b0('0x3b')](_0x52756d['query']);_0x37f53c[_0xf4b0('0x45')]=_['intersection'](_0x37f53c[_0xf4b0('0x3a')],_0x37f53c[_0xf4b0('0x3c')]);_0x3cd07c[_0xf4b0('0x3e')]=_[_0xf4b0('0x3d')](_0x37f53c[_0xf4b0('0x3a')],qs[_0xf4b0('0x3f')](_0x52756d[_0xf4b0('0x3c')][_0xf4b0('0x3f')]));_0x3cd07c[_0xf4b0('0x3e')]=_0x3cd07c[_0xf4b0('0x3e')][_0xf4b0('0x40')]?_0x3cd07c['attributes']:_0x37f53c['model'];if(!_0x52756d[_0xf4b0('0x3c')][_0xf4b0('0x41')](_0xf4b0('0x42'))){_0x3cd07c[_0xf4b0('0x22')]=qs[_0xf4b0('0x22')](_0x52756d['query'][_0xf4b0('0x22')]);_0x3cd07c[_0xf4b0('0x24')]=qs[_0xf4b0('0x24')](_0x52756d[_0xf4b0('0x3c')][_0xf4b0('0x24')]);}_0x3cd07c[_0xf4b0('0x43')]=qs[_0xf4b0('0x44')](_0x52756d[_0xf4b0('0x3c')]['sort']);_0x3cd07c[_0xf4b0('0x62')]=qs[_0xf4b0('0x45')](_[_0xf4b0('0x46')](_0x52756d[_0xf4b0('0x3c')],_0x37f53c[_0xf4b0('0x45')]));_0x3cd07c[_0xf4b0('0x62')][_0xf4b0('0x63')]=_0x219e51['id'];if(_0x52756d[_0xf4b0('0x3c')][_0xf4b0('0x64')]){_0x3cd07c[_0xf4b0('0x62')]=_[_0xf4b0('0x47')](_0x3cd07c[_0xf4b0('0x62')],{'$or':_['map'](_0x3cd07c[_0xf4b0('0x3e')],function(_0x1e0440){var _0x46576a={};_0x46576a[_0x1e0440]={'$like':'%'+_0x52756d[_0xf4b0('0x3c')]['filter']+'%'};return _0x46576a;})});}_0x3cd07c=_[_0xf4b0('0x47')]({},_0x3cd07c,_0x52756d[_0xf4b0('0x49')]);return db[_0xf4b0('0x61')]['count']({'where':_0x3cd07c[_0xf4b0('0x62')]})['then'](function(_0x30e78e){_0x534ecd[_0xf4b0('0x23')]=_0x30e78e;if(_0x52756d[_0xf4b0('0x3c')][_0xf4b0('0x4a')]){_0x3cd07c[_0xf4b0('0x4b')]=[{'all':!![]}];}return db[_0xf4b0('0x61')][_0xf4b0('0x4c')](_0x3cd07c);})[_0xf4b0('0x2b')](function(_0xb6d148){_0x534ecd[_0xf4b0('0x4d')]=_0xb6d148;return _0x534ecd;});}})[_0xf4b0('0x2b')](respondWithFilteredResult(_0x375186,_0x3cd07c))[_0xf4b0('0x4e')](handleError(_0x375186,null));};exports[_0xf4b0('0x65')]=function(_0x147b8e,_0x3517a9,_0x238915){var _0x20f205={'raw':!![],'where':{}};var _0x3af379={};var _0x44c452={'count':0x0,'rows':[]};return db[_0xf4b0('0x35')][_0xf4b0('0x60')]({'where':{'id':_0x147b8e[_0xf4b0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3517a9,null))[_0xf4b0('0x2b')](function(_0x2366f4){if(_0x2366f4){_0x3af379[_0xf4b0('0x3a')]=_['keys'](db[_0xf4b0('0x66')][_0xf4b0('0x36')]);_0x3af379[_0xf4b0('0x3c')]=_[_0xf4b0('0x3b')](_0x147b8e[_0xf4b0('0x3c')]);_0x3af379[_0xf4b0('0x45')]=_[_0xf4b0('0x3d')](_0x3af379[_0xf4b0('0x3a')],_0x3af379[_0xf4b0('0x3c')]);_0x20f205['attributes']=_[_0xf4b0('0x3d')](_0x3af379[_0xf4b0('0x3a')],qs[_0xf4b0('0x3f')](_0x147b8e[_0xf4b0('0x3c')]['fields']));_0x20f205[_0xf4b0('0x3e')]=_0x20f205[_0xf4b0('0x3e')][_0xf4b0('0x40')]?_0x20f205['attributes']:_0x3af379['model'];if(!_0x147b8e[_0xf4b0('0x3c')]['hasOwnProperty'](_0xf4b0('0x42'))){_0x20f205[_0xf4b0('0x22')]=qs[_0xf4b0('0x22')](_0x147b8e[_0xf4b0('0x3c')][_0xf4b0('0x22')]);_0x20f205[_0xf4b0('0x24')]=qs[_0xf4b0('0x24')](_0x147b8e[_0xf4b0('0x3c')][_0xf4b0('0x24')]);}_0x20f205[_0xf4b0('0x43')]=qs[_0xf4b0('0x44')](_0x147b8e['query'][_0xf4b0('0x44')]);_0x20f205['where']=qs['filters'](_[_0xf4b0('0x46')](_0x147b8e[_0xf4b0('0x3c')],_0x3af379['filters']));_0x20f205[_0xf4b0('0x62')][_0xf4b0('0x63')]=_0x2366f4['id'];if(_0x147b8e['query'][_0xf4b0('0x64')]){_0x20f205[_0xf4b0('0x62')]=_[_0xf4b0('0x47')](_0x20f205[_0xf4b0('0x62')],{'$or':_['map'](_0x20f205[_0xf4b0('0x3e')],function(_0x2bdf25){var _0x1a78f6={};_0x1a78f6[_0x2bdf25]={'$like':'%'+_0x147b8e[_0xf4b0('0x3c')][_0xf4b0('0x64')]+'%'};return _0x1a78f6;})});}_0x20f205=_[_0xf4b0('0x47')]({},_0x20f205,_0x147b8e['options']);return db[_0xf4b0('0x66')][_0xf4b0('0x23')]({'where':_0x20f205[_0xf4b0('0x62')]})[_0xf4b0('0x2b')](function(_0x42034a){_0x44c452[_0xf4b0('0x23')]=_0x42034a;if(_0x147b8e['query']['includeAll']){_0x20f205[_0xf4b0('0x4b')]=[{'all':!![]}];}return db[_0xf4b0('0x66')][_0xf4b0('0x4c')](_0x20f205);})['then'](function(_0x1dc3e1){_0x44c452[_0xf4b0('0x4d')]=_0x1dc3e1;return _0x44c452;});}})[_0xf4b0('0x2b')](respondWithFilteredResult(_0x3517a9,_0x20f205))[_0xf4b0('0x4e')](handleError(_0x3517a9,null));};function char(_0x515404){return _0xf4b0('0x67')===typeof _0x515404?String[_0xf4b0('0x68')][_0xf4b0('0x27')](null,arguments):_0x515404;}function needsEncapsulation(_0x355985){return!!_0x355985&&(_0x355985[_0xf4b0('0x69')]()[_0xf4b0('0x6a')](char(0xd))>=0x0||_0x355985['toString']()[_0xf4b0('0x6a')](char(0xa))>=0x0||_0x355985['toString']()[_0xf4b0('0x6a')](char(0x2c))>=0x0||_0x355985['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4e21f8){var _0x49b017=char(0x22),_0x3a21ce='\x5c'+char(0x22),_0x22dd7f=_0x4e21f8[_0xf4b0('0x69')]()[_0xf4b0('0x6b')](new RegExp(_0x49b017,'g'),_0x3a21ce);return _0x49b017+_0x22dd7f+_0x49b017;}exports[_0xf4b0('0x6c')]=function(_0x13d0ba,_0x2f0545,_0x332849){var _0x254967,_0x13c5ef;var _0x36bbdb={'where':{'ProjectId':_0x13d0ba['params']['id']}};if(_0x13d0ba[_0xf4b0('0x3c')][_0xf4b0('0x6d')]){_0x36bbdb[_0xf4b0('0x62')][_0xf4b0('0x6e')]=JSON[_0xf4b0('0x6f')](_0x13d0ba[_0xf4b0('0x3c')][_0xf4b0('0x6d')]);}return db[_0xf4b0('0x61')][_0xf4b0('0x4c')](_0x36bbdb)['then'](handleEntityNotFound(_0x2f0545,null))[_0xf4b0('0x2b')](function(_0x482855){if(_0x482855){_0x254967=_0x482855;return db['JscriptyQuestionReport'][_0xf4b0('0x4c')]({'where':{'SessionId':{'$in':_[_0xf4b0('0x34')](_0x254967,'id')},'ProjectId':_0x13d0ba['params']['id']},'order':_0xf4b0('0x70')});}})[_0xf4b0('0x2b')](handleEntityNotFound(_0x2f0545,null))[_0xf4b0('0x2b')](function(_0xbcaacb){if(_0xbcaacb){_0x13c5ef=_0xbcaacb;var _0x443fe4={};for(var _0xa6cb66=0x0,_0x97cacf=_0x13c5ef['length'];_0xa6cb66<_0x97cacf;_0xa6cb66++){if(!_0x443fe4[_0xf4b0('0x41')](_0x13c5ef[_0xa6cb66][_0xf4b0('0x71')])){_0x443fe4[_0x13c5ef[_0xa6cb66][_0xf4b0('0x71')]]=needsEncapsulation(_0x13c5ef[_0xa6cb66][_0xf4b0('0x72')])?encapsulate(_0x13c5ef[_0xa6cb66][_0xf4b0('0x72')]):_0x13c5ef[_0xa6cb66][_0xf4b0('0x72')];}}var _0x9fee09=[],_0x5a3524={};for(var _0x4ea008=0x0,_0x5e6920=_0x254967[_0xf4b0('0x40')];_0x4ea008<_0x5e6920;_0x4ea008++){_0x5a3524={'ProjectId':_0x13d0ba['params']['id'],'SessionId':_0x254967[_0x4ea008]['id'],'StartTime':moment(_0x254967[_0x4ea008][_0xf4b0('0x6e')])[_0xf4b0('0x73')](_0xf4b0('0x74'))};for(var _0x578538=0x0,_0x5cc2ea=_0x13c5ef[_0xf4b0('0x40')];_0x578538<_0x5cc2ea;_0x578538++){if(_0x13c5ef[_0x578538][_0xf4b0('0x75')]==_0x254967[_0x4ea008]['id']&&_0x443fe4[_0xf4b0('0x41')](_0x13c5ef[_0x578538][_0xf4b0('0x71')])){_0x5a3524[_0x443fe4[_0x13c5ef[_0x578538][_0xf4b0('0x71')]]]=_0x13c5ef[_0x578538][_0xf4b0('0x76')];}}for(var _0x1cbb95 in _0x443fe4){if(!_0x5a3524['hasOwnProperty'](_0x443fe4[_0x1cbb95])){_0x5a3524[_0x443fe4[_0x1cbb95]]=null;}}_0x9fee09[_0xf4b0('0x77')](_0x5a3524);}return _0x9fee09;}})['then'](function(_0x4dead1){if(!_[_0xf4b0('0x78')](_0x4dead1)){var _0x28076a=toCsv(_0x4dead1);var _0x38b99b=Date[_0xf4b0('0x79')]();fs[_0xf4b0('0x7a')](util[_0xf4b0('0x73')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x13d0ba[_0xf4b0('0x5a')]['id'],_0x38b99b),_0x28076a);_0x2f0545[_0xf4b0('0x7b')](_0xf4b0('0x7c'),'attachment;\x20filename='+util[_0xf4b0('0x73')]('Jscripty_Project_%d_Summary_%s.csv',_0x13d0ba[_0xf4b0('0x5a')]['id'],_0x38b99b));_0x2f0545[_0xf4b0('0x7b')](_0xf4b0('0x7d'),'text/csv');return _0x2f0545[_0xf4b0('0x7e')](util[_0xf4b0('0x73')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x13d0ba['params']['id'],_0x38b99b));}else{return _0x2f0545[_0xf4b0('0x1d')](0xcc);}})[_0xf4b0('0x4e')](handleError(_0x2f0545,null));}; \ No newline at end of file +var _0x0db9=['find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','findOne','JscriptySessionReport','nolimit','ProjectId','filter','rows','getAnswers','JscriptyAnswerReport','number','indexOf','toString','replace','getSummary','starttime','parse','-createdAt','questionId','question','SessionId','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','download','eml-format','request-promise','moment','mustache','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','Projects','destroy','error','name','send','map','JscriptyProject','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','filters','length'];(function(_0x3cd975,_0x23f21f){var _0x579111=function(_0x23d96c){while(--_0x23d96c){_0x3cd975['push'](_0x3cd975['shift']());}};_0x579111(++_0x23f21f);}(_0x0db9,0xa3));var _0x90db=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x0db9[_0x420513];return _0x1b44ec;};'use strict';var emlformat=require(_0x90db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90db('0x1'));var moment=require(_0x90db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90db('0x3'));var util=require('util');var path=require(_0x90db('0x4'));var sox=require(_0x90db('0x5'));var csv=require('to-csv');var ejs=require(_0x90db('0x6'));var fs=require('fs');var fs_extra=require(_0x90db('0x7'));var _=require(_0x90db('0x8'));var squel=require(_0x90db('0x9'));var crypto=require(_0x90db('0xa'));var jsforce=require(_0x90db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90db('0xc'));var querystring=require(_0x90db('0xd'));var Papa=require(_0x90db('0xe'));var Redis=require(_0x90db('0xf'));var authService=require(_0x90db('0x10'));var qs=require(_0x90db('0x11'));var as=require(_0x90db('0x12'));var hardwareService=require(_0x90db('0x13'));var logger=require(_0x90db('0x14'))(_0x90db('0x15'));var utils=require(_0x90db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90db('0x17'));var db=require(_0x90db('0x18'))['db'];function respondWithStatusCode(_0x45ad3c,_0x436327){_0x436327=_0x436327||0xcc;return function(_0x1b410d){if(_0x1b410d){return _0x45ad3c[_0x90db('0x19')](_0x436327);}return _0x45ad3c[_0x90db('0x1a')](_0x436327)[_0x90db('0x1b')]();};}function respondWithResult(_0x7826f7,_0x309aea){_0x309aea=_0x309aea||0xc8;return function(_0x334e22){if(_0x334e22){return _0x7826f7[_0x90db('0x1a')](_0x309aea)[_0x90db('0x1c')](_0x334e22);}};}function respondWithFilteredResult(_0xda2abe,_0x544226){return function(_0x3124d4){if(_0x3124d4){var _0x5ef456=typeof _0x544226[_0x90db('0x1d')]===_0x90db('0x1e')&&typeof _0x544226[_0x90db('0x1f')]===_0x90db('0x1e');var _0x32ff04=_0x3124d4[_0x90db('0x20')];var _0x15e33e=_0x5ef456?0x0:_0x544226[_0x90db('0x1d')];var _0x24a16a=_0x5ef456?_0x3124d4[_0x90db('0x20')]:_0x544226['offset']+_0x544226[_0x90db('0x1f')];var _0x445a22;if(_0x24a16a>=_0x32ff04){_0x24a16a=_0x32ff04;_0x445a22=0xc8;}else{_0x445a22=0xce;}_0xda2abe['status'](_0x445a22);return _0xda2abe['set'](_0x90db('0x21'),_0x15e33e+'-'+_0x24a16a+'/'+_0x32ff04)[_0x90db('0x1c')](_0x3124d4);}return null;};}function patchUpdates(_0x300dc2){return function(_0x3a58c4){try{jsonpatch[_0x90db('0x22')](_0x3a58c4,_0x300dc2,!![]);}catch(_0x168eaf){return BPromise[_0x90db('0x23')](_0x168eaf);}return _0x3a58c4['save']();};}function saveUpdates(_0xb45340,_0x1aeab9){return function(_0x23934a){if(_0x23934a){return _0x23934a[_0x90db('0x24')](_0xb45340)['then'](function(_0x43028e){return _0x43028e;});}return null;};}function removeEntity(_0x5a98f6,_0x459068){return function(_0x19f9c6){if(_0x19f9c6){return _0x19f9c6['destroy']()[_0x90db('0x25')](function(){var _0x294003=_0x19f9c6['get']({'plain':!![]});var _0x2f8469=_0x90db('0x26');return db['UserProfileResource'][_0x90db('0x27')]({'where':{'type':_0x2f8469,'resourceId':_0x294003['id']}})[_0x90db('0x25')](function(){return _0x19f9c6;});})[_0x90db('0x25')](function(){_0x5a98f6[_0x90db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e08e,_0x3e6200){return function(_0x60439d){if(!_0x60439d){_0x18e08e[_0x90db('0x19')](0x194);}return _0x60439d;};}function handleError(_0x3c6b10,_0x11cdf3){_0x11cdf3=_0x11cdf3||0x1f4;return function(_0x44b5b6){logger[_0x90db('0x28')](_0x44b5b6['stack']);if(_0x44b5b6[_0x90db('0x29')]){delete _0x44b5b6['name'];}_0x3c6b10[_0x90db('0x1a')](_0x11cdf3)[_0x90db('0x2a')](_0x44b5b6);};}exports['index']=function(_0x116635,_0xfc4ceb){var _0x2e9235={},_0xc48f13={},_0x4c3dfa={'count':0x0,'rows':[]};var _0x17071a=_[_0x90db('0x2b')](db[_0x90db('0x2c')]['rawAttributes'],function(_0x4a5d5a){return{'name':_0x4a5d5a[_0x90db('0x2d')],'type':_0x4a5d5a[_0x90db('0x2e')][_0x90db('0x2f')]};});_0xc48f13['model']=_[_0x90db('0x2b')](_0x17071a,_0x90db('0x29'));_0xc48f13['query']=_[_0x90db('0x30')](_0x116635[_0x90db('0x31')]);_0xc48f13['filters']=_[_0x90db('0x32')](_0xc48f13[_0x90db('0x33')],_0xc48f13[_0x90db('0x31')]);_0x2e9235[_0x90db('0x34')]=_['intersection'](_0xc48f13['model'],qs[_0x90db('0x35')](_0x116635['query'][_0x90db('0x35')]));_0x2e9235[_0x90db('0x34')]=_0x2e9235[_0x90db('0x34')]['length']?_0x2e9235[_0x90db('0x34')]:_0xc48f13['model'];if(!_0x116635[_0x90db('0x31')][_0x90db('0x36')]('nolimit')){_0x2e9235[_0x90db('0x1f')]=qs[_0x90db('0x1f')](_0x116635[_0x90db('0x31')][_0x90db('0x1f')]);_0x2e9235[_0x90db('0x1d')]=qs[_0x90db('0x1d')](_0x116635['query'][_0x90db('0x1d')]);}_0x2e9235[_0x90db('0x37')]=qs['sort'](_0x116635[_0x90db('0x31')][_0x90db('0x38')]);_0x2e9235[_0x90db('0x39')]=qs['filters'](_[_0x90db('0x3a')](_0x116635[_0x90db('0x31')],_0xc48f13['filters']),_0x17071a);if(_0x116635['query']['filter']){_0x2e9235['where']=_[_0x90db('0x3b')](_0x2e9235[_0x90db('0x39')],{'$or':_[_0x90db('0x2b')](_0x17071a,function(_0x4cf82c){if(_0x4cf82c['type']!==_0x90db('0x3c')){var _0x11a09a={};_0x11a09a[_0x4cf82c['name']]={'$like':'%'+_0x116635[_0x90db('0x31')]['filter']+'%'};return _0x11a09a;}})});}_0x2e9235=_[_0x90db('0x3b')]({},_0x2e9235,_0x116635[_0x90db('0x3d')]);var _0x248619={'where':_0x2e9235[_0x90db('0x39')]};return db[_0x90db('0x2c')][_0x90db('0x20')](_0x248619)[_0x90db('0x25')](function(_0x1d6f9a){_0x4c3dfa[_0x90db('0x20')]=_0x1d6f9a;if(_0x116635['query'][_0x90db('0x3e')]){_0x2e9235[_0x90db('0x3f')]=[{'all':!![]}];}return db[_0x90db('0x2c')][_0x90db('0x40')](_0x2e9235);})[_0x90db('0x25')](function(_0x4f0b46){_0x4c3dfa['rows']=_0x4f0b46;return _0x4c3dfa;})[_0x90db('0x25')](respondWithFilteredResult(_0xfc4ceb,_0x2e9235))['catch'](handleError(_0xfc4ceb,null));};exports[_0x90db('0x41')]=function(_0x2e33f2,_0x4457ee){var _0x473661={'raw':![],'where':{'id':_0x2e33f2['params']['id']}},_0x2fc7c5={};_0x2fc7c5['model']=_['keys'](db[_0x90db('0x2c')][_0x90db('0x42')]);_0x2fc7c5[_0x90db('0x31')]=_['keys'](_0x2e33f2[_0x90db('0x31')]);_0x2fc7c5[_0x90db('0x43')]=_[_0x90db('0x32')](_0x2fc7c5[_0x90db('0x33')],_0x2fc7c5['query']);_0x473661[_0x90db('0x34')]=_[_0x90db('0x32')](_0x2fc7c5[_0x90db('0x33')],qs[_0x90db('0x35')](_0x2e33f2['query']['fields']));_0x473661[_0x90db('0x34')]=_0x473661[_0x90db('0x34')][_0x90db('0x44')]?_0x473661[_0x90db('0x34')]:_0x2fc7c5['model'];if(_0x2e33f2[_0x90db('0x31')]['includeAll']){_0x473661[_0x90db('0x3f')]=[{'all':!![]}];}_0x473661=_[_0x90db('0x3b')]({},_0x473661,_0x2e33f2['options']);return db[_0x90db('0x2c')][_0x90db('0x45')](_0x473661)[_0x90db('0x25')](handleEntityNotFound(_0x4457ee,null))[_0x90db('0x25')](respondWithResult(_0x4457ee,null))[_0x90db('0x46')](handleError(_0x4457ee,null));};exports[_0x90db('0x47')]=function(_0x407f50,_0x62b965){return db[_0x90db('0x2c')][_0x90db('0x47')](_0x407f50[_0x90db('0x48')],{})['then'](function(_0x3cc064){var _0x3da12e=_0x407f50[_0x90db('0x49')][_0x90db('0x4a')]({'plain':!![]});if(!_0x3da12e)throw new Error(_0x90db('0x4b'));if(_0x3da12e[_0x90db('0x4c')]===_0x90db('0x49')){var _0x3a768b=_0x3cc064[_0x90db('0x4a')]({'plain':!![]});var _0x3e0942=_0x90db('0x26');return db[_0x90db('0x4d')]['find']({'where':{'name':_0x3e0942,'userProfileId':_0x3da12e[_0x90db('0x4e')]},'raw':!![]})['then'](function(_0x272bde){if(_0x272bde&&_0x272bde[_0x90db('0x4f')]===0x0){return db[_0x90db('0x50')][_0x90db('0x47')]({'name':_0x3a768b[_0x90db('0x29')],'resourceId':_0x3a768b['id'],'type':_0x272bde['name'],'sectionId':_0x272bde['id']},{})[_0x90db('0x25')](function(){return _0x3cc064;});}else{return _0x3cc064;}})[_0x90db('0x46')](function(_0x30cbc6){logger['error'](_0x90db('0x51'),_0x30cbc6);throw _0x30cbc6;});}return _0x3cc064;})['then'](respondWithResult(_0x62b965,0xc9))['catch'](handleError(_0x62b965,null));};exports[_0x90db('0x52')]=function(_0x224ac8,_0x10257d){var _0x80e5d7={'where':{'id':_0x224ac8[_0x90db('0x53')]['id']}},_0xc8aed3={};_0xc8aed3['model']=_['keys'](db[_0x90db('0x2c')][_0x90db('0x42')]);_0x80e5d7[_0x90db('0x34')]=_[_0x90db('0x32')](_0xc8aed3[_0x90db('0x33')],qs[_0x90db('0x35')](_0x224ac8[_0x90db('0x31')][_0x90db('0x35')]));_0x80e5d7[_0x90db('0x34')]=_0x80e5d7[_0x90db('0x34')][_0x90db('0x44')]?_0x80e5d7[_0x90db('0x34')]:_0xc8aed3[_0x90db('0x33')];if(_0x224ac8[_0x90db('0x31')][_0x90db('0x3e')]){_0x80e5d7[_0x90db('0x3f')]=[{'all':!![]}];}_0x80e5d7=_[_0x90db('0x3b')]({},_0x80e5d7,_0x224ac8[_0x90db('0x3d')]);return db[_0x90db('0x2c')][_0x90db('0x45')](_0x80e5d7)[_0x90db('0x25')](handleEntityNotFound(_0x10257d,null))[_0x90db('0x25')](function(_0x57da01){if(_0x57da01){var _0xd96450=_0x57da01[_0x90db('0x4a')]({'plain':!![]});_0xd96450=qs[_0x90db('0x54')](_0xd96450,['id',_0x90db('0x55'),_0x90db('0x56')]);_0x224ac8[_0x90db('0x48')]=_[_0x90db('0x54')](_0x224ac8[_0x90db('0x48')],['id',_0x90db('0x55'),_0x90db('0x56')]);return db[_0x90db('0x2c')][_0x90db('0x47')](_[_0x90db('0x3b')](_0xd96450,_0x224ac8[_0x90db('0x48')]),{'include':_0x224ac8[_0x90db('0x31')][_0x90db('0x3e')]?[{'all':!![]}]:undefined})[_0x90db('0x25')](function(_0x513879){var _0xf8c94d=_0x224ac8[_0x90db('0x49')]['get']({'plain':!![]});if(!_0xf8c94d)throw new Error(_0x90db('0x4b'));if(_0xf8c94d[_0x90db('0x4c')]==='user'){var _0x5087b6=_0x513879[_0x90db('0x4a')]({'plain':!![]});var _0xe35a38='Projects';return db[_0x90db('0x4d')]['find']({'where':{'name':_0xe35a38,'userProfileId':_0xf8c94d['userProfileId']},'raw':!![]})[_0x90db('0x25')](function(_0x210467){if(_0x210467&&_0x210467[_0x90db('0x4f')]===0x0){return db[_0x90db('0x50')][_0x90db('0x47')]({'name':_0x5087b6[_0x90db('0x29')],'resourceId':_0x5087b6['id'],'type':_0x210467[_0x90db('0x29')],'sectionId':_0x210467['id']},{})[_0x90db('0x25')](function(){return _0x513879;});}else{return _0x513879;}})[_0x90db('0x46')](function(_0x1d9db1){logger[_0x90db('0x28')](_0x90db('0x51'),_0x1d9db1);throw _0x1d9db1;});}return _0x513879;});}})['then'](respondWithResult(_0x10257d,0xc9))[_0x90db('0x46')](handleError(_0x10257d,null));};exports['update']=function(_0x30c97d,_0x5ecf74){if(_0x30c97d[_0x90db('0x48')]['id']){delete _0x30c97d[_0x90db('0x48')]['id'];}return db[_0x90db('0x2c')]['find']({'where':{'id':_0x30c97d[_0x90db('0x53')]['id']}})['then'](handleEntityNotFound(_0x5ecf74,null))[_0x90db('0x25')](saveUpdates(_0x30c97d[_0x90db('0x48')],null))['then'](respondWithResult(_0x5ecf74,null))[_0x90db('0x46')](handleError(_0x5ecf74,null));};exports[_0x90db('0x27')]=function(_0xa2129d,_0x575232){return db[_0x90db('0x2c')][_0x90db('0x45')]({'where':{'id':_0xa2129d[_0x90db('0x53')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x575232,null))[_0x90db('0x25')](removeEntity(_0x575232,null))['catch'](handleError(_0x575232,null));};exports['getSessions']=function(_0x13487c,_0x3e3da7,_0x35de24){var _0x19d2af={'raw':!![],'where':{}};var _0x2a05b5={};var _0x452c21={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x90db('0x57')]({'where':{'id':_0x13487c[_0x90db('0x53')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x3e3da7,null))[_0x90db('0x25')](function(_0x25dc9e){if(_0x25dc9e){_0x2a05b5[_0x90db('0x33')]=_[_0x90db('0x30')](db[_0x90db('0x58')][_0x90db('0x42')]);_0x2a05b5['query']=_[_0x90db('0x30')](_0x13487c[_0x90db('0x31')]);_0x2a05b5[_0x90db('0x43')]=_[_0x90db('0x32')](_0x2a05b5['model'],_0x2a05b5[_0x90db('0x31')]);_0x19d2af[_0x90db('0x34')]=_[_0x90db('0x32')](_0x2a05b5['model'],qs[_0x90db('0x35')](_0x13487c['query'][_0x90db('0x35')]));_0x19d2af[_0x90db('0x34')]=_0x19d2af['attributes'][_0x90db('0x44')]?_0x19d2af['attributes']:_0x2a05b5[_0x90db('0x33')];if(!_0x13487c[_0x90db('0x31')][_0x90db('0x36')](_0x90db('0x59'))){_0x19d2af['limit']=qs[_0x90db('0x1f')](_0x13487c[_0x90db('0x31')][_0x90db('0x1f')]);_0x19d2af['offset']=qs[_0x90db('0x1d')](_0x13487c[_0x90db('0x31')][_0x90db('0x1d')]);}_0x19d2af[_0x90db('0x37')]=qs[_0x90db('0x38')](_0x13487c[_0x90db('0x31')][_0x90db('0x38')]);_0x19d2af[_0x90db('0x39')]=qs[_0x90db('0x43')](_[_0x90db('0x3a')](_0x13487c[_0x90db('0x31')],_0x2a05b5[_0x90db('0x43')]));_0x19d2af[_0x90db('0x39')][_0x90db('0x5a')]=_0x25dc9e['id'];if(_0x13487c[_0x90db('0x31')]['filter']){_0x19d2af[_0x90db('0x39')]=_[_0x90db('0x3b')](_0x19d2af['where'],{'$or':_[_0x90db('0x2b')](_0x19d2af[_0x90db('0x34')],function(_0x5cbabb){var _0x32abd5={};_0x32abd5[_0x5cbabb]={'$like':'%'+_0x13487c[_0x90db('0x31')][_0x90db('0x5b')]+'%'};return _0x32abd5;})});}_0x19d2af=_[_0x90db('0x3b')]({},_0x19d2af,_0x13487c[_0x90db('0x3d')]);return db[_0x90db('0x58')][_0x90db('0x20')]({'where':_0x19d2af['where']})[_0x90db('0x25')](function(_0x46023c){_0x452c21[_0x90db('0x20')]=_0x46023c;if(_0x13487c[_0x90db('0x31')][_0x90db('0x3e')]){_0x19d2af[_0x90db('0x3f')]=[{'all':!![]}];}return db[_0x90db('0x58')][_0x90db('0x40')](_0x19d2af);})['then'](function(_0x4438e3){_0x452c21[_0x90db('0x5c')]=_0x4438e3;return _0x452c21;});}})[_0x90db('0x25')](respondWithFilteredResult(_0x3e3da7,_0x19d2af))[_0x90db('0x46')](handleError(_0x3e3da7,null));};exports[_0x90db('0x5d')]=function(_0xf75d73,_0x3f17ed,_0x2e4b57){var _0xe1c81a={'raw':!![],'where':{}};var _0xbb783={};var _0x1e12dc={'count':0x0,'rows':[]};return db[_0x90db('0x2c')]['findOne']({'where':{'id':_0xf75d73['params']['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x3f17ed,null))[_0x90db('0x25')](function(_0x24710e){if(_0x24710e){_0xbb783[_0x90db('0x33')]=_['keys'](db[_0x90db('0x5e')][_0x90db('0x42')]);_0xbb783[_0x90db('0x31')]=_[_0x90db('0x30')](_0xf75d73[_0x90db('0x31')]);_0xbb783['filters']=_[_0x90db('0x32')](_0xbb783[_0x90db('0x33')],_0xbb783[_0x90db('0x31')]);_0xe1c81a[_0x90db('0x34')]=_[_0x90db('0x32')](_0xbb783[_0x90db('0x33')],qs[_0x90db('0x35')](_0xf75d73[_0x90db('0x31')][_0x90db('0x35')]));_0xe1c81a[_0x90db('0x34')]=_0xe1c81a[_0x90db('0x34')][_0x90db('0x44')]?_0xe1c81a[_0x90db('0x34')]:_0xbb783[_0x90db('0x33')];if(!_0xf75d73[_0x90db('0x31')][_0x90db('0x36')](_0x90db('0x59'))){_0xe1c81a[_0x90db('0x1f')]=qs['limit'](_0xf75d73['query']['limit']);_0xe1c81a[_0x90db('0x1d')]=qs[_0x90db('0x1d')](_0xf75d73[_0x90db('0x31')][_0x90db('0x1d')]);}_0xe1c81a[_0x90db('0x37')]=qs[_0x90db('0x38')](_0xf75d73['query'][_0x90db('0x38')]);_0xe1c81a[_0x90db('0x39')]=qs[_0x90db('0x43')](_['pick'](_0xf75d73[_0x90db('0x31')],_0xbb783['filters']));_0xe1c81a['where'][_0x90db('0x5a')]=_0x24710e['id'];if(_0xf75d73[_0x90db('0x31')]['filter']){_0xe1c81a[_0x90db('0x39')]=_[_0x90db('0x3b')](_0xe1c81a[_0x90db('0x39')],{'$or':_[_0x90db('0x2b')](_0xe1c81a['attributes'],function(_0x122c3e){var _0x1c57fd={};_0x1c57fd[_0x122c3e]={'$like':'%'+_0xf75d73['query'][_0x90db('0x5b')]+'%'};return _0x1c57fd;})});}_0xe1c81a=_[_0x90db('0x3b')]({},_0xe1c81a,_0xf75d73[_0x90db('0x3d')]);return db[_0x90db('0x5e')][_0x90db('0x20')]({'where':_0xe1c81a[_0x90db('0x39')]})[_0x90db('0x25')](function(_0x3077db){_0x1e12dc['count']=_0x3077db;if(_0xf75d73['query'][_0x90db('0x3e')]){_0xe1c81a[_0x90db('0x3f')]=[{'all':!![]}];}return db[_0x90db('0x5e')][_0x90db('0x40')](_0xe1c81a);})['then'](function(_0x5c98c3){_0x1e12dc['rows']=_0x5c98c3;return _0x1e12dc;});}})[_0x90db('0x25')](respondWithFilteredResult(_0x3f17ed,_0xe1c81a))[_0x90db('0x46')](handleError(_0x3f17ed,null));};function char(_0x1d41a7){return _0x90db('0x5f')===typeof _0x1d41a7?String['fromCharCode'][_0x90db('0x22')](null,arguments):_0x1d41a7;}function needsEncapsulation(_0x2df660){return!!_0x2df660&&(_0x2df660['toString']()[_0x90db('0x60')](char(0xd))>=0x0||_0x2df660[_0x90db('0x61')]()[_0x90db('0x60')](char(0xa))>=0x0||_0x2df660['toString']()[_0x90db('0x60')](char(0x2c))>=0x0||_0x2df660[_0x90db('0x61')]()[_0x90db('0x60')](char(0x22))>=0x0);}function encapsulate(_0x400482){var _0xb97989=char(0x22),_0x2be874='\x5c'+char(0x22),_0x1d48d2=_0x400482[_0x90db('0x61')]()[_0x90db('0x62')](new RegExp(_0xb97989,'g'),_0x2be874);return _0xb97989+_0x1d48d2+_0xb97989;}exports[_0x90db('0x63')]=function(_0x516a62,_0x51b905,_0x5a37a0){var _0x25fdbb,_0x50ebc7;var _0xe718b5={'where':{'ProjectId':_0x516a62[_0x90db('0x53')]['id']}};if(_0x516a62[_0x90db('0x31')]['startTime']){_0xe718b5[_0x90db('0x39')][_0x90db('0x64')]=JSON[_0x90db('0x65')](_0x516a62[_0x90db('0x31')]['startTime']);}return db['JscriptySessionReport'][_0x90db('0x40')](_0xe718b5)[_0x90db('0x25')](handleEntityNotFound(_0x51b905,null))[_0x90db('0x25')](function(_0x4ef6d6){if(_0x4ef6d6){_0x25fdbb=_0x4ef6d6;return db['JscriptyQuestionReport'][_0x90db('0x40')]({'where':{'SessionId':{'$in':_[_0x90db('0x2b')](_0x25fdbb,'id')},'ProjectId':_0x516a62[_0x90db('0x53')]['id']},'order':_0x90db('0x66')});}})['then'](handleEntityNotFound(_0x51b905,null))['then'](function(_0x25d92b){if(_0x25d92b){_0x50ebc7=_0x25d92b;var _0x29e460={};for(var _0x20442c=0x0,_0x4cd4c4=_0x50ebc7[_0x90db('0x44')];_0x20442c<_0x4cd4c4;_0x20442c++){if(!_0x29e460[_0x90db('0x36')](_0x50ebc7[_0x20442c][_0x90db('0x67')])){_0x29e460[_0x50ebc7[_0x20442c][_0x90db('0x67')]]=needsEncapsulation(_0x50ebc7[_0x20442c][_0x90db('0x68')])?encapsulate(_0x50ebc7[_0x20442c]['question']):_0x50ebc7[_0x20442c][_0x90db('0x68')];}}var _0x43b8c8=[],_0x50c594={};for(var _0x44b7c2=0x0,_0x6deb77=_0x25fdbb[_0x90db('0x44')];_0x44b7c2<_0x6deb77;_0x44b7c2++){_0x50c594={'ProjectId':_0x516a62[_0x90db('0x53')]['id'],'SessionId':_0x25fdbb[_0x44b7c2]['id'],'StartTime':moment(_0x25fdbb[_0x44b7c2][_0x90db('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2cf48e=0x0,_0x1df54c=_0x50ebc7[_0x90db('0x44')];_0x2cf48e<_0x1df54c;_0x2cf48e++){if(_0x50ebc7[_0x2cf48e][_0x90db('0x69')]==_0x25fdbb[_0x44b7c2]['id']&&_0x29e460[_0x90db('0x36')](_0x50ebc7[_0x2cf48e]['questionId'])){_0x50c594[_0x29e460[_0x50ebc7[_0x2cf48e]['questionId']]]=_0x50ebc7[_0x2cf48e][_0x90db('0x6a')];}}for(var _0x4d67b5 in _0x29e460){if(!_0x50c594[_0x90db('0x36')](_0x29e460[_0x4d67b5])){_0x50c594[_0x29e460[_0x4d67b5]]=null;}}_0x43b8c8[_0x90db('0x6b')](_0x50c594);}return _0x43b8c8;}})[_0x90db('0x25')](function(_0x7bbdcb){if(!_[_0x90db('0x6c')](_0x7bbdcb)){var _0x290f1f=toCsv(_0x7bbdcb);var _0x5c5a7c=Date[_0x90db('0x6d')]();fs['writeFileSync'](util[_0x90db('0x6e')](_0x90db('0x6f'),_0x516a62[_0x90db('0x53')]['id'],_0x5c5a7c),_0x290f1f);_0x51b905[_0x90db('0x70')](_0x90db('0x71'),'attachment;\x20filename='+util[_0x90db('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x516a62['params']['id'],_0x5c5a7c));_0x51b905['setHeader'](_0x90db('0x72'),'text/csv');return _0x51b905[_0x90db('0x73')](util[_0x90db('0x6e')](_0x90db('0x6f'),_0x516a62['params']['id'],_0x5c5a7c));}else{return _0x51b905[_0x90db('0x19')](0xcc);}})[_0x90db('0x46')](handleError(_0x51b905,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7954e94..a17ee51 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 _0xe1dc=['request-promise','rimraf','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e5985,_0x50831d){var _0x1a2291=function(_0x12119c){while(--_0x12119c){_0x3e5985['push'](_0x3e5985['shift']());}};_0x1a2291(++_0x50831d);}(_0xe1dc,0x8a));var _0xce1d=function(_0x445e1f,_0x5c2dc0){_0x445e1f=_0x445e1f-0x0;var _0x583b4d=_0xe1dc[_0x445e1f];return _0x583b4d;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var moment=require(_0xce1d('0x4'));var BPromise=require(_0xce1d('0x5'));var rp=require(_0xce1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce1d('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xce1d('0x8')]=function(_0x232005,_0x2782b7){return _0x232005[_0xce1d('0x9')](_0xce1d('0xa'),attributes,{'tableName':_0xce1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf873=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf873,0xb2));var _0x3f87=function(_0xe4226,_0x532226){_0xe4226=_0xe4226-0x0;var _0x439bec=_0xf873[_0xe4226];return _0x439bec;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x3f87('0x9')]=function(_0x43c8e4,_0x27c03e){return _0x43c8e4['define'](_0x3f87('0xa'),attributes,{'tableName':_0x3f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index c173468..7cc7e5a 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x186b0e,_0x57b796){var _0x1f69b1=function(_0x184936){while(--_0x184936){_0x186b0e['push'](_0x186b0e['shift']());}};_0x1f69b1(++_0x57b796);}(_0xf4eb,0xec));var _0xbf4e=function(_0x393f6b,_0xac19f7){_0x393f6b=_0x393f6b-0x0;var _0x2c0643=_0xf4eb[_0x393f6b];return _0x2c0643;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xea0b85,_0x4271ef){var _0x41263e=function(_0x52f516){while(--_0x52f516){_0xea0b85['push'](_0xea0b85['shift']());}};_0x41263e(++_0x4271ef);}(_0xaa88,0x137));var _0x8aa8=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xaa88[_0x117f4c];return _0x2b24e9;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9a90ea3..a26f507 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 _0x1535=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x5a9299,_0xb5a9b7){var _0x272383=function(_0x2fde00){while(--_0x2fde00){_0x5a9299['push'](_0x5a9299['shift']());}};_0x272383(++_0xb5a9b7);}(_0x1535,0x1cc));var _0x5153=function(_0x1ec15f,_0x49a1b6){_0x1ec15f=_0x1ec15f-0x0;var _0x23fba9=_0x1535[_0x1ec15f];return _0x23fba9;};'use strict';var multer=require(_0x5153('0x0'));var util=require(_0x5153('0x1'));var path=require(_0x5153('0x2'));var timeout=require(_0x5153('0x3'));var express=require('express');var router=express[_0x5153('0x4')]();var fs_extra=require(_0x5153('0x5'));var auth=require(_0x5153('0x6'));var interaction=require(_0x5153('0x7'));var config=require(_0x5153('0x8'));var controller=require(_0x5153('0x9'));router[_0x5153('0xa')]('/',auth[_0x5153('0xb')](),controller[_0x5153('0xc')]);router[_0x5153('0xa')]('/describe',auth[_0x5153('0xb')](),controller['describe']);router[_0x5153('0xa')](_0x5153('0xd'),auth['isAuthenticated'](),controller[_0x5153('0xe')]);router[_0x5153('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5153('0x10')](_0x5153('0xd'),auth['isAuthenticated'](),controller[_0x5153('0x11')]);router['delete']('/:id',auth[_0x5153('0xb')](),controller[_0x5153('0x12')]);module[_0x5153('0x13')]=router; \ No newline at end of file +var _0x3ee8=['/:id','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','create','put','update','delete'];(function(_0x36abfd,_0x32068a){var _0x14ab00=function(_0x79ee87){while(--_0x79ee87){_0x36abfd['push'](_0x36abfd['shift']());}};_0x14ab00(++_0x32068a);}(_0x3ee8,0x8b));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x83ee('0x0'));var util=require(_0x83ee('0x1'));var path=require(_0x83ee('0x2'));var timeout=require(_0x83ee('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x83ee('0x4'));var config=require('../../config/environment');var controller=require(_0x83ee('0x5'));router[_0x83ee('0x6')]('/',auth[_0x83ee('0x7')](),controller[_0x83ee('0x8')]);router[_0x83ee('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x83ee('0x9')]);router[_0x83ee('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x83ee('0xa')]);router[_0x83ee('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x83ee('0xc')]);router[_0x83ee('0xd')](_0x83ee('0xe'),auth[_0x83ee('0x7')](),controller[_0x83ee('0xf')]);module[_0x83ee('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 abd2201..4f41ecd 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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x143aba,_0x55b6d3){_0x143aba=_0x143aba-0x0;var _0x294186=_0x7a54[_0x143aba];return _0x294186;};'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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x3b8f0d,_0x5d3676){_0x3b8f0d=_0x3b8f0d-0x0;var _0x12b9ae=_0x7a54[_0x3b8f0d];return _0x12b9ae;};'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 a622807..fb99fcd 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 _0xd587=['sort','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4a8726,_0x15b554){var _0x55268c=function(_0x3eea4b){while(--_0x3eea4b){_0x4a8726['push'](_0x4a8726['shift']());}};_0x55268c(++_0x15b554);}(_0xd587,0x146));var _0x7d58=function(_0x29b75,_0x5b560b){_0x29b75=_0x29b75-0x0;var _0x6ff3ab=_0xd587[_0x29b75];return _0x6ff3ab;};'use strict';var emlformat=require(_0x7d58('0x0'));var rimraf=require(_0x7d58('0x1'));var zipdir=require(_0x7d58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d58('0x3'));var moment=require(_0x7d58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d58('0x5'));var util=require(_0x7d58('0x6'));var path=require(_0x7d58('0x7'));var sox=require(_0x7d58('0x8'));var csv=require(_0x7d58('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d58('0xa'));var squel=require(_0x7d58('0xb'));var crypto=require(_0x7d58('0xc'));var jsforce=require(_0x7d58('0xd'));var deskjs=require(_0x7d58('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7d58('0xf'));var Papa=require(_0x7d58('0x10'));var Redis=require('ioredis');var authService=require(_0x7d58('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7d58('0x12'));var hardwareService=require(_0x7d58('0x13'));var logger=require(_0x7d58('0x14'))('api');var utils=require(_0x7d58('0x15'));var config=require(_0x7d58('0x16'));var licenseUtil=require(_0x7d58('0x17'));var db=require(_0x7d58('0x18'))['db'];function respondWithStatusCode(_0x52788f,_0x43e539){_0x43e539=_0x43e539||0xcc;return function(_0x34c843){if(_0x34c843){return _0x52788f[_0x7d58('0x19')](_0x43e539);}return _0x52788f[_0x7d58('0x1a')](_0x43e539)['end']();};}function respondWithResult(_0x13b28b,_0x2c9062){_0x2c9062=_0x2c9062||0xc8;return function(_0x1360c8){if(_0x1360c8){return _0x13b28b[_0x7d58('0x1a')](_0x2c9062)[_0x7d58('0x1b')](_0x1360c8);}};}function respondWithFilteredResult(_0x7923b1,_0xd75b1f){return function(_0x2d9d45){if(_0x2d9d45){var _0x1f2c19=typeof _0xd75b1f[_0x7d58('0x1c')]==='undefined'&&typeof _0xd75b1f[_0x7d58('0x1d')]===_0x7d58('0x1e');var _0x3071a5=_0x2d9d45[_0x7d58('0x1f')];var _0xf72e93=_0x1f2c19?0x0:_0xd75b1f[_0x7d58('0x1c')];var _0xcebb4f=_0x1f2c19?_0x2d9d45[_0x7d58('0x1f')]:_0xd75b1f[_0x7d58('0x1c')]+_0xd75b1f[_0x7d58('0x1d')];var _0x597e0c;if(_0xcebb4f>=_0x3071a5){_0xcebb4f=_0x3071a5;_0x597e0c=0xc8;}else{_0x597e0c=0xce;}_0x7923b1[_0x7d58('0x1a')](_0x597e0c);return _0x7923b1[_0x7d58('0x20')]('Content-Range',_0xf72e93+'-'+_0xcebb4f+'/'+_0x3071a5)[_0x7d58('0x1b')](_0x2d9d45);}return null;};}function patchUpdates(_0x9248f9){return function(_0x1edee0){try{jsonpatch[_0x7d58('0x21')](_0x1edee0,_0x9248f9,!![]);}catch(_0x2d4d8a){return BPromise[_0x7d58('0x22')](_0x2d4d8a);}return _0x1edee0[_0x7d58('0x23')]();};}function saveUpdates(_0x216560,_0x22d3b2){return function(_0x62da1c){if(_0x62da1c){return _0x62da1c[_0x7d58('0x24')](_0x216560)[_0x7d58('0x25')](function(_0x4d338b){return _0x4d338b;});}return null;};}function removeEntity(_0x1d653b,_0x4dc311){return function(_0x407f9b){if(_0x407f9b){return _0x407f9b[_0x7d58('0x26')]()[_0x7d58('0x25')](function(){_0x1d653b[_0x7d58('0x1a')](0xcc)[_0x7d58('0x27')]();});}};}function handleEntityNotFound(_0x118569,_0x660067){return function(_0x29069c){if(!_0x29069c){_0x118569[_0x7d58('0x19')](0x194);}return _0x29069c;};}function handleError(_0xcf78a9,_0x158935){_0x158935=_0x158935||0x1f4;return function(_0x288389){logger[_0x7d58('0x28')](_0x288389[_0x7d58('0x29')]);if(_0x288389[_0x7d58('0x2a')]){delete _0x288389[_0x7d58('0x2a')];}_0xcf78a9['status'](_0x158935)[_0x7d58('0x2b')](_0x288389);};}exports['index']=function(_0x53163a,_0x7f3456){var _0x3e7d1a={},_0x2dbb7e={},_0x1d176f={'count':0x0,'rows':[]};var _0x1d3f7d=_[_0x7d58('0x2c')](db[_0x7d58('0x2d')]['rawAttributes'],function(_0x4e8727){return{'name':_0x4e8727[_0x7d58('0x2e')],'type':_0x4e8727[_0x7d58('0x2f')]['key']};});_0x2dbb7e[_0x7d58('0x30')]=_[_0x7d58('0x2c')](_0x1d3f7d,_0x7d58('0x2a'));_0x2dbb7e[_0x7d58('0x31')]=_[_0x7d58('0x32')](_0x53163a['query']);_0x2dbb7e[_0x7d58('0x33')]=_[_0x7d58('0x34')](_0x2dbb7e[_0x7d58('0x30')],_0x2dbb7e[_0x7d58('0x31')]);_0x3e7d1a['attributes']=_[_0x7d58('0x34')](_0x2dbb7e[_0x7d58('0x30')],qs[_0x7d58('0x35')](_0x53163a[_0x7d58('0x31')]['fields']));_0x3e7d1a[_0x7d58('0x36')]=_0x3e7d1a[_0x7d58('0x36')][_0x7d58('0x37')]?_0x3e7d1a[_0x7d58('0x36')]:_0x2dbb7e[_0x7d58('0x30')];if(!_0x53163a[_0x7d58('0x31')][_0x7d58('0x38')](_0x7d58('0x39'))){_0x3e7d1a['limit']=qs[_0x7d58('0x1d')](_0x53163a[_0x7d58('0x31')][_0x7d58('0x1d')]);_0x3e7d1a[_0x7d58('0x1c')]=qs[_0x7d58('0x1c')](_0x53163a[_0x7d58('0x31')]['offset']);}_0x3e7d1a[_0x7d58('0x3a')]=qs[_0x7d58('0x3b')](_0x53163a[_0x7d58('0x31')][_0x7d58('0x3b')]);_0x3e7d1a['where']=qs['filters'](_['pick'](_0x53163a[_0x7d58('0x31')],_0x2dbb7e[_0x7d58('0x33')]),_0x1d3f7d);if(_0x53163a[_0x7d58('0x31')][_0x7d58('0x3c')]){_0x3e7d1a['where']=_[_0x7d58('0x3d')](_0x3e7d1a['where'],{'$or':_[_0x7d58('0x2c')](_0x1d3f7d,function(_0xb75ff5){if(_0xb75ff5[_0x7d58('0x2f')]!==_0x7d58('0x3e')){var _0x376005={};_0x376005[_0xb75ff5['name']]={'$like':'%'+_0x53163a[_0x7d58('0x31')][_0x7d58('0x3c')]+'%'};return _0x376005;}})});}_0x3e7d1a=_[_0x7d58('0x3d')]({},_0x3e7d1a,_0x53163a['options']);var _0x427243={'where':_0x3e7d1a[_0x7d58('0x3f')]};return db[_0x7d58('0x2d')][_0x7d58('0x1f')](_0x427243)[_0x7d58('0x25')](function(_0x25e892){_0x1d176f[_0x7d58('0x1f')]=_0x25e892;if(_0x53163a[_0x7d58('0x31')][_0x7d58('0x40')]){_0x3e7d1a[_0x7d58('0x41')]=[{'all':!![]}];}return db[_0x7d58('0x2d')][_0x7d58('0x42')](_0x3e7d1a);})[_0x7d58('0x25')](function(_0x2b0625){_0x1d176f[_0x7d58('0x43')]=_0x2b0625;return _0x1d176f;})['then'](respondWithFilteredResult(_0x7f3456,_0x3e7d1a))[_0x7d58('0x44')](handleError(_0x7f3456,null));};exports[_0x7d58('0x45')]=function(_0x150ab8,_0x7829f6){var _0x678060={'raw':!![],'where':{'id':_0x150ab8[_0x7d58('0x46')]['id']}},_0x238f19={};_0x238f19['model']=_['keys'](db['JscriptyQuestionReport'][_0x7d58('0x47')]);_0x238f19['query']=_[_0x7d58('0x32')](_0x150ab8[_0x7d58('0x31')]);_0x238f19[_0x7d58('0x33')]=_[_0x7d58('0x34')](_0x238f19[_0x7d58('0x30')],_0x238f19[_0x7d58('0x31')]);_0x678060[_0x7d58('0x36')]=_[_0x7d58('0x34')](_0x238f19[_0x7d58('0x30')],qs[_0x7d58('0x35')](_0x150ab8['query'][_0x7d58('0x35')]));_0x678060['attributes']=_0x678060[_0x7d58('0x36')][_0x7d58('0x37')]?_0x678060[_0x7d58('0x36')]:_0x238f19['model'];if(_0x150ab8[_0x7d58('0x31')][_0x7d58('0x40')]){_0x678060[_0x7d58('0x41')]=[{'all':!![]}];}_0x678060=_[_0x7d58('0x3d')]({},_0x678060,_0x150ab8[_0x7d58('0x48')]);return db[_0x7d58('0x2d')][_0x7d58('0x49')](_0x678060)[_0x7d58('0x25')](handleEntityNotFound(_0x7829f6,null))[_0x7d58('0x25')](respondWithResult(_0x7829f6,null))[_0x7d58('0x44')](handleError(_0x7829f6,null));};exports['create']=function(_0x59b2aa,_0x470859){return db[_0x7d58('0x2d')][_0x7d58('0x4a')](_0x59b2aa[_0x7d58('0x4b')],{})[_0x7d58('0x25')](respondWithResult(_0x470859,0xc9))[_0x7d58('0x44')](handleError(_0x470859,null));};exports['update']=function(_0x2959aa,_0x4a9ecb){if(_0x2959aa['body']['id']){delete _0x2959aa[_0x7d58('0x4b')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2959aa[_0x7d58('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a9ecb,null))[_0x7d58('0x25')](saveUpdates(_0x2959aa[_0x7d58('0x4b')],null))[_0x7d58('0x25')](respondWithResult(_0x4a9ecb,null))[_0x7d58('0x44')](handleError(_0x4a9ecb,null));};exports[_0x7d58('0x26')]=function(_0x2d9775,_0x139c58){return db[_0x7d58('0x2d')]['find']({'where':{'id':_0x2d9775[_0x7d58('0x46')]['id']}})[_0x7d58('0x25')](handleEntityNotFound(_0x139c58,null))[_0x7d58('0x25')](removeEntity(_0x139c58,null))[_0x7d58('0x44')](handleError(_0x139c58,null));};exports[_0x7d58('0x4c')]=function(_0x2b2738,_0x54de97){return db['JscriptyQuestionReport'][_0x7d58('0x4c')]()['then'](respondWithResult(_0x54de97,null))['catch'](handleError(_0x54de97,null));}; \ No newline at end of file +var _0xcde7=['reject','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x4d7a7c,_0x578847){var _0x4326dd=function(_0x53dd7a){while(--_0x53dd7a){_0x4d7a7c['push'](_0x4d7a7c['shift']());}};_0x4326dd(++_0x578847);}(_0xcde7,0x159));var _0x7cde=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xcde7[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x7cde('0x0'));var rimraf=require(_0x7cde('0x1'));var zipdir=require(_0x7cde('0x2'));var jsonpatch=require(_0x7cde('0x3'));var rp=require(_0x7cde('0x4'));var moment=require(_0x7cde('0x5'));var BPromise=require(_0x7cde('0x6'));var Mustache=require(_0x7cde('0x7'));var util=require(_0x7cde('0x8'));var path=require(_0x7cde('0x9'));var sox=require(_0x7cde('0xa'));var csv=require(_0x7cde('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cde('0xc'));var _=require(_0x7cde('0xd'));var squel=require(_0x7cde('0xe'));var crypto=require(_0x7cde('0xf'));var jsforce=require(_0x7cde('0x10'));var deskjs=require(_0x7cde('0x11'));var toCsv=require(_0x7cde('0xb'));var querystring=require(_0x7cde('0x12'));var Papa=require(_0x7cde('0x13'));var Redis=require(_0x7cde('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7cde('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cde('0x16'))(_0x7cde('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7cde('0x18'))['db'];function respondWithStatusCode(_0x478245,_0x2f7cb6){_0x2f7cb6=_0x2f7cb6||0xcc;return function(_0x3df625){if(_0x3df625){return _0x478245[_0x7cde('0x19')](_0x2f7cb6);}return _0x478245['status'](_0x2f7cb6)[_0x7cde('0x1a')]();};}function respondWithResult(_0x940bd8,_0x3faa25){_0x3faa25=_0x3faa25||0xc8;return function(_0x2b9fcf){if(_0x2b9fcf){return _0x940bd8['status'](_0x3faa25)[_0x7cde('0x1b')](_0x2b9fcf);}};}function respondWithFilteredResult(_0x9621a4,_0x2ff0ca){return function(_0x437215){if(_0x437215){var _0x467a3b=typeof _0x2ff0ca[_0x7cde('0x1c')]===_0x7cde('0x1d')&&typeof _0x2ff0ca[_0x7cde('0x1e')]===_0x7cde('0x1d');var _0x5d35ba=_0x437215[_0x7cde('0x1f')];var _0x4889bf=_0x467a3b?0x0:_0x2ff0ca['offset'];var _0x573801=_0x467a3b?_0x437215[_0x7cde('0x1f')]:_0x2ff0ca['offset']+_0x2ff0ca['limit'];var _0x4f7886;if(_0x573801>=_0x5d35ba){_0x573801=_0x5d35ba;_0x4f7886=0xc8;}else{_0x4f7886=0xce;}_0x9621a4[_0x7cde('0x20')](_0x4f7886);return _0x9621a4[_0x7cde('0x21')](_0x7cde('0x22'),_0x4889bf+'-'+_0x573801+'/'+_0x5d35ba)[_0x7cde('0x1b')](_0x437215);}return null;};}function patchUpdates(_0x172323){return function(_0x2922a1){try{jsonpatch['apply'](_0x2922a1,_0x172323,!![]);}catch(_0x1226e1){return BPromise[_0x7cde('0x23')](_0x1226e1);}return _0x2922a1[_0x7cde('0x24')]();};}function saveUpdates(_0x33c766,_0x3349c4){return function(_0x30e98a){if(_0x30e98a){return _0x30e98a[_0x7cde('0x25')](_0x33c766)[_0x7cde('0x26')](function(_0x1dc3c0){return _0x1dc3c0;});}return null;};}function removeEntity(_0x551408,_0x157154){return function(_0x6fa970){if(_0x6fa970){return _0x6fa970[_0x7cde('0x27')]()[_0x7cde('0x26')](function(){_0x551408[_0x7cde('0x20')](0xcc)[_0x7cde('0x1a')]();});}};}function handleEntityNotFound(_0x4ffaf1,_0x3fcd7e){return function(_0x17ad97){if(!_0x17ad97){_0x4ffaf1[_0x7cde('0x19')](0x194);}return _0x17ad97;};}function handleError(_0x3776fb,_0x55a4a4){_0x55a4a4=_0x55a4a4||0x1f4;return function(_0x57d60a){logger[_0x7cde('0x28')](_0x57d60a[_0x7cde('0x29')]);if(_0x57d60a['name']){delete _0x57d60a[_0x7cde('0x2a')];}_0x3776fb[_0x7cde('0x20')](_0x55a4a4)[_0x7cde('0x2b')](_0x57d60a);};}exports['index']=function(_0xaf4873,_0x2f035d){var _0x534e14={},_0x1b66e8={},_0x4c6b0e={'count':0x0,'rows':[]};var _0x10cd5b=_[_0x7cde('0x2c')](db[_0x7cde('0x2d')][_0x7cde('0x2e')],function(_0x1eff82){return{'name':_0x1eff82[_0x7cde('0x2f')],'type':_0x1eff82[_0x7cde('0x30')]['key']};});_0x1b66e8['model']=_[_0x7cde('0x2c')](_0x10cd5b,'name');_0x1b66e8[_0x7cde('0x31')]=_[_0x7cde('0x32')](_0xaf4873[_0x7cde('0x31')]);_0x1b66e8[_0x7cde('0x33')]=_['intersection'](_0x1b66e8['model'],_0x1b66e8['query']);_0x534e14[_0x7cde('0x34')]=_[_0x7cde('0x35')](_0x1b66e8[_0x7cde('0x36')],qs[_0x7cde('0x37')](_0xaf4873[_0x7cde('0x31')][_0x7cde('0x37')]));_0x534e14[_0x7cde('0x34')]=_0x534e14[_0x7cde('0x34')][_0x7cde('0x38')]?_0x534e14[_0x7cde('0x34')]:_0x1b66e8[_0x7cde('0x36')];if(!_0xaf4873[_0x7cde('0x31')][_0x7cde('0x39')](_0x7cde('0x3a'))){_0x534e14['limit']=qs[_0x7cde('0x1e')](_0xaf4873[_0x7cde('0x31')][_0x7cde('0x1e')]);_0x534e14[_0x7cde('0x1c')]=qs[_0x7cde('0x1c')](_0xaf4873[_0x7cde('0x31')][_0x7cde('0x1c')]);}_0x534e14[_0x7cde('0x3b')]=qs[_0x7cde('0x3c')](_0xaf4873[_0x7cde('0x31')][_0x7cde('0x3c')]);_0x534e14[_0x7cde('0x3d')]=qs[_0x7cde('0x33')](_[_0x7cde('0x3e')](_0xaf4873[_0x7cde('0x31')],_0x1b66e8[_0x7cde('0x33')]),_0x10cd5b);if(_0xaf4873['query'][_0x7cde('0x3f')]){_0x534e14['where']=_[_0x7cde('0x40')](_0x534e14[_0x7cde('0x3d')],{'$or':_[_0x7cde('0x2c')](_0x10cd5b,function(_0x209d75){if(_0x209d75[_0x7cde('0x30')]!==_0x7cde('0x41')){var _0x55d813={};_0x55d813[_0x209d75[_0x7cde('0x2a')]]={'$like':'%'+_0xaf4873[_0x7cde('0x31')][_0x7cde('0x3f')]+'%'};return _0x55d813;}})});}_0x534e14=_['merge']({},_0x534e14,_0xaf4873['options']);var _0xe6452b={'where':_0x534e14['where']};return db[_0x7cde('0x2d')][_0x7cde('0x1f')](_0xe6452b)['then'](function(_0xb9d4a7){_0x4c6b0e[_0x7cde('0x1f')]=_0xb9d4a7;if(_0xaf4873[_0x7cde('0x31')][_0x7cde('0x42')]){_0x534e14[_0x7cde('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7cde('0x44')](_0x534e14);})['then'](function(_0x2f0e55){_0x4c6b0e[_0x7cde('0x45')]=_0x2f0e55;return _0x4c6b0e;})[_0x7cde('0x26')](respondWithFilteredResult(_0x2f035d,_0x534e14))['catch'](handleError(_0x2f035d,null));};exports['show']=function(_0x1ffacf,_0x5d72cf){var _0x1d18cf={'raw':!![],'where':{'id':_0x1ffacf[_0x7cde('0x46')]['id']}},_0x2aa003={};_0x2aa003[_0x7cde('0x36')]=_['keys'](db[_0x7cde('0x2d')]['rawAttributes']);_0x2aa003[_0x7cde('0x31')]=_[_0x7cde('0x32')](_0x1ffacf[_0x7cde('0x31')]);_0x2aa003[_0x7cde('0x33')]=_[_0x7cde('0x35')](_0x2aa003[_0x7cde('0x36')],_0x2aa003[_0x7cde('0x31')]);_0x1d18cf['attributes']=_[_0x7cde('0x35')](_0x2aa003['model'],qs['fields'](_0x1ffacf[_0x7cde('0x31')][_0x7cde('0x37')]));_0x1d18cf[_0x7cde('0x34')]=_0x1d18cf['attributes'][_0x7cde('0x38')]?_0x1d18cf[_0x7cde('0x34')]:_0x2aa003[_0x7cde('0x36')];if(_0x1ffacf[_0x7cde('0x31')][_0x7cde('0x42')]){_0x1d18cf[_0x7cde('0x43')]=[{'all':!![]}];}_0x1d18cf=_[_0x7cde('0x40')]({},_0x1d18cf,_0x1ffacf['options']);return db[_0x7cde('0x2d')][_0x7cde('0x47')](_0x1d18cf)[_0x7cde('0x26')](handleEntityNotFound(_0x5d72cf,null))[_0x7cde('0x26')](respondWithResult(_0x5d72cf,null))[_0x7cde('0x48')](handleError(_0x5d72cf,null));};exports[_0x7cde('0x49')]=function(_0x1125d7,_0x3dd129){return db[_0x7cde('0x2d')][_0x7cde('0x49')](_0x1125d7[_0x7cde('0x4a')],{})[_0x7cde('0x26')](respondWithResult(_0x3dd129,0xc9))[_0x7cde('0x48')](handleError(_0x3dd129,null));};exports[_0x7cde('0x25')]=function(_0x49f69f,_0x52f521){if(_0x49f69f[_0x7cde('0x4a')]['id']){delete _0x49f69f[_0x7cde('0x4a')]['id'];}return db[_0x7cde('0x2d')][_0x7cde('0x47')]({'where':{'id':_0x49f69f['params']['id']}})[_0x7cde('0x26')](handleEntityNotFound(_0x52f521,null))['then'](saveUpdates(_0x49f69f[_0x7cde('0x4a')],null))[_0x7cde('0x26')](respondWithResult(_0x52f521,null))['catch'](handleError(_0x52f521,null));};exports[_0x7cde('0x27')]=function(_0x1b1222,_0x1b6e55){return db[_0x7cde('0x2d')][_0x7cde('0x47')]({'where':{'id':_0x1b1222[_0x7cde('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b6e55,null))['then'](removeEntity(_0x1b6e55,null))[_0x7cde('0x48')](handleError(_0x1b6e55,null));};exports[_0x7cde('0x4b')]=function(_0x3edf78,_0x547c4c){return db['JscriptyQuestionReport'][_0x7cde('0x4b')]()[_0x7cde('0x26')](respondWithResult(_0x547c4c,null))[_0x7cde('0x48')](handleError(_0x547c4c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 23235aa..150be96 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 _0x7091=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x54df52,_0x4329a2){var _0x46d319=function(_0x3b6035){while(--_0x3b6035){_0x54df52['push'](_0x54df52['shift']());}};_0x46d319(++_0x4329a2);}(_0x7091,0x66));var _0x1709=function(_0x559e12,_0x4ca668){_0x559e12=_0x559e12-0x0;var _0x50de65=_0x7091[_0x559e12];return _0x50de65;};'use strict';var _=require(_0x1709('0x0'));var util=require(_0x1709('0x1'));var logger=require(_0x1709('0x2'))(_0x1709('0x3'));var moment=require('moment');var BPromise=require(_0x1709('0x4'));var rp=require(_0x1709('0x5'));var fs=require('fs');var path=require(_0x1709('0x6'));var rimraf=require(_0x1709('0x7'));var config=require(_0x1709('0x8'));var attributes=require(_0x1709('0x9'));module[_0x1709('0xa')]=function(_0x32a74c,_0x52094c){return _0x32a74c[_0x1709('0xb')](_0x1709('0xc'),attributes,{'tableName':_0x1709('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7006=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x5d1ca7,_0x49ee6b){var _0xaef8ab=function(_0x567206){while(--_0x567206){_0x5d1ca7['push'](_0x5d1ca7['shift']());}};_0xaef8ab(++_0x49ee6b);}(_0x7006,0x197));var _0x6700=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x7006[_0x2fc113];return _0x5144ce;};'use strict';var _=require(_0x6700('0x0'));var util=require(_0x6700('0x1'));var logger=require(_0x6700('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6700('0x3'));var rp=require(_0x6700('0x4'));var fs=require('fs');var path=require(_0x6700('0x5'));var rimraf=require(_0x6700('0x6'));var config=require('../../config/environment');var attributes=require(_0x6700('0x7'));module[_0x6700('0x8')]=function(_0xee69ea,_0x4a282a){return _0xee69ea[_0x6700('0x9')](_0x6700('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index c9ebb8d..fdd8295 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 _0x22db=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring'];(function(_0xf5c66c,_0x2b59be){var _0x4cf978=function(_0xc84ef3){while(--_0xc84ef3){_0xf5c66c['push'](_0xf5c66c['shift']());}};_0x4cf978(++_0x2b59be);}(_0x22db,0xb0));var _0xb22d=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x22db[_0x28fe94];return _0x3560da;};'use strict';var _=require(_0xb22d('0x0'));var util=require(_0xb22d('0x1'));var moment=require(_0xb22d('0x2'));var BPromise=require('bluebird');var rs=require(_0xb22d('0x3'));var fs=require('fs');var Redis=require(_0xb22d('0x4'));var db=require(_0xb22d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb22d('0x6'))(_0xb22d('0x7'));var config=require('../../config/environment');var jayson=require(_0xb22d('0x8'));var client=jayson[_0xb22d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39a4cb,_0x4577b7,_0x3eebf2){return new BPromise(function(_0x25e28e,_0x149141){return client[_0xb22d('0xa')](_0x39a4cb,_0x3eebf2)[_0xb22d('0xb')](function(_0x34c1fa){logger[_0xb22d('0xc')](_0xb22d('0xd'),_0x4577b7,_0xb22d('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4577b7,_0xb22d('0xe'),JSON[_0xb22d('0xf')](_0x34c1fa));if(_0x34c1fa[_0xb22d('0x10')]){if(_0x34c1fa['error'][_0xb22d('0x11')]===0x1f4){logger[_0xb22d('0x10')](_0xb22d('0xd'),_0x4577b7,_0x34c1fa[_0xb22d('0x10')][_0xb22d('0x12')]);return _0x149141(_0x34c1fa[_0xb22d('0x10')][_0xb22d('0x12')]);}logger[_0xb22d('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4577b7,_0x34c1fa[_0xb22d('0x10')][_0xb22d('0x12')]);return _0x25e28e(_0x34c1fa[_0xb22d('0x10')][_0xb22d('0x12')]);}else{logger[_0xb22d('0xc')](_0xb22d('0xd'),_0x4577b7,'request\x20sent');_0x25e28e(_0x34c1fa[_0xb22d('0x13')][_0xb22d('0x12')]);}})['catch'](function(_0x4c6b5a){logger[_0xb22d('0x10')](_0xb22d('0xd'),_0x4577b7,_0x4c6b5a);_0x149141(_0x4c6b5a);});});} \ No newline at end of file +var _0xdda2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x16faff,_0x1289fa){var _0x350f73=function(_0x35f79c){while(--_0x35f79c){_0x16faff['push'](_0x16faff['shift']());}};_0x350f73(++_0x1289fa);}(_0xdda2,0xaf));var _0x2dda=function(_0x95a908,_0x227e95){_0x95a908=_0x95a908-0x0;var _0x436da9=_0xdda2[_0x95a908];return _0x436da9;};'use strict';var _=require(_0x2dda('0x0'));var util=require(_0x2dda('0x1'));var moment=require(_0x2dda('0x2'));var BPromise=require(_0x2dda('0x3'));var rs=require(_0x2dda('0x4'));var fs=require('fs');var Redis=require(_0x2dda('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2dda('0x6'));var logger=require(_0x2dda('0x7'))(_0x2dda('0x8'));var config=require(_0x2dda('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2dda('0xa')][_0x2dda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x459287,_0x530566,_0x280310){return new BPromise(function(_0x3d0f20,_0xf8886a){return client['request'](_0x459287,_0x280310)[_0x2dda('0xc')](function(_0x571ab0){logger[_0x2dda('0xd')](_0x2dda('0xe'),_0x530566,_0x2dda('0xf'));logger[_0x2dda('0x10')](_0x2dda('0x11'),_0x530566,'request\x20sent',JSON['stringify'](_0x571ab0));if(_0x571ab0[_0x2dda('0x12')]){if(_0x571ab0[_0x2dda('0x12')][_0x2dda('0x13')]===0x1f4){logger[_0x2dda('0x12')](_0x2dda('0xe'),_0x530566,_0x571ab0['error']['message']);return _0xf8886a(_0x571ab0['error']['message']);}logger['error'](_0x2dda('0xe'),_0x530566,_0x571ab0[_0x2dda('0x12')]['message']);return _0x3d0f20(_0x571ab0['error'][_0x2dda('0x14')]);}else{logger[_0x2dda('0xd')](_0x2dda('0xe'),_0x530566,_0x2dda('0xf'));_0x3d0f20(_0x571ab0[_0x2dda('0x15')][_0x2dda('0x14')]);}})['catch'](function(_0x22e881){logger[_0x2dda('0x12')](_0x2dda('0xe'),_0x530566,_0x22e881);_0xf8886a(_0x22e881);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index adb51cf..f2d8d32 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 _0x1f7e=['isAuthenticated','index','/describe','describe','/:id','show','getQuestions','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x1f7e,0x19a));var _0xe1f7=function(_0x468cc3,_0x4f78aa){_0x468cc3=_0x468cc3-0x0;var _0x50519d=_0x1f7e[_0x468cc3];return _0x50519d;};'use strict';var multer=require(_0xe1f7('0x0'));var util=require('util');var path=require(_0xe1f7('0x1'));var timeout=require(_0xe1f7('0x2'));var express=require('express');var router=express[_0xe1f7('0x3')]();var fs_extra=require(_0xe1f7('0x4'));var auth=require(_0xe1f7('0x5'));var interaction=require(_0xe1f7('0x6'));var config=require(_0xe1f7('0x7'));var controller=require(_0xe1f7('0x8'));router[_0xe1f7('0x9')]('/',auth[_0xe1f7('0xa')](),controller[_0xe1f7('0xb')]);router[_0xe1f7('0x9')](_0xe1f7('0xc'),auth[_0xe1f7('0xa')](),controller[_0xe1f7('0xd')]);router['get'](_0xe1f7('0xe'),auth[_0xe1f7('0xa')](),controller[_0xe1f7('0xf')]);router[_0xe1f7('0x9')]('/:id/questions',auth[_0xe1f7('0xa')](),controller[_0xe1f7('0x10')]);router['post']('/',auth[_0xe1f7('0xa')](),controller['create']);router['put']('/:id',auth[_0xe1f7('0xa')](),controller[_0xe1f7('0x11')]);router[_0xe1f7('0x12')]('/:id',auth[_0xe1f7('0xa')](),controller[_0xe1f7('0x13')]);module[_0xe1f7('0x14')]=router; \ No newline at end of file +var _0x98ba=['/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x5b9737,_0x5b9923){var _0x5b1581=function(_0x2449e4){while(--_0x2449e4){_0x5b9737['push'](_0x5b9737['shift']());}};_0x5b1581(++_0x5b9923);}(_0x98ba,0x13e));var _0xa98b=function(_0x5a1119,_0x2f426a){_0x5a1119=_0x5a1119-0x0;var _0x5234be=_0x98ba[_0x5a1119];return _0x5234be;};'use strict';var multer=require(_0xa98b('0x0'));var util=require(_0xa98b('0x1'));var path=require(_0xa98b('0x2'));var timeout=require(_0xa98b('0x3'));var express=require(_0xa98b('0x4'));var router=express[_0xa98b('0x5')]();var fs_extra=require(_0xa98b('0x6'));var auth=require(_0xa98b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa98b('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xa98b('0x9')]('/',auth[_0xa98b('0xa')](),controller['index']);router[_0xa98b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa98b('0xb')]);router['get'](_0xa98b('0xc'),auth[_0xa98b('0xa')](),controller[_0xa98b('0xd')]);router[_0xa98b('0x9')](_0xa98b('0xe'),auth['isAuthenticated'](),controller[_0xa98b('0xf')]);router[_0xa98b('0x10')]('/',auth[_0xa98b('0xa')](),controller[_0xa98b('0x11')]);router[_0xa98b('0x12')](_0xa98b('0xc'),auth[_0xa98b('0xa')](),controller[_0xa98b('0x13')]);router[_0xa98b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xa98b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5c72730..23f01aa 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 _0xe7f8=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x13fea6,_0x498715){var _0x52ea03=function(_0x1e4463){while(--_0x1e4463){_0x13fea6['push'](_0x13fea6['shift']());}};_0x52ea03(++_0x498715);}(_0xe7f8,0x1b3));var _0x8e7f=function(_0x1b2f38,_0x25e61f){_0x1b2f38=_0x1b2f38-0x0;var _0x54ad82=_0xe7f8[_0x1b2f38];return _0x54ad82;};'use strict';var moment=require(_0x8e7f('0x0'));var Sequelize=require(_0x8e7f('0x1'));module[_0x8e7f('0x2')]={'starttime':{'type':Sequelize[_0x8e7f('0x3')],'set':function(_0x28c467){this[_0x8e7f('0x4')](_0x8e7f('0x5'),_0x28c467);this[_0x8e7f('0x4')]('endtime',moment()[_0x8e7f('0x6')](_0x8e7f('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x8e7f('0x8')]},'projectname':{'type':Sequelize[_0x8e7f('0x8')]},'queue':{'type':Sequelize[_0x8e7f('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8e7f('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc2f7=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x1142da,_0x4ee9cb){var _0x234ff9=function(_0x17365d){while(--_0x17365d){_0x1142da['push'](_0x1142da['shift']());}};_0x234ff9(++_0x4ee9cb);}(_0xc2f7,0x1d5));var _0x7c2f=function(_0x5e3bcf,_0x491df3){_0x5e3bcf=_0x5e3bcf-0x0;var _0x199cba=_0xc2f7[_0x5e3bcf];return _0x199cba;};'use strict';var moment=require(_0x7c2f('0x0'));var Sequelize=require(_0x7c2f('0x1'));module[_0x7c2f('0x2')]={'starttime':{'type':Sequelize[_0x7c2f('0x3')],'set':function(_0x37ac45){this[_0x7c2f('0x4')](_0x7c2f('0x5'),_0x37ac45);this[_0x7c2f('0x4')](_0x7c2f('0x6'),moment()[_0x7c2f('0x7')](_0x7c2f('0x8')));}},'endtime':{'type':Sequelize[_0x7c2f('0x3')]},'membername':{'type':Sequelize[_0x7c2f('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7c2f('0x9')]},'uniqueid':{'type':Sequelize[_0x7c2f('0x9')]},'calleridname':{'type':Sequelize[_0x7c2f('0x9')]},'calleridnum':{'type':Sequelize[_0x7c2f('0x9')]},'completed':{'type':Sequelize[_0x7c2f('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index f18c278..da59747 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 _0x2083=['path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','JscriptySessionReport','findAll','rows','catch','show','rawAttributes','keys','includeAll','find','create','body','destroy','params','describe','getQuestions','findOne','JscriptyQuestionReport','order','fast-json-patch','request-promise','bluebird'];(function(_0x2b7b88,_0x2fa465){var _0x136919=function(_0x48fcd9){while(--_0x48fcd9){_0x2b7b88['push'](_0x2b7b88['shift']());}};_0x136919(++_0x2fa465);}(_0x2083,0x8b));var _0x3208=function(_0x145ee1,_0x19c9fa){_0x145ee1=_0x145ee1-0x0;var _0x411642=_0x2083[_0x145ee1];return _0x411642;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3208('0x0'));var rp=require(_0x3208('0x1'));var moment=require('moment');var BPromise=require(_0x3208('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3208('0x3'));var sox=require(_0x3208('0x4'));var csv=require('to-csv');var ejs=require(_0x3208('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3208('0x6'));var crypto=require(_0x3208('0x7'));var jsforce=require(_0x3208('0x8'));var deskjs=require(_0x3208('0x9'));var toCsv=require('to-csv');var querystring=require(_0x3208('0xa'));var Papa=require(_0x3208('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3208('0xc'));var as=require(_0x3208('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3208('0xe'));var config=require(_0x3208('0xf'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2163d5,_0x368dc4){_0x368dc4=_0x368dc4||0xcc;return function(_0x38aff3){if(_0x38aff3){return _0x2163d5[_0x3208('0x10')](_0x368dc4);}return _0x2163d5[_0x3208('0x11')](_0x368dc4)[_0x3208('0x12')]();};}function respondWithResult(_0x436b70,_0x35bea6){_0x35bea6=_0x35bea6||0xc8;return function(_0x3c98b0){if(_0x3c98b0){return _0x436b70[_0x3208('0x11')](_0x35bea6)[_0x3208('0x13')](_0x3c98b0);}};}function respondWithFilteredResult(_0x30cff7,_0x422469){return function(_0x50723c){if(_0x50723c){var _0x38e9eb=typeof _0x422469[_0x3208('0x14')]===_0x3208('0x15')&&typeof _0x422469[_0x3208('0x16')]==='undefined';var _0x3c7acd=_0x50723c[_0x3208('0x17')];var _0x21a0bf=_0x38e9eb?0x0:_0x422469['offset'];var _0x5df547=_0x38e9eb?_0x50723c['count']:_0x422469[_0x3208('0x14')]+_0x422469[_0x3208('0x16')];var _0x1dad62;if(_0x5df547>=_0x3c7acd){_0x5df547=_0x3c7acd;_0x1dad62=0xc8;}else{_0x1dad62=0xce;}_0x30cff7['status'](_0x1dad62);return _0x30cff7[_0x3208('0x18')](_0x3208('0x19'),_0x21a0bf+'-'+_0x5df547+'/'+_0x3c7acd)[_0x3208('0x13')](_0x50723c);}return null;};}function patchUpdates(_0x60491c){return function(_0x3e9db8){try{jsonpatch[_0x3208('0x1a')](_0x3e9db8,_0x60491c,!![]);}catch(_0x2fa3c0){return BPromise[_0x3208('0x1b')](_0x2fa3c0);}return _0x3e9db8[_0x3208('0x1c')]();};}function saveUpdates(_0x3f49df,_0x322f30){return function(_0x15b71a){if(_0x15b71a){return _0x15b71a[_0x3208('0x1d')](_0x3f49df)[_0x3208('0x1e')](function(_0x224ef9){return _0x224ef9;});}return null;};}function removeEntity(_0x10bafd,_0x4fae1a){return function(_0x3ee52a){if(_0x3ee52a){return _0x3ee52a['destroy']()[_0x3208('0x1e')](function(){_0x10bafd[_0x3208('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x535a32,_0x483cae){return function(_0x386d49){if(!_0x386d49){_0x535a32[_0x3208('0x10')](0x194);}return _0x386d49;};}function handleError(_0x5d4cf1,_0x319b69){_0x319b69=_0x319b69||0x1f4;return function(_0x23b77c){logger['error'](_0x23b77c[_0x3208('0x1f')]);if(_0x23b77c[_0x3208('0x20')]){delete _0x23b77c[_0x3208('0x20')];}_0x5d4cf1[_0x3208('0x11')](_0x319b69)[_0x3208('0x21')](_0x23b77c);};}exports[_0x3208('0x22')]=function(_0x5438b7,_0x5bf41d){var _0x52c164={},_0x211306={},_0x48b108={'count':0x0,'rows':[]};var _0x31ec70=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x755417){return{'name':_0x755417['fieldName'],'type':_0x755417[_0x3208('0x23')][_0x3208('0x24')]};});_0x211306[_0x3208('0x25')]=_[_0x3208('0x26')](_0x31ec70,_0x3208('0x20'));_0x211306[_0x3208('0x27')]=_['keys'](_0x5438b7[_0x3208('0x27')]);_0x211306[_0x3208('0x28')]=_['intersection'](_0x211306[_0x3208('0x25')],_0x211306[_0x3208('0x27')]);_0x52c164[_0x3208('0x29')]=_[_0x3208('0x2a')](_0x211306['model'],qs[_0x3208('0x2b')](_0x5438b7[_0x3208('0x27')][_0x3208('0x2b')]));_0x52c164['attributes']=_0x52c164[_0x3208('0x29')][_0x3208('0x2c')]?_0x52c164[_0x3208('0x29')]:_0x211306[_0x3208('0x25')];if(!_0x5438b7[_0x3208('0x27')][_0x3208('0x2d')](_0x3208('0x2e'))){_0x52c164['limit']=qs['limit'](_0x5438b7['query'][_0x3208('0x16')]);_0x52c164[_0x3208('0x14')]=qs[_0x3208('0x14')](_0x5438b7[_0x3208('0x27')][_0x3208('0x14')]);}_0x52c164['order']=qs['sort'](_0x5438b7[_0x3208('0x27')][_0x3208('0x2f')]);_0x52c164['where']=qs['filters'](_[_0x3208('0x30')](_0x5438b7[_0x3208('0x27')],_0x211306[_0x3208('0x28')]),_0x31ec70);if(_0x5438b7['query'][_0x3208('0x31')]){_0x52c164[_0x3208('0x32')]=_['merge'](_0x52c164[_0x3208('0x32')],{'$or':_[_0x3208('0x26')](_0x31ec70,function(_0x39124b){if(_0x39124b['type']!=='VIRTUAL'){var _0x37e906={};_0x37e906[_0x39124b[_0x3208('0x20')]]={'$like':'%'+_0x5438b7[_0x3208('0x27')][_0x3208('0x31')]+'%'};return _0x37e906;}})});}_0x52c164=_[_0x3208('0x33')]({},_0x52c164,_0x5438b7[_0x3208('0x34')]);var _0x47034d={'where':_0x52c164[_0x3208('0x32')]};return db['JscriptySessionReport']['count'](_0x47034d)[_0x3208('0x1e')](function(_0x154ffd){_0x48b108[_0x3208('0x17')]=_0x154ffd;if(_0x5438b7['query']['includeAll']){_0x52c164['include']=[{'all':!![]}];}return db[_0x3208('0x35')][_0x3208('0x36')](_0x52c164);})[_0x3208('0x1e')](function(_0x1f6c79){_0x48b108[_0x3208('0x37')]=_0x1f6c79;return _0x48b108;})[_0x3208('0x1e')](respondWithFilteredResult(_0x5bf41d,_0x52c164))[_0x3208('0x38')](handleError(_0x5bf41d,null));};exports[_0x3208('0x39')]=function(_0xdc1245,_0x10c7b0){var _0x287f91={'raw':!![],'where':{'id':_0xdc1245['params']['id']}},_0x11456b={};_0x11456b['model']=_['keys'](db[_0x3208('0x35')][_0x3208('0x3a')]);_0x11456b[_0x3208('0x27')]=_[_0x3208('0x3b')](_0xdc1245[_0x3208('0x27')]);_0x11456b[_0x3208('0x28')]=_[_0x3208('0x2a')](_0x11456b[_0x3208('0x25')],_0x11456b[_0x3208('0x27')]);_0x287f91[_0x3208('0x29')]=_[_0x3208('0x2a')](_0x11456b['model'],qs[_0x3208('0x2b')](_0xdc1245[_0x3208('0x27')][_0x3208('0x2b')]));_0x287f91[_0x3208('0x29')]=_0x287f91[_0x3208('0x29')]['length']?_0x287f91[_0x3208('0x29')]:_0x11456b[_0x3208('0x25')];if(_0xdc1245[_0x3208('0x27')][_0x3208('0x3c')]){_0x287f91['include']=[{'all':!![]}];}_0x287f91=_['merge']({},_0x287f91,_0xdc1245[_0x3208('0x34')]);return db[_0x3208('0x35')][_0x3208('0x3d')](_0x287f91)[_0x3208('0x1e')](handleEntityNotFound(_0x10c7b0,null))['then'](respondWithResult(_0x10c7b0,null))['catch'](handleError(_0x10c7b0,null));};exports[_0x3208('0x3e')]=function(_0x296b59,_0x20e659){return db['JscriptySessionReport'][_0x3208('0x3e')](_0x296b59['body'],{})['then'](respondWithResult(_0x20e659,0xc9))[_0x3208('0x38')](handleError(_0x20e659,null));};exports[_0x3208('0x1d')]=function(_0x5d5aa2,_0x116f40){if(_0x5d5aa2['body']['id']){delete _0x5d5aa2[_0x3208('0x3f')]['id'];}return db[_0x3208('0x35')][_0x3208('0x3d')]({'where':{'id':_0x5d5aa2['params']['id']}})[_0x3208('0x1e')](handleEntityNotFound(_0x116f40,null))[_0x3208('0x1e')](saveUpdates(_0x5d5aa2[_0x3208('0x3f')],null))[_0x3208('0x1e')](respondWithResult(_0x116f40,null))[_0x3208('0x38')](handleError(_0x116f40,null));};exports[_0x3208('0x40')]=function(_0x370e46,_0x545dbe){return db[_0x3208('0x35')][_0x3208('0x3d')]({'where':{'id':_0x370e46[_0x3208('0x41')]['id']}})[_0x3208('0x1e')](handleEntityNotFound(_0x545dbe,null))['then'](removeEntity(_0x545dbe,null))[_0x3208('0x38')](handleError(_0x545dbe,null));};exports[_0x3208('0x42')]=function(_0x242edb,_0x471620){return db['JscriptySessionReport'][_0x3208('0x42')]()[_0x3208('0x1e')](respondWithResult(_0x471620,null))[_0x3208('0x38')](handleError(_0x471620,null));};exports[_0x3208('0x43')]=function(_0x5386c6,_0x29368b,_0x2d4d9a){var _0x1973bb={'raw':!![],'where':{}};var _0x1b921c={};var _0x13c42a={'count':0x0,'rows':[]};return db[_0x3208('0x35')][_0x3208('0x44')]({'where':{'id':_0x5386c6[_0x3208('0x41')]['id']}})[_0x3208('0x1e')](handleEntityNotFound(_0x29368b,null))[_0x3208('0x1e')](function(_0x58a29e){if(_0x58a29e){_0x1b921c[_0x3208('0x25')]=_['keys'](db[_0x3208('0x45')]['rawAttributes']);_0x1b921c[_0x3208('0x27')]=_[_0x3208('0x3b')](_0x5386c6['query']);_0x1b921c[_0x3208('0x28')]=_[_0x3208('0x2a')](_0x1b921c['model'],_0x1b921c[_0x3208('0x27')]);_0x1973bb[_0x3208('0x29')]=_[_0x3208('0x2a')](_0x1b921c[_0x3208('0x25')],qs[_0x3208('0x2b')](_0x5386c6[_0x3208('0x27')]['fields']));_0x1973bb[_0x3208('0x29')]=_0x1973bb[_0x3208('0x29')]['length']?_0x1973bb[_0x3208('0x29')]:_0x1b921c['model'];if(!_0x5386c6[_0x3208('0x27')][_0x3208('0x2d')](_0x3208('0x2e'))){_0x1973bb[_0x3208('0x16')]=qs[_0x3208('0x16')](_0x5386c6[_0x3208('0x27')][_0x3208('0x16')]);_0x1973bb[_0x3208('0x14')]=qs[_0x3208('0x14')](_0x5386c6['query']['offset']);}_0x1973bb[_0x3208('0x46')]=qs['sort'](_0x5386c6[_0x3208('0x27')][_0x3208('0x2f')]);_0x1973bb[_0x3208('0x32')]=qs['filters'](_[_0x3208('0x30')](_0x5386c6['query'],_0x1b921c[_0x3208('0x28')]));_0x1973bb[_0x3208('0x32')]['SessionId']=_0x58a29e['id'];if(_0x5386c6['query'][_0x3208('0x31')]){_0x1973bb['where']=_['merge'](_0x1973bb[_0x3208('0x32')],{'$or':_[_0x3208('0x26')](_0x1973bb['attributes'],function(_0xccb3a9){var _0x377809={};_0x377809[_0xccb3a9]={'$like':'%'+_0x5386c6['query']['filter']+'%'};return _0x377809;})});}_0x1973bb=_[_0x3208('0x33')]({},_0x1973bb,_0x5386c6['options']);return db[_0x3208('0x45')]['count']({'where':_0x1973bb[_0x3208('0x32')]})['then'](function(_0x3f4c47){_0x13c42a[_0x3208('0x17')]=_0x3f4c47;if(_0x5386c6[_0x3208('0x27')][_0x3208('0x3c')]){_0x1973bb['include']=[{'all':!![]}];}return db[_0x3208('0x45')]['findAll'](_0x1973bb);})[_0x3208('0x1e')](function(_0x29c770){_0x13c42a[_0x3208('0x37')]=_0x29c770;return _0x13c42a;});}})[_0x3208('0x1e')](respondWithFilteredResult(_0x29368b,_0x1973bb))[_0x3208('0x38')](handleError(_0x29368b,null));}; \ No newline at end of file +var _0xa530=['update','destroy','then','error','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save'];(function(_0x144463,_0x5e2a3c){var _0x330802=function(_0x46319e){while(--_0x46319e){_0x144463['push'](_0x144463['shift']());}};_0x330802(++_0x5e2a3c);}(_0xa530,0x83));var _0x0a53=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xa530[_0x31b9cf];return _0x357b8a;};'use strict';var emlformat=require(_0x0a53('0x0'));var rimraf=require(_0x0a53('0x1'));var zipdir=require(_0x0a53('0x2'));var jsonpatch=require(_0x0a53('0x3'));var rp=require(_0x0a53('0x4'));var moment=require(_0x0a53('0x5'));var BPromise=require(_0x0a53('0x6'));var Mustache=require(_0x0a53('0x7'));var util=require(_0x0a53('0x8'));var path=require(_0x0a53('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a53('0xa'));var fs=require('fs');var fs_extra=require(_0x0a53('0xb'));var _=require(_0x0a53('0xc'));var squel=require(_0x0a53('0xd'));var crypto=require(_0x0a53('0xe'));var jsforce=require(_0x0a53('0xf'));var deskjs=require(_0x0a53('0x10'));var toCsv=require(_0x0a53('0x11'));var querystring=require(_0x0a53('0x12'));var Papa=require(_0x0a53('0x13'));var Redis=require(_0x0a53('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0a53('0x15'));var as=require(_0x0a53('0x16'));var hardwareService=require(_0x0a53('0x17'));var logger=require(_0x0a53('0x18'))(_0x0a53('0x19'));var utils=require(_0x0a53('0x1a'));var config=require(_0x0a53('0x1b'));var licenseUtil=require(_0x0a53('0x1c'));var db=require(_0x0a53('0x1d'))['db'];function respondWithStatusCode(_0x122ad3,_0xde1330){_0xde1330=_0xde1330||0xcc;return function(_0x2e7094){if(_0x2e7094){return _0x122ad3[_0x0a53('0x1e')](_0xde1330);}return _0x122ad3[_0x0a53('0x1f')](_0xde1330)[_0x0a53('0x20')]();};}function respondWithResult(_0x29b23e,_0xea603b){_0xea603b=_0xea603b||0xc8;return function(_0x2d0215){if(_0x2d0215){return _0x29b23e[_0x0a53('0x1f')](_0xea603b)[_0x0a53('0x21')](_0x2d0215);}};}function respondWithFilteredResult(_0x1665df,_0x2fe1c6){return function(_0x3d9146){if(_0x3d9146){var _0x3255fc=typeof _0x2fe1c6['offset']===_0x0a53('0x22')&&typeof _0x2fe1c6['limit']==='undefined';var _0x4af526=_0x3d9146[_0x0a53('0x23')];var _0x36a520=_0x3255fc?0x0:_0x2fe1c6[_0x0a53('0x24')];var _0x43297b=_0x3255fc?_0x3d9146['count']:_0x2fe1c6['offset']+_0x2fe1c6['limit'];var _0x16899e;if(_0x43297b>=_0x4af526){_0x43297b=_0x4af526;_0x16899e=0xc8;}else{_0x16899e=0xce;}_0x1665df[_0x0a53('0x1f')](_0x16899e);return _0x1665df[_0x0a53('0x25')](_0x0a53('0x26'),_0x36a520+'-'+_0x43297b+'/'+_0x4af526)[_0x0a53('0x21')](_0x3d9146);}return null;};}function patchUpdates(_0x50823d){return function(_0x4a1c71){try{jsonpatch[_0x0a53('0x27')](_0x4a1c71,_0x50823d,!![]);}catch(_0x5b20b1){return BPromise['reject'](_0x5b20b1);}return _0x4a1c71[_0x0a53('0x28')]();};}function saveUpdates(_0x5f8718,_0x53cdec){return function(_0x514881){if(_0x514881){return _0x514881[_0x0a53('0x29')](_0x5f8718)['then'](function(_0x5988db){return _0x5988db;});}return null;};}function removeEntity(_0x12bc42,_0x56e0b3){return function(_0x180612){if(_0x180612){return _0x180612[_0x0a53('0x2a')]()[_0x0a53('0x2b')](function(){_0x12bc42['status'](0xcc)[_0x0a53('0x20')]();});}};}function handleEntityNotFound(_0x16496f,_0x3bd7f0){return function(_0x4fc1d7){if(!_0x4fc1d7){_0x16496f[_0x0a53('0x1e')](0x194);}return _0x4fc1d7;};}function handleError(_0x2806e8,_0x382ce5){_0x382ce5=_0x382ce5||0x1f4;return function(_0x21544){logger[_0x0a53('0x2c')](_0x21544[_0x0a53('0x2d')]);if(_0x21544[_0x0a53('0x2e')]){delete _0x21544['name'];}_0x2806e8['status'](_0x382ce5)['send'](_0x21544);};}exports['index']=function(_0x5885c4,_0x128870){var _0x22d31c={},_0x5c1843={},_0x25339c={'count':0x0,'rows':[]};var _0x5acc1a=_[_0x0a53('0x2f')](db[_0x0a53('0x30')][_0x0a53('0x31')],function(_0x4205db){return{'name':_0x4205db[_0x0a53('0x32')],'type':_0x4205db[_0x0a53('0x33')][_0x0a53('0x34')]};});_0x5c1843[_0x0a53('0x35')]=_[_0x0a53('0x2f')](_0x5acc1a,_0x0a53('0x2e'));_0x5c1843[_0x0a53('0x36')]=_[_0x0a53('0x37')](_0x5885c4['query']);_0x5c1843[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x5c1843[_0x0a53('0x35')],_0x5c1843[_0x0a53('0x36')]);_0x22d31c[_0x0a53('0x3a')]=_[_0x0a53('0x39')](_0x5c1843['model'],qs['fields'](_0x5885c4[_0x0a53('0x36')][_0x0a53('0x3b')]));_0x22d31c[_0x0a53('0x3a')]=_0x22d31c[_0x0a53('0x3a')][_0x0a53('0x3c')]?_0x22d31c[_0x0a53('0x3a')]:_0x5c1843[_0x0a53('0x35')];if(!_0x5885c4['query'][_0x0a53('0x3d')](_0x0a53('0x3e'))){_0x22d31c[_0x0a53('0x3f')]=qs[_0x0a53('0x3f')](_0x5885c4[_0x0a53('0x36')][_0x0a53('0x3f')]);_0x22d31c[_0x0a53('0x24')]=qs[_0x0a53('0x24')](_0x5885c4[_0x0a53('0x36')][_0x0a53('0x24')]);}_0x22d31c[_0x0a53('0x40')]=qs[_0x0a53('0x41')](_0x5885c4[_0x0a53('0x36')][_0x0a53('0x41')]);_0x22d31c[_0x0a53('0x42')]=qs['filters'](_[_0x0a53('0x43')](_0x5885c4[_0x0a53('0x36')],_0x5c1843[_0x0a53('0x38')]),_0x5acc1a);if(_0x5885c4[_0x0a53('0x36')][_0x0a53('0x44')]){_0x22d31c[_0x0a53('0x42')]=_[_0x0a53('0x45')](_0x22d31c[_0x0a53('0x42')],{'$or':_[_0x0a53('0x2f')](_0x5acc1a,function(_0x29513e){if(_0x29513e[_0x0a53('0x33')]!=='VIRTUAL'){var _0x383a5a={};_0x383a5a[_0x29513e[_0x0a53('0x2e')]]={'$like':'%'+_0x5885c4['query'][_0x0a53('0x44')]+'%'};return _0x383a5a;}})});}_0x22d31c=_[_0x0a53('0x45')]({},_0x22d31c,_0x5885c4[_0x0a53('0x46')]);var _0x2b61a3={'where':_0x22d31c[_0x0a53('0x42')]};return db[_0x0a53('0x30')]['count'](_0x2b61a3)['then'](function(_0x41bfe8){_0x25339c[_0x0a53('0x23')]=_0x41bfe8;if(_0x5885c4[_0x0a53('0x36')][_0x0a53('0x47')]){_0x22d31c[_0x0a53('0x48')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a53('0x49')](_0x22d31c);})['then'](function(_0x431d23){_0x25339c['rows']=_0x431d23;return _0x25339c;})[_0x0a53('0x2b')](respondWithFilteredResult(_0x128870,_0x22d31c))[_0x0a53('0x4a')](handleError(_0x128870,null));};exports[_0x0a53('0x4b')]=function(_0x5ec31b,_0x265521){var _0x5b1d61={'raw':!![],'where':{'id':_0x5ec31b[_0x0a53('0x4c')]['id']}},_0x177a28={};_0x177a28[_0x0a53('0x35')]=_[_0x0a53('0x37')](db[_0x0a53('0x30')][_0x0a53('0x31')]);_0x177a28[_0x0a53('0x36')]=_['keys'](_0x5ec31b['query']);_0x177a28[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x177a28['model'],_0x177a28[_0x0a53('0x36')]);_0x5b1d61[_0x0a53('0x3a')]=_[_0x0a53('0x39')](_0x177a28['model'],qs[_0x0a53('0x3b')](_0x5ec31b[_0x0a53('0x36')][_0x0a53('0x3b')]));_0x5b1d61[_0x0a53('0x3a')]=_0x5b1d61['attributes'][_0x0a53('0x3c')]?_0x5b1d61['attributes']:_0x177a28[_0x0a53('0x35')];if(_0x5ec31b[_0x0a53('0x36')]['includeAll']){_0x5b1d61[_0x0a53('0x48')]=[{'all':!![]}];}_0x5b1d61=_[_0x0a53('0x45')]({},_0x5b1d61,_0x5ec31b[_0x0a53('0x46')]);return db['JscriptySessionReport']['find'](_0x5b1d61)['then'](handleEntityNotFound(_0x265521,null))[_0x0a53('0x2b')](respondWithResult(_0x265521,null))[_0x0a53('0x4a')](handleError(_0x265521,null));};exports[_0x0a53('0x4d')]=function(_0x21848b,_0x4421b2){return db[_0x0a53('0x30')]['create'](_0x21848b[_0x0a53('0x4e')],{})[_0x0a53('0x2b')](respondWithResult(_0x4421b2,0xc9))['catch'](handleError(_0x4421b2,null));};exports[_0x0a53('0x29')]=function(_0x4ef0d1,_0x501cb3){if(_0x4ef0d1['body']['id']){delete _0x4ef0d1[_0x0a53('0x4e')]['id'];}return db[_0x0a53('0x30')][_0x0a53('0x4f')]({'where':{'id':_0x4ef0d1[_0x0a53('0x4c')]['id']}})[_0x0a53('0x2b')](handleEntityNotFound(_0x501cb3,null))[_0x0a53('0x2b')](saveUpdates(_0x4ef0d1[_0x0a53('0x4e')],null))[_0x0a53('0x2b')](respondWithResult(_0x501cb3,null))[_0x0a53('0x4a')](handleError(_0x501cb3,null));};exports[_0x0a53('0x2a')]=function(_0xd5569d,_0x3be4d8){return db[_0x0a53('0x30')]['find']({'where':{'id':_0xd5569d['params']['id']}})[_0x0a53('0x2b')](handleEntityNotFound(_0x3be4d8,null))[_0x0a53('0x2b')](removeEntity(_0x3be4d8,null))[_0x0a53('0x4a')](handleError(_0x3be4d8,null));};exports['describe']=function(_0x4e5ee7,_0x58bf9a){return db['JscriptySessionReport'][_0x0a53('0x50')]()['then'](respondWithResult(_0x58bf9a,null))['catch'](handleError(_0x58bf9a,null));};exports[_0x0a53('0x51')]=function(_0x19dab3,_0xe2693a,_0x2023b3){var _0x107330={'raw':!![],'where':{}};var _0x8757c1={};var _0x2f97dc={'count':0x0,'rows':[]};return db[_0x0a53('0x30')][_0x0a53('0x52')]({'where':{'id':_0x19dab3[_0x0a53('0x4c')]['id']}})[_0x0a53('0x2b')](handleEntityNotFound(_0xe2693a,null))[_0x0a53('0x2b')](function(_0x82598c){if(_0x82598c){_0x8757c1[_0x0a53('0x35')]=_[_0x0a53('0x37')](db[_0x0a53('0x53')]['rawAttributes']);_0x8757c1[_0x0a53('0x36')]=_[_0x0a53('0x37')](_0x19dab3[_0x0a53('0x36')]);_0x8757c1[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x8757c1[_0x0a53('0x35')],_0x8757c1[_0x0a53('0x36')]);_0x107330[_0x0a53('0x3a')]=_[_0x0a53('0x39')](_0x8757c1[_0x0a53('0x35')],qs[_0x0a53('0x3b')](_0x19dab3[_0x0a53('0x36')][_0x0a53('0x3b')]));_0x107330[_0x0a53('0x3a')]=_0x107330[_0x0a53('0x3a')][_0x0a53('0x3c')]?_0x107330[_0x0a53('0x3a')]:_0x8757c1[_0x0a53('0x35')];if(!_0x19dab3['query'][_0x0a53('0x3d')](_0x0a53('0x3e'))){_0x107330[_0x0a53('0x3f')]=qs[_0x0a53('0x3f')](_0x19dab3[_0x0a53('0x36')]['limit']);_0x107330[_0x0a53('0x24')]=qs[_0x0a53('0x24')](_0x19dab3[_0x0a53('0x36')][_0x0a53('0x24')]);}_0x107330[_0x0a53('0x40')]=qs['sort'](_0x19dab3['query'][_0x0a53('0x41')]);_0x107330[_0x0a53('0x42')]=qs[_0x0a53('0x38')](_[_0x0a53('0x43')](_0x19dab3[_0x0a53('0x36')],_0x8757c1[_0x0a53('0x38')]));_0x107330[_0x0a53('0x42')][_0x0a53('0x54')]=_0x82598c['id'];if(_0x19dab3[_0x0a53('0x36')][_0x0a53('0x44')]){_0x107330[_0x0a53('0x42')]=_[_0x0a53('0x45')](_0x107330[_0x0a53('0x42')],{'$or':_[_0x0a53('0x2f')](_0x107330[_0x0a53('0x3a')],function(_0x328574){var _0x549934={};_0x549934[_0x328574]={'$like':'%'+_0x19dab3[_0x0a53('0x36')][_0x0a53('0x44')]+'%'};return _0x549934;})});}_0x107330=_[_0x0a53('0x45')]({},_0x107330,_0x19dab3['options']);return db[_0x0a53('0x53')]['count']({'where':_0x107330['where']})[_0x0a53('0x2b')](function(_0x3ed938){_0x2f97dc[_0x0a53('0x23')]=_0x3ed938;if(_0x19dab3[_0x0a53('0x36')]['includeAll']){_0x107330[_0x0a53('0x48')]=[{'all':!![]}];}return db[_0x0a53('0x53')][_0x0a53('0x49')](_0x107330);})[_0x0a53('0x2b')](function(_0x45f682){_0x2f97dc[_0x0a53('0x55')]=_0x45f682;return _0x2f97dc;});}})[_0x0a53('0x2b')](respondWithFilteredResult(_0xe2693a,_0x107330))[_0x0a53('0x4a')](handleError(_0xe2693a,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 34333c6..1cec3f7 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 _0xdc97=['path','../../config/environment','./jscriptySessionReport.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x37026d,_0x402bf4){var _0x5b1ff2=function(_0x540b82){while(--_0x540b82){_0x37026d['push'](_0x37026d['shift']());}};_0x5b1ff2(++_0x402bf4);}(_0xdc97,0x13b));var _0x7dc9=function(_0x6a8464,_0x1bb63a){_0x6a8464=_0x6a8464-0x0;var _0x45ea2d=_0xdc97[_0x6a8464];return _0x45ea2d;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x34ac74,_0x303fe4){var _0xd0404b=function(_0x184a5b){while(--_0x184a5b){_0x34ac74['push'](_0x34ac74['shift']());}};_0xd0404b(++_0x303fe4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x31b100,_0xee690){_0x31b100=_0x31b100-0x0;var _0x32281a=_0x1cb9[_0x31b100];return _0x32281a;};'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':'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 3bac08e..fe2eb3a 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 _0xb091=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4b0c8a,_0x592927){var _0x53dba6=function(_0x435f94){while(--_0x435f94){_0x4b0c8a['push'](_0x4b0c8a['shift']());}};_0x53dba6(++_0x592927);}(_0xb091,0x16e));var _0x1b09=function(_0x135728,_0x490d8a){_0x135728=_0x135728-0x0;var _0x27935e=_0xb091[_0x135728];return _0x27935e;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var moment=require(_0x1b09('0x1'));var BPromise=require(_0x1b09('0x2'));var rs=require(_0x1b09('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b09('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b09('0x5'));var config=require(_0x1b09('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1b09('0x7')][_0x1b09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bf4f6,_0x5ce726,_0x142c33){return new BPromise(function(_0x8c26a5,_0x2f359f){return client[_0x1b09('0x9')](_0x2bf4f6,_0x142c33)[_0x1b09('0xa')](function(_0x3362e4){logger[_0x1b09('0xb')](_0x1b09('0xc'),_0x5ce726,_0x1b09('0xd'));logger[_0x1b09('0xe')](_0x1b09('0xf'),_0x5ce726,'request\x20sent',JSON[_0x1b09('0x10')](_0x3362e4));if(_0x3362e4[_0x1b09('0x11')]){if(_0x3362e4['error']['code']===0x1f4){logger[_0x1b09('0x11')](_0x1b09('0xc'),_0x5ce726,_0x3362e4[_0x1b09('0x11')][_0x1b09('0x12')]);return _0x2f359f(_0x3362e4[_0x1b09('0x11')][_0x1b09('0x12')]);}logger[_0x1b09('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x5ce726,_0x3362e4[_0x1b09('0x11')]['message']);return _0x8c26a5(_0x3362e4[_0x1b09('0x11')][_0x1b09('0x12')]);}else{logger[_0x1b09('0xb')](_0x1b09('0xc'),_0x5ce726,_0x1b09('0xd'));_0x8c26a5(_0x3362e4[_0x1b09('0x13')][_0x1b09('0x12')]);}})[_0x1b09('0x14')](function(_0x1196b2){logger[_0x1b09('0x11')](_0x1b09('0xc'),_0x5ce726,_0x1196b2);_0x2f359f(_0x1196b2);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2414fd,_0x2c704d){var _0x10515e=function(_0x52aa71){while(--_0x52aa71){_0x2414fd['push'](_0x2414fd['shift']());}};_0x10515e(++_0x2c704d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c429a3e..8c22b63 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 _0xbefb=['express','fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','update','multer','util','connect-timeout'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xbefb,0x13c));var _0xbbef=function(_0x12fdbb,_0x91185d){_0x12fdbb=_0x12fdbb-0x0;var _0xbc5361=_0xbefb[_0x12fdbb];return _0xbc5361;};'use strict';var multer=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var path=require('path');var timeout=require(_0xbbef('0x2'));var express=require(_0xbbef('0x3'));var router=express['Router']();var fs_extra=require(_0xbbef('0x4'));var auth=require(_0xbbef('0x5'));var interaction=require(_0xbbef('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0xbbef('0x7')]);router['put'](_0xbbef('0x8'),auth[_0xbbef('0x9')](),controller[_0xbbef('0xa')]);module['exports']=router; \ No newline at end of file +var _0xbe83=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','update','exports'];(function(_0x55996a,_0x43bceb){var _0x468d14=function(_0x4a85d4){while(--_0x4a85d4){_0x55996a['push'](_0x55996a['shift']());}};_0x468d14(++_0x43bceb);}(_0xbe83,0xee));var _0x3be8=function(_0x34aada,_0x1e7cb8){_0x34aada=_0x34aada-0x0;var _0x261b5c=_0xbe83[_0x34aada];return _0x261b5c;};'use strict';var multer=require(_0x3be8('0x0'));var util=require('util');var path=require(_0x3be8('0x1'));var timeout=require(_0x3be8('0x2'));var express=require(_0x3be8('0x3'));var router=express[_0x3be8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3be8('0x5'));var interaction=require(_0x3be8('0x6'));var config=require(_0x3be8('0x7'));var controller=require(_0x3be8('0x8'));router['get']('/',controller[_0x3be8('0x9')]);router[_0x3be8('0xa')](_0x3be8('0xb'),auth['isAuthenticated'](),controller[_0x3be8('0xc')]);module[_0x3be8('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ca47705..43fe4d1 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 _0x9cf4=['INTEGER','sequelize','exports','STRING'];(function(_0x48cff8,_0x3dfb37){var _0x2f9e66=function(_0x46f288){while(--_0x46f288){_0x48cff8['push'](_0x48cff8['shift']());}};_0x2f9e66(++_0x3dfb37);}(_0x9cf4,0x129));var _0x49cf=function(_0x3dd4e0,_0x8075c2){_0x3dd4e0=_0x3dd4e0-0x0;var _0xf6c70=_0x9cf4[_0x3dd4e0];return _0xf6c70;};'use strict';var Sequelize=require(_0x49cf('0x0'));module[_0x49cf('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x49cf('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x49cf('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf024=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xf024,0x1ad));var _0x4f02=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xf024[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x4f02('0x0'));module[_0x4f02('0x1')]={'license':{'type':Sequelize[_0x4f02('0x2')]},'data1':{'type':Sequelize[_0x4f02('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x4f02('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6d9c9f1..9c40060 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 _0x4975=['name','index','model','query','keys','intersection','fields','attributes','length','options','getLicense','catch','body','License','find','params','get','key','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x3611a7,_0x59563c){var _0x569692=function(_0x5bbdc7){while(--_0x5bbdc7){_0x3611a7['push'](_0x3611a7['shift']());}};_0x569692(++_0x59563c);}(_0x4975,0x86));var _0x5497=function(_0xc497a0,_0x26b422){_0xc497a0=_0xc497a0-0x0;var _0x32922d=_0x4975[_0xc497a0];return _0x32922d;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}var utilLicense=require('../../config/license/util');exports[_0x5497('0x29')]=function(_0x48d146,_0x5e9356){var _0xc3465={'raw':!![],'where':{'id':0x1}},_0xb14593={};_0xb14593[_0x5497('0x2a')]=_['keys'](db['License']['rawAttributes']);_0xb14593[_0x5497('0x2b')]=_[_0x5497('0x2c')](_0x48d146[_0x5497('0x2b')]);_0xb14593['filters']=_['intersection'](_0xb14593['model'],_0xb14593[_0x5497('0x2b')]);_0xc3465['attributes']=_[_0x5497('0x2d')](_0xb14593[_0x5497('0x2a')],qs[_0x5497('0x2e')](_0x48d146['query'][_0x5497('0x2e')]));_0xc3465[_0x5497('0x2f')]=_0xc3465['attributes'][_0x5497('0x30')]?_0xc3465[_0x5497('0x2f')]:_0xb14593[_0x5497('0x2a')];_0xc3465=_['merge']({},_0xc3465,_0x48d146[_0x5497('0x31')]);return utilLicense[_0x5497('0x32')](_0xc3465)[_0x5497('0x24')](respondWithResult(_0x5e9356,null))[_0x5497('0x33')](handleError(_0x5e9356,null));};exports[_0x5497('0x23')]=function(_0x4a6459,_0x386845){if(_0x4a6459[_0x5497('0x34')]['id']){delete _0x4a6459['body']['id'];}return db[_0x5497('0x35')][_0x5497('0x36')]({'where':{'id':_0x4a6459[_0x5497('0x37')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x386845,null))[_0x5497('0x24')](function(_0x37011c){var _0x580e86=_0x37011c[_0x5497('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x580e86,_0x4a6459[_0x5497('0x34')][_0x5497('0x39')]);})[_0x5497('0x24')](function(_0x5ab18c){if(!_0x5ab18c['demo']){return saveUpdates(_0x4a6459[_0x5497('0x34')],null);}return _0x5ab18c;})[_0x5497('0x24')](respondWithResult(_0x386845,null))[_0x5497('0x33')](handleError(_0x386845,null));}; \ No newline at end of file +var _0xf494=['fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','../../config/license/util','index','model','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf494,0x1c6));var _0x4f49=function(_0x3fa529,_0x3c341e){_0x3fa529=_0x3fa529-0x0;var _0x350134=_0xf494[_0x3fa529];return _0x350134;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}var utilLicense=require(_0x4f49('0x29'));exports[_0x4f49('0x2a')]=function(_0x605c91,_0x560050){var _0x3cbfbd={'raw':!![],'where':{'id':0x1}},_0x206203={};_0x206203[_0x4f49('0x2b')]=_['keys'](db['License'][_0x4f49('0x2c')]);_0x206203[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x605c91['query']);_0x206203[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],_0x206203[_0x4f49('0x2d')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],qs[_0x4f49('0x32')](_0x605c91[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x3cbfbd[_0x4f49('0x31')]=_0x3cbfbd[_0x4f49('0x31')][_0x4f49('0x33')]?_0x3cbfbd[_0x4f49('0x31')]:_0x206203[_0x4f49('0x2b')];_0x3cbfbd=_[_0x4f49('0x34')]({},_0x3cbfbd,_0x605c91[_0x4f49('0x35')]);return utilLicense[_0x4f49('0x36')](_0x3cbfbd)[_0x4f49('0x25')](respondWithResult(_0x560050,null))['catch'](handleError(_0x560050,null));};exports[_0x4f49('0x24')]=function(_0x46b7ba,_0x24f568){if(_0x46b7ba[_0x4f49('0x37')]['id']){delete _0x46b7ba[_0x4f49('0x37')]['id'];}return db[_0x4f49('0x38')][_0x4f49('0x39')]({'where':{'id':_0x46b7ba[_0x4f49('0x3a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x24f568,null))[_0x4f49('0x25')](function(_0x44e6a0){var _0x343365=_0x44e6a0[_0x4f49('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x343365,_0x46b7ba[_0x4f49('0x37')][_0x4f49('0x3c')]);})[_0x4f49('0x25')](function(_0x26014f){if(!_0x26014f[_0x4f49('0x3d')]){return saveUpdates(_0x46b7ba[_0x4f49('0x37')],null);}return _0x26014f;})[_0x4f49('0x25')](respondWithResult(_0x24f568,null))[_0x4f49('0x3e')](handleError(_0x24f568,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7eb1962..c4f560b 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 _0x74cf=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','License','license'];(function(_0x34aef5,_0x33dffb){var _0x48dddc=function(_0x3e8ab2){while(--_0x3e8ab2){_0x34aef5['push'](_0x34aef5['shift']());}};_0x48dddc(++_0x33dffb);}(_0x74cf,0x11e));var _0xf74c=function(_0x58779c,_0xe8471b){_0x58779c=_0x58779c-0x0;var _0x5e1897=_0x74cf[_0x58779c];return _0x5e1897;};'use strict';var _=require(_0xf74c('0x0'));var util=require(_0xf74c('0x1'));var logger=require(_0xf74c('0x2'))('api');var moment=require(_0xf74c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf74c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf74c('0x5'));var config=require(_0xf74c('0x6'));var attributes=require('./license.attributes');module[_0xf74c('0x7')]=function(_0x299240,_0x76a5b2){return _0x299240[_0xf74c('0x8')](_0xf74c('0x9'),attributes,{'tableName':_0xf74c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x573c=['define','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x59f386,_0x49643f){var _0x11df6b=function(_0x3c2945){while(--_0x3c2945){_0x59f386['push'](_0x59f386['shift']());}};_0x11df6b(++_0x49643f);}(_0x573c,0x1ed));var _0xc573=function(_0x455dec,_0x443b92){_0x455dec=_0x455dec-0x0;var _0x566161=_0x573c[_0x455dec];return _0x566161;};'use strict';var _=require(_0xc573('0x0'));var util=require(_0xc573('0x1'));var logger=require(_0xc573('0x2'))(_0xc573('0x3'));var moment=require(_0xc573('0x4'));var BPromise=require(_0xc573('0x5'));var rp=require(_0xc573('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc573('0x7'));var config=require(_0xc573('0x8'));var attributes=require(_0xc573('0x9'));module[_0xc573('0xa')]=function(_0x8dc94d,_0x9c0926){return _0x8dc94d[_0xc573('0xb')](_0xc573('0xc'),attributes,{'tableName':_0xc573('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 c6300bf..50143c4 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 _0xabcf=['../../config/utils','../../config/logger','../../config/environment','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb'];(function(_0x124c7b,_0x8c053e){var _0x37f3e5=function(_0x374cdb){while(--_0x374cdb){_0x124c7b['push'](_0x124c7b['shift']());}};_0x37f3e5(++_0x8c053e);}(_0xabcf,0x150));var _0xfabc=function(_0xbf81ca,_0x303494){_0xbf81ca=_0xbf81ca-0x0;var _0xf22932=_0xabcf[_0xbf81ca];return _0xf22932;};'use strict';var _=require(_0xfabc('0x0'));var util=require(_0xfabc('0x1'));var moment=require(_0xfabc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfabc('0x3'))['db'];var utils=require(_0xfabc('0x4'));var logger=require(_0xfabc('0x5'))('rpc');var config=require(_0xfabc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfabc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ac921,_0x2d7bd0,_0x5b8234){return new BPromise(function(_0x3f440a,_0x47dc85){return client[_0xfabc('0x8')](_0x4ac921,_0x5b8234)[_0xfabc('0x9')](function(_0x4b3db9){logger[_0xfabc('0xa')](_0xfabc('0xb'),_0x2d7bd0,_0xfabc('0xc'));logger['debug'](_0xfabc('0xd'),_0x2d7bd0,_0xfabc('0xc'),JSON[_0xfabc('0xe')](_0x4b3db9));if(_0x4b3db9[_0xfabc('0xf')]){if(_0x4b3db9['error'][_0xfabc('0x10')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x2d7bd0,_0x4b3db9[_0xfabc('0xf')][_0xfabc('0x11')]);return _0x47dc85(_0x4b3db9['error'][_0xfabc('0x11')]);}logger['error']('License,\x20%s,\x20%s',_0x2d7bd0,_0x4b3db9[_0xfabc('0xf')][_0xfabc('0x11')]);return _0x3f440a(_0x4b3db9[_0xfabc('0xf')][_0xfabc('0x11')]);}else{logger['info'](_0xfabc('0xb'),_0x2d7bd0,'request\x20sent');_0x3f440a(_0x4b3db9[_0xfabc('0x12')][_0xfabc('0x11')]);}})[_0xfabc('0x13')](function(_0x17fd87){logger[_0xfabc('0xf')]('License,\x20%s,\x20%s',_0x2d7bd0,_0x17fd87);_0x47dc85(_0x17fd87);});});} \ No newline at end of file +var _0xe2ea=['rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xe2ea,0x101));var _0xae2e=function(_0x3305cb,_0x54f1bf){_0x3305cb=_0x3305cb-0x0;var _0x3d9c96=_0xe2ea[_0x3305cb];return _0x3d9c96;};'use strict';var _=require(_0xae2e('0x0'));var util=require(_0xae2e('0x1'));var moment=require('moment');var BPromise=require(_0xae2e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae2e('0x3'));var db=require(_0xae2e('0x4'))['db'];var utils=require(_0xae2e('0x5'));var logger=require(_0xae2e('0x6'))(_0xae2e('0x7'));var config=require(_0xae2e('0x8'));var jayson=require(_0xae2e('0x9'));var client=jayson[_0xae2e('0xa')][_0xae2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x544258,_0x4a5cc0,_0xc3b612){return new BPromise(function(_0x324f67,_0x3c8c0f){return client[_0xae2e('0xc')](_0x544258,_0xc3b612)['then'](function(_0x51fdf3){logger[_0xae2e('0xd')](_0xae2e('0xe'),_0x4a5cc0,'request\x20sent');logger['debug'](_0xae2e('0xf'),_0x4a5cc0,_0xae2e('0x10'),JSON[_0xae2e('0x11')](_0x51fdf3));if(_0x51fdf3[_0xae2e('0x12')]){if(_0x51fdf3[_0xae2e('0x12')]['code']===0x1f4){logger[_0xae2e('0x12')](_0xae2e('0xe'),_0x4a5cc0,_0x51fdf3[_0xae2e('0x12')][_0xae2e('0x13')]);return _0x3c8c0f(_0x51fdf3[_0xae2e('0x12')][_0xae2e('0x13')]);}logger['error'](_0xae2e('0xe'),_0x4a5cc0,_0x51fdf3[_0xae2e('0x12')][_0xae2e('0x13')]);return _0x324f67(_0x51fdf3[_0xae2e('0x12')]['message']);}else{logger[_0xae2e('0xd')]('License,\x20%s,\x20%s',_0x4a5cc0,_0xae2e('0x10'));_0x324f67(_0x51fdf3[_0xae2e('0x14')]['message']);}})[_0xae2e('0x15')](function(_0x5c7085){logger['error'](_0xae2e('0xe'),_0x4a5cc0,_0x5c7085);_0x3c8c0f(_0x5c7085);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0cc0073..5b084a6 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 _0x8b30=['/:id/interactions','addInteraction','addApplications','send','addAgents','update','delete','/:id/dispositions','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','post','addAnswer','addImap','addSmtp'];(function(_0x5444ba,_0x4daadd){var _0x4b1333=function(_0x587534){while(--_0x587534){_0x5444ba['push'](_0x5444ba['shift']());}};_0x4b1333(++_0x4daadd);}(_0x8b30,0x11a));var _0x08b3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8b30[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var path=require(_0x08b3('0x2'));var timeout=require(_0x08b3('0x3'));var express=require('express');var router=express[_0x08b3('0x4')]();var fs_extra=require(_0x08b3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x08b3('0x6'));var config=require(_0x08b3('0x7'));var controller=require(_0x08b3('0x8'));router[_0x08b3('0x9')]('/',auth[_0x08b3('0xa')](),controller[_0x08b3('0xb')]);router[_0x08b3('0x9')]('/describe',auth[_0x08b3('0xa')](),controller[_0x08b3('0xc')]);router[_0x08b3('0x9')](_0x08b3('0xd'),auth[_0x08b3('0xa')](),controller['show']);router[_0x08b3('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x08b3('0x9')](_0x08b3('0xe'),auth[_0x08b3('0xa')](),controller[_0x08b3('0xf')]);router[_0x08b3('0x9')](_0x08b3('0x10'),auth['isAuthenticated'](),controller[_0x08b3('0x11')]);router['get'](_0x08b3('0x12'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x13')]);router[_0x08b3('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x08b3('0x14')]);router[_0x08b3('0x9')](_0x08b3('0x15'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x16')]);router[_0x08b3('0x9')](_0x08b3('0x17'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x18')]);router[_0x08b3('0x9')](_0x08b3('0x19'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x1a')]);router[_0x08b3('0x9')](_0x08b3('0x1b'),auth[_0x08b3('0xa')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x08b3('0xa')](),controller[_0x08b3('0x1c')]);router[_0x08b3('0x1d')](_0x08b3('0xe'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x1e')]);router[_0x08b3('0x1d')]('/',auth['isAuthenticated'](),controller['create']);router[_0x08b3('0x1d')](_0x08b3('0x10'),auth['isAuthenticated'](),controller[_0x08b3('0x1f')]);router[_0x08b3('0x1d')](_0x08b3('0x12'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x20')]);router[_0x08b3('0x1d')](_0x08b3('0x21'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x22')]);router['post']('/:id/applications',auth[_0x08b3('0xa')](),controller[_0x08b3('0x23')]);router[_0x08b3('0x1d')]('/:id/send',auth[_0x08b3('0xa')](),controller[_0x08b3('0x24')]);router[_0x08b3('0x1d')](_0x08b3('0x1b'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x08b3('0x26')]);router[_0x08b3('0x27')](_0x08b3('0x28'),auth[_0x08b3('0xa')](),controller['removeDispositions']);router['delete'](_0x08b3('0xe'),auth[_0x08b3('0xa')](),controller['removeAnswers']);router[_0x08b3('0x27')](_0x08b3('0x10'),auth[_0x08b3('0xa')](),controller['removeImap']);router[_0x08b3('0x27')](_0x08b3('0x12'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x29')]);router[_0x08b3('0x27')](_0x08b3('0xd'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x2a')]);router['delete'](_0x08b3('0x1b'),auth[_0x08b3('0xa')](),controller[_0x08b3('0x2b')]);module[_0x08b3('0x2c')]=router; \ No newline at end of file +var _0x6f06=['addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6f06,0x1b4));var _0x66f0=function(_0x8806f5,_0x259bc6){_0x8806f5=_0x8806f5-0x0;var _0x39a9a8=_0x6f06[_0x8806f5];return _0x39a9a8;};'use strict';var multer=require(_0x66f0('0x0'));var util=require(_0x66f0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x66f0('0x2'));var router=express['Router']();var fs_extra=require(_0x66f0('0x3'));var auth=require(_0x66f0('0x4'));var interaction=require(_0x66f0('0x5'));var config=require(_0x66f0('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x66f0('0x7')](),controller['index']);router[_0x66f0('0x8')](_0x66f0('0x9'),auth[_0x66f0('0x7')](),controller[_0x66f0('0xa')]);router[_0x66f0('0x8')](_0x66f0('0xb'),auth[_0x66f0('0x7')](),controller[_0x66f0('0xc')]);router[_0x66f0('0x8')]('/:id/dispositions',auth[_0x66f0('0x7')](),controller[_0x66f0('0xd')]);router[_0x66f0('0x8')](_0x66f0('0xe'),auth[_0x66f0('0x7')](),controller[_0x66f0('0xf')]);router['get'](_0x66f0('0x10'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x11')]);router[_0x66f0('0x8')](_0x66f0('0x12'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x13')]);router[_0x66f0('0x8')](_0x66f0('0x14'),auth['isAuthenticated'](),controller[_0x66f0('0x15')]);router[_0x66f0('0x8')](_0x66f0('0x16'),auth[_0x66f0('0x7')](),controller['getApplications']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x66f0('0x17')]);router[_0x66f0('0x8')](_0x66f0('0x18'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x19')]);router[_0x66f0('0x8')](_0x66f0('0x1a'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x1b')]);router['post'](_0x66f0('0x1c'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x1d')]);router[_0x66f0('0x1e')](_0x66f0('0xe'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x1f')]);router[_0x66f0('0x1e')]('/',auth['isAuthenticated'](),controller[_0x66f0('0x20')]);router['post'](_0x66f0('0x10'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x21')]);router[_0x66f0('0x1e')]('/:id/out_servers',auth[_0x66f0('0x7')](),controller[_0x66f0('0x22')]);router['post'](_0x66f0('0x14'),auth['isAuthenticated'](),controller[_0x66f0('0x23')]);router[_0x66f0('0x1e')](_0x66f0('0x16'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x24')]);router[_0x66f0('0x1e')](_0x66f0('0x25'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x26')]);router['post'](_0x66f0('0x1a'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x27')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x66f0('0x28')]);router['delete'](_0x66f0('0x1c'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x29')]);router[_0x66f0('0x2a')](_0x66f0('0xe'),auth[_0x66f0('0x7')](),controller['removeAnswers']);router['delete'](_0x66f0('0x10'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x2b')]);router[_0x66f0('0x2a')](_0x66f0('0x12'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x2c')]);router[_0x66f0('0x2a')](_0x66f0('0xb'),auth[_0x66f0('0x7')](),controller[_0x66f0('0x2d')]);router['delete'](_0x66f0('0x1a'),auth['isAuthenticated'](),controller[_0x66f0('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 140ca6b..37bdc3b 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 _0x24cd=['mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x549f1a,_0xeace82){var _0x141c66=function(_0x240d4a){while(--_0x240d4a){_0x549f1a['push'](_0x549f1a['shift']());}};_0x141c66(++_0xeace82);}(_0x24cd,0x83));var _0xd24c=function(_0x1ecfb3,_0x3a52b6){_0x1ecfb3=_0x1ecfb3-0x0;var _0x1c40ef=_0x24cd[_0x1ecfb3];return _0x1c40ef;};'use strict';var Sequelize=require(_0xd24c('0x0'));module[_0xd24c('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd24c('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd24c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd24c('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd24c('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd24c('0x4')](0x2)[_0xd24c('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd24c('0x6')],'defaultValue':function(){return _0xd24c('0x7');}},'notificationSound':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd24c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd24c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd24c('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xd24c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![],'comment':_0xd24c('0x9'),'set':function(_0x1aa701){if(!_0x1aa701)this[_0xd24c('0xa')](_0xd24c('0xb'),null);this['setDataValue'](_0xd24c('0xc'),_0x1aa701);}}}; \ No newline at end of file +var _0x3c7b=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x24a205,_0x406ecf){var _0xb31e86=function(_0x3f7992){while(--_0x3f7992){_0x24a205['push'](_0x24a205['shift']());}};_0xb31e86(++_0x406ecf);}(_0x3c7b,0x11d));var _0xb3c7=function(_0xc9a582,_0x54d7c4){_0xc9a582=_0xc9a582-0x0;var _0x144937=_0x3c7b[_0xc9a582];return _0x144937;};'use strict';var Sequelize=require(_0xb3c7('0x0'));module[_0xb3c7('0x1')]={'description':{'type':Sequelize[_0xb3c7('0x2')]},'name':{'type':Sequelize[_0xb3c7('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xb3c7('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb3c7('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb3c7('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xb3c7('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb3c7('0x5')],'defaultValue':function(){return _0xb3c7('0x6');}},'notificationSound':{'type':Sequelize[_0xb3c7('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb3c7('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb3c7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb3c7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb3c7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb3c7('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xb3c7('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb3c7('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3bb4f1){if(!_0x3bb4f1)this[_0xb3c7('0x8')]('mandatoryDispositionPauseId',null);this[_0xb3c7('0x8')](_0xb3c7('0x9'),_0x3bb4f1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a16443b..7503f7b 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 _0x0184=['Pause','map','MailAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','params','Imap','mandatoryDispositionPause','keys','fields','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','options','rows','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','ListId','active','description','isNil','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','color','tag','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','juice','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','MailAccounts','UserProfileResource','name','index','MailServerIn','MailServerOut','Smtp'];(function(_0x3f5290,_0x53c67c){var _0x8a452d=function(_0x312179){while(--_0x312179){_0x3f5290['push'](_0x3f5290['shift']());}};_0x8a452d(++_0x53c67c);}(_0x0184,0x14e));var _0x4018=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x0184[_0x75ce5b];return _0x22195e;};'use strict';var emlformat=require(_0x4018('0x0'));var rimraf=require(_0x4018('0x1'));var zipdir=require(_0x4018('0x2'));var jsonpatch=require(_0x4018('0x3'));var rp=require('request-promise');var moment=require(_0x4018('0x4'));var BPromise=require(_0x4018('0x5'));var Mustache=require('mustache');var util=require(_0x4018('0x6'));var path=require(_0x4018('0x7'));var sox=require(_0x4018('0x8'));var csv=require(_0x4018('0x9'));var ejs=require(_0x4018('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4018('0xb'));var jsforce=require(_0x4018('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4018('0x9'));var querystring=require(_0x4018('0xd'));var Papa=require(_0x4018('0xe'));var htmlToText=require('html-to-text');var juice=require(_0x4018('0xf'));var Redis=require(_0x4018('0x10'));var authService=require(_0x4018('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4018('0x12'));var logger=require(_0x4018('0x13'))(_0x4018('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4018('0x15'));var db=require(_0x4018('0x16'))['db'];config[_0x4018('0x17')]=_[_0x4018('0x18')](config[_0x4018('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4018('0x19'))(new Redis(config[_0x4018('0x17')]));require(_0x4018('0x1a'))[_0x4018('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4018('0x1c')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4f50e6,_0x20ecfd,_0x142550,_0x76cb89){return new BPromise(function(_0x178cce,_0x210022){var _0x1578fb=_0x76cb89||client;return _0x1578fb[_0x4018('0x1d')](_0x4f50e6,_0x142550)[_0x4018('0x1e')](function(_0x575cc2){logger[_0x4018('0x1f')](_0x4018('0x20'),_0x20ecfd,_0x4018('0x21'));logger[_0x4018('0x22')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x20ecfd,_0x4018('0x21'),JSON[_0x4018('0x23')](_0x575cc2));if(_0x575cc2[_0x4018('0x24')]){if(_0x575cc2[_0x4018('0x24')][_0x4018('0x25')]===0x1f4){logger[_0x4018('0x24')]('MailAccount,\x20%s,\x20%s',_0x20ecfd,_0x575cc2['error']['message']);return _0x210022(_0x575cc2[_0x4018('0x24')]['message']);}logger[_0x4018('0x24')](_0x4018('0x20'),_0x20ecfd,_0x575cc2[_0x4018('0x24')][_0x4018('0x26')]);return _0x178cce(_0x575cc2[_0x4018('0x24')]['message']);}else{logger[_0x4018('0x1f')](_0x4018('0x20'),_0x20ecfd,_0x4018('0x21'));_0x178cce(_0x575cc2[_0x4018('0x27')][_0x4018('0x26')]);}})['catch'](function(_0xa093d2){logger['error']('MailAccount,\x20%s,\x20%s',_0x20ecfd,_0xa093d2);_0x210022(_0xa093d2);});});}function respondWithStatusCode(_0x27ec06,_0x3c9187){_0x3c9187=_0x3c9187||0xcc;return function(_0xa97734){if(_0xa97734){return _0x27ec06[_0x4018('0x28')](_0x3c9187);}return _0x27ec06['status'](_0x3c9187)[_0x4018('0x29')]();};}function respondWithResult(_0x1a3bca,_0x26f737){_0x26f737=_0x26f737||0xc8;return function(_0xdfe5ac){if(_0xdfe5ac){return _0x1a3bca[_0x4018('0x2a')](_0x26f737)[_0x4018('0x2b')](_0xdfe5ac);}};}function respondWithFilteredResult(_0x5de8cc,_0x4afd88){return function(_0x592f6f){if(_0x592f6f){var _0x2e9ab5=typeof _0x4afd88[_0x4018('0x2c')]===_0x4018('0x2d')&&typeof _0x4afd88[_0x4018('0x2e')]===_0x4018('0x2d');var _0xdbbe61=_0x592f6f[_0x4018('0x2f')];var _0x8a8558=_0x2e9ab5?0x0:_0x4afd88[_0x4018('0x2c')];var _0xaa5ce3=_0x2e9ab5?_0x592f6f[_0x4018('0x2f')]:_0x4afd88[_0x4018('0x2c')]+_0x4afd88[_0x4018('0x2e')];var _0x51db07;if(_0xaa5ce3>=_0xdbbe61){_0xaa5ce3=_0xdbbe61;_0x51db07=0xc8;}else{_0x51db07=0xce;}_0x5de8cc[_0x4018('0x2a')](_0x51db07);return _0x5de8cc[_0x4018('0x30')](_0x4018('0x31'),_0x8a8558+'-'+_0xaa5ce3+'/'+_0xdbbe61)['json'](_0x592f6f);}return null;};}function patchUpdates(_0x225e48){return function(_0x138d04){try{jsonpatch[_0x4018('0x32')](_0x138d04,_0x225e48,!![]);}catch(_0x4773e7){return BPromise[_0x4018('0x33')](_0x4773e7);}return _0x138d04['save']();};}function saveUpdates(_0x4a62cf,_0xb10845){return function(_0x1d2c42){if(_0x1d2c42){return _0x1d2c42[_0x4018('0x34')](_0x4a62cf)[_0x4018('0x1e')](function(_0x3ba53d){return _0x3ba53d;});}return null;};}function removeEntity(_0x4dcc8f,_0xaeb597){return function(_0xc6345){if(_0xc6345){return _0xc6345[_0x4018('0x35')]()['then'](function(){var _0x1022de=_0xc6345[_0x4018('0x36')]({'plain':!![]});var _0x938c7d=_0x4018('0x37');return db[_0x4018('0x38')][_0x4018('0x35')]({'where':{'type':_0x938c7d,'resourceId':_0x1022de['id']}})[_0x4018('0x1e')](function(){return _0xc6345;});})['then'](function(){_0x4dcc8f[_0x4018('0x2a')](0xcc)[_0x4018('0x29')]();});}};}function handleEntityNotFound(_0x49d40e,_0xf48539){return function(_0x47b506){if(!_0x47b506){_0x49d40e[_0x4018('0x28')](0x194);}return _0x47b506;};}function handleError(_0x58170d,_0x2d8d7e){_0x2d8d7e=_0x2d8d7e||0x1f4;return function(_0x4f4a4e){logger[_0x4018('0x24')](_0x4f4a4e['stack']);if(_0x4f4a4e[_0x4018('0x39')]){delete _0x4f4a4e[_0x4018('0x39')];}_0x58170d[_0x4018('0x2a')](_0x2d8d7e)['send'](_0x4f4a4e);};}exports[_0x4018('0x3a')]=function(_0x3ba454,_0x350a22){var _0x2b0f77={'include':[{'model':db[_0x4018('0x3b')],'as':'Imap'},{'model':db[_0x4018('0x3c')],'as':_0x4018('0x3d')},{'model':db[_0x4018('0x3e')],'as':'mandatoryDispositionPause'}]},_0x2ac88b={},_0x49c728={'count':0x0,'rows':[]};var _0x1e9782=_[_0x4018('0x3f')](db[_0x4018('0x40')][_0x4018('0x41')],function(_0x2af207){return{'name':_0x2af207['fieldName'],'type':_0x2af207[_0x4018('0x42')][_0x4018('0x43')]};});_0x2ac88b[_0x4018('0x44')]=_[_0x4018('0x3f')](_0x1e9782,_0x4018('0x39'));_0x2ac88b[_0x4018('0x45')]=_['keys'](_0x3ba454[_0x4018('0x45')]);_0x2ac88b[_0x4018('0x46')]=_[_0x4018('0x47')](_0x2ac88b['model'],_0x2ac88b[_0x4018('0x45')]);_0x2b0f77[_0x4018('0x48')]=_[_0x4018('0x47')](_0x2ac88b[_0x4018('0x44')],qs['fields'](_0x3ba454['query']['fields']));_0x2b0f77[_0x4018('0x48')]=_0x2b0f77[_0x4018('0x48')][_0x4018('0x49')]?_0x2b0f77['attributes']:_0x2ac88b['model'];if(!_0x3ba454['query'][_0x4018('0x4a')](_0x4018('0x4b'))){_0x2b0f77[_0x4018('0x2e')]=qs[_0x4018('0x2e')](_0x3ba454[_0x4018('0x45')][_0x4018('0x2e')]);_0x2b0f77[_0x4018('0x2c')]=qs[_0x4018('0x2c')](_0x3ba454[_0x4018('0x45')]['offset']);}_0x2b0f77[_0x4018('0x4c')]=qs[_0x4018('0x4d')](_0x3ba454[_0x4018('0x45')]['sort']);_0x2b0f77['where']=qs[_0x4018('0x46')](_[_0x4018('0x4e')](_0x3ba454['query'],_0x2ac88b[_0x4018('0x46')]),_0x1e9782);if(_0x3ba454['query'][_0x4018('0x4f')]){_0x2b0f77[_0x4018('0x50')]=_[_0x4018('0x51')](_0x2b0f77[_0x4018('0x50')],{'$or':_[_0x4018('0x3f')](_0x1e9782,function(_0x32e953){if(_0x32e953[_0x4018('0x42')]!==_0x4018('0x52')){var _0x551c56={};_0x551c56[_0x32e953[_0x4018('0x39')]]={'$like':'%'+_0x3ba454['query'][_0x4018('0x4f')]+'%'};return _0x551c56;}})});}_0x2b0f77=_[_0x4018('0x51')]({},_0x2b0f77,_0x3ba454['options']);var _0x5484b3={'where':_0x2b0f77['where']};return db[_0x4018('0x40')]['count'](_0x5484b3)[_0x4018('0x1e')](function(_0x32c97e){_0x49c728[_0x4018('0x2f')]=_0x32c97e;if(_0x3ba454[_0x4018('0x45')][_0x4018('0x53')]){_0x2b0f77['include']=[{'all':!![]}];}return db['MailAccount'][_0x4018('0x54')](_0x2b0f77);})['then'](function(_0x247c88){_0x49c728['rows']=_0x247c88;return _0x49c728;})[_0x4018('0x1e')](respondWithFilteredResult(_0x350a22,_0x2b0f77))[_0x4018('0x55')](handleError(_0x350a22,null));};exports['show']=function(_0x5f3135,_0x3e8e3c){var _0x43ca12={'raw':![],'where':{'id':_0x5f3135[_0x4018('0x56')]['id']},'include':[{'model':db[_0x4018('0x3b')],'as':_0x4018('0x57')},{'model':db[_0x4018('0x3c')],'as':_0x4018('0x3d')},{'model':db[_0x4018('0x3e')],'as':_0x4018('0x58')}]},_0x1ffcbf={};_0x1ffcbf[_0x4018('0x44')]=_[_0x4018('0x59')](db[_0x4018('0x40')][_0x4018('0x41')]);_0x1ffcbf[_0x4018('0x45')]=_[_0x4018('0x59')](_0x5f3135[_0x4018('0x45')]);_0x1ffcbf[_0x4018('0x46')]=_[_0x4018('0x47')](_0x1ffcbf[_0x4018('0x44')],_0x1ffcbf['query']);_0x43ca12[_0x4018('0x48')]=_[_0x4018('0x47')](_0x1ffcbf[_0x4018('0x44')],qs[_0x4018('0x5a')](_0x5f3135[_0x4018('0x45')][_0x4018('0x5a')]));_0x43ca12[_0x4018('0x48')]=_0x43ca12[_0x4018('0x48')][_0x4018('0x49')]?_0x43ca12[_0x4018('0x48')]:_0x1ffcbf['model'];if(_0x5f3135[_0x4018('0x45')]['includeAll']){_0x43ca12[_0x4018('0x5b')]=[{'all':!![]}];}_0x43ca12=_[_0x4018('0x51')]({},_0x43ca12,_0x5f3135['options']);return db[_0x4018('0x40')][_0x4018('0x5c')](_0x43ca12)[_0x4018('0x1e')](handleEntityNotFound(_0x3e8e3c,null))[_0x4018('0x1e')](respondWithResult(_0x3e8e3c,null))[_0x4018('0x55')](handleError(_0x3e8e3c,null));};exports[_0x4018('0x34')]=function(_0xa2311c,_0x3ac86c){if(_0xa2311c[_0x4018('0x5d')]['id']){delete _0xa2311c['body']['id'];}return db[_0x4018('0x40')][_0x4018('0x5c')]({'where':{'id':_0xa2311c[_0x4018('0x56')]['id']},'include':[{'model':db[_0x4018('0x3b')],'as':_0x4018('0x57')},{'model':db['MailServerOut'],'as':_0x4018('0x3d')},{'model':db[_0x4018('0x3e')],'as':_0x4018('0x58')}]})[_0x4018('0x1e')](handleEntityNotFound(_0x3ac86c,null))[_0x4018('0x1e')](saveUpdates(_0xa2311c[_0x4018('0x5d')],null))[_0x4018('0x1e')](function(_0x1174bd){if(_0x1174bd&&_0xa2311c['body'][_0x4018('0x57')]){return db[_0x4018('0x3b')]['update'](_0xa2311c[_0x4018('0x5d')][_0x4018('0x57')],{'where':{'MailAccountId':_0x1174bd['id']}})[_0x4018('0x1e')](function(){return _0x1174bd;});}return _0x1174bd;})['then'](function(_0x5e35b8){if(_0x5e35b8&&_0xa2311c[_0x4018('0x5d')][_0x4018('0x3d')]){return db[_0x4018('0x3c')][_0x4018('0x34')](_0xa2311c[_0x4018('0x5d')]['Smtp'],{'where':{'MailAccountId':_0x5e35b8['id']}})[_0x4018('0x1e')](function(){return _0x5e35b8;});}return _0x5e35b8;})[_0x4018('0x1e')](respondWithResult(_0x3ac86c,null))['catch'](handleError(_0x3ac86c,null));};exports[_0x4018('0x5e')]=function(_0x403979,_0x3bd4d3){return db['MailAccount'][_0x4018('0x5e')]()[_0x4018('0x1e')](respondWithResult(_0x3bd4d3,null))[_0x4018('0x55')](handleError(_0x3bd4d3,null));};exports[_0x4018('0x5f')]=function(_0x57bf6f,_0x6964b,_0x2adb8a){if(_0x57bf6f[_0x4018('0x5d')]['id']){delete _0x57bf6f[_0x4018('0x5d')]['id'];}return db[_0x4018('0x40')][_0x4018('0x5c')]({'where':{'id':_0x57bf6f[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x6964b,null))[_0x4018('0x1e')](function(_0xf6fc7e){if(_0xf6fc7e){_0x57bf6f['body'][_0x4018('0x60')]=_0xf6fc7e['id'];return db[_0x4018('0x61')][_0x4018('0x62')](_0x57bf6f[_0x4018('0x5d')]);}})['then'](respondWithResult(_0x6964b,null))['catch'](handleError(_0x6964b,null));};exports[_0x4018('0x63')]=function(_0x2dc97e,_0x5b10e7,_0x112e13){var _0x190136={'raw':![],'where':{}};var _0x26de31={};var _0x1125c6={'count':0x0,'rows':[]};return db[_0x4018('0x40')]['findOne']({'where':{'id':_0x2dc97e['params']['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x5b10e7,null))['then'](function(_0x6029e8){if(_0x6029e8){_0x26de31[_0x4018('0x44')]=_[_0x4018('0x59')](db[_0x4018('0x61')][_0x4018('0x41')]);_0x26de31[_0x4018('0x45')]=_[_0x4018('0x59')](_0x2dc97e[_0x4018('0x45')]);_0x26de31[_0x4018('0x46')]=_[_0x4018('0x47')](_0x26de31['model'],_0x26de31['query']);_0x190136[_0x4018('0x48')]=_[_0x4018('0x47')](_0x26de31[_0x4018('0x44')],qs[_0x4018('0x5a')](_0x2dc97e[_0x4018('0x45')][_0x4018('0x5a')]));_0x190136[_0x4018('0x48')]=_0x190136[_0x4018('0x48')][_0x4018('0x49')]?_0x190136['attributes']:_0x26de31[_0x4018('0x44')];if(!_0x2dc97e[_0x4018('0x45')][_0x4018('0x4a')](_0x4018('0x4b'))){_0x190136['limit']=qs['limit'](_0x2dc97e['query'][_0x4018('0x2e')]);_0x190136[_0x4018('0x2c')]=qs[_0x4018('0x2c')](_0x2dc97e['query'][_0x4018('0x2c')]);}_0x190136[_0x4018('0x4c')]=qs[_0x4018('0x4d')](_0x2dc97e[_0x4018('0x45')][_0x4018('0x4d')]);_0x190136[_0x4018('0x50')]=qs[_0x4018('0x46')](_[_0x4018('0x4e')](_0x2dc97e[_0x4018('0x45')],_0x26de31[_0x4018('0x46')]));_0x190136[_0x4018('0x50')][_0x4018('0x60')]=_0x6029e8['id'];if(_0x2dc97e[_0x4018('0x45')]['filter']){_0x190136[_0x4018('0x50')]=_['merge'](_0x190136[_0x4018('0x50')],{'$or':_[_0x4018('0x3f')](_0x190136['attributes'],function(_0x317e6b){var _0x2508e0={};_0x2508e0[_0x317e6b]={'$like':'%'+_0x2dc97e[_0x4018('0x45')]['filter']+'%'};return _0x2508e0;})});}_0x190136=_[_0x4018('0x51')]({},_0x190136,_0x2dc97e[_0x4018('0x64')]);return db[_0x4018('0x61')][_0x4018('0x2f')]({'where':_0x190136[_0x4018('0x50')]})['then'](function(_0x2c0042){_0x1125c6['count']=_0x2c0042;if(_0x2dc97e[_0x4018('0x45')][_0x4018('0x53')]){_0x190136[_0x4018('0x5b')]=[{'all':!![]}];}return db[_0x4018('0x61')]['findAll'](_0x190136);})[_0x4018('0x1e')](function(_0x5b6bb3){_0x1125c6[_0x4018('0x65')]=_0x5b6bb3;return _0x1125c6;});}})['then'](respondWithFilteredResult(_0x5b10e7,_0x190136))[_0x4018('0x55')](handleError(_0x5b10e7,null));};exports['removeDispositions']=function(_0xaa6f84,_0x3976be,_0x57fc4e){return db[_0x4018('0x40')][_0x4018('0x5c')]({'where':{'id':_0xaa6f84[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x3976be,null))[_0x4018('0x1e')](function(_0x2ca4f8){if(_0x2ca4f8){return _0x2ca4f8['removeDispositions'](_0xaa6f84[_0x4018('0x45')]['ids']);}})[_0x4018('0x1e')](respondWithStatusCode(_0x3976be,null))['catch'](handleError(_0x3976be,null));};exports[_0x4018('0x66')]=function(_0xb09b7b,_0x117f0b,_0x318216){if(_0xb09b7b['body']['id']){delete _0xb09b7b[_0x4018('0x5d')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xb09b7b[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x117f0b,null))[_0x4018('0x1e')](function(_0x4149b3){if(_0x4149b3){_0xb09b7b[_0x4018('0x5d')]['MailAccountId']=_0x4149b3['id'];return db['CannedAnswer'][_0x4018('0x62')](_0xb09b7b['body']);}})[_0x4018('0x1e')](respondWithResult(_0x117f0b,null))[_0x4018('0x55')](handleError(_0x117f0b,null));};exports[_0x4018('0x67')]=function(_0x2d9315,_0x2455eb,_0x2c737d){var _0x16b8a1={'raw':![],'where':{}};var _0x5f0218={};var _0x49e633={'count':0x0,'rows':[]};return db[_0x4018('0x40')]['findOne']({'where':{'id':_0x2d9315[_0x4018('0x56')]['id']}})['then'](handleEntityNotFound(_0x2455eb,null))[_0x4018('0x1e')](function(_0x435378){if(_0x435378){_0x5f0218[_0x4018('0x44')]=_[_0x4018('0x59')](db['CannedAnswer'][_0x4018('0x41')]);_0x5f0218[_0x4018('0x45')]=_[_0x4018('0x59')](_0x2d9315[_0x4018('0x45')]);_0x5f0218[_0x4018('0x46')]=_[_0x4018('0x47')](_0x5f0218[_0x4018('0x44')],_0x5f0218[_0x4018('0x45')]);_0x16b8a1[_0x4018('0x48')]=_['intersection'](_0x5f0218[_0x4018('0x44')],qs[_0x4018('0x5a')](_0x2d9315[_0x4018('0x45')][_0x4018('0x5a')]));_0x16b8a1[_0x4018('0x48')]=_0x16b8a1[_0x4018('0x48')]['length']?_0x16b8a1['attributes']:_0x5f0218[_0x4018('0x44')];if(!_0x2d9315[_0x4018('0x45')][_0x4018('0x4a')](_0x4018('0x4b'))){_0x16b8a1[_0x4018('0x2e')]=qs['limit'](_0x2d9315[_0x4018('0x45')]['limit']);_0x16b8a1[_0x4018('0x2c')]=qs[_0x4018('0x2c')](_0x2d9315['query']['offset']);}_0x16b8a1[_0x4018('0x4c')]=qs[_0x4018('0x4d')](_0x2d9315['query']['sort']);_0x16b8a1[_0x4018('0x50')]=qs['filters'](_[_0x4018('0x4e')](_0x2d9315['query'],_0x5f0218[_0x4018('0x46')]));_0x16b8a1[_0x4018('0x50')]['MailAccountId']=_0x435378['id'];if(_0x2d9315['query'][_0x4018('0x4f')]){_0x16b8a1[_0x4018('0x50')]=_[_0x4018('0x51')](_0x16b8a1['where'],{'$or':_[_0x4018('0x3f')](_0x16b8a1[_0x4018('0x48')],function(_0x6f4edf){var _0x3d89f6={};_0x3d89f6[_0x6f4edf]={'$like':'%'+_0x2d9315['query'][_0x4018('0x4f')]+'%'};return _0x3d89f6;})});}_0x16b8a1=_[_0x4018('0x51')]({},_0x16b8a1,_0x2d9315[_0x4018('0x64')]);return db[_0x4018('0x68')][_0x4018('0x2f')]({'where':_0x16b8a1[_0x4018('0x50')]})[_0x4018('0x1e')](function(_0x228e77){_0x49e633[_0x4018('0x2f')]=_0x228e77;if(_0x2d9315[_0x4018('0x45')][_0x4018('0x53')]){_0x16b8a1['include']=[{'all':!![]}];}return db[_0x4018('0x68')][_0x4018('0x54')](_0x16b8a1);})[_0x4018('0x1e')](function(_0x59408e){_0x49e633[_0x4018('0x65')]=_0x59408e;return _0x49e633;});}})[_0x4018('0x1e')](respondWithFilteredResult(_0x2455eb,_0x16b8a1))['catch'](handleError(_0x2455eb,null));};exports[_0x4018('0x69')]=function(_0x358d93,_0x53bd6b,_0x5650a9){return db['MailAccount']['find']({'where':{'id':_0x358d93[_0x4018('0x56')]['id']}})['then'](handleEntityNotFound(_0x53bd6b,null))[_0x4018('0x1e')](function(_0x3ef95d){if(_0x3ef95d){return _0x3ef95d[_0x4018('0x69')](_0x358d93[_0x4018('0x45')][_0x4018('0x6a')]);}})[_0x4018('0x1e')](respondWithStatusCode(_0x53bd6b,null))[_0x4018('0x55')](handleError(_0x53bd6b,null));};exports[_0x4018('0x62')]=function(_0x1d9453,_0x4a0837){var _0x5d2ffe={'name':_0x1d9453[_0x4018('0x5d')]['name'],'key':_0x1d9453[_0x4018('0x5d')][_0x4018('0x43')],'email':_0x1d9453[_0x4018('0x5d')]['email'],'ListId':_0x1d9453[_0x4018('0x5d')][_0x4018('0x6b')],'active':!_['isNil'](_0x1d9453[_0x4018('0x5d')][_0x4018('0x6c')])?_0x1d9453[_0x4018('0x5d')][_0x4018('0x6c')]:!![],'description':_0x1d9453[_0x4018('0x5d')][_0x4018('0x6d')]||null,'Imap':{},'Smtp':{}};if(_[_0x4018('0x6e')](_0x1d9453[_0x4018('0x5d')][_0x4018('0x6f')])){if(_0x1d9453[_0x4018('0x5d')][_0x4018('0x70')]){_0x5d2ffe[_0x4018('0x57')][_0x4018('0x71')]=_0x5d2ffe[_0x4018('0x3d')]['user']=_0x1d9453[_0x4018('0x5d')][_0x4018('0x72')];_0x5d2ffe[_0x4018('0x57')][_0x4018('0x73')]=_0x5d2ffe[_0x4018('0x3d')]['pass']=_0x1d9453[_0x4018('0x5d')][_0x4018('0x74')];}else{_0x5d2ffe['Imap'][_0x4018('0x75')]=_0x5d2ffe[_0x4018('0x3d')][_0x4018('0x75')]=![];}_0x5d2ffe[_0x4018('0x57')][_0x4018('0x76')]=_0x1d9453[_0x4018('0x5d')][_0x4018('0x57')][_0x4018('0x76')];_0x5d2ffe[_0x4018('0x57')][_0x4018('0x77')]=_0x1d9453[_0x4018('0x5d')][_0x4018('0x57')][_0x4018('0x77')];_0x5d2ffe[_0x4018('0x3d')][_0x4018('0x76')]=_0x1d9453['body'][_0x4018('0x3d')][_0x4018('0x76')];_0x5d2ffe[_0x4018('0x3d')][_0x4018('0x77')]=_0x1d9453[_0x4018('0x5d')][_0x4018('0x3d')][_0x4018('0x77')];}else{_0x5d2ffe[_0x4018('0x57')][_0x4018('0x78')]=_0x5d2ffe[_0x4018('0x3d')][_0x4018('0x78')]=_0x1d9453[_0x4018('0x5d')]['cservice'];_0x5d2ffe[_0x4018('0x57')][_0x4018('0x71')]=_0x5d2ffe['Smtp'][_0x4018('0x71')]=_0x1d9453[_0x4018('0x5d')][_0x4018('0x72')];_0x5d2ffe[_0x4018('0x57')][_0x4018('0x73')]=_0x5d2ffe[_0x4018('0x3d')][_0x4018('0x79')]=_0x1d9453[_0x4018('0x5d')]['cpassword'];}return db['MailAccount'][_0x4018('0x62')](_0x5d2ffe,{'include':[{'model':db[_0x4018('0x3c')],'as':'Smtp'},{'model':db[_0x4018('0x3b')],'as':_0x4018('0x57')}]})[_0x4018('0x1e')](function(_0x2a5a6e){var _0x41551e=_0x1d9453[_0x4018('0x71')][_0x4018('0x36')]({'plain':!![]});if(!_0x41551e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41551e[_0x4018('0x7a')]===_0x4018('0x71')){var _0x4b9cb5=_0x2a5a6e[_0x4018('0x36')]({'plain':!![]});return db[_0x4018('0x7b')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x41551e['userProfileId']},'raw':!![]})[_0x4018('0x1e')](function(_0x55800a){if(_0x55800a&&_0x55800a['autoAssociation']===0x0){return db[_0x4018('0x38')][_0x4018('0x62')]({'name':_0x4b9cb5[_0x4018('0x39')],'resourceId':_0x4b9cb5['id'],'type':_0x55800a['name'],'sectionId':_0x55800a['id']},{})[_0x4018('0x1e')](function(){return _0x2a5a6e;});}else{return _0x2a5a6e;}})['catch'](function(_0x2cd034){logger['error'](_0x4018('0x7c'),_0x2cd034);throw _0x2cd034;});}return _0x2a5a6e;})['then'](respondWithResult(_0x4a0837,0xc9))[_0x4018('0x55')](handleError(_0x4a0837,null));};exports['getImap']=function(_0x38ea1a,_0x21188f,_0x5f0b94){return db[_0x4018('0x40')][_0x4018('0x7d')]({'where':{'id':_0x38ea1a[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x21188f,null))[_0x4018('0x1e')](function(_0x6a4953){if(_0x6a4953){return _0x6a4953[_0x4018('0x7e')]();}return null;})[_0x4018('0x1e')](respondWithResult(_0x21188f,null))['catch'](handleError(_0x21188f,null));};exports['addImap']=function(_0x3ca88e,_0xf3ef67,_0x3a6ce2){if(_0x3ca88e[_0x4018('0x5d')]['id']){delete _0x3ca88e[_0x4018('0x5d')]['id'];}return db['MailAccount'][_0x4018('0x5c')]({'where':{'id':_0x3ca88e['params']['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0xf3ef67,null))[_0x4018('0x1e')](function(_0x50a281){if(_0x50a281){_0x3ca88e['body'][_0x4018('0x60')]=_0x50a281['id'];return db[_0x4018('0x3b')]['create'](_0x3ca88e[_0x4018('0x5d')]);}})[_0x4018('0x1e')](respondWithResult(_0xf3ef67,null))[_0x4018('0x55')](handleError(_0xf3ef67,null));};exports[_0x4018('0x7f')]=function(_0x3bb6b2,_0x2ab249,_0x1c46e3){return db['MailAccount'][_0x4018('0x7d')]({'where':{'id':_0x3bb6b2[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x2ab249,null))[_0x4018('0x1e')](function(_0x39ef3a){if(_0x39ef3a){return _0x39ef3a[_0x4018('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x2ab249,null))[_0x4018('0x55')](handleError(_0x2ab249,null));};exports['getSmtp']=function(_0x1592bb,_0x4eab2b,_0x1ceb30){return db[_0x4018('0x40')][_0x4018('0x7d')]({'where':{'id':_0x1592bb[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x4eab2b,null))['then'](function(_0x17fa7a){if(_0x17fa7a){return _0x17fa7a[_0x4018('0x81')]();}return null;})['then'](respondWithResult(_0x4eab2b,null))[_0x4018('0x55')](handleError(_0x4eab2b,null));};exports[_0x4018('0x82')]=function(_0x3cf592,_0x36c4f0,_0x988ad1){if(_0x3cf592[_0x4018('0x5d')]['id']){delete _0x3cf592[_0x4018('0x5d')]['id'];}return db[_0x4018('0x40')][_0x4018('0x5c')]({'where':{'id':_0x3cf592['params']['id']}})['then'](handleEntityNotFound(_0x36c4f0,null))[_0x4018('0x1e')](function(_0x4ff7e6){if(_0x4ff7e6){_0x3cf592['body'][_0x4018('0x60')]=_0x4ff7e6['id'];return db[_0x4018('0x3c')][_0x4018('0x62')](_0x3cf592[_0x4018('0x5d')]);}})[_0x4018('0x1e')](respondWithResult(_0x36c4f0,null))['catch'](handleError(_0x36c4f0,null));};exports[_0x4018('0x83')]=function(_0x2503e4,_0x516b75,_0x2eb823){return db['MailAccount']['findOne']({'where':{'id':_0x2503e4[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x516b75,null))[_0x4018('0x1e')](function(_0x23bfdd){if(_0x23bfdd){return _0x23bfdd[_0x4018('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x516b75,null))[_0x4018('0x55')](handleError(_0x516b75,null));};exports[_0x4018('0x85')]=function(_0x374ab0,_0x56ebd9,_0x570c60){return db['MailInteraction']['find']({'where':{'id':_0x374ab0[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x56ebd9,null))[_0x4018('0x1e')](function(_0x3887ac){if(_0x3887ac){return _0x3887ac[_0x4018('0x85')](_0x374ab0[_0x4018('0x5d')]['ids'],_['omit'](_0x374ab0[_0x4018('0x5d')],['ids','id'])||{});}})[_0x4018('0x1e')](respondWithResult(_0x56ebd9,null))['catch'](handleError(_0x56ebd9,null));};exports[_0x4018('0x86')]=function(_0x438ba6,_0x481c02,_0x3f17e6){var _0x337d8d={'raw':![],'where':{}};var _0x3588dc={};var _0x13b292={'count':0x0,'rows':[]};return db['MailAccount'][_0x4018('0x7d')]({'where':{'id':_0x438ba6[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x481c02,null))[_0x4018('0x1e')](function(_0x778a35){if(_0x778a35){_0x3588dc[_0x4018('0x44')]=_[_0x4018('0x59')](db[_0x4018('0x87')][_0x4018('0x41')]);_0x3588dc['query']=_[_0x4018('0x59')](_0x438ba6[_0x4018('0x45')]);_0x3588dc[_0x4018('0x46')]=_[_0x4018('0x47')](_0x3588dc[_0x4018('0x44')],_0x3588dc[_0x4018('0x45')]);_0x337d8d[_0x4018('0x48')]=_[_0x4018('0x47')](_0x3588dc[_0x4018('0x44')],qs[_0x4018('0x5a')](_0x438ba6[_0x4018('0x45')][_0x4018('0x5a')]));_0x337d8d[_0x4018('0x48')]=_0x337d8d[_0x4018('0x48')][_0x4018('0x49')]?_0x337d8d[_0x4018('0x48')]:_0x3588dc[_0x4018('0x44')];if(!_0x438ba6[_0x4018('0x45')][_0x4018('0x4a')]('nolimit')){_0x337d8d[_0x4018('0x2e')]=qs[_0x4018('0x2e')](_0x438ba6[_0x4018('0x45')][_0x4018('0x2e')]);_0x337d8d['offset']=qs[_0x4018('0x2c')](_0x438ba6['query'][_0x4018('0x2c')]);}_0x337d8d[_0x4018('0x4c')]=qs['sort'](_0x438ba6['query'][_0x4018('0x4d')]);_0x337d8d[_0x4018('0x50')]=qs[_0x4018('0x46')](_['pick'](_0x438ba6[_0x4018('0x45')],_0x3588dc[_0x4018('0x46')]));_0x337d8d['where'][_0x4018('0x60')]=_0x778a35['id'];if(_0x438ba6[_0x4018('0x45')][_0x4018('0x4f')]){_0x337d8d[_0x4018('0x50')]=_['merge'](_0x337d8d[_0x4018('0x50')],{'$or':_['map'](_0x337d8d[_0x4018('0x48')],function(_0x4cb62b){var _0x299079={};_0x299079[_0x4cb62b]={'$like':'%'+_0x438ba6['query'][_0x4018('0x4f')]+'%'};return _0x299079;})});}_0x337d8d=_[_0x4018('0x51')]({},_0x337d8d,_0x438ba6['options']);return db[_0x4018('0x87')][_0x4018('0x2f')]({'where':_0x337d8d[_0x4018('0x50')]})[_0x4018('0x1e')](function(_0x141379){_0x13b292['count']=_0x141379;if(_0x438ba6[_0x4018('0x45')][_0x4018('0x53')]){_0x337d8d['include']=[{'model':db[_0x4018('0x88')],'as':_0x4018('0x89'),'required':![]},{'model':db[_0x4018('0x8a')],'as':_0x4018('0x8b'),'attributes':[_0x4018('0x39'),_0x4018('0x8c'),_0x4018('0x8d')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4018('0x39'),_0x4018('0x8e')],'where':_0x438ba6[_0x4018('0x45')][_0x4018('0x8f')]?{'id':_0x438ba6['query']['tag']}:undefined,'required':_0x438ba6[_0x4018('0x45')][_0x4018('0x8f')]?!![]:![]}];}return db[_0x4018('0x87')][_0x4018('0x54')](_0x337d8d);})['then'](function(_0x3666c6){_0x13b292['rows']=_0x3666c6;return _0x13b292;});}})[_0x4018('0x1e')](respondWithFilteredResult(_0x481c02,_0x337d8d))[_0x4018('0x55')](handleError(_0x481c02,null));};exports['addApplications']=function addApplications(_0x45e7e8,_0x4a24e2){var _0x32a7ee=_0x45e7e8[_0x4018('0x56')]['id'];var _0x376dd6=_0x45e7e8[_0x4018('0x5d')];var _0x54b14e=0xc8;var _0x39524e=null;return db[_0x4018('0x90')][_0x4018('0x91')]({'isolationLevel':db['sequelize'][_0x4018('0x92')]['ISOLATION_LEVELS'][_0x4018('0x93')]},function(_0x24dc10){return db[_0x4018('0x40')]['findOne']({'where':{'id':_0x32a7ee},'transaction':_0x24dc10})[_0x4018('0x1e')](function(_0x2ee609){if(_0x2ee609){return db[_0x4018('0x94')]['destroy']({'where':{'MailAccountId':_0x32a7ee},'transaction':_0x24dc10})[_0x4018('0x1e')](function(){var _0x2d8949=_['map'](_0x376dd6,function(_0x22847e){_0x22847e[_0x4018('0x60')]=_0x32a7ee;return _0x22847e;});return db[_0x4018('0x94')][_0x4018('0x95')](_0x2d8949,{'transaction':_0x24dc10});});}else{_0x54b14e=0x194;_0x39524e=[];}});})[_0x4018('0x1e')](function(){if(_0x54b14e!==0x194){return db[_0x4018('0x94')][_0x4018('0x96')]({'where':{'MailAccountId':_0x32a7ee},'order':_0x4018('0x97')})[_0x4018('0x1e')](function(_0x217759){_0x39524e=_0x217759;});}})[_0x4018('0x55')](function(_0x34c9ef){_0x54b14e=0x1f4;logger[_0x4018('0x24')](_0x34c9ef[_0x4018('0x98')]);if(_0x34c9ef['name']){delete _0x34c9ef[_0x4018('0x39')];}_0x39524e=_0x34c9ef;})['finally'](function(){if(_0x39524e===null){_0x4a24e2[_0x4018('0x28')](_0x54b14e);}else{if(_0x54b14e===0x1f4){_0x4a24e2[_0x4018('0x2a')](_0x54b14e)[_0x4018('0x99')](_0x39524e);}else{_0x4a24e2[_0x4018('0x2a')](_0x54b14e)[_0x4018('0x2b')](_0x39524e);}}});};exports[_0x4018('0x9a')]=function(_0xf8eca6,_0x11888e,_0x50f65a){var _0x1d1f5b={};var _0x133e23={};var _0x9f9a7;var _0x1ce490;return db['MailAccount']['findOne']({'where':{'id':_0xf8eca6['params']['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x11888e,null))['then'](function(_0x3f79ba){if(_0x3f79ba){_0x9f9a7=_0x3f79ba;_0x133e23['model']=_[_0x4018('0x59')](db['MailApplication']['rawAttributes']);_0x133e23['query']=_[_0x4018('0x59')](_0xf8eca6[_0x4018('0x45')]);_0x133e23['filters']=_[_0x4018('0x47')](_0x133e23[_0x4018('0x44')],_0x133e23[_0x4018('0x45')]);_0x1d1f5b['attributes']=_[_0x4018('0x47')](_0x133e23[_0x4018('0x44')],qs[_0x4018('0x5a')](_0xf8eca6[_0x4018('0x45')][_0x4018('0x5a')]));_0x1d1f5b[_0x4018('0x48')]=_0x1d1f5b[_0x4018('0x48')][_0x4018('0x49')]?_0x1d1f5b[_0x4018('0x48')]:_0x133e23[_0x4018('0x44')];_0x1d1f5b['order']=qs[_0x4018('0x4d')](_0xf8eca6['query'][_0x4018('0x4d')]);_0x1d1f5b[_0x4018('0x50')]=qs[_0x4018('0x46')](_['pick'](_0xf8eca6[_0x4018('0x45')],_0x133e23[_0x4018('0x46')]));if(_0xf8eca6[_0x4018('0x45')]['filter']){_0x1d1f5b[_0x4018('0x50')]=_[_0x4018('0x51')](_0x1d1f5b['where'],{'$or':_[_0x4018('0x3f')](_0x1d1f5b[_0x4018('0x48')],function(_0x2424e8){var _0x21a589={};_0x21a589[_0x2424e8]={'$like':'%'+_0xf8eca6['query']['filter']+'%'};return _0x21a589;})});}_0x1d1f5b=_[_0x4018('0x51')]({},_0x1d1f5b,_0xf8eca6[_0x4018('0x64')]);return _0x9f9a7[_0x4018('0x9a')](_0x1d1f5b);}})['then'](function(_0x3967c7){if(_0x3967c7){_0x1ce490=_0x3967c7[_0x4018('0x49')];if(!_0xf8eca6[_0x4018('0x45')][_0x4018('0x4a')]('nolimit')){_0x1d1f5b[_0x4018('0x2e')]=qs['limit'](_0xf8eca6[_0x4018('0x45')]['limit']);_0x1d1f5b[_0x4018('0x2c')]=qs[_0x4018('0x2c')](_0xf8eca6[_0x4018('0x45')][_0x4018('0x2c')]);}return _0x9f9a7[_0x4018('0x9a')](_0x1d1f5b);}})[_0x4018('0x1e')](function(_0x3dc8e6){if(_0x3dc8e6){return _0x3dc8e6?{'count':_0x1ce490,'rows':_0x3dc8e6}:null;}})[_0x4018('0x1e')](respondWithResult(_0x11888e,null))[_0x4018('0x55')](handleError(_0x11888e,null));};exports[_0x4018('0x9b')]=function(_0x13ae65,_0x2dfe13,_0x5cc4f3){var _0x19614a={'raw':!![],'where':{}};var _0x991ae7={};var _0x4419e4={'count':0x0,'rows':[]};return db[_0x4018('0x40')]['findOne']({'where':{'id':_0x13ae65[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x2dfe13,null))[_0x4018('0x1e')](function(_0x5832ef){if(_0x5832ef){_0x991ae7[_0x4018('0x44')]=_[_0x4018('0x59')](db[_0x4018('0x9c')]['rawAttributes']);_0x991ae7[_0x4018('0x45')]=_[_0x4018('0x59')](_0x13ae65['query']);_0x991ae7[_0x4018('0x46')]=_[_0x4018('0x47')](_0x991ae7[_0x4018('0x44')],_0x991ae7[_0x4018('0x45')]);_0x19614a['attributes']=_[_0x4018('0x47')](_0x991ae7['model'],qs[_0x4018('0x5a')](_0x13ae65[_0x4018('0x45')][_0x4018('0x5a')]));_0x19614a['attributes']=_0x19614a[_0x4018('0x48')][_0x4018('0x49')]?_0x19614a[_0x4018('0x48')]:_0x991ae7['model'];if(!_0x13ae65[_0x4018('0x45')][_0x4018('0x4a')](_0x4018('0x4b'))){_0x19614a['limit']=qs['limit'](_0x13ae65[_0x4018('0x45')][_0x4018('0x2e')]);_0x19614a[_0x4018('0x2c')]=qs[_0x4018('0x2c')](_0x13ae65[_0x4018('0x45')][_0x4018('0x2c')]);}_0x19614a[_0x4018('0x4c')]=qs['sort'](_0x13ae65['query'][_0x4018('0x4d')]);_0x19614a[_0x4018('0x50')]=qs[_0x4018('0x46')](_[_0x4018('0x4e')](_0x13ae65[_0x4018('0x45')],_0x991ae7[_0x4018('0x46')]));_0x19614a[_0x4018('0x50')]['MailAccountId']=_0x5832ef['id'];if(_0x13ae65[_0x4018('0x45')]['filter']){_0x19614a['where']=_['merge'](_0x19614a[_0x4018('0x50')],{'$or':_[_0x4018('0x3f')](_0x19614a[_0x4018('0x48')],function(_0x22739c){var _0x26fd97={};_0x26fd97[_0x22739c]={'$like':'%'+_0x13ae65[_0x4018('0x45')]['filter']+'%'};return _0x26fd97;})});}if(_0x13ae65['query'][_0x4018('0x9d')]){var _0x5c1c98=_0x13ae65[_0x4018('0x45')][_0x4018('0x9d')][_0x4018('0x9e')](',');var _0x486725={};_0x486725[_0x5c1c98[0x0]]={'$gte':moment(_0x5c1c98[0x1])[_0x4018('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x19614a[_0x4018('0x50')]=_[_0x4018('0x51')](_0x19614a[_0x4018('0x50')],_0x486725);}_0x19614a=_[_0x4018('0x51')]({},_0x19614a,_0x13ae65['options']);return db[_0x4018('0x9c')][_0x4018('0x2f')]({'where':_0x19614a[_0x4018('0x50')]})[_0x4018('0x1e')](function(_0x4f4df1){_0x4419e4[_0x4018('0x2f')]=_0x4f4df1;if(_0x13ae65[_0x4018('0x45')][_0x4018('0x53')]){_0x19614a[_0x4018('0x5b')]=[{'all':!![]}];}return db[_0x4018('0x9c')][_0x4018('0x54')](_0x19614a);})[_0x4018('0x1e')](function(_0x34229c){if(_0x13ae65[_0x4018('0x45')][_0x4018('0xa0')]===_0x4018('0xa1')){for(var _0x494cfc=0x0;_0x494cfc<_0x34229c['length'];_0x494cfc++){_0x34229c[_0x494cfc]['body']=juice(_0x34229c[_0x494cfc]['body']);}}_0x4419e4['rows']=_0x34229c;return _0x4419e4;});}})[_0x4018('0x1e')](respondWithFilteredResult(_0x2dfe13,_0x19614a))[_0x4018('0x55')](handleError(_0x2dfe13,null));};exports['send']=function(_0x1f5e97,_0x35266b,_0x440ba1){var _0x2f87d4,_0x30c9ac={},_0x549ba0;if(_0x1f5e97['body']['to']){_0x549ba0=_0x1f5e97[_0x4018('0x5d')]['to'][_0x4018('0x9e')](',')[0x0];}return db['MailAccount'][_0x4018('0x5c')]({'where':{'id':_0x1f5e97['params']['id']},'include':[{'model':db['CmList'],'as':_0x4018('0xa2'),'include':[{'model':db[_0x4018('0x88')],'as':_0x4018('0xa3'),'where':{'email':_0x549ba0},'limit':0x1,'order':[[_0x4018('0xa4'),_0x4018('0xa5')]]}]},{'model':db[_0x4018('0x3c')],'as':_0x4018('0x3d'),'raw':!![]}]})[_0x4018('0x1e')](handleEntityNotFound(_0x35266b,null))[_0x4018('0x1e')](function(_0x5b35a9){if(_0x5b35a9){_0x2f87d4=_0x5b35a9;if(_0x5b35a9[_0x4018('0x3d')]){if(_[_0x4018('0x6e')](_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa6')])){_0x1f5e97['body'][_0x4018('0xa6')]=util[_0x4018('0x9f')](_0x4018('0xa7'),_0x5b35a9[_0x4018('0x39')],_0x5b35a9[_0x4018('0xa8')]||_0x5b35a9[_0x4018('0x3d')]['user']);}if(_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa9')]&&_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa9')]['length']){for(var _0x29c6f1=0x0;_0x29c6f1<_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa9')]['length'];_0x29c6f1+=0x1){_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa9')][_0x29c6f1]={'filename':_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa9')][_0x29c6f1][_0x4018('0x39')],'path':path[_0x4018('0xaa')](config[_0x4018('0xab')],_0x4018('0xac'),_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa9')][_0x29c6f1]['basename'])};}}var _0x3112e6={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5b35a9[_0x4018('0x3d')]['service'])){if(_0x5b35a9[_0x4018('0x3d')][_0x4018('0x75')]){_0x3112e6[_0x4018('0xad')]={'user':_0x5b35a9[_0x4018('0x3d')][_0x4018('0x71')],'pass':_0x5b35a9[_0x4018('0x3d')][_0x4018('0x79')]};}_0x3112e6['host']=_0x5b35a9[_0x4018('0x3d')][_0x4018('0x76')];_0x3112e6[_0x4018('0x77')]=_0x5b35a9[_0x4018('0x3d')][_0x4018('0x77')];_0x3112e6[_0x4018('0xae')]=_0x5b35a9[_0x4018('0x3d')][_0x4018('0xae')];}else{_0x3112e6[_0x4018('0x78')]=_0x5b35a9[_0x4018('0x3d')][_0x4018('0x78')];_0x3112e6['auth']={'user':_0x5b35a9[_0x4018('0x3d')][_0x4018('0x71')],'pass':_0x5b35a9['Smtp'][_0x4018('0x79')]};}return respondWithRpcPromise(_0x4018('0xaf'),_0x4018('0xb0'),{'account':_0x3112e6,'message':_0x1f5e97[_0x4018('0x5d')]});}else{throw new Error('List\x20not\x20found');}}})[_0x4018('0x1e')](function(_0xa0337c){if(_0xa0337c){_0x30c9ac=_0xa0337c;if(_0x2f87d4['List']){if(_0x2f87d4[_0x4018('0xa2')][_0x4018('0xa3')][_0x4018('0x49')]){return _0x2f87d4[_0x4018('0xa2')]['Contacts'][0x0];}else{return db[_0x4018('0x88')]['create'](_[_0x4018('0x18')](_0x1f5e97[_0x4018('0x5d')],{'firstName':_0x1f5e97[_0x4018('0x5d')]['to'],'email':_0x1f5e97['body']['to'],'phone':_0x1f5e97[_0x4018('0x5d')]['to'],'ListId':_0x2f87d4[_0x4018('0x6b')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x4018('0x1e')](function(_0x30e6ee){if(_0x30e6ee){var _0x23985e={'UserId':_0x1f5e97[_0x4018('0x71')]['id'],'ContactId':_0x30e6ee['id'],'MailAccountId':_0x2f87d4['id'],'inReplyTo':_0x30c9ac[_0x4018('0xb1')],'to':_0x1f5e97[_0x4018('0x5d')][_0x4018('0xa6')],'cc':_0x1f5e97[_0x4018('0x5d')]['cc'],'subject':_0x1f5e97[_0x4018('0x5d')][_0x4018('0xb2')],'attach':_0x1f5e97['body'][_0x4018('0xb3')],'firstMsgDirection':_0x4018('0xb4'),'lastMsgAt':moment()[_0x4018('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x4018('0xb4'),'Messages':[_[_0x4018('0x51')](_0x1f5e97[_0x4018('0x5d')],{'messageId':_0x30c9ac[_0x4018('0xb1')],'sentAt':moment()[_0x4018('0x9f')](_0x4018('0xb5')),'read':!![],'MailAccountId':_0x2f87d4['id'],'UserId':_0x1f5e97['user']['id'],'ContactId':_0x30e6ee['id']})]};if(_0x1f5e97[_0x4018('0x5d')][_0x4018('0xb6')]){_0x23985e=_[_0x4018('0x51')](_0x23985e,_0x1f5e97['body'][_0x4018('0xb6')]);}return db['MailInteraction'][_0x4018('0x62')](_0x23985e,{'include':[{'model':db[_0x4018('0x9c')],'as':_0x4018('0xb7')}]});}})[_0x4018('0x1e')](respondWithResult(_0x35266b,null))[_0x4018('0x55')](handleError(_0x35266b,null));};exports['verifySmtp']=function(_0x5d1a65,_0x383414,_0x58764b){return db[_0x4018('0x40')][_0x4018('0x5c')]({'where':{'id':_0x5d1a65[_0x4018('0x56')]['id']},'include':[{'model':db[_0x4018('0x3c')],'as':_0x4018('0x3d'),'raw':!![]}]})[_0x4018('0x1e')](handleEntityNotFound(_0x383414,null))['then'](function(_0x561f09){if(_0x561f09&&_0x561f09[_0x4018('0x3d')]){var _0x5e9efd={'id':_0x561f09['id'],'tls':{'rejectUnauthorized':![]}};if(_0x561f09[_0x4018('0x3d')]['service']){_0x5e9efd[_0x4018('0x78')]=_0x561f09[_0x4018('0x3d')]['service'];}else{_0x5e9efd[_0x4018('0x76')]=_0x561f09['Smtp'][_0x4018('0x76')];_0x5e9efd[_0x4018('0x77')]=_0x561f09[_0x4018('0x3d')][_0x4018('0x77')];_0x5e9efd[_0x4018('0xae')]=_0x561f09[_0x4018('0x3d')][_0x4018('0xae')];}if(_0x561f09[_0x4018('0x3d')][_0x4018('0x75')]){_0x5e9efd[_0x4018('0xad')]={'user':_0x561f09[_0x4018('0x3d')][_0x4018('0x71')],'pass':_0x561f09[_0x4018('0x3d')][_0x4018('0x79')]};}return respondWithRpcPromise(_0x4018('0xb8'),_0x4018('0xb9'),{'account':_0x5e9efd});}})[_0x4018('0x1e')](respondWithResult(_0x383414,null))[_0x4018('0x55')](handleError(_0x383414,null));};exports['destroy']=function(_0x1bdd75,_0xaf86ef){return db[_0x4018('0x40')]['find']({'where':{'id':_0x1bdd75[_0x4018('0x56')]['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0xaf86ef,null))['then'](function(_0x5afa1c){if(_0x5afa1c&&_0x5afa1c[_0x4018('0x78')]){throw new db[(_0x4018('0xba'))][(_0x4018('0xbb'))](_0x4018('0xbc'));}return _0x5afa1c;})[_0x4018('0x1e')](removeEntity(_0xaf86ef,null))[_0x4018('0x55')](handleError(_0xaf86ef,null));};exports[_0x4018('0xbd')]=function(_0xb81de7,_0x599127,_0x1e3441){return db[_0x4018('0x40')][_0x4018('0x5c')]({'where':{'id':_0xb81de7[_0x4018('0x56')]['id']}})['then'](handleEntityNotFound(_0x599127,null))[_0x4018('0x1e')](function(_0x574862){if(_0x574862){return _0x574862[_0x4018('0xbd')](_0xb81de7['body'][_0x4018('0x6a')],_[_0x4018('0xbe')](_0xb81de7[_0x4018('0x5d')],['ids','id'])||{})[_0x4018('0xbf')](function(_0x3d979e){for(var _0x105fb1=0x0;_0x105fb1<_0xb81de7[_0x4018('0x5d')]['ids'][_0x4018('0x49')];_0x105fb1+=0x1){socket[_0x4018('0xc0')](_0x4018('0xc1'),{'UserId':Number(_0xb81de7[_0x4018('0x5d')]['ids'][_0x105fb1]),'MailAccountId':Number(_0xb81de7[_0x4018('0x56')]['id'])});}return _0x3d979e;});}})[_0x4018('0x1e')](respondWithResult(_0x599127,null))[_0x4018('0x55')](handleError(_0x599127,null));};exports[_0x4018('0xc2')]=function(_0x4d6085,_0x3838f1,_0x467d22){return db[_0x4018('0x40')]['find']({'where':{'id':_0x4d6085['params']['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x3838f1,null))['then'](function(_0xc5e3e){if(_0xc5e3e){return _0xc5e3e[_0x4018('0xc2')](_0x4d6085['query']['ids'])['then'](function(){if(_[_0x4018('0xc3')](_0x4d6085['query']['ids'])){for(var _0x47d312=0x0;_0x47d312<_0x4d6085['query']['ids'][_0x4018('0x49')];_0x47d312+=0x1){socket[_0x4018('0xc0')](_0x4018('0xc4'),{'UserId':Number(_0x4d6085['query'][_0x4018('0x6a')][_0x47d312]),'MailAccountId':Number(_0x4d6085[_0x4018('0x56')]['id'])});}}else{socket[_0x4018('0xc0')](_0x4018('0xc4'),{'UserId':Number(_0x4d6085[_0x4018('0x45')][_0x4018('0x6a')]),'MailAccountId':Number(_0x4d6085[_0x4018('0x56')]['id'])});}});}})[_0x4018('0x1e')](respondWithStatusCode(_0x3838f1,null))[_0x4018('0x55')](handleError(_0x3838f1,null));};exports['getAgents']=function(_0x22106b,_0x38eb7a,_0x845822){var _0x129853={};var _0x27569a={};var _0x462606;var _0x29442a;return db[_0x4018('0x40')][_0x4018('0x7d')]({'where':{'id':_0x22106b['params']['id']}})[_0x4018('0x1e')](handleEntityNotFound(_0x38eb7a,null))[_0x4018('0x1e')](function(_0x1f6eaf){if(_0x1f6eaf){_0x462606=_0x1f6eaf;_0x27569a['model']=_[_0x4018('0x59')](db[_0x4018('0x8a')]['rawAttributes']);_0x27569a[_0x4018('0x45')]=_[_0x4018('0x59')](_0x22106b[_0x4018('0x45')]);_0x27569a[_0x4018('0x46')]=_[_0x4018('0x47')](_0x27569a[_0x4018('0x44')],_0x27569a[_0x4018('0x45')]);_0x129853[_0x4018('0x48')]=_['intersection'](_0x27569a[_0x4018('0x44')],qs[_0x4018('0x5a')](_0x22106b['query'][_0x4018('0x5a')]));_0x129853['attributes']=_0x129853['attributes'][_0x4018('0x49')]?_0x129853['attributes']:_0x27569a[_0x4018('0x44')];_0x129853['order']=qs[_0x4018('0x4d')](_0x22106b[_0x4018('0x45')]['sort']);_0x129853[_0x4018('0x50')]=qs[_0x4018('0x46')](_[_0x4018('0x4e')](_0x22106b[_0x4018('0x45')],_0x27569a['filters']));if(_0x22106b[_0x4018('0x45')][_0x4018('0x4f')]){_0x129853['where']=_['merge'](_0x129853[_0x4018('0x50')],{'$or':_[_0x4018('0x3f')](_0x129853[_0x4018('0x48')],function(_0x295db){var _0x577988={};_0x577988[_0x295db]={'$like':'%'+_0x22106b['query'][_0x4018('0x4f')]+'%'};return _0x577988;})});}_0x129853=_['merge']({},_0x129853,_0x22106b[_0x4018('0x64')]);return _0x462606[_0x4018('0xc5')](_0x129853);}})[_0x4018('0x1e')](function(_0x56332b){if(_0x56332b){_0x29442a=_0x56332b[_0x4018('0x49')];if(!_0x22106b[_0x4018('0x45')][_0x4018('0x4a')]('nolimit')){_0x129853[_0x4018('0x2e')]=qs['limit'](_0x22106b['query']['limit']);_0x129853[_0x4018('0x2c')]=qs['offset'](_0x22106b[_0x4018('0x45')][_0x4018('0x2c')]);}return _0x462606['getAgents'](_0x129853);}})[_0x4018('0x1e')](function(_0x4b3321){if(_0x4b3321){return _0x4b3321?{'count':_0x29442a,'rows':_0x4b3321}:null;}})['then'](respondWithResult(_0x38eb7a,null))['catch'](handleError(_0x38eb7a,null));}; \ No newline at end of file +var _0xff24=['rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','MailAccount','include','findAll','rows','show','params','keys','includeAll','find','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','description','cauthentication','user','cuser','pass','authentication','host','port','service','cservice','cpassword','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','MailInteraction','omit','getInteractions','CmContact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','email','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','List\x20not\x20found','List','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','then','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map'];(function(_0x75693,_0xf244a0){var _0x4599cc=function(_0x3e183d){while(--_0x3e183d){_0x75693['push'](_0x75693['shift']());}};_0x4599cc(++_0xf244a0);}(_0xff24,0x82));var _0x4ff2=function(_0xba6f54,_0x2a13b9){_0xba6f54=_0xba6f54-0x0;var _0x383bb4=_0xff24[_0xba6f54];return _0x383bb4;};'use strict';var emlformat=require(_0x4ff2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ff2('0x1'));var jsonpatch=require(_0x4ff2('0x2'));var rp=require(_0x4ff2('0x3'));var moment=require(_0x4ff2('0x4'));var BPromise=require(_0x4ff2('0x5'));var Mustache=require(_0x4ff2('0x6'));var util=require('util');var path=require(_0x4ff2('0x7'));var sox=require(_0x4ff2('0x8'));var csv=require(_0x4ff2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ff2('0xa'));var _=require(_0x4ff2('0xb'));var squel=require(_0x4ff2('0xc'));var crypto=require(_0x4ff2('0xd'));var jsforce=require(_0x4ff2('0xe'));var deskjs=require(_0x4ff2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4ff2('0x10'));var Papa=require('papaparse');var htmlToText=require(_0x4ff2('0x11'));var juice=require(_0x4ff2('0x12'));var Redis=require('ioredis');var authService=require(_0x4ff2('0x13'));var qs=require(_0x4ff2('0x14'));var as=require(_0x4ff2('0x15'));var hardwareService=require(_0x4ff2('0x16'));var logger=require(_0x4ff2('0x17'))(_0x4ff2('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ff2('0x19'));var db=require(_0x4ff2('0x1a'))['db'];config[_0x4ff2('0x1b')]=_[_0x4ff2('0x1c')](config[_0x4ff2('0x1b')],{'host':_0x4ff2('0x1d'),'port':0x18eb});var socket=require(_0x4ff2('0x1e'))(new Redis(config[_0x4ff2('0x1b')]));require(_0x4ff2('0x1f'))[_0x4ff2('0x20')](socket);var jayson=require(_0x4ff2('0x21'));var client=jayson['client'][_0x4ff2('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x22bda3,_0x214f46,_0x538c62,_0x4f4c54){return new BPromise(function(_0x43b34c,_0xe6dd2){var _0xf36d5=_0x4f4c54||client;return _0xf36d5[_0x4ff2('0x23')](_0x22bda3,_0x538c62)['then'](function(_0x1359ee){logger[_0x4ff2('0x24')](_0x4ff2('0x25'),_0x214f46,_0x4ff2('0x26'));logger[_0x4ff2('0x27')](_0x4ff2('0x28'),_0x214f46,_0x4ff2('0x26'),JSON['stringify'](_0x1359ee));if(_0x1359ee[_0x4ff2('0x29')]){if(_0x1359ee[_0x4ff2('0x29')][_0x4ff2('0x2a')]===0x1f4){logger[_0x4ff2('0x29')](_0x4ff2('0x25'),_0x214f46,_0x1359ee[_0x4ff2('0x29')][_0x4ff2('0x2b')]);return _0xe6dd2(_0x1359ee['error']['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x214f46,_0x1359ee[_0x4ff2('0x29')][_0x4ff2('0x2b')]);return _0x43b34c(_0x1359ee[_0x4ff2('0x29')][_0x4ff2('0x2b')]);}else{logger['info'](_0x4ff2('0x25'),_0x214f46,_0x4ff2('0x26'));_0x43b34c(_0x1359ee[_0x4ff2('0x2c')][_0x4ff2('0x2b')]);}})[_0x4ff2('0x2d')](function(_0x4a7334){logger[_0x4ff2('0x29')]('MailAccount,\x20%s,\x20%s',_0x214f46,_0x4a7334);_0xe6dd2(_0x4a7334);});});}function respondWithStatusCode(_0x2ad7b8,_0x2fbc9b){_0x2fbc9b=_0x2fbc9b||0xcc;return function(_0x1ed954){if(_0x1ed954){return _0x2ad7b8[_0x4ff2('0x2e')](_0x2fbc9b);}return _0x2ad7b8[_0x4ff2('0x2f')](_0x2fbc9b)[_0x4ff2('0x30')]();};}function respondWithResult(_0x3a4e07,_0x4064f6){_0x4064f6=_0x4064f6||0xc8;return function(_0x5122e4){if(_0x5122e4){return _0x3a4e07[_0x4ff2('0x2f')](_0x4064f6)[_0x4ff2('0x31')](_0x5122e4);}};}function respondWithFilteredResult(_0x2c70f5,_0x3e1d5b){return function(_0xf27263){if(_0xf27263){var _0x3f4c2c=typeof _0x3e1d5b[_0x4ff2('0x32')]===_0x4ff2('0x33')&&typeof _0x3e1d5b[_0x4ff2('0x34')]===_0x4ff2('0x33');var _0x159b2c=_0xf27263[_0x4ff2('0x35')];var _0x33342d=_0x3f4c2c?0x0:_0x3e1d5b['offset'];var _0x3a5ba8=_0x3f4c2c?_0xf27263['count']:_0x3e1d5b[_0x4ff2('0x32')]+_0x3e1d5b['limit'];var _0x147274;if(_0x3a5ba8>=_0x159b2c){_0x3a5ba8=_0x159b2c;_0x147274=0xc8;}else{_0x147274=0xce;}_0x2c70f5[_0x4ff2('0x2f')](_0x147274);return _0x2c70f5['set'](_0x4ff2('0x36'),_0x33342d+'-'+_0x3a5ba8+'/'+_0x159b2c)['json'](_0xf27263);}return null;};}function patchUpdates(_0x5e6aa8){return function(_0x35389a){try{jsonpatch[_0x4ff2('0x37')](_0x35389a,_0x5e6aa8,!![]);}catch(_0x5b8000){return BPromise[_0x4ff2('0x38')](_0x5b8000);}return _0x35389a[_0x4ff2('0x39')]();};}function saveUpdates(_0x4ffd39,_0x452e2f){return function(_0x3d33ba){if(_0x3d33ba){return _0x3d33ba[_0x4ff2('0x3a')](_0x4ffd39)['then'](function(_0x8fd1f0){return _0x8fd1f0;});}return null;};}function removeEntity(_0x5d4400,_0x998487){return function(_0x32b780){if(_0x32b780){return _0x32b780[_0x4ff2('0x3b')]()['then'](function(){var _0x220821=_0x32b780[_0x4ff2('0x3c')]({'plain':!![]});var _0x1df364=_0x4ff2('0x3d');return db[_0x4ff2('0x3e')]['destroy']({'where':{'type':_0x1df364,'resourceId':_0x220821['id']}})[_0x4ff2('0x3f')](function(){return _0x32b780;});})[_0x4ff2('0x3f')](function(){_0x5d4400[_0x4ff2('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3efdb2,_0x48ecf7){return function(_0x57e408){if(!_0x57e408){_0x3efdb2[_0x4ff2('0x2e')](0x194);}return _0x57e408;};}function handleError(_0x4e48d1,_0x41e577){_0x41e577=_0x41e577||0x1f4;return function(_0x2ab413){logger['error'](_0x2ab413[_0x4ff2('0x40')]);if(_0x2ab413['name']){delete _0x2ab413[_0x4ff2('0x41')];}_0x4e48d1[_0x4ff2('0x2f')](_0x41e577)[_0x4ff2('0x42')](_0x2ab413);};}exports[_0x4ff2('0x43')]=function(_0x18b366,_0x33dba1){var _0x118f91={'include':[{'model':db[_0x4ff2('0x44')],'as':_0x4ff2('0x45')},{'model':db[_0x4ff2('0x46')],'as':_0x4ff2('0x47')},{'model':db[_0x4ff2('0x48')],'as':_0x4ff2('0x49')}]},_0x5e0abe={},_0x5d6812={'count':0x0,'rows':[]};var _0x5656b3=_[_0x4ff2('0x4a')](db['MailAccount'][_0x4ff2('0x4b')],function(_0x346bb0){return{'name':_0x346bb0['fieldName'],'type':_0x346bb0[_0x4ff2('0x4c')][_0x4ff2('0x4d')]};});_0x5e0abe[_0x4ff2('0x4e')]=_[_0x4ff2('0x4a')](_0x5656b3,_0x4ff2('0x41'));_0x5e0abe[_0x4ff2('0x4f')]=_['keys'](_0x18b366['query']);_0x5e0abe[_0x4ff2('0x50')]=_[_0x4ff2('0x51')](_0x5e0abe[_0x4ff2('0x4e')],_0x5e0abe[_0x4ff2('0x4f')]);_0x118f91['attributes']=_[_0x4ff2('0x51')](_0x5e0abe[_0x4ff2('0x4e')],qs[_0x4ff2('0x52')](_0x18b366[_0x4ff2('0x4f')][_0x4ff2('0x52')]));_0x118f91[_0x4ff2('0x53')]=_0x118f91[_0x4ff2('0x53')][_0x4ff2('0x54')]?_0x118f91[_0x4ff2('0x53')]:_0x5e0abe[_0x4ff2('0x4e')];if(!_0x18b366[_0x4ff2('0x4f')]['hasOwnProperty'](_0x4ff2('0x55'))){_0x118f91[_0x4ff2('0x34')]=qs[_0x4ff2('0x34')](_0x18b366[_0x4ff2('0x4f')]['limit']);_0x118f91[_0x4ff2('0x32')]=qs[_0x4ff2('0x32')](_0x18b366['query']['offset']);}_0x118f91[_0x4ff2('0x56')]=qs[_0x4ff2('0x57')](_0x18b366[_0x4ff2('0x4f')][_0x4ff2('0x57')]);_0x118f91['where']=qs[_0x4ff2('0x50')](_[_0x4ff2('0x58')](_0x18b366['query'],_0x5e0abe[_0x4ff2('0x50')]),_0x5656b3);if(_0x18b366[_0x4ff2('0x4f')]['filter']){_0x118f91[_0x4ff2('0x59')]=_[_0x4ff2('0x5a')](_0x118f91['where'],{'$or':_['map'](_0x5656b3,function(_0x5b9ada){if(_0x5b9ada[_0x4ff2('0x4c')]!=='VIRTUAL'){var _0xd3968a={};_0xd3968a[_0x5b9ada[_0x4ff2('0x41')]]={'$like':'%'+_0x18b366[_0x4ff2('0x4f')][_0x4ff2('0x5b')]+'%'};return _0xd3968a;}})});}_0x118f91=_[_0x4ff2('0x5a')]({},_0x118f91,_0x18b366[_0x4ff2('0x5c')]);var _0x31d36f={'where':_0x118f91[_0x4ff2('0x59')]};return db[_0x4ff2('0x5d')][_0x4ff2('0x35')](_0x31d36f)[_0x4ff2('0x3f')](function(_0x463d65){_0x5d6812[_0x4ff2('0x35')]=_0x463d65;if(_0x18b366['query']['includeAll']){_0x118f91[_0x4ff2('0x5e')]=[{'all':!![]}];}return db['MailAccount'][_0x4ff2('0x5f')](_0x118f91);})[_0x4ff2('0x3f')](function(_0x2306d1){_0x5d6812[_0x4ff2('0x60')]=_0x2306d1;return _0x5d6812;})[_0x4ff2('0x3f')](respondWithFilteredResult(_0x33dba1,_0x118f91))[_0x4ff2('0x2d')](handleError(_0x33dba1,null));};exports[_0x4ff2('0x61')]=function(_0x504f76,_0x3728fc){var _0x216034={'raw':![],'where':{'id':_0x504f76[_0x4ff2('0x62')]['id']},'include':[{'model':db[_0x4ff2('0x44')],'as':_0x4ff2('0x45')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x4ff2('0x48')],'as':_0x4ff2('0x49')}]},_0x229033={};_0x229033[_0x4ff2('0x4e')]=_['keys'](db['MailAccount'][_0x4ff2('0x4b')]);_0x229033[_0x4ff2('0x4f')]=_[_0x4ff2('0x63')](_0x504f76[_0x4ff2('0x4f')]);_0x229033[_0x4ff2('0x50')]=_[_0x4ff2('0x51')](_0x229033['model'],_0x229033[_0x4ff2('0x4f')]);_0x216034['attributes']=_['intersection'](_0x229033[_0x4ff2('0x4e')],qs[_0x4ff2('0x52')](_0x504f76[_0x4ff2('0x4f')]['fields']));_0x216034['attributes']=_0x216034[_0x4ff2('0x53')][_0x4ff2('0x54')]?_0x216034[_0x4ff2('0x53')]:_0x229033['model'];if(_0x504f76['query'][_0x4ff2('0x64')]){_0x216034[_0x4ff2('0x5e')]=[{'all':!![]}];}_0x216034=_[_0x4ff2('0x5a')]({},_0x216034,_0x504f76[_0x4ff2('0x5c')]);return db['MailAccount'][_0x4ff2('0x65')](_0x216034)[_0x4ff2('0x3f')](handleEntityNotFound(_0x3728fc,null))[_0x4ff2('0x3f')](respondWithResult(_0x3728fc,null))[_0x4ff2('0x2d')](handleError(_0x3728fc,null));};exports['update']=function(_0xe467d6,_0x5ec2db){if(_0xe467d6[_0x4ff2('0x66')]['id']){delete _0xe467d6[_0x4ff2('0x66')]['id'];}return db[_0x4ff2('0x5d')]['find']({'where':{'id':_0xe467d6['params']['id']},'include':[{'model':db[_0x4ff2('0x44')],'as':'Imap'},{'model':db[_0x4ff2('0x46')],'as':'Smtp'},{'model':db[_0x4ff2('0x48')],'as':_0x4ff2('0x49')}]})['then'](handleEntityNotFound(_0x5ec2db,null))[_0x4ff2('0x3f')](saveUpdates(_0xe467d6[_0x4ff2('0x66')],null))[_0x4ff2('0x3f')](function(_0x1b0a70){if(_0x1b0a70&&_0xe467d6['body'][_0x4ff2('0x45')]){return db[_0x4ff2('0x44')][_0x4ff2('0x3a')](_0xe467d6['body'][_0x4ff2('0x45')],{'where':{'MailAccountId':_0x1b0a70['id']}})[_0x4ff2('0x3f')](function(){return _0x1b0a70;});}return _0x1b0a70;})[_0x4ff2('0x3f')](function(_0x315eca){if(_0x315eca&&_0xe467d6[_0x4ff2('0x66')]['Smtp']){return db[_0x4ff2('0x46')][_0x4ff2('0x3a')](_0xe467d6[_0x4ff2('0x66')][_0x4ff2('0x47')],{'where':{'MailAccountId':_0x315eca['id']}})[_0x4ff2('0x3f')](function(){return _0x315eca;});}return _0x315eca;})[_0x4ff2('0x3f')](respondWithResult(_0x5ec2db,null))[_0x4ff2('0x2d')](handleError(_0x5ec2db,null));};exports[_0x4ff2('0x67')]=function(_0x148d28,_0x46be6d){return db['MailAccount'][_0x4ff2('0x67')]()[_0x4ff2('0x3f')](respondWithResult(_0x46be6d,null))[_0x4ff2('0x2d')](handleError(_0x46be6d,null));};exports['addDisposition']=function(_0x44c140,_0x153644,_0x4a6d67){if(_0x44c140[_0x4ff2('0x66')]['id']){delete _0x44c140['body']['id'];}return db['MailAccount'][_0x4ff2('0x65')]({'where':{'id':_0x44c140['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x153644,null))[_0x4ff2('0x3f')](function(_0x219d92){if(_0x219d92){_0x44c140[_0x4ff2('0x66')][_0x4ff2('0x68')]=_0x219d92['id'];return db[_0x4ff2('0x69')][_0x4ff2('0x6a')](_0x44c140['body']);}})[_0x4ff2('0x3f')](respondWithResult(_0x153644,null))[_0x4ff2('0x2d')](handleError(_0x153644,null));};exports[_0x4ff2('0x6b')]=function(_0x320ee9,_0x22e5f2,_0x3f9f2e){var _0x5a2d19={'raw':![],'where':{}};var _0x53eb4e={};var _0x575320={'count':0x0,'rows':[]};return db[_0x4ff2('0x5d')][_0x4ff2('0x6c')]({'where':{'id':_0x320ee9['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x22e5f2,null))[_0x4ff2('0x3f')](function(_0x55452c){if(_0x55452c){_0x53eb4e[_0x4ff2('0x4e')]=_['keys'](db[_0x4ff2('0x69')][_0x4ff2('0x4b')]);_0x53eb4e[_0x4ff2('0x4f')]=_[_0x4ff2('0x63')](_0x320ee9[_0x4ff2('0x4f')]);_0x53eb4e['filters']=_[_0x4ff2('0x51')](_0x53eb4e[_0x4ff2('0x4e')],_0x53eb4e[_0x4ff2('0x4f')]);_0x5a2d19['attributes']=_[_0x4ff2('0x51')](_0x53eb4e[_0x4ff2('0x4e')],qs[_0x4ff2('0x52')](_0x320ee9['query'][_0x4ff2('0x52')]));_0x5a2d19[_0x4ff2('0x53')]=_0x5a2d19[_0x4ff2('0x53')][_0x4ff2('0x54')]?_0x5a2d19[_0x4ff2('0x53')]:_0x53eb4e[_0x4ff2('0x4e')];if(!_0x320ee9[_0x4ff2('0x4f')][_0x4ff2('0x6d')](_0x4ff2('0x55'))){_0x5a2d19[_0x4ff2('0x34')]=qs['limit'](_0x320ee9[_0x4ff2('0x4f')]['limit']);_0x5a2d19[_0x4ff2('0x32')]=qs['offset'](_0x320ee9['query'][_0x4ff2('0x32')]);}_0x5a2d19[_0x4ff2('0x56')]=qs[_0x4ff2('0x57')](_0x320ee9[_0x4ff2('0x4f')]['sort']);_0x5a2d19['where']=qs[_0x4ff2('0x50')](_[_0x4ff2('0x58')](_0x320ee9[_0x4ff2('0x4f')],_0x53eb4e[_0x4ff2('0x50')]));_0x5a2d19['where'][_0x4ff2('0x68')]=_0x55452c['id'];if(_0x320ee9['query'][_0x4ff2('0x5b')]){_0x5a2d19['where']=_['merge'](_0x5a2d19['where'],{'$or':_[_0x4ff2('0x4a')](_0x5a2d19[_0x4ff2('0x53')],function(_0x2484ca){var _0x77a16a={};_0x77a16a[_0x2484ca]={'$like':'%'+_0x320ee9['query'][_0x4ff2('0x5b')]+'%'};return _0x77a16a;})});}_0x5a2d19=_[_0x4ff2('0x5a')]({},_0x5a2d19,_0x320ee9['options']);return db[_0x4ff2('0x69')][_0x4ff2('0x35')]({'where':_0x5a2d19[_0x4ff2('0x59')]})[_0x4ff2('0x3f')](function(_0x4d6522){_0x575320[_0x4ff2('0x35')]=_0x4d6522;if(_0x320ee9[_0x4ff2('0x4f')]['includeAll']){_0x5a2d19[_0x4ff2('0x5e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5a2d19);})['then'](function(_0x403fd6){_0x575320[_0x4ff2('0x60')]=_0x403fd6;return _0x575320;});}})[_0x4ff2('0x3f')](respondWithFilteredResult(_0x22e5f2,_0x5a2d19))[_0x4ff2('0x2d')](handleError(_0x22e5f2,null));};exports['removeDispositions']=function(_0x5d624d,_0x3ac152,_0x38c01a){return db['MailAccount'][_0x4ff2('0x65')]({'where':{'id':_0x5d624d['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x3ac152,null))[_0x4ff2('0x3f')](function(_0x366b0a){if(_0x366b0a){return _0x366b0a[_0x4ff2('0x6e')](_0x5d624d['query'][_0x4ff2('0x6f')]);}})['then'](respondWithStatusCode(_0x3ac152,null))[_0x4ff2('0x2d')](handleError(_0x3ac152,null));};exports[_0x4ff2('0x70')]=function(_0x2006c8,_0x4b39d1,_0x207b99){if(_0x2006c8[_0x4ff2('0x66')]['id']){delete _0x2006c8[_0x4ff2('0x66')]['id'];}return db[_0x4ff2('0x5d')][_0x4ff2('0x65')]({'where':{'id':_0x2006c8['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x4b39d1,null))[_0x4ff2('0x3f')](function(_0x3a94d8){if(_0x3a94d8){_0x2006c8[_0x4ff2('0x66')][_0x4ff2('0x68')]=_0x3a94d8['id'];return db[_0x4ff2('0x71')][_0x4ff2('0x6a')](_0x2006c8[_0x4ff2('0x66')]);}})[_0x4ff2('0x3f')](respondWithResult(_0x4b39d1,null))['catch'](handleError(_0x4b39d1,null));};exports[_0x4ff2('0x72')]=function(_0x37a8c1,_0x593c53,_0x168621){var _0x35f6b9={'raw':![],'where':{}};var _0xc2ae8d={};var _0x12f578={'count':0x0,'rows':[]};return db[_0x4ff2('0x5d')][_0x4ff2('0x6c')]({'where':{'id':_0x37a8c1['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x593c53,null))[_0x4ff2('0x3f')](function(_0x5c96a6){if(_0x5c96a6){_0xc2ae8d[_0x4ff2('0x4e')]=_[_0x4ff2('0x63')](db[_0x4ff2('0x71')][_0x4ff2('0x4b')]);_0xc2ae8d[_0x4ff2('0x4f')]=_[_0x4ff2('0x63')](_0x37a8c1['query']);_0xc2ae8d[_0x4ff2('0x50')]=_[_0x4ff2('0x51')](_0xc2ae8d[_0x4ff2('0x4e')],_0xc2ae8d[_0x4ff2('0x4f')]);_0x35f6b9[_0x4ff2('0x53')]=_[_0x4ff2('0x51')](_0xc2ae8d['model'],qs[_0x4ff2('0x52')](_0x37a8c1[_0x4ff2('0x4f')]['fields']));_0x35f6b9[_0x4ff2('0x53')]=_0x35f6b9['attributes'][_0x4ff2('0x54')]?_0x35f6b9['attributes']:_0xc2ae8d[_0x4ff2('0x4e')];if(!_0x37a8c1[_0x4ff2('0x4f')]['hasOwnProperty']('nolimit')){_0x35f6b9[_0x4ff2('0x34')]=qs[_0x4ff2('0x34')](_0x37a8c1[_0x4ff2('0x4f')][_0x4ff2('0x34')]);_0x35f6b9[_0x4ff2('0x32')]=qs[_0x4ff2('0x32')](_0x37a8c1[_0x4ff2('0x4f')]['offset']);}_0x35f6b9['order']=qs['sort'](_0x37a8c1[_0x4ff2('0x4f')][_0x4ff2('0x57')]);_0x35f6b9[_0x4ff2('0x59')]=qs['filters'](_[_0x4ff2('0x58')](_0x37a8c1['query'],_0xc2ae8d[_0x4ff2('0x50')]));_0x35f6b9[_0x4ff2('0x59')][_0x4ff2('0x68')]=_0x5c96a6['id'];if(_0x37a8c1[_0x4ff2('0x4f')][_0x4ff2('0x5b')]){_0x35f6b9[_0x4ff2('0x59')]=_[_0x4ff2('0x5a')](_0x35f6b9[_0x4ff2('0x59')],{'$or':_[_0x4ff2('0x4a')](_0x35f6b9[_0x4ff2('0x53')],function(_0x3f1ffe){var _0x16cba1={};_0x16cba1[_0x3f1ffe]={'$like':'%'+_0x37a8c1[_0x4ff2('0x4f')][_0x4ff2('0x5b')]+'%'};return _0x16cba1;})});}_0x35f6b9=_[_0x4ff2('0x5a')]({},_0x35f6b9,_0x37a8c1[_0x4ff2('0x5c')]);return db['CannedAnswer'][_0x4ff2('0x35')]({'where':_0x35f6b9[_0x4ff2('0x59')]})['then'](function(_0xaa812){_0x12f578[_0x4ff2('0x35')]=_0xaa812;if(_0x37a8c1[_0x4ff2('0x4f')][_0x4ff2('0x64')]){_0x35f6b9['include']=[{'all':!![]}];}return db[_0x4ff2('0x71')]['findAll'](_0x35f6b9);})[_0x4ff2('0x3f')](function(_0x4408fd){_0x12f578[_0x4ff2('0x60')]=_0x4408fd;return _0x12f578;});}})[_0x4ff2('0x3f')](respondWithFilteredResult(_0x593c53,_0x35f6b9))[_0x4ff2('0x2d')](handleError(_0x593c53,null));};exports[_0x4ff2('0x73')]=function(_0x1e884f,_0x2a8ece,_0x3af919){return db[_0x4ff2('0x5d')][_0x4ff2('0x65')]({'where':{'id':_0x1e884f[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x2a8ece,null))[_0x4ff2('0x3f')](function(_0xe2105e){if(_0xe2105e){return _0xe2105e[_0x4ff2('0x73')](_0x1e884f[_0x4ff2('0x4f')][_0x4ff2('0x6f')]);}})[_0x4ff2('0x3f')](respondWithStatusCode(_0x2a8ece,null))[_0x4ff2('0x2d')](handleError(_0x2a8ece,null));};exports[_0x4ff2('0x6a')]=function(_0x3a4431,_0x59ac84){var _0x2ed20d={'name':_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x41')],'key':_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x4d')],'email':_0x3a4431[_0x4ff2('0x66')]['email'],'ListId':_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x74')],'active':!_[_0x4ff2('0x75')](_0x3a4431['body'][_0x4ff2('0x76')])?_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x76')]:!![],'description':_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x4ff2('0x75')](_0x3a4431[_0x4ff2('0x66')]['cservice'])){if(_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x78')]){_0x2ed20d[_0x4ff2('0x45')][_0x4ff2('0x79')]=_0x2ed20d[_0x4ff2('0x47')][_0x4ff2('0x79')]=_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x7a')];_0x2ed20d[_0x4ff2('0x45')]['password']=_0x2ed20d[_0x4ff2('0x47')][_0x4ff2('0x7b')]=_0x3a4431[_0x4ff2('0x66')]['cpassword'];}else{_0x2ed20d[_0x4ff2('0x45')][_0x4ff2('0x7c')]=_0x2ed20d['Smtp'][_0x4ff2('0x7c')]=![];}_0x2ed20d[_0x4ff2('0x45')][_0x4ff2('0x7d')]=_0x3a4431['body'][_0x4ff2('0x45')][_0x4ff2('0x7d')];_0x2ed20d[_0x4ff2('0x45')]['port']=_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x45')][_0x4ff2('0x7e')];_0x2ed20d[_0x4ff2('0x47')][_0x4ff2('0x7d')]=_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x47')][_0x4ff2('0x7d')];_0x2ed20d['Smtp'][_0x4ff2('0x7e')]=_0x3a4431['body'][_0x4ff2('0x47')][_0x4ff2('0x7e')];}else{_0x2ed20d[_0x4ff2('0x45')][_0x4ff2('0x7f')]=_0x2ed20d['Smtp']['service']=_0x3a4431[_0x4ff2('0x66')][_0x4ff2('0x80')];_0x2ed20d[_0x4ff2('0x45')][_0x4ff2('0x79')]=_0x2ed20d[_0x4ff2('0x47')][_0x4ff2('0x79')]=_0x3a4431[_0x4ff2('0x66')]['cuser'];_0x2ed20d[_0x4ff2('0x45')]['password']=_0x2ed20d[_0x4ff2('0x47')][_0x4ff2('0x7b')]=_0x3a4431['body'][_0x4ff2('0x81')];}return db[_0x4ff2('0x5d')][_0x4ff2('0x6a')](_0x2ed20d,{'include':[{'model':db[_0x4ff2('0x46')],'as':'Smtp'},{'model':db[_0x4ff2('0x44')],'as':'Imap'}]})[_0x4ff2('0x3f')](function(_0x3c9e3c){var _0x2a1acb=_0x3a4431['user']['get']({'plain':!![]});if(!_0x2a1acb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a1acb[_0x4ff2('0x82')]==='user'){var _0x5c32f4=_0x3c9e3c[_0x4ff2('0x3c')]({'plain':!![]});return db[_0x4ff2('0x83')][_0x4ff2('0x65')]({'where':{'name':_0x4ff2('0x3d'),'userProfileId':_0x2a1acb[_0x4ff2('0x84')]},'raw':!![]})[_0x4ff2('0x3f')](function(_0xa8a2c3){if(_0xa8a2c3&&_0xa8a2c3[_0x4ff2('0x85')]===0x0){return db['UserProfileResource'][_0x4ff2('0x6a')]({'name':_0x5c32f4['name'],'resourceId':_0x5c32f4['id'],'type':_0xa8a2c3[_0x4ff2('0x41')],'sectionId':_0xa8a2c3['id']},{})[_0x4ff2('0x3f')](function(){return _0x3c9e3c;});}else{return _0x3c9e3c;}})[_0x4ff2('0x2d')](function(_0x198689){logger[_0x4ff2('0x29')](_0x4ff2('0x86'),_0x198689);throw _0x198689;});}return _0x3c9e3c;})['then'](respondWithResult(_0x59ac84,0xc9))[_0x4ff2('0x2d')](handleError(_0x59ac84,null));};exports[_0x4ff2('0x87')]=function(_0x5caea9,_0x360de9,_0x33a068){return db[_0x4ff2('0x5d')][_0x4ff2('0x6c')]({'where':{'id':_0x5caea9['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x360de9,null))[_0x4ff2('0x3f')](function(_0xc3ee80){if(_0xc3ee80){return _0xc3ee80[_0x4ff2('0x87')]();}return null;})[_0x4ff2('0x3f')](respondWithResult(_0x360de9,null))[_0x4ff2('0x2d')](handleError(_0x360de9,null));};exports[_0x4ff2('0x88')]=function(_0x2bbac6,_0x50c92a,_0x1af85d){if(_0x2bbac6[_0x4ff2('0x66')]['id']){delete _0x2bbac6[_0x4ff2('0x66')]['id'];}return db[_0x4ff2('0x5d')]['find']({'where':{'id':_0x2bbac6['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x50c92a,null))['then'](function(_0x5210ef){if(_0x5210ef){_0x2bbac6[_0x4ff2('0x66')][_0x4ff2('0x68')]=_0x5210ef['id'];return db[_0x4ff2('0x44')][_0x4ff2('0x6a')](_0x2bbac6[_0x4ff2('0x66')]);}})[_0x4ff2('0x3f')](respondWithResult(_0x50c92a,null))['catch'](handleError(_0x50c92a,null));};exports[_0x4ff2('0x89')]=function(_0x327176,_0x54b488,_0x14aff7){return db[_0x4ff2('0x5d')][_0x4ff2('0x6c')]({'where':{'id':_0x327176[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x54b488,null))['then'](function(_0x59beee){if(_0x59beee){return _0x59beee['setImap'](null);}return null;})[_0x4ff2('0x3f')](respondWithStatusCode(_0x54b488,null))[_0x4ff2('0x2d')](handleError(_0x54b488,null));};exports['getSmtp']=function(_0x543eb3,_0x29d202,_0x23b355){return db[_0x4ff2('0x5d')]['findOne']({'where':{'id':_0x543eb3[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x29d202,null))[_0x4ff2('0x3f')](function(_0x5177a8){if(_0x5177a8){return _0x5177a8[_0x4ff2('0x8a')]();}return null;})[_0x4ff2('0x3f')](respondWithResult(_0x29d202,null))['catch'](handleError(_0x29d202,null));};exports[_0x4ff2('0x8b')]=function(_0x47f775,_0x4e725b,_0x18eb9b){if(_0x47f775['body']['id']){delete _0x47f775[_0x4ff2('0x66')]['id'];}return db[_0x4ff2('0x5d')][_0x4ff2('0x65')]({'where':{'id':_0x47f775['params']['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x4e725b,null))[_0x4ff2('0x3f')](function(_0x1c215c){if(_0x1c215c){_0x47f775['body']['MailAccountId']=_0x1c215c['id'];return db[_0x4ff2('0x46')]['create'](_0x47f775[_0x4ff2('0x66')]);}})['then'](respondWithResult(_0x4e725b,null))[_0x4ff2('0x2d')](handleError(_0x4e725b,null));};exports[_0x4ff2('0x8c')]=function(_0x284d35,_0x22835f,_0x5c5f5f){return db[_0x4ff2('0x5d')][_0x4ff2('0x6c')]({'where':{'id':_0x284d35[_0x4ff2('0x62')]['id']}})['then'](handleEntityNotFound(_0x22835f,null))[_0x4ff2('0x3f')](function(_0x29ddc3){if(_0x29ddc3){return _0x29ddc3['setSmtp'](null);}return null;})[_0x4ff2('0x3f')](respondWithStatusCode(_0x22835f,null))[_0x4ff2('0x2d')](handleError(_0x22835f,null));};exports['addInteraction']=function(_0x8613fe,_0x2b6436,_0x304371){return db[_0x4ff2('0x8d')][_0x4ff2('0x65')]({'where':{'id':_0x8613fe[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x2b6436,null))[_0x4ff2('0x3f')](function(_0x48ba91){if(_0x48ba91){return _0x48ba91['addInteraction'](_0x8613fe['body'][_0x4ff2('0x6f')],_[_0x4ff2('0x8e')](_0x8613fe[_0x4ff2('0x66')],[_0x4ff2('0x6f'),'id'])||{});}})[_0x4ff2('0x3f')](respondWithResult(_0x2b6436,null))[_0x4ff2('0x2d')](handleError(_0x2b6436,null));};exports[_0x4ff2('0x8f')]=function(_0x150c99,_0x3b9cde,_0x96ba6e){var _0x4cf697={'raw':![],'where':{}};var _0x4158de={};var _0x11bc45={'count':0x0,'rows':[]};return db[_0x4ff2('0x5d')][_0x4ff2('0x6c')]({'where':{'id':_0x150c99[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x3b9cde,null))['then'](function(_0x40083d){if(_0x40083d){_0x4158de[_0x4ff2('0x4e')]=_[_0x4ff2('0x63')](db[_0x4ff2('0x8d')]['rawAttributes']);_0x4158de[_0x4ff2('0x4f')]=_[_0x4ff2('0x63')](_0x150c99[_0x4ff2('0x4f')]);_0x4158de['filters']=_[_0x4ff2('0x51')](_0x4158de[_0x4ff2('0x4e')],_0x4158de[_0x4ff2('0x4f')]);_0x4cf697[_0x4ff2('0x53')]=_[_0x4ff2('0x51')](_0x4158de[_0x4ff2('0x4e')],qs['fields'](_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x52')]));_0x4cf697['attributes']=_0x4cf697['attributes'][_0x4ff2('0x54')]?_0x4cf697[_0x4ff2('0x53')]:_0x4158de[_0x4ff2('0x4e')];if(!_0x150c99['query'][_0x4ff2('0x6d')](_0x4ff2('0x55'))){_0x4cf697['limit']=qs['limit'](_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x34')]);_0x4cf697[_0x4ff2('0x32')]=qs[_0x4ff2('0x32')](_0x150c99['query'][_0x4ff2('0x32')]);}_0x4cf697['order']=qs[_0x4ff2('0x57')](_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x57')]);_0x4cf697[_0x4ff2('0x59')]=qs[_0x4ff2('0x50')](_[_0x4ff2('0x58')](_0x150c99[_0x4ff2('0x4f')],_0x4158de[_0x4ff2('0x50')]));_0x4cf697[_0x4ff2('0x59')][_0x4ff2('0x68')]=_0x40083d['id'];if(_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x5b')]){_0x4cf697[_0x4ff2('0x59')]=_[_0x4ff2('0x5a')](_0x4cf697[_0x4ff2('0x59')],{'$or':_[_0x4ff2('0x4a')](_0x4cf697['attributes'],function(_0x37e84c){var _0x21b0ff={};_0x21b0ff[_0x37e84c]={'$like':'%'+_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x5b')]+'%'};return _0x21b0ff;})});}_0x4cf697=_[_0x4ff2('0x5a')]({},_0x4cf697,_0x150c99[_0x4ff2('0x5c')]);return db['MailInteraction']['count']({'where':_0x4cf697[_0x4ff2('0x59')]})[_0x4ff2('0x3f')](function(_0x3ef307){_0x11bc45[_0x4ff2('0x35')]=_0x3ef307;if(_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x64')]){_0x4cf697['include']=[{'model':db[_0x4ff2('0x90')],'as':'Contact','required':![]},{'model':db[_0x4ff2('0x91')],'as':'Owner','attributes':['name',_0x4ff2('0x92'),_0x4ff2('0x93')],'required':![]},{'model':db[_0x4ff2('0x94')],'as':_0x4ff2('0x95'),'attributes':['id',_0x4ff2('0x41'),_0x4ff2('0x96')],'where':_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x97')]?{'id':_0x150c99[_0x4ff2('0x4f')][_0x4ff2('0x97')]}:undefined,'required':_0x150c99[_0x4ff2('0x4f')]['tag']?!![]:![]}];}return db[_0x4ff2('0x8d')]['findAll'](_0x4cf697);})[_0x4ff2('0x3f')](function(_0x2c636b){_0x11bc45[_0x4ff2('0x60')]=_0x2c636b;return _0x11bc45;});}})['then'](respondWithFilteredResult(_0x3b9cde,_0x4cf697))[_0x4ff2('0x2d')](handleError(_0x3b9cde,null));};exports[_0x4ff2('0x98')]=function addApplications(_0x3c8e72,_0x52e29f){var _0x48c433=_0x3c8e72[_0x4ff2('0x62')]['id'];var _0x335897=_0x3c8e72[_0x4ff2('0x66')];var _0x3aeed0=0xc8;var _0x16756d=null;return db[_0x4ff2('0x99')][_0x4ff2('0x9a')]({'isolationLevel':db[_0x4ff2('0x99')][_0x4ff2('0x9b')]['ISOLATION_LEVELS'][_0x4ff2('0x9c')]},function(_0x43e8f0){return db[_0x4ff2('0x5d')]['findOne']({'where':{'id':_0x48c433},'transaction':_0x43e8f0})['then'](function(_0x15c43f){if(_0x15c43f){return db['MailApplication'][_0x4ff2('0x3b')]({'where':{'MailAccountId':_0x48c433},'transaction':_0x43e8f0})[_0x4ff2('0x3f')](function(){var _0x2b24c4=_[_0x4ff2('0x4a')](_0x335897,function(_0xc9962b){_0xc9962b[_0x4ff2('0x68')]=_0x48c433;return _0xc9962b;});return db[_0x4ff2('0x9d')][_0x4ff2('0x9e')](_0x2b24c4,{'transaction':_0x43e8f0});});}else{_0x3aeed0=0x194;_0x16756d=[];}});})[_0x4ff2('0x3f')](function(){if(_0x3aeed0!==0x194){return db['MailApplication'][_0x4ff2('0x9f')]({'where':{'MailAccountId':_0x48c433},'order':_0x4ff2('0xa0')})['then'](function(_0xe97f86){_0x16756d=_0xe97f86;});}})['catch'](function(_0x393a62){_0x3aeed0=0x1f4;logger[_0x4ff2('0x29')](_0x393a62[_0x4ff2('0x40')]);if(_0x393a62[_0x4ff2('0x41')]){delete _0x393a62['name'];}_0x16756d=_0x393a62;})[_0x4ff2('0xa1')](function(){if(_0x16756d===null){_0x52e29f[_0x4ff2('0x2e')](_0x3aeed0);}else{if(_0x3aeed0===0x1f4){_0x52e29f[_0x4ff2('0x2f')](_0x3aeed0)['send'](_0x16756d);}else{_0x52e29f[_0x4ff2('0x2f')](_0x3aeed0)[_0x4ff2('0x31')](_0x16756d);}}});};exports[_0x4ff2('0xa2')]=function(_0x5b4058,_0xdf8199,_0x1d0a83){var _0x8c5b6={};var _0x2cc4a8={};var _0x2ddfdc;var _0x5ef404;return db['MailAccount']['findOne']({'where':{'id':_0x5b4058[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0xdf8199,null))[_0x4ff2('0x3f')](function(_0x484d65){if(_0x484d65){_0x2ddfdc=_0x484d65;_0x2cc4a8[_0x4ff2('0x4e')]=_['keys'](db[_0x4ff2('0x9d')]['rawAttributes']);_0x2cc4a8['query']=_['keys'](_0x5b4058['query']);_0x2cc4a8[_0x4ff2('0x50')]=_[_0x4ff2('0x51')](_0x2cc4a8['model'],_0x2cc4a8[_0x4ff2('0x4f')]);_0x8c5b6[_0x4ff2('0x53')]=_[_0x4ff2('0x51')](_0x2cc4a8['model'],qs[_0x4ff2('0x52')](_0x5b4058[_0x4ff2('0x4f')][_0x4ff2('0x52')]));_0x8c5b6[_0x4ff2('0x53')]=_0x8c5b6[_0x4ff2('0x53')][_0x4ff2('0x54')]?_0x8c5b6['attributes']:_0x2cc4a8[_0x4ff2('0x4e')];_0x8c5b6[_0x4ff2('0x56')]=qs['sort'](_0x5b4058[_0x4ff2('0x4f')][_0x4ff2('0x57')]);_0x8c5b6[_0x4ff2('0x59')]=qs['filters'](_[_0x4ff2('0x58')](_0x5b4058[_0x4ff2('0x4f')],_0x2cc4a8['filters']));if(_0x5b4058[_0x4ff2('0x4f')][_0x4ff2('0x5b')]){_0x8c5b6[_0x4ff2('0x59')]=_['merge'](_0x8c5b6[_0x4ff2('0x59')],{'$or':_['map'](_0x8c5b6[_0x4ff2('0x53')],function(_0x409619){var _0x598978={};_0x598978[_0x409619]={'$like':'%'+_0x5b4058['query']['filter']+'%'};return _0x598978;})});}_0x8c5b6=_[_0x4ff2('0x5a')]({},_0x8c5b6,_0x5b4058[_0x4ff2('0x5c')]);return _0x2ddfdc[_0x4ff2('0xa2')](_0x8c5b6);}})[_0x4ff2('0x3f')](function(_0x2d122f){if(_0x2d122f){_0x5ef404=_0x2d122f['length'];if(!_0x5b4058[_0x4ff2('0x4f')]['hasOwnProperty'](_0x4ff2('0x55'))){_0x8c5b6['limit']=qs[_0x4ff2('0x34')](_0x5b4058[_0x4ff2('0x4f')][_0x4ff2('0x34')]);_0x8c5b6['offset']=qs[_0x4ff2('0x32')](_0x5b4058[_0x4ff2('0x4f')][_0x4ff2('0x32')]);}return _0x2ddfdc[_0x4ff2('0xa2')](_0x8c5b6);}})[_0x4ff2('0x3f')](function(_0x443d84){if(_0x443d84){return _0x443d84?{'count':_0x5ef404,'rows':_0x443d84}:null;}})['then'](respondWithResult(_0xdf8199,null))[_0x4ff2('0x2d')](handleError(_0xdf8199,null));};exports[_0x4ff2('0xa3')]=function(_0x287362,_0xc2511,_0xf5b72d){var _0x254c59={'raw':!![],'where':{}};var _0xd158c2={};var _0x2c9c5f={'count':0x0,'rows':[]};return db['MailAccount'][_0x4ff2('0x6c')]({'where':{'id':_0x287362[_0x4ff2('0x62')]['id']}})['then'](handleEntityNotFound(_0xc2511,null))[_0x4ff2('0x3f')](function(_0x1819de){if(_0x1819de){_0xd158c2[_0x4ff2('0x4e')]=_[_0x4ff2('0x63')](db[_0x4ff2('0xa4')]['rawAttributes']);_0xd158c2[_0x4ff2('0x4f')]=_[_0x4ff2('0x63')](_0x287362[_0x4ff2('0x4f')]);_0xd158c2['filters']=_['intersection'](_0xd158c2[_0x4ff2('0x4e')],_0xd158c2[_0x4ff2('0x4f')]);_0x254c59[_0x4ff2('0x53')]=_[_0x4ff2('0x51')](_0xd158c2[_0x4ff2('0x4e')],qs[_0x4ff2('0x52')](_0x287362[_0x4ff2('0x4f')][_0x4ff2('0x52')]));_0x254c59[_0x4ff2('0x53')]=_0x254c59[_0x4ff2('0x53')][_0x4ff2('0x54')]?_0x254c59[_0x4ff2('0x53')]:_0xd158c2[_0x4ff2('0x4e')];if(!_0x287362[_0x4ff2('0x4f')][_0x4ff2('0x6d')]('nolimit')){_0x254c59['limit']=qs[_0x4ff2('0x34')](_0x287362[_0x4ff2('0x4f')]['limit']);_0x254c59[_0x4ff2('0x32')]=qs[_0x4ff2('0x32')](_0x287362[_0x4ff2('0x4f')][_0x4ff2('0x32')]);}_0x254c59[_0x4ff2('0x56')]=qs[_0x4ff2('0x57')](_0x287362['query'][_0x4ff2('0x57')]);_0x254c59[_0x4ff2('0x59')]=qs['filters'](_['pick'](_0x287362[_0x4ff2('0x4f')],_0xd158c2[_0x4ff2('0x50')]));_0x254c59[_0x4ff2('0x59')][_0x4ff2('0x68')]=_0x1819de['id'];if(_0x287362['query'][_0x4ff2('0x5b')]){_0x254c59[_0x4ff2('0x59')]=_[_0x4ff2('0x5a')](_0x254c59[_0x4ff2('0x59')],{'$or':_[_0x4ff2('0x4a')](_0x254c59[_0x4ff2('0x53')],function(_0x1dbb71){var _0x267eaa={};_0x267eaa[_0x1dbb71]={'$like':'%'+_0x287362['query'][_0x4ff2('0x5b')]+'%'};return _0x267eaa;})});}if(_0x287362[_0x4ff2('0x4f')][_0x4ff2('0xa5')]){var _0x1398b5=_0x287362[_0x4ff2('0x4f')]['$gte'][_0x4ff2('0xa6')](',');var _0x26e878={};_0x26e878[_0x1398b5[0x0]]={'$gte':moment(_0x1398b5[0x1])[_0x4ff2('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x254c59[_0x4ff2('0x59')]=_[_0x4ff2('0x5a')](_0x254c59['where'],_0x26e878);}_0x254c59=_[_0x4ff2('0x5a')]({},_0x254c59,_0x287362[_0x4ff2('0x5c')]);return db[_0x4ff2('0xa4')]['count']({'where':_0x254c59[_0x4ff2('0x59')]})[_0x4ff2('0x3f')](function(_0x420bc4){_0x2c9c5f['count']=_0x420bc4;if(_0x287362['query'][_0x4ff2('0x64')]){_0x254c59['include']=[{'all':!![]}];}return db[_0x4ff2('0xa4')][_0x4ff2('0x5f')](_0x254c59);})[_0x4ff2('0x3f')](function(_0xe3c688){if(_0x287362[_0x4ff2('0x4f')][_0x4ff2('0xa8')]===_0x4ff2('0xa9')){for(var _0x1802ad=0x0;_0x1802ad<_0xe3c688[_0x4ff2('0x54')];_0x1802ad++){_0xe3c688[_0x1802ad][_0x4ff2('0x66')]=juice(_0xe3c688[_0x1802ad][_0x4ff2('0x66')]);}}_0x2c9c5f[_0x4ff2('0x60')]=_0xe3c688;return _0x2c9c5f;});}})[_0x4ff2('0x3f')](respondWithFilteredResult(_0xc2511,_0x254c59))[_0x4ff2('0x2d')](handleError(_0xc2511,null));};exports[_0x4ff2('0x42')]=function(_0x59e9f3,_0x1b84a4,_0x519e6b){var _0x259644,_0x258ba8={},_0x39559b;if(_0x59e9f3[_0x4ff2('0x66')]['to']){_0x39559b=_0x59e9f3[_0x4ff2('0x66')]['to'][_0x4ff2('0xa6')](',')[0x0];}return db[_0x4ff2('0x5d')]['find']({'where':{'id':_0x59e9f3['params']['id']},'include':[{'model':db[_0x4ff2('0xaa')],'as':'List','include':[{'model':db[_0x4ff2('0x90')],'as':_0x4ff2('0xab'),'where':{'email':_0x39559b},'limit':0x1,'order':[[_0x4ff2('0xac'),_0x4ff2('0xad')]]}]},{'model':db[_0x4ff2('0x46')],'as':'Smtp','raw':!![]}]})[_0x4ff2('0x3f')](handleEntityNotFound(_0x1b84a4,null))[_0x4ff2('0x3f')](function(_0x312b1b){if(_0x312b1b){_0x259644=_0x312b1b;if(_0x312b1b[_0x4ff2('0x47')]){if(_[_0x4ff2('0x75')](_0x59e9f3['body'][_0x4ff2('0xae')])){_0x59e9f3['body'][_0x4ff2('0xae')]=util[_0x4ff2('0xa7')]('%s\x20<%s>',_0x312b1b['name'],_0x312b1b[_0x4ff2('0xaf')]||_0x312b1b[_0x4ff2('0x47')]['user']);}if(_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xb0')]&&_0x59e9f3['body']['attachments'][_0x4ff2('0x54')]){for(var _0x424f5d=0x0;_0x424f5d<_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xb0')][_0x4ff2('0x54')];_0x424f5d+=0x1){_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xb0')][_0x424f5d]={'filename':_0x59e9f3['body'][_0x4ff2('0xb0')][_0x424f5d][_0x4ff2('0x41')],'path':path[_0x4ff2('0xb1')](config[_0x4ff2('0xb2')],_0x4ff2('0xb3'),_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xb0')][_0x424f5d][_0x4ff2('0xb4')])};}}var _0x2f752f={'tls':{'rejectUnauthorized':![]}};if(_[_0x4ff2('0x75')](_0x312b1b[_0x4ff2('0x47')]['service'])){if(_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0x7c')]){_0x2f752f['auth']={'user':_0x312b1b[_0x4ff2('0x47')]['user'],'pass':_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0x7b')]};}_0x2f752f[_0x4ff2('0x7d')]=_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0x7d')];_0x2f752f[_0x4ff2('0x7e')]=_0x312b1b['Smtp']['port'];_0x2f752f[_0x4ff2('0xb5')]=_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0xb5')];}else{_0x2f752f[_0x4ff2('0x7f')]=_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0x7f')];_0x2f752f[_0x4ff2('0xb6')]={'user':_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0x79')],'pass':_0x312b1b[_0x4ff2('0x47')][_0x4ff2('0x7b')]};}return respondWithRpcPromise(_0x4ff2('0xb7'),'sendMail',{'account':_0x2f752f,'message':_0x59e9f3[_0x4ff2('0x66')]});}else{throw new Error(_0x4ff2('0xb8'));}}})['then'](function(_0x3d197f){if(_0x3d197f){_0x258ba8=_0x3d197f;if(_0x259644[_0x4ff2('0xb9')]){if(_0x259644['List'][_0x4ff2('0xab')][_0x4ff2('0x54')]){return _0x259644['List'][_0x4ff2('0xab')][0x0];}else{return db[_0x4ff2('0x90')][_0x4ff2('0x6a')](_[_0x4ff2('0x1c')](_0x59e9f3[_0x4ff2('0x66')],{'firstName':_0x59e9f3[_0x4ff2('0x66')]['to'],'email':_0x59e9f3[_0x4ff2('0x66')]['to'],'phone':_0x59e9f3['body']['to'],'ListId':_0x259644[_0x4ff2('0x74')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x463807){if(_0x463807){var _0x382d12={'UserId':_0x59e9f3[_0x4ff2('0x79')]['id'],'ContactId':_0x463807['id'],'MailAccountId':_0x259644['id'],'inReplyTo':_0x258ba8[_0x4ff2('0xba')],'to':_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xae')],'cc':_0x59e9f3['body']['cc'],'subject':_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xbb')],'attach':_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xbc')],'firstMsgDirection':_0x4ff2('0xbd'),'lastMsgAt':moment()[_0x4ff2('0xa7')](_0x4ff2('0xbe')),'lastMsgDirection':_0x4ff2('0xbd'),'Messages':[_[_0x4ff2('0x5a')](_0x59e9f3[_0x4ff2('0x66')],{'messageId':_0x258ba8[_0x4ff2('0xba')],'sentAt':moment()['format'](_0x4ff2('0xbe')),'read':!![],'MailAccountId':_0x259644['id'],'UserId':_0x59e9f3[_0x4ff2('0x79')]['id'],'ContactId':_0x463807['id']})]};if(_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xbf')]){_0x382d12=_[_0x4ff2('0x5a')](_0x382d12,_0x59e9f3[_0x4ff2('0x66')][_0x4ff2('0xbf')]);}return db[_0x4ff2('0x8d')][_0x4ff2('0x6a')](_0x382d12,{'include':[{'model':db[_0x4ff2('0xa4')],'as':_0x4ff2('0xc0')}]});}})[_0x4ff2('0x3f')](respondWithResult(_0x1b84a4,null))[_0x4ff2('0x2d')](handleError(_0x1b84a4,null));};exports['verifySmtp']=function(_0x53bc68,_0x2b48ee,_0x1151fb){return db[_0x4ff2('0x5d')]['find']({'where':{'id':_0x53bc68[_0x4ff2('0x62')]['id']},'include':[{'model':db[_0x4ff2('0x46')],'as':_0x4ff2('0x47'),'raw':!![]}]})[_0x4ff2('0x3f')](handleEntityNotFound(_0x2b48ee,null))['then'](function(_0x38ecbb){if(_0x38ecbb&&_0x38ecbb[_0x4ff2('0x47')]){var _0x5af0d5={'id':_0x38ecbb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38ecbb[_0x4ff2('0x47')]['service']){_0x5af0d5['service']=_0x38ecbb['Smtp']['service'];}else{_0x5af0d5[_0x4ff2('0x7d')]=_0x38ecbb[_0x4ff2('0x47')]['host'];_0x5af0d5[_0x4ff2('0x7e')]=_0x38ecbb[_0x4ff2('0x47')][_0x4ff2('0x7e')];_0x5af0d5[_0x4ff2('0xb5')]=_0x38ecbb[_0x4ff2('0x47')][_0x4ff2('0xb5')];}if(_0x38ecbb[_0x4ff2('0x47')]['authentication']){_0x5af0d5[_0x4ff2('0xb6')]={'user':_0x38ecbb[_0x4ff2('0x47')][_0x4ff2('0x79')],'pass':_0x38ecbb[_0x4ff2('0x47')]['pass']};}return respondWithRpcPromise(_0x4ff2('0xc1'),_0x4ff2('0xc2'),{'account':_0x5af0d5});}})[_0x4ff2('0x3f')](respondWithResult(_0x2b48ee,null))[_0x4ff2('0x2d')](handleError(_0x2b48ee,null));};exports[_0x4ff2('0x3b')]=function(_0x5e1b19,_0x3accd8){return db[_0x4ff2('0x5d')][_0x4ff2('0x65')]({'where':{'id':_0x5e1b19[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x3accd8,null))[_0x4ff2('0x3f')](function(_0x450a39){if(_0x450a39&&_0x450a39[_0x4ff2('0x7f')]){throw new db[(_0x4ff2('0xc3'))][(_0x4ff2('0xc4'))](_0x4ff2('0xc5'));}return _0x450a39;})[_0x4ff2('0x3f')](removeEntity(_0x3accd8,null))[_0x4ff2('0x2d')](handleError(_0x3accd8,null));};exports[_0x4ff2('0xc6')]=function(_0x457783,_0x4819f6,_0x2057d5){return db['MailAccount'][_0x4ff2('0x65')]({'where':{'id':_0x457783['params']['id']}})['then'](handleEntityNotFound(_0x4819f6,null))[_0x4ff2('0x3f')](function(_0x2f0e0e){if(_0x2f0e0e){return _0x2f0e0e[_0x4ff2('0xc6')](_0x457783['body']['ids'],_[_0x4ff2('0x8e')](_0x457783['body'],[_0x4ff2('0x6f'),'id'])||{})['spread'](function(_0x427b65){for(var _0x50529c=0x0;_0x50529c<_0x457783[_0x4ff2('0x66')][_0x4ff2('0x6f')]['length'];_0x50529c+=0x1){socket[_0x4ff2('0xc7')](_0x4ff2('0xc8'),{'UserId':Number(_0x457783[_0x4ff2('0x66')][_0x4ff2('0x6f')][_0x50529c]),'MailAccountId':Number(_0x457783[_0x4ff2('0x62')]['id'])});}return _0x427b65;});}})[_0x4ff2('0x3f')](respondWithResult(_0x4819f6,null))[_0x4ff2('0x2d')](handleError(_0x4819f6,null));};exports[_0x4ff2('0xc9')]=function(_0x1bf7d3,_0x51ebde,_0x176662){return db[_0x4ff2('0x5d')][_0x4ff2('0x65')]({'where':{'id':_0x1bf7d3['params']['id']}})['then'](handleEntityNotFound(_0x51ebde,null))[_0x4ff2('0x3f')](function(_0x22180c){if(_0x22180c){return _0x22180c[_0x4ff2('0xc9')](_0x1bf7d3['query'][_0x4ff2('0x6f')])[_0x4ff2('0x3f')](function(){if(_[_0x4ff2('0xca')](_0x1bf7d3[_0x4ff2('0x4f')]['ids'])){for(var _0x2f8a66=0x0;_0x2f8a66<_0x1bf7d3[_0x4ff2('0x4f')][_0x4ff2('0x6f')]['length'];_0x2f8a66+=0x1){socket[_0x4ff2('0xc7')]('userMailAccount:remove',{'UserId':Number(_0x1bf7d3[_0x4ff2('0x4f')][_0x4ff2('0x6f')][_0x2f8a66]),'MailAccountId':Number(_0x1bf7d3[_0x4ff2('0x62')]['id'])});}}else{socket[_0x4ff2('0xc7')](_0x4ff2('0xcb'),{'UserId':Number(_0x1bf7d3['query'][_0x4ff2('0x6f')]),'MailAccountId':Number(_0x1bf7d3[_0x4ff2('0x62')]['id'])});}});}})[_0x4ff2('0x3f')](respondWithStatusCode(_0x51ebde,null))[_0x4ff2('0x2d')](handleError(_0x51ebde,null));};exports[_0x4ff2('0xcc')]=function(_0x21cfa7,_0x46159a,_0x181c53){var _0x9f3322={};var _0xa33a5e={};var _0x19e96d;var _0x46d603;return db[_0x4ff2('0x5d')]['findOne']({'where':{'id':_0x21cfa7[_0x4ff2('0x62')]['id']}})[_0x4ff2('0x3f')](handleEntityNotFound(_0x46159a,null))['then'](function(_0x14da14){if(_0x14da14){_0x19e96d=_0x14da14;_0xa33a5e['model']=_[_0x4ff2('0x63')](db['User'][_0x4ff2('0x4b')]);_0xa33a5e['query']=_[_0x4ff2('0x63')](_0x21cfa7[_0x4ff2('0x4f')]);_0xa33a5e[_0x4ff2('0x50')]=_[_0x4ff2('0x51')](_0xa33a5e[_0x4ff2('0x4e')],_0xa33a5e[_0x4ff2('0x4f')]);_0x9f3322[_0x4ff2('0x53')]=_['intersection'](_0xa33a5e[_0x4ff2('0x4e')],qs['fields'](_0x21cfa7[_0x4ff2('0x4f')][_0x4ff2('0x52')]));_0x9f3322['attributes']=_0x9f3322['attributes']['length']?_0x9f3322[_0x4ff2('0x53')]:_0xa33a5e[_0x4ff2('0x4e')];_0x9f3322[_0x4ff2('0x56')]=qs[_0x4ff2('0x57')](_0x21cfa7[_0x4ff2('0x4f')][_0x4ff2('0x57')]);_0x9f3322['where']=qs[_0x4ff2('0x50')](_[_0x4ff2('0x58')](_0x21cfa7[_0x4ff2('0x4f')],_0xa33a5e[_0x4ff2('0x50')]));if(_0x21cfa7[_0x4ff2('0x4f')][_0x4ff2('0x5b')]){_0x9f3322[_0x4ff2('0x59')]=_['merge'](_0x9f3322[_0x4ff2('0x59')],{'$or':_['map'](_0x9f3322[_0x4ff2('0x53')],function(_0x5416ab){var _0x400807={};_0x400807[_0x5416ab]={'$like':'%'+_0x21cfa7[_0x4ff2('0x4f')][_0x4ff2('0x5b')]+'%'};return _0x400807;})});}_0x9f3322=_['merge']({},_0x9f3322,_0x21cfa7[_0x4ff2('0x5c')]);return _0x19e96d['getAgents'](_0x9f3322);}})['then'](function(_0x21a8c5){if(_0x21a8c5){_0x46d603=_0x21a8c5['length'];if(!_0x21cfa7['query'][_0x4ff2('0x6d')](_0x4ff2('0x55'))){_0x9f3322['limit']=qs['limit'](_0x21cfa7[_0x4ff2('0x4f')][_0x4ff2('0x34')]);_0x9f3322['offset']=qs[_0x4ff2('0x32')](_0x21cfa7['query'][_0x4ff2('0x32')]);}return _0x19e96d['getAgents'](_0x9f3322);}})['then'](function(_0x514a9b){if(_0x514a9b){return _0x514a9b?{'count':_0x46d603,'rows':_0x514a9b}:null;}})['then'](respondWithResult(_0x46159a,null))[_0x4ff2('0x2d')](handleError(_0x46159a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9e5825e..6dc83b2 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 _0xe635=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x395645,_0x2f6b66){var _0x6298e0=function(_0x438fdb){while(--_0x438fdb){_0x395645['push'](_0x395645['shift']());}};_0x6298e0(++_0x2f6b66);}(_0xe635,0x1be));var _0x5e63=function(_0x4d052d,_0x48bae9){_0x4d052d=_0x4d052d-0x0;var _0x70467b=_0xe635[_0x4d052d];return _0x70467b;};'use strict';var EventEmitter=require(_0x5e63('0x0'));var MailAccount=require(_0x5e63('0x1'))['db'][_0x5e63('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5e63('0x3')](0x0);var events={'afterCreate':_0x5e63('0x4'),'afterUpdate':_0x5e63('0x5'),'afterDestroy':_0x5e63('0x6')};function emitEvent(_0x585c30){return function(_0x56a8b5,_0x352338,_0x30e8d1){MailAccountEvents[_0x5e63('0x7')](_0x585c30+':'+_0x56a8b5['id'],_0x56a8b5);MailAccountEvents[_0x5e63('0x7')](_0x585c30,_0x56a8b5);_0x30e8d1(null);};}for(var e in events){if(events[_0x5e63('0x8')](e)){var event=events[e];MailAccount[_0x5e63('0x9')](e,emitEvent(event));}}module[_0x5e63('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x126e=['emit','hasOwnProperty','hook','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x4819ae,_0x2f9e3d){var _0xf7440d=function(_0x9717bd){while(--_0x9717bd){_0x4819ae['push'](_0x4819ae['shift']());}};_0xf7440d(++_0x2f9e3d);}(_0x126e,0x108));var _0xe126=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x126e[_0x13e741];return _0x3f8bb3;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xe126('0x0'))['db'][_0xe126('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe126('0x2')](0x0);var events={'afterCreate':_0xe126('0x3'),'afterUpdate':_0xe126('0x4'),'afterDestroy':_0xe126('0x5')};function emitEvent(_0x5e7f60){return function(_0x3beaef,_0x31c902,_0x8cb81d){MailAccountEvents[_0xe126('0x6')](_0x5e7f60+':'+_0x3beaef['id'],_0x3beaef);MailAccountEvents[_0xe126('0x6')](_0x5e7f60,_0x3beaef);_0x8cb81d(null);};}for(var e in events){if(events[_0xe126('0x7')](e)){var event=events[e];MailAccount[_0xe126('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a10d7a1..30d5961 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 _0x2724=['mail_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','MailAccount'];(function(_0x13759f,_0x4aeb31){var _0x3d6a7e=function(_0x278240){while(--_0x278240){_0x13759f['push'](_0x13759f['shift']());}};_0x3d6a7e(++_0x4aeb31);}(_0x2724,0x1c4));var _0x4272=function(_0x424554,_0x4ace61){_0x424554=_0x424554-0x0;var _0xfba003=_0x2724[_0x424554];return _0xfba003;};'use strict';var _=require(_0x4272('0x0'));var util=require(_0x4272('0x1'));var logger=require(_0x4272('0x2'))(_0x4272('0x3'));var moment=require('moment');var BPromise=require(_0x4272('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4272('0x5'));var rimraf=require(_0x4272('0x6'));var config=require(_0x4272('0x7'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x34033a,_0x13beb5){return _0x34033a[_0x4272('0x8')](_0x4272('0x9'),attributes,{'tableName':_0x4272('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfde9=['MailAccount','mail_accounts','lodash','../../config/logger','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x10ed4d,_0x572dba){var _0x37b79a=function(_0x403d8e){while(--_0x403d8e){_0x10ed4d['push'](_0x10ed4d['shift']());}};_0x37b79a(++_0x572dba);}(_0xfde9,0x1a6));var _0x9fde=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xfde9[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require(_0x9fde('0x0'));var util=require('util');var logger=require(_0x9fde('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9fde('0x2'));var fs=require('fs');var path=require(_0x9fde('0x3'));var rimraf=require('rimraf');var config=require(_0x9fde('0x4'));var attributes=require(_0x9fde('0x5'));module[_0x9fde('0x6')]=function(_0x273c62,_0x927fce){return _0x273c62[_0x9fde('0x7')](_0x9fde('0x8'),attributes,{'tableName':_0x9fde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 84c310d..ef8a813 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 _0x378d=['create','List\x20not\x20found','messageId','subject','format','MailInteraction','Messages','Contact\x20not\x20found','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','findAll','options','where','limit','include','map','model','attributes','find','raw','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','List','Contacts','MailApplication','Applications','Smtp','applications','priority','length','close','autoclose','*,*,*,*','defaults'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x378d,0x81));var _0xd378=function(_0x465cb0,_0x422dc4){_0x465cb0=_0x465cb0-0x0;var _0xa820e1=_0x378d[_0x465cb0];return _0xa820e1;};'use strict';var _=require(_0xd378('0x0'));var util=require(_0xd378('0x1'));var moment=require(_0xd378('0x2'));var BPromise=require(_0xd378('0x3'));var rs=require(_0xd378('0x4'));var fs=require('fs');var Redis=require(_0xd378('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd378('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd378('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd378('0x8')][_0xd378('0x9')]({'port':0x232c});config[_0xd378('0xa')]=_['defaults'](config['redis'],{'host':_0xd378('0xb'),'port':0x18eb});var socket=require(_0xd378('0xc'))(new Redis(config['redis']));require(_0xd378('0xd'))[_0xd378('0xe')](socket);function respondWithRpcPromise(_0x4ad449,_0x5e9ace,_0x29e208){return new BPromise(function(_0x59a928,_0x9d8854){return client['request'](_0x4ad449,_0x29e208)[_0xd378('0xf')](function(_0x243947){logger[_0xd378('0x10')]('MailAccount,\x20%s,\x20%s',_0x5e9ace,_0xd378('0x11'));logger[_0xd378('0x12')](_0xd378('0x13'),_0x5e9ace,_0xd378('0x11'),JSON[_0xd378('0x14')](_0x243947));if(_0x243947[_0xd378('0x15')]){if(_0x243947['error']['code']===0x1f4){logger[_0xd378('0x15')](_0xd378('0x16'),_0x5e9ace,_0x243947[_0xd378('0x15')]['message']);return _0x9d8854(_0x243947[_0xd378('0x15')][_0xd378('0x17')]);}logger[_0xd378('0x15')](_0xd378('0x16'),_0x5e9ace,_0x243947[_0xd378('0x15')]['message']);return _0x59a928(_0x243947[_0xd378('0x15')][_0xd378('0x17')]);}else{logger[_0xd378('0x10')](_0xd378('0x16'),_0x5e9ace,_0xd378('0x11'));_0x59a928(_0x243947[_0xd378('0x18')][_0xd378('0x17')]);}})[_0xd378('0x19')](function(_0x24671d){logger[_0xd378('0x15')](_0xd378('0x16'),_0x5e9ace,_0x24671d);_0x9d8854(_0x24671d);});});}exports[_0xd378('0x1a')]=function(_0x366dd3){var _0x30f695=this;return new Promise(function(_0x2a23df,_0x4f8779){return db['MailAccount'][_0xd378('0x1b')]({'raw':_0x366dd3[_0xd378('0x1c')]?_0x366dd3['options']['raw']===undefined?!![]:![]:!![],'where':_0x366dd3['options']?_0x366dd3[_0xd378('0x1c')][_0xd378('0x1d')]||null:null,'attributes':_0x366dd3[_0xd378('0x1c')]?_0x366dd3[_0xd378('0x1c')]['attributes']||null:null,'limit':_0x366dd3[_0xd378('0x1c')]?_0x366dd3['options'][_0xd378('0x1e')]||null:null,'include':_0x366dd3['options']?_0x366dd3[_0xd378('0x1c')][_0xd378('0x1f')]?_[_0xd378('0x20')](_0x366dd3[_0xd378('0x1c')][_0xd378('0x1f')],function(_0x426c12){return{'model':db[_0x426c12[_0xd378('0x21')]],'as':_0x426c12['as'],'attributes':_0x426c12[_0xd378('0x22')],'include':_0x426c12[_0xd378('0x1f')]?_[_0xd378('0x20')](_0x426c12[_0xd378('0x1f')],function(_0x54731f){return{'model':db[_0x54731f['model']],'as':_0x54731f['as'],'attributes':_0x54731f[_0xd378('0x22')],'include':_0x54731f[_0xd378('0x1f')]?_[_0xd378('0x20')](_0x54731f[_0xd378('0x1f')],function(_0x32962f){return{'model':db[_0x32962f[_0xd378('0x21')]],'as':_0x32962f['as'],'attributes':_0x32962f[_0xd378('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd378('0xf')](function(_0x8baf59){logger['info'](_0xd378('0x1a'),_0x366dd3);logger['debug'](_0xd378('0x1a'),_0x366dd3,JSON[_0xd378('0x14')](_0x8baf59));_0x2a23df(_0x8baf59);})['catch'](function(_0x3bf9a4){logger[_0xd378('0x15')]('GetMailAccount',_0x3bf9a4['message'],_0x366dd3);_0x4f8779(_0x30f695[_0xd378('0x15')](0x1f4,_0x3bf9a4[_0xd378('0x17')]));});});};exports['ShowMailAccount']=function(_0x59159f){var _0x738b54=this;return new Promise(function(_0x1711ca,_0xe1a778){return db['MailAccount'][_0xd378('0x23')]({'raw':_0x59159f[_0xd378('0x1c')]?_0x59159f['options'][_0xd378('0x24')]===undefined?!![]:![]:!![],'where':_0x59159f[_0xd378('0x1c')]?_0x59159f[_0xd378('0x1c')][_0xd378('0x1d')]||null:null,'attributes':_0x59159f[_0xd378('0x1c')]?_0x59159f[_0xd378('0x1c')][_0xd378('0x22')]||null:null,'include':_0x59159f[_0xd378('0x1c')]?_0x59159f[_0xd378('0x1c')][_0xd378('0x1f')]?_[_0xd378('0x20')](_0x59159f[_0xd378('0x1c')][_0xd378('0x1f')],function(_0x118acb){return{'model':db[_0x118acb[_0xd378('0x21')]],'as':_0x118acb['as'],'attributes':_0x118acb[_0xd378('0x22')],'include':_0x118acb[_0xd378('0x1f')]?_[_0xd378('0x20')](_0x118acb[_0xd378('0x1f')],function(_0x2f1215){return{'model':db[_0x2f1215[_0xd378('0x21')]],'as':_0x2f1215['as'],'attributes':_0x2f1215[_0xd378('0x22')],'include':_0x2f1215[_0xd378('0x1f')]?_[_0xd378('0x20')](_0x2f1215[_0xd378('0x1f')],function(_0x571297){return{'model':db[_0x571297[_0xd378('0x21')]],'as':_0x571297['as'],'attributes':_0x571297[_0xd378('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd378('0xf')](function(_0xf9a165){logger['info'](_0xd378('0x25'),_0x59159f);logger[_0xd378('0x12')]('ShowMailAccount',_0x59159f,JSON[_0xd378('0x14')](_0xf9a165));_0x1711ca(_0xf9a165);})[_0xd378('0x19')](function(_0x56c6f9){logger[_0xd378('0x15')](_0xd378('0x25'),_0x56c6f9[_0xd378('0x17')],_0x59159f);_0xe1a778(_0x738b54[_0xd378('0x15')](0x1f4,_0x56c6f9[_0xd378('0x17')]));});});};exports[_0xd378('0x26')]=function(_0x33ec97){var _0x49d6ea=this;return new Promise(function(_0x4c3af9,_0x345028){var _0x3a9b39={'body':_0x33ec97[_0xd378('0x27')],'channel':_0xd378('0x28')};var _0x5eda30=_[_0xd378('0x29')](_[_0xd378('0x2a')](db[_0xd378('0x2b')][_0xd378('0x2c')]),[_0xd378('0x2d'),_0xd378('0x2e'),_0xd378('0x2f'),_0xd378('0x30')]);var _0x45cac2=![];if(_0x33ec97['body']['id']){delete _0x33ec97[_0xd378('0x27')]['id'];}if(_[_0xd378('0x31')](_0x33ec97['body'][_0xd378('0x32')])){return _0x345028(_0x49d6ea['error'](0x1f4,_0xd378('0x33')));}if(_[_0xd378('0x31')](_0x33ec97[_0xd378('0x27')][_0xd378('0x27')])||_0x33ec97[_0xd378('0x27')]['body']===''){return _0x345028(_0x49d6ea[_0xd378('0x15')](0x1f4,_0xd378('0x34')));}if(_['isNil'](_0x33ec97[_0xd378('0x27')][_0xd378('0x35')])){return _0x345028(_0x49d6ea[_0xd378('0x15')](0x1f4,_0xd378('0x36')+_0x5eda30));}if(!_[_0xd378('0x37')](_0x5eda30,_0x33ec97[_0xd378('0x27')]['mapKey'])){return _0x345028(_0x49d6ea[_0xd378('0x15')](0x1f4,_0xd378('0x38')+_0x5eda30));}var _0x5d4d49={};_0x5d4d49[_0x33ec97[_0xd378('0x27')]['mapKey']]=_0x33ec97['body'][_0xd378('0x32')];return db[_0xd378('0x39')][_0xd378('0x23')]({'where':{'id':_0x33ec97[_0xd378('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0xd378('0x3b'),'include':[{'model':db['CmContact'],'as':_0xd378('0x3c'),'where':_0x5d4d49,'limit':0x1,'order':[[_0xd378('0x2e'),'DESC']]}]},{'model':db[_0xd378('0x3d')],'as':_0xd378('0x3e')},{'model':db['MailServerOut'],'as':_0xd378('0x3f')}]})[_0xd378('0xf')](function(_0x1ed7f2){if(_0x1ed7f2&&_0x1ed7f2[_0xd378('0x3b')]){var _0x46dd73=_0x1ed7f2['get']({'plain':!![]});_0x3a9b39[_0xd378('0x3a')]=_['omit'](_0x46dd73,[_0xd378('0x3e'),_0xd378('0x3b')]);_0x3a9b39['applications']=_0x46dd73[_0xd378('0x3e')];_0x3a9b39['list']=_0x46dd73[_0xd378('0x3b')];_0x3a9b39[_0xd378('0x40')]=_['orderBy'](_0x3a9b39[_0xd378('0x40')],[_0xd378('0x41')],['asc']);if(_0x3a9b39[_0xd378('0x3a')]&&_0x3a9b39[_0xd378('0x3a')]['autoclose']){_0x3a9b39[_0xd378('0x40')]['push']({'id':0x0,'priority':_0x3a9b39['applications'][_0xd378('0x42')]+0x1,'app':_0xd378('0x43'),'appdata':_0xd378('0x44'),'interval':_0xd378('0x45')});}if(_0x3a9b39[_0xd378('0x3a')][_0xd378('0x3e')]){delete _0x3a9b39[_0xd378('0x3a')][_0xd378('0x3e')];}if(_0x3a9b39[_0xd378('0x3a')]['List']){delete _0x3a9b39[_0xd378('0x3a')]['List'];}if(_0x46dd73['List'][_0xd378('0x3c')][_0xd378('0x42')]){return _0x46dd73[_0xd378('0x3b')][_0xd378('0x3c')][0x0];}var _0x39813c=_[_0xd378('0x46')](_0x33ec97['body'],{'firstName':_0x33ec97[_0xd378('0x27')][_0xd378('0x32')],'ListId':_0x46dd73[_0xd378('0x30')]});_0x39813c[_0x33ec97[_0xd378('0x27')][_0xd378('0x35')]]=_0x33ec97[_0xd378('0x27')][_0xd378('0x32')];return db[_0xd378('0x2b')][_0xd378('0x47')](_0x39813c);}else{throw new Error(_0xd378('0x48'));}})[_0xd378('0xf')](function(_0x1a8acc){_0x3a9b39['contact']=_0x1a8acc;if(_0x1a8acc){if(!_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x49')]){_0x33ec97['body'][_0xd378('0x17')]['messageId']=rs['generate']()+'\x20'+_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x32')];}var _0x526cce={'ContactId':_0x1a8acc['id'],'MailAccountId':_0x33ec97['account']['id'],'inReplyTo':_0x33ec97[_0xd378('0x27')]['message'][_0xd378('0x49')],'to':_0x33ec97[_0xd378('0x27')]['message'][_0xd378('0x32')],'cc':_0x33ec97['body'][_0xd378('0x17')]['cc'],'subject':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x4a')],'attach':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['attach'],'lastMsgAt':moment()[_0xd378('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xd378('0x4c')][_0xd378('0x23')]({'where':{'closed':![],'MailAccountId':_0x33ec97[_0xd378('0x3a')]['id']},'include':[{'model':db['MailMessage'],'as':_0xd378('0x4d'),'attributes':[_0xd378('0x49')],'where':{'messageId':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['inReplyTo']}}]})['then'](function(_0x1d13c6){if(_0x1d13c6){return[_0x1d13c6,![]];}return db[_0xd378('0x4c')][_0xd378('0x47')](_0x526cce)[_0xd378('0xf')](function(_0x3044d9){return[_0x3044d9,!![]];});});}else{throw new Error(_0xd378('0x4e'));}})['spread'](function(_0x3a3c95,_0x3595f7){if(_0x3a3c95){_0x45cac2=_0x3595f7;if(!_0x3595f7){return _0x3a3c95[_0xd378('0x4f')]({'inReplyTo':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x49')],'to':_0x33ec97['body']['message'][_0xd378('0x32')],'cc':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['cc'],'subject':_0x33ec97['body']['message'][_0xd378('0x4a')],'attach':_0x3a3c95[_0xd378('0x50')]?_0x3a3c95['attach']:_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x50')],'substatus':null,'substatusAt':moment()[_0xd378('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0xd378('0x51')),'lastMsgDirection':'in'});}else{return _0x3a3c95;}}})[_0xd378('0xf')](function(_0x470959){_0x3a9b39[_0xd378('0x52')]=_0x470959['get']({'plain':!![]});_0x3a9b39['interaction'][_0xd378('0x53')]=_0x45cac2;return db[_0xd378('0x54')][_0xd378('0x47')]({'body':_0x33ec97['body'][_0xd378('0x27')],'MailAccountId':_0x33ec97[_0xd378('0x3a')]['id'],'MailInteractionId':_0x470959['id'],'direction':'in','ContactId':_0x3a9b39[_0xd378('0x55')]['id'],'messageId':_0x33ec97[_0xd378('0x27')]['message'][_0xd378('0x49')],'from':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['from'],'to':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['to'],'cc':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['cc'],'subject':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['subject'],'attach':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x50')],'Attachments':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')]['attachments'],'originTo':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x56')],'originCc':_0x33ec97['body'][_0xd378('0x17')][_0xd378('0x57')],'bcc':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x58')],'ChatWebsiteId':_0x33ec97['body']['message'][_0xd378('0x59')]||null,'originChannel':_0x33ec97['body'][_0xd378('0x17')][_0xd378('0x5a')]||_0xd378('0x5b'),'ChatOfflineMessageId':_0x33ec97[_0xd378('0x27')][_0xd378('0x17')][_0xd378('0x5c')]||null},{'include':[{'model':db[_0xd378('0x5d')],'as':'Attachments'}]});})[_0xd378('0xf')](function(_0x59d9e4){_0x3a9b39[_0xd378('0x17')]=_0x59d9e4;if(_0x3a9b39[_0xd378('0x52')][_0xd378('0x5e')]){return db['User'][_0xd378('0x23')]({'attributes':['id',_0xd378('0x5f')],'where':{'id':_0x3a9b39[_0xd378('0x52')][_0xd378('0x5e')]}})[_0xd378('0xf')](function(_0x57134d){if(_0x57134d){_0x3a9b39['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd378('0x60'),'appdata':_0x57134d[_0xd378('0x5f')]+','+(_0x3a9b39[_0xd378('0x3a')][_0xd378('0x61')]||0xa),'interval':_0xd378('0x45')});}return respondWithRpcPromise(_0xd378('0x62'),_0xd378('0x63'),_0x3a9b39);});}return respondWithRpcPromise('Start','startRouting',_0x3a9b39);})[_0xd378('0xf')](function(_0x314928){_0x4c3af9(_0x314928);})[_0xd378('0x19')](function(_0x289e29){_0x345028(_0x49d6ea['error'](0x1f4,_0x289e29[_0xd378('0x17')]));});});}; \ No newline at end of file +var _0xcfea=['result','catch','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetMailAccount','ShowMailAccount','mail','keys','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','account','omit','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','spread','update','attach','interaction','created','MailMessage','attachments','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','find','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x2833fe,_0x343e15){var _0x5d435b=function(_0x3f186e){while(--_0x3f186e){_0x2833fe['push'](_0x2833fe['shift']());}};_0x5d435b(++_0x343e15);}(_0xcfea,0x182));var _0xacfe=function(_0x5d1609,_0x46cf30){_0x5d1609=_0x5d1609-0x0;var _0x42a2b2=_0xcfea[_0x5d1609];return _0x42a2b2;};'use strict';var _=require(_0xacfe('0x0'));var util=require('util');var moment=require(_0xacfe('0x1'));var BPromise=require('bluebird');var rs=require(_0xacfe('0x2'));var fs=require('fs');var Redis=require(_0xacfe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xacfe('0x4'));var logger=require('../../config/logger')(_0xacfe('0x5'));var config=require(_0xacfe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xacfe('0x7')][_0xacfe('0x8')]({'port':0x232c});config[_0xacfe('0x9')]=_[_0xacfe('0xa')](config['redis'],{'host':_0xacfe('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacfe('0x9')]));require('./mailAccount.socket')[_0xacfe('0xc')](socket);function respondWithRpcPromise(_0x221d1f,_0x457a6b,_0x5ada37){return new BPromise(function(_0x182446,_0x88fb){return client['request'](_0x221d1f,_0x5ada37)[_0xacfe('0xd')](function(_0x959ddb){logger[_0xacfe('0xe')](_0xacfe('0xf'),_0x457a6b,'request\x20sent');logger[_0xacfe('0x10')](_0xacfe('0x11'),_0x457a6b,_0xacfe('0x12'),JSON[_0xacfe('0x13')](_0x959ddb));if(_0x959ddb[_0xacfe('0x14')]){if(_0x959ddb['error']['code']===0x1f4){logger[_0xacfe('0x14')](_0xacfe('0xf'),_0x457a6b,_0x959ddb[_0xacfe('0x14')][_0xacfe('0x15')]);return _0x88fb(_0x959ddb[_0xacfe('0x14')][_0xacfe('0x15')]);}logger[_0xacfe('0x14')]('MailAccount,\x20%s,\x20%s',_0x457a6b,_0x959ddb[_0xacfe('0x14')][_0xacfe('0x15')]);return _0x182446(_0x959ddb['error'][_0xacfe('0x15')]);}else{logger[_0xacfe('0xe')](_0xacfe('0xf'),_0x457a6b,'request\x20sent');_0x182446(_0x959ddb[_0xacfe('0x16')][_0xacfe('0x15')]);}})[_0xacfe('0x17')](function(_0x27056e){logger[_0xacfe('0x14')](_0xacfe('0xf'),_0x457a6b,_0x27056e);_0x88fb(_0x27056e);});});}exports['GetMailAccount']=function(_0x3f8c5f){var _0x4a8ca8=this;return new Promise(function(_0x2507f5,_0x4a49e3){return db[_0xacfe('0x18')][_0xacfe('0x19')]({'raw':_0x3f8c5f['options']?_0x3f8c5f[_0xacfe('0x1a')][_0xacfe('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8c5f[_0xacfe('0x1a')]?_0x3f8c5f[_0xacfe('0x1a')][_0xacfe('0x1c')]||null:null,'attributes':_0x3f8c5f['options']?_0x3f8c5f[_0xacfe('0x1a')]['attributes']||null:null,'limit':_0x3f8c5f['options']?_0x3f8c5f[_0xacfe('0x1a')][_0xacfe('0x1d')]||null:null,'include':_0x3f8c5f['options']?_0x3f8c5f['options'][_0xacfe('0x1e')]?_[_0xacfe('0x1f')](_0x3f8c5f[_0xacfe('0x1a')][_0xacfe('0x1e')],function(_0x22af89){return{'model':db[_0x22af89[_0xacfe('0x20')]],'as':_0x22af89['as'],'attributes':_0x22af89[_0xacfe('0x21')],'include':_0x22af89[_0xacfe('0x1e')]?_['map'](_0x22af89[_0xacfe('0x1e')],function(_0x26d7c8){return{'model':db[_0x26d7c8[_0xacfe('0x20')]],'as':_0x26d7c8['as'],'attributes':_0x26d7c8['attributes'],'include':_0x26d7c8[_0xacfe('0x1e')]?_[_0xacfe('0x1f')](_0x26d7c8['include'],function(_0x224d7b){return{'model':db[_0x224d7b[_0xacfe('0x20')]],'as':_0x224d7b['as'],'attributes':_0x224d7b[_0xacfe('0x21')]};}):[]};}):[]};}):[]:[]})[_0xacfe('0xd')](function(_0x1c47a4){logger[_0xacfe('0xe')](_0xacfe('0x22'),_0x3f8c5f);logger['debug']('GetMailAccount',_0x3f8c5f,JSON['stringify'](_0x1c47a4));_0x2507f5(_0x1c47a4);})['catch'](function(_0x17230a){logger[_0xacfe('0x14')](_0xacfe('0x22'),_0x17230a[_0xacfe('0x15')],_0x3f8c5f);_0x4a49e3(_0x4a8ca8[_0xacfe('0x14')](0x1f4,_0x17230a[_0xacfe('0x15')]));});});};exports[_0xacfe('0x23')]=function(_0x32ea54){var _0x262c42=this;return new Promise(function(_0x4b9dd4,_0x16853e){return db['MailAccount']['find']({'raw':_0x32ea54[_0xacfe('0x1a')]?_0x32ea54[_0xacfe('0x1a')][_0xacfe('0x1b')]===undefined?!![]:![]:!![],'where':_0x32ea54[_0xacfe('0x1a')]?_0x32ea54[_0xacfe('0x1a')][_0xacfe('0x1c')]||null:null,'attributes':_0x32ea54['options']?_0x32ea54[_0xacfe('0x1a')][_0xacfe('0x21')]||null:null,'include':_0x32ea54[_0xacfe('0x1a')]?_0x32ea54['options'][_0xacfe('0x1e')]?_[_0xacfe('0x1f')](_0x32ea54[_0xacfe('0x1a')][_0xacfe('0x1e')],function(_0x3dfba8){return{'model':db[_0x3dfba8[_0xacfe('0x20')]],'as':_0x3dfba8['as'],'attributes':_0x3dfba8[_0xacfe('0x21')],'include':_0x3dfba8[_0xacfe('0x1e')]?_[_0xacfe('0x1f')](_0x3dfba8[_0xacfe('0x1e')],function(_0x1ad6fb){return{'model':db[_0x1ad6fb['model']],'as':_0x1ad6fb['as'],'attributes':_0x1ad6fb['attributes'],'include':_0x1ad6fb[_0xacfe('0x1e')]?_[_0xacfe('0x1f')](_0x1ad6fb['include'],function(_0x21fbe0){return{'model':db[_0x21fbe0[_0xacfe('0x20')]],'as':_0x21fbe0['as'],'attributes':_0x21fbe0[_0xacfe('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e1c43){logger[_0xacfe('0xe')]('ShowMailAccount',_0x32ea54);logger[_0xacfe('0x10')](_0xacfe('0x23'),_0x32ea54,JSON[_0xacfe('0x13')](_0x2e1c43));_0x4b9dd4(_0x2e1c43);})[_0xacfe('0x17')](function(_0x391df8){logger['error'](_0xacfe('0x23'),_0x391df8['message'],_0x32ea54);_0x16853e(_0x262c42[_0xacfe('0x14')](0x1f4,_0x391df8[_0xacfe('0x15')]));});});};exports['NotifyMailAccount']=function(_0x3c62dd){var _0x44dd8b=this;return new Promise(function(_0x2d4373,_0xcb74d0){var _0x5aa4c0={'body':_0x3c62dd['body'],'channel':_0xacfe('0x24')};var _0x4733e9=_['difference'](_[_0xacfe('0x25')](db['CmContact'][_0xacfe('0x26')]),[_0xacfe('0x27'),'updatedAt',_0xacfe('0x28'),_0xacfe('0x29')]);var _0x30e82e=![];if(_0x3c62dd[_0xacfe('0x2a')]['id']){delete _0x3c62dd[_0xacfe('0x2a')]['id'];}if(_[_0xacfe('0x2b')](_0x3c62dd['body'][_0xacfe('0x2c')])){return _0xcb74d0(_0x44dd8b[_0xacfe('0x14')](0x1f4,_0xacfe('0x2d')));}if(_[_0xacfe('0x2b')](_0x3c62dd[_0xacfe('0x2a')]['body'])||_0x3c62dd[_0xacfe('0x2a')]['body']===''){return _0xcb74d0(_0x44dd8b['error'](0x1f4,_0xacfe('0x2e')));}if(_[_0xacfe('0x2b')](_0x3c62dd['body'][_0xacfe('0x2f')])){return _0xcb74d0(_0x44dd8b['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4733e9));}if(!_[_0xacfe('0x30')](_0x4733e9,_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x2f')])){return _0xcb74d0(_0x44dd8b[_0xacfe('0x14')](0x1f4,_0xacfe('0x31')+_0x4733e9));}var _0x11f230={};_0x11f230[_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x2f')]]=_0x3c62dd[_0xacfe('0x2a')]['from'];return db['MailAccount']['find']({'where':{'id':_0x3c62dd['account']['id']},'include':[{'model':db['CmList'],'as':_0xacfe('0x32'),'include':[{'model':db['CmContact'],'as':_0xacfe('0x33'),'where':_0x11f230,'limit':0x1,'order':[[_0xacfe('0x34'),_0xacfe('0x35')]]}]},{'model':db[_0xacfe('0x36')],'as':_0xacfe('0x37')},{'model':db[_0xacfe('0x38')],'as':_0xacfe('0x39')}]})[_0xacfe('0xd')](function(_0x53ab0c){if(_0x53ab0c&&_0x53ab0c[_0xacfe('0x32')]){var _0x3aa08c=_0x53ab0c[_0xacfe('0x3a')]({'plain':!![]});_0x5aa4c0[_0xacfe('0x3b')]=_[_0xacfe('0x3c')](_0x3aa08c,[_0xacfe('0x37'),_0xacfe('0x32')]);_0x5aa4c0['applications']=_0x3aa08c[_0xacfe('0x37')];_0x5aa4c0['list']=_0x3aa08c[_0xacfe('0x32')];_0x5aa4c0[_0xacfe('0x3d')]=_[_0xacfe('0x3e')](_0x5aa4c0['applications'],[_0xacfe('0x3f')],[_0xacfe('0x40')]);if(_0x5aa4c0[_0xacfe('0x3b')]&&_0x5aa4c0[_0xacfe('0x3b')]['autoclose']){_0x5aa4c0['applications'][_0xacfe('0x41')]({'id':0x0,'priority':_0x5aa4c0[_0xacfe('0x3d')][_0xacfe('0x42')]+0x1,'app':_0xacfe('0x43'),'appdata':_0xacfe('0x44'),'interval':_0xacfe('0x45')});}if(_0x5aa4c0[_0xacfe('0x3b')][_0xacfe('0x37')]){delete _0x5aa4c0['account'][_0xacfe('0x37')];}if(_0x5aa4c0[_0xacfe('0x3b')][_0xacfe('0x32')]){delete _0x5aa4c0[_0xacfe('0x3b')]['List'];}if(_0x3aa08c['List']['Contacts'][_0xacfe('0x42')]){return _0x3aa08c[_0xacfe('0x32')][_0xacfe('0x33')][0x0];}var _0x1c2349=_[_0xacfe('0xa')](_0x3c62dd[_0xacfe('0x2a')],{'firstName':_0x3c62dd['body'][_0xacfe('0x2c')],'ListId':_0x3aa08c[_0xacfe('0x29')]});_0x1c2349[_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x2f')]]=_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x2c')];return db[_0xacfe('0x46')][_0xacfe('0x47')](_0x1c2349);}else{throw new Error(_0xacfe('0x48'));}})['then'](function(_0x30c5ec){_0x5aa4c0[_0xacfe('0x49')]=_0x30c5ec;if(_0x30c5ec){if(!_0x3c62dd[_0xacfe('0x2a')]['message']['messageId']){_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x4a')]=rs[_0xacfe('0x4b')]()+'\x20'+_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x2c')];}var _0x35ce28={'ContactId':_0x30c5ec['id'],'MailAccountId':_0x3c62dd[_0xacfe('0x3b')]['id'],'inReplyTo':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x4a')],'to':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x2c')],'cc':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')]['cc'],'subject':_0x3c62dd[_0xacfe('0x2a')]['message'][_0xacfe('0x4c')],'attach':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')]['attach'],'lastMsgAt':moment()[_0xacfe('0x4d')](_0xacfe('0x4e')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x3c62dd[_0xacfe('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x3c62dd['body']['message']['inReplyTo']}}]})['then'](function(_0x36e9bf){if(_0x36e9bf){return[_0x36e9bf,![]];}return db['MailInteraction'][_0xacfe('0x47')](_0x35ce28)[_0xacfe('0xd')](function(_0x2479ba){return[_0x2479ba,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xacfe('0x4f')](function(_0x10e880,_0x42b2ef){if(_0x10e880){_0x30e82e=_0x42b2ef;if(!_0x42b2ef){return _0x10e880[_0xacfe('0x50')]({'inReplyTo':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x4a')],'to':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x2c')],'cc':_0x3c62dd[_0xacfe('0x2a')]['message']['cc'],'subject':_0x3c62dd['body'][_0xacfe('0x15')][_0xacfe('0x4c')],'attach':_0x10e880['attach']?_0x10e880[_0xacfe('0x51')]:_0x3c62dd['body'][_0xacfe('0x15')][_0xacfe('0x51')],'substatus':null,'substatusAt':moment()[_0xacfe('0x4d')](_0xacfe('0x4e')),'lastMsgAt':moment()[_0xacfe('0x4d')](_0xacfe('0x4e')),'lastMsgDirection':'in'});}else{return _0x10e880;}}})[_0xacfe('0xd')](function(_0x318d5b){_0x5aa4c0['interaction']=_0x318d5b['get']({'plain':!![]});_0x5aa4c0[_0xacfe('0x52')][_0xacfe('0x53')]=_0x30e82e;return db[_0xacfe('0x54')][_0xacfe('0x47')]({'body':_0x3c62dd[_0xacfe('0x2a')]['body'],'MailAccountId':_0x3c62dd[_0xacfe('0x3b')]['id'],'MailInteractionId':_0x318d5b['id'],'direction':'in','ContactId':_0x5aa4c0['contact']['id'],'messageId':_0x3c62dd['body']['message'][_0xacfe('0x4a')],'from':_0x3c62dd[_0xacfe('0x2a')]['message'][_0xacfe('0x2c')],'to':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')]['to'],'cc':_0x3c62dd['body'][_0xacfe('0x15')]['cc'],'subject':_0x3c62dd[_0xacfe('0x2a')]['message'][_0xacfe('0x4c')],'attach':_0x3c62dd['body'][_0xacfe('0x15')][_0xacfe('0x51')],'Attachments':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x55')],'originTo':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')]['originTo'],'originCc':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x56')],'bcc':_0x3c62dd[_0xacfe('0x2a')]['message'][_0xacfe('0x57')],'ChatWebsiteId':_0x3c62dd['body'][_0xacfe('0x15')][_0xacfe('0x58')]||null,'originChannel':_0x3c62dd[_0xacfe('0x2a')]['message'][_0xacfe('0x59')]||'Email','ChatOfflineMessageId':_0x3c62dd[_0xacfe('0x2a')][_0xacfe('0x15')][_0xacfe('0x5a')]||null},{'include':[{'model':db[_0xacfe('0x5b')],'as':_0xacfe('0x5c')}]});})[_0xacfe('0xd')](function(_0x38ac9c){_0x5aa4c0[_0xacfe('0x15')]=_0x38ac9c;if(_0x5aa4c0[_0xacfe('0x52')][_0xacfe('0x5d')]){return db[_0xacfe('0x5e')][_0xacfe('0x5f')]({'attributes':['id',_0xacfe('0x60')],'where':{'id':_0x5aa4c0[_0xacfe('0x52')][_0xacfe('0x5d')]}})[_0xacfe('0xd')](function(_0x3e2b47){if(_0x3e2b47){_0x5aa4c0[_0xacfe('0x3d')][_0xacfe('0x61')]({'id':0x0,'priority':0x0,'app':_0xacfe('0x62'),'appdata':_0x3e2b47[_0xacfe('0x60')]+','+(_0x5aa4c0[_0xacfe('0x3b')][_0xacfe('0x63')]||0xa),'interval':_0xacfe('0x45')});}return respondWithRpcPromise(_0xacfe('0x64'),_0xacfe('0x65'),_0x5aa4c0);});}return respondWithRpcPromise(_0xacfe('0x64'),_0xacfe('0x65'),_0x5aa4c0);})[_0xacfe('0xd')](function(_0x500ec7){_0x2d4373(_0x500ec7);})[_0xacfe('0x17')](function(_0x5da6c7){_0xcb74d0(_0x44dd8b['error'](0x1f4,_0x5da6c7[_0xacfe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e8c9231..541110f 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 _0x1afc=['update','emit','removeListener','register','mailAccount:','remove'];(function(_0x48fe24,_0x59f31e){var _0x3c760c=function(_0x1c25ad){while(--_0x1c25ad){_0x48fe24['push'](_0x48fe24['shift']());}};_0x3c760c(++_0x59f31e);}(_0x1afc,0x167));var _0xc1af=function(_0x2079d2,_0x1fbf2a){_0x2079d2=_0x2079d2-0x0;var _0x1e807a=_0x1afc[_0x2079d2];return _0x1e807a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xc1af('0x0'),_0xc1af('0x1')];function createListener(_0x5610d0,_0x261f51){return function(_0xd7bf78){_0x261f51[_0xc1af('0x2')](_0x5610d0,_0xd7bf78);};}function removeListener(_0x2208db,_0x14f028){return function(){MailAccountEvents[_0xc1af('0x3')](_0x2208db,_0x14f028);};}exports[_0xc1af('0x4')]=function(_0xd20ac9){for(var _0x314392=0x0,_0x443a60=events['length'];_0x314392<_0x443a60;_0x314392++){var _0x2bcb64=events[_0x314392];var _0x1863a6=createListener(_0xc1af('0x5')+_0x2bcb64,_0xd20ac9);MailAccountEvents['on'](_0x2bcb64,_0x1863a6);}}; \ No newline at end of file +var _0xe09a=['remove','update','emit','register','mailAccount:'];(function(_0x127b65,_0x40917f){var _0x9d79c7=function(_0x44e064){while(--_0x44e064){_0x127b65['push'](_0x127b65['shift']());}};_0x9d79c7(++_0x40917f);}(_0xe09a,0xaa));var _0xae09=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xe09a[_0x329437];return _0x3789d9;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xae09('0x0'),_0xae09('0x1')];function createListener(_0x4350e0,_0x919c84){return function(_0x1f1c11){_0x919c84[_0xae09('0x2')](_0x4350e0,_0x1f1c11);};}function removeListener(_0x3cd467,_0xbe2557){return function(){MailAccountEvents['removeListener'](_0x3cd467,_0xbe2557);};}exports[_0xae09('0x3')]=function(_0x574796){for(var _0x4c94f8=0x0,_0x31eed9=events['length'];_0x4c94f8<_0x31eed9;_0x4c94f8++){var _0x37a36b=events[_0x4c94f8];var _0x391a06=createListener(_0xae09('0x4')+_0x37a36b,_0x574796);MailAccountEvents['on'](_0x37a36b,_0x391a06);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index bcc99a5..b05bcf2 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 _0x2fc2=['isAuthenticated','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','show','put'];(function(_0xf6d4c9,_0x5f0620){var _0x173408=function(_0x5d7dc5){while(--_0x5d7dc5){_0xf6d4c9['push'](_0xf6d4c9['shift']());}};_0x173408(++_0x5f0620);}(_0x2fc2,0x1a2));var _0x22fc=function(_0x4a02e9,_0x5d7b67){_0x4a02e9=_0x4a02e9-0x0;var _0x229ed7=_0x2fc2[_0x4a02e9];return _0x229ed7;};'use strict';var multer=require(_0x22fc('0x0'));var util=require('util');var path=require(_0x22fc('0x1'));var timeout=require(_0x22fc('0x2'));var express=require(_0x22fc('0x3'));var router=express[_0x22fc('0x4')]();var fs_extra=require(_0x22fc('0x5'));var auth=require(_0x22fc('0x6'));var interaction=require(_0x22fc('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0x22fc('0x8'),auth['isAuthenticated'](),controller[_0x22fc('0x9')]);router[_0x22fc('0xa')](_0x22fc('0x8'),auth[_0x22fc('0xb')](),controller['update']);router['delete'](_0x22fc('0x8'),auth[_0x22fc('0xb')](),controller[_0x22fc('0xc')]);module['exports']=router; \ No newline at end of file +var _0x5e13=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','update','delete','destroy'];(function(_0x13315b,_0x78db05){var _0x1793d5=function(_0x3fc2e9){while(--_0x3fc2e9){_0x13315b['push'](_0x13315b['shift']());}};_0x1793d5(++_0x78db05);}(_0x5e13,0x1c9));var _0x35e1=function(_0x4fbdf4,_0x2719b1){_0x4fbdf4=_0x4fbdf4-0x0;var _0x186fce=_0x5e13[_0x4fbdf4];return _0x186fce;};'use strict';var multer=require(_0x35e1('0x0'));var util=require(_0x35e1('0x1'));var path=require(_0x35e1('0x2'));var timeout=require(_0x35e1('0x3'));var express=require(_0x35e1('0x4'));var router=express[_0x35e1('0x5')]();var fs_extra=require(_0x35e1('0x6'));var auth=require(_0x35e1('0x7'));var interaction=require(_0x35e1('0x8'));var config=require(_0x35e1('0x9'));var controller=require(_0x35e1('0xa'));router['get']('/:id',auth[_0x35e1('0xb')](),controller[_0x35e1('0xc')]);router[_0x35e1('0xd')](_0x35e1('0xe'),auth[_0x35e1('0xb')](),controller[_0x35e1('0xf')]);router[_0x35e1('0x10')](_0x35e1('0xe'),auth['isAuthenticated'](),controller[_0x35e1('0x11')]);module[_0x35e1('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cc7106a..13fa024 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 _0x3846=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3846,0x1c9));var _0x6384=function(_0x56d1b5,_0x289333){_0x56d1b5=_0x56d1b5-0x0;var _0x4ad91e=_0x3846[_0x56d1b5];return _0x4ad91e;};'use strict';var Sequelize=require(_0x6384('0x0'));module[_0x6384('0x1')]={'priority':{'type':Sequelize[_0x6384('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6384('0x3')],'allowNull':![],'defaultValue':_0x6384('0x4')},'appdata':{'type':Sequelize[_0x6384('0x5')]()},'description':{'type':Sequelize[_0x6384('0x3')]},'interval':{'type':Sequelize[_0x6384('0x3')],'defaultValue':_0x6384('0x6')}}; \ No newline at end of file +var _0xc3b2=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x496c77,_0x3ae97f){var _0x46eb63=function(_0x2d0568){while(--_0x2d0568){_0x496c77['push'](_0x496c77['shift']());}};_0x46eb63(++_0x3ae97f);}(_0xc3b2,0xaf));var _0x2c3b=function(_0x196c94,_0x58fa96){_0x196c94=_0x196c94-0x0;var _0x4f7e3f=_0xc3b2[_0x196c94];return _0x4f7e3f;};'use strict';var Sequelize=require(_0x2c3b('0x0'));module[_0x2c3b('0x1')]={'priority':{'type':Sequelize[_0x2c3b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2c3b('0x3')],'allowNull':![],'defaultValue':_0x2c3b('0x4')},'appdata':{'type':Sequelize[_0x2c3b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2c3b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d388409..68031ae 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x37a0e3,_0x29e274){var _0x1816a9=function(_0x1a2426){while(--_0x1a2426){_0x37a0e3['push'](_0x37a0e3['shift']());}};_0x1816a9(++_0x29e274);}(_0xf4eb,0xec));var _0xbf4e=function(_0x49484d,_0x49f7c2){_0x49484d=_0x49484d-0x0;var _0x42ea40=_0xf4eb[_0x49484d];return _0x42ea40;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x29662f,_0x2be2a4){var _0x2a0c63=function(_0x419723){while(--_0x419723){_0x29662f['push'](_0x29662f['shift']());}};_0x2a0c63(++_0x2be2a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a80a2a6..44ac0a6 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 _0xa7a3=['./mailApplication.attributes','MailApplication','mail_applications','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa7a3,0x184));var _0x3a7a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa7a3[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x3a7a('0x0'));var util=require(_0x3a7a('0x1'));var logger=require(_0x3a7a('0x2'))('api');var moment=require(_0x3a7a('0x3'));var BPromise=require(_0x3a7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a7a('0x5'));var rimraf=require(_0x3a7a('0x6'));var config=require(_0x3a7a('0x7'));var attributes=require(_0x3a7a('0x8'));module['exports']=function(_0x51f460,_0x5d932a){return _0x51f460['define'](_0x3a7a('0x9'),attributes,{'tableName':_0x3a7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf783=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','MailApplication','mail_applications'];(function(_0x46db34,_0x59553e){var _0x1029da=function(_0x1e779b){while(--_0x1e779b){_0x46db34['push'](_0x46db34['shift']());}};_0x1029da(++_0x59553e);}(_0xf783,0x169));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3f78('0x0'));var logger=require(_0x3f78('0x1'))(_0x3f78('0x2'));var moment=require(_0x3f78('0x3'));var BPromise=require(_0x3f78('0x4'));var rp=require(_0x3f78('0x5'));var fs=require('fs');var path=require(_0x3f78('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x3f78('0x7')]=function(_0x34b92b,_0x178e3c){return _0x34b92b[_0x3f78('0x8')](_0x3f78('0x9'),attributes,{'tableName':_0x3f78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3f78('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index bad0860..12dcd69 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 _0x4c8d=['body','options','where','attributes','limit','then','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x4c8d,0xf7));var _0xd4c8=function(_0x16e23d,_0x341167){_0x16e23d=_0x16e23d-0x0;var _0x139d56=_0x4c8d[_0x16e23d];return _0x139d56;};'use strict';var _=require('lodash');var util=require(_0xd4c8('0x0'));var moment=require(_0xd4c8('0x1'));var BPromise=require(_0xd4c8('0x2'));var rs=require(_0xd4c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4c8('0x5'))('rpc');var config=require(_0xd4c8('0x6'));var jayson=require(_0xd4c8('0x7'));var client=jayson[_0xd4c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de0f7,_0x1472b9,_0x1bd383){return new BPromise(function(_0x32693c,_0x2dd027){return client[_0xd4c8('0x9')](_0x1de0f7,_0x1bd383)['then'](function(_0x4edf30){logger[_0xd4c8('0xa')]('MailApplication,\x20%s,\x20%s',_0x1472b9,'request\x20sent');logger['debug'](_0xd4c8('0xb'),_0x1472b9,_0xd4c8('0xc'),JSON[_0xd4c8('0xd')](_0x4edf30));if(_0x4edf30['error']){if(_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0xf')]===0x1f4){logger[_0xd4c8('0xe')](_0xd4c8('0x10'),_0x1472b9,_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0x11')]);return _0x2dd027(_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0x11')]);}logger[_0xd4c8('0xe')]('MailApplication,\x20%s,\x20%s',_0x1472b9,_0x4edf30['error'][_0xd4c8('0x11')]);return _0x32693c(_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0x11')]);}else{logger['info'](_0xd4c8('0x10'),_0x1472b9,'request\x20sent');_0x32693c(_0x4edf30[_0xd4c8('0x12')][_0xd4c8('0x11')]);}})[_0xd4c8('0x13')](function(_0x32b483){logger[_0xd4c8('0xe')](_0xd4c8('0x10'),_0x1472b9,_0x32b483);_0x2dd027(_0x32b483);});});}exports[_0xd4c8('0x14')]=function(_0x36ad28){var _0xbd2f3=this;return new Promise(function(_0x173d30,_0x4ad495){return db[_0xd4c8('0x15')][_0xd4c8('0x16')](_0x36ad28[_0xd4c8('0x17')],{'raw':_0x36ad28[_0xd4c8('0x18')]?_0x36ad28[_0xd4c8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36ad28[_0xd4c8('0x18')]?_0x36ad28[_0xd4c8('0x18')][_0xd4c8('0x19')]||null:null,'attributes':_0x36ad28['options']?_0x36ad28[_0xd4c8('0x18')][_0xd4c8('0x1a')]||null:null,'limit':_0x36ad28['options']?_0x36ad28[_0xd4c8('0x18')][_0xd4c8('0x1b')]||null:null})[_0xd4c8('0x1c')](function(_0x4d1d5a){logger[_0xd4c8('0xa')](_0xd4c8('0x14'),_0x36ad28);logger[_0xd4c8('0x1d')](_0xd4c8('0x14'),_0x36ad28,JSON[_0xd4c8('0xd')](_0x4d1d5a));_0x173d30(_0x4d1d5a);})['catch'](function(_0x2ad1f6){logger['error'](_0xd4c8('0x14'),_0x2ad1f6[_0xd4c8('0x11')],_0x36ad28);_0x4ad495(_0xbd2f3[_0xd4c8('0xe')](0x1f4,_0x2ad1f6[_0xd4c8('0x11')]));});});}; \ No newline at end of file +var _0xad59=['jayson/promise','client','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x471beb,_0x2c3a0d){var _0x50e12c=function(_0x2c563a){while(--_0x2c563a){_0x471beb['push'](_0x471beb['shift']());}};_0x50e12c(++_0x2c3a0d);}(_0xad59,0x84));var _0x9ad5=function(_0xfe0ca9,_0x26f02c){_0xfe0ca9=_0xfe0ca9-0x0;var _0x53e19f=_0xad59[_0xfe0ca9];return _0x53e19f;};'use strict';var _=require(_0x9ad5('0x0'));var util=require('util');var moment=require(_0x9ad5('0x1'));var BPromise=require(_0x9ad5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ad5('0x3'));var db=require(_0x9ad5('0x4'))['db'];var utils=require(_0x9ad5('0x5'));var logger=require('../../config/logger')(_0x9ad5('0x6'));var config=require(_0x9ad5('0x7'));var jayson=require(_0x9ad5('0x8'));var client=jayson[_0x9ad5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f0640,_0x537502,_0x29f859){return new BPromise(function(_0x21e8d5,_0x3ba7f2){return client['request'](_0x7f0640,_0x29f859)[_0x9ad5('0xa')](function(_0x32883d){logger[_0x9ad5('0xb')](_0x9ad5('0xc'),_0x537502,_0x9ad5('0xd'));logger[_0x9ad5('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x537502,_0x9ad5('0xd'),JSON[_0x9ad5('0xf')](_0x32883d));if(_0x32883d[_0x9ad5('0x10')]){if(_0x32883d[_0x9ad5('0x10')][_0x9ad5('0x11')]===0x1f4){logger[_0x9ad5('0x10')]('MailApplication,\x20%s,\x20%s',_0x537502,_0x32883d[_0x9ad5('0x10')]['message']);return _0x3ba7f2(_0x32883d[_0x9ad5('0x10')][_0x9ad5('0x12')]);}logger[_0x9ad5('0x10')](_0x9ad5('0xc'),_0x537502,_0x32883d[_0x9ad5('0x10')][_0x9ad5('0x12')]);return _0x21e8d5(_0x32883d[_0x9ad5('0x10')][_0x9ad5('0x12')]);}else{logger[_0x9ad5('0xb')](_0x9ad5('0xc'),_0x537502,'request\x20sent');_0x21e8d5(_0x32883d['result'][_0x9ad5('0x12')]);}})[_0x9ad5('0x13')](function(_0x422f20){logger[_0x9ad5('0x10')](_0x9ad5('0xc'),_0x537502,_0x422f20);_0x3ba7f2(_0x422f20);});});}exports[_0x9ad5('0x14')]=function(_0x672c14){var _0x3c3678=this;return new Promise(function(_0x4176d1,_0x45af1f){return db[_0x9ad5('0x15')][_0x9ad5('0x16')](_0x672c14[_0x9ad5('0x17')],{'raw':_0x672c14[_0x9ad5('0x18')]?_0x672c14[_0x9ad5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x672c14[_0x9ad5('0x18')]?_0x672c14[_0x9ad5('0x18')][_0x9ad5('0x19')]||null:null,'attributes':_0x672c14[_0x9ad5('0x18')]?_0x672c14[_0x9ad5('0x18')][_0x9ad5('0x1a')]||null:null,'limit':_0x672c14[_0x9ad5('0x18')]?_0x672c14['options'][_0x9ad5('0x1b')]||null:null})['then'](function(_0x50d782){logger[_0x9ad5('0xb')]('UpdateMailApplication',_0x672c14);logger[_0x9ad5('0xe')](_0x9ad5('0x14'),_0x672c14,JSON[_0x9ad5('0xf')](_0x50d782));_0x4176d1(_0x50d782);})[_0x9ad5('0x13')](function(_0x4188fa){logger[_0x9ad5('0x10')](_0x9ad5('0x14'),_0x4188fa['message'],_0x672c14);_0x45af1f(_0x3c3678['error'](0x1f4,_0x4188fa[_0x9ad5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ab75fcb..ae56e71 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 _0xcd0b=['/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2d52ed,_0x32c10a){var _0x31090e=function(_0xffc8e6){while(--_0xffc8e6){_0x2d52ed['push'](_0x2d52ed['shift']());}};_0x31090e(++_0x32c10a);}(_0xcd0b,0xaa));var _0xbcd0=function(_0x4221cb,_0x197b31){_0x4221cb=_0x4221cb-0x0;var _0x55bb97=_0xcd0b[_0x4221cb];return _0x55bb97;};'use strict';var express=require(_0xbcd0('0x0'));var router=express['Router']();var auth=require(_0xbcd0('0x1'));var interaction=require(_0xbcd0('0x2'));var controller=require('./mailInteraction.controller');router[_0xbcd0('0x3')]('/',auth[_0xbcd0('0x4')](),controller['index']);router[_0xbcd0('0x3')](_0xbcd0('0x5'),auth[_0xbcd0('0x4')](),controller[_0xbcd0('0x6')]);router['get'](_0xbcd0('0x7'),auth[_0xbcd0('0x4')](),controller[_0xbcd0('0x8')]);router['get'](_0xbcd0('0x9'),auth[_0xbcd0('0x4')](),controller[_0xbcd0('0xa')]);router['get']('/:id/download',auth[_0xbcd0('0x4')](),controller[_0xbcd0('0xb')]);router[_0xbcd0('0xc')]('/',auth['isAuthenticated'](),controller[_0xbcd0('0xd')]);router[_0xbcd0('0xc')](_0xbcd0('0x9'),auth[_0xbcd0('0x4')](),controller['addMessage']);router['post'](_0xbcd0('0xe'),auth[_0xbcd0('0x4')](),interaction[_0xbcd0('0xf')](_0xbcd0('0x10'),_0xbcd0('0x11')),controller[_0xbcd0('0x12')]);router[_0xbcd0('0x13')](_0xbcd0('0x7'),auth[_0xbcd0('0x4')](),interaction[_0xbcd0('0xf')](_0xbcd0('0x10'),'mailinteraction:update'),controller[_0xbcd0('0x14')]);router[_0xbcd0('0x15')](_0xbcd0('0x7'),auth[_0xbcd0('0x4')](),interaction['tracked']('mail',_0xbcd0('0x16')),controller[_0xbcd0('0x17')]);router[_0xbcd0('0x15')]('/:id/tags',auth[_0xbcd0('0x4')](),controller[_0xbcd0('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4ea9=['addMessage','/:id/tags','mailinteraction:addtags','addTags','tracked','mailinteraction:update','update','mail','mailinteraction:destroy','destroy','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post'];(function(_0x1f0521,_0x2b855b){var _0x1f4033=function(_0x2485f7){while(--_0x2485f7){_0x1f0521['push'](_0x1f0521['shift']());}};_0x1f4033(++_0x2b855b);}(_0x4ea9,0x14e));var _0x94ea=function(_0x1b11fe,_0x4693d1){_0x1b11fe=_0x1b11fe-0x0;var _0x1b21b0=_0x4ea9[_0x1b11fe];return _0x1b21b0;};'use strict';var express=require(_0x94ea('0x0'));var router=express[_0x94ea('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x94ea('0x2'));var controller=require(_0x94ea('0x3'));router[_0x94ea('0x4')]('/',auth[_0x94ea('0x5')](),controller[_0x94ea('0x6')]);router[_0x94ea('0x4')](_0x94ea('0x7'),auth['isAuthenticated'](),controller[_0x94ea('0x8')]);router[_0x94ea('0x4')](_0x94ea('0x9'),auth[_0x94ea('0x5')](),controller[_0x94ea('0xa')]);router[_0x94ea('0x4')](_0x94ea('0xb'),auth[_0x94ea('0x5')](),controller[_0x94ea('0xc')]);router['get'](_0x94ea('0xd'),auth[_0x94ea('0x5')](),controller[_0x94ea('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x94ea('0xf')]);router[_0x94ea('0x10')](_0x94ea('0xb'),auth[_0x94ea('0x5')](),controller[_0x94ea('0x11')]);router[_0x94ea('0x10')](_0x94ea('0x12'),auth[_0x94ea('0x5')](),interaction['tracked']('mail',_0x94ea('0x13')),controller[_0x94ea('0x14')]);router['put'](_0x94ea('0x9'),auth[_0x94ea('0x5')](),interaction[_0x94ea('0x15')]('mail',_0x94ea('0x16')),controller[_0x94ea('0x17')]);router['delete']('/:id',auth[_0x94ea('0x5')](),interaction[_0x94ea('0x15')](_0x94ea('0x18'),_0x94ea('0x19')),controller[_0x94ea('0x1a')]);router['delete'](_0x94ea('0x12'),auth[_0x94ea('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 85512da..ea5c102 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 _0x1c8d=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','iconv','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c8d,0x196));var _0xd1c8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1c8d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xd1c8('0x0'));module[_0xd1c8('0x1')]={'closed':{'type':Sequelize[_0xd1c8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd1c8('0x3')]},'disposition':{'type':Sequelize[_0xd1c8('0x4')]},'secondDisposition':{'type':Sequelize[_0xd1c8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd1c8('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xd1c8('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd1c8('0x5')]('long')},'subject':{'type':Sequelize[_0xd1c8('0x5')]()},'attach':{'type':Sequelize[_0xd1c8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd1c8('0x3')]},'substatus':{'type':Sequelize[_0xd1c8('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xd1c8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd1c8('0x6')]('in',_0xd1c8('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd1c8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd1c8('0x6')]('in',_0xd1c8('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd1c8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c92=['DATE','STRING','ENUM','out','sequelize','iconv','BOOLEAN'];(function(_0x47cd55,_0xc5cb28){var _0x2fb3ff=function(_0x30934b){while(--_0x30934b){_0x47cd55['push'](_0x47cd55['shift']());}};_0x2fb3ff(++_0xc5cb28);}(_0x0c92,0x1af));var _0x20c9=function(_0x57494e,_0x2c4d3d){_0x57494e=_0x57494e-0x0;var _0x4099da=_0x0c92[_0x57494e];return _0x4099da;};'use strict';var Sequelize=require(_0x20c9('0x0'));var iconv=require(_0x20c9('0x1'));module['exports']={'closed':{'type':Sequelize[_0x20c9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x20c9('0x3')]},'disposition':{'type':Sequelize[_0x20c9('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x20c9('0x4')]},'note':{'type':Sequelize[_0x20c9('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x20c9('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x20c9('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x20c9('0x3')]},'substatus':{'type':Sequelize[_0x20c9('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x20c9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x20c9('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x20c9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x20c9('0x5')]('in',_0x20c9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x20c9('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fe170a3..9683cfb 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 _0x6572=['each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','message%d.eml','unlinkSync','zip-dir','util','path','squel','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','Users','map','Tags','TagIds','split','forEach','push','findOne','out','-id','lastMsgText','trimStart','catch','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','from','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','MailInteractionId','enableEmailPreview','rows','show','params','includeAll','options','body','describe','addMessage','MailMessage','ids','omit','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','addTags','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','Attachment','Attachments','Messages','bcc','subject'];(function(_0x250b8b,_0x1d3b34){var _0x458585=function(_0x53147d){while(--_0x53147d){_0x250b8b['push'](_0x250b8b['shift']());}};_0x458585(++_0x1d3b34);}(_0x6572,0xeb));var _0x2657=function(_0x414b3f,_0x11f66f){_0x414b3f=_0x414b3f-0x0;var _0x10922e=_0x6572[_0x414b3f];return _0x10922e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2657('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2657('0x1'));var path=require(_0x2657('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2657('0x3'));var juice=require(_0x2657('0x4'));var Redis=require(_0x2657('0x5'));var qs=require(_0x2657('0x6'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x2657('0x7'));var config=require(_0x2657('0x8'));var db=require(_0x2657('0x9'))['db'];var htmlEntities=require(_0x2657('0xa'));config[_0x2657('0xb')]=_[_0x2657('0xc')](config[_0x2657('0xb')],{'host':_0x2657('0xd'),'port':0x18eb});var socket=require(_0x2657('0xe'))(new Redis(config[_0x2657('0xb')]));require(_0x2657('0xf'))['register'](socket);function respondWithStatusCode(_0x318b64,_0x4de77b){_0x4de77b=_0x4de77b||0xcc;return function(_0x2655cc){if(_0x2655cc){return _0x318b64[_0x2657('0x10')](_0x4de77b);}return _0x318b64[_0x2657('0x11')](_0x4de77b)[_0x2657('0x12')]();};}function respondWithResult(_0x566399,_0x528ce1){_0x528ce1=_0x528ce1||0xc8;return function(_0x574be6){if(_0x574be6){return _0x566399[_0x2657('0x11')](_0x528ce1)['json'](_0x574be6);}};}function respondWithFilteredResult(_0x21ca4d,_0x5a11b1){return function(_0xba7d5c){if(_0xba7d5c){var _0x2ab307=typeof _0x5a11b1[_0x2657('0x13')]===_0x2657('0x14')&&typeof _0x5a11b1[_0x2657('0x15')]===_0x2657('0x14');var _0x305c6f=_0xba7d5c[_0x2657('0x16')];var _0xaf63e9=_0x2ab307?0x0:_0x5a11b1[_0x2657('0x13')];var _0x2e6e12=_0x2ab307?_0xba7d5c['count']:_0x5a11b1[_0x2657('0x13')]+_0x5a11b1[_0x2657('0x15')];var _0x5603b2;if(_0x2e6e12>=_0x305c6f){_0x2e6e12=_0x305c6f;_0x5603b2=0xc8;}else{_0x5603b2=0xce;}_0x21ca4d[_0x2657('0x11')](_0x5603b2);return _0x21ca4d[_0x2657('0x17')]('Content-Range',_0xaf63e9+'-'+_0x2e6e12+'/'+_0x305c6f)[_0x2657('0x18')](_0xba7d5c);}return null;};}function saveUpdates(_0x2a95b8){return function(_0x435d76){if(_0x435d76){return _0x435d76[_0x2657('0x19')](_0x2a95b8)[_0x2657('0x1a')](function(_0x2b5f9e){return _0x2b5f9e;});}return null;};}function removeEntity(_0x533c5c){return function(_0x51b907){if(_0x51b907){return _0x51b907[_0x2657('0x1b')]()['then'](function(){_0x533c5c[_0x2657('0x11')](0xcc)[_0x2657('0x12')]();});}};}function handleEntityNotFound(_0x582d75){return function(_0x328613){if(!_0x328613){_0x582d75[_0x2657('0x10')](0x194);}return _0x328613;};}function handleError(_0xe35f98,_0x2fd814){_0x2fd814=_0x2fd814||0x1f4;return function(_0x38c818){logger[_0x2657('0x1c')](_0x38c818[_0x2657('0x1d')]);if(_0x38c818[_0x2657('0x1e')]){delete _0x38c818[_0x2657('0x1e')];}_0xe35f98[_0x2657('0x11')](_0x2fd814)[_0x2657('0x1f')](_0x38c818);};}function getInteractionUsers(_0x3d7f8a,_0x5b7abc){return new BPromise(function(_0x2fb86d,_0x5b321b){try{if(_0x5b7abc[_0x3d7f8a['id']]){_0x3d7f8a[_0x2657('0x20')]=_[_0x2657('0x21')](_0x5b7abc[_0x3d7f8a['id']],function(_0x48184a){return{'id':_0x48184a['id'],'fullname':_0x48184a['fullname']};});}}catch(_0x559495){_0x5b321b(_0x559495);}_0x2fb86d(_0x3d7f8a);});}function getInteractionTags(_0x5ed65,_0x54f014){return new BPromise(function(_0x4de985,_0x3712b8){try{if(_0x5ed65['TagIds']){_0x5ed65[_0x2657('0x22')]=[];_0x5ed65[_0x2657('0x23')][_0x2657('0x24')](',')[_0x2657('0x25')](function(_0x48b15c){_0x5ed65[_0x2657('0x22')][_0x2657('0x26')](_0x54f014[_0x48b15c]);});}delete _0x5ed65['TagIds'];}catch(_0x21ee38){_0x3712b8(_0x21ee38);}_0x4de985(_0x5ed65);});}function getLastMessageText(_0x505212){return new BPromise(function(_0x27b3af,_0x146567){return db['MailMessage'][_0x2657('0x27')]({'where':{'$and':[{'MailInteractionId':_0x505212['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2657('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2657('0x29'),'raw':!![]})[_0x2657('0x1a')](function(_0x3bd9e9){if(_0x3bd9e9&&_0x3bd9e9['plainBody']){_0x505212[_0x2657('0x2a')]=_[_0x2657('0x2b')](_0x3bd9e9['plainBody']);}_0x27b3af(_0x505212);})[_0x2657('0x2c')](function(_0x303665){_0x146567(_0x303665);});});}function updateMailInteraction(_0x34c1d8,_0x2a1031,_0x26734d,_0x5637b2){return new BPromise(function(_0x3373ca,_0x21ae5c){return getInteractionUsers(_0x34c1d8,_0x26734d)[_0x2657('0x1a')](function(_0x59096c){return getInteractionTags(_0x59096c,_0x2a1031);})['then'](function(_0x2b0614){if(_0x5637b2){_0x3373ca(getLastMessageText(_0x2b0614));}else{_0x3373ca(_0x2b0614);}})[_0x2657('0x2c')](function(_0x266990){_0x21ae5c(_0x266990);});});}exports['index']=function(_0x5e016a,_0x651e8b){var _0x7a6cdd={},_0xab06aa={},_0x1a56aa={'count':0x0,'rows':[]};var _0x3865e4=_[_0x2657('0x21')](db[_0x2657('0x2d')][_0x2657('0x2e')],function(_0x452efe){return{'name':_0x452efe[_0x2657('0x2f')],'type':_0x452efe[_0x2657('0x30')][_0x2657('0x31')]};});_0xab06aa[_0x2657('0x32')]=_[_0x2657('0x21')](_0x3865e4,_0x2657('0x1e'));_0xab06aa[_0x2657('0x33')]=_[_0x2657('0x34')](_0x5e016a[_0x2657('0x33')]);_0xab06aa[_0x2657('0x35')]=_[_0x2657('0x36')](_0xab06aa[_0x2657('0x32')],_0xab06aa[_0x2657('0x33')]);_0x7a6cdd['attributes']=_[_0x2657('0x36')](_0xab06aa['model'],qs[_0x2657('0x37')](_0x5e016a[_0x2657('0x33')][_0x2657('0x37')]));_0x7a6cdd['attributes']=_0x7a6cdd[_0x2657('0x38')][_0x2657('0x39')]?_0x7a6cdd['attributes']:_0xab06aa[_0x2657('0x32')];if(!_0x5e016a[_0x2657('0x33')][_0x2657('0x3a')](_0x2657('0x3b'))){_0x7a6cdd[_0x2657('0x15')]=qs[_0x2657('0x15')](_0x5e016a['query'][_0x2657('0x15')]);_0x7a6cdd[_0x2657('0x13')]=qs[_0x2657('0x13')](_0x5e016a[_0x2657('0x33')][_0x2657('0x13')]);}_0x7a6cdd[_0x2657('0x3c')]=qs[_0x2657('0x3d')](_0x5e016a[_0x2657('0x33')][_0x2657('0x3d')]);_0x7a6cdd['where']=qs[_0x2657('0x35')](_['pick'](_0x5e016a['query'],_0xab06aa['filters']),_0x3865e4);var _0x15f18e=[];var _0x5b0fdf=squel[_0x2657('0x3e')]()['field']('id')['field'](_0x2657('0x1e'))[_0x2657('0x3f')](_0x2657('0x40'))['from'](_0x2657('0x41'));var _0xb84dfc=squel[_0x2657('0x3e')]()[_0x2657('0x3f')]('u.id')[_0x2657('0x3f')](_0x2657('0x42'))[_0x2657('0x3f')](_0x2657('0x43'))['from'](_0x2657('0x44'),'ui')[_0x2657('0x45')](_0x2657('0x46'),'u','u.id\x20=\x20ui.UserId');var _0xc2f62a=squel[_0x2657('0x3e')]()[_0x2657('0x47')](_0x2657('0x48'),'i')[_0x2657('0x45')](_0x2657('0x49'),'c',_0x2657('0x4a'))[_0x2657('0x45')](_0x2657('0x46'),'o',_0x2657('0x4b'))[_0x2657('0x45')](_0x2657('0x4c'),'a',_0x2657('0x4d'))[_0x2657('0x45')](_0x2657('0x4e'),'me',_0x2657('0x4f'))[_0x2657('0x45')](_0x2657('0x50'),'it','it.MailInteractionId\x20=\x20i.id')[_0x2657('0x45')](_0x2657('0x41'),'t',_0x2657('0x51'));var _0x10067c=squel[_0x2657('0x52')]();var _0x4f2df8=[];var _0x17bb25=squel[_0x2657('0x52')]();var _0x1bfe71;if(_0x5e016a[_0x2657('0x33')]['search']){_0x1bfe71=as['parseSearch'](_0x5e016a[_0x2657('0x33')][_0x2657('0x53')]);var _0x1f0fb4=_0x1bfe71[_0x2657('0x54')];for(var _0x19c909=0x0;_0x19c909<_0x1bfe71[_0x2657('0x55')][_0x2657('0x39')];_0x19c909++){var _0x43273a=_0x1bfe71[_0x2657('0x55')][_0x19c909];var _0x2aa639='i';var _0x4de23e=_[_0x2657('0x56')](_0x3865e4,[_0x2657('0x1e'),_0x43273a[_0x2657('0x3f')]]);if(!_0x4de23e){switch(_0x43273a[_0x2657('0x3f')]){case _0x2657('0x57'):if(_0x43273a[_0x2657('0x58')]==0x1){_0xc2f62a['having']('`'+_0x43273a[_0x2657('0x3f')]+_0x2657('0x59'));}else{_0xc2f62a[_0x2657('0x5a')]('`'+_0x43273a['field']+_0x2657('0x5b'));}break;case _0x2657('0x5c'):if(_0x43273a[_0x2657('0x5d')]===_0x2657('0x5e')){if(_0x43273a[_0x2657('0x58')][_0x2657('0x24')]('\x20')['length']>0x1){_0x10067c[_0x1f0fb4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2657('0x5f')](_0x43273a[_0x2657('0x58')]),null);}else{var _0x867a7d='%'+_0x43273a['value']+'%';_0x10067c[_0x1f0fb4](_0x2657('0x60'),_0x867a7d,_0x867a7d,_0x867a7d);}}else{_0x4de23e=_[_0x2657('0x56')](_0x3865e4,[_0x2657('0x1e'),_0x2657('0x61')]);_0x43273a['field']=_0x2657('0x61');_0x52d5df=as[_0x2657('0x62')](_0x2aa639,_0x4de23e['type'],_0x43273a);_0x10067c[_0x1f0fb4](_0x52d5df['text'],_0x52d5df[_0x2657('0x58')]['start'],_0x52d5df[_0x2657('0x58')]['end']);}break;case _0x2657('0x63'):var _0x1573f3=_0x43273a[_0x2657('0x58')][_0x2657('0x24')](',')[_0x2657('0x21')](function(_0x12eb44){return Number(_0x12eb44);});_0x1573f3['forEach'](function(_0x673f0d){_0x17bb25['or'](_0x2657('0x64'),'%,'+_0x673f0d+',%');});_0x4f2df8=_[_0x2657('0x65')](_0x4f2df8,_0x1573f3);break;case'User':if(_0x43273a['operator']===_0x2657('0x5e')){_0x10067c[_0x1f0fb4](_0x2657('0x66'),'%'+_0x43273a[_0x2657('0x58')]+'%',null);}else{_0x4de23e=_['find'](_0x3865e4,[_0x2657('0x1e'),'UserId']);_0x43273a['field']=_0x2657('0x67');_0x52d5df=as[_0x2657('0x62')](_0x2aa639,_0x4de23e['type'],_0x43273a);_0x10067c[_0x1f0fb4](_0x52d5df['text'],_0x52d5df[_0x2657('0x58')]['start'],_0x52d5df[_0x2657('0x58')][_0x2657('0x12')]);}break;case'plainBody':_0x52d5df=as[_0x2657('0x62')]('me',null,_0x43273a);_0x10067c[_0x1f0fb4](_0x52d5df[_0x2657('0x68')],_0x52d5df[_0x2657('0x58')][_0x2657('0x69')],_0x52d5df[_0x2657('0x58')][_0x2657('0x12')]);break;}}else{var _0x52d5df=as[_0x2657('0x62')](_0x2aa639,_0x4de23e[_0x2657('0x30')],_0x43273a);_0x10067c[_0x1f0fb4](_0x52d5df['text'],_0x52d5df[_0x2657('0x58')][_0x2657('0x69')],_0x52d5df['value'][_0x2657('0x12')]);}}}else{var _0x3647c3=_(_0x5e016a[_0x2657('0x33')])[_0x2657('0x34')]()[_0x2657('0x21')](function(_0x5d686c){return _[_0x2657('0x6a')](_0x3865e4,['name',_0x5d686c])?_0x5d686c:undefined;})[_0x2657('0x6b')]()[_0x2657('0x58')]();if(!_[_0x2657('0x6c')](_0x3647c3)){_0x3647c3[_0x2657('0x25')](function(_0x3e08d7){if(_0x3e08d7===_0x2657('0x6d')){_0xc2f62a['where'](_0x2657('0x6e'),[][_0x2657('0x6f')](_0x5e016a[_0x2657('0x33')][_0x3e08d7]));}else if(_0x3e08d7===_0x2657('0x70')){var _0x2cdae7=JSON[_0x2657('0x71')](_0x5e016a[_0x2657('0x33')][_0x3e08d7])[_0x2657('0x72')];var _0x3a9ef7=JSON['parse'](_0x5e016a[_0x2657('0x33')][_0x3e08d7])[_0x2657('0x73')];_0xc2f62a[_0x2657('0x74')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2cdae7,_0x3a9ef7);}else{if(_0x5e016a[_0x2657('0x33')][_0x3e08d7]==='null'){_0xc2f62a['where']('i.'+_0x3e08d7+_0x2657('0x75'));}else{_0xc2f62a[_0x2657('0x74')]('i.'+_0x3e08d7+'\x20=\x20?',_0x5e016a[_0x2657('0x33')][_0x3e08d7]);}}});}if(_0x5e016a[_0x2657('0x33')][_0x2657('0x76')]){if(_0x5e016a[_0x2657('0x33')][_0x2657('0x76')]==0x1){_0xc2f62a['having'](_0x2657('0x77'));}else{_0xc2f62a[_0x2657('0x5a')](_0x2657('0x78'));}}if(_0x5e016a[_0x2657('0x33')][_0x2657('0x79')]){_0x4f2df8=_[_0x2657('0x7a')](_0x5e016a['query'][_0x2657('0x79')])?_0x5e016a[_0x2657('0x33')]['tag']:new Array(_0x5e016a[_0x2657('0x33')]['tag']);_0x4f2df8['forEach'](function(_0x388880){_0x17bb25['or'](_0x2657('0x64'),'%,'+_0x388880+',%');});}if(_0x5e016a[_0x2657('0x33')][_0x2657('0x7b')]){var _0x36ce34=_0x5e016a[_0x2657('0x33')]['filter'][_0x2657('0x7c')]('\x5c','\x5c\x5c')[_0x2657('0x7c')](/'/g,'\x27\x27');if(qs[_0x2657('0x7d')](_0x36ce34)){_0x10067c['or'](_0x2657('0x7e'),_0x36ce34+'%');}else if(qs[_0x2657('0x7f')](_0x36ce34)){_0x10067c['or'](_0x2657('0x80'),_0x36ce34+'%');}else{_0x10067c['or'](_0x2657('0x81'),qs[_0x2657('0x5f')](_0x36ce34))['or'](_0x2657('0x82'),qs[_0x2657('0x5f')](_0x36ce34));}}}_0xc2f62a[_0x2657('0x74')](_0x10067c);_0xc2f62a[_0x2657('0x83')]('i.id');var _0xf9ab5f={'type':db['Sequelize'][_0x2657('0x84')][_0x2657('0x85')],'raw':!![]};var _0x4d6357=_0xc2f62a['clone']();_0x4d6357[_0x2657('0x3f')]('i.id');_0x4d6357[_0x2657('0x3f')](_0x2657('0x86'),_0x2657('0x57'));if(_0x7a6cdd['order']){_0x7a6cdd[_0x2657('0x3c')][_0x2657('0x25')](function(_0x50dc8a){var _0x26fe92=_0x50dc8a[0x0]===_0x2657('0x87')?_0x50dc8a[0x0]:'i.'+_0x50dc8a[0x0];_0xc2f62a[_0x2657('0x3c')](_0x26fe92,_0x50dc8a[0x1]===_0x2657('0x88')?![]:!![]);});}if(!_[_0x2657('0x6c')](_0x4f2df8)){_0xc2f62a[_0x2657('0x5a')](_0x17bb25);_0x4d6357[_0x2657('0x74')](_0x2657('0x89'),_0x4f2df8);}BPromise[_0x2657('0x8a')]()['then'](function(){if(!_0x1bfe71){if(_0x5e016a[_0x2657('0x33')][_0x2657('0x6d')])return;_0x4d6357['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0xc2f62a[_0x2657('0x74')](_0x2657('0x8b'));return;}if(_0x5e016a[_0x2657('0x8c')][_0x2657('0x8d')]!==_0x2657('0x8e'))return;return _0x5e016a[_0x2657('0x8c')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x2657('0x1a')](function(_0x5c454c){if(_[_0x2657('0x6c')](_0x5c454c)){_0x4d6357[_0x2657('0x74')](_0x2657('0x8f'));_0xc2f62a[_0x2657('0x74')](_0x2657('0x8f'));}else{_0x4d6357['where'](_0x2657('0x6e'),_['map'](_0x5c454c,'id'));_0xc2f62a[_0x2657('0x74')](_0x2657('0x6e'),_['map'](_0x5c454c,'id'));}});})[_0x2657('0x1a')](function(){if(_0x5e016a['user'][_0x2657('0x8d')]===_0x2657('0x8e')&&!_0x1bfe71&&!_0x5e016a[_0x2657('0x33')][_0x2657('0x6d')])return[];return db[_0x2657('0x90')][_0x2657('0x33')](_0x4d6357[_0x2657('0x91')](),_0xf9ab5f);})['then'](function(_0x23d557){_0x1a56aa['count']=_0x23d557['length'];if(_0x1a56aa['count']===0x0)return[];return db[_0x2657('0x90')][_0x2657('0x33')](_0x5b0fdf[_0x2657('0x91')](),_0xf9ab5f)[_0x2657('0x1a')](function(_0xa12363){_0x15f18e=_[_0x2657('0x92')](_0xa12363,'id');_0xf9ab5f=_[_0x2657('0x93')](_0xf9ab5f,{'model':db[_0x2657('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e016a[_0x2657('0x33')][_0x2657('0x37')]){_0x7a6cdd[_0x2657('0x38')][_0x2657('0x25')](function(_0x53e859){_0xc2f62a['field']('i.'+_0x53e859);});}else{_0xc2f62a[_0x2657('0x3f')](_0x2657('0x86'),_0x2657('0x57'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x94'),_0x2657('0x95'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x96'),_0x2657('0x97'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x98'),_0x2657('0x87'));_0xc2f62a[_0x2657('0x3f')]('i.id');_0xc2f62a[_0x2657('0x3f')]('i.createdAt');_0xc2f62a[_0x2657('0x3f')](_0x2657('0x99'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x9a'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x9b'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x9c'));_0xc2f62a['field'](_0x2657('0x9d'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x9e'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0x9f'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa0'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa1'));_0xc2f62a[_0x2657('0x3f')]('i.thirdDisposition');_0xc2f62a[_0x2657('0x3f')]('i.substatus');_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa2'));_0xc2f62a['field'](_0x2657('0xa3'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa4'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa5'));_0xc2f62a[_0x2657('0x3f')]('c.firstName','Contact.firstName');_0xc2f62a[_0x2657('0x3f')]('c.lastName','Contact.lastName');_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa6'),_0x2657('0xa7'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xa8'),_0x2657('0xa9'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xaa'),_0x2657('0xab'));_0xc2f62a['field'](_0x2657('0xac'),_0x2657('0xad'));_0xc2f62a[_0x2657('0x3f')](_0x2657('0xae'),_0x2657('0xaf'));_0xc2f62a['field'](_0x2657('0xb0'),_0x2657('0xb1'));_0xc2f62a[_0x2657('0x3f')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x7a6cdd[_0x2657('0x15')])_0xc2f62a['limit'](_0x7a6cdd[_0x2657('0x15')]);if(_0x7a6cdd['offset'])_0xc2f62a[_0x2657('0x13')](_0x7a6cdd[_0x2657('0x13')]);return db['sequelize'][_0x2657('0x33')](_0xc2f62a[_0x2657('0x91')](),_0xf9ab5f);})[_0x2657('0x1a')](function(_0x460459){if(_0x460459['length']>0x0)_0xb84dfc[_0x2657('0x74')]('ui.MailInteractionId\x20IN\x20?',_[_0x2657('0x21')](_0x460459,'id'));return db[_0x2657('0x90')][_0x2657('0x33')](_0xb84dfc[_0x2657('0x91')](),_0xf9ab5f)[_0x2657('0x1a')](function(_0x4d0560){var _0x49356e=_[_0x2657('0xb2')](_0x4d0560,_0x2657('0xb3'));var _0x16f9f1=[];return db['Setting'][_0x2657('0x27')]({'attributes':[_0x2657('0xb4')],'raw':!![]})[_0x2657('0x1a')](function(_0x3715fc){var _0x237ba0=_0x3715fc[_0x2657('0xb4')];_0x460459[_0x2657('0x25')](function(_0x22916c){_0x16f9f1[_0x2657('0x26')](updateMailInteraction(_0x22916c,_0x15f18e,_0x49356e,_0x237ba0));});return BPromise['all'](_0x16f9f1);});});});})[_0x2657('0x1a')](function(_0x2e2bfb){_0x1a56aa[_0x2657('0xb5')]=_0x2e2bfb;return _0x1a56aa;})['then'](respondWithFilteredResult(_0x651e8b,_0x7a6cdd))[_0x2657('0x2c')](handleError(_0x651e8b,null));};exports[_0x2657('0xb6')]=function(_0x4ad6cf,_0x13ca8e){var _0x380e61={'raw':![],'where':{'id':_0x4ad6cf[_0x2657('0xb7')]['id']}},_0x41345d={};_0x41345d[_0x2657('0x32')]=_[_0x2657('0x34')](db[_0x2657('0x2d')][_0x2657('0x2e')]);_0x41345d['query']=_[_0x2657('0x34')](_0x4ad6cf[_0x2657('0x33')]);_0x41345d[_0x2657('0x35')]=_[_0x2657('0x36')](_0x41345d[_0x2657('0x32')],_0x41345d[_0x2657('0x33')]);_0x380e61[_0x2657('0x38')]=_[_0x2657('0x36')](_0x41345d[_0x2657('0x32')],qs[_0x2657('0x37')](_0x4ad6cf['query'][_0x2657('0x37')]));_0x380e61['attributes']=_0x380e61[_0x2657('0x38')][_0x2657('0x39')]?_0x380e61[_0x2657('0x38')]:_0x41345d[_0x2657('0x32')];if(_0x4ad6cf[_0x2657('0x33')][_0x2657('0xb8')]){_0x380e61['include']=[{'all':!![]}];}_0x380e61=_[_0x2657('0x93')]({},_0x380e61,_0x4ad6cf[_0x2657('0xb9')]);return db['MailInteraction'][_0x2657('0x56')](_0x380e61)['then'](handleEntityNotFound(_0x13ca8e,null))[_0x2657('0x1a')](respondWithResult(_0x13ca8e,null))['catch'](handleError(_0x13ca8e,null));};exports['create']=function(_0x8878ac,_0x26bdb7){return db[_0x2657('0x2d')]['create'](_0x8878ac[_0x2657('0xba')],{})[_0x2657('0x1a')](respondWithResult(_0x26bdb7,0xc9))[_0x2657('0x2c')](handleError(_0x26bdb7,null));};exports[_0x2657('0x19')]=function(_0x7482c,_0x2a48db){if(_0x7482c['body']['id']){delete _0x7482c[_0x2657('0xba')]['id'];}return db[_0x2657('0x2d')]['find']({'where':{'id':_0x7482c['params']['id']}})[_0x2657('0x1a')](handleEntityNotFound(_0x2a48db,null))[_0x2657('0x1a')](saveUpdates(_0x7482c['body'],null))[_0x2657('0x1a')](respondWithResult(_0x2a48db,null))[_0x2657('0x2c')](handleError(_0x2a48db,null));};exports[_0x2657('0x1b')]=function(_0x3229fb,_0x50f75e){return db['MailInteraction'][_0x2657('0x56')]({'where':{'id':_0x3229fb[_0x2657('0xb7')]['id']}})[_0x2657('0x1a')](handleEntityNotFound(_0x50f75e,null))[_0x2657('0x1a')](removeEntity(_0x50f75e,null))[_0x2657('0x2c')](handleError(_0x50f75e,null));};exports[_0x2657('0xbb')]=function(_0x3e18ea,_0x12c3e3){return db['MailInteraction'][_0x2657('0xbb')]()[_0x2657('0x1a')](respondWithResult(_0x12c3e3,null))[_0x2657('0x2c')](handleError(_0x12c3e3,null));};exports[_0x2657('0xbc')]=function(_0x15a452,_0x342714){return db[_0x2657('0xbd')][_0x2657('0x56')]({'where':{'id':_0x15a452[_0x2657('0xb7')]['id']}})[_0x2657('0x1a')](handleEntityNotFound(_0x342714,null))[_0x2657('0x1a')](function(_0x34166a){if(_0x34166a){return _0x34166a[_0x2657('0xbc')](_0x15a452['body'][_0x2657('0xbe')],_[_0x2657('0xbf')](_0x15a452[_0x2657('0xba')],[_0x2657('0xbe'),'id'])||{});}})[_0x2657('0x1a')](respondWithResult(_0x342714,null))[_0x2657('0x2c')](handleError(_0x342714,null));};exports['getMessages']=function(_0x448357,_0xd2bd7a){var _0x4cc28b={'raw':![],'where':{}};var _0x44bb66={};var _0x2eae8d={'count':0x0,'rows':[]};return db[_0x2657('0x2d')]['findOne']({'where':{'id':_0x448357['params']['id']}})[_0x2657('0x1a')](handleEntityNotFound(_0xd2bd7a,null))[_0x2657('0x1a')](function(_0x34d05b){if(_0x34d05b){_0x44bb66[_0x2657('0x32')]=_[_0x2657('0x34')](db[_0x2657('0xbd')][_0x2657('0x2e')]);_0x44bb66[_0x2657('0x33')]=_[_0x2657('0x34')](_0x448357[_0x2657('0x33')]);_0x44bb66[_0x2657('0x35')]=_['intersection'](_0x44bb66[_0x2657('0x32')],_0x44bb66[_0x2657('0x33')]);_0x4cc28b['attributes']=_[_0x2657('0x36')](_0x44bb66[_0x2657('0x32')],qs['fields'](_0x448357[_0x2657('0x33')][_0x2657('0x37')]));_0x4cc28b['attributes']=_0x4cc28b[_0x2657('0x38')][_0x2657('0x39')]?_0x4cc28b['attributes']:_0x44bb66[_0x2657('0x32')];if(!_0x448357[_0x2657('0x33')][_0x2657('0x3a')](_0x2657('0x3b'))){_0x4cc28b[_0x2657('0x15')]=qs[_0x2657('0x15')](_0x448357[_0x2657('0x33')][_0x2657('0x15')]);_0x4cc28b[_0x2657('0x13')]=qs[_0x2657('0x13')](_0x448357[_0x2657('0x33')][_0x2657('0x13')]);}_0x4cc28b['order']=qs[_0x2657('0x3d')](_0x448357[_0x2657('0x33')][_0x2657('0x3d')]);_0x4cc28b[_0x2657('0x74')]=qs[_0x2657('0x35')](_[_0x2657('0xc0')](_0x448357[_0x2657('0x33')],_0x44bb66['filters']));_0x4cc28b[_0x2657('0x74')][_0x2657('0xb3')]=_0x34d05b['id'];if(_0x448357['query'][_0x2657('0x7b')]){_0x4cc28b['where']=_['merge'](_0x4cc28b['where'],{'$or':_[_0x2657('0x21')](_0x4cc28b[_0x2657('0x38')],function(_0x561ab6){var _0x2ab543={};_0x2ab543[_0x561ab6]={'$like':'%'+_0x448357[_0x2657('0x33')]['filter']+'%'};return _0x2ab543;})});}if(_0x448357[_0x2657('0x33')][_0x2657('0x72')]){var _0x4c278f=_0x448357[_0x2657('0x33')][_0x2657('0x72')][_0x2657('0x24')](',');var _0x42d5a8={};_0x42d5a8[_0x4c278f[0x0]]={'$gte':moment(_0x4c278f[0x1])[_0x2657('0xc1')](_0x2657('0xc2'))};_0x4cc28b[_0x2657('0x74')]=_[_0x2657('0x93')](_0x4cc28b[_0x2657('0x74')],_0x42d5a8);}_0x4cc28b=_[_0x2657('0x93')]({},_0x4cc28b,_0x448357[_0x2657('0xb9')]);return db[_0x2657('0xbd')][_0x2657('0x16')]({'where':_0x4cc28b[_0x2657('0x74')]})[_0x2657('0x1a')](function(_0x2d3446){_0x2eae8d[_0x2657('0x16')]=_0x2d3446;if(_0x448357['query'][_0x2657('0xb8')]){_0x4cc28b[_0x2657('0xc3')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4cc28b);})[_0x2657('0x1a')](function(_0x2b2945){if(_0x448357[_0x2657('0x33')][_0x2657('0xc4')]===_0x2657('0xc5')){for(var _0x183dba=0x0;_0x183dba<_0x2b2945[_0x2657('0x39')];_0x183dba++){_0x2b2945[_0x183dba]['body']=juice(_0x2b2945[_0x183dba][_0x2657('0xba')]);}}_0x2eae8d[_0x2657('0xb5')]=_0x2b2945;return _0x2eae8d;});}})[_0x2657('0x1a')](respondWithFilteredResult(_0xd2bd7a,_0x4cc28b))[_0x2657('0x2c')](handleError(_0xd2bd7a,null));};exports[_0x2657('0xc6')]=function(_0x427dd1,_0x68fa35){return db[_0x2657('0x2d')][_0x2657('0x56')]({'where':{'id':_0x427dd1['params']['id']}})['then'](handleEntityNotFound(_0x68fa35,null))[_0x2657('0x1a')](function(_0x1c31ef){if(_0x1c31ef){return _0x1c31ef['setTags'](_0x427dd1[_0x2657('0xba')][_0x2657('0xbe')],_[_0x2657('0xbf')](_0x427dd1[_0x2657('0xba')],[_0x2657('0xbe'),'id'])||{})[_0x2657('0xc7')](function(){return db['Tag'][_0x2657('0xc8')]({'attributes':['id',_0x2657('0x1e'),_0x2657('0x40')],'where':{'id':_0x427dd1[_0x2657('0xba')]['ids']}});})[_0x2657('0x1a')](function(_0x4789aa){socket[_0x2657('0xc9')](_0x2657('0xca'),{'id':Number(_0x427dd1['params']['id']),'tags':_0x4789aa||[]});return{'id':Number(_0x427dd1[_0x2657('0xb7')]['id']),'tags':_0x4789aa||[]};});}})['then'](respondWithResult(_0x68fa35,null))[_0x2657('0x2c')](handleError(_0x68fa35,null));};exports[_0x2657('0xcb')]=function(_0x25ec0a,_0x4b1ea4){return db[_0x2657('0x2d')][_0x2657('0x56')]({'where':{'id':_0x25ec0a[_0x2657('0xb7')]['id']}})[_0x2657('0x1a')](handleEntityNotFound(_0x4b1ea4,null))[_0x2657('0x1a')](function(_0x1272b7){if(_0x1272b7){return _0x1272b7[_0x2657('0xcb')](_0x25ec0a['query']['ids']);}})[_0x2657('0x1a')](respondWithStatusCode(_0x4b1ea4,null))[_0x2657('0x2c')](handleError(_0x4b1ea4,null));};exports[_0x2657('0xcc')]=function(_0x2c48e1,_0x17d7ec){var _0x2436ce=moment()[_0x2657('0xcd')]()['toString']();var _0x2789d9=path[_0x2657('0xce')](config[_0x2657('0xcf')],_0x2657('0xd0'),_0x2657('0xd1'),_0x2657('0xd2'));var _0x1d82cb=path[_0x2657('0xce')](config['root'],'server',_0x2657('0xd1'),_0x2657('0xd3'));var _0x349201=path[_0x2657('0xce')](_0x2789d9,_0x2436ce);var _0x275189=util[_0x2657('0xc1')]('transcript-%d-%s.zip',_0x2c48e1[_0x2657('0xb7')]['id'],_0x2436ce);var _0x189ace=path['join'](_0x2789d9,_0x275189);var _0xd7825a=[];if(_0x2c48e1[_0x2657('0x33')][_0x2657('0xd3')]){_0xd7825a['push']({'model':db[_0x2657('0xd4')],'as':_0x2657('0xd5'),'raw':!![]});}var _0x236044=[{'model':db[_0x2657('0xbd')],'as':_0x2657('0xd6'),'attributes':['id',_0x2657('0xba'),_0x2657('0x47'),'to','cc',_0x2657('0xd7'),_0x2657('0xd8'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xd7825a}];return db['MailInteraction'][_0x2657('0x56')]({'where':{'id':_0x2c48e1['params']['id']},'include':_0x236044})['then'](handleEntityNotFound(_0x17d7ec,null))['then'](function(_0x246882){if(_0x246882&&_0x246882[_0x2657('0xd6')]){var _0x3b682d=_0x246882['get']({'plain':!![]});fs['mkdirSync'](_0x349201);return BPromise[_0x2657('0xd9')](_0x3b682d[_0x2657('0xd6')],function(_0x45cd78,_0x18d4aa){var _0x474746={'from':_0x45cd78[_0x2657('0x47')],'to':_0x45cd78['to'],'subject':_0x45cd78[_0x2657('0xd8')],'html':htmlEntities[_0x2657('0xda')](_0x45cd78[_0x2657('0xba')]),'headers':{'Date':moment(_0x45cd78[_0x2657('0x70')])[_0x2657('0xc1')](_0x2657('0xdb'))},'attachments':[]};if(_0x45cd78['cc']){_0x474746[_0x2657('0xdc')]['Cc']=_0x45cd78['cc'];}if(_0x45cd78[_0x2657('0xd7')]){_0x474746[_0x2657('0xdc')][_0x2657('0xdd')]=_0x45cd78['bcc'];}return new BPromise(function(_0x1d043d,_0x17c667){if(_0x45cd78[_0x2657('0xd5')]){for(var _0xc2999e=0x0;_0xc2999e<_0x45cd78[_0x2657('0xd5')][_0x2657('0x39')];_0xc2999e++){var _0x101746=_0x45cd78[_0x2657('0xd5')][_0xc2999e];var _0x5c3a4d=path[_0x2657('0xce')](_0x1d82cb,_0x101746[_0x2657('0xde')]);if(fs['existsSync'](_0x5c3a4d)){_0x474746[_0x2657('0xd3')][_0x2657('0x26')]({'name':_0x101746[_0x2657('0x1e')],'contentType':_0x101746['type'],'data':fs[_0x2657('0xdf')](_0x5c3a4d)});}}}emlformat['build'](_0x474746,function(_0x7b4868,_0x25fd4b){if(_0x7b4868)return _0x17c667(_0x7b4868);fs['writeFileSync'](path[_0x2657('0xce')](_0x349201,util[_0x2657('0xc1')](_0x2657('0xe0'),_0x18d4aa)),_0x25fd4b);return _0x1d043d(_0x25fd4b);});});})[_0x2657('0x1a')](function(){return new BPromise(function(_0x104de4,_0x2cf8da){zipdir(_0x349201,{'saveTo':_0x189ace},function(_0x4c104a,_0x1fcc20){if(_0x4c104a)return _0x2cf8da(_0x4c104a);return _0x104de4(_0x1fcc20);});})[_0x2657('0x1a')](function(){return new BPromise(function(_0x5a05bf,_0x4e2968){rimraf(_0x349201,function(_0x26e799){if(_0x26e799)_0x4e2968(_0x26e799);return _0x5a05bf();});});})[_0x2657('0x1a')](function(){return _0x17d7ec[_0x2657('0xcc')](_0x189ace,_0x275189,function(_0x477ce6){if(!_0x477ce6)fs[_0x2657('0xe1')](_0x189ace);});});});}else{return _0x17d7ec[_0x2657('0x10')](0xc8);}})[_0x2657('0x2c')](handleError(_0x17d7ec,null));}; \ No newline at end of file +var _0x7369=['stack','name','send','Users','map','fullname','TagIds','Tags','forEach','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','key','keys','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','isEmpty','MailAccountId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','MailInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','Setting','enableEmailPreview','push','all','show','params','includeAll','include','create','body','describe','addMessage','ids','getMessages','format','options','findAll','inlineCss','addTags','setTags','omit','spread','emit','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','rimraf','moment','bluebird','util','path','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','error'];(function(_0x57e1f7,_0x3c21f5){var _0x3b4be6=function(_0x7c0d66){while(--_0x7c0d66){_0x57e1f7['push'](_0x57e1f7['shift']());}};_0x3b4be6(++_0x3c21f5);}(_0x7369,0xc6));var _0x9736=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7369[_0x29b609];return _0x54c952;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9736('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9736('0x1'));var BPromise=require(_0x9736('0x2'));var util=require(_0x9736('0x3'));var path=require(_0x9736('0x4'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require('juice');var Redis=require(_0x9736('0x5'));var qs=require('../../components/parsers/qs');var as=require(_0x9736('0x6'));var logger=require('../../config/logger')('api');var config=require(_0x9736('0x7'));var db=require(_0x9736('0x8'))['db'];var htmlEntities=require(_0x9736('0x9'));config[_0x9736('0xa')]=_['defaults'](config['redis'],{'host':_0x9736('0xb'),'port':0x18eb});var socket=require(_0x9736('0xc'))(new Redis(config[_0x9736('0xa')]));require(_0x9736('0xd'))[_0x9736('0xe')](socket);function respondWithStatusCode(_0x1ad401,_0x3ae7a6){_0x3ae7a6=_0x3ae7a6||0xcc;return function(_0x6e8268){if(_0x6e8268){return _0x1ad401[_0x9736('0xf')](_0x3ae7a6);}return _0x1ad401[_0x9736('0x10')](_0x3ae7a6)['end']();};}function respondWithResult(_0xf8bdca,_0x602fc8){_0x602fc8=_0x602fc8||0xc8;return function(_0x5768e3){if(_0x5768e3){return _0xf8bdca[_0x9736('0x10')](_0x602fc8)[_0x9736('0x11')](_0x5768e3);}};}function respondWithFilteredResult(_0x2e8a05,_0x3c1a66){return function(_0x450f7e){if(_0x450f7e){var _0x50fc7f=typeof _0x3c1a66['offset']===_0x9736('0x12')&&typeof _0x3c1a66[_0x9736('0x13')]===_0x9736('0x12');var _0x3fe60d=_0x450f7e[_0x9736('0x14')];var _0x206eb1=_0x50fc7f?0x0:_0x3c1a66[_0x9736('0x15')];var _0x238c93=_0x50fc7f?_0x450f7e['count']:_0x3c1a66[_0x9736('0x15')]+_0x3c1a66['limit'];var _0x4376b2;if(_0x238c93>=_0x3fe60d){_0x238c93=_0x3fe60d;_0x4376b2=0xc8;}else{_0x4376b2=0xce;}_0x2e8a05['status'](_0x4376b2);return _0x2e8a05[_0x9736('0x16')](_0x9736('0x17'),_0x206eb1+'-'+_0x238c93+'/'+_0x3fe60d)[_0x9736('0x11')](_0x450f7e);}return null;};}function saveUpdates(_0x89333a){return function(_0x127132){if(_0x127132){return _0x127132[_0x9736('0x18')](_0x89333a)[_0x9736('0x19')](function(_0x545981){return _0x545981;});}return null;};}function removeEntity(_0x182276){return function(_0x267067){if(_0x267067){return _0x267067[_0x9736('0x1a')]()['then'](function(){_0x182276['status'](0xcc)[_0x9736('0x1b')]();});}};}function handleEntityNotFound(_0x2941be){return function(_0x1ecd7a){if(!_0x1ecd7a){_0x2941be[_0x9736('0xf')](0x194);}return _0x1ecd7a;};}function handleError(_0x533548,_0x1ca2ce){_0x1ca2ce=_0x1ca2ce||0x1f4;return function(_0x4e3714){logger[_0x9736('0x1c')](_0x4e3714[_0x9736('0x1d')]);if(_0x4e3714[_0x9736('0x1e')]){delete _0x4e3714[_0x9736('0x1e')];}_0x533548[_0x9736('0x10')](_0x1ca2ce)[_0x9736('0x1f')](_0x4e3714);};}function getInteractionUsers(_0x4aa891,_0x11bfbc){return new BPromise(function(_0xffe1,_0x53134b){try{if(_0x11bfbc[_0x4aa891['id']]){_0x4aa891[_0x9736('0x20')]=_[_0x9736('0x21')](_0x11bfbc[_0x4aa891['id']],function(_0x156dc4){return{'id':_0x156dc4['id'],'fullname':_0x156dc4[_0x9736('0x22')]};});}}catch(_0xdab979){_0x53134b(_0xdab979);}_0xffe1(_0x4aa891);});}function getInteractionTags(_0x3eb7a6,_0x2e1532){return new BPromise(function(_0x37059d,_0x4d3bb6){try{if(_0x3eb7a6[_0x9736('0x23')]){_0x3eb7a6[_0x9736('0x24')]=[];_0x3eb7a6['TagIds']['split'](',')[_0x9736('0x25')](function(_0x540d20){_0x3eb7a6['Tags']['push'](_0x2e1532[_0x540d20]);});}delete _0x3eb7a6[_0x9736('0x23')];}catch(_0x299329){_0x4d3bb6(_0x299329);}_0x37059d(_0x3eb7a6);});}function getLastMessageText(_0xbb34f4){return new BPromise(function(_0x14d7f8,_0x44049c){return db[_0x9736('0x26')][_0x9736('0x27')]({'where':{'$and':[{'MailInteractionId':_0xbb34f4['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9736('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9736('0x29')],'order':_0x9736('0x2a'),'raw':!![]})['then'](function(_0x5bd83e){if(_0x5bd83e&&_0x5bd83e['plainBody']){_0xbb34f4[_0x9736('0x2b')]=_[_0x9736('0x2c')](_0x5bd83e[_0x9736('0x29')]);}_0x14d7f8(_0xbb34f4);})[_0x9736('0x2d')](function(_0x517669){_0x44049c(_0x517669);});});}function updateMailInteraction(_0x2db675,_0x3605e1,_0x48bfa5,_0x29bc4e){return new BPromise(function(_0x5f297a,_0x14b610){return getInteractionUsers(_0x2db675,_0x48bfa5)[_0x9736('0x19')](function(_0x2a6a3b){return getInteractionTags(_0x2a6a3b,_0x3605e1);})[_0x9736('0x19')](function(_0x4bf0d9){if(_0x29bc4e){_0x5f297a(getLastMessageText(_0x4bf0d9));}else{_0x5f297a(_0x4bf0d9);}})[_0x9736('0x2d')](function(_0x224b96){_0x14b610(_0x224b96);});});}exports[_0x9736('0x2e')]=function(_0xf1111,_0x13fcb2){var _0x1e6824={},_0x39d1a9={},_0x251b3e={'count':0x0,'rows':[]};var _0x31786f=_[_0x9736('0x21')](db['MailInteraction'][_0x9736('0x2f')],function(_0xa88a66){return{'name':_0xa88a66[_0x9736('0x30')],'type':_0xa88a66[_0x9736('0x31')][_0x9736('0x32')]};});_0x39d1a9['model']=_[_0x9736('0x21')](_0x31786f,'name');_0x39d1a9['query']=_[_0x9736('0x33')](_0xf1111['query']);_0x39d1a9['filters']=_['intersection'](_0x39d1a9[_0x9736('0x34')],_0x39d1a9[_0x9736('0x35')]);_0x1e6824[_0x9736('0x36')]=_[_0x9736('0x37')](_0x39d1a9[_0x9736('0x34')],qs[_0x9736('0x38')](_0xf1111[_0x9736('0x35')]['fields']));_0x1e6824[_0x9736('0x36')]=_0x1e6824[_0x9736('0x36')][_0x9736('0x39')]?_0x1e6824['attributes']:_0x39d1a9[_0x9736('0x34')];if(!_0xf1111['query'][_0x9736('0x3a')](_0x9736('0x3b'))){_0x1e6824[_0x9736('0x13')]=qs[_0x9736('0x13')](_0xf1111['query']['limit']);_0x1e6824['offset']=qs[_0x9736('0x15')](_0xf1111[_0x9736('0x35')]['offset']);}_0x1e6824[_0x9736('0x3c')]=qs[_0x9736('0x3d')](_0xf1111[_0x9736('0x35')][_0x9736('0x3d')]);_0x1e6824[_0x9736('0x3e')]=qs[_0x9736('0x3f')](_[_0x9736('0x40')](_0xf1111['query'],_0x39d1a9[_0x9736('0x3f')]),_0x31786f);var _0x3e3204=[];var _0x3ab140=squel[_0x9736('0x41')]()[_0x9736('0x42')]('id')['field']('name')['field'](_0x9736('0x43'))[_0x9736('0x44')](_0x9736('0x45'));var _0x214c4a=squel[_0x9736('0x41')]()[_0x9736('0x42')](_0x9736('0x46'))['field'](_0x9736('0x47'))[_0x9736('0x42')]('ui.MailInteractionId')[_0x9736('0x44')](_0x9736('0x48'),'ui')[_0x9736('0x49')]('users','u',_0x9736('0x4a'));var _0x1d66b2=squel[_0x9736('0x41')]()['from']('mail_interactions','i')[_0x9736('0x49')](_0x9736('0x4b'),'c',_0x9736('0x4c'))['left_join']('users','o',_0x9736('0x4d'))[_0x9736('0x49')](_0x9736('0x4e'),'a',_0x9736('0x4f'))[_0x9736('0x49')](_0x9736('0x50'),'me',_0x9736('0x51'))[_0x9736('0x49')](_0x9736('0x52'),'it',_0x9736('0x53'))[_0x9736('0x49')](_0x9736('0x45'),'t','t.id\x20=\x20it.TagId');var _0x4db26f=squel[_0x9736('0x54')]();var _0x2c1f61=[];var _0x125c6d=squel[_0x9736('0x54')]();var _0x51e3ba;if(_0xf1111[_0x9736('0x35')][_0x9736('0x55')]){_0x51e3ba=as[_0x9736('0x56')](_0xf1111[_0x9736('0x35')][_0x9736('0x55')]);var _0x300d28=_0x51e3ba[_0x9736('0x57')];for(var _0x490fa9=0x0;_0x490fa9<_0x51e3ba['conditions']['length'];_0x490fa9++){var _0x52bb27=_0x51e3ba['conditions'][_0x490fa9];var _0xb434='i';var _0x7c02e3=_[_0x9736('0x58')](_0x31786f,[_0x9736('0x1e'),_0x52bb27[_0x9736('0x42')]]);if(!_0x7c02e3){switch(_0x52bb27['field']){case'unreadMessages':if(_0x52bb27[_0x9736('0x59')]==0x1){_0x1d66b2[_0x9736('0x5a')]('`'+_0x52bb27[_0x9736('0x42')]+'`\x20=\x200');}else{_0x1d66b2[_0x9736('0x5a')]('`'+_0x52bb27[_0x9736('0x42')]+_0x9736('0x5b'));}break;case _0x9736('0x5c'):if(_0x52bb27[_0x9736('0x5d')]===_0x9736('0x5e')){if(_0x52bb27['value']['split']('\x20')[_0x9736('0x39')]>0x1){_0x4db26f[_0x300d28](_0x9736('0x5f'),qs[_0x9736('0x60')](_0x52bb27[_0x9736('0x59')]),null);}else{var _0x4bdb8f='%'+_0x52bb27[_0x9736('0x59')]+'%';_0x4db26f[_0x300d28]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4bdb8f,_0x4bdb8f,_0x4bdb8f);}}else{_0x7c02e3=_[_0x9736('0x58')](_0x31786f,[_0x9736('0x1e'),_0x9736('0x61')]);_0x52bb27[_0x9736('0x42')]=_0x9736('0x61');_0x39d911=as[_0x9736('0x62')](_0xb434,_0x7c02e3['type'],_0x52bb27);_0x4db26f[_0x300d28](_0x39d911[_0x9736('0x63')],_0x39d911['value'][_0x9736('0x64')],_0x39d911[_0x9736('0x59')][_0x9736('0x1b')]);}break;case _0x9736('0x65'):var _0xe6447d=_0x52bb27[_0x9736('0x59')]['split'](',')[_0x9736('0x21')](function(_0x52e3f8){return Number(_0x52e3f8);});_0xe6447d['forEach'](function(_0x2fc1b3){_0x125c6d['or'](_0x9736('0x66'),'%,'+_0x2fc1b3+',%');});_0x2c1f61=_['union'](_0x2c1f61,_0xe6447d);break;case _0x9736('0x67'):if(_0x52bb27[_0x9736('0x5d')]===_0x9736('0x5e')){_0x4db26f[_0x300d28](_0x9736('0x68'),'%'+_0x52bb27['value']+'%',null);}else{_0x7c02e3=_[_0x9736('0x58')](_0x31786f,[_0x9736('0x1e'),_0x9736('0x69')]);_0x52bb27[_0x9736('0x42')]=_0x9736('0x69');_0x39d911=as[_0x9736('0x62')](_0xb434,_0x7c02e3['type'],_0x52bb27);_0x4db26f[_0x300d28](_0x39d911[_0x9736('0x63')],_0x39d911['value'][_0x9736('0x64')],_0x39d911[_0x9736('0x59')][_0x9736('0x1b')]);}break;case _0x9736('0x29'):_0x39d911=as[_0x9736('0x62')]('me',null,_0x52bb27);_0x4db26f[_0x300d28](_0x39d911[_0x9736('0x63')],_0x39d911[_0x9736('0x59')]['start'],_0x39d911['value'][_0x9736('0x1b')]);break;}}else{var _0x39d911=as[_0x9736('0x62')](_0xb434,_0x7c02e3[_0x9736('0x31')],_0x52bb27);_0x4db26f[_0x300d28](_0x39d911[_0x9736('0x63')],_0x39d911['value'][_0x9736('0x64')],_0x39d911[_0x9736('0x59')][_0x9736('0x1b')]);}}}else{var _0x53210f=_(_0xf1111[_0x9736('0x35')])[_0x9736('0x33')]()[_0x9736('0x21')](function(_0x1d569d){return _['some'](_0x31786f,[_0x9736('0x1e'),_0x1d569d])?_0x1d569d:undefined;})['compact']()['value']();if(!_[_0x9736('0x6a')](_0x53210f)){_0x53210f[_0x9736('0x25')](function(_0x5fbbd1){if(_0x5fbbd1===_0x9736('0x6b')){_0x1d66b2['where']('i.MailAccountId\x20IN\x20?',[]['concat'](_0xf1111[_0x9736('0x35')][_0x5fbbd1]));}else if(_0x5fbbd1==='createdAt'){var _0x768edf=JSON[_0x9736('0x6c')](_0xf1111[_0x9736('0x35')][_0x5fbbd1])[_0x9736('0x6d')];var _0x1a3e9d=JSON['parse'](_0xf1111[_0x9736('0x35')][_0x5fbbd1])[_0x9736('0x6e')];_0x1d66b2[_0x9736('0x3e')](_0x9736('0x6f'),_0x768edf,_0x1a3e9d);}else{if(_0xf1111['query'][_0x5fbbd1]===_0x9736('0x70')){_0x1d66b2[_0x9736('0x3e')]('i.'+_0x5fbbd1+'\x20IS\x20NULL');}else{_0x1d66b2[_0x9736('0x3e')]('i.'+_0x5fbbd1+_0x9736('0x71'),_0xf1111[_0x9736('0x35')][_0x5fbbd1]);}}});}if(_0xf1111[_0x9736('0x35')]['read']){if(_0xf1111[_0x9736('0x35')][_0x9736('0x72')]==0x1){_0x1d66b2[_0x9736('0x5a')](_0x9736('0x73'));}else{_0x1d66b2[_0x9736('0x5a')](_0x9736('0x74'));}}if(_0xf1111[_0x9736('0x35')][_0x9736('0x75')]){_0x2c1f61=_[_0x9736('0x76')](_0xf1111['query'][_0x9736('0x75')])?_0xf1111['query'][_0x9736('0x75')]:new Array(_0xf1111[_0x9736('0x35')]['tag']);_0x2c1f61['forEach'](function(_0x863051){_0x125c6d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x863051+',%');});}if(_0xf1111[_0x9736('0x35')]['filter']){var _0x55fa75=_0xf1111['query'][_0x9736('0x77')][_0x9736('0x78')]('\x5c','\x5c\x5c')[_0x9736('0x78')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x55fa75)){_0x4db26f['or'](_0x9736('0x79'),_0x55fa75+'%');}else if(qs[_0x9736('0x7a')](_0x55fa75)){_0x4db26f['or'](_0x9736('0x7b'),_0x55fa75+'%');}else{_0x4db26f['or'](_0x9736('0x7c'),qs['getFullTextValue'](_0x55fa75))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9736('0x60')](_0x55fa75));}}}_0x1d66b2[_0x9736('0x3e')](_0x4db26f);_0x1d66b2['group'](_0x9736('0x7d'));var _0x48d442={'type':db[_0x9736('0x7e')][_0x9736('0x7f')][_0x9736('0x80')],'raw':!![]};var _0x23faa7=_0x1d66b2[_0x9736('0x81')]();_0x23faa7[_0x9736('0x42')](_0x9736('0x7d'));_0x23faa7['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9736('0x82'));if(_0x1e6824[_0x9736('0x3c')]){_0x1e6824[_0x9736('0x3c')][_0x9736('0x25')](function(_0x4ab873){var _0x31794e=_0x4ab873[0x0]===_0x9736('0x83')?_0x4ab873[0x0]:'i.'+_0x4ab873[0x0];_0x1d66b2[_0x9736('0x3c')](_0x31794e,_0x4ab873[0x1]===_0x9736('0x84')?![]:!![]);});}if(!_[_0x9736('0x6a')](_0x2c1f61)){_0x1d66b2[_0x9736('0x5a')](_0x125c6d);_0x23faa7[_0x9736('0x3e')](_0x9736('0x85'),_0x2c1f61);}BPromise['resolve']()[_0x9736('0x19')](function(){if(!_0x51e3ba){if(_0xf1111[_0x9736('0x35')][_0x9736('0x6b')])return;_0x23faa7[_0x9736('0x3e')](_0x9736('0x86'));_0x1d66b2[_0x9736('0x3e')](_0x9736('0x86'));return;}if(_0xf1111[_0x9736('0x87')][_0x9736('0x88')]!==_0x9736('0x89'))return;return _0xf1111[_0x9736('0x87')][_0x9736('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d5476){if(_[_0x9736('0x6a')](_0x1d5476)){_0x23faa7[_0x9736('0x3e')](_0x9736('0x8b'));_0x1d66b2['where'](_0x9736('0x8b'));}else{_0x23faa7[_0x9736('0x3e')]('i.MailAccountId\x20IN\x20?',_[_0x9736('0x21')](_0x1d5476,'id'));_0x1d66b2[_0x9736('0x3e')](_0x9736('0x8c'),_['map'](_0x1d5476,'id'));}});})[_0x9736('0x19')](function(){if(_0xf1111[_0x9736('0x87')][_0x9736('0x88')]===_0x9736('0x89')&&!_0x51e3ba&&!_0xf1111[_0x9736('0x35')]['MailAccountId'])return[];return db[_0x9736('0x8d')][_0x9736('0x35')](_0x23faa7[_0x9736('0x8e')](),_0x48d442);})['then'](function(_0x433f81){_0x251b3e[_0x9736('0x14')]=_0x433f81[_0x9736('0x39')];if(_0x251b3e[_0x9736('0x14')]===0x0)return[];return db[_0x9736('0x8d')]['query'](_0x3ab140[_0x9736('0x8e')](),_0x48d442)['then'](function(_0x1cf5cc){_0x3e3204=_[_0x9736('0x8f')](_0x1cf5cc,'id');_0x48d442=_[_0x9736('0x90')](_0x48d442,{'model':db[_0x9736('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf1111['query']['fields']){_0x1e6824[_0x9736('0x36')][_0x9736('0x25')](function(_0x459a71){_0x1d66b2[_0x9736('0x42')]('i.'+_0x459a71);});}else{_0x1d66b2['field'](_0x9736('0x92'),_0x9736('0x82'));_0x1d66b2[_0x9736('0x42')](_0x9736('0x93'),_0x9736('0x94'));_0x1d66b2[_0x9736('0x42')](_0x9736('0x95'),_0x9736('0x96'));_0x1d66b2[_0x9736('0x42')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x1d66b2[_0x9736('0x42')](_0x9736('0x7d'));_0x1d66b2['field']('i.createdAt');_0x1d66b2[_0x9736('0x42')]('i.updatedAt');_0x1d66b2[_0x9736('0x42')](_0x9736('0x97'));_0x1d66b2['field'](_0x9736('0x98'));_0x1d66b2['field'](_0x9736('0x99'));_0x1d66b2[_0x9736('0x42')](_0x9736('0x9a'));_0x1d66b2[_0x9736('0x42')](_0x9736('0x9b'));_0x1d66b2[_0x9736('0x42')]('i.subject');_0x1d66b2['field'](_0x9736('0x9c'));_0x1d66b2[_0x9736('0x42')]('i.secondDisposition');_0x1d66b2['field'](_0x9736('0x9d'));_0x1d66b2[_0x9736('0x42')](_0x9736('0x9e'));_0x1d66b2[_0x9736('0x42')](_0x9736('0x9f'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xa0'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xa1'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xa2'));_0x1d66b2[_0x9736('0x42')]('c.firstName',_0x9736('0xa3'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xa4'),_0x9736('0xa5'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xa6'),_0x9736('0xa7'));_0x1d66b2['field'](_0x9736('0xa8'),_0x9736('0xa9'));_0x1d66b2[_0x9736('0x42')]('c.mobile',_0x9736('0xaa'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xab'),_0x9736('0xac'));_0x1d66b2[_0x9736('0x42')](_0x9736('0xad'),_0x9736('0xae'));_0x1d66b2['field'](_0x9736('0xaf'),'Owner.internal');_0x1d66b2[_0x9736('0x42')](_0x9736('0xb0'),_0x9736('0x23'));}if(_0x1e6824['limit'])_0x1d66b2[_0x9736('0x13')](_0x1e6824[_0x9736('0x13')]);if(_0x1e6824[_0x9736('0x15')])_0x1d66b2[_0x9736('0x15')](_0x1e6824['offset']);return db[_0x9736('0x8d')][_0x9736('0x35')](_0x1d66b2[_0x9736('0x8e')](),_0x48d442);})[_0x9736('0x19')](function(_0x4b87c5){if(_0x4b87c5[_0x9736('0x39')]>0x0)_0x214c4a['where']('ui.MailInteractionId\x20IN\x20?',_[_0x9736('0x21')](_0x4b87c5,'id'));return db[_0x9736('0x8d')][_0x9736('0x35')](_0x214c4a[_0x9736('0x8e')](),_0x48d442)[_0x9736('0x19')](function(_0x8a6ca8){var _0x5c4ee7=_['groupBy'](_0x8a6ca8,_0x9736('0xb1'));var _0xd22ef7=[];return db[_0x9736('0xb2')][_0x9736('0x27')]({'attributes':[_0x9736('0xb3')],'raw':!![]})[_0x9736('0x19')](function(_0x537903){var _0xfdf255=_0x537903['enableEmailPreview'];_0x4b87c5[_0x9736('0x25')](function(_0x4a1297){_0xd22ef7[_0x9736('0xb4')](updateMailInteraction(_0x4a1297,_0x3e3204,_0x5c4ee7,_0xfdf255));});return BPromise[_0x9736('0xb5')](_0xd22ef7);});});});})[_0x9736('0x19')](function(_0x8bc49d){_0x251b3e['rows']=_0x8bc49d;return _0x251b3e;})[_0x9736('0x19')](respondWithFilteredResult(_0x13fcb2,_0x1e6824))[_0x9736('0x2d')](handleError(_0x13fcb2,null));};exports[_0x9736('0xb6')]=function(_0x29e404,_0x567a20){var _0x4cf350={'raw':![],'where':{'id':_0x29e404[_0x9736('0xb7')]['id']}},_0x57cee3={};_0x57cee3[_0x9736('0x34')]=_[_0x9736('0x33')](db[_0x9736('0x91')][_0x9736('0x2f')]);_0x57cee3['query']=_[_0x9736('0x33')](_0x29e404['query']);_0x57cee3[_0x9736('0x3f')]=_['intersection'](_0x57cee3[_0x9736('0x34')],_0x57cee3['query']);_0x4cf350[_0x9736('0x36')]=_[_0x9736('0x37')](_0x57cee3[_0x9736('0x34')],qs[_0x9736('0x38')](_0x29e404['query'][_0x9736('0x38')]));_0x4cf350['attributes']=_0x4cf350[_0x9736('0x36')]['length']?_0x4cf350[_0x9736('0x36')]:_0x57cee3['model'];if(_0x29e404[_0x9736('0x35')][_0x9736('0xb8')]){_0x4cf350[_0x9736('0xb9')]=[{'all':!![]}];}_0x4cf350=_[_0x9736('0x90')]({},_0x4cf350,_0x29e404['options']);return db[_0x9736('0x91')][_0x9736('0x58')](_0x4cf350)[_0x9736('0x19')](handleEntityNotFound(_0x567a20,null))['then'](respondWithResult(_0x567a20,null))[_0x9736('0x2d')](handleError(_0x567a20,null));};exports[_0x9736('0xba')]=function(_0x4b73e5,_0x5ab883){return db[_0x9736('0x91')][_0x9736('0xba')](_0x4b73e5[_0x9736('0xbb')],{})[_0x9736('0x19')](respondWithResult(_0x5ab883,0xc9))[_0x9736('0x2d')](handleError(_0x5ab883,null));};exports[_0x9736('0x18')]=function(_0x2c7abc,_0x20e054){if(_0x2c7abc[_0x9736('0xbb')]['id']){delete _0x2c7abc['body']['id'];}return db[_0x9736('0x91')]['find']({'where':{'id':_0x2c7abc['params']['id']}})['then'](handleEntityNotFound(_0x20e054,null))[_0x9736('0x19')](saveUpdates(_0x2c7abc[_0x9736('0xbb')],null))[_0x9736('0x19')](respondWithResult(_0x20e054,null))[_0x9736('0x2d')](handleError(_0x20e054,null));};exports['destroy']=function(_0x2ded2a,_0x104c0e){return db[_0x9736('0x91')][_0x9736('0x58')]({'where':{'id':_0x2ded2a[_0x9736('0xb7')]['id']}})[_0x9736('0x19')](handleEntityNotFound(_0x104c0e,null))['then'](removeEntity(_0x104c0e,null))[_0x9736('0x2d')](handleError(_0x104c0e,null));};exports[_0x9736('0xbc')]=function(_0x450eed,_0x123d7d){return db[_0x9736('0x91')]['describe']()[_0x9736('0x19')](respondWithResult(_0x123d7d,null))[_0x9736('0x2d')](handleError(_0x123d7d,null));};exports['addMessage']=function(_0x50e493,_0x11fcd5){return db['MailMessage'][_0x9736('0x58')]({'where':{'id':_0x50e493[_0x9736('0xb7')]['id']}})[_0x9736('0x19')](handleEntityNotFound(_0x11fcd5,null))['then'](function(_0xefc52a){if(_0xefc52a){return _0xefc52a[_0x9736('0xbd')](_0x50e493['body'][_0x9736('0xbe')],_['omit'](_0x50e493[_0x9736('0xbb')],['ids','id'])||{});}})['then'](respondWithResult(_0x11fcd5,null))[_0x9736('0x2d')](handleError(_0x11fcd5,null));};exports[_0x9736('0xbf')]=function(_0x586408,_0x30fa54){var _0x25c1a2={'raw':![],'where':{}};var _0x48c6a3={};var _0x4b37e9={'count':0x0,'rows':[]};return db[_0x9736('0x91')][_0x9736('0x27')]({'where':{'id':_0x586408[_0x9736('0xb7')]['id']}})['then'](handleEntityNotFound(_0x30fa54,null))['then'](function(_0x3cbca6){if(_0x3cbca6){_0x48c6a3[_0x9736('0x34')]=_[_0x9736('0x33')](db[_0x9736('0x26')][_0x9736('0x2f')]);_0x48c6a3['query']=_[_0x9736('0x33')](_0x586408['query']);_0x48c6a3[_0x9736('0x3f')]=_[_0x9736('0x37')](_0x48c6a3[_0x9736('0x34')],_0x48c6a3[_0x9736('0x35')]);_0x25c1a2[_0x9736('0x36')]=_[_0x9736('0x37')](_0x48c6a3[_0x9736('0x34')],qs['fields'](_0x586408[_0x9736('0x35')]['fields']));_0x25c1a2[_0x9736('0x36')]=_0x25c1a2['attributes'][_0x9736('0x39')]?_0x25c1a2[_0x9736('0x36')]:_0x48c6a3[_0x9736('0x34')];if(!_0x586408[_0x9736('0x35')][_0x9736('0x3a')]('nolimit')){_0x25c1a2[_0x9736('0x13')]=qs['limit'](_0x586408[_0x9736('0x35')][_0x9736('0x13')]);_0x25c1a2[_0x9736('0x15')]=qs[_0x9736('0x15')](_0x586408[_0x9736('0x35')]['offset']);}_0x25c1a2[_0x9736('0x3c')]=qs[_0x9736('0x3d')](_0x586408[_0x9736('0x35')][_0x9736('0x3d')]);_0x25c1a2[_0x9736('0x3e')]=qs[_0x9736('0x3f')](_['pick'](_0x586408[_0x9736('0x35')],_0x48c6a3[_0x9736('0x3f')]));_0x25c1a2['where'][_0x9736('0xb1')]=_0x3cbca6['id'];if(_0x586408['query'][_0x9736('0x77')]){_0x25c1a2[_0x9736('0x3e')]=_['merge'](_0x25c1a2[_0x9736('0x3e')],{'$or':_['map'](_0x25c1a2['attributes'],function(_0x13c7d4){var _0x30f55c={};_0x30f55c[_0x13c7d4]={'$like':'%'+_0x586408[_0x9736('0x35')][_0x9736('0x77')]+'%'};return _0x30f55c;})});}if(_0x586408[_0x9736('0x35')][_0x9736('0x6d')]){var _0x363737=_0x586408[_0x9736('0x35')][_0x9736('0x6d')]['split'](',');var _0x18839d={};_0x18839d[_0x363737[0x0]]={'$gte':moment(_0x363737[0x1])[_0x9736('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x25c1a2[_0x9736('0x3e')]=_[_0x9736('0x90')](_0x25c1a2[_0x9736('0x3e')],_0x18839d);}_0x25c1a2=_[_0x9736('0x90')]({},_0x25c1a2,_0x586408[_0x9736('0xc1')]);return db[_0x9736('0x26')]['count']({'where':_0x25c1a2[_0x9736('0x3e')]})[_0x9736('0x19')](function(_0x3c02a2){_0x4b37e9[_0x9736('0x14')]=_0x3c02a2;if(_0x586408[_0x9736('0x35')][_0x9736('0xb8')]){_0x25c1a2[_0x9736('0xb9')]=[{'all':!![]}];}return db[_0x9736('0x26')][_0x9736('0xc2')](_0x25c1a2);})[_0x9736('0x19')](function(_0x3de4cf){if(_0x586408['query'][_0x9736('0xc3')]==='true'){for(var _0x4ec6c6=0x0;_0x4ec6c6<_0x3de4cf[_0x9736('0x39')];_0x4ec6c6++){_0x3de4cf[_0x4ec6c6][_0x9736('0xbb')]=juice(_0x3de4cf[_0x4ec6c6][_0x9736('0xbb')]);}}_0x4b37e9['rows']=_0x3de4cf;return _0x4b37e9;});}})[_0x9736('0x19')](respondWithFilteredResult(_0x30fa54,_0x25c1a2))['catch'](handleError(_0x30fa54,null));};exports[_0x9736('0xc4')]=function(_0x1598b9,_0x214558){return db[_0x9736('0x91')][_0x9736('0x58')]({'where':{'id':_0x1598b9[_0x9736('0xb7')]['id']}})[_0x9736('0x19')](handleEntityNotFound(_0x214558,null))[_0x9736('0x19')](function(_0x5a65fa){if(_0x5a65fa){return _0x5a65fa[_0x9736('0xc5')](_0x1598b9[_0x9736('0xbb')][_0x9736('0xbe')],_[_0x9736('0xc6')](_0x1598b9[_0x9736('0xbb')],['ids','id'])||{})[_0x9736('0xc7')](function(){return db[_0x9736('0x65')][_0x9736('0xc2')]({'attributes':['id','name',_0x9736('0x43')],'where':{'id':_0x1598b9['body'][_0x9736('0xbe')]}});})['then'](function(_0x7a47a4){socket[_0x9736('0xc8')]('mailInteractionTags:save',{'id':Number(_0x1598b9[_0x9736('0xb7')]['id']),'tags':_0x7a47a4||[]});return{'id':Number(_0x1598b9[_0x9736('0xb7')]['id']),'tags':_0x7a47a4||[]};});}})[_0x9736('0x19')](respondWithResult(_0x214558,null))[_0x9736('0x2d')](handleError(_0x214558,null));};exports['removeTags']=function(_0x2bdf78,_0x3eca33){return db[_0x9736('0x91')][_0x9736('0x58')]({'where':{'id':_0x2bdf78[_0x9736('0xb7')]['id']}})[_0x9736('0x19')](handleEntityNotFound(_0x3eca33,null))[_0x9736('0x19')](function(_0x115d02){if(_0x115d02){return _0x115d02[_0x9736('0xc9')](_0x2bdf78[_0x9736('0x35')][_0x9736('0xbe')]);}})[_0x9736('0x19')](respondWithStatusCode(_0x3eca33,null))[_0x9736('0x2d')](handleError(_0x3eca33,null));};exports[_0x9736('0xca')]=function(_0x46985f,_0x19744b){var _0x5ab3cb=moment()[_0x9736('0xcb')]()[_0x9736('0x8e')]();var _0x184325=path['join'](config['root'],_0x9736('0xcc'),_0x9736('0xcd'),_0x9736('0xce'));var _0x2c686c=path[_0x9736('0xcf')](config[_0x9736('0xd0')],_0x9736('0xcc'),'files',_0x9736('0xd1'));var _0x49bb7d=path['join'](_0x184325,_0x5ab3cb);var _0x59ecfc=util['format'](_0x9736('0xd2'),_0x46985f['params']['id'],_0x5ab3cb);var _0x4f53b=path[_0x9736('0xcf')](_0x184325,_0x59ecfc);var _0xb351d8=[];if(_0x46985f[_0x9736('0x35')][_0x9736('0xd1')]){_0xb351d8[_0x9736('0xb4')]({'model':db[_0x9736('0xd3')],'as':_0x9736('0xd4'),'raw':!![]});}var _0x4435f4=[{'model':db[_0x9736('0x26')],'as':_0x9736('0xd5'),'attributes':['id',_0x9736('0xbb'),_0x9736('0x44'),'to','cc',_0x9736('0xd6'),_0x9736('0xd7'),_0x9736('0xd8')],'where':{'secret':![]},'order':qs[_0x9736('0x3d')]('id'),'include':_0xb351d8}];return db[_0x9736('0x91')][_0x9736('0x58')]({'where':{'id':_0x46985f[_0x9736('0xb7')]['id']},'include':_0x4435f4})[_0x9736('0x19')](handleEntityNotFound(_0x19744b,null))[_0x9736('0x19')](function(_0x1b4d58){if(_0x1b4d58&&_0x1b4d58[_0x9736('0xd5')]){var _0x5baa35=_0x1b4d58[_0x9736('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x49bb7d);return BPromise[_0x9736('0xda')](_0x5baa35['Messages'],function(_0x7e1812,_0x40c188){var _0x75cb07={'from':_0x7e1812[_0x9736('0x44')],'to':_0x7e1812['to'],'subject':_0x7e1812[_0x9736('0xd7')],'html':htmlEntities['decode'](_0x7e1812[_0x9736('0xbb')]),'headers':{'Date':moment(_0x7e1812[_0x9736('0xd8')])['format'](_0x9736('0xdb'))},'attachments':[]};if(_0x7e1812['cc']){_0x75cb07[_0x9736('0xdc')]['Cc']=_0x7e1812['cc'];}if(_0x7e1812['bcc']){_0x75cb07[_0x9736('0xdc')][_0x9736('0xdd')]=_0x7e1812['bcc'];}return new BPromise(function(_0x2ce301,_0x53d91c){if(_0x7e1812[_0x9736('0xd4')]){for(var _0x2fe7c3=0x0;_0x2fe7c3<_0x7e1812[_0x9736('0xd4')][_0x9736('0x39')];_0x2fe7c3++){var _0x2182f4=_0x7e1812[_0x9736('0xd4')][_0x2fe7c3];var _0x11506a=path[_0x9736('0xcf')](_0x2c686c,_0x2182f4[_0x9736('0xde')]);if(fs[_0x9736('0xdf')](_0x11506a)){_0x75cb07[_0x9736('0xd1')]['push']({'name':_0x2182f4['name'],'contentType':_0x2182f4[_0x9736('0x31')],'data':fs[_0x9736('0xe0')](_0x11506a)});}}}emlformat['build'](_0x75cb07,function(_0x48b455,_0x2d2ae1){if(_0x48b455)return _0x53d91c(_0x48b455);fs[_0x9736('0xe1')](path['join'](_0x49bb7d,util['format'](_0x9736('0xe2'),_0x40c188)),_0x2d2ae1);return _0x2ce301(_0x2d2ae1);});});})[_0x9736('0x19')](function(){return new BPromise(function(_0x111ea0,_0x5ec7ce){zipdir(_0x49bb7d,{'saveTo':_0x4f53b},function(_0xf45589,_0x4e751c){if(_0xf45589)return _0x5ec7ce(_0xf45589);return _0x111ea0(_0x4e751c);});})[_0x9736('0x19')](function(){return new BPromise(function(_0x21bb78,_0x51aae3){rimraf(_0x49bb7d,function(_0x5a169d){if(_0x5a169d)_0x51aae3(_0x5a169d);return _0x21bb78();});});})[_0x9736('0x19')](function(){return _0x19744b[_0x9736('0xca')](_0x4f53b,_0x59ecfc,function(_0x500086){if(!_0x500086)fs['unlinkSync'](_0x4f53b);});});});}else{return _0x19744b[_0x9736('0xf')](0xc8);}})['catch'](handleError(_0x19744b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f735496..fba50d0 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 _0x1976=['../../mysqldb','MailInteraction','setMaxListeners','save','remove','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','hook','exports'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x1976,0x104));var _0x6197=function(_0x1750f8,_0x5d6d4e){_0x1750f8=_0x1750f8-0x0;var _0x56034b=_0x1976[_0x1750f8];return _0x56034b;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x6197('0x0'))['db'][_0x6197('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6197('0x2')](0x0);var events={'afterCreate':_0x6197('0x3'),'afterUpdate':'update','afterDestroy':_0x6197('0x4')};function emitEvent(_0x40826e){return function(_0x4dea29,_0x3763f9,_0x598d79){_0x4dea29['getUsers']({'attributes':['id'],'raw':!![]})[_0x6197('0x5')](function(_0x1acb21){_0x4dea29[_0x6197('0x6')]('Users',_0x1acb21['map'](function(_0x17758f){return{'id':_0x17758f['id']};}));return MailMessage[_0x6197('0x7')]({'where':{'MailInteractionId':_0x4dea29['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6197('0x5')](function(_0x28fb88){_0x4dea29[_0x6197('0x6')](_0x6197('0x8'),_0x28fb88['length']);MailInteractionEvents[_0x6197('0x9')](_0x40826e+':'+_0x4dea29['id'],_0x4dea29);MailInteractionEvents[_0x6197('0x9')](_0x40826e,_0x4dea29);_0x598d79(null);})['catch'](_0x598d79(null));};}for(var e in events){if(events[_0x6197('0xa')](e)){var event=events[e];MailInteraction[_0x6197('0xb')](e,emitEvent(event));}}module[_0x6197('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x734a=['setMaxListeners','save','update','then','Users','map','setDataValue','length','catch','hook','exports','events','MailInteraction','../../mysqldb','MailMessage'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x734a,0x83));var _0xa734=function(_0x3e0f20,_0x4c1204){_0x3e0f20=_0x3e0f20-0x0;var _0x4dc50e=_0x734a[_0x3e0f20];return _0x4dc50e;};'use strict';var EventEmitter=require(_0xa734('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xa734('0x1')];var MailMessage=require(_0xa734('0x2'))['db'][_0xa734('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa734('0x4')](0x0);var events={'afterCreate':_0xa734('0x5'),'afterUpdate':_0xa734('0x6'),'afterDestroy':'remove'};function emitEvent(_0x492126){return function(_0x181745,_0x56e48e,_0x120211){_0x181745['getUsers']({'attributes':['id'],'raw':!![]})[_0xa734('0x7')](function(_0x21dfa1){_0x181745['setDataValue'](_0xa734('0x8'),_0x21dfa1[_0xa734('0x9')](function(_0x141fed){return{'id':_0x141fed['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x181745['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa734('0x7')](function(_0x4b83e6){_0x181745[_0xa734('0xa')]('unreadMessages',_0x4b83e6[_0xa734('0xb')]);MailInteractionEvents['emit'](_0x492126+':'+_0x181745['id'],_0x181745);MailInteractionEvents['emit'](_0x492126,_0x181745);_0x120211(null);})[_0xa734('0xc')](_0x120211(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa734('0xd')](e,emitEvent(event));}}module[_0xa734('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b47d768..67573e3 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 _0xf9e8=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x3b545c,_0x491912){var _0xc9eb90=function(_0x35aeec){while(--_0x35aeec){_0x3b545c['push'](_0x3b545c['shift']());}};_0xc9eb90(++_0x491912);}(_0xf9e8,0x67));var _0x8f9e=function(_0x389a1a,_0x3046c0){_0x389a1a=_0x389a1a-0x0;var _0x45f466=_0xf9e8[_0x389a1a];return _0x45f466;};'use strict';var _=require(_0x8f9e('0x0'));var util=require(_0x8f9e('0x1'));var logger=require(_0x8f9e('0x2'))('api');var moment=require(_0x8f9e('0x3'));var BPromise=require(_0x8f9e('0x4'));var rp=require(_0x8f9e('0x5'));var fs=require('fs');var path=require(_0x8f9e('0x6'));var rimraf=require(_0x8f9e('0x7'));var config=require(_0x8f9e('0x8'));var attributes=require(_0x8f9e('0x9'));module[_0x8f9e('0xa')]=function(_0x5ece8e,_0x2ca854){return _0x5ece8e[_0x8f9e('0xb')](_0x8f9e('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x8f9e('0xd'),'fields':[_0x8f9e('0xe'),'to'],'type':_0x8f9e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e971d,_0x322b22,_0x15b96c){if(_0x2e971d[_0x8f9e('0x10')]){_0x2e971d['substatusAt']=moment()[_0x8f9e('0x11')](_0x8f9e('0x12'));}if(_0x2e971d[_0x8f9e('0x13')]){_0x2e971d[_0x8f9e('0x14')]=moment()[_0x8f9e('0x11')](_0x8f9e('0x12'));}_0x15b96c(null,_0x322b22);},'beforeUpdate':function(_0x5be108,_0x5b7182,_0x570efb){if(_0x5be108[_0x8f9e('0x15')](_0x8f9e('0x10'))){_0x5be108[_0x8f9e('0x16')]=_0x5be108[_0x8f9e('0x10')]?moment()[_0x8f9e('0x11')](_0x8f9e('0x12')):null;}if(_0x5be108['changed'](_0x8f9e('0x13'))){_0x5be108[_0x8f9e('0x14')]=moment()[_0x8f9e('0x11')](_0x8f9e('0x12'));_0x5be108['substatus']=null;_0x5be108[_0x8f9e('0x16')]=null;}_0x570efb(null,_0x5be108);},'afterUpdate':function(_0x13bafd,_0x5a174d,_0x14522f){var _0x534941=_0x5ece8e[_0x8f9e('0x17')];var _0x402177=_0x13bafd[_0x8f9e('0x18')]({'plain':!![]});if(_0x402177[_0x8f9e('0x13')]){return _0x534941[_0x8f9e('0x19')][_0x8f9e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x402177['id']}})[_0x8f9e('0x1b')](function(){_0x14522f();})['catch'](function(_0x5c2d44){_0x14522f(_0x5c2d44);});}else{_0x14522f();}}},'charset':_0x8f9e('0x1c'),'collate':_0x8f9e('0x1d')});}; \ No newline at end of file +var _0x4f64=['closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f64,0x1b3));var _0x44f6=function(_0x57b000,_0x214955){_0x57b000=_0x57b000-0x0;var _0x1c7fd5=_0x4f64[_0x57b000];return _0x1c7fd5;};'use strict';var _=require(_0x44f6('0x0'));var util=require(_0x44f6('0x1'));var logger=require(_0x44f6('0x2'))(_0x44f6('0x3'));var moment=require(_0x44f6('0x4'));var BPromise=require(_0x44f6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44f6('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x44f6('0x7')]=function(_0xb85975,_0xff33d4){return _0xb85975['define'](_0x44f6('0x8'),attributes,{'tableName':_0x44f6('0x9'),'paranoid':![],'indexes':[{'name':_0x44f6('0xa'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x317988,_0xb07ca7,_0x7ee67c){if(_0x317988[_0x44f6('0xb')]){_0x317988[_0x44f6('0xc')]=moment()[_0x44f6('0xd')](_0x44f6('0xe'));}if(_0x317988[_0x44f6('0xf')]){_0x317988[_0x44f6('0x10')]=moment()[_0x44f6('0xd')](_0x44f6('0xe'));}_0x7ee67c(null,_0xb07ca7);},'beforeUpdate':function(_0x15fd5b,_0x3937e2,_0x3747f7){if(_0x15fd5b['changed'](_0x44f6('0xb'))){_0x15fd5b[_0x44f6('0xc')]=_0x15fd5b[_0x44f6('0xb')]?moment()[_0x44f6('0xd')](_0x44f6('0xe')):null;}if(_0x15fd5b[_0x44f6('0x11')](_0x44f6('0xf'))){_0x15fd5b[_0x44f6('0x10')]=moment()[_0x44f6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x15fd5b[_0x44f6('0xb')]=null;_0x15fd5b[_0x44f6('0xc')]=null;}_0x3747f7(null,_0x15fd5b);},'afterUpdate':function(_0x4acc0c,_0x31dfe2,_0xc0e082){var _0x1c7eb6=_0xb85975[_0x44f6('0x12')];var _0x963484=_0x4acc0c[_0x44f6('0x13')]({'plain':!![]});if(_0x963484[_0x44f6('0xf')]){return _0x1c7eb6[_0x44f6('0x14')][_0x44f6('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x963484['id']}})[_0x44f6('0x16')](function(){_0xc0e082();})[_0x44f6('0x17')](function(_0x2f7d1e){_0xc0e082(_0x2f7d1e);});}else{_0xc0e082();}}},'charset':_0x44f6('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f4f673a..f295346 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 _0x4815=['ids','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','MailInteraction','update','body','options','raw','where','limit','UpdateMailInteraction','debug','AddTagsToMailInteraction','find','addTags'];(function(_0x4387a0,_0x1650ac){var _0x1184af=function(_0x4771a7){while(--_0x4771a7){_0x4387a0['push'](_0x4387a0['shift']());}};_0x1184af(++_0x1650ac);}(_0x4815,0xff));var _0x5481=function(_0x386e10,_0x12c92e){_0x386e10=_0x386e10-0x0;var _0x171c51=_0x4815[_0x386e10];return _0x171c51;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var moment=require(_0x5481('0x2'));var BPromise=require(_0x5481('0x3'));var rs=require(_0x5481('0x4'));var fs=require('fs');var Redis=require(_0x5481('0x5'));var db=require(_0x5481('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5481('0x7'));var config=require(_0x5481('0x8'));var jayson=require(_0x5481('0x9'));var client=jayson[_0x5481('0xa')][_0x5481('0xb')]({'port':0x232a});config[_0x5481('0xc')]=_[_0x5481('0xd')](config[_0x5481('0xc')],{'host':_0x5481('0xe'),'port':0x18eb});var socket=require(_0x5481('0xf'))(new Redis(config[_0x5481('0xc')]));require(_0x5481('0x10'))[_0x5481('0x11')](socket);function respondWithRpcPromise(_0x175606,_0x4529f5,_0x1447bf){return new BPromise(function(_0x4ba568,_0x4c484d){return client[_0x5481('0x12')](_0x175606,_0x1447bf)[_0x5481('0x13')](function(_0x46b6a3){logger[_0x5481('0x14')]('MailInteraction,\x20%s,\x20%s',_0x4529f5,_0x5481('0x15'));logger['debug'](_0x5481('0x16'),_0x4529f5,_0x5481('0x15'),JSON[_0x5481('0x17')](_0x46b6a3));if(_0x46b6a3['error']){if(_0x46b6a3[_0x5481('0x18')]['code']===0x1f4){logger[_0x5481('0x18')](_0x5481('0x19'),_0x4529f5,_0x46b6a3[_0x5481('0x18')][_0x5481('0x1a')]);return _0x4c484d(_0x46b6a3[_0x5481('0x18')][_0x5481('0x1a')]);}logger[_0x5481('0x18')](_0x5481('0x19'),_0x4529f5,_0x46b6a3[_0x5481('0x18')][_0x5481('0x1a')]);return _0x4ba568(_0x46b6a3['error'][_0x5481('0x1a')]);}else{logger[_0x5481('0x14')](_0x5481('0x19'),_0x4529f5,'request\x20sent');_0x4ba568(_0x46b6a3['result']['message']);}})['catch'](function(_0x3b3a11){logger[_0x5481('0x18')](_0x5481('0x19'),_0x4529f5,_0x3b3a11);_0x4c484d(_0x3b3a11);});});}exports['UpdateMailInteraction']=function(_0x59b071){var _0x5526e5=this;return new Promise(function(_0x2ec488,_0x277bd1){return db[_0x5481('0x1b')][_0x5481('0x1c')](_0x59b071[_0x5481('0x1d')],{'raw':_0x59b071[_0x5481('0x1e')]?_0x59b071[_0x5481('0x1e')][_0x5481('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b071[_0x5481('0x1e')]?_0x59b071[_0x5481('0x1e')][_0x5481('0x20')]||null:null,'attributes':_0x59b071['options']?_0x59b071[_0x5481('0x1e')]['attributes']||null:null,'limit':_0x59b071[_0x5481('0x1e')]?_0x59b071[_0x5481('0x1e')][_0x5481('0x21')]||null:null})[_0x5481('0x13')](function(_0x31ba21){logger[_0x5481('0x14')](_0x5481('0x22'),_0x59b071);logger[_0x5481('0x23')](_0x5481('0x22'),_0x59b071,JSON['stringify'](_0x31ba21));_0x2ec488(_0x31ba21);})['catch'](function(_0x2a1674){logger[_0x5481('0x18')]('UpdateMailInteraction',_0x2a1674[_0x5481('0x1a')],_0x59b071);_0x277bd1(_0x5526e5[_0x5481('0x18')](0x1f4,_0x2a1674[_0x5481('0x1a')]));});});};exports[_0x5481('0x24')]=function(_0x36c81a){return new Promise(function(_0x42291a,_0x235327){return db[_0x5481('0x1b')][_0x5481('0x25')]({'where':_0x36c81a['options']?_0x36c81a[_0x5481('0x1e')][_0x5481('0x20')]||null:null})[_0x5481('0x13')](function(_0x2218d3){if(_0x2218d3){return _0x2218d3[_0x5481('0x26')](_0x36c81a[_0x5481('0x1d')][_0x5481('0x27')],_['omit'](_0x36c81a[_0x5481('0x1d')],['ids','id'])||{});}})['spread'](function(_0x5c940a){logger[_0x5481('0x14')]('AddTags',_0x36c81a);logger[_0x5481('0x23')](_0x5481('0x28'),_0x36c81a,JSON[_0x5481('0x17')](_0x5c940a));_0x42291a(_0x5c940a);})[_0x5481('0x29')](function(_0x3d1737){logger[_0x5481('0x18')]('AddTags',_0x3d1737[_0x5481('0x1a')],_0x36c81a);_0x235327(_this[_0x5481('0x18')](0x1f4,_0x3d1737['message']));});});}; \ No newline at end of file +var _0x6838=['omit','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x6838,0x7b));var _0x8683=function(_0x266dab,_0x211142){_0x266dab=_0x266dab-0x0;var _0x2acc69=_0x6838[_0x266dab];return _0x2acc69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8683('0x0'));var BPromise=require(_0x8683('0x1'));var rs=require(_0x8683('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8683('0x3'))['db'];var utils=require(_0x8683('0x4'));var logger=require('../../config/logger')(_0x8683('0x5'));var config=require(_0x8683('0x6'));var jayson=require(_0x8683('0x7'));var client=jayson[_0x8683('0x8')][_0x8683('0x9')]({'port':0x232a});config[_0x8683('0xa')]=_[_0x8683('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8683('0xc'))(new Redis(config['redis']));require(_0x8683('0xd'))['register'](socket);function respondWithRpcPromise(_0x453604,_0x2e289a,_0x414a2f){return new BPromise(function(_0x297b70,_0x536cdf){return client[_0x8683('0xe')](_0x453604,_0x414a2f)[_0x8683('0xf')](function(_0x3461db){logger[_0x8683('0x10')](_0x8683('0x11'),_0x2e289a,_0x8683('0x12'));logger[_0x8683('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2e289a,_0x8683('0x12'),JSON[_0x8683('0x14')](_0x3461db));if(_0x3461db[_0x8683('0x15')]){if(_0x3461db[_0x8683('0x15')][_0x8683('0x16')]===0x1f4){logger[_0x8683('0x15')](_0x8683('0x11'),_0x2e289a,_0x3461db[_0x8683('0x15')][_0x8683('0x17')]);return _0x536cdf(_0x3461db[_0x8683('0x15')][_0x8683('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2e289a,_0x3461db[_0x8683('0x15')][_0x8683('0x17')]);return _0x297b70(_0x3461db[_0x8683('0x15')][_0x8683('0x17')]);}else{logger[_0x8683('0x10')](_0x8683('0x11'),_0x2e289a,'request\x20sent');_0x297b70(_0x3461db[_0x8683('0x18')][_0x8683('0x17')]);}})[_0x8683('0x19')](function(_0x351b2b){logger[_0x8683('0x15')](_0x8683('0x11'),_0x2e289a,_0x351b2b);_0x536cdf(_0x351b2b);});});}exports['UpdateMailInteraction']=function(_0xe6c26d){var _0x543b6f=this;return new Promise(function(_0x52ddd9,_0x4fbcee){return db[_0x8683('0x1a')][_0x8683('0x1b')](_0xe6c26d[_0x8683('0x1c')],{'raw':_0xe6c26d[_0x8683('0x1d')]?_0xe6c26d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe6c26d[_0x8683('0x1d')]?_0xe6c26d[_0x8683('0x1d')][_0x8683('0x1e')]||null:null,'attributes':_0xe6c26d[_0x8683('0x1d')]?_0xe6c26d[_0x8683('0x1d')][_0x8683('0x1f')]||null:null,'limit':_0xe6c26d[_0x8683('0x1d')]?_0xe6c26d[_0x8683('0x1d')][_0x8683('0x20')]||null:null})[_0x8683('0xf')](function(_0x450262){logger[_0x8683('0x10')]('UpdateMailInteraction',_0xe6c26d);logger[_0x8683('0x13')]('UpdateMailInteraction',_0xe6c26d,JSON[_0x8683('0x14')](_0x450262));_0x52ddd9(_0x450262);})[_0x8683('0x19')](function(_0x227125){logger[_0x8683('0x15')]('UpdateMailInteraction',_0x227125['message'],_0xe6c26d);_0x4fbcee(_0x543b6f[_0x8683('0x15')](0x1f4,_0x227125[_0x8683('0x17')]));});});};exports[_0x8683('0x21')]=function(_0x3b6e6c){return new Promise(function(_0x8eab9b,_0x246953){return db[_0x8683('0x1a')][_0x8683('0x22')]({'where':_0x3b6e6c[_0x8683('0x1d')]?_0x3b6e6c[_0x8683('0x1d')][_0x8683('0x1e')]||null:null})[_0x8683('0xf')](function(_0x42b5aa){if(_0x42b5aa){return _0x42b5aa[_0x8683('0x23')](_0x3b6e6c[_0x8683('0x1c')][_0x8683('0x24')],_[_0x8683('0x25')](_0x3b6e6c['body'],[_0x8683('0x24'),'id'])||{});}})[_0x8683('0x26')](function(_0x450240){logger[_0x8683('0x10')](_0x8683('0x27'),_0x3b6e6c);logger[_0x8683('0x13')](_0x8683('0x27'),_0x3b6e6c,JSON['stringify'](_0x450240));_0x8eab9b(_0x450240);})['catch'](function(_0x44e886){logger['error'](_0x8683('0x27'),_0x44e886[_0x8683('0x17')],_0x3b6e6c);_0x246953(_this[_0x8683('0x15')](0x1f4,_0x44e886[_0x8683('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index bf2e7ff..b5a3c34 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 _0xac1b=['save','remove','emit','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x1ddf04,_0xfdda4a){var _0x27710c=function(_0xafb9a9){while(--_0xafb9a9){_0x1ddf04['push'](_0x1ddf04['shift']());}};_0x27710c(++_0xfdda4a);}(_0xac1b,0x76));var _0xbac1=function(_0x3f72f5,_0xd33139){_0x3f72f5=_0x3f72f5-0x0;var _0x8da312=_0xac1b[_0x3f72f5];return _0x8da312;};'use strict';var MailInteractionEvents=require(_0xbac1('0x0'));var events=[_0xbac1('0x1'),_0xbac1('0x2'),'update'];function createListener(_0x5a53fe,_0x2ba354){return function(_0x48ac5f){_0x2ba354[_0xbac1('0x3')](_0x5a53fe,_0x48ac5f);};}function removeListener(_0x1be604,_0x178a12){return function(){MailInteractionEvents['removeListener'](_0x1be604,_0x178a12);};}exports[_0xbac1('0x4')]=function(_0x3eb266){for(var _0x54c93a=0x0,_0x112dba=events[_0xbac1('0x5')];_0x54c93a<_0x112dba;_0x54c93a++){var _0xb3fad3=events[_0x54c93a];var _0x2c0558=createListener(_0xbac1('0x6')+_0xb3fad3,_0x3eb266);MailInteractionEvents['on'](_0xb3fad3,_0x2c0558);}}; \ No newline at end of file +var _0xe640=['length','mailInteraction:','./mailInteraction.events','update','emit','removeListener'];(function(_0x5b0741,_0x438df7){var _0x3ee9c9=function(_0x4686d5){while(--_0x4686d5){_0x5b0741['push'](_0x5b0741['shift']());}};_0x3ee9c9(++_0x438df7);}(_0xe640,0xb6));var _0x0e64=function(_0x4d6dc1,_0x9b95c5){_0x4d6dc1=_0x4d6dc1-0x0;var _0x4dc33a=_0xe640[_0x4d6dc1];return _0x4dc33a;};'use strict';var MailInteractionEvents=require(_0x0e64('0x0'));var events=['save','remove',_0x0e64('0x1')];function createListener(_0x19f9f1,_0x948ff8){return function(_0x3f57c7){_0x948ff8[_0x0e64('0x2')](_0x19f9f1,_0x3f57c7);};}function removeListener(_0x135ee3,_0xfee233){return function(){MailInteractionEvents[_0x0e64('0x3')](_0x135ee3,_0xfee233);};}exports['register']=function(_0x4e0257){for(var _0x2bd46f=0x0,_0x58f424=events[_0x0e64('0x4')];_0x2bd46f<_0x58f424;_0x2bd46f++){var _0x47b224=events[_0x2bd46f];var _0x2aa45d=createListener(_0x0e64('0x5')+_0x47b224,_0x4e0257);MailInteractionEvents['on'](_0x47b224,_0x2aa45d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 471aa31..aa7d605 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 _0xe920=['get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0xe920,0xbe));var _0x0e92=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xe920[_0x40822a];return _0x357420;};'use strict';var multer=require(_0x0e92('0x0'));var util=require(_0x0e92('0x1'));var path=require(_0x0e92('0x2'));var timeout=require(_0x0e92('0x3'));var express=require(_0x0e92('0x4'));var router=express[_0x0e92('0x5')]();var fs_extra=require(_0x0e92('0x6'));var auth=require(_0x0e92('0x7'));var interaction=require(_0x0e92('0x8'));var config=require(_0x0e92('0x9'));var controller=require('./mailMessage.controller');router[_0x0e92('0xa')]('/',auth['isAuthenticated'](),controller[_0x0e92('0xb')]);router[_0x0e92('0xa')](_0x0e92('0xc'),auth[_0x0e92('0xd')](),controller['describe']);router[_0x0e92('0xa')](_0x0e92('0xe'),auth[_0x0e92('0xd')](),controller[_0x0e92('0xf')]);router[_0x0e92('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x0e92('0x10')]('/',auth[_0x0e92('0xd')](),interaction['tracked']('mail','mailmessage:create'),controller[_0x0e92('0x11')]);router[_0x0e92('0x12')]('/:id',auth[_0x0e92('0xd')](),controller[_0x0e92('0x13')]);router['put'](_0x0e92('0x14'),auth[_0x0e92('0xd')](),controller[_0x0e92('0x15')]);router[_0x0e92('0x12')](_0x0e92('0x16'),auth[_0x0e92('0xd')](),controller[_0x0e92('0x17')]);router['delete']('/:id',auth[_0x0e92('0xd')](),controller[_0x0e92('0x18')]);module['exports']=router; \ No newline at end of file +var _0x559a=['accept','reject','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','tracked','mail','create','update','put','/:id/accept'];(function(_0xbd1583,_0x230802){var _0x47ca99=function(_0x4458cc){while(--_0x4458cc){_0xbd1583['push'](_0xbd1583['shift']());}};_0x47ca99(++_0x230802);}(_0x559a,0xb3));var _0xa559=function(_0x3fbd2c,_0x259c90){_0x3fbd2c=_0x3fbd2c-0x0;var _0x321d89=_0x559a[_0x3fbd2c];return _0x321d89;};'use strict';var multer=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var path=require('path');var timeout=require(_0xa559('0x2'));var express=require(_0xa559('0x3'));var router=express[_0xa559('0x4')]();var fs_extra=require(_0xa559('0x5'));var auth=require(_0xa559('0x6'));var interaction=require(_0xa559('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xa559('0x8')]('/',auth[_0xa559('0x9')](),controller['index']);router[_0xa559('0x8')](_0xa559('0xa'),auth['isAuthenticated'](),controller[_0xa559('0xb')]);router[_0xa559('0x8')](_0xa559('0xc'),auth[_0xa559('0x9')](),controller['show']);router[_0xa559('0x8')](_0xa559('0xd'),auth[_0xa559('0x9')](),controller[_0xa559('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa559('0xf')](_0xa559('0x10'),'mailmessage:create'),controller[_0xa559('0x11')]);router['put'](_0xa559('0xc'),auth['isAuthenticated'](),controller[_0xa559('0x12')]);router[_0xa559('0x13')](_0xa559('0x14'),auth['isAuthenticated'](),controller[_0xa559('0x15')]);router[_0xa559('0x13')]('/:id/reject',auth[_0xa559('0x9')](),controller[_0xa559('0x16')]);router[_0xa559('0x17')](_0xa559('0xc'),auth['isAuthenticated'](),controller[_0xa559('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8e105bc..3307ae9 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 _0x1745=['BOOLEAN','ENUM','out','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1745,0x133));var _0x5174=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1745[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x5174('0x0'));var _=require(_0x5174('0x1'));module[_0x5174('0x2')]={'body':{'type':Sequelize[_0x5174('0x3')](_0x5174('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5174('0x3')]('medium')},'read':{'type':Sequelize[_0x5174('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5174('0x6')]('in','out'),'defaultValue':_0x5174('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x5174('0x3')](_0x5174('0x4'))},'cc':{'type':Sequelize[_0x5174('0x3')]('long')},'bcc':{'type':Sequelize[_0x5174('0x3')]('long')},'subject':{'type':Sequelize[_0x5174('0x3')]},'sentAt':{'type':Sequelize[_0x5174('0x8')]},'attach':{'type':Sequelize[_0x5174('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5174('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5174('0x3')]('long')},'originCc':{'type':Sequelize[_0x5174('0x3')](_0x5174('0x4'))},'originChannel':{'type':Sequelize[_0x5174('0x6')](_0x5174('0xa'),_0x5174('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x4d56=['STRING','DATE','INTEGER','BOOLEAN','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','ENUM'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x4d56,0x117));var _0x64d5=function(_0x2bc9c2,_0x1dbaed){_0x2bc9c2=_0x2bc9c2-0x0;var _0x151c8b=_0x4d56[_0x2bc9c2];return _0x151c8b;};'use strict';var Sequelize=require(_0x64d5('0x0'));var _=require(_0x64d5('0x1'));module[_0x64d5('0x2')]={'body':{'type':Sequelize[_0x64d5('0x3')](_0x64d5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x64d5('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x64d5('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x64d5('0x7')](0x1fe)},'from':{'type':Sequelize[_0x64d5('0x7')]},'to':{'type':Sequelize[_0x64d5('0x3')]('long')},'cc':{'type':Sequelize[_0x64d5('0x3')](_0x64d5('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x64d5('0x3')]},'sentAt':{'type':Sequelize[_0x64d5('0x8')]},'attach':{'type':Sequelize[_0x64d5('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x64d5('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x64d5('0x8')]},'originTo':{'type':Sequelize[_0x64d5('0x3')](_0x64d5('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x64d5('0x4'))},'originChannel':{'type':Sequelize[_0x64d5('0x6')]('Email',_0x64d5('0xb')),'defaultValue':_0x64d5('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5f0d478..27d14ee 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 _0x74e9=['ioredis','html-to-text','api','../../config/environment','../../mysqldb','redis','defaults','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','MailMessage','fieldName','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','params','fields','length','includeAll','find','body','describe','create','out','split','MailAccount','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','readAt','UserId','agent','get','MailInteraction','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','interface','SIP/%s','channel','event','accept','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','internal','rejectmessage','download','unix','toString','files','message-%s.eml','from','bcc','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','eml-format','bluebird','path','lodash'];(function(_0xc5775d,_0x3701ab){var _0x3b4edd=function(_0x37c3cb){while(--_0x37c3cb){_0xc5775d['push'](_0xc5775d['shift']());}};_0x3b4edd(++_0x3701ab);}(_0x74e9,0x12a));var _0x974e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74e9[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x974e('0x0'));var moment=require('moment');var BPromise=require(_0x974e('0x1'));var util=require('util');var path=require(_0x974e('0x2'));var fs=require('fs');var _=require(_0x974e('0x3'));var Redis=require(_0x974e('0x4'));var htmlToText=require(_0x974e('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x974e('0x6'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x974e('0x7'));var db=require(_0x974e('0x8'))['db'];config[_0x974e('0x9')]=_[_0x974e('0xa')](config[_0x974e('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x974e('0x9')]));var htmlEntities=require('html-entities');require(_0x974e('0xb'))[_0x974e('0xc')](socket);var jayson=require(_0x974e('0xd'));var client=jayson[_0x974e('0xe')][_0x974e('0xf')]({'port':0x232c});var client9003=jayson[_0x974e('0xe')][_0x974e('0xf')]({'port':0x232b});var client9002=jayson[_0x974e('0xe')][_0x974e('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x113ead,_0x2b79af,_0x24366f,_0x2a9e07){return new BPromise(function(_0x298458,_0x339d04){var _0x42d359=_0x2a9e07||client;return _0x42d359[_0x974e('0x10')](_0x113ead,_0x24366f)[_0x974e('0x11')](function(_0x3af5ca){logger[_0x974e('0x12')](_0x974e('0x13'),_0x2b79af,_0x974e('0x14'));logger[_0x974e('0x15')](_0x974e('0x16'),_0x2b79af,_0x974e('0x14'),JSON[_0x974e('0x17')](_0x3af5ca));if(_0x3af5ca[_0x974e('0x18')]){if(_0x3af5ca[_0x974e('0x18')][_0x974e('0x19')]===0x1f4){logger[_0x974e('0x18')](_0x974e('0x13'),_0x2b79af,_0x3af5ca[_0x974e('0x18')][_0x974e('0x1a')]);return _0x339d04(_0x3af5ca['error'][_0x974e('0x1a')]);}logger[_0x974e('0x18')](_0x974e('0x13'),_0x2b79af,_0x3af5ca[_0x974e('0x18')]['message']);return _0x298458(_0x3af5ca[_0x974e('0x18')][_0x974e('0x1a')]);}else{logger[_0x974e('0x12')](_0x974e('0x13'),_0x2b79af,'request\x20sent');_0x298458(_0x3af5ca[_0x974e('0x1b')][_0x974e('0x1a')]);}})[_0x974e('0x1c')](function(_0x3da0d6){logger[_0x974e('0x18')](_0x974e('0x13'),_0x2b79af,_0x3da0d6);_0x339d04(_0x3da0d6);});});}function respondWithResult(_0x5231ca,_0x43ad29){_0x43ad29=_0x43ad29||0xc8;return function(_0x2707a7){if(_0x2707a7){return _0x5231ca[_0x974e('0x1d')](_0x43ad29)[_0x974e('0x1e')](_0x2707a7);}};}function respondWithFilteredResult(_0x9f79a1,_0x4aa3d8){return function(_0x2a3e9f){if(_0x2a3e9f){var _0x5a049b=typeof _0x4aa3d8[_0x974e('0x1f')]===_0x974e('0x20')&&typeof _0x4aa3d8[_0x974e('0x21')]===_0x974e('0x20');var _0x6a23dd=_0x2a3e9f[_0x974e('0x22')];var _0x55e2d5=_0x5a049b?0x0:_0x4aa3d8[_0x974e('0x1f')];var _0x557e19=_0x5a049b?_0x2a3e9f[_0x974e('0x22')]:_0x4aa3d8[_0x974e('0x1f')]+_0x4aa3d8[_0x974e('0x21')];var _0xc8659b;if(_0x557e19>=_0x6a23dd){_0x557e19=_0x6a23dd;_0xc8659b=0xc8;}else{_0xc8659b=0xce;}_0x9f79a1[_0x974e('0x1d')](_0xc8659b);return _0x9f79a1[_0x974e('0x23')](_0x974e('0x24'),_0x55e2d5+'-'+_0x557e19+'/'+_0x6a23dd)[_0x974e('0x1e')](_0x2a3e9f);}return null;};}function saveUpdates(_0x56446d){return function(_0x50225e){if(_0x50225e){return _0x50225e[_0x974e('0x25')](_0x56446d)['then'](function(_0x271b73){return _0x271b73;});}return null;};}function removeEntity(_0x4bda1c){return function(_0x44fccd){if(_0x44fccd){return _0x44fccd[_0x974e('0x26')]()['then'](function(){_0x4bda1c['status'](0xcc)[_0x974e('0x27')]();});}};}function handleEntityNotFound(_0x4069e3){return function(_0x17a478){if(!_0x17a478){_0x4069e3[_0x974e('0x28')](0x194);}return _0x17a478;};}function handleError(_0x2d3404,_0x5c730d){_0x5c730d=_0x5c730d||0x1f4;return function(_0x28132a){logger[_0x974e('0x18')](_0x28132a['stack']);if(_0x28132a[_0x974e('0x29')]){delete _0x28132a[_0x974e('0x29')];}_0x2d3404['status'](_0x5c730d)[_0x974e('0x2a')](_0x28132a);};}exports[_0x974e('0x2b')]=function(_0x5898c6,_0x294edc){var _0x78201e={},_0x3dfd53={},_0xf70260={'count':0x0,'rows':[]};var _0xe88876=_[_0x974e('0x2c')](db[_0x974e('0x2d')]['rawAttributes'],function(_0x407ad2){return{'name':_0x407ad2[_0x974e('0x2e')],'type':_0x407ad2['type'][_0x974e('0x2f')]};});_0x3dfd53[_0x974e('0x30')]=_[_0x974e('0x2c')](_0xe88876,_0x974e('0x29'));_0x3dfd53['query']=_[_0x974e('0x31')](_0x5898c6[_0x974e('0x32')]);_0x3dfd53[_0x974e('0x33')]=_[_0x974e('0x34')](_0x3dfd53[_0x974e('0x30')],_0x3dfd53[_0x974e('0x32')]);_0x78201e[_0x974e('0x35')]=_[_0x974e('0x34')](_0x3dfd53['model'],qs['fields'](_0x5898c6['query']['fields']));_0x78201e['attributes']=_0x78201e['attributes']['length']?_0x78201e[_0x974e('0x35')]:_0x3dfd53[_0x974e('0x30')];if(!_0x5898c6[_0x974e('0x32')][_0x974e('0x36')]('nolimit')){_0x78201e[_0x974e('0x21')]=qs['limit'](_0x5898c6[_0x974e('0x32')][_0x974e('0x21')]);_0x78201e[_0x974e('0x1f')]=qs[_0x974e('0x1f')](_0x5898c6['query'][_0x974e('0x1f')]);}_0x78201e[_0x974e('0x37')]=qs[_0x974e('0x38')](_0x5898c6[_0x974e('0x32')][_0x974e('0x38')]);_0x78201e['where']=qs[_0x974e('0x33')](_[_0x974e('0x39')](_0x5898c6[_0x974e('0x32')],_0x3dfd53[_0x974e('0x33')]),_0xe88876);if(_0x5898c6[_0x974e('0x32')][_0x974e('0x3a')]){_0x78201e[_0x974e('0x3b')]=_['merge'](_0x78201e[_0x974e('0x3b')],{'$or':_['map'](_0xe88876,function(_0x2d7636){if(_0x2d7636[_0x974e('0x3c')]!==_0x974e('0x3d')){var _0x3ed610={};_0x3ed610[_0x2d7636[_0x974e('0x29')]]={'$like':'%'+_0x5898c6[_0x974e('0x32')][_0x974e('0x3a')]+'%'};return _0x3ed610;}})});}_0x78201e=_[_0x974e('0x3e')]({},_0x78201e,_0x5898c6[_0x974e('0x3f')]);var _0x2f8ef4={'where':_0x78201e[_0x974e('0x3b')]};return db[_0x974e('0x2d')][_0x974e('0x22')](_0x2f8ef4)[_0x974e('0x11')](function(_0x4546e0){_0xf70260['count']=_0x4546e0;if(_0x5898c6['query']['includeAll']){_0x78201e[_0x974e('0x40')]=[{'all':!![]}];}return db[_0x974e('0x2d')][_0x974e('0x41')](_0x78201e);})[_0x974e('0x11')](function(_0x57abed){_0xf70260['rows']=_0x57abed;return _0xf70260;})['then'](respondWithFilteredResult(_0x294edc,_0x78201e))[_0x974e('0x1c')](handleError(_0x294edc,null));};exports['show']=function(_0x4287c6,_0xe5c1c0){var _0x63ee2a={'raw':!![],'where':{'id':_0x4287c6[_0x974e('0x42')]['id']}},_0x46ea8d={};_0x46ea8d['model']=_[_0x974e('0x31')](db['MailMessage']['rawAttributes']);_0x46ea8d['query']=_[_0x974e('0x31')](_0x4287c6[_0x974e('0x32')]);_0x46ea8d['filters']=_[_0x974e('0x34')](_0x46ea8d[_0x974e('0x30')],_0x46ea8d['query']);_0x63ee2a[_0x974e('0x35')]=_[_0x974e('0x34')](_0x46ea8d['model'],qs[_0x974e('0x43')](_0x4287c6[_0x974e('0x32')][_0x974e('0x43')]));_0x63ee2a[_0x974e('0x35')]=_0x63ee2a[_0x974e('0x35')][_0x974e('0x44')]?_0x63ee2a[_0x974e('0x35')]:_0x46ea8d['model'];if(_0x4287c6['query'][_0x974e('0x45')]){_0x63ee2a[_0x974e('0x40')]=[{'all':!![]}];}_0x63ee2a=_['merge']({},_0x63ee2a,_0x4287c6[_0x974e('0x3f')]);return db[_0x974e('0x2d')][_0x974e('0x46')](_0x63ee2a)[_0x974e('0x11')](handleEntityNotFound(_0xe5c1c0,null))[_0x974e('0x11')](respondWithResult(_0xe5c1c0,null))[_0x974e('0x1c')](handleError(_0xe5c1c0,null));};exports[_0x974e('0x25')]=function(_0x4fdb9f,_0x20b80a){if(_0x4fdb9f[_0x974e('0x47')]['id']){delete _0x4fdb9f[_0x974e('0x47')]['id'];}return db[_0x974e('0x2d')][_0x974e('0x46')]({'where':{'id':_0x4fdb9f[_0x974e('0x42')]['id']}})['then'](handleEntityNotFound(_0x20b80a,null))[_0x974e('0x11')](saveUpdates(_0x4fdb9f['body'],null))['then'](respondWithResult(_0x20b80a,null))['catch'](handleError(_0x20b80a,null));};exports[_0x974e('0x26')]=function(_0x40e9f6,_0x25cf49){return db[_0x974e('0x2d')][_0x974e('0x46')]({'where':{'id':_0x40e9f6['params']['id']}})['then'](handleEntityNotFound(_0x25cf49,null))[_0x974e('0x11')](removeEntity(_0x25cf49,null))[_0x974e('0x1c')](handleError(_0x25cf49,null));};exports[_0x974e('0x48')]=function(_0x36f7a9,_0x50a2de){return db[_0x974e('0x2d')]['describe']()['then'](respondWithResult(_0x50a2de,null))[_0x974e('0x1c')](handleError(_0x50a2de,null));};exports[_0x974e('0x49')]=function(_0x1dcf16,_0x191760){return db[_0x974e('0x2d')][_0x974e('0x49')](_0x1dcf16[_0x974e('0x47')])[_0x974e('0x11')](function(_0x2571fe){if(_0x2571fe){if(_0x2571fe['direction']===_0x974e('0x4a')&&!_0x2571fe['secret']){var _0x12995f,_0x2de859,_0x1fbde4;if(_0x1dcf16[_0x974e('0x47')]['to']){_0x2de859=_0x1dcf16['body']['to'][_0x974e('0x4b')](',')[0x0];}return db[_0x974e('0x4c')]['findOne']({'where':{'id':_0x2571fe[_0x974e('0x4d')]},'include':[{'model':db['CmList'],'as':_0x974e('0x4e'),'include':[{'model':db[_0x974e('0x4f')],'as':_0x974e('0x50'),'where':{'email':_0x2de859},'limit':0x1,'order':[[_0x974e('0x51'),_0x974e('0x52')]]}]},{'model':db['MailServerOut'],'as':_0x974e('0x53'),'raw':!![]}]})[_0x974e('0x11')](function(_0x3258cd){_0x12995f=_0x3258cd;if(_0x12995f&&_0x12995f[_0x974e('0x53')]){var _0x4d963c={'tls':{'rejectUnauthorized':![]}};if(_[_0x974e('0x54')](_0x12995f[_0x974e('0x53')][_0x974e('0x55')])){_0x4d963c[_0x974e('0x56')]=_0x12995f[_0x974e('0x53')][_0x974e('0x56')];_0x4d963c['port']=_0x12995f[_0x974e('0x53')][_0x974e('0x57')];_0x4d963c[_0x974e('0x58')]=_0x12995f[_0x974e('0x53')]['secure'];if(_0x12995f[_0x974e('0x53')][_0x974e('0x59')]){_0x4d963c[_0x974e('0x5a')]={'user':_0x12995f['Smtp'][_0x974e('0x5b')],'pass':_0x12995f[_0x974e('0x53')][_0x974e('0x5c')]};}}else{_0x4d963c['service']=_0x12995f[_0x974e('0x53')][_0x974e('0x55')];_0x4d963c[_0x974e('0x5a')]={'user':_0x12995f[_0x974e('0x53')][_0x974e('0x5b')],'pass':_0x12995f[_0x974e('0x53')][_0x974e('0x5c')]};_0x4d963c[_0x974e('0x58')]=_0x12995f['Smtp']['secure'];}if(_0x1dcf16[_0x974e('0x47')][_0x974e('0x5d')]&&_0x1dcf16[_0x974e('0x47')]['attachments']['length']){for(var _0x18fd70=0x0;_0x18fd70<_0x1dcf16[_0x974e('0x47')]['attachments'][_0x974e('0x44')];_0x18fd70+=0x1){_0x1dcf16['body'][_0x974e('0x5d')][_0x18fd70]={'filename':_0x1dcf16[_0x974e('0x47')][_0x974e('0x5d')][_0x18fd70][_0x974e('0x29')],'path':path[_0x974e('0x5e')](config[_0x974e('0x5f')],_0x974e('0x60'),_0x1dcf16[_0x974e('0x47')][_0x974e('0x5d')][_0x18fd70]['basename'])};}}_0x1fbde4={'account':_0x4d963c,'message':_0x1dcf16[_0x974e('0x47')]};return;}})[_0x974e('0x11')](function(){if(_0x12995f['List']){if(_0x12995f[_0x974e('0x4e')][_0x974e('0x50')][_0x974e('0x44')]){return _0x12995f[_0x974e('0x4e')]['Contacts'][0x0];}else{return db[_0x974e('0x4f')]['create'](_[_0x974e('0xa')](_0x1dcf16['body'],{'firstName':_0x1dcf16['body']['to'],'email':_0x1dcf16[_0x974e('0x47')]['to'],'phone':_0x1dcf16[_0x974e('0x47')]['to'],'ListId':_0x12995f['ListId']}));}}else{throw new Error(_0x974e('0x61'));}})[_0x974e('0x11')](function(){if(_0x1fbde4){return respondWithRpcPromise('SendMail','sendMail',_0x1fbde4,client9003)[_0x974e('0x11')](function(_0x543c7b){return _0x2571fe['update']({'read':!![],'messageId':_0x543c7b[_0x974e('0x62')],'sentAt':moment()[_0x974e('0x63')](_0x974e('0x64'))});})[_0x974e('0x1c')](function(_0x567c38){logger['error']('%s',JSON['stringify'](_0x567c38));return _0x2571fe;});}return _0x2571fe;});}return _0x2571fe;}})[_0x974e('0x11')](respondWithResult(_0x191760,0xc9))[_0x974e('0x1c')](handleError(_0x191760,null));};exports['accept']=function(_0x13fa8b,_0xfcda77){var _0x2dc0e5={'agent':{},'channel':'mail'};if(_0x13fa8b[_0x974e('0x47')]['id']){delete _0x13fa8b[_0x974e('0x47')]['id'];}_0x13fa8b[_0x974e('0x47')][_0x974e('0x65')]=!![];_0x13fa8b[_0x974e('0x47')][_0x974e('0x66')]=moment()[_0x974e('0x63')](_0x974e('0x64'));_0x13fa8b['body'][_0x974e('0x67')]=_0x13fa8b[_0x974e('0x47')][_0x974e('0x67')]||_0x13fa8b[_0x974e('0x5b')]['id'];_0x2dc0e5[_0x974e('0x68')]['id']=_0x13fa8b[_0x974e('0x47')]['UserId'];return db[_0x974e('0x2d')]['find']({'where':{'id':_0x13fa8b[_0x974e('0x42')]['id'],'UserId':null}})[_0x974e('0x11')](handleEntityNotFound(_0xfcda77,null))[_0x974e('0x11')](saveUpdates(_0x13fa8b[_0x974e('0x47')],null))[_0x974e('0x11')](function(_0x15a135){if(_0x15a135){_0x2dc0e5['message']=_0x15a135[_0x974e('0x69')]({'plain':!![]});return db[_0x974e('0x6a')][_0x974e('0x46')]({'where':{'id':_0x15a135['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xfcda77,null))[_0x974e('0x11')](function(_0xfa37a6){if(_0xfa37a6){return _0xfa37a6['update']({'UserId':_0x13fa8b['body'][_0x974e('0x67')],'read1stAt':_[_0x974e('0x54')](_0xfa37a6['read1stAt'])?moment()[_0x974e('0x63')](_0x974e('0x64')):undefined});}return null;})[_0x974e('0x11')](function(_0x442bd7){if(_0x442bd7){_0x2dc0e5[_0x974e('0x6b')]=_0x442bd7[_0x974e('0x69')]({'plain':!![]});interaction_log['info'](_0x974e('0x6c'),_0x13fa8b['user']['id'],_0x13fa8b[_0x974e('0x5b')]['name'],_0x13fa8b[_0x974e('0x5b')][_0x974e('0x6d')],_0x2dc0e5[_0x974e('0x6b')]['id'],_0x13fa8b[_0x974e('0x47')]?JSON[_0x974e('0x17')](_0x13fa8b[_0x974e('0x47')]):_0x974e('0x6e'));return respondWithRpcPromise(_0x974e('0x6f'),_0x974e('0x70'),_0x2dc0e5);}return null;})['then'](function(_0x273bd8){var _0x2d7a17=_0x974e('0x71')+_0x273bd8['message']['ContactId'];return db[_0x974e('0x72')]['query'](_0x2d7a17,{'type':db[_0x974e('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0x974e('0x11')](function(_0x3e8a61){return _0x3e8a61;});})['then'](function(_0x2b0aef){if(_0x2b0aef){_0x2dc0e5[_0x974e('0x1a')][_0x974e('0x74')]=_0x2b0aef[0x0];if(!_0x13fa8b[_0x974e('0x47')][_0x974e('0x67')])return;return db[_0x974e('0x75')][_0x974e('0x46')]({'where':{'id':_0x13fa8b['body'][_0x974e('0x67')],'role':'agent'},'attributes':['id',_0x974e('0x29'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x974e('0x11')](function(_0x5e6680){if(!_0x5e6680)return null;_0x2dc0e5[_0x974e('0x1a')][_0x974e('0x68')]=_0x5e6680;return _0x2dc0e5;})[_0x974e('0x11')](function(_0x2827a8){if(_0x2827a8){if(_0x13fa8b[_0x974e('0x47')]['manual']){_0x2dc0e5[_0x974e('0x1a')][_0x974e('0x76')]=util[_0x974e('0x63')](_0x974e('0x77'),_0x13fa8b[_0x974e('0x5b')][_0x974e('0x29')]);_0x2dc0e5[_0x974e('0x1a')][_0x974e('0x78')]=_0x2dc0e5['channel'];_0x2dc0e5[_0x974e('0x1a')]['motionChannel']=_0x2dc0e5['channel'];_0x2dc0e5[_0x974e('0x1a')][_0x974e('0x79')]=_0x974e('0x7a');_0x2dc0e5[_0x974e('0x1a')][_0x974e('0x47')]=htmlToText[_0x974e('0x7b')](_0x2dc0e5['message'][_0x974e('0x47')]);return respondWithRpcPromise(_0x974e('0x7c'),'EventManager',{'event':_0x974e('0x7d'),'message':_0x2dc0e5[_0x974e('0x1a')]},client9002)[_0x974e('0x11')](function(){return _0x2dc0e5;});}return _0x2dc0e5;}return null;})['then'](respondWithResult(_0xfcda77,null))[_0x974e('0x1c')](handleError(_0xfcda77,null));};exports[_0x974e('0x7e')]=function(_0x4f59d9,_0x21d10c){var _0x4ebf89={'agent':{},'channel':'mail'};if(_0x4f59d9[_0x974e('0x47')]['id']){delete _0x4f59d9[_0x974e('0x47')]['id'];}_0x4f59d9[_0x974e('0x47')][_0x974e('0x67')]=_0x4f59d9[_0x974e('0x47')][_0x974e('0x67')]||_0x4f59d9['user']['id'];_0x4ebf89['agent']['id']=_0x4f59d9[_0x974e('0x47')]['UserId'];return db[_0x974e('0x2d')][_0x974e('0x46')]({'where':{'id':_0x4f59d9['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x21d10c,null))['then'](function(_0x5f5c74){if(_0x5f5c74){_0x4ebf89[_0x974e('0x1a')]=_0x5f5c74[_0x974e('0x69')]({'plain':!![]});return db[_0x974e('0x6a')]['find']({'where':{'id':_0x5f5c74[_0x974e('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x21d10c,null))[_0x974e('0x11')](function(_0x25d2f0){if(_0x25d2f0){_0x4ebf89[_0x974e('0x6b')]=_0x25d2f0[_0x974e('0x69')]({'plain':!![]});interaction_log[_0x974e('0x12')](_0x974e('0x80'),_0x4f59d9[_0x974e('0x5b')]['id'],_0x4f59d9['user'][_0x974e('0x29')],_0x4f59d9[_0x974e('0x5b')][_0x974e('0x6d')],_0x4ebf89[_0x974e('0x6b')]['id'],_0x4f59d9[_0x974e('0x47')]?JSON['stringify'](_0x4f59d9[_0x974e('0x47')]):'null');return respondWithRpcPromise(_0x974e('0x81'),_0x974e('0x82'),_0x4ebf89);}return null;})[_0x974e('0x11')](function(_0x2d75cf){var _0x554983='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d75cf[_0x974e('0x1a')]['ContactId'];return db[_0x974e('0x72')][_0x974e('0x32')](_0x554983,{'type':db[_0x974e('0x73')]['QueryTypes'][_0x974e('0x83')],'raw':!![]})['then'](function(_0x35c3f0){return _0x35c3f0;});})[_0x974e('0x11')](function(_0xdde82f){if(_0xdde82f){_0x4ebf89[_0x974e('0x1a')]['contact']=_0xdde82f[0x0];if(!_0x4f59d9[_0x974e('0x47')][_0x974e('0x67')])return;return db[_0x974e('0x75')][_0x974e('0x46')]({'where':{'id':_0x4f59d9[_0x974e('0x47')][_0x974e('0x67')],'role':_0x974e('0x68')},'attributes':['id',_0x974e('0x29'),_0x974e('0x84'),'email',_0x974e('0x85')],'raw':!![]});}return null;})['then'](function(_0x2ab5cd){if(!_0x2ab5cd)return null;_0x4ebf89['message']['agent']=_0x2ab5cd;return _0x4ebf89;})['then'](function(_0x9772ae){if(_0x9772ae){_0x9772ae[_0x974e('0x1a')][_0x974e('0x76')]=util[_0x974e('0x63')](_0x974e('0x77'),_0x4f59d9[_0x974e('0x5b')][_0x974e('0x29')]);_0x9772ae[_0x974e('0x1a')]['channel']=_0x4ebf89[_0x974e('0x78')];_0x9772ae[_0x974e('0x1a')]['motionChannel']=_0x4ebf89[_0x974e('0x78')];_0x9772ae[_0x974e('0x1a')][_0x974e('0x79')]='reject';_0x9772ae[_0x974e('0x1a')][_0x974e('0x47')]=htmlToText[_0x974e('0x7b')](_0x4ebf89[_0x974e('0x1a')][_0x974e('0x47')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x974e('0x86'),'message':_0x9772ae[_0x974e('0x1a')]},client9002);return _0x4ebf89;}return null;})[_0x974e('0x11')](respondWithResult(_0x21d10c,null))[_0x974e('0x1c')](handleError(_0x21d10c,null));};exports[_0x974e('0x87')]=function(_0x50b687,_0x1d00ae){var _0x21b2ed=moment()[_0x974e('0x88')]()[_0x974e('0x89')]();var _0x316000=path[_0x974e('0x5e')](config[_0x974e('0x5f')],'server',_0x974e('0x8a'),'tmp');var _0x2dcc73=path[_0x974e('0x5e')](config['root'],'server',_0x974e('0x8a'),'attachments');var _0x13b9b2=util[_0x974e('0x63')](_0x974e('0x8b'),_0x21b2ed);return db['MailMessage'][_0x974e('0x46')]({'where':{'id':_0x50b687[_0x974e('0x42')]['id']},'attributes':['id',_0x974e('0x47'),_0x974e('0x8c'),'to','cc',_0x974e('0x8d'),'subject','createdAt'],'include':_0x50b687['query'][_0x974e('0x5d')]?[{'model':db['Attachment'],'as':_0x974e('0x8e')}]:undefined})[_0x974e('0x11')](handleEntityNotFound(_0x1d00ae,null))[_0x974e('0x11')](function(_0x381813){if(_0x381813){var _0x26f7d2=_0x381813;var _0x5861d9={'from':_0x26f7d2[_0x974e('0x8c')],'to':_0x26f7d2['to'],'subject':_0x26f7d2['subject'],'html':htmlEntities['decode'](_0x26f7d2[_0x974e('0x47')]),'headers':{'Date':moment(_0x26f7d2[_0x974e('0x8f')])[_0x974e('0x63')](_0x974e('0x90'))},'attachments':[]};if(_0x381813['cc']){_0x5861d9[_0x974e('0x91')]['Cc']=_0x381813['cc'];}if(_0x381813[_0x974e('0x8d')]){_0x5861d9[_0x974e('0x91')]['Bcc']=_0x381813[_0x974e('0x8d')];}return new BPromise(function(_0x526bd3,_0x2bd07f){if(_0x381813['Attachments']){for(var _0x1daa04=0x0;_0x1daa04<_0x381813[_0x974e('0x8e')][_0x974e('0x44')];_0x1daa04++){var _0x1978a8=_0x381813['Attachments'][_0x1daa04];var _0x506721=path[_0x974e('0x5e')](_0x2dcc73,_0x1978a8[_0x974e('0x92')]);if(fs[_0x974e('0x93')](_0x506721)){_0x5861d9[_0x974e('0x5d')]['push']({'name':_0x1978a8[_0x974e('0x29')],'contentType':_0x1978a8[_0x974e('0x3c')],'data':fs[_0x974e('0x94')](_0x506721)});}}}emlformat[_0x974e('0x95')](_0x5861d9,function(_0xcabad5,_0x4952ae){if(_0xcabad5)return _0x2bd07f(_0xcabad5);fs[_0x974e('0x96')](path['join'](_0x316000,_0x13b9b2),_0x4952ae);return _0x526bd3(_0x4952ae);});});}})['then'](function(_0x210f86){if(_0x210f86){return _0x1d00ae[_0x974e('0x87')](path[_0x974e('0x5e')](_0x316000,_0x13b9b2),_0x13b9b2,function(_0x3f5156){if(!_0x3f5156)fs['unlinkSync'](path['join'](_0x316000,_0x13b9b2));});}})[_0x974e('0x1c')](handleError(_0x1d00ae,null));}; \ No newline at end of file +var _0x4bc3=['stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','channel','event','fromString','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','motionChannel','EventManager','rejectmessage','download','unix','server','files','tmp','root','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','socket.io-emitter','html-entities','register','jayson/promise','http','client','then','info','request\x20sent','debug','error','code','message','MailMessage,\x20%s,\x20%s','result','json','offset','undefined','limit','count','status','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','body','find','describe','create','direction','secret','split','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','auth','pass','attachments','join','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','format','accept','mail','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x52a303,_0x514264){var _0x3a9812=function(_0x2ee45e){while(--_0x2ee45e){_0x52a303['push'](_0x52a303['shift']());}};_0x3a9812(++_0x514264);}(_0x4bc3,0x17e));var _0x34bc=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x4bc3[_0x176329];return _0x31997c;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require(_0x34bc('0x2'));var fs=require('fs');var _=require(_0x34bc('0x3'));var Redis=require(_0x34bc('0x4'));var htmlToText=require(_0x34bc('0x5'));var qs=require(_0x34bc('0x6'));var logger=require(_0x34bc('0x7'))(_0x34bc('0x8'));var interaction_log=require(_0x34bc('0x7'))(_0x34bc('0x9'));var config=require(_0x34bc('0xa'));var db=require(_0x34bc('0xb'))['db'];config['redis']=_[_0x34bc('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x34bc('0xe'));require('./mailMessage.socket')[_0x34bc('0xf')](socket);var jayson=require(_0x34bc('0x10'));var client=jayson['client'][_0x34bc('0x11')]({'port':0x232c});var client9003=jayson[_0x34bc('0x12')][_0x34bc('0x11')]({'port':0x232b});var client9002=jayson[_0x34bc('0x12')][_0x34bc('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x3bfbbe,_0x5f3a81,_0x34bcc2,_0x3e7e88){return new BPromise(function(_0x402270,_0x5c12e2){var _0x3ac62a=_0x3e7e88||client;return _0x3ac62a['request'](_0x3bfbbe,_0x34bcc2)[_0x34bc('0x13')](function(_0xcc6a91){logger[_0x34bc('0x14')]('MailMessage,\x20%s,\x20%s',_0x5f3a81,_0x34bc('0x15'));logger[_0x34bc('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5f3a81,'request\x20sent',JSON['stringify'](_0xcc6a91));if(_0xcc6a91[_0x34bc('0x17')]){if(_0xcc6a91[_0x34bc('0x17')][_0x34bc('0x18')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5f3a81,_0xcc6a91['error'][_0x34bc('0x19')]);return _0x5c12e2(_0xcc6a91[_0x34bc('0x17')][_0x34bc('0x19')]);}logger[_0x34bc('0x17')](_0x34bc('0x1a'),_0x5f3a81,_0xcc6a91[_0x34bc('0x17')]['message']);return _0x402270(_0xcc6a91[_0x34bc('0x17')][_0x34bc('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x5f3a81,'request\x20sent');_0x402270(_0xcc6a91[_0x34bc('0x1b')][_0x34bc('0x19')]);}})['catch'](function(_0x228682){logger[_0x34bc('0x17')]('MailMessage,\x20%s,\x20%s',_0x5f3a81,_0x228682);_0x5c12e2(_0x228682);});});}function respondWithResult(_0x2618ea,_0x534582){_0x534582=_0x534582||0xc8;return function(_0x3265d6){if(_0x3265d6){return _0x2618ea['status'](_0x534582)[_0x34bc('0x1c')](_0x3265d6);}};}function respondWithFilteredResult(_0x453c88,_0x4572b3){return function(_0xf07518){if(_0xf07518){var _0x21f40f=typeof _0x4572b3[_0x34bc('0x1d')]===_0x34bc('0x1e')&&typeof _0x4572b3[_0x34bc('0x1f')]===_0x34bc('0x1e');var _0x4c5e32=_0xf07518['count'];var _0x548db7=_0x21f40f?0x0:_0x4572b3[_0x34bc('0x1d')];var _0x9888d5=_0x21f40f?_0xf07518[_0x34bc('0x20')]:_0x4572b3[_0x34bc('0x1d')]+_0x4572b3[_0x34bc('0x1f')];var _0x52b98e;if(_0x9888d5>=_0x4c5e32){_0x9888d5=_0x4c5e32;_0x52b98e=0xc8;}else{_0x52b98e=0xce;}_0x453c88[_0x34bc('0x21')](_0x52b98e);return _0x453c88['set'](_0x34bc('0x22'),_0x548db7+'-'+_0x9888d5+'/'+_0x4c5e32)[_0x34bc('0x1c')](_0xf07518);}return null;};}function saveUpdates(_0x244f6b){return function(_0x39bd12){if(_0x39bd12){return _0x39bd12[_0x34bc('0x23')](_0x244f6b)['then'](function(_0x308f16){return _0x308f16;});}return null;};}function removeEntity(_0x292d7c){return function(_0x6a16e2){if(_0x6a16e2){return _0x6a16e2[_0x34bc('0x24')]()[_0x34bc('0x13')](function(){_0x292d7c[_0x34bc('0x21')](0xcc)[_0x34bc('0x25')]();});}};}function handleEntityNotFound(_0x22f502){return function(_0x1d1aa1){if(!_0x1d1aa1){_0x22f502[_0x34bc('0x26')](0x194);}return _0x1d1aa1;};}function handleError(_0x263613,_0x28ffa4){_0x28ffa4=_0x28ffa4||0x1f4;return function(_0x195d11){logger[_0x34bc('0x17')](_0x195d11[_0x34bc('0x27')]);if(_0x195d11[_0x34bc('0x28')]){delete _0x195d11[_0x34bc('0x28')];}_0x263613[_0x34bc('0x21')](_0x28ffa4)[_0x34bc('0x29')](_0x195d11);};}exports[_0x34bc('0x2a')]=function(_0x1040ba,_0x5678b4){var _0x4fb68f={},_0x2e80b1={},_0x3e0d1f={'count':0x0,'rows':[]};var _0x5af5f7=_[_0x34bc('0x2b')](db[_0x34bc('0x2c')][_0x34bc('0x2d')],function(_0x3f0005){return{'name':_0x3f0005[_0x34bc('0x2e')],'type':_0x3f0005[_0x34bc('0x2f')][_0x34bc('0x30')]};});_0x2e80b1[_0x34bc('0x31')]=_[_0x34bc('0x2b')](_0x5af5f7,_0x34bc('0x28'));_0x2e80b1[_0x34bc('0x32')]=_[_0x34bc('0x33')](_0x1040ba['query']);_0x2e80b1[_0x34bc('0x34')]=_[_0x34bc('0x35')](_0x2e80b1[_0x34bc('0x31')],_0x2e80b1[_0x34bc('0x32')]);_0x4fb68f[_0x34bc('0x36')]=_[_0x34bc('0x35')](_0x2e80b1['model'],qs[_0x34bc('0x37')](_0x1040ba[_0x34bc('0x32')][_0x34bc('0x37')]));_0x4fb68f['attributes']=_0x4fb68f['attributes'][_0x34bc('0x38')]?_0x4fb68f['attributes']:_0x2e80b1['model'];if(!_0x1040ba[_0x34bc('0x32')][_0x34bc('0x39')](_0x34bc('0x3a'))){_0x4fb68f[_0x34bc('0x1f')]=qs['limit'](_0x1040ba[_0x34bc('0x32')]['limit']);_0x4fb68f['offset']=qs[_0x34bc('0x1d')](_0x1040ba[_0x34bc('0x32')][_0x34bc('0x1d')]);}_0x4fb68f[_0x34bc('0x3b')]=qs[_0x34bc('0x3c')](_0x1040ba[_0x34bc('0x32')][_0x34bc('0x3c')]);_0x4fb68f[_0x34bc('0x3d')]=qs[_0x34bc('0x34')](_[_0x34bc('0x3e')](_0x1040ba[_0x34bc('0x32')],_0x2e80b1[_0x34bc('0x34')]),_0x5af5f7);if(_0x1040ba[_0x34bc('0x32')][_0x34bc('0x3f')]){_0x4fb68f[_0x34bc('0x3d')]=_[_0x34bc('0x40')](_0x4fb68f[_0x34bc('0x3d')],{'$or':_['map'](_0x5af5f7,function(_0x40221b){if(_0x40221b['type']!==_0x34bc('0x41')){var _0x46c91e={};_0x46c91e[_0x40221b[_0x34bc('0x28')]]={'$like':'%'+_0x1040ba['query']['filter']+'%'};return _0x46c91e;}})});}_0x4fb68f=_['merge']({},_0x4fb68f,_0x1040ba[_0x34bc('0x42')]);var _0x265c42={'where':_0x4fb68f[_0x34bc('0x3d')]};return db[_0x34bc('0x2c')][_0x34bc('0x20')](_0x265c42)[_0x34bc('0x13')](function(_0x2ab09f){_0x3e0d1f[_0x34bc('0x20')]=_0x2ab09f;if(_0x1040ba[_0x34bc('0x32')][_0x34bc('0x43')]){_0x4fb68f[_0x34bc('0x44')]=[{'all':!![]}];}return db[_0x34bc('0x2c')][_0x34bc('0x45')](_0x4fb68f);})['then'](function(_0xed0b43){_0x3e0d1f[_0x34bc('0x46')]=_0xed0b43;return _0x3e0d1f;})[_0x34bc('0x13')](respondWithFilteredResult(_0x5678b4,_0x4fb68f))['catch'](handleError(_0x5678b4,null));};exports[_0x34bc('0x47')]=function(_0x6aa9a2,_0x2975dc){var _0x5993bd={'raw':!![],'where':{'id':_0x6aa9a2[_0x34bc('0x48')]['id']}},_0x245059={};_0x245059[_0x34bc('0x31')]=_[_0x34bc('0x33')](db[_0x34bc('0x2c')][_0x34bc('0x2d')]);_0x245059[_0x34bc('0x32')]=_['keys'](_0x6aa9a2['query']);_0x245059[_0x34bc('0x34')]=_[_0x34bc('0x35')](_0x245059[_0x34bc('0x31')],_0x245059[_0x34bc('0x32')]);_0x5993bd['attributes']=_[_0x34bc('0x35')](_0x245059[_0x34bc('0x31')],qs['fields'](_0x6aa9a2[_0x34bc('0x32')]['fields']));_0x5993bd['attributes']=_0x5993bd['attributes']['length']?_0x5993bd[_0x34bc('0x36')]:_0x245059[_0x34bc('0x31')];if(_0x6aa9a2[_0x34bc('0x32')][_0x34bc('0x43')]){_0x5993bd[_0x34bc('0x44')]=[{'all':!![]}];}_0x5993bd=_[_0x34bc('0x40')]({},_0x5993bd,_0x6aa9a2[_0x34bc('0x42')]);return db[_0x34bc('0x2c')]['find'](_0x5993bd)[_0x34bc('0x13')](handleEntityNotFound(_0x2975dc,null))['then'](respondWithResult(_0x2975dc,null))[_0x34bc('0x49')](handleError(_0x2975dc,null));};exports[_0x34bc('0x23')]=function(_0x43fe2e,_0x2e4711){if(_0x43fe2e[_0x34bc('0x4a')]['id']){delete _0x43fe2e['body']['id'];}return db[_0x34bc('0x2c')][_0x34bc('0x4b')]({'where':{'id':_0x43fe2e['params']['id']}})[_0x34bc('0x13')](handleEntityNotFound(_0x2e4711,null))[_0x34bc('0x13')](saveUpdates(_0x43fe2e[_0x34bc('0x4a')],null))[_0x34bc('0x13')](respondWithResult(_0x2e4711,null))['catch'](handleError(_0x2e4711,null));};exports[_0x34bc('0x24')]=function(_0x5d3b9c,_0x59aa33){return db[_0x34bc('0x2c')][_0x34bc('0x4b')]({'where':{'id':_0x5d3b9c[_0x34bc('0x48')]['id']}})[_0x34bc('0x13')](handleEntityNotFound(_0x59aa33,null))[_0x34bc('0x13')](removeEntity(_0x59aa33,null))['catch'](handleError(_0x59aa33,null));};exports[_0x34bc('0x4c')]=function(_0x34a58d,_0x5259cf){return db[_0x34bc('0x2c')]['describe']()['then'](respondWithResult(_0x5259cf,null))[_0x34bc('0x49')](handleError(_0x5259cf,null));};exports[_0x34bc('0x4d')]=function(_0x4d70de,_0x3dec87){return db[_0x34bc('0x2c')][_0x34bc('0x4d')](_0x4d70de[_0x34bc('0x4a')])[_0x34bc('0x13')](function(_0xafee5c){if(_0xafee5c){if(_0xafee5c[_0x34bc('0x4e')]==='out'&&!_0xafee5c[_0x34bc('0x4f')]){var _0x12dcb4,_0x336f0a,_0x3787b2;if(_0x4d70de[_0x34bc('0x4a')]['to']){_0x336f0a=_0x4d70de[_0x34bc('0x4a')]['to'][_0x34bc('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0xafee5c[_0x34bc('0x51')]},'include':[{'model':db[_0x34bc('0x52')],'as':_0x34bc('0x53'),'include':[{'model':db[_0x34bc('0x54')],'as':_0x34bc('0x55'),'where':{'email':_0x336f0a},'limit':0x1,'order':[[_0x34bc('0x56'),_0x34bc('0x57')]]}]},{'model':db[_0x34bc('0x58')],'as':'Smtp','raw':!![]}]})[_0x34bc('0x13')](function(_0x3abdf8){_0x12dcb4=_0x3abdf8;if(_0x12dcb4&&_0x12dcb4[_0x34bc('0x59')]){var _0x225ed3={'tls':{'rejectUnauthorized':![]}};if(_[_0x34bc('0x5a')](_0x12dcb4[_0x34bc('0x59')][_0x34bc('0x5b')])){_0x225ed3['host']=_0x12dcb4[_0x34bc('0x59')][_0x34bc('0x5c')];_0x225ed3[_0x34bc('0x5d')]=_0x12dcb4[_0x34bc('0x59')]['port'];_0x225ed3[_0x34bc('0x5e')]=_0x12dcb4['Smtp'][_0x34bc('0x5e')];if(_0x12dcb4['Smtp'][_0x34bc('0x5f')]){_0x225ed3['auth']={'user':_0x12dcb4[_0x34bc('0x59')][_0x34bc('0x60')],'pass':_0x12dcb4[_0x34bc('0x59')]['pass']};}}else{_0x225ed3[_0x34bc('0x5b')]=_0x12dcb4['Smtp'][_0x34bc('0x5b')];_0x225ed3[_0x34bc('0x61')]={'user':_0x12dcb4[_0x34bc('0x59')]['user'],'pass':_0x12dcb4[_0x34bc('0x59')][_0x34bc('0x62')]};_0x225ed3[_0x34bc('0x5e')]=_0x12dcb4[_0x34bc('0x59')][_0x34bc('0x5e')];}if(_0x4d70de[_0x34bc('0x4a')][_0x34bc('0x63')]&&_0x4d70de[_0x34bc('0x4a')][_0x34bc('0x63')][_0x34bc('0x38')]){for(var _0x357ca5=0x0;_0x357ca5<_0x4d70de['body'][_0x34bc('0x63')]['length'];_0x357ca5+=0x1){_0x4d70de[_0x34bc('0x4a')][_0x34bc('0x63')][_0x357ca5]={'filename':_0x4d70de[_0x34bc('0x4a')][_0x34bc('0x63')][_0x357ca5][_0x34bc('0x28')],'path':path[_0x34bc('0x64')](config['root'],_0x34bc('0x65'),_0x4d70de[_0x34bc('0x4a')][_0x34bc('0x63')][_0x357ca5][_0x34bc('0x66')])};}}_0x3787b2={'account':_0x225ed3,'message':_0x4d70de[_0x34bc('0x4a')]};return;}})[_0x34bc('0x13')](function(){if(_0x12dcb4[_0x34bc('0x53')]){if(_0x12dcb4[_0x34bc('0x53')]['Contacts']['length']){return _0x12dcb4['List'][_0x34bc('0x55')][0x0];}else{return db[_0x34bc('0x54')]['create'](_[_0x34bc('0xc')](_0x4d70de[_0x34bc('0x4a')],{'firstName':_0x4d70de[_0x34bc('0x4a')]['to'],'email':_0x4d70de[_0x34bc('0x4a')]['to'],'phone':_0x4d70de[_0x34bc('0x4a')]['to'],'ListId':_0x12dcb4['ListId']}));}}else{throw new Error(_0x34bc('0x67'));}})['then'](function(){if(_0x3787b2){return respondWithRpcPromise(_0x34bc('0x68'),_0x34bc('0x69'),_0x3787b2,client9003)[_0x34bc('0x13')](function(_0x4cd30b){return _0xafee5c[_0x34bc('0x23')]({'read':!![],'messageId':_0x4cd30b['messageId'],'sentAt':moment()[_0x34bc('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x34bc('0x49')](function(_0x378347){logger[_0x34bc('0x17')]('%s',JSON['stringify'](_0x378347));return _0xafee5c;});}return _0xafee5c;});}return _0xafee5c;}})['then'](respondWithResult(_0x3dec87,0xc9))[_0x34bc('0x49')](handleError(_0x3dec87,null));};exports[_0x34bc('0x6b')]=function(_0x4a9961,_0x5203b9){var _0x201638={'agent':{},'channel':_0x34bc('0x6c')};if(_0x4a9961[_0x34bc('0x4a')]['id']){delete _0x4a9961[_0x34bc('0x4a')]['id'];}_0x4a9961[_0x34bc('0x4a')][_0x34bc('0x6d')]=!![];_0x4a9961['body']['readAt']=moment()[_0x34bc('0x6a')](_0x34bc('0x6e'));_0x4a9961[_0x34bc('0x4a')][_0x34bc('0x6f')]=_0x4a9961[_0x34bc('0x4a')][_0x34bc('0x6f')]||_0x4a9961[_0x34bc('0x60')]['id'];_0x201638[_0x34bc('0x70')]['id']=_0x4a9961[_0x34bc('0x4a')]['UserId'];return db[_0x34bc('0x2c')][_0x34bc('0x4b')]({'where':{'id':_0x4a9961[_0x34bc('0x48')]['id'],'UserId':null}})[_0x34bc('0x13')](handleEntityNotFound(_0x5203b9,null))[_0x34bc('0x13')](saveUpdates(_0x4a9961[_0x34bc('0x4a')],null))[_0x34bc('0x13')](function(_0xb26e19){if(_0xb26e19){_0x201638[_0x34bc('0x19')]=_0xb26e19[_0x34bc('0x71')]({'plain':!![]});return db[_0x34bc('0x72')][_0x34bc('0x4b')]({'where':{'id':_0xb26e19[_0x34bc('0x73')]}});}return null;})[_0x34bc('0x13')](handleEntityNotFound(_0x5203b9,null))[_0x34bc('0x13')](function(_0x34e6ab){if(_0x34e6ab){return _0x34e6ab['update']({'UserId':_0x4a9961['body'][_0x34bc('0x6f')],'read1stAt':_[_0x34bc('0x5a')](_0x34e6ab[_0x34bc('0x74')])?moment()['format'](_0x34bc('0x6e')):undefined});}return null;})['then'](function(_0x3706e6){if(_0x3706e6){_0x201638[_0x34bc('0x75')]=_0x3706e6[_0x34bc('0x71')]({'plain':!![]});interaction_log[_0x34bc('0x14')](_0x34bc('0x76'),_0x4a9961[_0x34bc('0x60')]['id'],_0x4a9961[_0x34bc('0x60')]['name'],_0x4a9961[_0x34bc('0x60')]['role'],_0x201638[_0x34bc('0x75')]['id'],_0x4a9961[_0x34bc('0x4a')]?JSON[_0x34bc('0x77')](_0x4a9961[_0x34bc('0x4a')]):_0x34bc('0x78'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x201638);}return null;})[_0x34bc('0x13')](function(_0x4bffb1){var _0x3165a3=_0x34bc('0x79')+_0x4bffb1[_0x34bc('0x19')][_0x34bc('0x7a')];return db[_0x34bc('0x7b')]['query'](_0x3165a3,{'type':db[_0x34bc('0x7c')][_0x34bc('0x7d')][_0x34bc('0x7e')],'raw':!![]})['then'](function(_0x5919d5){return _0x5919d5;});})[_0x34bc('0x13')](function(_0x199eb4){if(_0x199eb4){_0x201638[_0x34bc('0x19')][_0x34bc('0x7f')]=_0x199eb4[0x0];if(!_0x4a9961[_0x34bc('0x4a')][_0x34bc('0x6f')])return;return db[_0x34bc('0x80')][_0x34bc('0x4b')]({'where':{'id':_0x4a9961['body'][_0x34bc('0x6f')],'role':'agent'},'attributes':['id',_0x34bc('0x28'),'fullname',_0x34bc('0x81'),_0x34bc('0x82')],'raw':!![]});}return null;})[_0x34bc('0x13')](function(_0x519719){if(!_0x519719)return null;_0x201638[_0x34bc('0x19')][_0x34bc('0x70')]=_0x519719;return _0x201638;})[_0x34bc('0x13')](function(_0x4145a5){if(_0x4145a5){if(_0x4a9961['body'][_0x34bc('0x83')]){_0x201638[_0x34bc('0x19')]['interface']=util[_0x34bc('0x6a')]('SIP/%s',_0x4a9961[_0x34bc('0x60')]['name']);_0x201638[_0x34bc('0x19')][_0x34bc('0x84')]=_0x201638[_0x34bc('0x84')];_0x201638[_0x34bc('0x19')]['motionChannel']=_0x201638['channel'];_0x201638[_0x34bc('0x19')][_0x34bc('0x85')]=_0x34bc('0x6b');_0x201638[_0x34bc('0x19')]['body']=htmlToText[_0x34bc('0x86')](_0x201638['message'][_0x34bc('0x4a')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x34bc('0x87'),'message':_0x201638[_0x34bc('0x19')]},client9002)[_0x34bc('0x13')](function(){return _0x201638;});}return _0x201638;}return null;})[_0x34bc('0x13')](respondWithResult(_0x5203b9,null))[_0x34bc('0x49')](handleError(_0x5203b9,null));};exports[_0x34bc('0x88')]=function(_0xefa084,_0x835a62){var _0xdd06d9={'agent':{},'channel':_0x34bc('0x6c')};if(_0xefa084[_0x34bc('0x4a')]['id']){delete _0xefa084[_0x34bc('0x4a')]['id'];}_0xefa084[_0x34bc('0x4a')][_0x34bc('0x6f')]=_0xefa084[_0x34bc('0x4a')][_0x34bc('0x6f')]||_0xefa084[_0x34bc('0x60')]['id'];_0xdd06d9[_0x34bc('0x70')]['id']=_0xefa084['body'][_0x34bc('0x6f')];return db[_0x34bc('0x2c')][_0x34bc('0x4b')]({'where':{'id':_0xefa084[_0x34bc('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x835a62,null))['then'](function(_0x4e569e){if(_0x4e569e){_0xdd06d9[_0x34bc('0x19')]=_0x4e569e[_0x34bc('0x71')]({'plain':!![]});return db['MailInteraction'][_0x34bc('0x4b')]({'where':{'id':_0x4e569e[_0x34bc('0x73')]}});}return null;})[_0x34bc('0x13')](handleEntityNotFound(_0x835a62,null))[_0x34bc('0x13')](function(_0x571773){if(_0x571773){_0xdd06d9['interaction']=_0x571773[_0x34bc('0x71')]({'plain':!![]});interaction_log[_0x34bc('0x14')](_0x34bc('0x89'),_0xefa084[_0x34bc('0x60')]['id'],_0xefa084[_0x34bc('0x60')][_0x34bc('0x28')],_0xefa084[_0x34bc('0x60')][_0x34bc('0x8a')],_0xdd06d9[_0x34bc('0x75')]['id'],_0xefa084[_0x34bc('0x4a')]?JSON[_0x34bc('0x77')](_0xefa084[_0x34bc('0x4a')]):_0x34bc('0x78'));return respondWithRpcPromise('RejectMessage',_0x34bc('0x8b'),_0xdd06d9);}return null;})[_0x34bc('0x13')](function(_0x3a35da){var _0x23e281='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a35da[_0x34bc('0x19')][_0x34bc('0x7a')];return db[_0x34bc('0x7b')]['query'](_0x23e281,{'type':db[_0x34bc('0x7c')]['QueryTypes'][_0x34bc('0x7e')],'raw':!![]})[_0x34bc('0x13')](function(_0x20bd45){return _0x20bd45;});})[_0x34bc('0x13')](function(_0x48e08a){if(_0x48e08a){_0xdd06d9[_0x34bc('0x19')][_0x34bc('0x7f')]=_0x48e08a[0x0];if(!_0xefa084[_0x34bc('0x4a')]['UserId'])return;return db[_0x34bc('0x80')][_0x34bc('0x4b')]({'where':{'id':_0xefa084['body']['UserId'],'role':_0x34bc('0x70')},'attributes':['id','name','fullname',_0x34bc('0x81'),'internal'],'raw':!![]});}return null;})[_0x34bc('0x13')](function(_0x477b2b){if(!_0x477b2b)return null;_0xdd06d9[_0x34bc('0x19')][_0x34bc('0x70')]=_0x477b2b;return _0xdd06d9;})['then'](function(_0x3e55dc){if(_0x3e55dc){_0x3e55dc[_0x34bc('0x19')]['interface']=util[_0x34bc('0x6a')](_0x34bc('0x8c'),_0xefa084[_0x34bc('0x60')]['name']);_0x3e55dc[_0x34bc('0x19')][_0x34bc('0x84')]=_0xdd06d9['channel'];_0x3e55dc[_0x34bc('0x19')][_0x34bc('0x8d')]=_0xdd06d9[_0x34bc('0x84')];_0x3e55dc[_0x34bc('0x19')][_0x34bc('0x85')]=_0x34bc('0x88');_0x3e55dc['message'][_0x34bc('0x4a')]=htmlToText[_0x34bc('0x86')](_0xdd06d9[_0x34bc('0x19')][_0x34bc('0x4a')]);respondWithRpcPromise(_0x34bc('0x8e'),_0x34bc('0x8e'),{'event':_0x34bc('0x8f'),'message':_0x3e55dc[_0x34bc('0x19')]},client9002);return _0xdd06d9;}return null;})[_0x34bc('0x13')](respondWithResult(_0x835a62,null))[_0x34bc('0x49')](handleError(_0x835a62,null));};exports[_0x34bc('0x90')]=function(_0x20b02a,_0x301ff2){var _0x53953f=moment()[_0x34bc('0x91')]()['toString']();var _0x45ffeb=path['join'](config['root'],_0x34bc('0x92'),_0x34bc('0x93'),_0x34bc('0x94'));var _0x1b82fd=path[_0x34bc('0x64')](config[_0x34bc('0x95')],_0x34bc('0x92'),_0x34bc('0x93'),_0x34bc('0x63'));var _0x461650=util[_0x34bc('0x6a')](_0x34bc('0x96'),_0x53953f);return db[_0x34bc('0x2c')]['find']({'where':{'id':_0x20b02a[_0x34bc('0x48')]['id']},'attributes':['id',_0x34bc('0x4a'),_0x34bc('0x97'),'to','cc',_0x34bc('0x98'),_0x34bc('0x99'),_0x34bc('0x9a')],'include':_0x20b02a['query'][_0x34bc('0x63')]?[{'model':db[_0x34bc('0x9b')],'as':_0x34bc('0x9c')}]:undefined})[_0x34bc('0x13')](handleEntityNotFound(_0x301ff2,null))['then'](function(_0x1bc14a){if(_0x1bc14a){var _0x6f4f02=_0x1bc14a;var _0x1e2957={'from':_0x6f4f02[_0x34bc('0x97')],'to':_0x6f4f02['to'],'subject':_0x6f4f02['subject'],'html':htmlEntities[_0x34bc('0x9d')](_0x6f4f02['body']),'headers':{'Date':moment(_0x6f4f02['createdAt'])[_0x34bc('0x6a')](_0x34bc('0x9e'))},'attachments':[]};if(_0x1bc14a['cc']){_0x1e2957[_0x34bc('0x9f')]['Cc']=_0x1bc14a['cc'];}if(_0x1bc14a[_0x34bc('0x98')]){_0x1e2957[_0x34bc('0x9f')][_0x34bc('0xa0')]=_0x1bc14a[_0x34bc('0x98')];}return new BPromise(function(_0x1fd01a,_0x23a7f9){if(_0x1bc14a[_0x34bc('0x9c')]){for(var _0x24bf35=0x0;_0x24bf35<_0x1bc14a['Attachments']['length'];_0x24bf35++){var _0x1b5bfc=_0x1bc14a[_0x34bc('0x9c')][_0x24bf35];var _0x407f65=path[_0x34bc('0x64')](_0x1b82fd,_0x1b5bfc[_0x34bc('0x66')]);if(fs[_0x34bc('0xa1')](_0x407f65)){_0x1e2957[_0x34bc('0x63')][_0x34bc('0xa2')]({'name':_0x1b5bfc['name'],'contentType':_0x1b5bfc[_0x34bc('0x2f')],'data':fs[_0x34bc('0xa3')](_0x407f65)});}}}emlformat[_0x34bc('0xa4')](_0x1e2957,function(_0x35f2c6,_0x113ec6){if(_0x35f2c6)return _0x23a7f9(_0x35f2c6);fs[_0x34bc('0xa5')](path[_0x34bc('0x64')](_0x45ffeb,_0x461650),_0x113ec6);return _0x1fd01a(_0x113ec6);});});}})[_0x34bc('0x13')](function(_0x210445){if(_0x210445){return _0x301ff2['download'](path['join'](_0x45ffeb,_0x461650),_0x461650,function(_0xb6e55d){if(!_0xb6e55d)fs[_0x34bc('0xa6')](path[_0x34bc('0x64')](_0x45ffeb,_0x461650));});}})[_0x34bc('0x49')](handleError(_0x301ff2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e944ea8..890e6ee 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 _0xe414=['../../mysqldb','MailMessage','update','emit','hook','exports','events'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xe414,0x7d));var _0x4e41=function(_0x35ae8a,_0x594cec){_0x35ae8a=_0x35ae8a-0x0;var _0x43d872=_0xe414[_0x35ae8a];return _0x43d872;};'use strict';var EventEmitter=require(_0x4e41('0x0'));var MailMessage=require(_0x4e41('0x1'))['db'][_0x4e41('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2a1394){return function(_0x389ede,_0x52ebc6,_0x3b2706){MailMessageEvents[_0x4e41('0x4')](_0x2a1394+':'+_0x389ede['id'],_0x389ede);MailMessageEvents['emit'](_0x2a1394,_0x389ede);_0x3b2706(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x4e41('0x5')](e,emitEvent(event));}}module[_0x4e41('0x6')]=MailMessageEvents; \ No newline at end of file +var _0xd369=['hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4808a6,_0x35ea2e){var _0x383852=function(_0x3d013a){while(--_0x3d013a){_0x4808a6['push'](_0x4808a6['shift']());}};_0x383852(++_0x35ea2e);}(_0xd369,0x1de));var _0x9d36=function(_0x33bad4,_0x329008){_0x33bad4=_0x33bad4-0x0;var _0x590290=_0xd369[_0x33bad4];return _0x590290;};'use strict';var EventEmitter=require(_0x9d36('0x0'));var MailMessage=require(_0x9d36('0x1'))['db'][_0x9d36('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9d36('0x3')](0x0);var events={'afterCreate':_0x9d36('0x4'),'afterUpdate':_0x9d36('0x5'),'afterDestroy':_0x9d36('0x6')};function emitEvent(_0x16b7ae){return function(_0x337cb1,_0x53a7ac,_0x593442){MailMessageEvents['emit'](_0x16b7ae+':'+_0x337cb1['id'],_0x337cb1);MailMessageEvents[_0x9d36('0x7')](_0x16b7ae,_0x337cb1);_0x593442(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x9d36('0x8')](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 996840f..73aa503 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 _0x45f8=['secret','MailInteraction','findOne','then','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','direction','toLowerCase'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x45f8,0x11a));var _0x845f=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x45f8[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x845f('0x0'));var util=require(_0x845f('0x1'));var logger=require(_0x845f('0x2'))(_0x845f('0x3'));var moment=require('moment');var BPromise=require(_0x845f('0x4'));var rp=require(_0x845f('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x845f('0x6'));var attributes=require('./mailMessage.attributes');module[_0x845f('0x7')]=function(_0x47900b,_0x3ac573){return _0x47900b['define']('MailMessage',attributes,{'tableName':_0x845f('0x8'),'paranoid':![],'indexes':[{'name':_0x845f('0x9'),'fields':[_0x845f('0x9')]},{'name':_0x845f('0xa'),'fields':[_0x845f('0xb'),'subject'],'type':_0x845f('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc79ffa,_0x1c7148,_0x385783){if(_0xc79ffa[_0x845f('0xd')]){_0xc79ffa[_0x845f('0xb')]=htmlToText['fromString'](_0xc79ffa[_0x845f('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x385783(null,_0x1c7148);},'afterCreate':function(_0x39379e,_0x56f7b9,_0x1d0a98){var _0x27468c=_0x47900b[_0x845f('0xe')];var _0x2830ea=_0x39379e[_0x845f('0xf')]({'plain':!![]});if(_0x2830ea[_0x845f('0x10')][_0x845f('0x11')]()==='in'||_0x2830ea[_0x845f('0x10')][_0x845f('0x11')]()==='out'&&!_0x2830ea[_0x845f('0x12')]&&!_['isNil'](_0x2830ea['UserId'])){_0x27468c[_0x845f('0x13')][_0x845f('0x14')]({'where':{'id':_0x2830ea['MailInteractionId']}})[_0x845f('0x15')](function(_0x2ffb0a){if(_0x2ffb0a){_0x2ffb0a['update']({'lastMsgAt':_0x2830ea['createdAt'],'lastMsgDirection':_0x2830ea[_0x845f('0x10')][_0x845f('0x11')]()});}})[_0x845f('0x16')](function(_0x12d3fa){console[_0x845f('0x17')](_0x12d3fa);});}_0x1d0a98();}},'charset':_0x845f('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x98af=['out','secret','isNil','UserId','MailInteraction','findOne','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','mail_messages','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','get','direction','toLowerCase'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x98af,0xc4));var _0xf98a=function(_0x44e97a,_0x4a01d2){_0x44e97a=_0x44e97a-0x0;var _0x15a999=_0x98af[_0x44e97a];return _0x15a999;};'use strict';var _=require(_0xf98a('0x0'));var util=require(_0xf98a('0x1'));var logger=require('../../config/logger')(_0xf98a('0x2'));var moment=require('moment');var BPromise=require(_0xf98a('0x3'));var rp=require(_0xf98a('0x4'));var htmlToText=require(_0xf98a('0x5'));var fs=require('fs');var path=require(_0xf98a('0x6'));var rimraf=require(_0xf98a('0x7'));var config=require('../../config/environment');var attributes=require(_0xf98a('0x8'));module[_0xf98a('0x9')]=function(_0x2885e9,_0x433068){return _0x2885e9[_0xf98a('0xa')]('MailMessage',attributes,{'tableName':_0xf98a('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xf98a('0xc'),'fields':[_0xf98a('0xd'),_0xf98a('0xe')],'type':_0xf98a('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5758cb,_0x4affa2,_0x54745f){if(_0x5758cb['body']){_0x5758cb['plainBody']=htmlToText[_0xf98a('0x10')](_0x5758cb['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x54745f(null,_0x4affa2);},'afterCreate':function(_0x36cc29,_0x59ee52,_0x7bfd22){var _0x4f2adf=_0x2885e9[_0xf98a('0x11')];var _0x2a3f66=_0x36cc29[_0xf98a('0x12')]({'plain':!![]});if(_0x2a3f66[_0xf98a('0x13')][_0xf98a('0x14')]()==='in'||_0x2a3f66[_0xf98a('0x13')][_0xf98a('0x14')]()===_0xf98a('0x15')&&!_0x2a3f66[_0xf98a('0x16')]&&!_[_0xf98a('0x17')](_0x2a3f66[_0xf98a('0x18')])){_0x4f2adf[_0xf98a('0x19')][_0xf98a('0x1a')]({'where':{'id':_0x2a3f66['MailInteractionId']}})['then'](function(_0x567e8a){if(_0x567e8a){_0x567e8a[_0xf98a('0x1b')]({'lastMsgAt':_0x2a3f66['createdAt'],'lastMsgDirection':_0x2a3f66['direction'][_0xf98a('0x14')]()});}})[_0xf98a('0x1c')](function(_0x59ef38){console['error'](_0x59ef38);});}_0x7bfd22();}},'charset':_0xf98a('0x1d'),'collate':_0xf98a('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b94cb9a..b3961dc 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 _0x58a4=['create','body','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58a4,0xbf));var _0x458a=function(_0xfa514e,_0x2665aa){_0xfa514e=_0xfa514e-0x0;var _0x39d8b0=_0x58a4[_0xfa514e];return _0x39d8b0;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});config['redis']=_[_0x458a('0xd')](config[_0x458a('0xe')],{'host':_0x458a('0xf'),'port':0x18eb});var socket=require(_0x458a('0x10'))(new Redis(config[_0x458a('0xe')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x185c5f,_0x45b79b,_0xaad5bf){return new BPromise(function(_0x2e1d67,_0x1ff87d){return client['request'](_0x185c5f,_0xaad5bf)[_0x458a('0x11')](function(_0x804e01){logger['info'](_0x458a('0x12'),_0x45b79b,_0x458a('0x13'));logger[_0x458a('0x14')](_0x458a('0x15'),_0x45b79b,_0x458a('0x13'),JSON['stringify'](_0x804e01));if(_0x804e01['error']){if(_0x804e01[_0x458a('0x16')]['code']===0x1f4){logger[_0x458a('0x16')](_0x458a('0x12'),_0x45b79b,_0x804e01[_0x458a('0x16')][_0x458a('0x17')]);return _0x1ff87d(_0x804e01[_0x458a('0x16')][_0x458a('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x45b79b,_0x804e01['error'][_0x458a('0x17')]);return _0x2e1d67(_0x804e01[_0x458a('0x16')][_0x458a('0x17')]);}else{logger['info'](_0x458a('0x12'),_0x45b79b,_0x458a('0x13'));_0x2e1d67(_0x804e01[_0x458a('0x18')][_0x458a('0x17')]);}})[_0x458a('0x19')](function(_0x4df9ef){logger['error'](_0x458a('0x12'),_0x45b79b,_0x4df9ef);_0x1ff87d(_0x4df9ef);});});}exports['CreateMailMessage']=function(_0x3302b7){var _0x398ff2=this;return new Promise(function(_0x47a202,_0x468416){return db['MailMessage'][_0x458a('0x1a')](_0x3302b7[_0x458a('0x1b')],{'raw':_0x3302b7['options']?_0x3302b7[_0x458a('0x1c')][_0x458a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xa6b8ff){logger['info'](_0x458a('0x1e'),_0x3302b7);logger['debug'](_0x458a('0x1e'),_0x3302b7,JSON['stringify'](_0xa6b8ff));_0x47a202(_0xa6b8ff);})[_0x458a('0x19')](function(_0x911eaf){logger[_0x458a('0x16')](_0x458a('0x1e'),_0x911eaf[_0x458a('0x17')],_0x3302b7);_0x468416(_0x398ff2[_0x458a('0x16')](0x1f4,_0x911eaf[_0x458a('0x17')]));});});}; \ No newline at end of file +var _0x896e=['request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s'];(function(_0x1a26ef,_0x556ccf){var _0x50ae2b=function(_0x2ecc71){while(--_0x2ecc71){_0x1a26ef['push'](_0x1a26ef['shift']());}};_0x50ae2b(++_0x556ccf);}(_0x896e,0x1e9));var _0xe896=function(_0x17171e,_0x4c4025){_0x17171e=_0x17171e-0x0;var _0x1279f4=_0x896e[_0x17171e];return _0x1279f4;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});}exports[_0xe896('0x1d')]=function(_0x3ac8b8){var _0x388c2e=this;return new Promise(function(_0x32d3d3,_0x49547b){return db[_0xe896('0x1e')]['create'](_0x3ac8b8['body'],{'raw':_0x3ac8b8[_0xe896('0x1f')]?_0x3ac8b8[_0xe896('0x1f')][_0xe896('0x20')]===undefined?!![]:![]:!![]})[_0xe896('0x13')](function(_0x498469){logger[_0xe896('0x21')]('CreateMailMessage',_0x3ac8b8);logger['debug'](_0xe896('0x1d'),_0x3ac8b8,JSON[_0xe896('0x17')](_0x498469));_0x32d3d3(_0x498469);})[_0xe896('0x1c')](function(_0x2e2c10){logger[_0xe896('0x18')](_0xe896('0x1d'),_0x2e2c10[_0xe896('0x1a')],_0x3ac8b8);_0x49547b(_0x388c2e['error'](0x1f4,_0x2e2c10[_0xe896('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 88d57d7..ce46966 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 _0x41a0=['register','length','mailMessage:','./mailMessage.events','remove','update','emit'];(function(_0x15e3d0,_0x3869b4){var _0x49a01b=function(_0xfa698a){while(--_0xfa698a){_0x15e3d0['push'](_0x15e3d0['shift']());}};_0x49a01b(++_0x3869b4);}(_0x41a0,0xd5));var _0x041a=function(_0x3790e1,_0x3c595a){_0x3790e1=_0x3790e1-0x0;var _0x148972=_0x41a0[_0x3790e1];return _0x148972;};'use strict';var MailMessageEvents=require(_0x041a('0x0'));var events=['save',_0x041a('0x1'),_0x041a('0x2')];function createListener(_0x17cd8b,_0x53d0c4){return function(_0x410566){_0x53d0c4[_0x041a('0x3')](_0x17cd8b,_0x410566);};}function removeListener(_0x1840d6,_0x4cbe51){return function(){MailMessageEvents['removeListener'](_0x1840d6,_0x4cbe51);};}exports[_0x041a('0x4')]=function(_0x1d4080){for(var _0x3d44b5=0x0,_0x48f313=events[_0x041a('0x5')];_0x3d44b5<_0x48f313;_0x3d44b5++){var _0x258ded=events[_0x3d44b5];var _0x90d5ce=createListener(_0x041a('0x6')+_0x258ded,_0x1d4080);MailMessageEvents['on'](_0x258ded,_0x90d5ce);}}; \ No newline at end of file +var _0xd29e=['emit','register','mailMessage:','save','remove','update'];(function(_0x115f5f,_0x280f88){var _0x9f53dc=function(_0x48618b){while(--_0x48618b){_0x115f5f['push'](_0x115f5f['shift']());}};_0x9f53dc(++_0x280f88);}(_0xd29e,0x1a7));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xed29('0x0'),_0xed29('0x1'),_0xed29('0x2')];function createListener(_0x27235f,_0x2505c2){return function(_0x4cf917){_0x2505c2[_0xed29('0x3')](_0x27235f,_0x4cf917);};}function removeListener(_0x33863f,_0x1b6a31){return function(){MailMessageEvents['removeListener'](_0x33863f,_0x1b6a31);};}exports[_0xed29('0x4')]=function(_0x1cd7de){for(var _0x3b1660=0x0,_0x91e94f=events['length'];_0x3b1660<_0x91e94f;_0x3b1660++){var _0x5aea8a=events[_0x3b1660];var _0x4ce362=createListener(_0xed29('0x5')+_0x5aea8a,_0x1cd7de);MailMessageEvents['on'](_0x5aea8a,_0x4ce362);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9d556ff..a3cabd2 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 _0xd151=['addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','create','post','/:id/teams'];(function(_0x22d3ab,_0x3bb10d){var _0x222592=function(_0x5108d9){while(--_0x5108d9){_0x22d3ab['push'](_0x22d3ab['shift']());}};_0x222592(++_0x3bb10d);}(_0xd151,0x173));var _0x1d15=function(_0x1de0b9,_0xc6f046){_0x1de0b9=_0x1de0b9-0x0;var _0x18edae=_0xd151[_0x1de0b9];return _0x18edae;};'use strict';var multer=require(_0x1d15('0x0'));var util=require(_0x1d15('0x1'));var path=require(_0x1d15('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d15('0x3'));var router=express[_0x1d15('0x4')]();var fs_extra=require(_0x1d15('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d15('0x6'));var config=require(_0x1d15('0x7'));var controller=require(_0x1d15('0x8'));router[_0x1d15('0x9')]('/',auth[_0x1d15('0xa')](),controller[_0x1d15('0xb')]);router[_0x1d15('0x9')](_0x1d15('0xc'),auth[_0x1d15('0xa')](),controller[_0x1d15('0xd')]);router[_0x1d15('0x9')]('/:id',auth[_0x1d15('0xa')](),controller['show']);router['get'](_0x1d15('0xe'),auth[_0x1d15('0xa')](),controller[_0x1d15('0xf')]);router[_0x1d15('0x9')]('/:id/teams',auth[_0x1d15('0xa')](),controller['getTeams']);router['get']('/:id/users',auth[_0x1d15('0xa')](),controller['getAgents']);router['post']('/',auth[_0x1d15('0xa')](),controller[_0x1d15('0x10')]);router[_0x1d15('0x11')](_0x1d15('0x12'),auth[_0x1d15('0xa')](),controller[_0x1d15('0x13')]);router[_0x1d15('0x11')](_0x1d15('0x14'),auth[_0x1d15('0xa')](),controller[_0x1d15('0x15')]);router[_0x1d15('0x16')](_0x1d15('0x17'),auth[_0x1d15('0xa')](),controller[_0x1d15('0x18')]);router[_0x1d15('0x19')](_0x1d15('0x17'),auth['isAuthenticated'](),controller[_0x1d15('0x1a')]);router[_0x1d15('0x19')](_0x1d15('0x12'),auth['isAuthenticated'](),controller[_0x1d15('0x1b')]);router['delete'](_0x1d15('0x14'),auth[_0x1d15('0xa')](),controller[_0x1d15('0x1c')]);module[_0x1d15('0x1d')]=router; \ No newline at end of file +var _0x39b4=['delete','removeTeams','removeAgents','multer','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','destroy'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x39b4,0x15c));var _0x439b=function(_0x5a2c69,_0x2289b8){_0x5a2c69=_0x5a2c69-0x0;var _0xb7c940=_0x39b4[_0x5a2c69];return _0xb7c940;};'use strict';var multer=require(_0x439b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x439b('0x1'));var router=express[_0x439b('0x2')]();var fs_extra=require(_0x439b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x439b('0x4'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x439b('0x5')]('/',auth['isAuthenticated'](),controller[_0x439b('0x6')]);router[_0x439b('0x5')](_0x439b('0x7'),auth[_0x439b('0x8')](),controller[_0x439b('0x9')]);router[_0x439b('0x5')](_0x439b('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x439b('0x8')](),controller['getMembers']);router[_0x439b('0x5')](_0x439b('0xb'),auth[_0x439b('0x8')](),controller[_0x439b('0xc')]);router['get'](_0x439b('0xd'),auth[_0x439b('0x8')](),controller[_0x439b('0xe')]);router[_0x439b('0xf')]('/',auth['isAuthenticated'](),controller[_0x439b('0x10')]);router[_0x439b('0xf')](_0x439b('0xb'),auth[_0x439b('0x8')](),controller[_0x439b('0x11')]);router['post'](_0x439b('0xd'),auth[_0x439b('0x8')](),controller['addAgents']);router['put'](_0x439b('0xa'),auth['isAuthenticated'](),controller[_0x439b('0x12')]);router['delete'](_0x439b('0xa'),auth[_0x439b('0x8')](),controller[_0x439b('0x13')]);router[_0x439b('0x14')](_0x439b('0xb'),auth[_0x439b('0x8')](),controller[_0x439b('0x15')]);router[_0x439b('0x14')](_0x439b('0xd'),auth['isAuthenticated'](),controller[_0x439b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index fda34bb..b2f2e41 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 _0xc18b=['sequelize','exports','INTEGER','ENUM','roundrobin'];(function(_0x2ae19b,_0x4192a4){var _0x40950a=function(_0x14848d){while(--_0x14848d){_0x2ae19b['push'](_0x2ae19b['shift']());}};_0x40950a(++_0x4192a4);}(_0xc18b,0x1c7));var _0xbc18=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xc18b[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0xbc18('0x0'));module[_0xbc18('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbc18('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbc18('0x3')]('rrmemory','beepall',_0xbc18('0x4'))}}; \ No newline at end of file +var _0xebed=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x266317,_0x451c06){var _0x2e8261=function(_0x6a9601){while(--_0x6a9601){_0x266317['push'](_0x266317['shift']());}};_0x2e8261(++_0x451c06);}(_0xebed,0x1cf));var _0xdebe=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xebed[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require('sequelize');module[_0xdebe('0x0')]={'name':{'type':Sequelize[_0xdebe('0x1')],'unique':_0xdebe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdebe('0x1')]},'timeout':{'type':Sequelize[_0xdebe('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdebe('0x4')](_0xdebe('0x5'),_0xdebe('0x6'),_0xdebe('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 30f35e1..501a530 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 _0x9993=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','MailQueue','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','findAll','User','findAndCountAll','UserId','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','addAgents','userMailQueue:save','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x134bc3,_0x21a290){var _0x35fc7a=function(_0x46d0c0){while(--_0x46d0c0){_0x134bc3['push'](_0x134bc3['shift']());}};_0x35fc7a(++_0x21a290);}(_0x9993,0x109));var _0x3999=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x9993[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x3999('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3999('0x1'));var jsonpatch=require(_0x3999('0x2'));var rp=require(_0x3999('0x3'));var moment=require('moment');var BPromise=require(_0x3999('0x4'));var Mustache=require('mustache');var util=require(_0x3999('0x5'));var path=require(_0x3999('0x6'));var sox=require(_0x3999('0x7'));var csv=require('to-csv');var ejs=require(_0x3999('0x8'));var fs=require('fs');var fs_extra=require(_0x3999('0x9'));var _=require('lodash');var squel=require(_0x3999('0xa'));var crypto=require(_0x3999('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3999('0xc'));var toCsv=require(_0x3999('0xd'));var querystring=require('querystring');var Papa=require(_0x3999('0xe'));var Redis=require('ioredis');var authService=require(_0x3999('0xf'));var qs=require(_0x3999('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3999('0x11'));var logger=require(_0x3999('0x12'))(_0x3999('0x13'));var utils=require(_0x3999('0x14'));var config=require(_0x3999('0x15'));var licenseUtil=require(_0x3999('0x16'));var db=require(_0x3999('0x17'))['db'];config['redis']=_[_0x3999('0x18')](config[_0x3999('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3999('0x1a'))(new Redis(config[_0x3999('0x19')]));require(_0x3999('0x1b'))[_0x3999('0x1c')](socket);function respondWithStatusCode(_0x5a36b0,_0x471033){_0x471033=_0x471033||0xcc;return function(_0x4a549d){if(_0x4a549d){return _0x5a36b0[_0x3999('0x1d')](_0x471033);}return _0x5a36b0['status'](_0x471033)[_0x3999('0x1e')]();};}function respondWithResult(_0x56787c,_0x28561f){_0x28561f=_0x28561f||0xc8;return function(_0x23fd81){if(_0x23fd81){return _0x56787c[_0x3999('0x1f')](_0x28561f)[_0x3999('0x20')](_0x23fd81);}};}function respondWithFilteredResult(_0x51f56a,_0x5e1aa5){return function(_0xdd19a){if(_0xdd19a){var _0x29ca01=typeof _0x5e1aa5['offset']===_0x3999('0x21')&&typeof _0x5e1aa5[_0x3999('0x22')]==='undefined';var _0x1afedd=_0xdd19a['count'];var _0x258f76=_0x29ca01?0x0:_0x5e1aa5['offset'];var _0x58f51c=_0x29ca01?_0xdd19a[_0x3999('0x23')]:_0x5e1aa5[_0x3999('0x24')]+_0x5e1aa5[_0x3999('0x22')];var _0x367dd8;if(_0x58f51c>=_0x1afedd){_0x58f51c=_0x1afedd;_0x367dd8=0xc8;}else{_0x367dd8=0xce;}_0x51f56a[_0x3999('0x1f')](_0x367dd8);return _0x51f56a[_0x3999('0x25')]('Content-Range',_0x258f76+'-'+_0x58f51c+'/'+_0x1afedd)[_0x3999('0x20')](_0xdd19a);}return null;};}function patchUpdates(_0x53ea75){return function(_0x28fec1){try{jsonpatch[_0x3999('0x26')](_0x28fec1,_0x53ea75,!![]);}catch(_0xf34704){return BPromise[_0x3999('0x27')](_0xf34704);}return _0x28fec1[_0x3999('0x28')]();};}function saveUpdates(_0x553535,_0x4f9096){return function(_0x1e8c9d){if(_0x1e8c9d){return _0x1e8c9d[_0x3999('0x29')](_0x553535)[_0x3999('0x2a')](function(_0x11a394){return _0x11a394;});}return null;};}function removeEntity(_0xedc3db,_0x5f3883){return function(_0xf9749b){if(_0xf9749b){return _0xf9749b[_0x3999('0x2b')]()[_0x3999('0x2a')](function(){var _0xe8ed9e=_0xf9749b[_0x3999('0x2c')]({'plain':!![]});var _0x23bfef=_0x3999('0x2d');return db[_0x3999('0x2e')]['destroy']({'where':{'type':_0x23bfef,'resourceId':_0xe8ed9e['id']}})[_0x3999('0x2a')](function(){return _0xf9749b;});})[_0x3999('0x2a')](function(){_0xedc3db[_0x3999('0x1f')](0xcc)[_0x3999('0x1e')]();});}};}function handleEntityNotFound(_0xe22b0a,_0x5937ef){return function(_0x2994b7){if(!_0x2994b7){_0xe22b0a[_0x3999('0x1d')](0x194);}return _0x2994b7;};}function handleError(_0x516e0f,_0x593e8e){_0x593e8e=_0x593e8e||0x1f4;return function(_0x5ba951){logger[_0x3999('0x2f')](_0x5ba951[_0x3999('0x30')]);if(_0x5ba951[_0x3999('0x31')]){delete _0x5ba951[_0x3999('0x31')];}_0x516e0f[_0x3999('0x1f')](_0x593e8e)[_0x3999('0x32')](_0x5ba951);};}exports['index']=function(_0x4ec8b0,_0x451162){var _0x40b327={},_0x231673={},_0x1edce3={'count':0x0,'rows':[]};var _0x92d8cd=_['map'](db['MailQueue'][_0x3999('0x33')],function(_0x451e3a){return{'name':_0x451e3a[_0x3999('0x34')],'type':_0x451e3a['type']['key']};});_0x231673[_0x3999('0x35')]=_[_0x3999('0x36')](_0x92d8cd,_0x3999('0x31'));_0x231673[_0x3999('0x37')]=_[_0x3999('0x38')](_0x4ec8b0[_0x3999('0x37')]);_0x231673[_0x3999('0x39')]=_[_0x3999('0x3a')](_0x231673[_0x3999('0x35')],_0x231673[_0x3999('0x37')]);_0x40b327[_0x3999('0x3b')]=_[_0x3999('0x3a')](_0x231673['model'],qs['fields'](_0x4ec8b0[_0x3999('0x37')][_0x3999('0x3c')]));_0x40b327[_0x3999('0x3b')]=_0x40b327[_0x3999('0x3b')][_0x3999('0x3d')]?_0x40b327['attributes']:_0x231673[_0x3999('0x35')];if(!_0x4ec8b0[_0x3999('0x37')][_0x3999('0x3e')]('nolimit')){_0x40b327[_0x3999('0x22')]=qs[_0x3999('0x22')](_0x4ec8b0[_0x3999('0x37')]['limit']);_0x40b327[_0x3999('0x24')]=qs['offset'](_0x4ec8b0['query'][_0x3999('0x24')]);}_0x40b327[_0x3999('0x3f')]=qs[_0x3999('0x40')](_0x4ec8b0[_0x3999('0x37')]['sort']);_0x40b327[_0x3999('0x41')]=qs[_0x3999('0x39')](_[_0x3999('0x42')](_0x4ec8b0[_0x3999('0x37')],_0x231673[_0x3999('0x39')]),_0x92d8cd);if(_0x4ec8b0['query'][_0x3999('0x43')]){_0x40b327[_0x3999('0x41')]=_['merge'](_0x40b327[_0x3999('0x41')],{'$or':_[_0x3999('0x36')](_0x92d8cd,function(_0x42a677){if(_0x42a677[_0x3999('0x44')]!==_0x3999('0x45')){var _0x354c31={};_0x354c31[_0x42a677[_0x3999('0x31')]]={'$like':'%'+_0x4ec8b0[_0x3999('0x37')][_0x3999('0x43')]+'%'};return _0x354c31;}})});}_0x40b327=_[_0x3999('0x46')]({},_0x40b327,_0x4ec8b0[_0x3999('0x47')]);var _0x5d1b38={'where':_0x40b327[_0x3999('0x41')]};return db['MailQueue'][_0x3999('0x23')](_0x5d1b38)[_0x3999('0x2a')](function(_0x15ddcb){_0x1edce3[_0x3999('0x23')]=_0x15ddcb;if(_0x4ec8b0['query'][_0x3999('0x48')]){_0x40b327[_0x3999('0x49')]=[{'all':!![]}];}return db[_0x3999('0x4a')]['findAll'](_0x40b327);})[_0x3999('0x2a')](function(_0x29f24b){_0x1edce3[_0x3999('0x4b')]=_0x29f24b;return _0x1edce3;})[_0x3999('0x2a')](respondWithFilteredResult(_0x451162,_0x40b327))[_0x3999('0x4c')](handleError(_0x451162,null));};exports[_0x3999('0x4d')]=function(_0x4d4847,_0xe3b503){var _0x5049be={'raw':!![],'where':{'id':_0x4d4847['params']['id']}},_0x10c3b1={};_0x10c3b1[_0x3999('0x35')]=_[_0x3999('0x38')](db[_0x3999('0x4a')]['rawAttributes']);_0x10c3b1[_0x3999('0x37')]=_[_0x3999('0x38')](_0x4d4847[_0x3999('0x37')]);_0x10c3b1[_0x3999('0x39')]=_[_0x3999('0x3a')](_0x10c3b1[_0x3999('0x35')],_0x10c3b1[_0x3999('0x37')]);_0x5049be[_0x3999('0x3b')]=_[_0x3999('0x3a')](_0x10c3b1[_0x3999('0x35')],qs[_0x3999('0x3c')](_0x4d4847[_0x3999('0x37')][_0x3999('0x3c')]));_0x5049be[_0x3999('0x3b')]=_0x5049be[_0x3999('0x3b')][_0x3999('0x3d')]?_0x5049be[_0x3999('0x3b')]:_0x10c3b1[_0x3999('0x35')];if(_0x4d4847[_0x3999('0x37')][_0x3999('0x48')]){_0x5049be[_0x3999('0x49')]=[{'all':!![]}];}_0x5049be=_[_0x3999('0x46')]({},_0x5049be,_0x4d4847['options']);return db[_0x3999('0x4a')][_0x3999('0x4e')](_0x5049be)['then'](handleEntityNotFound(_0xe3b503,null))[_0x3999('0x2a')](respondWithResult(_0xe3b503,null))[_0x3999('0x4c')](handleError(_0xe3b503,null));};exports['create']=function(_0x1d3f92,_0x199b84){return db['MailQueue'][_0x3999('0x4f')](_0x1d3f92['body'],{})[_0x3999('0x2a')](function(_0x281ef4){var _0x34c650=_0x1d3f92[_0x3999('0x50')][_0x3999('0x2c')]({'plain':!![]});if(!_0x34c650)throw new Error(_0x3999('0x51'));if(_0x34c650[_0x3999('0x52')]===_0x3999('0x50')){var _0x9b3aed=_0x281ef4['get']({'plain':!![]});var _0x5162c0=_0x3999('0x2d');return db[_0x3999('0x53')][_0x3999('0x4e')]({'where':{'name':_0x5162c0,'userProfileId':_0x34c650[_0x3999('0x54')]},'raw':!![]})['then'](function(_0x3deb72){if(_0x3deb72&&_0x3deb72[_0x3999('0x55')]===0x0){return db['UserProfileResource'][_0x3999('0x4f')]({'name':_0x9b3aed[_0x3999('0x31')],'resourceId':_0x9b3aed['id'],'type':_0x3deb72['name'],'sectionId':_0x3deb72['id']},{})[_0x3999('0x2a')](function(){return _0x281ef4;});}else{return _0x281ef4;}})[_0x3999('0x4c')](function(_0x49f12d){logger[_0x3999('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49f12d);throw _0x49f12d;});}return _0x281ef4;})[_0x3999('0x2a')](respondWithResult(_0x199b84,0xc9))['catch'](handleError(_0x199b84,null));};exports[_0x3999('0x29')]=function(_0x209391,_0x1ba1b5){if(_0x209391[_0x3999('0x56')]['id']){delete _0x209391[_0x3999('0x56')]['id'];}return db[_0x3999('0x4a')][_0x3999('0x4e')]({'where':{'id':_0x209391[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](handleEntityNotFound(_0x1ba1b5,null))[_0x3999('0x2a')](saveUpdates(_0x209391['body'],null))['then'](respondWithResult(_0x1ba1b5,null))[_0x3999('0x4c')](handleError(_0x1ba1b5,null));};exports[_0x3999('0x2b')]=function(_0x2a3718,_0x1b8a1d){return db['MailQueue'][_0x3999('0x4e')]({'where':{'id':_0x2a3718[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](handleEntityNotFound(_0x1b8a1d,null))[_0x3999('0x2a')](removeEntity(_0x1b8a1d,null))[_0x3999('0x4c')](handleError(_0x1b8a1d,null));};exports['describe']=function(_0x5226fa,_0x218a79){return db[_0x3999('0x4a')][_0x3999('0x58')]()[_0x3999('0x2a')](respondWithResult(_0x218a79,null))[_0x3999('0x4c')](handleError(_0x218a79,null));};exports[_0x3999('0x59')]=function(_0xc1549a,_0x7acf13,_0xf06f94){var _0x45d7e1={'raw':!![],'where':{}},_0x3d4ed4={},_0x4749b7;return db['MailQueue'][_0x3999('0x5a')]({'where':{'id':_0xc1549a[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](handleEntityNotFound(_0x7acf13,null))['then'](function(_0x22f2a6){if(_0x22f2a6){_0x4749b7=_0x22f2a6[_0x3999('0x2c')]({'plain':!![]});_0x3d4ed4[_0x3999('0x35')]=_[_0x3999('0x38')](db[_0x3999('0x5b')][_0x3999('0x33')]);_0x3d4ed4[_0x3999('0x37')]=_[_0x3999('0x38')](_0xc1549a['query']);_0x3d4ed4[_0x3999('0x39')]=_[_0x3999('0x3a')](_0x3d4ed4[_0x3999('0x35')],_0x3d4ed4[_0x3999('0x37')]);_0x45d7e1[_0x3999('0x3b')]=_[_0x3999('0x3a')](_0x3d4ed4[_0x3999('0x35')],qs[_0x3999('0x3c')](_0xc1549a[_0x3999('0x37')][_0x3999('0x3c')]));_0x45d7e1[_0x3999('0x3b')]=_0x45d7e1[_0x3999('0x3b')][_0x3999('0x3d')]?_0x45d7e1['attributes']:_0x3d4ed4[_0x3999('0x35')];if(!_0xc1549a[_0x3999('0x37')]['hasOwnProperty'](_0x3999('0x5c'))){_0x45d7e1[_0x3999('0x22')]=qs[_0x3999('0x22')](_0xc1549a[_0x3999('0x37')][_0x3999('0x22')]);_0x45d7e1[_0x3999('0x24')]=qs[_0x3999('0x24')](_0xc1549a[_0x3999('0x37')][_0x3999('0x24')]);}_0x45d7e1[_0x3999('0x3f')]=qs[_0x3999('0x40')](_0xc1549a[_0x3999('0x37')][_0x3999('0x40')]);_0x45d7e1[_0x3999('0x41')]=qs[_0x3999('0x39')](_[_0x3999('0x42')](_0xc1549a[_0x3999('0x37')],_0x3d4ed4['filters']));_0x45d7e1[_0x3999('0x41')][_0x3999('0x5d')]=_0x22f2a6['id'];if(_0xc1549a['query'][_0x3999('0x43')]){_0x45d7e1['where']=_[_0x3999('0x46')](_0x45d7e1[_0x3999('0x41')],{'$or':_[_0x3999('0x36')](_0x45d7e1[_0x3999('0x3b')],function(_0x296d04){var _0x564822={};_0x564822[_0x296d04]={'$like':'%'+_0xc1549a[_0x3999('0x37')][_0x3999('0x43')]+'%'};return _0x564822;})});}_0x45d7e1=_[_0x3999('0x46')]({},_0x45d7e1,_0xc1549a[_0x3999('0x47')]);return db[_0x3999('0x5b')][_0x3999('0x5e')](_0x45d7e1);}})[_0x3999('0x2a')](function(_0x16c7f4){if(_0x16c7f4){return db[_0x3999('0x5f')][_0x3999('0x60')]({'where':{'id':_['map'](_0x16c7f4,_0x3999('0x61')),'role':'agent'},'attributes':['id',_0x3999('0x31'),'mailPause','updatedAt',_0x3999('0x62')]});}})['then'](function(_0x516b18){if(_0x516b18){return{'count':_0x516b18[_0x3999('0x23')],'rows':_['map'](_0x516b18[_0x3999('0x4b')],function(_0x3a5c75){return{'membername':_0x3a5c75[_0x3999('0x31')],'UserId':_0x3a5c75['id'],'queue_name':_0x4749b7[_0x3999('0x31')],'MailQueueId':_0x4749b7['id'],'interface':util['format'](_0x3999('0x63'),_0x3999('0x64'),_0x3a5c75[_0x3999('0x31')]),'penalty':0x0,'paused':_0x3a5c75['mailPause'],'createdAt':_0x3a5c75[_0x3999('0x62')],'updatedAt':_0x3a5c75[_0x3999('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3999('0x2a')](respondWithFilteredResult(_0x7acf13,_0x45d7e1))[_0x3999('0x4c')](handleError(_0x7acf13,null));};exports['getTeams']=function(_0x1873ad,_0x46293c,_0x18ef13){var _0x28666b={};var _0x3bbc79={};var _0x5431ab;var _0x28b8f2;return db['MailQueue']['findOne']({'where':{'id':_0x1873ad['params']['id']}})['then'](handleEntityNotFound(_0x46293c,null))['then'](function(_0x596962){if(_0x596962){_0x5431ab=_0x596962;_0x3bbc79[_0x3999('0x35')]=_[_0x3999('0x38')](db[_0x3999('0x66')][_0x3999('0x33')]);_0x3bbc79[_0x3999('0x37')]=_[_0x3999('0x38')](_0x1873ad[_0x3999('0x37')]);_0x3bbc79['filters']=_[_0x3999('0x3a')](_0x3bbc79['model'],_0x3bbc79['query']);_0x28666b[_0x3999('0x3b')]=_[_0x3999('0x3a')](_0x3bbc79[_0x3999('0x35')],qs[_0x3999('0x3c')](_0x1873ad[_0x3999('0x37')][_0x3999('0x3c')]));_0x28666b[_0x3999('0x3b')]=_0x28666b[_0x3999('0x3b')][_0x3999('0x3d')]?_0x28666b[_0x3999('0x3b')]:_0x3bbc79[_0x3999('0x35')];_0x28666b[_0x3999('0x3f')]=qs['sort'](_0x1873ad[_0x3999('0x37')][_0x3999('0x40')]);_0x28666b[_0x3999('0x41')]=qs[_0x3999('0x39')](_[_0x3999('0x42')](_0x1873ad[_0x3999('0x37')],_0x3bbc79['filters']));if(_0x1873ad[_0x3999('0x37')][_0x3999('0x43')]){_0x28666b[_0x3999('0x41')]=_[_0x3999('0x46')](_0x28666b[_0x3999('0x41')],{'$or':_['map'](_0x28666b[_0x3999('0x3b')],function(_0x567326){var _0x206336={};_0x206336[_0x567326]={'$like':'%'+_0x1873ad[_0x3999('0x37')][_0x3999('0x43')]+'%'};return _0x206336;})});}_0x28666b=_[_0x3999('0x46')]({},_0x28666b,_0x1873ad[_0x3999('0x47')]);return _0x5431ab['getTeams'](_0x28666b);}})[_0x3999('0x2a')](function(_0x1898d7){if(_0x1898d7){_0x28b8f2=_0x1898d7['length'];if(!_0x1873ad['query'][_0x3999('0x3e')]('nolimit')){_0x28666b[_0x3999('0x22')]=qs[_0x3999('0x22')](_0x1873ad['query']['limit']);_0x28666b[_0x3999('0x24')]=qs[_0x3999('0x24')](_0x1873ad[_0x3999('0x37')][_0x3999('0x24')]);}return _0x5431ab[_0x3999('0x67')](_0x28666b);}})[_0x3999('0x2a')](function(_0x578987){if(_0x578987){return _0x578987?{'count':_0x28b8f2,'rows':_0x578987}:null;}})[_0x3999('0x2a')](respondWithResult(_0x46293c,null))[_0x3999('0x4c')](handleError(_0x46293c,null));};exports[_0x3999('0x68')]=function(_0x2e3aa1,_0x571be3,_0x3c1b77){var _0x33a35d=_0x2e3aa1[_0x3999('0x56')][_0x3999('0x69')];return db[_0x3999('0x66')][_0x3999('0x5e')]({'where':{'id':_0x33a35d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x3999('0x31'),_0x3999('0x6a'),_0x3999('0x6b'),_0x3999('0x6c')],'raw':!![]}]})[_0x3999('0x2a')](function(_0x52544d){if(_0x52544d){var _0x535ab4=_[_0x3999('0x6d')](_0x52544d,function(_0x220d51){var _0x124ec1=_0x220d51[_0x3999('0x2c')]({'plain':!![]});return _0x124ec1[_0x3999('0x6e')];});return db['MailQueue'][_0x3999('0x4e')]({'where':{'id':_0x2e3aa1[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](function(_0x1356a7){return db[_0x3999('0x6f')]['transaction'](function(_0x40a8e6){return _0x1356a7['addTeams'](_0x33a35d,{'transaction':_0x40a8e6})[_0x3999('0x2a')](function(){return BPromise[_0x3999('0x70')](_0x535ab4,function(_0xf38953){return db['UserMailQueue'][_0x3999('0x71')]({'where':{'UserId':_0xf38953['id'],'MailQueueId':_0x2e3aa1['params']['id']},'transaction':_0x40a8e6});});})[_0x3999('0x2a')](function(){_0x535ab4[_0x3999('0x72')](function(_0xc79567){socket[_0x3999('0x73')]('userMailQueue:save',{'UserId':_0xc79567['id'],'MailQueueId':_0x1356a7['id']});});});});});}})[_0x3999('0x2a')](respondWithStatusCode(_0x571be3,null))[_0x3999('0x4c')](handleError(_0x571be3,null));};exports[_0x3999('0x74')]=function(_0x43e215,_0x39d631,_0x2011d6){return db[_0x3999('0x66')][_0x3999('0x5e')]({'where':{'id':_0x43e215['query'][_0x3999('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3999('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x3999('0x2a')](handleEntityNotFound(_0x39d631,null))[_0x3999('0x2a')](function(_0xd36b77){var _0x17b666=_[_0x3999('0x36')](_0xd36b77,'id');var _0x2df2d8=[];var _0x4720d3=[];var _0x217821=squel[_0x3999('0x75')]();_0x217821['field'](_0x3999('0x76'))['from'](_0x3999('0x77'),'tq')['join'](_0x3999('0x78'),'ut',_0x3999('0x79'))[_0x3999('0x41')]('MailQueueId\x20=\x20?',_0x43e215[_0x3999('0x57')]['id']);for(var _0x2cfbec=0x0;_0x2cfbec<_0xd36b77[_0x3999('0x3d')];_0x2cfbec+=0x1){let _0x5f1fb1=_0xd36b77[_0x2cfbec];for(var _0x5ae683=0x0;_0x5ae683<_0x5f1fb1[_0x3999('0x6e')]['length'];_0x5ae683+=0x1){let _0x4c9e09=_0x5f1fb1[_0x3999('0x6e')][_0x5ae683];var _0x58392c=_0x217821[_0x3999('0x7a')]();_0x58392c[_0x3999('0x41')]('ut.UserId\x20=\x20?',_0x4c9e09['id']);_0x4720d3['push'](db['sequelize']['query'](_0x58392c['toString'](),{'type':db[_0x3999('0x6f')][_0x3999('0x7b')]['SELECT']})[_0x3999('0x2a')](function(_0x443a58){if(_0x443a58[_0x3999('0x3d')]===0x1){return _0x4c9e09['id'];}else{var _0x205d12=_[_0x3999('0x7c')](_[_0x3999('0x36')](_0x443a58,_0x3999('0x7d')),function(_0x93f2ae){return _[_0x3999('0x7e')](_0x17b666,_0x93f2ae);});if(_0x205d12){return _0x4c9e09['id'];}}}));}}return BPromise[_0x3999('0x7f')](_0x4720d3)[_0x3999('0x2a')](function(_0xa94c42){_0x2df2d8=_(_0x2df2d8)[_0x3999('0x80')](_0xa94c42)[_0x3999('0x81')]()[_0x3999('0x82')]();return db[_0x3999('0x4a')][_0x3999('0x4e')]({'where':{'id':_0x43e215[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](function(_0x53ee22){return db[_0x3999('0x6f')][_0x3999('0x83')](function(_0x54bfd5){return _0x53ee22['removeTeams'](_0x43e215['query']['ids'],{'transaction':_0x54bfd5})['then'](function(){if(!_[_0x3999('0x84')](_0x2df2d8)){return _0x53ee22['removeAgents'](_0x2df2d8,{'transaction':_0x54bfd5});}})[_0x3999('0x2a')](function(){_0x2df2d8[_0x3999('0x72')](function(_0xc2174b){socket[_0x3999('0x73')]('userMailQueue:remove',{'UserId':_0xc2174b,'MailQueueId':_0x53ee22['id']});});});});});});})['then'](respondWithStatusCode(_0x39d631,null))[_0x3999('0x4c')](handleError(_0x39d631,null));};exports['addAgents']=function(_0x2c0c3d,_0x5ba21a,_0x20a119){return db[_0x3999('0x4a')]['find']({'where':{'id':_0x2c0c3d[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](handleEntityNotFound(_0x5ba21a,null))[_0x3999('0x2a')](function(_0x20a6fe){if(_0x20a6fe){return _0x20a6fe[_0x3999('0x85')](_0x2c0c3d[_0x3999('0x56')][_0x3999('0x69')],_['omit'](_0x2c0c3d[_0x3999('0x56')],[_0x3999('0x69'),'id'])||{})['spread'](function(_0x1b953b){for(var _0x4dbd01=0x0;_0x4dbd01<_0x2c0c3d[_0x3999('0x56')]['ids']['length'];_0x4dbd01+=0x1){socket[_0x3999('0x73')](_0x3999('0x86'),{'UserId':Number(_0x2c0c3d[_0x3999('0x56')][_0x3999('0x69')][_0x4dbd01]),'MailQueueId':Number(_0x2c0c3d[_0x3999('0x57')]['id'])});}return _0x1b953b;});}})['then'](respondWithResult(_0x5ba21a,null))[_0x3999('0x4c')](handleError(_0x5ba21a,null));};exports[_0x3999('0x87')]=function(_0x39b671,_0x5a6cd5,_0x3581b6){return db[_0x3999('0x4a')][_0x3999('0x4e')]({'where':{'id':_0x39b671[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](handleEntityNotFound(_0x5a6cd5,null))[_0x3999('0x2a')](function(_0x22b5be){if(_0x22b5be){return _0x22b5be['removeAgents'](_0x39b671[_0x3999('0x37')][_0x3999('0x69')])[_0x3999('0x2a')](function(){if(_[_0x3999('0x88')](_0x39b671[_0x3999('0x37')]['ids'])){for(var _0x5f1a74=0x0;_0x5f1a74<_0x39b671[_0x3999('0x37')][_0x3999('0x69')][_0x3999('0x3d')];_0x5f1a74+=0x1){socket[_0x3999('0x73')]('userMailQueue:remove',{'UserId':Number(_0x39b671[_0x3999('0x37')][_0x3999('0x69')][_0x5f1a74]),'MailQueueId':Number(_0x39b671['params']['id'])});}}else{socket['emit'](_0x3999('0x89'),{'UserId':Number(_0x39b671[_0x3999('0x37')]['ids']),'MailQueueId':Number(_0x39b671[_0x3999('0x57')]['id'])});}});}})[_0x3999('0x2a')](respondWithStatusCode(_0x5a6cd5,null))[_0x3999('0x4c')](handleError(_0x5a6cd5,null));};exports[_0x3999('0x8a')]=function(_0x46c553,_0x25bfe1,_0x475003){var _0x1acec3={};var _0x712c8a={};var _0x5303b0;var _0x141484;return db[_0x3999('0x4a')]['findOne']({'where':{'id':_0x46c553[_0x3999('0x57')]['id']}})[_0x3999('0x2a')](handleEntityNotFound(_0x25bfe1,null))[_0x3999('0x2a')](function(_0x4d70cf){if(_0x4d70cf){_0x5303b0=_0x4d70cf;_0x712c8a['model']=_[_0x3999('0x38')](db[_0x3999('0x5f')][_0x3999('0x33')]);_0x712c8a['query']=_[_0x3999('0x38')](_0x46c553[_0x3999('0x37')]);_0x712c8a['filters']=_[_0x3999('0x3a')](_0x712c8a[_0x3999('0x35')],_0x712c8a[_0x3999('0x37')]);_0x1acec3[_0x3999('0x3b')]=_[_0x3999('0x3a')](_0x712c8a[_0x3999('0x35')],qs['fields'](_0x46c553['query'][_0x3999('0x3c')]));_0x1acec3[_0x3999('0x3b')]=_0x1acec3['attributes']['length']?_0x1acec3['attributes']:_0x712c8a['model'];_0x1acec3[_0x3999('0x3f')]=qs['sort'](_0x46c553[_0x3999('0x37')]['sort']);_0x1acec3['where']=qs[_0x3999('0x39')](_['pick'](_0x46c553[_0x3999('0x37')],_0x712c8a[_0x3999('0x39')]));if(_0x46c553[_0x3999('0x37')][_0x3999('0x43')]){_0x1acec3[_0x3999('0x41')]=_['merge'](_0x1acec3[_0x3999('0x41')],{'$or':_[_0x3999('0x36')](_0x1acec3[_0x3999('0x3b')],function(_0x4114cc){var _0x4b8ebe={};_0x4b8ebe[_0x4114cc]={'$like':'%'+_0x46c553[_0x3999('0x37')][_0x3999('0x43')]+'%'};return _0x4b8ebe;})});}_0x1acec3=_[_0x3999('0x46')]({},_0x1acec3,_0x46c553['options']);return _0x5303b0['getAgents'](_0x1acec3);}})[_0x3999('0x2a')](function(_0x531a7e){if(_0x531a7e){_0x141484=_0x531a7e['length'];if(!_0x46c553['query'][_0x3999('0x3e')](_0x3999('0x5c'))){_0x1acec3['limit']=qs['limit'](_0x46c553[_0x3999('0x37')]['limit']);_0x1acec3[_0x3999('0x24')]=qs['offset'](_0x46c553[_0x3999('0x37')][_0x3999('0x24')]);}return _0x5303b0['getAgents'](_0x1acec3);}})[_0x3999('0x2a')](function(_0x61d053){if(_0x61d053){return _0x61d053?{'count':_0x141484,'rows':_0x61d053}:null;}})[_0x3999('0x2a')](respondWithResult(_0x25bfe1,null))[_0x3999('0x4c')](handleError(_0x25bfe1,null));}; \ No newline at end of file +var _0x7aa0=['from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','union','value','removeAgents','forEach','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','MailQueue','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','mailPause','getTeams','Team','pick','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7aa0,0x1b9));var _0x07aa=function(_0x9f86c2,_0x8ce37e){_0x9f86c2=_0x9f86c2-0x0;var _0x55d092=_0x7aa0[_0x9f86c2];return _0x55d092;};'use strict';var emlformat=require(_0x07aa('0x0'));var rimraf=require(_0x07aa('0x1'));var zipdir=require(_0x07aa('0x2'));var jsonpatch=require(_0x07aa('0x3'));var rp=require(_0x07aa('0x4'));var moment=require('moment');var BPromise=require(_0x07aa('0x5'));var Mustache=require(_0x07aa('0x6'));var util=require(_0x07aa('0x7'));var path=require(_0x07aa('0x8'));var sox=require(_0x07aa('0x9'));var csv=require(_0x07aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07aa('0xb'));var _=require(_0x07aa('0xc'));var squel=require(_0x07aa('0xd'));var crypto=require(_0x07aa('0xe'));var jsforce=require(_0x07aa('0xf'));var deskjs=require(_0x07aa('0x10'));var toCsv=require(_0x07aa('0xa'));var querystring=require(_0x07aa('0x11'));var Papa=require('papaparse');var Redis=require(_0x07aa('0x12'));var authService=require(_0x07aa('0x13'));var qs=require(_0x07aa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07aa('0x15'));var logger=require(_0x07aa('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x07aa('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x07aa('0x18'))['db'];config[_0x07aa('0x19')]=_['defaults'](config[_0x07aa('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x07aa('0x1a'))(new Redis(config[_0x07aa('0x19')]));require('./mailQueue.socket')[_0x07aa('0x1b')](socket);function respondWithStatusCode(_0x51f5f3,_0x5747df){_0x5747df=_0x5747df||0xcc;return function(_0x260060){if(_0x260060){return _0x51f5f3[_0x07aa('0x1c')](_0x5747df);}return _0x51f5f3[_0x07aa('0x1d')](_0x5747df)[_0x07aa('0x1e')]();};}function respondWithResult(_0x2c1e3b,_0x5a13d4){_0x5a13d4=_0x5a13d4||0xc8;return function(_0x388efc){if(_0x388efc){return _0x2c1e3b[_0x07aa('0x1d')](_0x5a13d4)[_0x07aa('0x1f')](_0x388efc);}};}function respondWithFilteredResult(_0x426b2a,_0x89853f){return function(_0x34a89f){if(_0x34a89f){var _0x51d51a=typeof _0x89853f[_0x07aa('0x20')]===_0x07aa('0x21')&&typeof _0x89853f[_0x07aa('0x22')]===_0x07aa('0x21');var _0xee0fec=_0x34a89f[_0x07aa('0x23')];var _0x1af9b1=_0x51d51a?0x0:_0x89853f[_0x07aa('0x20')];var _0x3cdc98=_0x51d51a?_0x34a89f[_0x07aa('0x23')]:_0x89853f[_0x07aa('0x20')]+_0x89853f[_0x07aa('0x22')];var _0x433071;if(_0x3cdc98>=_0xee0fec){_0x3cdc98=_0xee0fec;_0x433071=0xc8;}else{_0x433071=0xce;}_0x426b2a['status'](_0x433071);return _0x426b2a['set'](_0x07aa('0x24'),_0x1af9b1+'-'+_0x3cdc98+'/'+_0xee0fec)[_0x07aa('0x1f')](_0x34a89f);}return null;};}function patchUpdates(_0xa2be5b){return function(_0x411621){try{jsonpatch[_0x07aa('0x25')](_0x411621,_0xa2be5b,!![]);}catch(_0x3b8fc8){return BPromise[_0x07aa('0x26')](_0x3b8fc8);}return _0x411621['save']();};}function saveUpdates(_0x38578f,_0x2feb52){return function(_0x2ec222){if(_0x2ec222){return _0x2ec222[_0x07aa('0x27')](_0x38578f)['then'](function(_0x5175c8){return _0x5175c8;});}return null;};}function removeEntity(_0x599680,_0x4e11af){return function(_0xa1944f){if(_0xa1944f){return _0xa1944f[_0x07aa('0x28')]()[_0x07aa('0x29')](function(){var _0x412674=_0xa1944f[_0x07aa('0x2a')]({'plain':!![]});var _0x54c756=_0x07aa('0x2b');return db[_0x07aa('0x2c')][_0x07aa('0x28')]({'where':{'type':_0x54c756,'resourceId':_0x412674['id']}})[_0x07aa('0x29')](function(){return _0xa1944f;});})['then'](function(){_0x599680['status'](0xcc)[_0x07aa('0x1e')]();});}};}function handleEntityNotFound(_0x2a254d,_0x5712ed){return function(_0x53ee43){if(!_0x53ee43){_0x2a254d[_0x07aa('0x1c')](0x194);}return _0x53ee43;};}function handleError(_0x1f7203,_0x155979){_0x155979=_0x155979||0x1f4;return function(_0x2355f6){logger[_0x07aa('0x2d')](_0x2355f6[_0x07aa('0x2e')]);if(_0x2355f6[_0x07aa('0x2f')]){delete _0x2355f6[_0x07aa('0x2f')];}_0x1f7203['status'](_0x155979)['send'](_0x2355f6);};}exports[_0x07aa('0x30')]=function(_0x11e098,_0x58d782){var _0x15282d={},_0x3762f7={},_0x794e0d={'count':0x0,'rows':[]};var _0x4424d4=_[_0x07aa('0x31')](db['MailQueue'][_0x07aa('0x32')],function(_0x33e61d){return{'name':_0x33e61d[_0x07aa('0x33')],'type':_0x33e61d[_0x07aa('0x34')][_0x07aa('0x35')]};});_0x3762f7[_0x07aa('0x36')]=_[_0x07aa('0x31')](_0x4424d4,_0x07aa('0x2f'));_0x3762f7[_0x07aa('0x37')]=_[_0x07aa('0x38')](_0x11e098[_0x07aa('0x37')]);_0x3762f7[_0x07aa('0x39')]=_[_0x07aa('0x3a')](_0x3762f7['model'],_0x3762f7[_0x07aa('0x37')]);_0x15282d[_0x07aa('0x3b')]=_[_0x07aa('0x3a')](_0x3762f7['model'],qs[_0x07aa('0x3c')](_0x11e098[_0x07aa('0x37')][_0x07aa('0x3c')]));_0x15282d[_0x07aa('0x3b')]=_0x15282d[_0x07aa('0x3b')][_0x07aa('0x3d')]?_0x15282d[_0x07aa('0x3b')]:_0x3762f7[_0x07aa('0x36')];if(!_0x11e098[_0x07aa('0x37')]['hasOwnProperty'](_0x07aa('0x3e'))){_0x15282d[_0x07aa('0x22')]=qs[_0x07aa('0x22')](_0x11e098[_0x07aa('0x37')]['limit']);_0x15282d[_0x07aa('0x20')]=qs['offset'](_0x11e098[_0x07aa('0x37')]['offset']);}_0x15282d[_0x07aa('0x3f')]=qs[_0x07aa('0x40')](_0x11e098[_0x07aa('0x37')][_0x07aa('0x40')]);_0x15282d['where']=qs[_0x07aa('0x39')](_['pick'](_0x11e098[_0x07aa('0x37')],_0x3762f7[_0x07aa('0x39')]),_0x4424d4);if(_0x11e098['query'][_0x07aa('0x41')]){_0x15282d[_0x07aa('0x42')]=_[_0x07aa('0x43')](_0x15282d[_0x07aa('0x42')],{'$or':_[_0x07aa('0x31')](_0x4424d4,function(_0x194366){if(_0x194366[_0x07aa('0x34')]!==_0x07aa('0x44')){var _0x28691b={};_0x28691b[_0x194366[_0x07aa('0x2f')]]={'$like':'%'+_0x11e098['query']['filter']+'%'};return _0x28691b;}})});}_0x15282d=_[_0x07aa('0x43')]({},_0x15282d,_0x11e098[_0x07aa('0x45')]);var _0x2f09c5={'where':_0x15282d[_0x07aa('0x42')]};return db['MailQueue'][_0x07aa('0x23')](_0x2f09c5)[_0x07aa('0x29')](function(_0xf702ae){_0x794e0d[_0x07aa('0x23')]=_0xf702ae;if(_0x11e098[_0x07aa('0x37')][_0x07aa('0x46')]){_0x15282d[_0x07aa('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0x07aa('0x48')](_0x15282d);})[_0x07aa('0x29')](function(_0x4205d0){_0x794e0d[_0x07aa('0x49')]=_0x4205d0;return _0x794e0d;})['then'](respondWithFilteredResult(_0x58d782,_0x15282d))[_0x07aa('0x4a')](handleError(_0x58d782,null));};exports[_0x07aa('0x4b')]=function(_0x357c99,_0xbda6ce){var _0x5472b8={'raw':!![],'where':{'id':_0x357c99[_0x07aa('0x4c')]['id']}},_0x53644d={};_0x53644d[_0x07aa('0x36')]=_[_0x07aa('0x38')](db['MailQueue'][_0x07aa('0x32')]);_0x53644d[_0x07aa('0x37')]=_['keys'](_0x357c99[_0x07aa('0x37')]);_0x53644d['filters']=_[_0x07aa('0x3a')](_0x53644d[_0x07aa('0x36')],_0x53644d[_0x07aa('0x37')]);_0x5472b8[_0x07aa('0x3b')]=_['intersection'](_0x53644d['model'],qs[_0x07aa('0x3c')](_0x357c99[_0x07aa('0x37')][_0x07aa('0x3c')]));_0x5472b8[_0x07aa('0x3b')]=_0x5472b8[_0x07aa('0x3b')]['length']?_0x5472b8[_0x07aa('0x3b')]:_0x53644d[_0x07aa('0x36')];if(_0x357c99[_0x07aa('0x37')]['includeAll']){_0x5472b8['include']=[{'all':!![]}];}_0x5472b8=_[_0x07aa('0x43')]({},_0x5472b8,_0x357c99['options']);return db[_0x07aa('0x4d')][_0x07aa('0x4e')](_0x5472b8)['then'](handleEntityNotFound(_0xbda6ce,null))[_0x07aa('0x29')](respondWithResult(_0xbda6ce,null))['catch'](handleError(_0xbda6ce,null));};exports[_0x07aa('0x4f')]=function(_0x3946ec,_0x29de65){return db[_0x07aa('0x4d')][_0x07aa('0x4f')](_0x3946ec['body'],{})['then'](function(_0x4efd86){var _0x33fc90=_0x3946ec[_0x07aa('0x50')][_0x07aa('0x2a')]({'plain':!![]});if(!_0x33fc90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fc90[_0x07aa('0x51')]==='user'){var _0x23d316=_0x4efd86['get']({'plain':!![]});var _0x448bc6=_0x07aa('0x2b');return db[_0x07aa('0x52')][_0x07aa('0x4e')]({'where':{'name':_0x448bc6,'userProfileId':_0x33fc90['userProfileId']},'raw':!![]})['then'](function(_0x21c9b9){if(_0x21c9b9&&_0x21c9b9[_0x07aa('0x53')]===0x0){return db[_0x07aa('0x2c')][_0x07aa('0x4f')]({'name':_0x23d316[_0x07aa('0x2f')],'resourceId':_0x23d316['id'],'type':_0x21c9b9['name'],'sectionId':_0x21c9b9['id']},{})['then'](function(){return _0x4efd86;});}else{return _0x4efd86;}})[_0x07aa('0x4a')](function(_0x3207ae){logger[_0x07aa('0x2d')](_0x07aa('0x54'),_0x3207ae);throw _0x3207ae;});}return _0x4efd86;})[_0x07aa('0x29')](respondWithResult(_0x29de65,0xc9))[_0x07aa('0x4a')](handleError(_0x29de65,null));};exports[_0x07aa('0x27')]=function(_0x40e8e5,_0x460e2c){if(_0x40e8e5['body']['id']){delete _0x40e8e5[_0x07aa('0x55')]['id'];}return db['MailQueue'][_0x07aa('0x4e')]({'where':{'id':_0x40e8e5[_0x07aa('0x4c')]['id']}})[_0x07aa('0x29')](handleEntityNotFound(_0x460e2c,null))[_0x07aa('0x29')](saveUpdates(_0x40e8e5['body'],null))['then'](respondWithResult(_0x460e2c,null))['catch'](handleError(_0x460e2c,null));};exports[_0x07aa('0x28')]=function(_0x59b515,_0x4817e1){return db['MailQueue']['find']({'where':{'id':_0x59b515[_0x07aa('0x4c')]['id']}})[_0x07aa('0x29')](handleEntityNotFound(_0x4817e1,null))[_0x07aa('0x29')](removeEntity(_0x4817e1,null))[_0x07aa('0x4a')](handleError(_0x4817e1,null));};exports[_0x07aa('0x56')]=function(_0xe9047e,_0x34b3b9){return db[_0x07aa('0x4d')][_0x07aa('0x56')]()[_0x07aa('0x29')](respondWithResult(_0x34b3b9,null))[_0x07aa('0x4a')](handleError(_0x34b3b9,null));};exports[_0x07aa('0x57')]=function(_0x4e7aed,_0x47f7aa,_0x2371d6){var _0x51cdcd={'raw':!![],'where':{}},_0x2101ca={},_0x18fcc5;return db[_0x07aa('0x4d')][_0x07aa('0x58')]({'where':{'id':_0x4e7aed[_0x07aa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x47f7aa,null))[_0x07aa('0x29')](function(_0x482872){if(_0x482872){_0x18fcc5=_0x482872[_0x07aa('0x2a')]({'plain':!![]});_0x2101ca[_0x07aa('0x36')]=_[_0x07aa('0x38')](db['UserMailQueue']['rawAttributes']);_0x2101ca['query']=_['keys'](_0x4e7aed[_0x07aa('0x37')]);_0x2101ca['filters']=_['intersection'](_0x2101ca[_0x07aa('0x36')],_0x2101ca[_0x07aa('0x37')]);_0x51cdcd['attributes']=_['intersection'](_0x2101ca['model'],qs[_0x07aa('0x3c')](_0x4e7aed['query'][_0x07aa('0x3c')]));_0x51cdcd[_0x07aa('0x3b')]=_0x51cdcd['attributes'][_0x07aa('0x3d')]?_0x51cdcd[_0x07aa('0x3b')]:_0x2101ca[_0x07aa('0x36')];if(!_0x4e7aed[_0x07aa('0x37')][_0x07aa('0x59')]('nolimit')){_0x51cdcd[_0x07aa('0x22')]=qs['limit'](_0x4e7aed[_0x07aa('0x37')][_0x07aa('0x22')]);_0x51cdcd['offset']=qs[_0x07aa('0x20')](_0x4e7aed[_0x07aa('0x37')]['offset']);}_0x51cdcd[_0x07aa('0x3f')]=qs[_0x07aa('0x40')](_0x4e7aed['query'][_0x07aa('0x40')]);_0x51cdcd[_0x07aa('0x42')]=qs[_0x07aa('0x39')](_['pick'](_0x4e7aed[_0x07aa('0x37')],_0x2101ca[_0x07aa('0x39')]));_0x51cdcd[_0x07aa('0x42')][_0x07aa('0x5a')]=_0x482872['id'];if(_0x4e7aed[_0x07aa('0x37')][_0x07aa('0x41')]){_0x51cdcd[_0x07aa('0x42')]=_['merge'](_0x51cdcd['where'],{'$or':_['map'](_0x51cdcd['attributes'],function(_0x594754){var _0x31ffcd={};_0x31ffcd[_0x594754]={'$like':'%'+_0x4e7aed[_0x07aa('0x37')][_0x07aa('0x41')]+'%'};return _0x31ffcd;})});}_0x51cdcd=_['merge']({},_0x51cdcd,_0x4e7aed['options']);return db[_0x07aa('0x5b')]['findAll'](_0x51cdcd);}})[_0x07aa('0x29')](function(_0xb56c44){if(_0xb56c44){return db[_0x07aa('0x5c')][_0x07aa('0x5d')]({'where':{'id':_[_0x07aa('0x31')](_0xb56c44,_0x07aa('0x5e')),'role':'agent'},'attributes':['id',_0x07aa('0x2f'),'mailPause',_0x07aa('0x5f'),_0x07aa('0x60')]});}})[_0x07aa('0x29')](function(_0x3b0760){if(_0x3b0760){return{'count':_0x3b0760[_0x07aa('0x23')],'rows':_[_0x07aa('0x31')](_0x3b0760['rows'],function(_0x3c9250){return{'membername':_0x3c9250['name'],'UserId':_0x3c9250['id'],'queue_name':_0x18fcc5[_0x07aa('0x2f')],'MailQueueId':_0x18fcc5['id'],'interface':util[_0x07aa('0x61')](_0x07aa('0x62'),_0x07aa('0x63'),_0x3c9250[_0x07aa('0x2f')]),'penalty':0x0,'paused':_0x3c9250[_0x07aa('0x64')],'createdAt':_0x3c9250[_0x07aa('0x60')],'updatedAt':_0x3c9250[_0x07aa('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x47f7aa,_0x51cdcd))[_0x07aa('0x4a')](handleError(_0x47f7aa,null));};exports[_0x07aa('0x65')]=function(_0x952ec0,_0x6765b7,_0x5bab47){var _0x4182df={};var _0x1ad044={};var _0x5159f2;var _0x4cb632;return db[_0x07aa('0x4d')]['findOne']({'where':{'id':_0x952ec0['params']['id']}})[_0x07aa('0x29')](handleEntityNotFound(_0x6765b7,null))[_0x07aa('0x29')](function(_0xdc773f){if(_0xdc773f){_0x5159f2=_0xdc773f;_0x1ad044[_0x07aa('0x36')]=_[_0x07aa('0x38')](db[_0x07aa('0x66')][_0x07aa('0x32')]);_0x1ad044[_0x07aa('0x37')]=_[_0x07aa('0x38')](_0x952ec0[_0x07aa('0x37')]);_0x1ad044[_0x07aa('0x39')]=_['intersection'](_0x1ad044[_0x07aa('0x36')],_0x1ad044[_0x07aa('0x37')]);_0x4182df[_0x07aa('0x3b')]=_['intersection'](_0x1ad044['model'],qs[_0x07aa('0x3c')](_0x952ec0[_0x07aa('0x37')]['fields']));_0x4182df[_0x07aa('0x3b')]=_0x4182df[_0x07aa('0x3b')]['length']?_0x4182df['attributes']:_0x1ad044[_0x07aa('0x36')];_0x4182df['order']=qs['sort'](_0x952ec0[_0x07aa('0x37')]['sort']);_0x4182df[_0x07aa('0x42')]=qs[_0x07aa('0x39')](_[_0x07aa('0x67')](_0x952ec0[_0x07aa('0x37')],_0x1ad044[_0x07aa('0x39')]));if(_0x952ec0[_0x07aa('0x37')][_0x07aa('0x41')]){_0x4182df[_0x07aa('0x42')]=_[_0x07aa('0x43')](_0x4182df['where'],{'$or':_[_0x07aa('0x31')](_0x4182df['attributes'],function(_0x23b45c){var _0x1b4cbc={};_0x1b4cbc[_0x23b45c]={'$like':'%'+_0x952ec0[_0x07aa('0x37')][_0x07aa('0x41')]+'%'};return _0x1b4cbc;})});}_0x4182df=_[_0x07aa('0x43')]({},_0x4182df,_0x952ec0[_0x07aa('0x45')]);return _0x5159f2[_0x07aa('0x65')](_0x4182df);}})['then'](function(_0x201e73){if(_0x201e73){_0x4cb632=_0x201e73[_0x07aa('0x3d')];if(!_0x952ec0[_0x07aa('0x37')][_0x07aa('0x59')]('nolimit')){_0x4182df[_0x07aa('0x22')]=qs[_0x07aa('0x22')](_0x952ec0[_0x07aa('0x37')][_0x07aa('0x22')]);_0x4182df[_0x07aa('0x20')]=qs[_0x07aa('0x20')](_0x952ec0[_0x07aa('0x37')][_0x07aa('0x20')]);}return _0x5159f2[_0x07aa('0x65')](_0x4182df);}})[_0x07aa('0x29')](function(_0x3e83e1){if(_0x3e83e1){return _0x3e83e1?{'count':_0x4cb632,'rows':_0x3e83e1}:null;}})[_0x07aa('0x29')](respondWithResult(_0x6765b7,null))[_0x07aa('0x4a')](handleError(_0x6765b7,null));};exports[_0x07aa('0x68')]=function(_0x417013,_0x33ec64,_0x146b57){var _0x511c43=_0x417013[_0x07aa('0x55')][_0x07aa('0x69')];return db[_0x07aa('0x66')][_0x07aa('0x48')]({'where':{'id':_0x511c43},'attributes':['id'],'include':[{'model':db[_0x07aa('0x5c')],'as':_0x07aa('0x6a'),'attributes':['id',_0x07aa('0x2f'),_0x07aa('0x6b'),'voicePause',_0x07aa('0x6c')],'raw':!![]}]})[_0x07aa('0x29')](function(_0x55c561){if(_0x55c561){var _0x531a6a=_[_0x07aa('0x6d')](_0x55c561,function(_0x4176cf){var _0x348f41=_0x4176cf[_0x07aa('0x2a')]({'plain':!![]});return _0x348f41['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x417013[_0x07aa('0x4c')]['id']}})[_0x07aa('0x29')](function(_0x4c672e){return db[_0x07aa('0x6e')][_0x07aa('0x6f')](function(_0x397642){return _0x4c672e['addTeams'](_0x511c43,{'transaction':_0x397642})[_0x07aa('0x29')](function(){return BPromise[_0x07aa('0x70')](_0x531a6a,function(_0x5bf165){return db[_0x07aa('0x5b')][_0x07aa('0x71')]({'where':{'UserId':_0x5bf165['id'],'MailQueueId':_0x417013[_0x07aa('0x4c')]['id']},'transaction':_0x397642});});})[_0x07aa('0x29')](function(){_0x531a6a['forEach'](function(_0x57bc63){socket[_0x07aa('0x72')]('userMailQueue:save',{'UserId':_0x57bc63['id'],'MailQueueId':_0x4c672e['id']});});});});});}})['then'](respondWithStatusCode(_0x33ec64,null))[_0x07aa('0x4a')](handleError(_0x33ec64,null));};exports[_0x07aa('0x73')]=function(_0x3b5385,_0x188789,_0x42992b){return db[_0x07aa('0x66')][_0x07aa('0x48')]({'where':{'id':_0x3b5385[_0x07aa('0x37')][_0x07aa('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x07aa('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x188789,null))['then'](function(_0x308c51){var _0x157d25=_[_0x07aa('0x31')](_0x308c51,'id');var _0x1b5445=[];var _0x33a8ba=[];var _0x3c5cdc=squel[_0x07aa('0x74')]();_0x3c5cdc[_0x07aa('0x75')](_0x07aa('0x76'))[_0x07aa('0x77')](_0x07aa('0x78'),'tq')[_0x07aa('0x79')](_0x07aa('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x07aa('0x42')](_0x07aa('0x7b'),_0x3b5385[_0x07aa('0x4c')]['id']);for(var _0x827d86=0x0;_0x827d86<_0x308c51[_0x07aa('0x3d')];_0x827d86+=0x1){let _0x447d29=_0x308c51[_0x827d86];for(var _0x111bd5=0x0;_0x111bd5<_0x447d29[_0x07aa('0x6a')][_0x07aa('0x3d')];_0x111bd5+=0x1){let _0x2977e7=_0x447d29['Agents'][_0x111bd5];var _0x12f158=_0x3c5cdc[_0x07aa('0x7c')]();_0x12f158[_0x07aa('0x42')](_0x07aa('0x7d'),_0x2977e7['id']);_0x33a8ba[_0x07aa('0x7e')](db[_0x07aa('0x6e')][_0x07aa('0x37')](_0x12f158[_0x07aa('0x7f')](),{'type':db['sequelize'][_0x07aa('0x80')][_0x07aa('0x81')]})[_0x07aa('0x29')](function(_0x1e1ed5){if(_0x1e1ed5['length']===0x1){return _0x2977e7['id'];}else{var _0x1e8c74=_[_0x07aa('0x82')](_[_0x07aa('0x31')](_0x1e1ed5,'TeamId'),function(_0x44d448){return _['includes'](_0x157d25,_0x44d448);});if(_0x1e8c74){return _0x2977e7['id'];}}}));}}return BPromise['all'](_0x33a8ba)[_0x07aa('0x29')](function(_0x49a897){_0x1b5445=_(_0x1b5445)[_0x07aa('0x83')](_0x49a897)['compact']()[_0x07aa('0x84')]();return db[_0x07aa('0x4d')][_0x07aa('0x4e')]({'where':{'id':_0x3b5385[_0x07aa('0x4c')]['id']}})[_0x07aa('0x29')](function(_0x1b2939){return db['sequelize'][_0x07aa('0x6f')](function(_0x1a2b8b){return _0x1b2939[_0x07aa('0x73')](_0x3b5385[_0x07aa('0x37')][_0x07aa('0x69')],{'transaction':_0x1a2b8b})[_0x07aa('0x29')](function(){if(!_['isEmpty'](_0x1b5445)){return _0x1b2939[_0x07aa('0x85')](_0x1b5445,{'transaction':_0x1a2b8b});}})[_0x07aa('0x29')](function(){_0x1b5445[_0x07aa('0x86')](function(_0x5bdef1){socket[_0x07aa('0x72')](_0x07aa('0x87'),{'UserId':_0x5bdef1,'MailQueueId':_0x1b2939['id']});});});});});});})[_0x07aa('0x29')](respondWithStatusCode(_0x188789,null))['catch'](handleError(_0x188789,null));};exports[_0x07aa('0x88')]=function(_0x582df8,_0x9d4305,_0x516178){return db[_0x07aa('0x4d')][_0x07aa('0x4e')]({'where':{'id':_0x582df8[_0x07aa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9d4305,null))[_0x07aa('0x29')](function(_0x237591){if(_0x237591){return _0x237591['addAgents'](_0x582df8['body'][_0x07aa('0x69')],_[_0x07aa('0x89')](_0x582df8[_0x07aa('0x55')],[_0x07aa('0x69'),'id'])||{})['spread'](function(_0x321da2){for(var _0x583aea=0x0;_0x583aea<_0x582df8[_0x07aa('0x55')][_0x07aa('0x69')]['length'];_0x583aea+=0x1){socket[_0x07aa('0x72')]('userMailQueue:save',{'UserId':Number(_0x582df8[_0x07aa('0x55')]['ids'][_0x583aea]),'MailQueueId':Number(_0x582df8[_0x07aa('0x4c')]['id'])});}return _0x321da2;});}})[_0x07aa('0x29')](respondWithResult(_0x9d4305,null))[_0x07aa('0x4a')](handleError(_0x9d4305,null));};exports[_0x07aa('0x85')]=function(_0xe66e5f,_0x13849f,_0x9299ea){return db[_0x07aa('0x4d')][_0x07aa('0x4e')]({'where':{'id':_0xe66e5f[_0x07aa('0x4c')]['id']}})[_0x07aa('0x29')](handleEntityNotFound(_0x13849f,null))['then'](function(_0x11bf19){if(_0x11bf19){return _0x11bf19[_0x07aa('0x85')](_0xe66e5f[_0x07aa('0x37')][_0x07aa('0x69')])[_0x07aa('0x29')](function(){if(_[_0x07aa('0x8a')](_0xe66e5f[_0x07aa('0x37')][_0x07aa('0x69')])){for(var _0x380a2f=0x0;_0x380a2f<_0xe66e5f['query'][_0x07aa('0x69')][_0x07aa('0x3d')];_0x380a2f+=0x1){socket[_0x07aa('0x72')](_0x07aa('0x87'),{'UserId':Number(_0xe66e5f[_0x07aa('0x37')][_0x07aa('0x69')][_0x380a2f]),'MailQueueId':Number(_0xe66e5f[_0x07aa('0x4c')]['id'])});}}else{socket['emit'](_0x07aa('0x87'),{'UserId':Number(_0xe66e5f[_0x07aa('0x37')][_0x07aa('0x69')]),'MailQueueId':Number(_0xe66e5f[_0x07aa('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x13849f,null))[_0x07aa('0x4a')](handleError(_0x13849f,null));};exports[_0x07aa('0x8b')]=function(_0x1851da,_0x572816,_0x4a6103){var _0x140185={};var _0x570dee={};var _0xcc8b15;var _0x383b08;return db[_0x07aa('0x4d')][_0x07aa('0x58')]({'where':{'id':_0x1851da[_0x07aa('0x4c')]['id']}})[_0x07aa('0x29')](handleEntityNotFound(_0x572816,null))[_0x07aa('0x29')](function(_0x108214){if(_0x108214){_0xcc8b15=_0x108214;_0x570dee['model']=_['keys'](db['User'][_0x07aa('0x32')]);_0x570dee['query']=_[_0x07aa('0x38')](_0x1851da[_0x07aa('0x37')]);_0x570dee[_0x07aa('0x39')]=_['intersection'](_0x570dee[_0x07aa('0x36')],_0x570dee['query']);_0x140185['attributes']=_[_0x07aa('0x3a')](_0x570dee[_0x07aa('0x36')],qs[_0x07aa('0x3c')](_0x1851da[_0x07aa('0x37')][_0x07aa('0x3c')]));_0x140185[_0x07aa('0x3b')]=_0x140185[_0x07aa('0x3b')]['length']?_0x140185[_0x07aa('0x3b')]:_0x570dee[_0x07aa('0x36')];_0x140185[_0x07aa('0x3f')]=qs['sort'](_0x1851da[_0x07aa('0x37')]['sort']);_0x140185[_0x07aa('0x42')]=qs[_0x07aa('0x39')](_[_0x07aa('0x67')](_0x1851da[_0x07aa('0x37')],_0x570dee[_0x07aa('0x39')]));if(_0x1851da[_0x07aa('0x37')][_0x07aa('0x41')]){_0x140185[_0x07aa('0x42')]=_[_0x07aa('0x43')](_0x140185[_0x07aa('0x42')],{'$or':_[_0x07aa('0x31')](_0x140185[_0x07aa('0x3b')],function(_0xc9749a){var _0x2196b2={};_0x2196b2[_0xc9749a]={'$like':'%'+_0x1851da[_0x07aa('0x37')][_0x07aa('0x41')]+'%'};return _0x2196b2;})});}_0x140185=_[_0x07aa('0x43')]({},_0x140185,_0x1851da['options']);return _0xcc8b15[_0x07aa('0x8b')](_0x140185);}})[_0x07aa('0x29')](function(_0x381c63){if(_0x381c63){_0x383b08=_0x381c63[_0x07aa('0x3d')];if(!_0x1851da[_0x07aa('0x37')]['hasOwnProperty'](_0x07aa('0x3e'))){_0x140185[_0x07aa('0x22')]=qs['limit'](_0x1851da[_0x07aa('0x37')][_0x07aa('0x22')]);_0x140185[_0x07aa('0x20')]=qs['offset'](_0x1851da[_0x07aa('0x37')][_0x07aa('0x20')]);}return _0xcc8b15[_0x07aa('0x8b')](_0x140185);}})['then'](function(_0x5505d4){if(_0x5505d4){return _0x5505d4?{'count':_0x383b08,'rows':_0x5505d4}:null;}})[_0x07aa('0x29')](respondWithResult(_0x572816,null))['catch'](handleError(_0x572816,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index cb5bdd1..b4cb996 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 _0xcd10=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2f61a9,_0x9dd448){var _0x397191=function(_0x240273){while(--_0x240273){_0x2f61a9['push'](_0x2f61a9['shift']());}};_0x397191(++_0x9dd448);}(_0xcd10,0x1a3));var _0x0cd1=function(_0x5cdaea,_0x45a23a){_0x5cdaea=_0x5cdaea-0x0;var _0x5d3f90=_0xcd10[_0x5cdaea];return _0x5d3f90;};'use strict';var EventEmitter=require(_0x0cd1('0x0'));var MailQueue=require(_0x0cd1('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0cd1('0x2'),'afterUpdate':_0x0cd1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10d17d){return function(_0x42996c,_0xfd5b87,_0x2637f3){MailQueueEvents[_0x0cd1('0x4')](_0x10d17d+':'+_0x42996c['id'],_0x42996c);MailQueueEvents[_0x0cd1('0x4')](_0x10d17d,_0x42996c);_0x2637f3(null);};}for(var e in events){if(events[_0x0cd1('0x5')](e)){var event=events[e];MailQueue[_0x0cd1('0x6')](e,emitEvent(event));}}module[_0x0cd1('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x1fbe=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x277de0,_0x47a652){var _0x1a754c=function(_0x27c92f){while(--_0x27c92f){_0x277de0['push'](_0x277de0['shift']());}};_0x1a754c(++_0x47a652);}(_0x1fbe,0xfe));var _0xe1fb=function(_0x28f0f7,_0x5e43cb){_0x28f0f7=_0x28f0f7-0x0;var _0x14eabb=_0x1fbe[_0x28f0f7];return _0x14eabb;};'use strict';var EventEmitter=require(_0xe1fb('0x0'));var MailQueue=require(_0xe1fb('0x1'))['db'][_0xe1fb('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe1fb('0x3')](0x0);var events={'afterCreate':_0xe1fb('0x4'),'afterUpdate':_0xe1fb('0x5'),'afterDestroy':_0xe1fb('0x6')};function emitEvent(_0x3f05db){return function(_0x32e19d,_0x3d5ae2,_0x598018){MailQueueEvents[_0xe1fb('0x7')](_0x3f05db+':'+_0x32e19d['id'],_0x32e19d);MailQueueEvents[_0xe1fb('0x7')](_0x3f05db,_0x32e19d);_0x598018(null);};}for(var e in events){if(events[_0xe1fb('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xe1fb('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 099159a..deff549 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 _0xb3d9=['./mailQueue.attributes','exports','define','mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x433a84,_0x332ca6){var _0x23d87d=function(_0x2ee3b6){while(--_0x2ee3b6){_0x433a84['push'](_0x433a84['shift']());}};_0x23d87d(++_0x332ca6);}(_0xb3d9,0x70));var _0x9b3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9b3d('0x0'));var util=require('util');var logger=require(_0x9b3d('0x1'))(_0x9b3d('0x2'));var moment=require(_0x9b3d('0x3'));var BPromise=require(_0x9b3d('0x4'));var rp=require(_0x9b3d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b3d('0x6'));var config=require(_0x9b3d('0x7'));var attributes=require(_0x9b3d('0x8'));module[_0x9b3d('0x9')]=function(_0x2dd818,_0x40b314){return _0x2dd818[_0x9b3d('0xa')]('MailQueue',attributes,{'tableName':_0x9b3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48ce=['moment','bluebird','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','api'];(function(_0x5e32ff,_0x264edd){var _0x7f0164=function(_0x1f0727){while(--_0x1f0727){_0x5e32ff['push'](_0x5e32ff['shift']());}};_0x7f0164(++_0x264edd);}(_0x48ce,0x97));var _0xe48c=function(_0x7bc6c2,_0x35fd69){_0x7bc6c2=_0x7bc6c2-0x0;var _0x396dbe=_0x48ce[_0x7bc6c2];return _0x396dbe;};'use strict';var _=require(_0xe48c('0x0'));var util=require(_0xe48c('0x1'));var logger=require('../../config/logger')(_0xe48c('0x2'));var moment=require(_0xe48c('0x3'));var BPromise=require(_0xe48c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe48c('0x5'));var config=require(_0xe48c('0x6'));var attributes=require(_0xe48c('0x7'));module['exports']=function(_0x16a4ff,_0xec0e60){return _0x16a4ff[_0xe48c('0x8')](_0xe48c('0x9'),attributes,{'tableName':_0xe48c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3a07017..7cca5aa 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 _0xef88=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','include','map','model','attributes','debug','ShowMailQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xef88,0x10f));var _0x8ef8=function(_0x503d28,_0x2f7b19){_0x503d28=_0x503d28-0x0;var _0x45d14b=_0xef88[_0x503d28];return _0x45d14b;};'use strict';var _=require('lodash');var util=require(_0x8ef8('0x0'));var moment=require(_0x8ef8('0x1'));var BPromise=require(_0x8ef8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ef8('0x3'));var db=require(_0x8ef8('0x4'))['db'];var utils=require(_0x8ef8('0x5'));var logger=require(_0x8ef8('0x6'))(_0x8ef8('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ef8('0x8'));var client=jayson[_0x8ef8('0x9')][_0x8ef8('0xa')]({'port':0x232a});config[_0x8ef8('0xb')]=_[_0x8ef8('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8ef8('0xd'))(new Redis(config[_0x8ef8('0xb')]));require(_0x8ef8('0xe'))[_0x8ef8('0xf')](socket);function respondWithRpcPromise(_0x53e140,_0x4cc5b3,_0x2196f7){return new BPromise(function(_0x53ae22,_0x51601a){return client[_0x8ef8('0x10')](_0x53e140,_0x2196f7)[_0x8ef8('0x11')](function(_0x45c028){logger[_0x8ef8('0x12')](_0x8ef8('0x13'),_0x4cc5b3,_0x8ef8('0x14'));logger['debug'](_0x8ef8('0x15'),_0x4cc5b3,_0x8ef8('0x14'),JSON[_0x8ef8('0x16')](_0x45c028));if(_0x45c028[_0x8ef8('0x17')]){if(_0x45c028['error'][_0x8ef8('0x18')]===0x1f4){logger['error'](_0x8ef8('0x13'),_0x4cc5b3,_0x45c028[_0x8ef8('0x17')][_0x8ef8('0x19')]);return _0x51601a(_0x45c028[_0x8ef8('0x17')][_0x8ef8('0x19')]);}logger[_0x8ef8('0x17')](_0x8ef8('0x13'),_0x4cc5b3,_0x45c028[_0x8ef8('0x17')][_0x8ef8('0x19')]);return _0x53ae22(_0x45c028['error'][_0x8ef8('0x19')]);}else{logger[_0x8ef8('0x12')](_0x8ef8('0x13'),_0x4cc5b3,_0x8ef8('0x14'));_0x53ae22(_0x45c028[_0x8ef8('0x1a')][_0x8ef8('0x19')]);}})[_0x8ef8('0x1b')](function(_0x30f630){logger['error'](_0x8ef8('0x13'),_0x4cc5b3,_0x30f630);_0x51601a(_0x30f630);});});}exports[_0x8ef8('0x1c')]=function(_0xd6ee12){var _0x3f6dc4=this;return new Promise(function(_0x2036f1,_0x12472a){return db[_0x8ef8('0x1d')]['findAll']({'raw':_0xd6ee12[_0x8ef8('0x1e')]?_0xd6ee12[_0x8ef8('0x1e')][_0x8ef8('0x1f')]===undefined?!![]:![]:!![],'where':_0xd6ee12['options']?_0xd6ee12['options'][_0x8ef8('0x20')]||null:null,'attributes':_0xd6ee12[_0x8ef8('0x1e')]?_0xd6ee12[_0x8ef8('0x1e')]['attributes']||null:null,'limit':_0xd6ee12['options']?_0xd6ee12[_0x8ef8('0x1e')][_0x8ef8('0x21')]||null:null,'include':_0xd6ee12[_0x8ef8('0x1e')]?_0xd6ee12['options'][_0x8ef8('0x22')]?_[_0x8ef8('0x23')](_0xd6ee12[_0x8ef8('0x1e')][_0x8ef8('0x22')],function(_0x453a6b){return{'model':db[_0x453a6b[_0x8ef8('0x24')]],'as':_0x453a6b['as'],'attributes':_0x453a6b[_0x8ef8('0x25')],'include':_0x453a6b['include']?_['map'](_0x453a6b[_0x8ef8('0x22')],function(_0x3d786e){return{'model':db[_0x3d786e['model']],'as':_0x3d786e['as'],'attributes':_0x3d786e['attributes'],'include':_0x3d786e['include']?_[_0x8ef8('0x23')](_0x3d786e[_0x8ef8('0x22')],function(_0x2353d5){return{'model':db[_0x2353d5[_0x8ef8('0x24')]],'as':_0x2353d5['as'],'attributes':_0x2353d5[_0x8ef8('0x25')]};}):[]};}):[]};}):[]:[]})[_0x8ef8('0x11')](function(_0xcaf6){logger[_0x8ef8('0x12')](_0x8ef8('0x1c'),_0xd6ee12);logger[_0x8ef8('0x26')](_0x8ef8('0x1c'),_0xd6ee12,JSON[_0x8ef8('0x16')](_0xcaf6));_0x2036f1(_0xcaf6);})[_0x8ef8('0x1b')](function(_0x5f3734){logger[_0x8ef8('0x17')]('GetMailQueue',_0x5f3734['message'],_0xd6ee12);_0x12472a(_0x3f6dc4[_0x8ef8('0x17')](0x1f4,_0x5f3734[_0x8ef8('0x19')]));});});};exports[_0x8ef8('0x27')]=function(_0x2042e4){var _0x3bcbb4=this;return new Promise(function(_0x52942d,_0xabed4){return db[_0x8ef8('0x1d')][_0x8ef8('0x28')]({'raw':_0x2042e4[_0x8ef8('0x1e')]?_0x2042e4[_0x8ef8('0x1e')][_0x8ef8('0x1f')]===undefined?!![]:![]:!![],'where':_0x2042e4['options']?_0x2042e4['options'][_0x8ef8('0x20')]||null:null,'attributes':_0x2042e4[_0x8ef8('0x1e')]?_0x2042e4['options'][_0x8ef8('0x25')]||null:null,'include':_0x2042e4[_0x8ef8('0x1e')]?_0x2042e4[_0x8ef8('0x1e')]['include']?_[_0x8ef8('0x23')](_0x2042e4[_0x8ef8('0x1e')][_0x8ef8('0x22')],function(_0x158458){return{'model':db[_0x158458[_0x8ef8('0x24')]],'as':_0x158458['as'],'attributes':_0x158458[_0x8ef8('0x25')],'include':_0x158458[_0x8ef8('0x22')]?_[_0x8ef8('0x23')](_0x158458[_0x8ef8('0x22')],function(_0xdb8811){return{'model':db[_0xdb8811[_0x8ef8('0x24')]],'as':_0xdb8811['as'],'attributes':_0xdb8811[_0x8ef8('0x25')],'include':_0xdb8811[_0x8ef8('0x22')]?_[_0x8ef8('0x23')](_0xdb8811[_0x8ef8('0x22')],function(_0x4de916){return{'model':db[_0x4de916['model']],'as':_0x4de916['as'],'attributes':_0x4de916[_0x8ef8('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17b1f5){logger[_0x8ef8('0x12')](_0x8ef8('0x27'),_0x2042e4);logger[_0x8ef8('0x26')]('ShowMailQueue',_0x2042e4,JSON[_0x8ef8('0x16')](_0x17b1f5));_0x52942d(_0x17b1f5);})[_0x8ef8('0x1b')](function(_0x337889){logger[_0x8ef8('0x17')]('ShowMailQueue',_0x337889[_0x8ef8('0x19')],_0x2042e4);_0xabed4(_0x3bcbb4['error'](0x1f4,_0x337889[_0x8ef8('0x19')]));});});}; \ No newline at end of file +var _0x676e=['options','raw','attributes','limit','include','map','model','then','GetMailQueue','catch','ShowMailQueue','MailQueue','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll'];(function(_0x1bfe2a,_0xf63817){var _0x8cc88c=function(_0x134938){while(--_0x134938){_0x1bfe2a['push'](_0x1bfe2a['shift']());}};_0x8cc88c(++_0xf63817);}(_0x676e,0x145));var _0xe676=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x676e[_0x1a595a];return _0x33f008;};'use strict';var _=require(_0xe676('0x0'));var util=require('util');var moment=require(_0xe676('0x1'));var BPromise=require(_0xe676('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe676('0x3'));var db=require(_0xe676('0x4'))['db'];var utils=require(_0xe676('0x5'));var logger=require(_0xe676('0x6'))(_0xe676('0x7'));var config=require(_0xe676('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe676('0x9')]['http']({'port':0x232a});config[_0xe676('0xa')]=_[_0xe676('0xb')](config['redis'],{'host':_0xe676('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe676('0xa')]));require(_0xe676('0xd'))['register'](socket);function respondWithRpcPromise(_0x1036a7,_0xe13d7e,_0x2a7870){return new BPromise(function(_0x1de8f1,_0x41defa){return client[_0xe676('0xe')](_0x1036a7,_0x2a7870)['then'](function(_0x3f770b){logger['info'](_0xe676('0xf'),_0xe13d7e,_0xe676('0x10'));logger[_0xe676('0x11')](_0xe676('0x12'),_0xe13d7e,_0xe676('0x10'),JSON[_0xe676('0x13')](_0x3f770b));if(_0x3f770b['error']){if(_0x3f770b[_0xe676('0x14')][_0xe676('0x15')]===0x1f4){logger[_0xe676('0x14')](_0xe676('0xf'),_0xe13d7e,_0x3f770b['error'][_0xe676('0x16')]);return _0x41defa(_0x3f770b[_0xe676('0x14')][_0xe676('0x16')]);}logger[_0xe676('0x14')]('MailQueue,\x20%s,\x20%s',_0xe13d7e,_0x3f770b[_0xe676('0x14')][_0xe676('0x16')]);return _0x1de8f1(_0x3f770b[_0xe676('0x14')][_0xe676('0x16')]);}else{logger[_0xe676('0x17')]('MailQueue,\x20%s,\x20%s',_0xe13d7e,'request\x20sent');_0x1de8f1(_0x3f770b[_0xe676('0x18')][_0xe676('0x16')]);}})['catch'](function(_0x4a5b1e){logger['error'](_0xe676('0xf'),_0xe13d7e,_0x4a5b1e);_0x41defa(_0x4a5b1e);});});}exports['GetMailQueue']=function(_0x3ddbd7){var _0x4567f3=this;return new Promise(function(_0x4c4709,_0x3c95ee){return db['MailQueue'][_0xe676('0x19')]({'raw':_0x3ddbd7['options']?_0x3ddbd7[_0xe676('0x1a')][_0xe676('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ddbd7[_0xe676('0x1a')]?_0x3ddbd7[_0xe676('0x1a')]['where']||null:null,'attributes':_0x3ddbd7[_0xe676('0x1a')]?_0x3ddbd7[_0xe676('0x1a')][_0xe676('0x1c')]||null:null,'limit':_0x3ddbd7[_0xe676('0x1a')]?_0x3ddbd7[_0xe676('0x1a')][_0xe676('0x1d')]||null:null,'include':_0x3ddbd7[_0xe676('0x1a')]?_0x3ddbd7[_0xe676('0x1a')][_0xe676('0x1e')]?_[_0xe676('0x1f')](_0x3ddbd7[_0xe676('0x1a')][_0xe676('0x1e')],function(_0x5c1279){return{'model':db[_0x5c1279[_0xe676('0x20')]],'as':_0x5c1279['as'],'attributes':_0x5c1279[_0xe676('0x1c')],'include':_0x5c1279[_0xe676('0x1e')]?_[_0xe676('0x1f')](_0x5c1279[_0xe676('0x1e')],function(_0x5a02c8){return{'model':db[_0x5a02c8[_0xe676('0x20')]],'as':_0x5a02c8['as'],'attributes':_0x5a02c8[_0xe676('0x1c')],'include':_0x5a02c8[_0xe676('0x1e')]?_[_0xe676('0x1f')](_0x5a02c8[_0xe676('0x1e')],function(_0x165bbb){return{'model':db[_0x165bbb[_0xe676('0x20')]],'as':_0x165bbb['as'],'attributes':_0x165bbb['attributes']};}):[]};}):[]};}):[]:[]})[_0xe676('0x21')](function(_0x3a1dbb){logger[_0xe676('0x17')](_0xe676('0x22'),_0x3ddbd7);logger['debug']('GetMailQueue',_0x3ddbd7,JSON[_0xe676('0x13')](_0x3a1dbb));_0x4c4709(_0x3a1dbb);})[_0xe676('0x23')](function(_0x5eb99f){logger[_0xe676('0x14')]('GetMailQueue',_0x5eb99f[_0xe676('0x16')],_0x3ddbd7);_0x3c95ee(_0x4567f3[_0xe676('0x14')](0x1f4,_0x5eb99f['message']));});});};exports[_0xe676('0x24')]=function(_0x5bef38){var _0xfe627c=this;return new Promise(function(_0x1d0e0c,_0x43d212){return db[_0xe676('0x25')]['find']({'raw':_0x5bef38[_0xe676('0x1a')]?_0x5bef38[_0xe676('0x1a')][_0xe676('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bef38[_0xe676('0x1a')]?_0x5bef38[_0xe676('0x1a')][_0xe676('0x26')]||null:null,'attributes':_0x5bef38[_0xe676('0x1a')]?_0x5bef38[_0xe676('0x1a')][_0xe676('0x1c')]||null:null,'include':_0x5bef38[_0xe676('0x1a')]?_0x5bef38[_0xe676('0x1a')]['include']?_[_0xe676('0x1f')](_0x5bef38[_0xe676('0x1a')][_0xe676('0x1e')],function(_0x4fef6f){return{'model':db[_0x4fef6f[_0xe676('0x20')]],'as':_0x4fef6f['as'],'attributes':_0x4fef6f[_0xe676('0x1c')],'include':_0x4fef6f['include']?_[_0xe676('0x1f')](_0x4fef6f[_0xe676('0x1e')],function(_0x3e3084){return{'model':db[_0x3e3084[_0xe676('0x20')]],'as':_0x3e3084['as'],'attributes':_0x3e3084[_0xe676('0x1c')],'include':_0x3e3084['include']?_[_0xe676('0x1f')](_0x3e3084[_0xe676('0x1e')],function(_0x4a9a63){return{'model':db[_0x4a9a63[_0xe676('0x20')]],'as':_0x4a9a63['as'],'attributes':_0x4a9a63[_0xe676('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58e154){logger[_0xe676('0x17')](_0xe676('0x24'),_0x5bef38);logger[_0xe676('0x11')](_0xe676('0x24'),_0x5bef38,JSON[_0xe676('0x13')](_0x58e154));_0x1d0e0c(_0x58e154);})['catch'](function(_0x11d570){logger[_0xe676('0x14')](_0xe676('0x24'),_0x11d570[_0xe676('0x16')],_0x5bef38);_0x43d212(_0xfe627c[_0xe676('0x14')](0x1f4,_0x11d570['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1d02449..0d4f335 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 _0x725e=['emit','removeListener','register','mailQueue:','./mailQueue.events','update'];(function(_0x54fe19,_0x44d4f7){var _0x25c6b0=function(_0x4b270c){while(--_0x4b270c){_0x54fe19['push'](_0x54fe19['shift']());}};_0x25c6b0(++_0x44d4f7);}(_0x725e,0x12a));var _0xe725=function(_0x20580a,_0x1c529f){_0x20580a=_0x20580a-0x0;var _0x33f7e2=_0x725e[_0x20580a];return _0x33f7e2;};'use strict';var MailQueueEvents=require(_0xe725('0x0'));var events=['save','remove',_0xe725('0x1')];function createListener(_0x57243a,_0xf69dae){return function(_0x18014d){_0xf69dae[_0xe725('0x2')](_0x57243a,_0x18014d);};}function removeListener(_0x1466cb,_0x4f2f05){return function(){MailQueueEvents[_0xe725('0x3')](_0x1466cb,_0x4f2f05);};}exports[_0xe725('0x4')]=function(_0x12c193){for(var _0x487c06=0x0,_0x5622ed=events['length'];_0x487c06<_0x5622ed;_0x487c06++){var _0x46ca6d=events[_0x487c06];var _0x3456b2=createListener(_0xe725('0x5')+_0x46ca6d,_0x12c193);MailQueueEvents['on'](_0x46ca6d,_0x3456b2);}}; \ No newline at end of file +var _0xba20=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','update'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0xba20,0xbb));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x0ba2('0x0'));var events=['save','remove',_0x0ba2('0x1')];function createListener(_0x128a60,_0x2e7380){return function(_0x19d2cf){_0x2e7380[_0x0ba2('0x2')](_0x128a60,_0x19d2cf);};}function removeListener(_0x201803,_0x49c079){return function(){MailQueueEvents[_0x0ba2('0x3')](_0x201803,_0x49c079);};}exports[_0x0ba2('0x4')]=function(_0x550a84){for(var _0x3f5fbc=0x0,_0x42b0a5=events[_0x0ba2('0x5')];_0x3f5fbc<_0x42b0a5;_0x3f5fbc++){var _0x47cc26=events[_0x3f5fbc];var _0x199678=createListener(_0x0ba2('0x6')+_0x47cc26,_0x550a84);MailQueueEvents['on'](_0x47cc26,_0x199678);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ccd1387..d6532eb 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 _0xd8fc=['fs-extra','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x1e2332,_0xd459da){var _0x2072bd=function(_0x57ed2d){while(--_0x57ed2d){_0x1e2332['push'](_0x1e2332['shift']());}};_0x2072bd(++_0xd459da);}(_0xd8fc,0xb9));var _0xcd8f=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0xd8fc[_0x22b39b];return _0x280e1d;};'use strict';var multer=require(_0xcd8f('0x0'));var util=require(_0xcd8f('0x1'));var path=require(_0xcd8f('0x2'));var timeout=require(_0xcd8f('0x3'));var express=require('express');var router=express[_0xcd8f('0x4')]();var fs_extra=require(_0xcd8f('0x5'));var auth=require(_0xcd8f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd8f('0x7'));router[_0xcd8f('0x8')]('/',auth[_0xcd8f('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcd8f('0xa')]);router[_0xcd8f('0x8')](_0xcd8f('0xb'),auth[_0xcd8f('0x9')](),controller['show']);router[_0xcd8f('0xc')]('/',auth['isAuthenticated'](),controller[_0xcd8f('0xd')]);router[_0xcd8f('0xe')]('/:id',auth[_0xcd8f('0x9')](),controller[_0xcd8f('0xf')]);router[_0xcd8f('0x10')](_0xcd8f('0xb'),auth[_0xcd8f('0x9')](),controller[_0xcd8f('0x11')]);module[_0xcd8f('0x12')]=router; \ No newline at end of file +var _0x96ca=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','exports','multer','path'];(function(_0x4cbfc3,_0x12425b){var _0x1f6a01=function(_0x452228){while(--_0x452228){_0x4cbfc3['push'](_0x4cbfc3['shift']());}};_0x1f6a01(++_0x12425b);}(_0x96ca,0x96));var _0xa96c=function(_0x3f9f9d,_0x923a36){_0x3f9f9d=_0x3f9f9d-0x0;var _0x3f9fc9=_0x96ca[_0x3f9f9d];return _0x3f9fc9;};'use strict';var multer=require(_0xa96c('0x0'));var util=require('util');var path=require(_0xa96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa96c('0x2'));var router=express[_0xa96c('0x3')]();var fs_extra=require(_0xa96c('0x4'));var auth=require(_0xa96c('0x5'));var interaction=require(_0xa96c('0x6'));var config=require(_0xa96c('0x7'));var controller=require(_0xa96c('0x8'));router['get']('/',auth[_0xa96c('0x9')](),controller[_0xa96c('0xa')]);router[_0xa96c('0xb')](_0xa96c('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xa96c('0xb')](_0xa96c('0xd'),auth[_0xa96c('0x9')](),controller[_0xa96c('0xe')]);router['post']('/',auth[_0xa96c('0x9')](),controller[_0xa96c('0xf')]);router[_0xa96c('0x10')](_0xa96c('0xd'),auth[_0xa96c('0x9')](),controller[_0xa96c('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa96c('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 b13e02a..d87047e 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 _0x7c92=['sequelize','exports','STRING','DATE'];(function(_0x583497,_0x160b6d){var _0x3eae7a=function(_0x2dfc77){while(--_0x2dfc77){_0x583497['push'](_0x583497['shift']());}};_0x3eae7a(++_0x160b6d);}(_0x7c92,0x110));var _0x27c9=function(_0x561649,_0x2726a4){_0x561649=_0x561649-0x0;var _0x1023dd=_0x7c92[_0x561649];return _0x1023dd;};'use strict';var moment=require('moment');var Sequelize=require(_0x27c9('0x0'));module[_0x27c9('0x1')]={'uniqueid':{'type':Sequelize[_0x27c9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x27c9('0x2')]},'joinAt':{'type':Sequelize[_0x27c9('0x3')]},'leaveAt':{'type':Sequelize[_0x27c9('0x3')]},'acceptAt':{'type':Sequelize[_0x27c9('0x3')]},'exitAt':{'type':Sequelize[_0x27c9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17fa=['DATE','moment','exports','STRING'];(function(_0x1c4866,_0x255b66){var _0x4239e6=function(_0xb477fe){while(--_0xb477fe){_0x1c4866['push'](_0x1c4866['shift']());}};_0x4239e6(++_0x255b66);}(_0x17fa,0x89));var _0xa17f=function(_0x59a216,_0x8a3204){_0x59a216=_0x59a216-0x0;var _0x203cae=_0x17fa[_0x59a216];return _0x203cae;};'use strict';var moment=require(_0xa17f('0x0'));var Sequelize=require('sequelize');module[_0xa17f('0x1')]={'uniqueid':{'type':Sequelize[_0xa17f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa17f('0x2')]},'joinAt':{'type':Sequelize[_0xa17f('0x3')]},'leaveAt':{'type':Sequelize[_0xa17f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa17f('0x3')]},'reason':{'type':Sequelize[_0xa17f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d05caa2..d0be4f5 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 _0xb145=['includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x5e3264,_0x310a41){var _0x320f02=function(_0x54609b){while(--_0x54609b){_0x5e3264['push'](_0x5e3264['shift']());}};_0x320f02(++_0x310a41);}(_0xb145,0xa3));var _0x5b14=function(_0x56ddae,_0x739a47){_0x56ddae=_0x56ddae-0x0;var _0x433d87=_0xb145[_0x56ddae];return _0x433d87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];function respondWithStatusCode(_0x1903a5,_0xc33723){_0xc33723=_0xc33723||0xcc;return function(_0x1cb56b){if(_0x1cb56b){return _0x1903a5[_0x5b14('0x19')](_0xc33723);}return _0x1903a5[_0x5b14('0x1a')](_0xc33723)['end']();};}function respondWithResult(_0x27b34b,_0x16f2a1){_0x16f2a1=_0x16f2a1||0xc8;return function(_0x35fb8b){if(_0x35fb8b){return _0x27b34b[_0x5b14('0x1a')](_0x16f2a1)[_0x5b14('0x1b')](_0x35fb8b);}};}function respondWithFilteredResult(_0x2a8fe5,_0x68f695){return function(_0xe5af75){if(_0xe5af75){var _0x183b0a=typeof _0x68f695[_0x5b14('0x1c')]===_0x5b14('0x1d')&&typeof _0x68f695[_0x5b14('0x1e')]==='undefined';var _0x24cfd0=_0xe5af75['count'];var _0x48d395=_0x183b0a?0x0:_0x68f695['offset'];var _0x3f397d=_0x183b0a?_0xe5af75[_0x5b14('0x1f')]:_0x68f695[_0x5b14('0x1c')]+_0x68f695[_0x5b14('0x1e')];var _0x3786f7;if(_0x3f397d>=_0x24cfd0){_0x3f397d=_0x24cfd0;_0x3786f7=0xc8;}else{_0x3786f7=0xce;}_0x2a8fe5[_0x5b14('0x1a')](_0x3786f7);return _0x2a8fe5[_0x5b14('0x20')]('Content-Range',_0x48d395+'-'+_0x3f397d+'/'+_0x24cfd0)['json'](_0xe5af75);}return null;};}function patchUpdates(_0x4fa079){return function(_0x4f4717){try{jsonpatch[_0x5b14('0x21')](_0x4f4717,_0x4fa079,!![]);}catch(_0x9a9495){return BPromise[_0x5b14('0x22')](_0x9a9495);}return _0x4f4717['save']();};}function saveUpdates(_0x1018d9,_0x1577f7){return function(_0x4857c7){if(_0x4857c7){return _0x4857c7[_0x5b14('0x23')](_0x1018d9)[_0x5b14('0x24')](function(_0x50951f){return _0x50951f;});}return null;};}function removeEntity(_0x33a293,_0x54073f){return function(_0x59282c){if(_0x59282c){return _0x59282c['destroy']()['then'](function(){_0x33a293[_0x5b14('0x1a')](0xcc)[_0x5b14('0x25')]();});}};}function handleEntityNotFound(_0x153a25,_0x5da505){return function(_0x46f86a){if(!_0x46f86a){_0x153a25[_0x5b14('0x19')](0x194);}return _0x46f86a;};}function handleError(_0x2ac7b0,_0x143648){_0x143648=_0x143648||0x1f4;return function(_0xe6851b){logger[_0x5b14('0x26')](_0xe6851b[_0x5b14('0x27')]);if(_0xe6851b[_0x5b14('0x28')]){delete _0xe6851b[_0x5b14('0x28')];}_0x2ac7b0[_0x5b14('0x1a')](_0x143648)[_0x5b14('0x29')](_0xe6851b);};}exports[_0x5b14('0x2a')]=function(_0x1c3c52,_0x266bbe){var _0x4cfd66={},_0x370fcd={},_0x18a76d={'count':0x0,'rows':[]};var _0x53b13d=_['map'](db[_0x5b14('0x2b')][_0x5b14('0x2c')],function(_0x5dca4f){return{'name':_0x5dca4f['fieldName'],'type':_0x5dca4f[_0x5b14('0x2d')]['key']};});_0x370fcd[_0x5b14('0x2e')]=_[_0x5b14('0x2f')](_0x53b13d,'name');_0x370fcd['query']=_[_0x5b14('0x30')](_0x1c3c52[_0x5b14('0x31')]);_0x370fcd[_0x5b14('0x32')]=_['intersection'](_0x370fcd[_0x5b14('0x2e')],_0x370fcd['query']);_0x4cfd66[_0x5b14('0x33')]=_[_0x5b14('0x34')](_0x370fcd[_0x5b14('0x2e')],qs[_0x5b14('0x35')](_0x1c3c52['query'][_0x5b14('0x35')]));_0x4cfd66[_0x5b14('0x33')]=_0x4cfd66[_0x5b14('0x33')][_0x5b14('0x36')]?_0x4cfd66['attributes']:_0x370fcd[_0x5b14('0x2e')];if(!_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x37')]('nolimit')){_0x4cfd66[_0x5b14('0x1e')]=qs['limit'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x1e')]);_0x4cfd66['offset']=qs[_0x5b14('0x1c')](_0x1c3c52[_0x5b14('0x31')]['offset']);}_0x4cfd66[_0x5b14('0x38')]=qs['sort'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x39')]);_0x4cfd66[_0x5b14('0x3a')]=qs[_0x5b14('0x32')](_['pick'](_0x1c3c52[_0x5b14('0x31')],_0x370fcd[_0x5b14('0x32')]),_0x53b13d);if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]){_0x4cfd66[_0x5b14('0x3a')]=_[_0x5b14('0x3c')](_0x4cfd66[_0x5b14('0x3a')],{'$or':_[_0x5b14('0x2f')](_0x53b13d,function(_0x4f647c){if(_0x4f647c[_0x5b14('0x2d')]!==_0x5b14('0x3d')){var _0x3f9d1d={};_0x3f9d1d[_0x4f647c[_0x5b14('0x28')]]={'$like':'%'+_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]+'%'};return _0x3f9d1d;}})});}_0x4cfd66=_[_0x5b14('0x3c')]({},_0x4cfd66,_0x1c3c52['options']);var _0x2ebaa8={'where':_0x4cfd66['where']};return db[_0x5b14('0x2b')][_0x5b14('0x1f')](_0x2ebaa8)['then'](function(_0x4c05ac){_0x18a76d['count']=_0x4c05ac;if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3e')]){_0x4cfd66['include']=[{'all':!![]}];}return db[_0x5b14('0x2b')][_0x5b14('0x3f')](_0x4cfd66);})[_0x5b14('0x24')](function(_0x3d0369){_0x18a76d[_0x5b14('0x40')]=_0x3d0369;return _0x18a76d;})['then'](respondWithFilteredResult(_0x266bbe,_0x4cfd66))[_0x5b14('0x41')](handleError(_0x266bbe,null));};exports[_0x5b14('0x42')]=function(_0x4fb46e,_0x996aee){var _0x985e69={'raw':!![],'where':{'id':_0x4fb46e[_0x5b14('0x43')]['id']}},_0x5cc257={};_0x5cc257['model']=_[_0x5b14('0x30')](db[_0x5b14('0x2b')][_0x5b14('0x2c')]);_0x5cc257[_0x5b14('0x31')]=_['keys'](_0x4fb46e[_0x5b14('0x31')]);_0x5cc257[_0x5b14('0x32')]=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],_0x5cc257['query']);_0x985e69['attributes']=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],qs['fields'](_0x4fb46e[_0x5b14('0x31')]['fields']));_0x985e69[_0x5b14('0x33')]=_0x985e69[_0x5b14('0x33')][_0x5b14('0x36')]?_0x985e69[_0x5b14('0x33')]:_0x5cc257[_0x5b14('0x2e')];if(_0x4fb46e['query'][_0x5b14('0x3e')]){_0x985e69[_0x5b14('0x44')]=[{'all':!![]}];}_0x985e69=_[_0x5b14('0x3c')]({},_0x985e69,_0x4fb46e[_0x5b14('0x45')]);return db[_0x5b14('0x2b')]['find'](_0x985e69)['then'](handleEntityNotFound(_0x996aee,null))[_0x5b14('0x24')](respondWithResult(_0x996aee,null))['catch'](handleError(_0x996aee,null));};exports['create']=function(_0x4825b4,_0x35d00d){return db[_0x5b14('0x2b')][_0x5b14('0x46')](_0x4825b4[_0x5b14('0x47')],{})[_0x5b14('0x24')](respondWithResult(_0x35d00d,0xc9))[_0x5b14('0x41')](handleError(_0x35d00d,null));};exports[_0x5b14('0x23')]=function(_0x4d2bee,_0x548e1c){if(_0x4d2bee['body']['id']){delete _0x4d2bee['body']['id'];}return db['MailQueueReport'][_0x5b14('0x48')]({'where':{'id':_0x4d2bee[_0x5b14('0x43')]['id']}})[_0x5b14('0x24')](handleEntityNotFound(_0x548e1c,null))[_0x5b14('0x24')](saveUpdates(_0x4d2bee[_0x5b14('0x47')],null))['then'](respondWithResult(_0x548e1c,null))['catch'](handleError(_0x548e1c,null));};exports[_0x5b14('0x49')]=function(_0xd6ea50,_0x58b18e){return db[_0x5b14('0x2b')][_0x5b14('0x48')]({'where':{'id':_0xd6ea50['params']['id']}})['then'](handleEntityNotFound(_0x58b18e,null))[_0x5b14('0x24')](removeEntity(_0x58b18e,null))[_0x5b14('0x41')](handleError(_0x58b18e,null));};exports[_0x5b14('0x4a')]=function(_0x5d3782,_0x1a51d5){return db[_0x5b14('0x2b')][_0x5b14('0x4a')]()[_0x5b14('0x24')](respondWithResult(_0x1a51d5,null))[_0x5b14('0x41')](handleError(_0x1a51d5,null));}; \ No newline at end of file +var _0xd824=['../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346394,_0x248eed){_0x248eed=_0x248eed||0xcc;return function(_0x319ba8){if(_0x319ba8){return _0x346394[_0x4d82('0x14')](_0x248eed);}return _0x346394['status'](_0x248eed)[_0x4d82('0x15')]();};}function respondWithResult(_0x2094bc,_0x41f5b2){_0x41f5b2=_0x41f5b2||0xc8;return function(_0x486152){if(_0x486152){return _0x2094bc[_0x4d82('0x16')](_0x41f5b2)['json'](_0x486152);}};}function respondWithFilteredResult(_0x3382c4,_0x5012db){return function(_0x469e09){if(_0x469e09){var _0x496f3b=typeof _0x5012db[_0x4d82('0x17')]===_0x4d82('0x18')&&typeof _0x5012db[_0x4d82('0x19')]===_0x4d82('0x18');var _0x2648a8=_0x469e09[_0x4d82('0x1a')];var _0x258c59=_0x496f3b?0x0:_0x5012db[_0x4d82('0x17')];var _0x2f2127=_0x496f3b?_0x469e09['count']:_0x5012db[_0x4d82('0x17')]+_0x5012db[_0x4d82('0x19')];var _0x1b1e39;if(_0x2f2127>=_0x2648a8){_0x2f2127=_0x2648a8;_0x1b1e39=0xc8;}else{_0x1b1e39=0xce;}_0x3382c4[_0x4d82('0x16')](_0x1b1e39);return _0x3382c4[_0x4d82('0x1b')](_0x4d82('0x1c'),_0x258c59+'-'+_0x2f2127+'/'+_0x2648a8)[_0x4d82('0x1d')](_0x469e09);}return null;};}function patchUpdates(_0x64669c){return function(_0x19832f){try{jsonpatch[_0x4d82('0x1e')](_0x19832f,_0x64669c,!![]);}catch(_0xf2f5a5){return BPromise['reject'](_0xf2f5a5);}return _0x19832f[_0x4d82('0x1f')]();};}function saveUpdates(_0x748ee7,_0x5e5bdf){return function(_0x1a419f){if(_0x1a419f){return _0x1a419f[_0x4d82('0x20')](_0x748ee7)[_0x4d82('0x21')](function(_0x14a2d4){return _0x14a2d4;});}return null;};}function removeEntity(_0xe17d70,_0x15f5d1){return function(_0x11c043){if(_0x11c043){return _0x11c043[_0x4d82('0x22')]()[_0x4d82('0x21')](function(){_0xe17d70[_0x4d82('0x16')](0xcc)[_0x4d82('0x15')]();});}};}function handleEntityNotFound(_0x395efc,_0x7404ba){return function(_0x284c66){if(!_0x284c66){_0x395efc[_0x4d82('0x14')](0x194);}return _0x284c66;};}function handleError(_0x4af6da,_0x5e0b03){_0x5e0b03=_0x5e0b03||0x1f4;return function(_0x3dcb0f){logger[_0x4d82('0x23')](_0x3dcb0f[_0x4d82('0x24')]);if(_0x3dcb0f[_0x4d82('0x25')]){delete _0x3dcb0f['name'];}_0x4af6da[_0x4d82('0x16')](_0x5e0b03)[_0x4d82('0x26')](_0x3dcb0f);};}exports[_0x4d82('0x27')]=function(_0x11d022,_0x5ce98b){var _0x4081f6={},_0x4a7444={},_0x4d9ac4={'count':0x0,'rows':[]};var _0x487581=_['map'](db[_0x4d82('0x28')][_0x4d82('0x29')],function(_0x88318c){return{'name':_0x88318c['fieldName'],'type':_0x88318c[_0x4d82('0x2a')][_0x4d82('0x2b')]};});_0x4a7444['model']=_['map'](_0x487581,_0x4d82('0x25'));_0x4a7444[_0x4d82('0x2c')]=_[_0x4d82('0x2d')](_0x11d022[_0x4d82('0x2c')]);_0x4a7444['filters']=_[_0x4d82('0x2e')](_0x4a7444['model'],_0x4a7444[_0x4d82('0x2c')]);_0x4081f6[_0x4d82('0x2f')]=_['intersection'](_0x4a7444['model'],qs[_0x4d82('0x30')](_0x11d022[_0x4d82('0x2c')][_0x4d82('0x30')]));_0x4081f6[_0x4d82('0x2f')]=_0x4081f6[_0x4d82('0x2f')][_0x4d82('0x31')]?_0x4081f6[_0x4d82('0x2f')]:_0x4a7444[_0x4d82('0x32')];if(!_0x11d022[_0x4d82('0x2c')][_0x4d82('0x33')]('nolimit')){_0x4081f6[_0x4d82('0x19')]=qs[_0x4d82('0x19')](_0x11d022[_0x4d82('0x2c')]['limit']);_0x4081f6[_0x4d82('0x17')]=qs[_0x4d82('0x17')](_0x11d022['query'][_0x4d82('0x17')]);}_0x4081f6[_0x4d82('0x34')]=qs[_0x4d82('0x35')](_0x11d022['query'][_0x4d82('0x35')]);_0x4081f6[_0x4d82('0x36')]=qs['filters'](_[_0x4d82('0x37')](_0x11d022['query'],_0x4a7444[_0x4d82('0x38')]),_0x487581);if(_0x11d022[_0x4d82('0x2c')]['filter']){_0x4081f6[_0x4d82('0x36')]=_['merge'](_0x4081f6[_0x4d82('0x36')],{'$or':_['map'](_0x487581,function(_0x51c705){if(_0x51c705[_0x4d82('0x2a')]!=='VIRTUAL'){var _0x2528d7={};_0x2528d7[_0x51c705['name']]={'$like':'%'+_0x11d022[_0x4d82('0x2c')][_0x4d82('0x39')]+'%'};return _0x2528d7;}})});}_0x4081f6=_['merge']({},_0x4081f6,_0x11d022[_0x4d82('0x3a')]);var _0x5d9444={'where':_0x4081f6[_0x4d82('0x36')]};return db[_0x4d82('0x28')]['count'](_0x5d9444)[_0x4d82('0x21')](function(_0x5521f1){_0x4d9ac4[_0x4d82('0x1a')]=_0x5521f1;if(_0x11d022[_0x4d82('0x2c')][_0x4d82('0x3b')]){_0x4081f6[_0x4d82('0x3c')]=[{'all':!![]}];}return db[_0x4d82('0x28')][_0x4d82('0x3d')](_0x4081f6);})['then'](function(_0x222b35){_0x4d9ac4[_0x4d82('0x3e')]=_0x222b35;return _0x4d9ac4;})[_0x4d82('0x21')](respondWithFilteredResult(_0x5ce98b,_0x4081f6))[_0x4d82('0x3f')](handleError(_0x5ce98b,null));};exports[_0x4d82('0x40')]=function(_0x363158,_0x37498b){var _0x4c474b={'raw':!![],'where':{'id':_0x363158[_0x4d82('0x41')]['id']}},_0x3c80d6={};_0x3c80d6[_0x4d82('0x32')]=_[_0x4d82('0x2d')](db[_0x4d82('0x28')]['rawAttributes']);_0x3c80d6[_0x4d82('0x2c')]=_[_0x4d82('0x2d')](_0x363158[_0x4d82('0x2c')]);_0x3c80d6[_0x4d82('0x38')]=_[_0x4d82('0x2e')](_0x3c80d6[_0x4d82('0x32')],_0x3c80d6[_0x4d82('0x2c')]);_0x4c474b['attributes']=_[_0x4d82('0x2e')](_0x3c80d6[_0x4d82('0x32')],qs['fields'](_0x363158[_0x4d82('0x2c')]['fields']));_0x4c474b[_0x4d82('0x2f')]=_0x4c474b[_0x4d82('0x2f')]['length']?_0x4c474b[_0x4d82('0x2f')]:_0x3c80d6[_0x4d82('0x32')];if(_0x363158['query'][_0x4d82('0x3b')]){_0x4c474b[_0x4d82('0x3c')]=[{'all':!![]}];}_0x4c474b=_[_0x4d82('0x42')]({},_0x4c474b,_0x363158['options']);return db[_0x4d82('0x28')][_0x4d82('0x43')](_0x4c474b)['then'](handleEntityNotFound(_0x37498b,null))['then'](respondWithResult(_0x37498b,null))[_0x4d82('0x3f')](handleError(_0x37498b,null));};exports[_0x4d82('0x44')]=function(_0x40c5ed,_0xb9d3bd){return db[_0x4d82('0x28')][_0x4d82('0x44')](_0x40c5ed[_0x4d82('0x45')],{})['then'](respondWithResult(_0xb9d3bd,0xc9))[_0x4d82('0x3f')](handleError(_0xb9d3bd,null));};exports[_0x4d82('0x20')]=function(_0x2e4083,_0x234ce3){if(_0x2e4083['body']['id']){delete _0x2e4083['body']['id'];}return db['MailQueueReport'][_0x4d82('0x43')]({'where':{'id':_0x2e4083[_0x4d82('0x41')]['id']}})[_0x4d82('0x21')](handleEntityNotFound(_0x234ce3,null))[_0x4d82('0x21')](saveUpdates(_0x2e4083[_0x4d82('0x45')],null))[_0x4d82('0x21')](respondWithResult(_0x234ce3,null))['catch'](handleError(_0x234ce3,null));};exports[_0x4d82('0x22')]=function(_0x1c022d,_0x3c0ffc){return db[_0x4d82('0x28')][_0x4d82('0x43')]({'where':{'id':_0x1c022d[_0x4d82('0x41')]['id']}})[_0x4d82('0x21')](handleEntityNotFound(_0x3c0ffc,null))[_0x4d82('0x21')](removeEntity(_0x3c0ffc,null))[_0x4d82('0x3f')](handleError(_0x3c0ffc,null));};exports['describe']=function(_0x418e6c,_0x25a4de){return db[_0x4d82('0x28')][_0x4d82('0x46')]()[_0x4d82('0x21')](respondWithResult(_0x25a4de,null))[_0x4d82('0x3f')](handleError(_0x25a4de,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fa23270..85e3311 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 _0x6c4d=['MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x6c4d,0x1a3));var _0xd6c4=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6c4d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xd6c4('0x0'));var util=require('util');var logger=require(_0xd6c4('0x1'))(_0xd6c4('0x2'));var moment=require(_0xd6c4('0x3'));var BPromise=require(_0xd6c4('0x4'));var rp=require(_0xd6c4('0x5'));var fs=require('fs');var path=require(_0xd6c4('0x6'));var rimraf=require('rimraf');var config=require(_0xd6c4('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xd6c4('0x8')]=function(_0x5f32a5,_0x5a7521){return _0x5f32a5[_0xd6c4('0x9')](_0xd6c4('0xa'),attributes,{'tableName':_0xd6c4('0xb'),'paranoid':![],'indexes':[{'name':_0xd6c4('0xc'),'fields':[_0xd6c4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfb=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x586149,_0x35d3fd){var _0x5e6aaa=function(_0x5c6adf){while(--_0x5c6adf){_0x586149['push'](_0x586149['shift']());}};_0x5e6aaa(++_0x35d3fd);}(_0x6bfb,0x8f));var _0xb6bf=function(_0x13e013,_0x145e9a){_0x13e013=_0x13e013-0x0;var _0x341960=_0x6bfb[_0x13e013];return _0x341960;};'use strict';var _=require('lodash');var util=require(_0xb6bf('0x0'));var logger=require(_0xb6bf('0x1'))(_0xb6bf('0x2'));var moment=require(_0xb6bf('0x3'));var BPromise=require(_0xb6bf('0x4'));var rp=require(_0xb6bf('0x5'));var fs=require('fs');var path=require(_0xb6bf('0x6'));var rimraf=require(_0xb6bf('0x7'));var config=require(_0xb6bf('0x8'));var attributes=require(_0xb6bf('0x9'));module[_0xb6bf('0xa')]=function(_0x2044a2,_0x3f588f){return _0x2044a2[_0xb6bf('0xb')](_0xb6bf('0xc'),attributes,{'tableName':_0xb6bf('0xd'),'paranoid':![],'indexes':[{'name':_0xb6bf('0xe'),'fields':[_0xb6bf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 828d8eb..353f163 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x426042,_0x3c2c2c){var _0x324411=function(_0x298545){while(--_0x298545){_0x426042['push'](_0x426042['shift']());}};_0x324411(++_0x3c2c2c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x51d9ee,_0x1a4bf5){var _0x5a9abb=function(_0x523d39){while(--_0x523d39){_0x51d9ee['push'](_0x51d9ee['shift']());}};_0x5a9abb(++_0x1a4bf5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b5d3a,_0x2afb5f){_0x5b5d3a=_0x5b5d3a-0x0;var _0x149cbd=_0x5f2f[_0x5b5d3a];return _0x149cbd;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 39090e1..9e27399 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe76b20,_0x28a975){var _0x49cb3c=function(_0x5b5c9c){while(--_0x5b5c9c){_0xe76b20['push'](_0xe76b20['shift']());}};_0x49cb3c(++_0x28a975);}(_0xedd9,0xfc));var _0x9edd=function(_0x261a6f,_0x2690db){_0x261a6f=_0x261a6f-0x0;var _0x25ebf3=_0xedd9[_0x261a6f];return _0x25ebf3;};'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(_0x1baf7b,_0x7d4056){var _0x4b3bcb=function(_0x47c6fe){while(--_0x47c6fe){_0x1baf7b['push'](_0x1baf7b['shift']());}};_0x4b3bcb(++_0x7d4056);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 24f1705..aa8a993 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 _0x80ed=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x4d6e8c,_0x510798){var _0x582629=function(_0x270d4a){while(--_0x270d4a){_0x4d6e8c['push'](_0x4d6e8c['shift']());}};_0x582629(++_0x510798);}(_0x80ed,0x11c));var _0xd80e=function(_0x3784fe,_0x315737){_0x3784fe=_0x3784fe-0x0;var _0x4d70c2=_0x80ed[_0x3784fe];return _0x4d70c2;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'description':{'type':Sequelize[_0xd80e('0x1')]},'host':{'type':Sequelize[_0xd80e('0x1')]},'authentication':{'type':Sequelize[_0xd80e('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd80e('0x1')]},'port':{'type':Sequelize[_0xd80e('0x3')]},'tls':{'type':Sequelize[_0xd80e('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd80e('0x1')]}}; \ No newline at end of file +var _0xd3d1=['BOOLEAN','STRING','INTEGER','INBOX','sequelize','exports'];(function(_0x1bee44,_0x4162bd){var _0x2cd4b8=function(_0x3f36b1){while(--_0x3f36b1){_0x1bee44['push'](_0x1bee44['shift']());}};_0x2cd4b8(++_0x4162bd);}(_0xd3d1,0x172));var _0x1d3d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd3d1[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x1d3d('0x0'));module[_0x1d3d('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1d3d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1d3d('0x3')]},'password':{'type':Sequelize[_0x1d3d('0x3')]},'port':{'type':Sequelize[_0x1d3d('0x4')]},'tls':{'type':Sequelize[_0x1d3d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1d3d('0x3')],'defaultValue':_0x1d3d('0x5')},'connTimeout':{'type':Sequelize[_0x1d3d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1d3d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1d3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c93b721..4112c6b 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 _0xe14b=['request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xe14b,0xd8));var _0xbe14=function(_0x15beeb,_0x32bd4f){_0x15beeb=_0x15beeb-0x0;var _0x5b681a=_0xe14b[_0x15beeb];return _0x5b681a;};'use strict';var _=require('lodash');var util=require(_0xbe14('0x0'));var logger=require(_0xbe14('0x1'))(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var rp=require(_0xbe14('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe14('0x5'));var config=require(_0xbe14('0x6'));var attributes=require(_0xbe14('0x7'));module[_0xbe14('0x8')]=function(_0x588dd6,_0x429581){return _0x588dd6[_0xbe14('0x9')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21dc=['./mailServerIn.attributes','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xd92b45,_0x541fff){var _0x351559=function(_0x133b4c){while(--_0x133b4c){_0xd92b45['push'](_0xd92b45['shift']());}};_0x351559(++_0x541fff);}(_0x21dc,0x1dd));var _0xc21d=function(_0x1f2637,_0x697569){_0x1f2637=_0x1f2637-0x0;var _0x34e066=_0x21dc[_0x1f2637];return _0x34e066;};'use strict';var _=require('lodash');var util=require(_0xc21d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc21d('0x1'));var BPromise=require(_0xc21d('0x2'));var rp=require(_0xc21d('0x3'));var fs=require('fs');var path=require(_0xc21d('0x4'));var rimraf=require('rimraf');var config=require(_0xc21d('0x5'));var attributes=require(_0xc21d('0x6'));module['exports']=function(_0x2ff3d4,_0x3d292d){return _0x2ff3d4['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','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 16e0494..4150606 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 _0xa9be=['code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x10e50e,_0x7b3bba){var _0x29b044=function(_0x527ee5){while(--_0x527ee5){_0x10e50e['push'](_0x10e50e['shift']());}};_0x29b044(++_0x7b3bba);}(_0xa9be,0x1eb));var _0xea9b=function(_0x1dbade,_0x523ddb){_0x1dbade=_0x1dbade-0x0;var _0x424f4d=_0xa9be[_0x1dbade];return _0x424f4d;};'use strict';var _=require(_0xea9b('0x0'));var util=require(_0xea9b('0x1'));var moment=require(_0xea9b('0x2'));var BPromise=require(_0xea9b('0x3'));var rs=require(_0xea9b('0x4'));var fs=require('fs');var Redis=require(_0xea9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea9b('0x6'));var logger=require(_0xea9b('0x7'))(_0xea9b('0x8'));var config=require(_0xea9b('0x9'));var jayson=require(_0xea9b('0xa'));var client=jayson[_0xea9b('0xb')][_0xea9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f1c0e,_0x10e567,_0x1197c1){return new BPromise(function(_0x4f513f,_0x156dfb){return client['request'](_0x4f1c0e,_0x1197c1)[_0xea9b('0xd')](function(_0x2bacbc){logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,_0xea9b('0x10'));logger[_0xea9b('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x10e567,_0xea9b('0x10'),JSON['stringify'](_0x2bacbc));if(_0x2bacbc[_0xea9b('0x12')]){if(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x13')]===0x1f4){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')]['message']);return _0x156dfb(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);}logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);return _0x4f513f(_0x2bacbc['error'][_0xea9b('0x14')]);}else{logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,'request\x20sent');_0x4f513f(_0x2bacbc[_0xea9b('0x15')][_0xea9b('0x14')]);}})[_0xea9b('0x16')](function(_0x1c2dd8){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x1c2dd8);_0x156dfb(_0x1c2dd8);});});}exports[_0xea9b('0x17')]=function(_0x1de758){var _0x49dd19=this;return new Promise(function(_0x4c1b81,_0xc033e0){return db[_0xea9b('0x18')][_0xea9b('0x19')]({'raw':_0x1de758[_0xea9b('0x1a')]?_0x1de758[_0xea9b('0x1a')][_0xea9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1de758['options']?_0x1de758['options'][_0xea9b('0x1c')]||null:null,'attributes':_0x1de758[_0xea9b('0x1a')]?_0x1de758[_0xea9b('0x1a')][_0xea9b('0x1d')]||null:null,'limit':_0x1de758[_0xea9b('0x1a')]?_0x1de758[_0xea9b('0x1a')]['limit']||null:null,'include':_0x1de758[_0xea9b('0x1a')]?_0x1de758['options'][_0xea9b('0x1e')]?_[_0xea9b('0x1f')](_0x1de758[_0xea9b('0x1a')][_0xea9b('0x1e')],function(_0x3c4b0b){return{'model':db[_0x3c4b0b['model']],'as':_0x3c4b0b['as'],'attributes':_0x3c4b0b['attributes'],'include':_0x3c4b0b[_0xea9b('0x1e')]?_[_0xea9b('0x1f')](_0x3c4b0b[_0xea9b('0x1e')],function(_0x4c786b){return{'model':db[_0x4c786b['model']],'as':_0x4c786b['as'],'attributes':_0x4c786b[_0xea9b('0x1d')],'include':_0x4c786b[_0xea9b('0x1e')]?_[_0xea9b('0x1f')](_0x4c786b[_0xea9b('0x1e')],function(_0x1488f0){return{'model':db[_0x1488f0[_0xea9b('0x20')]],'as':_0x1488f0['as'],'attributes':_0x1488f0[_0xea9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xea9b('0xd')](function(_0xb648d9){logger[_0xea9b('0xe')](_0xea9b('0x17'),_0x1de758);logger[_0xea9b('0x11')](_0xea9b('0x17'),_0x1de758,JSON[_0xea9b('0x21')](_0xb648d9));_0x4c1b81(_0xb648d9);})['catch'](function(_0xb4186){logger[_0xea9b('0x12')](_0xea9b('0x17'),_0xb4186[_0xea9b('0x14')],_0x1de758);_0xc033e0(_0x49dd19['error'](0x1f4,_0xb4186['message']));});});}; \ No newline at end of file +var _0xb4c2=['rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4016d4,_0x491c60){var _0x348a93=function(_0x2fad52){while(--_0x2fad52){_0x4016d4['push'](_0x4016d4['shift']());}};_0x348a93(++_0x491c60);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x577f67,_0x1cfb01){_0x577f67=_0x577f67-0x0;var _0x51faf4=_0xb4c2[_0x577f67];return _0x51faf4;};'use strict';var _=require('lodash');var util=require(_0x2b4c('0x0'));var moment=require(_0x2b4c('0x1'));var BPromise=require(_0x2b4c('0x2'));var rs=require(_0x2b4c('0x3'));var fs=require('fs');var Redis=require(_0x2b4c('0x4'));var db=require(_0x2b4c('0x5'))['db'];var utils=require(_0x2b4c('0x6'));var logger=require(_0x2b4c('0x7'))(_0x2b4c('0x8'));var config=require(_0x2b4c('0x9'));var jayson=require(_0x2b4c('0xa'));var client=jayson['client'][_0x2b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x519953,_0xd1f8e6,_0x5f529b){return new BPromise(function(_0x4251f8,_0x42590a){return client['request'](_0x519953,_0x5f529b)[_0x2b4c('0xc')](function(_0x3445c4){logger[_0x2b4c('0xd')](_0x2b4c('0xe'),_0xd1f8e6,'request\x20sent');logger[_0x2b4c('0xf')](_0x2b4c('0x10'),_0xd1f8e6,_0x2b4c('0x11'),JSON[_0x2b4c('0x12')](_0x3445c4));if(_0x3445c4[_0x2b4c('0x13')]){if(_0x3445c4['error'][_0x2b4c('0x14')]===0x1f4){logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);return _0x42590a(_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);}logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x3445c4[_0x2b4c('0x13')]['message']);return _0x4251f8(_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);}else{logger[_0x2b4c('0xd')](_0x2b4c('0xe'),_0xd1f8e6,_0x2b4c('0x11'));_0x4251f8(_0x3445c4[_0x2b4c('0x16')][_0x2b4c('0x15')]);}})['catch'](function(_0x45f8dd){logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x45f8dd);_0x42590a(_0x45f8dd);});});}exports[_0x2b4c('0x17')]=function(_0x396824){var _0x20a9c4=this;return new Promise(function(_0x38d460,_0xf729c){return db[_0x2b4c('0x18')][_0x2b4c('0x19')]({'raw':_0x396824[_0x2b4c('0x1a')]?_0x396824[_0x2b4c('0x1a')][_0x2b4c('0x1b')]===undefined?!![]:![]:!![],'where':_0x396824[_0x2b4c('0x1a')]?_0x396824[_0x2b4c('0x1a')][_0x2b4c('0x1c')]||null:null,'attributes':_0x396824[_0x2b4c('0x1a')]?_0x396824[_0x2b4c('0x1a')][_0x2b4c('0x1d')]||null:null,'limit':_0x396824[_0x2b4c('0x1a')]?_0x396824['options'][_0x2b4c('0x1e')]||null:null,'include':_0x396824[_0x2b4c('0x1a')]?_0x396824[_0x2b4c('0x1a')][_0x2b4c('0x1f')]?_['map'](_0x396824[_0x2b4c('0x1a')][_0x2b4c('0x1f')],function(_0x5c437e){return{'model':db[_0x5c437e[_0x2b4c('0x20')]],'as':_0x5c437e['as'],'attributes':_0x5c437e['attributes'],'include':_0x5c437e[_0x2b4c('0x1f')]?_['map'](_0x5c437e[_0x2b4c('0x1f')],function(_0x4e66ce){return{'model':db[_0x4e66ce['model']],'as':_0x4e66ce['as'],'attributes':_0x4e66ce[_0x2b4c('0x1d')],'include':_0x4e66ce['include']?_[_0x2b4c('0x21')](_0x4e66ce[_0x2b4c('0x1f')],function(_0x40b940){return{'model':db[_0x40b940[_0x2b4c('0x20')]],'as':_0x40b940['as'],'attributes':_0x40b940[_0x2b4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b4c('0xc')](function(_0x2a1db3){logger['info'](_0x2b4c('0x17'),_0x396824);logger[_0x2b4c('0xf')](_0x2b4c('0x17'),_0x396824,JSON[_0x2b4c('0x12')](_0x2a1db3));_0x38d460(_0x2a1db3);})[_0x2b4c('0x22')](function(_0x1ae3f9){logger[_0x2b4c('0x13')](_0x2b4c('0x17'),_0x1ae3f9[_0x2b4c('0x15')],_0x396824);_0xf729c(_0x20a9c4[_0x2b4c('0x13')](0x1f4,_0x1ae3f9[_0x2b4c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ac35901..2b06e2a 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(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7a54,0x106));var _0x47a5=function(_0x4c540f,_0x5985d5){_0x4c540f=_0x4c540f-0x0;var _0x51a522=_0x7a54[_0x4c540f];return _0x51a522;};'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 5df0748..4adb93b 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 _0x424d=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x424d,0x19d));var _0xd424=function(_0x5173b3,_0x26273d){_0x5173b3=_0x5173b3-0x0;var _0x16d4d7=_0x424d[_0x5173b3];return _0x16d4d7;};'use strict';var Sequelize=require(_0xd424('0x0'));module[_0xd424('0x1')]={'description':{'type':Sequelize[_0xd424('0x2')]},'host':{'type':Sequelize[_0xd424('0x2')]},'user':{'type':Sequelize[_0xd424('0x2')]},'pass':{'type':Sequelize[_0xd424('0x2')]},'port':{'type':Sequelize[_0xd424('0x3')]},'secure':{'type':Sequelize[_0xd424('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xd424('0x2')]},'authentication':{'type':Sequelize[_0xd424('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbb23=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x474c38,_0x11d71d){var _0x5d2c42=function(_0x8cf36d){while(--_0x8cf36d){_0x474c38['push'](_0x474c38['shift']());}};_0x5d2c42(++_0x11d71d);}(_0xbb23,0x18c));var _0x3bb2=function(_0x276bfe,_0x3a19cb){_0x276bfe=_0x276bfe-0x0;var _0x5a2efc=_0xbb23[_0x276bfe];return _0x5a2efc;};'use strict';var Sequelize=require(_0x3bb2('0x0'));module['exports']={'description':{'type':Sequelize[_0x3bb2('0x1')]},'host':{'type':Sequelize[_0x3bb2('0x1')]},'user':{'type':Sequelize[_0x3bb2('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3bb2('0x2')]},'secure':{'type':Sequelize[_0x3bb2('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x3bb2('0x1')]},'authentication':{'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 281b5f6..61f8726 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 _0x8cb6=['rows','catch','show','length','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','MailServerOut','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll'];(function(_0xe794f,_0x21f435){var _0x33cefb=function(_0x5f0207){while(--_0x5f0207){_0xe794f['push'](_0xe794f['shift']());}};_0x33cefb(++_0x21f435);}(_0x8cb6,0x139));var _0x68cb=function(_0x657e65,_0x307cb8){_0x657e65=_0x657e65-0x0;var _0x24c8ea=_0x8cb6[_0x657e65];return _0x24c8ea;};'use strict';var emlformat=require(_0x68cb('0x0'));var rimraf=require(_0x68cb('0x1'));var zipdir=require(_0x68cb('0x2'));var jsonpatch=require(_0x68cb('0x3'));var rp=require('request-promise');var moment=require(_0x68cb('0x4'));var BPromise=require(_0x68cb('0x5'));var Mustache=require(_0x68cb('0x6'));var util=require(_0x68cb('0x7'));var path=require('path');var sox=require(_0x68cb('0x8'));var csv=require(_0x68cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68cb('0xa'));var _=require(_0x68cb('0xb'));var squel=require(_0x68cb('0xc'));var crypto=require(_0x68cb('0xd'));var jsforce=require(_0x68cb('0xe'));var deskjs=require(_0x68cb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x68cb('0x10'));var Papa=require(_0x68cb('0x11'));var Redis=require('ioredis');var authService=require(_0x68cb('0x12'));var qs=require(_0x68cb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68cb('0x14'));var logger=require(_0x68cb('0x15'))(_0x68cb('0x16'));var utils=require(_0x68cb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x68cb('0x18'));var db=require(_0x68cb('0x19'))['db'];function respondWithStatusCode(_0x3fae6e,_0x86b3bc){_0x86b3bc=_0x86b3bc||0xcc;return function(_0x593561){if(_0x593561){return _0x3fae6e['sendStatus'](_0x86b3bc);}return _0x3fae6e[_0x68cb('0x1a')](_0x86b3bc)[_0x68cb('0x1b')]();};}function respondWithResult(_0x15d493,_0x3e9879){_0x3e9879=_0x3e9879||0xc8;return function(_0x2913db){if(_0x2913db){return _0x15d493[_0x68cb('0x1a')](_0x3e9879)['json'](_0x2913db);}};}function respondWithFilteredResult(_0x260fb0,_0x19bae9){return function(_0xdfa59d){if(_0xdfa59d){var _0x3f4439=typeof _0x19bae9[_0x68cb('0x1c')]===_0x68cb('0x1d')&&typeof _0x19bae9[_0x68cb('0x1e')]===_0x68cb('0x1d');var _0x14b82f=_0xdfa59d[_0x68cb('0x1f')];var _0x2e7274=_0x3f4439?0x0:_0x19bae9[_0x68cb('0x1c')];var _0x3d1b58=_0x3f4439?_0xdfa59d[_0x68cb('0x1f')]:_0x19bae9[_0x68cb('0x1c')]+_0x19bae9[_0x68cb('0x1e')];var _0x203b95;if(_0x3d1b58>=_0x14b82f){_0x3d1b58=_0x14b82f;_0x203b95=0xc8;}else{_0x203b95=0xce;}_0x260fb0[_0x68cb('0x1a')](_0x203b95);return _0x260fb0['set'](_0x68cb('0x20'),_0x2e7274+'-'+_0x3d1b58+'/'+_0x14b82f)[_0x68cb('0x21')](_0xdfa59d);}return null;};}function patchUpdates(_0x7b4007){return function(_0x148423){try{jsonpatch[_0x68cb('0x22')](_0x148423,_0x7b4007,!![]);}catch(_0x5753ba){return BPromise[_0x68cb('0x23')](_0x5753ba);}return _0x148423[_0x68cb('0x24')]();};}function saveUpdates(_0x59a6fc,_0x4fd25e){return function(_0x325bdb){if(_0x325bdb){return _0x325bdb[_0x68cb('0x25')](_0x59a6fc)[_0x68cb('0x26')](function(_0x57e001){return _0x57e001;});}return null;};}function removeEntity(_0x12fc5b,_0x8655c4){return function(_0x34d396){if(_0x34d396){return _0x34d396[_0x68cb('0x27')]()[_0x68cb('0x26')](function(){_0x12fc5b['status'](0xcc)[_0x68cb('0x1b')]();});}};}function handleEntityNotFound(_0x51f1d0,_0x2c546d){return function(_0x3e9601){if(!_0x3e9601){_0x51f1d0[_0x68cb('0x28')](0x194);}return _0x3e9601;};}function handleError(_0x5b8dd1,_0x503759){_0x503759=_0x503759||0x1f4;return function(_0x4d9d1d){logger['error'](_0x4d9d1d[_0x68cb('0x29')]);if(_0x4d9d1d[_0x68cb('0x2a')]){delete _0x4d9d1d[_0x68cb('0x2a')];}_0x5b8dd1[_0x68cb('0x1a')](_0x503759)['send'](_0x4d9d1d);};}exports['index']=function(_0x3bfd98,_0x26d6f7){var _0x303682={},_0x1f2fe6={},_0x300f20={'count':0x0,'rows':[]};var _0x3ecef8=_['map'](db[_0x68cb('0x2b')][_0x68cb('0x2c')],function(_0x5e732e){return{'name':_0x5e732e[_0x68cb('0x2d')],'type':_0x5e732e[_0x68cb('0x2e')]['key']};});_0x1f2fe6[_0x68cb('0x2f')]=_[_0x68cb('0x30')](_0x3ecef8,'name');_0x1f2fe6[_0x68cb('0x31')]=_[_0x68cb('0x32')](_0x3bfd98['query']);_0x1f2fe6[_0x68cb('0x33')]=_['intersection'](_0x1f2fe6['model'],_0x1f2fe6[_0x68cb('0x31')]);_0x303682['attributes']=_[_0x68cb('0x34')](_0x1f2fe6[_0x68cb('0x2f')],qs[_0x68cb('0x35')](_0x3bfd98[_0x68cb('0x31')][_0x68cb('0x35')]));_0x303682[_0x68cb('0x36')]=_0x303682[_0x68cb('0x36')]['length']?_0x303682[_0x68cb('0x36')]:_0x1f2fe6[_0x68cb('0x2f')];if(!_0x3bfd98[_0x68cb('0x31')][_0x68cb('0x37')](_0x68cb('0x38'))){_0x303682['limit']=qs[_0x68cb('0x1e')](_0x3bfd98[_0x68cb('0x31')][_0x68cb('0x1e')]);_0x303682[_0x68cb('0x1c')]=qs[_0x68cb('0x1c')](_0x3bfd98[_0x68cb('0x31')][_0x68cb('0x1c')]);}_0x303682[_0x68cb('0x39')]=qs[_0x68cb('0x3a')](_0x3bfd98['query'][_0x68cb('0x3a')]);_0x303682[_0x68cb('0x3b')]=qs[_0x68cb('0x33')](_[_0x68cb('0x3c')](_0x3bfd98[_0x68cb('0x31')],_0x1f2fe6[_0x68cb('0x33')]),_0x3ecef8);if(_0x3bfd98[_0x68cb('0x31')][_0x68cb('0x3d')]){_0x303682[_0x68cb('0x3b')]=_['merge'](_0x303682['where'],{'$or':_[_0x68cb('0x30')](_0x3ecef8,function(_0x37fad8){if(_0x37fad8['type']!==_0x68cb('0x3e')){var _0x644d7={};_0x644d7[_0x37fad8[_0x68cb('0x2a')]]={'$like':'%'+_0x3bfd98['query'][_0x68cb('0x3d')]+'%'};return _0x644d7;}})});}_0x303682=_[_0x68cb('0x3f')]({},_0x303682,_0x3bfd98[_0x68cb('0x40')]);var _0x14e2a2={'where':_0x303682[_0x68cb('0x3b')]};return db['MailServerOut'][_0x68cb('0x1f')](_0x14e2a2)['then'](function(_0x12b511){_0x300f20['count']=_0x12b511;if(_0x3bfd98[_0x68cb('0x31')][_0x68cb('0x41')]){_0x303682['include']=[{'all':!![]}];}return db[_0x68cb('0x2b')][_0x68cb('0x42')](_0x303682);})[_0x68cb('0x26')](function(_0x201de8){_0x300f20[_0x68cb('0x43')]=_0x201de8;return _0x300f20;})[_0x68cb('0x26')](respondWithFilteredResult(_0x26d6f7,_0x303682))[_0x68cb('0x44')](handleError(_0x26d6f7,null));};exports[_0x68cb('0x45')]=function(_0x21a27a,_0x169ec4){var _0x5568e3={'raw':!![],'where':{'id':_0x21a27a['params']['id']}},_0x43f10d={};_0x43f10d[_0x68cb('0x2f')]=_[_0x68cb('0x32')](db[_0x68cb('0x2b')]['rawAttributes']);_0x43f10d['query']=_[_0x68cb('0x32')](_0x21a27a[_0x68cb('0x31')]);_0x43f10d['filters']=_[_0x68cb('0x34')](_0x43f10d[_0x68cb('0x2f')],_0x43f10d[_0x68cb('0x31')]);_0x5568e3[_0x68cb('0x36')]=_['intersection'](_0x43f10d[_0x68cb('0x2f')],qs['fields'](_0x21a27a['query'][_0x68cb('0x35')]));_0x5568e3['attributes']=_0x5568e3[_0x68cb('0x36')][_0x68cb('0x46')]?_0x5568e3[_0x68cb('0x36')]:_0x43f10d[_0x68cb('0x2f')];if(_0x21a27a[_0x68cb('0x31')][_0x68cb('0x41')]){_0x5568e3[_0x68cb('0x47')]=[{'all':!![]}];}_0x5568e3=_[_0x68cb('0x3f')]({},_0x5568e3,_0x21a27a[_0x68cb('0x40')]);return db[_0x68cb('0x2b')][_0x68cb('0x48')](_0x5568e3)[_0x68cb('0x26')](handleEntityNotFound(_0x169ec4,null))[_0x68cb('0x26')](respondWithResult(_0x169ec4,null))[_0x68cb('0x44')](handleError(_0x169ec4,null));};exports[_0x68cb('0x49')]=function(_0x3b2e22,_0x56e283){return db['MailServerOut'][_0x68cb('0x49')](_0x3b2e22[_0x68cb('0x4a')],{})[_0x68cb('0x26')](respondWithResult(_0x56e283,0xc9))['catch'](handleError(_0x56e283,null));};exports[_0x68cb('0x25')]=function(_0x345e5a,_0x3b6fa0){if(_0x345e5a[_0x68cb('0x4a')]['id']){delete _0x345e5a[_0x68cb('0x4a')]['id'];}return db[_0x68cb('0x2b')]['find']({'where':{'id':_0x345e5a[_0x68cb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b6fa0,null))['then'](saveUpdates(_0x345e5a[_0x68cb('0x4a')],null))['then'](respondWithResult(_0x3b6fa0,null))[_0x68cb('0x44')](handleError(_0x3b6fa0,null));};exports[_0x68cb('0x27')]=function(_0x26cc7f,_0x3d0e4e){return db[_0x68cb('0x2b')][_0x68cb('0x48')]({'where':{'id':_0x26cc7f['params']['id']}})[_0x68cb('0x26')](handleEntityNotFound(_0x3d0e4e,null))['then'](removeEntity(_0x3d0e4e,null))[_0x68cb('0x44')](handleError(_0x3d0e4e,null));}; \ No newline at end of file +var _0x8304=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailServerOut','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x337809,_0x1d5ea0){var _0xfacae7=function(_0x1b9487){while(--_0x1b9487){_0x337809['push'](_0x337809['shift']());}};_0xfacae7(++_0x1d5ea0);}(_0x8304,0x80));var _0x4830=function(_0x12ea3f,_0x483e24){_0x12ea3f=_0x12ea3f-0x0;var _0xced9ec=_0x8304[_0x12ea3f];return _0xced9ec;};'use strict';var emlformat=require(_0x4830('0x0'));var rimraf=require(_0x4830('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4830('0x2'));var rp=require(_0x4830('0x3'));var moment=require('moment');var BPromise=require(_0x4830('0x4'));var Mustache=require(_0x4830('0x5'));var util=require(_0x4830('0x6'));var path=require(_0x4830('0x7'));var sox=require(_0x4830('0x8'));var csv=require('to-csv');var ejs=require(_0x4830('0x9'));var fs=require('fs');var fs_extra=require(_0x4830('0xa'));var _=require(_0x4830('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4830('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4830('0xd'));var Papa=require('papaparse');var Redis=require(_0x4830('0xe'));var authService=require(_0x4830('0xf'));var qs=require(_0x4830('0x10'));var as=require(_0x4830('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4830('0x12'))(_0x4830('0x13'));var utils=require(_0x4830('0x14'));var config=require(_0x4830('0x15'));var licenseUtil=require(_0x4830('0x16'));var db=require(_0x4830('0x17'))['db'];function respondWithStatusCode(_0x31ac11,_0x9cd971){_0x9cd971=_0x9cd971||0xcc;return function(_0x540402){if(_0x540402){return _0x31ac11[_0x4830('0x18')](_0x9cd971);}return _0x31ac11['status'](_0x9cd971)[_0x4830('0x19')]();};}function respondWithResult(_0x28a87a,_0x5ca362){_0x5ca362=_0x5ca362||0xc8;return function(_0x17e025){if(_0x17e025){return _0x28a87a[_0x4830('0x1a')](_0x5ca362)[_0x4830('0x1b')](_0x17e025);}};}function respondWithFilteredResult(_0x25b893,_0x31293e){return function(_0x17451e){if(_0x17451e){var _0x576405=typeof _0x31293e[_0x4830('0x1c')]===_0x4830('0x1d')&&typeof _0x31293e[_0x4830('0x1e')]===_0x4830('0x1d');var _0x428bc4=_0x17451e[_0x4830('0x1f')];var _0x269145=_0x576405?0x0:_0x31293e[_0x4830('0x1c')];var _0xe11048=_0x576405?_0x17451e[_0x4830('0x1f')]:_0x31293e[_0x4830('0x1c')]+_0x31293e[_0x4830('0x1e')];var _0x3e9b08;if(_0xe11048>=_0x428bc4){_0xe11048=_0x428bc4;_0x3e9b08=0xc8;}else{_0x3e9b08=0xce;}_0x25b893['status'](_0x3e9b08);return _0x25b893['set'](_0x4830('0x20'),_0x269145+'-'+_0xe11048+'/'+_0x428bc4)[_0x4830('0x1b')](_0x17451e);}return null;};}function patchUpdates(_0x19c823){return function(_0x36a8fc){try{jsonpatch[_0x4830('0x21')](_0x36a8fc,_0x19c823,!![]);}catch(_0x5652dc){return BPromise[_0x4830('0x22')](_0x5652dc);}return _0x36a8fc[_0x4830('0x23')]();};}function saveUpdates(_0x3a88e1,_0x39e1e2){return function(_0x5eb580){if(_0x5eb580){return _0x5eb580[_0x4830('0x24')](_0x3a88e1)[_0x4830('0x25')](function(_0x1dded5){return _0x1dded5;});}return null;};}function removeEntity(_0x58948f,_0x1ce201){return function(_0xe707a){if(_0xe707a){return _0xe707a[_0x4830('0x26')]()[_0x4830('0x25')](function(){_0x58948f['status'](0xcc)[_0x4830('0x19')]();});}};}function handleEntityNotFound(_0x56f130,_0x3d43da){return function(_0x94cac3){if(!_0x94cac3){_0x56f130[_0x4830('0x18')](0x194);}return _0x94cac3;};}function handleError(_0x309cbe,_0x3a7d92){_0x3a7d92=_0x3a7d92||0x1f4;return function(_0xacd1cc){logger[_0x4830('0x27')](_0xacd1cc['stack']);if(_0xacd1cc['name']){delete _0xacd1cc[_0x4830('0x28')];}_0x309cbe[_0x4830('0x1a')](_0x3a7d92)[_0x4830('0x29')](_0xacd1cc);};}exports[_0x4830('0x2a')]=function(_0x299c4f,_0x262f33){var _0x382464={},_0x551625={},_0x288f9e={'count':0x0,'rows':[]};var _0x419c17=_[_0x4830('0x2b')](db[_0x4830('0x2c')]['rawAttributes'],function(_0x3d5f9c){return{'name':_0x3d5f9c[_0x4830('0x2d')],'type':_0x3d5f9c[_0x4830('0x2e')][_0x4830('0x2f')]};});_0x551625['model']=_['map'](_0x419c17,_0x4830('0x28'));_0x551625[_0x4830('0x30')]=_[_0x4830('0x31')](_0x299c4f[_0x4830('0x30')]);_0x551625['filters']=_[_0x4830('0x32')](_0x551625['model'],_0x551625[_0x4830('0x30')]);_0x382464[_0x4830('0x33')]=_[_0x4830('0x32')](_0x551625[_0x4830('0x34')],qs[_0x4830('0x35')](_0x299c4f[_0x4830('0x30')][_0x4830('0x35')]));_0x382464[_0x4830('0x33')]=_0x382464['attributes']['length']?_0x382464[_0x4830('0x33')]:_0x551625[_0x4830('0x34')];if(!_0x299c4f['query'][_0x4830('0x36')](_0x4830('0x37'))){_0x382464[_0x4830('0x1e')]=qs[_0x4830('0x1e')](_0x299c4f[_0x4830('0x30')]['limit']);_0x382464[_0x4830('0x1c')]=qs['offset'](_0x299c4f[_0x4830('0x30')][_0x4830('0x1c')]);}_0x382464[_0x4830('0x38')]=qs[_0x4830('0x39')](_0x299c4f[_0x4830('0x30')]['sort']);_0x382464[_0x4830('0x3a')]=qs[_0x4830('0x3b')](_[_0x4830('0x3c')](_0x299c4f['query'],_0x551625[_0x4830('0x3b')]),_0x419c17);if(_0x299c4f[_0x4830('0x30')][_0x4830('0x3d')]){_0x382464[_0x4830('0x3a')]=_[_0x4830('0x3e')](_0x382464['where'],{'$or':_[_0x4830('0x2b')](_0x419c17,function(_0x28f285){if(_0x28f285[_0x4830('0x2e')]!==_0x4830('0x3f')){var _0x4f877b={};_0x4f877b[_0x28f285[_0x4830('0x28')]]={'$like':'%'+_0x299c4f[_0x4830('0x30')][_0x4830('0x3d')]+'%'};return _0x4f877b;}})});}_0x382464=_[_0x4830('0x3e')]({},_0x382464,_0x299c4f[_0x4830('0x40')]);var _0x2442dc={'where':_0x382464[_0x4830('0x3a')]};return db[_0x4830('0x2c')]['count'](_0x2442dc)[_0x4830('0x25')](function(_0x12563c){_0x288f9e['count']=_0x12563c;if(_0x299c4f[_0x4830('0x30')][_0x4830('0x41')]){_0x382464[_0x4830('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x4830('0x43')](_0x382464);})['then'](function(_0x2a6caf){_0x288f9e['rows']=_0x2a6caf;return _0x288f9e;})[_0x4830('0x25')](respondWithFilteredResult(_0x262f33,_0x382464))[_0x4830('0x44')](handleError(_0x262f33,null));};exports[_0x4830('0x45')]=function(_0x28f917,_0x994be6){var _0x1131e0={'raw':!![],'where':{'id':_0x28f917[_0x4830('0x46')]['id']}},_0x537ba3={};_0x537ba3[_0x4830('0x34')]=_[_0x4830('0x31')](db[_0x4830('0x2c')]['rawAttributes']);_0x537ba3[_0x4830('0x30')]=_[_0x4830('0x31')](_0x28f917['query']);_0x537ba3[_0x4830('0x3b')]=_[_0x4830('0x32')](_0x537ba3[_0x4830('0x34')],_0x537ba3[_0x4830('0x30')]);_0x1131e0[_0x4830('0x33')]=_[_0x4830('0x32')](_0x537ba3['model'],qs[_0x4830('0x35')](_0x28f917['query']['fields']));_0x1131e0[_0x4830('0x33')]=_0x1131e0['attributes']['length']?_0x1131e0[_0x4830('0x33')]:_0x537ba3['model'];if(_0x28f917['query']['includeAll']){_0x1131e0[_0x4830('0x42')]=[{'all':!![]}];}_0x1131e0=_['merge']({},_0x1131e0,_0x28f917[_0x4830('0x40')]);return db[_0x4830('0x2c')]['find'](_0x1131e0)[_0x4830('0x25')](handleEntityNotFound(_0x994be6,null))[_0x4830('0x25')](respondWithResult(_0x994be6,null))[_0x4830('0x44')](handleError(_0x994be6,null));};exports[_0x4830('0x47')]=function(_0x753d14,_0x4663ce){return db[_0x4830('0x2c')][_0x4830('0x47')](_0x753d14['body'],{})[_0x4830('0x25')](respondWithResult(_0x4663ce,0xc9))[_0x4830('0x44')](handleError(_0x4663ce,null));};exports[_0x4830('0x24')]=function(_0x59f1d3,_0x43483d){if(_0x59f1d3[_0x4830('0x48')]['id']){delete _0x59f1d3[_0x4830('0x48')]['id'];}return db[_0x4830('0x2c')][_0x4830('0x49')]({'where':{'id':_0x59f1d3[_0x4830('0x46')]['id']}})[_0x4830('0x25')](handleEntityNotFound(_0x43483d,null))[_0x4830('0x25')](saveUpdates(_0x59f1d3[_0x4830('0x48')],null))[_0x4830('0x25')](respondWithResult(_0x43483d,null))[_0x4830('0x44')](handleError(_0x43483d,null));};exports[_0x4830('0x26')]=function(_0x39a4c2,_0x277334){return db[_0x4830('0x2c')][_0x4830('0x49')]({'where':{'id':_0x39a4c2[_0x4830('0x46')]['id']}})[_0x4830('0x25')](handleEntityNotFound(_0x277334,null))[_0x4830('0x25')](removeEntity(_0x277334,null))[_0x4830('0x44')](handleError(_0x277334,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 476bd43..1fd9bf2 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 _0x9a1f=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x9a1f,0x1a5));var _0xf9a1=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x9a1f[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xf9a1('0x0'));var util=require(_0xf9a1('0x1'));var logger=require(_0xf9a1('0x2'))(_0xf9a1('0x3'));var moment=require(_0xf9a1('0x4'));var BPromise=require(_0xf9a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf9a1('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xf9a1('0x7')]=function(_0x3c072a,_0x735d94){return _0x3c072a[_0xf9a1('0x8')]('MailServerOut',attributes,{'tableName':_0xf9a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2575=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out'];(function(_0x58a450,_0x2534f4){var _0x5bda71=function(_0x1be024){while(--_0x1be024){_0x58a450['push'](_0x58a450['shift']());}};_0x5bda71(++_0x2534f4);}(_0x2575,0xfd));var _0x5257=function(_0x4d5d95,_0x532d7f){_0x4d5d95=_0x4d5d95-0x0;var _0x58e4e2=_0x2575[_0x4d5d95];return _0x58e4e2;};'use strict';var _=require(_0x5257('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5257('0x1'));var moment=require('moment');var BPromise=require(_0x5257('0x2'));var rp=require(_0x5257('0x3'));var fs=require('fs');var path=require(_0x5257('0x4'));var rimraf=require(_0x5257('0x5'));var config=require(_0x5257('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x5257('0x7')]=function(_0x37b0e4,_0x1d8256){return _0x37b0e4[_0x5257('0x8')](_0x5257('0x9'),attributes,{'tableName':_0x5257('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index a8413b8..76496d2 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x541df8,_0x4f7fb6){var _0x342293=function(_0x49ac48){while(--_0x49ac48){_0x541df8['push'](_0x541df8['shift']());}};_0x342293(++_0x4f7fb6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4bcc32,_0xddaf3a){_0x4bcc32=_0x4bcc32-0x0;var _0x240994=_0x5f2f[_0x4bcc32];return _0x240994;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x32666d,_0x18889a){var _0x2c90a3=function(_0xb3e672){while(--_0xb3e672){_0x32666d['push'](_0x32666d['shift']());}};_0x2c90a3(++_0x18889a);}(_0xdb28,0x106));var _0x8db2=function(_0x1df45e,_0x5a86a5){_0x1df45e=_0x1df45e-0x0;var _0x549506=_0xdb28[_0x1df45e];return _0x549506;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ca92e3c..7e3b839 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 _0xc776=['get','isAuthenticated','/describe','describe','post','create','put','/:id','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ed2dc,_0x14599d){var _0x397385=function(_0x39ac77){while(--_0x39ac77){_0x5ed2dc['push'](_0x5ed2dc['shift']());}};_0x397385(++_0x14599d);}(_0xc776,0x88));var _0x6c77=function(_0x9bcddc,_0x2cde2f){_0x9bcddc=_0x9bcddc-0x0;var _0x5089d0=_0xc776[_0x9bcddc];return _0x5089d0;};'use strict';var multer=require('multer');var util=require(_0x6c77('0x0'));var path=require(_0x6c77('0x1'));var timeout=require(_0x6c77('0x2'));var express=require(_0x6c77('0x3'));var router=express[_0x6c77('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c77('0x5'));var interaction=require(_0x6c77('0x6'));var config=require(_0x6c77('0x7'));var controller=require('./mailSubstatus.controller');router[_0x6c77('0x8')]('/',auth[_0x6c77('0x9')](),controller['index']);router['get'](_0x6c77('0xa'),auth[_0x6c77('0x9')](),controller[_0x6c77('0xb')]);router[_0x6c77('0x8')]('/:id',auth[_0x6c77('0x9')](),controller['show']);router[_0x6c77('0xc')]('/',auth[_0x6c77('0x9')](),controller[_0x6c77('0xd')]);router[_0x6c77('0xe')](_0x6c77('0xf'),auth[_0x6c77('0x9')](),controller[_0x6c77('0x10')]);router['delete'](_0x6c77('0xf'),auth[_0x6c77('0x9')](),controller[_0x6c77('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5d1c=['get','/:id','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','./mailSubstatus.controller','isAuthenticated','/describe','describe'];(function(_0x5e6da5,_0x3fd477){var _0x2e41f9=function(_0x3357ca){while(--_0x3357ca){_0x5e6da5['push'](_0x5e6da5['shift']());}};_0x2e41f9(++_0x3fd477);}(_0x5d1c,0x116));var _0xc5d1=function(_0xe1e676,_0x53f2d5){_0xe1e676=_0xe1e676-0x0;var _0x28798f=_0x5d1c[_0xe1e676];return _0x28798f;};'use strict';var multer=require(_0xc5d1('0x0'));var util=require(_0xc5d1('0x1'));var path=require(_0xc5d1('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5d1('0x3'));var router=express[_0xc5d1('0x4')]();var fs_extra=require(_0xc5d1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc5d1('0x6'));router['get']('/',auth[_0xc5d1('0x7')](),controller['index']);router['get'](_0xc5d1('0x8'),auth[_0xc5d1('0x7')](),controller[_0xc5d1('0x9')]);router[_0xc5d1('0xa')](_0xc5d1('0xb'),auth[_0xc5d1('0x7')](),controller['show']);router[_0xc5d1('0xc')]('/',auth[_0xc5d1('0x7')](),controller[_0xc5d1('0xd')]);router[_0xc5d1('0xe')]('/:id',auth[_0xc5d1('0x7')](),controller[_0xc5d1('0xf')]);router['delete'](_0xc5d1('0xb'),auth[_0xc5d1('0x7')](),controller[_0xc5d1('0x10')]);module[_0xc5d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 17cdfc8..22bf2a1 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 _0x4317=['name','exports','STRING'];(function(_0x50e879,_0x28ce9a){var _0x4845d2=function(_0x4f446b){while(--_0x4f446b){_0x50e879['push'](_0x50e879['shift']());}};_0x4845d2(++_0x28ce9a);}(_0x4317,0x7c));var _0x7431=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4317[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x7431('0x0')]={'name':{'type':Sequelize[_0x7431('0x1')],'unique':_0x7431('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e4b=['STRING','sequelize','exports'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x591a59,_0x3f9d6c){_0x591a59=_0x591a59-0x0;var _0x29ca33=_0x0e4b[_0x591a59];return _0x29ca33;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a835328..33047af 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 _0xbac4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','filter','where','merge','VIRTUAL','include','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1fb9d2,_0x57a208){var _0x4a8916=function(_0x215bf8){while(--_0x215bf8){_0x1fb9d2['push'](_0x1fb9d2['shift']());}};_0x4a8916(++_0x57a208);}(_0xbac4,0x184));var _0x4bac=function(_0x44dbc5,_0x5a3a00){_0x44dbc5=_0x44dbc5-0x0;var _0x49c8b5=_0xbac4[_0x44dbc5];return _0x49c8b5;};'use strict';var emlformat=require(_0x4bac('0x0'));var rimraf=require(_0x4bac('0x1'));var zipdir=require(_0x4bac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bac('0x3'));var moment=require(_0x4bac('0x4'));var BPromise=require(_0x4bac('0x5'));var Mustache=require('mustache');var util=require(_0x4bac('0x6'));var path=require(_0x4bac('0x7'));var sox=require(_0x4bac('0x8'));var csv=require(_0x4bac('0x9'));var ejs=require(_0x4bac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4bac('0xb'));var crypto=require(_0x4bac('0xc'));var jsforce=require(_0x4bac('0xd'));var deskjs=require(_0x4bac('0xe'));var toCsv=require(_0x4bac('0x9'));var querystring=require(_0x4bac('0xf'));var Papa=require(_0x4bac('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4bac('0x11'));var as=require(_0x4bac('0x12'));var hardwareService=require(_0x4bac('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4bac('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4bac('0x15'));var db=require(_0x4bac('0x16'))['db'];function respondWithStatusCode(_0x471326,_0x1f4261){_0x1f4261=_0x1f4261||0xcc;return function(_0x4cc4e7){if(_0x4cc4e7){return _0x471326[_0x4bac('0x17')](_0x1f4261);}return _0x471326[_0x4bac('0x18')](_0x1f4261)[_0x4bac('0x19')]();};}function respondWithResult(_0x5a6099,_0x1563ca){_0x1563ca=_0x1563ca||0xc8;return function(_0x2cbdd3){if(_0x2cbdd3){return _0x5a6099[_0x4bac('0x18')](_0x1563ca)[_0x4bac('0x1a')](_0x2cbdd3);}};}function respondWithFilteredResult(_0x1cedfe,_0xdaf4a0){return function(_0x443bee){if(_0x443bee){var _0x2e1a25=typeof _0xdaf4a0['offset']===_0x4bac('0x1b')&&typeof _0xdaf4a0[_0x4bac('0x1c')]===_0x4bac('0x1b');var _0x38be9d=_0x443bee[_0x4bac('0x1d')];var _0x169e25=_0x2e1a25?0x0:_0xdaf4a0['offset'];var _0x11afc2=_0x2e1a25?_0x443bee[_0x4bac('0x1d')]:_0xdaf4a0['offset']+_0xdaf4a0[_0x4bac('0x1c')];var _0x2363cb;if(_0x11afc2>=_0x38be9d){_0x11afc2=_0x38be9d;_0x2363cb=0xc8;}else{_0x2363cb=0xce;}_0x1cedfe['status'](_0x2363cb);return _0x1cedfe['set'](_0x4bac('0x1e'),_0x169e25+'-'+_0x11afc2+'/'+_0x38be9d)[_0x4bac('0x1a')](_0x443bee);}return null;};}function patchUpdates(_0x5c52f1){return function(_0x87b0be){try{jsonpatch['apply'](_0x87b0be,_0x5c52f1,!![]);}catch(_0x316387){return BPromise[_0x4bac('0x1f')](_0x316387);}return _0x87b0be[_0x4bac('0x20')]();};}function saveUpdates(_0x494cec,_0x559c23){return function(_0x1fc1d5){if(_0x1fc1d5){return _0x1fc1d5[_0x4bac('0x21')](_0x494cec)[_0x4bac('0x22')](function(_0x3ab344){return _0x3ab344;});}return null;};}function removeEntity(_0x3236aa,_0xc9e130){return function(_0x15fb72){if(_0x15fb72){return _0x15fb72[_0x4bac('0x23')]()[_0x4bac('0x22')](function(){_0x3236aa[_0x4bac('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228b25,_0x5eea7c){return function(_0x421f77){if(!_0x421f77){_0x228b25[_0x4bac('0x17')](0x194);}return _0x421f77;};}function handleError(_0x537554,_0x3cc421){_0x3cc421=_0x3cc421||0x1f4;return function(_0x43bb6a){logger['error'](_0x43bb6a[_0x4bac('0x24')]);if(_0x43bb6a['name']){delete _0x43bb6a[_0x4bac('0x25')];}_0x537554[_0x4bac('0x18')](_0x3cc421)[_0x4bac('0x26')](_0x43bb6a);};}exports['index']=function(_0x59ba4d,_0x48f645){var _0x470e05={},_0x4d79d3={},_0x344df2={'count':0x0,'rows':[]};var _0x41e6f9=_[_0x4bac('0x27')](db[_0x4bac('0x28')][_0x4bac('0x29')],function(_0x5bc8f7){return{'name':_0x5bc8f7[_0x4bac('0x2a')],'type':_0x5bc8f7[_0x4bac('0x2b')][_0x4bac('0x2c')]};});_0x4d79d3[_0x4bac('0x2d')]=_['map'](_0x41e6f9,'name');_0x4d79d3[_0x4bac('0x2e')]=_[_0x4bac('0x2f')](_0x59ba4d['query']);_0x4d79d3[_0x4bac('0x30')]=_[_0x4bac('0x31')](_0x4d79d3[_0x4bac('0x2d')],_0x4d79d3[_0x4bac('0x2e')]);_0x470e05[_0x4bac('0x32')]=_[_0x4bac('0x31')](_0x4d79d3[_0x4bac('0x2d')],qs['fields'](_0x59ba4d[_0x4bac('0x2e')][_0x4bac('0x33')]));_0x470e05[_0x4bac('0x32')]=_0x470e05[_0x4bac('0x32')][_0x4bac('0x34')]?_0x470e05[_0x4bac('0x32')]:_0x4d79d3[_0x4bac('0x2d')];if(!_0x59ba4d[_0x4bac('0x2e')][_0x4bac('0x35')]('nolimit')){_0x470e05['limit']=qs[_0x4bac('0x1c')](_0x59ba4d[_0x4bac('0x2e')][_0x4bac('0x1c')]);_0x470e05[_0x4bac('0x36')]=qs['offset'](_0x59ba4d[_0x4bac('0x2e')]['offset']);}_0x470e05[_0x4bac('0x37')]=qs[_0x4bac('0x38')](_0x59ba4d[_0x4bac('0x2e')][_0x4bac('0x38')]);_0x470e05['where']=qs[_0x4bac('0x30')](_['pick'](_0x59ba4d[_0x4bac('0x2e')],_0x4d79d3[_0x4bac('0x30')]),_0x41e6f9);if(_0x59ba4d[_0x4bac('0x2e')][_0x4bac('0x39')]){_0x470e05[_0x4bac('0x3a')]=_[_0x4bac('0x3b')](_0x470e05[_0x4bac('0x3a')],{'$or':_[_0x4bac('0x27')](_0x41e6f9,function(_0x399cf8){if(_0x399cf8['type']!==_0x4bac('0x3c')){var _0x5b4151={};_0x5b4151[_0x399cf8[_0x4bac('0x25')]]={'$like':'%'+_0x59ba4d[_0x4bac('0x2e')][_0x4bac('0x39')]+'%'};return _0x5b4151;}})});}_0x470e05=_[_0x4bac('0x3b')]({},_0x470e05,_0x59ba4d['options']);var _0x16d319={'where':_0x470e05[_0x4bac('0x3a')]};return db[_0x4bac('0x28')][_0x4bac('0x1d')](_0x16d319)[_0x4bac('0x22')](function(_0x2e51e4){_0x344df2['count']=_0x2e51e4;if(_0x59ba4d[_0x4bac('0x2e')]['includeAll']){_0x470e05[_0x4bac('0x3d')]=[{'all':!![]}];}return db[_0x4bac('0x28')]['findAll'](_0x470e05);})[_0x4bac('0x22')](function(_0x74bc1d){_0x344df2['rows']=_0x74bc1d;return _0x344df2;})[_0x4bac('0x22')](respondWithFilteredResult(_0x48f645,_0x470e05))[_0x4bac('0x3e')](handleError(_0x48f645,null));};exports['show']=function(_0xe5115b,_0x58c3ba){var _0x53d848={'raw':!![],'where':{'id':_0xe5115b[_0x4bac('0x3f')]['id']}},_0x2c6f71={};_0x2c6f71[_0x4bac('0x2d')]=_[_0x4bac('0x2f')](db[_0x4bac('0x28')][_0x4bac('0x29')]);_0x2c6f71[_0x4bac('0x2e')]=_[_0x4bac('0x2f')](_0xe5115b[_0x4bac('0x2e')]);_0x2c6f71[_0x4bac('0x30')]=_[_0x4bac('0x31')](_0x2c6f71[_0x4bac('0x2d')],_0x2c6f71['query']);_0x53d848['attributes']=_[_0x4bac('0x31')](_0x2c6f71['model'],qs['fields'](_0xe5115b[_0x4bac('0x2e')]['fields']));_0x53d848[_0x4bac('0x32')]=_0x53d848[_0x4bac('0x32')][_0x4bac('0x34')]?_0x53d848['attributes']:_0x2c6f71[_0x4bac('0x2d')];if(_0xe5115b['query']['includeAll']){_0x53d848[_0x4bac('0x3d')]=[{'all':!![]}];}_0x53d848=_[_0x4bac('0x3b')]({},_0x53d848,_0xe5115b['options']);return db['MailSubstatus'][_0x4bac('0x40')](_0x53d848)[_0x4bac('0x22')](handleEntityNotFound(_0x58c3ba,null))[_0x4bac('0x22')](respondWithResult(_0x58c3ba,null))[_0x4bac('0x3e')](handleError(_0x58c3ba,null));};exports[_0x4bac('0x41')]=function(_0x34fe24,_0x18e21d){return db[_0x4bac('0x28')][_0x4bac('0x41')](_0x34fe24[_0x4bac('0x42')],{})[_0x4bac('0x22')](respondWithResult(_0x18e21d,0xc9))[_0x4bac('0x3e')](handleError(_0x18e21d,null));};exports[_0x4bac('0x21')]=function(_0x28db6d,_0x254248){if(_0x28db6d[_0x4bac('0x42')]['id']){delete _0x28db6d[_0x4bac('0x42')]['id'];}return db[_0x4bac('0x28')]['find']({'where':{'id':_0x28db6d['params']['id']}})[_0x4bac('0x22')](handleEntityNotFound(_0x254248,null))[_0x4bac('0x22')](saveUpdates(_0x28db6d['body'],null))[_0x4bac('0x22')](respondWithResult(_0x254248,null))['catch'](handleError(_0x254248,null));};exports[_0x4bac('0x23')]=function(_0x34f1e6,_0x6197ff){return db[_0x4bac('0x28')][_0x4bac('0x40')]({'where':{'id':_0x34f1e6[_0x4bac('0x3f')]['id']}})[_0x4bac('0x22')](handleEntityNotFound(_0x6197ff,null))[_0x4bac('0x22')](removeEntity(_0x6197ff,null))[_0x4bac('0x3e')](handleError(_0x6197ff,null));};exports['describe']=function(_0x3f4933,_0x4b5946){return db[_0x4bac('0x28')][_0x4bac('0x43')]()['then'](respondWithResult(_0x4b5946,null))['catch'](handleError(_0x4b5946,null));}; \ No newline at end of file +var _0xdc80=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','stack','name','send','MailSubstatus','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','keys','find','body','update','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xdc80,0x108));var _0x0dc8=function(_0x20713e,_0x44f710){_0x20713e=_0x20713e-0x0;var _0x7d998b=_0xdc80[_0x20713e];return _0x7d998b;};'use strict';var emlformat=require(_0x0dc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dc8('0x1'));var jsonpatch=require(_0x0dc8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0dc8('0x3'));var Mustache=require(_0x0dc8('0x4'));var util=require(_0x0dc8('0x5'));var path=require(_0x0dc8('0x6'));var sox=require(_0x0dc8('0x7'));var csv=require(_0x0dc8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0dc8('0x9'));var _=require(_0x0dc8('0xa'));var squel=require('squel');var crypto=require(_0x0dc8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0dc8('0x8'));var querystring=require(_0x0dc8('0xc'));var Papa=require(_0x0dc8('0xd'));var Redis=require(_0x0dc8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0dc8('0xf'));var as=require(_0x0dc8('0x10'));var hardwareService=require(_0x0dc8('0x11'));var logger=require(_0x0dc8('0x12'))(_0x0dc8('0x13'));var utils=require(_0x0dc8('0x14'));var config=require(_0x0dc8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x270743,_0x5e444c){_0x5e444c=_0x5e444c||0xcc;return function(_0x157a0f){if(_0x157a0f){return _0x270743[_0x0dc8('0x16')](_0x5e444c);}return _0x270743[_0x0dc8('0x17')](_0x5e444c)[_0x0dc8('0x18')]();};}function respondWithResult(_0x3d5cb0,_0x382e48){_0x382e48=_0x382e48||0xc8;return function(_0x368df0){if(_0x368df0){return _0x3d5cb0[_0x0dc8('0x17')](_0x382e48)[_0x0dc8('0x19')](_0x368df0);}};}function respondWithFilteredResult(_0x4bb824,_0x4fa9f8){return function(_0x2e191c){if(_0x2e191c){var _0x56a47f=typeof _0x4fa9f8[_0x0dc8('0x1a')]===_0x0dc8('0x1b')&&typeof _0x4fa9f8[_0x0dc8('0x1c')]===_0x0dc8('0x1b');var _0x4465bc=_0x2e191c[_0x0dc8('0x1d')];var _0x1fea21=_0x56a47f?0x0:_0x4fa9f8['offset'];var _0x5761e1=_0x56a47f?_0x2e191c['count']:_0x4fa9f8[_0x0dc8('0x1a')]+_0x4fa9f8[_0x0dc8('0x1c')];var _0x201695;if(_0x5761e1>=_0x4465bc){_0x5761e1=_0x4465bc;_0x201695=0xc8;}else{_0x201695=0xce;}_0x4bb824[_0x0dc8('0x17')](_0x201695);return _0x4bb824['set'](_0x0dc8('0x1e'),_0x1fea21+'-'+_0x5761e1+'/'+_0x4465bc)[_0x0dc8('0x19')](_0x2e191c);}return null;};}function patchUpdates(_0x4ad2b8){return function(_0x2a2807){try{jsonpatch[_0x0dc8('0x1f')](_0x2a2807,_0x4ad2b8,!![]);}catch(_0x3d883d){return BPromise[_0x0dc8('0x20')](_0x3d883d);}return _0x2a2807[_0x0dc8('0x21')]();};}function saveUpdates(_0x305bcc,_0x3abd4f){return function(_0x54e024){if(_0x54e024){return _0x54e024['update'](_0x305bcc)[_0x0dc8('0x22')](function(_0x38cd1a){return _0x38cd1a;});}return null;};}function removeEntity(_0x51a30a,_0x8b0415){return function(_0x501cfe){if(_0x501cfe){return _0x501cfe['destroy']()['then'](function(){_0x51a30a['status'](0xcc)[_0x0dc8('0x18')]();});}};}function handleEntityNotFound(_0x48d658,_0x3a3810){return function(_0x4c0073){if(!_0x4c0073){_0x48d658[_0x0dc8('0x16')](0x194);}return _0x4c0073;};}function handleError(_0x16daf2,_0x3ae858){_0x3ae858=_0x3ae858||0x1f4;return function(_0x2d3f5d){logger['error'](_0x2d3f5d[_0x0dc8('0x23')]);if(_0x2d3f5d['name']){delete _0x2d3f5d[_0x0dc8('0x24')];}_0x16daf2['status'](_0x3ae858)[_0x0dc8('0x25')](_0x2d3f5d);};}exports['index']=function(_0x51dc5f,_0xcfa963){var _0x154f90={},_0x25b929={},_0x45ff87={'count':0x0,'rows':[]};var _0x27b4f5=_['map'](db[_0x0dc8('0x26')][_0x0dc8('0x27')],function(_0xdf9744){return{'name':_0xdf9744['fieldName'],'type':_0xdf9744['type'][_0x0dc8('0x28')]};});_0x25b929[_0x0dc8('0x29')]=_['map'](_0x27b4f5,_0x0dc8('0x24'));_0x25b929[_0x0dc8('0x2a')]=_['keys'](_0x51dc5f['query']);_0x25b929['filters']=_[_0x0dc8('0x2b')](_0x25b929[_0x0dc8('0x29')],_0x25b929[_0x0dc8('0x2a')]);_0x154f90[_0x0dc8('0x2c')]=_['intersection'](_0x25b929[_0x0dc8('0x29')],qs[_0x0dc8('0x2d')](_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x2d')]));_0x154f90[_0x0dc8('0x2c')]=_0x154f90['attributes'][_0x0dc8('0x2e')]?_0x154f90[_0x0dc8('0x2c')]:_0x25b929[_0x0dc8('0x29')];if(!_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x2f')]('nolimit')){_0x154f90['limit']=qs[_0x0dc8('0x1c')](_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x1c')]);_0x154f90[_0x0dc8('0x1a')]=qs['offset'](_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x1a')]);}_0x154f90[_0x0dc8('0x30')]=qs[_0x0dc8('0x31')](_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x31')]);_0x154f90[_0x0dc8('0x32')]=qs[_0x0dc8('0x33')](_[_0x0dc8('0x34')](_0x51dc5f[_0x0dc8('0x2a')],_0x25b929['filters']),_0x27b4f5);if(_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x35')]){_0x154f90['where']=_[_0x0dc8('0x36')](_0x154f90[_0x0dc8('0x32')],{'$or':_[_0x0dc8('0x37')](_0x27b4f5,function(_0x2e61da){if(_0x2e61da[_0x0dc8('0x38')]!==_0x0dc8('0x39')){var _0x46d178={};_0x46d178[_0x2e61da[_0x0dc8('0x24')]]={'$like':'%'+_0x51dc5f['query'][_0x0dc8('0x35')]+'%'};return _0x46d178;}})});}_0x154f90=_[_0x0dc8('0x36')]({},_0x154f90,_0x51dc5f['options']);var _0x24d057={'where':_0x154f90['where']};return db['MailSubstatus'][_0x0dc8('0x1d')](_0x24d057)[_0x0dc8('0x22')](function(_0x64b68d){_0x45ff87[_0x0dc8('0x1d')]=_0x64b68d;if(_0x51dc5f[_0x0dc8('0x2a')][_0x0dc8('0x3a')]){_0x154f90[_0x0dc8('0x3b')]=[{'all':!![]}];}return db['MailSubstatus'][_0x0dc8('0x3c')](_0x154f90);})['then'](function(_0x2490fb){_0x45ff87[_0x0dc8('0x3d')]=_0x2490fb;return _0x45ff87;})['then'](respondWithFilteredResult(_0xcfa963,_0x154f90))[_0x0dc8('0x3e')](handleError(_0xcfa963,null));};exports['show']=function(_0x581320,_0x32290b){var _0x1dc2c1={'raw':!![],'where':{'id':_0x581320['params']['id']}},_0x5b0226={};_0x5b0226[_0x0dc8('0x29')]=_[_0x0dc8('0x3f')](db[_0x0dc8('0x26')]['rawAttributes']);_0x5b0226[_0x0dc8('0x2a')]=_['keys'](_0x581320[_0x0dc8('0x2a')]);_0x5b0226[_0x0dc8('0x33')]=_[_0x0dc8('0x2b')](_0x5b0226[_0x0dc8('0x29')],_0x5b0226[_0x0dc8('0x2a')]);_0x1dc2c1['attributes']=_[_0x0dc8('0x2b')](_0x5b0226[_0x0dc8('0x29')],qs[_0x0dc8('0x2d')](_0x581320['query']['fields']));_0x1dc2c1[_0x0dc8('0x2c')]=_0x1dc2c1[_0x0dc8('0x2c')][_0x0dc8('0x2e')]?_0x1dc2c1[_0x0dc8('0x2c')]:_0x5b0226['model'];if(_0x581320[_0x0dc8('0x2a')][_0x0dc8('0x3a')]){_0x1dc2c1[_0x0dc8('0x3b')]=[{'all':!![]}];}_0x1dc2c1=_[_0x0dc8('0x36')]({},_0x1dc2c1,_0x581320['options']);return db[_0x0dc8('0x26')][_0x0dc8('0x40')](_0x1dc2c1)[_0x0dc8('0x22')](handleEntityNotFound(_0x32290b,null))[_0x0dc8('0x22')](respondWithResult(_0x32290b,null))[_0x0dc8('0x3e')](handleError(_0x32290b,null));};exports['create']=function(_0x136685,_0x398da3){return db[_0x0dc8('0x26')]['create'](_0x136685[_0x0dc8('0x41')],{})[_0x0dc8('0x22')](respondWithResult(_0x398da3,0xc9))['catch'](handleError(_0x398da3,null));};exports[_0x0dc8('0x42')]=function(_0x151f28,_0x4e2be1){if(_0x151f28[_0x0dc8('0x41')]['id']){delete _0x151f28['body']['id'];}return db[_0x0dc8('0x26')][_0x0dc8('0x40')]({'where':{'id':_0x151f28[_0x0dc8('0x43')]['id']}})[_0x0dc8('0x22')](handleEntityNotFound(_0x4e2be1,null))[_0x0dc8('0x22')](saveUpdates(_0x151f28[_0x0dc8('0x41')],null))['then'](respondWithResult(_0x4e2be1,null))[_0x0dc8('0x3e')](handleError(_0x4e2be1,null));};exports['destroy']=function(_0x1f0d3e,_0x45cf92){return db[_0x0dc8('0x26')][_0x0dc8('0x40')]({'where':{'id':_0x1f0d3e[_0x0dc8('0x43')]['id']}})['then'](handleEntityNotFound(_0x45cf92,null))[_0x0dc8('0x22')](removeEntity(_0x45cf92,null))['catch'](handleError(_0x45cf92,null));};exports[_0x0dc8('0x44')]=function(_0x140b38,_0x14b551){return db[_0x0dc8('0x26')][_0x0dc8('0x44')]()[_0x0dc8('0x22')](respondWithResult(_0x14b551,null))[_0x0dc8('0x3e')](handleError(_0x14b551,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 58ab941..ef1b7e6 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 _0xf3c4=['emit','events','MailSubstatus','setMaxListeners'];(function(_0x5e81db,_0x6b691){var _0x2ae518=function(_0x12f6be){while(--_0x12f6be){_0x5e81db['push'](_0x5e81db['shift']());}};_0x2ae518(++_0x6b691);}(_0xf3c4,0xe9));var _0x4f3c=function(_0x498e72,_0x79a5af){_0x498e72=_0x498e72-0x0;var _0xbf99b9=_0xf3c4[_0x498e72];return _0xbf99b9;};'use strict';var EventEmitter=require(_0x4f3c('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x4f3c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4f3c('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x50f5af){return function(_0xaedd6b,_0x5cd9f7,_0x31b28b){MailSubstatusEvents[_0x4f3c('0x3')](_0x50f5af+':'+_0xaedd6b['id'],_0xaedd6b);MailSubstatusEvents[_0x4f3c('0x3')](_0x50f5af,_0xaedd6b);_0x31b28b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xd9c8=['setMaxListeners','update','emit','hook','exports','../../mysqldb','MailSubstatus'];(function(_0x3315ab,_0x134bff){var _0x54725f=function(_0x370ea9){while(--_0x370ea9){_0x3315ab['push'](_0x3315ab['shift']());}};_0x54725f(++_0x134bff);}(_0xd9c8,0x1ef));var _0x8d9c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd9c8[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x8d9c('0x0'))['db'][_0x8d9c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8d9c('0x2')](0x0);var events={'afterUpdate':_0x8d9c('0x3')};function emitEvent(_0x19741c){return function(_0x790505,_0x2bd4c7,_0x1629eb){MailSubstatusEvents[_0x8d9c('0x4')](_0x19741c+':'+_0x790505['id'],_0x790505);MailSubstatusEvents[_0x8d9c('0x4')](_0x19741c,_0x790505);_0x1629eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x8d9c('0x5')](e,emitEvent(event));}}module[_0x8d9c('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f67bfc0..a3a15cd 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 _0x0772=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','name'];(function(_0x29551f,_0x7326d6){var _0x2f2a22=function(_0x17202e){while(--_0x17202e){_0x29551f['push'](_0x29551f['shift']());}};_0x2f2a22(++_0x7326d6);}(_0x0772,0x1a8));var _0x2077=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0772[_0x122096];return _0x3d1966;};'use strict';var attributes=require(_0x2077('0x0'));module[_0x2077('0x1')]=function(_0x67a50b){var _0x2d0949=_0x67a50b[_0x2077('0x2')];return _0x67a50b[_0x2077('0x3')](_0x2077('0x4'),attributes,{'tableName':_0x2077('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x56439e,_0x175c08,_0x3f9d8f){return _0x2d0949[_0x2077('0x6')]['update']({'value':_0x56439e[_0x2077('0x7')]},{'where':{'field':_0x2077('0x8'),'value':_0x56439e[_0x2077('0x9')][_0x2077('0x7')]}})[_0x2077('0xa')](function(){_0x3f9d8f();})[_0x2077('0xb')](function(_0x20539d){_0x3f9d8f(_0x20539d);});}}});}; \ No newline at end of file +var _0xab66=['define','MailSubstatus','update','name','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes','exports'];(function(_0x3a3381,_0x14d286){var _0x2c1cc3=function(_0x44c412){while(--_0x44c412){_0x3a3381['push'](_0x3a3381['shift']());}};_0x2c1cc3(++_0x14d286);}(_0xab66,0x97));var _0x6ab6=function(_0x1ccc60,_0x469ad9){_0x1ccc60=_0x1ccc60-0x0;var _0x10403c=_0xab66[_0x1ccc60];return _0x10403c;};'use strict';var attributes=require(_0x6ab6('0x0'));module[_0x6ab6('0x1')]=function(_0x153061){var _0xf2fc08=_0x153061['models'];return _0x153061[_0x6ab6('0x2')](_0x6ab6('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5491f6,_0x3392c0,_0x1c3a39){return _0xf2fc08['Condition'][_0x6ab6('0x4')]({'value':_0x5491f6[_0x6ab6('0x5')]},{'where':{'field':_0x6ab6('0x6'),'value':_0x5491f6[_0x6ab6('0x7')][_0x6ab6('0x5')]}})['then'](function(){_0x1c3a39();})[_0x6ab6('0x8')](function(_0x41028d){_0x1c3a39(_0x41028d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1bb5717..221d9e3 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 _0x2fe8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x340187,_0x495715){var _0xc99b8d=function(_0x4e3edc){while(--_0x4e3edc){_0x340187['push'](_0x340187['shift']());}};_0xc99b8d(++_0x495715);}(_0x2fe8,0x14f));var _0x82fe=function(_0x59d655,_0x2a95cc){_0x59d655=_0x59d655-0x0;var _0x5925a7=_0x2fe8[_0x59d655];return _0x5925a7;};'use strict';var _=require(_0x82fe('0x0'));var util=require(_0x82fe('0x1'));var moment=require(_0x82fe('0x2'));var BPromise=require(_0x82fe('0x3'));var rs=require(_0x82fe('0x4'));var fs=require('fs');var Redis=require(_0x82fe('0x5'));var db=require(_0x82fe('0x6'))['db'];var utils=require(_0x82fe('0x7'));var logger=require(_0x82fe('0x8'))(_0x82fe('0x9'));var config=require(_0x82fe('0xa'));var jayson=require(_0x82fe('0xb'));var client=jayson[_0x82fe('0xc')][_0x82fe('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x9029b1,_0x2ff3dc,_0x28f9fe){return new BPromise(function(_0x3cb8f8,_0x436495){return client['request'](_0x9029b1,_0x28f9fe)[_0x82fe('0xe')](function(_0x4ed0ac){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x2ff3dc,_0x82fe('0xf'));logger[_0x82fe('0x10')](_0x82fe('0x11'),_0x2ff3dc,_0x82fe('0xf'),JSON[_0x82fe('0x12')](_0x4ed0ac));if(_0x4ed0ac['error']){if(_0x4ed0ac[_0x82fe('0x13')][_0x82fe('0x14')]===0x1f4){logger[_0x82fe('0x13')](_0x82fe('0x15'),_0x2ff3dc,_0x4ed0ac[_0x82fe('0x13')][_0x82fe('0x16')]);return _0x436495(_0x4ed0ac[_0x82fe('0x13')]['message']);}logger[_0x82fe('0x13')](_0x82fe('0x15'),_0x2ff3dc,_0x4ed0ac[_0x82fe('0x13')][_0x82fe('0x16')]);return _0x3cb8f8(_0x4ed0ac[_0x82fe('0x13')][_0x82fe('0x16')]);}else{logger[_0x82fe('0x17')](_0x82fe('0x15'),_0x2ff3dc,_0x82fe('0xf'));_0x3cb8f8(_0x4ed0ac[_0x82fe('0x18')][_0x82fe('0x16')]);}})[_0x82fe('0x19')](function(_0x14f0fe){logger['error'](_0x82fe('0x15'),_0x2ff3dc,_0x14f0fe);_0x436495(_0x14f0fe);});});} \ No newline at end of file +var _0xa8fc=['http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1552f4,_0x2054ed){var _0x40fa88=function(_0x357112){while(--_0x357112){_0x1552f4['push'](_0x1552f4['shift']());}};_0x40fa88(++_0x2054ed);}(_0xa8fc,0x144));var _0xca8f=function(_0x4d60de,_0x455681){_0x4d60de=_0x4d60de-0x0;var _0x47c506=_0xa8fc[_0x4d60de];return _0x47c506;};'use strict';var _=require(_0xca8f('0x0'));var util=require(_0xca8f('0x1'));var moment=require(_0xca8f('0x2'));var BPromise=require(_0xca8f('0x3'));var rs=require(_0xca8f('0x4'));var fs=require('fs');var Redis=require(_0xca8f('0x5'));var db=require(_0xca8f('0x6'))['db'];var utils=require(_0xca8f('0x7'));var logger=require(_0xca8f('0x8'))(_0xca8f('0x9'));var config=require(_0xca8f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xca8f('0xb')][_0xca8f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ac725,_0x41e98d,_0xe16f4f){return new BPromise(function(_0x3c623c,_0x404948){return client['request'](_0x1ac725,_0xe16f4f)[_0xca8f('0xd')](function(_0x5895a9){logger[_0xca8f('0xe')](_0xca8f('0xf'),_0x41e98d,_0xca8f('0x10'));logger['debug'](_0xca8f('0x11'),_0x41e98d,_0xca8f('0x10'),JSON[_0xca8f('0x12')](_0x5895a9));if(_0x5895a9[_0xca8f('0x13')]){if(_0x5895a9[_0xca8f('0x13')][_0xca8f('0x14')]===0x1f4){logger[_0xca8f('0x13')](_0xca8f('0xf'),_0x41e98d,_0x5895a9['error'][_0xca8f('0x15')]);return _0x404948(_0x5895a9[_0xca8f('0x13')]['message']);}logger[_0xca8f('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x41e98d,_0x5895a9[_0xca8f('0x13')][_0xca8f('0x15')]);return _0x3c623c(_0x5895a9[_0xca8f('0x13')]['message']);}else{logger[_0xca8f('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x41e98d,_0xca8f('0x10'));_0x3c623c(_0x5895a9[_0xca8f('0x16')][_0xca8f('0x15')]);}})[_0xca8f('0x17')](function(_0x489ee7){logger['error'](_0xca8f('0xf'),_0x41e98d,_0x489ee7);_0x404948(_0x489ee7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0518a01..6e028cd 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 _0x85df=['create','put','/:id','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0xc13673,_0x359507){var _0x990e21=function(_0x479f61){while(--_0x479f61){_0xc13673['push'](_0xc13673['shift']());}};_0x990e21(++_0x359507);}(_0x85df,0xc3));var _0xf85d=function(_0x5db37e,_0x21d1a1){_0x5db37e=_0x5db37e-0x0;var _0xa0a1c9=_0x85df[_0x5db37e];return _0xa0a1c9;};'use strict';var multer=require(_0xf85d('0x0'));var util=require(_0xf85d('0x1'));var path=require(_0xf85d('0x2'));var timeout=require('connect-timeout');var express=require(_0xf85d('0x3'));var router=express[_0xf85d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf85d('0x5'));var interaction=require(_0xf85d('0x6'));var config=require('../../config/environment');var controller=require(_0xf85d('0x7'));router[_0xf85d('0x8')]('/',auth[_0xf85d('0x9')](),controller[_0xf85d('0xa')]);router[_0xf85d('0x8')](_0xf85d('0xb'),auth[_0xf85d('0x9')](),controller['describe']);router[_0xf85d('0x8')]('/:id',auth[_0xf85d('0x9')](),controller[_0xf85d('0xc')]);router[_0xf85d('0xd')]('/',auth[_0xf85d('0x9')](),controller[_0xf85d('0xe')]);router[_0xf85d('0xf')](_0xf85d('0x10'),auth[_0xf85d('0x9')](),controller['update']);router[_0xf85d('0x11')](_0xf85d('0x10'),auth[_0xf85d('0x9')](),controller['destroy']);module[_0xf85d('0x12')]=router; \ No newline at end of file +var _0x27e2=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports'];(function(_0x580622,_0x46b895){var _0x249c64=function(_0x2cdd41){while(--_0x2cdd41){_0x580622['push'](_0x580622['shift']());}};_0x249c64(++_0x46b895);}(_0x27e2,0x1a4));var _0x227e=function(_0x4630f4,_0x4aa158){_0x4630f4=_0x4630f4-0x0;var _0x3e2187=_0x27e2[_0x4630f4];return _0x3e2187;};'use strict';var multer=require(_0x227e('0x0'));var util=require(_0x227e('0x1'));var path=require(_0x227e('0x2'));var timeout=require('connect-timeout');var express=require(_0x227e('0x3'));var router=express[_0x227e('0x4')]();var fs_extra=require(_0x227e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x227e('0x6'));var config=require(_0x227e('0x7'));var controller=require(_0x227e('0x8'));router[_0x227e('0x9')]('/',auth[_0x227e('0xa')](),controller[_0x227e('0xb')]);router['get'](_0x227e('0xc'),auth[_0x227e('0xa')](),controller[_0x227e('0xd')]);router[_0x227e('0x9')](_0x227e('0xe'),auth[_0x227e('0xa')](),controller[_0x227e('0xf')]);router['post']('/',auth[_0x227e('0xa')](),controller[_0x227e('0x10')]);router[_0x227e('0x11')](_0x227e('0xe'),auth[_0x227e('0xa')](),controller['update']);router['delete'](_0x227e('0xe'),auth[_0x227e('0xa')](),controller[_0x227e('0x12')]);module[_0x227e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 62fdd2f..7e83c60 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4ec515,_0x181d52){var _0x39ef77=function(_0x392cbe){while(--_0x392cbe){_0x4ec515['push'](_0x4ec515['shift']());}};_0x39ef77(++_0x181d52);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xaa88[_0x2e7f96];return _0x315277;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4b89d9,_0x3a4a59){var _0x5648ac=function(_0x247968){while(--_0x247968){_0x4b89d9['push'](_0x4b89d9['shift']());}};_0x5648ac(++_0x3a4a59);}(_0x008c,0x188));var _0xc008=function(_0x3e4006,_0x6690ec){_0x3e4006=_0x3e4006-0x0;var _0x2553c2=_0x008c[_0x3e4006];return _0x2553c2;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d53e247..dc1b072 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 _0x0349=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','query','keys','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','fields','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x4c9f76,_0x5e0403){var _0x551afe=function(_0x1a3d2a){while(--_0x1a3d2a){_0x4c9f76['push'](_0x4c9f76['shift']());}};_0x551afe(++_0x5e0403);}(_0x0349,0x11f));var _0x9034=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x0349[_0x5c78d9];return _0x69ae1f;};'use strict';var emlformat=require(_0x9034('0x0'));var rimraf=require(_0x9034('0x1'));var zipdir=require(_0x9034('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9034('0x3'));var moment=require(_0x9034('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9034('0x5'));var path=require(_0x9034('0x6'));var sox=require(_0x9034('0x7'));var csv=require(_0x9034('0x8'));var ejs=require(_0x9034('0x9'));var fs=require('fs');var fs_extra=require(_0x9034('0xa'));var _=require('lodash');var squel=require(_0x9034('0xb'));var crypto=require(_0x9034('0xc'));var jsforce=require(_0x9034('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9034('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9034('0xe'));var authService=require(_0x9034('0xf'));var qs=require(_0x9034('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9034('0x11'));var logger=require(_0x9034('0x12'))('api');var utils=require(_0x9034('0x13'));var config=require(_0x9034('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9034('0x15'))['db'];function respondWithStatusCode(_0x42737c,_0x592cce){_0x592cce=_0x592cce||0xcc;return function(_0x50556a){if(_0x50556a){return _0x42737c[_0x9034('0x16')](_0x592cce);}return _0x42737c[_0x9034('0x17')](_0x592cce)[_0x9034('0x18')]();};}function respondWithResult(_0x1c98f1,_0x25763b){_0x25763b=_0x25763b||0xc8;return function(_0x2e4e02){if(_0x2e4e02){return _0x1c98f1[_0x9034('0x17')](_0x25763b)[_0x9034('0x19')](_0x2e4e02);}};}function respondWithFilteredResult(_0x46cc55,_0x58e522){return function(_0x21a98e){if(_0x21a98e){var _0x51b3ea=typeof _0x58e522[_0x9034('0x1a')]===_0x9034('0x1b')&&typeof _0x58e522[_0x9034('0x1c')]==='undefined';var _0x37c3be=_0x21a98e[_0x9034('0x1d')];var _0x2710da=_0x51b3ea?0x0:_0x58e522[_0x9034('0x1a')];var _0xda2f61=_0x51b3ea?_0x21a98e[_0x9034('0x1d')]:_0x58e522[_0x9034('0x1a')]+_0x58e522[_0x9034('0x1c')];var _0x3760b9;if(_0xda2f61>=_0x37c3be){_0xda2f61=_0x37c3be;_0x3760b9=0xc8;}else{_0x3760b9=0xce;}_0x46cc55[_0x9034('0x17')](_0x3760b9);return _0x46cc55[_0x9034('0x1e')]('Content-Range',_0x2710da+'-'+_0xda2f61+'/'+_0x37c3be)['json'](_0x21a98e);}return null;};}function patchUpdates(_0x422a7b){return function(_0x4c5141){try{jsonpatch[_0x9034('0x1f')](_0x4c5141,_0x422a7b,!![]);}catch(_0x4cd302){return BPromise[_0x9034('0x20')](_0x4cd302);}return _0x4c5141['save']();};}function saveUpdates(_0x51436d,_0x12d2f7){return function(_0x79f61a){if(_0x79f61a){return _0x79f61a['update'](_0x51436d)[_0x9034('0x21')](function(_0xa4a87e){return _0xa4a87e;});}return null;};}function removeEntity(_0x44a8a1,_0x3a3d52){return function(_0x2f915a){if(_0x2f915a){return _0x2f915a[_0x9034('0x22')]()[_0x9034('0x21')](function(){_0x44a8a1[_0x9034('0x17')](0xcc)[_0x9034('0x18')]();});}};}function handleEntityNotFound(_0x47a14f,_0x5f14c8){return function(_0x110a8a){if(!_0x110a8a){_0x47a14f[_0x9034('0x16')](0x194);}return _0x110a8a;};}function handleError(_0x4e9ca4,_0x5a6155){_0x5a6155=_0x5a6155||0x1f4;return function(_0x1273a0){logger[_0x9034('0x23')](_0x1273a0[_0x9034('0x24')]);if(_0x1273a0[_0x9034('0x25')]){delete _0x1273a0[_0x9034('0x25')];}_0x4e9ca4[_0x9034('0x17')](_0x5a6155)['send'](_0x1273a0);};}exports[_0x9034('0x26')]=function(_0x3cb4fb,_0x292813){var _0x2b7b21={},_0x8a5b32={},_0x1242e2={'count':0x0,'rows':[]};var _0x4656c5=_[_0x9034('0x27')](db[_0x9034('0x28')][_0x9034('0x29')],function(_0xad70a1){return{'name':_0xad70a1[_0x9034('0x2a')],'type':_0xad70a1[_0x9034('0x2b')]['key']};});_0x8a5b32['model']=_[_0x9034('0x27')](_0x4656c5,'name');_0x8a5b32[_0x9034('0x2c')]=_[_0x9034('0x2d')](_0x3cb4fb[_0x9034('0x2c')]);_0x8a5b32['filters']=_['intersection'](_0x8a5b32[_0x9034('0x2e')],_0x8a5b32[_0x9034('0x2c')]);_0x2b7b21['attributes']=_[_0x9034('0x2f')](_0x8a5b32[_0x9034('0x2e')],qs['fields'](_0x3cb4fb[_0x9034('0x2c')]['fields']));_0x2b7b21[_0x9034('0x30')]=_0x2b7b21[_0x9034('0x30')][_0x9034('0x31')]?_0x2b7b21[_0x9034('0x30')]:_0x8a5b32['model'];if(!_0x3cb4fb[_0x9034('0x2c')][_0x9034('0x32')](_0x9034('0x33'))){_0x2b7b21[_0x9034('0x1c')]=qs[_0x9034('0x1c')](_0x3cb4fb[_0x9034('0x2c')]['limit']);_0x2b7b21[_0x9034('0x1a')]=qs['offset'](_0x3cb4fb[_0x9034('0x2c')][_0x9034('0x1a')]);}_0x2b7b21[_0x9034('0x34')]=qs['sort'](_0x3cb4fb[_0x9034('0x2c')][_0x9034('0x35')]);_0x2b7b21[_0x9034('0x36')]=qs[_0x9034('0x37')](_[_0x9034('0x38')](_0x3cb4fb[_0x9034('0x2c')],_0x8a5b32['filters']),_0x4656c5);if(_0x3cb4fb[_0x9034('0x2c')]['filter']){_0x2b7b21['where']=_[_0x9034('0x39')](_0x2b7b21[_0x9034('0x36')],{'$or':_[_0x9034('0x27')](_0x4656c5,function(_0x10d200){if(_0x10d200['type']!==_0x9034('0x3a')){var _0x344cba={};_0x344cba[_0x10d200[_0x9034('0x25')]]={'$like':'%'+_0x3cb4fb[_0x9034('0x2c')][_0x9034('0x3b')]+'%'};return _0x344cba;}})});}_0x2b7b21=_['merge']({},_0x2b7b21,_0x3cb4fb['options']);var _0x5cfa3c={'where':_0x2b7b21['where']};return db[_0x9034('0x28')]['count'](_0x5cfa3c)[_0x9034('0x21')](function(_0x57bba){_0x1242e2[_0x9034('0x1d')]=_0x57bba;if(_0x3cb4fb[_0x9034('0x2c')][_0x9034('0x3c')]){_0x2b7b21[_0x9034('0x3d')]=[{'all':!![]}];}return db[_0x9034('0x28')][_0x9034('0x3e')](_0x2b7b21);})[_0x9034('0x21')](function(_0xb45051){_0x1242e2[_0x9034('0x3f')]=_0xb45051;return _0x1242e2;})[_0x9034('0x21')](respondWithFilteredResult(_0x292813,_0x2b7b21))[_0x9034('0x40')](handleError(_0x292813,null));};exports[_0x9034('0x41')]=function(_0x296a32,_0x38cc61){var _0x179d64={'raw':!![],'where':{'id':_0x296a32[_0x9034('0x42')]['id']}},_0x108025={};_0x108025[_0x9034('0x2e')]=_[_0x9034('0x2d')](db[_0x9034('0x28')][_0x9034('0x29')]);_0x108025['query']=_[_0x9034('0x2d')](_0x296a32[_0x9034('0x2c')]);_0x108025['filters']=_['intersection'](_0x108025[_0x9034('0x2e')],_0x108025[_0x9034('0x2c')]);_0x179d64[_0x9034('0x30')]=_['intersection'](_0x108025['model'],qs[_0x9034('0x43')](_0x296a32['query'][_0x9034('0x43')]));_0x179d64[_0x9034('0x30')]=_0x179d64[_0x9034('0x30')][_0x9034('0x31')]?_0x179d64[_0x9034('0x30')]:_0x108025[_0x9034('0x2e')];if(_0x296a32['query'][_0x9034('0x3c')]){_0x179d64[_0x9034('0x3d')]=[{'all':!![]}];}_0x179d64=_[_0x9034('0x39')]({},_0x179d64,_0x296a32['options']);return db['MailTransferReport'][_0x9034('0x44')](_0x179d64)['then'](handleEntityNotFound(_0x38cc61,null))[_0x9034('0x21')](respondWithResult(_0x38cc61,null))[_0x9034('0x40')](handleError(_0x38cc61,null));};exports['create']=function(_0x19852c,_0x46b86f){return db[_0x9034('0x28')][_0x9034('0x45')](_0x19852c['body'],{})['then'](respondWithResult(_0x46b86f,0xc9))[_0x9034('0x40')](handleError(_0x46b86f,null));};exports[_0x9034('0x46')]=function(_0x478471,_0x4c22ba){if(_0x478471[_0x9034('0x47')]['id']){delete _0x478471[_0x9034('0x47')]['id'];}return db[_0x9034('0x28')][_0x9034('0x44')]({'where':{'id':_0x478471['params']['id']}})[_0x9034('0x21')](handleEntityNotFound(_0x4c22ba,null))[_0x9034('0x21')](saveUpdates(_0x478471[_0x9034('0x47')],null))['then'](respondWithResult(_0x4c22ba,null))[_0x9034('0x40')](handleError(_0x4c22ba,null));};exports[_0x9034('0x22')]=function(_0x5bab52,_0x5617e2){return db[_0x9034('0x28')]['find']({'where':{'id':_0x5bab52['params']['id']}})[_0x9034('0x21')](handleEntityNotFound(_0x5617e2,null))[_0x9034('0x21')](removeEntity(_0x5617e2,null))[_0x9034('0x40')](handleError(_0x5617e2,null));};exports[_0x9034('0x48')]=function(_0x35bd88,_0x398c68){return db[_0x9034('0x28')]['describe']()['then'](respondWithResult(_0x398c68,null))[_0x9034('0x40')](handleError(_0x398c68,null));}; \ No newline at end of file +var _0x4de4=['json','apply','reject','save','update','then','destroy','error','name','send','map','MailTransferReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range'];(function(_0x331204,_0x1128f2){var _0x578012=function(_0x19e0ed){while(--_0x19e0ed){_0x331204['push'](_0x331204['shift']());}};_0x578012(++_0x1128f2);}(_0x4de4,0xbd));var _0x44de=function(_0x5960b9,_0x26f02c){_0x5960b9=_0x5960b9-0x0;var _0x4999d5=_0x4de4[_0x5960b9];return _0x4999d5;};'use strict';var emlformat=require(_0x44de('0x0'));var rimraf=require(_0x44de('0x1'));var zipdir=require(_0x44de('0x2'));var jsonpatch=require(_0x44de('0x3'));var rp=require(_0x44de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x44de('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x44de('0x6'));var ejs=require(_0x44de('0x7'));var fs=require('fs');var fs_extra=require(_0x44de('0x8'));var _=require('lodash');var squel=require(_0x44de('0x9'));var crypto=require(_0x44de('0xa'));var jsforce=require(_0x44de('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44de('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x44de('0xd'));var qs=require(_0x44de('0xe'));var as=require(_0x44de('0xf'));var hardwareService=require(_0x44de('0x10'));var logger=require(_0x44de('0x11'))(_0x44de('0x12'));var utils=require('../../config/utils');var config=require(_0x44de('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x44de('0x14'))['db'];function respondWithStatusCode(_0x65032b,_0x1f7109){_0x1f7109=_0x1f7109||0xcc;return function(_0x23c291){if(_0x23c291){return _0x65032b[_0x44de('0x15')](_0x1f7109);}return _0x65032b[_0x44de('0x16')](_0x1f7109)[_0x44de('0x17')]();};}function respondWithResult(_0x317d0c,_0x4b196c){_0x4b196c=_0x4b196c||0xc8;return function(_0xc0c165){if(_0xc0c165){return _0x317d0c['status'](_0x4b196c)['json'](_0xc0c165);}};}function respondWithFilteredResult(_0x3d70f2,_0x366e3e){return function(_0x4aefbd){if(_0x4aefbd){var _0x524110=typeof _0x366e3e['offset']===_0x44de('0x18')&&typeof _0x366e3e[_0x44de('0x19')]===_0x44de('0x18');var _0x59f624=_0x4aefbd[_0x44de('0x1a')];var _0x36566e=_0x524110?0x0:_0x366e3e[_0x44de('0x1b')];var _0x4445af=_0x524110?_0x4aefbd['count']:_0x366e3e[_0x44de('0x1b')]+_0x366e3e[_0x44de('0x19')];var _0x23e8ad;if(_0x4445af>=_0x59f624){_0x4445af=_0x59f624;_0x23e8ad=0xc8;}else{_0x23e8ad=0xce;}_0x3d70f2['status'](_0x23e8ad);return _0x3d70f2[_0x44de('0x1c')](_0x44de('0x1d'),_0x36566e+'-'+_0x4445af+'/'+_0x59f624)[_0x44de('0x1e')](_0x4aefbd);}return null;};}function patchUpdates(_0x4e7287){return function(_0x32384f){try{jsonpatch[_0x44de('0x1f')](_0x32384f,_0x4e7287,!![]);}catch(_0x317985){return BPromise[_0x44de('0x20')](_0x317985);}return _0x32384f[_0x44de('0x21')]();};}function saveUpdates(_0x1ae3fb,_0x20847f){return function(_0x2574e9){if(_0x2574e9){return _0x2574e9[_0x44de('0x22')](_0x1ae3fb)[_0x44de('0x23')](function(_0x53ac2a){return _0x53ac2a;});}return null;};}function removeEntity(_0x54ac27,_0x4e0660){return function(_0x10ef4f){if(_0x10ef4f){return _0x10ef4f[_0x44de('0x24')]()['then'](function(){_0x54ac27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a872,_0x19b872){return function(_0x117db5){if(!_0x117db5){_0x43a872[_0x44de('0x15')](0x194);}return _0x117db5;};}function handleError(_0xcea04d,_0x4fa9f4){_0x4fa9f4=_0x4fa9f4||0x1f4;return function(_0x2fc6bb){logger[_0x44de('0x25')](_0x2fc6bb['stack']);if(_0x2fc6bb[_0x44de('0x26')]){delete _0x2fc6bb['name'];}_0xcea04d[_0x44de('0x16')](_0x4fa9f4)[_0x44de('0x27')](_0x2fc6bb);};}exports['index']=function(_0x977b98,_0x264974){var _0x566498={},_0x3e839e={},_0x591b0e={'count':0x0,'rows':[]};var _0x48892f=_[_0x44de('0x28')](db[_0x44de('0x29')]['rawAttributes'],function(_0x4ef107){return{'name':_0x4ef107[_0x44de('0x2a')],'type':_0x4ef107[_0x44de('0x2b')][_0x44de('0x2c')]};});_0x3e839e['model']=_[_0x44de('0x28')](_0x48892f,_0x44de('0x26'));_0x3e839e[_0x44de('0x2d')]=_[_0x44de('0x2e')](_0x977b98[_0x44de('0x2d')]);_0x3e839e['filters']=_[_0x44de('0x2f')](_0x3e839e[_0x44de('0x30')],_0x3e839e['query']);_0x566498[_0x44de('0x31')]=_[_0x44de('0x2f')](_0x3e839e[_0x44de('0x30')],qs[_0x44de('0x32')](_0x977b98[_0x44de('0x2d')][_0x44de('0x32')]));_0x566498[_0x44de('0x31')]=_0x566498[_0x44de('0x31')]['length']?_0x566498[_0x44de('0x31')]:_0x3e839e['model'];if(!_0x977b98['query'][_0x44de('0x33')](_0x44de('0x34'))){_0x566498[_0x44de('0x19')]=qs[_0x44de('0x19')](_0x977b98[_0x44de('0x2d')][_0x44de('0x19')]);_0x566498['offset']=qs[_0x44de('0x1b')](_0x977b98['query'][_0x44de('0x1b')]);}_0x566498[_0x44de('0x35')]=qs[_0x44de('0x36')](_0x977b98[_0x44de('0x2d')][_0x44de('0x36')]);_0x566498[_0x44de('0x37')]=qs[_0x44de('0x38')](_[_0x44de('0x39')](_0x977b98[_0x44de('0x2d')],_0x3e839e[_0x44de('0x38')]),_0x48892f);if(_0x977b98[_0x44de('0x2d')]['filter']){_0x566498[_0x44de('0x37')]=_[_0x44de('0x3a')](_0x566498[_0x44de('0x37')],{'$or':_[_0x44de('0x28')](_0x48892f,function(_0xfac831){if(_0xfac831[_0x44de('0x2b')]!=='VIRTUAL'){var _0x520a4f={};_0x520a4f[_0xfac831['name']]={'$like':'%'+_0x977b98[_0x44de('0x2d')][_0x44de('0x3b')]+'%'};return _0x520a4f;}})});}_0x566498=_['merge']({},_0x566498,_0x977b98[_0x44de('0x3c')]);var _0x2ecad8={'where':_0x566498[_0x44de('0x37')]};return db['MailTransferReport'][_0x44de('0x1a')](_0x2ecad8)[_0x44de('0x23')](function(_0x29484e){_0x591b0e['count']=_0x29484e;if(_0x977b98[_0x44de('0x2d')][_0x44de('0x3d')]){_0x566498[_0x44de('0x3e')]=[{'all':!![]}];}return db[_0x44de('0x29')][_0x44de('0x3f')](_0x566498);})[_0x44de('0x23')](function(_0x4e2e33){_0x591b0e[_0x44de('0x40')]=_0x4e2e33;return _0x591b0e;})[_0x44de('0x23')](respondWithFilteredResult(_0x264974,_0x566498))[_0x44de('0x41')](handleError(_0x264974,null));};exports[_0x44de('0x42')]=function(_0x404055,_0x333d51){var _0x439a27={'raw':!![],'where':{'id':_0x404055[_0x44de('0x43')]['id']}},_0x1d259b={};_0x1d259b[_0x44de('0x30')]=_[_0x44de('0x2e')](db['MailTransferReport']['rawAttributes']);_0x1d259b[_0x44de('0x2d')]=_[_0x44de('0x2e')](_0x404055[_0x44de('0x2d')]);_0x1d259b[_0x44de('0x38')]=_[_0x44de('0x2f')](_0x1d259b[_0x44de('0x30')],_0x1d259b['query']);_0x439a27[_0x44de('0x31')]=_[_0x44de('0x2f')](_0x1d259b[_0x44de('0x30')],qs[_0x44de('0x32')](_0x404055[_0x44de('0x2d')][_0x44de('0x32')]));_0x439a27[_0x44de('0x31')]=_0x439a27[_0x44de('0x31')][_0x44de('0x44')]?_0x439a27['attributes']:_0x1d259b[_0x44de('0x30')];if(_0x404055[_0x44de('0x2d')]['includeAll']){_0x439a27['include']=[{'all':!![]}];}_0x439a27=_['merge']({},_0x439a27,_0x404055['options']);return db[_0x44de('0x29')]['find'](_0x439a27)['then'](handleEntityNotFound(_0x333d51,null))[_0x44de('0x23')](respondWithResult(_0x333d51,null))['catch'](handleError(_0x333d51,null));};exports[_0x44de('0x45')]=function(_0x196abc,_0x279c63){return db['MailTransferReport'][_0x44de('0x45')](_0x196abc['body'],{})[_0x44de('0x23')](respondWithResult(_0x279c63,0xc9))['catch'](handleError(_0x279c63,null));};exports[_0x44de('0x22')]=function(_0xf85961,_0x28a8d5){if(_0xf85961['body']['id']){delete _0xf85961[_0x44de('0x46')]['id'];}return db['MailTransferReport'][_0x44de('0x47')]({'where':{'id':_0xf85961[_0x44de('0x43')]['id']}})['then'](handleEntityNotFound(_0x28a8d5,null))[_0x44de('0x23')](saveUpdates(_0xf85961[_0x44de('0x46')],null))[_0x44de('0x23')](respondWithResult(_0x28a8d5,null))[_0x44de('0x41')](handleError(_0x28a8d5,null));};exports[_0x44de('0x24')]=function(_0x1c390c,_0x19e24f){return db[_0x44de('0x29')][_0x44de('0x47')]({'where':{'id':_0x1c390c[_0x44de('0x43')]['id']}})['then'](handleEntityNotFound(_0x19e24f,null))['then'](removeEntity(_0x19e24f,null))[_0x44de('0x41')](handleError(_0x19e24f,null));};exports['describe']=function(_0x44ff1e,_0x38f512){return db[_0x44de('0x29')][_0x44de('0x48')]()[_0x44de('0x23')](respondWithResult(_0x38f512,null))['catch'](handleError(_0x38f512,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a53c7fe..01a20df 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 _0xba92=['path','../../config/environment','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22a7a3,_0x36b654){var _0x52bce4=function(_0x15131c){while(--_0x15131c){_0x22a7a3['push'](_0x22a7a3['shift']());}};_0x52bce4(++_0x36b654);}(_0xba92,0xe9));var _0x2ba9=function(_0x1deb13,_0x5166ea){_0x1deb13=_0x1deb13-0x0;var _0x1c0af4=_0xba92[_0x1deb13];return _0x1c0af4;};'use strict';var _=require(_0x2ba9('0x0'));var util=require(_0x2ba9('0x1'));var logger=require(_0x2ba9('0x2'))(_0x2ba9('0x3'));var moment=require(_0x2ba9('0x4'));var BPromise=require(_0x2ba9('0x5'));var rp=require(_0x2ba9('0x6'));var fs=require('fs');var path=require(_0x2ba9('0x7'));var rimraf=require('rimraf');var config=require(_0x2ba9('0x8'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x5bc34,_0xd24a0b){return _0x5bc34[_0x2ba9('0x9')](_0x2ba9('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x2ba9('0xb'),'fields':[_0x2ba9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02b1=['request-promise','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x55bbd8,_0x2aafd5){var _0x223233=function(_0x132823){while(--_0x132823){_0x55bbd8['push'](_0x55bbd8['shift']());}};_0x223233(++_0x2aafd5);}(_0x02b1,0x7f));var _0x102b=function(_0x43b5aa,_0x1707c4){_0x43b5aa=_0x43b5aa-0x0;var _0x3ebf35=_0x02b1[_0x43b5aa];return _0x3ebf35;};'use strict';var _=require(_0x102b('0x0'));var util=require(_0x102b('0x1'));var logger=require(_0x102b('0x2'))(_0x102b('0x3'));var moment=require(_0x102b('0x4'));var BPromise=require('bluebird');var rp=require(_0x102b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x102b('0x6'));var attributes=require(_0x102b('0x7'));module[_0x102b('0x8')]=function(_0x779f1f,_0x2cf25c){return _0x779f1f['define'](_0x102b('0x9'),attributes,{'tableName':_0x102b('0xa'),'paranoid':![],'indexes':[{'name':_0x102b('0xb'),'fields':[_0x102b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8f212f0..5eebf1d 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 _0xf3b6=['../../config/environment','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xf3b6,0xf0));var _0x6f3b=function(_0x411b33,_0x4296b2){_0x411b33=_0x411b33-0x0;var _0x51a5d9=_0xf3b6[_0x411b33];return _0x51a5d9;};'use strict';var _=require(_0x6f3b('0x0'));var util=require(_0x6f3b('0x1'));var moment=require(_0x6f3b('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f3b('0x3'));var fs=require('fs');var Redis=require(_0x6f3b('0x4'));var db=require(_0x6f3b('0x5'))['db'];var utils=require(_0x6f3b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f3b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f3b('0x8')][_0x6f3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbb9522,_0x3c9dfa,_0x511f0c){return new BPromise(function(_0xcf8e5c,_0x19e54a){return client[_0x6f3b('0xa')](_0xbb9522,_0x511f0c)['then'](function(_0x54eae6){logger[_0x6f3b('0xb')](_0x6f3b('0xc'),_0x3c9dfa,_0x6f3b('0xd'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3c9dfa,_0x6f3b('0xd'),JSON[_0x6f3b('0xe')](_0x54eae6));if(_0x54eae6[_0x6f3b('0xf')]){if(_0x54eae6['error'][_0x6f3b('0x10')]===0x1f4){logger['error'](_0x6f3b('0xc'),_0x3c9dfa,_0x54eae6[_0x6f3b('0xf')][_0x6f3b('0x11')]);return _0x19e54a(_0x54eae6[_0x6f3b('0xf')][_0x6f3b('0x11')]);}logger[_0x6f3b('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3c9dfa,_0x54eae6[_0x6f3b('0xf')]['message']);return _0xcf8e5c(_0x54eae6[_0x6f3b('0xf')][_0x6f3b('0x11')]);}else{logger[_0x6f3b('0xb')](_0x6f3b('0xc'),_0x3c9dfa,'request\x20sent');_0xcf8e5c(_0x54eae6['result']['message']);}})[_0x6f3b('0x12')](function(_0x4e61d3){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x3c9dfa,_0x4e61d3);_0x19e54a(_0x4e61d3);});});} \ No newline at end of file +var _0x1442=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1442,0x94));var _0x2144=function(_0x4e32ae,_0x5a88d3){_0x4e32ae=_0x4e32ae-0x0;var _0x492ff6=_0x1442[_0x4e32ae];return _0x492ff6;};'use strict';var _=require(_0x2144('0x0'));var util=require(_0x2144('0x1'));var moment=require(_0x2144('0x2'));var BPromise=require(_0x2144('0x3'));var rs=require(_0x2144('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2144('0x5'))['db'];var utils=require(_0x2144('0x6'));var logger=require('../../config/logger')(_0x2144('0x7'));var config=require(_0x2144('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2144('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57bd94,_0x314005,_0xd6ec35){return new BPromise(function(_0xce93d7,_0x4a5647){return client['request'](_0x57bd94,_0xd6ec35)[_0x2144('0xa')](function(_0x4c543a){logger[_0x2144('0xb')](_0x2144('0xc'),_0x314005,_0x2144('0xd'));logger[_0x2144('0xe')](_0x2144('0xf'),_0x314005,_0x2144('0xd'),JSON[_0x2144('0x10')](_0x4c543a));if(_0x4c543a['error']){if(_0x4c543a['error'][_0x2144('0x11')]===0x1f4){logger['error'](_0x2144('0xc'),_0x314005,_0x4c543a[_0x2144('0x12')][_0x2144('0x13')]);return _0x4a5647(_0x4c543a[_0x2144('0x12')][_0x2144('0x13')]);}logger[_0x2144('0x12')](_0x2144('0xc'),_0x314005,_0x4c543a[_0x2144('0x12')][_0x2144('0x13')]);return _0xce93d7(_0x4c543a[_0x2144('0x12')][_0x2144('0x13')]);}else{logger[_0x2144('0xb')](_0x2144('0xc'),_0x314005,_0x2144('0xd'));_0xce93d7(_0x4c543a[_0x2144('0x14')][_0x2144('0x13')]);}})['catch'](function(_0x102e64){logger['error'](_0x2144('0xc'),_0x314005,_0x102e64);_0x4a5647(_0x102e64);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 08cfb1b..9e2f334 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 _0x712e=['put','/:id','update','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','show','create'];(function(_0x10b10c,_0xb8576){var _0x15ca63=function(_0x2fa2ab){while(--_0x2fa2ab){_0x10b10c['push'](_0x10b10c['shift']());}};_0x15ca63(++_0xb8576);}(_0x712e,0x1c6));var _0xe712=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x712e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe712('0x0'));var util=require('util');var path=require(_0xe712('0x1'));var timeout=require(_0xe712('0x2'));var express=require('express');var router=express[_0xe712('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe712('0x4'));var interaction=require(_0xe712('0x5'));var config=require(_0xe712('0x6'));var controller=require(_0xe712('0x7'));router[_0xe712('0x8')]('/',auth[_0xe712('0x9')](),controller['index']);router['get'](_0xe712('0xa'),auth[_0xe712('0x9')](),controller[_0xe712('0xb')]);router[_0xe712('0x8')]('/:id',auth[_0xe712('0x9')](),controller[_0xe712('0xc')]);router['post']('/',auth[_0xe712('0x9')](),controller[_0xe712('0xd')]);router[_0xe712('0xe')](_0xe712('0xf'),auth['isAuthenticated'](),controller[_0xe712('0x10')]);router['delete'](_0xe712('0xf'),auth[_0xe712('0x9')](),controller[_0xe712('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf0fb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports','path'];(function(_0x478087,_0x109fb2){var _0x54bff1=function(_0x4589b3){while(--_0x4589b3){_0x478087['push'](_0x478087['shift']());}};_0x54bff1(++_0x109fb2);}(_0xf0fb,0x131));var _0xbf0f=function(_0x41284e,_0x580b34){_0x41284e=_0x41284e-0x0;var _0x403f86=_0xf0fb[_0x41284e];return _0x403f86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf0f('0x0'));var timeout=require(_0xbf0f('0x1'));var express=require('express');var router=express[_0xbf0f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbf0f('0x3'));var interaction=require(_0xbf0f('0x4'));var config=require(_0xbf0f('0x5'));var controller=require(_0xbf0f('0x6'));router[_0xbf0f('0x7')]('/',auth[_0xbf0f('0x8')](),controller[_0xbf0f('0x9')]);router[_0xbf0f('0x7')](_0xbf0f('0xa'),auth[_0xbf0f('0x8')](),controller[_0xbf0f('0xb')]);router[_0xbf0f('0x7')](_0xbf0f('0xc'),auth[_0xbf0f('0x8')](),controller['show']);router['post']('/',auth[_0xbf0f('0x8')](),controller['create']);router[_0xbf0f('0xd')](_0xbf0f('0xc'),auth[_0xbf0f('0x8')](),controller[_0xbf0f('0xe')]);router[_0xbf0f('0xf')](_0xbf0f('0xc'),auth['isAuthenticated'](),controller[_0xbf0f('0x10')]);module[_0xbf0f('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5ecb67e..59df199 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 _0xe5db=['seconds','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x2dbb6c,_0x121efa){var _0x13c177=function(_0x4415ad){while(--_0x4415ad){_0x2dbb6c['push'](_0x2dbb6c['shift']());}};_0x13c177(++_0x121efa);}(_0xe5db,0x113));var _0xbe5d=function(_0x201bab,_0x4364bd){_0x201bab=_0x201bab-0x0;var _0x3bd407=_0xe5db[_0x201bab];return _0x3bd407;};'use strict';var Sequelize=require(_0xbe5d('0x0'));var moment=require('moment');module[_0xbe5d('0x1')]={'channel':{'type':Sequelize[_0xbe5d('0x2')]},'membername':{'type':Sequelize[_0xbe5d('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbe5d('0x2')],'defaultValue':_0xbe5d('0x3'),'comment':_0xbe5d('0x4')},'duration':{'type':Sequelize[_0xbe5d('0x5')]},'enterAt':{'type':Sequelize[_0xbe5d('0x6')]},'exitAt':{'type':Sequelize[_0xbe5d('0x6')],'set':function(_0x3d7d8e){var _0x3952e7=moment(_0x3d7d8e);var _0x596f64=moment(this[_0xbe5d('0x7')](_0xbe5d('0x8')));var _0x23abc3=_0x3952e7[_0xbe5d('0x9')](_0x596f64,_0xbe5d('0xa'));this['setDataValue']('exitAt',_0x3d7d8e);this['setDataValue']('duration',_0x23abc3>=0x0?_0x23abc3:null);}},'data1':{'type':Sequelize[_0xbe5d('0x2')],'comment':_0xbe5d('0xb')},'data2':{'type':Sequelize[_0xbe5d('0x2')],'comment':_0xbe5d('0xc')},'data3':{'type':Sequelize[_0xbe5d('0x2')],'comment':_0xbe5d('0xd')},'data4':{'type':Sequelize[_0xbe5d('0x2')],'comment':_0xbe5d('0xe')},'data5':{'type':Sequelize[_0xbe5d('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e7b=['talk:[queue]','INTEGER','sequelize','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','diff','seconds','setDataValue','exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x15fb71,_0x8037fd){var _0x1e6c19=function(_0x1d53ac){while(--_0x1d53ac){_0x15fb71['push'](_0x15fb71['shift']());}};_0x1e6c19(++_0x8037fd);}(_0x3e7b,0x77));var _0xb3e7=function(_0x221e88,_0x5552f3){_0x221e88=_0x221e88-0x0;var _0x1f5233=_0x3e7b[_0x221e88];return _0x1f5233;};'use strict';var Sequelize=require(_0xb3e7('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xb3e7('0x1')]},'membername':{'type':Sequelize[_0xb3e7('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xb3e7('0x2')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xb3e7('0x3')]},'exitAt':{'type':Sequelize[_0xb3e7('0x3')],'set':function(_0x54f92f){var _0x4df2bb=moment(_0x54f92f);var _0x4d2304=moment(this['getDataValue']('enterAt'));var _0xad56ca=_0x4df2bb[_0xb3e7('0x4')](_0x4d2304,_0xb3e7('0x5'));this[_0xb3e7('0x6')](_0xb3e7('0x7'),_0x54f92f);this[_0xb3e7('0x6')]('duration',_0xad56ca>=0x0?_0xad56ca:null);}},'data1':{'type':Sequelize[_0xb3e7('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb3e7('0x1')],'comment':_0xb3e7('0x8')},'data3':{'type':Sequelize[_0xb3e7('0x1')],'comment':_0xb3e7('0x9')},'data4':{'type':Sequelize[_0xb3e7('0x1')],'comment':_0xb3e7('0xa')},'data5':{'type':Sequelize[_0xb3e7('0x1')],'comment':_0xb3e7('0xb')},'role':{'type':Sequelize[_0xb3e7('0x1')]},'internal':{'type':Sequelize[_0xb3e7('0xc')]},'uniqueid':{'type':Sequelize[_0xb3e7('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 60ac865..54a8416 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 _0x34e8=['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','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x34e8,0x12c));var _0x834e=function(_0x8be3f0,_0x1b7c4f){_0x8be3f0=_0x8be3f0-0x0;var _0xb3e22=_0x34e8[_0x8be3f0];return _0xb3e22;};'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'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55ca,0x126));var _0xa55c=function(_0x397843,_0xa7173e){_0x397843=_0x397843-0x0;var _0x2ba028=_0x55ca[_0x397843];return _0x2ba028;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 660a1eb..7cbc829 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 _0x8b53=['exports','define','report_member','membername_interface','membername','interface','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8b53,0x88));var _0x38b5=function(_0x27a12b,_0x2ef91b){_0x27a12b=_0x27a12b-0x0;var _0xa7aa84=_0x8b53[_0x27a12b];return _0xa7aa84;};'use strict';var _=require(_0x38b5('0x0'));var util=require('util');var logger=require(_0x38b5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x38b5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38b5('0x3'));var rimraf=require(_0x38b5('0x4'));var config=require(_0x38b5('0x5'));var attributes=require(_0x38b5('0x6'));module[_0x38b5('0x7')]=function(_0x354204,_0x3dae02){return _0x354204[_0x38b5('0x8')]('MemberReport',attributes,{'tableName':_0x38b5('0x9'),'paranoid':![],'indexes':[{'name':_0x38b5('0xa'),'fields':[_0x38b5('0xb'),_0x38b5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01ad=['./memberReport.attributes','exports','define','MemberReport','membername_interface','interface','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x01ad,0xd2));var _0xd01a=function(_0x2efa92,_0x2557f6){_0x2efa92=_0x2efa92-0x0;var _0x32704b=_0x01ad[_0x2efa92];return _0x32704b;};'use strict';var _=require(_0xd01a('0x0'));var util=require('util');var logger=require(_0xd01a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd01a('0x2'));var rp=require(_0xd01a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd01a('0x4'));var config=require(_0xd01a('0x5'));var attributes=require(_0xd01a('0x6'));module[_0xd01a('0x7')]=function(_0x5d2bce,_0x475011){return _0x5d2bce[_0xd01a('0x8')](_0xd01a('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd01a('0xa'),'fields':['membername',_0xd01a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b82ffef..31bc7ef 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 _0xe928=['raw','attributes','limit','model','include','map','CreateMemberReport','create','update','UpdateMemberReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options'];(function(_0x3671d1,_0x54f765){var _0x4149ef=function(_0x33d111){while(--_0x33d111){_0x3671d1['push'](_0x3671d1['shift']());}};_0x4149ef(++_0x54f765);}(_0xe928,0x145));var _0x8e92=function(_0xb96f8b,_0x4b0abe){_0xb96f8b=_0xb96f8b-0x0;var _0x43a994=_0xe928[_0xb96f8b];return _0x43a994;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var moment=require(_0x8e92('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e92('0x4'))['db'];var utils=require(_0x8e92('0x5'));var logger=require(_0x8e92('0x6'))(_0x8e92('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e92('0x8'));var client=jayson['client'][_0x8e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe4eff3,_0x14811b,_0x76e11){return new BPromise(function(_0x59e109,_0x361fd2){return client['request'](_0xe4eff3,_0x76e11)[_0x8e92('0xa')](function(_0x8cc27a){logger[_0x8e92('0xb')](_0x8e92('0xc'),_0x14811b,_0x8e92('0xd'));logger[_0x8e92('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'),JSON[_0x8e92('0xf')](_0x8cc27a));if(_0x8cc27a[_0x8e92('0x10')]){if(_0x8cc27a['error'][_0x8e92('0x11')]===0x1f4){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);return _0x361fd2(_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);}logger['error'](_0x8e92('0xc'),_0x14811b,_0x8cc27a['error'][_0x8e92('0x12')]);return _0x59e109(_0x8cc27a[_0x8e92('0x10')]['message']);}else{logger[_0x8e92('0xb')]('MemberReport,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'));_0x59e109(_0x8cc27a[_0x8e92('0x13')][_0x8e92('0x12')]);}})[_0x8e92('0x14')](function(_0x1c4b12){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x1c4b12);_0x361fd2(_0x1c4b12);});});}exports[_0x8e92('0x15')]=function(_0x55f325){var _0x3dfb4c=this;return new Promise(function(_0x192b0b,_0x3a7417){return db[_0x8e92('0x16')][_0x8e92('0x17')]({'raw':_0x55f325['options']?_0x55f325[_0x8e92('0x18')][_0x8e92('0x19')]===undefined?!![]:![]:!![],'where':_0x55f325['options']?_0x55f325['options']['where']||null:null,'attributes':_0x55f325[_0x8e92('0x18')]?_0x55f325['options'][_0x8e92('0x1a')]||null:null,'limit':_0x55f325[_0x8e92('0x18')]?_0x55f325[_0x8e92('0x18')][_0x8e92('0x1b')]||null:null,'include':_0x55f325[_0x8e92('0x18')]?_0x55f325[_0x8e92('0x18')]['include']?_['map'](_0x55f325['options']['include'],function(_0x322765){return{'model':db[_0x322765[_0x8e92('0x1c')]],'as':_0x322765['as'],'attributes':_0x322765[_0x8e92('0x1a')],'include':_0x322765[_0x8e92('0x1d')]?_[_0x8e92('0x1e')](_0x322765[_0x8e92('0x1d')],function(_0x585adb){return{'model':db[_0x585adb[_0x8e92('0x1c')]],'as':_0x585adb['as'],'attributes':_0x585adb[_0x8e92('0x1a')],'include':_0x585adb[_0x8e92('0x1d')]?_[_0x8e92('0x1e')](_0x585adb[_0x8e92('0x1d')],function(_0x2aaf1d){return{'model':db[_0x2aaf1d['model']],'as':_0x2aaf1d['as'],'attributes':_0x2aaf1d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3df5){logger['info'](_0x8e92('0x15'),_0x55f325);logger['debug'](_0x8e92('0x15'),_0x55f325,JSON['stringify'](_0x1d3df5));_0x192b0b(_0x1d3df5);})[_0x8e92('0x14')](function(_0x57c4de){logger[_0x8e92('0x10')](_0x8e92('0x15'),_0x57c4de[_0x8e92('0x12')],_0x55f325);_0x3a7417(_0x3dfb4c[_0x8e92('0x10')](0x1f4,_0x57c4de['message']));});});};exports[_0x8e92('0x1f')]=function(_0x405df5){var _0x4c11ef=this;return new Promise(function(_0x2dbd8f,_0x4ddfea){return db[_0x8e92('0x16')][_0x8e92('0x20')](_0x405df5['body'],{'raw':_0x405df5[_0x8e92('0x18')]?_0x405df5[_0x8e92('0x18')][_0x8e92('0x19')]===undefined?!![]:![]:!![]})[_0x8e92('0xa')](function(_0x158fb2){logger[_0x8e92('0xb')](_0x8e92('0x1f'),_0x405df5);logger[_0x8e92('0xe')](_0x8e92('0x1f'),_0x405df5,JSON['stringify'](_0x158fb2));_0x2dbd8f(_0x158fb2);})['catch'](function(_0x456914){logger['error']('CreateMemberReport',_0x456914[_0x8e92('0x12')],_0x405df5);_0x4ddfea(_0x4c11ef[_0x8e92('0x10')](0x1f4,_0x456914[_0x8e92('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2fdbe5){var _0x316593=this;return new Promise(function(_0x300be0,_0x5c462b){return db['MemberReport'][_0x8e92('0x21')](_0x2fdbe5['body'],{'raw':_0x2fdbe5[_0x8e92('0x18')]?_0x2fdbe5[_0x8e92('0x18')][_0x8e92('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fdbe5[_0x8e92('0x18')]?_0x2fdbe5[_0x8e92('0x18')]['where']||null:null,'attributes':_0x2fdbe5[_0x8e92('0x18')]?_0x2fdbe5[_0x8e92('0x18')][_0x8e92('0x1a')]||null:null,'limit':_0x2fdbe5['options']?_0x2fdbe5['options'][_0x8e92('0x1b')]||null:null})['then'](function(_0x20777d){logger[_0x8e92('0xb')](_0x8e92('0x22'),_0x2fdbe5);logger[_0x8e92('0xe')]('UpdateMemberReport',_0x2fdbe5,JSON['stringify'](_0x20777d));_0x300be0(_0x20777d);})['catch'](function(_0x206534){logger['error'](_0x8e92('0x22'),_0x206534['message'],_0x2fdbe5);_0x5c462b(_0x316593['error'](0x1f4,_0x206534['message']));});});}; \ No newline at end of file +var _0x56da=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','GetMemberReport','stringify','CreateMemberReport','create','body','update','raw','UpdateMemberReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c4c72,_0x458c6a){var _0x52912f=function(_0x3eb08b){while(--_0x3eb08b){_0x2c4c72['push'](_0x2c4c72['shift']());}};_0x52912f(++_0x458c6a);}(_0x56da,0x119));var _0xa56d=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x56da[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0xa56d('0x0'));var util=require('util');var moment=require(_0xa56d('0x1'));var BPromise=require(_0xa56d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa56d('0x3'));var db=require(_0xa56d('0x4'))['db'];var utils=require(_0xa56d('0x5'));var logger=require(_0xa56d('0x6'))(_0xa56d('0x7'));var config=require(_0xa56d('0x8'));var jayson=require(_0xa56d('0x9'));var client=jayson[_0xa56d('0xa')][_0xa56d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x107e9b,_0xf696b6,_0x53f682){return new BPromise(function(_0x577926,_0xeeca5f){return client[_0xa56d('0xc')](_0x107e9b,_0x53f682)[_0xa56d('0xd')](function(_0x100015){logger[_0xa56d('0xe')]('MemberReport,\x20%s,\x20%s',_0xf696b6,'request\x20sent');logger[_0xa56d('0xf')](_0xa56d('0x10'),_0xf696b6,_0xa56d('0x11'),JSON['stringify'](_0x100015));if(_0x100015[_0xa56d('0x12')]){if(_0x100015[_0xa56d('0x12')][_0xa56d('0x13')]===0x1f4){logger['error'](_0xa56d('0x14'),_0xf696b6,_0x100015[_0xa56d('0x12')][_0xa56d('0x15')]);return _0xeeca5f(_0x100015[_0xa56d('0x12')][_0xa56d('0x15')]);}logger[_0xa56d('0x12')](_0xa56d('0x14'),_0xf696b6,_0x100015[_0xa56d('0x12')]['message']);return _0x577926(_0x100015[_0xa56d('0x12')][_0xa56d('0x15')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xf696b6,_0xa56d('0x11'));_0x577926(_0x100015[_0xa56d('0x16')][_0xa56d('0x15')]);}})[_0xa56d('0x17')](function(_0x23c01f){logger['error'](_0xa56d('0x14'),_0xf696b6,_0x23c01f);_0xeeca5f(_0x23c01f);});});}exports['GetMemberReport']=function(_0x30ba3f){var _0x228425=this;return new Promise(function(_0x2d7a1a,_0x46cab4){return db[_0xa56d('0x18')][_0xa56d('0x19')]({'raw':_0x30ba3f['options']?_0x30ba3f[_0xa56d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x30ba3f[_0xa56d('0x1a')]?_0x30ba3f[_0xa56d('0x1a')][_0xa56d('0x1b')]||null:null,'attributes':_0x30ba3f[_0xa56d('0x1a')]?_0x30ba3f[_0xa56d('0x1a')][_0xa56d('0x1c')]||null:null,'limit':_0x30ba3f[_0xa56d('0x1a')]?_0x30ba3f[_0xa56d('0x1a')][_0xa56d('0x1d')]||null:null,'include':_0x30ba3f['options']?_0x30ba3f[_0xa56d('0x1a')][_0xa56d('0x1e')]?_[_0xa56d('0x1f')](_0x30ba3f['options']['include'],function(_0x257841){return{'model':db[_0x257841['model']],'as':_0x257841['as'],'attributes':_0x257841['attributes'],'include':_0x257841[_0xa56d('0x1e')]?_[_0xa56d('0x1f')](_0x257841[_0xa56d('0x1e')],function(_0x2fe90e){return{'model':db[_0x2fe90e[_0xa56d('0x20')]],'as':_0x2fe90e['as'],'attributes':_0x2fe90e[_0xa56d('0x1c')],'include':_0x2fe90e[_0xa56d('0x1e')]?_[_0xa56d('0x1f')](_0x2fe90e[_0xa56d('0x1e')],function(_0x537ebc){return{'model':db[_0x537ebc[_0xa56d('0x20')]],'as':_0x537ebc['as'],'attributes':_0x537ebc[_0xa56d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa56d('0xd')](function(_0x3f8402){logger[_0xa56d('0xe')](_0xa56d('0x21'),_0x30ba3f);logger[_0xa56d('0xf')](_0xa56d('0x21'),_0x30ba3f,JSON[_0xa56d('0x22')](_0x3f8402));_0x2d7a1a(_0x3f8402);})[_0xa56d('0x17')](function(_0xb446a0){logger['error'](_0xa56d('0x21'),_0xb446a0[_0xa56d('0x15')],_0x30ba3f);_0x46cab4(_0x228425[_0xa56d('0x12')](0x1f4,_0xb446a0['message']));});});};exports[_0xa56d('0x23')]=function(_0x3f50df){var _0x197aab=this;return new Promise(function(_0x184663,_0xeed517){return db[_0xa56d('0x18')][_0xa56d('0x24')](_0x3f50df[_0xa56d('0x25')],{'raw':_0x3f50df[_0xa56d('0x1a')]?_0x3f50df[_0xa56d('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa56d('0xd')](function(_0xe3dd6d){logger['info'](_0xa56d('0x23'),_0x3f50df);logger[_0xa56d('0xf')]('CreateMemberReport',_0x3f50df,JSON[_0xa56d('0x22')](_0xe3dd6d));_0x184663(_0xe3dd6d);})[_0xa56d('0x17')](function(_0x46c1bc){logger[_0xa56d('0x12')](_0xa56d('0x23'),_0x46c1bc[_0xa56d('0x15')],_0x3f50df);_0xeed517(_0x197aab[_0xa56d('0x12')](0x1f4,_0x46c1bc[_0xa56d('0x15')]));});});};exports['UpdateMemberReport']=function(_0x49b446){var _0x11edf6=this;return new Promise(function(_0xf9b4ce,_0x5e6b8b){return db['MemberReport'][_0xa56d('0x26')](_0x49b446[_0xa56d('0x25')],{'raw':_0x49b446[_0xa56d('0x1a')]?_0x49b446['options'][_0xa56d('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49b446[_0xa56d('0x1a')]?_0x49b446[_0xa56d('0x1a')][_0xa56d('0x1b')]||null:null,'attributes':_0x49b446['options']?_0x49b446[_0xa56d('0x1a')][_0xa56d('0x1c')]||null:null,'limit':_0x49b446['options']?_0x49b446[_0xa56d('0x1a')]['limit']||null:null})['then'](function(_0x4efaa5){logger[_0xa56d('0xe')]('UpdateMemberReport',_0x49b446);logger[_0xa56d('0xf')](_0xa56d('0x28'),_0x49b446,JSON[_0xa56d('0x22')](_0x4efaa5));_0xf9b4ce(_0x4efaa5);})[_0xa56d('0x17')](function(_0x2df71c){logger[_0xa56d('0x12')](_0xa56d('0x28'),_0x2df71c['message'],_0x49b446);_0x5e6b8b(_0x11edf6[_0xa56d('0x12')](0x1f4,_0x2df71c[_0xa56d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d54aed8..f518c84 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 _0x813e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','multer','util','path','connect-timeout','express','Router'];(function(_0x4f7455,_0x17bc39){var _0xae5e3a=function(_0x412dc8){while(--_0x412dc8){_0x4f7455['push'](_0x4f7455['shift']());}};_0xae5e3a(++_0x17bc39);}(_0x813e,0xba));var _0xe813=function(_0xb61d88,_0x388bba){_0xb61d88=_0xb61d88-0x0;var _0x196a0d=_0x813e[_0xb61d88];return _0x196a0d;};'use strict';var multer=require(_0xe813('0x0'));var util=require(_0xe813('0x1'));var path=require(_0xe813('0x2'));var timeout=require(_0xe813('0x3'));var express=require(_0xe813('0x4'));var router=express[_0xe813('0x5')]();var fs_extra=require(_0xe813('0x6'));var auth=require(_0xe813('0x7'));var interaction=require(_0xe813('0x8'));var config=require(_0xe813('0x9'));var controller=require('./migration.controller');router[_0xe813('0xa')]('/',controller[_0xe813('0xb')]);module['exports']=router; \ No newline at end of file +var _0x46fa=['get','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x346912,_0x4a8eea){var _0x3d7279=function(_0x178aaa){while(--_0x178aaa){_0x346912['push'](_0x346912['shift']());}};_0x3d7279(++_0x4a8eea);}(_0x46fa,0x76));var _0xa46f=function(_0x25a191,_0x54e6c0){_0x25a191=_0x25a191-0x0;var _0x2f5d64=_0x46fa[_0x25a191];return _0x2f5d64;};'use strict';var multer=require(_0xa46f('0x0'));var util=require('util');var path=require(_0xa46f('0x1'));var timeout=require(_0xa46f('0x2'));var express=require(_0xa46f('0x3'));var router=express['Router']();var fs_extra=require(_0xa46f('0x4'));var auth=require(_0xa46f('0x5'));var interaction=require(_0xa46f('0x6'));var config=require(_0xa46f('0x7'));var controller=require('./migration.controller');router[_0xa46f('0x8')]('/',controller['index']);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 b3d381e..fd919ed 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 _0x9d9b=['sequelize','STRING','version'];(function(_0x5942fa,_0x1a8548){var _0x16bf45=function(_0x819d3e){while(--_0x819d3e){_0x5942fa['push'](_0x5942fa['shift']());}};_0x16bf45(++_0x1a8548);}(_0x9d9b,0x117));var _0xb9d9=function(_0x1925db,_0x13b1e7){_0x1925db=_0x1925db-0x0;var _0x1cbd22=_0x9d9b[_0x1925db];return _0x1cbd22;};'use strict';var Sequelize=require(_0xb9d9('0x0'));module['exports']={'version':{'type':Sequelize[_0xb9d9('0x1')],'unique':_0xb9d9('0x2')}}; \ No newline at end of file +var _0x14fd=['version','sequelize','STRING'];(function(_0x185d8f,_0x16b7f1){var _0x39072b=function(_0x188220){while(--_0x188220){_0x185d8f['push'](_0x185d8f['shift']());}};_0x39072b(++_0x16b7f1);}(_0x14fd,0x18d));var _0xd14f=function(_0x1000dc,_0x255fb7){_0x1000dc=_0x1000dc-0x0;var _0x2317cf=_0x14fd[_0x1000dc];return _0x2317cf;};'use strict';var Sequelize=require(_0xd14f('0x0'));module['exports']={'version':{'type':Sequelize[_0xd14f('0x1')],'unique':_0xd14f('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a15cb39..74ea037 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 _0xb22e=['includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb22e,0x1ef));var _0xeb22=function(_0x49e6ae,_0x489307){_0x49e6ae=_0x49e6ae-0x0;var _0x5552da=_0xb22e[_0x49e6ae];return _0x5552da;};'use strict';var emlformat=require(_0xeb22('0x0'));var rimraf=require(_0xeb22('0x1'));var zipdir=require(_0xeb22('0x2'));var jsonpatch=require(_0xeb22('0x3'));var rp=require(_0xeb22('0x4'));var moment=require('moment');var BPromise=require(_0xeb22('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb22('0x6'));var sox=require(_0xeb22('0x7'));var csv=require(_0xeb22('0x8'));var ejs=require(_0xeb22('0x9'));var fs=require('fs');var fs_extra=require(_0xeb22('0xa'));var _=require(_0xeb22('0xb'));var squel=require(_0xeb22('0xc'));var crypto=require(_0xeb22('0xd'));var jsforce=require(_0xeb22('0xe'));var deskjs=require(_0xeb22('0xf'));var toCsv=require(_0xeb22('0x8'));var querystring=require(_0xeb22('0x10'));var Papa=require(_0xeb22('0x11'));var Redis=require(_0xeb22('0x12'));var authService=require(_0xeb22('0x13'));var qs=require(_0xeb22('0x14'));var as=require(_0xeb22('0x15'));var hardwareService=require(_0xeb22('0x16'));var logger=require(_0xeb22('0x17'))(_0xeb22('0x18'));var utils=require(_0xeb22('0x19'));var config=require(_0xeb22('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb22('0x1b'))['db'];function respondWithStatusCode(_0xdd9361,_0x1b66eb){_0x1b66eb=_0x1b66eb||0xcc;return function(_0x5b01da){if(_0x5b01da){return _0xdd9361[_0xeb22('0x1c')](_0x1b66eb);}return _0xdd9361[_0xeb22('0x1d')](_0x1b66eb)['end']();};}function respondWithResult(_0x2f2ed5,_0x15f3cb){_0x15f3cb=_0x15f3cb||0xc8;return function(_0x3dc121){if(_0x3dc121){return _0x2f2ed5[_0xeb22('0x1d')](_0x15f3cb)[_0xeb22('0x1e')](_0x3dc121);}};}function respondWithFilteredResult(_0x2219de,_0x558a03){return function(_0x33bf2a){if(_0x33bf2a){var _0x2747f9=typeof _0x558a03[_0xeb22('0x1f')]===_0xeb22('0x20')&&typeof _0x558a03[_0xeb22('0x21')]===_0xeb22('0x20');var _0x52f0b9=_0x33bf2a[_0xeb22('0x22')];var _0x368906=_0x2747f9?0x0:_0x558a03[_0xeb22('0x1f')];var _0x14ecf2=_0x2747f9?_0x33bf2a['count']:_0x558a03['offset']+_0x558a03['limit'];var _0x46d8d6;if(_0x14ecf2>=_0x52f0b9){_0x14ecf2=_0x52f0b9;_0x46d8d6=0xc8;}else{_0x46d8d6=0xce;}_0x2219de['status'](_0x46d8d6);return _0x2219de['set'](_0xeb22('0x23'),_0x368906+'-'+_0x14ecf2+'/'+_0x52f0b9)[_0xeb22('0x1e')](_0x33bf2a);}return null;};}function patchUpdates(_0x37655c){return function(_0x1301c6){try{jsonpatch[_0xeb22('0x24')](_0x1301c6,_0x37655c,!![]);}catch(_0x3d0b5b){return BPromise['reject'](_0x3d0b5b);}return _0x1301c6[_0xeb22('0x25')]();};}function saveUpdates(_0x25c8e3,_0x2b0664){return function(_0x5a8fdd){if(_0x5a8fdd){return _0x5a8fdd[_0xeb22('0x26')](_0x25c8e3)[_0xeb22('0x27')](function(_0x265939){return _0x265939;});}return null;};}function removeEntity(_0x103106,_0x3c7858){return function(_0x28c67e){if(_0x28c67e){return _0x28c67e['destroy']()[_0xeb22('0x27')](function(){_0x103106[_0xeb22('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d90c4,_0x260ebf){return function(_0x1bcf5f){if(!_0x1bcf5f){_0x2d90c4[_0xeb22('0x1c')](0x194);}return _0x1bcf5f;};}function handleError(_0x5ac6c2,_0x558da3){_0x558da3=_0x558da3||0x1f4;return function(_0x3a63bd){logger[_0xeb22('0x28')](_0x3a63bd[_0xeb22('0x29')]);if(_0x3a63bd[_0xeb22('0x2a')]){delete _0x3a63bd[_0xeb22('0x2a')];}_0x5ac6c2[_0xeb22('0x1d')](_0x558da3)['send'](_0x3a63bd);};}exports[_0xeb22('0x2b')]=function(_0x29c1a6,_0x25d76c){var _0x3ac840={},_0x27aba1={},_0x2ec912={'count':0x0,'rows':[]};var _0x38e578=_[_0xeb22('0x2c')](db[_0xeb22('0x2d')][_0xeb22('0x2e')],function(_0x57a991){return{'name':_0x57a991[_0xeb22('0x2f')],'type':_0x57a991[_0xeb22('0x30')]['key']};});_0x27aba1['model']=_['map'](_0x38e578,_0xeb22('0x2a'));_0x27aba1['query']=_[_0xeb22('0x31')](_0x29c1a6[_0xeb22('0x32')]);_0x27aba1[_0xeb22('0x33')]=_[_0xeb22('0x34')](_0x27aba1[_0xeb22('0x35')],_0x27aba1[_0xeb22('0x32')]);_0x3ac840['attributes']=_[_0xeb22('0x34')](_0x27aba1[_0xeb22('0x35')],qs[_0xeb22('0x36')](_0x29c1a6[_0xeb22('0x32')]['fields']));_0x3ac840['attributes']=_0x3ac840[_0xeb22('0x37')][_0xeb22('0x38')]?_0x3ac840[_0xeb22('0x37')]:_0x27aba1[_0xeb22('0x35')];if(!_0x29c1a6['query'][_0xeb22('0x39')](_0xeb22('0x3a'))){_0x3ac840[_0xeb22('0x21')]=qs[_0xeb22('0x21')](_0x29c1a6[_0xeb22('0x32')][_0xeb22('0x21')]);_0x3ac840['offset']=qs[_0xeb22('0x1f')](_0x29c1a6[_0xeb22('0x32')]['offset']);}_0x3ac840[_0xeb22('0x3b')]=qs['sort'](_0x29c1a6[_0xeb22('0x32')][_0xeb22('0x3c')]);_0x3ac840[_0xeb22('0x3d')]=qs[_0xeb22('0x33')](_['pick'](_0x29c1a6[_0xeb22('0x32')],_0x27aba1[_0xeb22('0x33')]),_0x38e578);if(_0x29c1a6['query'][_0xeb22('0x3e')]){_0x3ac840[_0xeb22('0x3d')]=_[_0xeb22('0x3f')](_0x3ac840[_0xeb22('0x3d')],{'$or':_[_0xeb22('0x2c')](_0x38e578,function(_0x5bc997){if(_0x5bc997[_0xeb22('0x30')]!==_0xeb22('0x40')){var _0x3fc563={};_0x3fc563[_0x5bc997['name']]={'$like':'%'+_0x29c1a6['query'][_0xeb22('0x3e')]+'%'};return _0x3fc563;}})});}_0x3ac840=_[_0xeb22('0x3f')]({},_0x3ac840,_0x29c1a6['options']);var _0x20f558={'where':_0x3ac840['where']};return db[_0xeb22('0x2d')][_0xeb22('0x22')](_0x20f558)[_0xeb22('0x27')](function(_0x5e03bd){_0x2ec912[_0xeb22('0x22')]=_0x5e03bd;if(_0x29c1a6[_0xeb22('0x32')][_0xeb22('0x41')]){_0x3ac840[_0xeb22('0x42')]=[{'all':!![]}];}return db['Migration'][_0xeb22('0x43')](_0x3ac840);})[_0xeb22('0x27')](function(_0x135596){_0x2ec912[_0xeb22('0x44')]=_0x135596;return _0x2ec912;})[_0xeb22('0x27')](respondWithFilteredResult(_0x25d76c,_0x3ac840))[_0xeb22('0x45')](handleError(_0x25d76c,null));}; \ No newline at end of file +var _0xa4b8=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','Migration','findAll','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4b8,0x148));var _0x8a4b=function(_0x46bec2,_0x36cde0){_0x46bec2=_0x46bec2-0x0;var _0x39b857=_0xa4b8[_0x46bec2];return _0x39b857;};'use strict';var emlformat=require(_0x8a4b('0x0'));var rimraf=require(_0x8a4b('0x1'));var zipdir=require(_0x8a4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a4b('0x3'));var moment=require('moment');var BPromise=require(_0x8a4b('0x4'));var Mustache=require(_0x8a4b('0x5'));var util=require(_0x8a4b('0x6'));var path=require(_0x8a4b('0x7'));var sox=require(_0x8a4b('0x8'));var csv=require(_0x8a4b('0x9'));var ejs=require(_0x8a4b('0xa'));var fs=require('fs');var fs_extra=require(_0x8a4b('0xb'));var _=require(_0x8a4b('0xc'));var squel=require('squel');var crypto=require(_0x8a4b('0xd'));var jsforce=require(_0x8a4b('0xe'));var deskjs=require(_0x8a4b('0xf'));var toCsv=require(_0x8a4b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a4b('0x10'));var authService=require(_0x8a4b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a4b('0x12'));var logger=require(_0x8a4b('0x13'))(_0x8a4b('0x14'));var utils=require(_0x8a4b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8a4b('0x16'));var db=require(_0x8a4b('0x17'))['db'];function respondWithStatusCode(_0x379f0b,_0x54d870){_0x54d870=_0x54d870||0xcc;return function(_0x5373c6){if(_0x5373c6){return _0x379f0b[_0x8a4b('0x18')](_0x54d870);}return _0x379f0b[_0x8a4b('0x19')](_0x54d870)[_0x8a4b('0x1a')]();};}function respondWithResult(_0x3ecb5b,_0x1d6781){_0x1d6781=_0x1d6781||0xc8;return function(_0xcb1985){if(_0xcb1985){return _0x3ecb5b[_0x8a4b('0x19')](_0x1d6781)[_0x8a4b('0x1b')](_0xcb1985);}};}function respondWithFilteredResult(_0x190b28,_0x1dd184){return function(_0x299b36){if(_0x299b36){var _0x26781f=typeof _0x1dd184['offset']===_0x8a4b('0x1c')&&typeof _0x1dd184['limit']===_0x8a4b('0x1c');var _0x445e6f=_0x299b36[_0x8a4b('0x1d')];var _0x3e3995=_0x26781f?0x0:_0x1dd184['offset'];var _0x435173=_0x26781f?_0x299b36['count']:_0x1dd184[_0x8a4b('0x1e')]+_0x1dd184['limit'];var _0x37d3b8;if(_0x435173>=_0x445e6f){_0x435173=_0x445e6f;_0x37d3b8=0xc8;}else{_0x37d3b8=0xce;}_0x190b28['status'](_0x37d3b8);return _0x190b28[_0x8a4b('0x1f')]('Content-Range',_0x3e3995+'-'+_0x435173+'/'+_0x445e6f)[_0x8a4b('0x1b')](_0x299b36);}return null;};}function patchUpdates(_0x3d18c7){return function(_0x2ad662){try{jsonpatch[_0x8a4b('0x20')](_0x2ad662,_0x3d18c7,!![]);}catch(_0x49892a){return BPromise[_0x8a4b('0x21')](_0x49892a);}return _0x2ad662[_0x8a4b('0x22')]();};}function saveUpdates(_0x3c1535,_0x43d8d7){return function(_0x5c8dad){if(_0x5c8dad){return _0x5c8dad[_0x8a4b('0x23')](_0x3c1535)[_0x8a4b('0x24')](function(_0x250330){return _0x250330;});}return null;};}function removeEntity(_0x19386a,_0xbe08b2){return function(_0x294b43){if(_0x294b43){return _0x294b43[_0x8a4b('0x25')]()[_0x8a4b('0x24')](function(){_0x19386a[_0x8a4b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1575c9,_0x192f08){return function(_0x1ee52e){if(!_0x1ee52e){_0x1575c9[_0x8a4b('0x18')](0x194);}return _0x1ee52e;};}function handleError(_0x1cfe27,_0x1140bf){_0x1140bf=_0x1140bf||0x1f4;return function(_0x55bb4f){logger[_0x8a4b('0x26')](_0x55bb4f[_0x8a4b('0x27')]);if(_0x55bb4f[_0x8a4b('0x28')]){delete _0x55bb4f['name'];}_0x1cfe27['status'](_0x1140bf)[_0x8a4b('0x29')](_0x55bb4f);};}exports[_0x8a4b('0x2a')]=function(_0x174e43,_0x3dd479){var _0x3e778e={},_0x49a324={},_0x128023={'count':0x0,'rows':[]};var _0x415f98=_[_0x8a4b('0x2b')](db['Migration'][_0x8a4b('0x2c')],function(_0x3dd6ad){return{'name':_0x3dd6ad[_0x8a4b('0x2d')],'type':_0x3dd6ad[_0x8a4b('0x2e')]['key']};});_0x49a324['model']=_['map'](_0x415f98,'name');_0x49a324[_0x8a4b('0x2f')]=_['keys'](_0x174e43[_0x8a4b('0x2f')]);_0x49a324[_0x8a4b('0x30')]=_['intersection'](_0x49a324[_0x8a4b('0x31')],_0x49a324[_0x8a4b('0x2f')]);_0x3e778e['attributes']=_['intersection'](_0x49a324['model'],qs['fields'](_0x174e43['query'][_0x8a4b('0x32')]));_0x3e778e[_0x8a4b('0x33')]=_0x3e778e['attributes'][_0x8a4b('0x34')]?_0x3e778e[_0x8a4b('0x33')]:_0x49a324[_0x8a4b('0x31')];if(!_0x174e43[_0x8a4b('0x2f')][_0x8a4b('0x35')](_0x8a4b('0x36'))){_0x3e778e[_0x8a4b('0x37')]=qs[_0x8a4b('0x37')](_0x174e43[_0x8a4b('0x2f')][_0x8a4b('0x37')]);_0x3e778e['offset']=qs['offset'](_0x174e43[_0x8a4b('0x2f')][_0x8a4b('0x1e')]);}_0x3e778e[_0x8a4b('0x38')]=qs['sort'](_0x174e43[_0x8a4b('0x2f')][_0x8a4b('0x39')]);_0x3e778e[_0x8a4b('0x3a')]=qs['filters'](_[_0x8a4b('0x3b')](_0x174e43[_0x8a4b('0x2f')],_0x49a324['filters']),_0x415f98);if(_0x174e43[_0x8a4b('0x2f')][_0x8a4b('0x3c')]){_0x3e778e[_0x8a4b('0x3a')]=_[_0x8a4b('0x3d')](_0x3e778e[_0x8a4b('0x3a')],{'$or':_[_0x8a4b('0x2b')](_0x415f98,function(_0x15505b){if(_0x15505b['type']!==_0x8a4b('0x3e')){var _0x42ae19={};_0x42ae19[_0x15505b['name']]={'$like':'%'+_0x174e43[_0x8a4b('0x2f')][_0x8a4b('0x3c')]+'%'};return _0x42ae19;}})});}_0x3e778e=_['merge']({},_0x3e778e,_0x174e43[_0x8a4b('0x3f')]);var _0x42b20e={'where':_0x3e778e['where']};return db['Migration'][_0x8a4b('0x1d')](_0x42b20e)[_0x8a4b('0x24')](function(_0x5526f9){_0x128023['count']=_0x5526f9;if(_0x174e43[_0x8a4b('0x2f')]['includeAll']){_0x3e778e[_0x8a4b('0x40')]=[{'all':!![]}];}return db[_0x8a4b('0x41')][_0x8a4b('0x42')](_0x3e778e);})[_0x8a4b('0x24')](function(_0x310440){_0x128023['rows']=_0x310440;return _0x128023;})['then'](respondWithFilteredResult(_0x3dd479,_0x3e778e))['catch'](handleError(_0x3dd479,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c8b0404..860328b 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 _0xa76e=['Migration','migrations','util','../../config/logger','path','../../config/environment','./migration.attributes','exports','define'];(function(_0x3f373b,_0x282795){var _0x37409c=function(_0x3b82fc){while(--_0x3b82fc){_0x3f373b['push'](_0x3f373b['shift']());}};_0x37409c(++_0x282795);}(_0xa76e,0x92));var _0xea76=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xa76e[_0x836465];return _0x2150ea;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var logger=require(_0xea76('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea76('0x2'));var rimraf=require('rimraf');var config=require(_0xea76('0x3'));var attributes=require(_0xea76('0x4'));module[_0xea76('0x5')]=function(_0x35e481,_0x573cbc){return _0x35e481[_0xea76('0x6')](_0xea76('0x7'),attributes,{'tableName':_0xea76('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb606=['rimraf','./migration.attributes','exports','define','migrations','lodash','util','api','bluebird','path'];(function(_0x7a718,_0x53e4a1){var _0x2d10dc=function(_0x4fd89a){while(--_0x4fd89a){_0x7a718['push'](_0x7a718['shift']());}};_0x2d10dc(++_0x53e4a1);}(_0xb606,0x1bd));var _0x6b60=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0xb606[_0xffd8b0];return _0x301ba0;};'use strict';var _=require(_0x6b60('0x0'));var util=require(_0x6b60('0x1'));var logger=require('../../config/logger')(_0x6b60('0x2'));var moment=require('moment');var BPromise=require(_0x6b60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b60('0x4'));var rimraf=require(_0x6b60('0x5'));var config=require('../../config/environment');var attributes=require(_0x6b60('0x6'));module[_0x6b60('0x7')]=function(_0x25e6b7,_0x36b4ed){return _0x25e6b7[_0x6b60('0x8')]('Migration',attributes,{'tableName':_0x6b60('0x9'),'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 ebf18f9..1f07242 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 _0xceb0=['../../config/logger','jayson/promise','client','http','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Migration,\x20%s,\x20%s','message','result','randomstring','../../mysqldb','../../config/utils'];(function(_0x463b8d,_0x48e84d){var _0x110972=function(_0x103833){while(--_0x103833){_0x463b8d['push'](_0x463b8d['shift']());}};_0x110972(++_0x48e84d);}(_0xceb0,0x173));var _0x0ceb=function(_0x46703a,_0x59b5cc){_0x46703a=_0x46703a-0x0;var _0x10c7e3=_0xceb0[_0x46703a];return _0x10c7e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ceb('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ceb('0x1'))['db'];var utils=require(_0x0ceb('0x2'));var logger=require(_0x0ceb('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ceb('0x4'));var client=jayson[_0x0ceb('0x5')][_0x0ceb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52e6bb,_0x448bf8,_0x19e438){return new BPromise(function(_0x4ec03a,_0x9e53b7){return client['request'](_0x52e6bb,_0x19e438)[_0x0ceb('0x7')](function(_0x3e71f4){logger[_0x0ceb('0x8')]('Migration,\x20%s,\x20%s',_0x448bf8,'request\x20sent');logger[_0x0ceb('0x9')](_0x0ceb('0xa'),_0x448bf8,_0x0ceb('0xb'),JSON[_0x0ceb('0xc')](_0x3e71f4));if(_0x3e71f4[_0x0ceb('0xd')]){if(_0x3e71f4[_0x0ceb('0xd')]['code']===0x1f4){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);return _0x9e53b7(_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);}logger[_0x0ceb('0xd')]('Migration,\x20%s,\x20%s',_0x448bf8,_0x3e71f4[_0x0ceb('0xd')]['message']);return _0x4ec03a(_0x3e71f4['error'][_0x0ceb('0xf')]);}else{logger[_0x0ceb('0x8')](_0x0ceb('0xe'),_0x448bf8,'request\x20sent');_0x4ec03a(_0x3e71f4[_0x0ceb('0x10')][_0x0ceb('0xf')]);}})['catch'](function(_0x1dc6f5){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x1dc6f5);_0x9e53b7(_0x1dc6f5);});});} \ No newline at end of file +var _0x8e63=['message','request\x20sent','result','catch','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0x8e63,0x7c));var _0x38e6=function(_0x5e5309,_0x1d585f){_0x5e5309=_0x5e5309-0x0;var _0x766b7=_0x8e63[_0x5e5309];return _0x766b7;};'use strict';var _=require('lodash');var util=require(_0x38e6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x38e6('0x1'));var fs=require('fs');var Redis=require(_0x38e6('0x2'));var db=require(_0x38e6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x38e6('0x4'));var config=require(_0x38e6('0x5'));var jayson=require(_0x38e6('0x6'));var client=jayson['client'][_0x38e6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19e7be,_0x9dd996,_0x315953){return new BPromise(function(_0x51b586,_0x55abdf){return client[_0x38e6('0x8')](_0x19e7be,_0x315953)[_0x38e6('0x9')](function(_0x1a4c20){logger[_0x38e6('0xa')](_0x38e6('0xb'),_0x9dd996,'request\x20sent');logger['debug'](_0x38e6('0xc'),_0x9dd996,'request\x20sent',JSON[_0x38e6('0xd')](_0x1a4c20));if(_0x1a4c20['error']){if(_0x1a4c20[_0x38e6('0xe')][_0x38e6('0xf')]===0x1f4){logger[_0x38e6('0xe')](_0x38e6('0xb'),_0x9dd996,_0x1a4c20[_0x38e6('0xe')]['message']);return _0x55abdf(_0x1a4c20[_0x38e6('0xe')][_0x38e6('0x10')]);}logger['error'](_0x38e6('0xb'),_0x9dd996,_0x1a4c20[_0x38e6('0xe')][_0x38e6('0x10')]);return _0x51b586(_0x1a4c20[_0x38e6('0xe')][_0x38e6('0x10')]);}else{logger[_0x38e6('0xa')]('Migration,\x20%s,\x20%s',_0x9dd996,_0x38e6('0x11'));_0x51b586(_0x1a4c20[_0x38e6('0x12')][_0x38e6('0x10')]);}})[_0x38e6('0x13')](function(_0x5f9d7e){logger['error'](_0x38e6('0xb'),_0x9dd996,_0x5f9d7e);_0x55abdf(_0x5f9d7e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d96d6a6..97f17ac 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 _0x3b40=['get','index','/:id','show','isAuthenticated','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xea860f,_0x4e877e){var _0x4ab3e7=function(_0x184a4d){while(--_0x184a4d){_0xea860f['push'](_0xea860f['shift']());}};_0x4ab3e7(++_0x4e877e);}(_0x3b40,0x13a));var _0x03b4=function(_0x23dad9,_0x8bd964){_0x23dad9=_0x23dad9-0x0;var _0x2c5e5a=_0x3b40[_0x23dad9];return _0x2c5e5a;};'use strict';var multer=require('multer');var util=require(_0x03b4('0x0'));var path=require(_0x03b4('0x1'));var timeout=require(_0x03b4('0x2'));var express=require(_0x03b4('0x3'));var router=express[_0x03b4('0x4')]();var fs_extra=require(_0x03b4('0x5'));var auth=require(_0x03b4('0x6'));var interaction=require(_0x03b4('0x7'));var config=require(_0x03b4('0x8'));var controller=require('./network.controller');router[_0x03b4('0x9')]('/',auth['isAuthenticated'](),controller[_0x03b4('0xa')]);router['get'](_0x03b4('0xb'),auth['isAuthenticated'](),controller[_0x03b4('0xc')]);router['post']('/',auth[_0x03b4('0xd')](),controller[_0x03b4('0xe')]);router['put'](_0x03b4('0xb'),auth['isAuthenticated'](),controller[_0x03b4('0xf')]);router[_0x03b4('0x10')](_0x03b4('0xb'),auth[_0x03b4('0xd')](),controller[_0x03b4('0x11')]);module[_0x03b4('0x12')]=router; \ No newline at end of file +var _0x2eba=['update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','post','create'];(function(_0x1f120c,_0x22cd8f){var _0x3f43f5=function(_0x2e6eef){while(--_0x2e6eef){_0x1f120c['push'](_0x1f120c['shift']());}};_0x3f43f5(++_0x22cd8f);}(_0x2eba,0xc7));var _0xa2eb=function(_0x132d91,_0x4c98a8){_0x132d91=_0x132d91-0x0;var _0x233c3d=_0x2eba[_0x132d91];return _0x233c3d;};'use strict';var multer=require('multer');var util=require(_0xa2eb('0x0'));var path=require(_0xa2eb('0x1'));var timeout=require(_0xa2eb('0x2'));var express=require(_0xa2eb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa2eb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa2eb('0x5'));var controller=require(_0xa2eb('0x6'));router[_0xa2eb('0x7')]('/',auth[_0xa2eb('0x8')](),controller['index']);router['get']('/:id',auth[_0xa2eb('0x8')](),controller['show']);router[_0xa2eb('0x9')]('/',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xa')]);router['put']('/:id',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xb')]);router[_0xa2eb('0xc')]('/:id',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 77a2857..68b5dce 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 _0x4969=['exports','ENUM','localnet','externip','turn','STRING','sequelize'];(function(_0xfcc0e,_0x1da886){var _0x32bb2e=function(_0x4c627c){while(--_0x4c627c){_0xfcc0e['push'](_0xfcc0e['shift']());}};_0x32bb2e(++_0x1da886);}(_0x4969,0x195));var _0x9496=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0x4969[_0x45096e];return _0xba1fa3;};'use strict';var Sequelize=require(_0x9496('0x0'));module[_0x9496('0x1')]={'type':{'type':Sequelize[_0x9496('0x2')](_0x9496('0x3'),_0x9496('0x4'),'stun',_0x9496('0x5'))},'value':{'type':Sequelize[_0x9496('0x6')]},'username':{'type':Sequelize[_0x9496('0x6')]},'password':{'type':Sequelize[_0x9496('0x6')]}}; \ No newline at end of file +var _0x02b5=['externip','stun','turn','STRING','exports'];(function(_0x20b3fd,_0x380360){var _0x5caada=function(_0x8b5e9a){while(--_0x8b5e9a){_0x20b3fd['push'](_0x20b3fd['shift']());}};_0x5caada(++_0x380360);}(_0x02b5,0x167));var _0x502b=function(_0x954e8f,_0x91eeb2){_0x954e8f=_0x954e8f-0x0;var _0x2f2a7f=_0x02b5[_0x954e8f];return _0x2f2a7f;};'use strict';var Sequelize=require('sequelize');module[_0x502b('0x0')]={'type':{'type':Sequelize['ENUM']('localnet',_0x502b('0x1'),_0x502b('0x2'),_0x502b('0x3'))},'value':{'type':Sequelize[_0x502b('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x502b('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4029b91..94ed79d 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 _0xf131=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','offset','undefined','limit','count','status','json','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','Network','includeAll','include','findAll','rows','show','params','length','find','create','sequelize','transaction','STUN','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','join','format','body','toLowerCase','chan_sip.so','toUpperCase','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x3c4e48,_0x43a5eb){var _0x37fd7e=function(_0x27aa2b){while(--_0x27aa2b){_0x3c4e48['push'](_0x3c4e48['shift']());}};_0x37fd7e(++_0x43a5eb);}(_0xf131,0x1a1));var _0x1f13=function(_0x446226,_0x122408){_0x446226=_0x446226-0x0;var _0x3b5633=_0xf131[_0x446226];return _0x3b5633;};'use strict';var emlformat=require(_0x1f13('0x0'));var rimraf=require(_0x1f13('0x1'));var zipdir=require(_0x1f13('0x2'));var jsonpatch=require(_0x1f13('0x3'));var rp=require(_0x1f13('0x4'));var moment=require(_0x1f13('0x5'));var BPromise=require(_0x1f13('0x6'));var Mustache=require(_0x1f13('0x7'));var util=require('util');var path=require(_0x1f13('0x8'));var sox=require('sox');var csv=require(_0x1f13('0x9'));var ejs=require(_0x1f13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f13('0xb'));var squel=require(_0x1f13('0xc'));var crypto=require(_0x1f13('0xd'));var jsforce=require(_0x1f13('0xe'));var deskjs=require(_0x1f13('0xf'));var toCsv=require(_0x1f13('0x9'));var querystring=require(_0x1f13('0x10'));var Papa=require(_0x1f13('0x11'));var Redis=require('ioredis');var authService=require(_0x1f13('0x12'));var qs=require(_0x1f13('0x13'));var as=require(_0x1f13('0x14'));var hardwareService=require(_0x1f13('0x15'));var logger=require(_0x1f13('0x16'))('api');var utils=require(_0x1f13('0x17'));var config=require(_0x1f13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f13('0x19'))['db'];var jayson=require(_0x1f13('0x1a'));var client=jayson[_0x1f13('0x1b')][_0x1f13('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x8bd9d3,_0x1e40ca,_0x572499,_0x26b450){return new BPromise(function(_0x17f37d,_0x58c825){var _0x326054=_0x26b450||client;return _0x326054[_0x1f13('0x1d')](_0x8bd9d3,_0x572499)[_0x1f13('0x1e')](function(_0xb27afa){logger[_0x1f13('0x1f')](_0x1f13('0x20'),_0x1e40ca,_0x1f13('0x21'));logger[_0x1f13('0x22')](_0x1f13('0x23'),_0x1e40ca,_0x1f13('0x21'),JSON[_0x1f13('0x24')](_0xb27afa));if(_0xb27afa['error']){if(_0xb27afa[_0x1f13('0x25')]['code']===0x1f4){logger[_0x1f13('0x25')](_0x1f13('0x20'),_0x1e40ca,_0xb27afa[_0x1f13('0x25')][_0x1f13('0x26')]);return _0x58c825(_0xb27afa[_0x1f13('0x25')][_0x1f13('0x26')]);}logger[_0x1f13('0x25')]('Network,\x20%s,\x20%s',_0x1e40ca,_0xb27afa[_0x1f13('0x25')][_0x1f13('0x26')]);return _0x17f37d(_0xb27afa['error']['message']);}else{logger[_0x1f13('0x1f')](_0x1f13('0x20'),_0x1e40ca,_0x1f13('0x21'));_0x17f37d(_0xb27afa['result']['message']);}})[_0x1f13('0x27')](function(_0x457b1){logger[_0x1f13('0x25')](_0x1f13('0x20'),_0x1e40ca,_0x457b1);_0x58c825(_0x457b1);});});}function respondWithStatusCode(_0x107cba,_0x2c80fb){_0x2c80fb=_0x2c80fb||0xcc;return function(_0x2a2f46){if(_0x2a2f46){return _0x107cba[_0x1f13('0x28')](_0x2c80fb);}return _0x107cba['status'](_0x2c80fb)[_0x1f13('0x29')]();};}function respondWithResult(_0x2a3610,_0x1caa35){_0x1caa35=_0x1caa35||0xc8;return function(_0x28aa50){if(_0x28aa50){return _0x2a3610['status'](_0x1caa35)['json'](_0x28aa50);}};}function respondWithFilteredResult(_0x3daf90,_0x485457){return function(_0x4199eb){if(_0x4199eb){var _0xab32a1=typeof _0x485457[_0x1f13('0x2a')]===_0x1f13('0x2b')&&typeof _0x485457[_0x1f13('0x2c')]===_0x1f13('0x2b');var _0x37aa39=_0x4199eb['count'];var _0x11a74e=_0xab32a1?0x0:_0x485457['offset'];var _0x434d74=_0xab32a1?_0x4199eb[_0x1f13('0x2d')]:_0x485457[_0x1f13('0x2a')]+_0x485457[_0x1f13('0x2c')];var _0x129156;if(_0x434d74>=_0x37aa39){_0x434d74=_0x37aa39;_0x129156=0xc8;}else{_0x129156=0xce;}_0x3daf90[_0x1f13('0x2e')](_0x129156);return _0x3daf90['set']('Content-Range',_0x11a74e+'-'+_0x434d74+'/'+_0x37aa39)[_0x1f13('0x2f')](_0x4199eb);}return null;};}function patchUpdates(_0xc7bfe1){return function(_0x4ef848){try{jsonpatch[_0x1f13('0x30')](_0x4ef848,_0xc7bfe1,!![]);}catch(_0x8a8632){return BPromise['reject'](_0x8a8632);}return _0x4ef848[_0x1f13('0x31')]();};}function saveUpdates(_0x1d534f,_0x42d88d){return function(_0x213587){if(_0x213587){return _0x213587[_0x1f13('0x32')](_0x1d534f)[_0x1f13('0x1e')](function(_0x297292){return _0x297292;});}return null;};}function removeEntity(_0x5e0deb,_0x3d7391){return function(_0x256f4a){if(_0x256f4a){return _0x256f4a[_0x1f13('0x33')]()[_0x1f13('0x1e')](function(){_0x5e0deb[_0x1f13('0x2e')](0xcc)[_0x1f13('0x29')]();});}};}function handleEntityNotFound(_0x1724f1,_0x3005d8){return function(_0x21ad51){if(!_0x21ad51){_0x1724f1[_0x1f13('0x28')](0x194);}return _0x21ad51;};}function handleError(_0x21021f,_0x10bc11){_0x10bc11=_0x10bc11||0x1f4;return function(_0x69e3ed){logger[_0x1f13('0x25')](_0x69e3ed[_0x1f13('0x34')]);if(_0x69e3ed['name']){delete _0x69e3ed[_0x1f13('0x35')];}_0x21021f[_0x1f13('0x2e')](_0x10bc11)[_0x1f13('0x36')](_0x69e3ed);};}exports[_0x1f13('0x37')]=function(_0x42bf3d,_0x5e9ef3){var _0x27011b={},_0x5918e8={},_0x180591={'count':0x0,'rows':[]};var _0x3b62fa=_[_0x1f13('0x38')](db['Network'][_0x1f13('0x39')],function(_0x36cccc){return{'name':_0x36cccc[_0x1f13('0x3a')],'type':_0x36cccc[_0x1f13('0x3b')][_0x1f13('0x3c')]};});_0x5918e8[_0x1f13('0x3d')]=_[_0x1f13('0x38')](_0x3b62fa,_0x1f13('0x35'));_0x5918e8[_0x1f13('0x3e')]=_[_0x1f13('0x3f')](_0x42bf3d[_0x1f13('0x3e')]);_0x5918e8[_0x1f13('0x40')]=_[_0x1f13('0x41')](_0x5918e8[_0x1f13('0x3d')],_0x5918e8[_0x1f13('0x3e')]);_0x27011b[_0x1f13('0x42')]=_['intersection'](_0x5918e8[_0x1f13('0x3d')],qs[_0x1f13('0x43')](_0x42bf3d[_0x1f13('0x3e')][_0x1f13('0x43')]));_0x27011b[_0x1f13('0x42')]=_0x27011b[_0x1f13('0x42')]['length']?_0x27011b[_0x1f13('0x42')]:_0x5918e8[_0x1f13('0x3d')];if(!_0x42bf3d['query'][_0x1f13('0x44')]('nolimit')){_0x27011b[_0x1f13('0x2c')]=qs[_0x1f13('0x2c')](_0x42bf3d['query'][_0x1f13('0x2c')]);_0x27011b[_0x1f13('0x2a')]=qs['offset'](_0x42bf3d['query'][_0x1f13('0x2a')]);}_0x27011b[_0x1f13('0x45')]=qs[_0x1f13('0x46')](_0x42bf3d[_0x1f13('0x3e')][_0x1f13('0x46')]);_0x27011b['where']=qs['filters'](_[_0x1f13('0x47')](_0x42bf3d[_0x1f13('0x3e')],_0x5918e8[_0x1f13('0x40')]),_0x3b62fa);if(_0x42bf3d[_0x1f13('0x3e')][_0x1f13('0x48')]){_0x27011b[_0x1f13('0x49')]=_[_0x1f13('0x4a')](_0x27011b[_0x1f13('0x49')],{'$or':_['map'](_0x3b62fa,function(_0x52aae5){if(_0x52aae5[_0x1f13('0x3b')]!=='VIRTUAL'){var _0xc1cc07={};_0xc1cc07[_0x52aae5[_0x1f13('0x35')]]={'$like':'%'+_0x42bf3d[_0x1f13('0x3e')][_0x1f13('0x48')]+'%'};return _0xc1cc07;}})});}_0x27011b=_[_0x1f13('0x4a')]({},_0x27011b,_0x42bf3d[_0x1f13('0x4b')]);var _0x5899f9={'where':_0x27011b[_0x1f13('0x49')]};return db[_0x1f13('0x4c')]['count'](_0x5899f9)[_0x1f13('0x1e')](function(_0x4a06c8){_0x180591[_0x1f13('0x2d')]=_0x4a06c8;if(_0x42bf3d[_0x1f13('0x3e')][_0x1f13('0x4d')]){_0x27011b[_0x1f13('0x4e')]=[{'all':!![]}];}return db[_0x1f13('0x4c')][_0x1f13('0x4f')](_0x27011b);})[_0x1f13('0x1e')](function(_0x577a1f){_0x180591[_0x1f13('0x50')]=_0x577a1f;return _0x180591;})['then'](respondWithFilteredResult(_0x5e9ef3,_0x27011b))['catch'](handleError(_0x5e9ef3,null));};exports[_0x1f13('0x51')]=function(_0xbb3db7,_0x22f662){var _0x5959f4={'raw':!![],'where':{'id':_0xbb3db7[_0x1f13('0x52')]['id']}},_0x33f5cf={};_0x33f5cf[_0x1f13('0x3d')]=_[_0x1f13('0x3f')](db[_0x1f13('0x4c')][_0x1f13('0x39')]);_0x33f5cf[_0x1f13('0x3e')]=_[_0x1f13('0x3f')](_0xbb3db7[_0x1f13('0x3e')]);_0x33f5cf[_0x1f13('0x40')]=_[_0x1f13('0x41')](_0x33f5cf[_0x1f13('0x3d')],_0x33f5cf[_0x1f13('0x3e')]);_0x5959f4['attributes']=_['intersection'](_0x33f5cf[_0x1f13('0x3d')],qs['fields'](_0xbb3db7[_0x1f13('0x3e')][_0x1f13('0x43')]));_0x5959f4[_0x1f13('0x42')]=_0x5959f4[_0x1f13('0x42')][_0x1f13('0x53')]?_0x5959f4['attributes']:_0x33f5cf[_0x1f13('0x3d')];if(_0xbb3db7[_0x1f13('0x3e')][_0x1f13('0x4d')]){_0x5959f4[_0x1f13('0x4e')]=[{'all':!![]}];}_0x5959f4=_[_0x1f13('0x4a')]({},_0x5959f4,_0xbb3db7[_0x1f13('0x4b')]);return db[_0x1f13('0x4c')][_0x1f13('0x54')](_0x5959f4)[_0x1f13('0x1e')](handleEntityNotFound(_0x22f662,null))['then'](respondWithResult(_0x22f662,null))['catch'](handleError(_0x22f662,null));};exports[_0x1f13('0x55')]=function(_0x15c03f,_0x41bc0d,_0x12f808){var _0x3a362e;return db[_0x1f13('0x56')][_0x1f13('0x57')](function(_0x2d026e){return db[_0x1f13('0x4c')][_0x1f13('0x55')](_0x15c03f['body'],{'raw':!![]})[_0x1f13('0x1e')](function(_0x2c0d92){_0x3a362e=_0x2c0d92;return db['Network']['findAll']({'where':{'type':_0x15c03f['body']['type']},'raw':!![]});})[_0x1f13('0x1e')](function(_0x28d42b){if(_0x3a362e[_0x1f13('0x3b')]['toUpperCase']()==_0x1f13('0x58')){var _0x17c23e=fs['readFileSync'](path['join'](config[_0x1f13('0x59')],_0x1f13('0x5a')),'utf8');var _0x9c4e88=ejs[_0x1f13('0x5b')](_0x17c23e,{'networks':_0x28d42b||[]});fs['writeFileSync'](_0x1f13('0x5c'),_0x9c4e88);return respondWithRpcPromise(_0x1f13('0x5d'),'create',{'module':_0x1f13('0x5e')});}else if(_0x3a362e['type']['toUpperCase']()==_0x1f13('0x5f')){var _0x89ade1=fs[_0x1f13('0x60')](path['join'](config[_0x1f13('0x59')],'server/files/templates/turn_multiple.ejs'),_0x1f13('0x61'));var _0x1dc5f8=ejs[_0x1f13('0x5b')](_0x89ade1,{'networks':_0x28d42b||[]});fs[_0x1f13('0x62')](_0x1f13('0x63'),_0x1dc5f8);return respondWithRpcPromise(_0x1f13('0x5d'),_0x1f13('0x55'),{'module':_0x1f13('0x5e')});}else{var _0x163f90=fs[_0x1f13('0x60')](path[_0x1f13('0x64')](config[_0x1f13('0x59')],'server/files/templates/network.ejs'),'utf8');var _0x4bd11d=ejs['render'](_0x163f90,{'networks':_0x28d42b||[]});fs[_0x1f13('0x62')](util[_0x1f13('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x15c03f[_0x1f13('0x66')]['type'][_0x1f13('0x67')]()),_0x4bd11d);return respondWithRpcPromise(_0x1f13('0x5d'),_0x1f13('0x55'),{'module':_0x1f13('0x68')});}return null;})[_0x1f13('0x1e')](function(){return _0x3a362e;});})[_0x1f13('0x1e')](respondWithResult(_0x41bc0d,0xc9))[_0x1f13('0x27')](handleError(_0x41bc0d,null));};exports[_0x1f13('0x32')]=function(_0x4d1c9b,_0x5a8cd5,_0x55c1a6){var _0x1e99b2;return db[_0x1f13('0x56')][_0x1f13('0x57')](function(_0x4aba59){return db['Network'][_0x1f13('0x54')]({'where':{'id':_0x4d1c9b[_0x1f13('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a8cd5,null))[_0x1f13('0x1e')](saveUpdates(_0x4d1c9b[_0x1f13('0x66')],null))['then'](function(_0x3819c5){if(_0x3819c5){_0x1e99b2=_0x3819c5;return db['Network'][_0x1f13('0x4f')]({'where':{'type':_0x1e99b2[_0x1f13('0x3b')]},'raw':!![]});}return null;})['then'](function(_0xfbb0ee){if(_0x1e99b2[_0x1f13('0x3b')][_0x1f13('0x69')]()==_0x1f13('0x58')){var _0x43ad51=fs[_0x1f13('0x60')](path[_0x1f13('0x64')](config[_0x1f13('0x59')],_0x1f13('0x5a')),_0x1f13('0x61'));var _0x4d6e3e=ejs[_0x1f13('0x5b')](_0x43ad51,{'networks':_0xfbb0ee||[]});fs['writeFileSync'](_0x1f13('0x5c'),_0x4d6e3e);return respondWithRpcPromise('Reload',_0x1f13('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x1e99b2[_0x1f13('0x3b')][_0x1f13('0x69')]()==_0x1f13('0x5f')){var _0x10d438=fs['readFileSync'](path[_0x1f13('0x64')](config['root'],_0x1f13('0x6a')),_0x1f13('0x61'));var _0x4fe4eb=ejs[_0x1f13('0x5b')](_0x10d438,{'networks':_0xfbb0ee||[]});fs[_0x1f13('0x62')](_0x1f13('0x63'),_0x4fe4eb);return respondWithRpcPromise(_0x1f13('0x5d'),'update',{'module':'res_stun_monitor.so'});}else{var _0x4a659d=fs[_0x1f13('0x60')](path['join'](config[_0x1f13('0x59')],'server/files/templates/network.ejs'),_0x1f13('0x61'));var _0x55b19b=ejs[_0x1f13('0x5b')](_0x4a659d,{'networks':_0xfbb0ee||[]});fs[_0x1f13('0x62')](util[_0x1f13('0x65')](_0x1f13('0x6b'),_0x4d1c9b['body']['type'][_0x1f13('0x67')]()),_0x55b19b);return respondWithRpcPromise(_0x1f13('0x5d'),_0x1f13('0x32'),{'module':_0x1f13('0x68')});}return null;})['then'](function(_0x2fa862){if(_0x2fa862){return _0x1e99b2;}return null;});})[_0x1f13('0x1e')](respondWithResult(_0x5a8cd5,null))[_0x1f13('0x27')](handleError(_0x5a8cd5,null));};exports[_0x1f13('0x33')]=function(_0x3fd071,_0x4fdc14,_0x25bb5a){var _0x48b88f;return db['Network']['find']({'where':{'id':_0x3fd071['params']['id']}})['then'](function(_0x3d1718){_0x48b88f=_0x3d1718;return _0x3d1718;})[_0x1f13('0x1e')](handleEntityNotFound(_0x4fdc14,null))['then'](removeEntity(_0x4fdc14,null))[_0x1f13('0x1e')](function(){if(_0x48b88f){return db[_0x1f13('0x4c')][_0x1f13('0x4f')]({'where':{'type':_0x48b88f[_0x1f13('0x3b')]},'raw':!![]});}})[_0x1f13('0x1e')](function(_0x56dafa){if(_0x48b88f[_0x1f13('0x3b')][_0x1f13('0x69')]()==_0x1f13('0x58')){var _0x497da0=fs[_0x1f13('0x60')](path['join'](config[_0x1f13('0x59')],'server/files/templates/stun_multiple.ejs'),_0x1f13('0x61'));var _0x529eb8=ejs[_0x1f13('0x5b')](_0x497da0,{'networks':_0x56dafa||[]});fs[_0x1f13('0x62')](_0x1f13('0x5c'),_0x529eb8);return respondWithRpcPromise(_0x1f13('0x5d'),'destroy',{'module':_0x1f13('0x5e')});}else if(_0x48b88f[_0x1f13('0x3b')][_0x1f13('0x69')]()==_0x1f13('0x5f')){var _0x4568bb=fs[_0x1f13('0x60')](path['join'](config['root'],_0x1f13('0x6a')),_0x1f13('0x61'));var _0x26ceda=ejs[_0x1f13('0x5b')](_0x4568bb,{'networks':_0x56dafa||[]});fs[_0x1f13('0x62')](_0x1f13('0x63'),_0x26ceda);return respondWithRpcPromise(_0x1f13('0x5d'),_0x1f13('0x33'),{'module':_0x1f13('0x5e')});}else{var _0xc1c1af=fs[_0x1f13('0x60')](path[_0x1f13('0x64')](config[_0x1f13('0x59')],'server/files/templates/network.ejs'),'utf8');var _0x2d006f=ejs[_0x1f13('0x5b')](_0xc1c1af,{'networks':_0x56dafa||[]});fs['writeFileSync'](util[_0x1f13('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x3fd071[_0x1f13('0x66')][_0x1f13('0x3b')]['toLowerCase']()),_0x2d006f);return respondWithRpcPromise(_0x1f13('0x5d'),_0x1f13('0x33'),{'module':_0x1f13('0x68')});}return null;})[_0x1f13('0x27')](handleError(_0x4fdc14,null));}; \ No newline at end of file +var _0x7c8e=['attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','keys','length','includeAll','find','catch','create','transaction','body','findAll','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','toUpperCase','server/files/templates/stun_multiple.ejs','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end','status','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','filters','intersection'];(function(_0x51d430,_0x77c484){var _0x1c0b0c=function(_0x435810){while(--_0x435810){_0x51d430['push'](_0x51d430['shift']());}};_0x1c0b0c(++_0x77c484);}(_0x7c8e,0x94));var _0xe7c8=function(_0x4ae898,_0x124bdc){_0x4ae898=_0x4ae898-0x0;var _0x5bcf48=_0x7c8e[_0x4ae898];return _0x5bcf48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7c8('0x0'));var jsonpatch=require(_0xe7c8('0x1'));var rp=require(_0xe7c8('0x2'));var moment=require(_0xe7c8('0x3'));var BPromise=require(_0xe7c8('0x4'));var Mustache=require(_0xe7c8('0x5'));var util=require(_0xe7c8('0x6'));var path=require(_0xe7c8('0x7'));var sox=require(_0xe7c8('0x8'));var csv=require(_0xe7c8('0x9'));var ejs=require(_0xe7c8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7c8('0xb'));var squel=require(_0xe7c8('0xc'));var crypto=require(_0xe7c8('0xd'));var jsforce=require(_0xe7c8('0xe'));var deskjs=require(_0xe7c8('0xf'));var toCsv=require(_0xe7c8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7c8('0x10'));var qs=require(_0xe7c8('0x11'));var as=require(_0xe7c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe7c8('0x13'));var utils=require(_0xe7c8('0x14'));var config=require(_0xe7c8('0x15'));var licenseUtil=require(_0xe7c8('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe7c8('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c582d,_0x379b6c,_0x7de8fd,_0x55268c){return new BPromise(function(_0x1c257b,_0x21633b){var _0x449850=_0x55268c||client;return _0x449850[_0xe7c8('0x18')](_0x1c582d,_0x7de8fd)[_0xe7c8('0x19')](function(_0x478549){logger[_0xe7c8('0x1a')](_0xe7c8('0x1b'),_0x379b6c,_0xe7c8('0x1c'));logger[_0xe7c8('0x1d')](_0xe7c8('0x1e'),_0x379b6c,'request\x20sent',JSON[_0xe7c8('0x1f')](_0x478549));if(_0x478549[_0xe7c8('0x20')]){if(_0x478549[_0xe7c8('0x20')]['code']===0x1f4){logger[_0xe7c8('0x20')](_0xe7c8('0x1b'),_0x379b6c,_0x478549[_0xe7c8('0x20')][_0xe7c8('0x21')]);return _0x21633b(_0x478549['error'][_0xe7c8('0x21')]);}logger[_0xe7c8('0x20')](_0xe7c8('0x1b'),_0x379b6c,_0x478549[_0xe7c8('0x20')][_0xe7c8('0x21')]);return _0x1c257b(_0x478549[_0xe7c8('0x20')]['message']);}else{logger[_0xe7c8('0x1a')]('Network,\x20%s,\x20%s',_0x379b6c,'request\x20sent');_0x1c257b(_0x478549[_0xe7c8('0x22')]['message']);}})['catch'](function(_0x12ccb){logger[_0xe7c8('0x20')](_0xe7c8('0x1b'),_0x379b6c,_0x12ccb);_0x21633b(_0x12ccb);});});}function respondWithStatusCode(_0x2dbfe5,_0x5b99b3){_0x5b99b3=_0x5b99b3||0xcc;return function(_0x5cc0e3){if(_0x5cc0e3){return _0x2dbfe5['sendStatus'](_0x5b99b3);}return _0x2dbfe5['status'](_0x5b99b3)[_0xe7c8('0x23')]();};}function respondWithResult(_0x18b651,_0x46b9da){_0x46b9da=_0x46b9da||0xc8;return function(_0x485f08){if(_0x485f08){return _0x18b651[_0xe7c8('0x24')](_0x46b9da)['json'](_0x485f08);}};}function respondWithFilteredResult(_0x54d2bd,_0x580705){return function(_0x10f5a3){if(_0x10f5a3){var _0x443a4f=typeof _0x580705[_0xe7c8('0x25')]===_0xe7c8('0x26')&&typeof _0x580705[_0xe7c8('0x27')]===_0xe7c8('0x26');var _0x50813a=_0x10f5a3[_0xe7c8('0x28')];var _0x4dd8b9=_0x443a4f?0x0:_0x580705[_0xe7c8('0x25')];var _0x432019=_0x443a4f?_0x10f5a3['count']:_0x580705[_0xe7c8('0x25')]+_0x580705[_0xe7c8('0x27')];var _0x9e681a;if(_0x432019>=_0x50813a){_0x432019=_0x50813a;_0x9e681a=0xc8;}else{_0x9e681a=0xce;}_0x54d2bd[_0xe7c8('0x24')](_0x9e681a);return _0x54d2bd[_0xe7c8('0x29')]('Content-Range',_0x4dd8b9+'-'+_0x432019+'/'+_0x50813a)['json'](_0x10f5a3);}return null;};}function patchUpdates(_0x3b68ed){return function(_0x18f2a4){try{jsonpatch[_0xe7c8('0x2a')](_0x18f2a4,_0x3b68ed,!![]);}catch(_0x5ae038){return BPromise[_0xe7c8('0x2b')](_0x5ae038);}return _0x18f2a4[_0xe7c8('0x2c')]();};}function saveUpdates(_0x2a78ab,_0xf0c733){return function(_0x2c9a63){if(_0x2c9a63){return _0x2c9a63[_0xe7c8('0x2d')](_0x2a78ab)['then'](function(_0x5c5896){return _0x5c5896;});}return null;};}function removeEntity(_0x508f88,_0x334660){return function(_0x4d513c){if(_0x4d513c){return _0x4d513c[_0xe7c8('0x2e')]()[_0xe7c8('0x19')](function(){_0x508f88[_0xe7c8('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e7f28,_0x86ee38){return function(_0x370435){if(!_0x370435){_0x2e7f28['sendStatus'](0x194);}return _0x370435;};}function handleError(_0x54240e,_0x632a2e){_0x632a2e=_0x632a2e||0x1f4;return function(_0x2f28d1){logger['error'](_0x2f28d1[_0xe7c8('0x2f')]);if(_0x2f28d1[_0xe7c8('0x30')]){delete _0x2f28d1[_0xe7c8('0x30')];}_0x54240e[_0xe7c8('0x24')](_0x632a2e)[_0xe7c8('0x31')](_0x2f28d1);};}exports[_0xe7c8('0x32')]=function(_0x37b54b,_0x34b68f){var _0x3b1d5c={},_0x15150c={},_0x39dcb5={'count':0x0,'rows':[]};var _0x4c1eb5=_[_0xe7c8('0x33')](db[_0xe7c8('0x34')][_0xe7c8('0x35')],function(_0x75714a){return{'name':_0x75714a['fieldName'],'type':_0x75714a[_0xe7c8('0x36')][_0xe7c8('0x37')]};});_0x15150c[_0xe7c8('0x38')]=_[_0xe7c8('0x33')](_0x4c1eb5,'name');_0x15150c[_0xe7c8('0x39')]=_['keys'](_0x37b54b['query']);_0x15150c[_0xe7c8('0x3a')]=_[_0xe7c8('0x3b')](_0x15150c[_0xe7c8('0x38')],_0x15150c[_0xe7c8('0x39')]);_0x3b1d5c[_0xe7c8('0x3c')]=_[_0xe7c8('0x3b')](_0x15150c[_0xe7c8('0x38')],qs[_0xe7c8('0x3d')](_0x37b54b['query']['fields']));_0x3b1d5c[_0xe7c8('0x3c')]=_0x3b1d5c['attributes']['length']?_0x3b1d5c[_0xe7c8('0x3c')]:_0x15150c[_0xe7c8('0x38')];if(!_0x37b54b[_0xe7c8('0x39')][_0xe7c8('0x3e')]('nolimit')){_0x3b1d5c[_0xe7c8('0x27')]=qs['limit'](_0x37b54b[_0xe7c8('0x39')]['limit']);_0x3b1d5c[_0xe7c8('0x25')]=qs['offset'](_0x37b54b[_0xe7c8('0x39')]['offset']);}_0x3b1d5c[_0xe7c8('0x3f')]=qs[_0xe7c8('0x40')](_0x37b54b[_0xe7c8('0x39')]['sort']);_0x3b1d5c[_0xe7c8('0x41')]=qs[_0xe7c8('0x3a')](_[_0xe7c8('0x42')](_0x37b54b['query'],_0x15150c['filters']),_0x4c1eb5);if(_0x37b54b[_0xe7c8('0x39')][_0xe7c8('0x43')]){_0x3b1d5c[_0xe7c8('0x41')]=_[_0xe7c8('0x44')](_0x3b1d5c[_0xe7c8('0x41')],{'$or':_[_0xe7c8('0x33')](_0x4c1eb5,function(_0x3a2ed6){if(_0x3a2ed6[_0xe7c8('0x36')]!==_0xe7c8('0x45')){var _0x3236d6={};_0x3236d6[_0x3a2ed6[_0xe7c8('0x30')]]={'$like':'%'+_0x37b54b[_0xe7c8('0x39')][_0xe7c8('0x43')]+'%'};return _0x3236d6;}})});}_0x3b1d5c=_[_0xe7c8('0x44')]({},_0x3b1d5c,_0x37b54b[_0xe7c8('0x46')]);var _0x1fce76={'where':_0x3b1d5c['where']};return db[_0xe7c8('0x34')][_0xe7c8('0x28')](_0x1fce76)[_0xe7c8('0x19')](function(_0x595c2c){_0x39dcb5[_0xe7c8('0x28')]=_0x595c2c;if(_0x37b54b[_0xe7c8('0x39')]['includeAll']){_0x3b1d5c[_0xe7c8('0x47')]=[{'all':!![]}];}return db[_0xe7c8('0x34')]['findAll'](_0x3b1d5c);})['then'](function(_0xccf223){_0x39dcb5['rows']=_0xccf223;return _0x39dcb5;})[_0xe7c8('0x19')](respondWithFilteredResult(_0x34b68f,_0x3b1d5c))['catch'](handleError(_0x34b68f,null));};exports[_0xe7c8('0x48')]=function(_0x1a3281,_0x4a35b2){var _0x28d327={'raw':!![],'where':{'id':_0x1a3281[_0xe7c8('0x49')]['id']}},_0x584788={};_0x584788[_0xe7c8('0x38')]=_[_0xe7c8('0x4a')](db[_0xe7c8('0x34')][_0xe7c8('0x35')]);_0x584788[_0xe7c8('0x39')]=_['keys'](_0x1a3281[_0xe7c8('0x39')]);_0x584788['filters']=_[_0xe7c8('0x3b')](_0x584788['model'],_0x584788[_0xe7c8('0x39')]);_0x28d327[_0xe7c8('0x3c')]=_[_0xe7c8('0x3b')](_0x584788[_0xe7c8('0x38')],qs[_0xe7c8('0x3d')](_0x1a3281[_0xe7c8('0x39')]['fields']));_0x28d327[_0xe7c8('0x3c')]=_0x28d327['attributes'][_0xe7c8('0x4b')]?_0x28d327[_0xe7c8('0x3c')]:_0x584788[_0xe7c8('0x38')];if(_0x1a3281[_0xe7c8('0x39')][_0xe7c8('0x4c')]){_0x28d327[_0xe7c8('0x47')]=[{'all':!![]}];}_0x28d327=_[_0xe7c8('0x44')]({},_0x28d327,_0x1a3281[_0xe7c8('0x46')]);return db[_0xe7c8('0x34')][_0xe7c8('0x4d')](_0x28d327)[_0xe7c8('0x19')](handleEntityNotFound(_0x4a35b2,null))[_0xe7c8('0x19')](respondWithResult(_0x4a35b2,null))[_0xe7c8('0x4e')](handleError(_0x4a35b2,null));};exports[_0xe7c8('0x4f')]=function(_0x4c4e22,_0x4eb287,_0x173f80){var _0x44a6ef;return db['sequelize'][_0xe7c8('0x50')](function(_0x3edf54){return db['Network'][_0xe7c8('0x4f')](_0x4c4e22[_0xe7c8('0x51')],{'raw':!![]})[_0xe7c8('0x19')](function(_0x2ca41a){_0x44a6ef=_0x2ca41a;return db[_0xe7c8('0x34')][_0xe7c8('0x52')]({'where':{'type':_0x4c4e22['body'][_0xe7c8('0x36')]},'raw':!![]});})['then'](function(_0x3540bf){if(_0x44a6ef[_0xe7c8('0x36')]['toUpperCase']()==_0xe7c8('0x53')){var _0x535df7=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],'server/files/templates/stun_multiple.ejs'),_0xe7c8('0x57'));var _0x5f37b4=ejs[_0xe7c8('0x58')](_0x535df7,{'networks':_0x3540bf||[]});fs[_0xe7c8('0x59')](_0xe7c8('0x5a'),_0x5f37b4);return respondWithRpcPromise('Reload',_0xe7c8('0x4f'),{'module':'res_stun_monitor.so'});}else if(_0x44a6ef[_0xe7c8('0x36')]['toUpperCase']()==_0xe7c8('0x5b')){var _0x5a84a6=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],_0xe7c8('0x5c')),'utf8');var _0x41d2a2=ejs[_0xe7c8('0x58')](_0x5a84a6,{'networks':_0x3540bf||[]});fs[_0xe7c8('0x59')](_0xe7c8('0x5d'),_0x41d2a2);return respondWithRpcPromise(_0xe7c8('0x5e'),'create',{'module':_0xe7c8('0x5f')});}else{var _0x5a9314=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],_0xe7c8('0x60')),_0xe7c8('0x57'));var _0x33f13d=ejs[_0xe7c8('0x58')](_0x5a9314,{'networks':_0x3540bf||[]});fs[_0xe7c8('0x59')](util[_0xe7c8('0x61')](_0xe7c8('0x62'),_0x4c4e22[_0xe7c8('0x51')][_0xe7c8('0x36')][_0xe7c8('0x63')]()),_0x33f13d);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x4f'),{'module':_0xe7c8('0x64')});}return null;})['then'](function(){return _0x44a6ef;});})[_0xe7c8('0x19')](respondWithResult(_0x4eb287,0xc9))[_0xe7c8('0x4e')](handleError(_0x4eb287,null));};exports[_0xe7c8('0x2d')]=function(_0x19c31e,_0x2b0638,_0xd48467){var _0x3e1183;return db[_0xe7c8('0x65')][_0xe7c8('0x50')](function(_0x46823c){return db[_0xe7c8('0x34')][_0xe7c8('0x4d')]({'where':{'id':_0x19c31e['params']['id']}})['then'](handleEntityNotFound(_0x2b0638,null))['then'](saveUpdates(_0x19c31e[_0xe7c8('0x51')],null))[_0xe7c8('0x19')](function(_0x56d435){if(_0x56d435){_0x3e1183=_0x56d435;return db[_0xe7c8('0x34')][_0xe7c8('0x52')]({'where':{'type':_0x3e1183[_0xe7c8('0x36')]},'raw':!![]});}return null;})['then'](function(_0x5db76a){if(_0x3e1183['type'][_0xe7c8('0x66')]()==_0xe7c8('0x53')){var _0x175e5b=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config['root'],_0xe7c8('0x67')),'utf8');var _0x449663=ejs[_0xe7c8('0x58')](_0x175e5b,{'networks':_0x5db76a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x449663);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x2d'),{'module':_0xe7c8('0x5f')});}else if(_0x3e1183['type'][_0xe7c8('0x66')]()==_0xe7c8('0x5b')){var _0x4cca70=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],'server/files/templates/turn_multiple.ejs'),_0xe7c8('0x57'));var _0x2f33c2=ejs[_0xe7c8('0x58')](_0x4cca70,{'networks':_0x5db76a||[]});fs[_0xe7c8('0x59')]('/etc/asterisk/turn_xcally.conf',_0x2f33c2);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x2d'),{'module':_0xe7c8('0x5f')});}else{var _0x1eafd9=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config['root'],_0xe7c8('0x60')),'utf8');var _0x222f44=ejs[_0xe7c8('0x58')](_0x1eafd9,{'networks':_0x5db76a||[]});fs[_0xe7c8('0x59')](util[_0xe7c8('0x61')](_0xe7c8('0x62'),_0x19c31e['body'][_0xe7c8('0x36')]['toLowerCase']()),_0x222f44);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x2d'),{'module':_0xe7c8('0x64')});}return null;})[_0xe7c8('0x19')](function(_0x4db6d7){if(_0x4db6d7){return _0x3e1183;}return null;});})[_0xe7c8('0x19')](respondWithResult(_0x2b0638,null))[_0xe7c8('0x4e')](handleError(_0x2b0638,null));};exports[_0xe7c8('0x2e')]=function(_0x1dec76,_0x2ad04b,_0x4013a1){var _0x225651;return db[_0xe7c8('0x34')][_0xe7c8('0x4d')]({'where':{'id':_0x1dec76[_0xe7c8('0x49')]['id']}})['then'](function(_0x44566f){_0x225651=_0x44566f;return _0x44566f;})['then'](handleEntityNotFound(_0x2ad04b,null))['then'](removeEntity(_0x2ad04b,null))[_0xe7c8('0x19')](function(){if(_0x225651){return db[_0xe7c8('0x34')][_0xe7c8('0x52')]({'where':{'type':_0x225651[_0xe7c8('0x36')]},'raw':!![]});}})[_0xe7c8('0x19')](function(_0x202e0f){if(_0x225651[_0xe7c8('0x36')][_0xe7c8('0x66')]()=='STUN'){var _0x4e40b7=fs['readFileSync'](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],_0xe7c8('0x67')),'utf8');var _0xc268b5=ejs[_0xe7c8('0x58')](_0x4e40b7,{'networks':_0x202e0f||[]});fs[_0xe7c8('0x59')]('/etc/asterisk/stun_xcally.conf',_0xc268b5);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x2e'),{'module':_0xe7c8('0x5f')});}else if(_0x225651['type'][_0xe7c8('0x66')]()==_0xe7c8('0x5b')){var _0x503b37=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],_0xe7c8('0x5c')),_0xe7c8('0x57'));var _0x95d767=ejs[_0xe7c8('0x58')](_0x503b37,{'networks':_0x202e0f||[]});fs[_0xe7c8('0x59')](_0xe7c8('0x5d'),_0x95d767);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0x3cc1c8=fs[_0xe7c8('0x54')](path[_0xe7c8('0x55')](config[_0xe7c8('0x56')],_0xe7c8('0x60')),_0xe7c8('0x57'));var _0x1d3727=ejs[_0xe7c8('0x58')](_0x3cc1c8,{'networks':_0x202e0f||[]});fs[_0xe7c8('0x59')](util[_0xe7c8('0x61')](_0xe7c8('0x62'),_0x1dec76['body'][_0xe7c8('0x36')][_0xe7c8('0x63')]()),_0x1d3727);return respondWithRpcPromise(_0xe7c8('0x5e'),_0xe7c8('0x2e'),{'module':_0xe7c8('0x64')});}return null;})[_0xe7c8('0x4e')](handleError(_0x2ad04b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5c64720..c643677 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 _0xe130=['api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','define','lodash','util'];(function(_0xc426da,_0x4a3a0a){var _0x1703af=function(_0x14b475){while(--_0x14b475){_0xc426da['push'](_0xc426da['shift']());}};_0x1703af(++_0x4a3a0a);}(_0xe130,0x127));var _0x0e13=function(_0x4cc4d0,_0x104bdb){_0x4cc4d0=_0x4cc4d0-0x0;var _0x408c64=_0xe130[_0x4cc4d0];return _0x408c64;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var logger=require('../../config/logger')(_0x0e13('0x2'));var moment=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var rp=require(_0x0e13('0x5'));var fs=require('fs');var path=require(_0x0e13('0x6'));var rimraf=require('rimraf');var config=require(_0x0e13('0x7'));var attributes=require(_0x0e13('0x8'));module[_0x0e13('0x9')]=function(_0xcd92e,_0x50a80e){return _0xcd92e[_0x0e13('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./network.attributes'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xd547,0x1c1));var _0x7d54=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0xd547[_0x48fb10];return _0x534251;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('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 994a31f..6673b68 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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x5a2579,_0x13a6c4){_0x5a2579=_0x5a2579-0x0;var _0x471b95=_0x7a54[_0x5a2579];return _0x471b95;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x30ad0a,_0x5dc7be){_0x30ad0a=_0x30ad0a-0x0;var _0x46eee7=_0x7a54[_0x30ad0a];return _0x46eee7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b5912c4..33d180d 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 _0x3daa=['isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','create','addAnswer','/:id/notify','notify','/:id/applications','addApplications','post','/:id/users','addAgents','/:id/send','put','update','/:id','destroy','removeDispositions','delete','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3daa,0x6d));var _0xa3da=function(_0x3975db,_0x22337c){_0x3975db=_0x3975db-0x0;var _0x2dfa6a=_0x3daa[_0x3975db];return _0x2dfa6a;};'use strict';var multer=require(_0xa3da('0x0'));var util=require(_0xa3da('0x1'));var path=require('path');var timeout=require(_0xa3da('0x2'));var express=require(_0xa3da('0x3'));var router=express[_0xa3da('0x4')]();var fs_extra=require(_0xa3da('0x5'));var auth=require(_0xa3da('0x6'));var interaction=require(_0xa3da('0x7'));var config=require(_0xa3da('0x8'));var controller=require(_0xa3da('0x9'));router[_0xa3da('0xa')]('/',auth[_0xa3da('0xb')](),controller[_0xa3da('0xc')]);router['get'](_0xa3da('0xd'),auth[_0xa3da('0xb')](),controller[_0xa3da('0xe')]);router[_0xa3da('0xa')]('/:id',auth[_0xa3da('0xb')](),controller[_0xa3da('0xf')]);router[_0xa3da('0xa')](_0xa3da('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa3da('0xa')](_0xa3da('0x11'),auth[_0xa3da('0xb')](),controller[_0xa3da('0x12')]);router[_0xa3da('0xa')]('/:id/applications',auth[_0xa3da('0xb')](),controller[_0xa3da('0x13')]);router[_0xa3da('0xa')](_0xa3da('0x14'),auth['isAuthenticated'](),controller[_0xa3da('0x15')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xa3da('0xb')](),controller[_0xa3da('0x16')]);router['post'](_0xa3da('0x10'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xa3da('0x11'),auth[_0xa3da('0xb')](),controller[_0xa3da('0x17')]);router['post'](_0xa3da('0x18'),controller[_0xa3da('0x19')]);router['post'](_0xa3da('0x1a'),auth['isAuthenticated'](),controller[_0xa3da('0x1b')]);router[_0xa3da('0x1c')](_0xa3da('0x1d'),auth['isAuthenticated'](),controller[_0xa3da('0x1e')]);router['post'](_0xa3da('0x1f'),auth[_0xa3da('0xb')](),controller['send']);router[_0xa3da('0x20')]('/:id',auth[_0xa3da('0xb')](),controller[_0xa3da('0x21')]);router['delete'](_0xa3da('0x22'),auth[_0xa3da('0xb')](),controller[_0xa3da('0x23')]);router['delete'](_0xa3da('0x10'),auth[_0xa3da('0xb')](),controller[_0xa3da('0x24')]);router[_0xa3da('0x25')](_0xa3da('0x11'),auth[_0xa3da('0xb')](),controller[_0xa3da('0x26')]);router[_0xa3da('0x25')](_0xa3da('0x1d'),auth[_0xa3da('0xb')](),controller['removeAgents']);module[_0xa3da('0x27')]=router; \ No newline at end of file +var _0xdb49=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','send','update','/:id','removeDispositions','delete','removeAnswers','exports','multer'];(function(_0x553bc8,_0x481382){var _0xc45407=function(_0x1831ac){while(--_0x1831ac){_0x553bc8['push'](_0x553bc8['shift']());}};_0xc45407(++_0x481382);}(_0xdb49,0x1d3));var _0x9db4=function(_0x2034ce,_0x40a1c0){_0x2034ce=_0x2034ce-0x0;var _0x3fe785=_0xdb49[_0x2034ce];return _0x3fe785;};'use strict';var multer=require(_0x9db4('0x0'));var util=require(_0x9db4('0x1'));var path=require(_0x9db4('0x2'));var timeout=require(_0x9db4('0x3'));var express=require(_0x9db4('0x4'));var router=express[_0x9db4('0x5')]();var fs_extra=require(_0x9db4('0x6'));var auth=require(_0x9db4('0x7'));var interaction=require(_0x9db4('0x8'));var config=require(_0x9db4('0x9'));var controller=require(_0x9db4('0xa'));router[_0x9db4('0xb')]('/',auth[_0x9db4('0xc')](),controller[_0x9db4('0xd')]);router[_0x9db4('0xb')](_0x9db4('0xe'),auth[_0x9db4('0xc')](),controller[_0x9db4('0xf')]);router[_0x9db4('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9db4('0x10')]);router[_0x9db4('0xb')](_0x9db4('0x11'),auth[_0x9db4('0xc')](),controller['getDispositions']);router['get'](_0x9db4('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x9db4('0xb')]('/:id/applications',auth[_0x9db4('0xc')](),controller[_0x9db4('0x13')]);router[_0x9db4('0xb')]('/:id/interactions',auth[_0x9db4('0xc')](),controller['getInteractions']);router[_0x9db4('0xb')](_0x9db4('0x14'),auth[_0x9db4('0xc')](),controller[_0x9db4('0x15')]);router[_0x9db4('0x16')]('/',auth[_0x9db4('0xc')](),controller[_0x9db4('0x17')]);router[_0x9db4('0x16')](_0x9db4('0x11'),auth[_0x9db4('0xc')](),controller[_0x9db4('0x18')]);router[_0x9db4('0x16')]('/:id/canned_answers',auth[_0x9db4('0xc')](),controller[_0x9db4('0x19')]);router[_0x9db4('0x16')](_0x9db4('0x1a'),controller['notify']);router[_0x9db4('0x16')](_0x9db4('0x1b'),auth[_0x9db4('0xc')](),controller[_0x9db4('0x1c')]);router[_0x9db4('0x16')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x9db4('0x1d')]);router['put']('/:id',auth[_0x9db4('0xc')](),controller[_0x9db4('0x1e')]);router['delete'](_0x9db4('0x1f'),auth[_0x9db4('0xc')](),controller['destroy']);router['delete'](_0x9db4('0x11'),auth[_0x9db4('0xc')](),controller[_0x9db4('0x20')]);router[_0x9db4('0x21')]('/:id/canned_answers',auth[_0x9db4('0xc')](),controller[_0x9db4('0x22')]);router[_0x9db4('0x21')](_0x9db4('0x14'),auth[_0x9db4('0xc')](),controller['removeAgents']);module[_0x9db4('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 03baeda..20e379c 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 _0xb045=['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','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT'];(function(_0x220eb4,_0x5aa1ec){var _0x466657=function(_0x2c56fa){while(--_0x2c56fa){_0x220eb4['push'](_0x220eb4['shift']());}};_0x466657(++_0x5aa1ec);}(_0xb045,0xba));var _0x5b04=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0xb045[_0xa522f];return _0x2083b0;};'use strict';var Sequelize=require(_0x5b04('0x0'));var rs=require(_0x5b04('0x1'));module[_0x5b04('0x2')]={'name':{'type':Sequelize[_0x5b04('0x3')],'unique':_0x5b04('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5b04('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5b04('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5b04('0x5')],'defaultValue':function(){return _0x5b04('0x6');}},'notificationSound':{'type':Sequelize[_0x5b04('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5b04('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5b04('0x3')]},'queueTransfer':{'type':Sequelize[_0x5b04('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b04('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b04('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b04('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b04('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x5b04('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x5b04('0x7')],'defaultValue':![],'comment':_0x5b04('0xa'),'set':function(_0x502b18){if(!_0x502b18)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5b04('0xb'),_0x502b18);}}}; \ No newline at end of file +var _0x5928=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN'];(function(_0x117a9a,_0x3ec68f){var _0x8c3399=function(_0x427f29){while(--_0x427f29){_0x117a9a['push'](_0x117a9a['shift']());}};_0x8c3399(++_0x3ec68f);}(_0x5928,0xe8));var _0x8592=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5928[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8592('0x0'));var rs=require('randomstring');module[_0x8592('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8592('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8592('0x3')]},'token':{'type':Sequelize[_0x8592('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x8592('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8592('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8592('0x4')],'defaultValue':function(){return _0x8592('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8592('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8592('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8592('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8592('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8592('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8592('0x7')],'defaultValue':![],'comment':_0x8592('0x8'),'set':function(_0x717962){if(!_0x717962)this[_0x8592('0x9')](_0x8592('0xa'),null);this['setDataValue'](_0x8592('0xb'),_0x717962);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f297d56..04a7dce 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 _0xd029=['request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','OpenchannelAccounts','UserProfileSection','userProfileId','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','OpenchannelApplication','account','Applications','list','orderBy','applications','priority','asc','Contacts','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','EventManager','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','ListId','out','Messages','dataValues','push','rimraf','fast-json-patch'];(function(_0x1da72c,_0x15d2e9){var _0x58d9e7=function(_0x1487e3){while(--_0x1487e3){_0x1da72c['push'](_0x1da72c['shift']());}};_0x58d9e7(++_0x15d2e9);}(_0xd029,0x186));var _0x9d02=function(_0x58c48d,_0x1a2ce1){_0x58c48d=_0x58c48d-0x0;var _0x451050=_0xd029[_0x58c48d];return _0x451050;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d02('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d02('0x1'));var rp=require(_0x9d02('0x2'));var moment=require(_0x9d02('0x3'));var BPromise=require(_0x9d02('0x4'));var Mustache=require('mustache');var util=require(_0x9d02('0x5'));var path=require(_0x9d02('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d02('0x7'));var _=require(_0x9d02('0x8'));var squel=require(_0x9d02('0x9'));var crypto=require(_0x9d02('0xa'));var jsforce=require(_0x9d02('0xb'));var deskjs=require(_0x9d02('0xc'));var toCsv=require(_0x9d02('0xd'));var querystring=require(_0x9d02('0xe'));var Papa=require(_0x9d02('0xf'));var Redis=require(_0x9d02('0x10'));var authService=require(_0x9d02('0x11'));var qs=require(_0x9d02('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d02('0x13'));var logger=require('../../config/logger')(_0x9d02('0x14'));var utils=require(_0x9d02('0x15'));var config=require(_0x9d02('0x16'));var licenseUtil=require(_0x9d02('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9d02('0x18')](config[_0x9d02('0x19')],{'host':_0x9d02('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9d02('0x1b'))[_0x9d02('0x1c')](socket);var jayson=require(_0x9d02('0x1d'));var client=jayson[_0x9d02('0x1e')][_0x9d02('0x1f')]({'port':0x232c});var client9002=jayson[_0x9d02('0x1e')][_0x9d02('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3bb488,_0x2f4d02,_0x910c39,_0x519f3b){return new BPromise(function(_0x4c8ae6,_0x239da9){var _0x51ec91=_0x519f3b||client;return _0x51ec91[_0x9d02('0x20')](_0x3bb488,_0x910c39)['then'](function(_0x368d86){logger[_0x9d02('0x21')](_0x9d02('0x22'),_0x2f4d02,'request\x20sent');logger[_0x9d02('0x23')](_0x9d02('0x24'),_0x2f4d02,'request\x20sent',JSON[_0x9d02('0x25')](_0x368d86));if(_0x368d86[_0x9d02('0x26')]){if(_0x368d86['error']['code']===0x1f4){logger[_0x9d02('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f4d02,_0x368d86[_0x9d02('0x26')]['message']);return _0x239da9(_0x368d86[_0x9d02('0x26')][_0x9d02('0x27')]);}logger['error'](_0x9d02('0x22'),_0x2f4d02,_0x368d86['error'][_0x9d02('0x27')]);return _0x4c8ae6(_0x368d86[_0x9d02('0x26')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2f4d02,_0x9d02('0x28'));_0x4c8ae6(_0x368d86[_0x9d02('0x29')][_0x9d02('0x27')]);}})['catch'](function(_0x3802e7){logger[_0x9d02('0x26')](_0x9d02('0x22'),_0x2f4d02,_0x3802e7);_0x239da9(_0x3802e7);});});}function respondWithStatusCode(_0x2b8e83,_0x3ad930){_0x3ad930=_0x3ad930||0xcc;return function(_0xecaa97){if(_0xecaa97){return _0x2b8e83[_0x9d02('0x2a')](_0x3ad930);}return _0x2b8e83[_0x9d02('0x2b')](_0x3ad930)[_0x9d02('0x2c')]();};}function respondWithResult(_0x5ef96a,_0x2d1f4c){_0x2d1f4c=_0x2d1f4c||0xc8;return function(_0x334b25){if(_0x334b25){return _0x5ef96a[_0x9d02('0x2b')](_0x2d1f4c)['json'](_0x334b25);}};}function respondWithFilteredResult(_0x1a0420,_0x5218ed){return function(_0x26bf79){if(_0x26bf79){var _0x2167cd=typeof _0x5218ed['offset']==='undefined'&&typeof _0x5218ed[_0x9d02('0x2d')]===_0x9d02('0x2e');var _0x5d7422=_0x26bf79[_0x9d02('0x2f')];var _0x5695ec=_0x2167cd?0x0:_0x5218ed[_0x9d02('0x30')];var _0x15521e=_0x2167cd?_0x26bf79[_0x9d02('0x2f')]:_0x5218ed[_0x9d02('0x30')]+_0x5218ed['limit'];var _0x258053;if(_0x15521e>=_0x5d7422){_0x15521e=_0x5d7422;_0x258053=0xc8;}else{_0x258053=0xce;}_0x1a0420['status'](_0x258053);return _0x1a0420['set'](_0x9d02('0x31'),_0x5695ec+'-'+_0x15521e+'/'+_0x5d7422)[_0x9d02('0x32')](_0x26bf79);}return null;};}function patchUpdates(_0x392eda){return function(_0x108407){try{jsonpatch[_0x9d02('0x33')](_0x108407,_0x392eda,!![]);}catch(_0x4fd758){return BPromise[_0x9d02('0x34')](_0x4fd758);}return _0x108407[_0x9d02('0x35')]();};}function saveUpdates(_0x41170f,_0x37a988){return function(_0x4468bb){if(_0x4468bb){return _0x4468bb[_0x9d02('0x36')](_0x41170f)[_0x9d02('0x37')](function(_0x1ca6ef){return _0x1ca6ef;});}return null;};}function removeEntity(_0x525369,_0x2c2a76){return function(_0x311bbd){if(_0x311bbd){return _0x311bbd[_0x9d02('0x38')]()[_0x9d02('0x37')](function(){var _0x1bda08=_0x311bbd['get']({'plain':!![]});var _0x4775f5='OpenchannelAccounts';return db[_0x9d02('0x39')][_0x9d02('0x38')]({'where':{'type':_0x4775f5,'resourceId':_0x1bda08['id']}})[_0x9d02('0x37')](function(){return _0x311bbd;});})[_0x9d02('0x37')](function(){_0x525369[_0x9d02('0x2b')](0xcc)[_0x9d02('0x2c')]();});}};}function handleEntityNotFound(_0x2e6924,_0x2b0a7c){return function(_0x14597c){if(!_0x14597c){_0x2e6924[_0x9d02('0x2a')](0x194);}return _0x14597c;};}function handleError(_0x2d4b3d,_0x524dd8){_0x524dd8=_0x524dd8||0x1f4;return function(_0x142967){logger['error'](_0x142967[_0x9d02('0x3a')]);if(_0x142967[_0x9d02('0x3b')]){delete _0x142967[_0x9d02('0x3b')];}_0x2d4b3d[_0x9d02('0x2b')](_0x524dd8)['send'](_0x142967);};}exports['index']=function(_0x59854d,_0x4c9c4f){var _0x3ccda9={'include':[{'model':db[_0x9d02('0x3c')],'as':_0x9d02('0x3d')}]},_0x5a93ef={},_0x596975={'count':0x0,'rows':[]};var _0x4891be=_[_0x9d02('0x3e')](db[_0x9d02('0x3f')][_0x9d02('0x40')],function(_0xa2af25){return{'name':_0xa2af25[_0x9d02('0x41')],'type':_0xa2af25[_0x9d02('0x42')][_0x9d02('0x43')]};});_0x5a93ef[_0x9d02('0x44')]=_[_0x9d02('0x3e')](_0x4891be,_0x9d02('0x3b'));_0x5a93ef['query']=_['keys'](_0x59854d[_0x9d02('0x45')]);_0x5a93ef[_0x9d02('0x46')]=_[_0x9d02('0x47')](_0x5a93ef['model'],_0x5a93ef[_0x9d02('0x45')]);_0x3ccda9[_0x9d02('0x48')]=_['intersection'](_0x5a93ef[_0x9d02('0x44')],qs['fields'](_0x59854d[_0x9d02('0x45')][_0x9d02('0x49')]));_0x3ccda9['attributes']=_0x3ccda9['attributes'][_0x9d02('0x4a')]?_0x3ccda9['attributes']:_0x5a93ef[_0x9d02('0x44')];if(!_0x59854d[_0x9d02('0x45')][_0x9d02('0x4b')](_0x9d02('0x4c'))){_0x3ccda9[_0x9d02('0x2d')]=qs[_0x9d02('0x2d')](_0x59854d[_0x9d02('0x45')]['limit']);_0x3ccda9['offset']=qs[_0x9d02('0x30')](_0x59854d[_0x9d02('0x45')]['offset']);}_0x3ccda9[_0x9d02('0x4d')]=qs[_0x9d02('0x4e')](_0x59854d[_0x9d02('0x45')]['sort']);_0x3ccda9[_0x9d02('0x4f')]=qs[_0x9d02('0x46')](_[_0x9d02('0x50')](_0x59854d[_0x9d02('0x45')],_0x5a93ef['filters']),_0x4891be);if(_0x59854d[_0x9d02('0x45')][_0x9d02('0x51')]){_0x3ccda9[_0x9d02('0x4f')]=_[_0x9d02('0x52')](_0x3ccda9[_0x9d02('0x4f')],{'$or':_[_0x9d02('0x3e')](_0x4891be,function(_0x297d3e){if(_0x297d3e[_0x9d02('0x42')]!==_0x9d02('0x53')){var _0x51370f={};_0x51370f[_0x297d3e['name']]={'$like':'%'+_0x59854d[_0x9d02('0x45')][_0x9d02('0x51')]+'%'};return _0x51370f;}})});}_0x3ccda9=_[_0x9d02('0x52')]({},_0x3ccda9,_0x59854d[_0x9d02('0x54')]);var _0x233f10={'where':_0x3ccda9[_0x9d02('0x4f')]};return db['OpenchannelAccount']['count'](_0x233f10)[_0x9d02('0x37')](function(_0x2b8ac2){_0x596975['count']=_0x2b8ac2;if(_0x59854d[_0x9d02('0x45')][_0x9d02('0x55')]){_0x3ccda9[_0x9d02('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x3ccda9);})[_0x9d02('0x37')](function(_0x41855e){_0x596975[_0x9d02('0x57')]=_0x41855e;return _0x596975;})[_0x9d02('0x37')](respondWithFilteredResult(_0x4c9c4f,_0x3ccda9))[_0x9d02('0x58')](handleError(_0x4c9c4f,null));};exports[_0x9d02('0x59')]=function(_0x5ca8d9,_0x3e2426){var _0x1edfbd={'raw':![],'where':{'id':_0x5ca8d9[_0x9d02('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x9d02('0x3d')}]},_0x39c49e={};_0x39c49e[_0x9d02('0x44')]=_[_0x9d02('0x5b')](db['OpenchannelAccount'][_0x9d02('0x40')]);_0x39c49e['query']=_['keys'](_0x5ca8d9[_0x9d02('0x45')]);_0x39c49e[_0x9d02('0x46')]=_[_0x9d02('0x47')](_0x39c49e[_0x9d02('0x44')],_0x39c49e[_0x9d02('0x45')]);_0x1edfbd[_0x9d02('0x48')]=_['intersection'](_0x39c49e[_0x9d02('0x44')],qs[_0x9d02('0x49')](_0x5ca8d9[_0x9d02('0x45')]['fields']));_0x1edfbd[_0x9d02('0x48')]=_0x1edfbd[_0x9d02('0x48')]['length']?_0x1edfbd['attributes']:_0x39c49e[_0x9d02('0x44')];if(_0x5ca8d9['query'][_0x9d02('0x55')]){_0x1edfbd[_0x9d02('0x56')]=[{'all':!![]}];}_0x1edfbd=_[_0x9d02('0x52')]({},_0x1edfbd,_0x5ca8d9[_0x9d02('0x54')]);return db[_0x9d02('0x3f')][_0x9d02('0x5c')](_0x1edfbd)['then'](handleEntityNotFound(_0x3e2426,null))['then'](respondWithResult(_0x3e2426,null))[_0x9d02('0x58')](handleError(_0x3e2426,null));};exports['create']=function(_0x4664d0,_0x1ef345){return db[_0x9d02('0x3f')][_0x9d02('0x5d')](_0x4664d0[_0x9d02('0x5e')],{})[_0x9d02('0x37')](function(_0x9db366){var _0xc3d1bb=_0x4664d0[_0x9d02('0x5f')]['get']({'plain':!![]});if(!_0xc3d1bb)throw new Error(_0x9d02('0x60'));if(_0xc3d1bb['role']==='user'){var _0x50b537=_0x9db366[_0x9d02('0x61')]({'plain':!![]});var _0x47b2ba=_0x9d02('0x62');return db[_0x9d02('0x63')][_0x9d02('0x5c')]({'where':{'name':_0x47b2ba,'userProfileId':_0xc3d1bb[_0x9d02('0x64')]},'raw':!![]})[_0x9d02('0x37')](function(_0x2222e3){if(_0x2222e3&&_0x2222e3['autoAssociation']===0x0){return db['UserProfileResource'][_0x9d02('0x5d')]({'name':_0x50b537[_0x9d02('0x3b')],'resourceId':_0x50b537['id'],'type':_0x2222e3['name'],'sectionId':_0x2222e3['id']},{})[_0x9d02('0x37')](function(){return _0x9db366;});}else{return _0x9db366;}})['catch'](function(_0x2fb533){logger[_0x9d02('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fb533);throw _0x2fb533;});}return _0x9db366;})[_0x9d02('0x37')](respondWithResult(_0x1ef345,0xc9))[_0x9d02('0x58')](handleError(_0x1ef345,null));};exports[_0x9d02('0x36')]=function(_0x168d86,_0x2d2fbd){if(_0x168d86['body']['id']){delete _0x168d86[_0x9d02('0x5e')]['id'];}return db[_0x9d02('0x3f')][_0x9d02('0x5c')]({'where':{'id':_0x168d86[_0x9d02('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x9d02('0x3d')}]})[_0x9d02('0x37')](handleEntityNotFound(_0x2d2fbd,null))[_0x9d02('0x37')](saveUpdates(_0x168d86[_0x9d02('0x5e')],null))['then'](respondWithResult(_0x2d2fbd,null))[_0x9d02('0x58')](handleError(_0x2d2fbd,null));};exports[_0x9d02('0x38')]=function(_0x464b13,_0x14f3bd){return db[_0x9d02('0x3f')][_0x9d02('0x5c')]({'where':{'id':_0x464b13[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x14f3bd,null))[_0x9d02('0x37')](removeEntity(_0x14f3bd,null))[_0x9d02('0x58')](handleError(_0x14f3bd,null));};exports[_0x9d02('0x65')]=function(_0x5d2a4f,_0x50a823){return db[_0x9d02('0x3f')][_0x9d02('0x65')]()[_0x9d02('0x37')](respondWithResult(_0x50a823,null))[_0x9d02('0x58')](handleError(_0x50a823,null));};exports[_0x9d02('0x66')]=function(_0x4e7656,_0x144e40,_0x4d3ac1){if(_0x4e7656[_0x9d02('0x5e')]['id']){delete _0x4e7656[_0x9d02('0x5e')]['id'];}return db[_0x9d02('0x3f')][_0x9d02('0x5c')]({'where':{'id':_0x4e7656['params']['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x144e40,null))['then'](function(_0xfea942){if(_0xfea942){_0x4e7656[_0x9d02('0x5e')][_0x9d02('0x67')]=_0xfea942['id'];return db['Disposition'][_0x9d02('0x5d')](_0x4e7656[_0x9d02('0x5e')]);}})['then'](respondWithResult(_0x144e40,null))[_0x9d02('0x58')](handleError(_0x144e40,null));};exports['getDispositions']=function(_0x503c13,_0x258808,_0x2916e5){var _0xefccc6={'raw':![],'where':{}};var _0x4478c9={};var _0x56ffd2={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9d02('0x68')]({'where':{'id':_0x503c13[_0x9d02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x258808,null))['then'](function(_0x5871a9){if(_0x5871a9){_0x4478c9['model']=_[_0x9d02('0x5b')](db['Disposition'][_0x9d02('0x40')]);_0x4478c9[_0x9d02('0x45')]=_['keys'](_0x503c13['query']);_0x4478c9[_0x9d02('0x46')]=_['intersection'](_0x4478c9['model'],_0x4478c9[_0x9d02('0x45')]);_0xefccc6[_0x9d02('0x48')]=_['intersection'](_0x4478c9[_0x9d02('0x44')],qs[_0x9d02('0x49')](_0x503c13['query'][_0x9d02('0x49')]));_0xefccc6['attributes']=_0xefccc6[_0x9d02('0x48')]['length']?_0xefccc6['attributes']:_0x4478c9[_0x9d02('0x44')];if(!_0x503c13[_0x9d02('0x45')][_0x9d02('0x4b')](_0x9d02('0x4c'))){_0xefccc6[_0x9d02('0x2d')]=qs[_0x9d02('0x2d')](_0x503c13[_0x9d02('0x45')][_0x9d02('0x2d')]);_0xefccc6[_0x9d02('0x30')]=qs[_0x9d02('0x30')](_0x503c13[_0x9d02('0x45')][_0x9d02('0x30')]);}_0xefccc6['order']=qs[_0x9d02('0x4e')](_0x503c13['query'][_0x9d02('0x4e')]);_0xefccc6['where']=qs[_0x9d02('0x46')](_[_0x9d02('0x50')](_0x503c13[_0x9d02('0x45')],_0x4478c9[_0x9d02('0x46')]));_0xefccc6['where'][_0x9d02('0x67')]=_0x5871a9['id'];if(_0x503c13[_0x9d02('0x45')]['filter']){_0xefccc6[_0x9d02('0x4f')]=_[_0x9d02('0x52')](_0xefccc6[_0x9d02('0x4f')],{'$or':_[_0x9d02('0x3e')](_0xefccc6[_0x9d02('0x48')],function(_0x1018c8){var _0x59f1e0={};_0x59f1e0[_0x1018c8]={'$like':'%'+_0x503c13['query']['filter']+'%'};return _0x59f1e0;})});}_0xefccc6=_[_0x9d02('0x52')]({},_0xefccc6,_0x503c13[_0x9d02('0x54')]);return db[_0x9d02('0x69')]['count']({'where':_0xefccc6['where']})[_0x9d02('0x37')](function(_0x4fbb65){_0x56ffd2[_0x9d02('0x2f')]=_0x4fbb65;if(_0x503c13[_0x9d02('0x45')][_0x9d02('0x55')]){_0xefccc6['include']=[{'all':!![]}];}return db['Disposition'][_0x9d02('0x6a')](_0xefccc6);})[_0x9d02('0x37')](function(_0x2bf6c1){_0x56ffd2['rows']=_0x2bf6c1;return _0x56ffd2;});}})['then'](respondWithFilteredResult(_0x258808,_0xefccc6))[_0x9d02('0x58')](handleError(_0x258808,null));};exports[_0x9d02('0x6b')]=function(_0x415070,_0x2eb791,_0x17a122){return db[_0x9d02('0x3f')][_0x9d02('0x5c')]({'where':{'id':_0x415070['params']['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x2eb791,null))['then'](function(_0x950126){if(_0x950126){return _0x950126[_0x9d02('0x6b')](_0x415070[_0x9d02('0x45')][_0x9d02('0x6c')]);}})[_0x9d02('0x37')](respondWithStatusCode(_0x2eb791,null))[_0x9d02('0x58')](handleError(_0x2eb791,null));};exports[_0x9d02('0x6d')]=function(_0x2bc837,_0x528b60,_0x272db4){if(_0x2bc837[_0x9d02('0x5e')]['id']){delete _0x2bc837[_0x9d02('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2bc837[_0x9d02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x528b60,null))[_0x9d02('0x37')](function(_0x5d0100){if(_0x5d0100){_0x2bc837[_0x9d02('0x5e')]['OpenchannelAccountId']=_0x5d0100['id'];return db[_0x9d02('0x6e')][_0x9d02('0x5d')](_0x2bc837['body']);}})[_0x9d02('0x37')](respondWithResult(_0x528b60,null))[_0x9d02('0x58')](handleError(_0x528b60,null));};exports[_0x9d02('0x6f')]=function(_0x465bb1,_0x4c9540,_0xcc8978){var _0x8d0dae={'raw':![],'where':{}};var _0x339220={};var _0x1689ca={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x465bb1[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x4c9540,null))[_0x9d02('0x37')](function(_0x2ee660){if(_0x2ee660){_0x339220[_0x9d02('0x44')]=_['keys'](db[_0x9d02('0x6e')][_0x9d02('0x40')]);_0x339220[_0x9d02('0x45')]=_[_0x9d02('0x5b')](_0x465bb1[_0x9d02('0x45')]);_0x339220[_0x9d02('0x46')]=_[_0x9d02('0x47')](_0x339220['model'],_0x339220[_0x9d02('0x45')]);_0x8d0dae['attributes']=_[_0x9d02('0x47')](_0x339220[_0x9d02('0x44')],qs[_0x9d02('0x49')](_0x465bb1[_0x9d02('0x45')]['fields']));_0x8d0dae[_0x9d02('0x48')]=_0x8d0dae[_0x9d02('0x48')][_0x9d02('0x4a')]?_0x8d0dae[_0x9d02('0x48')]:_0x339220[_0x9d02('0x44')];if(!_0x465bb1[_0x9d02('0x45')][_0x9d02('0x4b')](_0x9d02('0x4c'))){_0x8d0dae[_0x9d02('0x2d')]=qs[_0x9d02('0x2d')](_0x465bb1[_0x9d02('0x45')]['limit']);_0x8d0dae['offset']=qs[_0x9d02('0x30')](_0x465bb1[_0x9d02('0x45')][_0x9d02('0x30')]);}_0x8d0dae[_0x9d02('0x4d')]=qs['sort'](_0x465bb1['query'][_0x9d02('0x4e')]);_0x8d0dae[_0x9d02('0x4f')]=qs[_0x9d02('0x46')](_[_0x9d02('0x50')](_0x465bb1[_0x9d02('0x45')],_0x339220[_0x9d02('0x46')]));_0x8d0dae[_0x9d02('0x4f')][_0x9d02('0x67')]=_0x2ee660['id'];if(_0x465bb1['query'][_0x9d02('0x51')]){_0x8d0dae['where']=_[_0x9d02('0x52')](_0x8d0dae[_0x9d02('0x4f')],{'$or':_[_0x9d02('0x3e')](_0x8d0dae['attributes'],function(_0x4a4458){var _0x47e46d={};_0x47e46d[_0x4a4458]={'$like':'%'+_0x465bb1['query'][_0x9d02('0x51')]+'%'};return _0x47e46d;})});}_0x8d0dae=_[_0x9d02('0x52')]({},_0x8d0dae,_0x465bb1[_0x9d02('0x54')]);return db[_0x9d02('0x6e')][_0x9d02('0x2f')]({'where':_0x8d0dae[_0x9d02('0x4f')]})['then'](function(_0x26b08c){_0x1689ca['count']=_0x26b08c;if(_0x465bb1['query'][_0x9d02('0x55')]){_0x8d0dae[_0x9d02('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9d02('0x6a')](_0x8d0dae);})[_0x9d02('0x37')](function(_0x4e87e3){_0x1689ca[_0x9d02('0x57')]=_0x4e87e3;return _0x1689ca;});}})['then'](respondWithFilteredResult(_0x4c9540,_0x8d0dae))['catch'](handleError(_0x4c9540,null));};exports[_0x9d02('0x70')]=function(_0x20bb93,_0x595f6e,_0xf24ec8){return db['OpenchannelAccount'][_0x9d02('0x5c')]({'where':{'id':_0x20bb93[_0x9d02('0x5a')]['id']}})['then'](handleEntityNotFound(_0x595f6e,null))[_0x9d02('0x37')](function(_0x7d9c28){if(_0x7d9c28){return _0x7d9c28['removeAnswers'](_0x20bb93[_0x9d02('0x45')][_0x9d02('0x6c')]);}})['then'](respondWithStatusCode(_0x595f6e,null))['catch'](handleError(_0x595f6e,null));};exports[_0x9d02('0x71')]=function(_0x1f992c,_0x150a81,_0x40d9f9){var _0x1568d9={'body':_0x1f992c[_0x9d02('0x5e')],'channel':_0x9d02('0x72')};var _0x4b9e4e=[];var _0x183ebe=[];var _0x379f72={};var _0x5523c3=![];return db[_0x9d02('0x73')][_0x9d02('0x65')]()[_0x9d02('0x37')](function(_0x195bc4){if(!_0x195bc4){throw new db[(_0x9d02('0x74'))][(_0x9d02('0x75'))](_0x9d02('0x76'));}_0x4b9e4e=_[_0x9d02('0x77')](_[_0x9d02('0x5b')](_0x195bc4),[_0x9d02('0x78'),_0x9d02('0x79')]);_0x183ebe=_[_0x9d02('0x77')](_[_0x9d02('0x5b')](_0x195bc4),[_0x9d02('0x78'),_0x9d02('0x79'),_0x9d02('0x7a'),'ListId']);if(_0x1f992c[_0x9d02('0x5e')]['id']){delete _0x1f992c[_0x9d02('0x5e')]['id'];}if(_[_0x9d02('0x7b')](_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x7c')])){throw new db[(_0x9d02('0x74'))][(_0x9d02('0x75'))](_0x9d02('0x7d'));}if(_[_0x9d02('0x7b')](_0x1f992c['body']['body'])||_0x1f992c[_0x9d02('0x5e')]['body']===''){throw new db[(_0x9d02('0x74'))][(_0x9d02('0x75'))](_0x9d02('0x7e'));}if(_[_0x9d02('0x7b')](_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x7f')])){throw new db[(_0x9d02('0x74'))]['ValidationError'](_0x9d02('0x80')+_0x183ebe);}if(!_[_0x9d02('0x81')](_0x183ebe,_0x1f992c['body'][_0x9d02('0x7f')])){throw new db[(_0x9d02('0x74'))][(_0x9d02('0x75'))](_0x9d02('0x82')+_0x183ebe);}_0x379f72[_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x7f')]]=_0x1f992c['body'][_0x9d02('0x7c')];})['then'](function(){return db['OpenchannelAccount'][_0x9d02('0x5c')]({'where':{'id':_0x1f992c[_0x9d02('0x5a')]['id']},'include':[{'model':db[_0x9d02('0x83')],'as':_0x9d02('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x379f72,'limit':0x1,'order':[[_0x9d02('0x79'),'DESC']]}]},{'model':db[_0x9d02('0x85')],'as':'Applications'}]});})[_0x9d02('0x37')](handleEntityNotFound(_0x150a81,null))[_0x9d02('0x37')](function(_0x51ee67){if(_0x51ee67&&_0x51ee67[_0x9d02('0x84')]){_0x1568d9[_0x9d02('0x86')]=_0x51ee67;_0x1568d9['applications']=_0x51ee67[_0x9d02('0x87')];_0x1568d9[_0x9d02('0x88')]=_0x51ee67[_0x9d02('0x84')];_0x1568d9['applications']=_[_0x9d02('0x89')](_0x1568d9[_0x9d02('0x8a')],[_0x9d02('0x8b')],[_0x9d02('0x8c')]);if(_0x1568d9['account'][_0x9d02('0x87')]){delete _0x1568d9['account'][_0x9d02('0x87')];}if(_0x1568d9['account']['List']&&_0x1568d9[_0x9d02('0x86')]['List'][_0x9d02('0x8d')]['length']){return _0x1568d9[_0x9d02('0x86')][_0x9d02('0x84')][_0x9d02('0x8d')][0x0];}var _0x120061=_['defaults'](_0x1f992c[_0x9d02('0x5e')],{'firstName':_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x7c')],'ListId':_0x51ee67['ListId']});_0x120061[_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x7f')]]=_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x7c')];return db['CmContact'][_0x9d02('0x5d')](_0x120061,{'fields':_0x4b9e4e,'raw':!![]});}})[_0x9d02('0x37')](handleEntityNotFound(_0x150a81,null))[_0x9d02('0x37')](function(_0x50a300){_0x1568d9['contact']=_0x50a300;if(_0x50a300){var _0x4315df={'ContactId':_0x50a300['id'],'OpenchannelAccountId':_0x1f992c[_0x9d02('0x5a')]['id'],'from':(_0x50a300['firstName']||'')+'\x20'+(_0x50a300[_0x9d02('0x8e')]||'')};var _0x5b8849={'OpenchannelAccountId':_0x1f992c[_0x9d02('0x5a')]['id'],'closed':![]};if(_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x8f')]){_0x5b8849[_0x9d02('0x8f')]=_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x8f')];return db[_0x9d02('0x90')][_0x9d02('0x5c')]({'where':_0x5b8849})[_0x9d02('0x37')](function(_0x363bbf){if(_0x363bbf){return[_0x363bbf,![]];}_0x4315df[_0x9d02('0x8f')]=_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x8f')];_0x4315df[_0x9d02('0x91')]=_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x91')];return db[_0x9d02('0x90')]['create'](_0x4315df)[_0x9d02('0x37')](function(_0x1c3367){return[_0x1c3367,!![]];});});}else{_0x5b8849['threadId']=null;}_0x5b8849['ContactId']=_0x50a300['id'];return db[_0x9d02('0x90')][_0x9d02('0x5c')]({'where':_0x5b8849})['then'](function(_0x276ff3){if(_0x276ff3){return[_0x276ff3,![]];}return db['OpenchannelInteraction'][_0x9d02('0x5d')](_0x4315df)[_0x9d02('0x37')](function(_0x14be88){return[_0x14be88,!![]];});});}})[_0x9d02('0x92')](function(_0x4a18fa,_0x402e7c){if(_0x4a18fa){_0x5523c3=_0x402e7c;if(!_0x402e7c){var _0x2e6b22={'from':(_0x1568d9['contact'][_0x9d02('0x93')]||'')+'\x20'+(_0x1568d9[_0x9d02('0x94')][_0x9d02('0x8e')]||'')};if(_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x8f')]&&_0x1f992c[_0x9d02('0x5e')]['messageId']&&_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x8f')]!=_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x95')]){_0x2e6b22[_0x9d02('0x8f')]=_0x1f992c[_0x9d02('0x5e')]['messageId'];}return _0x4a18fa['update'](_0x2e6b22);}else{return _0x4a18fa;}}})[_0x9d02('0x37')](function(_0x3e3689){_0x1568d9[_0x9d02('0x96')]=_0x3e3689[_0x9d02('0x61')]({'plain':!![]});_0x1568d9['interaction'][_0x9d02('0x97')]=_0x5523c3;if(_0x1568d9[_0x9d02('0x96')][_0x9d02('0x97')]){if(_0x1568d9[_0x9d02('0x86')][_0x9d02('0x98')]){_0x1568d9['applications']['push']({'id':0x0,'priority':_0x1568d9[_0x9d02('0x8a')][_0x9d02('0x4a')]+0x1,'app':_0x9d02('0x99'),'appdata':_0x9d02('0x9a'),'interval':_0x9d02('0x9b')});}}return db[_0x9d02('0x9c')][_0x9d02('0x5d')]({'body':_0x1f992c['body'][_0x9d02('0x5e')],'OpenchannelAccountId':_0x1f992c['params']['id'],'OpenchannelInteractionId':_0x3e3689['id'],'direction':'in','ContactId':_0x1568d9[_0x9d02('0x94')]['id'],'AttachmentId':_0x1f992c[_0x9d02('0x5e')][_0x9d02('0x9d')]});})['then'](function(_0x19f2d8){_0x1568d9['message']=_0x19f2d8;if(_0x1568d9[_0x9d02('0x96')][_0x9d02('0x9e')]){return db[_0x9d02('0x9f')]['find']({'attributes':['id',_0x9d02('0x3b')],'where':{'id':_0x1568d9[_0x9d02('0x96')][_0x9d02('0x9e')]}})[_0x9d02('0x37')](function(_0x15e1e7){if(_0x15e1e7){_0x1568d9[_0x9d02('0x8a')][_0x9d02('0xa0')]({'id':0x0,'priority':0x0,'app':_0x9d02('0xa1'),'appdata':_0x15e1e7[_0x9d02('0x3b')]+','+(_0x1568d9[_0x9d02('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x9d02('0x9b')});_0x1568d9['forcedOwnership']=![];}return respondWithRpcPromise(_0x9d02('0xa2'),'startRouting',_0x1568d9);});}return respondWithRpcPromise('Start',_0x9d02('0xa3'),_0x1568d9);})['then'](function(_0x1c4ba7){respondWithRpcPromise('EventManager',_0x9d02('0xa4'),{'event':_0x9d02('0x71'),'message':_0x1c4ba7},client9002);return _0x1c4ba7;})[_0x9d02('0x37')](respondWithResult(_0x150a81,null))['catch'](handleError(_0x150a81,null));};exports['addApplications']=function(_0x4b5eed,_0x1f7331){var _0x16338a=_0x4b5eed[_0x9d02('0x5a')]['id'];var _0xa4bf7=_0x4b5eed[_0x9d02('0x5e')];var _0x473e5a=0xc8;var _0x384585=null;return db[_0x9d02('0xa5')][_0x9d02('0xa6')]({'isolationLevel':db['sequelize'][_0x9d02('0xa7')]['ISOLATION_LEVELS'][_0x9d02('0xa8')]},function(_0x255480){return db[_0x9d02('0x3f')][_0x9d02('0x68')]({'where':{'id':_0x16338a},'transaction':_0x255480})[_0x9d02('0x37')](function(_0x1c6601){if(_0x1c6601){return db['OpenchannelApplication'][_0x9d02('0x38')]({'where':{'OpenchannelAccountId':_0x16338a},'transaction':_0x255480})[_0x9d02('0x37')](function(){var _0x4dc88a=_[_0x9d02('0x3e')](_0xa4bf7,function(_0x521de8){_0x521de8[_0x9d02('0x67')]=_0x16338a;return _0x521de8;});return db['OpenchannelApplication'][_0x9d02('0xa9')](_0x4dc88a,{'transaction':_0x255480});});}else{_0x473e5a=0x194;_0x384585=[];}});})[_0x9d02('0x37')](function(){if(_0x473e5a!==0x194){return db[_0x9d02('0x85')][_0x9d02('0xaa')]({'where':{'OpenchannelAccountId':_0x16338a},'order':_0x9d02('0x8b')})[_0x9d02('0x37')](function(_0x2224f3){_0x384585=_0x2224f3;});}})['catch'](function(_0x8982b3){_0x473e5a=0x1f4;logger['error'](_0x8982b3[_0x9d02('0x3a')]);if(_0x8982b3['name']){delete _0x8982b3['name'];}_0x384585=_0x8982b3;})[_0x9d02('0xab')](function(){if(_0x384585===null){_0x1f7331[_0x9d02('0x2a')](_0x473e5a);}else{if(_0x473e5a===0x1f4){_0x1f7331[_0x9d02('0x2b')](_0x473e5a)['send'](_0x384585);}else{_0x1f7331[_0x9d02('0x2b')](_0x473e5a)['json'](_0x384585);}}});};exports[_0x9d02('0xac')]=function(_0x914f1e,_0x2ca521,_0x182666){var _0x599295={};var _0x5bc556={};var _0x18d545;var _0x232e6f;return db[_0x9d02('0x3f')][_0x9d02('0x68')]({'where':{'id':_0x914f1e[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x2ca521,null))[_0x9d02('0x37')](function(_0x595e49){if(_0x595e49){_0x18d545=_0x595e49;_0x5bc556['model']=_[_0x9d02('0x5b')](db[_0x9d02('0x85')][_0x9d02('0x40')]);_0x5bc556[_0x9d02('0x45')]=_['keys'](_0x914f1e[_0x9d02('0x45')]);_0x5bc556[_0x9d02('0x46')]=_['intersection'](_0x5bc556[_0x9d02('0x44')],_0x5bc556['query']);_0x599295[_0x9d02('0x48')]=_['intersection'](_0x5bc556[_0x9d02('0x44')],qs[_0x9d02('0x49')](_0x914f1e[_0x9d02('0x45')][_0x9d02('0x49')]));_0x599295[_0x9d02('0x48')]=_0x599295[_0x9d02('0x48')][_0x9d02('0x4a')]?_0x599295[_0x9d02('0x48')]:_0x5bc556[_0x9d02('0x44')];_0x599295[_0x9d02('0x4d')]=qs[_0x9d02('0x4e')](_0x914f1e[_0x9d02('0x45')][_0x9d02('0x4e')]);_0x599295[_0x9d02('0x4f')]=qs[_0x9d02('0x46')](_[_0x9d02('0x50')](_0x914f1e['query'],_0x5bc556[_0x9d02('0x46')]));if(_0x914f1e[_0x9d02('0x45')][_0x9d02('0x51')]){_0x599295[_0x9d02('0x4f')]=_['merge'](_0x599295['where'],{'$or':_['map'](_0x599295[_0x9d02('0x48')],function(_0xef7402){var _0x49b8a7={};_0x49b8a7[_0xef7402]={'$like':'%'+_0x914f1e[_0x9d02('0x45')][_0x9d02('0x51')]+'%'};return _0x49b8a7;})});}_0x599295=_[_0x9d02('0x52')]({},_0x599295,_0x914f1e[_0x9d02('0x54')]);return _0x18d545[_0x9d02('0xac')](_0x599295);}})[_0x9d02('0x37')](function(_0x2d39f7){if(_0x2d39f7){_0x232e6f=_0x2d39f7[_0x9d02('0x4a')];if(!_0x914f1e[_0x9d02('0x45')]['hasOwnProperty'](_0x9d02('0x4c'))){_0x599295[_0x9d02('0x2d')]=qs[_0x9d02('0x2d')](_0x914f1e[_0x9d02('0x45')][_0x9d02('0x2d')]);_0x599295['offset']=qs[_0x9d02('0x30')](_0x914f1e[_0x9d02('0x45')]['offset']);}return _0x18d545[_0x9d02('0xac')](_0x599295);}})[_0x9d02('0x37')](function(_0x170375){if(_0x170375){return _0x170375?{'count':_0x232e6f,'rows':_0x170375}:null;}})[_0x9d02('0x37')](respondWithResult(_0x2ca521,null))[_0x9d02('0x58')](handleError(_0x2ca521,null));};exports[_0x9d02('0xad')]=function(_0x1d9298,_0x58203f,_0x4cf773){var _0x4c4d38={'raw':![],'where':{}};var _0x384f3c={};var _0x49ef43={'count':0x0,'rows':[]};return db[_0x9d02('0x3f')][_0x9d02('0x68')]({'where':{'id':_0x1d9298[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x58203f,null))[_0x9d02('0x37')](function(_0x45cfd1){if(_0x45cfd1){_0x384f3c[_0x9d02('0x44')]=_[_0x9d02('0x5b')](db[_0x9d02('0x90')]['rawAttributes']);_0x384f3c[_0x9d02('0x45')]=_[_0x9d02('0x5b')](_0x1d9298[_0x9d02('0x45')]);_0x384f3c[_0x9d02('0x46')]=_[_0x9d02('0x47')](_0x384f3c[_0x9d02('0x44')],_0x384f3c[_0x9d02('0x45')]);_0x4c4d38['attributes']=_[_0x9d02('0x47')](_0x384f3c[_0x9d02('0x44')],qs[_0x9d02('0x49')](_0x1d9298[_0x9d02('0x45')][_0x9d02('0x49')]));_0x4c4d38[_0x9d02('0x48')]=_0x4c4d38[_0x9d02('0x48')][_0x9d02('0x4a')]?_0x4c4d38[_0x9d02('0x48')]:_0x384f3c[_0x9d02('0x44')];if(!_0x1d9298[_0x9d02('0x45')][_0x9d02('0x4b')](_0x9d02('0x4c'))){_0x4c4d38['limit']=qs[_0x9d02('0x2d')](_0x1d9298['query'][_0x9d02('0x2d')]);_0x4c4d38[_0x9d02('0x30')]=qs[_0x9d02('0x30')](_0x1d9298['query']['offset']);}_0x4c4d38[_0x9d02('0x4d')]=qs[_0x9d02('0x4e')](_0x1d9298['query'][_0x9d02('0x4e')]);_0x4c4d38[_0x9d02('0x4f')]=qs['filters'](_['pick'](_0x1d9298[_0x9d02('0x45')],_0x384f3c['filters']));_0x4c4d38[_0x9d02('0x4f')][_0x9d02('0x67')]=_0x45cfd1['id'];if(_0x1d9298[_0x9d02('0x45')][_0x9d02('0x51')]){_0x4c4d38[_0x9d02('0x4f')]=_[_0x9d02('0x52')](_0x4c4d38[_0x9d02('0x4f')],{'$or':_[_0x9d02('0x3e')](_0x4c4d38[_0x9d02('0x48')],function(_0xc0c7d5){var _0x1ce1d8={};_0x1ce1d8[_0xc0c7d5]={'$like':'%'+_0x1d9298[_0x9d02('0x45')][_0x9d02('0x51')]+'%'};return _0x1ce1d8;})});}_0x4c4d38=_[_0x9d02('0x52')]({},_0x4c4d38,_0x1d9298[_0x9d02('0x54')]);return db[_0x9d02('0x90')][_0x9d02('0x2f')]({'where':_0x4c4d38[_0x9d02('0x4f')]})[_0x9d02('0x37')](function(_0x2f3880){_0x49ef43[_0x9d02('0x2f')]=_0x2f3880;if(_0x1d9298[_0x9d02('0x45')][_0x9d02('0x55')]){_0x4c4d38['include']=[{'model':db[_0x9d02('0x73')],'as':_0x9d02('0xae'),'required':![]},{'model':db[_0x9d02('0x9f')],'as':_0x9d02('0xaf'),'attributes':[_0x9d02('0x3b'),_0x9d02('0xb0'),_0x9d02('0xb1')],'required':![]},{'model':db[_0x9d02('0xb2')],'as':_0x9d02('0xb3'),'attributes':['id','name',_0x9d02('0xb4')],'where':_0x1d9298[_0x9d02('0x45')]['tag']?{'id':_0x1d9298[_0x9d02('0x45')][_0x9d02('0xb5')]}:undefined,'required':_0x1d9298['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x9d02('0x6a')](_0x4c4d38);})[_0x9d02('0x37')](function(_0x3ca0fc){_0x49ef43[_0x9d02('0x57')]=_0x3ca0fc;return _0x49ef43;});}})[_0x9d02('0x37')](respondWithFilteredResult(_0x58203f,_0x4c4d38))[_0x9d02('0x58')](handleError(_0x58203f,null));};exports[_0x9d02('0xb6')]=function(_0x512054,_0x4f1fa0,_0x3221e2){return db[_0x9d02('0x3f')]['find']({'where':{'id':_0x512054[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x4f1fa0,null))[_0x9d02('0x37')](function(_0x482556){if(_0x482556){return _0x482556[_0x9d02('0xb6')](_0x512054[_0x9d02('0x5e')][_0x9d02('0x6c')],_[_0x9d02('0xb7')](_0x512054[_0x9d02('0x5e')],[_0x9d02('0x6c'),'id'])||{})[_0x9d02('0x92')](function(_0x5f4eba){for(var _0x354dc1=0x0;_0x354dc1<_0x512054[_0x9d02('0x5e')]['ids'][_0x9d02('0x4a')];_0x354dc1+=0x1){socket['emit'](_0x9d02('0xb8'),{'UserId':Number(_0x512054[_0x9d02('0x5e')][_0x9d02('0x6c')][_0x354dc1]),'OpenchannelAccountId':Number(_0x512054['params']['id'])});}return _0x5f4eba;});}})['then'](respondWithResult(_0x4f1fa0,null))['catch'](handleError(_0x4f1fa0,null));};exports[_0x9d02('0xb9')]=function(_0x58cfaf,_0x41926d,_0x1deb74){return db[_0x9d02('0x3f')][_0x9d02('0x5c')]({'where':{'id':_0x58cfaf[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x41926d,null))['then'](function(_0x2dd8b1){if(_0x2dd8b1){return _0x2dd8b1[_0x9d02('0xb9')](_0x58cfaf[_0x9d02('0x45')][_0x9d02('0x6c')])['then'](function(){if(_[_0x9d02('0xba')](_0x58cfaf['query'][_0x9d02('0x6c')])){for(var _0x219d50=0x0;_0x219d50<_0x58cfaf['query']['ids'][_0x9d02('0x4a')];_0x219d50+=0x1){socket[_0x9d02('0xbb')](_0x9d02('0xbc'),{'UserId':Number(_0x58cfaf['query'][_0x9d02('0x6c')][_0x219d50]),'OpenchannelAccountId':Number(_0x58cfaf[_0x9d02('0x5a')]['id'])});}}else{socket[_0x9d02('0xbb')](_0x9d02('0xbc'),{'UserId':Number(_0x58cfaf[_0x9d02('0x45')][_0x9d02('0x6c')]),'OpenchannelAccountId':Number(_0x58cfaf[_0x9d02('0x5a')]['id'])});}});}})[_0x9d02('0x37')](respondWithStatusCode(_0x41926d,null))[_0x9d02('0x58')](handleError(_0x41926d,null));};exports['getAgents']=function(_0x3a55bd,_0x1845fa,_0x22f556){var _0x553862={};var _0x26b6bb={};var _0x338e8;var _0x381019;return db[_0x9d02('0x3f')][_0x9d02('0x68')]({'where':{'id':_0x3a55bd[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x1845fa,null))[_0x9d02('0x37')](function(_0x27ae80){if(_0x27ae80){_0x338e8=_0x27ae80;_0x26b6bb[_0x9d02('0x44')]=_['keys'](db[_0x9d02('0x9f')][_0x9d02('0x40')]);_0x26b6bb[_0x9d02('0x45')]=_[_0x9d02('0x5b')](_0x3a55bd[_0x9d02('0x45')]);_0x26b6bb[_0x9d02('0x46')]=_[_0x9d02('0x47')](_0x26b6bb['model'],_0x26b6bb[_0x9d02('0x45')]);_0x553862[_0x9d02('0x48')]=_[_0x9d02('0x47')](_0x26b6bb['model'],qs[_0x9d02('0x49')](_0x3a55bd[_0x9d02('0x45')]['fields']));_0x553862[_0x9d02('0x48')]=_0x553862[_0x9d02('0x48')]['length']?_0x553862['attributes']:_0x26b6bb[_0x9d02('0x44')];_0x553862[_0x9d02('0x4d')]=qs[_0x9d02('0x4e')](_0x3a55bd[_0x9d02('0x45')][_0x9d02('0x4e')]);_0x553862['where']=qs[_0x9d02('0x46')](_[_0x9d02('0x50')](_0x3a55bd[_0x9d02('0x45')],_0x26b6bb['filters']));if(_0x3a55bd[_0x9d02('0x45')][_0x9d02('0x51')]){_0x553862[_0x9d02('0x4f')]=_[_0x9d02('0x52')](_0x553862[_0x9d02('0x4f')],{'$or':_[_0x9d02('0x3e')](_0x553862[_0x9d02('0x48')],function(_0x458420){var _0x3097bb={};_0x3097bb[_0x458420]={'$like':'%'+_0x3a55bd[_0x9d02('0x45')][_0x9d02('0x51')]+'%'};return _0x3097bb;})});}_0x553862=_[_0x9d02('0x52')]({},_0x553862,_0x3a55bd[_0x9d02('0x54')]);return _0x338e8[_0x9d02('0xbd')](_0x553862);}})[_0x9d02('0x37')](function(_0x47d62d){if(_0x47d62d){_0x381019=_0x47d62d[_0x9d02('0x4a')];if(!_0x3a55bd[_0x9d02('0x45')]['hasOwnProperty'](_0x9d02('0x4c'))){_0x553862['limit']=qs['limit'](_0x3a55bd[_0x9d02('0x45')]['limit']);_0x553862[_0x9d02('0x30')]=qs[_0x9d02('0x30')](_0x3a55bd[_0x9d02('0x45')][_0x9d02('0x30')]);}return _0x338e8['getAgents'](_0x553862);}})[_0x9d02('0x37')](function(_0x181bdb){if(_0x181bdb){return _0x181bdb?{'count':_0x381019,'rows':_0x181bdb}:null;}})[_0x9d02('0x37')](respondWithResult(_0x1845fa,null))[_0x9d02('0x58')](handleError(_0x1845fa,null));};exports[_0x9d02('0xbe')]=function(_0x1e5ba8,_0x2a71f0,_0x4fbe08){var _0x1740b6,_0x47e7bc,_0x4bab21;if(_['isNil'](_0x1e5ba8[_0x9d02('0x5e')][_0x9d02('0x5e')])||_0x1e5ba8[_0x9d02('0x5e')][_0x9d02('0x5e')]===''){throw new db[(_0x9d02('0x74'))][(_0x9d02('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9d02('0x7b')](_0x1e5ba8[_0x9d02('0x5e')]['to'])){}_0x1740b6=_0x1e5ba8['body']['to'];return db[_0x9d02('0x3f')][_0x9d02('0x68')]({'where':{'id':_0x1e5ba8[_0x9d02('0x5a')]['id']}})[_0x9d02('0x37')](handleEntityNotFound(_0x2a71f0,null))[_0x9d02('0x37')](function(_0x42f875){if(_0x42f875){return db[_0x9d02('0x3f')][_0x9d02('0x5c')]({'where':{'id':_0x42f875['id']},'include':[{'model':db[_0x9d02('0x83')],'as':_0x9d02('0x84'),'include':[{'model':db[_0x9d02('0x73')],'as':'Contacts','where':{[_0x42f875['mapKey']]:_0x1740b6},'limit':0x1,'order':[[_0x9d02('0x79'),'DESC']]}]}]})[_0x9d02('0x37')](handleEntityNotFound(_0x2a71f0,null))[_0x9d02('0x37')](function(_0x3a950a){if(_0x3a950a&&_0x3a950a['List']){_0x47e7bc=_0x3a950a[_0x9d02('0x61')]({'plain':!![]});if(_0x47e7bc[_0x9d02('0x84')]&&_0x47e7bc[_0x9d02('0x84')][_0x9d02('0x8d')][_0x9d02('0x4a')]){return _0x47e7bc[_0x9d02('0x84')][_0x9d02('0x8d')][0x0];}return db[_0x9d02('0x73')]['create'](_['defaults'](_0x1e5ba8['body'],{'firstName':_0x1740b6,[_0x3a950a['mapKey']]:_0x1740b6,'phone':_0x1740b6,'ListId':_0x47e7bc[_0x9d02('0xbf')]}));}})[_0x9d02('0x37')](handleEntityNotFound(_0x2a71f0,null))['then'](function(_0x33e01b){if(_0x33e01b){_0x4bab21=_0x33e01b;return db['OpenchannelInteraction'][_0x9d02('0x5c')]({'where':{'ContactId':_0x4bab21['id'],'closed':![],'OpenchannelAccountId':_0x47e7bc['id']}})['then'](function(_0x4eba25){if(_0x4eba25){return[_0x4eba25,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1e5ba8[_0x9d02('0x5f')]['id'],'ContactId':_0x4bab21['id'],'OpenchannelAccountId':_0x47e7bc['id'],'lastMsgDirection':_0x9d02('0xc0'),'Messages':[_[_0x9d02('0x52')](_0x1e5ba8['body'],{'read':![],'body':_0x1e5ba8['body']['body'],'OpenchannelAccountId':_0x47e7bc['id'],'UserId':_0x1e5ba8[_0x9d02('0x5f')]['id'],'ContactId':_0x4bab21['id']})]},{'include':[{'model':db[_0x9d02('0x9c')],'as':_0x9d02('0xc1')}]})[_0x9d02('0x37')](function(_0x5e9bd8){return[_0x5e9bd8,!![]];});});}})['spread'](function(_0x14650d,_0x28ee10){if(_0x28ee10){return _0x14650d;}return db['OpenchannelMessage'][_0x9d02('0x5d')](_[_0x9d02('0x52')](_0x1e5ba8[_0x9d02('0x5e')],{'read':![],'body':_0x1e5ba8[_0x9d02('0x5e')]['body'],'OpenchannelAccountId':_0x47e7bc['id'],'OpenchannelInteractionId':_0x14650d['id'],'UserId':_0x1e5ba8[_0x9d02('0x5f')]['id'],'ContactId':_0x4bab21['id']}))['then'](function(_0x2cf798){_0x14650d[_0x9d02('0xc2')]['Messages']=[];_0x14650d[_0x9d02('0xc2')][_0x9d02('0xc1')][_0x9d02('0xc3')](_0x2cf798[_0x9d02('0xc2')]);return _0x14650d;});});}})[_0x9d02('0x37')](respondWithResult(_0x2a71f0,null))[_0x9d02('0x58')](handleError(_0x2a71f0,null));}; \ No newline at end of file +var _0xc701=['fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','OpenchannelAccounts','UserProfileResource','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','params','intersection','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','describe','OpenchannelAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','Applications','List','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x54fbed,_0x3c77a7){var _0x333bbc=function(_0x53c015){while(--_0x53c015){_0x54fbed['push'](_0x54fbed['shift']());}};_0x333bbc(++_0x3c77a7);}(_0xc701,0x16c));var _0x1c70=function(_0x20ebf7,_0x6dc038){_0x20ebf7=_0x20ebf7-0x0;var _0x15ca11=_0xc701[_0x20ebf7];return _0x15ca11;};'use strict';var emlformat=require(_0x1c70('0x0'));var rimraf=require(_0x1c70('0x1'));var zipdir=require(_0x1c70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c70('0x3'));var moment=require(_0x1c70('0x4'));var BPromise=require(_0x1c70('0x5'));var Mustache=require(_0x1c70('0x6'));var util=require(_0x1c70('0x7'));var path=require(_0x1c70('0x8'));var sox=require(_0x1c70('0x9'));var csv=require(_0x1c70('0xa'));var ejs=require(_0x1c70('0xb'));var fs=require('fs');var fs_extra=require(_0x1c70('0xc'));var _=require(_0x1c70('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c70('0xe'));var deskjs=require(_0x1c70('0xf'));var toCsv=require(_0x1c70('0xa'));var querystring=require('querystring');var Papa=require(_0x1c70('0x10'));var Redis=require(_0x1c70('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c70('0x12'));var as=require(_0x1c70('0x13'));var hardwareService=require(_0x1c70('0x14'));var logger=require(_0x1c70('0x15'))('api');var utils=require(_0x1c70('0x16'));var config=require(_0x1c70('0x17'));var licenseUtil=require(_0x1c70('0x18'));var db=require(_0x1c70('0x19'))['db'];config[_0x1c70('0x1a')]=_[_0x1c70('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1c70('0x1c'))(new Redis(config['redis']));require(_0x1c70('0x1d'))[_0x1c70('0x1e')](socket);var jayson=require(_0x1c70('0x1f'));var client=jayson[_0x1c70('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x1c70('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3f286d,_0x1d04a2,_0x3d792e,_0x118297){return new BPromise(function(_0x44cda9,_0x37cc13){var _0x24b122=_0x118297||client;return _0x24b122['request'](_0x3f286d,_0x3d792e)[_0x1c70('0x22')](function(_0x2b3361){logger['info'](_0x1c70('0x23'),_0x1d04a2,'request\x20sent');logger['debug'](_0x1c70('0x24'),_0x1d04a2,'request\x20sent',JSON[_0x1c70('0x25')](_0x2b3361));if(_0x2b3361[_0x1c70('0x26')]){if(_0x2b3361[_0x1c70('0x26')][_0x1c70('0x27')]===0x1f4){logger['error'](_0x1c70('0x23'),_0x1d04a2,_0x2b3361[_0x1c70('0x26')][_0x1c70('0x28')]);return _0x37cc13(_0x2b3361[_0x1c70('0x26')][_0x1c70('0x28')]);}logger[_0x1c70('0x26')](_0x1c70('0x23'),_0x1d04a2,_0x2b3361[_0x1c70('0x26')][_0x1c70('0x28')]);return _0x44cda9(_0x2b3361[_0x1c70('0x26')]['message']);}else{logger[_0x1c70('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d04a2,'request\x20sent');_0x44cda9(_0x2b3361[_0x1c70('0x2a')][_0x1c70('0x28')]);}})['catch'](function(_0x4276a2){logger[_0x1c70('0x26')](_0x1c70('0x23'),_0x1d04a2,_0x4276a2);_0x37cc13(_0x4276a2);});});}function respondWithStatusCode(_0x2c0a9e,_0x1f9722){_0x1f9722=_0x1f9722||0xcc;return function(_0x14d8f9){if(_0x14d8f9){return _0x2c0a9e[_0x1c70('0x2b')](_0x1f9722);}return _0x2c0a9e['status'](_0x1f9722)[_0x1c70('0x2c')]();};}function respondWithResult(_0xc1e31b,_0x2bdf9e){_0x2bdf9e=_0x2bdf9e||0xc8;return function(_0x1fddce){if(_0x1fddce){return _0xc1e31b[_0x1c70('0x2d')](_0x2bdf9e)[_0x1c70('0x2e')](_0x1fddce);}};}function respondWithFilteredResult(_0x19b67d,_0xb2a9d4){return function(_0x5e2529){if(_0x5e2529){var _0x134395=typeof _0xb2a9d4[_0x1c70('0x2f')]===_0x1c70('0x30')&&typeof _0xb2a9d4[_0x1c70('0x31')]===_0x1c70('0x30');var _0x3d81a7=_0x5e2529['count'];var _0x1993e4=_0x134395?0x0:_0xb2a9d4[_0x1c70('0x2f')];var _0x21b128=_0x134395?_0x5e2529['count']:_0xb2a9d4[_0x1c70('0x2f')]+_0xb2a9d4[_0x1c70('0x31')];var _0x29e891;if(_0x21b128>=_0x3d81a7){_0x21b128=_0x3d81a7;_0x29e891=0xc8;}else{_0x29e891=0xce;}_0x19b67d[_0x1c70('0x2d')](_0x29e891);return _0x19b67d[_0x1c70('0x32')](_0x1c70('0x33'),_0x1993e4+'-'+_0x21b128+'/'+_0x3d81a7)['json'](_0x5e2529);}return null;};}function patchUpdates(_0x113f72){return function(_0x5d59c9){try{jsonpatch[_0x1c70('0x34')](_0x5d59c9,_0x113f72,!![]);}catch(_0x4b53bc){return BPromise['reject'](_0x4b53bc);}return _0x5d59c9[_0x1c70('0x35')]();};}function saveUpdates(_0x5a22be,_0x105b86){return function(_0x45f065){if(_0x45f065){return _0x45f065[_0x1c70('0x36')](_0x5a22be)[_0x1c70('0x22')](function(_0xecfaf8){return _0xecfaf8;});}return null;};}function removeEntity(_0x375a32,_0x41c3fe){return function(_0x4242d5){if(_0x4242d5){return _0x4242d5[_0x1c70('0x37')]()['then'](function(){var _0x113c51=_0x4242d5['get']({'plain':!![]});var _0x2dc5a5=_0x1c70('0x38');return db[_0x1c70('0x39')][_0x1c70('0x37')]({'where':{'type':_0x2dc5a5,'resourceId':_0x113c51['id']}})[_0x1c70('0x22')](function(){return _0x4242d5;});})[_0x1c70('0x22')](function(){_0x375a32[_0x1c70('0x2d')](0xcc)[_0x1c70('0x2c')]();});}};}function handleEntityNotFound(_0x5abd53,_0x55214e){return function(_0x53ecfd){if(!_0x53ecfd){_0x5abd53[_0x1c70('0x2b')](0x194);}return _0x53ecfd;};}function handleError(_0x582cab,_0x647950){_0x647950=_0x647950||0x1f4;return function(_0xb49e49){logger[_0x1c70('0x26')](_0xb49e49['stack']);if(_0xb49e49['name']){delete _0xb49e49['name'];}_0x582cab['status'](_0x647950)[_0x1c70('0x3a')](_0xb49e49);};}exports[_0x1c70('0x3b')]=function(_0x4c4067,_0x39a723){var _0x3dd89b={'include':[{'model':db[_0x1c70('0x3c')],'as':_0x1c70('0x3d')}]},_0x18401f={},_0x3bd1aa={'count':0x0,'rows':[]};var _0x64d1e5=_[_0x1c70('0x3e')](db[_0x1c70('0x3f')][_0x1c70('0x40')],function(_0x58c2ba){return{'name':_0x58c2ba[_0x1c70('0x41')],'type':_0x58c2ba[_0x1c70('0x42')]['key']};});_0x18401f['model']=_[_0x1c70('0x3e')](_0x64d1e5,_0x1c70('0x43'));_0x18401f[_0x1c70('0x44')]=_[_0x1c70('0x45')](_0x4c4067[_0x1c70('0x44')]);_0x18401f[_0x1c70('0x46')]=_['intersection'](_0x18401f[_0x1c70('0x47')],_0x18401f[_0x1c70('0x44')]);_0x3dd89b[_0x1c70('0x48')]=_['intersection'](_0x18401f[_0x1c70('0x47')],qs[_0x1c70('0x49')](_0x4c4067[_0x1c70('0x44')][_0x1c70('0x49')]));_0x3dd89b[_0x1c70('0x48')]=_0x3dd89b[_0x1c70('0x48')][_0x1c70('0x4a')]?_0x3dd89b['attributes']:_0x18401f[_0x1c70('0x47')];if(!_0x4c4067[_0x1c70('0x44')][_0x1c70('0x4b')](_0x1c70('0x4c'))){_0x3dd89b['limit']=qs[_0x1c70('0x31')](_0x4c4067['query'][_0x1c70('0x31')]);_0x3dd89b[_0x1c70('0x2f')]=qs[_0x1c70('0x2f')](_0x4c4067[_0x1c70('0x44')][_0x1c70('0x2f')]);}_0x3dd89b[_0x1c70('0x4d')]=qs[_0x1c70('0x4e')](_0x4c4067['query'][_0x1c70('0x4e')]);_0x3dd89b[_0x1c70('0x4f')]=qs['filters'](_[_0x1c70('0x50')](_0x4c4067['query'],_0x18401f[_0x1c70('0x46')]),_0x64d1e5);if(_0x4c4067[_0x1c70('0x44')][_0x1c70('0x51')]){_0x3dd89b[_0x1c70('0x4f')]=_[_0x1c70('0x52')](_0x3dd89b[_0x1c70('0x4f')],{'$or':_['map'](_0x64d1e5,function(_0x500ad1){if(_0x500ad1[_0x1c70('0x42')]!==_0x1c70('0x53')){var _0x53dd6c={};_0x53dd6c[_0x500ad1['name']]={'$like':'%'+_0x4c4067[_0x1c70('0x44')][_0x1c70('0x51')]+'%'};return _0x53dd6c;}})});}_0x3dd89b=_[_0x1c70('0x52')]({},_0x3dd89b,_0x4c4067['options']);var _0x3d9364={'where':_0x3dd89b[_0x1c70('0x4f')]};return db[_0x1c70('0x3f')][_0x1c70('0x54')](_0x3d9364)[_0x1c70('0x22')](function(_0x324872){_0x3bd1aa[_0x1c70('0x54')]=_0x324872;if(_0x4c4067[_0x1c70('0x44')]['includeAll']){_0x3dd89b[_0x1c70('0x55')]=[{'all':!![]}];}return db[_0x1c70('0x3f')][_0x1c70('0x56')](_0x3dd89b);})[_0x1c70('0x22')](function(_0x1afbd7){_0x3bd1aa[_0x1c70('0x57')]=_0x1afbd7;return _0x3bd1aa;})[_0x1c70('0x22')](respondWithFilteredResult(_0x39a723,_0x3dd89b))[_0x1c70('0x58')](handleError(_0x39a723,null));};exports['show']=function(_0x5d3128,_0x653dc){var _0x3d288c={'raw':![],'where':{'id':_0x5d3128[_0x1c70('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x1c70('0x3d')}]},_0x52110e={};_0x52110e[_0x1c70('0x47')]=_[_0x1c70('0x45')](db['OpenchannelAccount'][_0x1c70('0x40')]);_0x52110e[_0x1c70('0x44')]=_[_0x1c70('0x45')](_0x5d3128[_0x1c70('0x44')]);_0x52110e[_0x1c70('0x46')]=_[_0x1c70('0x5a')](_0x52110e[_0x1c70('0x47')],_0x52110e[_0x1c70('0x44')]);_0x3d288c[_0x1c70('0x48')]=_[_0x1c70('0x5a')](_0x52110e[_0x1c70('0x47')],qs[_0x1c70('0x49')](_0x5d3128['query']['fields']));_0x3d288c[_0x1c70('0x48')]=_0x3d288c[_0x1c70('0x48')]['length']?_0x3d288c[_0x1c70('0x48')]:_0x52110e[_0x1c70('0x47')];if(_0x5d3128[_0x1c70('0x44')][_0x1c70('0x5b')]){_0x3d288c[_0x1c70('0x55')]=[{'all':!![]}];}_0x3d288c=_[_0x1c70('0x52')]({},_0x3d288c,_0x5d3128[_0x1c70('0x5c')]);return db[_0x1c70('0x3f')][_0x1c70('0x5d')](_0x3d288c)['then'](handleEntityNotFound(_0x653dc,null))['then'](respondWithResult(_0x653dc,null))[_0x1c70('0x58')](handleError(_0x653dc,null));};exports[_0x1c70('0x5e')]=function(_0x129e12,_0x2db1e7){return db[_0x1c70('0x3f')][_0x1c70('0x5e')](_0x129e12[_0x1c70('0x5f')],{})[_0x1c70('0x22')](function(_0x4f4a4c){var _0x1bd886=_0x129e12[_0x1c70('0x60')][_0x1c70('0x61')]({'plain':!![]});if(!_0x1bd886)throw new Error(_0x1c70('0x62'));if(_0x1bd886[_0x1c70('0x63')]===_0x1c70('0x60')){var _0x34c6c2=_0x4f4a4c['get']({'plain':!![]});var _0x47e10a='OpenchannelAccounts';return db['UserProfileSection'][_0x1c70('0x5d')]({'where':{'name':_0x47e10a,'userProfileId':_0x1bd886[_0x1c70('0x64')]},'raw':!![]})[_0x1c70('0x22')](function(_0x558837){if(_0x558837&&_0x558837['autoAssociation']===0x0){return db[_0x1c70('0x39')][_0x1c70('0x5e')]({'name':_0x34c6c2[_0x1c70('0x43')],'resourceId':_0x34c6c2['id'],'type':_0x558837[_0x1c70('0x43')],'sectionId':_0x558837['id']},{})['then'](function(){return _0x4f4a4c;});}else{return _0x4f4a4c;}})[_0x1c70('0x58')](function(_0x57d41c){logger[_0x1c70('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57d41c);throw _0x57d41c;});}return _0x4f4a4c;})[_0x1c70('0x22')](respondWithResult(_0x2db1e7,0xc9))[_0x1c70('0x58')](handleError(_0x2db1e7,null));};exports[_0x1c70('0x36')]=function(_0x2d7f1a,_0x574e74){if(_0x2d7f1a['body']['id']){delete _0x2d7f1a[_0x1c70('0x5f')]['id'];}return db[_0x1c70('0x3f')][_0x1c70('0x5d')]({'where':{'id':_0x2d7f1a[_0x1c70('0x59')]['id']},'include':[{'model':db[_0x1c70('0x3c')],'as':_0x1c70('0x3d')}]})[_0x1c70('0x22')](handleEntityNotFound(_0x574e74,null))['then'](saveUpdates(_0x2d7f1a[_0x1c70('0x5f')],null))['then'](respondWithResult(_0x574e74,null))['catch'](handleError(_0x574e74,null));};exports[_0x1c70('0x37')]=function(_0x5bbdab,_0x8b3359){return db[_0x1c70('0x3f')][_0x1c70('0x5d')]({'where':{'id':_0x5bbdab[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x8b3359,null))['then'](removeEntity(_0x8b3359,null))[_0x1c70('0x58')](handleError(_0x8b3359,null));};exports[_0x1c70('0x65')]=function(_0x187926,_0x428d28){return db[_0x1c70('0x3f')][_0x1c70('0x65')]()['then'](respondWithResult(_0x428d28,null))['catch'](handleError(_0x428d28,null));};exports['addDisposition']=function(_0x214227,_0xb8ee3,_0x1b3b8c){if(_0x214227[_0x1c70('0x5f')]['id']){delete _0x214227[_0x1c70('0x5f')]['id'];}return db['OpenchannelAccount'][_0x1c70('0x5d')]({'where':{'id':_0x214227[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0xb8ee3,null))[_0x1c70('0x22')](function(_0x9e6a3b){if(_0x9e6a3b){_0x214227[_0x1c70('0x5f')][_0x1c70('0x66')]=_0x9e6a3b['id'];return db[_0x1c70('0x67')]['create'](_0x214227[_0x1c70('0x5f')]);}})[_0x1c70('0x22')](respondWithResult(_0xb8ee3,null))[_0x1c70('0x58')](handleError(_0xb8ee3,null));};exports['getDispositions']=function(_0x7acb38,_0x2acfa9,_0xb60a60){var _0x3bae10={'raw':![],'where':{}};var _0x7f1004={};var _0x3a481d={'count':0x0,'rows':[]};return db[_0x1c70('0x3f')][_0x1c70('0x68')]({'where':{'id':_0x7acb38[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x2acfa9,null))[_0x1c70('0x22')](function(_0x34f3fe){if(_0x34f3fe){_0x7f1004[_0x1c70('0x47')]=_[_0x1c70('0x45')](db['Disposition'][_0x1c70('0x40')]);_0x7f1004[_0x1c70('0x44')]=_['keys'](_0x7acb38['query']);_0x7f1004['filters']=_[_0x1c70('0x5a')](_0x7f1004[_0x1c70('0x47')],_0x7f1004[_0x1c70('0x44')]);_0x3bae10[_0x1c70('0x48')]=_[_0x1c70('0x5a')](_0x7f1004[_0x1c70('0x47')],qs[_0x1c70('0x49')](_0x7acb38[_0x1c70('0x44')][_0x1c70('0x49')]));_0x3bae10[_0x1c70('0x48')]=_0x3bae10[_0x1c70('0x48')][_0x1c70('0x4a')]?_0x3bae10[_0x1c70('0x48')]:_0x7f1004[_0x1c70('0x47')];if(!_0x7acb38[_0x1c70('0x44')][_0x1c70('0x4b')]('nolimit')){_0x3bae10[_0x1c70('0x31')]=qs[_0x1c70('0x31')](_0x7acb38[_0x1c70('0x44')][_0x1c70('0x31')]);_0x3bae10[_0x1c70('0x2f')]=qs['offset'](_0x7acb38[_0x1c70('0x44')][_0x1c70('0x2f')]);}_0x3bae10[_0x1c70('0x4d')]=qs[_0x1c70('0x4e')](_0x7acb38[_0x1c70('0x44')][_0x1c70('0x4e')]);_0x3bae10[_0x1c70('0x4f')]=qs[_0x1c70('0x46')](_['pick'](_0x7acb38[_0x1c70('0x44')],_0x7f1004[_0x1c70('0x46')]));_0x3bae10[_0x1c70('0x4f')][_0x1c70('0x66')]=_0x34f3fe['id'];if(_0x7acb38[_0x1c70('0x44')][_0x1c70('0x51')]){_0x3bae10[_0x1c70('0x4f')]=_[_0x1c70('0x52')](_0x3bae10[_0x1c70('0x4f')],{'$or':_[_0x1c70('0x3e')](_0x3bae10[_0x1c70('0x48')],function(_0x2202f1){var _0x223ec4={};_0x223ec4[_0x2202f1]={'$like':'%'+_0x7acb38[_0x1c70('0x44')][_0x1c70('0x51')]+'%'};return _0x223ec4;})});}_0x3bae10=_[_0x1c70('0x52')]({},_0x3bae10,_0x7acb38['options']);return db[_0x1c70('0x67')]['count']({'where':_0x3bae10[_0x1c70('0x4f')]})[_0x1c70('0x22')](function(_0x3b3369){_0x3a481d[_0x1c70('0x54')]=_0x3b3369;if(_0x7acb38[_0x1c70('0x44')][_0x1c70('0x5b')]){_0x3bae10[_0x1c70('0x55')]=[{'all':!![]}];}return db[_0x1c70('0x67')][_0x1c70('0x56')](_0x3bae10);})[_0x1c70('0x22')](function(_0x40d551){_0x3a481d[_0x1c70('0x57')]=_0x40d551;return _0x3a481d;});}})[_0x1c70('0x22')](respondWithFilteredResult(_0x2acfa9,_0x3bae10))[_0x1c70('0x58')](handleError(_0x2acfa9,null));};exports[_0x1c70('0x69')]=function(_0x2b230c,_0x155a65,_0x361248){return db[_0x1c70('0x3f')][_0x1c70('0x5d')]({'where':{'id':_0x2b230c[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x155a65,null))[_0x1c70('0x22')](function(_0x23a89b){if(_0x23a89b){return _0x23a89b['removeDispositions'](_0x2b230c[_0x1c70('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x155a65,null))[_0x1c70('0x58')](handleError(_0x155a65,null));};exports[_0x1c70('0x6a')]=function(_0x53b187,_0x45702f,_0x2f87fc){if(_0x53b187['body']['id']){delete _0x53b187[_0x1c70('0x5f')]['id'];}return db[_0x1c70('0x3f')]['find']({'where':{'id':_0x53b187[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x45702f,null))[_0x1c70('0x22')](function(_0x362d18){if(_0x362d18){_0x53b187[_0x1c70('0x5f')][_0x1c70('0x66')]=_0x362d18['id'];return db[_0x1c70('0x6b')][_0x1c70('0x5e')](_0x53b187[_0x1c70('0x5f')]);}})['then'](respondWithResult(_0x45702f,null))[_0x1c70('0x58')](handleError(_0x45702f,null));};exports[_0x1c70('0x6c')]=function(_0x26e5c6,_0x14a517,_0x32fcd7){var _0x1e4757={'raw':![],'where':{}};var _0x5b8089={};var _0x3925b3={'count':0x0,'rows':[]};return db[_0x1c70('0x3f')][_0x1c70('0x68')]({'where':{'id':_0x26e5c6[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x14a517,null))['then'](function(_0x3b16b6){if(_0x3b16b6){_0x5b8089[_0x1c70('0x47')]=_[_0x1c70('0x45')](db[_0x1c70('0x6b')][_0x1c70('0x40')]);_0x5b8089[_0x1c70('0x44')]=_[_0x1c70('0x45')](_0x26e5c6['query']);_0x5b8089[_0x1c70('0x46')]=_[_0x1c70('0x5a')](_0x5b8089[_0x1c70('0x47')],_0x5b8089['query']);_0x1e4757[_0x1c70('0x48')]=_[_0x1c70('0x5a')](_0x5b8089[_0x1c70('0x47')],qs[_0x1c70('0x49')](_0x26e5c6[_0x1c70('0x44')]['fields']));_0x1e4757[_0x1c70('0x48')]=_0x1e4757[_0x1c70('0x48')][_0x1c70('0x4a')]?_0x1e4757['attributes']:_0x5b8089['model'];if(!_0x26e5c6['query'][_0x1c70('0x4b')]('nolimit')){_0x1e4757[_0x1c70('0x31')]=qs[_0x1c70('0x31')](_0x26e5c6['query']['limit']);_0x1e4757[_0x1c70('0x2f')]=qs[_0x1c70('0x2f')](_0x26e5c6['query'][_0x1c70('0x2f')]);}_0x1e4757[_0x1c70('0x4d')]=qs[_0x1c70('0x4e')](_0x26e5c6[_0x1c70('0x44')][_0x1c70('0x4e')]);_0x1e4757[_0x1c70('0x4f')]=qs[_0x1c70('0x46')](_[_0x1c70('0x50')](_0x26e5c6[_0x1c70('0x44')],_0x5b8089['filters']));_0x1e4757[_0x1c70('0x4f')]['OpenchannelAccountId']=_0x3b16b6['id'];if(_0x26e5c6[_0x1c70('0x44')][_0x1c70('0x51')]){_0x1e4757[_0x1c70('0x4f')]=_[_0x1c70('0x52')](_0x1e4757['where'],{'$or':_[_0x1c70('0x3e')](_0x1e4757[_0x1c70('0x48')],function(_0x4e5c44){var _0x507987={};_0x507987[_0x4e5c44]={'$like':'%'+_0x26e5c6['query'][_0x1c70('0x51')]+'%'};return _0x507987;})});}_0x1e4757=_['merge']({},_0x1e4757,_0x26e5c6[_0x1c70('0x5c')]);return db['CannedAnswer'][_0x1c70('0x54')]({'where':_0x1e4757[_0x1c70('0x4f')]})['then'](function(_0x1592c0){_0x3925b3[_0x1c70('0x54')]=_0x1592c0;if(_0x26e5c6[_0x1c70('0x44')]['includeAll']){_0x1e4757['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x1c70('0x56')](_0x1e4757);})[_0x1c70('0x22')](function(_0x6f0764){_0x3925b3[_0x1c70('0x57')]=_0x6f0764;return _0x3925b3;});}})[_0x1c70('0x22')](respondWithFilteredResult(_0x14a517,_0x1e4757))[_0x1c70('0x58')](handleError(_0x14a517,null));};exports['removeAnswers']=function(_0x51b76f,_0xee5dc,_0x620adf){return db[_0x1c70('0x3f')][_0x1c70('0x5d')]({'where':{'id':_0x51b76f[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0xee5dc,null))[_0x1c70('0x22')](function(_0xa02f79){if(_0xa02f79){return _0xa02f79['removeAnswers'](_0x51b76f[_0x1c70('0x44')]['ids']);}})['then'](respondWithStatusCode(_0xee5dc,null))['catch'](handleError(_0xee5dc,null));};exports[_0x1c70('0x6d')]=function(_0x241d27,_0x4e4fb8,_0x3a2a9f){var _0x48d57d={'body':_0x241d27[_0x1c70('0x5f')],'channel':_0x1c70('0x6e')};var _0x32f195=[];var _0x3efec4=[];var _0x4b1aa3={};var _0x336b36=![];return db[_0x1c70('0x6f')][_0x1c70('0x65')]()['then'](function(_0x360d01){if(!_0x360d01){throw new db['Sequelize'][(_0x1c70('0x70'))](_0x1c70('0x71'));}_0x32f195=_['difference'](_[_0x1c70('0x45')](_0x360d01),[_0x1c70('0x72'),_0x1c70('0x73')]);_0x3efec4=_['difference'](_['keys'](_0x360d01),[_0x1c70('0x72'),'updatedAt',_0x1c70('0x74'),_0x1c70('0x75')]);if(_0x241d27[_0x1c70('0x5f')]['id']){delete _0x241d27['body']['id'];}if(_[_0x1c70('0x76')](_0x241d27[_0x1c70('0x5f')][_0x1c70('0x77')])){throw new db['Sequelize'][(_0x1c70('0x70'))](_0x1c70('0x78'));}if(_['isNil'](_0x241d27[_0x1c70('0x5f')]['body'])||_0x241d27['body'][_0x1c70('0x5f')]===''){throw new db[(_0x1c70('0x79'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1c70('0x76')](_0x241d27[_0x1c70('0x5f')]['mapKey'])){throw new db[(_0x1c70('0x79'))]['ValidationError'](_0x1c70('0x7a')+_0x3efec4);}if(!_[_0x1c70('0x7b')](_0x3efec4,_0x241d27[_0x1c70('0x5f')][_0x1c70('0x7c')])){throw new db[(_0x1c70('0x79'))][(_0x1c70('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3efec4);}_0x4b1aa3[_0x241d27[_0x1c70('0x5f')][_0x1c70('0x7c')]]=_0x241d27[_0x1c70('0x5f')]['from'];})[_0x1c70('0x22')](function(){return db[_0x1c70('0x3f')][_0x1c70('0x5d')]({'where':{'id':_0x241d27['params']['id']},'include':[{'model':db[_0x1c70('0x7d')],'as':'List','include':[{'model':db[_0x1c70('0x6f')],'as':_0x1c70('0x7e'),'where':_0x4b1aa3,'limit':0x1,'order':[['updatedAt',_0x1c70('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0x1c70('0x80')}]});})['then'](handleEntityNotFound(_0x4e4fb8,null))['then'](function(_0x5ebd97){if(_0x5ebd97&&_0x5ebd97[_0x1c70('0x81')]){_0x48d57d[_0x1c70('0x82')]=_0x5ebd97;_0x48d57d['applications']=_0x5ebd97[_0x1c70('0x80')];_0x48d57d['list']=_0x5ebd97['List'];_0x48d57d[_0x1c70('0x83')]=_[_0x1c70('0x84')](_0x48d57d['applications'],[_0x1c70('0x85')],[_0x1c70('0x86')]);if(_0x48d57d[_0x1c70('0x82')]['Applications']){delete _0x48d57d['account']['Applications'];}if(_0x48d57d[_0x1c70('0x82')][_0x1c70('0x81')]&&_0x48d57d[_0x1c70('0x82')][_0x1c70('0x81')]['Contacts'][_0x1c70('0x4a')]){return _0x48d57d[_0x1c70('0x82')][_0x1c70('0x81')][_0x1c70('0x7e')][0x0];}var _0x54db91=_['defaults'](_0x241d27[_0x1c70('0x5f')],{'firstName':_0x241d27[_0x1c70('0x5f')][_0x1c70('0x77')],'ListId':_0x5ebd97[_0x1c70('0x75')]});_0x54db91[_0x241d27[_0x1c70('0x5f')]['mapKey']]=_0x241d27[_0x1c70('0x5f')][_0x1c70('0x77')];return db['CmContact']['create'](_0x54db91,{'fields':_0x32f195,'raw':!![]});}})[_0x1c70('0x22')](handleEntityNotFound(_0x4e4fb8,null))[_0x1c70('0x22')](function(_0x49e3a4){_0x48d57d[_0x1c70('0x87')]=_0x49e3a4;if(_0x49e3a4){var _0x49e7cb={'ContactId':_0x49e3a4['id'],'OpenchannelAccountId':_0x241d27['params']['id'],'from':(_0x49e3a4[_0x1c70('0x88')]||'')+'\x20'+(_0x49e3a4[_0x1c70('0x89')]||'')};var _0x195cde={'OpenchannelAccountId':_0x241d27[_0x1c70('0x59')]['id'],'closed':![]};if(_0x241d27[_0x1c70('0x5f')][_0x1c70('0x8a')]){_0x195cde['threadId']=_0x241d27[_0x1c70('0x5f')]['threadId'];return db['OpenchannelInteraction'][_0x1c70('0x5d')]({'where':_0x195cde})[_0x1c70('0x22')](function(_0x171a48){if(_0x171a48){return[_0x171a48,![]];}_0x49e7cb[_0x1c70('0x8a')]=_0x241d27[_0x1c70('0x5f')][_0x1c70('0x8a')];_0x49e7cb['externalUrl']=_0x241d27[_0x1c70('0x5f')][_0x1c70('0x8b')];return db['OpenchannelInteraction']['create'](_0x49e7cb)[_0x1c70('0x22')](function(_0x2e86a5){return[_0x2e86a5,!![]];});});}else{_0x195cde[_0x1c70('0x8a')]=null;}_0x195cde[_0x1c70('0x8c')]=_0x49e3a4['id'];return db[_0x1c70('0x8d')][_0x1c70('0x5d')]({'where':_0x195cde})[_0x1c70('0x22')](function(_0x52e617){if(_0x52e617){return[_0x52e617,![]];}return db['OpenchannelInteraction'][_0x1c70('0x5e')](_0x49e7cb)[_0x1c70('0x22')](function(_0x5c2ff7){return[_0x5c2ff7,!![]];});});}})[_0x1c70('0x8e')](function(_0x1d4764,_0x632569){if(_0x1d4764){_0x336b36=_0x632569;if(!_0x632569){var _0x736fba={'from':(_0x48d57d['contact'][_0x1c70('0x88')]||'')+'\x20'+(_0x48d57d[_0x1c70('0x87')]['lastName']||'')};if(_0x241d27[_0x1c70('0x5f')][_0x1c70('0x8a')]&&_0x241d27['body'][_0x1c70('0x8f')]&&_0x241d27[_0x1c70('0x5f')]['threadId']!=_0x241d27['body']['messageId']){_0x736fba['threadId']=_0x241d27['body'][_0x1c70('0x8f')];}return _0x1d4764[_0x1c70('0x36')](_0x736fba);}else{return _0x1d4764;}}})[_0x1c70('0x22')](function(_0x5ed50f){_0x48d57d[_0x1c70('0x90')]=_0x5ed50f[_0x1c70('0x61')]({'plain':!![]});_0x48d57d['interaction'][_0x1c70('0x91')]=_0x336b36;if(_0x48d57d[_0x1c70('0x90')][_0x1c70('0x91')]){if(_0x48d57d[_0x1c70('0x82')][_0x1c70('0x92')]){_0x48d57d[_0x1c70('0x83')][_0x1c70('0x93')]({'id':0x0,'priority':_0x48d57d['applications'][_0x1c70('0x4a')]+0x1,'app':_0x1c70('0x94'),'appdata':_0x1c70('0x95'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x1c70('0x5e')]({'body':_0x241d27[_0x1c70('0x5f')][_0x1c70('0x5f')],'OpenchannelAccountId':_0x241d27[_0x1c70('0x59')]['id'],'OpenchannelInteractionId':_0x5ed50f['id'],'direction':'in','ContactId':_0x48d57d[_0x1c70('0x87')]['id'],'AttachmentId':_0x241d27['body']['AttachmentId']});})[_0x1c70('0x22')](function(_0x10f629){_0x48d57d[_0x1c70('0x28')]=_0x10f629;if(_0x48d57d[_0x1c70('0x90')][_0x1c70('0x96')]){return db[_0x1c70('0x97')][_0x1c70('0x5d')]({'attributes':['id','name'],'where':{'id':_0x48d57d[_0x1c70('0x90')][_0x1c70('0x96')]}})[_0x1c70('0x22')](function(_0x439801){if(_0x439801){_0x48d57d[_0x1c70('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1c70('0x98'),'appdata':_0x439801[_0x1c70('0x43')]+','+(_0x48d57d[_0x1c70('0x82')][_0x1c70('0x99')]||0xa),'interval':_0x1c70('0x9a')});_0x48d57d['forcedOwnership']=![];}return respondWithRpcPromise(_0x1c70('0x9b'),_0x1c70('0x9c'),_0x48d57d);});}return respondWithRpcPromise('Start',_0x1c70('0x9c'),_0x48d57d);})[_0x1c70('0x22')](function(_0x3a5cc4){respondWithRpcPromise(_0x1c70('0x9d'),_0x1c70('0x9d'),{'event':_0x1c70('0x6d'),'message':_0x3a5cc4},client9002);return _0x3a5cc4;})[_0x1c70('0x22')](respondWithResult(_0x4e4fb8,null))['catch'](handleError(_0x4e4fb8,null));};exports[_0x1c70('0x9e')]=function(_0x52f8e2,_0x231d4d){var _0x5167a2=_0x52f8e2[_0x1c70('0x59')]['id'];var _0x335ec2=_0x52f8e2[_0x1c70('0x5f')];var _0x5e6c0f=0xc8;var _0x12a354=null;return db['sequelize'][_0x1c70('0x9f')]({'isolationLevel':db['sequelize'][_0x1c70('0xa0')][_0x1c70('0xa1')][_0x1c70('0xa2')]},function(_0x2bf91c){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5167a2},'transaction':_0x2bf91c})[_0x1c70('0x22')](function(_0x354703){if(_0x354703){return db[_0x1c70('0xa3')][_0x1c70('0x37')]({'where':{'OpenchannelAccountId':_0x5167a2},'transaction':_0x2bf91c})[_0x1c70('0x22')](function(){var _0x4738e3=_[_0x1c70('0x3e')](_0x335ec2,function(_0x1c337c){_0x1c337c['OpenchannelAccountId']=_0x5167a2;return _0x1c337c;});return db['OpenchannelApplication'][_0x1c70('0xa4')](_0x4738e3,{'transaction':_0x2bf91c});});}else{_0x5e6c0f=0x194;_0x12a354=[];}});})['then'](function(){if(_0x5e6c0f!==0x194){return db[_0x1c70('0xa3')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5167a2},'order':_0x1c70('0x85')})['then'](function(_0x24828d){_0x12a354=_0x24828d;});}})[_0x1c70('0x58')](function(_0xd4cb13){_0x5e6c0f=0x1f4;logger[_0x1c70('0x26')](_0xd4cb13['stack']);if(_0xd4cb13[_0x1c70('0x43')]){delete _0xd4cb13[_0x1c70('0x43')];}_0x12a354=_0xd4cb13;})[_0x1c70('0xa5')](function(){if(_0x12a354===null){_0x231d4d[_0x1c70('0x2b')](_0x5e6c0f);}else{if(_0x5e6c0f===0x1f4){_0x231d4d[_0x1c70('0x2d')](_0x5e6c0f)[_0x1c70('0x3a')](_0x12a354);}else{_0x231d4d[_0x1c70('0x2d')](_0x5e6c0f)['json'](_0x12a354);}}});};exports[_0x1c70('0xa6')]=function(_0x413408,_0x410539,_0x6eb9c){var _0x5567ad={};var _0xe7090e={};var _0x276233;var _0x336625;return db[_0x1c70('0x3f')][_0x1c70('0x68')]({'where':{'id':_0x413408['params']['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x410539,null))[_0x1c70('0x22')](function(_0x1fbd8e){if(_0x1fbd8e){_0x276233=_0x1fbd8e;_0xe7090e[_0x1c70('0x47')]=_[_0x1c70('0x45')](db[_0x1c70('0xa3')][_0x1c70('0x40')]);_0xe7090e[_0x1c70('0x44')]=_[_0x1c70('0x45')](_0x413408[_0x1c70('0x44')]);_0xe7090e[_0x1c70('0x46')]=_[_0x1c70('0x5a')](_0xe7090e['model'],_0xe7090e['query']);_0x5567ad['attributes']=_[_0x1c70('0x5a')](_0xe7090e[_0x1c70('0x47')],qs[_0x1c70('0x49')](_0x413408['query'][_0x1c70('0x49')]));_0x5567ad[_0x1c70('0x48')]=_0x5567ad[_0x1c70('0x48')][_0x1c70('0x4a')]?_0x5567ad['attributes']:_0xe7090e[_0x1c70('0x47')];_0x5567ad[_0x1c70('0x4d')]=qs['sort'](_0x413408[_0x1c70('0x44')][_0x1c70('0x4e')]);_0x5567ad['where']=qs[_0x1c70('0x46')](_['pick'](_0x413408[_0x1c70('0x44')],_0xe7090e['filters']));if(_0x413408[_0x1c70('0x44')][_0x1c70('0x51')]){_0x5567ad[_0x1c70('0x4f')]=_[_0x1c70('0x52')](_0x5567ad[_0x1c70('0x4f')],{'$or':_[_0x1c70('0x3e')](_0x5567ad[_0x1c70('0x48')],function(_0x371b92){var _0x1158e0={};_0x1158e0[_0x371b92]={'$like':'%'+_0x413408[_0x1c70('0x44')][_0x1c70('0x51')]+'%'};return _0x1158e0;})});}_0x5567ad=_['merge']({},_0x5567ad,_0x413408[_0x1c70('0x5c')]);return _0x276233[_0x1c70('0xa6')](_0x5567ad);}})['then'](function(_0x3ff254){if(_0x3ff254){_0x336625=_0x3ff254[_0x1c70('0x4a')];if(!_0x413408[_0x1c70('0x44')][_0x1c70('0x4b')](_0x1c70('0x4c'))){_0x5567ad['limit']=qs[_0x1c70('0x31')](_0x413408[_0x1c70('0x44')][_0x1c70('0x31')]);_0x5567ad[_0x1c70('0x2f')]=qs[_0x1c70('0x2f')](_0x413408[_0x1c70('0x44')][_0x1c70('0x2f')]);}return _0x276233['getApplications'](_0x5567ad);}})[_0x1c70('0x22')](function(_0x35cc83){if(_0x35cc83){return _0x35cc83?{'count':_0x336625,'rows':_0x35cc83}:null;}})[_0x1c70('0x22')](respondWithResult(_0x410539,null))[_0x1c70('0x58')](handleError(_0x410539,null));};exports['getInteractions']=function(_0x56c19a,_0x16a6ec,_0x14cca2){var _0x597335={'raw':![],'where':{}};var _0x261245={};var _0x45fd37={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1c70('0x68')]({'where':{'id':_0x56c19a[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x16a6ec,null))[_0x1c70('0x22')](function(_0x1b7a3e){if(_0x1b7a3e){_0x261245[_0x1c70('0x47')]=_['keys'](db[_0x1c70('0x8d')][_0x1c70('0x40')]);_0x261245['query']=_['keys'](_0x56c19a[_0x1c70('0x44')]);_0x261245['filters']=_[_0x1c70('0x5a')](_0x261245[_0x1c70('0x47')],_0x261245[_0x1c70('0x44')]);_0x597335['attributes']=_['intersection'](_0x261245['model'],qs['fields'](_0x56c19a[_0x1c70('0x44')][_0x1c70('0x49')]));_0x597335[_0x1c70('0x48')]=_0x597335[_0x1c70('0x48')][_0x1c70('0x4a')]?_0x597335[_0x1c70('0x48')]:_0x261245[_0x1c70('0x47')];if(!_0x56c19a[_0x1c70('0x44')][_0x1c70('0x4b')]('nolimit')){_0x597335['limit']=qs[_0x1c70('0x31')](_0x56c19a[_0x1c70('0x44')]['limit']);_0x597335[_0x1c70('0x2f')]=qs[_0x1c70('0x2f')](_0x56c19a[_0x1c70('0x44')][_0x1c70('0x2f')]);}_0x597335[_0x1c70('0x4d')]=qs[_0x1c70('0x4e')](_0x56c19a[_0x1c70('0x44')][_0x1c70('0x4e')]);_0x597335['where']=qs[_0x1c70('0x46')](_[_0x1c70('0x50')](_0x56c19a[_0x1c70('0x44')],_0x261245[_0x1c70('0x46')]));_0x597335[_0x1c70('0x4f')][_0x1c70('0x66')]=_0x1b7a3e['id'];if(_0x56c19a[_0x1c70('0x44')][_0x1c70('0x51')]){_0x597335[_0x1c70('0x4f')]=_[_0x1c70('0x52')](_0x597335['where'],{'$or':_[_0x1c70('0x3e')](_0x597335[_0x1c70('0x48')],function(_0x564282){var _0x1dddc8={};_0x1dddc8[_0x564282]={'$like':'%'+_0x56c19a[_0x1c70('0x44')][_0x1c70('0x51')]+'%'};return _0x1dddc8;})});}_0x597335=_[_0x1c70('0x52')]({},_0x597335,_0x56c19a[_0x1c70('0x5c')]);return db[_0x1c70('0x8d')][_0x1c70('0x54')]({'where':_0x597335[_0x1c70('0x4f')]})['then'](function(_0x311b64){_0x45fd37[_0x1c70('0x54')]=_0x311b64;if(_0x56c19a[_0x1c70('0x44')]['includeAll']){_0x597335[_0x1c70('0x55')]=[{'model':db[_0x1c70('0x6f')],'as':_0x1c70('0xa7'),'required':![]},{'model':db[_0x1c70('0x97')],'as':_0x1c70('0xa8'),'attributes':[_0x1c70('0x43'),_0x1c70('0xa9'),_0x1c70('0xaa')],'required':![]},{'model':db[_0x1c70('0xab')],'as':_0x1c70('0xac'),'attributes':['id',_0x1c70('0x43'),_0x1c70('0xad')],'where':_0x56c19a['query'][_0x1c70('0xae')]?{'id':_0x56c19a[_0x1c70('0x44')][_0x1c70('0xae')]}:undefined,'required':_0x56c19a[_0x1c70('0x44')][_0x1c70('0xae')]?!![]:![]}];}return db[_0x1c70('0x8d')][_0x1c70('0x56')](_0x597335);})[_0x1c70('0x22')](function(_0x3ec3c4){_0x45fd37[_0x1c70('0x57')]=_0x3ec3c4;return _0x45fd37;});}})[_0x1c70('0x22')](respondWithFilteredResult(_0x16a6ec,_0x597335))[_0x1c70('0x58')](handleError(_0x16a6ec,null));};exports[_0x1c70('0xaf')]=function(_0x2629cd,_0x3161a0,_0x52622c){return db['OpenchannelAccount'][_0x1c70('0x5d')]({'where':{'id':_0x2629cd['params']['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x3161a0,null))[_0x1c70('0x22')](function(_0x4839e5){if(_0x4839e5){return _0x4839e5[_0x1c70('0xaf')](_0x2629cd[_0x1c70('0x5f')][_0x1c70('0xb0')],_[_0x1c70('0xb1')](_0x2629cd[_0x1c70('0x5f')],[_0x1c70('0xb0'),'id'])||{})[_0x1c70('0x8e')](function(_0x1d8e21){for(var _0x2d34b5=0x0;_0x2d34b5<_0x2629cd['body']['ids']['length'];_0x2d34b5+=0x1){socket[_0x1c70('0xb2')](_0x1c70('0xb3'),{'UserId':Number(_0x2629cd[_0x1c70('0x5f')]['ids'][_0x2d34b5]),'OpenchannelAccountId':Number(_0x2629cd['params']['id'])});}return _0x1d8e21;});}})[_0x1c70('0x22')](respondWithResult(_0x3161a0,null))['catch'](handleError(_0x3161a0,null));};exports[_0x1c70('0xb4')]=function(_0x4abde0,_0x5116ba,_0xa50b1f){return db['OpenchannelAccount'][_0x1c70('0x5d')]({'where':{'id':_0x4abde0['params']['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x5116ba,null))['then'](function(_0x4bd50e){if(_0x4bd50e){return _0x4bd50e[_0x1c70('0xb4')](_0x4abde0[_0x1c70('0x44')][_0x1c70('0xb0')])['then'](function(){if(_[_0x1c70('0xb5')](_0x4abde0['query']['ids'])){for(var _0x251420=0x0;_0x251420<_0x4abde0[_0x1c70('0x44')]['ids'][_0x1c70('0x4a')];_0x251420+=0x1){socket[_0x1c70('0xb2')](_0x1c70('0xb6'),{'UserId':Number(_0x4abde0[_0x1c70('0x44')]['ids'][_0x251420]),'OpenchannelAccountId':Number(_0x4abde0[_0x1c70('0x59')]['id'])});}}else{socket[_0x1c70('0xb2')](_0x1c70('0xb6'),{'UserId':Number(_0x4abde0['query'][_0x1c70('0xb0')]),'OpenchannelAccountId':Number(_0x4abde0[_0x1c70('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5116ba,null))[_0x1c70('0x58')](handleError(_0x5116ba,null));};exports[_0x1c70('0xb7')]=function(_0x44116d,_0x50ba97,_0x12cd2e){var _0x15953e={};var _0x18268b={};var _0x46745c;var _0x1d5445;return db[_0x1c70('0x3f')][_0x1c70('0x68')]({'where':{'id':_0x44116d[_0x1c70('0x59')]['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x50ba97,null))['then'](function(_0x2f52a6){if(_0x2f52a6){_0x46745c=_0x2f52a6;_0x18268b[_0x1c70('0x47')]=_['keys'](db['User'][_0x1c70('0x40')]);_0x18268b[_0x1c70('0x44')]=_['keys'](_0x44116d['query']);_0x18268b['filters']=_['intersection'](_0x18268b[_0x1c70('0x47')],_0x18268b['query']);_0x15953e[_0x1c70('0x48')]=_['intersection'](_0x18268b[_0x1c70('0x47')],qs[_0x1c70('0x49')](_0x44116d[_0x1c70('0x44')][_0x1c70('0x49')]));_0x15953e[_0x1c70('0x48')]=_0x15953e[_0x1c70('0x48')][_0x1c70('0x4a')]?_0x15953e[_0x1c70('0x48')]:_0x18268b[_0x1c70('0x47')];_0x15953e[_0x1c70('0x4d')]=qs[_0x1c70('0x4e')](_0x44116d[_0x1c70('0x44')][_0x1c70('0x4e')]);_0x15953e['where']=qs[_0x1c70('0x46')](_['pick'](_0x44116d[_0x1c70('0x44')],_0x18268b['filters']));if(_0x44116d['query'][_0x1c70('0x51')]){_0x15953e['where']=_[_0x1c70('0x52')](_0x15953e['where'],{'$or':_['map'](_0x15953e['attributes'],function(_0x2c983f){var _0x1e124c={};_0x1e124c[_0x2c983f]={'$like':'%'+_0x44116d[_0x1c70('0x44')][_0x1c70('0x51')]+'%'};return _0x1e124c;})});}_0x15953e=_[_0x1c70('0x52')]({},_0x15953e,_0x44116d[_0x1c70('0x5c')]);return _0x46745c[_0x1c70('0xb7')](_0x15953e);}})[_0x1c70('0x22')](function(_0xd58d33){if(_0xd58d33){_0x1d5445=_0xd58d33[_0x1c70('0x4a')];if(!_0x44116d[_0x1c70('0x44')]['hasOwnProperty']('nolimit')){_0x15953e['limit']=qs[_0x1c70('0x31')](_0x44116d[_0x1c70('0x44')][_0x1c70('0x31')]);_0x15953e['offset']=qs['offset'](_0x44116d[_0x1c70('0x44')][_0x1c70('0x2f')]);}return _0x46745c['getAgents'](_0x15953e);}})['then'](function(_0x44b00b){if(_0x44b00b){return _0x44b00b?{'count':_0x1d5445,'rows':_0x44b00b}:null;}})[_0x1c70('0x22')](respondWithResult(_0x50ba97,null))[_0x1c70('0x58')](handleError(_0x50ba97,null));};exports['send']=function(_0xaa260f,_0x2f1a64,_0x570392){var _0x30e1e4,_0xe9c250,_0x304e4f;if(_['isNil'](_0xaa260f[_0x1c70('0x5f')]['body'])||_0xaa260f[_0x1c70('0x5f')][_0x1c70('0x5f')]===''){throw new db[(_0x1c70('0x79'))][(_0x1c70('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xaa260f[_0x1c70('0x5f')]['to'])){}_0x30e1e4=_0xaa260f[_0x1c70('0x5f')]['to'];return db[_0x1c70('0x3f')]['findOne']({'where':{'id':_0xaa260f['params']['id']}})[_0x1c70('0x22')](handleEntityNotFound(_0x2f1a64,null))[_0x1c70('0x22')](function(_0x2369ef){if(_0x2369ef){return db['OpenchannelAccount'][_0x1c70('0x5d')]({'where':{'id':_0x2369ef['id']},'include':[{'model':db[_0x1c70('0x7d')],'as':'List','include':[{'model':db[_0x1c70('0x6f')],'as':'Contacts','where':{[_0x2369ef[_0x1c70('0x7c')]]:_0x30e1e4},'limit':0x1,'order':[[_0x1c70('0x73'),_0x1c70('0x7f')]]}]}]})[_0x1c70('0x22')](handleEntityNotFound(_0x2f1a64,null))[_0x1c70('0x22')](function(_0x1cfc48){if(_0x1cfc48&&_0x1cfc48[_0x1c70('0x81')]){_0xe9c250=_0x1cfc48[_0x1c70('0x61')]({'plain':!![]});if(_0xe9c250[_0x1c70('0x81')]&&_0xe9c250[_0x1c70('0x81')]['Contacts'][_0x1c70('0x4a')]){return _0xe9c250[_0x1c70('0x81')]['Contacts'][0x0];}return db[_0x1c70('0x6f')][_0x1c70('0x5e')](_[_0x1c70('0x1b')](_0xaa260f[_0x1c70('0x5f')],{'firstName':_0x30e1e4,[_0x1cfc48['mapKey']]:_0x30e1e4,'phone':_0x30e1e4,'ListId':_0xe9c250[_0x1c70('0x75')]}));}})[_0x1c70('0x22')](handleEntityNotFound(_0x2f1a64,null))[_0x1c70('0x22')](function(_0x581874){if(_0x581874){_0x304e4f=_0x581874;return db[_0x1c70('0x8d')][_0x1c70('0x5d')]({'where':{'ContactId':_0x304e4f['id'],'closed':![],'OpenchannelAccountId':_0xe9c250['id']}})['then'](function(_0x4e6c11){if(_0x4e6c11){return[_0x4e6c11,![]];}return db[_0x1c70('0x8d')][_0x1c70('0x5e')]({'UserId':_0xaa260f[_0x1c70('0x60')]['id'],'ContactId':_0x304e4f['id'],'OpenchannelAccountId':_0xe9c250['id'],'lastMsgDirection':_0x1c70('0xb8'),'Messages':[_[_0x1c70('0x52')](_0xaa260f[_0x1c70('0x5f')],{'read':![],'body':_0xaa260f[_0x1c70('0x5f')][_0x1c70('0x5f')],'OpenchannelAccountId':_0xe9c250['id'],'UserId':_0xaa260f['user']['id'],'ContactId':_0x304e4f['id']})]},{'include':[{'model':db[_0x1c70('0xb9')],'as':'Messages'}]})[_0x1c70('0x22')](function(_0x4f5da4){return[_0x4f5da4,!![]];});});}})[_0x1c70('0x8e')](function(_0x1d7900,_0x5eb5ce){if(_0x5eb5ce){return _0x1d7900;}return db['OpenchannelMessage'][_0x1c70('0x5e')](_[_0x1c70('0x52')](_0xaa260f[_0x1c70('0x5f')],{'read':![],'body':_0xaa260f['body'][_0x1c70('0x5f')],'OpenchannelAccountId':_0xe9c250['id'],'OpenchannelInteractionId':_0x1d7900['id'],'UserId':_0xaa260f[_0x1c70('0x60')]['id'],'ContactId':_0x304e4f['id']}))['then'](function(_0x1b39ea){_0x1d7900[_0x1c70('0xba')][_0x1c70('0xbb')]=[];_0x1d7900['dataValues'][_0x1c70('0xbb')][_0x1c70('0x93')](_0x1b39ea['dataValues']);return _0x1d7900;});});}})[_0x1c70('0x22')](respondWithResult(_0x2f1a64,null))[_0x1c70('0x58')](handleError(_0x2f1a64,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index c2afe96..196aec3 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 _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x33f59b,_0x2df3b2){var _0x13f10e=function(_0x5388d5){while(--_0x5388d5){_0x33f59b['push'](_0x33f59b['shift']());}};_0x13f10e(++_0x2df3b2);}(_0x70e0,0x17b));var _0x070e=function(_0x25d065,_0x40f886){_0x25d065=_0x25d065-0x0;var _0x32731a=_0x70e0[_0x25d065];return _0x32731a;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f0d=['remove','emit','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x585a04,_0x2522ab){var _0x4cebda=function(_0x3fd0eb){while(--_0x3fd0eb){_0x585a04['push'](_0x585a04['shift']());}};_0x4cebda(++_0x2522ab);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x345f08,_0x5cd462){_0x345f08=_0x345f08-0x0;var _0x5d0290=_0x6f0d[_0x345f08];return _0x5d0290;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xd6f0('0x0'))['db'][_0xd6f0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd6f0('0x2')](0x0);var events={'afterCreate':_0xd6f0('0x3'),'afterUpdate':'update','afterDestroy':_0xd6f0('0x4')};function emitEvent(_0x135a93){return function(_0x2f78fb,_0x25344b,_0x3a757f){OpenchannelAccountEvents['emit'](_0x135a93+':'+_0x2f78fb['id'],_0x2f78fb);OpenchannelAccountEvents[_0xd6f0('0x5')](_0x135a93,_0x2f78fb);_0x3a757f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xd6f0('0x6')](e,emitEvent(event));}}module[_0xd6f0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 32cfc4f..68e9e60 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(_0x32e0c0,_0x4a1ce1){var _0x214c43=function(_0x1549c7){while(--_0x1549c7){_0x32e0c0['push'](_0x32e0c0['shift']());}};_0x214c43(++_0x4a1ce1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x4d3456,_0x174242){var _0x2266f0=function(_0x48afbf){while(--_0x48afbf){_0x4d3456['push'](_0x4d3456['shift']());}};_0x2266f0(++_0x174242);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 54f1d7a..5ae209d 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 _0x69d3=['socket.io-emitter','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4297a2,_0x436306){var _0x2a7c75=function(_0x298895){while(--_0x298895){_0x4297a2['push'](_0x4297a2['shift']());}};_0x2a7c75(++_0x436306);}(_0x69d3,0xda));var _0x369d=function(_0x3dffb7,_0x4522b2){_0x3dffb7=_0x3dffb7-0x0;var _0x4eac8f=_0x69d3[_0x3dffb7];return _0x4eac8f;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});config[_0x369d('0x9')]=_[_0x369d('0xa')](config[_0x369d('0x9')],{'host':_0x369d('0xb'),'port':0x18eb});var socket=require(_0x369d('0xc'))(new Redis(config[_0x369d('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x28bf6e,_0x222f5f,_0xe864f0){return new BPromise(function(_0x1cf530,_0x4c7850){return client['request'](_0x28bf6e,_0xe864f0)[_0x369d('0xd')](function(_0x40c00f){logger[_0x369d('0xe')](_0x369d('0xf'),_0x222f5f,_0x369d('0x10'));logger[_0x369d('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x222f5f,_0x369d('0x10'),JSON[_0x369d('0x12')](_0x40c00f));if(_0x40c00f[_0x369d('0x13')]){if(_0x40c00f[_0x369d('0x13')][_0x369d('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x222f5f,_0x40c00f['error'][_0x369d('0x15')]);return _0x4c7850(_0x40c00f[_0x369d('0x13')][_0x369d('0x15')]);}logger['error'](_0x369d('0xf'),_0x222f5f,_0x40c00f[_0x369d('0x13')][_0x369d('0x15')]);return _0x1cf530(_0x40c00f['error'][_0x369d('0x15')]);}else{logger[_0x369d('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x222f5f,'request\x20sent');_0x1cf530(_0x40c00f['result'][_0x369d('0x15')]);}})[_0x369d('0x16')](function(_0x247a3b){logger['error'](_0x369d('0xf'),_0x222f5f,_0x247a3b);_0x4c7850(_0x247a3b);});});} \ No newline at end of file +var _0x2bb0=['lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch'];(function(_0x5a2f4c,_0x76e21a){var _0x462311=function(_0x1c1818){while(--_0x1c1818){_0x5a2f4c['push'](_0x5a2f4c['shift']());}};_0x462311(++_0x76e21a);}(_0x2bb0,0xf3));var _0x02bb=function(_0x1cf733,_0x510c9a){_0x1cf733=_0x1cf733-0x0;var _0x4811d1=_0x2bb0[_0x1cf733];return _0x4811d1;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var moment=require(_0x02bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x02bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02bb('0x4'));var logger=require('../../config/logger')(_0x02bb('0x5'));var config=require(_0x02bb('0x6'));var jayson=require(_0x02bb('0x7'));var client=jayson[_0x02bb('0x8')][_0x02bb('0x9')]({'port':0x232a});config[_0x02bb('0xa')]=_[_0x02bb('0xb')](config['redis'],{'host':_0x02bb('0xc'),'port':0x18eb});var socket=require(_0x02bb('0xd'))(new Redis(config[_0x02bb('0xa')]));require('./openchannelAccount.socket')[_0x02bb('0xe')](socket);function respondWithRpcPromise(_0x5a4a7f,_0x3edabe,_0x1863ec){return new BPromise(function(_0x4d3418,_0x3f861e){return client[_0x02bb('0xf')](_0x5a4a7f,_0x1863ec)[_0x02bb('0x10')](function(_0x523480){logger[_0x02bb('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x3edabe,_0x02bb('0x12'));logger[_0x02bb('0x13')](_0x02bb('0x14'),_0x3edabe,'request\x20sent',JSON[_0x02bb('0x15')](_0x523480));if(_0x523480[_0x02bb('0x16')]){if(_0x523480[_0x02bb('0x16')]['code']===0x1f4){logger[_0x02bb('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x3edabe,_0x523480[_0x02bb('0x16')][_0x02bb('0x17')]);return _0x3f861e(_0x523480[_0x02bb('0x16')][_0x02bb('0x17')]);}logger[_0x02bb('0x16')](_0x02bb('0x18'),_0x3edabe,_0x523480['error']['message']);return _0x4d3418(_0x523480[_0x02bb('0x16')][_0x02bb('0x17')]);}else{logger[_0x02bb('0x11')](_0x02bb('0x18'),_0x3edabe,_0x02bb('0x12'));_0x4d3418(_0x523480[_0x02bb('0x19')]['message']);}})[_0x02bb('0x1a')](function(_0x4b3f78){logger[_0x02bb('0x16')](_0x02bb('0x18'),_0x3edabe,_0x4b3f78);_0x3f861e(_0x4b3f78);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 344d565..3e66646 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 _0xffaa=['removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','emit'];(function(_0x2bbb24,_0xaec5df){var _0x449653=function(_0x233fab){while(--_0x233fab){_0x2bbb24['push'](_0x2bbb24['shift']());}};_0x449653(++_0xaec5df);}(_0xffaa,0x130));var _0xaffa=function(_0x9f4e6c,_0x583cd7){_0x9f4e6c=_0x9f4e6c-0x0;var _0x1eb607=_0xffaa[_0x9f4e6c];return _0x1eb607;};'use strict';var OpenchannelAccountEvents=require(_0xaffa('0x0'));var events=[_0xaffa('0x1'),_0xaffa('0x2'),'update'];function createListener(_0x5d597a,_0x124832){return function(_0x2433d9){_0x124832[_0xaffa('0x3')](_0x5d597a,_0x2433d9);};}function removeListener(_0xd01185,_0x444eef){return function(){OpenchannelAccountEvents[_0xaffa('0x4')](_0xd01185,_0x444eef);};}exports[_0xaffa('0x5')]=function(_0x40a369){for(var _0x4306c0=0x0,_0x281191=events['length'];_0x4306c0<_0x281191;_0x4306c0++){var _0xa081be=events[_0x4306c0];var _0x7c018f=createListener(_0xaffa('0x6')+_0xa081be,_0x40a369);OpenchannelAccountEvents['on'](_0xa081be,_0x7c018f);}}; \ No newline at end of file +var _0x6d2e=['openchannelAccount:','save','remove','update','register','length'];(function(_0x1def52,_0x3e0c8d){var _0x269f80=function(_0x22b652){while(--_0x22b652){_0x1def52['push'](_0x1def52['shift']());}};_0x269f80(++_0x3e0c8d);}(_0x6d2e,0x97));var _0xe6d2=function(_0x141749,_0x477b04){_0x141749=_0x141749-0x0;var _0x3e6932=_0x6d2e[_0x141749];return _0x3e6932;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xe6d2('0x0'),_0xe6d2('0x1'),_0xe6d2('0x2')];function createListener(_0x3ff4b6,_0x412889){return function(_0xf81df7){_0x412889['emit'](_0x3ff4b6,_0xf81df7);};}function removeListener(_0x2dee74,_0x5dc6e4){return function(){OpenchannelAccountEvents['removeListener'](_0x2dee74,_0x5dc6e4);};}exports[_0xe6d2('0x3')]=function(_0x2b4bf0){for(var _0x3c0fab=0x0,_0x4d9c9f=events[_0xe6d2('0x4')];_0x3c0fab<_0x4d9c9f;_0x3c0fab++){var _0x53906e=events[_0x3c0fab];var _0x2e227e=createListener(_0xe6d2('0x5')+_0x53906e,_0x2b4bf0);OpenchannelAccountEvents['on'](_0x53906e,_0x2e227e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3181dbb..de848b5 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 _0xdf31=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x447761,_0x224d03){var _0x54a03c=function(_0x329861){while(--_0x329861){_0x447761['push'](_0x447761['shift']());}};_0x54a03c(++_0x224d03);}(_0xdf31,0x1a4));var _0x1df3=function(_0x3f67ce,_0x373243){_0x3f67ce=_0x3f67ce-0x0;var _0x5e684c=_0xdf31[_0x3f67ce];return _0x5e684c;};'use strict';var multer=require(_0x1df3('0x0'));var util=require(_0x1df3('0x1'));var path=require(_0x1df3('0x2'));var timeout=require(_0x1df3('0x3'));var express=require(_0x1df3('0x4'));var router=express[_0x1df3('0x5')]();var fs_extra=require(_0x1df3('0x6'));var auth=require(_0x1df3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1df3('0x8'));var controller=require(_0x1df3('0x9'));router[_0x1df3('0xa')]('/',auth[_0x1df3('0xb')](),controller['index']);router[_0x1df3('0xa')]('/:id',auth[_0x1df3('0xb')](),controller[_0x1df3('0xc')]);router[_0x1df3('0xd')]('/',auth[_0x1df3('0xb')](),controller[_0x1df3('0xe')]);router[_0x1df3('0xf')](_0x1df3('0x10'),auth[_0x1df3('0xb')](),controller[_0x1df3('0x11')]);router[_0x1df3('0x12')](_0x1df3('0x10'),auth[_0x1df3('0xb')](),controller[_0x1df3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x486d=['/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0x486d,0x1b7));var _0xd486=function(_0x3703fa,_0x126163){_0x3703fa=_0x3703fa-0x0;var _0x310469=_0x486d[_0x3703fa];return _0x310469;};'use strict';var multer=require(_0xd486('0x0'));var util=require('util');var path=require(_0xd486('0x1'));var timeout=require(_0xd486('0x2'));var express=require(_0xd486('0x3'));var router=express[_0xd486('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd486('0x5'));var config=require(_0xd486('0x6'));var controller=require(_0xd486('0x7'));router['get']('/',auth[_0xd486('0x8')](),controller[_0xd486('0x9')]);router[_0xd486('0xa')](_0xd486('0xb'),auth['isAuthenticated'](),controller[_0xd486('0xc')]);router['post']('/',auth[_0xd486('0x8')](),controller[_0xd486('0xd')]);router[_0xd486('0xe')](_0xd486('0xb'),auth['isAuthenticated'](),controller[_0xd486('0xf')]);router[_0xd486('0x10')](_0xd486('0xb'),auth[_0xd486('0x8')](),controller[_0xd486('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 25de85c..1435416 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 _0x9080=['sequelize','noop','TEXT','STRING'];(function(_0x151ec9,_0x3d974f){var _0x1af291=function(_0x4c0665){while(--_0x4c0665){_0x151ec9['push'](_0x151ec9['shift']());}};_0x1af291(++_0x3d974f);}(_0x9080,0x198));var _0x0908=function(_0x53382d,_0x30bd84){_0x53382d=_0x53382d-0x0;var _0xe13401=_0x9080[_0x53382d];return _0xe13401;};'use strict';var Sequelize=require(_0x0908('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0908('0x1')},'appdata':{'type':Sequelize[_0x0908('0x2')]()},'description':{'type':Sequelize[_0x0908('0x3')]},'interval':{'type':Sequelize[_0x0908('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xaf8d=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x341802,_0x3722f4){var _0x3c75d7=function(_0x8cad00){while(--_0x8cad00){_0x341802['push'](_0x341802['shift']());}};_0x3c75d7(++_0x3722f4);}(_0xaf8d,0xb3));var _0xdaf8=function(_0x44eb3c,_0x37190b){_0x44eb3c=_0x44eb3c-0x0;var _0x25ac57=_0xaf8d[_0x44eb3c];return _0x25ac57;};'use strict';var Sequelize=require('sequelize');module[_0xdaf8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdaf8('0x1')],'allowNull':![],'defaultValue':_0xdaf8('0x2')},'appdata':{'type':Sequelize[_0xdaf8('0x3')]()},'description':{'type':Sequelize[_0xdaf8('0x1')]},'interval':{'type':Sequelize[_0xdaf8('0x1')],'defaultValue':_0xdaf8('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b75a68c..d14148d 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 _0x54ee=['pick','filter','merge','options','include','rows','catch','params','includeAll','find','create','body','eml-format','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2e4aad,_0x3f3fae){var _0x395b4b=function(_0x1c28ba){while(--_0x1c28ba){_0x2e4aad['push'](_0x2e4aad['shift']());}};_0x395b4b(++_0x3f3fae);}(_0x54ee,0xe7));var _0xe54e=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x54ee[_0x5e36d1];return _0x950b9e;};'use strict';var emlformat=require(_0xe54e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe54e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe54e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe54e('0x3'));var util=require(_0xe54e('0x4'));var path=require(_0xe54e('0x5'));var sox=require('sox');var csv=require(_0xe54e('0x6'));var ejs=require(_0xe54e('0x7'));var fs=require('fs');var fs_extra=require(_0xe54e('0x8'));var _=require(_0xe54e('0x9'));var squel=require('squel');var crypto=require(_0xe54e('0xa'));var jsforce=require(_0xe54e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe54e('0x6'));var querystring=require(_0xe54e('0xc'));var Papa=require('papaparse');var Redis=require(_0xe54e('0xd'));var authService=require(_0xe54e('0xe'));var qs=require(_0xe54e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe54e('0x10'));var logger=require(_0xe54e('0x11'))(_0xe54e('0x12'));var utils=require(_0xe54e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe54e('0x14'));var db=require(_0xe54e('0x15'))['db'];function respondWithStatusCode(_0x396792,_0x299dd2){_0x299dd2=_0x299dd2||0xcc;return function(_0x3e72e9){if(_0x3e72e9){return _0x396792[_0xe54e('0x16')](_0x299dd2);}return _0x396792[_0xe54e('0x17')](_0x299dd2)['end']();};}function respondWithResult(_0x5efb78,_0x1ae660){_0x1ae660=_0x1ae660||0xc8;return function(_0x14665e){if(_0x14665e){return _0x5efb78['status'](_0x1ae660)[_0xe54e('0x18')](_0x14665e);}};}function respondWithFilteredResult(_0x48c589,_0x1cd518){return function(_0x3eda42){if(_0x3eda42){var _0x142f44=typeof _0x1cd518[_0xe54e('0x19')]===_0xe54e('0x1a')&&typeof _0x1cd518[_0xe54e('0x1b')]===_0xe54e('0x1a');var _0x245f11=_0x3eda42['count'];var _0x3848bf=_0x142f44?0x0:_0x1cd518[_0xe54e('0x19')];var _0x151356=_0x142f44?_0x3eda42[_0xe54e('0x1c')]:_0x1cd518['offset']+_0x1cd518[_0xe54e('0x1b')];var _0x184987;if(_0x151356>=_0x245f11){_0x151356=_0x245f11;_0x184987=0xc8;}else{_0x184987=0xce;}_0x48c589[_0xe54e('0x17')](_0x184987);return _0x48c589[_0xe54e('0x1d')](_0xe54e('0x1e'),_0x3848bf+'-'+_0x151356+'/'+_0x245f11)[_0xe54e('0x18')](_0x3eda42);}return null;};}function patchUpdates(_0x47c98c){return function(_0x1b0a05){try{jsonpatch[_0xe54e('0x1f')](_0x1b0a05,_0x47c98c,!![]);}catch(_0x3f04f2){return BPromise[_0xe54e('0x20')](_0x3f04f2);}return _0x1b0a05[_0xe54e('0x21')]();};}function saveUpdates(_0x2aeb7d,_0x53f3be){return function(_0xcb3ba1){if(_0xcb3ba1){return _0xcb3ba1[_0xe54e('0x22')](_0x2aeb7d)[_0xe54e('0x23')](function(_0x9e34ba){return _0x9e34ba;});}return null;};}function removeEntity(_0x19e7d2,_0x16e260){return function(_0x34972f){if(_0x34972f){return _0x34972f[_0xe54e('0x24')]()['then'](function(){_0x19e7d2[_0xe54e('0x17')](0xcc)[_0xe54e('0x25')]();});}};}function handleEntityNotFound(_0x58ff02,_0x20a570){return function(_0x2a34c0){if(!_0x2a34c0){_0x58ff02[_0xe54e('0x16')](0x194);}return _0x2a34c0;};}function handleError(_0x57301b,_0x5eb353){_0x5eb353=_0x5eb353||0x1f4;return function(_0xe5a8e7){logger[_0xe54e('0x26')](_0xe5a8e7[_0xe54e('0x27')]);if(_0xe5a8e7['name']){delete _0xe5a8e7['name'];}_0x57301b['status'](_0x5eb353)[_0xe54e('0x28')](_0xe5a8e7);};}exports[_0xe54e('0x29')]=function(_0x382c6a,_0xd64a2){var _0x363a90={},_0x23d99={},_0x294eda={'count':0x0,'rows':[]};var _0x3dcbed=_[_0xe54e('0x2a')](db[_0xe54e('0x2b')][_0xe54e('0x2c')],function(_0x5d445b){return{'name':_0x5d445b[_0xe54e('0x2d')],'type':_0x5d445b[_0xe54e('0x2e')][_0xe54e('0x2f')]};});_0x23d99[_0xe54e('0x30')]=_[_0xe54e('0x2a')](_0x3dcbed,_0xe54e('0x31'));_0x23d99['query']=_['keys'](_0x382c6a[_0xe54e('0x32')]);_0x23d99[_0xe54e('0x33')]=_['intersection'](_0x23d99[_0xe54e('0x30')],_0x23d99[_0xe54e('0x32')]);_0x363a90[_0xe54e('0x34')]=_[_0xe54e('0x35')](_0x23d99[_0xe54e('0x30')],qs[_0xe54e('0x36')](_0x382c6a[_0xe54e('0x32')][_0xe54e('0x36')]));_0x363a90[_0xe54e('0x34')]=_0x363a90[_0xe54e('0x34')][_0xe54e('0x37')]?_0x363a90[_0xe54e('0x34')]:_0x23d99[_0xe54e('0x30')];if(!_0x382c6a[_0xe54e('0x32')][_0xe54e('0x38')](_0xe54e('0x39'))){_0x363a90[_0xe54e('0x1b')]=qs[_0xe54e('0x1b')](_0x382c6a[_0xe54e('0x32')][_0xe54e('0x1b')]);_0x363a90['offset']=qs[_0xe54e('0x19')](_0x382c6a[_0xe54e('0x32')][_0xe54e('0x19')]);}_0x363a90[_0xe54e('0x3a')]=qs[_0xe54e('0x3b')](_0x382c6a['query'][_0xe54e('0x3b')]);_0x363a90[_0xe54e('0x3c')]=qs['filters'](_[_0xe54e('0x3d')](_0x382c6a[_0xe54e('0x32')],_0x23d99[_0xe54e('0x33')]),_0x3dcbed);if(_0x382c6a['query'][_0xe54e('0x3e')]){_0x363a90[_0xe54e('0x3c')]=_['merge'](_0x363a90[_0xe54e('0x3c')],{'$or':_[_0xe54e('0x2a')](_0x3dcbed,function(_0x57ee28){if(_0x57ee28[_0xe54e('0x2e')]!=='VIRTUAL'){var _0x195c35={};_0x195c35[_0x57ee28['name']]={'$like':'%'+_0x382c6a[_0xe54e('0x32')][_0xe54e('0x3e')]+'%'};return _0x195c35;}})});}_0x363a90=_[_0xe54e('0x3f')]({},_0x363a90,_0x382c6a[_0xe54e('0x40')]);var _0x307045={'where':_0x363a90['where']};return db[_0xe54e('0x2b')][_0xe54e('0x1c')](_0x307045)[_0xe54e('0x23')](function(_0x227f94){_0x294eda[_0xe54e('0x1c')]=_0x227f94;if(_0x382c6a[_0xe54e('0x32')]['includeAll']){_0x363a90[_0xe54e('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x363a90);})[_0xe54e('0x23')](function(_0xbf13f3){_0x294eda[_0xe54e('0x42')]=_0xbf13f3;return _0x294eda;})[_0xe54e('0x23')](respondWithFilteredResult(_0xd64a2,_0x363a90))[_0xe54e('0x43')](handleError(_0xd64a2,null));};exports['show']=function(_0x5ed335,_0x1dc060){var _0x198fe3={'raw':!![],'where':{'id':_0x5ed335[_0xe54e('0x44')]['id']}},_0x30e38e={};_0x30e38e['model']=_['keys'](db['OpenchannelApplication'][_0xe54e('0x2c')]);_0x30e38e['query']=_['keys'](_0x5ed335[_0xe54e('0x32')]);_0x30e38e[_0xe54e('0x33')]=_[_0xe54e('0x35')](_0x30e38e[_0xe54e('0x30')],_0x30e38e[_0xe54e('0x32')]);_0x198fe3[_0xe54e('0x34')]=_[_0xe54e('0x35')](_0x30e38e['model'],qs[_0xe54e('0x36')](_0x5ed335[_0xe54e('0x32')][_0xe54e('0x36')]));_0x198fe3[_0xe54e('0x34')]=_0x198fe3['attributes'][_0xe54e('0x37')]?_0x198fe3[_0xe54e('0x34')]:_0x30e38e['model'];if(_0x5ed335[_0xe54e('0x32')][_0xe54e('0x45')]){_0x198fe3[_0xe54e('0x41')]=[{'all':!![]}];}_0x198fe3=_['merge']({},_0x198fe3,_0x5ed335['options']);return db[_0xe54e('0x2b')][_0xe54e('0x46')](_0x198fe3)[_0xe54e('0x23')](handleEntityNotFound(_0x1dc060,null))[_0xe54e('0x23')](respondWithResult(_0x1dc060,null))[_0xe54e('0x43')](handleError(_0x1dc060,null));};exports['create']=function(_0x547fa5,_0x1fda70){return db[_0xe54e('0x2b')][_0xe54e('0x47')](_0x547fa5['body'],{})[_0xe54e('0x23')](respondWithResult(_0x1fda70,0xc9))[_0xe54e('0x43')](handleError(_0x1fda70,null));};exports[_0xe54e('0x22')]=function(_0x4fd135,_0x4647ad){if(_0x4fd135[_0xe54e('0x48')]['id']){delete _0x4fd135[_0xe54e('0x48')]['id'];}return db[_0xe54e('0x2b')][_0xe54e('0x46')]({'where':{'id':_0x4fd135[_0xe54e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4647ad,null))[_0xe54e('0x23')](saveUpdates(_0x4fd135[_0xe54e('0x48')],null))[_0xe54e('0x23')](respondWithResult(_0x4647ad,null))[_0xe54e('0x43')](handleError(_0x4647ad,null));};exports['destroy']=function(_0x4f95fa,_0x455a87){return db[_0xe54e('0x2b')][_0xe54e('0x46')]({'where':{'id':_0x4f95fa[_0xe54e('0x44')]['id']}})[_0xe54e('0x23')](handleEntityNotFound(_0x455a87,null))[_0xe54e('0x23')](removeEntity(_0x455a87,null))[_0xe54e('0x43')](handleError(_0x455a87,null));}; \ No newline at end of file +var _0x7179=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','end','sendStatus','stack','name','send','index','OpenchannelApplication','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','model','rawAttributes','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','fs-extra','lodash','crypto','desk.js'];(function(_0x386e27,_0x1124fc){var _0x1539b6=function(_0x5427a5){while(--_0x5427a5){_0x386e27['push'](_0x386e27['shift']());}};_0x1539b6(++_0x1124fc);}(_0x7179,0x14e));var _0x9717=function(_0x14becb,_0x23726d){_0x14becb=_0x14becb-0x0;var _0x1ab98c=_0x7179[_0x14becb];return _0x1ab98c;};'use strict';var emlformat=require(_0x9717('0x0'));var rimraf=require(_0x9717('0x1'));var zipdir=require(_0x9717('0x2'));var jsonpatch=require(_0x9717('0x3'));var rp=require(_0x9717('0x4'));var moment=require(_0x9717('0x5'));var BPromise=require(_0x9717('0x6'));var Mustache=require('mustache');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(_0x9717('0x7'));var _=require(_0x9717('0x8'));var squel=require('squel');var crypto=require(_0x9717('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9717('0xa'));var toCsv=require(_0x9717('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9717('0xc'));var authService=require(_0x9717('0xd'));var qs=require(_0x9717('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9717('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9717('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x9717('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356ea2,_0x252e2e){_0x252e2e=_0x252e2e||0xcc;return function(_0x590e2d){if(_0x590e2d){return _0x356ea2['sendStatus'](_0x252e2e);}return _0x356ea2[_0x9717('0x12')](_0x252e2e)['end']();};}function respondWithResult(_0x37aac1,_0x4d73db){_0x4d73db=_0x4d73db||0xc8;return function(_0x5a1b8d){if(_0x5a1b8d){return _0x37aac1[_0x9717('0x12')](_0x4d73db)[_0x9717('0x13')](_0x5a1b8d);}};}function respondWithFilteredResult(_0x1ff41c,_0x1d1014){return function(_0xb97b0a){if(_0xb97b0a){var _0x5548c3=typeof _0x1d1014[_0x9717('0x14')]===_0x9717('0x15')&&typeof _0x1d1014[_0x9717('0x16')]===_0x9717('0x15');var _0x3f54ad=_0xb97b0a['count'];var _0x4836d2=_0x5548c3?0x0:_0x1d1014[_0x9717('0x14')];var _0x355656=_0x5548c3?_0xb97b0a[_0x9717('0x17')]:_0x1d1014[_0x9717('0x14')]+_0x1d1014[_0x9717('0x16')];var _0x4ca0ac;if(_0x355656>=_0x3f54ad){_0x355656=_0x3f54ad;_0x4ca0ac=0xc8;}else{_0x4ca0ac=0xce;}_0x1ff41c[_0x9717('0x12')](_0x4ca0ac);return _0x1ff41c['set'](_0x9717('0x18'),_0x4836d2+'-'+_0x355656+'/'+_0x3f54ad)['json'](_0xb97b0a);}return null;};}function patchUpdates(_0x1f862e){return function(_0x1a413e){try{jsonpatch[_0x9717('0x19')](_0x1a413e,_0x1f862e,!![]);}catch(_0x245da4){return BPromise['reject'](_0x245da4);}return _0x1a413e[_0x9717('0x1a')]();};}function saveUpdates(_0x822c9f,_0x3aed0a){return function(_0x5b3da7){if(_0x5b3da7){return _0x5b3da7[_0x9717('0x1b')](_0x822c9f)['then'](function(_0x53c01c){return _0x53c01c;});}return null;};}function removeEntity(_0x28738,_0x21c137){return function(_0x1ab6cb){if(_0x1ab6cb){return _0x1ab6cb[_0x9717('0x1c')]()[_0x9717('0x1d')](function(){_0x28738[_0x9717('0x12')](0xcc)[_0x9717('0x1e')]();});}};}function handleEntityNotFound(_0x2ecea7,_0x3dc07f){return function(_0x4cc579){if(!_0x4cc579){_0x2ecea7[_0x9717('0x1f')](0x194);}return _0x4cc579;};}function handleError(_0x102687,_0x1146af){_0x1146af=_0x1146af||0x1f4;return function(_0x5e3fad){logger['error'](_0x5e3fad[_0x9717('0x20')]);if(_0x5e3fad[_0x9717('0x21')]){delete _0x5e3fad['name'];}_0x102687[_0x9717('0x12')](_0x1146af)[_0x9717('0x22')](_0x5e3fad);};}exports[_0x9717('0x23')]=function(_0x3e2718,_0x35ecf6){var _0x2516e5={},_0x4c3d6f={},_0x2a3f5d={'count':0x0,'rows':[]};var _0x169c00=_['map'](db[_0x9717('0x24')]['rawAttributes'],function(_0xae091){return{'name':_0xae091[_0x9717('0x25')],'type':_0xae091[_0x9717('0x26')][_0x9717('0x27')]};});_0x4c3d6f['model']=_[_0x9717('0x28')](_0x169c00,_0x9717('0x21'));_0x4c3d6f[_0x9717('0x29')]=_[_0x9717('0x2a')](_0x3e2718[_0x9717('0x29')]);_0x4c3d6f[_0x9717('0x2b')]=_[_0x9717('0x2c')](_0x4c3d6f['model'],_0x4c3d6f[_0x9717('0x29')]);_0x2516e5[_0x9717('0x2d')]=_['intersection'](_0x4c3d6f['model'],qs[_0x9717('0x2e')](_0x3e2718[_0x9717('0x29')][_0x9717('0x2e')]));_0x2516e5[_0x9717('0x2d')]=_0x2516e5['attributes'][_0x9717('0x2f')]?_0x2516e5[_0x9717('0x2d')]:_0x4c3d6f['model'];if(!_0x3e2718[_0x9717('0x29')][_0x9717('0x30')](_0x9717('0x31'))){_0x2516e5[_0x9717('0x16')]=qs[_0x9717('0x16')](_0x3e2718[_0x9717('0x29')][_0x9717('0x16')]);_0x2516e5[_0x9717('0x14')]=qs[_0x9717('0x14')](_0x3e2718[_0x9717('0x29')][_0x9717('0x14')]);}_0x2516e5['order']=qs[_0x9717('0x32')](_0x3e2718[_0x9717('0x29')][_0x9717('0x32')]);_0x2516e5[_0x9717('0x33')]=qs['filters'](_[_0x9717('0x34')](_0x3e2718[_0x9717('0x29')],_0x4c3d6f[_0x9717('0x2b')]),_0x169c00);if(_0x3e2718[_0x9717('0x29')][_0x9717('0x35')]){_0x2516e5['where']=_['merge'](_0x2516e5[_0x9717('0x33')],{'$or':_[_0x9717('0x28')](_0x169c00,function(_0x30cd18){if(_0x30cd18[_0x9717('0x26')]!==_0x9717('0x36')){var _0x816580={};_0x816580[_0x30cd18['name']]={'$like':'%'+_0x3e2718[_0x9717('0x29')][_0x9717('0x35')]+'%'};return _0x816580;}})});}_0x2516e5=_[_0x9717('0x37')]({},_0x2516e5,_0x3e2718[_0x9717('0x38')]);var _0x5e09d9={'where':_0x2516e5[_0x9717('0x33')]};return db[_0x9717('0x24')][_0x9717('0x17')](_0x5e09d9)['then'](function(_0x422ea8){_0x2a3f5d['count']=_0x422ea8;if(_0x3e2718[_0x9717('0x29')][_0x9717('0x39')]){_0x2516e5[_0x9717('0x3a')]=[{'all':!![]}];}return db[_0x9717('0x24')][_0x9717('0x3b')](_0x2516e5);})[_0x9717('0x1d')](function(_0x360cbb){_0x2a3f5d[_0x9717('0x3c')]=_0x360cbb;return _0x2a3f5d;})[_0x9717('0x1d')](respondWithFilteredResult(_0x35ecf6,_0x2516e5))['catch'](handleError(_0x35ecf6,null));};exports[_0x9717('0x3d')]=function(_0x1b089e,_0xd33ef1){var _0xfd0d5d={'raw':!![],'where':{'id':_0x1b089e[_0x9717('0x3e')]['id']}},_0x5698ad={};_0x5698ad[_0x9717('0x3f')]=_[_0x9717('0x2a')](db[_0x9717('0x24')][_0x9717('0x40')]);_0x5698ad[_0x9717('0x29')]=_['keys'](_0x1b089e[_0x9717('0x29')]);_0x5698ad[_0x9717('0x2b')]=_[_0x9717('0x2c')](_0x5698ad[_0x9717('0x3f')],_0x5698ad['query']);_0xfd0d5d[_0x9717('0x2d')]=_[_0x9717('0x2c')](_0x5698ad[_0x9717('0x3f')],qs[_0x9717('0x2e')](_0x1b089e['query'][_0x9717('0x2e')]));_0xfd0d5d[_0x9717('0x2d')]=_0xfd0d5d['attributes'][_0x9717('0x2f')]?_0xfd0d5d[_0x9717('0x2d')]:_0x5698ad[_0x9717('0x3f')];if(_0x1b089e['query']['includeAll']){_0xfd0d5d['include']=[{'all':!![]}];}_0xfd0d5d=_['merge']({},_0xfd0d5d,_0x1b089e[_0x9717('0x38')]);return db['OpenchannelApplication']['find'](_0xfd0d5d)[_0x9717('0x1d')](handleEntityNotFound(_0xd33ef1,null))['then'](respondWithResult(_0xd33ef1,null))['catch'](handleError(_0xd33ef1,null));};exports[_0x9717('0x41')]=function(_0x4110a4,_0x13cd17){return db[_0x9717('0x24')]['create'](_0x4110a4[_0x9717('0x42')],{})['then'](respondWithResult(_0x13cd17,0xc9))[_0x9717('0x43')](handleError(_0x13cd17,null));};exports[_0x9717('0x1b')]=function(_0x2b976d,_0x5a9941){if(_0x2b976d[_0x9717('0x42')]['id']){delete _0x2b976d[_0x9717('0x42')]['id'];}return db[_0x9717('0x24')]['find']({'where':{'id':_0x2b976d['params']['id']}})[_0x9717('0x1d')](handleEntityNotFound(_0x5a9941,null))[_0x9717('0x1d')](saveUpdates(_0x2b976d[_0x9717('0x42')],null))['then'](respondWithResult(_0x5a9941,null))['catch'](handleError(_0x5a9941,null));};exports[_0x9717('0x1c')]=function(_0x47ba57,_0x541984){return db['OpenchannelApplication'][_0x9717('0x44')]({'where':{'id':_0x47ba57['params']['id']}})[_0x9717('0x1d')](handleEntityNotFound(_0x541984,null))['then'](removeEntity(_0x541984,null))[_0x9717('0x43')](handleError(_0x541984,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 76fd863..9ff5185 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 _0x38b6=['rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2d099f,_0x40d72d){var _0x2adc30=function(_0x2a1c12){while(--_0x2a1c12){_0x2d099f['push'](_0x2d099f['shift']());}};_0x2adc30(++_0x40d72d);}(_0x38b6,0x1ac));var _0x638b=function(_0xbbe16d,_0x2f20e3){_0xbbe16d=_0xbbe16d-0x0;var _0x46b776=_0x38b6[_0xbbe16d];return _0x46b776;};'use strict';var _=require(_0x638b('0x0'));var util=require(_0x638b('0x1'));var logger=require(_0x638b('0x2'))('api');var moment=require(_0x638b('0x3'));var BPromise=require('bluebird');var rp=require(_0x638b('0x4'));var fs=require('fs');var path=require(_0x638b('0x5'));var rimraf=require(_0x638b('0x6'));var config=require(_0x638b('0x7'));var attributes=require(_0x638b('0x8'));module['exports']=function(_0x448f5e,_0x4db95d){return _0x448f5e[_0x638b('0x9')](_0x638b('0xa'),attributes,{'tableName':_0x638b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x638b('0xc'),'collate':_0x638b('0xd')});}; \ No newline at end of file +var _0x3713=['utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x519109,_0x59d22b){var _0x1667ce=function(_0x1d6d45){while(--_0x1d6d45){_0x519109['push'](_0x519109['shift']());}};_0x1667ce(++_0x59d22b);}(_0x3713,0x8d));var _0x3371=function(_0x4323d4,_0x42b60e){_0x4323d4=_0x4323d4-0x0;var _0xbff5e6=_0x3713[_0x4323d4];return _0xbff5e6;};'use strict';var _=require('lodash');var util=require(_0x3371('0x0'));var logger=require('../../config/logger')(_0x3371('0x1'));var moment=require('moment');var BPromise=require(_0x3371('0x2'));var rp=require(_0x3371('0x3'));var fs=require('fs');var path=require(_0x3371('0x4'));var rimraf=require(_0x3371('0x5'));var config=require(_0x3371('0x6'));var attributes=require(_0x3371('0x7'));module[_0x3371('0x8')]=function(_0x589dbb,_0x5b9eba){return _0x589dbb[_0x3371('0x9')](_0x3371('0xa'),attributes,{'tableName':_0x3371('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3371('0xc'),'collate':_0x3371('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5a1c0c4..2ecefc4 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 _0x2764=['request','then','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateOpenchannelApplication','update','options','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2764,0xd4));var _0x4276=function(_0x11cf82,_0xc3ddd){_0x11cf82=_0x11cf82-0x0;var _0x1266e9=_0x2764[_0x11cf82];return _0x1266e9;};'use strict';var _=require(_0x4276('0x0'));var util=require(_0x4276('0x1'));var moment=require(_0x4276('0x2'));var BPromise=require(_0x4276('0x3'));var rs=require(_0x4276('0x4'));var fs=require('fs');var Redis=require(_0x4276('0x5'));var db=require(_0x4276('0x6'))['db'];var utils=require(_0x4276('0x7'));var logger=require(_0x4276('0x8'))(_0x4276('0x9'));var config=require(_0x4276('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4276('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3030ed,_0x14b326,_0x513322){return new BPromise(function(_0x242513,_0x1cb7c){return client[_0x4276('0xc')](_0x3030ed,_0x513322)[_0x4276('0xd')](function(_0x5c78e6){logger['info'](_0x4276('0xe'),_0x14b326,'request\x20sent');logger['debug'](_0x4276('0xf'),_0x14b326,'request\x20sent',JSON[_0x4276('0x10')](_0x5c78e6));if(_0x5c78e6[_0x4276('0x11')]){if(_0x5c78e6[_0x4276('0x11')]['code']===0x1f4){logger['error'](_0x4276('0xe'),_0x14b326,_0x5c78e6[_0x4276('0x11')]['message']);return _0x1cb7c(_0x5c78e6[_0x4276('0x11')][_0x4276('0x12')]);}logger[_0x4276('0x11')](_0x4276('0xe'),_0x14b326,_0x5c78e6[_0x4276('0x11')]['message']);return _0x242513(_0x5c78e6[_0x4276('0x11')][_0x4276('0x12')]);}else{logger[_0x4276('0x13')](_0x4276('0xe'),_0x14b326,'request\x20sent');_0x242513(_0x5c78e6[_0x4276('0x14')][_0x4276('0x12')]);}})[_0x4276('0x15')](function(_0x7df646){logger['error'](_0x4276('0xe'),_0x14b326,_0x7df646);_0x1cb7c(_0x7df646);});});}exports[_0x4276('0x16')]=function(_0x42c87c){var _0x519a96=this;return new Promise(function(_0x4eddb8,_0x49a2ed){return db['OpenchannelApplication'][_0x4276('0x17')](_0x42c87c['body'],{'raw':_0x42c87c[_0x4276('0x18')]?_0x42c87c[_0x4276('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42c87c[_0x4276('0x18')]?_0x42c87c[_0x4276('0x18')]['where']||null:null,'attributes':_0x42c87c[_0x4276('0x18')]?_0x42c87c['options'][_0x4276('0x19')]||null:null,'limit':_0x42c87c[_0x4276('0x18')]?_0x42c87c[_0x4276('0x18')][_0x4276('0x1a')]||null:null})[_0x4276('0xd')](function(_0x2b55b2){logger['info'](_0x4276('0x16'),_0x42c87c);logger[_0x4276('0x1b')](_0x4276('0x16'),_0x42c87c,JSON[_0x4276('0x10')](_0x2b55b2));_0x4eddb8(_0x2b55b2);})[_0x4276('0x15')](function(_0x218188){logger['error']('UpdateOpenchannelApplication',_0x218188[_0x4276('0x12')],_0x42c87c);_0x49a2ed(_0x519a96['error'](0x1f4,_0x218188['message']));});});}; \ No newline at end of file +var _0xcec9=['then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x38d657,_0x3522a1){var _0x1de063=function(_0x3354be){while(--_0x3354be){_0x38d657['push'](_0x38d657['shift']());}};_0x1de063(++_0x3522a1);}(_0xcec9,0x171));var _0x9cec=function(_0x38d4b1,_0x2e77a9){_0x38d4b1=_0x38d4b1-0x0;var _0x25f0d9=_0xcec9[_0x38d4b1];return _0x25f0d9;};'use strict';var _=require(_0x9cec('0x0'));var util=require(_0x9cec('0x1'));var moment=require(_0x9cec('0x2'));var BPromise=require(_0x9cec('0x3'));var rs=require(_0x9cec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cec('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9cec('0x6'));var config=require(_0x9cec('0x7'));var jayson=require(_0x9cec('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30b315,_0x34946c,_0x3d1450){return new BPromise(function(_0x368c46,_0x156cc2){return client['request'](_0x30b315,_0x3d1450)[_0x9cec('0x9')](function(_0x260bdb){logger[_0x9cec('0xa')](_0x9cec('0xb'),_0x34946c,_0x9cec('0xc'));logger[_0x9cec('0xd')](_0x9cec('0xe'),_0x34946c,_0x9cec('0xc'),JSON['stringify'](_0x260bdb));if(_0x260bdb['error']){if(_0x260bdb[_0x9cec('0xf')][_0x9cec('0x10')]===0x1f4){logger[_0x9cec('0xf')](_0x9cec('0xb'),_0x34946c,_0x260bdb[_0x9cec('0xf')][_0x9cec('0x11')]);return _0x156cc2(_0x260bdb['error']['message']);}logger[_0x9cec('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x34946c,_0x260bdb[_0x9cec('0xf')][_0x9cec('0x11')]);return _0x368c46(_0x260bdb['error']['message']);}else{logger[_0x9cec('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x34946c,_0x9cec('0xc'));_0x368c46(_0x260bdb[_0x9cec('0x12')]['message']);}})[_0x9cec('0x13')](function(_0x55c45b){logger[_0x9cec('0xf')](_0x9cec('0xb'),_0x34946c,_0x55c45b);_0x156cc2(_0x55c45b);});});}exports[_0x9cec('0x14')]=function(_0x2c04ad){var _0x3bafcb=this;return new Promise(function(_0x4fc6c3,_0xf62ead){return db[_0x9cec('0x15')]['update'](_0x2c04ad['body'],{'raw':_0x2c04ad['options']?_0x2c04ad[_0x9cec('0x16')][_0x9cec('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c04ad[_0x9cec('0x16')]?_0x2c04ad[_0x9cec('0x16')]['where']||null:null,'attributes':_0x2c04ad['options']?_0x2c04ad[_0x9cec('0x16')][_0x9cec('0x18')]||null:null,'limit':_0x2c04ad[_0x9cec('0x16')]?_0x2c04ad[_0x9cec('0x16')][_0x9cec('0x19')]||null:null})[_0x9cec('0x9')](function(_0xe674b5){logger[_0x9cec('0xa')](_0x9cec('0x14'),_0x2c04ad);logger[_0x9cec('0xd')](_0x9cec('0x14'),_0x2c04ad,JSON[_0x9cec('0x1a')](_0xe674b5));_0x4fc6c3(_0xe674b5);})[_0x9cec('0x13')](function(_0x2c98b2){logger[_0x9cec('0xf')](_0x9cec('0x14'),_0x2c98b2[_0x9cec('0x11')],_0x2c04ad);_0xf62ead(_0x3bafcb[_0x9cec('0xf')](0x1f4,_0x2c98b2[_0x9cec('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 10a9063..1a06fb2 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 _0x8661=['download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/:id','show','/:id/messages','/:id/download'];(function(_0x4ab09d,_0xb7881d){var _0x3997d1=function(_0x458d63){while(--_0x458d63){_0x4ab09d['push'](_0x4ab09d['shift']());}};_0x3997d1(++_0xb7881d);}(_0x8661,0x1c0));var _0x1866=function(_0x130b99,_0x399fb9){_0x130b99=_0x130b99-0x0;var _0x421325=_0x8661[_0x130b99];return _0x421325;};'use strict';var multer=require('multer');var util=require(_0x1866('0x0'));var path=require(_0x1866('0x1'));var timeout=require(_0x1866('0x2'));var express=require(_0x1866('0x3'));var router=express[_0x1866('0x4')]();var fs_extra=require(_0x1866('0x5'));var auth=require(_0x1866('0x6'));var interaction=require(_0x1866('0x7'));var config=require(_0x1866('0x8'));var controller=require(_0x1866('0x9'));router['get']('/',auth[_0x1866('0xa')](),controller['index']);router[_0x1866('0xb')]('/describe',auth[_0x1866('0xa')](),controller['describe']);router['get'](_0x1866('0xc'),auth[_0x1866('0xa')](),controller[_0x1866('0xd')]);router[_0x1866('0xb')](_0x1866('0xe'),auth[_0x1866('0xa')](),controller['getMessages']);router[_0x1866('0xb')](_0x1866('0xf'),auth[_0x1866('0xa')](),controller[_0x1866('0x10')]);router[_0x1866('0x11')]('/',auth[_0x1866('0xa')](),controller['create']);router['post'](_0x1866('0xe'),auth[_0x1866('0xa')](),controller[_0x1866('0x12')]);router[_0x1866('0x11')]('/:id/tags',auth[_0x1866('0xa')](),interaction[_0x1866('0x13')](_0x1866('0x14'),_0x1866('0x15')),controller[_0x1866('0x16')]);router[_0x1866('0x17')](_0x1866('0xc'),auth[_0x1866('0xa')](),interaction['tracked'](_0x1866('0x14'),_0x1866('0x18')),controller[_0x1866('0x19')]);router[_0x1866('0x1a')](_0x1866('0xc'),auth[_0x1866('0xa')](),interaction[_0x1866('0x13')](_0x1866('0x14'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x1866('0x1a')](_0x1866('0x1b'),auth[_0x1866('0xa')](),controller[_0x1866('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xe435=['removeTags','exports','multer','path','connect-timeout','express','Router','../../config/environment','./openchannelInteraction.controller','get','/describe','describe','isAuthenticated','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','/:id','openchannel','openchannelinteraction:update','update','delete'];(function(_0x3ecb2d,_0x55b849){var _0x33efe2=function(_0x22d4d6){while(--_0x22d4d6){_0x3ecb2d['push'](_0x3ecb2d['shift']());}};_0x33efe2(++_0x55b849);}(_0xe435,0x107));var _0x5e43=function(_0x1f709a,_0x450c7a){_0x1f709a=_0x1f709a-0x0;var _0x315b00=_0xe435[_0x1f709a];return _0x315b00;};'use strict';var multer=require(_0x5e43('0x0'));var util=require('util');var path=require(_0x5e43('0x1'));var timeout=require(_0x5e43('0x2'));var express=require(_0x5e43('0x3'));var router=express[_0x5e43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e43('0x5'));var controller=require(_0x5e43('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5e43('0x7')](_0x5e43('0x8'),auth['isAuthenticated'](),controller[_0x5e43('0x9')]);router[_0x5e43('0x7')]('/:id',auth[_0x5e43('0xa')](),controller['show']);router[_0x5e43('0x7')](_0x5e43('0xb'),auth[_0x5e43('0xa')](),controller['getMessages']);router[_0x5e43('0x7')](_0x5e43('0xc'),auth[_0x5e43('0xa')](),controller[_0x5e43('0xd')]);router[_0x5e43('0xe')]('/',auth[_0x5e43('0xa')](),controller[_0x5e43('0xf')]);router[_0x5e43('0xe')](_0x5e43('0xb'),auth['isAuthenticated'](),controller[_0x5e43('0x10')]);router[_0x5e43('0xe')](_0x5e43('0x11'),auth[_0x5e43('0xa')](),interaction[_0x5e43('0x12')]('openchannel',_0x5e43('0x13')),controller[_0x5e43('0x14')]);router[_0x5e43('0x15')](_0x5e43('0x16'),auth['isAuthenticated'](),interaction[_0x5e43('0x12')](_0x5e43('0x17'),_0x5e43('0x18')),controller[_0x5e43('0x19')]);router[_0x5e43('0x1a')](_0x5e43('0x16'),auth[_0x5e43('0xa')](),interaction[_0x5e43('0x12')](_0x5e43('0x17'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x5e43('0x1a')](_0x5e43('0x11'),auth[_0x5e43('0xa')](),controller[_0x5e43('0x1b')]);module[_0x5e43('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5877f4f..1c226f6 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 _0xed1f=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0xed1f,0x6a));var _0xfed1=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xed1f[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'closed':{'type':Sequelize[_0xfed1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfed1('0x3')]},'disposition':{'type':Sequelize[_0xfed1('0x4')]},'secondDisposition':{'type':Sequelize[_0xfed1('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfed1('0x4')]},'note':{'type':Sequelize[_0xfed1('0x4')]},'read1stAt':{'type':Sequelize[_0xfed1('0x3')]},'threadId':{'type':Sequelize[_0xfed1('0x4')]},'externalUrl':{'type':Sequelize[_0xfed1('0x4')]},'lastMsgAt':{'type':Sequelize[_0xfed1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfed1('0x5')]('in',_0xfed1('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfed1('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xfed1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x032a=['exports','DATE','STRING','ENUM','out'];(function(_0x210da8,_0x3fe0e1){var _0x4455f7=function(_0x12820f){while(--_0x12820f){_0x210da8['push'](_0x210da8['shift']());}};_0x4455f7(++_0x3fe0e1);}(_0x032a,0xf0));var _0xa032=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0x032a[_0xae01dd];return _0x8c26df;};'use strict';var Sequelize=require('sequelize');module[_0xa032('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa032('0x1')]},'disposition':{'type':Sequelize[_0xa032('0x2')]},'secondDisposition':{'type':Sequelize[_0xa032('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa032('0x2')]},'note':{'type':Sequelize[_0xa032('0x2')]},'read1stAt':{'type':Sequelize[_0xa032('0x1')]},'threadId':{'type':Sequelize[_0xa032('0x2')]},'externalUrl':{'type':Sequelize[_0xa032('0x2')]},'lastMsgAt':{'type':Sequelize[_0xa032('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xa032('0x3')]('in',_0xa032('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa032('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 316a500..eceed4a 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 _0x6e2d=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','forEach','Tags','push','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','split','User','UserId','buildExpression','body','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','OpenchannelInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','catch','params','rawAttributes','includeAll','include','merge','options','create','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','Owner','get','mkdirSync','Openchannel','Account','closed','threadId','Public','existsSync','createReadStream','pipe','createWriteStream','basename','out'];(function(_0x25c3cf,_0x55f9f2){var _0x63ac54=function(_0x30898f){while(--_0x30898f){_0x25c3cf['push'](_0x25c3cf['shift']());}};_0x63ac54(++_0x55f9f2);}(_0x6e2d,0xf1));var _0xd6e2=function(_0x2205b2,_0x4d4ecb){_0x2205b2=_0x2205b2-0x0;var _0x18b63d=_0x6e2d[_0x2205b2];return _0x18b63d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6e2('0x0'));var zipdir=require(_0xd6e2('0x1'));var jsonpatch=require(_0xd6e2('0x2'));var rp=require('request-promise');var moment=require(_0xd6e2('0x3'));var BPromise=require(_0xd6e2('0x4'));var Mustache=require('mustache');var util=require(_0xd6e2('0x5'));var path=require(_0xd6e2('0x6'));var sox=require(_0xd6e2('0x7'));var csv=require(_0xd6e2('0x8'));var ejs=require(_0xd6e2('0x9'));var fs=require('fs');var fs_extra=require(_0xd6e2('0xa'));var _=require(_0xd6e2('0xb'));var squel=require('squel');var crypto=require(_0xd6e2('0xc'));var jsforce=require(_0xd6e2('0xd'));var deskjs=require(_0xd6e2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd6e2('0xf'));var Papa=require(_0xd6e2('0x10'));var Redis=require('ioredis');var authService=require(_0xd6e2('0x11'));var qs=require(_0xd6e2('0x12'));var as=require(_0xd6e2('0x13'));var pdf=require(_0xd6e2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd6e2('0x15'));var config=require(_0xd6e2('0x16'));var licenseUtil=require(_0xd6e2('0x17'));var db=require(_0xd6e2('0x18'))['db'];config[_0xd6e2('0x19')]=_['defaults'](config['redis'],{'host':_0xd6e2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6e2('0x19')]));require('./openchannelInteraction.socket')[_0xd6e2('0x1b')](socket);function respondWithStatusCode(_0x144dc6,_0x44a011){_0x44a011=_0x44a011||0xcc;return function(_0x2cd062){if(_0x2cd062){return _0x144dc6[_0xd6e2('0x1c')](_0x44a011);}return _0x144dc6[_0xd6e2('0x1d')](_0x44a011)['end']();};}function respondWithResult(_0x5061d2,_0x28b156){_0x28b156=_0x28b156||0xc8;return function(_0x477f74){if(_0x477f74){return _0x5061d2[_0xd6e2('0x1d')](_0x28b156)['json'](_0x477f74);}};}function respondWithFilteredResult(_0x15756a,_0x57ed8a){return function(_0x26121c){if(_0x26121c){var _0xee8c1a=typeof _0x57ed8a[_0xd6e2('0x1e')]===_0xd6e2('0x1f')&&typeof _0x57ed8a['limit']===_0xd6e2('0x1f');var _0x59f7fa=_0x26121c[_0xd6e2('0x20')];var _0x3c5a9f=_0xee8c1a?0x0:_0x57ed8a[_0xd6e2('0x1e')];var _0x372395=_0xee8c1a?_0x26121c[_0xd6e2('0x20')]:_0x57ed8a[_0xd6e2('0x1e')]+_0x57ed8a[_0xd6e2('0x21')];var _0x46aa5e;if(_0x372395>=_0x59f7fa){_0x372395=_0x59f7fa;_0x46aa5e=0xc8;}else{_0x46aa5e=0xce;}_0x15756a['status'](_0x46aa5e);return _0x15756a[_0xd6e2('0x22')](_0xd6e2('0x23'),_0x3c5a9f+'-'+_0x372395+'/'+_0x59f7fa)['json'](_0x26121c);}return null;};}function patchUpdates(_0x3b672e){return function(_0x53c8d1){try{jsonpatch[_0xd6e2('0x24')](_0x53c8d1,_0x3b672e,!![]);}catch(_0x356084){return BPromise['reject'](_0x356084);}return _0x53c8d1[_0xd6e2('0x25')]();};}function saveUpdates(_0x485067,_0x5bf9a3){return function(_0xcebaa7){if(_0xcebaa7){return _0xcebaa7[_0xd6e2('0x26')](_0x485067)[_0xd6e2('0x27')](function(_0x40e96c){return _0x40e96c;});}return null;};}function removeEntity(_0x3e028d,_0x14918f){return function(_0x1a5e7b){if(_0x1a5e7b){return _0x1a5e7b[_0xd6e2('0x28')]()['then'](function(){_0x3e028d[_0xd6e2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14dce8,_0x3d99bc){return function(_0x5d874c){if(!_0x5d874c){_0x14dce8['sendStatus'](0x194);}return _0x5d874c;};}function handleError(_0x13ba3f,_0x4368e7){_0x4368e7=_0x4368e7||0x1f4;return function(_0x511a4f){logger[_0xd6e2('0x29')](_0x511a4f[_0xd6e2('0x2a')]);if(_0x511a4f['name']){delete _0x511a4f[_0xd6e2('0x2b')];}_0x13ba3f[_0xd6e2('0x1d')](_0x4368e7)[_0xd6e2('0x2c')](_0x511a4f);};}function getInteractionUsers(_0xb386,_0x588133){return new BPromise(function(_0x5b747e,_0x199171){try{if(_0x588133[_0xb386['id']]){_0xb386[_0xd6e2('0x2d')]=_[_0xd6e2('0x2e')](_0x588133[_0xb386['id']],function(_0x4622e6){return{'id':_0x4622e6['id'],'fullname':_0x4622e6['fullname']};});}}catch(_0x373b3d){_0x199171(_0x373b3d);}_0x5b747e(_0xb386);});}function getInteractionTags(_0x42dcb1,_0xbea121){return new BPromise(function(_0x26c973,_0xa71082){try{if(_0x42dcb1[_0xd6e2('0x2f')]){_0x42dcb1['Tags']=[];_0x42dcb1[_0xd6e2('0x2f')]['split'](',')[_0xd6e2('0x30')](function(_0x2fd8b9){_0x42dcb1[_0xd6e2('0x31')][_0xd6e2('0x32')](_0xbea121[_0x2fd8b9]);});}delete _0x42dcb1['TagIds'];}catch(_0x30eabc){_0xa71082(_0x30eabc);}_0x26c973(_0x42dcb1);});}function updateOpenchannelInteraction(_0x3ba826,_0x28ee33,_0x662e48){return new BPromise(function(_0x19821c,_0x13de60){return getInteractionUsers(_0x3ba826,_0x662e48)[_0xd6e2('0x27')](function(_0xc82320){return getInteractionTags(_0xc82320,_0x28ee33);})[_0xd6e2('0x27')](function(_0x560a62){_0x19821c(_0x560a62);})['catch'](function(_0x2b6c8c){_0x13de60(_0x2b6c8c);});});}exports[_0xd6e2('0x33')]=function(_0x22f486,_0x2dc383){var _0x2ee64a={},_0x5451d1={},_0x2f9618={'count':0x0,'rows':[]};var _0x24df65=_[_0xd6e2('0x2e')](db['OpenchannelInteraction']['rawAttributes'],function(_0x31d6f4){return{'name':_0x31d6f4[_0xd6e2('0x34')],'type':_0x31d6f4[_0xd6e2('0x35')][_0xd6e2('0x36')]};});_0x5451d1[_0xd6e2('0x37')]=_[_0xd6e2('0x2e')](_0x24df65,_0xd6e2('0x2b'));_0x5451d1[_0xd6e2('0x38')]=_[_0xd6e2('0x39')](_0x22f486[_0xd6e2('0x38')]);_0x5451d1[_0xd6e2('0x3a')]=_[_0xd6e2('0x3b')](_0x5451d1[_0xd6e2('0x37')],_0x5451d1[_0xd6e2('0x38')]);_0x2ee64a['attributes']=_[_0xd6e2('0x3b')](_0x5451d1[_0xd6e2('0x37')],qs[_0xd6e2('0x3c')](_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x3c')]));_0x2ee64a['attributes']=_0x2ee64a[_0xd6e2('0x3d')][_0xd6e2('0x3e')]?_0x2ee64a[_0xd6e2('0x3d')]:_0x5451d1[_0xd6e2('0x37')];if(!_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x3f')](_0xd6e2('0x40'))){_0x2ee64a[_0xd6e2('0x21')]=qs[_0xd6e2('0x21')](_0x22f486[_0xd6e2('0x38')]['limit']);_0x2ee64a[_0xd6e2('0x1e')]=qs[_0xd6e2('0x1e')](_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x1e')]);}_0x2ee64a[_0xd6e2('0x41')]=qs[_0xd6e2('0x42')](_0x22f486['query']['sort']);_0x2ee64a[_0xd6e2('0x43')]=qs['filters'](_[_0xd6e2('0x44')](_0x22f486[_0xd6e2('0x38')],_0x5451d1[_0xd6e2('0x3a')]),_0x24df65);var _0x29fc4e=[];var _0x5aecb2=squel[_0xd6e2('0x45')]()[_0xd6e2('0x46')]('id')[_0xd6e2('0x46')](_0xd6e2('0x2b'))[_0xd6e2('0x46')](_0xd6e2('0x47'))[_0xd6e2('0x48')]('tools_tags');var _0x42c079=squel[_0xd6e2('0x45')]()['field'](_0xd6e2('0x49'))[_0xd6e2('0x46')]('u.fullname')[_0xd6e2('0x46')]('ui.OpenchannelInteractionId')[_0xd6e2('0x48')](_0xd6e2('0x4a'),'ui')['left_join'](_0xd6e2('0x4b'),'u',_0xd6e2('0x4c'));var _0x4ed672=squel[_0xd6e2('0x45')]()[_0xd6e2('0x48')](_0xd6e2('0x4d'),'i')[_0xd6e2('0x4e')]('cm_contacts','c',_0xd6e2('0x4f'))[_0xd6e2('0x4e')](_0xd6e2('0x4b'),'o',_0xd6e2('0x50'))[_0xd6e2('0x4e')](_0xd6e2('0x51'),'a',_0xd6e2('0x52'))[_0xd6e2('0x4e')](_0xd6e2('0x53'),'me',_0xd6e2('0x54'))[_0xd6e2('0x4e')](_0xd6e2('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xd6e2('0x4e')](_0xd6e2('0x56'),'t','t.id\x20=\x20it.TagId');var _0x52d81c=squel[_0xd6e2('0x57')]();var _0x7bc83e=[];var _0xa56ea2=squel[_0xd6e2('0x57')]();var _0x28ee3e;if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x58')]){_0x28ee3e=as[_0xd6e2('0x59')](_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x58')]);var _0x416aad=_0x28ee3e['sqlOperator'];for(var _0x1a318b=0x0;_0x1a318b<_0x28ee3e[_0xd6e2('0x5a')][_0xd6e2('0x3e')];_0x1a318b++){var _0x26909d=_0x28ee3e[_0xd6e2('0x5a')][_0x1a318b];var _0x3b0641='i';var _0x5ce10f=_[_0xd6e2('0x5b')](_0x24df65,['name',_0x26909d[_0xd6e2('0x46')]]);if(!_0x5ce10f){switch(_0x26909d[_0xd6e2('0x46')]){case _0xd6e2('0x5c'):if(_0x26909d[_0xd6e2('0x5d')]==0x1){_0x4ed672['having']('`'+_0x26909d[_0xd6e2('0x46')]+_0xd6e2('0x5e'));}else{_0x4ed672[_0xd6e2('0x5f')]('`'+_0x26909d[_0xd6e2('0x46')]+_0xd6e2('0x60'));}break;case'Contact':if(_0x26909d[_0xd6e2('0x61')]===_0xd6e2('0x62')){if(_0x26909d[_0xd6e2('0x5d')]['split']('\x20')[_0xd6e2('0x3e')]>0x1){_0x52d81c[_0x416aad](_0xd6e2('0x63'),qs[_0xd6e2('0x64')](_0x26909d[_0xd6e2('0x5d')]),null);}else{var _0x13f897='%'+_0x26909d[_0xd6e2('0x5d')]+'%';_0x52d81c[_0x416aad](_0xd6e2('0x65'),_0x13f897,_0x13f897,_0x13f897);}}else{_0x5ce10f=_[_0xd6e2('0x5b')](_0x24df65,[_0xd6e2('0x2b'),_0xd6e2('0x66')]);_0x26909d[_0xd6e2('0x46')]=_0xd6e2('0x66');_0x1e40a8=as['buildExpression'](_0x3b0641,_0x5ce10f[_0xd6e2('0x35')],_0x26909d);_0x52d81c[_0x416aad](_0x1e40a8[_0xd6e2('0x67')],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x68')],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x69')]);}break;case'Tag':var _0x4353d4=_0x26909d[_0xd6e2('0x5d')][_0xd6e2('0x6a')](',')[_0xd6e2('0x2e')](function(_0x539d7f){return Number(_0x539d7f);});_0x4353d4[_0xd6e2('0x30')](function(_0x28ad06){_0xa56ea2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28ad06+',%');});_0x7bc83e=_['union'](_0x7bc83e,_0x4353d4);break;case _0xd6e2('0x6b'):if(_0x26909d[_0xd6e2('0x61')]===_0xd6e2('0x62')){_0x52d81c[_0x416aad]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x26909d[_0xd6e2('0x5d')]+'%',null);}else{_0x5ce10f=_[_0xd6e2('0x5b')](_0x24df65,[_0xd6e2('0x2b'),_0xd6e2('0x6c')]);_0x26909d[_0xd6e2('0x46')]=_0xd6e2('0x6c');_0x1e40a8=as[_0xd6e2('0x6d')](_0x3b0641,_0x5ce10f[_0xd6e2('0x35')],_0x26909d);_0x52d81c[_0x416aad](_0x1e40a8[_0xd6e2('0x67')],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x68')],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x69')]);}break;case _0xd6e2('0x6e'):_0x1e40a8=as['buildExpression']('me',null,_0x26909d);_0x52d81c[_0x416aad](_0x1e40a8['text'],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x68')],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x69')]);break;}}else{var _0x1e40a8=as['buildExpression'](_0x3b0641,_0x5ce10f[_0xd6e2('0x35')],_0x26909d);_0x52d81c[_0x416aad](_0x1e40a8[_0xd6e2('0x67')],_0x1e40a8['value'][_0xd6e2('0x68')],_0x1e40a8[_0xd6e2('0x5d')][_0xd6e2('0x69')]);}}}else{var _0x3c03b3=_(_0x22f486[_0xd6e2('0x38')])[_0xd6e2('0x39')]()[_0xd6e2('0x2e')](function(_0xbb0209){return _['some'](_0x24df65,[_0xd6e2('0x2b'),_0xbb0209])?_0xbb0209:undefined;})[_0xd6e2('0x6f')]()[_0xd6e2('0x5d')]();if(!_[_0xd6e2('0x70')](_0x3c03b3)){_0x3c03b3[_0xd6e2('0x30')](function(_0x2e4cb3){if(_0x2e4cb3===_0xd6e2('0x71')){_0x4ed672['where'](_0xd6e2('0x72'),[][_0xd6e2('0x73')](_0x22f486[_0xd6e2('0x38')][_0x2e4cb3]));}else if(_0x2e4cb3===_0xd6e2('0x74')){var _0x1c9653=JSON[_0xd6e2('0x75')](_0x22f486[_0xd6e2('0x38')][_0x2e4cb3])['$gte'];var _0x51c524=JSON['parse'](_0x22f486[_0xd6e2('0x38')][_0x2e4cb3])[_0xd6e2('0x76')];_0x4ed672[_0xd6e2('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c9653,_0x51c524);}else{if(_0x22f486['query'][_0x2e4cb3]===_0xd6e2('0x77')){_0x4ed672[_0xd6e2('0x43')]('i.'+_0x2e4cb3+_0xd6e2('0x78'));}else{_0x4ed672[_0xd6e2('0x43')]('i.'+_0x2e4cb3+_0xd6e2('0x79'),_0x22f486[_0xd6e2('0x38')][_0x2e4cb3]);}}});}if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7a')]){if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7a')]==0x1){_0x4ed672[_0xd6e2('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x4ed672[_0xd6e2('0x5f')](_0xd6e2('0x7b'));}}if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7c')]){_0x7bc83e=_[_0xd6e2('0x7d')](_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7c')])?_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7c')]:new Array(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7c')]);_0x7bc83e[_0xd6e2('0x30')](function(_0x149cca){_0xa56ea2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x149cca+',%');});}if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x7e')]){var _0x32610d=_0x22f486[_0xd6e2('0x38')]['filter']['replace']('\x5c','\x5c\x5c')[_0xd6e2('0x7f')](/'/g,'\x27\x27');if(qs[_0xd6e2('0x80')](_0x32610d)){_0x52d81c['or'](_0xd6e2('0x81'),_0x32610d+'%');}else{_0x52d81c['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd6e2('0x64')](_0x32610d))['or']('i.from\x20LIKE\x20?',_0x32610d+'%')['or'](_0xd6e2('0x82'),_0x32610d+'%');}}}_0x4ed672['where'](_0x52d81c);_0x4ed672[_0xd6e2('0x83')](_0xd6e2('0x84'));var _0x8792bd={'type':db[_0xd6e2('0x85')][_0xd6e2('0x86')][_0xd6e2('0x87')],'raw':!![]};var _0x28b050=_0x4ed672[_0xd6e2('0x88')]();_0x28b050[_0xd6e2('0x46')]('i.id');_0x28b050[_0xd6e2('0x46')](_0xd6e2('0x89'),_0xd6e2('0x5c'));if(_0x2ee64a[_0xd6e2('0x41')]){_0x2ee64a['order'][_0xd6e2('0x30')](function(_0x56f995){var _0xd6ebec=_0x56f995[0x0]===_0xd6e2('0x8a')?_0x56f995[0x0]:'i.'+_0x56f995[0x0];_0x4ed672[_0xd6e2('0x41')](_0xd6ebec,_0x56f995[0x1]===_0xd6e2('0x8b')?![]:!![]);});}if(!_[_0xd6e2('0x70')](_0x7bc83e)){_0x4ed672['having'](_0xa56ea2);_0x28b050[_0xd6e2('0x43')](_0xd6e2('0x8c'),_0x7bc83e);}BPromise['resolve']()['then'](function(){if(!_0x28ee3e){if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x71')])return;_0x28b050[_0xd6e2('0x43')](_0xd6e2('0x8d'));_0x4ed672[_0xd6e2('0x43')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x22f486[_0xd6e2('0x8e')][_0xd6e2('0x8f')]!=='agent')return;return _0x22f486['user'][_0xd6e2('0x90')]({'attributes':['id'],'raw':!![]})[_0xd6e2('0x27')](function(_0x5c9911){if(_[_0xd6e2('0x70')](_0x5c9911)){_0x28b050[_0xd6e2('0x43')](_0xd6e2('0x91'));_0x4ed672['where'](_0xd6e2('0x91'));}else{_0x28b050[_0xd6e2('0x43')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xd6e2('0x2e')](_0x5c9911,'id'));_0x4ed672[_0xd6e2('0x43')](_0xd6e2('0x72'),_[_0xd6e2('0x2e')](_0x5c9911,'id'));}});})[_0xd6e2('0x27')](function(){if(_0x22f486[_0xd6e2('0x8e')]['role']==='agent'&&!_0x28ee3e&&!_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x71')])return[];return db[_0xd6e2('0x92')][_0xd6e2('0x38')](_0x28b050[_0xd6e2('0x93')](),_0x8792bd);})[_0xd6e2('0x27')](function(_0x528203){_0x2f9618[_0xd6e2('0x20')]=_0x528203['length'];if(_0x2f9618[_0xd6e2('0x20')]===0x0)return[];return db[_0xd6e2('0x92')]['query'](_0x5aecb2[_0xd6e2('0x93')](),_0x8792bd)[_0xd6e2('0x27')](function(_0x1ab353){_0x29fc4e=_[_0xd6e2('0x94')](_0x1ab353,'id');_0x8792bd=_['merge'](_0x8792bd,{'model':db[_0xd6e2('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x22f486[_0xd6e2('0x38')][_0xd6e2('0x3c')]){_0x2ee64a['attributes']['forEach'](function(_0x2174f2){_0x4ed672['field']('i.'+_0x2174f2);});}else{_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x89'),_0xd6e2('0x5c'));_0x4ed672[_0xd6e2('0x46')]('a.key','Account.key');_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x96'),_0xd6e2('0x97'));_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x98'),'contactName');_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x99'));_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x9a'),'Contact.firstName');_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x9b'),_0xd6e2('0x9c'));_0x4ed672[_0xd6e2('0x46')]('c.email','Contact.email');_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x9d'),_0xd6e2('0x9e'));_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0x9f'),_0xd6e2('0xa0'));_0x4ed672[_0xd6e2('0x46')]('c.fax',_0xd6e2('0xa1'));_0x4ed672['field'](_0xd6e2('0xa2'),_0xd6e2('0xa3'));_0x4ed672[_0xd6e2('0x46')](_0xd6e2('0xa4'),_0xd6e2('0xa5'));_0x4ed672['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd6e2('0x2f'));}if(_0x2ee64a[_0xd6e2('0x21')])_0x4ed672['limit'](_0x2ee64a[_0xd6e2('0x21')]);if(_0x2ee64a[_0xd6e2('0x1e')])_0x4ed672[_0xd6e2('0x1e')](_0x2ee64a[_0xd6e2('0x1e')]);return db['sequelize'][_0xd6e2('0x38')](_0x4ed672[_0xd6e2('0x93')](),_0x8792bd);})[_0xd6e2('0x27')](function(_0x5ef332){if(_0x5ef332['length']>0x0)_0x42c079['where'](_0xd6e2('0xa6'),_['map'](_0x5ef332,'id'));return db[_0xd6e2('0x92')][_0xd6e2('0x38')](_0x42c079[_0xd6e2('0x93')](),_0x8792bd)['then'](function(_0x2fd319){var _0x1fbf52=_[_0xd6e2('0xa7')](_0x2fd319,'OpenchannelInteractionId');var _0xf769b1=[];_0x5ef332['forEach'](function(_0x1a1091){_0xf769b1[_0xd6e2('0x32')](updateOpenchannelInteraction(_0x1a1091,_0x29fc4e,_0x1fbf52));});return BPromise[_0xd6e2('0xa8')](_0xf769b1);});});})[_0xd6e2('0x27')](function(_0x5171d4){_0x2f9618[_0xd6e2('0xa9')]=_0x5171d4;return _0x2f9618;})[_0xd6e2('0x27')](respondWithFilteredResult(_0x2dc383,_0x2ee64a))[_0xd6e2('0xaa')](handleError(_0x2dc383,null));};exports['show']=function(_0x37b2a0,_0x2331c6){var _0x388b07={};if(_0x37b2a0[_0xd6e2('0x38')]['type']&&_0x37b2a0[_0xd6e2('0x38')][_0xd6e2('0x35')]===_0xd6e2('0x48')){_0x388b07[_0xd6e2('0x48')]=_0x37b2a0[_0xd6e2('0xab')]['id'];}else{_0x388b07['id']=_0x37b2a0['params']['id'];}var _0x1a5363={'raw':![],'where':_0x388b07},_0x531171={};_0x531171[_0xd6e2('0x37')]=_[_0xd6e2('0x39')](db['OpenchannelInteraction'][_0xd6e2('0xac')]);_0x531171[_0xd6e2('0x38')]=_[_0xd6e2('0x39')](_0x37b2a0['query']);_0x531171[_0xd6e2('0x3a')]=_[_0xd6e2('0x3b')](_0x531171[_0xd6e2('0x37')],_0x531171[_0xd6e2('0x38')]);_0x1a5363[_0xd6e2('0x3d')]=_[_0xd6e2('0x3b')](_0x531171[_0xd6e2('0x37')],qs[_0xd6e2('0x3c')](_0x37b2a0[_0xd6e2('0x38')][_0xd6e2('0x3c')]));_0x1a5363[_0xd6e2('0x3d')]=_0x1a5363['attributes'][_0xd6e2('0x3e')]?_0x1a5363[_0xd6e2('0x3d')]:_0x531171[_0xd6e2('0x37')];if(_0x37b2a0[_0xd6e2('0x38')][_0xd6e2('0xad')]){_0x1a5363[_0xd6e2('0xae')]=[{'all':!![]}];}_0x1a5363=_[_0xd6e2('0xaf')]({},_0x1a5363,_0x37b2a0[_0xd6e2('0xb0')]);return db[_0xd6e2('0x95')]['find'](_0x1a5363)[_0xd6e2('0x27')](handleEntityNotFound(_0x2331c6,null))[_0xd6e2('0x27')](respondWithResult(_0x2331c6,null))[_0xd6e2('0xaa')](handleError(_0x2331c6,null));};exports[_0xd6e2('0xb1')]=function(_0x188103,_0x1ad7a8){return db[_0xd6e2('0x95')]['create'](_0x188103[_0xd6e2('0x6e')],{})['then'](respondWithResult(_0x1ad7a8,0xc9))[_0xd6e2('0xaa')](handleError(_0x1ad7a8,null));};exports[_0xd6e2('0x26')]=function(_0x4883f3,_0x16d64b){if(_0x4883f3[_0xd6e2('0x6e')]['id']){delete _0x4883f3[_0xd6e2('0x6e')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x4883f3[_0xd6e2('0xab')]['id']}})[_0xd6e2('0x27')](handleEntityNotFound(_0x16d64b,null))['then'](saveUpdates(_0x4883f3[_0xd6e2('0x6e')],null))['then'](respondWithResult(_0x16d64b,null))[_0xd6e2('0xaa')](handleError(_0x16d64b,null));};exports[_0xd6e2('0x28')]=function(_0x43be9a,_0x5d0bfe){return db[_0xd6e2('0x95')][_0xd6e2('0x5b')]({'where':{'id':_0x43be9a[_0xd6e2('0xab')]['id']}})[_0xd6e2('0x27')](handleEntityNotFound(_0x5d0bfe,null))[_0xd6e2('0x27')](removeEntity(_0x5d0bfe,null))['catch'](handleError(_0x5d0bfe,null));};exports['describe']=function(_0x32fa86,_0xabb51f){return db[_0xd6e2('0x95')]['describe']()[_0xd6e2('0x27')](respondWithResult(_0xabb51f,null))['catch'](handleError(_0xabb51f,null));};exports[_0xd6e2('0xb2')]=function(_0x5c3db5,_0x43f2b3,_0x3ebd10){return db[_0xd6e2('0xb3')]['find']({'where':{'id':_0x5c3db5['params']['id']}})[_0xd6e2('0x27')](handleEntityNotFound(_0x43f2b3,null))[_0xd6e2('0x27')](function(_0xdf462c){if(_0xdf462c){return _0xdf462c[_0xd6e2('0xb2')](_0x5c3db5[_0xd6e2('0x6e')]['ids'],_[_0xd6e2('0xb4')](_0x5c3db5['body'],[_0xd6e2('0xb5'),'id'])||{});}})[_0xd6e2('0x27')](respondWithResult(_0x43f2b3,null))[_0xd6e2('0xaa')](handleError(_0x43f2b3,null));};exports[_0xd6e2('0xb6')]=function(_0x578ef1,_0xca786,_0x32171c){var _0x2a8b12={'raw':![],'where':{}};var _0x21150e={};var _0x588c05={'count':0x0,'rows':[]};return db[_0xd6e2('0x95')][_0xd6e2('0xb7')]({'where':{'id':_0x578ef1[_0xd6e2('0xab')]['id']}})['then'](handleEntityNotFound(_0xca786,null))[_0xd6e2('0x27')](function(_0x45bc7a){if(_0x45bc7a){_0x21150e[_0xd6e2('0x37')]=_[_0xd6e2('0x39')](db[_0xd6e2('0xb3')]['rawAttributes']);_0x21150e[_0xd6e2('0x38')]=_[_0xd6e2('0x39')](_0x578ef1[_0xd6e2('0x38')]);_0x21150e[_0xd6e2('0x3a')]=_[_0xd6e2('0x3b')](_0x21150e[_0xd6e2('0x37')],_0x21150e[_0xd6e2('0x38')]);_0x2a8b12[_0xd6e2('0x3d')]=_[_0xd6e2('0x3b')](_0x21150e[_0xd6e2('0x37')],qs[_0xd6e2('0x3c')](_0x578ef1[_0xd6e2('0x38')]['fields']));_0x2a8b12[_0xd6e2('0x3d')]=_0x2a8b12[_0xd6e2('0x3d')][_0xd6e2('0x3e')]?_0x2a8b12[_0xd6e2('0x3d')]:_0x21150e[_0xd6e2('0x37')];if(!_0x578ef1[_0xd6e2('0x38')][_0xd6e2('0x3f')]('nolimit')){_0x2a8b12['limit']=qs[_0xd6e2('0x21')](_0x578ef1[_0xd6e2('0x38')][_0xd6e2('0x21')]);_0x2a8b12['offset']=qs[_0xd6e2('0x1e')](_0x578ef1[_0xd6e2('0x38')][_0xd6e2('0x1e')]);}_0x2a8b12[_0xd6e2('0x41')]=qs['sort'](_0x578ef1['query']['sort']);_0x2a8b12[_0xd6e2('0x43')]=qs['filters'](_['pick'](_0x578ef1[_0xd6e2('0x38')],_0x21150e[_0xd6e2('0x3a')]));_0x2a8b12[_0xd6e2('0x43')][_0xd6e2('0xb8')]=_0x45bc7a['id'];if(_0x578ef1['query'][_0xd6e2('0x7e')]){_0x2a8b12['where']=_[_0xd6e2('0xaf')](_0x2a8b12[_0xd6e2('0x43')],{'$or':_[_0xd6e2('0x2e')](_0x2a8b12[_0xd6e2('0x3d')],function(_0x5a89b2){var _0x4c1655={};_0x4c1655[_0x5a89b2]={'$like':'%'+_0x578ef1[_0xd6e2('0x38')]['filter']+'%'};return _0x4c1655;})});}if(_0x578ef1['query'][_0xd6e2('0xb9')]){var _0x8a026f=_0x578ef1[_0xd6e2('0x38')]['$gte'][_0xd6e2('0x6a')](',');var _0x12d791={};_0x12d791[_0x8a026f[0x0]]={'$gte':moment(_0x8a026f[0x1])[_0xd6e2('0xba')](_0xd6e2('0xbb'))};_0x2a8b12[_0xd6e2('0x43')]=_[_0xd6e2('0xaf')](_0x2a8b12[_0xd6e2('0x43')],_0x12d791);}_0x2a8b12=_[_0xd6e2('0xaf')]({},_0x2a8b12,_0x578ef1['options']);return db[_0xd6e2('0xb3')][_0xd6e2('0x20')]({'where':_0x2a8b12[_0xd6e2('0x43')]})[_0xd6e2('0x27')](function(_0x161407){_0x588c05[_0xd6e2('0x20')]=_0x161407;if(_0x578ef1[_0xd6e2('0x38')][_0xd6e2('0xad')]){_0x2a8b12[_0xd6e2('0xae')]=[{'all':!![]}];}return db[_0xd6e2('0xb3')][_0xd6e2('0xbc')](_0x2a8b12);})[_0xd6e2('0x27')](function(_0x373dfa){_0x588c05[_0xd6e2('0xa9')]=_0x373dfa;return _0x588c05;});}})[_0xd6e2('0x27')](respondWithFilteredResult(_0xca786,_0x2a8b12))[_0xd6e2('0xaa')](handleError(_0xca786,null));};exports[_0xd6e2('0xbd')]=function(_0x31677a,_0x4b23ae,_0x2fc15f){return db[_0xd6e2('0x95')][_0xd6e2('0x5b')]({'where':{'id':_0x31677a[_0xd6e2('0xab')]['id']}})[_0xd6e2('0x27')](handleEntityNotFound(_0x4b23ae,null))[_0xd6e2('0x27')](function(_0x31a27e){if(_0x31a27e){return _0x31a27e[_0xd6e2('0xbe')](_0x31677a['body']['ids'],_['omit'](_0x31677a[_0xd6e2('0x6e')],[_0xd6e2('0xb5'),'id'])||{})[_0xd6e2('0xbf')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xd6e2('0x47')],'where':{'id':_0x31677a['body'][_0xd6e2('0xb5')]}});})[_0xd6e2('0x27')](function(_0x701b5f){socket['emit'](_0xd6e2('0xc0'),{'id':Number(_0x31677a[_0xd6e2('0xab')]['id']),'tags':_0x701b5f||[]});return{'id':Number(_0x31677a[_0xd6e2('0xab')]['id']),'tags':_0x701b5f||[]};});}})[_0xd6e2('0x27')](respondWithResult(_0x4b23ae,null))[_0xd6e2('0xaa')](handleError(_0x4b23ae,null));};exports[_0xd6e2('0xc1')]=function(_0x1cf1b4,_0x4980ab,_0x2666d4){return db['OpenchannelInteraction'][_0xd6e2('0x5b')]({'where':{'id':_0x1cf1b4['params']['id']}})[_0xd6e2('0x27')](handleEntityNotFound(_0x4980ab,null))[_0xd6e2('0x27')](function(_0x5d0af0){if(_0x5d0af0){return _0x5d0af0['removeTags'](_0x1cf1b4['query']['ids']);}})['then'](respondWithStatusCode(_0x4980ab,null))[_0xd6e2('0xaa')](handleError(_0x4980ab,null));};exports[_0xd6e2('0xc2')]=function(_0x3bc007,_0x220bb6){var _0x33b6ba=moment()[_0xd6e2('0xc3')]()[_0xd6e2('0x93')]();var _0x5fe0a2=path[_0xd6e2('0xc4')](config[_0xd6e2('0xc5')],_0xd6e2('0xc6'),'files',_0xd6e2('0xc7'));var _0x4dc4d6=path[_0xd6e2('0xc4')](config[_0xd6e2('0xc5')],_0xd6e2('0xc6'),_0xd6e2('0xc8'),_0xd6e2('0xc9'));var _0x275026=path[_0xd6e2('0xc4')](_0x5fe0a2,_0x33b6ba);var _0x7c0318=util[_0xd6e2('0xba')]('transcript-%d-%s.zip',_0x3bc007[_0xd6e2('0xab')]['id'],_0x33b6ba);var _0x503b3e=path[_0xd6e2('0xc4')](_0x5fe0a2,_0x7c0318);var _0x15b823=[];_0x15b823['push']({'model':db[_0xd6e2('0x6b')],'as':_0xd6e2('0x6b'),'attributes':['id',_0xd6e2('0xca')],'raw':!![]});_0x15b823[_0xd6e2('0x32')]({'model':db[_0xd6e2('0xcb')],'as':_0xd6e2('0xcc'),'attributes':['id',_0xd6e2('0xcd'),_0xd6e2('0xce')],'raw':!![]});if(_0x3bc007[_0xd6e2('0x38')][_0xd6e2('0xc9')]){_0x15b823[_0xd6e2('0x32')]({'model':db[_0xd6e2('0xcf')],'as':_0xd6e2('0xcf'),'raw':!![]});}var _0x5c6894=[{'model':db['OpenchannelMessage'],'as':_0xd6e2('0xd0'),'attributes':['id',_0xd6e2('0x6e'),_0xd6e2('0x74'),_0xd6e2('0xd1'),_0xd6e2('0xd2'),_0xd6e2('0x7a')],'include':_0x15b823}];_0x5c6894[_0xd6e2('0x32')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xd6e2('0x2b')]});_0x5c6894[_0xd6e2('0x32')]({'model':db[_0xd6e2('0x6b')],'as':_0xd6e2('0xd3'),'attributes':['id',_0xd6e2('0xca')]});return db['OpenchannelInteraction'][_0xd6e2('0x5b')]({'where':{'id':_0x3bc007[_0xd6e2('0xab')]['id']},'include':_0x5c6894})[_0xd6e2('0x27')](handleEntityNotFound(_0x220bb6,null))[_0xd6e2('0x27')](function(_0x3cbe86){if(_0x3cbe86){var _0xc35f4b=_0x3cbe86[_0xd6e2('0xd4')]({'plain':!![]});fs[_0xd6e2('0xd5')](_0x275026);var _0x2dec3e={'channel':_0xd6e2('0xd6'),'account':_0xc35f4b[_0xd6e2('0xd7')][_0xd6e2('0x2b')],'agent':_0xc35f4b[_0xd6e2('0xd3')]?_0xc35f4b[_0xd6e2('0xd3')]['fullname']:'N.A.','createdAt':moment(_0xc35f4b[_0xd6e2('0x74')])[_0xd6e2('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6e2('0x93')](),'closedAt':_0xc35f4b[_0xd6e2('0xd8')]?moment(_0xc35f4b['closedAt'])[_0xd6e2('0xba')](_0xd6e2('0xbb'))['toString']():'','disposition':_0xc35f4b['disposition'],'visibility':_0xc35f4b[_0xd6e2('0xd9')]?_0xd6e2('0xda'):'Private','messages':_(_0xc35f4b[_0xd6e2('0xd0')])['filter']({'secret':![]})[_0xd6e2('0x2e')](function(_0x19a6f6){if(_0x19a6f6[_0xd6e2('0xcf')]){var _0x1a2a0d=path['join'](_0x4dc4d6,_0x19a6f6[_0xd6e2('0xcf')]['basename']);if(fs[_0xd6e2('0xdb')](_0x1a2a0d)){fs[_0xd6e2('0xdc')](_0x1a2a0d)[_0xd6e2('0xdd')](fs[_0xd6e2('0xde')](path[_0xd6e2('0xc4')](_0x275026,_0x19a6f6[_0xd6e2('0xcf')][_0xd6e2('0xdf')])));}}return{'date':moment(_0x19a6f6[_0xd6e2('0x74')])[_0xd6e2('0xba')](_0xd6e2('0xbb'))[_0xd6e2('0x93')](),'sender':_0x19a6f6['direction']===_0xd6e2('0xe0')?_0x19a6f6[_0xd6e2('0x6b')]?_0x19a6f6[_0xd6e2('0x6b')][_0xd6e2('0xca')]:'System':_0x19a6f6[_0xd6e2('0xcc')]['firstName']+(_0x19a6f6[_0xd6e2('0xcc')][_0xd6e2('0xce')]?'\x20'+_0x19a6f6[_0xd6e2('0xcc')]['lastName']:''),'body':_0x19a6f6[_0xd6e2('0xcf')]?_0x19a6f6['Attachment']['basename']:_0x19a6f6[_0xd6e2('0x6e')],'direction':_0x19a6f6[_0xd6e2('0xd1')]===_0xd6e2('0xe0')?'A':'C','secret':_0x19a6f6['secret'],'read':_0x19a6f6['read'],'attachment':_0x19a6f6[_0xd6e2('0xcf')]};})[_0xd6e2('0x5d')]()};return ejs[_0xd6e2('0xe1')](path[_0xd6e2('0xc4')](config['root'],_0xd6e2('0xc6'),_0xd6e2('0xe2'),_0xd6e2('0xe3')),{'interaction':_0x2dec3e})[_0xd6e2('0x27')](function(_0x252a04){var _0x47d067=path[_0xd6e2('0xc4')](_0x275026,_0xd6e2('0xe4')+_0xc35f4b['id']+'-'+_0x33b6ba+_0xd6e2('0xe5'));var _0x133447={'path':_0x47d067,'channel':_0xd6e2('0xd6'),'interactionId':_0xc35f4b['id']};return pdf[_0xd6e2('0xe6')](_0x252a04,_0x133447);})[_0xd6e2('0x27')](function(){return new BPromise(function(_0x212049,_0x7f958d){zipdir(_0x275026,{'saveTo':_0x503b3e},function(_0x270e06,_0x265522){if(_0x270e06)return _0x7f958d(_0x270e06);return _0x212049(_0x265522);});})[_0xd6e2('0x27')](function(){return new BPromise(function(_0x37828e,_0x3978e0){rimraf(_0x275026,function(_0x21cb88){if(_0x21cb88)_0x3978e0(_0x21cb88);return _0x37828e();});});})[_0xd6e2('0x27')](function(){return _0x220bb6['download'](_0x503b3e,_0x7c0318,function(_0x356905){if(_0x356905){console[_0xd6e2('0xe7')](_0xd6e2('0xe8'),_0x356905);}else{fs['unlinkSync'](_0x503b3e);}});});});}else{return _0x220bb6['sendStatus'](0xc8);}})[_0xd6e2('0xaa')](handleError(_0x220bb6,null));}; \ No newline at end of file +var _0x7d57=['start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','OpenchannelInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','catch','show','type','params','includeAll','include','merge','create','update','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','nolimit','options','findAll','addTags','emit','openchannelInteractionTags:save','removeTags','download','join','root','files','tmp','attachments','format','fullname','CmContact','firstName','Attachment','Messages','secret','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','direction','out','System','renderFile','server','views','downloadInteraction.ejs','.pdf','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','Tags','TagIds','split','forEach','push','index','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','field','color','tools_tags','select','u.id','u.fullname','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text'];(function(_0x1c3bbd,_0x5c0f8f){var _0x4679a3=function(_0x72cd13){while(--_0x72cd13){_0x1c3bbd['push'](_0x1c3bbd['shift']());}};_0x4679a3(++_0x5c0f8f);}(_0x7d57,0x88));var _0x77d5=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x7d57[_0x587dd0];return _0x56f153;};'use strict';var emlformat=require(_0x77d5('0x0'));var rimraf=require(_0x77d5('0x1'));var zipdir=require(_0x77d5('0x2'));var jsonpatch=require(_0x77d5('0x3'));var rp=require(_0x77d5('0x4'));var moment=require(_0x77d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x77d5('0x6'));var util=require(_0x77d5('0x7'));var path=require(_0x77d5('0x8'));var sox=require(_0x77d5('0x9'));var csv=require(_0x77d5('0xa'));var ejs=require(_0x77d5('0xb'));var fs=require('fs');var fs_extra=require(_0x77d5('0xc'));var _=require(_0x77d5('0xd'));var squel=require(_0x77d5('0xe'));var crypto=require(_0x77d5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x77d5('0x10'));var toCsv=require(_0x77d5('0xa'));var querystring=require(_0x77d5('0x11'));var Papa=require(_0x77d5('0x12'));var Redis=require(_0x77d5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x77d5('0x14'));var as=require(_0x77d5('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77d5('0x16'))(_0x77d5('0x17'));var utils=require(_0x77d5('0x18'));var config=require(_0x77d5('0x19'));var licenseUtil=require(_0x77d5('0x1a'));var db=require('../../mysqldb')['db'];config[_0x77d5('0x1b')]=_['defaults'](config[_0x77d5('0x1b')],{'host':_0x77d5('0x1c'),'port':0x18eb});var socket=require(_0x77d5('0x1d'))(new Redis(config[_0x77d5('0x1b')]));require('./openchannelInteraction.socket')[_0x77d5('0x1e')](socket);function respondWithStatusCode(_0x530c2e,_0x48e443){_0x48e443=_0x48e443||0xcc;return function(_0x3e286d){if(_0x3e286d){return _0x530c2e[_0x77d5('0x1f')](_0x48e443);}return _0x530c2e[_0x77d5('0x20')](_0x48e443)[_0x77d5('0x21')]();};}function respondWithResult(_0x41c150,_0x2c9680){_0x2c9680=_0x2c9680||0xc8;return function(_0xd2ccc4){if(_0xd2ccc4){return _0x41c150[_0x77d5('0x20')](_0x2c9680)[_0x77d5('0x22')](_0xd2ccc4);}};}function respondWithFilteredResult(_0x37e3cd,_0x466bfe){return function(_0x2dd783){if(_0x2dd783){var _0x3a56ec=typeof _0x466bfe[_0x77d5('0x23')]===_0x77d5('0x24')&&typeof _0x466bfe[_0x77d5('0x25')]===_0x77d5('0x24');var _0x4df88e=_0x2dd783['count'];var _0x530fbe=_0x3a56ec?0x0:_0x466bfe['offset'];var _0xe059bb=_0x3a56ec?_0x2dd783[_0x77d5('0x26')]:_0x466bfe[_0x77d5('0x23')]+_0x466bfe[_0x77d5('0x25')];var _0x3d5b07;if(_0xe059bb>=_0x4df88e){_0xe059bb=_0x4df88e;_0x3d5b07=0xc8;}else{_0x3d5b07=0xce;}_0x37e3cd['status'](_0x3d5b07);return _0x37e3cd[_0x77d5('0x27')](_0x77d5('0x28'),_0x530fbe+'-'+_0xe059bb+'/'+_0x4df88e)[_0x77d5('0x22')](_0x2dd783);}return null;};}function patchUpdates(_0x2a8feb){return function(_0x2363fa){try{jsonpatch['apply'](_0x2363fa,_0x2a8feb,!![]);}catch(_0x49eede){return BPromise[_0x77d5('0x29')](_0x49eede);}return _0x2363fa[_0x77d5('0x2a')]();};}function saveUpdates(_0x474fa5,_0x439c80){return function(_0x25e30c){if(_0x25e30c){return _0x25e30c['update'](_0x474fa5)[_0x77d5('0x2b')](function(_0x2f3718){return _0x2f3718;});}return null;};}function removeEntity(_0xb9c573,_0x5db660){return function(_0x1fe3aa){if(_0x1fe3aa){return _0x1fe3aa[_0x77d5('0x2c')]()[_0x77d5('0x2b')](function(){_0xb9c573[_0x77d5('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520351,_0x19edf4){return function(_0x4f40cf){if(!_0x4f40cf){_0x520351[_0x77d5('0x1f')](0x194);}return _0x4f40cf;};}function handleError(_0x5b33d3,_0xd1407a){_0xd1407a=_0xd1407a||0x1f4;return function(_0x2aa296){logger[_0x77d5('0x2d')](_0x2aa296['stack']);if(_0x2aa296['name']){delete _0x2aa296[_0x77d5('0x2e')];}_0x5b33d3[_0x77d5('0x20')](_0xd1407a)[_0x77d5('0x2f')](_0x2aa296);};}function getInteractionUsers(_0x22ab6b,_0x4d07fc){return new BPromise(function(_0x425b35,_0xe551d8){try{if(_0x4d07fc[_0x22ab6b['id']]){_0x22ab6b['Users']=_['map'](_0x4d07fc[_0x22ab6b['id']],function(_0x1aea99){return{'id':_0x1aea99['id'],'fullname':_0x1aea99['fullname']};});}}catch(_0x18edc9){_0xe551d8(_0x18edc9);}_0x425b35(_0x22ab6b);});}function getInteractionTags(_0x38bb54,_0x401af2){return new BPromise(function(_0x539e5d,_0x44654c){try{if(_0x38bb54['TagIds']){_0x38bb54[_0x77d5('0x30')]=[];_0x38bb54[_0x77d5('0x31')][_0x77d5('0x32')](',')[_0x77d5('0x33')](function(_0x25e6dd){_0x38bb54['Tags'][_0x77d5('0x34')](_0x401af2[_0x25e6dd]);});}delete _0x38bb54[_0x77d5('0x31')];}catch(_0x511617){_0x44654c(_0x511617);}_0x539e5d(_0x38bb54);});}function updateOpenchannelInteraction(_0x4e634e,_0x1d64c3,_0x55248c){return new BPromise(function(_0x3e3966,_0x589625){return getInteractionUsers(_0x4e634e,_0x55248c)[_0x77d5('0x2b')](function(_0xd55fae){return getInteractionTags(_0xd55fae,_0x1d64c3);})[_0x77d5('0x2b')](function(_0x550645){_0x3e3966(_0x550645);})['catch'](function(_0x17b954){_0x589625(_0x17b954);});});}exports[_0x77d5('0x35')]=function(_0xbd698f,_0x820725){var _0x266b71={},_0x17744a={},_0x5e2f29={'count':0x0,'rows':[]};var _0x4fdfde=_['map'](db['OpenchannelInteraction'][_0x77d5('0x36')],function(_0x160c3c){return{'name':_0x160c3c[_0x77d5('0x37')],'type':_0x160c3c['type'][_0x77d5('0x38')]};});_0x17744a[_0x77d5('0x39')]=_[_0x77d5('0x3a')](_0x4fdfde,'name');_0x17744a['query']=_[_0x77d5('0x3b')](_0xbd698f['query']);_0x17744a[_0x77d5('0x3c')]=_[_0x77d5('0x3d')](_0x17744a[_0x77d5('0x39')],_0x17744a[_0x77d5('0x3e')]);_0x266b71[_0x77d5('0x3f')]=_[_0x77d5('0x3d')](_0x17744a[_0x77d5('0x39')],qs[_0x77d5('0x40')](_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x40')]));_0x266b71[_0x77d5('0x3f')]=_0x266b71[_0x77d5('0x3f')][_0x77d5('0x41')]?_0x266b71[_0x77d5('0x3f')]:_0x17744a[_0x77d5('0x39')];if(!_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x42')]('nolimit')){_0x266b71[_0x77d5('0x25')]=qs[_0x77d5('0x25')](_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x25')]);_0x266b71[_0x77d5('0x23')]=qs[_0x77d5('0x23')](_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x23')]);}_0x266b71[_0x77d5('0x43')]=qs[_0x77d5('0x44')](_0xbd698f[_0x77d5('0x3e')]['sort']);_0x266b71[_0x77d5('0x45')]=qs['filters'](_['pick'](_0xbd698f[_0x77d5('0x3e')],_0x17744a['filters']),_0x4fdfde);var _0x3e0455=[];var _0x168012=squel['select']()[_0x77d5('0x46')]('id')[_0x77d5('0x46')]('name')['field'](_0x77d5('0x47'))['from'](_0x77d5('0x48'));var _0x9ceff=squel[_0x77d5('0x49')]()[_0x77d5('0x46')](_0x77d5('0x4a'))[_0x77d5('0x46')](_0x77d5('0x4b'))['field']('ui.OpenchannelInteractionId')[_0x77d5('0x4c')](_0x77d5('0x4d'),'ui')['left_join'](_0x77d5('0x4e'),'u',_0x77d5('0x4f'));var _0x45df5d=squel[_0x77d5('0x49')]()['from'](_0x77d5('0x50'),'i')[_0x77d5('0x51')](_0x77d5('0x52'),'c',_0x77d5('0x53'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x77d5('0x51')](_0x77d5('0x54'),'a',_0x77d5('0x55'))[_0x77d5('0x51')](_0x77d5('0x56'),'me',_0x77d5('0x57'))[_0x77d5('0x51')](_0x77d5('0x58'),'it',_0x77d5('0x59'))[_0x77d5('0x51')]('tools_tags','t',_0x77d5('0x5a'));var _0x24acd2=squel[_0x77d5('0x5b')]();var _0x2304f1=[];var _0x4271ac=squel['expr']();var _0x4f0a41;if(_0xbd698f['query']['search']){_0x4f0a41=as[_0x77d5('0x5c')](_0xbd698f[_0x77d5('0x3e')]['search']);var _0x322619=_0x4f0a41[_0x77d5('0x5d')];for(var _0x266479=0x0;_0x266479<_0x4f0a41[_0x77d5('0x5e')]['length'];_0x266479++){var _0x4f943d=_0x4f0a41[_0x77d5('0x5e')][_0x266479];var _0x476f07='i';var _0x480c8b=_[_0x77d5('0x5f')](_0x4fdfde,[_0x77d5('0x2e'),_0x4f943d['field']]);if(!_0x480c8b){switch(_0x4f943d['field']){case _0x77d5('0x60'):if(_0x4f943d['value']==0x1){_0x45df5d['having']('`'+_0x4f943d[_0x77d5('0x46')]+'`\x20=\x200');}else{_0x45df5d['having']('`'+_0x4f943d[_0x77d5('0x46')]+'`\x20>\x200');}break;case _0x77d5('0x61'):if(_0x4f943d[_0x77d5('0x62')]===_0x77d5('0x63')){if(_0x4f943d[_0x77d5('0x64')][_0x77d5('0x32')]('\x20')[_0x77d5('0x41')]>0x1){_0x24acd2[_0x322619](_0x77d5('0x65'),qs['getFullTextValue'](_0x4f943d[_0x77d5('0x64')]),null);}else{var _0x7b14='%'+_0x4f943d[_0x77d5('0x64')]+'%';_0x24acd2[_0x322619](_0x77d5('0x66'),_0x7b14,_0x7b14,_0x7b14);}}else{_0x480c8b=_['find'](_0x4fdfde,[_0x77d5('0x2e'),_0x77d5('0x67')]);_0x4f943d[_0x77d5('0x46')]='ContactId';_0x2433ad=as[_0x77d5('0x68')](_0x476f07,_0x480c8b['type'],_0x4f943d);_0x24acd2[_0x322619](_0x2433ad[_0x77d5('0x69')],_0x2433ad[_0x77d5('0x64')][_0x77d5('0x6a')],_0x2433ad['value'][_0x77d5('0x21')]);}break;case _0x77d5('0x6b'):var _0x5c5faa=_0x4f943d[_0x77d5('0x64')]['split'](',')['map'](function(_0x2d90d3){return Number(_0x2d90d3);});_0x5c5faa[_0x77d5('0x33')](function(_0x1b0c13){_0x4271ac['or'](_0x77d5('0x6c'),'%,'+_0x1b0c13+',%');});_0x2304f1=_[_0x77d5('0x6d')](_0x2304f1,_0x5c5faa);break;case _0x77d5('0x6e'):if(_0x4f943d[_0x77d5('0x62')]==='$substring'){_0x24acd2[_0x322619]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4f943d[_0x77d5('0x64')]+'%',null);}else{_0x480c8b=_[_0x77d5('0x5f')](_0x4fdfde,['name',_0x77d5('0x6f')]);_0x4f943d['field']=_0x77d5('0x6f');_0x2433ad=as['buildExpression'](_0x476f07,_0x480c8b['type'],_0x4f943d);_0x24acd2[_0x322619](_0x2433ad[_0x77d5('0x69')],_0x2433ad[_0x77d5('0x64')][_0x77d5('0x6a')],_0x2433ad[_0x77d5('0x64')][_0x77d5('0x21')]);}break;case'body':_0x2433ad=as[_0x77d5('0x68')]('me',null,_0x4f943d);_0x24acd2[_0x322619](_0x2433ad[_0x77d5('0x69')],_0x2433ad[_0x77d5('0x64')][_0x77d5('0x6a')],_0x2433ad['value'][_0x77d5('0x21')]);break;}}else{var _0x2433ad=as[_0x77d5('0x68')](_0x476f07,_0x480c8b['type'],_0x4f943d);_0x24acd2[_0x322619](_0x2433ad[_0x77d5('0x69')],_0x2433ad[_0x77d5('0x64')][_0x77d5('0x6a')],_0x2433ad[_0x77d5('0x64')][_0x77d5('0x21')]);}}}else{var _0x28d008=_(_0xbd698f[_0x77d5('0x3e')])[_0x77d5('0x3b')]()[_0x77d5('0x3a')](function(_0x3f3095){return _[_0x77d5('0x70')](_0x4fdfde,[_0x77d5('0x2e'),_0x3f3095])?_0x3f3095:undefined;})[_0x77d5('0x71')]()[_0x77d5('0x64')]();if(!_[_0x77d5('0x72')](_0x28d008)){_0x28d008['forEach'](function(_0x29a7b8){if(_0x29a7b8===_0x77d5('0x73')){_0x45df5d[_0x77d5('0x45')](_0x77d5('0x74'),[][_0x77d5('0x75')](_0xbd698f[_0x77d5('0x3e')][_0x29a7b8]));}else if(_0x29a7b8===_0x77d5('0x76')){var _0x4028ba=JSON[_0x77d5('0x77')](_0xbd698f[_0x77d5('0x3e')][_0x29a7b8])[_0x77d5('0x78')];var _0x20b615=JSON['parse'](_0xbd698f['query'][_0x29a7b8])[_0x77d5('0x79')];_0x45df5d[_0x77d5('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4028ba,_0x20b615);}else{if(_0xbd698f[_0x77d5('0x3e')][_0x29a7b8]===_0x77d5('0x7a')){_0x45df5d[_0x77d5('0x45')]('i.'+_0x29a7b8+_0x77d5('0x7b'));}else{_0x45df5d[_0x77d5('0x45')]('i.'+_0x29a7b8+_0x77d5('0x7c'),_0xbd698f[_0x77d5('0x3e')][_0x29a7b8]);}}});}if(_0xbd698f[_0x77d5('0x3e')]['read']){if(_0xbd698f[_0x77d5('0x3e')]['read']==0x1){_0x45df5d[_0x77d5('0x7d')](_0x77d5('0x7e'));}else{_0x45df5d[_0x77d5('0x7d')]('`unreadMessages`\x20>\x200');}}if(_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x7f')]){_0x2304f1=_[_0x77d5('0x80')](_0xbd698f[_0x77d5('0x3e')]['tag'])?_0xbd698f['query'][_0x77d5('0x7f')]:new Array(_0xbd698f['query'][_0x77d5('0x7f')]);_0x2304f1['forEach'](function(_0x59b5f0){_0x4271ac['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x59b5f0+',%');});}if(_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x81')]){var _0x786f57=_0xbd698f['query']['filter'][_0x77d5('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x77d5('0x83')](_0x786f57)){_0x24acd2['or']('i.id\x20LIKE\x20?',_0x786f57+'%');}else{_0x24acd2['or'](_0x77d5('0x84'),qs['getFullTextValue'](_0x786f57))['or'](_0x77d5('0x85'),_0x786f57+'%')['or'](_0x77d5('0x86'),_0x786f57+'%');}}}_0x45df5d[_0x77d5('0x45')](_0x24acd2);_0x45df5d[_0x77d5('0x87')](_0x77d5('0x88'));var _0x5966fc={'type':db[_0x77d5('0x89')][_0x77d5('0x8a')][_0x77d5('0x8b')],'raw':!![]};var _0x4525bd=_0x45df5d['clone']();_0x4525bd[_0x77d5('0x46')](_0x77d5('0x88'));_0x4525bd[_0x77d5('0x46')](_0x77d5('0x8c'),_0x77d5('0x60'));if(_0x266b71[_0x77d5('0x43')]){_0x266b71['order'][_0x77d5('0x33')](function(_0x5cfdb6){var _0x153131=_0x5cfdb6[0x0]===_0x77d5('0x8d')?_0x5cfdb6[0x0]:'i.'+_0x5cfdb6[0x0];_0x45df5d[_0x77d5('0x43')](_0x153131,_0x5cfdb6[0x1]===_0x77d5('0x8e')?![]:!![]);});}if(!_[_0x77d5('0x72')](_0x2304f1)){_0x45df5d[_0x77d5('0x7d')](_0x4271ac);_0x4525bd[_0x77d5('0x45')](_0x77d5('0x8f'),_0x2304f1);}BPromise[_0x77d5('0x90')]()[_0x77d5('0x2b')](function(){if(!_0x4f0a41){if(_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x73')])return;_0x4525bd[_0x77d5('0x45')](_0x77d5('0x91'));_0x45df5d[_0x77d5('0x45')](_0x77d5('0x91'));return;}if(_0xbd698f['user'][_0x77d5('0x92')]!==_0x77d5('0x93'))return;return _0xbd698f[_0x77d5('0x94')][_0x77d5('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x500e33){if(_[_0x77d5('0x72')](_0x500e33)){_0x4525bd['where'](_0x77d5('0x96'));_0x45df5d[_0x77d5('0x45')](_0x77d5('0x96'));}else{_0x4525bd[_0x77d5('0x45')](_0x77d5('0x74'),_['map'](_0x500e33,'id'));_0x45df5d[_0x77d5('0x45')](_0x77d5('0x74'),_[_0x77d5('0x3a')](_0x500e33,'id'));}});})[_0x77d5('0x2b')](function(){if(_0xbd698f[_0x77d5('0x94')][_0x77d5('0x92')]===_0x77d5('0x93')&&!_0x4f0a41&&!_0xbd698f[_0x77d5('0x3e')][_0x77d5('0x73')])return[];return db['sequelize']['query'](_0x4525bd[_0x77d5('0x97')](),_0x5966fc);})['then'](function(_0x1a10cd){_0x5e2f29['count']=_0x1a10cd[_0x77d5('0x41')];if(_0x5e2f29[_0x77d5('0x26')]===0x0)return[];return db[_0x77d5('0x98')][_0x77d5('0x3e')](_0x168012[_0x77d5('0x97')](),_0x5966fc)[_0x77d5('0x2b')](function(_0x1012a2){_0x3e0455=_[_0x77d5('0x99')](_0x1012a2,'id');_0x5966fc=_['merge'](_0x5966fc,{'model':db[_0x77d5('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xbd698f['query'][_0x77d5('0x40')]){_0x266b71[_0x77d5('0x3f')][_0x77d5('0x33')](function(_0x2a9dc1){_0x45df5d[_0x77d5('0x46')]('i.'+_0x2a9dc1);});}else{_0x45df5d[_0x77d5('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x77d5('0x60'));_0x45df5d[_0x77d5('0x46')]('a.key',_0x77d5('0x9b'));_0x45df5d[_0x77d5('0x46')](_0x77d5('0x9c'),_0x77d5('0x9d'));_0x45df5d['field'](_0x77d5('0x9e'),_0x77d5('0x8d'));_0x45df5d[_0x77d5('0x46')](_0x77d5('0x9f'));_0x45df5d[_0x77d5('0x46')](_0x77d5('0xa0'),_0x77d5('0xa1'));_0x45df5d['field']('c.lastName',_0x77d5('0xa2'));_0x45df5d[_0x77d5('0x46')]('c.email',_0x77d5('0xa3'));_0x45df5d['field'](_0x77d5('0xa4'),_0x77d5('0xa5'));_0x45df5d[_0x77d5('0x46')](_0x77d5('0xa6'),'Contact.mobile');_0x45df5d[_0x77d5('0x46')](_0x77d5('0xa7'),_0x77d5('0xa8'));_0x45df5d['field'](_0x77d5('0xa9'),_0x77d5('0xaa'));_0x45df5d[_0x77d5('0x46')](_0x77d5('0xab'),_0x77d5('0xac'));_0x45df5d[_0x77d5('0x46')](_0x77d5('0xad'),_0x77d5('0x31'));}if(_0x266b71[_0x77d5('0x25')])_0x45df5d[_0x77d5('0x25')](_0x266b71[_0x77d5('0x25')]);if(_0x266b71[_0x77d5('0x23')])_0x45df5d['offset'](_0x266b71[_0x77d5('0x23')]);return db[_0x77d5('0x98')][_0x77d5('0x3e')](_0x45df5d[_0x77d5('0x97')](),_0x5966fc);})['then'](function(_0x4aeabb){if(_0x4aeabb[_0x77d5('0x41')]>0x0)_0x9ceff[_0x77d5('0x45')](_0x77d5('0xae'),_['map'](_0x4aeabb,'id'));return db[_0x77d5('0x98')][_0x77d5('0x3e')](_0x9ceff[_0x77d5('0x97')](),_0x5966fc)[_0x77d5('0x2b')](function(_0x19641e){var _0x6166e9=_[_0x77d5('0xaf')](_0x19641e,_0x77d5('0xb0'));var _0x46886a=[];_0x4aeabb[_0x77d5('0x33')](function(_0x2322a8){_0x46886a[_0x77d5('0x34')](updateOpenchannelInteraction(_0x2322a8,_0x3e0455,_0x6166e9));});return BPromise[_0x77d5('0xb1')](_0x46886a);});});})[_0x77d5('0x2b')](function(_0x48e413){_0x5e2f29['rows']=_0x48e413;return _0x5e2f29;})[_0x77d5('0x2b')](respondWithFilteredResult(_0x820725,_0x266b71))[_0x77d5('0xb2')](handleError(_0x820725,null));};exports[_0x77d5('0xb3')]=function(_0x2711a3,_0x2985ea){var _0x37e622={};if(_0x2711a3['query'][_0x77d5('0xb4')]&&_0x2711a3[_0x77d5('0x3e')]['type']===_0x77d5('0x4c')){_0x37e622[_0x77d5('0x4c')]=_0x2711a3[_0x77d5('0xb5')]['id'];}else{_0x37e622['id']=_0x2711a3[_0x77d5('0xb5')]['id'];}var _0x3b562f={'raw':![],'where':_0x37e622},_0x6a45d5={};_0x6a45d5['model']=_['keys'](db[_0x77d5('0x9a')][_0x77d5('0x36')]);_0x6a45d5[_0x77d5('0x3e')]=_['keys'](_0x2711a3[_0x77d5('0x3e')]);_0x6a45d5['filters']=_[_0x77d5('0x3d')](_0x6a45d5[_0x77d5('0x39')],_0x6a45d5[_0x77d5('0x3e')]);_0x3b562f['attributes']=_[_0x77d5('0x3d')](_0x6a45d5[_0x77d5('0x39')],qs['fields'](_0x2711a3[_0x77d5('0x3e')][_0x77d5('0x40')]));_0x3b562f[_0x77d5('0x3f')]=_0x3b562f[_0x77d5('0x3f')]['length']?_0x3b562f[_0x77d5('0x3f')]:_0x6a45d5[_0x77d5('0x39')];if(_0x2711a3['query'][_0x77d5('0xb6')]){_0x3b562f[_0x77d5('0xb7')]=[{'all':!![]}];}_0x3b562f=_[_0x77d5('0xb8')]({},_0x3b562f,_0x2711a3['options']);return db[_0x77d5('0x9a')][_0x77d5('0x5f')](_0x3b562f)['then'](handleEntityNotFound(_0x2985ea,null))[_0x77d5('0x2b')](respondWithResult(_0x2985ea,null))[_0x77d5('0xb2')](handleError(_0x2985ea,null));};exports['create']=function(_0xd056a9,_0x187a44){return db[_0x77d5('0x9a')][_0x77d5('0xb9')](_0xd056a9['body'],{})['then'](respondWithResult(_0x187a44,0xc9))['catch'](handleError(_0x187a44,null));};exports[_0x77d5('0xba')]=function(_0x84cce2,_0x135347){if(_0x84cce2[_0x77d5('0xbb')]['id']){delete _0x84cce2[_0x77d5('0xbb')]['id'];}return db['OpenchannelInteraction'][_0x77d5('0x5f')]({'where':{'id':_0x84cce2['params']['id']}})[_0x77d5('0x2b')](handleEntityNotFound(_0x135347,null))['then'](saveUpdates(_0x84cce2['body'],null))[_0x77d5('0x2b')](respondWithResult(_0x135347,null))[_0x77d5('0xb2')](handleError(_0x135347,null));};exports['destroy']=function(_0x251dcf,_0x2e4f18){return db[_0x77d5('0x9a')][_0x77d5('0x5f')]({'where':{'id':_0x251dcf[_0x77d5('0xb5')]['id']}})[_0x77d5('0x2b')](handleEntityNotFound(_0x2e4f18,null))[_0x77d5('0x2b')](removeEntity(_0x2e4f18,null))[_0x77d5('0xb2')](handleError(_0x2e4f18,null));};exports[_0x77d5('0xbc')]=function(_0x32ae1c,_0x5b00cd){return db[_0x77d5('0x9a')][_0x77d5('0xbc')]()[_0x77d5('0x2b')](respondWithResult(_0x5b00cd,null))[_0x77d5('0xb2')](handleError(_0x5b00cd,null));};exports[_0x77d5('0xbd')]=function(_0x4e8ee3,_0x31fe67,_0x27db8b){return db[_0x77d5('0xbe')][_0x77d5('0x5f')]({'where':{'id':_0x4e8ee3['params']['id']}})[_0x77d5('0x2b')](handleEntityNotFound(_0x31fe67,null))[_0x77d5('0x2b')](function(_0x264ee0){if(_0x264ee0){return _0x264ee0['addMessage'](_0x4e8ee3[_0x77d5('0xbb')][_0x77d5('0xbf')],_[_0x77d5('0xc0')](_0x4e8ee3['body'],[_0x77d5('0xbf'),'id'])||{});}})['then'](respondWithResult(_0x31fe67,null))['catch'](handleError(_0x31fe67,null));};exports['getMessages']=function(_0x4fac21,_0x5c133f,_0x107852){var _0x420a94={'raw':![],'where':{}};var _0x9723fc={};var _0x5c9a0b={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x77d5('0xc1')]({'where':{'id':_0x4fac21[_0x77d5('0xb5')]['id']}})[_0x77d5('0x2b')](handleEntityNotFound(_0x5c133f,null))['then'](function(_0x3dc1fe){if(_0x3dc1fe){_0x9723fc[_0x77d5('0x39')]=_[_0x77d5('0x3b')](db[_0x77d5('0xbe')][_0x77d5('0x36')]);_0x9723fc[_0x77d5('0x3e')]=_['keys'](_0x4fac21[_0x77d5('0x3e')]);_0x9723fc[_0x77d5('0x3c')]=_['intersection'](_0x9723fc[_0x77d5('0x39')],_0x9723fc[_0x77d5('0x3e')]);_0x420a94['attributes']=_[_0x77d5('0x3d')](_0x9723fc[_0x77d5('0x39')],qs['fields'](_0x4fac21[_0x77d5('0x3e')][_0x77d5('0x40')]));_0x420a94[_0x77d5('0x3f')]=_0x420a94[_0x77d5('0x3f')][_0x77d5('0x41')]?_0x420a94[_0x77d5('0x3f')]:_0x9723fc['model'];if(!_0x4fac21[_0x77d5('0x3e')][_0x77d5('0x42')](_0x77d5('0xc2'))){_0x420a94[_0x77d5('0x25')]=qs[_0x77d5('0x25')](_0x4fac21['query']['limit']);_0x420a94[_0x77d5('0x23')]=qs[_0x77d5('0x23')](_0x4fac21['query']['offset']);}_0x420a94['order']=qs[_0x77d5('0x44')](_0x4fac21[_0x77d5('0x3e')][_0x77d5('0x44')]);_0x420a94[_0x77d5('0x45')]=qs[_0x77d5('0x3c')](_['pick'](_0x4fac21[_0x77d5('0x3e')],_0x9723fc[_0x77d5('0x3c')]));_0x420a94[_0x77d5('0x45')][_0x77d5('0xb0')]=_0x3dc1fe['id'];if(_0x4fac21[_0x77d5('0x3e')][_0x77d5('0x81')]){_0x420a94[_0x77d5('0x45')]=_['merge'](_0x420a94[_0x77d5('0x45')],{'$or':_['map'](_0x420a94[_0x77d5('0x3f')],function(_0x2ae080){var _0x2533f8={};_0x2533f8[_0x2ae080]={'$like':'%'+_0x4fac21['query']['filter']+'%'};return _0x2533f8;})});}if(_0x4fac21[_0x77d5('0x3e')][_0x77d5('0x78')]){var _0x108ec3=_0x4fac21['query'][_0x77d5('0x78')]['split'](',');var _0x2ee41c={};_0x2ee41c[_0x108ec3[0x0]]={'$gte':moment(_0x108ec3[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x420a94[_0x77d5('0x45')]=_['merge'](_0x420a94['where'],_0x2ee41c);}_0x420a94=_['merge']({},_0x420a94,_0x4fac21[_0x77d5('0xc3')]);return db[_0x77d5('0xbe')][_0x77d5('0x26')]({'where':_0x420a94[_0x77d5('0x45')]})[_0x77d5('0x2b')](function(_0x241741){_0x5c9a0b['count']=_0x241741;if(_0x4fac21[_0x77d5('0x3e')][_0x77d5('0xb6')]){_0x420a94['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x77d5('0xc4')](_0x420a94);})['then'](function(_0xf3dd50){_0x5c9a0b['rows']=_0xf3dd50;return _0x5c9a0b;});}})['then'](respondWithFilteredResult(_0x5c133f,_0x420a94))['catch'](handleError(_0x5c133f,null));};exports[_0x77d5('0xc5')]=function(_0x12016b,_0xdeace9,_0x1939c0){return db[_0x77d5('0x9a')]['find']({'where':{'id':_0x12016b[_0x77d5('0xb5')]['id']}})[_0x77d5('0x2b')](handleEntityNotFound(_0xdeace9,null))['then'](function(_0x11e141){if(_0x11e141){return _0x11e141['setTags'](_0x12016b['body'][_0x77d5('0xbf')],_[_0x77d5('0xc0')](_0x12016b[_0x77d5('0xbb')],[_0x77d5('0xbf'),'id'])||{})['spread'](function(){return db[_0x77d5('0x6b')][_0x77d5('0xc4')]({'attributes':['id',_0x77d5('0x2e'),'color'],'where':{'id':_0x12016b[_0x77d5('0xbb')][_0x77d5('0xbf')]}});})['then'](function(_0x5f303c){socket[_0x77d5('0xc6')](_0x77d5('0xc7'),{'id':Number(_0x12016b['params']['id']),'tags':_0x5f303c||[]});return{'id':Number(_0x12016b[_0x77d5('0xb5')]['id']),'tags':_0x5f303c||[]};});}})[_0x77d5('0x2b')](respondWithResult(_0xdeace9,null))[_0x77d5('0xb2')](handleError(_0xdeace9,null));};exports[_0x77d5('0xc8')]=function(_0x4800b2,_0x5ede8d,_0x39752b){return db[_0x77d5('0x9a')]['find']({'where':{'id':_0x4800b2['params']['id']}})[_0x77d5('0x2b')](handleEntityNotFound(_0x5ede8d,null))[_0x77d5('0x2b')](function(_0x774d1b){if(_0x774d1b){return _0x774d1b[_0x77d5('0xc8')](_0x4800b2[_0x77d5('0x3e')][_0x77d5('0xbf')]);}})[_0x77d5('0x2b')](respondWithStatusCode(_0x5ede8d,null))['catch'](handleError(_0x5ede8d,null));};exports[_0x77d5('0xc9')]=function(_0x5e8fc5,_0x5b3580){var _0x5cba5c=moment()['unix']()[_0x77d5('0x97')]();var _0x5b7954=path[_0x77d5('0xca')](config[_0x77d5('0xcb')],'server',_0x77d5('0xcc'),_0x77d5('0xcd'));var _0x33c154=path['join'](config[_0x77d5('0xcb')],'server',_0x77d5('0xcc'),_0x77d5('0xce'));var _0x5789f6=path[_0x77d5('0xca')](_0x5b7954,_0x5cba5c);var _0x159b29=util[_0x77d5('0xcf')]('transcript-%d-%s.zip',_0x5e8fc5['params']['id'],_0x5cba5c);var _0x5ea0b6=path[_0x77d5('0xca')](_0x5b7954,_0x159b29);var _0x2c7ab3=[];_0x2c7ab3[_0x77d5('0x34')]({'model':db['User'],'as':'User','attributes':['id',_0x77d5('0xd0')],'raw':!![]});_0x2c7ab3[_0x77d5('0x34')]({'model':db[_0x77d5('0xd1')],'as':'Contact','attributes':['id',_0x77d5('0xd2'),'lastName'],'raw':!![]});if(_0x5e8fc5[_0x77d5('0x3e')]['attachments']){_0x2c7ab3[_0x77d5('0x34')]({'model':db[_0x77d5('0xd3')],'as':'Attachment','raw':!![]});}var _0x31c5cd=[{'model':db[_0x77d5('0xbe')],'as':_0x77d5('0xd4'),'attributes':['id',_0x77d5('0xbb'),_0x77d5('0x76'),'direction',_0x77d5('0xd5'),_0x77d5('0xd6')],'include':_0x2c7ab3}];_0x31c5cd['push']({'model':db[_0x77d5('0xd7')],'as':_0x77d5('0xd8'),'attributes':['id',_0x77d5('0x2e')]});_0x31c5cd['push']({'model':db[_0x77d5('0x6e')],'as':'Owner','attributes':['id',_0x77d5('0xd0')]});return db[_0x77d5('0x9a')][_0x77d5('0x5f')]({'where':{'id':_0x5e8fc5[_0x77d5('0xb5')]['id']},'include':_0x31c5cd})[_0x77d5('0x2b')](handleEntityNotFound(_0x5b3580,null))[_0x77d5('0x2b')](function(_0x53bfe8){if(_0x53bfe8){var _0x2c7054=_0x53bfe8[_0x77d5('0xd9')]({'plain':!![]});fs[_0x77d5('0xda')](_0x5789f6);var _0x45f0bc={'channel':_0x77d5('0xdb'),'account':_0x2c7054['Account']['name'],'agent':_0x2c7054[_0x77d5('0xdc')]?_0x2c7054[_0x77d5('0xdc')][_0x77d5('0xd0')]:_0x77d5('0xdd'),'createdAt':moment(_0x2c7054[_0x77d5('0x76')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x77d5('0x97')](),'closedAt':_0x2c7054[_0x77d5('0xde')]?moment(_0x2c7054[_0x77d5('0xdf')])[_0x77d5('0xcf')](_0x77d5('0xe0'))['toString']():'','disposition':_0x2c7054[_0x77d5('0xe1')],'visibility':_0x2c7054[_0x77d5('0xe2')]?_0x77d5('0xe3'):_0x77d5('0xe4'),'messages':_(_0x2c7054[_0x77d5('0xd4')])[_0x77d5('0x81')]({'secret':![]})['map'](function(_0x471a23){if(_0x471a23[_0x77d5('0xd3')]){var _0x4aea64=path[_0x77d5('0xca')](_0x33c154,_0x471a23[_0x77d5('0xd3')][_0x77d5('0xe5')]);if(fs['existsSync'](_0x4aea64)){fs[_0x77d5('0xe6')](_0x4aea64)[_0x77d5('0xe7')](fs[_0x77d5('0xe8')](path[_0x77d5('0xca')](_0x5789f6,_0x471a23['Attachment'][_0x77d5('0xe5')])));}}return{'date':moment(_0x471a23[_0x77d5('0x76')])[_0x77d5('0xcf')](_0x77d5('0xe0'))[_0x77d5('0x97')](),'sender':_0x471a23[_0x77d5('0xe9')]===_0x77d5('0xea')?_0x471a23[_0x77d5('0x6e')]?_0x471a23['User']['fullname']:_0x77d5('0xeb'):_0x471a23[_0x77d5('0x61')]['firstName']+(_0x471a23[_0x77d5('0x61')]['lastName']?'\x20'+_0x471a23[_0x77d5('0x61')]['lastName']:''),'body':_0x471a23[_0x77d5('0xd3')]?_0x471a23['Attachment'][_0x77d5('0xe5')]:_0x471a23[_0x77d5('0xbb')],'direction':_0x471a23[_0x77d5('0xe9')]==='out'?'A':'C','secret':_0x471a23[_0x77d5('0xd5')],'read':_0x471a23[_0x77d5('0xd6')],'attachment':_0x471a23[_0x77d5('0xd3')]};})[_0x77d5('0x64')]()};return ejs[_0x77d5('0xec')](path['join'](config[_0x77d5('0xcb')],_0x77d5('0xed'),_0x77d5('0xee'),_0x77d5('0xef')),{'interaction':_0x45f0bc})[_0x77d5('0x2b')](function(_0x446531){var _0x59727f=path[_0x77d5('0xca')](_0x5789f6,'transcript-'+_0x2c7054['id']+'-'+_0x5cba5c+_0x77d5('0xf0'));var _0x58c34c={'path':_0x59727f,'channel':_0x77d5('0xdb'),'interactionId':_0x2c7054['id']};return pdf['createPdfFromHTML'](_0x446531,_0x58c34c);})[_0x77d5('0x2b')](function(){return new BPromise(function(_0x262d23,_0x46092a){zipdir(_0x5789f6,{'saveTo':_0x5ea0b6},function(_0x5a4358,_0x3b87f5){if(_0x5a4358)return _0x46092a(_0x5a4358);return _0x262d23(_0x3b87f5);});})['then'](function(){return new BPromise(function(_0x1dccc4,_0x1e0743){rimraf(_0x5789f6,function(_0x535cae){if(_0x535cae)_0x1e0743(_0x535cae);return _0x1dccc4();});});})[_0x77d5('0x2b')](function(){return _0x5b3580['download'](_0x5ea0b6,_0x159b29,function(_0x4d6a51){if(_0x4d6a51){console[_0x77d5('0xf1')]('err',_0x4d6a51);}else{fs['unlinkSync'](_0x5ea0b6);}});});});}else{return _0x5b3580[_0x77d5('0x1f')](0xc8);}})[_0x77d5('0xb2')](handleError(_0x5b3580,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8053b26..5ff7609 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 _0x8a6f=['setMaxListeners','update','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage'];(function(_0x2d2a58,_0x1f8f4b){var _0x451dfb=function(_0x4a1780){while(--_0x4a1780){_0x2d2a58['push'](_0x2d2a58['shift']());}};_0x451dfb(++_0x1f8f4b);}(_0x8a6f,0x18c));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf8a6('0x0'));var OpenchannelInteraction=require(_0xf8a6('0x1'))['db'][_0xf8a6('0x2')];var OpenchannelMessage=require(_0xf8a6('0x1'))['db'][_0xf8a6('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf8a6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf8a6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4ea437){return function(_0x55bd45,_0x2e2dfd,_0x5e9334){_0x55bd45[_0xf8a6('0x6')]({'attributes':['id'],'raw':!![]})[_0xf8a6('0x7')](function(_0xeb2352){_0x55bd45[_0xf8a6('0x8')](_0xf8a6('0x9'),_0xeb2352['map'](function(_0x661e4b){return{'id':_0x661e4b['id']};}));return OpenchannelMessage[_0xf8a6('0xa')]({'where':{'OpenchannelInteractionId':_0x55bd45['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4fcd26){_0x55bd45[_0xf8a6('0x8')]('unreadMessages',_0x4fcd26[_0xf8a6('0xb')]);OpenchannelInteractionEvents[_0xf8a6('0xc')](_0x4ea437+':'+_0x55bd45['id'],_0x55bd45);OpenchannelInteractionEvents[_0xf8a6('0xc')](_0x4ea437,_0x55bd45);_0x5e9334(null);})[_0xf8a6('0xd')](_0x5e9334(null));};}for(var e in events){if(events[_0xf8a6('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf8a6('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xfedb=['then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfedb,0x9a));var _0xbfed=function(_0x242912,_0x258070){_0x242912=_0x242912-0x0;var _0x2359cf=_0xfedb[_0x242912];return _0x2359cf;};'use strict';var EventEmitter=require(_0xbfed('0x0'));var OpenchannelInteraction=require(_0xbfed('0x1'))['db'][_0xbfed('0x2')];var OpenchannelMessage=require(_0xbfed('0x1'))['db'][_0xbfed('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbfed('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfed('0x5'),'afterDestroy':_0xbfed('0x6')};function emitEvent(_0x25fbe5){return function(_0x50f5c2,_0x364154,_0x2757fb){_0x50f5c2[_0xbfed('0x7')]({'attributes':['id'],'raw':!![]})[_0xbfed('0x8')](function(_0x234de7){_0x50f5c2[_0xbfed('0x9')](_0xbfed('0xa'),_0x234de7[_0xbfed('0xb')](function(_0x51959f){return{'id':_0x51959f['id']};}));return OpenchannelMessage[_0xbfed('0xc')]({'where':{'OpenchannelInteractionId':_0x50f5c2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24e8b9){_0x50f5c2[_0xbfed('0x9')](_0xbfed('0xd'),_0x24e8b9['length']);OpenchannelInteractionEvents[_0xbfed('0xe')](_0x25fbe5+':'+_0x50f5c2['id'],_0x50f5c2);OpenchannelInteractionEvents[_0xbfed('0xe')](_0x25fbe5,_0x50f5c2);_0x2757fb(null);})[_0xbfed('0xf')](_0x2757fb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xbfed('0x10')](e,emitEvent(event));}}module[_0xbfed('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 9e7ce7d..ca09f08 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 _0x2f81=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1cdd70,_0x532c2f){var _0x141bf3=function(_0x305346){while(--_0x305346){_0x1cdd70['push'](_0x1cdd70['shift']());}};_0x141bf3(++_0x532c2f);}(_0x2f81,0x10e));var _0x12f8=function(_0x212478,_0x3d356b){_0x212478=_0x212478-0x0;var _0x15f106=_0x2f81[_0x212478];return _0x15f106;};'use strict';var _=require(_0x12f8('0x0'));var util=require(_0x12f8('0x1'));var logger=require('../../config/logger')(_0x12f8('0x2'));var moment=require(_0x12f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x12f8('0x4'));var fs=require('fs');var path=require(_0x12f8('0x5'));var rimraf=require(_0x12f8('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x12f8('0x7')]=function(_0x5e008f,_0x2a774a){return _0x5e008f[_0x12f8('0x8')](_0x12f8('0x9'),attributes,{'tableName':_0x12f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12f8('0xb'),'collate':_0x12f8('0xc'),'hooks':{'beforeUpdate':function(_0x4912,_0x597a7e,_0x31859f){if(_0x4912['changed'](_0x12f8('0xd'))){_0x4912['closedAt']=moment()['format'](_0x12f8('0xe'));}_0x31859f(null,_0x4912);}}});}; \ No newline at end of file +var _0x2b0a=['lodash','util','api','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3fdd0e,_0x376a7f){var _0x3aca6c=function(_0x28434c){while(--_0x28434c){_0x3fdd0e['push'](_0x3fdd0e['shift']());}};_0x3aca6c(++_0x376a7f);}(_0x2b0a,0x84));var _0xa2b0=function(_0x5aaef0,_0x446be1){_0x5aaef0=_0x5aaef0-0x0;var _0x20d0c6=_0x2b0a[_0x5aaef0];return _0x20d0c6;};'use strict';var _=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var logger=require('../../config/logger')(_0xa2b0('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(_0xa2b0('0x3'));var config=require(_0xa2b0('0x4'));var attributes=require(_0xa2b0('0x5'));module[_0xa2b0('0x6')]=function(_0x31fab2,_0xa4e906){return _0x31fab2['define']('OpenchannelInteraction',attributes,{'tableName':_0xa2b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x1fb62b,_0x3abda1,_0x336127){if(_0x1fb62b[_0xa2b0('0x8')](_0xa2b0('0x9'))){_0x1fb62b[_0xa2b0('0xa')]=moment()['format'](_0xa2b0('0xb'));}_0x336127(null,_0x1fb62b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2c0bf0f..fa0ab8b 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 _0x7e8e=['raw','where','attributes','limit','then','stringify','find','addTags','omit','ids','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options'];(function(_0x7f8b61,_0x4fa837){var _0x16e761=function(_0x1872ee){while(--_0x1872ee){_0x7f8b61['push'](_0x7f8b61['shift']());}};_0x16e761(++_0x4fa837);}(_0x7e8e,0x1b1));var _0xe7e8=function(_0xbb6084,_0x1612c1){_0xbb6084=_0xbb6084-0x0;var _0x2db4f0=_0x7e8e[_0xbb6084];return _0x2db4f0;};'use strict';var _=require(_0xe7e8('0x0'));var util=require(_0xe7e8('0x1'));var moment=require(_0xe7e8('0x2'));var BPromise=require(_0xe7e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe7e8('0x5'))(_0xe7e8('0x6'));var config=require(_0xe7e8('0x7'));var jayson=require(_0xe7e8('0x8'));var client=jayson[_0xe7e8('0x9')][_0xe7e8('0xa')]({'port':0x232a});config[_0xe7e8('0xb')]=_[_0xe7e8('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe7e8('0xd'))(new Redis(config[_0xe7e8('0xb')]));require(_0xe7e8('0xe'))[_0xe7e8('0xf')](socket);function respondWithRpcPromise(_0x59c15f,_0x561d9f,_0x5a8017){return new BPromise(function(_0x3615ff,_0x4d734b){return client[_0xe7e8('0x10')](_0x59c15f,_0x5a8017)['then'](function(_0xea8b76){logger[_0xe7e8('0x11')](_0xe7e8('0x12'),_0x561d9f,_0xe7e8('0x13'));logger[_0xe7e8('0x14')](_0xe7e8('0x15'),_0x561d9f,_0xe7e8('0x13'),JSON['stringify'](_0xea8b76));if(_0xea8b76[_0xe7e8('0x16')]){if(_0xea8b76[_0xe7e8('0x16')][_0xe7e8('0x17')]===0x1f4){logger[_0xe7e8('0x16')](_0xe7e8('0x12'),_0x561d9f,_0xea8b76[_0xe7e8('0x16')][_0xe7e8('0x18')]);return _0x4d734b(_0xea8b76[_0xe7e8('0x16')][_0xe7e8('0x18')]);}logger[_0xe7e8('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x561d9f,_0xea8b76[_0xe7e8('0x16')][_0xe7e8('0x18')]);return _0x3615ff(_0xea8b76[_0xe7e8('0x16')][_0xe7e8('0x18')]);}else{logger[_0xe7e8('0x11')](_0xe7e8('0x12'),_0x561d9f,_0xe7e8('0x13'));_0x3615ff(_0xea8b76['result'][_0xe7e8('0x18')]);}})['catch'](function(_0x429618){logger[_0xe7e8('0x16')](_0xe7e8('0x12'),_0x561d9f,_0x429618);_0x4d734b(_0x429618);});});}exports[_0xe7e8('0x19')]=function(_0x47c7dd){var _0x49fa70=this;return new Promise(function(_0x5703c1,_0x459cfd){return db[_0xe7e8('0x1a')]['update'](_0x47c7dd[_0xe7e8('0x1b')],{'raw':_0x47c7dd[_0xe7e8('0x1c')]?_0x47c7dd['options'][_0xe7e8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c7dd[_0xe7e8('0x1c')]?_0x47c7dd[_0xe7e8('0x1c')][_0xe7e8('0x1e')]||null:null,'attributes':_0x47c7dd[_0xe7e8('0x1c')]?_0x47c7dd[_0xe7e8('0x1c')][_0xe7e8('0x1f')]||null:null,'limit':_0x47c7dd['options']?_0x47c7dd['options'][_0xe7e8('0x20')]||null:null})[_0xe7e8('0x21')](function(_0x544430){logger[_0xe7e8('0x11')](_0xe7e8('0x19'),_0x47c7dd);logger['debug'](_0xe7e8('0x19'),_0x47c7dd,JSON[_0xe7e8('0x22')](_0x544430));_0x5703c1(_0x544430);})['catch'](function(_0x2642c9){logger[_0xe7e8('0x16')](_0xe7e8('0x19'),_0x2642c9[_0xe7e8('0x18')],_0x47c7dd);_0x459cfd(_0x49fa70[_0xe7e8('0x16')](0x1f4,_0x2642c9[_0xe7e8('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x58c0ac){return new Promise(function(_0xae45af,_0xda82d6){return db[_0xe7e8('0x1a')][_0xe7e8('0x23')]({'where':_0x58c0ac[_0xe7e8('0x1c')]?_0x58c0ac['options'][_0xe7e8('0x1e')]||null:null})[_0xe7e8('0x21')](function(_0x3a5c2f){if(_0x3a5c2f){return _0x3a5c2f[_0xe7e8('0x24')](_0x58c0ac[_0xe7e8('0x1b')]['ids'],_[_0xe7e8('0x25')](_0x58c0ac[_0xe7e8('0x1b')],[_0xe7e8('0x26'),'id'])||{});}})[_0xe7e8('0x27')](function(_0x3cb324){logger[_0xe7e8('0x11')](_0xe7e8('0x28'),_0x58c0ac);logger[_0xe7e8('0x14')](_0xe7e8('0x28'),_0x58c0ac,JSON[_0xe7e8('0x22')](_0x3cb324));_0xae45af(_0x3cb324);})[_0xe7e8('0x29')](function(_0x409a40){logger[_0xe7e8('0x16')]('AddTags',_0x409a40[_0xe7e8('0x18')],_0x58c0ac);_0xda82d6(_this[_0xe7e8('0x16')](0x1f4,_0x409a40[_0xe7e8('0x18')]));});});}; \ No newline at end of file +var _0x648c=['error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','catch','OpenchannelInteraction','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction','find','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2bfddf,_0x28c576){var _0x2873e8=function(_0x32821e){while(--_0x32821e){_0x2bfddf['push'](_0x2bfddf['shift']());}};_0x2873e8(++_0x28c576);}(_0x648c,0x1e2));var _0xc648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x648c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc648('0x0'));var moment=require(_0xc648('0x1'));var BPromise=require(_0xc648('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc648('0x3'));var db=require(_0xc648('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc648('0x5'))(_0xc648('0x6'));var config=require(_0xc648('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc648('0x8')][_0xc648('0x9')]({'port':0x232a});config['redis']=_[_0xc648('0xa')](config[_0xc648('0xb')],{'host':_0xc648('0xc'),'port':0x18eb});var socket=require(_0xc648('0xd'))(new Redis(config[_0xc648('0xb')]));require(_0xc648('0xe'))[_0xc648('0xf')](socket);function respondWithRpcPromise(_0x5405ac,_0x35cfa8,_0x151056){return new BPromise(function(_0x2a063b,_0x51fef6){return client[_0xc648('0x10')](_0x5405ac,_0x151056)[_0xc648('0x11')](function(_0x11a1a2){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x35cfa8,'request\x20sent');logger[_0xc648('0x12')](_0xc648('0x13'),_0x35cfa8,_0xc648('0x14'),JSON[_0xc648('0x15')](_0x11a1a2));if(_0x11a1a2[_0xc648('0x16')]){if(_0x11a1a2[_0xc648('0x16')][_0xc648('0x17')]===0x1f4){logger[_0xc648('0x16')](_0xc648('0x18'),_0x35cfa8,_0x11a1a2[_0xc648('0x16')]['message']);return _0x51fef6(_0x11a1a2[_0xc648('0x16')][_0xc648('0x19')]);}logger[_0xc648('0x16')](_0xc648('0x18'),_0x35cfa8,_0x11a1a2[_0xc648('0x16')]['message']);return _0x2a063b(_0x11a1a2['error']['message']);}else{logger[_0xc648('0x1a')](_0xc648('0x18'),_0x35cfa8,_0xc648('0x14'));_0x2a063b(_0x11a1a2[_0xc648('0x1b')][_0xc648('0x19')]);}})[_0xc648('0x1c')](function(_0x460eac){logger[_0xc648('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x35cfa8,_0x460eac);_0x51fef6(_0x460eac);});});}exports['UpdateOpenchannelInteraction']=function(_0x2e1ce7){var _0xd1ff5c=this;return new Promise(function(_0x4511ef,_0x3a8db3){return db[_0xc648('0x1d')][_0xc648('0x1e')](_0x2e1ce7[_0xc648('0x1f')],{'raw':_0x2e1ce7['options']?_0x2e1ce7[_0xc648('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1ce7[_0xc648('0x20')]?_0x2e1ce7['options'][_0xc648('0x21')]||null:null,'attributes':_0x2e1ce7[_0xc648('0x20')]?_0x2e1ce7[_0xc648('0x20')][_0xc648('0x22')]||null:null,'limit':_0x2e1ce7[_0xc648('0x20')]?_0x2e1ce7['options'][_0xc648('0x23')]||null:null})[_0xc648('0x11')](function(_0x1c1ec2){logger['info'](_0xc648('0x24'),_0x2e1ce7);logger['debug'](_0xc648('0x24'),_0x2e1ce7,JSON[_0xc648('0x15')](_0x1c1ec2));_0x4511ef(_0x1c1ec2);})[_0xc648('0x1c')](function(_0x53a65e){logger[_0xc648('0x16')](_0xc648('0x24'),_0x53a65e[_0xc648('0x19')],_0x2e1ce7);_0x3a8db3(_0xd1ff5c['error'](0x1f4,_0x53a65e[_0xc648('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x51f56e){return new Promise(function(_0x25293c,_0x5a5f3c){return db[_0xc648('0x1d')][_0xc648('0x25')]({'where':_0x51f56e[_0xc648('0x20')]?_0x51f56e[_0xc648('0x20')]['where']||null:null})[_0xc648('0x11')](function(_0x3d8efa){if(_0x3d8efa){return _0x3d8efa['addTags'](_0x51f56e['body'][_0xc648('0x26')],_[_0xc648('0x27')](_0x51f56e[_0xc648('0x1f')],[_0xc648('0x26'),'id'])||{});}})[_0xc648('0x28')](function(_0x3c4189){logger[_0xc648('0x1a')](_0xc648('0x29'),_0x51f56e);logger[_0xc648('0x12')]('AddTags',_0x51f56e,JSON[_0xc648('0x15')](_0x3c4189));_0x25293c(_0x3c4189);})[_0xc648('0x1c')](function(_0x44796a){logger[_0xc648('0x16')](_0xc648('0x29'),_0x44796a[_0xc648('0x19')],_0x51f56e);_0x5a5f3c(_this[_0xc648('0x16')](0x1f4,_0x44796a[_0xc648('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b924644..d4a5139 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 _0xde85=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde85,0xed));var _0x5de8=function(_0x452961,_0x2f824d){_0x452961=_0x452961-0x0;var _0x13b1e8=_0xde85[_0x452961];return _0x13b1e8;};'use strict';var OpenchannelInteractionEvents=require(_0x5de8('0x0'));var events=[_0x5de8('0x1'),_0x5de8('0x2'),'update'];function createListener(_0x4a258a,_0x2ca6c2){return function(_0x380d27){_0x2ca6c2[_0x5de8('0x3')](_0x4a258a,_0x380d27);};}function removeListener(_0x1964b9,_0x176247){return function(){OpenchannelInteractionEvents[_0x5de8('0x4')](_0x1964b9,_0x176247);};}exports[_0x5de8('0x5')]=function(_0x5cd63f){for(var _0x309388=0x0,_0x3b25b8=events[_0x5de8('0x6')];_0x309388<_0x3b25b8;_0x309388++){var _0x2be6fa=events[_0x309388];var _0x2701bc=createListener(_0x5de8('0x7')+_0x2be6fa,_0x5cd63f);OpenchannelInteractionEvents['on'](_0x2be6fa,_0x2701bc);}}; \ No newline at end of file +var _0x4e36=['save','remove','update','emit','removeListener','length'];(function(_0x41fed8,_0x168adf){var _0x5d6c66=function(_0x2d3fce){while(--_0x2d3fce){_0x41fed8['push'](_0x41fed8['shift']());}};_0x5d6c66(++_0x168adf);}(_0x4e36,0x144));var _0x64e3=function(_0x425e30,_0x35e832){_0x425e30=_0x425e30-0x0;var _0x330c06=_0x4e36[_0x425e30];return _0x330c06;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x64e3('0x0'),_0x64e3('0x1'),_0x64e3('0x2')];function createListener(_0x58aa72,_0x5b614f){return function(_0x2b57fa){_0x5b614f[_0x64e3('0x3')](_0x58aa72,_0x2b57fa);};}function removeListener(_0x5ae599,_0x335a0e){return function(){OpenchannelInteractionEvents[_0x64e3('0x4')](_0x5ae599,_0x335a0e);};}exports['register']=function(_0x1abdc3){for(var _0x4551e1=0x0,_0x5a5270=events[_0x64e3('0x5')];_0x4551e1<_0x5a5270;_0x4551e1++){var _0x4711e5=events[_0x4551e1];var _0x3f94aa=createListener('openchannelInteraction:'+_0x4711e5,_0x1abdc3);OpenchannelInteractionEvents['on'](_0x4711e5,_0x3f94aa);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 08dfa12..ce9d19b 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0xc51ffb,_0x15a10f){var _0x887366=function(_0x36432e){while(--_0x36432e){_0xc51ffb['push'](_0xc51ffb['shift']());}};_0x887366(++_0x15a10f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x14aaae,_0x1a261){var _0x5a1189=function(_0x7673ce){while(--_0x7673ce){_0x14aaae['push'](_0x14aaae['shift']());}};_0x5a1189(++_0x1a261);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0xcb91[_0x383dbb];return _0x6e8bde;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5b0beb2..614dd33 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 _0x2547=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x11482b,_0x445148){var _0x4d172c=function(_0x1b08cf){while(--_0x1b08cf){_0x11482b['push'](_0x11482b['shift']());}};_0x4d172c(++_0x445148);}(_0x2547,0x1cd));var _0x7254=function(_0x2ae74b,_0x42addc){_0x2ae74b=_0x2ae74b-0x0;var _0x169fca=_0x2547[_0x2ae74b];return _0x169fca;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'body':{'type':Sequelize[_0x7254('0x1')](_0x7254('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7254('0x4')]('in',_0x7254('0x5')),'defaultValue':_0x7254('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7254('0x6')]},'providerResponse':{'type':Sequelize[_0x7254('0x1')]}}; \ No newline at end of file +var _0x33d2=['STRING','sequelize','exports','TEXT','BOOLEAN','out','DATE'];(function(_0x235983,_0x3e6e7c){var _0x21f20d=function(_0x532bd0){while(--_0x532bd0){_0x235983['push'](_0x235983['shift']());}};_0x21f20d(++_0x3e6e7c);}(_0x33d2,0x7f));var _0x233d=function(_0x33bad8,_0xa77a59){_0x33bad8=_0x33bad8-0x0;var _0xed1658=_0x33d2[_0x33bad8];return _0xed1658;};'use strict';var Sequelize=require(_0x233d('0x0'));module[_0x233d('0x1')]={'body':{'type':Sequelize[_0x233d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x233d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x233d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x233d('0x4')),'defaultValue':_0x233d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x233d('0x5')]},'providerName':{'type':Sequelize[_0x233d('0x6')]},'providerResponse':{'type':Sequelize[_0x233d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d9d0ab2..589982c 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 _0x3ec3=['hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','OpenchannelMessage','include','findAll','rows','show','keys','includeAll','find','create','body','params','describe','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','openchannel-interactions','OpenchannelInteractionId','stringify','rejectMessage','QueryTypes','SELECT','rejectmessage','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ec3,0x148));var _0x33ec=function(_0x1d6f82,_0x1e3208){_0x1d6f82=_0x1d6f82-0x0;var _0x1d9c09=_0x3ec3[_0x1d6f82];return _0x1d9c09;};'use strict';var emlformat=require(_0x33ec('0x0'));var rimraf=require(_0x33ec('0x1'));var zipdir=require(_0x33ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33ec('0x3'));var moment=require('moment');var BPromise=require(_0x33ec('0x4'));var Mustache=require(_0x33ec('0x5'));var util=require(_0x33ec('0x6'));var path=require(_0x33ec('0x7'));var sox=require(_0x33ec('0x8'));var csv=require(_0x33ec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33ec('0xa'));var _=require(_0x33ec('0xb'));var squel=require(_0x33ec('0xc'));var crypto=require(_0x33ec('0xd'));var jsforce=require(_0x33ec('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x33ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x33ec('0x10'));var authService=require(_0x33ec('0x11'));var qs=require(_0x33ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33ec('0x13'));var logger=require(_0x33ec('0x14'))(_0x33ec('0x15'));var utils=require(_0x33ec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x33ec('0x17'));var db=require(_0x33ec('0x18'))['db'];config[_0x33ec('0x19')]=_[_0x33ec('0x1a')](config[_0x33ec('0x19')],{'host':_0x33ec('0x1b'),'port':0x18eb});var socket=require(_0x33ec('0x1c'))(new Redis(config['redis']));require(_0x33ec('0x1d'))[_0x33ec('0x1e')](socket);var jayson=require(_0x33ec('0x1f'));var client=jayson[_0x33ec('0x20')][_0x33ec('0x21')]({'port':0x232c});var client9002=jayson[_0x33ec('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54164f,_0x491b7e,_0x112ad3,_0x304153){return new BPromise(function(_0x5f2fb8,_0x3d087c){var _0x1e6727=_0x304153||client;return _0x1e6727[_0x33ec('0x22')](_0x54164f,_0x112ad3)['then'](function(_0x433cbd){logger[_0x33ec('0x23')](_0x33ec('0x24'),_0x491b7e,'request\x20sent');logger['debug'](_0x33ec('0x25'),_0x491b7e,'request\x20sent',JSON['stringify'](_0x433cbd));if(_0x433cbd[_0x33ec('0x26')]){if(_0x433cbd[_0x33ec('0x26')]['code']===0x1f4){logger[_0x33ec('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x491b7e,_0x433cbd['error'][_0x33ec('0x27')]);return _0x3d087c(_0x433cbd[_0x33ec('0x26')][_0x33ec('0x27')]);}logger[_0x33ec('0x26')](_0x33ec('0x24'),_0x491b7e,_0x433cbd[_0x33ec('0x26')][_0x33ec('0x27')]);return _0x5f2fb8(_0x433cbd[_0x33ec('0x26')][_0x33ec('0x27')]);}else{logger[_0x33ec('0x23')](_0x33ec('0x24'),_0x491b7e,_0x33ec('0x28'));_0x5f2fb8(_0x433cbd['result'][_0x33ec('0x27')]);}})[_0x33ec('0x29')](function(_0x2ef8d8){logger['error'](_0x33ec('0x24'),_0x491b7e,_0x2ef8d8);_0x3d087c(_0x2ef8d8);});});}function respondWithStatusCode(_0x4f52df,_0x5c1a50){_0x5c1a50=_0x5c1a50||0xcc;return function(_0x48ff7c){if(_0x48ff7c){return _0x4f52df['sendStatus'](_0x5c1a50);}return _0x4f52df[_0x33ec('0x2a')](_0x5c1a50)[_0x33ec('0x2b')]();};}function respondWithResult(_0xe2a5fa,_0x46ff91){_0x46ff91=_0x46ff91||0xc8;return function(_0x27932a){if(_0x27932a){return _0xe2a5fa[_0x33ec('0x2a')](_0x46ff91)[_0x33ec('0x2c')](_0x27932a);}};}function respondWithFilteredResult(_0x149583,_0x107e72){return function(_0x66f9ac){if(_0x66f9ac){var _0x4dff2a=typeof _0x107e72[_0x33ec('0x2d')]==='undefined'&&typeof _0x107e72[_0x33ec('0x2e')]===_0x33ec('0x2f');var _0x29cd3f=_0x66f9ac[_0x33ec('0x30')];var _0x5d46b0=_0x4dff2a?0x0:_0x107e72['offset'];var _0x13cfc8=_0x4dff2a?_0x66f9ac[_0x33ec('0x30')]:_0x107e72[_0x33ec('0x2d')]+_0x107e72['limit'];var _0x1ba614;if(_0x13cfc8>=_0x29cd3f){_0x13cfc8=_0x29cd3f;_0x1ba614=0xc8;}else{_0x1ba614=0xce;}_0x149583[_0x33ec('0x2a')](_0x1ba614);return _0x149583['set']('Content-Range',_0x5d46b0+'-'+_0x13cfc8+'/'+_0x29cd3f)[_0x33ec('0x2c')](_0x66f9ac);}return null;};}function patchUpdates(_0x1f6044){return function(_0xe60e58){try{jsonpatch[_0x33ec('0x31')](_0xe60e58,_0x1f6044,!![]);}catch(_0x374cbd){return BPromise[_0x33ec('0x32')](_0x374cbd);}return _0xe60e58[_0x33ec('0x33')]();};}function saveUpdates(_0xda24e4,_0x2f257a){return function(_0x28d5af){if(_0x28d5af){return _0x28d5af[_0x33ec('0x34')](_0xda24e4)['then'](function(_0x4d786b){return _0x4d786b;});}return null;};}function removeEntity(_0x143bb8,_0x2cbcef){return function(_0x5e0f84){if(_0x5e0f84){return _0x5e0f84['destroy']()[_0x33ec('0x35')](function(){_0x143bb8[_0x33ec('0x2a')](0xcc)[_0x33ec('0x2b')]();});}};}function handleEntityNotFound(_0xdac00a,_0xbb4927){return function(_0x4d1760){if(!_0x4d1760){_0xdac00a[_0x33ec('0x36')](0x194);}return _0x4d1760;};}function handleError(_0x1cae06,_0x397cf4){_0x397cf4=_0x397cf4||0x1f4;return function(_0x287ace){logger[_0x33ec('0x26')](_0x287ace[_0x33ec('0x37')]);if(_0x287ace[_0x33ec('0x38')]){delete _0x287ace[_0x33ec('0x38')];}_0x1cae06[_0x33ec('0x2a')](_0x397cf4)[_0x33ec('0x39')](_0x287ace);};}exports[_0x33ec('0x3a')]=function(_0x1682bb,_0x1aa533){var _0xd201ed={},_0x29609e={},_0x8f617={'count':0x0,'rows':[]};var _0x5b1328=_[_0x33ec('0x3b')](db['OpenchannelMessage'][_0x33ec('0x3c')],function(_0xe732b6){return{'name':_0xe732b6[_0x33ec('0x3d')],'type':_0xe732b6[_0x33ec('0x3e')][_0x33ec('0x3f')]};});_0x29609e['model']=_[_0x33ec('0x3b')](_0x5b1328,_0x33ec('0x38'));_0x29609e[_0x33ec('0x40')]=_['keys'](_0x1682bb[_0x33ec('0x40')]);_0x29609e[_0x33ec('0x41')]=_[_0x33ec('0x42')](_0x29609e[_0x33ec('0x43')],_0x29609e[_0x33ec('0x40')]);_0xd201ed['attributes']=_[_0x33ec('0x42')](_0x29609e[_0x33ec('0x43')],qs[_0x33ec('0x44')](_0x1682bb[_0x33ec('0x40')]['fields']));_0xd201ed[_0x33ec('0x45')]=_0xd201ed['attributes'][_0x33ec('0x46')]?_0xd201ed['attributes']:_0x29609e['model'];if(!_0x1682bb['query'][_0x33ec('0x47')](_0x33ec('0x48'))){_0xd201ed[_0x33ec('0x2e')]=qs[_0x33ec('0x2e')](_0x1682bb['query'][_0x33ec('0x2e')]);_0xd201ed[_0x33ec('0x2d')]=qs[_0x33ec('0x2d')](_0x1682bb[_0x33ec('0x40')][_0x33ec('0x2d')]);}_0xd201ed[_0x33ec('0x49')]=qs[_0x33ec('0x4a')](_0x1682bb[_0x33ec('0x40')][_0x33ec('0x4a')]);_0xd201ed['where']=qs[_0x33ec('0x41')](_[_0x33ec('0x4b')](_0x1682bb[_0x33ec('0x40')],_0x29609e[_0x33ec('0x41')]),_0x5b1328);if(_0x1682bb[_0x33ec('0x40')][_0x33ec('0x4c')]){_0xd201ed[_0x33ec('0x4d')]=_['merge'](_0xd201ed[_0x33ec('0x4d')],{'$or':_[_0x33ec('0x3b')](_0x5b1328,function(_0x491883){if(_0x491883[_0x33ec('0x3e')]!==_0x33ec('0x4e')){var _0x24400d={};_0x24400d[_0x491883['name']]={'$like':'%'+_0x1682bb[_0x33ec('0x40')][_0x33ec('0x4c')]+'%'};return _0x24400d;}})});}_0xd201ed=_[_0x33ec('0x4f')]({},_0xd201ed,_0x1682bb[_0x33ec('0x50')]);var _0x1cf9d4={'where':_0xd201ed['where']};return db[_0x33ec('0x51')]['count'](_0x1cf9d4)[_0x33ec('0x35')](function(_0x17ec72){_0x8f617[_0x33ec('0x30')]=_0x17ec72;if(_0x1682bb[_0x33ec('0x40')]['includeAll']){_0xd201ed[_0x33ec('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x33ec('0x53')](_0xd201ed);})[_0x33ec('0x35')](function(_0x282fba){_0x8f617[_0x33ec('0x54')]=_0x282fba;return _0x8f617;})['then'](respondWithFilteredResult(_0x1aa533,_0xd201ed))[_0x33ec('0x29')](handleError(_0x1aa533,null));};exports[_0x33ec('0x55')]=function(_0x4d3309,_0x1f9ae8){var _0x38bcf5={'raw':!![],'where':{'id':_0x4d3309['params']['id']}},_0x1cd521={};_0x1cd521['model']=_['keys'](db[_0x33ec('0x51')]['rawAttributes']);_0x1cd521['query']=_[_0x33ec('0x56')](_0x4d3309[_0x33ec('0x40')]);_0x1cd521[_0x33ec('0x41')]=_[_0x33ec('0x42')](_0x1cd521[_0x33ec('0x43')],_0x1cd521[_0x33ec('0x40')]);_0x38bcf5[_0x33ec('0x45')]=_[_0x33ec('0x42')](_0x1cd521[_0x33ec('0x43')],qs['fields'](_0x4d3309[_0x33ec('0x40')]['fields']));_0x38bcf5[_0x33ec('0x45')]=_0x38bcf5['attributes'][_0x33ec('0x46')]?_0x38bcf5['attributes']:_0x1cd521[_0x33ec('0x43')];if(_0x4d3309[_0x33ec('0x40')][_0x33ec('0x57')]){_0x38bcf5['include']=[{'all':!![]}];}_0x38bcf5=_[_0x33ec('0x4f')]({},_0x38bcf5,_0x4d3309[_0x33ec('0x50')]);return db[_0x33ec('0x51')][_0x33ec('0x58')](_0x38bcf5)['then'](handleEntityNotFound(_0x1f9ae8,null))[_0x33ec('0x35')](respondWithResult(_0x1f9ae8,null))[_0x33ec('0x29')](handleError(_0x1f9ae8,null));};exports[_0x33ec('0x59')]=function(_0x55194e,_0x4257b2){return db[_0x33ec('0x51')][_0x33ec('0x59')](_0x55194e[_0x33ec('0x5a')],{})[_0x33ec('0x35')](respondWithResult(_0x4257b2,0xc9))[_0x33ec('0x29')](handleError(_0x4257b2,null));};exports[_0x33ec('0x34')]=function(_0x599cec,_0x106457){if(_0x599cec[_0x33ec('0x5a')]['id']){delete _0x599cec[_0x33ec('0x5a')]['id'];}return db['OpenchannelMessage'][_0x33ec('0x58')]({'where':{'id':_0x599cec[_0x33ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x106457,null))[_0x33ec('0x35')](saveUpdates(_0x599cec['body'],null))[_0x33ec('0x35')](respondWithResult(_0x106457,null))[_0x33ec('0x29')](handleError(_0x106457,null));};exports['destroy']=function(_0x29168a,_0x444db){return db[_0x33ec('0x51')][_0x33ec('0x58')]({'where':{'id':_0x29168a[_0x33ec('0x5b')]['id']}})[_0x33ec('0x35')](handleEntityNotFound(_0x444db,null))[_0x33ec('0x35')](removeEntity(_0x444db,null))[_0x33ec('0x29')](handleError(_0x444db,null));};exports[_0x33ec('0x5c')]=function(_0x420fae,_0x588b62){return db[_0x33ec('0x51')][_0x33ec('0x5c')]()[_0x33ec('0x35')](respondWithResult(_0x588b62,null))[_0x33ec('0x29')](handleError(_0x588b62,null));};var interaction_log=require(_0x33ec('0x14'))('openchannel-interactions');exports['accept']=function(_0x1b5b6a,_0x336b36,_0x44eb16){var _0x41fd21={'agent':{},'channel':_0x33ec('0x5d')};if(_0x1b5b6a[_0x33ec('0x5a')]['id']){delete _0x1b5b6a[_0x33ec('0x5a')]['id'];}_0x1b5b6a[_0x33ec('0x5a')]['read']=!![];_0x1b5b6a[_0x33ec('0x5a')][_0x33ec('0x5e')]=moment()[_0x33ec('0x5f')](_0x33ec('0x60'));_0x1b5b6a[_0x33ec('0x5a')][_0x33ec('0x61')]=_0x1b5b6a[_0x33ec('0x5a')]['UserId']||_0x1b5b6a[_0x33ec('0x62')]['id'];_0x41fd21[_0x33ec('0x63')]['id']=_0x1b5b6a[_0x33ec('0x5a')][_0x33ec('0x61')];return db[_0x33ec('0x51')][_0x33ec('0x58')]({'where':{'id':_0x1b5b6a[_0x33ec('0x5b')]['id'],'UserId':null}})[_0x33ec('0x35')](handleEntityNotFound(_0x336b36,null))[_0x33ec('0x35')](saveUpdates(_0x1b5b6a['body'],null))[_0x33ec('0x35')](function(_0x1e1ebe){if(_0x1e1ebe){_0x41fd21[_0x33ec('0x27')]=_0x1e1ebe['get']({'plain':!![]});return db[_0x33ec('0x64')][_0x33ec('0x58')]({'where':{'id':_0x1e1ebe['OpenchannelInteractionId']}});}return null;})[_0x33ec('0x35')](handleEntityNotFound(_0x336b36,null))['then'](function(_0x38e20c){if(_0x38e20c){return _0x38e20c[_0x33ec('0x34')]({'UserId':_0x1b5b6a[_0x33ec('0x5a')]['UserId'],'read1stAt':_[_0x33ec('0x65')](_0x38e20c[_0x33ec('0x66')])?moment()[_0x33ec('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x33ec('0x35')](function(_0x56ee64){if(_0x56ee64){_0x41fd21[_0x33ec('0x67')]=_0x56ee64[_0x33ec('0x68')]({'plain':!![]});interaction_log[_0x33ec('0x23')](_0x33ec('0x69'),_0x1b5b6a['user']['id'],_0x1b5b6a[_0x33ec('0x62')]['name'],_0x1b5b6a[_0x33ec('0x62')][_0x33ec('0x6a')],_0x41fd21[_0x33ec('0x67')]['id'],_0x1b5b6a[_0x33ec('0x5a')]?JSON['stringify'](_0x1b5b6a[_0x33ec('0x5a')]):_0x33ec('0x6b'));return respondWithRpcPromise(_0x33ec('0x6c'),_0x33ec('0x6d'),_0x41fd21);}return null;})[_0x33ec('0x35')](function(_0x1f7d60){var _0x38ad37=_0x33ec('0x6e')+_0x1f7d60[_0x33ec('0x27')][_0x33ec('0x6f')];return db[_0x33ec('0x70')][_0x33ec('0x40')](_0x38ad37,{'type':db[_0x33ec('0x71')]['QueryTypes']['SELECT'],'raw':!![]})[_0x33ec('0x35')](function(_0x5c6f00){return _0x5c6f00;});})[_0x33ec('0x35')](function(_0x328619){if(_0x328619){_0x41fd21['message'][_0x33ec('0x72')]=_0x328619[0x0];if(!_0x1b5b6a[_0x33ec('0x5a')][_0x33ec('0x61')])return;return db[_0x33ec('0x73')][_0x33ec('0x58')]({'where':{'id':_0x1b5b6a[_0x33ec('0x5a')][_0x33ec('0x61')],'role':_0x33ec('0x63')},'attributes':['id',_0x33ec('0x38'),_0x33ec('0x74'),_0x33ec('0x75'),_0x33ec('0x76')],'raw':!![]});}return null;})['then'](function(_0x5be775){if(!_0x5be775)return null;_0x41fd21[_0x33ec('0x27')][_0x33ec('0x63')]=_0x5be775;return _0x41fd21;})[_0x33ec('0x35')](function(_0x5e8c19){if(_0x5e8c19){if(_0x1b5b6a[_0x33ec('0x5a')][_0x33ec('0x77')]){_0x41fd21[_0x33ec('0x27')][_0x33ec('0x78')]=util[_0x33ec('0x5f')]('SIP/%s',_0x1b5b6a[_0x33ec('0x62')][_0x33ec('0x38')]);_0x41fd21['message'][_0x33ec('0x79')]=_0x41fd21[_0x33ec('0x79')];_0x41fd21['message'][_0x33ec('0x7a')]=_0x41fd21[_0x33ec('0x79')];_0x41fd21[_0x33ec('0x27')][_0x33ec('0x7b')]=_0x33ec('0x7c');return respondWithRpcPromise(_0x33ec('0x7d'),_0x33ec('0x7d'),{'event':'acceptmessage','message':_0x41fd21['message']},client9002)[_0x33ec('0x35')](function(){return _0x41fd21;});}return _0x41fd21;}return null;})[_0x33ec('0x35')](respondWithResult(_0x336b36,null))[_0x33ec('0x29')](handleError(_0x336b36,null));};var interaction_log=require(_0x33ec('0x14'))(_0x33ec('0x7e'));exports[_0x33ec('0x32')]=function(_0x356249,_0x2ae100,_0x3e1b55){var _0x2a0a51={'agent':{},'channel':_0x33ec('0x5d')};if(_0x356249[_0x33ec('0x5a')]['id']){delete _0x356249[_0x33ec('0x5a')]['id'];}_0x356249[_0x33ec('0x5a')][_0x33ec('0x61')]=_0x356249[_0x33ec('0x5a')][_0x33ec('0x61')]||_0x356249[_0x33ec('0x62')]['id'];_0x2a0a51['agent']['id']=_0x356249[_0x33ec('0x5a')]['UserId'];return db[_0x33ec('0x51')][_0x33ec('0x58')]({'where':{'id':_0x356249[_0x33ec('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ae100,null))[_0x33ec('0x35')](function(_0x335a8f){if(_0x335a8f){_0x2a0a51[_0x33ec('0x27')]=_0x335a8f[_0x33ec('0x68')]({'plain':!![]});return db[_0x33ec('0x64')]['find']({'where':{'id':_0x335a8f[_0x33ec('0x7f')]}});}return null;})[_0x33ec('0x35')](handleEntityNotFound(_0x2ae100,null))[_0x33ec('0x35')](function(_0x57a6cb){if(_0x57a6cb){_0x2a0a51[_0x33ec('0x67')]=_0x57a6cb[_0x33ec('0x68')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x356249['user']['id'],_0x356249[_0x33ec('0x62')][_0x33ec('0x38')],_0x356249[_0x33ec('0x62')]['role'],_0x2a0a51[_0x33ec('0x67')]['id'],_0x356249[_0x33ec('0x5a')]?JSON[_0x33ec('0x80')](_0x356249['body']):_0x33ec('0x6b'));return respondWithRpcPromise('RejectMessage',_0x33ec('0x81'),_0x2a0a51);}return null;})['then'](function(_0x168fd4){var _0x3b08d8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x168fd4[_0x33ec('0x27')][_0x33ec('0x6f')];return db['sequelize']['query'](_0x3b08d8,{'type':db[_0x33ec('0x71')][_0x33ec('0x82')][_0x33ec('0x83')],'raw':!![]})['then'](function(_0x2cd3e8){return _0x2cd3e8;});})[_0x33ec('0x35')](function(_0x5cc88f){if(_0x5cc88f){_0x2a0a51[_0x33ec('0x27')][_0x33ec('0x72')]=_0x5cc88f[0x0];if(!_0x356249[_0x33ec('0x5a')][_0x33ec('0x61')])return;return db['User'][_0x33ec('0x58')]({'where':{'id':_0x356249[_0x33ec('0x5a')]['UserId'],'role':_0x33ec('0x63')},'attributes':['id','name',_0x33ec('0x74'),'email',_0x33ec('0x76')],'raw':!![]});}return null;})['then'](function(_0x1b825b){if(!_0x1b825b)return null;_0x2a0a51[_0x33ec('0x27')][_0x33ec('0x63')]=_0x1b825b;return _0x2a0a51;})[_0x33ec('0x35')](function(_0x544e2b){if(_0x544e2b){_0x544e2b[_0x33ec('0x27')][_0x33ec('0x78')]=util[_0x33ec('0x5f')]('SIP/%s',_0x356249[_0x33ec('0x62')][_0x33ec('0x38')]);_0x544e2b[_0x33ec('0x27')][_0x33ec('0x79')]=_0x2a0a51['channel'];_0x544e2b[_0x33ec('0x27')][_0x33ec('0x7a')]=_0x2a0a51[_0x33ec('0x79')];_0x544e2b['message'][_0x33ec('0x7b')]=_0x33ec('0x32');respondWithRpcPromise(_0x33ec('0x7d'),_0x33ec('0x7d'),{'event':_0x33ec('0x84'),'message':_0x544e2b['message']},client9002);return _0x2a0a51;}return null;})[_0x33ec('0x35')](respondWithResult(_0x2ae100,null))['catch'](handleError(_0x2ae100,null));}; \ No newline at end of file +var _0xe191=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','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','defaults','redis','./openchannelMessage.socket','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','count','set','Content-Range','json','update','end','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','rows','show','params','find','create','body','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','role','null','AcceptMessage','acceptMessage'];(function(_0x48451c,_0x4e764e){var _0x41320a=function(_0x2515a7){while(--_0x2515a7){_0x48451c['push'](_0x48451c['shift']());}};_0x41320a(++_0x4e764e);}(_0xe191,0x98));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1e19('0x0'));var rimraf=require(_0x1e19('0x1'));var zipdir=require(_0x1e19('0x2'));var jsonpatch=require(_0x1e19('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e19('0x4'));var Mustache=require(_0x1e19('0x5'));var util=require(_0x1e19('0x6'));var path=require('path');var sox=require(_0x1e19('0x7'));var csv=require(_0x1e19('0x8'));var ejs=require(_0x1e19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e19('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e19('0xb'));var deskjs=require(_0x1e19('0xc'));var toCsv=require(_0x1e19('0x8'));var querystring=require('querystring');var Papa=require(_0x1e19('0xd'));var Redis=require(_0x1e19('0xe'));var authService=require(_0x1e19('0xf'));var qs=require(_0x1e19('0x10'));var as=require(_0x1e19('0x11'));var hardwareService=require(_0x1e19('0x12'));var logger=require(_0x1e19('0x13'))(_0x1e19('0x14'));var utils=require(_0x1e19('0x15'));var config=require(_0x1e19('0x16'));var licenseUtil=require(_0x1e19('0x17'));var db=require(_0x1e19('0x18'))['db'];config['redis']=_[_0x1e19('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e19('0x1a')]));require(_0x1e19('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x1e19('0x1c')][_0x1e19('0x1d')]({'port':0x232c});var client9002=jayson[_0x1e19('0x1c')][_0x1e19('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3fd50a,_0x4960ac,_0x53c693,_0x142ebc){return new BPromise(function(_0x3e9604,_0x2ea71f){var _0x1810a3=_0x142ebc||client;return _0x1810a3['request'](_0x3fd50a,_0x53c693)[_0x1e19('0x1e')](function(_0x4e2ac5){logger[_0x1e19('0x1f')](_0x1e19('0x20'),_0x4960ac,'request\x20sent');logger['debug'](_0x1e19('0x21'),_0x4960ac,_0x1e19('0x22'),JSON[_0x1e19('0x23')](_0x4e2ac5));if(_0x4e2ac5[_0x1e19('0x24')]){if(_0x4e2ac5[_0x1e19('0x24')][_0x1e19('0x25')]===0x1f4){logger[_0x1e19('0x24')](_0x1e19('0x20'),_0x4960ac,_0x4e2ac5[_0x1e19('0x24')][_0x1e19('0x26')]);return _0x2ea71f(_0x4e2ac5[_0x1e19('0x24')][_0x1e19('0x26')]);}logger['error'](_0x1e19('0x20'),_0x4960ac,_0x4e2ac5[_0x1e19('0x24')][_0x1e19('0x26')]);return _0x3e9604(_0x4e2ac5[_0x1e19('0x24')][_0x1e19('0x26')]);}else{logger[_0x1e19('0x1f')](_0x1e19('0x20'),_0x4960ac,_0x1e19('0x22'));_0x3e9604(_0x4e2ac5[_0x1e19('0x27')]['message']);}})[_0x1e19('0x28')](function(_0x58c322){logger[_0x1e19('0x24')](_0x1e19('0x20'),_0x4960ac,_0x58c322);_0x2ea71f(_0x58c322);});});}function respondWithStatusCode(_0x319d9f,_0x3d2356){_0x3d2356=_0x3d2356||0xcc;return function(_0x188307){if(_0x188307){return _0x319d9f[_0x1e19('0x29')](_0x3d2356);}return _0x319d9f[_0x1e19('0x2a')](_0x3d2356)['end']();};}function respondWithResult(_0x1f1d17,_0xdfb0d9){_0xdfb0d9=_0xdfb0d9||0xc8;return function(_0x264078){if(_0x264078){return _0x1f1d17[_0x1e19('0x2a')](_0xdfb0d9)['json'](_0x264078);}};}function respondWithFilteredResult(_0x4facc9,_0x499ffd){return function(_0x279c9b){if(_0x279c9b){var _0x5da3a3=typeof _0x499ffd[_0x1e19('0x2b')]==='undefined'&&typeof _0x499ffd[_0x1e19('0x2c')]==='undefined';var _0x3bfac0=_0x279c9b[_0x1e19('0x2d')];var _0x267439=_0x5da3a3?0x0:_0x499ffd[_0x1e19('0x2b')];var _0x71d981=_0x5da3a3?_0x279c9b['count']:_0x499ffd[_0x1e19('0x2b')]+_0x499ffd[_0x1e19('0x2c')];var _0x399446;if(_0x71d981>=_0x3bfac0){_0x71d981=_0x3bfac0;_0x399446=0xc8;}else{_0x399446=0xce;}_0x4facc9[_0x1e19('0x2a')](_0x399446);return _0x4facc9[_0x1e19('0x2e')](_0x1e19('0x2f'),_0x267439+'-'+_0x71d981+'/'+_0x3bfac0)[_0x1e19('0x30')](_0x279c9b);}return null;};}function patchUpdates(_0x474f8f){return function(_0x1c5cda){try{jsonpatch['apply'](_0x1c5cda,_0x474f8f,!![]);}catch(_0x2fc39f){return BPromise['reject'](_0x2fc39f);}return _0x1c5cda['save']();};}function saveUpdates(_0x2839e5,_0x4a2469){return function(_0x5a1329){if(_0x5a1329){return _0x5a1329[_0x1e19('0x31')](_0x2839e5)[_0x1e19('0x1e')](function(_0x1d63e4){return _0x1d63e4;});}return null;};}function removeEntity(_0x1db158,_0x1f9ea9){return function(_0x491211){if(_0x491211){return _0x491211['destroy']()['then'](function(){_0x1db158[_0x1e19('0x2a')](0xcc)[_0x1e19('0x32')]();});}};}function handleEntityNotFound(_0x2a8168,_0x4c2baf){return function(_0x1ef603){if(!_0x1ef603){_0x2a8168['sendStatus'](0x194);}return _0x1ef603;};}function handleError(_0x13f19e,_0x13494a){_0x13494a=_0x13494a||0x1f4;return function(_0x3703b3){logger['error'](_0x3703b3[_0x1e19('0x33')]);if(_0x3703b3[_0x1e19('0x34')]){delete _0x3703b3[_0x1e19('0x34')];}_0x13f19e['status'](_0x13494a)['send'](_0x3703b3);};}exports[_0x1e19('0x35')]=function(_0x5848e0,_0x1bb886){var _0x4cf81e={},_0x1a2a59={},_0x228231={'count':0x0,'rows':[]};var _0x59b6b9=_[_0x1e19('0x36')](db['OpenchannelMessage'][_0x1e19('0x37')],function(_0x113b2f){return{'name':_0x113b2f[_0x1e19('0x38')],'type':_0x113b2f['type'][_0x1e19('0x39')]};});_0x1a2a59[_0x1e19('0x3a')]=_[_0x1e19('0x36')](_0x59b6b9,_0x1e19('0x34'));_0x1a2a59['query']=_[_0x1e19('0x3b')](_0x5848e0[_0x1e19('0x3c')]);_0x1a2a59['filters']=_[_0x1e19('0x3d')](_0x1a2a59[_0x1e19('0x3a')],_0x1a2a59[_0x1e19('0x3c')]);_0x4cf81e[_0x1e19('0x3e')]=_[_0x1e19('0x3d')](_0x1a2a59[_0x1e19('0x3a')],qs[_0x1e19('0x3f')](_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x3f')]));_0x4cf81e[_0x1e19('0x3e')]=_0x4cf81e[_0x1e19('0x3e')][_0x1e19('0x40')]?_0x4cf81e['attributes']:_0x1a2a59['model'];if(!_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x41')]('nolimit')){_0x4cf81e[_0x1e19('0x2c')]=qs[_0x1e19('0x2c')](_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x2c')]);_0x4cf81e[_0x1e19('0x2b')]=qs[_0x1e19('0x2b')](_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x2b')]);}_0x4cf81e[_0x1e19('0x42')]=qs[_0x1e19('0x43')](_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x43')]);_0x4cf81e[_0x1e19('0x44')]=qs[_0x1e19('0x45')](_[_0x1e19('0x46')](_0x5848e0[_0x1e19('0x3c')],_0x1a2a59[_0x1e19('0x45')]),_0x59b6b9);if(_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x47')]){_0x4cf81e[_0x1e19('0x44')]=_[_0x1e19('0x48')](_0x4cf81e['where'],{'$or':_[_0x1e19('0x36')](_0x59b6b9,function(_0x5b7f87){if(_0x5b7f87['type']!==_0x1e19('0x49')){var _0x11edf2={};_0x11edf2[_0x5b7f87['name']]={'$like':'%'+_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x47')]+'%'};return _0x11edf2;}})});}_0x4cf81e=_[_0x1e19('0x48')]({},_0x4cf81e,_0x5848e0[_0x1e19('0x4a')]);var _0x332b2d={'where':_0x4cf81e[_0x1e19('0x44')]};return db[_0x1e19('0x4b')][_0x1e19('0x2d')](_0x332b2d)[_0x1e19('0x1e')](function(_0x2fbd31){_0x228231['count']=_0x2fbd31;if(_0x5848e0[_0x1e19('0x3c')][_0x1e19('0x4c')]){_0x4cf81e[_0x1e19('0x4d')]=[{'all':!![]}];}return db[_0x1e19('0x4b')]['findAll'](_0x4cf81e);})[_0x1e19('0x1e')](function(_0x1ec0e7){_0x228231[_0x1e19('0x4e')]=_0x1ec0e7;return _0x228231;})[_0x1e19('0x1e')](respondWithFilteredResult(_0x1bb886,_0x4cf81e))[_0x1e19('0x28')](handleError(_0x1bb886,null));};exports[_0x1e19('0x4f')]=function(_0x2ec7c0,_0xa41d6d){var _0x260aab={'raw':!![],'where':{'id':_0x2ec7c0[_0x1e19('0x50')]['id']}},_0x1e9890={};_0x1e9890[_0x1e19('0x3a')]=_[_0x1e19('0x3b')](db[_0x1e19('0x4b')][_0x1e19('0x37')]);_0x1e9890[_0x1e19('0x3c')]=_[_0x1e19('0x3b')](_0x2ec7c0[_0x1e19('0x3c')]);_0x1e9890[_0x1e19('0x45')]=_[_0x1e19('0x3d')](_0x1e9890[_0x1e19('0x3a')],_0x1e9890[_0x1e19('0x3c')]);_0x260aab[_0x1e19('0x3e')]=_[_0x1e19('0x3d')](_0x1e9890[_0x1e19('0x3a')],qs[_0x1e19('0x3f')](_0x2ec7c0[_0x1e19('0x3c')][_0x1e19('0x3f')]));_0x260aab[_0x1e19('0x3e')]=_0x260aab[_0x1e19('0x3e')][_0x1e19('0x40')]?_0x260aab[_0x1e19('0x3e')]:_0x1e9890[_0x1e19('0x3a')];if(_0x2ec7c0[_0x1e19('0x3c')]['includeAll']){_0x260aab[_0x1e19('0x4d')]=[{'all':!![]}];}_0x260aab=_[_0x1e19('0x48')]({},_0x260aab,_0x2ec7c0['options']);return db[_0x1e19('0x4b')][_0x1e19('0x51')](_0x260aab)['then'](handleEntityNotFound(_0xa41d6d,null))[_0x1e19('0x1e')](respondWithResult(_0xa41d6d,null))[_0x1e19('0x28')](handleError(_0xa41d6d,null));};exports[_0x1e19('0x52')]=function(_0x1b1da8,_0x8f071a){return db[_0x1e19('0x4b')][_0x1e19('0x52')](_0x1b1da8[_0x1e19('0x53')],{})[_0x1e19('0x1e')](respondWithResult(_0x8f071a,0xc9))[_0x1e19('0x28')](handleError(_0x8f071a,null));};exports['update']=function(_0x18c334,_0x38d504){if(_0x18c334[_0x1e19('0x53')]['id']){delete _0x18c334[_0x1e19('0x53')]['id'];}return db[_0x1e19('0x4b')][_0x1e19('0x51')]({'where':{'id':_0x18c334[_0x1e19('0x50')]['id']}})[_0x1e19('0x1e')](handleEntityNotFound(_0x38d504,null))[_0x1e19('0x1e')](saveUpdates(_0x18c334[_0x1e19('0x53')],null))['then'](respondWithResult(_0x38d504,null))[_0x1e19('0x28')](handleError(_0x38d504,null));};exports['destroy']=function(_0x1afaaa,_0x2ab2dc){return db[_0x1e19('0x4b')][_0x1e19('0x51')]({'where':{'id':_0x1afaaa['params']['id']}})[_0x1e19('0x1e')](handleEntityNotFound(_0x2ab2dc,null))[_0x1e19('0x1e')](removeEntity(_0x2ab2dc,null))[_0x1e19('0x28')](handleError(_0x2ab2dc,null));};exports['describe']=function(_0x26cf49,_0x204382){return db[_0x1e19('0x4b')][_0x1e19('0x54')]()[_0x1e19('0x1e')](respondWithResult(_0x204382,null))[_0x1e19('0x28')](handleError(_0x204382,null));};var interaction_log=require('../../config/logger')(_0x1e19('0x55'));exports['accept']=function(_0x2b8458,_0x74251e,_0x1864f8){var _0x562fce={'agent':{},'channel':_0x1e19('0x56')};if(_0x2b8458[_0x1e19('0x53')]['id']){delete _0x2b8458[_0x1e19('0x53')]['id'];}_0x2b8458[_0x1e19('0x53')]['read']=!![];_0x2b8458['body'][_0x1e19('0x57')]=moment()[_0x1e19('0x58')](_0x1e19('0x59'));_0x2b8458['body'][_0x1e19('0x5a')]=_0x2b8458[_0x1e19('0x53')][_0x1e19('0x5a')]||_0x2b8458[_0x1e19('0x5b')]['id'];_0x562fce['agent']['id']=_0x2b8458[_0x1e19('0x53')][_0x1e19('0x5a')];return db[_0x1e19('0x4b')]['find']({'where':{'id':_0x2b8458[_0x1e19('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x74251e,null))[_0x1e19('0x1e')](saveUpdates(_0x2b8458[_0x1e19('0x53')],null))[_0x1e19('0x1e')](function(_0x110ea1){if(_0x110ea1){_0x562fce[_0x1e19('0x26')]=_0x110ea1[_0x1e19('0x5c')]({'plain':!![]});return db[_0x1e19('0x5d')][_0x1e19('0x51')]({'where':{'id':_0x110ea1['OpenchannelInteractionId']}});}return null;})[_0x1e19('0x1e')](handleEntityNotFound(_0x74251e,null))[_0x1e19('0x1e')](function(_0x2043ad){if(_0x2043ad){return _0x2043ad[_0x1e19('0x31')]({'UserId':_0x2b8458[_0x1e19('0x53')]['UserId'],'read1stAt':_[_0x1e19('0x5e')](_0x2043ad[_0x1e19('0x5f')])?moment()['format'](_0x1e19('0x59')):undefined});}return null;})[_0x1e19('0x1e')](function(_0x285dad){if(_0x285dad){_0x562fce['interaction']=_0x285dad[_0x1e19('0x5c')]({'plain':!![]});interaction_log[_0x1e19('0x1f')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b8458[_0x1e19('0x5b')]['id'],_0x2b8458[_0x1e19('0x5b')][_0x1e19('0x34')],_0x2b8458['user'][_0x1e19('0x60')],_0x562fce['interaction']['id'],_0x2b8458[_0x1e19('0x53')]?JSON[_0x1e19('0x23')](_0x2b8458[_0x1e19('0x53')]):_0x1e19('0x61'));return respondWithRpcPromise(_0x1e19('0x62'),_0x1e19('0x63'),_0x562fce);}return null;})['then'](function(_0x14ef1b){var _0x154d9d=_0x1e19('0x64')+_0x14ef1b[_0x1e19('0x26')][_0x1e19('0x65')];return db[_0x1e19('0x66')][_0x1e19('0x3c')](_0x154d9d,{'type':db[_0x1e19('0x67')]['QueryTypes'][_0x1e19('0x68')],'raw':!![]})['then'](function(_0x414919){return _0x414919;});})['then'](function(_0x39baaf){if(_0x39baaf){_0x562fce['message'][_0x1e19('0x69')]=_0x39baaf[0x0];if(!_0x2b8458[_0x1e19('0x53')][_0x1e19('0x5a')])return;return db[_0x1e19('0x6a')][_0x1e19('0x51')]({'where':{'id':_0x2b8458[_0x1e19('0x53')][_0x1e19('0x5a')],'role':_0x1e19('0x6b')},'attributes':['id','name',_0x1e19('0x6c'),_0x1e19('0x6d'),_0x1e19('0x6e')],'raw':!![]});}return null;})[_0x1e19('0x1e')](function(_0x3a5263){if(!_0x3a5263)return null;_0x562fce['message'][_0x1e19('0x6b')]=_0x3a5263;return _0x562fce;})['then'](function(_0x55a027){if(_0x55a027){if(_0x2b8458[_0x1e19('0x53')][_0x1e19('0x6f')]){_0x562fce[_0x1e19('0x26')][_0x1e19('0x70')]=util[_0x1e19('0x58')]('SIP/%s',_0x2b8458[_0x1e19('0x5b')][_0x1e19('0x34')]);_0x562fce['message'][_0x1e19('0x71')]=_0x562fce[_0x1e19('0x71')];_0x562fce[_0x1e19('0x26')][_0x1e19('0x72')]=_0x562fce[_0x1e19('0x71')];_0x562fce[_0x1e19('0x26')][_0x1e19('0x73')]='accept';return respondWithRpcPromise(_0x1e19('0x74'),'EventManager',{'event':_0x1e19('0x75'),'message':_0x562fce[_0x1e19('0x26')]},client9002)['then'](function(){return _0x562fce;});}return _0x562fce;}return null;})['then'](respondWithResult(_0x74251e,null))[_0x1e19('0x28')](handleError(_0x74251e,null));};var interaction_log=require(_0x1e19('0x13'))('openchannel-interactions');exports[_0x1e19('0x76')]=function(_0x586d57,_0x5c3165,_0x6b7b86){var _0x516ac1={'agent':{},'channel':_0x1e19('0x56')};if(_0x586d57['body']['id']){delete _0x586d57[_0x1e19('0x53')]['id'];}_0x586d57[_0x1e19('0x53')]['UserId']=_0x586d57[_0x1e19('0x53')]['UserId']||_0x586d57[_0x1e19('0x5b')]['id'];_0x516ac1['agent']['id']=_0x586d57['body'][_0x1e19('0x5a')];return db[_0x1e19('0x4b')][_0x1e19('0x51')]({'where':{'id':_0x586d57[_0x1e19('0x50')]['id'],'UserId':null}})[_0x1e19('0x1e')](handleEntityNotFound(_0x5c3165,null))[_0x1e19('0x1e')](function(_0x1f392a){if(_0x1f392a){_0x516ac1[_0x1e19('0x26')]=_0x1f392a['get']({'plain':!![]});return db[_0x1e19('0x5d')][_0x1e19('0x51')]({'where':{'id':_0x1f392a[_0x1e19('0x77')]}});}return null;})[_0x1e19('0x1e')](handleEntityNotFound(_0x5c3165,null))[_0x1e19('0x1e')](function(_0x39a1d7){if(_0x39a1d7){_0x516ac1[_0x1e19('0x78')]=_0x39a1d7['get']({'plain':!![]});interaction_log[_0x1e19('0x1f')](_0x1e19('0x79'),_0x586d57[_0x1e19('0x5b')]['id'],_0x586d57['user'][_0x1e19('0x34')],_0x586d57[_0x1e19('0x5b')][_0x1e19('0x60')],_0x516ac1[_0x1e19('0x78')]['id'],_0x586d57['body']?JSON[_0x1e19('0x23')](_0x586d57[_0x1e19('0x53')]):_0x1e19('0x61'));return respondWithRpcPromise(_0x1e19('0x7a'),_0x1e19('0x7b'),_0x516ac1);}return null;})[_0x1e19('0x1e')](function(_0xf57f64){var _0x28878d=_0x1e19('0x64')+_0xf57f64[_0x1e19('0x26')]['ContactId'];return db[_0x1e19('0x66')][_0x1e19('0x3c')](_0x28878d,{'type':db['Sequelize'][_0x1e19('0x7c')][_0x1e19('0x68')],'raw':!![]})['then'](function(_0x578946){return _0x578946;});})[_0x1e19('0x1e')](function(_0x435636){if(_0x435636){_0x516ac1[_0x1e19('0x26')][_0x1e19('0x69')]=_0x435636[0x0];if(!_0x586d57[_0x1e19('0x53')][_0x1e19('0x5a')])return;return db['User'][_0x1e19('0x51')]({'where':{'id':_0x586d57[_0x1e19('0x53')]['UserId'],'role':_0x1e19('0x6b')},'attributes':['id','name',_0x1e19('0x6c'),_0x1e19('0x6d'),'internal'],'raw':!![]});}return null;})[_0x1e19('0x1e')](function(_0x94243){if(!_0x94243)return null;_0x516ac1[_0x1e19('0x26')][_0x1e19('0x6b')]=_0x94243;return _0x516ac1;})['then'](function(_0x1ba6fb){if(_0x1ba6fb){_0x1ba6fb[_0x1e19('0x26')][_0x1e19('0x70')]=util['format']('SIP/%s',_0x586d57['user'][_0x1e19('0x34')]);_0x1ba6fb['message'][_0x1e19('0x71')]=_0x516ac1[_0x1e19('0x71')];_0x1ba6fb[_0x1e19('0x26')][_0x1e19('0x72')]=_0x516ac1['channel'];_0x1ba6fb[_0x1e19('0x26')][_0x1e19('0x73')]='reject';respondWithRpcPromise(_0x1e19('0x74'),'EventManager',{'event':_0x1e19('0x7d'),'message':_0x1ba6fb[_0x1e19('0x26')]},client9002);return _0x516ac1;}return null;})[_0x1e19('0x1e')](respondWithResult(_0x5c3165,null))['catch'](handleError(_0x5c3165,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 70c3d17..a0b9dac 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 _0x785a=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x59a7f4,_0xe2763f){var _0xf208aa=function(_0x1123f0){while(--_0x1123f0){_0x59a7f4['push'](_0x59a7f4['shift']());}};_0xf208aa(++_0xe2763f);}(_0x785a,0x145));var _0xa785=function(_0x207793,_0xf82dc5){_0x207793=_0x207793-0x0;var _0x5c90cd=_0x785a[_0x207793];return _0x5c90cd;};'use strict';var EventEmitter=require(_0xa785('0x0'));var OpenchannelMessage=require(_0xa785('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa785('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa785('0x3'),'afterDestroy':_0xa785('0x4')};function emitEvent(_0x2b9ff4){return function(_0x5ba321,_0xcdf623,_0x1dd4aa){OpenchannelMessageEvents[_0xa785('0x5')](_0x2b9ff4+':'+_0x5ba321['id'],_0x5ba321);OpenchannelMessageEvents[_0xa785('0x5')](_0x2b9ff4,_0x5ba321);_0x1dd4aa(null);};}for(var e in events){if(events[_0xa785('0x6')](e)){var event=events[e];OpenchannelMessage[_0xa785('0x7')](e,emitEvent(event));}}module[_0xa785('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x964b=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x478379,_0x3c28cd){var _0x2887b1=function(_0x220076){while(--_0x220076){_0x478379['push'](_0x478379['shift']());}};_0x2887b1(++_0x3c28cd);}(_0x964b,0x1ac));var _0xb964=function(_0x25014f,_0x501c4b){_0x25014f=_0x25014f-0x0;var _0x5cb5e8=_0x964b[_0x25014f];return _0x5cb5e8;};'use strict';var EventEmitter=require(_0xb964('0x0'));var OpenchannelMessage=require(_0xb964('0x1'))['db'][_0xb964('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb964('0x3')](0x0);var events={'afterCreate':_0xb964('0x4'),'afterUpdate':_0xb964('0x5'),'afterDestroy':_0xb964('0x6')};function emitEvent(_0x247e0b){return function(_0x5cc4fc,_0xcf03f5,_0x563dda){OpenchannelMessageEvents[_0xb964('0x7')](_0x247e0b+':'+_0x5cc4fc['id'],_0x5cc4fc);OpenchannelMessageEvents['emit'](_0x247e0b,_0x5cc4fc);_0x563dda(null);};}for(var e in events){if(events[_0xb964('0x8')](e)){var event=events[e];OpenchannelMessage[_0xb964('0x9')](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 b2e8fc7..2874e08 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 _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x34b7,0x196));var _0x734b=function(_0x423b10,_0x36cad4){_0x423b10=_0x423b10-0x0;var _0x1338d9=_0x34b7[_0x423b10];return _0x1338d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file +var _0xefda=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4','lodash','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xefda,0x96));var _0xaefd=function(_0x199d71,_0x496186){_0x199d71=_0x199d71-0x0;var _0x5257d3=_0xefda[_0x199d71];return _0x5257d3;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xaefd('0xc')],'type':_0xaefd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463ce7,_0x4d44ed,_0x48a255){var _0x54a3b1=_0x497258[_0xaefd('0xe')];var _0x16b36e=_0x463ce7[_0xaefd('0xf')]({'plain':!![]});if(_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()==='in'||_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]&&!_[_0xaefd('0x14')](_0x16b36e[_0xaefd('0x15')])){_0x54a3b1['OpenchannelInteraction'][_0xaefd('0x16')]({'where':{'id':_0x16b36e['OpenchannelInteractionId']}})[_0xaefd('0x17')](function(_0x1725af){if(_0x1725af){_0x1725af[_0xaefd('0x18')]({'lastMsgAt':_0x16b36e[_0xaefd('0x19')],'lastMsgDirection':_0x16b36e['direction'][_0xaefd('0x11')]()});}})[_0xaefd('0x1a')](function(_0x41f345){console[_0xaefd('0x1b')](_0x41f345);});}if(_0x16b36e[_0xaefd('0x10')]===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]){var _0x23d736;_0x54a3b1['CmContact'][_0xaefd('0x1c')]()[_0xaefd('0x17')](function(_0x9748f4){return _0x54a3b1[_0xaefd('0x1d')][_0xaefd('0x1e')]({'where':{'id':_0x16b36e[_0xaefd('0x1f')]},'include':[{'model':_0x54a3b1['OpenchannelInteraction'],'as':_0xaefd('0x20'),'where':{'id':_0x16b36e[_0xaefd('0x21')]},'limit':0x1,'include':[{'model':_0x54a3b1[_0xaefd('0x22')],'as':_0xaefd('0x23'),'attributes':_[_0xaefd('0x24')](_0x9748f4)}]}]});})[_0xaefd('0x17')](function(_0x5282ed){_0x23d736=_0x5282ed[_0xaefd('0xf')]({'plain':!![]});if(_0x23d736&&_0x23d736[_0xaefd('0x25')]){logger[_0xaefd('0x26')](_0xaefd('0x27'),_0xaefd('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x16b36e['id'],_0x23d736['replyUri']));if(_0x23d736[_0xaefd('0x20')]&&_0x23d736[_0xaefd('0x20')][_0xaefd('0x29')]){_0x16b36e['Interaction']=_[_0xaefd('0x2a')](_0x23d736['Interactions'][0x0],_0xaefd('0x23'));_0x16b36e[_0xaefd('0x23')]=_0x23d736[_0xaefd('0x20')][0x0]['Contact'];}var _0x4d44ed={'method':_0xaefd('0x2b'),'uri':encodeURI(_0x23d736[_0xaefd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d44ed[_0xaefd('0x2c')]){case _0xaefd('0x2d'):_0x4d44ed['qs']=_0x16b36e;break;case'POST':_0x4d44ed[_0xaefd('0xc')]=_0x16b36e;break;}return rp(_0x4d44ed)['then'](function(_0x810bf){logger[_0xaefd('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x16b36e['id'],_0x23d736[_0xaefd('0x25')]));if(_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]&&_0x810bf['body'][_0xaefd('0x2f')]!=_0x16b36e['Interaction'][_0xaefd('0x2f')]){return _0x54a3b1['OpenchannelInteraction']['update']({'threadId':_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]},{'logging':!![],'where':{'id':_0x16b36e['Interaction']['id']}});}else{return;}})['then'](function(){return _0x463ce7['update']({'read':!![]});})[_0xaefd('0x1a')](function(_0x280eab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x30')](_0x280eab,{'showHidden':![],'depth':null}));_0x48a255();});}else{_0x48a255();}})[_0xaefd('0x31')](function(){_0x48a255();});}else{_0x48a255();}}},'charset':_0xaefd('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7458331..143668a 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x41e0f9,_0x5a352c){var _0x2ea594=function(_0x35ddbf){while(--_0x35ddbf){_0x41e0f9['push'](_0x41e0f9['shift']());}};_0x2ea594(++_0x5a352c);}(_0x2ef3,0xba));var _0x32ef=function(_0x37275d,_0x13d5f2){_0x37275d=_0x37275d-0x0;var _0x59f685=_0x2ef3[_0x37275d];return _0x59f685;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x39686e,_0x3d83bb){var _0x1b765e=function(_0x1c2e95){while(--_0x1c2e95){_0x39686e['push'](_0x39686e['shift']());}};_0x1b765e(++_0x3d83bb);}(_0xdb28,0x106));var _0x8db2=function(_0x13ea13,_0x2fca79){_0x13ea13=_0x13ea13-0x0;var _0x19a97b=_0xdb28[_0x13ea13];return _0x19a97b;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3cec79e..78c1874 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 _0x40e1=['openchannelMessage:','./openchannelMessage.events','remove','update','register','length'];(function(_0x8bc20f,_0x1c1389){var _0x46b449=function(_0x112357){while(--_0x112357){_0x8bc20f['push'](_0x8bc20f['shift']());}};_0x46b449(++_0x1c1389);}(_0x40e1,0x1e7));var _0x140e=function(_0x4db1a6,_0x255276){_0x4db1a6=_0x4db1a6-0x0;var _0x2796a8=_0x40e1[_0x4db1a6];return _0x2796a8;};'use strict';var OpenchannelMessageEvents=require(_0x140e('0x0'));var events=['save',_0x140e('0x1'),_0x140e('0x2')];function createListener(_0x25918c,_0x4348a2){return function(_0x35804b){_0x4348a2['emit'](_0x25918c,_0x35804b);};}function removeListener(_0x2c0be3,_0x5025f5){return function(){OpenchannelMessageEvents['removeListener'](_0x2c0be3,_0x5025f5);};}exports[_0x140e('0x3')]=function(_0x14a9d1){for(var _0x72b860=0x0,_0x4f4b0b=events[_0x140e('0x4')];_0x72b860<_0x4f4b0b;_0x72b860++){var _0x5cd67f=events[_0x72b860];var _0x54d04b=createListener(_0x140e('0x5')+_0x5cd67f,_0x14a9d1);OpenchannelMessageEvents['on'](_0x5cd67f,_0x54d04b);}}; \ No newline at end of file +var _0x3d46=['./openchannelMessage.events','save','remove','update','emit','register','length','openchannelMessage:'];(function(_0x2a2137,_0x280212){var _0x466f22=function(_0x233867){while(--_0x233867){_0x2a2137['push'](_0x2a2137['shift']());}};_0x466f22(++_0x280212);}(_0x3d46,0x170));var _0x63d4=function(_0x542c94,_0x2caae2){_0x542c94=_0x542c94-0x0;var _0x5d862a=_0x3d46[_0x542c94];return _0x5d862a;};'use strict';var OpenchannelMessageEvents=require(_0x63d4('0x0'));var events=[_0x63d4('0x1'),_0x63d4('0x2'),_0x63d4('0x3')];function createListener(_0x2d95a6,_0x10d028){return function(_0x37302a){_0x10d028[_0x63d4('0x4')](_0x2d95a6,_0x37302a);};}function removeListener(_0x4accfc,_0x220f99){return function(){OpenchannelMessageEvents['removeListener'](_0x4accfc,_0x220f99);};}exports[_0x63d4('0x5')]=function(_0x583f0){for(var _0x51dc4b=0x0,_0x39c7f9=events[_0x63d4('0x6')];_0x51dc4b<_0x39c7f9;_0x51dc4b++){var _0x168d19=events[_0x51dc4b];var _0x3bc1b0=createListener(_0x63d4('0x7')+_0x168d19,_0x583f0);OpenchannelMessageEvents['on'](_0x168d19,_0x3bc1b0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 98fc951..a9d99ad 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 _0xa5e6=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','getMembers'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa5e6,0x113));var _0x6a5e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa5e6[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x6a5e('0x0'));var path=require(_0x6a5e('0x1'));var timeout=require(_0x6a5e('0x2'));var express=require(_0x6a5e('0x3'));var router=express[_0x6a5e('0x4')]();var fs_extra=require(_0x6a5e('0x5'));var auth=require(_0x6a5e('0x6'));var interaction=require(_0x6a5e('0x7'));var config=require(_0x6a5e('0x8'));var controller=require('./openchannelQueue.controller');router[_0x6a5e('0x9')]('/',auth[_0x6a5e('0xa')](),controller[_0x6a5e('0xb')]);router[_0x6a5e('0x9')](_0x6a5e('0xc'),auth[_0x6a5e('0xa')](),controller['describe']);router['get']('/:id',auth[_0x6a5e('0xa')](),controller[_0x6a5e('0xd')]);router[_0x6a5e('0x9')]('/:id/members',auth[_0x6a5e('0xa')](),controller[_0x6a5e('0xe')]);router[_0x6a5e('0x9')](_0x6a5e('0xf'),auth[_0x6a5e('0xa')](),controller[_0x6a5e('0x10')]);router[_0x6a5e('0x9')]('/:id/users',auth[_0x6a5e('0xa')](),controller[_0x6a5e('0x11')]);router[_0x6a5e('0x12')]('/',auth[_0x6a5e('0xa')](),controller[_0x6a5e('0x13')]);router[_0x6a5e('0x12')](_0x6a5e('0xf'),auth[_0x6a5e('0xa')](),controller[_0x6a5e('0x14')]);router[_0x6a5e('0x12')](_0x6a5e('0x15'),auth[_0x6a5e('0xa')](),controller[_0x6a5e('0x16')]);router[_0x6a5e('0x17')](_0x6a5e('0x18'),auth['isAuthenticated'](),controller[_0x6a5e('0x19')]);router[_0x6a5e('0x1a')](_0x6a5e('0x18'),auth[_0x6a5e('0xa')](),controller['destroy']);router[_0x6a5e('0x1a')](_0x6a5e('0xf'),auth[_0x6a5e('0xa')](),controller[_0x6a5e('0x1b')]);router['delete'](_0x6a5e('0x15'),auth[_0x6a5e('0xa')](),controller['removeAgents']);module[_0x6a5e('0x1c')]=router; \ No newline at end of file +var _0x4441=['fs-extra','../../config/environment','./openchannelQueue.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeAgents','exports','multer','util','path','express','Router'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x4441,0x12f));var _0x1444=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4441[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1444('0x0'));var util=require(_0x1444('0x1'));var path=require(_0x1444('0x2'));var timeout=require('connect-timeout');var express=require(_0x1444('0x3'));var router=express[_0x1444('0x4')]();var fs_extra=require(_0x1444('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1444('0x6'));var controller=require(_0x1444('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1444('0x8')](_0x1444('0x9'),auth['isAuthenticated'](),controller[_0x1444('0xa')]);router[_0x1444('0x8')](_0x1444('0xb'),auth[_0x1444('0xc')](),controller[_0x1444('0xd')]);router[_0x1444('0x8')](_0x1444('0xe'),auth[_0x1444('0xc')](),controller['getMembers']);router['get'](_0x1444('0xf'),auth[_0x1444('0xc')](),controller[_0x1444('0x10')]);router[_0x1444('0x8')](_0x1444('0x11'),auth[_0x1444('0xc')](),controller[_0x1444('0x12')]);router[_0x1444('0x13')]('/',auth[_0x1444('0xc')](),controller[_0x1444('0x14')]);router[_0x1444('0x13')]('/:id/teams',auth[_0x1444('0xc')](),controller[_0x1444('0x15')]);router[_0x1444('0x13')](_0x1444('0x11'),auth[_0x1444('0xc')](),controller['addAgents']);router[_0x1444('0x16')](_0x1444('0xb'),auth[_0x1444('0xc')](),controller[_0x1444('0x17')]);router['delete'](_0x1444('0xb'),auth[_0x1444('0xc')](),controller[_0x1444('0x18')]);router['delete'](_0x1444('0xf'),auth[_0x1444('0xc')](),controller['removeTeams']);router[_0x1444('0x19')](_0x1444('0x11'),auth[_0x1444('0xc')](),controller[_0x1444('0x1a')]);module[_0x1444('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d708c5c..a8d7e47 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 _0x53d0=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x272ed8,_0x33ebca){var _0x1b79ad=function(_0x413b41){while(--_0x413b41){_0x272ed8['push'](_0x272ed8['shift']());}};_0x1b79ad(++_0x33ebca);}(_0x53d0,0xcf));var _0x053d=function(_0x2b2489,_0x20f669){_0x2b2489=_0x2b2489-0x0;var _0x406025=_0x53d0[_0x2b2489];return _0x406025;};'use strict';var Sequelize=require(_0x053d('0x0'));module[_0x053d('0x1')]={'name':{'type':Sequelize[_0x053d('0x2')],'unique':_0x053d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x053d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x053d('0x4')](_0x053d('0x5'),_0x053d('0x6'),_0x053d('0x7'))}}; \ No newline at end of file +var _0x5384=['STRING','name','ENUM','rrmemory','roundrobin','exports'];(function(_0x36c9a3,_0x211f4a){var _0x630130=function(_0x5251e3){while(--_0x5251e3){_0x36c9a3['push'](_0x36c9a3['shift']());}};_0x630130(++_0x211f4a);}(_0x5384,0xdd));var _0x4538=function(_0x549110,_0x3880ed){_0x549110=_0x549110-0x0;var _0x10ca74=_0x5384[_0x549110];return _0x10ca74;};'use strict';var Sequelize=require('sequelize');module[_0x4538('0x0')]={'name':{'type':Sequelize[_0x4538('0x1')],'unique':_0x4538('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4538('0x3')](_0x4538('0x4'),'beepall',_0x4538('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4415f19..3910aaa 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 _0x703f=['addAgents','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','show','rawAttributes','fields','find','catch','create','body','OpenchannelQueues','UserProfileSection','userProfileId','update','params','describe','getMembers','findOne','nolimit','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','all','compact'];(function(_0x518625,_0x48a4b2){var _0x1c7234=function(_0x1cdaf6){while(--_0x1cdaf6){_0x518625['push'](_0x518625['shift']());}};_0x1c7234(++_0x48a4b2);}(_0x703f,0x1a1));var _0xf703=function(_0x38ea75,_0x450a84){_0x38ea75=_0x38ea75-0x0;var _0x3bd555=_0x703f[_0x38ea75];return _0x3bd555;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf703('0x0'));var jsonpatch=require(_0xf703('0x1'));var rp=require(_0xf703('0x2'));var moment=require(_0xf703('0x3'));var BPromise=require(_0xf703('0x4'));var Mustache=require(_0xf703('0x5'));var util=require(_0xf703('0x6'));var path=require(_0xf703('0x7'));var sox=require(_0xf703('0x8'));var csv=require(_0xf703('0x9'));var ejs=require(_0xf703('0xa'));var fs=require('fs');var fs_extra=require(_0xf703('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf703('0xc'));var jsforce=require(_0xf703('0xd'));var deskjs=require(_0xf703('0xe'));var toCsv=require(_0xf703('0x9'));var querystring=require(_0xf703('0xf'));var Papa=require('papaparse');var Redis=require(_0xf703('0x10'));var authService=require(_0xf703('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf703('0x12'));var hardwareService=require(_0xf703('0x13'));var logger=require(_0xf703('0x14'))(_0xf703('0x15'));var utils=require(_0xf703('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf703('0x17'));var db=require('../../mysqldb')['db'];config[_0xf703('0x18')]=_[_0xf703('0x19')](config[_0xf703('0x18')],{'host':_0xf703('0x1a'),'port':0x18eb});var socket=require(_0xf703('0x1b'))(new Redis(config[_0xf703('0x18')]));require(_0xf703('0x1c'))[_0xf703('0x1d')](socket);function respondWithStatusCode(_0x947d25,_0x28b83){_0x28b83=_0x28b83||0xcc;return function(_0x424a0e){if(_0x424a0e){return _0x947d25[_0xf703('0x1e')](_0x28b83);}return _0x947d25[_0xf703('0x1f')](_0x28b83)[_0xf703('0x20')]();};}function respondWithResult(_0x52b1cd,_0x3e81d8){_0x3e81d8=_0x3e81d8||0xc8;return function(_0x4c5263){if(_0x4c5263){return _0x52b1cd[_0xf703('0x1f')](_0x3e81d8)[_0xf703('0x21')](_0x4c5263);}};}function respondWithFilteredResult(_0x3100e0,_0xb20f36){return function(_0x3a8482){if(_0x3a8482){var _0x3f6ef8=typeof _0xb20f36[_0xf703('0x22')]===_0xf703('0x23')&&typeof _0xb20f36[_0xf703('0x24')]===_0xf703('0x23');var _0xc1fe22=_0x3a8482[_0xf703('0x25')];var _0x2100e6=_0x3f6ef8?0x0:_0xb20f36[_0xf703('0x22')];var _0x1991fa=_0x3f6ef8?_0x3a8482[_0xf703('0x25')]:_0xb20f36[_0xf703('0x22')]+_0xb20f36[_0xf703('0x24')];var _0x4aad76;if(_0x1991fa>=_0xc1fe22){_0x1991fa=_0xc1fe22;_0x4aad76=0xc8;}else{_0x4aad76=0xce;}_0x3100e0[_0xf703('0x1f')](_0x4aad76);return _0x3100e0[_0xf703('0x26')](_0xf703('0x27'),_0x2100e6+'-'+_0x1991fa+'/'+_0xc1fe22)['json'](_0x3a8482);}return null;};}function patchUpdates(_0x206ca6){return function(_0x1a9004){try{jsonpatch['apply'](_0x1a9004,_0x206ca6,!![]);}catch(_0xdb3acb){return BPromise['reject'](_0xdb3acb);}return _0x1a9004[_0xf703('0x28')]();};}function saveUpdates(_0x3be066,_0x1a8fb8){return function(_0x305391){if(_0x305391){return _0x305391['update'](_0x3be066)[_0xf703('0x29')](function(_0x270d96){return _0x270d96;});}return null;};}function removeEntity(_0x1b0e93,_0x245c7b){return function(_0x58ee64){if(_0x58ee64){return _0x58ee64[_0xf703('0x2a')]()[_0xf703('0x29')](function(){var _0x1b45ac=_0x58ee64[_0xf703('0x2b')]({'plain':!![]});var _0x15b50e='OpenchannelQueues';return db['UserProfileResource'][_0xf703('0x2a')]({'where':{'type':_0x15b50e,'resourceId':_0x1b45ac['id']}})[_0xf703('0x29')](function(){return _0x58ee64;});})['then'](function(){_0x1b0e93['status'](0xcc)[_0xf703('0x20')]();});}};}function handleEntityNotFound(_0x260305,_0xa603cf){return function(_0x30188b){if(!_0x30188b){_0x260305['sendStatus'](0x194);}return _0x30188b;};}function handleError(_0x5024c2,_0x4d9c55){_0x4d9c55=_0x4d9c55||0x1f4;return function(_0x2ea579){logger[_0xf703('0x2c')](_0x2ea579[_0xf703('0x2d')]);if(_0x2ea579[_0xf703('0x2e')]){delete _0x2ea579[_0xf703('0x2e')];}_0x5024c2[_0xf703('0x1f')](_0x4d9c55)[_0xf703('0x2f')](_0x2ea579);};}exports['index']=function(_0x877ee3,_0x5f1a67){var _0x1dd320={},_0x4b282b={},_0x477c57={'count':0x0,'rows':[]};var _0x211e44=_[_0xf703('0x30')](db['OpenchannelQueue']['rawAttributes'],function(_0x29cc74){return{'name':_0x29cc74[_0xf703('0x31')],'type':_0x29cc74[_0xf703('0x32')][_0xf703('0x33')]};});_0x4b282b[_0xf703('0x34')]=_['map'](_0x211e44,_0xf703('0x2e'));_0x4b282b[_0xf703('0x35')]=_[_0xf703('0x36')](_0x877ee3[_0xf703('0x35')]);_0x4b282b[_0xf703('0x37')]=_[_0xf703('0x38')](_0x4b282b[_0xf703('0x34')],_0x4b282b[_0xf703('0x35')]);_0x1dd320['attributes']=_['intersection'](_0x4b282b['model'],qs['fields'](_0x877ee3['query']['fields']));_0x1dd320[_0xf703('0x39')]=_0x1dd320['attributes'][_0xf703('0x3a')]?_0x1dd320[_0xf703('0x39')]:_0x4b282b[_0xf703('0x34')];if(!_0x877ee3[_0xf703('0x35')][_0xf703('0x3b')]('nolimit')){_0x1dd320[_0xf703('0x24')]=qs['limit'](_0x877ee3[_0xf703('0x35')][_0xf703('0x24')]);_0x1dd320[_0xf703('0x22')]=qs[_0xf703('0x22')](_0x877ee3[_0xf703('0x35')][_0xf703('0x22')]);}_0x1dd320[_0xf703('0x3c')]=qs['sort'](_0x877ee3[_0xf703('0x35')][_0xf703('0x3d')]);_0x1dd320[_0xf703('0x3e')]=qs[_0xf703('0x37')](_[_0xf703('0x3f')](_0x877ee3[_0xf703('0x35')],_0x4b282b[_0xf703('0x37')]),_0x211e44);if(_0x877ee3[_0xf703('0x35')][_0xf703('0x40')]){_0x1dd320[_0xf703('0x3e')]=_[_0xf703('0x41')](_0x1dd320['where'],{'$or':_[_0xf703('0x30')](_0x211e44,function(_0x202bc8){if(_0x202bc8['type']!==_0xf703('0x42')){var _0x4c508e={};_0x4c508e[_0x202bc8['name']]={'$like':'%'+_0x877ee3[_0xf703('0x35')][_0xf703('0x40')]+'%'};return _0x4c508e;}})});}_0x1dd320=_[_0xf703('0x41')]({},_0x1dd320,_0x877ee3[_0xf703('0x43')]);var _0x564be8={'where':_0x1dd320[_0xf703('0x3e')]};return db[_0xf703('0x44')][_0xf703('0x25')](_0x564be8)[_0xf703('0x29')](function(_0xf64dc9){_0x477c57['count']=_0xf64dc9;if(_0x877ee3['query'][_0xf703('0x45')]){_0x1dd320[_0xf703('0x46')]=[{'all':!![]}];}return db[_0xf703('0x44')][_0xf703('0x47')](_0x1dd320);})['then'](function(_0x57f4e4){_0x477c57['rows']=_0x57f4e4;return _0x477c57;})['then'](respondWithFilteredResult(_0x5f1a67,_0x1dd320))['catch'](handleError(_0x5f1a67,null));};exports[_0xf703('0x48')]=function(_0xecde58,_0x2e4622){var _0x3d565a={'raw':!![],'where':{'id':_0xecde58['params']['id']}},_0x4c6c06={};_0x4c6c06[_0xf703('0x34')]=_[_0xf703('0x36')](db[_0xf703('0x44')][_0xf703('0x49')]);_0x4c6c06[_0xf703('0x35')]=_[_0xf703('0x36')](_0xecde58['query']);_0x4c6c06[_0xf703('0x37')]=_['intersection'](_0x4c6c06['model'],_0x4c6c06[_0xf703('0x35')]);_0x3d565a[_0xf703('0x39')]=_[_0xf703('0x38')](_0x4c6c06['model'],qs['fields'](_0xecde58[_0xf703('0x35')][_0xf703('0x4a')]));_0x3d565a[_0xf703('0x39')]=_0x3d565a[_0xf703('0x39')]['length']?_0x3d565a['attributes']:_0x4c6c06[_0xf703('0x34')];if(_0xecde58[_0xf703('0x35')][_0xf703('0x45')]){_0x3d565a['include']=[{'all':!![]}];}_0x3d565a=_[_0xf703('0x41')]({},_0x3d565a,_0xecde58[_0xf703('0x43')]);return db[_0xf703('0x44')][_0xf703('0x4b')](_0x3d565a)[_0xf703('0x29')](handleEntityNotFound(_0x2e4622,null))[_0xf703('0x29')](respondWithResult(_0x2e4622,null))[_0xf703('0x4c')](handleError(_0x2e4622,null));};exports[_0xf703('0x4d')]=function(_0x27f69a,_0x83b907){return db['OpenchannelQueue'][_0xf703('0x4d')](_0x27f69a[_0xf703('0x4e')],{})['then'](function(_0x52bcb5){var _0x1aacfe=_0x27f69a['user']['get']({'plain':!![]});if(!_0x1aacfe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aacfe['role']==='user'){var _0x39ad92=_0x52bcb5['get']({'plain':!![]});var _0x6e1f9e=_0xf703('0x4f');return db[_0xf703('0x50')]['find']({'where':{'name':_0x6e1f9e,'userProfileId':_0x1aacfe[_0xf703('0x51')]},'raw':!![]})[_0xf703('0x29')](function(_0x195fb5){if(_0x195fb5&&_0x195fb5['autoAssociation']===0x0){return db['UserProfileResource'][_0xf703('0x4d')]({'name':_0x39ad92[_0xf703('0x2e')],'resourceId':_0x39ad92['id'],'type':_0x195fb5['name'],'sectionId':_0x195fb5['id']},{})[_0xf703('0x29')](function(){return _0x52bcb5;});}else{return _0x52bcb5;}})[_0xf703('0x4c')](function(_0x187d02){logger[_0xf703('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x187d02);throw _0x187d02;});}return _0x52bcb5;})[_0xf703('0x29')](respondWithResult(_0x83b907,0xc9))[_0xf703('0x4c')](handleError(_0x83b907,null));};exports[_0xf703('0x52')]=function(_0x56b44c,_0x275ebc){if(_0x56b44c[_0xf703('0x4e')]['id']){delete _0x56b44c['body']['id'];}return db[_0xf703('0x44')][_0xf703('0x4b')]({'where':{'id':_0x56b44c[_0xf703('0x53')]['id']}})[_0xf703('0x29')](handleEntityNotFound(_0x275ebc,null))[_0xf703('0x29')](saveUpdates(_0x56b44c[_0xf703('0x4e')],null))[_0xf703('0x29')](respondWithResult(_0x275ebc,null))[_0xf703('0x4c')](handleError(_0x275ebc,null));};exports[_0xf703('0x2a')]=function(_0x371771,_0x14beee){return db[_0xf703('0x44')][_0xf703('0x4b')]({'where':{'id':_0x371771['params']['id']}})['then'](handleEntityNotFound(_0x14beee,null))[_0xf703('0x29')](removeEntity(_0x14beee,null))[_0xf703('0x4c')](handleError(_0x14beee,null));};exports[_0xf703('0x54')]=function(_0x9856bb,_0xc3ecc4){return db[_0xf703('0x44')][_0xf703('0x54')]()[_0xf703('0x29')](respondWithResult(_0xc3ecc4,null))[_0xf703('0x4c')](handleError(_0xc3ecc4,null));};exports[_0xf703('0x55')]=function(_0x3d5a44,_0x9d2142,_0x44e186){var _0x23c0f9={'raw':!![],'where':{}},_0x40c6b7={},_0x2d51a0;return db['OpenchannelQueue'][_0xf703('0x56')]({'where':{'id':_0x3d5a44[_0xf703('0x53')]['id']}})[_0xf703('0x29')](handleEntityNotFound(_0x9d2142,null))[_0xf703('0x29')](function(_0x230b9c){if(_0x230b9c){_0x2d51a0=_0x230b9c[_0xf703('0x2b')]({'plain':!![]});_0x40c6b7[_0xf703('0x34')]=_[_0xf703('0x36')](db['UserOpenchannelQueue'][_0xf703('0x49')]);_0x40c6b7[_0xf703('0x35')]=_[_0xf703('0x36')](_0x3d5a44[_0xf703('0x35')]);_0x40c6b7[_0xf703('0x37')]=_[_0xf703('0x38')](_0x40c6b7[_0xf703('0x34')],_0x40c6b7['query']);_0x23c0f9['attributes']=_[_0xf703('0x38')](_0x40c6b7[_0xf703('0x34')],qs['fields'](_0x3d5a44[_0xf703('0x35')]['fields']));_0x23c0f9[_0xf703('0x39')]=_0x23c0f9[_0xf703('0x39')]['length']?_0x23c0f9[_0xf703('0x39')]:_0x40c6b7[_0xf703('0x34')];if(!_0x3d5a44[_0xf703('0x35')][_0xf703('0x3b')](_0xf703('0x57'))){_0x23c0f9[_0xf703('0x24')]=qs['limit'](_0x3d5a44[_0xf703('0x35')][_0xf703('0x24')]);_0x23c0f9[_0xf703('0x22')]=qs[_0xf703('0x22')](_0x3d5a44['query'][_0xf703('0x22')]);}_0x23c0f9[_0xf703('0x3c')]=qs[_0xf703('0x3d')](_0x3d5a44[_0xf703('0x35')]['sort']);_0x23c0f9[_0xf703('0x3e')]=qs[_0xf703('0x37')](_[_0xf703('0x3f')](_0x3d5a44['query'],_0x40c6b7['filters']));_0x23c0f9[_0xf703('0x3e')][_0xf703('0x58')]=_0x230b9c['id'];if(_0x3d5a44[_0xf703('0x35')]['filter']){_0x23c0f9[_0xf703('0x3e')]=_[_0xf703('0x41')](_0x23c0f9[_0xf703('0x3e')],{'$or':_[_0xf703('0x30')](_0x23c0f9[_0xf703('0x39')],function(_0x547f99){var _0x34a0b9={};_0x34a0b9[_0x547f99]={'$like':'%'+_0x3d5a44['query'][_0xf703('0x40')]+'%'};return _0x34a0b9;})});}_0x23c0f9=_['merge']({},_0x23c0f9,_0x3d5a44[_0xf703('0x43')]);return db[_0xf703('0x59')][_0xf703('0x47')](_0x23c0f9);}})[_0xf703('0x29')](function(_0x90b85){if(_0x90b85){return db[_0xf703('0x5a')][_0xf703('0x5b')]({'where':{'id':_[_0xf703('0x30')](_0x90b85,_0xf703('0x5c')),'role':_0xf703('0x5d')},'attributes':['id',_0xf703('0x2e'),'openchannelPause',_0xf703('0x5e'),_0xf703('0x5f')]});}})[_0xf703('0x29')](function(_0x216feb){if(_0x216feb){return{'count':_0x216feb[_0xf703('0x25')],'rows':_[_0xf703('0x30')](_0x216feb[_0xf703('0x60')],function(_0x4a1012){return{'membername':_0x4a1012[_0xf703('0x2e')],'UserId':_0x4a1012['id'],'queue_name':_0x2d51a0[_0xf703('0x2e')],'OpenchannelQueueId':_0x2d51a0['id'],'interface':util[_0xf703('0x61')](_0xf703('0x62'),_0xf703('0x63'),_0x4a1012[_0xf703('0x2e')]),'penalty':0x0,'paused':_0x4a1012[_0xf703('0x64')],'createdAt':_0x4a1012[_0xf703('0x5f')],'updatedAt':_0x4a1012[_0xf703('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf703('0x29')](respondWithFilteredResult(_0x9d2142,_0x23c0f9))[_0xf703('0x4c')](handleError(_0x9d2142,null));};exports[_0xf703('0x65')]=function(_0x2e542e,_0x5c8679,_0x5bc0cd){var _0x2e0303={};var _0x418ca5={};var _0x1b1e5b;var _0x4e2197;return db[_0xf703('0x44')]['findOne']({'where':{'id':_0x2e542e[_0xf703('0x53')]['id']}})[_0xf703('0x29')](handleEntityNotFound(_0x5c8679,null))['then'](function(_0x29f420){if(_0x29f420){_0x1b1e5b=_0x29f420;_0x418ca5[_0xf703('0x34')]=_[_0xf703('0x36')](db[_0xf703('0x66')][_0xf703('0x49')]);_0x418ca5[_0xf703('0x35')]=_[_0xf703('0x36')](_0x2e542e['query']);_0x418ca5[_0xf703('0x37')]=_[_0xf703('0x38')](_0x418ca5['model'],_0x418ca5[_0xf703('0x35')]);_0x2e0303[_0xf703('0x39')]=_['intersection'](_0x418ca5[_0xf703('0x34')],qs['fields'](_0x2e542e['query'][_0xf703('0x4a')]));_0x2e0303[_0xf703('0x39')]=_0x2e0303['attributes']['length']?_0x2e0303['attributes']:_0x418ca5[_0xf703('0x34')];_0x2e0303[_0xf703('0x3c')]=qs[_0xf703('0x3d')](_0x2e542e['query'][_0xf703('0x3d')]);_0x2e0303['where']=qs[_0xf703('0x37')](_[_0xf703('0x3f')](_0x2e542e['query'],_0x418ca5[_0xf703('0x37')]));if(_0x2e542e['query'][_0xf703('0x40')]){_0x2e0303['where']=_[_0xf703('0x41')](_0x2e0303[_0xf703('0x3e')],{'$or':_['map'](_0x2e0303[_0xf703('0x39')],function(_0x478480){var _0x5dc742={};_0x5dc742[_0x478480]={'$like':'%'+_0x2e542e[_0xf703('0x35')]['filter']+'%'};return _0x5dc742;})});}_0x2e0303=_[_0xf703('0x41')]({},_0x2e0303,_0x2e542e[_0xf703('0x43')]);return _0x1b1e5b['getTeams'](_0x2e0303);}})[_0xf703('0x29')](function(_0x1c443e){if(_0x1c443e){_0x4e2197=_0x1c443e[_0xf703('0x3a')];if(!_0x2e542e[_0xf703('0x35')][_0xf703('0x3b')](_0xf703('0x57'))){_0x2e0303[_0xf703('0x24')]=qs[_0xf703('0x24')](_0x2e542e[_0xf703('0x35')][_0xf703('0x24')]);_0x2e0303[_0xf703('0x22')]=qs[_0xf703('0x22')](_0x2e542e['query'][_0xf703('0x22')]);}return _0x1b1e5b[_0xf703('0x65')](_0x2e0303);}})[_0xf703('0x29')](function(_0x1ec8bf){if(_0x1ec8bf){return _0x1ec8bf?{'count':_0x4e2197,'rows':_0x1ec8bf}:null;}})[_0xf703('0x29')](respondWithResult(_0x5c8679,null))[_0xf703('0x4c')](handleError(_0x5c8679,null));};exports[_0xf703('0x67')]=function(_0x23debd,_0x310790,_0x519d64){var _0x2c85fb=_0x23debd['body'][_0xf703('0x68')];return db[_0xf703('0x66')][_0xf703('0x47')]({'where':{'id':_0x2c85fb},'attributes':['id'],'include':[{'model':db[_0xf703('0x5a')],'as':'Agents','attributes':['id','name',_0xf703('0x69'),_0xf703('0x6a'),'interface'],'raw':!![]}]})[_0xf703('0x29')](function(_0x3aacb9){if(_0x3aacb9){var _0x4971e0=_[_0xf703('0x6b')](_0x3aacb9,function(_0x5ddfef){var _0x15d155=_0x5ddfef[_0xf703('0x2b')]({'plain':!![]});return _0x15d155[_0xf703('0x6c')];});return db[_0xf703('0x44')][_0xf703('0x4b')]({'where':{'id':_0x23debd[_0xf703('0x53')]['id']}})[_0xf703('0x29')](function(_0x19671e){return db[_0xf703('0x6d')][_0xf703('0x6e')](function(_0x74b3e){return _0x19671e[_0xf703('0x67')](_0x2c85fb,{'transaction':_0x74b3e})['then'](function(){return BPromise[_0xf703('0x6f')](_0x4971e0,function(_0x4152d8){return db[_0xf703('0x59')][_0xf703('0x70')]({'where':{'UserId':_0x4152d8['id'],'OpenchannelQueueId':_0x23debd[_0xf703('0x53')]['id']},'transaction':_0x74b3e});});})[_0xf703('0x29')](function(){_0x4971e0[_0xf703('0x71')](function(_0x58151b){socket[_0xf703('0x72')](_0xf703('0x73'),{'UserId':_0x58151b['id'],'OpenchannelQueueId':_0x19671e['id']});});});});});}})[_0xf703('0x29')](respondWithStatusCode(_0x310790,null))[_0xf703('0x4c')](handleError(_0x310790,null));};exports[_0xf703('0x74')]=function(_0x10eca2,_0x5a8a46,_0x2be976){return db[_0xf703('0x66')]['findAll']({'where':{'id':_0x10eca2[_0xf703('0x35')][_0xf703('0x68')]},'attributes':['id'],'include':[{'model':db[_0xf703('0x5a')],'as':_0xf703('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf703('0x29')](handleEntityNotFound(_0x5a8a46,null))[_0xf703('0x29')](function(_0x8ac41d){var _0x1981f8=_['map'](_0x8ac41d,'id');var _0x1c8263=[];var _0x5db7e5=[];var _0x518b48=squel[_0xf703('0x75')]();_0x518b48[_0xf703('0x76')](_0xf703('0x77'))['from'](_0xf703('0x78'),'tq')[_0xf703('0x79')]('user_has_teams','ut',_0xf703('0x7a'))[_0xf703('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x10eca2[_0xf703('0x53')]['id']);for(var _0x2b2499=0x0;_0x2b2499<_0x8ac41d[_0xf703('0x3a')];_0x2b2499+=0x1){let _0x5616a9=_0x8ac41d[_0x2b2499];for(var _0x520265=0x0;_0x520265<_0x5616a9[_0xf703('0x6c')][_0xf703('0x3a')];_0x520265+=0x1){let _0xc28933=_0x5616a9[_0xf703('0x6c')][_0x520265];var _0x24dbb5=_0x518b48[_0xf703('0x7b')]();_0x24dbb5[_0xf703('0x3e')](_0xf703('0x7c'),_0xc28933['id']);_0x5db7e5[_0xf703('0x7d')](db[_0xf703('0x6d')]['query'](_0x24dbb5[_0xf703('0x7e')](),{'type':db[_0xf703('0x6d')][_0xf703('0x7f')][_0xf703('0x80')]})[_0xf703('0x29')](function(_0x65c24){if(_0x65c24['length']===0x1){return _0xc28933['id'];}else{var _0x32de3=_['every'](_[_0xf703('0x30')](_0x65c24,'TeamId'),function(_0x3527a7){return _['includes'](_0x1981f8,_0x3527a7);});if(_0x32de3){return _0xc28933['id'];}}}));}}return BPromise[_0xf703('0x81')](_0x5db7e5)[_0xf703('0x29')](function(_0x5ce8e4){_0x1c8263=_(_0x1c8263)['union'](_0x5ce8e4)[_0xf703('0x82')]()['value']();return db[_0xf703('0x44')][_0xf703('0x4b')]({'where':{'id':_0x10eca2['params']['id']}})[_0xf703('0x29')](function(_0xca2040){return db[_0xf703('0x6d')][_0xf703('0x6e')](function(_0x4388a9){return _0xca2040[_0xf703('0x74')](_0x10eca2['query'][_0xf703('0x68')],{'transaction':_0x4388a9})[_0xf703('0x29')](function(){if(!_['isEmpty'](_0x1c8263)){return _0xca2040['removeAgents'](_0x1c8263,{'transaction':_0x4388a9});}})['then'](function(){_0x1c8263[_0xf703('0x71')](function(_0xfa2bbb){socket[_0xf703('0x72')]('userOpenchannelQueue:remove',{'UserId':_0xfa2bbb,'OpenchannelQueueId':_0xca2040['id']});});});});});});})[_0xf703('0x29')](respondWithStatusCode(_0x5a8a46,null))[_0xf703('0x4c')](handleError(_0x5a8a46,null));};exports[_0xf703('0x83')]=function(_0x46908f,_0x5c9f16,_0x324313){return db['OpenchannelQueue']['find']({'where':{'id':_0x46908f[_0xf703('0x53')]['id']}})[_0xf703('0x29')](handleEntityNotFound(_0x5c9f16,null))[_0xf703('0x29')](function(_0x4e99bf){if(_0x4e99bf){return _0x4e99bf[_0xf703('0x83')](_0x46908f[_0xf703('0x4e')]['ids'],_[_0xf703('0x84')](_0x46908f[_0xf703('0x4e')],['ids','id'])||{})[_0xf703('0x85')](function(_0x7d19d){for(var _0x52b14a=0x0;_0x52b14a<_0x46908f[_0xf703('0x4e')][_0xf703('0x68')][_0xf703('0x3a')];_0x52b14a+=0x1){socket[_0xf703('0x72')](_0xf703('0x73'),{'UserId':Number(_0x46908f[_0xf703('0x4e')][_0xf703('0x68')][_0x52b14a]),'OpenchannelQueueId':Number(_0x46908f[_0xf703('0x53')]['id'])});}return _0x7d19d;});}})[_0xf703('0x29')](respondWithResult(_0x5c9f16,null))[_0xf703('0x4c')](handleError(_0x5c9f16,null));};exports[_0xf703('0x86')]=function(_0x312603,_0xdb29ba,_0x1527d0){return db[_0xf703('0x44')][_0xf703('0x4b')]({'where':{'id':_0x312603['params']['id']}})['then'](handleEntityNotFound(_0xdb29ba,null))['then'](function(_0x36304f){if(_0x36304f){return _0x36304f['removeAgents'](_0x312603['query']['ids'])[_0xf703('0x29')](function(){if(_['isArray'](_0x312603[_0xf703('0x35')][_0xf703('0x68')])){for(var _0x1eb016=0x0;_0x1eb016<_0x312603[_0xf703('0x35')][_0xf703('0x68')]['length'];_0x1eb016+=0x1){socket[_0xf703('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x312603[_0xf703('0x35')][_0xf703('0x68')][_0x1eb016]),'OpenchannelQueueId':Number(_0x312603[_0xf703('0x53')]['id'])});}}else{socket[_0xf703('0x72')](_0xf703('0x87'),{'UserId':Number(_0x312603[_0xf703('0x35')][_0xf703('0x68')]),'OpenchannelQueueId':Number(_0x312603[_0xf703('0x53')]['id'])});}});}})[_0xf703('0x29')](respondWithStatusCode(_0xdb29ba,null))[_0xf703('0x4c')](handleError(_0xdb29ba,null));};exports['getAgents']=function(_0x3780c0,_0x186883,_0x5dd86f){var _0x55a8c8={};var _0x541a82={};var _0x50f59e;var _0x43ba8f;return db[_0xf703('0x44')]['findOne']({'where':{'id':_0x3780c0['params']['id']}})[_0xf703('0x29')](handleEntityNotFound(_0x186883,null))['then'](function(_0x125940){if(_0x125940){_0x50f59e=_0x125940;_0x541a82[_0xf703('0x34')]=_[_0xf703('0x36')](db[_0xf703('0x5a')]['rawAttributes']);_0x541a82[_0xf703('0x35')]=_['keys'](_0x3780c0['query']);_0x541a82['filters']=_['intersection'](_0x541a82[_0xf703('0x34')],_0x541a82[_0xf703('0x35')]);_0x55a8c8[_0xf703('0x39')]=_['intersection'](_0x541a82[_0xf703('0x34')],qs[_0xf703('0x4a')](_0x3780c0[_0xf703('0x35')]['fields']));_0x55a8c8[_0xf703('0x39')]=_0x55a8c8[_0xf703('0x39')][_0xf703('0x3a')]?_0x55a8c8[_0xf703('0x39')]:_0x541a82['model'];_0x55a8c8['order']=qs[_0xf703('0x3d')](_0x3780c0[_0xf703('0x35')][_0xf703('0x3d')]);_0x55a8c8[_0xf703('0x3e')]=qs[_0xf703('0x37')](_[_0xf703('0x3f')](_0x3780c0[_0xf703('0x35')],_0x541a82['filters']));if(_0x3780c0[_0xf703('0x35')]['filter']){_0x55a8c8[_0xf703('0x3e')]=_[_0xf703('0x41')](_0x55a8c8[_0xf703('0x3e')],{'$or':_[_0xf703('0x30')](_0x55a8c8[_0xf703('0x39')],function(_0x14b6a5){var _0x3b7c0b={};_0x3b7c0b[_0x14b6a5]={'$like':'%'+_0x3780c0[_0xf703('0x35')][_0xf703('0x40')]+'%'};return _0x3b7c0b;})});}_0x55a8c8=_['merge']({},_0x55a8c8,_0x3780c0[_0xf703('0x43')]);return _0x50f59e[_0xf703('0x88')](_0x55a8c8);}})[_0xf703('0x29')](function(_0x30ca1f){if(_0x30ca1f){_0x43ba8f=_0x30ca1f['length'];if(!_0x3780c0['query'][_0xf703('0x3b')](_0xf703('0x57'))){_0x55a8c8[_0xf703('0x24')]=qs[_0xf703('0x24')](_0x3780c0['query'][_0xf703('0x24')]);_0x55a8c8[_0xf703('0x22')]=qs[_0xf703('0x22')](_0x3780c0[_0xf703('0x35')]['offset']);}return _0x50f59e['getAgents'](_0x55a8c8);}})[_0xf703('0x29')](function(_0x59bd75){if(_0x59bd75){return _0x59bd75?{'count':_0x43ba8f,'rows':_0x59bd75}:null;}})[_0xf703('0x29')](respondWithResult(_0x186883,null))[_0xf703('0x4c')](handleError(_0x186883,null));}; \ No newline at end of file +var _0x565c=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','union','value','transaction','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','interface','flatMap','Agents','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues'];(function(_0x280043,_0xed4b79){var _0x4fbf34=function(_0x518713){while(--_0x518713){_0x280043['push'](_0x280043['shift']());}};_0x4fbf34(++_0xed4b79);}(_0x565c,0x9e));var _0xc565=function(_0x424884,_0x175626){_0x424884=_0x424884-0x0;var _0x18daea=_0x565c[_0x424884];return _0x18daea;};'use strict';var emlformat=require(_0xc565('0x0'));var rimraf=require(_0xc565('0x1'));var zipdir=require(_0xc565('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc565('0x3'));var moment=require(_0xc565('0x4'));var BPromise=require(_0xc565('0x5'));var Mustache=require('mustache');var util=require(_0xc565('0x6'));var path=require(_0xc565('0x7'));var sox=require('sox');var csv=require(_0xc565('0x8'));var ejs=require(_0xc565('0x9'));var fs=require('fs');var fs_extra=require(_0xc565('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc565('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc565('0xc'));var toCsv=require(_0xc565('0x8'));var querystring=require(_0xc565('0xd'));var Papa=require('papaparse');var Redis=require(_0xc565('0xe'));var authService=require(_0xc565('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc565('0x10'));var hardwareService=require(_0xc565('0x11'));var logger=require(_0xc565('0x12'))(_0xc565('0x13'));var utils=require('../../config/utils');var config=require(_0xc565('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc565('0x15')]=_[_0xc565('0x16')](config['redis'],{'host':_0xc565('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc565('0x15')]));require('./openchannelQueue.socket')[_0xc565('0x18')](socket);function respondWithStatusCode(_0x1e38a2,_0x38b94a){_0x38b94a=_0x38b94a||0xcc;return function(_0x1c034b){if(_0x1c034b){return _0x1e38a2[_0xc565('0x19')](_0x38b94a);}return _0x1e38a2[_0xc565('0x1a')](_0x38b94a)['end']();};}function respondWithResult(_0x506cf8,_0x578073){_0x578073=_0x578073||0xc8;return function(_0x33d9ea){if(_0x33d9ea){return _0x506cf8[_0xc565('0x1a')](_0x578073)[_0xc565('0x1b')](_0x33d9ea);}};}function respondWithFilteredResult(_0x10c76c,_0x2d317e){return function(_0x588e95){if(_0x588e95){var _0x4cfda7=typeof _0x2d317e[_0xc565('0x1c')]===_0xc565('0x1d')&&typeof _0x2d317e[_0xc565('0x1e')]==='undefined';var _0x360798=_0x588e95[_0xc565('0x1f')];var _0x190f38=_0x4cfda7?0x0:_0x2d317e[_0xc565('0x1c')];var _0x4c35a7=_0x4cfda7?_0x588e95[_0xc565('0x1f')]:_0x2d317e[_0xc565('0x1c')]+_0x2d317e[_0xc565('0x1e')];var _0x3d7c55;if(_0x4c35a7>=_0x360798){_0x4c35a7=_0x360798;_0x3d7c55=0xc8;}else{_0x3d7c55=0xce;}_0x10c76c[_0xc565('0x1a')](_0x3d7c55);return _0x10c76c[_0xc565('0x20')](_0xc565('0x21'),_0x190f38+'-'+_0x4c35a7+'/'+_0x360798)[_0xc565('0x1b')](_0x588e95);}return null;};}function patchUpdates(_0x306744){return function(_0x57a65b){try{jsonpatch['apply'](_0x57a65b,_0x306744,!![]);}catch(_0xbb09ad){return BPromise[_0xc565('0x22')](_0xbb09ad);}return _0x57a65b[_0xc565('0x23')]();};}function saveUpdates(_0x38b6a9,_0xfb9224){return function(_0x489f0f){if(_0x489f0f){return _0x489f0f[_0xc565('0x24')](_0x38b6a9)[_0xc565('0x25')](function(_0x10684c){return _0x10684c;});}return null;};}function removeEntity(_0x27a025,_0x1c25dd){return function(_0x2baa7b){if(_0x2baa7b){return _0x2baa7b[_0xc565('0x26')]()[_0xc565('0x25')](function(){var _0x17c614=_0x2baa7b[_0xc565('0x27')]({'plain':!![]});var _0x3fbfab=_0xc565('0x28');return db[_0xc565('0x29')][_0xc565('0x26')]({'where':{'type':_0x3fbfab,'resourceId':_0x17c614['id']}})[_0xc565('0x25')](function(){return _0x2baa7b;});})[_0xc565('0x25')](function(){_0x27a025[_0xc565('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256447,_0x33bf47){return function(_0x5adde4){if(!_0x5adde4){_0x256447[_0xc565('0x19')](0x194);}return _0x5adde4;};}function handleError(_0x1be263,_0xd59679){_0xd59679=_0xd59679||0x1f4;return function(_0x398c31){logger[_0xc565('0x2a')](_0x398c31[_0xc565('0x2b')]);if(_0x398c31[_0xc565('0x2c')]){delete _0x398c31[_0xc565('0x2c')];}_0x1be263[_0xc565('0x1a')](_0xd59679)[_0xc565('0x2d')](_0x398c31);};}exports[_0xc565('0x2e')]=function(_0x30bfba,_0x371522){var _0x458304={},_0xa3ef5b={},_0x3d9fc8={'count':0x0,'rows':[]};var _0x2d2866=_[_0xc565('0x2f')](db[_0xc565('0x30')][_0xc565('0x31')],function(_0x1510f2){return{'name':_0x1510f2[_0xc565('0x32')],'type':_0x1510f2[_0xc565('0x33')][_0xc565('0x34')]};});_0xa3ef5b['model']=_['map'](_0x2d2866,'name');_0xa3ef5b['query']=_['keys'](_0x30bfba['query']);_0xa3ef5b[_0xc565('0x35')]=_[_0xc565('0x36')](_0xa3ef5b[_0xc565('0x37')],_0xa3ef5b[_0xc565('0x38')]);_0x458304[_0xc565('0x39')]=_['intersection'](_0xa3ef5b[_0xc565('0x37')],qs[_0xc565('0x3a')](_0x30bfba[_0xc565('0x38')][_0xc565('0x3a')]));_0x458304[_0xc565('0x39')]=_0x458304[_0xc565('0x39')][_0xc565('0x3b')]?_0x458304[_0xc565('0x39')]:_0xa3ef5b[_0xc565('0x37')];if(!_0x30bfba['query'][_0xc565('0x3c')](_0xc565('0x3d'))){_0x458304['limit']=qs[_0xc565('0x1e')](_0x30bfba[_0xc565('0x38')]['limit']);_0x458304[_0xc565('0x1c')]=qs[_0xc565('0x1c')](_0x30bfba[_0xc565('0x38')][_0xc565('0x1c')]);}_0x458304['order']=qs['sort'](_0x30bfba[_0xc565('0x38')][_0xc565('0x3e')]);_0x458304['where']=qs[_0xc565('0x35')](_[_0xc565('0x3f')](_0x30bfba['query'],_0xa3ef5b[_0xc565('0x35')]),_0x2d2866);if(_0x30bfba[_0xc565('0x38')]['filter']){_0x458304[_0xc565('0x40')]=_[_0xc565('0x41')](_0x458304[_0xc565('0x40')],{'$or':_[_0xc565('0x2f')](_0x2d2866,function(_0x5d965a){if(_0x5d965a[_0xc565('0x33')]!==_0xc565('0x42')){var _0x228e77={};_0x228e77[_0x5d965a[_0xc565('0x2c')]]={'$like':'%'+_0x30bfba[_0xc565('0x38')][_0xc565('0x43')]+'%'};return _0x228e77;}})});}_0x458304=_[_0xc565('0x41')]({},_0x458304,_0x30bfba['options']);var _0x24b78b={'where':_0x458304['where']};return db['OpenchannelQueue'][_0xc565('0x1f')](_0x24b78b)[_0xc565('0x25')](function(_0x4c66ca){_0x3d9fc8[_0xc565('0x1f')]=_0x4c66ca;if(_0x30bfba[_0xc565('0x38')][_0xc565('0x44')]){_0x458304[_0xc565('0x45')]=[{'all':!![]}];}return db[_0xc565('0x30')][_0xc565('0x46')](_0x458304);})[_0xc565('0x25')](function(_0x1a389a){_0x3d9fc8[_0xc565('0x47')]=_0x1a389a;return _0x3d9fc8;})[_0xc565('0x25')](respondWithFilteredResult(_0x371522,_0x458304))[_0xc565('0x48')](handleError(_0x371522,null));};exports[_0xc565('0x49')]=function(_0x1c2930,_0x115182){var _0x1aec86={'raw':!![],'where':{'id':_0x1c2930[_0xc565('0x4a')]['id']}},_0x693ce4={};_0x693ce4[_0xc565('0x37')]=_[_0xc565('0x4b')](db[_0xc565('0x30')][_0xc565('0x31')]);_0x693ce4[_0xc565('0x38')]=_[_0xc565('0x4b')](_0x1c2930['query']);_0x693ce4[_0xc565('0x35')]=_[_0xc565('0x36')](_0x693ce4[_0xc565('0x37')],_0x693ce4[_0xc565('0x38')]);_0x1aec86[_0xc565('0x39')]=_[_0xc565('0x36')](_0x693ce4[_0xc565('0x37')],qs[_0xc565('0x3a')](_0x1c2930['query']['fields']));_0x1aec86[_0xc565('0x39')]=_0x1aec86[_0xc565('0x39')]['length']?_0x1aec86[_0xc565('0x39')]:_0x693ce4[_0xc565('0x37')];if(_0x1c2930[_0xc565('0x38')]['includeAll']){_0x1aec86['include']=[{'all':!![]}];}_0x1aec86=_[_0xc565('0x41')]({},_0x1aec86,_0x1c2930[_0xc565('0x4c')]);return db[_0xc565('0x30')][_0xc565('0x4d')](_0x1aec86)[_0xc565('0x25')](handleEntityNotFound(_0x115182,null))[_0xc565('0x25')](respondWithResult(_0x115182,null))[_0xc565('0x48')](handleError(_0x115182,null));};exports['create']=function(_0x5b26ac,_0x571a64){return db['OpenchannelQueue'][_0xc565('0x4e')](_0x5b26ac['body'],{})[_0xc565('0x25')](function(_0x49249f){var _0x5bdd17=_0x5b26ac['user']['get']({'plain':!![]});if(!_0x5bdd17)throw new Error(_0xc565('0x4f'));if(_0x5bdd17[_0xc565('0x50')]==='user'){var _0x51da8c=_0x49249f[_0xc565('0x27')]({'plain':!![]});var _0x14f5b7=_0xc565('0x28');return db['UserProfileSection'][_0xc565('0x4d')]({'where':{'name':_0x14f5b7,'userProfileId':_0x5bdd17[_0xc565('0x51')]},'raw':!![]})[_0xc565('0x25')](function(_0x3c22de){if(_0x3c22de&&_0x3c22de[_0xc565('0x52')]===0x0){return db['UserProfileResource'][_0xc565('0x4e')]({'name':_0x51da8c[_0xc565('0x2c')],'resourceId':_0x51da8c['id'],'type':_0x3c22de[_0xc565('0x2c')],'sectionId':_0x3c22de['id']},{})['then'](function(){return _0x49249f;});}else{return _0x49249f;}})[_0xc565('0x48')](function(_0x316ca9){logger[_0xc565('0x2a')](_0xc565('0x53'),_0x316ca9);throw _0x316ca9;});}return _0x49249f;})['then'](respondWithResult(_0x571a64,0xc9))['catch'](handleError(_0x571a64,null));};exports[_0xc565('0x24')]=function(_0x5d3c2f,_0x155ab2){if(_0x5d3c2f[_0xc565('0x54')]['id']){delete _0x5d3c2f['body']['id'];}return db[_0xc565('0x30')][_0xc565('0x4d')]({'where':{'id':_0x5d3c2f[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](handleEntityNotFound(_0x155ab2,null))['then'](saveUpdates(_0x5d3c2f[_0xc565('0x54')],null))[_0xc565('0x25')](respondWithResult(_0x155ab2,null))[_0xc565('0x48')](handleError(_0x155ab2,null));};exports['destroy']=function(_0x54f418,_0x38cc01){return db[_0xc565('0x30')][_0xc565('0x4d')]({'where':{'id':_0x54f418[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](handleEntityNotFound(_0x38cc01,null))[_0xc565('0x25')](removeEntity(_0x38cc01,null))[_0xc565('0x48')](handleError(_0x38cc01,null));};exports[_0xc565('0x55')]=function(_0x2a3a51,_0x2b8422){return db['OpenchannelQueue'][_0xc565('0x55')]()['then'](respondWithResult(_0x2b8422,null))['catch'](handleError(_0x2b8422,null));};exports[_0xc565('0x56')]=function(_0x247d4c,_0x3b3554,_0x1a4673){var _0x4a196c={'raw':!![],'where':{}},_0x596bea={},_0x46aa43;return db[_0xc565('0x30')][_0xc565('0x57')]({'where':{'id':_0x247d4c[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](handleEntityNotFound(_0x3b3554,null))['then'](function(_0xc8b4d9){if(_0xc8b4d9){_0x46aa43=_0xc8b4d9['get']({'plain':!![]});_0x596bea[_0xc565('0x37')]=_[_0xc565('0x4b')](db[_0xc565('0x58')][_0xc565('0x31')]);_0x596bea[_0xc565('0x38')]=_[_0xc565('0x4b')](_0x247d4c[_0xc565('0x38')]);_0x596bea[_0xc565('0x35')]=_['intersection'](_0x596bea[_0xc565('0x37')],_0x596bea[_0xc565('0x38')]);_0x4a196c[_0xc565('0x39')]=_['intersection'](_0x596bea[_0xc565('0x37')],qs['fields'](_0x247d4c[_0xc565('0x38')][_0xc565('0x3a')]));_0x4a196c[_0xc565('0x39')]=_0x4a196c[_0xc565('0x39')]['length']?_0x4a196c[_0xc565('0x39')]:_0x596bea[_0xc565('0x37')];if(!_0x247d4c[_0xc565('0x38')][_0xc565('0x3c')]('nolimit')){_0x4a196c[_0xc565('0x1e')]=qs[_0xc565('0x1e')](_0x247d4c['query']['limit']);_0x4a196c[_0xc565('0x1c')]=qs[_0xc565('0x1c')](_0x247d4c[_0xc565('0x38')][_0xc565('0x1c')]);}_0x4a196c[_0xc565('0x59')]=qs[_0xc565('0x3e')](_0x247d4c[_0xc565('0x38')][_0xc565('0x3e')]);_0x4a196c[_0xc565('0x40')]=qs[_0xc565('0x35')](_[_0xc565('0x3f')](_0x247d4c[_0xc565('0x38')],_0x596bea[_0xc565('0x35')]));_0x4a196c[_0xc565('0x40')][_0xc565('0x5a')]=_0xc8b4d9['id'];if(_0x247d4c['query'][_0xc565('0x43')]){_0x4a196c['where']=_['merge'](_0x4a196c[_0xc565('0x40')],{'$or':_[_0xc565('0x2f')](_0x4a196c[_0xc565('0x39')],function(_0x4235c7){var _0x56d9a4={};_0x56d9a4[_0x4235c7]={'$like':'%'+_0x247d4c[_0xc565('0x38')][_0xc565('0x43')]+'%'};return _0x56d9a4;})});}_0x4a196c=_[_0xc565('0x41')]({},_0x4a196c,_0x247d4c[_0xc565('0x4c')]);return db[_0xc565('0x58')][_0xc565('0x46')](_0x4a196c);}})[_0xc565('0x25')](function(_0x1efa49){if(_0x1efa49){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x1efa49,_0xc565('0x5b')),'role':'agent'},'attributes':['id',_0xc565('0x2c'),_0xc565('0x5c'),_0xc565('0x5d'),_0xc565('0x5e')]});}})[_0xc565('0x25')](function(_0x289273){if(_0x289273){return{'count':_0x289273[_0xc565('0x1f')],'rows':_[_0xc565('0x2f')](_0x289273['rows'],function(_0x5516ad){return{'membername':_0x5516ad[_0xc565('0x2c')],'UserId':_0x5516ad['id'],'queue_name':_0x46aa43[_0xc565('0x2c')],'OpenchannelQueueId':_0x46aa43['id'],'interface':util[_0xc565('0x5f')](_0xc565('0x60'),_0xc565('0x61'),_0x5516ad['name']),'penalty':0x0,'paused':_0x5516ad[_0xc565('0x5c')],'createdAt':_0x5516ad['createdAt'],'updatedAt':_0x5516ad['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc565('0x25')](respondWithFilteredResult(_0x3b3554,_0x4a196c))[_0xc565('0x48')](handleError(_0x3b3554,null));};exports[_0xc565('0x62')]=function(_0x38993b,_0x2c3bfe,_0x426acb){var _0x1abbf8={};var _0x483bea={};var _0x3d5414;var _0x2815ca;return db[_0xc565('0x30')][_0xc565('0x57')]({'where':{'id':_0x38993b[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](handleEntityNotFound(_0x2c3bfe,null))[_0xc565('0x25')](function(_0x4035e2){if(_0x4035e2){_0x3d5414=_0x4035e2;_0x483bea[_0xc565('0x37')]=_[_0xc565('0x4b')](db[_0xc565('0x63')][_0xc565('0x31')]);_0x483bea['query']=_['keys'](_0x38993b[_0xc565('0x38')]);_0x483bea[_0xc565('0x35')]=_[_0xc565('0x36')](_0x483bea[_0xc565('0x37')],_0x483bea[_0xc565('0x38')]);_0x1abbf8[_0xc565('0x39')]=_['intersection'](_0x483bea['model'],qs[_0xc565('0x3a')](_0x38993b[_0xc565('0x38')][_0xc565('0x3a')]));_0x1abbf8[_0xc565('0x39')]=_0x1abbf8[_0xc565('0x39')]['length']?_0x1abbf8[_0xc565('0x39')]:_0x483bea[_0xc565('0x37')];_0x1abbf8[_0xc565('0x59')]=qs[_0xc565('0x3e')](_0x38993b['query']['sort']);_0x1abbf8[_0xc565('0x40')]=qs['filters'](_['pick'](_0x38993b['query'],_0x483bea['filters']));if(_0x38993b[_0xc565('0x38')][_0xc565('0x43')]){_0x1abbf8[_0xc565('0x40')]=_['merge'](_0x1abbf8[_0xc565('0x40')],{'$or':_[_0xc565('0x2f')](_0x1abbf8[_0xc565('0x39')],function(_0x21242e){var _0x28dd47={};_0x28dd47[_0x21242e]={'$like':'%'+_0x38993b['query'][_0xc565('0x43')]+'%'};return _0x28dd47;})});}_0x1abbf8=_[_0xc565('0x41')]({},_0x1abbf8,_0x38993b[_0xc565('0x4c')]);return _0x3d5414['getTeams'](_0x1abbf8);}})['then'](function(_0x4bd153){if(_0x4bd153){_0x2815ca=_0x4bd153[_0xc565('0x3b')];if(!_0x38993b[_0xc565('0x38')][_0xc565('0x3c')](_0xc565('0x3d'))){_0x1abbf8['limit']=qs['limit'](_0x38993b['query'][_0xc565('0x1e')]);_0x1abbf8[_0xc565('0x1c')]=qs[_0xc565('0x1c')](_0x38993b['query']['offset']);}return _0x3d5414[_0xc565('0x62')](_0x1abbf8);}})[_0xc565('0x25')](function(_0x1818de){if(_0x1818de){return _0x1818de?{'count':_0x2815ca,'rows':_0x1818de}:null;}})[_0xc565('0x25')](respondWithResult(_0x2c3bfe,null))[_0xc565('0x48')](handleError(_0x2c3bfe,null));};exports[_0xc565('0x64')]=function(_0x175f42,_0x1ae658,_0x5679b6){var _0x40d522=_0x175f42[_0xc565('0x54')][_0xc565('0x65')];return db[_0xc565('0x63')][_0xc565('0x46')]({'where':{'id':_0x40d522},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc565('0x2c'),'online','voicePause',_0xc565('0x66')],'raw':!![]}]})[_0xc565('0x25')](function(_0x24598b){if(_0x24598b){var _0x117b7e=_[_0xc565('0x67')](_0x24598b,function(_0x54f6f4){var _0x1efff1=_0x54f6f4[_0xc565('0x27')]({'plain':!![]});return _0x1efff1[_0xc565('0x68')];});return db[_0xc565('0x30')][_0xc565('0x4d')]({'where':{'id':_0x175f42[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](function(_0x5b8132){return db[_0xc565('0x69')]['transaction'](function(_0x3d4128){return _0x5b8132[_0xc565('0x64')](_0x40d522,{'transaction':_0x3d4128})[_0xc565('0x25')](function(){return BPromise[_0xc565('0x6a')](_0x117b7e,function(_0x265902){return db[_0xc565('0x58')][_0xc565('0x6b')]({'where':{'UserId':_0x265902['id'],'OpenchannelQueueId':_0x175f42[_0xc565('0x4a')]['id']},'transaction':_0x3d4128});});})[_0xc565('0x25')](function(){_0x117b7e['forEach'](function(_0xfcdb6){socket[_0xc565('0x6c')](_0xc565('0x6d'),{'UserId':_0xfcdb6['id'],'OpenchannelQueueId':_0x5b8132['id']});});});});});}})[_0xc565('0x25')](respondWithStatusCode(_0x1ae658,null))[_0xc565('0x48')](handleError(_0x1ae658,null));};exports[_0xc565('0x6e')]=function(_0x4cf351,_0x3f5fa5,_0x14c485){return db[_0xc565('0x63')]['findAll']({'where':{'id':_0x4cf351[_0xc565('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc565('0x68'),'attributes':['id'],'raw':!![]}]})[_0xc565('0x25')](handleEntityNotFound(_0x3f5fa5,null))[_0xc565('0x25')](function(_0x441fdf){var _0x19b7f6=_[_0xc565('0x2f')](_0x441fdf,'id');var _0x287e4f=[];var _0xfd1efb=[];var _0x52a96f=squel[_0xc565('0x6f')]();_0x52a96f[_0xc565('0x70')](_0xc565('0x71'))[_0xc565('0x72')](_0xc565('0x73'),'tq')[_0xc565('0x74')](_0xc565('0x75'),'ut',_0xc565('0x76'))[_0xc565('0x40')](_0xc565('0x77'),_0x4cf351['params']['id']);for(var _0x135b4f=0x0;_0x135b4f<_0x441fdf['length'];_0x135b4f+=0x1){let _0x2f76e8=_0x441fdf[_0x135b4f];for(var _0x21bcf9=0x0;_0x21bcf9<_0x2f76e8[_0xc565('0x68')]['length'];_0x21bcf9+=0x1){let _0x5e6213=_0x2f76e8[_0xc565('0x68')][_0x21bcf9];var _0x2463c6=_0x52a96f['clone']();_0x2463c6[_0xc565('0x40')](_0xc565('0x78'),_0x5e6213['id']);_0xfd1efb['push'](db[_0xc565('0x69')][_0xc565('0x38')](_0x2463c6['toString'](),{'type':db[_0xc565('0x69')]['QueryTypes'][_0xc565('0x79')]})[_0xc565('0x25')](function(_0xcda5d4){if(_0xcda5d4[_0xc565('0x3b')]===0x1){return _0x5e6213['id'];}else{var _0x532f23=_[_0xc565('0x7a')](_[_0xc565('0x2f')](_0xcda5d4,_0xc565('0x7b')),function(_0x131f45){return _[_0xc565('0x7c')](_0x19b7f6,_0x131f45);});if(_0x532f23){return _0x5e6213['id'];}}}));}}return BPromise['all'](_0xfd1efb)[_0xc565('0x25')](function(_0x4c352e){_0x287e4f=_(_0x287e4f)[_0xc565('0x7d')](_0x4c352e)['compact']()[_0xc565('0x7e')]();return db[_0xc565('0x30')][_0xc565('0x4d')]({'where':{'id':_0x4cf351[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](function(_0x17c2f5){return db['sequelize'][_0xc565('0x7f')](function(_0xace5c7){return _0x17c2f5['removeTeams'](_0x4cf351[_0xc565('0x38')][_0xc565('0x65')],{'transaction':_0xace5c7})[_0xc565('0x25')](function(){if(!_[_0xc565('0x80')](_0x287e4f)){return _0x17c2f5['removeAgents'](_0x287e4f,{'transaction':_0xace5c7});}})[_0xc565('0x25')](function(){_0x287e4f[_0xc565('0x81')](function(_0x3fb714){socket[_0xc565('0x6c')](_0xc565('0x82'),{'UserId':_0x3fb714,'OpenchannelQueueId':_0x17c2f5['id']});});});});});});})['then'](respondWithStatusCode(_0x3f5fa5,null))[_0xc565('0x48')](handleError(_0x3f5fa5,null));};exports[_0xc565('0x83')]=function(_0x120fc2,_0x5bd5c2,_0x5f4cf9){return db[_0xc565('0x30')]['find']({'where':{'id':_0x120fc2[_0xc565('0x4a')]['id']}})[_0xc565('0x25')](handleEntityNotFound(_0x5bd5c2,null))[_0xc565('0x25')](function(_0x5c7f03){if(_0x5c7f03){return _0x5c7f03[_0xc565('0x83')](_0x120fc2[_0xc565('0x54')][_0xc565('0x65')],_[_0xc565('0x84')](_0x120fc2[_0xc565('0x54')],[_0xc565('0x65'),'id'])||{})[_0xc565('0x85')](function(_0x1de0a0){for(var _0x4434b2=0x0;_0x4434b2<_0x120fc2[_0xc565('0x54')][_0xc565('0x65')][_0xc565('0x3b')];_0x4434b2+=0x1){socket[_0xc565('0x6c')](_0xc565('0x6d'),{'UserId':Number(_0x120fc2['body'][_0xc565('0x65')][_0x4434b2]),'OpenchannelQueueId':Number(_0x120fc2[_0xc565('0x4a')]['id'])});}return _0x1de0a0;});}})[_0xc565('0x25')](respondWithResult(_0x5bd5c2,null))[_0xc565('0x48')](handleError(_0x5bd5c2,null));};exports['removeAgents']=function(_0x272c94,_0x463909,_0x2967bb){return db['OpenchannelQueue'][_0xc565('0x4d')]({'where':{'id':_0x272c94[_0xc565('0x4a')]['id']}})['then'](handleEntityNotFound(_0x463909,null))[_0xc565('0x25')](function(_0x448f1c){if(_0x448f1c){return _0x448f1c[_0xc565('0x86')](_0x272c94[_0xc565('0x38')][_0xc565('0x65')])[_0xc565('0x25')](function(){if(_[_0xc565('0x87')](_0x272c94['query']['ids'])){for(var _0x443407=0x0;_0x443407<_0x272c94['query'][_0xc565('0x65')][_0xc565('0x3b')];_0x443407+=0x1){socket[_0xc565('0x6c')](_0xc565('0x82'),{'UserId':Number(_0x272c94['query'][_0xc565('0x65')][_0x443407]),'OpenchannelQueueId':Number(_0x272c94[_0xc565('0x4a')]['id'])});}}else{socket[_0xc565('0x6c')](_0xc565('0x82'),{'UserId':Number(_0x272c94[_0xc565('0x38')][_0xc565('0x65')]),'OpenchannelQueueId':Number(_0x272c94['params']['id'])});}});}})[_0xc565('0x25')](respondWithStatusCode(_0x463909,null))['catch'](handleError(_0x463909,null));};exports[_0xc565('0x88')]=function(_0x40469b,_0x1aa2c3,_0xbf6518){var _0x4d5ac5={};var _0x1915c7={};var _0x342eb7;var _0x3b5bd1;return db[_0xc565('0x30')][_0xc565('0x57')]({'where':{'id':_0x40469b[_0xc565('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1aa2c3,null))[_0xc565('0x25')](function(_0x41c6bb){if(_0x41c6bb){_0x342eb7=_0x41c6bb;_0x1915c7['model']=_[_0xc565('0x4b')](db['User'][_0xc565('0x31')]);_0x1915c7[_0xc565('0x38')]=_[_0xc565('0x4b')](_0x40469b[_0xc565('0x38')]);_0x1915c7[_0xc565('0x35')]=_[_0xc565('0x36')](_0x1915c7['model'],_0x1915c7[_0xc565('0x38')]);_0x4d5ac5[_0xc565('0x39')]=_[_0xc565('0x36')](_0x1915c7[_0xc565('0x37')],qs[_0xc565('0x3a')](_0x40469b[_0xc565('0x38')][_0xc565('0x3a')]));_0x4d5ac5[_0xc565('0x39')]=_0x4d5ac5[_0xc565('0x39')][_0xc565('0x3b')]?_0x4d5ac5[_0xc565('0x39')]:_0x1915c7[_0xc565('0x37')];_0x4d5ac5['order']=qs[_0xc565('0x3e')](_0x40469b[_0xc565('0x38')][_0xc565('0x3e')]);_0x4d5ac5[_0xc565('0x40')]=qs[_0xc565('0x35')](_['pick'](_0x40469b[_0xc565('0x38')],_0x1915c7['filters']));if(_0x40469b['query'][_0xc565('0x43')]){_0x4d5ac5[_0xc565('0x40')]=_[_0xc565('0x41')](_0x4d5ac5[_0xc565('0x40')],{'$or':_['map'](_0x4d5ac5[_0xc565('0x39')],function(_0x216279){var _0x41b1d1={};_0x41b1d1[_0x216279]={'$like':'%'+_0x40469b[_0xc565('0x38')][_0xc565('0x43')]+'%'};return _0x41b1d1;})});}_0x4d5ac5=_[_0xc565('0x41')]({},_0x4d5ac5,_0x40469b[_0xc565('0x4c')]);return _0x342eb7[_0xc565('0x88')](_0x4d5ac5);}})['then'](function(_0x5eddc2){if(_0x5eddc2){_0x3b5bd1=_0x5eddc2[_0xc565('0x3b')];if(!_0x40469b[_0xc565('0x38')][_0xc565('0x3c')](_0xc565('0x3d'))){_0x4d5ac5[_0xc565('0x1e')]=qs['limit'](_0x40469b[_0xc565('0x38')]['limit']);_0x4d5ac5[_0xc565('0x1c')]=qs['offset'](_0x40469b[_0xc565('0x38')]['offset']);}return _0x342eb7[_0xc565('0x88')](_0x4d5ac5);}})[_0xc565('0x25')](function(_0x287a61){if(_0x287a61){return _0x287a61?{'count':_0x3b5bd1,'rows':_0x287a61}:null;}})[_0xc565('0x25')](respondWithResult(_0x1aa2c3,null))[_0xc565('0x48')](handleError(_0x1aa2c3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9eea68d..2215629 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 _0x01b7=['emit','hasOwnProperty','hook','events','OpenchannelQueue','setMaxListeners','update','remove'];(function(_0x4a9f9c,_0x332158){var _0x1ac3c4=function(_0x12e877){while(--_0x12e877){_0x4a9f9c['push'](_0x4a9f9c['shift']());}};_0x1ac3c4(++_0x332158);}(_0x01b7,0x1db));var _0x701b=function(_0x4e10c7,_0x3afd99){_0x4e10c7=_0x4e10c7-0x0;var _0x279007=_0x01b7[_0x4e10c7];return _0x279007;};'use strict';var EventEmitter=require(_0x701b('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x701b('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x701b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x701b('0x3'),'afterDestroy':_0x701b('0x4')};function emitEvent(_0x3027a4){return function(_0x183dda,_0x463220,_0x165afe){OpenchannelQueueEvents['emit'](_0x3027a4+':'+_0x183dda['id'],_0x183dda);OpenchannelQueueEvents[_0x701b('0x5')](_0x3027a4,_0x183dda);_0x165afe(null);};}for(var e in events){if(events[_0x701b('0x6')](e)){var event=events[e];OpenchannelQueue[_0x701b('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x5bd3=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x8929a1,_0x25516b){var _0x5102cc=function(_0x2d128e){while(--_0x2d128e){_0x8929a1['push'](_0x8929a1['shift']());}};_0x5102cc(++_0x25516b);}(_0x5bd3,0x92));var _0x35bd=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x5bd3[_0x39e283];return _0x7de89f;};'use strict';var EventEmitter=require(_0x35bd('0x0'));var OpenchannelQueue=require(_0x35bd('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x35bd('0x2')](0x0);var events={'afterCreate':_0x35bd('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x104aea){return function(_0x1b036c,_0x4e3ae4,_0x28e001){OpenchannelQueueEvents['emit'](_0x104aea+':'+_0x1b036c['id'],_0x1b036c);OpenchannelQueueEvents[_0x35bd('0x4')](_0x104aea,_0x1b036c);_0x28e001(null);};}for(var e in events){if(events[_0x35bd('0x5')](e)){var event=events[e];OpenchannelQueue[_0x35bd('0x6')](e,emitEvent(event));}}module[_0x35bd('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0f16381..f0eb189 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 _0x474d=['rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2a248a,_0x1b6c91){var _0x1ec090=function(_0x20182a){while(--_0x20182a){_0x2a248a['push'](_0x2a248a['shift']());}};_0x1ec090(++_0x1b6c91);}(_0x474d,0x13d));var _0xd474=function(_0x2f65a6,_0x5f52f3){_0x2f65a6=_0x2f65a6-0x0;var _0x451f83=_0x474d[_0x2f65a6];return _0x451f83;};'use strict';var _=require(_0xd474('0x0'));var util=require(_0xd474('0x1'));var logger=require(_0xd474('0x2'))('api');var moment=require(_0xd474('0x3'));var BPromise=require(_0xd474('0x4'));var rp=require(_0xd474('0x5'));var fs=require('fs');var path=require(_0xd474('0x6'));var rimraf=require(_0xd474('0x7'));var config=require(_0xd474('0x8'));var attributes=require(_0xd474('0x9'));module['exports']=function(_0x291a56,_0x2875b1){return _0x291a56[_0xd474('0xa')](_0xd474('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbac9=['bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','api','moment'];(function(_0x345712,_0x4b2ed8){var _0xe091c0=function(_0x1654d7){while(--_0x1654d7){_0x345712['push'](_0x345712['shift']());}};_0xe091c0(++_0x4b2ed8);}(_0xbac9,0xda));var _0x9bac=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xbac9[_0x214266];return _0x568f75;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9bac('0x0'));var moment=require(_0x9bac('0x1'));var BPromise=require(_0x9bac('0x2'));var rp=require(_0x9bac('0x3'));var fs=require('fs');var path=require(_0x9bac('0x4'));var rimraf=require('rimraf');var config=require(_0x9bac('0x5'));var attributes=require(_0x9bac('0x6'));module['exports']=function(_0x4e59b9,_0x3ea804){return _0x4e59b9[_0x9bac('0x7')](_0x9bac('0x8'),attributes,{'tableName':_0x9bac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 2d60122..874b922 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 _0x5443=['map','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetOpenchannelQueue','options','raw','where','limit','include','model','attributes'];(function(_0x3a814f,_0x553e5b){var _0x150de1=function(_0x162bed){while(--_0x162bed){_0x3a814f['push'](_0x3a814f['shift']());}};_0x150de1(++_0x553e5b);}(_0x5443,0x1cc));var _0x3544=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5443[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x3544('0x0'));var util=require(_0x3544('0x1'));var moment=require(_0x3544('0x2'));var BPromise=require(_0x3544('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3544('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3544('0x5'))('rpc');var config=require(_0x3544('0x6'));var jayson=require(_0x3544('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x3544('0x8')]=_[_0x3544('0x9')](config['redis'],{'host':_0x3544('0xa'),'port':0x18eb});var socket=require(_0x3544('0xb'))(new Redis(config['redis']));require(_0x3544('0xc'))[_0x3544('0xd')](socket);function respondWithRpcPromise(_0x14f1b6,_0x5388b8,_0xec25a2){return new BPromise(function(_0x124264,_0x2e12e5){return client[_0x3544('0xe')](_0x14f1b6,_0xec25a2)[_0x3544('0xf')](function(_0xb02049){logger[_0x3544('0x10')](_0x3544('0x11'),_0x5388b8,_0x3544('0x12'));logger[_0x3544('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5388b8,'request\x20sent',JSON[_0x3544('0x14')](_0xb02049));if(_0xb02049[_0x3544('0x15')]){if(_0xb02049[_0x3544('0x15')][_0x3544('0x16')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5388b8,_0xb02049[_0x3544('0x15')][_0x3544('0x17')]);return _0x2e12e5(_0xb02049[_0x3544('0x15')]['message']);}logger[_0x3544('0x15')](_0x3544('0x11'),_0x5388b8,_0xb02049[_0x3544('0x15')][_0x3544('0x17')]);return _0x124264(_0xb02049[_0x3544('0x15')][_0x3544('0x17')]);}else{logger[_0x3544('0x10')](_0x3544('0x11'),_0x5388b8,_0x3544('0x12'));_0x124264(_0xb02049[_0x3544('0x18')][_0x3544('0x17')]);}})[_0x3544('0x19')](function(_0xe5bf64){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5388b8,_0xe5bf64);_0x2e12e5(_0xe5bf64);});});}exports[_0x3544('0x1a')]=function(_0x149c2c){var _0x4bcd34=this;return new Promise(function(_0x28a47d,_0x187fd0){return db['OpenchannelQueue']['findAll']({'raw':_0x149c2c[_0x3544('0x1b')]?_0x149c2c[_0x3544('0x1b')][_0x3544('0x1c')]===undefined?!![]:![]:!![],'where':_0x149c2c['options']?_0x149c2c[_0x3544('0x1b')][_0x3544('0x1d')]||null:null,'attributes':_0x149c2c[_0x3544('0x1b')]?_0x149c2c[_0x3544('0x1b')]['attributes']||null:null,'limit':_0x149c2c[_0x3544('0x1b')]?_0x149c2c[_0x3544('0x1b')][_0x3544('0x1e')]||null:null,'include':_0x149c2c[_0x3544('0x1b')]?_0x149c2c[_0x3544('0x1b')]['include']?_['map'](_0x149c2c['options'][_0x3544('0x1f')],function(_0x4b8ecf){return{'model':db[_0x4b8ecf[_0x3544('0x20')]],'as':_0x4b8ecf['as'],'attributes':_0x4b8ecf[_0x3544('0x21')],'include':_0x4b8ecf['include']?_['map'](_0x4b8ecf[_0x3544('0x1f')],function(_0x616b71){return{'model':db[_0x616b71['model']],'as':_0x616b71['as'],'attributes':_0x616b71[_0x3544('0x21')],'include':_0x616b71[_0x3544('0x1f')]?_[_0x3544('0x22')](_0x616b71['include'],function(_0x3e7c1c){return{'model':db[_0x3e7c1c[_0x3544('0x20')]],'as':_0x3e7c1c['as'],'attributes':_0x3e7c1c[_0x3544('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3544('0xf')](function(_0x82e45b){logger[_0x3544('0x10')](_0x3544('0x1a'),_0x149c2c);logger[_0x3544('0x13')](_0x3544('0x1a'),_0x149c2c,JSON[_0x3544('0x14')](_0x82e45b));_0x28a47d(_0x82e45b);})[_0x3544('0x19')](function(_0x356381){logger[_0x3544('0x15')](_0x3544('0x1a'),_0x356381[_0x3544('0x17')],_0x149c2c);_0x187fd0(_0x4bcd34[_0x3544('0x15')](0x1f4,_0x356381[_0x3544('0x17')]));});});};exports[_0x3544('0x23')]=function(_0x4be876){var _0x4fa4ea=this;return new Promise(function(_0x4bac28,_0x58b968){return db[_0x3544('0x24')][_0x3544('0x25')]({'raw':_0x4be876[_0x3544('0x1b')]?_0x4be876[_0x3544('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4be876[_0x3544('0x1b')]?_0x4be876[_0x3544('0x1b')][_0x3544('0x1d')]||null:null,'attributes':_0x4be876[_0x3544('0x1b')]?_0x4be876['options'][_0x3544('0x21')]||null:null,'include':_0x4be876[_0x3544('0x1b')]?_0x4be876[_0x3544('0x1b')]['include']?_[_0x3544('0x22')](_0x4be876[_0x3544('0x1b')][_0x3544('0x1f')],function(_0x30f1b6){return{'model':db[_0x30f1b6['model']],'as':_0x30f1b6['as'],'attributes':_0x30f1b6[_0x3544('0x21')],'include':_0x30f1b6[_0x3544('0x1f')]?_[_0x3544('0x22')](_0x30f1b6[_0x3544('0x1f')],function(_0xe25f2){return{'model':db[_0xe25f2['model']],'as':_0xe25f2['as'],'attributes':_0xe25f2[_0x3544('0x21')],'include':_0xe25f2[_0x3544('0x1f')]?_[_0x3544('0x22')](_0xe25f2[_0x3544('0x1f')],function(_0x25c89d){return{'model':db[_0x25c89d[_0x3544('0x20')]],'as':_0x25c89d['as'],'attributes':_0x25c89d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ae85f){logger['info']('ShowOpenchannelQueue',_0x4be876);logger[_0x3544('0x13')](_0x3544('0x23'),_0x4be876,JSON[_0x3544('0x14')](_0x1ae85f));_0x4bac28(_0x1ae85f);})[_0x3544('0x19')](function(_0x5e9f0a){logger[_0x3544('0x15')](_0x3544('0x23'),_0x5e9f0a[_0x3544('0x17')],_0x4be876);_0x58b968(_0x4fa4ea['error'](0x1f4,_0x5e9f0a[_0x3544('0x17')]));});});}; \ No newline at end of file +var _0xa37f=['ShowOpenchannelQueue','where','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','include','model','map'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xa37f,0x1a4));var _0xfa37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa37f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfa37('0x0'));var util=require('util');var moment=require(_0xfa37('0x1'));var BPromise=require(_0xfa37('0x2'));var rs=require(_0xfa37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfa37('0x4'));var logger=require(_0xfa37('0x5'))(_0xfa37('0x6'));var config=require(_0xfa37('0x7'));var jayson=require(_0xfa37('0x8'));var client=jayson[_0xfa37('0x9')][_0xfa37('0xa')]({'port':0x232a});config[_0xfa37('0xb')]=_[_0xfa37('0xc')](config['redis'],{'host':_0xfa37('0xd'),'port':0x18eb});var socket=require(_0xfa37('0xe'))(new Redis(config[_0xfa37('0xb')]));require('./openchannelQueue.socket')[_0xfa37('0xf')](socket);function respondWithRpcPromise(_0x1c4cea,_0x50d6ce,_0x4be248){return new BPromise(function(_0x407e31,_0x46c000){return client[_0xfa37('0x10')](_0x1c4cea,_0x4be248)[_0xfa37('0x11')](function(_0x53bcd5){logger[_0xfa37('0x12')](_0xfa37('0x13'),_0x50d6ce,_0xfa37('0x14'));logger[_0xfa37('0x15')](_0xfa37('0x16'),_0x50d6ce,_0xfa37('0x14'),JSON[_0xfa37('0x17')](_0x53bcd5));if(_0x53bcd5[_0xfa37('0x18')]){if(_0x53bcd5[_0xfa37('0x18')][_0xfa37('0x19')]===0x1f4){logger[_0xfa37('0x18')](_0xfa37('0x13'),_0x50d6ce,_0x53bcd5[_0xfa37('0x18')][_0xfa37('0x1a')]);return _0x46c000(_0x53bcd5[_0xfa37('0x18')][_0xfa37('0x1a')]);}logger[_0xfa37('0x18')](_0xfa37('0x13'),_0x50d6ce,_0x53bcd5[_0xfa37('0x18')][_0xfa37('0x1a')]);return _0x407e31(_0x53bcd5['error'][_0xfa37('0x1a')]);}else{logger[_0xfa37('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x50d6ce,_0xfa37('0x14'));_0x407e31(_0x53bcd5['result'][_0xfa37('0x1a')]);}})[_0xfa37('0x1b')](function(_0x2ad14c){logger[_0xfa37('0x18')](_0xfa37('0x13'),_0x50d6ce,_0x2ad14c);_0x46c000(_0x2ad14c);});});}exports[_0xfa37('0x1c')]=function(_0x20d575){var _0x39b816=this;return new Promise(function(_0x275938,_0x52ec01){return db[_0xfa37('0x1d')]['findAll']({'raw':_0x20d575[_0xfa37('0x1e')]?_0x20d575[_0xfa37('0x1e')][_0xfa37('0x1f')]===undefined?!![]:![]:!![],'where':_0x20d575['options']?_0x20d575[_0xfa37('0x1e')]['where']||null:null,'attributes':_0x20d575[_0xfa37('0x1e')]?_0x20d575[_0xfa37('0x1e')][_0xfa37('0x20')]||null:null,'limit':_0x20d575[_0xfa37('0x1e')]?_0x20d575['options']['limit']||null:null,'include':_0x20d575[_0xfa37('0x1e')]?_0x20d575[_0xfa37('0x1e')][_0xfa37('0x21')]?_['map'](_0x20d575[_0xfa37('0x1e')][_0xfa37('0x21')],function(_0x55543e){return{'model':db[_0x55543e[_0xfa37('0x22')]],'as':_0x55543e['as'],'attributes':_0x55543e['attributes'],'include':_0x55543e[_0xfa37('0x21')]?_[_0xfa37('0x23')](_0x55543e[_0xfa37('0x21')],function(_0x5b9117){return{'model':db[_0x5b9117[_0xfa37('0x22')]],'as':_0x5b9117['as'],'attributes':_0x5b9117[_0xfa37('0x20')],'include':_0x5b9117[_0xfa37('0x21')]?_[_0xfa37('0x23')](_0x5b9117['include'],function(_0x546146){return{'model':db[_0x546146[_0xfa37('0x22')]],'as':_0x546146['as'],'attributes':_0x546146[_0xfa37('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfa37('0x11')](function(_0x21b193){logger['info'](_0xfa37('0x1c'),_0x20d575);logger[_0xfa37('0x15')](_0xfa37('0x1c'),_0x20d575,JSON[_0xfa37('0x17')](_0x21b193));_0x275938(_0x21b193);})[_0xfa37('0x1b')](function(_0x4b312a){logger[_0xfa37('0x18')]('GetOpenchannelQueue',_0x4b312a[_0xfa37('0x1a')],_0x20d575);_0x52ec01(_0x39b816['error'](0x1f4,_0x4b312a[_0xfa37('0x1a')]));});});};exports[_0xfa37('0x24')]=function(_0x4a7954){var _0x18a50a=this;return new Promise(function(_0x213cfa,_0x527e6d){return db[_0xfa37('0x1d')]['find']({'raw':_0x4a7954['options']?_0x4a7954['options'][_0xfa37('0x1f')]===undefined?!![]:![]:!![],'where':_0x4a7954['options']?_0x4a7954[_0xfa37('0x1e')][_0xfa37('0x25')]||null:null,'attributes':_0x4a7954[_0xfa37('0x1e')]?_0x4a7954[_0xfa37('0x1e')][_0xfa37('0x20')]||null:null,'include':_0x4a7954[_0xfa37('0x1e')]?_0x4a7954[_0xfa37('0x1e')][_0xfa37('0x21')]?_[_0xfa37('0x23')](_0x4a7954['options'][_0xfa37('0x21')],function(_0x5a4466){return{'model':db[_0x5a4466[_0xfa37('0x22')]],'as':_0x5a4466['as'],'attributes':_0x5a4466['attributes'],'include':_0x5a4466[_0xfa37('0x21')]?_[_0xfa37('0x23')](_0x5a4466[_0xfa37('0x21')],function(_0x28b089){return{'model':db[_0x28b089[_0xfa37('0x22')]],'as':_0x28b089['as'],'attributes':_0x28b089[_0xfa37('0x20')],'include':_0x28b089[_0xfa37('0x21')]?_[_0xfa37('0x23')](_0x28b089[_0xfa37('0x21')],function(_0x1f624d){return{'model':db[_0x1f624d[_0xfa37('0x22')]],'as':_0x1f624d['as'],'attributes':_0x1f624d[_0xfa37('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfa37('0x11')](function(_0x3c01cd){logger['info'](_0xfa37('0x24'),_0x4a7954);logger[_0xfa37('0x15')](_0xfa37('0x24'),_0x4a7954,JSON['stringify'](_0x3c01cd));_0x213cfa(_0x3c01cd);})[_0xfa37('0x1b')](function(_0x3bbc1a){logger[_0xfa37('0x18')](_0xfa37('0x24'),_0x3bbc1a[_0xfa37('0x1a')],_0x4a7954);_0x527e6d(_0x18a50a[_0xfa37('0x18')](0x1f4,_0x3bbc1a[_0xfa37('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6a49882..f1be5d4 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 _0x37be=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x37be,0x191));var _0xe37b=function(_0x6bdeed,_0x3a0d69){_0x6bdeed=_0x6bdeed-0x0;var _0x139cf0=_0x37be[_0x6bdeed];return _0x139cf0;};'use strict';var OpenchannelQueueEvents=require(_0xe37b('0x0'));var events=[_0xe37b('0x1'),'remove',_0xe37b('0x2')];function createListener(_0x3af222,_0x598fa2){return function(_0x519064){_0x598fa2[_0xe37b('0x3')](_0x3af222,_0x519064);};}function removeListener(_0x1086c5,_0x16bd58){return function(){OpenchannelQueueEvents[_0xe37b('0x4')](_0x1086c5,_0x16bd58);};}exports['register']=function(_0x531acb){for(var _0xf6134d=0x0,_0x47dcde=events[_0xe37b('0x5')];_0xf6134d<_0x47dcde;_0xf6134d++){var _0x4a7f50=events[_0xf6134d];var _0x28ccb9=createListener(_0xe37b('0x6')+_0x4a7f50,_0x531acb);OpenchannelQueueEvents['on'](_0x4a7f50,_0x28ccb9);}}; \ No newline at end of file +var _0xe2db=['./openchannelQueue.events','removeListener','register','length','openchannelQueue:'];(function(_0x1e11dc,_0x45d5c4){var _0x2b2a25=function(_0x293c13){while(--_0x293c13){_0x1e11dc['push'](_0x1e11dc['shift']());}};_0x2b2a25(++_0x45d5c4);}(_0xe2db,0x8c));var _0xbe2d=function(_0x3ccf44,_0x226760){_0x3ccf44=_0x3ccf44-0x0;var _0x4d865c=_0xe2db[_0x3ccf44];return _0x4d865c;};'use strict';var OpenchannelQueueEvents=require(_0xbe2d('0x0'));var events=['save','remove','update'];function createListener(_0x227bf7,_0x289263){return function(_0x3e67fa){_0x289263['emit'](_0x227bf7,_0x3e67fa);};}function removeListener(_0x473775,_0xcfc45d){return function(){OpenchannelQueueEvents[_0xbe2d('0x1')](_0x473775,_0xcfc45d);};}exports[_0xbe2d('0x2')]=function(_0x2592c3){for(var _0x1a0c92=0x0,_0x332603=events[_0xbe2d('0x3')];_0x1a0c92<_0x332603;_0x1a0c92++){var _0x4fbcb3=events[_0x1a0c92];var _0x168d1e=createListener(_0xbe2d('0x4')+_0x4fbcb3,_0x2592c3);OpenchannelQueueEvents['on'](_0x4fbcb3,_0x168d1e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index cf0e93a..ad4af16 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 _0xb808=['show','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0xb808,0xa7));var _0x8b80=function(_0x58920a,_0x4881d2){_0x58920a=_0x58920a-0x0;var _0x174659=_0xb808[_0x58920a];return _0x174659;};'use strict';var multer=require(_0x8b80('0x0'));var util=require(_0x8b80('0x1'));var path=require('path');var timeout=require(_0x8b80('0x2'));var express=require(_0x8b80('0x3'));var router=express[_0x8b80('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8b80('0x5'));var config=require('../../config/environment');var controller=require(_0x8b80('0x6'));router[_0x8b80('0x7')]('/',auth[_0x8b80('0x8')](),controller[_0x8b80('0x9')]);router[_0x8b80('0x7')](_0x8b80('0xa'),auth[_0x8b80('0x8')](),controller[_0x8b80('0xb')]);router[_0x8b80('0x7')](_0x8b80('0xc'),auth[_0x8b80('0x8')](),controller[_0x8b80('0xd')]);router['post']('/',auth[_0x8b80('0x8')](),controller[_0x8b80('0xe')]);router['put']('/:id',auth[_0x8b80('0x8')](),controller[_0x8b80('0xf')]);router[_0x8b80('0x10')](_0x8b80('0xc'),auth[_0x8b80('0x8')](),controller['destroy']);module[_0x8b80('0x11')]=router; \ No newline at end of file +var _0x637d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x58b984,_0x3fcd97){var _0x513827=function(_0x1a2e2c){while(--_0x1a2e2c){_0x58b984['push'](_0x58b984['shift']());}};_0x513827(++_0x3fcd97);}(_0x637d,0x194));var _0xd637=function(_0xee93ec,_0x299d68){_0xee93ec=_0xee93ec-0x0;var _0x2e18e9=_0x637d[_0xee93ec];return _0x2e18e9;};'use strict';var multer=require(_0xd637('0x0'));var util=require(_0xd637('0x1'));var path=require('path');var timeout=require(_0xd637('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd637('0x3'));var auth=require(_0xd637('0x4'));var interaction=require(_0xd637('0x5'));var config=require(_0xd637('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xd637('0x7')]('/',auth['isAuthenticated'](),controller[_0xd637('0x8')]);router['get'](_0xd637('0x9'),auth[_0xd637('0xa')](),controller[_0xd637('0xb')]);router[_0xd637('0x7')](_0xd637('0xc'),auth[_0xd637('0xa')](),controller[_0xd637('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd637('0xe')]);router[_0xd637('0xf')](_0xd637('0xc'),auth[_0xd637('0xa')](),controller['update']);router['delete'](_0xd637('0xc'),auth[_0xd637('0xa')](),controller[_0xd637('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index a995cfa..93b1f88 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 _0x3d3c=['STRING','DATE','moment','sequelize','exports'];(function(_0x412937,_0xdbe7e9){var _0x20772e=function(_0x501dc0){while(--_0x501dc0){_0x412937['push'](_0x412937['shift']());}};_0x20772e(++_0xdbe7e9);}(_0x3d3c,0x98));var _0xc3d3=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x3d3c[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0xc3d3('0x0'));var Sequelize=require(_0xc3d3('0x1'));module[_0xc3d3('0x2')]={'uniqueid':{'type':Sequelize[_0xc3d3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc3d3('0x3')]},'joinAt':{'type':Sequelize[_0xc3d3('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc3d3('0x3')]}}; \ No newline at end of file +var _0x6c50=['STRING','DATE','moment','exports'];(function(_0x4f3bef,_0xa2f6c3){var _0x16e0be=function(_0x4ce688){while(--_0x4ce688){_0x4f3bef['push'](_0x4f3bef['shift']());}};_0x16e0be(++_0xa2f6c3);}(_0x6c50,0xe2));var _0x06c5=function(_0x2b8c3a,_0x14b7ef){_0x2b8c3a=_0x2b8c3a-0x0;var _0x222402=_0x6c50[_0x2b8c3a];return _0x222402;};'use strict';var moment=require(_0x06c5('0x0'));var Sequelize=require('sequelize');module[_0x06c5('0x1')]={'uniqueid':{'type':Sequelize[_0x06c5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x06c5('0x2')]},'joinAt':{'type':Sequelize[_0x06c5('0x3')]},'leaveAt':{'type':Sequelize[_0x06c5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x06c5('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ec9ac31..857faab 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 _0xf9ec=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x45d679,_0x141a1d){var _0x34b6d2=function(_0x2ff61b){while(--_0x2ff61b){_0x45d679['push'](_0x45d679['shift']());}};_0x34b6d2(++_0x141a1d);}(_0xf9ec,0xc5));var _0xcf9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9ec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf9e('0x0'));var zipdir=require(_0xcf9e('0x1'));var jsonpatch=require(_0xcf9e('0x2'));var rp=require(_0xcf9e('0x3'));var moment=require(_0xcf9e('0x4'));var BPromise=require(_0xcf9e('0x5'));var Mustache=require(_0xcf9e('0x6'));var util=require(_0xcf9e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcf9e('0x8'));var ejs=require(_0xcf9e('0x9'));var fs=require('fs');var fs_extra=require(_0xcf9e('0xa'));var _=require('lodash');var squel=require(_0xcf9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf9e('0xc'));var toCsv=require(_0xcf9e('0x8'));var querystring=require(_0xcf9e('0xd'));var Papa=require(_0xcf9e('0xe'));var Redis=require('ioredis');var authService=require(_0xcf9e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcf9e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf9e('0x11'))(_0xcf9e('0x12'));var utils=require('../../config/utils');var config=require(_0xcf9e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf9e('0x14'))['db'];function respondWithStatusCode(_0x10a237,_0x354f64){_0x354f64=_0x354f64||0xcc;return function(_0x5d1544){if(_0x5d1544){return _0x10a237[_0xcf9e('0x15')](_0x354f64);}return _0x10a237[_0xcf9e('0x16')](_0x354f64)[_0xcf9e('0x17')]();};}function respondWithResult(_0x19a893,_0x3f24c1){_0x3f24c1=_0x3f24c1||0xc8;return function(_0x28c534){if(_0x28c534){return _0x19a893[_0xcf9e('0x16')](_0x3f24c1)[_0xcf9e('0x18')](_0x28c534);}};}function respondWithFilteredResult(_0x288a03,_0x2f5ff7){return function(_0x31ddc0){if(_0x31ddc0){var _0x41b6c9=typeof _0x2f5ff7[_0xcf9e('0x19')]===_0xcf9e('0x1a')&&typeof _0x2f5ff7[_0xcf9e('0x1b')]===_0xcf9e('0x1a');var _0x12a687=_0x31ddc0[_0xcf9e('0x1c')];var _0x1b1839=_0x41b6c9?0x0:_0x2f5ff7[_0xcf9e('0x19')];var _0x182a00=_0x41b6c9?_0x31ddc0[_0xcf9e('0x1c')]:_0x2f5ff7[_0xcf9e('0x19')]+_0x2f5ff7[_0xcf9e('0x1b')];var _0x460603;if(_0x182a00>=_0x12a687){_0x182a00=_0x12a687;_0x460603=0xc8;}else{_0x460603=0xce;}_0x288a03[_0xcf9e('0x16')](_0x460603);return _0x288a03[_0xcf9e('0x1d')](_0xcf9e('0x1e'),_0x1b1839+'-'+_0x182a00+'/'+_0x12a687)['json'](_0x31ddc0);}return null;};}function patchUpdates(_0x1f20c8){return function(_0x142ccf){try{jsonpatch[_0xcf9e('0x1f')](_0x142ccf,_0x1f20c8,!![]);}catch(_0x1c0edc){return BPromise[_0xcf9e('0x20')](_0x1c0edc);}return _0x142ccf[_0xcf9e('0x21')]();};}function saveUpdates(_0x5f3b12,_0x566fa9){return function(_0x6f604d){if(_0x6f604d){return _0x6f604d[_0xcf9e('0x22')](_0x5f3b12)[_0xcf9e('0x23')](function(_0x59f998){return _0x59f998;});}return null;};}function removeEntity(_0x410f13,_0xc07e){return function(_0x3837f6){if(_0x3837f6){return _0x3837f6['destroy']()['then'](function(){_0x410f13['status'](0xcc)[_0xcf9e('0x17')]();});}};}function handleEntityNotFound(_0x3d7cbb,_0x583269){return function(_0x50d2d4){if(!_0x50d2d4){_0x3d7cbb[_0xcf9e('0x15')](0x194);}return _0x50d2d4;};}function handleError(_0x3ae84c,_0x7f679e){_0x7f679e=_0x7f679e||0x1f4;return function(_0x474833){logger['error'](_0x474833[_0xcf9e('0x24')]);if(_0x474833[_0xcf9e('0x25')]){delete _0x474833[_0xcf9e('0x25')];}_0x3ae84c[_0xcf9e('0x16')](_0x7f679e)['send'](_0x474833);};}exports[_0xcf9e('0x26')]=function(_0x3ef349,_0xe7f70c){var _0x486f53={},_0x5a0ba9={},_0x5d810a={'count':0x0,'rows':[]};var _0x122370=_[_0xcf9e('0x27')](db[_0xcf9e('0x28')][_0xcf9e('0x29')],function(_0x5933e5){return{'name':_0x5933e5[_0xcf9e('0x2a')],'type':_0x5933e5[_0xcf9e('0x2b')][_0xcf9e('0x2c')]};});_0x5a0ba9[_0xcf9e('0x2d')]=_['map'](_0x122370,_0xcf9e('0x25'));_0x5a0ba9['query']=_[_0xcf9e('0x2e')](_0x3ef349['query']);_0x5a0ba9[_0xcf9e('0x2f')]=_[_0xcf9e('0x30')](_0x5a0ba9[_0xcf9e('0x2d')],_0x5a0ba9[_0xcf9e('0x31')]);_0x486f53[_0xcf9e('0x32')]=_[_0xcf9e('0x30')](_0x5a0ba9[_0xcf9e('0x2d')],qs[_0xcf9e('0x33')](_0x3ef349[_0xcf9e('0x31')][_0xcf9e('0x33')]));_0x486f53[_0xcf9e('0x32')]=_0x486f53[_0xcf9e('0x32')][_0xcf9e('0x34')]?_0x486f53[_0xcf9e('0x32')]:_0x5a0ba9['model'];if(!_0x3ef349[_0xcf9e('0x31')]['hasOwnProperty']('nolimit')){_0x486f53[_0xcf9e('0x1b')]=qs[_0xcf9e('0x1b')](_0x3ef349['query'][_0xcf9e('0x1b')]);_0x486f53[_0xcf9e('0x19')]=qs[_0xcf9e('0x19')](_0x3ef349[_0xcf9e('0x31')][_0xcf9e('0x19')]);}_0x486f53[_0xcf9e('0x35')]=qs[_0xcf9e('0x36')](_0x3ef349[_0xcf9e('0x31')][_0xcf9e('0x36')]);_0x486f53['where']=qs['filters'](_['pick'](_0x3ef349[_0xcf9e('0x31')],_0x5a0ba9[_0xcf9e('0x2f')]),_0x122370);if(_0x3ef349[_0xcf9e('0x31')]['filter']){_0x486f53[_0xcf9e('0x37')]=_[_0xcf9e('0x38')](_0x486f53[_0xcf9e('0x37')],{'$or':_['map'](_0x122370,function(_0x92037b){if(_0x92037b[_0xcf9e('0x2b')]!==_0xcf9e('0x39')){var _0x2607ae={};_0x2607ae[_0x92037b['name']]={'$like':'%'+_0x3ef349['query']['filter']+'%'};return _0x2607ae;}})});}_0x486f53=_[_0xcf9e('0x38')]({},_0x486f53,_0x3ef349[_0xcf9e('0x3a')]);var _0x576b96={'where':_0x486f53[_0xcf9e('0x37')]};return db['OpenchannelQueueReport'][_0xcf9e('0x1c')](_0x576b96)[_0xcf9e('0x23')](function(_0x225bdc){_0x5d810a[_0xcf9e('0x1c')]=_0x225bdc;if(_0x3ef349[_0xcf9e('0x31')][_0xcf9e('0x3b')]){_0x486f53[_0xcf9e('0x3c')]=[{'all':!![]}];}return db[_0xcf9e('0x28')][_0xcf9e('0x3d')](_0x486f53);})[_0xcf9e('0x23')](function(_0x763c79){_0x5d810a[_0xcf9e('0x3e')]=_0x763c79;return _0x5d810a;})['then'](respondWithFilteredResult(_0xe7f70c,_0x486f53))['catch'](handleError(_0xe7f70c,null));};exports[_0xcf9e('0x3f')]=function(_0x377b10,_0x3fb219){var _0x1d2be1={'raw':!![],'where':{'id':_0x377b10[_0xcf9e('0x40')]['id']}},_0x4d8503={};_0x4d8503[_0xcf9e('0x2d')]=_['keys'](db['OpenchannelQueueReport'][_0xcf9e('0x29')]);_0x4d8503['query']=_[_0xcf9e('0x2e')](_0x377b10['query']);_0x4d8503[_0xcf9e('0x2f')]=_[_0xcf9e('0x30')](_0x4d8503[_0xcf9e('0x2d')],_0x4d8503['query']);_0x1d2be1['attributes']=_[_0xcf9e('0x30')](_0x4d8503[_0xcf9e('0x2d')],qs['fields'](_0x377b10['query']['fields']));_0x1d2be1[_0xcf9e('0x32')]=_0x1d2be1[_0xcf9e('0x32')][_0xcf9e('0x34')]?_0x1d2be1['attributes']:_0x4d8503[_0xcf9e('0x2d')];if(_0x377b10['query'][_0xcf9e('0x3b')]){_0x1d2be1['include']=[{'all':!![]}];}_0x1d2be1=_[_0xcf9e('0x38')]({},_0x1d2be1,_0x377b10[_0xcf9e('0x3a')]);return db[_0xcf9e('0x28')][_0xcf9e('0x41')](_0x1d2be1)[_0xcf9e('0x23')](handleEntityNotFound(_0x3fb219,null))[_0xcf9e('0x23')](respondWithResult(_0x3fb219,null))['catch'](handleError(_0x3fb219,null));};exports[_0xcf9e('0x42')]=function(_0x5eafbd,_0x563e4f){return db[_0xcf9e('0x28')]['create'](_0x5eafbd[_0xcf9e('0x43')],{})[_0xcf9e('0x23')](respondWithResult(_0x563e4f,0xc9))[_0xcf9e('0x44')](handleError(_0x563e4f,null));};exports[_0xcf9e('0x22')]=function(_0x2671f7,_0x14e183){if(_0x2671f7[_0xcf9e('0x43')]['id']){delete _0x2671f7[_0xcf9e('0x43')]['id'];}return db['OpenchannelQueueReport'][_0xcf9e('0x41')]({'where':{'id':_0x2671f7[_0xcf9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x14e183,null))[_0xcf9e('0x23')](saveUpdates(_0x2671f7[_0xcf9e('0x43')],null))['then'](respondWithResult(_0x14e183,null))[_0xcf9e('0x44')](handleError(_0x14e183,null));};exports[_0xcf9e('0x45')]=function(_0x590947,_0x1ccec4){return db['OpenchannelQueueReport'][_0xcf9e('0x41')]({'where':{'id':_0x590947[_0xcf9e('0x40')]['id']}})[_0xcf9e('0x23')](handleEntityNotFound(_0x1ccec4,null))['then'](removeEntity(_0x1ccec4,null))[_0xcf9e('0x44')](handleError(_0x1ccec4,null));};exports[_0xcf9e('0x46')]=function(_0x4a367f,_0x1f1b01){return db[_0xcf9e('0x28')]['describe']()[_0xcf9e('0x23')](respondWithResult(_0x1f1b01,null))[_0xcf9e('0x44')](handleError(_0x1f1b01,null));}; \ No newline at end of file +var _0x0bc4=['where','pick','filter','merge','options','include','rows','catch','params','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x0bc4,0x12f));var _0x40bc=function(_0x324d86,_0x221346){_0x324d86=_0x324d86-0x0;var _0x5828ec=_0x0bc4[_0x324d86];return _0x5828ec;};'use strict';var emlformat=require(_0x40bc('0x0'));var rimraf=require(_0x40bc('0x1'));var zipdir=require(_0x40bc('0x2'));var jsonpatch=require(_0x40bc('0x3'));var rp=require(_0x40bc('0x4'));var moment=require(_0x40bc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40bc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x40bc('0x7'));var ejs=require(_0x40bc('0x8'));var fs=require('fs');var fs_extra=require(_0x40bc('0x9'));var _=require(_0x40bc('0xa'));var squel=require('squel');var crypto=require(_0x40bc('0xb'));var jsforce=require(_0x40bc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x40bc('0x7'));var querystring=require(_0x40bc('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40bc('0xe'));var as=require(_0x40bc('0xf'));var hardwareService=require(_0x40bc('0x10'));var logger=require('../../config/logger')(_0x40bc('0x11'));var utils=require(_0x40bc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x40bc('0x13'));var db=require(_0x40bc('0x14'))['db'];function respondWithStatusCode(_0x40446c,_0x4a1bce){_0x4a1bce=_0x4a1bce||0xcc;return function(_0x57bcb0){if(_0x57bcb0){return _0x40446c[_0x40bc('0x15')](_0x4a1bce);}return _0x40446c[_0x40bc('0x16')](_0x4a1bce)[_0x40bc('0x17')]();};}function respondWithResult(_0xdf491b,_0x5b3217){_0x5b3217=_0x5b3217||0xc8;return function(_0x426e5e){if(_0x426e5e){return _0xdf491b['status'](_0x5b3217)[_0x40bc('0x18')](_0x426e5e);}};}function respondWithFilteredResult(_0x496fe4,_0x1dcaa9){return function(_0x165bb3){if(_0x165bb3){var _0x425dd9=typeof _0x1dcaa9[_0x40bc('0x19')]===_0x40bc('0x1a')&&typeof _0x1dcaa9['limit']===_0x40bc('0x1a');var _0x3f1afa=_0x165bb3[_0x40bc('0x1b')];var _0x105aba=_0x425dd9?0x0:_0x1dcaa9[_0x40bc('0x19')];var _0x50cd05=_0x425dd9?_0x165bb3[_0x40bc('0x1b')]:_0x1dcaa9[_0x40bc('0x19')]+_0x1dcaa9[_0x40bc('0x1c')];var _0x4666d4;if(_0x50cd05>=_0x3f1afa){_0x50cd05=_0x3f1afa;_0x4666d4=0xc8;}else{_0x4666d4=0xce;}_0x496fe4[_0x40bc('0x16')](_0x4666d4);return _0x496fe4[_0x40bc('0x1d')](_0x40bc('0x1e'),_0x105aba+'-'+_0x50cd05+'/'+_0x3f1afa)[_0x40bc('0x18')](_0x165bb3);}return null;};}function patchUpdates(_0x3c92b7){return function(_0x1b4a8c){try{jsonpatch[_0x40bc('0x1f')](_0x1b4a8c,_0x3c92b7,!![]);}catch(_0x954b33){return BPromise[_0x40bc('0x20')](_0x954b33);}return _0x1b4a8c[_0x40bc('0x21')]();};}function saveUpdates(_0x1d6302,_0x4c60b7){return function(_0x19b1f6){if(_0x19b1f6){return _0x19b1f6['update'](_0x1d6302)[_0x40bc('0x22')](function(_0x224c9d){return _0x224c9d;});}return null;};}function removeEntity(_0x26c6bd,_0x3239d6){return function(_0x25944b){if(_0x25944b){return _0x25944b['destroy']()['then'](function(){_0x26c6bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x294561,_0x9475b5){return function(_0x1377fe){if(!_0x1377fe){_0x294561[_0x40bc('0x15')](0x194);}return _0x1377fe;};}function handleError(_0x333a65,_0xc6c033){_0xc6c033=_0xc6c033||0x1f4;return function(_0x3f2cf8){logger[_0x40bc('0x23')](_0x3f2cf8[_0x40bc('0x24')]);if(_0x3f2cf8[_0x40bc('0x25')]){delete _0x3f2cf8[_0x40bc('0x25')];}_0x333a65[_0x40bc('0x16')](_0xc6c033)[_0x40bc('0x26')](_0x3f2cf8);};}exports[_0x40bc('0x27')]=function(_0x55e5d3,_0x8f4b97){var _0x1f0670={},_0x52633a={},_0xa7777c={'count':0x0,'rows':[]};var _0x5f2090=_[_0x40bc('0x28')](db[_0x40bc('0x29')][_0x40bc('0x2a')],function(_0x2104a7){return{'name':_0x2104a7[_0x40bc('0x2b')],'type':_0x2104a7[_0x40bc('0x2c')][_0x40bc('0x2d')]};});_0x52633a[_0x40bc('0x2e')]=_[_0x40bc('0x28')](_0x5f2090,_0x40bc('0x25'));_0x52633a[_0x40bc('0x2f')]=_[_0x40bc('0x30')](_0x55e5d3[_0x40bc('0x2f')]);_0x52633a[_0x40bc('0x31')]=_[_0x40bc('0x32')](_0x52633a['model'],_0x52633a['query']);_0x1f0670[_0x40bc('0x33')]=_[_0x40bc('0x32')](_0x52633a[_0x40bc('0x2e')],qs['fields'](_0x55e5d3[_0x40bc('0x2f')][_0x40bc('0x34')]));_0x1f0670['attributes']=_0x1f0670['attributes']['length']?_0x1f0670[_0x40bc('0x33')]:_0x52633a[_0x40bc('0x2e')];if(!_0x55e5d3[_0x40bc('0x2f')][_0x40bc('0x35')](_0x40bc('0x36'))){_0x1f0670[_0x40bc('0x1c')]=qs['limit'](_0x55e5d3[_0x40bc('0x2f')][_0x40bc('0x1c')]);_0x1f0670['offset']=qs[_0x40bc('0x19')](_0x55e5d3['query'][_0x40bc('0x19')]);}_0x1f0670[_0x40bc('0x37')]=qs[_0x40bc('0x38')](_0x55e5d3[_0x40bc('0x2f')][_0x40bc('0x38')]);_0x1f0670[_0x40bc('0x39')]=qs[_0x40bc('0x31')](_[_0x40bc('0x3a')](_0x55e5d3['query'],_0x52633a[_0x40bc('0x31')]),_0x5f2090);if(_0x55e5d3[_0x40bc('0x2f')][_0x40bc('0x3b')]){_0x1f0670[_0x40bc('0x39')]=_[_0x40bc('0x3c')](_0x1f0670[_0x40bc('0x39')],{'$or':_[_0x40bc('0x28')](_0x5f2090,function(_0x27178b){if(_0x27178b[_0x40bc('0x2c')]!=='VIRTUAL'){var _0x25829d={};_0x25829d[_0x27178b[_0x40bc('0x25')]]={'$like':'%'+_0x55e5d3[_0x40bc('0x2f')][_0x40bc('0x3b')]+'%'};return _0x25829d;}})});}_0x1f0670=_[_0x40bc('0x3c')]({},_0x1f0670,_0x55e5d3[_0x40bc('0x3d')]);var _0xbeb15f={'where':_0x1f0670[_0x40bc('0x39')]};return db[_0x40bc('0x29')][_0x40bc('0x1b')](_0xbeb15f)[_0x40bc('0x22')](function(_0x4a458f){_0xa7777c[_0x40bc('0x1b')]=_0x4a458f;if(_0x55e5d3[_0x40bc('0x2f')]['includeAll']){_0x1f0670[_0x40bc('0x3e')]=[{'all':!![]}];}return db[_0x40bc('0x29')]['findAll'](_0x1f0670);})[_0x40bc('0x22')](function(_0x4184c8){_0xa7777c[_0x40bc('0x3f')]=_0x4184c8;return _0xa7777c;})[_0x40bc('0x22')](respondWithFilteredResult(_0x8f4b97,_0x1f0670))[_0x40bc('0x40')](handleError(_0x8f4b97,null));};exports['show']=function(_0x154244,_0x17fdf){var _0x1093f3={'raw':!![],'where':{'id':_0x154244[_0x40bc('0x41')]['id']}},_0x351f31={};_0x351f31[_0x40bc('0x2e')]=_[_0x40bc('0x30')](db['OpenchannelQueueReport'][_0x40bc('0x2a')]);_0x351f31[_0x40bc('0x2f')]=_[_0x40bc('0x30')](_0x154244[_0x40bc('0x2f')]);_0x351f31['filters']=_[_0x40bc('0x32')](_0x351f31[_0x40bc('0x2e')],_0x351f31['query']);_0x1093f3[_0x40bc('0x33')]=_['intersection'](_0x351f31[_0x40bc('0x2e')],qs['fields'](_0x154244[_0x40bc('0x2f')][_0x40bc('0x34')]));_0x1093f3[_0x40bc('0x33')]=_0x1093f3[_0x40bc('0x33')][_0x40bc('0x42')]?_0x1093f3[_0x40bc('0x33')]:_0x351f31[_0x40bc('0x2e')];if(_0x154244['query']['includeAll']){_0x1093f3['include']=[{'all':!![]}];}_0x1093f3=_[_0x40bc('0x3c')]({},_0x1093f3,_0x154244[_0x40bc('0x3d')]);return db[_0x40bc('0x29')]['find'](_0x1093f3)[_0x40bc('0x22')](handleEntityNotFound(_0x17fdf,null))[_0x40bc('0x22')](respondWithResult(_0x17fdf,null))[_0x40bc('0x40')](handleError(_0x17fdf,null));};exports['create']=function(_0x515861,_0x4f3862){return db['OpenchannelQueueReport'][_0x40bc('0x43')](_0x515861[_0x40bc('0x44')],{})[_0x40bc('0x22')](respondWithResult(_0x4f3862,0xc9))['catch'](handleError(_0x4f3862,null));};exports['update']=function(_0x289a9c,_0x52b130){if(_0x289a9c['body']['id']){delete _0x289a9c[_0x40bc('0x44')]['id'];}return db['OpenchannelQueueReport'][_0x40bc('0x45')]({'where':{'id':_0x289a9c[_0x40bc('0x41')]['id']}})[_0x40bc('0x22')](handleEntityNotFound(_0x52b130,null))[_0x40bc('0x22')](saveUpdates(_0x289a9c['body'],null))[_0x40bc('0x22')](respondWithResult(_0x52b130,null))[_0x40bc('0x40')](handleError(_0x52b130,null));};exports[_0x40bc('0x46')]=function(_0x1a2804,_0x537e88){return db[_0x40bc('0x29')]['find']({'where':{'id':_0x1a2804['params']['id']}})['then'](handleEntityNotFound(_0x537e88,null))['then'](removeEntity(_0x537e88,null))['catch'](handleError(_0x537e88,null));};exports[_0x40bc('0x47')]=function(_0x53233a,_0x132bf1){return db[_0x40bc('0x29')]['describe']()[_0x40bc('0x22')](respondWithResult(_0x132bf1,null))[_0x40bc('0x40')](handleError(_0x132bf1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b4c336a..175e815 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x162ccc,_0x2efff8){var _0x48321b=function(_0x57df91){while(--_0x57df91){_0x162ccc['push'](_0x162ccc['shift']());}};_0x48321b(++_0x2efff8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x5fc3[_0x1e7b16];return _0x37fadc;};'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 +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x5e9dfd,_0x508625){var _0x264b0f=function(_0x4ce93c){while(--_0x4ce93c){_0x5e9dfd['push'](_0x5e9dfd['shift']());}};_0x264b0f(++_0x508625);}(_0x5fc3,0xa8));var _0x35fc=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x5fc3[_0x14a862];return _0x245eb5;};'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 b7ab6e1..da04174 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 _0x55f1=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x55f1,0x9b));var _0x155f=function(_0x27627f,_0xc5ea6c){_0x27627f=_0x27627f-0x0;var _0x415f9b=_0x55f1[_0x27627f];return _0x415f9b;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22e07f,_0x39b14d,_0x1bcf84){return new BPromise(function(_0x2a0a02,_0x9fc06e){return client[_0x155f('0xa')](_0x22e07f,_0x1bcf84)[_0x155f('0xb')](function(_0x100e9a){logger[_0x155f('0xc')](_0x155f('0xd'),_0x39b14d,_0x155f('0xe'));logger[_0x155f('0xf')](_0x155f('0x10'),_0x39b14d,_0x155f('0xe'),JSON[_0x155f('0x11')](_0x100e9a));if(_0x100e9a[_0x155f('0x12')]){if(_0x100e9a['error'][_0x155f('0x13')]===0x1f4){logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x100e9a['error']['message']);return _0x9fc06e(_0x100e9a[_0x155f('0x12')][_0x155f('0x14')]);}logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x100e9a[_0x155f('0x12')][_0x155f('0x14')]);return _0x2a0a02(_0x100e9a[_0x155f('0x12')]['message']);}else{logger[_0x155f('0xc')](_0x155f('0xd'),_0x39b14d,'request\x20sent');_0x2a0a02(_0x100e9a[_0x155f('0x15')][_0x155f('0x14')]);}})[_0x155f('0x16')](function(_0x7ad1c2){logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x7ad1c2);_0x9fc06e(_0x7ad1c2);});});}exports[_0x155f('0x17')]=function(_0x343a1e){var _0x2f5b83=this;return new Promise(function(_0x407e26,_0x2e248d){return db[_0x155f('0x18')][_0x155f('0x19')](_0x343a1e[_0x155f('0x1a')],{'raw':_0x343a1e[_0x155f('0x1b')]?_0x343a1e[_0x155f('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x155f('0xb')](function(_0x26a322){logger[_0x155f('0xc')](_0x155f('0x17'),_0x343a1e);logger['debug']('CreateOpenchannelQueueReport',_0x343a1e,JSON['stringify'](_0x26a322));_0x407e26(_0x26a322);})[_0x155f('0x16')](function(_0x3a40b4){logger[_0x155f('0x12')](_0x155f('0x17'),_0x3a40b4[_0x155f('0x14')],_0x343a1e);_0x2e248d(_0x2f5b83['error'](0x1f4,_0x3a40b4[_0x155f('0x14')]));});});};exports[_0x155f('0x1c')]=function(_0x172077){var _0x348240=this;return new Promise(function(_0xee4dbc,_0x2588f5){return db[_0x155f('0x18')][_0x155f('0x1d')](_0x172077[_0x155f('0x1a')],{'raw':_0x172077[_0x155f('0x1b')]?_0x172077[_0x155f('0x1b')][_0x155f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172077['options']?_0x172077['options'][_0x155f('0x1f')]||null:null,'attributes':_0x172077[_0x155f('0x1b')]?_0x172077[_0x155f('0x1b')][_0x155f('0x20')]||null:null,'limit':_0x172077['options']?_0x172077[_0x155f('0x1b')][_0x155f('0x21')]||null:null})[_0x155f('0xb')](function(_0x29e9dd){logger[_0x155f('0xc')](_0x155f('0x1c'),_0x172077);logger[_0x155f('0xf')]('UpdateOpenchannelQueueReport',_0x172077,JSON[_0x155f('0x11')](_0x29e9dd));_0xee4dbc(_0x29e9dd);})[_0x155f('0x16')](function(_0x154158){logger[_0x155f('0x12')](_0x155f('0x1c'),_0x154158[_0x155f('0x14')],_0x172077);_0x2588f5(_0x348240[_0x155f('0x12')](0x1f4,_0x154158[_0x155f('0x14')]));});});}; \ No newline at end of file +var _0x8f4c=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x132dd6,_0x4f4fc8){var _0xf77fdb=function(_0x1be6c3){while(--_0x1be6c3){_0x132dd6['push'](_0x132dd6['shift']());}};_0xf77fdb(++_0x4f4fc8);}(_0x8f4c,0x113));var _0xc8f4=function(_0x455fdd,_0x42f286){_0x455fdd=_0x455fdd-0x0;var _0x240af3=_0x8f4c[_0x455fdd];return _0x240af3;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateOpenchannelQueueReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});};exports[_0xc8f4('0x1d')]=function(_0x5d54a9){var _0x39174f=this;return new Promise(function(_0x4a44e0,_0x3782fd){return db['OpenchannelQueueReport'][_0xc8f4('0x1e')](_0x5d54a9[_0xc8f4('0x1a')],{'raw':_0x5d54a9['options']?_0x5d54a9[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d54a9[_0xc8f4('0x1b')]?_0x5d54a9[_0xc8f4('0x1b')]['where']||null:null,'attributes':_0x5d54a9[_0xc8f4('0x1b')]?_0x5d54a9[_0xc8f4('0x1b')]['attributes']||null:null,'limit':_0x5d54a9[_0xc8f4('0x1b')]?_0x5d54a9[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x24bef0){logger[_0xc8f4('0x14')]('UpdateOpenchannelQueueReport',_0x5d54a9);logger[_0xc8f4('0xe')](_0xc8f4('0x1d'),_0x5d54a9,JSON[_0xc8f4('0x10')](_0x24bef0));_0x4a44e0(_0x24bef0);})['catch'](function(_0xf4a556){logger[_0xc8f4('0x11')]('UpdateOpenchannelQueueReport',_0xf4a556['message'],_0x5d54a9);_0x3782fd(_0x39174f['error'](0x1f4,_0xf4a556[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ea68a38..a27df23 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 _0x08ed=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x130ed9,_0x37cea6){var _0x30762=function(_0x4a4d63){while(--_0x4a4d63){_0x130ed9['push'](_0x130ed9['shift']());}};_0x30762(++_0x37cea6);}(_0x08ed,0x13a));var _0xd08e=function(_0x5cf728,_0xb8e38c){_0x5cf728=_0x5cf728-0x0;var _0x199dc2=_0x08ed[_0x5cf728];return _0x199dc2;};'use strict';var multer=require(_0xd08e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd08e('0x1'));var express=require(_0xd08e('0x2'));var router=express[_0xd08e('0x3')]();var fs_extra=require(_0xd08e('0x4'));var auth=require(_0xd08e('0x5'));var interaction=require(_0xd08e('0x6'));var config=require(_0xd08e('0x7'));var controller=require(_0xd08e('0x8'));router[_0xd08e('0x9')]('/',auth[_0xd08e('0xa')](),controller[_0xd08e('0xb')]);router[_0xd08e('0x9')](_0xd08e('0xc'),auth[_0xd08e('0xa')](),controller[_0xd08e('0xd')]);router[_0xd08e('0x9')](_0xd08e('0xe'),auth['isAuthenticated'](),controller[_0xd08e('0xf')]);router[_0xd08e('0x10')]('/',auth[_0xd08e('0xa')](),controller[_0xd08e('0x11')]);router['put'](_0xd08e('0xe'),auth[_0xd08e('0xa')](),controller[_0xd08e('0x12')]);router['delete']('/:id',auth[_0xd08e('0xa')](),controller[_0xd08e('0x13')]);module[_0xd08e('0x14')]=router; \ No newline at end of file +var _0xdea8=['get','/:id','post','create','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdea8,0xaa));var _0x8dea=function(_0x46c532,_0x5367d3){_0x46c532=_0x46c532-0x0;var _0x41bde0=_0xdea8[_0x46c532];return _0x41bde0;};'use strict';var multer=require('multer');var util=require(_0x8dea('0x0'));var path=require('path');var timeout=require(_0x8dea('0x1'));var express=require(_0x8dea('0x2'));var router=express['Router']();var fs_extra=require(_0x8dea('0x3'));var auth=require(_0x8dea('0x4'));var interaction=require(_0x8dea('0x5'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x8dea('0x6')](),controller[_0x8dea('0x7')]);router['get'](_0x8dea('0x8'),auth[_0x8dea('0x6')](),controller[_0x8dea('0x9')]);router[_0x8dea('0xa')](_0x8dea('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8dea('0xc')]('/',auth[_0x8dea('0x6')](),controller[_0x8dea('0xd')]);router['put'](_0x8dea('0xb'),auth[_0x8dea('0x6')](),controller[_0x8dea('0xe')]);router[_0x8dea('0xf')](_0x8dea('0xb'),auth['isAuthenticated'](),controller[_0x8dea('0x10')]);module[_0x8dea('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index da66fe2..f40c460 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x36eb49,_0x4cb5b0){var _0x55f66d=function(_0x12a107){while(--_0x12a107){_0x36eb49['push'](_0x36eb49['shift']());}};_0x55f66d(++_0x4cb5b0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5becd6,_0x13e651){_0x5becd6=_0x5becd6-0x0;var _0x3b7b78=_0xf3cd[_0x5becd6];return _0x3b7b78;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x433856,_0x93bdf7){var _0x264198=function(_0x4e17f6){while(--_0x4e17f6){_0x433856['push'](_0x433856['shift']());}};_0x264198(++_0x93bdf7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x427629,_0x26e77c){_0x427629=_0x427629-0x0;var _0xdcbb84=_0xf4eb[_0x427629];return _0xdcbb84;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e81092c..eb2359f 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 _0x8579=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','OpenchannelTransferReport','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0xa4b671,_0x5e1177){var _0x3222e8=function(_0x42389d){while(--_0x42389d){_0xa4b671['push'](_0xa4b671['shift']());}};_0x3222e8(++_0x5e1177);}(_0x8579,0x11f));var _0x9857=function(_0x98cd6a,_0x86a80){_0x98cd6a=_0x98cd6a-0x0;var _0x354f84=_0x8579[_0x98cd6a];return _0x354f84;};'use strict';var emlformat=require(_0x9857('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9857('0x1'));var jsonpatch=require(_0x9857('0x2'));var rp=require('request-promise');var moment=require(_0x9857('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9857('0x4'));var util=require(_0x9857('0x5'));var path=require(_0x9857('0x6'));var sox=require(_0x9857('0x7'));var csv=require(_0x9857('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9857('0x9'));var _=require(_0x9857('0xa'));var squel=require(_0x9857('0xb'));var crypto=require(_0x9857('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9857('0xd'));var Papa=require(_0x9857('0xe'));var Redis=require(_0x9857('0xf'));var authService=require(_0x9857('0x10'));var qs=require(_0x9857('0x11'));var as=require(_0x9857('0x12'));var hardwareService=require(_0x9857('0x13'));var logger=require('../../config/logger')(_0x9857('0x14'));var utils=require(_0x9857('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9857('0x16'));var db=require(_0x9857('0x17'))['db'];function respondWithStatusCode(_0x588b90,_0x182dc7){_0x182dc7=_0x182dc7||0xcc;return function(_0x4923df){if(_0x4923df){return _0x588b90['sendStatus'](_0x182dc7);}return _0x588b90[_0x9857('0x18')](_0x182dc7)[_0x9857('0x19')]();};}function respondWithResult(_0x4b764c,_0x46c744){_0x46c744=_0x46c744||0xc8;return function(_0x13c449){if(_0x13c449){return _0x4b764c[_0x9857('0x18')](_0x46c744)[_0x9857('0x1a')](_0x13c449);}};}function respondWithFilteredResult(_0x1a052f,_0xe66acc){return function(_0x41d229){if(_0x41d229){var _0x463c3c=typeof _0xe66acc[_0x9857('0x1b')]==='undefined'&&typeof _0xe66acc['limit']===_0x9857('0x1c');var _0x42441e=_0x41d229['count'];var _0x12f8c2=_0x463c3c?0x0:_0xe66acc[_0x9857('0x1b')];var _0x483daa=_0x463c3c?_0x41d229[_0x9857('0x1d')]:_0xe66acc[_0x9857('0x1b')]+_0xe66acc[_0x9857('0x1e')];var _0x39a396;if(_0x483daa>=_0x42441e){_0x483daa=_0x42441e;_0x39a396=0xc8;}else{_0x39a396=0xce;}_0x1a052f[_0x9857('0x18')](_0x39a396);return _0x1a052f[_0x9857('0x1f')](_0x9857('0x20'),_0x12f8c2+'-'+_0x483daa+'/'+_0x42441e)['json'](_0x41d229);}return null;};}function patchUpdates(_0xe28a5a){return function(_0x508db1){try{jsonpatch[_0x9857('0x21')](_0x508db1,_0xe28a5a,!![]);}catch(_0xece029){return BPromise[_0x9857('0x22')](_0xece029);}return _0x508db1[_0x9857('0x23')]();};}function saveUpdates(_0x3bb776,_0x485cea){return function(_0x4dfdab){if(_0x4dfdab){return _0x4dfdab[_0x9857('0x24')](_0x3bb776)[_0x9857('0x25')](function(_0x4eeba7){return _0x4eeba7;});}return null;};}function removeEntity(_0x247ea5,_0x490877){return function(_0x4d6562){if(_0x4d6562){return _0x4d6562[_0x9857('0x26')]()[_0x9857('0x25')](function(){_0x247ea5[_0x9857('0x18')](0xcc)[_0x9857('0x19')]();});}};}function handleEntityNotFound(_0x490226,_0x35c7b3){return function(_0x5e7259){if(!_0x5e7259){_0x490226[_0x9857('0x27')](0x194);}return _0x5e7259;};}function handleError(_0x19e12c,_0x160b4c){_0x160b4c=_0x160b4c||0x1f4;return function(_0x4eae20){logger[_0x9857('0x28')](_0x4eae20[_0x9857('0x29')]);if(_0x4eae20[_0x9857('0x2a')]){delete _0x4eae20[_0x9857('0x2a')];}_0x19e12c[_0x9857('0x18')](_0x160b4c)[_0x9857('0x2b')](_0x4eae20);};}exports[_0x9857('0x2c')]=function(_0x24ba5c,_0x51dc85){var _0x519449={},_0x56a181={},_0x4b8c95={'count':0x0,'rows':[]};var _0x486862=_[_0x9857('0x2d')](db['OpenchannelTransferReport'][_0x9857('0x2e')],function(_0x20bfcf){return{'name':_0x20bfcf[_0x9857('0x2f')],'type':_0x20bfcf[_0x9857('0x30')][_0x9857('0x31')]};});_0x56a181['model']=_[_0x9857('0x2d')](_0x486862,'name');_0x56a181[_0x9857('0x32')]=_[_0x9857('0x33')](_0x24ba5c[_0x9857('0x32')]);_0x56a181[_0x9857('0x34')]=_[_0x9857('0x35')](_0x56a181[_0x9857('0x36')],_0x56a181['query']);_0x519449[_0x9857('0x37')]=_[_0x9857('0x35')](_0x56a181[_0x9857('0x36')],qs['fields'](_0x24ba5c[_0x9857('0x32')][_0x9857('0x38')]));_0x519449[_0x9857('0x37')]=_0x519449['attributes'][_0x9857('0x39')]?_0x519449[_0x9857('0x37')]:_0x56a181[_0x9857('0x36')];if(!_0x24ba5c[_0x9857('0x32')][_0x9857('0x3a')](_0x9857('0x3b'))){_0x519449[_0x9857('0x1e')]=qs[_0x9857('0x1e')](_0x24ba5c[_0x9857('0x32')][_0x9857('0x1e')]);_0x519449[_0x9857('0x1b')]=qs[_0x9857('0x1b')](_0x24ba5c['query'][_0x9857('0x1b')]);}_0x519449[_0x9857('0x3c')]=qs[_0x9857('0x3d')](_0x24ba5c[_0x9857('0x32')][_0x9857('0x3d')]);_0x519449['where']=qs[_0x9857('0x34')](_[_0x9857('0x3e')](_0x24ba5c[_0x9857('0x32')],_0x56a181['filters']),_0x486862);if(_0x24ba5c['query']['filter']){_0x519449[_0x9857('0x3f')]=_[_0x9857('0x40')](_0x519449['where'],{'$or':_[_0x9857('0x2d')](_0x486862,function(_0x2d10e4){if(_0x2d10e4[_0x9857('0x30')]!==_0x9857('0x41')){var _0x1beafc={};_0x1beafc[_0x2d10e4[_0x9857('0x2a')]]={'$like':'%'+_0x24ba5c[_0x9857('0x32')][_0x9857('0x42')]+'%'};return _0x1beafc;}})});}_0x519449=_[_0x9857('0x40')]({},_0x519449,_0x24ba5c[_0x9857('0x43')]);var _0x1aa323={'where':_0x519449[_0x9857('0x3f')]};return db['OpenchannelTransferReport'][_0x9857('0x1d')](_0x1aa323)[_0x9857('0x25')](function(_0x44aabe){_0x4b8c95[_0x9857('0x1d')]=_0x44aabe;if(_0x24ba5c[_0x9857('0x32')][_0x9857('0x44')]){_0x519449[_0x9857('0x45')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x9857('0x46')](_0x519449);})[_0x9857('0x25')](function(_0x14f023){_0x4b8c95[_0x9857('0x47')]=_0x14f023;return _0x4b8c95;})[_0x9857('0x25')](respondWithFilteredResult(_0x51dc85,_0x519449))[_0x9857('0x48')](handleError(_0x51dc85,null));};exports['show']=function(_0x5c2989,_0xd7e627){var _0x57b04c={'raw':!![],'where':{'id':_0x5c2989[_0x9857('0x49')]['id']}},_0x335331={};_0x335331['model']=_[_0x9857('0x33')](db[_0x9857('0x4a')][_0x9857('0x2e')]);_0x335331[_0x9857('0x32')]=_[_0x9857('0x33')](_0x5c2989[_0x9857('0x32')]);_0x335331['filters']=_['intersection'](_0x335331[_0x9857('0x36')],_0x335331[_0x9857('0x32')]);_0x57b04c[_0x9857('0x37')]=_[_0x9857('0x35')](_0x335331[_0x9857('0x36')],qs[_0x9857('0x38')](_0x5c2989[_0x9857('0x32')][_0x9857('0x38')]));_0x57b04c['attributes']=_0x57b04c['attributes']['length']?_0x57b04c[_0x9857('0x37')]:_0x335331['model'];if(_0x5c2989[_0x9857('0x32')][_0x9857('0x44')]){_0x57b04c[_0x9857('0x45')]=[{'all':!![]}];}_0x57b04c=_['merge']({},_0x57b04c,_0x5c2989['options']);return db[_0x9857('0x4a')][_0x9857('0x4b')](_0x57b04c)['then'](handleEntityNotFound(_0xd7e627,null))[_0x9857('0x25')](respondWithResult(_0xd7e627,null))[_0x9857('0x48')](handleError(_0xd7e627,null));};exports[_0x9857('0x4c')]=function(_0x129cd8,_0xe08d07){return db[_0x9857('0x4a')]['create'](_0x129cd8[_0x9857('0x4d')],{})[_0x9857('0x25')](respondWithResult(_0xe08d07,0xc9))[_0x9857('0x48')](handleError(_0xe08d07,null));};exports['update']=function(_0x1657e2,_0x55f506){if(_0x1657e2['body']['id']){delete _0x1657e2['body']['id'];}return db[_0x9857('0x4a')][_0x9857('0x4b')]({'where':{'id':_0x1657e2['params']['id']}})[_0x9857('0x25')](handleEntityNotFound(_0x55f506,null))[_0x9857('0x25')](saveUpdates(_0x1657e2[_0x9857('0x4d')],null))[_0x9857('0x25')](respondWithResult(_0x55f506,null))['catch'](handleError(_0x55f506,null));};exports[_0x9857('0x26')]=function(_0x10706c,_0x48a951){return db[_0x9857('0x4a')][_0x9857('0x4b')]({'where':{'id':_0x10706c[_0x9857('0x49')]['id']}})['then'](handleEntityNotFound(_0x48a951,null))['then'](removeEntity(_0x48a951,null))[_0x9857('0x48')](handleError(_0x48a951,null));};exports[_0x9857('0x4e')]=function(_0x59841f,_0x1df2ae){return db[_0x9857('0x4a')]['describe']()[_0x9857('0x25')](respondWithResult(_0x1df2ae,null))[_0x9857('0x48')](handleError(_0x1df2ae,null));}; \ No newline at end of file +var _0x67a8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','includeAll','include','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','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x67a8,0x1c1));var _0x867a=function(_0x4f3193,_0x500f84){_0x4f3193=_0x4f3193-0x0;var _0x5f53fa=_0x67a8[_0x4f3193];return _0x5f53fa;};'use strict';var emlformat=require(_0x867a('0x0'));var rimraf=require(_0x867a('0x1'));var zipdir=require(_0x867a('0x2'));var jsonpatch=require(_0x867a('0x3'));var rp=require(_0x867a('0x4'));var moment=require(_0x867a('0x5'));var BPromise=require(_0x867a('0x6'));var Mustache=require(_0x867a('0x7'));var util=require(_0x867a('0x8'));var path=require(_0x867a('0x9'));var sox=require('sox');var csv=require(_0x867a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x867a('0xb'));var _=require(_0x867a('0xc'));var squel=require('squel');var crypto=require(_0x867a('0xd'));var jsforce=require(_0x867a('0xe'));var deskjs=require(_0x867a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x867a('0x10'));var Papa=require(_0x867a('0x11'));var Redis=require(_0x867a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x867a('0x13'));var as=require(_0x867a('0x14'));var hardwareService=require(_0x867a('0x15'));var logger=require(_0x867a('0x16'))(_0x867a('0x17'));var utils=require(_0x867a('0x18'));var config=require(_0x867a('0x19'));var licenseUtil=require(_0x867a('0x1a'));var db=require(_0x867a('0x1b'))['db'];function respondWithStatusCode(_0x155719,_0x427c36){_0x427c36=_0x427c36||0xcc;return function(_0x3a28b8){if(_0x3a28b8){return _0x155719[_0x867a('0x1c')](_0x427c36);}return _0x155719[_0x867a('0x1d')](_0x427c36)[_0x867a('0x1e')]();};}function respondWithResult(_0x4e0e36,_0x19e44e){_0x19e44e=_0x19e44e||0xc8;return function(_0x34e784){if(_0x34e784){return _0x4e0e36['status'](_0x19e44e)[_0x867a('0x1f')](_0x34e784);}};}function respondWithFilteredResult(_0x1423ce,_0xec4baf){return function(_0x24a2f5){if(_0x24a2f5){var _0x161500=typeof _0xec4baf[_0x867a('0x20')]===_0x867a('0x21')&&typeof _0xec4baf['limit']==='undefined';var _0x3f0c19=_0x24a2f5[_0x867a('0x22')];var _0x10894e=_0x161500?0x0:_0xec4baf[_0x867a('0x20')];var _0x428b1b=_0x161500?_0x24a2f5[_0x867a('0x22')]:_0xec4baf[_0x867a('0x20')]+_0xec4baf[_0x867a('0x23')];var _0x592d58;if(_0x428b1b>=_0x3f0c19){_0x428b1b=_0x3f0c19;_0x592d58=0xc8;}else{_0x592d58=0xce;}_0x1423ce[_0x867a('0x1d')](_0x592d58);return _0x1423ce[_0x867a('0x24')](_0x867a('0x25'),_0x10894e+'-'+_0x428b1b+'/'+_0x3f0c19)[_0x867a('0x1f')](_0x24a2f5);}return null;};}function patchUpdates(_0x351dbe){return function(_0x48bb40){try{jsonpatch[_0x867a('0x26')](_0x48bb40,_0x351dbe,!![]);}catch(_0xaf5a62){return BPromise['reject'](_0xaf5a62);}return _0x48bb40[_0x867a('0x27')]();};}function saveUpdates(_0x306f9e,_0x4f37e8){return function(_0x200f17){if(_0x200f17){return _0x200f17[_0x867a('0x28')](_0x306f9e)[_0x867a('0x29')](function(_0x9f656f){return _0x9f656f;});}return null;};}function removeEntity(_0x299e18,_0x4c2727){return function(_0x549175){if(_0x549175){return _0x549175[_0x867a('0x2a')]()[_0x867a('0x29')](function(){_0x299e18[_0x867a('0x1d')](0xcc)[_0x867a('0x1e')]();});}};}function handleEntityNotFound(_0x462bd6,_0x13b436){return function(_0xe18c43){if(!_0xe18c43){_0x462bd6[_0x867a('0x1c')](0x194);}return _0xe18c43;};}function handleError(_0x16bf2f,_0x2385f7){_0x2385f7=_0x2385f7||0x1f4;return function(_0x45ef7c){logger['error'](_0x45ef7c['stack']);if(_0x45ef7c[_0x867a('0x2b')]){delete _0x45ef7c[_0x867a('0x2b')];}_0x16bf2f['status'](_0x2385f7)[_0x867a('0x2c')](_0x45ef7c);};}exports[_0x867a('0x2d')]=function(_0x67115c,_0x171094){var _0x805511={},_0x2937ee={},_0x341bd9={'count':0x0,'rows':[]};var _0x41a6f1=_[_0x867a('0x2e')](db['OpenchannelTransferReport'][_0x867a('0x2f')],function(_0x53d3f7){return{'name':_0x53d3f7[_0x867a('0x30')],'type':_0x53d3f7[_0x867a('0x31')][_0x867a('0x32')]};});_0x2937ee[_0x867a('0x33')]=_[_0x867a('0x2e')](_0x41a6f1,_0x867a('0x2b'));_0x2937ee[_0x867a('0x34')]=_[_0x867a('0x35')](_0x67115c[_0x867a('0x34')]);_0x2937ee[_0x867a('0x36')]=_[_0x867a('0x37')](_0x2937ee[_0x867a('0x33')],_0x2937ee[_0x867a('0x34')]);_0x805511['attributes']=_[_0x867a('0x37')](_0x2937ee['model'],qs[_0x867a('0x38')](_0x67115c[_0x867a('0x34')][_0x867a('0x38')]));_0x805511[_0x867a('0x39')]=_0x805511[_0x867a('0x39')][_0x867a('0x3a')]?_0x805511[_0x867a('0x39')]:_0x2937ee[_0x867a('0x33')];if(!_0x67115c[_0x867a('0x34')]['hasOwnProperty'](_0x867a('0x3b'))){_0x805511['limit']=qs[_0x867a('0x23')](_0x67115c[_0x867a('0x34')][_0x867a('0x23')]);_0x805511[_0x867a('0x20')]=qs[_0x867a('0x20')](_0x67115c[_0x867a('0x34')][_0x867a('0x20')]);}_0x805511[_0x867a('0x3c')]=qs[_0x867a('0x3d')](_0x67115c[_0x867a('0x34')]['sort']);_0x805511[_0x867a('0x3e')]=qs[_0x867a('0x36')](_[_0x867a('0x3f')](_0x67115c[_0x867a('0x34')],_0x2937ee['filters']),_0x41a6f1);if(_0x67115c[_0x867a('0x34')][_0x867a('0x40')]){_0x805511[_0x867a('0x3e')]=_[_0x867a('0x41')](_0x805511[_0x867a('0x3e')],{'$or':_[_0x867a('0x2e')](_0x41a6f1,function(_0x41e618){if(_0x41e618['type']!==_0x867a('0x42')){var _0x2c3f0b={};_0x2c3f0b[_0x41e618[_0x867a('0x2b')]]={'$like':'%'+_0x67115c['query'][_0x867a('0x40')]+'%'};return _0x2c3f0b;}})});}_0x805511=_[_0x867a('0x41')]({},_0x805511,_0x67115c['options']);var _0x19914a={'where':_0x805511[_0x867a('0x3e')]};return db[_0x867a('0x43')][_0x867a('0x22')](_0x19914a)['then'](function(_0x3c14d5){_0x341bd9[_0x867a('0x22')]=_0x3c14d5;if(_0x67115c[_0x867a('0x34')][_0x867a('0x44')]){_0x805511[_0x867a('0x45')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x805511);})[_0x867a('0x29')](function(_0x5c8fc8){_0x341bd9['rows']=_0x5c8fc8;return _0x341bd9;})[_0x867a('0x29')](respondWithFilteredResult(_0x171094,_0x805511))[_0x867a('0x46')](handleError(_0x171094,null));};exports[_0x867a('0x47')]=function(_0x4208a8,_0x4bed00){var _0x332530={'raw':!![],'where':{'id':_0x4208a8['params']['id']}},_0x3ab069={};_0x3ab069['model']=_[_0x867a('0x35')](db[_0x867a('0x43')][_0x867a('0x2f')]);_0x3ab069[_0x867a('0x34')]=_[_0x867a('0x35')](_0x4208a8[_0x867a('0x34')]);_0x3ab069[_0x867a('0x36')]=_[_0x867a('0x37')](_0x3ab069[_0x867a('0x33')],_0x3ab069[_0x867a('0x34')]);_0x332530[_0x867a('0x39')]=_[_0x867a('0x37')](_0x3ab069['model'],qs[_0x867a('0x38')](_0x4208a8[_0x867a('0x34')]['fields']));_0x332530[_0x867a('0x39')]=_0x332530[_0x867a('0x39')][_0x867a('0x3a')]?_0x332530[_0x867a('0x39')]:_0x3ab069[_0x867a('0x33')];if(_0x4208a8[_0x867a('0x34')][_0x867a('0x44')]){_0x332530[_0x867a('0x45')]=[{'all':!![]}];}_0x332530=_[_0x867a('0x41')]({},_0x332530,_0x4208a8[_0x867a('0x48')]);return db[_0x867a('0x43')][_0x867a('0x49')](_0x332530)[_0x867a('0x29')](handleEntityNotFound(_0x4bed00,null))[_0x867a('0x29')](respondWithResult(_0x4bed00,null))[_0x867a('0x46')](handleError(_0x4bed00,null));};exports[_0x867a('0x4a')]=function(_0x42ea16,_0x42e44e){return db[_0x867a('0x43')][_0x867a('0x4a')](_0x42ea16['body'],{})[_0x867a('0x29')](respondWithResult(_0x42e44e,0xc9))[_0x867a('0x46')](handleError(_0x42e44e,null));};exports[_0x867a('0x28')]=function(_0x38bac5,_0x3b995f){if(_0x38bac5['body']['id']){delete _0x38bac5[_0x867a('0x4b')]['id'];}return db[_0x867a('0x43')][_0x867a('0x49')]({'where':{'id':_0x38bac5[_0x867a('0x4c')]['id']}})[_0x867a('0x29')](handleEntityNotFound(_0x3b995f,null))['then'](saveUpdates(_0x38bac5[_0x867a('0x4b')],null))[_0x867a('0x29')](respondWithResult(_0x3b995f,null))['catch'](handleError(_0x3b995f,null));};exports[_0x867a('0x2a')]=function(_0x209850,_0x2d656d){return db[_0x867a('0x43')][_0x867a('0x49')]({'where':{'id':_0x209850[_0x867a('0x4c')]['id']}})[_0x867a('0x29')](handleEntityNotFound(_0x2d656d,null))[_0x867a('0x29')](removeEntity(_0x2d656d,null))[_0x867a('0x46')](handleError(_0x2d656d,null));};exports[_0x867a('0x4d')]=function(_0x177985,_0x1cc149){return db[_0x867a('0x43')]['describe']()['then'](respondWithResult(_0x1cc149,null))[_0x867a('0x46')](handleError(_0x1cc149,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 314d89f..23ec243 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 _0xc57e=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelTransferReport.attributes'];(function(_0x27dd0c,_0x17039c){var _0xe2e5af=function(_0x3cc3b8){while(--_0x3cc3b8){_0x27dd0c['push'](_0x27dd0c['shift']());}};_0xe2e5af(++_0x17039c);}(_0xc57e,0x159));var _0xec57=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc57e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec57('0x0'))(_0xec57('0x1'));var moment=require(_0xec57('0x2'));var BPromise=require('bluebird');var rp=require(_0xec57('0x3'));var fs=require('fs');var path=require(_0xec57('0x4'));var rimraf=require(_0xec57('0x5'));var config=require('../../config/environment');var attributes=require(_0xec57('0x6'));module['exports']=function(_0xb2ce40,_0x3490e5){return _0xb2ce40[_0xec57('0x7')](_0xec57('0x8'),attributes,{'tableName':_0xec57('0x9'),'paranoid':![],'indexes':[{'name':_0xec57('0xa'),'fields':[_0xec57('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c40=['request-promise','path','rimraf','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','moment','bluebird'];(function(_0x5e1095,_0x33c4c6){var _0x11339a=function(_0x2fa583){while(--_0x2fa583){_0x5e1095['push'](_0x5e1095['shift']());}};_0x11339a(++_0x33c4c6);}(_0x5c40,0xd4));var _0x05c4=function(_0x1317e8,_0x934940){_0x1317e8=_0x1317e8-0x0;var _0x1c8245=_0x5c40[_0x1317e8];return _0x1c8245;};'use strict';var _=require(_0x05c4('0x0'));var util=require(_0x05c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x05c4('0x2'));var BPromise=require(_0x05c4('0x3'));var rp=require(_0x05c4('0x4'));var fs=require('fs');var path=require(_0x05c4('0x5'));var rimraf=require(_0x05c4('0x6'));var config=require(_0x05c4('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x05c4('0x8')]=function(_0x3341a1,_0x4e2e23){return _0x3341a1['define'](_0x05c4('0x9'),attributes,{'tableName':_0x05c4('0xa'),'paranoid':![],'indexes':[{'name':_0x05c4('0xb'),'fields':[_0x05c4('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 5f37c12..7fdc2c8 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 _0x27c5=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28c12e,_0x3d853c){var _0x2a48f1=function(_0x1be343){while(--_0x1be343){_0x28c12e['push'](_0x28c12e['shift']());}};_0x2a48f1(++_0x3d853c);}(_0x27c5,0x173));var _0x527c=function(_0x4cd14a,_0x3c08b4){_0x4cd14a=_0x4cd14a-0x0;var _0x59ac6a=_0x27c5[_0x4cd14a];return _0x59ac6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x527c('0x0'));var BPromise=require(_0x527c('0x1'));var rs=require(_0x527c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x527c('0x3'))['db'];var utils=require(_0x527c('0x4'));var logger=require(_0x527c('0x5'))(_0x527c('0x6'));var config=require(_0x527c('0x7'));var jayson=require(_0x527c('0x8'));var client=jayson[_0x527c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c413,_0x5a68e8,_0x2db820){return new BPromise(function(_0x5e07ba,_0x1071f5){return client[_0x527c('0xa')](_0x18c413,_0x2db820)[_0x527c('0xb')](function(_0x49465c){logger[_0x527c('0xc')](_0x527c('0xd'),_0x5a68e8,_0x527c('0xe'));logger[_0x527c('0xf')](_0x527c('0x10'),_0x5a68e8,_0x527c('0xe'),JSON[_0x527c('0x11')](_0x49465c));if(_0x49465c[_0x527c('0x12')]){if(_0x49465c[_0x527c('0x12')][_0x527c('0x13')]===0x1f4){logger[_0x527c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,_0x49465c['error'][_0x527c('0x14')]);return _0x1071f5(_0x49465c[_0x527c('0x12')][_0x527c('0x14')]);}logger[_0x527c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,_0x49465c[_0x527c('0x12')][_0x527c('0x14')]);return _0x5e07ba(_0x49465c['error']['message']);}else{logger[_0x527c('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,'request\x20sent');_0x5e07ba(_0x49465c[_0x527c('0x15')][_0x527c('0x14')]);}})[_0x527c('0x16')](function(_0x5e987c){logger[_0x527c('0x12')](_0x527c('0xd'),_0x5a68e8,_0x5e987c);_0x1071f5(_0x5e987c);});});} \ No newline at end of file +var _0x814b=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x814b,0x1a2));var _0xb814=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x814b[_0x30e004];return _0x5ca247;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f69ee00..7f6575c 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 _0x9140=['index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated'];(function(_0xc77048,_0x36d316){var _0x467781=function(_0x586039){while(--_0x586039){_0xc77048['push'](_0xc77048['shift']());}};_0x467781(++_0x36d316);}(_0x9140,0x185));var _0x0914=function(_0x2dfdec,_0x1852c6){_0x2dfdec=_0x2dfdec-0x0;var _0x27beac=_0x9140[_0x2dfdec];return _0x27beac;};'use strict';var multer=require(_0x0914('0x0'));var util=require(_0x0914('0x1'));var path=require(_0x0914('0x2'));var timeout=require(_0x0914('0x3'));var express=require(_0x0914('0x4'));var router=express['Router']();var fs_extra=require(_0x0914('0x5'));var auth=require(_0x0914('0x6'));var interaction=require(_0x0914('0x7'));var config=require('../../config/environment');var controller=require(_0x0914('0x8'));router[_0x0914('0x9')]('/',auth[_0x0914('0xa')](),controller[_0x0914('0xb')]);router['get'](_0x0914('0xc'),auth[_0x0914('0xa')](),controller[_0x0914('0xd')]);router[_0x0914('0xe')]('/',auth[_0x0914('0xa')](),controller[_0x0914('0xf')]);router['put'](_0x0914('0xc'),auth[_0x0914('0xa')](),controller[_0x0914('0x10')]);router[_0x0914('0x11')](_0x0914('0xc'),auth['isAuthenticated'](),controller[_0x0914('0x12')]);module[_0x0914('0x13')]=router; \ No newline at end of file +var _0xa244=['./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xa244,0xd2));var _0x4a24=function(_0x458b12,_0x49bd88){_0x458b12=_0x458b12-0x0;var _0x387110=_0xa244[_0x458b12];return _0x387110;};'use strict';var multer=require(_0x4a24('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4a24('0x1'));var router=express[_0x4a24('0x2')]();var fs_extra=require(_0x4a24('0x3'));var auth=require(_0x4a24('0x4'));var interaction=require(_0x4a24('0x5'));var config=require('../../config/environment');var controller=require(_0x4a24('0x6'));router[_0x4a24('0x7')]('/',auth['isAuthenticated'](),controller[_0x4a24('0x8')]);router[_0x4a24('0x7')](_0x4a24('0x9'),auth[_0x4a24('0xa')](),controller[_0x4a24('0xb')]);router[_0x4a24('0xc')]('/',auth['isAuthenticated'](),controller[_0x4a24('0xd')]);router[_0x4a24('0xe')](_0x4a24('0x9'),auth[_0x4a24('0xa')](),controller[_0x4a24('0xf')]);router[_0x4a24('0x10')]('/:id',auth[_0x4a24('0xa')](),controller['destroy']);module[_0x4a24('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 417dc5a..561dc04 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 _0xdebb=['sequelize','exports','name','STRING'];(function(_0xdc9e71,_0x5502b1){var _0x30e85=function(_0x13298b){while(--_0x13298b){_0xdc9e71['push'](_0xdc9e71['shift']());}};_0x30e85(++_0x5502b1);}(_0xdebb,0x1cc));var _0xbdeb=function(_0x2256d9,_0x54357e){_0x2256d9=_0x2256d9-0x0;var _0x28fb50=_0xdebb[_0x2256d9];return _0x28fb50;};'use strict';var Sequelize=require(_0xbdeb('0x0'));module[_0xbdeb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbdeb('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbdeb('0x3')]}}; \ No newline at end of file +var _0x51a7=['name','sequelize','exports','STRING'];(function(_0x5a25b6,_0x27f5d5){var _0x2414b0=function(_0x3dd5c7){while(--_0x3dd5c7){_0x5a25b6['push'](_0x5a25b6['shift']());}};_0x2414b0(++_0x27f5d5);}(_0x51a7,0x1b1));var _0x751a=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x51a7[_0x3ff685];return _0x2046c9;};'use strict';var Sequelize=require(_0x751a('0x0'));module[_0x751a('0x1')]={'name':{'type':Sequelize[_0x751a('0x2')],'unique':_0x751a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x751a('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index bee09d7..1176860 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 _0xe292=['include','rows','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','name','send','index','map','Pause','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x467c69,_0x1576f4){var _0x208599=function(_0x314b65){while(--_0x314b65){_0x467c69['push'](_0x467c69['shift']());}};_0x208599(++_0x1576f4);}(_0xe292,0x1bc));var _0x2e29=function(_0x5c3eff,_0x61c35e){_0x5c3eff=_0x5c3eff-0x0;var _0xc5f47c=_0xe292[_0x5c3eff];return _0xc5f47c;};'use strict';var emlformat=require(_0x2e29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e29('0x1'));var jsonpatch=require(_0x2e29('0x2'));var rp=require('request-promise');var moment=require(_0x2e29('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e29('0x4'));var path=require(_0x2e29('0x5'));var sox=require(_0x2e29('0x6'));var csv=require(_0x2e29('0x7'));var ejs=require(_0x2e29('0x8'));var fs=require('fs');var fs_extra=require(_0x2e29('0x9'));var _=require('lodash');var squel=require(_0x2e29('0xa'));var crypto=require(_0x2e29('0xb'));var jsforce=require(_0x2e29('0xc'));var deskjs=require(_0x2e29('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e29('0xe'));var Redis=require(_0x2e29('0xf'));var authService=require(_0x2e29('0x10'));var qs=require(_0x2e29('0x11'));var as=require(_0x2e29('0x12'));var hardwareService=require(_0x2e29('0x13'));var logger=require(_0x2e29('0x14'))(_0x2e29('0x15'));var utils=require(_0x2e29('0x16'));var config=require(_0x2e29('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e29('0x18'))['db'];function respondWithStatusCode(_0x50ad30,_0x4e6a54){_0x4e6a54=_0x4e6a54||0xcc;return function(_0x55f355){if(_0x55f355){return _0x50ad30[_0x2e29('0x19')](_0x4e6a54);}return _0x50ad30[_0x2e29('0x1a')](_0x4e6a54)['end']();};}function respondWithResult(_0x1a4214,_0x4c897a){_0x4c897a=_0x4c897a||0xc8;return function(_0xf16053){if(_0xf16053){return _0x1a4214[_0x2e29('0x1a')](_0x4c897a)['json'](_0xf16053);}};}function respondWithFilteredResult(_0x144a59,_0x3a7b8f){return function(_0xd9ff65){if(_0xd9ff65){var _0x2ff799=typeof _0x3a7b8f[_0x2e29('0x1b')]==='undefined'&&typeof _0x3a7b8f[_0x2e29('0x1c')]===_0x2e29('0x1d');var _0x517ea3=_0xd9ff65[_0x2e29('0x1e')];var _0x1f8920=_0x2ff799?0x0:_0x3a7b8f[_0x2e29('0x1b')];var _0x42a257=_0x2ff799?_0xd9ff65['count']:_0x3a7b8f[_0x2e29('0x1b')]+_0x3a7b8f['limit'];var _0x5a7ccb;if(_0x42a257>=_0x517ea3){_0x42a257=_0x517ea3;_0x5a7ccb=0xc8;}else{_0x5a7ccb=0xce;}_0x144a59[_0x2e29('0x1a')](_0x5a7ccb);return _0x144a59['set'](_0x2e29('0x1f'),_0x1f8920+'-'+_0x42a257+'/'+_0x517ea3)[_0x2e29('0x20')](_0xd9ff65);}return null;};}function patchUpdates(_0x1ac496){return function(_0x4b8c69){try{jsonpatch[_0x2e29('0x21')](_0x4b8c69,_0x1ac496,!![]);}catch(_0x57f73f){return BPromise[_0x2e29('0x22')](_0x57f73f);}return _0x4b8c69[_0x2e29('0x23')]();};}function saveUpdates(_0x43e3ff,_0x5259e6){return function(_0x3476ac){if(_0x3476ac){return _0x3476ac[_0x2e29('0x24')](_0x43e3ff)[_0x2e29('0x25')](function(_0x4c48dc){return _0x4c48dc;});}return null;};}function removeEntity(_0x1e2142,_0x667145){return function(_0x42df58){if(_0x42df58){return _0x42df58[_0x2e29('0x26')]()['then'](function(){var _0x1f30b9=_0x42df58[_0x2e29('0x27')]({'plain':!![]});var _0x5883d1='Pauses';return db[_0x2e29('0x28')][_0x2e29('0x26')]({'where':{'type':_0x5883d1,'resourceId':_0x1f30b9['id']}})[_0x2e29('0x25')](function(){return _0x42df58;});})[_0x2e29('0x25')](function(){_0x1e2142[_0x2e29('0x1a')](0xcc)[_0x2e29('0x29')]();});}};}function handleEntityNotFound(_0x413d3e,_0x265b70){return function(_0x3e78e0){if(!_0x3e78e0){_0x413d3e[_0x2e29('0x19')](0x194);}return _0x3e78e0;};}function handleError(_0x190877,_0x803980){_0x803980=_0x803980||0x1f4;return function(_0x5d9586){logger['error'](_0x5d9586['stack']);if(_0x5d9586[_0x2e29('0x2a')]){delete _0x5d9586[_0x2e29('0x2a')];}_0x190877['status'](_0x803980)[_0x2e29('0x2b')](_0x5d9586);};}exports[_0x2e29('0x2c')]=function(_0x2b81fd,_0x476fcc){var _0x545b4f={},_0x16c734={},_0x20e2ff={'count':0x0,'rows':[]};var _0x453c2d=_[_0x2e29('0x2d')](db[_0x2e29('0x2e')][_0x2e29('0x2f')],function(_0x3190a3){return{'name':_0x3190a3[_0x2e29('0x30')],'type':_0x3190a3[_0x2e29('0x31')]['key']};});_0x16c734[_0x2e29('0x32')]=_[_0x2e29('0x2d')](_0x453c2d,'name');_0x16c734[_0x2e29('0x33')]=_['keys'](_0x2b81fd[_0x2e29('0x33')]);_0x16c734[_0x2e29('0x34')]=_['intersection'](_0x16c734[_0x2e29('0x32')],_0x16c734[_0x2e29('0x33')]);_0x545b4f[_0x2e29('0x35')]=_[_0x2e29('0x36')](_0x16c734['model'],qs['fields'](_0x2b81fd[_0x2e29('0x33')][_0x2e29('0x37')]));_0x545b4f[_0x2e29('0x35')]=_0x545b4f[_0x2e29('0x35')][_0x2e29('0x38')]?_0x545b4f[_0x2e29('0x35')]:_0x16c734[_0x2e29('0x32')];if(!_0x2b81fd[_0x2e29('0x33')][_0x2e29('0x39')](_0x2e29('0x3a'))){_0x545b4f[_0x2e29('0x1c')]=qs[_0x2e29('0x1c')](_0x2b81fd[_0x2e29('0x33')][_0x2e29('0x1c')]);_0x545b4f[_0x2e29('0x1b')]=qs[_0x2e29('0x1b')](_0x2b81fd[_0x2e29('0x33')][_0x2e29('0x1b')]);}_0x545b4f[_0x2e29('0x3b')]=qs[_0x2e29('0x3c')](_0x2b81fd[_0x2e29('0x33')][_0x2e29('0x3c')]);_0x545b4f[_0x2e29('0x3d')]=qs['filters'](_[_0x2e29('0x3e')](_0x2b81fd[_0x2e29('0x33')],_0x16c734[_0x2e29('0x34')]),_0x453c2d);if(_0x2b81fd[_0x2e29('0x33')][_0x2e29('0x3f')]){_0x545b4f['where']=_['merge'](_0x545b4f[_0x2e29('0x3d')],{'$or':_[_0x2e29('0x2d')](_0x453c2d,function(_0x60d7ea){if(_0x60d7ea[_0x2e29('0x31')]!=='VIRTUAL'){var _0x1a8bb5={};_0x1a8bb5[_0x60d7ea[_0x2e29('0x2a')]]={'$like':'%'+_0x2b81fd['query']['filter']+'%'};return _0x1a8bb5;}})});}_0x545b4f=_[_0x2e29('0x40')]({},_0x545b4f,_0x2b81fd[_0x2e29('0x41')]);var _0x20160f={'where':_0x545b4f['where']};return db['Pause'][_0x2e29('0x1e')](_0x20160f)[_0x2e29('0x25')](function(_0x4a922f){_0x20e2ff[_0x2e29('0x1e')]=_0x4a922f;if(_0x2b81fd[_0x2e29('0x33')]['includeAll']){_0x545b4f[_0x2e29('0x42')]=[{'all':!![]}];}return db[_0x2e29('0x2e')]['findAll'](_0x545b4f);})[_0x2e29('0x25')](function(_0x5e71ef){_0x20e2ff[_0x2e29('0x43')]=_0x5e71ef;return _0x20e2ff;})[_0x2e29('0x25')](respondWithFilteredResult(_0x476fcc,_0x545b4f))[_0x2e29('0x44')](handleError(_0x476fcc,null));};exports[_0x2e29('0x45')]=function(_0x539418,_0x5ab6d0){var _0x3462a0={'raw':!![],'where':{'id':_0x539418['params']['id']}},_0x2db435={};_0x2db435[_0x2e29('0x32')]=_[_0x2e29('0x46')](db[_0x2e29('0x2e')][_0x2e29('0x2f')]);_0x2db435[_0x2e29('0x33')]=_[_0x2e29('0x46')](_0x539418[_0x2e29('0x33')]);_0x2db435[_0x2e29('0x34')]=_[_0x2e29('0x36')](_0x2db435[_0x2e29('0x32')],_0x2db435[_0x2e29('0x33')]);_0x3462a0[_0x2e29('0x35')]=_[_0x2e29('0x36')](_0x2db435[_0x2e29('0x32')],qs[_0x2e29('0x37')](_0x539418[_0x2e29('0x33')]['fields']));_0x3462a0[_0x2e29('0x35')]=_0x3462a0[_0x2e29('0x35')][_0x2e29('0x38')]?_0x3462a0[_0x2e29('0x35')]:_0x2db435[_0x2e29('0x32')];if(_0x539418['query'][_0x2e29('0x47')]){_0x3462a0[_0x2e29('0x42')]=[{'all':!![]}];}_0x3462a0=_[_0x2e29('0x40')]({},_0x3462a0,_0x539418[_0x2e29('0x41')]);return db[_0x2e29('0x2e')][_0x2e29('0x48')](_0x3462a0)[_0x2e29('0x25')](handleEntityNotFound(_0x5ab6d0,null))[_0x2e29('0x25')](respondWithResult(_0x5ab6d0,null))[_0x2e29('0x44')](handleError(_0x5ab6d0,null));};exports[_0x2e29('0x49')]=function(_0x39b471,_0x57bed6){return db[_0x2e29('0x2e')][_0x2e29('0x49')](_0x39b471[_0x2e29('0x4a')],{})[_0x2e29('0x25')](function(_0x2771a3){var _0x38fc3f=_0x39b471[_0x2e29('0x4b')][_0x2e29('0x27')]({'plain':!![]});if(!_0x38fc3f)throw new Error(_0x2e29('0x4c'));if(_0x38fc3f[_0x2e29('0x4d')]===_0x2e29('0x4b')){var _0x5ed7e6=_0x2771a3[_0x2e29('0x27')]({'plain':!![]});var _0x3aaaef=_0x2e29('0x4e');return db[_0x2e29('0x4f')]['find']({'where':{'name':_0x3aaaef,'userProfileId':_0x38fc3f[_0x2e29('0x50')]},'raw':!![]})[_0x2e29('0x25')](function(_0x6ebee8){if(_0x6ebee8&&_0x6ebee8[_0x2e29('0x51')]===0x0){return db[_0x2e29('0x28')][_0x2e29('0x49')]({'name':_0x5ed7e6['name'],'resourceId':_0x5ed7e6['id'],'type':_0x6ebee8[_0x2e29('0x2a')],'sectionId':_0x6ebee8['id']},{})['then'](function(){return _0x2771a3;});}else{return _0x2771a3;}})[_0x2e29('0x44')](function(_0xb76a2f){logger[_0x2e29('0x52')](_0x2e29('0x53'),_0xb76a2f);throw _0xb76a2f;});}return _0x2771a3;})['then'](respondWithResult(_0x57bed6,0xc9))[_0x2e29('0x44')](handleError(_0x57bed6,null));};exports['update']=function(_0x49735b,_0x61d125){if(_0x49735b[_0x2e29('0x4a')]['id']){delete _0x49735b['body']['id'];}return db['Pause'][_0x2e29('0x48')]({'where':{'id':_0x49735b[_0x2e29('0x54')]['id']}})[_0x2e29('0x25')](handleEntityNotFound(_0x61d125,null))[_0x2e29('0x25')](saveUpdates(_0x49735b[_0x2e29('0x4a')],null))[_0x2e29('0x25')](respondWithResult(_0x61d125,null))['catch'](handleError(_0x61d125,null));};exports['destroy']=function(_0x2c6c2d,_0x3ee14e){return db[_0x2e29('0x2e')][_0x2e29('0x48')]({'where':{'id':_0x2c6c2d[_0x2e29('0x54')]['id']}})[_0x2e29('0x25')](handleEntityNotFound(_0x3ee14e,null))[_0x2e29('0x25')](removeEntity(_0x3ee14e,null))['catch'](handleError(_0x3ee14e,null));}; \ No newline at end of file +var _0x77a6=['offset','count','set','Content-Range','json','reject','save','update','destroy','then','get','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Pause','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','undefined','limit'];(function(_0x4dd3c8,_0x1d566a){var _0xbdc9c2=function(_0x21e913){while(--_0x21e913){_0x4dd3c8['push'](_0x4dd3c8['shift']());}};_0xbdc9c2(++_0x1d566a);}(_0x77a6,0x177));var _0x677a=function(_0x37aa79,_0x39364d){_0x37aa79=_0x37aa79-0x0;var _0x235bee=_0x77a6[_0x37aa79];return _0x235bee;};'use strict';var emlformat=require(_0x677a('0x0'));var rimraf=require(_0x677a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x677a('0x2'));var moment=require(_0x677a('0x3'));var BPromise=require(_0x677a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x677a('0x5'));var sox=require('sox');var csv=require(_0x677a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x677a('0x7'));var _=require(_0x677a('0x8'));var squel=require('squel');var crypto=require(_0x677a('0x9'));var jsforce=require(_0x677a('0xa'));var deskjs=require(_0x677a('0xb'));var toCsv=require(_0x677a('0x6'));var querystring=require(_0x677a('0xc'));var Papa=require(_0x677a('0xd'));var Redis=require(_0x677a('0xe'));var authService=require(_0x677a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x677a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x677a('0x11'))(_0x677a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x677a('0x13'));var db=require(_0x677a('0x14'))['db'];function respondWithStatusCode(_0x5e7add,_0x33c121){_0x33c121=_0x33c121||0xcc;return function(_0x25bd83){if(_0x25bd83){return _0x5e7add['sendStatus'](_0x33c121);}return _0x5e7add[_0x677a('0x15')](_0x33c121)[_0x677a('0x16')]();};}function respondWithResult(_0x2ce471,_0x23fc30){_0x23fc30=_0x23fc30||0xc8;return function(_0x2ab2d4){if(_0x2ab2d4){return _0x2ce471[_0x677a('0x15')](_0x23fc30)['json'](_0x2ab2d4);}};}function respondWithFilteredResult(_0x757c3b,_0x3e74e4){return function(_0x569f1b){if(_0x569f1b){var _0x4da0ac=typeof _0x3e74e4['offset']===_0x677a('0x17')&&typeof _0x3e74e4[_0x677a('0x18')]===_0x677a('0x17');var _0x347cca=_0x569f1b['count'];var _0x206836=_0x4da0ac?0x0:_0x3e74e4[_0x677a('0x19')];var _0xdfd928=_0x4da0ac?_0x569f1b[_0x677a('0x1a')]:_0x3e74e4[_0x677a('0x19')]+_0x3e74e4['limit'];var _0x38556a;if(_0xdfd928>=_0x347cca){_0xdfd928=_0x347cca;_0x38556a=0xc8;}else{_0x38556a=0xce;}_0x757c3b[_0x677a('0x15')](_0x38556a);return _0x757c3b[_0x677a('0x1b')](_0x677a('0x1c'),_0x206836+'-'+_0xdfd928+'/'+_0x347cca)[_0x677a('0x1d')](_0x569f1b);}return null;};}function patchUpdates(_0x367d28){return function(_0x268666){try{jsonpatch['apply'](_0x268666,_0x367d28,!![]);}catch(_0x176ea7){return BPromise[_0x677a('0x1e')](_0x176ea7);}return _0x268666[_0x677a('0x1f')]();};}function saveUpdates(_0x5da0c8,_0xb6c84a){return function(_0x1fb768){if(_0x1fb768){return _0x1fb768[_0x677a('0x20')](_0x5da0c8)['then'](function(_0x502654){return _0x502654;});}return null;};}function removeEntity(_0x362588,_0x3896b0){return function(_0x7736a7){if(_0x7736a7){return _0x7736a7[_0x677a('0x21')]()[_0x677a('0x22')](function(){var _0x5c74f9=_0x7736a7[_0x677a('0x23')]({'plain':!![]});var _0x59cc28=_0x677a('0x24');return db[_0x677a('0x25')][_0x677a('0x21')]({'where':{'type':_0x59cc28,'resourceId':_0x5c74f9['id']}})['then'](function(){return _0x7736a7;});})[_0x677a('0x22')](function(){_0x362588[_0x677a('0x15')](0xcc)[_0x677a('0x16')]();});}};}function handleEntityNotFound(_0x140cca,_0x31b58f){return function(_0x21fddc){if(!_0x21fddc){_0x140cca[_0x677a('0x26')](0x194);}return _0x21fddc;};}function handleError(_0x1f64ef,_0x56a4f9){_0x56a4f9=_0x56a4f9||0x1f4;return function(_0x3cb139){logger['error'](_0x3cb139[_0x677a('0x27')]);if(_0x3cb139[_0x677a('0x28')]){delete _0x3cb139[_0x677a('0x28')];}_0x1f64ef[_0x677a('0x15')](_0x56a4f9)[_0x677a('0x29')](_0x3cb139);};}exports[_0x677a('0x2a')]=function(_0x5afe25,_0x333ebb){var _0x1f364a={},_0x2bc9ce={},_0x3b0edc={'count':0x0,'rows':[]};var _0x458a41=_[_0x677a('0x2b')](db['Pause']['rawAttributes'],function(_0x52b3be){return{'name':_0x52b3be['fieldName'],'type':_0x52b3be[_0x677a('0x2c')][_0x677a('0x2d')]};});_0x2bc9ce[_0x677a('0x2e')]=_[_0x677a('0x2b')](_0x458a41,_0x677a('0x28'));_0x2bc9ce['query']=_['keys'](_0x5afe25[_0x677a('0x2f')]);_0x2bc9ce['filters']=_[_0x677a('0x30')](_0x2bc9ce['model'],_0x2bc9ce[_0x677a('0x2f')]);_0x1f364a[_0x677a('0x31')]=_['intersection'](_0x2bc9ce['model'],qs[_0x677a('0x32')](_0x5afe25['query'][_0x677a('0x32')]));_0x1f364a[_0x677a('0x31')]=_0x1f364a[_0x677a('0x31')][_0x677a('0x33')]?_0x1f364a['attributes']:_0x2bc9ce[_0x677a('0x2e')];if(!_0x5afe25[_0x677a('0x2f')][_0x677a('0x34')](_0x677a('0x35'))){_0x1f364a[_0x677a('0x18')]=qs[_0x677a('0x18')](_0x5afe25[_0x677a('0x2f')][_0x677a('0x18')]);_0x1f364a['offset']=qs[_0x677a('0x19')](_0x5afe25[_0x677a('0x2f')][_0x677a('0x19')]);}_0x1f364a[_0x677a('0x36')]=qs[_0x677a('0x37')](_0x5afe25[_0x677a('0x2f')][_0x677a('0x37')]);_0x1f364a[_0x677a('0x38')]=qs[_0x677a('0x39')](_[_0x677a('0x3a')](_0x5afe25['query'],_0x2bc9ce['filters']),_0x458a41);if(_0x5afe25[_0x677a('0x2f')][_0x677a('0x3b')]){_0x1f364a[_0x677a('0x38')]=_['merge'](_0x1f364a[_0x677a('0x38')],{'$or':_[_0x677a('0x2b')](_0x458a41,function(_0x5dd97a){if(_0x5dd97a[_0x677a('0x2c')]!==_0x677a('0x3c')){var _0x4b0f02={};_0x4b0f02[_0x5dd97a[_0x677a('0x28')]]={'$like':'%'+_0x5afe25['query'][_0x677a('0x3b')]+'%'};return _0x4b0f02;}})});}_0x1f364a=_[_0x677a('0x3d')]({},_0x1f364a,_0x5afe25[_0x677a('0x3e')]);var _0xe117f9={'where':_0x1f364a[_0x677a('0x38')]};return db[_0x677a('0x3f')]['count'](_0xe117f9)['then'](function(_0x52b7ff){_0x3b0edc[_0x677a('0x1a')]=_0x52b7ff;if(_0x5afe25[_0x677a('0x2f')][_0x677a('0x40')]){_0x1f364a[_0x677a('0x41')]=[{'all':!![]}];}return db[_0x677a('0x3f')][_0x677a('0x42')](_0x1f364a);})[_0x677a('0x22')](function(_0x5e3cf0){_0x3b0edc[_0x677a('0x43')]=_0x5e3cf0;return _0x3b0edc;})[_0x677a('0x22')](respondWithFilteredResult(_0x333ebb,_0x1f364a))[_0x677a('0x44')](handleError(_0x333ebb,null));};exports[_0x677a('0x45')]=function(_0x2fdcb8,_0x30cfe0){var _0x2b4519={'raw':!![],'where':{'id':_0x2fdcb8[_0x677a('0x46')]['id']}},_0x3f098c={};_0x3f098c[_0x677a('0x2e')]=_[_0x677a('0x47')](db['Pause'][_0x677a('0x48')]);_0x3f098c[_0x677a('0x2f')]=_['keys'](_0x2fdcb8[_0x677a('0x2f')]);_0x3f098c[_0x677a('0x39')]=_['intersection'](_0x3f098c[_0x677a('0x2e')],_0x3f098c[_0x677a('0x2f')]);_0x2b4519[_0x677a('0x31')]=_[_0x677a('0x30')](_0x3f098c[_0x677a('0x2e')],qs[_0x677a('0x32')](_0x2fdcb8[_0x677a('0x2f')][_0x677a('0x32')]));_0x2b4519['attributes']=_0x2b4519[_0x677a('0x31')][_0x677a('0x33')]?_0x2b4519[_0x677a('0x31')]:_0x3f098c[_0x677a('0x2e')];if(_0x2fdcb8[_0x677a('0x2f')]['includeAll']){_0x2b4519[_0x677a('0x41')]=[{'all':!![]}];}_0x2b4519=_[_0x677a('0x3d')]({},_0x2b4519,_0x2fdcb8[_0x677a('0x3e')]);return db[_0x677a('0x3f')][_0x677a('0x49')](_0x2b4519)[_0x677a('0x22')](handleEntityNotFound(_0x30cfe0,null))['then'](respondWithResult(_0x30cfe0,null))[_0x677a('0x44')](handleError(_0x30cfe0,null));};exports[_0x677a('0x4a')]=function(_0x5e7dbf,_0x23fe7f){return db['Pause'][_0x677a('0x4a')](_0x5e7dbf[_0x677a('0x4b')],{})['then'](function(_0x522058){var _0x2d7a9a=_0x5e7dbf[_0x677a('0x4c')][_0x677a('0x23')]({'plain':!![]});if(!_0x2d7a9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d7a9a['role']===_0x677a('0x4c')){var _0x543205=_0x522058['get']({'plain':!![]});var _0x2776cd=_0x677a('0x24');return db[_0x677a('0x4d')][_0x677a('0x49')]({'where':{'name':_0x2776cd,'userProfileId':_0x2d7a9a['userProfileId']},'raw':!![]})[_0x677a('0x22')](function(_0x6c8653){if(_0x6c8653&&_0x6c8653[_0x677a('0x4e')]===0x0){return db[_0x677a('0x25')][_0x677a('0x4a')]({'name':_0x543205[_0x677a('0x28')],'resourceId':_0x543205['id'],'type':_0x6c8653[_0x677a('0x28')],'sectionId':_0x6c8653['id']},{})['then'](function(){return _0x522058;});}else{return _0x522058;}})[_0x677a('0x44')](function(_0x275702){logger['error'](_0x677a('0x4f'),_0x275702);throw _0x275702;});}return _0x522058;})['then'](respondWithResult(_0x23fe7f,0xc9))[_0x677a('0x44')](handleError(_0x23fe7f,null));};exports[_0x677a('0x20')]=function(_0x3a42ea,_0x341052){if(_0x3a42ea[_0x677a('0x4b')]['id']){delete _0x3a42ea[_0x677a('0x4b')]['id'];}return db[_0x677a('0x3f')]['find']({'where':{'id':_0x3a42ea[_0x677a('0x46')]['id']}})[_0x677a('0x22')](handleEntityNotFound(_0x341052,null))[_0x677a('0x22')](saveUpdates(_0x3a42ea[_0x677a('0x4b')],null))[_0x677a('0x22')](respondWithResult(_0x341052,null))['catch'](handleError(_0x341052,null));};exports[_0x677a('0x21')]=function(_0x53e0a1,_0xf86e60){return db[_0x677a('0x3f')]['find']({'where':{'id':_0x53e0a1[_0x677a('0x46')]['id']}})[_0x677a('0x22')](handleEntityNotFound(_0xf86e60,null))[_0x677a('0x22')](removeEntity(_0xf86e60,null))['catch'](handleError(_0xf86e60,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ed0a441..c2d4ddf 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x3237d0,_0x2d295d){var _0x4e92a3=function(_0x566c20){while(--_0x566c20){_0x3237d0['push'](_0x3237d0['shift']());}};_0x4e92a3(++_0x2d295d);}(_0x814b,0x1a2));var _0xb814=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0x814b[_0x17fea7];return _0x3150c3;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 4bbedfc..1e354c7 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(_0x3a49e5,_0x2a6321){var _0x3d7224=function(_0x2daa02){while(--_0x2daa02){_0x3a49e5['push'](_0x3a49e5['shift']());}};_0x3d7224(++_0x2a6321);}(_0x7a54,0x106));var _0x47a5=function(_0x444eb4,_0x396e7){_0x444eb4=_0x444eb4-0x0;var _0x3041d0=_0x7a54[_0x444eb4];return _0x3041d0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5837a4,_0x30eaf5){var _0x271f40=function(_0x4461df){while(--_0x4461df){_0x5837a4['push'](_0x5837a4['shift']());}};_0x271f40(++_0x30eaf5);}(_0x7a54,0x106));var _0x47a5=function(_0x4a95ac,_0x453ec3){_0x4a95ac=_0x4a95ac-0x0;var _0x34d8b0=_0x7a54[_0x4a95ac];return _0x34d8b0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 29b4d29..691c516 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 _0xe14d=['isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x5a94af,_0x548782){var _0x31ee8a=function(_0x581640){while(--_0x581640){_0x5a94af['push'](_0x5a94af['shift']());}};_0x31ee8a(++_0x548782);}(_0xe14d,0x1ee));var _0xde14=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe14d[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/webhook',controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde14('0x10')]({'destination':function(_0xe785fb,_0x417269,_0x4357c7){_0x4357c7(null,path[_0xde14('0x11')](config[_0xde14('0x12')],_0xde14('0x13')));},'filename':function(_0x3d5a29,_0x34e28f,_0x29e3ca){_0x34e28f[_0xde14('0x14')]=_0x34e28f[_0xde14('0x14')][_0xde14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e3ca(null,util[_0xde14('0x16')](_0xde14('0x17'),path['basename'](_0x34e28f['originalname'],path[_0xde14('0x18')](_0x34e28f[_0xde14('0x14')])),Date[_0xde14('0x19')](),path['extname'](_0x34e28f[_0xde14('0x14')])));}})});router[_0xde14('0x1a')]('/',upload[_0xde14('0x1b')](_0xde14('0x1c')),controller[_0xde14('0x1d')]);router[_0xde14('0x1a')](_0xde14('0x1e'),controller[_0xde14('0x1f')]);router[_0xde14('0x20')](_0xde14('0xd'),auth['isAuthenticated'](),controller[_0xde14('0x21')]);router[_0xde14('0x22')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller['delete']);module[_0xde14('0x23')]=router; \ No newline at end of file +var _0x2d17=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','/webhook','put','isAuthenticated','delete','exports','multer','util'];(function(_0x1fb966,_0x35e019){var _0x97f57f=function(_0xd0bc34){while(--_0xd0bc34){_0x1fb966['push'](_0x1fb966['shift']());}};_0x97f57f(++_0x35e019);}(_0x2d17,0x17e));var _0x72d1=function(_0x26364e,_0x177735){_0x26364e=_0x26364e-0x0;var _0x38a5ee=_0x2d17[_0x26364e];return _0x38a5ee;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./plugin.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/webhook',controller[_0x72d1('0x9')]);router[_0x72d1('0x7')](_0x72d1('0xa'),auth['isAuthenticated'](),controller[_0x72d1('0xb')]);router[_0x72d1('0x7')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);var upload=multer({'storage':multer[_0x72d1('0xe')]({'destination':function(_0x45eb4a,_0x14a41e,_0x3cb9c2){_0x3cb9c2(null,path[_0x72d1('0xf')](config[_0x72d1('0x10')],_0x72d1('0x11')));},'filename':function(_0x273ccf,_0x2f5a78,_0x5ad4df){_0x2f5a78[_0x72d1('0x12')]=_0x2f5a78[_0x72d1('0x12')][_0x72d1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ad4df(null,util[_0x72d1('0x14')](_0x72d1('0x15'),path[_0x72d1('0x16')](_0x2f5a78[_0x72d1('0x12')],path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])),Date[_0x72d1('0x18')](),path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])));}})});router[_0x72d1('0x19')]('/',upload['single'](_0x72d1('0x1a')),controller['upload']);router[_0x72d1('0x19')](_0x72d1('0x1b'),controller['webhookPost']);router[_0x72d1('0x1c')](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller['update']);router['delete'](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller[_0x72d1('0x1e')]);module[_0x72d1('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a19cc25..92e285a 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 _0x1111=['sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x165082,_0x207ae8){var _0x21989b=function(_0x3bec8b){while(--_0x3bec8b){_0x165082['push'](_0x165082['shift']());}};_0x21989b(++_0x207ae8);}(_0x1111,0x9a));var _0x1111=function(_0x5495b5,_0x1569f1){_0x5495b5=_0x5495b5-0x0;var _0x4ab61c=_0x1111[_0x5495b5];return _0x4ab61c;};'use strict';var Sequelize=require(_0x1111('0x0'));module[_0x1111('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1111('0x2')](_0x1111('0x3'),_0x1111('0x4'))},'description':{'type':Sequelize[_0x1111('0x5')]},'version':{'type':Sequelize[_0x1111('0x5')]},'path':{'type':Sequelize[_0x1111('0x6')],'comment':_0x1111('0x7')},'active':{'type':Sequelize[_0x1111('0x8')],'defaultValue':0x0,'comment':_0x1111('0x9')},'sidebar':{'type':Sequelize[_0x1111('0x2')](_0x1111('0xa'),'agentOnly',_0x1111('0xb'),_0x1111('0xc')),'defaultValue':_0x1111('0xb'),'comment':_0x1111('0xd')},'icon':{'type':Sequelize[_0x1111('0x6')]},'adminUrl':{'type':Sequelize[_0x1111('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x1111('0x6')]},'scriptPath':{'type':Sequelize[_0x1111('0x6')]}}; \ No newline at end of file +var _0x17cd=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','html','script','TEXT'];(function(_0x4663cf,_0x4045b2){var _0x5e7f76=function(_0x1e01ae){while(--_0x1e01ae){_0x4663cf['push'](_0x4663cf['shift']());}};_0x5e7f76(++_0x4045b2);}(_0x17cd,0xa2));var _0xd17c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x17cd[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xd17c('0x0'),_0xd17c('0x1'))},'description':{'type':Sequelize[_0xd17c('0x2')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd17c('0x3')],'comment':_0xd17c('0x4')},'active':{'type':Sequelize[_0xd17c('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xd17c('0x6')](_0xd17c('0x7'),_0xd17c('0x8'),_0xd17c('0x9'),'never'),'defaultValue':_0xd17c('0x9'),'comment':_0xd17c('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd17c('0x3')]},'agentUrl':{'type':Sequelize[_0xd17c('0x3')]},'scriptName':{'type':Sequelize[_0xd17c('0x3')]},'scriptPath':{'type':Sequelize[_0xd17c('0x3')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 702cb37..721e005 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 _0xa19c=['name','send','map','Plugin','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','download','path','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','get','UserProfileResource','destroy','sendStatus','stack'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa19c,0x1d3));var _0xca19=function(_0x3f3f40,_0x4e745f){_0x3f3f40=_0x3f3f40-0x0;var _0x32c366=_0xa19c[_0x3f3f40];return _0x32c366;};'use strict';var emlformat=require(_0xca19('0x0'));var rimraf=require(_0xca19('0x1'));var zipdir=require(_0xca19('0x2'));var jsonpatch=require(_0xca19('0x3'));var rp=require(_0xca19('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca19('0x5'));var path=require('path');var sox=require(_0xca19('0x6'));var csv=require(_0xca19('0x7'));var ejs=require(_0xca19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca19('0x9'));var squel=require(_0xca19('0xa'));var crypto=require(_0xca19('0xb'));var jsforce=require(_0xca19('0xc'));var deskjs=require(_0xca19('0xd'));var toCsv=require(_0xca19('0x7'));var querystring=require('querystring');var Papa=require(_0xca19('0xe'));var extract=require(_0xca19('0xf'));var rimraf=require(_0xca19('0x1'));var archiver=require('archiver');var Redis=require(_0xca19('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xca19('0x11'));var as=require(_0xca19('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca19('0x13'))(_0xca19('0x14'));var utils=require(_0xca19('0x15'));var config=require(_0xca19('0x16'));var licenseUtil=require(_0xca19('0x17'));var db=require('../../mysqldb')['db'];config[_0xca19('0x18')]=_[_0xca19('0x19')](config[_0xca19('0x18')],{'host':_0xca19('0x1a'),'port':0x18eb});var socket=require(_0xca19('0x1b'))(new Redis(config[_0xca19('0x18')]));require('./plugin.socket')[_0xca19('0x1c')](socket);function respondWithStatusCode(_0x3b543f,_0x167543){_0x167543=_0x167543||0xcc;return function(_0x1d423b){if(_0x1d423b){return _0x3b543f['sendStatus'](_0x167543);}return _0x3b543f[_0xca19('0x1d')](_0x167543)[_0xca19('0x1e')]();};}function respondWithResult(_0x4cd817,_0x1a32ac){_0x1a32ac=_0x1a32ac||0xc8;return function(_0x397b2e){if(_0x397b2e){return _0x4cd817['status'](_0x1a32ac)[_0xca19('0x1f')](_0x397b2e);}};}function respondWithFilteredResult(_0x2f8f5f,_0x38d3b6){return function(_0x115882){if(_0x115882){var _0x19b1d2=typeof _0x38d3b6[_0xca19('0x20')]==='undefined'&&typeof _0x38d3b6[_0xca19('0x21')]===_0xca19('0x22');var _0xd9d1ca=_0x115882[_0xca19('0x23')];var _0x2a9565=_0x19b1d2?0x0:_0x38d3b6[_0xca19('0x20')];var _0xb2d8e8=_0x19b1d2?_0x115882[_0xca19('0x23')]:_0x38d3b6[_0xca19('0x20')]+_0x38d3b6[_0xca19('0x21')];var _0x139a0f;if(_0xb2d8e8>=_0xd9d1ca){_0xb2d8e8=_0xd9d1ca;_0x139a0f=0xc8;}else{_0x139a0f=0xce;}_0x2f8f5f[_0xca19('0x1d')](_0x139a0f);return _0x2f8f5f[_0xca19('0x24')]('Content-Range',_0x2a9565+'-'+_0xb2d8e8+'/'+_0xd9d1ca)[_0xca19('0x1f')](_0x115882);}return null;};}function patchUpdates(_0x196079){return function(_0x105878){try{jsonpatch[_0xca19('0x25')](_0x105878,_0x196079,!![]);}catch(_0x161fee){return BPromise[_0xca19('0x26')](_0x161fee);}return _0x105878[_0xca19('0x27')]();};}function saveUpdates(_0x36670e,_0x1e6b57){return function(_0x1753ef){if(_0x1753ef){return _0x1753ef['update'](_0x36670e)[_0xca19('0x28')](function(_0x30d990){return _0x30d990;});}return null;};}function removeEntity(_0x15296a,_0x14c7e1){return function(_0x28b655){if(_0x28b655){return _0x28b655['destroy']()[_0xca19('0x28')](function(){var _0x3df2a9=_0x28b655[_0xca19('0x29')]({'plain':!![]});var _0x2429c7='Plugins';return db[_0xca19('0x2a')][_0xca19('0x2b')]({'where':{'type':_0x2429c7,'resourceId':_0x3df2a9['id']}})[_0xca19('0x28')](function(){return _0x28b655;});})[_0xca19('0x28')](function(){_0x15296a[_0xca19('0x1d')](0xcc)[_0xca19('0x1e')]();});}};}function handleEntityNotFound(_0x336eff,_0x55926c){return function(_0x48189a){if(!_0x48189a){_0x336eff[_0xca19('0x2c')](0x194);}return _0x48189a;};}function handleError(_0x198ff6,_0x239223){_0x239223=_0x239223||0x1f4;return function(_0x30f246){logger['error'](_0x30f246[_0xca19('0x2d')]);if(_0x30f246['name']){delete _0x30f246[_0xca19('0x2e')];}_0x198ff6['status'](_0x239223)[_0xca19('0x2f')](_0x30f246);};}exports['index']=function(_0xb4d45f,_0x324ac7){var _0x227982={},_0x495e42={},_0x310727={'count':0x0,'rows':[]};var _0x35fd00=_[_0xca19('0x30')](db[_0xca19('0x31')][_0xca19('0x32')],function(_0x343cb9){return{'name':_0x343cb9['fieldName'],'type':_0x343cb9[_0xca19('0x33')][_0xca19('0x34')]};});_0x495e42[_0xca19('0x35')]=_['map'](_0x35fd00,'name');_0x495e42[_0xca19('0x36')]=_['keys'](_0xb4d45f[_0xca19('0x36')]);_0x495e42[_0xca19('0x37')]=_[_0xca19('0x38')](_0x495e42[_0xca19('0x35')],_0x495e42['query']);_0x227982['attributes']=_[_0xca19('0x38')](_0x495e42['model'],qs['fields'](_0xb4d45f[_0xca19('0x36')][_0xca19('0x39')]));_0x227982[_0xca19('0x3a')]=_0x227982[_0xca19('0x3a')][_0xca19('0x3b')]?_0x227982[_0xca19('0x3a')]:_0x495e42[_0xca19('0x35')];if(!_0xb4d45f[_0xca19('0x36')][_0xca19('0x3c')](_0xca19('0x3d'))){_0x227982[_0xca19('0x21')]=qs[_0xca19('0x21')](_0xb4d45f[_0xca19('0x36')]['limit']);_0x227982['offset']=qs[_0xca19('0x20')](_0xb4d45f[_0xca19('0x36')][_0xca19('0x20')]);}_0x227982[_0xca19('0x3e')]=qs[_0xca19('0x3f')](_0xb4d45f[_0xca19('0x36')][_0xca19('0x3f')]);_0x227982[_0xca19('0x40')]=qs['filters'](_[_0xca19('0x41')](_0xb4d45f[_0xca19('0x36')],_0x495e42[_0xca19('0x37')]),_0x35fd00);if(_0xb4d45f[_0xca19('0x36')]['filter']){_0x227982[_0xca19('0x40')]=_[_0xca19('0x42')](_0x227982[_0xca19('0x40')],{'$or':_[_0xca19('0x30')](_0x35fd00,function(_0x4f8087){if(_0x4f8087[_0xca19('0x33')]!==_0xca19('0x43')){var _0x1817dc={};_0x1817dc[_0x4f8087['name']]={'$like':'%'+_0xb4d45f['query']['filter']+'%'};return _0x1817dc;}})});}_0x227982=_[_0xca19('0x42')]({},_0x227982,_0xb4d45f['options']);var _0x5560db={'where':_0x227982[_0xca19('0x40')]};return db['Plugin'][_0xca19('0x23')](_0x5560db)[_0xca19('0x28')](function(_0x4a6977){_0x310727[_0xca19('0x23')]=_0x4a6977;if(_0xb4d45f[_0xca19('0x36')][_0xca19('0x44')]){_0x227982[_0xca19('0x45')]=[{'all':!![]}];}return db[_0xca19('0x31')][_0xca19('0x46')](_0x227982);})[_0xca19('0x28')](function(_0x51a42e){_0x310727[_0xca19('0x47')]=_0x51a42e;return _0x310727;})[_0xca19('0x28')](respondWithFilteredResult(_0x324ac7,_0x227982))[_0xca19('0x48')](handleError(_0x324ac7,null));};exports[_0xca19('0x49')]=function(_0x24fceb,_0x9b0d0b){var _0x859ae0={'raw':!![],'where':{'id':_0x24fceb[_0xca19('0x4a')]['id']}},_0x19fbf0={};_0x19fbf0[_0xca19('0x35')]=_[_0xca19('0x4b')](db[_0xca19('0x31')]['rawAttributes']);_0x19fbf0[_0xca19('0x36')]=_['keys'](_0x24fceb[_0xca19('0x36')]);_0x19fbf0[_0xca19('0x37')]=_['intersection'](_0x19fbf0[_0xca19('0x35')],_0x19fbf0['query']);_0x859ae0['attributes']=_[_0xca19('0x38')](_0x19fbf0[_0xca19('0x35')],qs[_0xca19('0x39')](_0x24fceb['query']['fields']));_0x859ae0[_0xca19('0x3a')]=_0x859ae0[_0xca19('0x3a')][_0xca19('0x3b')]?_0x859ae0[_0xca19('0x3a')]:_0x19fbf0['model'];if(_0x24fceb['query'][_0xca19('0x44')]){_0x859ae0[_0xca19('0x45')]=[{'all':!![]}];}_0x859ae0=_['merge']({},_0x859ae0,_0x24fceb[_0xca19('0x4c')]);return db[_0xca19('0x31')][_0xca19('0x4d')](_0x859ae0)['then'](handleEntityNotFound(_0x9b0d0b,null))[_0xca19('0x28')](respondWithResult(_0x9b0d0b,null))[_0xca19('0x48')](handleError(_0x9b0d0b,null));};exports[_0xca19('0x4e')]=function(_0x16a3e4,_0x303fb3,_0x1dc174){return db[_0xca19('0x31')][_0xca19('0x4d')]({'where':{'id':_0x16a3e4[_0xca19('0x4a')]['id']},'attributes':[_0xca19('0x2e'),_0xca19('0x4f')],'raw':!![]})[_0xca19('0x28')](handleEntityNotFound(_0x303fb3,null))[_0xca19('0x28')](function(_0x15e3f3){if(_0x15e3f3){var _0xccf8ff=path[_0xca19('0x50')](config[_0xca19('0x51')],_0xca19('0x52'),util[_0xca19('0x53')](_0xca19('0x54'),path[_0xca19('0x55')](_0x15e3f3['path'])));var _0x1f528b=fs['createWriteStream'](_0xccf8ff);var _0x3a183d=archiver(_0xca19('0x56'),{'zlib':{'level':0x9}});_0x3a183d['on'](_0xca19('0x57'),function(_0x181319){if(_0x181319[_0xca19('0x58')]===_0xca19('0x59')){logger[_0xca19('0x5a')](_0x181319);}else{throw new db['Sequelize'][(_0xca19('0x5b'))](_0xca19('0x5c'));}});_0x3a183d['on'](_0xca19('0x5a'),function(_0x3c0763){throw new db[(_0xca19('0x5d'))]['Error'](_0xca19('0x5c'));});_0x3a183d['pipe'](_0x1f528b);_0x3a183d[_0xca19('0x5e')]('**/*',{'cwd':path[_0xca19('0x50')](config[_0xca19('0x51')],_0xca19('0x52'),path[_0xca19('0x5f')](_0x15e3f3[_0xca19('0x4f')])),'ignore':[path[_0xca19('0x50')](path[_0xca19('0x55')](_0x15e3f3[_0xca19('0x4f')]),_0xca19('0x60')),path[_0xca19('0x50')](path[_0xca19('0x55')](_0x15e3f3[_0xca19('0x4f')]),_0xca19('0x61'))],'nodir':!![]})[_0xca19('0x62')]();_0x1f528b['on']('close',function(){if(!fs[_0xca19('0x63')](_0xccf8ff)){throw new db[(_0xca19('0x5d'))]['Error'](_0xca19('0x64'));}return _0x303fb3[_0xca19('0x4e')](_0xccf8ff,util[_0xca19('0x53')](_0xca19('0x54'),path[_0xca19('0x55')](_0x15e3f3[_0xca19('0x4f')])),function(_0xd42ce){if(_0xd42ce){throw new db[(_0xca19('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xca19('0x65')](_0xccf8ff);logger[_0xca19('0x66')]('Download\x20completed');logger[_0xca19('0x66')](_0xca19('0x67'));});});}return null;})[_0xca19('0x48')](handleError(_0x303fb3,null));};exports[_0xca19('0x68')]=function(_0x2d979d,_0x1f9ee2,_0x414b8e){var _0x455ff8=path[_0xca19('0x55')](_0x2d979d[_0xca19('0x69')]['filename'],path[_0xca19('0x6a')](_0x2d979d['file']['filename']));var _0x2c609e=path['join'](config[_0xca19('0x51')],_0xca19('0x52'),_0x2d979d[_0xca19('0x69')][_0xca19('0x6b')]);var _0xa9a587=path[_0xca19('0x50')](config[_0xca19('0x51')],_0xca19('0x52'),_0x455ff8);logger[_0xca19('0x66')](_0xca19('0x6c'),_0x2c609e);logger[_0xca19('0x66')](_0xca19('0x6d'),_0xa9a587);try{fs[_0xca19('0x6e')](_0x2c609e,parseInt(_0xca19('0x6f'),0x8));extract(_0x2c609e,{'dir':_0xa9a587},function(_0x213277){if(_0x213277){logger[_0xca19('0x5a')](_0x213277);handleError(_0x213277,!![]);};var _0x2f2be1=fs[_0xca19('0x70')](_0xa9a587);if(_0x2f2be1[_0xca19('0x3b')]>0x1){removeReferences(_0x2c609e,_0xa9a587);logger[_0xca19('0x5a')](_0xca19('0x71'));return _0x414b8e(new Error(_0xca19('0x71')));}var _0x45a35b=fs[_0xca19('0x72')](path[_0xca19('0x50')](_0xa9a587,_0x2f2be1[0x0]));if(_0x45a35b[_0xca19('0x73')]()){removeReferences(_0x2c609e,_0xa9a587);logger[_0xca19('0x5a')](_0xca19('0x71'));return _0x414b8e(new Error(_0xca19('0x71')));}if(_0x45a35b['isDirectory']()){var _0x59492d=fs['readdirSync'](path[_0xca19('0x50')](_0xa9a587,_0x2f2be1[0x0]));if(_0x59492d['length']===0x0){removeReferences(_0x2c609e,_0xa9a587);logger[_0xca19('0x5a')]('Invalid\x20plugin\x20structure');return _0x414b8e(new Error(_0xca19('0x71')));}var _0x146532=_0x59492d[_0xca19('0x74')](function(_0x37bba6){return _0x37bba6===_0xca19('0x75');});if(!_0x146532){return _0x414b8e(new Error(_0xca19('0x76')));}var _0x374421=fs[_0xca19('0x77')](path[_0xca19('0x50')](_0xa9a587,_0x2f2be1[0x0],'manifest.json'));var _0x25dfb7=JSON[_0xca19('0x78')](_0x374421);if(_0xca19('0x22')==typeof _0x25dfb7['name']){return _0x414b8e(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xca19('0x22')==typeof _0x25dfb7['type']){return _0x414b8e(new Error(_0xca19('0x79')));}if(_0xca19('0x22')==typeof _0x25dfb7[_0xca19('0x7a')]){return _0x414b8e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x25dfb7[_0xca19('0x7b')]){return _0x414b8e(new Error(_0xca19('0x7c')));}if(_0x25dfb7['type']===_0xca19('0x7d')){if(_0xca19('0x22')==typeof _0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')]){return _0x414b8e(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xca19('0x22')==typeof _0x25dfb7[_0xca19('0x7b')]['views'][_0xca19('0x7f')]&&_0xca19('0x22')==typeof _0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')][_0xca19('0x80')]){return _0x414b8e(new Error(_0xca19('0x81')));}}else if(_0x25dfb7[_0xca19('0x33')]==='script'){if(_0xca19('0x22')==typeof _0x25dfb7[_0xca19('0x7b')][_0xca19('0x82')]){return _0x414b8e(new Error(_0xca19('0x83')));}if(_0xca19('0x22')==typeof _0x25dfb7['parameters'][_0xca19('0x84')]){return _0x414b8e(new Error(_0xca19('0x85')));}}else{return _0x414b8e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x505936=_0x25dfb7[_0xca19('0x2e')];var _0x5b5aa2=_0x25dfb7['description'];var _0x51d281=_0x25dfb7[_0xca19('0x33')];var _0x24b5c6=_0x25dfb7[_0xca19('0x86')]?_0x25dfb7[_0xca19('0x86')]:_0xca19('0x87');var _0x5bd022=_0x25dfb7[_0xca19('0x88')]?_0x25dfb7[_0xca19('0x88')]:'icon-apps';var _0x26fc20='';var _0x45ec65='';var _0x592cb3='';var _0x774e4f='';var _0x5ee067=_0x25dfb7[_0xca19('0x7a')];if(_0x51d281===_0xca19('0x7d')){if('undefined'!=typeof _0x25dfb7[_0xca19('0x7b')]['views']['admin']){var _0x52bebd=_0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')][_0xca19('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x52bebd)){_0x26fc20=path['join'](_0xca19('0x89'),_0x455ff8,_0x2f2be1[0x0],_0x52bebd);}else{_0x26fc20=_0x52bebd;}}else{logger['info'](_0xca19('0x8a'));}if('undefined'!=typeof _0x25dfb7[_0xca19('0x7b')]['views']['agent']){var _0x4629df=_0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xca19('0x8b')](_0x4629df)){_0x45ec65=path[_0xca19('0x50')]('plugins',_0x455ff8,_0x2f2be1[0x0],_0x4629df);}else{_0x45ec65=_0x4629df;}}else{logger[_0xca19('0x66')](_0xca19('0x8c'));}}else if(_0x51d281===_0xca19('0x8d')){_0x592cb3=_0x25dfb7[_0xca19('0x7b')]['scriptName'];_0x774e4f=_0x25dfb7[_0xca19('0x7b')][_0xca19('0x84')];if('undefined'!=typeof _0x25dfb7['parameters'][_0xca19('0x7e')]){if(_0xca19('0x22')!=typeof _0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')][_0xca19('0x7f')]){var _0x52bebd=_0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')][_0xca19('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x52bebd)){_0x26fc20=path['join'](_0xca19('0x89'),_0x455ff8,_0x2f2be1[0x0],_0x52bebd);}else{_0x26fc20=_0x52bebd;}}if(_0xca19('0x22')!=typeof _0x25dfb7['parameters']['views'][_0xca19('0x80')]){var _0x4629df=_0x25dfb7[_0xca19('0x7b')][_0xca19('0x7e')][_0xca19('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xca19('0x8b')](_0x4629df)){_0x45ec65=path['join'](_0xca19('0x89'),_0x455ff8,_0x2f2be1[0x0],_0x4629df);}else{_0x45ec65=_0x4629df;}}}}var _0x2164ad={'name':_0x505936,'description':_0x5b5aa2,'path':path[_0xca19('0x50')](_0x455ff8,_0x2f2be1[0x0]),'type':_0x51d281,'sidebar':_0x24b5c6,'icon':_0x5bd022,'adminUrl':_0x26fc20,'agentUrl':_0x45ec65,'scriptName':_0x592cb3,'scriptPath':_0x774e4f,'version':_0x5ee067};removeReferences(_0x2c609e,null);return db[_0xca19('0x31')][_0xca19('0x8e')](_0x2164ad)[_0xca19('0x28')](function(_0x5aae4b){var _0x7945a={'role':_0x2d979d[_0xca19('0x8f')][_0xca19('0x90')],'userProfileId':_0x2d979d[_0xca19('0x8f')][_0xca19('0x91')]};if(!_0x7945a)throw new Error(_0xca19('0x92'));if(_0x7945a[_0xca19('0x90')]==='user'){var _0x19c7b1=_0x5aae4b['get']({'plain':!![]});return db[_0xca19('0x93')][_0xca19('0x4d')]({'where':{'name':_0xca19('0x94'),'userProfileId':_0x7945a[_0xca19('0x91')]},'raw':!![]})[_0xca19('0x28')](function(_0x3af878){if(_0x3af878&&_0x3af878[_0xca19('0x95')]===0x0){return db[_0xca19('0x2a')][_0xca19('0x8e')]({'name':_0x19c7b1[_0xca19('0x2e')],'resourceId':_0x19c7b1['id'],'type':_0x3af878[_0xca19('0x2e')],'sectionId':_0x3af878['id']},{})[_0xca19('0x28')](function(){return _0x5aae4b;});}else{return _0x5aae4b;}})['catch'](function(_0x46f8e5){logger[_0xca19('0x5a')](_0xca19('0x96'),_0x46f8e5);throw _0x46f8e5;});}return _0x5aae4b;})[_0xca19('0x28')](respondWithResult(_0x1f9ee2,null))[_0xca19('0x48')](handleError(_0x1f9ee2,null));}});}catch(_0x2c01e9){_0x1f9ee2[_0xca19('0x1d')](0x1f4)[_0xca19('0x2f')](_0x2c01e9);}};function removeReferences(_0x43808e,_0x505a04){try{if(_0x43808e){fs['unlinkSync'](_0x43808e);logger[_0xca19('0x66')](_0xca19('0x97'));}if(_0x505a04){rimraf(_0x505a04,function(){});logger[_0xca19('0x66')](_0xca19('0x98'));}}catch(_0xb8ed8e){logger[_0xca19('0x5a')](_0xb8ed8e);}}exports[_0xca19('0x99')]=function(_0x5aa36b,_0x23adf0,_0x403519){return db[_0xca19('0x31')]['find']({'where':{'id':_0x5aa36b[_0xca19('0x4a')]['id']}})[_0xca19('0x28')](handleEntityNotFound(_0x23adf0,null))['then'](saveUpdates(_0x5aa36b[_0xca19('0x8f')],null))[_0xca19('0x28')](respondWithResult(_0x23adf0,null))[_0xca19('0x48')](handleError(_0x23adf0,null));};exports[_0xca19('0x9a')]=function(_0x801da7,_0x2af01b,_0xb2d153){return db[_0xca19('0x31')][_0xca19('0x4d')]({'where':{'id':_0x801da7[_0xca19('0x4a')]['id']}})['then'](function(_0x5338e3){if(_0x5338e3){return _0x5338e3[_0xca19('0x2b')]();}})[_0xca19('0x28')](function(_0x184b23){rimraf(path[_0xca19('0x50')](config[_0xca19('0x51')],_0xca19('0x52'),path['dirname'](_0x184b23['path'])),function(){});return _0x184b23;})[_0xca19('0x28')](handleEntityNotFound(_0x2af01b,null))[_0xca19('0x28')](respondWithStatusCode(_0x2af01b,null))['catch'](handleError(_0x2af01b,null));};exports[_0xca19('0x9b')]=function(_0x3356c3,_0x158270,_0x1e9c6b){return BPromise[_0xca19('0x9c')]()[_0xca19('0x28')](function(){if(!_0x3356c3[_0xca19('0x36')]['path']){throw new Error(_0xca19('0x9d'));}if(!_0x3356c3[_0xca19('0x36')][_0xca19('0x9e')]){throw new Error(_0xca19('0x9f'));}var _0x14585d=_0x3356c3['query'][_0xca19('0xa0')]?_0x3356c3[_0xca19('0x36')]['hostname']+':'+_0x3356c3[_0xca19('0x36')][_0xca19('0x9e')]:'http://localhost:'+_0x3356c3[_0xca19('0x36')][_0xca19('0x9e')];var _0x8c235d=_0x3356c3['query'][_0xca19('0x1f')]?_0x3356c3['query']['json']:!![];var _0x1d4a23=_0x3356c3['query'][_0xca19('0xa1')]?_0x3356c3[_0xca19('0x36')][_0xca19('0xa1')]:null;var _0x3a68b9={'method':_0x3356c3[_0xca19('0xa2')],'uri':util[_0xca19('0x53')](_0xca19('0xa3'),_0x14585d,_0x3356c3[_0xca19('0x36')][_0xca19('0x4f')]),'json':_0x8c235d,'resolveWithFullResponse':!![],'encoding':_0x1d4a23,'qs':_0x3356c3[_0xca19('0x36')]};if(_0x3356c3[_0xca19('0xa4')]){_0x3a68b9[_0xca19('0xa4')]=_0x3356c3[_0xca19('0xa4')];if(_0x3a68b9[_0xca19('0xa4')][_0xca19('0xa5')]){delete _0x3a68b9[_0xca19('0xa4')][_0xca19('0xa5')];}}if(_0x3a68b9[_0xca19('0xa4')][_0xca19('0xa6')]){delete _0x3a68b9[_0xca19('0xa4')][_0xca19('0xa6')];}return rp(_0x3a68b9);})[_0xca19('0x28')](function(_0x317520){if(_0x317520){_0x158270[_0xca19('0x24')](_0x317520[_0xca19('0xa4')]);logger[_0xca19('0x66')](_0x317520[_0xca19('0x8f')]);if(_[_0xca19('0xa7')](_0x3356c3['query']['path'],_0xca19('0x4e'))&&_0x317520[_0xca19('0xa8')]==0x1f4){return _0x158270['sendStatus'](_0x317520['statusCode']);}else{return _0x158270[_0xca19('0x1d')](_0x317520['statusCode'])[_0xca19('0x2f')](_0x317520[_0xca19('0x8f')]);}}else{return _0x158270[_0xca19('0x2c')](0xc8);}})[_0xca19('0x48')](handleError(_0x158270,null));};exports[_0xca19('0xa9')]=function(_0x45ffb2,_0x13b4f8,_0x4afe0f){return BPromise['resolve']()[_0xca19('0x28')](function(){if(!_0x45ffb2[_0xca19('0x36')][_0xca19('0x4f')]){throw new Error(_0xca19('0x9d'));}if(!_0x45ffb2[_0xca19('0x36')]['port']){throw new Error(_0xca19('0x9f'));}var _0x5f2007=_0x45ffb2['query'][_0xca19('0xa0')]?_0x45ffb2['query']['hostname']+':'+_0x45ffb2['query'][_0xca19('0x9e')]:_0xca19('0xaa')+_0x45ffb2[_0xca19('0x36')]['port'];var _0x579f60=_0x45ffb2[_0xca19('0x36')]['json']?_0x45ffb2[_0xca19('0x36')]['json']:!![];var _0xf1815b=_0x45ffb2['query'][_0xca19('0xa1')]?_0x45ffb2[_0xca19('0x36')][_0xca19('0xa1')]:null;var _0x3134f2={'method':_0x45ffb2[_0xca19('0xa2')],'uri':util[_0xca19('0x53')](_0xca19('0xa3'),_0x5f2007,_0x45ffb2[_0xca19('0x36')][_0xca19('0x4f')]),'json':_0x579f60,'resolveWithFullResponse':!![],'encoding':_0xf1815b,'body':_0x45ffb2['body']};if(_0x45ffb2[_0xca19('0xa4')]){_0x3134f2['headers']=_0x45ffb2[_0xca19('0xa4')];if(_0x3134f2['headers'][_0xca19('0xa5')]){delete _0x3134f2['headers']['content-length'];}}if(_0x3134f2[_0xca19('0xa4')][_0xca19('0xa6')]){delete _0x3134f2[_0xca19('0xa4')][_0xca19('0xa6')];}return rp(_0x3134f2);})[_0xca19('0x28')](function(_0x53b6e7){if(_0x53b6e7){_0x13b4f8[_0xca19('0x24')](_0x53b6e7['headers']);logger[_0xca19('0x66')](_0x53b6e7['body']);return _0x13b4f8[_0xca19('0x1d')](_0x53b6e7[_0xca19('0xa8')])['send'](_0x53b6e7[_0xca19('0x8f')]);}else{return _0x13b4f8[_0xca19('0x2c')](0xc8);}})[_0xca19('0x48')](handleError(_0x13b4f8,null));}; \ No newline at end of file +var _0xf4c3=['show','params','includeAll','download','find','root','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','server/files/plugins','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','filename','file','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','agent','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','sendStatus','offset','undefined','count','limit','status','json','apply','save','update','destroy','then','error','name','send','index','Plugin','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','include','findAll','catch'];(function(_0x1bf778,_0x2270ee){var _0x1fb3ea=function(_0x465e57){while(--_0x465e57){_0x1bf778['push'](_0x1bf778['shift']());}};_0x1fb3ea(++_0x2270ee);}(_0xf4c3,0x104));var _0x3f4c=function(_0x2e16e8,_0x48b26f){_0x2e16e8=_0x2e16e8-0x0;var _0xb19ac0=_0xf4c3[_0x2e16e8];return _0xb19ac0;};'use strict';var emlformat=require(_0x3f4c('0x0'));var rimraf=require(_0x3f4c('0x1'));var zipdir=require(_0x3f4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f4c('0x3'));var moment=require('moment');var BPromise=require(_0x3f4c('0x4'));var Mustache=require(_0x3f4c('0x5'));var util=require(_0x3f4c('0x6'));var path=require(_0x3f4c('0x7'));var sox=require(_0x3f4c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f4c('0x9'));var _=require(_0x3f4c('0xa'));var squel=require(_0x3f4c('0xb'));var crypto=require(_0x3f4c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3f4c('0xd'));var toCsv=require(_0x3f4c('0xe'));var querystring=require('querystring');var Papa=require(_0x3f4c('0xf'));var extract=require(_0x3f4c('0x10'));var rimraf=require(_0x3f4c('0x1'));var archiver=require(_0x3f4c('0x11'));var Redis=require(_0x3f4c('0x12'));var authService=require(_0x3f4c('0x13'));var qs=require(_0x3f4c('0x14'));var as=require(_0x3f4c('0x15'));var hardwareService=require(_0x3f4c('0x16'));var logger=require(_0x3f4c('0x17'))(_0x3f4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f4c('0x19'))['db'];config['redis']=_[_0x3f4c('0x1a')](config[_0x3f4c('0x1b')],{'host':_0x3f4c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f4c('0x1b')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x87b427,_0x5c483f){_0x5c483f=_0x5c483f||0xcc;return function(_0x4d13ef){if(_0x4d13ef){return _0x87b427[_0x3f4c('0x1d')](_0x5c483f);}return _0x87b427['status'](_0x5c483f)['end']();};}function respondWithResult(_0x474317,_0x211425){_0x211425=_0x211425||0xc8;return function(_0x49849f){if(_0x49849f){return _0x474317['status'](_0x211425)['json'](_0x49849f);}};}function respondWithFilteredResult(_0x5413d7,_0x153ada){return function(_0x56d81f){if(_0x56d81f){var _0x32e0d7=typeof _0x153ada[_0x3f4c('0x1e')]===_0x3f4c('0x1f')&&typeof _0x153ada['limit']==='undefined';var _0x3020ea=_0x56d81f[_0x3f4c('0x20')];var _0xf3221d=_0x32e0d7?0x0:_0x153ada[_0x3f4c('0x1e')];var _0xdc5f08=_0x32e0d7?_0x56d81f[_0x3f4c('0x20')]:_0x153ada[_0x3f4c('0x1e')]+_0x153ada[_0x3f4c('0x21')];var _0x289751;if(_0xdc5f08>=_0x3020ea){_0xdc5f08=_0x3020ea;_0x289751=0xc8;}else{_0x289751=0xce;}_0x5413d7[_0x3f4c('0x22')](_0x289751);return _0x5413d7['set']('Content-Range',_0xf3221d+'-'+_0xdc5f08+'/'+_0x3020ea)[_0x3f4c('0x23')](_0x56d81f);}return null;};}function patchUpdates(_0x348432){return function(_0x5ab86a){try{jsonpatch[_0x3f4c('0x24')](_0x5ab86a,_0x348432,!![]);}catch(_0x274adb){return BPromise['reject'](_0x274adb);}return _0x5ab86a[_0x3f4c('0x25')]();};}function saveUpdates(_0x44b0e5,_0xc0bef){return function(_0x2af398){if(_0x2af398){return _0x2af398[_0x3f4c('0x26')](_0x44b0e5)['then'](function(_0x5ce900){return _0x5ce900;});}return null;};}function removeEntity(_0x53e513,_0x42bf0d){return function(_0x280d2c){if(_0x280d2c){return _0x280d2c[_0x3f4c('0x27')]()[_0x3f4c('0x28')](function(){var _0x1cda7b=_0x280d2c['get']({'plain':!![]});var _0x3e091c='Plugins';return db['UserProfileResource'][_0x3f4c('0x27')]({'where':{'type':_0x3e091c,'resourceId':_0x1cda7b['id']}})['then'](function(){return _0x280d2c;});})[_0x3f4c('0x28')](function(){_0x53e513[_0x3f4c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ced1c,_0x632cad){return function(_0x3dbd8c){if(!_0x3dbd8c){_0x4ced1c[_0x3f4c('0x1d')](0x194);}return _0x3dbd8c;};}function handleError(_0x360dc2,_0x34889a){_0x34889a=_0x34889a||0x1f4;return function(_0x254d4b){logger[_0x3f4c('0x29')](_0x254d4b['stack']);if(_0x254d4b[_0x3f4c('0x2a')]){delete _0x254d4b[_0x3f4c('0x2a')];}_0x360dc2[_0x3f4c('0x22')](_0x34889a)[_0x3f4c('0x2b')](_0x254d4b);};}exports[_0x3f4c('0x2c')]=function(_0xf330b9,_0x1b02d2){var _0x128fd7={},_0x3622a7={},_0x366da4={'count':0x0,'rows':[]};var _0x92b6b4=_['map'](db[_0x3f4c('0x2d')][_0x3f4c('0x2e')],function(_0x16e008){return{'name':_0x16e008[_0x3f4c('0x2f')],'type':_0x16e008[_0x3f4c('0x30')]['key']};});_0x3622a7['model']=_['map'](_0x92b6b4,'name');_0x3622a7[_0x3f4c('0x31')]=_[_0x3f4c('0x32')](_0xf330b9[_0x3f4c('0x31')]);_0x3622a7['filters']=_[_0x3f4c('0x33')](_0x3622a7[_0x3f4c('0x34')],_0x3622a7[_0x3f4c('0x31')]);_0x128fd7[_0x3f4c('0x35')]=_['intersection'](_0x3622a7[_0x3f4c('0x34')],qs[_0x3f4c('0x36')](_0xf330b9[_0x3f4c('0x31')][_0x3f4c('0x36')]));_0x128fd7['attributes']=_0x128fd7[_0x3f4c('0x35')][_0x3f4c('0x37')]?_0x128fd7[_0x3f4c('0x35')]:_0x3622a7[_0x3f4c('0x34')];if(!_0xf330b9[_0x3f4c('0x31')][_0x3f4c('0x38')](_0x3f4c('0x39'))){_0x128fd7['limit']=qs[_0x3f4c('0x21')](_0xf330b9[_0x3f4c('0x31')][_0x3f4c('0x21')]);_0x128fd7[_0x3f4c('0x1e')]=qs[_0x3f4c('0x1e')](_0xf330b9['query']['offset']);}_0x128fd7[_0x3f4c('0x3a')]=qs[_0x3f4c('0x3b')](_0xf330b9[_0x3f4c('0x31')][_0x3f4c('0x3b')]);_0x128fd7[_0x3f4c('0x3c')]=qs[_0x3f4c('0x3d')](_[_0x3f4c('0x3e')](_0xf330b9[_0x3f4c('0x31')],_0x3622a7[_0x3f4c('0x3d')]),_0x92b6b4);if(_0xf330b9[_0x3f4c('0x31')][_0x3f4c('0x3f')]){_0x128fd7[_0x3f4c('0x3c')]=_[_0x3f4c('0x40')](_0x128fd7['where'],{'$or':_[_0x3f4c('0x41')](_0x92b6b4,function(_0x19ed8e){if(_0x19ed8e[_0x3f4c('0x30')]!=='VIRTUAL'){var _0xa1b6f3={};_0xa1b6f3[_0x19ed8e[_0x3f4c('0x2a')]]={'$like':'%'+_0xf330b9[_0x3f4c('0x31')][_0x3f4c('0x3f')]+'%'};return _0xa1b6f3;}})});}_0x128fd7=_[_0x3f4c('0x40')]({},_0x128fd7,_0xf330b9[_0x3f4c('0x42')]);var _0x239a61={'where':_0x128fd7[_0x3f4c('0x3c')]};return db[_0x3f4c('0x2d')][_0x3f4c('0x20')](_0x239a61)[_0x3f4c('0x28')](function(_0x5ad511){_0x366da4[_0x3f4c('0x20')]=_0x5ad511;if(_0xf330b9['query']['includeAll']){_0x128fd7[_0x3f4c('0x43')]=[{'all':!![]}];}return db[_0x3f4c('0x2d')][_0x3f4c('0x44')](_0x128fd7);})[_0x3f4c('0x28')](function(_0x47ae1c){_0x366da4['rows']=_0x47ae1c;return _0x366da4;})[_0x3f4c('0x28')](respondWithFilteredResult(_0x1b02d2,_0x128fd7))[_0x3f4c('0x45')](handleError(_0x1b02d2,null));};exports[_0x3f4c('0x46')]=function(_0x367f83,_0x54d78d){var _0x250be2={'raw':!![],'where':{'id':_0x367f83[_0x3f4c('0x47')]['id']}},_0x39e917={};_0x39e917[_0x3f4c('0x34')]=_[_0x3f4c('0x32')](db[_0x3f4c('0x2d')]['rawAttributes']);_0x39e917['query']=_[_0x3f4c('0x32')](_0x367f83[_0x3f4c('0x31')]);_0x39e917['filters']=_[_0x3f4c('0x33')](_0x39e917['model'],_0x39e917['query']);_0x250be2['attributes']=_['intersection'](_0x39e917[_0x3f4c('0x34')],qs[_0x3f4c('0x36')](_0x367f83[_0x3f4c('0x31')][_0x3f4c('0x36')]));_0x250be2[_0x3f4c('0x35')]=_0x250be2['attributes'][_0x3f4c('0x37')]?_0x250be2[_0x3f4c('0x35')]:_0x39e917[_0x3f4c('0x34')];if(_0x367f83[_0x3f4c('0x31')][_0x3f4c('0x48')]){_0x250be2['include']=[{'all':!![]}];}_0x250be2=_['merge']({},_0x250be2,_0x367f83[_0x3f4c('0x42')]);return db[_0x3f4c('0x2d')]['find'](_0x250be2)['then'](handleEntityNotFound(_0x54d78d,null))[_0x3f4c('0x28')](respondWithResult(_0x54d78d,null))[_0x3f4c('0x45')](handleError(_0x54d78d,null));};exports[_0x3f4c('0x49')]=function(_0x4ee9b4,_0x4aae5f,_0x19f3c8){return db[_0x3f4c('0x2d')][_0x3f4c('0x4a')]({'where':{'id':_0x4ee9b4[_0x3f4c('0x47')]['id']},'attributes':['name',_0x3f4c('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x4aae5f,null))['then'](function(_0xe2af23){if(_0xe2af23){var _0x1386b2=path['join'](config[_0x3f4c('0x4b')],'server/files/plugins',util[_0x3f4c('0x4c')](_0x3f4c('0x4d'),path[_0x3f4c('0x4e')](_0xe2af23['path'])));var _0x2c5649=fs[_0x3f4c('0x4f')](_0x1386b2);var _0x255e9d=archiver('zip',{'zlib':{'level':0x9}});_0x255e9d['on'](_0x3f4c('0x50'),function(_0x4a6046){if(_0x4a6046['code']===_0x3f4c('0x51')){logger[_0x3f4c('0x29')](_0x4a6046);}else{throw new db[(_0x3f4c('0x52'))][(_0x3f4c('0x53'))](_0x3f4c('0x54'));}});_0x255e9d['on'](_0x3f4c('0x29'),function(_0x51bce7){throw new db[(_0x3f4c('0x52'))][(_0x3f4c('0x53'))](_0x3f4c('0x54'));});_0x255e9d[_0x3f4c('0x55')](_0x2c5649);_0x255e9d[_0x3f4c('0x56')](_0x3f4c('0x57'),{'cwd':path[_0x3f4c('0x58')](config[_0x3f4c('0x4b')],_0x3f4c('0x59'),path[_0x3f4c('0x5a')](_0xe2af23[_0x3f4c('0x7')])),'ignore':[path[_0x3f4c('0x58')](path['basename'](_0xe2af23[_0x3f4c('0x7')]),'node_modules/**/*'),path[_0x3f4c('0x58')](path[_0x3f4c('0x4e')](_0xe2af23[_0x3f4c('0x7')]),_0x3f4c('0x5b'))],'nodir':!![]})['finalize']();_0x2c5649['on'](_0x3f4c('0x5c'),function(){if(!fs[_0x3f4c('0x5d')](_0x1386b2)){throw new db[(_0x3f4c('0x52'))][(_0x3f4c('0x53'))](_0x3f4c('0x5e'));}return _0x4aae5f[_0x3f4c('0x49')](_0x1386b2,util[_0x3f4c('0x4c')](_0x3f4c('0x4d'),path[_0x3f4c('0x4e')](_0xe2af23[_0x3f4c('0x7')])),function(_0x7df61f){if(_0x7df61f){throw new db[(_0x3f4c('0x52'))]['Error'](_0x3f4c('0x5f'));}fs[_0x3f4c('0x60')](_0x1386b2);logger['info'](_0x3f4c('0x61'));logger['info'](_0x3f4c('0x62'));});});}return null;})['catch'](handleError(_0x4aae5f,null));};exports['upload']=function(_0x20b1d3,_0x3635f6,_0x3e97ef){var _0x27135f=path[_0x3f4c('0x4e')](_0x20b1d3['file'][_0x3f4c('0x63')],path['extname'](_0x20b1d3[_0x3f4c('0x64')][_0x3f4c('0x63')]));var _0xd1f3b0=path[_0x3f4c('0x58')](config[_0x3f4c('0x4b')],_0x3f4c('0x59'),_0x20b1d3[_0x3f4c('0x64')]['filename']);var _0x867a9c=path[_0x3f4c('0x58')](config['root'],'server/files/plugins',_0x27135f);logger[_0x3f4c('0x65')](_0x3f4c('0x66'),_0xd1f3b0);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x867a9c);try{fs[_0x3f4c('0x67')](_0xd1f3b0,parseInt(_0x3f4c('0x68'),0x8));extract(_0xd1f3b0,{'dir':_0x867a9c},function(_0x34f90d){if(_0x34f90d){logger['error'](_0x34f90d);handleError(_0x34f90d,!![]);};var _0x2eaa4a=fs['readdirSync'](_0x867a9c);if(_0x2eaa4a[_0x3f4c('0x37')]>0x1){removeReferences(_0xd1f3b0,_0x867a9c);logger['error'](_0x3f4c('0x69'));return _0x3e97ef(new Error('Invalid\x20plugin\x20structure'));}var _0x245e20=fs['lstatSync'](path[_0x3f4c('0x58')](_0x867a9c,_0x2eaa4a[0x0]));if(_0x245e20[_0x3f4c('0x6a')]()){removeReferences(_0xd1f3b0,_0x867a9c);logger[_0x3f4c('0x29')](_0x3f4c('0x69'));return _0x3e97ef(new Error(_0x3f4c('0x69')));}if(_0x245e20[_0x3f4c('0x6b')]()){var _0xd6a826=fs[_0x3f4c('0x6c')](path[_0x3f4c('0x58')](_0x867a9c,_0x2eaa4a[0x0]));if(_0xd6a826[_0x3f4c('0x37')]===0x0){removeReferences(_0xd1f3b0,_0x867a9c);logger['error'](_0x3f4c('0x69'));return _0x3e97ef(new Error('Invalid\x20plugin\x20structure'));}var _0x459d95=_0xd6a826[_0x3f4c('0x6d')](function(_0x4841e3){return _0x4841e3===_0x3f4c('0x6e');});if(!_0x459d95){return _0x3e97ef(new Error(_0x3f4c('0x6f')));}var _0x21abcf=fs['readFileSync'](path['join'](_0x867a9c,_0x2eaa4a[0x0],_0x3f4c('0x6e')));var _0x1a77bc=JSON[_0x3f4c('0x70')](_0x21abcf);if(_0x3f4c('0x1f')==typeof _0x1a77bc['name']){return _0x3e97ef(new Error(_0x3f4c('0x71')));}if(_0x3f4c('0x1f')==typeof _0x1a77bc[_0x3f4c('0x30')]){return _0x3e97ef(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x3f4c('0x1f')==typeof _0x1a77bc[_0x3f4c('0x72')]){return _0x3e97ef(new Error(_0x3f4c('0x73')));}if(_0x3f4c('0x1f')==typeof _0x1a77bc[_0x3f4c('0x74')]){return _0x3e97ef(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1a77bc[_0x3f4c('0x30')]===_0x3f4c('0x75')){if(_0x3f4c('0x1f')==typeof _0x1a77bc['parameters'][_0x3f4c('0x76')]){return _0x3e97ef(new Error(_0x3f4c('0x77')));}if('undefined'==typeof _0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')][_0x3f4c('0x78')]&&'undefined'==typeof _0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')]['agent']){return _0x3e97ef(new Error(_0x3f4c('0x79')));}}else if(_0x1a77bc[_0x3f4c('0x30')]===_0x3f4c('0x7a')){if(_0x3f4c('0x1f')==typeof _0x1a77bc[_0x3f4c('0x74')]['scriptName']){return _0x3e97ef(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x3f4c('0x1f')==typeof _0x1a77bc['parameters']['scriptPath']){return _0x3e97ef(new Error(_0x3f4c('0x7b')));}}else{return _0x3e97ef(new Error(_0x3f4c('0x7c')));}var _0x252319=_0x1a77bc[_0x3f4c('0x2a')];var _0x41d510=_0x1a77bc[_0x3f4c('0x7d')];var _0x46e7bf=_0x1a77bc[_0x3f4c('0x30')];var _0x525424=_0x1a77bc[_0x3f4c('0x7e')]?_0x1a77bc[_0x3f4c('0x7e')]:_0x3f4c('0x7f');var _0x562add=_0x1a77bc[_0x3f4c('0x80')]?_0x1a77bc[_0x3f4c('0x80')]:_0x3f4c('0x81');var _0x3aeed2='';var _0x5caae7='';var _0x274827='';var _0x169134='';var _0x1634f7=_0x1a77bc[_0x3f4c('0x72')];if(_0x46e7bf===_0x3f4c('0x75')){if(_0x3f4c('0x1f')!=typeof _0x1a77bc['parameters'][_0x3f4c('0x76')][_0x3f4c('0x78')]){var _0x40e19c=_0x1a77bc[_0x3f4c('0x74')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3f4c('0x82')](_0x40e19c)){_0x3aeed2=path[_0x3f4c('0x58')](_0x3f4c('0x83'),_0x27135f,_0x2eaa4a[0x0],_0x40e19c);}else{_0x3aeed2=_0x40e19c;}}else{logger[_0x3f4c('0x65')](_0x3f4c('0x84'));}if(_0x3f4c('0x1f')!=typeof _0x1a77bc['parameters'][_0x3f4c('0x76')]['agent']){var _0x2570a1=_0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2570a1)){_0x5caae7=path[_0x3f4c('0x58')](_0x3f4c('0x83'),_0x27135f,_0x2eaa4a[0x0],_0x2570a1);}else{_0x5caae7=_0x2570a1;}}else{logger[_0x3f4c('0x65')](_0x3f4c('0x85'));}}else if(_0x46e7bf===_0x3f4c('0x7a')){_0x274827=_0x1a77bc['parameters']['scriptName'];_0x169134=_0x1a77bc['parameters'][_0x3f4c('0x86')];if(_0x3f4c('0x1f')!=typeof _0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')]){if('undefined'!=typeof _0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')][_0x3f4c('0x78')]){var _0x40e19c=_0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')][_0x3f4c('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x3f4c('0x82')](_0x40e19c)){_0x3aeed2=path[_0x3f4c('0x58')](_0x3f4c('0x83'),_0x27135f,_0x2eaa4a[0x0],_0x40e19c);}else{_0x3aeed2=_0x40e19c;}}if('undefined'!=typeof _0x1a77bc['parameters'][_0x3f4c('0x76')][_0x3f4c('0x87')]){var _0x2570a1=_0x1a77bc[_0x3f4c('0x74')][_0x3f4c('0x76')][_0x3f4c('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2570a1)){_0x5caae7=path['join'](_0x3f4c('0x83'),_0x27135f,_0x2eaa4a[0x0],_0x2570a1);}else{_0x5caae7=_0x2570a1;}}}}var _0x2ce5a3={'name':_0x252319,'description':_0x41d510,'path':path[_0x3f4c('0x58')](_0x27135f,_0x2eaa4a[0x0]),'type':_0x46e7bf,'sidebar':_0x525424,'icon':_0x562add,'adminUrl':_0x3aeed2,'agentUrl':_0x5caae7,'scriptName':_0x274827,'scriptPath':_0x169134,'version':_0x1634f7};removeReferences(_0xd1f3b0,null);return db[_0x3f4c('0x2d')][_0x3f4c('0x88')](_0x2ce5a3)[_0x3f4c('0x28')](function(_0x37b264){var _0x6a4da4={'role':_0x20b1d3[_0x3f4c('0x89')]['role'],'userProfileId':_0x20b1d3[_0x3f4c('0x89')][_0x3f4c('0x8a')]};if(!_0x6a4da4)throw new Error(_0x3f4c('0x8b'));if(_0x6a4da4[_0x3f4c('0x8c')]===_0x3f4c('0x8d')){var _0x3b4e97=_0x37b264[_0x3f4c('0x8e')]({'plain':!![]});return db[_0x3f4c('0x8f')][_0x3f4c('0x4a')]({'where':{'name':'Plugins','userProfileId':_0x6a4da4['userProfileId']},'raw':!![]})[_0x3f4c('0x28')](function(_0x488190){if(_0x488190&&_0x488190[_0x3f4c('0x90')]===0x0){return db[_0x3f4c('0x91')][_0x3f4c('0x88')]({'name':_0x3b4e97[_0x3f4c('0x2a')],'resourceId':_0x3b4e97['id'],'type':_0x488190[_0x3f4c('0x2a')],'sectionId':_0x488190['id']},{})[_0x3f4c('0x28')](function(){return _0x37b264;});}else{return _0x37b264;}})[_0x3f4c('0x45')](function(_0x60be47){logger['error'](_0x3f4c('0x92'),_0x60be47);throw _0x60be47;});}return _0x37b264;})[_0x3f4c('0x28')](respondWithResult(_0x3635f6,null))[_0x3f4c('0x45')](handleError(_0x3635f6,null));}});}catch(_0x5a343c){_0x3635f6[_0x3f4c('0x22')](0x1f4)['send'](_0x5a343c);}};function removeReferences(_0x392d21,_0xe30fa8){try{if(_0x392d21){fs[_0x3f4c('0x60')](_0x392d21);logger[_0x3f4c('0x65')]('Zip\x20archive\x20removed');}if(_0xe30fa8){rimraf(_0xe30fa8,function(){});logger['info'](_0x3f4c('0x93'));}}catch(_0x4cd2f2){logger[_0x3f4c('0x29')](_0x4cd2f2);}}exports[_0x3f4c('0x26')]=function(_0x4b4b73,_0x6e0dc7,_0x13a488){return db['Plugin'][_0x3f4c('0x4a')]({'where':{'id':_0x4b4b73[_0x3f4c('0x47')]['id']}})[_0x3f4c('0x28')](handleEntityNotFound(_0x6e0dc7,null))[_0x3f4c('0x28')](saveUpdates(_0x4b4b73[_0x3f4c('0x89')],null))[_0x3f4c('0x28')](respondWithResult(_0x6e0dc7,null))[_0x3f4c('0x45')](handleError(_0x6e0dc7,null));};exports['delete']=function(_0x48b534,_0x55d86f,_0x29a51f){return db[_0x3f4c('0x2d')]['find']({'where':{'id':_0x48b534[_0x3f4c('0x47')]['id']}})[_0x3f4c('0x28')](function(_0x5ad9e8){if(_0x5ad9e8){return _0x5ad9e8['destroy']();}})[_0x3f4c('0x28')](function(_0xe42081){rimraf(path['join'](config['root'],'server/files/plugins',path[_0x3f4c('0x5a')](_0xe42081[_0x3f4c('0x7')])),function(){});return _0xe42081;})[_0x3f4c('0x28')](handleEntityNotFound(_0x55d86f,null))[_0x3f4c('0x28')](respondWithStatusCode(_0x55d86f,null))[_0x3f4c('0x45')](handleError(_0x55d86f,null));};exports[_0x3f4c('0x94')]=function(_0x21fe25,_0x3b4f78,_0x55bad4){return BPromise[_0x3f4c('0x95')]()['then'](function(){if(!_0x21fe25[_0x3f4c('0x31')][_0x3f4c('0x7')]){throw new Error(_0x3f4c('0x96'));}if(!_0x21fe25[_0x3f4c('0x31')][_0x3f4c('0x97')]){throw new Error(_0x3f4c('0x98'));}var _0x5a12ce=_0x21fe25[_0x3f4c('0x31')][_0x3f4c('0x99')]?_0x21fe25['query']['hostname']+':'+_0x21fe25[_0x3f4c('0x31')]['port']:_0x3f4c('0x9a')+_0x21fe25[_0x3f4c('0x31')][_0x3f4c('0x97')];var _0x10320c=_0x21fe25['query'][_0x3f4c('0x23')]?_0x21fe25['query'][_0x3f4c('0x23')]:!![];var _0xdd3c9f=_0x21fe25[_0x3f4c('0x31')][_0x3f4c('0x9b')]?_0x21fe25[_0x3f4c('0x31')][_0x3f4c('0x9b')]:null;var _0x408243={'method':_0x21fe25[_0x3f4c('0x9c')],'uri':util[_0x3f4c('0x4c')]('%s%s',_0x5a12ce,_0x21fe25['query'][_0x3f4c('0x7')]),'json':_0x10320c,'resolveWithFullResponse':!![],'encoding':_0xdd3c9f,'qs':_0x21fe25['query']};if(_0x21fe25[_0x3f4c('0x9d')]){_0x408243[_0x3f4c('0x9d')]=_0x21fe25['headers'];if(_0x408243[_0x3f4c('0x9d')][_0x3f4c('0x9e')]){delete _0x408243[_0x3f4c('0x9d')][_0x3f4c('0x9e')];}}if(_0x408243['headers'][_0x3f4c('0x9f')]){delete _0x408243['headers'][_0x3f4c('0x9f')];}return rp(_0x408243);})[_0x3f4c('0x28')](function(_0x51ef1){if(_0x51ef1){_0x3b4f78[_0x3f4c('0xa0')](_0x51ef1['headers']);logger['info'](_0x51ef1[_0x3f4c('0x89')]);if(_[_0x3f4c('0xa1')](_0x21fe25[_0x3f4c('0x31')]['path'],_0x3f4c('0x49'))&&_0x51ef1['statusCode']==0x1f4){return _0x3b4f78[_0x3f4c('0x1d')](_0x51ef1[_0x3f4c('0xa2')]);}else{return _0x3b4f78[_0x3f4c('0x22')](_0x51ef1[_0x3f4c('0xa2')])['send'](_0x51ef1[_0x3f4c('0x89')]);}}else{return _0x3b4f78[_0x3f4c('0x1d')](0xc8);}})[_0x3f4c('0x45')](handleError(_0x3b4f78,null));};exports[_0x3f4c('0xa3')]=function(_0x4a1f83,_0xcec9cb,_0x4b0120){return BPromise[_0x3f4c('0x95')]()[_0x3f4c('0x28')](function(){if(!_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x7')]){throw new Error(_0x3f4c('0x96'));}if(!_0x4a1f83[_0x3f4c('0x31')]['port']){throw new Error(_0x3f4c('0x98'));}var _0x4a2c7b=_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x99')]?_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x99')]+':'+_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x97')]:_0x3f4c('0x9a')+_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x97')];var _0x3ea496=_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x23')]?_0x4a1f83[_0x3f4c('0x31')]['json']:!![];var _0x16762b=_0x4a1f83['query'][_0x3f4c('0x9b')]?_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x9b')]:null;var _0x505620={'method':_0x4a1f83[_0x3f4c('0x9c')],'uri':util[_0x3f4c('0x4c')](_0x3f4c('0xa4'),_0x4a2c7b,_0x4a1f83[_0x3f4c('0x31')][_0x3f4c('0x7')]),'json':_0x3ea496,'resolveWithFullResponse':!![],'encoding':_0x16762b,'body':_0x4a1f83['body']};if(_0x4a1f83[_0x3f4c('0x9d')]){_0x505620[_0x3f4c('0x9d')]=_0x4a1f83['headers'];if(_0x505620[_0x3f4c('0x9d')][_0x3f4c('0x9e')]){delete _0x505620[_0x3f4c('0x9d')][_0x3f4c('0x9e')];}}if(_0x505620[_0x3f4c('0x9d')][_0x3f4c('0x9f')]){delete _0x505620[_0x3f4c('0x9d')][_0x3f4c('0x9f')];}return rp(_0x505620);})[_0x3f4c('0x28')](function(_0x3ed833){if(_0x3ed833){_0xcec9cb[_0x3f4c('0xa0')](_0x3ed833[_0x3f4c('0x9d')]);logger[_0x3f4c('0x65')](_0x3ed833[_0x3f4c('0x89')]);return _0xcec9cb[_0x3f4c('0x22')](_0x3ed833['statusCode'])['send'](_0x3ed833[_0x3f4c('0x89')]);}else{return _0xcec9cb['sendStatus'](0xc8);}})[_0x3f4c('0x45')](handleError(_0xcec9cb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3fff9fa..b437ee1 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 _0x1c23=['hook','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x1c23,0x1d5));var _0x31c2=function(_0x3ecaed,_0x6a02f6){_0x3ecaed=_0x3ecaed-0x0;var _0x5906b7=_0x1c23[_0x3ecaed];return _0x5906b7;};'use strict';var EventEmitter=require(_0x31c2('0x0'));var Plugin=require(_0x31c2('0x1'))['db'][_0x31c2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x31c2('0x3')](0x0);var events={'afterCreate':_0x31c2('0x4'),'afterUpdate':_0x31c2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x30a2af){return function(_0x2da7ad,_0x55e8c3,_0x50b513){PluginEvents[_0x31c2('0x6')](_0x30a2af+':'+_0x2da7ad['id'],_0x2da7ad);PluginEvents[_0x31c2('0x6')](_0x30a2af,_0x2da7ad);_0x50b513(null);};}for(var e in events){if(events[_0x31c2('0x7')](e)){var event=events[e];Plugin[_0x31c2('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xa7be=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x433bfc,_0xaf71ec){var _0x3e9d5f=function(_0x516f55){while(--_0x516f55){_0x433bfc['push'](_0x433bfc['shift']());}};_0x3e9d5f(++_0xaf71ec);}(_0xa7be,0xfd));var _0xea7b=function(_0x2557d8,_0x552397){_0x2557d8=_0x2557d8-0x0;var _0x21871e=_0xa7be[_0x2557d8];return _0x21871e;};'use strict';var EventEmitter=require(_0xea7b('0x0'));var Plugin=require(_0xea7b('0x1'))['db'][_0xea7b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xea7b('0x3')](0x0);var events={'afterCreate':_0xea7b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22627){return function(_0x98ad19,_0x3a1456,_0x50f0f9){PluginEvents[_0xea7b('0x5')](_0x22627+':'+_0x98ad19['id'],_0x98ad19);PluginEvents[_0xea7b('0x5')](_0x22627,_0x98ad19);_0x50f0f9(null);};}for(var e in events){if(events[_0xea7b('0x6')](e)){var event=events[e];Plugin[_0xea7b('0x7')](e,emitEvent(event));}}module[_0xea7b('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e2d2243..2cc1433 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 _0xf61a=['plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Plugin'];(function(_0x2131af,_0x4a510d){var _0x97a9c3=function(_0x4c4203){while(--_0x4c4203){_0x2131af['push'](_0x2131af['shift']());}};_0x97a9c3(++_0x4a510d);}(_0xf61a,0x140));var _0xaf61=function(_0x5d6059,_0x19edea){_0x5d6059=_0x5d6059-0x0;var _0x3cb32b=_0xf61a[_0x5d6059];return _0x3cb32b;};'use strict';var _=require(_0xaf61('0x0'));var util=require('util');var logger=require(_0xaf61('0x1'))(_0xaf61('0x2'));var moment=require(_0xaf61('0x3'));var BPromise=require(_0xaf61('0x4'));var rp=require(_0xaf61('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf61('0x6'));var config=require(_0xaf61('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x25e3b4,_0x2b78a9){return _0x25e3b4[_0xaf61('0x8')](_0xaf61('0x9'),attributes,{'tableName':_0xaf61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69e8=['rimraf','../../config/environment','define','lodash','../../config/logger','api','bluebird'];(function(_0x49ddfb,_0x5cea95){var _0x2f43d1=function(_0x481ba0){while(--_0x481ba0){_0x49ddfb['push'](_0x49ddfb['shift']());}};_0x2f43d1(++_0x5cea95);}(_0x69e8,0x137));var _0x869e=function(_0x136ce3,_0x4f6960){_0x136ce3=_0x136ce3-0x0;var _0x2a2f8a=_0x69e8[_0x136ce3];return _0x2a2f8a;};'use strict';var _=require(_0x869e('0x0'));var util=require('util');var logger=require(_0x869e('0x1'))(_0x869e('0x2'));var moment=require('moment');var BPromise=require(_0x869e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x869e('0x4'));var config=require(_0x869e('0x5'));var attributes=require('./plugin.attributes');module['exports']=function(_0x218f99,_0x83ac68){return _0x218f99[_0x869e('0x6')]('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 fa4124b..6fa7709 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 _0x33d2=['Plugin','create','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreatePlugin'];(function(_0x2f6a98,_0x560df2){var _0x3a945e=function(_0x302ddb){while(--_0x302ddb){_0x2f6a98['push'](_0x2f6a98['shift']());}};_0x3a945e(++_0x560df2);}(_0x33d2,0x7f));var _0x233d=function(_0x3a3c81,_0x253ca1){_0x3a3c81=_0x3a3c81-0x0;var _0x53acaf=_0x33d2[_0x3a3c81];return _0x53acaf;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var moment=require(_0x233d('0x2'));var BPromise=require('bluebird');var rs=require(_0x233d('0x3'));var fs=require('fs');var Redis=require(_0x233d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x233d('0x5'));var logger=require(_0x233d('0x6'))(_0x233d('0x7'));var config=require(_0x233d('0x8'));var jayson=require(_0x233d('0x9'));var client=jayson[_0x233d('0xa')][_0x233d('0xb')]({'port':0x232a});config[_0x233d('0xc')]=_['defaults'](config[_0x233d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x233d('0xd'))(new Redis(config[_0x233d('0xc')]));require(_0x233d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c819e,_0x5cc1fe,_0x3a6471){return new BPromise(function(_0x5df708,_0x1a9d36){return client[_0x233d('0xf')](_0x3c819e,_0x3a6471)[_0x233d('0x10')](function(_0x4f7eac){logger[_0x233d('0x11')](_0x233d('0x12'),_0x5cc1fe,'request\x20sent');logger[_0x233d('0x13')](_0x233d('0x14'),_0x5cc1fe,_0x233d('0x15'),JSON[_0x233d('0x16')](_0x4f7eac));if(_0x4f7eac[_0x233d('0x17')]){if(_0x4f7eac[_0x233d('0x17')]['code']===0x1f4){logger[_0x233d('0x17')](_0x233d('0x12'),_0x5cc1fe,_0x4f7eac[_0x233d('0x17')][_0x233d('0x18')]);return _0x1a9d36(_0x4f7eac[_0x233d('0x17')]['message']);}logger[_0x233d('0x17')]('Plugin,\x20%s,\x20%s',_0x5cc1fe,_0x4f7eac[_0x233d('0x17')][_0x233d('0x18')]);return _0x5df708(_0x4f7eac[_0x233d('0x17')][_0x233d('0x18')]);}else{logger[_0x233d('0x11')]('Plugin,\x20%s,\x20%s',_0x5cc1fe,'request\x20sent');_0x5df708(_0x4f7eac[_0x233d('0x19')][_0x233d('0x18')]);}})[_0x233d('0x1a')](function(_0xa2ab1){logger[_0x233d('0x17')](_0x233d('0x12'),_0x5cc1fe,_0xa2ab1);_0x1a9d36(_0xa2ab1);});});}exports[_0x233d('0x1b')]=function(_0x3b2d4b){var _0x13c055=this;return new Promise(function(_0x9bc931,_0x3fa180){return db[_0x233d('0x1c')][_0x233d('0x1d')](_0x3b2d4b['body'],{'raw':_0x3b2d4b[_0x233d('0x1e')]?_0x3b2d4b[_0x233d('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x233d('0x10')](function(_0x19f575){logger[_0x233d('0x11')](_0x233d('0x1b'),_0x3b2d4b);logger['debug'](_0x233d('0x1b'),_0x3b2d4b,JSON[_0x233d('0x16')](_0x19f575));_0x9bc931(_0x19f575);})[_0x233d('0x1a')](function(_0x1df500){logger[_0x233d('0x17')](_0x233d('0x1b'),_0x1df500[_0x233d('0x18')],_0x3b2d4b);_0x3fa180(_0x13c055['error'](0x1f4,_0x1df500['message']));});});}; \ No newline at end of file +var _0xf5ee=['http','redis','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','create','body','options','raw','CreatePlugin','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf5ee,0xd5));var _0xef5e=function(_0xd29c88,_0x141c80){_0xd29c88=_0xd29c88-0x0;var _0x375635=_0xf5ee[_0xd29c88];return _0x375635;};'use strict';var _=require(_0xef5e('0x0'));var util=require(_0xef5e('0x1'));var moment=require(_0xef5e('0x2'));var BPromise=require(_0xef5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef5e('0x4'));var db=require(_0xef5e('0x5'))['db'];var utils=require(_0xef5e('0x6'));var logger=require(_0xef5e('0x7'))('rpc');var config=require(_0xef5e('0x8'));var jayson=require(_0xef5e('0x9'));var client=jayson[_0xef5e('0xa')][_0xef5e('0xb')]({'port':0x232a});config[_0xef5e('0xc')]=_['defaults'](config[_0xef5e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xef5e('0xd'))(new Redis(config[_0xef5e('0xc')]));require(_0xef5e('0xe'))[_0xef5e('0xf')](socket);function respondWithRpcPromise(_0x546063,_0x3d5847,_0x5cac1e){return new BPromise(function(_0x3e5e9b,_0x4c3b58){return client[_0xef5e('0x10')](_0x546063,_0x5cac1e)[_0xef5e('0x11')](function(_0x8e5acd){logger[_0xef5e('0x12')](_0xef5e('0x13'),_0x3d5847,'request\x20sent');logger['debug'](_0xef5e('0x14'),_0x3d5847,_0xef5e('0x15'),JSON[_0xef5e('0x16')](_0x8e5acd));if(_0x8e5acd['error']){if(_0x8e5acd[_0xef5e('0x17')]['code']===0x1f4){logger[_0xef5e('0x17')](_0xef5e('0x13'),_0x3d5847,_0x8e5acd['error'][_0xef5e('0x18')]);return _0x4c3b58(_0x8e5acd[_0xef5e('0x17')][_0xef5e('0x18')]);}logger[_0xef5e('0x17')](_0xef5e('0x13'),_0x3d5847,_0x8e5acd[_0xef5e('0x17')][_0xef5e('0x18')]);return _0x3e5e9b(_0x8e5acd['error'][_0xef5e('0x18')]);}else{logger['info'](_0xef5e('0x13'),_0x3d5847,'request\x20sent');_0x3e5e9b(_0x8e5acd['result'][_0xef5e('0x18')]);}})[_0xef5e('0x19')](function(_0x56dc66){logger[_0xef5e('0x17')](_0xef5e('0x13'),_0x3d5847,_0x56dc66);_0x4c3b58(_0x56dc66);});});}exports['CreatePlugin']=function(_0x30f699){var _0x9d6554=this;return new Promise(function(_0x3c8eb7,_0x505f6e){return db['Plugin'][_0xef5e('0x1a')](_0x30f699[_0xef5e('0x1b')],{'raw':_0x30f699[_0xef5e('0x1c')]?_0x30f699[_0xef5e('0x1c')][_0xef5e('0x1d')]===undefined?!![]:![]:!![]})[_0xef5e('0x11')](function(_0x251dc7){logger['info'](_0xef5e('0x1e'),_0x30f699);logger[_0xef5e('0x1f')](_0xef5e('0x1e'),_0x30f699,JSON['stringify'](_0x251dc7));_0x3c8eb7(_0x251dc7);})['catch'](function(_0x4f015f){logger[_0xef5e('0x17')](_0xef5e('0x1e'),_0x4f015f[_0xef5e('0x18')],_0x30f699);_0x505f6e(_0x9d6554[_0xef5e('0x17')](0x1f4,_0x4f015f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ddbf21d..d0724fe 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 _0x301b=['update','removeListener','register','length','./plugin.events','save','remove'];(function(_0x3d75c5,_0x4b7ef9){var _0x192fb5=function(_0x1dc5d0){while(--_0x1dc5d0){_0x3d75c5['push'](_0x3d75c5['shift']());}};_0x192fb5(++_0x4b7ef9);}(_0x301b,0x138));var _0xb301=function(_0x440ad2,_0x40fbda){_0x440ad2=_0x440ad2-0x0;var _0x2cc9e1=_0x301b[_0x440ad2];return _0x2cc9e1;};'use strict';var PluginEvents=require(_0xb301('0x0'));var events=[_0xb301('0x1'),_0xb301('0x2'),_0xb301('0x3')];function createListener(_0x3f2175,_0x5369dd){return function(_0x4ebb98){_0x5369dd['emit'](_0x3f2175,_0x4ebb98);};}function removeListener(_0x1a2e3a,_0x4a8d83){return function(){PluginEvents[_0xb301('0x4')](_0x1a2e3a,_0x4a8d83);};}exports[_0xb301('0x5')]=function(_0x1451df){for(var _0x10b967=0x0,_0x207b91=events[_0xb301('0x6')];_0x10b967<_0x207b91;_0x10b967++){var _0x5b9e4a=events[_0x10b967];var _0xed4f08=createListener('plugin:'+_0x5b9e4a,_0x1451df);PluginEvents['on'](_0x5b9e4a,_0xed4f08);}}; \ No newline at end of file +var _0xe493=['./plugin.events','save','update','removeListener','length','plugin:'];(function(_0x280f41,_0x495a86){var _0x4f5e49=function(_0x4cbd3a){while(--_0x4cbd3a){_0x280f41['push'](_0x280f41['shift']());}};_0x4f5e49(++_0x495a86);}(_0xe493,0x1b0));var _0x3e49=function(_0x2e4497,_0x1f7b92){_0x2e4497=_0x2e4497-0x0;var _0x5e4e65=_0xe493[_0x2e4497];return _0x5e4e65;};'use strict';var PluginEvents=require(_0x3e49('0x0'));var events=[_0x3e49('0x1'),'remove',_0x3e49('0x2')];function createListener(_0x204f20,_0x487437){return function(_0x27f7e5){_0x487437['emit'](_0x204f20,_0x27f7e5);};}function removeListener(_0x56e398,_0x5843ad){return function(){PluginEvents[_0x3e49('0x3')](_0x56e398,_0x5843ad);};}exports['register']=function(_0x2f2429){for(var _0x166ed9=0x0,_0x1af05b=events[_0x3e49('0x4')];_0x166ed9<_0x1af05b;_0x166ed9++){var _0x195e3d=events[_0x166ed9];var _0x5bdcbd=createListener(_0x3e49('0x5')+_0x195e3d,_0x2f2429);PluginEvents['on'](_0x195e3d,_0x5bdcbd);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index bd6b11f..9a92821 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(_0xfcc72,_0x502fe0){var _0x346d63=function(_0x2482f7){while(--_0x2482f7){_0xfcc72['push'](_0xfcc72['shift']());}};_0x346d63(++_0x502fe0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0xaf3a3c,_0x50f69f){var _0x16f43e=function(_0x256f36){while(--_0x256f36){_0xaf3a3c['push'](_0xaf3a3c['shift']());}};_0x16f43e(++_0x50f69f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 c9dcdfc..67ba06c 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 _0x54ef=['bluebird','status','error','name','send','npm\x20install','info','index','list','reject','express','motion2','catch','show','describe','params','then','create','script','join','../../files/plugins','body','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x54ef,0x112));var _0xf54e=function(_0x2405da,_0x10f0ff){_0x2405da=_0x2405da-0x0;var _0x231035=_0x54ef[_0x2405da];return _0x231035;};'use strict';var _=require(_0xf54e('0x0'));var pm2=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var path=require(_0xf54e('0x3'));var exec=require(_0xf54e('0x4'))[_0xf54e('0x5')];var BPromise=require(_0xf54e('0x6'));function handleEntityNotFound(_0x8b6bb6,_0x431e36){return function(_0x12d43f){if(!_0x12d43f){_0x8b6bb6['sendStatus'](0x194);;}return _0x12d43f;};}function respondWithResult(_0x55e611,_0x18e84e){_0x18e84e=_0x18e84e||0xc8;return function(_0x99cf9){if(_0x99cf9){return _0x55e611[_0xf54e('0x7')](_0x18e84e)['json'](_0x99cf9);}return null;};}function handleError(_0x27e69b,_0x57a1ce){_0x57a1ce=_0x57a1ce||0x1f4;return function(_0x40a75d){logger[_0xf54e('0x8')](_0x40a75d['stack']);if(_0x40a75d[_0xf54e('0x9')]){delete _0x40a75d[_0xf54e('0x9')];}_0x27e69b[_0xf54e('0x7')](_0x57a1ce)[_0xf54e('0xa')](_0x40a75d);};}function execChildProcess(){return new BPromise(function(_0x5f232a,_0x558502){exec(_0xf54e('0xb'),function(_0x143d66,_0x326eef,_0x553759){logger[_0xf54e('0xc')](_0x326eef);logger['info'](_0x553759);if(_0x143d66){logger['error'](_0x143d66);return _0x558502(_0x143d66);}return _0x5f232a(_0x326eef);});});}exports[_0xf54e('0xd')]=function(_0x2033e9,_0x28f776){return pm2[_0xf54e('0xe')]()['then'](function(_0x331732){if(_0x331732){var _0x1bbeaa=_[_0xf54e('0xf')](_0x331732,function(_0x15f639){return _0x15f639['name']===_0xf54e('0x10')||_0x15f639[_0xf54e('0x9')]===_0xf54e('0x11');});return{'rows':_0x1bbeaa,'count':_0x1bbeaa['length']};}return null;})['then'](respondWithResult(_0x28f776,null))[_0xf54e('0x12')](handleError(_0x28f776,null));};exports[_0xf54e('0x13')]=function(_0x1c02e7,_0x9647f){return pm2[_0xf54e('0x14')](_0x1c02e7[_0xf54e('0x15')]['id'])[_0xf54e('0x16')](respondWithResult(_0x9647f,null))[_0xf54e('0x16')](handleEntityNotFound(_0x9647f,null))[_0xf54e('0x12')](handleError(_0x9647f,null));};exports[_0xf54e('0x17')]=function(_0x226c96,_0x50fc66){if(_0x226c96['body'][_0xf54e('0x9')]&&_0x226c96['body'][_0xf54e('0x18')]){var _0x1bfe99=path[_0xf54e('0x19')](__dirname,_0xf54e('0x1a'),_0x226c96[_0xf54e('0x1b')][_0xf54e('0x18')]);var _0x388aa0=process[_0xf54e('0x1c')]();process[_0xf54e('0x1d')](path[_0xf54e('0x1e')](_0x1bfe99));return execChildProcess()[_0xf54e('0x16')](function(_0x5b83df){process[_0xf54e('0x1d')](_0x388aa0);return pm2['start']({'name':_0x226c96[_0xf54e('0x1b')][_0xf54e('0x9')],'script':_0x1bfe99});})[_0xf54e('0x16')](function(_0x474b61){pm2[_0xf54e('0x1f')]();return _0x474b61[0x0];})[_0xf54e('0x16')](respondWithResult(_0x50fc66,0xc9))[_0xf54e('0x12')](handleError(_0x50fc66,null));}else{return _0x50fc66[_0xf54e('0x7')](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x20')});}};exports[_0xf54e('0x21')]=function(_0x39c0ae,_0x2ea001){if(_0x39c0ae['body']['id']){delete _0x39c0ae[_0xf54e('0x1b')]['id'];}var _0x4cbf7c={'online':_0xf54e('0x22'),'stopped':'stop'};if(_0x4cbf7c[_0xf54e('0x23')](_0x39c0ae[_0xf54e('0x1b')][_0xf54e('0x7')])){return pm2[_0x4cbf7c[_0x39c0ae[_0xf54e('0x1b')][_0xf54e('0x7')]]](_0x39c0ae[_0xf54e('0x15')]['id'])[_0xf54e('0x16')](respondWithResult(_0x2ea001,0xc8))['catch'](handleError(_0x2ea001,null));}else{return _0x2ea001['status'](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x24')});}};exports[_0xf54e('0x25')]=function(_0x16d00f,_0xb2d4c4){if(_0x16d00f[_0xf54e('0x1b')]['id']){delete _0x16d00f[_0xf54e('0x1b')]['id'];}if(_0x16d00f[_0xf54e('0x15')]['id']){return pm2[_0xf54e('0x26')](_0x16d00f[_0xf54e('0x15')]['id'])['then'](function(_0x5f29d3){pm2[_0xf54e('0x1f')]();return _0x5f29d3[0x0];})[_0xf54e('0x16')](respondWithResult(_0xb2d4c4,null))['catch'](handleError(_0xb2d4c4,null));}else{return _0xb2d4c4[_0xf54e('0x7')](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x27')});}}; \ No newline at end of file +var _0xd3d1=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','describe','create','join','../../files/plugins','body','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','destroy','delete'];(function(_0x4d8666,_0x4d1a4a){var _0x2df436=function(_0x3185c7){while(--_0x3185c7){_0x4d8666['push'](_0x4d8666['shift']());}};_0x2df436(++_0x4d1a4a);}(_0xd3d1,0x172));var _0x1d3d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd3d1[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x1d3d('0x0'));var pm2=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x1d3d('0x2'));var exec=require(_0x1d3d('0x3'))[_0x1d3d('0x4')];var BPromise=require(_0x1d3d('0x5'));function handleEntityNotFound(_0x41a806,_0x328a4e){return function(_0x2445e8){if(!_0x2445e8){_0x41a806[_0x1d3d('0x6')](0x194);;}return _0x2445e8;};}function respondWithResult(_0x1cbe06,_0x449475){_0x449475=_0x449475||0xc8;return function(_0x3831ce){if(_0x3831ce){return _0x1cbe06[_0x1d3d('0x7')](_0x449475)[_0x1d3d('0x8')](_0x3831ce);}return null;};}function handleError(_0x2c377c,_0xbea61e){_0xbea61e=_0xbea61e||0x1f4;return function(_0x2ba122){logger[_0x1d3d('0x9')](_0x2ba122['stack']);if(_0x2ba122[_0x1d3d('0xa')]){delete _0x2ba122[_0x1d3d('0xa')];}_0x2c377c[_0x1d3d('0x7')](_0xbea61e)[_0x1d3d('0xb')](_0x2ba122);};}function execChildProcess(){return new BPromise(function(_0x27d914,_0x372ff2){exec(_0x1d3d('0xc'),function(_0x2fa11e,_0x3b3913,_0x3cffa5){logger[_0x1d3d('0xd')](_0x3b3913);logger['info'](_0x3cffa5);if(_0x2fa11e){logger[_0x1d3d('0x9')](_0x2fa11e);return _0x372ff2(_0x2fa11e);}return _0x27d914(_0x3b3913);});});}exports[_0x1d3d('0xe')]=function(_0x494b82,_0x4dd753){return pm2[_0x1d3d('0xf')]()[_0x1d3d('0x10')](function(_0x1a8035){if(_0x1a8035){var _0x59b907=_[_0x1d3d('0x11')](_0x1a8035,function(_0x4dcc22){return _0x4dcc22[_0x1d3d('0xa')]===_0x1d3d('0x12')||_0x4dcc22[_0x1d3d('0xa')]===_0x1d3d('0x13');});return{'rows':_0x59b907,'count':_0x59b907[_0x1d3d('0x14')]};}return null;})[_0x1d3d('0x10')](respondWithResult(_0x4dd753,null))[_0x1d3d('0x15')](handleError(_0x4dd753,null));};exports['show']=function(_0x5d3ac9,_0x316ab4){return pm2[_0x1d3d('0x16')](_0x5d3ac9['params']['id'])[_0x1d3d('0x10')](respondWithResult(_0x316ab4,null))['then'](handleEntityNotFound(_0x316ab4,null))[_0x1d3d('0x15')](handleError(_0x316ab4,null));};exports[_0x1d3d('0x17')]=function(_0x2cd430,_0x2d6dfb){if(_0x2cd430['body'][_0x1d3d('0xa')]&&_0x2cd430['body']['script']){var _0x108005=path[_0x1d3d('0x18')](__dirname,_0x1d3d('0x19'),_0x2cd430[_0x1d3d('0x1a')][_0x1d3d('0x1b')]);var _0xe4afa2=process[_0x1d3d('0x1c')]();process[_0x1d3d('0x1d')](path[_0x1d3d('0x1e')](_0x108005));return execChildProcess()[_0x1d3d('0x10')](function(_0x1610a6){process['chdir'](_0xe4afa2);return pm2[_0x1d3d('0x1f')]({'name':_0x2cd430[_0x1d3d('0x1a')]['name'],'script':_0x108005});})[_0x1d3d('0x10')](function(_0x5c52da){pm2[_0x1d3d('0x20')]();return _0x5c52da[0x0];})[_0x1d3d('0x10')](respondWithResult(_0x2d6dfb,0xc9))[_0x1d3d('0x15')](handleError(_0x2d6dfb,null));}else{return _0x2d6dfb[_0x1d3d('0x7')](0x1f4)[_0x1d3d('0xb')]({'message':_0x1d3d('0x21')});}};exports[_0x1d3d('0x22')]=function(_0x298fd3,_0x2294ee){if(_0x298fd3[_0x1d3d('0x1a')]['id']){delete _0x298fd3[_0x1d3d('0x1a')]['id'];}var _0x4f0aa7={'online':_0x1d3d('0x23'),'stopped':'stop'};if(_0x4f0aa7[_0x1d3d('0x24')](_0x298fd3[_0x1d3d('0x1a')]['status'])){return pm2[_0x4f0aa7[_0x298fd3[_0x1d3d('0x1a')][_0x1d3d('0x7')]]](_0x298fd3[_0x1d3d('0x25')]['id'])[_0x1d3d('0x10')](respondWithResult(_0x2294ee,0xc8))['catch'](handleError(_0x2294ee,null));}else{return _0x2294ee[_0x1d3d('0x7')](0x1f4)[_0x1d3d('0xb')]({'message':'Unknown\x20status'});}};exports[_0x1d3d('0x26')]=function(_0x4845b7,_0x4c04a8){if(_0x4845b7[_0x1d3d('0x1a')]['id']){delete _0x4845b7['body']['id'];}if(_0x4845b7[_0x1d3d('0x25')]['id']){return pm2[_0x1d3d('0x27')](_0x4845b7[_0x1d3d('0x25')]['id'])[_0x1d3d('0x10')](function(_0x3a4c01){pm2[_0x1d3d('0x20')]();return _0x3a4c01[0x0];})[_0x1d3d('0x10')](respondWithResult(_0x4c04a8,null))[_0x1d3d('0x15')](handleError(_0x4c04a8,null));}else{return _0x4c04a8[_0x1d3d('0x7')](0x1f4)['send']({'message':_0x1d3d('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3ea5f0c..d93c578 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 _0xf313=['/agents','isAuthenticated','getAgents','/queues','getQueues','express','Router','./realtime.controller','get'];(function(_0x47989f,_0x5385bc){var _0x5b815e=function(_0x5e1766){while(--_0x5e1766){_0x47989f['push'](_0x47989f['shift']());}};_0x5b815e(++_0x5385bc);}(_0xf313,0x95));var _0x3f31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf313[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x3f31('0x0'));var router=express[_0x3f31('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3f31('0x2'));router[_0x3f31('0x3')](_0x3f31('0x4'),auth[_0x3f31('0x5')](),controller[_0x3f31('0x6')]);router['get'](_0x3f31('0x7'),auth[_0x3f31('0x5')](),controller[_0x3f31('0x8')]);module['exports']=router; \ No newline at end of file +var _0xdaeb=['getQueues','express','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','get'];(function(_0x4230bc,_0x395230){var _0x304341=function(_0x436a3a){while(--_0x436a3a){_0x4230bc['push'](_0x4230bc['shift']());}};_0x304341(++_0x395230);}(_0xdaeb,0x131));var _0xbdae=function(_0x2486e2,_0x3eade2){_0x2486e2=_0x2486e2-0x0;var _0x1c5a2a=_0xdaeb[_0x2486e2];return _0x1c5a2a;};'use strict';var express=require(_0xbdae('0x0'));var router=express['Router']();var auth=require(_0xbdae('0x1'));var controller=require(_0xbdae('0x2'));router['get'](_0xbdae('0x3'),auth[_0xbdae('0x4')](),controller[_0xbdae('0x5')]);router[_0xbdae('0x6')]('/queues',auth['isAuthenticated'](),controller[_0xbdae('0x7')]);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 e6d54e1..e1f3fb5 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 _0x6f49=['UserProfile','User','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','whatsapp','channel','toLowerCase','type','Queues','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','client','offset','undefined','limit','count','status','set','json','error','stack','name','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','voice','outbound','push','pTalking','originated','message','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','paused','loggedInDb','available','pick','filter','queue','some','connectedlinenum','internal','toString','find','getMembers','length','UserId','accountcode','online','voiceStatus','busy','startCase','Queue','Pause','QueueId','idle','unknown','ringing','isNil','chatPause','faxPause','smsPause','every','voicePause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','openchannelPause','whatsappPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','mailPause','resolve','rawAttributes','fieldName','key','query','role','agent','getOptions','raw','user','userProfileId','nolimit','sort'];(function(_0x3e5a04,_0x3eded0){var _0x59b7e5=function(_0x33d3a4){while(--_0x33d3a4){_0x3e5a04['push'](_0x3e5a04['shift']());}};_0x59b7e5(++_0x3eded0);}(_0x6f49,0xa6));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x96f4('0x0'));var jayson=require(_0x96f4('0x1'));var qs=require(_0x96f4('0x2'));var logger=require(_0x96f4('0x3'))(_0x96f4('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x96f4('0x5')]['http']({'port':0x232c});function respondWithFilteredResult(_0x42c309,_0x1e7389){return function(_0x67f60f){if(_0x67f60f){var _0x5c9074=typeof _0x1e7389[_0x96f4('0x6')]===_0x96f4('0x7')&&typeof _0x1e7389[_0x96f4('0x8')]===_0x96f4('0x7');var _0x198654=_0x67f60f[_0x96f4('0x9')];var _0x1ae6e2=_0x5c9074?0x0:_0x1e7389[_0x96f4('0x6')];var _0xd6fe01=_0x5c9074?_0x67f60f['count']:_0x1e7389[_0x96f4('0x6')]+_0x1e7389[_0x96f4('0x8')];var _0xc3595a;if(_0xd6fe01>=_0x198654){_0xd6fe01=_0x198654;_0xc3595a=0xc8;}else{_0xc3595a=0xce;}_0x42c309[_0x96f4('0xa')](_0xc3595a);return _0x42c309[_0x96f4('0xb')]('Content-Range',_0x1ae6e2+'-'+_0xd6fe01+'/'+_0x198654)[_0x96f4('0xc')](_0x67f60f);}return null;};}function handleError(_0x32d21c,_0x1fa6d9){_0x1fa6d9=_0x1fa6d9||0x1f4;return function(_0x54f5e4){logger[_0x96f4('0xd')](_0x54f5e4[_0x96f4('0xe')]);if(_0x54f5e4[_0x96f4('0xf')]){delete _0x54f5e4[_0x96f4('0xf')];}_0x32d21c['status'](_0x1fa6d9)['send'](_0x54f5e4);};}function getRealtimeAgents(){return new Promise(function(_0x502f3d,_0x2a8a28){return amiClient[_0x96f4('0x10')](_0x96f4('0x11'),{})[_0x96f4('0x12')](function(_0x5355be){if(_0x5355be[_0x96f4('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0xf47f83=_0x5355be[_0x96f4('0x13')];return routingClient[_0x96f4('0x10')](_0x96f4('0x11'),{})['then'](function(_0x27893a){if(_0x27893a[_0x96f4('0xd')])throw new Error(_0x96f4('0x14'));var _0x4b60fa=_0x27893a[_0x96f4('0x13')];return _0x502f3d(_[_0x96f4('0x15')]({},_0xf47f83,_0x4b60fa));});})[_0x96f4('0x16')](function(_0x354dcc){_0x2a8a28(_0x354dcc);});});}function getRealtimeQueues(_0x356101,_0x3030a3){return new Promise(function(_0x5ae4c4,_0x2a6554){var _0x269eea=_0x3030a3==='voice'?amiClient:routingClient;return _0x269eea[_0x96f4('0x10')](_['startCase'](_0x3030a3)+'Queues',_0x356101)[_0x96f4('0x12')](function(_0xdedcf1){if(_0xdedcf1[_0x96f4('0xd')])throw new Error(util[_0x96f4('0x17')](_0x96f4('0x18'),_0x3030a3));return _0x5ae4c4(_0xdedcf1[_0x96f4('0x13')]);})['catch'](function(_0x287f36){_0x2a6554(_0x287f36);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3f8b1b,_0x215ada){return amiClient[_0x96f4('0x10')]('VoiceQueuesChannels',{})[_0x96f4('0x12')](function(_0x3404bf){if(_0x3404bf[_0x96f4('0xd')])throw new Error(_0x96f4('0x19'));return _0x3f8b1b(_0x3404bf[_0x96f4('0x13')]);})['catch'](function(_0x25d0a0){_0x215ada(_0x25d0a0);});});}function initializeQueues(_0xff2057,_0xd3571a,_0x1db8fb,_0x29de6d){var _0xaf3284=[_0x96f4('0x1a'),'available',_0x96f4('0x1b'),_0x96f4('0x1c'),'paused'];if(_0x1db8fb===_0x96f4('0x1d')&&_0x29de6d===_0x96f4('0x1e')){_0xaf3284[_0x96f4('0x1f')](_0x96f4('0x20'),_0x96f4('0x21'),_0x96f4('0x22'),'dialActive','dialMethod',_0x96f4('0x23'),_0x96f4('0x24'),_0x96f4('0x25'),_0x96f4('0x26'),_0x96f4('0x27'),_0x96f4('0x28'),_0x96f4('0x29'),_0x96f4('0x2a'),_0x96f4('0x2b'),'dialPredictiveIntervalMinThreshold',_0x96f4('0x2c'),_0x96f4('0x2d'),_0x96f4('0x2e'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x96f4('0x2f'),_0x96f4('0x30'));}return _0xff2057[_0x96f4('0x31')](function(_0x291d9d){var _0x36d233=_0x291d9d[_0x96f4('0x32')]({'plain':!![]});_0x36d233[_0x96f4('0x33')]=[];_0x36d233[_0x96f4('0x34')]=0x0;_0x36d233[_0x96f4('0x35')]=0x0;_0x36d233['loggedIn']=0x0;_0x36d233[_0x96f4('0x36')]=0x0;_0x36d233['waiting']=0x0;if(_0x1db8fb===_0x96f4('0x1d')){_0x36d233[_0x96f4('0x1c')]=0x0;_0x36d233['busy']=0x0;if(_0x29de6d===_0x96f4('0x1e')){_0x36d233['pTalking']=0x0;_0x36d233['originated']=0x0;}}var _0x114cca=_['find'](_0xd3571a,['id',_0x36d233['id']]);if(_0x114cca)_[_0x96f4('0x15')](_0x36d233,_[_0x96f4('0x37')](_0x114cca,_0xaf3284));return _0x36d233;});}function updateAgentVoiceStatus(_0x2d3242,_0x41ac3c,_0x533379){var _0x1eba15=_[_0x96f4('0x38')](_0x533379,[_0x96f4('0x39'),_0x41ac3c[_0x96f4('0xf')]]);if(_0x1eba15['length']===0x0)return _0x2d3242['busy']=!![];if(_[_0x96f4('0x3a')](_0x1eba15,[_0x96f4('0x3b'),_0x2d3242[_0x96f4('0x3c')][_0x96f4('0x3d')]()]))return _0x2d3242[_0x96f4('0x1c')]=!![];if(!_0x2d3242['talking'])return _0x2d3242['busy']=!![];}function getVoiceQueueAgents(_0x52093f,_0x3fde9c,_0x4abb63,_0xa65685){var _0x46db5d=_[_0x96f4('0x3e')](_0x3fde9c,['id',_0x52093f['id']]);if(!_0x46db5d)return _0x52093f;return _0x46db5d[_0x96f4('0x3f')]({'raw':!![]})[_0x96f4('0x12')](function(_0xae4ca3){for(var _0x5f5746=0x0;_0x5f5746<_0xae4ca3[_0x96f4('0x40')];_0x5f5746++){var _0x39f796=_[_0x96f4('0x3e')](_0x4abb63,['id',_0xae4ca3[_0x5f5746][_0x96f4('0x41')]]);if(!_0x39f796){_0x39f796={'id':_0xae4ca3[_0x5f5746]['UserId'],'name':_0xae4ca3[_0x5f5746][_0x96f4('0x41')],'accountcode':'','online':![]};}var _0x289cff={'id':_0x39f796['id'],'name':_0x39f796[_0x96f4('0xf')],'internal':_0x39f796[_0x96f4('0x42')],'online':Boolean(_0x39f796[_0x96f4('0x43')]),'paused':Boolean(_0xae4ca3[_0x5f5746]['paused'])};if(_0x39f796[_0x96f4('0x44')]===_0x96f4('0x1c'))updateAgentVoiceStatus(_0x289cff,_0x52093f,_0xa65685);if(_0x289cff[_0x96f4('0x43')])_0x52093f[_0x96f4('0x35')]++;if(_0x289cff[_0x96f4('0x45')])_0x52093f[_0x96f4('0x45')]++;if(_0x289cff['paused']&&!_0x289cff[_0x96f4('0x45')]&&!_0x289cff[_0x96f4('0x1c')])_0x52093f['paused']++;_0x52093f[_0x96f4('0x33')][_0x96f4('0x1f')](_0x289cff);}return _0x52093f;});}function getQueueAgents(_0x4fcc54,_0x24ac2a,_0x2626b9){var _0x201797='User'+_[_0x96f4('0x46')](_0x2626b9)+_0x96f4('0x47');var _0x500e21=_0x2626b9+_0x96f4('0x48');return db[_0x201797]['findAll']({'where':{[_[_0x96f4('0x46')](_0x2626b9)+_0x96f4('0x49')]:_0x4fcc54['id']},'raw':!![]})[_0x96f4('0x12')](function(_0x2c9e19){for(var _0x3d6586=0x0;_0x3d6586<_0x2c9e19[_0x96f4('0x40')];_0x3d6586++){var _0xd8eed1=_[_0x96f4('0x3e')](_0x24ac2a,['id',_0x2c9e19[_0x3d6586][_0x96f4('0x41')]]);if(!_0xd8eed1){_0xd8eed1={'id':_0x2c9e19[_0x3d6586]['UserId'],'name':_0x2c9e19[_0x3d6586][_0x96f4('0x41')],'online':![],['pauseField']:![]};}var _0x13d641={'id':_0xd8eed1['id'],'name':_0xd8eed1[_0x96f4('0xf')],'online':Boolean(_0xd8eed1[_0x96f4('0x43')]),'paused':Boolean(_0xd8eed1[_0x500e21])};if(_0x13d641['online'])_0x4fcc54[_0x96f4('0x35')]++;_0x4fcc54[_0x96f4('0x33')]['push'](_0x13d641);}return _0x4fcc54;});}function isIdle(_0x5c220f){return _0x5c220f===_0x96f4('0x4a')||_0x5c220f===_0x96f4('0x4b')||_0x5c220f==='unavailable'||_0x5c220f===_0x96f4('0x4c')||_[_0x96f4('0x4d')](_0x5c220f);}function isAgentPaused(_0x2c4ff9,_0x38fc9c){var _0x5e620d=[_0x2c4ff9[_0x96f4('0x4e')],_0x2c4ff9[_0x96f4('0x4f')],_0x2c4ff9['mailPause'],_0x2c4ff9['openchannelPause'],_0x2c4ff9[_0x96f4('0x50')],_0x2c4ff9['voicePause'],_0x2c4ff9['whatsappPause']];if(!_0x38fc9c)return _[_0x96f4('0x51')](_0x5e620d);var _0x3106b9=_[_0x96f4('0x38')](_0x5e620d);return _0x3106b9[_0x96f4('0x40')]>0x0&&_0x3106b9[_0x96f4('0x40')]<_0x5e620d['length']?!![]:![];}function isAgentIdle(_0x409d2a){if(_0x409d2a[_0x96f4('0x44')]!=='idle'&&_0x409d2a[_0x96f4('0x52')]){_0x409d2a['voiceStatus']=_0x96f4('0x53');return![];}return _[_0x96f4('0x51')]([_0x409d2a[_0x96f4('0x54')],_0x409d2a[_0x96f4('0x55')],_0x409d2a[_0x96f4('0x56')],_0x409d2a[_0x96f4('0x57')],_0x409d2a[_0x96f4('0x58')],_0x409d2a[_0x96f4('0x44')],_0x409d2a['whatsappStatus']],isIdle);}function getAgentStatus(_0x4fe9b1){var _0xfe825f=_0x96f4('0x4b');if(isAgentPaused(_0x4fe9b1))_0xfe825f='pause';else if(isAgentPaused(_0x4fe9b1,!![]))_0xfe825f='*pause';else if(isAgentIdle(_0x4fe9b1))_0xfe825f=_0x96f4('0x4a');else _0xfe825f=_0x96f4('0x45');return _0xfe825f;}exports[_0x96f4('0x59')]=function(_0x16fa7b,_0x2f7f5d){var _0x4158d2={'count':0x0,'rows':[]},_0x1e157a={},_0x481357,_0x56786b,_0x59e29a=[_0x96f4('0x5a'),_0x96f4('0x43'),_0x96f4('0x5b'),_0x96f4('0x5c'),_0x96f4('0x5d'),_0x96f4('0x5c'),_0x96f4('0x3c'),_0x96f4('0x5e'),'chatPause',_0x96f4('0x5f'),'mailPause',_0x96f4('0x50'),_0x96f4('0x60'),_0x96f4('0x4f'),_0x96f4('0x52'),'chatCapacity',_0x96f4('0x61'),_0x96f4('0x62'),_0x96f4('0x63'),_0x96f4('0x64'),'faxCapacity',_0x96f4('0x65'),_0x96f4('0x66'),_0x96f4('0x67'),_0x96f4('0x68'),_0x96f4('0x69'),_0x96f4('0x6a'),_0x96f4('0x54'),_0x96f4('0x57'),'mailStatus','smsStatus',_0x96f4('0x6b'),_0x96f4('0x55'),_0x96f4('0x44'),_0x96f4('0x6c'),'openchannelStatusTime',_0x96f4('0x6d'),_0x96f4('0x6e'),_0x96f4('0x6f'),_0x96f4('0x70'),'voiceStatusTime',_0x96f4('0x39'),'destconnectedlinenum',_0x96f4('0x71'),_0x96f4('0x72'),'phoneBarEnableAutomaticScreenRecording',_0x96f4('0x73')],_0x4b7fff=[_0x96f4('0x4e'),_0x96f4('0x5f'),_0x96f4('0x74'),'smsPause',_0x96f4('0x60'),_0x96f4('0x4f'),'voicePause',_0x96f4('0x43')];Promise[_0x96f4('0x75')]()[_0x96f4('0x12')](function(){var _0x2cf218=_[_0x96f4('0x31')](db['User'][_0x96f4('0x76')],function(_0x5e013f){return{'name':_0x5e013f[_0x96f4('0x77')],'type':_0x5e013f['type'][_0x96f4('0x78')]};});_0x16fa7b[_0x96f4('0x79')][_0x96f4('0x7a')]=_0x96f4('0x7b');_0x16fa7b[_0x96f4('0x79')][_0x96f4('0x43')]=!![];_0x1e157a=qs[_0x96f4('0x7c')](_0x2cf218,_0x16fa7b);_0x1e157a[_0x96f4('0x7d')]=!![];if(_0x16fa7b[_0x96f4('0x7e')]['role']===_0x96f4('0x7e')){var _0x3582a7={'params':{'id':_0x16fa7b[_0x96f4('0x7e')][_0x96f4('0x7f')]},'query':{'section':_0x96f4('0x11'),'role':'agent','online':!![],'nolimit':_0x16fa7b[_0x96f4('0x79')][_0x96f4('0x80')],'sort':_0x16fa7b[_0x96f4('0x79')][_0x96f4('0x81')],'filter':_0x16fa7b[_0x96f4('0x79')]['filter']},'raw':!![]};return db[_0x96f4('0x82')]['getResources'](_0x3582a7);}return db[_0x96f4('0x83')][_0x96f4('0x84')](_0x1e157a);})['then'](function(_0x2294d4){_0x4158d2[_0x96f4('0x9')]=_0x2294d4[_0x96f4('0x9')];_0x481357=_0x2294d4[_0x96f4('0x85')];return getRealtimeAgents();})[_0x96f4('0x12')](function(_0x3ed062){_0x56786b=_0x3ed062[_0x96f4('0x85')];return _0x481357[_0x96f4('0x31')](function(_0x2acf0e){var _0x46b79b=_['find'](_0x56786b,['id',_0x2acf0e['id']]);if(_0x46b79b)_[_0x96f4('0x15')](_0x2acf0e,_[_0x96f4('0x37')](_[_0x96f4('0x86')](_0x46b79b,_0x4b7fff),_0x59e29a));_0x2acf0e[_0x96f4('0x87')]=getAgentStatus(_0x2acf0e);return _0x2acf0e;});})['then'](function(_0x7a01ff){if(_0x16fa7b['query'][_0x96f4('0x88')]){var _0x2d84ba=_[_0x96f4('0x38')](_0x7a01ff,[_0x96f4('0x87'),_0x16fa7b['query'][_0x96f4('0x88')]]);if(_0x16fa7b['query']['pauseTypeFilter']){_0x2d84ba=_['filter'](_0x2d84ba,[_0x96f4('0x5d'),_0x16fa7b[_0x96f4('0x79')][_0x96f4('0x89')]]);}}_0x4158d2[_0x96f4('0x85')]=_0x2d84ba||_0x7a01ff;return _0x4158d2;})[_0x96f4('0x12')](respondWithFilteredResult(_0x2f7f5d,_0x1e157a))['catch'](handleError(_0x2f7f5d,null));};exports[_0x96f4('0x8a')]=function(_0x54172c,_0x2a783b){var _0x4b47cd=[_0x96f4('0x8b'),_0x96f4('0x8c'),_0x96f4('0x8d'),_0x96f4('0x8e'),'fax',_0x96f4('0x8f'),_0x96f4('0x1d')];var _0x5e3a62={'count':0x0,'rows':[]},_0x123b95={},_0x47e6b6,_0x2f75a5,_0x3e2035,_0x3e67ba,_0x5f28c8;Promise[_0x96f4('0x75')]()[_0x96f4('0x12')](function(){if(_0x54172c['query'][_0x96f4('0x90')]){if(!_['includes'](_0x4b47cd,_0x54172c[_0x96f4('0x79')][_0x96f4('0x90')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x47e6b6=_0x54172c[_0x96f4('0x79')][_0x96f4('0x90')][_0x96f4('0x91')]();}var _0x392d61=_['startCase'](_0x47e6b6)+_0x96f4('0x47');var _0x137b4e=_[_0x96f4('0x31')](db[_0x392d61][_0x96f4('0x76')],function(_0x2ae58b){return{'name':_0x2ae58b[_0x96f4('0x77')],'type':_0x2ae58b['type'][_0x96f4('0x78')]};});_0x123b95=qs[_0x96f4('0x7c')](_0x137b4e,_0x54172c);if(_0x54172c['user'][_0x96f4('0x7a')]===_0x96f4('0x7e')){var _0x18e1ea={'params':{'id':_0x54172c[_0x96f4('0x7e')][_0x96f4('0x7f')]},'query':{'section':_0x47e6b6==='voice'&&_0x54172c[_0x96f4('0x79')][_0x96f4('0x92')]===_0x96f4('0x1e')?'QueueCampaigns':_[_0x96f4('0x46')](_0x47e6b6)+_0x96f4('0x93'),'type':_0x54172c[_0x96f4('0x79')][_0x96f4('0x92')],'nolimit':!![],'sort':'name','filter':_0x54172c[_0x96f4('0x79')][_0x96f4('0x38')]}};return db[_0x96f4('0x82')]['getResources'](_0x18e1ea);}return db[_0x392d61]['findAndCountAll'](_0x123b95);})[_0x96f4('0x12')](function(_0x14494d){_0x5e3a62['count']=_0x14494d[_0x96f4('0x9')];_0x2f75a5=_0x14494d[_0x96f4('0x85')];return getRealtimeQueues(_0x54172c,_0x47e6b6);})[_0x96f4('0x12')](function(_0x2e5eba){_0x3e67ba=_0x2e5eba[_0x96f4('0x85')];return getRealtimeAgents();})[_0x96f4('0x12')](function(_0x3036b7){_0x3e2035=_0x3036b7[_0x96f4('0x85')];if(_0x47e6b6!=_0x96f4('0x1d'))return;return getRealtimeVoiceQueueChannels();})[_0x96f4('0x12')](function(_0x13e425){_0x5f28c8=_0x13e425?_0x13e425[_0x96f4('0x85')]:[];return initializeQueues(_0x2f75a5,_0x3e67ba,_0x47e6b6,_0x54172c[_0x96f4('0x79')][_0x96f4('0x92')]);})['then'](function(_0x33f682){var _0x1d980c=_0x33f682[_0x96f4('0x31')](function(_0x15a07f){if(_0x47e6b6==='voice')return getVoiceQueueAgents(_0x15a07f,_0x2f75a5,_0x3e2035,_0x5f28c8);else return getQueueAgents(_0x15a07f,_0x3e2035,_0x47e6b6);});return Promise['all'](_0x1d980c);})[_0x96f4('0x12')](function(_0xefc26d){_0x5e3a62[_0x96f4('0x85')]=_0xefc26d;return _0x5e3a62;})[_0x96f4('0x12')](respondWithFilteredResult(_0x2a783b,_0x123b95))[_0x96f4('0x16')](handleError(_0x2a783b,null));}; \ No newline at end of file +var _0xa80f=['userpic','lastLoginAt','lastPauseAt','address','mailPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','key','query','role','getOptions','user','userProfileId','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','pauseTypeFilter','pauseType','getQueues','mail','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','type','QueueCampaigns','util','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','limit','undefined','count','json','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','voice','startCase','Queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','map','get','loggedInDb','originated','find','pick','filter','queue','busy','some','internal','toString','getMembers','length','UserId','accountcode','online','agents','User','Queue','Pause','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause'];(function(_0x2bfe35,_0x50c413){var _0x2f4f56=function(_0x2b352e){while(--_0x2b352e){_0x2bfe35['push'](_0x2bfe35['shift']());}};_0x2f4f56(++_0x50c413);}(_0xa80f,0xca));var _0xfa80=function(_0x53e83d,_0x760f0f){_0x53e83d=_0x53e83d-0x0;var _0x212614=_0xa80f[_0x53e83d];return _0x212614;};'use strict';var util=require(_0xfa80('0x0'));var _=require('lodash');var jayson=require(_0xfa80('0x1'));var qs=require(_0xfa80('0x2'));var logger=require(_0xfa80('0x3'))('api');var db=require(_0xfa80('0x4'))['db'];var amiClient=jayson[_0xfa80('0x5')][_0xfa80('0x6')]({'port':0x232a});var routingClient=jayson[_0xfa80('0x5')][_0xfa80('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x5941d1,_0x15571f){return function(_0xa0ec21){if(_0xa0ec21){var _0x2c1939=typeof _0x15571f[_0xfa80('0x7')]==='undefined'&&typeof _0x15571f[_0xfa80('0x8')]===_0xfa80('0x9');var _0x525782=_0xa0ec21[_0xfa80('0xa')];var _0x5028dc=_0x2c1939?0x0:_0x15571f[_0xfa80('0x7')];var _0x2eb461=_0x2c1939?_0xa0ec21[_0xfa80('0xa')]:_0x15571f[_0xfa80('0x7')]+_0x15571f[_0xfa80('0x8')];var _0x30eb87;if(_0x2eb461>=_0x525782){_0x2eb461=_0x525782;_0x30eb87=0xc8;}else{_0x30eb87=0xce;}_0x5941d1['status'](_0x30eb87);return _0x5941d1['set']('Content-Range',_0x5028dc+'-'+_0x2eb461+'/'+_0x525782)[_0xfa80('0xb')](_0xa0ec21);}return null;};}function handleError(_0x35fb75,_0x2eca63){_0x2eca63=_0x2eca63||0x1f4;return function(_0xdc30ca){logger[_0xfa80('0xc')](_0xdc30ca[_0xfa80('0xd')]);if(_0xdc30ca[_0xfa80('0xe')]){delete _0xdc30ca['name'];}_0x35fb75['status'](_0x2eca63)['send'](_0xdc30ca);};}function getRealtimeAgents(){return new Promise(function(_0x541a56,_0x41a2e9){return amiClient[_0xfa80('0xf')](_0xfa80('0x10'),{})[_0xfa80('0x11')](function(_0xc9a4b4){if(_0xc9a4b4[_0xfa80('0xc')])throw new Error(_0xfa80('0x12'));var _0x33df3d=_0xc9a4b4[_0xfa80('0x13')];return routingClient[_0xfa80('0xf')](_0xfa80('0x10'),{})[_0xfa80('0x11')](function(_0x77261a){if(_0x77261a[_0xfa80('0xc')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x5adbcc=_0x77261a[_0xfa80('0x13')];return _0x541a56(_[_0xfa80('0x14')]({},_0x33df3d,_0x5adbcc));});})[_0xfa80('0x15')](function(_0x387270){_0x41a2e9(_0x387270);});});}function getRealtimeQueues(_0x729c84,_0xa5924a){return new Promise(function(_0x4b735a,_0x1be07c){var _0x2c85b6=_0xa5924a===_0xfa80('0x16')?amiClient:routingClient;return _0x2c85b6['request'](_[_0xfa80('0x17')](_0xa5924a)+_0xfa80('0x18'),_0x729c84)['then'](function(_0x386890){if(_0x386890[_0xfa80('0xc')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xa5924a));return _0x4b735a(_0x386890[_0xfa80('0x13')]);})[_0xfa80('0x15')](function(_0x238fc0){_0x1be07c(_0x238fc0);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x265e2b,_0x237e2c){return amiClient[_0xfa80('0xf')](_0xfa80('0x19'),{})[_0xfa80('0x11')](function(_0x1a26e6){if(_0x1a26e6[_0xfa80('0xc')])throw new Error(_0xfa80('0x1a'));return _0x265e2b(_0x1a26e6[_0xfa80('0x13')]);})[_0xfa80('0x15')](function(_0x2edf6f){_0x237e2c(_0x2edf6f);});});}function initializeQueues(_0x2216bf,_0x2cdb2f,_0x4e50a1,_0x24dcf4){var _0x505a41=[_0xfa80('0x1b'),_0xfa80('0x1c'),_0xfa80('0x1d'),_0xfa80('0x1e'),_0xfa80('0x1f')];if(_0x4e50a1===_0xfa80('0x16')&&_0x24dcf4===_0xfa80('0x20')){_0x505a41[_0xfa80('0x21')](_0xfa80('0x22'),'originated',_0xfa80('0x23'),_0xfa80('0x24'),_0xfa80('0x25'),'Trunk',_0xfa80('0x26'),_0xfa80('0x27'),_0xfa80('0x28'),_0xfa80('0x29'),_0xfa80('0x2a'),_0xfa80('0x2b'),_0xfa80('0x2c'),_0xfa80('0x2d'),'dialPredictiveIntervalMinThreshold',_0xfa80('0x2e'),_0xfa80('0x2f'),_0xfa80('0x30'),_0xfa80('0x31'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x2216bf[_0xfa80('0x32')](function(_0x6804b6){var _0x58d8ce=_0x6804b6[_0xfa80('0x33')]({'plain':!![]});_0x58d8ce['agents']=[];_0x58d8ce[_0xfa80('0x1f')]=0x0;_0x58d8ce[_0xfa80('0x34')]=0x0;_0x58d8ce[_0xfa80('0x1b')]=0x0;_0x58d8ce[_0xfa80('0x1c')]=0x0;_0x58d8ce[_0xfa80('0x1d')]=0x0;if(_0x4e50a1===_0xfa80('0x16')){_0x58d8ce['talking']=0x0;_0x58d8ce['busy']=0x0;if(_0x24dcf4===_0xfa80('0x20')){_0x58d8ce[_0xfa80('0x22')]=0x0;_0x58d8ce[_0xfa80('0x35')]=0x0;}}var _0x281cdc=_[_0xfa80('0x36')](_0x2cdb2f,['id',_0x58d8ce['id']]);if(_0x281cdc)_[_0xfa80('0x14')](_0x58d8ce,_[_0xfa80('0x37')](_0x281cdc,_0x505a41));return _0x58d8ce;});}function updateAgentVoiceStatus(_0x3f96e5,_0x37ebf9,_0x335667){var _0x3958fa=_[_0xfa80('0x38')](_0x335667,[_0xfa80('0x39'),_0x37ebf9[_0xfa80('0xe')]]);if(_0x3958fa['length']===0x0)return _0x3f96e5[_0xfa80('0x3a')]=!![];if(_[_0xfa80('0x3b')](_0x3958fa,['connectedlinenum',_0x3f96e5[_0xfa80('0x3c')][_0xfa80('0x3d')]()]))return _0x3f96e5[_0xfa80('0x1e')]=!![];if(!_0x3f96e5[_0xfa80('0x1e')])return _0x3f96e5[_0xfa80('0x3a')]=!![];}function getVoiceQueueAgents(_0xe8cdc9,_0x199d50,_0xe22954,_0x23243f){var _0xc18a4d=_[_0xfa80('0x36')](_0x199d50,['id',_0xe8cdc9['id']]);if(!_0xc18a4d)return _0xe8cdc9;return _0xc18a4d[_0xfa80('0x3e')]({'raw':!![]})['then'](function(_0x44fe4d){for(var _0x5abebf=0x0;_0x5abebf<_0x44fe4d[_0xfa80('0x3f')];_0x5abebf++){var _0x1a812d=_[_0xfa80('0x36')](_0xe22954,['id',_0x44fe4d[_0x5abebf]['UserId']]);if(!_0x1a812d){_0x1a812d={'id':_0x44fe4d[_0x5abebf][_0xfa80('0x40')],'name':_0x44fe4d[_0x5abebf][_0xfa80('0x40')],'accountcode':'','online':![]};}var _0xca1df={'id':_0x1a812d['id'],'name':_0x1a812d['name'],'internal':_0x1a812d[_0xfa80('0x41')],'online':Boolean(_0x1a812d[_0xfa80('0x42')]),'paused':Boolean(_0x44fe4d[_0x5abebf][_0xfa80('0x1f')])};if(_0x1a812d['voiceStatus']===_0xfa80('0x1e'))updateAgentVoiceStatus(_0xca1df,_0xe8cdc9,_0x23243f);if(_0xca1df[_0xfa80('0x42')])_0xe8cdc9[_0xfa80('0x34')]++;if(_0xca1df[_0xfa80('0x3a')])_0xe8cdc9[_0xfa80('0x3a')]++;if(_0xca1df['paused']&&!_0xca1df[_0xfa80('0x3a')]&&!_0xca1df[_0xfa80('0x1e')])_0xe8cdc9['paused']++;_0xe8cdc9[_0xfa80('0x43')][_0xfa80('0x21')](_0xca1df);}return _0xe8cdc9;});}function getQueueAgents(_0x1c3a91,_0x3ce53d,_0xbb4d7a){var _0x33323a=_0xfa80('0x44')+_[_0xfa80('0x17')](_0xbb4d7a)+_0xfa80('0x45');var _0x2e1bc6=_0xbb4d7a+_0xfa80('0x46');return db[_0x33323a][_0xfa80('0x47')]({'where':{[_['startCase'](_0xbb4d7a)+_0xfa80('0x48')]:_0x1c3a91['id']},'raw':!![]})[_0xfa80('0x11')](function(_0x40288d){for(var _0x1b6a3a=0x0;_0x1b6a3a<_0x40288d[_0xfa80('0x3f')];_0x1b6a3a++){var _0x4ba399=_[_0xfa80('0x36')](_0x3ce53d,['id',_0x40288d[_0x1b6a3a][_0xfa80('0x40')]]);if(!_0x4ba399){_0x4ba399={'id':_0x40288d[_0x1b6a3a][_0xfa80('0x40')],'name':_0x40288d[_0x1b6a3a]['UserId'],'online':![],['pauseField']:![]};}var _0x4b5cc9={'id':_0x4ba399['id'],'name':_0x4ba399[_0xfa80('0xe')],'online':Boolean(_0x4ba399['online']),'paused':Boolean(_0x4ba399[_0x2e1bc6])};if(_0x4b5cc9[_0xfa80('0x42')])_0x1c3a91[_0xfa80('0x34')]++;_0x1c3a91[_0xfa80('0x43')][_0xfa80('0x21')](_0x4b5cc9);}return _0x1c3a91;});}function isIdle(_0x1a7e4e){return _0x1a7e4e===_0xfa80('0x49')||_0x1a7e4e===_0xfa80('0x4a')||_0x1a7e4e===_0xfa80('0x4b')||_0x1a7e4e===_0xfa80('0x4c')||_[_0xfa80('0x4d')](_0x1a7e4e);}function isAgentPaused(_0x3897be,_0x508e9a){var _0x45ce9c=[_0x3897be[_0xfa80('0x4e')],_0x3897be[_0xfa80('0x4f')],_0x3897be['mailPause'],_0x3897be[_0xfa80('0x50')],_0x3897be[_0xfa80('0x51')],_0x3897be[_0xfa80('0x52')],_0x3897be[_0xfa80('0x53')]];if(!_0x508e9a)return _['every'](_0x45ce9c);var _0x1910c3=_[_0xfa80('0x38')](_0x45ce9c);return _0x1910c3[_0xfa80('0x3f')]>0x0&&_0x1910c3[_0xfa80('0x3f')]<_0x45ce9c[_0xfa80('0x3f')]?!![]:![];}function isAgentIdle(_0x236e28){if(_0x236e28['voiceStatus']!==_0xfa80('0x49')&&_0x236e28[_0xfa80('0x52')]){_0x236e28[_0xfa80('0x54')]=_0xfa80('0x55');return![];}return _[_0xfa80('0x56')]([_0x236e28[_0xfa80('0x57')],_0x236e28[_0xfa80('0x58')],_0x236e28[_0xfa80('0x59')],_0x236e28[_0xfa80('0x5a')],_0x236e28[_0xfa80('0x5b')],_0x236e28[_0xfa80('0x54')],_0x236e28[_0xfa80('0x5c')]],isIdle);}function getAgentStatus(_0x43be69){var _0x315ef1=_0xfa80('0x4a');if(isAgentPaused(_0x43be69))_0x315ef1='pause';else if(isAgentPaused(_0x43be69,!![]))_0x315ef1=_0xfa80('0x5d');else if(isAgentIdle(_0x43be69))_0x315ef1=_0xfa80('0x49');else _0x315ef1=_0xfa80('0x3a');return _0x315ef1;}exports['getAgents']=function(_0x23cbc7,_0x4b1bef){var _0x3ba606={'count':0x0,'rows':[]},_0x2c8700={},_0xbe3358,_0x347be4,_0x43e6f6=[_0xfa80('0x5e'),_0xfa80('0x42'),_0xfa80('0x5f'),_0xfa80('0x60'),'pauseType',_0xfa80('0x60'),_0xfa80('0x3c'),_0xfa80('0x61'),_0xfa80('0x4e'),_0xfa80('0x50'),_0xfa80('0x62'),_0xfa80('0x51'),'whatsappPause',_0xfa80('0x4f'),_0xfa80('0x52'),_0xfa80('0x63'),_0xfa80('0x64'),_0xfa80('0x65'),_0xfa80('0x66'),'whatsappCapacity','faxCapacity',_0xfa80('0x67'),_0xfa80('0x68'),_0xfa80('0x69'),_0xfa80('0x6a'),_0xfa80('0x6b'),_0xfa80('0x6c'),_0xfa80('0x57'),_0xfa80('0x5a'),_0xfa80('0x59'),_0xfa80('0x5b'),_0xfa80('0x5c'),'faxStatus',_0xfa80('0x54'),_0xfa80('0x6d'),_0xfa80('0x6e'),_0xfa80('0x6f'),_0xfa80('0x70'),_0xfa80('0x71'),_0xfa80('0x72'),'voiceStatusTime',_0xfa80('0x39'),'destconnectedlinenum','screenrecording',_0xfa80('0x73'),_0xfa80('0x74'),_0xfa80('0x75')],_0x263726=[_0xfa80('0x4e'),_0xfa80('0x50'),'mailPause',_0xfa80('0x51'),_0xfa80('0x53'),_0xfa80('0x4f'),'voicePause',_0xfa80('0x42')];Promise[_0xfa80('0x76')]()[_0xfa80('0x11')](function(){var _0x487e7d=_[_0xfa80('0x32')](db[_0xfa80('0x44')][_0xfa80('0x77')],function(_0x189d16){return{'name':_0x189d16[_0xfa80('0x78')],'type':_0x189d16['type'][_0xfa80('0x79')]};});_0x23cbc7[_0xfa80('0x7a')][_0xfa80('0x7b')]='agent';_0x23cbc7['query']['online']=!![];_0x2c8700=qs[_0xfa80('0x7c')](_0x487e7d,_0x23cbc7);_0x2c8700['raw']=!![];if(_0x23cbc7[_0xfa80('0x7d')][_0xfa80('0x7b')]===_0xfa80('0x7d')){var _0x453394={'params':{'id':_0x23cbc7[_0xfa80('0x7d')][_0xfa80('0x7e')]},'query':{'section':_0xfa80('0x10'),'role':'agent','online':!![],'nolimit':_0x23cbc7[_0xfa80('0x7a')]['nolimit'],'sort':_0x23cbc7[_0xfa80('0x7a')][_0xfa80('0x7f')],'filter':_0x23cbc7[_0xfa80('0x7a')][_0xfa80('0x38')]},'raw':!![]};return db[_0xfa80('0x80')][_0xfa80('0x81')](_0x453394);}return db[_0xfa80('0x44')][_0xfa80('0x82')](_0x2c8700);})['then'](function(_0x37cb15){_0x3ba606[_0xfa80('0xa')]=_0x37cb15['count'];_0xbe3358=_0x37cb15[_0xfa80('0x83')];return getRealtimeAgents();})[_0xfa80('0x11')](function(_0x9773c2){_0x347be4=_0x9773c2[_0xfa80('0x83')];return _0xbe3358['map'](function(_0x43afcb){var _0xefbe2a=_[_0xfa80('0x36')](_0x347be4,['id',_0x43afcb['id']]);if(_0xefbe2a)_['merge'](_0x43afcb,_[_0xfa80('0x37')](_[_0xfa80('0x84')](_0xefbe2a,_0x263726),_0x43e6f6));_0x43afcb[_0xfa80('0x85')]=getAgentStatus(_0x43afcb);return _0x43afcb;});})['then'](function(_0x2853c2){if(_0x23cbc7[_0xfa80('0x7a')]['globalStatusFilter']){var _0x454418=_[_0xfa80('0x38')](_0x2853c2,[_0xfa80('0x85'),_0x23cbc7[_0xfa80('0x7a')]['globalStatusFilter']]);if(_0x23cbc7[_0xfa80('0x7a')][_0xfa80('0x86')]){_0x454418=_[_0xfa80('0x38')](_0x454418,[_0xfa80('0x87'),_0x23cbc7[_0xfa80('0x7a')][_0xfa80('0x86')]]);}}_0x3ba606[_0xfa80('0x83')]=_0x454418||_0x2853c2;return _0x3ba606;})[_0xfa80('0x11')](respondWithFilteredResult(_0x4b1bef,_0x2c8700))[_0xfa80('0x15')](handleError(_0x4b1bef,null));};exports[_0xfa80('0x88')]=function(_0x107208,_0x42cea7){var _0x2d6f50=[_0xfa80('0x89'),'chat',_0xfa80('0x8a'),_0xfa80('0x8b'),_0xfa80('0x8c'),_0xfa80('0x8d'),_0xfa80('0x16')];var _0x2b16e3={'count':0x0,'rows':[]},_0x464fbb={},_0x4ffe19,_0x561a42,_0x48ebd1,_0x41535c,_0x4d9998;Promise['resolve']()[_0xfa80('0x11')](function(){if(_0x107208['query'][_0xfa80('0x8e')]){if(!_[_0xfa80('0x8f')](_0x2d6f50,_0x107208[_0xfa80('0x7a')][_0xfa80('0x8e')][_0xfa80('0x90')]()))throw new Error(_0xfa80('0x91'));_0x4ffe19=_0x107208[_0xfa80('0x7a')][_0xfa80('0x8e')][_0xfa80('0x90')]();}var _0x517b2d=_['startCase'](_0x4ffe19)+_0xfa80('0x45');var _0x5982b4=_[_0xfa80('0x32')](db[_0x517b2d][_0xfa80('0x77')],function(_0x52bc9a){return{'name':_0x52bc9a['fieldName'],'type':_0x52bc9a[_0xfa80('0x92')][_0xfa80('0x79')]};});_0x464fbb=qs['getOptions'](_0x5982b4,_0x107208);if(_0x107208[_0xfa80('0x7d')]['role']===_0xfa80('0x7d')){var _0x2b81fc={'params':{'id':_0x107208['user'][_0xfa80('0x7e')]},'query':{'section':_0x4ffe19==='voice'&&_0x107208['query'][_0xfa80('0x92')]===_0xfa80('0x20')?_0xfa80('0x93'):_[_0xfa80('0x17')](_0x4ffe19)+_0xfa80('0x18'),'type':_0x107208[_0xfa80('0x7a')][_0xfa80('0x92')],'nolimit':!![],'sort':_0xfa80('0xe'),'filter':_0x107208[_0xfa80('0x7a')][_0xfa80('0x38')]}};return db['UserProfile'][_0xfa80('0x81')](_0x2b81fc);}return db[_0x517b2d][_0xfa80('0x82')](_0x464fbb);})['then'](function(_0x52a636){_0x2b16e3[_0xfa80('0xa')]=_0x52a636[_0xfa80('0xa')];_0x561a42=_0x52a636[_0xfa80('0x83')];return getRealtimeQueues(_0x107208,_0x4ffe19);})[_0xfa80('0x11')](function(_0x3aa4f9){_0x41535c=_0x3aa4f9['rows'];return getRealtimeAgents();})['then'](function(_0x21ea5a){_0x48ebd1=_0x21ea5a[_0xfa80('0x83')];if(_0x4ffe19!=_0xfa80('0x16'))return;return getRealtimeVoiceQueueChannels();})[_0xfa80('0x11')](function(_0x33bc33){_0x4d9998=_0x33bc33?_0x33bc33[_0xfa80('0x83')]:[];return initializeQueues(_0x561a42,_0x41535c,_0x4ffe19,_0x107208[_0xfa80('0x7a')]['type']);})[_0xfa80('0x11')](function(_0x43f8a1){var _0x41fedc=_0x43f8a1[_0xfa80('0x32')](function(_0x239b2b){if(_0x4ffe19==='voice')return getVoiceQueueAgents(_0x239b2b,_0x561a42,_0x48ebd1,_0x4d9998);else return getQueueAgents(_0x239b2b,_0x48ebd1,_0x4ffe19);});return Promise['all'](_0x41fedc);})[_0xfa80('0x11')](function(_0x8f1a1c){_0x2b16e3[_0xfa80('0x83')]=_0x8f1a1c;return _0x2b16e3;})['then'](respondWithFilteredResult(_0x42cea7,_0x464fbb))['catch'](handleError(_0x42cea7,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d46de8a..3db2599 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54ee85,_0x53708f){var _0x585070=function(_0x34650d){while(--_0x34650d){_0x54ee85['push'](_0x54ee85['shift']());}};_0x585070(++_0x53708f);}(_0xe706,0xa3));var _0x6e70=function(_0x46599d,_0x335ded){_0x46599d=_0x46599d-0x0;var _0x2e111a=_0xe706[_0x46599d];return _0x2e111a;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x48d266,_0x2cbd75){var _0x5eb912=function(_0x25a826){while(--_0x25a826){_0x48d266['push'](_0x48d266['shift']());}};_0x5eb912(++_0x2cbd75);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 814ebf7..aba064f 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 _0x4f0d=['STRING','DATE'];(function(_0x2fb875,_0x2de0b0){var _0x109743=function(_0x44ceb9){while(--_0x44ceb9){_0x2fb875['push'](_0x2fb875['shift']());}};_0x109743(++_0x2de0b0);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x11262c,_0x20d80b){_0x11262c=_0x11262c-0x0;var _0x23977b=_0x4f0d[_0x11262c];return _0x23977b;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xd4f0('0x0')]},'starttime':{'type':Sequelize[_0xd4f0('0x1')]},'responsetime':{'type':Sequelize[_0xd4f0('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd4f0('0x0')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc21c=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x7f813e,_0x566653){var _0x9aeda9=function(_0x561d4c){while(--_0x561d4c){_0x7f813e['push'](_0x7f813e['shift']());}};_0x9aeda9(++_0x566653);}(_0xc21c,0x166));var _0xcc21=function(_0x5b4a05,_0xc74583){_0x5b4a05=_0x5b4a05-0x0;var _0xaf74e1=_0xc21c[_0x5b4a05];return _0xaf74e1;};'use strict';var Sequelize=require(_0xcc21('0x0'));module[_0xcc21('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcc21('0x2')]},'scheduledat':{'type':Sequelize[_0xcc21('0x3')]},'uniqueid':{'type':Sequelize[_0xcc21('0x2')]},'starttime':{'type':Sequelize[_0xcc21('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xcc21('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xcc21('0x2')]},'campaigntype':{'type':Sequelize[_0xcc21('0x2')]},'membername':{'type':Sequelize[_0xcc21('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6cce1ed..b5dd971 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 _0x34de=['exports','ReportAgentPreview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x34de,0x141));var _0xe34d=function(_0x2da0a6,_0xc0b288){_0x2da0a6=_0x2da0a6-0x0;var _0xa0aab0=_0x34de[_0x2da0a6];return _0xa0aab0;};'use strict';var _=require(_0xe34d('0x0'));var util=require('util');var logger=require(_0xe34d('0x1'))(_0xe34d('0x2'));var moment=require(_0xe34d('0x3'));var BPromise=require(_0xe34d('0x4'));var rp=require(_0xe34d('0x5'));var fs=require('fs');var path=require(_0xe34d('0x6'));var rimraf=require(_0xe34d('0x7'));var config=require('../../config/environment');var attributes=require(_0xe34d('0x8'));module[_0xe34d('0x9')]=function(_0xff5959,_0x272d7a){return _0xff5959['define'](_0xe34d('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe43d=['api','moment','bluebird','request-promise','rimraf','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x4d4fcf,_0x41bcea){var _0x31b21c=function(_0x4988d4){while(--_0x4988d4){_0x4d4fcf['push'](_0x4d4fcf['shift']());}};_0x31b21c(++_0x41bcea);}(_0xe43d,0x105));var _0xde43=function(_0x20522a,_0x11bb0){_0x20522a=_0x20522a-0x0;var _0x3105e0=_0xe43d[_0x20522a];return _0x3105e0;};'use strict';var _=require(_0xde43('0x0'));var util=require(_0xde43('0x1'));var logger=require(_0xde43('0x2'))(_0xde43('0x3'));var moment=require(_0xde43('0x4'));var BPromise=require(_0xde43('0x5'));var rp=require(_0xde43('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde43('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xde43('0x8')]=function(_0x5f45b6,_0x44f88e){return _0x5f45b6[_0xde43('0x9')](_0xde43('0xa'),attributes,{'tableName':_0xde43('0xb'),'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 3a34c69..2c338a9 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 _0x329d=['stringify','error','code','message','catch','CreateReportAgentPreview','create','options','raw','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x20862b,_0x2904a8){var _0x1178d6=function(_0x1934a2){while(--_0x1934a2){_0x20862b['push'](_0x20862b['shift']());}};_0x1178d6(++_0x2904a8);}(_0x329d,0x8b));var _0xd329=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x329d[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd329('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd329('0x1'));var db=require(_0xd329('0x2'))['db'];var utils=require(_0xd329('0x3'));var logger=require(_0xd329('0x4'))(_0xd329('0x5'));var config=require(_0xd329('0x6'));var jayson=require(_0xd329('0x7'));var client=jayson[_0xd329('0x8')][_0xd329('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d6beb,_0x1bc96a,_0x4e4ed2){return new BPromise(function(_0x27c07e,_0x484b0e){return client[_0xd329('0xa')](_0x3d6beb,_0x4e4ed2)[_0xd329('0xb')](function(_0x51d062){logger[_0xd329('0xc')](_0xd329('0xd'),_0x1bc96a,_0xd329('0xe'));logger[_0xd329('0xf')](_0xd329('0x10'),_0x1bc96a,'request\x20sent',JSON[_0xd329('0x11')](_0x51d062));if(_0x51d062[_0xd329('0x12')]){if(_0x51d062['error'][_0xd329('0x13')]===0x1f4){logger[_0xd329('0x12')](_0xd329('0xd'),_0x1bc96a,_0x51d062['error']['message']);return _0x484b0e(_0x51d062['error']['message']);}logger[_0xd329('0x12')](_0xd329('0xd'),_0x1bc96a,_0x51d062[_0xd329('0x12')][_0xd329('0x14')]);return _0x27c07e(_0x51d062[_0xd329('0x12')][_0xd329('0x14')]);}else{logger[_0xd329('0xc')](_0xd329('0xd'),_0x1bc96a,_0xd329('0xe'));_0x27c07e(_0x51d062['result'][_0xd329('0x14')]);}})[_0xd329('0x15')](function(_0x24dbf4){logger['error'](_0xd329('0xd'),_0x1bc96a,_0x24dbf4);_0x484b0e(_0x24dbf4);});});}exports[_0xd329('0x16')]=function(_0x3528b4){var _0x101271=this;return new Promise(function(_0xa4ed1,_0x4140ff){return db['ReportAgentPreview'][_0xd329('0x17')](_0x3528b4['body'],{'raw':_0x3528b4[_0xd329('0x18')]?_0x3528b4[_0xd329('0x18')][_0xd329('0x19')]===undefined?!![]:![]:!![]})[_0xd329('0xb')](function(_0x447085){logger[_0xd329('0xc')](_0xd329('0x16'),_0x3528b4);logger[_0xd329('0xf')](_0xd329('0x16'),_0x3528b4,JSON[_0xd329('0x11')](_0x447085));_0xa4ed1(_0x447085);})['catch'](function(_0x141674){logger[_0xd329('0x12')](_0xd329('0x16'),_0x141674[_0xd329('0x14')],_0x3528b4);_0x4140ff(_0x101271['error'](0x1f4,_0x141674[_0xd329('0x14')]));});});}; \ No newline at end of file +var _0x890f=['result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1611b8,_0x10b4e7){var _0x241366=function(_0x42ff19){while(--_0x42ff19){_0x1611b8['push'](_0x1611b8['shift']());}};_0x241366(++_0x10b4e7);}(_0x890f,0x1c9));var _0xf890=function(_0x20cf0c,_0x14259b){_0x20cf0c=_0x20cf0c-0x0;var _0x4a5336=_0x890f[_0x20cf0c];return _0x4a5336;};'use strict';var _=require('lodash');var util=require(_0xf890('0x0'));var moment=require(_0xf890('0x1'));var BPromise=require('bluebird');var rs=require(_0xf890('0x2'));var fs=require('fs');var Redis=require(_0xf890('0x3'));var db=require(_0xf890('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf890('0x5'))(_0xf890('0x6'));var config=require(_0xf890('0x7'));var jayson=require(_0xf890('0x8'));var client=jayson['client'][_0xf890('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a4fd1,_0x10b22d,_0x55a4ac){return new BPromise(function(_0x548ee0,_0x1e06c7){return client[_0xf890('0xa')](_0x3a4fd1,_0x55a4ac)['then'](function(_0x45e47a){logger[_0xf890('0xb')](_0xf890('0xc'),_0x10b22d,'request\x20sent');logger[_0xf890('0xd')](_0xf890('0xe'),_0x10b22d,_0xf890('0xf'),JSON['stringify'](_0x45e47a));if(_0x45e47a[_0xf890('0x10')]){if(_0x45e47a['error'][_0xf890('0x11')]===0x1f4){logger[_0xf890('0x10')](_0xf890('0xc'),_0x10b22d,_0x45e47a[_0xf890('0x10')][_0xf890('0x12')]);return _0x1e06c7(_0x45e47a[_0xf890('0x10')][_0xf890('0x12')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x10b22d,_0x45e47a[_0xf890('0x10')][_0xf890('0x12')]);return _0x548ee0(_0x45e47a[_0xf890('0x10')]['message']);}else{logger[_0xf890('0xb')](_0xf890('0xc'),_0x10b22d,_0xf890('0xf'));_0x548ee0(_0x45e47a[_0xf890('0x13')][_0xf890('0x12')]);}})[_0xf890('0x14')](function(_0x394a36){logger[_0xf890('0x10')](_0xf890('0xc'),_0x10b22d,_0x394a36);_0x1e06c7(_0x394a36);});});}exports[_0xf890('0x15')]=function(_0x5b0f8b){var _0x542320=this;return new Promise(function(_0x1c9afd,_0x5ea813){return db[_0xf890('0x16')][_0xf890('0x17')](_0x5b0f8b[_0xf890('0x18')],{'raw':_0x5b0f8b[_0xf890('0x19')]?_0x5b0f8b[_0xf890('0x19')][_0xf890('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x469683){logger[_0xf890('0xb')]('CreateReportAgentPreview',_0x5b0f8b);logger[_0xf890('0xd')](_0xf890('0x15'),_0x5b0f8b,JSON[_0xf890('0x1b')](_0x469683));_0x1c9afd(_0x469683);})['catch'](function(_0x23c80e){logger[_0xf890('0x10')](_0xf890('0x15'),_0x23c80e[_0xf890('0x12')],_0x5b0f8b);_0x5ea813(_0x542320[_0xf890('0x10')](0x1f4,_0x23c80e[_0xf890('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 89219b3..dac39cb 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 _0xfc9a=['outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels'];(function(_0x5f34bc,_0x27d012){var _0x596f6a=function(_0x5d1cb3){while(--_0x5d1cb3){_0x5f34bc['push'](_0x5f34bc['shift']());}};_0x596f6a(++_0x27d012);}(_0xfc9a,0x83));var _0xafc9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfc9a[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xafc9('0x0'));var util=require(_0xafc9('0x1'));var path=require(_0xafc9('0x2'));var express=require(_0xafc9('0x3'));var router=express[_0xafc9('0x4')]();var auth=require(_0xafc9('0x5'));var controller=require(_0xafc9('0x6'));router[_0xafc9('0x7')](_0xafc9('0x8'),auth[_0xafc9('0x9')](),controller[_0xafc9('0xa')]);router[_0xafc9('0x7')](_0xafc9('0xb'),auth[_0xafc9('0x9')](),controller['voiceChannelMixMonitor']);router[_0xafc9('0x7')](_0xafc9('0xc'),auth[_0xafc9('0x9')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xafc9('0xd'),auth['isAuthenticated'](),controller[_0xafc9('0xe')]);router[_0xafc9('0x7')](_0xafc9('0xf'),auth[_0xafc9('0x9')](),controller['chatQueues']);router['get'](_0xafc9('0x10'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x11')]);router[_0xafc9('0x7')](_0xafc9('0x12'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x13')]);router['get'](_0xafc9('0x14'),auth['isAuthenticated'](),controller[_0xafc9('0x15')]);router['get'](_0xafc9('0x16'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x17')]);router[_0xafc9('0x7')](_0xafc9('0x18'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x19')]);router[_0xafc9('0x7')](_0xafc9('0x1a'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x1b')]);router[_0xafc9('0x7')](_0xafc9('0x1c'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x1d')]);router[_0xafc9('0x7')](_0xafc9('0x1e'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x1f')]);router['get'](_0xafc9('0x20'),auth['isAuthenticated'](),controller[_0xafc9('0x21')]);router[_0xafc9('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xafc9('0x9')](),controller[_0xafc9('0x22')]);router['get'](_0xafc9('0x23'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0xafc9('0x7')](_0xafc9('0x24'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x25')]);router[_0xafc9('0x26')](_0xafc9('0x24'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x27')]);router[_0xafc9('0x7')](_0xafc9('0x28'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x29')]);router[_0xafc9('0x7')](_0xafc9('0x2a'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x2b')]);router['get'](_0xafc9('0x2c'),auth[_0xafc9('0x9')](),controller['agents']);router[_0xafc9('0x26')](_0xafc9('0x2d'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x2e')]);router['get'](_0xafc9('0x2f'),auth[_0xafc9('0x9')](),controller['telephones']);router[_0xafc9('0x7')](_0xafc9('0x30'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x31')]);router[_0xafc9('0x7')](_0xafc9('0x32'),auth['isAuthenticated'](),controller['campaigns']);router[_0xafc9('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller[_0xafc9('0x33')]);router['get'](_0xafc9('0x34'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x35')]);router[_0xafc9('0x7')](_0xafc9('0x36'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x37')]);router['get'](_0xafc9('0x38'),auth['isAuthenticated'](),controller[_0xafc9('0x39')]);router[_0xafc9('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0xafc9('0x9')](),controller[_0xafc9('0x3a')]);router[_0xafc9('0x7')](_0xafc9('0x3b'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x3c')]);router['get'](_0xafc9('0x3d'),auth['isAuthenticated'](),controller[_0xafc9('0x3e')]);router[_0xafc9('0x7')](_0xafc9('0x3f'),auth['isAuthenticated'](),controller[_0xafc9('0x40')]);router[_0xafc9('0x41')](_0xafc9('0x42'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x43')](_0xafc9('0x44')));router[_0xafc9('0x7')](_0xafc9('0x45'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x46')]);router['post'](_0xafc9('0x47'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x43')](_0xafc9('0x48')));router[_0xafc9('0x7')](_0xafc9('0x49'),auth[_0xafc9('0x9')](),controller['showChatQueues']);router[_0xafc9('0x41')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xafc9('0x43')](_0xafc9('0x4a')));router[_0xafc9('0x7')](_0xafc9('0x4b'),auth[_0xafc9('0x9')](),controller['showFaxQueues']);router[_0xafc9('0x41')](_0xafc9('0x4c'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x43')]('openchannel'));router[_0xafc9('0x7')](_0xafc9('0x4d'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xafc9('0x41')](_0xafc9('0x4e'),auth[_0xafc9('0x9')](),controller['queueNotify'](_0xafc9('0x4f')));router['post'](_0xafc9('0x50'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x43')]('whatsapp'));router[_0xafc9('0x7')](_0xafc9('0x51'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x52')]);router[_0xafc9('0x7')](_0xafc9('0x53'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0xafc9('0x41')](_0xafc9('0x54'),auth[_0xafc9('0x9')](),controller[_0xafc9('0x55')]);module[_0xafc9('0x56')]=router; \ No newline at end of file +var _0x4998=['showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x4998,0x89));var _0x8499=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x4998[_0x54de5d];return _0x1b349e;};'use strict';var multer=require(_0x8499('0x0'));var util=require('util');var path=require(_0x8499('0x1'));var express=require(_0x8499('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x8499('0x3'));router[_0x8499('0x4')](_0x8499('0x5'),auth[_0x8499('0x6')](),controller[_0x8499('0x7')]);router['get'](_0x8499('0x8'),auth[_0x8499('0x6')](),controller[_0x8499('0x9')]);router['get'](_0x8499('0xa'),auth[_0x8499('0x6')](),controller[_0x8499('0xb')]);router[_0x8499('0x4')](_0x8499('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x8499('0x4')](_0x8499('0xd'),auth[_0x8499('0x6')](),controller[_0x8499('0xe')]);router[_0x8499('0x4')](_0x8499('0xf'),auth[_0x8499('0x6')](),controller[_0x8499('0x10')]);router['get'](_0x8499('0x11'),auth[_0x8499('0x6')](),controller[_0x8499('0x12')]);router[_0x8499('0x4')](_0x8499('0x13'),auth['isAuthenticated'](),controller[_0x8499('0x14')]);router[_0x8499('0x4')](_0x8499('0x15'),auth['isAuthenticated'](),controller[_0x8499('0x16')]);router[_0x8499('0x4')](_0x8499('0x17'),auth[_0x8499('0x6')](),controller['whatsappQueues']);router['get']('/fax/queues',auth[_0x8499('0x6')](),controller[_0x8499('0x18')]);router[_0x8499('0x4')](_0x8499('0x19'),auth[_0x8499('0x6')](),controller[_0x8499('0x1a')]);router[_0x8499('0x4')]('/voice/queues/channels',auth[_0x8499('0x6')](),controller[_0x8499('0x1b')]);router[_0x8499('0x4')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x8499('0x1c')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x8499('0x6')](),controller[_0x8499('0x1d')]);router['get'](_0x8499('0x1e'),auth['isAuthenticated'](),controller[_0x8499('0x1f')]);router[_0x8499('0x4')](_0x8499('0x20'),auth[_0x8499('0x6')](),controller[_0x8499('0x21')]);router[_0x8499('0x22')]('/voice/queues/:id',auth[_0x8499('0x6')](),controller[_0x8499('0x23')]);router[_0x8499('0x4')](_0x8499('0x24'),auth[_0x8499('0x6')](),controller[_0x8499('0x25')]);router[_0x8499('0x4')](_0x8499('0x26'),auth[_0x8499('0x6')](),controller['outboundChannels']);router[_0x8499('0x4')](_0x8499('0x27'),auth[_0x8499('0x6')](),controller[_0x8499('0x28')]);router[_0x8499('0x22')](_0x8499('0x29'),auth[_0x8499('0x6')](),controller[_0x8499('0x2a')]);router[_0x8499('0x4')]('/telephones',auth[_0x8499('0x6')](),controller[_0x8499('0x2b')]);router[_0x8499('0x4')](_0x8499('0x2c'),auth[_0x8499('0x6')](),controller[_0x8499('0x2d')]);router[_0x8499('0x4')](_0x8499('0x2e'),auth[_0x8499('0x6')](),controller[_0x8499('0x2f')]);router['get'](_0x8499('0x30'),auth[_0x8499('0x6')](),controller[_0x8499('0x31')]);router[_0x8499('0x4')](_0x8499('0x32'),auth[_0x8499('0x6')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x8499('0x33'),auth[_0x8499('0x6')](),controller[_0x8499('0x34')]);router[_0x8499('0x4')](_0x8499('0x35'),auth[_0x8499('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x8499('0x4')](_0x8499('0x36'),auth[_0x8499('0x6')](),controller[_0x8499('0x37')]);router['get'](_0x8499('0x38'),auth[_0x8499('0x6')](),controller[_0x8499('0x39')]);router[_0x8499('0x4')](_0x8499('0x3a'),auth['isAuthenticated'](),controller[_0x8499('0x3b')]);router[_0x8499('0x4')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x8499('0x3c')](_0x8499('0x3d'),auth[_0x8499('0x6')](),controller[_0x8499('0x3e')](_0x8499('0x3f')));router[_0x8499('0x4')](_0x8499('0x40'),auth[_0x8499('0x6')](),controller[_0x8499('0x41')]);router[_0x8499('0x3c')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x8499('0x42')));router[_0x8499('0x4')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x8499('0x43')]);router[_0x8499('0x3c')](_0x8499('0x44'),auth['isAuthenticated'](),controller[_0x8499('0x3e')]('fax'));router[_0x8499('0x4')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x8499('0x45')]);router[_0x8499('0x3c')](_0x8499('0x46'),auth[_0x8499('0x6')](),controller[_0x8499('0x3e')](_0x8499('0x47')));router[_0x8499('0x4')](_0x8499('0x48'),auth[_0x8499('0x6')](),controller[_0x8499('0x49')]);router[_0x8499('0x3c')](_0x8499('0x4a'),auth['isAuthenticated'](),controller[_0x8499('0x3e')](_0x8499('0x4b')));router[_0x8499('0x3c')](_0x8499('0x4c'),auth[_0x8499('0x6')](),controller[_0x8499('0x3e')](_0x8499('0x4d')));router[_0x8499('0x4')](_0x8499('0x4e'),auth[_0x8499('0x6')](),controller[_0x8499('0x4f')]);router[_0x8499('0x4')](_0x8499('0x50'),auth[_0x8499('0x6')](),controller[_0x8499('0x51')]);router[_0x8499('0x3c')](_0x8499('0x52'),auth[_0x8499('0x6')](),controller[_0x8499('0x53')]);module[_0x8499('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1e9b742..1bc8567 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 _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x1444d4,_0xe4af52){var _0x351c9c=function(_0x2b26a6){while(--_0x2b26a6){_0x1444d4['push'](_0x1444d4['shift']());}};_0x351c9c(++_0xe4af52);}(_0x6f47,0xc7));var _0x76f4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6f47[_0x5f0089];return _0x193892;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file +var _0x7fbe=['VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','user','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','create','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','From','TransferReport','Start','agentTransferTimeout','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','result','catch','status','json','stack','name','send','isNil','find','voiceChannels','query','VoiceChannelMixMonitor','merge','params','then','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2a0a38,_0x4a6de5){_0x2a0a38=_0x2a0a38-0x0;var _0x4a200e=_0x7fbe[_0x2a0a38];return _0x4a200e;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var db=require(_0xe7fb('0x2'))['db'];var logger=require(_0xe7fb('0x3'))(_0xe7fb('0x4'));var jayson=require(_0xe7fb('0x5'));var amiClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232a});var mailClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232b});var routingClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){var _0x1d0741=_0x5ad75b?_0x5ad75b:amiClient;return _0x1d0741[_0xe7fb('0x8')](_0x24cd67,_0x1f943f)['then'](function(_0x558857){if(_0x558857[_0xe7fb('0x9')]){if(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xa')]===0x1f4){return _0x228f6b(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}return _0x213ebc(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}else{_0x213ebc(_0x558857[_0xe7fb('0xc')]);}})[_0xe7fb('0xd')](function(_0x2fe8ab){_0x228f6b(_0x2fe8ab);});});}function respondWithResult(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xc8;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0xe')](_0x188e1d)[_0xe7fb('0xf')](_0xdf9760);}return _0x2437d4['sendStatus'](0x194);};}function handleError(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0x1f4;return function(_0x5573ab){logger[_0xe7fb('0x9')](_0x5573ab[_0xe7fb('0x10')]);if(_0x5573ab['name']){delete _0x5573ab[_0xe7fb('0x11')];}_0x278b75['status'](_0x2225e5)[_0xe7fb('0x12')](_0x5573ab);};}function findById(_0x18d23c){return function(_0x12603d){if(!_[_0xe7fb('0x13')](_0x18d23c)&&!_['isNil'](_0x12603d)&&!_[_0xe7fb('0x13')](_0x12603d['rows'])){return _[_0xe7fb('0x14')](_0x12603d['rows'],function(_0x1e77fd){return _0x1e77fd['id']==_0x18d23c;});}return null;};}exports[_0xe7fb('0x15')]=function(_0x3f96a7,_0x182269){return respondWithRpcPromise('VoiceChannels',_0x3f96a7[_0xe7fb('0x16')])['then'](respondWithResult(_0x182269,null))[_0xe7fb('0xd')](handleError(_0x182269,null));};exports['voiceChannelMixMonitor']=function(_0x15f7a4,_0x4ea664){return respondWithRpcPromise(_0xe7fb('0x17'),_[_0xe7fb('0x18')](_0x15f7a4['query'],_0x15f7a4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x4ea664,null))[_0xe7fb('0xd')](handleError(_0x4ea664,null));};exports['voiceChannelStopMixMonitor']=function(_0x469d50,_0x469ead){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x469d50['query'],_0x469d50[_0xe7fb('0x19')]))['then'](respondWithResult(_0x469ead,null))['catch'](handleError(_0x469ead,null));};exports[_0xe7fb('0x1b')]=function(_0x32e8b2,_0x2996ae){return respondWithRpcPromise('VoiceQueues',_0x32e8b2[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2996ae,null))[_0xe7fb('0xd')](handleError(_0x2996ae,null));};exports[_0xe7fb('0x1c')]=function(_0x392d75,_0x16237a){return respondWithRpcPromise(_0xe7fb('0x1d'),_0x392d75['query'])['then'](findById(_0x392d75[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x16237a,null))[_0xe7fb('0xd')](handleError(_0x16237a,null));};exports['updateVoiceQueue']=function(_0xb1f2f4,_0x251807){return respondWithRpcPromise(_0xe7fb('0x1e'),_[_0xe7fb('0x18')](_0xb1f2f4[_0xe7fb('0x1f')],_0xb1f2f4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x251807,null))[_0xe7fb('0xd')](handleError(_0x251807,null));};exports['voiceQueuesPreview']=function(_0x3d1fb5,_0x1742f3){return respondWithRpcPromise(_0xe7fb('0x20'),_['merge'](_0x3d1fb5['query'],_0x3d1fb5[_0xe7fb('0x19')]))['then'](respondWithResult(_0x1742f3,null))[_0xe7fb('0xd')](handleError(_0x1742f3,null));};exports[_0xe7fb('0x21')]=function(_0xe49053,_0x2a4745){return respondWithRpcPromise('VoiceQueuesChannels',_0xe49053[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2a4745,null))[_0xe7fb('0xd')](handleError(_0x2a4745,null));};exports[_0xe7fb('0x22')]=function(_0x2d650d,_0x480819){return respondWithRpcPromise(_0xe7fb('0x23'),_[_0xe7fb('0x18')](_0x2d650d[_0xe7fb('0x16')],_0x2d650d[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x480819,null))[_0xe7fb('0xd')](handleError(_0x480819,null));};exports[_0xe7fb('0x24')]=function(_0x147eb1,_0x389903){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xe7fb('0x18')](_0x147eb1[_0xe7fb('0x16')],_0x147eb1[_0xe7fb('0x19')]))['then'](respondWithResult(_0x389903,null))[_0xe7fb('0xd')](handleError(_0x389903,null));};exports[_0xe7fb('0x25')]=function(_0x4218bc,_0x1530b1){return respondWithRpcPromise(_0xe7fb('0x26'),_[_0xe7fb('0x18')](_0x4218bc[_0xe7fb('0x16')],_0x4218bc[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x1530b1,null))[_0xe7fb('0xd')](handleError(_0x1530b1,null));};exports[_0xe7fb('0x27')]=function(_0x3c4f4b,_0x1544f2){return respondWithRpcPromise(_0xe7fb('0x28'),_0x3c4f4b[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1544f2,null))[_0xe7fb('0xd')](handleError(_0x1544f2,null));};exports[_0xe7fb('0x29')]=function(_0x21e35c,_0x4d6fe6){return respondWithRpcPromise(_0xe7fb('0x2a'),_0x21e35c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x4d6fe6,null))[_0xe7fb('0xd')](handleError(_0x4d6fe6,null));};exports['agents']=function(_0x3426a9,_0x186418){var _0xd472d;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9['query'])[_0xe7fb('0x1a')](function(_0x451a6c){_0xd472d=_0x451a6c;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9[_0xe7fb('0x16')],routingClient);})[_0xe7fb('0x1a')](function(_0xb729fc){return _['merge']({},_0xb729fc,_0xd472d);})[_0xe7fb('0x1a')](respondWithResult(_0x186418,null))[_0xe7fb('0xd')](handleError(_0x186418,null));};exports[_0xe7fb('0x2c')]=function(_0x4b263d,_0x36a341){if(_0x4b263d[_0xe7fb('0x1f')]&&_0x4b263d['body']['interaction']&&_0x4b263d['user']&&_0x4b263d['user']['name']){for(var _0x900d67 in _0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')]){if(_0x4b263d['body'][_0xe7fb('0x2d')]['hasOwnProperty'](_0x900d67)){db[_0xe7fb('0x2e')][_0xe7fb('0x2f')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'type':_0xe7fb('0x30'),'exitAt':null,'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67]&&_0x4b263d['body'][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')]?{'$notIn':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67]}:{'$ne':null}}})[_0xe7fb('0x1a')](function(_0x6eb1ab){var _0x13b17f=moment()[_0xe7fb('0x32')](_0xe7fb('0x33'));for(var _0x5a1ce1=0x0,_0x2eb999=_0x6eb1ab['length'];_0x5a1ce1<_0x2eb999;_0x5a1ce1+=0x1){_0x6eb1ab[_0x5a1ce1][_0xe7fb('0x34')]({'exitAt':_0x13b17f});}});for(var _0x468c62=0x0;_0x468c62<_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')];_0x468c62+=0x1){db['MemberReport'][_0xe7fb('0x35')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user']['name'],'type':_0xe7fb('0x30'),'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0x468c62],'exitAt':null},'defaults':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'interface':_[_0xe7fb('0x13')](_0x4b263d['user']['interface'])?util[_0xe7fb('0x32')](_0xe7fb('0x36'),_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x11')]):_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x38')],'type':_0xe7fb('0x30'),'enterAt':moment()[_0xe7fb('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe7fb('0x39'),'internal':_0x4b263d['user'][_0xe7fb('0x3a')],'uniqueid':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67][_0x468c62]}});}}}}return respondWithRpcPromise(_0xe7fb('0x3b'),{'id':_0x4b263d['params']['id'],'capacity':_0x4b263d[_0xe7fb('0x1f')]['capacity']},routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x36a341,null))['catch'](handleError(_0x36a341,null));};exports[_0xe7fb('0x3c')]=function(_0x59158c,_0x1fff6c){return respondWithRpcPromise(_0xe7fb('0x3d'),_0x59158c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1fff6c,null))[_0xe7fb('0xd')](handleError(_0x1fff6c,null));};exports[_0xe7fb('0x3e')]=function(_0x2f4760,_0x582a4a){return respondWithRpcPromise('Trunks',_0x2f4760[_0xe7fb('0x16')])['then'](respondWithResult(_0x582a4a,null))['catch'](handleError(_0x582a4a,null));};exports['campaigns']=function(_0x50b8df,_0x539252){return respondWithRpcPromise(_0xe7fb('0x3f'),_0x50b8df[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x539252,null))[_0xe7fb('0xd')](handleError(_0x539252,null));};exports['chatQueues']=function(_0x37af37,_0x236b35){return respondWithRpcPromise(_0xe7fb('0x40'),_0x37af37['query'],routingClient)['then'](respondWithResult(_0x236b35,null))[_0xe7fb('0xd')](handleError(_0x236b35,null));};exports[_0xe7fb('0x41')]=function(_0x300b8e,_0x4f4ba3){return respondWithRpcPromise(_0xe7fb('0x40'),_0x300b8e[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x300b8e[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x4f4ba3,null))['catch'](handleError(_0x4f4ba3,null));};exports[_0xe7fb('0x42')]=function(_0x3104c2,_0x1f16b2){return respondWithRpcPromise(_0xe7fb('0x43'),_0x3104c2[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x1f16b2,null))[_0xe7fb('0xd')](handleError(_0x1f16b2,null));};exports[_0xe7fb('0x44')]=function(_0x23755b,_0x590d7a){return respondWithRpcPromise('MailQueues',_0x23755b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x23755b[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x590d7a,null))[_0xe7fb('0xd')](handleError(_0x590d7a,null));};exports[_0xe7fb('0x45')]=function(_0x585b7c,_0x1e21e4){return respondWithRpcPromise(_0xe7fb('0x46'),_0x585b7c[_0xe7fb('0x16')],mailClient)[_0xe7fb('0x1a')](respondWithResult(_0x1e21e4,null))[_0xe7fb('0xd')](handleError(_0x1e21e4,null));};exports[_0xe7fb('0x47')]=function(_0x554092,_0x2e457c){return respondWithRpcPromise('OpenchannelQueues',_0x554092[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2e457c,null))[_0xe7fb('0xd')](handleError(_0x2e457c,null));};exports[_0xe7fb('0x48')]=function(_0x5925e6,_0x47ac92){return respondWithRpcPromise(_0xe7fb('0x49'),_0x5925e6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5925e6[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x47ac92,null))['catch'](handleError(_0x47ac92,null));};exports[_0xe7fb('0x4a')]=function(_0x58d4ec,_0x127b0e){return respondWithRpcPromise('SmsQueues',_0x58d4ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x127b0e,null))[_0xe7fb('0xd')](handleError(_0x127b0e,null));};exports[_0xe7fb('0x4b')]=function(_0x5da884,_0x475716){return respondWithRpcPromise(_0xe7fb('0x4c'),_0x5da884[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5da884[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x475716,null))[_0xe7fb('0xd')](handleError(_0x475716,null));};exports[_0xe7fb('0x4d')]=function(_0x5151ec,_0x4136ae){return respondWithRpcPromise(_0xe7fb('0x4e'),_0x5151ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x4136ae,null))['catch'](handleError(_0x4136ae,null));};exports[_0xe7fb('0x4f')]=function(_0x1dc9c1,_0xa93f35){return respondWithRpcPromise('WhatsappQueues',_0x1dc9c1[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x1dc9c1[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0xa93f35,null))[_0xe7fb('0xd')](handleError(_0xa93f35,null));};exports[_0xe7fb('0x50')]=function(_0xcdc72e,_0x187040){return respondWithRpcPromise('FaxQueues',_0xcdc72e['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x187040,null))[_0xe7fb('0xd')](handleError(_0x187040,null));};exports[_0xe7fb('0x51')]=function(_0x50c705,_0x519c5f){return respondWithRpcPromise(_0xe7fb('0x52'),_0x50c705[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x50c705[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x519c5f,null))[_0xe7fb('0xd')](handleError(_0x519c5f,null));};exports[_0xe7fb('0x53')]=function(_0x3f11f1,_0xb06693){return respondWithRpcPromise(_0xe7fb('0x54'),_0x3f11f1[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0xb06693,null))[_0xe7fb('0xd')](handleError(_0xb06693,null));};exports['chatQueuesWaitingInteractions']=function(_0x4fa142,_0x125427){return respondWithRpcPromise(_0xe7fb('0x55'),_0x4fa142[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x125427,null))[_0xe7fb('0xd')](handleError(_0x125427,null));};exports['mailQueuesWaitingInteractions']=function(_0x43f14b,_0x1beb13){return respondWithRpcPromise(_0xe7fb('0x56'),_0x43f14b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x1beb13,null))[_0xe7fb('0xd')](handleError(_0x1beb13,null));};exports[_0xe7fb('0x57')]=function(_0x1e6256,_0xa7fa61){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1e6256[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0xa7fa61,null))[_0xe7fb('0xd')](handleError(_0xa7fa61,null));};exports[_0xe7fb('0x58')]=function(_0x2a2079,_0x31c159){return respondWithRpcPromise(_0xe7fb('0x59'),_0x2a2079['query'],routingClient)[_0xe7fb('0x1a')](function(_0x38e66a){if(_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')]!==undefined){var _0x15d881=_(_0x38e66a[_0xe7fb('0x5b')])[_0xe7fb('0x5c')]([_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')],_0x2a2079[_0xe7fb('0x19')]['id']])[_0xe7fb('0x5d')](_0xe7fb('0x5e'))[_0xe7fb('0x5f')]()[_0xe7fb('0x60')]();return _0x38e66a['rows']['filter'](function(_0x48a015){return _0x15d881[_0xe7fb('0x61')](_0x48a015[_0xe7fb('0x5e')])>-0x1;});}else{return _0x38e66a[_0xe7fb('0x5b')][_0xe7fb('0x5c')](function(_0x535e8b){return _0x535e8b[_0xe7fb('0x5e')]===parseInt(_0x2a2079[_0xe7fb('0x19')]['id']);});}})[_0xe7fb('0x1a')](respondWithResult(_0x31c159,null))[_0xe7fb('0xd')](handleError(_0x31c159,null));};exports['smsQueuesWaitingInteractions']=function(_0x2f7fa6,_0x5650c6){return respondWithRpcPromise(_0xe7fb('0x62'),_0x2f7fa6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x5650c6,null))[_0xe7fb('0xd')](handleError(_0x5650c6,null));};exports[_0xe7fb('0x63')]=function(_0x4ab541,_0x3ffd6c){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4ab541[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x3ffd6c,null))[_0xe7fb('0xd')](handleError(_0x3ffd6c,null));};exports[_0xe7fb('0x64')]=function(_0x4c37cd,_0x2b6d69){return respondWithRpcPromise(_0xe7fb('0x65'),_0x4c37cd[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2b6d69,null))['catch'](handleError(_0x2b6d69,null));};exports[_0xe7fb('0x66')]=function(_0x277335){return function(_0x1412e2,_0x4d0eed){var _0x11d5b6,_0x4b2cc4;var _0x5b1e28=_['capitalize'](_0x277335);var _0x3c99e7=_0x277335===_0xe7fb('0x67')?'Website':_0xe7fb('0x68');return db[_0x5b1e28+_0xe7fb('0x69')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0x1412e2[_0xe7fb('0x19')]['id']}})[_0xe7fb('0x1a')](function(_0x1cc21d){if(_[_0xe7fb('0x13')](_0x1cc21d)){throw new Error(_0x5b1e28+_0xe7fb('0x6b'));}_0x11d5b6=_0x1cc21d;return db[_0x5b1e28+_0xe7fb('0x6c')][_0xe7fb('0x6a')]({'where':{'id':_0x1412e2[_0xe7fb('0x1f')][_0xe7fb('0x6d')]},'include':[{'model':db[_0x5b1e28+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x5b1e28+_0x3c99e7],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x3c5bd9){if(_[_0xe7fb('0x13')](_0x3c5bd9)){throw new Error(_0x5b1e28+_0xe7fb('0x6f'));}_0x4b2cc4=_0x3c5bd9;return _0x3c5bd9[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x47568c={'uniqueid':_0x277335+'.'+_0x4b2cc4['id']+'.'+_0x4b2cc4[_0xe7fb('0x6e')]['id'],'FromUserId':_0x1412e2[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71')};_0x47568c[_0x5b1e28+_0xe7fb('0x72')]=_0x4b2cc4['id'];_0x47568c[_0x5b1e28+_0xe7fb('0x73')]=_0x4b2cc4[_0xe7fb('0x6e')]['id'];_0x47568c['From'+_0x5b1e28+_0x3c99e7+'Id']=_0x4b2cc4['Account']['id'];_0x47568c['To'+_0x5b1e28+_0xe7fb('0x74')]=_0x11d5b6['id'];return db[_0x5b1e28+'TransferReport'][_0xe7fb('0x75')](_0x47568c);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise('Start',{'channel':_0x277335,'interaction':_0x4b2cc4[_0xe7fb('0x6e')],'message':_0x4b2cc4,'account':_0x4b2cc4[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x71'),'appdata':_0x11d5b6[_0xe7fb('0x11')]+','+(_0x4b2cc4[_0xe7fb('0x68')][_0xe7fb('0x76')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x4d0eed,null))[_0xe7fb('0xd')](handleError(_0x4d0eed,null));};};exports[_0xe7fb('0x77')]=function(_0xae9441,_0x276c28){var _0xd5a417,_0x48de0c;if(_['isNil'](_0xae9441['body'][_0xe7fb('0x78')])){throw new Error(_0xe7fb('0x79'));}var _0x2b0600=_0xae9441['body'][_0xe7fb('0x78')];var _0x57ee3b=_[_0xe7fb('0x7a')](_0x2b0600);var _0x278a6c=_0x2b0600===_0xe7fb('0x67')?_0xe7fb('0x7b'):'Account';return db[_0xe7fb('0x7c')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0xae9441[_0xe7fb('0x19')]['id'],'role':_0xe7fb('0x39')}})[_0xe7fb('0x1a')](function(_0x33262f){if(_[_0xe7fb('0x13')](_0x33262f)){throw new Error(_0xe7fb('0x7d'));}_0xd5a417=_0x33262f;return db[_0x57ee3b+'Message']['findOne']({'where':{'id':_0xae9441[_0xe7fb('0x1f')]['messageId']},'include':[{'model':db[_0x57ee3b+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x57ee3b+_0x278a6c],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x58352d){if(_['isNil'](_0x58352d)){throw new Error(_0x57ee3b+_0xe7fb('0x6f'));}_0x48de0c=_0x58352d;return _0x58352d[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x21cb12={'uniqueid':_0x2b0600+'.'+_0x48de0c['id']+'.'+_0x48de0c[_0xe7fb('0x6e')]['id'],'FromUserId':_0xae9441[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71'),'ToUserId':_0xd5a417['id']};_0x21cb12[_0x57ee3b+_0xe7fb('0x72')]=_0x48de0c['id'];_0x21cb12[_0x57ee3b+_0xe7fb('0x73')]=_0x48de0c['Interaction']['id'];_0x21cb12[_0xe7fb('0x7e')+_0x57ee3b+_0x278a6c+'Id']=_0x48de0c[_0xe7fb('0x68')]['id'];return db[_0x57ee3b+_0xe7fb('0x7f')][_0xe7fb('0x75')](_0x21cb12);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise(_0xe7fb('0x80'),{'channel':_0x2b0600,'interaction':_0x48de0c[_0xe7fb('0x6e')],'message':_0x48de0c,'account':_0x48de0c[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x39'),'appdata':_0xd5a417[_0xe7fb('0x11')]+','+(_0x48de0c[_0xe7fb('0x68')][_0xe7fb('0x81')]||0x12c),'interval':_0xe7fb('0x82')}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x276c28,null))[_0xe7fb('0xd')](handleError(_0x276c28,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 41b0e8d..01ab29f 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 _0x48c1=['put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','run','post','create'];(function(_0x2df8a1,_0x3594be){var _0x2432b5=function(_0x2b6e5c){while(--_0x2b6e5c){_0x2df8a1['push'](_0x2df8a1['shift']());}};_0x2432b5(++_0x3594be);}(_0x48c1,0xb8));var _0x148c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x48c1[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x148c('0x0'));var util=require(_0x148c('0x1'));var path=require(_0x148c('0x2'));var timeout=require('connect-timeout');var express=require(_0x148c('0x3'));var router=express[_0x148c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x148c('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x148c('0x6')]('/',auth[_0x148c('0x7')](),controller[_0x148c('0x8')]);router[_0x148c('0x6')](_0x148c('0x9'),auth[_0x148c('0x7')](),controller[_0x148c('0xa')]);router[_0x148c('0x6')]('/:id/run',auth[_0x148c('0x7')](),controller[_0x148c('0xb')]);router[_0x148c('0xc')]('/',auth['isAuthenticated'](),controller[_0x148c('0xd')]);router[_0x148c('0xe')](_0x148c('0x9'),auth[_0x148c('0x7')](),controller['update']);router[_0x148c('0xf')]('/:id',auth[_0x148c('0x7')](),controller[_0x148c('0x10')]);module[_0x148c('0x11')]=router; \ No newline at end of file +var _0x59b9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/run','post','create','put','update','delete','exports','multer','util','path'];(function(_0x279d3c,_0x428133){var _0x591b14=function(_0x262412){while(--_0x262412){_0x279d3c['push'](_0x279d3c['shift']());}};_0x591b14(++_0x428133);}(_0x59b9,0x89));var _0x959b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x59b9[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x959b('0x0'));var util=require(_0x959b('0x1'));var path=require(_0x959b('0x2'));var timeout=require(_0x959b('0x3'));var express=require('express');var router=express[_0x959b('0x4')]();var fs_extra=require(_0x959b('0x5'));var auth=require(_0x959b('0x6'));var interaction=require(_0x959b('0x7'));var config=require(_0x959b('0x8'));var controller=require('./schedule.controller');router[_0x959b('0x9')]('/',auth[_0x959b('0xa')](),controller['index']);router['get'](_0x959b('0xb'),auth['isAuthenticated'](),controller[_0x959b('0xc')]);router['get'](_0x959b('0xd'),auth[_0x959b('0xa')](),controller['run']);router[_0x959b('0xe')]('/',auth[_0x959b('0xa')](),controller[_0x959b('0xf')]);router[_0x959b('0x10')](_0x959b('0xb'),auth[_0x959b('0xa')](),controller[_0x959b('0x11')]);router[_0x959b('0x12')](_0x959b('0xb'),auth[_0x959b('0xa')](),controller['destroy']);module[_0x959b('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f3e4af4..58a3bfb 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 _0x3cad=['DATE','INTEGER','years','quarters','months','weeks','hours','minutes','days','ENUM','csv','pdf','xlsx','custom','TEXT','BOOLEAN','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3cad,0xa8));var _0xd3ca=function(_0x523c09,_0x130c71){_0x523c09=_0x523c09-0x0;var _0x9de2ac=_0x3cad[_0x523c09];return _0x9de2ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd3ca('0x0')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd3ca('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xd3ca('0x2')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd3ca('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xd3ca('0x4'),_0xd3ca('0x5'),_0xd3ca('0x6'),_0xd3ca('0x7'),'days',_0xd3ca('0x8'),_0xd3ca('0x9')),'allowNull':![],'defaultValue':_0xd3ca('0xa')},'output':{'type':Sequelize[_0xd3ca('0xb')](_0xd3ca('0xc'),_0xd3ca('0xd'),_0xd3ca('0xe')),'allowNull':![],'defaultValue':_0xd3ca('0xc')},'type':{'type':Sequelize['ENUM'](_0xd3ca('0xf'),'default'),'allowNull':![],'defaultValue':_0xd3ca('0xf')},'sendMail':{'type':Sequelize[_0xd3ca('0x0')],'defaultValue':![]},'email':{'type':Sequelize[_0xd3ca('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xd3ca('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4dba=['TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','years','weeks','days','minutes','ENUM','csv','pdf','custom'];(function(_0x5cb7d6,_0x5485ae){var _0x28171c=function(_0x56718b){while(--_0x56718b){_0x5cb7d6['push'](_0x5cb7d6['shift']());}};_0x28171c(++_0x5485ae);}(_0x4dba,0x1c3));var _0xa4db=function(_0x5ae6b2,_0x318e68){_0x5ae6b2=_0x5ae6b2-0x0;var _0x5d899c=_0x4dba[_0x5ae6b2];return _0x5d899c;};'use strict';var Sequelize=require(_0xa4db('0x0'));module[_0xa4db('0x1')]={'name':{'type':Sequelize[_0xa4db('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa4db('0x2')]},'active':{'type':Sequelize[_0xa4db('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa4db('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xa4db('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa4db('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa4db('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xa4db('0x6'),'quarters','months',_0xa4db('0x7'),_0xa4db('0x8'),'hours',_0xa4db('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa4db('0xa')](_0xa4db('0xb'),_0xa4db('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xa4db('0xb')},'type':{'type':Sequelize[_0xa4db('0xa')]('custom','default'),'allowNull':![],'defaultValue':_0xa4db('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xa4db('0xe')]},'bcc':{'type':Sequelize[_0xa4db('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xa4db('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a685cf6..0b59a13 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 _0x4a6a=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','map','Schedule','rawAttributes','key','model','query','filters','attributes','intersection','fields'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x4a6a,0x168));var _0xa4a6=function(_0x32b792,_0x345945){_0x32b792=_0x32b792-0x0;var _0x2e5308=_0x4a6a[_0x32b792];return _0x2e5308;};'use strict';var emlformat=require(_0xa4a6('0x0'));var rimraf=require(_0xa4a6('0x1'));var zipdir=require(_0xa4a6('0x2'));var jsonpatch=require(_0xa4a6('0x3'));var rp=require(_0xa4a6('0x4'));var moment=require('moment');var BPromise=require(_0xa4a6('0x5'));var Mustache=require(_0xa4a6('0x6'));var util=require(_0xa4a6('0x7'));var path=require(_0xa4a6('0x8'));var sox=require(_0xa4a6('0x9'));var csv=require(_0xa4a6('0xa'));var ejs=require(_0xa4a6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa4a6('0xc'));var crypto=require(_0xa4a6('0xd'));var jsforce=require(_0xa4a6('0xe'));var deskjs=require(_0xa4a6('0xf'));var toCsv=require(_0xa4a6('0xa'));var querystring=require(_0xa4a6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa4a6('0x11'));var qs=require(_0xa4a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4a6('0x13'))('api');var utils=require(_0xa4a6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa4a6('0x15'));var db=require(_0xa4a6('0x16'))['db'];function respondWithStatusCode(_0x23f182,_0x1fa128){_0x1fa128=_0x1fa128||0xcc;return function(_0x23628b){if(_0x23628b){return _0x23f182[_0xa4a6('0x17')](_0x1fa128);}return _0x23f182['status'](_0x1fa128)[_0xa4a6('0x18')]();};}function respondWithResult(_0x51afdb,_0xd769e9){_0xd769e9=_0xd769e9||0xc8;return function(_0x390bee){if(_0x390bee){return _0x51afdb[_0xa4a6('0x19')](_0xd769e9)[_0xa4a6('0x1a')](_0x390bee);}};}function respondWithFilteredResult(_0x1bcc80,_0x5c8f63){return function(_0x247439){if(_0x247439){var _0x107267=typeof _0x5c8f63['offset']===_0xa4a6('0x1b')&&typeof _0x5c8f63[_0xa4a6('0x1c')]==='undefined';var _0x215078=_0x247439['count'];var _0x5af8e8=_0x107267?0x0:_0x5c8f63['offset'];var _0x2da708=_0x107267?_0x247439[_0xa4a6('0x1d')]:_0x5c8f63[_0xa4a6('0x1e')]+_0x5c8f63['limit'];var _0x8d6d68;if(_0x2da708>=_0x215078){_0x2da708=_0x215078;_0x8d6d68=0xc8;}else{_0x8d6d68=0xce;}_0x1bcc80['status'](_0x8d6d68);return _0x1bcc80[_0xa4a6('0x1f')](_0xa4a6('0x20'),_0x5af8e8+'-'+_0x2da708+'/'+_0x215078)[_0xa4a6('0x1a')](_0x247439);}return null;};}function patchUpdates(_0xf6b806){return function(_0x1780ed){try{jsonpatch[_0xa4a6('0x21')](_0x1780ed,_0xf6b806,!![]);}catch(_0x40a027){return BPromise[_0xa4a6('0x22')](_0x40a027);}return _0x1780ed[_0xa4a6('0x23')]();};}function saveUpdates(_0x4fe34d,_0x1dc15c){return function(_0x4ba24c){if(_0x4ba24c){return _0x4ba24c[_0xa4a6('0x24')](_0x4fe34d)[_0xa4a6('0x25')](function(_0x40160a){return _0x40160a;});}return null;};}function removeEntity(_0x4a2f3f,_0x2c61ee){return function(_0x56dc9b){if(_0x56dc9b){return _0x56dc9b[_0xa4a6('0x26')]()[_0xa4a6('0x25')](function(){var _0x21fb10=_0x56dc9b[_0xa4a6('0x27')]({'plain':!![]});var _0x37ff2d=_0xa4a6('0x28');return db[_0xa4a6('0x29')][_0xa4a6('0x26')]({'where':{'type':_0x37ff2d,'resourceId':_0x21fb10['id']}})[_0xa4a6('0x25')](function(){return _0x56dc9b;});})[_0xa4a6('0x25')](function(){_0x4a2f3f[_0xa4a6('0x19')](0xcc)[_0xa4a6('0x18')]();});}};}function handleEntityNotFound(_0x1b9596,_0xfac93a){return function(_0xd8e656){if(!_0xd8e656){_0x1b9596[_0xa4a6('0x17')](0x194);}return _0xd8e656;};}function handleError(_0x35d10c,_0x41bcbd){_0x41bcbd=_0x41bcbd||0x1f4;return function(_0x28a4c1){logger[_0xa4a6('0x2a')](_0x28a4c1[_0xa4a6('0x2b')]);if(_0x28a4c1[_0xa4a6('0x2c')]){delete _0x28a4c1[_0xa4a6('0x2c')];}_0x35d10c[_0xa4a6('0x19')](_0x41bcbd)['send'](_0x28a4c1);};}exports['index']=function(_0x47307f,_0x5c7fe7){var _0x445137={},_0x8909a9={},_0x1c50b2={'count':0x0,'rows':[]};var _0x3c3fff=_[_0xa4a6('0x2d')](db[_0xa4a6('0x2e')][_0xa4a6('0x2f')],function(_0x5355b3){return{'name':_0x5355b3['fieldName'],'type':_0x5355b3['type'][_0xa4a6('0x30')]};});_0x8909a9[_0xa4a6('0x31')]=_['map'](_0x3c3fff,'name');_0x8909a9[_0xa4a6('0x32')]=_['keys'](_0x47307f[_0xa4a6('0x32')]);_0x8909a9[_0xa4a6('0x33')]=_['intersection'](_0x8909a9[_0xa4a6('0x31')],_0x8909a9[_0xa4a6('0x32')]);_0x445137[_0xa4a6('0x34')]=_[_0xa4a6('0x35')](_0x8909a9[_0xa4a6('0x31')],qs[_0xa4a6('0x36')](_0x47307f[_0xa4a6('0x32')][_0xa4a6('0x36')]));_0x445137[_0xa4a6('0x34')]=_0x445137[_0xa4a6('0x34')][_0xa4a6('0x37')]?_0x445137['attributes']:_0x8909a9['model'];if(!_0x47307f['query'][_0xa4a6('0x38')]('nolimit')){_0x445137[_0xa4a6('0x1c')]=qs[_0xa4a6('0x1c')](_0x47307f[_0xa4a6('0x32')][_0xa4a6('0x1c')]);_0x445137[_0xa4a6('0x1e')]=qs[_0xa4a6('0x1e')](_0x47307f['query'][_0xa4a6('0x1e')]);}_0x445137[_0xa4a6('0x39')]=qs[_0xa4a6('0x3a')](_0x47307f[_0xa4a6('0x32')]['sort']);_0x445137[_0xa4a6('0x3b')]=qs[_0xa4a6('0x33')](_[_0xa4a6('0x3c')](_0x47307f[_0xa4a6('0x32')],_0x8909a9[_0xa4a6('0x33')]),_0x3c3fff);if(_0x47307f[_0xa4a6('0x32')][_0xa4a6('0x3d')]){_0x445137[_0xa4a6('0x3b')]=_[_0xa4a6('0x3e')](_0x445137[_0xa4a6('0x3b')],{'$or':_['map'](_0x3c3fff,function(_0x24be8a){if(_0x24be8a['type']!==_0xa4a6('0x3f')){var _0x33bfc4={};_0x33bfc4[_0x24be8a['name']]={'$like':'%'+_0x47307f[_0xa4a6('0x32')][_0xa4a6('0x3d')]+'%'};return _0x33bfc4;}})});}_0x445137=_[_0xa4a6('0x3e')]({},_0x445137,_0x47307f[_0xa4a6('0x40')]);var _0x16397f={'where':_0x445137[_0xa4a6('0x3b')]};return db[_0xa4a6('0x2e')]['count'](_0x16397f)[_0xa4a6('0x25')](function(_0x307a6c){_0x1c50b2[_0xa4a6('0x1d')]=_0x307a6c;if(_0x47307f['query'][_0xa4a6('0x41')]){_0x445137['include']=[{'all':!![]}];}return db[_0xa4a6('0x2e')][_0xa4a6('0x42')](_0x445137);})[_0xa4a6('0x25')](function(_0x1b17a4){_0x1c50b2[_0xa4a6('0x43')]=_0x1b17a4;return _0x1c50b2;})['then'](respondWithFilteredResult(_0x5c7fe7,_0x445137))['catch'](handleError(_0x5c7fe7,null));};exports[_0xa4a6('0x44')]=function(_0x57ce7c,_0x13b57b){var _0x2d7edf={'raw':![],'where':{'id':_0x57ce7c[_0xa4a6('0x45')]['id']}},_0x267767={};_0x267767[_0xa4a6('0x31')]=_[_0xa4a6('0x46')](db[_0xa4a6('0x2e')][_0xa4a6('0x2f')]);_0x267767['query']=_[_0xa4a6('0x46')](_0x57ce7c['query']);_0x267767[_0xa4a6('0x33')]=_[_0xa4a6('0x35')](_0x267767[_0xa4a6('0x31')],_0x267767['query']);_0x2d7edf[_0xa4a6('0x34')]=_[_0xa4a6('0x35')](_0x267767[_0xa4a6('0x31')],qs['fields'](_0x57ce7c[_0xa4a6('0x32')][_0xa4a6('0x36')]));_0x2d7edf[_0xa4a6('0x34')]=_0x2d7edf[_0xa4a6('0x34')][_0xa4a6('0x37')]?_0x2d7edf[_0xa4a6('0x34')]:_0x267767[_0xa4a6('0x31')];if(_0x57ce7c[_0xa4a6('0x32')][_0xa4a6('0x41')]){_0x2d7edf[_0xa4a6('0x47')]=[{'all':!![]}];}_0x2d7edf=_[_0xa4a6('0x3e')]({},_0x2d7edf,_0x57ce7c['options']);return db[_0xa4a6('0x2e')][_0xa4a6('0x48')](_0x2d7edf)['then'](handleEntityNotFound(_0x13b57b,null))[_0xa4a6('0x25')](respondWithResult(_0x13b57b,null))[_0xa4a6('0x49')](handleError(_0x13b57b,null));};exports[_0xa4a6('0x4a')]=function(_0x4f69ac,_0x71f655){return db[_0xa4a6('0x2e')][_0xa4a6('0x4a')](_0x4f69ac[_0xa4a6('0x4b')],{})[_0xa4a6('0x25')](function(_0x3bb3f5){var _0xc39e78=_0x4f69ac[_0xa4a6('0x4c')][_0xa4a6('0x27')]({'plain':!![]});if(!_0xc39e78)throw new Error(_0xa4a6('0x4d'));if(_0xc39e78[_0xa4a6('0x4e')]==='user'){var _0x1aef08=_0x3bb3f5[_0xa4a6('0x27')]({'plain':!![]});var _0x52258e=_0xa4a6('0x28');return db[_0xa4a6('0x4f')][_0xa4a6('0x48')]({'where':{'name':_0x52258e,'userProfileId':_0xc39e78[_0xa4a6('0x50')]},'raw':!![]})[_0xa4a6('0x25')](function(_0xb7c309){if(_0xb7c309&&_0xb7c309['autoAssociation']===0x0){return db['UserProfileResource'][_0xa4a6('0x4a')]({'name':_0x1aef08['name'],'resourceId':_0x1aef08['id'],'type':_0xb7c309['name'],'sectionId':_0xb7c309['id']},{})[_0xa4a6('0x25')](function(){return _0x3bb3f5;});}else{return _0x3bb3f5;}})[_0xa4a6('0x49')](function(_0x542ec9){logger[_0xa4a6('0x2a')](_0xa4a6('0x51'),_0x542ec9);throw _0x542ec9;});}return _0x3bb3f5;})['then'](respondWithResult(_0x71f655,0xc9))['catch'](handleError(_0x71f655,null));};exports[_0xa4a6('0x24')]=function(_0x1754ff,_0x5a8787){if(_0x1754ff[_0xa4a6('0x4b')]['id']){delete _0x1754ff[_0xa4a6('0x4b')]['id'];}return db['Schedule'][_0xa4a6('0x48')]({'where':{'id':_0x1754ff[_0xa4a6('0x45')]['id']}})[_0xa4a6('0x25')](handleEntityNotFound(_0x5a8787,null))[_0xa4a6('0x25')](saveUpdates(_0x1754ff[_0xa4a6('0x4b')],null))[_0xa4a6('0x25')](respondWithResult(_0x5a8787,null))[_0xa4a6('0x49')](handleError(_0x5a8787,null));};exports[_0xa4a6('0x26')]=function(_0x4a44d0,_0x14c498){return db[_0xa4a6('0x2e')][_0xa4a6('0x48')]({'where':{'id':_0x4a44d0['params']['id']}})[_0xa4a6('0x25')](handleEntityNotFound(_0x14c498,null))['then'](removeEntity(_0x14c498,null))[_0xa4a6('0x49')](handleError(_0x14c498,null));};exports[_0xa4a6('0x52')]=function(_0x12f734,_0x174f4a,_0xdafbf7){var _0x6a9c4b=require('../../config/schedule');return db[_0xa4a6('0x2e')][_0xa4a6('0x48')]({'where':{'id':_0x12f734[_0xa4a6('0x45')]['id']},'raw':!![]})[_0xa4a6('0x25')](handleEntityNotFound(_0x174f4a,null))[_0xa4a6('0x25')](function(){_0x6a9c4b[_0xa4a6('0x52')](_0x12f734['params']['id']);})[_0xa4a6('0x25')](respondWithStatusCode(_0x174f4a,null))['catch'](handleError(_0x174f4a,null));}; \ No newline at end of file +var _0x1e3c=['rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','length','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule'];(function(_0x164c54,_0x3e2040){var _0x4184ce=function(_0x237a2d){while(--_0x237a2d){_0x164c54['push'](_0x164c54['shift']());}};_0x4184ce(++_0x3e2040);}(_0x1e3c,0x123));var _0xc1e3=function(_0x36ea6d,_0x4941da){_0x36ea6d=_0x36ea6d-0x0;var _0x544ff7=_0x1e3c[_0x36ea6d];return _0x544ff7;};'use strict';var emlformat=require(_0xc1e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1e3('0x1'));var jsonpatch=require(_0xc1e3('0x2'));var rp=require(_0xc1e3('0x3'));var moment=require(_0xc1e3('0x4'));var BPromise=require(_0xc1e3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc1e3('0x6'));var sox=require(_0xc1e3('0x7'));var csv=require(_0xc1e3('0x8'));var ejs=require(_0xc1e3('0x9'));var fs=require('fs');var fs_extra=require(_0xc1e3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc1e3('0xb'));var jsforce=require(_0xc1e3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1e3('0x8'));var querystring=require(_0xc1e3('0xd'));var Papa=require(_0xc1e3('0xe'));var Redis=require(_0xc1e3('0xf'));var authService=require(_0xc1e3('0x10'));var qs=require(_0xc1e3('0x11'));var as=require(_0xc1e3('0x12'));var hardwareService=require(_0xc1e3('0x13'));var logger=require(_0xc1e3('0x14'))(_0xc1e3('0x15'));var utils=require(_0xc1e3('0x16'));var config=require(_0xc1e3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1e3('0x18'))['db'];function respondWithStatusCode(_0x1e5220,_0x457fc8){_0x457fc8=_0x457fc8||0xcc;return function(_0x395b00){if(_0x395b00){return _0x1e5220[_0xc1e3('0x19')](_0x457fc8);}return _0x1e5220[_0xc1e3('0x1a')](_0x457fc8)[_0xc1e3('0x1b')]();};}function respondWithResult(_0x22fb64,_0x1b5bf8){_0x1b5bf8=_0x1b5bf8||0xc8;return function(_0x7d0ff1){if(_0x7d0ff1){return _0x22fb64[_0xc1e3('0x1a')](_0x1b5bf8)[_0xc1e3('0x1c')](_0x7d0ff1);}};}function respondWithFilteredResult(_0x16a1fd,_0x2166b0){return function(_0x1cf6a2){if(_0x1cf6a2){var _0x3f19a8=typeof _0x2166b0[_0xc1e3('0x1d')]===_0xc1e3('0x1e')&&typeof _0x2166b0[_0xc1e3('0x1f')]===_0xc1e3('0x1e');var _0x2a0da4=_0x1cf6a2[_0xc1e3('0x20')];var _0x3a8257=_0x3f19a8?0x0:_0x2166b0[_0xc1e3('0x1d')];var _0x3e24d9=_0x3f19a8?_0x1cf6a2['count']:_0x2166b0[_0xc1e3('0x1d')]+_0x2166b0[_0xc1e3('0x1f')];var _0x33e0be;if(_0x3e24d9>=_0x2a0da4){_0x3e24d9=_0x2a0da4;_0x33e0be=0xc8;}else{_0x33e0be=0xce;}_0x16a1fd[_0xc1e3('0x1a')](_0x33e0be);return _0x16a1fd[_0xc1e3('0x21')]('Content-Range',_0x3a8257+'-'+_0x3e24d9+'/'+_0x2a0da4)['json'](_0x1cf6a2);}return null;};}function patchUpdates(_0x1b4715){return function(_0x3cb884){try{jsonpatch[_0xc1e3('0x22')](_0x3cb884,_0x1b4715,!![]);}catch(_0x2a0abd){return BPromise[_0xc1e3('0x23')](_0x2a0abd);}return _0x3cb884['save']();};}function saveUpdates(_0x389e91,_0x215a54){return function(_0x854efc){if(_0x854efc){return _0x854efc[_0xc1e3('0x24')](_0x389e91)[_0xc1e3('0x25')](function(_0x2ee110){return _0x2ee110;});}return null;};}function removeEntity(_0x418629,_0x40e8ad){return function(_0x31755f){if(_0x31755f){return _0x31755f[_0xc1e3('0x26')]()[_0xc1e3('0x25')](function(){var _0x147d4a=_0x31755f[_0xc1e3('0x27')]({'plain':!![]});var _0x46c257=_0xc1e3('0x28');return db[_0xc1e3('0x29')][_0xc1e3('0x26')]({'where':{'type':_0x46c257,'resourceId':_0x147d4a['id']}})[_0xc1e3('0x25')](function(){return _0x31755f;});})[_0xc1e3('0x25')](function(){_0x418629[_0xc1e3('0x1a')](0xcc)[_0xc1e3('0x1b')]();});}};}function handleEntityNotFound(_0x452c1,_0xac9f53){return function(_0x1aad26){if(!_0x1aad26){_0x452c1[_0xc1e3('0x19')](0x194);}return _0x1aad26;};}function handleError(_0x5dcc12,_0x3546eb){_0x3546eb=_0x3546eb||0x1f4;return function(_0x533c38){logger[_0xc1e3('0x2a')](_0x533c38[_0xc1e3('0x2b')]);if(_0x533c38[_0xc1e3('0x2c')]){delete _0x533c38[_0xc1e3('0x2c')];}_0x5dcc12['status'](_0x3546eb)[_0xc1e3('0x2d')](_0x533c38);};}exports[_0xc1e3('0x2e')]=function(_0x348a2a,_0x37fbcd){var _0x3037bc={},_0x380579={},_0x29e9df={'count':0x0,'rows':[]};var _0x22d84f=_[_0xc1e3('0x2f')](db[_0xc1e3('0x30')][_0xc1e3('0x31')],function(_0x583881){return{'name':_0x583881[_0xc1e3('0x32')],'type':_0x583881[_0xc1e3('0x33')][_0xc1e3('0x34')]};});_0x380579['model']=_[_0xc1e3('0x2f')](_0x22d84f,'name');_0x380579['query']=_[_0xc1e3('0x35')](_0x348a2a[_0xc1e3('0x36')]);_0x380579['filters']=_[_0xc1e3('0x37')](_0x380579['model'],_0x380579[_0xc1e3('0x36')]);_0x3037bc[_0xc1e3('0x38')]=_[_0xc1e3('0x37')](_0x380579[_0xc1e3('0x39')],qs[_0xc1e3('0x3a')](_0x348a2a[_0xc1e3('0x36')]['fields']));_0x3037bc[_0xc1e3('0x38')]=_0x3037bc[_0xc1e3('0x38')]['length']?_0x3037bc[_0xc1e3('0x38')]:_0x380579[_0xc1e3('0x39')];if(!_0x348a2a[_0xc1e3('0x36')][_0xc1e3('0x3b')](_0xc1e3('0x3c'))){_0x3037bc[_0xc1e3('0x1f')]=qs[_0xc1e3('0x1f')](_0x348a2a[_0xc1e3('0x36')][_0xc1e3('0x1f')]);_0x3037bc[_0xc1e3('0x1d')]=qs[_0xc1e3('0x1d')](_0x348a2a['query'][_0xc1e3('0x1d')]);}_0x3037bc['order']=qs[_0xc1e3('0x3d')](_0x348a2a[_0xc1e3('0x36')]['sort']);_0x3037bc[_0xc1e3('0x3e')]=qs[_0xc1e3('0x3f')](_['pick'](_0x348a2a[_0xc1e3('0x36')],_0x380579[_0xc1e3('0x3f')]),_0x22d84f);if(_0x348a2a[_0xc1e3('0x36')][_0xc1e3('0x40')]){_0x3037bc[_0xc1e3('0x3e')]=_[_0xc1e3('0x41')](_0x3037bc['where'],{'$or':_['map'](_0x22d84f,function(_0x2774b3){if(_0x2774b3[_0xc1e3('0x33')]!==_0xc1e3('0x42')){var _0x2f9343={};_0x2f9343[_0x2774b3['name']]={'$like':'%'+_0x348a2a[_0xc1e3('0x36')]['filter']+'%'};return _0x2f9343;}})});}_0x3037bc=_[_0xc1e3('0x41')]({},_0x3037bc,_0x348a2a['options']);var _0x2ed893={'where':_0x3037bc['where']};return db[_0xc1e3('0x30')][_0xc1e3('0x20')](_0x2ed893)[_0xc1e3('0x25')](function(_0x48fe52){_0x29e9df[_0xc1e3('0x20')]=_0x48fe52;if(_0x348a2a[_0xc1e3('0x36')][_0xc1e3('0x43')]){_0x3037bc[_0xc1e3('0x44')]=[{'all':!![]}];}return db[_0xc1e3('0x30')]['findAll'](_0x3037bc);})[_0xc1e3('0x25')](function(_0x39a41f){_0x29e9df[_0xc1e3('0x45')]=_0x39a41f;return _0x29e9df;})['then'](respondWithFilteredResult(_0x37fbcd,_0x3037bc))[_0xc1e3('0x46')](handleError(_0x37fbcd,null));};exports[_0xc1e3('0x47')]=function(_0x5f2319,_0x46540b){var _0x57daae={'raw':![],'where':{'id':_0x5f2319['params']['id']}},_0x22aa0a={};_0x22aa0a[_0xc1e3('0x39')]=_[_0xc1e3('0x35')](db['Schedule'][_0xc1e3('0x31')]);_0x22aa0a[_0xc1e3('0x36')]=_['keys'](_0x5f2319[_0xc1e3('0x36')]);_0x22aa0a['filters']=_[_0xc1e3('0x37')](_0x22aa0a[_0xc1e3('0x39')],_0x22aa0a[_0xc1e3('0x36')]);_0x57daae['attributes']=_[_0xc1e3('0x37')](_0x22aa0a[_0xc1e3('0x39')],qs[_0xc1e3('0x3a')](_0x5f2319[_0xc1e3('0x36')][_0xc1e3('0x3a')]));_0x57daae[_0xc1e3('0x38')]=_0x57daae[_0xc1e3('0x38')][_0xc1e3('0x48')]?_0x57daae[_0xc1e3('0x38')]:_0x22aa0a[_0xc1e3('0x39')];if(_0x5f2319[_0xc1e3('0x36')][_0xc1e3('0x43')]){_0x57daae['include']=[{'all':!![]}];}_0x57daae=_['merge']({},_0x57daae,_0x5f2319[_0xc1e3('0x49')]);return db['Schedule'][_0xc1e3('0x4a')](_0x57daae)[_0xc1e3('0x25')](handleEntityNotFound(_0x46540b,null))[_0xc1e3('0x25')](respondWithResult(_0x46540b,null))['catch'](handleError(_0x46540b,null));};exports[_0xc1e3('0x4b')]=function(_0x500c4a,_0x16ff1d){return db[_0xc1e3('0x30')][_0xc1e3('0x4b')](_0x500c4a[_0xc1e3('0x4c')],{})[_0xc1e3('0x25')](function(_0x3d1c73){var _0x1ae201=_0x500c4a[_0xc1e3('0x4d')]['get']({'plain':!![]});if(!_0x1ae201)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ae201[_0xc1e3('0x4e')]==='user'){var _0x3a91b1=_0x3d1c73[_0xc1e3('0x27')]({'plain':!![]});var _0x22eea3=_0xc1e3('0x28');return db[_0xc1e3('0x4f')][_0xc1e3('0x4a')]({'where':{'name':_0x22eea3,'userProfileId':_0x1ae201[_0xc1e3('0x50')]},'raw':!![]})[_0xc1e3('0x25')](function(_0x1f9556){if(_0x1f9556&&_0x1f9556[_0xc1e3('0x51')]===0x0){return db[_0xc1e3('0x29')]['create']({'name':_0x3a91b1[_0xc1e3('0x2c')],'resourceId':_0x3a91b1['id'],'type':_0x1f9556[_0xc1e3('0x2c')],'sectionId':_0x1f9556['id']},{})['then'](function(){return _0x3d1c73;});}else{return _0x3d1c73;}})[_0xc1e3('0x46')](function(_0x5f54a5){logger[_0xc1e3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f54a5);throw _0x5f54a5;});}return _0x3d1c73;})['then'](respondWithResult(_0x16ff1d,0xc9))[_0xc1e3('0x46')](handleError(_0x16ff1d,null));};exports[_0xc1e3('0x24')]=function(_0x4424f6,_0x154f0a){if(_0x4424f6[_0xc1e3('0x4c')]['id']){delete _0x4424f6[_0xc1e3('0x4c')]['id'];}return db[_0xc1e3('0x30')][_0xc1e3('0x4a')]({'where':{'id':_0x4424f6['params']['id']}})[_0xc1e3('0x25')](handleEntityNotFound(_0x154f0a,null))[_0xc1e3('0x25')](saveUpdates(_0x4424f6[_0xc1e3('0x4c')],null))[_0xc1e3('0x25')](respondWithResult(_0x154f0a,null))[_0xc1e3('0x46')](handleError(_0x154f0a,null));};exports[_0xc1e3('0x26')]=function(_0x367e8c,_0x2ace86){return db['Schedule']['find']({'where':{'id':_0x367e8c[_0xc1e3('0x52')]['id']}})[_0xc1e3('0x25')](handleEntityNotFound(_0x2ace86,null))['then'](removeEntity(_0x2ace86,null))['catch'](handleError(_0x2ace86,null));};exports[_0xc1e3('0x53')]=function(_0x2bf217,_0xb21f5b,_0x4658b1){var _0x5da6d4=require(_0xc1e3('0x54'));return db[_0xc1e3('0x30')][_0xc1e3('0x4a')]({'where':{'id':_0x2bf217[_0xc1e3('0x52')]['id']},'raw':!![]})[_0xc1e3('0x25')](handleEntityNotFound(_0xb21f5b,null))[_0xc1e3('0x25')](function(){_0x5da6d4['run'](_0x2bf217[_0xc1e3('0x52')]['id']);})[_0xc1e3('0x25')](respondWithStatusCode(_0xb21f5b,null))['catch'](handleError(_0xb21f5b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1fa2524..ba169d3 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 _0x9b00=['Schedule','tools_schedules','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define'];(function(_0x43d6fd,_0x298527){var _0x2a4329=function(_0x2c9318){while(--_0x2c9318){_0x43d6fd['push'](_0x43d6fd['shift']());}};_0x2a4329(++_0x298527);}(_0x9b00,0x1e3));var _0x09b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9b00[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x09b0('0x0'));var util=require(_0x09b0('0x1'));var logger=require('../../config/logger')(_0x09b0('0x2'));var moment=require(_0x09b0('0x3'));var BPromise=require(_0x09b0('0x4'));var rp=require(_0x09b0('0x5'));var fs=require('fs');var path=require(_0x09b0('0x6'));var rimraf=require(_0x09b0('0x7'));var config=require(_0x09b0('0x8'));var attributes=require(_0x09b0('0x9'));module['exports']=function(_0x5ba5cc,_0x4b625c){return _0x5ba5cc[_0x09b0('0xa')](_0x09b0('0xb'),attributes,{'tableName':_0x09b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ac7=['path','rimraf','./schedule.attributes','exports','define','Schedule','lodash','api','moment','bluebird'];(function(_0x18de4f,_0x3095a6){var _0xdb4fd1=function(_0x49c63e){while(--_0x49c63e){_0x18de4f['push'](_0x18de4f['shift']());}};_0xdb4fd1(++_0x3095a6);}(_0x3ac7,0x15a));var _0x73ac=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3ac7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x73ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x73ac('0x1'));var moment=require(_0x73ac('0x2'));var BPromise=require(_0x73ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ac('0x4'));var rimraf=require(_0x73ac('0x5'));var config=require('../../config/environment');var attributes=require(_0x73ac('0x6'));module[_0x73ac('0x7')]=function(_0x55d0d9,_0x4820af){return _0x55d0d9[_0x73ac('0x8')](_0x73ac('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 9ac03d3..6924425 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 _0x9f8f=['then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2fa2ad,_0x521109){var _0x16317e=function(_0x431213){while(--_0x431213){_0x2fa2ad['push'](_0x2fa2ad['shift']());}};_0x16317e(++_0x521109);}(_0x9f8f,0x1d7));var _0xf9f8=function(_0x555e32,_0x3f694f){_0x555e32=_0x555e32-0x0;var _0x464bd5=_0x9f8f[_0x555e32];return _0x464bd5;};'use strict';var _=require(_0xf9f8('0x0'));var util=require(_0xf9f8('0x1'));var moment=require(_0xf9f8('0x2'));var BPromise=require(_0xf9f8('0x3'));var rs=require(_0xf9f8('0x4'));var fs=require('fs');var Redis=require(_0xf9f8('0x5'));var db=require(_0xf9f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf9f8('0x7'));var config=require(_0xf9f8('0x8'));var jayson=require(_0xf9f8('0x9'));var client=jayson[_0xf9f8('0xa')][_0xf9f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a89e,_0x352e32,_0x158763){return new BPromise(function(_0x7fb682,_0x5e113a){return client[_0xf9f8('0xc')](_0x22a89e,_0x158763)[_0xf9f8('0xd')](function(_0x10b63a){logger[_0xf9f8('0xe')](_0xf9f8('0xf'),_0x352e32,'request\x20sent');logger['debug'](_0xf9f8('0x10'),_0x352e32,_0xf9f8('0x11'),JSON['stringify'](_0x10b63a));if(_0x10b63a['error']){if(_0x10b63a[_0xf9f8('0x12')]['code']===0x1f4){logger[_0xf9f8('0x12')](_0xf9f8('0xf'),_0x352e32,_0x10b63a[_0xf9f8('0x12')][_0xf9f8('0x13')]);return _0x5e113a(_0x10b63a[_0xf9f8('0x12')][_0xf9f8('0x13')]);}logger[_0xf9f8('0x12')](_0xf9f8('0xf'),_0x352e32,_0x10b63a[_0xf9f8('0x12')][_0xf9f8('0x13')]);return _0x7fb682(_0x10b63a['error'][_0xf9f8('0x13')]);}else{logger[_0xf9f8('0xe')](_0xf9f8('0xf'),_0x352e32,_0xf9f8('0x11'));_0x7fb682(_0x10b63a[_0xf9f8('0x14')]['message']);}})[_0xf9f8('0x15')](function(_0x10fda7){logger[_0xf9f8('0x12')]('Schedule,\x20%s,\x20%s',_0x352e32,_0x10fda7);_0x5e113a(_0x10fda7);});});} \ No newline at end of file +var _0x49dd=['../../config/logger','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','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x49dd,0xdb));var _0xd49d=function(_0x496f4e,_0x3f8c02){_0x496f4e=_0x496f4e-0x0;var _0x2c3574=_0x49dd[_0x496f4e];return _0x2c3574;};'use strict';var _=require(_0xd49d('0x0'));var util=require(_0xd49d('0x1'));var moment=require('moment');var BPromise=require(_0xd49d('0x2'));var rs=require(_0xd49d('0x3'));var fs=require('fs');var Redis=require(_0xd49d('0x4'));var db=require(_0xd49d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd49d('0x6'))(_0xd49d('0x7'));var config=require(_0xd49d('0x8'));var jayson=require(_0xd49d('0x9'));var client=jayson[_0xd49d('0xa')][_0xd49d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a3379,_0x121b19,_0x4f4ed8){return new BPromise(function(_0x32de15,_0x3e93ed){return client[_0xd49d('0xc')](_0x1a3379,_0x4f4ed8)[_0xd49d('0xd')](function(_0x11f53f){logger[_0xd49d('0xe')](_0xd49d('0xf'),_0x121b19,'request\x20sent');logger[_0xd49d('0x10')](_0xd49d('0x11'),_0x121b19,_0xd49d('0x12'),JSON[_0xd49d('0x13')](_0x11f53f));if(_0x11f53f['error']){if(_0x11f53f[_0xd49d('0x14')][_0xd49d('0x15')]===0x1f4){logger[_0xd49d('0x14')](_0xd49d('0xf'),_0x121b19,_0x11f53f[_0xd49d('0x14')][_0xd49d('0x16')]);return _0x3e93ed(_0x11f53f[_0xd49d('0x14')][_0xd49d('0x16')]);}logger['error'](_0xd49d('0xf'),_0x121b19,_0x11f53f[_0xd49d('0x14')]['message']);return _0x32de15(_0x11f53f[_0xd49d('0x14')][_0xd49d('0x16')]);}else{logger[_0xd49d('0xe')](_0xd49d('0xf'),_0x121b19,'request\x20sent');_0x32de15(_0x11f53f[_0xd49d('0x17')]['message']);}})[_0xd49d('0x18')](function(_0x10ca93){logger[_0xd49d('0x14')](_0xd49d('0xf'),_0x121b19,_0x10ca93);_0x3e93ed(_0x10ca93);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c1bc523..dd8988c 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 _0xc922=['get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0xeb729a,_0x5d09df){var _0x2b71e9=function(_0x3580b4){while(--_0x3580b4){_0xeb729a['push'](_0xeb729a['shift']());}};_0x2b71e9(++_0x5d09df);}(_0xc922,0x1b0));var _0x2c92=function(_0x4ce277,_0x19f0dc){_0x4ce277=_0x4ce277-0x0;var _0x3152bb=_0xc922[_0x4ce277];return _0x3152bb;};'use strict';var multer=require('multer');var util=require(_0x2c92('0x0'));var path=require('path');var timeout=require(_0x2c92('0x1'));var express=require(_0x2c92('0x2'));var router=express['Router']();var fs_extra=require(_0x2c92('0x3'));var auth=require(_0x2c92('0x4'));var interaction=require(_0x2c92('0x5'));var config=require(_0x2c92('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2c92('0x7')]);router[_0x2c92('0x8')](_0x2c92('0x9'),auth[_0x2c92('0xa')](),controller[_0x2c92('0xb')]);router[_0x2c92('0x8')](_0x2c92('0xc'),auth['isAuthenticated'](),controller[_0x2c92('0xd')]);router['get'](_0x2c92('0xe'),auth[_0x2c92('0xa')](),controller[_0x2c92('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2c92('0x10')](_0x2c92('0xc'),auth['isAuthenticated'](),controller[_0x2c92('0x11')]);router[_0x2c92('0x12')](_0x2c92('0xc'),auth[_0x2c92('0xa')](),controller[_0x2c92('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3530=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id/download','download','post','create','put','delete','/:id','destroy','util','path','Router','fs-extra'];(function(_0x4e6359,_0x32321a){var _0x452318=function(_0x2d9a9f){while(--_0x2d9a9f){_0x4e6359['push'](_0x4e6359['shift']());}};_0x452318(++_0x32321a);}(_0x3530,0x176));var _0x0353=function(_0x138c66,_0x12206c){_0x138c66=_0x138c66-0x0;var _0x7d5be4=_0x3530[_0x138c66];return _0x7d5be4;};'use strict';var multer=require('multer');var util=require(_0x0353('0x0'));var path=require(_0x0353('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0353('0x2')]();var fs_extra=require(_0x0353('0x3'));var auth=require(_0x0353('0x4'));var interaction=require(_0x0353('0x5'));var config=require(_0x0353('0x6'));var controller=require(_0x0353('0x7'));router[_0x0353('0x8')]('/',auth[_0x0353('0x9')](),controller[_0x0353('0xa')]);router[_0x0353('0x8')](_0x0353('0xb'),auth[_0x0353('0x9')](),controller[_0x0353('0xc')]);router['get']('/:id',auth[_0x0353('0x9')](),controller['show']);router[_0x0353('0x8')](_0x0353('0xd'),auth['isAuthenticated'](),controller[_0x0353('0xe')]);router[_0x0353('0xf')]('/',auth[_0x0353('0x9')](),controller[_0x0353('0x10')]);router[_0x0353('0x11')]('/:id',auth[_0x0353('0x9')](),controller['update']);router[_0x0353('0x12')](_0x0353('0x13'),auth[_0x0353('0x9')](),controller[_0x0353('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d69dc8c..ff88b94 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 _0xfbbb=['VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x48b6ca,_0xab08e){var _0x2fca3c=function(_0x1b9248){while(--_0x1b9248){_0x48b6ca['push'](_0x48b6ca['shift']());}};_0x2fca3c(++_0xab08e);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x552b0c,_0x34d91f){_0x552b0c=_0x552b0c-0x0;var _0x5ca7d6=_0xfbbb[_0x552b0c];return _0x5ca7d6;};'use strict';var Sequelize=require(_0xbfbb('0x0'));var moment=require(_0xbfbb('0x1'));var path=require(_0xbfbb('0x2'));var config=require(_0xbfbb('0x3'));module[_0xbfbb('0x4')]={'format':{'type':Sequelize[_0xbfbb('0x5')],'get':function(){return this[_0xbfbb('0x6')](_0xbfbb('0x7'))?path[_0xbfbb('0x8')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xbfbb('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xbfbb('0x9')],'set':function(_0x16c6cc){var _0x16a41c=_0x16c6cc['replace'](/\\/g,'/');this[_0xbfbb('0xa')](_0xbfbb('0x7'),_0x16a41c);}},'rating':{'type':Sequelize[_0xbfbb('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xbfbb('0xb')],'set':function(_0x1baefa){this[_0xbfbb('0xa')]('startedAt',moment()[_0xbfbb('0xc')](_0x1baefa,'ms'));this[_0xbfbb('0xa')](_0xbfbb('0xd'),moment());this[_0xbfbb('0xa')]('duration',_0x1baefa);}},'startedAt':{'type':Sequelize[_0xbfbb('0xe')],'get':function(){return moment(this[_0xbfbb('0x6')](_0xbfbb('0xf')))[_0xbfbb('0x10')](_0xbfbb('0x11'))[_0xbfbb('0x12')]();}},'closedAt':{'type':Sequelize[_0xbfbb('0xe')],'get':function(){return moment(this[_0xbfbb('0x6')]('closedAt'))[_0xbfbb('0x10')](_0xbfbb('0x11'))[_0xbfbb('0x12')]();}},'createdAt':{'type':Sequelize[_0xbfbb('0xe')],'get':function(){return moment(this[_0xbfbb('0x6')]('createdAt'))[_0xbfbb('0x10')](_0xbfbb('0x11'))[_0xbfbb('0x12')]();}},'updatedAt':{'type':Sequelize[_0xbfbb('0xe')],'get':function(){return moment(this[_0xbfbb('0x6')](_0xbfbb('0x13')))[_0xbfbb('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x2eba=['path','../../config/environment','exports','value','getDataValue','STRING','replace','INTEGER','startedAt','subtract','setDataValue','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','createdAt','updatedAt','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eba,0xc7));var _0xa2eb=function(_0x3997e3,_0x2a80df){_0x3997e3=_0x3997e3-0x0;var _0xaee5f1=_0x2eba[_0x3997e3];return _0xaee5f1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa2eb('0x0'));var path=require(_0xa2eb('0x1'));var config=require(_0xa2eb('0x2'));module[_0xa2eb('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa2eb('0x4'))?path['extname'](this[_0xa2eb('0x5')](_0xa2eb('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xa2eb('0x6')]},'channel':{'type':Sequelize[_0xa2eb('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x545db3){var _0x56b33a=_0x545db3[_0xa2eb('0x7')](/\\/g,'/');this['setDataValue'](_0xa2eb('0x4'),_0x56b33a);}},'rating':{'type':Sequelize[_0xa2eb('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa2eb('0x8')],'set':function(_0x5480a1){this['setDataValue'](_0xa2eb('0x9'),moment()[_0xa2eb('0xa')](_0x5480a1,'ms'));this[_0xa2eb('0xb')]('closedAt',moment());this[_0xa2eb('0xb')](_0xa2eb('0xc'),_0x5480a1);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa2eb('0x5')]('startedAt'))[_0xa2eb('0xd')](_0xa2eb('0xe'))[_0xa2eb('0xf')]();}},'closedAt':{'type':Sequelize[_0xa2eb('0x10')],'get':function(){return moment(this[_0xa2eb('0x5')](_0xa2eb('0x11')))['format'](_0xa2eb('0xe'))[_0xa2eb('0xf')]();}},'createdAt':{'type':Sequelize[_0xa2eb('0x10')],'get':function(){return moment(this[_0xa2eb('0x5')](_0xa2eb('0x12')))[_0xa2eb('0xd')](_0xa2eb('0xe'))[_0xa2eb('0xf')]();}},'updatedAt':{'type':Sequelize[_0xa2eb('0x10')],'get':function(){return moment(this[_0xa2eb('0x5')](_0xa2eb('0x13')))[_0xa2eb('0xd')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 19f53a9..1f6ad1f 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 _0x3eea=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','Not\x20found','isNil','root','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys'];(function(_0x27ba28,_0x2284ad){var _0x1ca115=function(_0xf765b5){while(--_0xf765b5){_0x27ba28['push'](_0x27ba28['shift']());}};_0x1ca115(++_0x2284ad);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x37dc0d,_0x2f18a4){_0x37dc0d=_0x37dc0d-0x0;var _0x5a2e5b=_0x3eea[_0x37dc0d];return _0x5a2e5b;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x31')](_['map'](_0x3fa094,_0xa3ee('0x27')),['format']);_0x78e581[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x59c6f9['query']);_0x78e581[_0xa3ee('0x34')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x59c6f9[_0xa3ee('0x32')]['fields']));_0x4abf49[_0xa3ee('0x35')]=_0x4abf49[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x4abf49['attributes']:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x39')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x1b')]);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3b')]);_0x4abf49[_0xa3ee('0x3c')]=qs[_0xa3ee('0x34')](_[_0xa3ee('0x3d')](_0x59c6f9['query'],_0x78e581[_0xa3ee('0x34')]),_0x3fa094);if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]){_0x4abf49[_0xa3ee('0x3c')]=_['merge'](_0x4abf49[_0xa3ee('0x3c')],{'$or':_[_0xa3ee('0x2a')](_0x3fa094,function(_0x1a9b63){if(_0x1a9b63['type']!==_0xa3ee('0x3f')){var _0x3554eb={};_0x3554eb[_0x1a9b63['name']]={'$like':'%'+_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]+'%'};return _0x3554eb;}})});}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x40')]);var _0x6dd235={'where':_0x4abf49[_0xa3ee('0x3c')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x6dd235)[_0xa3ee('0x23')](function(_0x2ca04f){_0x481358[_0xa3ee('0x1c')]=_0x2ca04f;if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x41')]){_0x4abf49[_0xa3ee('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4abf49);})['then'](function(_0x45aeec){_0x481358[_0xa3ee('0x43')]=_0x45aeec;return _0x481358;})['then'](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x44')](handleError(_0x5ba571,null));};exports[_0xa3ee('0x45')]=function(_0x279834,_0x55f47f){var _0x1af10b={'raw':![],'where':{'id':_0x279834[_0xa3ee('0x46')]['id']}},_0x559cc1={};_0x559cc1[_0xa3ee('0x30')]=_[_0xa3ee('0x33')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x559cc1[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x279834[_0xa3ee('0x32')]);_0x559cc1[_0xa3ee('0x34')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],_0x559cc1[_0xa3ee('0x32')]);_0x1af10b[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x279834[_0xa3ee('0x32')][_0xa3ee('0x37')]));_0x1af10b['attributes']=_0x1af10b[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x1af10b[_0xa3ee('0x35')]:_0x559cc1[_0xa3ee('0x30')];if(_0x279834['query'][_0xa3ee('0x41')]){_0x1af10b['include']=[{'all':!![]}];}_0x1af10b=_[_0xa3ee('0x47')]({},_0x1af10b,_0x279834[_0xa3ee('0x40')]);return db[_0xa3ee('0x2b')][_0xa3ee('0x48')](_0x1af10b)[_0xa3ee('0x23')](handleEntityNotFound(_0x55f47f,null))[_0xa3ee('0x23')](respondWithResult(_0x55f47f,null))[_0xa3ee('0x44')](handleError(_0x55f47f,null));};exports[_0xa3ee('0x49')]=function(_0x3c3677,_0xd6160e){return db['ScreenRecording'][_0xa3ee('0x49')](_0x3c3677['body'],{})['then'](respondWithResult(_0xd6160e,0xc9))[_0xa3ee('0x44')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x22')]=function(_0x45029f,_0x1ec479){if(_0x45029f[_0xa3ee('0x4a')]['id']){delete _0x45029f[_0xa3ee('0x4a')]['id'];}delete _0x45029f[_0xa3ee('0x4a')]['duration'];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4b')];delete _0x45029f['body'][_0xa3ee('0x4c')];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x45029f[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x1ec479,null))[_0xa3ee('0x23')](saveUpdates(_0x45029f[_0xa3ee('0x4a')],null))[_0xa3ee('0x23')](respondWithResult(_0x1ec479,null))['catch'](handleError(_0x1ec479,null));};exports['describe']=function(_0x15b55e,_0x441b23){return db['ScreenRecording'][_0xa3ee('0x4e')]()[_0xa3ee('0x23')](respondWithResult(_0x441b23,null))[_0xa3ee('0x44')](handleError(_0x441b23,null));};exports['download']=function(_0x505444,_0x2388f7,_0x49057c){var _0x172a73=require(_0xa3ee('0x4f'));var _0x5b8e79=![];var _0x4232e0={};if(_0x505444[_0xa3ee('0x32')][_0xa3ee('0x2e')]&&_0x505444['query'][_0xa3ee('0x2e')]===_0xa3ee('0x50')){_0x4232e0['uniqueid']=_0x505444[_0xa3ee('0x46')]['id'];}else{_0x4232e0['id']=_0x505444[_0xa3ee('0x46')]['id'];}return db[_0xa3ee('0x2b')]['find']({'where':_0x4232e0,'attributes':['id','value'],'raw':!![]})[_0xa3ee('0x23')](handleEntityNotFound(_0x2388f7,null))[_0xa3ee('0x23')](function(_0x4a1a2f){if(_0x4a1a2f){var _0x1f9913=path[_0xa3ee('0x51')](config['root'],'server/files/screen_recordings',_0x4a1a2f[_0xa3ee('0x4d')]);var _0x659491=util[_0xa3ee('0x52')]('%s.cypher',_0x1f9913);if(fs[_0xa3ee('0x53')](_0x659491)){_0x5b8e79=!![];return _0x172a73[_0xa3ee('0x54')](_0x659491,_0x1f9913,config[_0xa3ee('0x55')][_0xa3ee('0x56')])[_0xa3ee('0x23')](function(){return _0x4a1a2f;});}return _0x4a1a2f;}})[_0xa3ee('0x23')](function(_0x497be4){if(_0x497be4){var _0x10f508=path[_0xa3ee('0x51')](config['root'],_0xa3ee('0x57'),_0x497be4[_0xa3ee('0x4d')]);if(!fs[_0xa3ee('0x53')](_0x10f508)){throw new db[(_0xa3ee('0x58'))][(_0xa3ee('0x59'))](_0xa3ee('0x5a'));}if(_0x497be4['filename']){return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,_0x497be4[_0xa3ee('0x5c')]+path[_0xa3ee('0x5d')](_0x10f508),function(){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}else{return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,function(_0x13b81b){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}}})['catch'](function(_0x4df186){if(_0x4df186['message']===_0xa3ee('0x5a')){_0x2388f7[_0xa3ee('0x1d')](0x194)[_0xa3ee('0x28')](_0xa3ee('0x5e'));}else{return handleError(_0x2388f7,null);}});};exports[_0xa3ee('0x24')]=function(_0x18a164,_0x4000ee){return db['ScreenRecording'][_0xa3ee('0x48')]({'where':{'id':_0x18a164[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](function(_0xaff641){if(_[_0xa3ee('0x5f')](_0xaff641)){throw new ReferenceError('Entity\x20not\x20found');}return _0xaff641;})['then'](function(_0x7b1e97){var _0x303b71=path[_0xa3ee('0x51')](config[_0xa3ee('0x60')],_0xa3ee('0x57'),_0x7b1e97[_0xa3ee('0x4d')]);logger[_0xa3ee('0x61')](_0xa3ee('0x62'),_0x303b71);if(!_[_0xa3ee('0x5f')](_0x7b1e97[_0xa3ee('0x4d')])&&fs[_0xa3ee('0x53')](_0x303b71)){logger[_0xa3ee('0x61')](_0xa3ee('0x63')+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}_0x303b71=_0x303b71+'.cypher';if(!_[_0xa3ee('0x5f')](_0x7b1e97['value'])&&fs['existsSync'](_0x303b71)){logger[_0xa3ee('0x61')]('File:\x20\x22'+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}return _0x7b1e97;})[_0xa3ee('0x23')](function(_0x221deb){if(!_0x221deb)throw new InternalError();return _0x221deb['destroy']();})[_0xa3ee('0x23')](function(){_0x4000ee[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();})[_0xa3ee('0x44')](handleError(_0x4000ee,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x122d0b,_0x26442e){var _0x4f0d4c=function(_0x2624cc){while(--_0x2624cc){_0x122d0b['push'](_0x122d0b['shift']());}};_0x4f0d4c(++_0x26442e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x26ad35,_0x5ebc9a){_0x26ad35=_0x26ad35-0x0;var _0x196961=_0xe5b3[_0x26ad35];return _0x196961;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 45c4a27..6bebcab 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 _0xb10a=['rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1c1716,_0x2680b2){var _0x375895=function(_0x53194a){while(--_0x53194a){_0x1c1716['push'](_0x1c1716['shift']());}};_0x375895(++_0x2680b2);}(_0xb10a,0x7c));var _0xab10=function(_0x5aee67,_0x4ba3c3){_0x5aee67=_0x5aee67-0x0;var _0x26972d=_0xb10a[_0x5aee67];return _0x26972d;};'use strict';var _=require(_0xab10('0x0'));var util=require(_0xab10('0x1'));var logger=require(_0xab10('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab10('0x3'));var rp=require(_0xab10('0x4'));var fs=require('fs');var path=require(_0xab10('0x5'));var rimraf=require(_0xab10('0x6'));var config=require(_0xab10('0x7'));var attributes=require('./screenRecording.attributes');module[_0xab10('0x8')]=function(_0x52b808,_0x268734){return _0x52b808[_0xab10('0x9')](_0xab10('0xa'),attributes,{'tableName':_0xab10('0xb'),'paranoid':![],'indexes':[{'name':_0xab10('0xc'),'fields':[_0xab10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa912=['screen_recordings','interactionid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa912,0x116));var _0x2a91=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa912[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2a91('0x0'));var util=require(_0x2a91('0x1'));var logger=require('../../config/logger')(_0x2a91('0x2'));var moment=require(_0x2a91('0x3'));var BPromise=require(_0x2a91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a91('0x5'));var rimraf=require(_0x2a91('0x6'));var config=require(_0x2a91('0x7'));var attributes=require('./screenRecording.attributes');module[_0x2a91('0x8')]=function(_0x25cd4e,_0x22291a){return _0x25cd4e[_0x2a91('0x9')]('ScreenRecording',attributes,{'tableName':_0x2a91('0xa'),'paranoid':![],'indexes':[{'name':_0x2a91('0xb'),'fields':[_0x2a91('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 287c59f..edb69d8 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 _0xe7e7=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf8371a,_0x46a425){var _0x4a7375=function(_0x76f6d9){while(--_0x76f6d9){_0xf8371a['push'](_0xf8371a['shift']());}};_0x4a7375(++_0x46a425);}(_0xe7e7,0x160));var _0x7e7e=function(_0x978e4f,_0x1b4d8a){_0x978e4f=_0x978e4f-0x0;var _0x29678b=_0xe7e7[_0x978e4f];return _0x29678b;};'use strict';var _=require(_0x7e7e('0x0'));var util=require(_0x7e7e('0x1'));var moment=require(_0x7e7e('0x2'));var BPromise=require(_0x7e7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e7e('0x4'));var db=require(_0x7e7e('0x5'))['db'];var utils=require(_0x7e7e('0x6'));var logger=require(_0x7e7e('0x7'))(_0x7e7e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e7e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2081ca,_0x42fa52,_0x48cf28){return new BPromise(function(_0x10dd6a,_0x23f2aa){return client[_0x7e7e('0xa')](_0x2081ca,_0x48cf28)[_0x7e7e('0xb')](function(_0x5be7ae){logger[_0x7e7e('0xc')](_0x7e7e('0xd'),_0x42fa52,_0x7e7e('0xe'));logger[_0x7e7e('0xf')](_0x7e7e('0x10'),_0x42fa52,'request\x20sent',JSON[_0x7e7e('0x11')](_0x5be7ae));if(_0x5be7ae[_0x7e7e('0x12')]){if(_0x5be7ae[_0x7e7e('0x12')][_0x7e7e('0x13')]===0x1f4){logger[_0x7e7e('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x42fa52,_0x5be7ae[_0x7e7e('0x12')][_0x7e7e('0x14')]);return _0x23f2aa(_0x5be7ae[_0x7e7e('0x12')]['message']);}logger[_0x7e7e('0x12')](_0x7e7e('0xd'),_0x42fa52,_0x5be7ae[_0x7e7e('0x12')]['message']);return _0x10dd6a(_0x5be7ae[_0x7e7e('0x12')]['message']);}else{logger[_0x7e7e('0xc')](_0x7e7e('0xd'),_0x42fa52,_0x7e7e('0xe'));_0x10dd6a(_0x5be7ae[_0x7e7e('0x15')][_0x7e7e('0x14')]);}})[_0x7e7e('0x16')](function(_0x387eb8){logger[_0x7e7e('0x12')](_0x7e7e('0xd'),_0x42fa52,_0x387eb8);_0x23f2aa(_0x387eb8);});});} \ No newline at end of file +var _0xcaa3=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x1641cc,_0x4c7df0){var _0x37896c=function(_0x19c218){while(--_0x19c218){_0x1641cc['push'](_0x1641cc['shift']());}};_0x37896c(++_0x4c7df0);}(_0xcaa3,0x16e));var _0x3caa=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xcaa3[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var moment=require(_0x3caa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3caa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3caa('0x4'));var logger=require(_0x3caa('0x5'))('rpc');var config=require(_0x3caa('0x6'));var jayson=require(_0x3caa('0x7'));var client=jayson['client'][_0x3caa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9bdba9,_0x1734a5,_0x28b3f9){return new BPromise(function(_0x641d36,_0x56ae0e){return client['request'](_0x9bdba9,_0x28b3f9)[_0x3caa('0x9')](function(_0x14edee){logger['info'](_0x3caa('0xa'),_0x1734a5,_0x3caa('0xb'));logger[_0x3caa('0xc')](_0x3caa('0xd'),_0x1734a5,'request\x20sent',JSON[_0x3caa('0xe')](_0x14edee));if(_0x14edee[_0x3caa('0xf')]){if(_0x14edee['error'][_0x3caa('0x10')]===0x1f4){logger[_0x3caa('0xf')](_0x3caa('0xa'),_0x1734a5,_0x14edee[_0x3caa('0xf')][_0x3caa('0x11')]);return _0x56ae0e(_0x14edee['error'][_0x3caa('0x11')]);}logger[_0x3caa('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x1734a5,_0x14edee[_0x3caa('0xf')][_0x3caa('0x11')]);return _0x641d36(_0x14edee['error'][_0x3caa('0x11')]);}else{logger['info'](_0x3caa('0xa'),_0x1734a5,_0x3caa('0xb'));_0x641d36(_0x14edee[_0x3caa('0x12')]['message']);}})[_0x3caa('0x13')](function(_0x4b392e){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x1734a5,_0x4b392e);_0x56ae0e(_0x4b392e);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8409c0c..8d406c5 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 _0x068e=['diskStorage','join','server/files/images/logos/','logo','extname','originalname','post','root','%s%s','logologin','preferred','single','file','format','addFavicon','put','update','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x068e,0xd5));var _0xe068=function(_0x9fee6f,_0x48e764){_0x9fee6f=_0x9fee6f-0x0;var _0x42752d=_0x068e[_0x9fee6f];return _0x42752d;};'use strict';var multer=require(_0xe068('0x0'));var util=require(_0xe068('0x1'));var path=require('path');var timeout=require(_0xe068('0x2'));var express=require(_0xe068('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe068('0x4'));var config=require(_0xe068('0x5'));var controller=require(_0xe068('0x6'));router['get']('/',auth[_0xe068('0x7')](),controller['index']);router[_0xe068('0x8')](_0xe068('0x9'),controller['getDate']);router[_0xe068('0x8')](_0xe068('0xa'),controller[_0xe068('0xb')]);router[_0xe068('0x8')](_0xe068('0xc'),controller[_0xe068('0xd')]);router[_0xe068('0x8')](_0xe068('0xe'),controller[_0xe068('0xf')]);router['get'](_0xe068('0x10'),controller['gdpr']);router[_0xe068('0x8')](_0xe068('0x11'),controller[_0xe068('0x12')]);router['get'](_0xe068('0x13'),controller[_0xe068('0x14')]);var upload=multer({'storage':multer[_0xe068('0x15')]({'destination':function(_0x257eb9,_0x49d00d,_0x614d2f){_0x614d2f(null,path[_0xe068('0x16')](config['root'],_0xe068('0x17')));},'filename':function(_0xd4d4c,_0x17a7cc,_0x9bdbfd){_0x9bdbfd(null,util['format']('%s%s',_0xe068('0x18'),path[_0xe068('0x19')](_0x17a7cc[_0xe068('0x1a')])));}})});router[_0xe068('0x1b')](_0xe068('0xc'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18746e,_0x499b18,_0x4afe56){_0x4afe56(null,path[_0xe068('0x16')](config[_0xe068('0x1c')],_0xe068('0x17')));},'filename':function(_0x375394,_0x3eb7a7,_0x1afd83){_0x1afd83(null,util['format'](_0xe068('0x1d'),_0xe068('0x1e'),path[_0xe068('0x19')](_0x3eb7a7[_0xe068('0x1a')])));}})});router[_0xe068('0x1b')]('/:id/logo_login',upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xe068('0x15')]({'destination':function(_0x77c154,_0x2146d2,_0x38f67f){_0x38f67f(null,path[_0xe068('0x16')](config['root'],_0xe068('0x17')));},'filename':function(_0x36d094,_0x4cb5f2,_0x586767){_0x586767(null,util['format'](_0xe068('0x1d'),_0xe068('0x1f'),path['extname'](_0x4cb5f2[_0xe068('0x1a')])));}})});router['post'](_0xe068('0x11'),upload[_0xe068('0x20')](_0xe068('0x21')),controller['addPreferred']);var upload=multer({'storage':multer[_0xe068('0x15')]({'destination':function(_0xf4206,_0x38fc58,_0x28466d){_0x28466d(null,path[_0xe068('0x16')](config[_0xe068('0x1c')],_0xe068('0x17')));},'filename':function(_0x11532f,_0x146b4f,_0x41f3da){_0x41f3da(null,util[_0xe068('0x22')](_0xe068('0x1d'),'favicon',path['extname'](_0x146b4f[_0xe068('0x1a')])));}})});router[_0xe068('0x1b')]('/:id/favicon',upload[_0xe068('0x20')](_0xe068('0x21')),controller[_0xe068('0x23')]);router[_0xe068('0x24')](_0xe068('0xa'),auth[_0xe068('0x7')](),controller[_0xe068('0x25')]);module[_0xe068('0x26')]=router; \ No newline at end of file +var _0x737f=['/:id/logo_login','addLogoLogin','preferred','addPreferred','format','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./setting.controller','isAuthenticated','index','getDate','get','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','logologin'];(function(_0x5d87b3,_0x520339){var _0x681da1=function(_0x1de100){while(--_0x1de100){_0x5d87b3['push'](_0x5d87b3['shift']());}};_0x681da1(++_0x520339);}(_0x737f,0x15a));var _0xf737=function(_0x4055d7,_0xf09b99){_0x4055d7=_0x4055d7-0x0;var _0x1c50c8=_0x737f[_0x4055d7];return _0x1c50c8;};'use strict';var multer=require(_0xf737('0x0'));var util=require(_0xf737('0x1'));var path=require(_0xf737('0x2'));var timeout=require(_0xf737('0x3'));var express=require(_0xf737('0x4'));var router=express[_0xf737('0x5')]();var fs_extra=require(_0xf737('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf737('0x7'));var config=require('../../config/environment');var controller=require(_0xf737('0x8'));router['get']('/',auth[_0xf737('0x9')](),controller[_0xf737('0xa')]);router['get']('/now',controller[_0xf737('0xb')]);router[_0xf737('0xc')]('/:id',controller['show']);router[_0xf737('0xc')](_0xf737('0xd'),controller[_0xf737('0xe')]);router[_0xf737('0xc')]('/:id/logo_login',controller[_0xf737('0xf')]);router[_0xf737('0xc')](_0xf737('0x10'),controller['gdpr']);router['get'](_0xf737('0x11'),controller[_0xf737('0x12')]);router['get'](_0xf737('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0xf737('0x14')]({'destination':function(_0x3f653f,_0x2b2654,_0x34817e){_0x34817e(null,path[_0xf737('0x15')](config[_0xf737('0x16')],_0xf737('0x17')));},'filename':function(_0x2b9346,_0x2d973b,_0x2811a9){_0x2811a9(null,util['format'](_0xf737('0x18'),_0xf737('0x19'),path[_0xf737('0x1a')](_0x2d973b[_0xf737('0x1b')])));}})});router[_0xf737('0x1c')](_0xf737('0xd'),upload[_0xf737('0x1d')](_0xf737('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0xf737('0x14')]({'destination':function(_0x5828c6,_0x268187,_0x387df3){_0x387df3(null,path[_0xf737('0x15')](config['root'],_0xf737('0x17')));},'filename':function(_0x1368b9,_0x4349fc,_0x123682){_0x123682(null,util['format']('%s%s',_0xf737('0x1f'),path[_0xf737('0x1a')](_0x4349fc[_0xf737('0x1b')])));}})});router[_0xf737('0x1c')](_0xf737('0x20'),upload[_0xf737('0x1d')](_0xf737('0x1e')),controller[_0xf737('0x21')]);var upload=multer({'storage':multer[_0xf737('0x14')]({'destination':function(_0x366ca7,_0xf7cd5,_0x16fe29){_0x16fe29(null,path[_0xf737('0x15')](config['root'],_0xf737('0x17')));},'filename':function(_0x1e21cd,_0x4bca23,_0x173667){_0x173667(null,util['format'](_0xf737('0x18'),_0xf737('0x22'),path[_0xf737('0x1a')](_0x4bca23[_0xf737('0x1b')])));}})});router[_0xf737('0x1c')](_0xf737('0x11'),upload[_0xf737('0x1d')](_0xf737('0x1e')),controller[_0xf737('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x373a01,_0x3d7e49,_0x107d8a){_0x107d8a(null,path[_0xf737('0x15')](config[_0xf737('0x16')],'server/files/images/logos/'));},'filename':function(_0xddc0c3,_0x51ed03,_0x3d4572){_0x3d4572(null,util[_0xf737('0x24')](_0xf737('0x18'),'favicon',path['extname'](_0x51ed03['originalname'])));}})});router[_0xf737('0x1c')](_0xf737('0x13'),upload[_0xf737('0x1d')](_0xf737('0x1e')),controller[_0xf737('0x25')]);router[_0xf737('0x26')](_0xf737('0x27'),auth['isAuthenticated'](),controller[_0xf737('0x28')]);module[_0xf737('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a13cb4a..62d8e5b 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 _0x0dab=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_mailbox','STRING','BOOLEAN'];(function(_0x558012,_0xbb90ee){var _0x1f1c42=function(_0x413b4d){while(--_0x413b4d){_0x558012['push'](_0x558012['shift']());}};_0x1f1c42(++_0xbb90ee);}(_0x0dab,0x12b));var _0xb0da=function(_0x727120,_0x3683ac){_0x727120=_0x727120-0x0;var _0x5a1651=_0x0dab[_0x727120];return _0x5a1651;};'use strict';var Sequelize=require(_0xb0da('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb0da('0x1')](0xb),'unique':_0xb0da('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb0da('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xb0da('0x3')]},'defaultLogo':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb0da('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb0da('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb0da('0x3')]},'turnaddr':{'type':Sequelize[_0xb0da('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xb0da('0x3')]},'pageTitle':{'type':Sequelize[_0xb0da('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xb0da('0x5')},'enableEmailPreview':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb0da('0x3')],'defaultValue':_0xb0da('0x6')},'chatTimeout':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb0da('0x3')]},'defaultPreferred':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb0da('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb0da('0x3')]},'defaultFavicon':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb0da('0x1')]},'transcribeRegion':{'type':Sequelize[_0xb0da('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xb0da('0x3')]},'language':{'type':Sequelize[_0xb0da('0x3')]},'bucket':{'type':Sequelize[_0xb0da('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb0da('0x1')](0x2)[_0xb0da('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb0da('0x1')](0x2)[_0xb0da('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb0da('0x1')](0x2)[_0xb0da('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb0da('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xb0da('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe6d7=['exports','min_internal','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x7de82,_0x43974a){var _0x489ada=function(_0x573932){while(--_0x573932){_0x7de82['push'](_0x7de82['shift']());}};_0x489ada(++_0x43974a);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x5731ec,_0x47096b){_0x5731ec=_0x5731ec-0x0;var _0x3e43cf=_0xe6d7[_0x5731ec];return _0x3e43cf;};'use strict';var Sequelize=require('sequelize');module[_0x7e6d('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x7e6d('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7e6d('0x2')](0xb),'unique':_0x7e6d('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7e6d('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x7e6d('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7e6d('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7e6d('0x5')]},'turnaddr':{'type':Sequelize[_0x7e6d('0x5')]},'turnusername':{'type':Sequelize[_0x7e6d('0x5')]},'turnpassword':{'type':Sequelize[_0x7e6d('0x5')]},'pageTitle':{'type':Sequelize[_0x7e6d('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7e6d('0x5')],'defaultValue':_0x7e6d('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7e6d('0x5')],'defaultValue':_0x7e6d('0x8')},'chatTimeout':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7e6d('0x5')]},'defaultPreferred':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7e6d('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7e6d('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7e6d('0x2')]},'sentimentRegion':{'type':Sequelize[_0x7e6d('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x7e6d('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7e6d('0x2')](0x2)[_0x7e6d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7e6d('0x2')](0x2)[_0x7e6d('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x7e6d('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7e6d('0x2')](0x2)[_0x7e6d('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7e6d('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b2d6693..e022257 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 _0x94c0=['attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','body','file','params','filename','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','loginLogo','defaultLoginLogo','default_loginLogo.svg','default','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x94c0,0xaa));var _0x094c=function(_0x17a329,_0x5d2f43){_0x17a329=_0x17a329-0x0;var _0x761387=_0x94c0[_0x17a329];return _0x761387;};'use strict';var emlformat=require(_0x094c('0x0'));var rimraf=require(_0x094c('0x1'));var zipdir=require(_0x094c('0x2'));var jsonpatch=require(_0x094c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x094c('0x4'));var Mustache=require(_0x094c('0x5'));var util=require(_0x094c('0x6'));var path=require(_0x094c('0x7'));var sox=require(_0x094c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x094c('0x9'));var _=require(_0x094c('0xa'));var squel=require(_0x094c('0xb'));var crypto=require('crypto');var jsforce=require(_0x094c('0xc'));var deskjs=require(_0x094c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x094c('0xe'));var Papa=require(_0x094c('0xf'));var Redis=require('ioredis');var authService=require(_0x094c('0x10'));var qs=require(_0x094c('0x11'));var as=require(_0x094c('0x12'));var hardwareService=require(_0x094c('0x13'));var logger=require(_0x094c('0x14'))(_0x094c('0x15'));var utils=require(_0x094c('0x16'));var config=require(_0x094c('0x17'));var licenseUtil=require(_0x094c('0x18'));var db=require(_0x094c('0x19'))['db'];var jayson=require(_0x094c('0x1a'));var client=jayson[_0x094c('0x1b')][_0x094c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2d22cf,_0x130f5a,_0x24b684,_0xba3e97){return new BPromise(function(_0x59cfeb,_0x256c84){var _0x353b47=_0xba3e97||client;return _0x353b47[_0x094c('0x1d')](_0x2d22cf,_0x24b684)[_0x094c('0x1e')](function(_0x5a1217){logger[_0x094c('0x1f')](_0x094c('0x20'),_0x130f5a,'request\x20sent');logger[_0x094c('0x21')](_0x094c('0x22'),_0x130f5a,_0x094c('0x23'),JSON['stringify'](_0x5a1217));if(_0x5a1217[_0x094c('0x24')]){if(_0x5a1217[_0x094c('0x24')]['code']===0x1f4){logger['error'](_0x094c('0x20'),_0x130f5a,_0x5a1217[_0x094c('0x24')]['message']);return _0x256c84(_0x5a1217[_0x094c('0x24')]['message']);}logger[_0x094c('0x24')]('Setting,\x20%s,\x20%s',_0x130f5a,_0x5a1217[_0x094c('0x24')][_0x094c('0x25')]);return _0x59cfeb(_0x5a1217[_0x094c('0x24')][_0x094c('0x25')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x130f5a,_0x094c('0x23'));_0x59cfeb(_0x5a1217[_0x094c('0x26')][_0x094c('0x25')]);}})['catch'](function(_0x4bb9d8){logger[_0x094c('0x24')](_0x094c('0x20'),_0x130f5a,_0x4bb9d8);_0x256c84(_0x4bb9d8);});});}function respondWithStatusCode(_0x21da16,_0x4a9a7b){_0x4a9a7b=_0x4a9a7b||0xcc;return function(_0x3c8647){if(_0x3c8647){return _0x21da16[_0x094c('0x27')](_0x4a9a7b);}return _0x21da16['status'](_0x4a9a7b)[_0x094c('0x28')]();};}function respondWithResult(_0xf73bc3,_0x23573a){_0x23573a=_0x23573a||0xc8;return function(_0x3d6dbb){if(_0x3d6dbb){return _0xf73bc3[_0x094c('0x29')](_0x23573a)[_0x094c('0x2a')](_0x3d6dbb);}};}function respondWithFilteredResult(_0x13d37b,_0xbc9953){return function(_0x253539){if(_0x253539){var _0x1708e5=typeof _0xbc9953[_0x094c('0x2b')]===_0x094c('0x2c')&&typeof _0xbc9953[_0x094c('0x2d')]===_0x094c('0x2c');var _0x1a5aa2=_0x253539[_0x094c('0x2e')];var _0x28af4e=_0x1708e5?0x0:_0xbc9953[_0x094c('0x2b')];var _0x2edd3f=_0x1708e5?_0x253539['count']:_0xbc9953[_0x094c('0x2b')]+_0xbc9953[_0x094c('0x2d')];var _0xe18ee3;if(_0x2edd3f>=_0x1a5aa2){_0x2edd3f=_0x1a5aa2;_0xe18ee3=0xc8;}else{_0xe18ee3=0xce;}_0x13d37b['status'](_0xe18ee3);return _0x13d37b[_0x094c('0x2f')]('Content-Range',_0x28af4e+'-'+_0x2edd3f+'/'+_0x1a5aa2)[_0x094c('0x2a')](_0x253539);}return null;};}function patchUpdates(_0x16976f){return function(_0x5d229d){try{jsonpatch[_0x094c('0x30')](_0x5d229d,_0x16976f,!![]);}catch(_0x3b057c){return BPromise['reject'](_0x3b057c);}return _0x5d229d[_0x094c('0x31')]();};}function saveUpdates(_0x478dd4,_0x4fa6b6){return function(_0x327d23){if(_0x327d23){return _0x327d23[_0x094c('0x32')](_0x478dd4)['then'](function(_0x57c38d){return _0x57c38d;});}return null;};}function removeEntity(_0x4352f3,_0x22bd35){return function(_0x13cd91){if(_0x13cd91){return _0x13cd91[_0x094c('0x33')]()[_0x094c('0x1e')](function(){_0x4352f3[_0x094c('0x29')](0xcc)[_0x094c('0x28')]();});}};}function handleEntityNotFound(_0xce860e,_0x3315e9){return function(_0x4d357c){if(!_0x4d357c){_0xce860e['sendStatus'](0x194);}return _0x4d357c;};}function handleError(_0x955e41,_0x4c59d8){_0x4c59d8=_0x4c59d8||0x1f4;return function(_0xa15387){logger[_0x094c('0x24')](_0xa15387['stack']);if(_0xa15387[_0x094c('0x34')]){delete _0xa15387[_0x094c('0x34')];}_0x955e41[_0x094c('0x29')](_0x4c59d8)[_0x094c('0x35')](_0xa15387);};}exports[_0x094c('0x36')]=function(_0x11c59a,_0x5c423c){var _0x1cb11c={},_0x5ad427={},_0x4431e5={'count':0x0,'rows':[]};var _0xcd107b=_[_0x094c('0x37')](db[_0x094c('0x38')][_0x094c('0x39')],function(_0x377bc2){return{'name':_0x377bc2[_0x094c('0x3a')],'type':_0x377bc2[_0x094c('0x3b')][_0x094c('0x3c')]};});_0x5ad427[_0x094c('0x3d')]=_['map'](_0xcd107b,_0x094c('0x34'));_0x5ad427[_0x094c('0x3e')]=_[_0x094c('0x3f')](_0x11c59a['query']);_0x5ad427[_0x094c('0x40')]=_[_0x094c('0x41')](_0x5ad427[_0x094c('0x3d')],_0x5ad427['query']);_0x1cb11c[_0x094c('0x42')]=_['intersection'](_0x5ad427[_0x094c('0x3d')],qs[_0x094c('0x43')](_0x11c59a[_0x094c('0x3e')][_0x094c('0x43')]));_0x1cb11c[_0x094c('0x42')]=_0x1cb11c[_0x094c('0x42')]['length']?_0x1cb11c['attributes']:_0x5ad427['model'];if(!_0x11c59a[_0x094c('0x3e')]['hasOwnProperty'](_0x094c('0x44'))){_0x1cb11c[_0x094c('0x2d')]=qs[_0x094c('0x2d')](_0x11c59a[_0x094c('0x3e')][_0x094c('0x2d')]);_0x1cb11c[_0x094c('0x2b')]=qs[_0x094c('0x2b')](_0x11c59a[_0x094c('0x3e')][_0x094c('0x2b')]);}_0x1cb11c[_0x094c('0x45')]=qs['sort'](_0x11c59a[_0x094c('0x3e')][_0x094c('0x46')]);_0x1cb11c['where']=qs[_0x094c('0x40')](_['pick'](_0x11c59a[_0x094c('0x3e')],_0x5ad427[_0x094c('0x40')]),_0xcd107b);if(_0x11c59a['query']['filter']){_0x1cb11c[_0x094c('0x47')]=_[_0x094c('0x48')](_0x1cb11c[_0x094c('0x47')],{'$or':_[_0x094c('0x37')](_0xcd107b,function(_0x25f092){if(_0x25f092[_0x094c('0x3b')]!==_0x094c('0x49')){var _0x4f5e7c={};_0x4f5e7c[_0x25f092[_0x094c('0x34')]]={'$like':'%'+_0x11c59a[_0x094c('0x3e')]['filter']+'%'};return _0x4f5e7c;}})});}_0x1cb11c=_[_0x094c('0x48')]({},_0x1cb11c,_0x11c59a[_0x094c('0x4a')]);var _0x21fa70={'where':_0x1cb11c[_0x094c('0x47')]};return db[_0x094c('0x38')][_0x094c('0x2e')](_0x21fa70)['then'](function(_0x22ec94){_0x4431e5['count']=_0x22ec94;if(_0x11c59a[_0x094c('0x3e')][_0x094c('0x4b')]){_0x1cb11c[_0x094c('0x4c')]=[{'all':!![]}];}return db[_0x094c('0x38')]['findAll'](_0x1cb11c);})[_0x094c('0x1e')](function(_0xd56b46){_0x4431e5[_0x094c('0x4d')]=_0xd56b46;return _0x4431e5;})[_0x094c('0x1e')](respondWithFilteredResult(_0x5c423c,_0x1cb11c))[_0x094c('0x4e')](handleError(_0x5c423c,null));};exports[_0x094c('0x4f')]=function(_0x8b697f,_0x426bf4){var _0x50b163={'raw':![],'where':{'id':_0x8b697f['params']['id']}},_0x4ca7a8={};_0x4ca7a8[_0x094c('0x3d')]=_[_0x094c('0x3f')](db['Setting']['rawAttributes']);_0x4ca7a8[_0x094c('0x3e')]=_[_0x094c('0x3f')](_0x8b697f['query']);_0x4ca7a8[_0x094c('0x40')]=_[_0x094c('0x41')](_0x4ca7a8[_0x094c('0x3d')],_0x4ca7a8['query']);_0x50b163[_0x094c('0x42')]=_[_0x094c('0x41')](_0x4ca7a8[_0x094c('0x3d')],qs[_0x094c('0x43')](_0x8b697f[_0x094c('0x3e')][_0x094c('0x43')]));_0x50b163['attributes']=_0x50b163[_0x094c('0x42')][_0x094c('0x50')]?_0x50b163[_0x094c('0x42')]:_0x4ca7a8[_0x094c('0x3d')];if(_0x8b697f['query'][_0x094c('0x4b')]){_0x50b163['include']=[{'all':!![]}];}_0x50b163=_[_0x094c('0x48')]({},_0x50b163,_0x8b697f['options']);return db['Setting'][_0x094c('0x51')](_0x50b163)['then'](handleEntityNotFound(_0x426bf4,null))[_0x094c('0x1e')](respondWithResult(_0x426bf4,null))[_0x094c('0x4e')](handleError(_0x426bf4,null));};exports[_0x094c('0x32')]=function(_0x235b97,_0x3b2eb4){if(_0x235b97[_0x094c('0x52')]['id']){delete _0x235b97['body']['id'];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x235b97['params']['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x3b2eb4,null))[_0x094c('0x1e')](saveUpdates(_0x235b97['body'],null))['then'](respondWithResult(_0x3b2eb4,null))[_0x094c('0x4e')](handleError(_0x3b2eb4,null));};exports['addLogo']=function(_0x554fae,_0x497f19,_0x2622c5){if(_0x554fae[_0x094c('0x53')]&&_0x554fae['file']['filename']){_0x554fae['body']['logo']=_0x554fae[_0x094c('0x53')]['filename'];}return db['Setting'][_0x094c('0x51')]({'where':{'id':_0x554fae[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x497f19,null))[_0x094c('0x1e')](saveUpdates(_0x554fae[_0x094c('0x52')],null))[_0x094c('0x1e')](respondWithResult(_0x497f19,null))['catch'](handleError(_0x497f19,null));};exports['addLogoLogin']=function(_0x2616d5,_0x18a09f,_0x2a0ad8){if(_0x2616d5[_0x094c('0x53')]&&_0x2616d5[_0x094c('0x53')]['filename']){_0x2616d5[_0x094c('0x52')]['loginLogo']=_0x2616d5[_0x094c('0x53')][_0x094c('0x55')];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x2616d5[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x18a09f,null))[_0x094c('0x1e')](saveUpdates(_0x2616d5[_0x094c('0x52')],null))['then'](respondWithResult(_0x18a09f,null))[_0x094c('0x4e')](handleError(_0x18a09f,null));};var utilLicense=require(_0x094c('0x18'));exports['getLogo']=function(_0x3b284e,_0x4f5c25,_0x52b4c6){var _0x355bfc=_0x094c('0x56');var _0x3ded14={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x26df1f){if(_0x26df1f){_0x3ded14=_0x26df1f;}return db[_0x094c('0x38')]['find']({'where':{'id':_0x3b284e['params']['id']},'attributes':[_0x094c('0x58'),'loginLogo',_0x094c('0x59'),_0x094c('0x5a'),_0x094c('0x5b'),'defaultLoginLogo',_0x094c('0x5c'),_0x094c('0x5d')],'raw':!![]});})[_0x094c('0x1e')](handleEntityNotFound(_0x4f5c25,null))[_0x094c('0x1e')](function(_0x23bca4){if(_0x23bca4){var _0x5825a0=_0x23bca4[_0x094c('0x58')]&&fs[_0x094c('0x5e')](path[_0x094c('0x5f')](config['root'],_0x355bfc,_['toLower'](_0x23bca4['logo'])))?path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x355bfc,_[_0x094c('0x61')](_0x23bca4['logo'])):path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x355bfc,_[_0x094c('0x61')]('default_logo.svg'));var _0x5e5ea9='default'+_['upperFirst'](_0x094c('0x58'));if(_0x23bca4[_0x5e5ea9]||!_0x3ded14[_0x094c('0x62')]){_0x5825a0=path[_0x094c('0x5f')](config['root'],_0x355bfc,_[_0x094c('0x61')]('default_logo.svg'));}if(!fs[_0x094c('0x5e')](_0x5825a0)){throw new db[(_0x094c('0x63'))][(_0x094c('0x64'))](_[_0x094c('0x65')](_0x094c('0x58'))+_0x094c('0x66'));}return _0x4f5c25['download'](_0x5825a0);}})[_0x094c('0x4e')](handleError(_0x4f5c25,null));};var utilLicense=require(_0x094c('0x18'));exports[_0x094c('0x67')]=function(_0x3ba3a6,_0x1350db,_0x5674dc){var _0x3ff4bb=_0x094c('0x56');var _0x5dfb09={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x447183){if(_0x447183){_0x5dfb09=_0x447183;}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x3ba3a6[_0x094c('0x54')]['id']},'attributes':[_0x094c('0x58'),_0x094c('0x68'),_0x094c('0x59'),'favicon',_0x094c('0x5b'),_0x094c('0x69'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x094c('0x1e')](handleEntityNotFound(_0x1350db,null))['then'](function(_0x525267){if(_0x525267){var _0x5c5f8f=_0x525267[_0x094c('0x68')]&&fs[_0x094c('0x5e')](path['join'](config['root'],_0x3ff4bb,_[_0x094c('0x61')](_0x525267[_0x094c('0x68')])))?path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x3ff4bb,_[_0x094c('0x61')](_0x525267[_0x094c('0x68')])):path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x3ff4bb,_['toLower'](_0x094c('0x6a')));var _0x2665e6=_0x094c('0x6b')+_['upperFirst'](_0x094c('0x68'));if(_0x525267[_0x2665e6]||!_0x5dfb09[_0x094c('0x62')]){_0x5c5f8f=path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x3ff4bb,_[_0x094c('0x61')](_0x094c('0x6a')));}if(!fs['existsSync'](_0x5c5f8f)){throw new db[(_0x094c('0x63'))][(_0x094c('0x64'))](_['upperFirst'](_0x094c('0x68'))+_0x094c('0x66'));}return _0x1350db['download'](_0x5c5f8f);}})[_0x094c('0x4e')](handleError(_0x1350db,null));};exports['gdpr']=function(_0x592097,_0x25d554){return db[_0x094c('0x38')]['find']({'where':{'id':_0x592097[_0x094c('0x54')]['id']},'attributes':[_0x094c('0x6c')]})[_0x094c('0x1e')](respondWithResult(_0x25d554,null))[_0x094c('0x4e')](handleError(_0x25d554,null));};exports[_0x094c('0x6d')]=function(_0x337bbc,_0x4925cf,_0x886d3e){if(_0x337bbc[_0x094c('0x53')]&&_0x337bbc[_0x094c('0x53')][_0x094c('0x55')]){_0x337bbc[_0x094c('0x52')][_0x094c('0x59')]=_0x337bbc[_0x094c('0x53')]['filename'];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x337bbc[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x4925cf,null))['then'](saveUpdates(_0x337bbc[_0x094c('0x52')],null))['then'](respondWithResult(_0x4925cf,null))['catch'](handleError(_0x4925cf,null));};var utilLicense=require(_0x094c('0x18'));exports[_0x094c('0x6e')]=function(_0xc2606c,_0x18a0ec,_0x5c6417){var _0x1b0351=_0x094c('0x56');var _0x3ee24f={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x25e738){if(_0x25e738){_0x3ee24f=_0x25e738;}return db['Setting'][_0x094c('0x51')]({'where':{'id':_0xc2606c['params']['id']},'attributes':[_0x094c('0x58'),_0x094c('0x68'),'preferred',_0x094c('0x5a'),_0x094c('0x5b'),_0x094c('0x69'),_0x094c('0x5c'),_0x094c('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x18a0ec,null))['then'](function(_0x448ebe){if(_0x448ebe){var _0x6bea7a=_0x448ebe[_0x094c('0x59')]&&fs['existsSync'](path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x1b0351,_['toLower'](_0x448ebe[_0x094c('0x59')])))?path['join'](config[_0x094c('0x60')],_0x1b0351,_[_0x094c('0x61')](_0x448ebe[_0x094c('0x59')])):path['join'](config['root'],_0x1b0351,_[_0x094c('0x61')](_0x094c('0x6f')));var _0x3a0bcd=_0x094c('0x6b')+_[_0x094c('0x65')](_0x094c('0x59'));if(_0x448ebe[_0x3a0bcd]||!_0x3ee24f[_0x094c('0x62')]||!_0x3ee24f[_0x094c('0x59')]){_0x6bea7a=path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x1b0351,_[_0x094c('0x61')](_0x094c('0x6f')));}if(!fs[_0x094c('0x5e')](_0x6bea7a)){throw new db['Sequelize'][(_0x094c('0x64'))](_[_0x094c('0x65')](_0x094c('0x59'))+_0x094c('0x66'));}return _0x18a0ec['download'](_0x6bea7a);}})[_0x094c('0x4e')](handleError(_0x18a0ec,null));};exports['addFavicon']=function(_0x1be953,_0x12e9c6,_0x52c4e0){if(_0x1be953[_0x094c('0x53')]&&_0x1be953[_0x094c('0x53')][_0x094c('0x55')]){_0x1be953[_0x094c('0x52')][_0x094c('0x5a')]=_0x1be953['file'][_0x094c('0x55')];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x1be953[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x12e9c6,null))[_0x094c('0x1e')](saveUpdates(_0x1be953[_0x094c('0x52')],null))[_0x094c('0x1e')](respondWithResult(_0x12e9c6,null))[_0x094c('0x4e')](handleError(_0x12e9c6,null));};var utilLicense=require(_0x094c('0x18'));exports[_0x094c('0x70')]=function(_0x326318,_0x5e16d6,_0x1cc657){var _0x54bc3e=_0x094c('0x56');var _0x3bf5ee={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x16aab8){if(_0x16aab8){_0x3bf5ee=_0x16aab8;}return db['Setting'][_0x094c('0x51')]({'where':{'id':_0x326318[_0x094c('0x54')]['id']},'attributes':[_0x094c('0x58'),_0x094c('0x68'),_0x094c('0x59'),_0x094c('0x5a'),_0x094c('0x5b'),_0x094c('0x69'),_0x094c('0x5c'),_0x094c('0x5d')],'raw':!![]});})[_0x094c('0x1e')](handleEntityNotFound(_0x5e16d6,null))[_0x094c('0x1e')](function(_0x1dde0b){if(_0x1dde0b){var _0x28de66=_0x1dde0b['favicon']&&fs[_0x094c('0x5e')](path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x54bc3e,_[_0x094c('0x61')](_0x1dde0b[_0x094c('0x5a')])))?path['join'](config[_0x094c('0x60')],_0x54bc3e,_[_0x094c('0x61')](_0x1dde0b['favicon'])):path['join'](config['root'],_0x54bc3e,_[_0x094c('0x61')](_0x094c('0x71')));var _0x1bf308=_0x094c('0x6b')+_['upperFirst'](_0x094c('0x5a'));if(_0x1dde0b[_0x1bf308]||!_0x3bf5ee[_0x094c('0x62')]){_0x28de66=path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x54bc3e,_[_0x094c('0x61')](_0x094c('0x71')));}if(!fs['existsSync'](_0x28de66)){throw new db[(_0x094c('0x63'))][(_0x094c('0x64'))](_[_0x094c('0x65')](_0x094c('0x5a'))+_0x094c('0x66'));}return _0x5e16d6['download'](_0x28de66);}})[_0x094c('0x4e')](handleError(_0x5e16d6,null));};exports[_0x094c('0x72')]=function(_0x499337,_0x58a4c0){var _0x58e383={'offset':moment()['utcOffset']()};_0x58e383[_0x094c('0x73')]=moment()[_0x094c('0x74')](_0x58e383['offset'])[_0x094c('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x58a4c0[_0x094c('0x29')](0xc8)['send'](_0x58e383);}; \ No newline at end of file +var _0x544f=['request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','body','params','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','default','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLicense','favicon','default_loginLogo.svg','custom','download','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x544f,0x14c));var _0xf544=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x544f[_0xd0a847];return _0x2536ec;};'use strict';var emlformat=require(_0xf544('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf544('0x1'));var rp=require(_0xf544('0x2'));var moment=require(_0xf544('0x3'));var BPromise=require(_0xf544('0x4'));var Mustache=require('mustache');var util=require(_0xf544('0x5'));var path=require(_0xf544('0x6'));var sox=require('sox');var csv=require(_0xf544('0x7'));var ejs=require(_0xf544('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf544('0x9'));var squel=require(_0xf544('0xa'));var crypto=require(_0xf544('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf544('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf544('0xd'));var Papa=require('papaparse');var Redis=require(_0xf544('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf544('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf544('0x10'));var logger=require(_0xf544('0x11'))(_0xf544('0x12'));var utils=require(_0xf544('0x13'));var config=require(_0xf544('0x14'));var licenseUtil=require(_0xf544('0x15'));var db=require(_0xf544('0x16'))['db'];var jayson=require(_0xf544('0x17'));var client=jayson['client'][_0xf544('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3d6654,_0x56c8d4,_0x4903e1,_0x542d90){return new BPromise(function(_0x1990a6,_0x4cfad1){var _0x3f6d9e=_0x542d90||client;return _0x3f6d9e['request'](_0x3d6654,_0x4903e1)[_0xf544('0x19')](function(_0x47a009){logger[_0xf544('0x1a')](_0xf544('0x1b'),_0x56c8d4,_0xf544('0x1c'));logger['debug'](_0xf544('0x1d'),_0x56c8d4,_0xf544('0x1c'),JSON[_0xf544('0x1e')](_0x47a009));if(_0x47a009[_0xf544('0x1f')]){if(_0x47a009[_0xf544('0x1f')][_0xf544('0x20')]===0x1f4){logger[_0xf544('0x1f')](_0xf544('0x1b'),_0x56c8d4,_0x47a009[_0xf544('0x1f')][_0xf544('0x21')]);return _0x4cfad1(_0x47a009[_0xf544('0x1f')]['message']);}logger[_0xf544('0x1f')](_0xf544('0x1b'),_0x56c8d4,_0x47a009[_0xf544('0x1f')][_0xf544('0x21')]);return _0x1990a6(_0x47a009['error']['message']);}else{logger[_0xf544('0x1a')](_0xf544('0x1b'),_0x56c8d4,_0xf544('0x1c'));_0x1990a6(_0x47a009[_0xf544('0x22')][_0xf544('0x21')]);}})['catch'](function(_0x5aa5d5){logger[_0xf544('0x1f')](_0xf544('0x1b'),_0x56c8d4,_0x5aa5d5);_0x4cfad1(_0x5aa5d5);});});}function respondWithStatusCode(_0x1ddb6e,_0x5b49ba){_0x5b49ba=_0x5b49ba||0xcc;return function(_0x2a7d18){if(_0x2a7d18){return _0x1ddb6e[_0xf544('0x23')](_0x5b49ba);}return _0x1ddb6e[_0xf544('0x24')](_0x5b49ba)[_0xf544('0x25')]();};}function respondWithResult(_0x1fd5be,_0x1aa869){_0x1aa869=_0x1aa869||0xc8;return function(_0x4a1282){if(_0x4a1282){return _0x1fd5be[_0xf544('0x24')](_0x1aa869)['json'](_0x4a1282);}};}function respondWithFilteredResult(_0x3da4eb,_0x1169f8){return function(_0x2e3c4d){if(_0x2e3c4d){var _0xac0eba=typeof _0x1169f8[_0xf544('0x26')]===_0xf544('0x27')&&typeof _0x1169f8[_0xf544('0x28')]===_0xf544('0x27');var _0x1900af=_0x2e3c4d[_0xf544('0x29')];var _0x1ba3d4=_0xac0eba?0x0:_0x1169f8[_0xf544('0x26')];var _0x5c5fe6=_0xac0eba?_0x2e3c4d[_0xf544('0x29')]:_0x1169f8[_0xf544('0x26')]+_0x1169f8[_0xf544('0x28')];var _0x415c64;if(_0x5c5fe6>=_0x1900af){_0x5c5fe6=_0x1900af;_0x415c64=0xc8;}else{_0x415c64=0xce;}_0x3da4eb[_0xf544('0x24')](_0x415c64);return _0x3da4eb['set'](_0xf544('0x2a'),_0x1ba3d4+'-'+_0x5c5fe6+'/'+_0x1900af)[_0xf544('0x2b')](_0x2e3c4d);}return null;};}function patchUpdates(_0x124929){return function(_0x4177f6){try{jsonpatch['apply'](_0x4177f6,_0x124929,!![]);}catch(_0x1e54f4){return BPromise['reject'](_0x1e54f4);}return _0x4177f6[_0xf544('0x2c')]();};}function saveUpdates(_0x5a38f5,_0x2cecb1){return function(_0x1fc48f){if(_0x1fc48f){return _0x1fc48f[_0xf544('0x2d')](_0x5a38f5)['then'](function(_0x51b02f){return _0x51b02f;});}return null;};}function removeEntity(_0xbe47f,_0x4c8a0f){return function(_0x32272e){if(_0x32272e){return _0x32272e[_0xf544('0x2e')]()['then'](function(){_0xbe47f['status'](0xcc)[_0xf544('0x25')]();});}};}function handleEntityNotFound(_0xb4c403,_0x35546c){return function(_0x2597c2){if(!_0x2597c2){_0xb4c403[_0xf544('0x23')](0x194);}return _0x2597c2;};}function handleError(_0xad81f0,_0x87ab26){_0x87ab26=_0x87ab26||0x1f4;return function(_0x8e90fa){logger[_0xf544('0x1f')](_0x8e90fa[_0xf544('0x2f')]);if(_0x8e90fa[_0xf544('0x30')]){delete _0x8e90fa[_0xf544('0x30')];}_0xad81f0[_0xf544('0x24')](_0x87ab26)[_0xf544('0x31')](_0x8e90fa);};}exports[_0xf544('0x32')]=function(_0x564f25,_0x4c9ed9){var _0x54d2f7={},_0xd57a60={},_0x314057={'count':0x0,'rows':[]};var _0x315f89=_[_0xf544('0x33')](db[_0xf544('0x34')][_0xf544('0x35')],function(_0x5c057c){return{'name':_0x5c057c[_0xf544('0x36')],'type':_0x5c057c[_0xf544('0x37')][_0xf544('0x38')]};});_0xd57a60[_0xf544('0x39')]=_['map'](_0x315f89,'name');_0xd57a60['query']=_[_0xf544('0x3a')](_0x564f25[_0xf544('0x3b')]);_0xd57a60['filters']=_[_0xf544('0x3c')](_0xd57a60[_0xf544('0x39')],_0xd57a60[_0xf544('0x3b')]);_0x54d2f7[_0xf544('0x3d')]=_[_0xf544('0x3c')](_0xd57a60[_0xf544('0x39')],qs[_0xf544('0x3e')](_0x564f25['query'][_0xf544('0x3e')]));_0x54d2f7[_0xf544('0x3d')]=_0x54d2f7[_0xf544('0x3d')][_0xf544('0x3f')]?_0x54d2f7[_0xf544('0x3d')]:_0xd57a60[_0xf544('0x39')];if(!_0x564f25['query'][_0xf544('0x40')](_0xf544('0x41'))){_0x54d2f7[_0xf544('0x28')]=qs['limit'](_0x564f25[_0xf544('0x3b')][_0xf544('0x28')]);_0x54d2f7[_0xf544('0x26')]=qs[_0xf544('0x26')](_0x564f25[_0xf544('0x3b')]['offset']);}_0x54d2f7['order']=qs[_0xf544('0x42')](_0x564f25['query'][_0xf544('0x42')]);_0x54d2f7[_0xf544('0x43')]=qs[_0xf544('0x44')](_[_0xf544('0x45')](_0x564f25[_0xf544('0x3b')],_0xd57a60[_0xf544('0x44')]),_0x315f89);if(_0x564f25[_0xf544('0x3b')][_0xf544('0x46')]){_0x54d2f7['where']=_[_0xf544('0x47')](_0x54d2f7[_0xf544('0x43')],{'$or':_['map'](_0x315f89,function(_0x13ba13){if(_0x13ba13[_0xf544('0x37')]!==_0xf544('0x48')){var _0x384554={};_0x384554[_0x13ba13[_0xf544('0x30')]]={'$like':'%'+_0x564f25[_0xf544('0x3b')][_0xf544('0x46')]+'%'};return _0x384554;}})});}_0x54d2f7=_['merge']({},_0x54d2f7,_0x564f25['options']);var _0x3c1b72={'where':_0x54d2f7[_0xf544('0x43')]};return db[_0xf544('0x34')][_0xf544('0x29')](_0x3c1b72)['then'](function(_0x27f9a6){_0x314057['count']=_0x27f9a6;if(_0x564f25[_0xf544('0x3b')][_0xf544('0x49')]){_0x54d2f7[_0xf544('0x4a')]=[{'all':!![]}];}return db[_0xf544('0x34')][_0xf544('0x4b')](_0x54d2f7);})[_0xf544('0x19')](function(_0x43d1fc){_0x314057[_0xf544('0x4c')]=_0x43d1fc;return _0x314057;})[_0xf544('0x19')](respondWithFilteredResult(_0x4c9ed9,_0x54d2f7))[_0xf544('0x4d')](handleError(_0x4c9ed9,null));};exports[_0xf544('0x4e')]=function(_0x414cc6,_0x358e07){var _0x140312={'raw':![],'where':{'id':_0x414cc6['params']['id']}},_0x51dbc4={};_0x51dbc4['model']=_[_0xf544('0x3a')](db[_0xf544('0x34')]['rawAttributes']);_0x51dbc4[_0xf544('0x3b')]=_[_0xf544('0x3a')](_0x414cc6['query']);_0x51dbc4[_0xf544('0x44')]=_[_0xf544('0x3c')](_0x51dbc4[_0xf544('0x39')],_0x51dbc4[_0xf544('0x3b')]);_0x140312[_0xf544('0x3d')]=_['intersection'](_0x51dbc4['model'],qs['fields'](_0x414cc6[_0xf544('0x3b')][_0xf544('0x3e')]));_0x140312[_0xf544('0x3d')]=_0x140312['attributes']['length']?_0x140312['attributes']:_0x51dbc4[_0xf544('0x39')];if(_0x414cc6['query'][_0xf544('0x49')]){_0x140312['include']=[{'all':!![]}];}_0x140312=_[_0xf544('0x47')]({},_0x140312,_0x414cc6[_0xf544('0x4f')]);return db[_0xf544('0x34')][_0xf544('0x50')](_0x140312)[_0xf544('0x19')](handleEntityNotFound(_0x358e07,null))['then'](respondWithResult(_0x358e07,null))[_0xf544('0x4d')](handleError(_0x358e07,null));};exports[_0xf544('0x2d')]=function(_0x126410,_0x1aa897){if(_0x126410[_0xf544('0x51')]['id']){delete _0x126410[_0xf544('0x51')]['id'];}return db[_0xf544('0x34')]['find']({'where':{'id':_0x126410[_0xf544('0x52')]['id']}})[_0xf544('0x19')](handleEntityNotFound(_0x1aa897,null))[_0xf544('0x19')](saveUpdates(_0x126410['body'],null))[_0xf544('0x19')](respondWithResult(_0x1aa897,null))['catch'](handleError(_0x1aa897,null));};exports[_0xf544('0x53')]=function(_0x3dec0d,_0x3e5b6d,_0x3c6f68){if(_0x3dec0d['file']&&_0x3dec0d[_0xf544('0x54')]['filename']){_0x3dec0d[_0xf544('0x51')][_0xf544('0x55')]=_0x3dec0d[_0xf544('0x54')][_0xf544('0x56')];}return db[_0xf544('0x34')][_0xf544('0x50')]({'where':{'id':_0x3dec0d[_0xf544('0x52')]['id']}})[_0xf544('0x19')](handleEntityNotFound(_0x3e5b6d,null))[_0xf544('0x19')](saveUpdates(_0x3dec0d['body'],null))[_0xf544('0x19')](respondWithResult(_0x3e5b6d,null))['catch'](handleError(_0x3e5b6d,null));};exports[_0xf544('0x57')]=function(_0x3d5545,_0xe9742b,_0x446a6f){if(_0x3d5545[_0xf544('0x54')]&&_0x3d5545['file']['filename']){_0x3d5545[_0xf544('0x51')][_0xf544('0x58')]=_0x3d5545[_0xf544('0x54')]['filename'];}return db[_0xf544('0x34')][_0xf544('0x50')]({'where':{'id':_0x3d5545[_0xf544('0x52')]['id']}})[_0xf544('0x19')](handleEntityNotFound(_0xe9742b,null))[_0xf544('0x19')](saveUpdates(_0x3d5545[_0xf544('0x51')],null))[_0xf544('0x19')](respondWithResult(_0xe9742b,null))[_0xf544('0x4d')](handleError(_0xe9742b,null));};var utilLicense=require(_0xf544('0x15'));exports[_0xf544('0x59')]=function(_0x516efd,_0x4c43db,_0x16ebfc){var _0x3b3ab9=_0xf544('0x5a');var _0xac71e={'custom':![]};return utilLicense['getLicense']()[_0xf544('0x19')](function(_0x1e909d){if(_0x1e909d){_0xac71e=_0x1e909d;}return db['Setting'][_0xf544('0x50')]({'where':{'id':_0x516efd['params']['id']},'attributes':['logo',_0xf544('0x58'),_0xf544('0x5b'),'favicon',_0xf544('0x5c'),_0xf544('0x5d'),_0xf544('0x5e'),_0xf544('0x5f')],'raw':!![]});})[_0xf544('0x19')](handleEntityNotFound(_0x4c43db,null))[_0xf544('0x19')](function(_0x14f8a0){if(_0x14f8a0){var _0x1bb50b=_0x14f8a0[_0xf544('0x55')]&&fs['existsSync'](path[_0xf544('0x60')](config['root'],_0x3b3ab9,_[_0xf544('0x61')](_0x14f8a0[_0xf544('0x55')])))?path[_0xf544('0x60')](config[_0xf544('0x62')],_0x3b3ab9,_[_0xf544('0x61')](_0x14f8a0[_0xf544('0x55')])):path[_0xf544('0x60')](config[_0xf544('0x62')],_0x3b3ab9,_[_0xf544('0x61')](_0xf544('0x63')));var _0x572ef0=_0xf544('0x64')+_['upperFirst'](_0xf544('0x55'));if(_0x14f8a0[_0x572ef0]||!_0xac71e['custom']){_0x1bb50b=path[_0xf544('0x60')](config[_0xf544('0x62')],_0x3b3ab9,_[_0xf544('0x61')](_0xf544('0x63')));}if(!fs[_0xf544('0x65')](_0x1bb50b)){throw new db[(_0xf544('0x66'))][(_0xf544('0x67'))](_[_0xf544('0x68')](_0xf544('0x55'))+_0xf544('0x69'));}return _0x4c43db['download'](_0x1bb50b);}})[_0xf544('0x4d')](handleError(_0x4c43db,null));};var utilLicense=require(_0xf544('0x15'));exports['getLogoLogin']=function(_0x2c7b74,_0x148349,_0x1448ad){var _0x1c25ba=_0xf544('0x5a');var _0x45516e={'custom':![]};return utilLicense[_0xf544('0x6a')]()[_0xf544('0x19')](function(_0x7a3ae4){if(_0x7a3ae4){_0x45516e=_0x7a3ae4;}return db[_0xf544('0x34')][_0xf544('0x50')]({'where':{'id':_0x2c7b74[_0xf544('0x52')]['id']},'attributes':[_0xf544('0x55'),'loginLogo',_0xf544('0x5b'),_0xf544('0x6b'),_0xf544('0x5c'),_0xf544('0x5d'),'defaultPreferred',_0xf544('0x5f')],'raw':!![]});})[_0xf544('0x19')](handleEntityNotFound(_0x148349,null))['then'](function(_0xeaf58c){if(_0xeaf58c){var _0x4756c6=_0xeaf58c[_0xf544('0x58')]&&fs[_0xf544('0x65')](path[_0xf544('0x60')](config[_0xf544('0x62')],_0x1c25ba,_['toLower'](_0xeaf58c[_0xf544('0x58')])))?path['join'](config[_0xf544('0x62')],_0x1c25ba,_[_0xf544('0x61')](_0xeaf58c['loginLogo'])):path[_0xf544('0x60')](config[_0xf544('0x62')],_0x1c25ba,_[_0xf544('0x61')](_0xf544('0x6c')));var _0x4f5b99=_0xf544('0x64')+_[_0xf544('0x68')](_0xf544('0x58'));if(_0xeaf58c[_0x4f5b99]||!_0x45516e[_0xf544('0x6d')]){_0x4756c6=path[_0xf544('0x60')](config[_0xf544('0x62')],_0x1c25ba,_[_0xf544('0x61')](_0xf544('0x6c')));}if(!fs[_0xf544('0x65')](_0x4756c6)){throw new db[(_0xf544('0x66'))]['ValidationError'](_['upperFirst'](_0xf544('0x58'))+_0xf544('0x69'));}return _0x148349[_0xf544('0x6e')](_0x4756c6);}})['catch'](handleError(_0x148349,null));};exports['gdpr']=function(_0x1c7033,_0x2ab45f){return db[_0xf544('0x34')][_0xf544('0x50')]({'where':{'id':_0x1c7033[_0xf544('0x52')]['id']},'attributes':['securePassword']})[_0xf544('0x19')](respondWithResult(_0x2ab45f,null))['catch'](handleError(_0x2ab45f,null));};exports[_0xf544('0x6f')]=function(_0x2b7a9a,_0x18e76f,_0x4aba75){if(_0x2b7a9a[_0xf544('0x54')]&&_0x2b7a9a[_0xf544('0x54')][_0xf544('0x56')]){_0x2b7a9a[_0xf544('0x51')][_0xf544('0x5b')]=_0x2b7a9a[_0xf544('0x54')][_0xf544('0x56')];}return db[_0xf544('0x34')][_0xf544('0x50')]({'where':{'id':_0x2b7a9a['params']['id']}})[_0xf544('0x19')](handleEntityNotFound(_0x18e76f,null))['then'](saveUpdates(_0x2b7a9a[_0xf544('0x51')],null))['then'](respondWithResult(_0x18e76f,null))['catch'](handleError(_0x18e76f,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0xda0141,_0x35a1ff,_0xf7962f){var _0x204891=_0xf544('0x5a');var _0x41f462={'custom':![]};return utilLicense[_0xf544('0x6a')]()[_0xf544('0x19')](function(_0x34ecff){if(_0x34ecff){_0x41f462=_0x34ecff;}return db[_0xf544('0x34')]['find']({'where':{'id':_0xda0141['params']['id']},'attributes':['logo','loginLogo',_0xf544('0x5b'),_0xf544('0x6b'),'defaultLogo',_0xf544('0x5d'),_0xf544('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf544('0x19')](handleEntityNotFound(_0x35a1ff,null))['then'](function(_0xfcb69c){if(_0xfcb69c){var _0x395919=_0xfcb69c[_0xf544('0x5b')]&&fs[_0xf544('0x65')](path['join'](config[_0xf544('0x62')],_0x204891,_[_0xf544('0x61')](_0xfcb69c[_0xf544('0x5b')])))?path[_0xf544('0x60')](config[_0xf544('0x62')],_0x204891,_[_0xf544('0x61')](_0xfcb69c[_0xf544('0x5b')])):path[_0xf544('0x60')](config[_0xf544('0x62')],_0x204891,_[_0xf544('0x61')](_0xf544('0x70')));var _0xc5ef7e=_0xf544('0x64')+_['upperFirst']('preferred');if(_0xfcb69c[_0xc5ef7e]||!_0x41f462['custom']||!_0x41f462[_0xf544('0x5b')]){_0x395919=path['join'](config['root'],_0x204891,_[_0xf544('0x61')](_0xf544('0x70')));}if(!fs[_0xf544('0x65')](_0x395919)){throw new db[(_0xf544('0x66'))][(_0xf544('0x67'))](_[_0xf544('0x68')](_0xf544('0x5b'))+'\x20not\x20found');}return _0x35a1ff[_0xf544('0x6e')](_0x395919);}})[_0xf544('0x4d')](handleError(_0x35a1ff,null));};exports[_0xf544('0x71')]=function(_0xaf5808,_0x1573b1,_0x1f09ac){if(_0xaf5808[_0xf544('0x54')]&&_0xaf5808['file'][_0xf544('0x56')]){_0xaf5808['body'][_0xf544('0x6b')]=_0xaf5808[_0xf544('0x54')]['filename'];}return db['Setting'][_0xf544('0x50')]({'where':{'id':_0xaf5808[_0xf544('0x52')]['id']}})['then'](handleEntityNotFound(_0x1573b1,null))['then'](saveUpdates(_0xaf5808[_0xf544('0x51')],null))['then'](respondWithResult(_0x1573b1,null))[_0xf544('0x4d')](handleError(_0x1573b1,null));};var utilLicense=require('../../config/license/util');exports[_0xf544('0x72')]=function(_0x527576,_0xaa2abc,_0x138c0a){var _0x1e182e='server/files/images/logos';var _0x39c103={'custom':![]};return utilLicense[_0xf544('0x6a')]()['then'](function(_0x3d859d){if(_0x3d859d){_0x39c103=_0x3d859d;}return db[_0xf544('0x34')]['find']({'where':{'id':_0x527576[_0xf544('0x52')]['id']},'attributes':['logo',_0xf544('0x58'),_0xf544('0x5b'),'favicon',_0xf544('0x5c'),_0xf544('0x5d'),'defaultPreferred',_0xf544('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xaa2abc,null))[_0xf544('0x19')](function(_0x411e31){if(_0x411e31){var _0x2b5c97=_0x411e31['favicon']&&fs[_0xf544('0x65')](path[_0xf544('0x60')](config['root'],_0x1e182e,_[_0xf544('0x61')](_0x411e31[_0xf544('0x6b')])))?path['join'](config[_0xf544('0x62')],_0x1e182e,_[_0xf544('0x61')](_0x411e31[_0xf544('0x6b')])):path[_0xf544('0x60')](config[_0xf544('0x62')],_0x1e182e,_[_0xf544('0x61')](_0xf544('0x73')));var _0x1258ca=_0xf544('0x64')+_[_0xf544('0x68')](_0xf544('0x6b'));if(_0x411e31[_0x1258ca]||!_0x39c103['custom']){_0x2b5c97=path[_0xf544('0x60')](config[_0xf544('0x62')],_0x1e182e,_['toLower'](_0xf544('0x73')));}if(!fs[_0xf544('0x65')](_0x2b5c97)){throw new db['Sequelize']['ValidationError'](_[_0xf544('0x68')](_0xf544('0x6b'))+_0xf544('0x69'));}return _0xaa2abc['download'](_0x2b5c97);}})['catch'](handleError(_0xaa2abc,null));};exports[_0xf544('0x74')]=function(_0x5dd852,_0x3e2611){var _0x265863={'offset':moment()[_0xf544('0x75')]()};_0x265863[_0xf544('0x76')]=moment()[_0xf544('0x75')](_0x265863['offset'])['format'](_0xf544('0x77'));return _0x3e2611['status'](0xc8)[_0xf544('0x31')](_0x265863);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5f67d26..b3e8cc3 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x008c,0x188));var _0xc008=function(_0x408e97,_0x4b23e2){_0x408e97=_0x408e97-0x0;var _0x227b62=_0x008c[_0x408e97];return _0x227b62;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x2f8d71,_0x2773a2){var _0x3f6a12=function(_0x39d3aa){while(--_0x39d3aa){_0x2f8d71['push'](_0x2f8d71['shift']());}};_0x3f6a12(++_0x2773a2);}(_0xedd9,0xfc));var _0x9edd=function(_0x40289b,_0x4b64cb){_0x40289b=_0x40289b-0x0;var _0x1935a0=_0xedd9[_0x40289b];return _0x1935a0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index cff2508..4903864 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 _0x2430=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird'];(function(_0x7f284e,_0x44cff2){var _0x4bb31f=function(_0x1d1a67){while(--_0x1d1a67){_0x7f284e['push'](_0x7f284e['shift']());}};_0x4bb31f(++_0x44cff2);}(_0x2430,0xa1));var _0x0243=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x2430[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0x0243('0x0'));var util=require(_0x0243('0x1'));var moment=require(_0x0243('0x2'));var BPromise=require(_0x0243('0x3'));var rs=require(_0x0243('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0243('0x5'))['db'];var utils=require(_0x0243('0x6'));var logger=require(_0x0243('0x7'))('rpc');var config=require(_0x0243('0x8'));var jayson=require(_0x0243('0x9'));var client=jayson[_0x0243('0xa')][_0x0243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x153964,_0x4f388a,_0x21004c){return new BPromise(function(_0x5ad7a3,_0x358460){return client[_0x0243('0xc')](_0x153964,_0x21004c)[_0x0243('0xd')](function(_0x8ce19c){logger[_0x0243('0xe')]('Setting,\x20%s,\x20%s',_0x4f388a,_0x0243('0xf'));logger[_0x0243('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x4f388a,_0x0243('0xf'),JSON[_0x0243('0x11')](_0x8ce19c));if(_0x8ce19c[_0x0243('0x12')]){if(_0x8ce19c[_0x0243('0x12')][_0x0243('0x13')]===0x1f4){logger['error'](_0x0243('0x14'),_0x4f388a,_0x8ce19c[_0x0243('0x12')][_0x0243('0x15')]);return _0x358460(_0x8ce19c[_0x0243('0x12')][_0x0243('0x15')]);}logger[_0x0243('0x12')]('Setting,\x20%s,\x20%s',_0x4f388a,_0x8ce19c['error']['message']);return _0x5ad7a3(_0x8ce19c[_0x0243('0x12')][_0x0243('0x15')]);}else{logger[_0x0243('0xe')](_0x0243('0x14'),_0x4f388a,_0x0243('0xf'));_0x5ad7a3(_0x8ce19c['result'][_0x0243('0x15')]);}})['catch'](function(_0x401fa7){logger[_0x0243('0x12')](_0x0243('0x14'),_0x4f388a,_0x401fa7);_0x358460(_0x401fa7);});});}exports[_0x0243('0x16')]=function(_0x380ae7){var _0x4b6317=this;return new Promise(function(_0x48dee3,_0x5302c7){return db[_0x0243('0x17')][_0x0243('0x18')]({'raw':_0x380ae7[_0x0243('0x19')]?_0x380ae7[_0x0243('0x19')][_0x0243('0x1a')]===undefined?!![]:![]:!![],'where':_0x380ae7[_0x0243('0x19')]?_0x380ae7[_0x0243('0x19')][_0x0243('0x1b')]||null:null,'attributes':_0x380ae7['options']?_0x380ae7['options'][_0x0243('0x1c')]||null:null,'include':_0x380ae7[_0x0243('0x19')]?_0x380ae7[_0x0243('0x19')][_0x0243('0x1d')]?_[_0x0243('0x1e')](_0x380ae7[_0x0243('0x19')][_0x0243('0x1d')],function(_0x34d8){return{'model':db[_0x34d8['model']],'as':_0x34d8['as'],'attributes':_0x34d8['attributes'],'include':_0x34d8['include']?_[_0x0243('0x1e')](_0x34d8[_0x0243('0x1d')],function(_0x42e578){return{'model':db[_0x42e578['model']],'as':_0x42e578['as'],'attributes':_0x42e578['attributes'],'include':_0x42e578['include']?_[_0x0243('0x1e')](_0x42e578[_0x0243('0x1d')],function(_0x27c1a7){return{'model':db[_0x27c1a7[_0x0243('0x1f')]],'as':_0x27c1a7['as'],'attributes':_0x27c1a7[_0x0243('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0243('0xd')](function(_0x18744f){logger[_0x0243('0xe')](_0x0243('0x16'),_0x380ae7);logger[_0x0243('0x10')](_0x0243('0x16'),_0x380ae7,JSON['stringify'](_0x18744f));_0x48dee3(_0x18744f);})[_0x0243('0x20')](function(_0x2c7029){logger[_0x0243('0x12')](_0x0243('0x16'),_0x2c7029[_0x0243('0x15')],_0x380ae7);_0x5302c7(_0x4b6317[_0x0243('0x12')](0x1f4,_0x2c7029[_0x0243('0x15')]));});});}; \ No newline at end of file +var _0xc9b4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','Setting','options','raw','include','map','model','attributes','ShowSetting','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1eab57,_0x49cd92){var _0x2694f6=function(_0x393adc){while(--_0x393adc){_0x1eab57['push'](_0x1eab57['shift']());}};_0x2694f6(++_0x49cd92);}(_0xc9b4,0x15b));var _0x4c9b=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0xc9b4[_0x4d2993];return _0x427374;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c9b('0x0'));var BPromise=require(_0x4c9b('0x1'));var rs=require(_0x4c9b('0x2'));var fs=require('fs');var Redis=require(_0x4c9b('0x3'));var db=require(_0x4c9b('0x4'))['db'];var utils=require(_0x4c9b('0x5'));var logger=require(_0x4c9b('0x6'))(_0x4c9b('0x7'));var config=require(_0x4c9b('0x8'));var jayson=require(_0x4c9b('0x9'));var client=jayson[_0x4c9b('0xa')][_0x4c9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c024,_0x483541,_0x5b96cd){return new BPromise(function(_0x467d4,_0xb4552a){return client['request'](_0x54c024,_0x5b96cd)[_0x4c9b('0xc')](function(_0x4cd204){logger[_0x4c9b('0xd')]('Setting,\x20%s,\x20%s',_0x483541,_0x4c9b('0xe'));logger[_0x4c9b('0xf')](_0x4c9b('0x10'),_0x483541,_0x4c9b('0xe'),JSON[_0x4c9b('0x11')](_0x4cd204));if(_0x4cd204[_0x4c9b('0x12')]){if(_0x4cd204[_0x4c9b('0x12')][_0x4c9b('0x13')]===0x1f4){logger[_0x4c9b('0x12')](_0x4c9b('0x14'),_0x483541,_0x4cd204['error'][_0x4c9b('0x15')]);return _0xb4552a(_0x4cd204['error'][_0x4c9b('0x15')]);}logger[_0x4c9b('0x12')]('Setting,\x20%s,\x20%s',_0x483541,_0x4cd204[_0x4c9b('0x12')]['message']);return _0x467d4(_0x4cd204[_0x4c9b('0x12')][_0x4c9b('0x15')]);}else{logger[_0x4c9b('0xd')](_0x4c9b('0x14'),_0x483541,'request\x20sent');_0x467d4(_0x4cd204[_0x4c9b('0x16')][_0x4c9b('0x15')]);}})[_0x4c9b('0x17')](function(_0x3811d8){logger['error'](_0x4c9b('0x14'),_0x483541,_0x3811d8);_0xb4552a(_0x3811d8);});});}exports['ShowSetting']=function(_0x5ee624){var _0x1ebf63=this;return new Promise(function(_0x7f09b7,_0x5055b8){return db[_0x4c9b('0x18')]['find']({'raw':_0x5ee624[_0x4c9b('0x19')]?_0x5ee624[_0x4c9b('0x19')][_0x4c9b('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ee624['options']?_0x5ee624[_0x4c9b('0x19')]['where']||null:null,'attributes':_0x5ee624[_0x4c9b('0x19')]?_0x5ee624[_0x4c9b('0x19')]['attributes']||null:null,'include':_0x5ee624[_0x4c9b('0x19')]?_0x5ee624[_0x4c9b('0x19')][_0x4c9b('0x1b')]?_[_0x4c9b('0x1c')](_0x5ee624['options'][_0x4c9b('0x1b')],function(_0x22c856){return{'model':db[_0x22c856[_0x4c9b('0x1d')]],'as':_0x22c856['as'],'attributes':_0x22c856[_0x4c9b('0x1e')],'include':_0x22c856[_0x4c9b('0x1b')]?_['map'](_0x22c856[_0x4c9b('0x1b')],function(_0x2644b8){return{'model':db[_0x2644b8['model']],'as':_0x2644b8['as'],'attributes':_0x2644b8[_0x4c9b('0x1e')],'include':_0x2644b8[_0x4c9b('0x1b')]?_[_0x4c9b('0x1c')](_0x2644b8[_0x4c9b('0x1b')],function(_0x55a45a){return{'model':db[_0x55a45a[_0x4c9b('0x1d')]],'as':_0x55a45a['as'],'attributes':_0x55a45a[_0x4c9b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4c9b('0xc')](function(_0x551e4f){logger[_0x4c9b('0xd')](_0x4c9b('0x1f'),_0x5ee624);logger[_0x4c9b('0xf')](_0x4c9b('0x1f'),_0x5ee624,JSON['stringify'](_0x551e4f));_0x7f09b7(_0x551e4f);})['catch'](function(_0x5ef904){logger['error'](_0x4c9b('0x1f'),_0x5ef904['message'],_0x5ee624);_0x5055b8(_0x1ebf63[_0x4c9b('0x12')](0x1f4,_0x5ef904['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3e239cd..6331c89 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x1eed8a,_0x2da908){var _0x562ab8=function(_0x4c50df){while(--_0x4c50df){_0x1eed8a['push'](_0x1eed8a['shift']());}};_0x562ab8(++_0x2da908);}(_0x6aa7,0x178));var _0x76aa=function(_0x207407,_0x50c6f0){_0x207407=_0x207407-0x0;var _0x5d80ec=_0x6aa7[_0x207407];return _0x5d80ec;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1cb9,0x14e));var _0x91cb=function(_0x324d2c,_0x4a7b00){_0x324d2c=_0x324d2c-0x0;var _0x3581ec=_0x1cb9[_0x324d2c];return _0x3581ec;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 450bd0c..c1c9437 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 _0xb780=['name','generate','ENUM','skebby','connectel','clicksend','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0xb780,0xd8));var _0x0b78=function(_0x1d77b7,_0x5a4cdc){_0x1d77b7=_0x1d77b7-0x0;var _0x2ce3bc=_0xb780[_0x1d77b7];return _0x2ce3bc;};'use strict';var Sequelize=require(_0x0b78('0x0'));var rs=require(_0x0b78('0x1'));module[_0x0b78('0x2')]={'name':{'type':Sequelize[_0x0b78('0x3')],'unique':_0x0b78('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x0b78('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0b78('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0b78('0x3')],'defaultValue':function(){return rs[_0x0b78('0x5')]();}},'phone':{'type':Sequelize[_0x0b78('0x3')]},'type':{'type':Sequelize[_0x0b78('0x6')]('twilio',_0x0b78('0x7'),_0x0b78('0x8'),_0x0b78('0x9'),'plivo','clickatell','bandwidth',_0x0b78('0xa'),'infobip',_0x0b78('0xb'))},'accountSid':{'type':Sequelize[_0x0b78('0x3')]},'authId':{'type':Sequelize[_0x0b78('0x3')]},'authToken':{'type':Sequelize[_0x0b78('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x0b78('0x3')]},'password':{'type':Sequelize[_0x0b78('0x3')]},'apiKey':{'type':Sequelize[_0x0b78('0x3')]},'applicationId':{'type':Sequelize[_0x0b78('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x0b78('0x3')]},'deliveryReport':{'type':Sequelize[_0x0b78('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0b78('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0b78('0xd')],'defaultValue':function(){return _0x0b78('0xe');}},'notificationSound':{'type':Sequelize[_0x0b78('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0b78('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b78('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b78('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b78('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b78('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0b78('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b78('0xf')],'comment':_0x0b78('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x0b78('0xc')],'defaultValue':![],'comment':_0x0b78('0x11'),'set':function(_0x3dec1a){if(!_0x3dec1a)this[_0x0b78('0x12')]('mandatoryDispositionPauseId',null);this[_0x0b78('0x12')](_0x0b78('0x13'),_0x3dec1a);}}}; \ No newline at end of file +var _0x0f3d=['ENUM','BOOLEAN','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','mandatoryDisposition','STRING','name','generate','twilio','skebby','clicksend','plivo','clickatell','csc','infobip','intelepeer'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x0f3d,0x135));var _0xd0f3=function(_0x3a40d2,_0x58b6e1){_0x3a40d2=_0x3a40d2-0x0;var _0x7fd05d=_0x0f3d[_0x3a40d2];return _0x7fd05d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xd0f3('0x0')],'unique':_0xd0f3('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xd0f3('0x0')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd0f3('0x0')],'defaultValue':function(){return rs[_0xd0f3('0x2')]();}},'phone':{'type':Sequelize[_0xd0f3('0x0')]},'type':{'type':Sequelize['ENUM'](_0xd0f3('0x3'),_0xd0f3('0x4'),'connectel',_0xd0f3('0x5'),_0xd0f3('0x6'),_0xd0f3('0x7'),'bandwidth',_0xd0f3('0x8'),_0xd0f3('0x9'),_0xd0f3('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xd0f3('0x0')]},'authToken':{'type':Sequelize[_0xd0f3('0x0')]},'smsMethod':{'type':Sequelize[_0xd0f3('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd0f3('0x0')]},'password':{'type':Sequelize[_0xd0f3('0x0')]},'apiKey':{'type':Sequelize[_0xd0f3('0x0')]},'applicationId':{'type':Sequelize[_0xd0f3('0x0')]},'accountId':{'type':Sequelize[_0xd0f3('0x0')]},'senderString':{'type':Sequelize[_0xd0f3('0x0')]},'deliveryReport':{'type':Sequelize[_0xd0f3('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xd0f3('0x0')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd0f3('0xd');}},'notificationSound':{'type':Sequelize[_0xd0f3('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd0f3('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd0f3('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd0f3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd0f3('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd0f3('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xd0f3('0xc')],'defaultValue':![],'comment':_0xd0f3('0x10'),'set':function(_0x4378e6){if(!_0x4378e6)this[_0xd0f3('0x11')](_0xd0f3('0x12'),null);this[_0xd0f3('0x11')](_0xd0f3('0x13'),_0x4378e6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 104626d..560c545 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 _0x80a1=['UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','filter','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','sms','Applications','account','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','connectel','clicksend','message_id','MessageUUID','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','SmsMessage','ContactId','UserId','User','applications','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','filters','intersection','attributes','model','query','length','nolimit','order','sort','where','type','VIRTUAL','merge','options','include','findAll','rows','show','keys','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3f4fb9,_0x82cd60){var _0x1715f2=function(_0xd2e1c6){while(--_0xd2e1c6){_0x3f4fb9['push'](_0x3f4fb9['shift']());}};_0x1715f2(++_0x82cd60);}(_0x80a1,0x85));var _0x180a=function(_0x31678f,_0x4bd077){_0x31678f=_0x31678f-0x0;var _0x49d438=_0x80a1[_0x31678f];return _0x49d438;};'use strict';var emlformat=require(_0x180a('0x0'));var rimraf=require(_0x180a('0x1'));var zipdir=require(_0x180a('0x2'));var jsonpatch=require(_0x180a('0x3'));var rp=require(_0x180a('0x4'));var moment=require(_0x180a('0x5'));var BPromise=require(_0x180a('0x6'));var Mustache=require('mustache');var util=require(_0x180a('0x7'));var path=require(_0x180a('0x8'));var sox=require(_0x180a('0x9'));var csv=require(_0x180a('0xa'));var ejs=require(_0x180a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x180a('0xc'));var squel=require(_0x180a('0xd'));var crypto=require(_0x180a('0xe'));var jsforce=require(_0x180a('0xf'));var deskjs=require(_0x180a('0x10'));var toCsv=require(_0x180a('0xa'));var querystring=require(_0x180a('0x11'));var Papa=require(_0x180a('0x12'));var Redis=require(_0x180a('0x13'));var authService=require(_0x180a('0x14'));var qs=require(_0x180a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x180a('0x16'));var logger=require(_0x180a('0x17'))(_0x180a('0x18'));var utils=require(_0x180a('0x19'));var config=require(_0x180a('0x1a'));var licenseUtil=require(_0x180a('0x1b'));var db=require(_0x180a('0x1c'))['db'];config[_0x180a('0x1d')]=_[_0x180a('0x1e')](config[_0x180a('0x1d')],{'host':_0x180a('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x180a('0x20'))['register'](socket);var jayson=require(_0x180a('0x21'));var client=jayson[_0x180a('0x22')][_0x180a('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x4a4b5d,_0x56ac60,_0xbe24aa,_0x224663){return new BPromise(function(_0x1c8881,_0x33623b){var _0x2ea909=_0x224663||client;return _0x2ea909[_0x180a('0x24')](_0x4a4b5d,_0xbe24aa)[_0x180a('0x25')](function(_0x46ef16){logger[_0x180a('0x26')](_0x180a('0x27'),_0x56ac60,'request\x20sent');logger[_0x180a('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x56ac60,_0x180a('0x29'),JSON[_0x180a('0x2a')](_0x46ef16));if(_0x46ef16['error']){if(_0x46ef16['error'][_0x180a('0x2b')]===0x1f4){logger[_0x180a('0x2c')](_0x180a('0x27'),_0x56ac60,_0x46ef16[_0x180a('0x2c')][_0x180a('0x2d')]);return _0x33623b(_0x46ef16['error'][_0x180a('0x2d')]);}logger[_0x180a('0x2c')]('SmsAccount,\x20%s,\x20%s',_0x56ac60,_0x46ef16[_0x180a('0x2c')]['message']);return _0x1c8881(_0x46ef16['error'][_0x180a('0x2d')]);}else{logger[_0x180a('0x26')](_0x180a('0x27'),_0x56ac60,_0x180a('0x29'));_0x1c8881(_0x46ef16[_0x180a('0x2e')]['message']);}})[_0x180a('0x2f')](function(_0x11be8e){logger['error'](_0x180a('0x27'),_0x56ac60,_0x11be8e);_0x33623b(_0x11be8e);});});}function respondWithStatusCode(_0x210aa1,_0x42ca72){_0x42ca72=_0x42ca72||0xcc;return function(_0x1d2717){if(_0x1d2717){return _0x210aa1[_0x180a('0x30')](_0x42ca72);}return _0x210aa1[_0x180a('0x31')](_0x42ca72)[_0x180a('0x32')]();};}function respondWithResult(_0x13103d,_0x4f8c27){_0x4f8c27=_0x4f8c27||0xc8;return function(_0x271ef9){if(_0x271ef9){return _0x13103d[_0x180a('0x31')](_0x4f8c27)['json'](_0x271ef9);}};}function respondWithFilteredResult(_0x321d2a,_0x4ac298){return function(_0x4b347b){if(_0x4b347b){var _0x1c2c69=typeof _0x4ac298[_0x180a('0x33')]===_0x180a('0x34')&&typeof _0x4ac298['limit']==='undefined';var _0x77ffd0=_0x4b347b[_0x180a('0x35')];var _0x3c3ac3=_0x1c2c69?0x0:_0x4ac298[_0x180a('0x33')];var _0x246182=_0x1c2c69?_0x4b347b[_0x180a('0x35')]:_0x4ac298['offset']+_0x4ac298[_0x180a('0x36')];var _0x1049e3;if(_0x246182>=_0x77ffd0){_0x246182=_0x77ffd0;_0x1049e3=0xc8;}else{_0x1049e3=0xce;}_0x321d2a[_0x180a('0x31')](_0x1049e3);return _0x321d2a['set'](_0x180a('0x37'),_0x3c3ac3+'-'+_0x246182+'/'+_0x77ffd0)[_0x180a('0x38')](_0x4b347b);}return null;};}function patchUpdates(_0x3370b3){return function(_0x213097){try{jsonpatch['apply'](_0x213097,_0x3370b3,!![]);}catch(_0x1a8583){return BPromise[_0x180a('0x39')](_0x1a8583);}return _0x213097[_0x180a('0x3a')]();};}function saveUpdates(_0x52d65c,_0x4f4da1){return function(_0xc93550){if(_0xc93550){return _0xc93550['update'](_0x52d65c)['then'](function(_0x5b2de1){return _0x5b2de1;});}return null;};}function removeEntity(_0x33c699,_0x52d1ca){return function(_0x4ab3e4){if(_0x4ab3e4){return _0x4ab3e4[_0x180a('0x3b')]()[_0x180a('0x25')](function(){var _0x525563=_0x4ab3e4[_0x180a('0x3c')]({'plain':!![]});var _0x104783=_0x180a('0x3d');return db[_0x180a('0x3e')]['destroy']({'where':{'type':_0x104783,'resourceId':_0x525563['id']}})[_0x180a('0x25')](function(){return _0x4ab3e4;});})[_0x180a('0x25')](function(){_0x33c699[_0x180a('0x31')](0xcc)[_0x180a('0x32')]();});}};}function handleEntityNotFound(_0x40897b,_0x298aff){return function(_0x187c39){if(!_0x187c39){_0x40897b[_0x180a('0x30')](0x194);}return _0x187c39;};}function handleError(_0x463491,_0x1cbab5){_0x1cbab5=_0x1cbab5||0x1f4;return function(_0x147e5d){logger['error'](_0x147e5d[_0x180a('0x3f')]);if(_0x147e5d[_0x180a('0x40')]){delete _0x147e5d[_0x180a('0x40')];}_0x463491[_0x180a('0x31')](_0x1cbab5)[_0x180a('0x41')](_0x147e5d);};}exports[_0x180a('0x42')]=function(_0x20fa1b,_0x481e6e){var _0x1ed180={'include':[{'model':db[_0x180a('0x43')],'as':_0x180a('0x44')}]},_0x2009fc={},_0x1f1d7f={'count':0x0,'rows':[]};var _0x58a7dc=_[_0x180a('0x45')](db[_0x180a('0x46')][_0x180a('0x47')],function(_0x486e73){return{'name':_0x486e73[_0x180a('0x48')],'type':_0x486e73['type']['key']};});_0x2009fc['model']=_[_0x180a('0x45')](_0x58a7dc,'name');_0x2009fc['query']=_['keys'](_0x20fa1b['query']);_0x2009fc[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x2009fc['model'],_0x2009fc['query']);_0x1ed180[_0x180a('0x4b')]=_[_0x180a('0x4a')](_0x2009fc[_0x180a('0x4c')],qs['fields'](_0x20fa1b[_0x180a('0x4d')]['fields']));_0x1ed180[_0x180a('0x4b')]=_0x1ed180[_0x180a('0x4b')][_0x180a('0x4e')]?_0x1ed180[_0x180a('0x4b')]:_0x2009fc[_0x180a('0x4c')];if(!_0x20fa1b['query']['hasOwnProperty'](_0x180a('0x4f'))){_0x1ed180[_0x180a('0x36')]=qs[_0x180a('0x36')](_0x20fa1b[_0x180a('0x4d')][_0x180a('0x36')]);_0x1ed180[_0x180a('0x33')]=qs[_0x180a('0x33')](_0x20fa1b[_0x180a('0x4d')][_0x180a('0x33')]);}_0x1ed180[_0x180a('0x50')]=qs[_0x180a('0x51')](_0x20fa1b[_0x180a('0x4d')][_0x180a('0x51')]);_0x1ed180[_0x180a('0x52')]=qs[_0x180a('0x49')](_['pick'](_0x20fa1b[_0x180a('0x4d')],_0x2009fc[_0x180a('0x49')]),_0x58a7dc);if(_0x20fa1b[_0x180a('0x4d')]['filter']){_0x1ed180[_0x180a('0x52')]=_['merge'](_0x1ed180[_0x180a('0x52')],{'$or':_[_0x180a('0x45')](_0x58a7dc,function(_0x29f533){if(_0x29f533[_0x180a('0x53')]!==_0x180a('0x54')){var _0x18d798={};_0x18d798[_0x29f533[_0x180a('0x40')]]={'$like':'%'+_0x20fa1b['query']['filter']+'%'};return _0x18d798;}})});}_0x1ed180=_[_0x180a('0x55')]({},_0x1ed180,_0x20fa1b[_0x180a('0x56')]);var _0x38985b={'where':_0x1ed180[_0x180a('0x52')]};return db[_0x180a('0x46')]['count'](_0x38985b)[_0x180a('0x25')](function(_0x561d58){_0x1f1d7f['count']=_0x561d58;if(_0x20fa1b[_0x180a('0x4d')]['includeAll']){_0x1ed180[_0x180a('0x57')]=[{'all':!![]}];}return db[_0x180a('0x46')][_0x180a('0x58')](_0x1ed180);})[_0x180a('0x25')](function(_0x2514c7){_0x1f1d7f[_0x180a('0x59')]=_0x2514c7;return _0x1f1d7f;})['then'](respondWithFilteredResult(_0x481e6e,_0x1ed180))[_0x180a('0x2f')](handleError(_0x481e6e,null));};exports[_0x180a('0x5a')]=function(_0x23c5d4,_0x16744c){var _0x54478b={'raw':![],'where':{'id':_0x23c5d4['params']['id']},'include':[{'model':db['Pause'],'as':_0x180a('0x44')}]},_0x240b50={};_0x240b50['model']=_[_0x180a('0x5b')](db[_0x180a('0x46')][_0x180a('0x47')]);_0x240b50['query']=_[_0x180a('0x5b')](_0x23c5d4[_0x180a('0x4d')]);_0x240b50[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x240b50['model'],_0x240b50[_0x180a('0x4d')]);_0x54478b[_0x180a('0x4b')]=_[_0x180a('0x4a')](_0x240b50[_0x180a('0x4c')],qs[_0x180a('0x5c')](_0x23c5d4['query'][_0x180a('0x5c')]));_0x54478b[_0x180a('0x4b')]=_0x54478b[_0x180a('0x4b')][_0x180a('0x4e')]?_0x54478b[_0x180a('0x4b')]:_0x240b50[_0x180a('0x4c')];if(_0x23c5d4[_0x180a('0x4d')][_0x180a('0x5d')]){_0x54478b[_0x180a('0x57')]=[{'all':!![]}];}_0x54478b=_[_0x180a('0x55')]({},_0x54478b,_0x23c5d4['options']);return db[_0x180a('0x46')][_0x180a('0x5e')](_0x54478b)[_0x180a('0x25')](handleEntityNotFound(_0x16744c,null))['then'](respondWithResult(_0x16744c,null))[_0x180a('0x2f')](handleError(_0x16744c,null));};exports[_0x180a('0x5f')]=function(_0x2ee02c,_0x289c9b){return db[_0x180a('0x46')][_0x180a('0x5f')](_0x2ee02c[_0x180a('0x60')],{})['then'](function(_0x50d4d3){var _0x2897fd=_0x2ee02c[_0x180a('0x61')][_0x180a('0x3c')]({'plain':!![]});if(!_0x2897fd)throw new Error(_0x180a('0x62'));if(_0x2897fd[_0x180a('0x63')]==='user'){var _0x3bd022=_0x50d4d3[_0x180a('0x3c')]({'plain':!![]});var _0x23c4d0=_0x180a('0x3d');return db[_0x180a('0x64')]['find']({'where':{'name':_0x23c4d0,'userProfileId':_0x2897fd['userProfileId']},'raw':!![]})[_0x180a('0x25')](function(_0x3ee0b3){if(_0x3ee0b3&&_0x3ee0b3['autoAssociation']===0x0){return db[_0x180a('0x3e')][_0x180a('0x5f')]({'name':_0x3bd022[_0x180a('0x40')],'resourceId':_0x3bd022['id'],'type':_0x3ee0b3['name'],'sectionId':_0x3ee0b3['id']},{})[_0x180a('0x25')](function(){return _0x50d4d3;});}else{return _0x50d4d3;}})[_0x180a('0x2f')](function(_0x2dbbf3){logger[_0x180a('0x2c')](_0x180a('0x65'),_0x2dbbf3);throw _0x2dbbf3;});}return _0x50d4d3;})[_0x180a('0x25')](respondWithResult(_0x289c9b,0xc9))['catch'](handleError(_0x289c9b,null));};exports[_0x180a('0x66')]=function(_0x148070,_0x548656){if(_0x148070[_0x180a('0x60')]['id']){delete _0x148070['body']['id'];}return db['SmsAccount'][_0x180a('0x5e')]({'where':{'id':_0x148070[_0x180a('0x67')]['id']},'include':[{'model':db[_0x180a('0x43')],'as':_0x180a('0x44')}]})['then'](handleEntityNotFound(_0x548656,null))[_0x180a('0x25')](saveUpdates(_0x148070[_0x180a('0x60')],null))['then'](respondWithResult(_0x548656,null))[_0x180a('0x2f')](handleError(_0x548656,null));};exports[_0x180a('0x3b')]=function(_0x46bff1,_0xbc33e3){return db['SmsAccount'][_0x180a('0x5e')]({'where':{'id':_0x46bff1[_0x180a('0x67')]['id']}})['then'](handleEntityNotFound(_0xbc33e3,null))[_0x180a('0x25')](removeEntity(_0xbc33e3,null))[_0x180a('0x2f')](handleError(_0xbc33e3,null));};exports['describe']=function(_0x183623,_0xb6b021){return db[_0x180a('0x46')]['describe']()['then'](respondWithResult(_0xb6b021,null))[_0x180a('0x2f')](handleError(_0xb6b021,null));};exports[_0x180a('0x68')]=function(_0x31233d,_0x22e9e9,_0x170921){if(_0x31233d[_0x180a('0x60')]['id']){delete _0x31233d['body']['id'];}return db['SmsAccount'][_0x180a('0x5e')]({'where':{'id':_0x31233d[_0x180a('0x67')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x22e9e9,null))[_0x180a('0x25')](function(_0x3af0e9){if(_0x3af0e9){_0x31233d[_0x180a('0x60')][_0x180a('0x69')]=_0x3af0e9['id'];return db[_0x180a('0x6a')][_0x180a('0x5f')](_0x31233d[_0x180a('0x60')]);}})[_0x180a('0x25')](respondWithResult(_0x22e9e9,null))[_0x180a('0x2f')](handleError(_0x22e9e9,null));};exports[_0x180a('0x6b')]=function(_0x1b07e6,_0x11eacd,_0x1566ef){var _0x2280c4={'raw':![],'where':{}};var _0x3cbcd6={};var _0x242086={'count':0x0,'rows':[]};return db[_0x180a('0x46')][_0x180a('0x6c')]({'where':{'id':_0x1b07e6['params']['id']}})['then'](handleEntityNotFound(_0x11eacd,null))[_0x180a('0x25')](function(_0x1050b3){if(_0x1050b3){_0x3cbcd6['model']=_[_0x180a('0x5b')](db[_0x180a('0x6a')][_0x180a('0x47')]);_0x3cbcd6['query']=_['keys'](_0x1b07e6['query']);_0x3cbcd6[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x3cbcd6['model'],_0x3cbcd6[_0x180a('0x4d')]);_0x2280c4[_0x180a('0x4b')]=_[_0x180a('0x4a')](_0x3cbcd6[_0x180a('0x4c')],qs[_0x180a('0x5c')](_0x1b07e6['query'][_0x180a('0x5c')]));_0x2280c4[_0x180a('0x4b')]=_0x2280c4[_0x180a('0x4b')][_0x180a('0x4e')]?_0x2280c4[_0x180a('0x4b')]:_0x3cbcd6['model'];if(!_0x1b07e6[_0x180a('0x4d')][_0x180a('0x6d')](_0x180a('0x4f'))){_0x2280c4['limit']=qs['limit'](_0x1b07e6[_0x180a('0x4d')][_0x180a('0x36')]);_0x2280c4[_0x180a('0x33')]=qs[_0x180a('0x33')](_0x1b07e6['query'][_0x180a('0x33')]);}_0x2280c4[_0x180a('0x50')]=qs[_0x180a('0x51')](_0x1b07e6[_0x180a('0x4d')][_0x180a('0x51')]);_0x2280c4[_0x180a('0x52')]=qs[_0x180a('0x49')](_['pick'](_0x1b07e6['query'],_0x3cbcd6[_0x180a('0x49')]));_0x2280c4[_0x180a('0x52')][_0x180a('0x69')]=_0x1050b3['id'];if(_0x1b07e6[_0x180a('0x4d')][_0x180a('0x6e')]){_0x2280c4['where']=_[_0x180a('0x55')](_0x2280c4[_0x180a('0x52')],{'$or':_[_0x180a('0x45')](_0x2280c4[_0x180a('0x4b')],function(_0x4576fe){var _0x3079e8={};_0x3079e8[_0x4576fe]={'$like':'%'+_0x1b07e6[_0x180a('0x4d')]['filter']+'%'};return _0x3079e8;})});}_0x2280c4=_[_0x180a('0x55')]({},_0x2280c4,_0x1b07e6['options']);return db[_0x180a('0x6a')]['count']({'where':_0x2280c4['where']})[_0x180a('0x25')](function(_0x40e280){_0x242086[_0x180a('0x35')]=_0x40e280;if(_0x1b07e6[_0x180a('0x4d')][_0x180a('0x5d')]){_0x2280c4[_0x180a('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x180a('0x58')](_0x2280c4);})[_0x180a('0x25')](function(_0x3792f5){_0x242086[_0x180a('0x59')]=_0x3792f5;return _0x242086;});}})[_0x180a('0x25')](respondWithFilteredResult(_0x11eacd,_0x2280c4))[_0x180a('0x2f')](handleError(_0x11eacd,null));};exports[_0x180a('0x6f')]=function(_0x68e938,_0x226168,_0x3c01db){return db['SmsAccount'][_0x180a('0x5e')]({'where':{'id':_0x68e938['params']['id']}})['then'](handleEntityNotFound(_0x226168,null))[_0x180a('0x25')](function(_0x3b77fc){if(_0x3b77fc){return _0x3b77fc[_0x180a('0x6f')](_0x68e938[_0x180a('0x4d')][_0x180a('0x70')]);}})[_0x180a('0x25')](respondWithStatusCode(_0x226168,null))['catch'](handleError(_0x226168,null));};exports[_0x180a('0x71')]=function(_0x3d8205,_0x4029c5,_0x3fcb40){if(_0x3d8205[_0x180a('0x60')]['id']){delete _0x3d8205['body']['id'];}return db[_0x180a('0x46')][_0x180a('0x5e')]({'where':{'id':_0x3d8205[_0x180a('0x67')]['id']}})['then'](handleEntityNotFound(_0x4029c5,null))[_0x180a('0x25')](function(_0xd7ee81){if(_0xd7ee81){_0x3d8205['body'][_0x180a('0x69')]=_0xd7ee81['id'];return db['CannedAnswer'][_0x180a('0x5f')](_0x3d8205[_0x180a('0x60')]);}})[_0x180a('0x25')](respondWithResult(_0x4029c5,null))[_0x180a('0x2f')](handleError(_0x4029c5,null));};exports['getAnswers']=function(_0x34fc67,_0x3cf1bb,_0x52c11b){var _0x51d966={'raw':![],'where':{}};var _0x536223={};var _0x25dba6={'count':0x0,'rows':[]};return db[_0x180a('0x46')][_0x180a('0x6c')]({'where':{'id':_0x34fc67['params']['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x3cf1bb,null))[_0x180a('0x25')](function(_0x383461){if(_0x383461){_0x536223[_0x180a('0x4c')]=_[_0x180a('0x5b')](db[_0x180a('0x72')][_0x180a('0x47')]);_0x536223[_0x180a('0x4d')]=_[_0x180a('0x5b')](_0x34fc67[_0x180a('0x4d')]);_0x536223[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x536223[_0x180a('0x4c')],_0x536223[_0x180a('0x4d')]);_0x51d966[_0x180a('0x4b')]=_[_0x180a('0x4a')](_0x536223['model'],qs['fields'](_0x34fc67[_0x180a('0x4d')][_0x180a('0x5c')]));_0x51d966['attributes']=_0x51d966['attributes']['length']?_0x51d966[_0x180a('0x4b')]:_0x536223[_0x180a('0x4c')];if(!_0x34fc67[_0x180a('0x4d')]['hasOwnProperty'](_0x180a('0x4f'))){_0x51d966[_0x180a('0x36')]=qs[_0x180a('0x36')](_0x34fc67['query']['limit']);_0x51d966['offset']=qs[_0x180a('0x33')](_0x34fc67[_0x180a('0x4d')]['offset']);}_0x51d966[_0x180a('0x50')]=qs[_0x180a('0x51')](_0x34fc67[_0x180a('0x4d')][_0x180a('0x51')]);_0x51d966[_0x180a('0x52')]=qs[_0x180a('0x49')](_[_0x180a('0x73')](_0x34fc67[_0x180a('0x4d')],_0x536223[_0x180a('0x49')]));_0x51d966[_0x180a('0x52')][_0x180a('0x69')]=_0x383461['id'];if(_0x34fc67[_0x180a('0x4d')]['filter']){_0x51d966['where']=_[_0x180a('0x55')](_0x51d966[_0x180a('0x52')],{'$or':_['map'](_0x51d966[_0x180a('0x4b')],function(_0x28b311){var _0x850bc2={};_0x850bc2[_0x28b311]={'$like':'%'+_0x34fc67[_0x180a('0x4d')][_0x180a('0x6e')]+'%'};return _0x850bc2;})});}_0x51d966=_[_0x180a('0x55')]({},_0x51d966,_0x34fc67[_0x180a('0x56')]);return db[_0x180a('0x72')][_0x180a('0x35')]({'where':_0x51d966[_0x180a('0x52')]})['then'](function(_0x5e9329){_0x25dba6['count']=_0x5e9329;if(_0x34fc67[_0x180a('0x4d')][_0x180a('0x5d')]){_0x51d966['include']=[{'all':!![]}];}return db[_0x180a('0x72')][_0x180a('0x58')](_0x51d966);})[_0x180a('0x25')](function(_0x3a1f46){_0x25dba6[_0x180a('0x59')]=_0x3a1f46;return _0x25dba6;});}})['then'](respondWithFilteredResult(_0x3cf1bb,_0x51d966))[_0x180a('0x2f')](handleError(_0x3cf1bb,null));};exports['removeAnswers']=function(_0x5dd9b0,_0x160486,_0x509134){return db[_0x180a('0x46')][_0x180a('0x5e')]({'where':{'id':_0x5dd9b0[_0x180a('0x67')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x160486,null))[_0x180a('0x25')](function(_0x34e421){if(_0x34e421){return _0x34e421[_0x180a('0x74')](_0x5dd9b0[_0x180a('0x4d')][_0x180a('0x70')]);}})[_0x180a('0x25')](respondWithStatusCode(_0x160486,null))['catch'](handleError(_0x160486,null));};exports['notify']=function(_0xea0fc8,_0x2b5740,_0x3d8d39){var _0xc41492={'channel':_0x180a('0x75')};var _0x2a195d=[];var _0x5552b9=[];var _0x11ca90={};return db['SmsAccount'][_0x180a('0x5e')]({'where':{'id':_0xea0fc8[_0x180a('0x67')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x180a('0x76')}]})[_0x180a('0x25')](handleEntityNotFound(_0x2b5740,null))[_0x180a('0x25')](function(_0x436c8a){_0xc41492[_0x180a('0x77')]=_0x436c8a;_0xc41492['applications']=_[_0x180a('0x78')](_0x436c8a[_0x180a('0x76')],[_0x180a('0x79')],[_0x180a('0x7a')]);if(_0xc41492[_0x180a('0x77')]['Applications']){delete _0xc41492[_0x180a('0x77')][_0x180a('0x76')];}return db[_0x180a('0x7b')]['describe']();})[_0x180a('0x25')](function(_0x392cfb){if(!_0x392cfb){throw new db[(_0x180a('0x7c'))]['ValidationError'](_0x180a('0x7d'));}_0x2a195d=_[_0x180a('0x7e')](_[_0x180a('0x5b')](_0x392cfb),[_0x180a('0x7f'),_0x180a('0x80')]);_0x5552b9=_[_0x180a('0x7e')](_[_0x180a('0x5b')](_0x392cfb),['createdAt',_0x180a('0x80'),_0x180a('0x81'),_0x180a('0x82')]);_0xc41492[_0x180a('0x60')]={'mapKey':_0x180a('0x83')};if(_0xc41492['account'][_0x180a('0x53')]){switch(_0xc41492[_0x180a('0x77')][_0x180a('0x53')]){case _0x180a('0x84'):_0xc41492['body'][_0x180a('0x85')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x86')];_0xc41492[_0x180a('0x60')]['body']=_0xea0fc8['body'][_0x180a('0x87')];_0xc41492[_0x180a('0x60')][_0x180a('0x88')]=_0xea0fc8[_0x180a('0x60')]['MessageSid'];break;case _0x180a('0x89'):_0xc41492[_0x180a('0x60')][_0x180a('0x85')]='+'+_0xea0fc8[_0x180a('0x60')][_0x180a('0x8a')];_0xc41492[_0x180a('0x60')][_0x180a('0x60')]=_0xea0fc8['body']['text'];break;case _0x180a('0x8b'):_0xc41492[_0x180a('0x60')]['from']=_0xea0fc8[_0x180a('0x60')]['from'];_0xc41492[_0x180a('0x60')]['body']=_0xea0fc8[_0x180a('0x60')][_0x180a('0x2d')];break;case _0x180a('0x8c'):_0xc41492[_0x180a('0x60')]['from']=_0xea0fc8[_0x180a('0x60')][_0x180a('0x85')];_0xc41492[_0x180a('0x60')]['body']=_0xea0fc8['body']['body'];_0xc41492[_0x180a('0x60')][_0x180a('0x88')]=_0xea0fc8['body'][_0x180a('0x8d')];break;case'plivo':_0xc41492['body']['from']=_0xea0fc8[_0x180a('0x60')][_0x180a('0x86')];_0xc41492[_0x180a('0x60')][_0x180a('0x60')]=_0xea0fc8[_0x180a('0x60')]['Text'];_0xc41492['body'][_0x180a('0x88')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x8e')];break;case'infobip':_0xc41492['body'][_0x180a('0x85')]='+'+_0xea0fc8['body']['results'][0x0][_0x180a('0x85')];_0xc41492[_0x180a('0x60')][_0x180a('0x60')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x8f')][0x0][_0x180a('0x90')];_0xc41492[_0x180a('0x60')][_0x180a('0x88')]=_0xea0fc8[_0x180a('0x60')]['results'][0x0]['messageId'];break;case _0x180a('0x91'):_0xc41492[_0x180a('0x60')][_0x180a('0x85')]=_0xea0fc8['body'][_0x180a('0x92')];_0xc41492[_0x180a('0x60')][_0x180a('0x60')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x93')]['message'];break;case _0x180a('0x94'):_0xc41492[_0x180a('0x60')][_0x180a('0x85')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x95')];_0xc41492['body'][_0x180a('0x60')]=_0xea0fc8[_0x180a('0x60')]['text'];_0xc41492[_0x180a('0x60')][_0x180a('0x88')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x96')];break;case _0x180a('0x97'):_0xc41492['body'][_0x180a('0x88')]=_0xea0fc8[_0x180a('0x60')][0x0][_0x180a('0x2d')]['id'];_0xc41492[_0x180a('0x60')][_0x180a('0x85')]=_0xea0fc8[_0x180a('0x60')][0x0]['message'][_0x180a('0x85')];_0xc41492['body']['body']=_0xea0fc8[_0x180a('0x60')][0x0][_0x180a('0x2d')][_0x180a('0x90')];break;case _0x180a('0x98'):_0xc41492[_0x180a('0x60')][_0x180a('0x85')]=_0xea0fc8[_0x180a('0x60')][_0x180a('0x85')];_0xc41492[_0x180a('0x60')][_0x180a('0x60')]=_0xea0fc8[_0x180a('0x60')]['message'];_0xc41492[_0x180a('0x60')][_0x180a('0x88')]=_0xea0fc8[_0x180a('0x60')]['refid'];break;}}if(_0xc41492[_0x180a('0x60')]['id']){delete _0xc41492[_0x180a('0x60')]['id'];}if(_['isNil'](_0xc41492[_0x180a('0x60')]['from'])){throw new db[(_0x180a('0x7c'))][(_0x180a('0x99'))]('from\x20is\x20mandatory');}if(_[_0x180a('0x9a')](_0xc41492[_0x180a('0x60')]['body'])||_0xc41492['body'][_0x180a('0x60')]===''){throw new db[(_0x180a('0x7c'))][(_0x180a('0x99'))](_0x180a('0x9b'));}if(_[_0x180a('0x9a')](_0xc41492[_0x180a('0x60')][_0x180a('0x9c')])){throw new db['Sequelize'][(_0x180a('0x99'))](_0x180a('0x9d')+_0x5552b9);}if(!_[_0x180a('0x9e')](_0x5552b9,_0xc41492[_0x180a('0x60')][_0x180a('0x9c')])){throw new db['Sequelize'][(_0x180a('0x99'))](_0x180a('0x9f')+_0x5552b9);}_0x11ca90[_0xc41492['body'][_0x180a('0x9c')]]=_0xc41492[_0x180a('0x60')][_0x180a('0x85')];return db[_0x180a('0xa0')][_0x180a('0x5e')]({'where':{'id':_0xc41492[_0x180a('0x77')][_0x180a('0x82')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x11ca90,'limit':0x1,'order':[['updatedAt',_0x180a('0xa1')]]}]});})[_0x180a('0x25')](handleEntityNotFound(_0x2b5740,null))[_0x180a('0x25')](function(_0x1ceca4){if(_0x1ceca4){_0xc41492[_0x180a('0xa2')]=_['omit'](_0x1ceca4,['Contacts']);if(_0x1ceca4[_0x180a('0xa3')][_0x180a('0x4e')]){return _0x1ceca4[_0x180a('0xa3')][0x0];}var _0x47eef1=_['defaults'](_0xc41492[_0x180a('0x60')],{'firstName':_0xc41492[_0x180a('0x60')][_0x180a('0x85')],'ListId':_0x1ceca4['id']});_0x47eef1[_0xc41492['body'][_0x180a('0x9c')]]=_0xc41492[_0x180a('0x60')][_0x180a('0x85')];return db[_0x180a('0x7b')][_0x180a('0x5f')](_0x47eef1,{'fields':_0x2a195d,'raw':!![]});}})[_0x180a('0x25')](handleEntityNotFound(_0x2b5740,null))[_0x180a('0x25')](function(_0x2de42d){if(_0x2de42d){_0xc41492[_0x180a('0xa4')]=_0x2de42d;var _0x5373af={'ContactId':_0x2de42d['id'],'phone':_0xc41492[_0x180a('0x60')]['from'],'SmsAccountId':_0xea0fc8[_0x180a('0x67')]['id']};var _0x2a581f={'ContactId':_0x2de42d['id'],'SmsAccountId':_0xea0fc8[_0x180a('0x67')]['id'],'closed':![]};return db[_0x180a('0xa5')]['find']({'where':_0x2a581f})[_0x180a('0x25')](function(_0x5db14f){if(_0x5db14f){return[_0x5db14f,![]];}return db[_0x180a('0xa5')][_0x180a('0x5f')](_0x5373af)[_0x180a('0x25')](function(_0x1efcbb){return[_0x1efcbb,!![]];});});}})[_0x180a('0xa6')](function(_0x18e651,_0x2ad829){_0xc41492['interaction']=_0x18e651[_0x180a('0x3c')]({'plain':!![]});_0xc41492[_0x180a('0xa7')][_0x180a('0xa8')]=![];if(_0x2ad829){if(_0xc41492[_0x180a('0x77')][_0x180a('0xa9')]){_0xc41492['applications'][_0x180a('0xaa')]({'id':0x0,'priority':_0xc41492['applications'][_0x180a('0x4e')]+0x1,'app':_0x180a('0xab'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0xc41492[_0x180a('0xa7')][_0x180a('0xa8')]=!![];}return db[_0x180a('0xac')][_0x180a('0x5f')]({'phone':_0xc41492[_0x180a('0x60')][_0x180a('0x85')],'messageId':_0xc41492[_0x180a('0x60')]['messageId'],'body':_0xc41492['body'][_0x180a('0x60')],'SmsAccountId':_0xea0fc8[_0x180a('0x67')]['id'],'SmsInteractionId':_0x18e651['id'],'direction':'in','ContactId':_0x18e651[_0x180a('0xad')],'AttachmentId':_0xc41492[_0x180a('0x60')]['AttachmentId']});})[_0x180a('0x25')](function(_0x44bd32){_0xc41492[_0x180a('0x2d')]=_0x44bd32;if(_0xc41492['interaction'][_0x180a('0xae')]){return db[_0x180a('0xaf')][_0x180a('0x5e')]({'attributes':['id',_0x180a('0x40')],'where':{'id':_0xc41492[_0x180a('0xa7')][_0x180a('0xae')]}})[_0x180a('0x25')](function(_0x489e01){if(_0x489e01){_0xc41492[_0x180a('0xb0')][_0x180a('0xb1')]({'id':0x0,'priority':0x0,'app':_0x180a('0xb2'),'appdata':_0x489e01[_0x180a('0x40')]+','+(_0xc41492[_0x180a('0x77')][_0x180a('0xb3')]||0xa),'interval':_0x180a('0xb4')});}return respondWithRpcPromise(_0x180a('0xb5'),_0x180a('0xb6'),_0xc41492);});}return respondWithRpcPromise(_0x180a('0xb5'),'startRouting',_0xc41492);})[_0x180a('0x25')](function(_0x2f9a38){if(_0x2f9a38){var _0x15af09=0xc8;var _0x2cf6ed='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2cf6ed,_0x15af09,_0x180a('0xb7'));logger[_0x180a('0x28')](_0x180a('0xb8'),_0x2cf6ed,_0x15af09,_0x180a('0xb7'),JSON[_0x180a('0x2a')](_0x2f9a38));if(_0xc41492['account'][_0x180a('0x53')]===_0x180a('0x84')){return _0x2b5740[_0x180a('0x31')](_0x15af09)[_0x180a('0xb9')](_0x180a('0xba'),_0x180a('0xbb'))[_0x180a('0x41')](_0x180a('0xbc'));}else{return _0x2b5740[_0x180a('0x31')](_0x15af09)[_0x180a('0x38')](_0x2f9a38);}}})[_0x180a('0x2f')](handleError(_0x2b5740,null));};exports[_0x180a('0xbd')]=function(_0x42780d,_0xdfda7){var _0x478d4f=_0x42780d[_0x180a('0x67')]['id'];var _0x58d769=_0x42780d['body'];var _0xe5adf8=0xc8;var _0x40f56f=null;return db[_0x180a('0xbe')]['transaction']({'isolationLevel':db[_0x180a('0xbe')]['Transaction'][_0x180a('0xbf')][_0x180a('0xc0')]},function(_0xa94445){return db[_0x180a('0x46')][_0x180a('0x6c')]({'where':{'id':_0x478d4f},'transaction':_0xa94445})[_0x180a('0x25')](function(_0x2a6dd0){if(_0x2a6dd0){return db[_0x180a('0xc1')]['destroy']({'where':{'SmsAccountId':_0x478d4f},'transaction':_0xa94445})[_0x180a('0x25')](function(){var _0x115225=_[_0x180a('0x45')](_0x58d769,function(_0x4c4f27){_0x4c4f27['SmsAccountId']=_0x478d4f;return _0x4c4f27;});return db['SmsApplication'][_0x180a('0xc2')](_0x115225,{'transaction':_0xa94445});});}else{_0xe5adf8=0x194;_0x40f56f=[];}});})['then'](function(){if(_0xe5adf8!==0x194){return db[_0x180a('0xc1')]['findAndCountAll']({'where':{'SmsAccountId':_0x478d4f},'order':_0x180a('0x79')})[_0x180a('0x25')](function(_0x3e15ff){_0x40f56f=_0x3e15ff;});}})['catch'](function(_0x2899b4){_0xe5adf8=0x1f4;logger['error'](_0x2899b4[_0x180a('0x3f')]);if(_0x2899b4[_0x180a('0x40')]){delete _0x2899b4['name'];}_0x40f56f=_0x2899b4;})[_0x180a('0xc3')](function(){if(_0x40f56f===null){_0xdfda7[_0x180a('0x30')](_0xe5adf8);}else{if(_0xe5adf8===0x1f4){_0xdfda7[_0x180a('0x31')](_0xe5adf8)[_0x180a('0x41')](_0x40f56f);}else{_0xdfda7[_0x180a('0x31')](_0xe5adf8)['json'](_0x40f56f);}}});};exports[_0x180a('0xc4')]=function(_0x15fcda,_0x3032ae,_0xb65461){var _0x278287={};var _0x4841ed={};var _0x2866de;var _0x168cc3;return db[_0x180a('0x46')][_0x180a('0x6c')]({'where':{'id':_0x15fcda[_0x180a('0x67')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x3032ae,null))['then'](function(_0x743f93){if(_0x743f93){_0x2866de=_0x743f93;_0x4841ed[_0x180a('0x4c')]=_[_0x180a('0x5b')](db[_0x180a('0xc1')][_0x180a('0x47')]);_0x4841ed['query']=_[_0x180a('0x5b')](_0x15fcda[_0x180a('0x4d')]);_0x4841ed[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x4841ed[_0x180a('0x4c')],_0x4841ed[_0x180a('0x4d')]);_0x278287[_0x180a('0x4b')]=_[_0x180a('0x4a')](_0x4841ed[_0x180a('0x4c')],qs[_0x180a('0x5c')](_0x15fcda[_0x180a('0x4d')][_0x180a('0x5c')]));_0x278287['attributes']=_0x278287[_0x180a('0x4b')][_0x180a('0x4e')]?_0x278287[_0x180a('0x4b')]:_0x4841ed[_0x180a('0x4c')];_0x278287[_0x180a('0x50')]=qs[_0x180a('0x51')](_0x15fcda[_0x180a('0x4d')][_0x180a('0x51')]);_0x278287[_0x180a('0x52')]=qs[_0x180a('0x49')](_[_0x180a('0x73')](_0x15fcda[_0x180a('0x4d')],_0x4841ed[_0x180a('0x49')]));if(_0x15fcda['query']['filter']){_0x278287[_0x180a('0x52')]=_[_0x180a('0x55')](_0x278287[_0x180a('0x52')],{'$or':_['map'](_0x278287[_0x180a('0x4b')],function(_0x305f55){var _0x61e80d={};_0x61e80d[_0x305f55]={'$like':'%'+_0x15fcda[_0x180a('0x4d')]['filter']+'%'};return _0x61e80d;})});}_0x278287=_[_0x180a('0x55')]({},_0x278287,_0x15fcda[_0x180a('0x56')]);return _0x2866de[_0x180a('0xc4')](_0x278287);}})[_0x180a('0x25')](function(_0x1a9a78){if(_0x1a9a78){_0x168cc3=_0x1a9a78[_0x180a('0x4e')];if(!_0x15fcda[_0x180a('0x4d')][_0x180a('0x6d')]('nolimit')){_0x278287['limit']=qs[_0x180a('0x36')](_0x15fcda[_0x180a('0x4d')][_0x180a('0x36')]);_0x278287[_0x180a('0x33')]=qs[_0x180a('0x33')](_0x15fcda[_0x180a('0x4d')][_0x180a('0x33')]);}return _0x2866de[_0x180a('0xc4')](_0x278287);}})[_0x180a('0x25')](function(_0x515d12){if(_0x515d12){return _0x515d12?{'count':_0x168cc3,'rows':_0x515d12}:null;}})[_0x180a('0x25')](respondWithResult(_0x3032ae,null))[_0x180a('0x2f')](handleError(_0x3032ae,null));};exports[_0x180a('0xc5')]=function(_0x2e532c,_0x447ed2,_0x1f6461){var _0x212d27={'raw':![],'where':{}};var _0x441914={};var _0x1db6a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x180a('0x6c')]({'where':{'id':_0x2e532c[_0x180a('0x67')]['id']}})['then'](handleEntityNotFound(_0x447ed2,null))[_0x180a('0x25')](function(_0x4d2682){if(_0x4d2682){_0x441914[_0x180a('0x4c')]=_['keys'](db[_0x180a('0xa5')]['rawAttributes']);_0x441914[_0x180a('0x4d')]=_[_0x180a('0x5b')](_0x2e532c[_0x180a('0x4d')]);_0x441914[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x441914[_0x180a('0x4c')],_0x441914[_0x180a('0x4d')]);_0x212d27[_0x180a('0x4b')]=_[_0x180a('0x4a')](_0x441914['model'],qs[_0x180a('0x5c')](_0x2e532c['query'][_0x180a('0x5c')]));_0x212d27[_0x180a('0x4b')]=_0x212d27[_0x180a('0x4b')][_0x180a('0x4e')]?_0x212d27['attributes']:_0x441914[_0x180a('0x4c')];if(!_0x2e532c['query'][_0x180a('0x6d')](_0x180a('0x4f'))){_0x212d27[_0x180a('0x36')]=qs['limit'](_0x2e532c[_0x180a('0x4d')][_0x180a('0x36')]);_0x212d27[_0x180a('0x33')]=qs[_0x180a('0x33')](_0x2e532c[_0x180a('0x4d')][_0x180a('0x33')]);}_0x212d27[_0x180a('0x50')]=qs[_0x180a('0x51')](_0x2e532c[_0x180a('0x4d')][_0x180a('0x51')]);_0x212d27[_0x180a('0x52')]=qs['filters'](_[_0x180a('0x73')](_0x2e532c[_0x180a('0x4d')],_0x441914['filters']));_0x212d27[_0x180a('0x52')]['SmsAccountId']=_0x4d2682['id'];if(_0x2e532c[_0x180a('0x4d')]['filter']){_0x212d27[_0x180a('0x52')]=_[_0x180a('0x55')](_0x212d27[_0x180a('0x52')],{'$or':_[_0x180a('0x45')](_0x212d27['attributes'],function(_0x5957bb){var _0x441f0f={};_0x441f0f[_0x5957bb]={'$like':'%'+_0x2e532c[_0x180a('0x4d')][_0x180a('0x6e')]+'%'};return _0x441f0f;})});}_0x212d27=_['merge']({},_0x212d27,_0x2e532c[_0x180a('0x56')]);return db['SmsInteraction'][_0x180a('0x35')]({'where':_0x212d27[_0x180a('0x52')]})[_0x180a('0x25')](function(_0x5e370b){_0x1db6a8[_0x180a('0x35')]=_0x5e370b;if(_0x2e532c[_0x180a('0x4d')]['includeAll']){_0x212d27[_0x180a('0x57')]=[{'model':db[_0x180a('0x7b')],'as':_0x180a('0xc6'),'required':![]},{'model':db[_0x180a('0xaf')],'as':_0x180a('0xc7'),'attributes':[_0x180a('0x40'),_0x180a('0xc8'),_0x180a('0xc9')],'required':![]},{'model':db['Tag'],'as':_0x180a('0xca'),'attributes':['id',_0x180a('0x40'),_0x180a('0xcb')],'where':_0x2e532c['query'][_0x180a('0xcc')]?{'id':_0x2e532c['query'][_0x180a('0xcc')]}:undefined,'required':_0x2e532c[_0x180a('0x4d')]['tag']?!![]:![]}];}return db[_0x180a('0xa5')][_0x180a('0x58')](_0x212d27);})[_0x180a('0x25')](function(_0x2373d3){_0x1db6a8[_0x180a('0x59')]=_0x2373d3;return _0x1db6a8;});}})[_0x180a('0x25')](respondWithFilteredResult(_0x447ed2,_0x212d27))[_0x180a('0x2f')](handleError(_0x447ed2,null));};exports['send']=function(_0x459df1,_0x5d7de4,_0xad88b9){var _0x4e36b3,_0x392b8c,_0x19af64;if(_[_0x180a('0x9a')](_0x459df1[_0x180a('0x60')][_0x180a('0x60')])||_0x459df1['body'][_0x180a('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x180a('0x9b'));}if(_['isNil'](_0x459df1[_0x180a('0x60')]['to'])){throw new db['Sequelize'][(_0x180a('0x99'))](_0x180a('0xcd'));}_0x4e36b3=_0x459df1[_0x180a('0x60')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x459df1[_0x180a('0x67')]['id']},'include':[{'model':db[_0x180a('0xa0')],'as':_0x180a('0xce'),'include':[{'model':db[_0x180a('0x7b')],'as':'Contacts','where':{'mobile':_0x4e36b3},'limit':0x1,'order':[[_0x180a('0x80'),_0x180a('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x5d7de4,null))['then'](function(_0x223ff2){if(_0x223ff2&&_0x223ff2[_0x180a('0xce')]){_0x392b8c=_0x223ff2[_0x180a('0x3c')]({'plain':!![]});if(_0x392b8c[_0x180a('0xce')]&&_0x392b8c[_0x180a('0xce')][_0x180a('0xa3')][_0x180a('0x4e')]){return _0x392b8c['List'][_0x180a('0xa3')][0x0];}return db[_0x180a('0x7b')]['create'](_['defaults'](_0x459df1[_0x180a('0x60')],{'firstName':_0x4e36b3,'mobile':_0x4e36b3,'phone':_0x4e36b3,'ListId':_0x392b8c[_0x180a('0x82')]}));}})['then'](handleEntityNotFound(_0x5d7de4,null))['then'](function(_0x24438a){if(_0x24438a){_0x19af64=_0x24438a;return db[_0x180a('0xa5')][_0x180a('0x5e')]({'where':{'ContactId':_0x19af64['id'],'closed':![],'SmsAccountId':_0x392b8c['id']}})[_0x180a('0x25')](function(_0x374a3d){if(_0x374a3d){return[_0x374a3d,![]];}return db['SmsInteraction'][_0x180a('0x5f')]({'UserId':_0x459df1[_0x180a('0x61')]['id'],'ContactId':_0x19af64['id'],'SmsAccountId':_0x392b8c['id'],'phone':_0x4e36b3,'firstMsgDirection':'out','Messages':[_[_0x180a('0x55')](_0x459df1[_0x180a('0x60')],{'read':![],'body':_0x459df1[_0x180a('0x60')]['body'],'phone':_0x4e36b3,'SmsAccountId':_0x392b8c['id'],'UserId':_0x459df1[_0x180a('0x61')]['id'],'ContactId':_0x19af64['id']})]},{'include':[{'model':db[_0x180a('0xac')],'as':_0x180a('0xcf')}]})[_0x180a('0x25')](function(_0x20bba6){return[_0x20bba6,!![]];});});}})[_0x180a('0xa6')](function(_0x3a252e,_0x22a7a5){if(_0x22a7a5){return _0x3a252e;}return db['SmsMessage'][_0x180a('0x5f')](_[_0x180a('0x55')](_0x459df1[_0x180a('0x60')],{'read':![],'body':_0x459df1['body'][_0x180a('0x60')],'phone':_0x4e36b3,'SmsAccountId':_0x392b8c['id'],'SmsInteractionId':_0x3a252e['id'],'UserId':_0x459df1[_0x180a('0x61')]['id'],'ContactId':_0x19af64['id']}))[_0x180a('0x25')](function(_0x25b93d){_0x3a252e[_0x180a('0xd0')]['Messages']=[];_0x3a252e['dataValues'][_0x180a('0xcf')][_0x180a('0xaa')](_0x25b93d[_0x180a('0xd0')]);return _0x3a252e;});})[_0x180a('0x25')](respondWithResult(_0x5d7de4,null))[_0x180a('0x2f')](handleError(_0x5d7de4,null));};exports[_0x180a('0x31')]=function(_0x595d35,_0x1602fa,_0xf98ca8){if(_0x595d35[_0x180a('0x60')]['id']){delete _0x595d35[_0x180a('0x60')]['id'];}var _0x4795d3,_0x3799e6,_0x143fe0;return db[_0x180a('0x46')][_0x180a('0x5e')]({'where':{'id':_0x595d35[_0x180a('0x67')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x1602fa,null))['then'](function(_0x2d1bbb){if(_0x2d1bbb){_0x143fe0=_0x2d1bbb;logger[_0x180a('0x28')](_0x180a('0xd1'),'status',_0x180a('0xd2'),_0x2d1bbb['type'],util[_0x180a('0xd3')](_0x595d35[_0x180a('0x60')],{'showHidden':![],'depth':null}));switch(_0x2d1bbb[_0x180a('0x53')]){case _0x180a('0x89'):if(_0x595d35['body'][_0x180a('0xd4')]&&_0x595d35[_0x180a('0x60')][_0x180a('0x31')]){_0x3799e6=_0x595d35[_0x180a('0x60')][_0x180a('0x31')];return db[_0x180a('0xac')]['find']({'where':{'messageId':_0x595d35[_0x180a('0x60')][_0x180a('0xd4')]}});}break;case _0x180a('0x8b'):if(_0x595d35[_0x180a('0x60')][_0x180a('0xd5')]&&_0x595d35['body'][_0x180a('0xd6')]){_0x3799e6=_0x595d35[_0x180a('0x60')][_0x180a('0xd6')];return db[_0x180a('0xac')][_0x180a('0x5e')]({'where':{'messageId':_0x595d35[_0x180a('0x60')][_0x180a('0xd5')]}});}break;case _0x180a('0x8c'):if(_0x595d35[_0x180a('0x60')][_0x180a('0x8d')]&&_0x595d35['body'][_0x180a('0xd7')]){_0x3799e6=_0x595d35['body'][_0x180a('0xd7')];return db[_0x180a('0xac')][_0x180a('0x5e')]({'where':{'messageId':_0x595d35[_0x180a('0x60')][_0x180a('0x8d')]}});}break;case _0x180a('0xd8'):var _0x5a632e=_0x595d35['body'][_0x180a('0x8f')][0x0];if(_0x5a632e[_0x180a('0x88')]&&_0x5a632e[_0x180a('0x31')][_0x180a('0xd9')]===_0x180a('0xda')){_0x3799e6=_0x5a632e[_0x180a('0x31')][_0x180a('0xd9')];return db['SmsMessage'][_0x180a('0x5e')]({'where':{'messageId':_0x5a632e['messageId']}});}break;case _0x180a('0x94'):if(_0x595d35[_0x180a('0x60')][_0x180a('0x88')]&&_0x595d35[_0x180a('0x60')]['status']){_0x3799e6=_0x595d35[_0x180a('0x60')]['status'];return db[_0x180a('0xac')][_0x180a('0x5e')]({'where':{'messageId':_0x595d35['body'][_0x180a('0x88')]}});}break;case _0x180a('0x97'):if(_0x595d35['body'][0x0]['message']['id']){_0x3799e6=_0x595d35['body'][0x0]['type'];return db[_0x180a('0xac')][_0x180a('0x5e')]({'where':{'messageId':_0x595d35['body'][0x0]['message']['id']}});}break;case _0x180a('0x98'):if(_0x595d35[_0x180a('0x60')][_0x180a('0xdb')]&&_0x595d35[_0x180a('0x60')][_0x180a('0x31')]){_0x3799e6=_0x595d35[_0x180a('0x60')][_0x180a('0x31')];return db[_0x180a('0xac')][_0x180a('0x5e')]({'where':{'messageId':_0x595d35[_0x180a('0x60')][_0x180a('0xdb')]}});}break;}}})[_0x180a('0x25')](handleEntityNotFound(_0x1602fa,null))[_0x180a('0x25')](function(_0x4b3e6b){if(_0x4b3e6b){_0x4795d3=_0x4b3e6b;switch(_0x143fe0[_0x180a('0x53')]){case _0x180a('0x89'):if(_0x3799e6===_0x180a('0xda')){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger[_0x180a('0x2c')](_0x180a('0xd1'),'status',_0x180a('0x89'),util[_0x180a('0xd3')](_0x595d35[_0x180a('0x60')],{'showHidden':![],'depth':null}));}break;case _0x180a('0x8b'):if(_0x3799e6==='1'){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger[_0x180a('0x2c')](_0x180a('0xd1'),_0x180a('0x31'),_0x180a('0x89'),util[_0x180a('0xd3')](_0x595d35[_0x180a('0x60')],{'showHidden':![],'depth':null}));}break;case _0x180a('0x8c'):if(!_0x595d35[_0x180a('0x60')]['error_code']&&_0x3799e6>=0xc8&&_0x3799e6<=0xce){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger[_0x180a('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x180a('0x31'),_0x180a('0x8c'),util[_0x180a('0xd3')](_0x595d35['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3e7536=_0x595d35['body'][_0x180a('0x8f')][0x0];if(_0x3e7536[_0x180a('0x31')][_0x180a('0xd9')]===_0x180a('0xda')){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger['error'](_0x180a('0xd1'),_0x180a('0x31'),_0x180a('0xd8'),util[_0x180a('0xd3')](_0x595d35[_0x180a('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3799e6=='DELIVERED_TO_GATEWAY'||_0x3799e6==_0x180a('0xdc')){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger[_0x180a('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x180a('0x94'),util[_0x180a('0xd3')](_0x595d35[_0x180a('0x60')],{'showHidden':![],'depth':null}));}break;case _0x180a('0x97'):if(_0x3799e6=='message-delivered'){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger[_0x180a('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x180a('0x31'),_0x180a('0x97'),util['inspect'](_0x595d35['body'],{'showHidden':![],'depth':null}));}break;case _0x180a('0x98'):if(_0x3799e6===_0x180a('0xdd')||_0x3799e6===_0x180a('0xde')){return _0x4795d3[_0x180a('0x66')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x180a('0x31'),_0x180a('0x98'),util['inspect'](_0x595d35[_0x180a('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x4795d3;}})[_0x180a('0x25')](respondWithResult(_0x1602fa,null))[_0x180a('0x2f')](handleError(_0x1602fa,null));};exports[_0x180a('0xdf')]=function(_0x55c591,_0x4b779e,_0x3969e6){var _0x3a41ea,_0x4534be,_0x5b4790;return db[_0x180a('0x46')]['find']({'where':{'id':_0x55c591['params']['id']}})['then'](handleEntityNotFound(_0x4b779e,null))[_0x180a('0x25')](function(_0x39df4d){if(_0x39df4d){_0x5b4790=_0x39df4d;logger['debug'](_0x180a('0xd1'),'status',_0x180a('0xd2'),_0x39df4d[_0x180a('0x53')],util[_0x180a('0xd3')](_0x55c591[_0x180a('0x4d')],{'showHidden':![],'depth':null}));switch(_0x39df4d[_0x180a('0x53')]){case _0x180a('0x91'):if(_0x55c591[_0x180a('0x4d')][_0x180a('0xe0')]&&_0x55c591['query'][_0x180a('0xe1')]){_0x4534be=_0x55c591[_0x180a('0x4d')][_0x180a('0xe1')];return db[_0x180a('0xac')][_0x180a('0x5e')]({'where':{'messageId':_0x55c591[_0x180a('0x4d')][_0x180a('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x4b779e,null))[_0x180a('0x25')](function(_0x3c510b){if(_0x3c510b){_0x3a41ea=_0x3c510b;switch(_0x5b4790[_0x180a('0x53')]){case _0x180a('0x91'):if(_0x4534be==='2'||_0x4534be==='6'){return _0x3a41ea['update']({'read':!![]});}else{logger['error'](_0x180a('0xd1'),_0x180a('0x31'),_0x180a('0x91'),util[_0x180a('0xd3')](_0x55c591['query'],{'showHidden':![],'depth':null}));};break;}return _0x3a41ea;}})[_0x180a('0x25')](respondWithResult(_0x4b779e,null))[_0x180a('0x2f')](handleError(_0x4b779e,null));};exports['addAgents']=function(_0x12895b,_0x4a5499,_0x32477d){return db[_0x180a('0x46')][_0x180a('0x5e')]({'where':{'id':_0x12895b[_0x180a('0x67')]['id']}})['then'](handleEntityNotFound(_0x4a5499,null))[_0x180a('0x25')](function(_0x12b87b){if(_0x12b87b){return _0x12b87b[_0x180a('0xe2')](_0x12895b[_0x180a('0x60')][_0x180a('0x70')],_[_0x180a('0xe3')](_0x12895b['body'],[_0x180a('0x70'),'id'])||{})[_0x180a('0xa6')](function(_0x23eda4){for(var _0x25fa08=0x0;_0x25fa08<_0x12895b['body'][_0x180a('0x70')][_0x180a('0x4e')];_0x25fa08+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x12895b[_0x180a('0x60')][_0x180a('0x70')][_0x25fa08]),'SmsAccountId':Number(_0x12895b[_0x180a('0x67')]['id'])});}return _0x23eda4;});}})[_0x180a('0x25')](respondWithResult(_0x4a5499,null))['catch'](handleError(_0x4a5499,null));};exports[_0x180a('0xe4')]=function(_0x14736c,_0x2549aa,_0x37e26c){return db[_0x180a('0x46')]['find']({'where':{'id':_0x14736c[_0x180a('0x67')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x2549aa,null))[_0x180a('0x25')](function(_0x59aa9b){if(_0x59aa9b){return _0x59aa9b['removeAgents'](_0x14736c['query'][_0x180a('0x70')])[_0x180a('0x25')](function(){if(_[_0x180a('0xe5')](_0x14736c[_0x180a('0x4d')][_0x180a('0x70')])){for(var _0x14f374=0x0;_0x14f374<_0x14736c[_0x180a('0x4d')]['ids'][_0x180a('0x4e')];_0x14f374+=0x1){socket[_0x180a('0xe6')](_0x180a('0xe7'),{'UserId':Number(_0x14736c[_0x180a('0x4d')]['ids'][_0x14f374]),'SmsAccountId':Number(_0x14736c['params']['id'])});}}else{socket[_0x180a('0xe6')](_0x180a('0xe7'),{'UserId':Number(_0x14736c[_0x180a('0x4d')]['ids']),'SmsAccountId':Number(_0x14736c[_0x180a('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x2549aa,null))['catch'](handleError(_0x2549aa,null));};exports['getAgents']=function(_0x19e6d4,_0x5734d9,_0x4cd9bf){var _0x12ece4={};var _0x3a69c2={};var _0x3c8174;var _0xd140df;return db[_0x180a('0x46')][_0x180a('0x6c')]({'where':{'id':_0x19e6d4[_0x180a('0x67')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x5734d9,null))[_0x180a('0x25')](function(_0x178787){if(_0x178787){_0x3c8174=_0x178787;_0x3a69c2['model']=_[_0x180a('0x5b')](db['User'][_0x180a('0x47')]);_0x3a69c2[_0x180a('0x4d')]=_['keys'](_0x19e6d4[_0x180a('0x4d')]);_0x3a69c2[_0x180a('0x49')]=_[_0x180a('0x4a')](_0x3a69c2[_0x180a('0x4c')],_0x3a69c2['query']);_0x12ece4['attributes']=_[_0x180a('0x4a')](_0x3a69c2[_0x180a('0x4c')],qs[_0x180a('0x5c')](_0x19e6d4[_0x180a('0x4d')][_0x180a('0x5c')]));_0x12ece4['attributes']=_0x12ece4['attributes'][_0x180a('0x4e')]?_0x12ece4[_0x180a('0x4b')]:_0x3a69c2[_0x180a('0x4c')];_0x12ece4[_0x180a('0x50')]=qs['sort'](_0x19e6d4['query'][_0x180a('0x51')]);_0x12ece4[_0x180a('0x52')]=qs['filters'](_[_0x180a('0x73')](_0x19e6d4[_0x180a('0x4d')],_0x3a69c2[_0x180a('0x49')]));if(_0x19e6d4['query']['filter']){_0x12ece4[_0x180a('0x52')]=_[_0x180a('0x55')](_0x12ece4[_0x180a('0x52')],{'$or':_[_0x180a('0x45')](_0x12ece4[_0x180a('0x4b')],function(_0x5189f3){var _0x5ca0ae={};_0x5ca0ae[_0x5189f3]={'$like':'%'+_0x19e6d4[_0x180a('0x4d')][_0x180a('0x6e')]+'%'};return _0x5ca0ae;})});}_0x12ece4=_[_0x180a('0x55')]({},_0x12ece4,_0x19e6d4[_0x180a('0x56')]);return _0x3c8174[_0x180a('0xe8')](_0x12ece4);}})[_0x180a('0x25')](function(_0x4bf587){if(_0x4bf587){_0xd140df=_0x4bf587['length'];if(!_0x19e6d4['query'][_0x180a('0x6d')](_0x180a('0x4f'))){_0x12ece4['limit']=qs['limit'](_0x19e6d4['query']['limit']);_0x12ece4[_0x180a('0x33')]=qs[_0x180a('0x33')](_0x19e6d4[_0x180a('0x4d')]['offset']);}return _0x3c8174[_0x180a('0xe8')](_0x12ece4);}})['then'](function(_0x58eb76){if(_0x58eb76){return _0x58eb76?{'count':_0xd140df,'rows':_0x58eb76}:null;}})[_0x180a('0x25')](respondWithResult(_0x5734d9,null))['catch'](handleError(_0x5734d9,null));}; \ No newline at end of file +var _0x3fbc=['ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','AttachmentId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','set','Content-Type','text/xml','send','\x0a','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./smsAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','get','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','Pause','includeAll','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','getDispositions','findOne','Disposition','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x4b4815,_0x88d78){var _0x2f0234=function(_0x229868){while(--_0x229868){_0x4b4815['push'](_0x4b4815['shift']());}};_0x2f0234(++_0x88d78);}(_0x3fbc,0x65));var _0xc3fb=function(_0x184eb4,_0x437069){_0x184eb4=_0x184eb4-0x0;var _0x495420=_0x3fbc[_0x184eb4];return _0x495420;};'use strict';var emlformat=require(_0xc3fb('0x0'));var rimraf=require(_0xc3fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3fb('0x2'));var rp=require(_0xc3fb('0x3'));var moment=require(_0xc3fb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc3fb('0x5'));var sox=require(_0xc3fb('0x6'));var csv=require('to-csv');var ejs=require(_0xc3fb('0x7'));var fs=require('fs');var fs_extra=require(_0xc3fb('0x8'));var _=require('lodash');var squel=require(_0xc3fb('0x9'));var crypto=require(_0xc3fb('0xa'));var jsforce=require(_0xc3fb('0xb'));var deskjs=require(_0xc3fb('0xc'));var toCsv=require(_0xc3fb('0xd'));var querystring=require(_0xc3fb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3fb('0xf'));var qs=require(_0xc3fb('0x10'));var as=require(_0xc3fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3fb('0x12'))(_0xc3fb('0x13'));var utils=require(_0xc3fb('0x14'));var config=require(_0xc3fb('0x15'));var licenseUtil=require(_0xc3fb('0x16'));var db=require(_0xc3fb('0x17'))['db'];config[_0xc3fb('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3fb('0x18')]));require(_0xc3fb('0x19'))[_0xc3fb('0x1a')](socket);var jayson=require(_0xc3fb('0x1b'));var client=jayson[_0xc3fb('0x1c')][_0xc3fb('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x15ae26,_0x579950,_0x21ce7a,_0xcad778){return new BPromise(function(_0x51e65c,_0x50fd52){var _0xd3a121=_0xcad778||client;return _0xd3a121['request'](_0x15ae26,_0x21ce7a)[_0xc3fb('0x1e')](function(_0x2ebb3d){logger[_0xc3fb('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x579950,_0xc3fb('0x20'));logger[_0xc3fb('0x21')](_0xc3fb('0x22'),_0x579950,_0xc3fb('0x20'),JSON[_0xc3fb('0x23')](_0x2ebb3d));if(_0x2ebb3d[_0xc3fb('0x24')]){if(_0x2ebb3d[_0xc3fb('0x24')]['code']===0x1f4){logger[_0xc3fb('0x24')]('SmsAccount,\x20%s,\x20%s',_0x579950,_0x2ebb3d[_0xc3fb('0x24')][_0xc3fb('0x25')]);return _0x50fd52(_0x2ebb3d[_0xc3fb('0x24')][_0xc3fb('0x25')]);}logger[_0xc3fb('0x24')]('SmsAccount,\x20%s,\x20%s',_0x579950,_0x2ebb3d['error'][_0xc3fb('0x25')]);return _0x51e65c(_0x2ebb3d[_0xc3fb('0x24')][_0xc3fb('0x25')]);}else{logger[_0xc3fb('0x1f')](_0xc3fb('0x26'),_0x579950,_0xc3fb('0x20'));_0x51e65c(_0x2ebb3d[_0xc3fb('0x27')]['message']);}})['catch'](function(_0x4d734f){logger['error'](_0xc3fb('0x26'),_0x579950,_0x4d734f);_0x50fd52(_0x4d734f);});});}function respondWithStatusCode(_0x3c430d,_0x16f5fa){_0x16f5fa=_0x16f5fa||0xcc;return function(_0x2f6ed2){if(_0x2f6ed2){return _0x3c430d[_0xc3fb('0x28')](_0x16f5fa);}return _0x3c430d[_0xc3fb('0x29')](_0x16f5fa)[_0xc3fb('0x2a')]();};}function respondWithResult(_0x5d6014,_0x369b83){_0x369b83=_0x369b83||0xc8;return function(_0x17f829){if(_0x17f829){return _0x5d6014[_0xc3fb('0x29')](_0x369b83)['json'](_0x17f829);}};}function respondWithFilteredResult(_0x1ed22c,_0xb7b2bb){return function(_0x28d881){if(_0x28d881){var _0x305004=typeof _0xb7b2bb[_0xc3fb('0x2b')]===_0xc3fb('0x2c')&&typeof _0xb7b2bb['limit']===_0xc3fb('0x2c');var _0x20837f=_0x28d881[_0xc3fb('0x2d')];var _0x128020=_0x305004?0x0:_0xb7b2bb[_0xc3fb('0x2b')];var _0x5b93ce=_0x305004?_0x28d881[_0xc3fb('0x2d')]:_0xb7b2bb['offset']+_0xb7b2bb[_0xc3fb('0x2e')];var _0x2574a0;if(_0x5b93ce>=_0x20837f){_0x5b93ce=_0x20837f;_0x2574a0=0xc8;}else{_0x2574a0=0xce;}_0x1ed22c['status'](_0x2574a0);return _0x1ed22c['set'](_0xc3fb('0x2f'),_0x128020+'-'+_0x5b93ce+'/'+_0x20837f)[_0xc3fb('0x30')](_0x28d881);}return null;};}function patchUpdates(_0x217d72){return function(_0x4deac4){try{jsonpatch[_0xc3fb('0x31')](_0x4deac4,_0x217d72,!![]);}catch(_0x27f9b0){return BPromise['reject'](_0x27f9b0);}return _0x4deac4[_0xc3fb('0x32')]();};}function saveUpdates(_0x21ba8e,_0x8e8c1){return function(_0x4c1cb4){if(_0x4c1cb4){return _0x4c1cb4[_0xc3fb('0x33')](_0x21ba8e)[_0xc3fb('0x1e')](function(_0x24ca35){return _0x24ca35;});}return null;};}function removeEntity(_0x1c9223,_0x55568a){return function(_0x4286b2){if(_0x4286b2){return _0x4286b2['destroy']()[_0xc3fb('0x1e')](function(){var _0x2360f9=_0x4286b2[_0xc3fb('0x34')]({'plain':!![]});var _0x2b4c4a='SmsAccounts';return db[_0xc3fb('0x35')][_0xc3fb('0x36')]({'where':{'type':_0x2b4c4a,'resourceId':_0x2360f9['id']}})[_0xc3fb('0x1e')](function(){return _0x4286b2;});})[_0xc3fb('0x1e')](function(){_0x1c9223[_0xc3fb('0x29')](0xcc)[_0xc3fb('0x2a')]();});}};}function handleEntityNotFound(_0x47e2c9,_0x591fa9){return function(_0x3d9f20){if(!_0x3d9f20){_0x47e2c9[_0xc3fb('0x28')](0x194);}return _0x3d9f20;};}function handleError(_0x5168fd,_0x52363b){_0x52363b=_0x52363b||0x1f4;return function(_0x1a99c8){logger[_0xc3fb('0x24')](_0x1a99c8[_0xc3fb('0x37')]);if(_0x1a99c8[_0xc3fb('0x38')]){delete _0x1a99c8[_0xc3fb('0x38')];}_0x5168fd['status'](_0x52363b)['send'](_0x1a99c8);};}exports[_0xc3fb('0x39')]=function(_0x1a0f72,_0x592969){var _0x34949a={'include':[{'model':db['Pause'],'as':_0xc3fb('0x3a')}]},_0x283927={},_0x43dc59={'count':0x0,'rows':[]};var _0x2714cf=_[_0xc3fb('0x3b')](db[_0xc3fb('0x3c')][_0xc3fb('0x3d')],function(_0xcbb1ec){return{'name':_0xcbb1ec['fieldName'],'type':_0xcbb1ec['type'][_0xc3fb('0x3e')]};});_0x283927['model']=_[_0xc3fb('0x3b')](_0x2714cf,_0xc3fb('0x38'));_0x283927[_0xc3fb('0x3f')]=_[_0xc3fb('0x40')](_0x1a0f72[_0xc3fb('0x3f')]);_0x283927[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0x283927[_0xc3fb('0x43')],_0x283927['query']);_0x34949a[_0xc3fb('0x44')]=_['intersection'](_0x283927[_0xc3fb('0x43')],qs[_0xc3fb('0x45')](_0x1a0f72[_0xc3fb('0x3f')]['fields']));_0x34949a['attributes']=_0x34949a[_0xc3fb('0x44')][_0xc3fb('0x46')]?_0x34949a['attributes']:_0x283927[_0xc3fb('0x43')];if(!_0x1a0f72[_0xc3fb('0x3f')][_0xc3fb('0x47')](_0xc3fb('0x48'))){_0x34949a[_0xc3fb('0x2e')]=qs[_0xc3fb('0x2e')](_0x1a0f72[_0xc3fb('0x3f')][_0xc3fb('0x2e')]);_0x34949a[_0xc3fb('0x2b')]=qs['offset'](_0x1a0f72[_0xc3fb('0x3f')]['offset']);}_0x34949a[_0xc3fb('0x49')]=qs[_0xc3fb('0x4a')](_0x1a0f72[_0xc3fb('0x3f')][_0xc3fb('0x4a')]);_0x34949a[_0xc3fb('0x4b')]=qs[_0xc3fb('0x41')](_[_0xc3fb('0x4c')](_0x1a0f72[_0xc3fb('0x3f')],_0x283927['filters']),_0x2714cf);if(_0x1a0f72[_0xc3fb('0x3f')][_0xc3fb('0x4d')]){_0x34949a[_0xc3fb('0x4b')]=_['merge'](_0x34949a[_0xc3fb('0x4b')],{'$or':_[_0xc3fb('0x3b')](_0x2714cf,function(_0x172249){if(_0x172249[_0xc3fb('0x4e')]!==_0xc3fb('0x4f')){var _0x4019ae={};_0x4019ae[_0x172249['name']]={'$like':'%'+_0x1a0f72[_0xc3fb('0x3f')]['filter']+'%'};return _0x4019ae;}})});}_0x34949a=_[_0xc3fb('0x50')]({},_0x34949a,_0x1a0f72['options']);var _0x5261e8={'where':_0x34949a[_0xc3fb('0x4b')]};return db[_0xc3fb('0x3c')][_0xc3fb('0x2d')](_0x5261e8)[_0xc3fb('0x1e')](function(_0x37c1ae){_0x43dc59['count']=_0x37c1ae;if(_0x1a0f72[_0xc3fb('0x3f')]['includeAll']){_0x34949a[_0xc3fb('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0xc3fb('0x52')](_0x34949a);})[_0xc3fb('0x1e')](function(_0x47d7a3){_0x43dc59[_0xc3fb('0x53')]=_0x47d7a3;return _0x43dc59;})[_0xc3fb('0x1e')](respondWithFilteredResult(_0x592969,_0x34949a))[_0xc3fb('0x54')](handleError(_0x592969,null));};exports['show']=function(_0x44f181,_0x567dff){var _0x5e79a2={'raw':![],'where':{'id':_0x44f181['params']['id']},'include':[{'model':db[_0xc3fb('0x55')],'as':_0xc3fb('0x3a')}]},_0x2d7cd4={};_0x2d7cd4[_0xc3fb('0x43')]=_['keys'](db[_0xc3fb('0x3c')][_0xc3fb('0x3d')]);_0x2d7cd4[_0xc3fb('0x3f')]=_[_0xc3fb('0x40')](_0x44f181[_0xc3fb('0x3f')]);_0x2d7cd4[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0x2d7cd4[_0xc3fb('0x43')],_0x2d7cd4[_0xc3fb('0x3f')]);_0x5e79a2[_0xc3fb('0x44')]=_[_0xc3fb('0x42')](_0x2d7cd4['model'],qs[_0xc3fb('0x45')](_0x44f181['query'][_0xc3fb('0x45')]));_0x5e79a2[_0xc3fb('0x44')]=_0x5e79a2[_0xc3fb('0x44')][_0xc3fb('0x46')]?_0x5e79a2[_0xc3fb('0x44')]:_0x2d7cd4[_0xc3fb('0x43')];if(_0x44f181[_0xc3fb('0x3f')][_0xc3fb('0x56')]){_0x5e79a2[_0xc3fb('0x51')]=[{'all':!![]}];}_0x5e79a2=_['merge']({},_0x5e79a2,_0x44f181['options']);return db[_0xc3fb('0x3c')][_0xc3fb('0x57')](_0x5e79a2)['then'](handleEntityNotFound(_0x567dff,null))[_0xc3fb('0x1e')](respondWithResult(_0x567dff,null))[_0xc3fb('0x54')](handleError(_0x567dff,null));};exports[_0xc3fb('0x58')]=function(_0x56d9c4,_0xae973a){return db[_0xc3fb('0x3c')][_0xc3fb('0x58')](_0x56d9c4[_0xc3fb('0x59')],{})[_0xc3fb('0x1e')](function(_0x17d0a5){var _0x43a0e1=_0x56d9c4[_0xc3fb('0x5a')][_0xc3fb('0x34')]({'plain':!![]});if(!_0x43a0e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a0e1['role']===_0xc3fb('0x5a')){var _0xa26c3a=_0x17d0a5[_0xc3fb('0x34')]({'plain':!![]});var _0x2cfc8e='SmsAccounts';return db[_0xc3fb('0x5b')][_0xc3fb('0x57')]({'where':{'name':_0x2cfc8e,'userProfileId':_0x43a0e1['userProfileId']},'raw':!![]})[_0xc3fb('0x1e')](function(_0x13d01b){if(_0x13d01b&&_0x13d01b[_0xc3fb('0x5c')]===0x0){return db[_0xc3fb('0x35')][_0xc3fb('0x58')]({'name':_0xa26c3a[_0xc3fb('0x38')],'resourceId':_0xa26c3a['id'],'type':_0x13d01b['name'],'sectionId':_0x13d01b['id']},{})['then'](function(){return _0x17d0a5;});}else{return _0x17d0a5;}})[_0xc3fb('0x54')](function(_0x116763){logger[_0xc3fb('0x24')](_0xc3fb('0x5d'),_0x116763);throw _0x116763;});}return _0x17d0a5;})[_0xc3fb('0x1e')](respondWithResult(_0xae973a,0xc9))[_0xc3fb('0x54')](handleError(_0xae973a,null));};exports['update']=function(_0x15d534,_0x1370b2){if(_0x15d534[_0xc3fb('0x59')]['id']){delete _0x15d534[_0xc3fb('0x59')]['id'];}return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x15d534[_0xc3fb('0x5e')]['id']},'include':[{'model':db[_0xc3fb('0x55')],'as':_0xc3fb('0x3a')}]})[_0xc3fb('0x1e')](handleEntityNotFound(_0x1370b2,null))[_0xc3fb('0x1e')](saveUpdates(_0x15d534[_0xc3fb('0x59')],null))[_0xc3fb('0x1e')](respondWithResult(_0x1370b2,null))[_0xc3fb('0x54')](handleError(_0x1370b2,null));};exports[_0xc3fb('0x36')]=function(_0x5850b9,_0x407c95){return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x5850b9[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x407c95,null))[_0xc3fb('0x1e')](removeEntity(_0x407c95,null))[_0xc3fb('0x54')](handleError(_0x407c95,null));};exports['describe']=function(_0x5ddacb,_0x2021a8){return db[_0xc3fb('0x3c')][_0xc3fb('0x5f')]()[_0xc3fb('0x1e')](respondWithResult(_0x2021a8,null))['catch'](handleError(_0x2021a8,null));};exports['addDisposition']=function(_0x51c661,_0x93b329,_0x10ce19){if(_0x51c661[_0xc3fb('0x59')]['id']){delete _0x51c661['body']['id'];}return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x51c661['params']['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x93b329,null))[_0xc3fb('0x1e')](function(_0x1d1170){if(_0x1d1170){_0x51c661['body'][_0xc3fb('0x60')]=_0x1d1170['id'];return db['Disposition']['create'](_0x51c661['body']);}})[_0xc3fb('0x1e')](respondWithResult(_0x93b329,null))[_0xc3fb('0x54')](handleError(_0x93b329,null));};exports[_0xc3fb('0x61')]=function(_0x9573ce,_0x586564,_0x3c288c){var _0x1cf194={'raw':![],'where':{}};var _0x82974={};var _0x2fbda3={'count':0x0,'rows':[]};return db[_0xc3fb('0x3c')][_0xc3fb('0x62')]({'where':{'id':_0x9573ce[_0xc3fb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x586564,null))[_0xc3fb('0x1e')](function(_0x4bdcab){if(_0x4bdcab){_0x82974[_0xc3fb('0x43')]=_[_0xc3fb('0x40')](db[_0xc3fb('0x63')][_0xc3fb('0x3d')]);_0x82974[_0xc3fb('0x3f')]=_[_0xc3fb('0x40')](_0x9573ce[_0xc3fb('0x3f')]);_0x82974[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0x82974[_0xc3fb('0x43')],_0x82974[_0xc3fb('0x3f')]);_0x1cf194[_0xc3fb('0x44')]=_[_0xc3fb('0x42')](_0x82974[_0xc3fb('0x43')],qs[_0xc3fb('0x45')](_0x9573ce[_0xc3fb('0x3f')][_0xc3fb('0x45')]));_0x1cf194[_0xc3fb('0x44')]=_0x1cf194['attributes'][_0xc3fb('0x46')]?_0x1cf194[_0xc3fb('0x44')]:_0x82974[_0xc3fb('0x43')];if(!_0x9573ce[_0xc3fb('0x3f')][_0xc3fb('0x47')](_0xc3fb('0x48'))){_0x1cf194['limit']=qs[_0xc3fb('0x2e')](_0x9573ce[_0xc3fb('0x3f')][_0xc3fb('0x2e')]);_0x1cf194['offset']=qs[_0xc3fb('0x2b')](_0x9573ce[_0xc3fb('0x3f')][_0xc3fb('0x2b')]);}_0x1cf194['order']=qs['sort'](_0x9573ce['query'][_0xc3fb('0x4a')]);_0x1cf194[_0xc3fb('0x4b')]=qs[_0xc3fb('0x41')](_[_0xc3fb('0x4c')](_0x9573ce[_0xc3fb('0x3f')],_0x82974[_0xc3fb('0x41')]));_0x1cf194[_0xc3fb('0x4b')][_0xc3fb('0x60')]=_0x4bdcab['id'];if(_0x9573ce['query'][_0xc3fb('0x4d')]){_0x1cf194[_0xc3fb('0x4b')]=_[_0xc3fb('0x50')](_0x1cf194[_0xc3fb('0x4b')],{'$or':_['map'](_0x1cf194[_0xc3fb('0x44')],function(_0x6703fc){var _0xaa8fe6={};_0xaa8fe6[_0x6703fc]={'$like':'%'+_0x9573ce[_0xc3fb('0x3f')]['filter']+'%'};return _0xaa8fe6;})});}_0x1cf194=_['merge']({},_0x1cf194,_0x9573ce[_0xc3fb('0x64')]);return db[_0xc3fb('0x63')][_0xc3fb('0x2d')]({'where':_0x1cf194[_0xc3fb('0x4b')]})['then'](function(_0x5d3aa7){_0x2fbda3[_0xc3fb('0x2d')]=_0x5d3aa7;if(_0x9573ce['query'][_0xc3fb('0x56')]){_0x1cf194['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1cf194);})['then'](function(_0x29e333){_0x2fbda3[_0xc3fb('0x53')]=_0x29e333;return _0x2fbda3;});}})[_0xc3fb('0x1e')](respondWithFilteredResult(_0x586564,_0x1cf194))[_0xc3fb('0x54')](handleError(_0x586564,null));};exports[_0xc3fb('0x65')]=function(_0x437aa9,_0x5d5a79,_0x1b5353){return db[_0xc3fb('0x3c')]['find']({'where':{'id':_0x437aa9[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x5d5a79,null))[_0xc3fb('0x1e')](function(_0x45f1aa){if(_0x45f1aa){return _0x45f1aa[_0xc3fb('0x65')](_0x437aa9['query'][_0xc3fb('0x66')]);}})[_0xc3fb('0x1e')](respondWithStatusCode(_0x5d5a79,null))[_0xc3fb('0x54')](handleError(_0x5d5a79,null));};exports[_0xc3fb('0x67')]=function(_0x37a9e1,_0xbaf0ad,_0x1af85d){if(_0x37a9e1[_0xc3fb('0x59')]['id']){delete _0x37a9e1[_0xc3fb('0x59')]['id'];}return db[_0xc3fb('0x3c')]['find']({'where':{'id':_0x37a9e1[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0xbaf0ad,null))[_0xc3fb('0x1e')](function(_0x3301d9){if(_0x3301d9){_0x37a9e1['body'][_0xc3fb('0x60')]=_0x3301d9['id'];return db[_0xc3fb('0x68')][_0xc3fb('0x58')](_0x37a9e1[_0xc3fb('0x59')]);}})[_0xc3fb('0x1e')](respondWithResult(_0xbaf0ad,null))[_0xc3fb('0x54')](handleError(_0xbaf0ad,null));};exports[_0xc3fb('0x69')]=function(_0x5c5aec,_0x1e2132,_0x23b9c1){var _0x508bdf={'raw':![],'where':{}};var _0x3fe91c={};var _0x1098ba={'count':0x0,'rows':[]};return db[_0xc3fb('0x3c')][_0xc3fb('0x62')]({'where':{'id':_0x5c5aec[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x1e2132,null))['then'](function(_0x4c4482){if(_0x4c4482){_0x3fe91c[_0xc3fb('0x43')]=_['keys'](db['CannedAnswer'][_0xc3fb('0x3d')]);_0x3fe91c[_0xc3fb('0x3f')]=_['keys'](_0x5c5aec[_0xc3fb('0x3f')]);_0x3fe91c[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0x3fe91c[_0xc3fb('0x43')],_0x3fe91c['query']);_0x508bdf[_0xc3fb('0x44')]=_[_0xc3fb('0x42')](_0x3fe91c[_0xc3fb('0x43')],qs[_0xc3fb('0x45')](_0x5c5aec[_0xc3fb('0x3f')]['fields']));_0x508bdf[_0xc3fb('0x44')]=_0x508bdf['attributes'][_0xc3fb('0x46')]?_0x508bdf[_0xc3fb('0x44')]:_0x3fe91c[_0xc3fb('0x43')];if(!_0x5c5aec[_0xc3fb('0x3f')]['hasOwnProperty'](_0xc3fb('0x48'))){_0x508bdf[_0xc3fb('0x2e')]=qs[_0xc3fb('0x2e')](_0x5c5aec[_0xc3fb('0x3f')][_0xc3fb('0x2e')]);_0x508bdf['offset']=qs[_0xc3fb('0x2b')](_0x5c5aec[_0xc3fb('0x3f')]['offset']);}_0x508bdf[_0xc3fb('0x49')]=qs[_0xc3fb('0x4a')](_0x5c5aec[_0xc3fb('0x3f')]['sort']);_0x508bdf['where']=qs[_0xc3fb('0x41')](_['pick'](_0x5c5aec[_0xc3fb('0x3f')],_0x3fe91c[_0xc3fb('0x41')]));_0x508bdf[_0xc3fb('0x4b')]['SmsAccountId']=_0x4c4482['id'];if(_0x5c5aec['query'][_0xc3fb('0x4d')]){_0x508bdf[_0xc3fb('0x4b')]=_[_0xc3fb('0x50')](_0x508bdf[_0xc3fb('0x4b')],{'$or':_[_0xc3fb('0x3b')](_0x508bdf[_0xc3fb('0x44')],function(_0x16e075){var _0x35bcf6={};_0x35bcf6[_0x16e075]={'$like':'%'+_0x5c5aec[_0xc3fb('0x3f')][_0xc3fb('0x4d')]+'%'};return _0x35bcf6;})});}_0x508bdf=_['merge']({},_0x508bdf,_0x5c5aec['options']);return db[_0xc3fb('0x68')][_0xc3fb('0x2d')]({'where':_0x508bdf[_0xc3fb('0x4b')]})[_0xc3fb('0x1e')](function(_0x4899e0){_0x1098ba[_0xc3fb('0x2d')]=_0x4899e0;if(_0x5c5aec[_0xc3fb('0x3f')][_0xc3fb('0x56')]){_0x508bdf[_0xc3fb('0x51')]=[{'all':!![]}];}return db[_0xc3fb('0x68')]['findAll'](_0x508bdf);})[_0xc3fb('0x1e')](function(_0x588199){_0x1098ba['rows']=_0x588199;return _0x1098ba;});}})[_0xc3fb('0x1e')](respondWithFilteredResult(_0x1e2132,_0x508bdf))['catch'](handleError(_0x1e2132,null));};exports[_0xc3fb('0x6a')]=function(_0x409038,_0x5e7ad2,_0x31e66c){return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x409038[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x5e7ad2,null))[_0xc3fb('0x1e')](function(_0x548676){if(_0x548676){return _0x548676[_0xc3fb('0x6a')](_0x409038[_0xc3fb('0x3f')]['ids']);}})[_0xc3fb('0x1e')](respondWithStatusCode(_0x5e7ad2,null))['catch'](handleError(_0x5e7ad2,null));};exports[_0xc3fb('0x6b')]=function(_0x339865,_0x17facf,_0x28a506){var _0x1857a0={'channel':'sms'};var _0x480e00=[];var _0x497a6a=[];var _0x5b1c2f={};return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x339865[_0xc3fb('0x5e')]['id']},'include':[{'model':db[_0xc3fb('0x6c')],'as':_0xc3fb('0x6d')}]})[_0xc3fb('0x1e')](handleEntityNotFound(_0x17facf,null))[_0xc3fb('0x1e')](function(_0x7bc312){_0x1857a0[_0xc3fb('0x6e')]=_0x7bc312;_0x1857a0[_0xc3fb('0x6f')]=_[_0xc3fb('0x70')](_0x7bc312['Applications'],['priority'],['asc']);if(_0x1857a0['account'][_0xc3fb('0x6d')]){delete _0x1857a0[_0xc3fb('0x6e')][_0xc3fb('0x6d')];}return db[_0xc3fb('0x71')][_0xc3fb('0x5f')]();})[_0xc3fb('0x1e')](function(_0x57abb3){if(!_0x57abb3){throw new db['Sequelize'][(_0xc3fb('0x72'))](_0xc3fb('0x73'));}_0x480e00=_[_0xc3fb('0x74')](_['keys'](_0x57abb3),[_0xc3fb('0x75'),'updatedAt']);_0x497a6a=_[_0xc3fb('0x74')](_[_0xc3fb('0x40')](_0x57abb3),[_0xc3fb('0x75'),_0xc3fb('0x76'),_0xc3fb('0x77'),_0xc3fb('0x78')]);_0x1857a0['body']={'mapKey':_0xc3fb('0x79')};if(_0x1857a0[_0xc3fb('0x6e')][_0xc3fb('0x4e')]){switch(_0x1857a0[_0xc3fb('0x6e')]['type']){case _0xc3fb('0x7a'):_0x1857a0['body'][_0xc3fb('0x7b')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x7c')];_0x1857a0[_0xc3fb('0x59')]['body']=_0x339865['body'][_0xc3fb('0x7d')];_0x1857a0['body'][_0xc3fb('0x7e')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x7f')];break;case _0xc3fb('0x80'):_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')]='+'+_0x339865[_0xc3fb('0x59')][_0xc3fb('0x81')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')]=_0x339865['body'][_0xc3fb('0x82')];break;case _0xc3fb('0x83'):_0x1857a0[_0xc3fb('0x59')]['from']=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x7b')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x25')];break;case _0xc3fb('0x84'):_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')]=_0x339865['body']['from'];_0x1857a0['body'][_0xc3fb('0x59')]=_0x339865['body'][_0xc3fb('0x59')];_0x1857a0[_0xc3fb('0x59')]['messageId']=_0x339865['body'][_0xc3fb('0x85')];break;case _0xc3fb('0x86'):_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')]=_0x339865['body'][_0xc3fb('0x7c')];_0x1857a0['body'][_0xc3fb('0x59')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x87')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7e')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x88')];break;case _0xc3fb('0x89'):_0x1857a0['body'][_0xc3fb('0x7b')]='+'+_0x339865['body'][_0xc3fb('0x8a')][0x0][_0xc3fb('0x7b')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')]=_0x339865[_0xc3fb('0x59')]['results'][0x0][_0xc3fb('0x82')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7e')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x8a')][0x0]['messageId'];break;case _0xc3fb('0x8b'):_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')]=_0x339865[_0xc3fb('0x59')]['originatingAddress'];_0x1857a0[_0xc3fb('0x59')]['body']=_0x339865['body'][_0xc3fb('0x8c')]['message'];break;case _0xc3fb('0x8d'):_0x1857a0['body'][_0xc3fb('0x7b')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x8e')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x82')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7e')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x8f')];break;case'bandwidth':_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7e')]=_0x339865[_0xc3fb('0x59')][0x0]['message']['id'];_0x1857a0[_0xc3fb('0x59')]['from']=_0x339865[_0xc3fb('0x59')][0x0][_0xc3fb('0x25')][_0xc3fb('0x7b')];_0x1857a0['body'][_0xc3fb('0x59')]=_0x339865[_0xc3fb('0x59')][0x0]['message'][_0xc3fb('0x82')];break;case _0xc3fb('0x90'):_0x1857a0['body'][_0xc3fb('0x7b')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x7b')];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')]=_0x339865['body']['message'];_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7e')]=_0x339865[_0xc3fb('0x59')][_0xc3fb('0x91')];break;}}if(_0x1857a0[_0xc3fb('0x59')]['id']){delete _0x1857a0[_0xc3fb('0x59')]['id'];}if(_[_0xc3fb('0x92')](_0x1857a0[_0xc3fb('0x59')]['from'])){throw new db[(_0xc3fb('0x93'))]['ValidationError'](_0xc3fb('0x94'));}if(_[_0xc3fb('0x92')](_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')])||_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x59')]===''){throw new db['Sequelize'][(_0xc3fb('0x72'))](_0xc3fb('0x95'));}if(_[_0xc3fb('0x92')](_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x96')])){throw new db[(_0xc3fb('0x93'))][(_0xc3fb('0x72'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x497a6a);}if(!_['includes'](_0x497a6a,_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x96')])){throw new db[(_0xc3fb('0x93'))][(_0xc3fb('0x72'))](_0xc3fb('0x97')+_0x497a6a);}_0x5b1c2f[_0x1857a0['body'][_0xc3fb('0x96')]]=_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')];return db[_0xc3fb('0x98')][_0xc3fb('0x57')]({'where':{'id':_0x1857a0['account'][_0xc3fb('0x78')]},'include':[{'model':db['CmContact'],'as':_0xc3fb('0x99'),'where':_0x5b1c2f,'limit':0x1,'order':[[_0xc3fb('0x76'),'DESC']]}]});})[_0xc3fb('0x1e')](handleEntityNotFound(_0x17facf,null))['then'](function(_0xacecb4){if(_0xacecb4){_0x1857a0[_0xc3fb('0x9a')]=_[_0xc3fb('0x9b')](_0xacecb4,['Contacts']);if(_0xacecb4[_0xc3fb('0x99')][_0xc3fb('0x46')]){return _0xacecb4[_0xc3fb('0x99')][0x0];}var _0x1f628b=_[_0xc3fb('0x9c')](_0x1857a0[_0xc3fb('0x59')],{'firstName':_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')],'ListId':_0xacecb4['id']});_0x1f628b[_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x96')]]=_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')];return db[_0xc3fb('0x71')][_0xc3fb('0x58')](_0x1f628b,{'fields':_0x480e00,'raw':!![]});}})['then'](handleEntityNotFound(_0x17facf,null))[_0xc3fb('0x1e')](function(_0x377270){if(_0x377270){_0x1857a0[_0xc3fb('0x9d')]=_0x377270;var _0x2b65fc={'ContactId':_0x377270['id'],'phone':_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')],'SmsAccountId':_0x339865['params']['id']};var _0x1d374b={'ContactId':_0x377270['id'],'SmsAccountId':_0x339865[_0xc3fb('0x5e')]['id'],'closed':![]};return db['SmsInteraction'][_0xc3fb('0x57')]({'where':_0x1d374b})['then'](function(_0x49bf33){if(_0x49bf33){return[_0x49bf33,![]];}return db[_0xc3fb('0x9e')]['create'](_0x2b65fc)[_0xc3fb('0x1e')](function(_0x4e586c){return[_0x4e586c,!![]];});});}})[_0xc3fb('0x9f')](function(_0x5d8f74,_0x487d8b){_0x1857a0['interaction']=_0x5d8f74['get']({'plain':!![]});_0x1857a0[_0xc3fb('0xa0')][_0xc3fb('0xa1')]=![];if(_0x487d8b){if(_0x1857a0[_0xc3fb('0x6e')][_0xc3fb('0xa2')]){_0x1857a0[_0xc3fb('0x6f')][_0xc3fb('0xa3')]({'id':0x0,'priority':_0x1857a0[_0xc3fb('0x6f')][_0xc3fb('0x46')]+0x1,'app':'close','appdata':_0xc3fb('0xa4'),'interval':_0xc3fb('0xa5')});}_0x1857a0['interaction'][_0xc3fb('0xa1')]=!![];}return db[_0xc3fb('0xa6')][_0xc3fb('0x58')]({'phone':_0x1857a0[_0xc3fb('0x59')][_0xc3fb('0x7b')],'messageId':_0x1857a0['body'][_0xc3fb('0x7e')],'body':_0x1857a0[_0xc3fb('0x59')]['body'],'SmsAccountId':_0x339865[_0xc3fb('0x5e')]['id'],'SmsInteractionId':_0x5d8f74['id'],'direction':'in','ContactId':_0x5d8f74['ContactId'],'AttachmentId':_0x1857a0['body'][_0xc3fb('0xa7')]});})[_0xc3fb('0x1e')](function(_0x37afa9){_0x1857a0[_0xc3fb('0x25')]=_0x37afa9;if(_0x1857a0[_0xc3fb('0xa0')]['UserId']){return db['User'][_0xc3fb('0x57')]({'attributes':['id',_0xc3fb('0x38')],'where':{'id':_0x1857a0['interaction']['UserId']}})[_0xc3fb('0x1e')](function(_0x3ffb91){if(_0x3ffb91){_0x1857a0[_0xc3fb('0x6f')][_0xc3fb('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3ffb91[_0xc3fb('0x38')]+','+(_0x1857a0[_0xc3fb('0x6e')][_0xc3fb('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc3fb('0xaa'),_0xc3fb('0xab'),_0x1857a0);});}return respondWithRpcPromise(_0xc3fb('0xaa'),_0xc3fb('0xab'),_0x1857a0);})[_0xc3fb('0x1e')](function(_0x318235){if(_0x318235){var _0x392c91=0xc8;var _0x4e7564=_0xc3fb('0xac');logger[_0xc3fb('0x1f')](_0xc3fb('0x22'),_0x4e7564,_0x392c91,'entity\x20found');logger[_0xc3fb('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4e7564,_0x392c91,'entity\x20found',JSON['stringify'](_0x318235));if(_0x1857a0[_0xc3fb('0x6e')][_0xc3fb('0x4e')]==='twilio'){return _0x17facf[_0xc3fb('0x29')](_0x392c91)[_0xc3fb('0xad')](_0xc3fb('0xae'),_0xc3fb('0xaf'))[_0xc3fb('0xb0')](_0xc3fb('0xb1'));}else{return _0x17facf[_0xc3fb('0x29')](_0x392c91)['json'](_0x318235);}}})[_0xc3fb('0x54')](handleError(_0x17facf,null));};exports['addApplications']=function(_0x4e6c76,_0x38919b){var _0x1682f1=_0x4e6c76[_0xc3fb('0x5e')]['id'];var _0x4f96db=_0x4e6c76['body'];var _0x98a15d=0xc8;var _0x2aac32=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xc3fb('0xb2')][_0xc3fb('0xb3')]['ISOLATION_LEVELS'][_0xc3fb('0xb4')]},function(_0x3e9b96){return db[_0xc3fb('0x3c')][_0xc3fb('0x62')]({'where':{'id':_0x1682f1},'transaction':_0x3e9b96})[_0xc3fb('0x1e')](function(_0xc79013){if(_0xc79013){return db[_0xc3fb('0x6c')][_0xc3fb('0x36')]({'where':{'SmsAccountId':_0x1682f1},'transaction':_0x3e9b96})[_0xc3fb('0x1e')](function(){var _0x1267d0=_[_0xc3fb('0x3b')](_0x4f96db,function(_0xed113e){_0xed113e[_0xc3fb('0x60')]=_0x1682f1;return _0xed113e;});return db[_0xc3fb('0x6c')][_0xc3fb('0xb5')](_0x1267d0,{'transaction':_0x3e9b96});});}else{_0x98a15d=0x194;_0x2aac32=[];}});})[_0xc3fb('0x1e')](function(){if(_0x98a15d!==0x194){return db['SmsApplication'][_0xc3fb('0xb6')]({'where':{'SmsAccountId':_0x1682f1},'order':'priority'})['then'](function(_0x5a42b1){_0x2aac32=_0x5a42b1;});}})[_0xc3fb('0x54')](function(_0x1be17e){_0x98a15d=0x1f4;logger['error'](_0x1be17e[_0xc3fb('0x37')]);if(_0x1be17e['name']){delete _0x1be17e['name'];}_0x2aac32=_0x1be17e;})['finally'](function(){if(_0x2aac32===null){_0x38919b[_0xc3fb('0x28')](_0x98a15d);}else{if(_0x98a15d===0x1f4){_0x38919b[_0xc3fb('0x29')](_0x98a15d)[_0xc3fb('0xb0')](_0x2aac32);}else{_0x38919b[_0xc3fb('0x29')](_0x98a15d)['json'](_0x2aac32);}}});};exports[_0xc3fb('0xb7')]=function(_0x45608e,_0x5ab822,_0x566734){var _0x36146b={};var _0x1ffeb5={};var _0x229c12;var _0x2fde16;return db['SmsAccount'][_0xc3fb('0x62')]({'where':{'id':_0x45608e[_0xc3fb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ab822,null))['then'](function(_0x2b4ae5){if(_0x2b4ae5){_0x229c12=_0x2b4ae5;_0x1ffeb5[_0xc3fb('0x43')]=_[_0xc3fb('0x40')](db[_0xc3fb('0x6c')][_0xc3fb('0x3d')]);_0x1ffeb5[_0xc3fb('0x3f')]=_[_0xc3fb('0x40')](_0x45608e[_0xc3fb('0x3f')]);_0x1ffeb5[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0x1ffeb5[_0xc3fb('0x43')],_0x1ffeb5[_0xc3fb('0x3f')]);_0x36146b[_0xc3fb('0x44')]=_[_0xc3fb('0x42')](_0x1ffeb5[_0xc3fb('0x43')],qs[_0xc3fb('0x45')](_0x45608e['query'][_0xc3fb('0x45')]));_0x36146b[_0xc3fb('0x44')]=_0x36146b[_0xc3fb('0x44')][_0xc3fb('0x46')]?_0x36146b[_0xc3fb('0x44')]:_0x1ffeb5[_0xc3fb('0x43')];_0x36146b[_0xc3fb('0x49')]=qs['sort'](_0x45608e[_0xc3fb('0x3f')]['sort']);_0x36146b['where']=qs[_0xc3fb('0x41')](_[_0xc3fb('0x4c')](_0x45608e['query'],_0x1ffeb5[_0xc3fb('0x41')]));if(_0x45608e[_0xc3fb('0x3f')][_0xc3fb('0x4d')]){_0x36146b[_0xc3fb('0x4b')]=_['merge'](_0x36146b[_0xc3fb('0x4b')],{'$or':_['map'](_0x36146b[_0xc3fb('0x44')],function(_0x16fffd){var _0x4c4620={};_0x4c4620[_0x16fffd]={'$like':'%'+_0x45608e['query']['filter']+'%'};return _0x4c4620;})});}_0x36146b=_['merge']({},_0x36146b,_0x45608e[_0xc3fb('0x64')]);return _0x229c12[_0xc3fb('0xb7')](_0x36146b);}})['then'](function(_0x44adff){if(_0x44adff){_0x2fde16=_0x44adff[_0xc3fb('0x46')];if(!_0x45608e[_0xc3fb('0x3f')][_0xc3fb('0x47')](_0xc3fb('0x48'))){_0x36146b[_0xc3fb('0x2e')]=qs['limit'](_0x45608e[_0xc3fb('0x3f')][_0xc3fb('0x2e')]);_0x36146b[_0xc3fb('0x2b')]=qs[_0xc3fb('0x2b')](_0x45608e[_0xc3fb('0x3f')][_0xc3fb('0x2b')]);}return _0x229c12[_0xc3fb('0xb7')](_0x36146b);}})[_0xc3fb('0x1e')](function(_0x1947c1){if(_0x1947c1){return _0x1947c1?{'count':_0x2fde16,'rows':_0x1947c1}:null;}})[_0xc3fb('0x1e')](respondWithResult(_0x5ab822,null))[_0xc3fb('0x54')](handleError(_0x5ab822,null));};exports['getInteractions']=function(_0x5b986d,_0x2843db,_0x153b1e){var _0x9ca8e8={'raw':![],'where':{}};var _0x3a59b1={};var _0x593213={'count':0x0,'rows':[]};return db[_0xc3fb('0x3c')]['findOne']({'where':{'id':_0x5b986d[_0xc3fb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2843db,null))['then'](function(_0x255967){if(_0x255967){_0x3a59b1[_0xc3fb('0x43')]=_[_0xc3fb('0x40')](db['SmsInteraction']['rawAttributes']);_0x3a59b1[_0xc3fb('0x3f')]=_[_0xc3fb('0x40')](_0x5b986d[_0xc3fb('0x3f')]);_0x3a59b1[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0x3a59b1[_0xc3fb('0x43')],_0x3a59b1[_0xc3fb('0x3f')]);_0x9ca8e8[_0xc3fb('0x44')]=_[_0xc3fb('0x42')](_0x3a59b1['model'],qs[_0xc3fb('0x45')](_0x5b986d[_0xc3fb('0x3f')]['fields']));_0x9ca8e8[_0xc3fb('0x44')]=_0x9ca8e8['attributes']['length']?_0x9ca8e8[_0xc3fb('0x44')]:_0x3a59b1[_0xc3fb('0x43')];if(!_0x5b986d['query'][_0xc3fb('0x47')]('nolimit')){_0x9ca8e8[_0xc3fb('0x2e')]=qs[_0xc3fb('0x2e')](_0x5b986d[_0xc3fb('0x3f')][_0xc3fb('0x2e')]);_0x9ca8e8['offset']=qs['offset'](_0x5b986d[_0xc3fb('0x3f')]['offset']);}_0x9ca8e8[_0xc3fb('0x49')]=qs['sort'](_0x5b986d[_0xc3fb('0x3f')][_0xc3fb('0x4a')]);_0x9ca8e8[_0xc3fb('0x4b')]=qs[_0xc3fb('0x41')](_[_0xc3fb('0x4c')](_0x5b986d[_0xc3fb('0x3f')],_0x3a59b1[_0xc3fb('0x41')]));_0x9ca8e8['where'][_0xc3fb('0x60')]=_0x255967['id'];if(_0x5b986d[_0xc3fb('0x3f')]['filter']){_0x9ca8e8['where']=_[_0xc3fb('0x50')](_0x9ca8e8[_0xc3fb('0x4b')],{'$or':_[_0xc3fb('0x3b')](_0x9ca8e8[_0xc3fb('0x44')],function(_0x104533){var _0x29df3b={};_0x29df3b[_0x104533]={'$like':'%'+_0x5b986d['query'][_0xc3fb('0x4d')]+'%'};return _0x29df3b;})});}_0x9ca8e8=_[_0xc3fb('0x50')]({},_0x9ca8e8,_0x5b986d['options']);return db[_0xc3fb('0x9e')][_0xc3fb('0x2d')]({'where':_0x9ca8e8[_0xc3fb('0x4b')]})[_0xc3fb('0x1e')](function(_0x522143){_0x593213[_0xc3fb('0x2d')]=_0x522143;if(_0x5b986d[_0xc3fb('0x3f')]['includeAll']){_0x9ca8e8[_0xc3fb('0x51')]=[{'model':db[_0xc3fb('0x71')],'as':'Contact','required':![]},{'model':db[_0xc3fb('0xb8')],'as':_0xc3fb('0xb9'),'attributes':[_0xc3fb('0x38'),_0xc3fb('0xba'),_0xc3fb('0xbb')],'required':![]},{'model':db[_0xc3fb('0xbc')],'as':'Tags','attributes':['id','name',_0xc3fb('0xbd')],'where':_0x5b986d[_0xc3fb('0x3f')]['tag']?{'id':_0x5b986d[_0xc3fb('0x3f')][_0xc3fb('0xbe')]}:undefined,'required':_0x5b986d[_0xc3fb('0x3f')][_0xc3fb('0xbe')]?!![]:![]}];}return db[_0xc3fb('0x9e')]['findAll'](_0x9ca8e8);})[_0xc3fb('0x1e')](function(_0x235348){_0x593213[_0xc3fb('0x53')]=_0x235348;return _0x593213;});}})[_0xc3fb('0x1e')](respondWithFilteredResult(_0x2843db,_0x9ca8e8))[_0xc3fb('0x54')](handleError(_0x2843db,null));};exports['send']=function(_0x5087e4,_0x4a7c5f,_0x562f41){var _0x4afff0,_0x587159,_0x1d463e;if(_[_0xc3fb('0x92')](_0x5087e4[_0xc3fb('0x59')][_0xc3fb('0x59')])||_0x5087e4['body'][_0xc3fb('0x59')]===''){throw new db[(_0xc3fb('0x93'))][(_0xc3fb('0x72'))](_0xc3fb('0x95'));}if(_[_0xc3fb('0x92')](_0x5087e4[_0xc3fb('0x59')]['to'])){throw new db[(_0xc3fb('0x93'))][(_0xc3fb('0x72'))](_0xc3fb('0xbf'));}_0x4afff0=_0x5087e4[_0xc3fb('0x59')]['to'];return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x5087e4[_0xc3fb('0x5e')]['id']},'include':[{'model':db[_0xc3fb('0x98')],'as':'List','include':[{'model':db[_0xc3fb('0x71')],'as':_0xc3fb('0x99'),'where':{'mobile':_0x4afff0},'limit':0x1,'order':[['updatedAt',_0xc3fb('0xc0')]]}]}]})[_0xc3fb('0x1e')](handleEntityNotFound(_0x4a7c5f,null))[_0xc3fb('0x1e')](function(_0x4d7fb0){if(_0x4d7fb0&&_0x4d7fb0['List']){_0x587159=_0x4d7fb0[_0xc3fb('0x34')]({'plain':!![]});if(_0x587159[_0xc3fb('0xc1')]&&_0x587159[_0xc3fb('0xc1')]['Contacts'][_0xc3fb('0x46')]){return _0x587159[_0xc3fb('0xc1')]['Contacts'][0x0];}return db['CmContact'][_0xc3fb('0x58')](_[_0xc3fb('0x9c')](_0x5087e4[_0xc3fb('0x59')],{'firstName':_0x4afff0,'mobile':_0x4afff0,'phone':_0x4afff0,'ListId':_0x587159[_0xc3fb('0x78')]}));}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x4a7c5f,null))[_0xc3fb('0x1e')](function(_0x5cfe07){if(_0x5cfe07){_0x1d463e=_0x5cfe07;return db[_0xc3fb('0x9e')][_0xc3fb('0x57')]({'where':{'ContactId':_0x1d463e['id'],'closed':![],'SmsAccountId':_0x587159['id']}})['then'](function(_0x263ece){if(_0x263ece){return[_0x263ece,![]];}return db[_0xc3fb('0x9e')][_0xc3fb('0x58')]({'UserId':_0x5087e4['user']['id'],'ContactId':_0x1d463e['id'],'SmsAccountId':_0x587159['id'],'phone':_0x4afff0,'firstMsgDirection':_0xc3fb('0xc2'),'Messages':[_[_0xc3fb('0x50')](_0x5087e4[_0xc3fb('0x59')],{'read':![],'body':_0x5087e4[_0xc3fb('0x59')][_0xc3fb('0x59')],'phone':_0x4afff0,'SmsAccountId':_0x587159['id'],'UserId':_0x5087e4['user']['id'],'ContactId':_0x1d463e['id']})]},{'include':[{'model':db[_0xc3fb('0xa6')],'as':_0xc3fb('0xc3')}]})[_0xc3fb('0x1e')](function(_0xc5e5bd){return[_0xc5e5bd,!![]];});});}})[_0xc3fb('0x9f')](function(_0x29e00a,_0x3f1fd7){if(_0x3f1fd7){return _0x29e00a;}return db['SmsMessage']['create'](_[_0xc3fb('0x50')](_0x5087e4[_0xc3fb('0x59')],{'read':![],'body':_0x5087e4['body'][_0xc3fb('0x59')],'phone':_0x4afff0,'SmsAccountId':_0x587159['id'],'SmsInteractionId':_0x29e00a['id'],'UserId':_0x5087e4[_0xc3fb('0x5a')]['id'],'ContactId':_0x1d463e['id']}))[_0xc3fb('0x1e')](function(_0x35c627){_0x29e00a[_0xc3fb('0xc4')][_0xc3fb('0xc3')]=[];_0x29e00a['dataValues'][_0xc3fb('0xc3')][_0xc3fb('0xa3')](_0x35c627[_0xc3fb('0xc4')]);return _0x29e00a;});})[_0xc3fb('0x1e')](respondWithResult(_0x4a7c5f,null))[_0xc3fb('0x54')](handleError(_0x4a7c5f,null));};exports[_0xc3fb('0x29')]=function(_0x3a171b,_0x41afb4,_0x4b3eae){if(_0x3a171b[_0xc3fb('0x59')]['id']){delete _0x3a171b[_0xc3fb('0x59')]['id'];}var _0x3db68c,_0x5edbfd,_0x29d5ec;return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x3a171b['params']['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x41afb4,null))['then'](function(_0x3bcffb){if(_0x3bcffb){_0x29d5ec=_0x3bcffb;logger[_0xc3fb('0x21')](_0xc3fb('0x22'),_0xc3fb('0x29'),_0xc3fb('0xc5'),_0x3bcffb['type'],util[_0xc3fb('0xc6')](_0x3a171b[_0xc3fb('0x59')],{'showHidden':![],'depth':null}));switch(_0x3bcffb['type']){case _0xc3fb('0x80'):if(_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xc7')]&&_0x3a171b[_0xc3fb('0x59')]['status']){_0x5edbfd=_0x3a171b['body'][_0xc3fb('0x29')];return db[_0xc3fb('0xa6')][_0xc3fb('0x57')]({'where':{'messageId':_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xc7')]}});}break;case _0xc3fb('0x83'):if(_0x3a171b[_0xc3fb('0x59')]['requestid']&&_0x3a171b['body'][_0xc3fb('0xc8')]){_0x5edbfd=_0x3a171b[_0xc3fb('0x59')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xc9')]}});}break;case _0xc3fb('0x84'):if(_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0x85')]&&_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xca')]){_0x5edbfd=_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xca')];return db[_0xc3fb('0xa6')]['find']({'where':{'messageId':_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0x85')]}});}break;case _0xc3fb('0x89'):var _0x3af534=_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0x8a')][0x0];if(_0x3af534[_0xc3fb('0x7e')]&&_0x3af534[_0xc3fb('0x29')][_0xc3fb('0xcb')]===_0xc3fb('0xcc')){_0x5edbfd=_0x3af534[_0xc3fb('0x29')][_0xc3fb('0xcb')];return db[_0xc3fb('0xa6')][_0xc3fb('0x57')]({'where':{'messageId':_0x3af534[_0xc3fb('0x7e')]}});}break;case _0xc3fb('0x8d'):if(_0x3a171b[_0xc3fb('0x59')]['messageId']&&_0x3a171b['body']['status']){_0x5edbfd=_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0x29')];return db['SmsMessage'][_0xc3fb('0x57')]({'where':{'messageId':_0x3a171b['body'][_0xc3fb('0x7e')]}});}break;case'bandwidth':if(_0x3a171b[_0xc3fb('0x59')][0x0][_0xc3fb('0x25')]['id']){_0x5edbfd=_0x3a171b[_0xc3fb('0x59')][0x0]['type'];return db[_0xc3fb('0xa6')][_0xc3fb('0x57')]({'where':{'messageId':_0x3a171b[_0xc3fb('0x59')][0x0][_0xc3fb('0x25')]['id']}});}break;case _0xc3fb('0x90'):if(_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xcd')]&&_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0x29')]){_0x5edbfd=_0x3a171b['body'][_0xc3fb('0x29')];return db['SmsMessage']['find']({'where':{'messageId':_0x3a171b[_0xc3fb('0x59')]['redif']}});}break;}}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x41afb4,null))['then'](function(_0x5de776){if(_0x5de776){_0x3db68c=_0x5de776;switch(_0x29d5ec[_0xc3fb('0x4e')]){case'skebby':if(_0x5edbfd===_0xc3fb('0xcc')){return _0x3db68c[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')](_0xc3fb('0x22'),_0xc3fb('0x29'),_0xc3fb('0x80'),util[_0xc3fb('0xc6')](_0x3a171b[_0xc3fb('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5edbfd==='1'){return _0x3db68c['update']({'read':!![]});}else{logger[_0xc3fb('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc3fb('0x29'),_0xc3fb('0x80'),util[_0xc3fb('0xc6')](_0x3a171b[_0xc3fb('0x59')],{'showHidden':![],'depth':null}));}break;case _0xc3fb('0x84'):if(!_0x3a171b[_0xc3fb('0x59')][_0xc3fb('0xce')]&&_0x5edbfd>=0xc8&&_0x5edbfd<=0xce){return _0x3db68c[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')](_0xc3fb('0x22'),'status','clicksend',util[_0xc3fb('0xc6')](_0x3a171b['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2bc7e4=_0x3a171b[_0xc3fb('0x59')]['results'][0x0];if(_0x2bc7e4[_0xc3fb('0x29')][_0xc3fb('0xcb')]===_0xc3fb('0xcc')){return _0x3db68c[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')](_0xc3fb('0x22'),_0xc3fb('0x29'),'infobip',util[_0xc3fb('0xc6')](_0x3a171b[_0xc3fb('0x59')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5edbfd==_0xc3fb('0xcf')||_0x5edbfd==_0xc3fb('0xd0')){return _0x3db68c[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')](_0xc3fb('0x22'),_0xc3fb('0x29'),_0xc3fb('0x8d'),util['inspect'](_0x3a171b['body'],{'showHidden':![],'depth':null}));}break;case _0xc3fb('0xd1'):if(_0x5edbfd==_0xc3fb('0xd2')){return _0x3db68c[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc3fb('0x29'),'bandwidth',util['inspect'](_0x3a171b[_0xc3fb('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5edbfd===_0xc3fb('0xd3')||_0x5edbfd===_0xc3fb('0xd4')){return _0x3db68c[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')](_0xc3fb('0x22'),_0xc3fb('0x29'),_0xc3fb('0x90'),util[_0xc3fb('0xc6')](_0x3a171b['body'],{'showHidden':![],'depth':null}));}break;}return _0x3db68c;}})[_0xc3fb('0x1e')](respondWithResult(_0x41afb4,null))[_0xc3fb('0x54')](handleError(_0x41afb4,null));};exports[_0xc3fb('0xd5')]=function(_0x2338a8,_0x515974,_0xa62b6a){var _0x4e1bfc,_0x50aab5,_0x5f5bd2;return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x2338a8[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x515974,null))[_0xc3fb('0x1e')](function(_0x4ea085){if(_0x4ea085){_0x5f5bd2=_0x4ea085;logger['debug'](_0xc3fb('0x22'),_0xc3fb('0x29'),_0xc3fb('0xc5'),_0x4ea085['type'],util[_0xc3fb('0xc6')](_0x2338a8[_0xc3fb('0x3f')],{'showHidden':![],'depth':null}));switch(_0x4ea085['type']){case _0xc3fb('0x8b'):if(_0x2338a8[_0xc3fb('0x3f')][_0xc3fb('0xd6')]&&_0x2338a8['query'][_0xc3fb('0xd7')]){_0x50aab5=_0x2338a8[_0xc3fb('0x3f')]['state'];return db[_0xc3fb('0xa6')][_0xc3fb('0x57')]({'where':{'messageId':_0x2338a8[_0xc3fb('0x3f')][_0xc3fb('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x515974,null))[_0xc3fb('0x1e')](function(_0x37b723){if(_0x37b723){_0x4e1bfc=_0x37b723;switch(_0x5f5bd2[_0xc3fb('0x4e')]){case _0xc3fb('0x8b'):if(_0x50aab5==='2'||_0x50aab5==='6'){return _0x4e1bfc[_0xc3fb('0x33')]({'read':!![]});}else{logger[_0xc3fb('0x24')](_0xc3fb('0x22'),_0xc3fb('0x29'),_0xc3fb('0x8b'),util[_0xc3fb('0xc6')](_0x2338a8[_0xc3fb('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x4e1bfc;}})[_0xc3fb('0x1e')](respondWithResult(_0x515974,null))[_0xc3fb('0x54')](handleError(_0x515974,null));};exports[_0xc3fb('0xd8')]=function(_0x3970f1,_0xbdf688,_0x2ed1f9){return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x3970f1[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0xbdf688,null))['then'](function(_0x5ebb66){if(_0x5ebb66){return _0x5ebb66[_0xc3fb('0xd8')](_0x3970f1[_0xc3fb('0x59')][_0xc3fb('0x66')],_[_0xc3fb('0x9b')](_0x3970f1[_0xc3fb('0x59')],[_0xc3fb('0x66'),'id'])||{})[_0xc3fb('0x9f')](function(_0x3834ff){for(var _0x3a78e8=0x0;_0x3a78e8<_0x3970f1[_0xc3fb('0x59')][_0xc3fb('0x66')]['length'];_0x3a78e8+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x3970f1[_0xc3fb('0x59')][_0xc3fb('0x66')][_0x3a78e8]),'SmsAccountId':Number(_0x3970f1['params']['id'])});}return _0x3834ff;});}})[_0xc3fb('0x1e')](respondWithResult(_0xbdf688,null))[_0xc3fb('0x54')](handleError(_0xbdf688,null));};exports['removeAgents']=function(_0x121bb5,_0x377345,_0x39f6df){return db[_0xc3fb('0x3c')][_0xc3fb('0x57')]({'where':{'id':_0x121bb5[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x377345,null))[_0xc3fb('0x1e')](function(_0x57c4ce){if(_0x57c4ce){return _0x57c4ce['removeAgents'](_0x121bb5['query']['ids'])[_0xc3fb('0x1e')](function(){if(_[_0xc3fb('0xd9')](_0x121bb5[_0xc3fb('0x3f')][_0xc3fb('0x66')])){for(var _0x10a114=0x0;_0x10a114<_0x121bb5[_0xc3fb('0x3f')][_0xc3fb('0x66')][_0xc3fb('0x46')];_0x10a114+=0x1){socket[_0xc3fb('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x121bb5['query'][_0xc3fb('0x66')][_0x10a114]),'SmsAccountId':Number(_0x121bb5['params']['id'])});}}else{socket[_0xc3fb('0xda')](_0xc3fb('0xdb'),{'UserId':Number(_0x121bb5[_0xc3fb('0x3f')]['ids']),'SmsAccountId':Number(_0x121bb5[_0xc3fb('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x377345,null))[_0xc3fb('0x54')](handleError(_0x377345,null));};exports[_0xc3fb('0xdc')]=function(_0x1eb25a,_0x25dda2,_0x5aeea6){var _0x32864d={};var _0xb89d93={};var _0xc8aa21;var _0x6188a7;return db[_0xc3fb('0x3c')]['findOne']({'where':{'id':_0x1eb25a[_0xc3fb('0x5e')]['id']}})[_0xc3fb('0x1e')](handleEntityNotFound(_0x25dda2,null))[_0xc3fb('0x1e')](function(_0x16538c){if(_0x16538c){_0xc8aa21=_0x16538c;_0xb89d93[_0xc3fb('0x43')]=_[_0xc3fb('0x40')](db[_0xc3fb('0xb8')][_0xc3fb('0x3d')]);_0xb89d93[_0xc3fb('0x3f')]=_[_0xc3fb('0x40')](_0x1eb25a['query']);_0xb89d93[_0xc3fb('0x41')]=_[_0xc3fb('0x42')](_0xb89d93[_0xc3fb('0x43')],_0xb89d93[_0xc3fb('0x3f')]);_0x32864d[_0xc3fb('0x44')]=_['intersection'](_0xb89d93[_0xc3fb('0x43')],qs['fields'](_0x1eb25a[_0xc3fb('0x3f')]['fields']));_0x32864d[_0xc3fb('0x44')]=_0x32864d[_0xc3fb('0x44')]['length']?_0x32864d['attributes']:_0xb89d93[_0xc3fb('0x43')];_0x32864d[_0xc3fb('0x49')]=qs[_0xc3fb('0x4a')](_0x1eb25a[_0xc3fb('0x3f')][_0xc3fb('0x4a')]);_0x32864d[_0xc3fb('0x4b')]=qs[_0xc3fb('0x41')](_[_0xc3fb('0x4c')](_0x1eb25a[_0xc3fb('0x3f')],_0xb89d93[_0xc3fb('0x41')]));if(_0x1eb25a[_0xc3fb('0x3f')][_0xc3fb('0x4d')]){_0x32864d[_0xc3fb('0x4b')]=_[_0xc3fb('0x50')](_0x32864d['where'],{'$or':_[_0xc3fb('0x3b')](_0x32864d['attributes'],function(_0x483d8a){var _0x4094f1={};_0x4094f1[_0x483d8a]={'$like':'%'+_0x1eb25a[_0xc3fb('0x3f')]['filter']+'%'};return _0x4094f1;})});}_0x32864d=_['merge']({},_0x32864d,_0x1eb25a[_0xc3fb('0x64')]);return _0xc8aa21[_0xc3fb('0xdc')](_0x32864d);}})[_0xc3fb('0x1e')](function(_0x4ff743){if(_0x4ff743){_0x6188a7=_0x4ff743[_0xc3fb('0x46')];if(!_0x1eb25a[_0xc3fb('0x3f')]['hasOwnProperty'](_0xc3fb('0x48'))){_0x32864d[_0xc3fb('0x2e')]=qs[_0xc3fb('0x2e')](_0x1eb25a[_0xc3fb('0x3f')][_0xc3fb('0x2e')]);_0x32864d[_0xc3fb('0x2b')]=qs[_0xc3fb('0x2b')](_0x1eb25a['query'][_0xc3fb('0x2b')]);}return _0xc8aa21[_0xc3fb('0xdc')](_0x32864d);}})['then'](function(_0x184586){if(_0x184586){return _0x184586?{'count':_0x6188a7,'rows':_0x184586}:null;}})['then'](respondWithResult(_0x25dda2,null))[_0xc3fb('0x54')](handleError(_0x25dda2,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c8c1b46..ef40afd 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 _0xfdaa=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0xfdaa,0x14b));var _0xafda=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xfdaa[_0x36b400];return _0x4d47bf;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xafda('0x0'))['db'][_0xafda('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xafda('0x2')](0x0);var events={'afterCreate':_0xafda('0x3'),'afterUpdate':'update','afterDestroy':_0xafda('0x4')};function emitEvent(_0x4e1047){return function(_0x585f8b,_0x4bbcdf,_0x379e20){SmsAccountEvents['emit'](_0x4e1047+':'+_0x585f8b['id'],_0x585f8b);SmsAccountEvents[_0xafda('0x5')](_0x4e1047,_0x585f8b);_0x379e20(null);};}for(var e in events){if(events[_0xafda('0x6')](e)){var event=events[e];SmsAccount[_0xafda('0x7')](e,emitEvent(event));}}module[_0xafda('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x97d2=['emit','hook','events','SmsAccount','save','update','remove'];(function(_0x27fad5,_0x4a1727){var _0x289fe8=function(_0x1f6cb1){while(--_0x1f6cb1){_0x27fad5['push'](_0x27fad5['shift']());}};_0x289fe8(++_0x4a1727);}(_0x97d2,0x160));var _0x297d=function(_0x1d667c,_0x30068c){_0x1d667c=_0x1d667c-0x0;var _0x2536eb=_0x97d2[_0x1d667c];return _0x2536eb;};'use strict';var EventEmitter=require(_0x297d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x297d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x297d('0x2'),'afterUpdate':_0x297d('0x3'),'afterDestroy':_0x297d('0x4')};function emitEvent(_0x13c860){return function(_0x43268e,_0x32c219,_0x3d14ad){SmsAccountEvents[_0x297d('0x5')](_0x13c860+':'+_0x43268e['id'],_0x43268e);SmsAccountEvents[_0x297d('0x5')](_0x13c860,_0x43268e);_0x3d14ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x297d('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 81b5ab8..5ef0b1e 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 _0x8cdf=['define','SmsAccount','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x8cdf,0x65));var _0xf8cd=function(_0x153027,_0x4026ea){_0x153027=_0x153027-0x0;var _0xa2231c=_0x8cdf[_0x153027];return _0xa2231c;};'use strict';var _=require(_0xf8cd('0x0'));var util=require(_0xf8cd('0x1'));var logger=require('../../config/logger')(_0xf8cd('0x2'));var moment=require(_0xf8cd('0x3'));var BPromise=require(_0xf8cd('0x4'));var rp=require(_0xf8cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8cd('0x6'));var config=require(_0xf8cd('0x7'));var attributes=require(_0xf8cd('0x8'));module['exports']=function(_0x43e956,_0x34776a){return _0x43e956[_0xf8cd('0x9')](_0xf8cd('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdffe=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45f90f,_0x5070b5){var _0x3a26b4=function(_0x529d84){while(--_0x529d84){_0x45f90f['push'](_0x45f90f['shift']());}};_0x3a26b4(++_0x5070b5);}(_0xdffe,0x1ac));var _0xedff=function(_0x45a263,_0x2c0be7){_0x45a263=_0x45a263-0x0;var _0x337fe2=_0xdffe[_0x45a263];return _0x337fe2;};'use strict';var _=require(_0xedff('0x0'));var util=require(_0xedff('0x1'));var logger=require(_0xedff('0x2'))(_0xedff('0x3'));var moment=require(_0xedff('0x4'));var BPromise=require(_0xedff('0x5'));var rp=require(_0xedff('0x6'));var fs=require('fs');var path=require(_0xedff('0x7'));var rimraf=require(_0xedff('0x8'));var config=require(_0xedff('0x9'));var attributes=require(_0xedff('0xa'));module[_0xedff('0xb')]=function(_0x5d2dae,_0x4c65c6){return _0x5d2dae[_0xedff('0xc')](_0xedff('0xd'),attributes,{'tableName':_0xedff('0xe'),'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 6da9dbf..e6c40ab 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 _0xf46d=['SmsAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','map','model','attributes','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x455a41,_0x53cb5c){var _0x954704=function(_0x4ec3d8){while(--_0x4ec3d8){_0x455a41['push'](_0x455a41['shift']());}};_0x954704(++_0x53cb5c);}(_0xf46d,0x1b2));var _0xdf46=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xf46d[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xdf46('0x0'));var util=require(_0xdf46('0x1'));var moment=require('moment');var BPromise=require(_0xdf46('0x2'));var rs=require(_0xdf46('0x3'));var fs=require('fs');var Redis=require(_0xdf46('0x4'));var db=require(_0xdf46('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf46('0x6'))(_0xdf46('0x7'));var config=require(_0xdf46('0x8'));var jayson=require(_0xdf46('0x9'));var client=jayson[_0xdf46('0xa')][_0xdf46('0xb')]({'port':0x232a});config[_0xdf46('0xc')]=_[_0xdf46('0xd')](config[_0xdf46('0xc')],{'host':_0xdf46('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf46('0xc')]));require(_0xdf46('0xf'))[_0xdf46('0x10')](socket);function respondWithRpcPromise(_0x4958d2,_0x1ecde4,_0x108529){return new BPromise(function(_0x554e41,_0x138faf){return client[_0xdf46('0x11')](_0x4958d2,_0x108529)[_0xdf46('0x12')](function(_0x2c87bc){logger[_0xdf46('0x13')](_0xdf46('0x14'),_0x1ecde4,_0xdf46('0x15'));logger['debug'](_0xdf46('0x16'),_0x1ecde4,_0xdf46('0x15'),JSON['stringify'](_0x2c87bc));if(_0x2c87bc['error']){if(_0x2c87bc['error'][_0xdf46('0x17')]===0x1f4){logger[_0xdf46('0x18')](_0xdf46('0x14'),_0x1ecde4,_0x2c87bc[_0xdf46('0x18')]['message']);return _0x138faf(_0x2c87bc[_0xdf46('0x18')][_0xdf46('0x19')]);}logger[_0xdf46('0x18')](_0xdf46('0x14'),_0x1ecde4,_0x2c87bc[_0xdf46('0x18')]['message']);return _0x554e41(_0x2c87bc[_0xdf46('0x18')]['message']);}else{logger['info'](_0xdf46('0x14'),_0x1ecde4,_0xdf46('0x15'));_0x554e41(_0x2c87bc[_0xdf46('0x1a')]['message']);}})[_0xdf46('0x1b')](function(_0x4c00ac){logger[_0xdf46('0x18')](_0xdf46('0x14'),_0x1ecde4,_0x4c00ac);_0x138faf(_0x4c00ac);});});}exports[_0xdf46('0x1c')]=function(_0x5d5fd8){var _0x36d657=this;return new Promise(function(_0x3f256f,_0x34a62d){return db[_0xdf46('0x1d')][_0xdf46('0x1e')]({'raw':_0x5d5fd8[_0xdf46('0x1f')]?_0x5d5fd8[_0xdf46('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5d5fd8[_0xdf46('0x1f')]?_0x5d5fd8[_0xdf46('0x1f')][_0xdf46('0x20')]||null:null,'attributes':_0x5d5fd8['options']?_0x5d5fd8[_0xdf46('0x1f')]['attributes']||null:null,'include':_0x5d5fd8[_0xdf46('0x1f')]?_0x5d5fd8[_0xdf46('0x1f')][_0xdf46('0x21')]?_[_0xdf46('0x22')](_0x5d5fd8[_0xdf46('0x1f')][_0xdf46('0x21')],function(_0x12ab38){return{'model':db[_0x12ab38[_0xdf46('0x23')]],'as':_0x12ab38['as'],'attributes':_0x12ab38['attributes'],'include':_0x12ab38[_0xdf46('0x21')]?_[_0xdf46('0x22')](_0x12ab38[_0xdf46('0x21')],function(_0x140521){return{'model':db[_0x140521['model']],'as':_0x140521['as'],'attributes':_0x140521[_0xdf46('0x24')],'include':_0x140521[_0xdf46('0x21')]?_[_0xdf46('0x22')](_0x140521[_0xdf46('0x21')],function(_0x5a18d7){return{'model':db[_0x5a18d7[_0xdf46('0x23')]],'as':_0x5a18d7['as'],'attributes':_0x5a18d7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf46('0x12')](function(_0x251efb){logger['info'](_0xdf46('0x1c'),_0x5d5fd8);logger['debug'](_0xdf46('0x1c'),_0x5d5fd8,JSON[_0xdf46('0x25')](_0x251efb));_0x3f256f(_0x251efb);})[_0xdf46('0x1b')](function(_0x433bb4){logger['error'](_0xdf46('0x1c'),_0x433bb4[_0xdf46('0x19')],_0x5d5fd8);_0x34a62d(_0x36d657[_0xdf46('0x18')](0x1f4,_0x433bb4['message']));});});}; \ No newline at end of file +var _0x5572=['error','message','info','SmsAccount,\x20%s,\x20%s','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./smsAccount.socket','request','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3aa889,_0x45a1f7){var _0x4ea2d8=function(_0x16a3de){while(--_0x16a3de){_0x3aa889['push'](_0x3aa889['shift']());}};_0x4ea2d8(++_0x45a1f7);}(_0x5572,0x192));var _0x2557=function(_0x4262c7,_0x5c47bc){_0x4262c7=_0x4262c7-0x0;var _0x5a7497=_0x5572[_0x4262c7];return _0x5a7497;};'use strict';var _=require(_0x2557('0x0'));var util=require(_0x2557('0x1'));var moment=require(_0x2557('0x2'));var BPromise=require(_0x2557('0x3'));var rs=require(_0x2557('0x4'));var fs=require('fs');var Redis=require(_0x2557('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2557('0x6'));var logger=require('../../config/logger')(_0x2557('0x7'));var config=require(_0x2557('0x8'));var jayson=require(_0x2557('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2557('0xa')]=_['defaults'](config['redis'],{'host':_0x2557('0xb'),'port':0x18eb});var socket=require(_0x2557('0xc'))(new Redis(config[_0x2557('0xa')]));require(_0x2557('0xd'))['register'](socket);function respondWithRpcPromise(_0x55ca69,_0x5769bb,_0x4088d9){return new BPromise(function(_0x43bb19,_0x239627){return client[_0x2557('0xe')](_0x55ca69,_0x4088d9)['then'](function(_0x47df37){logger['info']('SmsAccount,\x20%s,\x20%s',_0x5769bb,'request\x20sent');logger['debug'](_0x2557('0xf'),_0x5769bb,_0x2557('0x10'),JSON[_0x2557('0x11')](_0x47df37));if(_0x47df37[_0x2557('0x12')]){if(_0x47df37[_0x2557('0x12')]['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5769bb,_0x47df37[_0x2557('0x12')][_0x2557('0x13')]);return _0x239627(_0x47df37[_0x2557('0x12')][_0x2557('0x13')]);}logger[_0x2557('0x12')]('SmsAccount,\x20%s,\x20%s',_0x5769bb,_0x47df37[_0x2557('0x12')][_0x2557('0x13')]);return _0x43bb19(_0x47df37[_0x2557('0x12')][_0x2557('0x13')]);}else{logger[_0x2557('0x14')](_0x2557('0x15'),_0x5769bb,'request\x20sent');_0x43bb19(_0x47df37['result'][_0x2557('0x13')]);}})[_0x2557('0x16')](function(_0x4efa23){logger['error'](_0x2557('0x15'),_0x5769bb,_0x4efa23);_0x239627(_0x4efa23);});});}exports[_0x2557('0x17')]=function(_0x2885e8){var _0x48e65e=this;return new Promise(function(_0x1b251d,_0xdf8f1e){return db[_0x2557('0x18')][_0x2557('0x19')]({'raw':_0x2885e8[_0x2557('0x1a')]?_0x2885e8[_0x2557('0x1a')][_0x2557('0x1b')]===undefined?!![]:![]:!![],'where':_0x2885e8[_0x2557('0x1a')]?_0x2885e8['options'][_0x2557('0x1c')]||null:null,'attributes':_0x2885e8[_0x2557('0x1a')]?_0x2885e8[_0x2557('0x1a')]['attributes']||null:null,'include':_0x2885e8['options']?_0x2885e8['options'][_0x2557('0x1d')]?_[_0x2557('0x1e')](_0x2885e8[_0x2557('0x1a')]['include'],function(_0x4996e6){return{'model':db[_0x4996e6[_0x2557('0x1f')]],'as':_0x4996e6['as'],'attributes':_0x4996e6[_0x2557('0x20')],'include':_0x4996e6[_0x2557('0x1d')]?_[_0x2557('0x1e')](_0x4996e6[_0x2557('0x1d')],function(_0x58c9ef){return{'model':db[_0x58c9ef[_0x2557('0x1f')]],'as':_0x58c9ef['as'],'attributes':_0x58c9ef[_0x2557('0x20')],'include':_0x58c9ef[_0x2557('0x1d')]?_[_0x2557('0x1e')](_0x58c9ef[_0x2557('0x1d')],function(_0x43db23){return{'model':db[_0x43db23['model']],'as':_0x43db23['as'],'attributes':_0x43db23[_0x2557('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2557('0x21')](function(_0x3656c4){logger['info'](_0x2557('0x17'),_0x2885e8);logger[_0x2557('0x22')]('ShowSmsAccount',_0x2885e8,JSON[_0x2557('0x11')](_0x3656c4));_0x1b251d(_0x3656c4);})[_0x2557('0x16')](function(_0x5d41e4){logger[_0x2557('0x12')](_0x2557('0x17'),_0x5d41e4['message'],_0x2885e8);_0xdf8f1e(_0x48e65e['error'](0x1f4,_0x5d41e4[_0x2557('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index cb15c3b..058eccf 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 a46f63d..6258723 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(_0x29788e,_0x389794){var _0x245e90=function(_0x7f6012){while(--_0x7f6012){_0x29788e['push'](_0x29788e['shift']());}};_0x245e90(++_0x389794);}(_0x008c,0x188));var _0xc008=function(_0x5dd703,_0x7fe88c){_0x5dd703=_0x5dd703-0x0;var _0x557f8e=_0x008c[_0x5dd703];return _0x557f8e;};'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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4d86df,_0x2ab5a5){var _0x454145=function(_0x37cc0d){while(--_0x37cc0d){_0x4d86df['push'](_0x4d86df['shift']());}};_0x454145(++_0x2ab5a5);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b04b1,_0x4d0ffe){_0x4b04b1=_0x4b04b1-0x0;var _0x21aa12=_0xedd9[_0x4b04b1];return _0x21aa12;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1b47f51..ac22e9e 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 _0x0c4d=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x0c4d,0x77));var _0xd0c4=function(_0x1181f5,_0x1b3f62){_0x1181f5=_0x1181f5-0x0;var _0x5ed6d1=_0x0c4d[_0x1181f5];return _0x5ed6d1;};'use strict';var Sequelize=require(_0xd0c4('0x0'));module[_0xd0c4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd0c4('0x2')],'allowNull':![],'defaultValue':_0xd0c4('0x3')},'appdata':{'type':Sequelize[_0xd0c4('0x4')]()},'description':{'type':Sequelize[_0xd0c4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd0c4('0x5')}}; \ No newline at end of file +var _0x08e8=['TEXT','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08e8,0x14d));var _0x808e=function(_0x2f0145,_0x57c5be){_0x2f0145=_0x2f0145-0x0;var _0xa99afe=_0x08e8[_0x2f0145];return _0xa99afe;};'use strict';var Sequelize=require(_0x808e('0x0'));module[_0x808e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x808e('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x808e('0x3')]()},'description':{'type':Sequelize[_0x808e('0x2')]},'interval':{'type':Sequelize[_0x808e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8972ce1..05494c9 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 _0x6f1e=['then','destroy','stack','name','send','index','map','SmsApplication','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x6f1e,0x77));var _0xe6f1=function(_0x466d81,_0x5afd36){_0x466d81=_0x466d81-0x0;var _0x35cff4=_0x6f1e[_0x466d81];return _0x35cff4;};'use strict';var emlformat=require(_0xe6f1('0x0'));var rimraf=require(_0xe6f1('0x1'));var zipdir=require(_0xe6f1('0x2'));var jsonpatch=require(_0xe6f1('0x3'));var rp=require('request-promise');var moment=require(_0xe6f1('0x4'));var BPromise=require(_0xe6f1('0x5'));var Mustache=require(_0xe6f1('0x6'));var util=require(_0xe6f1('0x7'));var path=require('path');var sox=require(_0xe6f1('0x8'));var csv=require(_0xe6f1('0x9'));var ejs=require(_0xe6f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6f1('0xb'));var squel=require(_0xe6f1('0xc'));var crypto=require('crypto');var jsforce=require(_0xe6f1('0xd'));var deskjs=require(_0xe6f1('0xe'));var toCsv=require(_0xe6f1('0x9'));var querystring=require('querystring');var Papa=require(_0xe6f1('0xf'));var Redis=require(_0xe6f1('0x10'));var authService=require(_0xe6f1('0x11'));var qs=require(_0xe6f1('0x12'));var as=require(_0xe6f1('0x13'));var hardwareService=require(_0xe6f1('0x14'));var logger=require(_0xe6f1('0x15'))(_0xe6f1('0x16'));var utils=require(_0xe6f1('0x17'));var config=require(_0xe6f1('0x18'));var licenseUtil=require(_0xe6f1('0x19'));var db=require(_0xe6f1('0x1a'))['db'];function respondWithStatusCode(_0x10f7cb,_0x53e292){_0x53e292=_0x53e292||0xcc;return function(_0x583d2f){if(_0x583d2f){return _0x10f7cb[_0xe6f1('0x1b')](_0x53e292);}return _0x10f7cb[_0xe6f1('0x1c')](_0x53e292)['end']();};}function respondWithResult(_0xdcc67e,_0x300ddc){_0x300ddc=_0x300ddc||0xc8;return function(_0x30cbf0){if(_0x30cbf0){return _0xdcc67e[_0xe6f1('0x1c')](_0x300ddc)[_0xe6f1('0x1d')](_0x30cbf0);}};}function respondWithFilteredResult(_0x195405,_0x252e90){return function(_0x50eafc){if(_0x50eafc){var _0x342630=typeof _0x252e90[_0xe6f1('0x1e')]===_0xe6f1('0x1f')&&typeof _0x252e90[_0xe6f1('0x20')]===_0xe6f1('0x1f');var _0x363b42=_0x50eafc['count'];var _0x459c8a=_0x342630?0x0:_0x252e90[_0xe6f1('0x1e')];var _0x3fc6ca=_0x342630?_0x50eafc[_0xe6f1('0x21')]:_0x252e90[_0xe6f1('0x1e')]+_0x252e90[_0xe6f1('0x20')];var _0x59b93c;if(_0x3fc6ca>=_0x363b42){_0x3fc6ca=_0x363b42;_0x59b93c=0xc8;}else{_0x59b93c=0xce;}_0x195405[_0xe6f1('0x1c')](_0x59b93c);return _0x195405['set'](_0xe6f1('0x22'),_0x459c8a+'-'+_0x3fc6ca+'/'+_0x363b42)[_0xe6f1('0x1d')](_0x50eafc);}return null;};}function patchUpdates(_0x2f4a98){return function(_0x37db59){try{jsonpatch[_0xe6f1('0x23')](_0x37db59,_0x2f4a98,!![]);}catch(_0x45946d){return BPromise[_0xe6f1('0x24')](_0x45946d);}return _0x37db59[_0xe6f1('0x25')]();};}function saveUpdates(_0x4ef294,_0x4cd465){return function(_0x303fb9){if(_0x303fb9){return _0x303fb9[_0xe6f1('0x26')](_0x4ef294)[_0xe6f1('0x27')](function(_0x3aff0d){return _0x3aff0d;});}return null;};}function removeEntity(_0x49a344,_0x5334b8){return function(_0x2a15d8){if(_0x2a15d8){return _0x2a15d8[_0xe6f1('0x28')]()[_0xe6f1('0x27')](function(){_0x49a344[_0xe6f1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad7fa,_0x399619){return function(_0x37414f){if(!_0x37414f){_0x3ad7fa[_0xe6f1('0x1b')](0x194);}return _0x37414f;};}function handleError(_0x1a713b,_0x2f206e){_0x2f206e=_0x2f206e||0x1f4;return function(_0x4def89){logger['error'](_0x4def89[_0xe6f1('0x29')]);if(_0x4def89['name']){delete _0x4def89[_0xe6f1('0x2a')];}_0x1a713b[_0xe6f1('0x1c')](_0x2f206e)[_0xe6f1('0x2b')](_0x4def89);};}exports[_0xe6f1('0x2c')]=function(_0x273196,_0x16979d){var _0x48c163={},_0x5b6292={},_0x5d78b3={'count':0x0,'rows':[]};var _0x59679d=_[_0xe6f1('0x2d')](db[_0xe6f1('0x2e')]['rawAttributes'],function(_0x232507){return{'name':_0x232507[_0xe6f1('0x2f')],'type':_0x232507[_0xe6f1('0x30')][_0xe6f1('0x31')]};});_0x5b6292['model']=_[_0xe6f1('0x2d')](_0x59679d,_0xe6f1('0x2a'));_0x5b6292[_0xe6f1('0x32')]=_[_0xe6f1('0x33')](_0x273196[_0xe6f1('0x32')]);_0x5b6292[_0xe6f1('0x34')]=_[_0xe6f1('0x35')](_0x5b6292[_0xe6f1('0x36')],_0x5b6292[_0xe6f1('0x32')]);_0x48c163['attributes']=_['intersection'](_0x5b6292['model'],qs[_0xe6f1('0x37')](_0x273196['query'][_0xe6f1('0x37')]));_0x48c163['attributes']=_0x48c163[_0xe6f1('0x38')]['length']?_0x48c163['attributes']:_0x5b6292[_0xe6f1('0x36')];if(!_0x273196['query'][_0xe6f1('0x39')](_0xe6f1('0x3a'))){_0x48c163['limit']=qs[_0xe6f1('0x20')](_0x273196['query'][_0xe6f1('0x20')]);_0x48c163[_0xe6f1('0x1e')]=qs['offset'](_0x273196[_0xe6f1('0x32')][_0xe6f1('0x1e')]);}_0x48c163[_0xe6f1('0x3b')]=qs['sort'](_0x273196['query'][_0xe6f1('0x3c')]);_0x48c163['where']=qs[_0xe6f1('0x34')](_[_0xe6f1('0x3d')](_0x273196[_0xe6f1('0x32')],_0x5b6292[_0xe6f1('0x34')]),_0x59679d);if(_0x273196['query'][_0xe6f1('0x3e')]){_0x48c163[_0xe6f1('0x3f')]=_['merge'](_0x48c163[_0xe6f1('0x3f')],{'$or':_[_0xe6f1('0x2d')](_0x59679d,function(_0x204779){if(_0x204779[_0xe6f1('0x30')]!==_0xe6f1('0x40')){var _0x3dd69a={};_0x3dd69a[_0x204779[_0xe6f1('0x2a')]]={'$like':'%'+_0x273196[_0xe6f1('0x32')][_0xe6f1('0x3e')]+'%'};return _0x3dd69a;}})});}_0x48c163=_[_0xe6f1('0x41')]({},_0x48c163,_0x273196['options']);var _0x460521={'where':_0x48c163[_0xe6f1('0x3f')]};return db[_0xe6f1('0x2e')][_0xe6f1('0x21')](_0x460521)[_0xe6f1('0x27')](function(_0x4fdcf6){_0x5d78b3[_0xe6f1('0x21')]=_0x4fdcf6;if(_0x273196[_0xe6f1('0x32')][_0xe6f1('0x42')]){_0x48c163[_0xe6f1('0x43')]=[{'all':!![]}];}return db['SmsApplication'][_0xe6f1('0x44')](_0x48c163);})[_0xe6f1('0x27')](function(_0x24b86b){_0x5d78b3[_0xe6f1('0x45')]=_0x24b86b;return _0x5d78b3;})[_0xe6f1('0x27')](respondWithFilteredResult(_0x16979d,_0x48c163))[_0xe6f1('0x46')](handleError(_0x16979d,null));};exports[_0xe6f1('0x47')]=function(_0x2cf997,_0x361f78){var _0x5b616b={'raw':!![],'where':{'id':_0x2cf997[_0xe6f1('0x48')]['id']}},_0x3356d3={};_0x3356d3[_0xe6f1('0x36')]=_[_0xe6f1('0x33')](db[_0xe6f1('0x2e')][_0xe6f1('0x49')]);_0x3356d3[_0xe6f1('0x32')]=_[_0xe6f1('0x33')](_0x2cf997['query']);_0x3356d3['filters']=_['intersection'](_0x3356d3[_0xe6f1('0x36')],_0x3356d3[_0xe6f1('0x32')]);_0x5b616b[_0xe6f1('0x38')]=_[_0xe6f1('0x35')](_0x3356d3[_0xe6f1('0x36')],qs[_0xe6f1('0x37')](_0x2cf997[_0xe6f1('0x32')]['fields']));_0x5b616b[_0xe6f1('0x38')]=_0x5b616b[_0xe6f1('0x38')][_0xe6f1('0x4a')]?_0x5b616b[_0xe6f1('0x38')]:_0x3356d3[_0xe6f1('0x36')];if(_0x2cf997[_0xe6f1('0x32')][_0xe6f1('0x42')]){_0x5b616b[_0xe6f1('0x43')]=[{'all':!![]}];}_0x5b616b=_[_0xe6f1('0x41')]({},_0x5b616b,_0x2cf997[_0xe6f1('0x4b')]);return db['SmsApplication'][_0xe6f1('0x4c')](_0x5b616b)[_0xe6f1('0x27')](handleEntityNotFound(_0x361f78,null))[_0xe6f1('0x27')](respondWithResult(_0x361f78,null))[_0xe6f1('0x46')](handleError(_0x361f78,null));};exports[_0xe6f1('0x4d')]=function(_0x458c04,_0x1f2b99){return db['SmsApplication'][_0xe6f1('0x4d')](_0x458c04['body'],{})[_0xe6f1('0x27')](respondWithResult(_0x1f2b99,0xc9))[_0xe6f1('0x46')](handleError(_0x1f2b99,null));};exports[_0xe6f1('0x26')]=function(_0x261a89,_0x1373d7){if(_0x261a89['body']['id']){delete _0x261a89[_0xe6f1('0x4e')]['id'];}return db['SmsApplication'][_0xe6f1('0x4c')]({'where':{'id':_0x261a89[_0xe6f1('0x48')]['id']}})[_0xe6f1('0x27')](handleEntityNotFound(_0x1373d7,null))[_0xe6f1('0x27')](saveUpdates(_0x261a89[_0xe6f1('0x4e')],null))[_0xe6f1('0x27')](respondWithResult(_0x1373d7,null))[_0xe6f1('0x46')](handleError(_0x1373d7,null));};exports[_0xe6f1('0x28')]=function(_0x5d9042,_0x4063dc){return db[_0xe6f1('0x2e')][_0xe6f1('0x4c')]({'where':{'id':_0x5d9042['params']['id']}})['then'](handleEntityNotFound(_0x4063dc,null))[_0xe6f1('0x27')](removeEntity(_0x4063dc,null))[_0xe6f1('0x46')](handleError(_0x4063dc,null));}; \ No newline at end of file +var _0xe5da=['save','update','then','destroy','end','sendStatus','error','name','send','SmsApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','merge','type','filter','include','findAll','rows','catch','length','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','json','limit','undefined','count','status','set','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5da,0x6f));var _0xae5d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe5da[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xae5d('0x0'));var rimraf=require(_0xae5d('0x1'));var zipdir=require(_0xae5d('0x2'));var jsonpatch=require(_0xae5d('0x3'));var rp=require(_0xae5d('0x4'));var moment=require('moment');var BPromise=require(_0xae5d('0x5'));var Mustache=require('mustache');var util=require(_0xae5d('0x6'));var path=require(_0xae5d('0x7'));var sox=require(_0xae5d('0x8'));var csv=require(_0xae5d('0x9'));var ejs=require(_0xae5d('0xa'));var fs=require('fs');var fs_extra=require(_0xae5d('0xb'));var _=require(_0xae5d('0xc'));var squel=require(_0xae5d('0xd'));var crypto=require(_0xae5d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae5d('0x9'));var querystring=require(_0xae5d('0xf'));var Papa=require(_0xae5d('0x10'));var Redis=require(_0xae5d('0x11'));var authService=require(_0xae5d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae5d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae5d('0x14'))(_0xae5d('0x15'));var utils=require('../../config/utils');var config=require(_0xae5d('0x16'));var licenseUtil=require(_0xae5d('0x17'));var db=require(_0xae5d('0x18'))['db'];function respondWithStatusCode(_0x303dfc,_0x1bc768){_0x1bc768=_0x1bc768||0xcc;return function(_0x4618c5){if(_0x4618c5){return _0x303dfc['sendStatus'](_0x1bc768);}return _0x303dfc['status'](_0x1bc768)['end']();};}function respondWithResult(_0x261b37,_0x39cbf8){_0x39cbf8=_0x39cbf8||0xc8;return function(_0x35f0be){if(_0x35f0be){return _0x261b37['status'](_0x39cbf8)[_0xae5d('0x19')](_0x35f0be);}};}function respondWithFilteredResult(_0x424a2e,_0x241123){return function(_0x3cb6cc){if(_0x3cb6cc){var _0x7fdecf=typeof _0x241123['offset']==='undefined'&&typeof _0x241123[_0xae5d('0x1a')]===_0xae5d('0x1b');var _0x25931c=_0x3cb6cc[_0xae5d('0x1c')];var _0x238cda=_0x7fdecf?0x0:_0x241123['offset'];var _0x229a32=_0x7fdecf?_0x3cb6cc['count']:_0x241123['offset']+_0x241123['limit'];var _0x5592fa;if(_0x229a32>=_0x25931c){_0x229a32=_0x25931c;_0x5592fa=0xc8;}else{_0x5592fa=0xce;}_0x424a2e[_0xae5d('0x1d')](_0x5592fa);return _0x424a2e[_0xae5d('0x1e')]('Content-Range',_0x238cda+'-'+_0x229a32+'/'+_0x25931c)[_0xae5d('0x19')](_0x3cb6cc);}return null;};}function patchUpdates(_0x308b6e){return function(_0x326bfd){try{jsonpatch[_0xae5d('0x1f')](_0x326bfd,_0x308b6e,!![]);}catch(_0x4150c5){return BPromise[_0xae5d('0x20')](_0x4150c5);}return _0x326bfd[_0xae5d('0x21')]();};}function saveUpdates(_0xfee5c,_0x5db992){return function(_0x33888d){if(_0x33888d){return _0x33888d[_0xae5d('0x22')](_0xfee5c)[_0xae5d('0x23')](function(_0x34d6ad){return _0x34d6ad;});}return null;};}function removeEntity(_0x596bb0,_0x121c3e){return function(_0x5dd3f9){if(_0x5dd3f9){return _0x5dd3f9[_0xae5d('0x24')]()[_0xae5d('0x23')](function(){_0x596bb0[_0xae5d('0x1d')](0xcc)[_0xae5d('0x25')]();});}};}function handleEntityNotFound(_0x2647b3,_0x50adc8){return function(_0x53b8f3){if(!_0x53b8f3){_0x2647b3[_0xae5d('0x26')](0x194);}return _0x53b8f3;};}function handleError(_0x907ac2,_0x23efad){_0x23efad=_0x23efad||0x1f4;return function(_0x53b797){logger[_0xae5d('0x27')](_0x53b797['stack']);if(_0x53b797[_0xae5d('0x28')]){delete _0x53b797[_0xae5d('0x28')];}_0x907ac2[_0xae5d('0x1d')](_0x23efad)[_0xae5d('0x29')](_0x53b797);};}exports['index']=function(_0x27bbe6,_0x445c65){var _0x1856e0={},_0x1c11f9={},_0x1d693a={'count':0x0,'rows':[]};var _0x23e97b=_['map'](db[_0xae5d('0x2a')][_0xae5d('0x2b')],function(_0x4beade){return{'name':_0x4beade[_0xae5d('0x2c')],'type':_0x4beade['type'][_0xae5d('0x2d')]};});_0x1c11f9[_0xae5d('0x2e')]=_['map'](_0x23e97b,'name');_0x1c11f9['query']=_[_0xae5d('0x2f')](_0x27bbe6[_0xae5d('0x30')]);_0x1c11f9[_0xae5d('0x31')]=_[_0xae5d('0x32')](_0x1c11f9[_0xae5d('0x2e')],_0x1c11f9['query']);_0x1856e0[_0xae5d('0x33')]=_[_0xae5d('0x32')](_0x1c11f9[_0xae5d('0x2e')],qs[_0xae5d('0x34')](_0x27bbe6[_0xae5d('0x30')]['fields']));_0x1856e0[_0xae5d('0x33')]=_0x1856e0[_0xae5d('0x33')]['length']?_0x1856e0[_0xae5d('0x33')]:_0x1c11f9[_0xae5d('0x2e')];if(!_0x27bbe6[_0xae5d('0x30')][_0xae5d('0x35')]('nolimit')){_0x1856e0[_0xae5d('0x1a')]=qs['limit'](_0x27bbe6[_0xae5d('0x30')]['limit']);_0x1856e0[_0xae5d('0x36')]=qs[_0xae5d('0x36')](_0x27bbe6[_0xae5d('0x30')]['offset']);}_0x1856e0[_0xae5d('0x37')]=qs['sort'](_0x27bbe6['query'][_0xae5d('0x38')]);_0x1856e0[_0xae5d('0x39')]=qs['filters'](_['pick'](_0x27bbe6['query'],_0x1c11f9['filters']),_0x23e97b);if(_0x27bbe6[_0xae5d('0x30')]['filter']){_0x1856e0[_0xae5d('0x39')]=_[_0xae5d('0x3a')](_0x1856e0[_0xae5d('0x39')],{'$or':_['map'](_0x23e97b,function(_0x1e3dfa){if(_0x1e3dfa[_0xae5d('0x3b')]!=='VIRTUAL'){var _0x79ca5d={};_0x79ca5d[_0x1e3dfa[_0xae5d('0x28')]]={'$like':'%'+_0x27bbe6[_0xae5d('0x30')][_0xae5d('0x3c')]+'%'};return _0x79ca5d;}})});}_0x1856e0=_['merge']({},_0x1856e0,_0x27bbe6['options']);var _0x543618={'where':_0x1856e0['where']};return db['SmsApplication'][_0xae5d('0x1c')](_0x543618)['then'](function(_0x2f4b82){_0x1d693a['count']=_0x2f4b82;if(_0x27bbe6[_0xae5d('0x30')]['includeAll']){_0x1856e0[_0xae5d('0x3d')]=[{'all':!![]}];}return db[_0xae5d('0x2a')][_0xae5d('0x3e')](_0x1856e0);})['then'](function(_0x52911b){_0x1d693a[_0xae5d('0x3f')]=_0x52911b;return _0x1d693a;})[_0xae5d('0x23')](respondWithFilteredResult(_0x445c65,_0x1856e0))[_0xae5d('0x40')](handleError(_0x445c65,null));};exports['show']=function(_0x424f1c,_0x79c7dc){var _0x228e3e={'raw':!![],'where':{'id':_0x424f1c['params']['id']}},_0x558acf={};_0x558acf['model']=_['keys'](db['SmsApplication'][_0xae5d('0x2b')]);_0x558acf[_0xae5d('0x30')]=_[_0xae5d('0x2f')](_0x424f1c[_0xae5d('0x30')]);_0x558acf[_0xae5d('0x31')]=_[_0xae5d('0x32')](_0x558acf[_0xae5d('0x2e')],_0x558acf[_0xae5d('0x30')]);_0x228e3e[_0xae5d('0x33')]=_['intersection'](_0x558acf[_0xae5d('0x2e')],qs[_0xae5d('0x34')](_0x424f1c[_0xae5d('0x30')][_0xae5d('0x34')]));_0x228e3e[_0xae5d('0x33')]=_0x228e3e[_0xae5d('0x33')][_0xae5d('0x41')]?_0x228e3e[_0xae5d('0x33')]:_0x558acf[_0xae5d('0x2e')];if(_0x424f1c[_0xae5d('0x30')][_0xae5d('0x42')]){_0x228e3e['include']=[{'all':!![]}];}_0x228e3e=_[_0xae5d('0x3a')]({},_0x228e3e,_0x424f1c[_0xae5d('0x43')]);return db[_0xae5d('0x2a')][_0xae5d('0x44')](_0x228e3e)[_0xae5d('0x23')](handleEntityNotFound(_0x79c7dc,null))[_0xae5d('0x23')](respondWithResult(_0x79c7dc,null))[_0xae5d('0x40')](handleError(_0x79c7dc,null));};exports[_0xae5d('0x45')]=function(_0x12a7ad,_0x399dc1){return db['SmsApplication']['create'](_0x12a7ad[_0xae5d('0x46')],{})['then'](respondWithResult(_0x399dc1,0xc9))['catch'](handleError(_0x399dc1,null));};exports[_0xae5d('0x22')]=function(_0x4e8c4d,_0xc60fa1){if(_0x4e8c4d[_0xae5d('0x46')]['id']){delete _0x4e8c4d[_0xae5d('0x46')]['id'];}return db[_0xae5d('0x2a')][_0xae5d('0x44')]({'where':{'id':_0x4e8c4d['params']['id']}})['then'](handleEntityNotFound(_0xc60fa1,null))[_0xae5d('0x23')](saveUpdates(_0x4e8c4d['body'],null))[_0xae5d('0x23')](respondWithResult(_0xc60fa1,null))[_0xae5d('0x40')](handleError(_0xc60fa1,null));};exports[_0xae5d('0x24')]=function(_0x2b46f6,_0xd4025e){return db[_0xae5d('0x2a')][_0xae5d('0x44')]({'where':{'id':_0x2b46f6[_0xae5d('0x47')]['id']}})[_0xae5d('0x23')](handleEntityNotFound(_0xd4025e,null))['then'](removeEntity(_0xd4025e,null))[_0xae5d('0x40')](handleError(_0xd4025e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8436f6b..da5fb99 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 _0x0233=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x584aef,_0x5cfef5){var _0x27cb09=function(_0x49124){while(--_0x49124){_0x584aef['push'](_0x584aef['shift']());}};_0x27cb09(++_0x5cfef5);}(_0x0233,0x1b0));var _0x3023=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0233[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x3023('0x0'));var util=require(_0x3023('0x1'));var logger=require(_0x3023('0x2'))(_0x3023('0x3'));var moment=require(_0x3023('0x4'));var BPromise=require('bluebird');var rp=require(_0x3023('0x5'));var fs=require('fs');var path=require(_0x3023('0x6'));var rimraf=require(_0x3023('0x7'));var config=require(_0x3023('0x8'));var attributes=require('./smsApplication.attributes');module[_0x3023('0x9')]=function(_0x239eb7,_0x19ec57){return _0x239eb7[_0x3023('0xa')](_0x3023('0xb'),attributes,{'tableName':_0x3023('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3023('0xd'),'collate':_0x3023('0xe')});}; \ No newline at end of file +var _0x15ad=['SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','define'];(function(_0x4078f6,_0x35a5de){var _0x26b444=function(_0x1afced){while(--_0x1afced){_0x4078f6['push'](_0x4078f6['shift']());}};_0x26b444(++_0x35a5de);}(_0x15ad,0x19b));var _0xd15a=function(_0x16a6c9,_0x17ee6d){_0x16a6c9=_0x16a6c9-0x0;var _0x4eff7b=_0x15ad[_0x16a6c9];return _0x4eff7b;};'use strict';var _=require(_0xd15a('0x0'));var util=require(_0xd15a('0x1'));var logger=require(_0xd15a('0x2'))(_0xd15a('0x3'));var moment=require(_0xd15a('0x4'));var BPromise=require('bluebird');var rp=require(_0xd15a('0x5'));var fs=require('fs');var path=require(_0xd15a('0x6'));var rimraf=require(_0xd15a('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module['exports']=function(_0x2c4fe9,_0x4d5135){return _0x2c4fe9[_0xd15a('0x8')](_0xd15a('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd15a('0xa'),'collate':_0xd15a('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7895831..7eccc06 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 _0x4171=['jayson/promise','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x36d15f,_0x4c3130){var _0x3682f3=function(_0x5978e4){while(--_0x5978e4){_0x36d15f['push'](_0x36d15f['shift']());}};_0x3682f3(++_0x4c3130);}(_0x4171,0x6a));var _0x1417=function(_0x280110,_0x12fa57){_0x280110=_0x280110-0x0;var _0x5df9dc=_0x4171[_0x280110];return _0x5df9dc;};'use strict';var _=require('lodash');var util=require(_0x1417('0x0'));var moment=require(_0x1417('0x1'));var BPromise=require(_0x1417('0x2'));var rs=require(_0x1417('0x3'));var fs=require('fs');var Redis=require(_0x1417('0x4'));var db=require(_0x1417('0x5'))['db'];var utils=require(_0x1417('0x6'));var logger=require('../../config/logger')(_0x1417('0x7'));var config=require('../../config/environment');var jayson=require(_0x1417('0x8'));var client=jayson['client'][_0x1417('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35c775,_0x3e2a7d,_0x2e8ef8){return new BPromise(function(_0x4b713a,_0x49dc2b){return client['request'](_0x35c775,_0x2e8ef8)['then'](function(_0x57f09e){logger[_0x1417('0xa')](_0x1417('0xb'),_0x3e2a7d,_0x1417('0xc'));logger[_0x1417('0xd')](_0x1417('0xe'),_0x3e2a7d,_0x1417('0xc'),JSON[_0x1417('0xf')](_0x57f09e));if(_0x57f09e[_0x1417('0x10')]){if(_0x57f09e['error']['code']===0x1f4){logger[_0x1417('0x10')](_0x1417('0xb'),_0x3e2a7d,_0x57f09e[_0x1417('0x10')]['message']);return _0x49dc2b(_0x57f09e[_0x1417('0x10')][_0x1417('0x11')]);}logger[_0x1417('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3e2a7d,_0x57f09e[_0x1417('0x10')][_0x1417('0x11')]);return _0x4b713a(_0x57f09e[_0x1417('0x10')][_0x1417('0x11')]);}else{logger[_0x1417('0xa')](_0x1417('0xb'),_0x3e2a7d,'request\x20sent');_0x4b713a(_0x57f09e[_0x1417('0x12')][_0x1417('0x11')]);}})['catch'](function(_0x121119){logger[_0x1417('0x10')](_0x1417('0xb'),_0x3e2a7d,_0x121119);_0x49dc2b(_0x121119);});});} \ No newline at end of file +var _0xd98a=['client','http','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x58d789,_0x2b92c3){var _0x1c5f4e=function(_0x2fb40){while(--_0x2fb40){_0x58d789['push'](_0x58d789['shift']());}};_0x1c5f4e(++_0x2b92c3);}(_0xd98a,0xfc));var _0xad98=function(_0x20dd7a,_0x4ffbc5){_0x20dd7a=_0x20dd7a-0x0;var _0x389416=_0xd98a[_0x20dd7a];return _0x389416;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad98('0x1'));var rs=require(_0xad98('0x2'));var fs=require('fs');var Redis=require(_0xad98('0x3'));var db=require(_0xad98('0x4'))['db'];var utils=require(_0xad98('0x5'));var logger=require(_0xad98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad98('0x7'));var client=jayson[_0xad98('0x8')][_0xad98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cd316,_0x2bf76c,_0x480c93){return new BPromise(function(_0x20712b,_0x34eb2d){return client['request'](_0x2cd316,_0x480c93)[_0xad98('0xa')](function(_0x5016b4){logger[_0xad98('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2bf76c,'request\x20sent');logger['debug'](_0xad98('0xc'),_0x2bf76c,_0xad98('0xd'),JSON[_0xad98('0xe')](_0x5016b4));if(_0x5016b4[_0xad98('0xf')]){if(_0x5016b4['error']['code']===0x1f4){logger[_0xad98('0xf')](_0xad98('0x10'),_0x2bf76c,_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);return _0x34eb2d(_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);}logger[_0xad98('0xf')](_0xad98('0x10'),_0x2bf76c,_0x5016b4[_0xad98('0xf')]['message']);return _0x20712b(_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);}else{logger[_0xad98('0xb')](_0xad98('0x10'),_0x2bf76c,_0xad98('0xd'));_0x20712b(_0x5016b4[_0xad98('0x12')][_0xad98('0x11')]);}})[_0xad98('0x13')](function(_0x1c98e7){logger['error']('SmsApplication,\x20%s,\x20%s',_0x2bf76c,_0x1c98e7);_0x34eb2d(_0x1c98e7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0ecf8bf..bf73070 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 _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e5462,_0x59ccc1){var _0x285918=function(_0x467907){while(--_0x467907){_0x1e5462['push'](_0x1e5462['shift']());}};_0x285918(++_0x59ccc1);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file +var _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xb7e7[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('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 557c2a1..33b5a43 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 _0x9c5a=['ENUM','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x44de7a,_0x5d0821){var _0x54d318=function(_0x4f9d49){while(--_0x4f9d49){_0x44de7a['push'](_0x44de7a['shift']());}};_0x54d318(++_0x5d0821);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x486dbb,_0x5edee7){_0x486dbb=_0x486dbb-0x0;var _0x4c1709=_0x9c5a[_0x486dbb];return _0x4c1709;};'use strict';var Sequelize=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));module['exports']={'closed':{'type':Sequelize[_0xa9c5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa9c5('0x3')]},'disposition':{'type':Sequelize[_0xa9c5('0x4')]},'secondDisposition':{'type':Sequelize[_0xa9c5('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa9c5('0x4')]},'phone':{'type':Sequelize[_0xa9c5('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa9c5('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa9c5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa9c5('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1db9=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1a209f,_0x1b35e6){var _0x376b56=function(_0x5ed729){while(--_0x5ed729){_0x1a209f['push'](_0x1a209f['shift']());}};_0x376b56(++_0x1b35e6);}(_0x1db9,0x176));var _0x91db=function(_0x5e3153,_0x5cedce){_0x5e3153=_0x5e3153-0x0;var _0xa4a540=_0x1db9[_0x5e3153];return _0xa4a540;};'use strict';var Sequelize=require(_0x91db('0x0'));var moment=require(_0x91db('0x1'));module[_0x91db('0x2')]={'closed':{'type':Sequelize[_0x91db('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x91db('0x4')]},'disposition':{'type':Sequelize[_0x91db('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x91db('0x5')]},'note':{'type':Sequelize[_0x91db('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x91db('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x91db('0x6')]('in',_0x91db('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x91db('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index aa70e3f..94425ce 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 _0x28e1=['eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','status','json','offset','undefined','limit','count','apply','reject','update','then','sendStatus','error','stack','name','send','map','fullname','TagIds','Tags','split','push','index','SmsInteraction','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','end','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','compact','isEmpty','SmsAccountId','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','all','rows','catch','show','keys','include','options','create','destroy','params','describe','SmsMessage','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','tmp','server','files','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','secret','read','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','out','System','firstName','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','download','log','err','unlinkSync'];(function(_0x403428,_0x419281){var _0x1d6c81=function(_0x18688d){while(--_0x18688d){_0x403428['push'](_0x403428['shift']());}};_0x1d6c81(++_0x419281);}(_0x28e1,0x1d4));var _0x128e=function(_0x547146,_0x402b2c){_0x547146=_0x547146-0x0;var _0x18e5be=_0x28e1[_0x547146];return _0x18e5be;};'use strict';var emlformat=require(_0x128e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x128e('0x1'));var jsonpatch=require(_0x128e('0x2'));var rp=require(_0x128e('0x3'));var moment=require('moment');var BPromise=require(_0x128e('0x4'));var Mustache=require(_0x128e('0x5'));var util=require('util');var path=require(_0x128e('0x6'));var sox=require(_0x128e('0x7'));var csv=require(_0x128e('0x8'));var ejs=require(_0x128e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x128e('0xa'));var squel=require('squel');var crypto=require(_0x128e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x128e('0x8'));var querystring=require(_0x128e('0xc'));var Papa=require(_0x128e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x128e('0xe'));var as=require(_0x128e('0xf'));var pdf=require(_0x128e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x128e('0x11'))(_0x128e('0x12'));var utils=require(_0x128e('0x13'));var config=require(_0x128e('0x14'));var licenseUtil=require(_0x128e('0x15'));var db=require(_0x128e('0x16'))['db'];config[_0x128e('0x17')]=_[_0x128e('0x18')](config[_0x128e('0x17')],{'host':_0x128e('0x19'),'port':0x18eb});var socket=require(_0x128e('0x1a'))(new Redis(config[_0x128e('0x17')]));require(_0x128e('0x1b'))['register'](socket);function respondWithStatusCode(_0x2794b9,_0x590bf4){_0x590bf4=_0x590bf4||0xcc;return function(_0x3f2c62){if(_0x3f2c62){return _0x2794b9['sendStatus'](_0x590bf4);}return _0x2794b9[_0x128e('0x1c')](_0x590bf4)['end']();};}function respondWithResult(_0x1a6e88,_0x26e95e){_0x26e95e=_0x26e95e||0xc8;return function(_0xbd4a17){if(_0xbd4a17){return _0x1a6e88[_0x128e('0x1c')](_0x26e95e)[_0x128e('0x1d')](_0xbd4a17);}};}function respondWithFilteredResult(_0x207369,_0x3c0bc6){return function(_0x548b9d){if(_0x548b9d){var _0x36d18a=typeof _0x3c0bc6[_0x128e('0x1e')]===_0x128e('0x1f')&&typeof _0x3c0bc6[_0x128e('0x20')]==='undefined';var _0x2d0c0b=_0x548b9d[_0x128e('0x21')];var _0x1230c6=_0x36d18a?0x0:_0x3c0bc6[_0x128e('0x1e')];var _0x5c0081=_0x36d18a?_0x548b9d['count']:_0x3c0bc6['offset']+_0x3c0bc6[_0x128e('0x20')];var _0xf69b66;if(_0x5c0081>=_0x2d0c0b){_0x5c0081=_0x2d0c0b;_0xf69b66=0xc8;}else{_0xf69b66=0xce;}_0x207369[_0x128e('0x1c')](_0xf69b66);return _0x207369['set']('Content-Range',_0x1230c6+'-'+_0x5c0081+'/'+_0x2d0c0b)[_0x128e('0x1d')](_0x548b9d);}return null;};}function patchUpdates(_0x1aed19){return function(_0x1e6ed5){try{jsonpatch[_0x128e('0x22')](_0x1e6ed5,_0x1aed19,!![]);}catch(_0x1cb964){return BPromise[_0x128e('0x23')](_0x1cb964);}return _0x1e6ed5['save']();};}function saveUpdates(_0x32ce13,_0x22367b){return function(_0x566c42){if(_0x566c42){return _0x566c42[_0x128e('0x24')](_0x32ce13)[_0x128e('0x25')](function(_0x1aead8){return _0x1aead8;});}return null;};}function removeEntity(_0x18fb9a,_0x3e7c38){return function(_0x393a23){if(_0x393a23){return _0x393a23['destroy']()[_0x128e('0x25')](function(){_0x18fb9a[_0x128e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3445c2,_0x2e12a1){return function(_0x434f1e){if(!_0x434f1e){_0x3445c2[_0x128e('0x26')](0x194);}return _0x434f1e;};}function handleError(_0x769954,_0x39fd55){_0x39fd55=_0x39fd55||0x1f4;return function(_0x5964c4){logger[_0x128e('0x27')](_0x5964c4[_0x128e('0x28')]);if(_0x5964c4[_0x128e('0x29')]){delete _0x5964c4[_0x128e('0x29')];}_0x769954[_0x128e('0x1c')](_0x39fd55)[_0x128e('0x2a')](_0x5964c4);};}function getInteractionUsers(_0x4ddd4d,_0x5c6e5a){return new BPromise(function(_0x703bec,_0xdb951f){try{if(_0x5c6e5a[_0x4ddd4d['id']]){_0x4ddd4d['Users']=_[_0x128e('0x2b')](_0x5c6e5a[_0x4ddd4d['id']],function(_0x1cc2fd){return{'id':_0x1cc2fd['id'],'fullname':_0x1cc2fd[_0x128e('0x2c')]};});}}catch(_0xf9edcb){_0xdb951f(_0xf9edcb);}_0x703bec(_0x4ddd4d);});}function getInteractionTags(_0x14778c,_0x290d43){return new BPromise(function(_0x199cdf,_0x2b1358){try{if(_0x14778c[_0x128e('0x2d')]){_0x14778c[_0x128e('0x2e')]=[];_0x14778c[_0x128e('0x2d')][_0x128e('0x2f')](',')['forEach'](function(_0x730003){_0x14778c[_0x128e('0x2e')][_0x128e('0x30')](_0x290d43[_0x730003]);});}delete _0x14778c[_0x128e('0x2d')];}catch(_0x265b8c){_0x2b1358(_0x265b8c);}_0x199cdf(_0x14778c);});}function updateSmsInteraction(_0x8d2271,_0x196565,_0xd2358d){return new BPromise(function(_0x38428c,_0x2548f2){return getInteractionUsers(_0x8d2271,_0xd2358d)[_0x128e('0x25')](function(_0x1d16a9){return getInteractionTags(_0x1d16a9,_0x196565);})[_0x128e('0x25')](function(_0x17dc44){_0x38428c(_0x17dc44);})['catch'](function(_0x34b73c){_0x2548f2(_0x34b73c);});});}exports[_0x128e('0x31')]=function(_0x24ebe7,_0x2fc74a){var _0x12e464={},_0x290eb7={},_0x1f1a5b={'count':0x0,'rows':[]};var _0x3dc6c0=_[_0x128e('0x2b')](db[_0x128e('0x32')][_0x128e('0x33')],function(_0x21c2c4){return{'name':_0x21c2c4[_0x128e('0x34')],'type':_0x21c2c4['type']['key']};});_0x290eb7[_0x128e('0x35')]=_['map'](_0x3dc6c0,'name');_0x290eb7[_0x128e('0x36')]=_['keys'](_0x24ebe7[_0x128e('0x36')]);_0x290eb7[_0x128e('0x37')]=_[_0x128e('0x38')](_0x290eb7[_0x128e('0x35')],_0x290eb7[_0x128e('0x36')]);_0x12e464['attributes']=_[_0x128e('0x38')](_0x290eb7[_0x128e('0x35')],qs[_0x128e('0x39')](_0x24ebe7[_0x128e('0x36')][_0x128e('0x39')]));_0x12e464[_0x128e('0x3a')]=_0x12e464['attributes'][_0x128e('0x3b')]?_0x12e464[_0x128e('0x3a')]:_0x290eb7[_0x128e('0x35')];if(!_0x24ebe7['query'][_0x128e('0x3c')](_0x128e('0x3d'))){_0x12e464[_0x128e('0x20')]=qs[_0x128e('0x20')](_0x24ebe7[_0x128e('0x36')][_0x128e('0x20')]);_0x12e464[_0x128e('0x1e')]=qs[_0x128e('0x1e')](_0x24ebe7[_0x128e('0x36')]['offset']);}_0x12e464[_0x128e('0x3e')]=qs[_0x128e('0x3f')](_0x24ebe7[_0x128e('0x36')]['sort']);_0x12e464[_0x128e('0x40')]=qs[_0x128e('0x37')](_[_0x128e('0x41')](_0x24ebe7[_0x128e('0x36')],_0x290eb7[_0x128e('0x37')]),_0x3dc6c0);var _0x2afa63=[];var _0x3161cf=squel[_0x128e('0x42')]()['field']('id')[_0x128e('0x43')]('name')['field'](_0x128e('0x44'))[_0x128e('0x45')](_0x128e('0x46'));var _0x2885ca=squel[_0x128e('0x42')]()[_0x128e('0x43')](_0x128e('0x47'))[_0x128e('0x43')](_0x128e('0x48'))[_0x128e('0x43')](_0x128e('0x49'))['from'](_0x128e('0x4a'),'ui')[_0x128e('0x4b')](_0x128e('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x2c1c9e=squel[_0x128e('0x42')]()['from']('sms_interactions','i')[_0x128e('0x4b')](_0x128e('0x4d'),'c',_0x128e('0x4e'))[_0x128e('0x4b')](_0x128e('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x128e('0x4b')](_0x128e('0x4f'),'a',_0x128e('0x50'))[_0x128e('0x4b')](_0x128e('0x51'),'me',_0x128e('0x52'))[_0x128e('0x4b')](_0x128e('0x53'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x128e('0x4b')]('tools_tags','t',_0x128e('0x54'));var _0x286da2=squel[_0x128e('0x55')]();var _0xe904e=[];var _0x45969c=squel[_0x128e('0x55')]();var _0x5563a0;if(_0x24ebe7[_0x128e('0x36')][_0x128e('0x56')]){_0x5563a0=as['parseSearch'](_0x24ebe7['query'][_0x128e('0x56')]);var _0x462b13=_0x5563a0[_0x128e('0x57')];for(var _0x27d489=0x0;_0x27d489<_0x5563a0[_0x128e('0x58')]['length'];_0x27d489++){var _0x37c356=_0x5563a0[_0x128e('0x58')][_0x27d489];var _0x4d0b6c='i';var _0x26055a=_['find'](_0x3dc6c0,[_0x128e('0x29'),_0x37c356[_0x128e('0x43')]]);if(!_0x26055a){switch(_0x37c356[_0x128e('0x43')]){case _0x128e('0x59'):if(_0x37c356[_0x128e('0x5a')]==0x1){_0x2c1c9e['having']('`'+_0x37c356[_0x128e('0x43')]+_0x128e('0x5b'));}else{_0x2c1c9e[_0x128e('0x5c')]('`'+_0x37c356['field']+_0x128e('0x5d'));}break;case _0x128e('0x5e'):if(_0x37c356[_0x128e('0x5f')]===_0x128e('0x60')){if(_0x37c356['value'][_0x128e('0x2f')]('\x20')[_0x128e('0x3b')]>0x1){_0x286da2[_0x462b13]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x128e('0x61')](_0x37c356[_0x128e('0x5a')]),null);}else{var _0x33dc72='%'+_0x37c356[_0x128e('0x5a')]+'%';_0x286da2[_0x462b13](_0x128e('0x62'),_0x33dc72,_0x33dc72,_0x33dc72);}}else{_0x26055a=_[_0x128e('0x63')](_0x3dc6c0,[_0x128e('0x29'),_0x128e('0x64')]);_0x37c356[_0x128e('0x43')]=_0x128e('0x64');_0x5a1ce4=as[_0x128e('0x65')](_0x4d0b6c,_0x26055a[_0x128e('0x66')],_0x37c356);_0x286da2[_0x462b13](_0x5a1ce4[_0x128e('0x67')],_0x5a1ce4[_0x128e('0x5a')]['start'],_0x5a1ce4[_0x128e('0x5a')][_0x128e('0x68')]);}break;case _0x128e('0x69'):var _0x261de9=_0x37c356[_0x128e('0x5a')]['split'](',')['map'](function(_0x4b5222){return Number(_0x4b5222);});_0x261de9[_0x128e('0x6a')](function(_0x321ee2){_0x45969c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x321ee2+',%');});_0xe904e=_[_0x128e('0x6b')](_0xe904e,_0x261de9);break;case _0x128e('0x6c'):if(_0x37c356[_0x128e('0x5f')]===_0x128e('0x60')){_0x286da2[_0x462b13](_0x128e('0x6d'),'%'+_0x37c356['value']+'%',null);}else{_0x26055a=_['find'](_0x3dc6c0,['name',_0x128e('0x6e')]);_0x37c356[_0x128e('0x43')]='UserId';_0x5a1ce4=as[_0x128e('0x65')](_0x4d0b6c,_0x26055a['type'],_0x37c356);_0x286da2[_0x462b13](_0x5a1ce4['text'],_0x5a1ce4[_0x128e('0x5a')][_0x128e('0x6f')],_0x5a1ce4[_0x128e('0x5a')][_0x128e('0x68')]);}break;case _0x128e('0x70'):_0x5a1ce4=as[_0x128e('0x65')]('me',null,_0x37c356);_0x286da2[_0x462b13](_0x5a1ce4[_0x128e('0x67')],_0x5a1ce4[_0x128e('0x5a')][_0x128e('0x6f')],_0x5a1ce4['value'][_0x128e('0x68')]);break;}}else{var _0x5a1ce4=as[_0x128e('0x65')](_0x4d0b6c,_0x26055a[_0x128e('0x66')],_0x37c356);_0x286da2[_0x462b13](_0x5a1ce4['text'],_0x5a1ce4['value'][_0x128e('0x6f')],_0x5a1ce4['value'][_0x128e('0x68')]);}}}else{var _0xb333aa=_(_0x24ebe7[_0x128e('0x36')])['keys']()[_0x128e('0x2b')](function(_0x382d94){return _['some'](_0x3dc6c0,[_0x128e('0x29'),_0x382d94])?_0x382d94:undefined;})[_0x128e('0x71')]()[_0x128e('0x5a')]();if(!_[_0x128e('0x72')](_0xb333aa)){_0xb333aa[_0x128e('0x6a')](function(_0x439df9){if(_0x439df9===_0x128e('0x73')){_0x2c1c9e[_0x128e('0x40')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x24ebe7[_0x128e('0x36')][_0x439df9]));}else if(_0x439df9===_0x128e('0x74')){var _0x4f326c=JSON['parse'](_0x24ebe7[_0x128e('0x36')][_0x439df9])[_0x128e('0x75')];var _0x1345ef=JSON['parse'](_0x24ebe7[_0x128e('0x36')][_0x439df9])[_0x128e('0x76')];_0x2c1c9e[_0x128e('0x40')](_0x128e('0x77'),_0x4f326c,_0x1345ef);}else{if(_0x24ebe7[_0x128e('0x36')][_0x439df9]===_0x128e('0x78')){_0x2c1c9e['where']('i.'+_0x439df9+_0x128e('0x79'));}else{_0x2c1c9e[_0x128e('0x40')]('i.'+_0x439df9+'\x20=\x20?',_0x24ebe7['query'][_0x439df9]);}}});}if(_0x24ebe7['query']['read']){if(_0x24ebe7[_0x128e('0x36')]['read']==0x1){_0x2c1c9e[_0x128e('0x5c')](_0x128e('0x7a'));}else{_0x2c1c9e['having'](_0x128e('0x7b'));}}if(_0x24ebe7[_0x128e('0x36')][_0x128e('0x7c')]){_0xe904e=_[_0x128e('0x7d')](_0x24ebe7[_0x128e('0x36')][_0x128e('0x7c')])?_0x24ebe7[_0x128e('0x36')]['tag']:new Array(_0x24ebe7[_0x128e('0x36')]['tag']);_0xe904e[_0x128e('0x6a')](function(_0x21c43b){_0x45969c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x21c43b+',%');});}if(_0x24ebe7[_0x128e('0x36')][_0x128e('0x7e')]){var _0x2e9e03=_0x24ebe7[_0x128e('0x36')][_0x128e('0x7e')][_0x128e('0x7f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x128e('0x80')](_0x2e9e03)){_0x286da2['or'](_0x128e('0x81'),_0x2e9e03+'%')['or'](_0x128e('0x82'),_0x2e9e03+'%');}else{_0x286da2['or'](_0x128e('0x83'),qs[_0x128e('0x61')](_0x2e9e03))['or'](_0x128e('0x84'),_0x2e9e03+'%');}}}_0x2c1c9e['where'](_0x286da2);_0x2c1c9e[_0x128e('0x85')]('i.id');var _0x2e1d39={'type':db[_0x128e('0x86')][_0x128e('0x87')][_0x128e('0x88')],'raw':!![]};var _0x5688d9=_0x2c1c9e[_0x128e('0x89')]();_0x5688d9['field']('i.id');_0x5688d9[_0x128e('0x43')](_0x128e('0x8a'),_0x128e('0x59'));if(_0x12e464[_0x128e('0x3e')]){_0x12e464[_0x128e('0x3e')][_0x128e('0x6a')](function(_0x25a6ad){var _0x1ea455=_0x25a6ad[0x0]===_0x128e('0x8b')?_0x25a6ad[0x0]:'i.'+_0x25a6ad[0x0];_0x2c1c9e[_0x128e('0x3e')](_0x1ea455,_0x25a6ad[0x1]===_0x128e('0x8c')?![]:!![]);});}if(!_[_0x128e('0x72')](_0xe904e)){_0x2c1c9e[_0x128e('0x5c')](_0x45969c);_0x5688d9['where'](_0x128e('0x8d'),_0xe904e);}BPromise[_0x128e('0x8e')]()['then'](function(){if(!_0x5563a0){if(_0x24ebe7[_0x128e('0x36')][_0x128e('0x73')])return;_0x5688d9[_0x128e('0x40')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2c1c9e[_0x128e('0x40')](_0x128e('0x8f'));return;}if(_0x24ebe7[_0x128e('0x90')][_0x128e('0x91')]!=='agent')return;return _0x24ebe7['user'][_0x128e('0x92')]({'attributes':['id'],'raw':!![]})[_0x128e('0x25')](function(_0x128f56){if(_['isEmpty'](_0x128f56)){_0x5688d9[_0x128e('0x40')](_0x128e('0x93'));_0x2c1c9e['where'](_0x128e('0x93'));}else{_0x5688d9[_0x128e('0x40')](_0x128e('0x94'),_[_0x128e('0x2b')](_0x128f56,'id'));_0x2c1c9e['where'](_0x128e('0x94'),_['map'](_0x128f56,'id'));}});})['then'](function(){if(_0x24ebe7[_0x128e('0x90')]['role']===_0x128e('0x95')&&!_0x5563a0&&!_0x24ebe7[_0x128e('0x36')][_0x128e('0x73')])return[];return db[_0x128e('0x96')][_0x128e('0x36')](_0x5688d9[_0x128e('0x97')](),_0x2e1d39);})[_0x128e('0x25')](function(_0xf87e1c){_0x1f1a5b[_0x128e('0x21')]=_0xf87e1c[_0x128e('0x3b')];if(_0x1f1a5b['count']===0x0)return[];return db[_0x128e('0x96')][_0x128e('0x36')](_0x3161cf[_0x128e('0x97')](),_0x2e1d39)[_0x128e('0x25')](function(_0x192726){_0x2afa63=_[_0x128e('0x98')](_0x192726,'id');_0x2e1d39=_[_0x128e('0x99')](_0x2e1d39,{'model':db[_0x128e('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x24ebe7['query'][_0x128e('0x39')]){_0x12e464[_0x128e('0x3a')]['forEach'](function(_0x3e1acb){_0x2c1c9e[_0x128e('0x43')]('i.'+_0x3e1acb);});}else{_0x2c1c9e['field'](_0x128e('0x8a'),'unreadMessages');_0x2c1c9e['field'](_0x128e('0x9a'),_0x128e('0x9b'));_0x2c1c9e[_0x128e('0x43')](_0x128e('0x9c'),_0x128e('0x9d'));_0x2c1c9e['field'](_0x128e('0x9e'),'contactName');_0x2c1c9e[_0x128e('0x43')](_0x128e('0x9f'));_0x2c1c9e[_0x128e('0x43')](_0x128e('0xa0'),_0x128e('0xa1'));_0x2c1c9e['field'](_0x128e('0xa2'),_0x128e('0xa3'));_0x2c1c9e[_0x128e('0x43')](_0x128e('0xa4'),_0x128e('0xa5'));_0x2c1c9e['field']('c.phone',_0x128e('0xa6'));_0x2c1c9e[_0x128e('0x43')](_0x128e('0xa7'),'Contact.mobile');_0x2c1c9e[_0x128e('0x43')](_0x128e('0xa8'),_0x128e('0xa9'));_0x2c1c9e[_0x128e('0x43')](_0x128e('0xaa'),_0x128e('0xab'));_0x2c1c9e['field'](_0x128e('0xac'),_0x128e('0xad'));_0x2c1c9e['field'](_0x128e('0xae'),_0x128e('0x2d'));}if(_0x12e464[_0x128e('0x20')])_0x2c1c9e[_0x128e('0x20')](_0x12e464[_0x128e('0x20')]);if(_0x12e464[_0x128e('0x1e')])_0x2c1c9e['offset'](_0x12e464[_0x128e('0x1e')]);return db[_0x128e('0x96')]['query'](_0x2c1c9e['toString'](),_0x2e1d39);})[_0x128e('0x25')](function(_0x56dab3){if(_0x56dab3['length']>0x0)_0x2885ca[_0x128e('0x40')]('ui.SmsInteractionId\x20IN\x20?',_[_0x128e('0x2b')](_0x56dab3,'id'));return db[_0x128e('0x96')][_0x128e('0x36')](_0x2885ca['toString'](),_0x2e1d39)[_0x128e('0x25')](function(_0x72eb2f){var _0x1d46ae=_['groupBy'](_0x72eb2f,_0x128e('0xaf'));var _0x440fa1=[];_0x56dab3['forEach'](function(_0x2f60ff){_0x440fa1[_0x128e('0x30')](updateSmsInteraction(_0x2f60ff,_0x2afa63,_0x1d46ae));});return BPromise[_0x128e('0xb0')](_0x440fa1);});});})[_0x128e('0x25')](function(_0x427ba7){_0x1f1a5b[_0x128e('0xb1')]=_0x427ba7;return _0x1f1a5b;})[_0x128e('0x25')](respondWithFilteredResult(_0x2fc74a,_0x12e464))[_0x128e('0xb2')](handleError(_0x2fc74a,null));};exports[_0x128e('0xb3')]=function(_0xa842c3,_0x27b2b7){var _0x393f05={'raw':![],'where':{'id':_0xa842c3['params']['id']}},_0x3e866c={};_0x3e866c[_0x128e('0x35')]=_['keys'](db['SmsInteraction'][_0x128e('0x33')]);_0x3e866c[_0x128e('0x36')]=_[_0x128e('0xb4')](_0xa842c3[_0x128e('0x36')]);_0x3e866c[_0x128e('0x37')]=_['intersection'](_0x3e866c[_0x128e('0x35')],_0x3e866c[_0x128e('0x36')]);_0x393f05[_0x128e('0x3a')]=_['intersection'](_0x3e866c['model'],qs['fields'](_0xa842c3[_0x128e('0x36')][_0x128e('0x39')]));_0x393f05[_0x128e('0x3a')]=_0x393f05[_0x128e('0x3a')]['length']?_0x393f05[_0x128e('0x3a')]:_0x3e866c[_0x128e('0x35')];if(_0xa842c3[_0x128e('0x36')]['includeAll']){_0x393f05[_0x128e('0xb5')]=[{'all':!![]}];}_0x393f05=_[_0x128e('0x99')]({},_0x393f05,_0xa842c3[_0x128e('0xb6')]);return db[_0x128e('0x32')][_0x128e('0x63')](_0x393f05)[_0x128e('0x25')](handleEntityNotFound(_0x27b2b7,null))[_0x128e('0x25')](respondWithResult(_0x27b2b7,null))[_0x128e('0xb2')](handleError(_0x27b2b7,null));};exports[_0x128e('0xb7')]=function(_0x161c62,_0x265cfe){return db[_0x128e('0x32')][_0x128e('0xb7')](_0x161c62[_0x128e('0x70')],{})['then'](respondWithResult(_0x265cfe,0xc9))[_0x128e('0xb2')](handleError(_0x265cfe,null));};exports[_0x128e('0x24')]=function(_0x297e90,_0x999023){if(_0x297e90[_0x128e('0x70')]['id']){delete _0x297e90[_0x128e('0x70')]['id'];}return db[_0x128e('0x32')][_0x128e('0x63')]({'where':{'id':_0x297e90['params']['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x999023,null))[_0x128e('0x25')](saveUpdates(_0x297e90[_0x128e('0x70')],null))[_0x128e('0x25')](respondWithResult(_0x999023,null))[_0x128e('0xb2')](handleError(_0x999023,null));};exports[_0x128e('0xb8')]=function(_0x3de6c9,_0x4912c2){return db[_0x128e('0x32')][_0x128e('0x63')]({'where':{'id':_0x3de6c9[_0x128e('0xb9')]['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x4912c2,null))['then'](removeEntity(_0x4912c2,null))[_0x128e('0xb2')](handleError(_0x4912c2,null));};exports[_0x128e('0xba')]=function(_0x11b72f,_0x413fbf){return db['SmsInteraction'][_0x128e('0xba')]()[_0x128e('0x25')](respondWithResult(_0x413fbf,null))[_0x128e('0xb2')](handleError(_0x413fbf,null));};exports['addMessage']=function(_0x156822,_0x3b1a7d,_0xc03bca){return db[_0x128e('0xbb')]['find']({'where':{'id':_0x156822[_0x128e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x3b1a7d,null))[_0x128e('0x25')](function(_0xa59cf4){if(_0xa59cf4){return _0xa59cf4[_0x128e('0xbc')](_0x156822[_0x128e('0x70')][_0x128e('0xbd')],_[_0x128e('0xbe')](_0x156822[_0x128e('0x70')],[_0x128e('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x3b1a7d,null))[_0x128e('0xb2')](handleError(_0x3b1a7d,null));};exports[_0x128e('0xbf')]=function(_0x1d8e4f,_0x5098b8,_0xfc8d30){var _0x2e0045={'raw':![],'where':{}};var _0x43ea74={};var _0x9347e={'count':0x0,'rows':[]};return db[_0x128e('0x32')]['findOne']({'where':{'id':_0x1d8e4f['params']['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x5098b8,null))[_0x128e('0x25')](function(_0x347efa){if(_0x347efa){_0x43ea74['model']=_[_0x128e('0xb4')](db['SmsMessage'][_0x128e('0x33')]);_0x43ea74[_0x128e('0x36')]=_['keys'](_0x1d8e4f[_0x128e('0x36')]);_0x43ea74[_0x128e('0x37')]=_['intersection'](_0x43ea74[_0x128e('0x35')],_0x43ea74[_0x128e('0x36')]);_0x2e0045[_0x128e('0x3a')]=_[_0x128e('0x38')](_0x43ea74[_0x128e('0x35')],qs['fields'](_0x1d8e4f[_0x128e('0x36')][_0x128e('0x39')]));_0x2e0045[_0x128e('0x3a')]=_0x2e0045[_0x128e('0x3a')]['length']?_0x2e0045[_0x128e('0x3a')]:_0x43ea74[_0x128e('0x35')];if(!_0x1d8e4f[_0x128e('0x36')]['hasOwnProperty']('nolimit')){_0x2e0045[_0x128e('0x20')]=qs[_0x128e('0x20')](_0x1d8e4f[_0x128e('0x36')]['limit']);_0x2e0045['offset']=qs['offset'](_0x1d8e4f[_0x128e('0x36')][_0x128e('0x1e')]);}_0x2e0045['order']=qs[_0x128e('0x3f')](_0x1d8e4f[_0x128e('0x36')][_0x128e('0x3f')]);_0x2e0045[_0x128e('0x40')]=qs[_0x128e('0x37')](_[_0x128e('0x41')](_0x1d8e4f['query'],_0x43ea74[_0x128e('0x37')]));_0x2e0045[_0x128e('0x40')]['SmsInteractionId']=_0x347efa['id'];if(_0x1d8e4f['query'][_0x128e('0x7e')]){_0x2e0045[_0x128e('0x40')]=_[_0x128e('0x99')](_0x2e0045[_0x128e('0x40')],{'$or':_[_0x128e('0x2b')](_0x2e0045[_0x128e('0x3a')],function(_0x18ca0a){var _0x185b9d={};_0x185b9d[_0x18ca0a]={'$like':'%'+_0x1d8e4f['query'][_0x128e('0x7e')]+'%'};return _0x185b9d;})});}if(_0x1d8e4f[_0x128e('0x36')][_0x128e('0x75')]){var _0x244ae4=_0x1d8e4f[_0x128e('0x36')][_0x128e('0x75')]['split'](',');var _0x23f2bf={};_0x23f2bf[_0x244ae4[0x0]]={'$gte':moment(_0x244ae4[0x1])[_0x128e('0xc0')](_0x128e('0xc1'))};_0x2e0045[_0x128e('0x40')]=_[_0x128e('0x99')](_0x2e0045['where'],_0x23f2bf);}_0x2e0045=_[_0x128e('0x99')]({},_0x2e0045,_0x1d8e4f[_0x128e('0xb6')]);return db[_0x128e('0xbb')][_0x128e('0x21')]({'where':_0x2e0045[_0x128e('0x40')]})[_0x128e('0x25')](function(_0x33d4ca){_0x9347e[_0x128e('0x21')]=_0x33d4ca;if(_0x1d8e4f['query']['includeAll']){_0x2e0045['include']=[{'all':!![]}];}return db[_0x128e('0xbb')][_0x128e('0xc2')](_0x2e0045);})[_0x128e('0x25')](function(_0x26d0d9){_0x9347e[_0x128e('0xb1')]=_0x26d0d9;return _0x9347e;});}})[_0x128e('0x25')](respondWithFilteredResult(_0x5098b8,_0x2e0045))[_0x128e('0xb2')](handleError(_0x5098b8,null));};exports[_0x128e('0xc3')]=function(_0x47ce66,_0x37a45d,_0x3da9aa){return db['SmsInteraction'][_0x128e('0x63')]({'where':{'id':_0x47ce66[_0x128e('0xb9')]['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x37a45d,null))[_0x128e('0x25')](function(_0x5cb6a4){if(_0x5cb6a4){return _0x5cb6a4[_0x128e('0xc4')](_0x47ce66['body'][_0x128e('0xbd')],_[_0x128e('0xbe')](_0x47ce66[_0x128e('0x70')],['ids','id'])||{})[_0x128e('0xc5')](function(){return db[_0x128e('0x69')][_0x128e('0xc2')]({'attributes':['id',_0x128e('0x29'),'color'],'where':{'id':_0x47ce66[_0x128e('0x70')][_0x128e('0xbd')]}});})[_0x128e('0x25')](function(_0x275369){socket[_0x128e('0xc6')](_0x128e('0xc7'),{'id':Number(_0x47ce66[_0x128e('0xb9')]['id']),'tags':_0x275369||[]});return{'id':Number(_0x47ce66[_0x128e('0xb9')]['id']),'tags':_0x275369||[]};});}})[_0x128e('0x25')](respondWithResult(_0x37a45d,null))[_0x128e('0xb2')](handleError(_0x37a45d,null));};exports[_0x128e('0xc8')]=function(_0x45f158,_0x51800e,_0x30ea68){return db['SmsInteraction']['find']({'where':{'id':_0x45f158[_0x128e('0xb9')]['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x51800e,null))[_0x128e('0x25')](function(_0x3904f8){if(_0x3904f8){return _0x3904f8['removeTags'](_0x45f158['query']['ids']);}})[_0x128e('0x25')](respondWithStatusCode(_0x51800e,null))['catch'](handleError(_0x51800e,null));};exports['download']=function(_0x1264b3,_0x27e0b4){var _0x3b8c00=moment()[_0x128e('0xc9')]()[_0x128e('0x97')]();var _0x1e621c=path[_0x128e('0xca')](config[_0x128e('0xcb')],'server','files',_0x128e('0xcc'));var _0x146704=path[_0x128e('0xca')](config[_0x128e('0xcb')],_0x128e('0xcd'),_0x128e('0xce'),_0x128e('0xcf'));var _0x4082b5=path[_0x128e('0xca')](_0x1e621c,_0x3b8c00);var _0x5127fa=util[_0x128e('0xc0')](_0x128e('0xd0'),_0x1264b3[_0x128e('0xb9')]['id'],_0x3b8c00);var _0x48e0cb=path[_0x128e('0xca')](_0x1e621c,_0x5127fa);var _0x5eeaec=[];_0x5eeaec['push']({'model':db['User'],'as':'User','attributes':['id',_0x128e('0x2c')],'raw':!![]});_0x5eeaec[_0x128e('0x30')]({'model':db[_0x128e('0xd1')],'as':_0x128e('0x5e'),'attributes':['id','firstName',_0x128e('0xd2')],'raw':!![]});var _0x5e7c88=[{'model':db['SmsMessage'],'as':_0x128e('0xd3'),'attributes':['id',_0x128e('0x70'),_0x128e('0x74'),_0x128e('0xd4'),_0x128e('0xd5'),_0x128e('0xd6')],'include':_0x5eeaec}];_0x5e7c88[_0x128e('0x30')]({'model':db['SmsAccount'],'as':_0x128e('0xd7'),'attributes':['id',_0x128e('0x29')]});_0x5e7c88[_0x128e('0x30')]({'model':db[_0x128e('0x6c')],'as':_0x128e('0xd8'),'attributes':['id',_0x128e('0x2c')]});return db['SmsInteraction']['find']({'where':{'id':_0x1264b3[_0x128e('0xb9')]['id']},'include':_0x5e7c88})[_0x128e('0x25')](handleEntityNotFound(_0x27e0b4,null))[_0x128e('0x25')](function(_0xa5411){if(_0xa5411){var _0x96b4ad=_0xa5411[_0x128e('0xd9')]({'plain':!![]});fs[_0x128e('0xda')](_0x4082b5);var _0x5b14b3={'channel':'Sms','account':_0x96b4ad[_0x128e('0xd7')]['name'],'agent':_0x96b4ad[_0x128e('0xd8')]?_0x96b4ad['Owner'][_0x128e('0x2c')]:_0x128e('0xdb'),'createdAt':moment(_0x96b4ad['createdAt'])['format'](_0x128e('0xc1'))[_0x128e('0x97')](),'closedAt':_0x96b4ad['closed']?moment(_0x96b4ad[_0x128e('0xdc')])['format'](_0x128e('0xc1'))['toString']():'','disposition':_0x96b4ad[_0x128e('0xdd')],'messages':_(_0x96b4ad[_0x128e('0xd3')])[_0x128e('0x7e')]({'secret':![]})[_0x128e('0x2b')](function(_0x1345bc){return{'date':moment(_0x1345bc[_0x128e('0x74')])['format'](_0x128e('0xc1'))[_0x128e('0x97')](),'sender':_0x1345bc[_0x128e('0xd4')]===_0x128e('0xde')?_0x1345bc[_0x128e('0x6c')]?_0x1345bc[_0x128e('0x6c')][_0x128e('0x2c')]:_0x128e('0xdf'):_0x1345bc[_0x128e('0x5e')][_0x128e('0xe0')]+(_0x1345bc['Contact']['lastName']?'\x20'+_0x1345bc[_0x128e('0x5e')][_0x128e('0xd2')]:''),'body':_0x1345bc['body'],'direction':_0x1345bc[_0x128e('0xd4')]===_0x128e('0xde')?'A':'C','secret':_0x1345bc['secret'],'read':_0x1345bc[_0x128e('0xd6')]};})['value']()};return ejs['renderFile'](path[_0x128e('0xca')](config[_0x128e('0xcb')],_0x128e('0xcd'),'views',_0x128e('0xe1')),{'interaction':_0x5b14b3})[_0x128e('0x25')](function(_0x3d5eaa){var _0x56622f=path[_0x128e('0xca')](_0x4082b5,_0x128e('0xe2')+_0x96b4ad['id']+'-'+_0x3b8c00+_0x128e('0xe3'));var _0x52fd45={'path':_0x56622f,'channel':_0x128e('0xe4'),'interactionId':_0x96b4ad['id']};return pdf[_0x128e('0xe5')](_0x3d5eaa,_0x52fd45);})[_0x128e('0x25')](function(){return new BPromise(function(_0x325317,_0x5d2cc4){zipdir(_0x4082b5,{'saveTo':_0x48e0cb},function(_0x193d7e,_0x4fcd7f){if(_0x193d7e)return _0x5d2cc4(_0x193d7e);return _0x325317(_0x4fcd7f);});})['then'](function(){return new BPromise(function(_0x5a5bdc,_0x4dfca5){rimraf(_0x4082b5,function(_0x1afbe3){if(_0x1afbe3)_0x4dfca5(_0x1afbe3);return _0x5a5bdc();});});})[_0x128e('0x25')](function(){return _0x27e0b4[_0x128e('0xe6')](_0x48e0cb,_0x5127fa,function(_0x251d59){if(_0x251d59){console[_0x128e('0xe7')](_0x128e('0xe8'),_0x251d59);}else{fs[_0x128e('0xe9')](_0x48e0cb);}});});});}else{return _0x27e0b4[_0x128e('0x26')](0xc8);}})[_0x128e('0xb2')](handleError(_0x27e0b4,null));}; \ No newline at end of file +var _0xe323=['me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IN\x20?','sequelize','toString','merge','SmsInteraction','unreadMessages','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','params','intersection','includeAll','options','create','body','destroy','describe','addMessage','ids','omit','getMessages','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','User','Owner','get','mkdirSync','N.A.','closed','disposition','out','downloadInteraction.ejs','.pdf','Sms','log','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','save','update','then','end','error','stack','name','send','map','fullname','Tags','split','forEach','push','TagIds','catch','index','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0xe323,0x16c));var _0x3e32=function(_0x6205e3,_0x58c848){_0x6205e3=_0x6205e3-0x0;var _0x2ab597=_0xe323[_0x6205e3];return _0x2ab597;};'use strict';var emlformat=require(_0x3e32('0x0'));var rimraf=require(_0x3e32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e32('0x2'));var rp=require('request-promise');var moment=require(_0x3e32('0x3'));var BPromise=require(_0x3e32('0x4'));var Mustache=require(_0x3e32('0x5'));var util=require(_0x3e32('0x6'));var path=require(_0x3e32('0x7'));var sox=require(_0x3e32('0x8'));var csv=require(_0x3e32('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e32('0xa'));var squel=require(_0x3e32('0xb'));var crypto=require(_0x3e32('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3e32('0x9'));var querystring=require(_0x3e32('0xd'));var Papa=require(_0x3e32('0xe'));var Redis=require('ioredis');var authService=require(_0x3e32('0xf'));var qs=require(_0x3e32('0x10'));var as=require(_0x3e32('0x11'));var pdf=require(_0x3e32('0x12'));var hardwareService=require(_0x3e32('0x13'));var logger=require(_0x3e32('0x14'))(_0x3e32('0x15'));var utils=require(_0x3e32('0x16'));var config=require(_0x3e32('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3e32('0x18')]=_[_0x3e32('0x19')](config[_0x3e32('0x18')],{'host':_0x3e32('0x1a'),'port':0x18eb});var socket=require(_0x3e32('0x1b'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x3e32('0x1c')](socket);function respondWithStatusCode(_0x1e9bb8,_0x5d55a8){_0x5d55a8=_0x5d55a8||0xcc;return function(_0x1bf999){if(_0x1bf999){return _0x1e9bb8[_0x3e32('0x1d')](_0x5d55a8);}return _0x1e9bb8[_0x3e32('0x1e')](_0x5d55a8)['end']();};}function respondWithResult(_0x520679,_0x1f09ed){_0x1f09ed=_0x1f09ed||0xc8;return function(_0x12deba){if(_0x12deba){return _0x520679[_0x3e32('0x1e')](_0x1f09ed)['json'](_0x12deba);}};}function respondWithFilteredResult(_0x32ca42,_0x5c5568){return function(_0x448614){if(_0x448614){var _0x52d3f4=typeof _0x5c5568[_0x3e32('0x1f')]==='undefined'&&typeof _0x5c5568['limit']==='undefined';var _0x3cb1f8=_0x448614[_0x3e32('0x20')];var _0x540f59=_0x52d3f4?0x0:_0x5c5568['offset'];var _0x114661=_0x52d3f4?_0x448614[_0x3e32('0x20')]:_0x5c5568[_0x3e32('0x1f')]+_0x5c5568[_0x3e32('0x21')];var _0x4c19e6;if(_0x114661>=_0x3cb1f8){_0x114661=_0x3cb1f8;_0x4c19e6=0xc8;}else{_0x4c19e6=0xce;}_0x32ca42[_0x3e32('0x1e')](_0x4c19e6);return _0x32ca42[_0x3e32('0x22')](_0x3e32('0x23'),_0x540f59+'-'+_0x114661+'/'+_0x3cb1f8)[_0x3e32('0x24')](_0x448614);}return null;};}function patchUpdates(_0x559f14){return function(_0x5733b6){try{jsonpatch[_0x3e32('0x25')](_0x5733b6,_0x559f14,!![]);}catch(_0x4fd8e5){return BPromise['reject'](_0x4fd8e5);}return _0x5733b6[_0x3e32('0x26')]();};}function saveUpdates(_0x3bb094,_0x385bf8){return function(_0x25a099){if(_0x25a099){return _0x25a099[_0x3e32('0x27')](_0x3bb094)[_0x3e32('0x28')](function(_0x2cff85){return _0x2cff85;});}return null;};}function removeEntity(_0x40dfd6,_0xca18c1){return function(_0x1f16f4){if(_0x1f16f4){return _0x1f16f4['destroy']()['then'](function(){_0x40dfd6[_0x3e32('0x1e')](0xcc)[_0x3e32('0x29')]();});}};}function handleEntityNotFound(_0x2b9088,_0x416cab){return function(_0x6ce32){if(!_0x6ce32){_0x2b9088['sendStatus'](0x194);}return _0x6ce32;};}function handleError(_0x13e687,_0x430c82){_0x430c82=_0x430c82||0x1f4;return function(_0x81e793){logger[_0x3e32('0x2a')](_0x81e793[_0x3e32('0x2b')]);if(_0x81e793[_0x3e32('0x2c')]){delete _0x81e793[_0x3e32('0x2c')];}_0x13e687['status'](_0x430c82)[_0x3e32('0x2d')](_0x81e793);};}function getInteractionUsers(_0x532c58,_0x3ea435){return new BPromise(function(_0x4bda13,_0x7abe0d){try{if(_0x3ea435[_0x532c58['id']]){_0x532c58['Users']=_[_0x3e32('0x2e')](_0x3ea435[_0x532c58['id']],function(_0x33e8bd){return{'id':_0x33e8bd['id'],'fullname':_0x33e8bd[_0x3e32('0x2f')]};});}}catch(_0x24d41e){_0x7abe0d(_0x24d41e);}_0x4bda13(_0x532c58);});}function getInteractionTags(_0x1d1657,_0x54d2d5){return new BPromise(function(_0x10a4ed,_0x2d032a){try{if(_0x1d1657['TagIds']){_0x1d1657[_0x3e32('0x30')]=[];_0x1d1657['TagIds'][_0x3e32('0x31')](',')[_0x3e32('0x32')](function(_0x299492){_0x1d1657[_0x3e32('0x30')][_0x3e32('0x33')](_0x54d2d5[_0x299492]);});}delete _0x1d1657[_0x3e32('0x34')];}catch(_0xe850e4){_0x2d032a(_0xe850e4);}_0x10a4ed(_0x1d1657);});}function updateSmsInteraction(_0x6bcc29,_0x4c67fe,_0x1774a4){return new BPromise(function(_0x21eed4,_0x298a9b){return getInteractionUsers(_0x6bcc29,_0x1774a4)[_0x3e32('0x28')](function(_0x509498){return getInteractionTags(_0x509498,_0x4c67fe);})[_0x3e32('0x28')](function(_0x158292){_0x21eed4(_0x158292);})[_0x3e32('0x35')](function(_0x4f0d3e){_0x298a9b(_0x4f0d3e);});});}exports[_0x3e32('0x36')]=function(_0x543d06,_0x21d4b9){var _0x3bc33d={},_0xef34d0={},_0x5f3d22={'count':0x0,'rows':[]};var _0x373dd8=_[_0x3e32('0x2e')](db['SmsInteraction'][_0x3e32('0x37')],function(_0x5dd1cf){return{'name':_0x5dd1cf[_0x3e32('0x38')],'type':_0x5dd1cf[_0x3e32('0x39')]['key']};});_0xef34d0[_0x3e32('0x3a')]=_[_0x3e32('0x2e')](_0x373dd8,_0x3e32('0x2c'));_0xef34d0[_0x3e32('0x3b')]=_[_0x3e32('0x3c')](_0x543d06[_0x3e32('0x3b')]);_0xef34d0[_0x3e32('0x3d')]=_['intersection'](_0xef34d0['model'],_0xef34d0['query']);_0x3bc33d['attributes']=_['intersection'](_0xef34d0[_0x3e32('0x3a')],qs[_0x3e32('0x3e')](_0x543d06[_0x3e32('0x3b')][_0x3e32('0x3e')]));_0x3bc33d[_0x3e32('0x3f')]=_0x3bc33d[_0x3e32('0x3f')][_0x3e32('0x40')]?_0x3bc33d['attributes']:_0xef34d0[_0x3e32('0x3a')];if(!_0x543d06[_0x3e32('0x3b')][_0x3e32('0x41')](_0x3e32('0x42'))){_0x3bc33d[_0x3e32('0x21')]=qs['limit'](_0x543d06[_0x3e32('0x3b')]['limit']);_0x3bc33d[_0x3e32('0x1f')]=qs[_0x3e32('0x1f')](_0x543d06[_0x3e32('0x3b')][_0x3e32('0x1f')]);}_0x3bc33d[_0x3e32('0x43')]=qs[_0x3e32('0x44')](_0x543d06[_0x3e32('0x3b')][_0x3e32('0x44')]);_0x3bc33d[_0x3e32('0x45')]=qs[_0x3e32('0x3d')](_[_0x3e32('0x46')](_0x543d06[_0x3e32('0x3b')],_0xef34d0[_0x3e32('0x3d')]),_0x373dd8);var _0x56877f=[];var _0x169d1d=squel[_0x3e32('0x47')]()[_0x3e32('0x48')]('id')[_0x3e32('0x48')](_0x3e32('0x2c'))['field'](_0x3e32('0x49'))[_0x3e32('0x4a')](_0x3e32('0x4b'));var _0x5bb6be=squel['select']()['field']('u.id')[_0x3e32('0x48')](_0x3e32('0x4c'))['field']('ui.SmsInteractionId')[_0x3e32('0x4a')](_0x3e32('0x4d'),'ui')['left_join'](_0x3e32('0x4e'),'u',_0x3e32('0x4f'));var _0xffac37=squel['select']()['from'](_0x3e32('0x50'),'i')[_0x3e32('0x51')](_0x3e32('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x3e32('0x4e'),'o',_0x3e32('0x53'))[_0x3e32('0x51')](_0x3e32('0x54'),'a',_0x3e32('0x55'))[_0x3e32('0x51')]('sms_messages','me',_0x3e32('0x56'))[_0x3e32('0x51')](_0x3e32('0x57'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x3e32('0x51')](_0x3e32('0x4b'),'t',_0x3e32('0x58'));var _0x388fb0=squel['expr']();var _0x21c042=[];var _0x57e3a2=squel[_0x3e32('0x59')]();var _0x47b939;if(_0x543d06[_0x3e32('0x3b')][_0x3e32('0x5a')]){_0x47b939=as['parseSearch'](_0x543d06[_0x3e32('0x3b')][_0x3e32('0x5a')]);var _0xff2649=_0x47b939['sqlOperator'];for(var _0x97beae=0x0;_0x97beae<_0x47b939[_0x3e32('0x5b')][_0x3e32('0x40')];_0x97beae++){var _0x554a32=_0x47b939[_0x3e32('0x5b')][_0x97beae];var _0x548923='i';var _0x56e43c=_[_0x3e32('0x5c')](_0x373dd8,[_0x3e32('0x2c'),_0x554a32[_0x3e32('0x48')]]);if(!_0x56e43c){switch(_0x554a32[_0x3e32('0x48')]){case'unreadMessages':if(_0x554a32[_0x3e32('0x5d')]==0x1){_0xffac37[_0x3e32('0x5e')]('`'+_0x554a32[_0x3e32('0x48')]+_0x3e32('0x5f'));}else{_0xffac37[_0x3e32('0x5e')]('`'+_0x554a32[_0x3e32('0x48')]+_0x3e32('0x60'));}break;case'Contact':if(_0x554a32['operator']==='$substring'){if(_0x554a32[_0x3e32('0x5d')][_0x3e32('0x31')]('\x20')[_0x3e32('0x40')]>0x1){_0x388fb0[_0xff2649](_0x3e32('0x61'),qs['getFullTextValue'](_0x554a32[_0x3e32('0x5d')]),null);}else{var _0x4d452e='%'+_0x554a32[_0x3e32('0x5d')]+'%';_0x388fb0[_0xff2649](_0x3e32('0x62'),_0x4d452e,_0x4d452e,_0x4d452e);}}else{_0x56e43c=_[_0x3e32('0x5c')](_0x373dd8,[_0x3e32('0x2c'),_0x3e32('0x63')]);_0x554a32[_0x3e32('0x48')]=_0x3e32('0x63');_0x1aa405=as[_0x3e32('0x64')](_0x548923,_0x56e43c[_0x3e32('0x39')],_0x554a32);_0x388fb0[_0xff2649](_0x1aa405[_0x3e32('0x65')],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x66')],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x29')]);}break;case _0x3e32('0x67'):var _0x3a8dc2=_0x554a32['value'][_0x3e32('0x31')](',')[_0x3e32('0x2e')](function(_0x30e675){return Number(_0x30e675);});_0x3a8dc2[_0x3e32('0x32')](function(_0x1b87ab){_0x57e3a2['or'](_0x3e32('0x68'),'%,'+_0x1b87ab+',%');});_0x21c042=_[_0x3e32('0x69')](_0x21c042,_0x3a8dc2);break;case'User':if(_0x554a32[_0x3e32('0x6a')]===_0x3e32('0x6b')){_0x388fb0[_0xff2649](_0x3e32('0x6c'),'%'+_0x554a32['value']+'%',null);}else{_0x56e43c=_['find'](_0x373dd8,['name',_0x3e32('0x6d')]);_0x554a32[_0x3e32('0x48')]=_0x3e32('0x6d');_0x1aa405=as[_0x3e32('0x64')](_0x548923,_0x56e43c['type'],_0x554a32);_0x388fb0[_0xff2649](_0x1aa405[_0x3e32('0x65')],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x66')],_0x1aa405['value']['end']);}break;case'body':_0x1aa405=as[_0x3e32('0x64')]('me',null,_0x554a32);_0x388fb0[_0xff2649](_0x1aa405[_0x3e32('0x65')],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x66')],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x29')]);break;}}else{var _0x1aa405=as[_0x3e32('0x64')](_0x548923,_0x56e43c['type'],_0x554a32);_0x388fb0[_0xff2649](_0x1aa405['text'],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x66')],_0x1aa405[_0x3e32('0x5d')][_0x3e32('0x29')]);}}}else{var _0x2b5f27=_(_0x543d06['query'])[_0x3e32('0x3c')]()[_0x3e32('0x2e')](function(_0x537d82){return _[_0x3e32('0x6e')](_0x373dd8,['name',_0x537d82])?_0x537d82:undefined;})[_0x3e32('0x6f')]()[_0x3e32('0x5d')]();if(!_[_0x3e32('0x70')](_0x2b5f27)){_0x2b5f27['forEach'](function(_0x33ebed){if(_0x33ebed===_0x3e32('0x71')){_0xffac37[_0x3e32('0x45')]('i.SmsAccountId\x20IN\x20?',[][_0x3e32('0x72')](_0x543d06[_0x3e32('0x3b')][_0x33ebed]));}else if(_0x33ebed===_0x3e32('0x73')){var _0x38cdad=JSON[_0x3e32('0x74')](_0x543d06[_0x3e32('0x3b')][_0x33ebed])[_0x3e32('0x75')];var _0x546d95=JSON[_0x3e32('0x74')](_0x543d06['query'][_0x33ebed])[_0x3e32('0x76')];_0xffac37['where'](_0x3e32('0x77'),_0x38cdad,_0x546d95);}else{if(_0x543d06['query'][_0x33ebed]===_0x3e32('0x78')){_0xffac37[_0x3e32('0x45')]('i.'+_0x33ebed+_0x3e32('0x79'));}else{_0xffac37['where']('i.'+_0x33ebed+'\x20=\x20?',_0x543d06[_0x3e32('0x3b')][_0x33ebed]);}}});}if(_0x543d06[_0x3e32('0x3b')][_0x3e32('0x7a')]){if(_0x543d06[_0x3e32('0x3b')][_0x3e32('0x7a')]==0x1){_0xffac37[_0x3e32('0x5e')]('`unreadMessages`\x20=\x200');}else{_0xffac37[_0x3e32('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x543d06[_0x3e32('0x3b')][_0x3e32('0x7b')]){_0x21c042=_[_0x3e32('0x7c')](_0x543d06['query']['tag'])?_0x543d06[_0x3e32('0x3b')][_0x3e32('0x7b')]:new Array(_0x543d06[_0x3e32('0x3b')]['tag']);_0x21c042[_0x3e32('0x32')](function(_0x340abf){_0x57e3a2['or'](_0x3e32('0x68'),'%,'+_0x340abf+',%');});}if(_0x543d06[_0x3e32('0x3b')][_0x3e32('0x7d')]){var _0x4b5905=_0x543d06[_0x3e32('0x3b')][_0x3e32('0x7d')][_0x3e32('0x7e')]('\x5c','\x5c\x5c')[_0x3e32('0x7e')](/'/g,'\x27\x27');if(qs[_0x3e32('0x7f')](_0x4b5905)){_0x388fb0['or'](_0x3e32('0x80'),_0x4b5905+'%')['or']('i.phone\x20LIKE\x20?',_0x4b5905+'%');}else{_0x388fb0['or'](_0x3e32('0x81'),qs[_0x3e32('0x82')](_0x4b5905))['or'](_0x3e32('0x83'),_0x4b5905+'%');}}}_0xffac37['where'](_0x388fb0);_0xffac37[_0x3e32('0x84')](_0x3e32('0x85'));var _0x3b1d17={'type':db['Sequelize'][_0x3e32('0x86')]['SELECT'],'raw':!![]};var _0x2d9cfa=_0xffac37[_0x3e32('0x87')]();_0x2d9cfa[_0x3e32('0x48')]('i.id');_0x2d9cfa[_0x3e32('0x48')](_0x3e32('0x88'),'unreadMessages');if(_0x3bc33d[_0x3e32('0x43')]){_0x3bc33d[_0x3e32('0x43')]['forEach'](function(_0x57b870){var _0xef6fc2=_0x57b870[0x0]===_0x3e32('0x89')?_0x57b870[0x0]:'i.'+_0x57b870[0x0];_0xffac37[_0x3e32('0x43')](_0xef6fc2,_0x57b870[0x1]===_0x3e32('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x21c042)){_0xffac37[_0x3e32('0x5e')](_0x57e3a2);_0x2d9cfa[_0x3e32('0x45')](_0x3e32('0x8b'),_0x21c042);}BPromise['resolve']()[_0x3e32('0x28')](function(){if(!_0x47b939){if(_0x543d06[_0x3e32('0x3b')][_0x3e32('0x71')])return;_0x2d9cfa[_0x3e32('0x45')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0xffac37[_0x3e32('0x45')](_0x3e32('0x8c'));return;}if(_0x543d06[_0x3e32('0x8d')][_0x3e32('0x8e')]!==_0x3e32('0x8f'))return;return _0x543d06[_0x3e32('0x8d')][_0x3e32('0x90')]({'attributes':['id'],'raw':!![]})[_0x3e32('0x28')](function(_0x507bcf){if(_[_0x3e32('0x70')](_0x507bcf)){_0x2d9cfa['where']('i.SmsAccountId\x20IS\x20NULL');_0xffac37[_0x3e32('0x45')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2d9cfa[_0x3e32('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x3e32('0x2e')](_0x507bcf,'id'));_0xffac37['where'](_0x3e32('0x91'),_['map'](_0x507bcf,'id'));}});})[_0x3e32('0x28')](function(){if(_0x543d06[_0x3e32('0x8d')]['role']===_0x3e32('0x8f')&&!_0x47b939&&!_0x543d06[_0x3e32('0x3b')][_0x3e32('0x71')])return[];return db[_0x3e32('0x92')][_0x3e32('0x3b')](_0x2d9cfa[_0x3e32('0x93')](),_0x3b1d17);})[_0x3e32('0x28')](function(_0x34011c){_0x5f3d22[_0x3e32('0x20')]=_0x34011c['length'];if(_0x5f3d22[_0x3e32('0x20')]===0x0)return[];return db[_0x3e32('0x92')]['query'](_0x169d1d['toString'](),_0x3b1d17)[_0x3e32('0x28')](function(_0xbf6c29){_0x56877f=_['keyBy'](_0xbf6c29,'id');_0x3b1d17=_[_0x3e32('0x94')](_0x3b1d17,{'model':db[_0x3e32('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x543d06[_0x3e32('0x3b')]['fields']){_0x3bc33d[_0x3e32('0x3f')][_0x3e32('0x32')](function(_0x561f8b){_0xffac37[_0x3e32('0x48')]('i.'+_0x561f8b);});}else{_0xffac37[_0x3e32('0x48')](_0x3e32('0x88'),_0x3e32('0x96'));_0xffac37['field']('a.key',_0x3e32('0x97'));_0xffac37[_0x3e32('0x48')]('a.mandatoryDisposition',_0x3e32('0x98'));_0xffac37['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xffac37[_0x3e32('0x48')]('i.*');_0xffac37[_0x3e32('0x48')](_0x3e32('0x99'),'Contact.firstName');_0xffac37['field'](_0x3e32('0x9a'),'Contact.lastName');_0xffac37[_0x3e32('0x48')]('c.email',_0x3e32('0x9b'));_0xffac37['field'](_0x3e32('0x9c'),_0x3e32('0x9d'));_0xffac37[_0x3e32('0x48')](_0x3e32('0x9e'),_0x3e32('0x9f'));_0xffac37[_0x3e32('0x48')](_0x3e32('0xa0'),_0x3e32('0xa1'));_0xffac37[_0x3e32('0x48')](_0x3e32('0xa2'),_0x3e32('0xa3'));_0xffac37[_0x3e32('0x48')](_0x3e32('0xa4'),'Owner.internal');_0xffac37[_0x3e32('0x48')](_0x3e32('0xa5'),_0x3e32('0x34'));}if(_0x3bc33d['limit'])_0xffac37[_0x3e32('0x21')](_0x3bc33d[_0x3e32('0x21')]);if(_0x3bc33d['offset'])_0xffac37[_0x3e32('0x1f')](_0x3bc33d[_0x3e32('0x1f')]);return db[_0x3e32('0x92')][_0x3e32('0x3b')](_0xffac37[_0x3e32('0x93')](),_0x3b1d17);})['then'](function(_0x3829b0){if(_0x3829b0['length']>0x0)_0x5bb6be[_0x3e32('0x45')](_0x3e32('0xa6'),_[_0x3e32('0x2e')](_0x3829b0,'id'));return db['sequelize'][_0x3e32('0x3b')](_0x5bb6be[_0x3e32('0x93')](),_0x3b1d17)[_0x3e32('0x28')](function(_0x2138bf){var _0x51e9c8=_[_0x3e32('0xa7')](_0x2138bf,_0x3e32('0xa8'));var _0x3b636a=[];_0x3829b0[_0x3e32('0x32')](function(_0x366c31){_0x3b636a[_0x3e32('0x33')](updateSmsInteraction(_0x366c31,_0x56877f,_0x51e9c8));});return BPromise[_0x3e32('0xa9')](_0x3b636a);});});})['then'](function(_0x8ec0cd){_0x5f3d22['rows']=_0x8ec0cd;return _0x5f3d22;})[_0x3e32('0x28')](respondWithFilteredResult(_0x21d4b9,_0x3bc33d))[_0x3e32('0x35')](handleError(_0x21d4b9,null));};exports['show']=function(_0x3b5c69,_0xf96284){var _0x4d9bf7={'raw':![],'where':{'id':_0x3b5c69[_0x3e32('0xaa')]['id']}},_0x43ee66={};_0x43ee66[_0x3e32('0x3a')]=_[_0x3e32('0x3c')](db[_0x3e32('0x95')][_0x3e32('0x37')]);_0x43ee66['query']=_['keys'](_0x3b5c69[_0x3e32('0x3b')]);_0x43ee66[_0x3e32('0x3d')]=_[_0x3e32('0xab')](_0x43ee66[_0x3e32('0x3a')],_0x43ee66['query']);_0x4d9bf7[_0x3e32('0x3f')]=_[_0x3e32('0xab')](_0x43ee66[_0x3e32('0x3a')],qs[_0x3e32('0x3e')](_0x3b5c69[_0x3e32('0x3b')][_0x3e32('0x3e')]));_0x4d9bf7[_0x3e32('0x3f')]=_0x4d9bf7[_0x3e32('0x3f')][_0x3e32('0x40')]?_0x4d9bf7[_0x3e32('0x3f')]:_0x43ee66[_0x3e32('0x3a')];if(_0x3b5c69[_0x3e32('0x3b')][_0x3e32('0xac')]){_0x4d9bf7['include']=[{'all':!![]}];}_0x4d9bf7=_[_0x3e32('0x94')]({},_0x4d9bf7,_0x3b5c69[_0x3e32('0xad')]);return db[_0x3e32('0x95')][_0x3e32('0x5c')](_0x4d9bf7)[_0x3e32('0x28')](handleEntityNotFound(_0xf96284,null))['then'](respondWithResult(_0xf96284,null))['catch'](handleError(_0xf96284,null));};exports[_0x3e32('0xae')]=function(_0x2a04df,_0x8abb8b){return db[_0x3e32('0x95')][_0x3e32('0xae')](_0x2a04df['body'],{})[_0x3e32('0x28')](respondWithResult(_0x8abb8b,0xc9))[_0x3e32('0x35')](handleError(_0x8abb8b,null));};exports[_0x3e32('0x27')]=function(_0x528ebc,_0x38634e){if(_0x528ebc['body']['id']){delete _0x528ebc[_0x3e32('0xaf')]['id'];}return db[_0x3e32('0x95')]['find']({'where':{'id':_0x528ebc[_0x3e32('0xaa')]['id']}})[_0x3e32('0x28')](handleEntityNotFound(_0x38634e,null))[_0x3e32('0x28')](saveUpdates(_0x528ebc[_0x3e32('0xaf')],null))[_0x3e32('0x28')](respondWithResult(_0x38634e,null))[_0x3e32('0x35')](handleError(_0x38634e,null));};exports[_0x3e32('0xb0')]=function(_0x3003a6,_0x1dee94){return db[_0x3e32('0x95')]['find']({'where':{'id':_0x3003a6['params']['id']}})[_0x3e32('0x28')](handleEntityNotFound(_0x1dee94,null))['then'](removeEntity(_0x1dee94,null))[_0x3e32('0x35')](handleError(_0x1dee94,null));};exports[_0x3e32('0xb1')]=function(_0x3e0917,_0x1b2c53){return db['SmsInteraction']['describe']()[_0x3e32('0x28')](respondWithResult(_0x1b2c53,null))['catch'](handleError(_0x1b2c53,null));};exports['addMessage']=function(_0x119d68,_0x230770,_0x4480f0){return db['SmsMessage']['find']({'where':{'id':_0x119d68[_0x3e32('0xaa')]['id']}})['then'](handleEntityNotFound(_0x230770,null))[_0x3e32('0x28')](function(_0x49c280){if(_0x49c280){return _0x49c280[_0x3e32('0xb2')](_0x119d68['body'][_0x3e32('0xb3')],_[_0x3e32('0xb4')](_0x119d68[_0x3e32('0xaf')],[_0x3e32('0xb3'),'id'])||{});}})[_0x3e32('0x28')](respondWithResult(_0x230770,null))[_0x3e32('0x35')](handleError(_0x230770,null));};exports[_0x3e32('0xb5')]=function(_0x2cffbb,_0x33b434,_0xd71a9){var _0x4ecc89={'raw':![],'where':{}};var _0x51820d={};var _0x36da6d={'count':0x0,'rows':[]};return db[_0x3e32('0x95')]['findOne']({'where':{'id':_0x2cffbb[_0x3e32('0xaa')]['id']}})[_0x3e32('0x28')](handleEntityNotFound(_0x33b434,null))[_0x3e32('0x28')](function(_0x25a26d){if(_0x25a26d){_0x51820d['model']=_[_0x3e32('0x3c')](db[_0x3e32('0xb6')][_0x3e32('0x37')]);_0x51820d[_0x3e32('0x3b')]=_[_0x3e32('0x3c')](_0x2cffbb['query']);_0x51820d[_0x3e32('0x3d')]=_['intersection'](_0x51820d[_0x3e32('0x3a')],_0x51820d[_0x3e32('0x3b')]);_0x4ecc89[_0x3e32('0x3f')]=_[_0x3e32('0xab')](_0x51820d[_0x3e32('0x3a')],qs['fields'](_0x2cffbb['query'][_0x3e32('0x3e')]));_0x4ecc89[_0x3e32('0x3f')]=_0x4ecc89[_0x3e32('0x3f')]['length']?_0x4ecc89[_0x3e32('0x3f')]:_0x51820d[_0x3e32('0x3a')];if(!_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x41')](_0x3e32('0x42'))){_0x4ecc89[_0x3e32('0x21')]=qs[_0x3e32('0x21')](_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x21')]);_0x4ecc89[_0x3e32('0x1f')]=qs['offset'](_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x1f')]);}_0x4ecc89[_0x3e32('0x43')]=qs[_0x3e32('0x44')](_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x44')]);_0x4ecc89[_0x3e32('0x45')]=qs['filters'](_[_0x3e32('0x46')](_0x2cffbb[_0x3e32('0x3b')],_0x51820d[_0x3e32('0x3d')]));_0x4ecc89[_0x3e32('0x45')][_0x3e32('0xa8')]=_0x25a26d['id'];if(_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x7d')]){_0x4ecc89[_0x3e32('0x45')]=_[_0x3e32('0x94')](_0x4ecc89['where'],{'$or':_[_0x3e32('0x2e')](_0x4ecc89[_0x3e32('0x3f')],function(_0x3fd612){var _0x3cee53={};_0x3cee53[_0x3fd612]={'$like':'%'+_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x7d')]+'%'};return _0x3cee53;})});}if(_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x75')]){var _0x3bc846=_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0x75')][_0x3e32('0x31')](',');var _0x19ca1e={};_0x19ca1e[_0x3bc846[0x0]]={'$gte':moment(_0x3bc846[0x1])[_0x3e32('0xb7')](_0x3e32('0xb8'))};_0x4ecc89[_0x3e32('0x45')]=_[_0x3e32('0x94')](_0x4ecc89[_0x3e32('0x45')],_0x19ca1e);}_0x4ecc89=_[_0x3e32('0x94')]({},_0x4ecc89,_0x2cffbb[_0x3e32('0xad')]);return db[_0x3e32('0xb6')]['count']({'where':_0x4ecc89[_0x3e32('0x45')]})[_0x3e32('0x28')](function(_0x28afcf){_0x36da6d[_0x3e32('0x20')]=_0x28afcf;if(_0x2cffbb[_0x3e32('0x3b')][_0x3e32('0xac')]){_0x4ecc89[_0x3e32('0xb9')]=[{'all':!![]}];}return db[_0x3e32('0xb6')][_0x3e32('0xba')](_0x4ecc89);})[_0x3e32('0x28')](function(_0x553cd5){_0x36da6d[_0x3e32('0xbb')]=_0x553cd5;return _0x36da6d;});}})[_0x3e32('0x28')](respondWithFilteredResult(_0x33b434,_0x4ecc89))['catch'](handleError(_0x33b434,null));};exports[_0x3e32('0xbc')]=function(_0x4fd02e,_0x200a6a,_0x496427){return db[_0x3e32('0x95')][_0x3e32('0x5c')]({'where':{'id':_0x4fd02e[_0x3e32('0xaa')]['id']}})['then'](handleEntityNotFound(_0x200a6a,null))[_0x3e32('0x28')](function(_0x47f9eb){if(_0x47f9eb){return _0x47f9eb[_0x3e32('0xbd')](_0x4fd02e[_0x3e32('0xaf')][_0x3e32('0xb3')],_[_0x3e32('0xb4')](_0x4fd02e[_0x3e32('0xaf')],[_0x3e32('0xb3'),'id'])||{})[_0x3e32('0xbe')](function(){return db[_0x3e32('0x67')]['findAll']({'attributes':['id',_0x3e32('0x2c'),_0x3e32('0x49')],'where':{'id':_0x4fd02e[_0x3e32('0xaf')][_0x3e32('0xb3')]}});})[_0x3e32('0x28')](function(_0x3810b0){socket[_0x3e32('0xbf')](_0x3e32('0xc0'),{'id':Number(_0x4fd02e['params']['id']),'tags':_0x3810b0||[]});return{'id':Number(_0x4fd02e[_0x3e32('0xaa')]['id']),'tags':_0x3810b0||[]};});}})[_0x3e32('0x28')](respondWithResult(_0x200a6a,null))[_0x3e32('0x35')](handleError(_0x200a6a,null));};exports[_0x3e32('0xc1')]=function(_0x32a596,_0x12f004,_0x1c44a7){return db['SmsInteraction'][_0x3e32('0x5c')]({'where':{'id':_0x32a596[_0x3e32('0xaa')]['id']}})['then'](handleEntityNotFound(_0x12f004,null))[_0x3e32('0x28')](function(_0x5bdb26){if(_0x5bdb26){return _0x5bdb26[_0x3e32('0xc1')](_0x32a596[_0x3e32('0x3b')][_0x3e32('0xb3')]);}})[_0x3e32('0x28')](respondWithStatusCode(_0x12f004,null))[_0x3e32('0x35')](handleError(_0x12f004,null));};exports[_0x3e32('0xc2')]=function(_0x3d9100,_0x2b570a){var _0x3a5e01=moment()[_0x3e32('0xc3')]()[_0x3e32('0x93')]();var _0xbcce2e=path[_0x3e32('0xc4')](config['root'],_0x3e32('0xc5'),_0x3e32('0xc6'),_0x3e32('0xc7'));var _0xfe1de8=path['join'](config[_0x3e32('0xc8')],_0x3e32('0xc5'),_0x3e32('0xc6'),_0x3e32('0xc9'));var _0x5c31b5=path['join'](_0xbcce2e,_0x3a5e01);var _0x4645a2=util[_0x3e32('0xb7')](_0x3e32('0xca'),_0x3d9100[_0x3e32('0xaa')]['id'],_0x3a5e01);var _0x2dc544=path[_0x3e32('0xc4')](_0xbcce2e,_0x4645a2);var _0x12de72=[];_0x12de72['push']({'model':db['User'],'as':'User','attributes':['id',_0x3e32('0x2f')],'raw':!![]});_0x12de72[_0x3e32('0x33')]({'model':db[_0x3e32('0xcb')],'as':_0x3e32('0xcc'),'attributes':['id',_0x3e32('0xcd'),_0x3e32('0xce')],'raw':!![]});var _0x3e0a18=[{'model':db[_0x3e32('0xb6')],'as':_0x3e32('0xcf'),'attributes':['id',_0x3e32('0xaf'),_0x3e32('0x73'),_0x3e32('0xd0'),_0x3e32('0xd1'),_0x3e32('0x7a')],'include':_0x12de72}];_0x3e0a18[_0x3e32('0x33')]({'model':db[_0x3e32('0xd2')],'as':_0x3e32('0xd3'),'attributes':['id',_0x3e32('0x2c')]});_0x3e0a18[_0x3e32('0x33')]({'model':db[_0x3e32('0xd4')],'as':_0x3e32('0xd5'),'attributes':['id',_0x3e32('0x2f')]});return db[_0x3e32('0x95')]['find']({'where':{'id':_0x3d9100[_0x3e32('0xaa')]['id']},'include':_0x3e0a18})['then'](handleEntityNotFound(_0x2b570a,null))[_0x3e32('0x28')](function(_0x2dca9b){if(_0x2dca9b){var _0x1b39a3=_0x2dca9b[_0x3e32('0xd6')]({'plain':!![]});fs[_0x3e32('0xd7')](_0x5c31b5);var _0x5d2025={'channel':'Sms','account':_0x1b39a3[_0x3e32('0xd3')][_0x3e32('0x2c')],'agent':_0x1b39a3['Owner']?_0x1b39a3[_0x3e32('0xd5')][_0x3e32('0x2f')]:_0x3e32('0xd8'),'createdAt':moment(_0x1b39a3[_0x3e32('0x73')])[_0x3e32('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3e32('0x93')](),'closedAt':_0x1b39a3[_0x3e32('0xd9')]?moment(_0x1b39a3['closedAt'])[_0x3e32('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3e32('0x93')]():'','disposition':_0x1b39a3[_0x3e32('0xda')],'messages':_(_0x1b39a3[_0x3e32('0xcf')])[_0x3e32('0x7d')]({'secret':![]})[_0x3e32('0x2e')](function(_0x49e81e){return{'date':moment(_0x49e81e[_0x3e32('0x73')])[_0x3e32('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3e32('0x93')](),'sender':_0x49e81e['direction']==='out'?_0x49e81e[_0x3e32('0xd4')]?_0x49e81e[_0x3e32('0xd4')][_0x3e32('0x2f')]:'System':_0x49e81e[_0x3e32('0xcc')][_0x3e32('0xcd')]+(_0x49e81e[_0x3e32('0xcc')]['lastName']?'\x20'+_0x49e81e['Contact'][_0x3e32('0xce')]:''),'body':_0x49e81e[_0x3e32('0xaf')],'direction':_0x49e81e['direction']===_0x3e32('0xdb')?'A':'C','secret':_0x49e81e['secret'],'read':_0x49e81e[_0x3e32('0x7a')]};})[_0x3e32('0x5d')]()};return ejs['renderFile'](path[_0x3e32('0xc4')](config[_0x3e32('0xc8')],_0x3e32('0xc5'),'views',_0x3e32('0xdc')),{'interaction':_0x5d2025})['then'](function(_0x1667cd){var _0x2d4bcc=path[_0x3e32('0xc4')](_0x5c31b5,'transcript-'+_0x1b39a3['id']+'-'+_0x3a5e01+_0x3e32('0xdd'));var _0x21c9aa={'path':_0x2d4bcc,'channel':_0x3e32('0xde'),'interactionId':_0x1b39a3['id']};return pdf['createPdfFromHTML'](_0x1667cd,_0x21c9aa);})[_0x3e32('0x28')](function(){return new BPromise(function(_0x346c45,_0x50eeb7){zipdir(_0x5c31b5,{'saveTo':_0x2dc544},function(_0x3ab092,_0x2a93b9){if(_0x3ab092)return _0x50eeb7(_0x3ab092);return _0x346c45(_0x2a93b9);});})[_0x3e32('0x28')](function(){return new BPromise(function(_0x349615,_0x57af2f){rimraf(_0x5c31b5,function(_0x5d871b){if(_0x5d871b)_0x57af2f(_0x5d871b);return _0x349615();});});})[_0x3e32('0x28')](function(){return _0x2b570a[_0x3e32('0xc2')](_0x2dc544,_0x4645a2,function(_0xdd80cd){if(_0xdd80cd){console[_0x3e32('0xdf')]('err',_0xdd80cd);}else{fs[_0x3e32('0xe0')](_0x2dc544);}});});});}else{return _0x2b570a[_0x3e32('0x1d')](0xc8);}})[_0x3e32('0x35')](handleError(_0x2b570a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b455390..e05ee73 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 _0x351d=['length','emit','catch','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','remove','getUsers','setDataValue','map','unreadMessages'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x351d,0x90));var _0xd351=function(_0x22f52b,_0x43cdd0){_0x22f52b=_0x22f52b-0x0;var _0x435022=_0x351d[_0x22f52b];return _0x435022;};'use strict';var EventEmitter=require(_0xd351('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xd351('0x1')];var SmsMessage=require(_0xd351('0x2'))['db'][_0xd351('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd351('0x4'),'afterUpdate':'update','afterDestroy':_0xd351('0x5')};function emitEvent(_0x151391){return function(_0x49610f,_0x1cd581,_0x45e9e5){_0x49610f[_0xd351('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16b3f7){_0x49610f[_0xd351('0x7')]('Users',_0x16b3f7[_0xd351('0x8')](function(_0xb4f580){return{'id':_0xb4f580['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x49610f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x44bf81){_0x49610f['setDataValue'](_0xd351('0x9'),_0x44bf81[_0xd351('0xa')]);SmsInteractionEvents['emit'](_0x151391+':'+_0x49610f['id'],_0x49610f);SmsInteractionEvents[_0xd351('0xb')](_0x151391,_0x49610f);_0x45e9e5(null);})[_0xd351('0xc')](_0x45e9e5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xd351('0xd')](e,emitEvent(event));}}module['exports']=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(_0x5835e8,_0x610f12){var _0x463a41=function(_0x514e78){while(--_0x514e78){_0x5835e8['push'](_0x5835e8['shift']());}};_0x463a41(++_0x610f12);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x36d887,_0x1782f9){_0x36d887=_0x36d887-0x0;var _0x2634d5=_0xdd4f[_0x36d887];return _0x2634d5;};'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 0c287fc..d0868f5 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 _0xea88=['sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x571d15,_0x1e674a){var _0x15cbe4=function(_0x31fcb8){while(--_0x31fcb8){_0x571d15['push'](_0x571d15['shift']());}};_0x15cbe4(++_0x1e674a);}(_0xea88,0xc8));var _0x8ea8=function(_0x59c887,_0x254da8){_0x59c887=_0x59c887-0x0;var _0x4aceb4=_0xea88[_0x59c887];return _0x4aceb4;};'use strict';var _=require(_0x8ea8('0x0'));var util=require(_0x8ea8('0x1'));var logger=require(_0x8ea8('0x2'))(_0x8ea8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ea8('0x4'));var rimraf=require(_0x8ea8('0x5'));var config=require('../../config/environment');var attributes=require(_0x8ea8('0x6'));module[_0x8ea8('0x7')]=function(_0x1173f4,_0x2ae373){return _0x1173f4[_0x8ea8('0x8')](_0x8ea8('0x9'),attributes,{'tableName':_0x8ea8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38396b,_0x170126,_0x59c7fa){if(_0x38396b['changed'](_0x8ea8('0xb'))){_0x38396b[_0x8ea8('0xc')]=moment()['format'](_0x8ea8('0xd'));}_0x59c7fa(null,_0x38396b);}}});}; \ No newline at end of file +var _0x094d=['closed','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x2c5ca4,_0xcfdcfa){var _0x5b3697=function(_0x3d87ee){while(--_0x3d87ee){_0x2c5ca4['push'](_0x2c5ca4['shift']());}};_0x5b3697(++_0xcfdcfa);}(_0x094d,0x1d6));var _0xd094=function(_0x211964,_0x12ecc6){_0x211964=_0x211964-0x0;var _0x5db508=_0x094d[_0x211964];return _0x5db508;};'use strict';var _=require(_0xd094('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd094('0x1'));var moment=require(_0xd094('0x2'));var BPromise=require(_0xd094('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd094('0x4'));var config=require(_0xd094('0x5'));var attributes=require(_0xd094('0x6'));module[_0xd094('0x7')]=function(_0x572290,_0x983e65){return _0x572290[_0xd094('0x8')](_0xd094('0x9'),attributes,{'tableName':_0xd094('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13367d,_0x328233,_0x47548b){if(_0x13367d['changed'](_0xd094('0xb'))){_0x13367d['closedAt']=moment()['format'](_0xd094('0xc'));}_0x47548b(null,_0x13367d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index fdcd9e1..04121da 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 _0x28ac=['UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','info','debug','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x52ec2f,_0x3d359a){var _0x37c45c=function(_0x3d27d1){while(--_0x3d27d1){_0x52ec2f['push'](_0x52ec2f['shift']());}};_0x37c45c(++_0x3d359a);}(_0x28ac,0x1cb));var _0xc28a=function(_0xf0fab,_0x3aaf48){_0xf0fab=_0xf0fab-0x0;var _0x9f8fb7=_0x28ac[_0xf0fab];return _0x9f8fb7;};'use strict';var _=require(_0xc28a('0x0'));var util=require(_0xc28a('0x1'));var moment=require(_0xc28a('0x2'));var BPromise=require(_0xc28a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc28a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc28a('0x5'))(_0xc28a('0x6'));var config=require(_0xc28a('0x7'));var jayson=require(_0xc28a('0x8'));var client=jayson['client'][_0xc28a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc28a('0xa'),'port':0x18eb});var socket=require(_0xc28a('0xb'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xc28a('0xc')](socket);function respondWithRpcPromise(_0x382139,_0xfda113,_0x2d04da){return new BPromise(function(_0x341b7b,_0x1353bb){return client[_0xc28a('0xd')](_0x382139,_0x2d04da)[_0xc28a('0xe')](function(_0x2becce){logger['info'](_0xc28a('0xf'),_0xfda113,_0xc28a('0x10'));logger['debug'](_0xc28a('0x11'),_0xfda113,'request\x20sent',JSON[_0xc28a('0x12')](_0x2becce));if(_0x2becce['error']){if(_0x2becce[_0xc28a('0x13')]['code']===0x1f4){logger[_0xc28a('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xfda113,_0x2becce[_0xc28a('0x13')][_0xc28a('0x14')]);return _0x1353bb(_0x2becce['error'][_0xc28a('0x14')]);}logger[_0xc28a('0x13')](_0xc28a('0xf'),_0xfda113,_0x2becce[_0xc28a('0x13')][_0xc28a('0x14')]);return _0x341b7b(_0x2becce[_0xc28a('0x13')][_0xc28a('0x14')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0xfda113,_0xc28a('0x10'));_0x341b7b(_0x2becce['result']['message']);}})[_0xc28a('0x15')](function(_0x32bc5e){logger[_0xc28a('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xfda113,_0x32bc5e);_0x1353bb(_0x32bc5e);});});}exports[_0xc28a('0x16')]=function(_0x93f738){var _0x4ed18a=this;return new Promise(function(_0x500a1f,_0x194c04){return db[_0xc28a('0x17')][_0xc28a('0x18')](_0x93f738[_0xc28a('0x19')],{'raw':_0x93f738[_0xc28a('0x1a')]?_0x93f738[_0xc28a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x93f738[_0xc28a('0x1a')]?_0x93f738[_0xc28a('0x1a')][_0xc28a('0x1b')]||null:null,'attributes':_0x93f738['options']?_0x93f738[_0xc28a('0x1a')][_0xc28a('0x1c')]||null:null,'limit':_0x93f738[_0xc28a('0x1a')]?_0x93f738[_0xc28a('0x1a')][_0xc28a('0x1d')]||null:null})[_0xc28a('0xe')](function(_0x2a6459){logger['info'](_0xc28a('0x16'),_0x93f738);logger['debug'](_0xc28a('0x16'),_0x93f738,JSON['stringify'](_0x2a6459));_0x500a1f(_0x2a6459);})['catch'](function(_0x38ab01){logger['error'](_0xc28a('0x16'),_0x38ab01['message'],_0x93f738);_0x194c04(_0x4ed18a[_0xc28a('0x13')](0x1f4,_0x38ab01[_0xc28a('0x14')]));});});};exports[_0xc28a('0x1e')]=function(_0x34f66d){return new Promise(function(_0x1ad3eb,_0x515a96){return db['SmsInteraction'][_0xc28a('0x1f')]({'where':_0x34f66d[_0xc28a('0x1a')]?_0x34f66d[_0xc28a('0x1a')]['where']||null:null})[_0xc28a('0xe')](function(_0x99be90){if(_0x99be90){return _0x99be90[_0xc28a('0x20')](_0x34f66d[_0xc28a('0x19')][_0xc28a('0x21')],_[_0xc28a('0x22')](_0x34f66d[_0xc28a('0x19')],['ids','id'])||{});}})['spread'](function(_0x1dba5e){logger[_0xc28a('0x23')]('AddTags',_0x34f66d);logger[_0xc28a('0x24')]('AddTags',_0x34f66d,JSON[_0xc28a('0x12')](_0x1dba5e));_0x1ad3eb(_0x1dba5e);})[_0xc28a('0x15')](function(_0x33d9cf){logger['error']('AddTags',_0x33d9cf[_0xc28a('0x14')],_0x34f66d);_0x515a96(_this['error'](0x1f4,_0x33d9cf['message']));});});}; \ No newline at end of file +var _0x7297=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsInteraction','update','body','raw','options','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','./smsInteraction.socket','register','request','then'];(function(_0x546215,_0x3ad7d6){var _0x24017c=function(_0x1d76d0){while(--_0x1d76d0){_0x546215['push'](_0x546215['shift']());}};_0x24017c(++_0x3ad7d6);}(_0x7297,0x1b3));var _0x7729=function(_0x57d2bf,_0x3858a7){_0x57d2bf=_0x57d2bf-0x0;var _0x56140d=_0x7297[_0x57d2bf];return _0x56140d;};'use strict';var _=require('lodash');var util=require(_0x7729('0x0'));var moment=require(_0x7729('0x1'));var BPromise=require(_0x7729('0x2'));var rs=require(_0x7729('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7729('0x4'))['db'];var utils=require(_0x7729('0x5'));var logger=require(_0x7729('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7729('0x7'));var client=jayson[_0x7729('0x8')]['http']({'port':0x232a});config[_0x7729('0x9')]=_[_0x7729('0xa')](config[_0x7729('0x9')],{'host':_0x7729('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7729('0xc'))[_0x7729('0xd')](socket);function respondWithRpcPromise(_0x431e32,_0x24c2c2,_0x413b5c){return new BPromise(function(_0x1bdf8c,_0x15d97b){return client[_0x7729('0xe')](_0x431e32,_0x413b5c)[_0x7729('0xf')](function(_0xb7f228){logger[_0x7729('0x10')](_0x7729('0x11'),_0x24c2c2,_0x7729('0x12'));logger[_0x7729('0x13')](_0x7729('0x14'),_0x24c2c2,_0x7729('0x12'),JSON[_0x7729('0x15')](_0xb7f228));if(_0xb7f228['error']){if(_0xb7f228[_0x7729('0x16')][_0x7729('0x17')]===0x1f4){logger[_0x7729('0x16')](_0x7729('0x11'),_0x24c2c2,_0xb7f228[_0x7729('0x16')][_0x7729('0x18')]);return _0x15d97b(_0xb7f228[_0x7729('0x16')][_0x7729('0x18')]);}logger[_0x7729('0x16')](_0x7729('0x11'),_0x24c2c2,_0xb7f228[_0x7729('0x16')][_0x7729('0x18')]);return _0x1bdf8c(_0xb7f228[_0x7729('0x16')][_0x7729('0x18')]);}else{logger[_0x7729('0x10')](_0x7729('0x11'),_0x24c2c2,_0x7729('0x12'));_0x1bdf8c(_0xb7f228['result'][_0x7729('0x18')]);}})[_0x7729('0x19')](function(_0x42ed31){logger[_0x7729('0x16')](_0x7729('0x11'),_0x24c2c2,_0x42ed31);_0x15d97b(_0x42ed31);});});}exports['UpdateSmsInteraction']=function(_0x4c59f7){var _0x256d82=this;return new Promise(function(_0x117a65,_0x10cf59){return db[_0x7729('0x1a')][_0x7729('0x1b')](_0x4c59f7[_0x7729('0x1c')],{'raw':_0x4c59f7['options']?_0x4c59f7['options'][_0x7729('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c59f7[_0x7729('0x1e')]?_0x4c59f7[_0x7729('0x1e')][_0x7729('0x1f')]||null:null,'attributes':_0x4c59f7['options']?_0x4c59f7[_0x7729('0x1e')][_0x7729('0x20')]||null:null,'limit':_0x4c59f7[_0x7729('0x1e')]?_0x4c59f7['options'][_0x7729('0x21')]||null:null})[_0x7729('0xf')](function(_0x2712cc){logger['info'](_0x7729('0x22'),_0x4c59f7);logger[_0x7729('0x13')](_0x7729('0x22'),_0x4c59f7,JSON[_0x7729('0x15')](_0x2712cc));_0x117a65(_0x2712cc);})[_0x7729('0x19')](function(_0x150116){logger[_0x7729('0x16')](_0x7729('0x22'),_0x150116[_0x7729('0x18')],_0x4c59f7);_0x10cf59(_0x256d82[_0x7729('0x16')](0x1f4,_0x150116['message']));});});};exports[_0x7729('0x23')]=function(_0x2331ca){return new Promise(function(_0x2f7e17,_0x504c50){return db['SmsInteraction'][_0x7729('0x24')]({'where':_0x2331ca['options']?_0x2331ca['options'][_0x7729('0x1f')]||null:null})['then'](function(_0x11d00a){if(_0x11d00a){return _0x11d00a[_0x7729('0x25')](_0x2331ca[_0x7729('0x1c')]['ids'],_[_0x7729('0x26')](_0x2331ca[_0x7729('0x1c')],['ids','id'])||{});}})[_0x7729('0x27')](function(_0x436813){logger[_0x7729('0x10')](_0x7729('0x28'),_0x2331ca);logger[_0x7729('0x13')]('AddTags',_0x2331ca,JSON[_0x7729('0x15')](_0x436813));_0x2f7e17(_0x436813);})[_0x7729('0x19')](function(_0x53f741){logger[_0x7729('0x16')]('AddTags',_0x53f741[_0x7729('0x18')],_0x2331ca);_0x504c50(_this['error'](0x1f4,_0x53f741[_0x7729('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1399c37..33d326d 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 _0x1ef4=['removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x3151eb,_0x40245a){var _0x3af72f=function(_0x2f3ba1){while(--_0x2f3ba1){_0x3151eb['push'](_0x3151eb['shift']());}};_0x3af72f(++_0x40245a);}(_0x1ef4,0x15c));var _0x41ef=function(_0x2f5f47,_0x308fa8){_0x2f5f47=_0x2f5f47-0x0;var _0xc3864f=_0x1ef4[_0x2f5f47];return _0xc3864f;};'use strict';var SmsInteractionEvents=require(_0x41ef('0x0'));var events=['save',_0x41ef('0x1'),_0x41ef('0x2')];function createListener(_0x5f19c7,_0x132353){return function(_0x21e22f){_0x132353[_0x41ef('0x3')](_0x5f19c7,_0x21e22f);};}function removeListener(_0x5656da,_0x7a7663){return function(){SmsInteractionEvents[_0x41ef('0x4')](_0x5656da,_0x7a7663);};}exports[_0x41ef('0x5')]=function(_0x52238d){for(var _0x3adc5f=0x0,_0x32f7b7=events[_0x41ef('0x6')];_0x3adc5f<_0x32f7b7;_0x3adc5f++){var _0x40d379=events[_0x3adc5f];var _0x47ce50=createListener(_0x41ef('0x7')+_0x40d379,_0x52238d);SmsInteractionEvents['on'](_0x40d379,_0x47ce50);}}; \ No newline at end of file +var _0x52f1=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x137f8f,_0x412ec2){var _0x35056e=function(_0xe9ebce){while(--_0xe9ebce){_0x137f8f['push'](_0x137f8f['shift']());}};_0x35056e(++_0x412ec2);}(_0x52f1,0x171));var _0x152f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x52f1[_0x1facfa];return _0x9ec701;};'use strict';var SmsInteractionEvents=require(_0x152f('0x0'));var events=[_0x152f('0x1'),_0x152f('0x2'),_0x152f('0x3')];function createListener(_0x476215,_0x43f39d){return function(_0xa89069){_0x43f39d[_0x152f('0x4')](_0x476215,_0xa89069);};}function removeListener(_0x7e1030,_0x14c71c){return function(){SmsInteractionEvents[_0x152f('0x5')](_0x7e1030,_0x14c71c);};}exports[_0x152f('0x6')]=function(_0xcc7e0c){for(var _0x1edca2=0x0,_0x33be04=events[_0x152f('0x7')];_0x1edca2<_0x33be04;_0x1edca2++){var _0x15d9c2=events[_0x1edca2];var _0x5e3846=createListener(_0x152f('0x8')+_0x15d9c2,_0xcc7e0c);SmsInteractionEvents['on'](_0x15d9c2,_0x5e3846);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4bae5f8..d8ee821 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 _0x26a3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','sms','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1392f5,_0x2dacd1){var _0x2da093=function(_0x3fead9){while(--_0x3fead9){_0x1392f5['push'](_0x1392f5['shift']());}};_0x2da093(++_0x2dacd1);}(_0x26a3,0x94));var _0x326a=function(_0x241402,_0x4009fc){_0x241402=_0x241402-0x0;var _0x4ef3ee=_0x26a3[_0x241402];return _0x4ef3ee;};'use strict';var multer=require(_0x326a('0x0'));var util=require(_0x326a('0x1'));var path=require(_0x326a('0x2'));var timeout=require(_0x326a('0x3'));var express=require(_0x326a('0x4'));var router=express[_0x326a('0x5')]();var fs_extra=require(_0x326a('0x6'));var auth=require(_0x326a('0x7'));var interaction=require(_0x326a('0x8'));var config=require(_0x326a('0x9'));var controller=require(_0x326a('0xa'));router['get']('/',auth[_0x326a('0xb')](),controller[_0x326a('0xc')]);router[_0x326a('0xd')]('/describe',auth[_0x326a('0xb')](),controller[_0x326a('0xe')]);router[_0x326a('0xd')](_0x326a('0xf'),auth[_0x326a('0xb')](),controller[_0x326a('0x10')]);router[_0x326a('0x11')]('/',auth['isAuthenticated'](),interaction[_0x326a('0x12')](_0x326a('0x13'),'smsmessage:create'),controller[_0x326a('0x14')]);router[_0x326a('0x11')]('/:id/status',controller[_0x326a('0x15')]);router[_0x326a('0x16')]('/:id',auth[_0x326a('0xb')](),controller[_0x326a('0x17')]);router[_0x326a('0x16')](_0x326a('0x18'),auth[_0x326a('0xb')](),controller[_0x326a('0x19')]);router[_0x326a('0x16')](_0x326a('0x1a'),auth[_0x326a('0xb')](),controller[_0x326a('0x1b')]);router[_0x326a('0x1c')](_0x326a('0xf'),auth[_0x326a('0xb')](),controller[_0x326a('0x1d')]);module[_0x326a('0x1e')]=router; \ No newline at end of file +var _0xc306=['/:id','post','sms','/:id/status','status','put','accept','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x106f67,_0x242d0d){var _0xc1d2af=function(_0x4773bd){while(--_0x4773bd){_0x106f67['push'](_0x106f67['shift']());}};_0xc1d2af(++_0x242d0d);}(_0xc306,0x1a9));var _0x6c30=function(_0x1ccde7,_0x5825e0){_0x1ccde7=_0x1ccde7-0x0;var _0x5a5428=_0xc306[_0x1ccde7];return _0x5a5428;};'use strict';var multer=require(_0x6c30('0x0'));var util=require('util');var path=require(_0x6c30('0x1'));var timeout=require(_0x6c30('0x2'));var express=require(_0x6c30('0x3'));var router=express[_0x6c30('0x4')]();var fs_extra=require(_0x6c30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c30('0x6'));var config=require('../../config/environment');var controller=require(_0x6c30('0x7'));router[_0x6c30('0x8')]('/',auth[_0x6c30('0x9')](),controller[_0x6c30('0xa')]);router[_0x6c30('0x8')](_0x6c30('0xb'),auth[_0x6c30('0x9')](),controller['describe']);router[_0x6c30('0x8')](_0x6c30('0xc'),auth[_0x6c30('0x9')](),controller['show']);router[_0x6c30('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x6c30('0xe'),'smsmessage:create'),controller['create']);router['post'](_0x6c30('0xf'),controller[_0x6c30('0x10')]);router[_0x6c30('0x11')]('/:id',auth[_0x6c30('0x9')](),controller['update']);router[_0x6c30('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x6c30('0x12')]);router[_0x6c30('0x11')]('/:id/reject',auth[_0x6c30('0x9')](),controller[_0x6c30('0x13')]);router[_0x6c30('0x14')](_0x6c30('0xc'),auth['isAuthenticated'](),controller[_0x6c30('0x15')]);module[_0x6c30('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 929b368..3b244b1 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 _0xb7a7=['TEXT','medium','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x29ab19,_0x3a77c1){var _0x5cebdd=function(_0x2d6ef7){while(--_0x2d6ef7){_0x29ab19['push'](_0x29ab19['shift']());}};_0x5cebdd(++_0x3a77c1);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x1d2e59,_0x10d700){_0x1d2e59=_0x1d2e59-0x0;var _0x2e0ab8=_0xb7a7[_0x1d2e59];return _0x2e0ab8;};'use strict';var Sequelize=require(_0x7b7a('0x0'));module[_0x7b7a('0x1')]={'body':{'type':Sequelize[_0x7b7a('0x2')](_0x7b7a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7b7a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7b7a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7b7a('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7b7a('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x7b7a('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7b7a('0x6')]},'providerResponse':{'type':Sequelize[_0x7b7a('0x2')]}}; \ No newline at end of file +var _0xe899=['STRING','DATE','TEXT','BOOLEAN'];(function(_0x4f9f2b,_0x3fe474){var _0xbb0e25=function(_0x5dd17a){while(--_0x5dd17a){_0x4f9f2b['push'](_0x4f9f2b['shift']());}};_0xbb0e25(++_0x3fe474);}(_0xe899,0x196));var _0x9e89=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xe899[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x9e89('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9e89('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9e89('0x2')](0xbe)},'phone':{'type':Sequelize[_0x9e89('0x2')]},'readAt':{'type':Sequelize[_0x9e89('0x3')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9e89('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a3f6eac..75e2408 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 _0x6515=['interface','SIP/%s','channel','motionChannel','event','accept','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','contact','EventManager','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','show','includeAll','options','find','create','body','params','describe','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','fullname','email','internal','manual'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0x6515,0x1e5));var _0x5651=function(_0x1414aa,_0x3b6c8c){_0x1414aa=_0x1414aa-0x0;var _0x21ccf5=_0x6515[_0x1414aa];return _0x21ccf5;};'use strict';var emlformat=require(_0x5651('0x0'));var rimraf=require(_0x5651('0x1'));var zipdir=require(_0x5651('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5651('0x3'));var moment=require(_0x5651('0x4'));var BPromise=require(_0x5651('0x5'));var Mustache=require(_0x5651('0x6'));var util=require(_0x5651('0x7'));var path=require(_0x5651('0x8'));var sox=require(_0x5651('0x9'));var csv=require(_0x5651('0xa'));var ejs=require(_0x5651('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5651('0xc'));var squel=require(_0x5651('0xd'));var crypto=require(_0x5651('0xe'));var jsforce=require(_0x5651('0xf'));var deskjs=require(_0x5651('0x10'));var toCsv=require(_0x5651('0xa'));var querystring=require(_0x5651('0x11'));var Papa=require(_0x5651('0x12'));var Redis=require(_0x5651('0x13'));var authService=require(_0x5651('0x14'));var qs=require(_0x5651('0x15'));var as=require(_0x5651('0x16'));var hardwareService=require(_0x5651('0x17'));var logger=require(_0x5651('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x5651('0x19'));var licenseUtil=require(_0x5651('0x1a'));var db=require(_0x5651('0x1b'))['db'];config[_0x5651('0x1c')]=_['defaults'](config['redis'],{'host':_0x5651('0x1d'),'port':0x18eb});var socket=require(_0x5651('0x1e'))(new Redis(config[_0x5651('0x1c')]));require(_0x5651('0x1f'))[_0x5651('0x20')](socket);var jayson=require(_0x5651('0x21'));var client=jayson[_0x5651('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x5651('0x22')][_0x5651('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1a4325,_0x6dcfd4,_0x1c0d02,_0xef5da7){return new BPromise(function(_0x5dc0c3,_0x27c8e1){var _0x462612=_0xef5da7||client;return _0x462612[_0x5651('0x24')](_0x1a4325,_0x1c0d02)['then'](function(_0x1d41f4){logger['info']('SmsMessage,\x20%s,\x20%s',_0x6dcfd4,'request\x20sent');logger['debug'](_0x5651('0x25'),_0x6dcfd4,_0x5651('0x26'),JSON[_0x5651('0x27')](_0x1d41f4));if(_0x1d41f4[_0x5651('0x28')]){if(_0x1d41f4[_0x5651('0x28')][_0x5651('0x29')]===0x1f4){logger[_0x5651('0x28')](_0x5651('0x2a'),_0x6dcfd4,_0x1d41f4[_0x5651('0x28')][_0x5651('0x2b')]);return _0x27c8e1(_0x1d41f4[_0x5651('0x28')]['message']);}logger[_0x5651('0x28')](_0x5651('0x2a'),_0x6dcfd4,_0x1d41f4[_0x5651('0x28')][_0x5651('0x2b')]);return _0x5dc0c3(_0x1d41f4[_0x5651('0x28')][_0x5651('0x2b')]);}else{logger[_0x5651('0x2c')](_0x5651('0x2a'),_0x6dcfd4,_0x5651('0x26'));_0x5dc0c3(_0x1d41f4[_0x5651('0x2d')]['message']);}})[_0x5651('0x2e')](function(_0x58c4f3){logger[_0x5651('0x28')]('SmsMessage,\x20%s,\x20%s',_0x6dcfd4,_0x58c4f3);_0x27c8e1(_0x58c4f3);});});}function respondWithStatusCode(_0x9a47e6,_0x5120d1){_0x5120d1=_0x5120d1||0xcc;return function(_0x59541f){if(_0x59541f){return _0x9a47e6['sendStatus'](_0x5120d1);}return _0x9a47e6['status'](_0x5120d1)[_0x5651('0x2f')]();};}function respondWithResult(_0x28fe83,_0x59b169){_0x59b169=_0x59b169||0xc8;return function(_0x476c63){if(_0x476c63){return _0x28fe83[_0x5651('0x30')](_0x59b169)[_0x5651('0x31')](_0x476c63);}};}function respondWithFilteredResult(_0x5b7583,_0xc05b38){return function(_0x3f8de4){if(_0x3f8de4){var _0xfac646=typeof _0xc05b38[_0x5651('0x32')]===_0x5651('0x33')&&typeof _0xc05b38[_0x5651('0x34')]===_0x5651('0x33');var _0x15d105=_0x3f8de4['count'];var _0x1b30fe=_0xfac646?0x0:_0xc05b38[_0x5651('0x32')];var _0x473140=_0xfac646?_0x3f8de4[_0x5651('0x35')]:_0xc05b38[_0x5651('0x32')]+_0xc05b38[_0x5651('0x34')];var _0x567538;if(_0x473140>=_0x15d105){_0x473140=_0x15d105;_0x567538=0xc8;}else{_0x567538=0xce;}_0x5b7583['status'](_0x567538);return _0x5b7583['set'](_0x5651('0x36'),_0x1b30fe+'-'+_0x473140+'/'+_0x15d105)[_0x5651('0x31')](_0x3f8de4);}return null;};}function patchUpdates(_0x4fddcb){return function(_0x3c2ef6){try{jsonpatch[_0x5651('0x37')](_0x3c2ef6,_0x4fddcb,!![]);}catch(_0x1f0da8){return BPromise['reject'](_0x1f0da8);}return _0x3c2ef6[_0x5651('0x38')]();};}function saveUpdates(_0xab749b,_0x12accb){return function(_0x310b1e){if(_0x310b1e){return _0x310b1e[_0x5651('0x39')](_0xab749b)[_0x5651('0x3a')](function(_0x10f308){return _0x10f308;});}return null;};}function removeEntity(_0x5816fb,_0x45419c){return function(_0x30cc0a){if(_0x30cc0a){return _0x30cc0a[_0x5651('0x3b')]()[_0x5651('0x3a')](function(){_0x5816fb[_0x5651('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b550,_0x35a42f){return function(_0x47b67b){if(!_0x47b67b){_0x26b550['sendStatus'](0x194);}return _0x47b67b;};}function handleError(_0x59cc72,_0x3bc1ef){_0x3bc1ef=_0x3bc1ef||0x1f4;return function(_0x5cab0c){logger[_0x5651('0x28')](_0x5cab0c[_0x5651('0x3c')]);if(_0x5cab0c[_0x5651('0x3d')]){delete _0x5cab0c[_0x5651('0x3d')];}_0x59cc72[_0x5651('0x30')](_0x3bc1ef)[_0x5651('0x3e')](_0x5cab0c);};}exports[_0x5651('0x3f')]=function(_0x268912,_0x56fcd0){var _0x45b5ad={},_0x164105={},_0x1273af={'count':0x0,'rows':[]};var _0x3ebb0a=_[_0x5651('0x40')](db[_0x5651('0x41')][_0x5651('0x42')],function(_0x45aafb){return{'name':_0x45aafb[_0x5651('0x43')],'type':_0x45aafb[_0x5651('0x44')][_0x5651('0x45')]};});_0x164105['model']=_[_0x5651('0x40')](_0x3ebb0a,'name');_0x164105[_0x5651('0x46')]=_[_0x5651('0x47')](_0x268912[_0x5651('0x46')]);_0x164105[_0x5651('0x48')]=_[_0x5651('0x49')](_0x164105[_0x5651('0x4a')],_0x164105['query']);_0x45b5ad[_0x5651('0x4b')]=_[_0x5651('0x49')](_0x164105[_0x5651('0x4a')],qs[_0x5651('0x4c')](_0x268912[_0x5651('0x46')]['fields']));_0x45b5ad[_0x5651('0x4b')]=_0x45b5ad[_0x5651('0x4b')][_0x5651('0x4d')]?_0x45b5ad[_0x5651('0x4b')]:_0x164105['model'];if(!_0x268912[_0x5651('0x46')][_0x5651('0x4e')](_0x5651('0x4f'))){_0x45b5ad['limit']=qs[_0x5651('0x34')](_0x268912['query'][_0x5651('0x34')]);_0x45b5ad[_0x5651('0x32')]=qs['offset'](_0x268912['query'][_0x5651('0x32')]);}_0x45b5ad['order']=qs[_0x5651('0x50')](_0x268912['query'][_0x5651('0x50')]);_0x45b5ad[_0x5651('0x51')]=qs[_0x5651('0x48')](_['pick'](_0x268912[_0x5651('0x46')],_0x164105[_0x5651('0x48')]),_0x3ebb0a);if(_0x268912['query'][_0x5651('0x52')]){_0x45b5ad['where']=_[_0x5651('0x53')](_0x45b5ad[_0x5651('0x51')],{'$or':_[_0x5651('0x40')](_0x3ebb0a,function(_0x53ecd7){if(_0x53ecd7[_0x5651('0x44')]!==_0x5651('0x54')){var _0x2326ca={};_0x2326ca[_0x53ecd7[_0x5651('0x3d')]]={'$like':'%'+_0x268912[_0x5651('0x46')]['filter']+'%'};return _0x2326ca;}})});}_0x45b5ad=_[_0x5651('0x53')]({},_0x45b5ad,_0x268912['options']);var _0x46a0df={'where':_0x45b5ad[_0x5651('0x51')]};return db[_0x5651('0x41')][_0x5651('0x35')](_0x46a0df)[_0x5651('0x3a')](function(_0xfb2c07){_0x1273af[_0x5651('0x35')]=_0xfb2c07;if(_0x268912['query']['includeAll']){_0x45b5ad[_0x5651('0x55')]=[{'all':!![]}];}return db['SmsMessage'][_0x5651('0x56')](_0x45b5ad);})['then'](function(_0x2f5576){_0x1273af['rows']=_0x2f5576;return _0x1273af;})[_0x5651('0x3a')](respondWithFilteredResult(_0x56fcd0,_0x45b5ad))['catch'](handleError(_0x56fcd0,null));};exports[_0x5651('0x57')]=function(_0x434d9c,_0x29e6a0){var _0x50e59d={'raw':!![],'where':{'id':_0x434d9c['params']['id']}},_0x179184={};_0x179184['model']=_[_0x5651('0x47')](db[_0x5651('0x41')][_0x5651('0x42')]);_0x179184['query']=_[_0x5651('0x47')](_0x434d9c['query']);_0x179184[_0x5651('0x48')]=_[_0x5651('0x49')](_0x179184[_0x5651('0x4a')],_0x179184[_0x5651('0x46')]);_0x50e59d['attributes']=_[_0x5651('0x49')](_0x179184[_0x5651('0x4a')],qs['fields'](_0x434d9c[_0x5651('0x46')][_0x5651('0x4c')]));_0x50e59d[_0x5651('0x4b')]=_0x50e59d[_0x5651('0x4b')]['length']?_0x50e59d['attributes']:_0x179184[_0x5651('0x4a')];if(_0x434d9c['query'][_0x5651('0x58')]){_0x50e59d[_0x5651('0x55')]=[{'all':!![]}];}_0x50e59d=_[_0x5651('0x53')]({},_0x50e59d,_0x434d9c[_0x5651('0x59')]);return db['SmsMessage'][_0x5651('0x5a')](_0x50e59d)[_0x5651('0x3a')](handleEntityNotFound(_0x29e6a0,null))[_0x5651('0x3a')](respondWithResult(_0x29e6a0,null))[_0x5651('0x2e')](handleError(_0x29e6a0,null));};exports[_0x5651('0x5b')]=function(_0x44173b,_0x52131e){return db[_0x5651('0x41')][_0x5651('0x5b')](_0x44173b[_0x5651('0x5c')],{})[_0x5651('0x3a')](respondWithResult(_0x52131e,0xc9))[_0x5651('0x2e')](handleError(_0x52131e,null));};exports[_0x5651('0x39')]=function(_0x50a9ca,_0x46f34c){if(_0x50a9ca['body']['id']){delete _0x50a9ca['body']['id'];}return db[_0x5651('0x41')][_0x5651('0x5a')]({'where':{'id':_0x50a9ca['params']['id']}})[_0x5651('0x3a')](handleEntityNotFound(_0x46f34c,null))[_0x5651('0x3a')](saveUpdates(_0x50a9ca['body'],null))[_0x5651('0x3a')](respondWithResult(_0x46f34c,null))[_0x5651('0x2e')](handleError(_0x46f34c,null));};exports[_0x5651('0x3b')]=function(_0x2c3a45,_0x39db97){return db[_0x5651('0x41')]['find']({'where':{'id':_0x2c3a45[_0x5651('0x5d')]['id']}})['then'](handleEntityNotFound(_0x39db97,null))['then'](removeEntity(_0x39db97,null))['catch'](handleError(_0x39db97,null));};exports[_0x5651('0x5e')]=function(_0x4a42ec,_0x1cf033){return db[_0x5651('0x41')][_0x5651('0x5e')]()['then'](respondWithResult(_0x1cf033,null))[_0x5651('0x2e')](handleError(_0x1cf033,null));};var interaction_log=require('../../config/logger')(_0x5651('0x5f'));exports['accept']=function(_0x1a57a5,_0x4a3c70,_0x200c59){var _0x9c0987={'agent':{},'channel':_0x5651('0x60')};if(_0x1a57a5['body']['id']){delete _0x1a57a5[_0x5651('0x5c')]['id'];}_0x1a57a5['body'][_0x5651('0x61')]=!![];_0x1a57a5['body'][_0x5651('0x62')]=moment()[_0x5651('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a57a5['body'][_0x5651('0x64')]=_0x1a57a5[_0x5651('0x5c')]['UserId']||_0x1a57a5[_0x5651('0x65')]['id'];_0x9c0987[_0x5651('0x66')]['id']=_0x1a57a5['body']['UserId'];return db[_0x5651('0x41')][_0x5651('0x5a')]({'where':{'id':_0x1a57a5[_0x5651('0x5d')]['id'],'UserId':null}})[_0x5651('0x3a')](handleEntityNotFound(_0x4a3c70,null))[_0x5651('0x3a')](saveUpdates(_0x1a57a5['body'],null))['then'](function(_0x46d7f1){if(_0x46d7f1){_0x9c0987[_0x5651('0x2b')]=_0x46d7f1[_0x5651('0x67')]({'plain':!![]});return db[_0x5651('0x68')][_0x5651('0x5a')]({'where':{'id':_0x46d7f1['SmsInteractionId']}});}return null;})[_0x5651('0x3a')](handleEntityNotFound(_0x4a3c70,null))['then'](function(_0x571eaa){if(_0x571eaa){return _0x571eaa[_0x5651('0x39')]({'UserId':_0x1a57a5[_0x5651('0x5c')][_0x5651('0x64')],'read1stAt':_[_0x5651('0x69')](_0x571eaa['read1stAt'])?moment()[_0x5651('0x63')](_0x5651('0x6a')):undefined});}return null;})['then'](function(_0xc0c563){if(_0xc0c563){_0x9c0987[_0x5651('0x6b')]=_0xc0c563[_0x5651('0x67')]({'plain':!![]});interaction_log[_0x5651('0x2c')](_0x5651('0x6c'),_0x1a57a5[_0x5651('0x65')]['id'],_0x1a57a5[_0x5651('0x65')]['name'],_0x1a57a5[_0x5651('0x65')][_0x5651('0x6d')],_0x9c0987[_0x5651('0x6b')]['id'],_0x1a57a5[_0x5651('0x5c')]?JSON['stringify'](_0x1a57a5[_0x5651('0x5c')]):'null');return respondWithRpcPromise(_0x5651('0x6e'),'acceptMessage',_0x9c0987);}return null;})[_0x5651('0x3a')](function(_0x23f00b){var _0x294d5d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x23f00b[_0x5651('0x2b')][_0x5651('0x6f')];return db[_0x5651('0x70')][_0x5651('0x46')](_0x294d5d,{'type':db['Sequelize'][_0x5651('0x71')][_0x5651('0x72')],'raw':!![]})['then'](function(_0x1d6bc2){return _0x1d6bc2;});})[_0x5651('0x3a')](function(_0xa4ceef){if(_0xa4ceef){_0x9c0987[_0x5651('0x2b')]['contact']=_0xa4ceef[0x0];if(!_0x1a57a5['body'][_0x5651('0x64')])return;return db['User'][_0x5651('0x5a')]({'where':{'id':_0x1a57a5['body'][_0x5651('0x64')],'role':_0x5651('0x66')},'attributes':['id','name',_0x5651('0x73'),_0x5651('0x74'),_0x5651('0x75')],'raw':!![]});}return null;})['then'](function(_0x2b6a0f){if(!_0x2b6a0f)return null;_0x9c0987[_0x5651('0x2b')]['agent']=_0x2b6a0f;return _0x9c0987;})['then'](function(_0x4b3ca){if(_0x4b3ca){if(_0x1a57a5[_0x5651('0x5c')][_0x5651('0x76')]){_0x9c0987[_0x5651('0x2b')][_0x5651('0x77')]=util[_0x5651('0x63')](_0x5651('0x78'),_0x1a57a5[_0x5651('0x65')]['name']);_0x9c0987[_0x5651('0x2b')][_0x5651('0x79')]=_0x9c0987[_0x5651('0x79')];_0x9c0987[_0x5651('0x2b')][_0x5651('0x7a')]=_0x9c0987[_0x5651('0x79')];_0x9c0987[_0x5651('0x2b')][_0x5651('0x7b')]=_0x5651('0x7c');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x9c0987[_0x5651('0x2b')]},client9002)['then'](function(){return _0x9c0987;});}return _0x9c0987;}return null;})[_0x5651('0x3a')](respondWithResult(_0x4a3c70,null))[_0x5651('0x2e')](handleError(_0x4a3c70,null));};var interaction_log=require(_0x5651('0x18'))(_0x5651('0x5f'));exports[_0x5651('0x7d')]=function(_0x398ece,_0x35c542,_0x57fd0b){var _0x8b9e0a={'agent':{},'channel':'sms'};if(_0x398ece[_0x5651('0x5c')]['id']){delete _0x398ece[_0x5651('0x5c')]['id'];}_0x398ece[_0x5651('0x5c')][_0x5651('0x64')]=_0x398ece['body'][_0x5651('0x64')]||_0x398ece[_0x5651('0x65')]['id'];_0x8b9e0a[_0x5651('0x66')]['id']=_0x398ece['body']['UserId'];return db[_0x5651('0x41')][_0x5651('0x5a')]({'where':{'id':_0x398ece[_0x5651('0x5d')]['id'],'UserId':null}})[_0x5651('0x3a')](handleEntityNotFound(_0x35c542,null))[_0x5651('0x3a')](function(_0x2f4f0c){if(_0x2f4f0c){_0x8b9e0a['message']=_0x2f4f0c[_0x5651('0x67')]({'plain':!![]});return db[_0x5651('0x68')]['find']({'where':{'id':_0x2f4f0c['SmsInteractionId']}});}return null;})[_0x5651('0x3a')](handleEntityNotFound(_0x35c542,null))[_0x5651('0x3a')](function(_0x14767d){if(_0x14767d){_0x8b9e0a[_0x5651('0x6b')]=_0x14767d[_0x5651('0x67')]({'plain':!![]});interaction_log['info'](_0x5651('0x7e'),_0x398ece[_0x5651('0x65')]['id'],_0x398ece[_0x5651('0x65')][_0x5651('0x3d')],_0x398ece[_0x5651('0x65')][_0x5651('0x6d')],_0x8b9e0a[_0x5651('0x6b')]['id'],_0x398ece['body']?JSON[_0x5651('0x27')](_0x398ece[_0x5651('0x5c')]):_0x5651('0x7f'));return respondWithRpcPromise(_0x5651('0x80'),_0x5651('0x81'),_0x8b9e0a);}return null;})[_0x5651('0x3a')](function(_0x389358){var _0x52f5f0=_0x5651('0x82')+_0x389358[_0x5651('0x2b')][_0x5651('0x6f')];return db[_0x5651('0x70')]['query'](_0x52f5f0,{'type':db[_0x5651('0x83')][_0x5651('0x71')][_0x5651('0x72')],'raw':!![]})[_0x5651('0x3a')](function(_0x207929){return _0x207929;});})[_0x5651('0x3a')](function(_0x421008){if(_0x421008){_0x8b9e0a['message'][_0x5651('0x84')]=_0x421008[0x0];if(!_0x398ece[_0x5651('0x5c')][_0x5651('0x64')])return;return db['User'][_0x5651('0x5a')]({'where':{'id':_0x398ece[_0x5651('0x5c')][_0x5651('0x64')],'role':_0x5651('0x66')},'attributes':['id',_0x5651('0x3d'),_0x5651('0x73'),_0x5651('0x74'),_0x5651('0x75')],'raw':!![]});}return null;})[_0x5651('0x3a')](function(_0x28b60f){if(!_0x28b60f)return null;_0x8b9e0a[_0x5651('0x2b')][_0x5651('0x66')]=_0x28b60f;return _0x8b9e0a;})[_0x5651('0x3a')](function(_0x2baea0){if(_0x2baea0){_0x2baea0[_0x5651('0x2b')][_0x5651('0x77')]=util[_0x5651('0x63')](_0x5651('0x78'),_0x398ece[_0x5651('0x65')]['name']);_0x2baea0[_0x5651('0x2b')][_0x5651('0x79')]=_0x8b9e0a[_0x5651('0x79')];_0x2baea0[_0x5651('0x2b')][_0x5651('0x7a')]=_0x8b9e0a[_0x5651('0x79')];_0x2baea0[_0x5651('0x2b')][_0x5651('0x7b')]='reject';respondWithRpcPromise(_0x5651('0x85'),_0x5651('0x85'),{'event':'rejectmessage','message':_0x2baea0['message']},client9002);return _0x8b9e0a;}return null;})[_0x5651('0x3a')](respondWithResult(_0x35c542,null))[_0x5651('0x2e')](handleError(_0x35c542,null));};exports['status']=function(_0x1c0128,_0x426cdc,_0x512d1c){if(_0x1c0128[_0x5651('0x5c')]['id']){delete _0x1c0128[_0x5651('0x5c')]['id'];}var _0x555fcb;return db[_0x5651('0x41')][_0x5651('0x5a')]({'where':{'id':_0x1c0128[_0x5651('0x5d')]['id']}})['then'](handleEntityNotFound(_0x426cdc,null))[_0x5651('0x3a')](function(_0x39c10b){if(_0x39c10b){_0x555fcb=_0x39c10b;return db[_0x5651('0x86')][_0x5651('0x5a')]({'where':{'id':_0x39c10b[_0x5651('0x87')]}});}})[_0x5651('0x3a')](handleEntityNotFound(_0x426cdc,null))[_0x5651('0x3a')](function(_0x106819){if(_0x106819){logger[_0x5651('0x88')](_0x5651('0x25'),_0x5651('0x30'),_0x5651('0x89'),_0x106819[_0x5651('0x44')],util[_0x5651('0x8a')](_0x1c0128[_0x5651('0x5c')],{'showHidden':![],'depth':null}));switch(_0x106819[_0x5651('0x44')]){case'twilio':if(_0x1c0128['body'][_0x5651('0x8b')]&&_0x1c0128['body']['MessageSid']===_0x555fcb[_0x5651('0x8c')]){return _0x555fcb['update']({'read':!![]});}else{logger[_0x5651('0x28')](_0x5651('0x8d'),_0x5651('0x30'),_0x5651('0x8e'),util[_0x5651('0x8a')](_0x1c0128[_0x5651('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x5651('0x8f'):if(_0x1c0128['body'][_0x5651('0x90')]&&_0x1c0128[_0x5651('0x5c')]['MessageUUID']===_0x555fcb[_0x5651('0x8c')]&&_[_0x5651('0x91')](['sent','delivered'],_0x1c0128['body'][_0x5651('0x92')])>=0x0){return _0x555fcb['update']({'read':!![]});}else{logger[_0x5651('0x28')](_0x5651('0x8d'),_0x5651('0x30'),_0x5651('0x93'),util[_0x5651('0x8a')](_0x1c0128[_0x5651('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x5651('0x94'):var _0x21f7fd=_0x1c0128[_0x5651('0x5c')][_0x5651('0x95')][0x0];if(_0x21f7fd[_0x5651('0x30')][_0x5651('0x96')]==='DELIVERED'){return _0x555fcb[_0x5651('0x39')]({'read':!![]});}else{logger['error'](_0x5651('0x8d'),_0x5651('0x30'),_0x5651('0x94'),util[_0x5651('0x8a')](_0x1c0128[_0x5651('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x555fcb;}})[_0x5651('0x3a')](respondWithResult(_0x426cdc,null))[_0x5651('0x2e')](handleError(_0x426cdc,null));}; \ No newline at end of file +var _0xce9e=['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','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','sendStatus','name','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','body','describe','sms-interactions','accept','sms','read','readAt','format','user','agent','UserId','find','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','contact','email','motionChannel','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x577991,_0x4af074){var _0x112e6b=function(_0x2e1e1e){while(--_0x2e1e1e){_0x577991['push'](_0x577991['shift']());}};_0x112e6b(++_0x4af074);}(_0xce9e,0x1c8));var _0xece9=function(_0x39e02f,_0x2f4a3c){_0x39e02f=_0x39e02f-0x0;var _0x9cf183=_0xce9e[_0x39e02f];return _0x9cf183;};'use strict';var emlformat=require(_0xece9('0x0'));var rimraf=require(_0xece9('0x1'));var zipdir=require(_0xece9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xece9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xece9('0x4'));var util=require('util');var path=require(_0xece9('0x5'));var sox=require(_0xece9('0x6'));var csv=require(_0xece9('0x7'));var ejs=require(_0xece9('0x8'));var fs=require('fs');var fs_extra=require(_0xece9('0x9'));var _=require(_0xece9('0xa'));var squel=require(_0xece9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xece9('0xc'));var toCsv=require(_0xece9('0x7'));var querystring=require(_0xece9('0xd'));var Papa=require(_0xece9('0xe'));var Redis=require(_0xece9('0xf'));var authService=require(_0xece9('0x10'));var qs=require(_0xece9('0x11'));var as=require(_0xece9('0x12'));var hardwareService=require(_0xece9('0x13'));var logger=require(_0xece9('0x14'))(_0xece9('0x15'));var utils=require(_0xece9('0x16'));var config=require(_0xece9('0x17'));var licenseUtil=require(_0xece9('0x18'));var db=require(_0xece9('0x19'))['db'];config[_0xece9('0x1a')]=_[_0xece9('0x1b')](config[_0xece9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xece9('0x1c'))(new Redis(config[_0xece9('0x1a')]));require(_0xece9('0x1d'))[_0xece9('0x1e')](socket);var jayson=require(_0xece9('0x1f'));var client=jayson[_0xece9('0x20')][_0xece9('0x21')]({'port':0x232c});var client9002=jayson[_0xece9('0x20')][_0xece9('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3a0071,_0x32e73b,_0x1bebd8,_0x296c44){return new BPromise(function(_0x1e9422,_0x1c4384){var _0x2906ef=_0x296c44||client;return _0x2906ef[_0xece9('0x22')](_0x3a0071,_0x1bebd8)[_0xece9('0x23')](function(_0x24ae56){logger[_0xece9('0x24')](_0xece9('0x25'),_0x32e73b,'request\x20sent');logger[_0xece9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e73b,_0xece9('0x27'),JSON[_0xece9('0x28')](_0x24ae56));if(_0x24ae56[_0xece9('0x29')]){if(_0x24ae56['error'][_0xece9('0x2a')]===0x1f4){logger['error'](_0xece9('0x25'),_0x32e73b,_0x24ae56[_0xece9('0x29')][_0xece9('0x2b')]);return _0x1c4384(_0x24ae56[_0xece9('0x29')][_0xece9('0x2b')]);}logger[_0xece9('0x29')](_0xece9('0x25'),_0x32e73b,_0x24ae56[_0xece9('0x29')][_0xece9('0x2b')]);return _0x1e9422(_0x24ae56[_0xece9('0x29')][_0xece9('0x2b')]);}else{logger['info'](_0xece9('0x25'),_0x32e73b,_0xece9('0x27'));_0x1e9422(_0x24ae56[_0xece9('0x2c')][_0xece9('0x2b')]);}})['catch'](function(_0x44f342){logger['error'](_0xece9('0x25'),_0x32e73b,_0x44f342);_0x1c4384(_0x44f342);});});}function respondWithStatusCode(_0x585ec9,_0x20d2c3){_0x20d2c3=_0x20d2c3||0xcc;return function(_0x6c9bc8){if(_0x6c9bc8){return _0x585ec9['sendStatus'](_0x20d2c3);}return _0x585ec9[_0xece9('0x2d')](_0x20d2c3)[_0xece9('0x2e')]();};}function respondWithResult(_0x20e27d,_0x2b86f5){_0x2b86f5=_0x2b86f5||0xc8;return function(_0x3b1b54){if(_0x3b1b54){return _0x20e27d['status'](_0x2b86f5)[_0xece9('0x2f')](_0x3b1b54);}};}function respondWithFilteredResult(_0x49c51a,_0x48cf1d){return function(_0x15fcce){if(_0x15fcce){var _0x2ea5f5=typeof _0x48cf1d['offset']==='undefined'&&typeof _0x48cf1d['limit']===_0xece9('0x30');var _0x3349b6=_0x15fcce[_0xece9('0x31')];var _0x110226=_0x2ea5f5?0x0:_0x48cf1d[_0xece9('0x32')];var _0x29a060=_0x2ea5f5?_0x15fcce[_0xece9('0x31')]:_0x48cf1d[_0xece9('0x32')]+_0x48cf1d[_0xece9('0x33')];var _0x290cbc;if(_0x29a060>=_0x3349b6){_0x29a060=_0x3349b6;_0x290cbc=0xc8;}else{_0x290cbc=0xce;}_0x49c51a['status'](_0x290cbc);return _0x49c51a[_0xece9('0x34')](_0xece9('0x35'),_0x110226+'-'+_0x29a060+'/'+_0x3349b6)[_0xece9('0x2f')](_0x15fcce);}return null;};}function patchUpdates(_0x3a5658){return function(_0xd92a04){try{jsonpatch[_0xece9('0x36')](_0xd92a04,_0x3a5658,!![]);}catch(_0x3469c4){return BPromise['reject'](_0x3469c4);}return _0xd92a04[_0xece9('0x37')]();};}function saveUpdates(_0x15cff5,_0x2c6ee9){return function(_0x4a3a60){if(_0x4a3a60){return _0x4a3a60['update'](_0x15cff5)[_0xece9('0x23')](function(_0x374798){return _0x374798;});}return null;};}function removeEntity(_0x19929d,_0x112440){return function(_0x292897){if(_0x292897){return _0x292897[_0xece9('0x38')]()[_0xece9('0x23')](function(){_0x19929d['status'](0xcc)[_0xece9('0x2e')]();});}};}function handleEntityNotFound(_0x48200c,_0x334ef5){return function(_0x417934){if(!_0x417934){_0x48200c[_0xece9('0x39')](0x194);}return _0x417934;};}function handleError(_0x3ed5c2,_0x39ae4c){_0x39ae4c=_0x39ae4c||0x1f4;return function(_0x5216f9){logger[_0xece9('0x29')](_0x5216f9['stack']);if(_0x5216f9[_0xece9('0x3a')]){delete _0x5216f9['name'];}_0x3ed5c2[_0xece9('0x2d')](_0x39ae4c)['send'](_0x5216f9);};}exports['index']=function(_0x353484,_0x240446){var _0x4308f2={},_0x597d02={},_0x5647a4={'count':0x0,'rows':[]};var _0x45e3fa=_['map'](db[_0xece9('0x3b')][_0xece9('0x3c')],function(_0x59b6e5){return{'name':_0x59b6e5[_0xece9('0x3d')],'type':_0x59b6e5[_0xece9('0x3e')][_0xece9('0x3f')]};});_0x597d02[_0xece9('0x40')]=_['map'](_0x45e3fa,'name');_0x597d02['query']=_[_0xece9('0x41')](_0x353484[_0xece9('0x42')]);_0x597d02[_0xece9('0x43')]=_[_0xece9('0x44')](_0x597d02[_0xece9('0x40')],_0x597d02[_0xece9('0x42')]);_0x4308f2[_0xece9('0x45')]=_[_0xece9('0x44')](_0x597d02[_0xece9('0x40')],qs[_0xece9('0x46')](_0x353484[_0xece9('0x42')][_0xece9('0x46')]));_0x4308f2['attributes']=_0x4308f2['attributes'][_0xece9('0x47')]?_0x4308f2[_0xece9('0x45')]:_0x597d02[_0xece9('0x40')];if(!_0x353484['query'][_0xece9('0x48')](_0xece9('0x49'))){_0x4308f2[_0xece9('0x33')]=qs[_0xece9('0x33')](_0x353484['query'][_0xece9('0x33')]);_0x4308f2[_0xece9('0x32')]=qs['offset'](_0x353484[_0xece9('0x42')][_0xece9('0x32')]);}_0x4308f2[_0xece9('0x4a')]=qs[_0xece9('0x4b')](_0x353484[_0xece9('0x42')][_0xece9('0x4b')]);_0x4308f2[_0xece9('0x4c')]=qs['filters'](_['pick'](_0x353484[_0xece9('0x42')],_0x597d02[_0xece9('0x43')]),_0x45e3fa);if(_0x353484['query'][_0xece9('0x4d')]){_0x4308f2[_0xece9('0x4c')]=_[_0xece9('0x4e')](_0x4308f2[_0xece9('0x4c')],{'$or':_[_0xece9('0x4f')](_0x45e3fa,function(_0x475177){if(_0x475177[_0xece9('0x3e')]!==_0xece9('0x50')){var _0x361919={};_0x361919[_0x475177[_0xece9('0x3a')]]={'$like':'%'+_0x353484[_0xece9('0x42')]['filter']+'%'};return _0x361919;}})});}_0x4308f2=_['merge']({},_0x4308f2,_0x353484['options']);var _0x430c2d={'where':_0x4308f2[_0xece9('0x4c')]};return db[_0xece9('0x3b')][_0xece9('0x31')](_0x430c2d)[_0xece9('0x23')](function(_0x4e2353){_0x5647a4[_0xece9('0x31')]=_0x4e2353;if(_0x353484[_0xece9('0x42')][_0xece9('0x51')]){_0x4308f2['include']=[{'all':!![]}];}return db[_0xece9('0x3b')][_0xece9('0x52')](_0x4308f2);})[_0xece9('0x23')](function(_0x3c1fba){_0x5647a4[_0xece9('0x53')]=_0x3c1fba;return _0x5647a4;})[_0xece9('0x23')](respondWithFilteredResult(_0x240446,_0x4308f2))[_0xece9('0x54')](handleError(_0x240446,null));};exports[_0xece9('0x55')]=function(_0x31d6eb,_0x423504){var _0x559f88={'raw':!![],'where':{'id':_0x31d6eb[_0xece9('0x56')]['id']}},_0x26824c={};_0x26824c[_0xece9('0x40')]=_[_0xece9('0x41')](db[_0xece9('0x3b')]['rawAttributes']);_0x26824c[_0xece9('0x42')]=_['keys'](_0x31d6eb[_0xece9('0x42')]);_0x26824c[_0xece9('0x43')]=_[_0xece9('0x44')](_0x26824c[_0xece9('0x40')],_0x26824c['query']);_0x559f88[_0xece9('0x45')]=_[_0xece9('0x44')](_0x26824c['model'],qs[_0xece9('0x46')](_0x31d6eb['query'][_0xece9('0x46')]));_0x559f88[_0xece9('0x45')]=_0x559f88[_0xece9('0x45')][_0xece9('0x47')]?_0x559f88[_0xece9('0x45')]:_0x26824c['model'];if(_0x31d6eb[_0xece9('0x42')][_0xece9('0x51')]){_0x559f88[_0xece9('0x57')]=[{'all':!![]}];}_0x559f88=_['merge']({},_0x559f88,_0x31d6eb[_0xece9('0x58')]);return db['SmsMessage']['find'](_0x559f88)[_0xece9('0x23')](handleEntityNotFound(_0x423504,null))[_0xece9('0x23')](respondWithResult(_0x423504,null))[_0xece9('0x54')](handleError(_0x423504,null));};exports[_0xece9('0x59')]=function(_0x5dbad4,_0x4d6c5f){return db[_0xece9('0x3b')]['create'](_0x5dbad4[_0xece9('0x5a')],{})[_0xece9('0x23')](respondWithResult(_0x4d6c5f,0xc9))['catch'](handleError(_0x4d6c5f,null));};exports['update']=function(_0x5efd7c,_0x3db07d){if(_0x5efd7c['body']['id']){delete _0x5efd7c[_0xece9('0x5a')]['id'];}return db[_0xece9('0x3b')]['find']({'where':{'id':_0x5efd7c['params']['id']}})['then'](handleEntityNotFound(_0x3db07d,null))[_0xece9('0x23')](saveUpdates(_0x5efd7c[_0xece9('0x5a')],null))['then'](respondWithResult(_0x3db07d,null))[_0xece9('0x54')](handleError(_0x3db07d,null));};exports[_0xece9('0x38')]=function(_0x4c89a1,_0xc85ffe){return db[_0xece9('0x3b')]['find']({'where':{'id':_0x4c89a1[_0xece9('0x56')]['id']}})[_0xece9('0x23')](handleEntityNotFound(_0xc85ffe,null))['then'](removeEntity(_0xc85ffe,null))['catch'](handleError(_0xc85ffe,null));};exports[_0xece9('0x5b')]=function(_0x5ba239,_0xf4111){return db[_0xece9('0x3b')][_0xece9('0x5b')]()['then'](respondWithResult(_0xf4111,null))[_0xece9('0x54')](handleError(_0xf4111,null));};var interaction_log=require('../../config/logger')(_0xece9('0x5c'));exports[_0xece9('0x5d')]=function(_0x2f37dc,_0x35a3fd,_0x2b66bd){var _0x4af775={'agent':{},'channel':_0xece9('0x5e')};if(_0x2f37dc['body']['id']){delete _0x2f37dc['body']['id'];}_0x2f37dc[_0xece9('0x5a')][_0xece9('0x5f')]=!![];_0x2f37dc[_0xece9('0x5a')][_0xece9('0x60')]=moment()[_0xece9('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f37dc[_0xece9('0x5a')]['UserId']=_0x2f37dc['body']['UserId']||_0x2f37dc[_0xece9('0x62')]['id'];_0x4af775[_0xece9('0x63')]['id']=_0x2f37dc[_0xece9('0x5a')][_0xece9('0x64')];return db[_0xece9('0x3b')][_0xece9('0x65')]({'where':{'id':_0x2f37dc[_0xece9('0x56')]['id'],'UserId':null}})[_0xece9('0x23')](handleEntityNotFound(_0x35a3fd,null))[_0xece9('0x23')](saveUpdates(_0x2f37dc[_0xece9('0x5a')],null))[_0xece9('0x23')](function(_0x1bdfef){if(_0x1bdfef){_0x4af775[_0xece9('0x2b')]=_0x1bdfef['get']({'plain':!![]});return db[_0xece9('0x66')][_0xece9('0x65')]({'where':{'id':_0x1bdfef[_0xece9('0x67')]}});}return null;})[_0xece9('0x23')](handleEntityNotFound(_0x35a3fd,null))[_0xece9('0x23')](function(_0x225ac1){if(_0x225ac1){return _0x225ac1[_0xece9('0x68')]({'UserId':_0x2f37dc[_0xece9('0x5a')][_0xece9('0x64')],'read1stAt':_[_0xece9('0x69')](_0x225ac1[_0xece9('0x6a')])?moment()[_0xece9('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xece9('0x23')](function(_0x4ea87b){if(_0x4ea87b){_0x4af775[_0xece9('0x6b')]=_0x4ea87b['get']({'plain':!![]});interaction_log[_0xece9('0x24')](_0xece9('0x6c'),_0x2f37dc[_0xece9('0x62')]['id'],_0x2f37dc[_0xece9('0x62')][_0xece9('0x3a')],_0x2f37dc[_0xece9('0x62')][_0xece9('0x6d')],_0x4af775['interaction']['id'],_0x2f37dc['body']?JSON['stringify'](_0x2f37dc[_0xece9('0x5a')]):_0xece9('0x6e'));return respondWithRpcPromise(_0xece9('0x6f'),_0xece9('0x70'),_0x4af775);}return null;})[_0xece9('0x23')](function(_0x4a0a52){var _0x58dc7c=_0xece9('0x71')+_0x4a0a52[_0xece9('0x2b')][_0xece9('0x72')];return db['sequelize'][_0xece9('0x42')](_0x58dc7c,{'type':db[_0xece9('0x73')][_0xece9('0x74')]['SELECT'],'raw':!![]})[_0xece9('0x23')](function(_0x59ece4){return _0x59ece4;});})[_0xece9('0x23')](function(_0x23fa4e){if(_0x23fa4e){_0x4af775[_0xece9('0x2b')]['contact']=_0x23fa4e[0x0];if(!_0x2f37dc[_0xece9('0x5a')][_0xece9('0x64')])return;return db[_0xece9('0x75')]['find']({'where':{'id':_0x2f37dc[_0xece9('0x5a')][_0xece9('0x64')],'role':_0xece9('0x63')},'attributes':['id',_0xece9('0x3a'),_0xece9('0x76'),'email',_0xece9('0x77')],'raw':!![]});}return null;})[_0xece9('0x23')](function(_0x3c2328){if(!_0x3c2328)return null;_0x4af775[_0xece9('0x2b')][_0xece9('0x63')]=_0x3c2328;return _0x4af775;})[_0xece9('0x23')](function(_0x255662){if(_0x255662){if(_0x2f37dc['body'][_0xece9('0x78')]){_0x4af775[_0xece9('0x2b')][_0xece9('0x79')]=util[_0xece9('0x61')](_0xece9('0x7a'),_0x2f37dc[_0xece9('0x62')][_0xece9('0x3a')]);_0x4af775['message'][_0xece9('0x7b')]=_0x4af775[_0xece9('0x7b')];_0x4af775[_0xece9('0x2b')]['motionChannel']=_0x4af775[_0xece9('0x7b')];_0x4af775[_0xece9('0x2b')][_0xece9('0x7c')]=_0xece9('0x5d');return respondWithRpcPromise(_0xece9('0x7d'),_0xece9('0x7d'),{'event':_0xece9('0x7e'),'message':_0x4af775['message']},client9002)[_0xece9('0x23')](function(){return _0x4af775;});}return _0x4af775;}return null;})[_0xece9('0x23')](respondWithResult(_0x35a3fd,null))['catch'](handleError(_0x35a3fd,null));};var interaction_log=require(_0xece9('0x14'))('sms-interactions');exports[_0xece9('0x7f')]=function(_0x1cede9,_0x3f35c9,_0x462aa2){var _0x59e1c8={'agent':{},'channel':_0xece9('0x5e')};if(_0x1cede9[_0xece9('0x5a')]['id']){delete _0x1cede9['body']['id'];}_0x1cede9[_0xece9('0x5a')][_0xece9('0x64')]=_0x1cede9['body'][_0xece9('0x64')]||_0x1cede9[_0xece9('0x62')]['id'];_0x59e1c8[_0xece9('0x63')]['id']=_0x1cede9[_0xece9('0x5a')][_0xece9('0x64')];return db[_0xece9('0x3b')][_0xece9('0x65')]({'where':{'id':_0x1cede9['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f35c9,null))[_0xece9('0x23')](function(_0x325b2b){if(_0x325b2b){_0x59e1c8[_0xece9('0x2b')]=_0x325b2b[_0xece9('0x80')]({'plain':!![]});return db[_0xece9('0x66')][_0xece9('0x65')]({'where':{'id':_0x325b2b[_0xece9('0x67')]}});}return null;})[_0xece9('0x23')](handleEntityNotFound(_0x3f35c9,null))[_0xece9('0x23')](function(_0x8a9ec){if(_0x8a9ec){_0x59e1c8['interaction']=_0x8a9ec[_0xece9('0x80')]({'plain':!![]});interaction_log[_0xece9('0x24')](_0xece9('0x81'),_0x1cede9[_0xece9('0x62')]['id'],_0x1cede9[_0xece9('0x62')][_0xece9('0x3a')],_0x1cede9[_0xece9('0x62')][_0xece9('0x6d')],_0x59e1c8['interaction']['id'],_0x1cede9[_0xece9('0x5a')]?JSON['stringify'](_0x1cede9[_0xece9('0x5a')]):_0xece9('0x6e'));return respondWithRpcPromise(_0xece9('0x82'),_0xece9('0x83'),_0x59e1c8);}return null;})[_0xece9('0x23')](function(_0x1a2020){var _0xd057d8=_0xece9('0x71')+_0x1a2020[_0xece9('0x2b')]['ContactId'];return db[_0xece9('0x84')][_0xece9('0x42')](_0xd057d8,{'type':db['Sequelize'][_0xece9('0x74')][_0xece9('0x85')],'raw':!![]})[_0xece9('0x23')](function(_0x57c520){return _0x57c520;});})[_0xece9('0x23')](function(_0x130bc1){if(_0x130bc1){_0x59e1c8[_0xece9('0x2b')][_0xece9('0x86')]=_0x130bc1[0x0];if(!_0x1cede9[_0xece9('0x5a')]['UserId'])return;return db[_0xece9('0x75')][_0xece9('0x65')]({'where':{'id':_0x1cede9[_0xece9('0x5a')][_0xece9('0x64')],'role':_0xece9('0x63')},'attributes':['id',_0xece9('0x3a'),_0xece9('0x76'),_0xece9('0x87'),_0xece9('0x77')],'raw':!![]});}return null;})['then'](function(_0x2c2a4f){if(!_0x2c2a4f)return null;_0x59e1c8[_0xece9('0x2b')]['agent']=_0x2c2a4f;return _0x59e1c8;})['then'](function(_0x41ae7a){if(_0x41ae7a){_0x41ae7a[_0xece9('0x2b')][_0xece9('0x79')]=util[_0xece9('0x61')]('SIP/%s',_0x1cede9[_0xece9('0x62')][_0xece9('0x3a')]);_0x41ae7a[_0xece9('0x2b')]['channel']=_0x59e1c8[_0xece9('0x7b')];_0x41ae7a[_0xece9('0x2b')][_0xece9('0x88')]=_0x59e1c8['channel'];_0x41ae7a[_0xece9('0x2b')][_0xece9('0x7c')]=_0xece9('0x7f');respondWithRpcPromise('EventManager',_0xece9('0x7d'),{'event':_0xece9('0x89'),'message':_0x41ae7a[_0xece9('0x2b')]},client9002);return _0x59e1c8;}return null;})[_0xece9('0x23')](respondWithResult(_0x3f35c9,null))[_0xece9('0x54')](handleError(_0x3f35c9,null));};exports[_0xece9('0x2d')]=function(_0x3811d8,_0x2b0e0e,_0x4ea358){if(_0x3811d8[_0xece9('0x5a')]['id']){delete _0x3811d8[_0xece9('0x5a')]['id'];}var _0x44a5b8;return db[_0xece9('0x3b')]['find']({'where':{'id':_0x3811d8[_0xece9('0x56')]['id']}})[_0xece9('0x23')](handleEntityNotFound(_0x2b0e0e,null))[_0xece9('0x23')](function(_0x40b123){if(_0x40b123){_0x44a5b8=_0x40b123;return db[_0xece9('0x8a')][_0xece9('0x65')]({'where':{'id':_0x40b123[_0xece9('0x8b')]}});}})['then'](handleEntityNotFound(_0x2b0e0e,null))[_0xece9('0x23')](function(_0x29eca2){if(_0x29eca2){logger[_0xece9('0x26')](_0xece9('0x8c'),_0xece9('0x2d'),'received\x20delivery\x20report\x20from',_0x29eca2[_0xece9('0x3e')],util[_0xece9('0x8d')](_0x3811d8['body'],{'showHidden':![],'depth':null}));switch(_0x29eca2[_0xece9('0x3e')]){case _0xece9('0x8e'):if(_0x3811d8[_0xece9('0x5a')][_0xece9('0x8f')]&&_0x3811d8[_0xece9('0x5a')]['MessageSid']===_0x44a5b8['messageId']){return _0x44a5b8['update']({'read':!![]});}else{logger[_0xece9('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xece9('0x2d'),'twilio',util['inspect'](_0x3811d8[_0xece9('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xece9('0x90'):if(_0x3811d8[_0xece9('0x5a')][_0xece9('0x91')]&&_0x3811d8[_0xece9('0x5a')]['MessageUUID']===_0x44a5b8[_0xece9('0x92')]&&_[_0xece9('0x93')]([_0xece9('0x94'),_0xece9('0x95')],_0x3811d8[_0xece9('0x5a')][_0xece9('0x96')])>=0x0){return _0x44a5b8[_0xece9('0x68')]({'read':!![]});}else{logger[_0xece9('0x29')](_0xece9('0x97'),_0xece9('0x2d'),_0xece9('0x98'),util[_0xece9('0x8d')](_0x3811d8[_0xece9('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xece9('0x99'):var _0x51dbda=_0x3811d8[_0xece9('0x5a')][_0xece9('0x9a')][0x0];if(_0x51dbda['status']['groupName']===_0xece9('0x9b')){return _0x44a5b8['update']({'read':!![]});}else{logger[_0xece9('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xece9('0x2d'),_0xece9('0x99'),util[_0xece9('0x8d')](_0x3811d8[_0xece9('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x44a5b8;}})[_0xece9('0x23')](respondWithResult(_0x2b0e0e,null))['catch'](handleError(_0x2b0e0e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4443f2a..d5f4f5e 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 _0x7efd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x396ac0,_0x2f55d8){var _0x3e10ad=function(_0x53129c){while(--_0x53129c){_0x396ac0['push'](_0x396ac0['shift']());}};_0x3e10ad(++_0x2f55d8);}(_0x7efd,0x17d));var _0xd7ef=function(_0x2287df,_0x5a4a24){_0x2287df=_0x2287df-0x0;var _0x2afbc1=_0x7efd[_0x2287df];return _0x2afbc1;};'use strict';var EventEmitter=require(_0xd7ef('0x0'));var SmsMessage=require(_0xd7ef('0x1'))['db'][_0xd7ef('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd7ef('0x3')](0x0);var events={'afterCreate':_0xd7ef('0x4'),'afterUpdate':_0xd7ef('0x5'),'afterDestroy':_0xd7ef('0x6')};function emitEvent(_0x5eaf34){return function(_0x35d6b7,_0x3ce705,_0x1ac1ca){SmsMessageEvents[_0xd7ef('0x7')](_0x5eaf34+':'+_0x35d6b7['id'],_0x35d6b7);SmsMessageEvents[_0xd7ef('0x7')](_0x5eaf34,_0x35d6b7);_0x1ac1ca(null);};}for(var e in events){if(events[_0xd7ef('0x8')](e)){var event=events[e];SmsMessage[_0xd7ef('0x9')](e,emitEvent(event));}}module[_0xd7ef('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0x1fca=['SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b873d,_0x2d8216){var _0x824a00=function(_0xe69090){while(--_0xe69090){_0x3b873d['push'](_0x3b873d['shift']());}};_0x824a00(++_0x2d8216);}(_0x1fca,0xb0));var _0xa1fc=function(_0x42428f,_0x3f1489){_0x42428f=_0x42428f-0x0;var _0x49aa3f=_0x1fca[_0x42428f];return _0x49aa3f;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xa1fc('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa1fc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1fc('0x2'),'afterDestroy':_0xa1fc('0x3')};function emitEvent(_0x4d3006){return function(_0x55d4d2,_0x274b78,_0x1dcbd4){SmsMessageEvents['emit'](_0x4d3006+':'+_0x55d4d2['id'],_0x55d4d2);SmsMessageEvents[_0xa1fc('0x4')](_0x4d3006,_0x55d4d2);_0x1dcbd4(null);};}for(var e in events){if(events[_0xa1fc('0x5')](e)){var event=events[e];SmsMessage[_0xa1fc('0x6')](e,emitEvent(event));}}module[_0xa1fc('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 02253e3..b1bb264 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 _0x9e38=['md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer','code','Bearer\x20','message','refid','status','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','senderString','requestid','deliveryReport','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','token','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash'];(function(_0x280cad,_0x327bf5){var _0x32a455=function(_0x2e85fd){while(--_0x2e85fd){_0x280cad['push'](_0x280cad['shift']());}};_0x32a455(++_0x327bf5);}(_0x9e38,0x93));var _0x89e3=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0x9e38[_0x44606e];return _0xe68388;};'use strict';var _=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var logger=require(_0x89e3('0x2'))('api');var moment=require(_0x89e3('0x3'));var BPromise=require(_0x89e3('0x4'));var rp=require(_0x89e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89e3('0x6'));var config=require(_0x89e3('0x7'));var attributes=require(_0x89e3('0x8'));module[_0x89e3('0x9')]=function(_0x3af5b0,_0x1dff70){return _0x3af5b0[_0x89e3('0xa')](_0x89e3('0xb'),attributes,{'tableName':_0x89e3('0xc'),'paranoid':![],'indexes':[{'name':_0x89e3('0xd'),'fields':[_0x89e3('0xd')]},{'name':_0x89e3('0xe'),'fields':[_0x89e3('0xf')],'type':_0x89e3('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46f34d,_0x242569,_0x4dbfbb){var _0x144f02=_0x3af5b0[_0x89e3('0x11')];var _0x48bfca=_0x46f34d[_0x89e3('0x12')]({'plain':!![]});if(_0x48bfca['direction']['toLowerCase']()==='in'||_0x48bfca[_0x89e3('0x13')][_0x89e3('0x14')]()==='out'&&!_0x48bfca[_0x89e3('0x15')]&&!_['isNil'](_0x48bfca[_0x89e3('0x16')])&&!_[_0x89e3('0x17')](_0x48bfca[_0x89e3('0x18')])){_0x144f02[_0x89e3('0x19')][_0x89e3('0x1a')]({'where':{'id':_0x48bfca['SmsInteractionId']}})[_0x89e3('0x1b')](function(_0x29e5fa){if(_0x29e5fa){_0x29e5fa['update']({'lastMsgAt':_0x48bfca['createdAt'],'lastMsgDirection':_0x48bfca[_0x89e3('0x13')][_0x89e3('0x14')]()});}})[_0x89e3('0x1c')](function(_0x48e5d0){console[_0x89e3('0x1d')](_0x48e5d0);});}if(_0x48bfca[_0x89e3('0x13')]===_0x89e3('0x1e')&&!_0x48bfca[_0x89e3('0x15')]){var _0x59232b;_0x144f02[_0x89e3('0x1f')][_0x89e3('0x20')]({'where':{'id':_0x48bfca[_0x89e3('0x21')]},'raw':!![]})[_0x89e3('0x1b')](function(_0x516f9d){_0x59232b=_0x516f9d;if(_0x59232b&&_0x59232b[_0x89e3('0x22')]){switch(_0x59232b['type']){case _0x89e3('0x23'):var _0x2ccf84=require('twilio');if(_0x59232b[_0x89e3('0x24')]&&_0x59232b[_0x89e3('0x25')]&&_0x59232b[_0x89e3('0x26')]){var _0x201b0b=new _0x2ccf84(_0x59232b['accountSid'],_0x59232b[_0x89e3('0x25')]);_0x201b0b[_0x89e3('0x27')][_0x89e3('0x28')]({'body':_0x48bfca['body'],'to':_0x48bfca[_0x89e3('0x26')],'from':_0x59232b[_0x89e3('0x26')],'statusCallback':_0x59232b[_0x89e3('0x29')]+_0x89e3('0x2a')+_0x48bfca['id']+'/status?token='+_0x59232b['token']})[_0x89e3('0x1b')](function(_0x721d82){if(_0x721d82['sid']){return _0x46f34d[_0x89e3('0x2b')]({'messageId':_0x721d82['sid']});}})[_0x89e3('0x1c')](function(_0x2321a8){logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),'twilio',util[_0x89e3('0x2e')](_0x2321a8,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),'twilio',_0x89e3('0x2f'));}break;case _0x89e3('0x30'):var _0x13fbeb=_0x89e3('0x31');if(_0x59232b[_0x89e3('0x32')]&&_0x59232b[_0x89e3('0x33')]){var _0x37dcc2={'recipient':[_0x48bfca[_0x89e3('0x26')]],'message':_0x48bfca['body'],'message_type':_0x59232b[_0x89e3('0x34')]};if(_0x59232b['smsMethod']&&_0x59232b[_0x89e3('0x34')]!=='SI'){_0x37dcc2[_0x89e3('0x35')]=_0x59232b[_0x89e3('0x26')];}var _0x1c229a={'url':_0x13fbeb+'login?username='+_0x59232b[_0x89e3('0x32')]+_0x89e3('0x36')+_0x59232b[_0x89e3('0x33')],'method':_0x89e3('0x37')};rp(_0x1c229a)[_0x89e3('0x1b')](function(_0x10768b){var _0x23f787=_0x10768b[_0x89e3('0x38')](';');var _0x3b4ceb={'user_key':_0x23f787[0x0],'session_key':_0x23f787[0x1]};_0x1c229a={'url':_0x13fbeb+'sms','method':_0x89e3('0x39'),'headers':{'user_key':_0x3b4ceb[_0x89e3('0x3a')],'Session_key':_0x3b4ceb[_0x89e3('0x3b')]},'json':!![],'body':_0x37dcc2};return rp(_0x1c229a);})[_0x89e3('0x1b')](function(_0x4a1871){if(_0x4a1871[_0x89e3('0x3c')]>=0x1){var _0x40ed59={'messageId':_0x4a1871[_0x89e3('0x3d')]};if(_0x59232b[_0x89e3('0x34')]!=='GP'||!_0x59232b['deliveryReport']){_0x40ed59['read']=!![];}return _0x46f34d[_0x89e3('0x2b')](_0x40ed59);}else{return logger[_0x89e3('0x1d')](_0x89e3('0x2c'),'afterCreate',_0x89e3('0x30'),util[_0x89e3('0x2e')](_0x4a1871,{'showHidden':![],'depth':null}));}})[_0x89e3('0x1c')](function(_0x5090a5){return logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x30'),util[_0x89e3('0x2e')](_0x5090a5,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x59232b['authToken']){var _0xc351b3={'recipient':_0x48bfca[_0x89e3('0x26')],'message':_0x48bfca[_0x89e3('0xf')],'sender':_0x59232b[_0x89e3('0x3e')]||_0x59232b[_0x89e3('0x26')],'authorization':_0x59232b[_0x89e3('0x25')]};var _0x242569={'method':_0x89e3('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xc351b3,'json':!![]};rp(_0x242569)[_0x89e3('0x1b')](function(_0x5bf447){var _0x41b9c4={'messageId':_0x5bf447[_0x89e3('0x3f')]};if(!_0x59232b[_0x89e3('0x40')]){_0x41b9c4[_0x89e3('0x41')]=!![];}return _0x46f34d['update'](_0x41b9c4);})['catch'](function(_0xc25df2){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x89e3('0x42'),util['inspect'](_0xc25df2,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x42'),_0x89e3('0x43'));}break;case _0x89e3('0x44'):if(_0x59232b[_0x89e3('0x32')]&&_0x59232b[_0x89e3('0x33')]){var _0xc351b3={'messages':[{'source':_0x89e3('0x45'),'to':_0x48bfca[_0x89e3('0x26')],'body':_0x48bfca[_0x89e3('0xf')],'from':_0x59232b[_0x89e3('0x3e')]||_0x59232b[_0x89e3('0x26')]}]};var _0x9f2f2c=util['format'](_0x89e3('0x46'),_0x59232b['username'],_0x59232b['password']);var _0x242569={'method':_0x89e3('0x39'),'uri':_0x89e3('0x47'),'body':_0xc351b3,'headers':{'Authorization':util[_0x89e3('0x48')](_0x89e3('0x49'),new Buffer(_0x9f2f2c)[_0x89e3('0x4a')](_0x89e3('0x4b')))},'json':!![]};rp(_0x242569)[_0x89e3('0x1b')](function(_0xd5d3b9){if(_0xd5d3b9['http_code']>=0xc8&&_0xd5d3b9[_0x89e3('0x4c')]<=0xce){if(_0xd5d3b9[_0x89e3('0x4d')]&&_0xd5d3b9['data'][_0x89e3('0x4e')]>0x0){var _0x481334=_[_0x89e3('0x4f')](_0xd5d3b9[_0x89e3('0x4d')]['messages']);var _0x5f2c21={'messageId':_0x481334['message_id']};if(!_0x59232b[_0x89e3('0x40')]){_0x5f2c21[_0x89e3('0x41')]=!![];}return _0x46f34d['update'](_0x5f2c21);}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x50'),util[_0x89e3('0x2e')](_0xd5d3b9,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),'clickSend',util[_0x89e3('0x2e')](_0xd5d3b9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1c2a63){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),_0x89e3('0x50'),util['inspect'](_0x1c2a63,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),'afterCreate',_0x89e3('0x50'),_0x89e3('0x51'));}break;case _0x89e3('0x52'):if(_0x59232b[_0x89e3('0x53')]&&_0x59232b[_0x89e3('0x25')]){var _0xc351b3={'dst':_0x48bfca[_0x89e3('0x26')],'text':_0x48bfca[_0x89e3('0xf')],'src':_0x59232b[_0x89e3('0x3e')]||_0x59232b[_0x89e3('0x26')],'url':_0x59232b[_0x89e3('0x29')]+'/api/sms/messages/'+_0x48bfca['id']+'/status?token='+_0x59232b[_0x89e3('0x54')]};var _0x9f2f2c=util[_0x89e3('0x48')](_0x89e3('0x46'),_0x59232b['authId'],_0x59232b[_0x89e3('0x25')]);var _0x242569={'method':_0x89e3('0x39'),'uri':util[_0x89e3('0x48')]('https://api.plivo.com/v1/Account/%s/Message/',_0x59232b[_0x89e3('0x53')]),'body':_0xc351b3,'headers':{'Authorization':util[_0x89e3('0x48')]('Basic\x20%s',new Buffer(_0x9f2f2c)[_0x89e3('0x4a')](_0x89e3('0x4b')))},'json':!![]};rp(_0x242569)[_0x89e3('0x1b')](function(_0x375200){var _0x47e56c={'messageId':_0x375200[_0x89e3('0x55')][0x0]};return _0x46f34d['update'](_0x47e56c);})[_0x89e3('0x1c')](function(_0xde749d){logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),'plivo',util['inspect'](_0xde749d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),_0x89e3('0x52'),_0x89e3('0x56'));}break;case _0x89e3('0x57'):if(_0x59232b['username']&&_0x59232b[_0x89e3('0x33')]){if(_0x59232b['baseUrl']){var _0x24a054={'method':_0x89e3('0x39'),'uri':_0x59232b[_0x89e3('0x58')]+_0x89e3('0x59'),'body':{'username':_0x59232b[_0x89e3('0x32')],'password':_0x59232b[_0x89e3('0x33')]},'json':!![]};return rp(_0x24a054)[_0x89e3('0x1b')](function(_0x451e20){var _0x1c019e={'method':_0x89e3('0x39'),'uri':_0x59232b[_0x89e3('0x58')]+_0x89e3('0x5a'),'body':{'messages':[{'from':_0x59232b['phone'],'destinations':[{'to':_0x48bfca[_0x89e3('0x26')]}],'text':_0x48bfca['body'],'notifyUrl':_0x59232b[_0x89e3('0x29')]+_0x89e3('0x2a')+_0x48bfca['id']+_0x89e3('0x5b')+_0x59232b[_0x89e3('0x54')],'notifyContentType':_0x89e3('0x5c'),'callbackData':_0x59232b[_0x89e3('0x26')]+';'+_0x48bfca[_0x89e3('0xf')]}]},'headers':{'Authorization':_0x89e3('0x5d')+_0x451e20[_0x89e3('0x54')]},'json':!![]};return rp(_0x1c019e)[_0x89e3('0x1b')](function(_0x55db35){if(_0x55db35[_0x89e3('0x27')]){var _0x5e0a66={'messageId':_0x55db35[_0x89e3('0x27')][0x0][_0x89e3('0xd')]};if(!_0x59232b[_0x89e3('0x40')]){_0x5e0a66[_0x89e3('0x41')]=!![];}return _0x46f34d[_0x89e3('0x2b')](_0x5e0a66);}else{return logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x57'),util[_0x89e3('0x2e')](_0x55db35,{'showHidden':![],'depth':null}));}});})[_0x89e3('0x1c')](function(_0x31e729){return logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x57'),util['inspect'](_0x31e729,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x57'),_0x89e3('0x5e'));}}else{logger['error'](_0x89e3('0x2c'),'afterCreate',_0x89e3('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x89e3('0x5f'):var _0x17fff2=require(_0x89e3('0x60'));if(_0x59232b[_0x89e3('0x61')]){var _0x90bef3={};_0x90bef3[_0x89e3('0x62')]=_0x59232b[_0x89e3('0x32')];_0x90bef3[_0x89e3('0x26')]=_0x48bfca['phone'];_0x90bef3[_0x89e3('0x35')]=_0x59232b[_0x89e3('0x26')];_0x90bef3[_0x89e3('0x63')]=_0x48bfca[_0x89e3('0xf')];_0x90bef3[_0x89e3('0x64')]=+new Date();var _0x17ec41='';var _0x5832a9='';var _0x4c5871=Object[_0x89e3('0x65')](_0x90bef3);_0x4c5871[_0x89e3('0x66')]();for(var _0x42b717=0x0;_0x42b717<_0x4c5871[_0x89e3('0x67')];_0x42b717++){if(_0x17ec41!=''){_0x17ec41+='&';}_0x17ec41+=_0x4c5871[_0x42b717]+'='+encodeURIComponent(_0x90bef3[_0x4c5871[_0x42b717]]);_0x5832a9+=_0x90bef3[_0x4c5871[_0x42b717]];}_0x5832a9+=_0x59232b[_0x89e3('0x61')];_0x5832a9=_0x17fff2[_0x89e3('0x68')](_0x89e3('0x69'))[_0x89e3('0x2b')](_0x5832a9)['digest'](_0x89e3('0x6a'));if(_0x17ec41!==''){_0x17ec41+='&';}_0x17ec41+=_0x89e3('0x6b')+_0x5832a9;var _0x1c229a={'method':_0x89e3('0x37'),'uri':_0x59232b['baseUrl']+_0x89e3('0x6c')+_0x17ec41,'json':!![]};return rp(_0x1c229a)['then'](function(_0x474bc2){var _0x425848=Object['keys'](_0x474bc2);if(_0x474bc2[_0x425848[0x0]][_0x89e3('0x1d')]&&parseInt(_0x474bc2[_0x425848[0x0]][_0x89e3('0x1d')])===0x0){var _0x42badd={'messageId':_0x474bc2[_0x425848[0x0]][_0x89e3('0x6d')]};if(!_0x59232b[_0x89e3('0x40')]){_0x42badd[_0x89e3('0x41')]=!![];}return _0x46f34d[_0x89e3('0x2b')](_0x42badd);}else{return logger['error'](_0x89e3('0x2c'),'afterCreate','csc',util['inspect'](_0x474bc2[_0x89e3('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x310b55){return logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),_0x89e3('0x5f'),util['inspect'](_0x310b55,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),'csc',_0x89e3('0x6e'));}break;case _0x89e3('0x6f'):if(_0x59232b['apiKey']){var _0x4c8370={'method':_0x89e3('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x59232b[_0x89e3('0x61')]},'body':{'content':_0x48bfca[_0x89e3('0xf')],'to':[_0x48bfca['phone']],'from':_0x59232b['phone'],'binary':![],'clientMessageId':_0x89e3('0x70'),'charset':_0x89e3('0x71')},'json':!![]};rp(_0x4c8370)[_0x89e3('0x1b')](function(_0x1cc676){if(!_0x1cc676[_0x89e3('0x1d')]){var _0x28681b={'messageId':_0x1cc676[_0x89e3('0x27')][0x0][_0x89e3('0x72')]};if(!_0x59232b['deliveryReport']){_0x28681b[_0x89e3('0x41')]=!![];}return _0x46f34d['update'](_0x28681b);}else{return logger[_0x89e3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),'clickatell',util['inspect'](_0x1cc676[_0x89e3('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x342b0a){return logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),'clickatell',util[_0x89e3('0x2e')](_0x342b0a,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),_0x89e3('0x6f'),'Missing\x20parameters:\x20apiKey');}break;case _0x89e3('0x73'):if(_0x59232b['username']&&_0x59232b[_0x89e3('0x33')]){var _0x9f2f2c=util[_0x89e3('0x48')](_0x89e3('0x46'),_0x59232b[_0x89e3('0x32')],_0x59232b[_0x89e3('0x33')]);var _0x242569={'method':_0x89e3('0x39'),'uri':_0x89e3('0x74')+_0x59232b['accountId']+'/messages','body':{'to':[_0x48bfca['phone']],'text':_0x48bfca[_0x89e3('0xf')],'from':_0x59232b[_0x89e3('0x26')],'applicationId':_0x59232b[_0x89e3('0x75')]},'headers':{'Authorization':util['format'](_0x89e3('0x49'),new Buffer(_0x9f2f2c)[_0x89e3('0x4a')](_0x89e3('0x4b')))},'json':!![]};rp(_0x242569)[_0x89e3('0x1b')](function(_0x234204){if(_0x234204['id']){var _0x356a2b={'messageId':_0x234204['id']};return _0x46f34d[_0x89e3('0x2b')](_0x356a2b);}else{logger[_0x89e3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x89e3('0x2d'),_0x89e3('0x73'),util[_0x89e3('0x2e')](_0x234204,{'showHidden':![],'depth':null}));}})[_0x89e3('0x1c')](function(_0x2f17bc){logger[_0x89e3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util['inspect'](_0x2f17bc,{'showHidden':![],'depth':null}));});}else{logger[_0x89e3('0x1d')](_0x89e3('0x2c'),_0x89e3('0x2d'),'bandwidth',_0x89e3('0x51'));}break;case _0x89e3('0x76'):if(_0x59232b[_0x89e3('0x61')]){var _0x1a5829={};var _0x1c229a={'method':_0x89e3('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x59232b[_0x89e3('0x61')],'Content-Type':'application/json'},'body':{'from':_0x59232b[_0x89e3('0x26')],'to':_0x48bfca['phone'],'text':_0x48bfca[_0x89e3('0xf')]},'json':!![]};return rp(_0x1c229a)['then'](function(_0x538e63){if(_0x538e63[_0x89e3('0x77')]==0xca){_0x1a5829['message']=_0x538e63;var _0x1d5ab5={'method':_0x89e3('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x89e3('0x78')+_0x59232b[_0x89e3('0x61')],'Content-Type':_0x89e3('0x5c')},'body':{'refid':_0x1a5829[_0x89e3('0x79')][_0x89e3('0x7a')]},'json':!![]};return rp(_0x1d5ab5)['then'](function(_0x6cc6e){_0x1a5829[_0x89e3('0x7b')]=_0x6cc6e;var _0x5f8929={'messageId':_0x1a5829[_0x89e3('0x79')]['refid'],'read':!![]};return _0x46f34d['update'](_0x5f8929);});}else{return logger['error'](_0x89e3('0x2c'),_0x89e3('0x2d'),'intelepeer',util[_0x89e3('0x2e')](_0x538e63,{'showHidden':![],'depth':null}));}})[_0x89e3('0x1c')](function(_0x51a37f){return logger['error'](_0x89e3('0x2c'),_0x89e3('0x2d'),'intelepeer',util['inspect'](_0x51a37f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x89e3('0x2c'),_0x89e3('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x89e3('0x7c')](function(){_0x4dbfbb();});}else{_0x4dbfbb();}}},'charset':_0x89e3('0x7d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc790=['split','sms','user_key','session_key','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','plivo','authId','remote','/api/sms/messages/','format','%s:%s','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','csc','crypto','apiKey','login','text','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','finally','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteractionId','SmsInteraction','then','createdAt','catch','error','out','SmsAccount','find','type','twilio','authToken','phone','accountSid','messages','body','/status?token=','token','sid','update','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password='];(function(_0x72cbb3,_0x5d8fa4){var _0x26e47d=function(_0x4bc7b5){while(--_0x4bc7b5){_0x72cbb3['push'](_0x72cbb3['shift']());}};_0x26e47d(++_0x5d8fa4);}(_0xc790,0xc8));var _0x0c79=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc790[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0c79('0x0'));var util=require(_0x0c79('0x1'));var logger=require(_0x0c79('0x2'))(_0x0c79('0x3'));var moment=require(_0x0c79('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c79('0x5'));var rimraf=require(_0x0c79('0x6'));var config=require(_0x0c79('0x7'));var attributes=require(_0x0c79('0x8'));module['exports']=function(_0x51e4cb,_0x24ec8c){return _0x51e4cb[_0x0c79('0x9')]('SmsMessage',attributes,{'tableName':_0x0c79('0xa'),'paranoid':![],'indexes':[{'name':_0x0c79('0xb'),'fields':[_0x0c79('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x0c79('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20f123,_0x1f2a6f,_0x12aab9){var _0x3d6dba=_0x51e4cb[_0x0c79('0xd')];var _0x13d152=_0x20f123[_0x0c79('0xe')]({'plain':!![]});if(_0x13d152[_0x0c79('0xf')][_0x0c79('0x10')]()==='in'||_0x13d152[_0x0c79('0xf')]['toLowerCase']()==='out'&&!_0x13d152[_0x0c79('0x11')]&&!_['isNil'](_0x13d152['UserId'])&&!_[_0x0c79('0x12')](_0x13d152[_0x0c79('0x13')])){_0x3d6dba[_0x0c79('0x14')]['findOne']({'where':{'id':_0x13d152[_0x0c79('0x13')]}})[_0x0c79('0x15')](function(_0x1151f5){if(_0x1151f5){_0x1151f5['update']({'lastMsgAt':_0x13d152[_0x0c79('0x16')],'lastMsgDirection':_0x13d152['direction']['toLowerCase']()});}})[_0x0c79('0x17')](function(_0x255927){console[_0x0c79('0x18')](_0x255927);});}if(_0x13d152[_0x0c79('0xf')]===_0x0c79('0x19')&&!_0x13d152['secret']){var _0x282e9c;_0x3d6dba[_0x0c79('0x1a')][_0x0c79('0x1b')]({'where':{'id':_0x13d152['SmsAccountId']},'raw':!![]})[_0x0c79('0x15')](function(_0x3804cd){_0x282e9c=_0x3804cd;if(_0x282e9c&&_0x282e9c[_0x0c79('0x1c')]){switch(_0x282e9c[_0x0c79('0x1c')]){case _0x0c79('0x1d'):var _0x3d7499=require(_0x0c79('0x1d'));if(_0x282e9c['accountSid']&&_0x282e9c[_0x0c79('0x1e')]&&_0x282e9c[_0x0c79('0x1f')]){var _0x27e877=new _0x3d7499(_0x282e9c[_0x0c79('0x20')],_0x282e9c['authToken']);_0x27e877[_0x0c79('0x21')]['create']({'body':_0x13d152[_0x0c79('0x22')],'to':_0x13d152['phone'],'from':_0x282e9c[_0x0c79('0x1f')],'statusCallback':_0x282e9c['remote']+'/api/sms/messages/'+_0x13d152['id']+_0x0c79('0x23')+_0x282e9c[_0x0c79('0x24')]})[_0x0c79('0x15')](function(_0x245457){if(_0x245457[_0x0c79('0x25')]){return _0x20f123[_0x0c79('0x26')]({'messageId':_0x245457[_0x0c79('0x25')]});}})[_0x0c79('0x17')](function(_0x3f1d41){logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c79('0x27'),'twilio',util['inspect'](_0x3f1d41,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),'twilio',_0x0c79('0x29'));}break;case _0x0c79('0x2a'):var _0x17084d=_0x0c79('0x2b');if(_0x282e9c['username']&&_0x282e9c[_0x0c79('0x2c')]){var _0x46fc4b={'recipient':[_0x13d152[_0x0c79('0x1f')]],'message':_0x13d152[_0x0c79('0x22')],'message_type':_0x282e9c[_0x0c79('0x2d')]};if(_0x282e9c[_0x0c79('0x2d')]&&_0x282e9c[_0x0c79('0x2d')]!=='SI'){_0x46fc4b[_0x0c79('0x2e')]=_0x282e9c[_0x0c79('0x1f')];}var _0x5d4855={'url':_0x17084d+_0x0c79('0x2f')+_0x282e9c[_0x0c79('0x30')]+_0x0c79('0x31')+_0x282e9c['password'],'method':'GET'};rp(_0x5d4855)[_0x0c79('0x15')](function(_0x124412){var _0x4e4042=_0x124412[_0x0c79('0x32')](';');var _0x10b3ec={'user_key':_0x4e4042[0x0],'session_key':_0x4e4042[0x1]};_0x5d4855={'url':_0x17084d+_0x0c79('0x33'),'method':'POST','headers':{'user_key':_0x10b3ec[_0x0c79('0x34')],'Session_key':_0x10b3ec[_0x0c79('0x35')]},'json':!![],'body':_0x46fc4b};return rp(_0x5d4855);})[_0x0c79('0x15')](function(_0x2cb5a1){if(_0x2cb5a1['total_sent']>=0x1){var _0x563dcf={'messageId':_0x2cb5a1[_0x0c79('0x36')]};if(_0x282e9c['smsMethod']!=='GP'||!_0x282e9c[_0x0c79('0x37')]){_0x563dcf[_0x0c79('0x38')]=!![];}return _0x20f123[_0x0c79('0x26')](_0x563dcf);}else{return logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c79('0x27'),'skebby',util[_0x0c79('0x39')](_0x2cb5a1,{'showHidden':![],'depth':null}));}})[_0x0c79('0x17')](function(_0x40a46c){return logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c79('0x27'),_0x0c79('0x2a'),util[_0x0c79('0x39')](_0x40a46c,{'showHidden':![],'depth':null}));});}else{logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c79('0x2a'),_0x0c79('0x3a'));}break;case'connectel':if(_0x282e9c['authToken']){var _0x12d61e={'recipient':_0x13d152['phone'],'message':_0x13d152[_0x0c79('0x22')],'sender':_0x282e9c[_0x0c79('0x3b')]||_0x282e9c[_0x0c79('0x1f')],'authorization':_0x282e9c[_0x0c79('0x1e')]};var _0x1f2a6f={'method':'POST','uri':_0x0c79('0x3c'),'body':_0x12d61e,'json':!![]};rp(_0x1f2a6f)[_0x0c79('0x15')](function(_0x2265a1){var _0xf94960={'messageId':_0x2265a1[_0x0c79('0x3d')]};if(!_0x282e9c['deliveryReport']){_0xf94960[_0x0c79('0x38')]=!![];}return _0x20f123[_0x0c79('0x26')](_0xf94960);})[_0x0c79('0x17')](function(_0x3a7ce4){logger['error'](_0x0c79('0x28'),'afterCreate',_0x0c79('0x3e'),util[_0x0c79('0x39')](_0x3a7ce4,{'showHidden':![],'depth':null}));});}else{logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),'connectel',_0x0c79('0x3f'));}break;case _0x0c79('0x40'):if(_0x282e9c[_0x0c79('0x30')]&&_0x282e9c[_0x0c79('0x2c')]){var _0x12d61e={'messages':[{'source':_0x0c79('0x41'),'to':_0x13d152[_0x0c79('0x1f')],'body':_0x13d152['body'],'from':_0x282e9c[_0x0c79('0x3b')]||_0x282e9c[_0x0c79('0x1f')]}]};var _0x120e05=util['format']('%s:%s',_0x282e9c[_0x0c79('0x30')],_0x282e9c[_0x0c79('0x2c')]);var _0x1f2a6f={'method':_0x0c79('0x42'),'uri':_0x0c79('0x43'),'body':_0x12d61e,'headers':{'Authorization':util['format'](_0x0c79('0x44'),new Buffer(_0x120e05)[_0x0c79('0x45')]('base64'))},'json':!![]};rp(_0x1f2a6f)['then'](function(_0x2a580a){if(_0x2a580a[_0x0c79('0x46')]>=0xc8&&_0x2a580a[_0x0c79('0x46')]<=0xce){if(_0x2a580a[_0x0c79('0x47')]&&_0x2a580a[_0x0c79('0x47')][_0x0c79('0x48')]>0x0){var _0x31a1f8=_[_0x0c79('0x49')](_0x2a580a[_0x0c79('0x47')]['messages']);var _0x42445e={'messageId':_0x31a1f8['message_id']};if(!_0x282e9c[_0x0c79('0x37')]){_0x42445e['read']=!![];}return _0x20f123[_0x0c79('0x26')](_0x42445e);}else{logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x4a'),util[_0x0c79('0x39')](_0x2a580a,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c79('0x27'),_0x0c79('0x4a'),util['inspect'](_0x2a580a,{'showHidden':![],'depth':null}));}})[_0x0c79('0x17')](function(_0x4c6470){logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x4a'),util[_0x0c79('0x39')](_0x4c6470,{'showHidden':![],'depth':null}));});}else{logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c79('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0c79('0x4b'):if(_0x282e9c[_0x0c79('0x4c')]&&_0x282e9c[_0x0c79('0x1e')]){var _0x12d61e={'dst':_0x13d152[_0x0c79('0x1f')],'text':_0x13d152['body'],'src':_0x282e9c[_0x0c79('0x3b')]||_0x282e9c['phone'],'url':_0x282e9c[_0x0c79('0x4d')]+_0x0c79('0x4e')+_0x13d152['id']+_0x0c79('0x23')+_0x282e9c['token']};var _0x120e05=util[_0x0c79('0x4f')](_0x0c79('0x50'),_0x282e9c[_0x0c79('0x4c')],_0x282e9c[_0x0c79('0x1e')]);var _0x1f2a6f={'method':_0x0c79('0x42'),'uri':util[_0x0c79('0x4f')](_0x0c79('0x51'),_0x282e9c[_0x0c79('0x4c')]),'body':_0x12d61e,'headers':{'Authorization':util[_0x0c79('0x4f')]('Basic\x20%s',new Buffer(_0x120e05)[_0x0c79('0x45')]('base64'))},'json':!![]};rp(_0x1f2a6f)[_0x0c79('0x15')](function(_0x6ebd0d){var _0x3bd9d9={'messageId':_0x6ebd0d[_0x0c79('0x52')][0x0]};return _0x20f123[_0x0c79('0x26')](_0x3bd9d9);})[_0x0c79('0x17')](function(_0x12b425){logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),'plivo',util['inspect'](_0x12b425,{'showHidden':![],'depth':null}));});}else{logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x4b'),_0x0c79('0x53'));}break;case _0x0c79('0x54'):if(_0x282e9c['username']&&_0x282e9c[_0x0c79('0x2c')]){if(_0x282e9c[_0x0c79('0x55')]){var _0x24ffe5={'method':_0x0c79('0x42'),'uri':_0x282e9c[_0x0c79('0x55')]+_0x0c79('0x56'),'body':{'username':_0x282e9c[_0x0c79('0x30')],'password':_0x282e9c[_0x0c79('0x2c')]},'json':!![]};return rp(_0x24ffe5)[_0x0c79('0x15')](function(_0x92217a){var _0x37c0d6={'method':_0x0c79('0x42'),'uri':_0x282e9c[_0x0c79('0x55')]+_0x0c79('0x57'),'body':{'messages':[{'from':_0x282e9c['phone'],'destinations':[{'to':_0x13d152[_0x0c79('0x1f')]}],'text':_0x13d152[_0x0c79('0x22')],'notifyUrl':_0x282e9c['remote']+'/api/sms/messages/'+_0x13d152['id']+_0x0c79('0x23')+_0x282e9c[_0x0c79('0x24')],'notifyContentType':_0x0c79('0x58'),'callbackData':_0x282e9c[_0x0c79('0x1f')]+';'+_0x13d152[_0x0c79('0x22')]}]},'headers':{'Authorization':_0x0c79('0x59')+_0x92217a['token']},'json':!![]};return rp(_0x37c0d6)[_0x0c79('0x15')](function(_0x4c2a47){if(_0x4c2a47[_0x0c79('0x21')]){var _0x43bf59={'messageId':_0x4c2a47['messages'][0x0][_0x0c79('0xb')]};if(!_0x282e9c[_0x0c79('0x37')]){_0x43bf59[_0x0c79('0x38')]=!![];}return _0x20f123[_0x0c79('0x26')](_0x43bf59);}else{return logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x54'),util[_0x0c79('0x39')](_0x4c2a47,{'showHidden':![],'depth':null}));}});})[_0x0c79('0x17')](function(_0x42b1a8){return logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c79('0x54'),util[_0x0c79('0x39')](_0x42b1a8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x54'),_0x0c79('0x5a'));}}else{logger[_0x0c79('0x18')](_0x0c79('0x28'),'afterCreate',_0x0c79('0x54'),_0x0c79('0x3a'));}break;case _0x0c79('0x5b'):var _0x2ee225=require(_0x0c79('0x5c'));if(_0x282e9c[_0x0c79('0x5d')]){var _0x11b135={};_0x11b135[_0x0c79('0x5e')]=_0x282e9c[_0x0c79('0x30')];_0x11b135[_0x0c79('0x1f')]=_0x13d152['phone'];_0x11b135[_0x0c79('0x2e')]=_0x282e9c[_0x0c79('0x1f')];_0x11b135[_0x0c79('0x5f')]=_0x13d152['body'];_0x11b135['timestamp']=+new Date();var _0x4edf3d='';var _0x2597a5='';var _0x31a249=Object['keys'](_0x11b135);_0x31a249[_0x0c79('0x60')]();for(var _0x47c46f=0x0;_0x47c46f<_0x31a249[_0x0c79('0x61')];_0x47c46f++){if(_0x4edf3d!=''){_0x4edf3d+='&';}_0x4edf3d+=_0x31a249[_0x47c46f]+'='+encodeURIComponent(_0x11b135[_0x31a249[_0x47c46f]]);_0x2597a5+=_0x11b135[_0x31a249[_0x47c46f]];}_0x2597a5+=_0x282e9c[_0x0c79('0x5d')];_0x2597a5=_0x2ee225[_0x0c79('0x62')](_0x0c79('0x63'))[_0x0c79('0x26')](_0x2597a5)[_0x0c79('0x64')](_0x0c79('0x65'));if(_0x4edf3d!==''){_0x4edf3d+='&';}_0x4edf3d+=_0x0c79('0x66')+_0x2597a5;var _0x5d4855={'method':_0x0c79('0x67'),'uri':_0x282e9c['baseUrl']+_0x0c79('0x68')+_0x4edf3d,'json':!![]};return rp(_0x5d4855)['then'](function(_0x228f79){var _0x24859e=Object['keys'](_0x228f79);if(_0x228f79[_0x24859e[0x0]][_0x0c79('0x18')]&&parseInt(_0x228f79[_0x24859e[0x0]]['error'])===0x0){var _0x531595={'messageId':_0x228f79[_0x24859e[0x0]][_0x0c79('0x69')]};if(!_0x282e9c[_0x0c79('0x37')]){_0x531595[_0x0c79('0x38')]=!![];}return _0x20f123[_0x0c79('0x26')](_0x531595);}else{return logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x5b'),util[_0x0c79('0x39')](_0x228f79[_0x0c79('0x18')],{'showHidden':![],'depth':null}));}})[_0x0c79('0x17')](function(_0x228aed){return logger['error'](_0x0c79('0x28'),'afterCreate',_0x0c79('0x5b'),util['inspect'](_0x228aed,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),'csc',_0x0c79('0x6a'));}break;case _0x0c79('0x6b'):if(_0x282e9c[_0x0c79('0x5d')]){var _0x4a4896={'method':_0x0c79('0x42'),'uri':_0x0c79('0x6c'),'headers':{'Authorization':_0x282e9c[_0x0c79('0x5d')]},'body':{'content':_0x13d152[_0x0c79('0x22')],'to':[_0x13d152[_0x0c79('0x1f')]],'from':_0x282e9c['phone'],'binary':![],'clientMessageId':_0x0c79('0x6d'),'charset':_0x0c79('0x6e')},'json':!![]};rp(_0x4a4896)[_0x0c79('0x15')](function(_0x372b7f){if(!_0x372b7f[_0x0c79('0x18')]){var _0x1cc111={'messageId':_0x372b7f['messages'][0x0][_0x0c79('0x6f')]};if(!_0x282e9c['deliveryReport']){_0x1cc111['read']=!![];}return _0x20f123['update'](_0x1cc111);}else{return logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x6b'),util[_0x0c79('0x39')](_0x372b7f['error'],{'showHidden':![],'depth':null}));}})[_0x0c79('0x17')](function(_0xedfb56){return logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x6b'),util[_0x0c79('0x39')](_0xedfb56,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),'clickatell',_0x0c79('0x6a'));}break;case'bandwidth':if(_0x282e9c[_0x0c79('0x30')]&&_0x282e9c['password']){var _0x120e05=util[_0x0c79('0x4f')](_0x0c79('0x50'),_0x282e9c['username'],_0x282e9c[_0x0c79('0x2c')]);var _0x1f2a6f={'method':_0x0c79('0x42'),'uri':_0x0c79('0x70')+_0x282e9c['accountId']+_0x0c79('0x71'),'body':{'to':[_0x13d152[_0x0c79('0x1f')]],'text':_0x13d152[_0x0c79('0x22')],'from':_0x282e9c[_0x0c79('0x1f')],'applicationId':_0x282e9c[_0x0c79('0x72')]},'headers':{'Authorization':util[_0x0c79('0x4f')](_0x0c79('0x44'),new Buffer(_0x120e05)[_0x0c79('0x45')]('base64'))},'json':!![]};rp(_0x1f2a6f)[_0x0c79('0x15')](function(_0x580f14){if(_0x580f14['id']){var _0x3815dd={'messageId':_0x580f14['id']};return _0x20f123[_0x0c79('0x26')](_0x3815dd);}else{logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c79('0x73'),util[_0x0c79('0x39')](_0x580f14,{'showHidden':![],'depth':null}));}})[_0x0c79('0x17')](function(_0x2df13e){logger[_0x0c79('0x18')](_0x0c79('0x28'),_0x0c79('0x27'),_0x0c79('0x73'),util[_0x0c79('0x39')](_0x2df13e,{'showHidden':![],'depth':null}));});}else{logger[_0x0c79('0x18')](_0x0c79('0x28'),'afterCreate',_0x0c79('0x73'),_0x0c79('0x3a'));}break;case'intelepeer':if(_0x282e9c[_0x0c79('0x5d')]){var _0x2cdf8a={};var _0x5d4855={'method':_0x0c79('0x42'),'uri':_0x0c79('0x74'),'headers':{'Authorization':_0x0c79('0x75')+_0x282e9c[_0x0c79('0x5d')],'Content-Type':_0x0c79('0x58')},'body':{'from':_0x282e9c[_0x0c79('0x1f')],'to':_0x13d152[_0x0c79('0x1f')],'text':_0x13d152['body']},'json':!![]};return rp(_0x5d4855)[_0x0c79('0x15')](function(_0x51e5fc){if(_0x51e5fc[_0x0c79('0x76')]==0xca){_0x2cdf8a[_0x0c79('0x77')]=_0x51e5fc;var _0x6accc3={'method':_0x0c79('0x42'),'uri':_0x0c79('0x78'),'headers':{'Authorization':_0x0c79('0x75')+_0x282e9c[_0x0c79('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x2cdf8a[_0x0c79('0x77')]['refid']},'json':!![]};return rp(_0x6accc3)[_0x0c79('0x15')](function(_0x368140){_0x2cdf8a['status']=_0x368140;var _0x4356de={'messageId':_0x2cdf8a['message'][_0x0c79('0x79')],'read':!![]};return _0x20f123['update'](_0x4356de);});}else{return logger[_0x0c79('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c79('0x7a'),util['inspect'](_0x51e5fc,{'showHidden':![],'depth':null}));}})[_0x0c79('0x17')](function(_0x31bb23){return logger['error'](_0x0c79('0x28'),_0x0c79('0x27'),'intelepeer',util['inspect'](_0x31bb23,{'showHidden':![],'depth':null}));});}else{return logger[_0x0c79('0x18')](_0x0c79('0x28'),'afterCreate',_0x0c79('0x7a'),'Token\x20not\x20received');}break;}}})[_0x0c79('0x7b')](function(){_0x12aab9();});}else{_0x12aab9();}}},'charset':_0x0c79('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 04e95f3..8f2a7e2 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 _0xafb3=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsMessage.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','create','body','options'];(function(_0xe32485,_0x30b4cd){var _0x2e332d=function(_0x5439bc){while(--_0x5439bc){_0xe32485['push'](_0xe32485['shift']());}};_0x2e332d(++_0x30b4cd);}(_0xafb3,0x78));var _0x3afb=function(_0x4c227b,_0x30fa4e){_0x4c227b=_0x4c227b-0x0;var _0x3c3539=_0xafb3[_0x4c227b];return _0x3c3539;};'use strict';var _=require(_0x3afb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3afb('0x1'));var rs=require(_0x3afb('0x2'));var fs=require('fs');var Redis=require(_0x3afb('0x3'));var db=require(_0x3afb('0x4'))['db'];var utils=require(_0x3afb('0x5'));var logger=require('../../config/logger')(_0x3afb('0x6'));var config=require(_0x3afb('0x7'));var jayson=require(_0x3afb('0x8'));var client=jayson['client'][_0x3afb('0x9')]({'port':0x232a});config[_0x3afb('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3afb('0xb'))(new Redis(config[_0x3afb('0xa')]));require(_0x3afb('0xc'))[_0x3afb('0xd')](socket);function respondWithRpcPromise(_0xbad7d6,_0x4c090e,_0x4cb672){return new BPromise(function(_0x598a37,_0x5bdb3d){return client[_0x3afb('0xe')](_0xbad7d6,_0x4cb672)[_0x3afb('0xf')](function(_0x3707b5){logger[_0x3afb('0x10')]('SmsMessage,\x20%s,\x20%s',_0x4c090e,'request\x20sent');logger[_0x3afb('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4c090e,_0x3afb('0x12'),JSON[_0x3afb('0x13')](_0x3707b5));if(_0x3707b5[_0x3afb('0x14')]){if(_0x3707b5[_0x3afb('0x14')][_0x3afb('0x15')]===0x1f4){logger[_0x3afb('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4c090e,_0x3707b5[_0x3afb('0x14')][_0x3afb('0x16')]);return _0x5bdb3d(_0x3707b5['error'][_0x3afb('0x16')]);}logger[_0x3afb('0x14')](_0x3afb('0x17'),_0x4c090e,_0x3707b5['error']['message']);return _0x598a37(_0x3707b5[_0x3afb('0x14')][_0x3afb('0x16')]);}else{logger[_0x3afb('0x10')](_0x3afb('0x17'),_0x4c090e,_0x3afb('0x12'));_0x598a37(_0x3707b5[_0x3afb('0x18')][_0x3afb('0x16')]);}})[_0x3afb('0x19')](function(_0x171408){logger[_0x3afb('0x14')](_0x3afb('0x17'),_0x4c090e,_0x171408);_0x5bdb3d(_0x171408);});});}exports[_0x3afb('0x1a')]=function(_0xe707d1){var _0x85e989=this;return new Promise(function(_0x5620af,_0x179e98){return db['SmsMessage'][_0x3afb('0x1b')](_0xe707d1[_0x3afb('0x1c')],{'raw':_0xe707d1[_0x3afb('0x1d')]?_0xe707d1[_0x3afb('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1f0eac){logger[_0x3afb('0x10')](_0x3afb('0x1a'),_0xe707d1);logger[_0x3afb('0x11')](_0x3afb('0x1a'),_0xe707d1,JSON['stringify'](_0x1f0eac));_0x5620af(_0x1f0eac);})[_0x3afb('0x19')](function(_0x3b78a2){logger[_0x3afb('0x14')](_0x3afb('0x1a'),_0x3b78a2[_0x3afb('0x16')],_0xe707d1);_0x179e98(_0x85e989['error'](0x1f4,_0x3b78a2[_0x3afb('0x16')]));});});}; \ No newline at end of file +var _0x80d6=['redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsMessage','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x31d3f6,_0x2b75b3){var _0x2fff65=function(_0x5b94c1){while(--_0x5b94c1){_0x31d3f6['push'](_0x31d3f6['shift']());}};_0x2fff65(++_0x2b75b3);}(_0x80d6,0x150));var _0x680d=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x80d6[_0x2dc7c9];return _0x3e6536;};'use strict';var _=require(_0x680d('0x0'));var util=require(_0x680d('0x1'));var moment=require(_0x680d('0x2'));var BPromise=require(_0x680d('0x3'));var rs=require(_0x680d('0x4'));var fs=require('fs');var Redis=require(_0x680d('0x5'));var db=require(_0x680d('0x6'))['db'];var utils=require(_0x680d('0x7'));var logger=require(_0x680d('0x8'))('rpc');var config=require(_0x680d('0x9'));var jayson=require(_0x680d('0xa'));var client=jayson[_0x680d('0xb')][_0x680d('0xc')]({'port':0x232a});config['redis']=_[_0x680d('0xd')](config[_0x680d('0xe')],{'host':_0x680d('0xf'),'port':0x18eb});var socket=require(_0x680d('0x10'))(new Redis(config[_0x680d('0xe')]));require(_0x680d('0x11'))[_0x680d('0x12')](socket);function respondWithRpcPromise(_0x54fd9a,_0xd485fa,_0x15e1d4){return new BPromise(function(_0x3e8a34,_0x22c6ea){return client[_0x680d('0x13')](_0x54fd9a,_0x15e1d4)[_0x680d('0x14')](function(_0x1c5a41){logger[_0x680d('0x15')](_0x680d('0x16'),_0xd485fa,_0x680d('0x17'));logger[_0x680d('0x18')](_0x680d('0x19'),_0xd485fa,_0x680d('0x17'),JSON[_0x680d('0x1a')](_0x1c5a41));if(_0x1c5a41['error']){if(_0x1c5a41[_0x680d('0x1b')][_0x680d('0x1c')]===0x1f4){logger[_0x680d('0x1b')](_0x680d('0x16'),_0xd485fa,_0x1c5a41[_0x680d('0x1b')][_0x680d('0x1d')]);return _0x22c6ea(_0x1c5a41[_0x680d('0x1b')][_0x680d('0x1d')]);}logger[_0x680d('0x1b')]('SmsMessage,\x20%s,\x20%s',_0xd485fa,_0x1c5a41[_0x680d('0x1b')][_0x680d('0x1d')]);return _0x3e8a34(_0x1c5a41[_0x680d('0x1b')][_0x680d('0x1d')]);}else{logger['info'](_0x680d('0x16'),_0xd485fa,_0x680d('0x17'));_0x3e8a34(_0x1c5a41['result'][_0x680d('0x1d')]);}})['catch'](function(_0x18da03){logger[_0x680d('0x1b')](_0x680d('0x16'),_0xd485fa,_0x18da03);_0x22c6ea(_0x18da03);});});}exports[_0x680d('0x1e')]=function(_0x2b050e){var _0x19361d=this;return new Promise(function(_0x43b311,_0x50380f){return db['SmsMessage']['create'](_0x2b050e[_0x680d('0x1f')],{'raw':_0x2b050e[_0x680d('0x20')]?_0x2b050e[_0x680d('0x20')][_0x680d('0x21')]===undefined?!![]:![]:!![]})[_0x680d('0x14')](function(_0x5d28a7){logger[_0x680d('0x15')]('CreateSmsMessage',_0x2b050e);logger[_0x680d('0x18')](_0x680d('0x1e'),_0x2b050e,JSON[_0x680d('0x1a')](_0x5d28a7));_0x43b311(_0x5d28a7);})[_0x680d('0x22')](function(_0x4e1217){logger[_0x680d('0x1b')]('CreateSmsMessage',_0x4e1217[_0x680d('0x1d')],_0x2b050e);_0x50380f(_0x19361d['error'](0x1f4,_0x4e1217[_0x680d('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d6347a1..77d5954 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 _0x6aad=['./smsMessage.events','save','update','emit','removeListener','register','length','smsMessage:'];(function(_0xe83feb,_0x310b88){var _0x451e09=function(_0xf70f5a){while(--_0xf70f5a){_0xe83feb['push'](_0xe83feb['shift']());}};_0x451e09(++_0x310b88);}(_0x6aad,0x130));var _0xd6aa=function(_0xb29383,_0x22be8d){_0xb29383=_0xb29383-0x0;var _0x22945c=_0x6aad[_0xb29383];return _0x22945c;};'use strict';var SmsMessageEvents=require(_0xd6aa('0x0'));var events=[_0xd6aa('0x1'),'remove',_0xd6aa('0x2')];function createListener(_0x49e3e3,_0x2366ff){return function(_0x5eff11){_0x2366ff[_0xd6aa('0x3')](_0x49e3e3,_0x5eff11);};}function removeListener(_0x2bad56,_0x161e61){return function(){SmsMessageEvents[_0xd6aa('0x4')](_0x2bad56,_0x161e61);};}exports[_0xd6aa('0x5')]=function(_0x39a1fc){for(var _0x391c7d=0x0,_0x488063=events[_0xd6aa('0x6')];_0x391c7d<_0x488063;_0x391c7d++){var _0x3b192b=events[_0x391c7d];var _0x509ef3=createListener(_0xd6aa('0x7')+_0x3b192b,_0x39a1fc);SmsMessageEvents['on'](_0x3b192b,_0x509ef3);}}; \ No newline at end of file +var _0x25d6=['remove','update','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25d6,0x6e));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x625d('0x0'));var events=[_0x625d('0x1'),_0x625d('0x2'),_0x625d('0x3')];function createListener(_0x2336a2,_0x15e0c5){return function(_0x4476a8){_0x15e0c5['emit'](_0x2336a2,_0x4476a8);};}function removeListener(_0x4ac6f2,_0x56d9fb){return function(){SmsMessageEvents['removeListener'](_0x4ac6f2,_0x56d9fb);};}exports[_0x625d('0x4')]=function(_0x2cb093){for(var _0x68e7d8=0x0,_0x3b6784=events[_0x625d('0x5')];_0x68e7d8<_0x3b6784;_0x68e7d8++){var _0x88c34f=events[_0x68e7d8];var _0x435bff=createListener(_0x625d('0x6')+_0x88c34f,_0x2cb093);SmsMessageEvents['on'](_0x88c34f,_0x435bff);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ff0491e..e0d8210 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 _0xd43e=['put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/users','post','create','/:id/teams','addTeams'];(function(_0x496ecc,_0x3a2c55){var _0x3e141d=function(_0x59b066){while(--_0x59b066){_0x496ecc['push'](_0x496ecc['shift']());}};_0x3e141d(++_0x3a2c55);}(_0xd43e,0x1b9));var _0xed43=function(_0x1c38a1,_0x2568d8){_0x1c38a1=_0x1c38a1-0x0;var _0x3a0f33=_0xd43e[_0x1c38a1];return _0x3a0f33;};'use strict';var multer=require(_0xed43('0x0'));var util=require(_0xed43('0x1'));var path=require(_0xed43('0x2'));var timeout=require(_0xed43('0x3'));var express=require(_0xed43('0x4'));var router=express[_0xed43('0x5')]();var fs_extra=require(_0xed43('0x6'));var auth=require(_0xed43('0x7'));var interaction=require(_0xed43('0x8'));var config=require(_0xed43('0x9'));var controller=require(_0xed43('0xa'));router['get']('/',auth[_0xed43('0xb')](),controller[_0xed43('0xc')]);router[_0xed43('0xd')](_0xed43('0xe'),auth[_0xed43('0xb')](),controller[_0xed43('0xf')]);router[_0xed43('0xd')](_0xed43('0x10'),auth[_0xed43('0xb')](),controller[_0xed43('0x11')]);router[_0xed43('0xd')](_0xed43('0x12'),auth[_0xed43('0xb')](),controller['getMembers']);router[_0xed43('0xd')]('/:id/teams',auth[_0xed43('0xb')](),controller['getTeams']);router['get'](_0xed43('0x13'),auth[_0xed43('0xb')](),controller['getAgents']);router[_0xed43('0x14')]('/',auth['isAuthenticated'](),controller[_0xed43('0x15')]);router['post'](_0xed43('0x16'),auth['isAuthenticated'](),controller[_0xed43('0x17')]);router['post'](_0xed43('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xed43('0x18')](_0xed43('0x10'),auth[_0xed43('0xb')](),controller[_0xed43('0x19')]);router[_0xed43('0x1a')](_0xed43('0x10'),auth[_0xed43('0xb')](),controller[_0xed43('0x1b')]);router[_0xed43('0x1a')](_0xed43('0x16'),auth[_0xed43('0xb')](),controller[_0xed43('0x1c')]);router[_0xed43('0x1a')](_0xed43('0x13'),auth[_0xed43('0xb')](),controller[_0xed43('0x1d')]);module[_0xed43('0x1e')]=router; \ No newline at end of file +var _0xf0aa=['addAgents','put','update','destroy','delete','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x42c747,_0x45e3e0){var _0x4ab37b=function(_0x270801){while(--_0x270801){_0x42c747['push'](_0x42c747['shift']());}};_0x4ab37b(++_0x45e3e0);}(_0xf0aa,0x16e));var _0xaf0a=function(_0x312d3a,_0x53f060){_0x312d3a=_0x312d3a-0x0;var _0x63446=_0xf0aa[_0x312d3a];return _0x63446;};'use strict';var multer=require(_0xaf0a('0x0'));var util=require('util');var path=require(_0xaf0a('0x1'));var timeout=require(_0xaf0a('0x2'));var express=require(_0xaf0a('0x3'));var router=express[_0xaf0a('0x4')]();var fs_extra=require(_0xaf0a('0x5'));var auth=require(_0xaf0a('0x6'));var interaction=require(_0xaf0a('0x7'));var config=require(_0xaf0a('0x8'));var controller=require(_0xaf0a('0x9'));router[_0xaf0a('0xa')]('/',auth['isAuthenticated'](),controller[_0xaf0a('0xb')]);router[_0xaf0a('0xa')](_0xaf0a('0xc'),auth[_0xaf0a('0xd')](),controller[_0xaf0a('0xe')]);router[_0xaf0a('0xa')](_0xaf0a('0xf'),auth[_0xaf0a('0xd')](),controller['show']);router[_0xaf0a('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xaf0a('0x10')]);router[_0xaf0a('0xa')](_0xaf0a('0x11'),auth[_0xaf0a('0xd')](),controller[_0xaf0a('0x12')]);router[_0xaf0a('0xa')](_0xaf0a('0x13'),auth['isAuthenticated'](),controller[_0xaf0a('0x14')]);router[_0xaf0a('0x15')]('/',auth[_0xaf0a('0xd')](),controller[_0xaf0a('0x16')]);router[_0xaf0a('0x15')]('/:id/teams',auth[_0xaf0a('0xd')](),controller[_0xaf0a('0x17')]);router[_0xaf0a('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xaf0a('0x18')]);router[_0xaf0a('0x19')](_0xaf0a('0xf'),auth[_0xaf0a('0xd')](),controller[_0xaf0a('0x1a')]);router['delete'](_0xaf0a('0xf'),auth['isAuthenticated'](),controller[_0xaf0a('0x1b')]);router[_0xaf0a('0x1c')](_0xaf0a('0x11'),auth[_0xaf0a('0xd')](),controller['removeTeams']);router[_0xaf0a('0x1c')](_0xaf0a('0x13'),auth[_0xaf0a('0xd')](),controller[_0xaf0a('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9e53143..9b7be0f 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 _0x907b=['rrmemory','beepall','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x57fc88,_0x5b7f1c){var _0x595dcc=function(_0x3ecb8a){while(--_0x3ecb8a){_0x57fc88['push'](_0x57fc88['shift']());}};_0x595dcc(++_0x5b7f1c);}(_0x907b,0x1da));var _0xb907=function(_0x45556d,_0x25e55d){_0x45556d=_0x45556d-0x0;var _0x6a3aa3=_0x907b[_0x45556d];return _0x6a3aa3;};'use strict';var Sequelize=require(_0xb907('0x0'));module[_0xb907('0x1')]={'name':{'type':Sequelize[_0xb907('0x2')],'unique':_0xb907('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb907('0x2')]},'timeout':{'type':Sequelize[_0xb907('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb907('0x5')](_0xb907('0x6'),_0xb907('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x2d39=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x3d0f1f,_0xcad3f0){var _0xd94d48=function(_0x43274d){while(--_0x43274d){_0x3d0f1f['push'](_0x3d0f1f['shift']());}};_0xd94d48(++_0xcad3f0);}(_0x2d39,0xf4));var _0x92d3=function(_0x5da973,_0x112386){_0x5da973=_0x5da973-0x0;var _0x190a39=_0x2d39[_0x5da973];return _0x190a39;};'use strict';var Sequelize=require(_0x92d3('0x0'));module[_0x92d3('0x1')]={'name':{'type':Sequelize[_0x92d3('0x2')],'unique':_0x92d3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92d3('0x2')]},'timeout':{'type':Sequelize[_0x92d3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x92d3('0x5'),_0x92d3('0x6'),_0x92d3('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0d77ca4..5910f02 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 _0x5a87=['../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','updatedAt','getTeams','findOne','Team','addTeams','ids','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Agents','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xec04c7,_0x4eca9c){var _0x352dcd=function(_0x729bd7){while(--_0x729bd7){_0xec04c7['push'](_0xec04c7['shift']());}};_0x352dcd(++_0x4eca9c);}(_0x5a87,0x194));var _0x75a8=function(_0x5a48ca,_0x2cf21d){_0x5a48ca=_0x5a48ca-0x0;var _0x2161c9=_0x5a87[_0x5a48ca];return _0x2161c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75a8('0x0'));var zipdir=require(_0x75a8('0x1'));var jsonpatch=require(_0x75a8('0x2'));var rp=require(_0x75a8('0x3'));var moment=require(_0x75a8('0x4'));var BPromise=require(_0x75a8('0x5'));var Mustache=require(_0x75a8('0x6'));var util=require(_0x75a8('0x7'));var path=require(_0x75a8('0x8'));var sox=require(_0x75a8('0x9'));var csv=require('to-csv');var ejs=require(_0x75a8('0xa'));var fs=require('fs');var fs_extra=require(_0x75a8('0xb'));var _=require('lodash');var squel=require(_0x75a8('0xc'));var crypto=require('crypto');var jsforce=require(_0x75a8('0xd'));var deskjs=require(_0x75a8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x75a8('0xf'));var Redis=require(_0x75a8('0x10'));var authService=require(_0x75a8('0x11'));var qs=require(_0x75a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75a8('0x13'));var logger=require(_0x75a8('0x14'))(_0x75a8('0x15'));var utils=require(_0x75a8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x75a8('0x17'));var db=require(_0x75a8('0x18'))['db'];config[_0x75a8('0x19')]=_['defaults'](config['redis'],{'host':_0x75a8('0x1a'),'port':0x18eb});var socket=require(_0x75a8('0x1b'))(new Redis(config[_0x75a8('0x19')]));require(_0x75a8('0x1c'))[_0x75a8('0x1d')](socket);function respondWithStatusCode(_0x5efdf2,_0x5165ee){_0x5165ee=_0x5165ee||0xcc;return function(_0x1ca53a){if(_0x1ca53a){return _0x5efdf2[_0x75a8('0x1e')](_0x5165ee);}return _0x5efdf2['status'](_0x5165ee)[_0x75a8('0x1f')]();};}function respondWithResult(_0x5f1a94,_0x44f9a5){_0x44f9a5=_0x44f9a5||0xc8;return function(_0xbc13cf){if(_0xbc13cf){return _0x5f1a94[_0x75a8('0x20')](_0x44f9a5)['json'](_0xbc13cf);}};}function respondWithFilteredResult(_0x36648f,_0x1781cd){return function(_0x5236ce){if(_0x5236ce){var _0x1e4b27=typeof _0x1781cd[_0x75a8('0x21')]===_0x75a8('0x22')&&typeof _0x1781cd[_0x75a8('0x23')]==='undefined';var _0x48d518=_0x5236ce[_0x75a8('0x24')];var _0x19d5d2=_0x1e4b27?0x0:_0x1781cd[_0x75a8('0x21')];var _0x4b11b7=_0x1e4b27?_0x5236ce[_0x75a8('0x24')]:_0x1781cd['offset']+_0x1781cd['limit'];var _0x476b1e;if(_0x4b11b7>=_0x48d518){_0x4b11b7=_0x48d518;_0x476b1e=0xc8;}else{_0x476b1e=0xce;}_0x36648f[_0x75a8('0x20')](_0x476b1e);return _0x36648f[_0x75a8('0x25')](_0x75a8('0x26'),_0x19d5d2+'-'+_0x4b11b7+'/'+_0x48d518)[_0x75a8('0x27')](_0x5236ce);}return null;};}function patchUpdates(_0x14a4f9){return function(_0x5ebe13){try{jsonpatch[_0x75a8('0x28')](_0x5ebe13,_0x14a4f9,!![]);}catch(_0x3f3375){return BPromise[_0x75a8('0x29')](_0x3f3375);}return _0x5ebe13['save']();};}function saveUpdates(_0x14bedf,_0x2c539a){return function(_0x5724fd){if(_0x5724fd){return _0x5724fd[_0x75a8('0x2a')](_0x14bedf)['then'](function(_0x28a4b1){return _0x28a4b1;});}return null;};}function removeEntity(_0x5d8287,_0x5ac1fd){return function(_0x4cac08){if(_0x4cac08){return _0x4cac08[_0x75a8('0x2b')]()[_0x75a8('0x2c')](function(){var _0x4290bf=_0x4cac08[_0x75a8('0x2d')]({'plain':!![]});var _0x10470b=_0x75a8('0x2e');return db[_0x75a8('0x2f')]['destroy']({'where':{'type':_0x10470b,'resourceId':_0x4290bf['id']}})['then'](function(){return _0x4cac08;});})[_0x75a8('0x2c')](function(){_0x5d8287[_0x75a8('0x20')](0xcc)[_0x75a8('0x1f')]();});}};}function handleEntityNotFound(_0x3bdaf3,_0xabd1eb){return function(_0x3c8c13){if(!_0x3c8c13){_0x3bdaf3['sendStatus'](0x194);}return _0x3c8c13;};}function handleError(_0x3051f9,_0x227bb2){_0x227bb2=_0x227bb2||0x1f4;return function(_0xeecd10){logger[_0x75a8('0x30')](_0xeecd10[_0x75a8('0x31')]);if(_0xeecd10[_0x75a8('0x32')]){delete _0xeecd10[_0x75a8('0x32')];}_0x3051f9['status'](_0x227bb2)[_0x75a8('0x33')](_0xeecd10);};}exports['index']=function(_0xb1cad,_0xfb5f5c){var _0x3b7098={},_0x20c533={},_0x21262e={'count':0x0,'rows':[]};var _0x4846ff=_[_0x75a8('0x34')](db[_0x75a8('0x35')][_0x75a8('0x36')],function(_0x930607){return{'name':_0x930607[_0x75a8('0x37')],'type':_0x930607[_0x75a8('0x38')][_0x75a8('0x39')]};});_0x20c533[_0x75a8('0x3a')]=_[_0x75a8('0x34')](_0x4846ff,'name');_0x20c533[_0x75a8('0x3b')]=_[_0x75a8('0x3c')](_0xb1cad[_0x75a8('0x3b')]);_0x20c533[_0x75a8('0x3d')]=_[_0x75a8('0x3e')](_0x20c533[_0x75a8('0x3a')],_0x20c533['query']);_0x3b7098['attributes']=_['intersection'](_0x20c533['model'],qs[_0x75a8('0x3f')](_0xb1cad[_0x75a8('0x3b')][_0x75a8('0x3f')]));_0x3b7098['attributes']=_0x3b7098[_0x75a8('0x40')][_0x75a8('0x41')]?_0x3b7098[_0x75a8('0x40')]:_0x20c533[_0x75a8('0x3a')];if(!_0xb1cad[_0x75a8('0x3b')][_0x75a8('0x42')](_0x75a8('0x43'))){_0x3b7098[_0x75a8('0x23')]=qs[_0x75a8('0x23')](_0xb1cad[_0x75a8('0x3b')]['limit']);_0x3b7098[_0x75a8('0x21')]=qs['offset'](_0xb1cad[_0x75a8('0x3b')][_0x75a8('0x21')]);}_0x3b7098[_0x75a8('0x44')]=qs['sort'](_0xb1cad[_0x75a8('0x3b')][_0x75a8('0x45')]);_0x3b7098['where']=qs[_0x75a8('0x3d')](_[_0x75a8('0x46')](_0xb1cad['query'],_0x20c533[_0x75a8('0x3d')]),_0x4846ff);if(_0xb1cad[_0x75a8('0x3b')][_0x75a8('0x47')]){_0x3b7098[_0x75a8('0x48')]=_[_0x75a8('0x49')](_0x3b7098[_0x75a8('0x48')],{'$or':_[_0x75a8('0x34')](_0x4846ff,function(_0xe5556a){if(_0xe5556a[_0x75a8('0x38')]!==_0x75a8('0x4a')){var _0x216924={};_0x216924[_0xe5556a[_0x75a8('0x32')]]={'$like':'%'+_0xb1cad['query'][_0x75a8('0x47')]+'%'};return _0x216924;}})});}_0x3b7098=_[_0x75a8('0x49')]({},_0x3b7098,_0xb1cad[_0x75a8('0x4b')]);var _0x57f02b={'where':_0x3b7098[_0x75a8('0x48')]};return db[_0x75a8('0x35')][_0x75a8('0x24')](_0x57f02b)[_0x75a8('0x2c')](function(_0x285954){_0x21262e[_0x75a8('0x24')]=_0x285954;if(_0xb1cad['query'][_0x75a8('0x4c')]){_0x3b7098[_0x75a8('0x4d')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x3b7098);})[_0x75a8('0x2c')](function(_0x3e299f){_0x21262e[_0x75a8('0x4e')]=_0x3e299f;return _0x21262e;})[_0x75a8('0x2c')](respondWithFilteredResult(_0xfb5f5c,_0x3b7098))['catch'](handleError(_0xfb5f5c,null));};exports[_0x75a8('0x4f')]=function(_0x32a857,_0x325f7e){var _0x597c6f={'raw':!![],'where':{'id':_0x32a857[_0x75a8('0x50')]['id']}},_0x19709d={};_0x19709d[_0x75a8('0x3a')]=_[_0x75a8('0x3c')](db[_0x75a8('0x35')][_0x75a8('0x36')]);_0x19709d[_0x75a8('0x3b')]=_[_0x75a8('0x3c')](_0x32a857[_0x75a8('0x3b')]);_0x19709d[_0x75a8('0x3d')]=_[_0x75a8('0x3e')](_0x19709d[_0x75a8('0x3a')],_0x19709d[_0x75a8('0x3b')]);_0x597c6f[_0x75a8('0x40')]=_['intersection'](_0x19709d['model'],qs[_0x75a8('0x3f')](_0x32a857[_0x75a8('0x3b')][_0x75a8('0x3f')]));_0x597c6f['attributes']=_0x597c6f[_0x75a8('0x40')]['length']?_0x597c6f[_0x75a8('0x40')]:_0x19709d[_0x75a8('0x3a')];if(_0x32a857[_0x75a8('0x3b')]['includeAll']){_0x597c6f[_0x75a8('0x4d')]=[{'all':!![]}];}_0x597c6f=_[_0x75a8('0x49')]({},_0x597c6f,_0x32a857[_0x75a8('0x4b')]);return db['SmsQueue']['find'](_0x597c6f)['then'](handleEntityNotFound(_0x325f7e,null))[_0x75a8('0x2c')](respondWithResult(_0x325f7e,null))['catch'](handleError(_0x325f7e,null));};exports['create']=function(_0x4a979f,_0x21fab9){return db[_0x75a8('0x35')][_0x75a8('0x51')](_0x4a979f[_0x75a8('0x52')],{})[_0x75a8('0x2c')](function(_0x2c03b2){var _0x58d1c5=_0x4a979f[_0x75a8('0x53')][_0x75a8('0x2d')]({'plain':!![]});if(!_0x58d1c5)throw new Error(_0x75a8('0x54'));if(_0x58d1c5[_0x75a8('0x55')]===_0x75a8('0x53')){var _0x961cce=_0x2c03b2[_0x75a8('0x2d')]({'plain':!![]});var _0x176612=_0x75a8('0x2e');return db[_0x75a8('0x56')][_0x75a8('0x57')]({'where':{'name':_0x176612,'userProfileId':_0x58d1c5['userProfileId']},'raw':!![]})[_0x75a8('0x2c')](function(_0x393b8c){if(_0x393b8c&&_0x393b8c[_0x75a8('0x58')]===0x0){return db['UserProfileResource'][_0x75a8('0x51')]({'name':_0x961cce['name'],'resourceId':_0x961cce['id'],'type':_0x393b8c[_0x75a8('0x32')],'sectionId':_0x393b8c['id']},{})[_0x75a8('0x2c')](function(){return _0x2c03b2;});}else{return _0x2c03b2;}})[_0x75a8('0x59')](function(_0x1c479a){logger[_0x75a8('0x30')](_0x75a8('0x5a'),_0x1c479a);throw _0x1c479a;});}return _0x2c03b2;})[_0x75a8('0x2c')](respondWithResult(_0x21fab9,0xc9))[_0x75a8('0x59')](handleError(_0x21fab9,null));};exports[_0x75a8('0x2a')]=function(_0x25f606,_0x566fdd){if(_0x25f606[_0x75a8('0x52')]['id']){delete _0x25f606['body']['id'];}return db['SmsQueue'][_0x75a8('0x57')]({'where':{'id':_0x25f606['params']['id']}})['then'](handleEntityNotFound(_0x566fdd,null))['then'](saveUpdates(_0x25f606[_0x75a8('0x52')],null))[_0x75a8('0x2c')](respondWithResult(_0x566fdd,null))['catch'](handleError(_0x566fdd,null));};exports[_0x75a8('0x2b')]=function(_0x855764,_0x57acfd){return db['SmsQueue'][_0x75a8('0x57')]({'where':{'id':_0x855764[_0x75a8('0x50')]['id']}})['then'](handleEntityNotFound(_0x57acfd,null))['then'](removeEntity(_0x57acfd,null))[_0x75a8('0x59')](handleError(_0x57acfd,null));};exports[_0x75a8('0x5b')]=function(_0x292b20,_0x2fd3ab){return db[_0x75a8('0x35')][_0x75a8('0x5b')]()['then'](respondWithResult(_0x2fd3ab,null))[_0x75a8('0x59')](handleError(_0x2fd3ab,null));};exports[_0x75a8('0x5c')]=function(_0x1b2766,_0x179d01,_0xe41b09){var _0x7c0b39={'raw':!![],'where':{}},_0xe2eb0a={},_0x45f98e;return db[_0x75a8('0x35')]['findOne']({'where':{'id':_0x1b2766[_0x75a8('0x50')]['id']}})['then'](handleEntityNotFound(_0x179d01,null))[_0x75a8('0x2c')](function(_0x2fcbba){if(_0x2fcbba){_0x45f98e=_0x2fcbba['get']({'plain':!![]});_0xe2eb0a['model']=_['keys'](db[_0x75a8('0x5d')][_0x75a8('0x36')]);_0xe2eb0a[_0x75a8('0x3b')]=_[_0x75a8('0x3c')](_0x1b2766[_0x75a8('0x3b')]);_0xe2eb0a[_0x75a8('0x3d')]=_[_0x75a8('0x3e')](_0xe2eb0a[_0x75a8('0x3a')],_0xe2eb0a[_0x75a8('0x3b')]);_0x7c0b39[_0x75a8('0x40')]=_[_0x75a8('0x3e')](_0xe2eb0a['model'],qs[_0x75a8('0x3f')](_0x1b2766[_0x75a8('0x3b')][_0x75a8('0x3f')]));_0x7c0b39[_0x75a8('0x40')]=_0x7c0b39[_0x75a8('0x40')][_0x75a8('0x41')]?_0x7c0b39['attributes']:_0xe2eb0a[_0x75a8('0x3a')];if(!_0x1b2766[_0x75a8('0x3b')][_0x75a8('0x42')](_0x75a8('0x43'))){_0x7c0b39[_0x75a8('0x23')]=qs[_0x75a8('0x23')](_0x1b2766[_0x75a8('0x3b')]['limit']);_0x7c0b39[_0x75a8('0x21')]=qs[_0x75a8('0x21')](_0x1b2766['query'][_0x75a8('0x21')]);}_0x7c0b39[_0x75a8('0x44')]=qs[_0x75a8('0x45')](_0x1b2766[_0x75a8('0x3b')]['sort']);_0x7c0b39[_0x75a8('0x48')]=qs[_0x75a8('0x3d')](_[_0x75a8('0x46')](_0x1b2766[_0x75a8('0x3b')],_0xe2eb0a[_0x75a8('0x3d')]));_0x7c0b39['where'][_0x75a8('0x5e')]=_0x2fcbba['id'];if(_0x1b2766[_0x75a8('0x3b')][_0x75a8('0x47')]){_0x7c0b39['where']=_[_0x75a8('0x49')](_0x7c0b39[_0x75a8('0x48')],{'$or':_[_0x75a8('0x34')](_0x7c0b39[_0x75a8('0x40')],function(_0x13e9f9){var _0x231792={};_0x231792[_0x13e9f9]={'$like':'%'+_0x1b2766[_0x75a8('0x3b')]['filter']+'%'};return _0x231792;})});}_0x7c0b39=_[_0x75a8('0x49')]({},_0x7c0b39,_0x1b2766[_0x75a8('0x4b')]);return db[_0x75a8('0x5d')][_0x75a8('0x5f')](_0x7c0b39);}})[_0x75a8('0x2c')](function(_0x3dcb53){if(_0x3dcb53){return db[_0x75a8('0x60')][_0x75a8('0x61')]({'where':{'id':_[_0x75a8('0x34')](_0x3dcb53,_0x75a8('0x62')),'role':_0x75a8('0x63')},'attributes':['id',_0x75a8('0x32'),_0x75a8('0x64'),'updatedAt',_0x75a8('0x65')]});}})[_0x75a8('0x2c')](function(_0x14276f){if(_0x14276f){return{'count':_0x14276f[_0x75a8('0x24')],'rows':_['map'](_0x14276f[_0x75a8('0x4e')],function(_0x4eaf6e){return{'membername':_0x4eaf6e[_0x75a8('0x32')],'UserId':_0x4eaf6e['id'],'queue_name':_0x45f98e['name'],'SmsQueueId':_0x45f98e['id'],'interface':util[_0x75a8('0x66')](_0x75a8('0x67'),'SIP',_0x4eaf6e[_0x75a8('0x32')]),'penalty':0x0,'paused':_0x4eaf6e[_0x75a8('0x64')],'createdAt':_0x4eaf6e[_0x75a8('0x65')],'updatedAt':_0x4eaf6e[_0x75a8('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x179d01,_0x7c0b39))['catch'](handleError(_0x179d01,null));};exports[_0x75a8('0x69')]=function(_0xb80551,_0x477421,_0xc52771){var _0x39ac67={};var _0xcbb7d3={};var _0x3761f1;var _0x3dba17;return db['SmsQueue'][_0x75a8('0x6a')]({'where':{'id':_0xb80551[_0x75a8('0x50')]['id']}})[_0x75a8('0x2c')](handleEntityNotFound(_0x477421,null))['then'](function(_0x54cfa3){if(_0x54cfa3){_0x3761f1=_0x54cfa3;_0xcbb7d3[_0x75a8('0x3a')]=_[_0x75a8('0x3c')](db[_0x75a8('0x6b')]['rawAttributes']);_0xcbb7d3[_0x75a8('0x3b')]=_['keys'](_0xb80551[_0x75a8('0x3b')]);_0xcbb7d3[_0x75a8('0x3d')]=_['intersection'](_0xcbb7d3[_0x75a8('0x3a')],_0xcbb7d3[_0x75a8('0x3b')]);_0x39ac67['attributes']=_['intersection'](_0xcbb7d3[_0x75a8('0x3a')],qs[_0x75a8('0x3f')](_0xb80551[_0x75a8('0x3b')][_0x75a8('0x3f')]));_0x39ac67[_0x75a8('0x40')]=_0x39ac67['attributes']['length']?_0x39ac67['attributes']:_0xcbb7d3[_0x75a8('0x3a')];_0x39ac67['order']=qs[_0x75a8('0x45')](_0xb80551[_0x75a8('0x3b')]['sort']);_0x39ac67[_0x75a8('0x48')]=qs[_0x75a8('0x3d')](_[_0x75a8('0x46')](_0xb80551[_0x75a8('0x3b')],_0xcbb7d3[_0x75a8('0x3d')]));if(_0xb80551[_0x75a8('0x3b')]['filter']){_0x39ac67[_0x75a8('0x48')]=_[_0x75a8('0x49')](_0x39ac67[_0x75a8('0x48')],{'$or':_[_0x75a8('0x34')](_0x39ac67[_0x75a8('0x40')],function(_0x14e08a){var _0x540e66={};_0x540e66[_0x14e08a]={'$like':'%'+_0xb80551['query']['filter']+'%'};return _0x540e66;})});}_0x39ac67=_[_0x75a8('0x49')]({},_0x39ac67,_0xb80551[_0x75a8('0x4b')]);return _0x3761f1[_0x75a8('0x69')](_0x39ac67);}})['then'](function(_0x518f72){if(_0x518f72){_0x3dba17=_0x518f72[_0x75a8('0x41')];if(!_0xb80551[_0x75a8('0x3b')][_0x75a8('0x42')](_0x75a8('0x43'))){_0x39ac67[_0x75a8('0x23')]=qs[_0x75a8('0x23')](_0xb80551[_0x75a8('0x3b')][_0x75a8('0x23')]);_0x39ac67[_0x75a8('0x21')]=qs[_0x75a8('0x21')](_0xb80551[_0x75a8('0x3b')][_0x75a8('0x21')]);}return _0x3761f1[_0x75a8('0x69')](_0x39ac67);}})[_0x75a8('0x2c')](function(_0x3fcf9a){if(_0x3fcf9a){return _0x3fcf9a?{'count':_0x3dba17,'rows':_0x3fcf9a}:null;}})[_0x75a8('0x2c')](respondWithResult(_0x477421,null))[_0x75a8('0x59')](handleError(_0x477421,null));};exports[_0x75a8('0x6c')]=function(_0xd1ac22,_0x1f94f2,_0x27288c){var _0x563dc3=_0xd1ac22['body'][_0x75a8('0x6d')];return db[_0x75a8('0x6b')][_0x75a8('0x5f')]({'where':{'id':_0x563dc3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x75a8('0x6e'),_0x75a8('0x6f'),'interface'],'raw':!![]}]})[_0x75a8('0x2c')](function(_0x3d80d6){if(_0x3d80d6){var _0x27791f=_[_0x75a8('0x70')](_0x3d80d6,function(_0x1942e6){var _0x1aaaca=_0x1942e6[_0x75a8('0x2d')]({'plain':!![]});return _0x1aaaca['Agents'];});return db[_0x75a8('0x35')][_0x75a8('0x57')]({'where':{'id':_0xd1ac22[_0x75a8('0x50')]['id']}})[_0x75a8('0x2c')](function(_0x113e4b){return db[_0x75a8('0x71')][_0x75a8('0x72')](function(_0x14bd00){return _0x113e4b['addTeams'](_0x563dc3,{'transaction':_0x14bd00})[_0x75a8('0x2c')](function(){return BPromise[_0x75a8('0x73')](_0x27791f,function(_0x5d136f){return db[_0x75a8('0x5d')][_0x75a8('0x74')]({'where':{'UserId':_0x5d136f['id'],'SmsQueueId':_0xd1ac22[_0x75a8('0x50')]['id']},'transaction':_0x14bd00});});})[_0x75a8('0x2c')](function(){_0x27791f[_0x75a8('0x75')](function(_0xf7e0e6){socket[_0x75a8('0x76')](_0x75a8('0x77'),{'UserId':_0xf7e0e6['id'],'SmsQueueId':_0x113e4b['id']});});});});});}})[_0x75a8('0x2c')](respondWithStatusCode(_0x1f94f2,null))[_0x75a8('0x59')](handleError(_0x1f94f2,null));};exports[_0x75a8('0x78')]=function(_0xfb808c,_0x391a15,_0x34d1ba){return db['Team'][_0x75a8('0x5f')]({'where':{'id':_0xfb808c['query'][_0x75a8('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x75a8('0x60')],'as':_0x75a8('0x79'),'attributes':['id'],'raw':!![]}]})[_0x75a8('0x2c')](handleEntityNotFound(_0x391a15,null))[_0x75a8('0x2c')](function(_0x4e867b){var _0x24a43d=_[_0x75a8('0x34')](_0x4e867b,'id');var _0xf168c5=[];var _0x297bef=[];var _0x247b55=squel[_0x75a8('0x7a')]();_0x247b55['field'](_0x75a8('0x7b'))[_0x75a8('0x7c')](_0x75a8('0x7d'),'tq')[_0x75a8('0x7e')](_0x75a8('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x75a8('0x48')](_0x75a8('0x80'),_0xfb808c['params']['id']);for(var _0x49c344=0x0;_0x49c344<_0x4e867b[_0x75a8('0x41')];_0x49c344+=0x1){let _0x1eacd8=_0x4e867b[_0x49c344];for(var _0x45b25e=0x0;_0x45b25e<_0x1eacd8[_0x75a8('0x79')]['length'];_0x45b25e+=0x1){let _0x29d64d=_0x1eacd8['Agents'][_0x45b25e];var _0x35dccf=_0x247b55['clone']();_0x35dccf[_0x75a8('0x48')](_0x75a8('0x81'),_0x29d64d['id']);_0x297bef['push'](db[_0x75a8('0x71')]['query'](_0x35dccf['toString'](),{'type':db[_0x75a8('0x71')]['QueryTypes']['SELECT']})['then'](function(_0x4cf989){if(_0x4cf989[_0x75a8('0x41')]===0x1){return _0x29d64d['id'];}else{var _0x4359fd=_[_0x75a8('0x82')](_[_0x75a8('0x34')](_0x4cf989,_0x75a8('0x83')),function(_0xf8eaf){return _['includes'](_0x24a43d,_0xf8eaf);});if(_0x4359fd){return _0x29d64d['id'];}}}));}}return BPromise[_0x75a8('0x84')](_0x297bef)[_0x75a8('0x2c')](function(_0x174c71){_0xf168c5=_(_0xf168c5)[_0x75a8('0x85')](_0x174c71)[_0x75a8('0x86')]()[_0x75a8('0x87')]();return db[_0x75a8('0x35')][_0x75a8('0x57')]({'where':{'id':_0xfb808c[_0x75a8('0x50')]['id']}})['then'](function(_0x16e6d9){return db[_0x75a8('0x71')][_0x75a8('0x72')](function(_0x1e9cd3){return _0x16e6d9[_0x75a8('0x78')](_0xfb808c[_0x75a8('0x3b')][_0x75a8('0x6d')],{'transaction':_0x1e9cd3})[_0x75a8('0x2c')](function(){if(!_[_0x75a8('0x88')](_0xf168c5)){return _0x16e6d9[_0x75a8('0x89')](_0xf168c5,{'transaction':_0x1e9cd3});}})[_0x75a8('0x2c')](function(){_0xf168c5['forEach'](function(_0x4dc7de){socket['emit'](_0x75a8('0x8a'),{'UserId':_0x4dc7de,'SmsQueueId':_0x16e6d9['id']});});});});});});})[_0x75a8('0x2c')](respondWithStatusCode(_0x391a15,null))[_0x75a8('0x59')](handleError(_0x391a15,null));};exports['addAgents']=function(_0x5b86d6,_0x294fe8,_0x5cd31d){return db[_0x75a8('0x35')][_0x75a8('0x57')]({'where':{'id':_0x5b86d6[_0x75a8('0x50')]['id']}})[_0x75a8('0x2c')](handleEntityNotFound(_0x294fe8,null))[_0x75a8('0x2c')](function(_0x5289e0){if(_0x5289e0){return _0x5289e0[_0x75a8('0x8b')](_0x5b86d6[_0x75a8('0x52')]['ids'],_['omit'](_0x5b86d6[_0x75a8('0x52')],[_0x75a8('0x6d'),'id'])||{})['spread'](function(_0x54ed0f){for(var _0x1b03cf=0x0;_0x1b03cf<_0x5b86d6[_0x75a8('0x52')][_0x75a8('0x6d')][_0x75a8('0x41')];_0x1b03cf+=0x1){socket['emit'](_0x75a8('0x77'),{'UserId':Number(_0x5b86d6['body']['ids'][_0x1b03cf]),'SmsQueueId':Number(_0x5b86d6[_0x75a8('0x50')]['id'])});}return _0x54ed0f;});}})[_0x75a8('0x2c')](respondWithResult(_0x294fe8,null))[_0x75a8('0x59')](handleError(_0x294fe8,null));};exports['removeAgents']=function(_0x58c656,_0x3f36b8,_0x1eb5cb){return db[_0x75a8('0x35')][_0x75a8('0x57')]({'where':{'id':_0x58c656[_0x75a8('0x50')]['id']}})[_0x75a8('0x2c')](handleEntityNotFound(_0x3f36b8,null))[_0x75a8('0x2c')](function(_0x54c1ba){if(_0x54c1ba){return _0x54c1ba[_0x75a8('0x89')](_0x58c656[_0x75a8('0x3b')][_0x75a8('0x6d')])[_0x75a8('0x2c')](function(){if(_[_0x75a8('0x8c')](_0x58c656[_0x75a8('0x3b')]['ids'])){for(var _0x4d0187=0x0;_0x4d0187<_0x58c656[_0x75a8('0x3b')][_0x75a8('0x6d')][_0x75a8('0x41')];_0x4d0187+=0x1){socket[_0x75a8('0x76')](_0x75a8('0x8a'),{'UserId':Number(_0x58c656[_0x75a8('0x3b')]['ids'][_0x4d0187]),'SmsQueueId':Number(_0x58c656[_0x75a8('0x50')]['id'])});}}else{socket[_0x75a8('0x76')](_0x75a8('0x8a'),{'UserId':Number(_0x58c656[_0x75a8('0x3b')][_0x75a8('0x6d')]),'SmsQueueId':Number(_0x58c656[_0x75a8('0x50')]['id'])});}});}})[_0x75a8('0x2c')](respondWithStatusCode(_0x3f36b8,null))[_0x75a8('0x59')](handleError(_0x3f36b8,null));};exports[_0x75a8('0x8d')]=function(_0x5525a1,_0x5471e1,_0x10d291){var _0x769ff9={};var _0x469399={};var _0x67ed4d;var _0x105343;return db[_0x75a8('0x35')][_0x75a8('0x6a')]({'where':{'id':_0x5525a1[_0x75a8('0x50')]['id']}})['then'](handleEntityNotFound(_0x5471e1,null))[_0x75a8('0x2c')](function(_0x60a429){if(_0x60a429){_0x67ed4d=_0x60a429;_0x469399[_0x75a8('0x3a')]=_[_0x75a8('0x3c')](db[_0x75a8('0x60')][_0x75a8('0x36')]);_0x469399[_0x75a8('0x3b')]=_[_0x75a8('0x3c')](_0x5525a1[_0x75a8('0x3b')]);_0x469399[_0x75a8('0x3d')]=_[_0x75a8('0x3e')](_0x469399['model'],_0x469399[_0x75a8('0x3b')]);_0x769ff9['attributes']=_['intersection'](_0x469399['model'],qs[_0x75a8('0x3f')](_0x5525a1[_0x75a8('0x3b')][_0x75a8('0x3f')]));_0x769ff9[_0x75a8('0x40')]=_0x769ff9[_0x75a8('0x40')][_0x75a8('0x41')]?_0x769ff9[_0x75a8('0x40')]:_0x469399[_0x75a8('0x3a')];_0x769ff9['order']=qs[_0x75a8('0x45')](_0x5525a1[_0x75a8('0x3b')]['sort']);_0x769ff9[_0x75a8('0x48')]=qs[_0x75a8('0x3d')](_[_0x75a8('0x46')](_0x5525a1[_0x75a8('0x3b')],_0x469399[_0x75a8('0x3d')]));if(_0x5525a1[_0x75a8('0x3b')][_0x75a8('0x47')]){_0x769ff9['where']=_[_0x75a8('0x49')](_0x769ff9[_0x75a8('0x48')],{'$or':_[_0x75a8('0x34')](_0x769ff9['attributes'],function(_0x597590){var _0x435bc1={};_0x435bc1[_0x597590]={'$like':'%'+_0x5525a1[_0x75a8('0x3b')][_0x75a8('0x47')]+'%'};return _0x435bc1;})});}_0x769ff9=_[_0x75a8('0x49')]({},_0x769ff9,_0x5525a1[_0x75a8('0x4b')]);return _0x67ed4d[_0x75a8('0x8d')](_0x769ff9);}})['then'](function(_0x4a5c83){if(_0x4a5c83){_0x105343=_0x4a5c83[_0x75a8('0x41')];if(!_0x5525a1['query']['hasOwnProperty'](_0x75a8('0x43'))){_0x769ff9[_0x75a8('0x23')]=qs['limit'](_0x5525a1[_0x75a8('0x3b')]['limit']);_0x769ff9[_0x75a8('0x21')]=qs[_0x75a8('0x21')](_0x5525a1[_0x75a8('0x3b')][_0x75a8('0x21')]);}return _0x67ed4d[_0x75a8('0x8d')](_0x769ff9);}})['then'](function(_0x50bb3e){if(_0x50bb3e){return _0x50bb3e?{'count':_0x105343,'rows':_0x50bb3e}:null;}})[_0x75a8('0x2c')](respondWithResult(_0x5471e1,null))['catch'](handleError(_0x5471e1,null));}; \ No newline at end of file +var _0xd9eb=['getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','type','map','query','keys','filters','intersection','model','attributes','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsQueue','includeAll','findAll','catch','show','params','rawAttributes','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','describe'];(function(_0xc5735d,_0x296ba9){var _0x55ace6=function(_0x2923aa){while(--_0x2923aa){_0xc5735d['push'](_0xc5735d['shift']());}};_0x55ace6(++_0x296ba9);}(_0xd9eb,0xca));var _0xbd9e=function(_0x2c3201,_0x1f76ff){_0x2c3201=_0x2c3201-0x0;var _0x564fc4=_0xd9eb[_0x2c3201];return _0x564fc4;};'use strict';var emlformat=require(_0xbd9e('0x0'));var rimraf=require(_0xbd9e('0x1'));var zipdir=require(_0xbd9e('0x2'));var jsonpatch=require(_0xbd9e('0x3'));var rp=require(_0xbd9e('0x4'));var moment=require(_0xbd9e('0x5'));var BPromise=require(_0xbd9e('0x6'));var Mustache=require(_0xbd9e('0x7'));var util=require(_0xbd9e('0x8'));var path=require(_0xbd9e('0x9'));var sox=require(_0xbd9e('0xa'));var csv=require(_0xbd9e('0xb'));var ejs=require(_0xbd9e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd9e('0xd'));var squel=require(_0xbd9e('0xe'));var crypto=require(_0xbd9e('0xf'));var jsforce=require(_0xbd9e('0x10'));var deskjs=require(_0xbd9e('0x11'));var toCsv=require(_0xbd9e('0xb'));var querystring=require(_0xbd9e('0x12'));var Papa=require(_0xbd9e('0x13'));var Redis=require(_0xbd9e('0x14'));var authService=require(_0xbd9e('0x15'));var qs=require(_0xbd9e('0x16'));var as=require(_0xbd9e('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd9e('0x18'))(_0xbd9e('0x19'));var utils=require('../../config/utils');var config=require(_0xbd9e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd9e('0x1b'))['db'];config[_0xbd9e('0x1c')]=_[_0xbd9e('0x1d')](config[_0xbd9e('0x1c')],{'host':_0xbd9e('0x1e'),'port':0x18eb});var socket=require(_0xbd9e('0x1f'))(new Redis(config[_0xbd9e('0x1c')]));require(_0xbd9e('0x20'))['register'](socket);function respondWithStatusCode(_0x3c56bd,_0x145a40){_0x145a40=_0x145a40||0xcc;return function(_0x40c48f){if(_0x40c48f){return _0x3c56bd[_0xbd9e('0x21')](_0x145a40);}return _0x3c56bd[_0xbd9e('0x22')](_0x145a40)[_0xbd9e('0x23')]();};}function respondWithResult(_0x324074,_0x87eb30){_0x87eb30=_0x87eb30||0xc8;return function(_0x4112a8){if(_0x4112a8){return _0x324074[_0xbd9e('0x22')](_0x87eb30)[_0xbd9e('0x24')](_0x4112a8);}};}function respondWithFilteredResult(_0x492736,_0x43c588){return function(_0x20e2dc){if(_0x20e2dc){var _0x16c773=typeof _0x43c588[_0xbd9e('0x25')]===_0xbd9e('0x26')&&typeof _0x43c588['limit']===_0xbd9e('0x26');var _0x36bdc1=_0x20e2dc[_0xbd9e('0x27')];var _0xb9ff26=_0x16c773?0x0:_0x43c588[_0xbd9e('0x25')];var _0x599c68=_0x16c773?_0x20e2dc[_0xbd9e('0x27')]:_0x43c588['offset']+_0x43c588['limit'];var _0x30d92f;if(_0x599c68>=_0x36bdc1){_0x599c68=_0x36bdc1;_0x30d92f=0xc8;}else{_0x30d92f=0xce;}_0x492736[_0xbd9e('0x22')](_0x30d92f);return _0x492736[_0xbd9e('0x28')](_0xbd9e('0x29'),_0xb9ff26+'-'+_0x599c68+'/'+_0x36bdc1)['json'](_0x20e2dc);}return null;};}function patchUpdates(_0x435fd3){return function(_0x217dc4){try{jsonpatch['apply'](_0x217dc4,_0x435fd3,!![]);}catch(_0x4efbe2){return BPromise[_0xbd9e('0x2a')](_0x4efbe2);}return _0x217dc4[_0xbd9e('0x2b')]();};}function saveUpdates(_0x467860,_0x2f7dab){return function(_0x5d4ceb){if(_0x5d4ceb){return _0x5d4ceb['update'](_0x467860)['then'](function(_0x3031af){return _0x3031af;});}return null;};}function removeEntity(_0x5743c3,_0xb58228){return function(_0x4e2712){if(_0x4e2712){return _0x4e2712[_0xbd9e('0x2c')]()[_0xbd9e('0x2d')](function(){var _0x4be355=_0x4e2712[_0xbd9e('0x2e')]({'plain':!![]});var _0xcc3a5=_0xbd9e('0x2f');return db[_0xbd9e('0x30')][_0xbd9e('0x2c')]({'where':{'type':_0xcc3a5,'resourceId':_0x4be355['id']}})[_0xbd9e('0x2d')](function(){return _0x4e2712;});})[_0xbd9e('0x2d')](function(){_0x5743c3['status'](0xcc)[_0xbd9e('0x23')]();});}};}function handleEntityNotFound(_0x57a339,_0x33d152){return function(_0x5238a5){if(!_0x5238a5){_0x57a339[_0xbd9e('0x21')](0x194);}return _0x5238a5;};}function handleError(_0x4289aa,_0x5485ec){_0x5485ec=_0x5485ec||0x1f4;return function(_0x2ee14a){logger[_0xbd9e('0x31')](_0x2ee14a['stack']);if(_0x2ee14a[_0xbd9e('0x32')]){delete _0x2ee14a[_0xbd9e('0x32')];}_0x4289aa['status'](_0x5485ec)[_0xbd9e('0x33')](_0x2ee14a);};}exports[_0xbd9e('0x34')]=function(_0xf37d0,_0x547905){var _0x1dac86={},_0x26e58e={},_0x272c8d={'count':0x0,'rows':[]};var _0x301113=_['map'](db['SmsQueue']['rawAttributes'],function(_0xeb35dc){return{'name':_0xeb35dc['fieldName'],'type':_0xeb35dc[_0xbd9e('0x35')]['key']};});_0x26e58e['model']=_[_0xbd9e('0x36')](_0x301113,'name');_0x26e58e[_0xbd9e('0x37')]=_[_0xbd9e('0x38')](_0xf37d0[_0xbd9e('0x37')]);_0x26e58e[_0xbd9e('0x39')]=_[_0xbd9e('0x3a')](_0x26e58e[_0xbd9e('0x3b')],_0x26e58e['query']);_0x1dac86[_0xbd9e('0x3c')]=_['intersection'](_0x26e58e[_0xbd9e('0x3b')],qs['fields'](_0xf37d0['query']['fields']));_0x1dac86[_0xbd9e('0x3c')]=_0x1dac86['attributes']['length']?_0x1dac86[_0xbd9e('0x3c')]:_0x26e58e['model'];if(!_0xf37d0[_0xbd9e('0x37')]['hasOwnProperty'](_0xbd9e('0x3d'))){_0x1dac86[_0xbd9e('0x3e')]=qs[_0xbd9e('0x3e')](_0xf37d0[_0xbd9e('0x37')][_0xbd9e('0x3e')]);_0x1dac86['offset']=qs[_0xbd9e('0x25')](_0xf37d0[_0xbd9e('0x37')]['offset']);}_0x1dac86[_0xbd9e('0x3f')]=qs[_0xbd9e('0x40')](_0xf37d0[_0xbd9e('0x37')][_0xbd9e('0x40')]);_0x1dac86[_0xbd9e('0x41')]=qs['filters'](_[_0xbd9e('0x42')](_0xf37d0[_0xbd9e('0x37')],_0x26e58e[_0xbd9e('0x39')]),_0x301113);if(_0xf37d0[_0xbd9e('0x37')][_0xbd9e('0x43')]){_0x1dac86[_0xbd9e('0x41')]=_['merge'](_0x1dac86[_0xbd9e('0x41')],{'$or':_[_0xbd9e('0x36')](_0x301113,function(_0xe14d54){if(_0xe14d54['type']!==_0xbd9e('0x44')){var _0x24cca7={};_0x24cca7[_0xe14d54['name']]={'$like':'%'+_0xf37d0['query']['filter']+'%'};return _0x24cca7;}})});}_0x1dac86=_[_0xbd9e('0x45')]({},_0x1dac86,_0xf37d0[_0xbd9e('0x46')]);var _0x547885={'where':_0x1dac86[_0xbd9e('0x41')]};return db[_0xbd9e('0x47')][_0xbd9e('0x27')](_0x547885)[_0xbd9e('0x2d')](function(_0x2fdd04){_0x272c8d[_0xbd9e('0x27')]=_0x2fdd04;if(_0xf37d0[_0xbd9e('0x37')][_0xbd9e('0x48')]){_0x1dac86['include']=[{'all':!![]}];}return db[_0xbd9e('0x47')][_0xbd9e('0x49')](_0x1dac86);})[_0xbd9e('0x2d')](function(_0x405967){_0x272c8d['rows']=_0x405967;return _0x272c8d;})['then'](respondWithFilteredResult(_0x547905,_0x1dac86))[_0xbd9e('0x4a')](handleError(_0x547905,null));};exports[_0xbd9e('0x4b')]=function(_0x501a5e,_0x2d1bfe){var _0x5d83f9={'raw':!![],'where':{'id':_0x501a5e[_0xbd9e('0x4c')]['id']}},_0x2de7b0={};_0x2de7b0['model']=_['keys'](db['SmsQueue'][_0xbd9e('0x4d')]);_0x2de7b0[_0xbd9e('0x37')]=_[_0xbd9e('0x38')](_0x501a5e[_0xbd9e('0x37')]);_0x2de7b0[_0xbd9e('0x39')]=_[_0xbd9e('0x3a')](_0x2de7b0['model'],_0x2de7b0[_0xbd9e('0x37')]);_0x5d83f9['attributes']=_['intersection'](_0x2de7b0[_0xbd9e('0x3b')],qs[_0xbd9e('0x4e')](_0x501a5e[_0xbd9e('0x37')]['fields']));_0x5d83f9[_0xbd9e('0x3c')]=_0x5d83f9[_0xbd9e('0x3c')][_0xbd9e('0x4f')]?_0x5d83f9['attributes']:_0x2de7b0[_0xbd9e('0x3b')];if(_0x501a5e['query'][_0xbd9e('0x48')]){_0x5d83f9[_0xbd9e('0x50')]=[{'all':!![]}];}_0x5d83f9=_[_0xbd9e('0x45')]({},_0x5d83f9,_0x501a5e[_0xbd9e('0x46')]);return db[_0xbd9e('0x47')][_0xbd9e('0x51')](_0x5d83f9)[_0xbd9e('0x2d')](handleEntityNotFound(_0x2d1bfe,null))[_0xbd9e('0x2d')](respondWithResult(_0x2d1bfe,null))[_0xbd9e('0x4a')](handleError(_0x2d1bfe,null));};exports[_0xbd9e('0x52')]=function(_0xbc3e78,_0x2bbad7){return db[_0xbd9e('0x47')]['create'](_0xbc3e78[_0xbd9e('0x53')],{})[_0xbd9e('0x2d')](function(_0x318225){var _0x129ed7=_0xbc3e78[_0xbd9e('0x54')][_0xbd9e('0x2e')]({'plain':!![]});if(!_0x129ed7)throw new Error(_0xbd9e('0x55'));if(_0x129ed7[_0xbd9e('0x56')]==='user'){var _0x4c56e5=_0x318225[_0xbd9e('0x2e')]({'plain':!![]});var _0x1696f3=_0xbd9e('0x2f');return db[_0xbd9e('0x57')][_0xbd9e('0x51')]({'where':{'name':_0x1696f3,'userProfileId':_0x129ed7['userProfileId']},'raw':!![]})[_0xbd9e('0x2d')](function(_0x338630){if(_0x338630&&_0x338630['autoAssociation']===0x0){return db[_0xbd9e('0x30')][_0xbd9e('0x52')]({'name':_0x4c56e5[_0xbd9e('0x32')],'resourceId':_0x4c56e5['id'],'type':_0x338630[_0xbd9e('0x32')],'sectionId':_0x338630['id']},{})[_0xbd9e('0x2d')](function(){return _0x318225;});}else{return _0x318225;}})[_0xbd9e('0x4a')](function(_0x81363f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81363f);throw _0x81363f;});}return _0x318225;})[_0xbd9e('0x2d')](respondWithResult(_0x2bbad7,0xc9))[_0xbd9e('0x4a')](handleError(_0x2bbad7,null));};exports[_0xbd9e('0x58')]=function(_0x1f5fa6,_0xcdd098){if(_0x1f5fa6[_0xbd9e('0x53')]['id']){delete _0x1f5fa6[_0xbd9e('0x53')]['id'];}return db[_0xbd9e('0x47')]['find']({'where':{'id':_0x1f5fa6[_0xbd9e('0x4c')]['id']}})[_0xbd9e('0x2d')](handleEntityNotFound(_0xcdd098,null))[_0xbd9e('0x2d')](saveUpdates(_0x1f5fa6[_0xbd9e('0x53')],null))[_0xbd9e('0x2d')](respondWithResult(_0xcdd098,null))[_0xbd9e('0x4a')](handleError(_0xcdd098,null));};exports[_0xbd9e('0x2c')]=function(_0x3a4b37,_0x57c5b2){return db[_0xbd9e('0x47')]['find']({'where':{'id':_0x3a4b37[_0xbd9e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57c5b2,null))[_0xbd9e('0x2d')](removeEntity(_0x57c5b2,null))['catch'](handleError(_0x57c5b2,null));};exports['describe']=function(_0x58bc0a,_0x2d8f0b){return db['SmsQueue'][_0xbd9e('0x59')]()[_0xbd9e('0x2d')](respondWithResult(_0x2d8f0b,null))[_0xbd9e('0x4a')](handleError(_0x2d8f0b,null));};exports[_0xbd9e('0x5a')]=function(_0x2918bc,_0x40e84a,_0x320ab3){var _0x5ab760={'raw':!![],'where':{}},_0x4754d3={},_0x5ed853;return db['SmsQueue'][_0xbd9e('0x5b')]({'where':{'id':_0x2918bc[_0xbd9e('0x4c')]['id']}})[_0xbd9e('0x2d')](handleEntityNotFound(_0x40e84a,null))[_0xbd9e('0x2d')](function(_0x356a2f){if(_0x356a2f){_0x5ed853=_0x356a2f[_0xbd9e('0x2e')]({'plain':!![]});_0x4754d3[_0xbd9e('0x3b')]=_['keys'](db[_0xbd9e('0x5c')]['rawAttributes']);_0x4754d3[_0xbd9e('0x37')]=_[_0xbd9e('0x38')](_0x2918bc[_0xbd9e('0x37')]);_0x4754d3[_0xbd9e('0x39')]=_[_0xbd9e('0x3a')](_0x4754d3[_0xbd9e('0x3b')],_0x4754d3['query']);_0x5ab760['attributes']=_['intersection'](_0x4754d3['model'],qs['fields'](_0x2918bc['query'][_0xbd9e('0x4e')]));_0x5ab760[_0xbd9e('0x3c')]=_0x5ab760[_0xbd9e('0x3c')][_0xbd9e('0x4f')]?_0x5ab760[_0xbd9e('0x3c')]:_0x4754d3[_0xbd9e('0x3b')];if(!_0x2918bc['query'][_0xbd9e('0x5d')](_0xbd9e('0x3d'))){_0x5ab760['limit']=qs[_0xbd9e('0x3e')](_0x2918bc[_0xbd9e('0x37')]['limit']);_0x5ab760[_0xbd9e('0x25')]=qs[_0xbd9e('0x25')](_0x2918bc[_0xbd9e('0x37')]['offset']);}_0x5ab760[_0xbd9e('0x3f')]=qs[_0xbd9e('0x40')](_0x2918bc[_0xbd9e('0x37')]['sort']);_0x5ab760['where']=qs[_0xbd9e('0x39')](_[_0xbd9e('0x42')](_0x2918bc['query'],_0x4754d3['filters']));_0x5ab760[_0xbd9e('0x41')][_0xbd9e('0x5e')]=_0x356a2f['id'];if(_0x2918bc[_0xbd9e('0x37')][_0xbd9e('0x43')]){_0x5ab760['where']=_[_0xbd9e('0x45')](_0x5ab760[_0xbd9e('0x41')],{'$or':_[_0xbd9e('0x36')](_0x5ab760[_0xbd9e('0x3c')],function(_0x1d1877){var _0x5a754e={};_0x5a754e[_0x1d1877]={'$like':'%'+_0x2918bc[_0xbd9e('0x37')][_0xbd9e('0x43')]+'%'};return _0x5a754e;})});}_0x5ab760=_[_0xbd9e('0x45')]({},_0x5ab760,_0x2918bc['options']);return db[_0xbd9e('0x5c')][_0xbd9e('0x49')](_0x5ab760);}})[_0xbd9e('0x2d')](function(_0x2516cd){if(_0x2516cd){return db[_0xbd9e('0x5f')][_0xbd9e('0x60')]({'where':{'id':_[_0xbd9e('0x36')](_0x2516cd,_0xbd9e('0x61')),'role':_0xbd9e('0x62')},'attributes':['id','name',_0xbd9e('0x63'),'updatedAt',_0xbd9e('0x64')]});}})[_0xbd9e('0x2d')](function(_0x3d396e){if(_0x3d396e){return{'count':_0x3d396e[_0xbd9e('0x27')],'rows':_[_0xbd9e('0x36')](_0x3d396e[_0xbd9e('0x65')],function(_0x1aa36c){return{'membername':_0x1aa36c['name'],'UserId':_0x1aa36c['id'],'queue_name':_0x5ed853['name'],'SmsQueueId':_0x5ed853['id'],'interface':util[_0xbd9e('0x66')](_0xbd9e('0x67'),_0xbd9e('0x68'),_0x1aa36c[_0xbd9e('0x32')]),'penalty':0x0,'paused':_0x1aa36c[_0xbd9e('0x63')],'createdAt':_0x1aa36c[_0xbd9e('0x64')],'updatedAt':_0x1aa36c[_0xbd9e('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40e84a,_0x5ab760))['catch'](handleError(_0x40e84a,null));};exports[_0xbd9e('0x6a')]=function(_0x40915b,_0x3b6199,_0x356039){var _0x2beb68={};var _0x1d2496={};var _0x5ae8d4;var _0x4fe96b;return db[_0xbd9e('0x47')]['findOne']({'where':{'id':_0x40915b[_0xbd9e('0x4c')]['id']}})[_0xbd9e('0x2d')](handleEntityNotFound(_0x3b6199,null))[_0xbd9e('0x2d')](function(_0x28b272){if(_0x28b272){_0x5ae8d4=_0x28b272;_0x1d2496[_0xbd9e('0x3b')]=_['keys'](db[_0xbd9e('0x6b')][_0xbd9e('0x4d')]);_0x1d2496['query']=_['keys'](_0x40915b[_0xbd9e('0x37')]);_0x1d2496[_0xbd9e('0x39')]=_[_0xbd9e('0x3a')](_0x1d2496[_0xbd9e('0x3b')],_0x1d2496[_0xbd9e('0x37')]);_0x2beb68['attributes']=_[_0xbd9e('0x3a')](_0x1d2496[_0xbd9e('0x3b')],qs[_0xbd9e('0x4e')](_0x40915b[_0xbd9e('0x37')]['fields']));_0x2beb68['attributes']=_0x2beb68[_0xbd9e('0x3c')][_0xbd9e('0x4f')]?_0x2beb68[_0xbd9e('0x3c')]:_0x1d2496['model'];_0x2beb68[_0xbd9e('0x3f')]=qs['sort'](_0x40915b[_0xbd9e('0x37')][_0xbd9e('0x40')]);_0x2beb68['where']=qs[_0xbd9e('0x39')](_[_0xbd9e('0x42')](_0x40915b[_0xbd9e('0x37')],_0x1d2496[_0xbd9e('0x39')]));if(_0x40915b['query']['filter']){_0x2beb68[_0xbd9e('0x41')]=_[_0xbd9e('0x45')](_0x2beb68['where'],{'$or':_[_0xbd9e('0x36')](_0x2beb68['attributes'],function(_0x42e4fd){var _0x53eda3={};_0x53eda3[_0x42e4fd]={'$like':'%'+_0x40915b[_0xbd9e('0x37')][_0xbd9e('0x43')]+'%'};return _0x53eda3;})});}_0x2beb68=_[_0xbd9e('0x45')]({},_0x2beb68,_0x40915b[_0xbd9e('0x46')]);return _0x5ae8d4[_0xbd9e('0x6a')](_0x2beb68);}})['then'](function(_0x867212){if(_0x867212){_0x4fe96b=_0x867212[_0xbd9e('0x4f')];if(!_0x40915b[_0xbd9e('0x37')][_0xbd9e('0x5d')]('nolimit')){_0x2beb68[_0xbd9e('0x3e')]=qs['limit'](_0x40915b['query']['limit']);_0x2beb68['offset']=qs[_0xbd9e('0x25')](_0x40915b[_0xbd9e('0x37')][_0xbd9e('0x25')]);}return _0x5ae8d4[_0xbd9e('0x6a')](_0x2beb68);}})['then'](function(_0x1eaf79){if(_0x1eaf79){return _0x1eaf79?{'count':_0x4fe96b,'rows':_0x1eaf79}:null;}})[_0xbd9e('0x2d')](respondWithResult(_0x3b6199,null))[_0xbd9e('0x4a')](handleError(_0x3b6199,null));};exports[_0xbd9e('0x6c')]=function(_0x9117e1,_0x487f09,_0x125934){var _0x16f9c5=_0x9117e1[_0xbd9e('0x53')][_0xbd9e('0x6d')];return db[_0xbd9e('0x6b')][_0xbd9e('0x49')]({'where':{'id':_0x16f9c5},'attributes':['id'],'include':[{'model':db[_0xbd9e('0x5f')],'as':_0xbd9e('0x6e'),'attributes':['id',_0xbd9e('0x32'),_0xbd9e('0x6f'),'voicePause','interface'],'raw':!![]}]})[_0xbd9e('0x2d')](function(_0xacfeaf){if(_0xacfeaf){var _0x21adf6=_[_0xbd9e('0x70')](_0xacfeaf,function(_0x5e14b9){var _0x56989e=_0x5e14b9[_0xbd9e('0x2e')]({'plain':!![]});return _0x56989e[_0xbd9e('0x6e')];});return db[_0xbd9e('0x47')][_0xbd9e('0x51')]({'where':{'id':_0x9117e1[_0xbd9e('0x4c')]['id']}})['then'](function(_0x13a47f){return db[_0xbd9e('0x71')]['transaction'](function(_0x1964ad){return _0x13a47f[_0xbd9e('0x6c')](_0x16f9c5,{'transaction':_0x1964ad})[_0xbd9e('0x2d')](function(){return BPromise[_0xbd9e('0x72')](_0x21adf6,function(_0x3236e3){return db[_0xbd9e('0x5c')][_0xbd9e('0x73')]({'where':{'UserId':_0x3236e3['id'],'SmsQueueId':_0x9117e1[_0xbd9e('0x4c')]['id']},'transaction':_0x1964ad});});})[_0xbd9e('0x2d')](function(){_0x21adf6[_0xbd9e('0x74')](function(_0x31da00){socket[_0xbd9e('0x75')](_0xbd9e('0x76'),{'UserId':_0x31da00['id'],'SmsQueueId':_0x13a47f['id']});});});});});}})[_0xbd9e('0x2d')](respondWithStatusCode(_0x487f09,null))[_0xbd9e('0x4a')](handleError(_0x487f09,null));};exports[_0xbd9e('0x77')]=function(_0x49c941,_0x1e3473,_0x4775f7){return db[_0xbd9e('0x6b')]['findAll']({'where':{'id':_0x49c941[_0xbd9e('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbd9e('0x5f')],'as':_0xbd9e('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e3473,null))['then'](function(_0x179eb8){var _0x2c1693=_['map'](_0x179eb8,'id');var _0x1c851a=[];var _0x42a362=[];var _0x5a869c=squel[_0xbd9e('0x78')]();_0x5a869c[_0xbd9e('0x79')]('tq.TeamId')[_0xbd9e('0x7a')](_0xbd9e('0x7b'),'tq')[_0xbd9e('0x7c')](_0xbd9e('0x7d'),'ut',_0xbd9e('0x7e'))['where']('SmsQueueId\x20=\x20?',_0x49c941['params']['id']);for(var _0x1151ae=0x0;_0x1151ae<_0x179eb8[_0xbd9e('0x4f')];_0x1151ae+=0x1){let _0x15c27b=_0x179eb8[_0x1151ae];for(var _0xa41fd9=0x0;_0xa41fd9<_0x15c27b[_0xbd9e('0x6e')]['length'];_0xa41fd9+=0x1){let _0x18f855=_0x15c27b[_0xbd9e('0x6e')][_0xa41fd9];var _0x25dd00=_0x5a869c['clone']();_0x25dd00[_0xbd9e('0x41')](_0xbd9e('0x7f'),_0x18f855['id']);_0x42a362[_0xbd9e('0x80')](db[_0xbd9e('0x71')][_0xbd9e('0x37')](_0x25dd00[_0xbd9e('0x81')](),{'type':db['sequelize'][_0xbd9e('0x82')][_0xbd9e('0x83')]})[_0xbd9e('0x2d')](function(_0x1313bf){if(_0x1313bf[_0xbd9e('0x4f')]===0x1){return _0x18f855['id'];}else{var _0x382765=_[_0xbd9e('0x84')](_[_0xbd9e('0x36')](_0x1313bf,_0xbd9e('0x85')),function(_0x146cfc){return _[_0xbd9e('0x86')](_0x2c1693,_0x146cfc);});if(_0x382765){return _0x18f855['id'];}}}));}}return BPromise[_0xbd9e('0x87')](_0x42a362)[_0xbd9e('0x2d')](function(_0x3c5a88){_0x1c851a=_(_0x1c851a)['union'](_0x3c5a88)[_0xbd9e('0x88')]()[_0xbd9e('0x89')]();return db[_0xbd9e('0x47')]['find']({'where':{'id':_0x49c941[_0xbd9e('0x4c')]['id']}})[_0xbd9e('0x2d')](function(_0x21a368){return db[_0xbd9e('0x71')][_0xbd9e('0x8a')](function(_0x4bf5b4){return _0x21a368[_0xbd9e('0x77')](_0x49c941['query']['ids'],{'transaction':_0x4bf5b4})[_0xbd9e('0x2d')](function(){if(!_[_0xbd9e('0x8b')](_0x1c851a)){return _0x21a368[_0xbd9e('0x8c')](_0x1c851a,{'transaction':_0x4bf5b4});}})[_0xbd9e('0x2d')](function(){_0x1c851a['forEach'](function(_0x32aff9){socket[_0xbd9e('0x75')](_0xbd9e('0x8d'),{'UserId':_0x32aff9,'SmsQueueId':_0x21a368['id']});});});});});});})[_0xbd9e('0x2d')](respondWithStatusCode(_0x1e3473,null))[_0xbd9e('0x4a')](handleError(_0x1e3473,null));};exports[_0xbd9e('0x8e')]=function(_0x542de9,_0x305412,_0x255874){return db['SmsQueue']['find']({'where':{'id':_0x542de9['params']['id']}})[_0xbd9e('0x2d')](handleEntityNotFound(_0x305412,null))[_0xbd9e('0x2d')](function(_0x1f7102){if(_0x1f7102){return _0x1f7102['addAgents'](_0x542de9[_0xbd9e('0x53')]['ids'],_['omit'](_0x542de9[_0xbd9e('0x53')],['ids','id'])||{})[_0xbd9e('0x8f')](function(_0x2ad0fb){for(var _0x414612=0x0;_0x414612<_0x542de9[_0xbd9e('0x53')][_0xbd9e('0x6d')][_0xbd9e('0x4f')];_0x414612+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x542de9[_0xbd9e('0x53')][_0xbd9e('0x6d')][_0x414612]),'SmsQueueId':Number(_0x542de9[_0xbd9e('0x4c')]['id'])});}return _0x2ad0fb;});}})[_0xbd9e('0x2d')](respondWithResult(_0x305412,null))[_0xbd9e('0x4a')](handleError(_0x305412,null));};exports[_0xbd9e('0x8c')]=function(_0x5523d8,_0x5e6a3a,_0x5bb364){return db[_0xbd9e('0x47')][_0xbd9e('0x51')]({'where':{'id':_0x5523d8[_0xbd9e('0x4c')]['id']}})[_0xbd9e('0x2d')](handleEntityNotFound(_0x5e6a3a,null))['then'](function(_0x3ae0c6){if(_0x3ae0c6){return _0x3ae0c6[_0xbd9e('0x8c')](_0x5523d8[_0xbd9e('0x37')][_0xbd9e('0x6d')])[_0xbd9e('0x2d')](function(){if(_[_0xbd9e('0x90')](_0x5523d8[_0xbd9e('0x37')]['ids'])){for(var _0x50ab05=0x0;_0x50ab05<_0x5523d8['query'][_0xbd9e('0x6d')][_0xbd9e('0x4f')];_0x50ab05+=0x1){socket[_0xbd9e('0x75')](_0xbd9e('0x8d'),{'UserId':Number(_0x5523d8[_0xbd9e('0x37')][_0xbd9e('0x6d')][_0x50ab05]),'SmsQueueId':Number(_0x5523d8[_0xbd9e('0x4c')]['id'])});}}else{socket[_0xbd9e('0x75')](_0xbd9e('0x8d'),{'UserId':Number(_0x5523d8['query'][_0xbd9e('0x6d')]),'SmsQueueId':Number(_0x5523d8[_0xbd9e('0x4c')]['id'])});}});}})[_0xbd9e('0x2d')](respondWithStatusCode(_0x5e6a3a,null))[_0xbd9e('0x4a')](handleError(_0x5e6a3a,null));};exports['getAgents']=function(_0x5634d1,_0x1f3a74,_0xa06b43){var _0xc58163={};var _0x5f0dfd={};var _0x353249;var _0x53e246;return db[_0xbd9e('0x47')]['findOne']({'where':{'id':_0x5634d1[_0xbd9e('0x4c')]['id']}})[_0xbd9e('0x2d')](handleEntityNotFound(_0x1f3a74,null))['then'](function(_0x371b8c){if(_0x371b8c){_0x353249=_0x371b8c;_0x5f0dfd['model']=_['keys'](db[_0xbd9e('0x5f')][_0xbd9e('0x4d')]);_0x5f0dfd[_0xbd9e('0x37')]=_['keys'](_0x5634d1[_0xbd9e('0x37')]);_0x5f0dfd['filters']=_['intersection'](_0x5f0dfd[_0xbd9e('0x3b')],_0x5f0dfd[_0xbd9e('0x37')]);_0xc58163[_0xbd9e('0x3c')]=_[_0xbd9e('0x3a')](_0x5f0dfd[_0xbd9e('0x3b')],qs[_0xbd9e('0x4e')](_0x5634d1[_0xbd9e('0x37')]['fields']));_0xc58163[_0xbd9e('0x3c')]=_0xc58163[_0xbd9e('0x3c')]['length']?_0xc58163[_0xbd9e('0x3c')]:_0x5f0dfd[_0xbd9e('0x3b')];_0xc58163[_0xbd9e('0x3f')]=qs[_0xbd9e('0x40')](_0x5634d1[_0xbd9e('0x37')]['sort']);_0xc58163['where']=qs[_0xbd9e('0x39')](_[_0xbd9e('0x42')](_0x5634d1['query'],_0x5f0dfd[_0xbd9e('0x39')]));if(_0x5634d1[_0xbd9e('0x37')][_0xbd9e('0x43')]){_0xc58163['where']=_[_0xbd9e('0x45')](_0xc58163['where'],{'$or':_[_0xbd9e('0x36')](_0xc58163['attributes'],function(_0x50a665){var _0x3e9ba5={};_0x3e9ba5[_0x50a665]={'$like':'%'+_0x5634d1['query']['filter']+'%'};return _0x3e9ba5;})});}_0xc58163=_[_0xbd9e('0x45')]({},_0xc58163,_0x5634d1['options']);return _0x353249[_0xbd9e('0x91')](_0xc58163);}})['then'](function(_0x1646c0){if(_0x1646c0){_0x53e246=_0x1646c0[_0xbd9e('0x4f')];if(!_0x5634d1[_0xbd9e('0x37')][_0xbd9e('0x5d')]('nolimit')){_0xc58163['limit']=qs[_0xbd9e('0x3e')](_0x5634d1['query']['limit']);_0xc58163['offset']=qs[_0xbd9e('0x25')](_0x5634d1['query'][_0xbd9e('0x25')]);}return _0x353249[_0xbd9e('0x91')](_0xc58163);}})[_0xbd9e('0x2d')](function(_0x19a7e2){if(_0x19a7e2){return _0x19a7e2?{'count':_0x53e246,'rows':_0x19a7e2}:null;}})[_0xbd9e('0x2d')](respondWithResult(_0x1f3a74,null))[_0xbd9e('0x4a')](handleError(_0x1f3a74,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ad34c04..f51037c 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 _0x10c4=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x10c4,0x1d9));var _0x410c=function(_0x26e768,_0x404a35){_0x26e768=_0x26e768-0x0;var _0x16d80d=_0x10c4[_0x26e768];return _0x16d80d;};'use strict';var EventEmitter=require(_0x410c('0x0'));var SmsQueue=require(_0x410c('0x1'))['db'][_0x410c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x410c('0x3')](0x0);var events={'afterCreate':_0x410c('0x4'),'afterUpdate':_0x410c('0x5'),'afterDestroy':_0x410c('0x6')};function emitEvent(_0x26b4f1){return function(_0x1cb058,_0x4b9300,_0xeeff18){SmsQueueEvents[_0x410c('0x7')](_0x26b4f1+':'+_0x1cb058['id'],_0x1cb058);SmsQueueEvents['emit'](_0x26b4f1,_0x1cb058);_0xeeff18(null);};}for(var e in events){if(events[_0x410c('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x410c('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xedc4=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x44ced5,_0x4d0291){var _0x46ace2=function(_0x142cd6){while(--_0x142cd6){_0x44ced5['push'](_0x44ced5['shift']());}};_0x46ace2(++_0x4d0291);}(_0xedc4,0x1de));var _0x4edc=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xedc4[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x4edc('0x0'));var SmsQueue=require(_0x4edc('0x1'))['db'][_0x4edc('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4edc('0x3')](0x0);var events={'afterCreate':_0x4edc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x544370){return function(_0x39f180,_0x335fd0,_0x6240b4){SmsQueueEvents[_0x4edc('0x5')](_0x544370+':'+_0x39f180['id'],_0x39f180);SmsQueueEvents[_0x4edc('0x5')](_0x544370,_0x39f180);_0x6240b4(null);};}for(var e in events){if(events[_0x4edc('0x6')](e)){var event=events[e];SmsQueue[_0x4edc('0x7')](e,emitEvent(event));}}module[_0x4edc('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 1b5180e..a17ab5b 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 _0x3b08=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x19e780,_0x36ee25){var _0x399031=function(_0x27c4d2){while(--_0x27c4d2){_0x19e780['push'](_0x19e780['shift']());}};_0x399031(++_0x36ee25);}(_0x3b08,0x1b2));var _0x83b0=function(_0x2aeafc,_0x2109a0){_0x2aeafc=_0x2aeafc-0x0;var _0x1c8387=_0x3b08[_0x2aeafc];return _0x1c8387;};'use strict';var _=require(_0x83b0('0x0'));var util=require('util');var logger=require(_0x83b0('0x1'))(_0x83b0('0x2'));var moment=require(_0x83b0('0x3'));var BPromise=require(_0x83b0('0x4'));var rp=require(_0x83b0('0x5'));var fs=require('fs');var path=require(_0x83b0('0x6'));var rimraf=require('rimraf');var config=require(_0x83b0('0x7'));var attributes=require(_0x83b0('0x8'));module[_0x83b0('0x9')]=function(_0x1591d3,_0x366e6d){return _0x1591d3[_0x83b0('0xa')](_0x83b0('0xb'),attributes,{'tableName':_0x83b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1879=['request-promise','path','rimraf','../../config/environment','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5f042e,_0x4c4a69){var _0x41b98a=function(_0x268323){while(--_0x268323){_0x5f042e['push'](_0x5f042e['shift']());}};_0x41b98a(++_0x4c4a69);}(_0x1879,0x19e));var _0x9187=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0x1879[_0x131585];return _0x1fcca2;};'use strict';var _=require(_0x9187('0x0'));var util=require(_0x9187('0x1'));var logger=require(_0x9187('0x2'))(_0x9187('0x3'));var moment=require(_0x9187('0x4'));var BPromise=require(_0x9187('0x5'));var rp=require(_0x9187('0x6'));var fs=require('fs');var path=require(_0x9187('0x7'));var rimraf=require(_0x9187('0x8'));var config=require(_0x9187('0x9'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x196d1b,_0x276a7e){return _0x196d1b['define'](_0x9187('0xa'),attributes,{'tableName':_0x9187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index ef17188..fea5167 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 _0x1cb2=['jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x1cb2,0x10e));var _0x21cb=function(_0x14da95,_0x190974){_0x14da95=_0x14da95-0x0;var _0x16e730=_0x1cb2[_0x14da95];return _0x16e730;};'use strict';var _=require(_0x21cb('0x0'));var util=require(_0x21cb('0x1'));var moment=require(_0x21cb('0x2'));var BPromise=require(_0x21cb('0x3'));var rs=require(_0x21cb('0x4'));var fs=require('fs');var Redis=require(_0x21cb('0x5'));var db=require(_0x21cb('0x6'))['db'];var utils=require(_0x21cb('0x7'));var logger=require('../../config/logger')(_0x21cb('0x8'));var config=require(_0x21cb('0x9'));var jayson=require(_0x21cb('0xa'));var client=jayson[_0x21cb('0xb')][_0x21cb('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x21cb('0xd')],{'host':_0x21cb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21cb('0xd')]));require(_0x21cb('0xf'))[_0x21cb('0x10')](socket);function respondWithRpcPromise(_0x28b21c,_0x4539d9,_0x22781b){return new BPromise(function(_0x1c2b61,_0x531927){return client['request'](_0x28b21c,_0x22781b)['then'](function(_0x3d4e15){logger[_0x21cb('0x11')](_0x21cb('0x12'),_0x4539d9,_0x21cb('0x13'));logger[_0x21cb('0x14')](_0x21cb('0x15'),_0x4539d9,'request\x20sent',JSON['stringify'](_0x3d4e15));if(_0x3d4e15[_0x21cb('0x16')]){if(_0x3d4e15[_0x21cb('0x16')]['code']===0x1f4){logger[_0x21cb('0x16')](_0x21cb('0x12'),_0x4539d9,_0x3d4e15[_0x21cb('0x16')][_0x21cb('0x17')]);return _0x531927(_0x3d4e15[_0x21cb('0x16')][_0x21cb('0x17')]);}logger[_0x21cb('0x16')](_0x21cb('0x12'),_0x4539d9,_0x3d4e15['error'][_0x21cb('0x17')]);return _0x1c2b61(_0x3d4e15['error'][_0x21cb('0x17')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x4539d9,_0x21cb('0x13'));_0x1c2b61(_0x3d4e15['result'][_0x21cb('0x17')]);}})[_0x21cb('0x18')](function(_0x3d088b){logger[_0x21cb('0x16')](_0x21cb('0x12'),_0x4539d9,_0x3d088b);_0x531927(_0x3d088b);});});}exports[_0x21cb('0x19')]=function(_0x1390d0){var _0x43f66f=this;return new Promise(function(_0x4e9980,_0x151637){return db[_0x21cb('0x1a')][_0x21cb('0x1b')]({'raw':_0x1390d0[_0x21cb('0x1c')]?_0x1390d0[_0x21cb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1390d0[_0x21cb('0x1c')]?_0x1390d0[_0x21cb('0x1c')][_0x21cb('0x1d')]||null:null,'attributes':_0x1390d0[_0x21cb('0x1c')]?_0x1390d0[_0x21cb('0x1c')][_0x21cb('0x1e')]||null:null,'limit':_0x1390d0['options']?_0x1390d0[_0x21cb('0x1c')][_0x21cb('0x1f')]||null:null,'include':_0x1390d0[_0x21cb('0x1c')]?_0x1390d0['options'][_0x21cb('0x20')]?_[_0x21cb('0x21')](_0x1390d0[_0x21cb('0x1c')][_0x21cb('0x20')],function(_0x485e43){return{'model':db[_0x485e43[_0x21cb('0x22')]],'as':_0x485e43['as'],'attributes':_0x485e43[_0x21cb('0x1e')],'include':_0x485e43[_0x21cb('0x20')]?_[_0x21cb('0x21')](_0x485e43['include'],function(_0x16a244){return{'model':db[_0x16a244[_0x21cb('0x22')]],'as':_0x16a244['as'],'attributes':_0x16a244[_0x21cb('0x1e')],'include':_0x16a244[_0x21cb('0x20')]?_[_0x21cb('0x21')](_0x16a244[_0x21cb('0x20')],function(_0x1d7df4){return{'model':db[_0x1d7df4[_0x21cb('0x22')]],'as':_0x1d7df4['as'],'attributes':_0x1d7df4['attributes']};}):[]};}):[]};}):[]:[]})[_0x21cb('0x23')](function(_0x1ad7c5){logger['info'](_0x21cb('0x19'),_0x1390d0);logger['debug'](_0x21cb('0x19'),_0x1390d0,JSON[_0x21cb('0x24')](_0x1ad7c5));_0x4e9980(_0x1ad7c5);})[_0x21cb('0x18')](function(_0x407521){logger[_0x21cb('0x16')](_0x21cb('0x19'),_0x407521[_0x21cb('0x17')],_0x1390d0);_0x151637(_0x43f66f['error'](0x1f4,_0x407521['message']));});});};exports[_0x21cb('0x25')]=function(_0x2923b7){var _0x48c7c8=this;return new Promise(function(_0x46d888,_0x178371){return db[_0x21cb('0x1a')][_0x21cb('0x26')]({'raw':_0x2923b7[_0x21cb('0x1c')]?_0x2923b7[_0x21cb('0x1c')][_0x21cb('0x27')]===undefined?!![]:![]:!![],'where':_0x2923b7[_0x21cb('0x1c')]?_0x2923b7[_0x21cb('0x1c')][_0x21cb('0x1d')]||null:null,'attributes':_0x2923b7[_0x21cb('0x1c')]?_0x2923b7[_0x21cb('0x1c')][_0x21cb('0x1e')]||null:null,'include':_0x2923b7[_0x21cb('0x1c')]?_0x2923b7[_0x21cb('0x1c')][_0x21cb('0x20')]?_[_0x21cb('0x21')](_0x2923b7['options'][_0x21cb('0x20')],function(_0x4e1a3a){return{'model':db[_0x4e1a3a[_0x21cb('0x22')]],'as':_0x4e1a3a['as'],'attributes':_0x4e1a3a[_0x21cb('0x1e')],'include':_0x4e1a3a['include']?_[_0x21cb('0x21')](_0x4e1a3a[_0x21cb('0x20')],function(_0x523542){return{'model':db[_0x523542[_0x21cb('0x22')]],'as':_0x523542['as'],'attributes':_0x523542['attributes'],'include':_0x523542[_0x21cb('0x20')]?_[_0x21cb('0x21')](_0x523542['include'],function(_0x16fc01){return{'model':db[_0x16fc01[_0x21cb('0x22')]],'as':_0x16fc01['as'],'attributes':_0x16fc01[_0x21cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x21cb('0x23')](function(_0x7f9d43){logger[_0x21cb('0x11')](_0x21cb('0x25'),_0x2923b7);logger[_0x21cb('0x14')](_0x21cb('0x25'),_0x2923b7,JSON['stringify'](_0x7f9d43));_0x46d888(_0x7f9d43);})[_0x21cb('0x18')](function(_0x25f3ab){logger[_0x21cb('0x16')]('ShowSmsQueue',_0x25f3ab[_0x21cb('0x17')],_0x2923b7);_0x178371(_0x48c7c8[_0x21cb('0x16')](0x1f4,_0x25f3ab[_0x21cb('0x17')]));});});}; \ No newline at end of file +var _0xbb94=['then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','map','model','include','debug','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request'];(function(_0xa3174a,_0x414885){var _0x194500=function(_0x483de5){while(--_0x483de5){_0xa3174a['push'](_0xa3174a['shift']());}};_0x194500(++_0x414885);}(_0xbb94,0xc0));var _0x4bb9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbb94[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4bb9('0x0'));var util=require('util');var moment=require(_0x4bb9('0x1'));var BPromise=require(_0x4bb9('0x2'));var rs=require(_0x4bb9('0x3'));var fs=require('fs');var Redis=require(_0x4bb9('0x4'));var db=require(_0x4bb9('0x5'))['db'];var utils=require(_0x4bb9('0x6'));var logger=require(_0x4bb9('0x7'))(_0x4bb9('0x8'));var config=require(_0x4bb9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4bb9('0xa')][_0x4bb9('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4bb9('0xc')],{'host':_0x4bb9('0xd'),'port':0x18eb});var socket=require(_0x4bb9('0xe'))(new Redis(config[_0x4bb9('0xc')]));require(_0x4bb9('0xf'))[_0x4bb9('0x10')](socket);function respondWithRpcPromise(_0x34e86e,_0xfb95f3,_0x492e58){return new BPromise(function(_0x64c01b,_0x4f9b24){return client[_0x4bb9('0x11')](_0x34e86e,_0x492e58)[_0x4bb9('0x12')](function(_0x4c603){logger['info'](_0x4bb9('0x13'),_0xfb95f3,_0x4bb9('0x14'));logger['debug'](_0x4bb9('0x15'),_0xfb95f3,'request\x20sent',JSON[_0x4bb9('0x16')](_0x4c603));if(_0x4c603[_0x4bb9('0x17')]){if(_0x4c603[_0x4bb9('0x17')][_0x4bb9('0x18')]===0x1f4){logger['error'](_0x4bb9('0x13'),_0xfb95f3,_0x4c603[_0x4bb9('0x17')][_0x4bb9('0x19')]);return _0x4f9b24(_0x4c603['error'][_0x4bb9('0x19')]);}logger[_0x4bb9('0x17')]('SmsQueue,\x20%s,\x20%s',_0xfb95f3,_0x4c603['error'][_0x4bb9('0x19')]);return _0x64c01b(_0x4c603['error'][_0x4bb9('0x19')]);}else{logger[_0x4bb9('0x1a')](_0x4bb9('0x13'),_0xfb95f3,_0x4bb9('0x14'));_0x64c01b(_0x4c603[_0x4bb9('0x1b')][_0x4bb9('0x19')]);}})[_0x4bb9('0x1c')](function(_0x329bdd){logger[_0x4bb9('0x17')]('SmsQueue,\x20%s,\x20%s',_0xfb95f3,_0x329bdd);_0x4f9b24(_0x329bdd);});});}exports[_0x4bb9('0x1d')]=function(_0x92386e){var _0x3a2d5c=this;return new Promise(function(_0x445a19,_0x27bf79){return db[_0x4bb9('0x1e')][_0x4bb9('0x1f')]({'raw':_0x92386e[_0x4bb9('0x20')]?_0x92386e[_0x4bb9('0x20')][_0x4bb9('0x21')]===undefined?!![]:![]:!![],'where':_0x92386e[_0x4bb9('0x20')]?_0x92386e[_0x4bb9('0x20')][_0x4bb9('0x22')]||null:null,'attributes':_0x92386e[_0x4bb9('0x20')]?_0x92386e[_0x4bb9('0x20')][_0x4bb9('0x23')]||null:null,'limit':_0x92386e[_0x4bb9('0x20')]?_0x92386e[_0x4bb9('0x20')]['limit']||null:null,'include':_0x92386e['options']?_0x92386e[_0x4bb9('0x20')]['include']?_[_0x4bb9('0x24')](_0x92386e[_0x4bb9('0x20')]['include'],function(_0x5841aa){return{'model':db[_0x5841aa[_0x4bb9('0x25')]],'as':_0x5841aa['as'],'attributes':_0x5841aa[_0x4bb9('0x23')],'include':_0x5841aa[_0x4bb9('0x26')]?_['map'](_0x5841aa['include'],function(_0x3ffd68){return{'model':db[_0x3ffd68[_0x4bb9('0x25')]],'as':_0x3ffd68['as'],'attributes':_0x3ffd68[_0x4bb9('0x23')],'include':_0x3ffd68[_0x4bb9('0x26')]?_[_0x4bb9('0x24')](_0x3ffd68[_0x4bb9('0x26')],function(_0x1e63d7){return{'model':db[_0x1e63d7[_0x4bb9('0x25')]],'as':_0x1e63d7['as'],'attributes':_0x1e63d7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2db41f){logger[_0x4bb9('0x1a')](_0x4bb9('0x1d'),_0x92386e);logger[_0x4bb9('0x27')](_0x4bb9('0x1d'),_0x92386e,JSON[_0x4bb9('0x16')](_0x2db41f));_0x445a19(_0x2db41f);})[_0x4bb9('0x1c')](function(_0x1a57b5){logger['error']('GetSmsQueue',_0x1a57b5['message'],_0x92386e);_0x27bf79(_0x3a2d5c[_0x4bb9('0x17')](0x1f4,_0x1a57b5[_0x4bb9('0x19')]));});});};exports[_0x4bb9('0x28')]=function(_0x35e1c1){var _0x960708=this;return new Promise(function(_0x530154,_0x4acb8e){return db['SmsQueue'][_0x4bb9('0x29')]({'raw':_0x35e1c1['options']?_0x35e1c1[_0x4bb9('0x20')][_0x4bb9('0x21')]===undefined?!![]:![]:!![],'where':_0x35e1c1[_0x4bb9('0x20')]?_0x35e1c1[_0x4bb9('0x20')][_0x4bb9('0x22')]||null:null,'attributes':_0x35e1c1['options']?_0x35e1c1[_0x4bb9('0x20')][_0x4bb9('0x23')]||null:null,'include':_0x35e1c1[_0x4bb9('0x20')]?_0x35e1c1[_0x4bb9('0x20')]['include']?_[_0x4bb9('0x24')](_0x35e1c1[_0x4bb9('0x20')][_0x4bb9('0x26')],function(_0x12324a){return{'model':db[_0x12324a[_0x4bb9('0x25')]],'as':_0x12324a['as'],'attributes':_0x12324a[_0x4bb9('0x23')],'include':_0x12324a[_0x4bb9('0x26')]?_['map'](_0x12324a[_0x4bb9('0x26')],function(_0x2cfe88){return{'model':db[_0x2cfe88['model']],'as':_0x2cfe88['as'],'attributes':_0x2cfe88['attributes'],'include':_0x2cfe88[_0x4bb9('0x26')]?_['map'](_0x2cfe88[_0x4bb9('0x26')],function(_0x72fac6){return{'model':db[_0x72fac6[_0x4bb9('0x25')]],'as':_0x72fac6['as'],'attributes':_0x72fac6[_0x4bb9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4bb9('0x12')](function(_0xb2a159){logger['info'](_0x4bb9('0x28'),_0x35e1c1);logger['debug']('ShowSmsQueue',_0x35e1c1,JSON[_0x4bb9('0x16')](_0xb2a159));_0x530154(_0xb2a159);})[_0x4bb9('0x1c')](function(_0x67ea92){logger['error']('ShowSmsQueue',_0x67ea92[_0x4bb9('0x19')],_0x35e1c1);_0x4acb8e(_0x960708['error'](0x1f4,_0x67ea92[_0x4bb9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9e99d24..be9d9b8 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 _0xf363=['length','save','remove','emit','removeListener','register'];(function(_0x273b7f,_0x225e20){var _0x14c1a0=function(_0x530fcb){while(--_0x530fcb){_0x273b7f['push'](_0x273b7f['shift']());}};_0x14c1a0(++_0x225e20);}(_0xf363,0x151));var _0x3f36=function(_0x5f0110,_0x2381fd){_0x5f0110=_0x5f0110-0x0;var _0x5d7df7=_0xf363[_0x5f0110];return _0x5d7df7;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x3f36('0x0'),_0x3f36('0x1'),'update'];function createListener(_0x31e9f0,_0x8efd4f){return function(_0x2cef2d){_0x8efd4f[_0x3f36('0x2')](_0x31e9f0,_0x2cef2d);};}function removeListener(_0x2ee5aa,_0x5f3bec){return function(){SmsQueueEvents[_0x3f36('0x3')](_0x2ee5aa,_0x5f3bec);};}exports[_0x3f36('0x4')]=function(_0x3db8d5){for(var _0xd71eac=0x0,_0x470fa0=events[_0x3f36('0x5')];_0xd71eac<_0x470fa0;_0xd71eac++){var _0x3651ed=events[_0xd71eac];var _0x1d853a=createListener('smsQueue:'+_0x3651ed,_0x3db8d5);SmsQueueEvents['on'](_0x3651ed,_0x1d853a);}}; \ No newline at end of file +var _0xef19=['./smsQueue.events','remove','removeListener','register','length'];(function(_0x1ff33a,_0x1daf36){var _0x809abd=function(_0x386fe4){while(--_0x386fe4){_0x1ff33a['push'](_0x1ff33a['shift']());}};_0x809abd(++_0x1daf36);}(_0xef19,0xbe));var _0x9ef1=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xef19[_0x5466ab];return _0x40751a;};'use strict';var SmsQueueEvents=require(_0x9ef1('0x0'));var events=['save',_0x9ef1('0x1'),'update'];function createListener(_0x5d8687,_0x625ecf){return function(_0x22cc87){_0x625ecf['emit'](_0x5d8687,_0x22cc87);};}function removeListener(_0x255892,_0x19cf06){return function(){SmsQueueEvents[_0x9ef1('0x2')](_0x255892,_0x19cf06);};}exports[_0x9ef1('0x3')]=function(_0x2fe9ff){for(var _0x41f2a3=0x0,_0x1e8ed8=events[_0x9ef1('0x4')];_0x41f2a3<_0x1e8ed8;_0x41f2a3++){var _0xe8362a=events[_0x41f2a3];var _0x405e13=createListener('smsQueue:'+_0xe8362a,_0x2fe9ff);SmsQueueEvents['on'](_0xe8362a,_0x405e13);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8210181..bd11b53 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 _0x1987=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x3f55bd,_0x4b8424){var _0x3f9759=function(_0x161618){while(--_0x161618){_0x3f55bd['push'](_0x3f55bd['shift']());}};_0x3f9759(++_0x4b8424);}(_0x1987,0x1cd));var _0x7198=function(_0x4cee04,_0x173bb5){_0x4cee04=_0x4cee04-0x0;var _0x27b1c3=_0x1987[_0x4cee04];return _0x27b1c3;};'use strict';var multer=require('multer');var util=require(_0x7198('0x0'));var path=require(_0x7198('0x1'));var timeout=require(_0x7198('0x2'));var express=require('express');var router=express[_0x7198('0x3')]();var fs_extra=require(_0x7198('0x4'));var auth=require(_0x7198('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7198('0x6'));var controller=require('./smsQueueReport.controller');router[_0x7198('0x7')]('/',auth[_0x7198('0x8')](),controller[_0x7198('0x9')]);router[_0x7198('0x7')](_0x7198('0xa'),auth[_0x7198('0x8')](),controller[_0x7198('0xb')]);router[_0x7198('0x7')](_0x7198('0xc'),auth[_0x7198('0x8')](),controller['show']);router[_0x7198('0xd')]('/',auth['isAuthenticated'](),controller[_0x7198('0xe')]);router[_0x7198('0xf')]('/:id',auth[_0x7198('0x8')](),controller[_0x7198('0x10')]);router[_0x7198('0x11')](_0x7198('0xc'),auth[_0x7198('0x8')](),controller[_0x7198('0x12')]);module[_0x7198('0x13')]=router; \ No newline at end of file +var _0x2e1a=['update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put'];(function(_0x5c4702,_0xba509){var _0x572304=function(_0x2e0507){while(--_0x2e0507){_0x5c4702['push'](_0x5c4702['shift']());}};_0x572304(++_0xba509);}(_0x2e1a,0xd6));var _0xa2e1=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x2e1a[_0x1f7413];return _0x2d2775;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa2e1('0x0'));var timeout=require(_0xa2e1('0x1'));var express=require('express');var router=express[_0xa2e1('0x2')]();var fs_extra=require(_0xa2e1('0x3'));var auth=require(_0xa2e1('0x4'));var interaction=require(_0xa2e1('0x5'));var config=require(_0xa2e1('0x6'));var controller=require(_0xa2e1('0x7'));router[_0xa2e1('0x8')]('/',auth['isAuthenticated'](),controller[_0xa2e1('0x9')]);router[_0xa2e1('0x8')](_0xa2e1('0xa'),auth[_0xa2e1('0xb')](),controller[_0xa2e1('0xc')]);router['get'](_0xa2e1('0xd'),auth[_0xa2e1('0xb')](),controller[_0xa2e1('0xe')]);router[_0xa2e1('0xf')]('/',auth[_0xa2e1('0xb')](),controller['create']);router[_0xa2e1('0x10')](_0xa2e1('0xd'),auth[_0xa2e1('0xb')](),controller[_0xa2e1('0x11')]);router[_0xa2e1('0x12')](_0xa2e1('0xd'),auth[_0xa2e1('0xb')](),controller[_0xa2e1('0x13')]);module[_0xa2e1('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 027bd37..03b35ed 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 _0x3c0c=['moment','exports','STRING','DATE'];(function(_0x3c43dd,_0x468888){var _0xff058d=function(_0x49a22f){while(--_0x49a22f){_0x3c43dd['push'](_0x3c43dd['shift']());}};_0xff058d(++_0x468888);}(_0x3c0c,0x94));var _0xc3c0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3c0c[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xc3c0('0x0'));var Sequelize=require('sequelize');module[_0xc3c0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc3c0('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc3c0('0x3')]},'acceptAt':{'type':Sequelize[_0xc3c0('0x3')]},'exitAt':{'type':Sequelize[_0xc3c0('0x3')]},'reason':{'type':Sequelize[_0xc3c0('0x2')]}}; \ No newline at end of file +var _0x0260=['exports','STRING','DATE','moment','sequelize'];(function(_0x3a13c7,_0x4667f8){var _0x565321=function(_0x18b2d0){while(--_0x18b2d0){_0x3a13c7['push'](_0x3a13c7['shift']());}};_0x565321(++_0x4667f8);}(_0x0260,0x1d9));var _0x0026=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x0260[_0x243b59];return _0x3e1676;};'use strict';var moment=require(_0x0026('0x0'));var Sequelize=require(_0x0026('0x1'));module[_0x0026('0x2')]={'uniqueid':{'type':Sequelize[_0x0026('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0026('0x3')]},'joinAt':{'type':Sequelize[_0x0026('0x4')]},'leaveAt':{'type':Sequelize[_0x0026('0x4')]},'acceptAt':{'type':Sequelize[_0x0026('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0026('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f22ee0f..978b199 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 _0x2ac8=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','SmsQueueReport','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x28f503,_0x4c61ca){var _0x58121d=function(_0xfc2e3f){while(--_0xfc2e3f){_0x28f503['push'](_0x28f503['shift']());}};_0x58121d(++_0x4c61ca);}(_0x2ac8,0x80));var _0x82ac=function(_0x25c992,_0x40b204){_0x25c992=_0x25c992-0x0;var _0x36a731=_0x2ac8[_0x25c992];return _0x36a731;};'use strict';var emlformat=require(_0x82ac('0x0'));var rimraf=require(_0x82ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82ac('0x2'));var rp=require(_0x82ac('0x3'));var moment=require('moment');var BPromise=require(_0x82ac('0x4'));var Mustache=require('mustache');var util=require(_0x82ac('0x5'));var path=require('path');var sox=require(_0x82ac('0x6'));var csv=require(_0x82ac('0x7'));var ejs=require(_0x82ac('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82ac('0x9'));var squel=require('squel');var crypto=require(_0x82ac('0xa'));var jsforce=require(_0x82ac('0xb'));var deskjs=require(_0x82ac('0xc'));var toCsv=require('to-csv');var querystring=require(_0x82ac('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82ac('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x82ac('0xf'));var hardwareService=require(_0x82ac('0x10'));var logger=require('../../config/logger')(_0x82ac('0x11'));var utils=require(_0x82ac('0x12'));var config=require(_0x82ac('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82ac('0x14'))['db'];function respondWithStatusCode(_0x424b23,_0x4bf6e0){_0x4bf6e0=_0x4bf6e0||0xcc;return function(_0x12e8c4){if(_0x12e8c4){return _0x424b23['sendStatus'](_0x4bf6e0);}return _0x424b23[_0x82ac('0x15')](_0x4bf6e0)[_0x82ac('0x16')]();};}function respondWithResult(_0xc25ed4,_0x5780c7){_0x5780c7=_0x5780c7||0xc8;return function(_0x13c6bc){if(_0x13c6bc){return _0xc25ed4[_0x82ac('0x15')](_0x5780c7)[_0x82ac('0x17')](_0x13c6bc);}};}function respondWithFilteredResult(_0xa8bce7,_0x584152){return function(_0x5dbbb8){if(_0x5dbbb8){var _0x5d411f=typeof _0x584152[_0x82ac('0x18')]===_0x82ac('0x19')&&typeof _0x584152[_0x82ac('0x1a')]===_0x82ac('0x19');var _0x5d47e3=_0x5dbbb8[_0x82ac('0x1b')];var _0x3c11ca=_0x5d411f?0x0:_0x584152['offset'];var _0x410d48=_0x5d411f?_0x5dbbb8[_0x82ac('0x1b')]:_0x584152[_0x82ac('0x18')]+_0x584152[_0x82ac('0x1a')];var _0x327e33;if(_0x410d48>=_0x5d47e3){_0x410d48=_0x5d47e3;_0x327e33=0xc8;}else{_0x327e33=0xce;}_0xa8bce7[_0x82ac('0x15')](_0x327e33);return _0xa8bce7[_0x82ac('0x1c')](_0x82ac('0x1d'),_0x3c11ca+'-'+_0x410d48+'/'+_0x5d47e3)[_0x82ac('0x17')](_0x5dbbb8);}return null;};}function patchUpdates(_0x4e5926){return function(_0x3f7b9a){try{jsonpatch[_0x82ac('0x1e')](_0x3f7b9a,_0x4e5926,!![]);}catch(_0x38dc0d){return BPromise[_0x82ac('0x1f')](_0x38dc0d);}return _0x3f7b9a[_0x82ac('0x20')]();};}function saveUpdates(_0x1e257e,_0x56685e){return function(_0x588d9f){if(_0x588d9f){return _0x588d9f[_0x82ac('0x21')](_0x1e257e)['then'](function(_0x60e89a){return _0x60e89a;});}return null;};}function removeEntity(_0x4e77c,_0x225985){return function(_0x1d3555){if(_0x1d3555){return _0x1d3555[_0x82ac('0x22')]()[_0x82ac('0x23')](function(){_0x4e77c[_0x82ac('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x181776,_0x23142f){return function(_0x3240e0){if(!_0x3240e0){_0x181776[_0x82ac('0x24')](0x194);}return _0x3240e0;};}function handleError(_0x13d08d,_0x22589d){_0x22589d=_0x22589d||0x1f4;return function(_0x36c187){logger[_0x82ac('0x25')](_0x36c187[_0x82ac('0x26')]);if(_0x36c187[_0x82ac('0x27')]){delete _0x36c187['name'];}_0x13d08d[_0x82ac('0x15')](_0x22589d)[_0x82ac('0x28')](_0x36c187);};}exports[_0x82ac('0x29')]=function(_0x264f4b,_0x1a7f52){var _0x455554={},_0x5ecb9c={},_0x2d8942={'count':0x0,'rows':[]};var _0x2a1a72=_['map'](db['SmsQueueReport'][_0x82ac('0x2a')],function(_0x3120dc){return{'name':_0x3120dc[_0x82ac('0x2b')],'type':_0x3120dc[_0x82ac('0x2c')][_0x82ac('0x2d')]};});_0x5ecb9c[_0x82ac('0x2e')]=_[_0x82ac('0x2f')](_0x2a1a72,_0x82ac('0x27'));_0x5ecb9c[_0x82ac('0x30')]=_['keys'](_0x264f4b['query']);_0x5ecb9c['filters']=_[_0x82ac('0x31')](_0x5ecb9c[_0x82ac('0x2e')],_0x5ecb9c[_0x82ac('0x30')]);_0x455554['attributes']=_[_0x82ac('0x31')](_0x5ecb9c[_0x82ac('0x2e')],qs[_0x82ac('0x32')](_0x264f4b[_0x82ac('0x30')]['fields']));_0x455554[_0x82ac('0x33')]=_0x455554['attributes']['length']?_0x455554[_0x82ac('0x33')]:_0x5ecb9c[_0x82ac('0x2e')];if(!_0x264f4b['query'][_0x82ac('0x34')](_0x82ac('0x35'))){_0x455554[_0x82ac('0x1a')]=qs[_0x82ac('0x1a')](_0x264f4b[_0x82ac('0x30')][_0x82ac('0x1a')]);_0x455554[_0x82ac('0x18')]=qs['offset'](_0x264f4b[_0x82ac('0x30')][_0x82ac('0x18')]);}_0x455554[_0x82ac('0x36')]=qs[_0x82ac('0x37')](_0x264f4b[_0x82ac('0x30')][_0x82ac('0x37')]);_0x455554['where']=qs[_0x82ac('0x38')](_[_0x82ac('0x39')](_0x264f4b[_0x82ac('0x30')],_0x5ecb9c['filters']),_0x2a1a72);if(_0x264f4b[_0x82ac('0x30')][_0x82ac('0x3a')]){_0x455554['where']=_[_0x82ac('0x3b')](_0x455554[_0x82ac('0x3c')],{'$or':_[_0x82ac('0x2f')](_0x2a1a72,function(_0x48c0ba){if(_0x48c0ba[_0x82ac('0x2c')]!=='VIRTUAL'){var _0x24da3a={};_0x24da3a[_0x48c0ba['name']]={'$like':'%'+_0x264f4b['query']['filter']+'%'};return _0x24da3a;}})});}_0x455554=_[_0x82ac('0x3b')]({},_0x455554,_0x264f4b[_0x82ac('0x3d')]);var _0xee1e85={'where':_0x455554[_0x82ac('0x3c')]};return db[_0x82ac('0x3e')][_0x82ac('0x1b')](_0xee1e85)[_0x82ac('0x23')](function(_0x9502d5){_0x2d8942[_0x82ac('0x1b')]=_0x9502d5;if(_0x264f4b['query']['includeAll']){_0x455554[_0x82ac('0x3f')]=[{'all':!![]}];}return db[_0x82ac('0x3e')][_0x82ac('0x40')](_0x455554);})['then'](function(_0x1b7855){_0x2d8942['rows']=_0x1b7855;return _0x2d8942;})[_0x82ac('0x23')](respondWithFilteredResult(_0x1a7f52,_0x455554))[_0x82ac('0x41')](handleError(_0x1a7f52,null));};exports[_0x82ac('0x42')]=function(_0x2f1fdb,_0xc04789){var _0x265c72={'raw':!![],'where':{'id':_0x2f1fdb[_0x82ac('0x43')]['id']}},_0x553cc5={};_0x553cc5[_0x82ac('0x2e')]=_['keys'](db['SmsQueueReport'][_0x82ac('0x2a')]);_0x553cc5['query']=_[_0x82ac('0x44')](_0x2f1fdb['query']);_0x553cc5[_0x82ac('0x38')]=_[_0x82ac('0x31')](_0x553cc5[_0x82ac('0x2e')],_0x553cc5[_0x82ac('0x30')]);_0x265c72[_0x82ac('0x33')]=_['intersection'](_0x553cc5[_0x82ac('0x2e')],qs['fields'](_0x2f1fdb[_0x82ac('0x30')][_0x82ac('0x32')]));_0x265c72[_0x82ac('0x33')]=_0x265c72[_0x82ac('0x33')][_0x82ac('0x45')]?_0x265c72[_0x82ac('0x33')]:_0x553cc5[_0x82ac('0x2e')];if(_0x2f1fdb[_0x82ac('0x30')][_0x82ac('0x46')]){_0x265c72[_0x82ac('0x3f')]=[{'all':!![]}];}_0x265c72=_['merge']({},_0x265c72,_0x2f1fdb['options']);return db[_0x82ac('0x3e')][_0x82ac('0x47')](_0x265c72)[_0x82ac('0x23')](handleEntityNotFound(_0xc04789,null))[_0x82ac('0x23')](respondWithResult(_0xc04789,null))[_0x82ac('0x41')](handleError(_0xc04789,null));};exports[_0x82ac('0x48')]=function(_0x1c3393,_0x222494){return db['SmsQueueReport'][_0x82ac('0x48')](_0x1c3393[_0x82ac('0x49')],{})[_0x82ac('0x23')](respondWithResult(_0x222494,0xc9))[_0x82ac('0x41')](handleError(_0x222494,null));};exports['update']=function(_0x354958,_0x4eb6ee){if(_0x354958['body']['id']){delete _0x354958[_0x82ac('0x49')]['id'];}return db['SmsQueueReport'][_0x82ac('0x47')]({'where':{'id':_0x354958[_0x82ac('0x43')]['id']}})['then'](handleEntityNotFound(_0x4eb6ee,null))[_0x82ac('0x23')](saveUpdates(_0x354958[_0x82ac('0x49')],null))[_0x82ac('0x23')](respondWithResult(_0x4eb6ee,null))[_0x82ac('0x41')](handleError(_0x4eb6ee,null));};exports[_0x82ac('0x22')]=function(_0x4f4643,_0x1ea9e6){return db['SmsQueueReport'][_0x82ac('0x47')]({'where':{'id':_0x4f4643[_0x82ac('0x43')]['id']}})[_0x82ac('0x23')](handleEntityNotFound(_0x1ea9e6,null))[_0x82ac('0x23')](removeEntity(_0x1ea9e6,null))[_0x82ac('0x41')](handleError(_0x1ea9e6,null));};exports[_0x82ac('0x4a')]=function(_0x3d2921,_0x5111a0){return db[_0x82ac('0x3e')]['describe']()[_0x82ac('0x23')](respondWithResult(_0x5111a0,null))[_0x82ac('0x41')](handleError(_0x5111a0,null));}; \ No newline at end of file +var _0xab03=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','reject','save','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x41f10d,_0x328378){var _0x2dae61=function(_0x4b8522){while(--_0x4b8522){_0x41f10d['push'](_0x41f10d['shift']());}};_0x2dae61(++_0x328378);}(_0xab03,0xca));var _0x3ab0=function(_0x143047,_0x36cb1c){_0x143047=_0x143047-0x0;var _0x2d00fd=_0xab03[_0x143047];return _0x2d00fd;};'use strict';var emlformat=require(_0x3ab0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ab0('0x1'));var rp=require('request-promise');var moment=require(_0x3ab0('0x2'));var BPromise=require(_0x3ab0('0x3'));var Mustache=require(_0x3ab0('0x4'));var util=require(_0x3ab0('0x5'));var path=require('path');var sox=require(_0x3ab0('0x6'));var csv=require(_0x3ab0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ab0('0x8'));var _=require(_0x3ab0('0x9'));var squel=require('squel');var crypto=require(_0x3ab0('0xa'));var jsforce=require(_0x3ab0('0xb'));var deskjs=require(_0x3ab0('0xc'));var toCsv=require(_0x3ab0('0x7'));var querystring=require(_0x3ab0('0xd'));var Papa=require(_0x3ab0('0xe'));var Redis=require(_0x3ab0('0xf'));var authService=require(_0x3ab0('0x10'));var qs=require(_0x3ab0('0x11'));var as=require(_0x3ab0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ab0('0x13'))(_0x3ab0('0x14'));var utils=require(_0x3ab0('0x15'));var config=require(_0x3ab0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b070f,_0x22511f){_0x22511f=_0x22511f||0xcc;return function(_0x3d7970){if(_0x3d7970){return _0x4b070f[_0x3ab0('0x17')](_0x22511f);}return _0x4b070f[_0x3ab0('0x18')](_0x22511f)[_0x3ab0('0x19')]();};}function respondWithResult(_0x2287d4,_0x5b109d){_0x5b109d=_0x5b109d||0xc8;return function(_0x593669){if(_0x593669){return _0x2287d4[_0x3ab0('0x18')](_0x5b109d)[_0x3ab0('0x1a')](_0x593669);}};}function respondWithFilteredResult(_0x3b3233,_0x41b001){return function(_0x2f39e2){if(_0x2f39e2){var _0x5f0841=typeof _0x41b001[_0x3ab0('0x1b')]==='undefined'&&typeof _0x41b001[_0x3ab0('0x1c')]==='undefined';var _0x16ed6f=_0x2f39e2[_0x3ab0('0x1d')];var _0x717350=_0x5f0841?0x0:_0x41b001[_0x3ab0('0x1b')];var _0x12dcf2=_0x5f0841?_0x2f39e2[_0x3ab0('0x1d')]:_0x41b001[_0x3ab0('0x1b')]+_0x41b001[_0x3ab0('0x1c')];var _0x4ce5c1;if(_0x12dcf2>=_0x16ed6f){_0x12dcf2=_0x16ed6f;_0x4ce5c1=0xc8;}else{_0x4ce5c1=0xce;}_0x3b3233['status'](_0x4ce5c1);return _0x3b3233['set']('Content-Range',_0x717350+'-'+_0x12dcf2+'/'+_0x16ed6f)['json'](_0x2f39e2);}return null;};}function patchUpdates(_0x489fa5){return function(_0x4a8b1a){try{jsonpatch['apply'](_0x4a8b1a,_0x489fa5,!![]);}catch(_0x485c90){return BPromise[_0x3ab0('0x1e')](_0x485c90);}return _0x4a8b1a[_0x3ab0('0x1f')]();};}function saveUpdates(_0x1c5f38,_0x3d007a){return function(_0xfa890f){if(_0xfa890f){return _0xfa890f['update'](_0x1c5f38)[_0x3ab0('0x20')](function(_0x396aa6){return _0x396aa6;});}return null;};}function removeEntity(_0x3d2b6f,_0x25179e){return function(_0x526fa7){if(_0x526fa7){return _0x526fa7['destroy']()[_0x3ab0('0x20')](function(){_0x3d2b6f[_0x3ab0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2126,_0x3a2731){return function(_0x21381e){if(!_0x21381e){_0x2c2126['sendStatus'](0x194);}return _0x21381e;};}function handleError(_0x55a469,_0x57ee76){_0x57ee76=_0x57ee76||0x1f4;return function(_0x38a932){logger[_0x3ab0('0x21')](_0x38a932[_0x3ab0('0x22')]);if(_0x38a932[_0x3ab0('0x23')]){delete _0x38a932[_0x3ab0('0x23')];}_0x55a469[_0x3ab0('0x18')](_0x57ee76)[_0x3ab0('0x24')](_0x38a932);};}exports[_0x3ab0('0x25')]=function(_0x36021b,_0x5a4bae){var _0x4f9a8f={},_0x1c6cb8={},_0x506b89={'count':0x0,'rows':[]};var _0x5fbd8e=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x25bbf7){return{'name':_0x25bbf7[_0x3ab0('0x26')],'type':_0x25bbf7[_0x3ab0('0x27')][_0x3ab0('0x28')]};});_0x1c6cb8[_0x3ab0('0x29')]=_[_0x3ab0('0x2a')](_0x5fbd8e,_0x3ab0('0x23'));_0x1c6cb8[_0x3ab0('0x2b')]=_[_0x3ab0('0x2c')](_0x36021b[_0x3ab0('0x2b')]);_0x1c6cb8['filters']=_[_0x3ab0('0x2d')](_0x1c6cb8[_0x3ab0('0x29')],_0x1c6cb8[_0x3ab0('0x2b')]);_0x4f9a8f[_0x3ab0('0x2e')]=_[_0x3ab0('0x2d')](_0x1c6cb8[_0x3ab0('0x29')],qs['fields'](_0x36021b[_0x3ab0('0x2b')][_0x3ab0('0x2f')]));_0x4f9a8f[_0x3ab0('0x2e')]=_0x4f9a8f[_0x3ab0('0x2e')][_0x3ab0('0x30')]?_0x4f9a8f[_0x3ab0('0x2e')]:_0x1c6cb8[_0x3ab0('0x29')];if(!_0x36021b[_0x3ab0('0x2b')]['hasOwnProperty']('nolimit')){_0x4f9a8f[_0x3ab0('0x1c')]=qs[_0x3ab0('0x1c')](_0x36021b[_0x3ab0('0x2b')]['limit']);_0x4f9a8f[_0x3ab0('0x1b')]=qs['offset'](_0x36021b['query'][_0x3ab0('0x1b')]);}_0x4f9a8f['order']=qs[_0x3ab0('0x31')](_0x36021b[_0x3ab0('0x2b')][_0x3ab0('0x31')]);_0x4f9a8f[_0x3ab0('0x32')]=qs[_0x3ab0('0x33')](_[_0x3ab0('0x34')](_0x36021b[_0x3ab0('0x2b')],_0x1c6cb8[_0x3ab0('0x33')]),_0x5fbd8e);if(_0x36021b[_0x3ab0('0x2b')][_0x3ab0('0x35')]){_0x4f9a8f['where']=_[_0x3ab0('0x36')](_0x4f9a8f['where'],{'$or':_[_0x3ab0('0x2a')](_0x5fbd8e,function(_0x2d8797){if(_0x2d8797[_0x3ab0('0x27')]!==_0x3ab0('0x37')){var _0x1cea25={};_0x1cea25[_0x2d8797['name']]={'$like':'%'+_0x36021b[_0x3ab0('0x2b')]['filter']+'%'};return _0x1cea25;}})});}_0x4f9a8f=_['merge']({},_0x4f9a8f,_0x36021b[_0x3ab0('0x38')]);var _0x20caec={'where':_0x4f9a8f[_0x3ab0('0x32')]};return db[_0x3ab0('0x39')][_0x3ab0('0x1d')](_0x20caec)[_0x3ab0('0x20')](function(_0x110fd2){_0x506b89[_0x3ab0('0x1d')]=_0x110fd2;if(_0x36021b['query'][_0x3ab0('0x3a')]){_0x4f9a8f[_0x3ab0('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x3ab0('0x3c')](_0x4f9a8f);})[_0x3ab0('0x20')](function(_0x1ef9f3){_0x506b89[_0x3ab0('0x3d')]=_0x1ef9f3;return _0x506b89;})[_0x3ab0('0x20')](respondWithFilteredResult(_0x5a4bae,_0x4f9a8f))[_0x3ab0('0x3e')](handleError(_0x5a4bae,null));};exports[_0x3ab0('0x3f')]=function(_0x17b8fe,_0x59f146){var _0x616991={'raw':!![],'where':{'id':_0x17b8fe['params']['id']}},_0x4759d2={};_0x4759d2[_0x3ab0('0x29')]=_[_0x3ab0('0x2c')](db[_0x3ab0('0x39')][_0x3ab0('0x40')]);_0x4759d2['query']=_['keys'](_0x17b8fe[_0x3ab0('0x2b')]);_0x4759d2['filters']=_[_0x3ab0('0x2d')](_0x4759d2[_0x3ab0('0x29')],_0x4759d2['query']);_0x616991[_0x3ab0('0x2e')]=_[_0x3ab0('0x2d')](_0x4759d2[_0x3ab0('0x29')],qs[_0x3ab0('0x2f')](_0x17b8fe[_0x3ab0('0x2b')]['fields']));_0x616991['attributes']=_0x616991[_0x3ab0('0x2e')][_0x3ab0('0x30')]?_0x616991['attributes']:_0x4759d2[_0x3ab0('0x29')];if(_0x17b8fe['query'][_0x3ab0('0x3a')]){_0x616991[_0x3ab0('0x3b')]=[{'all':!![]}];}_0x616991=_['merge']({},_0x616991,_0x17b8fe[_0x3ab0('0x38')]);return db[_0x3ab0('0x39')]['find'](_0x616991)[_0x3ab0('0x20')](handleEntityNotFound(_0x59f146,null))[_0x3ab0('0x20')](respondWithResult(_0x59f146,null))[_0x3ab0('0x3e')](handleError(_0x59f146,null));};exports[_0x3ab0('0x41')]=function(_0x5e8d6a,_0x41e1aa){return db[_0x3ab0('0x39')]['create'](_0x5e8d6a[_0x3ab0('0x42')],{})[_0x3ab0('0x20')](respondWithResult(_0x41e1aa,0xc9))[_0x3ab0('0x3e')](handleError(_0x41e1aa,null));};exports['update']=function(_0x20c718,_0x938187){if(_0x20c718[_0x3ab0('0x42')]['id']){delete _0x20c718[_0x3ab0('0x42')]['id'];}return db['SmsQueueReport'][_0x3ab0('0x43')]({'where':{'id':_0x20c718[_0x3ab0('0x44')]['id']}})[_0x3ab0('0x20')](handleEntityNotFound(_0x938187,null))[_0x3ab0('0x20')](saveUpdates(_0x20c718[_0x3ab0('0x42')],null))['then'](respondWithResult(_0x938187,null))[_0x3ab0('0x3e')](handleError(_0x938187,null));};exports[_0x3ab0('0x45')]=function(_0x50fe45,_0xfc9e0e){return db[_0x3ab0('0x39')][_0x3ab0('0x43')]({'where':{'id':_0x50fe45['params']['id']}})[_0x3ab0('0x20')](handleEntityNotFound(_0xfc9e0e,null))[_0x3ab0('0x20')](removeEntity(_0xfc9e0e,null))[_0x3ab0('0x3e')](handleError(_0xfc9e0e,null));};exports[_0x3ab0('0x46')]=function(_0x1ec18c,_0x458a77){return db[_0x3ab0('0x39')][_0x3ab0('0x46')]()[_0x3ab0('0x20')](respondWithResult(_0x458a77,null))['catch'](handleError(_0x458a77,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 6248bba..1cea7ae 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0xe706,0xa3));var _0x6e70=function(_0x49e6ca,_0x3fb558){_0x49e6ca=_0x49e6ca-0x0;var _0x362189=_0xe706[_0x49e6ca];return _0x362189;};'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 2783ffb..fb5bbca 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 _0x4d2b=['attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where'];(function(_0x229c6c,_0x4f6ed1){var _0x15bf7a=function(_0x24ce0e){while(--_0x24ce0e){_0x229c6c['push'](_0x229c6c['shift']());}};_0x15bf7a(++_0x4f6ed1);}(_0x4d2b,0x14d));var _0xb4d2=function(_0x1dadf0,_0xfc3118){_0x1dadf0=_0x1dadf0-0x0;var _0x485fe8=_0x4d2b[_0x1dadf0];return _0x485fe8;};'use strict';var _=require('lodash');var util=require(_0xb4d2('0x0'));var moment=require(_0xb4d2('0x1'));var BPromise=require(_0xb4d2('0x2'));var rs=require(_0xb4d2('0x3'));var fs=require('fs');var Redis=require(_0xb4d2('0x4'));var db=require(_0xb4d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4d2('0x6'));var config=require(_0xb4d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb4d2('0x8')][_0xb4d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb1cc,_0x2c6c9f,_0x3b68a6){return new BPromise(function(_0x481aad,_0x53f9a0){return client[_0xb4d2('0xa')](_0x2eb1cc,_0x3b68a6)[_0xb4d2('0xb')](function(_0x1ca908){logger[_0xb4d2('0xc')](_0xb4d2('0xd'),_0x2c6c9f,_0xb4d2('0xe'));logger[_0xb4d2('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2c6c9f,_0xb4d2('0xe'),JSON[_0xb4d2('0x10')](_0x1ca908));if(_0x1ca908['error']){if(_0x1ca908[_0xb4d2('0x11')][_0xb4d2('0x12')]===0x1f4){logger[_0xb4d2('0x11')](_0xb4d2('0xd'),_0x2c6c9f,_0x1ca908[_0xb4d2('0x11')]['message']);return _0x53f9a0(_0x1ca908[_0xb4d2('0x11')][_0xb4d2('0x13')]);}logger[_0xb4d2('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2c6c9f,_0x1ca908[_0xb4d2('0x11')][_0xb4d2('0x13')]);return _0x481aad(_0x1ca908['error'][_0xb4d2('0x13')]);}else{logger['info'](_0xb4d2('0xd'),_0x2c6c9f,_0xb4d2('0xe'));_0x481aad(_0x1ca908[_0xb4d2('0x14')][_0xb4d2('0x13')]);}})[_0xb4d2('0x15')](function(_0x38fd8d){logger[_0xb4d2('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2c6c9f,_0x38fd8d);_0x53f9a0(_0x38fd8d);});});}exports[_0xb4d2('0x16')]=function(_0x571427){var _0x17387b=this;return new Promise(function(_0x20bbd0,_0x3b4774){return db[_0xb4d2('0x17')][_0xb4d2('0x18')](_0x571427[_0xb4d2('0x19')],{'raw':_0x571427[_0xb4d2('0x1a')]?_0x571427[_0xb4d2('0x1a')][_0xb4d2('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2968d7){logger[_0xb4d2('0xc')](_0xb4d2('0x16'),_0x571427);logger[_0xb4d2('0xf')](_0xb4d2('0x16'),_0x571427,JSON[_0xb4d2('0x10')](_0x2968d7));_0x20bbd0(_0x2968d7);})['catch'](function(_0x2dc4fc){logger[_0xb4d2('0x11')](_0xb4d2('0x16'),_0x2dc4fc['message'],_0x571427);_0x3b4774(_0x17387b[_0xb4d2('0x11')](0x1f4,_0x2dc4fc[_0xb4d2('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x1f61dc){var _0x126376=this;return new Promise(function(_0x3328f6,_0x40fd97){return db[_0xb4d2('0x17')][_0xb4d2('0x1c')](_0x1f61dc['body'],{'raw':_0x1f61dc['options']?_0x1f61dc['options'][_0xb4d2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f61dc[_0xb4d2('0x1a')]?_0x1f61dc['options'][_0xb4d2('0x1d')]||null:null,'attributes':_0x1f61dc[_0xb4d2('0x1a')]?_0x1f61dc[_0xb4d2('0x1a')][_0xb4d2('0x1e')]||null:null,'limit':_0x1f61dc['options']?_0x1f61dc[_0xb4d2('0x1a')][_0xb4d2('0x1f')]||null:null})[_0xb4d2('0xb')](function(_0x214d55){logger[_0xb4d2('0xc')]('UpdateSmsQueueReport',_0x1f61dc);logger[_0xb4d2('0xf')](_0xb4d2('0x20'),_0x1f61dc,JSON[_0xb4d2('0x10')](_0x214d55));_0x3328f6(_0x214d55);})[_0xb4d2('0x15')](function(_0xf93da2){logger[_0xb4d2('0x11')](_0xb4d2('0x20'),_0xf93da2[_0xb4d2('0x13')],_0x1f61dc);_0x40fd97(_0x126376[_0xb4d2('0x11')](0x1f4,_0xf93da2[_0xb4d2('0x13')]));});});}; \ No newline at end of file +var _0x7616=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x51954a,_0x2589ec){var _0x1dab30=function(_0x1da2e5){while(--_0x1da2e5){_0x51954a['push'](_0x51954a['shift']());}};_0x1dab30(++_0x2589ec);}(_0x7616,0x102));var _0x6761=function(_0x3dc6ff,_0x16bb3c){_0x3dc6ff=_0x3dc6ff-0x0;var _0x519604=_0x7616[_0x3dc6ff];return _0x519604;};'use strict';var _=require(_0x6761('0x0'));var util=require(_0x6761('0x1'));var moment=require(_0x6761('0x2'));var BPromise=require('bluebird');var rs=require(_0x6761('0x3'));var fs=require('fs');var Redis=require(_0x6761('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6761('0x5'));var logger=require(_0x6761('0x6'))(_0x6761('0x7'));var config=require('../../config/environment');var jayson=require(_0x6761('0x8'));var client=jayson[_0x6761('0x9')][_0x6761('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcdfce1,_0x8b650f,_0x509427){return new BPromise(function(_0x46f896,_0x401a59){return client['request'](_0xcdfce1,_0x509427)[_0x6761('0xb')](function(_0x415732){logger[_0x6761('0xc')](_0x6761('0xd'),_0x8b650f,_0x6761('0xe'));logger[_0x6761('0xf')](_0x6761('0x10'),_0x8b650f,_0x6761('0xe'),JSON[_0x6761('0x11')](_0x415732));if(_0x415732[_0x6761('0x12')]){if(_0x415732[_0x6761('0x12')][_0x6761('0x13')]===0x1f4){logger[_0x6761('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x8b650f,_0x415732['error'][_0x6761('0x14')]);return _0x401a59(_0x415732[_0x6761('0x12')][_0x6761('0x14')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x8b650f,_0x415732['error'][_0x6761('0x14')]);return _0x46f896(_0x415732[_0x6761('0x12')][_0x6761('0x14')]);}else{logger[_0x6761('0xc')](_0x6761('0xd'),_0x8b650f,'request\x20sent');_0x46f896(_0x415732[_0x6761('0x15')][_0x6761('0x14')]);}})[_0x6761('0x16')](function(_0x554669){logger[_0x6761('0x12')](_0x6761('0xd'),_0x8b650f,_0x554669);_0x401a59(_0x554669);});});}exports['CreateSmsQueueReport']=function(_0x2ba481){var _0x46633e=this;return new Promise(function(_0x261524,_0x2a7f5b){return db[_0x6761('0x17')][_0x6761('0x18')](_0x2ba481['body'],{'raw':_0x2ba481[_0x6761('0x19')]?_0x2ba481[_0x6761('0x19')][_0x6761('0x1a')]===undefined?!![]:![]:!![]})[_0x6761('0xb')](function(_0x3434ad){logger[_0x6761('0xc')]('CreateSmsQueueReport',_0x2ba481);logger['debug'](_0x6761('0x1b'),_0x2ba481,JSON[_0x6761('0x11')](_0x3434ad));_0x261524(_0x3434ad);})['catch'](function(_0x17c2f9){logger[_0x6761('0x12')](_0x6761('0x1b'),_0x17c2f9['message'],_0x2ba481);_0x2a7f5b(_0x46633e['error'](0x1f4,_0x17c2f9[_0x6761('0x14')]));});});};exports[_0x6761('0x1c')]=function(_0x1bfea5){var _0x5da079=this;return new Promise(function(_0xa8218,_0x48506a){return db[_0x6761('0x17')][_0x6761('0x1d')](_0x1bfea5[_0x6761('0x1e')],{'raw':_0x1bfea5[_0x6761('0x19')]?_0x1bfea5[_0x6761('0x19')][_0x6761('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bfea5['options']?_0x1bfea5[_0x6761('0x19')][_0x6761('0x1f')]||null:null,'attributes':_0x1bfea5[_0x6761('0x19')]?_0x1bfea5[_0x6761('0x19')][_0x6761('0x20')]||null:null,'limit':_0x1bfea5[_0x6761('0x19')]?_0x1bfea5[_0x6761('0x19')][_0x6761('0x21')]||null:null})[_0x6761('0xb')](function(_0x2e1ec8){logger['info'](_0x6761('0x1c'),_0x1bfea5);logger[_0x6761('0xf')]('UpdateSmsQueueReport',_0x1bfea5,JSON[_0x6761('0x11')](_0x2e1ec8));_0xa8218(_0x2e1ec8);})['catch'](function(_0x5aa5f8){logger['error'](_0x6761('0x1c'),_0x5aa5f8[_0x6761('0x14')],_0x1bfea5);_0x48506a(_0x5da079[_0x6761('0x12')](0x1f4,_0x5aa5f8[_0x6761('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7979dca..ff6d26a 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 _0x6921=['describe','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2f0dfe,_0x419c89){var _0x204a30=function(_0x5e7877){while(--_0x5e7877){_0x2f0dfe['push'](_0x2f0dfe['shift']());}};_0x204a30(++_0x419c89);}(_0x6921,0x1d1));var _0x1692=function(_0x197b8d,_0x10c8a0){_0x197b8d=_0x197b8d-0x0;var _0x209e6d=_0x6921[_0x197b8d];return _0x209e6d;};'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('0x6')](_0x1692('0xb'),auth[_0x1692('0x7')](),controller['show']);router[_0x1692('0xc')]('/',auth['isAuthenticated'](),controller[_0x1692('0xd')]);router[_0x1692('0xe')](_0x1692('0xb'),auth[_0x1692('0x7')](),controller[_0x1692('0xf')]);router[_0x1692('0x10')]('/:id',auth[_0x1692('0x7')](),controller[_0x1692('0x11')]);module[_0x1692('0x12')]=router; \ No newline at end of file +var _0x106f=['./smsTransferReport.controller','get','isAuthenticated','index','describe','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x106f,0x162));var _0xf106=function(_0x2b8c63,_0x3c4e31){_0x2b8c63=_0x2b8c63-0x0;var _0xc2f818=_0x106f[_0x2b8c63];return _0xc2f818;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var fs_extra=require(_0xf106('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var controller=require(_0xf106('0x7'));router[_0xf106('0x8')]('/',auth[_0xf106('0x9')](),controller[_0xf106('0xa')]);router[_0xf106('0x8')]('/describe',auth[_0xf106('0x9')](),controller[_0xf106('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf106('0x9')](),controller[_0xf106('0xc')]);router[_0xf106('0xd')](_0xf106('0xe'),auth[_0xf106('0x9')](),controller[_0xf106('0xf')]);router[_0xf106('0x10')](_0xf106('0xe'),auth[_0xf106('0x9')](),controller[_0xf106('0x11')]);module[_0xf106('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 02a5b4b..6cd5732 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1f18a7,_0x5680c1){var _0x28995b=function(_0x207ca3){while(--_0x207ca3){_0x1f18a7['push'](_0x1f18a7['shift']());}};_0x28995b(++_0x5680c1);}(_0x00bb,0x1d8));var _0xb00b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00bb[_0x42245d];return _0x4b211a;};'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(_0x4057ec,_0x3382e9){var _0x40b632=function(_0x4bc152){while(--_0x4bc152){_0x4057ec['push'](_0x4057ec['shift']());}};_0x40b632(++_0x3382e9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xcb91[_0x1602ef];return _0x5870ee;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index bcf35f2..28b0651 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 _0xedc9=['order','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xedc9,0x13e));var _0x9edc=function(_0xfcb0f1,_0x3f2d57){_0xfcb0f1=_0xfcb0f1-0x0;var _0x4ed14e=_0xedc9[_0xfcb0f1];return _0x4ed14e;};'use strict';var emlformat=require(_0x9edc('0x0'));var rimraf=require(_0x9edc('0x1'));var zipdir=require(_0x9edc('0x2'));var jsonpatch=require(_0x9edc('0x3'));var rp=require(_0x9edc('0x4'));var moment=require(_0x9edc('0x5'));var BPromise=require(_0x9edc('0x6'));var Mustache=require(_0x9edc('0x7'));var util=require(_0x9edc('0x8'));var path=require(_0x9edc('0x9'));var sox=require(_0x9edc('0xa'));var csv=require(_0x9edc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9edc('0xc'));var _=require(_0x9edc('0xd'));var squel=require(_0x9edc('0xe'));var crypto=require(_0x9edc('0xf'));var jsforce=require(_0x9edc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9edc('0xb'));var querystring=require(_0x9edc('0x11'));var Papa=require('papaparse');var Redis=require(_0x9edc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9edc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9edc('0x14'));var utils=require(_0x9edc('0x15'));var config=require(_0x9edc('0x16'));var licenseUtil=require(_0x9edc('0x17'));var db=require(_0x9edc('0x18'))['db'];function respondWithStatusCode(_0x1a83de,_0x3a684a){_0x3a684a=_0x3a684a||0xcc;return function(_0x4bb8bd){if(_0x4bb8bd){return _0x1a83de[_0x9edc('0x19')](_0x3a684a);}return _0x1a83de['status'](_0x3a684a)['end']();};}function respondWithResult(_0x1df0b6,_0xec3aae){_0xec3aae=_0xec3aae||0xc8;return function(_0x5a2688){if(_0x5a2688){return _0x1df0b6[_0x9edc('0x1a')](_0xec3aae)[_0x9edc('0x1b')](_0x5a2688);}};}function respondWithFilteredResult(_0x2da499,_0x4b3cc3){return function(_0x1dc6f2){if(_0x1dc6f2){var _0x3fd317=typeof _0x4b3cc3['offset']===_0x9edc('0x1c')&&typeof _0x4b3cc3['limit']===_0x9edc('0x1c');var _0x34377d=_0x1dc6f2[_0x9edc('0x1d')];var _0x170491=_0x3fd317?0x0:_0x4b3cc3[_0x9edc('0x1e')];var _0x53e1d8=_0x3fd317?_0x1dc6f2['count']:_0x4b3cc3['offset']+_0x4b3cc3['limit'];var _0x92c581;if(_0x53e1d8>=_0x34377d){_0x53e1d8=_0x34377d;_0x92c581=0xc8;}else{_0x92c581=0xce;}_0x2da499[_0x9edc('0x1a')](_0x92c581);return _0x2da499[_0x9edc('0x1f')](_0x9edc('0x20'),_0x170491+'-'+_0x53e1d8+'/'+_0x34377d)[_0x9edc('0x1b')](_0x1dc6f2);}return null;};}function patchUpdates(_0x4ed7f9){return function(_0x121b55){try{jsonpatch[_0x9edc('0x21')](_0x121b55,_0x4ed7f9,!![]);}catch(_0x5f07a8){return BPromise['reject'](_0x5f07a8);}return _0x121b55['save']();};}function saveUpdates(_0x239222,_0x4ce6d7){return function(_0x572267){if(_0x572267){return _0x572267[_0x9edc('0x22')](_0x239222)[_0x9edc('0x23')](function(_0x33a90c){return _0x33a90c;});}return null;};}function removeEntity(_0x28871d,_0x200107){return function(_0x51be16){if(_0x51be16){return _0x51be16[_0x9edc('0x24')]()[_0x9edc('0x23')](function(){_0x28871d[_0x9edc('0x1a')](0xcc)[_0x9edc('0x25')]();});}};}function handleEntityNotFound(_0x16a1ff,_0x579c10){return function(_0x540b40){if(!_0x540b40){_0x16a1ff[_0x9edc('0x19')](0x194);}return _0x540b40;};}function handleError(_0x3cd206,_0x564b61){_0x564b61=_0x564b61||0x1f4;return function(_0x1af008){logger[_0x9edc('0x26')](_0x1af008[_0x9edc('0x27')]);if(_0x1af008[_0x9edc('0x28')]){delete _0x1af008[_0x9edc('0x28')];}_0x3cd206['status'](_0x564b61)[_0x9edc('0x29')](_0x1af008);};}exports['index']=function(_0xcddecc,_0x1a2f81){var _0x773f09={},_0xc01690={},_0x48f4c9={'count':0x0,'rows':[]};var _0x49dc30=_[_0x9edc('0x2a')](db[_0x9edc('0x2b')][_0x9edc('0x2c')],function(_0x1225c9){return{'name':_0x1225c9[_0x9edc('0x2d')],'type':_0x1225c9['type'][_0x9edc('0x2e')]};});_0xc01690[_0x9edc('0x2f')]=_[_0x9edc('0x2a')](_0x49dc30,'name');_0xc01690[_0x9edc('0x30')]=_[_0x9edc('0x31')](_0xcddecc[_0x9edc('0x30')]);_0xc01690[_0x9edc('0x32')]=_[_0x9edc('0x33')](_0xc01690[_0x9edc('0x2f')],_0xc01690[_0x9edc('0x30')]);_0x773f09[_0x9edc('0x34')]=_['intersection'](_0xc01690[_0x9edc('0x2f')],qs['fields'](_0xcddecc[_0x9edc('0x30')][_0x9edc('0x35')]));_0x773f09[_0x9edc('0x34')]=_0x773f09[_0x9edc('0x34')]['length']?_0x773f09['attributes']:_0xc01690[_0x9edc('0x2f')];if(!_0xcddecc[_0x9edc('0x30')][_0x9edc('0x36')](_0x9edc('0x37'))){_0x773f09[_0x9edc('0x38')]=qs[_0x9edc('0x38')](_0xcddecc[_0x9edc('0x30')][_0x9edc('0x38')]);_0x773f09[_0x9edc('0x1e')]=qs['offset'](_0xcddecc[_0x9edc('0x30')][_0x9edc('0x1e')]);}_0x773f09[_0x9edc('0x39')]=qs[_0x9edc('0x3a')](_0xcddecc[_0x9edc('0x30')][_0x9edc('0x3a')]);_0x773f09[_0x9edc('0x3b')]=qs[_0x9edc('0x32')](_['pick'](_0xcddecc['query'],_0xc01690[_0x9edc('0x32')]),_0x49dc30);if(_0xcddecc[_0x9edc('0x30')][_0x9edc('0x3c')]){_0x773f09[_0x9edc('0x3b')]=_[_0x9edc('0x3d')](_0x773f09[_0x9edc('0x3b')],{'$or':_[_0x9edc('0x2a')](_0x49dc30,function(_0xdc668c){if(_0xdc668c[_0x9edc('0x3e')]!=='VIRTUAL'){var _0xf47cac={};_0xf47cac[_0xdc668c[_0x9edc('0x28')]]={'$like':'%'+_0xcddecc[_0x9edc('0x30')][_0x9edc('0x3c')]+'%'};return _0xf47cac;}})});}_0x773f09=_['merge']({},_0x773f09,_0xcddecc[_0x9edc('0x3f')]);var _0x211f0f={'where':_0x773f09[_0x9edc('0x3b')]};return db[_0x9edc('0x2b')]['count'](_0x211f0f)[_0x9edc('0x23')](function(_0x3da150){_0x48f4c9[_0x9edc('0x1d')]=_0x3da150;if(_0xcddecc[_0x9edc('0x30')][_0x9edc('0x40')]){_0x773f09[_0x9edc('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x9edc('0x42')](_0x773f09);})[_0x9edc('0x23')](function(_0x4702e2){_0x48f4c9['rows']=_0x4702e2;return _0x48f4c9;})[_0x9edc('0x23')](respondWithFilteredResult(_0x1a2f81,_0x773f09))[_0x9edc('0x43')](handleError(_0x1a2f81,null));};exports[_0x9edc('0x44')]=function(_0x278190,_0x495434){var _0x40d4b0={'raw':!![],'where':{'id':_0x278190['params']['id']}},_0xcaa600={};_0xcaa600[_0x9edc('0x2f')]=_[_0x9edc('0x31')](db['SmsTransferReport']['rawAttributes']);_0xcaa600[_0x9edc('0x30')]=_[_0x9edc('0x31')](_0x278190[_0x9edc('0x30')]);_0xcaa600[_0x9edc('0x32')]=_['intersection'](_0xcaa600[_0x9edc('0x2f')],_0xcaa600[_0x9edc('0x30')]);_0x40d4b0[_0x9edc('0x34')]=_['intersection'](_0xcaa600[_0x9edc('0x2f')],qs['fields'](_0x278190[_0x9edc('0x30')][_0x9edc('0x35')]));_0x40d4b0[_0x9edc('0x34')]=_0x40d4b0[_0x9edc('0x34')][_0x9edc('0x45')]?_0x40d4b0[_0x9edc('0x34')]:_0xcaa600['model'];if(_0x278190['query'][_0x9edc('0x40')]){_0x40d4b0['include']=[{'all':!![]}];}_0x40d4b0=_[_0x9edc('0x3d')]({},_0x40d4b0,_0x278190[_0x9edc('0x3f')]);return db[_0x9edc('0x2b')][_0x9edc('0x46')](_0x40d4b0)[_0x9edc('0x23')](handleEntityNotFound(_0x495434,null))[_0x9edc('0x23')](respondWithResult(_0x495434,null))[_0x9edc('0x43')](handleError(_0x495434,null));};exports[_0x9edc('0x47')]=function(_0x9d48d6,_0x50bbd3){return db[_0x9edc('0x2b')]['create'](_0x9d48d6['body'],{})[_0x9edc('0x23')](respondWithResult(_0x50bbd3,0xc9))[_0x9edc('0x43')](handleError(_0x50bbd3,null));};exports['update']=function(_0xec09e6,_0x419d07){if(_0xec09e6['body']['id']){delete _0xec09e6[_0x9edc('0x48')]['id'];}return db['SmsTransferReport'][_0x9edc('0x46')]({'where':{'id':_0xec09e6[_0x9edc('0x49')]['id']}})[_0x9edc('0x23')](handleEntityNotFound(_0x419d07,null))[_0x9edc('0x23')](saveUpdates(_0xec09e6['body'],null))[_0x9edc('0x23')](respondWithResult(_0x419d07,null))['catch'](handleError(_0x419d07,null));};exports[_0x9edc('0x24')]=function(_0x5cf1bf,_0x4759f9){return db['SmsTransferReport'][_0x9edc('0x46')]({'where':{'id':_0x5cf1bf['params']['id']}})[_0x9edc('0x23')](handleEntityNotFound(_0x4759f9,null))[_0x9edc('0x23')](removeEntity(_0x4759f9,null))[_0x9edc('0x43')](handleError(_0x4759f9,null));};exports[_0x9edc('0x4a')]=function(_0x451f95,_0x3b139e){return db[_0x9edc('0x2b')][_0x9edc('0x4a')]()[_0x9edc('0x23')](respondWithResult(_0x3b139e,null))[_0x9edc('0x43')](handleError(_0x3b139e,null));}; \ No newline at end of file +var _0x0219=['filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','length','include','options','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x147e6a,_0x1c462d){var _0x111206=function(_0x5a0fcc){while(--_0x5a0fcc){_0x147e6a['push'](_0x147e6a['shift']());}};_0x111206(++_0x1c462d);}(_0x0219,0x14d));var _0x9021=function(_0x58394a,_0x17838d){_0x58394a=_0x58394a-0x0;var _0x4b14d5=_0x0219[_0x58394a];return _0x4b14d5;};'use strict';var emlformat=require(_0x9021('0x0'));var rimraf=require(_0x9021('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9021('0x2'));var rp=require(_0x9021('0x3'));var moment=require(_0x9021('0x4'));var BPromise=require(_0x9021('0x5'));var Mustache=require(_0x9021('0x6'));var util=require(_0x9021('0x7'));var path=require(_0x9021('0x8'));var sox=require(_0x9021('0x9'));var csv=require(_0x9021('0xa'));var ejs=require(_0x9021('0xb'));var fs=require('fs');var fs_extra=require(_0x9021('0xc'));var _=require(_0x9021('0xd'));var squel=require('squel');var crypto=require(_0x9021('0xe'));var jsforce=require(_0x9021('0xf'));var deskjs=require(_0x9021('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9021('0x11'));var qs=require(_0x9021('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9021('0x13'));var logger=require(_0x9021('0x14'))(_0x9021('0x15'));var utils=require(_0x9021('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9021('0x17'));var db=require(_0x9021('0x18'))['db'];function respondWithStatusCode(_0x5a22b4,_0x18b429){_0x18b429=_0x18b429||0xcc;return function(_0x1d8b55){if(_0x1d8b55){return _0x5a22b4[_0x9021('0x19')](_0x18b429);}return _0x5a22b4[_0x9021('0x1a')](_0x18b429)[_0x9021('0x1b')]();};}function respondWithResult(_0x94e502,_0x275a47){_0x275a47=_0x275a47||0xc8;return function(_0x6661de){if(_0x6661de){return _0x94e502[_0x9021('0x1a')](_0x275a47)[_0x9021('0x1c')](_0x6661de);}};}function respondWithFilteredResult(_0x5df057,_0x14b814){return function(_0x5ac548){if(_0x5ac548){var _0x2be82b=typeof _0x14b814[_0x9021('0x1d')]===_0x9021('0x1e')&&typeof _0x14b814[_0x9021('0x1f')]===_0x9021('0x1e');var _0x120bd4=_0x5ac548['count'];var _0x36515=_0x2be82b?0x0:_0x14b814[_0x9021('0x1d')];var _0x1c6b06=_0x2be82b?_0x5ac548[_0x9021('0x20')]:_0x14b814[_0x9021('0x1d')]+_0x14b814[_0x9021('0x1f')];var _0x53ca00;if(_0x1c6b06>=_0x120bd4){_0x1c6b06=_0x120bd4;_0x53ca00=0xc8;}else{_0x53ca00=0xce;}_0x5df057['status'](_0x53ca00);return _0x5df057['set']('Content-Range',_0x36515+'-'+_0x1c6b06+'/'+_0x120bd4)[_0x9021('0x1c')](_0x5ac548);}return null;};}function patchUpdates(_0x2f5fc2){return function(_0x14d402){try{jsonpatch[_0x9021('0x21')](_0x14d402,_0x2f5fc2,!![]);}catch(_0x45a20f){return BPromise[_0x9021('0x22')](_0x45a20f);}return _0x14d402[_0x9021('0x23')]();};}function saveUpdates(_0x52456a,_0x364446){return function(_0x4d9018){if(_0x4d9018){return _0x4d9018[_0x9021('0x24')](_0x52456a)[_0x9021('0x25')](function(_0x213297){return _0x213297;});}return null;};}function removeEntity(_0xf5e631,_0x14b25d){return function(_0x212b07){if(_0x212b07){return _0x212b07[_0x9021('0x26')]()[_0x9021('0x25')](function(){_0xf5e631[_0x9021('0x1a')](0xcc)[_0x9021('0x1b')]();});}};}function handleEntityNotFound(_0x191180,_0x554183){return function(_0x2b45ca){if(!_0x2b45ca){_0x191180[_0x9021('0x19')](0x194);}return _0x2b45ca;};}function handleError(_0x42388f,_0x3a2a05){_0x3a2a05=_0x3a2a05||0x1f4;return function(_0x27bfe2){logger[_0x9021('0x27')](_0x27bfe2[_0x9021('0x28')]);if(_0x27bfe2[_0x9021('0x29')]){delete _0x27bfe2[_0x9021('0x29')];}_0x42388f[_0x9021('0x1a')](_0x3a2a05)[_0x9021('0x2a')](_0x27bfe2);};}exports[_0x9021('0x2b')]=function(_0x17cd17,_0x3f9ba2){var _0x40a6cf={},_0x4970db={},_0x1c5345={'count':0x0,'rows':[]};var _0x48b7ae=_['map'](db[_0x9021('0x2c')][_0x9021('0x2d')],function(_0x7c1aa9){return{'name':_0x7c1aa9[_0x9021('0x2e')],'type':_0x7c1aa9[_0x9021('0x2f')][_0x9021('0x30')]};});_0x4970db['model']=_[_0x9021('0x31')](_0x48b7ae,_0x9021('0x29'));_0x4970db[_0x9021('0x32')]=_[_0x9021('0x33')](_0x17cd17[_0x9021('0x32')]);_0x4970db[_0x9021('0x34')]=_['intersection'](_0x4970db[_0x9021('0x35')],_0x4970db[_0x9021('0x32')]);_0x40a6cf[_0x9021('0x36')]=_[_0x9021('0x37')](_0x4970db[_0x9021('0x35')],qs[_0x9021('0x38')](_0x17cd17[_0x9021('0x32')][_0x9021('0x38')]));_0x40a6cf[_0x9021('0x36')]=_0x40a6cf[_0x9021('0x36')]['length']?_0x40a6cf[_0x9021('0x36')]:_0x4970db[_0x9021('0x35')];if(!_0x17cd17[_0x9021('0x32')][_0x9021('0x39')]('nolimit')){_0x40a6cf[_0x9021('0x1f')]=qs[_0x9021('0x1f')](_0x17cd17[_0x9021('0x32')]['limit']);_0x40a6cf[_0x9021('0x1d')]=qs[_0x9021('0x1d')](_0x17cd17['query'][_0x9021('0x1d')]);}_0x40a6cf[_0x9021('0x3a')]=qs['sort'](_0x17cd17[_0x9021('0x32')][_0x9021('0x3b')]);_0x40a6cf[_0x9021('0x3c')]=qs[_0x9021('0x34')](_[_0x9021('0x3d')](_0x17cd17['query'],_0x4970db[_0x9021('0x34')]),_0x48b7ae);if(_0x17cd17['query'][_0x9021('0x3e')]){_0x40a6cf[_0x9021('0x3c')]=_['merge'](_0x40a6cf['where'],{'$or':_[_0x9021('0x31')](_0x48b7ae,function(_0xcf2de1){if(_0xcf2de1[_0x9021('0x2f')]!=='VIRTUAL'){var _0x256b92={};_0x256b92[_0xcf2de1['name']]={'$like':'%'+_0x17cd17[_0x9021('0x32')][_0x9021('0x3e')]+'%'};return _0x256b92;}})});}_0x40a6cf=_[_0x9021('0x3f')]({},_0x40a6cf,_0x17cd17['options']);var _0xb409ae={'where':_0x40a6cf[_0x9021('0x3c')]};return db[_0x9021('0x2c')]['count'](_0xb409ae)[_0x9021('0x25')](function(_0x52825){_0x1c5345[_0x9021('0x20')]=_0x52825;if(_0x17cd17[_0x9021('0x32')][_0x9021('0x40')]){_0x40a6cf['include']=[{'all':!![]}];}return db[_0x9021('0x2c')][_0x9021('0x41')](_0x40a6cf);})[_0x9021('0x25')](function(_0x363963){_0x1c5345[_0x9021('0x42')]=_0x363963;return _0x1c5345;})['then'](respondWithFilteredResult(_0x3f9ba2,_0x40a6cf))['catch'](handleError(_0x3f9ba2,null));};exports[_0x9021('0x43')]=function(_0x473bf9,_0x162f74){var _0x4e4141={'raw':!![],'where':{'id':_0x473bf9['params']['id']}},_0x57efb4={};_0x57efb4['model']=_[_0x9021('0x33')](db[_0x9021('0x2c')][_0x9021('0x2d')]);_0x57efb4[_0x9021('0x32')]=_['keys'](_0x473bf9['query']);_0x57efb4['filters']=_[_0x9021('0x37')](_0x57efb4[_0x9021('0x35')],_0x57efb4[_0x9021('0x32')]);_0x4e4141[_0x9021('0x36')]=_['intersection'](_0x57efb4[_0x9021('0x35')],qs[_0x9021('0x38')](_0x473bf9[_0x9021('0x32')][_0x9021('0x38')]));_0x4e4141[_0x9021('0x36')]=_0x4e4141[_0x9021('0x36')][_0x9021('0x44')]?_0x4e4141[_0x9021('0x36')]:_0x57efb4[_0x9021('0x35')];if(_0x473bf9[_0x9021('0x32')][_0x9021('0x40')]){_0x4e4141[_0x9021('0x45')]=[{'all':!![]}];}_0x4e4141=_[_0x9021('0x3f')]({},_0x4e4141,_0x473bf9[_0x9021('0x46')]);return db[_0x9021('0x2c')][_0x9021('0x47')](_0x4e4141)[_0x9021('0x25')](handleEntityNotFound(_0x162f74,null))[_0x9021('0x25')](respondWithResult(_0x162f74,null))[_0x9021('0x48')](handleError(_0x162f74,null));};exports[_0x9021('0x49')]=function(_0x3269dc,_0x1ed87e){return db[_0x9021('0x2c')][_0x9021('0x49')](_0x3269dc['body'],{})[_0x9021('0x25')](respondWithResult(_0x1ed87e,0xc9))[_0x9021('0x48')](handleError(_0x1ed87e,null));};exports[_0x9021('0x24')]=function(_0x2e0a0a,_0x103ea0){if(_0x2e0a0a[_0x9021('0x4a')]['id']){delete _0x2e0a0a[_0x9021('0x4a')]['id'];}return db['SmsTransferReport'][_0x9021('0x47')]({'where':{'id':_0x2e0a0a['params']['id']}})['then'](handleEntityNotFound(_0x103ea0,null))[_0x9021('0x25')](saveUpdates(_0x2e0a0a[_0x9021('0x4a')],null))['then'](respondWithResult(_0x103ea0,null))[_0x9021('0x48')](handleError(_0x103ea0,null));};exports[_0x9021('0x26')]=function(_0x1381e5,_0x4ee053){return db['SmsTransferReport'][_0x9021('0x47')]({'where':{'id':_0x1381e5[_0x9021('0x4b')]['id']}})[_0x9021('0x25')](handleEntityNotFound(_0x4ee053,null))['then'](removeEntity(_0x4ee053,null))[_0x9021('0x48')](handleError(_0x4ee053,null));};exports['describe']=function(_0x5d8df4,_0x121e6f){return db[_0x9021('0x2c')][_0x9021('0x4c')]()[_0x9021('0x25')](respondWithResult(_0x121e6f,null))[_0x9021('0x48')](handleError(_0x121e6f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0d47efb..877186a 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 _0xb607=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x360cd8,_0x16a7ec){var _0x583a05=function(_0x28920b){while(--_0x28920b){_0x360cd8['push'](_0x360cd8['shift']());}};_0x583a05(++_0x16a7ec);}(_0xb607,0x1bc));var _0x7b60=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xb607[_0x42245d];return _0x4b211a;};'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':[{'name':_0x7b60('0xc'),'fields':[_0x7b60('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe45=['rimraf','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x228a4a,_0x23d65e){var _0x3d3937=function(_0x3e9511){while(--_0x3e9511){_0x228a4a['push'](_0x228a4a['shift']());}};_0x3d3937(++_0x23d65e);}(_0xfe45,0xe1));var _0x5fe4=function(_0x528516,_0x584ca2){_0x528516=_0x528516-0x0;var _0x30b503=_0xfe45[_0x528516];return _0x30b503;};'use strict';var _=require(_0x5fe4('0x0'));var util=require('util');var logger=require(_0x5fe4('0x1'))(_0x5fe4('0x2'));var moment=require(_0x5fe4('0x3'));var BPromise=require(_0x5fe4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fe4('0x5'));var rimraf=require(_0x5fe4('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fe4('0x7'));module['exports']=function(_0x1b5165,_0x588deb){return _0x1b5165[_0x5fe4('0x8')](_0x5fe4('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x5fe4('0xa'),'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 51745f5..123eb11 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 _0xe3c5=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x13a4a7,_0xe110c0){var _0x51af93=function(_0x17f9c9){while(--_0x17f9c9){_0x13a4a7['push'](_0x13a4a7['shift']());}};_0x51af93(++_0xe110c0);}(_0xe3c5,0x17d));var _0x5e3c=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0xe3c5[_0xfcfc24];return _0x58f773;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var moment=require(_0x5e3c('0x2'));var BPromise=require(_0x5e3c('0x3'));var rs=require(_0x5e3c('0x4'));var fs=require('fs');var Redis=require(_0x5e3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e3c('0x6'));var logger=require(_0x5e3c('0x7'))(_0x5e3c('0x8'));var config=require(_0x5e3c('0x9'));var jayson=require(_0x5e3c('0xa'));var client=jayson[_0x5e3c('0xb')][_0x5e3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d6b68,_0xc8c788,_0x17076a){return new BPromise(function(_0x3139da,_0x3068c6){return client['request'](_0x2d6b68,_0x17076a)['then'](function(_0x32942e){logger[_0x5e3c('0xd')](_0x5e3c('0xe'),_0xc8c788,_0x5e3c('0xf'));logger[_0x5e3c('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xc8c788,_0x5e3c('0xf'),JSON[_0x5e3c('0x11')](_0x32942e));if(_0x32942e['error']){if(_0x32942e[_0x5e3c('0x12')]['code']===0x1f4){logger['error'](_0x5e3c('0xe'),_0xc8c788,_0x32942e[_0x5e3c('0x12')][_0x5e3c('0x13')]);return _0x3068c6(_0x32942e[_0x5e3c('0x12')][_0x5e3c('0x13')]);}logger[_0x5e3c('0x12')](_0x5e3c('0xe'),_0xc8c788,_0x32942e[_0x5e3c('0x12')]['message']);return _0x3139da(_0x32942e['error'][_0x5e3c('0x13')]);}else{logger[_0x5e3c('0xd')](_0x5e3c('0xe'),_0xc8c788,'request\x20sent');_0x3139da(_0x32942e['result'][_0x5e3c('0x13')]);}})[_0x5e3c('0x14')](function(_0x321487){logger[_0x5e3c('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0xc8c788,_0x321487);_0x3068c6(_0x321487);});});} \ No newline at end of file +var _0x0738=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x0738,0x6e));var _0x8073=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0x0738[_0x3b0c9d];return _0xcfc8d7;};'use strict';var _=require(_0x8073('0x0'));var util=require('util');var moment=require(_0x8073('0x1'));var BPromise=require(_0x8073('0x2'));var rs=require(_0x8073('0x3'));var fs=require('fs');var Redis=require(_0x8073('0x4'));var db=require(_0x8073('0x5'))['db'];var utils=require(_0x8073('0x6'));var logger=require(_0x8073('0x7'))(_0x8073('0x8'));var config=require(_0x8073('0x9'));var jayson=require(_0x8073('0xa'));var client=jayson[_0x8073('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aad61,_0x16ff8b,_0x2899ce){return new BPromise(function(_0x310f3a,_0x3f7807){return client[_0x8073('0xc')](_0x1aad61,_0x2899ce)[_0x8073('0xd')](function(_0x57b564){logger[_0x8073('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x16ff8b,'request\x20sent');logger[_0x8073('0xf')](_0x8073('0x10'),_0x16ff8b,_0x8073('0x11'),JSON[_0x8073('0x12')](_0x57b564));if(_0x57b564['error']){if(_0x57b564[_0x8073('0x13')][_0x8073('0x14')]===0x1f4){logger['error'](_0x8073('0x15'),_0x16ff8b,_0x57b564['error'][_0x8073('0x16')]);return _0x3f7807(_0x57b564[_0x8073('0x13')][_0x8073('0x16')]);}logger[_0x8073('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x16ff8b,_0x57b564[_0x8073('0x13')][_0x8073('0x16')]);return _0x310f3a(_0x57b564[_0x8073('0x13')][_0x8073('0x16')]);}else{logger[_0x8073('0xe')](_0x8073('0x15'),_0x16ff8b,_0x8073('0x11'));_0x310f3a(_0x57b564['result'][_0x8073('0x16')]);}})['catch'](function(_0xe9c222){logger[_0x8073('0x13')](_0x8073('0x15'),_0x16ff8b,_0xe9c222);_0x3f7807(_0xe9c222);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index da0063d..a999642 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 _0xdf38=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','/:id','update','delete','exports'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xdf38,0x16b));var _0x8df3=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xdf38[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x8df3('0x0'));var util=require('util');var path=require(_0x8df3('0x1'));var timeout=require(_0x8df3('0x2'));var express=require(_0x8df3('0x3'));var router=express[_0x8df3('0x4')]();var fs_extra=require(_0x8df3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8df3('0x6'));var config=require(_0x8df3('0x7'));var controller=require(_0x8df3('0x8'));router[_0x8df3('0x9')]('/',auth[_0x8df3('0xa')](),controller[_0x8df3('0xb')]);router[_0x8df3('0x9')]('/:id',auth[_0x8df3('0xa')](),controller[_0x8df3('0xc')]);router['get'](_0x8df3('0xd'),auth['isAuthenticated'](),controller[_0x8df3('0xe')]);var upload=multer({'storage':multer[_0x8df3('0xf')]({'destination':function(_0x14d212,_0x54a6dd,_0x405af2){_0x405af2(null,path['join'](config[_0x8df3('0x10')],_0x8df3('0x11')));},'filename':function(_0x24d69d,_0x5078d6,_0x5d6048){_0x5078d6['originalname']=_0x5078d6[_0x8df3('0x12')][_0x8df3('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5d6048(null,util[_0x8df3('0x14')](_0x8df3('0x15'),path[_0x8df3('0x16')](_0x5078d6[_0x8df3('0x12')],path[_0x8df3('0x17')](_0x5078d6[_0x8df3('0x12')])),Date[_0x8df3('0x18')](),path[_0x8df3('0x17')](_0x5078d6[_0x8df3('0x12')])));}})});router[_0x8df3('0x19')]('/',upload[_0x8df3('0x1a')](_0x8df3('0x1b')),controller[_0x8df3('0x1c')]);router['put'](_0x8df3('0x1d'),auth[_0x8df3('0xa')](),controller[_0x8df3('0x1e')]);router[_0x8df3('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x8df3('0x1f')]);module[_0x8df3('0x20')]=router; \ No newline at end of file +var _0xba1a=['../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xba1a,0x9d));var _0xaba1=function(_0xd09768,_0x322d95){_0xd09768=_0xd09768-0x0;var _0x4e5c54=_0xba1a[_0xd09768];return _0x4e5c54;};'use strict';var multer=require(_0xaba1('0x0'));var util=require(_0xaba1('0x1'));var path=require(_0xaba1('0x2'));var timeout=require(_0xaba1('0x3'));var express=require('express');var router=express[_0xaba1('0x4')]();var fs_extra=require(_0xaba1('0x5'));var auth=require(_0xaba1('0x6'));var interaction=require(_0xaba1('0x7'));var config=require(_0xaba1('0x8'));var controller=require(_0xaba1('0x9'));router[_0xaba1('0xa')]('/',auth[_0xaba1('0xb')](),controller[_0xaba1('0xc')]);router[_0xaba1('0xa')]('/:id',auth[_0xaba1('0xb')](),controller[_0xaba1('0xd')]);router[_0xaba1('0xa')](_0xaba1('0xe'),auth[_0xaba1('0xb')](),controller['download']);var upload=multer({'storage':multer[_0xaba1('0xf')]({'destination':function(_0x2fd9a7,_0x292388,_0x493345){_0x493345(null,path[_0xaba1('0x10')](config[_0xaba1('0x11')],'server/files/sounds/original/'));},'filename':function(_0x4bbf13,_0x4ad69d,_0x260673){_0x4ad69d[_0xaba1('0x12')]=_0x4ad69d[_0xaba1('0x12')][_0xaba1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x260673(null,util[_0xaba1('0x14')](_0xaba1('0x15'),path['basename'](_0x4ad69d[_0xaba1('0x12')],path[_0xaba1('0x16')](_0x4ad69d[_0xaba1('0x12')])),Date[_0xaba1('0x17')](),path[_0xaba1('0x16')](_0x4ad69d[_0xaba1('0x12')])));}})});router[_0xaba1('0x18')]('/',upload[_0xaba1('0x19')](_0xaba1('0x1a')),controller[_0xaba1('0x1b')]);router[_0xaba1('0x1c')](_0xaba1('0x1d'),auth[_0xaba1('0xb')](),controller[_0xaba1('0x1e')]);router[_0xaba1('0x1f')](_0xaba1('0x1d'),auth[_0xaba1('0xb')](),controller[_0xaba1('0x1f')]);module[_0xaba1('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index bf33842..038b5d4 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 _0xb7da=['STRING','FLOAT','BIGINT','INTEGER','exports','name'];(function(_0x4ef724,_0x2eaa8f){var _0x16b426=function(_0x2c336b){while(--_0x2c336b){_0x4ef724['push'](_0x4ef724['shift']());}};_0x16b426(++_0x2eaa8f);}(_0xb7da,0x88));var _0xab7d=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xb7da[_0x1064bc];return _0x5edc45;};'use strict';var Sequelize=require('sequelize');module[_0xab7d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xab7d('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xab7d('0x2')]},'display_name':{'type':Sequelize[_0xab7d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xab7d('0x2')]},'original_format':{'type':Sequelize[_0xab7d('0x2')]},'original_duration':{'type':Sequelize[_0xab7d('0x3')]},'original_sampleCount':{'type':Sequelize[_0xab7d('0x4')]},'original_channelCount':{'type':Sequelize[_0xab7d('0x5')]},'original_bitRate':{'type':Sequelize[_0xab7d('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xab7d('0x2')]},'converted_duration':{'type':Sequelize[_0xab7d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xab7d('0x4')]},'converted_channelCount':{'type':Sequelize[_0xab7d('0x5')]},'converted_bitRate':{'type':Sequelize[_0xab7d('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xab7d('0x5')]}}; \ No newline at end of file +var _0x38ed=['name','BIGINT','INTEGER','FLOAT','sequelize','STRING'];(function(_0x2f3782,_0x150f14){var _0x40a8c4=function(_0x1cdc87){while(--_0x1cdc87){_0x2f3782['push'](_0x2f3782['shift']());}};_0x40a8c4(++_0x150f14);}(_0x38ed,0x118));var _0xd38e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x38ed[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xd38e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd38e('0x1')],'unique':_0xd38e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd38e('0x1')]},'display_name':{'type':Sequelize[_0xd38e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xd38e('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xd38e('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd38e('0x3')]},'original_sampleRate':{'type':Sequelize[_0xd38e('0x4')]},'converted_format':{'type':Sequelize[_0xd38e('0x1')]},'converted_duration':{'type':Sequelize[_0xd38e('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xd38e('0x3')]},'converted_channelCount':{'type':Sequelize[_0xd38e('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xd38e('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 16efc4e..49efbbe 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 _0x704f=['original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','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','offset','undefined','limit','count','apply','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','Sound','length','find','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','download','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x704f,0x178));var _0xf704=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x704f[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf704('0x0'));var zipdir=require(_0xf704('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf704('0x2'));var moment=require('moment');var BPromise=require(_0xf704('0x3'));var Mustache=require(_0xf704('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf704('0x5'));var csv=require('to-csv');var ejs=require(_0xf704('0x6'));var fs=require('fs');var fs_extra=require(_0xf704('0x7'));var _=require(_0xf704('0x8'));var squel=require('squel');var crypto=require(_0xf704('0x9'));var jsforce=require(_0xf704('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf704('0xb'));var Papa=require('papaparse');var Redis=require(_0xf704('0xc'));var authService=require(_0xf704('0xd'));var qs=require(_0xf704('0xe'));var as=require(_0xf704('0xf'));var hardwareService=require(_0xf704('0x10'));var logger=require(_0xf704('0x11'))('api');var utils=require(_0xf704('0x12'));var config=require(_0xf704('0x13'));var licenseUtil=require(_0xf704('0x14'));var db=require(_0xf704('0x15'))['db'];function respondWithStatusCode(_0x383d4b,_0x37fc8e){_0x37fc8e=_0x37fc8e||0xcc;return function(_0x572b7c){if(_0x572b7c){return _0x383d4b['sendStatus'](_0x37fc8e);}return _0x383d4b['status'](_0x37fc8e)['end']();};}function respondWithResult(_0x4edc25,_0x147402){_0x147402=_0x147402||0xc8;return function(_0x358553){if(_0x358553){return _0x4edc25[_0xf704('0x16')](_0x147402)[_0xf704('0x17')](_0x358553);}};}function respondWithFilteredResult(_0x4b98b5,_0x43eac6){return function(_0x1fb15f){if(_0x1fb15f){var _0x4e7d89=typeof _0x43eac6[_0xf704('0x18')]===_0xf704('0x19')&&typeof _0x43eac6[_0xf704('0x1a')]==='undefined';var _0x1a41b5=_0x1fb15f[_0xf704('0x1b')];var _0x594298=_0x4e7d89?0x0:_0x43eac6[_0xf704('0x18')];var _0x3066c7=_0x4e7d89?_0x1fb15f[_0xf704('0x1b')]:_0x43eac6[_0xf704('0x18')]+_0x43eac6[_0xf704('0x1a')];var _0x3116bf;if(_0x3066c7>=_0x1a41b5){_0x3066c7=_0x1a41b5;_0x3116bf=0xc8;}else{_0x3116bf=0xce;}_0x4b98b5[_0xf704('0x16')](_0x3116bf);return _0x4b98b5['set']('Content-Range',_0x594298+'-'+_0x3066c7+'/'+_0x1a41b5)[_0xf704('0x17')](_0x1fb15f);}return null;};}function patchUpdates(_0x36c062){return function(_0x44f37e){try{jsonpatch[_0xf704('0x1c')](_0x44f37e,_0x36c062,!![]);}catch(_0x460cdf){return BPromise['reject'](_0x460cdf);}return _0x44f37e[_0xf704('0x1d')]();};}function saveUpdates(_0x29f63c,_0x14ba11){return function(_0x5200ff){if(_0x5200ff){return _0x5200ff[_0xf704('0x1e')](_0x29f63c)[_0xf704('0x1f')](function(_0x3bcfdf){return _0x3bcfdf;});}return null;};}function removeEntity(_0x4f00f8,_0x4c00da){return function(_0x5020a8){if(_0x5020a8){return _0x5020a8[_0xf704('0x20')]()[_0xf704('0x1f')](function(){var _0x236b24=_0x5020a8[_0xf704('0x21')]({'plain':!![]});var _0x4561fc=_0xf704('0x22');return db[_0xf704('0x23')][_0xf704('0x20')]({'where':{'type':_0x4561fc,'resourceId':_0x236b24['id']}})[_0xf704('0x1f')](function(){return _0x5020a8;});})[_0xf704('0x1f')](function(){_0x4f00f8[_0xf704('0x16')](0xcc)[_0xf704('0x24')]();});}};}function handleEntityNotFound(_0x1cf311,_0x1086b7){return function(_0x862a25){if(!_0x862a25){_0x1cf311['sendStatus'](0x194);}return _0x862a25;};}function handleError(_0xa1cd43,_0x2d6f54){_0x2d6f54=_0x2d6f54||0x1f4;return function(_0x1befb2){logger[_0xf704('0x25')](_0x1befb2['stack']);if(_0x1befb2[_0xf704('0x26')]){delete _0x1befb2['name'];}_0xa1cd43[_0xf704('0x16')](_0x2d6f54)[_0xf704('0x27')](_0x1befb2);};}exports[_0xf704('0x28')]=function(_0x23b0d1,_0x252cd7){var _0xe06e89={},_0x4180a1={},_0x3f643a={'count':0x0,'rows':[]};var _0x294c66=_[_0xf704('0x29')](db['Sound'][_0xf704('0x2a')],function(_0x2009d9){return{'name':_0x2009d9[_0xf704('0x2b')],'type':_0x2009d9[_0xf704('0x2c')][_0xf704('0x2d')]};});_0x4180a1[_0xf704('0x2e')]=_['map'](_0x294c66,_0xf704('0x26'));_0x4180a1[_0xf704('0x2f')]=_['keys'](_0x23b0d1['query']);_0x4180a1[_0xf704('0x30')]=_[_0xf704('0x31')](_0x4180a1['model'],_0x4180a1[_0xf704('0x2f')]);_0xe06e89[_0xf704('0x32')]=_[_0xf704('0x31')](_0x4180a1['model'],qs[_0xf704('0x33')](_0x23b0d1[_0xf704('0x2f')]['fields']));_0xe06e89[_0xf704('0x32')]=_0xe06e89[_0xf704('0x32')]['length']?_0xe06e89['attributes']:_0x4180a1[_0xf704('0x2e')];if(!_0x23b0d1[_0xf704('0x2f')][_0xf704('0x34')]('nolimit')){_0xe06e89['limit']=qs[_0xf704('0x1a')](_0x23b0d1['query'][_0xf704('0x1a')]);_0xe06e89[_0xf704('0x18')]=qs[_0xf704('0x18')](_0x23b0d1['query']['offset']);}_0xe06e89['order']=qs[_0xf704('0x35')](_0x23b0d1['query'][_0xf704('0x35')]);_0xe06e89['where']=qs['filters'](_[_0xf704('0x36')](_0x23b0d1[_0xf704('0x2f')],_0x4180a1[_0xf704('0x30')]),_0x294c66);if(_0x23b0d1[_0xf704('0x2f')][_0xf704('0x37')]){_0xe06e89[_0xf704('0x38')]=_[_0xf704('0x39')](_0xe06e89['where'],{'$or':_[_0xf704('0x29')](_0x294c66,function(_0x1c71ce){if(_0x1c71ce['type']!==_0xf704('0x3a')){var _0x183984={};_0x183984[_0x1c71ce['name']]={'$like':'%'+_0x23b0d1[_0xf704('0x2f')][_0xf704('0x37')]+'%'};return _0x183984;}})});}_0xe06e89=_[_0xf704('0x39')]({},_0xe06e89,_0x23b0d1[_0xf704('0x3b')]);var _0x29c549={'where':_0xe06e89['where']};return db['Sound'][_0xf704('0x1b')](_0x29c549)[_0xf704('0x1f')](function(_0x34a0ef){_0x3f643a['count']=_0x34a0ef;if(_0x23b0d1[_0xf704('0x2f')][_0xf704('0x3c')]){_0xe06e89[_0xf704('0x3d')]=[{'all':!![]}];}return db['Sound']['findAll'](_0xe06e89);})[_0xf704('0x1f')](function(_0x1cb6ed){_0x3f643a[_0xf704('0x3e')]=_0x1cb6ed;return _0x3f643a;})[_0xf704('0x1f')](respondWithFilteredResult(_0x252cd7,_0xe06e89))[_0xf704('0x3f')](handleError(_0x252cd7,null));};exports[_0xf704('0x40')]=function(_0x338bda,_0x4fed20){var _0x294cd1={'raw':!![],'where':{'id':_0x338bda[_0xf704('0x41')]['id']}},_0xecad4a={};_0xecad4a[_0xf704('0x2e')]=_[_0xf704('0x42')](db[_0xf704('0x43')][_0xf704('0x2a')]);_0xecad4a['query']=_['keys'](_0x338bda['query']);_0xecad4a[_0xf704('0x30')]=_[_0xf704('0x31')](_0xecad4a[_0xf704('0x2e')],_0xecad4a[_0xf704('0x2f')]);_0x294cd1[_0xf704('0x32')]=_['intersection'](_0xecad4a[_0xf704('0x2e')],qs[_0xf704('0x33')](_0x338bda[_0xf704('0x2f')]['fields']));_0x294cd1[_0xf704('0x32')]=_0x294cd1[_0xf704('0x32')][_0xf704('0x44')]?_0x294cd1[_0xf704('0x32')]:_0xecad4a['model'];if(_0x338bda[_0xf704('0x2f')]['includeAll']){_0x294cd1[_0xf704('0x3d')]=[{'all':!![]}];}_0x294cd1=_['merge']({},_0x294cd1,_0x338bda[_0xf704('0x3b')]);return db[_0xf704('0x43')][_0xf704('0x45')](_0x294cd1)['then'](handleEntityNotFound(_0x4fed20,null))[_0xf704('0x1f')](respondWithResult(_0x4fed20,null))[_0xf704('0x3f')](handleError(_0x4fed20,null));};exports['download']=function(_0x46cb2d,_0x26ff23,_0xd33ebc){return db[_0xf704('0x43')][_0xf704('0x45')]({'where':{'id':_0x46cb2d['params']['id']},'attributes':[_0xf704('0x26'),_0xf704('0x46'),_0xf704('0x47')],'raw':!![]})[_0xf704('0x1f')](handleEntityNotFound(_0x26ff23,null))['then'](function(_0x9ed45e){if(_0x9ed45e){if(!fs['existsSync'](path[_0xf704('0x48')](config[_0xf704('0x49')],_0xf704('0x4a'),_0x9ed45e[_0xf704('0x46')]+'.'+_0x9ed45e[_0xf704('0x47')]))){throw new db['Sequelize'][(_0xf704('0x4b'))]('Sound\x20not\x20found');}return _0x26ff23[_0xf704('0x4c')](path['join'](config[_0xf704('0x49')],'server/files/sounds/converted',util['format']('%s.%s',_0x9ed45e[_0xf704('0x46')],_0x9ed45e['converted_format'])),util[_0xf704('0x4d')]('%s.%s',_0x9ed45e['name'],_0x9ed45e[_0xf704('0x47')]));}return null;})[_0xf704('0x3f')](handleError(_0x26ff23,null));};exports[_0xf704('0x4e')]=function(_0x5e839c,_0x39a3a7,_0x4dba2d){var _0x7813fb={'name':path[_0xf704('0x4f')](_0x5e839c[_0xf704('0x50')][_0xf704('0x51')],path[_0xf704('0x52')](_0x5e839c[_0xf704('0x50')][_0xf704('0x51')])),'save_name':path[_0xf704('0x4f')](_0x5e839c[_0xf704('0x50')][_0xf704('0x53')],path[_0xf704('0x52')](_0x5e839c[_0xf704('0x50')][_0xf704('0x53')])),'original_format':path['extname'](_0x5e839c['file'][_0xf704('0x51')])[_0xf704('0x54')](0x1),'converted_format':_0xf704('0x55')};var _0x1cd883=path[_0xf704('0x48')](config['root'],_0xf704('0x56'),_0x5e839c[_0xf704('0x50')][_0xf704('0x53')]);var _0x332d32=path[_0xf704('0x48')](config[_0xf704('0x49')],_0xf704('0x4a'),util[_0xf704('0x4d')](_0xf704('0x57'),path[_0xf704('0x4f')](_0x5e839c['file'][_0xf704('0x53')],path[_0xf704('0x52')](_0x5e839c[_0xf704('0x50')][_0xf704('0x53')])),_0x7813fb[_0xf704('0x47')]));logger[_0xf704('0x58')](_0xf704('0x59'),_0x1cd883);logger['info'](_0xf704('0x5a'),_0x332d32);try{fs[_0xf704('0x5b')](_0x1cd883,parseInt('0777',0x8));var _0x282689=sox[_0xf704('0x5c')](_0x1cd883,_0x332d32,{'sampleRate':0x1f40,'format':_0xf704('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x282689['on'](_0xf704('0x25'),function(_0x1fa492){fs[_0xf704('0x5d')](_0x1cd883);_0x39a3a7[_0xf704('0x16')](0x1f4)[_0xf704('0x27')](_0x1fa492);});_0x282689['on']('src',function(_0xe831af){_0x7813fb[_0xf704('0x5e')]=isNaN(_0xe831af['duration'])?null:_0xe831af[_0xf704('0x5f')]*0x3e8;_0x7813fb[_0xf704('0x60')]=isNaN(_0xe831af[_0xf704('0x61')])?null:_0xe831af[_0xf704('0x61')];_0x7813fb[_0xf704('0x62')]=isNaN(_0xe831af[_0xf704('0x63')])?null:_0xe831af[_0xf704('0x63')];_0x7813fb[_0xf704('0x64')]=isNaN(_0xe831af[_0xf704('0x65')])?null:_0xe831af['bitRate'];_0x7813fb[_0xf704('0x66')]=isNaN(_0xe831af[_0xf704('0x67')])?null:_0xe831af[_0xf704('0x67')];});_0x282689['on']('dest',function(_0x4fc3b4){_0x7813fb[_0xf704('0x68')]=isNaN(_0x4fc3b4[_0xf704('0x5f')])?null:_0x4fc3b4[_0xf704('0x5f')]*0x3e8;_0x7813fb[_0xf704('0x69')]=isNaN(_0x4fc3b4[_0xf704('0x61')])?null:_0x4fc3b4[_0xf704('0x61')];_0x7813fb[_0xf704('0x6a')]=isNaN(_0x4fc3b4[_0xf704('0x63')])?null:_0x4fc3b4['channelCount'];_0x7813fb['converted_bitRate']=isNaN(_0x4fc3b4['bitRate'])?null:_0x4fc3b4[_0xf704('0x65')];_0x7813fb[_0xf704('0x6b')]=isNaN(_0x4fc3b4['sampleRate'])?null:_0x4fc3b4[_0xf704('0x67')];});_0x282689['on'](_0xf704('0x24'),function(){fs['chmodSync'](_0x332d32,parseInt(_0xf704('0x6c'),0x8));return db['Sound']['create'](_0x7813fb)[_0xf704('0x1f')](function(_0x11a5ab){var _0x120bf4={'role':_0x5e839c[_0xf704('0x6d')]['role'],'userProfileId':_0x5e839c['body'][_0xf704('0x6e')]};if(!_0x120bf4)throw new Error(_0xf704('0x6f'));if(_0x120bf4[_0xf704('0x70')]==='user'){var _0x5024ba=_0x11a5ab[_0xf704('0x21')]({'plain':!![]});return db[_0xf704('0x71')][_0xf704('0x45')]({'where':{'name':'Sounds','userProfileId':_0x120bf4[_0xf704('0x6e')]},'raw':!![]})[_0xf704('0x1f')](function(_0x54fe2d){if(_0x54fe2d&&_0x54fe2d[_0xf704('0x72')]===0x0){return db['UserProfileResource'][_0xf704('0x4e')]({'name':_0x5024ba[_0xf704('0x26')],'resourceId':_0x5024ba['id'],'type':_0x54fe2d[_0xf704('0x26')],'sectionId':_0x54fe2d['id']},{})[_0xf704('0x1f')](function(){return _0x11a5ab;});}else{return _0x11a5ab;}})[_0xf704('0x3f')](function(_0x5ae905){logger[_0xf704('0x25')](_0xf704('0x73'),_0x5ae905);throw _0x5ae905;});}return _0x11a5ab;})['then'](respondWithResult(_0x39a3a7,null))[_0xf704('0x3f')](handleError(_0x39a3a7,null));});_0x282689[_0xf704('0x74')]();}catch(_0xf33ef9){_0x39a3a7[_0xf704('0x16')](0x1f4)[_0xf704('0x27')](_0xf33ef9);}};exports[_0xf704('0x1e')]=function(_0x100122,_0x262432,_0x28d298){return db['Sound'][_0xf704('0x45')]({'where':{'id':_0x100122[_0xf704('0x41')]['id']}})[_0xf704('0x1f')](handleEntityNotFound(_0x262432,null))[_0xf704('0x1f')](saveUpdates(_[_0xf704('0x36')](_0x100122[_0xf704('0x6d')],['name','description']),null))[_0xf704('0x1f')](respondWithResult(_0x262432,null))[_0xf704('0x3f')](handleError(_0x262432,null));};exports[_0xf704('0x75')]=function(_0x104945,_0x5010ae,_0x5d6107){return db[_0xf704('0x43')][_0xf704('0x45')]({'where':{'id':_0x104945[_0xf704('0x41')]['id']}})['then'](function(_0x109482){if(_0x109482){return _0x109482['destroy']();}})[_0xf704('0x1f')](function(_0x52fba0){var _0x16b1ae=path['join'](config['root'],_0xf704('0x56'),util[_0xf704('0x4d')](_0xf704('0x57'),_0x52fba0[_0xf704('0x46')],_0x52fba0[_0xf704('0x76')]));var _0x4305b3=path['join'](config['root'],_0xf704('0x4a'),util['format'](_0xf704('0x57'),_0x52fba0[_0xf704('0x46')],_0x52fba0[_0xf704('0x47')]));fs['unlinkSync'](_0x16b1ae);fs[_0xf704('0x5d')](_0x4305b3);return _0x52fba0;})[_0xf704('0x1f')](function(_0x1a8d98){if(_0x1a8d98){return _0x5010ae[_0xf704('0x16')](0xcc)['end']();}})[_0xf704('0x1f')](handleEntityNotFound(_0x5010ae,null))[_0xf704('0x3f')](handleError(_0x5010ae,null));}; \ No newline at end of file +var _0xde33=['description','delete','original_format','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','catch','show','params','keys','length','include','find','download','existsSync','server/files/sounds/converted','save_name','converted_format','ValidationError','Sound\x20not\x20found','join','root','%s.%s','create','basename','file','extname','filename','originalname','substring','server/files/sounds/original','format','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick'];(function(_0x1a1250,_0x2dbdb1){var _0x4246b5=function(_0x1ce931){while(--_0x1ce931){_0x1a1250['push'](_0x1a1250['shift']());}};_0x4246b5(++_0x2dbdb1);}(_0xde33,0x106));var _0x3de3=function(_0x36dae3,_0x195fd8){_0x36dae3=_0x36dae3-0x0;var _0x4dd7ff=_0xde33[_0x36dae3];return _0x4dd7ff;};'use strict';var emlformat=require(_0x3de3('0x0'));var rimraf=require(_0x3de3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3de3('0x2'));var rp=require(_0x3de3('0x3'));var moment=require(_0x3de3('0x4'));var BPromise=require(_0x3de3('0x5'));var Mustache=require(_0x3de3('0x6'));var util=require(_0x3de3('0x7'));var path=require(_0x3de3('0x8'));var sox=require(_0x3de3('0x9'));var csv=require(_0x3de3('0xa'));var ejs=require(_0x3de3('0xb'));var fs=require('fs');var fs_extra=require(_0x3de3('0xc'));var _=require(_0x3de3('0xd'));var squel=require(_0x3de3('0xe'));var crypto=require('crypto');var jsforce=require(_0x3de3('0xf'));var deskjs=require(_0x3de3('0x10'));var toCsv=require(_0x3de3('0xa'));var querystring=require(_0x3de3('0x11'));var Papa=require(_0x3de3('0x12'));var Redis=require('ioredis');var authService=require(_0x3de3('0x13'));var qs=require(_0x3de3('0x14'));var as=require(_0x3de3('0x15'));var hardwareService=require(_0x3de3('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3de3('0x17'));var config=require(_0x3de3('0x18'));var licenseUtil=require(_0x3de3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dc91a,_0x17ba80){_0x17ba80=_0x17ba80||0xcc;return function(_0x332f84){if(_0x332f84){return _0x4dc91a[_0x3de3('0x1a')](_0x17ba80);}return _0x4dc91a[_0x3de3('0x1b')](_0x17ba80)[_0x3de3('0x1c')]();};}function respondWithResult(_0x36bf82,_0x3fc21e){_0x3fc21e=_0x3fc21e||0xc8;return function(_0x29b860){if(_0x29b860){return _0x36bf82['status'](_0x3fc21e)[_0x3de3('0x1d')](_0x29b860);}};}function respondWithFilteredResult(_0x4345f6,_0x572bfa){return function(_0x365f74){if(_0x365f74){var _0x3c375b=typeof _0x572bfa[_0x3de3('0x1e')]==='undefined'&&typeof _0x572bfa[_0x3de3('0x1f')]===_0x3de3('0x20');var _0x1df40c=_0x365f74[_0x3de3('0x21')];var _0x1b733e=_0x3c375b?0x0:_0x572bfa[_0x3de3('0x1e')];var _0x3a51d8=_0x3c375b?_0x365f74[_0x3de3('0x21')]:_0x572bfa[_0x3de3('0x1e')]+_0x572bfa['limit'];var _0x5e3f1d;if(_0x3a51d8>=_0x1df40c){_0x3a51d8=_0x1df40c;_0x5e3f1d=0xc8;}else{_0x5e3f1d=0xce;}_0x4345f6['status'](_0x5e3f1d);return _0x4345f6['set'](_0x3de3('0x22'),_0x1b733e+'-'+_0x3a51d8+'/'+_0x1df40c)[_0x3de3('0x1d')](_0x365f74);}return null;};}function patchUpdates(_0x3ce488){return function(_0x38869e){try{jsonpatch['apply'](_0x38869e,_0x3ce488,!![]);}catch(_0x3bb614){return BPromise[_0x3de3('0x23')](_0x3bb614);}return _0x38869e[_0x3de3('0x24')]();};}function saveUpdates(_0x1933a6,_0x562d67){return function(_0x51d15b){if(_0x51d15b){return _0x51d15b[_0x3de3('0x25')](_0x1933a6)[_0x3de3('0x26')](function(_0x52ccba){return _0x52ccba;});}return null;};}function removeEntity(_0x1d50f0,_0x477336){return function(_0x569510){if(_0x569510){return _0x569510[_0x3de3('0x27')]()['then'](function(){var _0x5464bc=_0x569510['get']({'plain':!![]});var _0x5448d6=_0x3de3('0x28');return db[_0x3de3('0x29')][_0x3de3('0x27')]({'where':{'type':_0x5448d6,'resourceId':_0x5464bc['id']}})['then'](function(){return _0x569510;});})[_0x3de3('0x26')](function(){_0x1d50f0[_0x3de3('0x1b')](0xcc)[_0x3de3('0x1c')]();});}};}function handleEntityNotFound(_0x4182e3,_0x4dc0c9){return function(_0x394a2b){if(!_0x394a2b){_0x4182e3['sendStatus'](0x194);}return _0x394a2b;};}function handleError(_0x533419,_0x5e3849){_0x5e3849=_0x5e3849||0x1f4;return function(_0x3ba104){logger[_0x3de3('0x2a')](_0x3ba104[_0x3de3('0x2b')]);if(_0x3ba104[_0x3de3('0x2c')]){delete _0x3ba104[_0x3de3('0x2c')];}_0x533419['status'](_0x5e3849)[_0x3de3('0x2d')](_0x3ba104);};}exports[_0x3de3('0x2e')]=function(_0x413971,_0x2f4313){var _0x31c0f4={},_0x54def9={},_0x2642e9={'count':0x0,'rows':[]};var _0xff9b81=_[_0x3de3('0x2f')](db['Sound']['rawAttributes'],function(_0x350637){return{'name':_0x350637[_0x3de3('0x30')],'type':_0x350637[_0x3de3('0x31')][_0x3de3('0x32')]};});_0x54def9['model']=_[_0x3de3('0x2f')](_0xff9b81,_0x3de3('0x2c'));_0x54def9['query']=_['keys'](_0x413971[_0x3de3('0x33')]);_0x54def9[_0x3de3('0x34')]=_[_0x3de3('0x35')](_0x54def9['model'],_0x54def9[_0x3de3('0x33')]);_0x31c0f4[_0x3de3('0x36')]=_[_0x3de3('0x35')](_0x54def9['model'],qs[_0x3de3('0x37')](_0x413971[_0x3de3('0x33')][_0x3de3('0x37')]));_0x31c0f4[_0x3de3('0x36')]=_0x31c0f4[_0x3de3('0x36')]['length']?_0x31c0f4[_0x3de3('0x36')]:_0x54def9[_0x3de3('0x38')];if(!_0x413971[_0x3de3('0x33')][_0x3de3('0x39')]('nolimit')){_0x31c0f4[_0x3de3('0x1f')]=qs[_0x3de3('0x1f')](_0x413971['query']['limit']);_0x31c0f4[_0x3de3('0x1e')]=qs[_0x3de3('0x1e')](_0x413971[_0x3de3('0x33')][_0x3de3('0x1e')]);}_0x31c0f4[_0x3de3('0x3a')]=qs[_0x3de3('0x3b')](_0x413971[_0x3de3('0x33')][_0x3de3('0x3b')]);_0x31c0f4[_0x3de3('0x3c')]=qs[_0x3de3('0x34')](_['pick'](_0x413971[_0x3de3('0x33')],_0x54def9[_0x3de3('0x34')]),_0xff9b81);if(_0x413971['query'][_0x3de3('0x3d')]){_0x31c0f4[_0x3de3('0x3c')]=_[_0x3de3('0x3e')](_0x31c0f4[_0x3de3('0x3c')],{'$or':_[_0x3de3('0x2f')](_0xff9b81,function(_0x15b286){if(_0x15b286[_0x3de3('0x31')]!==_0x3de3('0x3f')){var _0xd898d={};_0xd898d[_0x15b286[_0x3de3('0x2c')]]={'$like':'%'+_0x413971[_0x3de3('0x33')]['filter']+'%'};return _0xd898d;}})});}_0x31c0f4=_[_0x3de3('0x3e')]({},_0x31c0f4,_0x413971[_0x3de3('0x40')]);var _0x601fa1={'where':_0x31c0f4[_0x3de3('0x3c')]};return db[_0x3de3('0x41')][_0x3de3('0x21')](_0x601fa1)[_0x3de3('0x26')](function(_0x28e771){_0x2642e9[_0x3de3('0x21')]=_0x28e771;if(_0x413971[_0x3de3('0x33')][_0x3de3('0x42')]){_0x31c0f4['include']=[{'all':!![]}];}return db[_0x3de3('0x41')][_0x3de3('0x43')](_0x31c0f4);})[_0x3de3('0x26')](function(_0x28b3cd){_0x2642e9[_0x3de3('0x44')]=_0x28b3cd;return _0x2642e9;})[_0x3de3('0x26')](respondWithFilteredResult(_0x2f4313,_0x31c0f4))[_0x3de3('0x45')](handleError(_0x2f4313,null));};exports[_0x3de3('0x46')]=function(_0x3c08e0,_0x5fe1af){var _0x3b5a26={'raw':!![],'where':{'id':_0x3c08e0[_0x3de3('0x47')]['id']}},_0x2234f0={};_0x2234f0[_0x3de3('0x38')]=_[_0x3de3('0x48')](db[_0x3de3('0x41')]['rawAttributes']);_0x2234f0['query']=_[_0x3de3('0x48')](_0x3c08e0[_0x3de3('0x33')]);_0x2234f0[_0x3de3('0x34')]=_['intersection'](_0x2234f0[_0x3de3('0x38')],_0x2234f0[_0x3de3('0x33')]);_0x3b5a26[_0x3de3('0x36')]=_[_0x3de3('0x35')](_0x2234f0['model'],qs[_0x3de3('0x37')](_0x3c08e0[_0x3de3('0x33')][_0x3de3('0x37')]));_0x3b5a26[_0x3de3('0x36')]=_0x3b5a26[_0x3de3('0x36')][_0x3de3('0x49')]?_0x3b5a26[_0x3de3('0x36')]:_0x2234f0[_0x3de3('0x38')];if(_0x3c08e0[_0x3de3('0x33')][_0x3de3('0x42')]){_0x3b5a26[_0x3de3('0x4a')]=[{'all':!![]}];}_0x3b5a26=_['merge']({},_0x3b5a26,_0x3c08e0[_0x3de3('0x40')]);return db[_0x3de3('0x41')][_0x3de3('0x4b')](_0x3b5a26)[_0x3de3('0x26')](handleEntityNotFound(_0x5fe1af,null))[_0x3de3('0x26')](respondWithResult(_0x5fe1af,null))[_0x3de3('0x45')](handleError(_0x5fe1af,null));};exports[_0x3de3('0x4c')]=function(_0x4aaf76,_0x3d230c,_0x3ab08a){return db[_0x3de3('0x41')][_0x3de3('0x4b')]({'where':{'id':_0x4aaf76[_0x3de3('0x47')]['id']},'attributes':[_0x3de3('0x2c'),'save_name','converted_format'],'raw':!![]})[_0x3de3('0x26')](handleEntityNotFound(_0x3d230c,null))[_0x3de3('0x26')](function(_0x1270b2){if(_0x1270b2){if(!fs[_0x3de3('0x4d')](path['join'](config['root'],_0x3de3('0x4e'),_0x1270b2[_0x3de3('0x4f')]+'.'+_0x1270b2[_0x3de3('0x50')]))){throw new db['Sequelize'][(_0x3de3('0x51'))](_0x3de3('0x52'));}return _0x3d230c['download'](path[_0x3de3('0x53')](config[_0x3de3('0x54')],_0x3de3('0x4e'),util['format'](_0x3de3('0x55'),_0x1270b2[_0x3de3('0x4f')],_0x1270b2[_0x3de3('0x50')])),util['format']('%s.%s',_0x1270b2['name'],_0x1270b2[_0x3de3('0x50')]));}return null;})[_0x3de3('0x45')](handleError(_0x3d230c,null));};exports[_0x3de3('0x56')]=function(_0x5419d5,_0x2bbe6a,_0x4bd3dc){var _0x3e0de0={'name':path[_0x3de3('0x57')](_0x5419d5[_0x3de3('0x58')]['originalname'],path[_0x3de3('0x59')](_0x5419d5[_0x3de3('0x58')]['originalname'])),'save_name':path['basename'](_0x5419d5[_0x3de3('0x58')][_0x3de3('0x5a')],path['extname'](_0x5419d5[_0x3de3('0x58')][_0x3de3('0x5a')])),'original_format':path[_0x3de3('0x59')](_0x5419d5[_0x3de3('0x58')][_0x3de3('0x5b')])[_0x3de3('0x5c')](0x1),'converted_format':'wav'};var _0x4b78ee=path[_0x3de3('0x53')](config[_0x3de3('0x54')],_0x3de3('0x5d'),_0x5419d5[_0x3de3('0x58')][_0x3de3('0x5a')]);var _0x5f431c=path[_0x3de3('0x53')](config[_0x3de3('0x54')],'server/files/sounds/converted',util[_0x3de3('0x5e')](_0x3de3('0x55'),path[_0x3de3('0x57')](_0x5419d5[_0x3de3('0x58')][_0x3de3('0x5a')],path[_0x3de3('0x59')](_0x5419d5[_0x3de3('0x58')]['filename'])),_0x3e0de0['converted_format']));logger['info'](_0x3de3('0x5f'),_0x4b78ee);logger['info'](_0x3de3('0x60'),_0x5f431c);try{fs['chmodSync'](_0x4b78ee,parseInt(_0x3de3('0x61'),0x8));var _0x236390=sox[_0x3de3('0x62')](_0x4b78ee,_0x5f431c,{'sampleRate':0x1f40,'format':_0x3de3('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x236390['on']('error',function(_0x390ed8){fs['unlinkSync'](_0x4b78ee);_0x2bbe6a[_0x3de3('0x1b')](0x1f4)[_0x3de3('0x2d')](_0x390ed8);});_0x236390['on'](_0x3de3('0x64'),function(_0x41cdc7){_0x3e0de0[_0x3de3('0x65')]=isNaN(_0x41cdc7[_0x3de3('0x66')])?null:_0x41cdc7[_0x3de3('0x66')]*0x3e8;_0x3e0de0[_0x3de3('0x67')]=isNaN(_0x41cdc7[_0x3de3('0x68')])?null:_0x41cdc7[_0x3de3('0x68')];_0x3e0de0[_0x3de3('0x69')]=isNaN(_0x41cdc7[_0x3de3('0x6a')])?null:_0x41cdc7['channelCount'];_0x3e0de0[_0x3de3('0x6b')]=isNaN(_0x41cdc7[_0x3de3('0x6c')])?null:_0x41cdc7[_0x3de3('0x6c')];_0x3e0de0[_0x3de3('0x6d')]=isNaN(_0x41cdc7['sampleRate'])?null:_0x41cdc7[_0x3de3('0x6e')];});_0x236390['on']('dest',function(_0x512931){_0x3e0de0[_0x3de3('0x6f')]=isNaN(_0x512931[_0x3de3('0x66')])?null:_0x512931[_0x3de3('0x66')]*0x3e8;_0x3e0de0[_0x3de3('0x70')]=isNaN(_0x512931[_0x3de3('0x68')])?null:_0x512931['sampleCount'];_0x3e0de0[_0x3de3('0x71')]=isNaN(_0x512931[_0x3de3('0x6a')])?null:_0x512931[_0x3de3('0x6a')];_0x3e0de0[_0x3de3('0x72')]=isNaN(_0x512931['bitRate'])?null:_0x512931[_0x3de3('0x6c')];_0x3e0de0[_0x3de3('0x73')]=isNaN(_0x512931[_0x3de3('0x6e')])?null:_0x512931[_0x3de3('0x6e')];});_0x236390['on'](_0x3de3('0x1c'),function(){fs[_0x3de3('0x74')](_0x5f431c,parseInt(_0x3de3('0x61'),0x8));return db[_0x3de3('0x41')][_0x3de3('0x56')](_0x3e0de0)[_0x3de3('0x26')](function(_0x598665){var _0x46eec2={'role':_0x5419d5[_0x3de3('0x75')][_0x3de3('0x76')],'userProfileId':_0x5419d5[_0x3de3('0x75')][_0x3de3('0x77')]};if(!_0x46eec2)throw new Error(_0x3de3('0x78'));if(_0x46eec2[_0x3de3('0x76')]==='user'){var _0x3876a0=_0x598665['get']({'plain':!![]});return db[_0x3de3('0x79')][_0x3de3('0x4b')]({'where':{'name':_0x3de3('0x28'),'userProfileId':_0x46eec2[_0x3de3('0x77')]},'raw':!![]})['then'](function(_0x1ffd3f){if(_0x1ffd3f&&_0x1ffd3f['autoAssociation']===0x0){return db[_0x3de3('0x29')][_0x3de3('0x56')]({'name':_0x3876a0[_0x3de3('0x2c')],'resourceId':_0x3876a0['id'],'type':_0x1ffd3f[_0x3de3('0x2c')],'sectionId':_0x1ffd3f['id']},{})[_0x3de3('0x26')](function(){return _0x598665;});}else{return _0x598665;}})[_0x3de3('0x45')](function(_0x192b96){logger['error'](_0x3de3('0x7a'),_0x192b96);throw _0x192b96;});}return _0x598665;})[_0x3de3('0x26')](respondWithResult(_0x2bbe6a,null))['catch'](handleError(_0x2bbe6a,null));});_0x236390[_0x3de3('0x7b')]();}catch(_0x3b8a1b){_0x2bbe6a['status'](0x1f4)[_0x3de3('0x2d')](_0x3b8a1b);}};exports['update']=function(_0x3996cf,_0x67ca5d,_0x31270c){return db[_0x3de3('0x41')][_0x3de3('0x4b')]({'where':{'id':_0x3996cf[_0x3de3('0x47')]['id']}})[_0x3de3('0x26')](handleEntityNotFound(_0x67ca5d,null))['then'](saveUpdates(_[_0x3de3('0x7c')](_0x3996cf['body'],['name',_0x3de3('0x7d')]),null))[_0x3de3('0x26')](respondWithResult(_0x67ca5d,null))[_0x3de3('0x45')](handleError(_0x67ca5d,null));};exports[_0x3de3('0x7e')]=function(_0x3f4126,_0x2a6db6,_0x83b25b){return db[_0x3de3('0x41')][_0x3de3('0x4b')]({'where':{'id':_0x3f4126[_0x3de3('0x47')]['id']}})['then'](function(_0x5f527f){if(_0x5f527f){return _0x5f527f[_0x3de3('0x27')]();}})[_0x3de3('0x26')](function(_0x7ded3c){var _0xaa9723=path[_0x3de3('0x53')](config[_0x3de3('0x54')],'server/files/sounds/original',util[_0x3de3('0x5e')](_0x3de3('0x55'),_0x7ded3c[_0x3de3('0x4f')],_0x7ded3c[_0x3de3('0x7f')]));var _0x5734ad=path['join'](config[_0x3de3('0x54')],_0x3de3('0x4e'),util[_0x3de3('0x5e')]('%s.%s',_0x7ded3c['save_name'],_0x7ded3c[_0x3de3('0x50')]));fs[_0x3de3('0x80')](_0xaa9723);fs[_0x3de3('0x80')](_0x5734ad);return _0x7ded3c;})[_0x3de3('0x26')](function(_0x2b99dd){if(_0x2b99dd){return _0x2a6db6[_0x3de3('0x1b')](0xcc)[_0x3de3('0x1c')]();}})[_0x3de3('0x26')](handleEntityNotFound(_0x2a6db6,null))[_0x3de3('0x45')](handleError(_0x2a6db6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 782bbe6..2bc3785 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 _0xccd0=['moment','bluebird','rimraf','../../config/environment','Sound','tools_sounds','lodash','util','../../config/logger','api'];(function(_0x8b0818,_0x59a8a7){var _0x2e3f03=function(_0x4182ad){while(--_0x4182ad){_0x8b0818['push'](_0x8b0818['shift']());}};_0x2e3f03(++_0x59a8a7);}(_0xccd0,0xce));var _0x0ccd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xccd0[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0ccd('0x0'));var util=require(_0x0ccd('0x1'));var logger=require(_0x0ccd('0x2'))(_0x0ccd('0x3'));var moment=require(_0x0ccd('0x4'));var BPromise=require(_0x0ccd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ccd('0x6'));var config=require(_0x0ccd('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x1e3531,_0x1bd7ba){return _0x1e3531['define'](_0x0ccd('0x8'),attributes,{'tableName':_0x0ccd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7caa=['request-promise','path','rimraf','./sound.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x44b7ec,_0x47aacf){var _0x35cc6c=function(_0x53029a){while(--_0x53029a){_0x44b7ec['push'](_0x44b7ec['shift']());}};_0x35cc6c(++_0x47aacf);}(_0x7caa,0xf8));var _0xa7ca=function(_0x48a273,_0x571854){_0x48a273=_0x48a273-0x0;var _0xd59649=_0x7caa[_0x48a273];return _0xd59649;};'use strict';var _=require(_0xa7ca('0x0'));var util=require(_0xa7ca('0x1'));var logger=require(_0xa7ca('0x2'))(_0xa7ca('0x3'));var moment=require('moment');var BPromise=require(_0xa7ca('0x4'));var rp=require(_0xa7ca('0x5'));var fs=require('fs');var path=require(_0xa7ca('0x6'));var rimraf=require(_0xa7ca('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7ca('0x8'));module[_0xa7ca('0x9')]=function(_0x4ca3ed,_0x1c1320){return _0x4ca3ed[_0xa7ca('0xa')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 374c744..4b42b41 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 _0xde71=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','debug'];(function(_0x207949,_0x10a4c0){var _0x42a9ef=function(_0xee6448){while(--_0xee6448){_0x207949['push'](_0x207949['shift']());}};_0x42a9ef(++_0x10a4c0);}(_0xde71,0x186));var _0x1de7=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xde71[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require('lodash');var util=require(_0x1de7('0x0'));var moment=require(_0x1de7('0x1'));var BPromise=require(_0x1de7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1de7('0x3'))['db'];var utils=require(_0x1de7('0x4'));var logger=require(_0x1de7('0x5'))(_0x1de7('0x6'));var config=require('../../config/environment');var jayson=require(_0x1de7('0x7'));var client=jayson['client'][_0x1de7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a87cf,_0x393af0,_0x13facb){return new BPromise(function(_0x3eae05,_0x573e8c){return client['request'](_0x2a87cf,_0x13facb)[_0x1de7('0x9')](function(_0x26a365){logger[_0x1de7('0xa')]('Sound,\x20%s,\x20%s',_0x393af0,_0x1de7('0xb'));logger['debug'](_0x1de7('0xc'),_0x393af0,_0x1de7('0xb'),JSON[_0x1de7('0xd')](_0x26a365));if(_0x26a365['error']){if(_0x26a365[_0x1de7('0xe')][_0x1de7('0xf')]===0x1f4){logger[_0x1de7('0xe')]('Sound,\x20%s,\x20%s',_0x393af0,_0x26a365[_0x1de7('0xe')][_0x1de7('0x10')]);return _0x573e8c(_0x26a365[_0x1de7('0xe')]['message']);}logger['error']('Sound,\x20%s,\x20%s',_0x393af0,_0x26a365[_0x1de7('0xe')][_0x1de7('0x10')]);return _0x3eae05(_0x26a365['error']['message']);}else{logger['info'](_0x1de7('0x11'),_0x393af0,_0x1de7('0xb'));_0x3eae05(_0x26a365['result'][_0x1de7('0x10')]);}})[_0x1de7('0x12')](function(_0x392297){logger[_0x1de7('0xe')](_0x1de7('0x11'),_0x393af0,_0x392297);_0x573e8c(_0x392297);});});}exports[_0x1de7('0x13')]=function(_0x4ecfd0){var _0x707405=this;return new Promise(function(_0x3fe5a0,_0x5d30c1){return db[_0x1de7('0x14')][_0x1de7('0x15')]({'raw':_0x4ecfd0[_0x1de7('0x16')]?_0x4ecfd0[_0x1de7('0x16')][_0x1de7('0x17')]===undefined?!![]:![]:!![],'where':_0x4ecfd0[_0x1de7('0x16')]?_0x4ecfd0[_0x1de7('0x16')][_0x1de7('0x18')]||null:null,'attributes':_0x4ecfd0[_0x1de7('0x16')]?_0x4ecfd0[_0x1de7('0x16')][_0x1de7('0x19')]||null:null,'include':_0x4ecfd0['options']?_0x4ecfd0['options'][_0x1de7('0x1a')]?_[_0x1de7('0x1b')](_0x4ecfd0[_0x1de7('0x16')][_0x1de7('0x1a')],function(_0xf5141a){return{'model':db[_0xf5141a[_0x1de7('0x1c')]],'as':_0xf5141a['as'],'attributes':_0xf5141a[_0x1de7('0x19')],'include':_0xf5141a['include']?_[_0x1de7('0x1b')](_0xf5141a[_0x1de7('0x1a')],function(_0x36d4cb){return{'model':db[_0x36d4cb[_0x1de7('0x1c')]],'as':_0x36d4cb['as'],'attributes':_0x36d4cb['attributes'],'include':_0x36d4cb[_0x1de7('0x1a')]?_[_0x1de7('0x1b')](_0x36d4cb[_0x1de7('0x1a')],function(_0x3945db){return{'model':db[_0x3945db[_0x1de7('0x1c')]],'as':_0x3945db['as'],'attributes':_0x3945db[_0x1de7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1de7('0x9')](function(_0x66e480){logger[_0x1de7('0xa')](_0x1de7('0x13'),_0x4ecfd0);logger[_0x1de7('0x1d')](_0x1de7('0x13'),_0x4ecfd0,JSON[_0x1de7('0xd')](_0x66e480));_0x3fe5a0(_0x66e480);})[_0x1de7('0x12')](function(_0x548ae9){logger[_0x1de7('0xe')]('ShowSound',_0x548ae9[_0x1de7('0x10')],_0x4ecfd0);_0x5d30c1(_0x707405[_0x1de7('0xe')](0x1f4,_0x548ae9[_0x1de7('0x10')]));});});}; \ No newline at end of file +var _0xc5dc=['find','options','raw','where','attributes','model','map','include','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound'];(function(_0x295583,_0x4756aa){var _0x4c2ae6=function(_0xa20d19){while(--_0xa20d19){_0x295583['push'](_0x295583['shift']());}};_0x4c2ae6(++_0x4756aa);}(_0xc5dc,0xf8));var _0xcc5d=function(_0x2af74a,_0x1ab77f){_0x2af74a=_0x2af74a-0x0;var _0x3b5a85=_0xc5dc[_0x2af74a];return _0x3b5a85;};'use strict';var _=require('lodash');var util=require(_0xcc5d('0x0'));var moment=require(_0xcc5d('0x1'));var BPromise=require(_0xcc5d('0x2'));var rs=require(_0xcc5d('0x3'));var fs=require('fs');var Redis=require(_0xcc5d('0x4'));var db=require(_0xcc5d('0x5'))['db'];var utils=require(_0xcc5d('0x6'));var logger=require('../../config/logger')(_0xcc5d('0x7'));var config=require(_0xcc5d('0x8'));var jayson=require(_0xcc5d('0x9'));var client=jayson['client'][_0xcc5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47e7a5,_0x5be4cc,_0x2cc83b){return new BPromise(function(_0x45a436,_0x495a96){return client['request'](_0x47e7a5,_0x2cc83b)[_0xcc5d('0xb')](function(_0x26363e){logger[_0xcc5d('0xc')](_0xcc5d('0xd'),_0x5be4cc,_0xcc5d('0xe'));logger['debug'](_0xcc5d('0xf'),_0x5be4cc,_0xcc5d('0xe'),JSON['stringify'](_0x26363e));if(_0x26363e[_0xcc5d('0x10')]){if(_0x26363e[_0xcc5d('0x10')][_0xcc5d('0x11')]===0x1f4){logger[_0xcc5d('0x10')](_0xcc5d('0xd'),_0x5be4cc,_0x26363e['error'][_0xcc5d('0x12')]);return _0x495a96(_0x26363e[_0xcc5d('0x10')]['message']);}logger[_0xcc5d('0x10')](_0xcc5d('0xd'),_0x5be4cc,_0x26363e[_0xcc5d('0x10')][_0xcc5d('0x12')]);return _0x45a436(_0x26363e['error']['message']);}else{logger[_0xcc5d('0xc')](_0xcc5d('0xd'),_0x5be4cc,_0xcc5d('0xe'));_0x45a436(_0x26363e[_0xcc5d('0x13')][_0xcc5d('0x12')]);}})[_0xcc5d('0x14')](function(_0x7611b){logger[_0xcc5d('0x10')](_0xcc5d('0xd'),_0x5be4cc,_0x7611b);_0x495a96(_0x7611b);});});}exports[_0xcc5d('0x15')]=function(_0x24d3b9){var _0x40130f=this;return new Promise(function(_0x3789f0,_0x50782b){return db['Sound'][_0xcc5d('0x16')]({'raw':_0x24d3b9['options']?_0x24d3b9[_0xcc5d('0x17')][_0xcc5d('0x18')]===undefined?!![]:![]:!![],'where':_0x24d3b9['options']?_0x24d3b9[_0xcc5d('0x17')][_0xcc5d('0x19')]||null:null,'attributes':_0x24d3b9[_0xcc5d('0x17')]?_0x24d3b9[_0xcc5d('0x17')][_0xcc5d('0x1a')]||null:null,'include':_0x24d3b9[_0xcc5d('0x17')]?_0x24d3b9[_0xcc5d('0x17')]['include']?_['map'](_0x24d3b9[_0xcc5d('0x17')]['include'],function(_0x250fd9){return{'model':db[_0x250fd9[_0xcc5d('0x1b')]],'as':_0x250fd9['as'],'attributes':_0x250fd9[_0xcc5d('0x1a')],'include':_0x250fd9['include']?_[_0xcc5d('0x1c')](_0x250fd9['include'],function(_0x2de554){return{'model':db[_0x2de554[_0xcc5d('0x1b')]],'as':_0x2de554['as'],'attributes':_0x2de554[_0xcc5d('0x1a')],'include':_0x2de554[_0xcc5d('0x1d')]?_['map'](_0x2de554[_0xcc5d('0x1d')],function(_0x19211e){return{'model':db[_0x19211e['model']],'as':_0x19211e['as'],'attributes':_0x19211e[_0xcc5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc5d('0xb')](function(_0x18371e){logger['info'](_0xcc5d('0x15'),_0x24d3b9);logger['debug']('ShowSound',_0x24d3b9,JSON['stringify'](_0x18371e));_0x3789f0(_0x18371e);})['catch'](function(_0x4a7cc3){logger[_0xcc5d('0x10')](_0xcc5d('0x15'),_0x4a7cc3[_0xcc5d('0x12')],_0x24d3b9);_0x50782b(_0x40130f[_0xcc5d('0x10')](0x1f4,_0x4a7cc3[_0xcc5d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ad692ac..c339e60 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2d60d9,_0x35972d){var _0x1a5acf=function(_0x496ffa){while(--_0x496ffa){_0x2d60d9['push'](_0x2d60d9['shift']());}};_0x1a5acf(++_0x35972d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0x5eb8[_0x4aa662];return _0x336478;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +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(_0x4b7018,_0x3ab02e){var _0x22d01d=function(_0x3c0aff){while(--_0x3c0aff){_0x4b7018['push'](_0x4b7018['shift']());}};_0x22d01d(++_0x3ab02e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'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 a1e1414..f20c381 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 _0x4ee8=['sequelize','exports','STRING','TEXT','out'];(function(_0x11d66e,_0x75c35){var _0x3a71df=function(_0x3c16e3){while(--_0x3c16e3){_0x11d66e['push'](_0x11d66e['shift']());}};_0x3a71df(++_0x75c35);}(_0x4ee8,0x11d));var _0x84ee=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x4ee8[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0x84ee('0x0'));module[_0x84ee('0x1')]={'uniqueid':{'type':Sequelize[_0x84ee('0x2')]},'body':{'type':Sequelize[_0x84ee('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x84ee('0x4')),'defaultValue':_0x84ee('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7d20=['ENUM','out','sequelize','STRING','medium'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x7d20,0x197));var _0x07d2=function(_0x30c5dc,_0x4196f9){_0x30c5dc=_0x30c5dc-0x0;var _0x42f6ff=_0x7d20[_0x30c5dc];return _0x42f6ff;};'use strict';var Sequelize=require(_0x07d2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x07d2('0x1')]},'body':{'type':Sequelize['TEXT'](_0x07d2('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x07d2('0x3')]('in',_0x07d2('0x4')),'defaultValue':_0x07d2('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'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 3b52193..ba2b10f 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 _0x6219=['save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject'];(function(_0xee4573,_0x1c99e0){var _0x1f503b=function(_0xdac224){while(--_0xdac224){_0xee4573['push'](_0xee4573['shift']());}};_0x1f503b(++_0x1c99e0);}(_0x6219,0xc4));var _0x9621=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x6219[_0x3c2166];return _0x30ccc3;};'use strict';var emlformat=require(_0x9621('0x0'));var rimraf=require(_0x9621('0x1'));var zipdir=require(_0x9621('0x2'));var jsonpatch=require(_0x9621('0x3'));var rp=require(_0x9621('0x4'));var moment=require(_0x9621('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9621('0x6'));var util=require(_0x9621('0x7'));var path=require('path');var sox=require(_0x9621('0x8'));var csv=require(_0x9621('0x9'));var ejs=require(_0x9621('0xa'));var fs=require('fs');var fs_extra=require(_0x9621('0xb'));var _=require('lodash');var squel=require(_0x9621('0xc'));var crypto=require(_0x9621('0xd'));var jsforce=require(_0x9621('0xe'));var deskjs=require(_0x9621('0xf'));var toCsv=require(_0x9621('0x9'));var querystring=require(_0x9621('0x10'));var Papa=require('papaparse');var Redis=require(_0x9621('0x11'));var authService=require(_0x9621('0x12'));var qs=require(_0x9621('0x13'));var as=require(_0x9621('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9621('0x15'))('api');var utils=require(_0x9621('0x16'));var config=require(_0x9621('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9621('0x18'))['db'];function respondWithStatusCode(_0x554ea7,_0x4ce0d4){_0x4ce0d4=_0x4ce0d4||0xcc;return function(_0x29ffa1){if(_0x29ffa1){return _0x554ea7[_0x9621('0x19')](_0x4ce0d4);}return _0x554ea7[_0x9621('0x1a')](_0x4ce0d4)[_0x9621('0x1b')]();};}function respondWithResult(_0x5b2d9b,_0x47c607){_0x47c607=_0x47c607||0xc8;return function(_0x54a1a5){if(_0x54a1a5){return _0x5b2d9b['status'](_0x47c607)[_0x9621('0x1c')](_0x54a1a5);}};}function respondWithFilteredResult(_0x4b74f4,_0x283483){return function(_0x28b9bf){if(_0x28b9bf){var _0x26d412=typeof _0x283483[_0x9621('0x1d')]===_0x9621('0x1e')&&typeof _0x283483['limit']===_0x9621('0x1e');var _0x3a91c3=_0x28b9bf[_0x9621('0x1f')];var _0x223095=_0x26d412?0x0:_0x283483[_0x9621('0x1d')];var _0x46cd32=_0x26d412?_0x28b9bf[_0x9621('0x1f')]:_0x283483['offset']+_0x283483['limit'];var _0x288555;if(_0x46cd32>=_0x3a91c3){_0x46cd32=_0x3a91c3;_0x288555=0xc8;}else{_0x288555=0xce;}_0x4b74f4[_0x9621('0x1a')](_0x288555);return _0x4b74f4['set'](_0x9621('0x20'),_0x223095+'-'+_0x46cd32+'/'+_0x3a91c3)[_0x9621('0x1c')](_0x28b9bf);}return null;};}function patchUpdates(_0x505df2){return function(_0x1a5323){try{jsonpatch[_0x9621('0x21')](_0x1a5323,_0x505df2,!![]);}catch(_0x57ea57){return BPromise[_0x9621('0x22')](_0x57ea57);}return _0x1a5323[_0x9621('0x23')]();};}function saveUpdates(_0xdf205f,_0x2a42f2){return function(_0x4d0172){if(_0x4d0172){return _0x4d0172[_0x9621('0x24')](_0xdf205f)[_0x9621('0x25')](function(_0x3ac0ad){return _0x3ac0ad;});}return null;};}function removeEntity(_0x3372c5,_0x3014e4){return function(_0x1ef440){if(_0x1ef440){return _0x1ef440[_0x9621('0x26')]()[_0x9621('0x25')](function(){_0x3372c5[_0x9621('0x1a')](0xcc)[_0x9621('0x1b')]();});}};}function handleEntityNotFound(_0x402fed,_0x42edbc){return function(_0x1eaa0c){if(!_0x1eaa0c){_0x402fed[_0x9621('0x19')](0x194);}return _0x1eaa0c;};}function handleError(_0x2a5ba1,_0x1cd5c5){_0x1cd5c5=_0x1cd5c5||0x1f4;return function(_0xf9f0c5){logger[_0x9621('0x27')](_0xf9f0c5[_0x9621('0x28')]);if(_0xf9f0c5[_0x9621('0x29')]){delete _0xf9f0c5[_0x9621('0x29')];}_0x2a5ba1[_0x9621('0x1a')](_0x1cd5c5)[_0x9621('0x2a')](_0xf9f0c5);};}exports[_0x9621('0x2b')]=function(_0x1fa582,_0x581ddf){var _0x1c4e51={},_0x410be8={},_0x39ae3a={'count':0x0,'rows':[]};var _0x1eac65=_[_0x9621('0x2c')](db[_0x9621('0x2d')][_0x9621('0x2e')],function(_0x192230){return{'name':_0x192230[_0x9621('0x2f')],'type':_0x192230[_0x9621('0x30')][_0x9621('0x31')]};});_0x410be8[_0x9621('0x32')]=_[_0x9621('0x2c')](_0x1eac65,'name');_0x410be8[_0x9621('0x33')]=_[_0x9621('0x34')](_0x1fa582[_0x9621('0x33')]);_0x410be8[_0x9621('0x35')]=_['intersection'](_0x410be8[_0x9621('0x32')],_0x410be8[_0x9621('0x33')]);_0x1c4e51['attributes']=_['intersection'](_0x410be8[_0x9621('0x32')],qs['fields'](_0x1fa582[_0x9621('0x33')][_0x9621('0x36')]));_0x1c4e51[_0x9621('0x37')]=_0x1c4e51[_0x9621('0x37')][_0x9621('0x38')]?_0x1c4e51[_0x9621('0x37')]:_0x410be8[_0x9621('0x32')];if(!_0x1fa582['query'][_0x9621('0x39')]('nolimit')){_0x1c4e51[_0x9621('0x3a')]=qs['limit'](_0x1fa582[_0x9621('0x33')][_0x9621('0x3a')]);_0x1c4e51[_0x9621('0x1d')]=qs[_0x9621('0x1d')](_0x1fa582['query'][_0x9621('0x1d')]);}_0x1c4e51[_0x9621('0x3b')]=qs[_0x9621('0x3c')](_0x1fa582[_0x9621('0x33')][_0x9621('0x3c')]);_0x1c4e51[_0x9621('0x3d')]=qs[_0x9621('0x35')](_[_0x9621('0x3e')](_0x1fa582['query'],_0x410be8[_0x9621('0x35')]),_0x1eac65);if(_0x1fa582['query'][_0x9621('0x3f')]){_0x1c4e51[_0x9621('0x3d')]=_[_0x9621('0x40')](_0x1c4e51[_0x9621('0x3d')],{'$or':_[_0x9621('0x2c')](_0x1eac65,function(_0x45e139){if(_0x45e139[_0x9621('0x30')]!==_0x9621('0x41')){var _0x3ba668={};_0x3ba668[_0x45e139['name']]={'$like':'%'+_0x1fa582[_0x9621('0x33')][_0x9621('0x3f')]+'%'};return _0x3ba668;}})});}_0x1c4e51=_['merge']({},_0x1c4e51,_0x1fa582[_0x9621('0x42')]);var _0x5bae6f={'where':_0x1c4e51[_0x9621('0x3d')]};return db[_0x9621('0x2d')][_0x9621('0x1f')](_0x5bae6f)[_0x9621('0x25')](function(_0x336957){_0x39ae3a[_0x9621('0x1f')]=_0x336957;if(_0x1fa582[_0x9621('0x33')]['includeAll']){_0x1c4e51[_0x9621('0x43')]=[{'all':!![]}];}return db[_0x9621('0x2d')][_0x9621('0x44')](_0x1c4e51);})['then'](function(_0x4b3d37){_0x39ae3a['rows']=_0x4b3d37;return _0x39ae3a;})[_0x9621('0x25')](respondWithFilteredResult(_0x581ddf,_0x1c4e51))[_0x9621('0x45')](handleError(_0x581ddf,null));};exports[_0x9621('0x46')]=function(_0x5a4d00,_0x420f92){var _0x478c2a={'raw':!![],'where':{'id':_0x5a4d00[_0x9621('0x47')]['id']}},_0x2e9cae={};_0x2e9cae[_0x9621('0x32')]=_[_0x9621('0x34')](db['SquareMessage'][_0x9621('0x2e')]);_0x2e9cae[_0x9621('0x33')]=_[_0x9621('0x34')](_0x5a4d00['query']);_0x2e9cae['filters']=_[_0x9621('0x48')](_0x2e9cae[_0x9621('0x32')],_0x2e9cae['query']);_0x478c2a[_0x9621('0x37')]=_[_0x9621('0x48')](_0x2e9cae['model'],qs[_0x9621('0x36')](_0x5a4d00[_0x9621('0x33')][_0x9621('0x36')]));_0x478c2a['attributes']=_0x478c2a[_0x9621('0x37')][_0x9621('0x38')]?_0x478c2a[_0x9621('0x37')]:_0x2e9cae[_0x9621('0x32')];if(_0x5a4d00[_0x9621('0x33')][_0x9621('0x49')]){_0x478c2a[_0x9621('0x43')]=[{'all':!![]}];}_0x478c2a=_[_0x9621('0x40')]({},_0x478c2a,_0x5a4d00[_0x9621('0x42')]);return db['SquareMessage']['find'](_0x478c2a)[_0x9621('0x25')](handleEntityNotFound(_0x420f92,null))[_0x9621('0x25')](respondWithResult(_0x420f92,null))[_0x9621('0x45')](handleError(_0x420f92,null));};exports[_0x9621('0x4a')]=function(_0x448f74,_0x753067){return db[_0x9621('0x2d')][_0x9621('0x4a')](_0x448f74[_0x9621('0x4b')],{})[_0x9621('0x25')](respondWithResult(_0x753067,0xc9))[_0x9621('0x45')](handleError(_0x753067,null));};exports[_0x9621('0x24')]=function(_0x1ad0a9,_0x5ab65e){if(_0x1ad0a9[_0x9621('0x4b')]['id']){delete _0x1ad0a9[_0x9621('0x4b')]['id'];}return db[_0x9621('0x2d')][_0x9621('0x4c')]({'where':{'id':_0x1ad0a9[_0x9621('0x47')]['id']}})[_0x9621('0x25')](handleEntityNotFound(_0x5ab65e,null))[_0x9621('0x25')](saveUpdates(_0x1ad0a9[_0x9621('0x4b')],null))[_0x9621('0x25')](respondWithResult(_0x5ab65e,null))[_0x9621('0x45')](handleError(_0x5ab65e,null));};exports[_0x9621('0x26')]=function(_0x598fe5,_0x52ed5b){return db[_0x9621('0x2d')][_0x9621('0x4c')]({'where':{'id':_0x598fe5['params']['id']}})[_0x9621('0x25')](handleEntityNotFound(_0x52ed5b,null))['then'](removeEntity(_0x52ed5b,null))[_0x9621('0x45')](handleError(_0x52ed5b,null));}; \ No newline at end of file +var _0xa282=['catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xa282,0x189));var _0x2a28=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xa282[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x2a28('0x0'));var rimraf=require(_0x2a28('0x1'));var zipdir=require(_0x2a28('0x2'));var jsonpatch=require(_0x2a28('0x3'));var rp=require(_0x2a28('0x4'));var moment=require(_0x2a28('0x5'));var BPromise=require(_0x2a28('0x6'));var Mustache=require(_0x2a28('0x7'));var util=require(_0x2a28('0x8'));var path=require(_0x2a28('0x9'));var sox=require(_0x2a28('0xa'));var csv=require(_0x2a28('0xb'));var ejs=require(_0x2a28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a28('0xd'));var crypto=require(_0x2a28('0xe'));var jsforce=require(_0x2a28('0xf'));var deskjs=require(_0x2a28('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2a28('0x11'));var Papa=require(_0x2a28('0x12'));var Redis=require(_0x2a28('0x13'));var authService=require(_0x2a28('0x14'));var qs=require(_0x2a28('0x15'));var as=require(_0x2a28('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a28('0x17'))('api');var utils=require(_0x2a28('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2a28('0x19'));var db=require(_0x2a28('0x1a'))['db'];function respondWithStatusCode(_0x1e7640,_0x15d6a2){_0x15d6a2=_0x15d6a2||0xcc;return function(_0x7b5ca){if(_0x7b5ca){return _0x1e7640[_0x2a28('0x1b')](_0x15d6a2);}return _0x1e7640[_0x2a28('0x1c')](_0x15d6a2)['end']();};}function respondWithResult(_0x387ddc,_0x7ffb41){_0x7ffb41=_0x7ffb41||0xc8;return function(_0x328e83){if(_0x328e83){return _0x387ddc[_0x2a28('0x1c')](_0x7ffb41)[_0x2a28('0x1d')](_0x328e83);}};}function respondWithFilteredResult(_0x48ed07,_0x388753){return function(_0x18cb8e){if(_0x18cb8e){var _0x5e6294=typeof _0x388753[_0x2a28('0x1e')]===_0x2a28('0x1f')&&typeof _0x388753[_0x2a28('0x20')]==='undefined';var _0x23eed5=_0x18cb8e[_0x2a28('0x21')];var _0x2c27f9=_0x5e6294?0x0:_0x388753[_0x2a28('0x1e')];var _0x1ee433=_0x5e6294?_0x18cb8e[_0x2a28('0x21')]:_0x388753[_0x2a28('0x1e')]+_0x388753[_0x2a28('0x20')];var _0x1d1559;if(_0x1ee433>=_0x23eed5){_0x1ee433=_0x23eed5;_0x1d1559=0xc8;}else{_0x1d1559=0xce;}_0x48ed07[_0x2a28('0x1c')](_0x1d1559);return _0x48ed07[_0x2a28('0x22')](_0x2a28('0x23'),_0x2c27f9+'-'+_0x1ee433+'/'+_0x23eed5)[_0x2a28('0x1d')](_0x18cb8e);}return null;};}function patchUpdates(_0x38f256){return function(_0x5916a1){try{jsonpatch[_0x2a28('0x24')](_0x5916a1,_0x38f256,!![]);}catch(_0x2f1344){return BPromise[_0x2a28('0x25')](_0x2f1344);}return _0x5916a1[_0x2a28('0x26')]();};}function saveUpdates(_0x598c44,_0x2055f6){return function(_0xa9610e){if(_0xa9610e){return _0xa9610e[_0x2a28('0x27')](_0x598c44)[_0x2a28('0x28')](function(_0xae2ae1){return _0xae2ae1;});}return null;};}function removeEntity(_0x3c8eba,_0x20ca1c){return function(_0x251f8d){if(_0x251f8d){return _0x251f8d[_0x2a28('0x29')]()[_0x2a28('0x28')](function(){_0x3c8eba[_0x2a28('0x1c')](0xcc)[_0x2a28('0x2a')]();});}};}function handleEntityNotFound(_0x7e7d99,_0x2a51d5){return function(_0xb7db8e){if(!_0xb7db8e){_0x7e7d99[_0x2a28('0x1b')](0x194);}return _0xb7db8e;};}function handleError(_0x52e8ee,_0x37305d){_0x37305d=_0x37305d||0x1f4;return function(_0x5a30c6){logger[_0x2a28('0x2b')](_0x5a30c6['stack']);if(_0x5a30c6['name']){delete _0x5a30c6[_0x2a28('0x2c')];}_0x52e8ee[_0x2a28('0x1c')](_0x37305d)[_0x2a28('0x2d')](_0x5a30c6);};}exports[_0x2a28('0x2e')]=function(_0x406d3e,_0x5537fb){var _0x11901c={},_0x4158d5={},_0x1ba395={'count':0x0,'rows':[]};var _0x26beda=_[_0x2a28('0x2f')](db[_0x2a28('0x30')][_0x2a28('0x31')],function(_0x5124a8){return{'name':_0x5124a8[_0x2a28('0x32')],'type':_0x5124a8[_0x2a28('0x33')][_0x2a28('0x34')]};});_0x4158d5['model']=_[_0x2a28('0x2f')](_0x26beda,'name');_0x4158d5[_0x2a28('0x35')]=_[_0x2a28('0x36')](_0x406d3e[_0x2a28('0x35')]);_0x4158d5[_0x2a28('0x37')]=_[_0x2a28('0x38')](_0x4158d5[_0x2a28('0x39')],_0x4158d5[_0x2a28('0x35')]);_0x11901c[_0x2a28('0x3a')]=_['intersection'](_0x4158d5['model'],qs[_0x2a28('0x3b')](_0x406d3e['query'][_0x2a28('0x3b')]));_0x11901c['attributes']=_0x11901c[_0x2a28('0x3a')][_0x2a28('0x3c')]?_0x11901c[_0x2a28('0x3a')]:_0x4158d5[_0x2a28('0x39')];if(!_0x406d3e['query'][_0x2a28('0x3d')]('nolimit')){_0x11901c[_0x2a28('0x20')]=qs[_0x2a28('0x20')](_0x406d3e[_0x2a28('0x35')]['limit']);_0x11901c[_0x2a28('0x1e')]=qs[_0x2a28('0x1e')](_0x406d3e[_0x2a28('0x35')][_0x2a28('0x1e')]);}_0x11901c[_0x2a28('0x3e')]=qs[_0x2a28('0x3f')](_0x406d3e[_0x2a28('0x35')][_0x2a28('0x3f')]);_0x11901c[_0x2a28('0x40')]=qs[_0x2a28('0x37')](_['pick'](_0x406d3e[_0x2a28('0x35')],_0x4158d5[_0x2a28('0x37')]),_0x26beda);if(_0x406d3e[_0x2a28('0x35')][_0x2a28('0x41')]){_0x11901c[_0x2a28('0x40')]=_[_0x2a28('0x42')](_0x11901c[_0x2a28('0x40')],{'$or':_[_0x2a28('0x2f')](_0x26beda,function(_0x57ae4f){if(_0x57ae4f[_0x2a28('0x33')]!==_0x2a28('0x43')){var _0x28baf1={};_0x28baf1[_0x57ae4f['name']]={'$like':'%'+_0x406d3e[_0x2a28('0x35')][_0x2a28('0x41')]+'%'};return _0x28baf1;}})});}_0x11901c=_['merge']({},_0x11901c,_0x406d3e['options']);var _0x515262={'where':_0x11901c['where']};return db[_0x2a28('0x30')][_0x2a28('0x21')](_0x515262)[_0x2a28('0x28')](function(_0x466f48){_0x1ba395[_0x2a28('0x21')]=_0x466f48;if(_0x406d3e[_0x2a28('0x35')][_0x2a28('0x44')]){_0x11901c[_0x2a28('0x45')]=[{'all':!![]}];}return db[_0x2a28('0x30')][_0x2a28('0x46')](_0x11901c);})[_0x2a28('0x28')](function(_0x4f7dc6){_0x1ba395[_0x2a28('0x47')]=_0x4f7dc6;return _0x1ba395;})[_0x2a28('0x28')](respondWithFilteredResult(_0x5537fb,_0x11901c))['catch'](handleError(_0x5537fb,null));};exports[_0x2a28('0x48')]=function(_0x53eb7c,_0x37417b){var _0x286650={'raw':!![],'where':{'id':_0x53eb7c[_0x2a28('0x49')]['id']}},_0x26f594={};_0x26f594[_0x2a28('0x39')]=_[_0x2a28('0x36')](db['SquareMessage'][_0x2a28('0x31')]);_0x26f594[_0x2a28('0x35')]=_[_0x2a28('0x36')](_0x53eb7c['query']);_0x26f594[_0x2a28('0x37')]=_[_0x2a28('0x38')](_0x26f594[_0x2a28('0x39')],_0x26f594['query']);_0x286650[_0x2a28('0x3a')]=_[_0x2a28('0x38')](_0x26f594[_0x2a28('0x39')],qs['fields'](_0x53eb7c[_0x2a28('0x35')][_0x2a28('0x3b')]));_0x286650[_0x2a28('0x3a')]=_0x286650[_0x2a28('0x3a')][_0x2a28('0x3c')]?_0x286650[_0x2a28('0x3a')]:_0x26f594[_0x2a28('0x39')];if(_0x53eb7c[_0x2a28('0x35')][_0x2a28('0x44')]){_0x286650[_0x2a28('0x45')]=[{'all':!![]}];}_0x286650=_[_0x2a28('0x42')]({},_0x286650,_0x53eb7c['options']);return db[_0x2a28('0x30')][_0x2a28('0x4a')](_0x286650)[_0x2a28('0x28')](handleEntityNotFound(_0x37417b,null))[_0x2a28('0x28')](respondWithResult(_0x37417b,null))[_0x2a28('0x4b')](handleError(_0x37417b,null));};exports['create']=function(_0x3b4dd4,_0x25342b){return db[_0x2a28('0x30')][_0x2a28('0x4c')](_0x3b4dd4[_0x2a28('0x4d')],{})['then'](respondWithResult(_0x25342b,0xc9))[_0x2a28('0x4b')](handleError(_0x25342b,null));};exports['update']=function(_0x5e9588,_0x5e4f97){if(_0x5e9588[_0x2a28('0x4d')]['id']){delete _0x5e9588[_0x2a28('0x4d')]['id'];}return db[_0x2a28('0x30')][_0x2a28('0x4a')]({'where':{'id':_0x5e9588[_0x2a28('0x49')]['id']}})[_0x2a28('0x28')](handleEntityNotFound(_0x5e4f97,null))[_0x2a28('0x28')](saveUpdates(_0x5e9588[_0x2a28('0x4d')],null))['then'](respondWithResult(_0x5e4f97,null))[_0x2a28('0x4b')](handleError(_0x5e4f97,null));};exports[_0x2a28('0x29')]=function(_0x2b15e7,_0x409b8c){return db['SquareMessage']['find']({'where':{'id':_0x2b15e7[_0x2a28('0x49')]['id']}})['then'](handleEntityNotFound(_0x409b8c,null))['then'](removeEntity(_0x409b8c,null))[_0x2a28('0x4b')](handleError(_0x409b8c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 484296d..9d87f4c 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 _0x8f1d=['moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api'];(function(_0x314ee2,_0x407566){var _0x51809c=function(_0x5f08ed){while(--_0x5f08ed){_0x314ee2['push'](_0x314ee2['shift']());}};_0x51809c(++_0x407566);}(_0x8f1d,0x72));var _0xd8f1=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x8f1d[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xd8f1('0x0'));var util=require(_0xd8f1('0x1'));var logger=require('../../config/logger')(_0xd8f1('0x2'));var moment=require(_0xd8f1('0x3'));var BPromise=require(_0xd8f1('0x4'));var rp=require(_0xd8f1('0x5'));var fs=require('fs');var path=require(_0xd8f1('0x6'));var rimraf=require('rimraf');var config=require(_0xd8f1('0x7'));var attributes=require(_0xd8f1('0x8'));module[_0xd8f1('0x9')]=function(_0x103610,_0x5ef96f){return _0x103610[_0xd8f1('0xa')](_0xd8f1('0xb'),attributes,{'tableName':_0xd8f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x508b=['./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a8ae7,_0x282d8f){var _0x5a4685=function(_0x52b983){while(--_0x52b983){_0x3a8ae7['push'](_0x3a8ae7['shift']());}};_0x5a4685(++_0x282d8f);}(_0x508b,0x170));var _0xb508=function(_0x195f71,_0x40c2bd){_0x195f71=_0x195f71-0x0;var _0x3bb3bc=_0x508b[_0x195f71];return _0x3bb3bc;};'use strict';var _=require('lodash');var util=require(_0xb508('0x0'));var logger=require(_0xb508('0x1'))(_0xb508('0x2'));var moment=require(_0xb508('0x3'));var BPromise=require(_0xb508('0x4'));var rp=require(_0xb508('0x5'));var fs=require('fs');var path=require(_0xb508('0x6'));var rimraf=require(_0xb508('0x7'));var config=require(_0xb508('0x8'));var attributes=require(_0xb508('0x9'));module[_0xb508('0xa')]=function(_0x12ffb6,_0x52d7be){return _0x12ffb6[_0xb508('0xb')]('SquareMessage',attributes,{'tableName':_0xb508('0xc'),'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 8b5b7a2..92a22cc 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 _0x755b=['debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareMessage','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x560659,_0x49bddb){var _0x9d1012=function(_0x159807){while(--_0x159807){_0x560659['push'](_0x560659['shift']());}};_0x9d1012(++_0x49bddb);}(_0x755b,0x178));var _0xb755=function(_0x5a053d,_0x330f07){_0x5a053d=_0x5a053d-0x0;var _0x2f4c42=_0x755b[_0x5a053d];return _0x2f4c42;};'use strict';var _=require(_0xb755('0x0'));var util=require('util');var moment=require(_0xb755('0x1'));var BPromise=require(_0xb755('0x2'));var rs=require(_0xb755('0x3'));var fs=require('fs');var Redis=require(_0xb755('0x4'));var db=require(_0xb755('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb755('0x6'))(_0xb755('0x7'));var config=require(_0xb755('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb755('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce5c0,_0x347231,_0x45d5db){return new BPromise(function(_0x58a6e1,_0x17fdea){return client[_0xb755('0xa')](_0x2ce5c0,_0x45d5db)[_0xb755('0xb')](function(_0xbb1f33){logger['info'](_0xb755('0xc'),_0x347231,_0xb755('0xd'));logger[_0xb755('0xe')](_0xb755('0xf'),_0x347231,_0xb755('0xd'),JSON[_0xb755('0x10')](_0xbb1f33));if(_0xbb1f33['error']){if(_0xbb1f33[_0xb755('0x11')][_0xb755('0x12')]===0x1f4){logger[_0xb755('0x11')](_0xb755('0xc'),_0x347231,_0xbb1f33[_0xb755('0x11')][_0xb755('0x13')]);return _0x17fdea(_0xbb1f33['error'][_0xb755('0x13')]);}logger[_0xb755('0x11')](_0xb755('0xc'),_0x347231,_0xbb1f33[_0xb755('0x11')]['message']);return _0x58a6e1(_0xbb1f33[_0xb755('0x11')][_0xb755('0x13')]);}else{logger[_0xb755('0x14')]('SquareMessage,\x20%s,\x20%s',_0x347231,'request\x20sent');_0x58a6e1(_0xbb1f33['result'][_0xb755('0x13')]);}})[_0xb755('0x15')](function(_0x48328d){logger[_0xb755('0x11')](_0xb755('0xc'),_0x347231,_0x48328d);_0x17fdea(_0x48328d);});});}exports[_0xb755('0x16')]=function(_0x223b06){var _0x215a1f=this;return new Promise(function(_0x29436c,_0x12df9b){return db['SquareMessage']['create'](_0x223b06[_0xb755('0x17')],{'raw':_0x223b06[_0xb755('0x18')]?_0x223b06['options'][_0xb755('0x19')]===undefined?!![]:![]:!![]})[_0xb755('0xb')](function(_0x1a076a){logger['info'](_0xb755('0x16'),_0x223b06);logger[_0xb755('0xe')](_0xb755('0x16'),_0x223b06,JSON[_0xb755('0x10')](_0x1a076a));_0x29436c(_0x1a076a);})[_0xb755('0x15')](function(_0x56013e){logger[_0xb755('0x11')](_0xb755('0x16'),_0x56013e[_0xb755('0x13')],_0x223b06);_0x12df9b(_0x215a1f[_0xb755('0x11')](0x1f4,_0x56013e['message']));});});}; \ No newline at end of file +var _0x09d6=['result','catch','CreateSquareMessage','SquareMessage','options','raw','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x09d6,0x94));var _0x609d=function(_0x2159ac,_0x4d2ec5){_0x2159ac=_0x2159ac-0x0;var _0x4457f1=_0x09d6[_0x2159ac];return _0x4457f1;};'use strict';var _=require('lodash');var util=require(_0x609d('0x0'));var moment=require(_0x609d('0x1'));var BPromise=require('bluebird');var rs=require(_0x609d('0x2'));var fs=require('fs');var Redis=require(_0x609d('0x3'));var db=require(_0x609d('0x4'))['db'];var utils=require(_0x609d('0x5'));var logger=require(_0x609d('0x6'))(_0x609d('0x7'));var config=require(_0x609d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x609d('0x9')][_0x609d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbeb8c,_0x2b81fe,_0x4af40e){return new BPromise(function(_0x5a48e7,_0x435d95){return client[_0x609d('0xb')](_0xbeb8c,_0x4af40e)[_0x609d('0xc')](function(_0x339441){logger[_0x609d('0xd')](_0x609d('0xe'),_0x2b81fe,_0x609d('0xf'));logger['debug'](_0x609d('0x10'),_0x2b81fe,_0x609d('0xf'),JSON['stringify'](_0x339441));if(_0x339441[_0x609d('0x11')]){if(_0x339441[_0x609d('0x11')][_0x609d('0x12')]===0x1f4){logger[_0x609d('0x11')](_0x609d('0xe'),_0x2b81fe,_0x339441[_0x609d('0x11')][_0x609d('0x13')]);return _0x435d95(_0x339441['error']['message']);}logger[_0x609d('0x11')]('SquareMessage,\x20%s,\x20%s',_0x2b81fe,_0x339441[_0x609d('0x11')]['message']);return _0x5a48e7(_0x339441[_0x609d('0x11')][_0x609d('0x13')]);}else{logger[_0x609d('0xd')](_0x609d('0xe'),_0x2b81fe,_0x609d('0xf'));_0x5a48e7(_0x339441[_0x609d('0x14')][_0x609d('0x13')]);}})[_0x609d('0x15')](function(_0x381f13){logger[_0x609d('0x11')](_0x609d('0xe'),_0x2b81fe,_0x381f13);_0x435d95(_0x381f13);});});}exports[_0x609d('0x16')]=function(_0x4eae21){var _0x5036f7=this;return new Promise(function(_0x17ff38,_0x5457db){return db[_0x609d('0x17')]['create'](_0x4eae21['body'],{'raw':_0x4eae21[_0x609d('0x18')]?_0x4eae21[_0x609d('0x18')][_0x609d('0x19')]===undefined?!![]:![]:!![]})[_0x609d('0xc')](function(_0x8255e9){logger['info'](_0x609d('0x16'),_0x4eae21);logger[_0x609d('0x1a')](_0x609d('0x16'),_0x4eae21,JSON[_0x609d('0x1b')](_0x8255e9));_0x17ff38(_0x8255e9);})[_0x609d('0x15')](function(_0x3674bc){logger[_0x609d('0x11')](_0x609d('0x16'),_0x3674bc[_0x609d('0x13')],_0x4eae21);_0x5457db(_0x5036f7[_0x609d('0x11')](0x1f4,_0x3674bc[_0x609d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 056b241..72dd83b 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 _0x1249=['../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','15s','test','create','delete','destroy','exports','path','express','Router'];(function(_0x10ff29,_0x1d5e8e){var _0x57f20e=function(_0x80eeee){while(--_0x80eeee){_0x10ff29['push'](_0x10ff29['shift']());}};_0x57f20e(++_0x1d5e8e);}(_0x1249,0x96));var _0x9124=function(_0x1cf04e,_0x7add5b){_0x1cf04e=_0x1cf04e-0x0;var _0x18941e=_0x1249[_0x1cf04e];return _0x18941e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9124('0x0'));var timeout=require('connect-timeout');var express=require(_0x9124('0x1'));var router=express[_0x9124('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9124('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9124('0x4'));var controller=require(_0x9124('0x5'));router['get']('/',auth[_0x9124('0x6')](),controller[_0x9124('0x7')]);router[_0x9124('0x8')](_0x9124('0x9'),auth[_0x9124('0x6')](),controller[_0x9124('0xa')]);router[_0x9124('0x8')]('/:id/test',auth['isAuthenticated'](),timeout(_0x9124('0xb')),controller[_0x9124('0xc')]);router['post']('/',auth[_0x9124('0x6')](),controller[_0x9124('0xd')]);router['put'](_0x9124('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9124('0xe')]('/:id',auth[_0x9124('0x6')](),controller[_0x9124('0xf')]);module[_0x9124('0x10')]=router; \ No newline at end of file +var _0xd630=['show','/:id/test','15s','test','post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0x4a6ae5,_0x9f6541){var _0x402486=function(_0xa1043c){while(--_0xa1043c){_0x4a6ae5['push'](_0x4a6ae5['shift']());}};_0x402486(++_0x9f6541);}(_0xd630,0x162));var _0x0d63=function(_0x3d9015,_0x4a8d4d){_0x3d9015=_0x3d9015-0x0;var _0x26a1d1=_0xd630[_0x3d9015];return _0x26a1d1;};'use strict';var multer=require(_0x0d63('0x0'));var util=require(_0x0d63('0x1'));var path=require('path');var timeout=require(_0x0d63('0x2'));var express=require(_0x0d63('0x3'));var router=express[_0x0d63('0x4')]();var fs_extra=require(_0x0d63('0x5'));var auth=require(_0x0d63('0x6'));var interaction=require(_0x0d63('0x7'));var config=require(_0x0d63('0x8'));var controller=require(_0x0d63('0x9'));router[_0x0d63('0xa')]('/',auth[_0x0d63('0xb')](),controller[_0x0d63('0xc')]);router[_0x0d63('0xa')](_0x0d63('0xd'),auth[_0x0d63('0xb')](),controller[_0x0d63('0xe')]);router[_0x0d63('0xa')](_0x0d63('0xf'),auth[_0x0d63('0xb')](),timeout(_0x0d63('0x10')),controller[_0x0d63('0x11')]);router[_0x0d63('0x12')]('/',auth[_0x0d63('0xb')](),controller[_0x0d63('0x13')]);router[_0x0d63('0x14')](_0x0d63('0xd'),auth['isAuthenticated'](),controller[_0x0d63('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0d63('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a8cc317..4c58c9f 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 _0x6adf=['exports','STRING','name','sequelize'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6adf,0x167));var _0xf6ad=function(_0x210305,_0x59f232){_0x210305=_0x210305-0x0;var _0xb3c7c5=_0x6adf[_0x210305];return _0xb3c7c5;};'use strict';var Sequelize=require(_0xf6ad('0x0'));module[_0xf6ad('0x1')]={'name':{'type':Sequelize[_0xf6ad('0x2')],'unique':_0xf6ad('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf6ad('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa567=['name','STRING'];(function(_0x1970c1,_0x16523b){var _0x1bcd2f=function(_0x2ef7fa){while(--_0x2ef7fa){_0x1970c1['push'](_0x1970c1['shift']());}};_0x1bcd2f(++_0x16523b);}(_0xa567,0xbd));var _0x7a56=function(_0x219d64,_0x48c3c7){_0x219d64=_0x219d64-0x0;var _0x2a8720=_0xa567[_0x219d64];return _0x2a8720;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7a56('0x0')],'unique':_0x7a56('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7a56('0x0')]},'description':{'type':Sequelize[_0x7a56('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index d722f4a..f5f0892 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 _0x269a=['filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick'];(function(_0x3b0e30,_0x462767){var _0x50caad=function(_0x1710b4){while(--_0x1710b4){_0x3b0e30['push'](_0x3b0e30['shift']());}};_0x50caad(++_0x462767);}(_0x269a,0x181));var _0xa269=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x269a[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require(_0xa269('0x0'));var rimraf=require(_0xa269('0x1'));var zipdir=require(_0xa269('0x2'));var jsonpatch=require(_0xa269('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa269('0x4'));var Mustache=require(_0xa269('0x5'));var util=require(_0xa269('0x6'));var path=require('path');var sox=require(_0xa269('0x7'));var csv=require(_0xa269('0x8'));var ejs=require(_0xa269('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa269('0xa'));var crypto=require('crypto');var jsforce=require(_0xa269('0xb'));var deskjs=require(_0xa269('0xc'));var toCsv=require(_0xa269('0x8'));var querystring=require(_0xa269('0xd'));var Papa=require(_0xa269('0xe'));var Redis=require(_0xa269('0xf'));var authService=require(_0xa269('0x10'));var qs=require(_0xa269('0x11'));var as=require(_0xa269('0x12'));var hardwareService=require(_0xa269('0x13'));var logger=require(_0xa269('0x14'))(_0xa269('0x15'));var utils=require(_0xa269('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa269('0x17'));var db=require(_0xa269('0x18'))['db'];function respondWithStatusCode(_0x5ae2ad,_0x1c42c0){_0x1c42c0=_0x1c42c0||0xcc;return function(_0x17578a){if(_0x17578a){return _0x5ae2ad[_0xa269('0x19')](_0x1c42c0);}return _0x5ae2ad[_0xa269('0x1a')](_0x1c42c0)[_0xa269('0x1b')]();};}function respondWithResult(_0x1fdb64,_0x4caeb1){_0x4caeb1=_0x4caeb1||0xc8;return function(_0x1244a2){if(_0x1244a2){return _0x1fdb64['status'](_0x4caeb1)[_0xa269('0x1c')](_0x1244a2);}};}function respondWithFilteredResult(_0x163f1a,_0x2907fd){return function(_0x1951ce){if(_0x1951ce){var _0x197dc0=typeof _0x2907fd[_0xa269('0x1d')]==='undefined'&&typeof _0x2907fd['limit']===_0xa269('0x1e');var _0x497abb=_0x1951ce['count'];var _0x5e5edc=_0x197dc0?0x0:_0x2907fd['offset'];var _0x59a93a=_0x197dc0?_0x1951ce[_0xa269('0x1f')]:_0x2907fd[_0xa269('0x1d')]+_0x2907fd['limit'];var _0x807050;if(_0x59a93a>=_0x497abb){_0x59a93a=_0x497abb;_0x807050=0xc8;}else{_0x807050=0xce;}_0x163f1a[_0xa269('0x1a')](_0x807050);return _0x163f1a['set'](_0xa269('0x20'),_0x5e5edc+'-'+_0x59a93a+'/'+_0x497abb)[_0xa269('0x1c')](_0x1951ce);}return null;};}function patchUpdates(_0x4d9cf0){return function(_0x549760){try{jsonpatch[_0xa269('0x21')](_0x549760,_0x4d9cf0,!![]);}catch(_0x15b69a){return BPromise[_0xa269('0x22')](_0x15b69a);}return _0x549760[_0xa269('0x23')]();};}function saveUpdates(_0x1ab765,_0x574f63){return function(_0x2b92ad){if(_0x2b92ad){return _0x2b92ad[_0xa269('0x24')](_0x1ab765)['then'](function(_0x4e1f5d){return _0x4e1f5d;});}return null;};}function removeEntity(_0x130cd7,_0x3c1249){return function(_0x2b5e71){if(_0x2b5e71){return _0x2b5e71[_0xa269('0x25')]()[_0xa269('0x26')](function(){var _0x1cfdcd=_0x2b5e71[_0xa269('0x27')]({'plain':!![]});var _0x47095a='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x47095a,'resourceId':_0x1cfdcd['id']}})[_0xa269('0x26')](function(){return _0x2b5e71;});})[_0xa269('0x26')](function(){_0x130cd7[_0xa269('0x1a')](0xcc)[_0xa269('0x1b')]();});}};}function handleEntityNotFound(_0x40d14e,_0x3e4227){return function(_0x11d6ff){if(!_0x11d6ff){_0x40d14e[_0xa269('0x19')](0x194);}return _0x11d6ff;};}function handleError(_0x701664,_0x5d8bd7){_0x5d8bd7=_0x5d8bd7||0x1f4;return function(_0xa76ea9){logger[_0xa269('0x28')](_0xa76ea9[_0xa269('0x29')]);if(_0xa76ea9[_0xa269('0x2a')]){delete _0xa76ea9[_0xa269('0x2a')];}_0x701664[_0xa269('0x1a')](_0x5d8bd7)[_0xa269('0x2b')](_0xa76ea9);};}exports[_0xa269('0x2c')]=function(_0x1b461f,_0x156c56){var _0x2f324b={},_0x46ca9f={},_0x5c2fba={'count':0x0,'rows':[]};var _0x5c44ce=_[_0xa269('0x2d')](db[_0xa269('0x2e')][_0xa269('0x2f')],function(_0x5f4749){return{'name':_0x5f4749['fieldName'],'type':_0x5f4749[_0xa269('0x30')][_0xa269('0x31')]};});_0x46ca9f[_0xa269('0x32')]=_[_0xa269('0x2d')](_0x5c44ce,_0xa269('0x2a'));_0x46ca9f[_0xa269('0x33')]=_[_0xa269('0x34')](_0x1b461f['query']);_0x46ca9f['filters']=_[_0xa269('0x35')](_0x46ca9f['model'],_0x46ca9f[_0xa269('0x33')]);_0x2f324b['attributes']=_[_0xa269('0x35')](_0x46ca9f[_0xa269('0x32')],qs[_0xa269('0x36')](_0x1b461f[_0xa269('0x33')][_0xa269('0x36')]));_0x2f324b[_0xa269('0x37')]=_0x2f324b['attributes'][_0xa269('0x38')]?_0x2f324b[_0xa269('0x37')]:_0x46ca9f[_0xa269('0x32')];if(!_0x1b461f[_0xa269('0x33')][_0xa269('0x39')](_0xa269('0x3a'))){_0x2f324b[_0xa269('0x3b')]=qs[_0xa269('0x3b')](_0x1b461f[_0xa269('0x33')][_0xa269('0x3b')]);_0x2f324b[_0xa269('0x1d')]=qs[_0xa269('0x1d')](_0x1b461f[_0xa269('0x33')][_0xa269('0x1d')]);}_0x2f324b[_0xa269('0x3c')]=qs[_0xa269('0x3d')](_0x1b461f[_0xa269('0x33')][_0xa269('0x3d')]);_0x2f324b[_0xa269('0x3e')]=qs[_0xa269('0x3f')](_[_0xa269('0x40')](_0x1b461f[_0xa269('0x33')],_0x46ca9f[_0xa269('0x3f')]),_0x5c44ce);if(_0x1b461f[_0xa269('0x33')][_0xa269('0x41')]){_0x2f324b[_0xa269('0x3e')]=_[_0xa269('0x42')](_0x2f324b[_0xa269('0x3e')],{'$or':_['map'](_0x5c44ce,function(_0x4dd039){if(_0x4dd039[_0xa269('0x30')]!=='VIRTUAL'){var _0x3c7e30={};_0x3c7e30[_0x4dd039[_0xa269('0x2a')]]={'$like':'%'+_0x1b461f[_0xa269('0x33')][_0xa269('0x41')]+'%'};return _0x3c7e30;}})});}_0x2f324b=_[_0xa269('0x42')]({},_0x2f324b,_0x1b461f[_0xa269('0x43')]);var _0x49bbe4={'where':_0x2f324b['where']};return db[_0xa269('0x2e')]['count'](_0x49bbe4)[_0xa269('0x26')](function(_0x52f14c){_0x5c2fba[_0xa269('0x1f')]=_0x52f14c;if(_0x1b461f[_0xa269('0x33')][_0xa269('0x44')]){_0x2f324b['include']=[{'all':!![]}];}return db[_0xa269('0x2e')][_0xa269('0x45')](_0x2f324b);})['then'](function(_0x219fad){_0x5c2fba[_0xa269('0x46')]=_0x219fad;return _0x5c2fba;})[_0xa269('0x26')](respondWithFilteredResult(_0x156c56,_0x2f324b))[_0xa269('0x47')](handleError(_0x156c56,null));};exports[_0xa269('0x48')]=function(_0x7e4c9c,_0x4b081f){var _0x1dac9a={'raw':!![],'where':{'id':_0x7e4c9c[_0xa269('0x49')]['id']}},_0x36b363={};_0x36b363['model']=_['keys'](db[_0xa269('0x2e')]['rawAttributes']);_0x36b363[_0xa269('0x33')]=_[_0xa269('0x34')](_0x7e4c9c[_0xa269('0x33')]);_0x36b363[_0xa269('0x3f')]=_[_0xa269('0x35')](_0x36b363[_0xa269('0x32')],_0x36b363[_0xa269('0x33')]);_0x1dac9a[_0xa269('0x37')]=_['intersection'](_0x36b363[_0xa269('0x32')],qs['fields'](_0x7e4c9c[_0xa269('0x33')][_0xa269('0x36')]));_0x1dac9a[_0xa269('0x37')]=_0x1dac9a['attributes']['length']?_0x1dac9a[_0xa269('0x37')]:_0x36b363[_0xa269('0x32')];if(_0x7e4c9c[_0xa269('0x33')][_0xa269('0x44')]){_0x1dac9a[_0xa269('0x4a')]=[{'all':!![]}];}_0x1dac9a=_[_0xa269('0x42')]({},_0x1dac9a,_0x7e4c9c[_0xa269('0x43')]);return db['SquareOdbc'][_0xa269('0x4b')](_0x1dac9a)[_0xa269('0x26')](handleEntityNotFound(_0x4b081f,null))[_0xa269('0x26')](respondWithResult(_0x4b081f,null))[_0xa269('0x47')](handleError(_0x4b081f,null));};exports['create']=function(_0x50d58a,_0x536b48){return db['SquareOdbc'][_0xa269('0x4c')](_0x50d58a[_0xa269('0x4d')],{})[_0xa269('0x26')](function(_0x3ae8f7){var _0x3fca13=_0x50d58a['user'][_0xa269('0x27')]({'plain':!![]});if(!_0x3fca13)throw new Error(_0xa269('0x4e'));if(_0x3fca13[_0xa269('0x4f')]===_0xa269('0x50')){var _0x352c0a=_0x3ae8f7[_0xa269('0x27')]({'plain':!![]});var _0x4f06c5=_0xa269('0x51');return db[_0xa269('0x52')][_0xa269('0x4b')]({'where':{'name':_0x4f06c5,'userProfileId':_0x3fca13[_0xa269('0x53')]},'raw':!![]})[_0xa269('0x26')](function(_0x281828){if(_0x281828&&_0x281828[_0xa269('0x54')]===0x0){return db[_0xa269('0x55')][_0xa269('0x4c')]({'name':_0x352c0a['name'],'resourceId':_0x352c0a['id'],'type':_0x281828['name'],'sectionId':_0x281828['id']},{})[_0xa269('0x26')](function(){return _0x3ae8f7;});}else{return _0x3ae8f7;}})[_0xa269('0x47')](function(_0x2649b0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2649b0);throw _0x2649b0;});}return _0x3ae8f7;})[_0xa269('0x26')](respondWithResult(_0x536b48,0xc9))[_0xa269('0x47')](handleError(_0x536b48,null));};exports[_0xa269('0x24')]=function(_0x27ac7c,_0xaacdea){if(_0x27ac7c[_0xa269('0x4d')]['id']){delete _0x27ac7c[_0xa269('0x4d')]['id'];}return db[_0xa269('0x2e')][_0xa269('0x4b')]({'where':{'id':_0x27ac7c[_0xa269('0x49')]['id']}})[_0xa269('0x26')](handleEntityNotFound(_0xaacdea,null))[_0xa269('0x26')](saveUpdates(_0x27ac7c[_0xa269('0x4d')],null))[_0xa269('0x26')](respondWithResult(_0xaacdea,null))['catch'](handleError(_0xaacdea,null));};exports[_0xa269('0x25')]=function(_0x7ea725,_0x3a81f3){return db[_0xa269('0x2e')][_0xa269('0x4b')]({'where':{'id':_0x7ea725[_0xa269('0x49')]['id']}})[_0xa269('0x26')](handleEntityNotFound(_0x3a81f3,null))['then'](removeEntity(_0x3a81f3,null))[_0xa269('0x47')](handleError(_0x3a81f3,null));};exports[_0xa269('0x56')]=function(_0x2c61cc,_0x352f99,_0x39c0fd){var _0x44e8fe;return db['SquareOdbc'][_0xa269('0x4b')]({'where':{'id':_0x2c61cc['params']['id']},'attributes':['id',_0xa269('0x57')]})[_0xa269('0x26')](handleEntityNotFound(_0x352f99,null))[_0xa269('0x26')](function(_0x5a2bf9){if(_0x5a2bf9){var _0x349d8e=require('odbc')();_0x349d8e[_0xa269('0x58')](_0x5a2bf9[_0xa269('0x57')]);_0x349d8e[_0xa269('0x59')]();return _0x5a2bf9;}})[_0xa269('0x26')](respondWithResult(_0x352f99,null))['catch'](handleError(_0x352f99,null));}; \ No newline at end of file +var _0x2b5a=['bluebird','path','sox','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','intersection','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','test','odbc','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x2b5a,0xab));var _0xa2b5=function(_0x262e18,_0x535856){_0x262e18=_0x262e18-0x0;var _0x50e0ea=_0x2b5a[_0x262e18];return _0x50e0ea;};'use strict';var emlformat=require(_0xa2b5('0x0'));var rimraf=require(_0xa2b5('0x1'));var zipdir=require(_0xa2b5('0x2'));var jsonpatch=require(_0xa2b5('0x3'));var rp=require('request-promise');var moment=require(_0xa2b5('0x4'));var BPromise=require(_0xa2b5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2b5('0x6'));var sox=require(_0xa2b5('0x7'));var csv=require('to-csv');var ejs=require(_0xa2b5('0x8'));var fs=require('fs');var fs_extra=require(_0xa2b5('0x9'));var _=require('lodash');var squel=require(_0xa2b5('0xa'));var crypto=require(_0xa2b5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa2b5('0xc'));var toCsv=require(_0xa2b5('0xd'));var querystring=require(_0xa2b5('0xe'));var Papa=require('papaparse');var Redis=require(_0xa2b5('0xf'));var authService=require(_0xa2b5('0x10'));var qs=require(_0xa2b5('0x11'));var as=require(_0xa2b5('0x12'));var hardwareService=require(_0xa2b5('0x13'));var logger=require(_0xa2b5('0x14'))(_0xa2b5('0x15'));var utils=require(_0xa2b5('0x16'));var config=require(_0xa2b5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2b5('0x18'))['db'];function respondWithStatusCode(_0x4c7a7a,_0x132390){_0x132390=_0x132390||0xcc;return function(_0x4352cb){if(_0x4352cb){return _0x4c7a7a[_0xa2b5('0x19')](_0x132390);}return _0x4c7a7a[_0xa2b5('0x1a')](_0x132390)[_0xa2b5('0x1b')]();};}function respondWithResult(_0x11248d,_0x44d245){_0x44d245=_0x44d245||0xc8;return function(_0x55f504){if(_0x55f504){return _0x11248d['status'](_0x44d245)[_0xa2b5('0x1c')](_0x55f504);}};}function respondWithFilteredResult(_0x2cf7bb,_0x206111){return function(_0x5a3f42){if(_0x5a3f42){var _0x3729ce=typeof _0x206111[_0xa2b5('0x1d')]===_0xa2b5('0x1e')&&typeof _0x206111[_0xa2b5('0x1f')]==='undefined';var _0x4bd1d1=_0x5a3f42[_0xa2b5('0x20')];var _0x578bca=_0x3729ce?0x0:_0x206111['offset'];var _0x4c4d33=_0x3729ce?_0x5a3f42['count']:_0x206111[_0xa2b5('0x1d')]+_0x206111[_0xa2b5('0x1f')];var _0xad2f2f;if(_0x4c4d33>=_0x4bd1d1){_0x4c4d33=_0x4bd1d1;_0xad2f2f=0xc8;}else{_0xad2f2f=0xce;}_0x2cf7bb['status'](_0xad2f2f);return _0x2cf7bb['set']('Content-Range',_0x578bca+'-'+_0x4c4d33+'/'+_0x4bd1d1)['json'](_0x5a3f42);}return null;};}function patchUpdates(_0x560a00){return function(_0x413670){try{jsonpatch[_0xa2b5('0x21')](_0x413670,_0x560a00,!![]);}catch(_0x483fcb){return BPromise[_0xa2b5('0x22')](_0x483fcb);}return _0x413670[_0xa2b5('0x23')]();};}function saveUpdates(_0x5aee12,_0x17a73c){return function(_0x1b1f77){if(_0x1b1f77){return _0x1b1f77[_0xa2b5('0x24')](_0x5aee12)[_0xa2b5('0x25')](function(_0x322b0a){return _0x322b0a;});}return null;};}function removeEntity(_0x7c57cf,_0x5d6b14){return function(_0x371197){if(_0x371197){return _0x371197[_0xa2b5('0x26')]()[_0xa2b5('0x25')](function(){var _0x242198=_0x371197['get']({'plain':!![]});var _0x359fbf=_0xa2b5('0x27');return db[_0xa2b5('0x28')]['destroy']({'where':{'type':_0x359fbf,'resourceId':_0x242198['id']}})[_0xa2b5('0x25')](function(){return _0x371197;});})[_0xa2b5('0x25')](function(){_0x7c57cf[_0xa2b5('0x1a')](0xcc)[_0xa2b5('0x1b')]();});}};}function handleEntityNotFound(_0x25f093,_0x282481){return function(_0x280a4a){if(!_0x280a4a){_0x25f093[_0xa2b5('0x19')](0x194);}return _0x280a4a;};}function handleError(_0x3742eb,_0x41e72d){_0x41e72d=_0x41e72d||0x1f4;return function(_0x368adb){logger[_0xa2b5('0x29')](_0x368adb[_0xa2b5('0x2a')]);if(_0x368adb[_0xa2b5('0x2b')]){delete _0x368adb['name'];}_0x3742eb[_0xa2b5('0x1a')](_0x41e72d)[_0xa2b5('0x2c')](_0x368adb);};}exports[_0xa2b5('0x2d')]=function(_0x428084,_0x1600f3){var _0x3e4d75={},_0x12ed0a={},_0x426355={'count':0x0,'rows':[]};var _0x227f19=_[_0xa2b5('0x2e')](db[_0xa2b5('0x2f')][_0xa2b5('0x30')],function(_0x3d3eb7){return{'name':_0x3d3eb7[_0xa2b5('0x31')],'type':_0x3d3eb7[_0xa2b5('0x32')][_0xa2b5('0x33')]};});_0x12ed0a[_0xa2b5('0x34')]=_[_0xa2b5('0x2e')](_0x227f19,_0xa2b5('0x2b'));_0x12ed0a['query']=_['keys'](_0x428084['query']);_0x12ed0a[_0xa2b5('0x35')]=_['intersection'](_0x12ed0a[_0xa2b5('0x34')],_0x12ed0a[_0xa2b5('0x36')]);_0x3e4d75['attributes']=_['intersection'](_0x12ed0a[_0xa2b5('0x34')],qs[_0xa2b5('0x37')](_0x428084[_0xa2b5('0x36')]['fields']));_0x3e4d75[_0xa2b5('0x38')]=_0x3e4d75['attributes'][_0xa2b5('0x39')]?_0x3e4d75[_0xa2b5('0x38')]:_0x12ed0a['model'];if(!_0x428084['query'][_0xa2b5('0x3a')](_0xa2b5('0x3b'))){_0x3e4d75['limit']=qs[_0xa2b5('0x1f')](_0x428084['query'][_0xa2b5('0x1f')]);_0x3e4d75[_0xa2b5('0x1d')]=qs['offset'](_0x428084['query'][_0xa2b5('0x1d')]);}_0x3e4d75[_0xa2b5('0x3c')]=qs[_0xa2b5('0x3d')](_0x428084['query'][_0xa2b5('0x3d')]);_0x3e4d75['where']=qs['filters'](_[_0xa2b5('0x3e')](_0x428084[_0xa2b5('0x36')],_0x12ed0a[_0xa2b5('0x35')]),_0x227f19);if(_0x428084[_0xa2b5('0x36')][_0xa2b5('0x3f')]){_0x3e4d75[_0xa2b5('0x40')]=_[_0xa2b5('0x41')](_0x3e4d75[_0xa2b5('0x40')],{'$or':_[_0xa2b5('0x2e')](_0x227f19,function(_0x44a2c0){if(_0x44a2c0['type']!==_0xa2b5('0x42')){var _0x517651={};_0x517651[_0x44a2c0[_0xa2b5('0x2b')]]={'$like':'%'+_0x428084[_0xa2b5('0x36')]['filter']+'%'};return _0x517651;}})});}_0x3e4d75=_[_0xa2b5('0x41')]({},_0x3e4d75,_0x428084[_0xa2b5('0x43')]);var _0x245fd9={'where':_0x3e4d75['where']};return db[_0xa2b5('0x2f')][_0xa2b5('0x20')](_0x245fd9)[_0xa2b5('0x25')](function(_0x3ca3de){_0x426355['count']=_0x3ca3de;if(_0x428084['query'][_0xa2b5('0x44')]){_0x3e4d75[_0xa2b5('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0xa2b5('0x46')](_0x3e4d75);})[_0xa2b5('0x25')](function(_0x373ed1){_0x426355['rows']=_0x373ed1;return _0x426355;})[_0xa2b5('0x25')](respondWithFilteredResult(_0x1600f3,_0x3e4d75))[_0xa2b5('0x47')](handleError(_0x1600f3,null));};exports[_0xa2b5('0x48')]=function(_0x24845e,_0x181982){var _0x1408a1={'raw':!![],'where':{'id':_0x24845e['params']['id']}},_0x579870={};_0x579870[_0xa2b5('0x34')]=_[_0xa2b5('0x49')](db[_0xa2b5('0x2f')]['rawAttributes']);_0x579870[_0xa2b5('0x36')]=_[_0xa2b5('0x49')](_0x24845e[_0xa2b5('0x36')]);_0x579870['filters']=_['intersection'](_0x579870[_0xa2b5('0x34')],_0x579870[_0xa2b5('0x36')]);_0x1408a1[_0xa2b5('0x38')]=_[_0xa2b5('0x4a')](_0x579870[_0xa2b5('0x34')],qs[_0xa2b5('0x37')](_0x24845e['query'][_0xa2b5('0x37')]));_0x1408a1[_0xa2b5('0x38')]=_0x1408a1[_0xa2b5('0x38')][_0xa2b5('0x39')]?_0x1408a1[_0xa2b5('0x38')]:_0x579870[_0xa2b5('0x34')];if(_0x24845e[_0xa2b5('0x36')][_0xa2b5('0x44')]){_0x1408a1[_0xa2b5('0x45')]=[{'all':!![]}];}_0x1408a1=_['merge']({},_0x1408a1,_0x24845e['options']);return db[_0xa2b5('0x2f')]['find'](_0x1408a1)['then'](handleEntityNotFound(_0x181982,null))[_0xa2b5('0x25')](respondWithResult(_0x181982,null))[_0xa2b5('0x47')](handleError(_0x181982,null));};exports[_0xa2b5('0x4b')]=function(_0x3bab60,_0x5bcacb){return db['SquareOdbc'][_0xa2b5('0x4b')](_0x3bab60[_0xa2b5('0x4c')],{})[_0xa2b5('0x25')](function(_0x3d48d6){var _0x1ab3e6=_0x3bab60['user'][_0xa2b5('0x4d')]({'plain':!![]});if(!_0x1ab3e6)throw new Error(_0xa2b5('0x4e'));if(_0x1ab3e6[_0xa2b5('0x4f')]===_0xa2b5('0x50')){var _0x3dca31=_0x3d48d6[_0xa2b5('0x4d')]({'plain':!![]});var _0x4872cc=_0xa2b5('0x27');return db[_0xa2b5('0x51')]['find']({'where':{'name':_0x4872cc,'userProfileId':_0x1ab3e6['userProfileId']},'raw':!![]})['then'](function(_0x4abfb4){if(_0x4abfb4&&_0x4abfb4[_0xa2b5('0x52')]===0x0){return db[_0xa2b5('0x28')][_0xa2b5('0x4b')]({'name':_0x3dca31[_0xa2b5('0x2b')],'resourceId':_0x3dca31['id'],'type':_0x4abfb4['name'],'sectionId':_0x4abfb4['id']},{})[_0xa2b5('0x25')](function(){return _0x3d48d6;});}else{return _0x3d48d6;}})['catch'](function(_0x523023){logger[_0xa2b5('0x29')](_0xa2b5('0x53'),_0x523023);throw _0x523023;});}return _0x3d48d6;})[_0xa2b5('0x25')](respondWithResult(_0x5bcacb,0xc9))[_0xa2b5('0x47')](handleError(_0x5bcacb,null));};exports[_0xa2b5('0x24')]=function(_0x200f03,_0x597af2){if(_0x200f03[_0xa2b5('0x4c')]['id']){delete _0x200f03[_0xa2b5('0x4c')]['id'];}return db[_0xa2b5('0x2f')][_0xa2b5('0x54')]({'where':{'id':_0x200f03['params']['id']}})[_0xa2b5('0x25')](handleEntityNotFound(_0x597af2,null))[_0xa2b5('0x25')](saveUpdates(_0x200f03[_0xa2b5('0x4c')],null))[_0xa2b5('0x25')](respondWithResult(_0x597af2,null))[_0xa2b5('0x47')](handleError(_0x597af2,null));};exports[_0xa2b5('0x26')]=function(_0x523a06,_0x2586f5){return db[_0xa2b5('0x2f')]['find']({'where':{'id':_0x523a06[_0xa2b5('0x55')]['id']}})['then'](handleEntityNotFound(_0x2586f5,null))[_0xa2b5('0x25')](removeEntity(_0x2586f5,null))[_0xa2b5('0x47')](handleError(_0x2586f5,null));};exports[_0xa2b5('0x56')]=function(_0x2499ed,_0x59b2ba,_0x36a4bd){var _0x5892d1;return db['SquareOdbc']['find']({'where':{'id':_0x2499ed[_0xa2b5('0x55')]['id']},'attributes':['id','dsn']})[_0xa2b5('0x25')](handleEntityNotFound(_0x59b2ba,null))['then'](function(_0x58d78f){if(_0x58d78f){var _0x38a4f7=require(_0xa2b5('0x57'))();_0x38a4f7['openSync'](_0x58d78f['dsn']);_0x38a4f7['closeSync']();return _0x58d78f;}})[_0xa2b5('0x25')](respondWithResult(_0x59b2ba,null))[_0xa2b5('0x47')](handleError(_0x59b2ba,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ce27fa4..07a3597 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 _0x2f2d=['bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2f2d,0x173));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2f2('0x0'));var util=require(_0xd2f2('0x1'));var logger=require(_0xd2f2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd2f2('0x3'));var rp=require(_0xd2f2('0x4'));var fs=require('fs');var path=require(_0xd2f2('0x5'));var rimraf=require(_0xd2f2('0x6'));var config=require('../../config/environment');var attributes=require(_0xd2f2('0x7'));module[_0xd2f2('0x8')]=function(_0x356386,_0x2adce6){return _0x356386[_0xd2f2('0x9')](_0xd2f2('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5768=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','SquareOdbc'];(function(_0x5298f2,_0x7680e4){var _0x5d3206=function(_0x42698e){while(--_0x42698e){_0x5298f2['push'](_0x5298f2['shift']());}};_0x5d3206(++_0x7680e4);}(_0x5768,0x1b8));var _0x8576=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5768[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x8576('0x0'));var util=require(_0x8576('0x1'));var logger=require(_0x8576('0x2'))(_0x8576('0x3'));var moment=require(_0x8576('0x4'));var BPromise=require(_0x8576('0x5'));var rp=require(_0x8576('0x6'));var fs=require('fs');var path=require(_0x8576('0x7'));var rimraf=require('rimraf');var config=require(_0x8576('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x8576('0x9')]=function(_0x4c8f0b,_0xd89cd3){return _0x4c8f0b['define'](_0x8576('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b38a1ec..2339809 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 _0xf577=['model','attributes','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','ShowSquareOdbc','options','raw','where','include','map'];(function(_0x2063cf,_0x4efe2f){var _0x24d448=function(_0x5a457e){while(--_0x5a457e){_0x2063cf['push'](_0x2063cf['shift']());}};_0x24d448(++_0x4efe2f);}(_0xf577,0x188));var _0x7f57=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf577[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f57('0x0'));var BPromise=require(_0x7f57('0x1'));var rs=require(_0x7f57('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f57('0x3'))('rpc');var config=require(_0x7f57('0x4'));var jayson=require(_0x7f57('0x5'));var client=jayson['client'][_0x7f57('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2124f4,_0x464e63,_0x17bfbe){return new BPromise(function(_0x4310a1,_0x36620a){return client[_0x7f57('0x7')](_0x2124f4,_0x17bfbe)[_0x7f57('0x8')](function(_0x402df5){logger[_0x7f57('0x9')](_0x7f57('0xa'),_0x464e63,'request\x20sent');logger[_0x7f57('0xb')](_0x7f57('0xc'),_0x464e63,_0x7f57('0xd'),JSON[_0x7f57('0xe')](_0x402df5));if(_0x402df5[_0x7f57('0xf')]){if(_0x402df5[_0x7f57('0xf')]['code']===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x464e63,_0x402df5[_0x7f57('0xf')][_0x7f57('0x10')]);return _0x36620a(_0x402df5[_0x7f57('0xf')][_0x7f57('0x10')]);}logger[_0x7f57('0xf')](_0x7f57('0xa'),_0x464e63,_0x402df5[_0x7f57('0xf')]['message']);return _0x4310a1(_0x402df5['error'][_0x7f57('0x10')]);}else{logger['info'](_0x7f57('0xa'),_0x464e63,_0x7f57('0xd'));_0x4310a1(_0x402df5['result'][_0x7f57('0x10')]);}})[_0x7f57('0x11')](function(_0x737ac4){logger[_0x7f57('0xf')](_0x7f57('0xa'),_0x464e63,_0x737ac4);_0x36620a(_0x737ac4);});});}exports[_0x7f57('0x12')]=function(_0x582502){var _0x5ed545=this;return new Promise(function(_0x299adf,_0x28f84d){return db['SquareOdbc']['find']({'raw':_0x582502[_0x7f57('0x13')]?_0x582502['options'][_0x7f57('0x14')]===undefined?!![]:![]:!![],'where':_0x582502['options']?_0x582502[_0x7f57('0x13')][_0x7f57('0x15')]||null:null,'attributes':_0x582502[_0x7f57('0x13')]?_0x582502['options']['attributes']||null:null,'include':_0x582502[_0x7f57('0x13')]?_0x582502[_0x7f57('0x13')][_0x7f57('0x16')]?_[_0x7f57('0x17')](_0x582502[_0x7f57('0x13')][_0x7f57('0x16')],function(_0x1e714d){return{'model':db[_0x1e714d[_0x7f57('0x18')]],'as':_0x1e714d['as'],'attributes':_0x1e714d[_0x7f57('0x19')],'include':_0x1e714d['include']?_['map'](_0x1e714d[_0x7f57('0x16')],function(_0x4f9878){return{'model':db[_0x4f9878[_0x7f57('0x18')]],'as':_0x4f9878['as'],'attributes':_0x4f9878[_0x7f57('0x19')],'include':_0x4f9878['include']?_[_0x7f57('0x17')](_0x4f9878[_0x7f57('0x16')],function(_0xaec02d){return{'model':db[_0xaec02d['model']],'as':_0xaec02d['as'],'attributes':_0xaec02d[_0x7f57('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7f57('0x8')](function(_0xb5a207){logger[_0x7f57('0x9')](_0x7f57('0x12'),_0x582502);logger[_0x7f57('0xb')](_0x7f57('0x12'),_0x582502,JSON[_0x7f57('0xe')](_0xb5a207));_0x299adf(_0xb5a207);})[_0x7f57('0x11')](function(_0x4f26af){logger['error'](_0x7f57('0x12'),_0x4f26af[_0x7f57('0x10')],_0x582502);_0x28f84d(_0x5ed545[_0x7f57('0xf')](0x1f4,_0x4f26af['message']));});});}; \ No newline at end of file +var _0xe678=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x324645,_0xdc9c60){var _0x518909=function(_0x48a9f9){while(--_0x48a9f9){_0x324645['push'](_0x324645['shift']());}};_0x518909(++_0xdc9c60);}(_0xe678,0x1cb));var _0x8e67=function(_0x15a2a7,_0x2b9d15){_0x15a2a7=_0x15a2a7-0x0;var _0x410fba=_0xe678[_0x15a2a7];return _0x410fba;};'use strict';var _=require(_0x8e67('0x0'));var util=require(_0x8e67('0x1'));var moment=require(_0x8e67('0x2'));var BPromise=require(_0x8e67('0x3'));var rs=require(_0x8e67('0x4'));var fs=require('fs');var Redis=require(_0x8e67('0x5'));var db=require(_0x8e67('0x6'))['db'];var utils=require(_0x8e67('0x7'));var logger=require(_0x8e67('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e67('0x9'));var client=jayson['client'][_0x8e67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50d31d,_0x1e318d,_0x36a5c3){return new BPromise(function(_0x314002,_0x3ad565){return client[_0x8e67('0xb')](_0x50d31d,_0x36a5c3)[_0x8e67('0xc')](function(_0x3ffd18){logger['info'](_0x8e67('0xd'),_0x1e318d,_0x8e67('0xe'));logger[_0x8e67('0xf')](_0x8e67('0x10'),_0x1e318d,_0x8e67('0xe'),JSON[_0x8e67('0x11')](_0x3ffd18));if(_0x3ffd18[_0x8e67('0x12')]){if(_0x3ffd18[_0x8e67('0x12')][_0x8e67('0x13')]===0x1f4){logger['error'](_0x8e67('0xd'),_0x1e318d,_0x3ffd18[_0x8e67('0x12')][_0x8e67('0x14')]);return _0x3ad565(_0x3ffd18[_0x8e67('0x12')][_0x8e67('0x14')]);}logger[_0x8e67('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x1e318d,_0x3ffd18[_0x8e67('0x12')][_0x8e67('0x14')]);return _0x314002(_0x3ffd18[_0x8e67('0x12')][_0x8e67('0x14')]);}else{logger[_0x8e67('0x15')](_0x8e67('0xd'),_0x1e318d,_0x8e67('0xe'));_0x314002(_0x3ffd18[_0x8e67('0x16')]['message']);}})[_0x8e67('0x17')](function(_0x4f8989){logger[_0x8e67('0x12')](_0x8e67('0xd'),_0x1e318d,_0x4f8989);_0x3ad565(_0x4f8989);});});}exports[_0x8e67('0x18')]=function(_0x4b25dc){var _0x311463=this;return new Promise(function(_0x1452ab,_0x4c863b){return db['SquareOdbc']['find']({'raw':_0x4b25dc[_0x8e67('0x19')]?_0x4b25dc[_0x8e67('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4b25dc['options']?_0x4b25dc['options'][_0x8e67('0x1a')]||null:null,'attributes':_0x4b25dc[_0x8e67('0x19')]?_0x4b25dc[_0x8e67('0x19')][_0x8e67('0x1b')]||null:null,'include':_0x4b25dc[_0x8e67('0x19')]?_0x4b25dc[_0x8e67('0x19')][_0x8e67('0x1c')]?_[_0x8e67('0x1d')](_0x4b25dc[_0x8e67('0x19')][_0x8e67('0x1c')],function(_0x3488c7){return{'model':db[_0x3488c7[_0x8e67('0x1e')]],'as':_0x3488c7['as'],'attributes':_0x3488c7[_0x8e67('0x1b')],'include':_0x3488c7[_0x8e67('0x1c')]?_[_0x8e67('0x1d')](_0x3488c7[_0x8e67('0x1c')],function(_0x9c29a1){return{'model':db[_0x9c29a1[_0x8e67('0x1e')]],'as':_0x9c29a1['as'],'attributes':_0x9c29a1[_0x8e67('0x1b')],'include':_0x9c29a1[_0x8e67('0x1c')]?_[_0x8e67('0x1d')](_0x9c29a1['include'],function(_0x31b7cb){return{'model':db[_0x31b7cb[_0x8e67('0x1e')]],'as':_0x31b7cb['as'],'attributes':_0x31b7cb[_0x8e67('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x250e8a){logger[_0x8e67('0x15')](_0x8e67('0x18'),_0x4b25dc);logger[_0x8e67('0xf')](_0x8e67('0x18'),_0x4b25dc,JSON[_0x8e67('0x11')](_0x250e8a));_0x1452ab(_0x250e8a);})['catch'](function(_0x1af93b){logger[_0x8e67('0x12')](_0x8e67('0x18'),_0x1af93b[_0x8e67('0x14')],_0x4b25dc);_0x4c863b(_0x311463[_0x8e67('0x12')](0x1f4,_0x1af93b[_0x8e67('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 67e2701..322c6b0 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 _0xb4f8=['./squareProject.controller','get','isAuthenticated','index','show','getUsers','post','create','/:id/users','put','/:id','update','delete','destroy','removeUsers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x12062f,_0x5ce5ba){var _0x24e187=function(_0x4c916f){while(--_0x4c916f){_0x12062f['push'](_0x12062f['shift']());}};_0x24e187(++_0x5ce5ba);}(_0xb4f8,0x83));var _0x8b4f=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xb4f8[_0x3b150c];return _0x5cd414;};'use strict';var multer=require('multer');var util=require(_0x8b4f('0x0'));var path=require(_0x8b4f('0x1'));var timeout=require(_0x8b4f('0x2'));var express=require(_0x8b4f('0x3'));var router=express[_0x8b4f('0x4')]();var fs_extra=require(_0x8b4f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b4f('0x6'));var config=require('../../config/environment');var controller=require(_0x8b4f('0x7'));router[_0x8b4f('0x8')]('/',auth[_0x8b4f('0x9')](),controller[_0x8b4f('0xa')]);router[_0x8b4f('0x8')]('/:id',auth[_0x8b4f('0x9')](),controller[_0x8b4f('0xb')]);router[_0x8b4f('0x8')]('/:id/users',auth[_0x8b4f('0x9')](),controller[_0x8b4f('0xc')]);router[_0x8b4f('0xd')]('/',auth[_0x8b4f('0x9')](),controller[_0x8b4f('0xe')]);router['post'](_0x8b4f('0xf'),auth[_0x8b4f('0x9')](),controller['addUsers']);router[_0x8b4f('0x10')](_0x8b4f('0x11'),auth['isAuthenticated'](),controller[_0x8b4f('0x12')]);router[_0x8b4f('0x13')]('/:id',auth[_0x8b4f('0x9')](),controller[_0x8b4f('0x14')]);router[_0x8b4f('0x13')](_0x8b4f('0xf'),auth['isAuthenticated'](),controller[_0x8b4f('0x15')]);module[_0x8b4f('0x16')]=router; \ No newline at end of file +var _0x17bb=['../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','/:id/users','getUsers','post','create','addUsers','update','destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x36c03f,_0x2fcec5){var _0x587946=function(_0x56101b){while(--_0x56101b){_0x36c03f['push'](_0x36c03f['shift']());}};_0x587946(++_0x2fcec5);}(_0x17bb,0x188));var _0xb17b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x17bb[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xb17b('0x0'));var util=require(_0xb17b('0x1'));var path=require(_0xb17b('0x2'));var timeout=require(_0xb17b('0x3'));var express=require(_0xb17b('0x4'));var router=express[_0xb17b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb17b('0x6'));var interaction=require(_0xb17b('0x7'));var config=require(_0xb17b('0x8'));var controller=require(_0xb17b('0x9'));router['get']('/',auth[_0xb17b('0xa')](),controller['index']);router[_0xb17b('0xb')](_0xb17b('0xc'),auth[_0xb17b('0xa')](),controller['show']);router[_0xb17b('0xb')](_0xb17b('0xd'),auth[_0xb17b('0xa')](),controller[_0xb17b('0xe')]);router[_0xb17b('0xf')]('/',auth[_0xb17b('0xa')](),controller[_0xb17b('0x10')]);router[_0xb17b('0xf')](_0xb17b('0xd'),auth['isAuthenticated'](),controller[_0xb17b('0x11')]);router['put'](_0xb17b('0xc'),auth[_0xb17b('0xa')](),controller[_0xb17b('0x12')]);router['delete']('/:id',auth[_0xb17b('0xa')](),controller[_0xb17b('0x13')]);router[_0xb17b('0x14')](_0xb17b('0xd'),auth[_0xb17b('0xa')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d67eb3f..6123451 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 _0xd0ce=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xd0ce,0x105));var _0xed0c=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0xd0ce[_0x209302];return _0x1df8e9;};'use strict';var Sequelize=require(_0xed0c('0x0'));module[_0xed0c('0x1')]={'name':{'type':Sequelize[_0xed0c('0x2')],'unique':_0xed0c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xed0c('0x2')]},'notes':{'type':Sequelize[_0xed0c('0x4')]},'preproduction':{'type':Sequelize[_0xed0c('0x5')](_0xed0c('0x6')),'get':function(){if(this[_0xed0c('0x7')](_0xed0c('0x8'))){return this[_0xed0c('0x7')](_0xed0c('0x8'))['toString'](_0xed0c('0x9'));}}},'production':{'type':Sequelize[_0xed0c('0x5')](_0xed0c('0x6')),'get':function(){if(this[_0xed0c('0x7')](_0xed0c('0xa'))){return this[_0xed0c('0x7')](_0xed0c('0xa'))[_0xed0c('0xb')](_0xed0c('0x9'));}}},'savedAt':{'type':Sequelize[_0xed0c('0xc')]},'publishedAt':{'type':Sequelize[_0xed0c('0xc')]}}; \ No newline at end of file +var _0x45c6=['getDataValue','preproduction','utf8','production','toString','DATE','exports','STRING','name','TEXT','BLOB'];(function(_0x453bc9,_0x2df167){var _0x4e4348=function(_0x1f3e6b){while(--_0x1f3e6b){_0x453bc9['push'](_0x453bc9['shift']());}};_0x4e4348(++_0x2df167);}(_0x45c6,0x74));var _0x645c=function(_0x22d5be,_0xfbe4ed){_0x22d5be=_0x22d5be-0x0;var _0x478dff=_0x45c6[_0x22d5be];return _0x478dff;};'use strict';var Sequelize=require('sequelize');module[_0x645c('0x0')]={'name':{'type':Sequelize[_0x645c('0x1')],'unique':_0x645c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x645c('0x3')]},'preproduction':{'type':Sequelize[_0x645c('0x4')]('long'),'get':function(){if(this[_0x645c('0x5')](_0x645c('0x6'))){return this[_0x645c('0x5')](_0x645c('0x6'))['toString'](_0x645c('0x7'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x645c('0x5')](_0x645c('0x8'))){return this[_0x645c('0x5')](_0x645c('0x8'))[_0x645c('0x9')](_0x645c('0x7'));}}},'savedAt':{'type':Sequelize[_0x645c('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b8bbe8c..059ddc6 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 _0x1d55=['reject','save','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','catch','show','rawAttributes','intersection','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','User','pick','filter','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x3440ec,_0x19c00d){var _0x164820=function(_0x476666){while(--_0x476666){_0x3440ec['push'](_0x3440ec['shift']());}};_0x164820(++_0x19c00d);}(_0x1d55,0x1be));var _0x51d5=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x1d55[_0x3e25c1];return _0x52e7f2;};'use strict';var emlformat=require(_0x51d5('0x0'));var rimraf=require(_0x51d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51d5('0x2'));var rp=require(_0x51d5('0x3'));var moment=require(_0x51d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51d5('0x5'));var util=require(_0x51d5('0x6'));var path=require(_0x51d5('0x7'));var sox=require(_0x51d5('0x8'));var csv=require(_0x51d5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51d5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x51d5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x51d5('0xc'));var toCsv=require(_0x51d5('0x9'));var querystring=require(_0x51d5('0xd'));var Papa=require(_0x51d5('0xe'));var Redis=require('ioredis');var authService=require(_0x51d5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51d5('0x10'));var logger=require(_0x51d5('0x11'))(_0x51d5('0x12'));var utils=require(_0x51d5('0x13'));var config=require(_0x51d5('0x14'));var licenseUtil=require(_0x51d5('0x15'));var db=require(_0x51d5('0x16'))['db'];config[_0x51d5('0x17')]=_[_0x51d5('0x18')](config[_0x51d5('0x17')],{'host':_0x51d5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51d5('0x17')]));require(_0x51d5('0x1a'))[_0x51d5('0x1b')](socket);function respondWithStatusCode(_0x18b2f1,_0x528420){_0x528420=_0x528420||0xcc;return function(_0x6d5118){if(_0x6d5118){return _0x18b2f1[_0x51d5('0x1c')](_0x528420);}return _0x18b2f1['status'](_0x528420)[_0x51d5('0x1d')]();};}function respondWithResult(_0x57b706,_0xef3215){_0xef3215=_0xef3215||0xc8;return function(_0x148e8b){if(_0x148e8b){return _0x57b706[_0x51d5('0x1e')](_0xef3215)[_0x51d5('0x1f')](_0x148e8b);}};}function respondWithFilteredResult(_0x30e8f1,_0x532cb8){return function(_0x4d2e85){if(_0x4d2e85){var _0x191819=typeof _0x532cb8[_0x51d5('0x20')]===_0x51d5('0x21')&&typeof _0x532cb8[_0x51d5('0x22')]===_0x51d5('0x21');var _0x2386fd=_0x4d2e85[_0x51d5('0x23')];var _0x40e7f0=_0x191819?0x0:_0x532cb8['offset'];var _0x49bf1f=_0x191819?_0x4d2e85['count']:_0x532cb8[_0x51d5('0x20')]+_0x532cb8['limit'];var _0xd23634;if(_0x49bf1f>=_0x2386fd){_0x49bf1f=_0x2386fd;_0xd23634=0xc8;}else{_0xd23634=0xce;}_0x30e8f1['status'](_0xd23634);return _0x30e8f1[_0x51d5('0x24')](_0x51d5('0x25'),_0x40e7f0+'-'+_0x49bf1f+'/'+_0x2386fd)[_0x51d5('0x1f')](_0x4d2e85);}return null;};}function patchUpdates(_0x17b4f5){return function(_0x26d310){try{jsonpatch[_0x51d5('0x26')](_0x26d310,_0x17b4f5,!![]);}catch(_0x1c0d95){return BPromise[_0x51d5('0x27')](_0x1c0d95);}return _0x26d310[_0x51d5('0x28')]();};}function saveUpdates(_0x4289d3,_0x48f7f6){return function(_0x359c03){if(_0x359c03){return _0x359c03[_0x51d5('0x29')](_0x4289d3)[_0x51d5('0x2a')](function(_0x486377){return _0x486377;});}return null;};}function removeEntity(_0x17257a,_0x311cad){return function(_0x86405b){if(_0x86405b){return _0x86405b[_0x51d5('0x2b')]()[_0x51d5('0x2a')](function(){var _0x3925e8=_0x86405b[_0x51d5('0x2c')]({'plain':!![]});var _0x3dc2d6=_0x51d5('0x2d');return db['UserProfileResource'][_0x51d5('0x2b')]({'where':{'type':_0x3dc2d6,'resourceId':_0x3925e8['id']}})['then'](function(){return _0x86405b;});})[_0x51d5('0x2a')](function(){_0x17257a['status'](0xcc)[_0x51d5('0x1d')]();});}};}function handleEntityNotFound(_0x11ef48,_0x4e5a29){return function(_0x31a6c7){if(!_0x31a6c7){_0x11ef48[_0x51d5('0x1c')](0x194);}return _0x31a6c7;};}function handleError(_0x2d6032,_0x4e2b5e){_0x4e2b5e=_0x4e2b5e||0x1f4;return function(_0x1c7cda){logger[_0x51d5('0x2e')](_0x1c7cda['stack']);if(_0x1c7cda[_0x51d5('0x2f')]){delete _0x1c7cda['name'];}_0x2d6032[_0x51d5('0x1e')](_0x4e2b5e)[_0x51d5('0x30')](_0x1c7cda);};}exports[_0x51d5('0x31')]=function(_0x40a5fb,_0x171550){var _0x19b37b={},_0x167ebe={},_0x5a95df={'count':0x0,'rows':[]};var _0x2ade41=_[_0x51d5('0x32')](db[_0x51d5('0x33')]['rawAttributes'],function(_0x5cb842){return{'name':_0x5cb842[_0x51d5('0x34')],'type':_0x5cb842[_0x51d5('0x35')]['key']};});_0x167ebe[_0x51d5('0x36')]=_[_0x51d5('0x32')](_0x2ade41,_0x51d5('0x2f'));_0x167ebe[_0x51d5('0x37')]=_[_0x51d5('0x38')](_0x40a5fb[_0x51d5('0x37')]);_0x167ebe[_0x51d5('0x39')]=_['intersection'](_0x167ebe[_0x51d5('0x36')],_0x167ebe[_0x51d5('0x37')]);_0x19b37b[_0x51d5('0x3a')]=_['intersection'](_0x167ebe[_0x51d5('0x36')],qs[_0x51d5('0x3b')](_0x40a5fb[_0x51d5('0x37')]['fields']));_0x19b37b[_0x51d5('0x3a')]=_0x19b37b[_0x51d5('0x3a')][_0x51d5('0x3c')]?_0x19b37b[_0x51d5('0x3a')]:_0x167ebe[_0x51d5('0x36')];if(!_0x40a5fb[_0x51d5('0x37')][_0x51d5('0x3d')](_0x51d5('0x3e'))){_0x19b37b['limit']=qs[_0x51d5('0x22')](_0x40a5fb['query'][_0x51d5('0x22')]);_0x19b37b[_0x51d5('0x20')]=qs[_0x51d5('0x20')](_0x40a5fb[_0x51d5('0x37')][_0x51d5('0x20')]);}_0x19b37b[_0x51d5('0x3f')]=qs[_0x51d5('0x40')](_0x40a5fb[_0x51d5('0x37')][_0x51d5('0x40')]);_0x19b37b[_0x51d5('0x41')]=qs[_0x51d5('0x39')](_['pick'](_0x40a5fb[_0x51d5('0x37')],_0x167ebe['filters']),_0x2ade41);if(_0x40a5fb[_0x51d5('0x37')]['filter']){_0x19b37b[_0x51d5('0x41')]=_[_0x51d5('0x42')](_0x19b37b[_0x51d5('0x41')],{'$or':_[_0x51d5('0x32')](_0x2ade41,function(_0x5b6011){if(_0x5b6011[_0x51d5('0x35')]!==_0x51d5('0x43')){var _0x3231ee={};_0x3231ee[_0x5b6011[_0x51d5('0x2f')]]={'$like':'%'+_0x40a5fb['query']['filter']+'%'};return _0x3231ee;}})});}_0x19b37b=_['merge']({},_0x19b37b,_0x40a5fb[_0x51d5('0x44')]);var _0x352097={'where':_0x19b37b[_0x51d5('0x41')]};return db[_0x51d5('0x33')][_0x51d5('0x23')](_0x352097)['then'](function(_0x403114){_0x5a95df[_0x51d5('0x23')]=_0x403114;if(_0x40a5fb[_0x51d5('0x37')]['includeAll']){_0x19b37b[_0x51d5('0x45')]=[{'all':!![]}];}return db['SquareProject'][_0x51d5('0x46')](_0x19b37b);})['then'](function(_0x550a5e){_0x5a95df['rows']=_0x550a5e;return _0x5a95df;})[_0x51d5('0x2a')](respondWithFilteredResult(_0x171550,_0x19b37b))[_0x51d5('0x47')](handleError(_0x171550,null));};exports[_0x51d5('0x48')]=function(_0x2e7f6c,_0x477cda){var _0x1ec21c={'raw':![],'where':{'id':_0x2e7f6c['params']['id']}},_0x357e7d={};_0x357e7d['model']=_[_0x51d5('0x38')](db[_0x51d5('0x33')][_0x51d5('0x49')]);_0x357e7d[_0x51d5('0x37')]=_[_0x51d5('0x38')](_0x2e7f6c['query']);_0x357e7d[_0x51d5('0x39')]=_[_0x51d5('0x4a')](_0x357e7d['model'],_0x357e7d[_0x51d5('0x37')]);_0x1ec21c[_0x51d5('0x3a')]=_[_0x51d5('0x4a')](_0x357e7d[_0x51d5('0x36')],qs[_0x51d5('0x3b')](_0x2e7f6c['query'][_0x51d5('0x3b')]));_0x1ec21c[_0x51d5('0x3a')]=_0x1ec21c[_0x51d5('0x3a')][_0x51d5('0x3c')]?_0x1ec21c[_0x51d5('0x3a')]:_0x357e7d['model'];if(_0x2e7f6c[_0x51d5('0x37')]['includeAll']){_0x1ec21c[_0x51d5('0x45')]=[{'all':!![]}];}_0x1ec21c=_['merge']({},_0x1ec21c,_0x2e7f6c['options']);return db[_0x51d5('0x33')][_0x51d5('0x4b')](_0x1ec21c)[_0x51d5('0x2a')](handleEntityNotFound(_0x477cda,null))[_0x51d5('0x2a')](respondWithResult(_0x477cda,null))[_0x51d5('0x47')](handleError(_0x477cda,null));};exports[_0x51d5('0x4c')]=function(_0x246bf2,_0x124483){return db[_0x51d5('0x33')][_0x51d5('0x4c')](_0x246bf2[_0x51d5('0x4d')],{})['then'](function(_0x27d016){var _0x3409ab=_0x246bf2['user'][_0x51d5('0x2c')]({'plain':!![]});if(!_0x3409ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3409ab[_0x51d5('0x4e')]===_0x51d5('0x4f')){var _0x382d2a=_0x27d016[_0x51d5('0x2c')]({'plain':!![]});var _0x5ebe5c='SquareProjects';return db[_0x51d5('0x50')]['find']({'where':{'name':_0x5ebe5c,'userProfileId':_0x3409ab[_0x51d5('0x51')]},'raw':!![]})[_0x51d5('0x2a')](function(_0x3400ed){if(_0x3400ed&&_0x3400ed[_0x51d5('0x52')]===0x0){return db[_0x51d5('0x53')][_0x51d5('0x4c')]({'name':_0x382d2a[_0x51d5('0x2f')],'resourceId':_0x382d2a['id'],'type':_0x3400ed['name'],'sectionId':_0x3400ed['id']},{})[_0x51d5('0x2a')](function(){return _0x27d016;});}else{return _0x27d016;}})['catch'](function(_0x152cac){logger[_0x51d5('0x2e')](_0x51d5('0x54'),_0x152cac);throw _0x152cac;});}return _0x27d016;})[_0x51d5('0x2a')](respondWithResult(_0x124483,0xc9))[_0x51d5('0x47')](handleError(_0x124483,null));};exports[_0x51d5('0x29')]=function(_0x2cd4ca,_0x4b316f){if(_0x2cd4ca[_0x51d5('0x4d')]['id']){delete _0x2cd4ca[_0x51d5('0x4d')]['id'];}return db[_0x51d5('0x33')][_0x51d5('0x4b')]({'where':{'id':_0x2cd4ca[_0x51d5('0x55')]['id']}})[_0x51d5('0x2a')](handleEntityNotFound(_0x4b316f,null))[_0x51d5('0x2a')](saveUpdates(_0x2cd4ca[_0x51d5('0x4d')],null))['then'](respondWithResult(_0x4b316f,null))[_0x51d5('0x47')](handleError(_0x4b316f,null));};exports[_0x51d5('0x2b')]=function(_0x3f488e,_0x25b6b4){return db['SquareProject'][_0x51d5('0x4b')]({'where':{'id':_0x3f488e[_0x51d5('0x55')]['id']}})[_0x51d5('0x2a')](handleEntityNotFound(_0x25b6b4,null))[_0x51d5('0x2a')](removeEntity(_0x25b6b4,null))[_0x51d5('0x47')](handleError(_0x25b6b4,null));};exports[_0x51d5('0x56')]=function(_0x4c0a44,_0x23e6dd,_0x4f2000){return db[_0x51d5('0x33')][_0x51d5('0x4b')]({'where':{'id':_0x4c0a44[_0x51d5('0x55')]['id']}})[_0x51d5('0x2a')](handleEntityNotFound(_0x23e6dd,null))[_0x51d5('0x2a')](function(_0x4b0a96){if(_0x4b0a96){return _0x4b0a96[_0x51d5('0x56')](_0x4c0a44[_0x51d5('0x4d')][_0x51d5('0x57')],_[_0x51d5('0x58')](_0x4c0a44['body'],[_0x51d5('0x57'),'id'])||{});}})[_0x51d5('0x2a')](respondWithResult(_0x23e6dd,null))['catch'](handleError(_0x23e6dd,null));};exports['removeUsers']=function(_0x2d68aa,_0x3c2863,_0x5515ee){return db[_0x51d5('0x33')][_0x51d5('0x4b')]({'where':{'id':_0x2d68aa['params']['id']}})['then'](handleEntityNotFound(_0x3c2863,null))[_0x51d5('0x2a')](function(_0x4c2dc9){if(_0x4c2dc9){return _0x4c2dc9[_0x51d5('0x59')](_0x2d68aa['query']['ids'])[_0x51d5('0x2a')](function(){if(_[_0x51d5('0x5a')](_0x2d68aa[_0x51d5('0x37')][_0x51d5('0x57')])){for(var _0x542b3c=0x0;_0x542b3c<_0x2d68aa[_0x51d5('0x37')][_0x51d5('0x57')][_0x51d5('0x3c')];_0x542b3c+=0x1){socket['emit'](_0x51d5('0x5b'),{'UserId':Number(_0x2d68aa[_0x51d5('0x37')][_0x51d5('0x57')][_0x542b3c]),'SquareProjectId':Number(_0x2d68aa[_0x51d5('0x55')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x2d68aa[_0x51d5('0x37')][_0x51d5('0x57')]),'SquareProjectId':Number(_0x2d68aa[_0x51d5('0x55')]['id'])});}});}})[_0x51d5('0x2a')](respondWithStatusCode(_0x3c2863,null))[_0x51d5('0x47')](handleError(_0x3c2863,null));};exports[_0x51d5('0x5c')]=function(_0x2d6220,_0xc056dd,_0x286a4b){var _0x7add1f={};var _0x267a69={};var _0x55f70a;var _0x45b8e7;return db[_0x51d5('0x33')][_0x51d5('0x5d')]({'where':{'id':_0x2d6220[_0x51d5('0x55')]['id']}})[_0x51d5('0x2a')](handleEntityNotFound(_0xc056dd,null))['then'](function(_0x4f2a38){if(_0x4f2a38){_0x55f70a=_0x4f2a38;_0x267a69[_0x51d5('0x36')]=_[_0x51d5('0x38')](db[_0x51d5('0x5e')][_0x51d5('0x49')]);_0x267a69[_0x51d5('0x37')]=_[_0x51d5('0x38')](_0x2d6220[_0x51d5('0x37')]);_0x267a69[_0x51d5('0x39')]=_['intersection'](_0x267a69[_0x51d5('0x36')],_0x267a69[_0x51d5('0x37')]);_0x7add1f['attributes']=_[_0x51d5('0x4a')](_0x267a69['model'],qs[_0x51d5('0x3b')](_0x2d6220[_0x51d5('0x37')][_0x51d5('0x3b')]));_0x7add1f[_0x51d5('0x3a')]=_0x7add1f[_0x51d5('0x3a')][_0x51d5('0x3c')]?_0x7add1f[_0x51d5('0x3a')]:_0x267a69[_0x51d5('0x36')];_0x7add1f[_0x51d5('0x3f')]=qs[_0x51d5('0x40')](_0x2d6220[_0x51d5('0x37')][_0x51d5('0x40')]);_0x7add1f[_0x51d5('0x41')]=qs[_0x51d5('0x39')](_[_0x51d5('0x5f')](_0x2d6220[_0x51d5('0x37')],_0x267a69[_0x51d5('0x39')]));if(_0x2d6220[_0x51d5('0x37')][_0x51d5('0x60')]){_0x7add1f['where']=_[_0x51d5('0x42')](_0x7add1f['where'],{'$or':_[_0x51d5('0x32')](_0x7add1f['attributes'],function(_0x11c8b9){var _0x10a1f9={};_0x10a1f9[_0x11c8b9]={'$like':'%'+_0x2d6220[_0x51d5('0x37')][_0x51d5('0x60')]+'%'};return _0x10a1f9;})});}_0x7add1f=_[_0x51d5('0x42')]({},_0x7add1f,_0x2d6220[_0x51d5('0x44')]);return _0x55f70a[_0x51d5('0x5c')](_0x7add1f);}})[_0x51d5('0x2a')](function(_0x2617d8){if(_0x2617d8){_0x45b8e7=_0x2617d8[_0x51d5('0x3c')];if(!_0x2d6220[_0x51d5('0x37')][_0x51d5('0x3d')](_0x51d5('0x3e'))){_0x7add1f[_0x51d5('0x22')]=qs[_0x51d5('0x22')](_0x2d6220['query'][_0x51d5('0x22')]);_0x7add1f[_0x51d5('0x20')]=qs[_0x51d5('0x20')](_0x2d6220[_0x51d5('0x37')]['offset']);}return _0x55f70a[_0x51d5('0x5c')](_0x7add1f);}})['then'](function(_0x3968f2){if(_0x3968f2){return _0x3968f2?{'count':_0x45b8e7,'rows':_0x3968f2}:null;}})[_0x51d5('0x2a')](respondWithResult(_0xc056dd,null))[_0x51d5('0x47')](handleError(_0xc056dd,null));}; \ No newline at end of file +var _0x0e1a=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','findOne','User','getUsers','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','findAll','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x229234,_0x211943){var _0x4d9c11=function(_0x1e2267){while(--_0x1e2267){_0x229234['push'](_0x229234['shift']());}};_0x4d9c11(++_0x211943);}(_0x0e1a,0x142));var _0xa0e1=function(_0x5c5351,_0x2395d2){_0x5c5351=_0x5c5351-0x0;var _0x37b375=_0x0e1a[_0x5c5351];return _0x37b375;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0e1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0e1('0x1'));var rp=require(_0xa0e1('0x2'));var moment=require(_0xa0e1('0x3'));var BPromise=require(_0xa0e1('0x4'));var Mustache=require(_0xa0e1('0x5'));var util=require(_0xa0e1('0x6'));var path=require(_0xa0e1('0x7'));var sox=require(_0xa0e1('0x8'));var csv=require(_0xa0e1('0x9'));var ejs=require(_0xa0e1('0xa'));var fs=require('fs');var fs_extra=require(_0xa0e1('0xb'));var _=require(_0xa0e1('0xc'));var squel=require(_0xa0e1('0xd'));var crypto=require(_0xa0e1('0xe'));var jsforce=require(_0xa0e1('0xf'));var deskjs=require(_0xa0e1('0x10'));var toCsv=require(_0xa0e1('0x9'));var querystring=require(_0xa0e1('0x11'));var Papa=require(_0xa0e1('0x12'));var Redis=require(_0xa0e1('0x13'));var authService=require(_0xa0e1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa0e1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0e1('0x16'))(_0xa0e1('0x17'));var utils=require(_0xa0e1('0x18'));var config=require(_0xa0e1('0x19'));var licenseUtil=require(_0xa0e1('0x1a'));var db=require(_0xa0e1('0x1b'))['db'];config[_0xa0e1('0x1c')]=_[_0xa0e1('0x1d')](config['redis'],{'host':_0xa0e1('0x1e'),'port':0x18eb});var socket=require(_0xa0e1('0x1f'))(new Redis(config['redis']));require(_0xa0e1('0x20'))[_0xa0e1('0x21')](socket);function respondWithStatusCode(_0xfbab90,_0x1cda45){_0x1cda45=_0x1cda45||0xcc;return function(_0x5adbbd){if(_0x5adbbd){return _0xfbab90['sendStatus'](_0x1cda45);}return _0xfbab90['status'](_0x1cda45)[_0xa0e1('0x22')]();};}function respondWithResult(_0x5d6fb4,_0x484a75){_0x484a75=_0x484a75||0xc8;return function(_0x291cdd){if(_0x291cdd){return _0x5d6fb4['status'](_0x484a75)[_0xa0e1('0x23')](_0x291cdd);}};}function respondWithFilteredResult(_0x2bdf48,_0x15585d){return function(_0x4137f3){if(_0x4137f3){var _0x47998e=typeof _0x15585d[_0xa0e1('0x24')]===_0xa0e1('0x25')&&typeof _0x15585d[_0xa0e1('0x26')]===_0xa0e1('0x25');var _0x37bb95=_0x4137f3[_0xa0e1('0x27')];var _0x142598=_0x47998e?0x0:_0x15585d['offset'];var _0x32a27a=_0x47998e?_0x4137f3[_0xa0e1('0x27')]:_0x15585d[_0xa0e1('0x24')]+_0x15585d[_0xa0e1('0x26')];var _0x36a732;if(_0x32a27a>=_0x37bb95){_0x32a27a=_0x37bb95;_0x36a732=0xc8;}else{_0x36a732=0xce;}_0x2bdf48[_0xa0e1('0x28')](_0x36a732);return _0x2bdf48[_0xa0e1('0x29')](_0xa0e1('0x2a'),_0x142598+'-'+_0x32a27a+'/'+_0x37bb95)['json'](_0x4137f3);}return null;};}function patchUpdates(_0x292e7a){return function(_0x1e4a7a){try{jsonpatch[_0xa0e1('0x2b')](_0x1e4a7a,_0x292e7a,!![]);}catch(_0x9832d9){return BPromise['reject'](_0x9832d9);}return _0x1e4a7a['save']();};}function saveUpdates(_0x32204e,_0x4e4ae4){return function(_0x129a7b){if(_0x129a7b){return _0x129a7b[_0xa0e1('0x2c')](_0x32204e)[_0xa0e1('0x2d')](function(_0x3dbe14){return _0x3dbe14;});}return null;};}function removeEntity(_0x6044f0,_0x4c2257){return function(_0x4b1d77){if(_0x4b1d77){return _0x4b1d77[_0xa0e1('0x2e')]()[_0xa0e1('0x2d')](function(){var _0x2ad83a=_0x4b1d77['get']({'plain':!![]});var _0x34293b=_0xa0e1('0x2f');return db[_0xa0e1('0x30')]['destroy']({'where':{'type':_0x34293b,'resourceId':_0x2ad83a['id']}})[_0xa0e1('0x2d')](function(){return _0x4b1d77;});})[_0xa0e1('0x2d')](function(){_0x6044f0[_0xa0e1('0x28')](0xcc)[_0xa0e1('0x22')]();});}};}function handleEntityNotFound(_0x5df6de,_0x491b05){return function(_0x3d65ee){if(!_0x3d65ee){_0x5df6de[_0xa0e1('0x31')](0x194);}return _0x3d65ee;};}function handleError(_0x54ddb6,_0x1f1bc2){_0x1f1bc2=_0x1f1bc2||0x1f4;return function(_0x3868ad){logger[_0xa0e1('0x32')](_0x3868ad[_0xa0e1('0x33')]);if(_0x3868ad['name']){delete _0x3868ad[_0xa0e1('0x34')];}_0x54ddb6[_0xa0e1('0x28')](_0x1f1bc2)[_0xa0e1('0x35')](_0x3868ad);};}exports[_0xa0e1('0x36')]=function(_0x216a03,_0x1a7279){var _0x13884d={},_0x385ba1={},_0x22fb0b={'count':0x0,'rows':[]};var _0xba0e20=_['map'](db[_0xa0e1('0x37')][_0xa0e1('0x38')],function(_0x241e42){return{'name':_0x241e42['fieldName'],'type':_0x241e42['type'][_0xa0e1('0x39')]};});_0x385ba1[_0xa0e1('0x3a')]=_[_0xa0e1('0x3b')](_0xba0e20,'name');_0x385ba1[_0xa0e1('0x3c')]=_[_0xa0e1('0x3d')](_0x216a03[_0xa0e1('0x3c')]);_0x385ba1['filters']=_[_0xa0e1('0x3e')](_0x385ba1['model'],_0x385ba1[_0xa0e1('0x3c')]);_0x13884d[_0xa0e1('0x3f')]=_[_0xa0e1('0x3e')](_0x385ba1['model'],qs[_0xa0e1('0x40')](_0x216a03['query']['fields']));_0x13884d[_0xa0e1('0x3f')]=_0x13884d[_0xa0e1('0x3f')][_0xa0e1('0x41')]?_0x13884d['attributes']:_0x385ba1[_0xa0e1('0x3a')];if(!_0x216a03[_0xa0e1('0x3c')]['hasOwnProperty'](_0xa0e1('0x42'))){_0x13884d['limit']=qs['limit'](_0x216a03['query'][_0xa0e1('0x26')]);_0x13884d[_0xa0e1('0x24')]=qs[_0xa0e1('0x24')](_0x216a03[_0xa0e1('0x3c')]['offset']);}_0x13884d[_0xa0e1('0x43')]=qs[_0xa0e1('0x44')](_0x216a03[_0xa0e1('0x3c')][_0xa0e1('0x44')]);_0x13884d[_0xa0e1('0x45')]=qs[_0xa0e1('0x46')](_[_0xa0e1('0x47')](_0x216a03[_0xa0e1('0x3c')],_0x385ba1[_0xa0e1('0x46')]),_0xba0e20);if(_0x216a03[_0xa0e1('0x3c')][_0xa0e1('0x48')]){_0x13884d['where']=_[_0xa0e1('0x49')](_0x13884d[_0xa0e1('0x45')],{'$or':_['map'](_0xba0e20,function(_0x31b403){if(_0x31b403[_0xa0e1('0x4a')]!=='VIRTUAL'){var _0x38516a={};_0x38516a[_0x31b403[_0xa0e1('0x34')]]={'$like':'%'+_0x216a03[_0xa0e1('0x3c')][_0xa0e1('0x48')]+'%'};return _0x38516a;}})});}_0x13884d=_[_0xa0e1('0x49')]({},_0x13884d,_0x216a03[_0xa0e1('0x4b')]);var _0x250ce7={'where':_0x13884d[_0xa0e1('0x45')]};return db[_0xa0e1('0x37')][_0xa0e1('0x27')](_0x250ce7)[_0xa0e1('0x2d')](function(_0x3c86da){_0x22fb0b[_0xa0e1('0x27')]=_0x3c86da;if(_0x216a03['query']['includeAll']){_0x13884d['include']=[{'all':!![]}];}return db[_0xa0e1('0x37')][_0xa0e1('0x4c')](_0x13884d);})['then'](function(_0x3bd408){_0x22fb0b['rows']=_0x3bd408;return _0x22fb0b;})['then'](respondWithFilteredResult(_0x1a7279,_0x13884d))[_0xa0e1('0x4d')](handleError(_0x1a7279,null));};exports[_0xa0e1('0x4e')]=function(_0x335e4e,_0x257737){var _0x2ba8ce={'raw':![],'where':{'id':_0x335e4e[_0xa0e1('0x4f')]['id']}},_0x2dd6a6={};_0x2dd6a6[_0xa0e1('0x3a')]=_[_0xa0e1('0x3d')](db[_0xa0e1('0x37')][_0xa0e1('0x38')]);_0x2dd6a6[_0xa0e1('0x3c')]=_[_0xa0e1('0x3d')](_0x335e4e[_0xa0e1('0x3c')]);_0x2dd6a6['filters']=_[_0xa0e1('0x3e')](_0x2dd6a6[_0xa0e1('0x3a')],_0x2dd6a6[_0xa0e1('0x3c')]);_0x2ba8ce['attributes']=_[_0xa0e1('0x3e')](_0x2dd6a6[_0xa0e1('0x3a')],qs[_0xa0e1('0x40')](_0x335e4e[_0xa0e1('0x3c')][_0xa0e1('0x40')]));_0x2ba8ce[_0xa0e1('0x3f')]=_0x2ba8ce[_0xa0e1('0x3f')][_0xa0e1('0x41')]?_0x2ba8ce['attributes']:_0x2dd6a6['model'];if(_0x335e4e[_0xa0e1('0x3c')][_0xa0e1('0x50')]){_0x2ba8ce[_0xa0e1('0x51')]=[{'all':!![]}];}_0x2ba8ce=_[_0xa0e1('0x49')]({},_0x2ba8ce,_0x335e4e['options']);return db['SquareProject'][_0xa0e1('0x52')](_0x2ba8ce)['then'](handleEntityNotFound(_0x257737,null))[_0xa0e1('0x2d')](respondWithResult(_0x257737,null))['catch'](handleError(_0x257737,null));};exports[_0xa0e1('0x53')]=function(_0x2eefa8,_0x4545e1){return db[_0xa0e1('0x37')][_0xa0e1('0x53')](_0x2eefa8[_0xa0e1('0x54')],{})[_0xa0e1('0x2d')](function(_0x3e0cf9){var _0x39343a=_0x2eefa8[_0xa0e1('0x55')][_0xa0e1('0x56')]({'plain':!![]});if(!_0x39343a)throw new Error(_0xa0e1('0x57'));if(_0x39343a[_0xa0e1('0x58')]===_0xa0e1('0x55')){var _0x3016d8=_0x3e0cf9[_0xa0e1('0x56')]({'plain':!![]});var _0x58287c=_0xa0e1('0x2f');return db[_0xa0e1('0x59')][_0xa0e1('0x52')]({'where':{'name':_0x58287c,'userProfileId':_0x39343a[_0xa0e1('0x5a')]},'raw':!![]})['then'](function(_0x169390){if(_0x169390&&_0x169390[_0xa0e1('0x5b')]===0x0){return db[_0xa0e1('0x30')][_0xa0e1('0x53')]({'name':_0x3016d8['name'],'resourceId':_0x3016d8['id'],'type':_0x169390[_0xa0e1('0x34')],'sectionId':_0x169390['id']},{})[_0xa0e1('0x2d')](function(){return _0x3e0cf9;});}else{return _0x3e0cf9;}})['catch'](function(_0x20710c){logger[_0xa0e1('0x32')](_0xa0e1('0x5c'),_0x20710c);throw _0x20710c;});}return _0x3e0cf9;})[_0xa0e1('0x2d')](respondWithResult(_0x4545e1,0xc9))[_0xa0e1('0x4d')](handleError(_0x4545e1,null));};exports[_0xa0e1('0x2c')]=function(_0x5c38be,_0x420f71){if(_0x5c38be['body']['id']){delete _0x5c38be['body']['id'];}return db[_0xa0e1('0x37')][_0xa0e1('0x52')]({'where':{'id':_0x5c38be['params']['id']}})[_0xa0e1('0x2d')](handleEntityNotFound(_0x420f71,null))['then'](saveUpdates(_0x5c38be['body'],null))[_0xa0e1('0x2d')](respondWithResult(_0x420f71,null))[_0xa0e1('0x4d')](handleError(_0x420f71,null));};exports[_0xa0e1('0x2e')]=function(_0x1b83ac,_0x36742d){return db[_0xa0e1('0x37')][_0xa0e1('0x52')]({'where':{'id':_0x1b83ac[_0xa0e1('0x4f')]['id']}})[_0xa0e1('0x2d')](handleEntityNotFound(_0x36742d,null))[_0xa0e1('0x2d')](removeEntity(_0x36742d,null))['catch'](handleError(_0x36742d,null));};exports[_0xa0e1('0x5d')]=function(_0x4d7eb1,_0x3c712c,_0x36d53a){return db[_0xa0e1('0x37')][_0xa0e1('0x52')]({'where':{'id':_0x4d7eb1[_0xa0e1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c712c,null))[_0xa0e1('0x2d')](function(_0x1ef443){if(_0x1ef443){return _0x1ef443[_0xa0e1('0x5d')](_0x4d7eb1['body'][_0xa0e1('0x5e')],_[_0xa0e1('0x5f')](_0x4d7eb1[_0xa0e1('0x54')],[_0xa0e1('0x5e'),'id'])||{});}})[_0xa0e1('0x2d')](respondWithResult(_0x3c712c,null))[_0xa0e1('0x4d')](handleError(_0x3c712c,null));};exports[_0xa0e1('0x60')]=function(_0x25bcce,_0x489623,_0x347911){return db[_0xa0e1('0x37')][_0xa0e1('0x52')]({'where':{'id':_0x25bcce[_0xa0e1('0x4f')]['id']}})[_0xa0e1('0x2d')](handleEntityNotFound(_0x489623,null))[_0xa0e1('0x2d')](function(_0x30dda1){if(_0x30dda1){return _0x30dda1[_0xa0e1('0x60')](_0x25bcce[_0xa0e1('0x3c')][_0xa0e1('0x5e')])['then'](function(){if(_['isArray'](_0x25bcce['query'][_0xa0e1('0x5e')])){for(var _0x29055a=0x0;_0x29055a<_0x25bcce[_0xa0e1('0x3c')][_0xa0e1('0x5e')]['length'];_0x29055a+=0x1){socket[_0xa0e1('0x61')](_0xa0e1('0x62'),{'UserId':Number(_0x25bcce[_0xa0e1('0x3c')][_0xa0e1('0x5e')][_0x29055a]),'SquareProjectId':Number(_0x25bcce['params']['id'])});}}else{socket[_0xa0e1('0x61')](_0xa0e1('0x62'),{'UserId':Number(_0x25bcce['query'][_0xa0e1('0x5e')]),'SquareProjectId':Number(_0x25bcce['params']['id'])});}});}})[_0xa0e1('0x2d')](respondWithStatusCode(_0x489623,null))[_0xa0e1('0x4d')](handleError(_0x489623,null));};exports['getUsers']=function(_0x5e0523,_0x1c7a81,_0x257806){var _0xb1d102={};var _0x4e4e3d={};var _0x4a5b1c;var _0x4d24a2;return db[_0xa0e1('0x37')][_0xa0e1('0x63')]({'where':{'id':_0x5e0523[_0xa0e1('0x4f')]['id']}})[_0xa0e1('0x2d')](handleEntityNotFound(_0x1c7a81,null))[_0xa0e1('0x2d')](function(_0x2e862b){if(_0x2e862b){_0x4a5b1c=_0x2e862b;_0x4e4e3d[_0xa0e1('0x3a')]=_['keys'](db[_0xa0e1('0x64')][_0xa0e1('0x38')]);_0x4e4e3d[_0xa0e1('0x3c')]=_[_0xa0e1('0x3d')](_0x5e0523['query']);_0x4e4e3d[_0xa0e1('0x46')]=_[_0xa0e1('0x3e')](_0x4e4e3d[_0xa0e1('0x3a')],_0x4e4e3d[_0xa0e1('0x3c')]);_0xb1d102[_0xa0e1('0x3f')]=_[_0xa0e1('0x3e')](_0x4e4e3d[_0xa0e1('0x3a')],qs[_0xa0e1('0x40')](_0x5e0523[_0xa0e1('0x3c')][_0xa0e1('0x40')]));_0xb1d102['attributes']=_0xb1d102[_0xa0e1('0x3f')]['length']?_0xb1d102['attributes']:_0x4e4e3d['model'];_0xb1d102[_0xa0e1('0x43')]=qs[_0xa0e1('0x44')](_0x5e0523['query'][_0xa0e1('0x44')]);_0xb1d102[_0xa0e1('0x45')]=qs[_0xa0e1('0x46')](_[_0xa0e1('0x47')](_0x5e0523[_0xa0e1('0x3c')],_0x4e4e3d[_0xa0e1('0x46')]));if(_0x5e0523[_0xa0e1('0x3c')]['filter']){_0xb1d102[_0xa0e1('0x45')]=_[_0xa0e1('0x49')](_0xb1d102[_0xa0e1('0x45')],{'$or':_['map'](_0xb1d102['attributes'],function(_0x58e040){var _0x2e1425={};_0x2e1425[_0x58e040]={'$like':'%'+_0x5e0523[_0xa0e1('0x3c')]['filter']+'%'};return _0x2e1425;})});}_0xb1d102=_[_0xa0e1('0x49')]({},_0xb1d102,_0x5e0523['options']);return _0x4a5b1c[_0xa0e1('0x65')](_0xb1d102);}})['then'](function(_0x41af63){if(_0x41af63){_0x4d24a2=_0x41af63[_0xa0e1('0x41')];if(!_0x5e0523[_0xa0e1('0x3c')][_0xa0e1('0x66')](_0xa0e1('0x42'))){_0xb1d102[_0xa0e1('0x26')]=qs[_0xa0e1('0x26')](_0x5e0523['query'][_0xa0e1('0x26')]);_0xb1d102[_0xa0e1('0x24')]=qs[_0xa0e1('0x24')](_0x5e0523['query']['offset']);}return _0x4a5b1c[_0xa0e1('0x65')](_0xb1d102);}})[_0xa0e1('0x2d')](function(_0x3c7665){if(_0x3c7665){return _0x3c7665?{'count':_0x4d24a2,'rows':_0x3c7665}:null;}})[_0xa0e1('0x2d')](respondWithResult(_0x1c7a81,null))[_0xa0e1('0x4d')](handleError(_0x1c7a81,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 33b83d5..d28bc85 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 _0xa480=['SquareProject','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3a1d18,_0x4332e6){var _0x3ab894=function(_0x3fd976){while(--_0x3fd976){_0x3a1d18['push'](_0x3a1d18['shift']());}};_0x3ab894(++_0x4332e6);}(_0xa480,0x99));var _0x0a48=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xa480[_0x3305de];return _0x3b5a84;};'use strict';var EventEmitter=require(_0x0a48('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x0a48('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0a48('0x2')};function emitEvent(_0x3d8327){return function(_0x17461b,_0x228d18,_0x96d907){SquareProjectEvents[_0x0a48('0x3')](_0x3d8327+':'+_0x17461b['id'],_0x17461b);SquareProjectEvents[_0x0a48('0x3')](_0x3d8327,_0x17461b);_0x96d907(null);};}for(var e in events){if(events[_0x0a48('0x4')](e)){var event=events[e];SquareProject[_0x0a48('0x5')](e,emitEvent(event));}}module[_0x0a48('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x1caf=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject'];(function(_0x5c362d,_0x324e81){var _0x5445c3=function(_0x178632){while(--_0x178632){_0x5c362d['push'](_0x5c362d['shift']());}};_0x5445c3(++_0x324e81);}(_0x1caf,0x1dd));var _0xf1ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1caf[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf1ca('0x0'));var SquareProject=require(_0xf1ca('0x1'))['db'][_0xf1ca('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1ca('0x3'),'afterUpdate':'update','afterDestroy':_0xf1ca('0x4')};function emitEvent(_0x206c51){return function(_0x1be370,_0x4db14c,_0x3a8250){SquareProjectEvents[_0xf1ca('0x5')](_0x206c51+':'+_0x1be370['id'],_0x1be370);SquareProjectEvents[_0xf1ca('0x5')](_0x206c51,_0x1be370);_0x3a8250(null);};}for(var e in events){if(events[_0xf1ca('0x6')](e)){var event=events[e];SquareProject[_0xf1ca('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index faf0016..ca176d8 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 _0x94e7=['SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e7,0x118));var _0x794e=function(_0x5a29b6,_0x1a7e50){_0x5a29b6=_0x5a29b6-0x0;var _0x164f24=_0x94e7[_0x5a29b6];return _0x164f24;};'use strict';var _=require(_0x794e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x794e('0x1'));var moment=require(_0x794e('0x2'));var BPromise=require(_0x794e('0x3'));var rp=require(_0x794e('0x4'));var fs=require('fs');var path=require(_0x794e('0x5'));var rimraf=require('rimraf');var config=require(_0x794e('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x395c99,_0x2fdc35){return _0x395c99[_0x794e('0x7')](_0x794e('0x8'),attributes,{'tableName':_0x794e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22e9ac,_0x1b8ddb,_0x312f10){if(_0x22e9ac['changed'](_0x794e('0xa'))){_0x22e9ac[_0x794e('0xb')]=moment()[_0x794e('0xc')](_0x794e('0xd'));}if(_0x22e9ac['changed'](_0x794e('0xe'))){_0x22e9ac[_0x794e('0xf')]=moment()[_0x794e('0xc')](_0x794e('0xd'));}_0x312f10(null,_0x22e9ac);}}});}; \ No newline at end of file +var _0x00d3=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash'];(function(_0x6e9a01,_0x41ab36){var _0x238469=function(_0x4811e){while(--_0x4811e){_0x6e9a01['push'](_0x6e9a01['shift']());}};_0x238469(++_0x41ab36);}(_0x00d3,0x11f));var _0x300d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x00d3[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x300d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x300d('0x1'));var moment=require(_0x300d('0x2'));var BPromise=require(_0x300d('0x3'));var rp=require(_0x300d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x300d('0x5'));var config=require(_0x300d('0x6'));var attributes=require(_0x300d('0x7'));module['exports']=function(_0x2301bd,_0x3fb848){return _0x2301bd[_0x300d('0x8')](_0x300d('0x9'),attributes,{'tableName':_0x300d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ca93a,_0x3708ee,_0x51a219){if(_0x4ca93a[_0x300d('0xb')](_0x300d('0xc'))){_0x4ca93a[_0x300d('0xd')]=moment()[_0x300d('0xe')](_0x300d('0xf'));}if(_0x4ca93a[_0x300d('0xb')](_0x300d('0x10'))){_0x4ca93a[_0x300d('0x11')]=moment()[_0x300d('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51a219(null,_0x4ca93a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d7d961b..4adf36f 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 _0xb9b1=['options','attributes','include','map','model','ShowSquareProject','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareProject'];(function(_0x2c4327,_0x65ee60){var _0x3f42ff=function(_0x561108){while(--_0x561108){_0x2c4327['push'](_0x2c4327['shift']());}};_0x3f42ff(++_0x65ee60);}(_0xb9b1,0x15b));var _0x1b9b=function(_0x27243d,_0x260e35){_0x27243d=_0x27243d-0x0;var _0x433c29=_0xb9b1[_0x27243d];return _0x433c29;};'use strict';var _=require('lodash');var util=require(_0x1b9b('0x0'));var moment=require('moment');var BPromise=require(_0x1b9b('0x1'));var rs=require(_0x1b9b('0x2'));var fs=require('fs');var Redis=require(_0x1b9b('0x3'));var db=require(_0x1b9b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b9b('0x5'))(_0x1b9b('0x6'));var config=require('../../config/environment');var jayson=require(_0x1b9b('0x7'));var client=jayson[_0x1b9b('0x8')][_0x1b9b('0x9')]({'port':0x232a});config[_0x1b9b('0xa')]=_['defaults'](config[_0x1b9b('0xa')],{'host':_0x1b9b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1b9b('0xc'))[_0x1b9b('0xd')](socket);function respondWithRpcPromise(_0x1daa85,_0x408509,_0x216cd7){return new BPromise(function(_0x4dce10,_0x29be20){return client[_0x1b9b('0xe')](_0x1daa85,_0x216cd7)[_0x1b9b('0xf')](function(_0x303468){logger[_0x1b9b('0x10')](_0x1b9b('0x11'),_0x408509,_0x1b9b('0x12'));logger['debug'](_0x1b9b('0x13'),_0x408509,_0x1b9b('0x12'),JSON[_0x1b9b('0x14')](_0x303468));if(_0x303468[_0x1b9b('0x15')]){if(_0x303468[_0x1b9b('0x15')][_0x1b9b('0x16')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x408509,_0x303468[_0x1b9b('0x15')][_0x1b9b('0x17')]);return _0x29be20(_0x303468['error'][_0x1b9b('0x17')]);}logger[_0x1b9b('0x15')](_0x1b9b('0x11'),_0x408509,_0x303468[_0x1b9b('0x15')]['message']);return _0x4dce10(_0x303468['error'][_0x1b9b('0x17')]);}else{logger[_0x1b9b('0x10')](_0x1b9b('0x11'),_0x408509,_0x1b9b('0x12'));_0x4dce10(_0x303468[_0x1b9b('0x18')]['message']);}})[_0x1b9b('0x19')](function(_0x49592f){logger[_0x1b9b('0x15')]('SquareProject,\x20%s,\x20%s',_0x408509,_0x49592f);_0x29be20(_0x49592f);});});}exports['ShowSquareProject']=function(_0x425340){var _0x46f603=this;return new Promise(function(_0x12dc38,_0x9f0025){return db[_0x1b9b('0x1a')]['find']({'raw':_0x425340['options']?_0x425340[_0x1b9b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x425340[_0x1b9b('0x1b')]?_0x425340[_0x1b9b('0x1b')]['where']||null:null,'attributes':_0x425340[_0x1b9b('0x1b')]?_0x425340[_0x1b9b('0x1b')][_0x1b9b('0x1c')]||null:null,'include':_0x425340[_0x1b9b('0x1b')]?_0x425340[_0x1b9b('0x1b')][_0x1b9b('0x1d')]?_[_0x1b9b('0x1e')](_0x425340['options']['include'],function(_0x2e90d7){return{'model':db[_0x2e90d7['model']],'as':_0x2e90d7['as'],'attributes':_0x2e90d7[_0x1b9b('0x1c')],'include':_0x2e90d7['include']?_[_0x1b9b('0x1e')](_0x2e90d7[_0x1b9b('0x1d')],function(_0x2cea87){return{'model':db[_0x2cea87[_0x1b9b('0x1f')]],'as':_0x2cea87['as'],'attributes':_0x2cea87['attributes'],'include':_0x2cea87[_0x1b9b('0x1d')]?_[_0x1b9b('0x1e')](_0x2cea87[_0x1b9b('0x1d')],function(_0x3cb3f1){return{'model':db[_0x3cb3f1['model']],'as':_0x3cb3f1['as'],'attributes':_0x3cb3f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b9b('0xf')](function(_0x1c9a3d){logger[_0x1b9b('0x10')](_0x1b9b('0x20'),_0x425340);logger[_0x1b9b('0x21')](_0x1b9b('0x20'),_0x425340,JSON[_0x1b9b('0x14')](_0x1c9a3d));_0x12dc38(_0x1c9a3d);})[_0x1b9b('0x19')](function(_0x1ea424){logger[_0x1b9b('0x15')]('ShowSquareProject',_0x1ea424[_0x1b9b('0x17')],_0x425340);_0x9f0025(_0x46f603[_0x1b9b('0x15')](0x1f4,_0x1ea424['message']));});});}; \ No newline at end of file +var _0x46e6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','SquareProject,\x20%s,\x20%s','message','SquareProject','find','options','where','attributes','include','map','then','ShowSquareProject','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a09ec,_0x5c2326){var _0xc2d313=function(_0x1558b9){while(--_0x1558b9){_0x5a09ec['push'](_0x5a09ec['shift']());}};_0xc2d313(++_0x5c2326);}(_0x46e6,0xe8));var _0x646e=function(_0x13b58a,_0x2c7797){_0x13b58a=_0x13b58a-0x0;var _0x2c8413=_0x46e6[_0x13b58a];return _0x2c8413;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x646e('0x0'));var BPromise=require(_0x646e('0x1'));var rs=require(_0x646e('0x2'));var fs=require('fs');var Redis=require(_0x646e('0x3'));var db=require(_0x646e('0x4'))['db'];var utils=require(_0x646e('0x5'));var logger=require(_0x646e('0x6'))(_0x646e('0x7'));var config=require(_0x646e('0x8'));var jayson=require(_0x646e('0x9'));var client=jayson[_0x646e('0xa')][_0x646e('0xb')]({'port':0x232a});config[_0x646e('0xc')]=_[_0x646e('0xd')](config[_0x646e('0xc')],{'host':_0x646e('0xe'),'port':0x18eb});var socket=require(_0x646e('0xf'))(new Redis(config[_0x646e('0xc')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x1404a6,_0x4b1d82,_0x4da9c2){return new BPromise(function(_0x2c0dbf,_0x5badcd){return client[_0x646e('0x10')](_0x1404a6,_0x4da9c2)['then'](function(_0x2830d2){logger[_0x646e('0x11')]('SquareProject,\x20%s,\x20%s',_0x4b1d82,_0x646e('0x12'));logger['debug'](_0x646e('0x13'),_0x4b1d82,_0x646e('0x12'),JSON['stringify'](_0x2830d2));if(_0x2830d2[_0x646e('0x14')]){if(_0x2830d2[_0x646e('0x14')]['code']===0x1f4){logger[_0x646e('0x14')](_0x646e('0x15'),_0x4b1d82,_0x2830d2[_0x646e('0x14')][_0x646e('0x16')]);return _0x5badcd(_0x2830d2['error']['message']);}logger['error'](_0x646e('0x15'),_0x4b1d82,_0x2830d2[_0x646e('0x14')]['message']);return _0x2c0dbf(_0x2830d2[_0x646e('0x14')]['message']);}else{logger[_0x646e('0x11')](_0x646e('0x15'),_0x4b1d82,'request\x20sent');_0x2c0dbf(_0x2830d2['result'][_0x646e('0x16')]);}})['catch'](function(_0x58ce83){logger[_0x646e('0x14')](_0x646e('0x15'),_0x4b1d82,_0x58ce83);_0x5badcd(_0x58ce83);});});}exports['ShowSquareProject']=function(_0x4344ce){var _0x50dc0d=this;return new Promise(function(_0x3eaca4,_0x5ded21){return db[_0x646e('0x17')][_0x646e('0x18')]({'raw':_0x4344ce[_0x646e('0x19')]?_0x4344ce[_0x646e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4344ce[_0x646e('0x19')]?_0x4344ce['options'][_0x646e('0x1a')]||null:null,'attributes':_0x4344ce[_0x646e('0x19')]?_0x4344ce['options'][_0x646e('0x1b')]||null:null,'include':_0x4344ce[_0x646e('0x19')]?_0x4344ce[_0x646e('0x19')][_0x646e('0x1c')]?_['map'](_0x4344ce[_0x646e('0x19')]['include'],function(_0x51f3b5){return{'model':db[_0x51f3b5['model']],'as':_0x51f3b5['as'],'attributes':_0x51f3b5[_0x646e('0x1b')],'include':_0x51f3b5[_0x646e('0x1c')]?_[_0x646e('0x1d')](_0x51f3b5[_0x646e('0x1c')],function(_0x70d450){return{'model':db[_0x70d450['model']],'as':_0x70d450['as'],'attributes':_0x70d450['attributes'],'include':_0x70d450[_0x646e('0x1c')]?_[_0x646e('0x1d')](_0x70d450['include'],function(_0x49e527){return{'model':db[_0x49e527['model']],'as':_0x49e527['as'],'attributes':_0x49e527['attributes']};}):[]};}):[]};}):[]:[]})[_0x646e('0x1e')](function(_0x2ce187){logger[_0x646e('0x11')](_0x646e('0x1f'),_0x4344ce);logger[_0x646e('0x20')](_0x646e('0x1f'),_0x4344ce,JSON[_0x646e('0x21')](_0x2ce187));_0x3eaca4(_0x2ce187);})['catch'](function(_0x3a12c1){logger[_0x646e('0x14')](_0x646e('0x1f'),_0x3a12c1[_0x646e('0x16')],_0x4344ce);_0x5ded21(_0x50dc0d['error'](0x1f4,_0x3a12c1[_0x646e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 5ba4e21..7c4fa83 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 _0x3003=['length','squareProject:','save','remove','emit','removeListener','register'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x3003,0x160));var _0x3300=function(_0xc25f35,_0x1e0d38){_0xc25f35=_0xc25f35-0x0;var _0x36965f=_0x3003[_0xc25f35];return _0x36965f;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x3300('0x0'),_0x3300('0x1'),'update'];function createListener(_0x20de6c,_0x37cced){return function(_0x439950){_0x37cced[_0x3300('0x2')](_0x20de6c,_0x439950);};}function removeListener(_0x5e37c3,_0x13bc5d){return function(){SquareProjectEvents[_0x3300('0x3')](_0x5e37c3,_0x13bc5d);};}exports[_0x3300('0x4')]=function(_0x6a2d29){for(var _0x1be412=0x0,_0x15b28b=events[_0x3300('0x5')];_0x1be412<_0x15b28b;_0x1be412++){var _0x469394=events[_0x1be412];var _0x41eac4=createListener(_0x3300('0x6')+_0x469394,_0x6a2d29);SquareProjectEvents['on'](_0x469394,_0x41eac4);}}; \ No newline at end of file +var _0x1859=['save','remove','update','removeListener','register','squareProject:','./squareProject.events'];(function(_0x2f9907,_0x53cd09){var _0x3c8199=function(_0x112df7){while(--_0x112df7){_0x2f9907['push'](_0x2f9907['shift']());}};_0x3c8199(++_0x53cd09);}(_0x1859,0x1a3));var _0x9185=function(_0x5b0d2a,_0x30f62c){_0x5b0d2a=_0x5b0d2a-0x0;var _0x15118a=_0x1859[_0x5b0d2a];return _0x15118a;};'use strict';var SquareProjectEvents=require(_0x9185('0x0'));var events=[_0x9185('0x1'),_0x9185('0x2'),_0x9185('0x3')];function createListener(_0x452b66,_0x1379b4){return function(_0x46e2bc){_0x1379b4['emit'](_0x452b66,_0x46e2bc);};}function removeListener(_0x14fe36,_0x226a21){return function(){SquareProjectEvents[_0x9185('0x4')](_0x14fe36,_0x226a21);};}exports[_0x9185('0x5')]=function(_0x3ad10b){for(var _0x1e385b=0x0,_0x1a445c=events['length'];_0x1e385b<_0x1a445c;_0x1e385b++){var _0x4be3c6=events[_0x1e385b];var _0x4a4f33=createListener(_0x9185('0x6')+_0x4be3c6,_0x3ad10b);SquareProjectEvents['on'](_0x4be3c6,_0x4a4f33);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8121cc4..881d0ef 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x2c3bd9,_0x45f815){var _0x112e55=function(_0x22de25){while(--_0x22de25){_0x2c3bd9['push'](_0x2c3bd9['shift']());}};_0x112e55(++_0x45f815);}(_0x326f,0xd1));var _0xf326=function(_0x294dad,_0x5e0d12){_0x294dad=_0x294dad-0x0;var _0x181376=_0x326f[_0x294dad];return _0x181376;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _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(_0x40b37b,_0x112a65){var _0x506cf5=function(_0x24389e){while(--_0x24389e){_0x40b37b['push'](_0x40b37b['shift']());}};_0x506cf5(++_0x112a65);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x5fc3[_0x56138f];return _0x1acaf7;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 34f2aa7..764b2f0 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 _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0xb9d880,_0x5c83f4){var _0x1a9d6f=function(_0x49cfcf){while(--_0x49cfcf){_0xb9d880['push'](_0xb9d880['shift']());}};_0x1a9d6f(++_0x5c83f4);}(_0x326f,0xd1));var _0xf326=function(_0x27f68b,_0x22a578){_0x27f68b=_0x27f68b-0x0;var _0x397247=_0x326f[_0x27f68b];return _0x397247;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','VIRTUAL','savePath','substring','lastIndexOf'];(function(_0x329401,_0x57ebd6){var _0x1b2234=function(_0x1315bf){while(--_0x1315bf){_0x329401['push'](_0x329401['shift']());}};_0x1b2234(++_0x57ebd6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x24ca[_0x1655bb];return _0x5e2020;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'callerid':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'dnid':{'type':Sequelize[_0xa24c('0x1')]},'projectName':{'type':Sequelize[_0xa24c('0x1')]},'saveName':{'type':Sequelize[_0xa24c('0x1')]},'filename':{'type':Sequelize[_0xa24c('0x1')]},'savePath':{'type':Sequelize[_0xa24c('0x1')]},'format':{'type':Sequelize[_0xa24c('0x2')],'get':function(){var _0x257264='';var _0x9a5013=this['getDataValue'](_0xa24c('0x3'));if(_0x9a5013){_0x257264=_0x9a5013[_0xa24c('0x4')](_0x9a5013[_0xa24c('0x5')]('.'));}return _0x257264;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 166b577..b90fcd1 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 _0xb7f2=['sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','download','../../components/encryptor','type','savePath','filename','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','name','index','map','SquareRecording','rawAttributes','query','keys','filters','attributes','model','fields','hasOwnProperty','nolimit','order'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xb7f2,0x86));var _0x2b7f=function(_0x3e1c6f,_0x34cb38){_0x3e1c6f=_0x3e1c6f-0x0;var _0x90256f=_0xb7f2[_0x3e1c6f];return _0x90256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b7f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b7f('0x1'));var rp=require(_0x2b7f('0x2'));var moment=require(_0x2b7f('0x3'));var BPromise=require(_0x2b7f('0x4'));var Mustache=require(_0x2b7f('0x5'));var util=require(_0x2b7f('0x6'));var path=require(_0x2b7f('0x7'));var sox=require(_0x2b7f('0x8'));var csv=require(_0x2b7f('0x9'));var ejs=require(_0x2b7f('0xa'));var fs=require('fs');var fs_extra=require(_0x2b7f('0xb'));var _=require(_0x2b7f('0xc'));var squel=require(_0x2b7f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b7f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b7f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2b7f('0x10'));var as=require(_0x2b7f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b7f('0x12'))(_0x2b7f('0x13'));var utils=require(_0x2b7f('0x14'));var config=require(_0x2b7f('0x15'));var licenseUtil=require(_0x2b7f('0x16'));var db=require(_0x2b7f('0x17'))['db'];function respondWithStatusCode(_0x27173f,_0x2f395d){_0x2f395d=_0x2f395d||0xcc;return function(_0xd56f70){if(_0xd56f70){return _0x27173f[_0x2b7f('0x18')](_0x2f395d);}return _0x27173f[_0x2b7f('0x19')](_0x2f395d)[_0x2b7f('0x1a')]();};}function respondWithResult(_0x2b82cc,_0x5ce67b){_0x5ce67b=_0x5ce67b||0xc8;return function(_0x2ed76f){if(_0x2ed76f){return _0x2b82cc[_0x2b7f('0x19')](_0x5ce67b)['json'](_0x2ed76f);}};}function respondWithFilteredResult(_0xc3db47,_0x317d06){return function(_0xcb3616){if(_0xcb3616){var _0x4ace77=typeof _0x317d06['offset']===_0x2b7f('0x1b')&&typeof _0x317d06[_0x2b7f('0x1c')]===_0x2b7f('0x1b');var _0x42869e=_0xcb3616[_0x2b7f('0x1d')];var _0x3bd5c3=_0x4ace77?0x0:_0x317d06['offset'];var _0x1b2835=_0x4ace77?_0xcb3616['count']:_0x317d06[_0x2b7f('0x1e')]+_0x317d06[_0x2b7f('0x1c')];var _0x21d692;if(_0x1b2835>=_0x42869e){_0x1b2835=_0x42869e;_0x21d692=0xc8;}else{_0x21d692=0xce;}_0xc3db47[_0x2b7f('0x19')](_0x21d692);return _0xc3db47[_0x2b7f('0x1f')](_0x2b7f('0x20'),_0x3bd5c3+'-'+_0x1b2835+'/'+_0x42869e)[_0x2b7f('0x21')](_0xcb3616);}return null;};}function patchUpdates(_0x430fd8){return function(_0x481c53){try{jsonpatch[_0x2b7f('0x22')](_0x481c53,_0x430fd8,!![]);}catch(_0x2da3e9){return BPromise['reject'](_0x2da3e9);}return _0x481c53[_0x2b7f('0x23')]();};}function saveUpdates(_0x3f2c50,_0x2de975){return function(_0x5f9774){if(_0x5f9774){return _0x5f9774[_0x2b7f('0x24')](_0x3f2c50)[_0x2b7f('0x25')](function(_0x8b3e51){return _0x8b3e51;});}return null;};}function removeEntity(_0x5a99cc,_0x2d715c){return function(_0x50cf4d){if(_0x50cf4d){return _0x50cf4d[_0x2b7f('0x26')]()[_0x2b7f('0x25')](function(){_0x5a99cc[_0x2b7f('0x19')](0xcc)[_0x2b7f('0x1a')]();});}};}function handleEntityNotFound(_0x2f8b43,_0x45b8a4){return function(_0x16b597){if(!_0x16b597){_0x2f8b43[_0x2b7f('0x18')](0x194);}return _0x16b597;};}function handleError(_0x2d318b,_0xf34fc1){_0xf34fc1=_0xf34fc1||0x1f4;return function(_0x45a88e){logger[_0x2b7f('0x27')](_0x45a88e['stack']);if(_0x45a88e[_0x2b7f('0x28')]){delete _0x45a88e[_0x2b7f('0x28')];}_0x2d318b['status'](_0xf34fc1)['send'](_0x45a88e);};}exports[_0x2b7f('0x29')]=function(_0x4e4f02,_0xaab532){var _0x28862e={},_0x32545c={},_0x237010={'count':0x0,'rows':[]};var _0x2851e9=_[_0x2b7f('0x2a')](db[_0x2b7f('0x2b')][_0x2b7f('0x2c')],function(_0x2ceaac){return{'name':_0x2ceaac['fieldName'],'type':_0x2ceaac['type']['key']};});_0x32545c['model']=_[_0x2b7f('0x2a')](_0x2851e9,_0x2b7f('0x28'));_0x32545c[_0x2b7f('0x2d')]=_[_0x2b7f('0x2e')](_0x4e4f02['query']);_0x32545c[_0x2b7f('0x2f')]=_['intersection'](_0x32545c['model'],_0x32545c[_0x2b7f('0x2d')]);_0x28862e[_0x2b7f('0x30')]=_['intersection'](_0x32545c[_0x2b7f('0x31')],qs[_0x2b7f('0x32')](_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x32')]));_0x28862e[_0x2b7f('0x30')]=_0x28862e[_0x2b7f('0x30')]['length']?_0x28862e[_0x2b7f('0x30')]:_0x32545c[_0x2b7f('0x31')];if(!_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x33')](_0x2b7f('0x34'))){_0x28862e[_0x2b7f('0x1c')]=qs[_0x2b7f('0x1c')](_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x1c')]);_0x28862e[_0x2b7f('0x1e')]=qs[_0x2b7f('0x1e')](_0x4e4f02[_0x2b7f('0x2d')]['offset']);}_0x28862e[_0x2b7f('0x35')]=qs[_0x2b7f('0x36')](_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x36')]);_0x28862e['where']=qs[_0x2b7f('0x2f')](_[_0x2b7f('0x37')](_0x4e4f02['query'],_0x32545c[_0x2b7f('0x2f')]),_0x2851e9);if(_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x38')]){_0x28862e[_0x2b7f('0x39')]=_[_0x2b7f('0x3a')](_0x28862e[_0x2b7f('0x39')],{'$or':_['map'](_0x2851e9,function(_0x12601b){if(_0x12601b['type']!==_0x2b7f('0x3b')){var _0x249c06={};_0x249c06[_0x12601b[_0x2b7f('0x28')]]={'$like':'%'+_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x38')]+'%'};return _0x249c06;}})});}_0x28862e=_[_0x2b7f('0x3a')]({},_0x28862e,_0x4e4f02[_0x2b7f('0x3c')]);var _0x171ec3={'where':_0x28862e[_0x2b7f('0x39')]};return db[_0x2b7f('0x2b')][_0x2b7f('0x1d')](_0x171ec3)['then'](function(_0x5d8a6b){_0x237010[_0x2b7f('0x1d')]=_0x5d8a6b;if(_0x4e4f02[_0x2b7f('0x2d')][_0x2b7f('0x3d')]){_0x28862e['include']=[{'all':!![]}];}return db[_0x2b7f('0x2b')][_0x2b7f('0x3e')](_0x28862e);})['then'](function(_0x324040){_0x237010[_0x2b7f('0x3f')]=_0x324040;return _0x237010;})[_0x2b7f('0x25')](respondWithFilteredResult(_0xaab532,_0x28862e))[_0x2b7f('0x40')](handleError(_0xaab532,null));};exports[_0x2b7f('0x41')]=function(_0x4bf146,_0x3586d4){var _0x952fae={'raw':!![],'where':{'id':_0x4bf146[_0x2b7f('0x42')]['id']}},_0x25b89d={};_0x25b89d['model']=_[_0x2b7f('0x2e')](db[_0x2b7f('0x2b')][_0x2b7f('0x2c')]);_0x25b89d[_0x2b7f('0x2d')]=_[_0x2b7f('0x2e')](_0x4bf146[_0x2b7f('0x2d')]);_0x25b89d[_0x2b7f('0x2f')]=_[_0x2b7f('0x43')](_0x25b89d['model'],_0x25b89d[_0x2b7f('0x2d')]);_0x952fae[_0x2b7f('0x30')]=_[_0x2b7f('0x43')](_0x25b89d[_0x2b7f('0x31')],qs['fields'](_0x4bf146[_0x2b7f('0x2d')][_0x2b7f('0x32')]));_0x952fae[_0x2b7f('0x30')]=_0x952fae[_0x2b7f('0x30')]['length']?_0x952fae[_0x2b7f('0x30')]:_0x25b89d[_0x2b7f('0x31')];if(_0x4bf146['query'][_0x2b7f('0x3d')]){_0x952fae[_0x2b7f('0x44')]=[{'all':!![]}];}_0x952fae=_[_0x2b7f('0x3a')]({},_0x952fae,_0x4bf146[_0x2b7f('0x3c')]);return db[_0x2b7f('0x2b')][_0x2b7f('0x45')](_0x952fae)[_0x2b7f('0x25')](handleEntityNotFound(_0x3586d4,null))['then'](respondWithResult(_0x3586d4,null))[_0x2b7f('0x40')](handleError(_0x3586d4,null));};exports[_0x2b7f('0x46')]=function(_0x3b9452,_0x1aaf21){return db[_0x2b7f('0x2b')][_0x2b7f('0x46')](_0x3b9452['body'],{})[_0x2b7f('0x25')](respondWithResult(_0x1aaf21,0xc9))[_0x2b7f('0x40')](handleError(_0x1aaf21,null));};exports[_0x2b7f('0x24')]=function(_0x136171,_0x1a0ed5){if(_0x136171[_0x2b7f('0x47')]['id']){delete _0x136171[_0x2b7f('0x47')]['id'];}return db[_0x2b7f('0x2b')][_0x2b7f('0x45')]({'where':{'id':_0x136171[_0x2b7f('0x42')]['id']}})[_0x2b7f('0x25')](handleEntityNotFound(_0x1a0ed5,null))['then'](saveUpdates(_0x136171['body'],null))[_0x2b7f('0x25')](respondWithResult(_0x1a0ed5,null))[_0x2b7f('0x40')](handleError(_0x1a0ed5,null));};exports[_0x2b7f('0x48')]=function(_0x1b595e,_0xd15dda,_0x28f000){var _0x2daea7=require(_0x2b7f('0x49'));var _0x37fc37=![];var _0x18c1ff={};if(_0x1b595e[_0x2b7f('0x2d')][_0x2b7f('0x4a')]&&_0x1b595e['query'][_0x2b7f('0x4a')]==='uniqueid'){_0x18c1ff['uniqueid']=_0x1b595e[_0x2b7f('0x42')]['id'];}else{_0x18c1ff['id']=_0x1b595e[_0x2b7f('0x42')]['id'];}return db[_0x2b7f('0x2b')][_0x2b7f('0x45')]({'where':_0x18c1ff,'attributes':['id',_0x2b7f('0x4b'),_0x2b7f('0x4c')],'raw':!![]})[_0x2b7f('0x25')](handleEntityNotFound(_0xd15dda,null))[_0x2b7f('0x25')](function(_0x474ef6){if(_0x474ef6){var _0x5675a8=_0x474ef6['savePath'];var _0x1e7f29=util['format']('%s.cypher',_0x5675a8);if(fs[_0x2b7f('0x4d')](_0x1e7f29)){_0x37fc37=!![];return _0x2daea7['decryptFile'](_0x1e7f29,_0x5675a8,config[_0x2b7f('0x4e')][_0x2b7f('0x4f')])[_0x2b7f('0x25')](function(){return _0x474ef6;});}return _0x474ef6;}})['then'](function(_0x280aed){if(_0x280aed){var _0x2c366a=_0x280aed[_0x2b7f('0x4b')];if(!fs[_0x2b7f('0x4d')](_0x2c366a)){throw new db[(_0x2b7f('0x50'))][(_0x2b7f('0x51'))](_0x2b7f('0x52'));}if(_0x280aed[_0x2b7f('0x4c')]){return _0xd15dda['download'](_0x2c366a,_0x280aed['filename']+path[_0x2b7f('0x53')](_0x2c366a),function(){if(_0x37fc37){fs[_0x2b7f('0x54')](_0x2c366a);}});}else{return _0xd15dda[_0x2b7f('0x48')](_0x2c366a,function(_0x23ddcd){if(_0x37fc37){fs[_0x2b7f('0x54')](_0x2c366a);}});}}})[_0x2b7f('0x40')](function(_0x149ccb){if(_0x149ccb[_0x2b7f('0x55')]===_0x2b7f('0x52')){_0xd15dda[_0x2b7f('0x19')](0x194)['send'](_0x2b7f('0x56'));}else{return handleError(_0xd15dda,null);}});};exports[_0x2b7f('0x26')]=function(_0x296785,_0x1f43f8){return db[_0x2b7f('0x2b')]['find']({'where':{'id':_0x296785[_0x2b7f('0x42')]['id']}})[_0x2b7f('0x25')](function(_0x388c27){if(_[_0x2b7f('0x57')](_0x388c27)){throw new ReferenceError(_0x2b7f('0x58'));}return _0x388c27;})['then'](function(_0x253759){var _0x1d6293=_0x253759[_0x2b7f('0x4b')];logger[_0x2b7f('0x59')](_0x2b7f('0x5a'),_0x1d6293);if(!_[_0x2b7f('0x57')](_0x253759[_0x2b7f('0x4b')])&&fs[_0x2b7f('0x4d')](_0x1d6293)){logger['info'](_0x2b7f('0x5b')+_0x1d6293+_0x2b7f('0x5c'));fs['unlinkSync'](_0x1d6293);}_0x1d6293=_0x1d6293+_0x2b7f('0x5d');if(!_[_0x2b7f('0x57')](_0x253759[_0x2b7f('0x4b')])&&fs[_0x2b7f('0x4d')](_0x1d6293)){logger['info'](_0x2b7f('0x5b')+_0x1d6293+_0x2b7f('0x5c'));fs['unlinkSync'](_0x1d6293);}return _0x253759;})[_0x2b7f('0x25')](function(_0x2f0b79){if(!_0x2f0b79)throw new InternalError();return _0x2f0b79[_0x2b7f('0x26')]();})['then'](function(){_0x1f43f8[_0x2b7f('0x19')](0xcc)[_0x2b7f('0x1a')]();})[_0x2b7f('0x40')](handleError(_0x1f43f8,null));}; \ No newline at end of file +var _0x0093=['util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','SquareRecording','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x0093,0xbd));var _0x3009=function(_0x1ad7b4,_0x2de020){_0x1ad7b4=_0x1ad7b4-0x0;var _0x38f39a=_0x0093[_0x1ad7b4];return _0x38f39a;};'use strict';var emlformat=require(_0x3009('0x0'));var rimraf=require(_0x3009('0x1'));var zipdir=require(_0x3009('0x2'));var jsonpatch=require(_0x3009('0x3'));var rp=require(_0x3009('0x4'));var moment=require(_0x3009('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3009('0x6'));var util=require(_0x3009('0x7'));var path=require('path');var sox=require(_0x3009('0x8'));var csv=require(_0x3009('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3009('0xa'));var _=require(_0x3009('0xb'));var squel=require(_0x3009('0xc'));var crypto=require('crypto');var jsforce=require(_0x3009('0xd'));var deskjs=require(_0x3009('0xe'));var toCsv=require(_0x3009('0x9'));var querystring=require(_0x3009('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3009('0x10'));var qs=require(_0x3009('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3009('0x12'));var logger=require(_0x3009('0x13'))(_0x3009('0x14'));var utils=require('../../config/utils');var config=require(_0x3009('0x15'));var licenseUtil=require(_0x3009('0x16'));var db=require(_0x3009('0x17'))['db'];function respondWithStatusCode(_0x11f10c,_0x446ebc){_0x446ebc=_0x446ebc||0xcc;return function(_0x1ed66d){if(_0x1ed66d){return _0x11f10c['sendStatus'](_0x446ebc);}return _0x11f10c['status'](_0x446ebc)[_0x3009('0x18')]();};}function respondWithResult(_0x9c4d19,_0x2de876){_0x2de876=_0x2de876||0xc8;return function(_0x4c0d81){if(_0x4c0d81){return _0x9c4d19[_0x3009('0x19')](_0x2de876)['json'](_0x4c0d81);}};}function respondWithFilteredResult(_0x5bfd98,_0x445195){return function(_0x491469){if(_0x491469){var _0x23a08d=typeof _0x445195[_0x3009('0x1a')]==='undefined'&&typeof _0x445195[_0x3009('0x1b')]===_0x3009('0x1c');var _0x35538b=_0x491469['count'];var _0x3d37f5=_0x23a08d?0x0:_0x445195[_0x3009('0x1a')];var _0x57f03f=_0x23a08d?_0x491469[_0x3009('0x1d')]:_0x445195[_0x3009('0x1a')]+_0x445195[_0x3009('0x1b')];var _0x37096a;if(_0x57f03f>=_0x35538b){_0x57f03f=_0x35538b;_0x37096a=0xc8;}else{_0x37096a=0xce;}_0x5bfd98[_0x3009('0x19')](_0x37096a);return _0x5bfd98[_0x3009('0x1e')]('Content-Range',_0x3d37f5+'-'+_0x57f03f+'/'+_0x35538b)['json'](_0x491469);}return null;};}function patchUpdates(_0x46424){return function(_0x750c75){try{jsonpatch[_0x3009('0x1f')](_0x750c75,_0x46424,!![]);}catch(_0x5703a9){return BPromise[_0x3009('0x20')](_0x5703a9);}return _0x750c75['save']();};}function saveUpdates(_0x31e3f8,_0x34d793){return function(_0x151232){if(_0x151232){return _0x151232[_0x3009('0x21')](_0x31e3f8)[_0x3009('0x22')](function(_0x5e504d){return _0x5e504d;});}return null;};}function removeEntity(_0x413ccc,_0x22d910){return function(_0x2a973c){if(_0x2a973c){return _0x2a973c[_0x3009('0x23')]()[_0x3009('0x22')](function(){_0x413ccc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1ce74,_0x5cf33d){return function(_0x3cb0ee){if(!_0x3cb0ee){_0xd1ce74[_0x3009('0x24')](0x194);}return _0x3cb0ee;};}function handleError(_0x23a8a7,_0x226b7c){_0x226b7c=_0x226b7c||0x1f4;return function(_0x1c5780){logger[_0x3009('0x25')](_0x1c5780[_0x3009('0x26')]);if(_0x1c5780[_0x3009('0x27')]){delete _0x1c5780[_0x3009('0x27')];}_0x23a8a7[_0x3009('0x19')](_0x226b7c)['send'](_0x1c5780);};}exports[_0x3009('0x28')]=function(_0xadf226,_0x50915f){var _0x3ee1f1={},_0x19da16={},_0x247964={'count':0x0,'rows':[]};var _0x5bcd3b=_['map'](db[_0x3009('0x29')][_0x3009('0x2a')],function(_0x30e6c4){return{'name':_0x30e6c4[_0x3009('0x2b')],'type':_0x30e6c4[_0x3009('0x2c')][_0x3009('0x2d')]};});_0x19da16['model']=_[_0x3009('0x2e')](_0x5bcd3b,_0x3009('0x27'));_0x19da16['query']=_[_0x3009('0x2f')](_0xadf226['query']);_0x19da16[_0x3009('0x30')]=_[_0x3009('0x31')](_0x19da16[_0x3009('0x32')],_0x19da16['query']);_0x3ee1f1['attributes']=_[_0x3009('0x31')](_0x19da16[_0x3009('0x32')],qs['fields'](_0xadf226[_0x3009('0x33')][_0x3009('0x34')]));_0x3ee1f1['attributes']=_0x3ee1f1[_0x3009('0x35')]['length']?_0x3ee1f1[_0x3009('0x35')]:_0x19da16[_0x3009('0x32')];if(!_0xadf226[_0x3009('0x33')][_0x3009('0x36')]('nolimit')){_0x3ee1f1[_0x3009('0x1b')]=qs['limit'](_0xadf226['query'][_0x3009('0x1b')]);_0x3ee1f1['offset']=qs[_0x3009('0x1a')](_0xadf226[_0x3009('0x33')][_0x3009('0x1a')]);}_0x3ee1f1[_0x3009('0x37')]=qs[_0x3009('0x38')](_0xadf226['query'][_0x3009('0x38')]);_0x3ee1f1[_0x3009('0x39')]=qs[_0x3009('0x30')](_[_0x3009('0x3a')](_0xadf226['query'],_0x19da16[_0x3009('0x30')]),_0x5bcd3b);if(_0xadf226[_0x3009('0x33')][_0x3009('0x3b')]){_0x3ee1f1['where']=_[_0x3009('0x3c')](_0x3ee1f1[_0x3009('0x39')],{'$or':_[_0x3009('0x2e')](_0x5bcd3b,function(_0xb06a85){if(_0xb06a85[_0x3009('0x2c')]!==_0x3009('0x3d')){var _0x32f6ef={};_0x32f6ef[_0xb06a85[_0x3009('0x27')]]={'$like':'%'+_0xadf226[_0x3009('0x33')][_0x3009('0x3b')]+'%'};return _0x32f6ef;}})});}_0x3ee1f1=_[_0x3009('0x3c')]({},_0x3ee1f1,_0xadf226[_0x3009('0x3e')]);var _0x459932={'where':_0x3ee1f1[_0x3009('0x39')]};return db['SquareRecording'][_0x3009('0x1d')](_0x459932)[_0x3009('0x22')](function(_0x2d539c){_0x247964[_0x3009('0x1d')]=_0x2d539c;if(_0xadf226[_0x3009('0x33')][_0x3009('0x3f')]){_0x3ee1f1[_0x3009('0x40')]=[{'all':!![]}];}return db['SquareRecording'][_0x3009('0x41')](_0x3ee1f1);})[_0x3009('0x22')](function(_0x1bd214){_0x247964[_0x3009('0x42')]=_0x1bd214;return _0x247964;})[_0x3009('0x22')](respondWithFilteredResult(_0x50915f,_0x3ee1f1))['catch'](handleError(_0x50915f,null));};exports[_0x3009('0x43')]=function(_0x148859,_0x1cb314){var _0x1d635a={'raw':!![],'where':{'id':_0x148859[_0x3009('0x44')]['id']}},_0x248557={};_0x248557['model']=_['keys'](db['SquareRecording']['rawAttributes']);_0x248557[_0x3009('0x33')]=_[_0x3009('0x2f')](_0x148859['query']);_0x248557[_0x3009('0x30')]=_['intersection'](_0x248557['model'],_0x248557['query']);_0x1d635a['attributes']=_[_0x3009('0x31')](_0x248557[_0x3009('0x32')],qs[_0x3009('0x34')](_0x148859[_0x3009('0x33')]['fields']));_0x1d635a[_0x3009('0x35')]=_0x1d635a[_0x3009('0x35')]['length']?_0x1d635a[_0x3009('0x35')]:_0x248557[_0x3009('0x32')];if(_0x148859[_0x3009('0x33')][_0x3009('0x3f')]){_0x1d635a[_0x3009('0x40')]=[{'all':!![]}];}_0x1d635a=_[_0x3009('0x3c')]({},_0x1d635a,_0x148859[_0x3009('0x3e')]);return db[_0x3009('0x29')][_0x3009('0x45')](_0x1d635a)['then'](handleEntityNotFound(_0x1cb314,null))[_0x3009('0x22')](respondWithResult(_0x1cb314,null))[_0x3009('0x46')](handleError(_0x1cb314,null));};exports['create']=function(_0x59fa19,_0x29b8ed){return db['SquareRecording'][_0x3009('0x47')](_0x59fa19['body'],{})['then'](respondWithResult(_0x29b8ed,0xc9))[_0x3009('0x46')](handleError(_0x29b8ed,null));};exports[_0x3009('0x21')]=function(_0x25e2b8,_0x1cfe10){if(_0x25e2b8[_0x3009('0x48')]['id']){delete _0x25e2b8[_0x3009('0x48')]['id'];}return db[_0x3009('0x29')][_0x3009('0x45')]({'where':{'id':_0x25e2b8[_0x3009('0x44')]['id']}})[_0x3009('0x22')](handleEntityNotFound(_0x1cfe10,null))[_0x3009('0x22')](saveUpdates(_0x25e2b8[_0x3009('0x48')],null))[_0x3009('0x22')](respondWithResult(_0x1cfe10,null))[_0x3009('0x46')](handleError(_0x1cfe10,null));};exports['download']=function(_0xb5f7e1,_0x12eb03,_0x2d3156){var _0x315379=require(_0x3009('0x49'));var _0x376f95=![];var _0x24d0d5={};if(_0xb5f7e1[_0x3009('0x33')][_0x3009('0x2c')]&&_0xb5f7e1[_0x3009('0x33')]['type']==='uniqueid'){_0x24d0d5[_0x3009('0x4a')]=_0xb5f7e1[_0x3009('0x44')]['id'];}else{_0x24d0d5['id']=_0xb5f7e1[_0x3009('0x44')]['id'];}return db[_0x3009('0x29')][_0x3009('0x45')]({'where':_0x24d0d5,'attributes':['id',_0x3009('0x4b'),_0x3009('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x12eb03,null))[_0x3009('0x22')](function(_0x149aaa){if(_0x149aaa){var _0x118db9=_0x149aaa['savePath'];var _0x3bd39d=util['format'](_0x3009('0x4d'),_0x118db9);if(fs['existsSync'](_0x3bd39d)){_0x376f95=!![];return _0x315379[_0x3009('0x4e')](_0x3bd39d,_0x118db9,config[_0x3009('0x4f')][_0x3009('0x50')])['then'](function(){return _0x149aaa;});}return _0x149aaa;}})[_0x3009('0x22')](function(_0x32c84d){if(_0x32c84d){var _0x1165aa=_0x32c84d[_0x3009('0x4b')];if(!fs[_0x3009('0x51')](_0x1165aa)){throw new db[(_0x3009('0x52'))][(_0x3009('0x53'))](_0x3009('0x54'));}if(_0x32c84d[_0x3009('0x4c')]){return _0x12eb03[_0x3009('0x55')](_0x1165aa,_0x32c84d[_0x3009('0x4c')]+path[_0x3009('0x56')](_0x1165aa),function(){if(_0x376f95){fs[_0x3009('0x57')](_0x1165aa);}});}else{return _0x12eb03['download'](_0x1165aa,function(_0x5528d8){if(_0x376f95){fs[_0x3009('0x57')](_0x1165aa);}});}}})[_0x3009('0x46')](function(_0x2183a4){if(_0x2183a4[_0x3009('0x58')]==='SquareRecording\x20not\x20found'){_0x12eb03['status'](0x194)[_0x3009('0x59')](_0x3009('0x5a'));}else{return handleError(_0x12eb03,null);}});};exports[_0x3009('0x23')]=function(_0x36a01c,_0xce6d80){return db[_0x3009('0x29')][_0x3009('0x45')]({'where':{'id':_0x36a01c['params']['id']}})[_0x3009('0x22')](function(_0x5c861b){if(_[_0x3009('0x5b')](_0x5c861b)){throw new ReferenceError(_0x3009('0x5c'));}return _0x5c861b;})['then'](function(_0x477e58){var _0x87e879=_0x477e58[_0x3009('0x4b')];logger[_0x3009('0x5d')](_0x3009('0x5e'),_0x87e879);if(!_[_0x3009('0x5b')](_0x477e58[_0x3009('0x4b')])&&fs[_0x3009('0x51')](_0x87e879)){logger[_0x3009('0x5d')](_0x3009('0x5f')+_0x87e879+_0x3009('0x60'));fs['unlinkSync'](_0x87e879);}_0x87e879=_0x87e879+'.cypher';if(!_[_0x3009('0x5b')](_0x477e58[_0x3009('0x4b')])&&fs[_0x3009('0x51')](_0x87e879)){logger[_0x3009('0x5d')](_0x3009('0x5f')+_0x87e879+_0x3009('0x60'));fs[_0x3009('0x61')](_0x87e879);}return _0x477e58;})[_0x3009('0x22')](function(_0x4a42ef){if(!_0x4a42ef)throw new InternalError();return _0x4a42ef['destroy']();})[_0x3009('0x22')](function(){_0xce6d80[_0x3009('0x19')](0xcc)[_0x3009('0x18')]();})[_0x3009('0x46')](handleError(_0xce6d80,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a407b11..aa0e045 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 _0x539d=['../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x539d,0x17b));var _0xd539=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x539d[_0x33e4a7];return _0x598620;};'use strict';var _=require(_0xd539('0x0'));var util=require('util');var logger=require(_0xd539('0x1'))(_0xd539('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd539('0x3'));var fs=require('fs');var path=require(_0xd539('0x4'));var rimraf=require(_0xd539('0x5'));var config=require(_0xd539('0x6'));var attributes=require(_0xd539('0x7'));module['exports']=function(_0x341dd4,_0x158719){return _0x341dd4[_0xd539('0x8')](_0xd539('0x9'),attributes,{'tableName':_0xd539('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0324=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings'];(function(_0x7a96df,_0x46e119){var _0x1ac00b=function(_0x5532a2){while(--_0x5532a2){_0x7a96df['push'](_0x7a96df['shift']());}};_0x1ac00b(++_0x46e119);}(_0x0324,0x90));var _0x4032=function(_0xb5d344,_0x137c56){_0xb5d344=_0xb5d344-0x0;var _0x4546ff=_0x0324[_0xb5d344];return _0x4546ff;};'use strict';var _=require('lodash');var util=require(_0x4032('0x0'));var logger=require(_0x4032('0x1'))(_0x4032('0x2'));var moment=require(_0x4032('0x3'));var BPromise=require(_0x4032('0x4'));var rp=require(_0x4032('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4032('0x6'));var config=require(_0x4032('0x7'));var attributes=require(_0x4032('0x8'));module[_0x4032('0x9')]=function(_0x77ac4c,_0xa41e9c){return _0x77ac4c['define'](_0x4032('0xa'),attributes,{'tableName':_0x4032('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 c2cbedf..a0b32f0 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 _0x1118=['body','options','then','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','SquareRecording','create'];(function(_0x40a770,_0x3f5e68){var _0x2d24b9=function(_0x3c9833){while(--_0x3c9833){_0x40a770['push'](_0x40a770['shift']());}};_0x2d24b9(++_0x3f5e68);}(_0x1118,0xac));var _0x8111=function(_0x7f44a9,_0x42cf08){_0x7f44a9=_0x7f44a9-0x0;var _0x527a99=_0x1118[_0x7f44a9];return _0x527a99;};'use strict';var _=require(_0x8111('0x0'));var util=require(_0x8111('0x1'));var moment=require(_0x8111('0x2'));var BPromise=require(_0x8111('0x3'));var rs=require(_0x8111('0x4'));var fs=require('fs');var Redis=require(_0x8111('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8111('0x6'))('rpc');var config=require(_0x8111('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8111('0x8')][_0x8111('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x185cf9,_0x225e2d,_0x15ebb3){return new BPromise(function(_0x94dbe1,_0x46efdc){return client[_0x8111('0xa')](_0x185cf9,_0x15ebb3)['then'](function(_0x59abeb){logger['info'](_0x8111('0xb'),_0x225e2d,_0x8111('0xc'));logger[_0x8111('0xd')](_0x8111('0xe'),_0x225e2d,_0x8111('0xc'),JSON[_0x8111('0xf')](_0x59abeb));if(_0x59abeb['error']){if(_0x59abeb['error'][_0x8111('0x10')]===0x1f4){logger[_0x8111('0x11')]('SquareRecording,\x20%s,\x20%s',_0x225e2d,_0x59abeb[_0x8111('0x11')][_0x8111('0x12')]);return _0x46efdc(_0x59abeb[_0x8111('0x11')]['message']);}logger['error'](_0x8111('0xb'),_0x225e2d,_0x59abeb[_0x8111('0x11')]['message']);return _0x94dbe1(_0x59abeb[_0x8111('0x11')]['message']);}else{logger[_0x8111('0x13')](_0x8111('0xb'),_0x225e2d,_0x8111('0xc'));_0x94dbe1(_0x59abeb[_0x8111('0x14')]['message']);}})[_0x8111('0x15')](function(_0x2f0fe3){logger[_0x8111('0x11')](_0x8111('0xb'),_0x225e2d,_0x2f0fe3);_0x46efdc(_0x2f0fe3);});});}exports['CreateSquareRecording']=function(_0xa5f2f6){var _0x265b60=this;return new Promise(function(_0x58fe42,_0x442072){return db[_0x8111('0x16')][_0x8111('0x17')](_0xa5f2f6[_0x8111('0x18')],{'raw':_0xa5f2f6[_0x8111('0x19')]?_0xa5f2f6[_0x8111('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8111('0x1a')](function(_0x28c485){logger[_0x8111('0x13')]('CreateSquareRecording',_0xa5f2f6);logger[_0x8111('0xd')](_0x8111('0x1b'),_0xa5f2f6,JSON[_0x8111('0xf')](_0x28c485));_0x58fe42(_0x28c485);})[_0x8111('0x15')](function(_0x3be853){logger['error'](_0x8111('0x1b'),_0x3be853[_0x8111('0x12')],_0xa5f2f6);_0x442072(_0x265b60[_0x8111('0x11')](0x1f4,_0x3be853[_0x8111('0x12')]));});});}; \ No newline at end of file +var _0x7b84=['client','http','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7b84,0x17e));var _0x47b8=function(_0x246ef8,_0x384888){_0x246ef8=_0x246ef8-0x0;var _0x365dc5=_0x7b84[_0x246ef8];return _0x365dc5;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))('rpc');var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e508,_0x4ed529,_0x1f48a1){return new BPromise(function(_0x482441,_0x30d514){return client['request'](_0x37e508,_0x1f48a1)[_0x47b8('0xc')](function(_0x3884cd){logger[_0x47b8('0xd')]('SquareRecording,\x20%s,\x20%s',_0x4ed529,_0x47b8('0xe'));logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x4ed529,_0x47b8('0xe'),JSON['stringify'](_0x3884cd));if(_0x3884cd[_0x47b8('0x11')]){if(_0x3884cd[_0x47b8('0x11')]['code']===0x1f4){logger['error'](_0x47b8('0x12'),_0x4ed529,_0x3884cd[_0x47b8('0x11')][_0x47b8('0x13')]);return _0x30d514(_0x3884cd[_0x47b8('0x11')][_0x47b8('0x13')]);}logger['error'](_0x47b8('0x12'),_0x4ed529,_0x3884cd[_0x47b8('0x11')]['message']);return _0x482441(_0x3884cd['error'][_0x47b8('0x13')]);}else{logger[_0x47b8('0xd')]('SquareRecording,\x20%s,\x20%s',_0x4ed529,'request\x20sent');_0x482441(_0x3884cd[_0x47b8('0x14')][_0x47b8('0x13')]);}})[_0x47b8('0x15')](function(_0x3ee700){logger[_0x47b8('0x11')]('SquareRecording,\x20%s,\x20%s',_0x4ed529,_0x3ee700);_0x30d514(_0x3ee700);});});}exports[_0x47b8('0x16')]=function(_0x2b1d07){var _0x5c7b84=this;return new Promise(function(_0x3c1839,_0x54a3f2){return db[_0x47b8('0x17')][_0x47b8('0x18')](_0x2b1d07[_0x47b8('0x19')],{'raw':_0x2b1d07['options']?_0x2b1d07[_0x47b8('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x47b8('0xc')](function(_0x34cdc7){logger['info']('CreateSquareRecording',_0x2b1d07);logger[_0x47b8('0xf')](_0x47b8('0x16'),_0x2b1d07,JSON[_0x47b8('0x1b')](_0x34cdc7));_0x3c1839(_0x34cdc7);})[_0x47b8('0x15')](function(_0x4b5172){logger[_0x47b8('0x11')](_0x47b8('0x16'),_0x4b5172['message'],_0x2b1d07);_0x54a3f2(_0x5c7b84[_0x47b8('0x11')](0x1f4,_0x4b5172[_0x47b8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index aba0a14..6c9389e 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xf970ab,_0x354f4d){var _0x53b870=function(_0x54d075){while(--_0x54d075){_0xf970ab['push'](_0xf970ab['shift']());}};_0x53b870(++_0x354f4d);}(_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['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x54e335,_0x6b782d){var _0x5be44a=function(_0x599a0e){while(--_0x599a0e){_0x54e335['push'](_0x54e335['shift']());}};_0x5be44a(++_0x6b782d);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 9880a0d..2ee068d 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 _0xae41=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae41,0xaf));var _0x1ae4=function(_0x9c04a,_0x5522c5){_0x9c04a=_0x9c04a-0x0;var _0x2a0c90=_0xae41[_0x9c04a];return _0x2a0c90;};'use strict';var Sequelize=require(_0x1ae4('0x0'));module[_0x1ae4('0x1')]={'network':{'type':Sequelize[_0x1ae4('0x2')]},'network_script':{'type':Sequelize[_0x1ae4('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1ae4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x1ae4('0x2')]},'callerid':{'type':Sequelize[_0x1ae4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x1ae4('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x1ae4('0x2')]},'callingtns':{'type':Sequelize[_0x1ae4('0x2')]},'dnid':{'type':Sequelize[_0x1ae4('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1ae4('0x2')]},'extension':{'type':Sequelize[_0x1ae4('0x2')]},'priority':{'type':Sequelize[_0x1ae4('0x2')]},'enhanced':{'type':Sequelize[_0x1ae4('0x2')]},'accountcode':{'type':Sequelize[_0x1ae4('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x1ae4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8a74=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x8a74,0x90));var _0x48a7=function(_0x20b8d8,_0x548b25){_0x20b8d8=_0x20b8d8-0x0;var _0x481aef=_0x8a74[_0x20b8d8];return _0x481aef;};'use strict';var Sequelize=require(_0x48a7('0x0'));module[_0x48a7('0x1')]={'network':{'type':Sequelize[_0x48a7('0x2')]},'network_script':{'type':Sequelize[_0x48a7('0x2')]},'request':{'type':Sequelize[_0x48a7('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x48a7('0x2')]},'type':{'type':Sequelize[_0x48a7('0x2')]},'uniqueid':{'type':Sequelize[_0x48a7('0x2')]},'version':{'type':Sequelize[_0x48a7('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x48a7('0x2')]},'callingpres':{'type':Sequelize[_0x48a7('0x2')]},'callingani2':{'type':Sequelize[_0x48a7('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x48a7('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x48a7('0x2')]},'extension':{'type':Sequelize[_0x48a7('0x2')]},'priority':{'type':Sequelize[_0x48a7('0x2')]},'enhanced':{'type':Sequelize[_0x48a7('0x2')]},'accountcode':{'type':Sequelize[_0x48a7('0x2')]},'threadid':{'type':Sequelize[_0x48a7('0x2')]},'project_name':{'type':Sequelize[_0x48a7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x48a7('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 390e1cc..154a542 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 _0x32fa=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x3e78eb,_0x198a0d){var _0x11257e=function(_0x307e7e){while(--_0x307e7e){_0x3e78eb['push'](_0x3e78eb['shift']());}};_0x11257e(++_0x198a0d);}(_0x32fa,0x11b));var _0xa32f=function(_0x3a3fd8,_0x192bf8){_0x3a3fd8=_0x3a3fd8-0x0;var _0x28da71=_0x32fa[_0x3a3fd8];return _0x28da71;};'use strict';var emlformat=require(_0xa32f('0x0'));var rimraf=require(_0xa32f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa32f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa32f('0x3'));var util=require(_0xa32f('0x4'));var path=require('path');var sox=require(_0xa32f('0x5'));var csv=require(_0xa32f('0x6'));var ejs=require(_0xa32f('0x7'));var fs=require('fs');var fs_extra=require(_0xa32f('0x8'));var _=require('lodash');var squel=require(_0xa32f('0x9'));var crypto=require(_0xa32f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa32f('0xb'));var toCsv=require(_0xa32f('0x6'));var querystring=require(_0xa32f('0xc'));var Papa=require(_0xa32f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa32f('0xe'));var as=require(_0xa32f('0xf'));var hardwareService=require(_0xa32f('0x10'));var logger=require(_0xa32f('0x11'))('api');var utils=require(_0xa32f('0x12'));var config=require(_0xa32f('0x13'));var licenseUtil=require(_0xa32f('0x14'));var db=require(_0xa32f('0x15'))['db'];function respondWithStatusCode(_0x499aba,_0x4febcf){_0x4febcf=_0x4febcf||0xcc;return function(_0x5e7701){if(_0x5e7701){return _0x499aba[_0xa32f('0x16')](_0x4febcf);}return _0x499aba[_0xa32f('0x17')](_0x4febcf)[_0xa32f('0x18')]();};}function respondWithResult(_0x28e447,_0x524081){_0x524081=_0x524081||0xc8;return function(_0x2d1b41){if(_0x2d1b41){return _0x28e447[_0xa32f('0x17')](_0x524081)['json'](_0x2d1b41);}};}function respondWithFilteredResult(_0x271bd0,_0x1504d4){return function(_0x15f8e3){if(_0x15f8e3){var _0xb88a07=typeof _0x1504d4[_0xa32f('0x19')]==='undefined'&&typeof _0x1504d4[_0xa32f('0x1a')]==='undefined';var _0x401318=_0x15f8e3['count'];var _0x1f6895=_0xb88a07?0x0:_0x1504d4[_0xa32f('0x19')];var _0x357c6a=_0xb88a07?_0x15f8e3[_0xa32f('0x1b')]:_0x1504d4['offset']+_0x1504d4[_0xa32f('0x1a')];var _0x3a03ee;if(_0x357c6a>=_0x401318){_0x357c6a=_0x401318;_0x3a03ee=0xc8;}else{_0x3a03ee=0xce;}_0x271bd0[_0xa32f('0x17')](_0x3a03ee);return _0x271bd0[_0xa32f('0x1c')](_0xa32f('0x1d'),_0x1f6895+'-'+_0x357c6a+'/'+_0x401318)[_0xa32f('0x1e')](_0x15f8e3);}return null;};}function patchUpdates(_0x5e5369){return function(_0x1c1fe3){try{jsonpatch[_0xa32f('0x1f')](_0x1c1fe3,_0x5e5369,!![]);}catch(_0x23f308){return BPromise[_0xa32f('0x20')](_0x23f308);}return _0x1c1fe3[_0xa32f('0x21')]();};}function saveUpdates(_0x4e9db0,_0x48773f){return function(_0x2ec1b7){if(_0x2ec1b7){return _0x2ec1b7[_0xa32f('0x22')](_0x4e9db0)[_0xa32f('0x23')](function(_0x3dc8a1){return _0x3dc8a1;});}return null;};}function removeEntity(_0x3e4910,_0x30258c){return function(_0x512d7e){if(_0x512d7e){return _0x512d7e[_0xa32f('0x24')]()['then'](function(){_0x3e4910[_0xa32f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf2e5c9,_0x10f10d){return function(_0x2a7c1d){if(!_0x2a7c1d){_0xf2e5c9['sendStatus'](0x194);}return _0x2a7c1d;};}function handleError(_0x1ed8bc,_0x2a7b1e){_0x2a7b1e=_0x2a7b1e||0x1f4;return function(_0x53f731){logger[_0xa32f('0x25')](_0x53f731['stack']);if(_0x53f731['name']){delete _0x53f731[_0xa32f('0x26')];}_0x1ed8bc[_0xa32f('0x17')](_0x2a7b1e)[_0xa32f('0x27')](_0x53f731);};}exports[_0xa32f('0x28')]=function(_0xbc9089,_0x4e56be){var _0x17847f={},_0x4a0f66={},_0x240bac={'count':0x0,'rows':[]};var _0x30ec77=_[_0xa32f('0x29')](db[_0xa32f('0x2a')][_0xa32f('0x2b')],function(_0x1267aa){return{'name':_0x1267aa[_0xa32f('0x2c')],'type':_0x1267aa[_0xa32f('0x2d')][_0xa32f('0x2e')]};});_0x4a0f66[_0xa32f('0x2f')]=_['map'](_0x30ec77,_0xa32f('0x26'));_0x4a0f66['query']=_[_0xa32f('0x30')](_0xbc9089['query']);_0x4a0f66['filters']=_[_0xa32f('0x31')](_0x4a0f66[_0xa32f('0x2f')],_0x4a0f66[_0xa32f('0x32')]);_0x17847f['attributes']=_[_0xa32f('0x31')](_0x4a0f66[_0xa32f('0x2f')],qs[_0xa32f('0x33')](_0xbc9089[_0xa32f('0x32')]['fields']));_0x17847f[_0xa32f('0x34')]=_0x17847f['attributes'][_0xa32f('0x35')]?_0x17847f[_0xa32f('0x34')]:_0x4a0f66[_0xa32f('0x2f')];if(!_0xbc9089[_0xa32f('0x32')][_0xa32f('0x36')](_0xa32f('0x37'))){_0x17847f[_0xa32f('0x1a')]=qs[_0xa32f('0x1a')](_0xbc9089['query'][_0xa32f('0x1a')]);_0x17847f['offset']=qs[_0xa32f('0x19')](_0xbc9089[_0xa32f('0x32')][_0xa32f('0x19')]);}_0x17847f['order']=qs[_0xa32f('0x38')](_0xbc9089[_0xa32f('0x32')]['sort']);_0x17847f[_0xa32f('0x39')]=qs[_0xa32f('0x3a')](_[_0xa32f('0x3b')](_0xbc9089[_0xa32f('0x32')],_0x4a0f66[_0xa32f('0x3a')]),_0x30ec77);if(_0xbc9089['query'][_0xa32f('0x3c')]){_0x17847f['where']=_[_0xa32f('0x3d')](_0x17847f['where'],{'$or':_['map'](_0x30ec77,function(_0x12d44){if(_0x12d44[_0xa32f('0x2d')]!==_0xa32f('0x3e')){var _0x128e0b={};_0x128e0b[_0x12d44[_0xa32f('0x26')]]={'$like':'%'+_0xbc9089['query']['filter']+'%'};return _0x128e0b;}})});}_0x17847f=_[_0xa32f('0x3d')]({},_0x17847f,_0xbc9089['options']);var _0x21625d={'where':_0x17847f[_0xa32f('0x39')]};return db[_0xa32f('0x2a')][_0xa32f('0x1b')](_0x21625d)[_0xa32f('0x23')](function(_0x515bb0){_0x240bac[_0xa32f('0x1b')]=_0x515bb0;if(_0xbc9089['query'][_0xa32f('0x3f')]){_0x17847f[_0xa32f('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x17847f);})[_0xa32f('0x23')](function(_0x235def){_0x240bac[_0xa32f('0x41')]=_0x235def;return _0x240bac;})['then'](respondWithFilteredResult(_0x4e56be,_0x17847f))[_0xa32f('0x42')](handleError(_0x4e56be,null));};exports[_0xa32f('0x43')]=function(_0x214620,_0x45445a){var _0x167a9f={'raw':!![],'where':{'id':_0x214620[_0xa32f('0x44')]['id']}},_0x451d22={};_0x451d22[_0xa32f('0x2f')]=_['keys'](db[_0xa32f('0x2a')][_0xa32f('0x2b')]);_0x451d22[_0xa32f('0x32')]=_[_0xa32f('0x30')](_0x214620[_0xa32f('0x32')]);_0x451d22[_0xa32f('0x3a')]=_[_0xa32f('0x31')](_0x451d22[_0xa32f('0x2f')],_0x451d22['query']);_0x167a9f[_0xa32f('0x34')]=_[_0xa32f('0x31')](_0x451d22[_0xa32f('0x2f')],qs[_0xa32f('0x33')](_0x214620[_0xa32f('0x32')]['fields']));_0x167a9f[_0xa32f('0x34')]=_0x167a9f[_0xa32f('0x34')]['length']?_0x167a9f['attributes']:_0x451d22[_0xa32f('0x2f')];if(_0x214620[_0xa32f('0x32')][_0xa32f('0x3f')]){_0x167a9f[_0xa32f('0x40')]=[{'all':!![]}];}_0x167a9f=_[_0xa32f('0x3d')]({},_0x167a9f,_0x214620[_0xa32f('0x45')]);return db[_0xa32f('0x2a')]['find'](_0x167a9f)[_0xa32f('0x23')](handleEntityNotFound(_0x45445a,null))[_0xa32f('0x23')](respondWithResult(_0x45445a,null))[_0xa32f('0x42')](handleError(_0x45445a,null));};exports['create']=function(_0x28004c,_0x16cf5e){return db[_0xa32f('0x2a')][_0xa32f('0x46')](_0x28004c[_0xa32f('0x47')],{})[_0xa32f('0x23')](respondWithResult(_0x16cf5e,0xc9))['catch'](handleError(_0x16cf5e,null));};exports[_0xa32f('0x22')]=function(_0x3c2a37,_0x5a5e3b){if(_0x3c2a37[_0xa32f('0x47')]['id']){delete _0x3c2a37[_0xa32f('0x47')]['id'];}return db[_0xa32f('0x2a')][_0xa32f('0x48')]({'where':{'id':_0x3c2a37['params']['id']}})['then'](handleEntityNotFound(_0x5a5e3b,null))[_0xa32f('0x23')](saveUpdates(_0x3c2a37[_0xa32f('0x47')],null))[_0xa32f('0x23')](respondWithResult(_0x5a5e3b,null))[_0xa32f('0x42')](handleError(_0x5a5e3b,null));};exports['destroy']=function(_0x585feb,_0x537634){return db[_0xa32f('0x2a')][_0xa32f('0x48')]({'where':{'id':_0x585feb[_0xa32f('0x44')]['id']}})['then'](handleEntityNotFound(_0x537634,null))[_0xa32f('0x23')](removeEntity(_0x537634,null))[_0xa32f('0x42')](handleError(_0x537634,null));};exports[_0xa32f('0x49')]=function(_0x8fb8,_0x146c11){return db[_0xa32f('0x2a')]['describe']()['then'](respondWithResult(_0x146c11,null))[_0xa32f('0x42')](handleError(_0x146c11,null));}; \ No newline at end of file +var _0x342f=['sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SquareReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x423312,_0x25f527){var _0x33f959=function(_0x5b1783){while(--_0x5b1783){_0x423312['push'](_0x423312['shift']());}};_0x33f959(++_0x25f527);}(_0x342f,0x101));var _0xf342=function(_0x17983d,_0x30e8c1){_0x17983d=_0x17983d-0x0;var _0x1ca89d=_0x342f[_0x17983d];return _0x1ca89d;};'use strict';var emlformat=require(_0xf342('0x0'));var rimraf=require(_0xf342('0x1'));var zipdir=require(_0xf342('0x2'));var jsonpatch=require(_0xf342('0x3'));var rp=require(_0xf342('0x4'));var moment=require(_0xf342('0x5'));var BPromise=require(_0xf342('0x6'));var Mustache=require(_0xf342('0x7'));var util=require(_0xf342('0x8'));var path=require(_0xf342('0x9'));var sox=require(_0xf342('0xa'));var csv=require(_0xf342('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf342('0xc'));var _=require(_0xf342('0xd'));var squel=require(_0xf342('0xe'));var crypto=require(_0xf342('0xf'));var jsforce=require(_0xf342('0x10'));var deskjs=require(_0xf342('0x11'));var toCsv=require(_0xf342('0xb'));var querystring=require(_0xf342('0x12'));var Papa=require(_0xf342('0x13'));var Redis=require(_0xf342('0x14'));var authService=require(_0xf342('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf342('0x16'));var logger=require(_0xf342('0x17'))(_0xf342('0x18'));var utils=require(_0xf342('0x19'));var config=require(_0xf342('0x1a'));var licenseUtil=require(_0xf342('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39f3cb,_0x1ec629){_0x1ec629=_0x1ec629||0xcc;return function(_0x3bdf1a){if(_0x3bdf1a){return _0x39f3cb[_0xf342('0x1c')](_0x1ec629);}return _0x39f3cb[_0xf342('0x1d')](_0x1ec629)['end']();};}function respondWithResult(_0x1ecaad,_0x568de1){_0x568de1=_0x568de1||0xc8;return function(_0x3da1e4){if(_0x3da1e4){return _0x1ecaad[_0xf342('0x1d')](_0x568de1)[_0xf342('0x1e')](_0x3da1e4);}};}function respondWithFilteredResult(_0x465fee,_0x3bf097){return function(_0x1cf7d2){if(_0x1cf7d2){var _0xa0da4=typeof _0x3bf097[_0xf342('0x1f')]===_0xf342('0x20')&&typeof _0x3bf097[_0xf342('0x21')]===_0xf342('0x20');var _0x10f7c3=_0x1cf7d2[_0xf342('0x22')];var _0x4c1779=_0xa0da4?0x0:_0x3bf097[_0xf342('0x1f')];var _0x448211=_0xa0da4?_0x1cf7d2['count']:_0x3bf097[_0xf342('0x1f')]+_0x3bf097['limit'];var _0x54236d;if(_0x448211>=_0x10f7c3){_0x448211=_0x10f7c3;_0x54236d=0xc8;}else{_0x54236d=0xce;}_0x465fee[_0xf342('0x1d')](_0x54236d);return _0x465fee[_0xf342('0x23')](_0xf342('0x24'),_0x4c1779+'-'+_0x448211+'/'+_0x10f7c3)['json'](_0x1cf7d2);}return null;};}function patchUpdates(_0x18daea){return function(_0x2b4ecb){try{jsonpatch[_0xf342('0x25')](_0x2b4ecb,_0x18daea,!![]);}catch(_0x8818bc){return BPromise[_0xf342('0x26')](_0x8818bc);}return _0x2b4ecb[_0xf342('0x27')]();};}function saveUpdates(_0x356e2a,_0x3eef9d){return function(_0x1994b6){if(_0x1994b6){return _0x1994b6[_0xf342('0x28')](_0x356e2a)[_0xf342('0x29')](function(_0x4ca78a){return _0x4ca78a;});}return null;};}function removeEntity(_0x58419d,_0x339fef){return function(_0x597426){if(_0x597426){return _0x597426[_0xf342('0x2a')]()[_0xf342('0x29')](function(){_0x58419d[_0xf342('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279bfe,_0xc5fb40){return function(_0x5658e3){if(!_0x5658e3){_0x279bfe[_0xf342('0x1c')](0x194);}return _0x5658e3;};}function handleError(_0x3616cc,_0x53c3ea){_0x53c3ea=_0x53c3ea||0x1f4;return function(_0x504ddc){logger[_0xf342('0x2b')](_0x504ddc[_0xf342('0x2c')]);if(_0x504ddc[_0xf342('0x2d')]){delete _0x504ddc['name'];}_0x3616cc['status'](_0x53c3ea)['send'](_0x504ddc);};}exports['index']=function(_0x21e764,_0x1cca8a){var _0x193bee={},_0x28a3fe={},_0x3490e0={'count':0x0,'rows':[]};var _0x4cac1f=_[_0xf342('0x2e')](db[_0xf342('0x2f')][_0xf342('0x30')],function(_0x1908c9){return{'name':_0x1908c9['fieldName'],'type':_0x1908c9['type'][_0xf342('0x31')]};});_0x28a3fe[_0xf342('0x32')]=_[_0xf342('0x2e')](_0x4cac1f,_0xf342('0x2d'));_0x28a3fe[_0xf342('0x33')]=_[_0xf342('0x34')](_0x21e764[_0xf342('0x33')]);_0x28a3fe['filters']=_[_0xf342('0x35')](_0x28a3fe[_0xf342('0x32')],_0x28a3fe[_0xf342('0x33')]);_0x193bee[_0xf342('0x36')]=_[_0xf342('0x35')](_0x28a3fe['model'],qs[_0xf342('0x37')](_0x21e764[_0xf342('0x33')][_0xf342('0x37')]));_0x193bee['attributes']=_0x193bee['attributes']['length']?_0x193bee[_0xf342('0x36')]:_0x28a3fe[_0xf342('0x32')];if(!_0x21e764['query'][_0xf342('0x38')](_0xf342('0x39'))){_0x193bee[_0xf342('0x21')]=qs['limit'](_0x21e764[_0xf342('0x33')][_0xf342('0x21')]);_0x193bee[_0xf342('0x1f')]=qs[_0xf342('0x1f')](_0x21e764[_0xf342('0x33')][_0xf342('0x1f')]);}_0x193bee[_0xf342('0x3a')]=qs[_0xf342('0x3b')](_0x21e764['query'][_0xf342('0x3b')]);_0x193bee[_0xf342('0x3c')]=qs[_0xf342('0x3d')](_[_0xf342('0x3e')](_0x21e764['query'],_0x28a3fe[_0xf342('0x3d')]),_0x4cac1f);if(_0x21e764['query'][_0xf342('0x3f')]){_0x193bee[_0xf342('0x3c')]=_[_0xf342('0x40')](_0x193bee[_0xf342('0x3c')],{'$or':_['map'](_0x4cac1f,function(_0x5c821e){if(_0x5c821e['type']!==_0xf342('0x41')){var _0x2f9ca6={};_0x2f9ca6[_0x5c821e[_0xf342('0x2d')]]={'$like':'%'+_0x21e764[_0xf342('0x33')][_0xf342('0x3f')]+'%'};return _0x2f9ca6;}})});}_0x193bee=_['merge']({},_0x193bee,_0x21e764['options']);var _0x35e3e3={'where':_0x193bee['where']};return db[_0xf342('0x2f')]['count'](_0x35e3e3)['then'](function(_0x31dc7a){_0x3490e0[_0xf342('0x22')]=_0x31dc7a;if(_0x21e764['query'][_0xf342('0x42')]){_0x193bee[_0xf342('0x43')]=[{'all':!![]}];}return db['SquareReport'][_0xf342('0x44')](_0x193bee);})[_0xf342('0x29')](function(_0x2554b1){_0x3490e0[_0xf342('0x45')]=_0x2554b1;return _0x3490e0;})[_0xf342('0x29')](respondWithFilteredResult(_0x1cca8a,_0x193bee))[_0xf342('0x46')](handleError(_0x1cca8a,null));};exports[_0xf342('0x47')]=function(_0x414341,_0x4f4be0){var _0x3af586={'raw':!![],'where':{'id':_0x414341[_0xf342('0x48')]['id']}},_0x3f598c={};_0x3f598c[_0xf342('0x32')]=_[_0xf342('0x34')](db[_0xf342('0x2f')][_0xf342('0x30')]);_0x3f598c[_0xf342('0x33')]=_['keys'](_0x414341[_0xf342('0x33')]);_0x3f598c[_0xf342('0x3d')]=_[_0xf342('0x35')](_0x3f598c[_0xf342('0x32')],_0x3f598c[_0xf342('0x33')]);_0x3af586['attributes']=_[_0xf342('0x35')](_0x3f598c[_0xf342('0x32')],qs[_0xf342('0x37')](_0x414341[_0xf342('0x33')][_0xf342('0x37')]));_0x3af586['attributes']=_0x3af586[_0xf342('0x36')][_0xf342('0x49')]?_0x3af586[_0xf342('0x36')]:_0x3f598c[_0xf342('0x32')];if(_0x414341['query'][_0xf342('0x42')]){_0x3af586[_0xf342('0x43')]=[{'all':!![]}];}_0x3af586=_[_0xf342('0x40')]({},_0x3af586,_0x414341[_0xf342('0x4a')]);return db[_0xf342('0x2f')][_0xf342('0x4b')](_0x3af586)[_0xf342('0x29')](handleEntityNotFound(_0x4f4be0,null))['then'](respondWithResult(_0x4f4be0,null))['catch'](handleError(_0x4f4be0,null));};exports[_0xf342('0x4c')]=function(_0x2012bc,_0x2b2768){return db[_0xf342('0x2f')][_0xf342('0x4c')](_0x2012bc[_0xf342('0x4d')],{})[_0xf342('0x29')](respondWithResult(_0x2b2768,0xc9))[_0xf342('0x46')](handleError(_0x2b2768,null));};exports['update']=function(_0x5c820b,_0xbd645a){if(_0x5c820b[_0xf342('0x4d')]['id']){delete _0x5c820b[_0xf342('0x4d')]['id'];}return db['SquareReport'][_0xf342('0x4b')]({'where':{'id':_0x5c820b[_0xf342('0x48')]['id']}})['then'](handleEntityNotFound(_0xbd645a,null))[_0xf342('0x29')](saveUpdates(_0x5c820b[_0xf342('0x4d')],null))['then'](respondWithResult(_0xbd645a,null))[_0xf342('0x46')](handleError(_0xbd645a,null));};exports[_0xf342('0x2a')]=function(_0x24c8b9,_0x366a56){return db[_0xf342('0x2f')]['find']({'where':{'id':_0x24c8b9['params']['id']}})[_0xf342('0x29')](handleEntityNotFound(_0x366a56,null))[_0xf342('0x29')](removeEntity(_0x366a56,null))[_0xf342('0x46')](handleError(_0x366a56,null));};exports[_0xf342('0x4e')]=function(_0x2a4fa9,_0x16f608){return db[_0xf342('0x2f')][_0xf342('0x4e')]()['then'](respondWithResult(_0x16f608,null))[_0xf342('0x46')](handleError(_0x16f608,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 99495b3..f4bc66e 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 _0x09fa=['SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./squareReport.attributes','exports','define'];(function(_0xc15a10,_0x439827){var _0x37a210=function(_0x433dcf){while(--_0x433dcf){_0xc15a10['push'](_0xc15a10['shift']());}};_0x37a210(++_0x439827);}(_0x09fa,0x9b));var _0xa09f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x09fa[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xa09f('0x0'));var util=require(_0xa09f('0x1'));var logger=require(_0xa09f('0x2'))(_0xa09f('0x3'));var moment=require(_0xa09f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa09f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa09f('0x6'));var config=require('../../config/environment');var attributes=require(_0xa09f('0x7'));module[_0xa09f('0x8')]=function(_0x427e7d,_0x27b93a){return _0x427e7d[_0xa09f('0x9')](_0xa09f('0xa'),attributes,{'tableName':_0xa09f('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xa09f('0xc'),_0xa09f('0xd')]},{'name':_0xa09f('0xe'),'fields':[_0xa09f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bdc=['bluebird','request-promise','rimraf','../../config/environment','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api','moment'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x3bdc,0x115));var _0xc3bd=function(_0xeab380,_0xee8424){_0xeab380=_0xeab380-0x0;var _0xca9ad6=_0x3bdc[_0xeab380];return _0xca9ad6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3bd('0x0'))(_0xc3bd('0x1'));var moment=require(_0xc3bd('0x2'));var BPromise=require(_0xc3bd('0x3'));var rp=require(_0xc3bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3bd('0x5'));var config=require(_0xc3bd('0x6'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x3437ab,_0x965fc1){return _0x3437ab[_0xc3bd('0x7')](_0xc3bd('0x8'),attributes,{'tableName':_0xc3bd('0x9'),'paranoid':![],'indexes':[{'name':_0xc3bd('0xa'),'fields':[_0xc3bd('0xb'),_0xc3bd('0xc')]},{'name':_0xc3bd('0xd'),'fields':[_0xc3bd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 83d26f2..583929b 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 _0xdd1a=['../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','create','body','options','then','debug','stringify','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3af6d5,_0x580412){var _0x3e0d4c=function(_0x1b8516){while(--_0x1b8516){_0x3af6d5['push'](_0x3af6d5['shift']());}};_0x3e0d4c(++_0x580412);}(_0xdd1a,0x155));var _0xadd1=function(_0x46bdea,_0x2f2307){_0x46bdea=_0x46bdea-0x0;var _0xfe2763=_0xdd1a[_0x46bdea];return _0xfe2763;};'use strict';var _=require(_0xadd1('0x0'));var util=require(_0xadd1('0x1'));var moment=require(_0xadd1('0x2'));var BPromise=require(_0xadd1('0x3'));var rs=require(_0xadd1('0x4'));var fs=require('fs');var Redis=require(_0xadd1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xadd1('0x6'));var logger=require(_0xadd1('0x7'))(_0xadd1('0x8'));var config=require(_0xadd1('0x9'));var jayson=require(_0xadd1('0xa'));var client=jayson[_0xadd1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590760,_0x429ac1,_0x5280a7){return new BPromise(function(_0x32ffa6,_0x385baa){return client[_0xadd1('0xc')](_0x590760,_0x5280a7)['then'](function(_0x3e17cb){logger[_0xadd1('0xd')]('SquareReport,\x20%s,\x20%s',_0x429ac1,'request\x20sent');logger['debug'](_0xadd1('0xe'),_0x429ac1,_0xadd1('0xf'),JSON['stringify'](_0x3e17cb));if(_0x3e17cb[_0xadd1('0x10')]){if(_0x3e17cb[_0xadd1('0x10')][_0xadd1('0x11')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x429ac1,_0x3e17cb[_0xadd1('0x10')][_0xadd1('0x12')]);return _0x385baa(_0x3e17cb['error']['message']);}logger[_0xadd1('0x10')]('SquareReport,\x20%s,\x20%s',_0x429ac1,_0x3e17cb['error'][_0xadd1('0x12')]);return _0x32ffa6(_0x3e17cb[_0xadd1('0x10')][_0xadd1('0x12')]);}else{logger[_0xadd1('0xd')](_0xadd1('0x13'),_0x429ac1,_0xadd1('0xf'));_0x32ffa6(_0x3e17cb[_0xadd1('0x14')][_0xadd1('0x12')]);}})[_0xadd1('0x15')](function(_0xf0fb7e){logger[_0xadd1('0x10')]('SquareReport,\x20%s,\x20%s',_0x429ac1,_0xf0fb7e);_0x385baa(_0xf0fb7e);});});}exports[_0xadd1('0x16')]=function(_0x3a5fc5){var _0x252fd0=this;return new Promise(function(_0x51f9de,_0x3426e7){return db[_0xadd1('0x17')][_0xadd1('0x18')](_0x3a5fc5[_0xadd1('0x19')],{'raw':_0x3a5fc5[_0xadd1('0x1a')]?_0x3a5fc5['options']['raw']===undefined?!![]:![]:!![]})[_0xadd1('0x1b')](function(_0x247dad){logger[_0xadd1('0xd')]('CreateSquareReport',_0x3a5fc5);logger[_0xadd1('0x1c')]('CreateSquareReport',_0x3a5fc5,JSON[_0xadd1('0x1d')](_0x247dad));_0x51f9de(_0x247dad);})[_0xadd1('0x15')](function(_0xb7d6be){logger[_0xadd1('0x10')](_0xadd1('0x16'),_0xb7d6be[_0xadd1('0x12')],_0x3a5fc5);_0x3426e7(_0x252fd0['error'](0x1f4,_0xb7d6be[_0xadd1('0x12')]));});});};exports[_0xadd1('0x1e')]=function(_0x453ffc){var _0x958fca=this;return new Promise(function(_0x46c5ed,_0x4d5eff){return db[_0xadd1('0x17')][_0xadd1('0x1f')](_0x453ffc['body'],{'raw':_0x453ffc['options']?_0x453ffc[_0xadd1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453ffc['options']?_0x453ffc[_0xadd1('0x1a')][_0xadd1('0x20')]||null:null,'attributes':_0x453ffc[_0xadd1('0x1a')]?_0x453ffc['options'][_0xadd1('0x21')]||null:null,'limit':_0x453ffc[_0xadd1('0x1a')]?_0x453ffc[_0xadd1('0x1a')][_0xadd1('0x22')]||null:null})[_0xadd1('0x1b')](function(_0x207b51){logger[_0xadd1('0xd')]('UpdateSquareReport',_0x453ffc);logger[_0xadd1('0x1c')](_0xadd1('0x1e'),_0x453ffc,JSON[_0xadd1('0x1d')](_0x207b51));_0x46c5ed(_0x207b51);})[_0xadd1('0x15')](function(_0x3a3b32){logger[_0xadd1('0x10')](_0xadd1('0x1e'),_0x3a3b32[_0xadd1('0x12')],_0x453ffc);_0x4d5eff(_0x958fca[_0xadd1('0x10')](0x1f4,_0x3a3b32[_0xadd1('0x12')]));});});}; \ No newline at end of file +var _0x5c48=['then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a93a5,_0x13f256){var _0x4893a2=function(_0x4a176c){while(--_0x4a176c){_0x1a93a5['push'](_0x1a93a5['shift']());}};_0x4893a2(++_0x13f256);}(_0x5c48,0x181));var _0x85c4=function(_0x1297c9,_0x449e9f){_0x1297c9=_0x1297c9-0x0;var _0x459c13=_0x5c48[_0x1297c9];return _0x459c13;};'use strict';var _=require(_0x85c4('0x0'));var util=require('util');var moment=require(_0x85c4('0x1'));var BPromise=require(_0x85c4('0x2'));var rs=require(_0x85c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85c4('0x4'))['db'];var utils=require(_0x85c4('0x5'));var logger=require(_0x85c4('0x6'))(_0x85c4('0x7'));var config=require(_0x85c4('0x8'));var jayson=require(_0x85c4('0x9'));var client=jayson[_0x85c4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56f3fd,_0x2c016b,_0x3fbd52){return new BPromise(function(_0x50c7b1,_0x21913e){return client['request'](_0x56f3fd,_0x3fbd52)[_0x85c4('0xb')](function(_0x3c1316){logger[_0x85c4('0xc')](_0x85c4('0xd'),_0x2c016b,_0x85c4('0xe'));logger[_0x85c4('0xf')](_0x85c4('0x10'),_0x2c016b,_0x85c4('0xe'),JSON[_0x85c4('0x11')](_0x3c1316));if(_0x3c1316[_0x85c4('0x12')]){if(_0x3c1316[_0x85c4('0x12')][_0x85c4('0x13')]===0x1f4){logger[_0x85c4('0x12')](_0x85c4('0xd'),_0x2c016b,_0x3c1316[_0x85c4('0x12')][_0x85c4('0x14')]);return _0x21913e(_0x3c1316[_0x85c4('0x12')][_0x85c4('0x14')]);}logger[_0x85c4('0x12')]('SquareReport,\x20%s,\x20%s',_0x2c016b,_0x3c1316[_0x85c4('0x12')][_0x85c4('0x14')]);return _0x50c7b1(_0x3c1316[_0x85c4('0x12')][_0x85c4('0x14')]);}else{logger[_0x85c4('0xc')]('SquareReport,\x20%s,\x20%s',_0x2c016b,_0x85c4('0xe'));_0x50c7b1(_0x3c1316[_0x85c4('0x15')][_0x85c4('0x14')]);}})[_0x85c4('0x16')](function(_0x2d9a35){logger[_0x85c4('0x12')](_0x85c4('0xd'),_0x2c016b,_0x2d9a35);_0x21913e(_0x2d9a35);});});}exports[_0x85c4('0x17')]=function(_0x53011f){var _0x39fa69=this;return new Promise(function(_0x23e19f,_0x27c070){return db[_0x85c4('0x18')][_0x85c4('0x19')](_0x53011f[_0x85c4('0x1a')],{'raw':_0x53011f['options']?_0x53011f[_0x85c4('0x1b')][_0x85c4('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x19cb84){logger[_0x85c4('0xc')]('CreateSquareReport',_0x53011f);logger[_0x85c4('0xf')](_0x85c4('0x17'),_0x53011f,JSON[_0x85c4('0x11')](_0x19cb84));_0x23e19f(_0x19cb84);})[_0x85c4('0x16')](function(_0x5ede03){logger[_0x85c4('0x12')](_0x85c4('0x17'),_0x5ede03[_0x85c4('0x14')],_0x53011f);_0x27c070(_0x39fa69[_0x85c4('0x12')](0x1f4,_0x5ede03['message']));});});};exports[_0x85c4('0x1d')]=function(_0x7d91b8){var _0x54f28d=this;return new Promise(function(_0x54ed0d,_0x140501){return db[_0x85c4('0x18')][_0x85c4('0x1e')](_0x7d91b8[_0x85c4('0x1a')],{'raw':_0x7d91b8[_0x85c4('0x1b')]?_0x7d91b8[_0x85c4('0x1b')][_0x85c4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d91b8[_0x85c4('0x1b')]?_0x7d91b8['options'][_0x85c4('0x1f')]||null:null,'attributes':_0x7d91b8['options']?_0x7d91b8[_0x85c4('0x1b')]['attributes']||null:null,'limit':_0x7d91b8[_0x85c4('0x1b')]?_0x7d91b8[_0x85c4('0x1b')][_0x85c4('0x20')]||null:null})[_0x85c4('0xb')](function(_0x499404){logger[_0x85c4('0xc')](_0x85c4('0x1d'),_0x7d91b8);logger[_0x85c4('0xf')](_0x85c4('0x1d'),_0x7d91b8,JSON[_0x85c4('0x11')](_0x499404));_0x54ed0d(_0x499404);})['catch'](function(_0x4251aa){logger[_0x85c4('0x12')](_0x85c4('0x1d'),_0x4251aa[_0x85c4('0x14')],_0x7d91b8);_0x140501(_0x54f28d[_0x85c4('0x12')](0x1f4,_0x4251aa[_0x85c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9c93a33..560525f 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 _0x1f11=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x1f11,0x1e2));var _0x11f1=function(_0x45cf7c,_0x49fed2){_0x45cf7c=_0x45cf7c-0x0;var _0x2a9193=_0x1f11[_0x45cf7c];return _0x2a9193;};'use strict';var multer=require(_0x11f1('0x0'));var util=require(_0x11f1('0x1'));var path=require(_0x11f1('0x2'));var timeout=require(_0x11f1('0x3'));var express=require('express');var router=express[_0x11f1('0x4')]();var fs_extra=require(_0x11f1('0x5'));var auth=require(_0x11f1('0x6'));var interaction=require(_0x11f1('0x7'));var config=require(_0x11f1('0x8'));var controller=require(_0x11f1('0x9'));router[_0x11f1('0xa')]('/',auth['isAuthenticated'](),controller[_0x11f1('0xb')]);router[_0x11f1('0xa')](_0x11f1('0xc'),auth[_0x11f1('0xd')](),controller[_0x11f1('0xe')]);router[_0x11f1('0xa')](_0x11f1('0xf'),auth[_0x11f1('0xd')](),controller[_0x11f1('0x10')]);router[_0x11f1('0x11')]('/',auth['isAuthenticated'](),controller[_0x11f1('0x12')]);router[_0x11f1('0x13')](_0x11f1('0xf'),auth[_0x11f1('0xd')](),controller['update']);router['delete'](_0x11f1('0xf'),auth[_0x11f1('0xd')](),controller[_0x11f1('0x14')]);module[_0x11f1('0x15')]=router; \ No newline at end of file +var _0x40ea=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','post','create','/:id','delete','destroy','exports','multer','util','path'];(function(_0xad39bb,_0x2ed225){var _0x231b60=function(_0x526ed8){while(--_0x526ed8){_0xad39bb['push'](_0xad39bb['shift']());}};_0x231b60(++_0x2ed225);}(_0x40ea,0x1a1));var _0xa40e=function(_0x6ba503,_0x3c7932){_0x6ba503=_0x6ba503-0x0;var _0x52956b=_0x40ea[_0x6ba503];return _0x52956b;};'use strict';var multer=require(_0xa40e('0x0'));var util=require(_0xa40e('0x1'));var path=require(_0xa40e('0x2'));var timeout=require(_0xa40e('0x3'));var express=require(_0xa40e('0x4'));var router=express[_0xa40e('0x5')]();var fs_extra=require(_0xa40e('0x6'));var auth=require(_0xa40e('0x7'));var interaction=require(_0xa40e('0x8'));var config=require(_0xa40e('0x9'));var controller=require('./squareReportDetail.controller');router[_0xa40e('0xa')]('/',auth['isAuthenticated'](),controller[_0xa40e('0xb')]);router[_0xa40e('0xa')](_0xa40e('0xc'),auth[_0xa40e('0xd')](),controller[_0xa40e('0xe')]);router['get']('/:id',auth[_0xa40e('0xd')](),controller['show']);router[_0xa40e('0xf')]('/',auth['isAuthenticated'](),controller[_0xa40e('0x10')]);router['put'](_0xa40e('0x11'),auth[_0xa40e('0xd')](),controller['update']);router[_0xa40e('0x12')](_0xa40e('0x11'),auth[_0xa40e('0xd')](),controller[_0xa40e('0x13')]);module[_0xa40e('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 3ec3fe8..f5095d1 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 _0x28e4=['exports','STRING','sequelize'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x28e4,0x11c));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x428e('0x0'));module[_0x428e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x428e('0x2')]},'application':{'type':Sequelize[_0x428e('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x428e('0x2')]},'callerid':{'type':Sequelize[_0x428e('0x2')]}}; \ No newline at end of file +var _0xd04c=['STRING','TEXT'];(function(_0x32f510,_0x3ff37b){var _0x22d5bf=function(_0x470580){while(--_0x470580){_0x32f510['push'](_0x32f510['shift']());}};_0x22d5bf(++_0x3ff37b);}(_0xd04c,0x11a));var _0xcd04=function(_0x1f5cdc,_0x220199){_0x1f5cdc=_0x1f5cdc-0x0;var _0x578908=_0xd04c[_0x1f5cdc];return _0x578908;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcd04('0x0')]},'node':{'type':Sequelize[_0xcd04('0x0')]},'application':{'type':Sequelize[_0xcd04('0x0')]},'data':{'type':Sequelize[_0xcd04('0x1')]},'project_name':{'type':Sequelize[_0xcd04('0x0')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0b30f44..fac5326 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 _0x3527=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','findAll','catch','show','params','keys','include','find','create','body','describe','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x3527,0x1b4));var _0x7352=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x3527[_0x2ca9d4];return _0x258956;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7352('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7352('0x1'));var moment=require('moment');var BPromise=require(_0x7352('0x2'));var Mustache=require(_0x7352('0x3'));var util=require(_0x7352('0x4'));var path=require(_0x7352('0x5'));var sox=require('sox');var csv=require(_0x7352('0x6'));var ejs=require(_0x7352('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7352('0x8'));var squel=require(_0x7352('0x9'));var crypto=require(_0x7352('0xa'));var jsforce=require(_0x7352('0xb'));var deskjs=require(_0x7352('0xc'));var toCsv=require(_0x7352('0x6'));var querystring=require(_0x7352('0xd'));var Papa=require('papaparse');var Redis=require(_0x7352('0xe'));var authService=require(_0x7352('0xf'));var qs=require(_0x7352('0x10'));var as=require(_0x7352('0x11'));var hardwareService=require(_0x7352('0x12'));var logger=require('../../config/logger')(_0x7352('0x13'));var utils=require(_0x7352('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7352('0x15'));var db=require(_0x7352('0x16'))['db'];function respondWithStatusCode(_0x2ac303,_0x476ebd){_0x476ebd=_0x476ebd||0xcc;return function(_0x36e0e9){if(_0x36e0e9){return _0x2ac303[_0x7352('0x17')](_0x476ebd);}return _0x2ac303[_0x7352('0x18')](_0x476ebd)['end']();};}function respondWithResult(_0x200ede,_0x1d2398){_0x1d2398=_0x1d2398||0xc8;return function(_0x4fd05c){if(_0x4fd05c){return _0x200ede['status'](_0x1d2398)[_0x7352('0x19')](_0x4fd05c);}};}function respondWithFilteredResult(_0x334d55,_0x3d33e7){return function(_0x888996){if(_0x888996){var _0x840a4a=typeof _0x3d33e7[_0x7352('0x1a')]===_0x7352('0x1b')&&typeof _0x3d33e7['limit']==='undefined';var _0x596800=_0x888996[_0x7352('0x1c')];var _0x52d6cf=_0x840a4a?0x0:_0x3d33e7['offset'];var _0x468029=_0x840a4a?_0x888996['count']:_0x3d33e7[_0x7352('0x1a')]+_0x3d33e7[_0x7352('0x1d')];var _0x4f7ffc;if(_0x468029>=_0x596800){_0x468029=_0x596800;_0x4f7ffc=0xc8;}else{_0x4f7ffc=0xce;}_0x334d55[_0x7352('0x18')](_0x4f7ffc);return _0x334d55[_0x7352('0x1e')]('Content-Range',_0x52d6cf+'-'+_0x468029+'/'+_0x596800)[_0x7352('0x19')](_0x888996);}return null;};}function patchUpdates(_0x553021){return function(_0x4cefca){try{jsonpatch[_0x7352('0x1f')](_0x4cefca,_0x553021,!![]);}catch(_0x42b888){return BPromise['reject'](_0x42b888);}return _0x4cefca[_0x7352('0x20')]();};}function saveUpdates(_0x210275,_0x4813c3){return function(_0x2e6310){if(_0x2e6310){return _0x2e6310[_0x7352('0x21')](_0x210275)[_0x7352('0x22')](function(_0x1b53fc){return _0x1b53fc;});}return null;};}function removeEntity(_0x4b0a72,_0x585e9c){return function(_0x6f4452){if(_0x6f4452){return _0x6f4452[_0x7352('0x23')]()['then'](function(){_0x4b0a72['status'](0xcc)[_0x7352('0x24')]();});}};}function handleEntityNotFound(_0x4c381d,_0x210568){return function(_0x220b47){if(!_0x220b47){_0x4c381d[_0x7352('0x17')](0x194);}return _0x220b47;};}function handleError(_0x4bf361,_0x207d98){_0x207d98=_0x207d98||0x1f4;return function(_0x27d010){logger[_0x7352('0x25')](_0x27d010[_0x7352('0x26')]);if(_0x27d010['name']){delete _0x27d010[_0x7352('0x27')];}_0x4bf361[_0x7352('0x18')](_0x207d98)[_0x7352('0x28')](_0x27d010);};}exports[_0x7352('0x29')]=function(_0x593e18,_0x34ed41){var _0x40d71e={},_0x1efe6b={},_0x5864b7={'count':0x0,'rows':[]};var _0x24be12=_[_0x7352('0x2a')](db['SquareDetailsReport'][_0x7352('0x2b')],function(_0x286123){return{'name':_0x286123[_0x7352('0x2c')],'type':_0x286123[_0x7352('0x2d')][_0x7352('0x2e')]};});_0x1efe6b[_0x7352('0x2f')]=_[_0x7352('0x2a')](_0x24be12,_0x7352('0x27'));_0x1efe6b[_0x7352('0x30')]=_['keys'](_0x593e18[_0x7352('0x30')]);_0x1efe6b[_0x7352('0x31')]=_[_0x7352('0x32')](_0x1efe6b[_0x7352('0x2f')],_0x1efe6b[_0x7352('0x30')]);_0x40d71e[_0x7352('0x33')]=_[_0x7352('0x32')](_0x1efe6b[_0x7352('0x2f')],qs['fields'](_0x593e18[_0x7352('0x30')][_0x7352('0x34')]));_0x40d71e['attributes']=_0x40d71e[_0x7352('0x33')][_0x7352('0x35')]?_0x40d71e['attributes']:_0x1efe6b[_0x7352('0x2f')];if(!_0x593e18[_0x7352('0x30')][_0x7352('0x36')]('nolimit')){_0x40d71e[_0x7352('0x1d')]=qs[_0x7352('0x1d')](_0x593e18[_0x7352('0x30')][_0x7352('0x1d')]);_0x40d71e[_0x7352('0x1a')]=qs['offset'](_0x593e18['query']['offset']);}_0x40d71e[_0x7352('0x37')]=qs[_0x7352('0x38')](_0x593e18[_0x7352('0x30')][_0x7352('0x38')]);_0x40d71e[_0x7352('0x39')]=qs[_0x7352('0x31')](_[_0x7352('0x3a')](_0x593e18[_0x7352('0x30')],_0x1efe6b[_0x7352('0x31')]),_0x24be12);if(_0x593e18[_0x7352('0x30')][_0x7352('0x3b')]){_0x40d71e[_0x7352('0x39')]=_[_0x7352('0x3c')](_0x40d71e[_0x7352('0x39')],{'$or':_[_0x7352('0x2a')](_0x24be12,function(_0x2086a5){if(_0x2086a5[_0x7352('0x2d')]!==_0x7352('0x3d')){var _0x4cdd0d={};_0x4cdd0d[_0x2086a5[_0x7352('0x27')]]={'$like':'%'+_0x593e18['query']['filter']+'%'};return _0x4cdd0d;}})});}_0x40d71e=_[_0x7352('0x3c')]({},_0x40d71e,_0x593e18[_0x7352('0x3e')]);var _0x281e34={'where':_0x40d71e[_0x7352('0x39')]};return db[_0x7352('0x3f')][_0x7352('0x1c')](_0x281e34)[_0x7352('0x22')](function(_0x496e34){_0x5864b7['count']=_0x496e34;if(_0x593e18['query'][_0x7352('0x40')]){_0x40d71e['include']=[{'all':!![]}];}return db[_0x7352('0x3f')][_0x7352('0x41')](_0x40d71e);})[_0x7352('0x22')](function(_0x26f24b){_0x5864b7['rows']=_0x26f24b;return _0x5864b7;})[_0x7352('0x22')](respondWithFilteredResult(_0x34ed41,_0x40d71e))[_0x7352('0x42')](handleError(_0x34ed41,null));};exports[_0x7352('0x43')]=function(_0x615840,_0x25c854){var _0x2f4c56={'raw':!![],'where':{'id':_0x615840[_0x7352('0x44')]['id']}},_0x402bdd={};_0x402bdd[_0x7352('0x2f')]=_[_0x7352('0x45')](db['SquareDetailsReport'][_0x7352('0x2b')]);_0x402bdd[_0x7352('0x30')]=_[_0x7352('0x45')](_0x615840[_0x7352('0x30')]);_0x402bdd[_0x7352('0x31')]=_[_0x7352('0x32')](_0x402bdd[_0x7352('0x2f')],_0x402bdd[_0x7352('0x30')]);_0x2f4c56[_0x7352('0x33')]=_['intersection'](_0x402bdd[_0x7352('0x2f')],qs[_0x7352('0x34')](_0x615840[_0x7352('0x30')][_0x7352('0x34')]));_0x2f4c56[_0x7352('0x33')]=_0x2f4c56['attributes'][_0x7352('0x35')]?_0x2f4c56[_0x7352('0x33')]:_0x402bdd[_0x7352('0x2f')];if(_0x615840['query']['includeAll']){_0x2f4c56[_0x7352('0x46')]=[{'all':!![]}];}_0x2f4c56=_[_0x7352('0x3c')]({},_0x2f4c56,_0x615840[_0x7352('0x3e')]);return db[_0x7352('0x3f')][_0x7352('0x47')](_0x2f4c56)[_0x7352('0x22')](handleEntityNotFound(_0x25c854,null))[_0x7352('0x22')](respondWithResult(_0x25c854,null))['catch'](handleError(_0x25c854,null));};exports['create']=function(_0x174ed9,_0x228265){return db[_0x7352('0x3f')][_0x7352('0x48')](_0x174ed9[_0x7352('0x49')],{})[_0x7352('0x22')](respondWithResult(_0x228265,0xc9))['catch'](handleError(_0x228265,null));};exports[_0x7352('0x21')]=function(_0x424ac8,_0x2aacdd){if(_0x424ac8['body']['id']){delete _0x424ac8['body']['id'];}return db[_0x7352('0x3f')][_0x7352('0x47')]({'where':{'id':_0x424ac8[_0x7352('0x44')]['id']}})[_0x7352('0x22')](handleEntityNotFound(_0x2aacdd,null))[_0x7352('0x22')](saveUpdates(_0x424ac8['body'],null))[_0x7352('0x22')](respondWithResult(_0x2aacdd,null))[_0x7352('0x42')](handleError(_0x2aacdd,null));};exports[_0x7352('0x23')]=function(_0x496277,_0x34d29f){return db[_0x7352('0x3f')][_0x7352('0x47')]({'where':{'id':_0x496277[_0x7352('0x44')]['id']}})['then'](handleEntityNotFound(_0x34d29f,null))[_0x7352('0x22')](removeEntity(_0x34d29f,null))[_0x7352('0x42')](handleError(_0x34d29f,null));};exports['describe']=function(_0x51a7ae,_0x50055b){return db[_0x7352('0x3f')][_0x7352('0x4a')]()[_0x7352('0x22')](respondWithResult(_0x50055b,null))[_0x7352('0x42')](handleError(_0x50055b,null));}; \ No newline at end of file +var _0xbc2c=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x260a62,_0x231089){var _0x107210=function(_0x4efede){while(--_0x4efede){_0x260a62['push'](_0x260a62['shift']());}};_0x107210(++_0x231089);}(_0xbc2c,0x154));var _0xcbc2=function(_0x37be36,_0x18fe03){_0x37be36=_0x37be36-0x0;var _0x47108e=_0xbc2c[_0x37be36];return _0x47108e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcbc2('0x0'));var zipdir=require(_0xcbc2('0x1'));var jsonpatch=require(_0xcbc2('0x2'));var rp=require(_0xcbc2('0x3'));var moment=require(_0xcbc2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcbc2('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcbc2('0x6'));var fs=require('fs');var fs_extra=require(_0xcbc2('0x7'));var _=require(_0xcbc2('0x8'));var squel=require(_0xcbc2('0x9'));var crypto=require(_0xcbc2('0xa'));var jsforce=require(_0xcbc2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcbc2('0xc'));var querystring=require(_0xcbc2('0xd'));var Papa=require(_0xcbc2('0xe'));var Redis=require('ioredis');var authService=require(_0xcbc2('0xf'));var qs=require(_0xcbc2('0x10'));var as=require(_0xcbc2('0x11'));var hardwareService=require(_0xcbc2('0x12'));var logger=require(_0xcbc2('0x13'))('api');var utils=require(_0xcbc2('0x14'));var config=require(_0xcbc2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbc2('0x16'))['db'];function respondWithStatusCode(_0x2601c3,_0x5bd24b){_0x5bd24b=_0x5bd24b||0xcc;return function(_0x69ed43){if(_0x69ed43){return _0x2601c3[_0xcbc2('0x17')](_0x5bd24b);}return _0x2601c3[_0xcbc2('0x18')](_0x5bd24b)[_0xcbc2('0x19')]();};}function respondWithResult(_0x230a7d,_0x483d1f){_0x483d1f=_0x483d1f||0xc8;return function(_0x7d2ac8){if(_0x7d2ac8){return _0x230a7d[_0xcbc2('0x18')](_0x483d1f)[_0xcbc2('0x1a')](_0x7d2ac8);}};}function respondWithFilteredResult(_0x1b94d2,_0xee5d19){return function(_0x39185c){if(_0x39185c){var _0x31580f=typeof _0xee5d19[_0xcbc2('0x1b')]==='undefined'&&typeof _0xee5d19[_0xcbc2('0x1c')]===_0xcbc2('0x1d');var _0x44a592=_0x39185c['count'];var _0x40e8c1=_0x31580f?0x0:_0xee5d19['offset'];var _0x1ec9e5=_0x31580f?_0x39185c[_0xcbc2('0x1e')]:_0xee5d19[_0xcbc2('0x1b')]+_0xee5d19['limit'];var _0xd70e0b;if(_0x1ec9e5>=_0x44a592){_0x1ec9e5=_0x44a592;_0xd70e0b=0xc8;}else{_0xd70e0b=0xce;}_0x1b94d2['status'](_0xd70e0b);return _0x1b94d2[_0xcbc2('0x1f')](_0xcbc2('0x20'),_0x40e8c1+'-'+_0x1ec9e5+'/'+_0x44a592)[_0xcbc2('0x1a')](_0x39185c);}return null;};}function patchUpdates(_0x5898f5){return function(_0x72e127){try{jsonpatch[_0xcbc2('0x21')](_0x72e127,_0x5898f5,!![]);}catch(_0x49383a){return BPromise['reject'](_0x49383a);}return _0x72e127[_0xcbc2('0x22')]();};}function saveUpdates(_0x3852eb,_0x35fa91){return function(_0x544d8a){if(_0x544d8a){return _0x544d8a[_0xcbc2('0x23')](_0x3852eb)[_0xcbc2('0x24')](function(_0x4e9b5b){return _0x4e9b5b;});}return null;};}function removeEntity(_0x516268,_0x41c16c){return function(_0x5536d7){if(_0x5536d7){return _0x5536d7[_0xcbc2('0x25')]()[_0xcbc2('0x24')](function(){_0x516268[_0xcbc2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0405,_0x13d3b9){return function(_0x4a45f4){if(!_0x4a45f4){_0x5e0405[_0xcbc2('0x17')](0x194);}return _0x4a45f4;};}function handleError(_0x573f30,_0x568ea2){_0x568ea2=_0x568ea2||0x1f4;return function(_0x42e6db){logger[_0xcbc2('0x26')](_0x42e6db[_0xcbc2('0x27')]);if(_0x42e6db[_0xcbc2('0x28')]){delete _0x42e6db[_0xcbc2('0x28')];}_0x573f30[_0xcbc2('0x18')](_0x568ea2)['send'](_0x42e6db);};}exports[_0xcbc2('0x29')]=function(_0xa031de,_0x4c5e79){var _0x33c4bb={},_0x410037={},_0x2bcac3={'count':0x0,'rows':[]};var _0x20e2e3=_[_0xcbc2('0x2a')](db[_0xcbc2('0x2b')][_0xcbc2('0x2c')],function(_0x3e063a){return{'name':_0x3e063a[_0xcbc2('0x2d')],'type':_0x3e063a['type']['key']};});_0x410037[_0xcbc2('0x2e')]=_[_0xcbc2('0x2a')](_0x20e2e3,_0xcbc2('0x28'));_0x410037[_0xcbc2('0x2f')]=_[_0xcbc2('0x30')](_0xa031de[_0xcbc2('0x2f')]);_0x410037[_0xcbc2('0x31')]=_['intersection'](_0x410037['model'],_0x410037[_0xcbc2('0x2f')]);_0x33c4bb[_0xcbc2('0x32')]=_[_0xcbc2('0x33')](_0x410037['model'],qs[_0xcbc2('0x34')](_0xa031de[_0xcbc2('0x2f')]['fields']));_0x33c4bb[_0xcbc2('0x32')]=_0x33c4bb[_0xcbc2('0x32')][_0xcbc2('0x35')]?_0x33c4bb[_0xcbc2('0x32')]:_0x410037[_0xcbc2('0x2e')];if(!_0xa031de[_0xcbc2('0x2f')][_0xcbc2('0x36')](_0xcbc2('0x37'))){_0x33c4bb[_0xcbc2('0x1c')]=qs['limit'](_0xa031de[_0xcbc2('0x2f')][_0xcbc2('0x1c')]);_0x33c4bb['offset']=qs['offset'](_0xa031de[_0xcbc2('0x2f')]['offset']);}_0x33c4bb['order']=qs[_0xcbc2('0x38')](_0xa031de[_0xcbc2('0x2f')][_0xcbc2('0x38')]);_0x33c4bb[_0xcbc2('0x39')]=qs[_0xcbc2('0x31')](_[_0xcbc2('0x3a')](_0xa031de[_0xcbc2('0x2f')],_0x410037[_0xcbc2('0x31')]),_0x20e2e3);if(_0xa031de[_0xcbc2('0x2f')]['filter']){_0x33c4bb[_0xcbc2('0x39')]=_[_0xcbc2('0x3b')](_0x33c4bb[_0xcbc2('0x39')],{'$or':_['map'](_0x20e2e3,function(_0x529157){if(_0x529157[_0xcbc2('0x3c')]!==_0xcbc2('0x3d')){var _0x10c4f7={};_0x10c4f7[_0x529157['name']]={'$like':'%'+_0xa031de[_0xcbc2('0x2f')][_0xcbc2('0x3e')]+'%'};return _0x10c4f7;}})});}_0x33c4bb=_['merge']({},_0x33c4bb,_0xa031de[_0xcbc2('0x3f')]);var _0x8c6f4d={'where':_0x33c4bb['where']};return db[_0xcbc2('0x2b')]['count'](_0x8c6f4d)[_0xcbc2('0x24')](function(_0x304de6){_0x2bcac3[_0xcbc2('0x1e')]=_0x304de6;if(_0xa031de[_0xcbc2('0x2f')][_0xcbc2('0x40')]){_0x33c4bb[_0xcbc2('0x41')]=[{'all':!![]}];}return db[_0xcbc2('0x2b')]['findAll'](_0x33c4bb);})[_0xcbc2('0x24')](function(_0x20f534){_0x2bcac3[_0xcbc2('0x42')]=_0x20f534;return _0x2bcac3;})[_0xcbc2('0x24')](respondWithFilteredResult(_0x4c5e79,_0x33c4bb))[_0xcbc2('0x43')](handleError(_0x4c5e79,null));};exports[_0xcbc2('0x44')]=function(_0x5716c6,_0x182d47){var _0x1f5aff={'raw':!![],'where':{'id':_0x5716c6[_0xcbc2('0x45')]['id']}},_0x2e18f2={};_0x2e18f2['model']=_[_0xcbc2('0x30')](db[_0xcbc2('0x2b')]['rawAttributes']);_0x2e18f2['query']=_[_0xcbc2('0x30')](_0x5716c6[_0xcbc2('0x2f')]);_0x2e18f2[_0xcbc2('0x31')]=_['intersection'](_0x2e18f2[_0xcbc2('0x2e')],_0x2e18f2['query']);_0x1f5aff['attributes']=_[_0xcbc2('0x33')](_0x2e18f2[_0xcbc2('0x2e')],qs[_0xcbc2('0x34')](_0x5716c6[_0xcbc2('0x2f')][_0xcbc2('0x34')]));_0x1f5aff[_0xcbc2('0x32')]=_0x1f5aff[_0xcbc2('0x32')][_0xcbc2('0x35')]?_0x1f5aff[_0xcbc2('0x32')]:_0x2e18f2[_0xcbc2('0x2e')];if(_0x5716c6['query'][_0xcbc2('0x40')]){_0x1f5aff['include']=[{'all':!![]}];}_0x1f5aff=_[_0xcbc2('0x3b')]({},_0x1f5aff,_0x5716c6['options']);return db[_0xcbc2('0x2b')][_0xcbc2('0x46')](_0x1f5aff)[_0xcbc2('0x24')](handleEntityNotFound(_0x182d47,null))['then'](respondWithResult(_0x182d47,null))[_0xcbc2('0x43')](handleError(_0x182d47,null));};exports[_0xcbc2('0x47')]=function(_0x40a40a,_0xa81406){return db[_0xcbc2('0x2b')]['create'](_0x40a40a[_0xcbc2('0x48')],{})[_0xcbc2('0x24')](respondWithResult(_0xa81406,0xc9))['catch'](handleError(_0xa81406,null));};exports[_0xcbc2('0x23')]=function(_0x33992d,_0x45bfe0){if(_0x33992d[_0xcbc2('0x48')]['id']){delete _0x33992d[_0xcbc2('0x48')]['id'];}return db['SquareDetailsReport'][_0xcbc2('0x46')]({'where':{'id':_0x33992d[_0xcbc2('0x45')]['id']}})['then'](handleEntityNotFound(_0x45bfe0,null))['then'](saveUpdates(_0x33992d['body'],null))[_0xcbc2('0x24')](respondWithResult(_0x45bfe0,null))['catch'](handleError(_0x45bfe0,null));};exports[_0xcbc2('0x25')]=function(_0x56d1b7,_0x3c4079){return db[_0xcbc2('0x2b')][_0xcbc2('0x46')]({'where':{'id':_0x56d1b7[_0xcbc2('0x45')]['id']}})[_0xcbc2('0x24')](handleEntityNotFound(_0x3c4079,null))[_0xcbc2('0x24')](removeEntity(_0x3c4079,null))['catch'](handleError(_0x3c4079,null));};exports['describe']=function(_0x1ce260,_0x173e05){return db[_0xcbc2('0x2b')][_0xcbc2('0x49')]()['then'](respondWithResult(_0x173e05,null))[_0xcbc2('0x43')](handleError(_0x173e05,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 10d9aa6..2fece7b 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 _0x751f=['define','SquareDetailsReport','report_square_details','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x539281,_0xeef1e){var _0x223040=function(_0x495014){while(--_0x495014){_0x539281['push'](_0x539281['shift']());}};_0x223040(++_0xeef1e);}(_0x751f,0x107));var _0xf751=function(_0x747a79,_0x25d233){_0x747a79=_0x747a79-0x0;var _0x5c3229=_0x751f[_0x747a79];return _0x5c3229;};'use strict';var _=require('lodash');var util=require(_0xf751('0x0'));var logger=require('../../config/logger')(_0xf751('0x1'));var moment=require(_0xf751('0x2'));var BPromise=require(_0xf751('0x3'));var rp=require(_0xf751('0x4'));var fs=require('fs');var path=require(_0xf751('0x5'));var rimraf=require(_0xf751('0x6'));var config=require(_0xf751('0x7'));var attributes=require(_0xf751('0x8'));module[_0xf751('0x9')]=function(_0x15bcad,_0xbebaef){return _0x15bcad[_0xf751('0xa')](_0xf751('0xb'),attributes,{'tableName':_0xf751('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb08b=['./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x40f5b7,_0xb3243e){var _0x3c884a=function(_0x4fc27b){while(--_0x4fc27b){_0x40f5b7['push'](_0x40f5b7['shift']());}};_0x3c884a(++_0xb3243e);}(_0xb08b,0x194));var _0xbb08=function(_0x22206a,_0x4984dd){_0x22206a=_0x22206a-0x0;var _0x307b6d=_0xb08b[_0x22206a];return _0x307b6d;};'use strict';var _=require('lodash');var util=require(_0xbb08('0x0'));var logger=require(_0xbb08('0x1'))(_0xbb08('0x2'));var moment=require('moment');var BPromise=require(_0xbb08('0x3'));var rp=require(_0xbb08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb08('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb08('0x6'));module[_0xbb08('0x7')]=function(_0x4287fd,_0x52f66f){return _0x4287fd['define'](_0xbb08('0x8'),attributes,{'tableName':_0xbb08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 1603632..bb4861f 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 _0x7334=['error','code','message','request\x20sent','result','CreateSquareDetailsReport','create','body','options','raw','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x355fa6,_0x40e134){var _0x54cba7=function(_0x4dbfb0){while(--_0x4dbfb0){_0x355fa6['push'](_0x355fa6['shift']());}};_0x54cba7(++_0x40e134);}(_0x7334,0x184));var _0x4733=function(_0x48345f,_0x342aeb){_0x48345f=_0x48345f-0x0;var _0x50a725=_0x7334[_0x48345f];return _0x50a725;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['SquareDetailsReport'][_0x4733('0x18')](_0x1d2fb6[_0x4733('0x19')],{'raw':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![]})[_0x4733('0xc')](function(_0x7a4e0){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger[_0x4733('0xf')]('CreateSquareDetailsReport',_0x1d2fb6,JSON[_0x4733('0x11')](_0x7a4e0));_0x384e0c(_0x7a4e0);})[_0x4733('0x1c')](function(_0x478e34){logger[_0x4733('0x12')](_0x4733('0x17'),_0x478e34[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x478e34[_0x4733('0x14')]));});});}; \ No newline at end of file +var _0xc900=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc900,0xb3));var _0x0c90=function(_0x5e073e,_0x15c224){_0x5e073e=_0x5e073e-0x0;var _0x77851b=_0xc900[_0x5e073e];return _0x77851b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});}exports[_0x0c90('0x15')]=function(_0x42321a){var _0x57b9a6=this;return new Promise(function(_0xc3bb47,_0x38becc){return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x42321a['body'],{'raw':_0x42321a[_0x0c90('0x18')]?_0x42321a[_0x0c90('0x18')][_0x0c90('0x19')]===undefined?!![]:![]:!![]})[_0x0c90('0xb')](function(_0x315932){logger[_0x0c90('0xc')]('CreateSquareDetailsReport',_0x42321a);logger[_0x0c90('0xf')]('CreateSquareDetailsReport',_0x42321a,JSON[_0x0c90('0x11')](_0x315932));_0xc3bb47(_0x315932);})[_0x0c90('0x14')](function(_0x47b13c){logger[_0x0c90('0x12')](_0x0c90('0x15'),_0x47b13c[_0x0c90('0x13')],_0x42321a);_0x38becc(_0x57b9a6[_0x0c90('0x12')](0x1f4,_0x47b13c[_0x0c90('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7f4b85a..18d20cb 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 _0x66bb=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service'];(function(_0x24dc5d,_0x190ef5){var _0x1fb55b=function(_0x315abd){while(--_0x315abd){_0x24dc5d['push'](_0x24dc5d['shift']());}};_0x1fb55b(++_0x190ef5);}(_0x66bb,0x10b));var _0xb66b=function(_0x2fc930,_0x1c116e){_0x2fc930=_0x2fc930-0x0;var _0xedb9be=_0x66bb[_0x2fc930];return _0xedb9be;};'use strict';var express=require(_0xb66b('0x0'));var router=express[_0xb66b('0x1')]();var auth=require(_0xb66b('0x2'));var controller=require(_0xb66b('0x3'));router[_0xb66b('0x4')]('/',auth[_0xb66b('0x5')](),controller[_0xb66b('0x6')]);router[_0xb66b('0x4')](_0xb66b('0x7'),auth[_0xb66b('0x5')](),controller['killProcess']);module[_0xb66b('0x8')]=router; \ No newline at end of file +var _0x38a1=['get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller'];(function(_0xf2267d,_0x10c87c){var _0x207e0d=function(_0x12b23d){while(--_0x12b23d){_0xf2267d['push'](_0xf2267d['shift']());}};_0x207e0d(++_0x10c87c);}(_0x38a1,0xc5));var _0x138a=function(_0x161901,_0xbbd16c){_0x161901=_0x161901-0x0;var _0x3ac9a6=_0x38a1[_0x161901];return _0x3ac9a6;};'use strict';var express=require(_0x138a('0x0'));var router=express['Router']();var auth=require(_0x138a('0x1'));var controller=require(_0x138a('0x2'));router[_0x138a('0x3')]('/',auth[_0x138a('0x4')](),controller['index']);router['get'](_0x138a('0x5'),auth['isAuthenticated'](),controller[_0x138a('0x6')]);module[_0x138a('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 34eebf9..fee0e3f 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 _0xb464=['split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','util','lodash','error','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','pid'];(function(_0x5883b8,_0xc98e6b){var _0x6f0c33=function(_0x16e63f){while(--_0x16e63f){_0x5883b8['push'](_0x5883b8['shift']());}};_0x6f0c33(++_0xc98e6b);}(_0xb464,0x80));var _0x4b46=function(_0x177aa9,_0x262243){_0x177aa9=_0x177aa9-0x0;var _0x27d3e7=_0xb464[_0x177aa9];return _0x27d3e7;};'use strict';var info=require(_0x4b46('0x0'));var exec=require(_0x4b46('0x1'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x4b46('0x2'));var BPromise=require('bluebird');var _=require(_0x4b46('0x3'));function handleError(_0x2fc90d,_0x1c3945,_0xb0b3a5){_0x1c3945=_0x1c3945||0x1f4;return function(_0x409922){logger[_0x4b46('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0xb0b3a5,_0x1c3945,util['inspect'](_0x409922,{'showHidden':![],'depth':null}));delete _0x409922['name'];_0x2fc90d[_0x4b46('0x5')](_0x1c3945)[_0x4b46('0x6')](_0x409922);};}exports[_0x4b46('0x7')]=function(_0x14a08d,_0x558187){return info[_0x4b46('0x8')]()[_0x4b46('0x9')](function(_0x273484){return _0x558187[_0x4b46('0x5')](0xc8)[_0x4b46('0xa')](_0x273484);})[_0x4b46('0xb')](function(_0x55e110){return _0x558187['status'](0x1f4)[_0x4b46('0xa')](_0x55e110);});};exports[_0x4b46('0xc')]=function(_0x1e5b92,_0x115ebf){var _0x128fb3=[_0x4b46('0xd')];return new BPromise(function(_0x103e2f,_0x82f300){return exec(util[_0x4b46('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1e5b92['params'][_0x4b46('0xf')]),function(_0x2bab33,_0x488469,_0x6b7b38){if(_0x2bab33){return _0x82f300(_0x2bab33);}return _0x103e2f(_0x488469);});})[_0x4b46('0x9')](function(_0x5a5d85){var _0x288f86=![];var _0x2f8f61=_0x5a5d85[_0x4b46('0x10')](/\n/);for(var _0x1ae148=0x0,_0x1f92f7=_0x128fb3[_0x4b46('0x11')];_0x1ae148<_0x1f92f7,_0x288f86===![];_0x1ae148+=0x1){if(_0x5a5d85[_0x4b46('0x12')](_0x128fb3[_0x1ae148])>=0x0){_0x288f86=!![];}}if(!_0x288f86){throw new Error(util[_0x4b46('0xe')](_0x4b46('0x13'),_0x1e5b92[_0x4b46('0x14')][_0x4b46('0xf')]));}process[_0x4b46('0x15')](_0x1e5b92[_0x4b46('0x14')][_0x4b46('0xf')],_0x4b46('0x16'));return _0x115ebf[_0x4b46('0x5')](0xc8)[_0x4b46('0xa')]({'message':util[_0x4b46('0xe')](_0x4b46('0x17'),_0x1e5b92[_0x4b46('0x14')][_0x4b46('0xf')])});})[_0x4b46('0xb')](handleError(_0x115ebf,null,_0x4b46('0xc')));}; \ No newline at end of file +var _0x359b=['api','util','bluebird','error','inspect','name','index','getAllData','then','json','catch','status','killProcess','format','params','pid','split','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec'];(function(_0x3d885a,_0x352a08){var _0x497b5b=function(_0x1cb548){while(--_0x1cb548){_0x3d885a['push'](_0x3d885a['shift']());}};_0x497b5b(++_0x352a08);}(_0x359b,0x184));var _0xb359=function(_0x3d12da,_0x457ad7){_0x3d12da=_0x3d12da-0x0;var _0x483317=_0x359b[_0x3d12da];return _0x483317;};'use strict';var info=require(_0xb359('0x0'));var exec=require(_0xb359('0x1'))[_0xb359('0x2')];var logger=require('../../config/logger')(_0xb359('0x3'));var util=require(_0xb359('0x4'));var BPromise=require(_0xb359('0x5'));var _=require('lodash');function handleError(_0x2501d9,_0x5b4add,_0x229cf2){_0x5b4add=_0x5b4add||0x1f4;return function(_0x3274a8){logger[_0xb359('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x229cf2,_0x5b4add,util[_0xb359('0x7')](_0x3274a8,{'showHidden':![],'depth':null}));delete _0x3274a8[_0xb359('0x8')];_0x2501d9['status'](_0x5b4add)['send'](_0x3274a8);};}exports[_0xb359('0x9')]=function(_0x31dc5a,_0x2d54cb){return info[_0xb359('0xa')]()[_0xb359('0xb')](function(_0x112b32){return _0x2d54cb['status'](0xc8)[_0xb359('0xc')](_0x112b32);})[_0xb359('0xd')](function(_0x375fe9){return _0x2d54cb[_0xb359('0xe')](0x1f4)['json'](_0x375fe9);});};exports[_0xb359('0xf')]=function(_0x12a712,_0x1b19b9){var _0xd5ac9c=['components/import/cm'];return new BPromise(function(_0x16296e,_0x3fcfbc){return exec(util[_0xb359('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x12a712[_0xb359('0x11')][_0xb359('0x12')]),function(_0x31d6fb,_0x3ec08e,_0x4891f7){if(_0x31d6fb){return _0x3fcfbc(_0x31d6fb);}return _0x16296e(_0x3ec08e);});})['then'](function(_0x396da3){var _0x1aaabd=![];var _0xd75062=_0x396da3[_0xb359('0x13')](/\n/);for(var _0x5e92b5=0x0,_0x3d4af4=_0xd5ac9c['length'];_0x5e92b5<_0x3d4af4,_0x1aaabd===![];_0x5e92b5+=0x1){if(_0x396da3[_0xb359('0x14')](_0xd5ac9c[_0x5e92b5])>=0x0){_0x1aaabd=!![];}}if(!_0x1aaabd){throw new Error(util[_0xb359('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x12a712['params'][_0xb359('0x12')]));}process[_0xb359('0x15')](_0x12a712['params']['pid'],'SIGINT');return _0x1b19b9[_0xb359('0xe')](0xc8)[_0xb359('0xc')]({'message':util[_0xb359('0x10')](_0xb359('0x16'),_0x12a712[_0xb359('0x11')][_0xb359('0x12')])});})[_0xb359('0xd')](handleError(_0x1b19b9,null,_0xb359('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3188a90..4516eca 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 _0x1678=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x9f5b74,_0x228fd4){var _0x459dfe=function(_0x9c9771){while(--_0x9c9771){_0x9f5b74['push'](_0x9f5b74['shift']());}};_0x459dfe(++_0x228fd4);}(_0x1678,0x17b));var _0x8167=function(_0x2174b9,_0x8d2817){_0x2174b9=_0x2174b9-0x0;var _0x30fcf4=_0x1678[_0x2174b9];return _0x30fcf4;};'use strict';var multer=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var path=require(_0x8167('0x2'));var timeout=require(_0x8167('0x3'));var express=require(_0x8167('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8167('0x5'));var interaction=require(_0x8167('0x6'));var config=require(_0x8167('0x7'));var controller=require(_0x8167('0x8'));router[_0x8167('0x9')]('/',auth[_0x8167('0xa')](),controller[_0x8167('0xb')]);router['get'](_0x8167('0xc'),auth[_0x8167('0xa')](),controller[_0x8167('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8167('0xe')]);router[_0x8167('0xf')]('/:id',auth[_0x8167('0xa')](),controller[_0x8167('0x10')]);router[_0x8167('0x11')](_0x8167('0xc'),auth[_0x8167('0xa')](),controller[_0x8167('0x12')]);module[_0x8167('0x13')]=router; \ No newline at end of file +var _0xbca0=['../../components/interaction/service','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0xbca0,0x8b));var _0x0bca=function(_0x86ca33,_0x3e36c0){_0x86ca33=_0x86ca33-0x0;var _0x81030a=_0xbca0[_0x86ca33];return _0x81030a;};'use strict';var multer=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0bca('0x2')]();var fs_extra=require(_0x0bca('0x3'));var auth=require(_0x0bca('0x4'));var interaction=require(_0x0bca('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x0bca('0x6')]('/',auth[_0x0bca('0x7')](),controller[_0x0bca('0x8')]);router[_0x0bca('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0bca('0x9')]('/',auth[_0x0bca('0x7')](),controller[_0x0bca('0xa')]);router[_0x0bca('0xb')](_0x0bca('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0bca('0xd')](_0x0bca('0xc'),auth[_0x0bca('0x7')](),controller[_0x0bca('0xe')]);module[_0x0bca('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 813c6e3..15d3f4c 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 _0x7269=['STRING','#0091EA','sequelize','exports'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0x7269,0x76));var _0x9726=function(_0x2fe50e,_0x5de1e1){_0x2fe50e=_0x2fe50e-0x0;var _0x39c5f3=_0x7269[_0x2fe50e];return _0x39c5f3;};'use strict';var Sequelize=require(_0x9726('0x0'));module[_0x9726('0x1')]={'name':{'type':Sequelize[_0x9726('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x9726('0x3')},'description':{'type':Sequelize[_0x9726('0x2')]}}; \ No newline at end of file +var _0xa846=['exports','STRING','name','#0091EA'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0xa846,0x70));var _0x6a84=function(_0x40b305,_0x15524e){_0x40b305=_0x40b305-0x0;var _0xa270d3=_0xa846[_0x40b305];return _0xa270d3;};'use strict';var Sequelize=require('sequelize');module[_0x6a84('0x0')]={'name':{'type':Sequelize[_0x6a84('0x1')],'unique':_0x6a84('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6a84('0x1')],'defaultValue':_0x6a84('0x3')},'description':{'type':Sequelize[_0x6a84('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 4f7854c..a1ece88 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 _0x222f=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x7e366c,_0x587167){var _0x13dd0e=function(_0x523b8c){while(--_0x523b8c){_0x7e366c['push'](_0x7e366c['shift']());}};_0x13dd0e(++_0x587167);}(_0x222f,0x1a4));var _0xf222=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x222f[_0x1b64dd];return _0xeb464c;};'use strict';var emlformat=require(_0xf222('0x0'));var rimraf=require(_0xf222('0x1'));var zipdir=require(_0xf222('0x2'));var jsonpatch=require(_0xf222('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf222('0x4'));var Mustache=require(_0xf222('0x5'));var util=require(_0xf222('0x6'));var path=require(_0xf222('0x7'));var sox=require('sox');var csv=require(_0xf222('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf222('0x9'));var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0x8'));var querystring=require(_0xf222('0xd'));var Papa=require(_0xf222('0xe'));var Redis=require(_0xf222('0xf'));var authService=require(_0xf222('0x10'));var qs=require(_0xf222('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x12'));var logger=require(_0xf222('0x13'))(_0xf222('0x14'));var utils=require(_0xf222('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x16'));var db=require(_0xf222('0x17'))['db'];function respondWithStatusCode(_0x2a6965,_0x3d3d29){_0x3d3d29=_0x3d3d29||0xcc;return function(_0x12f968){if(_0x12f968){return _0x2a6965[_0xf222('0x18')](_0x3d3d29);}return _0x2a6965[_0xf222('0x19')](_0x3d3d29)[_0xf222('0x1a')]();};}function respondWithResult(_0x52a003,_0x5b8f97){_0x5b8f97=_0x5b8f97||0xc8;return function(_0x1feb86){if(_0x1feb86){return _0x52a003[_0xf222('0x19')](_0x5b8f97)['json'](_0x1feb86);}};}function respondWithFilteredResult(_0x39be58,_0x43d35b){return function(_0x464f3e){if(_0x464f3e){var _0x4392a0=typeof _0x43d35b[_0xf222('0x1b')]===_0xf222('0x1c')&&typeof _0x43d35b[_0xf222('0x1d')]==='undefined';var _0x1efa9f=_0x464f3e[_0xf222('0x1e')];var _0x8783ab=_0x4392a0?0x0:_0x43d35b[_0xf222('0x1b')];var _0x12a2e4=_0x4392a0?_0x464f3e[_0xf222('0x1e')]:_0x43d35b[_0xf222('0x1b')]+_0x43d35b['limit'];var _0xf26a16;if(_0x12a2e4>=_0x1efa9f){_0x12a2e4=_0x1efa9f;_0xf26a16=0xc8;}else{_0xf26a16=0xce;}_0x39be58[_0xf222('0x19')](_0xf26a16);return _0x39be58[_0xf222('0x1f')](_0xf222('0x20'),_0x8783ab+'-'+_0x12a2e4+'/'+_0x1efa9f)['json'](_0x464f3e);}return null;};}function patchUpdates(_0x5cd899){return function(_0x398ff4){try{jsonpatch[_0xf222('0x21')](_0x398ff4,_0x5cd899,!![]);}catch(_0x201cf0){return BPromise[_0xf222('0x22')](_0x201cf0);}return _0x398ff4[_0xf222('0x23')]();};}function saveUpdates(_0x151a89,_0x51b872){return function(_0x176b20){if(_0x176b20){return _0x176b20[_0xf222('0x24')](_0x151a89)[_0xf222('0x25')](function(_0x12d443){return _0x12d443;});}return null;};}function removeEntity(_0x2c48ce,_0x2d18ab){return function(_0x4616de){if(_0x4616de){return _0x4616de[_0xf222('0x26')]()['then'](function(){var _0x145e2e=_0x4616de[_0xf222('0x27')]({'plain':!![]});var _0x1883c1=_0xf222('0x28');return db[_0xf222('0x29')][_0xf222('0x26')]({'where':{'type':_0x1883c1,'resourceId':_0x145e2e['id']}})[_0xf222('0x25')](function(){return _0x4616de;});})[_0xf222('0x25')](function(){_0x2c48ce[_0xf222('0x19')](0xcc)[_0xf222('0x1a')]();});}};}function handleEntityNotFound(_0x2a8310,_0x501f8e){return function(_0x14b2b1){if(!_0x14b2b1){_0x2a8310[_0xf222('0x18')](0x194);}return _0x14b2b1;};}function handleError(_0x3d5508,_0x2f04bf){_0x2f04bf=_0x2f04bf||0x1f4;return function(_0xe41039){logger[_0xf222('0x2a')](_0xe41039[_0xf222('0x2b')]);if(_0xe41039[_0xf222('0x2c')]){delete _0xe41039[_0xf222('0x2c')];}_0x3d5508['status'](_0x2f04bf)[_0xf222('0x2d')](_0xe41039);};}exports[_0xf222('0x2e')]=function(_0x3ffc30,_0x53a382){var _0x3ccc9e={},_0x5d5963={},_0x40c7e7={'count':0x0,'rows':[]};var _0x27a8cc=_[_0xf222('0x2f')](db[_0xf222('0x30')][_0xf222('0x31')],function(_0x152d79){return{'name':_0x152d79[_0xf222('0x32')],'type':_0x152d79['type']['key']};});_0x5d5963[_0xf222('0x33')]=_[_0xf222('0x2f')](_0x27a8cc,_0xf222('0x2c'));_0x5d5963[_0xf222('0x34')]=_[_0xf222('0x35')](_0x3ffc30[_0xf222('0x34')]);_0x5d5963['filters']=_[_0xf222('0x36')](_0x5d5963[_0xf222('0x33')],_0x5d5963[_0xf222('0x34')]);_0x3ccc9e['attributes']=_[_0xf222('0x36')](_0x5d5963[_0xf222('0x33')],qs[_0xf222('0x37')](_0x3ffc30['query'][_0xf222('0x37')]));_0x3ccc9e[_0xf222('0x38')]=_0x3ccc9e[_0xf222('0x38')]['length']?_0x3ccc9e[_0xf222('0x38')]:_0x5d5963[_0xf222('0x33')];if(!_0x3ffc30[_0xf222('0x34')][_0xf222('0x39')](_0xf222('0x3a'))){_0x3ccc9e['limit']=qs[_0xf222('0x1d')](_0x3ffc30['query'][_0xf222('0x1d')]);_0x3ccc9e[_0xf222('0x1b')]=qs[_0xf222('0x1b')](_0x3ffc30['query'][_0xf222('0x1b')]);}_0x3ccc9e[_0xf222('0x3b')]=qs['sort'](_0x3ffc30[_0xf222('0x34')]['sort']);_0x3ccc9e[_0xf222('0x3c')]=qs[_0xf222('0x3d')](_[_0xf222('0x3e')](_0x3ffc30['query'],_0x5d5963[_0xf222('0x3d')]),_0x27a8cc);if(_0x3ffc30[_0xf222('0x34')][_0xf222('0x3f')]){_0x3ccc9e[_0xf222('0x3c')]=_[_0xf222('0x40')](_0x3ccc9e[_0xf222('0x3c')],{'$or':_['map'](_0x27a8cc,function(_0x1ae1d4){if(_0x1ae1d4[_0xf222('0x41')]!=='VIRTUAL'){var _0x49cad2={};_0x49cad2[_0x1ae1d4[_0xf222('0x2c')]]={'$like':'%'+_0x3ffc30['query'][_0xf222('0x3f')]+'%'};return _0x49cad2;}})});}_0x3ccc9e=_[_0xf222('0x40')]({},_0x3ccc9e,_0x3ffc30[_0xf222('0x42')]);var _0xc16fcb={'where':_0x3ccc9e['where']};return db['Tag'][_0xf222('0x1e')](_0xc16fcb)['then'](function(_0x522a9e){_0x40c7e7[_0xf222('0x1e')]=_0x522a9e;if(_0x3ffc30[_0xf222('0x34')][_0xf222('0x43')]){_0x3ccc9e[_0xf222('0x44')]=[{'all':!![]}];}return db[_0xf222('0x30')][_0xf222('0x45')](_0x3ccc9e);})['then'](function(_0xf829ae){_0x40c7e7[_0xf222('0x46')]=_0xf829ae;return _0x40c7e7;})['then'](respondWithFilteredResult(_0x53a382,_0x3ccc9e))[_0xf222('0x47')](handleError(_0x53a382,null));};exports[_0xf222('0x48')]=function(_0x56a5f0,_0x19cb67){var _0x51ed52={'raw':!![],'where':{'id':_0x56a5f0[_0xf222('0x49')]['id']}},_0x149589={};_0x149589[_0xf222('0x33')]=_[_0xf222('0x35')](db[_0xf222('0x30')][_0xf222('0x31')]);_0x149589[_0xf222('0x34')]=_[_0xf222('0x35')](_0x56a5f0[_0xf222('0x34')]);_0x149589[_0xf222('0x3d')]=_[_0xf222('0x36')](_0x149589['model'],_0x149589['query']);_0x51ed52['attributes']=_[_0xf222('0x36')](_0x149589[_0xf222('0x33')],qs[_0xf222('0x37')](_0x56a5f0[_0xf222('0x34')]['fields']));_0x51ed52[_0xf222('0x38')]=_0x51ed52[_0xf222('0x38')][_0xf222('0x4a')]?_0x51ed52[_0xf222('0x38')]:_0x149589['model'];if(_0x56a5f0[_0xf222('0x34')][_0xf222('0x43')]){_0x51ed52[_0xf222('0x44')]=[{'all':!![]}];}_0x51ed52=_[_0xf222('0x40')]({},_0x51ed52,_0x56a5f0[_0xf222('0x42')]);return db[_0xf222('0x30')][_0xf222('0x4b')](_0x51ed52)[_0xf222('0x25')](handleEntityNotFound(_0x19cb67,null))[_0xf222('0x25')](respondWithResult(_0x19cb67,null))[_0xf222('0x47')](handleError(_0x19cb67,null));};exports['create']=function(_0x5d0d70,_0x193762){return db['Tag'][_0xf222('0x4c')](_0x5d0d70['body'],{})[_0xf222('0x25')](function(_0x4e9083){var _0x2d8a04=_0x5d0d70[_0xf222('0x4d')][_0xf222('0x27')]({'plain':!![]});if(!_0x2d8a04)throw new Error(_0xf222('0x4e'));if(_0x2d8a04['role']===_0xf222('0x4d')){var _0x34fd50=_0x4e9083[_0xf222('0x27')]({'plain':!![]});var _0x2dc8d2=_0xf222('0x28');return db[_0xf222('0x4f')][_0xf222('0x4b')]({'where':{'name':_0x2dc8d2,'userProfileId':_0x2d8a04[_0xf222('0x50')]},'raw':!![]})[_0xf222('0x25')](function(_0x8e620){if(_0x8e620&&_0x8e620[_0xf222('0x51')]===0x0){return db[_0xf222('0x29')]['create']({'name':_0x34fd50['name'],'resourceId':_0x34fd50['id'],'type':_0x8e620[_0xf222('0x2c')],'sectionId':_0x8e620['id']},{})[_0xf222('0x25')](function(){return _0x4e9083;});}else{return _0x4e9083;}})[_0xf222('0x47')](function(_0xfb75f0){logger[_0xf222('0x2a')](_0xf222('0x52'),_0xfb75f0);throw _0xfb75f0;});}return _0x4e9083;})[_0xf222('0x25')](respondWithResult(_0x193762,0xc9))[_0xf222('0x47')](handleError(_0x193762,null));};exports[_0xf222('0x24')]=function(_0x1e680a,_0x19d859){if(_0x1e680a['body']['id']){delete _0x1e680a['body']['id'];}return db[_0xf222('0x30')][_0xf222('0x4b')]({'where':{'id':_0x1e680a[_0xf222('0x49')]['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x19d859,null))[_0xf222('0x25')](saveUpdates(_0x1e680a[_0xf222('0x53')],null))[_0xf222('0x25')](respondWithResult(_0x19d859,null))[_0xf222('0x47')](handleError(_0x19d859,null));};exports[_0xf222('0x26')]=function(_0x1c4da4,_0x32ec77){return db[_0xf222('0x30')][_0xf222('0x4b')]({'where':{'id':_0x1c4da4[_0xf222('0x49')]['id']}})['then'](handleEntityNotFound(_0x32ec77,null))[_0xf222('0x25')](removeEntity(_0x32ec77,null))['catch'](handleError(_0x32ec77,null));}; \ No newline at end of file +var _0x55e0=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','get','Tags','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','options','Tag','findAll','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js'];(function(_0x1e3929,_0xb1541f){var _0x14675c=function(_0x48a241){while(--_0x48a241){_0x1e3929['push'](_0x1e3929['shift']());}};_0x14675c(++_0xb1541f);}(_0x55e0,0xdc));var _0x055e=function(_0x2ff139,_0x5146c8){_0x2ff139=_0x2ff139-0x0;var _0x50190d=_0x55e0[_0x2ff139];return _0x50190d;};'use strict';var emlformat=require(_0x055e('0x0'));var rimraf=require(_0x055e('0x1'));var zipdir=require(_0x055e('0x2'));var jsonpatch=require(_0x055e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x055e('0x4'));var Mustache=require(_0x055e('0x5'));var util=require(_0x055e('0x6'));var path=require(_0x055e('0x7'));var sox=require(_0x055e('0x8'));var csv=require(_0x055e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0x9'));var querystring=require(_0x055e('0xe'));var Papa=require('papaparse');var Redis=require(_0x055e('0xf'));var authService=require(_0x055e('0x10'));var qs=require(_0x055e('0x11'));var as=require(_0x055e('0x12'));var hardwareService=require(_0x055e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x055e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x055e('0x15'));var db=require(_0x055e('0x16'))['db'];function respondWithStatusCode(_0x72d424,_0x101bc3){_0x101bc3=_0x101bc3||0xcc;return function(_0xc98c6a){if(_0xc98c6a){return _0x72d424[_0x055e('0x17')](_0x101bc3);}return _0x72d424[_0x055e('0x18')](_0x101bc3)['end']();};}function respondWithResult(_0x14064d,_0xb80d83){_0xb80d83=_0xb80d83||0xc8;return function(_0x3cfd14){if(_0x3cfd14){return _0x14064d[_0x055e('0x18')](_0xb80d83)[_0x055e('0x19')](_0x3cfd14);}};}function respondWithFilteredResult(_0x56af18,_0x230674){return function(_0x2fe55f){if(_0x2fe55f){var _0x111cdb=typeof _0x230674['offset']===_0x055e('0x1a')&&typeof _0x230674[_0x055e('0x1b')]===_0x055e('0x1a');var _0x2bad86=_0x2fe55f[_0x055e('0x1c')];var _0x4c85dd=_0x111cdb?0x0:_0x230674[_0x055e('0x1d')];var _0x2cf3de=_0x111cdb?_0x2fe55f[_0x055e('0x1c')]:_0x230674[_0x055e('0x1d')]+_0x230674['limit'];var _0x4004ce;if(_0x2cf3de>=_0x2bad86){_0x2cf3de=_0x2bad86;_0x4004ce=0xc8;}else{_0x4004ce=0xce;}_0x56af18[_0x055e('0x18')](_0x4004ce);return _0x56af18['set'](_0x055e('0x1e'),_0x4c85dd+'-'+_0x2cf3de+'/'+_0x2bad86)[_0x055e('0x19')](_0x2fe55f);}return null;};}function patchUpdates(_0x10258f){return function(_0x124d86){try{jsonpatch[_0x055e('0x1f')](_0x124d86,_0x10258f,!![]);}catch(_0x4675ff){return BPromise['reject'](_0x4675ff);}return _0x124d86[_0x055e('0x20')]();};}function saveUpdates(_0x2f0346,_0x211594){return function(_0x5930ff){if(_0x5930ff){return _0x5930ff[_0x055e('0x21')](_0x2f0346)[_0x055e('0x22')](function(_0x32c64e){return _0x32c64e;});}return null;};}function removeEntity(_0x37243b,_0x51df23){return function(_0x71a6e1){if(_0x71a6e1){return _0x71a6e1['destroy']()[_0x055e('0x22')](function(){var _0x42a6aa=_0x71a6e1[_0x055e('0x23')]({'plain':!![]});var _0x1a76c6=_0x055e('0x24');return db[_0x055e('0x25')]['destroy']({'where':{'type':_0x1a76c6,'resourceId':_0x42a6aa['id']}})[_0x055e('0x22')](function(){return _0x71a6e1;});})[_0x055e('0x22')](function(){_0x37243b[_0x055e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x408e38,_0x29078a){return function(_0x42f2df){if(!_0x42f2df){_0x408e38[_0x055e('0x17')](0x194);}return _0x42f2df;};}function handleError(_0x59539d,_0x27f81a){_0x27f81a=_0x27f81a||0x1f4;return function(_0x5958ef){logger[_0x055e('0x26')](_0x5958ef[_0x055e('0x27')]);if(_0x5958ef[_0x055e('0x28')]){delete _0x5958ef[_0x055e('0x28')];}_0x59539d[_0x055e('0x18')](_0x27f81a)['send'](_0x5958ef);};}exports[_0x055e('0x29')]=function(_0x453e5e,_0x293062){var _0x1499e1={},_0x36abb2={},_0x225c88={'count':0x0,'rows':[]};var _0x59f8c4=_[_0x055e('0x2a')](db['Tag'][_0x055e('0x2b')],function(_0x43ec84){return{'name':_0x43ec84['fieldName'],'type':_0x43ec84[_0x055e('0x2c')][_0x055e('0x2d')]};});_0x36abb2[_0x055e('0x2e')]=_[_0x055e('0x2a')](_0x59f8c4,_0x055e('0x28'));_0x36abb2[_0x055e('0x2f')]=_['keys'](_0x453e5e['query']);_0x36abb2[_0x055e('0x30')]=_['intersection'](_0x36abb2['model'],_0x36abb2['query']);_0x1499e1[_0x055e('0x31')]=_[_0x055e('0x32')](_0x36abb2[_0x055e('0x2e')],qs[_0x055e('0x33')](_0x453e5e[_0x055e('0x2f')][_0x055e('0x33')]));_0x1499e1[_0x055e('0x31')]=_0x1499e1[_0x055e('0x31')][_0x055e('0x34')]?_0x1499e1[_0x055e('0x31')]:_0x36abb2[_0x055e('0x2e')];if(!_0x453e5e[_0x055e('0x2f')]['hasOwnProperty']('nolimit')){_0x1499e1[_0x055e('0x1b')]=qs[_0x055e('0x1b')](_0x453e5e[_0x055e('0x2f')][_0x055e('0x1b')]);_0x1499e1[_0x055e('0x1d')]=qs[_0x055e('0x1d')](_0x453e5e[_0x055e('0x2f')]['offset']);}_0x1499e1[_0x055e('0x35')]=qs[_0x055e('0x36')](_0x453e5e[_0x055e('0x2f')][_0x055e('0x36')]);_0x1499e1[_0x055e('0x37')]=qs['filters'](_[_0x055e('0x38')](_0x453e5e[_0x055e('0x2f')],_0x36abb2['filters']),_0x59f8c4);if(_0x453e5e[_0x055e('0x2f')][_0x055e('0x39')]){_0x1499e1['where']=_[_0x055e('0x3a')](_0x1499e1[_0x055e('0x37')],{'$or':_['map'](_0x59f8c4,function(_0x473004){if(_0x473004[_0x055e('0x2c')]!=='VIRTUAL'){var _0x1012a4={};_0x1012a4[_0x473004[_0x055e('0x28')]]={'$like':'%'+_0x453e5e[_0x055e('0x2f')]['filter']+'%'};return _0x1012a4;}})});}_0x1499e1=_[_0x055e('0x3a')]({},_0x1499e1,_0x453e5e[_0x055e('0x3b')]);var _0x574ea0={'where':_0x1499e1[_0x055e('0x37')]};return db[_0x055e('0x3c')][_0x055e('0x1c')](_0x574ea0)['then'](function(_0x228eca){_0x225c88[_0x055e('0x1c')]=_0x228eca;if(_0x453e5e[_0x055e('0x2f')]['includeAll']){_0x1499e1['include']=[{'all':!![]}];}return db[_0x055e('0x3c')][_0x055e('0x3d')](_0x1499e1);})['then'](function(_0x3a5bc5){_0x225c88['rows']=_0x3a5bc5;return _0x225c88;})[_0x055e('0x22')](respondWithFilteredResult(_0x293062,_0x1499e1))['catch'](handleError(_0x293062,null));};exports[_0x055e('0x3e')]=function(_0x31c57a,_0x358b53){var _0x48ad60={'raw':!![],'where':{'id':_0x31c57a[_0x055e('0x3f')]['id']}},_0x57483c={};_0x57483c[_0x055e('0x2e')]=_[_0x055e('0x40')](db[_0x055e('0x3c')]['rawAttributes']);_0x57483c['query']=_[_0x055e('0x40')](_0x31c57a[_0x055e('0x2f')]);_0x57483c['filters']=_[_0x055e('0x32')](_0x57483c[_0x055e('0x2e')],_0x57483c[_0x055e('0x2f')]);_0x48ad60[_0x055e('0x31')]=_[_0x055e('0x32')](_0x57483c[_0x055e('0x2e')],qs['fields'](_0x31c57a[_0x055e('0x2f')][_0x055e('0x33')]));_0x48ad60['attributes']=_0x48ad60[_0x055e('0x31')][_0x055e('0x34')]?_0x48ad60[_0x055e('0x31')]:_0x57483c[_0x055e('0x2e')];if(_0x31c57a[_0x055e('0x2f')][_0x055e('0x41')]){_0x48ad60[_0x055e('0x42')]=[{'all':!![]}];}_0x48ad60=_['merge']({},_0x48ad60,_0x31c57a[_0x055e('0x3b')]);return db['Tag'][_0x055e('0x43')](_0x48ad60)[_0x055e('0x22')](handleEntityNotFound(_0x358b53,null))[_0x055e('0x22')](respondWithResult(_0x358b53,null))['catch'](handleError(_0x358b53,null));};exports['create']=function(_0x45845e,_0x20114c){return db[_0x055e('0x3c')][_0x055e('0x44')](_0x45845e[_0x055e('0x45')],{})[_0x055e('0x22')](function(_0x128e11){var _0x3d5a54=_0x45845e[_0x055e('0x46')]['get']({'plain':!![]});if(!_0x3d5a54)throw new Error(_0x055e('0x47'));if(_0x3d5a54[_0x055e('0x48')]===_0x055e('0x46')){var _0x17695b=_0x128e11[_0x055e('0x23')]({'plain':!![]});var _0x5270b8=_0x055e('0x24');return db[_0x055e('0x49')][_0x055e('0x43')]({'where':{'name':_0x5270b8,'userProfileId':_0x3d5a54['userProfileId']},'raw':!![]})[_0x055e('0x22')](function(_0x4b185e){if(_0x4b185e&&_0x4b185e[_0x055e('0x4a')]===0x0){return db[_0x055e('0x25')]['create']({'name':_0x17695b[_0x055e('0x28')],'resourceId':_0x17695b['id'],'type':_0x4b185e[_0x055e('0x28')],'sectionId':_0x4b185e['id']},{})[_0x055e('0x22')](function(){return _0x128e11;});}else{return _0x128e11;}})['catch'](function(_0x5a91a9){logger[_0x055e('0x26')](_0x055e('0x4b'),_0x5a91a9);throw _0x5a91a9;});}return _0x128e11;})[_0x055e('0x22')](respondWithResult(_0x20114c,0xc9))[_0x055e('0x4c')](handleError(_0x20114c,null));};exports[_0x055e('0x21')]=function(_0x2ceb8d,_0x473e7a){if(_0x2ceb8d[_0x055e('0x45')]['id']){delete _0x2ceb8d[_0x055e('0x45')]['id'];}return db[_0x055e('0x3c')]['find']({'where':{'id':_0x2ceb8d[_0x055e('0x3f')]['id']}})[_0x055e('0x22')](handleEntityNotFound(_0x473e7a,null))[_0x055e('0x22')](saveUpdates(_0x2ceb8d[_0x055e('0x45')],null))['then'](respondWithResult(_0x473e7a,null))[_0x055e('0x4c')](handleError(_0x473e7a,null));};exports[_0x055e('0x4d')]=function(_0x214b14,_0x3eb1a1){return db['Tag']['find']({'where':{'id':_0x214b14[_0x055e('0x3f')]['id']}})[_0x055e('0x22')](handleEntityNotFound(_0x3eb1a1,null))[_0x055e('0x22')](removeEntity(_0x3eb1a1,null))[_0x055e('0x4c')](handleError(_0x3eb1a1,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 367c174..358185b 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 _0x4cc9=['bluebird','path','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash','util','../../config/logger','moment'];(function(_0x51aae8,_0x2aae56){var _0x54fd61=function(_0x4d213a){while(--_0x4d213a){_0x51aae8['push'](_0x51aae8['shift']());}};_0x54fd61(++_0x2aae56);}(_0x4cc9,0x1ca));var _0x94cc=function(_0x28afd5,_0x987962){_0x28afd5=_0x28afd5-0x0;var _0xbceb44=_0x4cc9[_0x28afd5];return _0xbceb44;};'use strict';var _=require(_0x94cc('0x0'));var util=require(_0x94cc('0x1'));var logger=require(_0x94cc('0x2'))('api');var moment=require(_0x94cc('0x3'));var BPromise=require(_0x94cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94cc('0x5'));var rimraf=require(_0x94cc('0x6'));var config=require(_0x94cc('0x7'));var attributes=require(_0x94cc('0x8'));module['exports']=function(_0x2f61e8,_0x23f0a2){return _0x2f61e8[_0x94cc('0x9')]('Tag',attributes,{'tableName':_0x94cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c83=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','bluebird'];(function(_0x2d5fe8,_0x635742){var _0x2e9ecc=function(_0x24b0e8){while(--_0x24b0e8){_0x2d5fe8['push'](_0x2d5fe8['shift']());}};_0x2e9ecc(++_0x635742);}(_0x2c83,0xd8));var _0x32c8=function(_0xaff9a1,_0x1bc0e8){_0xaff9a1=_0xaff9a1-0x0;var _0x487320=_0x2c83[_0xaff9a1];return _0x487320;};'use strict';var _=require(_0x32c8('0x0'));var util=require(_0x32c8('0x1'));var logger=require(_0x32c8('0x2'))(_0x32c8('0x3'));var moment=require('moment');var BPromise=require(_0x32c8('0x4'));var rp=require(_0x32c8('0x5'));var fs=require('fs');var path=require(_0x32c8('0x6'));var rimraf=require(_0x32c8('0x7'));var config=require(_0x32c8('0x8'));var attributes=require(_0x32c8('0x9'));module[_0x32c8('0xa')]=function(_0x5a4d35,_0x102778){return _0x5a4d35[_0x32c8('0xb')]('Tag',attributes,{'tableName':_0x32c8('0xc'),'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 717894c..5773a96 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5bafd3,_0x474626){var _0x4aeb83=function(_0x4ab61a){while(--_0x4ab61a){_0x5bafd3['push'](_0x5bafd3['shift']());}};_0x4aeb83(++_0x474626);}(_0x99e9,0xb4));var _0x999e=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x99e9[_0x5b13c3];return _0x3d6780;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('Tag,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x51a57a,_0x3003ec){var _0x5d6774=function(_0x151807){while(--_0x151807){_0x51a57a['push'](_0x51a57a['shift']());}};_0x5d6774(++_0x3003ec);}(_0x2dae,0xc3));var _0xe2da=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x2dae[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('Tag,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4ddb675..b85d5f5 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 d581aa9..6d7c6fc 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 58cb231..7235c56 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 _0xe3ed=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','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','Sequelize','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','toLowerCase','Queue','Unknown\x20channel','capitalize','Queues','ids','removeQueues','remove','isArray','Sms','Fax','Whatsapp','Voice','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','User','voicePause','interface','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','Chat','Mail','Openchannel','transaction','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','set','apply','reject','save','update','then','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','length','include','merge','body','user','get'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe3ed,0xee));var _0xde3e=function(_0x5314bd,_0x1c0a3e){_0x5314bd=_0x5314bd-0x0;var _0x49c7f3=_0xe3ed[_0x5314bd];return _0x49c7f3;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require('request-promise');var moment=require(_0xde3e('0x4'));var BPromise=require(_0xde3e('0x5'));var Mustache=require(_0xde3e('0x6'));var util=require('util');var path=require(_0xde3e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xde3e('0x8'));var fs=require('fs');var fs_extra=require(_0xde3e('0x9'));var _=require('lodash');var squel=require(_0xde3e('0xa'));var crypto=require(_0xde3e('0xb'));var jsforce=require(_0xde3e('0xc'));var deskjs=require(_0xde3e('0xd'));var toCsv=require(_0xde3e('0xe'));var querystring=require(_0xde3e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xde3e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde3e('0x11'));var logger=require(_0xde3e('0x12'))(_0xde3e('0x13'));var utils=require(_0xde3e('0x14'));var config=require(_0xde3e('0x15'));var licenseUtil=require(_0xde3e('0x16'));var db=require('../../mysqldb')['db'];config[_0xde3e('0x17')]=_[_0xde3e('0x18')](config['redis'],{'host':_0xde3e('0x19'),'port':0x18eb});var socket=require(_0xde3e('0x1a'))(new Redis(config[_0xde3e('0x17')]));require('./team.socket')[_0xde3e('0x1b')](socket);function respondWithStatusCode(_0x6d3500,_0x3d8467){_0x3d8467=_0x3d8467||0xcc;return function(_0x339ea9){if(_0x339ea9){return _0x6d3500[_0xde3e('0x1c')](_0x3d8467);}return _0x6d3500[_0xde3e('0x1d')](_0x3d8467)[_0xde3e('0x1e')]();};}function respondWithResult(_0x5296ec,_0x448d10){_0x448d10=_0x448d10||0xc8;return function(_0x178dad){if(_0x178dad){return _0x5296ec[_0xde3e('0x1d')](_0x448d10)[_0xde3e('0x1f')](_0x178dad);}};}function respondWithFilteredResult(_0x12e754,_0x29a66b){return function(_0x3904d1){if(_0x3904d1){var _0x42f403=typeof _0x29a66b[_0xde3e('0x20')]===_0xde3e('0x21')&&typeof _0x29a66b['limit']===_0xde3e('0x21');var _0xf2e70b=_0x3904d1['count'];var _0xb29920=_0x42f403?0x0:_0x29a66b[_0xde3e('0x20')];var _0x54baaa=_0x42f403?_0x3904d1['count']:_0x29a66b['offset']+_0x29a66b['limit'];var _0x104244;if(_0x54baaa>=_0xf2e70b){_0x54baaa=_0xf2e70b;_0x104244=0xc8;}else{_0x104244=0xce;}_0x12e754['status'](_0x104244);return _0x12e754[_0xde3e('0x22')]('Content-Range',_0xb29920+'-'+_0x54baaa+'/'+_0xf2e70b)[_0xde3e('0x1f')](_0x3904d1);}return null;};}function patchUpdates(_0x29dd62){return function(_0x437f18){try{jsonpatch[_0xde3e('0x23')](_0x437f18,_0x29dd62,!![]);}catch(_0xccbc2a){return BPromise[_0xde3e('0x24')](_0xccbc2a);}return _0x437f18[_0xde3e('0x25')]();};}function saveUpdates(_0x5d2ea1,_0x35ffa2){return function(_0x4e2d6a){if(_0x4e2d6a){return _0x4e2d6a[_0xde3e('0x26')](_0x5d2ea1)[_0xde3e('0x27')](function(_0x1252ea){return _0x1252ea;});}return null;};}function handleEntityNotFound(_0x5c6577,_0x2f8241){return function(_0x56b3ef){if(!_0x56b3ef){_0x5c6577[_0xde3e('0x1c')](0x194);}return _0x56b3ef;};}function handleError(_0x2ad1a5,_0x1e5aee){_0x1e5aee=_0x1e5aee||0x1f4;return function(_0x5cdf17){logger['error'](_0x5cdf17[_0xde3e('0x28')]);if(_0x5cdf17[_0xde3e('0x29')]){delete _0x5cdf17[_0xde3e('0x29')];}_0x2ad1a5[_0xde3e('0x1d')](_0x1e5aee)[_0xde3e('0x2a')](_0x5cdf17);};}exports[_0xde3e('0x2b')]=function(_0x1615ca,_0x324922){var _0x371ee3={},_0x4102df={},_0x309f62={'count':0x0,'rows':[]};var _0x35721f=_[_0xde3e('0x2c')](db[_0xde3e('0x2d')][_0xde3e('0x2e')],function(_0x22b72a){return{'name':_0x22b72a['fieldName'],'type':_0x22b72a[_0xde3e('0x2f')][_0xde3e('0x30')]};});_0x4102df[_0xde3e('0x31')]=_[_0xde3e('0x2c')](_0x35721f,_0xde3e('0x29'));_0x4102df[_0xde3e('0x32')]=_[_0xde3e('0x33')](_0x1615ca[_0xde3e('0x32')]);_0x4102df[_0xde3e('0x34')]=_[_0xde3e('0x35')](_0x4102df[_0xde3e('0x31')],_0x4102df[_0xde3e('0x32')]);_0x371ee3['attributes']=_['intersection'](_0x4102df[_0xde3e('0x31')],qs['fields'](_0x1615ca[_0xde3e('0x32')][_0xde3e('0x36')]));_0x371ee3[_0xde3e('0x37')]=_0x371ee3[_0xde3e('0x37')]['length']?_0x371ee3[_0xde3e('0x37')]:_0x4102df['model'];if(!_0x1615ca[_0xde3e('0x32')]['hasOwnProperty'](_0xde3e('0x38'))){_0x371ee3['limit']=qs['limit'](_0x1615ca[_0xde3e('0x32')][_0xde3e('0x39')]);_0x371ee3[_0xde3e('0x20')]=qs[_0xde3e('0x20')](_0x1615ca[_0xde3e('0x32')][_0xde3e('0x20')]);}_0x371ee3[_0xde3e('0x3a')]=qs[_0xde3e('0x3b')](_0x1615ca[_0xde3e('0x32')][_0xde3e('0x3b')]);_0x371ee3[_0xde3e('0x3c')]=qs[_0xde3e('0x34')](_[_0xde3e('0x3d')](_0x1615ca[_0xde3e('0x32')],_0x4102df['filters']),_0x35721f);if(_0x1615ca[_0xde3e('0x32')][_0xde3e('0x3e')]){_0x371ee3[_0xde3e('0x3c')]=_['merge'](_0x371ee3[_0xde3e('0x3c')],{'$or':_['map'](_0x35721f,function(_0x1b0b90){if(_0x1b0b90['type']!==_0xde3e('0x3f')){var _0x11c644={};_0x11c644[_0x1b0b90['name']]={'$like':'%'+_0x1615ca[_0xde3e('0x32')][_0xde3e('0x3e')]+'%'};return _0x11c644;}})});}_0x371ee3=_['merge']({},_0x371ee3,_0x1615ca[_0xde3e('0x40')]);var _0x51331a={'where':_0x371ee3['where']};return db[_0xde3e('0x2d')]['count'](_0x51331a)[_0xde3e('0x27')](function(_0x327e9b){_0x309f62[_0xde3e('0x41')]=_0x327e9b;if(_0x1615ca[_0xde3e('0x32')][_0xde3e('0x42')]){_0x371ee3['include']=[{'all':!![]}];}return db['Team'][_0xde3e('0x43')](_0x371ee3);})[_0xde3e('0x27')](function(_0x621f63){_0x309f62[_0xde3e('0x44')]=_0x621f63;return _0x309f62;})[_0xde3e('0x27')](respondWithFilteredResult(_0x324922,_0x371ee3))[_0xde3e('0x45')](handleError(_0x324922,null));};exports['show']=function(_0x1126ba,_0x24c45d){var _0x154ae6={'raw':![],'where':{'id':_0x1126ba['params']['id']}},_0x59a911={};_0x59a911[_0xde3e('0x31')]=_[_0xde3e('0x33')](db[_0xde3e('0x2d')][_0xde3e('0x2e')]);_0x59a911[_0xde3e('0x32')]=_['keys'](_0x1126ba[_0xde3e('0x32')]);_0x59a911[_0xde3e('0x34')]=_['intersection'](_0x59a911['model'],_0x59a911[_0xde3e('0x32')]);_0x154ae6['attributes']=_[_0xde3e('0x35')](_0x59a911[_0xde3e('0x31')],qs['fields'](_0x1126ba[_0xde3e('0x32')][_0xde3e('0x36')]));_0x154ae6[_0xde3e('0x37')]=_0x154ae6[_0xde3e('0x37')][_0xde3e('0x46')]?_0x154ae6[_0xde3e('0x37')]:_0x59a911[_0xde3e('0x31')];if(_0x1126ba['query'][_0xde3e('0x42')]){_0x154ae6[_0xde3e('0x47')]=[{'all':!![]}];}_0x154ae6=_[_0xde3e('0x48')]({},_0x154ae6,_0x1126ba[_0xde3e('0x40')]);return db[_0xde3e('0x2d')]['find'](_0x154ae6)['then'](handleEntityNotFound(_0x24c45d,null))[_0xde3e('0x27')](respondWithResult(_0x24c45d,null))[_0xde3e('0x45')](handleError(_0x24c45d,null));};exports['create']=function(_0x3c888d,_0x32fcba){return db[_0xde3e('0x2d')]['create'](_0x3c888d[_0xde3e('0x49')],{})[_0xde3e('0x27')](function(_0x29d99b){var _0x2e653e=_0x3c888d[_0xde3e('0x4a')][_0xde3e('0x4b')]({'plain':!![]});if(!_0x2e653e)throw new Error(_0xde3e('0x4c'));if(_0x2e653e[_0xde3e('0x4d')]==='user'){var _0x33ca22=_0x29d99b[_0xde3e('0x4b')]({'plain':!![]});var _0x377575=_0xde3e('0x4e');return db[_0xde3e('0x4f')]['find']({'where':{'name':_0x377575,'userProfileId':_0x2e653e[_0xde3e('0x50')]},'raw':!![]})[_0xde3e('0x27')](function(_0x40bf4e){if(_0x40bf4e&&_0x40bf4e[_0xde3e('0x51')]===0x0){return db[_0xde3e('0x52')][_0xde3e('0x53')]({'name':_0x33ca22[_0xde3e('0x29')],'resourceId':_0x33ca22['id'],'type':_0x40bf4e[_0xde3e('0x29')],'sectionId':_0x40bf4e['id']},{})[_0xde3e('0x27')](function(){return _0x29d99b;});}else{return _0x29d99b;}})[_0xde3e('0x45')](function(_0xc7ef0d){logger[_0xde3e('0x54')](_0xde3e('0x55'),_0xc7ef0d);throw _0xc7ef0d;});}return _0x29d99b;})[_0xde3e('0x27')](respondWithResult(_0x32fcba,0xc9))['catch'](handleError(_0x32fcba,null));};exports['update']=function(_0x14e102,_0x17fa41){if(_0x14e102[_0xde3e('0x49')]['id']){delete _0x14e102[_0xde3e('0x49')]['id'];}return db[_0xde3e('0x2d')][_0xde3e('0x56')]({'where':{'id':_0x14e102['params']['id']}})[_0xde3e('0x27')](handleEntityNotFound(_0x17fa41,null))[_0xde3e('0x27')](saveUpdates(_0x14e102[_0xde3e('0x49')],null))['then'](respondWithResult(_0x17fa41,null))['catch'](handleError(_0x17fa41,null));};exports['destroy']=function(_0x3f23c5,_0x555c77){var _0x24c809=_0x3f23c5[_0xde3e('0x57')]['id'];var _0xa8524e=[];return db[_0xde3e('0x58')]['transaction'](function(_0x92ae5f){var _0x2c2972='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x24c809;return db['sequelize']['query'](_0x2c2972,{'type':db['Sequelize'][_0xde3e('0x59')]['SELECT'],'raw':!![],'transaction':_0x92ae5f})[_0xde3e('0x27')](function(_0x40dec6){_0xa8524e=_[_0xde3e('0x2c')](_0x40dec6,function(_0x13491c){return Number(_0x13491c['UserId']);});})[_0xde3e('0x27')](function(){var _0x2e6ce5=_0xde3e('0x5a')+_0x24c809;return db['sequelize']['query'](_0x2e6ce5,{'type':db['Sequelize'][_0xde3e('0x59')][_0xde3e('0x5b')],'raw':!![],'transaction':_0x92ae5f});})['then'](function(_0xedf253){var _0x2ea3f3=_['map'](_0xedf253,function(_0x5ef418){return Number(_0x5ef418[_0xde3e('0x5c')]);});return db[_0xde3e('0x5d')][_0xde3e('0x5e')]({'where':{'UserId':{'$in':_0xa8524e},'VoiceQueueId':{'$in':_0x2ea3f3}},'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(){var _0x29ee3d=_0xde3e('0x5f')+_0x24c809;return db[_0xde3e('0x58')][_0xde3e('0x32')](_0x29ee3d,{'type':db['Sequelize'][_0xde3e('0x59')][_0xde3e('0x5b')],'raw':!![],'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(_0xf2614){var _0xefa80d=_['map'](_0xf2614,function(_0x4acae3){return Number(_0x4acae3[_0xde3e('0x60')]);});return db[_0xde3e('0x61')][_0xde3e('0x5e')]({'where':{'UserId':{'$in':_0xa8524e},'MailQueueId':{'$in':_0xefa80d}},'transaction':_0x92ae5f});})['then'](function(){var _0x16f542=_0xde3e('0x62')+_0x24c809;return db[_0xde3e('0x58')]['query'](_0x16f542,{'type':db[_0xde3e('0x63')][_0xde3e('0x59')][_0xde3e('0x5b')],'raw':!![],'transaction':_0x92ae5f});})['then'](function(_0x87a955){var _0x5c04a5=_[_0xde3e('0x2c')](_0x87a955,function(_0x334978){return Number(_0x334978[_0xde3e('0x64')]);});return db['UserSmsQueue'][_0xde3e('0x5e')]({'where':{'UserId':{'$in':_0xa8524e},'SmsQueueId':{'$in':_0x5c04a5}},'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(){var _0x42a511=_0xde3e('0x65')+_0x24c809;return db[_0xde3e('0x58')][_0xde3e('0x32')](_0x42a511,{'type':db[_0xde3e('0x63')][_0xde3e('0x59')]['SELECT'],'raw':!![],'transaction':_0x92ae5f});})['then'](function(_0x24b100){var _0xf2826a=_[_0xde3e('0x2c')](_0x24b100,function(_0x3e3c6b){return Number(_0x3e3c6b[_0xde3e('0x66')]);});return db[_0xde3e('0x67')]['destroy']({'where':{'UserId':{'$in':_0xa8524e},'ChatQueueId':{'$in':_0xf2826a}},'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(){var _0x196053=_0xde3e('0x68')+_0x24c809;return db[_0xde3e('0x58')][_0xde3e('0x32')](_0x196053,{'type':db[_0xde3e('0x63')][_0xde3e('0x59')]['SELECT'],'raw':!![],'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(_0x13880b){var _0xc7b992=_[_0xde3e('0x2c')](_0x13880b,function(_0x38cf61){return Number(_0x38cf61[_0xde3e('0x69')]);});return db[_0xde3e('0x6a')]['destroy']({'where':{'UserId':{'$in':_0xa8524e},'FaxQueueId':{'$in':_0xc7b992}},'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(){var _0x12c4b4=_0xde3e('0x6b')+_0x24c809;return db['sequelize'][_0xde3e('0x32')](_0x12c4b4,{'type':db[_0xde3e('0x63')][_0xde3e('0x59')][_0xde3e('0x5b')],'raw':!![],'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(_0x4f563a){var _0x39317c=_[_0xde3e('0x2c')](_0x4f563a,function(_0x4d097f){return Number(_0x4d097f[_0xde3e('0x6c')]);});return db[_0xde3e('0x6d')][_0xde3e('0x5e')]({'where':{'UserId':{'$in':_0xa8524e},'OpenchannelQueueId':{'$in':_0x39317c}},'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(){var _0x23b0d9='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x24c809;return db[_0xde3e('0x58')][_0xde3e('0x32')](_0x23b0d9,{'type':db[_0xde3e('0x63')][_0xde3e('0x59')]['SELECT'],'raw':!![],'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(_0x11a117){var _0x42f7ab=_['map'](_0x11a117,function(_0x571fea){return Number(_0x571fea[_0xde3e('0x6e')]);});return db[_0xde3e('0x6f')][_0xde3e('0x5e')]({'where':{'UserId':{'$in':_0xa8524e},'WhatsappQueueId':{'$in':_0x42f7ab}},'transaction':_0x92ae5f});})['then'](function(){return db[_0xde3e('0x70')][_0xde3e('0x56')]({'where':{'TeamId':_0x24c809}});})[_0xde3e('0x27')](function(_0x2c04ad){if(_0x2c04ad===null){return;}return db['UserVoicePrefix'][_0xde3e('0x5e')]({'where':{'UserId':{'$in':_0xa8524e},'VoicePrefixId':_0x2c04ad[_0xde3e('0x71')]},'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(){return db['Team'][_0xde3e('0x5e')]({'where':{'id':_0x24c809},'cascade':!![],'transaction':_0x92ae5f});})[_0xde3e('0x27')](function(_0x21f15b){if(_0x21f15b===0x0){_0x555c77[_0xde3e('0x1c')](0x194);}else{return db[_0xde3e('0x52')][_0xde3e('0x5e')]({'where':{'type':_0xde3e('0x4e'),'resourceId':_0x24c809},'cascade':!![],'transaction':_0x92ae5f})[_0xde3e('0x27')](function(){_0x555c77[_0xde3e('0x1d')](0xcc)[_0xde3e('0x1e')]();});}})['catch'](function(_0x3db4e3){_0x555c77[_0xde3e('0x1d')](0x1f4)[_0xde3e('0x2a')](_0x3db4e3);});});};exports[_0xde3e('0x72')]=function(_0x5b300d,_0xe7cba0,_0x56e9b7){return db[_0xde3e('0x2d')][_0xde3e('0x73')]({'where':{'id':_0x5b300d[_0xde3e('0x57')]['id']}})['then'](handleEntityNotFound(_0xe7cba0,null))[_0xde3e('0x27')](function(_0x22bb29){if(!_0x5b300d[_0xde3e('0x32')][_0xde3e('0x74')]||!utils[_0xde3e('0x75')](_0x5b300d['query'][_0xde3e('0x74')])){throw new db[(_0xde3e('0x63'))][(_0xde3e('0x76'))]('Unknown\x20channel');}var _0x230550={};var _0x52f315={};_0x52f315[_0xde3e('0x31')]=_[_0xde3e('0x33')](db[_['capitalize'](_0x5b300d[_0xde3e('0x32')][_0xde3e('0x74')][_0xde3e('0x77')]())+_0xde3e('0x78')][_0xde3e('0x2e')]);_0x52f315[_0xde3e('0x32')]=_[_0xde3e('0x33')](_0x5b300d[_0xde3e('0x32')]);_0x52f315[_0xde3e('0x34')]=_[_0xde3e('0x35')](_0x52f315[_0xde3e('0x31')],_0x52f315[_0xde3e('0x32')]);_0x230550['attributes']=_[_0xde3e('0x35')](_0x52f315[_0xde3e('0x31')],qs['fields'](_0x5b300d[_0xde3e('0x32')][_0xde3e('0x36')]));_0x230550['attributes']=_0x230550[_0xde3e('0x37')][_0xde3e('0x46')]?_0x230550[_0xde3e('0x37')]:_0x52f315[_0xde3e('0x31')];_0x230550[_0xde3e('0x39')]=qs[_0xde3e('0x39')](_0x5b300d[_0xde3e('0x32')][_0xde3e('0x39')]);_0x230550['offset']=qs[_0xde3e('0x20')](_0x5b300d[_0xde3e('0x32')][_0xde3e('0x20')]);_0x230550[_0xde3e('0x3a')]=qs[_0xde3e('0x3b')](_0x5b300d[_0xde3e('0x32')][_0xde3e('0x3b')]);_0x230550['where']=qs['filters'](_[_0xde3e('0x3d')](_0x5b300d[_0xde3e('0x32')],_0x52f315[_0xde3e('0x34')]));_0x230550=_['merge']({},_0x230550,_0x5b300d['options']);return _0x22bb29[_0xde3e('0x4b')+_['capitalize'](_0x5b300d[_0xde3e('0x32')]['channel'][_0xde3e('0x77')]())+'Queues'](_0x230550);})[_0xde3e('0x27')](respondWithResult(_0xe7cba0,null))[_0xde3e('0x45')](handleError(_0xe7cba0,null));};exports['addQueues']=function(_0x4c48fb,_0x3ad50b,_0x40f94a){return db[_0xde3e('0x2d')][_0xde3e('0x73')]({'where':{'id':_0x4c48fb[_0xde3e('0x57')]['id']}})[_0xde3e('0x27')](function(_0x3455ee){if(_0x3455ee){if(!_0x4c48fb[_0xde3e('0x49')][_0xde3e('0x74')]||!utils[_0xde3e('0x75')](_0x4c48fb['body'][_0xde3e('0x74')])){throw new db[(_0xde3e('0x63'))][(_0xde3e('0x76'))](_0xde3e('0x79'));}return _0x3455ee['add'+_[_0xde3e('0x7a')](_0x4c48fb[_0xde3e('0x49')]['channel'][_0xde3e('0x77')]())+_0xde3e('0x7b')](_0x4c48fb[_0xde3e('0x49')][_0xde3e('0x7c')]);}return null;})[_0xde3e('0x27')](handleEntityNotFound(_0x3ad50b,null))[_0xde3e('0x27')](respondWithStatusCode(_0x3ad50b,null))['catch'](handleError(_0x3ad50b,null));};exports[_0xde3e('0x7d')]=function(_0x4c4896,_0x47cc60,_0x293a98){return db[_0xde3e('0x2d')]['findOne']({'where':{'id':_0x4c4896[_0xde3e('0x57')]['id']}})[_0xde3e('0x27')](function(_0x2a1b8e){if(_0x2a1b8e){if(!_0x4c4896[_0xde3e('0x32')]['channel']||!utils[_0xde3e('0x75')](_0x4c4896[_0xde3e('0x32')]['channel'])){throw new db[(_0xde3e('0x63'))][(_0xde3e('0x76'))](_0xde3e('0x79'));}return _0x2a1b8e[_0xde3e('0x7e')+_['capitalize'](_0x4c4896[_0xde3e('0x32')][_0xde3e('0x74')][_0xde3e('0x77')]())+_0xde3e('0x7b')](_0x4c4896[_0xde3e('0x32')][_0xde3e('0x7c')]);}return null;})[_0xde3e('0x27')](handleEntityNotFound(_0x47cc60,null))['then'](respondWithStatusCode(_0x47cc60,null))[_0xde3e('0x45')](handleError(_0x47cc60,null));};exports['addAgents']=function(_0x30e510,_0xbb2d7){var _0x2041ee=_[_0xde3e('0x7f')](_0x30e510[_0xde3e('0x49')][_0xde3e('0x7c')])?_0x30e510[_0xde3e('0x49')][_0xde3e('0x7c')]:[_0x30e510[_0xde3e('0x49')][_0xde3e('0x7c')]];var _0x2bb584=_0x30e510[_0xde3e('0x57')]['id'];return db[_0xde3e('0x2d')][_0xde3e('0x56')]({'where':{'id':_0x2bb584}})['then'](handleEntityNotFound(_0xbb2d7,null))[_0xde3e('0x27')](function(_0x25ca1f){if(_0x25ca1f){var _0x4a70c0=['Voice','Chat','Mail',_0xde3e('0x80'),_0xde3e('0x81'),'Openchannel',_0xde3e('0x82')];return db[_0xde3e('0x58')]['transaction'](function(_0x432f35){var _0x3780e7=_['map'](_0x4a70c0,function(_0x47c39a){var _0x4ac0f9={'attributes':['id',_0xde3e('0x29')]};if(_0x47c39a===_0xde3e('0x83')){_0x4ac0f9[_0xde3e('0x84')]={'attributes':[_0xde3e('0x85')]};}return _0x25ca1f['get'+_0x47c39a+_0xde3e('0x7b')](_0x4ac0f9)[_0xde3e('0x27')](function(_0x27d8c8){var _0x5478ac=_[_0xde3e('0x2c')](_0x27d8c8,function(_0x24560c){var _0x54f0a6=_[_0xde3e('0x2c')](_0x2041ee,function(_0x55b541){var _0x1ee059={'where':{'UserId':_0x55b541,[_0x47c39a+_0xde3e('0x86')]:_0x24560c['id']},'transaction':_0x432f35};if(_0x47c39a==='Voice'){_0x1ee059['defaults']={'penalty':_0x24560c[_0xde3e('0x87')][_0xde3e('0x85')]};}return db['User'+_0x47c39a+_0xde3e('0x78')][_0xde3e('0x88')](_0x1ee059)[_0xde3e('0x27')](function(){socket[_0xde3e('0x89')](_0xde3e('0x4a')+_0x47c39a+'Queue:save',{'UserId':_0x55b541,[_0x47c39a+_0xde3e('0x86')]:_0x24560c['id']});if(_0x47c39a!==_0xde3e('0x83')){return;}return db[_0xde3e('0x8a')]['findAll']({'where':{'id':_0x2041ee,'online':0x1},'attributes':['id',_0xde3e('0x29'),'online',_0xde3e('0x8b'),_0xde3e('0x8c')],'raw':!![]})[_0xde3e('0x27')](function(_0x172b94){var _0x2de405=_[_0xde3e('0x2c')](_0x172b94,function(_0x47a176){return db['UserVoiceQueueRt'][_0xde3e('0x8d')]({'membername':_0x47a176[_0xde3e('0x29')],'UserId':_0x47a176['id'],'queue_name':_0x24560c['name'],'VoiceQueueId':_0x24560c['id'],'interface':_[_0xde3e('0x8e')](_0x47a176[_0xde3e('0x8c')])?util[_0xde3e('0x8f')](_0xde3e('0x90'),_0x47a176['name']):_0x47a176[_0xde3e('0x8c')],'paused':_0x47a176['voicePause']||![],'penalty':_0x24560c['TeamVoiceQueue'][_0xde3e('0x85')]},{'transaction':_0x432f35});});return Promise[_0xde3e('0x91')](_0x2de405);});});});return Promise[_0xde3e('0x91')](_0x54f0a6);});return Promise[_0xde3e('0x91')](_0x5478ac);})['then'](function(){return db['TeamVoicePrefix'][_0xde3e('0x73')]({'where':{'teamId':_0x2bb584}})[_0xde3e('0x27')](function(_0xf475ff){if(_0xf475ff){var _0x384384=_[_0xde3e('0x2c')](_0x2041ee,function(_0x5aad3){db[_0xde3e('0x92')][_0xde3e('0x8d')]({'UserId':_0x5aad3,'VoicePrefixId':_0xf475ff[_0xde3e('0x71')]});});return Promise[_0xde3e('0x91')](_0x384384);}});});});return Promise[_0xde3e('0x91')](_0x3780e7)[_0xde3e('0x27')](function(){return _0x25ca1f[_0xde3e('0x93')](_0x2041ee,{'transaction':_0x432f35})[_0xde3e('0x94')](function(_0x4ec90a){return _0x4ec90a;});});});}})['then'](respondWithResult(_0xbb2d7,null))[_0xde3e('0x45')](handleError(_0xbb2d7,null));};exports[_0xde3e('0x95')]=function(_0x58f418,_0x3ed68c){var _0x101949=_[_0xde3e('0x7f')](_0x58f418['query'][_0xde3e('0x7c')])?_0x58f418[_0xde3e('0x32')][_0xde3e('0x7c')]:[_0x58f418[_0xde3e('0x32')][_0xde3e('0x7c')]];var _0x2a708a=_0x58f418[_0xde3e('0x57')]['id'];return db[_0xde3e('0x2d')][_0xde3e('0x56')]({'where':{'id':_0x2a708a}})[_0xde3e('0x27')](handleEntityNotFound(_0x3ed68c,null))[_0xde3e('0x27')](function(_0x46bb3f){if(_0x46bb3f){var _0x5e6be1=['Voice',_0xde3e('0x96'),_0xde3e('0x97'),_0xde3e('0x80'),_0xde3e('0x81'),_0xde3e('0x98'),_0xde3e('0x82')];return db[_0xde3e('0x58')][_0xde3e('0x99')](function(_0x1e2eca){var _0xe784f9=_[_0xde3e('0x2c')](_0x5e6be1,function(_0x40f2ac){var _0x3c5a0f={'attributes':['id','name']};return _0x46bb3f[_0xde3e('0x4b')+_0x40f2ac+_0xde3e('0x7b')](_0x3c5a0f)[_0xde3e('0x27')](function(_0x398bd0){var _0x5bb43e=_[_0xde3e('0x2c')](_0x398bd0,function(_0xc2a3c1){return _0xc2a3c1[_0xde3e('0x95')](_0x101949,{'transaction':_0x1e2eca})[_0xde3e('0x27')](function(){var _0x4205d1=_[_0xde3e('0x2c')](_0x101949,function(_0x54c266){socket[_0xde3e('0x89')](_0xde3e('0x4a')+_0x40f2ac+_0xde3e('0x9a'),{'UserId':Number(_0x54c266),[_0x40f2ac+_0xde3e('0x86')]:_0xc2a3c1['id']});if(_0x40f2ac!==_0xde3e('0x83')){return;}return db[_0xde3e('0x9b')][_0xde3e('0x5e')]({'where':{'VoiceQueueId':_0xc2a3c1['id'],'UserId':_0x54c266},'transaction':_0x1e2eca});});return Promise[_0xde3e('0x91')](_0x4205d1);});});return Promise['all'](_0x5bb43e);});});return Promise[_0xde3e('0x91')](_0xe784f9)[_0xde3e('0x27')](function(){return _0x46bb3f['removeAgents'](_0x101949,{'transaction':_0x1e2eca});})['then'](function(){return db[_0xde3e('0x70')][_0xde3e('0x73')]({'where':{'teamId':_0x2a708a}})[_0xde3e('0x27')](function(_0x2368a7){if(_0x2368a7){var _0x2db25d=_['map'](_0x101949,function(_0x4cf196){db[_0xde3e('0x92')][_0xde3e('0x5e')]({'where':{'UserId':_0x4cf196,'VoicePrefixId':_0x2368a7[_0xde3e('0x71')]}});});return Promise[_0xde3e('0x91')](_0x2db25d);}});});});}})[_0xde3e('0x27')](respondWithStatusCode(_0x3ed68c,null))['catch'](handleError(_0x3ed68c,null));};exports['getAgents']=function(_0xd881f0,_0x3dcda2,_0x587030){var _0x309abd={};var _0x123721={};var _0x34980b;var _0x59a6ae;return db[_0xde3e('0x2d')][_0xde3e('0x73')]({'where':{'id':_0xd881f0[_0xde3e('0x57')]['id']}})[_0xde3e('0x27')](handleEntityNotFound(_0x3dcda2,null))[_0xde3e('0x27')](function(_0x43ed7f){if(_0x43ed7f){_0x34980b=_0x43ed7f;_0x123721[_0xde3e('0x31')]=_[_0xde3e('0x33')](db['User'][_0xde3e('0x2e')]);_0x123721[_0xde3e('0x32')]=_['keys'](_0xd881f0[_0xde3e('0x32')]);_0x123721['filters']=_[_0xde3e('0x35')](_0x123721[_0xde3e('0x31')],_0x123721[_0xde3e('0x32')]);_0x309abd[_0xde3e('0x37')]=_[_0xde3e('0x35')](_0x123721[_0xde3e('0x31')],qs['fields'](_0xd881f0[_0xde3e('0x32')][_0xde3e('0x36')]));_0x309abd[_0xde3e('0x37')]=_0x309abd[_0xde3e('0x37')]['length']?_0x309abd['attributes']:_0x123721[_0xde3e('0x31')];_0x309abd[_0xde3e('0x3a')]=qs[_0xde3e('0x3b')](_0xd881f0[_0xde3e('0x32')]['sort']);_0x309abd[_0xde3e('0x3c')]=qs[_0xde3e('0x34')](_['pick'](_0xd881f0[_0xde3e('0x32')],_0x123721[_0xde3e('0x34')]));if(_0xd881f0[_0xde3e('0x32')][_0xde3e('0x3e')]){_0x309abd[_0xde3e('0x3c')]=_['merge'](_0x309abd[_0xde3e('0x3c')],{'$or':_[_0xde3e('0x2c')](_0x309abd[_0xde3e('0x37')],function(_0x316786){var _0xee6777={};_0xee6777[_0x316786]={'$like':'%'+_0xd881f0['query'][_0xde3e('0x3e')]+'%'};return _0xee6777;})});}_0x309abd=_[_0xde3e('0x48')]({},_0x309abd,_0xd881f0[_0xde3e('0x40')]);return _0x34980b[_0xde3e('0x9c')](_0x309abd);}})[_0xde3e('0x27')](function(_0x30face){if(_0x30face){_0x59a6ae=_0x30face[_0xde3e('0x46')];if(!_0xd881f0[_0xde3e('0x32')]['hasOwnProperty'](_0xde3e('0x38'))){_0x309abd[_0xde3e('0x39')]=qs[_0xde3e('0x39')](_0xd881f0[_0xde3e('0x32')][_0xde3e('0x39')]);_0x309abd['offset']=qs[_0xde3e('0x20')](_0xd881f0[_0xde3e('0x32')][_0xde3e('0x20')]);}return _0x34980b['getAgents'](_0x309abd);}})['then'](function(_0x59ece6){if(_0x59ece6){return _0x59ece6?{'count':_0x59a6ae,'rows':_0x59ece6}:null;}})[_0xde3e('0x27')](respondWithResult(_0x3dcda2,null))[_0xde3e('0x45')](handleError(_0x3dcda2,null));}; \ No newline at end of file +var _0x7cb9=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','name','send','map','Team','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','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','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','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','pick','toLowerCase','Queues','isValidChannel','add','ids','removeQueues','remove','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','transaction','through','penalty','QueueId','User','Queue','findOrCreate','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','addAgents','spread','removeAgents','Fax','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x7cb9,0x8d));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x97cb('0x0'));var rimraf=require(_0x97cb('0x1'));var zipdir=require(_0x97cb('0x2'));var jsonpatch=require(_0x97cb('0x3'));var rp=require('request-promise');var moment=require(_0x97cb('0x4'));var BPromise=require(_0x97cb('0x5'));var Mustache=require(_0x97cb('0x6'));var util=require(_0x97cb('0x7'));var path=require(_0x97cb('0x8'));var sox=require('sox');var csv=require(_0x97cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97cb('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x97cb('0xb'));var jsforce=require(_0x97cb('0xc'));var deskjs=require(_0x97cb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97cb('0xe'));var Papa=require(_0x97cb('0xf'));var Redis=require(_0x97cb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x97cb('0x11'));var hardwareService=require(_0x97cb('0x12'));var logger=require(_0x97cb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x97cb('0x14'));var licenseUtil=require(_0x97cb('0x15'));var db=require(_0x97cb('0x16'))['db'];config[_0x97cb('0x17')]=_[_0x97cb('0x18')](config[_0x97cb('0x17')],{'host':_0x97cb('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97cb('0x17')]));require(_0x97cb('0x1a'))[_0x97cb('0x1b')](socket);function respondWithStatusCode(_0x287571,_0x2de732){_0x2de732=_0x2de732||0xcc;return function(_0x48f74d){if(_0x48f74d){return _0x287571[_0x97cb('0x1c')](_0x2de732);}return _0x287571[_0x97cb('0x1d')](_0x2de732)['end']();};}function respondWithResult(_0x399dd0,_0x3597a0){_0x3597a0=_0x3597a0||0xc8;return function(_0x4be6b3){if(_0x4be6b3){return _0x399dd0[_0x97cb('0x1d')](_0x3597a0)[_0x97cb('0x1e')](_0x4be6b3);}};}function respondWithFilteredResult(_0x45d2ca,_0x1c4163){return function(_0x32a317){if(_0x32a317){var _0x1b66b5=typeof _0x1c4163[_0x97cb('0x1f')]===_0x97cb('0x20')&&typeof _0x1c4163[_0x97cb('0x21')]===_0x97cb('0x20');var _0x3fe18a=_0x32a317[_0x97cb('0x22')];var _0x33345b=_0x1b66b5?0x0:_0x1c4163[_0x97cb('0x1f')];var _0x29dba2=_0x1b66b5?_0x32a317[_0x97cb('0x22')]:_0x1c4163[_0x97cb('0x1f')]+_0x1c4163[_0x97cb('0x21')];var _0x468e44;if(_0x29dba2>=_0x3fe18a){_0x29dba2=_0x3fe18a;_0x468e44=0xc8;}else{_0x468e44=0xce;}_0x45d2ca[_0x97cb('0x1d')](_0x468e44);return _0x45d2ca[_0x97cb('0x23')](_0x97cb('0x24'),_0x33345b+'-'+_0x29dba2+'/'+_0x3fe18a)[_0x97cb('0x1e')](_0x32a317);}return null;};}function patchUpdates(_0x4e5f19){return function(_0x4b2cc1){try{jsonpatch['apply'](_0x4b2cc1,_0x4e5f19,!![]);}catch(_0xf1eb08){return BPromise[_0x97cb('0x25')](_0xf1eb08);}return _0x4b2cc1[_0x97cb('0x26')]();};}function saveUpdates(_0xe7f19e,_0xb6e812){return function(_0x7cbfec){if(_0x7cbfec){return _0x7cbfec['update'](_0xe7f19e)[_0x97cb('0x27')](function(_0x485112){return _0x485112;});}return null;};}function handleEntityNotFound(_0x4c551c,_0x40d992){return function(_0x18bd17){if(!_0x18bd17){_0x4c551c['sendStatus'](0x194);}return _0x18bd17;};}function handleError(_0x29149c,_0x5a2dfd){_0x5a2dfd=_0x5a2dfd||0x1f4;return function(_0x2246a8){logger['error'](_0x2246a8['stack']);if(_0x2246a8[_0x97cb('0x28')]){delete _0x2246a8[_0x97cb('0x28')];}_0x29149c[_0x97cb('0x1d')](_0x5a2dfd)[_0x97cb('0x29')](_0x2246a8);};}exports['index']=function(_0x21543e,_0x3441d4){var _0x4cd7c8={},_0x5cef4e={},_0x289d4a={'count':0x0,'rows':[]};var _0x38a4a4=_[_0x97cb('0x2a')](db[_0x97cb('0x2b')][_0x97cb('0x2c')],function(_0x2e3af7){return{'name':_0x2e3af7[_0x97cb('0x2d')],'type':_0x2e3af7[_0x97cb('0x2e')]['key']};});_0x5cef4e[_0x97cb('0x2f')]=_[_0x97cb('0x2a')](_0x38a4a4,_0x97cb('0x28'));_0x5cef4e[_0x97cb('0x30')]=_['keys'](_0x21543e['query']);_0x5cef4e[_0x97cb('0x31')]=_[_0x97cb('0x32')](_0x5cef4e[_0x97cb('0x2f')],_0x5cef4e[_0x97cb('0x30')]);_0x4cd7c8[_0x97cb('0x33')]=_[_0x97cb('0x32')](_0x5cef4e[_0x97cb('0x2f')],qs['fields'](_0x21543e[_0x97cb('0x30')][_0x97cb('0x34')]));_0x4cd7c8[_0x97cb('0x33')]=_0x4cd7c8['attributes'][_0x97cb('0x35')]?_0x4cd7c8[_0x97cb('0x33')]:_0x5cef4e[_0x97cb('0x2f')];if(!_0x21543e[_0x97cb('0x30')][_0x97cb('0x36')](_0x97cb('0x37'))){_0x4cd7c8[_0x97cb('0x21')]=qs[_0x97cb('0x21')](_0x21543e['query'][_0x97cb('0x21')]);_0x4cd7c8[_0x97cb('0x1f')]=qs['offset'](_0x21543e['query']['offset']);}_0x4cd7c8[_0x97cb('0x38')]=qs[_0x97cb('0x39')](_0x21543e[_0x97cb('0x30')][_0x97cb('0x39')]);_0x4cd7c8[_0x97cb('0x3a')]=qs[_0x97cb('0x31')](_['pick'](_0x21543e['query'],_0x5cef4e[_0x97cb('0x31')]),_0x38a4a4);if(_0x21543e[_0x97cb('0x30')][_0x97cb('0x3b')]){_0x4cd7c8['where']=_[_0x97cb('0x3c')](_0x4cd7c8['where'],{'$or':_[_0x97cb('0x2a')](_0x38a4a4,function(_0x1778d6){if(_0x1778d6[_0x97cb('0x2e')]!=='VIRTUAL'){var _0x838345={};_0x838345[_0x1778d6[_0x97cb('0x28')]]={'$like':'%'+_0x21543e[_0x97cb('0x30')][_0x97cb('0x3b')]+'%'};return _0x838345;}})});}_0x4cd7c8=_[_0x97cb('0x3c')]({},_0x4cd7c8,_0x21543e[_0x97cb('0x3d')]);var _0x6a146e={'where':_0x4cd7c8['where']};return db['Team'][_0x97cb('0x22')](_0x6a146e)[_0x97cb('0x27')](function(_0x375e92){_0x289d4a[_0x97cb('0x22')]=_0x375e92;if(_0x21543e[_0x97cb('0x30')][_0x97cb('0x3e')]){_0x4cd7c8[_0x97cb('0x3f')]=[{'all':!![]}];}return db[_0x97cb('0x2b')]['findAll'](_0x4cd7c8);})[_0x97cb('0x27')](function(_0x5e05be){_0x289d4a[_0x97cb('0x40')]=_0x5e05be;return _0x289d4a;})[_0x97cb('0x27')](respondWithFilteredResult(_0x3441d4,_0x4cd7c8))[_0x97cb('0x41')](handleError(_0x3441d4,null));};exports[_0x97cb('0x42')]=function(_0x21dbf4,_0xae8f41){var _0x4d23ea={'raw':![],'where':{'id':_0x21dbf4['params']['id']}},_0x238ce1={};_0x238ce1[_0x97cb('0x2f')]=_[_0x97cb('0x43')](db['Team'][_0x97cb('0x2c')]);_0x238ce1[_0x97cb('0x30')]=_[_0x97cb('0x43')](_0x21dbf4[_0x97cb('0x30')]);_0x238ce1[_0x97cb('0x31')]=_['intersection'](_0x238ce1[_0x97cb('0x2f')],_0x238ce1[_0x97cb('0x30')]);_0x4d23ea['attributes']=_[_0x97cb('0x32')](_0x238ce1[_0x97cb('0x2f')],qs[_0x97cb('0x34')](_0x21dbf4[_0x97cb('0x30')]['fields']));_0x4d23ea[_0x97cb('0x33')]=_0x4d23ea['attributes']['length']?_0x4d23ea[_0x97cb('0x33')]:_0x238ce1[_0x97cb('0x2f')];if(_0x21dbf4[_0x97cb('0x30')][_0x97cb('0x3e')]){_0x4d23ea['include']=[{'all':!![]}];}_0x4d23ea=_[_0x97cb('0x3c')]({},_0x4d23ea,_0x21dbf4[_0x97cb('0x3d')]);return db[_0x97cb('0x2b')]['find'](_0x4d23ea)['then'](handleEntityNotFound(_0xae8f41,null))[_0x97cb('0x27')](respondWithResult(_0xae8f41,null))[_0x97cb('0x41')](handleError(_0xae8f41,null));};exports[_0x97cb('0x44')]=function(_0x273e2c,_0x1fd69a){return db[_0x97cb('0x2b')][_0x97cb('0x44')](_0x273e2c[_0x97cb('0x45')],{})[_0x97cb('0x27')](function(_0x2ea360){var _0x38ac60=_0x273e2c[_0x97cb('0x46')][_0x97cb('0x47')]({'plain':!![]});if(!_0x38ac60)throw new Error(_0x97cb('0x48'));if(_0x38ac60[_0x97cb('0x49')]===_0x97cb('0x46')){var _0x1b41f7=_0x2ea360[_0x97cb('0x47')]({'plain':!![]});var _0x283173=_0x97cb('0x4a');return db[_0x97cb('0x4b')][_0x97cb('0x4c')]({'where':{'name':_0x283173,'userProfileId':_0x38ac60[_0x97cb('0x4d')]},'raw':!![]})[_0x97cb('0x27')](function(_0x41efc9){if(_0x41efc9&&_0x41efc9[_0x97cb('0x4e')]===0x0){return db[_0x97cb('0x4f')][_0x97cb('0x44')]({'name':_0x1b41f7['name'],'resourceId':_0x1b41f7['id'],'type':_0x41efc9[_0x97cb('0x28')],'sectionId':_0x41efc9['id']},{})[_0x97cb('0x27')](function(){return _0x2ea360;});}else{return _0x2ea360;}})['catch'](function(_0x955b66){logger[_0x97cb('0x50')](_0x97cb('0x51'),_0x955b66);throw _0x955b66;});}return _0x2ea360;})['then'](respondWithResult(_0x1fd69a,0xc9))[_0x97cb('0x41')](handleError(_0x1fd69a,null));};exports[_0x97cb('0x52')]=function(_0x75c1a7,_0x3dbdbc){if(_0x75c1a7['body']['id']){delete _0x75c1a7[_0x97cb('0x45')]['id'];}return db[_0x97cb('0x2b')]['find']({'where':{'id':_0x75c1a7[_0x97cb('0x53')]['id']}})[_0x97cb('0x27')](handleEntityNotFound(_0x3dbdbc,null))[_0x97cb('0x27')](saveUpdates(_0x75c1a7[_0x97cb('0x45')],null))[_0x97cb('0x27')](respondWithResult(_0x3dbdbc,null))[_0x97cb('0x41')](handleError(_0x3dbdbc,null));};exports['destroy']=function(_0x4f2227,_0x9d0b92){var _0x314bdc=_0x4f2227[_0x97cb('0x53')]['id'];var _0x31af38=[];return db[_0x97cb('0x54')]['transaction'](function(_0x777b43){var _0x393d50=_0x97cb('0x55')+_0x314bdc;return db[_0x97cb('0x54')]['query'](_0x393d50,{'type':db[_0x97cb('0x56')][_0x97cb('0x57')]['SELECT'],'raw':!![],'transaction':_0x777b43})[_0x97cb('0x27')](function(_0x5eec3f){_0x31af38=_[_0x97cb('0x2a')](_0x5eec3f,function(_0x1ec839){return Number(_0x1ec839[_0x97cb('0x58')]);});})[_0x97cb('0x27')](function(){var _0xf20670=_0x97cb('0x59')+_0x314bdc;return db[_0x97cb('0x54')][_0x97cb('0x30')](_0xf20670,{'type':db['Sequelize'][_0x97cb('0x57')][_0x97cb('0x5a')],'raw':!![],'transaction':_0x777b43});})[_0x97cb('0x27')](function(_0x48c15a){var _0x3255e8=_[_0x97cb('0x2a')](_0x48c15a,function(_0x4ea61f){return Number(_0x4ea61f[_0x97cb('0x5b')]);});return db[_0x97cb('0x5c')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'VoiceQueueId':{'$in':_0x3255e8}},'transaction':_0x777b43});})['then'](function(){var _0xaba3f5=_0x97cb('0x5e')+_0x314bdc;return db['sequelize'][_0x97cb('0x30')](_0xaba3f5,{'type':db[_0x97cb('0x56')][_0x97cb('0x57')][_0x97cb('0x5a')],'raw':!![],'transaction':_0x777b43});})[_0x97cb('0x27')](function(_0x317f19){var _0x176934=_[_0x97cb('0x2a')](_0x317f19,function(_0x117bc7){return Number(_0x117bc7[_0x97cb('0x5f')]);});return db[_0x97cb('0x60')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'MailQueueId':{'$in':_0x176934}},'transaction':_0x777b43});})['then'](function(){var _0x27cee1=_0x97cb('0x61')+_0x314bdc;return db[_0x97cb('0x54')][_0x97cb('0x30')](_0x27cee1,{'type':db[_0x97cb('0x56')][_0x97cb('0x57')]['SELECT'],'raw':!![],'transaction':_0x777b43});})[_0x97cb('0x27')](function(_0x1d852b){var _0x5bbd43=_[_0x97cb('0x2a')](_0x1d852b,function(_0x531a5f){return Number(_0x531a5f['SmsQueueId']);});return db[_0x97cb('0x62')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'SmsQueueId':{'$in':_0x5bbd43}},'transaction':_0x777b43});})[_0x97cb('0x27')](function(){var _0x4bd018=_0x97cb('0x63')+_0x314bdc;return db[_0x97cb('0x54')]['query'](_0x4bd018,{'type':db['Sequelize'][_0x97cb('0x57')][_0x97cb('0x5a')],'raw':!![],'transaction':_0x777b43});})[_0x97cb('0x27')](function(_0x47b191){var _0x130a5d=_['map'](_0x47b191,function(_0x46db09){return Number(_0x46db09[_0x97cb('0x64')]);});return db[_0x97cb('0x65')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'ChatQueueId':{'$in':_0x130a5d}},'transaction':_0x777b43});})['then'](function(){var _0x1694a3=_0x97cb('0x66')+_0x314bdc;return db[_0x97cb('0x54')][_0x97cb('0x30')](_0x1694a3,{'type':db[_0x97cb('0x56')][_0x97cb('0x57')]['SELECT'],'raw':!![],'transaction':_0x777b43});})[_0x97cb('0x27')](function(_0x3dd9f3){var _0x3f64b0=_['map'](_0x3dd9f3,function(_0x14a9b1){return Number(_0x14a9b1[_0x97cb('0x67')]);});return db['UserFaxQueue'][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'FaxQueueId':{'$in':_0x3f64b0}},'transaction':_0x777b43});})[_0x97cb('0x27')](function(){var _0x2d81e3=_0x97cb('0x68')+_0x314bdc;return db[_0x97cb('0x54')]['query'](_0x2d81e3,{'type':db[_0x97cb('0x56')][_0x97cb('0x57')][_0x97cb('0x5a')],'raw':!![],'transaction':_0x777b43});})['then'](function(_0x79c4eb){var _0x49041b=_[_0x97cb('0x2a')](_0x79c4eb,function(_0x2f0c8a){return Number(_0x2f0c8a['OpenchannelQueueId']);});return db[_0x97cb('0x69')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'OpenchannelQueueId':{'$in':_0x49041b}},'transaction':_0x777b43});})[_0x97cb('0x27')](function(){var _0x50ae4a=_0x97cb('0x6a')+_0x314bdc;return db[_0x97cb('0x54')][_0x97cb('0x30')](_0x50ae4a,{'type':db[_0x97cb('0x56')][_0x97cb('0x57')]['SELECT'],'raw':!![],'transaction':_0x777b43});})[_0x97cb('0x27')](function(_0x14eb09){var _0x30a5d7=_[_0x97cb('0x2a')](_0x14eb09,function(_0x3acdeb){return Number(_0x3acdeb['WhatsappQueueId']);});return db[_0x97cb('0x6b')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'WhatsappQueueId':{'$in':_0x30a5d7}},'transaction':_0x777b43});})['then'](function(){return db['TeamVoicePrefix'][_0x97cb('0x4c')]({'where':{'TeamId':_0x314bdc}});})[_0x97cb('0x27')](function(_0x25bfbc){if(_0x25bfbc===null){return;}return db[_0x97cb('0x6c')][_0x97cb('0x5d')]({'where':{'UserId':{'$in':_0x31af38},'VoicePrefixId':_0x25bfbc[_0x97cb('0x6d')]},'transaction':_0x777b43});})[_0x97cb('0x27')](function(){return db[_0x97cb('0x2b')][_0x97cb('0x5d')]({'where':{'id':_0x314bdc},'cascade':!![],'transaction':_0x777b43});})['then'](function(_0x2b59e5){if(_0x2b59e5===0x0){_0x9d0b92['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x97cb('0x5d')]({'where':{'type':_0x97cb('0x4a'),'resourceId':_0x314bdc},'cascade':!![],'transaction':_0x777b43})[_0x97cb('0x27')](function(){_0x9d0b92['status'](0xcc)['end']();});}})[_0x97cb('0x41')](function(_0x58c5ff){_0x9d0b92[_0x97cb('0x1d')](0x1f4)['send'](_0x58c5ff);});});};exports[_0x97cb('0x6e')]=function(_0x5d3e81,_0x2d95cf,_0x30af70){return db['Team'][_0x97cb('0x6f')]({'where':{'id':_0x5d3e81[_0x97cb('0x53')]['id']}})[_0x97cb('0x27')](handleEntityNotFound(_0x2d95cf,null))['then'](function(_0x4e9e7a){if(!_0x5d3e81[_0x97cb('0x30')][_0x97cb('0x70')]||!utils['isValidChannel'](_0x5d3e81[_0x97cb('0x30')]['channel'])){throw new db[(_0x97cb('0x56'))][(_0x97cb('0x71'))](_0x97cb('0x72'));}var _0x2d86b6={};var _0x6b1f7d={};_0x6b1f7d[_0x97cb('0x2f')]=_[_0x97cb('0x43')](db[_[_0x97cb('0x73')](_0x5d3e81[_0x97cb('0x30')][_0x97cb('0x70')]['toLowerCase']())+'Queue'][_0x97cb('0x2c')]);_0x6b1f7d[_0x97cb('0x30')]=_[_0x97cb('0x43')](_0x5d3e81[_0x97cb('0x30')]);_0x6b1f7d[_0x97cb('0x31')]=_[_0x97cb('0x32')](_0x6b1f7d[_0x97cb('0x2f')],_0x6b1f7d[_0x97cb('0x30')]);_0x2d86b6[_0x97cb('0x33')]=_[_0x97cb('0x32')](_0x6b1f7d[_0x97cb('0x2f')],qs['fields'](_0x5d3e81[_0x97cb('0x30')][_0x97cb('0x34')]));_0x2d86b6[_0x97cb('0x33')]=_0x2d86b6[_0x97cb('0x33')][_0x97cb('0x35')]?_0x2d86b6[_0x97cb('0x33')]:_0x6b1f7d[_0x97cb('0x2f')];_0x2d86b6[_0x97cb('0x21')]=qs[_0x97cb('0x21')](_0x5d3e81[_0x97cb('0x30')][_0x97cb('0x21')]);_0x2d86b6[_0x97cb('0x1f')]=qs[_0x97cb('0x1f')](_0x5d3e81['query'][_0x97cb('0x1f')]);_0x2d86b6[_0x97cb('0x38')]=qs['sort'](_0x5d3e81['query'][_0x97cb('0x39')]);_0x2d86b6[_0x97cb('0x3a')]=qs[_0x97cb('0x31')](_[_0x97cb('0x74')](_0x5d3e81[_0x97cb('0x30')],_0x6b1f7d[_0x97cb('0x31')]));_0x2d86b6=_[_0x97cb('0x3c')]({},_0x2d86b6,_0x5d3e81['options']);return _0x4e9e7a['get'+_['capitalize'](_0x5d3e81['query'][_0x97cb('0x70')][_0x97cb('0x75')]())+_0x97cb('0x76')](_0x2d86b6);})[_0x97cb('0x27')](respondWithResult(_0x2d95cf,null))[_0x97cb('0x41')](handleError(_0x2d95cf,null));};exports['addQueues']=function(_0x409a6e,_0x36a53c,_0xe3aa28){return db[_0x97cb('0x2b')][_0x97cb('0x6f')]({'where':{'id':_0x409a6e['params']['id']}})['then'](function(_0x35103b){if(_0x35103b){if(!_0x409a6e[_0x97cb('0x45')][_0x97cb('0x70')]||!utils[_0x97cb('0x77')](_0x409a6e[_0x97cb('0x45')]['channel'])){throw new db[(_0x97cb('0x56'))][(_0x97cb('0x71'))](_0x97cb('0x72'));}return _0x35103b[_0x97cb('0x78')+_[_0x97cb('0x73')](_0x409a6e[_0x97cb('0x45')]['channel'][_0x97cb('0x75')]())+_0x97cb('0x76')](_0x409a6e[_0x97cb('0x45')][_0x97cb('0x79')]);}return null;})[_0x97cb('0x27')](handleEntityNotFound(_0x36a53c,null))[_0x97cb('0x27')](respondWithStatusCode(_0x36a53c,null))[_0x97cb('0x41')](handleError(_0x36a53c,null));};exports[_0x97cb('0x7a')]=function(_0x2889b6,_0x6daae5,_0x37be6e){return db[_0x97cb('0x2b')]['findOne']({'where':{'id':_0x2889b6[_0x97cb('0x53')]['id']}})[_0x97cb('0x27')](function(_0x3c8d2b){if(_0x3c8d2b){if(!_0x2889b6[_0x97cb('0x30')][_0x97cb('0x70')]||!utils[_0x97cb('0x77')](_0x2889b6[_0x97cb('0x30')][_0x97cb('0x70')])){throw new db[(_0x97cb('0x56'))][(_0x97cb('0x71'))](_0x97cb('0x72'));}return _0x3c8d2b[_0x97cb('0x7b')+_[_0x97cb('0x73')](_0x2889b6[_0x97cb('0x30')][_0x97cb('0x70')][_0x97cb('0x75')]())+_0x97cb('0x76')](_0x2889b6[_0x97cb('0x30')][_0x97cb('0x79')]);}return null;})[_0x97cb('0x27')](handleEntityNotFound(_0x6daae5,null))[_0x97cb('0x27')](respondWithStatusCode(_0x6daae5,null))['catch'](handleError(_0x6daae5,null));};exports['addAgents']=function(_0x3efa05,_0x13b131){var _0x1efab8=_['isArray'](_0x3efa05[_0x97cb('0x45')][_0x97cb('0x79')])?_0x3efa05[_0x97cb('0x45')][_0x97cb('0x79')]:[_0x3efa05[_0x97cb('0x45')][_0x97cb('0x79')]];var _0x252860=_0x3efa05['params']['id'];return db['Team'][_0x97cb('0x4c')]({'where':{'id':_0x252860}})['then'](handleEntityNotFound(_0x13b131,null))[_0x97cb('0x27')](function(_0x121e8f){if(_0x121e8f){var _0x19f8af=[_0x97cb('0x7c'),_0x97cb('0x7d'),_0x97cb('0x7e'),_0x97cb('0x7f'),'Fax',_0x97cb('0x80'),_0x97cb('0x81')];return db['sequelize'][_0x97cb('0x82')](function(_0x4fe73c){var _0x4f943f=_[_0x97cb('0x2a')](_0x19f8af,function(_0x1bd480){var _0x525c50={'attributes':['id','name']};if(_0x1bd480===_0x97cb('0x7c')){_0x525c50[_0x97cb('0x83')]={'attributes':[_0x97cb('0x84')]};}return _0x121e8f[_0x97cb('0x47')+_0x1bd480+_0x97cb('0x76')](_0x525c50)[_0x97cb('0x27')](function(_0x18f015){var _0x2bd0d9=_['map'](_0x18f015,function(_0x57a94b){var _0x3bf717=_['map'](_0x1efab8,function(_0x1b6b62){var _0x41ec8d={'where':{'UserId':_0x1b6b62,[_0x1bd480+_0x97cb('0x85')]:_0x57a94b['id']},'transaction':_0x4fe73c};if(_0x1bd480===_0x97cb('0x7c')){_0x41ec8d[_0x97cb('0x18')]={'penalty':_0x57a94b['TeamVoiceQueue'][_0x97cb('0x84')]};}return db[_0x97cb('0x86')+_0x1bd480+_0x97cb('0x87')][_0x97cb('0x88')](_0x41ec8d)[_0x97cb('0x27')](function(){socket[_0x97cb('0x89')](_0x97cb('0x46')+_0x1bd480+_0x97cb('0x8a'),{'UserId':_0x1b6b62,[_0x1bd480+_0x97cb('0x85')]:_0x57a94b['id']});if(_0x1bd480!==_0x97cb('0x7c')){return;}return db[_0x97cb('0x86')][_0x97cb('0x8b')]({'where':{'id':_0x1efab8,'online':0x1},'attributes':['id',_0x97cb('0x28'),_0x97cb('0x8c'),_0x97cb('0x8d'),_0x97cb('0x8e')],'raw':!![]})[_0x97cb('0x27')](function(_0x127215){var _0x1d5532=_['map'](_0x127215,function(_0x277335){return db[_0x97cb('0x8f')][_0x97cb('0x90')]({'membername':_0x277335[_0x97cb('0x28')],'UserId':_0x277335['id'],'queue_name':_0x57a94b['name'],'VoiceQueueId':_0x57a94b['id'],'interface':_['isNil'](_0x277335['interface'])?util['format'](_0x97cb('0x91'),_0x277335[_0x97cb('0x28')]):_0x277335[_0x97cb('0x8e')],'paused':_0x277335[_0x97cb('0x8d')]||![],'penalty':_0x57a94b[_0x97cb('0x92')][_0x97cb('0x84')]},{'transaction':_0x4fe73c});});return Promise[_0x97cb('0x93')](_0x1d5532);});});});return Promise[_0x97cb('0x93')](_0x3bf717);});return Promise['all'](_0x2bd0d9);})[_0x97cb('0x27')](function(){return db[_0x97cb('0x94')]['findOne']({'where':{'teamId':_0x252860}})[_0x97cb('0x27')](function(_0x408aa3){if(_0x408aa3){var _0x49d7a8=_['map'](_0x1efab8,function(_0x331311){db[_0x97cb('0x6c')][_0x97cb('0x90')]({'UserId':_0x331311,'VoicePrefixId':_0x408aa3['VoicePrefixId']});});return Promise[_0x97cb('0x93')](_0x49d7a8);}});});});return Promise[_0x97cb('0x93')](_0x4f943f)[_0x97cb('0x27')](function(){return _0x121e8f[_0x97cb('0x95')](_0x1efab8,{'transaction':_0x4fe73c})[_0x97cb('0x96')](function(_0x3f6720){return _0x3f6720;});});});}})['then'](respondWithResult(_0x13b131,null))[_0x97cb('0x41')](handleError(_0x13b131,null));};exports[_0x97cb('0x97')]=function(_0x315019,_0x25e41d){var _0x22e49b=_['isArray'](_0x315019['query']['ids'])?_0x315019['query'][_0x97cb('0x79')]:[_0x315019[_0x97cb('0x30')][_0x97cb('0x79')]];var _0x4fa3dc=_0x315019[_0x97cb('0x53')]['id'];return db['Team'][_0x97cb('0x4c')]({'where':{'id':_0x4fa3dc}})['then'](handleEntityNotFound(_0x25e41d,null))[_0x97cb('0x27')](function(_0x1fa3c2){if(_0x1fa3c2){var _0x175f2d=[_0x97cb('0x7c'),_0x97cb('0x7d'),'Mail','Sms',_0x97cb('0x98'),'Openchannel','Whatsapp'];return db[_0x97cb('0x54')]['transaction'](function(_0x36761a){var _0x220fff=_[_0x97cb('0x2a')](_0x175f2d,function(_0x548179){var _0x2fdc20={'attributes':['id','name']};return _0x1fa3c2[_0x97cb('0x47')+_0x548179+_0x97cb('0x76')](_0x2fdc20)['then'](function(_0xc9d1b5){var _0x2bbd74=_[_0x97cb('0x2a')](_0xc9d1b5,function(_0x10609d){return _0x10609d[_0x97cb('0x97')](_0x22e49b,{'transaction':_0x36761a})[_0x97cb('0x27')](function(){var _0x391be5=_['map'](_0x22e49b,function(_0x1a3f3e){socket[_0x97cb('0x89')]('user'+_0x548179+_0x97cb('0x99'),{'UserId':Number(_0x1a3f3e),[_0x548179+_0x97cb('0x85')]:_0x10609d['id']});if(_0x548179!==_0x97cb('0x7c')){return;}return db[_0x97cb('0x8f')][_0x97cb('0x5d')]({'where':{'VoiceQueueId':_0x10609d['id'],'UserId':_0x1a3f3e},'transaction':_0x36761a});});return Promise['all'](_0x391be5);});});return Promise[_0x97cb('0x93')](_0x2bbd74);});});return Promise[_0x97cb('0x93')](_0x220fff)[_0x97cb('0x27')](function(){return _0x1fa3c2['removeAgents'](_0x22e49b,{'transaction':_0x36761a});})['then'](function(){return db[_0x97cb('0x94')][_0x97cb('0x6f')]({'where':{'teamId':_0x4fa3dc}})[_0x97cb('0x27')](function(_0x3ad35e){if(_0x3ad35e){var _0x3bf21a=_[_0x97cb('0x2a')](_0x22e49b,function(_0x2bb834){db[_0x97cb('0x6c')][_0x97cb('0x5d')]({'where':{'UserId':_0x2bb834,'VoicePrefixId':_0x3ad35e[_0x97cb('0x6d')]}});});return Promise[_0x97cb('0x93')](_0x3bf21a);}});});});}})[_0x97cb('0x27')](respondWithStatusCode(_0x25e41d,null))[_0x97cb('0x41')](handleError(_0x25e41d,null));};exports[_0x97cb('0x9a')]=function(_0x3d9f07,_0x390df5,_0x3de193){var _0x4ab6f0={};var _0x105893={};var _0x28e97f;var _0x2f4956;return db[_0x97cb('0x2b')][_0x97cb('0x6f')]({'where':{'id':_0x3d9f07[_0x97cb('0x53')]['id']}})[_0x97cb('0x27')](handleEntityNotFound(_0x390df5,null))['then'](function(_0x127a2f){if(_0x127a2f){_0x28e97f=_0x127a2f;_0x105893[_0x97cb('0x2f')]=_['keys'](db[_0x97cb('0x86')][_0x97cb('0x2c')]);_0x105893['query']=_[_0x97cb('0x43')](_0x3d9f07['query']);_0x105893[_0x97cb('0x31')]=_[_0x97cb('0x32')](_0x105893['model'],_0x105893[_0x97cb('0x30')]);_0x4ab6f0['attributes']=_[_0x97cb('0x32')](_0x105893[_0x97cb('0x2f')],qs[_0x97cb('0x34')](_0x3d9f07[_0x97cb('0x30')][_0x97cb('0x34')]));_0x4ab6f0['attributes']=_0x4ab6f0[_0x97cb('0x33')][_0x97cb('0x35')]?_0x4ab6f0[_0x97cb('0x33')]:_0x105893[_0x97cb('0x2f')];_0x4ab6f0['order']=qs[_0x97cb('0x39')](_0x3d9f07['query']['sort']);_0x4ab6f0[_0x97cb('0x3a')]=qs['filters'](_['pick'](_0x3d9f07[_0x97cb('0x30')],_0x105893['filters']));if(_0x3d9f07[_0x97cb('0x30')][_0x97cb('0x3b')]){_0x4ab6f0[_0x97cb('0x3a')]=_[_0x97cb('0x3c')](_0x4ab6f0[_0x97cb('0x3a')],{'$or':_['map'](_0x4ab6f0[_0x97cb('0x33')],function(_0x3f542b){var _0x2884b2={};_0x2884b2[_0x3f542b]={'$like':'%'+_0x3d9f07[_0x97cb('0x30')][_0x97cb('0x3b')]+'%'};return _0x2884b2;})});}_0x4ab6f0=_['merge']({},_0x4ab6f0,_0x3d9f07[_0x97cb('0x3d')]);return _0x28e97f['getAgents'](_0x4ab6f0);}})[_0x97cb('0x27')](function(_0x241c37){if(_0x241c37){_0x2f4956=_0x241c37['length'];if(!_0x3d9f07['query'][_0x97cb('0x36')]('nolimit')){_0x4ab6f0[_0x97cb('0x21')]=qs['limit'](_0x3d9f07[_0x97cb('0x30')][_0x97cb('0x21')]);_0x4ab6f0[_0x97cb('0x1f')]=qs[_0x97cb('0x1f')](_0x3d9f07[_0x97cb('0x30')][_0x97cb('0x1f')]);}return _0x28e97f[_0x97cb('0x9a')](_0x4ab6f0);}})[_0x97cb('0x27')](function(_0x374087){if(_0x374087){return _0x374087?{'count':_0x2f4956,'rows':_0x374087}:null;}})['then'](respondWithResult(_0x390df5,null))[_0x97cb('0x41')](handleError(_0x390df5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9f7cd70..42aa871 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 _0x39c7=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team'];(function(_0x60795b,_0x3e8e45){var _0x37e9e7=function(_0x1409c4){while(--_0x1409c4){_0x60795b['push'](_0x60795b['shift']());}};_0x37e9e7(++_0x3e8e45);}(_0x39c7,0x1ec));var _0x739c=function(_0xe2c701,_0x42c78d){_0xe2c701=_0xe2c701-0x0;var _0x36db09=_0x39c7[_0xe2c701];return _0x36db09;};'use strict';var EventEmitter=require(_0x739c('0x0'));var Team=require(_0x739c('0x1'))['db'][_0x739c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x739c('0x3')](0x0);var events={'afterCreate':_0x739c('0x4'),'afterUpdate':'update','afterDestroy':_0x739c('0x5')};function emitEvent(_0x147a4f){return function(_0x522424,_0x54847f,_0x52ddf3){TeamEvents[_0x739c('0x6')](_0x147a4f+':'+_0x522424['id'],_0x522424);TeamEvents[_0x739c('0x6')](_0x147a4f,_0x522424);_0x52ddf3(null);};}for(var e in events){if(events[_0x739c('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x739c('0x8')]=TeamEvents; \ No newline at end of file +var _0xd752=['Team','save','emit','hook','exports'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xd752,0x190));var _0x2d75=function(_0x47f7f5,_0xa5caf){_0x47f7f5=_0x47f7f5-0x0;var _0x52fe6b=_0xd752[_0x47f7f5];return _0x52fe6b;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x2d75('0x0')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d75('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x308b5e){return function(_0x47dac7,_0xa12bbb,_0x3cad47){TeamEvents[_0x2d75('0x2')](_0x308b5e+':'+_0x47dac7['id'],_0x47dac7);TeamEvents['emit'](_0x308b5e,_0x47dac7);_0x3cad47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x2d75('0x3')](e,emitEvent(event));}}module[_0x2d75('0x4')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7bd4525..d388256 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 _0xa2c2=['./team.attributes','define','Team','teams','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x36c2ea,_0x2fda23){var _0x15ee03=function(_0x38f6a3){while(--_0x38f6a3){_0x36c2ea['push'](_0x36c2ea['shift']());}};_0x15ee03(++_0x2fda23);}(_0xa2c2,0xb8));var _0x2a2c=function(_0x5d673e,_0x1bb0a8){_0x5d673e=_0x5d673e-0x0;var _0x1cf65a=_0xa2c2[_0x5d673e];return _0x1cf65a;};'use strict';var _=require('lodash');var util=require(_0x2a2c('0x0'));var logger=require(_0x2a2c('0x1'))(_0x2a2c('0x2'));var moment=require(_0x2a2c('0x3'));var BPromise=require(_0x2a2c('0x4'));var rp=require(_0x2a2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a2c('0x6'));var config=require(_0x2a2c('0x7'));var attributes=require(_0x2a2c('0x8'));module['exports']=function(_0x2e3ea0,_0x2f856a){return _0x2e3ea0[_0x2a2c('0x9')](_0x2a2c('0xa'),attributes,{'tableName':_0x2a2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0ce=['bluebird','request-promise','rimraf','./team.attributes','exports','define','Team','teams','util','api','moment'];(function(_0x5f0f6a,_0xa6b540){var _0x3975e5=function(_0xf519a2){while(--_0xf519a2){_0x5f0f6a['push'](_0x5f0f6a['shift']());}};_0x3975e5(++_0xa6b540);}(_0xf0ce,0x76));var _0xef0c=function(_0x478d88,_0x2c111d){_0x478d88=_0x478d88-0x0;var _0x27c9c0=_0xf0ce[_0x478d88];return _0x27c9c0;};'use strict';var _=require('lodash');var util=require(_0xef0c('0x0'));var logger=require('../../config/logger')(_0xef0c('0x1'));var moment=require(_0xef0c('0x2'));var BPromise=require(_0xef0c('0x3'));var rp=require(_0xef0c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef0c('0x5'));var config=require('../../config/environment');var attributes=require(_0xef0c('0x6'));module[_0xef0c('0x7')]=function(_0x4d73fc,_0x5554d3){return _0x4d73fc[_0xef0c('0x8')](_0xef0c('0x9'),attributes,{'tableName':_0xef0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index c6c5151..24afd23 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 _0x9766=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x9766,0x175));var _0x6976=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x9766[_0xcaf223];return _0x17e00d;};'use strict';var _=require('lodash');var util=require(_0x6976('0x0'));var moment=require(_0x6976('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6976('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6976('0x3'));var logger=require(_0x6976('0x4'))(_0x6976('0x5'));var config=require(_0x6976('0x6'));var jayson=require(_0x6976('0x7'));var client=jayson['client'][_0x6976('0x8')]({'port':0x232a});config[_0x6976('0x9')]=_[_0x6976('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6976('0xb'))['register'](socket);function respondWithRpcPromise(_0x2815b7,_0x13df5c,_0x35beb7){return new BPromise(function(_0x254530,_0x151c58){return client[_0x6976('0xc')](_0x2815b7,_0x35beb7)[_0x6976('0xd')](function(_0x4c416c){logger[_0x6976('0xe')](_0x6976('0xf'),_0x13df5c,_0x6976('0x10'));logger[_0x6976('0x11')](_0x6976('0x12'),_0x13df5c,_0x6976('0x10'),JSON[_0x6976('0x13')](_0x4c416c));if(_0x4c416c[_0x6976('0x14')]){if(_0x4c416c[_0x6976('0x14')][_0x6976('0x15')]===0x1f4){logger[_0x6976('0x14')](_0x6976('0xf'),_0x13df5c,_0x4c416c[_0x6976('0x14')][_0x6976('0x16')]);return _0x151c58(_0x4c416c['error'][_0x6976('0x16')]);}logger['error'](_0x6976('0xf'),_0x13df5c,_0x4c416c[_0x6976('0x14')][_0x6976('0x16')]);return _0x254530(_0x4c416c[_0x6976('0x14')][_0x6976('0x16')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x13df5c,_0x6976('0x10'));_0x254530(_0x4c416c[_0x6976('0x17')][_0x6976('0x16')]);}})[_0x6976('0x18')](function(_0x61c18e){logger['error'](_0x6976('0xf'),_0x13df5c,_0x61c18e);_0x151c58(_0x61c18e);});});} \ No newline at end of file +var _0xe184=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','request\x20sent'];(function(_0x41c29d,_0x41b696){var _0x506fd0=function(_0x45b22d){while(--_0x45b22d){_0x41c29d['push'](_0x41c29d['shift']());}};_0x506fd0(++_0x41b696);}(_0xe184,0xa5));var _0x4e18=function(_0x1032f4,_0x19b912){_0x1032f4=_0x1032f4-0x0;var _0x590c1c=_0xe184[_0x1032f4];return _0x590c1c;};'use strict';var _=require(_0x4e18('0x0'));var util=require(_0x4e18('0x1'));var moment=require(_0x4e18('0x2'));var BPromise=require(_0x4e18('0x3'));var rs=require(_0x4e18('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e18('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e18('0x6'))(_0x4e18('0x7'));var config=require(_0x4e18('0x8'));var jayson=require(_0x4e18('0x9'));var client=jayson['client'][_0x4e18('0xa')]({'port':0x232a});config[_0x4e18('0xb')]=_[_0x4e18('0xc')](config[_0x4e18('0xb')],{'host':_0x4e18('0xd'),'port':0x18eb});var socket=require(_0x4e18('0xe'))(new Redis(config[_0x4e18('0xb')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x41f4fc,_0x34b103,_0xabec49){return new BPromise(function(_0x3dd6a6,_0x137aad){return client[_0x4e18('0xf')](_0x41f4fc,_0xabec49)['then'](function(_0x19f91f){logger['info']('Team,\x20%s,\x20%s',_0x34b103,_0x4e18('0x10'));logger['debug'](_0x4e18('0x11'),_0x34b103,'request\x20sent',JSON[_0x4e18('0x12')](_0x19f91f));if(_0x19f91f[_0x4e18('0x13')]){if(_0x19f91f['error'][_0x4e18('0x14')]===0x1f4){logger[_0x4e18('0x13')](_0x4e18('0x15'),_0x34b103,_0x19f91f['error'][_0x4e18('0x16')]);return _0x137aad(_0x19f91f['error'][_0x4e18('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x34b103,_0x19f91f[_0x4e18('0x13')]['message']);return _0x3dd6a6(_0x19f91f[_0x4e18('0x13')]['message']);}else{logger[_0x4e18('0x17')](_0x4e18('0x15'),_0x34b103,'request\x20sent');_0x3dd6a6(_0x19f91f[_0x4e18('0x18')]['message']);}})[_0x4e18('0x19')](function(_0x70db75){logger[_0x4e18('0x13')](_0x4e18('0x15'),_0x34b103,_0x70db75);_0x137aad(_0x70db75);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index be89b2a..2f430d2 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 _0x109b=['register','team:','./team.events','remove','update','emit','removeListener'];(function(_0x2b9208,_0x57ee50){var _0x29a1ef=function(_0x28244e){while(--_0x28244e){_0x2b9208['push'](_0x2b9208['shift']());}};_0x29a1ef(++_0x57ee50);}(_0x109b,0x159));var _0xb109=function(_0x19aa38,_0xecb46f){_0x19aa38=_0x19aa38-0x0;var _0x4a934d=_0x109b[_0x19aa38];return _0x4a934d;};'use strict';var TeamEvents=require(_0xb109('0x0'));var events=['save',_0xb109('0x1'),_0xb109('0x2')];function createListener(_0x5c1753,_0x51d353){return function(_0x1281c5){_0x51d353[_0xb109('0x3')](_0x5c1753,_0x1281c5);};}function removeListener(_0x2d9fa1,_0x1c8915){return function(){TeamEvents[_0xb109('0x4')](_0x2d9fa1,_0x1c8915);};}exports[_0xb109('0x5')]=function(_0x30c032){for(var _0x39ff9c=0x0,_0x4e8844=events['length'];_0x39ff9c<_0x4e8844;_0x39ff9c++){var _0x5ab771=events[_0x39ff9c];var _0x5d9d87=createListener(_0xb109('0x6')+_0x5ab771,_0x30c032);TeamEvents['on'](_0x5ab771,_0x5d9d87);}}; \ No newline at end of file +var _0x8c7a=['register','team:','./team.events','update','emit','removeListener'];(function(_0x189298,_0x1920fc){var _0x3ecc5d=function(_0x5ebca9){while(--_0x5ebca9){_0x189298['push'](_0x189298['shift']());}};_0x3ecc5d(++_0x1920fc);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x347727,_0x579fd7){_0x347727=_0x347727-0x0;var _0x215da1=_0x8c7a[_0x347727];return _0x215da1;};'use strict';var TeamEvents=require(_0xa8c7('0x0'));var events=['save','remove',_0xa8c7('0x1')];function createListener(_0x485112,_0x1d2011){return function(_0x3bf4c4){_0x1d2011[_0xa8c7('0x2')](_0x485112,_0x3bf4c4);};}function removeListener(_0x582b2c,_0x4a58b9){return function(){TeamEvents[_0xa8c7('0x3')](_0x582b2c,_0x4a58b9);};}exports[_0xa8c7('0x4')]=function(_0x1afbe0){for(var _0x2ecdf1=0x0,_0x416db0=events['length'];_0x2ecdf1<_0x416db0;_0x2ecdf1++){var _0x37d743=events[_0x2ecdf1];var _0x5b85e2=createListener(_0xa8c7('0x5')+_0x37d743,_0x1afbe0);TeamEvents['on'](_0x37d743,_0x5b85e2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b18f261..2f29cd1 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 _0xd66c=['sequelize','INTEGER'];(function(_0x2cfacc,_0xa550b6){var _0x3a254f=function(_0x3436a0){while(--_0x3436a0){_0x2cfacc['push'](_0x2cfacc['shift']());}};_0x3a254f(++_0xa550b6);}(_0xd66c,0x106));var _0xcd66=function(_0x1f91dd,_0x4f3328){_0x1f91dd=_0x1f91dd-0x0;var _0x50f083=_0xd66c[_0x1f91dd];return _0x50f083;};'use strict';var Sequelize=require(_0xcd66('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xcd66('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xcd66('0x1')]}}; \ No newline at end of file +var _0x7117=['sequelize','exports','INTEGER'];(function(_0x3c756c,_0xa01f78){var _0x5ccda4=function(_0x11ee62){while(--_0x11ee62){_0x3c756c['push'](_0x3c756c['shift']());}};_0x5ccda4(++_0xa01f78);}(_0x7117,0x1ec));var _0x7711=function(_0x3f69d0,_0x357535){_0x3f69d0=_0x3f69d0-0x0;var _0x32af35=_0x7117[_0x3f69d0];return _0x32af35;};'use strict';var Sequelize=require(_0x7711('0x0'));module[_0x7711('0x1')]={'TeamId':{'type':Sequelize[_0x7711('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7711('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 35d996c..f6be22a 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 _0x578c=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x578c,0x158));var _0xc578=function(_0x158b0a,_0x5570c9){_0x158b0a=_0x158b0a-0x0;var _0x31fa0b=_0x578c[_0x158b0a];return _0x31fa0b;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var logger=require(_0xc578('0x2'))('api');var moment=require(_0xc578('0x3'));var BPromise=require(_0xc578('0x4'));var rp=require(_0xc578('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc578('0x6'));var config=require(_0xc578('0x7'));var attributes=require(_0xc578('0x8'));module[_0xc578('0x9')]=function(_0x178786,_0x3305c9){return _0x178786[_0xc578('0xa')](_0xc578('0xb'),attributes,{'tableName':_0xc578('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85de=['team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix'];(function(_0x5f58bc,_0x3e0b07){var _0x45bf84=function(_0x57e13d){while(--_0x57e13d){_0x5f58bc['push'](_0x5f58bc['shift']());}};_0x45bf84(++_0x3e0b07);}(_0x85de,0x1f0));var _0xe85d=function(_0x1fbf59,_0x2ed06a){_0x1fbf59=_0x1fbf59-0x0;var _0x5143d2=_0x85de[_0x1fbf59];return _0x5143d2;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var logger=require(_0xe85d('0x2'))(_0xe85d('0x3'));var moment=require(_0xe85d('0x4'));var BPromise=require('bluebird');var rp=require(_0xe85d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe85d('0x6'));var attributes=require(_0xe85d('0x7'));module['exports']=function(_0x1e9dea,_0xb70e1d){return _0x1e9dea[_0xe85d('0x8')](_0xe85d('0x9'),attributes,{'tableName':_0xe85d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index debed09..b44738a 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1ed364,_0x196a00){var _0x3b69fa=function(_0x48caa0){while(--_0x48caa0){_0x1ed364['push'](_0x1ed364['shift']());}};_0x3b69fa(++_0x196a00);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xcb91[_0x58afd5];return _0x3e503b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f113458..9006424 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 _0x3b64=['sequelize','exports','INTEGER'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3b64,0x1b0));var _0x43b6=function(_0x96b351,_0x1757e8){_0x96b351=_0x96b351-0x0;var _0x61b0f3=_0x3b64[_0x96b351];return _0x61b0f3;};'use strict';var Sequelize=require(_0x43b6('0x0'));module[_0x43b6('0x1')]={'penalty':{'type':Sequelize[_0x43b6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 2c5cba8..fc960c4 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 _0x502a=['path','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment'];(function(_0x236013,_0x536975){var _0x389739=function(_0xa06437){while(--_0xa06437){_0x236013['push'](_0x236013['shift']());}};_0x389739(++_0x536975);}(_0x502a,0xd8));var _0xa502=function(_0x47f56e,_0x1647db){_0x47f56e=_0x47f56e-0x0;var _0x3f3564=_0x502a[_0x47f56e];return _0x3f3564;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var moment=require(_0xa502('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa502('0x4'));var rimraf=require('rimraf');var config=require(_0xa502('0x5'));var attributes=require(_0xa502('0x6'));module[_0xa502('0x7')]=function(_0x1cb2e4,_0x136d51){return _0x1cb2e4['define'](_0xa502('0x8'),attributes,{'tableName':_0xa502('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6753=['bluebird','request-promise','rimraf','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x31064d,_0x5bb8e8){var _0x678c91=function(_0x20606b){while(--_0x20606b){_0x31064d['push'](_0x31064d['shift']());}};_0x678c91(++_0x5bb8e8);}(_0x6753,0xa1));var _0x3675=function(_0x39356a,_0x28aba){_0x39356a=_0x39356a-0x0;var _0x38fb86=_0x6753[_0x39356a];return _0x38fb86;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require(_0x3675('0x2'))(_0x3675('0x3'));var moment=require('moment');var BPromise=require(_0x3675('0x4'));var rp=require(_0x3675('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x4e4e73,_0x396a35){return _0x4e4e73[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 7332a60..005781b 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 _0xc1e8=['rpc','../../config/environment','jayson/promise','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x327dbd,_0x2bd34d){var _0x58775e=function(_0x5a9d66){while(--_0x5a9d66){_0x327dbd['push'](_0x327dbd['shift']());}};_0x58775e(++_0x2bd34d);}(_0xc1e8,0x87));var _0x8c1e=function(_0x11fb16,_0x29a381){_0x11fb16=_0x11fb16-0x0;var _0x343de1=_0xc1e8[_0x11fb16];return _0x343de1;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var moment=require(_0x8c1e('0x2'));var BPromise=require(_0x8c1e('0x3'));var rs=require(_0x8c1e('0x4'));var fs=require('fs');var Redis=require(_0x8c1e('0x5'));var db=require(_0x8c1e('0x6'))['db'];var utils=require(_0x8c1e('0x7'));var logger=require(_0x8c1e('0x8'))(_0x8c1e('0x9'));var config=require(_0x8c1e('0xa'));var jayson=require(_0x8c1e('0xb'));var client=jayson['client'][_0x8c1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x310103,_0x2b9f52,_0x5e6d1b){return new BPromise(function(_0x3c120a,_0x3d6703){return client[_0x8c1e('0xd')](_0x310103,_0x5e6d1b)[_0x8c1e('0xe')](function(_0x20ded3){logger['info'](_0x8c1e('0xf'),_0x2b9f52,_0x8c1e('0x10'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2b9f52,'request\x20sent',JSON[_0x8c1e('0x11')](_0x20ded3));if(_0x20ded3['error']){if(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x13')]===0x1f4){logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x20ded3[_0x8c1e('0x12')]['message']);return _0x3d6703(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);}logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);return _0x3c120a(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);}else{logger[_0x8c1e('0x15')](_0x8c1e('0xf'),_0x2b9f52,_0x8c1e('0x10'));_0x3c120a(_0x20ded3[_0x8c1e('0x16')]['message']);}})[_0x8c1e('0x17')](function(_0x1a3497){logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x1a3497);_0x3d6703(_0x1a3497);});});} \ No newline at end of file +var _0x8b50=['stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x891b81,_0xfbb107){var _0x585932=function(_0x18e04d){while(--_0x18e04d){_0x891b81['push'](_0x891b81['shift']());}};_0x585932(++_0xfbb107);}(_0x8b50,0x13f));var _0x08b5=function(_0x24b5b4,_0x5e76ae){_0x24b5b4=_0x24b5b4-0x0;var _0xb5e28a=_0x8b50[_0x24b5b4];return _0xb5e28a;};'use strict';var _=require(_0x08b5('0x0'));var util=require(_0x08b5('0x1'));var moment=require(_0x08b5('0x2'));var BPromise=require(_0x08b5('0x3'));var rs=require(_0x08b5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08b5('0x5'));var logger=require(_0x08b5('0x6'))(_0x08b5('0x7'));var config=require(_0x08b5('0x8'));var jayson=require(_0x08b5('0x9'));var client=jayson[_0x08b5('0xa')][_0x08b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498928,_0x5a0ea1,_0x18dcd0){return new BPromise(function(_0x34a670,_0x342af9){return client[_0x08b5('0xc')](_0x498928,_0x18dcd0)[_0x08b5('0xd')](function(_0x104e1b){logger[_0x08b5('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5a0ea1,_0x08b5('0xf'));logger[_0x08b5('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5a0ea1,_0x08b5('0xf'),JSON[_0x08b5('0x11')](_0x104e1b));if(_0x104e1b[_0x08b5('0x12')]){if(_0x104e1b[_0x08b5('0x12')][_0x08b5('0x13')]===0x1f4){logger[_0x08b5('0x12')](_0x08b5('0x14'),_0x5a0ea1,_0x104e1b[_0x08b5('0x12')][_0x08b5('0x15')]);return _0x342af9(_0x104e1b[_0x08b5('0x12')][_0x08b5('0x15')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5a0ea1,_0x104e1b[_0x08b5('0x12')][_0x08b5('0x15')]);return _0x34a670(_0x104e1b[_0x08b5('0x12')]['message']);}else{logger[_0x08b5('0xe')](_0x08b5('0x14'),_0x5a0ea1,_0x08b5('0xf'));_0x34a670(_0x104e1b[_0x08b5('0x16')][_0x08b5('0x15')]);}})[_0x08b5('0x17')](function(_0x4600bb){logger[_0x08b5('0x12')](_0x08b5('0x14'),_0x5a0ea1,_0x4600bb);_0x342af9(_0x4600bb);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 6eb44d5..64f10d0 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 _0x887b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','/:id','post','isAuthenticated','update','destroy','exports','multer','util'];(function(_0x3502bf,_0x22808c){var _0xe9e888=function(_0x13e4bf){while(--_0x13e4bf){_0x3502bf['push'](_0x3502bf['shift']());}};_0xe9e888(++_0x22808c);}(_0x887b,0x185));var _0xb887=function(_0x6a1399,_0x23e5d9){_0x6a1399=_0x6a1399-0x0;var _0x579e2d=_0x887b[_0x6a1399];return _0x579e2d;};'use strict';var multer=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var timeout=require(_0xb887('0x3'));var express=require(_0xb887('0x4'));var router=express[_0xb887('0x5')]();var fs_extra=require(_0xb887('0x6'));var auth=require(_0xb887('0x7'));var interaction=require(_0xb887('0x8'));var config=require('../../config/environment');var controller=require(_0xb887('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb887('0xa')](_0xb887('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb887('0xc')]('/',auth[_0xb887('0xd')](),controller['create']);router['put']('/:id',auth[_0xb887('0xd')](),controller[_0xb887('0xe')]);router['delete'](_0xb887('0xb'),auth['isAuthenticated'](),controller[_0xb887('0xf')]);module[_0xb887('0x10')]=router; \ No newline at end of file +var _0x07a2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3116b0,_0x4e368e){var _0x142b5d=function(_0x10f8ed){while(--_0x10f8ed){_0x3116b0['push'](_0x3116b0['shift']());}};_0x142b5d(++_0x4e368e);}(_0x07a2,0x12c));var _0x207a=function(_0x2d1371,_0x43aef7){_0x2d1371=_0x2d1371-0x0;var _0xf17680=_0x07a2[_0x2d1371];return _0xf17680;};'use strict';var multer=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var path=require('path');var timeout=require(_0x207a('0x2'));var express=require(_0x207a('0x3'));var router=express[_0x207a('0x4')]();var fs_extra=require(_0x207a('0x5'));var auth=require(_0x207a('0x6'));var interaction=require(_0x207a('0x7'));var config=require(_0x207a('0x8'));var controller=require(_0x207a('0x9'));router[_0x207a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x207a('0xa')](_0x207a('0xb'),auth[_0x207a('0xc')](),controller[_0x207a('0xd')]);router[_0x207a('0xe')]('/',auth[_0x207a('0xc')](),controller['create']);router['put'](_0x207a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x207a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x207a('0x10')]);module[_0x207a('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index da616ab..3fc2b26 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 _0x2367=['TEXT','sequelize','STRING'];(function(_0x25c58c,_0x5ce8ee){var _0x1cc1d0=function(_0x50f90e){while(--_0x50f90e){_0x25c58c['push'](_0x25c58c['shift']());}};_0x1cc1d0(++_0x5ce8ee);}(_0x2367,0x19c));var _0x7236=function(_0x256537,_0x5dadaf){_0x256537=_0x256537-0x0;var _0xd424bb=_0x2367[_0x256537];return _0xd424bb;};'use strict';var Sequelize=require(_0x7236('0x0'));module['exports']={'name':{'type':Sequelize[_0x7236('0x1')]},'description':{'type':Sequelize[_0x7236('0x1')]},'html':{'type':Sequelize[_0x7236('0x2')]}}; \ No newline at end of file +var _0x8838=['sequelize','exports','STRING'];(function(_0x79f6ac,_0x5c10f2){var _0x9660f3=function(_0x38fe05){while(--_0x38fe05){_0x79f6ac['push'](_0x79f6ac['shift']());}};_0x9660f3(++_0x5c10f2);}(_0x8838,0xfc));var _0x8883=function(_0x22c5ef,_0x5d3656){_0x22c5ef=_0x22c5ef-0x0;var _0x246aca=_0x8838[_0x22c5ef];return _0x246aca;};'use strict';var Sequelize=require(_0x8883('0x0'));module[_0x8883('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8883('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 9def6c8..44d4131 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 _0x0b28=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','Template','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x58b4f4,_0x205ed2){var _0x1bc562=function(_0xd2dd5f){while(--_0xd2dd5f){_0x58b4f4['push'](_0x58b4f4['shift']());}};_0x1bc562(++_0x205ed2);}(_0x0b28,0x18f));var _0x80b2=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x0b28[_0x5f46e7];return _0x567e95;};'use strict';var emlformat=require(_0x80b2('0x0'));var rimraf=require(_0x80b2('0x1'));var zipdir=require(_0x80b2('0x2'));var jsonpatch=require(_0x80b2('0x3'));var rp=require(_0x80b2('0x4'));var moment=require('moment');var BPromise=require(_0x80b2('0x5'));var Mustache=require(_0x80b2('0x6'));var util=require('util');var path=require(_0x80b2('0x7'));var sox=require(_0x80b2('0x8'));var csv=require(_0x80b2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80b2('0xa'));var _=require(_0x80b2('0xb'));var squel=require(_0x80b2('0xc'));var crypto=require(_0x80b2('0xd'));var jsforce=require(_0x80b2('0xe'));var deskjs=require(_0x80b2('0xf'));var toCsv=require(_0x80b2('0x9'));var querystring=require('querystring');var Papa=require(_0x80b2('0x10'));var Redis=require(_0x80b2('0x11'));var authService=require(_0x80b2('0x12'));var qs=require(_0x80b2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x80b2('0x14'));var config=require(_0x80b2('0x15'));var licenseUtil=require(_0x80b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403fa3,_0x205b9c){_0x205b9c=_0x205b9c||0xcc;return function(_0x51a720){if(_0x51a720){return _0x403fa3[_0x80b2('0x17')](_0x205b9c);}return _0x403fa3[_0x80b2('0x18')](_0x205b9c)[_0x80b2('0x19')]();};}function respondWithResult(_0x29c20e,_0x35e7a4){_0x35e7a4=_0x35e7a4||0xc8;return function(_0x71383){if(_0x71383){return _0x29c20e[_0x80b2('0x18')](_0x35e7a4)[_0x80b2('0x1a')](_0x71383);}};}function respondWithFilteredResult(_0x47f2ec,_0x34a5ff){return function(_0x21c308){if(_0x21c308){var _0xc0b8bd=typeof _0x34a5ff[_0x80b2('0x1b')]==='undefined'&&typeof _0x34a5ff[_0x80b2('0x1c')]===_0x80b2('0x1d');var _0x5514ef=_0x21c308[_0x80b2('0x1e')];var _0x194745=_0xc0b8bd?0x0:_0x34a5ff[_0x80b2('0x1b')];var _0x243944=_0xc0b8bd?_0x21c308[_0x80b2('0x1e')]:_0x34a5ff['offset']+_0x34a5ff[_0x80b2('0x1c')];var _0x5a0d57;if(_0x243944>=_0x5514ef){_0x243944=_0x5514ef;_0x5a0d57=0xc8;}else{_0x5a0d57=0xce;}_0x47f2ec['status'](_0x5a0d57);return _0x47f2ec[_0x80b2('0x1f')](_0x80b2('0x20'),_0x194745+'-'+_0x243944+'/'+_0x5514ef)['json'](_0x21c308);}return null;};}function patchUpdates(_0x41047e){return function(_0x1587d3){try{jsonpatch[_0x80b2('0x21')](_0x1587d3,_0x41047e,!![]);}catch(_0x4039f8){return BPromise[_0x80b2('0x22')](_0x4039f8);}return _0x1587d3[_0x80b2('0x23')]();};}function saveUpdates(_0x5c2e43,_0x554edd){return function(_0x2cdf53){if(_0x2cdf53){return _0x2cdf53[_0x80b2('0x24')](_0x5c2e43)[_0x80b2('0x25')](function(_0xa2a4c4){return _0xa2a4c4;});}return null;};}function removeEntity(_0x57942f,_0x43d4b3){return function(_0x556493){if(_0x556493){return _0x556493[_0x80b2('0x26')]()['then'](function(){var _0xc2cffd=_0x556493['get']({'plain':!![]});var _0x553c56='Templates';return db[_0x80b2('0x27')][_0x80b2('0x26')]({'where':{'type':_0x553c56,'resourceId':_0xc2cffd['id']}})[_0x80b2('0x25')](function(){return _0x556493;});})[_0x80b2('0x25')](function(){_0x57942f[_0x80b2('0x18')](0xcc)[_0x80b2('0x19')]();});}};}function handleEntityNotFound(_0x699321,_0x22f358){return function(_0x5e6821){if(!_0x5e6821){_0x699321['sendStatus'](0x194);}return _0x5e6821;};}function handleError(_0x260ce6,_0x11c97c){_0x11c97c=_0x11c97c||0x1f4;return function(_0x3fb20a){logger[_0x80b2('0x28')](_0x3fb20a['stack']);if(_0x3fb20a['name']){delete _0x3fb20a[_0x80b2('0x29')];}_0x260ce6['status'](_0x11c97c)[_0x80b2('0x2a')](_0x3fb20a);};}exports[_0x80b2('0x2b')]=function(_0x52c21d,_0x5be9ca){var _0x28b240={},_0x453da2={},_0x8077d={'count':0x0,'rows':[]};var _0x53d66f=_[_0x80b2('0x2c')](db[_0x80b2('0x2d')][_0x80b2('0x2e')],function(_0x1230ec){return{'name':_0x1230ec['fieldName'],'type':_0x1230ec[_0x80b2('0x2f')][_0x80b2('0x30')]};});_0x453da2['model']=_['map'](_0x53d66f,_0x80b2('0x29'));_0x453da2[_0x80b2('0x31')]=_['keys'](_0x52c21d[_0x80b2('0x31')]);_0x453da2[_0x80b2('0x32')]=_['intersection'](_0x453da2[_0x80b2('0x33')],_0x453da2[_0x80b2('0x31')]);_0x28b240[_0x80b2('0x34')]=_[_0x80b2('0x35')](_0x453da2[_0x80b2('0x33')],qs[_0x80b2('0x36')](_0x52c21d[_0x80b2('0x31')][_0x80b2('0x36')]));_0x28b240[_0x80b2('0x34')]=_0x28b240[_0x80b2('0x34')]['length']?_0x28b240[_0x80b2('0x34')]:_0x453da2[_0x80b2('0x33')];if(!_0x52c21d[_0x80b2('0x31')]['hasOwnProperty'](_0x80b2('0x37'))){_0x28b240['limit']=qs[_0x80b2('0x1c')](_0x52c21d[_0x80b2('0x31')][_0x80b2('0x1c')]);_0x28b240[_0x80b2('0x1b')]=qs[_0x80b2('0x1b')](_0x52c21d[_0x80b2('0x31')]['offset']);}_0x28b240[_0x80b2('0x38')]=qs[_0x80b2('0x39')](_0x52c21d[_0x80b2('0x31')][_0x80b2('0x39')]);_0x28b240[_0x80b2('0x3a')]=qs['filters'](_[_0x80b2('0x3b')](_0x52c21d['query'],_0x453da2[_0x80b2('0x32')]),_0x53d66f);if(_0x52c21d[_0x80b2('0x31')][_0x80b2('0x3c')]){_0x28b240[_0x80b2('0x3a')]=_[_0x80b2('0x3d')](_0x28b240[_0x80b2('0x3a')],{'$or':_[_0x80b2('0x2c')](_0x53d66f,function(_0x5cc61d){if(_0x5cc61d['type']!==_0x80b2('0x3e')){var _0x504e50={};_0x504e50[_0x5cc61d[_0x80b2('0x29')]]={'$like':'%'+_0x52c21d[_0x80b2('0x31')][_0x80b2('0x3c')]+'%'};return _0x504e50;}})});}_0x28b240=_[_0x80b2('0x3d')]({},_0x28b240,_0x52c21d['options']);var _0x41c10c={'where':_0x28b240[_0x80b2('0x3a')]};return db[_0x80b2('0x2d')][_0x80b2('0x1e')](_0x41c10c)['then'](function(_0x35c9c3){_0x8077d[_0x80b2('0x1e')]=_0x35c9c3;if(_0x52c21d['query'][_0x80b2('0x3f')]){_0x28b240[_0x80b2('0x40')]=[{'all':!![]}];}return db['Template'][_0x80b2('0x41')](_0x28b240);})[_0x80b2('0x25')](function(_0x428749){_0x8077d[_0x80b2('0x42')]=_0x428749;return _0x8077d;})[_0x80b2('0x25')](respondWithFilteredResult(_0x5be9ca,_0x28b240))[_0x80b2('0x43')](handleError(_0x5be9ca,null));};exports[_0x80b2('0x44')]=function(_0x4fd528,_0x313c00){var _0x1909dc={'raw':!![],'where':{'id':_0x4fd528[_0x80b2('0x45')]['id']}},_0x2a2d7f={};_0x2a2d7f[_0x80b2('0x33')]=_[_0x80b2('0x46')](db[_0x80b2('0x2d')][_0x80b2('0x2e')]);_0x2a2d7f[_0x80b2('0x31')]=_[_0x80b2('0x46')](_0x4fd528['query']);_0x2a2d7f[_0x80b2('0x32')]=_[_0x80b2('0x35')](_0x2a2d7f[_0x80b2('0x33')],_0x2a2d7f[_0x80b2('0x31')]);_0x1909dc[_0x80b2('0x34')]=_[_0x80b2('0x35')](_0x2a2d7f['model'],qs[_0x80b2('0x36')](_0x4fd528[_0x80b2('0x31')][_0x80b2('0x36')]));_0x1909dc[_0x80b2('0x34')]=_0x1909dc[_0x80b2('0x34')][_0x80b2('0x47')]?_0x1909dc[_0x80b2('0x34')]:_0x2a2d7f[_0x80b2('0x33')];if(_0x4fd528[_0x80b2('0x31')][_0x80b2('0x3f')]){_0x1909dc[_0x80b2('0x40')]=[{'all':!![]}];}_0x1909dc=_[_0x80b2('0x3d')]({},_0x1909dc,_0x4fd528[_0x80b2('0x48')]);return db[_0x80b2('0x2d')]['find'](_0x1909dc)[_0x80b2('0x25')](handleEntityNotFound(_0x313c00,null))[_0x80b2('0x25')](respondWithResult(_0x313c00,null))[_0x80b2('0x43')](handleError(_0x313c00,null));};exports[_0x80b2('0x49')]=function(_0x23a763,_0x20f527){return db[_0x80b2('0x2d')][_0x80b2('0x49')](_0x23a763[_0x80b2('0x4a')],{})[_0x80b2('0x25')](function(_0x572d38){var _0x18bd33=_0x23a763[_0x80b2('0x4b')][_0x80b2('0x4c')]({'plain':!![]});if(!_0x18bd33)throw new Error(_0x80b2('0x4d'));if(_0x18bd33['role']===_0x80b2('0x4b')){var _0x10889a=_0x572d38[_0x80b2('0x4c')]({'plain':!![]});var _0x43f7f7='Templates';return db[_0x80b2('0x4e')][_0x80b2('0x4f')]({'where':{'name':_0x43f7f7,'userProfileId':_0x18bd33[_0x80b2('0x50')]},'raw':!![]})[_0x80b2('0x25')](function(_0x928d74){if(_0x928d74&&_0x928d74[_0x80b2('0x51')]===0x0){return db['UserProfileResource'][_0x80b2('0x49')]({'name':_0x10889a['name'],'resourceId':_0x10889a['id'],'type':_0x928d74[_0x80b2('0x29')],'sectionId':_0x928d74['id']},{})[_0x80b2('0x25')](function(){return _0x572d38;});}else{return _0x572d38;}})[_0x80b2('0x43')](function(_0x1600ad){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1600ad);throw _0x1600ad;});}return _0x572d38;})[_0x80b2('0x25')](respondWithResult(_0x20f527,0xc9))[_0x80b2('0x43')](handleError(_0x20f527,null));};exports[_0x80b2('0x24')]=function(_0x278211,_0x384bdf){if(_0x278211[_0x80b2('0x4a')]['id']){delete _0x278211['body']['id'];}return db[_0x80b2('0x2d')][_0x80b2('0x4f')]({'where':{'id':_0x278211['params']['id']}})[_0x80b2('0x25')](handleEntityNotFound(_0x384bdf,null))[_0x80b2('0x25')](saveUpdates(_0x278211['body'],null))['then'](respondWithResult(_0x384bdf,null))[_0x80b2('0x43')](handleError(_0x384bdf,null));};exports['destroy']=function(_0x293957,_0x423e1f){return db[_0x80b2('0x2d')][_0x80b2('0x4f')]({'where':{'id':_0x293957[_0x80b2('0x45')]['id']}})[_0x80b2('0x25')](handleEntityNotFound(_0x423e1f,null))['then'](removeEntity(_0x423e1f,null))[_0x80b2('0x43')](handleError(_0x423e1f,null));}; \ No newline at end of file +var _0x0f99=['index','map','Template','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name'];(function(_0x50f834,_0x11dbf7){var _0x49caf9=function(_0x5db235){while(--_0x5db235){_0x50f834['push'](_0x50f834['shift']());}};_0x49caf9(++_0x11dbf7);}(_0x0f99,0x1ac));var _0x90f9=function(_0x187677,_0xc19538){_0x187677=_0x187677-0x0;var _0xd31061=_0x0f99[_0x187677];return _0xd31061;};'use strict';var emlformat=require(_0x90f9('0x0'));var rimraf=require(_0x90f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x90f9('0x2'));var BPromise=require(_0x90f9('0x3'));var Mustache=require('mustache');var util=require(_0x90f9('0x4'));var path=require('path');var sox=require(_0x90f9('0x5'));var csv=require('to-csv');var ejs=require(_0x90f9('0x6'));var fs=require('fs');var fs_extra=require(_0x90f9('0x7'));var _=require(_0x90f9('0x8'));var squel=require(_0x90f9('0x9'));var crypto=require(_0x90f9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x90f9('0xb'));var toCsv=require(_0x90f9('0xc'));var querystring=require(_0x90f9('0xd'));var Papa=require(_0x90f9('0xe'));var Redis=require(_0x90f9('0xf'));var authService=require(_0x90f9('0x10'));var qs=require(_0x90f9('0x11'));var as=require(_0x90f9('0x12'));var hardwareService=require(_0x90f9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x90f9('0x14'));var config=require(_0x90f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ba6f6,_0x3ba6b4){_0x3ba6b4=_0x3ba6b4||0xcc;return function(_0x2bb6fc){if(_0x2bb6fc){return _0x3ba6f6[_0x90f9('0x16')](_0x3ba6b4);}return _0x3ba6f6[_0x90f9('0x17')](_0x3ba6b4)['end']();};}function respondWithResult(_0x35c8bb,_0x2957a1){_0x2957a1=_0x2957a1||0xc8;return function(_0x1a049d){if(_0x1a049d){return _0x35c8bb[_0x90f9('0x17')](_0x2957a1)[_0x90f9('0x18')](_0x1a049d);}};}function respondWithFilteredResult(_0x1caa57,_0x34df31){return function(_0x3e3cb0){if(_0x3e3cb0){var _0x450e1a=typeof _0x34df31[_0x90f9('0x19')]===_0x90f9('0x1a')&&typeof _0x34df31['limit']===_0x90f9('0x1a');var _0x268207=_0x3e3cb0['count'];var _0x2c7031=_0x450e1a?0x0:_0x34df31[_0x90f9('0x19')];var _0x3cbb86=_0x450e1a?_0x3e3cb0[_0x90f9('0x1b')]:_0x34df31[_0x90f9('0x19')]+_0x34df31['limit'];var _0x1bf2f0;if(_0x3cbb86>=_0x268207){_0x3cbb86=_0x268207;_0x1bf2f0=0xc8;}else{_0x1bf2f0=0xce;}_0x1caa57[_0x90f9('0x17')](_0x1bf2f0);return _0x1caa57['set'](_0x90f9('0x1c'),_0x2c7031+'-'+_0x3cbb86+'/'+_0x268207)[_0x90f9('0x18')](_0x3e3cb0);}return null;};}function patchUpdates(_0x5eb998){return function(_0x362377){try{jsonpatch['apply'](_0x362377,_0x5eb998,!![]);}catch(_0x134959){return BPromise[_0x90f9('0x1d')](_0x134959);}return _0x362377[_0x90f9('0x1e')]();};}function saveUpdates(_0x1b88a8,_0x392837){return function(_0x50fd3b){if(_0x50fd3b){return _0x50fd3b[_0x90f9('0x1f')](_0x1b88a8)[_0x90f9('0x20')](function(_0x1c1e9e){return _0x1c1e9e;});}return null;};}function removeEntity(_0x593947,_0x4ec443){return function(_0x4b7725){if(_0x4b7725){return _0x4b7725[_0x90f9('0x21')]()[_0x90f9('0x20')](function(){var _0x263476=_0x4b7725[_0x90f9('0x22')]({'plain':!![]});var _0x183a58=_0x90f9('0x23');return db[_0x90f9('0x24')][_0x90f9('0x21')]({'where':{'type':_0x183a58,'resourceId':_0x263476['id']}})[_0x90f9('0x20')](function(){return _0x4b7725;});})[_0x90f9('0x20')](function(){_0x593947['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f2e6a,_0x1e1f5b){return function(_0xbc1c2){if(!_0xbc1c2){_0x2f2e6a['sendStatus'](0x194);}return _0xbc1c2;};}function handleError(_0x3690f3,_0xb829b5){_0xb829b5=_0xb829b5||0x1f4;return function(_0xe8704c){logger[_0x90f9('0x25')](_0xe8704c[_0x90f9('0x26')]);if(_0xe8704c[_0x90f9('0x27')]){delete _0xe8704c[_0x90f9('0x27')];}_0x3690f3[_0x90f9('0x17')](_0xb829b5)['send'](_0xe8704c);};}exports[_0x90f9('0x28')]=function(_0x3c04fd,_0x2d429b){var _0x215a14={},_0xdab2b8={},_0x110cec={'count':0x0,'rows':[]};var _0xc77fa=_[_0x90f9('0x29')](db[_0x90f9('0x2a')][_0x90f9('0x2b')],function(_0x11ac22){return{'name':_0x11ac22[_0x90f9('0x2c')],'type':_0x11ac22[_0x90f9('0x2d')][_0x90f9('0x2e')]};});_0xdab2b8[_0x90f9('0x2f')]=_[_0x90f9('0x29')](_0xc77fa,_0x90f9('0x27'));_0xdab2b8[_0x90f9('0x30')]=_['keys'](_0x3c04fd[_0x90f9('0x30')]);_0xdab2b8['filters']=_[_0x90f9('0x31')](_0xdab2b8['model'],_0xdab2b8['query']);_0x215a14[_0x90f9('0x32')]=_[_0x90f9('0x31')](_0xdab2b8[_0x90f9('0x2f')],qs[_0x90f9('0x33')](_0x3c04fd['query'][_0x90f9('0x33')]));_0x215a14[_0x90f9('0x32')]=_0x215a14[_0x90f9('0x32')]['length']?_0x215a14[_0x90f9('0x32')]:_0xdab2b8[_0x90f9('0x2f')];if(!_0x3c04fd[_0x90f9('0x30')][_0x90f9('0x34')](_0x90f9('0x35'))){_0x215a14['limit']=qs['limit'](_0x3c04fd[_0x90f9('0x30')][_0x90f9('0x36')]);_0x215a14['offset']=qs[_0x90f9('0x19')](_0x3c04fd[_0x90f9('0x30')][_0x90f9('0x19')]);}_0x215a14['order']=qs[_0x90f9('0x37')](_0x3c04fd[_0x90f9('0x30')][_0x90f9('0x37')]);_0x215a14[_0x90f9('0x38')]=qs['filters'](_[_0x90f9('0x39')](_0x3c04fd[_0x90f9('0x30')],_0xdab2b8['filters']),_0xc77fa);if(_0x3c04fd['query'][_0x90f9('0x3a')]){_0x215a14['where']=_[_0x90f9('0x3b')](_0x215a14[_0x90f9('0x38')],{'$or':_['map'](_0xc77fa,function(_0x24f4d5){if(_0x24f4d5[_0x90f9('0x2d')]!=='VIRTUAL'){var _0x4ca18d={};_0x4ca18d[_0x24f4d5[_0x90f9('0x27')]]={'$like':'%'+_0x3c04fd[_0x90f9('0x30')][_0x90f9('0x3a')]+'%'};return _0x4ca18d;}})});}_0x215a14=_['merge']({},_0x215a14,_0x3c04fd[_0x90f9('0x3c')]);var _0x22b69f={'where':_0x215a14['where']};return db[_0x90f9('0x2a')][_0x90f9('0x1b')](_0x22b69f)[_0x90f9('0x20')](function(_0x5434c1){_0x110cec[_0x90f9('0x1b')]=_0x5434c1;if(_0x3c04fd[_0x90f9('0x30')][_0x90f9('0x3d')]){_0x215a14[_0x90f9('0x3e')]=[{'all':!![]}];}return db[_0x90f9('0x2a')][_0x90f9('0x3f')](_0x215a14);})[_0x90f9('0x20')](function(_0x32bdd6){_0x110cec[_0x90f9('0x40')]=_0x32bdd6;return _0x110cec;})[_0x90f9('0x20')](respondWithFilteredResult(_0x2d429b,_0x215a14))['catch'](handleError(_0x2d429b,null));};exports[_0x90f9('0x41')]=function(_0x439882,_0x774b04){var _0x473156={'raw':!![],'where':{'id':_0x439882[_0x90f9('0x42')]['id']}},_0x3e2d40={};_0x3e2d40['model']=_['keys'](db[_0x90f9('0x2a')][_0x90f9('0x2b')]);_0x3e2d40[_0x90f9('0x30')]=_[_0x90f9('0x43')](_0x439882[_0x90f9('0x30')]);_0x3e2d40['filters']=_[_0x90f9('0x31')](_0x3e2d40[_0x90f9('0x2f')],_0x3e2d40[_0x90f9('0x30')]);_0x473156[_0x90f9('0x32')]=_[_0x90f9('0x31')](_0x3e2d40[_0x90f9('0x2f')],qs[_0x90f9('0x33')](_0x439882[_0x90f9('0x30')]['fields']));_0x473156[_0x90f9('0x32')]=_0x473156[_0x90f9('0x32')][_0x90f9('0x44')]?_0x473156['attributes']:_0x3e2d40[_0x90f9('0x2f')];if(_0x439882[_0x90f9('0x30')][_0x90f9('0x3d')]){_0x473156[_0x90f9('0x3e')]=[{'all':!![]}];}_0x473156=_[_0x90f9('0x3b')]({},_0x473156,_0x439882[_0x90f9('0x3c')]);return db[_0x90f9('0x2a')][_0x90f9('0x45')](_0x473156)[_0x90f9('0x20')](handleEntityNotFound(_0x774b04,null))['then'](respondWithResult(_0x774b04,null))[_0x90f9('0x46')](handleError(_0x774b04,null));};exports[_0x90f9('0x47')]=function(_0x2c99d0,_0x3c3c9c){return db[_0x90f9('0x2a')][_0x90f9('0x47')](_0x2c99d0[_0x90f9('0x48')],{})[_0x90f9('0x20')](function(_0x62b918){var _0x4065d8=_0x2c99d0[_0x90f9('0x49')][_0x90f9('0x22')]({'plain':!![]});if(!_0x4065d8)throw new Error(_0x90f9('0x4a'));if(_0x4065d8['role']==='user'){var _0x4d27aa=_0x62b918[_0x90f9('0x22')]({'plain':!![]});var _0x27587e='Templates';return db['UserProfileSection'][_0x90f9('0x45')]({'where':{'name':_0x27587e,'userProfileId':_0x4065d8[_0x90f9('0x4b')]},'raw':!![]})[_0x90f9('0x20')](function(_0x39c19b){if(_0x39c19b&&_0x39c19b[_0x90f9('0x4c')]===0x0){return db[_0x90f9('0x24')]['create']({'name':_0x4d27aa[_0x90f9('0x27')],'resourceId':_0x4d27aa['id'],'type':_0x39c19b['name'],'sectionId':_0x39c19b['id']},{})[_0x90f9('0x20')](function(){return _0x62b918;});}else{return _0x62b918;}})[_0x90f9('0x46')](function(_0x9a416a){logger[_0x90f9('0x25')](_0x90f9('0x4d'),_0x9a416a);throw _0x9a416a;});}return _0x62b918;})[_0x90f9('0x20')](respondWithResult(_0x3c3c9c,0xc9))['catch'](handleError(_0x3c3c9c,null));};exports[_0x90f9('0x1f')]=function(_0x13e4ef,_0x9b2b3f){if(_0x13e4ef[_0x90f9('0x48')]['id']){delete _0x13e4ef[_0x90f9('0x48')]['id'];}return db[_0x90f9('0x2a')][_0x90f9('0x45')]({'where':{'id':_0x13e4ef[_0x90f9('0x42')]['id']}})[_0x90f9('0x20')](handleEntityNotFound(_0x9b2b3f,null))[_0x90f9('0x20')](saveUpdates(_0x13e4ef['body'],null))[_0x90f9('0x20')](respondWithResult(_0x9b2b3f,null))[_0x90f9('0x46')](handleError(_0x9b2b3f,null));};exports[_0x90f9('0x21')]=function(_0x23c3ee,_0x24199e){return db[_0x90f9('0x2a')][_0x90f9('0x45')]({'where':{'id':_0x23c3ee[_0x90f9('0x42')]['id']}})['then'](handleEntityNotFound(_0x24199e,null))[_0x90f9('0x20')](removeEntity(_0x24199e,null))[_0x90f9('0x46')](handleError(_0x24199e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6cb9ac7..d5f1a16 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 _0xdbc5=['./template.attributes','exports','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x25ca44,_0x111633){var _0x4897c1=function(_0xf344b9){while(--_0xf344b9){_0x25ca44['push'](_0x25ca44['shift']());}};_0x4897c1(++_0x111633);}(_0xdbc5,0x1d8));var _0x5dbc=function(_0x588258,_0x5b26a8){_0x588258=_0x588258-0x0;var _0x4efce8=_0xdbc5[_0x588258];return _0x4efce8;};'use strict';var _=require(_0x5dbc('0x0'));var util=require('util');var logger=require(_0x5dbc('0x1'))(_0x5dbc('0x2'));var moment=require(_0x5dbc('0x3'));var BPromise=require(_0x5dbc('0x4'));var rp=require(_0x5dbc('0x5'));var fs=require('fs');var path=require(_0x5dbc('0x6'));var rimraf=require('rimraf');var config=require(_0x5dbc('0x7'));var attributes=require(_0x5dbc('0x8'));module[_0x5dbc('0x9')]=function(_0xc6649f,_0x12394c){return _0xc6649f['define'](_0x5dbc('0xa'),attributes,{'tableName':_0x5dbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf43=['./template.attributes','define','Template','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1c16aa,_0x1ec270){var _0xb9787e=function(_0x5c307a){while(--_0x5c307a){_0x1c16aa['push'](_0x1c16aa['shift']());}};_0xb9787e(++_0x1ec270);}(_0xbf43,0x183));var _0x3bf4=function(_0x150159,_0x33cebe){_0x150159=_0x150159-0x0;var _0x24cdaa=_0xbf43[_0x150159];return _0x24cdaa;};'use strict';var _=require(_0x3bf4('0x0'));var util=require(_0x3bf4('0x1'));var logger=require(_0x3bf4('0x2'))(_0x3bf4('0x3'));var moment=require(_0x3bf4('0x4'));var BPromise=require(_0x3bf4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bf4('0x6'));var rimraf=require(_0x3bf4('0x7'));var config=require(_0x3bf4('0x8'));var attributes=require(_0x3bf4('0x9'));module['exports']=function(_0x112c32,_0x1f08a1){return _0x112c32[_0x3bf4('0xa')](_0x3bf4('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index e289df7..26f8dff 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 _0xb80b=['map','attributes','model','stringify','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','findAll','options','limit','include'];(function(_0x332d96,_0x2203a9){var _0x25aefd=function(_0x271b48){while(--_0x271b48){_0x332d96['push'](_0x332d96['shift']());}};_0x25aefd(++_0x2203a9);}(_0xb80b,0xf4));var _0xbb80=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb80b[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xbb80('0x0'));var moment=require(_0xbb80('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb80('0x2'));var fs=require('fs');var Redis=require(_0xbb80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb80('0x4'));var logger=require(_0xbb80('0x5'))('rpc');var config=require(_0xbb80('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbb80('0x7')][_0xbb80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd40399,_0x3e9f58,_0x2f7169){return new BPromise(function(_0x5cafb6,_0x5437eb){return client['request'](_0xd40399,_0x2f7169)[_0xbb80('0x9')](function(_0x290657){logger[_0xbb80('0xa')](_0xbb80('0xb'),_0x3e9f58,_0xbb80('0xc'));logger[_0xbb80('0xd')](_0xbb80('0xe'),_0x3e9f58,_0xbb80('0xc'),JSON['stringify'](_0x290657));if(_0x290657[_0xbb80('0xf')]){if(_0x290657[_0xbb80('0xf')][_0xbb80('0x10')]===0x1f4){logger[_0xbb80('0xf')]('Template,\x20%s,\x20%s',_0x3e9f58,_0x290657[_0xbb80('0xf')]['message']);return _0x5437eb(_0x290657['error'][_0xbb80('0x11')]);}logger[_0xbb80('0xf')](_0xbb80('0xb'),_0x3e9f58,_0x290657[_0xbb80('0xf')]['message']);return _0x5cafb6(_0x290657['error']['message']);}else{logger['info'](_0xbb80('0xb'),_0x3e9f58,_0xbb80('0xc'));_0x5cafb6(_0x290657[_0xbb80('0x12')]['message']);}})[_0xbb80('0x13')](function(_0xacf7e2){logger[_0xbb80('0xf')](_0xbb80('0xb'),_0x3e9f58,_0xacf7e2);_0x5437eb(_0xacf7e2);});});}exports[_0xbb80('0x14')]=function(_0x298f1c){var _0x48cf41=this;return new Promise(function(_0x47f25b,_0x43af17){return db[_0xbb80('0x15')][_0xbb80('0x16')]({'raw':_0x298f1c['options']?_0x298f1c[_0xbb80('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x298f1c[_0xbb80('0x17')]?_0x298f1c['options']['where']||null:null,'attributes':_0x298f1c['options']?_0x298f1c[_0xbb80('0x17')]['attributes']||null:null,'limit':_0x298f1c[_0xbb80('0x17')]?_0x298f1c[_0xbb80('0x17')][_0xbb80('0x18')]||null:null,'include':_0x298f1c[_0xbb80('0x17')]?_0x298f1c[_0xbb80('0x17')][_0xbb80('0x19')]?_[_0xbb80('0x1a')](_0x298f1c[_0xbb80('0x17')]['include'],function(_0x264278){return{'model':db[_0x264278['model']],'as':_0x264278['as'],'attributes':_0x264278[_0xbb80('0x1b')],'include':_0x264278['include']?_[_0xbb80('0x1a')](_0x264278[_0xbb80('0x19')],function(_0x33a064){return{'model':db[_0x33a064['model']],'as':_0x33a064['as'],'attributes':_0x33a064['attributes'],'include':_0x33a064['include']?_[_0xbb80('0x1a')](_0x33a064[_0xbb80('0x19')],function(_0x57f418){return{'model':db[_0x57f418[_0xbb80('0x1c')]],'as':_0x57f418['as'],'attributes':_0x57f418[_0xbb80('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bab8c){logger[_0xbb80('0xa')]('GetTemplate',_0x298f1c);logger['debug']('GetTemplate',_0x298f1c,JSON[_0xbb80('0x1d')](_0x4bab8c));_0x47f25b(_0x4bab8c);})[_0xbb80('0x13')](function(_0x3636f5){logger[_0xbb80('0xf')](_0xbb80('0x14'),_0x3636f5['message'],_0x298f1c);_0x43af17(_0x48cf41['error'](0x1f4,_0x3636f5[_0xbb80('0x11')]));});});}; \ No newline at end of file +var _0xb453=['map','model','GetTemplate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0x1282a0,_0x58b2f9){var _0x18af0c=function(_0x5ac73f){while(--_0x5ac73f){_0x1282a0['push'](_0x1282a0['shift']());}};_0x18af0c(++_0x58b2f9);}(_0xb453,0xf3));var _0x3b45=function(_0x3496c0,_0x4c8690){_0x3496c0=_0x3496c0-0x0;var _0x18b36b=_0xb453[_0x3496c0];return _0x18b36b;};'use strict';var _=require(_0x3b45('0x0'));var util=require(_0x3b45('0x1'));var moment=require('moment');var BPromise=require(_0x3b45('0x2'));var rs=require(_0x3b45('0x3'));var fs=require('fs');var Redis=require(_0x3b45('0x4'));var db=require(_0x3b45('0x5'))['db'];var utils=require(_0x3b45('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3b45('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c35be,_0x4a73e2,_0x3ba19e){return new BPromise(function(_0x4b9db4,_0x47a23f){return client[_0x3b45('0x8')](_0x5c35be,_0x3ba19e)[_0x3b45('0x9')](function(_0x571af6){logger['info'](_0x3b45('0xa'),_0x4a73e2,_0x3b45('0xb'));logger[_0x3b45('0xc')](_0x3b45('0xd'),_0x4a73e2,_0x3b45('0xb'),JSON[_0x3b45('0xe')](_0x571af6));if(_0x571af6[_0x3b45('0xf')]){if(_0x571af6[_0x3b45('0xf')][_0x3b45('0x10')]===0x1f4){logger['error'](_0x3b45('0xa'),_0x4a73e2,_0x571af6[_0x3b45('0xf')][_0x3b45('0x11')]);return _0x47a23f(_0x571af6[_0x3b45('0xf')][_0x3b45('0x11')]);}logger['error'](_0x3b45('0xa'),_0x4a73e2,_0x571af6['error']['message']);return _0x4b9db4(_0x571af6['error']['message']);}else{logger[_0x3b45('0x12')](_0x3b45('0xa'),_0x4a73e2,_0x3b45('0xb'));_0x4b9db4(_0x571af6['result'][_0x3b45('0x11')]);}})[_0x3b45('0x13')](function(_0x47a176){logger[_0x3b45('0xf')](_0x3b45('0xa'),_0x4a73e2,_0x47a176);_0x47a23f(_0x47a176);});});}exports['GetTemplate']=function(_0x11c4e0){var _0x26475c=this;return new Promise(function(_0x4f90b6,_0x2e6566){return db['Template'][_0x3b45('0x14')]({'raw':_0x11c4e0[_0x3b45('0x15')]?_0x11c4e0[_0x3b45('0x15')][_0x3b45('0x16')]===undefined?!![]:![]:!![],'where':_0x11c4e0[_0x3b45('0x15')]?_0x11c4e0['options'][_0x3b45('0x17')]||null:null,'attributes':_0x11c4e0[_0x3b45('0x15')]?_0x11c4e0[_0x3b45('0x15')][_0x3b45('0x18')]||null:null,'limit':_0x11c4e0[_0x3b45('0x15')]?_0x11c4e0['options'][_0x3b45('0x19')]||null:null,'include':_0x11c4e0['options']?_0x11c4e0[_0x3b45('0x15')][_0x3b45('0x1a')]?_[_0x3b45('0x1b')](_0x11c4e0['options']['include'],function(_0x4ea9fd){return{'model':db[_0x4ea9fd[_0x3b45('0x1c')]],'as':_0x4ea9fd['as'],'attributes':_0x4ea9fd['attributes'],'include':_0x4ea9fd[_0x3b45('0x1a')]?_[_0x3b45('0x1b')](_0x4ea9fd[_0x3b45('0x1a')],function(_0x320986){return{'model':db[_0x320986[_0x3b45('0x1c')]],'as':_0x320986['as'],'attributes':_0x320986[_0x3b45('0x18')],'include':_0x320986[_0x3b45('0x1a')]?_['map'](_0x320986[_0x3b45('0x1a')],function(_0x5cb3a7){return{'model':db[_0x5cb3a7[_0x3b45('0x1c')]],'as':_0x5cb3a7['as'],'attributes':_0x5cb3a7[_0x3b45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b45('0x9')](function(_0x3f06b5){logger[_0x3b45('0x12')](_0x3b45('0x1d'),_0x11c4e0);logger['debug']('GetTemplate',_0x11c4e0,JSON[_0x3b45('0xe')](_0x3f06b5));_0x4f90b6(_0x3f06b5);})[_0x3b45('0x13')](function(_0x9aedc4){logger[_0x3b45('0xf')](_0x3b45('0x1d'),_0x9aedc4[_0x3b45('0x11')],_0x11c4e0);_0x2e6566(_0x26475c[_0x3b45('0xf')](0x1f4,_0x9aedc4[_0x3b45('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c65145d..0874d55 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 _0x0c6b=['update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','put','/:id'];(function(_0x18f33a,_0x31ead6){var _0x2570d6=function(_0x5c3e4f){while(--_0x5c3e4f){_0x18f33a['push'](_0x18f33a['shift']());}};_0x2570d6(++_0x31ead6);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x50a0a2,_0x549d40){_0x50a0a2=_0x50a0a2-0x0;var _0x2d7901=_0x0c6b[_0x50a0a2];return _0x2d7901;};'use strict';var multer=require(_0xb0c6('0x0'));var util=require('util');var path=require(_0xb0c6('0x1'));var timeout=require(_0xb0c6('0x2'));var express=require(_0xb0c6('0x3'));var router=express[_0xb0c6('0x4')]();var fs_extra=require(_0xb0c6('0x5'));var auth=require(_0xb0c6('0x6'));var interaction=require(_0xb0c6('0x7'));var config=require(_0xb0c6('0x8'));var controller=require(_0xb0c6('0x9'));router[_0xb0c6('0xa')]('/',auth[_0xb0c6('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0c6('0xc')]);router[_0xb0c6('0xa')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xb0c6('0xd')]);router[_0xb0c6('0xa')](_0xb0c6('0xe'),auth[_0xb0c6('0xb')](),controller[_0xb0c6('0xf')]);router[_0xb0c6('0xa')](_0xb0c6('0x10'),auth[_0xb0c6('0xb')](),controller['getActions']);router[_0xb0c6('0x11')]('/',auth['isAuthenticated'](),controller[_0xb0c6('0x12')]);router[_0xb0c6('0x11')](_0xb0c6('0x13'),auth['isAuthenticated'](),controller[_0xb0c6('0x14')]);router[_0xb0c6('0x11')](_0xb0c6('0xe'),auth[_0xb0c6('0xb')](),controller[_0xb0c6('0x15')]);router[_0xb0c6('0x11')](_0xb0c6('0x10'),auth[_0xb0c6('0xb')](),controller['addAction']);router[_0xb0c6('0x16')](_0xb0c6('0x17'),auth[_0xb0c6('0xb')](),controller[_0xb0c6('0x18')]);router['delete'](_0xb0c6('0x17'),auth[_0xb0c6('0xb')](),controller[_0xb0c6('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbacd=['addAllCondition','update','delete','/:id','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/any_conditions','getActions','post','create','/:id/all_conditions'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xbacd,0x194));var _0xdbac=function(_0x3366bc,_0x301955){_0x3366bc=_0x3366bc-0x0;var _0x4a7863=_0xbacd[_0x3366bc];return _0x4a7863;};'use strict';var multer=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var path=require(_0xdbac('0x2'));var timeout=require('connect-timeout');var express=require(_0xdbac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbac('0x4'));var config=require(_0xdbac('0x5'));var controller=require(_0xdbac('0x6'));router[_0xdbac('0x7')]('/',auth[_0xdbac('0x8')](),controller[_0xdbac('0x9')]);router[_0xdbac('0x7')]('/:id',auth[_0xdbac('0x8')](),controller[_0xdbac('0xa')]);router[_0xdbac('0x7')]('/:id/all_conditions',auth[_0xdbac('0x8')](),controller['getAllConditions']);router['get'](_0xdbac('0xb'),auth[_0xdbac('0x8')](),controller['getAnyConditions']);router[_0xdbac('0x7')]('/:id/actions',auth[_0xdbac('0x8')](),controller[_0xdbac('0xc')]);router[_0xdbac('0xd')]('/',auth['isAuthenticated'](),controller[_0xdbac('0xe')]);router[_0xdbac('0xd')](_0xdbac('0xf'),auth[_0xdbac('0x8')](),controller[_0xdbac('0x10')]);router[_0xdbac('0xd')]('/:id/any_conditions',auth[_0xdbac('0x8')](),controller['addAnyCondition']);router[_0xdbac('0xd')]('/:id/actions',auth[_0xdbac('0x8')](),controller['addAction']);router['put']('/:id',auth[_0xdbac('0x8')](),controller[_0xdbac('0x11')]);router[_0xdbac('0x12')](_0xdbac('0x13'),auth[_0xdbac('0x8')](),controller['destroy']);module[_0xdbac('0x14')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 640d28e..7e721f9 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 _0x2236=['BOOLEAN','exports','STRING'];(function(_0x22a2d9,_0x4b375b){var _0x574a5b=function(_0x1515cc){while(--_0x1515cc){_0x22a2d9['push'](_0x22a2d9['shift']());}};_0x574a5b(++_0x4b375b);}(_0x2236,0x64));var _0x6223=function(_0x1a27f3,_0x1c082d){_0x1a27f3=_0x1a27f3-0x0;var _0x3ce222=_0x2236[_0x1a27f3];return _0x3ce222;};'use strict';var Sequelize=require('sequelize');module[_0x6223('0x0')]={'name':{'type':Sequelize[_0x6223('0x1')]},'channel':{'type':Sequelize[_0x6223('0x1')]},'description':{'type':Sequelize[_0x6223('0x1')]},'status':{'type':Sequelize[_0x6223('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7095=['sequelize','exports','STRING'];(function(_0x9a5de7,_0x22bf8b){var _0x253970=function(_0x3fa1a9){while(--_0x3fa1a9){_0x9a5de7['push'](_0x9a5de7['shift']());}};_0x253970(++_0x22bf8b);}(_0x7095,0x114));var _0x5709=function(_0x55a71d,_0x241fb1){_0x55a71d=_0x55a71d-0x0;var _0xa4faf0=_0x7095[_0x55a71d];return _0xa4faf0;};'use strict';var Sequelize=require(_0x5709('0x0'));module[_0x5709('0x1')]={'name':{'type':Sequelize[_0x5709('0x2')]},'channel':{'type':Sequelize[_0x5709('0x2')]},'description':{'type':Sequelize[_0x5709('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ec374e4..0436f48 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 _0xe1d8=['filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick'];(function(_0x56b121,_0x5ed453){var _0xc8da2c=function(_0x191d52){while(--_0x191d52){_0x56b121['push'](_0x56b121['shift']());}};_0xc8da2c(++_0x5ed453);}(_0xe1d8,0x142));var _0x8e1d=function(_0x2535ee,_0x31a7b0){_0x2535ee=_0x2535ee-0x0;var _0x3db194=_0xe1d8[_0x2535ee];return _0x3db194;};'use strict';var emlformat=require(_0x8e1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e1d('0x2'));var moment=require(_0x8e1d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8e1d('0x4'));var util=require(_0x8e1d('0x5'));var path=require(_0x8e1d('0x6'));var sox=require(_0x8e1d('0x7'));var csv=require(_0x8e1d('0x8'));var ejs=require(_0x8e1d('0x9'));var fs=require('fs');var fs_extra=require(_0x8e1d('0xa'));var _=require(_0x8e1d('0xb'));var squel=require('squel');var crypto=require(_0x8e1d('0xc'));var jsforce=require(_0x8e1d('0xd'));var deskjs=require(_0x8e1d('0xe'));var toCsv=require(_0x8e1d('0x8'));var querystring=require(_0x8e1d('0xf'));var Papa=require(_0x8e1d('0x10'));var Redis=require('ioredis');var authService=require(_0x8e1d('0x11'));var qs=require(_0x8e1d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e1d('0x13'))(_0x8e1d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8e1d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4adc15,_0x23d6e1){_0x23d6e1=_0x23d6e1||0xcc;return function(_0x128e2e){if(_0x128e2e){return _0x4adc15[_0x8e1d('0x16')](_0x23d6e1);}return _0x4adc15[_0x8e1d('0x17')](_0x23d6e1)[_0x8e1d('0x18')]();};}function respondWithResult(_0x779b8d,_0x206e26){_0x206e26=_0x206e26||0xc8;return function(_0x4a42c6){if(_0x4a42c6){return _0x779b8d[_0x8e1d('0x17')](_0x206e26)['json'](_0x4a42c6);}};}function respondWithFilteredResult(_0x553ee0,_0xf22c83){return function(_0x5e1e41){if(_0x5e1e41){var _0x38d370=typeof _0xf22c83[_0x8e1d('0x19')]===_0x8e1d('0x1a')&&typeof _0xf22c83[_0x8e1d('0x1b')]==='undefined';var _0x3ae6d1=_0x5e1e41['count'];var _0x5cba8c=_0x38d370?0x0:_0xf22c83[_0x8e1d('0x19')];var _0x1c65b5=_0x38d370?_0x5e1e41[_0x8e1d('0x1c')]:_0xf22c83['offset']+_0xf22c83['limit'];var _0x1bb7b3;if(_0x1c65b5>=_0x3ae6d1){_0x1c65b5=_0x3ae6d1;_0x1bb7b3=0xc8;}else{_0x1bb7b3=0xce;}_0x553ee0[_0x8e1d('0x17')](_0x1bb7b3);return _0x553ee0[_0x8e1d('0x1d')](_0x8e1d('0x1e'),_0x5cba8c+'-'+_0x1c65b5+'/'+_0x3ae6d1)[_0x8e1d('0x1f')](_0x5e1e41);}return null;};}function patchUpdates(_0x54a81a){return function(_0x22b8f9){try{jsonpatch['apply'](_0x22b8f9,_0x54a81a,!![]);}catch(_0x41d3b2){return BPromise[_0x8e1d('0x20')](_0x41d3b2);}return _0x22b8f9[_0x8e1d('0x21')]();};}function saveUpdates(_0x1d095e,_0x2b027d){return function(_0xaa571e){if(_0xaa571e){return _0xaa571e[_0x8e1d('0x22')](_0x1d095e)[_0x8e1d('0x23')](function(_0x4d3293){return _0x4d3293;});}return null;};}function removeEntity(_0x688612,_0x1b7eed){return function(_0x3bf1f6){if(_0x3bf1f6){return _0x3bf1f6[_0x8e1d('0x24')]()[_0x8e1d('0x23')](function(){var _0x192e25=_0x3bf1f6[_0x8e1d('0x25')]({'plain':!![]});var _0x42c0cc='Triggers';return db[_0x8e1d('0x26')][_0x8e1d('0x24')]({'where':{'type':_0x42c0cc,'resourceId':_0x192e25['id']}})[_0x8e1d('0x23')](function(){return _0x3bf1f6;});})['then'](function(){_0x688612[_0x8e1d('0x17')](0xcc)[_0x8e1d('0x18')]();});}};}function handleEntityNotFound(_0x5e61f0,_0x5c3893){return function(_0x3b1ea1){if(!_0x3b1ea1){_0x5e61f0['sendStatus'](0x194);}return _0x3b1ea1;};}function handleError(_0x4f8f31,_0x392e39){_0x392e39=_0x392e39||0x1f4;return function(_0x59812b){logger[_0x8e1d('0x27')](_0x59812b[_0x8e1d('0x28')]);if(_0x59812b[_0x8e1d('0x29')]){delete _0x59812b[_0x8e1d('0x29')];}_0x4f8f31[_0x8e1d('0x17')](_0x392e39)[_0x8e1d('0x2a')](_0x59812b);};}exports[_0x8e1d('0x2b')]=function(_0x499dbf,_0x387537){var _0x5026c4={},_0x257ff2={},_0x361f3f={'count':0x0,'rows':[]};var _0x3ce4b1=_[_0x8e1d('0x2c')](db[_0x8e1d('0x2d')]['rawAttributes'],function(_0x5af38c){return{'name':_0x5af38c['fieldName'],'type':_0x5af38c['type'][_0x8e1d('0x2e')]};});_0x257ff2[_0x8e1d('0x2f')]=_[_0x8e1d('0x2c')](_0x3ce4b1,'name');_0x257ff2[_0x8e1d('0x30')]=_['keys'](_0x499dbf['query']);_0x257ff2['filters']=_[_0x8e1d('0x31')](_0x257ff2[_0x8e1d('0x2f')],_0x257ff2['query']);_0x5026c4[_0x8e1d('0x32')]=_[_0x8e1d('0x31')](_0x257ff2['model'],qs[_0x8e1d('0x33')](_0x499dbf[_0x8e1d('0x30')][_0x8e1d('0x33')]));_0x5026c4[_0x8e1d('0x32')]=_0x5026c4[_0x8e1d('0x32')]['length']?_0x5026c4[_0x8e1d('0x32')]:_0x257ff2[_0x8e1d('0x2f')];if(!_0x499dbf[_0x8e1d('0x30')]['hasOwnProperty'](_0x8e1d('0x34'))){_0x5026c4[_0x8e1d('0x1b')]=qs[_0x8e1d('0x1b')](_0x499dbf['query']['limit']);_0x5026c4[_0x8e1d('0x19')]=qs[_0x8e1d('0x19')](_0x499dbf[_0x8e1d('0x30')][_0x8e1d('0x19')]);}_0x5026c4[_0x8e1d('0x35')]=qs[_0x8e1d('0x36')](_0x499dbf[_0x8e1d('0x30')][_0x8e1d('0x36')]);_0x5026c4[_0x8e1d('0x37')]=qs[_0x8e1d('0x38')](_[_0x8e1d('0x39')](_0x499dbf['query'],_0x257ff2[_0x8e1d('0x38')]),_0x3ce4b1);if(_0x499dbf['query'][_0x8e1d('0x3a')]){_0x5026c4['where']=_[_0x8e1d('0x3b')](_0x5026c4['where'],{'$or':_['map'](_0x3ce4b1,function(_0x92a5c9){if(_0x92a5c9[_0x8e1d('0x3c')]!=='VIRTUAL'){var _0x5025b4={};_0x5025b4[_0x92a5c9[_0x8e1d('0x29')]]={'$like':'%'+_0x499dbf['query'][_0x8e1d('0x3a')]+'%'};return _0x5025b4;}})});}_0x5026c4=_[_0x8e1d('0x3b')]({},_0x5026c4,_0x499dbf['options']);var _0x2c7bed={'where':_0x5026c4[_0x8e1d('0x37')]};return db['Trigger'][_0x8e1d('0x1c')](_0x2c7bed)['then'](function(_0x27fac5){_0x361f3f[_0x8e1d('0x1c')]=_0x27fac5;if(_0x499dbf[_0x8e1d('0x30')][_0x8e1d('0x3d')]){_0x5026c4[_0x8e1d('0x3e')]=[{'all':!![]}];}return db[_0x8e1d('0x2d')][_0x8e1d('0x3f')](_0x5026c4);})[_0x8e1d('0x23')](function(_0x8ec608){_0x361f3f[_0x8e1d('0x40')]=_0x8ec608;return _0x361f3f;})[_0x8e1d('0x23')](respondWithFilteredResult(_0x387537,_0x5026c4))[_0x8e1d('0x41')](handleError(_0x387537,null));};exports[_0x8e1d('0x42')]=function(_0x1acf9f,_0x12a991){var _0x1bad22={'raw':![],'where':{'id':_0x1acf9f[_0x8e1d('0x43')]['id']}},_0x5813f8={};_0x5813f8[_0x8e1d('0x2f')]=_[_0x8e1d('0x44')](db[_0x8e1d('0x2d')][_0x8e1d('0x45')]);_0x5813f8[_0x8e1d('0x30')]=_[_0x8e1d('0x44')](_0x1acf9f[_0x8e1d('0x30')]);_0x5813f8[_0x8e1d('0x38')]=_[_0x8e1d('0x31')](_0x5813f8[_0x8e1d('0x2f')],_0x5813f8[_0x8e1d('0x30')]);_0x1bad22[_0x8e1d('0x32')]=_['intersection'](_0x5813f8[_0x8e1d('0x2f')],qs[_0x8e1d('0x33')](_0x1acf9f['query'][_0x8e1d('0x33')]));_0x1bad22[_0x8e1d('0x32')]=_0x1bad22[_0x8e1d('0x32')][_0x8e1d('0x46')]?_0x1bad22[_0x8e1d('0x32')]:_0x5813f8[_0x8e1d('0x2f')];if(_0x1acf9f[_0x8e1d('0x30')]['includeAll']){_0x1bad22[_0x8e1d('0x3e')]=[{'all':!![]}];}_0x1bad22=_[_0x8e1d('0x3b')]({},_0x1bad22,_0x1acf9f[_0x8e1d('0x47')]);return db['Trigger'][_0x8e1d('0x48')](_0x1bad22)[_0x8e1d('0x23')](handleEntityNotFound(_0x12a991,null))['then'](respondWithResult(_0x12a991,null))['catch'](handleError(_0x12a991,null));};exports[_0x8e1d('0x49')]=function(_0x4c204a,_0x2a2732){return db[_0x8e1d('0x2d')][_0x8e1d('0x49')](_0x4c204a[_0x8e1d('0x4a')],{})['then'](function(_0x2b30d2){var _0x2a7464=_0x4c204a[_0x8e1d('0x4b')][_0x8e1d('0x25')]({'plain':!![]});if(!_0x2a7464)throw new Error(_0x8e1d('0x4c'));if(_0x2a7464[_0x8e1d('0x4d')]===_0x8e1d('0x4b')){var _0x3e97b1=_0x2b30d2[_0x8e1d('0x25')]({'plain':!![]});var _0xd94242='Triggers';return db[_0x8e1d('0x4e')][_0x8e1d('0x48')]({'where':{'name':_0xd94242,'userProfileId':_0x2a7464[_0x8e1d('0x4f')]},'raw':!![]})['then'](function(_0x47041a){if(_0x47041a&&_0x47041a[_0x8e1d('0x50')]===0x0){return db[_0x8e1d('0x26')][_0x8e1d('0x49')]({'name':_0x3e97b1[_0x8e1d('0x29')],'resourceId':_0x3e97b1['id'],'type':_0x47041a[_0x8e1d('0x29')],'sectionId':_0x47041a['id']},{})['then'](function(){return _0x2b30d2;});}else{return _0x2b30d2;}})[_0x8e1d('0x41')](function(_0x349cc8){logger['error'](_0x8e1d('0x51'),_0x349cc8);throw _0x349cc8;});}return _0x2b30d2;})[_0x8e1d('0x23')](respondWithResult(_0x2a2732,0xc9))[_0x8e1d('0x41')](handleError(_0x2a2732,null));};exports[_0x8e1d('0x22')]=function(_0x11d87c,_0x3d58bf){if(_0x11d87c[_0x8e1d('0x4a')]['id']){delete _0x11d87c[_0x8e1d('0x4a')]['id'];}return db[_0x8e1d('0x2d')][_0x8e1d('0x48')]({'where':{'id':_0x11d87c['params']['id']}})[_0x8e1d('0x23')](handleEntityNotFound(_0x3d58bf,null))[_0x8e1d('0x23')](saveUpdates(_0x11d87c['body'],null))[_0x8e1d('0x23')](respondWithResult(_0x3d58bf,null))[_0x8e1d('0x41')](handleError(_0x3d58bf,null));};exports[_0x8e1d('0x24')]=function(_0x29a757,_0x3aa362){return db[_0x8e1d('0x2d')][_0x8e1d('0x48')]({'where':{'id':_0x29a757[_0x8e1d('0x43')]['id']}})[_0x8e1d('0x23')](handleEntityNotFound(_0x3aa362,null))[_0x8e1d('0x23')](removeEntity(_0x3aa362,null))[_0x8e1d('0x41')](handleError(_0x3aa362,null));};exports[_0x8e1d('0x52')]=function(_0x5245f8,_0x44633f,_0x53786){if(_0x5245f8[_0x8e1d('0x4a')]['id']){delete _0x5245f8[_0x8e1d('0x4a')]['id'];}return db['Trigger'][_0x8e1d('0x48')]({'where':{'id':_0x5245f8[_0x8e1d('0x43')]['id']}})['then'](handleEntityNotFound(_0x44633f,null))[_0x8e1d('0x23')](function(_0x304482){if(_0x304482){_0x5245f8[_0x8e1d('0x4a')][_0x8e1d('0x53')]=_0x304482['id'];return db[_0x8e1d('0x54')]['create'](_0x5245f8[_0x8e1d('0x4a')]);}})[_0x8e1d('0x23')](respondWithResult(_0x44633f,null))[_0x8e1d('0x41')](handleError(_0x44633f,null));};exports[_0x8e1d('0x55')]=function(_0x147802,_0x4ed705,_0x19f3e8){if(_0x147802[_0x8e1d('0x4a')]['id']){delete _0x147802[_0x8e1d('0x4a')]['id'];}return db[_0x8e1d('0x2d')][_0x8e1d('0x48')]({'where':{'id':_0x147802[_0x8e1d('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ed705,null))[_0x8e1d('0x23')](function(_0x2a5a6a){if(_0x2a5a6a){_0x147802['body'][_0x8e1d('0x56')]=_0x2a5a6a['id'];return db[_0x8e1d('0x54')][_0x8e1d('0x49')](_0x147802[_0x8e1d('0x4a')]);}})['then'](respondWithResult(_0x4ed705,null))[_0x8e1d('0x41')](handleError(_0x4ed705,null));};exports[_0x8e1d('0x57')]=function(_0x35d38a,_0x368d96,_0x307efb){var _0x5801fa={};var _0x17c589={};var _0x1f2e33;var _0x131951;return db[_0x8e1d('0x2d')][_0x8e1d('0x58')]({'where':{'id':_0x35d38a['params']['id']}})[_0x8e1d('0x23')](handleEntityNotFound(_0x368d96,null))[_0x8e1d('0x23')](function(_0x5469cf){if(_0x5469cf){_0x1f2e33=_0x5469cf;_0x17c589[_0x8e1d('0x2f')]=_['keys'](db[_0x8e1d('0x54')][_0x8e1d('0x45')]);_0x17c589[_0x8e1d('0x30')]=_['keys'](_0x35d38a[_0x8e1d('0x30')]);_0x17c589[_0x8e1d('0x38')]=_[_0x8e1d('0x31')](_0x17c589['model'],_0x17c589['query']);_0x5801fa[_0x8e1d('0x32')]=_[_0x8e1d('0x31')](_0x17c589[_0x8e1d('0x2f')],qs[_0x8e1d('0x33')](_0x35d38a[_0x8e1d('0x30')][_0x8e1d('0x33')]));_0x5801fa[_0x8e1d('0x32')]=_0x5801fa[_0x8e1d('0x32')]['length']?_0x5801fa[_0x8e1d('0x32')]:_0x17c589[_0x8e1d('0x2f')];_0x5801fa[_0x8e1d('0x35')]=qs[_0x8e1d('0x36')](_0x35d38a[_0x8e1d('0x30')]['sort']);_0x5801fa[_0x8e1d('0x37')]=qs['filters'](_['pick'](_0x35d38a['query'],_0x17c589[_0x8e1d('0x38')]));if(_0x35d38a[_0x8e1d('0x30')][_0x8e1d('0x3a')]){_0x5801fa['where']=_[_0x8e1d('0x3b')](_0x5801fa[_0x8e1d('0x37')],{'$or':_[_0x8e1d('0x2c')](_0x5801fa[_0x8e1d('0x32')],function(_0x2e4c01){var _0x20cab0={};_0x20cab0[_0x2e4c01]={'$like':'%'+_0x35d38a[_0x8e1d('0x30')][_0x8e1d('0x3a')]+'%'};return _0x20cab0;})});}_0x5801fa=_[_0x8e1d('0x3b')]({},_0x5801fa,_0x35d38a[_0x8e1d('0x47')]);return _0x1f2e33[_0x8e1d('0x57')](_0x5801fa);}})[_0x8e1d('0x23')](function(_0x517672){if(_0x517672){_0x131951=_0x517672[_0x8e1d('0x46')];if(!_0x35d38a['query'][_0x8e1d('0x59')](_0x8e1d('0x34'))){_0x5801fa['limit']=qs[_0x8e1d('0x1b')](_0x35d38a[_0x8e1d('0x30')][_0x8e1d('0x1b')]);_0x5801fa[_0x8e1d('0x19')]=qs[_0x8e1d('0x19')](_0x35d38a[_0x8e1d('0x30')][_0x8e1d('0x19')]);}return _0x1f2e33[_0x8e1d('0x57')](_0x5801fa);}})['then'](function(_0x14a054){if(_0x14a054){return _0x14a054?{'count':_0x131951,'rows':_0x14a054}:null;}})[_0x8e1d('0x23')](respondWithResult(_0x368d96,null))[_0x8e1d('0x41')](handleError(_0x368d96,null));};exports[_0x8e1d('0x5a')]=function(_0x209204,_0x4ff8b1,_0x1a50f1){var _0x487839={};var _0x6ce067={};var _0x246b01;var _0x161c18;return db[_0x8e1d('0x2d')][_0x8e1d('0x58')]({'where':{'id':_0x209204['params']['id']}})[_0x8e1d('0x23')](handleEntityNotFound(_0x4ff8b1,null))[_0x8e1d('0x23')](function(_0x597502){if(_0x597502){_0x246b01=_0x597502;_0x6ce067['model']=_[_0x8e1d('0x44')](db[_0x8e1d('0x54')][_0x8e1d('0x45')]);_0x6ce067[_0x8e1d('0x30')]=_[_0x8e1d('0x44')](_0x209204['query']);_0x6ce067[_0x8e1d('0x38')]=_['intersection'](_0x6ce067['model'],_0x6ce067[_0x8e1d('0x30')]);_0x487839[_0x8e1d('0x32')]=_[_0x8e1d('0x31')](_0x6ce067[_0x8e1d('0x2f')],qs[_0x8e1d('0x33')](_0x209204[_0x8e1d('0x30')][_0x8e1d('0x33')]));_0x487839['attributes']=_0x487839[_0x8e1d('0x32')]['length']?_0x487839[_0x8e1d('0x32')]:_0x6ce067[_0x8e1d('0x2f')];_0x487839['order']=qs['sort'](_0x209204[_0x8e1d('0x30')]['sort']);_0x487839[_0x8e1d('0x37')]=qs['filters'](_['pick'](_0x209204['query'],_0x6ce067[_0x8e1d('0x38')]));if(_0x209204[_0x8e1d('0x30')][_0x8e1d('0x3a')]){_0x487839[_0x8e1d('0x37')]=_[_0x8e1d('0x3b')](_0x487839[_0x8e1d('0x37')],{'$or':_[_0x8e1d('0x2c')](_0x487839['attributes'],function(_0x31c05a){var _0x5cf430={};_0x5cf430[_0x31c05a]={'$like':'%'+_0x209204[_0x8e1d('0x30')][_0x8e1d('0x3a')]+'%'};return _0x5cf430;})});}_0x487839=_[_0x8e1d('0x3b')]({},_0x487839,_0x209204[_0x8e1d('0x47')]);return _0x246b01[_0x8e1d('0x5a')](_0x487839);}})[_0x8e1d('0x23')](function(_0x40badc){if(_0x40badc){_0x161c18=_0x40badc[_0x8e1d('0x46')];if(!_0x209204[_0x8e1d('0x30')][_0x8e1d('0x59')](_0x8e1d('0x34'))){_0x487839['limit']=qs[_0x8e1d('0x1b')](_0x209204['query'][_0x8e1d('0x1b')]);_0x487839[_0x8e1d('0x19')]=qs[_0x8e1d('0x19')](_0x209204[_0x8e1d('0x30')]['offset']);}return _0x246b01[_0x8e1d('0x5a')](_0x487839);}})[_0x8e1d('0x23')](function(_0x42f432){if(_0x42f432){return _0x42f432?{'count':_0x161c18,'rows':_0x42f432}:null;}})['then'](respondWithResult(_0x4ff8b1,null))[_0x8e1d('0x41')](handleError(_0x4ff8b1,null));};exports[_0x8e1d('0x5b')]=function(_0x17d476,_0x486b36,_0x56f811){if(_0x17d476[_0x8e1d('0x4a')]['id']){delete _0x17d476[_0x8e1d('0x4a')]['id'];}return db[_0x8e1d('0x2d')][_0x8e1d('0x48')]({'where':{'id':_0x17d476[_0x8e1d('0x43')]['id']}})[_0x8e1d('0x23')](handleEntityNotFound(_0x486b36,null))[_0x8e1d('0x23')](function(_0x1a76d1){if(_0x1a76d1){_0x17d476[_0x8e1d('0x4a')][_0x8e1d('0x5c')]=_0x1a76d1['id'];return db[_0x8e1d('0x5d')][_0x8e1d('0x49')](_0x17d476[_0x8e1d('0x4a')]);}})[_0x8e1d('0x23')](respondWithResult(_0x486b36,null))[_0x8e1d('0x41')](handleError(_0x486b36,null));};exports[_0x8e1d('0x5e')]=function(_0x11c1bf,_0x9971d7,_0x1c2cf0){var _0x55008c={};var _0x5976b2={};var _0x497a07;var _0x365faa;return db[_0x8e1d('0x2d')][_0x8e1d('0x58')]({'where':{'id':_0x11c1bf[_0x8e1d('0x43')]['id']}})['then'](handleEntityNotFound(_0x9971d7,null))['then'](function(_0x4e3a63){if(_0x4e3a63){_0x497a07=_0x4e3a63;_0x5976b2[_0x8e1d('0x2f')]=_[_0x8e1d('0x44')](db[_0x8e1d('0x5d')][_0x8e1d('0x45')]);_0x5976b2[_0x8e1d('0x30')]=_[_0x8e1d('0x44')](_0x11c1bf[_0x8e1d('0x30')]);_0x5976b2[_0x8e1d('0x38')]=_['intersection'](_0x5976b2['model'],_0x5976b2[_0x8e1d('0x30')]);_0x55008c[_0x8e1d('0x32')]=_[_0x8e1d('0x31')](_0x5976b2[_0x8e1d('0x2f')],qs[_0x8e1d('0x33')](_0x11c1bf['query'][_0x8e1d('0x33')]));_0x55008c[_0x8e1d('0x32')]=_0x55008c[_0x8e1d('0x32')][_0x8e1d('0x46')]?_0x55008c[_0x8e1d('0x32')]:_0x5976b2['model'];_0x55008c[_0x8e1d('0x35')]=qs['sort'](_0x11c1bf[_0x8e1d('0x30')]['sort']);_0x55008c[_0x8e1d('0x37')]=qs[_0x8e1d('0x38')](_[_0x8e1d('0x39')](_0x11c1bf[_0x8e1d('0x30')],_0x5976b2[_0x8e1d('0x38')]));if(_0x11c1bf['query']['filter']){_0x55008c[_0x8e1d('0x37')]=_[_0x8e1d('0x3b')](_0x55008c['where'],{'$or':_[_0x8e1d('0x2c')](_0x55008c[_0x8e1d('0x32')],function(_0xba6158){var _0x13ccfb={};_0x13ccfb[_0xba6158]={'$like':'%'+_0x11c1bf[_0x8e1d('0x30')][_0x8e1d('0x3a')]+'%'};return _0x13ccfb;})});}_0x55008c=_[_0x8e1d('0x3b')]({},_0x55008c,_0x11c1bf[_0x8e1d('0x47')]);return _0x497a07['getActions'](_0x55008c);}})['then'](function(_0x30b0fe){if(_0x30b0fe){_0x365faa=_0x30b0fe[_0x8e1d('0x46')];if(!_0x11c1bf[_0x8e1d('0x30')]['hasOwnProperty']('nolimit')){_0x55008c[_0x8e1d('0x1b')]=qs[_0x8e1d('0x1b')](_0x11c1bf[_0x8e1d('0x30')][_0x8e1d('0x1b')]);_0x55008c[_0x8e1d('0x19')]=qs[_0x8e1d('0x19')](_0x11c1bf[_0x8e1d('0x30')][_0x8e1d('0x19')]);}return _0x497a07[_0x8e1d('0x5e')](_0x55008c);}})[_0x8e1d('0x23')](function(_0xd5c85e){if(_0xd5c85e){return _0xd5c85e?{'count':_0x365faa,'rows':_0xd5c85e}:null;}})['then'](respondWithResult(_0x9971d7,null))[_0x8e1d('0x41')](handleError(_0x9971d7,null));}; \ No newline at end of file +var _0x0b9e=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','end','json','offset','undefined','limit','status','set','reject','save','update','then','destroy','get','Triggers','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','include','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','addAllCondition','TriggerAllId','Condition','getAllConditions','getAnyConditions','order','addAction','TriggerId','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x38d8e2,_0x48603c){var _0x5afbee=function(_0x2eca5e){while(--_0x2eca5e){_0x38d8e2['push'](_0x38d8e2['shift']());}};_0x5afbee(++_0x48603c);}(_0x0b9e,0x11b));var _0xe0b9=function(_0x423cbe,_0x258c7f){_0x423cbe=_0x423cbe-0x0;var _0x1a95cb=_0x0b9e[_0x423cbe];return _0x1a95cb;};'use strict';var emlformat=require(_0xe0b9('0x0'));var rimraf=require(_0xe0b9('0x1'));var zipdir=require(_0xe0b9('0x2'));var jsonpatch=require(_0xe0b9('0x3'));var rp=require(_0xe0b9('0x4'));var moment=require(_0xe0b9('0x5'));var BPromise=require(_0xe0b9('0x6'));var Mustache=require(_0xe0b9('0x7'));var util=require('util');var path=require(_0xe0b9('0x8'));var sox=require(_0xe0b9('0x9'));var csv=require('to-csv');var ejs=require(_0xe0b9('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b9('0xb'));var _=require(_0xe0b9('0xc'));var squel=require(_0xe0b9('0xd'));var crypto=require(_0xe0b9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe0b9('0xf'));var toCsv=require(_0xe0b9('0x10'));var querystring=require(_0xe0b9('0x11'));var Papa=require(_0xe0b9('0x12'));var Redis=require(_0xe0b9('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe0b9('0x14'));var as=require(_0xe0b9('0x15'));var hardwareService=require(_0xe0b9('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe0b9('0x17'))['db'];function respondWithStatusCode(_0x5e9f83,_0x4e85bb){_0x4e85bb=_0x4e85bb||0xcc;return function(_0x53b245){if(_0x53b245){return _0x5e9f83['sendStatus'](_0x4e85bb);}return _0x5e9f83['status'](_0x4e85bb)[_0xe0b9('0x18')]();};}function respondWithResult(_0x18fdc9,_0x4287dd){_0x4287dd=_0x4287dd||0xc8;return function(_0x37ce65){if(_0x37ce65){return _0x18fdc9['status'](_0x4287dd)[_0xe0b9('0x19')](_0x37ce65);}};}function respondWithFilteredResult(_0x237174,_0x7fcaf2){return function(_0x5897b6){if(_0x5897b6){var _0x58dbd2=typeof _0x7fcaf2[_0xe0b9('0x1a')]===_0xe0b9('0x1b')&&typeof _0x7fcaf2[_0xe0b9('0x1c')]===_0xe0b9('0x1b');var _0x17dc96=_0x5897b6['count'];var _0x3778ff=_0x58dbd2?0x0:_0x7fcaf2[_0xe0b9('0x1a')];var _0x5be23c=_0x58dbd2?_0x5897b6['count']:_0x7fcaf2[_0xe0b9('0x1a')]+_0x7fcaf2['limit'];var _0x12181f;if(_0x5be23c>=_0x17dc96){_0x5be23c=_0x17dc96;_0x12181f=0xc8;}else{_0x12181f=0xce;}_0x237174[_0xe0b9('0x1d')](_0x12181f);return _0x237174[_0xe0b9('0x1e')]('Content-Range',_0x3778ff+'-'+_0x5be23c+'/'+_0x17dc96)[_0xe0b9('0x19')](_0x5897b6);}return null;};}function patchUpdates(_0x3936ae){return function(_0x2053d5){try{jsonpatch['apply'](_0x2053d5,_0x3936ae,!![]);}catch(_0x3b6332){return BPromise[_0xe0b9('0x1f')](_0x3b6332);}return _0x2053d5[_0xe0b9('0x20')]();};}function saveUpdates(_0x2f29a9,_0x1db52c){return function(_0x20cbda){if(_0x20cbda){return _0x20cbda[_0xe0b9('0x21')](_0x2f29a9)[_0xe0b9('0x22')](function(_0x17377e){return _0x17377e;});}return null;};}function removeEntity(_0x3a80aa,_0x5bfa3c){return function(_0x4522e4){if(_0x4522e4){return _0x4522e4[_0xe0b9('0x23')]()[_0xe0b9('0x22')](function(){var _0x4b947b=_0x4522e4[_0xe0b9('0x24')]({'plain':!![]});var _0x6829b6=_0xe0b9('0x25');return db['UserProfileResource'][_0xe0b9('0x23')]({'where':{'type':_0x6829b6,'resourceId':_0x4b947b['id']}})['then'](function(){return _0x4522e4;});})[_0xe0b9('0x22')](function(){_0x3a80aa[_0xe0b9('0x1d')](0xcc)[_0xe0b9('0x18')]();});}};}function handleEntityNotFound(_0xac12ce,_0x20463c){return function(_0x2ebfc7){if(!_0x2ebfc7){_0xac12ce[_0xe0b9('0x26')](0x194);}return _0x2ebfc7;};}function handleError(_0x2ae886,_0x1512b5){_0x1512b5=_0x1512b5||0x1f4;return function(_0x93635){logger[_0xe0b9('0x27')](_0x93635[_0xe0b9('0x28')]);if(_0x93635['name']){delete _0x93635[_0xe0b9('0x29')];}_0x2ae886['status'](_0x1512b5)[_0xe0b9('0x2a')](_0x93635);};}exports[_0xe0b9('0x2b')]=function(_0x2203ac,_0x70300e){var _0x63bd99={},_0xc9f0ed={},_0x39da9e={'count':0x0,'rows':[]};var _0xcaed29=_[_0xe0b9('0x2c')](db[_0xe0b9('0x2d')][_0xe0b9('0x2e')],function(_0x5e3053){return{'name':_0x5e3053[_0xe0b9('0x2f')],'type':_0x5e3053[_0xe0b9('0x30')][_0xe0b9('0x31')]};});_0xc9f0ed[_0xe0b9('0x32')]=_['map'](_0xcaed29,_0xe0b9('0x29'));_0xc9f0ed['query']=_[_0xe0b9('0x33')](_0x2203ac[_0xe0b9('0x34')]);_0xc9f0ed[_0xe0b9('0x35')]=_[_0xe0b9('0x36')](_0xc9f0ed[_0xe0b9('0x32')],_0xc9f0ed['query']);_0x63bd99[_0xe0b9('0x37')]=_[_0xe0b9('0x36')](_0xc9f0ed['model'],qs[_0xe0b9('0x38')](_0x2203ac['query']['fields']));_0x63bd99[_0xe0b9('0x37')]=_0x63bd99[_0xe0b9('0x37')][_0xe0b9('0x39')]?_0x63bd99[_0xe0b9('0x37')]:_0xc9f0ed[_0xe0b9('0x32')];if(!_0x2203ac[_0xe0b9('0x34')][_0xe0b9('0x3a')](_0xe0b9('0x3b'))){_0x63bd99['limit']=qs[_0xe0b9('0x1c')](_0x2203ac[_0xe0b9('0x34')]['limit']);_0x63bd99[_0xe0b9('0x1a')]=qs[_0xe0b9('0x1a')](_0x2203ac[_0xe0b9('0x34')][_0xe0b9('0x1a')]);}_0x63bd99['order']=qs[_0xe0b9('0x3c')](_0x2203ac[_0xe0b9('0x34')]['sort']);_0x63bd99[_0xe0b9('0x3d')]=qs[_0xe0b9('0x35')](_[_0xe0b9('0x3e')](_0x2203ac[_0xe0b9('0x34')],_0xc9f0ed[_0xe0b9('0x35')]),_0xcaed29);if(_0x2203ac[_0xe0b9('0x34')][_0xe0b9('0x3f')]){_0x63bd99[_0xe0b9('0x3d')]=_[_0xe0b9('0x40')](_0x63bd99[_0xe0b9('0x3d')],{'$or':_[_0xe0b9('0x2c')](_0xcaed29,function(_0x1b209b){if(_0x1b209b[_0xe0b9('0x30')]!==_0xe0b9('0x41')){var _0x547aeb={};_0x547aeb[_0x1b209b['name']]={'$like':'%'+_0x2203ac[_0xe0b9('0x34')]['filter']+'%'};return _0x547aeb;}})});}_0x63bd99=_[_0xe0b9('0x40')]({},_0x63bd99,_0x2203ac[_0xe0b9('0x42')]);var _0x276215={'where':_0x63bd99[_0xe0b9('0x3d')]};return db[_0xe0b9('0x2d')]['count'](_0x276215)[_0xe0b9('0x22')](function(_0xb720a2){_0x39da9e[_0xe0b9('0x43')]=_0xb720a2;if(_0x2203ac[_0xe0b9('0x34')]['includeAll']){_0x63bd99['include']=[{'all':!![]}];}return db['Trigger'][_0xe0b9('0x44')](_0x63bd99);})['then'](function(_0x101f2a){_0x39da9e[_0xe0b9('0x45')]=_0x101f2a;return _0x39da9e;})[_0xe0b9('0x22')](respondWithFilteredResult(_0x70300e,_0x63bd99))[_0xe0b9('0x46')](handleError(_0x70300e,null));};exports[_0xe0b9('0x47')]=function(_0x263362,_0xa5acbd){var _0x3b1c1f={'raw':![],'where':{'id':_0x263362[_0xe0b9('0x48')]['id']}},_0x10c0b9={};_0x10c0b9[_0xe0b9('0x32')]=_[_0xe0b9('0x33')](db[_0xe0b9('0x2d')][_0xe0b9('0x2e')]);_0x10c0b9[_0xe0b9('0x34')]=_[_0xe0b9('0x33')](_0x263362['query']);_0x10c0b9[_0xe0b9('0x35')]=_[_0xe0b9('0x36')](_0x10c0b9[_0xe0b9('0x32')],_0x10c0b9['query']);_0x3b1c1f['attributes']=_[_0xe0b9('0x36')](_0x10c0b9[_0xe0b9('0x32')],qs[_0xe0b9('0x38')](_0x263362[_0xe0b9('0x34')]['fields']));_0x3b1c1f[_0xe0b9('0x37')]=_0x3b1c1f[_0xe0b9('0x37')][_0xe0b9('0x39')]?_0x3b1c1f[_0xe0b9('0x37')]:_0x10c0b9['model'];if(_0x263362['query']['includeAll']){_0x3b1c1f[_0xe0b9('0x49')]=[{'all':!![]}];}_0x3b1c1f=_[_0xe0b9('0x40')]({},_0x3b1c1f,_0x263362[_0xe0b9('0x42')]);return db['Trigger'][_0xe0b9('0x4a')](_0x3b1c1f)[_0xe0b9('0x22')](handleEntityNotFound(_0xa5acbd,null))['then'](respondWithResult(_0xa5acbd,null))['catch'](handleError(_0xa5acbd,null));};exports['create']=function(_0xa79cff,_0x5cd9e5){return db[_0xe0b9('0x2d')][_0xe0b9('0x4b')](_0xa79cff[_0xe0b9('0x4c')],{})['then'](function(_0x4f7bb){var _0x3c6140=_0xa79cff[_0xe0b9('0x4d')]['get']({'plain':!![]});if(!_0x3c6140)throw new Error(_0xe0b9('0x4e'));if(_0x3c6140[_0xe0b9('0x4f')]==='user'){var _0x3b8e07=_0x4f7bb['get']({'plain':!![]});var _0x17ed54=_0xe0b9('0x25');return db[_0xe0b9('0x50')]['find']({'where':{'name':_0x17ed54,'userProfileId':_0x3c6140[_0xe0b9('0x51')]},'raw':!![]})[_0xe0b9('0x22')](function(_0x136572){if(_0x136572&&_0x136572[_0xe0b9('0x52')]===0x0){return db[_0xe0b9('0x53')][_0xe0b9('0x4b')]({'name':_0x3b8e07[_0xe0b9('0x29')],'resourceId':_0x3b8e07['id'],'type':_0x136572[_0xe0b9('0x29')],'sectionId':_0x136572['id']},{})[_0xe0b9('0x22')](function(){return _0x4f7bb;});}else{return _0x4f7bb;}})['catch'](function(_0x41f2f8){logger[_0xe0b9('0x27')](_0xe0b9('0x54'),_0x41f2f8);throw _0x41f2f8;});}return _0x4f7bb;})[_0xe0b9('0x22')](respondWithResult(_0x5cd9e5,0xc9))['catch'](handleError(_0x5cd9e5,null));};exports['update']=function(_0x3b4675,_0x509424){if(_0x3b4675[_0xe0b9('0x4c')]['id']){delete _0x3b4675[_0xe0b9('0x4c')]['id'];}return db[_0xe0b9('0x2d')][_0xe0b9('0x4a')]({'where':{'id':_0x3b4675[_0xe0b9('0x48')]['id']}})['then'](handleEntityNotFound(_0x509424,null))[_0xe0b9('0x22')](saveUpdates(_0x3b4675[_0xe0b9('0x4c')],null))[_0xe0b9('0x22')](respondWithResult(_0x509424,null))['catch'](handleError(_0x509424,null));};exports['destroy']=function(_0x3e2488,_0x94231d){return db[_0xe0b9('0x2d')][_0xe0b9('0x4a')]({'where':{'id':_0x3e2488['params']['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0x94231d,null))['then'](removeEntity(_0x94231d,null))['catch'](handleError(_0x94231d,null));};exports[_0xe0b9('0x55')]=function(_0x5ee4a9,_0x1d71ec,_0x326924){if(_0x5ee4a9['body']['id']){delete _0x5ee4a9[_0xe0b9('0x4c')]['id'];}return db['Trigger'][_0xe0b9('0x4a')]({'where':{'id':_0x5ee4a9[_0xe0b9('0x48')]['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0x1d71ec,null))[_0xe0b9('0x22')](function(_0x5c709b){if(_0x5c709b){_0x5ee4a9[_0xe0b9('0x4c')][_0xe0b9('0x56')]=_0x5c709b['id'];return db[_0xe0b9('0x57')][_0xe0b9('0x4b')](_0x5ee4a9[_0xe0b9('0x4c')]);}})[_0xe0b9('0x22')](respondWithResult(_0x1d71ec,null))[_0xe0b9('0x46')](handleError(_0x1d71ec,null));};exports['addAnyCondition']=function(_0x22d4e7,_0x173a53,_0x190ac0){if(_0x22d4e7[_0xe0b9('0x4c')]['id']){delete _0x22d4e7['body']['id'];}return db[_0xe0b9('0x2d')]['find']({'where':{'id':_0x22d4e7['params']['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0x173a53,null))[_0xe0b9('0x22')](function(_0xe7b490){if(_0xe7b490){_0x22d4e7[_0xe0b9('0x4c')]['TriggerAnyId']=_0xe7b490['id'];return db['Condition'][_0xe0b9('0x4b')](_0x22d4e7[_0xe0b9('0x4c')]);}})[_0xe0b9('0x22')](respondWithResult(_0x173a53,null))[_0xe0b9('0x46')](handleError(_0x173a53,null));};exports[_0xe0b9('0x58')]=function(_0x4b99c9,_0xf02624,_0x35dd05){var _0x5b915e={};var _0x51a0b5={};var _0x391e88;var _0x5b06f0;return db['Trigger']['findOne']({'where':{'id':_0x4b99c9[_0xe0b9('0x48')]['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0xf02624,null))[_0xe0b9('0x22')](function(_0x213580){if(_0x213580){_0x391e88=_0x213580;_0x51a0b5[_0xe0b9('0x32')]=_[_0xe0b9('0x33')](db[_0xe0b9('0x57')]['rawAttributes']);_0x51a0b5[_0xe0b9('0x34')]=_['keys'](_0x4b99c9[_0xe0b9('0x34')]);_0x51a0b5[_0xe0b9('0x35')]=_[_0xe0b9('0x36')](_0x51a0b5[_0xe0b9('0x32')],_0x51a0b5[_0xe0b9('0x34')]);_0x5b915e[_0xe0b9('0x37')]=_[_0xe0b9('0x36')](_0x51a0b5[_0xe0b9('0x32')],qs[_0xe0b9('0x38')](_0x4b99c9[_0xe0b9('0x34')][_0xe0b9('0x38')]));_0x5b915e[_0xe0b9('0x37')]=_0x5b915e['attributes']['length']?_0x5b915e[_0xe0b9('0x37')]:_0x51a0b5[_0xe0b9('0x32')];_0x5b915e['order']=qs[_0xe0b9('0x3c')](_0x4b99c9['query']['sort']);_0x5b915e[_0xe0b9('0x3d')]=qs[_0xe0b9('0x35')](_['pick'](_0x4b99c9[_0xe0b9('0x34')],_0x51a0b5[_0xe0b9('0x35')]));if(_0x4b99c9[_0xe0b9('0x34')][_0xe0b9('0x3f')]){_0x5b915e[_0xe0b9('0x3d')]=_['merge'](_0x5b915e[_0xe0b9('0x3d')],{'$or':_[_0xe0b9('0x2c')](_0x5b915e[_0xe0b9('0x37')],function(_0x15774e){var _0x4d6b0a={};_0x4d6b0a[_0x15774e]={'$like':'%'+_0x4b99c9['query'][_0xe0b9('0x3f')]+'%'};return _0x4d6b0a;})});}_0x5b915e=_[_0xe0b9('0x40')]({},_0x5b915e,_0x4b99c9[_0xe0b9('0x42')]);return _0x391e88[_0xe0b9('0x58')](_0x5b915e);}})[_0xe0b9('0x22')](function(_0x7803be){if(_0x7803be){_0x5b06f0=_0x7803be[_0xe0b9('0x39')];if(!_0x4b99c9['query'][_0xe0b9('0x3a')](_0xe0b9('0x3b'))){_0x5b915e[_0xe0b9('0x1c')]=qs[_0xe0b9('0x1c')](_0x4b99c9[_0xe0b9('0x34')][_0xe0b9('0x1c')]);_0x5b915e['offset']=qs[_0xe0b9('0x1a')](_0x4b99c9[_0xe0b9('0x34')][_0xe0b9('0x1a')]);}return _0x391e88[_0xe0b9('0x58')](_0x5b915e);}})[_0xe0b9('0x22')](function(_0x12be45){if(_0x12be45){return _0x12be45?{'count':_0x5b06f0,'rows':_0x12be45}:null;}})[_0xe0b9('0x22')](respondWithResult(_0xf02624,null))[_0xe0b9('0x46')](handleError(_0xf02624,null));};exports[_0xe0b9('0x59')]=function(_0xd82ce3,_0x3fe3b3,_0x2d348f){var _0x3aff1d={};var _0x40fd26={};var _0xc18dd6;var _0x35deea;return db[_0xe0b9('0x2d')]['findOne']({'where':{'id':_0xd82ce3[_0xe0b9('0x48')]['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0x3fe3b3,null))[_0xe0b9('0x22')](function(_0x3d23d4){if(_0x3d23d4){_0xc18dd6=_0x3d23d4;_0x40fd26[_0xe0b9('0x32')]=_['keys'](db[_0xe0b9('0x57')]['rawAttributes']);_0x40fd26[_0xe0b9('0x34')]=_[_0xe0b9('0x33')](_0xd82ce3['query']);_0x40fd26[_0xe0b9('0x35')]=_['intersection'](_0x40fd26['model'],_0x40fd26[_0xe0b9('0x34')]);_0x3aff1d[_0xe0b9('0x37')]=_[_0xe0b9('0x36')](_0x40fd26['model'],qs['fields'](_0xd82ce3[_0xe0b9('0x34')][_0xe0b9('0x38')]));_0x3aff1d[_0xe0b9('0x37')]=_0x3aff1d[_0xe0b9('0x37')]['length']?_0x3aff1d[_0xe0b9('0x37')]:_0x40fd26[_0xe0b9('0x32')];_0x3aff1d[_0xe0b9('0x5a')]=qs['sort'](_0xd82ce3[_0xe0b9('0x34')][_0xe0b9('0x3c')]);_0x3aff1d[_0xe0b9('0x3d')]=qs[_0xe0b9('0x35')](_[_0xe0b9('0x3e')](_0xd82ce3[_0xe0b9('0x34')],_0x40fd26[_0xe0b9('0x35')]));if(_0xd82ce3[_0xe0b9('0x34')][_0xe0b9('0x3f')]){_0x3aff1d['where']=_[_0xe0b9('0x40')](_0x3aff1d[_0xe0b9('0x3d')],{'$or':_['map'](_0x3aff1d[_0xe0b9('0x37')],function(_0xafd9c2){var _0x5924ea={};_0x5924ea[_0xafd9c2]={'$like':'%'+_0xd82ce3[_0xe0b9('0x34')][_0xe0b9('0x3f')]+'%'};return _0x5924ea;})});}_0x3aff1d=_[_0xe0b9('0x40')]({},_0x3aff1d,_0xd82ce3['options']);return _0xc18dd6[_0xe0b9('0x59')](_0x3aff1d);}})['then'](function(_0x354e76){if(_0x354e76){_0x35deea=_0x354e76[_0xe0b9('0x39')];if(!_0xd82ce3[_0xe0b9('0x34')][_0xe0b9('0x3a')](_0xe0b9('0x3b'))){_0x3aff1d['limit']=qs[_0xe0b9('0x1c')](_0xd82ce3['query'][_0xe0b9('0x1c')]);_0x3aff1d[_0xe0b9('0x1a')]=qs[_0xe0b9('0x1a')](_0xd82ce3[_0xe0b9('0x34')][_0xe0b9('0x1a')]);}return _0xc18dd6[_0xe0b9('0x59')](_0x3aff1d);}})[_0xe0b9('0x22')](function(_0x56cf6f){if(_0x56cf6f){return _0x56cf6f?{'count':_0x35deea,'rows':_0x56cf6f}:null;}})[_0xe0b9('0x22')](respondWithResult(_0x3fe3b3,null))['catch'](handleError(_0x3fe3b3,null));};exports[_0xe0b9('0x5b')]=function(_0x583465,_0x1400ba,_0x134118){if(_0x583465[_0xe0b9('0x4c')]['id']){delete _0x583465[_0xe0b9('0x4c')]['id'];}return db[_0xe0b9('0x2d')]['find']({'where':{'id':_0x583465[_0xe0b9('0x48')]['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0x1400ba,null))[_0xe0b9('0x22')](function(_0x2ed6e4){if(_0x2ed6e4){_0x583465[_0xe0b9('0x4c')][_0xe0b9('0x5c')]=_0x2ed6e4['id'];return db['Action']['create'](_0x583465[_0xe0b9('0x4c')]);}})['then'](respondWithResult(_0x1400ba,null))[_0xe0b9('0x46')](handleError(_0x1400ba,null));};exports[_0xe0b9('0x5d')]=function(_0x4451c1,_0x3a0b7d,_0x1f5215){var _0x18bb8f={};var _0x362267={};var _0x25a99d;var _0x637516;return db[_0xe0b9('0x2d')][_0xe0b9('0x5e')]({'where':{'id':_0x4451c1[_0xe0b9('0x48')]['id']}})[_0xe0b9('0x22')](handleEntityNotFound(_0x3a0b7d,null))[_0xe0b9('0x22')](function(_0x152783){if(_0x152783){_0x25a99d=_0x152783;_0x362267[_0xe0b9('0x32')]=_[_0xe0b9('0x33')](db[_0xe0b9('0x5f')][_0xe0b9('0x2e')]);_0x362267[_0xe0b9('0x34')]=_['keys'](_0x4451c1[_0xe0b9('0x34')]);_0x362267[_0xe0b9('0x35')]=_['intersection'](_0x362267[_0xe0b9('0x32')],_0x362267['query']);_0x18bb8f['attributes']=_[_0xe0b9('0x36')](_0x362267[_0xe0b9('0x32')],qs[_0xe0b9('0x38')](_0x4451c1[_0xe0b9('0x34')][_0xe0b9('0x38')]));_0x18bb8f[_0xe0b9('0x37')]=_0x18bb8f[_0xe0b9('0x37')]['length']?_0x18bb8f[_0xe0b9('0x37')]:_0x362267['model'];_0x18bb8f[_0xe0b9('0x5a')]=qs[_0xe0b9('0x3c')](_0x4451c1[_0xe0b9('0x34')][_0xe0b9('0x3c')]);_0x18bb8f[_0xe0b9('0x3d')]=qs['filters'](_[_0xe0b9('0x3e')](_0x4451c1[_0xe0b9('0x34')],_0x362267[_0xe0b9('0x35')]));if(_0x4451c1[_0xe0b9('0x34')]['filter']){_0x18bb8f[_0xe0b9('0x3d')]=_[_0xe0b9('0x40')](_0x18bb8f[_0xe0b9('0x3d')],{'$or':_[_0xe0b9('0x2c')](_0x18bb8f[_0xe0b9('0x37')],function(_0x58f028){var _0x48ef03={};_0x48ef03[_0x58f028]={'$like':'%'+_0x4451c1[_0xe0b9('0x34')][_0xe0b9('0x3f')]+'%'};return _0x48ef03;})});}_0x18bb8f=_[_0xe0b9('0x40')]({},_0x18bb8f,_0x4451c1[_0xe0b9('0x42')]);return _0x25a99d[_0xe0b9('0x5d')](_0x18bb8f);}})[_0xe0b9('0x22')](function(_0x23e166){if(_0x23e166){_0x637516=_0x23e166[_0xe0b9('0x39')];if(!_0x4451c1[_0xe0b9('0x34')]['hasOwnProperty'](_0xe0b9('0x3b'))){_0x18bb8f[_0xe0b9('0x1c')]=qs[_0xe0b9('0x1c')](_0x4451c1[_0xe0b9('0x34')][_0xe0b9('0x1c')]);_0x18bb8f[_0xe0b9('0x1a')]=qs[_0xe0b9('0x1a')](_0x4451c1['query'][_0xe0b9('0x1a')]);}return _0x25a99d[_0xe0b9('0x5d')](_0x18bb8f);}})[_0xe0b9('0x22')](function(_0x2be8e2){if(_0x2be8e2){return _0x2be8e2?{'count':_0x637516,'rows':_0x2be8e2}:null;}})['then'](respondWithResult(_0x3a0b7d,null))[_0xe0b9('0x46')](handleError(_0x3a0b7d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b462815..a7c68e4 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 _0x31c2=['exports','Trigger','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x31c2,0x98));var _0x231c=function(_0x4ca5d1,_0x12c3fe){_0x4ca5d1=_0x4ca5d1-0x0;var _0x2b961b=_0x31c2[_0x4ca5d1];return _0x2b961b;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require('bluebird');var rp=require(_0x231c('0x3'));var fs=require('fs');var path=require(_0x231c('0x4'));var rimraf=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var attributes=require(_0x231c('0x7'));module[_0x231c('0x8')]=function(_0x21b4df,_0x4442b9){return _0x21b4df['define'](_0x231c('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','lodash'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0xb43b,0xbf));var _0xbb43=function(_0x2b3efe,_0x5165ca){_0x2b3efe=_0x2b3efe-0x0;var _0xa0aa22=_0xb43b[_0x2b3efe];return _0xa0aa22;};'use strict';var _=require(_0xbb43('0x0'));var util=require('util');var logger=require(_0xbb43('0x1'))(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require(_0xbb43('0x5'));var fs=require('fs');var path=require(_0xbb43('0x6'));var rimraf=require(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var attributes=require(_0xbb43('0x9'));module[_0xbb43('0xa')]=function(_0x2e55f3,_0x51e44e){return _0x2e55f3[_0xbb43('0xb')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 02a0a5f..3fa5af7 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 _0x3368=['Trigger','findAll','options','where','attributes','limit','map','model','include','find','ShowTrigger','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger'];(function(_0x190311,_0x38f551){var _0x5b6cf7=function(_0x3fcdc4){while(--_0x3fcdc4){_0x190311['push'](_0x190311['shift']());}};_0x5b6cf7(++_0x38f551);}(_0x3368,0x8f));var _0x8336=function(_0x16852f,_0x4e8e3e){_0x16852f=_0x16852f-0x0;var _0x13e242=_0x3368[_0x16852f];return _0x13e242;};'use strict';var _=require(_0x8336('0x0'));var util=require(_0x8336('0x1'));var moment=require(_0x8336('0x2'));var BPromise=require('bluebird');var rs=require(_0x8336('0x3'));var fs=require('fs');var Redis=require(_0x8336('0x4'));var db=require(_0x8336('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8336('0x6'))('rpc');var config=require(_0x8336('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8336('0x8')][_0x8336('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ab4ee,_0x3507eb,_0x320cd7){return new BPromise(function(_0xda8c75,_0x438735){return client['request'](_0x1ab4ee,_0x320cd7)[_0x8336('0xa')](function(_0x25e43f){logger[_0x8336('0xb')](_0x8336('0xc'),_0x3507eb,_0x8336('0xd'));logger[_0x8336('0xe')](_0x8336('0xf'),_0x3507eb,_0x8336('0xd'),JSON[_0x8336('0x10')](_0x25e43f));if(_0x25e43f[_0x8336('0x11')]){if(_0x25e43f[_0x8336('0x11')][_0x8336('0x12')]===0x1f4){logger[_0x8336('0x11')](_0x8336('0xc'),_0x3507eb,_0x25e43f[_0x8336('0x11')][_0x8336('0x13')]);return _0x438735(_0x25e43f['error'][_0x8336('0x13')]);}logger[_0x8336('0x11')](_0x8336('0xc'),_0x3507eb,_0x25e43f[_0x8336('0x11')][_0x8336('0x13')]);return _0xda8c75(_0x25e43f[_0x8336('0x11')][_0x8336('0x13')]);}else{logger[_0x8336('0xb')]('Trigger,\x20%s,\x20%s',_0x3507eb,_0x8336('0xd'));_0xda8c75(_0x25e43f['result'][_0x8336('0x13')]);}})[_0x8336('0x14')](function(_0x2ff962){logger[_0x8336('0x11')]('Trigger,\x20%s,\x20%s',_0x3507eb,_0x2ff962);_0x438735(_0x2ff962);});});}exports[_0x8336('0x15')]=function(_0x5a3de3){var _0x50b153=this;return new Promise(function(_0x3f96a7,_0x46c261){return db[_0x8336('0x16')][_0x8336('0x17')]({'raw':_0x5a3de3[_0x8336('0x18')]?_0x5a3de3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a3de3[_0x8336('0x18')]?_0x5a3de3['options'][_0x8336('0x19')]||null:null,'attributes':_0x5a3de3[_0x8336('0x18')]?_0x5a3de3[_0x8336('0x18')][_0x8336('0x1a')]||null:null,'limit':_0x5a3de3[_0x8336('0x18')]?_0x5a3de3[_0x8336('0x18')][_0x8336('0x1b')]||null:null,'include':_0x5a3de3[_0x8336('0x18')]?_0x5a3de3[_0x8336('0x18')]['include']?_[_0x8336('0x1c')](_0x5a3de3['options']['include'],function(_0x5a5800){return{'model':db[_0x5a5800[_0x8336('0x1d')]],'as':_0x5a5800['as'],'attributes':_0x5a5800[_0x8336('0x1a')],'include':_0x5a5800[_0x8336('0x1e')]?_[_0x8336('0x1c')](_0x5a5800[_0x8336('0x1e')],function(_0x27ad2a){return{'model':db[_0x27ad2a[_0x8336('0x1d')]],'as':_0x27ad2a['as'],'attributes':_0x27ad2a[_0x8336('0x1a')],'include':_0x27ad2a[_0x8336('0x1e')]?_[_0x8336('0x1c')](_0x27ad2a[_0x8336('0x1e')],function(_0x353f27){return{'model':db[_0x353f27[_0x8336('0x1d')]],'as':_0x353f27['as'],'attributes':_0x353f27[_0x8336('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8336('0xa')](function(_0x6a35ea){logger['info'](_0x8336('0x15'),_0x5a3de3);logger['debug'](_0x8336('0x15'),_0x5a3de3,JSON[_0x8336('0x10')](_0x6a35ea));_0x3f96a7(_0x6a35ea);})[_0x8336('0x14')](function(_0x3b70b8){logger[_0x8336('0x11')](_0x8336('0x15'),_0x3b70b8[_0x8336('0x13')],_0x5a3de3);_0x46c261(_0x50b153['error'](0x1f4,_0x3b70b8[_0x8336('0x13')]));});});};exports['ShowTrigger']=function(_0xb8084c){var _0x5db96f=this;return new Promise(function(_0x5f1946,_0xd15701){return db[_0x8336('0x16')][_0x8336('0x1f')]({'raw':_0xb8084c[_0x8336('0x18')]?_0xb8084c['options']['raw']===undefined?!![]:![]:!![],'where':_0xb8084c[_0x8336('0x18')]?_0xb8084c['options']['where']||null:null,'attributes':_0xb8084c[_0x8336('0x18')]?_0xb8084c[_0x8336('0x18')][_0x8336('0x1a')]||null:null,'include':_0xb8084c[_0x8336('0x18')]?_0xb8084c[_0x8336('0x18')][_0x8336('0x1e')]?_[_0x8336('0x1c')](_0xb8084c[_0x8336('0x18')]['include'],function(_0x135c5a){return{'model':db[_0x135c5a['model']],'as':_0x135c5a['as'],'attributes':_0x135c5a['attributes'],'include':_0x135c5a[_0x8336('0x1e')]?_[_0x8336('0x1c')](_0x135c5a[_0x8336('0x1e')],function(_0x2cf41b){return{'model':db[_0x2cf41b[_0x8336('0x1d')]],'as':_0x2cf41b['as'],'attributes':_0x2cf41b[_0x8336('0x1a')],'include':_0x2cf41b[_0x8336('0x1e')]?_[_0x8336('0x1c')](_0x2cf41b[_0x8336('0x1e')],function(_0x303c8a){return{'model':db[_0x303c8a[_0x8336('0x1d')]],'as':_0x303c8a['as'],'attributes':_0x303c8a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8336('0xa')](function(_0x2247cc){logger[_0x8336('0xb')]('ShowTrigger',_0xb8084c);logger[_0x8336('0xe')]('ShowTrigger',_0xb8084c,JSON[_0x8336('0x10')](_0x2247cc));_0x5f1946(_0x2247cc);})[_0x8336('0x14')](function(_0x11ec2b){logger[_0x8336('0x11')](_0x8336('0x20'),_0x11ec2b[_0x8336('0x13')],_0xb8084c);_0xd15701(_0x5db96f['error'](0x1f4,_0x11ec2b[_0x8336('0x13')]));});});}; \ No newline at end of file +var _0xfea0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','model','map','catch','ShowTrigger','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfea0,0x175));var _0x0fea=function(_0x2665ff,_0x342a47){_0x2665ff=_0x2665ff-0x0;var _0x5d2ec9=_0xfea0[_0x2665ff];return _0x5d2ec9;};'use strict';var _=require(_0x0fea('0x0'));var util=require(_0x0fea('0x1'));var moment=require(_0x0fea('0x2'));var BPromise=require(_0x0fea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fea('0x4'));var db=require(_0x0fea('0x5'))['db'];var utils=require(_0x0fea('0x6'));var logger=require(_0x0fea('0x7'))(_0x0fea('0x8'));var config=require(_0x0fea('0x9'));var jayson=require(_0x0fea('0xa'));var client=jayson[_0x0fea('0xb')][_0x0fea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xacbb03,_0x38bf29,_0x5929f6){return new BPromise(function(_0x5b8c97,_0x3fceea){return client[_0x0fea('0xd')](_0xacbb03,_0x5929f6)[_0x0fea('0xe')](function(_0x31822d){logger[_0x0fea('0xf')]('Trigger,\x20%s,\x20%s',_0x38bf29,_0x0fea('0x10'));logger[_0x0fea('0x11')](_0x0fea('0x12'),_0x38bf29,_0x0fea('0x10'),JSON[_0x0fea('0x13')](_0x31822d));if(_0x31822d[_0x0fea('0x14')]){if(_0x31822d[_0x0fea('0x14')]['code']===0x1f4){logger[_0x0fea('0x14')](_0x0fea('0x15'),_0x38bf29,_0x31822d[_0x0fea('0x14')]['message']);return _0x3fceea(_0x31822d[_0x0fea('0x14')][_0x0fea('0x16')]);}logger[_0x0fea('0x14')]('Trigger,\x20%s,\x20%s',_0x38bf29,_0x31822d[_0x0fea('0x14')][_0x0fea('0x16')]);return _0x5b8c97(_0x31822d[_0x0fea('0x14')][_0x0fea('0x16')]);}else{logger[_0x0fea('0xf')](_0x0fea('0x15'),_0x38bf29,'request\x20sent');_0x5b8c97(_0x31822d[_0x0fea('0x17')]['message']);}})['catch'](function(_0x2727b2){logger[_0x0fea('0x14')](_0x0fea('0x15'),_0x38bf29,_0x2727b2);_0x3fceea(_0x2727b2);});});}exports[_0x0fea('0x18')]=function(_0x1ec914){var _0x186fd3=this;return new Promise(function(_0x44795e,_0x15550a){return db[_0x0fea('0x19')][_0x0fea('0x1a')]({'raw':_0x1ec914[_0x0fea('0x1b')]?_0x1ec914['options'][_0x0fea('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ec914[_0x0fea('0x1b')]?_0x1ec914[_0x0fea('0x1b')]['where']||null:null,'attributes':_0x1ec914[_0x0fea('0x1b')]?_0x1ec914[_0x0fea('0x1b')][_0x0fea('0x1d')]||null:null,'limit':_0x1ec914[_0x0fea('0x1b')]?_0x1ec914[_0x0fea('0x1b')][_0x0fea('0x1e')]||null:null,'include':_0x1ec914[_0x0fea('0x1b')]?_0x1ec914[_0x0fea('0x1b')]['include']?_['map'](_0x1ec914[_0x0fea('0x1b')][_0x0fea('0x1f')],function(_0x3dfdfb){return{'model':db[_0x3dfdfb[_0x0fea('0x20')]],'as':_0x3dfdfb['as'],'attributes':_0x3dfdfb['attributes'],'include':_0x3dfdfb['include']?_[_0x0fea('0x21')](_0x3dfdfb[_0x0fea('0x1f')],function(_0x4be547){return{'model':db[_0x4be547[_0x0fea('0x20')]],'as':_0x4be547['as'],'attributes':_0x4be547['attributes'],'include':_0x4be547['include']?_[_0x0fea('0x21')](_0x4be547[_0x0fea('0x1f')],function(_0xcea2a3){return{'model':db[_0xcea2a3[_0x0fea('0x20')]],'as':_0xcea2a3['as'],'attributes':_0xcea2a3[_0x0fea('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c93e1){logger['info'](_0x0fea('0x18'),_0x1ec914);logger['debug'](_0x0fea('0x18'),_0x1ec914,JSON['stringify'](_0x1c93e1));_0x44795e(_0x1c93e1);})[_0x0fea('0x22')](function(_0x50e6e7){logger[_0x0fea('0x14')](_0x0fea('0x18'),_0x50e6e7[_0x0fea('0x16')],_0x1ec914);_0x15550a(_0x186fd3[_0x0fea('0x14')](0x1f4,_0x50e6e7[_0x0fea('0x16')]));});});};exports[_0x0fea('0x23')]=function(_0x390436){var _0x41c9b1=this;return new Promise(function(_0x4961c8,_0x9d9586){return db[_0x0fea('0x19')][_0x0fea('0x24')]({'raw':_0x390436[_0x0fea('0x1b')]?_0x390436[_0x0fea('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x390436[_0x0fea('0x1b')]?_0x390436[_0x0fea('0x1b')][_0x0fea('0x25')]||null:null,'attributes':_0x390436['options']?_0x390436[_0x0fea('0x1b')][_0x0fea('0x1d')]||null:null,'include':_0x390436[_0x0fea('0x1b')]?_0x390436[_0x0fea('0x1b')][_0x0fea('0x1f')]?_[_0x0fea('0x21')](_0x390436[_0x0fea('0x1b')]['include'],function(_0x178324){return{'model':db[_0x178324[_0x0fea('0x20')]],'as':_0x178324['as'],'attributes':_0x178324[_0x0fea('0x1d')],'include':_0x178324[_0x0fea('0x1f')]?_['map'](_0x178324[_0x0fea('0x1f')],function(_0x103abd){return{'model':db[_0x103abd[_0x0fea('0x20')]],'as':_0x103abd['as'],'attributes':_0x103abd[_0x0fea('0x1d')],'include':_0x103abd['include']?_[_0x0fea('0x21')](_0x103abd[_0x0fea('0x1f')],function(_0x1b639d){return{'model':db[_0x1b639d[_0x0fea('0x20')]],'as':_0x1b639d['as'],'attributes':_0x1b639d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0fea('0xe')](function(_0x4ceabd){logger[_0x0fea('0xf')](_0x0fea('0x23'),_0x390436);logger[_0x0fea('0x11')](_0x0fea('0x23'),_0x390436,JSON['stringify'](_0x4ceabd));_0x4961c8(_0x4ceabd);})[_0x0fea('0x22')](function(_0x2bd8cc){logger[_0x0fea('0x14')]('ShowTrigger',_0x2bd8cc[_0x0fea('0x16')],_0x390436);_0x9d9586(_0x41c9b1[_0x0fea('0x14')](0x1f4,_0x2bd8cc[_0x0fea('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 2bd7fa2..3e87644 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 _0x8542=['show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x5913e2,_0x47adda){var _0xc6d0f5=function(_0x2c7ed7){while(--_0x2c7ed7){_0x5913e2['push'](_0x5913e2['shift']());}};_0xc6d0f5(++_0x47adda);}(_0x8542,0x1ed));var _0x2854=function(_0xa5a61a,_0x216617){_0xa5a61a=_0xa5a61a-0x0;var _0xabee02=_0x8542[_0xa5a61a];return _0xabee02;};'use strict';var multer=require(_0x2854('0x0'));var util=require(_0x2854('0x1'));var path=require(_0x2854('0x2'));var timeout=require(_0x2854('0x3'));var express=require('express');var router=express[_0x2854('0x4')]();var fs_extra=require(_0x2854('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2854('0x6'));var controller=require('./trunk.controller');router['get']('/',auth[_0x2854('0x7')](),controller[_0x2854('0x8')]);router[_0x2854('0x9')](_0x2854('0xa'),auth[_0x2854('0x7')](),controller[_0x2854('0xb')]);router[_0x2854('0xc')](_0x2854('0xd'),auth['isAuthenticated'](),controller[_0x2854('0xe')]);router[_0x2854('0xc')]('/',auth[_0x2854('0x7')](),controller[_0x2854('0xf')]);router[_0x2854('0x10')](_0x2854('0xa'),auth[_0x2854('0x7')](),controller[_0x2854('0x11')]);router[_0x2854('0x12')](_0x2854('0xa'),auth[_0x2854('0x7')](),controller[_0x2854('0x13')]);module[_0x2854('0x14')]=router; \ No newline at end of file +var _0x0315=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x0315,0x12b));var _0x5031=function(_0x523d79,_0x158546){_0x523d79=_0x523d79-0x0;var _0x5dfe1f=_0x0315[_0x523d79];return _0x5dfe1f;};'use strict';var multer=require(_0x5031('0x0'));var util=require(_0x5031('0x1'));var path=require('path');var timeout=require(_0x5031('0x2'));var express=require(_0x5031('0x3'));var router=express[_0x5031('0x4')]();var fs_extra=require(_0x5031('0x5'));var auth=require(_0x5031('0x6'));var interaction=require(_0x5031('0x7'));var config=require(_0x5031('0x8'));var controller=require(_0x5031('0x9'));router[_0x5031('0xa')]('/',auth['isAuthenticated'](),controller[_0x5031('0xb')]);router[_0x5031('0xa')](_0x5031('0xc'),auth[_0x5031('0xd')](),controller['show']);router[_0x5031('0xe')]('/:id/clone',auth[_0x5031('0xd')](),controller['clone']);router[_0x5031('0xe')]('/',auth[_0x5031('0xd')](),controller[_0x5031('0xf')]);router[_0x5031('0x10')](_0x5031('0xc'),auth[_0x5031('0xd')](),controller[_0x5031('0x11')]);router[_0x5031('0x12')](_0x5031('0xc'),auth['isAuthenticated'](),controller[_0x5031('0x13')]);module[_0x5031('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 53c881e..4f8aa3a 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 _0x5083=['ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','accept','refuse','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','ALLOWED_NOT_SCREENED'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x5083,0x8f));var _0x3508=function(_0x45cf4f,_0x78046a){_0x45cf4f=_0x45cf4f-0x0;var _0x200767=_0x5083[_0x45cf4f];return _0x200767;};'use strict';var Sequelize=require(_0x3508('0x0'));module['exports']={'name':{'type':Sequelize[_0x3508('0x1')],'allowNull':![],'unique':_0x3508('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x4'),_0x3508('0x5'),'peer'),'allowNull':![],'defaultValue':_0x3508('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x6'),_0x3508('0x7'),_0x3508('0x8'),_0x3508('0x9'),_0x3508('0xa'),_0x3508('0xb'),'PROHIB_FAILED_SCREEN',_0x3508('0xc'))},'deny':{'type':Sequelize[_0x3508('0x1')]},'permit':{'type':Sequelize[_0x3508('0x1')]},'secret':{'type':Sequelize[_0x3508('0x1')]},'md5secret':{'type':Sequelize[_0x3508('0x1')]},'remotesecret':{'type':Sequelize[_0x3508('0x1')]},'transport':{'type':Sequelize[_0x3508('0x1')],'defaultValue':_0x3508('0xd'),'set':function(_0x393d68){this[_0x3508('0xe')](_0x3508('0xf'),_0x393d68?_0x393d68['join'](','):null);},'get':function(){return this[_0x3508('0x10')]('transport')?this[_0x3508('0x10')](_0x3508('0xf'))[_0x3508('0x11')](','):null;},'comment':_0x3508('0x12')},'dtmfmode':{'type':Sequelize[_0x3508('0x3')]('rfc2833',_0x3508('0x13'),'shortinfo',_0x3508('0x14'),_0x3508('0x15')),'defaultValue':_0x3508('0x16')},'directmedia':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no',_0x3508('0x18'),_0x3508('0x19'),_0x3508('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3508('0x1')]},'directmediadeny':{'type':Sequelize[_0x3508('0x1')]},'nat':{'type':Sequelize[_0x3508('0x1')],'defaultValue':_0x3508('0x1b'),'set':function(_0x2c792f){this[_0x3508('0xe')](_0x3508('0x1c'),_0x2c792f?_0x2c792f[_0x3508('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x3508('0x1c'))?this[_0x3508('0x10')](_0x3508('0x1c'))[_0x3508('0x11')](','):null;},'comment':_0x3508('0x1e')},'callgroup':{'type':Sequelize[_0x3508('0x1')]},'namedcallgroup':{'type':Sequelize[_0x3508('0x1')]},'pickupgroup':{'type':Sequelize[_0x3508('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x3508('0x1')]},'language':{'type':Sequelize[_0x3508('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3508('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x3508('0x1f')},'allow':{'type':Sequelize[_0x3508('0x1')],'allowNull':![],'defaultValue':_0x3508('0x20'),'set':function(_0x1ece05){this[_0x3508('0xe')](_0x3508('0x21'),_0x1ece05?_0x1ece05[_0x3508('0x1d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3508('0x10')](_0x3508('0x21'))?this[_0x3508('0x10')](_0x3508('0x21'))[_0x3508('0x11')](';'):null;},'comment':_0x3508('0x22')},'autoframing':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'insecure':{'type':Sequelize[_0x3508('0x1')],'defaultValue':'port,invite','set':function(_0x1ecdc0){this['setDataValue'](_0x3508('0x23'),_0x1ecdc0?_0x1ecdc0[_0x3508('0x1d')](','):null);},'get':function(){return this[_0x3508('0x10')](_0x3508('0x23'))?this['getDataValue'](_0x3508('0x23'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no',_0x3508('0x24'))},'promiscredir':{'type':Sequelize[_0x3508('0x3')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3508('0x17'),'no')},'accountcode':{'type':Sequelize[_0x3508('0x25')](0xb)},'setvar':{'type':Sequelize[_0x3508('0x1')]},'callerid':{'type':Sequelize[_0x3508('0x1')],'defaultValue':_0x3508('0x26')},'amaflags':{'type':Sequelize[_0x3508('0x1')]},'callcounter':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no'),'defaultValue':_0x3508('0x17')},'busylevel':{'type':Sequelize[_0x3508('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x3508('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x3508('0x1')]},'template':{'type':Sequelize[_0x3508('0x1')]},'videosupport':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3508('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3508('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x3508('0x1')]},'session_timers':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x27'),_0x3508('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x3508('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x3508('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x3508('0x3')]('uac',_0x3508('0x29')),'defaultValue':_0x3508('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x3508('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x3508('0x1')]},'fromuser':{'type':Sequelize[_0x3508('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x3508('0x17'),'no'),'defaultValue':_0x3508('0x17')},'keepalive':{'type':Sequelize[_0x3508('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x3508('0x1')]},'defaultuser':{'type':Sequelize[_0x3508('0x1')]},'rtptimeout':{'type':Sequelize[_0x3508('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3508('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x3508('0x17'),'no',_0x3508('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3508('0x1')]},'callbackextension':{'type':Sequelize[_0x3508('0x1')]},'timert1':{'type':Sequelize[_0x3508('0x25')](0xb)},'timerb':{'type':Sequelize[_0x3508('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3508('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x3508('0x1')]},'contactdeny':{'type':Sequelize[_0x3508('0x1')]},'contactacl':{'type':Sequelize[_0x3508('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x3508('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x3508('0x25')](0xb)},'encryption':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3508('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'icesupport':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no',_0x3508('0x2b'),_0x3508('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x3508('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3508('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3508('0x1')]},'dtlscafile':{'type':Sequelize[_0x3508('0x1')]},'dtlscapath':{'type':Sequelize[_0x3508('0x1')]},'dtlssetup':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x2d'),_0x3508('0x2e'),_0x3508('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3508('0x1')]},'usereqphone':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3508('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3508('0x3')](_0x3508('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x3508('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x3508('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x3508('0x1')]},'description':{'type':Sequelize[_0x3508('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x3508('0x17'),'no',_0x3508('0x18'),'update',_0x3508('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3508('0x1')]},'otherFields':{'type':Sequelize[_0x3508('0x1')]},'active':{'type':Sequelize[_0x3508('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3508('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xab1e=['PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','sequelize','exports','STRING','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED'];(function(_0x2d9da8,_0x5d5072){var _0x57a29c=function(_0x2f562d){while(--_0x2f562d){_0x2d9da8['push'](_0x2d9da8['shift']());}};_0x57a29c(++_0x5d5072);}(_0xab1e,0x154));var _0xeab1=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xab1e[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xeab1('0x0'));module[_0xeab1('0x1')]={'name':{'type':Sequelize[_0xeab1('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xeab1('0x3'),_0xeab1('0x4'),_0xeab1('0x5')),'allowNull':![],'defaultValue':_0xeab1('0x3')},'context':{'type':Sequelize[_0xeab1('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x7'),'ALLOWED_PASSED_SCREEN',_0xeab1('0x8'),'ALLOWED',_0xeab1('0x9'),'PROHIB_PASSED_SCREEN',_0xeab1('0xa'),_0xeab1('0xb'))},'deny':{'type':Sequelize[_0xeab1('0x2')]},'permit':{'type':Sequelize[_0xeab1('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xeab1('0x2')]},'remotesecret':{'type':Sequelize[_0xeab1('0x2')]},'transport':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':'udp','set':function(_0x3032f2){this[_0xeab1('0xc')](_0xeab1('0xd'),_0x3032f2?_0x3032f2['join'](','):null);},'get':function(){return this['getDataValue'](_0xeab1('0xd'))?this[_0xeab1('0xe')](_0xeab1('0xd'))[_0xeab1('0xf')](','):null;},'comment':_0xeab1('0x10')},'dtmfmode':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x11'),_0xeab1('0x12'),_0xeab1('0x13'),_0xeab1('0x14'),'auto'),'defaultValue':_0xeab1('0x11')},'directmedia':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no','nonat',_0xeab1('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xeab1('0x2')]},'nat':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x35e2db){this[_0xeab1('0xc')](_0xeab1('0x17'),_0x35e2db?_0x35e2db[_0xeab1('0x18')](','):null);},'get':function(){return this[_0xeab1('0xe')]('nat')?this['getDataValue'](_0xeab1('0x17'))[_0xeab1('0xf')](','):null;},'comment':_0xeab1('0x19')},'callgroup':{'type':Sequelize[_0xeab1('0x2')]},'namedcallgroup':{'type':Sequelize[_0xeab1('0x2')]},'pickupgroup':{'type':Sequelize[_0xeab1('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xeab1('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xeab1('0x2')],'allowNull':![],'defaultValue':_0xeab1('0x1a'),'set':function(_0x195677){this['setDataValue'](_0xeab1('0x1b'),_0x195677?_0x195677[_0xeab1('0x18')](';'):_0xeab1('0x1a'));},'get':function(){return this['getDataValue'](_0xeab1('0x1b'))?this[_0xeab1('0xe')](_0xeab1('0x1b'))[_0xeab1('0xf')](';'):null;},'comment':_0xeab1('0x1c')},'autoframing':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'insecure':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':_0xeab1('0x1d'),'set':function(_0x20efa9){this[_0xeab1('0xc')]('insecure',_0x20efa9?_0x20efa9[_0xeab1('0x18')](','):null);},'get':function(){return this[_0xeab1('0xe')](_0xeab1('0x1e'))?this[_0xeab1('0xe')]('insecure')[_0xeab1('0xf')](','):null;},'comment':_0xeab1('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0xeab1('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no',_0xeab1('0x20'))},'promiscredir':{'type':Sequelize[_0xeab1('0x6')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0xeab1('0x21')](0xb)},'setvar':{'type':Sequelize[_0xeab1('0x2')]},'callerid':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':_0xeab1('0x22')},'amaflags':{'type':Sequelize[_0xeab1('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeab1('0x15')},'busylevel':{'type':Sequelize[_0xeab1('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xeab1('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xeab1('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xeab1('0x15'),'no',_0xeab1('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xeab1('0x15'),'no')},'mailbox':{'type':Sequelize[_0xeab1('0x2')]},'session_timers':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x24'),_0xeab1('0x25'),_0xeab1('0x26'))},'session_expires':{'type':Sequelize[_0xeab1('0x21')](0xb)},'session_minse':{'type':Sequelize[_0xeab1('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x27'),_0xeab1('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xeab1('0x2')]},'regexten':{'type':Sequelize[_0xeab1('0x2')]},'fromdomain':{'type':Sequelize[_0xeab1('0x2')]},'fromuser':{'type':Sequelize[_0xeab1('0x2')]},'port':{'type':Sequelize[_0xeab1('0x21')](0x5)},'qualify':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xeab1('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xeab1('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no',_0xeab1('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xeab1('0x2')]},'callbackextension':{'type':Sequelize[_0xeab1('0x2')]},'timert1':{'type':Sequelize[_0xeab1('0x21')](0xb)},'timerb':{'type':Sequelize[_0xeab1('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xeab1('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0xeab1('0x2')]},'contactdeny':{'type':Sequelize[_0xeab1('0x2')]},'contactacl':{'type':Sequelize[_0xeab1('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xeab1('0x2')]},'use_q850_reason':{'type':Sequelize[_0xeab1('0x2')]},'maxforwards':{'type':Sequelize[_0xeab1('0x21')](0xb)},'encryption':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xeab1('0x15'),'no')},'icesupport':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xeab1('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no',_0xeab1('0x2a'),_0xeab1('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xeab1('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xeab1('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xeab1('0x2')]},'dtlscipher':{'type':Sequelize[_0xeab1('0x2')]},'dtlscafile':{'type':Sequelize[_0xeab1('0x2')]},'dtlscapath':{'type':Sequelize[_0xeab1('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xeab1('0x2c'),_0xeab1('0x2d'),_0xeab1('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xeab1('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xeab1('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xeab1('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no')},'vmexten':{'type':Sequelize[_0xeab1('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xeab1('0x2')]},'parkinglot':{'type':Sequelize[_0xeab1('0x2')]},'description':{'type':Sequelize[_0xeab1('0x2')]},'host':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':_0xeab1('0x2f')},'canreinvite':{'type':Sequelize[_0xeab1('0x6')](_0xeab1('0x15'),'no',_0xeab1('0x30'),_0xeab1('0x16'),_0xeab1('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xeab1('0x2')]},'otherFields':{'type':Sequelize[_0xeab1('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xeab1('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 92e5003..c7774f6 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5aacd7,_0x348948){var _0x578292=function(_0x5087e4){while(--_0x5087e4){_0x5aacd7['push'](_0x5aacd7['shift']());}};_0x578292(++_0x348948);}(_0x55ca,0x126));var _0xa55c=function(_0x4d230c,_0x3862fd){_0x4d230c=_0x4d230c-0x0;var _0x16b044=_0x55ca[_0x4d230c];return _0x16b044;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5a762a,_0x6aa15e){var _0x41db9e=function(_0x2e75f0){while(--_0x2e75f0){_0x5a762a['push'](_0x5a762a['shift']());}};_0x41db9e(++_0x6aa15e);}(_0x54ef,0x112));var _0xf54e=function(_0x10539c,_0x1c0396){_0x10539c=_0x10539c-0x0;var _0x326456=_0x54ef[_0x10539c];return _0x326456;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 087d961..283c147 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 _0x70f9=['path','rimraf','../../config/environment','define','tools_trunks','util','moment','bluebird','request-promise'];(function(_0x29219e,_0x361e47){var _0x2d2540=function(_0x330941){while(--_0x330941){_0x29219e['push'](_0x29219e['shift']());}};_0x2d2540(++_0x361e47);}(_0x70f9,0x1a3));var _0x970f=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x70f9[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var util=require(_0x970f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x970f('0x1'));var BPromise=require(_0x970f('0x2'));var rp=require(_0x970f('0x3'));var fs=require('fs');var path=require(_0x970f('0x4'));var rimraf=require(_0x970f('0x5'));var config=require(_0x970f('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x2bc1a7,_0x18a9ba){return _0x2bc1a7[_0x970f('0x7')]('Trunk',attributes,{'tableName':_0x970f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a87=['exports','define','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./trunk.attributes'];(function(_0x3e686b,_0x5a83e7){var _0x4d7791=function(_0x500cb2){while(--_0x500cb2){_0x3e686b['push'](_0x3e686b['shift']());}};_0x4d7791(++_0x5a83e7);}(_0x6a87,0xb6));var _0x76a8=function(_0x136ad7,_0x2406ce){_0x136ad7=_0x136ad7-0x0;var _0x41f698=_0x6a87[_0x136ad7];return _0x41f698;};'use strict';var _=require(_0x76a8('0x0'));var util=require('util');var logger=require(_0x76a8('0x1'))(_0x76a8('0x2'));var moment=require('moment');var BPromise=require(_0x76a8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76a8('0x4'));var config=require(_0x76a8('0x5'));var attributes=require(_0x76a8('0x6'));module[_0x76a8('0x7')]=function(_0x1e4cea,_0x52270c){return _0x1e4cea[_0x76a8('0x8')]('Trunk',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 f82c137..e1a93a7 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 _0x497d=['../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','Trunk,\x20%s,\x20%s','message','info','result','GetTrunk','Trunk','findAll','options','raw','where','limit','map','include','model','attributes','catch','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x11f3b0,_0x1c5575){var _0x5ae1f0=function(_0x12167d){while(--_0x12167d){_0x11f3b0['push'](_0x11f3b0['shift']());}};_0x5ae1f0(++_0x1c5575);}(_0x497d,0x80));var _0xd497=function(_0x42bafa,_0xbd1eb4){_0x42bafa=_0x42bafa-0x0;var _0x4cc9bd=_0x497d[_0x42bafa];return _0x4cc9bd;};'use strict';var _=require('lodash');var util=require(_0xd497('0x0'));var moment=require(_0xd497('0x1'));var BPromise=require(_0xd497('0x2'));var rs=require(_0xd497('0x3'));var fs=require('fs');var Redis=require(_0xd497('0x4'));var db=require(_0xd497('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd497('0x6'))(_0xd497('0x7'));var config=require(_0xd497('0x8'));var jayson=require(_0xd497('0x9'));var client=jayson['client'][_0xd497('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a174a,_0x3699d7,_0x4cd0b4){return new BPromise(function(_0x5ab102,_0x6795b2){return client[_0xd497('0xb')](_0x2a174a,_0x4cd0b4)[_0xd497('0xc')](function(_0x467cea){logger['info']('Trunk,\x20%s,\x20%s',_0x3699d7,_0xd497('0xd'));logger[_0xd497('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3699d7,_0xd497('0xd'),JSON[_0xd497('0xf')](_0x467cea));if(_0x467cea[_0xd497('0x10')]){if(_0x467cea[_0xd497('0x10')]['code']===0x1f4){logger[_0xd497('0x10')](_0xd497('0x11'),_0x3699d7,_0x467cea[_0xd497('0x10')][_0xd497('0x12')]);return _0x6795b2(_0x467cea[_0xd497('0x10')][_0xd497('0x12')]);}logger[_0xd497('0x10')](_0xd497('0x11'),_0x3699d7,_0x467cea['error'][_0xd497('0x12')]);return _0x5ab102(_0x467cea[_0xd497('0x10')]['message']);}else{logger[_0xd497('0x13')]('Trunk,\x20%s,\x20%s',_0x3699d7,_0xd497('0xd'));_0x5ab102(_0x467cea[_0xd497('0x14')][_0xd497('0x12')]);}})['catch'](function(_0x3a9fef){logger[_0xd497('0x10')](_0xd497('0x11'),_0x3699d7,_0x3a9fef);_0x6795b2(_0x3a9fef);});});}exports[_0xd497('0x15')]=function(_0x3dc50c){var _0x491ad7=this;return new Promise(function(_0x3c40b9,_0x52f57f){return db[_0xd497('0x16')][_0xd497('0x17')]({'raw':_0x3dc50c[_0xd497('0x18')]?_0x3dc50c[_0xd497('0x18')][_0xd497('0x19')]===undefined?!![]:![]:!![],'where':_0x3dc50c[_0xd497('0x18')]?_0x3dc50c[_0xd497('0x18')][_0xd497('0x1a')]||null:null,'attributes':_0x3dc50c['options']?_0x3dc50c[_0xd497('0x18')]['attributes']||null:null,'limit':_0x3dc50c[_0xd497('0x18')]?_0x3dc50c['options'][_0xd497('0x1b')]||null:null,'include':_0x3dc50c['options']?_0x3dc50c[_0xd497('0x18')]['include']?_[_0xd497('0x1c')](_0x3dc50c['options'][_0xd497('0x1d')],function(_0x1b68e6){return{'model':db[_0x1b68e6[_0xd497('0x1e')]],'as':_0x1b68e6['as'],'attributes':_0x1b68e6['attributes'],'include':_0x1b68e6[_0xd497('0x1d')]?_['map'](_0x1b68e6[_0xd497('0x1d')],function(_0x363472){return{'model':db[_0x363472[_0xd497('0x1e')]],'as':_0x363472['as'],'attributes':_0x363472[_0xd497('0x1f')],'include':_0x363472[_0xd497('0x1d')]?_[_0xd497('0x1c')](_0x363472[_0xd497('0x1d')],function(_0x448557){return{'model':db[_0x448557['model']],'as':_0x448557['as'],'attributes':_0x448557[_0xd497('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd497('0xc')](function(_0x104d83){logger[_0xd497('0x13')](_0xd497('0x15'),_0x3dc50c);logger[_0xd497('0xe')](_0xd497('0x15'),_0x3dc50c,JSON['stringify'](_0x104d83));_0x3c40b9(_0x104d83);})[_0xd497('0x20')](function(_0x33a5e2){logger['error'](_0xd497('0x15'),_0x33a5e2['message'],_0x3dc50c);_0x52f57f(_0x491ad7[_0xd497('0x10')](0x1f4,_0x33a5e2[_0xd497('0x12')]));});});};exports[_0xd497('0x21')]=function(_0x2f0cdc){var _0x363150=this;return new Promise(function(_0x38fb6d,_0x5dd5ac){return db[_0xd497('0x16')]['find']({'raw':_0x2f0cdc['options']?_0x2f0cdc[_0xd497('0x18')][_0xd497('0x19')]===undefined?!![]:![]:!![],'where':_0x2f0cdc[_0xd497('0x18')]?_0x2f0cdc[_0xd497('0x18')][_0xd497('0x1a')]||null:null,'attributes':_0x2f0cdc[_0xd497('0x18')]?_0x2f0cdc[_0xd497('0x18')][_0xd497('0x1f')]||null:null,'include':_0x2f0cdc[_0xd497('0x18')]?_0x2f0cdc[_0xd497('0x18')]['include']?_[_0xd497('0x1c')](_0x2f0cdc[_0xd497('0x18')][_0xd497('0x1d')],function(_0x40960c){return{'model':db[_0x40960c['model']],'as':_0x40960c['as'],'attributes':_0x40960c[_0xd497('0x1f')],'include':_0x40960c[_0xd497('0x1d')]?_[_0xd497('0x1c')](_0x40960c[_0xd497('0x1d')],function(_0x500ed7){return{'model':db[_0x500ed7[_0xd497('0x1e')]],'as':_0x500ed7['as'],'attributes':_0x500ed7[_0xd497('0x1f')],'include':_0x500ed7[_0xd497('0x1d')]?_[_0xd497('0x1c')](_0x500ed7['include'],function(_0x58af7a){return{'model':db[_0x58af7a['model']],'as':_0x58af7a['as'],'attributes':_0x58af7a[_0xd497('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd497('0xc')](function(_0x58bdd3){logger[_0xd497('0x13')](_0xd497('0x21'),_0x2f0cdc);logger[_0xd497('0xe')](_0xd497('0x21'),_0x2f0cdc,JSON['stringify'](_0x58bdd3));_0x38fb6d(_0x58bdd3);})[_0xd497('0x20')](function(_0x5239f5){logger[_0xd497('0x10')](_0xd497('0x21'),_0x5239f5['message'],_0x2f0cdc);_0x5dd5ac(_0x363150[_0xd497('0x10')](0x1f4,_0x5239f5[_0xd497('0x12')]));});});}; \ No newline at end of file +var _0x20f4=['http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','debug','ShowTrunk','find','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x20f4,0x12a));var _0x420f=function(_0x4b4739,_0x9b3da9){_0x4b4739=_0x4b4739-0x0;var _0x2f1495=_0x20f4[_0x4b4739];return _0x2f1495;};'use strict';var _=require('lodash');var util=require(_0x420f('0x0'));var moment=require(_0x420f('0x1'));var BPromise=require('bluebird');var rs=require(_0x420f('0x2'));var fs=require('fs');var Redis=require(_0x420f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x420f('0x4'));var logger=require(_0x420f('0x5'))(_0x420f('0x6'));var config=require(_0x420f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x420f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272584,_0x426c2e,_0x6fa2b2){return new BPromise(function(_0x328a99,_0x265dfd){return client[_0x420f('0x9')](_0x272584,_0x6fa2b2)[_0x420f('0xa')](function(_0x2ceb3a){logger[_0x420f('0xb')](_0x420f('0xc'),_0x426c2e,_0x420f('0xd'));logger['debug'](_0x420f('0xe'),_0x426c2e,_0x420f('0xd'),JSON[_0x420f('0xf')](_0x2ceb3a));if(_0x2ceb3a[_0x420f('0x10')]){if(_0x2ceb3a['error'][_0x420f('0x11')]===0x1f4){logger[_0x420f('0x10')]('Trunk,\x20%s,\x20%s',_0x426c2e,_0x2ceb3a[_0x420f('0x10')]['message']);return _0x265dfd(_0x2ceb3a['error'][_0x420f('0x12')]);}logger['error'](_0x420f('0xc'),_0x426c2e,_0x2ceb3a[_0x420f('0x10')][_0x420f('0x12')]);return _0x328a99(_0x2ceb3a[_0x420f('0x10')][_0x420f('0x12')]);}else{logger[_0x420f('0xb')](_0x420f('0xc'),_0x426c2e,_0x420f('0xd'));_0x328a99(_0x2ceb3a['result'][_0x420f('0x12')]);}})[_0x420f('0x13')](function(_0x669d29){logger[_0x420f('0x10')](_0x420f('0xc'),_0x426c2e,_0x669d29);_0x265dfd(_0x669d29);});});}exports[_0x420f('0x14')]=function(_0x492e1e){var _0x3281ff=this;return new Promise(function(_0x46ea14,_0x347a72){return db[_0x420f('0x15')][_0x420f('0x16')]({'raw':_0x492e1e[_0x420f('0x17')]?_0x492e1e[_0x420f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x492e1e['options']?_0x492e1e[_0x420f('0x17')][_0x420f('0x18')]||null:null,'attributes':_0x492e1e['options']?_0x492e1e[_0x420f('0x17')][_0x420f('0x19')]||null:null,'limit':_0x492e1e['options']?_0x492e1e[_0x420f('0x17')][_0x420f('0x1a')]||null:null,'include':_0x492e1e[_0x420f('0x17')]?_0x492e1e[_0x420f('0x17')][_0x420f('0x1b')]?_['map'](_0x492e1e[_0x420f('0x17')][_0x420f('0x1b')],function(_0x437060){return{'model':db[_0x437060[_0x420f('0x1c')]],'as':_0x437060['as'],'attributes':_0x437060[_0x420f('0x19')],'include':_0x437060[_0x420f('0x1b')]?_[_0x420f('0x1d')](_0x437060[_0x420f('0x1b')],function(_0x3bca1d){return{'model':db[_0x3bca1d[_0x420f('0x1c')]],'as':_0x3bca1d['as'],'attributes':_0x3bca1d[_0x420f('0x19')],'include':_0x3bca1d[_0x420f('0x1b')]?_['map'](_0x3bca1d['include'],function(_0x1202ab){return{'model':db[_0x1202ab[_0x420f('0x1c')]],'as':_0x1202ab['as'],'attributes':_0x1202ab[_0x420f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x420f('0xa')](function(_0x373aeb){logger[_0x420f('0xb')](_0x420f('0x14'),_0x492e1e);logger[_0x420f('0x1e')]('GetTrunk',_0x492e1e,JSON[_0x420f('0xf')](_0x373aeb));_0x46ea14(_0x373aeb);})['catch'](function(_0x50d40f){logger['error'](_0x420f('0x14'),_0x50d40f['message'],_0x492e1e);_0x347a72(_0x3281ff['error'](0x1f4,_0x50d40f[_0x420f('0x12')]));});});};exports[_0x420f('0x1f')]=function(_0x3ddaea){var _0x466645=this;return new Promise(function(_0x530ed7,_0x5f282a){return db[_0x420f('0x15')][_0x420f('0x20')]({'raw':_0x3ddaea[_0x420f('0x17')]?_0x3ddaea['options'][_0x420f('0x21')]===undefined?!![]:![]:!![],'where':_0x3ddaea[_0x420f('0x17')]?_0x3ddaea[_0x420f('0x17')]['where']||null:null,'attributes':_0x3ddaea[_0x420f('0x17')]?_0x3ddaea[_0x420f('0x17')]['attributes']||null:null,'include':_0x3ddaea[_0x420f('0x17')]?_0x3ddaea[_0x420f('0x17')][_0x420f('0x1b')]?_[_0x420f('0x1d')](_0x3ddaea[_0x420f('0x17')][_0x420f('0x1b')],function(_0x9f5d9b){return{'model':db[_0x9f5d9b[_0x420f('0x1c')]],'as':_0x9f5d9b['as'],'attributes':_0x9f5d9b['attributes'],'include':_0x9f5d9b['include']?_[_0x420f('0x1d')](_0x9f5d9b['include'],function(_0x280456){return{'model':db[_0x280456[_0x420f('0x1c')]],'as':_0x280456['as'],'attributes':_0x280456[_0x420f('0x19')],'include':_0x280456[_0x420f('0x1b')]?_[_0x420f('0x1d')](_0x280456[_0x420f('0x1b')],function(_0x231a2b){return{'model':db[_0x231a2b[_0x420f('0x1c')]],'as':_0x231a2b['as'],'attributes':_0x231a2b[_0x420f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a0696){logger[_0x420f('0xb')](_0x420f('0x1f'),_0x3ddaea);logger['debug']('ShowTrunk',_0x3ddaea,JSON[_0x420f('0xf')](_0x3a0696));_0x530ed7(_0x3a0696);})['catch'](function(_0x3d4a3e){logger[_0x420f('0x10')]('ShowTrunk',_0x3d4a3e[_0x420f('0x12')],_0x3ddaea);_0x5f282a(_0x466645[_0x420f('0x10')](0x1f4,_0x3d4a3e[_0x420f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index f8a7f14..b794732 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 _0xd779=['fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','create','/create_many','addQueues','diskStorage','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/square_projects','createApiKey','/:id','update','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','exports','multer','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd779,0x149));var _0x9d77=function(_0x14aa40,_0x23076a){_0x14aa40=_0x14aa40-0x0;var _0x39858a=_0xd779[_0x14aa40];return _0x39858a;};'use strict';var multer=require(_0x9d77('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9d77('0x1'));var express=require(_0x9d77('0x2'));var router=express[_0x9d77('0x3')]();var fs_extra=require(_0x9d77('0x4'));var auth=require(_0x9d77('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d77('0x6'));var controller=require(_0x9d77('0x7'));router[_0x9d77('0x8')]('/',auth[_0x9d77('0x9')](),controller[_0x9d77('0xa')]);router['get']('/describe',auth[_0x9d77('0x9')](),controller[_0x9d77('0xb')]);router[_0x9d77('0x8')]('/whoami',auth['isAuthenticated'](),controller['whoami']);router[_0x9d77('0x8')](_0x9d77('0xc'),auth[_0x9d77('0x9')](),controller[_0x9d77('0xd')]);router['get']('/:id',auth[_0x9d77('0x9')](),controller[_0x9d77('0xe')]);router[_0x9d77('0x8')](_0x9d77('0xf'),controller[_0x9d77('0x10')]);router[_0x9d77('0x8')](_0x9d77('0x11'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x12')]);router[_0x9d77('0x8')](_0x9d77('0x13'),auth[_0x9d77('0x9')](),controller['getContacts']);router[_0x9d77('0x8')](_0x9d77('0x14'),auth['isAuthenticated'](),controller[_0x9d77('0x15')]);router[_0x9d77('0x8')](_0x9d77('0x16'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x17')]);router['get'](_0x9d77('0x18'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x19')]);router[_0x9d77('0x8')](_0x9d77('0x1a'),auth[_0x9d77('0x9')](),controller['getRecordings']);router[_0x9d77('0x8')](_0x9d77('0x1b'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x1c')]);router[_0x9d77('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x9d77('0x1d')]);router[_0x9d77('0x8')]('/:id/openchannel/interactions',auth[_0x9d77('0x9')](),controller['getOpenchannelInteractions']);router[_0x9d77('0x8')](_0x9d77('0x1e'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x1f')]);router['get'](_0x9d77('0x20'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x21')]);router[_0x9d77('0x8')]('/:id/fax/interactions',auth[_0x9d77('0x9')](),controller['getFaxInteractions']);router[_0x9d77('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x9d77('0x8')](_0x9d77('0x22'),auth['isAuthenticated'](),controller[_0x9d77('0x23')]);router[_0x9d77('0x8')](_0x9d77('0x24'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x25')]);router[_0x9d77('0x8')]('/:id/agents',auth[_0x9d77('0x9')](),controller[_0x9d77('0x26')]);router[_0x9d77('0x8')]('/:id/prefixes',auth[_0x9d77('0x9')](),controller[_0x9d77('0x27')]);router[_0x9d77('0x8')](_0x9d77('0x28'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x29')]);router[_0x9d77('0x8')](_0x9d77('0x2a'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x2b')]);router[_0x9d77('0x8')](_0x9d77('0x2c'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x2d')]);router[_0x9d77('0x8')](_0x9d77('0x2e'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x2f')]);router[_0x9d77('0x8')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x9d77('0x30')]);router[_0x9d77('0x8')](_0x9d77('0x31'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x32')]);router[_0x9d77('0x8')]('/:id/square_projects',auth[_0x9d77('0x9')](),controller[_0x9d77('0x33')]);router[_0x9d77('0x8')](_0x9d77('0x34'),auth[_0x9d77('0x9')](),controller['getScheduledCalls']);router['get'](_0x9d77('0x35'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x36')]);router[_0x9d77('0x37')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x9d77('0x37')]('/',auth[_0x9d77('0x9')](),controller[_0x9d77('0x38')]);router[_0x9d77('0x37')](_0x9d77('0x39'),auth[_0x9d77('0x9')](),controller['bulkCreate']);router[_0x9d77('0x37')](_0x9d77('0x14'),auth['isAuthenticated'](),controller[_0x9d77('0x3a')]);var upload=multer({'storage':multer[_0x9d77('0x3b')]({'destination':function(_0x55e8a9,_0x1fafe1,_0x3c823b){_0x3c823b(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x2567ad,_0x3689c,_0x1b2b0a){_0x1b2b0a(null,util[_0x9d77('0x3c')](_0x9d77('0x3d'),Date[_0x9d77('0x3e')](),_0x3689c[_0x9d77('0x3f')]));}})});router[_0x9d77('0x37')](_0x9d77('0xf'),upload['single'](_0x9d77('0x40')),controller[_0x9d77('0x41')]);router['post'](_0x9d77('0x42'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x43')]);router[_0x9d77('0x37')](_0x9d77('0x44'),auth['isAuthenticated'](),controller[_0x9d77('0x45')]);router[_0x9d77('0x37')](_0x9d77('0x46'),auth['isAuthenticated'](),controller[_0x9d77('0x47')]);router['post']('/:id/unpause',auth[_0x9d77('0x9')](),controller[_0x9d77('0x48')]);router[_0x9d77('0x37')](_0x9d77('0x22'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x49')]);router[_0x9d77('0x37')](_0x9d77('0x4a'),auth['isAuthenticated'](),controller[_0x9d77('0x4b')]);router[_0x9d77('0x37')](_0x9d77('0x4c'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x4d')]);router['post'](_0x9d77('0x4e'),auth['isAuthenticated'](),controller[_0x9d77('0x4f')]);router[_0x9d77('0x37')](_0x9d77('0x50'),auth['isAuthenticated'](),controller[_0x9d77('0x51')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x9d77('0x52')]);router['post'](_0x9d77('0x53'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x54')]);router[_0x9d77('0x37')](_0x9d77('0x28'),auth[_0x9d77('0x9')](),controller['addFaxAccounts']);router[_0x9d77('0x37')](_0x9d77('0x2a'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x55')]);router[_0x9d77('0x37')](_0x9d77('0x2c'),auth[_0x9d77('0x9')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x9d77('0x9')](),controller[_0x9d77('0x56')]);router['post'](_0x9d77('0x57'),auth['isAuthenticated'](),controller[_0x9d77('0x58')]);router[_0x9d77('0x37')](_0x9d77('0x31'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x59')]);router[_0x9d77('0x37')](_0x9d77('0x5a'),auth[_0x9d77('0x9')](),controller['addSquareProjects']);router[_0x9d77('0x37')](_0x9d77('0x35'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x5b')]);router['put'](_0x9d77('0x5c'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x5d')]);router[_0x9d77('0x5e')](_0x9d77('0x5f'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x60')]);router['delete'](_0x9d77('0x14'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x61')]);router[_0x9d77('0x62')](_0x9d77('0x22'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x63')]);router[_0x9d77('0x62')](_0x9d77('0x5c'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x64')]);router[_0x9d77('0x62')](_0x9d77('0x4a'),auth['isAuthenticated'](),controller[_0x9d77('0x65')]);router[_0x9d77('0x62')](_0x9d77('0x4c'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x66')]);router['delete'](_0x9d77('0x4e'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x67')]);router[_0x9d77('0x62')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x9d77('0x68')]);router[_0x9d77('0x62')](_0x9d77('0x69'),auth[_0x9d77('0x9')](),controller['removeOpenchannelInteractions']);router[_0x9d77('0x62')](_0x9d77('0x53'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x6a')]);router[_0x9d77('0x62')](_0x9d77('0x28'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x6b')]);router[_0x9d77('0x62')](_0x9d77('0x2a'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x6c')]);router['delete'](_0x9d77('0x2c'),auth[_0x9d77('0x9')](),controller[_0x9d77('0x6d')]);router[_0x9d77('0x62')]('/:id/sms_accounts',auth[_0x9d77('0x9')](),controller['removeSmsAccounts']);router[_0x9d77('0x62')](_0x9d77('0x57'),auth[_0x9d77('0x9')](),controller['removeChatWebsites']);router[_0x9d77('0x62')](_0x9d77('0x31'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x9d77('0x62')](_0x9d77('0x5a'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x9d77('0x62')]('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);module[_0x9d77('0x6e')]=router; \ No newline at end of file +var _0x8ae8=['../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','whoami','/presence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/: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','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','format','originalname','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','unpause','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1fcaf0,_0x5a8a23){var _0x2bc21a=function(_0x195e25){while(--_0x195e25){_0x1fcaf0['push'](_0x1fcaf0['shift']());}};_0x2bc21a(++_0x5a8a23);}(_0x8ae8,0x6b));var _0x88ae=function(_0x2c5009,_0x63505f){_0x2c5009=_0x2c5009-0x0;var _0x40b7f9=_0x8ae8[_0x2c5009];return _0x40b7f9;};'use strict';var multer=require(_0x88ae('0x0'));var util=require('util');var path=require(_0x88ae('0x1'));var timeout=require(_0x88ae('0x2'));var express=require(_0x88ae('0x3'));var router=express['Router']();var fs_extra=require(_0x88ae('0x4'));var auth=require(_0x88ae('0x5'));var interaction=require(_0x88ae('0x6'));var config=require(_0x88ae('0x7'));var controller=require(_0x88ae('0x8'));router[_0x88ae('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88ae('0x9')](_0x88ae('0xa'),auth[_0x88ae('0xb')](),controller[_0x88ae('0xc')]);router[_0x88ae('0x9')]('/whoami',auth[_0x88ae('0xb')](),controller[_0x88ae('0xd')]);router[_0x88ae('0x9')](_0x88ae('0xe'),auth['isAuthenticated'](),controller['getPresence']);router[_0x88ae('0x9')]('/:id',auth[_0x88ae('0xb')](),controller[_0x88ae('0xf')]);router[_0x88ae('0x9')]('/:id/avatar',controller[_0x88ae('0x10')]);router[_0x88ae('0x9')](_0x88ae('0x11'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x12')]);router[_0x88ae('0x9')](_0x88ae('0x13'),auth['isAuthenticated'](),controller[_0x88ae('0x14')]);router[_0x88ae('0x9')](_0x88ae('0x15'),auth[_0x88ae('0xb')](),controller['getQueues']);router[_0x88ae('0x9')](_0x88ae('0x16'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x17')]);router['get'](_0x88ae('0x18'),auth['isAuthenticated'](),controller['getGroups']);router[_0x88ae('0x9')](_0x88ae('0x19'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x1a')]);router['get'](_0x88ae('0x1b'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x1c')]);router['get'](_0x88ae('0x1d'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x1e')]);router[_0x88ae('0x9')](_0x88ae('0x1f'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x20')]);router[_0x88ae('0x9')](_0x88ae('0x21'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x22')]);router[_0x88ae('0x9')](_0x88ae('0x23'),auth[_0x88ae('0xb')](),controller['getSmsInteractions']);router[_0x88ae('0x9')](_0x88ae('0x24'),auth[_0x88ae('0xb')](),controller['getFaxInteractions']);router[_0x88ae('0x9')](_0x88ae('0x25'),auth['isAuthenticated'](),controller[_0x88ae('0x26')]);router[_0x88ae('0x9')](_0x88ae('0x27'),auth['isAuthenticated'](),controller[_0x88ae('0x28')]);router['get'](_0x88ae('0x29'),auth[_0x88ae('0xb')](),controller['getLists']);router[_0x88ae('0x9')](_0x88ae('0x2a'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x2b')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x88ae('0x2c')]);router['get'](_0x88ae('0x2d'),auth[_0x88ae('0xb')](),controller['getFaxAccounts']);router['get'](_0x88ae('0x2e'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x2f')]);router[_0x88ae('0x9')](_0x88ae('0x30'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x31')]);router[_0x88ae('0x9')](_0x88ae('0x32'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x33')]);router[_0x88ae('0x9')](_0x88ae('0x34'),auth[_0x88ae('0xb')](),controller['getChatWebsites']);router[_0x88ae('0x9')](_0x88ae('0x35'),auth['isAuthenticated'](),controller[_0x88ae('0x36')]);router[_0x88ae('0x9')](_0x88ae('0x37'),auth[_0x88ae('0xb')](),controller['getSquareProjects']);router[_0x88ae('0x9')](_0x88ae('0x38'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x39')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0x88ae('0x3a')]);router[_0x88ae('0x3b')](_0x88ae('0x13'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x3c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x88ae('0x3d')]);router[_0x88ae('0x3b')]('/create_many',auth['isAuthenticated'](),controller[_0x88ae('0x3e')]);router[_0x88ae('0x3b')](_0x88ae('0x15'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x3f')]);var upload=multer({'storage':multer[_0x88ae('0x40')]({'destination':function(_0x1634df,_0x3f56cc,_0x345ff4){_0x345ff4(null,path[_0x88ae('0x41')](config[_0x88ae('0x42')],'server/files/images/'));},'filename':function(_0x571f4e,_0x4d0432,_0x5d5e1f){_0x5d5e1f(null,util[_0x88ae('0x43')]('%s-%s',Date['now'](),_0x4d0432[_0x88ae('0x44')]));}})});router[_0x88ae('0x3b')]('/:id/avatar',upload['single']('file'),controller[_0x88ae('0x45')]);router[_0x88ae('0x3b')](_0x88ae('0x46'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x47')]);router[_0x88ae('0x3b')]('/:id/logout',auth[_0x88ae('0xb')](),controller[_0x88ae('0x48')]);router['post'](_0x88ae('0x49'),auth[_0x88ae('0xb')](),controller['pause']);router[_0x88ae('0x3b')](_0x88ae('0x4a'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x4b')]);router[_0x88ae('0x3b')]('/:id/teams',auth[_0x88ae('0xb')](),controller['addTeams']);router[_0x88ae('0x3b')]('/:id/chat_interactions',auth[_0x88ae('0xb')](),controller[_0x88ae('0x4c')]);router[_0x88ae('0x3b')]('/:id/mail_interactions',auth[_0x88ae('0xb')](),controller[_0x88ae('0x4d')]);router['post'](_0x88ae('0x4e'),auth['isAuthenticated'](),controller[_0x88ae('0x4f')]);router[_0x88ae('0x3b')](_0x88ae('0x50'),auth[_0x88ae('0xb')](),controller['addSmsInteractions']);router['post']('/:id/openchannel_interactions',auth[_0x88ae('0xb')](),controller['addOpenchannelInteractions']);router[_0x88ae('0x3b')]('/:id/whatsapp_interactions',auth[_0x88ae('0xb')](),controller[_0x88ae('0x51')]);router['post'](_0x88ae('0x2d'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x88ae('0x3b')]('/:id/mail_accounts',auth[_0x88ae('0xb')](),controller[_0x88ae('0x52')]);router[_0x88ae('0x3b')]('/:id/openchannel_accounts',auth[_0x88ae('0xb')](),controller[_0x88ae('0x53')]);router[_0x88ae('0x3b')]('/:id/sms_accounts',auth[_0x88ae('0xb')](),controller[_0x88ae('0x54')]);router['post']('/:id/chat_websites',auth[_0x88ae('0xb')](),controller[_0x88ae('0x55')]);router[_0x88ae('0x3b')](_0x88ae('0x35'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x56')]);router[_0x88ae('0x3b')]('/:id/square_projects',auth[_0x88ae('0xb')](),controller[_0x88ae('0x57')]);router['post'](_0x88ae('0x58'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x59')]);router[_0x88ae('0x5a')](_0x88ae('0x5b'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x5c')]);router['put'](_0x88ae('0x5d'),auth[_0x88ae('0xb')](),controller['changePassword']);router[_0x88ae('0x5e')](_0x88ae('0x15'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x5f')]);router[_0x88ae('0x5e')](_0x88ae('0x27'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x60')]);router['delete'](_0x88ae('0x5b'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x61')]);router[_0x88ae('0x5e')](_0x88ae('0x62'),auth[_0x88ae('0xb')](),controller['removeChatInteractions']);router[_0x88ae('0x5e')](_0x88ae('0x63'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x64')]);router['delete'](_0x88ae('0x4e'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x65')]);router[_0x88ae('0x5e')](_0x88ae('0x50'),auth['isAuthenticated'](),controller[_0x88ae('0x66')]);router[_0x88ae('0x5e')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x88ae('0x67')]);router[_0x88ae('0x5e')](_0x88ae('0x68'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x69')]);router['delete'](_0x88ae('0x2d'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x6a')]);router['delete'](_0x88ae('0x2e'),auth['isAuthenticated'](),controller[_0x88ae('0x6b')]);router[_0x88ae('0x5e')](_0x88ae('0x30'),auth[_0x88ae('0xb')](),controller['removeOpenchannelAccounts']);router[_0x88ae('0x5e')](_0x88ae('0x32'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x6c')]);router['delete'](_0x88ae('0x34'),auth[_0x88ae('0xb')](),controller[_0x88ae('0x6d')]);router[_0x88ae('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x88ae('0x6e')]);router[_0x88ae('0x5e')](_0x88ae('0x37'),auth[_0x88ae('0xb')](),controller['removeSquareProjects']);router[_0x88ae('0x5e')]('/:id/api_key',auth[_0x88ae('0xb')](),controller[_0x88ae('0x6f')]);module[_0x88ae('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0a0fef8..75e5e7d 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 _0x4ef1=['force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','get','isArray','udp','wss','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','INTEGER','internal','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing'];(function(_0x25aa12,_0x4bec8c){var _0x3ab6b1=function(_0x2ac8ea){while(--_0x2ac8ea){_0x25aa12['push'](_0x25aa12['shift']());}};_0x3ab6b1(++_0x4bec8c);}(_0x4ef1,0xeb));var _0x14ef=function(_0x47137a,_0x5322a7){_0x47137a=_0x47137a-0x0;var _0x573b0a=_0x4ef1[_0x47137a];return _0x573b0a;};'use strict';var Sequelize=require(_0x14ef('0x0'));var moment=require(_0x14ef('0x1'));var util=require('util');var _=require(_0x14ef('0x2'));module[_0x14ef('0x3')]={'name':{'type':Sequelize[_0x14ef('0x4')],'allowNull':![],'unique':_0x14ef('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x168fd8){this[_0x14ef('0x6')](_0x14ef('0x5'),_0x168fd8);this[_0x14ef('0x6')](_0x14ef('0x7'),_0x168fd8);},'comment':_0x14ef('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x261fa2){this[_0x14ef('0x6')]('fullname',_0x261fa2);this[_0x14ef('0x6')](_0x14ef('0x9'),util[_0x14ef('0xa')](_0x14ef('0xb'),_0x261fa2,this[_0x14ef('0xc')]('internal')));}},'alias':{'type':Sequelize[_0x14ef('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x14ef('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1a4008){if(_0x1a4008){this[_0x14ef('0x6')](_0x14ef('0xd'),_0x1a4008['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x14ef('0xe'),_0x14ef('0xf'),'agent',_0x14ef('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x14ef('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x14ef('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':![],'unique':_0x14ef('0x12'),'set':function(_0x2263f1){this[_0x14ef('0x6')]('internal',_0x2263f1);this[_0x14ef('0x6')](_0x14ef('0x13'),_0x2263f1);this[_0x14ef('0x6')](_0x14ef('0x9'),util['format'](_0x14ef('0xb'),this[_0x14ef('0xc')](_0x14ef('0x14')),_0x2263f1));}},'salt':{'type':Sequelize[_0x14ef('0x4')]},'phone':{'type':Sequelize[_0x14ef('0x4')]},'mobile':{'type':Sequelize[_0x14ef('0x4')]},'address':{'type':Sequelize[_0x14ef('0x4')]},'zipcode':{'type':Sequelize[_0x14ef('0x4')]},'userpic':{'type':Sequelize[_0x14ef('0x4')]},'city':{'type':Sequelize[_0x14ef('0x4')]},'country':{'type':Sequelize[_0x14ef('0x4')]},'online':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x14ef('0x16')]},'voicePause':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x14ef('0x4')],'defaultValue':_0x14ef('0x17')},'lastPauseAt':{'type':Sequelize[_0x14ef('0x16')]},'chatCapacity':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x14ef('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x14ef('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![],'defaultValue':_0x14ef('0x18')},'ipaddr':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x14ef('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x14ef('0x19'),_0x14ef('0xf'),_0x14ef('0x1a')),'allowNull':!![],'defaultValue':_0x14ef('0x19')},'context':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![],'defaultValue':_0x14ef('0x1b')},'callingpres':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x1d'),'ALLOWED_PASSED_SCREEN',_0x14ef('0x1e'),_0x14ef('0x1f'),_0x14ef('0x20'),_0x14ef('0x21'),_0x14ef('0x22'),_0x14ef('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x217e20){this[_0x14ef('0x6')](_0x14ef('0x24'),_0x217e20?_0x217e20[_0x14ef('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x14ef('0xc')](_0x14ef('0x24'))[_0x14ef('0x26')](','):null;},'comment':_0x14ef('0x27')},'dtmfmode':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x28'),'info',_0x14ef('0x29'),_0x14ef('0x2a'),_0x14ef('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x14ef('0x2c'),_0x14ef('0x2d'),_0x14ef('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![],'defaultValue':_0x14ef('0x2f'),'set':function(_0x35f873){this['setDataValue'](_0x14ef('0x30'),_0x35f873?_0x35f873[_0x14ef('0x25')](','):null);},'get':function(){return this[_0x14ef('0xc')]('nat')?this[_0x14ef('0xc')]('nat')[_0x14ef('0x26')](','):null;},'comment':_0x14ef('0x31')},'callgroup':{'type':Sequelize[_0x14ef('0x4')]},'namedcallgroup':{'type':Sequelize[_0x14ef('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x14ef('0x4')]},'language':{'type':Sequelize[_0x14ef('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x14ef('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x14ef('0x32')},'allow':{'type':Sequelize[_0x14ef('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ad29b){this['setDataValue'](_0x14ef('0x33'),_0x3ad29b?_0x3ad29b[_0x14ef('0x25')](';'):_0x14ef('0x34'));},'get':function(){return this[_0x14ef('0xc')]('allow')?this[_0x14ef('0xc')](_0x14ef('0x33'))['split'](';'):null;},'comment':_0x14ef('0x35')},'autoframing':{'type':Sequelize[_0x14ef('0x1c')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![],'set':function(_0x975a53){this[_0x14ef('0x6')](_0x14ef('0x36'),_0x975a53?_0x975a53[_0x14ef('0x25')](','):null);},'get':function(){return this[_0x14ef('0xc')](_0x14ef('0x36'))?this[_0x14ef('0xc')](_0x14ef('0x36'))['split'](','):null;},'comment':_0x14ef('0x37')},'trustrpid':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x14ef('0x1c')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x14ef('0x38'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x14ef('0x1c')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![],'defaultValue':_0x14ef('0x38')},'busylevel':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x14ef('0x38'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x14ef('0x38'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x14ef('0x1c')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no',_0x14ef('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x14ef('0x38'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x14ef('0x3a'),_0x14ef('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x3c'),_0x14ef('0x3d')),'allowNull':!![],'defaultValue':_0x14ef('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![],'defaultValue':_0x14ef('0x38')},'keepalive':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x14ef('0x38'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no',_0x14ef('0x3e'),_0x14ef('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x14ef('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x14ef('0x1c')]('active',_0x14ef('0x40'),_0x14ef('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x14ef('0x38'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x14ef('0x1c')]('yes','no','nonat',_0x14ef('0x2d'),_0x14ef('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x14ef('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x14ef('0x16')]},'passwordResetAt':{'type':Sequelize[_0x14ef('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x14ef('0x43')]},'showWebBar':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0,'set':function(_0x5ee7c7){this[_0x14ef('0x6')]('showWebBar',_0x5ee7c7);var _0x587c65=this[_0x14ef('0x44')]({'plain':!![]});switch(_0x5ee7c7){case 0x0:case 0x1:var _0x434a44=_0x587c65[_0x14ef('0x24')]?_[_0x14ef('0x45')](_0x587c65[_0x14ef('0x24')])?_0x587c65[_0x14ef('0x24')][_0x14ef('0x25')]():_0x587c65['transport']:_0x14ef('0x46');if(_0x434a44===_0x14ef('0x47')){_0x434a44=_0x14ef('0x46');}this['setDataValue']('transport',_0x434a44);this['setDataValue']('encryption','no');this[_0x14ef('0x6')](_0x14ef('0x48'),null);this[_0x14ef('0x6')](_0x14ef('0x49'),null);this[_0x14ef('0x6')](_0x14ef('0x4a'),null);this[_0x14ef('0x6')]('dtlsenable',null);this[_0x14ef('0x6')](_0x14ef('0x4b'),null);this['setDataValue'](_0x14ef('0x4c'),null);this[_0x14ef('0x6')](_0x14ef('0x4d'),null);this[_0x14ef('0x6')](_0x14ef('0x4e'),null);this[_0x14ef('0x6')](_0x14ef('0x4f'),'no');break;case 0x2:this['setDataValue'](_0x14ef('0x24'),_0x14ef('0x47'));this['setDataValue'](_0x14ef('0x50'),'yes');this[_0x14ef('0x6')](_0x14ef('0x48'),_0x14ef('0x38'));this[_0x14ef('0x6')](_0x14ef('0x49'),'yes');this[_0x14ef('0x6')]('icesupport',_0x14ef('0x38'));this[_0x14ef('0x6')](_0x14ef('0x51'),'yes');this['setDataValue'](_0x14ef('0x4b'),'no');this[_0x14ef('0x6')](_0x14ef('0x4c'),_0x14ef('0x41'));this[_0x14ef('0x6')](_0x14ef('0x4d'),_0x587c65[_0x14ef('0x4d')]||_0x14ef('0x52'));this[_0x14ef('0x6')](_0x14ef('0x4e'),_0x587c65[_0x14ef('0x4e')]||'/etc/pki/tls/private/motion.key');this[_0x14ef('0x6')](_0x14ef('0x4f'),_0x14ef('0x38'));break;default:}}},'permissions':{'type':Sequelize[_0x14ef('0x43')],'set':function(_0x675b04){this[_0x14ef('0x6')](_0x14ef('0x53'),_0x675b04?_0x675b04[_0x14ef('0x25')](','):[]);},'get':function(){return this[_0x14ef('0xc')]('permissions')?_[_0x14ef('0x54')](this[_0x14ef('0xc')]('permissions')['split'](','),function(_0x219737){return parseInt(_0x219737,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x14ef('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x14ef('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x14ef('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x14ef('0x1c')](_0x14ef('0x38'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x14ef('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x14ef('0x55')],'get':function(){return this[_0x14ef('0xc')](_0x14ef('0x56'))?this[_0x14ef('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x14ef('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x14ef('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![],'set':function(_0x4b6511){if(typeof _0x4b6511===_0x14ef('0x57')){var _0x11773e=_0x4b6511==='1'?!![]:_0x4b6511==='0'?![]:_0x4b6511==='true'?!![]:_0x4b6511===_0x14ef('0x58')?![]:![];this[_0x14ef('0x6')](_0x14ef('0x59'),_0x11773e);}else{this[_0x14ef('0x6')](_0x14ef('0x59'),_0x4b6511);}}},'blocked':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![],'set':function(_0x108670){this[_0x14ef('0x6')](_0x14ef('0x5a'),_0x108670);if(_0x108670===!![]){this['setDataValue'](_0x14ef('0x5b'),moment());this[_0x14ef('0x6')](_0x14ef('0x5c'),0x0);}else{this[_0x14ef('0x6')](_0x14ef('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x14ef('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x14ef('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x14ef('0x11')](0x5)[_0x14ef('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x14ef('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x0cd6=['The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','toLowerCase','admin','user','telephone','INTEGER','accountcode','BOOLEAN','DATE','dynamic','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','info','shortinfo','inband','auto','rfc2833','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','wss','dtlsenable','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','name','setDataValue','defaultuser'];(function(_0x5449df,_0x3fb383){var _0x3e3611=function(_0x35a350){while(--_0x35a350){_0x5449df['push'](_0x5449df['shift']());}};_0x3e3611(++_0x3fb383);}(_0x0cd6,0x113));var _0x60cd=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x0cd6[_0x188a93];return _0x23b40d;};'use strict';var Sequelize=require(_0x60cd('0x0'));var moment=require(_0x60cd('0x1'));var util=require('util');var _=require(_0x60cd('0x2'));module[_0x60cd('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x60cd('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2f22ea){this['setDataValue']('name',_0x2f22ea);this[_0x60cd('0x5')](_0x60cd('0x6'),_0x2f22ea);},'comment':_0x60cd('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x381044){this['setDataValue'](_0x60cd('0x8'),_0x381044);this[_0x60cd('0x5')](_0x60cd('0x9'),util[_0x60cd('0xa')](_0x60cd('0xb'),_0x381044,this[_0x60cd('0xc')](_0x60cd('0xd'))));}},'alias':{'type':Sequelize[_0x60cd('0xe')]},'email':{'type':Sequelize[_0x60cd('0xe')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x23820b){if(_0x23820b){this[_0x60cd('0x5')]('email',_0x23820b[_0x60cd('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0x60cd('0x10'),_0x60cd('0x11'),'agent',_0x60cd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x60cd('0xe')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x60cd('0xe')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':![],'unique':_0x60cd('0xd'),'set':function(_0x53e158){this[_0x60cd('0x5')]('internal',_0x53e158);this[_0x60cd('0x5')](_0x60cd('0x14'),_0x53e158);this['setDataValue']('callerid',util[_0x60cd('0xa')](_0x60cd('0xb'),this[_0x60cd('0xc')]('fullname'),_0x53e158));}},'salt':{'type':Sequelize[_0x60cd('0xe')]},'phone':{'type':Sequelize[_0x60cd('0xe')]},'mobile':{'type':Sequelize[_0x60cd('0xe')]},'address':{'type':Sequelize[_0x60cd('0xe')]},'zipcode':{'type':Sequelize[_0x60cd('0xe')]},'userpic':{'type':Sequelize[_0x60cd('0xe')]},'city':{'type':Sequelize[_0x60cd('0xe')]},'country':{'type':Sequelize[_0x60cd('0xe')]},'online':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x60cd('0xe')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x60cd('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x60cd('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x60cd('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x60cd('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x60cd('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x60cd('0x17')},'ipaddr':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'port':{'type':Sequelize[_0x60cd('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x19'),_0x60cd('0x11'),'peer'),'allowNull':!![],'defaultValue':_0x60cd('0x19')},'context':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![],'defaultValue':_0x60cd('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0x60cd('0x1b'),'ALLOWED_PASSED_SCREEN',_0x60cd('0x1c'),_0x60cd('0x1d'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x60cd('0x1e'),_0x60cd('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'transport':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![],'defaultValue':_0x60cd('0x20'),'set':function(_0x3aed82){this[_0x60cd('0x5')]('transport',_0x3aed82?_0x3aed82[_0x60cd('0x21')](','):null);},'get':function(){return this[_0x60cd('0xc')](_0x60cd('0x22'))?this[_0x60cd('0xc')](_0x60cd('0x22'))[_0x60cd('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x60cd('0x24'),_0x60cd('0x25'),_0x60cd('0x26'),_0x60cd('0x27')),'allowNull':!![],'defaultValue':_0x60cd('0x28')},'directmedia':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no','nonat',_0x60cd('0x2a'),_0x60cd('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'nat':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![],'defaultValue':_0x60cd('0x2c'),'set':function(_0x4ff0db){this['setDataValue'](_0x60cd('0x2d'),_0x4ff0db?_0x4ff0db[_0x60cd('0x21')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x60cd('0xc')](_0x60cd('0x2d'))[_0x60cd('0x23')](','):null;},'comment':_0x60cd('0x2e')},'callgroup':{'type':Sequelize[_0x60cd('0xe')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x60cd('0xe')]},'namedpickupgroup':{'type':Sequelize[_0x60cd('0xe')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x60cd('0xe')],'allowNull':![],'defaultValue':_0x60cd('0x2f')},'allow':{'type':Sequelize[_0x60cd('0xe')],'allowNull':![],'defaultValue':_0x60cd('0x30'),'set':function(_0x6703e){this[_0x60cd('0x5')]('allow',_0x6703e?_0x6703e[_0x60cd('0x21')](';'):_0x60cd('0x30'));},'get':function(){return this[_0x60cd('0xc')](_0x60cd('0x31'))?this[_0x60cd('0xc')](_0x60cd('0x31'))[_0x60cd('0x23')](';'):null;},'comment':_0x60cd('0x32')},'autoframing':{'type':Sequelize[_0x60cd('0x18')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x594a84){this[_0x60cd('0x5')](_0x60cd('0x33'),_0x594a84?_0x594a84[_0x60cd('0x21')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x60cd('0x23')](','):null;},'comment':_0x60cd('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no',_0x60cd('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x60cd('0x18')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![],'defaultValue':_0x60cd('0x36')},'amaflags':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x60cd('0x18')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'template':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no',_0x60cd('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x38'),_0x60cd('0x39'),_0x60cd('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x3b'),_0x60cd('0x3c')),'allowNull':!![],'defaultValue':_0x60cd('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![],'defaultValue':_0x60cd('0x29')},'keepalive':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x60cd('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x60cd('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x60cd('0x18')]('yes','no',_0x60cd('0x3d'),_0x60cd('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x3f'),_0x60cd('0x40'),_0x60cd('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x60cd('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x60cd('0x18')](_0x60cd('0x29'),'no','nonat',_0x60cd('0x2a'),_0x60cd('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x60cd('0xe')]},'resetPasswordExpires':{'type':Sequelize[_0x60cd('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x60cd('0x43')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x873725){this[_0x60cd('0x5')](_0x60cd('0x44'),_0x873725);var _0x40cb17=this[_0x60cd('0x45')]({'plain':!![]});switch(_0x873725){case 0x0:case 0x1:var _0xd6457b=_0x40cb17[_0x60cd('0x22')]?_[_0x60cd('0x46')](_0x40cb17['transport'])?_0x40cb17[_0x60cd('0x22')][_0x60cd('0x21')]():_0x40cb17[_0x60cd('0x22')]:_0x60cd('0x20');if(_0xd6457b==='wss'){_0xd6457b=_0x60cd('0x20');}this[_0x60cd('0x5')]('transport',_0xd6457b);this['setDataValue'](_0x60cd('0x47'),'no');this[_0x60cd('0x5')](_0x60cd('0x48'),null);this[_0x60cd('0x5')](_0x60cd('0x49'),null);this[_0x60cd('0x5')](_0x60cd('0x4a'),null);this[_0x60cd('0x5')]('dtlsenable',null);this['setDataValue'](_0x60cd('0x4b'),null);this[_0x60cd('0x5')](_0x60cd('0x4c'),null);this[_0x60cd('0x5')](_0x60cd('0x4d'),null);this[_0x60cd('0x5')]('dtlsprivatekey',null);this[_0x60cd('0x5')](_0x60cd('0x4e'),'no');break;case 0x2:this[_0x60cd('0x5')](_0x60cd('0x22'),_0x60cd('0x4f'));this[_0x60cd('0x5')](_0x60cd('0x47'),_0x60cd('0x29'));this['setDataValue'](_0x60cd('0x48'),_0x60cd('0x29'));this[_0x60cd('0x5')](_0x60cd('0x49'),_0x60cd('0x29'));this[_0x60cd('0x5')](_0x60cd('0x4a'),_0x60cd('0x29'));this[_0x60cd('0x5')](_0x60cd('0x50'),_0x60cd('0x29'));this[_0x60cd('0x5')](_0x60cd('0x4b'),'no');this[_0x60cd('0x5')](_0x60cd('0x4c'),_0x60cd('0x41'));this[_0x60cd('0x5')](_0x60cd('0x4d'),_0x40cb17[_0x60cd('0x4d')]||_0x60cd('0x51'));this['setDataValue'](_0x60cd('0x52'),_0x40cb17['dtlsprivatekey']||_0x60cd('0x53'));this[_0x60cd('0x5')](_0x60cd('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x60cd('0x43')],'set':function(_0x2a0e2d){this['setDataValue'](_0x60cd('0x54'),_0x2a0e2d?_0x2a0e2d['join'](','):[]);},'get':function(){return this[_0x60cd('0xc')]('permissions')?_[_0x60cd('0x55')](this[_0x60cd('0xc')](_0x60cd('0x54'))[_0x60cd('0x23')](','),function(_0x5bcf84){return parseInt(_0x5bcf84,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x60cd('0xe')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x60cd('0xe')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x60cd('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x60cd('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x60cd('0x18')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x60cd('0x56')],'get':function(){return this['getDataValue'](_0x60cd('0x57'))?this[_0x60cd('0xc')](_0x60cd('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x60cd('0xe')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x60cd('0xe')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![],'set':function(_0x1730be){if(typeof _0x1730be==='string'){var _0x1a28d5=_0x1730be==='1'?!![]:_0x1730be==='0'?![]:_0x1730be===_0x60cd('0x58')?!![]:_0x1730be==='false'?![]:![];this[_0x60cd('0x5')](_0x60cd('0x59'),_0x1a28d5);}else{this[_0x60cd('0x5')](_0x60cd('0x59'),_0x1730be);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x178812){this[_0x60cd('0x5')](_0x60cd('0x5a'),_0x178812);if(_0x178812===!![]){this[_0x60cd('0x5')]('blockedAt',moment());this[_0x60cd('0x5')](_0x60cd('0x5b'),0x0);}else{this[_0x60cd('0x5')](_0x60cd('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0x60cd('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x60cd('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x60cd('0x13')](0x5)[_0x60cd('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x60cd('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index fd4b74d..6c06032 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 _0x9582=['unpause','PAUSE','manual','Pause','getTeams','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','addAgent','upsert','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getVoiceQueues','Voice','removeAgent','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','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','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','teams','queues','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unknown','unavailable','ringing','voiceStatus','busy','charAt','toUpperCase','slice','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','register','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','role','admin','Users','user','agent','telephone','filter','map','value','includes','find','UserProfileResource','stack','name','index','User','rawAttributes','fieldName','type','key','password','salt','getOptions','query','includeAll','include','attributes','push','rows','true','length','chat','dataValues','sms','mail','openchannel','whatsapp','all','catch','show','params','model','differenceBy','keys','filters','intersection','fields','options','fax','body','describe','addContacts','ids','internal','Setting','securePassword','validatePasswordPattern','max','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','isNil','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','110','104','106','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','Agents','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','VoiceQueue','findAll','voice','interface','format','SIP/%s','voicePause','UserVoiceQueueRt','removeQueues','channel','remove','isArray','Queue:remove','addAvatar','root','server/files/images/logos/default_profile.png','userpic','download','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','findOne','order','sort','pick','where','merge','CmList','List','Tags','tag','nolimit','Queue','Unknown\x20role','hasOwnProperty','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','bulkCreate','concat','LOGININPAUSE','isMiddleware','resolve','logout','pause','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9582,0x95));var _0x2958=function(_0x23e6e2,_0x400a9e){_0x23e6e2=_0x23e6e2-0x0;var _0x279c39=_0x9582[_0x23e6e2];return _0x279c39;};'use strict';var moment=require(_0x2958('0x0'));var BPromise=require(_0x2958('0x1'));var util=require(_0x2958('0x2'));var path=require(_0x2958('0x3'));var fs=require('fs');var _=require(_0x2958('0x4'));var squel=require(_0x2958('0x5'));var jayson=require('jayson/promise');var Redis=require(_0x2958('0x6'));var authService=require(_0x2958('0x7'));var qs=require(_0x2958('0x8'));var logger=require(_0x2958('0x9'))(_0x2958('0xa'));var utils=require(_0x2958('0xb'));var config=require(_0x2958('0xc'));var licenseUtil=require(_0x2958('0xd'));var db=require(_0x2958('0xe'))['db'];var socket=require(_0x2958('0xf'))(new Redis(config['redis']));require('./user.socket')[_0x2958('0x10')](socket);config['redis']=_[_0x2958('0x11')](config['redis'],{'host':_0x2958('0x12'),'port':0x18eb});var client=jayson['client'][_0x2958('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x29776c,_0x12f0b0,_0x117ff0,_0x11ec8d){return new BPromise(function(_0x4f980c,_0x4780a8){var _0x4255ee=_0x11ec8d||client;return _0x4255ee[_0x2958('0x14')](_0x29776c,_0x117ff0)[_0x2958('0x15')](function(_0x47067d){logger[_0x2958('0x16')](_0x2958('0x17'),_0x12f0b0,_0x2958('0x18'));logger['debug'](_0x2958('0x19'),_0x12f0b0,_0x2958('0x18'),JSON['stringify'](_0x47067d));if(_0x47067d['error']){if(_0x47067d[_0x2958('0x1a')][_0x2958('0x1b')]===0x1f4){logger['error'](_0x2958('0x17'),_0x12f0b0,_0x47067d['error']['message']);return _0x4780a8(_0x47067d[_0x2958('0x1a')][_0x2958('0x1c')]);}logger['error']('User,\x20%s,\x20%s',_0x12f0b0,_0x47067d[_0x2958('0x1a')][_0x2958('0x1c')]);return _0x4f980c(_0x47067d[_0x2958('0x1a')][_0x2958('0x1c')]);}else{logger[_0x2958('0x16')]('User,\x20%s,\x20%s',_0x12f0b0,_0x2958('0x18'));_0x4f980c(_0x47067d[_0x2958('0x1d')][_0x2958('0x1c')]);}})['catch'](function(_0x1e77eb){logger['error'](_0x2958('0x17'),_0x12f0b0,_0x1e77eb);_0x4780a8(_0x1e77eb);});});}function respondWithStatusCode(_0x52ea2f,_0x5eaf36){_0x5eaf36=_0x5eaf36||0xcc;return function(_0x431b41){if(_0x431b41){return _0x52ea2f[_0x2958('0x1e')](_0x5eaf36);}return _0x52ea2f[_0x2958('0x1f')](_0x5eaf36)[_0x2958('0x20')]();};}function respondWithResult(_0x2202f8,_0x412e42){_0x412e42=_0x412e42||0xc8;return function(_0x3f8641){if(_0x3f8641){return _0x2202f8[_0x2958('0x1f')](_0x412e42)[_0x2958('0x21')](_0x3f8641);}};}function respondWithFilteredResult(_0x2aa514,_0xaf5547){return function(_0xd58ae1){if(_0xd58ae1){var _0x119242=typeof _0xaf5547[_0x2958('0x22')]===_0x2958('0x23')&&typeof _0xaf5547['limit']==='undefined';var _0x3c1155=_0xd58ae1[_0x2958('0x24')];var _0x28c1f5=_0x119242?0x0:_0xaf5547[_0x2958('0x22')];var _0x52bd32=_0x119242?_0xd58ae1[_0x2958('0x24')]:_0xaf5547['offset']+_0xaf5547[_0x2958('0x25')];var _0x40adce;if(_0x52bd32>=_0x3c1155){_0x52bd32=_0x3c1155;_0x40adce=0xc8;}else{_0x40adce=0xce;}_0x2aa514[_0x2958('0x1f')](_0x40adce);return _0x2aa514[_0x2958('0x26')](_0x2958('0x27'),_0x28c1f5+'-'+_0x52bd32+'/'+_0x3c1155)[_0x2958('0x21')](_0xd58ae1);}return null;};}function saveUpdates(_0x153958){return function(_0x5d1dfc){if(_0x5d1dfc){return _0x5d1dfc[_0x2958('0x28')](_0x153958)['then'](function(_0x48650d){return _0x48650d;});}return null;};}function removeEntity(_0x28ee09){return function(_0x15bab3){if(_0x15bab3){return _0x15bab3[_0x2958('0x29')]()[_0x2958('0x15')](function(){var _0x584179=_0x15bab3[_0x2958('0x2a')]({'plain':!![]});if(_0x584179[_0x2958('0x2b')]===_0x2958('0x2c'))return;var _0x4d6348=[{'name':_0x2958('0x2d'),'value':_0x2958('0x2e'),'ignore':!![]},{'name':'Agents','value':_0x2958('0x2f'),'ignore':![]},{'name':'Telephones','value':_0x2958('0x30'),'ignore':![]}];var _0x56d9fd=_(_0x4d6348)[_0x2958('0x31')]('ignore')[_0x2958('0x32')](_0x2958('0x33'))[_0x2958('0x33')]();if(_[_0x2958('0x34')](_0x56d9fd,_0x584179[_0x2958('0x2b')])){return;}var _0x3a124a=_[_0x2958('0x35')](_0x4d6348,[_0x2958('0x33'),_0x584179[_0x2958('0x2b')]])['name'];return db[_0x2958('0x36')]['destroy']({'where':{'type':_0x3a124a,'resourceId':_0x584179['id']}})[_0x2958('0x15')](function(){return _0x15bab3;});})['then'](function(){_0x28ee09[_0x2958('0x1f')](0xcc)[_0x2958('0x20')]();});}};}function handleEntityNotFound(_0x35df90){return function(_0x36088c){if(!_0x36088c){_0x35df90[_0x2958('0x1e')](0x194);}return _0x36088c;};}function handleError(_0x24aca5,_0x3e6873){_0x3e6873=_0x3e6873||0x1f4;return function(_0x468b8e){logger[_0x2958('0x1a')](_0x468b8e[_0x2958('0x37')]);if(_0x468b8e[_0x2958('0x38')]){delete _0x468b8e[_0x2958('0x38')];}_0x24aca5[_0x2958('0x1f')](_0x3e6873)['send'](_0x468b8e);};}exports[_0x2958('0x39')]=function(_0xcdaa70,_0x281817){var _0x27edd6={},_0x4e0db4={'count':0x0,'rows':[]};var _0x2f9a28=_(db[_0x2958('0x3a')][_0x2958('0x3b')])[_0x2958('0x32')](function(_0x337bcc){return{'name':_0x337bcc[_0x2958('0x3c')],'type':_0x337bcc[_0x2958('0x3d')][_0x2958('0x3e')]};})[_0x2958('0x31')](function(_0x3ef099){return!_[_0x2958('0x34')]([_0x2958('0x3f'),_0x2958('0x40')],_0x3ef099['name']);})[_0x2958('0x33')]();_0x27edd6=qs[_0x2958('0x41')](_0x2f9a28,_0xcdaa70);var _0x5bdd8e={'where':_0x27edd6['where']};return db[_0x2958('0x3a')][_0x2958('0x24')](_0x5bdd8e)[_0x2958('0x15')](function(_0x27068b){_0x4e0db4[_0x2958('0x24')]=_0x27068b;if(_0xcdaa70[_0x2958('0x42')][_0x2958('0x43')]){_0x27edd6[_0x2958('0x44')]=[{'all':!![]}];}if(!_[_0x2958('0x34')](_0x27edd6[_0x2958('0x45')],'id')){_0x27edd6[_0x2958('0x45')][_0x2958('0x46')]('id');}return db[_0x2958('0x3a')]['findAll'](_0x27edd6);})[_0x2958('0x15')](function(_0x112256){_0x4e0db4[_0x2958('0x47')]=_0x112256;if(_0xcdaa70[_0x2958('0x42')]['openTabs']===_0x2958('0x48')){var _0x4af190=[];for(var _0x53ac56=0x0;_0x53ac56<_0x4e0db4[_0x2958('0x47')][_0x2958('0x49')];_0x53ac56++){_0x4af190[_0x2958('0x46')](get_open_tabs(_0x2958('0x4a'),_0x4e0db4[_0x2958('0x47')][_0x53ac56][_0x2958('0x4b')]));_0x4af190['push'](get_open_tabs(_0x2958('0x4c'),_0x4e0db4['rows'][_0x53ac56]['dataValues']));_0x4af190[_0x2958('0x46')](get_open_tabs('fax',_0x4e0db4[_0x2958('0x47')][_0x53ac56][_0x2958('0x4b')]));_0x4af190[_0x2958('0x46')](get_open_tabs(_0x2958('0x4d'),_0x4e0db4[_0x2958('0x47')][_0x53ac56][_0x2958('0x4b')]));_0x4af190[_0x2958('0x46')](get_open_tabs(_0x2958('0x4e'),_0x4e0db4['rows'][_0x53ac56][_0x2958('0x4b')]));_0x4af190[_0x2958('0x46')](get_open_tabs(_0x2958('0x4f'),_0x4e0db4[_0x2958('0x47')][_0x53ac56]['dataValues']));}return BPromise[_0x2958('0x50')](_0x4af190)[_0x2958('0x15')](function(_0x4a51b1){return _0x4e0db4;});}else{return _0x4e0db4;}})[_0x2958('0x15')](respondWithFilteredResult(_0x281817,_0x27edd6))[_0x2958('0x51')](handleError(_0x281817,null));};exports[_0x2958('0x52')]=function(_0x3c5431,_0x171a21){var _0x16a0a8={'raw':![],'where':{'id':_0x3c5431[_0x2958('0x53')]['id']}},_0x519fab={};_0x519fab[_0x2958('0x54')]=_[_0x2958('0x55')](_[_0x2958('0x56')](db[_0x2958('0x3a')][_0x2958('0x3b')]),[_0x2958('0x3f'),_0x2958('0x40')]);_0x519fab[_0x2958('0x42')]=_[_0x2958('0x56')](_0x3c5431[_0x2958('0x42')]);_0x519fab[_0x2958('0x57')]=_[_0x2958('0x58')](_0x519fab[_0x2958('0x54')],_0x519fab[_0x2958('0x42')]);_0x16a0a8[_0x2958('0x45')]=_[_0x2958('0x58')](_0x519fab['model'],qs[_0x2958('0x59')](_0x3c5431['query'][_0x2958('0x59')]));_0x16a0a8[_0x2958('0x45')]=_0x16a0a8[_0x2958('0x45')]['length']?_0x16a0a8['attributes']:_0x519fab[_0x2958('0x54')];if(_0x3c5431[_0x2958('0x42')][_0x2958('0x43')]){_0x16a0a8['include']=[{'all':!![]}];}_0x16a0a8=_['merge']({},_0x16a0a8,_0x3c5431[_0x2958('0x5a')]);if(!_[_0x2958('0x34')](_0x16a0a8[_0x2958('0x45')],'id')){_0x16a0a8[_0x2958('0x45')][_0x2958('0x46')]('id');}return db[_0x2958('0x3a')][_0x2958('0x35')](_0x16a0a8)[_0x2958('0x15')](handleEntityNotFound(_0x171a21,null))[_0x2958('0x15')](function(_0x4df36c){var _0x30c739=[];values=_0x4df36c;if(_0x3c5431[_0x2958('0x42')]['openTabs']===_0x2958('0x48')){_0x30c739[_0x2958('0x46')](get_open_tabs(_0x2958('0x4a'),_0x4df36c[_0x2958('0x4b')]));_0x30c739[_0x2958('0x46')](get_open_tabs(_0x2958('0x4c'),_0x4df36c['dataValues']));_0x30c739[_0x2958('0x46')](get_open_tabs(_0x2958('0x4e'),_0x4df36c[_0x2958('0x4b')]));_0x30c739['push'](get_open_tabs('whatsapp',_0x4df36c[_0x2958('0x4b')]));_0x30c739['push'](get_open_tabs(_0x2958('0x5b'),_0x4df36c['dataValues']));_0x30c739[_0x2958('0x46')](get_open_tabs(_0x2958('0x4d'),_0x4df36c[_0x2958('0x4b')]));return BPromise[_0x2958('0x50')](_0x30c739);}else{return values;}})[_0x2958('0x15')](function(_0x55cc49){return values;})['then'](respondWithResult(_0x171a21,null))[_0x2958('0x51')](handleError(_0x171a21,null));};exports[_0x2958('0x28')]=function(_0xfa171d,_0x51bf4c){if(_0xfa171d['body']['id']){delete _0xfa171d[_0x2958('0x5c')]['id'];}delete _0xfa171d[_0x2958('0x5c')][_0x2958('0x2b')];return db[_0x2958('0x3a')][_0x2958('0x35')]({'where':{'id':_0xfa171d[_0x2958('0x53')]['id']}})[_0x2958('0x15')](handleEntityNotFound(_0x51bf4c,null))[_0x2958('0x15')](saveUpdates(_0xfa171d[_0x2958('0x5c')],null))[_0x2958('0x15')](respondWithResult(_0x51bf4c,null))[_0x2958('0x51')](handleError(_0x51bf4c,null));};exports[_0x2958('0x5d')]=function(_0x3cc345,_0x49d190){return db[_0x2958('0x3a')][_0x2958('0x5d')]()[_0x2958('0x15')](respondWithResult(_0x49d190,null))[_0x2958('0x51')](handleError(_0x49d190,null));};exports[_0x2958('0x5e')]=function(_0xa848ba,_0x143b2a){return db[_0x2958('0x3a')][_0x2958('0x35')]({'where':{'id':_0xa848ba['params']['id']}})[_0x2958('0x15')](handleEntityNotFound(_0x143b2a,null))['then'](function(_0x196901){if(_0x196901){return _0x196901[_0x2958('0x5e')](_0xa848ba[_0x2958('0x5c')]['ids'],_['omit'](_0xa848ba['body'],[_0x2958('0x5f'),'id'])||{});}})[_0x2958('0x15')](respondWithResult(_0x143b2a,null))[_0x2958('0x51')](handleError(_0x143b2a,null));};function validateUser(_0x1bba2c){return new BPromise(function(_0x1b778e,_0xb2fe28){if(_0x1bba2c[_0x2958('0x60')])return _0x1b778e(_0x1bba2c);return db[_0x2958('0x61')]['findById'](0x1)['then'](function(_0x42717b){if(_0x42717b[_0x2958('0x62')])authService[_0x2958('0x63')](_0x1bba2c[_0x2958('0x3f')]);db['User'][_0x2958('0x64')](_0x2958('0x60'))[_0x2958('0x15')](function(_0x20ca93){if(_['isNil'](_0x20ca93)){_0x1bba2c['internal']=_0x42717b['min_internal']||0x1;return;}if(_['isNil'](_0x42717b[_0x2958('0x65')])||_0x42717b[_0x2958('0x65')]===_0x20ca93){_0x1bba2c['internal']=_0x20ca93+0x1;return;}if(_0x42717b[_0x2958('0x65')]>_0x20ca93){_0x1bba2c[_0x2958('0x60')]=_0x42717b[_0x2958('0x65')];return;}return db[_0x2958('0x66')][_0x2958('0x42')](_0x2958('0x67'),{'type':db['sequelize'][_0x2958('0x68')][_0x2958('0x69')]})[_0x2958('0x15')](function(_0x48160b){if(_0x48160b&&_0x48160b[_0x2958('0x49')]){for(var _0x566123=0x0,_0x546721=_0x48160b['length'];_0x566123<_0x546721&&_['isNil'](_0x1bba2c[_0x2958('0x60')]);_0x566123++){if(_0x42717b['min_internal']<=_0x48160b[_0x566123][_0x2958('0x6a')]){_0x1bba2c[_0x2958('0x60')]=_0x48160b[_0x566123][_0x2958('0x6a')];}else if(_0x42717b[_0x2958('0x65')]>_0x48160b[_0x566123][_0x2958('0x6a')]&&_0x42717b[_0x2958('0x65')]<=_0x48160b[_0x566123]['to']){_0x1bba2c['internal']=_0x42717b[_0x2958('0x65')];}}}if(_[_0x2958('0x6b')](_0x1bba2c[_0x2958('0x60')])){_0x1bba2c[_0x2958('0x60')]=_0x20ca93+0x1;}return _0x1b778e(_0x1bba2c);});});})[_0x2958('0x51')](function(_0x294acf){_0xb2fe28(_0x294acf);});});}function updateUser(_0x39c38d){return new BPromise(function(_0x3674b3,_0x2d8418){try{if(_0x39c38d[_0x2958('0x6c')]){_0x39c38d[_0x2958('0x6d')]=_0x39c38d[_0x2958('0x60')];_0x39c38d[_0x2958('0x6e')]={'mailbox':_0x39c38d[_0x2958('0x60')],'password':_0x39c38d[_0x2958('0x3f')],'fullname':_0x39c38d[_0x2958('0x6f')],'email':_0x39c38d[_0x2958('0x70')]};}if(_0x39c38d[_0x2958('0x2b')]===_0x2958('0x2f')){if(!_0x39c38d[_0x2958('0x71')])_0x39c38d[_0x2958('0x71')]=['101',_0x2958('0x72'),_0x2958('0x73'),_0x2958('0x74'),_0x2958('0x75'),_0x2958('0x76'),'105',_0x2958('0x77'),_0x2958('0x78'),_0x2958('0x79'),_0x2958('0x7a'),_0x2958('0x7b'),_0x2958('0x7c'),_0x2958('0x7d'),_0x2958('0x7e')];}_0x3674b3(_0x39c38d);}catch(_0x16c8f2){_0x2d8418(_0x16c8f2);}});}exports[_0x2958('0x7f')]=function(_0x37efd7,_0x461344){if(_0x37efd7[_0x2958('0x2e')][_0x2958('0x2b')]===_0x2958('0x2f'))throw new Error(_0x2958('0x80'));if(_0x37efd7[_0x2958('0x5c')][_0x2958('0x2b')]===_0x2958('0x2e')&&_0x37efd7[_0x2958('0x2e')][_0x2958('0x2b')]!==_0x2958('0x2c')){throw new Error(_0x2958('0x81'));}if(_0x37efd7[_0x2958('0x5c')]['role']===_0x2958('0x2c')&&_0x37efd7[_0x2958('0x2e')][_0x2958('0x2b')]!==_0x2958('0x2c')){throw new Error(_0x2958('0x82'));}return licenseUtil[_0x2958('0x83')]([_0x37efd7[_0x2958('0x5c')]])[_0x2958('0x15')](function(){return validateUser(_0x37efd7[_0x2958('0x5c')]);})[_0x2958('0x15')](function(_0x19bd4f){return updateUser(_0x19bd4f)[_0x2958('0x15')](function(_0x4e4ce9){if(_0x4e4ce9[_0x2958('0x2b')]===_0x2958('0x2c')){_0x4e4ce9[_0x2958('0x84')]=_0x37efd7[_0x2958('0x2e')][_0x2958('0x84')];delete _0x4e4ce9[_0x2958('0x85')];}return _0x4e4ce9;});})['then'](function(_0x431bd4){return db[_0x2958('0x3a')][_0x2958('0x7f')](_0x431bd4,{'include':[{'model':db[_0x2958('0x6e')],'as':_0x2958('0x6e')}]});})['then'](function(_0x158c43){if(_0x37efd7[_0x2958('0x5c')][_0x2958('0x2b')]===_0x2958('0x2e'))return _0x158c43;if(_0x37efd7[_0x2958('0x2e')][_0x2958('0x2b')]!==_0x2958('0x2e'))return _0x158c43;return db[_0x2958('0x86')][_0x2958('0x35')]({'where':{'name':_0x158c43[_0x2958('0x2b')]===_0x2958('0x2f')?'Agents':_0x2958('0x87'),'userProfileId':_0x37efd7[_0x2958('0x2e')]['userProfileId']},'raw':!![]})['then'](function(_0x37586c){if(!_0x37586c||_0x37586c[_0x2958('0x88')]!=0x0)return _0x158c43;return db['UserProfileResource'][_0x2958('0x7f')]({'name':_0x158c43[_0x2958('0x38')],'resourceId':_0x158c43['id'],'type':_0x37586c[_0x2958('0x38')],'sectionId':_0x37586c['id']},{})['then'](function(){return _0x158c43;});})[_0x2958('0x51')](function(_0x383505){logger[_0x2958('0x1a')](_0x2958('0x89'),_0x383505);throw _0x383505;});})[_0x2958('0x15')](respondWithResult(_0x461344,0xc9))[_0x2958('0x51')](handleError(_0x461344,null));};exports['bulkCreate']=function(_0x449e68,_0x675842){var _0x65e58b=_0x449e68[_0x2958('0x5c')];var _0x5bb046=[];if(_0x449e68['user']['role']===_0x2958('0x2f'))throw new Error('Unauthorized');if(_[_0x2958('0x8a')](_0x65e58b,['role','user'])&&_0x449e68[_0x2958('0x2e')][_0x2958('0x2b')]!=='admin'){throw new Error(_0x2958('0x81'));}if(_[_0x2958('0x8a')](_0x65e58b,[_0x2958('0x2b'),_0x2958('0x2c')])&&_0x449e68[_0x2958('0x2e')]['role']!==_0x2958('0x2c')){throw new Error(_0x2958('0x8b'));}return licenseUtil[_0x2958('0x83')](_0x65e58b)[_0x2958('0x15')](function(){return validateUser(_0x65e58b[0x0]);})[_0x2958('0x15')](function(){for(var _0x17b2bf=0x1;_0x17b2bf<_0x65e58b[_0x2958('0x49')];_0x17b2bf++){var _0x1142e3=_0x65e58b[_0x17b2bf-0x1][_0x2958('0x60')];if(!_0x65e58b[_0x17b2bf]['internal'])_0x65e58b[_0x17b2bf][_0x2958('0x60')]=_0x1142e3+0x1;_0x5bb046[_0x2958('0x46')](validateUser(_0x65e58b[_0x17b2bf]));}return BPromise[_0x2958('0x50')](_0x5bb046);})['then'](function(){_0x5bb046=[];for(var _0x24d1bc=0x0;_0x24d1bc<_0x65e58b[_0x2958('0x49')];_0x24d1bc++){_0x5bb046[_0x2958('0x46')](updateUser(_0x65e58b[_0x24d1bc]));}return BPromise[_0x2958('0x50')](_0x5bb046);})[_0x2958('0x15')](function(){return BPromise[_0x2958('0x8c')](_0x65e58b,function(_0xb41929){return db[_0x2958('0x3a')][_0x2958('0x7f')](_0xb41929,{'include':[{'model':db[_0x2958('0x6e')],'as':'VoiceMail'}]})[_0x2958('0x15')](function(_0x5d9ad0){_0xb41929['id']=_0x5d9ad0['id'];return _0xb41929;});});})['then'](function(_0x2f279a){if(_0x449e68[_0x2958('0x5c')]['role']==='user')return _0x2f279a;if(_0x449e68['user'][_0x2958('0x2b')]!==_0x2958('0x2e'))return _0x2f279a;var _0x486650=_[_0x2958('0x8a')](_0x2f279a,function(_0x3f31a3){return _0x3f31a3[_0x2958('0x2b')]===_0x2958('0x2f')||_0x3f31a3[_0x2958('0x2b')]===_0x2958('0x30');});if(!_0x486650)return _0x2f279a;return db[_0x2958('0x86')]['findAll']({'where':{'name':{'$or':[_0x2958('0x8d'),_0x2958('0x87')]},'userProfileId':_0x449e68[_0x2958('0x2e')][_0x2958('0x85')]},'raw':!![]})[_0x2958('0x15')](function(_0x1e7057){if(_[_0x2958('0x8e')](_0x1e7057)||!_[_0x2958('0x8a')](_0x1e7057,[_0x2958('0x88'),0x0]))return _0x2f279a;_0x5bb046=[];var _0x2c4239=_(_0x1e7057)['map'](function(_0x5a4bc5){if(_0x5a4bc5[_0x2958('0x88')]===0x1)return;return _0x5a4bc5['name']===_0x2958('0x8d')?_0x2958('0x2f'):_0x2958('0x30');})[_0x2958('0x8f')]()[_0x2958('0x33')]();for(var _0x2c8502=0x0;_0x2c8502<_0x2f279a[_0x2958('0x49')];_0x2c8502++){if(!_['includes'](_0x2c4239,_0x2f279a[_0x2c8502][_0x2958('0x2b')]))return;var _0x11479d=_0x2f279a[_0x2c8502][_0x2958('0x2b')]===_0x2958('0x2f')?_0x2958('0x8d'):'Telephones';_0x5bb046[_0x2958('0x46')](db[_0x2958('0x36')][_0x2958('0x7f')]({'name':_0x2f279a[_0x2c8502]['name'],'resourceId':_0x2f279a[_0x2c8502]['id'],'type':_0x11479d,'sectionId':_[_0x2958('0x35')](_0x1e7057,[_0x2958('0x38'),_0x11479d])['id']},{}));}return BPromise[_0x2958('0x50')](_0x5bb046);});})[_0x2958('0x15')](respondWithResult(_0x675842,0xc9))[_0x2958('0x51')](handleError(_0x675842,null));};exports[_0x2958('0x90')]=function(_0x511dd9,_0x5f4622){if(_0x511dd9[_0x2958('0x5c')]['id']){delete _0x511dd9[_0x2958('0x5c')]['id'];}return db[_0x2958('0x3a')]['find']({'where':{'id':_0x511dd9[_0x2958('0x53')]['id']}})['then'](function(_0x346a12){if(!_0x346a12)return null;if(_0x346a12['id']===_0x511dd9[_0x2958('0x2e')]['id']){if(!_0x511dd9[_0x2958('0x5c')]['oldPassword']||!_0x511dd9[_0x2958('0x5c')][_0x2958('0x91')]){throw new db[(_0x2958('0x92'))][(_0x2958('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x346a12['authenticate'](_0x511dd9[_0x2958('0x5c')][_0x2958('0x94')])){throw new db[(_0x2958('0x92'))][(_0x2958('0x93'))](_0x2958('0x95'));}if(_0x511dd9['body'][_0x2958('0x94')]===_0x511dd9[_0x2958('0x5c')][_0x2958('0x91')]){throw new db[(_0x2958('0x92'))][(_0x2958('0x93'))](_0x2958('0x96'));}}else if(_0x511dd9[_0x2958('0x2e')][_0x2958('0x2b')]==='admin'){if(!_0x511dd9['body']['newPassword']){throw new db[(_0x2958('0x92'))][(_0x2958('0x93'))](_0x2958('0x97'));}}else if(_0x511dd9['user'][_0x2958('0x2b')]===_0x2958('0x2e')){if(!_0x511dd9[_0x2958('0x5c')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x2958('0x97'));}if(_0x346a12[_0x2958('0x2b')]!==_0x2958('0x2f')){throw new db[(_0x2958('0x92'))][(_0x2958('0x93'))](_0x2958('0x80'));}}else{throw new db['Sequelize'][(_0x2958('0x93'))](_0x2958('0x80'));}return _0x346a12;})[_0x2958('0x15')](handleEntityNotFound(_0x5f4622,null))[_0x2958('0x15')](function(_0x397a06){return db[_0x2958('0x61')]['findOne']({'attributes':['id','securePassword',_0x2958('0x98'),_0x2958('0x99')]})[_0x2958('0x15')](function(_0x147682){if(_0x147682[_0x2958('0x62')])authService[_0x2958('0x63')](_0x511dd9[_0x2958('0x5c')][_0x2958('0x91')]);if(!_0x147682['enforcePasswordHistory']||!_0x397a06[_0x2958('0x9a')])return _0x397a06;authService[_0x2958('0x9b')](_0x511dd9[_0x2958('0x5c')][_0x2958('0x91')],_0x397a06[_0x2958('0x9a')],_0x147682[_0x2958('0x99')]);return _0x397a06;})[_0x2958('0x15')](saveUpdates({'password':_0x511dd9[_0x2958('0x5c')]['newPassword'],'passwordResetAt':_0x511dd9[_0x2958('0x2e')]['id']==_0x511dd9[_0x2958('0x53')]['id']?moment():null,'previousPasswords':authService[_0x2958('0x9c')](_0x511dd9[_0x2958('0x5c')][_0x2958('0x91')],_0x397a06[_0x2958('0x9a')])},null));})[_0x2958('0x15')](respondWithResult(_0x5f4622,null))['catch'](handleError(_0x5f4622,null));};exports[_0x2958('0x9d')]=function(_0x1d0d0d,_0xc3b770){var _0x10ed18=_0x1d0d0d[_0x2958('0x5c')]['channel'];return db['User']['find']({'where':{'id':_0x1d0d0d[_0x2958('0x53')]['id']},'attributes':['id','name',_0x2958('0x2b'),_0x2958('0x9e'),_0x2958('0x9f'),'voicePause','interface']})[_0x2958('0x15')](handleEntityNotFound(_0xc3b770,null))[_0x2958('0x15')](function(_0x3fbe11){if(_0x3fbe11){if(!utils[_0x2958('0xa0')](_0x10ed18)){throw new db[(_0x2958('0x92'))][(_0x2958('0x93'))](_0x2958('0xa1'));}return _0x3fbe11[_0x2958('0xa2')+_[_0x2958('0xa3')](_0x10ed18[_0x2958('0xa4')]())+_0x2958('0xa5')](_0x1d0d0d[_0x2958('0x5c')][_0x2958('0x5f')],{'penalty':_0x1d0d0d[_0x2958('0x5c')][_0x2958('0xa6')]||0x0})[_0x2958('0xa7')](function(_0x18fecd){for(var _0x2c5c06=0x0;_0x2c5c06<_0x1d0d0d[_0x2958('0x5c')][_0x2958('0x5f')][_0x2958('0x49')];_0x2c5c06+=0x1){var _0x362837={'UserId':Number(_0x1d0d0d['params']['id'])};_0x362837[_[_0x2958('0xa3')](_0x10ed18[_0x2958('0xa4')]())+_0x2958('0xa8')]=Number(_0x1d0d0d[_0x2958('0x5c')]['ids'][_0x2c5c06]);socket[_0x2958('0xa9')](_0x2958('0x2e')+_['capitalize'](_0x10ed18['toLowerCase']())+'Queue:save',_0x362837);}return _0x18fecd;})[_0x2958('0x15')](function(){if(_0x10ed18==='voice'){return db[_0x2958('0xaa')][_0x2958('0xab')]({'where':{'id':_0x1d0d0d[_0x2958('0x5c')]['ids']||[]},'raw':!![],'attributes':['id',_0x2958('0x38')]});}})[_0x2958('0x15')](function(_0x21dba6){var _0x3b38b2=_0x3fbe11[_0x2958('0x2a')]({'plain':!![]});var _0x34ba48=[];if(_0x10ed18===_0x2958('0xac')&&_0x3b38b2[_0x2958('0x2b')]==='agent'&&_0x3b38b2['online']){for(var _0x1c5d40=0x0;_0x1c5d40<_0x21dba6[_0x2958('0x49')];_0x1c5d40+=0x1){_0x34ba48[_0x2958('0x46')]({'membername':_0x3b38b2[_0x2958('0x38')],'UserId':_0x3b38b2['id'],'queue_name':_0x21dba6[_0x1c5d40][_0x2958('0x38')],'VoiceQueueId':_0x21dba6[_0x1c5d40]['id'],'interface':_[_0x2958('0x6b')](_0x3b38b2[_0x2958('0xad')])?util[_0x2958('0xae')](_0x2958('0xaf'),_0x3b38b2['name']):_0x3b38b2[_0x2958('0xad')],'paused':_0x3b38b2[_0x2958('0xb0')]||![],'penalty':_0x1d0d0d['body']['penalty']||0x0});}return BPromise[_0x2958('0x8c')](_0x34ba48,function(_0x33c111){return db[_0x2958('0xb1')]['upsert'](_0x33c111);});}return _0x3fbe11;});}})[_0x2958('0x15')](respondWithStatusCode(_0xc3b770,null))[_0x2958('0x51')](handleError(_0xc3b770,null));};exports[_0x2958('0xb2')]=function(_0xd403bd,_0x97949){var _0x402518;return db['User'][_0x2958('0x35')]({'where':{'id':_0xd403bd[_0x2958('0x53')]['id']},'attributes':['id','name','role']})[_0x2958('0x15')](handleEntityNotFound(_0x97949,null))['then'](function(_0x28c11c){if(_0x28c11c){_0x402518=_0x28c11c;if(!_0xd403bd[_0x2958('0x42')][_0x2958('0xb3')]||!utils[_0x2958('0xa0')](_0xd403bd['query']['channel'])){throw new db[(_0x2958('0x92'))]['ValidationError'](_0x2958('0xa1'));}return _0x28c11c[_0x2958('0xb4')+_[_0x2958('0xa3')](_0xd403bd[_0x2958('0x42')][_0x2958('0xb3')][_0x2958('0xa4')]())+'Queues'](_0xd403bd[_0x2958('0x42')][_0x2958('0x5f')]);}})[_0x2958('0x15')](function(_0x2bfa7c){if(_[_0x2958('0xb5')](_0xd403bd[_0x2958('0x42')]['ids'])){for(var _0x2465db=0x0;_0x2465db<_0xd403bd[_0x2958('0x42')][_0x2958('0x5f')][_0x2958('0x49')];_0x2465db+=0x1){var _0x7bd7b={'UserId':Number(_0xd403bd[_0x2958('0x53')]['id'])};_0x7bd7b[_['capitalize'](_0xd403bd[_0x2958('0x42')][_0x2958('0xb3')][_0x2958('0xa4')]())+_0x2958('0xa8')]=Number(_0xd403bd['query']['ids'][_0x2465db]);socket[_0x2958('0xa9')](_0x2958('0x2e')+_['capitalize'](_0xd403bd['query']['channel'][_0x2958('0xa4')]())+_0x2958('0xb6'),_0x7bd7b);}}else{var _0x7bd7b={'UserId':Number(_0xd403bd[_0x2958('0x53')]['id'])};_0x7bd7b[_['capitalize'](_0xd403bd[_0x2958('0x42')][_0x2958('0xb3')]['toLowerCase']())+_0x2958('0xa8')]=Number(_0xd403bd['query'][_0x2958('0x5f')]);socket[_0x2958('0xa9')](_0x2958('0x2e')+_['capitalize'](_0xd403bd[_0x2958('0x42')][_0x2958('0xb3')][_0x2958('0xa4')]())+_0x2958('0xb6'),_0x7bd7b);}return _0x2bfa7c;})[_0x2958('0x15')](function(){if(_0xd403bd[_0x2958('0x42')][_0x2958('0xb3')]==='voice'){return db[_0x2958('0xb1')][_0x2958('0x29')]({'where':{'UserId':_0xd403bd[_0x2958('0x53')]['id'],'VoiceQueueId':_0xd403bd[_0x2958('0x42')][_0x2958('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x402518;});}return _0x402518;})[_0x2958('0x15')](respondWithStatusCode(_0x97949,null))[_0x2958('0x51')](handleError(_0x97949,null));};exports[_0x2958('0xb7')]=function(_0x5b1521,_0x46ac94){_0x5b1521[_0x2958('0x5c')]['userpic']=_0x5b1521['file']['filename'];return db[_0x2958('0x3a')][_0x2958('0x35')]({'where':{'id':_0x5b1521['params']['id']}})[_0x2958('0x15')](handleEntityNotFound(_0x46ac94,null))[_0x2958('0x15')](saveUpdates(_0x5b1521[_0x2958('0x5c')],null))['then'](respondWithResult(_0x46ac94,null))[_0x2958('0x51')](handleError(_0x46ac94,null));};exports['getAvatar']=function(_0x36dd39,_0x1763c0){var _0x2c992f=path['join'](config[_0x2958('0xb8')],_0x2958('0xb9'));return db[_0x2958('0x3a')][_0x2958('0x35')]({'where':{'id':_0x36dd39['params']['id']},'attributes':['id',_0x2958('0xba')],'raw':!![]})[_0x2958('0x15')](handleEntityNotFound(_0x1763c0,null))['then'](function(_0x16cf32){if(_0x16cf32){if(_[_0x2958('0x6b')](_0x16cf32['userpic'])){return _0x1763c0[_0x2958('0xbb')](_0x2c992f);}else{if(!fs['existsSync'](path[_0x2958('0xbc')](config[_0x2958('0xb8')],_0x2958('0xbd'),_0x16cf32[_0x2958('0xba')]))){return _0x1763c0[_0x2958('0xbb')](_0x2c992f);}return _0x1763c0['download'](path[_0x2958('0xbc')](config['root'],_0x2958('0xbd'),_0x16cf32[_0x2958('0xba')]));}}})[_0x2958('0x51')](handleError(_0x1763c0,null));};exports[_0x2958('0xbe')]=function(_0x41504c,_0x20bee2){return db[_0x2958('0x3a')]['find']({'where':{'id':_0x41504c[_0x2958('0x53')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x20bee2,null))[_0x2958('0x15')](function(_0x6151c){var _0x40abb1=[];values=_0x6151c['dataValues'];_0x40abb1[_0x2958('0x46')](get_open_tabs(_0x2958('0x4a'),_0x6151c['dataValues']));_0x40abb1[_0x2958('0x46')](get_open_tabs(_0x2958('0x4c'),_0x6151c['dataValues']));_0x40abb1[_0x2958('0x46')](get_open_tabs('openchannel',_0x6151c[_0x2958('0x4b')]));_0x40abb1[_0x2958('0x46')](get_open_tabs(_0x2958('0x4f'),_0x6151c[_0x2958('0x4b')]));_0x40abb1[_0x2958('0x46')](get_open_tabs(_0x2958('0x5b'),_0x6151c[_0x2958('0x4b')]));_0x40abb1[_0x2958('0x46')](get_open_tabs(_0x2958('0x4d'),_0x6151c[_0x2958('0x4b')]));return BPromise[_0x2958('0x50')](_0x40abb1);})['then'](function(_0x596dc4){var _0x3d4186=[];if(_0x596dc4){for(var _0x5161e1=0x0;_0x5161e1=_0x2baed0){_0x3544ba=_0x2baed0;_0x483aee=0xc8;}else{_0x483aee=0xce;}_0x256202[_0x8db2('0x20')](_0x483aee);return _0x256202[_0x8db2('0x26')](_0x8db2('0x27'),_0x8d4f54+'-'+_0x3544ba+'/'+_0x2baed0)[_0x8db2('0x28')](_0x5725f0);}return null;};}function saveUpdates(_0xbe5ece){return function(_0x21bae5){if(_0x21bae5){return _0x21bae5[_0x8db2('0x29')](_0xbe5ece)[_0x8db2('0x15')](function(_0xbc5366){return _0xbc5366;});}return null;};}function removeEntity(_0x493cab){return function(_0x4718ec){if(_0x4718ec){return _0x4718ec['destroy']()['then'](function(){var _0x302188=_0x4718ec[_0x8db2('0x2a')]({'plain':!![]});if(_0x302188[_0x8db2('0x2b')]==='admin')return;var _0x42b272=[{'name':'Users','value':_0x8db2('0x2c'),'ignore':!![]},{'name':_0x8db2('0x2d'),'value':_0x8db2('0x2e'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x35d337=_(_0x42b272)[_0x8db2('0x2f')]('ignore')['map'](_0x8db2('0x30'))[_0x8db2('0x30')]();if(_[_0x8db2('0x31')](_0x35d337,_0x302188[_0x8db2('0x2b')])){return;}var _0x17ad44=_[_0x8db2('0x32')](_0x42b272,[_0x8db2('0x30'),_0x302188[_0x8db2('0x2b')]])[_0x8db2('0x33')];return db[_0x8db2('0x34')]['destroy']({'where':{'type':_0x17ad44,'resourceId':_0x302188['id']}})[_0x8db2('0x15')](function(){return _0x4718ec;});})[_0x8db2('0x15')](function(){_0x493cab['status'](0xcc)[_0x8db2('0x21')]();});}};}function handleEntityNotFound(_0x3ca80b){return function(_0x5962e6){if(!_0x5962e6){_0x3ca80b['sendStatus'](0x194);}return _0x5962e6;};}function handleError(_0x3c1983,_0x4a45dd){_0x4a45dd=_0x4a45dd||0x1f4;return function(_0x3dfbaa){logger[_0x8db2('0x1b')](_0x3dfbaa[_0x8db2('0x35')]);if(_0x3dfbaa[_0x8db2('0x33')]){delete _0x3dfbaa['name'];}_0x3c1983[_0x8db2('0x20')](_0x4a45dd)['send'](_0x3dfbaa);};}exports[_0x8db2('0x36')]=function(_0xd550ae,_0x2c8bc9){var _0x4599c3={},_0x50e88a={'count':0x0,'rows':[]};var _0x50ee17=_(db[_0x8db2('0x37')][_0x8db2('0x38')])['map'](function(_0x2bac57){return{'name':_0x2bac57[_0x8db2('0x39')],'type':_0x2bac57[_0x8db2('0x3a')]['key']};})[_0x8db2('0x2f')](function(_0x149186){return!_[_0x8db2('0x31')]([_0x8db2('0x3b'),_0x8db2('0x3c')],_0x149186[_0x8db2('0x33')]);})[_0x8db2('0x30')]();_0x4599c3=qs[_0x8db2('0x3d')](_0x50ee17,_0xd550ae);var _0x3793a4={'where':_0x4599c3[_0x8db2('0x3e')]};return db[_0x8db2('0x37')][_0x8db2('0x24')](_0x3793a4)[_0x8db2('0x15')](function(_0x4a1c60){_0x50e88a[_0x8db2('0x24')]=_0x4a1c60;if(_0xd550ae[_0x8db2('0x3f')]['includeAll']){_0x4599c3['include']=[{'all':!![]}];}if(!_[_0x8db2('0x31')](_0x4599c3['attributes'],'id')){_0x4599c3[_0x8db2('0x40')][_0x8db2('0x41')]('id');}return db[_0x8db2('0x37')][_0x8db2('0x42')](_0x4599c3);})[_0x8db2('0x15')](function(_0x30d606){_0x50e88a[_0x8db2('0x43')]=_0x30d606;if(_0xd550ae['query'][_0x8db2('0x44')]===_0x8db2('0x45')){var _0x40c69e=[];for(var _0x4a0b56=0x0;_0x4a0b56<_0x50e88a['rows'][_0x8db2('0x46')];_0x4a0b56++){_0x40c69e[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x47'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56]['dataValues']));_0x40c69e[_0x8db2('0x41')](get_open_tabs('sms',_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e[_0x8db2('0x41')](get_open_tabs('fax',_0x50e88a['rows'][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e['push'](get_open_tabs(_0x8db2('0x49'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4a'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4b'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));}return BPromise[_0x8db2('0x4c')](_0x40c69e)['then'](function(_0x449109){return _0x50e88a;});}else{return _0x50e88a;}})[_0x8db2('0x15')](respondWithFilteredResult(_0x2c8bc9,_0x4599c3))[_0x8db2('0x4d')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x4e')]=function(_0x4f5018,_0x4ffd9d){var _0x11c224={'raw':![],'where':{'id':_0x4f5018[_0x8db2('0x4f')]['id']}},_0x2e46d4={};_0x2e46d4['model']=_['differenceBy'](_['keys'](db[_0x8db2('0x37')][_0x8db2('0x38')]),[_0x8db2('0x3b'),_0x8db2('0x3c')]);_0x2e46d4[_0x8db2('0x3f')]=_[_0x8db2('0x50')](_0x4f5018[_0x8db2('0x3f')]);_0x2e46d4['filters']=_['intersection'](_0x2e46d4[_0x8db2('0x51')],_0x2e46d4[_0x8db2('0x3f')]);_0x11c224[_0x8db2('0x40')]=_[_0x8db2('0x52')](_0x2e46d4[_0x8db2('0x51')],qs[_0x8db2('0x53')](_0x4f5018[_0x8db2('0x3f')][_0x8db2('0x53')]));_0x11c224[_0x8db2('0x40')]=_0x11c224[_0x8db2('0x40')][_0x8db2('0x46')]?_0x11c224[_0x8db2('0x40')]:_0x2e46d4[_0x8db2('0x51')];if(_0x4f5018[_0x8db2('0x3f')][_0x8db2('0x54')]){_0x11c224['include']=[{'all':!![]}];}_0x11c224=_[_0x8db2('0x55')]({},_0x11c224,_0x4f5018[_0x8db2('0x56')]);if(!_['includes'](_0x11c224[_0x8db2('0x40')],'id')){_0x11c224[_0x8db2('0x40')][_0x8db2('0x41')]('id');}return db['User'][_0x8db2('0x32')](_0x11c224)[_0x8db2('0x15')](handleEntityNotFound(_0x4ffd9d,null))[_0x8db2('0x15')](function(_0x1f41f2){var _0x1167d5=[];values=_0x1f41f2;if(_0x4f5018['query'][_0x8db2('0x44')]===_0x8db2('0x45')){_0x1167d5[_0x8db2('0x41')](get_open_tabs('chat',_0x1f41f2[_0x8db2('0x48')]));_0x1167d5[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x57'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4a'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5['push'](get_open_tabs(_0x8db2('0x4b'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5['push'](get_open_tabs(_0x8db2('0x58'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5['push'](get_open_tabs(_0x8db2('0x49'),_0x1f41f2[_0x8db2('0x48')]));return BPromise[_0x8db2('0x4c')](_0x1167d5);}else{return values;}})[_0x8db2('0x15')](function(_0x42b941){return values;})[_0x8db2('0x15')](respondWithResult(_0x4ffd9d,null))[_0x8db2('0x4d')](handleError(_0x4ffd9d,null));};exports[_0x8db2('0x29')]=function(_0x120ef2,_0x173a5e){if(_0x120ef2[_0x8db2('0x59')]['id']){delete _0x120ef2[_0x8db2('0x59')]['id'];}delete _0x120ef2[_0x8db2('0x59')][_0x8db2('0x2b')];return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x120ef2['params']['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x173a5e,null))[_0x8db2('0x15')](saveUpdates(_0x120ef2[_0x8db2('0x59')],null))[_0x8db2('0x15')](respondWithResult(_0x173a5e,null))[_0x8db2('0x4d')](handleError(_0x173a5e,null));};exports['describe']=function(_0x3dd6b1,_0x2c3087){return db[_0x8db2('0x37')][_0x8db2('0x5a')]()[_0x8db2('0x15')](respondWithResult(_0x2c3087,null))[_0x8db2('0x4d')](handleError(_0x2c3087,null));};exports[_0x8db2('0x5b')]=function(_0x2c7b04,_0x24cfe9){return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x2c7b04[_0x8db2('0x4f')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x24cfe9,null))[_0x8db2('0x15')](function(_0xed9d36){if(_0xed9d36){return _0xed9d36[_0x8db2('0x5b')](_0x2c7b04[_0x8db2('0x59')][_0x8db2('0x5c')],_['omit'](_0x2c7b04[_0x8db2('0x59')],['ids','id'])||{});}})[_0x8db2('0x15')](respondWithResult(_0x24cfe9,null))['catch'](handleError(_0x24cfe9,null));};function validateUser(_0x3de11e){return new BPromise(function(_0x39330c,_0xe4fd6a){if(_0x3de11e[_0x8db2('0x5d')])return _0x39330c(_0x3de11e);return db[_0x8db2('0x5e')]['findById'](0x1)['then'](function(_0x3d1128){if(_0x3d1128[_0x8db2('0x5f')])authService[_0x8db2('0x60')](_0x3de11e[_0x8db2('0x3b')]);db[_0x8db2('0x37')][_0x8db2('0x61')](_0x8db2('0x5d'))[_0x8db2('0x15')](function(_0x504039){if(_[_0x8db2('0x62')](_0x504039)){_0x3de11e[_0x8db2('0x5d')]=_0x3d1128[_0x8db2('0x63')]||0x1;return;}if(_[_0x8db2('0x62')](_0x3d1128[_0x8db2('0x63')])||_0x3d1128[_0x8db2('0x63')]===_0x504039){_0x3de11e[_0x8db2('0x5d')]=_0x504039+0x1;return;}if(_0x3d1128[_0x8db2('0x63')]>_0x504039){_0x3de11e['internal']=_0x3d1128['min_internal'];return;}return db[_0x8db2('0x64')][_0x8db2('0x3f')](_0x8db2('0x65'),{'type':db[_0x8db2('0x64')][_0x8db2('0x66')]['SELECT']})['then'](function(_0x3611da){if(_0x3611da&&_0x3611da[_0x8db2('0x46')]){for(var _0x54f0d4=0x0,_0xa698bd=_0x3611da[_0x8db2('0x46')];_0x54f0d4<_0xa698bd&&_[_0x8db2('0x62')](_0x3de11e['internal']);_0x54f0d4++){if(_0x3d1128[_0x8db2('0x63')]<=_0x3611da[_0x54f0d4][_0x8db2('0x67')]){_0x3de11e[_0x8db2('0x5d')]=_0x3611da[_0x54f0d4]['from'];}else if(_0x3d1128[_0x8db2('0x63')]>_0x3611da[_0x54f0d4][_0x8db2('0x67')]&&_0x3d1128[_0x8db2('0x63')]<=_0x3611da[_0x54f0d4]['to']){_0x3de11e[_0x8db2('0x5d')]=_0x3d1128[_0x8db2('0x63')];}}}if(_['isNil'](_0x3de11e[_0x8db2('0x5d')])){_0x3de11e[_0x8db2('0x5d')]=_0x504039+0x1;}return _0x39330c(_0x3de11e);});});})[_0x8db2('0x4d')](function(_0x4b79e7){_0xe4fd6a(_0x4b79e7);});});}function updateUser(_0x59e740){return new BPromise(function(_0x2cdf3c,_0xbe05ca){try{if(_0x59e740['voicemail']){_0x59e740[_0x8db2('0x68')]=_0x59e740[_0x8db2('0x5d')];_0x59e740[_0x8db2('0x69')]={'mailbox':_0x59e740[_0x8db2('0x5d')],'password':_0x59e740[_0x8db2('0x3b')],'fullname':_0x59e740[_0x8db2('0x6a')],'email':_0x59e740[_0x8db2('0x6b')]};}if(_0x59e740[_0x8db2('0x2b')]===_0x8db2('0x2e')){if(!_0x59e740[_0x8db2('0x6c')])_0x59e740[_0x8db2('0x6c')]=[_0x8db2('0x6d'),_0x8db2('0x6e'),'103',_0x8db2('0x6f'),'110',_0x8db2('0x70'),_0x8db2('0x71'),'106',_0x8db2('0x72'),_0x8db2('0x73'),'109',_0x8db2('0x74'),_0x8db2('0x75'),_0x8db2('0x76'),_0x8db2('0x77')];}_0x2cdf3c(_0x59e740);}catch(_0x242379){_0xbe05ca(_0x242379);}});}exports[_0x8db2('0x78')]=function(_0x1f5565,_0x3ac0fa){if(_0x1f5565[_0x8db2('0x2c')]['role']==='agent')throw new Error(_0x8db2('0x79'));if(_0x1f5565['body'][_0x8db2('0x2b')]===_0x8db2('0x2c')&&_0x1f5565[_0x8db2('0x2c')]['role']!==_0x8db2('0x7a')){throw new Error(_0x8db2('0x7b'));}if(_0x1f5565[_0x8db2('0x59')]['role']===_0x8db2('0x7a')&&_0x1f5565[_0x8db2('0x2c')][_0x8db2('0x2b')]!==_0x8db2('0x7a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x8db2('0x7c')]([_0x1f5565[_0x8db2('0x59')]])[_0x8db2('0x15')](function(){return validateUser(_0x1f5565[_0x8db2('0x59')]);})[_0x8db2('0x15')](function(_0x15fd4){return updateUser(_0x15fd4)[_0x8db2('0x15')](function(_0x3682bf){if(_0x3682bf[_0x8db2('0x2b')]===_0x8db2('0x7a')){_0x3682bf[_0x8db2('0x7d')]=_0x1f5565['user'][_0x8db2('0x7d')];delete _0x3682bf[_0x8db2('0x7e')];}return _0x3682bf;});})[_0x8db2('0x15')](function(_0x4b297f){return db['User']['create'](_0x4b297f,{'include':[{'model':db[_0x8db2('0x69')],'as':_0x8db2('0x69')}]});})[_0x8db2('0x15')](function(_0x454377){if(_0x1f5565[_0x8db2('0x59')][_0x8db2('0x2b')]===_0x8db2('0x2c'))return _0x454377;if(_0x1f5565[_0x8db2('0x2c')][_0x8db2('0x2b')]!==_0x8db2('0x2c'))return _0x454377;return db[_0x8db2('0x7f')]['find']({'where':{'name':_0x454377[_0x8db2('0x2b')]===_0x8db2('0x2e')?_0x8db2('0x2d'):_0x8db2('0x80'),'userProfileId':_0x1f5565['user']['userProfileId']},'raw':!![]})[_0x8db2('0x15')](function(_0x3c3f3e){if(!_0x3c3f3e||_0x3c3f3e['autoAssociation']!=0x0)return _0x454377;return db[_0x8db2('0x34')][_0x8db2('0x78')]({'name':_0x454377[_0x8db2('0x33')],'resourceId':_0x454377['id'],'type':_0x3c3f3e['name'],'sectionId':_0x3c3f3e['id']},{})['then'](function(){return _0x454377;});})['catch'](function(_0x468f90){logger[_0x8db2('0x1b')](_0x8db2('0x81'),_0x468f90);throw _0x468f90;});})[_0x8db2('0x15')](respondWithResult(_0x3ac0fa,0xc9))[_0x8db2('0x4d')](handleError(_0x3ac0fa,null));};exports['bulkCreate']=function(_0x30930a,_0x5e349c){var _0x8c54c=_0x30930a[_0x8db2('0x59')];var _0xa083b1=[];if(_0x30930a[_0x8db2('0x2c')][_0x8db2('0x2b')]==='agent')throw new Error('Unauthorized');if(_[_0x8db2('0x82')](_0x8c54c,['role',_0x8db2('0x2c')])&&_0x30930a[_0x8db2('0x2c')][_0x8db2('0x2b')]!==_0x8db2('0x7a')){throw new Error(_0x8db2('0x7b'));}if(_[_0x8db2('0x82')](_0x8c54c,['role',_0x8db2('0x7a')])&&_0x30930a[_0x8db2('0x2c')][_0x8db2('0x2b')]!=='admin'){throw new Error(_0x8db2('0x83'));}return licenseUtil[_0x8db2('0x7c')](_0x8c54c)['then'](function(){return validateUser(_0x8c54c[0x0]);})[_0x8db2('0x15')](function(){for(var _0x7cb97d=0x1;_0x7cb97d<_0x8c54c[_0x8db2('0x46')];_0x7cb97d++){var _0x15307d=_0x8c54c[_0x7cb97d-0x1][_0x8db2('0x5d')];if(!_0x8c54c[_0x7cb97d][_0x8db2('0x5d')])_0x8c54c[_0x7cb97d][_0x8db2('0x5d')]=_0x15307d+0x1;_0xa083b1[_0x8db2('0x41')](validateUser(_0x8c54c[_0x7cb97d]));}return BPromise[_0x8db2('0x4c')](_0xa083b1);})['then'](function(){_0xa083b1=[];for(var _0x44c0cc=0x0;_0x44c0cc<_0x8c54c[_0x8db2('0x46')];_0x44c0cc++){_0xa083b1[_0x8db2('0x41')](updateUser(_0x8c54c[_0x44c0cc]));}return BPromise[_0x8db2('0x4c')](_0xa083b1);})[_0x8db2('0x15')](function(){return BPromise[_0x8db2('0x84')](_0x8c54c,function(_0x16d1c5){return db[_0x8db2('0x37')][_0x8db2('0x78')](_0x16d1c5,{'include':[{'model':db[_0x8db2('0x69')],'as':'VoiceMail'}]})[_0x8db2('0x15')](function(_0x7e4bf){_0x16d1c5['id']=_0x7e4bf['id'];return _0x16d1c5;});});})[_0x8db2('0x15')](function(_0x1587e8){if(_0x30930a['body'][_0x8db2('0x2b')]===_0x8db2('0x2c'))return _0x1587e8;if(_0x30930a[_0x8db2('0x2c')]['role']!=='user')return _0x1587e8;var _0x1fdeee=_[_0x8db2('0x82')](_0x1587e8,function(_0x15b85e){return _0x15b85e[_0x8db2('0x2b')]==='agent'||_0x15b85e[_0x8db2('0x2b')]===_0x8db2('0x85');});if(!_0x1fdeee)return _0x1587e8;return db[_0x8db2('0x7f')][_0x8db2('0x42')]({'where':{'name':{'$or':['Agents',_0x8db2('0x80')]},'userProfileId':_0x30930a[_0x8db2('0x2c')][_0x8db2('0x7e')]},'raw':!![]})['then'](function(_0x5742c5){if(_['isEmpty'](_0x5742c5)||!_[_0x8db2('0x82')](_0x5742c5,[_0x8db2('0x86'),0x0]))return _0x1587e8;_0xa083b1=[];var _0x122029=_(_0x5742c5)[_0x8db2('0x87')](function(_0x53ae6f){if(_0x53ae6f['autoAssociation']===0x1)return;return _0x53ae6f[_0x8db2('0x33')]===_0x8db2('0x2d')?_0x8db2('0x2e'):_0x8db2('0x85');})[_0x8db2('0x88')]()[_0x8db2('0x30')]();for(var _0x57c265=0x0;_0x57c265<_0x1587e8[_0x8db2('0x46')];_0x57c265++){if(!_['includes'](_0x122029,_0x1587e8[_0x57c265][_0x8db2('0x2b')]))return;var _0x23457b=_0x1587e8[_0x57c265][_0x8db2('0x2b')]===_0x8db2('0x2e')?_0x8db2('0x2d'):'Telephones';_0xa083b1[_0x8db2('0x41')](db[_0x8db2('0x34')]['create']({'name':_0x1587e8[_0x57c265][_0x8db2('0x33')],'resourceId':_0x1587e8[_0x57c265]['id'],'type':_0x23457b,'sectionId':_[_0x8db2('0x32')](_0x5742c5,[_0x8db2('0x33'),_0x23457b])['id']},{}));}return BPromise[_0x8db2('0x4c')](_0xa083b1);});})['then'](respondWithResult(_0x5e349c,0xc9))[_0x8db2('0x4d')](handleError(_0x5e349c,null));};exports['changePassword']=function(_0x58ab95,_0xaa90b9){if(_0x58ab95[_0x8db2('0x59')]['id']){delete _0x58ab95[_0x8db2('0x59')]['id'];}return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x58ab95[_0x8db2('0x4f')]['id']}})[_0x8db2('0x15')](function(_0x48c718){if(!_0x48c718)return null;if(_0x48c718['id']===_0x58ab95[_0x8db2('0x2c')]['id']){if(!_0x58ab95['body']['oldPassword']||!_0x58ab95[_0x8db2('0x59')]['newPassword']){throw new db['Sequelize'][(_0x8db2('0x89'))](_0x8db2('0x8a'));}if(!_0x48c718[_0x8db2('0x8b')](_0x58ab95['body'][_0x8db2('0x8c')])){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))]('Wrong\x20credentials');}if(_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8c')]===_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')]){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x8f'));}}else if(_0x58ab95[_0x8db2('0x2c')]['role']===_0x8db2('0x7a')){if(!_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')]){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x90'));}}else if(_0x58ab95[_0x8db2('0x2c')][_0x8db2('0x2b')]===_0x8db2('0x2c')){if(!_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')]){throw new db['Sequelize'][(_0x8db2('0x89'))](_0x8db2('0x90'));}if(_0x48c718[_0x8db2('0x2b')]!=='agent'){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x79'));}}else{throw new db['Sequelize']['ValidationError'](_0x8db2('0x79'));}return _0x48c718;})[_0x8db2('0x15')](handleEntityNotFound(_0xaa90b9,null))[_0x8db2('0x15')](function(_0x1f205d){return db[_0x8db2('0x5e')][_0x8db2('0x91')]({'attributes':['id',_0x8db2('0x5f'),_0x8db2('0x92'),_0x8db2('0x93')]})[_0x8db2('0x15')](function(_0x581ef1){if(_0x581ef1[_0x8db2('0x5f')])authService[_0x8db2('0x60')](_0x58ab95['body'][_0x8db2('0x8e')]);if(!_0x581ef1[_0x8db2('0x92')]||!_0x1f205d[_0x8db2('0x94')])return _0x1f205d;authService[_0x8db2('0x95')](_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')],_0x1f205d[_0x8db2('0x94')],_0x581ef1[_0x8db2('0x93')]);return _0x1f205d;})[_0x8db2('0x15')](saveUpdates({'password':_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')],'passwordResetAt':_0x58ab95['user']['id']==_0x58ab95[_0x8db2('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x8db2('0x96')](_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')],_0x1f205d[_0x8db2('0x94')])},null));})[_0x8db2('0x15')](respondWithResult(_0xaa90b9,null))['catch'](handleError(_0xaa90b9,null));};exports[_0x8db2('0x97')]=function(_0x19bc4d,_0x339dbf){var _0x858bbc=_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x98')];return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x19bc4d[_0x8db2('0x4f')]['id']},'attributes':['id',_0x8db2('0x33'),_0x8db2('0x2b'),'online','loginInPause',_0x8db2('0x99'),'interface']})[_0x8db2('0x15')](handleEntityNotFound(_0x339dbf,null))[_0x8db2('0x15')](function(_0x2428f1){if(_0x2428f1){if(!utils['isValidChannel'](_0x858bbc)){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x9a'));}return _0x2428f1[_0x8db2('0x9b')+_['capitalize'](_0x858bbc[_0x8db2('0x9c')]())+_0x8db2('0x9d')](_0x19bc4d[_0x8db2('0x59')]['ids'],{'penalty':_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x9e')]||0x0})[_0x8db2('0x9f')](function(_0x5e04be){for(var _0x38099e=0x0;_0x38099e<_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x5c')]['length'];_0x38099e+=0x1){var _0x18ac5c={'UserId':Number(_0x19bc4d[_0x8db2('0x4f')]['id'])};_0x18ac5c[_['capitalize'](_0x858bbc[_0x8db2('0x9c')]())+_0x8db2('0xa0')]=Number(_0x19bc4d['body'][_0x8db2('0x5c')][_0x38099e]);socket[_0x8db2('0xa1')](_0x8db2('0x2c')+_['capitalize'](_0x858bbc['toLowerCase']())+_0x8db2('0xa2'),_0x18ac5c);}return _0x5e04be;})['then'](function(){if(_0x858bbc==='voice'){return db[_0x8db2('0xa3')][_0x8db2('0x42')]({'where':{'id':_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x5c')]||[]},'raw':!![],'attributes':['id',_0x8db2('0x33')]});}})[_0x8db2('0x15')](function(_0x54d389){var _0x4f7dcd=_0x2428f1[_0x8db2('0x2a')]({'plain':!![]});var _0x2bb457=[];if(_0x858bbc===_0x8db2('0xa4')&&_0x4f7dcd[_0x8db2('0x2b')]==='agent'&&_0x4f7dcd[_0x8db2('0xa5')]){for(var _0x51d15e=0x0;_0x51d15e<_0x54d389[_0x8db2('0x46')];_0x51d15e+=0x1){_0x2bb457['push']({'membername':_0x4f7dcd[_0x8db2('0x33')],'UserId':_0x4f7dcd['id'],'queue_name':_0x54d389[_0x51d15e][_0x8db2('0x33')],'VoiceQueueId':_0x54d389[_0x51d15e]['id'],'interface':_[_0x8db2('0x62')](_0x4f7dcd[_0x8db2('0xa6')])?util[_0x8db2('0xa7')](_0x8db2('0xa8'),_0x4f7dcd['name']):_0x4f7dcd['interface'],'paused':_0x4f7dcd[_0x8db2('0x99')]||![],'penalty':_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x9e')]||0x0});}return BPromise['each'](_0x2bb457,function(_0x4eb531){return db[_0x8db2('0xa9')][_0x8db2('0xaa')](_0x4eb531);});}return _0x2428f1;});}})[_0x8db2('0x15')](respondWithStatusCode(_0x339dbf,null))['catch'](handleError(_0x339dbf,null));};exports['removeQueues']=function(_0x31613c,_0x109d59){var _0x5e7912;return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x31613c[_0x8db2('0x4f')]['id']},'attributes':['id',_0x8db2('0x33'),_0x8db2('0x2b')]})[_0x8db2('0x15')](handleEntityNotFound(_0x109d59,null))[_0x8db2('0x15')](function(_0x3bffd9){if(_0x3bffd9){_0x5e7912=_0x3bffd9;if(!_0x31613c[_0x8db2('0x3f')]['channel']||!utils['isValidChannel'](_0x31613c['query'][_0x8db2('0x98')])){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x9a'));}return _0x3bffd9[_0x8db2('0xab')+_['capitalize'](_0x31613c[_0x8db2('0x3f')]['channel'][_0x8db2('0x9c')]())+_0x8db2('0x9d')](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')]);}})['then'](function(_0x44da4b){if(_['isArray'](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')])){for(var _0x4ad5c5=0x0;_0x4ad5c5<_0x31613c['query']['ids'][_0x8db2('0x46')];_0x4ad5c5+=0x1){var _0x340686={'UserId':Number(_0x31613c[_0x8db2('0x4f')]['id'])};_0x340686[_[_0x8db2('0xac')](_0x31613c['query'][_0x8db2('0x98')][_0x8db2('0x9c')]())+_0x8db2('0xa0')]=Number(_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')][_0x4ad5c5]);socket['emit']('user'+_[_0x8db2('0xac')](_0x31613c[_0x8db2('0x3f')]['channel'][_0x8db2('0x9c')]())+_0x8db2('0xad'),_0x340686);}}else{var _0x340686={'UserId':Number(_0x31613c['params']['id'])};_0x340686[_[_0x8db2('0xac')](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x98')][_0x8db2('0x9c')]())+_0x8db2('0xa0')]=Number(_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')]);socket[_0x8db2('0xa1')](_0x8db2('0x2c')+_[_0x8db2('0xac')](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x98')]['toLowerCase']())+_0x8db2('0xad'),_0x340686);}return _0x44da4b;})[_0x8db2('0x15')](function(){if(_0x31613c['query'][_0x8db2('0x98')]===_0x8db2('0xa4')){return db[_0x8db2('0xa9')][_0x8db2('0xae')]({'where':{'UserId':_0x31613c[_0x8db2('0x4f')]['id'],'VoiceQueueId':_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')]},'individualHooks':!![]})[_0x8db2('0x15')](function(){return _0x5e7912;});}return _0x5e7912;})[_0x8db2('0x15')](respondWithStatusCode(_0x109d59,null))[_0x8db2('0x4d')](handleError(_0x109d59,null));};exports[_0x8db2('0xaf')]=function(_0x1748b4,_0x5c1870){_0x1748b4['body'][_0x8db2('0xb0')]=_0x1748b4[_0x8db2('0xb1')]['filename'];return db[_0x8db2('0x37')]['find']({'where':{'id':_0x1748b4[_0x8db2('0x4f')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x5c1870,null))[_0x8db2('0x15')](saveUpdates(_0x1748b4[_0x8db2('0x59')],null))[_0x8db2('0x15')](respondWithResult(_0x5c1870,null))[_0x8db2('0x4d')](handleError(_0x5c1870,null));};exports[_0x8db2('0xb2')]=function(_0x1c28c2,_0x505017){var _0x1c3e0f=path[_0x8db2('0xb3')](config[_0x8db2('0xb4')],_0x8db2('0xb5'));return db['User'][_0x8db2('0x32')]({'where':{'id':_0x1c28c2['params']['id']},'attributes':['id',_0x8db2('0xb0')],'raw':!![]})['then'](handleEntityNotFound(_0x505017,null))[_0x8db2('0x15')](function(_0x3155a6){if(_0x3155a6){if(_[_0x8db2('0x62')](_0x3155a6[_0x8db2('0xb0')])){return _0x505017['download'](_0x1c3e0f);}else{if(!fs[_0x8db2('0xb6')](path[_0x8db2('0xb3')](config[_0x8db2('0xb4')],_0x8db2('0xb7'),_0x3155a6[_0x8db2('0xb0')]))){return _0x505017[_0x8db2('0xb8')](_0x1c3e0f);}return _0x505017[_0x8db2('0xb8')](path[_0x8db2('0xb3')](config[_0x8db2('0xb4')],_0x8db2('0xb7'),_0x3155a6['userpic']));}}})['catch'](handleError(_0x505017,null));};exports['getOpenTabs']=function(_0x280d6a,_0x3191a5){return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x280d6a[_0x8db2('0x4f')]['id']},'attributes':['id']})[_0x8db2('0x15')](handleEntityNotFound(_0x3191a5,null))[_0x8db2('0x15')](function(_0xd5a052){var _0x4bb49c=[];values=_0xd5a052[_0x8db2('0x48')];_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x47'),_0xd5a052[_0x8db2('0x48')]));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x57'),_0xd5a052['dataValues']));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4a'),_0xd5a052['dataValues']));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4b'),_0xd5a052['dataValues']));_0x4bb49c[_0x8db2('0x41')](get_open_tabs('fax',_0xd5a052[_0x8db2('0x48')]));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x49'),_0xd5a052[_0x8db2('0x48')]));return BPromise[_0x8db2('0x4c')](_0x4bb49c);})[_0x8db2('0x15')](function(_0x165cda){var _0x4905e3=[];if(_0x165cda){for(var _0x3a254b=0x0;_0x3a254b=_0x565d78[_0xf522('0x51')]){throw new Error(_0xf522('0x52'));}})[_0xf522('0xe')](function(){if(_0x512709){return db[_0xf522('0x29')][_0xf522('0x48')]({'where':{'membername':_0x512709[_0xf522('0x26')]},'individualHooks':!![]});}})[_0xf522('0xe')](function(){if(_0x512709){return _0x512709[_0xf522('0x53')]({'raw':!![]});}})['then'](function(_0x236721){if(_0x512709){if(_0x236721){var _0x3fb853=[];_0x1c74ba=_0x236721;if(_0x1c74ba[_0xf522('0x2a')]){for(var _0x22771b=0x0;_0x22771b<_0x1c74ba[_0xf522('0x2a')];_0x22771b++){_0x3fb853[_0xf522('0x2e')](db[_0xf522('0x29')][_0xf522('0x54')]({'membername':_0x512709[_0xf522('0x26')],'UserId':_0x512709['id'],'queue_name':_0x1c74ba[_0x22771b][_0xf522('0x26')],'VoiceQueueId':_0x1c74ba[_0x22771b]['id'],'interface':_0x3057d6,'paused':_0x512709[_0xf522('0x55')]||![],'penalty':_0x1c74ba[_0x22771b]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xf522('0x46')](_0x3fb853);}}}})[_0xf522('0xe')](function(){if(_0x512709){return db[_0xf522('0x41')][_0xf522('0x1b')]({'where':{'membername':_0x512709['name'],'exitAt':null}});}})[_0xf522('0xe')](function(_0x367c47){if(_0x512709){if(_0x367c47&&_0x367c47[_0xf522('0x2a')]){var _0x30bfa3=[];_0x367c47[_0xf522('0x45')](function(_0x594a33){_0x30bfa3[_0xf522('0x2e')](_0x594a33[_0xf522('0x3c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xf522('0x46')](_0x30bfa3);}}})[_0xf522('0xe')](function(_0x37625a){if(_0x512709){var _0x518d1d=[];var _0x155fdc=[];var _0xa42b98=utils[_0xf522('0x2d')]();var _0x1604ee={'membername':_0x512709[_0xf522('0x26')],'interface':_0x3057d6,'enterAt':moment()[_0xf522('0x2b')](_0xf522('0x35')),'role':_0x512709[_0xf522('0x34')],'internal':_0x512709[_0xf522('0x27')]};_0xa42b98['forEach'](function(_0x598647){_0x518d1d[_0xf522('0x2e')](_[_0xf522('0x56')]({'channel':_0x598647,'type':_0xf522('0x57'),'data1':'callysquare','data2':_0x3057d6},_0x1604ee));if(_0x512709[_0xf522('0x55')]){_0x155fdc[_0xf522('0x2e')](_['merge']({'channel':_0x598647,'type':_0xf522('0x30'),'data1':'LOGININPAUSE'},_0x1604ee));}});return db[_0xf522('0x41')][_0xf522('0x58')](_0x518d1d[_0xf522('0x59')](_0x155fdc),{'individualHooks':!![]});}})[_0xf522('0xe')](function(){if(_0x512709){return _0x512709[_0xf522('0x3c')]({'online':!![],'lastLoginAt':moment()[_0xf522('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x512709[_0xf522('0x55')]||![],'mailPause':_0x512709['loginInPause']||![],'chatPause':_0x512709[_0xf522('0x55')]||![],'faxPause':_0x512709[_0xf522('0x55')]||![],'smsPause':_0x512709['loginInPause']||![],'openchannelPause':_0x512709[_0xf522('0x55')]||![],'pauseType':_0x512709[_0xf522('0x55')]?_0xf522('0x5a'):null,'lastPauseAt':moment()['format'](_0xf522('0x35')),'interface':_0x3057d6});}})['then'](function(_0xe02aa){_0x2ee360(_0xe02aa);})[_0xf522('0x18')](function(_0x5d4b91){_0x46b34d(_0x95fc76[_0xf522('0x14')](0x1f4,_0x5d4b91[_0xf522('0x17')]));});});}; \ No newline at end of file +var _0x00d6=['register','then','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetUser','User','options','raw','where','attributes','include','map','model','info','ShowUser','find','debug','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','format','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','set','Pause','forEach','all','LogoutUser','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','upsert','LOGIN','callysquare','LOGININPAUSE','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter','./user.socket'];(function(_0x436cc2,_0x554a84){var _0x598b95=function(_0x32b820){while(--_0x32b820){_0x436cc2['push'](_0x436cc2['shift']());}};_0x598b95(++_0x554a84);}(_0x00d6,0x14c));var _0x600d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x00d6[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x600d('0x0'));var util=require('util');var moment=require(_0x600d('0x1'));var BPromise=require(_0x600d('0x2'));var rs=require(_0x600d('0x3'));var fs=require('fs');var Redis=require(_0x600d('0x4'));var db=require(_0x600d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x600d('0x6'))('rpc');var config=require(_0x600d('0x7'));var jayson=require(_0x600d('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x600d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x600d('0xa'))(new Redis(config[_0x600d('0x9')]));require(_0x600d('0xb'))[_0x600d('0xc')](socket);function respondWithRpcPromise(_0x5b8cd6,_0x4f4a64,_0x3f071d){return new BPromise(function(_0x4509ec,_0x3cfaee){return client['request'](_0x5b8cd6,_0x3f071d)[_0x600d('0xd')](function(_0x5b3982){logger['info'](_0x600d('0xe'),_0x4f4a64,_0x600d('0xf'));logger['debug'](_0x600d('0x10'),_0x4f4a64,'request\x20sent',JSON[_0x600d('0x11')](_0x5b3982));if(_0x5b3982[_0x600d('0x12')]){if(_0x5b3982['error'][_0x600d('0x13')]===0x1f4){logger['error'](_0x600d('0xe'),_0x4f4a64,_0x5b3982[_0x600d('0x12')][_0x600d('0x14')]);return _0x3cfaee(_0x5b3982[_0x600d('0x12')]['message']);}logger[_0x600d('0x12')]('User,\x20%s,\x20%s',_0x4f4a64,_0x5b3982[_0x600d('0x12')]['message']);return _0x4509ec(_0x5b3982['error'][_0x600d('0x14')]);}else{logger['info'](_0x600d('0xe'),_0x4f4a64,_0x600d('0xf'));_0x4509ec(_0x5b3982['result']['message']);}})[_0x600d('0x15')](function(_0x257256){logger[_0x600d('0x12')](_0x600d('0xe'),_0x4f4a64,_0x257256);_0x3cfaee(_0x257256);});});}exports[_0x600d('0x16')]=function(_0x24a80d){var _0x490586=this;return new Promise(function(_0x2b77e2,_0x17ad1f){return db[_0x600d('0x17')]['findAll']({'raw':_0x24a80d[_0x600d('0x18')]?_0x24a80d[_0x600d('0x18')][_0x600d('0x19')]===undefined?!![]:![]:!![],'where':_0x24a80d[_0x600d('0x18')]?_0x24a80d[_0x600d('0x18')][_0x600d('0x1a')]||null:null,'attributes':_0x24a80d[_0x600d('0x18')]?_0x24a80d['options'][_0x600d('0x1b')]||null:null,'limit':_0x24a80d[_0x600d('0x18')]?_0x24a80d['options']['limit']||null:null,'include':_0x24a80d[_0x600d('0x18')]?_0x24a80d[_0x600d('0x18')][_0x600d('0x1c')]?_[_0x600d('0x1d')](_0x24a80d[_0x600d('0x18')][_0x600d('0x1c')],function(_0x3eef48){return{'model':db[_0x3eef48[_0x600d('0x1e')]],'as':_0x3eef48['as'],'attributes':_0x3eef48['attributes'],'include':_0x3eef48[_0x600d('0x1c')]?_[_0x600d('0x1d')](_0x3eef48['include'],function(_0x5e2255){return{'model':db[_0x5e2255[_0x600d('0x1e')]],'as':_0x5e2255['as'],'attributes':_0x5e2255[_0x600d('0x1b')],'include':_0x5e2255[_0x600d('0x1c')]?_[_0x600d('0x1d')](_0x5e2255['include'],function(_0x48d0b7){return{'model':db[_0x48d0b7[_0x600d('0x1e')]],'as':_0x48d0b7['as'],'attributes':_0x48d0b7[_0x600d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x600d('0xd')](function(_0x5cfb6d){logger[_0x600d('0x1f')](_0x600d('0x16'),_0x24a80d);logger['debug'](_0x600d('0x16'),_0x24a80d,JSON[_0x600d('0x11')](_0x5cfb6d));_0x2b77e2(_0x5cfb6d);})[_0x600d('0x15')](function(_0xf9ba4c){logger['error'](_0x600d('0x16'),_0xf9ba4c[_0x600d('0x14')],_0x24a80d);_0x17ad1f(_0x490586['error'](0x1f4,_0xf9ba4c[_0x600d('0x14')]));});});};exports[_0x600d('0x20')]=function(_0x273739){var _0x219715=this;return new Promise(function(_0x2998ae,_0x2ac4e1){return db[_0x600d('0x17')][_0x600d('0x21')]({'raw':_0x273739[_0x600d('0x18')]?_0x273739[_0x600d('0x18')][_0x600d('0x19')]===undefined?!![]:![]:!![],'where':_0x273739[_0x600d('0x18')]?_0x273739['options']['where']||null:null,'attributes':_0x273739[_0x600d('0x18')]?_0x273739['options']['attributes']||null:null,'include':_0x273739['options']?_0x273739[_0x600d('0x18')][_0x600d('0x1c')]?_[_0x600d('0x1d')](_0x273739[_0x600d('0x18')]['include'],function(_0x168c51){return{'model':db[_0x168c51['model']],'as':_0x168c51['as'],'attributes':_0x168c51[_0x600d('0x1b')],'include':_0x168c51['include']?_['map'](_0x168c51[_0x600d('0x1c')],function(_0x68f7a5){return{'model':db[_0x68f7a5['model']],'as':_0x68f7a5['as'],'attributes':_0x68f7a5[_0x600d('0x1b')],'include':_0x68f7a5[_0x600d('0x1c')]?_[_0x600d('0x1d')](_0x68f7a5['include'],function(_0x3fdff5){return{'model':db[_0x3fdff5['model']],'as':_0x3fdff5['as'],'attributes':_0x3fdff5[_0x600d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x600d('0xd')](function(_0x1c0263){logger[_0x600d('0x1f')](_0x600d('0x20'),_0x273739);logger[_0x600d('0x22')](_0x600d('0x20'),_0x273739,JSON[_0x600d('0x11')](_0x1c0263));_0x2998ae(_0x1c0263);})[_0x600d('0x15')](function(_0x5a8c1d){logger['error'](_0x600d('0x20'),_0x5a8c1d[_0x600d('0x14')],_0x273739);_0x2ac4e1(_0x219715[_0x600d('0x12')](0x1f4,_0x5a8c1d[_0x600d('0x14')]));});});};exports[_0x600d('0x23')]=function(_0x3a5990){var _0x5c73db=this;return new Promise(function(_0x25a040,_0x5ea967){var _0x3c47e8;return db['User'][_0x600d('0x21')]({'where':_0x3a5990[_0x600d('0x18')][_0x600d('0x1a')]||{},'attributes':['id',_0x600d('0x24'),_0x600d('0x25'),_0x600d('0x26'),_0x600d('0x27')]})['then'](function(_0x50d098){if(_0x50d098){_0x3c47e8=_0x50d098;return db[_0x600d('0x28')][_0x600d('0x29')]({'paused':0x1},{'where':{'UserId':_0x3c47e8['id']},'individualHooks':!![]});}})[_0x600d('0xd')](function(){if(_0x3c47e8){return db[_0x600d('0x2a')][_0x600d('0x2b')]({'where':{'membername':_0x3c47e8[_0x600d('0x24')],'type':_0x600d('0x2c'),'exitAt':null}});}})[_0x600d('0xd')](function(_0x5c0d92){if(_0x3c47e8){if(_0x5c0d92&&_0x5c0d92[_0x600d('0x2d')]){var _0x4fb555=moment()['format'](_0x600d('0x2e'));for(var _0x59f83d=0x0,_0x5139bf=_0x5c0d92['length'];_0x59f83d<_0x5139bf;_0x59f83d++){_0x5c0d92[_0x59f83d][_0x600d('0x2f')]({'exitAt':_0x4fb555});}}}})[_0x600d('0xd')](function(){if(_0x3c47e8){var _0x1f88a0=[];var _0x1d8b40=utils[_0x600d('0x30')]();_0x1d8b40['forEach'](function(_0x3b6631){_0x1f88a0[_0x600d('0x31')]({'channel':_0x3b6631,'membername':_0x3c47e8[_0x600d('0x24')],'interface':_['isNil'](_0x3c47e8[_0x600d('0x27')])?util[_0x600d('0x32')](_0x600d('0x33'),_0x3c47e8[_0x600d('0x24')]):_0x3c47e8[_0x600d('0x27')],'type':_0x600d('0x2c'),'enterAt':moment()['format'](_0x600d('0x2e')),'data1':_0x3a5990[_0x600d('0x34')][_0x600d('0x35')]||_0x600d('0x36'),'role':_0x3c47e8[_0x600d('0x25')],'internal':_0x3c47e8[_0x600d('0x26')],'uniqueid':_0x3a5990['body'][_0x600d('0x37')]||null});});return db[_0x600d('0x2a')][_0x600d('0x38')](_0x1f88a0,{'individualHooks':!![]});}})[_0x600d('0xd')](function(){if(_0x3c47e8){return _0x3c47e8[_0x600d('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3a5990[_0x600d('0x34')]['type']||_0x600d('0x36'),'lastPauseAt':moment()[_0x600d('0x32')](_0x600d('0x2e'))});}})[_0x600d('0xd')](function(_0x3c0517){_0x25a040(_0x3c0517);})[_0x600d('0x15')](function(_0x24d046){_0x5ea967(_0x5c73db['error'](0x1f4,_0x24d046['message']));});});};exports[_0x600d('0x39')]=function(_0x2bcd88){var _0x614285=this;return new Promise(function(_0x2d5e0f,_0x4de53f){var _0x597eba;return db[_0x600d('0x17')][_0x600d('0x3a')]({'where':_0x2bcd88['options'][_0x600d('0x1a')]||{},'attributes':['id',_0x600d('0x24')]})[_0x600d('0xd')](function(_0xeaee86){if(_0xeaee86){_0x597eba=_0xeaee86;if(_0x2bcd88[_0x600d('0x34')]['channel']&&!utils[_0x600d('0x3b')](_0x2bcd88[_0x600d('0x34')][_0x600d('0x3c')])){throw new Error(_0x600d('0x3d'));}switch(_0x2bcd88[_0x600d('0x34')][_0x600d('0x3c')]){case _0x600d('0x3e'):return db[_0x600d('0x28')][_0x600d('0x29')]({'paused':0x0},{'where':{'UserId':_0x597eba['id']}})[_0x600d('0xd')](function(){return db[_0x600d('0x2a')][_0x600d('0x21')]({'where':{'channel':_0x2bcd88[_0x600d('0x34')][_0x600d('0x3c')],'membername':_0x597eba['name'],'type':_0x600d('0x2c'),'exitAt':null}});})[_0x600d('0xd')](function(_0x3b2d62){if(_0x3b2d62){return _0x3b2d62['update']({'exitAt':moment()['format'](_0x600d('0x2e')),'data2':_0x600d('0x3f')},{'individualHooks':!![]});}return null;})[_0x600d('0xd')](function(){return _0x597eba[_0x600d('0x29')]({'voicePause':![]});});case _0x600d('0x40'):case _0x600d('0x41'):case _0x600d('0x42'):case _0x600d('0x43'):case _0x600d('0x44'):case'whatsapp':return db[_0x600d('0x2a')][_0x600d('0x21')]({'where':{'channel':_0x2bcd88[_0x600d('0x34')][_0x600d('0x3c')],'membername':_0x597eba[_0x600d('0x24')],'type':_0x600d('0x2c'),'exitAt':null}})[_0x600d('0xd')](function(_0x40f706){return _0x40f706['update']({'exitAt':moment()[_0x600d('0x32')](_0x600d('0x2e')),'data2':_0x600d('0x3f')},{'individualHooks':!![]});})[_0x600d('0xd')](function(){var _0x9a880d={};_[_0x600d('0x45')](_0x9a880d,util[_0x600d('0x32')]('%s%s',_0x2bcd88[_0x600d('0x34')][_0x600d('0x3c')],_0x600d('0x46')),![]);return _0x597eba['update'](_0x9a880d);});default:return db[_0x600d('0x28')][_0x600d('0x29')]({'paused':0x0},{'where':{'UserId':_0x597eba['id']}})[_0x600d('0xd')](function(){return db[_0x600d('0x2a')][_0x600d('0x2b')]({'where':{'membername':_0x597eba[_0x600d('0x24')],'type':'PAUSE','exitAt':null}});})[_0x600d('0xd')](function(_0x3fcf63){var _0x883a8a=[];_0x3fcf63[_0x600d('0x47')](function(_0x19f46e){_0x883a8a[_0x600d('0x31')](_0x19f46e[_0x600d('0x29')]({'exitAt':moment()[_0x600d('0x32')](_0x600d('0x2e')),'data2':'system'}));});return BPromise[_0x600d('0x48')](_0x883a8a);})[_0x600d('0xd')](function(){return _0x597eba[_0x600d('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x3524a5){_0x2d5e0f(_0x3524a5);})[_0x600d('0x15')](function(_0x1e8f20){_0x4de53f(_0x614285[_0x600d('0x12')](0x1f4,_0x1e8f20[_0x600d('0x14')]));});});};exports[_0x600d('0x49')]=function(_0x268d3d){var _0x4e65bd=this;return new Promise(function(_0xa4216b,_0xdc3926){var _0x846e8b;return db[_0x600d('0x17')][_0x600d('0x3a')]({'where':_0x268d3d[_0x600d('0x18')][_0x600d('0x1a')]||{},'attributes':['id','name']})[_0x600d('0xd')](function(_0x5580f6){if(_0x5580f6){_0x846e8b=_0x5580f6;return db[_0x600d('0x28')]['destroy']({'where':{'membername':_0x846e8b[_0x600d('0x24')]},'individualHooks':!![]});}})[_0x600d('0xd')](function(){if(_0x846e8b){return db[_0x600d('0x2a')][_0x600d('0x2b')]({'where':{'membername':_0x846e8b[_0x600d('0x24')],'exitAt':null}});}})[_0x600d('0xd')](function(_0x444ba6){if(_0x846e8b){if(_0x444ba6&&_0x444ba6['length']){var _0x529476=[];_0x444ba6[_0x600d('0x47')](function(_0x5d5492){_0x529476[_0x600d('0x31')](_0x5d5492[_0x600d('0x29')]({'exitAt':moment()[_0x600d('0x32')](_0x600d('0x2e'))}));});return BPromise['all'](_0x529476);}}})[_0x600d('0xd')](function(){if(_0x846e8b){return _0x846e8b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5c684f){_0xa4216b(_0x5c684f);})[_0x600d('0x15')](function(_0x4a2bcf){_0xdc3926(_0x4e65bd['error'](0x1f4,_0x4a2bcf[_0x600d('0x14')]));});});};exports['LoginUser']=function(_0x256acb){var _0x4f125e=this;return new Promise(function(_0xd915c1,_0x52bd3b){var _0x15c48c;var _0x309c2b;var _0x225296;var _0x2525f4;return db[_0x600d('0x17')]['findOne']({'where':_0x256acb[_0x600d('0x18')][_0x600d('0x1a')]||{},'attributes':['id',_0x600d('0x24'),_0x600d('0x25'),'mobile',_0x600d('0x4a'),'internal',_0x600d('0x4b'),_0x600d('0x27')]})['then'](function(_0x45d244){if(_0x45d244){_0x15c48c=_0x45d244;_0x2525f4=_0x256acb[_0x600d('0x34')][_0x600d('0x27')]?_0x256acb[_0x600d('0x34')][_0x600d('0x27')]:util['format']('SIP/%s',_0x15c48c[_0x600d('0x24')]);return db[_0x600d('0x17')][_0x600d('0x4c')]({'where':{'role':_0x600d('0x4d'),'online':!![],'id':{'$ne':_0x15c48c['id']}}});}})[_0x600d('0xd')](function(_0x37679c){if(_0x37679c){_0x225296=_0x37679c;return require('../../config/license/util')[_0x600d('0x4e')]();}})[_0x600d('0xd')](function(_0x4a7195){if(_0x4a7195&&_0x4a7195[_0x600d('0x4f')]&&_0x225296>=_0x4a7195['agents']){throw new Error(_0x600d('0x50'));}})[_0x600d('0xd')](function(){if(_0x15c48c){return db[_0x600d('0x28')][_0x600d('0x51')]({'where':{'membername':_0x15c48c[_0x600d('0x24')]},'individualHooks':!![]});}})['then'](function(){if(_0x15c48c){return _0x15c48c['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2f361c){if(_0x15c48c){if(_0x2f361c){var _0x485264=[];_0x309c2b=_0x2f361c;if(_0x309c2b[_0x600d('0x2d')]){for(var _0xbc207a=0x0;_0xbc207a<_0x309c2b[_0x600d('0x2d')];_0xbc207a++){_0x485264[_0x600d('0x31')](db['UserVoiceQueueRt'][_0x600d('0x52')]({'membername':_0x15c48c[_0x600d('0x24')],'UserId':_0x15c48c['id'],'queue_name':_0x309c2b[_0xbc207a][_0x600d('0x24')],'VoiceQueueId':_0x309c2b[_0xbc207a]['id'],'interface':_0x2525f4,'paused':_0x15c48c[_0x600d('0x4b')]||![],'penalty':_0x309c2b[_0xbc207a]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x485264);}}}})['then'](function(){if(_0x15c48c){return db[_0x600d('0x2a')][_0x600d('0x2b')]({'where':{'membername':_0x15c48c[_0x600d('0x24')],'exitAt':null}});}})[_0x600d('0xd')](function(_0x324e9b){if(_0x15c48c){if(_0x324e9b&&_0x324e9b[_0x600d('0x2d')]){var _0x403d3b=[];_0x324e9b['forEach'](function(_0x5b3327){_0x403d3b[_0x600d('0x31')](_0x5b3327[_0x600d('0x29')]({'exitAt':moment()[_0x600d('0x32')](_0x600d('0x2e'))}));});return BPromise[_0x600d('0x48')](_0x403d3b);}}})[_0x600d('0xd')](function(_0x36e078){if(_0x15c48c){var _0x42c235=[];var _0x20e433=[];var _0x296c61=utils[_0x600d('0x30')]();var _0x1a6432={'membername':_0x15c48c[_0x600d('0x24')],'interface':_0x2525f4,'enterAt':moment()[_0x600d('0x32')](_0x600d('0x2e')),'role':_0x15c48c[_0x600d('0x25')],'internal':_0x15c48c[_0x600d('0x26')]};_0x296c61[_0x600d('0x47')](function(_0x138abf){_0x42c235[_0x600d('0x31')](_['merge']({'channel':_0x138abf,'type':_0x600d('0x53'),'data1':_0x600d('0x54'),'data2':_0x2525f4},_0x1a6432));if(_0x15c48c['loginInPause']){_0x20e433[_0x600d('0x31')](_['merge']({'channel':_0x138abf,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1a6432));}});return db[_0x600d('0x2a')]['bulkCreate'](_0x42c235['concat'](_0x20e433),{'individualHooks':!![]});}})[_0x600d('0xd')](function(){if(_0x15c48c){return _0x15c48c[_0x600d('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0x600d('0x2e')),'voicePause':_0x15c48c[_0x600d('0x4b')]||![],'mailPause':_0x15c48c[_0x600d('0x4b')]||![],'chatPause':_0x15c48c[_0x600d('0x4b')]||![],'faxPause':_0x15c48c[_0x600d('0x4b')]||![],'smsPause':_0x15c48c[_0x600d('0x4b')]||![],'openchannelPause':_0x15c48c[_0x600d('0x4b')]||![],'pauseType':_0x15c48c[_0x600d('0x4b')]?_0x600d('0x55'):null,'lastPauseAt':moment()[_0x600d('0x32')](_0x600d('0x2e')),'interface':_0x2525f4});}})[_0x600d('0xd')](function(_0x5e1fca){_0xd915c1(_0x5e1fca);})[_0x600d('0x15')](function(_0x24f968){_0x52bd3b(_0x4f125e[_0x600d('0x12')](0x1f4,_0x24f968[_0x600d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9f592fe..9989cef 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 _0x903e=['remove','update','emit','register','user:','./user.events','save'];(function(_0x1ad590,_0x1ea58e){var _0xc07ad9=function(_0x277e8b){while(--_0x277e8b){_0x1ad590['push'](_0x1ad590['shift']());}};_0xc07ad9(++_0x1ea58e);}(_0x903e,0x140));var _0xe903=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x903e[_0x4dcc2d];return _0x1bbd79;};'use strict';var UserEvents=require(_0xe903('0x0'));var events=[_0xe903('0x1'),_0xe903('0x2'),_0xe903('0x3')];function createListener(_0xd629c6,_0x5cd20d){return function(_0x5e723c){_0x5cd20d[_0xe903('0x4')](_0xd629c6,_0x5e723c);};}function removeListener(_0x5d709f,_0x42886b){return function(){UserEvents['removeListener'](_0x5d709f,_0x42886b);};}exports[_0xe903('0x5')]=function(_0x55c8af){for(var _0x321935=0x0,_0x73ada5=events['length'];_0x321935<_0x73ada5;_0x321935++){var _0x4fc9a6=events[_0x321935];var _0x12b477=createListener(_0xe903('0x6')+_0x4fc9a6,_0x55c8af);UserEvents['on'](_0x4fc9a6,_0x12b477);}}; \ No newline at end of file +var _0xb565=['remove','update','emit','register','length','./user.events'];(function(_0x3b10b5,_0x48e57f){var _0x5a6cf2=function(_0x278bf5){while(--_0x278bf5){_0x3b10b5['push'](_0x3b10b5['shift']());}};_0x5a6cf2(++_0x48e57f);}(_0xb565,0xd1));var _0x5b56=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0xb565[_0x4433b];return _0xffc1da;};'use strict';var UserEvents=require(_0x5b56('0x0'));var events=['save',_0x5b56('0x1'),_0x5b56('0x2')];function createListener(_0x146ceb,_0x35112c){return function(_0x1f3a98){_0x35112c[_0x5b56('0x3')](_0x146ceb,_0x1f3a98);};}function removeListener(_0x18e9ab,_0x54f5a4){return function(){UserEvents['removeListener'](_0x18e9ab,_0x54f5a4);};}exports[_0x5b56('0x4')]=function(_0x5355fd){for(var _0x4c30c7=0x0,_0x4019ef=events[_0x5b56('0x5')];_0x4c30c7<_0x4019ef;_0x4c30c7++){var _0x527e3d=events[_0x4c30c7];var _0x23c942=createListener('user:'+_0x527e3d,_0x5355fd);UserEvents['on'](_0x527e3d,_0x23c942);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b38837c..b0f2983 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x530102,_0x137163){var _0xb4b02=function(_0x580dc8){while(--_0x580dc8){_0x530102['push'](_0x530102['shift']());}};_0xb4b02(++_0x137163);}(_0xe706,0xa3));var _0x6e70=function(_0x18b165,_0x40a7ea){_0x18b165=_0x18b165-0x0;var _0x1d8e19=_0xe706[_0x18b165];return _0x1d8e19;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1a5968,_0x112eee){var _0x496e4c=function(_0x518bae){while(--_0x518bae){_0x1a5968['push'](_0x1a5968['shift']());}};_0x496e4c(++_0x112eee);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7660f50..5dc11d6 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa467=['sequelize','exports','INTEGER'];(function(_0x42f41b,_0x67e11f){var _0x4a4e89=function(_0xe261fa){while(--_0xe261fa){_0x42f41b['push'](_0x42f41b['shift']());}};_0x4a4e89(++_0x67e11f);}(_0xa467,0xde));var _0x7a46=function(_0x1524b7,_0xf9a3f7){_0x1524b7=_0x1524b7-0x0;var _0x51e3e2=_0xa467[_0x1524b7];return _0x51e3e2;};'use strict';var Sequelize=require(_0x7a46('0x0'));module[_0x7a46('0x1')]={'penalty':{'type':Sequelize[_0x7a46('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbeb4=['INTEGER','sequelize','exports'];(function(_0x4f6c26,_0x5c2c54){var _0x4809a0=function(_0x1b30a9){while(--_0x1b30a9){_0x4f6c26['push'](_0x4f6c26['shift']());}};_0x4809a0(++_0x5c2c54);}(_0xbeb4,0x172));var _0x4beb=function(_0x4fe6d2,_0x2d756c){_0x4fe6d2=_0x4fe6d2-0x0;var _0x3c7a33=_0xbeb4[_0x4fe6d2];return _0x3c7a33;};'use strict';var Sequelize=require(_0x4beb('0x0'));module[_0x4beb('0x1')]={'penalty':{'type':Sequelize[_0x4beb('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 970edad..855af97 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 _0xdcee=['user_has_chat_queues','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0xf58718,_0x33541a){var _0x5aea10=function(_0x16f386){while(--_0x16f386){_0xf58718['push'](_0xf58718['shift']());}};_0x5aea10(++_0x33541a);}(_0xdcee,0x109));var _0xedce=function(_0x812b4,_0x5c732f){_0x812b4=_0x812b4-0x0;var _0x1b1950=_0xdcee[_0x812b4];return _0x1b1950;};'use strict';var _=require('lodash');var util=require(_0xedce('0x0'));var logger=require(_0xedce('0x1'))(_0xedce('0x2'));var moment=require(_0xedce('0x3'));var BPromise=require(_0xedce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xedce('0x5'));var config=require(_0xedce('0x6'));var attributes=require(_0xedce('0x7'));module[_0xedce('0x8')]=function(_0x26a7de,_0x3b1c26){return _0x26a7de[_0xedce('0x9')](_0xedce('0xa'),attributes,{'tableName':_0xedce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62be=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e7a0b,_0x361476){var _0x46f55a=function(_0x9178bf){while(--_0x9178bf){_0x4e7a0b['push'](_0x4e7a0b['shift']());}};_0x46f55a(++_0x361476);}(_0x62be,0xf6));var _0xe62b=function(_0x26b0c7,_0x4809cb){_0x26b0c7=_0x26b0c7-0x0;var _0x494927=_0x62be[_0x26b0c7];return _0x494927;};'use strict';var _=require('lodash');var util=require(_0xe62b('0x0'));var logger=require(_0xe62b('0x1'))(_0xe62b('0x2'));var moment=require(_0xe62b('0x3'));var BPromise=require(_0xe62b('0x4'));var rp=require(_0xe62b('0x5'));var fs=require('fs');var path=require(_0xe62b('0x6'));var rimraf=require(_0xe62b('0x7'));var config=require(_0xe62b('0x8'));var attributes=require(_0xe62b('0x9'));module[_0xe62b('0xa')]=function(_0x1ae59a,_0x2edf81){return _0x1ae59a[_0xe62b('0xb')](_0xe62b('0xc'),attributes,{'tableName':_0xe62b('0xd'),'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 c64bdf0..89f0fe3 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 _0xcd5f=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x4ca484,_0x2bb0c9){var _0x5d5f4c=function(_0x36b860){while(--_0x36b860){_0x4ca484['push'](_0x4ca484['shift']());}};_0x5d5f4c(++_0x2bb0c9);}(_0xcd5f,0xe2));var _0xfcd5=function(_0x4f6941,_0x50a162){_0x4f6941=_0x4f6941-0x0;var _0x1ae6a1=_0xcd5f[_0x4f6941];return _0x1ae6a1;};'use strict';var _=require(_0xfcd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd5('0x1'));var rs=require(_0xfcd5('0x2'));var fs=require('fs');var Redis=require(_0xfcd5('0x3'));var db=require(_0xfcd5('0x4'))['db'];var utils=require(_0xfcd5('0x5'));var logger=require('../../config/logger')(_0xfcd5('0x6'));var config=require(_0xfcd5('0x7'));var jayson=require(_0xfcd5('0x8'));var client=jayson[_0xfcd5('0x9')][_0xfcd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x570c17,_0x415a00,_0x49ac52){return new BPromise(function(_0x1022c7,_0x278268){return client[_0xfcd5('0xb')](_0x570c17,_0x49ac52)['then'](function(_0x25aafe){logger[_0xfcd5('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x415a00,'request\x20sent');logger[_0xfcd5('0xd')](_0xfcd5('0xe'),_0x415a00,_0xfcd5('0xf'),JSON[_0xfcd5('0x10')](_0x25aafe));if(_0x25aafe[_0xfcd5('0x11')]){if(_0x25aafe[_0xfcd5('0x11')][_0xfcd5('0x12')]===0x1f4){logger[_0xfcd5('0x11')](_0xfcd5('0x13'),_0x415a00,_0x25aafe['error'][_0xfcd5('0x14')]);return _0x278268(_0x25aafe['error'][_0xfcd5('0x14')]);}logger[_0xfcd5('0x11')](_0xfcd5('0x13'),_0x415a00,_0x25aafe[_0xfcd5('0x11')]['message']);return _0x1022c7(_0x25aafe['error'][_0xfcd5('0x14')]);}else{logger[_0xfcd5('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x415a00,_0xfcd5('0xf'));_0x1022c7(_0x25aafe[_0xfcd5('0x15')][_0xfcd5('0x14')]);}})[_0xfcd5('0x16')](function(_0x1200e4){logger[_0xfcd5('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x415a00,_0x1200e4);_0x278268(_0x1200e4);});});} \ No newline at end of file +var _0x9174=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x9174,0x1d9));var _0x4917=function(_0x78e285,_0xf09c38){_0x78e285=_0x78e285-0x0;var _0x2c03ff=_0x9174[_0x78e285];return _0x2c03ff;};'use strict';var _=require('lodash');var util=require(_0x4917('0x0'));var moment=require(_0x4917('0x1'));var BPromise=require(_0x4917('0x2'));var rs=require(_0x4917('0x3'));var fs=require('fs');var Redis=require(_0x4917('0x4'));var db=require(_0x4917('0x5'))['db'];var utils=require(_0x4917('0x6'));var logger=require(_0x4917('0x7'))(_0x4917('0x8'));var config=require(_0x4917('0x9'));var jayson=require(_0x4917('0xa'));var client=jayson[_0x4917('0xb')][_0x4917('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48bd17,_0x28f495,_0x4f4acc){return new BPromise(function(_0x2c7a07,_0x30502b){return client[_0x4917('0xd')](_0x48bd17,_0x4f4acc)[_0x4917('0xe')](function(_0x5499e9){logger[_0x4917('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x28f495,_0x4917('0x10'));logger[_0x4917('0x11')](_0x4917('0x12'),_0x28f495,_0x4917('0x10'),JSON[_0x4917('0x13')](_0x5499e9));if(_0x5499e9[_0x4917('0x14')]){if(_0x5499e9[_0x4917('0x14')][_0x4917('0x15')]===0x1f4){logger['error'](_0x4917('0x16'),_0x28f495,_0x5499e9[_0x4917('0x14')][_0x4917('0x17')]);return _0x30502b(_0x5499e9[_0x4917('0x14')][_0x4917('0x17')]);}logger[_0x4917('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x28f495,_0x5499e9['error'][_0x4917('0x17')]);return _0x2c7a07(_0x5499e9[_0x4917('0x14')][_0x4917('0x17')]);}else{logger[_0x4917('0xf')](_0x4917('0x16'),_0x28f495,_0x4917('0x10'));_0x2c7a07(_0x5499e9['result']['message']);}})['catch'](function(_0x134c6c){logger[_0x4917('0x14')](_0x4917('0x16'),_0x28f495,_0x134c6c);_0x30502b(_0x134c6c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9b6221c..b005d0e 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x19616a,_0x545c46){var _0x57bfb4=function(_0x9ab37b){while(--_0x9ab37b){_0x19616a['push'](_0x19616a['shift']());}};_0x57bfb4(++_0x545c46);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x18fc83,_0x205c12){var _0x397c28=function(_0x545253){while(--_0x545253){_0x18fc83['push'](_0x18fc83['shift']());}};_0x397c28(++_0x205c12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 4b8b8c3..6284c60 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 _0xc61c=['sequelize','INTEGER'];(function(_0x5ad982,_0x5d7472){var _0x277911=function(_0x2b3ae5){while(--_0x2b3ae5){_0x5ad982['push'](_0x5ad982['shift']());}};_0x277911(++_0x5d7472);}(_0xc61c,0x162));var _0xcc61=function(_0x5524a4,_0x335747){_0x5524a4=_0x5524a4-0x0;var _0x53469d=_0xc61c[_0x5524a4];return _0x53469d;};'use strict';var Sequelize=require(_0xcc61('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcc61('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcc61('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7254=['sequelize','exports','INTEGER','STRING'];(function(_0x2a0034,_0x51c1a1){var _0x55c1b0=function(_0x349508){while(--_0x349508){_0x2a0034['push'](_0x2a0034['shift']());}};_0x55c1b0(++_0x51c1a1);}(_0x7254,0x164));var _0x4725=function(_0xd519cf,_0xd1c4b9){_0xd519cf=_0xd519cf-0x0;var _0x43b104=_0x7254[_0xd519cf];return _0x43b104;};'use strict';var Sequelize=require(_0x4725('0x0'));module[_0x4725('0x1')]={'penalty':{'type':Sequelize[_0x4725('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4725('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4725('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f4d8816..7cb971c 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 _0x857a=['moment','bluebird','request-promise','rimraf','./userFaxQueue.attributes','define','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x857a,0x80));var _0xa857=function(_0x39c8dd,_0x115225){_0x39c8dd=_0x39c8dd-0x0;var _0x462565=_0x857a[_0x39c8dd];return _0x462565;};'use strict';var _=require(_0xa857('0x0'));var util=require(_0xa857('0x1'));var logger=require(_0xa857('0x2'))(_0xa857('0x3'));var moment=require(_0xa857('0x4'));var BPromise=require(_0xa857('0x5'));var rp=require(_0xa857('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa857('0x7'));var config=require('../../config/environment');var attributes=require(_0xa857('0x8'));module['exports']=function(_0x49f965,_0x4bd9cd){return _0x49f965[_0xa857('0x9')]('UserFaxQueue',attributes,{'tableName':_0xa857('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe4c=['api','moment','request-promise','../../config/environment','./userFaxQueue.attributes','define','user_has_fax_queues','util','../../config/logger'];(function(_0x1c0d45,_0x3a9ee9){var _0x2ab11e=function(_0x272bc7){while(--_0x272bc7){_0x1c0d45['push'](_0x1c0d45['shift']());}};_0x2ab11e(++_0x3a9ee9);}(_0xbe4c,0x8e));var _0xcbe4=function(_0x1ba8db,_0x37a338){_0x1ba8db=_0x1ba8db-0x0;var _0x422a32=_0xbe4c[_0x1ba8db];return _0x422a32;};'use strict';var _=require('lodash');var util=require(_0xcbe4('0x0'));var logger=require(_0xcbe4('0x1'))(_0xcbe4('0x2'));var moment=require(_0xcbe4('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbe4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcbe4('0x5'));var attributes=require(_0xcbe4('0x6'));module['exports']=function(_0x3c73e8,_0x151062){return _0x3c73e8[_0xcbe4('0x7')]('UserFaxQueue',attributes,{'tableName':_0xcbe4('0x8'),'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 c0e7c89..5202606 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 _0x5955=['code','message','UserFaxQueue,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x5955,0x7b));var _0x5595=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x5955[_0x2a8c21];return _0x5f3061;};'use strict';var _=require('lodash');var util=require(_0x5595('0x0'));var moment=require(_0x5595('0x1'));var BPromise=require(_0x5595('0x2'));var rs=require(_0x5595('0x3'));var fs=require('fs');var Redis=require(_0x5595('0x4'));var db=require(_0x5595('0x5'))['db'];var utils=require(_0x5595('0x6'));var logger=require('../../config/logger')(_0x5595('0x7'));var config=require(_0x5595('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5595('0x9')][_0x5595('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b170a,_0x2baba8,_0x1ff70d){return new BPromise(function(_0x2d04b5,_0x1a13f6){return client['request'](_0x2b170a,_0x1ff70d)['then'](function(_0x14019f){logger[_0x5595('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x2baba8,_0x5595('0xc'));logger[_0x5595('0xd')](_0x5595('0xe'),_0x2baba8,'request\x20sent',JSON[_0x5595('0xf')](_0x14019f));if(_0x14019f[_0x5595('0x10')]){if(_0x14019f[_0x5595('0x10')][_0x5595('0x11')]===0x1f4){logger[_0x5595('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2baba8,_0x14019f[_0x5595('0x10')][_0x5595('0x12')]);return _0x1a13f6(_0x14019f[_0x5595('0x10')][_0x5595('0x12')]);}logger['error'](_0x5595('0x13'),_0x2baba8,_0x14019f['error'][_0x5595('0x12')]);return _0x2d04b5(_0x14019f[_0x5595('0x10')]['message']);}else{logger[_0x5595('0xb')](_0x5595('0x13'),_0x2baba8,'request\x20sent');_0x2d04b5(_0x14019f['result'][_0x5595('0x12')]);}})['catch'](function(_0x51c816){logger[_0x5595('0x10')](_0x5595('0x13'),_0x2baba8,_0x51c816);_0x1a13f6(_0x51c816);});});} \ No newline at end of file +var _0x9348=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2114c2,_0x4131b8){var _0x1b247f=function(_0x767cdc){while(--_0x767cdc){_0x2114c2['push'](_0x2114c2['shift']());}};_0x1b247f(++_0x4131b8);}(_0x9348,0x1a3));var _0x8934=function(_0x40c298,_0x27c469){_0x40c298=_0x40c298-0x0;var _0x183678=_0x9348[_0x40c298];return _0x183678;};'use strict';var _=require('lodash');var util=require(_0x8934('0x0'));var moment=require(_0x8934('0x1'));var BPromise=require(_0x8934('0x2'));var rs=require(_0x8934('0x3'));var fs=require('fs');var Redis=require(_0x8934('0x4'));var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require(_0x8934('0x7'))(_0x8934('0x8'));var config=require(_0x8934('0x9'));var jayson=require(_0x8934('0xa'));var client=jayson[_0x8934('0xb')][_0x8934('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52114d,_0x732b5d,_0x592e3d){return new BPromise(function(_0x5972f2,_0x407b1d){return client[_0x8934('0xd')](_0x52114d,_0x592e3d)[_0x8934('0xe')](function(_0x658ae){logger[_0x8934('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x732b5d,'request\x20sent');logger['debug'](_0x8934('0x10'),_0x732b5d,_0x8934('0x11'),JSON[_0x8934('0x12')](_0x658ae));if(_0x658ae[_0x8934('0x13')]){if(_0x658ae[_0x8934('0x13')][_0x8934('0x14')]===0x1f4){logger[_0x8934('0x13')](_0x8934('0x15'),_0x732b5d,_0x658ae[_0x8934('0x13')][_0x8934('0x16')]);return _0x407b1d(_0x658ae['error'][_0x8934('0x16')]);}logger[_0x8934('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x732b5d,_0x658ae['error'][_0x8934('0x16')]);return _0x5972f2(_0x658ae[_0x8934('0x13')][_0x8934('0x16')]);}else{logger['info'](_0x8934('0x15'),_0x732b5d,'request\x20sent');_0x5972f2(_0x658ae[_0x8934('0x17')]['message']);}})[_0x8934('0x18')](function(_0x3553ce){logger['error'](_0x8934('0x15'),_0x732b5d,_0x3553ce);_0x407b1d(_0x3553ce);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d12ceab..aeddbb9 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x263999,_0x477176){var _0x336996=function(_0x43c50a){while(--_0x43c50a){_0x263999['push'](_0x263999['shift']());}};_0x336996(++_0x477176);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x51fca6,_0x914273){var _0x13708f=function(_0x56efd7){while(--_0x56efd7){_0x51fca6['push'](_0x51fca6['shift']());}};_0x13708f(++_0x914273);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a1f7cfa..855ad42 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 _0xf0cc=['sequelize','exports','INTEGER'];(function(_0x2ea68e,_0x593e70){var _0x9119bd=function(_0x44449c){while(--_0x44449c){_0x2ea68e['push'](_0x2ea68e['shift']());}};_0x9119bd(++_0x593e70);}(_0xf0cc,0xf3));var _0xcf0c=function(_0x7b14f3,_0x3ee42e){_0x7b14f3=_0x7b14f3-0x0;var _0x2e5559=_0xf0cc[_0x7b14f3];return _0x2e5559;};'use strict';var Sequelize=require(_0xcf0c('0x0'));module[_0xcf0c('0x1')]={'penalty':{'type':Sequelize[_0xcf0c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77b0=['sequelize','exports','INTEGER'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x77b0,0x8d));var _0x077b=function(_0x3593a5,_0x465d22){_0x3593a5=_0x3593a5-0x0;var _0x25cc33=_0x77b0[_0x3593a5];return _0x25cc33;};'use strict';var Sequelize=require(_0x077b('0x0'));module[_0x077b('0x1')]={'penalty':{'type':Sequelize[_0x077b('0x2')],'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 e7aaed9..e66ea5c 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 _0xc4e5=['rimraf','./userMailQueue.attributes','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x90dd9c,_0x27e98f){var _0x4aff84=function(_0x41d36e){while(--_0x41d36e){_0x90dd9c['push'](_0x90dd9c['shift']());}};_0x4aff84(++_0x27e98f);}(_0xc4e5,0xc9));var _0x5c4e=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xc4e5[_0x1ad926];return _0x1b81dc;};'use strict';var _=require(_0x5c4e('0x0'));var util=require(_0x5c4e('0x1'));var logger=require(_0x5c4e('0x2'))(_0x5c4e('0x3'));var moment=require(_0x5c4e('0x4'));var BPromise=require(_0x5c4e('0x5'));var rp=require(_0x5c4e('0x6'));var fs=require('fs');var path=require(_0x5c4e('0x7'));var rimraf=require(_0x5c4e('0x8'));var config=require('../../config/environment');var attributes=require(_0x5c4e('0x9'));module['exports']=function(_0x5dde76,_0x283ed8){return _0x5dde76['define'](_0x5c4e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8d8=['path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13cfcf,_0x47c5c3){var _0x3aaaf1=function(_0x241bee){while(--_0x241bee){_0x13cfcf['push'](_0x13cfcf['shift']());}};_0x3aaaf1(++_0x47c5c3);}(_0xe8d8,0x73));var _0x8e8d=function(_0x23c00d,_0x1c9faf){_0x23c00d=_0x23c00d-0x0;var _0x2e51a6=_0xe8d8[_0x23c00d];return _0x2e51a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8e8d('0x0'))(_0x8e8d('0x1'));var moment=require(_0x8e8d('0x2'));var BPromise=require(_0x8e8d('0x3'));var rp=require(_0x8e8d('0x4'));var fs=require('fs');var path=require(_0x8e8d('0x5'));var rimraf=require(_0x8e8d('0x6'));var config=require(_0x8e8d('0x7'));var attributes=require(_0x8e8d('0x8'));module['exports']=function(_0x1ec587,_0x23366b){return _0x1ec587[_0x8e8d('0x9')](_0x8e8d('0xa'),attributes,{'tableName':_0x8e8d('0xb'),'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 47a86c5..4e94bbc 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x38ef19,_0x2a0114){var _0x3b5f10=function(_0x20129a){while(--_0x20129a){_0x38ef19['push'](_0x38ef19['shift']());}};_0x3b5f10(++_0x2a0114);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x00bb[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x2ee799,_0x4c2c18){var _0x496ec1=function(_0x158288){while(--_0x158288){_0x2ee799['push'](_0x2ee799['shift']());}};_0x496ec1(++_0x4c2c18);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x4b84[_0x5f5cce];return _0x705ecf;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 751af41..5defc3f 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 _0xd56d=['isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x400369,_0x5e414c){var _0x163d2d=function(_0x1c90cb){while(--_0x1c90cb){_0x400369['push'](_0x400369['shift']());}};_0x163d2d(++_0x5e414c);}(_0xd56d,0x17b));var _0xdd56=function(_0x552dec,_0x27a96d){_0x552dec=_0x552dec-0x0;var _0xcd5ca6=_0xd56d[_0x552dec];return _0xcd5ca6;};'use strict';var multer=require(_0xdd56('0x0'));var util=require(_0xdd56('0x1'));var path=require(_0xdd56('0x2'));var timeout=require(_0xdd56('0x3'));var express=require(_0xdd56('0x4'));var router=express[_0xdd56('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdd56('0x6'));var interaction=require(_0xdd56('0x7'));var config=require(_0xdd56('0x8'));var controller=require(_0xdd56('0x9'));router[_0xdd56('0xa')]('/',auth[_0xdd56('0xb')](),controller['sendUserNotification']);module[_0xdd56('0xc')]=router; \ No newline at end of file +var _0x4b09=['../../components/auth/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b09,0x15a));var _0x94b0=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x4b09[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0x94b0('0x0'));var util=require(_0x94b0('0x1'));var path=require(_0x94b0('0x2'));var timeout=require(_0x94b0('0x3'));var express=require(_0x94b0('0x4'));var router=express[_0x94b0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x94b0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94b0('0x7'));router[_0x94b0('0x8')]('/',auth[_0x94b0('0x9')](),controller[_0x94b0('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 388c81a..b432af0 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 _0x607f=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x1f164d,_0x4cef92){var _0x474599=function(_0x4beded){while(--_0x4beded){_0x1f164d['push'](_0x1f164d['shift']());}};_0x474599(++_0x4cef92);}(_0x607f,0x145));var _0xf607=function(_0x559339,_0x1cc49a){_0x559339=_0x559339-0x0;var _0x1ba106=_0x607f[_0x559339];return _0x1ba106;};'use strict';var Sequelize=require(_0xf607('0x0'));module[_0xf607('0x1')]={'body':{'type':Sequelize[_0xf607('0x2')]},'senderName':{'type':Sequelize[_0xf607('0x3')]},'recipientsId':{'type':Sequelize[_0xf607('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf607('0x3')]},'beep':{'type':Sequelize[_0xf607('0x4')]}}; \ No newline at end of file +var _0x5fe7=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3c5433,_0x347433){var _0x53892c=function(_0x2b73f3){while(--_0x2b73f3){_0x3c5433['push'](_0x3c5433['shift']());}};_0x53892c(++_0x347433);}(_0x5fe7,0x142));var _0x75fe=function(_0x30fc52,_0x8fca2c){_0x30fc52=_0x30fc52-0x0;var _0x57a8c6=_0x5fe7[_0x30fc52];return _0x57a8c6;};'use strict';var Sequelize=require(_0x75fe('0x0'));module[_0x75fe('0x1')]={'body':{'type':Sequelize[_0x75fe('0x2')]},'senderName':{'type':Sequelize[_0x75fe('0x3')]},'recipientsId':{'type':Sequelize[_0x75fe('0x2')]},'recipientsDescription':{'type':Sequelize[_0x75fe('0x3')]},'beep':{'type':Sequelize[_0x75fe('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index f161a26..a975ac7 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 _0x7033=['union','flatten','findOne','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','html','render','startCase','model','ids','queue','replace','Queue','push','all'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7033,0x69));var _0x3703=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7033[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x3703('0x0'));var rimraf=require(_0x3703('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3703('0x2'));var rp=require(_0x3703('0x3'));var moment=require(_0x3703('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3703('0x5'));var path=require(_0x3703('0x6'));var sox=require(_0x3703('0x7'));var csv=require(_0x3703('0x8'));var ejs=require(_0x3703('0x9'));var fs=require('fs');var fs_extra=require(_0x3703('0xa'));var _=require(_0x3703('0xb'));var squel=require(_0x3703('0xc'));var crypto=require(_0x3703('0xd'));var jsforce=require(_0x3703('0xe'));var deskjs=require(_0x3703('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3703('0x10'));var Papa=require(_0x3703('0x11'));var Redis=require(_0x3703('0x12'));var authService=require(_0x3703('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3703('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3703('0x15'));var db=require(_0x3703('0x16'))['db'];config[_0x3703('0x17')]=_[_0x3703('0x18')](config[_0x3703('0x17')],{'host':_0x3703('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3703('0x17')]));require(_0x3703('0x1a'))[_0x3703('0x1b')](socket);function respondWithStatusCode(_0x2eff4f,_0x5770fc){_0x5770fc=_0x5770fc||0xcc;return function(_0x27e09a){if(_0x27e09a){return _0x2eff4f[_0x3703('0x1c')](_0x5770fc);}return _0x2eff4f[_0x3703('0x1d')](_0x5770fc)[_0x3703('0x1e')]();};}function respondWithResult(_0x7d702b,_0x4bd05b){_0x4bd05b=_0x4bd05b||0xc8;return function(_0x1f5708){if(_0x1f5708){return _0x7d702b[_0x3703('0x1d')](_0x4bd05b)['json'](_0x1f5708);}};}function respondWithFilteredResult(_0x5a16b3,_0x8f4a13){return function(_0x270a7b){if(_0x270a7b){var _0x23938c=typeof _0x8f4a13['offset']===_0x3703('0x1f')&&typeof _0x8f4a13[_0x3703('0x20')]===_0x3703('0x1f');var _0x50a084=_0x270a7b[_0x3703('0x21')];var _0x4e8d60=_0x23938c?0x0:_0x8f4a13['offset'];var _0x2e0d17=_0x23938c?_0x270a7b[_0x3703('0x21')]:_0x8f4a13[_0x3703('0x22')]+_0x8f4a13[_0x3703('0x20')];var _0x399c3e;if(_0x2e0d17>=_0x50a084){_0x2e0d17=_0x50a084;_0x399c3e=0xc8;}else{_0x399c3e=0xce;}_0x5a16b3['status'](_0x399c3e);return _0x5a16b3[_0x3703('0x23')](_0x3703('0x24'),_0x4e8d60+'-'+_0x2e0d17+'/'+_0x50a084)[_0x3703('0x25')](_0x270a7b);}return null;};}function patchUpdates(_0x3da6de){return function(_0x3b5b2f){try{jsonpatch['apply'](_0x3b5b2f,_0x3da6de,!![]);}catch(_0xeb6833){return BPromise[_0x3703('0x26')](_0xeb6833);}return _0x3b5b2f[_0x3703('0x27')]();};}function saveUpdates(_0x6fb972,_0x1bb9fd){return function(_0x4f4ec5){if(_0x4f4ec5){return _0x4f4ec5[_0x3703('0x28')](_0x6fb972)[_0x3703('0x29')](function(_0x3f511c){return _0x3f511c;});}return null;};}function removeEntity(_0x151a14,_0x3d75ad){return function(_0x4a5f40){if(_0x4a5f40){return _0x4a5f40[_0x3703('0x2a')]()[_0x3703('0x29')](function(){_0x151a14[_0x3703('0x1d')](0xcc)[_0x3703('0x1e')]();});}};}function handleEntityNotFound(_0x4031ea,_0x4b6fb7){return function(_0x5fbbad){if(!_0x5fbbad){_0x4031ea['sendStatus'](0x194);}return _0x5fbbad;};}function handleError(_0x36d44c,_0x1a1647){_0x1a1647=_0x1a1647||0x1f4;return function(_0x521bbc){logger[_0x3703('0x2b')](_0x521bbc[_0x3703('0x2c')]);if(_0x521bbc['name']){delete _0x521bbc[_0x3703('0x2d')];}_0x36d44c[_0x3703('0x1d')](_0x1a1647)[_0x3703('0x2e')](_0x521bbc);};}exports[_0x3703('0x2f')]=function(_0x3e891d,_0x25676a,_0x438d40){if(!_0x3e891d[_0x3703('0x30')][_0x3703('0x31')](_0x3703('0x32'))&&!_0x3e891d['body'][_0x3703('0x31')](_0x3703('0x33'))){throw new db[(_0x3703('0x34'))][(_0x3703('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3e891d[_0x3703('0x30')][_0x3703('0x31')](_0x3703('0x33'))&&!_0x3e891d[_0x3703('0x30')][_0x3703('0x31')](_0x3703('0x36'))){throw new db[(_0x3703('0x34'))][(_0x3703('0x35'))](_0x3703('0x37'));}if(!_0x3e891d[_0x3703('0x30')][_0x3703('0x31')](_0x3703('0x38'))){throw new db[(_0x3703('0x34'))][(_0x3703('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x297f49=JSON[_0x3703('0x39')](_0x3e891d[_0x3703('0x30')][_0x3703('0x38')]);}catch(_0x21456b){logger['error'](_0x21456b);throw new db[(_0x3703('0x34'))][(_0x3703('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3da864=[_0x3703('0x3a'),_0x3703('0x3b'),_0x3703('0x3c'),'openchannelqueue',_0x3703('0x3d'),_0x3703('0x3e'),_0x3703('0x3f'),_0x3703('0x40'),_0x3703('0x41')];if(_[_0x3703('0x42')](_0x297f49,function(_0xea510b){return!_[_0x3703('0x43')](_0x3da864,_0xea510b['model'][_0x3703('0x44')]());})){throw new db[(_0x3703('0x34'))]['ValidationError'](_0x3703('0x45'));}}}var _0x12c407={};_0x12c407[_0x3703('0x46')]=_0x3e891d[_0x3703('0x30')]['hasOwnProperty'](_0x3703('0x46'))?_0x3e891d[_0x3703('0x30')][_0x3703('0x46')]:_0x3e891d[_0x3703('0x41')][_0x3703('0x47')];_0x12c407[_0x3703('0x48')]=_[_0x3703('0x49')](_0x3e891d[_0x3703('0x30')][_0x3703('0x48')])?null:_0x3e891d[_0x3703('0x30')][_0x3703('0x48')];_0x12c407['beep']=_0x3e891d[_0x3703('0x30')][_0x3703('0x4a')]||![];_0x12c407[_0x3703('0x4b')]=_0x3e891d[_0x3703('0x41')]['id'];return getContent(_0x3e891d[_0x3703('0x30')])[_0x3703('0x29')](function(_0x323e71){_0x12c407[_0x3703('0x30')]=_0x323e71;return getRecipients(_0x297f49);})[_0x3703('0x29')](function(_0xc5f30a){_0x12c407[_0x3703('0x4c')]=_[_0x3703('0x4d')](_0xc5f30a)[_0x3703('0x4e')](',');return db['sequelize'][_0x3703('0x4f')](function(_0x542cff){return db[_0x3703('0x50')][_0x3703('0x51')](_0x12c407,{'raw':!![],'transaction':_0x542cff})['then'](function(_0x23ae65){var _0x4d4fae={'sender':_0x12c407['senderName'],'description':_0x12c407['recipientsDescription'],'content':_0x12c407['body'],'beep':_0x12c407[_0x3703('0x4a')]};_0xc5f30a[_0x3703('0x52')](function(_0x4e4215){_0x4d4fae[_0x3703('0x53')]=_0x4e4215;socket[_0x3703('0x54')](_0x3703('0x55'),_0x4d4fae);});return _0x23ae65;});});})[_0x3703('0x29')](respondWithResult(_0x25676a,0xc9))[_0x3703('0x56')](handleError(_0x25676a,null));};function getContent(_0x2c1701){return new BPromise(function(_0x18eb15,_0x190914){if(_0x2c1701[_0x3703('0x32')]){_0x18eb15(_0x2c1701[_0x3703('0x32')]);return;}return db['Template']['findOne']({'attributes':[_0x3703('0x57')],'where':{'id':_0x2c1701['TemplateId']},'raw':!![]})[_0x3703('0x29')](function(_0x3e8825){if(!_0x3e8825)throw new db['Sequelize'][(_0x3703('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3780af=Mustache[_0x3703('0x58')](_0x3e8825['html'],_0x2c1701[_0x3703('0x36')]);_0x18eb15(_0x3780af);})[_0x3703('0x56')](function(_0x3dc313){_0x190914(_0x3dc313);});});}function getRecipients(_0x467237){return new BPromise(function(_0x492cb3,_0x498e48){var _0x529a97=[];var _0x49e672=[];_0x467237[_0x3703('0x52')](function(_0x17e96c){var _0x10b3a8=_[_0x3703('0x59')](_0x17e96c[_0x3703('0x5a')][_0x3703('0x44')]());if(_0x10b3a8==='User'){_0x529a97=_['union'](_0x529a97,_0x17e96c[_0x3703('0x5b')]);}else{if(_['includes'](_0x10b3a8,_0x3703('0x5c')))_0x10b3a8=_0x10b3a8[_0x3703('0x5d')](_0x3703('0x5c'),_0x3703('0x5e'));_0x17e96c[_0x3703('0x5b')][_0x3703('0x52')](function(_0x39961b){_0x49e672[_0x3703('0x5f')](getAgents(_0x10b3a8,_0x39961b));});}});return BPromise[_0x3703('0x60')](_0x49e672)[_0x3703('0x29')](function(_0xe383e2){_0x529a97=_[_0x3703('0x61')](_0x529a97,_[_0x3703('0x62')](_0xe383e2));_0x492cb3(_0x529a97);})[_0x3703('0x56')](function(_0x282207){_0x498e48(_0x282207);});});}function getAgents(_0x385bf9,_0x4a80a7){return new BPromise(function(_0x5a4ccb,_0x3b8226){return db[_0x385bf9][_0x3703('0x63')]({'where':{'id':_0x4a80a7}})[_0x3703('0x29')](function(_0xc8e6d6){return _0xc8e6d6[_0x3703('0x64')]({'attributes':['id'],'raw':!![]})[_0x3703('0x29')](function(_0x4e92e5){var _0x5cbbf=_['map'](_0x4e92e5,'id');_0x5a4ccb(_0x5cbbf);});})[_0x3703('0x56')](function(_0x418589){_0x3b8226(_0x418589);});});} \ No newline at end of file +var _0x1dc2=['join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','ids','includes','queue','replace','Queue','all','flatten','getAgents','map','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','sendUserNotification','body','hasOwnProperty','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy'];(function(_0x45521d,_0x169dfe){var _0x24f9ed=function(_0x54a0e4){while(--_0x54a0e4){_0x45521d['push'](_0x45521d['shift']());}};_0x24f9ed(++_0x169dfe);}(_0x1dc2,0x7e));var _0x21dc=function(_0x171996,_0x1a1d64){_0x171996=_0x171996-0x0;var _0x8c711a=_0x1dc2[_0x171996];return _0x8c711a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21dc('0x1'));var rp=require(_0x21dc('0x2'));var moment=require(_0x21dc('0x3'));var BPromise=require(_0x21dc('0x4'));var Mustache=require(_0x21dc('0x5'));var util=require(_0x21dc('0x6'));var path=require(_0x21dc('0x7'));var sox=require(_0x21dc('0x8'));var csv=require(_0x21dc('0x9'));var ejs=require(_0x21dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21dc('0xb'));var squel=require(_0x21dc('0xc'));var crypto=require(_0x21dc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x21dc('0xe'));var toCsv=require(_0x21dc('0x9'));var querystring=require('querystring');var Papa=require(_0x21dc('0xf'));var Redis=require('ioredis');var authService=require(_0x21dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x21dc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21dc('0x12'))(_0x21dc('0x13'));var utils=require(_0x21dc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x21dc('0x15'));var db=require(_0x21dc('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x21dc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x21dc('0x18')](socket);function respondWithStatusCode(_0x3faaa7,_0x3e4eb5){_0x3e4eb5=_0x3e4eb5||0xcc;return function(_0x1b5343){if(_0x1b5343){return _0x3faaa7['sendStatus'](_0x3e4eb5);}return _0x3faaa7[_0x21dc('0x19')](_0x3e4eb5)[_0x21dc('0x1a')]();};}function respondWithResult(_0x487782,_0x525f2d){_0x525f2d=_0x525f2d||0xc8;return function(_0x2d4de3){if(_0x2d4de3){return _0x487782['status'](_0x525f2d)[_0x21dc('0x1b')](_0x2d4de3);}};}function respondWithFilteredResult(_0x19660d,_0x1727f5){return function(_0x30841b){if(_0x30841b){var _0x38b6b2=typeof _0x1727f5['offset']===_0x21dc('0x1c')&&typeof _0x1727f5[_0x21dc('0x1d')]===_0x21dc('0x1c');var _0x60bdf5=_0x30841b[_0x21dc('0x1e')];var _0x3db460=_0x38b6b2?0x0:_0x1727f5[_0x21dc('0x1f')];var _0x40471e=_0x38b6b2?_0x30841b[_0x21dc('0x1e')]:_0x1727f5[_0x21dc('0x1f')]+_0x1727f5[_0x21dc('0x1d')];var _0x3a1004;if(_0x40471e>=_0x60bdf5){_0x40471e=_0x60bdf5;_0x3a1004=0xc8;}else{_0x3a1004=0xce;}_0x19660d[_0x21dc('0x19')](_0x3a1004);return _0x19660d['set'](_0x21dc('0x20'),_0x3db460+'-'+_0x40471e+'/'+_0x60bdf5)[_0x21dc('0x1b')](_0x30841b);}return null;};}function patchUpdates(_0x3c3d43){return function(_0x5673bb){try{jsonpatch[_0x21dc('0x21')](_0x5673bb,_0x3c3d43,!![]);}catch(_0x3b93da){return BPromise[_0x21dc('0x22')](_0x3b93da);}return _0x5673bb[_0x21dc('0x23')]();};}function saveUpdates(_0x3e283f,_0x1f1caf){return function(_0x255cd9){if(_0x255cd9){return _0x255cd9['update'](_0x3e283f)[_0x21dc('0x24')](function(_0x263b39){return _0x263b39;});}return null;};}function removeEntity(_0x52f60b,_0x352e5c){return function(_0x1c278c){if(_0x1c278c){return _0x1c278c[_0x21dc('0x25')]()[_0x21dc('0x24')](function(){_0x52f60b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0fc4,_0x4c8b5b){return function(_0x43632b){if(!_0x43632b){_0x4b0fc4[_0x21dc('0x26')](0x194);}return _0x43632b;};}function handleError(_0x10be1b,_0x17f93f){_0x17f93f=_0x17f93f||0x1f4;return function(_0x2542fb){logger['error'](_0x2542fb[_0x21dc('0x27')]);if(_0x2542fb[_0x21dc('0x28')]){delete _0x2542fb[_0x21dc('0x28')];}_0x10be1b[_0x21dc('0x19')](_0x17f93f)['send'](_0x2542fb);};}exports[_0x21dc('0x29')]=function(_0x2a31cb,_0x29151b,_0x175249){if(!_0x2a31cb[_0x21dc('0x2a')]['hasOwnProperty']('text')&&!_0x2a31cb[_0x21dc('0x2a')][_0x21dc('0x2b')]('TemplateId')){throw new db['Sequelize'][(_0x21dc('0x2c'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2a31cb[_0x21dc('0x2a')][_0x21dc('0x2b')](_0x21dc('0x2d'))&&!_0x2a31cb[_0x21dc('0x2a')]['hasOwnProperty'](_0x21dc('0x2e'))){throw new db['Sequelize']['ValidationError'](_0x21dc('0x2f'));}if(!_0x2a31cb[_0x21dc('0x2a')][_0x21dc('0x2b')](_0x21dc('0x30'))){throw new db[(_0x21dc('0x31'))][(_0x21dc('0x2c'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1d592b=JSON[_0x21dc('0x32')](_0x2a31cb['body'][_0x21dc('0x30')]);}catch(_0x438e7e){logger[_0x21dc('0x33')](_0x438e7e);throw new db[(_0x21dc('0x31'))][(_0x21dc('0x2c'))](_0x21dc('0x34'));}var _0x5c1354=[_0x21dc('0x35'),'faxqueue',_0x21dc('0x36'),_0x21dc('0x37'),_0x21dc('0x38'),_0x21dc('0x39'),_0x21dc('0x3a'),_0x21dc('0x3b'),_0x21dc('0x3c')];if(_[_0x21dc('0x3d')](_0x1d592b,function(_0x3fc9be){return!_['includes'](_0x5c1354,_0x3fc9be['model'][_0x21dc('0x3e')]());})){throw new db[(_0x21dc('0x31'))]['ValidationError'](_0x21dc('0x3f'));}}}var _0x1fa566={};_0x1fa566[_0x21dc('0x40')]=_0x2a31cb[_0x21dc('0x2a')][_0x21dc('0x2b')](_0x21dc('0x40'))?_0x2a31cb[_0x21dc('0x2a')]['senderName']:_0x2a31cb[_0x21dc('0x3c')][_0x21dc('0x41')];_0x1fa566[_0x21dc('0x42')]=_[_0x21dc('0x43')](_0x2a31cb[_0x21dc('0x2a')][_0x21dc('0x42')])?null:_0x2a31cb['body'][_0x21dc('0x42')];_0x1fa566[_0x21dc('0x44')]=_0x2a31cb[_0x21dc('0x2a')][_0x21dc('0x44')]||![];_0x1fa566[_0x21dc('0x45')]=_0x2a31cb['user']['id'];return getContent(_0x2a31cb['body'])[_0x21dc('0x24')](function(_0x4731f6){_0x1fa566[_0x21dc('0x2a')]=_0x4731f6;return getRecipients(_0x1d592b);})[_0x21dc('0x24')](function(_0x50f830){_0x1fa566[_0x21dc('0x46')]=_[_0x21dc('0x47')](_0x50f830)[_0x21dc('0x48')](',');return db[_0x21dc('0x49')][_0x21dc('0x4a')](function(_0xd50a){return db[_0x21dc('0x4b')][_0x21dc('0x4c')](_0x1fa566,{'raw':!![],'transaction':_0xd50a})[_0x21dc('0x24')](function(_0x5cc024){var _0x18d9f6={'sender':_0x1fa566[_0x21dc('0x40')],'description':_0x1fa566['recipientsDescription'],'content':_0x1fa566[_0x21dc('0x2a')],'beep':_0x1fa566[_0x21dc('0x44')]};_0x50f830[_0x21dc('0x4d')](function(_0x910678){_0x18d9f6[_0x21dc('0x4e')]=_0x910678;socket[_0x21dc('0x4f')](_0x21dc('0x50'),_0x18d9f6);});return _0x5cc024;});});})['then'](respondWithResult(_0x29151b,0xc9))[_0x21dc('0x51')](handleError(_0x29151b,null));};function getContent(_0xfa872c){return new BPromise(function(_0x353d8f,_0x2ee056){if(_0xfa872c[_0x21dc('0x52')]){_0x353d8f(_0xfa872c[_0x21dc('0x52')]);return;}return db['Template'][_0x21dc('0x53')]({'attributes':['html'],'where':{'id':_0xfa872c['TemplateId']},'raw':!![]})[_0x21dc('0x24')](function(_0x4c305d){if(!_0x4c305d)throw new db['Sequelize'][(_0x21dc('0x2c'))](_0x21dc('0x54'));var _0xf170b9=Mustache[_0x21dc('0x55')](_0x4c305d[_0x21dc('0x56')],_0xfa872c['view']);_0x353d8f(_0xf170b9);})['catch'](function(_0x57035c){_0x2ee056(_0x57035c);});});}function getRecipients(_0x427d64){return new BPromise(function(_0xdb0707,_0x1a989f){var _0x27d0d7=[];var _0x3b8ea9=[];_0x427d64['forEach'](function(_0x61b8f8){var _0x3e9af5=_[_0x21dc('0x57')](_0x61b8f8['model'][_0x21dc('0x3e')]());if(_0x3e9af5===_0x21dc('0x58')){_0x27d0d7=_[_0x21dc('0x59')](_0x27d0d7,_0x61b8f8[_0x21dc('0x5a')]);}else{if(_[_0x21dc('0x5b')](_0x3e9af5,_0x21dc('0x5c')))_0x3e9af5=_0x3e9af5[_0x21dc('0x5d')](_0x21dc('0x5c'),_0x21dc('0x5e'));_0x61b8f8[_0x21dc('0x5a')][_0x21dc('0x4d')](function(_0x146e06){_0x3b8ea9['push'](getAgents(_0x3e9af5,_0x146e06));});}});return BPromise[_0x21dc('0x5f')](_0x3b8ea9)[_0x21dc('0x24')](function(_0xa39dc){_0x27d0d7=_[_0x21dc('0x59')](_0x27d0d7,_[_0x21dc('0x60')](_0xa39dc));_0xdb0707(_0x27d0d7);})[_0x21dc('0x51')](function(_0x193986){_0x1a989f(_0x193986);});});}function getAgents(_0xef9cf6,_0x3213ad){return new BPromise(function(_0x11520d,_0x474ed1){return db[_0xef9cf6][_0x21dc('0x53')]({'where':{'id':_0x3213ad}})[_0x21dc('0x24')](function(_0x255bc8){return _0x255bc8[_0x21dc('0x61')]({'attributes':['id'],'raw':!![]})[_0x21dc('0x24')](function(_0x5e7f1a){var _0x54d209=_[_0x21dc('0x62')](_0x5e7f1a,'id');_0x11520d(_0x54d209);});})[_0x21dc('0x51')](function(_0x434261){_0x474ed1(_0x434261);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b22d148..596a174 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 _0x8bd3=['update','remove','emit','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x131017,_0xcde894){var _0x1429b2=function(_0x3504ab){while(--_0x3504ab){_0x131017['push'](_0x131017['shift']());}};_0x1429b2(++_0xcde894);}(_0x8bd3,0x10c));var _0x38bd=function(_0x12d773,_0x253abd){_0x12d773=_0x12d773-0x0;var _0x152e37=_0x8bd3[_0x12d773];return _0x152e37;};'use strict';var EventEmitter=require(_0x38bd('0x0'));var UserNotification=require(_0x38bd('0x1'))['db'][_0x38bd('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x38bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38bd('0x4'),'afterDestroy':_0x38bd('0x5')};function emitEvent(_0x790ec2){return function(_0x933010,_0x64c261,_0x35629a){UserNotificationEvents['emit'](_0x790ec2+':'+_0x933010['id'],_0x933010);UserNotificationEvents[_0x38bd('0x6')](_0x790ec2,_0x933010);_0x35629a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x38bd('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x0678=['hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners','save','update','emit'];(function(_0x526aa7,_0x2646ef){var _0x420526=function(_0x18e149){while(--_0x18e149){_0x526aa7['push'](_0x526aa7['shift']());}};_0x420526(++_0x2646ef);}(_0x0678,0x135));var _0x8067=function(_0x57fb67,_0x458a1f){_0x57fb67=_0x57fb67-0x0;var _0x576a44=_0x0678[_0x57fb67];return _0x576a44;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x8067('0x0'))['db'][_0x8067('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8067('0x2')](0x0);var events={'afterCreate':_0x8067('0x3'),'afterUpdate':_0x8067('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3279f2){return function(_0x487a13,_0x4efc4c,_0x3136be){UserNotificationEvents[_0x8067('0x5')](_0x3279f2+':'+_0x487a13['id'],_0x487a13);UserNotificationEvents[_0x8067('0x5')](_0x3279f2,_0x487a13);_0x3136be(null);};}for(var e in events){if(events[_0x8067('0x6')](e)){var event=events[e];UserNotification[_0x8067('0x7')](e,emitEvent(event));}}module[_0x8067('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a6aafc6..43bddc6 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 _0x3216=['define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xf3fa9d,_0x29b950){var _0x4aa380=function(_0x5e0f83){while(--_0x5e0f83){_0xf3fa9d['push'](_0xf3fa9d['shift']());}};_0x4aa380(++_0x29b950);}(_0x3216,0x89));var _0x6321=function(_0x1d0b2b,_0x5f170c){_0x1d0b2b=_0x1d0b2b-0x0;var _0x78a633=_0x3216[_0x1d0b2b];return _0x78a633;};'use strict';var _=require(_0x6321('0x0'));var util=require(_0x6321('0x1'));var logger=require(_0x6321('0x2'))('api');var moment=require(_0x6321('0x3'));var BPromise=require(_0x6321('0x4'));var rp=require(_0x6321('0x5'));var fs=require('fs');var path=require(_0x6321('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x58fad8,_0x5c293c){return _0x58fad8[_0x6321('0x7')](_0x6321('0x8'),attributes,{'tableName':_0x6321('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6321('0xa'),'collate':_0x6321('0xb')});}; \ No newline at end of file +var _0x7db3=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports'];(function(_0x533bac,_0x2448b8){var _0x155aa7=function(_0x4d2248){while(--_0x4d2248){_0x533bac['push'](_0x533bac['shift']());}};_0x155aa7(++_0x2448b8);}(_0x7db3,0x12e));var _0x37db=function(_0x53f72d,_0x58068c){_0x53f72d=_0x53f72d-0x0;var _0x460f0d=_0x7db3[_0x53f72d];return _0x460f0d;};'use strict';var _=require(_0x37db('0x0'));var util=require(_0x37db('0x1'));var logger=require(_0x37db('0x2'))('api');var moment=require(_0x37db('0x3'));var BPromise=require(_0x37db('0x4'));var rp=require(_0x37db('0x5'));var fs=require('fs');var path=require(_0x37db('0x6'));var rimraf=require('rimraf');var config=require(_0x37db('0x7'));var attributes=require(_0x37db('0x8'));module[_0x37db('0x9')]=function(_0x46c5f5,_0x6e0016){return _0x46c5f5[_0x37db('0xa')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x37db('0xb'),'collate':_0x37db('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 35bd691..ea9fd37 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 _0x9897=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x9897,0x198));var _0x7989=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9897[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x7989('0x0'));var util=require(_0x7989('0x1'));var moment=require('moment');var BPromise=require(_0x7989('0x2'));var rs=require(_0x7989('0x3'));var fs=require('fs');var Redis=require(_0x7989('0x4'));var db=require(_0x7989('0x5'))['db'];var utils=require(_0x7989('0x6'));var logger=require(_0x7989('0x7'))(_0x7989('0x8'));var config=require(_0x7989('0x9'));var jayson=require(_0x7989('0xa'));var client=jayson['client'][_0x7989('0xb')]({'port':0x232a});config['redis']=_[_0x7989('0xc')](config[_0x7989('0xd')],{'host':_0x7989('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7989('0xd')]));require(_0x7989('0xf'))[_0x7989('0x10')](socket);function respondWithRpcPromise(_0x38f6e4,_0x508365,_0x568947){return new BPromise(function(_0x3f0670,_0x4b0865){return client['request'](_0x38f6e4,_0x568947)[_0x7989('0x11')](function(_0x47197d){logger[_0x7989('0x12')](_0x7989('0x13'),_0x508365,_0x7989('0x14'));logger[_0x7989('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x508365,'request\x20sent',JSON[_0x7989('0x16')](_0x47197d));if(_0x47197d[_0x7989('0x17')]){if(_0x47197d[_0x7989('0x17')][_0x7989('0x18')]===0x1f4){logger[_0x7989('0x17')](_0x7989('0x13'),_0x508365,_0x47197d[_0x7989('0x17')][_0x7989('0x19')]);return _0x4b0865(_0x47197d[_0x7989('0x17')][_0x7989('0x19')]);}logger['error'](_0x7989('0x13'),_0x508365,_0x47197d[_0x7989('0x17')][_0x7989('0x19')]);return _0x3f0670(_0x47197d[_0x7989('0x17')][_0x7989('0x19')]);}else{logger[_0x7989('0x12')](_0x7989('0x13'),_0x508365,_0x7989('0x14'));_0x3f0670(_0x47197d['result'][_0x7989('0x19')]);}})[_0x7989('0x1a')](function(_0x320656){logger[_0x7989('0x17')](_0x7989('0x13'),_0x508365,_0x320656);_0x4b0865(_0x320656);});});} \ No newline at end of file +var _0x6433=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x399c4a,_0x637889){var _0x13de38=function(_0x91c686){while(--_0x91c686){_0x399c4a['push'](_0x399c4a['shift']());}};_0x13de38(++_0x637889);}(_0x6433,0x105));var _0x3643=function(_0x55b5dc,_0x1e1f0f){_0x55b5dc=_0x55b5dc-0x0;var _0x569932=_0x6433[_0x55b5dc];return _0x569932;};'use strict';var _=require(_0x3643('0x0'));var util=require(_0x3643('0x1'));var moment=require(_0x3643('0x2'));var BPromise=require('bluebird');var rs=require(_0x3643('0x3'));var fs=require('fs');var Redis=require(_0x3643('0x4'));var db=require(_0x3643('0x5'))['db'];var utils=require(_0x3643('0x6'));var logger=require('../../config/logger')(_0x3643('0x7'));var config=require(_0x3643('0x8'));var jayson=require(_0x3643('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3643('0xa')]=_[_0x3643('0xb')](config['redis'],{'host':_0x3643('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3643('0xd'))[_0x3643('0xe')](socket);function respondWithRpcPromise(_0x228367,_0x3c7378,_0x2fa8f7){return new BPromise(function(_0x2bbb73,_0x5c614c){return client[_0x3643('0xf')](_0x228367,_0x2fa8f7)['then'](function(_0x1ff1e6){logger[_0x3643('0x10')](_0x3643('0x11'),_0x3c7378,_0x3643('0x12'));logger[_0x3643('0x13')](_0x3643('0x14'),_0x3c7378,'request\x20sent',JSON[_0x3643('0x15')](_0x1ff1e6));if(_0x1ff1e6[_0x3643('0x16')]){if(_0x1ff1e6[_0x3643('0x16')][_0x3643('0x17')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x3c7378,_0x1ff1e6[_0x3643('0x16')]['message']);return _0x5c614c(_0x1ff1e6['error'][_0x3643('0x18')]);}logger[_0x3643('0x16')](_0x3643('0x11'),_0x3c7378,_0x1ff1e6[_0x3643('0x16')][_0x3643('0x18')]);return _0x2bbb73(_0x1ff1e6[_0x3643('0x16')]['message']);}else{logger[_0x3643('0x10')](_0x3643('0x11'),_0x3c7378,_0x3643('0x12'));_0x2bbb73(_0x1ff1e6[_0x3643('0x19')][_0x3643('0x18')]);}})['catch'](function(_0x4eec40){logger[_0x3643('0x16')](_0x3643('0x11'),_0x3c7378,_0x4eec40);_0x5c614c(_0x4eec40);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 263b5c2..87979ae 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 _0x5aae=['./userNotification.events','save','remove','update','removeListener','register','length'];(function(_0xe78202,_0x200dd0){var _0xd44ff5=function(_0x33936b){while(--_0x33936b){_0xe78202['push'](_0xe78202['shift']());}};_0xd44ff5(++_0x200dd0);}(_0x5aae,0x1a4));var _0xe5aa=function(_0x7b544a,_0x33c45a){_0x7b544a=_0x7b544a-0x0;var _0x33dcb4=_0x5aae[_0x7b544a];return _0x33dcb4;};'use strict';var UserNotificationEvents=require(_0xe5aa('0x0'));var events=[_0xe5aa('0x1'),_0xe5aa('0x2'),_0xe5aa('0x3')];function createListener(_0x2d38fd,_0x2a522b){return function(_0x21a414){_0x2a522b['emit'](_0x2d38fd,_0x21a414);};}function removeListener(_0x1ff289,_0x2c6298){return function(){UserNotificationEvents[_0xe5aa('0x4')](_0x1ff289,_0x2c6298);};}exports[_0xe5aa('0x5')]=function(_0x1d9176){for(var _0x3290b4=0x0,_0x271f7e=events[_0xe5aa('0x6')];_0x3290b4<_0x271f7e;_0x3290b4++){var _0xd6527b=events[_0x3290b4];var _0x451a30=createListener('userNotification:'+_0xd6527b,_0x1d9176);UserNotificationEvents['on'](_0xd6527b,_0x451a30);}}; \ No newline at end of file +var _0x5846=['./userNotification.events','save','update','register','length','userNotification:'];(function(_0x49045f,_0x9e364){var _0x51329b=function(_0x17090d){while(--_0x17090d){_0x49045f['push'](_0x49045f['shift']());}};_0x51329b(++_0x9e364);}(_0x5846,0x180));var _0x6584=function(_0x3a1c24,_0x28848f){_0x3a1c24=_0x3a1c24-0x0;var _0x507379=_0x5846[_0x3a1c24];return _0x507379;};'use strict';var UserNotificationEvents=require(_0x6584('0x0'));var events=[_0x6584('0x1'),'remove',_0x6584('0x2')];function createListener(_0x45ee8b,_0x47ac84){return function(_0x53e27f){_0x47ac84['emit'](_0x45ee8b,_0x53e27f);};}function removeListener(_0x2c3b88,_0x5cf99a){return function(){UserNotificationEvents['removeListener'](_0x2c3b88,_0x5cf99a);};}exports[_0x6584('0x3')]=function(_0x19c6f3){for(var _0x7a5a4b=0x0,_0x5cdbd9=events[_0x6584('0x4')];_0x7a5a4b<_0x5cdbd9;_0x7a5a4b++){var _0x422a82=events[_0x7a5a4b];var _0x5df4bd=createListener(_0x6584('0x5')+_0x422a82,_0x19c6f3);UserNotificationEvents['on'](_0x422a82,_0x5df4bd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 81424c9..c048354 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57f34f,_0x1f1710){var _0x9ad0f1=function(_0x27b976){while(--_0x27b976){_0x57f34f['push'](_0x57f34f['shift']());}};_0x9ad0f1(++_0x1f1710);}(_0xe706,0xa3));var _0x6e70=function(_0x3f1b36,_0x205b14){_0x3f1b36=_0x3f1b36-0x0;var _0x56a704=_0xe706[_0x3f1b36];return _0x56a704;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index f34971f..8978ecd 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 _0xb8ff=['exports','INTEGER'];(function(_0x3bfe11,_0x573678){var _0x19f6b2=function(_0x561817){while(--_0x561817){_0x3bfe11['push'](_0x3bfe11['shift']());}};_0x19f6b2(++_0x573678);}(_0xb8ff,0x180));var _0xfb8f=function(_0x3de7fa,_0x4e7d93){_0x3de7fa=_0x3de7fa-0x0;var _0x407a92=_0xb8ff[_0x3de7fa];return _0x407a92;};'use strict';var Sequelize=require('sequelize');module[_0xfb8f('0x0')]={'penalty':{'type':Sequelize[_0xfb8f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x343f=['sequelize','INTEGER'];(function(_0x285ed3,_0x354d46){var _0x90bc47=function(_0x4cda4a){while(--_0x4cda4a){_0x285ed3['push'](_0x285ed3['shift']());}};_0x90bc47(++_0x354d46);}(_0x343f,0xb6));var _0xf343=function(_0x3c8e5a,_0x3a1602){_0x3c8e5a=_0x3c8e5a-0x0;var _0xcebcc4=_0x343f[_0x3c8e5a];return _0xcebcc4;};'use strict';var Sequelize=require(_0xf343('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf343('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 582c477..55a74f3 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 _0x135f=['../../config/environment','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x215f91,_0x42721a){var _0x396370=function(_0x2fbfd2){while(--_0x2fbfd2){_0x215f91['push'](_0x215f91['shift']());}};_0x396370(++_0x42721a);}(_0x135f,0x19d));var _0xf135=function(_0x2dcc1b,_0x1f9671){_0x2dcc1b=_0x2dcc1b-0x0;var _0x329a16=_0x135f[_0x2dcc1b];return _0x329a16;};'use strict';var _=require('lodash');var util=require(_0xf135('0x0'));var logger=require(_0xf135('0x1'))(_0xf135('0x2'));var moment=require('moment');var BPromise=require(_0xf135('0x3'));var rp=require(_0xf135('0x4'));var fs=require('fs');var path=require(_0xf135('0x5'));var rimraf=require(_0xf135('0x6'));var config=require(_0xf135('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x2cbfb9,_0x209efd){return _0x2cbfb9['define'](_0xf135('0x8'),attributes,{'tableName':_0xf135('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac47=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0xac47,0xce));var _0x7ac4=function(_0x253e1f,_0xd247f0){_0x253e1f=_0x253e1f-0x0;var _0x1adb58=_0xac47[_0x253e1f];return _0x1adb58;};'use strict';var _=require(_0x7ac4('0x0'));var util=require(_0x7ac4('0x1'));var logger=require('../../config/logger')(_0x7ac4('0x2'));var moment=require('moment');var BPromise=require(_0x7ac4('0x3'));var rp=require(_0x7ac4('0x4'));var fs=require('fs');var path=require(_0x7ac4('0x5'));var rimraf=require(_0x7ac4('0x6'));var config=require(_0x7ac4('0x7'));var attributes=require(_0x7ac4('0x8'));module['exports']=function(_0x55edc7,_0x24b868){return _0x55edc7[_0x7ac4('0x9')](_0x7ac4('0xa'),attributes,{'tableName':_0x7ac4('0xb'),'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 1ab59b8..5380331 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 _0xe7e7=['error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x37dcf8,_0x50437b){var _0x1d121c=function(_0x5bf87f){while(--_0x5bf87f){_0x37dcf8['push'](_0x37dcf8['shift']());}};_0x1d121c(++_0x50437b);}(_0xe7e7,0x1ea));var _0x7e7e=function(_0xe810f1,_0x2bd355){_0xe810f1=_0xe810f1-0x0;var _0x264f78=_0xe7e7[_0xe810f1];return _0x264f78;};'use strict';var _=require('lodash');var util=require(_0x7e7e('0x0'));var moment=require(_0x7e7e('0x1'));var BPromise=require(_0x7e7e('0x2'));var rs=require(_0x7e7e('0x3'));var fs=require('fs');var Redis=require(_0x7e7e('0x4'));var db=require(_0x7e7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e7e('0x6'))(_0x7e7e('0x7'));var config=require(_0x7e7e('0x8'));var jayson=require(_0x7e7e('0x9'));var client=jayson[_0x7e7e('0xa')][_0x7e7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6302,_0x17ca78,_0x2b1577){return new BPromise(function(_0x56a955,_0x1da2a9){return client['request'](_0x2b6302,_0x2b1577)[_0x7e7e('0xc')](function(_0x41125e){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x17ca78,_0x7e7e('0xd'));logger['debug'](_0x7e7e('0xe'),_0x17ca78,'request\x20sent',JSON[_0x7e7e('0xf')](_0x41125e));if(_0x41125e['error']){if(_0x41125e[_0x7e7e('0x10')][_0x7e7e('0x11')]===0x1f4){logger[_0x7e7e('0x10')](_0x7e7e('0x12'),_0x17ca78,_0x41125e[_0x7e7e('0x10')][_0x7e7e('0x13')]);return _0x1da2a9(_0x41125e[_0x7e7e('0x10')][_0x7e7e('0x13')]);}logger[_0x7e7e('0x10')](_0x7e7e('0x12'),_0x17ca78,_0x41125e[_0x7e7e('0x10')][_0x7e7e('0x13')]);return _0x56a955(_0x41125e[_0x7e7e('0x10')]['message']);}else{logger[_0x7e7e('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x17ca78,'request\x20sent');_0x56a955(_0x41125e[_0x7e7e('0x15')][_0x7e7e('0x13')]);}})['catch'](function(_0x366953){logger[_0x7e7e('0x10')](_0x7e7e('0x12'),_0x17ca78,_0x366953);_0x1da2a9(_0x366953);});});} \ No newline at end of file +var _0x5a4f=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x5bd072,_0x3f02d6){var _0x17c868=function(_0x1bcfe4){while(--_0x1bcfe4){_0x5bd072['push'](_0x5bd072['shift']());}};_0x17c868(++_0x3f02d6);}(_0x5a4f,0xa6));var _0xf5a4=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x5a4f[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0xf5a4('0x0'));var util=require(_0xf5a4('0x1'));var moment=require(_0xf5a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5a4('0x3'));var fs=require('fs');var Redis=require(_0xf5a4('0x4'));var db=require(_0xf5a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5a4('0x6'))(_0xf5a4('0x7'));var config=require(_0xf5a4('0x8'));var jayson=require(_0xf5a4('0x9'));var client=jayson[_0xf5a4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45d896,_0x14f3a9,_0x3aae99){return new BPromise(function(_0x1bccbd,_0x5ca331){return client[_0xf5a4('0xb')](_0x45d896,_0x3aae99)[_0xf5a4('0xc')](function(_0x3dd6c2){logger['info'](_0xf5a4('0xd'),_0x14f3a9,_0xf5a4('0xe'));logger[_0xf5a4('0xf')](_0xf5a4('0x10'),_0x14f3a9,_0xf5a4('0xe'),JSON['stringify'](_0x3dd6c2));if(_0x3dd6c2[_0xf5a4('0x11')]){if(_0x3dd6c2[_0xf5a4('0x11')][_0xf5a4('0x12')]===0x1f4){logger['error'](_0xf5a4('0xd'),_0x14f3a9,_0x3dd6c2[_0xf5a4('0x11')]['message']);return _0x5ca331(_0x3dd6c2[_0xf5a4('0x11')][_0xf5a4('0x13')]);}logger[_0xf5a4('0x11')](_0xf5a4('0xd'),_0x14f3a9,_0x3dd6c2['error'][_0xf5a4('0x13')]);return _0x1bccbd(_0x3dd6c2[_0xf5a4('0x11')][_0xf5a4('0x13')]);}else{logger[_0xf5a4('0x14')](_0xf5a4('0xd'),_0x14f3a9,_0xf5a4('0xe'));_0x1bccbd(_0x3dd6c2[_0xf5a4('0x15')][_0xf5a4('0x13')]);}})[_0xf5a4('0x16')](function(_0x295e9f){logger[_0xf5a4('0x11')](_0xf5a4('0xd'),_0x14f3a9,_0x295e9f);_0x5ca331(_0x295e9f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 620d1a9..4d7fb94 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 _0xf14b=['clone','/:id/sections','addSections','addResources','put','update','destroy','delete','removeResources','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/resources','getResources','post','create','/:id/clone'];(function(_0xdede10,_0x3970d1){var _0x5e1172=function(_0x1266ed){while(--_0x1266ed){_0xdede10['push'](_0xdede10['shift']());}};_0x5e1172(++_0x3970d1);}(_0xf14b,0xb8));var _0xbf14=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0xf14b[_0xcd26a9];return _0x3afcbc;};'use strict';var multer=require('multer');var util=require(_0xbf14('0x0'));var path=require('path');var timeout=require(_0xbf14('0x1'));var express=require(_0xbf14('0x2'));var router=express['Router']();var fs_extra=require(_0xbf14('0x3'));var auth=require(_0xbf14('0x4'));var interaction=require(_0xbf14('0x5'));var config=require(_0xbf14('0x6'));var controller=require(_0xbf14('0x7'));router['get']('/',auth[_0xbf14('0x8')](),controller[_0xbf14('0x9')]);router[_0xbf14('0xa')](_0xbf14('0xb'),auth['isAuthenticated'](),controller[_0xbf14('0xc')]);router[_0xbf14('0xa')](_0xbf14('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/sections',auth[_0xbf14('0x8')](),controller['getSections']);router[_0xbf14('0xa')](_0xbf14('0xe'),auth[_0xbf14('0x8')](),controller[_0xbf14('0xf')]);router[_0xbf14('0x10')]('/',auth[_0xbf14('0x8')](),controller[_0xbf14('0x11')]);router[_0xbf14('0x10')](_0xbf14('0x12'),auth[_0xbf14('0x8')](),controller[_0xbf14('0x13')]);router[_0xbf14('0x10')](_0xbf14('0x14'),auth[_0xbf14('0x8')](),controller[_0xbf14('0x15')]);router[_0xbf14('0x10')](_0xbf14('0xe'),auth['isAuthenticated'](),controller[_0xbf14('0x16')]);router[_0xbf14('0x17')](_0xbf14('0xd'),auth['isAuthenticated'](),controller[_0xbf14('0x18')]);router['delete'](_0xbf14('0xd'),auth['isAuthenticated'](),controller[_0xbf14('0x19')]);router['delete'](_0xbf14('0x14'),auth[_0xbf14('0x8')](),controller['removeSections']);router[_0xbf14('0x1a')]('/:id/resources',auth[_0xbf14('0x8')](),controller[_0xbf14('0x1b')]);module[_0xbf14('0x1c')]=router; \ No newline at end of file +var _0x6dfa=['path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getResources','post','/:id/clone','clone','addSections','/:id/resources','put','update','delete','destroy','removeSections','multer','util'];(function(_0x2f90d0,_0x1d9ec1){var _0x25ed4b=function(_0x31bcc3){while(--_0x31bcc3){_0x2f90d0['push'](_0x2f90d0['shift']());}};_0x25ed4b(++_0x1d9ec1);}(_0x6dfa,0x7b));var _0xa6df=function(_0x52f793,_0x40c699){_0x52f793=_0x52f793-0x0;var _0x42c6d9=_0x6dfa[_0x52f793];return _0x42c6d9;};'use strict';var multer=require(_0xa6df('0x0'));var util=require(_0xa6df('0x1'));var path=require(_0xa6df('0x2'));var timeout=require(_0xa6df('0x3'));var express=require(_0xa6df('0x4'));var router=express['Router']();var fs_extra=require(_0xa6df('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa6df('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xa6df('0x7')]('/',auth[_0xa6df('0x8')](),controller[_0xa6df('0x9')]);router[_0xa6df('0x7')](_0xa6df('0xa'),auth[_0xa6df('0x8')](),controller[_0xa6df('0xb')]);router[_0xa6df('0x7')](_0xa6df('0xc'),auth[_0xa6df('0x8')](),controller['show']);router[_0xa6df('0x7')](_0xa6df('0xd'),auth[_0xa6df('0x8')](),controller['getSections']);router[_0xa6df('0x7')]('/:id/resources',auth[_0xa6df('0x8')](),controller[_0xa6df('0xe')]);router[_0xa6df('0xf')]('/',auth[_0xa6df('0x8')](),controller['create']);router[_0xa6df('0xf')](_0xa6df('0x10'),auth[_0xa6df('0x8')](),controller[_0xa6df('0x11')]);router[_0xa6df('0xf')](_0xa6df('0xd'),auth['isAuthenticated'](),controller[_0xa6df('0x12')]);router[_0xa6df('0xf')](_0xa6df('0x13'),auth[_0xa6df('0x8')](),controller['addResources']);router[_0xa6df('0x14')](_0xa6df('0xc'),auth[_0xa6df('0x8')](),controller[_0xa6df('0x15')]);router[_0xa6df('0x16')]('/:id',auth[_0xa6df('0x8')](),controller[_0xa6df('0x17')]);router[_0xa6df('0x16')](_0xa6df('0xd'),auth['isAuthenticated'](),controller[_0xa6df('0x18')]);router[_0xa6df('0x16')](_0xa6df('0x13'),auth[_0xa6df('0x8')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 10790d9..9fb7d0c 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 _0x534a=['join','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0xd8d0f,_0x3f7a1c){var _0x1cdf4b=function(_0x2fbfb3){while(--_0x2fbfb3){_0xd8d0f['push'](_0xd8d0f['shift']());}};_0x1cdf4b(++_0x3f7a1c);}(_0x534a,0xc9));var _0xa534=function(_0x4ca3ca,_0x2092b2){_0x4ca3ca=_0x4ca3ca-0x0;var _0x5c94ac=_0x534a[_0x4ca3ca];return _0x5c94ac;};'use strict';var Sequelize=require(_0xa534('0x0'));module[_0xa534('0x1')]={'name':{'type':Sequelize[_0xa534('0x2')],'allowNull':![],'unique':_0xa534('0x3')},'crudPermissions':{'type':Sequelize[_0xa534('0x2')],'set':function(_0x5c4c1d){this[_0xa534('0x4')](_0xa534('0x5'),_0x5c4c1d?_0x5c4c1d[_0xa534('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa534('0x5'))?this['getDataValue'](_0xa534('0x5'))[_0xa534('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa534('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa534('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa534('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa534('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa534('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa534('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa534('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf682=['name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','STRING'];(function(_0x236470,_0x752a84){var _0x2b858d=function(_0x40c5b2){while(--_0x40c5b2){_0x236470['push'](_0x236470['shift']());}};_0x2b858d(++_0x752a84);}(_0xf682,0x178));var _0x2f68=function(_0xfa5b71,_0x6c569e){_0xfa5b71=_0xfa5b71-0x0;var _0x285a8b=_0xf682[_0xfa5b71];return _0x285a8b;};'use strict';var Sequelize=require(_0x2f68('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f68('0x1')],'allowNull':![],'unique':_0x2f68('0x2')},'crudPermissions':{'type':Sequelize[_0x2f68('0x1')],'set':function(_0x10af8c){this[_0x2f68('0x3')]('crudPermissions',_0x10af8c?_0x10af8c[_0x2f68('0x4')](''):[]);},'get':function(){return this[_0x2f68('0x5')]('crudPermissions')?this[_0x2f68('0x5')](_0x2f68('0x6'))[_0x2f68('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2f68('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2f68('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2f68('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2f68('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2f68('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2f68('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2f68('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c7f19f1..24a4640 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 _0xbecf=['enabled','includes','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','ids','getResources','Missing\x20section\x20parameter','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','catch','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','destroy','describe','addSections','UserProfileSection','Resources','push','removeSections'];(function(_0x53791c,_0x5e4a11){var _0xab2bb=function(_0x5d1186){while(--_0x5d1186){_0x53791c['push'](_0x53791c['shift']());}};_0xab2bb(++_0x5e4a11);}(_0xbecf,0x15c));var _0xfbec=function(_0x558a3c,_0xd7c840){_0x558a3c=_0x558a3c-0x0;var _0x1a9a7b=_0xbecf[_0x558a3c];return _0x1a9a7b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfbec('0x0'));var jsonpatch=require(_0xfbec('0x1'));var rp=require(_0xfbec('0x2'));var moment=require(_0xfbec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfbec('0x4'));var util=require(_0xfbec('0x5'));var path=require(_0xfbec('0x6'));var sox=require(_0xfbec('0x7'));var csv=require(_0xfbec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbec('0x9'));var _=require(_0xfbec('0xa'));var squel=require(_0xfbec('0xb'));var crypto=require(_0xfbec('0xc'));var jsforce=require(_0xfbec('0xd'));var deskjs=require(_0xfbec('0xe'));var toCsv=require(_0xfbec('0x8'));var querystring=require(_0xfbec('0xf'));var Papa=require(_0xfbec('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfbec('0x11'));var hardwareService=require(_0xfbec('0x12'));var logger=require(_0xfbec('0x13'))(_0xfbec('0x14'));var utils=require(_0xfbec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfbec('0x16'));var db=require(_0xfbec('0x17'))['db'];config[_0xfbec('0x18')]=_[_0xfbec('0x19')](config['redis'],{'host':_0xfbec('0x1a'),'port':0x18eb});var socket=require(_0xfbec('0x1b'))(new Redis(config[_0xfbec('0x18')]));require(_0xfbec('0x1c'))['register'](socket);function respondWithStatusCode(_0x93609b,_0x5e021e){_0x5e021e=_0x5e021e||0xcc;return function(_0x8b2f89){if(_0x8b2f89){return _0x93609b['sendStatus'](_0x5e021e);}return _0x93609b[_0xfbec('0x1d')](_0x5e021e)[_0xfbec('0x1e')]();};}function respondWithResult(_0x171721,_0x4aa49e){_0x4aa49e=_0x4aa49e||0xc8;return function(_0xe91fb8){if(_0xe91fb8){return _0x171721[_0xfbec('0x1d')](_0x4aa49e)[_0xfbec('0x1f')](_0xe91fb8);}};}function respondWithFilteredResult(_0x47d506,_0x148453){return function(_0x267a4b){if(_0x267a4b){var _0x259874=typeof _0x148453[_0xfbec('0x20')]===_0xfbec('0x21')&&typeof _0x148453[_0xfbec('0x22')]===_0xfbec('0x21');var _0x4f2431=_0x267a4b['count'];var _0x5da567=_0x259874?0x0:_0x148453[_0xfbec('0x20')];var _0x1eb345=_0x259874?_0x267a4b[_0xfbec('0x23')]:_0x148453['offset']+_0x148453[_0xfbec('0x22')];var _0x383405;if(_0x1eb345>=_0x4f2431){_0x1eb345=_0x4f2431;_0x383405=0xc8;}else{_0x383405=0xce;}_0x47d506['status'](_0x383405);return _0x47d506[_0xfbec('0x24')](_0xfbec('0x25'),_0x5da567+'-'+_0x1eb345+'/'+_0x4f2431)['json'](_0x267a4b);}return null;};}function patchUpdates(_0xe1f8d6){return function(_0x4048b7){try{jsonpatch[_0xfbec('0x26')](_0x4048b7,_0xe1f8d6,!![]);}catch(_0x43e395){return BPromise[_0xfbec('0x27')](_0x43e395);}return _0x4048b7['save']();};}function saveUpdates(_0x2e172e,_0x4bc10a){return function(_0x1bed47){if(_0x1bed47){return _0x1bed47[_0xfbec('0x28')](_0x2e172e)['then'](function(_0x50e0ef){return _0x50e0ef;});}return null;};}function removeEntity(_0x4d8a3f,_0x10f5d3){return function(_0x421535){if(_0x421535){return _0x421535['destroy']()[_0xfbec('0x29')](function(){_0x4d8a3f[_0xfbec('0x1d')](0xcc)[_0xfbec('0x1e')]();});}};}function handleEntityNotFound(_0x4ac842,_0x29126f){return function(_0x2d9acb){if(!_0x2d9acb){_0x4ac842[_0xfbec('0x2a')](0x194);}return _0x2d9acb;};}function handleError(_0x14aa8a,_0xe7036f){_0xe7036f=_0xe7036f||0x1f4;return function(_0x5b359b){logger['error'](_0x5b359b[_0xfbec('0x2b')]);if(_0x5b359b[_0xfbec('0x2c')]){delete _0x5b359b[_0xfbec('0x2c')];}_0x14aa8a[_0xfbec('0x1d')](_0xe7036f)[_0xfbec('0x2d')](_0x5b359b);};}exports[_0xfbec('0x2e')]=function(_0x41b4cf,_0x5cb9d7){var _0xa0084a={},_0x55ffd2={},_0x5260b2={'count':0x0,'rows':[]};var _0x5a3829=_[_0xfbec('0x2f')](db[_0xfbec('0x30')]['rawAttributes'],function(_0x5803dd){return{'name':_0x5803dd[_0xfbec('0x31')],'type':_0x5803dd[_0xfbec('0x32')][_0xfbec('0x33')]};});_0x55ffd2[_0xfbec('0x34')]=_[_0xfbec('0x2f')](_0x5a3829,'name');_0x55ffd2[_0xfbec('0x35')]=_[_0xfbec('0x36')](_0x41b4cf['query']);_0x55ffd2[_0xfbec('0x37')]=_['intersection'](_0x55ffd2['model'],_0x55ffd2[_0xfbec('0x35')]);_0xa0084a[_0xfbec('0x38')]=_[_0xfbec('0x39')](_0x55ffd2[_0xfbec('0x34')],qs['fields'](_0x41b4cf[_0xfbec('0x35')][_0xfbec('0x3a')]));_0xa0084a[_0xfbec('0x38')]=_0xa0084a['attributes']['length']?_0xa0084a[_0xfbec('0x38')]:_0x55ffd2['model'];if(!_0x41b4cf[_0xfbec('0x35')][_0xfbec('0x3b')](_0xfbec('0x3c'))){_0xa0084a[_0xfbec('0x22')]=qs[_0xfbec('0x22')](_0x41b4cf[_0xfbec('0x35')]['limit']);_0xa0084a['offset']=qs[_0xfbec('0x20')](_0x41b4cf[_0xfbec('0x35')][_0xfbec('0x20')]);}_0xa0084a[_0xfbec('0x3d')]=qs['sort'](_0x41b4cf[_0xfbec('0x35')]['sort']);_0xa0084a['where']=qs[_0xfbec('0x37')](_[_0xfbec('0x3e')](_0x41b4cf[_0xfbec('0x35')],_0x55ffd2[_0xfbec('0x37')]),_0x5a3829);if(_0x41b4cf[_0xfbec('0x35')][_0xfbec('0x3f')]){_0xa0084a[_0xfbec('0x40')]=_[_0xfbec('0x41')](_0xa0084a[_0xfbec('0x40')],{'$or':_[_0xfbec('0x2f')](_0x5a3829,function(_0x56b3ae){if(_0x56b3ae['type']!==_0xfbec('0x42')){var _0x2d6d9c={};_0x2d6d9c[_0x56b3ae[_0xfbec('0x2c')]]={'$like':'%'+_0x41b4cf[_0xfbec('0x35')]['filter']+'%'};return _0x2d6d9c;}})});}_0xa0084a=_[_0xfbec('0x41')]({},_0xa0084a,_0x41b4cf[_0xfbec('0x43')]);var _0x1044d9={'where':_0xa0084a[_0xfbec('0x40')]};return db[_0xfbec('0x30')][_0xfbec('0x23')](_0x1044d9)[_0xfbec('0x29')](function(_0x5bd90f){_0x5260b2[_0xfbec('0x23')]=_0x5bd90f;if(_0x41b4cf[_0xfbec('0x35')]['includeAll']){_0xa0084a[_0xfbec('0x44')]=[{'all':!![]}];}return db[_0xfbec('0x30')][_0xfbec('0x45')](_0xa0084a);})[_0xfbec('0x29')](function(_0x206a55){_0x5260b2[_0xfbec('0x46')]=_0x206a55;return _0x5260b2;})[_0xfbec('0x29')](respondWithFilteredResult(_0x5cb9d7,_0xa0084a))['catch'](handleError(_0x5cb9d7,null));};exports[_0xfbec('0x47')]=function(_0x43c222,_0x50182c){var _0x18eb22={'raw':![],'where':{'id':_0x43c222[_0xfbec('0x48')]['id']}},_0x5e7d1c={};_0x5e7d1c['model']=_[_0xfbec('0x36')](db[_0xfbec('0x30')][_0xfbec('0x49')]);_0x5e7d1c[_0xfbec('0x35')]=_[_0xfbec('0x36')](_0x43c222[_0xfbec('0x35')]);_0x5e7d1c[_0xfbec('0x37')]=_['intersection'](_0x5e7d1c[_0xfbec('0x34')],_0x5e7d1c[_0xfbec('0x35')]);_0x18eb22[_0xfbec('0x38')]=_[_0xfbec('0x39')](_0x5e7d1c['model'],qs[_0xfbec('0x3a')](_0x43c222[_0xfbec('0x35')][_0xfbec('0x3a')]));_0x18eb22[_0xfbec('0x38')]=_0x18eb22[_0xfbec('0x38')][_0xfbec('0x4a')]?_0x18eb22[_0xfbec('0x38')]:_0x5e7d1c['model'];if(_0x43c222[_0xfbec('0x35')][_0xfbec('0x4b')]){_0x18eb22['include']=[{'all':!![]}];}_0x18eb22=_[_0xfbec('0x41')]({},_0x18eb22,_0x43c222[_0xfbec('0x43')]);return db[_0xfbec('0x30')][_0xfbec('0x4c')](_0x18eb22)[_0xfbec('0x29')](handleEntityNotFound(_0x50182c,null))['then'](respondWithResult(_0x50182c,null))[_0xfbec('0x4d')](handleError(_0x50182c,null));};exports[_0xfbec('0x4e')]=function(_0x23dd29,_0x348b0c){return db[_0xfbec('0x30')]['create'](_0x23dd29[_0xfbec('0x4f')],{})[_0xfbec('0x29')](respondWithResult(_0x348b0c,0xc9))[_0xfbec('0x4d')](handleError(_0x348b0c,null));};exports[_0xfbec('0x50')]=function(_0x458ee4,_0x4e79ff){var _0x238394={'where':{'id':_0x458ee4[_0xfbec('0x48')]['id']}},_0x2cc356={};_0x2cc356[_0xfbec('0x34')]=_[_0xfbec('0x36')](db['UserProfile'][_0xfbec('0x49')]);_0x238394[_0xfbec('0x38')]=_[_0xfbec('0x39')](_0x2cc356[_0xfbec('0x34')],qs[_0xfbec('0x3a')](_0x458ee4[_0xfbec('0x35')][_0xfbec('0x3a')]));_0x238394[_0xfbec('0x38')]=_0x238394[_0xfbec('0x38')][_0xfbec('0x4a')]?_0x238394[_0xfbec('0x38')]:_0x2cc356[_0xfbec('0x34')];if(_0x458ee4[_0xfbec('0x35')]['includeAll']){_0x238394[_0xfbec('0x44')]=[{'all':!![]}];}_0x238394=_[_0xfbec('0x41')]({},_0x238394,_0x458ee4[_0xfbec('0x43')]);return db[_0xfbec('0x30')][_0xfbec('0x4c')](_0x238394)[_0xfbec('0x29')](handleEntityNotFound(_0x4e79ff,null))[_0xfbec('0x29')](function(_0x4a6c0d){if(_0x4a6c0d){var _0x4e7a08=_0x4a6c0d[_0xfbec('0x51')]({'plain':!![]});_0x4e7a08=qs[_0xfbec('0x52')](_0x4e7a08,['id',_0xfbec('0x53'),_0xfbec('0x54'),_0xfbec('0x55')]);_0x458ee4[_0xfbec('0x4f')]=_['omit'](_0x458ee4[_0xfbec('0x4f')],['id',_0xfbec('0x53'),_0xfbec('0x54')]);return db[_0xfbec('0x56')][_0xfbec('0x57')](function(_0x2296c4){return db[_0xfbec('0x30')]['create'](_[_0xfbec('0x41')](_0x4e7a08,_0x458ee4[_0xfbec('0x4f')]),{'include':_0x458ee4['query'][_0xfbec('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x2296c4})[_0xfbec('0x29')](function(_0x19cc60){var _0x3c587e=_0x19cc60[_0xfbec('0x51')]({'plain':!![]});return db['UserProfileSection'][_0xfbec('0x45')]({'where':{'userProfileId':_0x458ee4[_0xfbec('0x48')]['id']},'raw':!![]})[_0xfbec('0x29')](function(_0x30289e){if(_0x30289e){return BPromise[_0xfbec('0x58')](_0x30289e,function(_0x1d9469){return new BPromise(function(_0x4d7345,_0x49b0a9){if(_0x1d9469[_0xfbec('0x59')]===null||_0x1d9469[_0xfbec('0x59')]===0x1)_0x4d7345(null);return db[_0xfbec('0x5a')][_0xfbec('0x45')]({'where':{'sectionId':_0x1d9469['id']},'raw':!![]})[_0xfbec('0x29')](function(_0x22a829){var _0x3c2b99=_[_0xfbec('0x2f')](_0x22a829,function(_0x583ba0){return qs[_0xfbec('0x52')](_0x583ba0,['id',_0xfbec('0x53'),_0xfbec('0x54'),_0xfbec('0x5b')]);});_0x4d7345(_0x3c2b99);})[_0xfbec('0x4d')](function(_0x3d3fc1){_0x49b0a9(_0x3d3fc1);});})['then'](function(_0x305caa){var _0x544d54=qs[_0xfbec('0x52')](_0x1d9469,['id','createdAt',_0xfbec('0x54')]);_0x544d54[_0xfbec('0x5c')]=_0x3c587e['id'];if(_0x305caa)_0x544d54['Resources']=_0x305caa;return _0x544d54;})[_0xfbec('0x29')](function(_0x644902){return db['UserProfileSection'][_0xfbec('0x4e')](_0x644902,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x2296c4});});})[_0xfbec('0x29')](function(){return _0x3c587e;});}});});});}})[_0xfbec('0x29')](respondWithResult(_0x4e79ff,0xc9))[_0xfbec('0x4d')](handleError(_0x4e79ff,null));};exports['update']=function(_0x41ecb7,_0x462a78){if(_0x41ecb7[_0xfbec('0x4f')]['id']){delete _0x41ecb7[_0xfbec('0x4f')]['id'];}return db[_0xfbec('0x30')][_0xfbec('0x4c')]({'where':{'id':_0x41ecb7['params']['id']}})[_0xfbec('0x29')](handleEntityNotFound(_0x462a78,null))[_0xfbec('0x29')](saveUpdates(_0x41ecb7[_0xfbec('0x4f')],null))[_0xfbec('0x29')](respondWithResult(_0x462a78,null))['catch'](handleError(_0x462a78,null));};exports[_0xfbec('0x5d')]=function(_0x185734,_0x2751fa){return db[_0xfbec('0x30')][_0xfbec('0x4c')]({'where':{'id':_0x185734[_0xfbec('0x48')]['id']}})['then'](handleEntityNotFound(_0x2751fa,null))[_0xfbec('0x29')](removeEntity(_0x2751fa,null))[_0xfbec('0x4d')](handleError(_0x2751fa,null));};exports[_0xfbec('0x5e')]=function(_0x3e4c0c,_0xdf2ff1){return db['UserProfile']['describe']()[_0xfbec('0x29')](respondWithResult(_0xdf2ff1,null))['catch'](handleError(_0xdf2ff1,null));};exports[_0xfbec('0x5f')]=function(_0x800b7,_0x5c6269){var _0x1fcdc8=_0x800b7['body'];return db[_0xfbec('0x30')][_0xfbec('0x4c')]({'where':{'id':_0x800b7[_0xfbec('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c6269,null))['then'](function(_0x5e0c94){if(_0x5e0c94){return db[_0xfbec('0x56')][_0xfbec('0x57')](function(_0x561b90){return db[_0xfbec('0x60')][_0xfbec('0x5d')]({'where':{'userProfileId':_0x800b7['params']['id'],'sectionId':_[_0xfbec('0x2f')](_0x1fcdc8,function(_0x4d08fa){return _0x4d08fa[_0xfbec('0x5b')];})},'transaction':_0x561b90})[_0xfbec('0x29')](function(){var _0x4cda24=_[_0xfbec('0x2f')](_0x1fcdc8,function(_0x3fb944){_0x3fb944['userProfileId']=_0x800b7['params']['id'];return _0x3fb944;});var _0x2640dc=[];return BPromise[_0xfbec('0x58')](_0x4cda24,function(_0x1d854b){return db[_0xfbec('0x60')][_0xfbec('0x4e')](_0x1d854b,{'include':[{'model':db[_0xfbec('0x5a')],'as':_0xfbec('0x61')}],'raw':!![],'transaction':_0x561b90})['then'](function(_0x2c3b9b){_0x2640dc[_0xfbec('0x62')](_0x2c3b9b[_0xfbec('0x51')]({'plain':!![]}));});})[_0xfbec('0x29')](function(){return _0x2640dc;});});});}})['then'](function(_0x193b92){return _0x193b92;})[_0xfbec('0x29')](respondWithResult(_0x5c6269,null))[_0xfbec('0x4d')](handleError(_0x5c6269,null));};exports[_0xfbec('0x63')]=function(_0x44701f,_0x9766bc){var _0x37a0d0;return db[_0xfbec('0x30')]['find']({'where':{'id':_0x44701f[_0xfbec('0x48')]['id']},'attributes':['id',_0xfbec('0x2c')]})['then'](handleEntityNotFound(_0x9766bc,null))[_0xfbec('0x29')](function(_0x323012){if(_0x323012){_0x37a0d0=_0x323012;return db[_0xfbec('0x60')][_0xfbec('0x5d')]({'where':{'userProfileId':_0x44701f[_0xfbec('0x48')]['id'],'sectionId':_0x44701f[_0xfbec('0x35')]['ids']}});}})['then'](function(){return _0x37a0d0;})[_0xfbec('0x29')](respondWithStatusCode(_0x9766bc,null))['catch'](handleError(_0x9766bc,null));};exports['getSections']=function(_0x49e558,_0x192d9b){var _0x50fb57=[];var _0x16fabb=[];return db['UserProfileSection'][_0xfbec('0x45')]({'where':{'userProfileId':_0x49e558['params']['id']},'raw':!![]})[_0xfbec('0x29')](function(_0x22d3bc){_0x50fb57=_[_0xfbec('0x3f')](_0x22d3bc,function(_0x24c1dd){return _0x24c1dd[_0xfbec('0x64')]===0x1||_[_0xfbec('0x65')]([0x3eb,0x709],_0x24c1dd[_0xfbec('0x5b')]);});if(!_['isEmpty'](_0x50fb57)){return _[_0xfbec('0x2f')](_0x50fb57,function(_0x2df235){return _0x2df235[_0xfbec('0x5b')];});}else{return;}})['then'](function(_0x43d9bb){if(_0x43d9bb)_0x16fabb=_0x43d9bb;if(_['includes'](_0x16fabb,0x64)){var _0xdd9aa=_[_0xfbec('0x4c')](_0x50fb57,{'sectionId':0x64});return hasDefaultDashboard(_0xdd9aa)['then'](function(_0x59db5b){return _[_0xfbec('0x2f')](_0x50fb57,function(_0x370038){if(_0x370038[_0xfbec('0x5b')]===0x64){_0x370038[_0xfbec('0x66')]=_0x59db5b;}return _0x370038;});});}else{return;}})['then'](function(_0x2e7287){if(_0x2e7287)_0x50fb57=_0x2e7287;if(_[_0xfbec('0x65')](_0x16fabb,0x3eb)){var _0x1cac63=_[_0xfbec('0x4c')](_0x50fb57,{'sectionId':0x3eb});return getCustomDashboards(_0x1cac63)[_0xfbec('0x29')](function(_0x553a93){return _[_0xfbec('0x2f')](_0x50fb57,function(_0x2a83f2){if(_0x1cac63[_0xfbec('0x64')]){if(_0x2a83f2[_0xfbec('0x5b')]===0x3eb){_0x2a83f2['subsections']=_0x553a93;}}else{if(_0x2a83f2['sectionId']===0x64){_0x2a83f2[_0xfbec('0x66')]=_0x553a93;}}return _0x2a83f2;});});}else{return;}})[_0xfbec('0x29')](function(_0x5c360b){if(_0x5c360b)_0x50fb57=_0x5c360b;if(_['includes'](_0x16fabb,0x709)){var _0x1c05e4=_[_0xfbec('0x4c')](_0x50fb57,{'sectionId':0x709});return getPlugins(_0x1c05e4)['then'](function(_0xfd4fdf){if(_0x1c05e4[_0xfbec('0x64')]){return _['map'](_0x50fb57,function(_0x490e05){if(_0x490e05[_0xfbec('0x5b')]===0x709){_0x490e05['subsections']=_0xfd4fdf;}return _0x490e05;});}else{var _0x495a5d={'sectionId':0x76c,'enabled':0x1,'subsections':_0xfd4fdf};var _0x58b0d5=_[_0xfbec('0x2f')](_0x50fb57);_0x58b0d5[_0xfbec('0x62')](_0x495a5d);return _0x58b0d5;}});}else{return;}})[_0xfbec('0x29')](function(_0x11796f){if(_0x11796f)_0x50fb57=_0x11796f;return _[_0xfbec('0x3f')](_0x50fb57,[_0xfbec('0x64'),0x1]);})['then'](respondWithResult(_0x192d9b,null))[_0xfbec('0x4d')](handleError(_0x192d9b,null));};function hasDefaultDashboard(_0x307cec){var _0x2c7146=[0x65];return new BPromise(function(_0x6acfb7,_0x56f05){try{if(_0x307cec['autoAssociation']){_0x6acfb7(_0x2c7146);}else{return db[_0xfbec('0x5a')]['findOne']({'where':{'sectionId':_0x307cec['id']},'raw':!![]})[_0xfbec('0x29')](function(_0xfbe6fc){_0xfbe6fc?_0x6acfb7(_0x2c7146):_0x6acfb7();});}}catch(_0x148cb9){_0x56f05(_0x148cb9);}});}function getCustomDashboards(_0x27d921){var _0x10e58f=[];return new BPromise(function(_0x5e70d6,_0x4bf568){try{if(_0x27d921[_0xfbec('0x59')]){return db[_0xfbec('0x67')][_0xfbec('0x45')]({'raw':!![]})[_0xfbec('0x29')](function(_0x291202){_0x291202[_0xfbec('0x68')](function(_0x380924){_0x10e58f['push'](_0x380924['id']+0x1869f);});_0x5e70d6(_0x10e58f);});}else{return db['UserProfileResource'][_0xfbec('0x45')]({'where':{'sectionId':_0x27d921['id']},'raw':!![]})[_0xfbec('0x29')](function(_0x423bfd){_0x423bfd['forEach'](function(_0x13f125){_0x10e58f[_0xfbec('0x62')](_0x13f125[_0xfbec('0x69')]+0x1869f);});_0x5e70d6(_0x10e58f);});}}catch(_0x27fb9a){_0x4bf568(_0x27fb9a);}});}function getPlugins(_0x406313){var _0x102dcf=[];return new BPromise(function(_0x144ba8,_0x458733){try{if(_0x406313[_0xfbec('0x59')]){return db[_0xfbec('0x6a')]['findAll']({'raw':!![]})['then'](function(_0x4abda5){_0x4abda5[_0xfbec('0x68')](function(_0x47ca8a){_0x102dcf[_0xfbec('0x62')](_0x47ca8a['id']+0x15b38);});_0x144ba8(_0x102dcf);});}else{return db[_0xfbec('0x5a')]['findAll']({'where':{'sectionId':_0x406313['id']},'raw':!![]})[_0xfbec('0x29')](function(_0x5c9147){_0x5c9147['forEach'](function(_0x5285a2){_0x102dcf[_0xfbec('0x62')](_0x5285a2[_0xfbec('0x69')]+0x15b38);});_0x144ba8(_0x102dcf);});}}catch(_0x4b3b57){_0x458733(_0x4b3b57);}});}exports[_0xfbec('0x6b')]=function(_0x86f98f,_0x40bae6){return db[_0xfbec('0x30')]['find']({'where':{'id':_0x86f98f[_0xfbec('0x48')]['id']}})['then'](handleEntityNotFound(_0x40bae6,null))[_0xfbec('0x29')](function(_0x57d27c){if(_0x57d27c){return db[_0xfbec('0x56')][_0xfbec('0x57')](function(_0x6cc594){return db['UserProfileSection'][_0xfbec('0x45')]({'where':{'userProfileId':_0x86f98f[_0xfbec('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xfbec('0x29')](function(_0x3c83e7){if(_0x3c83e7){return db['UserProfileSection'][_0xfbec('0x5d')]({'where':{'userProfileId':_0x86f98f[_0xfbec('0x48')]['id'],'id':_['map'](_0x3c83e7,function(_0x101fc6){return _0x101fc6['id'];})},'transaction':_0x6cc594});}})[_0xfbec('0x29')](function(_0xaab033){var _0x13980f=_[_0xfbec('0x2f')](_0x86f98f[_0xfbec('0x4f')],function(_0x50da4b){_0x50da4b[_0xfbec('0x5c')]=_0x86f98f['params']['id'];return _0x50da4b;});return db[_0xfbec('0x60')][_0xfbec('0x6c')](_0x13980f,{'raw':!![],'transaction':_0x6cc594});})[_0xfbec('0x29')](function(_0x4a2411){var _0x26ad6b=_[_0xfbec('0x3f')](_[_0xfbec('0x2f')](_0x4a2411,function(_0x440995){return _0x440995[_0xfbec('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x26ad6b){return db[_0xfbec('0x60')]['findAll']({'where':{'userProfileId':_0x86f98f['params']['id'],'sectionId':_[_0xfbec('0x2f')](_0x26ad6b,function(_0x54809e){return _0x54809e[_0xfbec('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x41fc20){var _0x1d8836=_[_0xfbec('0x2f')](_0x86f98f[_0xfbec('0x4f')],function(_0x3f0cc7){_0x3f0cc7[_0xfbec('0x5c')]=_0x86f98f['params']['id'];return _0x3f0cc7;});return db[_0xfbec('0x5a')][_0xfbec('0x6c')](_0x1d8836,{'raw':!![],'transaction':_0x6cc594});});}})['catch'](handleError(_0x40bae6,null));});}})['then'](function(_0x4802ce){var _0x3a1179=_[_0xfbec('0x2f')](_0x4802ce,function(_0x2042e1){return _0x2042e1[_0xfbec('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x40bae6,null))['catch'](handleError(_0x40bae6,null));};exports['removeResources']=function(_0x54890d,_0x34f5ab,_0x53a885){return db[_0xfbec('0x30')][_0xfbec('0x4c')]({'where':{'id':_0x54890d['params']['id']}})[_0xfbec('0x29')](handleEntityNotFound(_0x34f5ab,null))[_0xfbec('0x29')](function(_0x213bda){if(_0x213bda){return _0x213bda['removeResources'](_0x54890d[_0xfbec('0x35')][_0xfbec('0x6d')]);}})[_0xfbec('0x29')](respondWithStatusCode(_0x34f5ab,null))[_0xfbec('0x4d')](handleError(_0x34f5ab,null));};exports[_0xfbec('0x6e')]=function(_0x1e004a,_0x5f1c19){var _0x366cf4={};if(!_0x1e004a[_0xfbec('0x35')]['section'])throw new Error(_0xfbec('0x6f'));if(!_0x1e004a[_0xfbec('0x35')][_0xfbec('0x3b')]('nolimit')){_0x366cf4[_0xfbec('0x22')]=qs[_0xfbec('0x22')](_0x1e004a[_0xfbec('0x35')]['limit']);_0x366cf4[_0xfbec('0x20')]=qs[_0xfbec('0x20')](_0x1e004a['query'][_0xfbec('0x20')]);}return db[_0xfbec('0x30')][_0xfbec('0x4c')]({'where':{'id':_0x1e004a[_0xfbec('0x48')]['id']}})[_0xfbec('0x29')](function(_0x4655e5){if(!_0x4655e5)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1e004a[_0xfbec('0x48')]['id']);return db[_0xfbec('0x30')][_0xfbec('0x6e')](_0x1e004a);})[_0xfbec('0x29')](respondWithFilteredResult(_0x5f1c19,_0x366cf4))[_0xfbec('0x4d')](handleError(_0x5f1c19,null));}; \ No newline at end of file +var _0x13b6=['VIRTUAL','UserProfile','includeAll','include','findAll','catch','params','find','create','body','clone','options','get','omit','crudPermissions','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','transaction','push','includes','isEmpty','subsections','enabled','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4cd85f,_0x491c92){var _0x26764d=function(_0x57a117){while(--_0x57a117){_0x4cd85f['push'](_0x4cd85f['shift']());}};_0x26764d(++_0x491c92);}(_0x13b6,0x97));var _0x613b=function(_0x35dc0b,_0x230737){_0x35dc0b=_0x35dc0b-0x0;var _0x40b521=_0x13b6[_0x35dc0b];return _0x40b521;};'use strict';var emlformat=require(_0x613b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x613b('0x1'));var jsonpatch=require(_0x613b('0x2'));var rp=require(_0x613b('0x3'));var moment=require(_0x613b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613b('0x5'));var util=require(_0x613b('0x6'));var path=require(_0x613b('0x7'));var sox=require('sox');var csv=require(_0x613b('0x8'));var ejs=require(_0x613b('0x9'));var fs=require('fs');var fs_extra=require(_0x613b('0xa'));var _=require('lodash');var squel=require(_0x613b('0xb'));var crypto=require('crypto');var jsforce=require(_0x613b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x613b('0xd'));var Papa=require(_0x613b('0xe'));var Redis=require(_0x613b('0xf'));var authService=require(_0x613b('0x10'));var qs=require(_0x613b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x613b('0x12'))('api');var utils=require(_0x613b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x613b('0x14'))['db'];config[_0x613b('0x15')]=_[_0x613b('0x16')](config['redis'],{'host':_0x613b('0x17'),'port':0x18eb});var socket=require(_0x613b('0x18'))(new Redis(config[_0x613b('0x15')]));require(_0x613b('0x19'))[_0x613b('0x1a')](socket);function respondWithStatusCode(_0x3516ed,_0xae6dd1){_0xae6dd1=_0xae6dd1||0xcc;return function(_0x3c1e24){if(_0x3c1e24){return _0x3516ed[_0x613b('0x1b')](_0xae6dd1);}return _0x3516ed[_0x613b('0x1c')](_0xae6dd1)['end']();};}function respondWithResult(_0xa74b30,_0x3023a4){_0x3023a4=_0x3023a4||0xc8;return function(_0x12f0d1){if(_0x12f0d1){return _0xa74b30['status'](_0x3023a4)['json'](_0x12f0d1);}};}function respondWithFilteredResult(_0x41a912,_0x588d5d){return function(_0x27949c){if(_0x27949c){var _0x4d3def=typeof _0x588d5d[_0x613b('0x1d')]===_0x613b('0x1e')&&typeof _0x588d5d[_0x613b('0x1f')]===_0x613b('0x1e');var _0x22fee9=_0x27949c[_0x613b('0x20')];var _0x231fcb=_0x4d3def?0x0:_0x588d5d['offset'];var _0x393168=_0x4d3def?_0x27949c[_0x613b('0x20')]:_0x588d5d['offset']+_0x588d5d['limit'];var _0x22b5ec;if(_0x393168>=_0x22fee9){_0x393168=_0x22fee9;_0x22b5ec=0xc8;}else{_0x22b5ec=0xce;}_0x41a912[_0x613b('0x1c')](_0x22b5ec);return _0x41a912[_0x613b('0x21')](_0x613b('0x22'),_0x231fcb+'-'+_0x393168+'/'+_0x22fee9)[_0x613b('0x23')](_0x27949c);}return null;};}function patchUpdates(_0x4d9728){return function(_0x84c80f){try{jsonpatch['apply'](_0x84c80f,_0x4d9728,!![]);}catch(_0x295420){return BPromise[_0x613b('0x24')](_0x295420);}return _0x84c80f[_0x613b('0x25')]();};}function saveUpdates(_0x101ec7,_0x485a6d){return function(_0x32a460){if(_0x32a460){return _0x32a460['update'](_0x101ec7)[_0x613b('0x26')](function(_0x4ad958){return _0x4ad958;});}return null;};}function removeEntity(_0x116b0e,_0x17e3ac){return function(_0x1a08dc){if(_0x1a08dc){return _0x1a08dc[_0x613b('0x27')]()[_0x613b('0x26')](function(){_0x116b0e[_0x613b('0x1c')](0xcc)[_0x613b('0x28')]();});}};}function handleEntityNotFound(_0x374547,_0x2d7191){return function(_0x63f8c3){if(!_0x63f8c3){_0x374547[_0x613b('0x1b')](0x194);}return _0x63f8c3;};}function handleError(_0x367c1a,_0x4f6bdf){_0x4f6bdf=_0x4f6bdf||0x1f4;return function(_0x46529a){logger[_0x613b('0x29')](_0x46529a[_0x613b('0x2a')]);if(_0x46529a[_0x613b('0x2b')]){delete _0x46529a[_0x613b('0x2b')];}_0x367c1a[_0x613b('0x1c')](_0x4f6bdf)[_0x613b('0x2c')](_0x46529a);};}exports['index']=function(_0x228f39,_0x169baf){var _0x56561f={},_0x3af1ff={},_0x4f2df9={'count':0x0,'rows':[]};var _0x3ed316=_[_0x613b('0x2d')](db['UserProfile'][_0x613b('0x2e')],function(_0x37294f){return{'name':_0x37294f[_0x613b('0x2f')],'type':_0x37294f[_0x613b('0x30')][_0x613b('0x31')]};});_0x3af1ff[_0x613b('0x32')]=_[_0x613b('0x2d')](_0x3ed316,_0x613b('0x2b'));_0x3af1ff[_0x613b('0x33')]=_[_0x613b('0x34')](_0x228f39[_0x613b('0x33')]);_0x3af1ff[_0x613b('0x35')]=_[_0x613b('0x36')](_0x3af1ff['model'],_0x3af1ff[_0x613b('0x33')]);_0x56561f[_0x613b('0x37')]=_[_0x613b('0x36')](_0x3af1ff[_0x613b('0x32')],qs['fields'](_0x228f39['query'][_0x613b('0x38')]));_0x56561f[_0x613b('0x37')]=_0x56561f[_0x613b('0x37')][_0x613b('0x39')]?_0x56561f[_0x613b('0x37')]:_0x3af1ff[_0x613b('0x32')];if(!_0x228f39[_0x613b('0x33')]['hasOwnProperty'](_0x613b('0x3a'))){_0x56561f[_0x613b('0x1f')]=qs[_0x613b('0x1f')](_0x228f39[_0x613b('0x33')][_0x613b('0x1f')]);_0x56561f[_0x613b('0x1d')]=qs[_0x613b('0x1d')](_0x228f39[_0x613b('0x33')][_0x613b('0x1d')]);}_0x56561f[_0x613b('0x3b')]=qs[_0x613b('0x3c')](_0x228f39[_0x613b('0x33')][_0x613b('0x3c')]);_0x56561f[_0x613b('0x3d')]=qs[_0x613b('0x35')](_[_0x613b('0x3e')](_0x228f39[_0x613b('0x33')],_0x3af1ff[_0x613b('0x35')]),_0x3ed316);if(_0x228f39['query'][_0x613b('0x3f')]){_0x56561f[_0x613b('0x3d')]=_[_0x613b('0x40')](_0x56561f[_0x613b('0x3d')],{'$or':_[_0x613b('0x2d')](_0x3ed316,function(_0x127500){if(_0x127500[_0x613b('0x30')]!==_0x613b('0x41')){var _0x18d31e={};_0x18d31e[_0x127500[_0x613b('0x2b')]]={'$like':'%'+_0x228f39[_0x613b('0x33')]['filter']+'%'};return _0x18d31e;}})});}_0x56561f=_[_0x613b('0x40')]({},_0x56561f,_0x228f39['options']);var _0x5ea015={'where':_0x56561f[_0x613b('0x3d')]};return db[_0x613b('0x42')][_0x613b('0x20')](_0x5ea015)[_0x613b('0x26')](function(_0x48bca8){_0x4f2df9[_0x613b('0x20')]=_0x48bca8;if(_0x228f39['query'][_0x613b('0x43')]){_0x56561f[_0x613b('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x613b('0x45')](_0x56561f);})['then'](function(_0x48a4fb){_0x4f2df9['rows']=_0x48a4fb;return _0x4f2df9;})['then'](respondWithFilteredResult(_0x169baf,_0x56561f))[_0x613b('0x46')](handleError(_0x169baf,null));};exports['show']=function(_0x385c1c,_0x389868){var _0x57d5fa={'raw':![],'where':{'id':_0x385c1c[_0x613b('0x47')]['id']}},_0x392a2d={};_0x392a2d[_0x613b('0x32')]=_[_0x613b('0x34')](db['UserProfile']['rawAttributes']);_0x392a2d[_0x613b('0x33')]=_[_0x613b('0x34')](_0x385c1c[_0x613b('0x33')]);_0x392a2d['filters']=_['intersection'](_0x392a2d[_0x613b('0x32')],_0x392a2d[_0x613b('0x33')]);_0x57d5fa[_0x613b('0x37')]=_['intersection'](_0x392a2d['model'],qs[_0x613b('0x38')](_0x385c1c[_0x613b('0x33')][_0x613b('0x38')]));_0x57d5fa[_0x613b('0x37')]=_0x57d5fa[_0x613b('0x37')][_0x613b('0x39')]?_0x57d5fa[_0x613b('0x37')]:_0x392a2d[_0x613b('0x32')];if(_0x385c1c[_0x613b('0x33')][_0x613b('0x43')]){_0x57d5fa[_0x613b('0x44')]=[{'all':!![]}];}_0x57d5fa=_[_0x613b('0x40')]({},_0x57d5fa,_0x385c1c['options']);return db[_0x613b('0x42')][_0x613b('0x48')](_0x57d5fa)[_0x613b('0x26')](handleEntityNotFound(_0x389868,null))[_0x613b('0x26')](respondWithResult(_0x389868,null))[_0x613b('0x46')](handleError(_0x389868,null));};exports['create']=function(_0x1e6226,_0x2d3995){return db[_0x613b('0x42')][_0x613b('0x49')](_0x1e6226[_0x613b('0x4a')],{})[_0x613b('0x26')](respondWithResult(_0x2d3995,0xc9))[_0x613b('0x46')](handleError(_0x2d3995,null));};exports[_0x613b('0x4b')]=function(_0x1b23a3,_0x378205){var _0x1813f8={'where':{'id':_0x1b23a3[_0x613b('0x47')]['id']}},_0x43fcf1={};_0x43fcf1[_0x613b('0x32')]=_[_0x613b('0x34')](db[_0x613b('0x42')][_0x613b('0x2e')]);_0x1813f8[_0x613b('0x37')]=_[_0x613b('0x36')](_0x43fcf1['model'],qs[_0x613b('0x38')](_0x1b23a3[_0x613b('0x33')][_0x613b('0x38')]));_0x1813f8['attributes']=_0x1813f8['attributes'][_0x613b('0x39')]?_0x1813f8[_0x613b('0x37')]:_0x43fcf1[_0x613b('0x32')];if(_0x1b23a3['query'][_0x613b('0x43')]){_0x1813f8[_0x613b('0x44')]=[{'all':!![]}];}_0x1813f8=_['merge']({},_0x1813f8,_0x1b23a3[_0x613b('0x4c')]);return db[_0x613b('0x42')][_0x613b('0x48')](_0x1813f8)[_0x613b('0x26')](handleEntityNotFound(_0x378205,null))[_0x613b('0x26')](function(_0x1eb1de){if(_0x1eb1de){var _0x5ef07a=_0x1eb1de[_0x613b('0x4d')]({'plain':!![]});_0x5ef07a=qs[_0x613b('0x4e')](_0x5ef07a,['id','createdAt','updatedAt',_0x613b('0x4f')]);_0x1b23a3['body']=_['omit'](_0x1b23a3[_0x613b('0x4a')],['id',_0x613b('0x50'),_0x613b('0x51')]);return db[_0x613b('0x52')]['transaction'](function(_0x2ea46a){return db[_0x613b('0x42')][_0x613b('0x49')](_['merge'](_0x5ef07a,_0x1b23a3['body']),{'include':_0x1b23a3[_0x613b('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2ea46a})['then'](function(_0x258c69){var _0x5cdc2a=_0x258c69[_0x613b('0x4d')]({'plain':!![]});return db[_0x613b('0x53')][_0x613b('0x45')]({'where':{'userProfileId':_0x1b23a3[_0x613b('0x47')]['id']},'raw':!![]})['then'](function(_0x4f84b2){if(_0x4f84b2){return BPromise[_0x613b('0x54')](_0x4f84b2,function(_0x3751b6){return new BPromise(function(_0x109a2a,_0x209ff7){if(_0x3751b6[_0x613b('0x55')]===null||_0x3751b6[_0x613b('0x55')]===0x1)_0x109a2a(null);return db[_0x613b('0x56')][_0x613b('0x45')]({'where':{'sectionId':_0x3751b6['id']},'raw':!![]})[_0x613b('0x26')](function(_0x119c97){var _0x3600d0=_[_0x613b('0x2d')](_0x119c97,function(_0x3c3d22){return qs[_0x613b('0x4e')](_0x3c3d22,['id','createdAt',_0x613b('0x51'),_0x613b('0x57')]);});_0x109a2a(_0x3600d0);})[_0x613b('0x46')](function(_0x56bd02){_0x209ff7(_0x56bd02);});})[_0x613b('0x26')](function(_0x34bdaf){var _0x3cf80a=qs[_0x613b('0x4e')](_0x3751b6,['id',_0x613b('0x50'),_0x613b('0x51')]);_0x3cf80a[_0x613b('0x58')]=_0x5cdc2a['id'];if(_0x34bdaf)_0x3cf80a[_0x613b('0x59')]=_0x34bdaf;return _0x3cf80a;})['then'](function(_0x14a1ab){return db[_0x613b('0x53')]['create'](_0x14a1ab,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x2ea46a});});})['then'](function(){return _0x5cdc2a;});}});});});}})['then'](respondWithResult(_0x378205,0xc9))[_0x613b('0x46')](handleError(_0x378205,null));};exports[_0x613b('0x5a')]=function(_0x13d17b,_0x108318){if(_0x13d17b[_0x613b('0x4a')]['id']){delete _0x13d17b['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x13d17b[_0x613b('0x47')]['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x108318,null))[_0x613b('0x26')](saveUpdates(_0x13d17b[_0x613b('0x4a')],null))['then'](respondWithResult(_0x108318,null))[_0x613b('0x46')](handleError(_0x108318,null));};exports[_0x613b('0x27')]=function(_0x7cfc4a,_0x2745c3){return db[_0x613b('0x42')]['find']({'where':{'id':_0x7cfc4a[_0x613b('0x47')]['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x2745c3,null))[_0x613b('0x26')](removeEntity(_0x2745c3,null))[_0x613b('0x46')](handleError(_0x2745c3,null));};exports[_0x613b('0x5b')]=function(_0x7c00c5,_0xb235f5){return db[_0x613b('0x42')][_0x613b('0x5b')]()[_0x613b('0x26')](respondWithResult(_0xb235f5,null))[_0x613b('0x46')](handleError(_0xb235f5,null));};exports['addSections']=function(_0x279e27,_0x3ee588){var _0x3d58d3=_0x279e27['body'];return db['UserProfile'][_0x613b('0x48')]({'where':{'id':_0x279e27[_0x613b('0x47')]['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x3ee588,null))[_0x613b('0x26')](function(_0x6b4199){if(_0x6b4199){return db[_0x613b('0x52')][_0x613b('0x5c')](function(_0x3e42d6){return db['UserProfileSection'][_0x613b('0x27')]({'where':{'userProfileId':_0x279e27[_0x613b('0x47')]['id'],'sectionId':_[_0x613b('0x2d')](_0x3d58d3,function(_0x2685ac){return _0x2685ac[_0x613b('0x57')];})},'transaction':_0x3e42d6})[_0x613b('0x26')](function(){var _0x5a58ce=_[_0x613b('0x2d')](_0x3d58d3,function(_0x5c9d99){_0x5c9d99[_0x613b('0x58')]=_0x279e27['params']['id'];return _0x5c9d99;});var _0x36c23c=[];return BPromise['each'](_0x5a58ce,function(_0x3e2213){return db[_0x613b('0x53')]['create'](_0x3e2213,{'include':[{'model':db[_0x613b('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x3e42d6})[_0x613b('0x26')](function(_0x1a26a2){_0x36c23c[_0x613b('0x5d')](_0x1a26a2['get']({'plain':!![]}));});})['then'](function(){return _0x36c23c;});});});}})[_0x613b('0x26')](function(_0xf05af9){return _0xf05af9;})['then'](respondWithResult(_0x3ee588,null))[_0x613b('0x46')](handleError(_0x3ee588,null));};exports['removeSections']=function(_0x881822,_0xfa8443){var _0x1eb029;return db[_0x613b('0x42')]['find']({'where':{'id':_0x881822[_0x613b('0x47')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0xfa8443,null))[_0x613b('0x26')](function(_0x13e836){if(_0x13e836){_0x1eb029=_0x13e836;return db[_0x613b('0x53')][_0x613b('0x27')]({'where':{'userProfileId':_0x881822[_0x613b('0x47')]['id'],'sectionId':_0x881822[_0x613b('0x33')]['ids']}});}})[_0x613b('0x26')](function(){return _0x1eb029;})[_0x613b('0x26')](respondWithStatusCode(_0xfa8443,null))[_0x613b('0x46')](handleError(_0xfa8443,null));};exports['getSections']=function(_0x4c0332,_0x8fcff4){var _0x331851=[];var _0x4e4ae2=[];return db[_0x613b('0x53')][_0x613b('0x45')]({'where':{'userProfileId':_0x4c0332['params']['id']},'raw':!![]})[_0x613b('0x26')](function(_0x1c077a){_0x331851=_[_0x613b('0x3f')](_0x1c077a,function(_0x14188f){return _0x14188f['enabled']===0x1||_[_0x613b('0x5e')]([0x3eb,0x709],_0x14188f[_0x613b('0x57')]);});if(!_[_0x613b('0x5f')](_0x331851)){return _[_0x613b('0x2d')](_0x331851,function(_0x2b2338){return _0x2b2338['sectionId'];});}else{return;}})[_0x613b('0x26')](function(_0x10b169){if(_0x10b169)_0x4e4ae2=_0x10b169;if(_[_0x613b('0x5e')](_0x4e4ae2,0x64)){var _0x261ee2=_[_0x613b('0x48')](_0x331851,{'sectionId':0x64});return hasDefaultDashboard(_0x261ee2)[_0x613b('0x26')](function(_0x49a2c3){return _[_0x613b('0x2d')](_0x331851,function(_0x54874f){if(_0x54874f['sectionId']===0x64){_0x54874f[_0x613b('0x60')]=_0x49a2c3;}return _0x54874f;});});}else{return;}})[_0x613b('0x26')](function(_0x325492){if(_0x325492)_0x331851=_0x325492;if(_[_0x613b('0x5e')](_0x4e4ae2,0x3eb)){var _0x343193=_[_0x613b('0x48')](_0x331851,{'sectionId':0x3eb});return getCustomDashboards(_0x343193)[_0x613b('0x26')](function(_0x1bf5d2){return _[_0x613b('0x2d')](_0x331851,function(_0x337ff3){if(_0x343193['enabled']){if(_0x337ff3['sectionId']===0x3eb){_0x337ff3[_0x613b('0x60')]=_0x1bf5d2;}}else{if(_0x337ff3[_0x613b('0x57')]===0x64){_0x337ff3['subsections']=_0x1bf5d2;}}return _0x337ff3;});});}else{return;}})['then'](function(_0x17f422){if(_0x17f422)_0x331851=_0x17f422;if(_[_0x613b('0x5e')](_0x4e4ae2,0x709)){var _0x187b77=_[_0x613b('0x48')](_0x331851,{'sectionId':0x709});return getPlugins(_0x187b77)['then'](function(_0x10ff52){if(_0x187b77[_0x613b('0x61')]){return _['map'](_0x331851,function(_0x4ae273){if(_0x4ae273[_0x613b('0x57')]===0x709){_0x4ae273[_0x613b('0x60')]=_0x10ff52;}return _0x4ae273;});}else{var _0x2e706f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10ff52};var _0x5944ac=_[_0x613b('0x2d')](_0x331851);_0x5944ac['push'](_0x2e706f);return _0x5944ac;}});}else{return;}})[_0x613b('0x26')](function(_0x378353){if(_0x378353)_0x331851=_0x378353;return _[_0x613b('0x3f')](_0x331851,[_0x613b('0x61'),0x1]);})[_0x613b('0x26')](respondWithResult(_0x8fcff4,null))[_0x613b('0x46')](handleError(_0x8fcff4,null));};function hasDefaultDashboard(_0x3d7bde){var _0x52a649=[0x65];return new BPromise(function(_0x352fc3,_0x2dec83){try{if(_0x3d7bde[_0x613b('0x55')]){_0x352fc3(_0x52a649);}else{return db[_0x613b('0x56')]['findOne']({'where':{'sectionId':_0x3d7bde['id']},'raw':!![]})[_0x613b('0x26')](function(_0x336061){_0x336061?_0x352fc3(_0x52a649):_0x352fc3();});}}catch(_0x4a440d){_0x2dec83(_0x4a440d);}});}function getCustomDashboards(_0x464689){var _0x118f1d=[];return new BPromise(function(_0x456eee,_0xbe7782){try{if(_0x464689['autoAssociation']){return db[_0x613b('0x62')][_0x613b('0x45')]({'raw':!![]})['then'](function(_0x2cb319){_0x2cb319[_0x613b('0x63')](function(_0x129436){_0x118f1d[_0x613b('0x5d')](_0x129436['id']+0x1869f);});_0x456eee(_0x118f1d);});}else{return db[_0x613b('0x56')][_0x613b('0x45')]({'where':{'sectionId':_0x464689['id']},'raw':!![]})[_0x613b('0x26')](function(_0x20c6c9){_0x20c6c9[_0x613b('0x63')](function(_0x348c77){_0x118f1d[_0x613b('0x5d')](_0x348c77['resourceId']+0x1869f);});_0x456eee(_0x118f1d);});}}catch(_0x36d6c0){_0xbe7782(_0x36d6c0);}});}function getPlugins(_0x4355bc){var _0x4dc34a=[];return new BPromise(function(_0x304f92,_0x93dcef){try{if(_0x4355bc[_0x613b('0x55')]){return db[_0x613b('0x64')]['findAll']({'raw':!![]})['then'](function(_0x11123f){_0x11123f[_0x613b('0x63')](function(_0x4a5881){_0x4dc34a[_0x613b('0x5d')](_0x4a5881['id']+0x15b38);});_0x304f92(_0x4dc34a);});}else{return db[_0x613b('0x56')]['findAll']({'where':{'sectionId':_0x4355bc['id']},'raw':!![]})[_0x613b('0x26')](function(_0x4c3966){_0x4c3966[_0x613b('0x63')](function(_0x2f9e30){_0x4dc34a[_0x613b('0x5d')](_0x2f9e30['resourceId']+0x15b38);});_0x304f92(_0x4dc34a);});}}catch(_0x15f1ae){_0x93dcef(_0x15f1ae);}});}exports[_0x613b('0x65')]=function(_0xc7522e,_0x5d0fa7){return db[_0x613b('0x42')][_0x613b('0x48')]({'where':{'id':_0xc7522e['params']['id']}})['then'](handleEntityNotFound(_0x5d0fa7,null))['then'](function(_0x110d2b){if(_0x110d2b){return db[_0x613b('0x52')][_0x613b('0x5c')](function(_0x4014a8){return db['UserProfileSection'][_0x613b('0x45')]({'where':{'userProfileId':_0xc7522e[_0x613b('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4f1eaf){if(_0x4f1eaf){return db[_0x613b('0x53')][_0x613b('0x27')]({'where':{'userProfileId':_0xc7522e[_0x613b('0x47')]['id'],'id':_[_0x613b('0x2d')](_0x4f1eaf,function(_0x4acdc4){return _0x4acdc4['id'];})},'transaction':_0x4014a8});}})[_0x613b('0x26')](function(_0x3f9cd6){var _0x25528a=_['map'](_0xc7522e[_0x613b('0x4a')],function(_0x7d9ef2){_0x7d9ef2[_0x613b('0x58')]=_0xc7522e['params']['id'];return _0x7d9ef2;});return db[_0x613b('0x53')]['bulkCreate'](_0x25528a,{'raw':!![],'transaction':_0x4014a8});})['then'](function(_0x1710a8){var _0x2d2b31=_[_0x613b('0x3f')](_['map'](_0x1710a8,function(_0x4b769b){return _0x4b769b[_0x613b('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x2d2b31){return db[_0x613b('0x53')][_0x613b('0x45')]({'where':{'userProfileId':_0xc7522e[_0x613b('0x47')]['id'],'sectionId':_[_0x613b('0x2d')](_0x2d2b31,function(_0x3cd9c1){return _0x3cd9c1[_0x613b('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x163f0d){var _0x17ca3f=_[_0x613b('0x2d')](_0xc7522e['body'],function(_0x35ab20){_0x35ab20['userProfileId']=_0xc7522e['params']['id'];return _0x35ab20;});return db[_0x613b('0x56')][_0x613b('0x66')](_0x17ca3f,{'raw':!![],'transaction':_0x4014a8});});}})[_0x613b('0x46')](handleError(_0x5d0fa7,null));});}})[_0x613b('0x26')](function(_0x273781){var _0xb40bf=_[_0x613b('0x2d')](_0x273781,function(_0x46cc74){return _0x46cc74['get']({'plain':!![]});});})[_0x613b('0x26')](respondWithResult(_0x5d0fa7,null))[_0x613b('0x46')](handleError(_0x5d0fa7,null));};exports[_0x613b('0x67')]=function(_0x19f46b,_0x269e3e,_0x46df6c){return db[_0x613b('0x42')]['find']({'where':{'id':_0x19f46b['params']['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x269e3e,null))[_0x613b('0x26')](function(_0x380587){if(_0x380587){return _0x380587[_0x613b('0x67')](_0x19f46b['query']['ids']);}})[_0x613b('0x26')](respondWithStatusCode(_0x269e3e,null))[_0x613b('0x46')](handleError(_0x269e3e,null));};exports['getResources']=function(_0x1ce2da,_0x13eb17){var _0x253d59={};if(!_0x1ce2da[_0x613b('0x33')][_0x613b('0x68')])throw new Error(_0x613b('0x69'));if(!_0x1ce2da['query'][_0x613b('0x6a')](_0x613b('0x3a'))){_0x253d59[_0x613b('0x1f')]=qs[_0x613b('0x1f')](_0x1ce2da[_0x613b('0x33')][_0x613b('0x1f')]);_0x253d59['offset']=qs['offset'](_0x1ce2da[_0x613b('0x33')][_0x613b('0x1d')]);}return db[_0x613b('0x42')][_0x613b('0x48')]({'where':{'id':_0x1ce2da[_0x613b('0x47')]['id']}})[_0x613b('0x26')](function(_0x523629){if(!_0x523629)throw new Error(_0x613b('0x6b')+_0x1ce2da[_0x613b('0x47')]['id']);return db[_0x613b('0x42')]['getResources'](_0x1ce2da);})[_0x613b('0x26')](respondWithFilteredResult(_0x13eb17,_0x253d59))[_0x613b('0x46')](handleError(_0x13eb17,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e83b48d..6ebb93e 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 _0xb4b6=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x34cc62,_0x1e5e84){_0x34cc62=_0x34cc62-0x0;var _0x59c873=_0xb4b6[_0x34cc62];return _0x59c873;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6b4b('0x0'))['db'][_0x6b4b('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6b4b('0x2')](0x0);var events={'afterCreate':_0x6b4b('0x3'),'afterUpdate':_0x6b4b('0x4'),'afterDestroy':_0x6b4b('0x5')};function emitEvent(_0x1a8934){return function(_0xff2737,_0x422b21,_0x562733){UserProfileEvents[_0x6b4b('0x6')](_0x1a8934+':'+_0xff2737['id'],_0xff2737);UserProfileEvents['emit'](_0x1a8934,_0xff2737);_0x562733(null);};}for(var e in events){if(events[_0x6b4b('0x7')](e)){var event=events[e];UserProfile[_0x6b4b('0x8')](e,emitEvent(event));}}module[_0x6b4b('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xe260=['remove','emit','hook','exports','events','UserProfile','setMaxListeners','save','update'];(function(_0x55ae58,_0x32b6de){var _0x2e5b4=function(_0x4c5a64){while(--_0x4c5a64){_0x55ae58['push'](_0x55ae58['shift']());}};_0x2e5b4(++_0x32b6de);}(_0xe260,0x94));var _0x0e26=function(_0xc25e94,_0x353e27){_0xc25e94=_0xc25e94-0x0;var _0x5d88c5=_0xe260[_0xc25e94];return _0x5d88c5;};'use strict';var EventEmitter=require(_0x0e26('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x0e26('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0e26('0x2')](0x0);var events={'afterCreate':_0x0e26('0x3'),'afterUpdate':_0x0e26('0x4'),'afterDestroy':_0x0e26('0x5')};function emitEvent(_0x16613c){return function(_0x4a2388,_0x937f2a,_0x141a58){UserProfileEvents[_0x0e26('0x6')](_0x16613c+':'+_0x4a2388['id'],_0x4a2388);UserProfileEvents['emit'](_0x16613c,_0x4a2388);_0x141a58(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x0e26('0x7')](e,emitEvent(event));}}module[_0x0e26('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 43ffc9e..370d047 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 _0x2ef3=['squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','UserProfileResource','AnalyticExtractedReport','type','resourceId','catch','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','user_has_','_interactions','where','query','define','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','attributes','intersection','hasOwnProperty','limit','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','DefaultReports','custom','CustomReports','rows','count','include','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs'];(function(_0x295dce,_0x580fd5){var _0x27af29=function(_0x1899db){while(--_0x1899db){_0x295dce['push'](_0x295dce['shift']());}};_0x27af29(++_0x580fd5);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d98bc,_0x12b08b){_0x5d98bc=_0x5d98bc-0x0;var _0x42ce52=_0x2ef3[_0x5d98bc];return _0x42ce52;};'use strict';var _=require(_0x32ef('0x0'));var attributes=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));module[_0x32ef('0x4')]=function(_0x38047b){var _0x48106c=_0x38047b[_0x32ef('0x5')];function _0x38b7f3(_0x524ab6,_0x402857){return new Promise(function(_0x37dd1d,_0x4c8104){if(!_0x402857)return _0x37dd1d(null);var _0x5dfa09=_0x402857[_0x32ef('0x6')]?{[_0x402857[_0x32ef('0x6')][_0x32ef('0x7')]]:_0x402857[_0x32ef('0x6')][_0x32ef('0x8')]}:undefined;return _0x48106c[_0x524ab6][_0x32ef('0x9')]({'where':_0x5dfa09,'raw':!![]})[_0x32ef('0xa')](function(_0x2bbb50){_0x402857[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0x2bbb50,'id');_0x37dd1d(_0x402857);})['catch'](function(_0x5780e9){_0x4c8104(_0x5780e9);});});}function _0x401d0b(_0x33281d,_0x45bfd5){return new Promise(function(_0x1499c2,_0x5af651){var _0x193714=_0x33281d['filter']?{[_0x33281d[_0x32ef('0x6')]['field']]:_0x33281d[_0x32ef('0x6')][_0x32ef('0x8')]}:undefined;return _0x48106c[_0x33281d['model']]['findAll']({'where':_0x193714,'raw':!![]})[_0x32ef('0xa')](function(_0x4d8009){_0x45bfd5[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0x4d8009,function(_0x93d492){return _0x93d492[_0x32ef('0xd')];});_0x1499c2(_0x45bfd5);})['catch'](function(_0x55bf0b){_0x5af651(_0x55bf0b);});});}function _0x531e30(_0x13db1a,_0x3950e6,_0xb5aed2){if(!_0x3950e6)return Promise['resolve'](null);return new Promise(function(_0x5d559b,_0x1eb468){return _0x48106c[_0x32ef('0xe')][_0x32ef('0x9')]({'where':{'sectionId':_0x3950e6['id']},'raw':!![]})['then'](function(_0xbe37f6){if(_0x13db1a[_0x32ef('0x7')]&&_0x13db1a['field']!=='id'){_0x3950e6[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0xbe37f6,function(_0x26aff3){return _0x26aff3[_0x13db1a[_0x32ef('0x7')]];});}else{if(_0xb5aed2===_0x32ef('0xf')){_0x3950e6[_0x32ef('0xb')]=_['map'](_0xbe37f6,function(_0x3c5b78){return{'id':_0x3c5b78['resourceId'],'type':_0x3c5b78[_0x32ef('0x10')]};});}else{_0x3950e6[_0x32ef('0xb')]=_['map'](_0xbe37f6,function(_0x1af371){return _0x1af371[_0x32ef('0x11')];});}}_0x5d559b(_0x3950e6);})[_0x32ef('0x12')](function(_0x55f7f2){_0x1eb468(_0x55f7f2);});});}function _0x57f5e5(_0x22f2d7,_0xb30fab){var _0x225feb={'parentSections':[]};switch(_0x22f2d7['toLowerCase']()){case'squareprojects':_0x225feb[_0x32ef('0x13')]='SquareProject';break;case'odbc':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x14');break;case _0x32ef('0x15'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x16');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x18'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x19')}];break;case _0x32ef('0x1a'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x1b');break;case'contacts':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x1c');_0x225feb['parentSections']=[{'name':_0x32ef('0x1d'),'field':'id','foreignKey':_0x32ef('0x1e')}];break;case _0x32ef('0x1f'):_0x225feb[_0x32ef('0x13')]='CmList';break;case _0x32ef('0x20'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x21');break;case _0x32ef('0x22'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x23');break;case _0x32ef('0x24'):_0x225feb['childModel']=_0x32ef('0x25');break;case'chatwebsites':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x26');break;case'faxqueues':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x27');break;case _0x32ef('0x28'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x29');break;case'inboundroutes':case'internalroutes':case _0x32ef('0x2a'):_0x225feb['childModel']=_0x32ef('0x2b');break;case _0x32ef('0x2c'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x2d');break;case _0x32ef('0x2e'):_0x225feb[_0x32ef('0x13')]='VoiceMail';break;case'voicerecordings':_0x225feb['childModel']=_0x32ef('0x2f');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x30'),'field':'name','foreignKey':'membername','model':_0x32ef('0x31'),'filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x33')]}},{'name':'Telephones','field':'name','foreignKey':_0x32ef('0x34'),'model':_0x32ef('0x31'),'filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x35')]}},{'name':_0x32ef('0x36'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x37'),'model':_0x32ef('0x38'),'filter':{'field':_0x32ef('0x10'),'value':['inbound']}},{'name':_0x32ef('0x39'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x37'),'model':'VoiceQueue','filter':{'field':_0x32ef('0x10'),'value':[_0x32ef('0x3a')]}}];break;case _0x32ef('0x3b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x3c');break;case _0x32ef('0x3d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x3e');break;case _0x32ef('0x3f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x40');break;case _0x32ef('0x41'):_0x225feb['childModel']=_0x32ef('0x42');break;case _0x32ef('0x43'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x44');break;case _0x32ef('0x45'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x46');break;case'mailsubstatuses':_0x225feb['childModel']=_0x32ef('0x47');break;case _0x32ef('0x48'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x49');break;case'openchannelaccounts':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4a');break;case'smsqueues':_0x225feb[_0x32ef('0x13')]='SmsQueue';break;case _0x32ef('0x4b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4c');break;case _0x32ef('0x4d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4e');break;case _0x32ef('0x4f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x50');break;case _0x32ef('0x51'):_0x225feb['childModel']=_0x32ef('0x52');break;case'voicequeues':case _0x32ef('0x53'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x38');if(_0xb30fab){_0x225feb['parentSections']=[{'name':_0x32ef('0x36')},{'name':_0x32ef('0x39')}];}break;case _0x32ef('0x54'):case _0x32ef('0x55'):case _0x32ef('0x56'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x31');if(_0xb30fab){_0x225feb['parentSections']=[{'name':'Users','filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x57'),_0x32ef('0x58')]},'ignore':!![]},{'name':_0x32ef('0x30')},{'name':_0x32ef('0x59')}];}break;case _0x32ef('0x5a'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x5b');break;case _0x32ef('0x5c'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x5d');break;case _0x32ef('0x5e'):_0x225feb[_0x32ef('0x13')]='FreshdeskAccount';break;case _0x32ef('0x5f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x60');break;case _0x32ef('0x61'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x62');break;case _0x32ef('0x63'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x64');break;case _0x32ef('0x65'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x31');break;case _0x32ef('0x66'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x67');break;case _0x32ef('0x68'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x69');break;case'customdashboards':_0x225feb['childModel']=_0x32ef('0x6a');break;case _0x32ef('0x6b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x6c');break;case _0x32ef('0x6d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x6e');break;case _0x32ef('0x6f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x70');break;case _0x32ef('0x71'):_0x225feb['childModel']=_0x32ef('0x72');break;case _0x32ef('0x73'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x74');break;case _0x32ef('0x75'):_0x225feb[_0x32ef('0x13')]='Template';break;case _0x32ef('0x76'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x77');break;case'trunks':_0x225feb[_0x32ef('0x13')]='Trunk';break;case _0x32ef('0x78'):_0x225feb[_0x32ef('0x13')]='Variable';break;case _0x32ef('0x79'):_0x225feb['childModel']=_0x32ef('0x7a');break;case _0x32ef('0x7b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0xf');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x7c'),'field':'id','foreignKey':_0x32ef('0x7d')}];break;case'metrics':_0x225feb['childModel']=_0x32ef('0x7e');break;}return _0x225feb;}function _0x52232a(_0x4fbab6,_0xb519e9){var _0x89d0b3=_0x4fbab6[_0x32ef('0x7f')](0x0)[_0x32ef('0x80')]()+_0x4fbab6[_0x32ef('0x81')](0x1);var _0x356704={'type':_0x48106c[_0x32ef('0x82')][_0x32ef('0x83')][_0x32ef('0x84')],'raw':!![]};return new Promise(function(_0x123571,_0x4c125c){var _0x518ee1=squel[_0x32ef('0x85')]()[_0x32ef('0x7')]('ui.'+_0x89d0b3+_0x32ef('0x86'),'id')[_0x32ef('0x7')](_0x32ef('0x87'))['from'](_0x32ef('0x88')+_0x4fbab6+_0x32ef('0x89'),'ui')[_0x32ef('0x8a')]('ui.UserId\x20=\x20?',_0xb519e9['id']);return _0x48106c['sequelize'][_0x32ef('0x8b')](_0x518ee1['toString'](),_0x356704)[_0x32ef('0xa')](function(_0x5bb114){_0xb519e9[_0x89d0b3+'OpenTabs']=_0x5bb114;_0x123571(_0x5bb114);})[_0x32ef('0x12')](function(_0x208989){_0x4c125c(_0x208989);});});}return _0x38047b[_0x32ef('0x8c')]('UserProfile',attributes,{'tableName':_0x32ef('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x222b24){var _0x5f9da7={'raw':![],'where':{}};var _0x58ecbb={};var _0x4557ce={'count':0x0,'rows':[]};var _0x12b7f8=_0x222b24['query']['section'];var _0x2e20dc=_0x222b24[_0x32ef('0x8b')][_0x32ef('0x8e')]||![];var _0x339625=_0x57f5e5(_0x12b7f8,_0x2e20dc);if(!_0x339625[_0x32ef('0x13')])throw new Error(_0x32ef('0x8f')+_0x12b7f8+'\x27');var _0x4c89e8=[{'name':_0x12b7f8}];if(!_[_0x32ef('0x90')](_0x339625[_0x32ef('0x17')]))_0x4c89e8=_0x339625[_0x32ef('0x17')];var _0x36ed97=[];for(var _0x21e930=0x0;_0x21e930<_0x4c89e8[_0x32ef('0x91')];_0x21e930++){_0x36ed97[_0x32ef('0x92')](_0x48106c[_0x32ef('0x93')][_0x32ef('0x94')]({'where':{'userProfileId':_0x222b24['params']['id'],'name':_0x4c89e8[_0x21e930][_0x32ef('0xd')]},'raw':!![]}));}return Promise[_0x32ef('0x95')](_0x36ed97)[_0x32ef('0xa')](function(_0x1c629d){var _0x79ae28=_['filter'](_0x1c629d,function(_0x47c0ed){return _0x47c0ed?_0x47c0ed:undefined;});var _0x2125de=_[_0x32ef('0x6')](_0x4c89e8,[_0x32ef('0x96'),!![]]);var _0x334ca6=_[_0x32ef('0x90')](_0x79ae28)&&_['isEmpty'](_0x2125de)?null:_[_0x32ef('0x97')](_0x2125de,_0x79ae28);if(!_0x334ca6)return null;var _0x544045=[];for(var _0x216e2f=0x0;_0x216e2f<_0x334ca6[_0x32ef('0x91')];_0x216e2f++){var _0x48b6f4=_['find'](_0x4c89e8,function(_0x2c9f7a){return _0x334ca6[_0x216e2f]?_0x2c9f7a[_0x32ef('0xd')]===_0x334ca6[_0x216e2f][_0x32ef('0xd')]:null;});if(_0x48b6f4){if(_0x334ca6[_0x216e2f]['ignore']){_0x544045['push'](_0x38b7f3(_0x339625[_0x32ef('0x13')],_0x334ca6[_0x216e2f]));}else{if(!_0x334ca6[_0x216e2f][_0x32ef('0x98')]){_0x544045[_0x32ef('0x92')](_0x531e30(_0x48b6f4,_0x334ca6[_0x216e2f],_0x339625[_0x32ef('0x13')]));}else{if(_0x48b6f4['model']){_0x544045[_0x32ef('0x92')](_0x401d0b(_0x48b6f4,_0x334ca6[_0x216e2f]));}}}}}return Promise[_0x32ef('0x95')](_0x544045);})[_0x32ef('0xa')](function(_0xd7a78){var _0x9df27c=_0xd7a78;var _0x268dcd=null;if(_0x9df27c){_0x268dcd=_0x9df27c[_0x32ef('0x91')]===0x1?_0x9df27c[0x0]:null;}if(!_0x268dcd&&!_0x9df27c)return _0x4557ce;var _0x44e23e=_0x48106c[_0x339625[_0x32ef('0x13')]][_0x32ef('0x99')];_0x58ecbb[_0x32ef('0x9a')]=_[_0x32ef('0x9b')](_0x44e23e);_0x58ecbb['query']=_['keys'](_0x222b24[_0x32ef('0x8b')]);_0x58ecbb[_0x32ef('0x9c')]=_['intersection'](_0x58ecbb[_0x32ef('0x9a')],_0x58ecbb['query']);_0x5f9da7[_0x32ef('0x9d')]=_[_0x32ef('0x9e')](_0x58ecbb[_0x32ef('0x9a')],qs['fields'](_0x222b24[_0x32ef('0x8b')]['fields']));_0x5f9da7[_0x32ef('0x9d')]=_0x5f9da7[_0x32ef('0x9d')]['length']?_0x5f9da7['attributes']:_0x58ecbb[_0x32ef('0x9a')];if(!_0x222b24['query'][_0x32ef('0x9f')]('nolimit')){_0x5f9da7[_0x32ef('0xa0')]=qs[_0x32ef('0xa0')](_0x222b24[_0x32ef('0x8b')]['limit']);_0x5f9da7['offset']=qs['offset'](_0x222b24[_0x32ef('0x8b')]['offset']);}_0x5f9da7[_0x32ef('0xa1')]=qs[_0x32ef('0xa2')](_0x222b24[_0x32ef('0x8b')][_0x32ef('0xa2')]);_0x5f9da7[_0x32ef('0x8a')]=qs[_0x32ef('0x9c')](_['pick'](_0x222b24[_0x32ef('0x8b')],_0x58ecbb['filters']));if(_0x222b24['query'][_0x32ef('0x6')]){_0x5f9da7['where']=_[_0x32ef('0xa3')](_0x5f9da7[_0x32ef('0x8a')],{'$or':_['map'](_0x44e23e,function(_0x232b40){if(_0x232b40[_0x32ef('0x10')][_0x32ef('0xa4')]!==_0x32ef('0xa5')){var _0x1fa36d={};_0x1fa36d[_0x232b40[_0x32ef('0x7')]]={'$like':'%'+_0x222b24['query']['filter']+'%'};return _0x1fa36d;}})});}var _0x35b10d=[];var _0x5e0b55=null;var _0x41bbe1={};if(_0x268dcd){_0x5e0b55=_[_0x32ef('0x94')](_0x4c89e8,[_0x32ef('0xd'),_0x268dcd[_0x32ef('0xd')]]);if(_0x5e0b55[_0x32ef('0x7')]){_0x41bbe1={};if(_0x339625[_0x32ef('0x13')]==='AnalyticExtractedReport'){_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_[_0x32ef('0xc')](_0x268dcd[_0x32ef('0xb')],'id');}else{_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_0x268dcd[_0x32ef('0xb')];}_0x35b10d['push'](_0x41bbe1);}else{_0x5f9da7['where']['id']=_0x268dcd[_0x32ef('0xb')];}}else{for(var _0x904a4f=0x0;_0x904a4f<_0x9df27c['length'];_0x904a4f++){_0x5e0b55=_[_0x32ef('0x94')](_0x4c89e8,[_0x32ef('0xd'),_0x9df27c[_0x904a4f][_0x32ef('0xd')]]);if(_0x5e0b55[_0x32ef('0x7')]){_0x41bbe1={};_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_0x9df27c[_0x904a4f][_0x32ef('0xb')];_0x35b10d[_0x32ef('0x92')](_0x41bbe1);}else{if(!_0x5f9da7[_0x32ef('0x8a')]['id'])_0x5f9da7[_0x32ef('0x8a')]['id']=[];_0x9df27c[_0x904a4f]['associatedResources'][_0x32ef('0xa7')](function(_0xefbbf2){_0x5f9da7['where']['id'][_0x32ef('0x92')](_0xefbbf2);});}}}if(!_['isEmpty'](_0x35b10d)){_0x5f9da7[_0x32ef('0x8a')]=_['merge'](_0x5f9da7[_0x32ef('0x8a')],{'$and':{'$or':_0x35b10d}});}_0x5f9da7=_[_0x32ef('0xa3')]({},_0x5f9da7,_0x222b24[_0x32ef('0xa8')]);if(_0x268dcd&&!_0x268dcd[_0x32ef('0x98')]&&_0x339625['childModel']===_0x32ef('0xf')){if(_0x222b24[_0x32ef('0x8b')][_0x32ef('0xa9')]){_0x5f9da7['include']=[{'all':!![]}];}return _0x48106c[_0x339625['childModel']]['findAll'](_0x5f9da7)[_0x32ef('0xa')](function(_0x12f5ef){var _0x1ec12d=[];_0x12f5ef[_0x32ef('0xa7')](function(_0x3cc90c){var _0x5a1696;switch(_0x3cc90c[_0x32ef('0xaa')]){case'default':_0x5a1696=_[_0x32ef('0x94')](_0x268dcd[_0x32ef('0xb')],function(_0xc43e1){return _0xc43e1['id']===_0x3cc90c['reportId']&&_0xc43e1[_0x32ef('0x10')]===_0x32ef('0xab');});break;case _0x32ef('0xac'):_0x5a1696=_[_0x32ef('0x94')](_0x268dcd[_0x32ef('0xb')],function(_0x4d4b5f){return _0x4d4b5f['id']===_0x3cc90c[_0x32ef('0x7d')]&&_0x4d4b5f['type']===_0x32ef('0xad');});break;}if(_0x5a1696)_0x1ec12d[_0x32ef('0x92')](_0x3cc90c);});_0x4557ce['count']=_0x1ec12d['length'];_0x4557ce[_0x32ef('0xae')]=_0x1ec12d;return _0x4557ce;});}else{return _0x48106c[_0x339625[_0x32ef('0x13')]][_0x32ef('0xaf')]({'where':_0x5f9da7[_0x32ef('0x8a')]})['then'](function(_0x356fd4){_0x4557ce['count']=_0x356fd4;if(_0x222b24['query'][_0x32ef('0xa9')]){if(_0x339625['childModel']===_0x32ef('0x1c')){_0x5f9da7[_0x32ef('0xb0')]=[{'model':_0x48106c[_0x32ef('0x74')],'as':'Tags','attributes':['id','name',_0x32ef('0xb1')],'required':_0x222b24[_0x32ef('0x8b')][_0x32ef('0xb2')]?!![]:![]},{'model':_0x48106c[_0x32ef('0x74')],'as':_0x32ef('0xb3'),'attributes':['id',_0x32ef('0xd'),_0x32ef('0xb1')],'through':_0x222b24['query'][_0x32ef('0xb2')]?{'attributes':[],'where':{'TagId':_0x222b24[_0x32ef('0x8b')][_0x32ef('0xb2')]||undefined}}:{},'required':_0x222b24[_0x32ef('0x8b')]['tag']?!![]:![]}];}else{_0x5f9da7['include']=[{'all':!![]}];}}return _0x48106c[_0x339625[_0x32ef('0x13')]]['findAll'](_0x5f9da7);})[_0x32ef('0xa')](function(_0x1d3a37){_0x4557ce['rows']=_0x1d3a37;if(_0x12b7f8==='Agents'&&_0x222b24['query'][_0x32ef('0xb4')]===_0x32ef('0xb5')){var _0xa53375=[];for(var _0x275995=0x0;_0x275995<_0x4557ce['rows'][_0x32ef('0x91')];_0x275995++){_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xb6'),_0x4557ce['rows'][_0x275995][_0x32ef('0xb7')]));_0xa53375['push'](_0x52232a(_0x32ef('0xb8'),_0x4557ce[_0x32ef('0xae')][_0x275995]['dataValues']));_0xa53375['push'](_0x52232a(_0x32ef('0xb9'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xba'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xbb'),_0x4557ce['rows'][_0x275995][_0x32ef('0xb7')]));_0xa53375['push'](_0x52232a(_0x32ef('0xbc'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));}return Promise[_0x32ef('0x95')](_0xa53375)[_0x32ef('0xa')](function(){return _0x4557ce;});}return _0x4557ce;});}});}}});}; \ No newline at end of file +var _0xf494=['SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','pick','filters','key','foreignKey','merge','options','includeAll','forEach','reportType','default','reportId','DefaultReports','custom','CustomReports','count','include','Tag','Tags','color','tag','ThroughTags','rows','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','catch','model','name','UserProfileResource','field','AnalyticExtractedReport','resourceId','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','sounds','Sound','tags','templates','triggers','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes'];(function(_0x31e59e,_0x3fe544){var _0x36f2e4=function(_0x9c5671){while(--_0x9c5671){_0x31e59e['push'](_0x31e59e['shift']());}};_0x36f2e4(++_0x3fe544);}(_0xf494,0x1c6));var _0x4f49=function(_0x2ff9b4,_0x410dcb){_0x2ff9b4=_0x2ff9b4-0x0;var _0x2ce341=_0xf494[_0x2ff9b4];return _0x2ce341;};'use strict';var _=require(_0x4f49('0x0'));var attributes=require(_0x4f49('0x1'));var qs=require(_0x4f49('0x2'));var squel=require('squel');module[_0x4f49('0x3')]=function(_0x1d54cc){var _0x423b25=_0x1d54cc[_0x4f49('0x4')];function _0x20c0d7(_0x2a15fb,_0x3267c1){return new Promise(function(_0x790e8b,_0xc5e778){if(!_0x3267c1)return _0x790e8b(null);var _0x413530=_0x3267c1[_0x4f49('0x5')]?{[_0x3267c1['filter']['field']]:_0x3267c1[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x2a15fb][_0x4f49('0x7')]({'where':_0x413530,'raw':!![]})[_0x4f49('0x8')](function(_0x185174){_0x3267c1[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x185174,'id');_0x790e8b(_0x3267c1);})[_0x4f49('0xb')](function(_0x53ee74){_0xc5e778(_0x53ee74);});});}function _0x3e464f(_0x411759,_0x5bcfe5){return new Promise(function(_0x15e7a1,_0x5bbc75){var _0x496293=_0x411759[_0x4f49('0x5')]?{[_0x411759[_0x4f49('0x5')]['field']]:_0x411759[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x411759[_0x4f49('0xc')]][_0x4f49('0x7')]({'where':_0x496293,'raw':!![]})[_0x4f49('0x8')](function(_0x2f0131){_0x5bcfe5[_0x4f49('0x9')]=_['map'](_0x2f0131,function(_0x515ace){return _0x515ace[_0x4f49('0xd')];});_0x15e7a1(_0x5bcfe5);})[_0x4f49('0xb')](function(_0x5878f4){_0x5bbc75(_0x5878f4);});});}function _0x5bdfaf(_0x2f0a0d,_0x2ecaaa,_0x74886e){if(!_0x2ecaaa)return Promise['resolve'](null);return new Promise(function(_0x1dccfd,_0x399be7){return _0x423b25[_0x4f49('0xe')]['findAll']({'where':{'sectionId':_0x2ecaaa['id']},'raw':!![]})['then'](function(_0x560592){if(_0x2f0a0d['field']&&_0x2f0a0d[_0x4f49('0xf')]!=='id'){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x407042){return _0x407042[_0x2f0a0d['field']];});}else{if(_0x74886e===_0x4f49('0x10')){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0xaab5e7){return{'id':_0xaab5e7[_0x4f49('0x11')],'type':_0xaab5e7['type']};});}else{_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x3ae590){return _0x3ae590['resourceId'];});}}_0x1dccfd(_0x2ecaaa);})[_0x4f49('0xb')](function(_0x1d70a7){_0x399be7(_0x1d70a7);});});}function _0x32ca7b(_0x43c458,_0x9d30aa){var _0x36187b={'parentSections':[]};switch(_0x43c458['toLowerCase']()){case'squareprojects':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x13');break;case'odbc':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x14');break;case _0x4f49('0x15'):_0x36187b['childModel']=_0x4f49('0x16');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x18'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x19')}];break;case _0x4f49('0x1a'):_0x36187b['childModel']='JscriptyProject';break;case _0x4f49('0x1b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x1c');_0x36187b['parentSections']=[{'name':_0x4f49('0x1d'),'field':'id','foreignKey':_0x4f49('0x1e')}];break;case _0x4f49('0x1f'):_0x36187b['childModel']='CmList';break;case _0x4f49('0x20'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x21');break;case'globalcustomfields':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x22');break;case _0x4f49('0x23'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x24');break;case _0x4f49('0x25'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x26');break;case _0x4f49('0x27'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x28');break;case _0x4f49('0x29'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2a');break;case _0x4f49('0x2b'):case _0x4f49('0x2c'):case _0x4f49('0x2d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2e');break;case'contexts':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2f');break;case _0x4f49('0x30'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x31');break;case _0x4f49('0x32'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x33');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x34'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':'role','value':[_0x4f49('0x37')]}},{'name':_0x4f49('0x38'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':_0x4f49('0x39'),'value':[_0x4f49('0x3a')]}},{'name':_0x4f49('0x3b'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':_0x4f49('0x3e'),'value':[_0x4f49('0x3f')]}},{'name':_0x4f49('0x40'),'field':'name','foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':'type','value':[_0x4f49('0x41')]}}];break;case _0x4f49('0x42'):_0x36187b['childModel']=_0x4f49('0x43');break;case _0x4f49('0x44'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x45');break;case _0x4f49('0x46'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x47');break;case'ivrcampaigns':_0x36187b['childModel']='Campaign';break;case _0x4f49('0x48'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x49');break;case _0x4f49('0x4a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4b');break;case _0x4f49('0x4c'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4d');break;case'openchannelqueues':_0x36187b['childModel']=_0x4f49('0x4e');break;case _0x4f49('0x4f'):_0x36187b[_0x4f49('0x12')]='OpenchannelAccount';break;case _0x4f49('0x50'):_0x36187b['childModel']='SmsQueue';break;case _0x4f49('0x51'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x52');break;case'whatsappqueues':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x53');break;case'whatsappaccounts':_0x36187b[_0x4f49('0x12')]='WhatsappAccount';break;case _0x4f49('0x54'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x55');break;case'voicequeues':case _0x4f49('0x56'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x3d');if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x3b')},{'name':_0x4f49('0x40')}];}break;case _0x4f49('0x57'):case _0x4f49('0x58'):case _0x4f49('0x59'):_0x36187b[_0x4f49('0x12')]='User';if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x5a'),'filter':{'field':'role','value':[_0x4f49('0x5b'),'user']},'ignore':!![]},{'name':_0x4f49('0x34')},{'name':_0x4f49('0x38')}];}break;case _0x4f49('0x5c'):_0x36187b[_0x4f49('0x12')]='ZendeskAccount';break;case _0x4f49('0x5d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x5e');break;case _0x4f49('0x5f'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x60');break;case _0x4f49('0x61'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x62');break;case _0x4f49('0x63'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x64');break;case _0x4f49('0x65'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x66');break;case _0x4f49('0x67'):_0x36187b['childModel']='User';break;case _0x4f49('0x68'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x69');break;case _0x4f49('0x6a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6b');break;case _0x4f49('0x6c'):_0x36187b['childModel']=_0x4f49('0x6d');break;case'intervals':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6e');break;case _0x4f49('0x6f'):_0x36187b[_0x4f49('0x12')]='Pause';break;case _0x4f49('0x70'):_0x36187b['childModel']='Schedule';break;case _0x4f49('0x71'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x72');break;case _0x4f49('0x73'):_0x36187b['childModel']='Tag';break;case _0x4f49('0x74'):_0x36187b[_0x4f49('0x12')]='Template';break;case _0x4f49('0x75'):_0x36187b['childModel']='Trigger';break;case _0x4f49('0x76'):_0x36187b['childModel']=_0x4f49('0x77');break;case'variables':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x78');break;case _0x4f49('0x79'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7a');break;case _0x4f49('0x7b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x10');_0x36187b['parentSections']=[{'name':_0x4f49('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x4f49('0x7d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7e');break;}return _0x36187b;}function _0x467f12(_0x1981e0,_0xb7538c){var _0x553981=_0x1981e0[_0x4f49('0x7f')](0x0)[_0x4f49('0x80')]()+_0x1981e0['slice'](0x1);var _0x5d2b3c={'type':_0x423b25[_0x4f49('0x81')][_0x4f49('0x82')][_0x4f49('0x83')],'raw':!![]};return new Promise(function(_0x2409f1,_0x19a788){var _0x4af08d=squel[_0x4f49('0x84')]()['field'](_0x4f49('0x85')+_0x553981+_0x4f49('0x86'),'id')[_0x4f49('0xf')]('ui.createdAt')[_0x4f49('0x87')](_0x4f49('0x88')+_0x1981e0+_0x4f49('0x89'),'ui')[_0x4f49('0x8a')]('ui.UserId\x20=\x20?',_0xb7538c['id']);return _0x423b25[_0x4f49('0x8b')][_0x4f49('0x8c')](_0x4af08d['toString'](),_0x5d2b3c)[_0x4f49('0x8')](function(_0x17b15){_0xb7538c[_0x553981+_0x4f49('0x8d')]=_0x17b15;_0x2409f1(_0x17b15);})[_0x4f49('0xb')](function(_0x28ea73){_0x19a788(_0x28ea73);});});}return _0x1d54cc[_0x4f49('0x8e')](_0x4f49('0x8f'),attributes,{'tableName':_0x4f49('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x519721){var _0x468821={'raw':![],'where':{}};var _0x3566f2={};var _0x1e91a5={'count':0x0,'rows':[]};var _0x192b5a=_0x519721[_0x4f49('0x8c')][_0x4f49('0x91')];var _0x335875=_0x519721['query'][_0x4f49('0x92')]||![];var _0x50d1ad=_0x32ca7b(_0x192b5a,_0x335875);if(!_0x50d1ad[_0x4f49('0x12')])throw new Error(_0x4f49('0x93')+_0x192b5a+'\x27');var _0x4714c7=[{'name':_0x192b5a}];if(!_[_0x4f49('0x94')](_0x50d1ad[_0x4f49('0x17')]))_0x4714c7=_0x50d1ad[_0x4f49('0x17')];var _0x61a565=[];for(var _0x297698=0x0;_0x297698<_0x4714c7[_0x4f49('0x95')];_0x297698++){_0x61a565[_0x4f49('0x96')](_0x423b25['UserProfileSection'][_0x4f49('0x97')]({'where':{'userProfileId':_0x519721[_0x4f49('0x98')]['id'],'name':_0x4714c7[_0x297698][_0x4f49('0xd')]},'raw':!![]}));}return Promise[_0x4f49('0x99')](_0x61a565)['then'](function(_0x54c67b){var _0x28e8ae=_['filter'](_0x54c67b,function(_0x30defd){return _0x30defd?_0x30defd:undefined;});var _0x287705=_[_0x4f49('0x5')](_0x4714c7,[_0x4f49('0x9a'),!![]]);var _0x224c8d=_[_0x4f49('0x94')](_0x28e8ae)&&_[_0x4f49('0x94')](_0x287705)?null:_[_0x4f49('0x9b')](_0x287705,_0x28e8ae);if(!_0x224c8d)return null;var _0x3823f0=[];for(var _0x3e9b47=0x0;_0x3e9b47<_0x224c8d[_0x4f49('0x95')];_0x3e9b47++){var _0x1ba97e=_[_0x4f49('0x97')](_0x4714c7,function(_0xd53de8){return _0x224c8d[_0x3e9b47]?_0xd53de8[_0x4f49('0xd')]===_0x224c8d[_0x3e9b47][_0x4f49('0xd')]:null;});if(_0x1ba97e){if(_0x224c8d[_0x3e9b47][_0x4f49('0x9a')]){_0x3823f0[_0x4f49('0x96')](_0x20c0d7(_0x50d1ad[_0x4f49('0x12')],_0x224c8d[_0x3e9b47]));}else{if(!_0x224c8d[_0x3e9b47][_0x4f49('0x9c')]){_0x3823f0[_0x4f49('0x96')](_0x5bdfaf(_0x1ba97e,_0x224c8d[_0x3e9b47],_0x50d1ad[_0x4f49('0x12')]));}else{if(_0x1ba97e[_0x4f49('0xc')]){_0x3823f0[_0x4f49('0x96')](_0x3e464f(_0x1ba97e,_0x224c8d[_0x3e9b47]));}}}}}return Promise[_0x4f49('0x99')](_0x3823f0);})['then'](function(_0x3e9460){var _0x4ff0c1=_0x3e9460;var _0x31df7f=null;if(_0x4ff0c1){_0x31df7f=_0x4ff0c1[_0x4f49('0x95')]===0x1?_0x4ff0c1[0x0]:null;}if(!_0x31df7f&&!_0x4ff0c1)return _0x1e91a5;var _0x38fe50=_0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x9d')];_0x3566f2[_0x4f49('0xc')]=_[_0x4f49('0x9e')](_0x38fe50);_0x3566f2[_0x4f49('0x8c')]=_[_0x4f49('0x9e')](_0x519721['query']);_0x3566f2['filters']=_[_0x4f49('0x9f')](_0x3566f2['model'],_0x3566f2[_0x4f49('0x8c')]);_0x468821[_0x4f49('0xa0')]=_[_0x4f49('0x9f')](_0x3566f2[_0x4f49('0xc')],qs[_0x4f49('0xa1')](_0x519721['query']['fields']));_0x468821[_0x4f49('0xa0')]=_0x468821[_0x4f49('0xa0')]['length']?_0x468821[_0x4f49('0xa0')]:_0x3566f2[_0x4f49('0xc')];if(!_0x519721['query'][_0x4f49('0xa2')]('nolimit')){_0x468821[_0x4f49('0xa3')]=qs[_0x4f49('0xa3')](_0x519721['query'][_0x4f49('0xa3')]);_0x468821[_0x4f49('0xa4')]=qs[_0x4f49('0xa4')](_0x519721[_0x4f49('0x8c')][_0x4f49('0xa4')]);}_0x468821[_0x4f49('0xa5')]=qs['sort'](_0x519721[_0x4f49('0x8c')]['sort']);_0x468821[_0x4f49('0x8a')]=qs['filters'](_[_0x4f49('0xa6')](_0x519721['query'],_0x3566f2[_0x4f49('0xa7')]));if(_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]){_0x468821[_0x4f49('0x8a')]=_['merge'](_0x468821[_0x4f49('0x8a')],{'$or':_['map'](_0x38fe50,function(_0x5ddfe4){if(_0x5ddfe4['type'][_0x4f49('0xa8')]!=='VIRTUAL'){var _0x4938a6={};_0x4938a6[_0x5ddfe4[_0x4f49('0xf')]]={'$like':'%'+_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]+'%'};return _0x4938a6;}})});}var _0x4c0e7a=[];var _0x289810=null;var _0x431c15={};if(_0x31df7f){_0x289810=_['find'](_0x4714c7,['name',_0x31df7f['name']]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){_0x431c15[_0x289810[_0x4f49('0xa9')]]=_[_0x4f49('0xa')](_0x31df7f['associatedResources'],'id');}else{_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x31df7f[_0x4f49('0x9')];}_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{_0x468821['where']['id']=_0x31df7f[_0x4f49('0x9')];}}else{for(var _0x34843a=0x0;_0x34843a<_0x4ff0c1[_0x4f49('0x95')];_0x34843a++){_0x289810=_[_0x4f49('0x97')](_0x4714c7,['name',_0x4ff0c1[_0x34843a][_0x4f49('0xd')]]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x4ff0c1[_0x34843a][_0x4f49('0x9')];_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{if(!_0x468821['where']['id'])_0x468821[_0x4f49('0x8a')]['id']=[];_0x4ff0c1[_0x34843a][_0x4f49('0x9')]['forEach'](function(_0x3eebc0){_0x468821['where']['id'][_0x4f49('0x96')](_0x3eebc0);});}}}if(!_['isEmpty'](_0x4c0e7a)){_0x468821[_0x4f49('0x8a')]=_[_0x4f49('0xaa')](_0x468821[_0x4f49('0x8a')],{'$and':{'$or':_0x4c0e7a}});}_0x468821=_[_0x4f49('0xaa')]({},_0x468821,_0x519721[_0x4f49('0xab')]);if(_0x31df7f&&!_0x31df7f['autoAssociation']&&_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){if(_0x519721[_0x4f49('0x8c')][_0x4f49('0xac')]){_0x468821['include']=[{'all':!![]}];}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['findAll'](_0x468821)[_0x4f49('0x8')](function(_0x59a5e9){var _0x3066ee=[];_0x59a5e9[_0x4f49('0xad')](function(_0x288f75){var _0x34fca3;switch(_0x288f75[_0x4f49('0xae')]){case _0x4f49('0xaf'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x3a26ff){return _0x3a26ff['id']===_0x288f75[_0x4f49('0xb0')]&&_0x3a26ff['type']===_0x4f49('0xb1');});break;case _0x4f49('0xb2'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x302861){return _0x302861['id']===_0x288f75[_0x4f49('0xb0')]&&_0x302861['type']===_0x4f49('0xb3');});break;}if(_0x34fca3)_0x3066ee[_0x4f49('0x96')](_0x288f75);});_0x1e91a5[_0x4f49('0xb4')]=_0x3066ee[_0x4f49('0x95')];_0x1e91a5['rows']=_0x3066ee;return _0x1e91a5;});}else{return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['count']({'where':_0x468821[_0x4f49('0x8a')]})[_0x4f49('0x8')](function(_0x5c5d2){_0x1e91a5[_0x4f49('0xb4')]=_0x5c5d2;if(_0x519721['query'][_0x4f49('0xac')]){if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x1c')){_0x468821[_0x4f49('0xb5')]=[{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xb7'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'required':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?!![]:![]},{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xba'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'through':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?{'attributes':[],'where':{'TagId':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]||undefined}}:{},'required':_0x519721['query'][_0x4f49('0xb9')]?!![]:![]}];}else{_0x468821[_0x4f49('0xb5')]=[{'all':!![]}];}}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x7')](_0x468821);})['then'](function(_0x225e63){_0x1e91a5[_0x4f49('0xbb')]=_0x225e63;if(_0x192b5a==='Agents'&&_0x519721[_0x4f49('0x8c')]['openTabs']===_0x4f49('0xbc')){var _0x3bc245=[];for(var _0x1b6e82=0x0;_0x1b6e82<_0x1e91a5[_0x4f49('0xbb')][_0x4f49('0x95')];_0x1b6e82++){_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xbd'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12('sms',_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xbf'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82]['dataValues']));_0x3bc245['push'](_0x467f12(_0x4f49('0xc0'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xc1'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xc2'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));}return Promise['all'](_0x3bc245)[_0x4f49('0x8')](function(){return _0x1e91a5;});}return _0x1e91a5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 682d82e..b746a68 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 _0x7096=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','then','info'];(function(_0x29d7ac,_0x2e964a){var _0x541775=function(_0x1ad170){while(--_0x1ad170){_0x29d7ac['push'](_0x29d7ac['shift']());}};_0x541775(++_0x2e964a);}(_0x7096,0x10c));var _0x6709=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7096[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});config[_0x6709('0xb')]=_[_0x6709('0xc')](config[_0x6709('0xb')],{'host':_0x6709('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6709('0xe'))[_0x6709('0xf')](socket);function respondWithRpcPromise(_0xbcb47,_0x1aa476,_0x12eea2){return new BPromise(function(_0x426ea1,_0x5de1fa){return client['request'](_0xbcb47,_0x12eea2)[_0x6709('0x10')](function(_0x262261){logger[_0x6709('0x11')](_0x6709('0x12'),_0x1aa476,_0x6709('0x13'));logger[_0x6709('0x14')](_0x6709('0x15'),_0x1aa476,_0x6709('0x13'),JSON['stringify'](_0x262261));if(_0x262261[_0x6709('0x16')]){if(_0x262261[_0x6709('0x16')][_0x6709('0x17')]===0x1f4){logger[_0x6709('0x16')]('UserProfile,\x20%s,\x20%s',_0x1aa476,_0x262261[_0x6709('0x16')]['message']);return _0x5de1fa(_0x262261[_0x6709('0x16')]['message']);}logger[_0x6709('0x16')](_0x6709('0x12'),_0x1aa476,_0x262261[_0x6709('0x16')][_0x6709('0x18')]);return _0x426ea1(_0x262261['error']['message']);}else{logger['info'](_0x6709('0x12'),_0x1aa476,_0x6709('0x13'));_0x426ea1(_0x262261['result'][_0x6709('0x18')]);}})[_0x6709('0x19')](function(_0xf1a70d){logger['error'](_0x6709('0x12'),_0x1aa476,_0xf1a70d);_0x5de1fa(_0xf1a70d);});});} \ No newline at end of file +var _0x13c5=['request\x20sent','result','lodash','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','info','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x484e14,_0xfd0e28){var _0x5e944c=function(_0x8ee477){while(--_0x8ee477){_0x484e14['push'](_0x484e14['shift']());}};_0x5e944c(++_0xfd0e28);}(_0x13c5,0x7a));var _0x513c=function(_0x19f626,_0x33cc28){_0x19f626=_0x19f626-0x0;var _0x3372a3=_0x13c5[_0x19f626];return _0x3372a3;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x513c('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x513c('0x2'));var jayson=require(_0x513c('0x3'));var client=jayson[_0x513c('0x4')][_0x513c('0x5')]({'port':0x232a});config['redis']=_['defaults'](config[_0x513c('0x6')],{'host':_0x513c('0x7'),'port':0x18eb});var socket=require(_0x513c('0x8'))(new Redis(config[_0x513c('0x6')]));require(_0x513c('0x9'))[_0x513c('0xa')](socket);function respondWithRpcPromise(_0x222c25,_0x18471d,_0x4adc04){return new BPromise(function(_0xd70448,_0x224eb2){return client['request'](_0x222c25,_0x4adc04)['then'](function(_0x798eed){logger[_0x513c('0xb')]('UserProfile,\x20%s,\x20%s',_0x18471d,'request\x20sent');logger['debug'](_0x513c('0xc'),_0x18471d,'request\x20sent',JSON[_0x513c('0xd')](_0x798eed));if(_0x798eed[_0x513c('0xe')]){if(_0x798eed['error'][_0x513c('0xf')]===0x1f4){logger[_0x513c('0xe')](_0x513c('0x10'),_0x18471d,_0x798eed[_0x513c('0xe')][_0x513c('0x11')]);return _0x224eb2(_0x798eed['error'][_0x513c('0x11')]);}logger['error'](_0x513c('0x10'),_0x18471d,_0x798eed[_0x513c('0xe')][_0x513c('0x11')]);return _0xd70448(_0x798eed[_0x513c('0xe')]['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x18471d,_0x513c('0x12'));_0xd70448(_0x798eed[_0x513c('0x13')]['message']);}})['catch'](function(_0x217e7a){logger[_0x513c('0xe')](_0x513c('0x10'),_0x18471d,_0x217e7a);_0x224eb2(_0x217e7a);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5a76423..3323f6b 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 _0xd6d8=['length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d8,0x1cd));var _0x8d6d=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xd6d8[_0x16de68];return _0x1c277e;};'use strict';var UserProfileEvents=require(_0x8d6d('0x0'));var events=[_0x8d6d('0x1'),_0x8d6d('0x2'),_0x8d6d('0x3')];function createListener(_0x5b415f,_0xfac734){return function(_0x4ec898){_0xfac734[_0x8d6d('0x4')](_0x5b415f,_0x4ec898);};}function removeListener(_0x53809f,_0x535995){return function(){UserProfileEvents[_0x8d6d('0x5')](_0x53809f,_0x535995);};}exports[_0x8d6d('0x6')]=function(_0xef88ee){for(var _0x4a14c6=0x0,_0x56c79c=events[_0x8d6d('0x7')];_0x4a14c6<_0x56c79c;_0x4a14c6++){var _0x2f43a8=events[_0x4a14c6];var _0x90de65=createListener(_0x8d6d('0x8')+_0x2f43a8,_0xef88ee);UserProfileEvents['on'](_0x2f43a8,_0x90de65);}}; \ No newline at end of file +var _0x74d4=['register','userProfile:','./userProfile.events','save','remove','update','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x74d4,0xf7));var _0x474d=function(_0x40011c,_0x471ecd){_0x40011c=_0x40011c-0x0;var _0x42a3ea=_0x74d4[_0x40011c];return _0x42a3ea;};'use strict';var UserProfileEvents=require(_0x474d('0x0'));var events=[_0x474d('0x1'),_0x474d('0x2'),_0x474d('0x3')];function createListener(_0x4402ae,_0x71edbf){return function(_0x80c706){_0x71edbf['emit'](_0x4402ae,_0x80c706);};}function removeListener(_0x4e6f89,_0x42f9db){return function(){UserProfileEvents[_0x474d('0x4')](_0x4e6f89,_0x42f9db);};}exports[_0x474d('0x5')]=function(_0x142ede){for(var _0x1f5af7=0x0,_0x241ba2=events['length'];_0x1f5af7<_0x241ba2;_0x1f5af7++){var _0x3be97f=events[_0x1f5af7];var _0x2e6d5c=createListener(_0x474d('0x6')+_0x3be97f,_0x142ede);UserProfileEvents['on'](_0x3be97f,_0x2e6d5c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9a0a307..6539657 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 _0xbbdd=['/describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xbbdd,0xa2));var _0xdbbd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbbdd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbbd('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdbbd('0x1')]();var fs_extra=require(_0xdbbd('0x2'));var auth=require(_0xdbbd('0x3'));var interaction=require(_0xdbbd('0x4'));var config=require(_0xdbbd('0x5'));var controller=require(_0xdbbd('0x6'));router[_0xdbbd('0x7')]('/',auth['isAuthenticated'](),controller[_0xdbbd('0x8')]);router[_0xdbbd('0x7')](_0xdbbd('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xdbbd('0x7')](_0xdbbd('0xa'),auth[_0xdbbd('0xb')](),controller[_0xdbbd('0xc')]);router[_0xdbbd('0xd')]('/',auth['isAuthenticated'](),controller[_0xdbbd('0xe')]);router[_0xdbbd('0xf')]('/:id',auth[_0xdbbd('0xb')](),controller['update']);router[_0xdbbd('0x10')](_0xdbbd('0xa'),auth[_0xdbbd('0xb')](),controller[_0xdbbd('0x11')]);module[_0xdbbd('0x12')]=router; \ No newline at end of file +var _0x7285=['isAuthenticated','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x128ed9,_0x1039b0){var _0x237eac=function(_0x225000){while(--_0x225000){_0x128ed9['push'](_0x128ed9['shift']());}};_0x237eac(++_0x1039b0);}(_0x7285,0xff));var _0x5728=function(_0xee3b03,_0x3472e3){_0xee3b03=_0xee3b03-0x0;var _0x44d20d=_0x7285[_0xee3b03];return _0x44d20d;};'use strict';var multer=require(_0x5728('0x0'));var util=require(_0x5728('0x1'));var path=require(_0x5728('0x2'));var timeout=require(_0x5728('0x3'));var express=require(_0x5728('0x4'));var router=express['Router']();var fs_extra=require(_0x5728('0x5'));var auth=require(_0x5728('0x6'));var interaction=require(_0x5728('0x7'));var config=require(_0x5728('0x8'));var controller=require(_0x5728('0x9'));router[_0x5728('0xa')]('/',auth[_0x5728('0xb')](),controller['index']);router['get']('/describe',auth[_0x5728('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5728('0xc')]);router[_0x5728('0xd')]('/',auth[_0x5728('0xb')](),controller[_0x5728('0xe')]);router[_0x5728('0xf')](_0x5728('0x10'),auth[_0x5728('0xb')](),controller['update']);router[_0x5728('0x11')](_0x5728('0x10'),auth[_0x5728('0xb')](),controller['destroy']);module[_0x5728('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3b45d15..a2941c0 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 _0x4088=['sequelize','exports','STRING','INTEGER'];(function(_0x1c07ea,_0x4a9c39){var _0x17227f=function(_0x8cfa1f){while(--_0x8cfa1f){_0x1c07ea['push'](_0x1c07ea['shift']());}};_0x17227f(++_0x4a9c39);}(_0x4088,0x170));var _0x8408=function(_0x4d967a,_0xc56013){_0x4d967a=_0x4d967a-0x0;var _0x362726=_0x4088[_0x4d967a];return _0x362726;};'use strict';var Sequelize=require(_0x8408('0x0'));module[_0x8408('0x1')]={'name':{'type':Sequelize[_0x8408('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8408('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8408('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0696=['sequelize','exports','STRING','INTEGER'];(function(_0x555109,_0x1d7ebb){var _0x2d499d=function(_0x175386){while(--_0x175386){_0x555109['push'](_0x555109['shift']());}};_0x2d499d(++_0x1d7ebb);}(_0x0696,0x1d8));var _0x6069=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x0696[_0x5b26cb];return _0x563d12;};'use strict';var Sequelize=require(_0x6069('0x0'));module[_0x6069('0x1')]={'name':{'type':Sequelize[_0x6069('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6069('0x3')],'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 189937a..2a8c8e8 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 _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x5bcadb,_0x35270a){var _0x501049=function(_0xa2c00b){while(--_0xa2c00b){_0x5bcadb['push'](_0x5bcadb['shift']());}};_0x501049(++_0x35270a);}(_0xdb28,0x106));var _0x8db2=function(_0x274eb3,_0x1cf748){_0x274eb3=_0x274eb3-0x0;var _0x2cfec2=_0xdb28[_0x274eb3];return _0x2cfec2;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file +var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x168005,_0x5d89d5){var _0x142188=function(_0x12f3a6){while(--_0x12f3a6){_0x168005['push'](_0x168005['shift']());}};_0x142188(++_0x5d89d5);}(_0xd117,0x182));var _0x7d11=function(_0x412818,_0xe8171a){_0x412818=_0x412818-0x0;var _0x2d40d1=_0xd117[_0x412818];return _0x2d40d1;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e863ade..ccc8ea4 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 _0x5655=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','moment','path'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x5655,0x134));var _0x5565=function(_0x5375ff,_0x2a13d1){_0x5375ff=_0x5375ff-0x0;var _0xfbfda3=_0x5655[_0x5375ff];return _0xfbfda3;};'use strict';var _=require('lodash');var util=require(_0x5565('0x0'));var logger=require(_0x5565('0x1'))('api');var moment=require(_0x5565('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5565('0x3'));var rimraf=require('rimraf');var config=require(_0x5565('0x4'));var attributes=require(_0x5565('0x5'));module[_0x5565('0x6')]=function(_0x1aa554,_0x4cb1be){return _0x1aa554[_0x5565('0x7')](_0x5565('0x8'),attributes,{'tableName':_0x5565('0x9'),'paranoid':![],'indexes':[{'name':_0x5565('0xa'),'fields':['resourceId',_0x5565('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c4b=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','sectionId','util','moment','bluebird','request-promise'];(function(_0x5bca54,_0x265d31){var _0x417e61=function(_0x374526){while(--_0x374526){_0x5bca54['push'](_0x5bca54['shift']());}};_0x417e61(++_0x265d31);}(_0x5c4b,0xc8));var _0xb5c4=function(_0x189921,_0x278da7){_0x189921=_0x189921-0x0;var _0x16a438=_0x5c4b[_0x189921];return _0x16a438;};'use strict';var _=require('lodash');var util=require(_0xb5c4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb5c4('0x1'));var BPromise=require(_0xb5c4('0x2'));var rp=require(_0xb5c4('0x3'));var fs=require('fs');var path=require(_0xb5c4('0x4'));var rimraf=require(_0xb5c4('0x5'));var config=require(_0xb5c4('0x6'));var attributes=require(_0xb5c4('0x7'));module[_0xb5c4('0x8')]=function(_0x5e0f52,_0x3944f4){return _0x5e0f52[_0xb5c4('0x9')](_0xb5c4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xb5c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 0f0537b..86f58af 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 _0x5189=['rpc','jayson/promise','client','http','request','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x416586,_0xbdf0b1){var _0x5cbb10=function(_0x274854){while(--_0x274854){_0x416586['push'](_0x416586['shift']());}};_0x5cbb10(++_0xbdf0b1);}(_0x5189,0xc2));var _0x9518=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x5189[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require('lodash');var util=require(_0x9518('0x0'));var moment=require(_0x9518('0x1'));var BPromise=require('bluebird');var rs=require(_0x9518('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9518('0x3'))['db'];var utils=require(_0x9518('0x4'));var logger=require(_0x9518('0x5'))(_0x9518('0x6'));var config=require('../../config/environment');var jayson=require(_0x9518('0x7'));var client=jayson[_0x9518('0x8')][_0x9518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x391be5,_0x5757bf,_0x3acc81){return new BPromise(function(_0x1f33be,_0x40e97b){return client[_0x9518('0xa')](_0x391be5,_0x3acc81)['then'](function(_0x42ac96){logger['info'](_0x9518('0xb'),_0x5757bf,'request\x20sent');logger[_0x9518('0xc')](_0x9518('0xd'),_0x5757bf,_0x9518('0xe'),JSON[_0x9518('0xf')](_0x42ac96));if(_0x42ac96['error']){if(_0x42ac96[_0x9518('0x10')][_0x9518('0x11')]===0x1f4){logger['error'](_0x9518('0xb'),_0x5757bf,_0x42ac96[_0x9518('0x10')][_0x9518('0x12')]);return _0x40e97b(_0x42ac96[_0x9518('0x10')][_0x9518('0x12')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5757bf,_0x42ac96[_0x9518('0x10')]['message']);return _0x1f33be(_0x42ac96[_0x9518('0x10')][_0x9518('0x12')]);}else{logger['info'](_0x9518('0xb'),_0x5757bf,_0x9518('0xe'));_0x1f33be(_0x42ac96[_0x9518('0x13')]['message']);}})['catch'](function(_0x42d26e){logger[_0x9518('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5757bf,_0x42d26e);_0x40e97b(_0x42d26e);});});} \ No newline at end of file +var _0x1b47=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x1328a7,_0x3cc28c){var _0x31429d=function(_0x57f9c0){while(--_0x57f9c0){_0x1328a7['push'](_0x1328a7['shift']());}};_0x31429d(++_0x3cc28c);}(_0x1b47,0x193));var _0x71b4=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0x1b47[_0x56355a];return _0x573afa;};'use strict';var _=require(_0x71b4('0x0'));var util=require(_0x71b4('0x1'));var moment=require(_0x71b4('0x2'));var BPromise=require(_0x71b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71b4('0x4'));var db=require(_0x71b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x71b4('0x6'));var jayson=require(_0x71b4('0x7'));var client=jayson[_0x71b4('0x8')][_0x71b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9176,_0x5e2958,_0x4190ee){return new BPromise(function(_0x15c27d,_0x113d95){return client[_0x71b4('0xa')](_0x2e9176,_0x4190ee)[_0x71b4('0xb')](function(_0x25f23a){logger[_0x71b4('0xc')](_0x71b4('0xd'),_0x5e2958,_0x71b4('0xe'));logger[_0x71b4('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5e2958,_0x71b4('0xe'),JSON[_0x71b4('0x10')](_0x25f23a));if(_0x25f23a['error']){if(_0x25f23a[_0x71b4('0x11')][_0x71b4('0x12')]===0x1f4){logger['error'](_0x71b4('0xd'),_0x5e2958,_0x25f23a[_0x71b4('0x11')][_0x71b4('0x13')]);return _0x113d95(_0x25f23a[_0x71b4('0x11')][_0x71b4('0x13')]);}logger[_0x71b4('0x11')](_0x71b4('0xd'),_0x5e2958,_0x25f23a[_0x71b4('0x11')][_0x71b4('0x13')]);return _0x15c27d(_0x25f23a['error'][_0x71b4('0x13')]);}else{logger[_0x71b4('0xc')](_0x71b4('0xd'),_0x5e2958,'request\x20sent');_0x15c27d(_0x25f23a[_0x71b4('0x14')][_0x71b4('0x13')]);}})[_0x71b4('0x15')](function(_0x5836f9){logger[_0x71b4('0x11')](_0x71b4('0xd'),_0x5e2958,_0x5836f9);_0x113d95(_0x5836f9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9c4f3f0..046a246 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 _0x65f1=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x52cae6,_0x24cd18){var _0x4ce7e9=function(_0x50f837){while(--_0x50f837){_0x52cae6['push'](_0x52cae6['shift']());}};_0x4ce7e9(++_0x24cd18);}(_0x65f1,0x185));var _0x165f=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x65f1[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x165f('0x0'));var util=require(_0x165f('0x1'));var path=require(_0x165f('0x2'));var timeout=require(_0x165f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x165f('0x4'));var interaction=require(_0x165f('0x5'));var config=require(_0x165f('0x6'));var controller=require(_0x165f('0x7'));router[_0x165f('0x8')]('/',auth[_0x165f('0x9')](),controller[_0x165f('0xa')]);router[_0x165f('0x8')](_0x165f('0xb'),auth[_0x165f('0x9')](),controller[_0x165f('0xc')]);router[_0x165f('0x8')](_0x165f('0xd'),auth['isAuthenticated'](),controller[_0x165f('0xe')]);router[_0x165f('0xf')]('/',auth['isAuthenticated'](),controller[_0x165f('0x10')]);router[_0x165f('0x11')](_0x165f('0xd'),auth[_0x165f('0x9')](),controller[_0x165f('0x12')]);router[_0x165f('0x13')](_0x165f('0xd'),auth['isAuthenticated'](),controller[_0x165f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0148=['/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','describe','isAuthenticated','show','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0148,0xd4));var _0x8014=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0148[_0x1da527];return _0x40fc7c;};'use strict';var multer=require('multer');var util=require(_0x8014('0x0'));var path=require(_0x8014('0x1'));var timeout=require(_0x8014('0x2'));var express=require(_0x8014('0x3'));var router=express[_0x8014('0x4')]();var fs_extra=require(_0x8014('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8014('0x6'));var config=require(_0x8014('0x7'));var controller=require(_0x8014('0x8'));router[_0x8014('0x9')]('/',auth['isAuthenticated'](),controller[_0x8014('0xa')]);router[_0x8014('0x9')](_0x8014('0xb'),auth['isAuthenticated'](),controller[_0x8014('0xc')]);router[_0x8014('0x9')]('/:id',auth[_0x8014('0xd')](),controller[_0x8014('0xe')]);router['post']('/',auth[_0x8014('0xd')](),controller['create']);router[_0x8014('0xf')](_0x8014('0x10'),auth[_0x8014('0xd')](),controller['update']);router['delete'](_0x8014('0x10'),auth[_0x8014('0xd')](),controller[_0x8014('0x11')]);module[_0x8014('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8ecc8d0..f31ac61 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 _0x757a=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x115d8d,_0xacde78){var _0x250c76=function(_0x5a5236){while(--_0x5a5236){_0x115d8d['push'](_0x115d8d['shift']());}};_0x250c76(++_0xacde78);}(_0x757a,0xde));var _0xa757=function(_0x117e7a,_0x17ed8a){_0x117e7a=_0x117e7a-0x0;var _0x5e96d3=_0x757a[_0x117e7a];return _0x5e96d3;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa757('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa757('0x1')],'set':function(_0x1c2932){this[_0xa757('0x3')](_0xa757('0x4'),_0x1c2932?_0x1c2932[_0xa757('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xa757('0x4'))?this[_0xa757('0x6')]('crudPermissions')[_0xa757('0x7')](''):[];}}}; \ No newline at end of file +var _0x0565=['exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','sequelize'];(function(_0x499275,_0x41f8a2){var _0x40dc01=function(_0x47c56b){while(--_0x47c56b){_0x499275['push'](_0x499275['shift']());}};_0x40dc01(++_0x41f8a2);}(_0x0565,0xf2));var _0x5056=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0565[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5056('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5056('0x2')],'set':function(_0x3657a8){this[_0x5056('0x5')]('crudPermissions',_0x3657a8?_0x3657a8[_0x5056('0x6')](''):[]);},'get':function(){return this[_0x5056('0x7')](_0x5056('0x8'))?this[_0x5056('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 a159155..0864773 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 _0x38a8=['end','name','send','map','UserProfileSection','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','options','include','rows','catch','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x38a8,0x122));var _0x838a=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0x38a8[_0x3cb152];return _0x4f54c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x838a('0x0'));var zipdir=require(_0x838a('0x1'));var jsonpatch=require(_0x838a('0x2'));var rp=require(_0x838a('0x3'));var moment=require(_0x838a('0x4'));var BPromise=require(_0x838a('0x5'));var Mustache=require(_0x838a('0x6'));var util=require(_0x838a('0x7'));var path=require(_0x838a('0x8'));var sox=require(_0x838a('0x9'));var csv=require(_0x838a('0xa'));var ejs=require(_0x838a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x838a('0xc'));var crypto=require(_0x838a('0xd'));var jsforce=require(_0x838a('0xe'));var deskjs=require(_0x838a('0xf'));var toCsv=require(_0x838a('0xa'));var querystring=require(_0x838a('0x10'));var Papa=require(_0x838a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x838a('0x12'));var hardwareService=require(_0x838a('0x13'));var logger=require('../../config/logger')(_0x838a('0x14'));var utils=require('../../config/utils');var config=require(_0x838a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x838a('0x16'))['db'];function respondWithStatusCode(_0x3dc913,_0x12847c){_0x12847c=_0x12847c||0xcc;return function(_0x5be488){if(_0x5be488){return _0x3dc913['sendStatus'](_0x12847c);}return _0x3dc913['status'](_0x12847c)['end']();};}function respondWithResult(_0x49886f,_0xe6777b){_0xe6777b=_0xe6777b||0xc8;return function(_0x2240a6){if(_0x2240a6){return _0x49886f[_0x838a('0x17')](_0xe6777b)['json'](_0x2240a6);}};}function respondWithFilteredResult(_0x21ba45,_0x40fa92){return function(_0x55c310){if(_0x55c310){var _0x472de3=typeof _0x40fa92[_0x838a('0x18')]===_0x838a('0x19')&&typeof _0x40fa92[_0x838a('0x1a')]==='undefined';var _0x14214b=_0x55c310[_0x838a('0x1b')];var _0x42a896=_0x472de3?0x0:_0x40fa92[_0x838a('0x18')];var _0x241bc5=_0x472de3?_0x55c310[_0x838a('0x1b')]:_0x40fa92[_0x838a('0x18')]+_0x40fa92[_0x838a('0x1a')];var _0x84bf87;if(_0x241bc5>=_0x14214b){_0x241bc5=_0x14214b;_0x84bf87=0xc8;}else{_0x84bf87=0xce;}_0x21ba45[_0x838a('0x17')](_0x84bf87);return _0x21ba45['set'](_0x838a('0x1c'),_0x42a896+'-'+_0x241bc5+'/'+_0x14214b)[_0x838a('0x1d')](_0x55c310);}return null;};}function patchUpdates(_0xc8652){return function(_0xe3cf2a){try{jsonpatch['apply'](_0xe3cf2a,_0xc8652,!![]);}catch(_0x1c9c7a){return BPromise[_0x838a('0x1e')](_0x1c9c7a);}return _0xe3cf2a[_0x838a('0x1f')]();};}function saveUpdates(_0xd5567c,_0x4046f3){return function(_0x53cca9){if(_0x53cca9){return _0x53cca9[_0x838a('0x20')](_0xd5567c)['then'](function(_0x373ab5){return _0x373ab5;});}return null;};}function removeEntity(_0x499c44,_0x2e75ee){return function(_0x6f1e7){if(_0x6f1e7){return _0x6f1e7[_0x838a('0x21')]()[_0x838a('0x22')](function(){_0x499c44[_0x838a('0x17')](0xcc)[_0x838a('0x23')]();});}};}function handleEntityNotFound(_0x15d116,_0x250675){return function(_0x49c5db){if(!_0x49c5db){_0x15d116['sendStatus'](0x194);}return _0x49c5db;};}function handleError(_0x507fdb,_0x2e5db4){_0x2e5db4=_0x2e5db4||0x1f4;return function(_0xe6167f){logger['error'](_0xe6167f['stack']);if(_0xe6167f['name']){delete _0xe6167f[_0x838a('0x24')];}_0x507fdb[_0x838a('0x17')](_0x2e5db4)[_0x838a('0x25')](_0xe6167f);};}exports['index']=function(_0x24dbbe,_0x1d97f5){var _0xaa9688={},_0x439955={},_0x426c79={'count':0x0,'rows':[]};var _0x37b40c=_[_0x838a('0x26')](db[_0x838a('0x27')][_0x838a('0x28')],function(_0x38c0e4){return{'name':_0x38c0e4['fieldName'],'type':_0x38c0e4[_0x838a('0x29')][_0x838a('0x2a')]};});_0x439955['model']=_['map'](_0x37b40c,'name');_0x439955['query']=_[_0x838a('0x2b')](_0x24dbbe[_0x838a('0x2c')]);_0x439955[_0x838a('0x2d')]=_[_0x838a('0x2e')](_0x439955[_0x838a('0x2f')],_0x439955[_0x838a('0x2c')]);_0xaa9688[_0x838a('0x30')]=_['intersection'](_0x439955['model'],qs['fields'](_0x24dbbe[_0x838a('0x2c')][_0x838a('0x31')]));_0xaa9688[_0x838a('0x30')]=_0xaa9688[_0x838a('0x30')][_0x838a('0x32')]?_0xaa9688[_0x838a('0x30')]:_0x439955[_0x838a('0x2f')];if(!_0x24dbbe[_0x838a('0x2c')][_0x838a('0x33')]('nolimit')){_0xaa9688['limit']=qs[_0x838a('0x1a')](_0x24dbbe[_0x838a('0x2c')]['limit']);_0xaa9688['offset']=qs['offset'](_0x24dbbe[_0x838a('0x2c')][_0x838a('0x18')]);}_0xaa9688['order']=qs[_0x838a('0x34')](_0x24dbbe[_0x838a('0x2c')]['sort']);_0xaa9688[_0x838a('0x35')]=qs['filters'](_[_0x838a('0x36')](_0x24dbbe[_0x838a('0x2c')],_0x439955[_0x838a('0x2d')]),_0x37b40c);if(_0x24dbbe[_0x838a('0x2c')]['filter']){_0xaa9688[_0x838a('0x35')]=_[_0x838a('0x37')](_0xaa9688[_0x838a('0x35')],{'$or':_[_0x838a('0x26')](_0x37b40c,function(_0x49a3a7){if(_0x49a3a7[_0x838a('0x29')]!=='VIRTUAL'){var _0x58c81f={};_0x58c81f[_0x49a3a7[_0x838a('0x24')]]={'$like':'%'+_0x24dbbe['query']['filter']+'%'};return _0x58c81f;}})});}_0xaa9688=_['merge']({},_0xaa9688,_0x24dbbe[_0x838a('0x38')]);var _0xd3ebb3={'where':_0xaa9688[_0x838a('0x35')]};return db['UserProfileSection'][_0x838a('0x1b')](_0xd3ebb3)[_0x838a('0x22')](function(_0x4909c7){_0x426c79['count']=_0x4909c7;if(_0x24dbbe['query']['includeAll']){_0xaa9688[_0x838a('0x39')]=[{'all':!![]}];}return db[_0x838a('0x27')]['findAll'](_0xaa9688);})[_0x838a('0x22')](function(_0x1ef70c){_0x426c79[_0x838a('0x3a')]=_0x1ef70c;return _0x426c79;})[_0x838a('0x22')](respondWithFilteredResult(_0x1d97f5,_0xaa9688))[_0x838a('0x3b')](handleError(_0x1d97f5,null));};exports['show']=function(_0x3bdf08,_0x38f11d){var _0x310f8b={'raw':![],'where':{'id':_0x3bdf08[_0x838a('0x3c')]['id']}},_0x400fdc={};_0x400fdc[_0x838a('0x2f')]=_['keys'](db[_0x838a('0x27')][_0x838a('0x28')]);_0x400fdc['query']=_[_0x838a('0x2b')](_0x3bdf08[_0x838a('0x2c')]);_0x400fdc['filters']=_[_0x838a('0x2e')](_0x400fdc[_0x838a('0x2f')],_0x400fdc[_0x838a('0x2c')]);_0x310f8b[_0x838a('0x30')]=_['intersection'](_0x400fdc[_0x838a('0x2f')],qs['fields'](_0x3bdf08[_0x838a('0x2c')][_0x838a('0x31')]));_0x310f8b[_0x838a('0x30')]=_0x310f8b[_0x838a('0x30')][_0x838a('0x32')]?_0x310f8b[_0x838a('0x30')]:_0x400fdc[_0x838a('0x2f')];if(_0x3bdf08[_0x838a('0x2c')]['includeAll']){_0x310f8b[_0x838a('0x39')]=[{'all':!![]}];}_0x310f8b=_[_0x838a('0x37')]({},_0x310f8b,_0x3bdf08[_0x838a('0x38')]);return db[_0x838a('0x27')]['find'](_0x310f8b)[_0x838a('0x22')](handleEntityNotFound(_0x38f11d,null))[_0x838a('0x22')](respondWithResult(_0x38f11d,null))[_0x838a('0x3b')](handleError(_0x38f11d,null));};exports[_0x838a('0x3d')]=function(_0x4d0875,_0x3cb447){return db[_0x838a('0x27')][_0x838a('0x3d')](_0x4d0875['body'],{})[_0x838a('0x22')](respondWithResult(_0x3cb447,0xc9))['catch'](handleError(_0x3cb447,null));};exports[_0x838a('0x20')]=function(_0x4b9533,_0xaf188d){if(_0x4b9533[_0x838a('0x3e')]['id']){delete _0x4b9533[_0x838a('0x3e')]['id'];}return db[_0x838a('0x27')][_0x838a('0x3f')]({'where':{'id':_0x4b9533[_0x838a('0x3c')]['id']}})[_0x838a('0x22')](handleEntityNotFound(_0xaf188d,null))[_0x838a('0x22')](saveUpdates(_0x4b9533[_0x838a('0x3e')],null))[_0x838a('0x22')](respondWithResult(_0xaf188d,null))[_0x838a('0x3b')](handleError(_0xaf188d,null));};exports[_0x838a('0x21')]=function(_0x132a11,_0xf78965){return db[_0x838a('0x27')][_0x838a('0x3f')]({'where':{'id':_0x132a11[_0x838a('0x3c')]['id']}})['then'](handleEntityNotFound(_0xf78965,null))[_0x838a('0x22')](removeEntity(_0xf78965,null))['catch'](handleError(_0xf78965,null));};exports[_0x838a('0x40')]=function(_0x473a72,_0x7520cc){return db[_0x838a('0x27')][_0x838a('0x40')]()[_0x838a('0x22')](respondWithResult(_0x7520cc,null))[_0x838a('0x3b')](handleError(_0x7520cc,null));}; \ No newline at end of file +var _0x7692=['hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','then','count','include','UserProfileSection','findAll','catch','show','params','rawAttributes','find','create','update','body','describe','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7692,0x19d));var _0x2769=function(_0x1bfc7b,_0x360a77){_0x1bfc7b=_0x1bfc7b-0x0;var _0x3004cf=_0x7692[_0x1bfc7b];return _0x3004cf;};'use strict';var emlformat=require(_0x2769('0x0'));var rimraf=require(_0x2769('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2769('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2769('0x3'));var util=require(_0x2769('0x4'));var path=require(_0x2769('0x5'));var sox=require(_0x2769('0x6'));var csv=require(_0x2769('0x7'));var ejs=require(_0x2769('0x8'));var fs=require('fs');var fs_extra=require(_0x2769('0x9'));var _=require(_0x2769('0xa'));var squel=require(_0x2769('0xb'));var crypto=require(_0x2769('0xc'));var jsforce=require(_0x2769('0xd'));var deskjs=require(_0x2769('0xe'));var toCsv=require(_0x2769('0x7'));var querystring=require(_0x2769('0xf'));var Papa=require(_0x2769('0x10'));var Redis=require('ioredis');var authService=require(_0x2769('0x11'));var qs=require(_0x2769('0x12'));var as=require(_0x2769('0x13'));var hardwareService=require(_0x2769('0x14'));var logger=require('../../config/logger')(_0x2769('0x15'));var utils=require(_0x2769('0x16'));var config=require(_0x2769('0x17'));var licenseUtil=require(_0x2769('0x18'));var db=require(_0x2769('0x19'))['db'];function respondWithStatusCode(_0x46dacc,_0x1201b3){_0x1201b3=_0x1201b3||0xcc;return function(_0x31973f){if(_0x31973f){return _0x46dacc[_0x2769('0x1a')](_0x1201b3);}return _0x46dacc['status'](_0x1201b3)[_0x2769('0x1b')]();};}function respondWithResult(_0x21e71b,_0x2dd6dc){_0x2dd6dc=_0x2dd6dc||0xc8;return function(_0x3f4818){if(_0x3f4818){return _0x21e71b[_0x2769('0x1c')](_0x2dd6dc)[_0x2769('0x1d')](_0x3f4818);}};}function respondWithFilteredResult(_0x13cfe0,_0x27cf69){return function(_0x32b3f8){if(_0x32b3f8){var _0x48c14b=typeof _0x27cf69[_0x2769('0x1e')]===_0x2769('0x1f')&&typeof _0x27cf69[_0x2769('0x20')]===_0x2769('0x1f');var _0x31db4a=_0x32b3f8['count'];var _0x501544=_0x48c14b?0x0:_0x27cf69['offset'];var _0x204526=_0x48c14b?_0x32b3f8['count']:_0x27cf69['offset']+_0x27cf69[_0x2769('0x20')];var _0x2e4b46;if(_0x204526>=_0x31db4a){_0x204526=_0x31db4a;_0x2e4b46=0xc8;}else{_0x2e4b46=0xce;}_0x13cfe0['status'](_0x2e4b46);return _0x13cfe0[_0x2769('0x21')](_0x2769('0x22'),_0x501544+'-'+_0x204526+'/'+_0x31db4a)[_0x2769('0x1d')](_0x32b3f8);}return null;};}function patchUpdates(_0x15e2f2){return function(_0x4494c3){try{jsonpatch[_0x2769('0x23')](_0x4494c3,_0x15e2f2,!![]);}catch(_0x46d413){return BPromise[_0x2769('0x24')](_0x46d413);}return _0x4494c3[_0x2769('0x25')]();};}function saveUpdates(_0xf3119e,_0x1545f1){return function(_0x5566fe){if(_0x5566fe){return _0x5566fe['update'](_0xf3119e)['then'](function(_0x28eca9){return _0x28eca9;});}return null;};}function removeEntity(_0x5e19c1,_0x254816){return function(_0x3d3111){if(_0x3d3111){return _0x3d3111[_0x2769('0x26')]()['then'](function(){_0x5e19c1['status'](0xcc)[_0x2769('0x1b')]();});}};}function handleEntityNotFound(_0x2681c1,_0x3a4690){return function(_0x28634a){if(!_0x28634a){_0x2681c1[_0x2769('0x1a')](0x194);}return _0x28634a;};}function handleError(_0x31ac3a,_0x4d2a88){_0x4d2a88=_0x4d2a88||0x1f4;return function(_0x1b41e0){logger[_0x2769('0x27')](_0x1b41e0[_0x2769('0x28')]);if(_0x1b41e0['name']){delete _0x1b41e0[_0x2769('0x29')];}_0x31ac3a[_0x2769('0x1c')](_0x4d2a88)[_0x2769('0x2a')](_0x1b41e0);};}exports[_0x2769('0x2b')]=function(_0x53d361,_0xf6d3d8){var _0x50da02={},_0x41b1f8={},_0x423297={'count':0x0,'rows':[]};var _0x256fe3=_[_0x2769('0x2c')](db['UserProfileSection']['rawAttributes'],function(_0x1d6231){return{'name':_0x1d6231['fieldName'],'type':_0x1d6231[_0x2769('0x2d')][_0x2769('0x2e')]};});_0x41b1f8[_0x2769('0x2f')]=_[_0x2769('0x2c')](_0x256fe3,_0x2769('0x29'));_0x41b1f8[_0x2769('0x30')]=_[_0x2769('0x31')](_0x53d361[_0x2769('0x30')]);_0x41b1f8[_0x2769('0x32')]=_[_0x2769('0x33')](_0x41b1f8['model'],_0x41b1f8['query']);_0x50da02[_0x2769('0x34')]=_['intersection'](_0x41b1f8['model'],qs[_0x2769('0x35')](_0x53d361['query'][_0x2769('0x35')]));_0x50da02[_0x2769('0x34')]=_0x50da02[_0x2769('0x34')][_0x2769('0x36')]?_0x50da02['attributes']:_0x41b1f8[_0x2769('0x2f')];if(!_0x53d361[_0x2769('0x30')][_0x2769('0x37')]('nolimit')){_0x50da02[_0x2769('0x20')]=qs[_0x2769('0x20')](_0x53d361[_0x2769('0x30')][_0x2769('0x20')]);_0x50da02[_0x2769('0x1e')]=qs['offset'](_0x53d361['query'][_0x2769('0x1e')]);}_0x50da02[_0x2769('0x38')]=qs['sort'](_0x53d361[_0x2769('0x30')][_0x2769('0x39')]);_0x50da02[_0x2769('0x3a')]=qs[_0x2769('0x32')](_[_0x2769('0x3b')](_0x53d361['query'],_0x41b1f8[_0x2769('0x32')]),_0x256fe3);if(_0x53d361[_0x2769('0x30')]['filter']){_0x50da02[_0x2769('0x3a')]=_[_0x2769('0x3c')](_0x50da02[_0x2769('0x3a')],{'$or':_[_0x2769('0x2c')](_0x256fe3,function(_0x2224ee){if(_0x2224ee[_0x2769('0x2d')]!==_0x2769('0x3d')){var _0x403fd1={};_0x403fd1[_0x2224ee[_0x2769('0x29')]]={'$like':'%'+_0x53d361['query'][_0x2769('0x3e')]+'%'};return _0x403fd1;}})});}_0x50da02=_[_0x2769('0x3c')]({},_0x50da02,_0x53d361[_0x2769('0x3f')]);var _0x17a1b5={'where':_0x50da02[_0x2769('0x3a')]};return db['UserProfileSection']['count'](_0x17a1b5)[_0x2769('0x40')](function(_0x3971b1){_0x423297[_0x2769('0x41')]=_0x3971b1;if(_0x53d361[_0x2769('0x30')]['includeAll']){_0x50da02[_0x2769('0x42')]=[{'all':!![]}];}return db[_0x2769('0x43')][_0x2769('0x44')](_0x50da02);})['then'](function(_0x9b4460){_0x423297['rows']=_0x9b4460;return _0x423297;})[_0x2769('0x40')](respondWithFilteredResult(_0xf6d3d8,_0x50da02))[_0x2769('0x45')](handleError(_0xf6d3d8,null));};exports[_0x2769('0x46')]=function(_0x2392c9,_0x4bce9f){var _0xad2e73={'raw':![],'where':{'id':_0x2392c9[_0x2769('0x47')]['id']}},_0xa6c865={};_0xa6c865[_0x2769('0x2f')]=_['keys'](db[_0x2769('0x43')][_0x2769('0x48')]);_0xa6c865[_0x2769('0x30')]=_['keys'](_0x2392c9[_0x2769('0x30')]);_0xa6c865['filters']=_['intersection'](_0xa6c865['model'],_0xa6c865[_0x2769('0x30')]);_0xad2e73[_0x2769('0x34')]=_[_0x2769('0x33')](_0xa6c865[_0x2769('0x2f')],qs['fields'](_0x2392c9[_0x2769('0x30')][_0x2769('0x35')]));_0xad2e73[_0x2769('0x34')]=_0xad2e73[_0x2769('0x34')][_0x2769('0x36')]?_0xad2e73[_0x2769('0x34')]:_0xa6c865[_0x2769('0x2f')];if(_0x2392c9[_0x2769('0x30')]['includeAll']){_0xad2e73[_0x2769('0x42')]=[{'all':!![]}];}_0xad2e73=_['merge']({},_0xad2e73,_0x2392c9[_0x2769('0x3f')]);return db['UserProfileSection'][_0x2769('0x49')](_0xad2e73)[_0x2769('0x40')](handleEntityNotFound(_0x4bce9f,null))[_0x2769('0x40')](respondWithResult(_0x4bce9f,null))['catch'](handleError(_0x4bce9f,null));};exports[_0x2769('0x4a')]=function(_0x30e682,_0x5a5bde){return db[_0x2769('0x43')][_0x2769('0x4a')](_0x30e682['body'],{})[_0x2769('0x40')](respondWithResult(_0x5a5bde,0xc9))['catch'](handleError(_0x5a5bde,null));};exports[_0x2769('0x4b')]=function(_0x1f0ce7,_0x349ae1){if(_0x1f0ce7[_0x2769('0x4c')]['id']){delete _0x1f0ce7[_0x2769('0x4c')]['id'];}return db[_0x2769('0x43')][_0x2769('0x49')]({'where':{'id':_0x1f0ce7[_0x2769('0x47')]['id']}})[_0x2769('0x40')](handleEntityNotFound(_0x349ae1,null))[_0x2769('0x40')](saveUpdates(_0x1f0ce7[_0x2769('0x4c')],null))[_0x2769('0x40')](respondWithResult(_0x349ae1,null))[_0x2769('0x45')](handleError(_0x349ae1,null));};exports[_0x2769('0x26')]=function(_0x189877,_0x34db1e){return db[_0x2769('0x43')][_0x2769('0x49')]({'where':{'id':_0x189877[_0x2769('0x47')]['id']}})['then'](handleEntityNotFound(_0x34db1e,null))[_0x2769('0x40')](removeEntity(_0x34db1e,null))['catch'](handleError(_0x34db1e,null));};exports[_0x2769('0x4d')]=function(_0x32c7bc,_0x178083){return db['UserProfileSection'][_0x2769('0x4d')]()['then'](respondWithResult(_0x178083,null))[_0x2769('0x45')](handleError(_0x178083,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 842150f..d0dc0bc 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 _0x0d56=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','request-promise'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x0d56,0x6c));var _0x60d5=function(_0x6628e4,_0x1cfd1b){_0x6628e4=_0x6628e4-0x0;var _0x424deb=_0x0d56[_0x6628e4];return _0x424deb;};'use strict';var _=require(_0x60d5('0x0'));var util=require(_0x60d5('0x1'));var logger=require(_0x60d5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x60d5('0x3'));var fs=require('fs');var path=require(_0x60d5('0x4'));var rimraf=require(_0x60d5('0x5'));var config=require(_0x60d5('0x6'));var attributes=require(_0x60d5('0x7'));module[_0x60d5('0x8')]=function(_0x21e4ca,_0x13ad1f){return _0x21e4ca[_0x60d5('0x9')]('UserProfileSection',attributes,{'tableName':_0x60d5('0xa'),'paranoid':![],'indexes':[{'name':_0x60d5('0xb'),'fields':[_0x60d5('0xc'),_0x60d5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeee0=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','moment','bluebird','request-promise','path','./userProfileSection.attributes','exports','define'];(function(_0x3b7157,_0x1685d2){var _0x5c0b90=function(_0x219856){while(--_0x219856){_0x3b7157['push'](_0x3b7157['shift']());}};_0x5c0b90(++_0x1685d2);}(_0xeee0,0x164));var _0x0eee=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0xeee0[_0x38ce4c];return _0x5d4544;};'use strict';var _=require('lodash');var util=require(_0x0eee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0eee('0x1'));var BPromise=require(_0x0eee('0x2'));var rp=require(_0x0eee('0x3'));var fs=require('fs');var path=require(_0x0eee('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0eee('0x5'));module[_0x0eee('0x6')]=function(_0x8deaa6,_0x5c35d6){return _0x8deaa6[_0x0eee('0x7')](_0x0eee('0x8'),attributes,{'tableName':_0x0eee('0x9'),'paranoid':![],'indexes':[{'name':_0x0eee('0xa'),'fields':[_0x0eee('0xb'),_0x0eee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 28c105a..422beea 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 _0x7981=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','bluebird','randomstring'];(function(_0x459573,_0x35679e){var _0x51ffcd=function(_0x37bb90){while(--_0x37bb90){_0x459573['push'](_0x459573['shift']());}};_0x51ffcd(++_0x35679e);}(_0x7981,0x132));var _0x1798=function(_0x59ec6e,_0x58b3bf){_0x59ec6e=_0x59ec6e-0x0;var _0x564e11=_0x7981[_0x59ec6e];return _0x564e11;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1798('0x0'));var rs=require(_0x1798('0x1'));var fs=require('fs');var Redis=require(_0x1798('0x2'));var db=require(_0x1798('0x3'))['db'];var utils=require(_0x1798('0x4'));var logger=require(_0x1798('0x5'))(_0x1798('0x6'));var config=require(_0x1798('0x7'));var jayson=require(_0x1798('0x8'));var client=jayson[_0x1798('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x532262,_0x296cd3,_0x1b45ab){return new BPromise(function(_0x4bdfb5,_0x5d7c74){return client[_0x1798('0xa')](_0x532262,_0x1b45ab)[_0x1798('0xb')](function(_0x58ed57){logger[_0x1798('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x296cd3,_0x1798('0xd'));logger[_0x1798('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x296cd3,_0x1798('0xd'),JSON[_0x1798('0xf')](_0x58ed57));if(_0x58ed57[_0x1798('0x10')]){if(_0x58ed57[_0x1798('0x10')][_0x1798('0x11')]===0x1f4){logger[_0x1798('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x296cd3,_0x58ed57[_0x1798('0x10')][_0x1798('0x12')]);return _0x5d7c74(_0x58ed57['error'][_0x1798('0x12')]);}logger['error'](_0x1798('0x13'),_0x296cd3,_0x58ed57[_0x1798('0x10')][_0x1798('0x12')]);return _0x4bdfb5(_0x58ed57['error'][_0x1798('0x12')]);}else{logger[_0x1798('0xc')](_0x1798('0x13'),_0x296cd3,_0x1798('0xd'));_0x4bdfb5(_0x58ed57[_0x1798('0x14')]['message']);}})[_0x1798('0x15')](function(_0x4535ae){logger['error'](_0x1798('0x13'),_0x296cd3,_0x4535ae);_0x5d7c74(_0x4535ae);});});} \ No newline at end of file +var _0x39f3=['../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x156d1b,_0x756c49){var _0x4b20ad=function(_0x41543d){while(--_0x41543d){_0x156d1b['push'](_0x156d1b['shift']());}};_0x4b20ad(++_0x756c49);}(_0x39f3,0x82));var _0x339f=function(_0x718568,_0x4af153){_0x718568=_0x718568-0x0;var _0x5e1321=_0x39f3[_0x718568];return _0x5e1321;};'use strict';var _=require('lodash');var util=require(_0x339f('0x0'));var moment=require(_0x339f('0x1'));var BPromise=require(_0x339f('0x2'));var rs=require(_0x339f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x339f('0x4'))['db'];var utils=require(_0x339f('0x5'));var logger=require(_0x339f('0x6'))(_0x339f('0x7'));var config=require(_0x339f('0x8'));var jayson=require(_0x339f('0x9'));var client=jayson['client'][_0x339f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a858c,_0x5d620a,_0x2850f8){return new BPromise(function(_0x463b2f,_0x171f70){return client[_0x339f('0xb')](_0x8a858c,_0x2850f8)[_0x339f('0xc')](function(_0x33e46c){logger[_0x339f('0xd')](_0x339f('0xe'),_0x5d620a,_0x339f('0xf'));logger['debug'](_0x339f('0x10'),_0x5d620a,_0x339f('0xf'),JSON[_0x339f('0x11')](_0x33e46c));if(_0x33e46c[_0x339f('0x12')]){if(_0x33e46c['error'][_0x339f('0x13')]===0x1f4){logger[_0x339f('0x12')](_0x339f('0xe'),_0x5d620a,_0x33e46c[_0x339f('0x12')][_0x339f('0x14')]);return _0x171f70(_0x33e46c[_0x339f('0x12')][_0x339f('0x14')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5d620a,_0x33e46c[_0x339f('0x12')][_0x339f('0x14')]);return _0x463b2f(_0x33e46c[_0x339f('0x12')][_0x339f('0x14')]);}else{logger[_0x339f('0xd')](_0x339f('0xe'),_0x5d620a,_0x339f('0xf'));_0x463b2f(_0x33e46c[_0x339f('0x15')][_0x339f('0x14')]);}})[_0x339f('0x16')](function(_0x490253){logger['error'](_0x339f('0xe'),_0x5d620a,_0x490253);_0x171f70(_0x490253);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1072af0..2fd95ac 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x52f460,_0x32b61a){var _0xc1adc9=function(_0x5da0db){while(--_0x5da0db){_0x52f460['push'](_0x52f460['shift']());}};_0xc1adc9(++_0x32b61a);}(_0xe706,0xa3));var _0x6e70=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0xe706[_0x480fc2];return _0x540a95;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x485c5e,_0x3026df){var _0x2a9502=function(_0x2ec198){while(--_0x2ec198){_0x485c5e['push'](_0x485c5e['shift']());}};_0x2a9502(++_0x3026df);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4c85dbf..ce6cc97 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 _0xa19a=['INTEGER','sequelize','exports'];(function(_0x1ded70,_0x3f28d5){var _0x5a3a97=function(_0x4575ca){while(--_0x4575ca){_0x1ded70['push'](_0x1ded70['shift']());}};_0x5a3a97(++_0x3f28d5);}(_0xa19a,0x82));var _0xaa19=function(_0x4e9f9f,_0x3f7962){_0x4e9f9f=_0x4e9f9f-0x0;var _0x252351=_0xa19a[_0x4e9f9f];return _0x252351;};'use strict';var Sequelize=require(_0xaa19('0x0'));module[_0xaa19('0x1')]={'penalty':{'type':Sequelize[_0xaa19('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20ef=['exports','INTEGER'];(function(_0x1ad20d,_0xdf6fe4){var _0x4cbfc0=function(_0x5523b9){while(--_0x5523b9){_0x1ad20d['push'](_0x1ad20d['shift']());}};_0x4cbfc0(++_0xdf6fe4);}(_0x20ef,0x9e));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf20e('0x0')]={'penalty':{'type':Sequelize[_0xf20e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c04cba5..c4af5ac 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 _0xe944=['define','UserSmsQueue','user_has_sms_queues','lodash','api','request-promise','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x5ad1b0,_0x26da43){var _0x3100f0=function(_0x141664){while(--_0x141664){_0x5ad1b0['push'](_0x5ad1b0['shift']());}};_0x3100f0(++_0x26da43);}(_0xe944,0x174));var _0x4e94=function(_0x544127,_0x2146d0){_0x544127=_0x544127-0x0;var _0x26df88=_0xe944[_0x544127];return _0x26df88;};'use strict';var _=require(_0x4e94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e94('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e94('0x3'));var attributes=require(_0x4e94('0x4'));module[_0x4e94('0x5')]=function(_0xbb43ae,_0x4d00e5){return _0xbb43ae[_0x4e94('0x6')](_0x4e94('0x7'),attributes,{'tableName':_0x4e94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe714=['path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x522014,_0x367450){var _0x225905=function(_0x389a2e){while(--_0x389a2e){_0x522014['push'](_0x522014['shift']());}};_0x225905(++_0x367450);}(_0xe714,0xe2));var _0x4e71=function(_0x531d23,_0x476ce2){_0x531d23=_0x531d23-0x0;var _0x1cfbd8=_0xe714[_0x531d23];return _0x1cfbd8;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var logger=require(_0x4e71('0x1'))(_0x4e71('0x2'));var moment=require(_0x4e71('0x3'));var BPromise=require(_0x4e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e71('0x5'));var rimraf=require('rimraf');var config=require(_0x4e71('0x6'));var attributes=require(_0x4e71('0x7'));module[_0x4e71('0x8')]=function(_0x204a19,_0xfe1559){return _0x204a19[_0x4e71('0x9')]('UserSmsQueue',attributes,{'tableName':_0x4e71('0xa'),'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 ffd342c..626e18b 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 _0x3aa7=['UserSmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x473ad1,_0xcc08c1){var _0x585a2d=function(_0x3152bc){while(--_0x3152bc){_0x473ad1['push'](_0x473ad1['shift']());}};_0x585a2d(++_0xcc08c1);}(_0x3aa7,0x7e));var _0x73aa=function(_0x3d51e1,_0x48bf00){_0x3d51e1=_0x3d51e1-0x0;var _0x32d0a5=_0x3aa7[_0x3d51e1];return _0x32d0a5;};'use strict';var _=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var moment=require(_0x73aa('0x2'));var BPromise=require(_0x73aa('0x3'));var rs=require(_0x73aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73aa('0x5'))['db'];var utils=require(_0x73aa('0x6'));var logger=require(_0x73aa('0x7'))(_0x73aa('0x8'));var config=require(_0x73aa('0x9'));var jayson=require(_0x73aa('0xa'));var client=jayson[_0x73aa('0xb')][_0x73aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ae0f5,_0x36e42b,_0x29a9c4){return new BPromise(function(_0x8dc04,_0x5f266a){return client[_0x73aa('0xd')](_0x2ae0f5,_0x29a9c4)[_0x73aa('0xe')](function(_0x4cef66){logger[_0x73aa('0xf')](_0x73aa('0x10'),_0x36e42b,_0x73aa('0x11'));logger['debug'](_0x73aa('0x12'),_0x36e42b,_0x73aa('0x11'),JSON['stringify'](_0x4cef66));if(_0x4cef66['error']){if(_0x4cef66['error'][_0x73aa('0x13')]===0x1f4){logger[_0x73aa('0x14')](_0x73aa('0x10'),_0x36e42b,_0x4cef66[_0x73aa('0x14')][_0x73aa('0x15')]);return _0x5f266a(_0x4cef66[_0x73aa('0x14')][_0x73aa('0x15')]);}logger[_0x73aa('0x14')](_0x73aa('0x10'),_0x36e42b,_0x4cef66[_0x73aa('0x14')]['message']);return _0x8dc04(_0x4cef66['error'][_0x73aa('0x15')]);}else{logger[_0x73aa('0xf')](_0x73aa('0x10'),_0x36e42b,_0x73aa('0x11'));_0x8dc04(_0x4cef66[_0x73aa('0x16')][_0x73aa('0x15')]);}})[_0x73aa('0x17')](function(_0x38b25d){logger['error'](_0x73aa('0x10'),_0x36e42b,_0x38b25d);_0x5f266a(_0x38b25d);});});} \ No newline at end of file +var _0x73c3=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1d38f2,_0x1f96c7){var _0x2b0e5b=function(_0x1e5294){while(--_0x1e5294){_0x1d38f2['push'](_0x1d38f2['shift']());}};_0x2b0e5b(++_0x1f96c7);}(_0x73c3,0x118));var _0x373c=function(_0x24d4a8,_0x202639){_0x24d4a8=_0x24d4a8-0x0;var _0x495ef0=_0x73c3[_0x24d4a8];return _0x495ef0;};'use strict';var _=require('lodash');var util=require(_0x373c('0x0'));var moment=require(_0x373c('0x1'));var BPromise=require(_0x373c('0x2'));var rs=require(_0x373c('0x3'));var fs=require('fs');var Redis=require(_0x373c('0x4'));var db=require(_0x373c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x373c('0x6'))(_0x373c('0x7'));var config=require(_0x373c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x373c('0x9')][_0x373c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c24a6,_0x2d2f8a,_0x51f473){return new BPromise(function(_0x269a85,_0xf88030){return client['request'](_0x3c24a6,_0x51f473)['then'](function(_0x11d7a3){logger[_0x373c('0xb')](_0x373c('0xc'),_0x2d2f8a,_0x373c('0xd'));logger[_0x373c('0xe')](_0x373c('0xf'),_0x2d2f8a,_0x373c('0xd'),JSON[_0x373c('0x10')](_0x11d7a3));if(_0x11d7a3[_0x373c('0x11')]){if(_0x11d7a3[_0x373c('0x11')]['code']===0x1f4){logger[_0x373c('0x11')](_0x373c('0xc'),_0x2d2f8a,_0x11d7a3['error'][_0x373c('0x12')]);return _0xf88030(_0x11d7a3[_0x373c('0x11')]['message']);}logger[_0x373c('0x11')](_0x373c('0xc'),_0x2d2f8a,_0x11d7a3[_0x373c('0x11')][_0x373c('0x12')]);return _0x269a85(_0x11d7a3[_0x373c('0x11')][_0x373c('0x12')]);}else{logger['info'](_0x373c('0xc'),_0x2d2f8a,_0x373c('0xd'));_0x269a85(_0x11d7a3[_0x373c('0x13')][_0x373c('0x12')]);}})[_0x373c('0x14')](function(_0x2c6b1d){logger[_0x373c('0x11')](_0x373c('0xc'),_0x2d2f8a,_0x2c6b1d);_0xf88030(_0x2c6b1d);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d1c8484..d2bd33f 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 _0xf0e8=['INTEGER','sequelize'];(function(_0x39842c,_0x44480f){var _0xe70458=function(_0x4f0867){while(--_0x4f0867){_0x39842c['push'](_0x39842c['shift']());}};_0xe70458(++_0x44480f);}(_0xf0e8,0x171));var _0x8f0e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf0e8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x8f0e('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x8f0e('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8f0e('0x1')]}}; \ No newline at end of file +var _0x62e0=['INTEGER','sequelize','exports'];(function(_0x4ac830,_0x461b2d){var _0x6e6530=function(_0x52dd58){while(--_0x52dd58){_0x4ac830['push'](_0x4ac830['shift']());}};_0x6e6530(++_0x461b2d);}(_0x62e0,0xfa));var _0x062e=function(_0xac63b2,_0x32f4ad){_0xac63b2=_0xac63b2-0x0;var _0x44ac8b=_0x62e0[_0xac63b2];return _0x44ac8b;};'use strict';var Sequelize=require(_0x062e('0x0'));module[_0x062e('0x1')]={'UserId':{'type':Sequelize[_0x062e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x062e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 095cbd8..5d2d585 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(_0xc38184,_0x9387b6){var _0x37f73a=function(_0x2568d5){while(--_0x2568d5){_0xc38184['push'](_0xc38184['shift']());}};_0x37f73a(++_0x9387b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xa405a2,_0x4df017){var _0x243f44=function(_0xf36061){while(--_0xf36061){_0xa405a2['push'](_0xa405a2['shift']());}};_0x243f44(++_0x4df017);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d6cf05f..68c8777 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36487f,_0x40e4e1){var _0x17ada4=function(_0x46157c){while(--_0x46157c){_0x36487f['push'](_0x36487f['shift']());}};_0x17ada4(++_0x40e4e1);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1840b1,_0x2d021e){var _0x54ee73=function(_0x313ab9){while(--_0x313ab9){_0x1840b1['push'](_0x1840b1['shift']());}};_0x54ee73(++_0x2d021e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6cc4afe..3d51451 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 _0x96b8=['sequelize','exports'];(function(_0x3c59b7,_0x242aba){var _0x1a5e0=function(_0x32fc7f){while(--_0x32fc7f){_0x3c59b7['push'](_0x3c59b7['shift']());}};_0x1a5e0(++_0x242aba);}(_0x96b8,0x100));var _0x896b=function(_0x589f31,_0xc29bf5){_0x589f31=_0x589f31-0x0;var _0x33d9c3=_0x96b8[_0x589f31];return _0x33d9c3;};'use strict';var Sequelize=require(_0x896b('0x0'));module[_0x896b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7984=['exports','INTEGER','sequelize'];(function(_0x28b83a,_0x401d6f){var _0x5985d9=function(_0x37d489){while(--_0x37d489){_0x28b83a['push'](_0x28b83a['shift']());}};_0x5985d9(++_0x401d6f);}(_0x7984,0x83));var _0x4798=function(_0x4bf7ff,_0x53004b){_0x4bf7ff=_0x4bf7ff-0x0;var _0x35ffb3=_0x7984[_0x4bf7ff];return _0x35ffb3;};'use strict';var Sequelize=require(_0x4798('0x0'));module[_0x4798('0x1')]={'penalty':{'type':Sequelize[_0x4798('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 fa3b677..4e894e1 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 _0x7c68=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','api','bluebird'];(function(_0x4685d1,_0x281970){var _0x2589cd=function(_0x1c6b8d){while(--_0x1c6b8d){_0x4685d1['push'](_0x4685d1['shift']());}};_0x2589cd(++_0x281970);}(_0x7c68,0x140));var _0x87c6=function(_0x142009,_0x302ec6){_0x142009=_0x142009-0x0;var _0x43454b=_0x7c68[_0x142009];return _0x43454b;};'use strict';var _=require(_0x87c6('0x0'));var util=require(_0x87c6('0x1'));var logger=require('../../config/logger')(_0x87c6('0x2'));var moment=require('moment');var BPromise=require(_0x87c6('0x3'));var rp=require(_0x87c6('0x4'));var fs=require('fs');var path=require(_0x87c6('0x5'));var rimraf=require(_0x87c6('0x6'));var config=require(_0x87c6('0x7'));var attributes=require(_0x87c6('0x8'));module[_0x87c6('0x9')]=function(_0x329dc2,_0xea1c6e){return _0x329dc2[_0x87c6('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x87c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe06b=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','moment','bluebird'];(function(_0xa44882,_0x178bac){var _0x3daec4=function(_0x51ed96){while(--_0x51ed96){_0xa44882['push'](_0xa44882['shift']());}};_0x3daec4(++_0x178bac);}(_0xe06b,0xa2));var _0xbe06=function(_0x313fc8,_0x54b06f){_0x313fc8=_0x313fc8-0x0;var _0x443e34=_0xe06b[_0x313fc8];return _0x443e34;};'use strict';var _=require('lodash');var util=require(_0xbe06('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbe06('0x1'));var BPromise=require(_0xbe06('0x2'));var rp=require(_0xbe06('0x3'));var fs=require('fs');var path=require(_0xbe06('0x4'));var rimraf=require('rimraf');var config=require(_0xbe06('0x5'));var attributes=require(_0xbe06('0x6'));module[_0xbe06('0x7')]=function(_0xec245b,_0x35458e){return _0xec245b[_0xbe06('0x8')](_0xbe06('0x9'),attributes,{'tableName':_0xbe06('0xa'),'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 e3cd4d7..c8d9aeb 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 _0x8f2f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x8f2f,0xa0));var _0xf8f2=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x8f2f[_0x456fb1];return _0x4083d6;};'use strict';var _=require('lodash');var util=require(_0xf8f2('0x0'));var moment=require(_0xf8f2('0x1'));var BPromise=require(_0xf8f2('0x2'));var rs=require(_0xf8f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8f2('0x4'))['db'];var utils=require(_0xf8f2('0x5'));var logger=require('../../config/logger')(_0xf8f2('0x6'));var config=require('../../config/environment');var jayson=require(_0xf8f2('0x7'));var client=jayson[_0xf8f2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ce537,_0x3b8467,_0x1def35){return new BPromise(function(_0x30ead6,_0x3a99f1){return client[_0xf8f2('0x9')](_0x5ce537,_0x1def35)['then'](function(_0x185ee3){logger[_0xf8f2('0xa')](_0xf8f2('0xb'),_0x3b8467,_0xf8f2('0xc'));logger['debug'](_0xf8f2('0xd'),_0x3b8467,'request\x20sent',JSON[_0xf8f2('0xe')](_0x185ee3));if(_0x185ee3[_0xf8f2('0xf')]){if(_0x185ee3[_0xf8f2('0xf')][_0xf8f2('0x10')]===0x1f4){logger[_0xf8f2('0xf')](_0xf8f2('0xb'),_0x3b8467,_0x185ee3[_0xf8f2('0xf')][_0xf8f2('0x11')]);return _0x3a99f1(_0x185ee3[_0xf8f2('0xf')][_0xf8f2('0x11')]);}logger['error'](_0xf8f2('0xb'),_0x3b8467,_0x185ee3[_0xf8f2('0xf')]['message']);return _0x30ead6(_0x185ee3[_0xf8f2('0xf')]['message']);}else{logger[_0xf8f2('0xa')](_0xf8f2('0xb'),_0x3b8467,_0xf8f2('0xc'));_0x30ead6(_0x185ee3[_0xf8f2('0x12')][_0xf8f2('0x11')]);}})[_0xf8f2('0x13')](function(_0x41502e){logger[_0xf8f2('0xf')](_0xf8f2('0xb'),_0x3b8467,_0x41502e);_0x3a99f1(_0x41502e);});});} \ No newline at end of file +var _0xa69b=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x29bfb9,_0x2e35c5){var _0x1f5cbd=function(_0x473c33){while(--_0x473c33){_0x29bfb9['push'](_0x29bfb9['shift']());}};_0x1f5cbd(++_0x2e35c5);}(_0xa69b,0x103));var _0xba69=function(_0x550439,_0x20af4a){_0x550439=_0x550439-0x0;var _0x2ddd0a=_0xa69b[_0x550439];return _0x2ddd0a;};'use strict';var _=require(_0xba69('0x0'));var util=require('util');var moment=require(_0xba69('0x1'));var BPromise=require(_0xba69('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xba69('0x4'));var logger=require(_0xba69('0x5'))('rpc');var config=require(_0xba69('0x6'));var jayson=require(_0xba69('0x7'));var client=jayson[_0xba69('0x8')][_0xba69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x770d2c,_0x4307f8,_0x37f0e0){return new BPromise(function(_0x5aeb17,_0x30a209){return client[_0xba69('0xa')](_0x770d2c,_0x37f0e0)[_0xba69('0xb')](function(_0x545cc3){logger[_0xba69('0xc')](_0xba69('0xd'),_0x4307f8,'request\x20sent');logger[_0xba69('0xe')](_0xba69('0xf'),_0x4307f8,_0xba69('0x10'),JSON[_0xba69('0x11')](_0x545cc3));if(_0x545cc3[_0xba69('0x12')]){if(_0x545cc3['error'][_0xba69('0x13')]===0x1f4){logger[_0xba69('0x12')](_0xba69('0xd'),_0x4307f8,_0x545cc3[_0xba69('0x12')][_0xba69('0x14')]);return _0x30a209(_0x545cc3[_0xba69('0x12')][_0xba69('0x14')]);}logger[_0xba69('0x12')](_0xba69('0xd'),_0x4307f8,_0x545cc3[_0xba69('0x12')]['message']);return _0x5aeb17(_0x545cc3[_0xba69('0x12')][_0xba69('0x14')]);}else{logger[_0xba69('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x4307f8,_0xba69('0x10'));_0x5aeb17(_0x545cc3[_0xba69('0x15')][_0xba69('0x14')]);}})[_0xba69('0x16')](function(_0x23afe5){logger[_0xba69('0x12')](_0xba69('0xd'),_0x4307f8,_0x23afe5);_0x30a209(_0x23afe5);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 53f440c..51c576d 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(_0x1cd916,_0x333f5c){var _0x1ff07a=function(_0x340c8e){while(--_0x340c8e){_0x1cd916['push'](_0x1cd916['shift']());}};_0x1ff07a(++_0x333f5c);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3bdad8,_0x46d6a7){var _0x1e8f4e=function(_0x3850df){while(--_0x3850df){_0x3bdad8['push'](_0x3bdad8['shift']());}};_0x1e8f4e(++_0x46d6a7);}(_0xe706,0xa3));var _0x6e70=function(_0x3759fa,_0x4a1baa){_0x3759fa=_0x3759fa-0x0;var _0x4e512e=_0xe706[_0x3759fa];return _0x4e512e;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6e986db..18a965e 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 _0x1561=['queue_interface','sequelize','exports','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x1ab51d,_0x37b6f1){var _0xd7ab2=function(_0x2b207c){while(--_0x2b207c){_0x1ab51d['push'](_0x1ab51d['shift']());}};_0xd7ab2(++_0x37b6f1);}(_0x1561,0x1b7));var _0x1156=function(_0x197f69,_0x328173){_0x197f69=_0x197f69-0x0;var _0x1774f6=_0x1561[_0x197f69];return _0x1774f6;};'use strict';var Sequelize=require(_0x1156('0x0'));module[_0x1156('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x1156('0x2')],'allowNull':![],'comment':_0x1156('0x3')},'UserId':{'type':Sequelize[_0x1156('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1156('0x2')],'allowNull':![],'unique':_0x1156('0x5'),'comment':_0x1156('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1156('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x1156('0x3')},'penalty':{'type':Sequelize[_0x1156('0x4')](0xb),'defaultValue':0x0,'comment':_0x1156('0x3')},'paused':{'type':Sequelize[_0x1156('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xbeb2=['Required\x20by\x20Asterisk','queue_interface','STRING','exports','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbeb2,0x99));var _0x2beb=function(_0x4b26e0,_0x473c50){_0x4b26e0=_0x4b26e0-0x0;var _0x3fa819=_0xbeb2[_0x4b26e0];return _0x3fa819;};'use strict';var Sequelize=require('sequelize');module[_0x2beb('0x0')]={'uniqueid':{'type':Sequelize[_0x2beb('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2beb('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x2beb('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2beb('0x3'),'comment':_0x2beb('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2beb('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x2beb('0x4')],'allowNull':![],'unique':_0x2beb('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x2beb('0x1')](0xb),'defaultValue':0x0,'comment':_0x2beb('0x2')},'paused':{'type':Sequelize[_0x2beb('0x1')](0xb),'defaultValue':0x0,'comment':_0x2beb('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f828f13..6ae41aa 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 _0x07cb=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x3b7ac6,_0x501f60){var _0x45a3f0=function(_0x1dbeff){while(--_0x1dbeff){_0x3b7ac6['push'](_0x3b7ac6['shift']());}};_0x45a3f0(++_0x501f60);}(_0x07cb,0xa5));var _0xb07c=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x07cb[_0x9b3efc];return _0x200f05;};'use strict';var EventEmitter=require(_0xb07c('0x0'));var UserVoiceQueueRt=require(_0xb07c('0x1'))['db'][_0xb07c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb07c('0x3'),'afterUpdate':_0xb07c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5bbe4b){return function(_0x1afd51,_0x76f0,_0x2b6624){UserVoiceQueueRtEvents[_0xb07c('0x5')](_0x5bbe4b+':'+_0x1afd51['id'],_0x1afd51);UserVoiceQueueRtEvents['emit'](_0x5bbe4b,_0x1afd51);_0x2b6624(null);};}for(var e in events){if(events[_0xb07c('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xb07c('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9e05=['hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','emit'];(function(_0x22a741,_0x481f2f){var _0x2e125c=function(_0x12baa1){while(--_0x12baa1){_0x22a741['push'](_0x22a741['shift']());}};_0x2e125c(++_0x481f2f);}(_0x9e05,0x133));var _0x59e0=function(_0x363d9,_0x1e5203){_0x363d9=_0x363d9-0x0;var _0xd49e1d=_0x9e05[_0x363d9];return _0xd49e1d;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x59e0('0x0'))['db'][_0x59e0('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x59e0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x59e0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x49f11c){return function(_0x1ba06e,_0x13160d,_0x49b2a9){UserVoiceQueueRtEvents[_0x59e0('0x4')](_0x49f11c+':'+_0x1ba06e['id'],_0x1ba06e);UserVoiceQueueRtEvents[_0x59e0('0x4')](_0x49f11c,_0x1ba06e);_0x49b2a9(null);};}for(var e in events){if(events[_0x59e0('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x59e0('0x6')](e,emitEvent(event));}}module[_0x59e0('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ee11c89..340f9aa 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 _0x2e3d=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x524ea1,_0x1f1a19){var _0x156638=function(_0x1654d0){while(--_0x1654d0){_0x524ea1['push'](_0x524ea1['shift']());}};_0x156638(++_0x1f1a19);}(_0x2e3d,0x1d9));var _0xd2e3=function(_0x625f28,_0x1ae817){_0x625f28=_0x625f28-0x0;var _0x1acd2c=_0x2e3d[_0x625f28];return _0x1acd2c;};'use strict';var _=require(_0xd2e3('0x0'));var util=require('util');var logger=require(_0xd2e3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd2e3('0x2'));var rp=require(_0xd2e3('0x3'));var fs=require('fs');var path=require(_0xd2e3('0x4'));var rimraf=require(_0xd2e3('0x5'));var config=require(_0xd2e3('0x6'));var attributes=require(_0xd2e3('0x7'));module[_0xd2e3('0x8')]=function(_0x18e6de,_0x178d51){return _0x18e6de['define'](_0xd2e3('0x9'),attributes,{'tableName':_0xd2e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa57f=['bluebird','./userVoiceQueueRt.attributes','exports','lodash','../../config/logger'];(function(_0x2894e6,_0xe59c9d){var _0x22c2cb=function(_0x4b0516){while(--_0x4b0516){_0x2894e6['push'](_0x2894e6['shift']());}};_0x22c2cb(++_0xe59c9d);}(_0xa57f,0xda));var _0xfa57=function(_0x283f7e,_0x44d71b){_0x283f7e=_0x283f7e-0x0;var _0x20b316=_0xa57f[_0x283f7e];return _0x20b316;};'use strict';var _=require(_0xfa57('0x0'));var util=require('util');var logger=require(_0xfa57('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfa57('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(_0xfa57('0x3'));module[_0xfa57('0x4')]=function(_0x2bebb6,_0x4fa8d5){return _0x2bebb6['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 20caf03..038ebd3 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 _0xd14c=['raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options'];(function(_0x2c6197,_0x12da7f){var _0x34d8e4=function(_0x3eb955){while(--_0x3eb955){_0x2c6197['push'](_0x2c6197['shift']());}};_0x34d8e4(++_0x12da7f);}(_0xd14c,0x10a));var _0xcd14=function(_0x3505a9,_0x2cad6b){_0x3505a9=_0x3505a9-0x0;var _0x37decc=_0xd14c[_0x3505a9];return _0x37decc;};'use strict';var _=require('lodash');var util=require(_0xcd14('0x0'));var moment=require(_0xcd14('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd14('0x2'));var fs=require('fs');var Redis=require(_0xcd14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd14('0x4'));var logger=require(_0xcd14('0x5'))(_0xcd14('0x6'));var config=require(_0xcd14('0x7'));var jayson=require(_0xcd14('0x8'));var client=jayson['client'][_0xcd14('0x9')]({'port':0x232a});config['redis']=_[_0xcd14('0xa')](config['redis'],{'host':_0xcd14('0xb'),'port':0x18eb});var socket=require(_0xcd14('0xc'))(new Redis(config[_0xcd14('0xd')]));require(_0xcd14('0xe'))[_0xcd14('0xf')](socket);function respondWithRpcPromise(_0x52d4c8,_0x29ba2a,_0x5d93d9){return new BPromise(function(_0x52f4e4,_0x4755f9){return client[_0xcd14('0x10')](_0x52d4c8,_0x5d93d9)['then'](function(_0x3fb023){logger[_0xcd14('0x11')](_0xcd14('0x12'),_0x29ba2a,_0xcd14('0x13'));logger[_0xcd14('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x29ba2a,_0xcd14('0x13'),JSON[_0xcd14('0x15')](_0x3fb023));if(_0x3fb023['error']){if(_0x3fb023[_0xcd14('0x16')]['code']===0x1f4){logger[_0xcd14('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x29ba2a,_0x3fb023[_0xcd14('0x16')]['message']);return _0x4755f9(_0x3fb023[_0xcd14('0x16')][_0xcd14('0x17')]);}logger[_0xcd14('0x16')](_0xcd14('0x12'),_0x29ba2a,_0x3fb023['error'][_0xcd14('0x17')]);return _0x52f4e4(_0x3fb023[_0xcd14('0x16')][_0xcd14('0x17')]);}else{logger[_0xcd14('0x11')](_0xcd14('0x12'),_0x29ba2a,_0xcd14('0x13'));_0x52f4e4(_0x3fb023[_0xcd14('0x18')][_0xcd14('0x17')]);}})[_0xcd14('0x19')](function(_0x34148a){logger[_0xcd14('0x16')](_0xcd14('0x12'),_0x29ba2a,_0x34148a);_0x4755f9(_0x34148a);});});}exports[_0xcd14('0x1a')]=function(_0x3a13a7){var _0x59380c=this;return new Promise(function(_0x4df2b3,_0x559a03){return db[_0xcd14('0x1b')][_0xcd14('0x1c')]({'raw':_0x3a13a7[_0xcd14('0x1d')]?_0x3a13a7[_0xcd14('0x1d')][_0xcd14('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a13a7[_0xcd14('0x1d')]?_0x3a13a7[_0xcd14('0x1d')]['where']||null:null,'attributes':[[db[_0xcd14('0x1f')]['fn'](_0xcd14('0x20'),db[_0xcd14('0x1f')]['fn']('IF',db[_0xcd14('0x1f')][_0xcd14('0x21')](_0xcd14('0x22')))),_0xcd14('0x23')]]})[_0xcd14('0x24')](function(_0x2fdc21){logger[_0xcd14('0x11')](_0xcd14('0x1a'),_0x3a13a7);logger[_0xcd14('0x14')](_0xcd14('0x1a'),_0x3a13a7,JSON['stringify'](_0x2fdc21));_0x4df2b3(_0x2fdc21);})[_0xcd14('0x19')](function(_0x70eed3){logger[_0xcd14('0x16')](_0xcd14('0x1a'),_0x70eed3[_0xcd14('0x17')],_0x3a13a7);_0x559a03(_0x59380c[_0xcd14('0x16')](0x1f4,_0x70eed3[_0xcd14('0x17')]));});});}; \ No newline at end of file +var _0x42b5=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','lodash','util','moment'];(function(_0x1f280c,_0x3e9e55){var _0x4fe913=function(_0x2b0561){while(--_0x2b0561){_0x1f280c['push'](_0x1f280c['shift']());}};_0x4fe913(++_0x3e9e55);}(_0x42b5,0x1ad));var _0x542b=function(_0x8d996c,_0x434d5c){_0x8d996c=_0x8d996c-0x0;var _0x442e8d=_0x42b5[_0x8d996c];return _0x442e8d;};'use strict';var _=require(_0x542b('0x0'));var util=require(_0x542b('0x1'));var moment=require(_0x542b('0x2'));var BPromise=require(_0x542b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x542b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x542b('0x5'));var logger=require(_0x542b('0x6'))(_0x542b('0x7'));var config=require(_0x542b('0x8'));var jayson=require(_0x542b('0x9'));var client=jayson[_0x542b('0xa')][_0x542b('0xb')]({'port':0x232a});config[_0x542b('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x542b('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x542b('0xe')](socket);function respondWithRpcPromise(_0xff4068,_0x3bbfa5,_0x5e8973){return new BPromise(function(_0x240023,_0x468fb0){return client[_0x542b('0xf')](_0xff4068,_0x5e8973)['then'](function(_0xfc2ca4){logger['info'](_0x542b('0x10'),_0x3bbfa5,_0x542b('0x11'));logger[_0x542b('0x12')](_0x542b('0x13'),_0x3bbfa5,'request\x20sent',JSON['stringify'](_0xfc2ca4));if(_0xfc2ca4[_0x542b('0x14')]){if(_0xfc2ca4['error'][_0x542b('0x15')]===0x1f4){logger[_0x542b('0x14')](_0x542b('0x10'),_0x3bbfa5,_0xfc2ca4[_0x542b('0x14')][_0x542b('0x16')]);return _0x468fb0(_0xfc2ca4['error'][_0x542b('0x16')]);}logger[_0x542b('0x14')](_0x542b('0x10'),_0x3bbfa5,_0xfc2ca4[_0x542b('0x14')][_0x542b('0x16')]);return _0x240023(_0xfc2ca4[_0x542b('0x14')]['message']);}else{logger[_0x542b('0x17')](_0x542b('0x10'),_0x3bbfa5,'request\x20sent');_0x240023(_0xfc2ca4[_0x542b('0x18')][_0x542b('0x16')]);}})[_0x542b('0x19')](function(_0x564cf2){logger[_0x542b('0x14')](_0x542b('0x10'),_0x3bbfa5,_0x564cf2);_0x468fb0(_0x564cf2);});});}exports['GetVoiceQueueRtPauses']=function(_0x440fbe){var _0x42bd5b=this;return new Promise(function(_0x5aea83,_0x1d2d48){return db[_0x542b('0x1a')][_0x542b('0x1b')]({'raw':_0x440fbe[_0x542b('0x1c')]?_0x440fbe[_0x542b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x440fbe[_0x542b('0x1c')]?_0x440fbe[_0x542b('0x1c')]['where']||null:null,'attributes':[[db[_0x542b('0x1d')]['fn'](_0x542b('0x1e'),db[_0x542b('0x1d')]['fn']('IF',db[_0x542b('0x1d')][_0x542b('0x1f')](_0x542b('0x20')))),_0x542b('0x21')]]})[_0x542b('0x22')](function(_0x2d01d9){logger[_0x542b('0x17')](_0x542b('0x23'),_0x440fbe);logger[_0x542b('0x12')](_0x542b('0x23'),_0x440fbe,JSON['stringify'](_0x2d01d9));_0x5aea83(_0x2d01d9);})['catch'](function(_0x4a63a0){logger[_0x542b('0x14')](_0x542b('0x23'),_0x4a63a0[_0x542b('0x16')],_0x440fbe);_0x1d2d48(_0x42bd5b['error'](0x1f4,_0x4a63a0[_0x542b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1ba5816..ec8fb88 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 _0xf767=['remove','update','emit','removeListener','length','userVoiceQueueRt:','save'];(function(_0x1022f8,_0x5e1757){var _0x5fbcc=function(_0x2e4a0b){while(--_0x2e4a0b){_0x1022f8['push'](_0x1022f8['shift']());}};_0x5fbcc(++_0x5e1757);}(_0xf767,0x76));var _0x7f76=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0xf767[_0x673722];return _0x21249c;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x7f76('0x0'),_0x7f76('0x1'),_0x7f76('0x2')];function createListener(_0x23f0c3,_0x90398d){return function(_0x5d215a){_0x90398d[_0x7f76('0x3')](_0x23f0c3,_0x5d215a);};}function removeListener(_0x2aa5e1,_0x40ba50){return function(){UserVoiceQueueRtEvents[_0x7f76('0x4')](_0x2aa5e1,_0x40ba50);};}exports['register']=function(_0x23c243){for(var _0x2f2588=0x0,_0x45ddcc=events[_0x7f76('0x5')];_0x2f2588<_0x45ddcc;_0x2f2588++){var _0x1fc46c=events[_0x2f2588];var _0x5acfee=createListener(_0x7f76('0x6')+_0x1fc46c,_0x23c243);UserVoiceQueueRtEvents['on'](_0x1fc46c,_0x5acfee);}}; \ No newline at end of file +var _0x9432=['./userVoiceQueueRt.events','save','update','removeListener','register','length','userVoiceQueueRt:'];(function(_0x19c274,_0x3cbbbf){var _0x410aa3=function(_0x23f69a){while(--_0x23f69a){_0x19c274['push'](_0x19c274['shift']());}};_0x410aa3(++_0x3cbbbf);}(_0x9432,0x1e3));var _0x2943=function(_0x3b57f9,_0x4b917a){_0x3b57f9=_0x3b57f9-0x0;var _0x1e5c1b=_0x9432[_0x3b57f9];return _0x1e5c1b;};'use strict';var UserVoiceQueueRtEvents=require(_0x2943('0x0'));var events=[_0x2943('0x1'),'remove',_0x2943('0x2')];function createListener(_0x40551b,_0x4af175){return function(_0x3515dd){_0x4af175['emit'](_0x40551b,_0x3515dd);};}function removeListener(_0x4b25e8,_0xb254a5){return function(){UserVoiceQueueRtEvents[_0x2943('0x3')](_0x4b25e8,_0xb254a5);};}exports[_0x2943('0x4')]=function(_0x27641b){for(var _0x191c65=0x0,_0x56f65f=events[_0x2943('0x5')];_0x191c65<_0x56f65f;_0x191c65++){var _0x111824=events[_0x191c65];var _0x6e3b61=createListener(_0x2943('0x6')+_0x111824,_0x27641b);UserVoiceQueueRtEvents['on'](_0x111824,_0x6e3b61);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 351bb30..ebe85ea 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x483a54,_0x5b8a36){var _0x447299=function(_0x2e4579){while(--_0x2e4579){_0x483a54['push'](_0x483a54['shift']());}};_0x447299(++_0x5b8a36);}(_0x70e0,0x17b));var _0x070e=function(_0x21a20f,_0x13f96c){_0x21a20f=_0x21a20f-0x0;var _0x1795cb=_0x70e0[_0x21a20f];return _0x1795cb;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b785273..ec7661e 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2894=['sequelize','exports'];(function(_0x5623cb,_0x20b099){var _0x368ce6=function(_0x3439ad){while(--_0x3439ad){_0x5623cb['push'](_0x5623cb['shift']());}};_0x368ce6(++_0x20b099);}(_0x2894,0xb2));var _0x4289=function(_0x503d2d,_0xc0ed26){_0x503d2d=_0x503d2d-0x0;var _0x5a533b=_0x2894[_0x503d2d];return _0x5a533b;};'use strict';var Sequelize=require(_0x4289('0x0'));module[_0x4289('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6af6=['INTEGER','sequelize'];(function(_0x57f198,_0x1c0aec){var _0x47789d=function(_0x142969){while(--_0x142969){_0x57f198['push'](_0x57f198['shift']());}};_0x47789d(++_0x1c0aec);}(_0x6af6,0x1bb));var _0x66af=function(_0x10f34a,_0x12cc10){_0x10f34a=_0x10f34a-0x0;var _0x24d7c5=_0x6af6[_0x10f34a];return _0x24d7c5;};'use strict';var Sequelize=require(_0x66af('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x66af('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 3da484e..153a2a2 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 _0xdec0=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','./userWhatsappQueue.attributes'];(function(_0x9d9a4,_0x4b0634){var _0x16e69f=function(_0x3a0ac4){while(--_0x3a0ac4){_0x9d9a4['push'](_0x9d9a4['shift']());}};_0x16e69f(++_0x4b0634);}(_0xdec0,0xf4));var _0x0dec=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xdec0[_0x4a6cf8];return _0x22205e;};'use strict';var _=require(_0x0dec('0x0'));var util=require('util');var logger=require(_0x0dec('0x1'))('api');var moment=require(_0x0dec('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0dec('0x3'));module[_0x0dec('0x4')]=function(_0x4aa8ab,_0x2fb823){return _0x4aa8ab[_0x0dec('0x5')](_0x0dec('0x6'),attributes,{'tableName':_0x0dec('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1d8=['exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xc1d8,0xc3));var _0x8c1d=function(_0x5ed5eb,_0x4c956c){_0x5ed5eb=_0x5ed5eb-0x0;var _0x54dc69=_0xc1d8[_0x5ed5eb];return _0x54dc69;};'use strict';var _=require(_0x8c1d('0x0'));var util=require(_0x8c1d('0x1'));var logger=require(_0x8c1d('0x2'))(_0x8c1d('0x3'));var moment=require(_0x8c1d('0x4'));var BPromise=require(_0x8c1d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c1d('0x6'));var rimraf=require(_0x8c1d('0x7'));var config=require(_0x8c1d('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0x8c1d('0x9')]=function(_0x43dc94,_0x2bba3e){return _0x43dc94[_0x8c1d('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x8c1d('0xb'),'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 91f5071..97210db 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 _0x188a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x188a,0x120));var _0xa188=function(_0x489233,_0x50ecc1){_0x489233=_0x489233-0x0;var _0x2578a0=_0x188a[_0x489233];return _0x2578a0;};'use strict';var _=require('lodash');var util=require(_0xa188('0x0'));var moment=require(_0xa188('0x1'));var BPromise=require(_0xa188('0x2'));var rs=require(_0xa188('0x3'));var fs=require('fs');var Redis=require(_0xa188('0x4'));var db=require(_0xa188('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa188('0x6'))('rpc');var config=require(_0xa188('0x7'));var jayson=require(_0xa188('0x8'));var client=jayson[_0xa188('0x9')][_0xa188('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x232e90,_0x208432,_0x15e717){return new BPromise(function(_0x27d6b1,_0xed1428){return client[_0xa188('0xb')](_0x232e90,_0x15e717)[_0xa188('0xc')](function(_0x3e70e1){logger[_0xa188('0xd')](_0xa188('0xe'),_0x208432,_0xa188('0xf'));logger[_0xa188('0x10')](_0xa188('0x11'),_0x208432,_0xa188('0xf'),JSON[_0xa188('0x12')](_0x3e70e1));if(_0x3e70e1['error']){if(_0x3e70e1[_0xa188('0x13')][_0xa188('0x14')]===0x1f4){logger[_0xa188('0x13')](_0xa188('0xe'),_0x208432,_0x3e70e1[_0xa188('0x13')][_0xa188('0x15')]);return _0xed1428(_0x3e70e1[_0xa188('0x13')][_0xa188('0x15')]);}logger[_0xa188('0x13')](_0xa188('0xe'),_0x208432,_0x3e70e1['error']['message']);return _0x27d6b1(_0x3e70e1['error']['message']);}else{logger[_0xa188('0xd')](_0xa188('0xe'),_0x208432,_0xa188('0xf'));_0x27d6b1(_0x3e70e1[_0xa188('0x16')][_0xa188('0x15')]);}})[_0xa188('0x17')](function(_0x494d1a){logger[_0xa188('0x13')](_0xa188('0xe'),_0x208432,_0x494d1a);_0xed1428(_0x494d1a);});});} \ No newline at end of file +var _0x21ae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x34dff7,_0xde441b){var _0x5a27ee=function(_0xd5b07a){while(--_0xd5b07a){_0x34dff7['push'](_0x34dff7['shift']());}};_0x5a27ee(++_0xde441b);}(_0x21ae,0xd9));var _0xe21a=function(_0x2ac628,_0x40ad59){_0x2ac628=_0x2ac628-0x0;var _0x54a58c=_0x21ae[_0x2ac628];return _0x54a58c;};'use strict';var _=require('lodash');var util=require(_0xe21a('0x0'));var moment=require(_0xe21a('0x1'));var BPromise=require(_0xe21a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe21a('0x3'));var db=require(_0xe21a('0x4'))['db'];var utils=require(_0xe21a('0x5'));var logger=require(_0xe21a('0x6'))(_0xe21a('0x7'));var config=require(_0xe21a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe21a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36633e,_0x5f0073,_0x19253e){return new BPromise(function(_0x1c6ffb,_0x2932ac){return client[_0xe21a('0xa')](_0x36633e,_0x19253e)[_0xe21a('0xb')](function(_0xe903db){logger['info'](_0xe21a('0xc'),_0x5f0073,_0xe21a('0xd'));logger['debug'](_0xe21a('0xe'),_0x5f0073,_0xe21a('0xd'),JSON[_0xe21a('0xf')](_0xe903db));if(_0xe903db['error']){if(_0xe903db[_0xe21a('0x10')][_0xe21a('0x11')]===0x1f4){logger[_0xe21a('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5f0073,_0xe903db[_0xe21a('0x10')]['message']);return _0x2932ac(_0xe903db['error'][_0xe21a('0x12')]);}logger[_0xe21a('0x10')](_0xe21a('0xc'),_0x5f0073,_0xe903db['error']['message']);return _0x1c6ffb(_0xe903db[_0xe21a('0x10')][_0xe21a('0x12')]);}else{logger[_0xe21a('0x13')](_0xe21a('0xc'),_0x5f0073,_0xe21a('0xd'));_0x1c6ffb(_0xe903db[_0xe21a('0x14')][_0xe21a('0x12')]);}})[_0xe21a('0x15')](function(_0x553fd6){logger[_0xe21a('0x10')](_0xe21a('0xc'),_0x5f0073,_0x553fd6);_0x2932ac(_0x553fd6);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c29098c..e60b7b0 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 _0x9cff=['index','/:id','show','post','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x1f1876,_0x53c2f8){_0x1f1876=_0x1f1876-0x0;var _0xf5ba8c=_0x9cff[_0x1f1876];return _0xf5ba8c;};'use strict';var multer=require('multer');var util=require(_0xf9cf('0x0'));var path=require(_0xf9cf('0x1'));var timeout=require(_0xf9cf('0x2'));var express=require('express');var router=express[_0xf9cf('0x3')]();var fs_extra=require(_0xf9cf('0x4'));var auth=require(_0xf9cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9cf('0x6'));var controller=require(_0xf9cf('0x7'));router[_0xf9cf('0x8')]('/',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xa')]);router[_0xf9cf('0x8')](_0xf9cf('0xb'),auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xc')]);router[_0xf9cf('0xd')]('/',auth[_0xf9cf('0x9')](),controller['create']);router[_0xf9cf('0xe')](_0xf9cf('0xb'),auth['isAuthenticated'](),controller[_0xf9cf('0xf')]);router['delete']('/:id',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdad2=['isAuthenticated','index','show','post','create','put','/:id','update','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x3041ad,_0x514fa7){var _0x29ef2d=function(_0x5ed911){while(--_0x5ed911){_0x3041ad['push'](_0x3041ad['shift']());}};_0x29ef2d(++_0x514fa7);}(_0xdad2,0x14c));var _0x2dad=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdad2[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0x2dad('0x0'));var path=require(_0x2dad('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dad('0x2'));var router=express[_0x2dad('0x3')]();var fs_extra=require(_0x2dad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var controller=require('./variable.controller');router[_0x2dad('0x7')]('/',auth[_0x2dad('0x8')](),controller[_0x2dad('0x9')]);router[_0x2dad('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2dad('0xa')]);router[_0x2dad('0xb')]('/',auth[_0x2dad('0x8')](),controller[_0x2dad('0xc')]);router[_0x2dad('0xd')](_0x2dad('0xe'),auth['isAuthenticated'](),controller[_0x2dad('0xf')]);router['delete'](_0x2dad('0xe'),auth[_0x2dad('0x8')](),controller['destroy']);module[_0x2dad('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2505919..54b1c49 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 _0x7985=['exports','STRING','name','sequelize'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x7985,0x15f));var _0x5798=function(_0xba9f86,_0x1e988b){_0xba9f86=_0xba9f86-0x0;var _0x2a25ce=_0x7985[_0xba9f86];return _0x2a25ce;};'use strict';var Sequelize=require(_0x5798('0x0'));module[_0x5798('0x1')]={'name':{'type':Sequelize[_0x5798('0x2')],'unique':_0x5798('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5798('0x2')]}}; \ No newline at end of file +var _0xd73d=['STRING','sequelize','exports'];(function(_0x270709,_0x2cf1ed){var _0x1d277b=function(_0x43ef52){while(--_0x43ef52){_0x270709['push'](_0x270709['shift']());}};_0x1d277b(++_0x2cf1ed);}(_0xd73d,0x1a5));var _0xdd73=function(_0xbd3556,_0xe38bfa){_0xbd3556=_0xbd3556-0x0;var _0x4a2e2d=_0xd73d[_0xbd3556];return _0x4a2e2d;};'use strict';var Sequelize=require(_0xdd73('0x0'));module[_0xdd73('0x1')]={'name':{'type':Sequelize[_0xdd73('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdd73('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index e1a68ec..64bb1af 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 _0x6755=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','Variables','destroy','sendStatus','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x53c88f,_0x4a2d95){var _0x2576eb=function(_0x309005){while(--_0x309005){_0x53c88f['push'](_0x53c88f['shift']());}};_0x2576eb(++_0x4a2d95);}(_0x6755,0x19f));var _0x5675=function(_0x13a318,_0x5af23b){_0x13a318=_0x13a318-0x0;var _0x5dea0c=_0x6755[_0x13a318];return _0x5dea0c;};'use strict';var emlformat=require(_0x5675('0x0'));var rimraf=require(_0x5675('0x1'));var zipdir=require(_0x5675('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5675('0x3'));var moment=require(_0x5675('0x4'));var BPromise=require(_0x5675('0x5'));var Mustache=require(_0x5675('0x6'));var util=require(_0x5675('0x7'));var path=require('path');var sox=require(_0x5675('0x8'));var csv=require(_0x5675('0x9'));var ejs=require(_0x5675('0xa'));var fs=require('fs');var fs_extra=require(_0x5675('0xb'));var _=require(_0x5675('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5675('0xd'));var deskjs=require(_0x5675('0xe'));var toCsv=require(_0x5675('0x9'));var querystring=require(_0x5675('0xf'));var Papa=require('papaparse');var Redis=require(_0x5675('0x10'));var authService=require(_0x5675('0x11'));var qs=require(_0x5675('0x12'));var as=require(_0x5675('0x13'));var hardwareService=require(_0x5675('0x14'));var logger=require('../../config/logger')(_0x5675('0x15'));var utils=require(_0x5675('0x16'));var config=require(_0x5675('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5675('0x18'))['db'];function respondWithStatusCode(_0x5aa645,_0x5ddd52){_0x5ddd52=_0x5ddd52||0xcc;return function(_0x5aad1f){if(_0x5aad1f){return _0x5aa645['sendStatus'](_0x5ddd52);}return _0x5aa645[_0x5675('0x19')](_0x5ddd52)[_0x5675('0x1a')]();};}function respondWithResult(_0x3dc33e,_0x29da0c){_0x29da0c=_0x29da0c||0xc8;return function(_0x145df3){if(_0x145df3){return _0x3dc33e['status'](_0x29da0c)['json'](_0x145df3);}};}function respondWithFilteredResult(_0x51f660,_0x22760f){return function(_0x5d82d9){if(_0x5d82d9){var _0x571fec=typeof _0x22760f['offset']===_0x5675('0x1b')&&typeof _0x22760f[_0x5675('0x1c')]===_0x5675('0x1b');var _0x1f8ed2=_0x5d82d9[_0x5675('0x1d')];var _0x370522=_0x571fec?0x0:_0x22760f[_0x5675('0x1e')];var _0x4c3cf7=_0x571fec?_0x5d82d9[_0x5675('0x1d')]:_0x22760f[_0x5675('0x1e')]+_0x22760f[_0x5675('0x1c')];var _0x4d6bc4;if(_0x4c3cf7>=_0x1f8ed2){_0x4c3cf7=_0x1f8ed2;_0x4d6bc4=0xc8;}else{_0x4d6bc4=0xce;}_0x51f660[_0x5675('0x19')](_0x4d6bc4);return _0x51f660[_0x5675('0x1f')](_0x5675('0x20'),_0x370522+'-'+_0x4c3cf7+'/'+_0x1f8ed2)['json'](_0x5d82d9);}return null;};}function patchUpdates(_0x38cb5b){return function(_0x333495){try{jsonpatch[_0x5675('0x21')](_0x333495,_0x38cb5b,!![]);}catch(_0x3ed3b9){return BPromise['reject'](_0x3ed3b9);}return _0x333495[_0x5675('0x22')]();};}function saveUpdates(_0x4d1877,_0x328e94){return function(_0x401bb9){if(_0x401bb9){return _0x401bb9[_0x5675('0x23')](_0x4d1877)['then'](function(_0x4329cf){return _0x4329cf;});}return null;};}function removeEntity(_0x3b920b,_0x31f18d){return function(_0x5bf180){if(_0x5bf180){return _0x5bf180['destroy']()[_0x5675('0x24')](function(){var _0x5231cb=_0x5bf180[_0x5675('0x25')]({'plain':!![]});var _0x54bdb0=_0x5675('0x26');return db['UserProfileResource'][_0x5675('0x27')]({'where':{'type':_0x54bdb0,'resourceId':_0x5231cb['id']}})[_0x5675('0x24')](function(){return _0x5bf180;});})[_0x5675('0x24')](function(){_0x3b920b[_0x5675('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x112583,_0x5995e3){return function(_0x209e6){if(!_0x209e6){_0x112583[_0x5675('0x28')](0x194);}return _0x209e6;};}function handleError(_0x592878,_0x360bbf){_0x360bbf=_0x360bbf||0x1f4;return function(_0x137e23){logger[_0x5675('0x29')](_0x137e23[_0x5675('0x2a')]);if(_0x137e23[_0x5675('0x2b')]){delete _0x137e23['name'];}_0x592878[_0x5675('0x19')](_0x360bbf)[_0x5675('0x2c')](_0x137e23);};}exports[_0x5675('0x2d')]=function(_0x5d6db5,_0x241b5a){var _0x920284={},_0x2a956e={},_0x24006f={'count':0x0,'rows':[]};var _0x1951c0=_['map'](db[_0x5675('0x2e')][_0x5675('0x2f')],function(_0x5237da){return{'name':_0x5237da[_0x5675('0x30')],'type':_0x5237da[_0x5675('0x31')][_0x5675('0x32')]};});_0x2a956e['model']=_[_0x5675('0x33')](_0x1951c0,_0x5675('0x2b'));_0x2a956e[_0x5675('0x34')]=_[_0x5675('0x35')](_0x5d6db5[_0x5675('0x34')]);_0x2a956e['filters']=_[_0x5675('0x36')](_0x2a956e['model'],_0x2a956e[_0x5675('0x34')]);_0x920284[_0x5675('0x37')]=_[_0x5675('0x36')](_0x2a956e[_0x5675('0x38')],qs[_0x5675('0x39')](_0x5d6db5['query']['fields']));_0x920284[_0x5675('0x37')]=_0x920284[_0x5675('0x37')][_0x5675('0x3a')]?_0x920284['attributes']:_0x2a956e[_0x5675('0x38')];if(!_0x5d6db5[_0x5675('0x34')]['hasOwnProperty'](_0x5675('0x3b'))){_0x920284[_0x5675('0x1c')]=qs[_0x5675('0x1c')](_0x5d6db5[_0x5675('0x34')][_0x5675('0x1c')]);_0x920284['offset']=qs[_0x5675('0x1e')](_0x5d6db5[_0x5675('0x34')][_0x5675('0x1e')]);}_0x920284[_0x5675('0x3c')]=qs['sort'](_0x5d6db5[_0x5675('0x34')][_0x5675('0x3d')]);_0x920284[_0x5675('0x3e')]=qs[_0x5675('0x3f')](_['pick'](_0x5d6db5[_0x5675('0x34')],_0x2a956e['filters']),_0x1951c0);if(_0x5d6db5[_0x5675('0x34')][_0x5675('0x40')]){_0x920284[_0x5675('0x3e')]=_['merge'](_0x920284['where'],{'$or':_[_0x5675('0x33')](_0x1951c0,function(_0x53e424){if(_0x53e424[_0x5675('0x31')]!==_0x5675('0x41')){var _0x37d309={};_0x37d309[_0x53e424['name']]={'$like':'%'+_0x5d6db5[_0x5675('0x34')][_0x5675('0x40')]+'%'};return _0x37d309;}})});}_0x920284=_[_0x5675('0x42')]({},_0x920284,_0x5d6db5[_0x5675('0x43')]);var _0x1e132b={'where':_0x920284['where']};return db[_0x5675('0x2e')][_0x5675('0x1d')](_0x1e132b)[_0x5675('0x24')](function(_0x4cee57){_0x24006f[_0x5675('0x1d')]=_0x4cee57;if(_0x5d6db5['query'][_0x5675('0x44')]){_0x920284[_0x5675('0x45')]=[{'all':!![]}];}return db[_0x5675('0x2e')][_0x5675('0x46')](_0x920284);})['then'](function(_0x384828){_0x24006f[_0x5675('0x47')]=_0x384828;return _0x24006f;})[_0x5675('0x24')](respondWithFilteredResult(_0x241b5a,_0x920284))[_0x5675('0x48')](handleError(_0x241b5a,null));};exports[_0x5675('0x49')]=function(_0x24c31a,_0x32e22e){var _0x423b60={'raw':!![],'where':{'id':_0x24c31a[_0x5675('0x4a')]['id']}},_0x111dad={};_0x111dad['model']=_[_0x5675('0x35')](db['Variable'][_0x5675('0x2f')]);_0x111dad[_0x5675('0x34')]=_[_0x5675('0x35')](_0x24c31a['query']);_0x111dad[_0x5675('0x3f')]=_[_0x5675('0x36')](_0x111dad['model'],_0x111dad[_0x5675('0x34')]);_0x423b60['attributes']=_[_0x5675('0x36')](_0x111dad[_0x5675('0x38')],qs[_0x5675('0x39')](_0x24c31a[_0x5675('0x34')]['fields']));_0x423b60[_0x5675('0x37')]=_0x423b60['attributes'][_0x5675('0x3a')]?_0x423b60['attributes']:_0x111dad['model'];if(_0x24c31a[_0x5675('0x34')][_0x5675('0x44')]){_0x423b60['include']=[{'all':!![]}];}_0x423b60=_['merge']({},_0x423b60,_0x24c31a[_0x5675('0x43')]);return db[_0x5675('0x2e')][_0x5675('0x4b')](_0x423b60)[_0x5675('0x24')](handleEntityNotFound(_0x32e22e,null))[_0x5675('0x24')](respondWithResult(_0x32e22e,null))[_0x5675('0x48')](handleError(_0x32e22e,null));};exports['create']=function(_0x38b700,_0x523e4e){return db[_0x5675('0x2e')]['create'](_0x38b700[_0x5675('0x4c')],{})[_0x5675('0x24')](function(_0x55feea){var _0xf71f40=_0x38b700[_0x5675('0x4d')][_0x5675('0x25')]({'plain':!![]});if(!_0xf71f40)throw new Error(_0x5675('0x4e'));if(_0xf71f40['role']===_0x5675('0x4d')){var _0x1def98=_0x55feea[_0x5675('0x25')]({'plain':!![]});var _0x77413c=_0x5675('0x26');return db[_0x5675('0x4f')][_0x5675('0x4b')]({'where':{'name':_0x77413c,'userProfileId':_0xf71f40[_0x5675('0x50')]},'raw':!![]})[_0x5675('0x24')](function(_0x5061fb){if(_0x5061fb&&_0x5061fb[_0x5675('0x51')]===0x0){return db[_0x5675('0x52')]['create']({'name':_0x1def98['name'],'resourceId':_0x1def98['id'],'type':_0x5061fb[_0x5675('0x2b')],'sectionId':_0x5061fb['id']},{})['then'](function(){return _0x55feea;});}else{return _0x55feea;}})[_0x5675('0x48')](function(_0x2ca969){logger[_0x5675('0x29')](_0x5675('0x53'),_0x2ca969);throw _0x2ca969;});}return _0x55feea;})[_0x5675('0x24')](respondWithResult(_0x523e4e,0xc9))[_0x5675('0x48')](handleError(_0x523e4e,null));};exports[_0x5675('0x23')]=function(_0x30c493,_0x349d1e){if(_0x30c493[_0x5675('0x4c')]['id']){delete _0x30c493['body']['id'];}return db['Variable']['find']({'where':{'id':_0x30c493[_0x5675('0x4a')]['id']}})[_0x5675('0x24')](handleEntityNotFound(_0x349d1e,null))[_0x5675('0x24')](saveUpdates(_0x30c493[_0x5675('0x4c')],null))[_0x5675('0x24')](respondWithResult(_0x349d1e,null))['catch'](handleError(_0x349d1e,null));};exports[_0x5675('0x27')]=function(_0x4aa60e,_0x2fc9b8){return db['Variable'][_0x5675('0x4b')]({'where':{'id':_0x4aa60e[_0x5675('0x4a')]['id']}})[_0x5675('0x24')](handleEntityNotFound(_0x2fc9b8,null))['then'](removeEntity(_0x2fc9b8,null))['catch'](handleError(_0x2fc9b8,null));}; \ No newline at end of file +var _0x437d=['rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','name','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','Variable','includeAll','include','findAll','rows','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x437d,0x13b));var _0xd437=function(_0x4bf0af,_0x5ce5e3){_0x4bf0af=_0x4bf0af-0x0;var _0x3521a6=_0x437d[_0x4bf0af];return _0x3521a6;};'use strict';var emlformat=require(_0xd437('0x0'));var rimraf=require(_0xd437('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd437('0x2'));var moment=require(_0xd437('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd437('0x4'));var path=require(_0xd437('0x5'));var sox=require(_0xd437('0x6'));var csv=require(_0xd437('0x7'));var ejs=require(_0xd437('0x8'));var fs=require('fs');var fs_extra=require(_0xd437('0x9'));var _=require(_0xd437('0xa'));var squel=require(_0xd437('0xb'));var crypto=require(_0xd437('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd437('0xd'));var Papa=require(_0xd437('0xe'));var Redis=require(_0xd437('0xf'));var authService=require(_0xd437('0x10'));var qs=require(_0xd437('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd437('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd437('0x13'));var config=require(_0xd437('0x14'));var licenseUtil=require(_0xd437('0x15'));var db=require(_0xd437('0x16'))['db'];function respondWithStatusCode(_0x10fa69,_0x4a7781){_0x4a7781=_0x4a7781||0xcc;return function(_0x15dbfe){if(_0x15dbfe){return _0x10fa69[_0xd437('0x17')](_0x4a7781);}return _0x10fa69[_0xd437('0x18')](_0x4a7781)['end']();};}function respondWithResult(_0x55e24c,_0x12860d){_0x12860d=_0x12860d||0xc8;return function(_0x57e016){if(_0x57e016){return _0x55e24c[_0xd437('0x18')](_0x12860d)[_0xd437('0x19')](_0x57e016);}};}function respondWithFilteredResult(_0x270558,_0xeff7fc){return function(_0x48b6ce){if(_0x48b6ce){var _0xae9f6a=typeof _0xeff7fc['offset']===_0xd437('0x1a')&&typeof _0xeff7fc[_0xd437('0x1b')]===_0xd437('0x1a');var _0x3ee52c=_0x48b6ce['count'];var _0x1560d7=_0xae9f6a?0x0:_0xeff7fc[_0xd437('0x1c')];var _0x2ae0cb=_0xae9f6a?_0x48b6ce[_0xd437('0x1d')]:_0xeff7fc[_0xd437('0x1c')]+_0xeff7fc[_0xd437('0x1b')];var _0xce90b2;if(_0x2ae0cb>=_0x3ee52c){_0x2ae0cb=_0x3ee52c;_0xce90b2=0xc8;}else{_0xce90b2=0xce;}_0x270558[_0xd437('0x18')](_0xce90b2);return _0x270558[_0xd437('0x1e')](_0xd437('0x1f'),_0x1560d7+'-'+_0x2ae0cb+'/'+_0x3ee52c)[_0xd437('0x19')](_0x48b6ce);}return null;};}function patchUpdates(_0x46db11){return function(_0x2c5881){try{jsonpatch[_0xd437('0x20')](_0x2c5881,_0x46db11,!![]);}catch(_0x260ea7){return BPromise['reject'](_0x260ea7);}return _0x2c5881[_0xd437('0x21')]();};}function saveUpdates(_0x1e4ddb,_0x201ef9){return function(_0xe1e260){if(_0xe1e260){return _0xe1e260[_0xd437('0x22')](_0x1e4ddb)[_0xd437('0x23')](function(_0x301a2e){return _0x301a2e;});}return null;};}function removeEntity(_0x1ea00c,_0x41b780){return function(_0x2d5a75){if(_0x2d5a75){return _0x2d5a75[_0xd437('0x24')]()[_0xd437('0x23')](function(){var _0xde3ed3=_0x2d5a75[_0xd437('0x25')]({'plain':!![]});var _0x3c05b9=_0xd437('0x26');return db[_0xd437('0x27')][_0xd437('0x24')]({'where':{'type':_0x3c05b9,'resourceId':_0xde3ed3['id']}})[_0xd437('0x23')](function(){return _0x2d5a75;});})[_0xd437('0x23')](function(){_0x1ea00c[_0xd437('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x533a4d,_0x4dceb6){return function(_0x4a5032){if(!_0x4a5032){_0x533a4d['sendStatus'](0x194);}return _0x4a5032;};}function handleError(_0x3707a5,_0x404f7d){_0x404f7d=_0x404f7d||0x1f4;return function(_0x3a2622){logger[_0xd437('0x28')](_0x3a2622['stack']);if(_0x3a2622['name']){delete _0x3a2622[_0xd437('0x29')];}_0x3707a5[_0xd437('0x18')](_0x404f7d)['send'](_0x3a2622);};}exports['index']=function(_0x528c45,_0x542c9c){var _0x287f83={},_0x3710c0={},_0x1e537e={'count':0x0,'rows':[]};var _0x2701a4=_[_0xd437('0x2a')](db['Variable'][_0xd437('0x2b')],function(_0x1186d2){return{'name':_0x1186d2['fieldName'],'type':_0x1186d2['type'][_0xd437('0x2c')]};});_0x3710c0[_0xd437('0x2d')]=_[_0xd437('0x2a')](_0x2701a4,_0xd437('0x29'));_0x3710c0[_0xd437('0x2e')]=_['keys'](_0x528c45[_0xd437('0x2e')]);_0x3710c0[_0xd437('0x2f')]=_[_0xd437('0x30')](_0x3710c0[_0xd437('0x2d')],_0x3710c0[_0xd437('0x2e')]);_0x287f83[_0xd437('0x31')]=_[_0xd437('0x30')](_0x3710c0[_0xd437('0x2d')],qs[_0xd437('0x32')](_0x528c45['query'][_0xd437('0x32')]));_0x287f83[_0xd437('0x31')]=_0x287f83[_0xd437('0x31')][_0xd437('0x33')]?_0x287f83[_0xd437('0x31')]:_0x3710c0[_0xd437('0x2d')];if(!_0x528c45[_0xd437('0x2e')][_0xd437('0x34')]('nolimit')){_0x287f83['limit']=qs[_0xd437('0x1b')](_0x528c45[_0xd437('0x2e')][_0xd437('0x1b')]);_0x287f83[_0xd437('0x1c')]=qs[_0xd437('0x1c')](_0x528c45[_0xd437('0x2e')][_0xd437('0x1c')]);}_0x287f83[_0xd437('0x35')]=qs[_0xd437('0x36')](_0x528c45[_0xd437('0x2e')][_0xd437('0x36')]);_0x287f83[_0xd437('0x37')]=qs[_0xd437('0x2f')](_['pick'](_0x528c45['query'],_0x3710c0[_0xd437('0x2f')]),_0x2701a4);if(_0x528c45['query'][_0xd437('0x38')]){_0x287f83[_0xd437('0x37')]=_[_0xd437('0x39')](_0x287f83[_0xd437('0x37')],{'$or':_['map'](_0x2701a4,function(_0x51f941){if(_0x51f941[_0xd437('0x3a')]!==_0xd437('0x3b')){var _0x49c091={};_0x49c091[_0x51f941[_0xd437('0x29')]]={'$like':'%'+_0x528c45['query'][_0xd437('0x38')]+'%'};return _0x49c091;}})});}_0x287f83=_[_0xd437('0x39')]({},_0x287f83,_0x528c45[_0xd437('0x3c')]);var _0xbb9f45={'where':_0x287f83[_0xd437('0x37')]};return db[_0xd437('0x3d')][_0xd437('0x1d')](_0xbb9f45)[_0xd437('0x23')](function(_0x513c87){_0x1e537e[_0xd437('0x1d')]=_0x513c87;if(_0x528c45[_0xd437('0x2e')][_0xd437('0x3e')]){_0x287f83[_0xd437('0x3f')]=[{'all':!![]}];}return db[_0xd437('0x3d')][_0xd437('0x40')](_0x287f83);})['then'](function(_0x27b12e){_0x1e537e[_0xd437('0x41')]=_0x27b12e;return _0x1e537e;})[_0xd437('0x23')](respondWithFilteredResult(_0x542c9c,_0x287f83))['catch'](handleError(_0x542c9c,null));};exports['show']=function(_0x43ab16,_0xd550c7){var _0x1779be={'raw':!![],'where':{'id':_0x43ab16[_0xd437('0x42')]['id']}},_0x1a170b={};_0x1a170b['model']=_[_0xd437('0x43')](db[_0xd437('0x3d')][_0xd437('0x2b')]);_0x1a170b[_0xd437('0x2e')]=_['keys'](_0x43ab16['query']);_0x1a170b[_0xd437('0x2f')]=_[_0xd437('0x30')](_0x1a170b[_0xd437('0x2d')],_0x1a170b[_0xd437('0x2e')]);_0x1779be[_0xd437('0x31')]=_['intersection'](_0x1a170b[_0xd437('0x2d')],qs[_0xd437('0x32')](_0x43ab16[_0xd437('0x2e')][_0xd437('0x32')]));_0x1779be[_0xd437('0x31')]=_0x1779be[_0xd437('0x31')][_0xd437('0x33')]?_0x1779be[_0xd437('0x31')]:_0x1a170b[_0xd437('0x2d')];if(_0x43ab16[_0xd437('0x2e')]['includeAll']){_0x1779be[_0xd437('0x3f')]=[{'all':!![]}];}_0x1779be=_['merge']({},_0x1779be,_0x43ab16[_0xd437('0x3c')]);return db[_0xd437('0x3d')]['find'](_0x1779be)[_0xd437('0x23')](handleEntityNotFound(_0xd550c7,null))[_0xd437('0x23')](respondWithResult(_0xd550c7,null))[_0xd437('0x44')](handleError(_0xd550c7,null));};exports[_0xd437('0x45')]=function(_0x5394ab,_0x1934a4){return db[_0xd437('0x3d')]['create'](_0x5394ab[_0xd437('0x46')],{})['then'](function(_0x170f62){var _0x2785b3=_0x5394ab[_0xd437('0x47')]['get']({'plain':!![]});if(!_0x2785b3)throw new Error(_0xd437('0x48'));if(_0x2785b3[_0xd437('0x49')]==='user'){var _0x15b9e7=_0x170f62['get']({'plain':!![]});var _0x2c87b6=_0xd437('0x26');return db[_0xd437('0x4a')][_0xd437('0x4b')]({'where':{'name':_0x2c87b6,'userProfileId':_0x2785b3[_0xd437('0x4c')]},'raw':!![]})[_0xd437('0x23')](function(_0x23d6f8){if(_0x23d6f8&&_0x23d6f8[_0xd437('0x4d')]===0x0){return db[_0xd437('0x27')][_0xd437('0x45')]({'name':_0x15b9e7['name'],'resourceId':_0x15b9e7['id'],'type':_0x23d6f8[_0xd437('0x29')],'sectionId':_0x23d6f8['id']},{})[_0xd437('0x23')](function(){return _0x170f62;});}else{return _0x170f62;}})[_0xd437('0x44')](function(_0x794380){logger[_0xd437('0x28')](_0xd437('0x4e'),_0x794380);throw _0x794380;});}return _0x170f62;})[_0xd437('0x23')](respondWithResult(_0x1934a4,0xc9))['catch'](handleError(_0x1934a4,null));};exports[_0xd437('0x22')]=function(_0x877ad6,_0x420dc3){if(_0x877ad6[_0xd437('0x46')]['id']){delete _0x877ad6[_0xd437('0x46')]['id'];}return db[_0xd437('0x3d')][_0xd437('0x4b')]({'where':{'id':_0x877ad6['params']['id']}})[_0xd437('0x23')](handleEntityNotFound(_0x420dc3,null))[_0xd437('0x23')](saveUpdates(_0x877ad6[_0xd437('0x46')],null))[_0xd437('0x23')](respondWithResult(_0x420dc3,null))['catch'](handleError(_0x420dc3,null));};exports[_0xd437('0x24')]=function(_0x54d461,_0x3048a4){return db[_0xd437('0x3d')]['find']({'where':{'id':_0x54d461[_0xd437('0x42')]['id']}})[_0xd437('0x23')](handleEntityNotFound(_0x3048a4,null))['then'](removeEntity(_0x3048a4,null))[_0xd437('0x44')](handleError(_0x3048a4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ef6b23f..5c9783e 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 _0xfc90=['define','tools_variables','util','api','moment','bluebird','rimraf','../../config/environment','./variable.attributes'];(function(_0x49e2a6,_0x1df6a8){var _0x267c60=function(_0xe464b8){while(--_0xe464b8){_0x49e2a6['push'](_0x49e2a6['shift']());}};_0x267c60(++_0x1df6a8);}(_0xfc90,0xa4));var _0x0fc9=function(_0x3071bd,_0x54cda0){_0x3071bd=_0x3071bd-0x0;var _0x673926=_0xfc90[_0x3071bd];return _0x673926;};'use strict';var _=require('lodash');var util=require(_0x0fc9('0x0'));var logger=require('../../config/logger')(_0x0fc9('0x1'));var moment=require(_0x0fc9('0x2'));var BPromise=require(_0x0fc9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fc9('0x4'));var config=require(_0x0fc9('0x5'));var attributes=require(_0x0fc9('0x6'));module['exports']=function(_0x5a3872,_0x51a72c){return _0x5a3872[_0x0fc9('0x7')]('Variable',attributes,{'tableName':_0x0fc9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8130=['./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c4e32,_0x3a5590){var _0x1eac30=function(_0x236c8e){while(--_0x236c8e){_0x2c4e32['push'](_0x2c4e32['shift']());}};_0x1eac30(++_0x3a5590);}(_0x8130,0xd5));var _0x0813=function(_0x4b431c,_0xafe491){_0x4b431c=_0x4b431c-0x0;var _0x30d67c=_0x8130[_0x4b431c];return _0x30d67c;};'use strict';var _=require('lodash');var util=require(_0x0813('0x0'));var logger=require(_0x0813('0x1'))(_0x0813('0x2'));var moment=require(_0x0813('0x3'));var BPromise=require(_0x0813('0x4'));var rp=require(_0x0813('0x5'));var fs=require('fs');var path=require(_0x0813('0x6'));var rimraf=require(_0x0813('0x7'));var config=require('../../config/environment');var attributes=require(_0x0813('0x8'));module[_0x0813('0x9')]=function(_0x547f2c,_0x2c95c2){return _0x547f2c[_0x0813('0xa')](_0x0813('0xb'),attributes,{'tableName':_0x0813('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 9297397..5888c2b 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x3f9510,_0x3d509e){var _0x4ddfb0=function(_0x474b1d){while(--_0x474b1d){_0x3f9510['push'](_0x3f9510['shift']());}};_0x4ddfb0(++_0x3d509e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b80d6,_0x18a56a){_0x3b80d6=_0x3b80d6-0x0;var _0x4e08f1=_0x7fbe[_0x3b80d6];return _0x4e08f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x55ca,0x126));var _0xa55c=function(_0x48f4c5,_0x56e4c3){_0x48f4c5=_0x48f4c5-0x0;var _0x40ab65=_0x55ca[_0x48f4c5];return _0x40ab65;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 716fe21..c8c1c71 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 _0x6f2e=['isAuthenticated','canUpdate','fetch','/reset','reset','get','/pull','/restart','restart','exports','express','Router','../../components/auth/service','index','/fetch'];(function(_0x3c5a79,_0x565097){var _0x52835f=function(_0x139063){while(--_0x139063){_0x3c5a79['push'](_0x3c5a79['shift']());}};_0x52835f(++_0x565097);}(_0x6f2e,0x1db));var _0xe6f2=function(_0x5bcdde,_0x375c71){_0x5bcdde=_0x5bcdde-0x0;var _0x478035=_0x6f2e[_0x5bcdde];return _0x478035;};'use strict';var express=require(_0xe6f2('0x0'));var router=express[_0xe6f2('0x1')]();var auth=require(_0xe6f2('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0xe6f2('0x3')]);router['get'](_0xe6f2('0x4'),auth[_0xe6f2('0x5')](),auth[_0xe6f2('0x6')](),controller[_0xe6f2('0x7')]);router['get'](_0xe6f2('0x8'),auth[_0xe6f2('0x5')](),auth['canUpdate'](),controller[_0xe6f2('0x9')]);router[_0xe6f2('0xa')](_0xe6f2('0xb'),auth[_0xe6f2('0x5')](),auth['canUpdate'](),controller['pull']);router[_0xe6f2('0xa')](_0xe6f2('0xc'),auth[_0xe6f2('0x5')](),controller[_0xe6f2('0xd')]);router[_0xe6f2('0xa')]('/migrations',controller['migrations']);module[_0xe6f2('0xe')]=router; \ No newline at end of file +var _0x6bea=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','migrations','exports','Router','../../components/auth/service','./version.controller'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x6bea,0x17d));var _0xa6be=function(_0x5999e9,_0x23dd00){_0x5999e9=_0x5999e9-0x0;var _0x2a7fd7=_0x6bea[_0x5999e9];return _0x2a7fd7;};'use strict';var express=require('express');var router=express[_0xa6be('0x0')]();var auth=require(_0xa6be('0x1'));var controller=require(_0xa6be('0x2'));router[_0xa6be('0x3')]('/',controller[_0xa6be('0x4')]);router[_0xa6be('0x3')](_0xa6be('0x5'),auth[_0xa6be('0x6')](),auth[_0xa6be('0x7')](),controller[_0xa6be('0x8')]);router[_0xa6be('0x3')](_0xa6be('0x9'),auth[_0xa6be('0x6')](),auth['canUpdate'](),controller[_0xa6be('0xa')]);router['get'](_0xa6be('0xb'),auth[_0xa6be('0x6')](),auth[_0xa6be('0x7')](),controller[_0xa6be('0xc')]);router[_0xa6be('0x3')](_0xa6be('0xd'),auth['isAuthenticated'](),controller['restart']);router['get']('/migrations',controller[_0xa6be('0xe')]);module[_0xa6be('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 81579e8..12f7ed6 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 _0xb411=['readdirSync','join','length','replace','.js','push','Migration','constructor','server','map','last','catch','sequelize','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','exports','2.0.0','status','origin','master','error','json','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations'];(function(_0x4d0d36,_0x31dac3){var _0xd31de8=function(_0x3f148a){while(--_0x3f148a){_0x4d0d36['push'](_0x4d0d36['shift']());}};_0xd31de8(++_0x31dac3);}(_0xb411,0xda));var _0x1b41=function(_0xfd245e,_0x2475a4){_0xfd245e=_0xfd245e-0x0;var _0x3b0a09=_0xb411[_0xfd245e];return _0x3b0a09;};'use strict';var Umzug=require('umzug');var path=require(_0x1b41('0x0'));var fs=require('fs');var _=require(_0x1b41('0x1'));var pkginfo=require(_0x1b41('0x2'))(module,_0x1b41('0x3'));var compareVersions=require(_0x1b41('0x4'));var exec=require(_0x1b41('0x5'))[_0x1b41('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x1b41('0x7'));var pm2=require(_0x1b41('0x8'));var logger=require(_0x1b41('0x9'))(_0x1b41('0xa'));var git=require(_0x1b41('0xb'))(config[_0x1b41('0xc')]);exports[_0x1b41('0xd')]=function(_0x1e1fd2,_0xccd641){var _0x3976b1={'current':module['exports'][_0x1b41('0x3')],'phonebar':0x2};if(_0x1e1fd2['query']&&_0x1e1fd2[_0x1b41('0xe')][_0x1b41('0xf')]){return git[_0x1b41('0x10')]()['tags'](function(_0x573aa1,_0x4f37f7){_0x3976b1['latest']=(_0x573aa1?module[_0x1b41('0x11')][_0x1b41('0x3')]:_0x4f37f7[_0x1b41('0xf')])||_0x1b41('0x12');return _0xccd641[_0x1b41('0x13')](0xc8)['json'](_0x3976b1);});}else{return _0xccd641[_0x1b41('0x13')](0xc8)['json'](_0x3976b1);}};exports['fetch']=function(_0x4e5680,_0x2fd9ca){return git[_0x1b41('0x10')]([_0x1b41('0x14'),_0x1b41('0x15')],function(_0xc01cce){if(_0xc01cce){logger[_0x1b41('0x16')](_0xc01cce);return _0x2fd9ca[_0x1b41('0x13')](0x1f4)[_0x1b41('0x17')](_0xc01cce);}logger[_0x1b41('0x18')](_0x1b41('0x19'));return _0x2fd9ca[_0x1b41('0x13')](0xc8)[_0x1b41('0x17')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x1b41('0x1a')]=function(_0x255a67,_0x37aff7){return git['reset'](['--hard',_0x1b41('0x1b')],function(_0x162105){if(_0x162105){logger['error'](_0x162105);return _0x37aff7[_0x1b41('0x13')](0x1f4)[_0x1b41('0x17')](_0x162105);}logger[_0x1b41('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x37aff7[_0x1b41('0x13')](0xc8)[_0x1b41('0x17')]({'output':_0x1b41('0x1c')});});};exports[_0x1b41('0x1d')]=function(_0x25d3b4,_0xd93cc3){exec(_0x1b41('0x1e'),function(_0x51ac70,_0x3613a4,_0x5266b6){logger[_0x1b41('0x18')](_0x3613a4);logger[_0x1b41('0x18')](_0x5266b6);if(_0x51ac70){logger[_0x1b41('0x16')](_0x51ac70);return _0xd93cc3['status'](0x1f4)[_0x1b41('0x17')](_0x51ac70);}return _0xd93cc3[_0x1b41('0x13')](0xc8)[_0x1b41('0x17')]({'output':_0x3613a4});});};exports[_0x1b41('0x1f')]=function(_0x23b2f3,_0x2cf76f){return pm2[_0x1b41('0x1f')](_0x1b41('0x20'))[_0x1b41('0x21')](function(_0x49f09e){logger[_0x1b41('0x18')](_0x1b41('0x22'),_0x49f09e);return _0x2cf76f[_0x1b41('0x13')](0xc8)['json']({'output':_0x1b41('0x23')});})['catch'](function(_0x38ebdd){logger['error'](_0x38ebdd);return _0x2cf76f[_0x1b41('0x13')](0x1f4)[_0x1b41('0x17')](_0x38ebdd);});};exports[_0x1b41('0x24')]=function(_0x22fc43,_0x362d3d){var _0x58d89c=fs[_0x1b41('0x25')](path[_0x1b41('0x26')](config[_0x1b41('0xc')],'server',_0x1b41('0x24')));var _0x18fbf5=[];for(var _0x3d2497=0x0;_0x3d2497<_0x58d89c[_0x1b41('0x27')];_0x3d2497++){var _0x34a460=_0x58d89c[_0x3d2497][_0x1b41('0x28')](_0x1b41('0x29'),'');if(compareVersions(module[_0x1b41('0x11')]['version'],_0x34a460)===-0x1){_0x18fbf5[_0x1b41('0x2a')](_0x34a460);}}if(_0x18fbf5['length']){var _0x266ea6=_0x18fbf5['sort'](compareVersions);var _0x222bb0=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x1b41('0x2b'),'columnName':'version'},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x1b41('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x1b41('0x26')](config[_0x1b41('0xc')],_0x1b41('0x2d'),_0x1b41('0x24')),'pattern':/\.js$/}});_0x222bb0['up']({'migrations':_[_0x1b41('0x2e')](_0x266ea6,function(_0x4cc284){return _0x4cc284+'.js';})})[_0x1b41('0x21')](function(){return _0x362d3d[_0x1b41('0x13')](0xc8)[_0x1b41('0x17')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x1b41('0x11')]['version']+'\x20to\x20'+_[_0x1b41('0x2f')](_0x266ea6),'migrations':_[_0x1b41('0x26')](_0x266ea6)});})[_0x1b41('0x30')](function(_0x1d9d8d){if(_0x1d9d8d instanceof db[_0x1b41('0x31')]['UniqueConstraintError']){return _0x362d3d[_0x1b41('0x13')](0xc8)['json']({'output':_0x1b41('0x32')});}else{return _0x362d3d[_0x1b41('0x13')](0x1f4)['json'](_0x1d9d8d);}});}else{return _0x362d3d[_0x1b41('0x13')](0xc8)[_0x1b41('0x17')]({'output':_0x1b41('0x32')});}}; \ No newline at end of file +var _0x275a=['latest','tags','exports','2.0.0','status','fetch','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','version'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0x275a,0x92));var _0xa275=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x275a[_0x1a9204];return _0x17ca68;};'use strict';var Umzug=require('umzug');var path=require(_0xa275('0x0'));var fs=require('fs');var _=require(_0xa275('0x1'));var pkginfo=require(_0xa275('0x2'))(module,'version');var compareVersions=require(_0xa275('0x3'));var exec=require(_0xa275('0x4'))[_0xa275('0x5')];var db=require(_0xa275('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xa275('0x7'));var logger=require(_0xa275('0x8'))('update');var git=require(_0xa275('0x9'))(config[_0xa275('0xa')]);exports[_0xa275('0xb')]=function(_0x3726c8,_0x4f6299){var _0x393e90={'current':module['exports'][_0xa275('0xc')],'phonebar':0x2};if(_0x3726c8['query']&&_0x3726c8['query'][_0xa275('0xd')]){return git['fetch']()[_0xa275('0xe')](function(_0x1c29e1,_0x479ffd){_0x393e90['latest']=(_0x1c29e1?module[_0xa275('0xf')]['version']:_0x479ffd[_0xa275('0xd')])||_0xa275('0x10');return _0x4f6299['status'](0xc8)['json'](_0x393e90);});}else{return _0x4f6299[_0xa275('0x11')](0xc8)['json'](_0x393e90);}};exports[_0xa275('0x12')]=function(_0x101df8,_0x124bb6){return git[_0xa275('0x12')](['origin',_0xa275('0x13')],function(_0x4e057d){if(_0x4e057d){logger[_0xa275('0x14')](_0x4e057d);return _0x124bb6['status'](0x1f4)[_0xa275('0x15')](_0x4e057d);}logger[_0xa275('0x16')](_0xa275('0x17'));return _0x124bb6['status'](0xc8)[_0xa275('0x15')]({'output':_0xa275('0x18')});});};exports[_0xa275('0x19')]=function(_0x287444,_0xb81be2){return git[_0xa275('0x19')]([_0xa275('0x1a'),_0xa275('0x1b')],function(_0x5dbcec){if(_0x5dbcec){logger[_0xa275('0x14')](_0x5dbcec);return _0xb81be2[_0xa275('0x11')](0x1f4)[_0xa275('0x15')](_0x5dbcec);}logger[_0xa275('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xb81be2[_0xa275('0x11')](0xc8)['json']({'output':_0xa275('0x1c')});});};exports[_0xa275('0x1d')]=function(_0x1ec3fe,_0x58dcc7){exec(_0xa275('0x1e'),function(_0x143349,_0x54d7ff,_0x546cfe){logger[_0xa275('0x16')](_0x54d7ff);logger['info'](_0x546cfe);if(_0x143349){logger[_0xa275('0x14')](_0x143349);return _0x58dcc7[_0xa275('0x11')](0x1f4)[_0xa275('0x15')](_0x143349);}return _0x58dcc7[_0xa275('0x11')](0xc8)['json']({'output':_0x54d7ff});});};exports[_0xa275('0x1f')]=function(_0x2195e7,_0x37b777){return pm2['restart']('motion2')['then'](function(_0x1b796b){logger[_0xa275('0x16')](_0xa275('0x20'),_0x1b796b);return _0x37b777[_0xa275('0x11')](0xc8)[_0xa275('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xa275('0x21')](function(_0x275167){logger['error'](_0x275167);return _0x37b777[_0xa275('0x11')](0x1f4)['json'](_0x275167);});};exports[_0xa275('0x22')]=function(_0xf35df7,_0x469392){var _0x15a0f5=fs[_0xa275('0x23')](path[_0xa275('0x24')](config[_0xa275('0xa')],_0xa275('0x25'),_0xa275('0x22')));var _0xdb5ff1=[];for(var _0x2234e5=0x0;_0x2234e5<_0x15a0f5[_0xa275('0x26')];_0x2234e5++){var _0x3479ea=_0x15a0f5[_0x2234e5][_0xa275('0x27')]('.js','');if(compareVersions(module[_0xa275('0xf')][_0xa275('0xc')],_0x3479ea)===-0x1){_0xdb5ff1[_0xa275('0x28')](_0x3479ea);}}if(_0xdb5ff1[_0xa275('0x26')]){var _0x9c4ee=_0xdb5ff1[_0xa275('0x29')](compareVersions);var _0x35dc21=new Umzug({'storage':_0xa275('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':_0xa275('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0xa275('0x2a')][_0xa275('0x2c')](),db[_0xa275('0x2a')][_0xa275('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xa275('0x24')](config[_0xa275('0xa')],'server',_0xa275('0x22')),'pattern':/\.js$/}});_0x35dc21['up']({'migrations':_[_0xa275('0x2e')](_0x9c4ee,function(_0x2658e5){return _0x2658e5+_0xa275('0x2f');})})[_0xa275('0x30')](function(){return _0x469392[_0xa275('0x11')](0xc8)['json']({'output':_0xa275('0x31')+module['exports']['version']+_0xa275('0x32')+_[_0xa275('0x33')](_0x9c4ee),'migrations':_[_0xa275('0x24')](_0x9c4ee)});})[_0xa275('0x21')](function(_0x1034f3){if(_0x1034f3 instanceof db[_0xa275('0x2a')]['UniqueConstraintError']){return _0x469392['status'](0xc8)[_0xa275('0x15')]({'output':_0xa275('0x34')});}else{return _0x469392[_0xa275('0x11')](0x1f4)[_0xa275('0x15')](_0x1034f3);}});}else{return _0x469392[_0xa275('0x11')](0xc8)['json']({'output':_0xa275('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 815c602..958591f 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 _0x9cf6=['/:id','show','post','create','put','delete','multer','util','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','describe'];(function(_0x275cb3,_0x53a02e){var _0x37d01c=function(_0x1a1135){while(--_0x1a1135){_0x275cb3['push'](_0x275cb3['shift']());}};_0x37d01c(++_0x53a02e);}(_0x9cf6,0x1aa));var _0x69cf=function(_0x52bfb9,_0x4816bc){_0x52bfb9=_0x52bfb9-0x0;var _0x2edf67=_0x9cf6[_0x52bfb9];return _0x2edf67;};'use strict';var multer=require(_0x69cf('0x0'));var util=require(_0x69cf('0x1'));var path=require('path');var timeout=require(_0x69cf('0x2'));var express=require('express');var router=express[_0x69cf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x69cf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x69cf('0x5')]('/',auth[_0x69cf('0x6')](),controller[_0x69cf('0x7')]);router[_0x69cf('0x5')]('/describe',auth[_0x69cf('0x6')](),controller[_0x69cf('0x8')]);router[_0x69cf('0x5')](_0x69cf('0x9'),auth[_0x69cf('0x6')](),controller[_0x69cf('0xa')]);router[_0x69cf('0xb')]('/',auth[_0x69cf('0x6')](),controller[_0x69cf('0xc')]);router[_0x69cf('0xd')](_0x69cf('0x9'),auth[_0x69cf('0x6')](),controller['update']);router[_0x69cf('0xe')]('/:id',auth[_0x69cf('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1037=['isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x59770e,_0x305cf7){var _0x9b25b7=function(_0x355552){while(--_0x355552){_0x59770e['push'](_0x59770e['shift']());}};_0x9b25b7(++_0x305cf7);}(_0x1037,0x6e));var _0x7103=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x1037[_0x3ba924];return _0x4cc1df;};'use strict';var multer=require(_0x7103('0x0'));var util=require('util');var path=require(_0x7103('0x1'));var timeout=require(_0x7103('0x2'));var express=require(_0x7103('0x3'));var router=express[_0x7103('0x4')]();var fs_extra=require(_0x7103('0x5'));var auth=require(_0x7103('0x6'));var interaction=require(_0x7103('0x7'));var config=require(_0x7103('0x8'));var controller=require(_0x7103('0x9'));router['get']('/',auth[_0x7103('0xa')](),controller['index']);router[_0x7103('0xb')](_0x7103('0xc'),auth[_0x7103('0xa')](),controller['describe']);router[_0x7103('0xb')](_0x7103('0xd'),auth['isAuthenticated'](),controller[_0x7103('0xe')]);router[_0x7103('0xf')]('/',auth['isAuthenticated'](),controller[_0x7103('0x10')]);router[_0x7103('0x11')](_0x7103('0xd'),auth['isAuthenticated'](),controller[_0x7103('0x12')]);router[_0x7103('0x13')](_0x7103('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index fd9d1bc..f5a4f19 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 _0x07a2=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07a2,0x12c));var _0x207a=function(_0x235563,_0x260ece){_0x235563=_0x235563-0x0;var _0x219be0=_0x07a2[_0x235563];return _0x219be0;};'use strict';var Sequelize=require(_0x207a('0x0'));module[_0x207a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x207a('0x2')]},'calleridnum':{'type':Sequelize[_0x207a('0x2')]},'calleridname':{'type':Sequelize[_0x207a('0x2')]},'queue':{'type':Sequelize[_0x207a('0x2')]},'interface':{'type':Sequelize[_0x207a('0x2')]},'membername':{'type':Sequelize[_0x207a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x207a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x207a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x207a('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x207a('0x4')]},'agentcomplete':{'type':Sequelize[_0x207a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x207a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x207a('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x207a('0x4')]},'agentacw':{'type':Sequelize[_0x207a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x207a('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x207a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x207a('0x2')]},'accountcode':{'type':Sequelize[_0x207a('0x2')]},'context':{'type':Sequelize[_0x207a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x207a('0x2')]},'destchannel':{'type':Sequelize[_0x207a('0x2')]},'destchannelstate':{'type':Sequelize[_0x207a('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x207a('0x2')]},'destcalleridname':{'type':Sequelize[_0x207a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x207a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x207a('0x2')]},'destlanguage':{'type':Sequelize[_0x207a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x207a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x207a('0x2')]},'destuniqueid':{'type':Sequelize[_0x207a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x207a('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x207a('0x2')]},'transfer':{'type':Sequelize[_0x207a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x207a('0x2')],'comment':_0x207a('0x6')},'transferexten':{'type':Sequelize[_0x207a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x207a('0x2')]},'agententerreason':{'type':Sequelize[_0x207a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1cc3=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1cc3,0x11b));var _0x31cc=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1cc3[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x31cc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x31cc('0x2')]},'queue':{'type':Sequelize[_0x31cc('0x2')]},'interface':{'type':Sequelize[_0x31cc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x31cc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x31cc('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x31cc('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x31cc('0x3')]},'holdtime':{'type':Sequelize[_0x31cc('0x4')]},'agentcomplete':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x31cc('0x4')]},'agentacw':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x31cc('0x4')]},'reason':{'type':Sequelize[_0x31cc('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x31cc('0x2')]},'channelstate':{'type':Sequelize[_0x31cc('0x4')]},'channelstatedesc':{'type':Sequelize[_0x31cc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x31cc('0x2')]},'connectedlinename':{'type':Sequelize[_0x31cc('0x2')]},'language':{'type':Sequelize[_0x31cc('0x2')]},'accountcode':{'type':Sequelize[_0x31cc('0x2')]},'context':{'type':Sequelize[_0x31cc('0x2')]},'exten':{'type':Sequelize[_0x31cc('0x2')]},'priority':{'type':Sequelize[_0x31cc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x31cc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x31cc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x31cc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x31cc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x31cc('0x2')]},'destlanguage':{'type':Sequelize[_0x31cc('0x2')]},'destaccountcode':{'type':Sequelize[_0x31cc('0x2')]},'destcontext':{'type':Sequelize[_0x31cc('0x2')]},'destexten':{'type':Sequelize[_0x31cc('0x2')]},'destpriority':{'type':Sequelize[_0x31cc('0x2')]},'destuniqueid':{'type':Sequelize[_0x31cc('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x31cc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x31cc('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x31cc('0x2')],'comment':_0x31cc('0x6')},'transferexten':{'type':Sequelize[_0x31cc('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x31cc('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 3bc6399..7cdf9df 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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 9e007a8..9df6957 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(_0x2ef0e2,_0x5b1990){var _0x56886d=function(_0x16be77){while(--_0x16be77){_0x2ef0e2['push'](_0x2ef0e2['shift']());}};_0x56886d(++_0x5b1990);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'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 _0x2bd8=['bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x2bd8,0x130));var _0x82bd=function(_0x38bc65,_0x3606cb){_0x38bc65=_0x38bc65-0x0;var _0x449454=_0x2bd8[_0x38bc65];return _0x449454;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'fields':[_0x82bd('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 610b7e3..af286b0 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 _0xedb8=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','CreateVoiceAgentReport','VoiceAgentReport','body','options','debug','UpdateVoiceAgentReport','update','raw','where','catch','lodash'];(function(_0x430543,_0x5ae1f5){var _0x5176d9=function(_0x10eabc){while(--_0x10eabc){_0x430543['push'](_0x430543['shift']());}};_0x5176d9(++_0x5ae1f5);}(_0xedb8,0x1a3));var _0x8edb=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0xedb8[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0x8edb('0x0'));var util=require('util');var moment=require(_0x8edb('0x1'));var BPromise=require('bluebird');var rs=require(_0x8edb('0x2'));var fs=require('fs');var Redis=require(_0x8edb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8edb('0x4'));var logger=require(_0x8edb('0x5'))(_0x8edb('0x6'));var config=require('../../config/environment');var jayson=require(_0x8edb('0x7'));var client=jayson[_0x8edb('0x8')][_0x8edb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbdb0fa,_0x3d636e,_0x485c73){return new BPromise(function(_0x46e60b,_0x5d63f1){return client[_0x8edb('0xa')](_0xbdb0fa,_0x485c73)[_0x8edb('0xb')](function(_0x53cd18){logger['info'](_0x8edb('0xc'),_0x3d636e,'request\x20sent');logger['debug'](_0x8edb('0xd'),_0x3d636e,_0x8edb('0xe'),JSON[_0x8edb('0xf')](_0x53cd18));if(_0x53cd18['error']){if(_0x53cd18['error'][_0x8edb('0x10')]===0x1f4){logger[_0x8edb('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x3d636e,_0x53cd18[_0x8edb('0x11')][_0x8edb('0x12')]);return _0x5d63f1(_0x53cd18['error'][_0x8edb('0x12')]);}logger[_0x8edb('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x3d636e,_0x53cd18[_0x8edb('0x11')][_0x8edb('0x12')]);return _0x46e60b(_0x53cd18[_0x8edb('0x11')][_0x8edb('0x12')]);}else{logger[_0x8edb('0x13')](_0x8edb('0xc'),_0x3d636e,'request\x20sent');_0x46e60b(_0x53cd18['result'][_0x8edb('0x12')]);}})['catch'](function(_0x486b20){logger[_0x8edb('0x11')](_0x8edb('0xc'),_0x3d636e,_0x486b20);_0x5d63f1(_0x486b20);});});}exports[_0x8edb('0x14')]=function(_0xd0fa43){var _0x15f773=this;return new Promise(function(_0x16d885,_0x2d22b7){return db[_0x8edb('0x15')]['create'](_0xd0fa43[_0x8edb('0x16')],{'raw':_0xd0fa43['options']?_0xd0fa43[_0x8edb('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x8edb('0xb')](function(_0x50a5e2){logger[_0x8edb('0x13')]('CreateVoiceAgentReport',_0xd0fa43);logger[_0x8edb('0x18')](_0x8edb('0x14'),_0xd0fa43,JSON['stringify'](_0x50a5e2));_0x16d885(_0x50a5e2);})['catch'](function(_0x15d744){logger[_0x8edb('0x11')](_0x8edb('0x14'),_0x15d744[_0x8edb('0x12')],_0xd0fa43);_0x2d22b7(_0x15f773[_0x8edb('0x11')](0x1f4,_0x15d744['message']));});});};exports[_0x8edb('0x19')]=function(_0x11262a){var _0x4446b0=this;return new Promise(function(_0x5c8019,_0x53e84f){return db[_0x8edb('0x15')][_0x8edb('0x1a')](_0x11262a[_0x8edb('0x16')],{'raw':_0x11262a[_0x8edb('0x17')]?_0x11262a[_0x8edb('0x17')][_0x8edb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11262a[_0x8edb('0x17')]?_0x11262a[_0x8edb('0x17')][_0x8edb('0x1c')]||null:null,'attributes':_0x11262a['options']?_0x11262a[_0x8edb('0x17')]['attributes']||null:null,'limit':_0x11262a[_0x8edb('0x17')]?_0x11262a[_0x8edb('0x17')]['limit']||null:null})[_0x8edb('0xb')](function(_0x204fdd){logger[_0x8edb('0x13')](_0x8edb('0x19'),_0x11262a);logger[_0x8edb('0x18')]('UpdateVoiceAgentReport',_0x11262a,JSON[_0x8edb('0xf')](_0x204fdd));_0x5c8019(_0x204fdd);})[_0x8edb('0x1d')](function(_0x2ca7aa){logger[_0x8edb('0x11')](_0x8edb('0x19'),_0x2ca7aa['message'],_0x11262a);_0x53e84f(_0x4446b0['error'](0x1f4,_0x2ca7aa['message']));});});}; \ No newline at end of file +var _0x1523=['info','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','body','options','raw'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1523,0xcd));var _0x3152=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x1523[_0x1678c8];return _0x387aa9;};'use strict';var _=require(_0x3152('0x0'));var util=require(_0x3152('0x1'));var moment=require(_0x3152('0x2'));var BPromise=require(_0x3152('0x3'));var rs=require(_0x3152('0x4'));var fs=require('fs');var Redis=require(_0x3152('0x5'));var db=require(_0x3152('0x6'))['db'];var utils=require(_0x3152('0x7'));var logger=require(_0x3152('0x8'))('rpc');var config=require(_0x3152('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3152('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38848c,_0x28e145,_0x416cad){return new BPromise(function(_0x3621ef,_0x2620d1){return client['request'](_0x38848c,_0x416cad)[_0x3152('0xb')](function(_0x55df49){logger['info'](_0x3152('0xc'),_0x28e145,_0x3152('0xd'));logger[_0x3152('0xe')](_0x3152('0xf'),_0x28e145,'request\x20sent',JSON[_0x3152('0x10')](_0x55df49));if(_0x55df49[_0x3152('0x11')]){if(_0x55df49[_0x3152('0x11')][_0x3152('0x12')]===0x1f4){logger[_0x3152('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x28e145,_0x55df49[_0x3152('0x11')][_0x3152('0x13')]);return _0x2620d1(_0x55df49[_0x3152('0x11')][_0x3152('0x13')]);}logger[_0x3152('0x11')](_0x3152('0xc'),_0x28e145,_0x55df49[_0x3152('0x11')][_0x3152('0x13')]);return _0x3621ef(_0x55df49[_0x3152('0x11')]['message']);}else{logger['info'](_0x3152('0xc'),_0x28e145,_0x3152('0xd'));_0x3621ef(_0x55df49[_0x3152('0x14')][_0x3152('0x13')]);}})[_0x3152('0x15')](function(_0x422f5a){logger[_0x3152('0x11')](_0x3152('0xc'),_0x28e145,_0x422f5a);_0x2620d1(_0x422f5a);});});}exports['CreateVoiceAgentReport']=function(_0x560d03){var _0x245232=this;return new Promise(function(_0x506d85,_0x318b68){return db[_0x3152('0x16')]['create'](_0x560d03[_0x3152('0x17')],{'raw':_0x560d03[_0x3152('0x18')]?_0x560d03[_0x3152('0x18')][_0x3152('0x19')]===undefined?!![]:![]:!![]})[_0x3152('0xb')](function(_0x4aa22d){logger[_0x3152('0x1a')]('CreateVoiceAgentReport',_0x560d03);logger[_0x3152('0xe')]('CreateVoiceAgentReport',_0x560d03,JSON[_0x3152('0x10')](_0x4aa22d));_0x506d85(_0x4aa22d);})[_0x3152('0x15')](function(_0x29ff02){logger[_0x3152('0x11')](_0x3152('0x1b'),_0x29ff02[_0x3152('0x13')],_0x560d03);_0x318b68(_0x245232[_0x3152('0x11')](0x1f4,_0x29ff02[_0x3152('0x13')]));});});};exports[_0x3152('0x1c')]=function(_0x799187){var _0x1d761a=this;return new Promise(function(_0x1a6888,_0x54bc23){return db[_0x3152('0x16')][_0x3152('0x1d')](_0x799187['body'],{'raw':_0x799187[_0x3152('0x18')]?_0x799187[_0x3152('0x18')][_0x3152('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x799187['options']?_0x799187[_0x3152('0x18')][_0x3152('0x1e')]||null:null,'attributes':_0x799187[_0x3152('0x18')]?_0x799187[_0x3152('0x18')][_0x3152('0x1f')]||null:null,'limit':_0x799187[_0x3152('0x18')]?_0x799187['options'][_0x3152('0x20')]||null:null})[_0x3152('0xb')](function(_0x4b209c){logger[_0x3152('0x1a')]('UpdateVoiceAgentReport',_0x799187);logger[_0x3152('0xe')](_0x3152('0x1c'),_0x799187,JSON['stringify'](_0x4b209c));_0x1a6888(_0x4b209c);})[_0x3152('0x15')](function(_0x457773){logger[_0x3152('0x11')](_0x3152('0x1c'),_0x457773['message'],_0x799187);_0x54bc23(_0x1d761a[_0x3152('0x11')](0x1f4,_0x457773[_0x3152('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 412ff3f..90ed697 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 _0x5ad3=['isAuthenticated','index','describe','create','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x26400b,_0x36a7c2){var _0x42d5e9=function(_0x2e7995){while(--_0x2e7995){_0x26400b['push'](_0x26400b['shift']());}};_0x42d5e9(++_0x36a7c2);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x5ad3[_0x1f239e];return _0x826971;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/describe',auth[_0x35ad('0xb')](),controller[_0x35ad('0xd')]);router[_0x35ad('0xa')]('/:id',auth[_0x35ad('0xb')](),controller['show']);router['post']('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xe')]);router['put'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['update']);router['delete'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['destroy']);module[_0x35ad('0x10')]=router; \ No newline at end of file +var _0xb66c=['./voiceCallReport.controller','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xb66c,0x175));var _0xcb66=function(_0x36dcae,_0x3d43a1){_0x36dcae=_0x36dcae-0x0;var _0x247059=_0xb66c[_0x36dcae];return _0x247059;};'use strict';var multer=require(_0xcb66('0x0'));var util=require('util');var path=require(_0xcb66('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb66('0x2'));var router=express[_0xcb66('0x3')]();var fs_extra=require(_0xcb66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var controller=require(_0xcb66('0x7'));router[_0xcb66('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb66('0x8')](_0xcb66('0x9'),auth[_0xcb66('0xa')](),controller[_0xcb66('0xb')]);router[_0xcb66('0x8')]('/:id',auth[_0xcb66('0xa')](),controller[_0xcb66('0xc')]);router[_0xcb66('0xd')]('/',auth[_0xcb66('0xa')](),controller[_0xcb66('0xe')]);router['put'](_0xcb66('0xf'),auth[_0xcb66('0xa')](),controller[_0xcb66('0x10')]);router[_0xcb66('0x11')]('/:id',auth[_0xcb66('0xa')](),controller[_0xcb66('0x12')]);module[_0xcb66('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index aafc992..00048a2 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 _0x30c7=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','outbound','inbound-fax'];(function(_0x3c0197,_0x483428){var _0x15af59=function(_0x562f32){while(--_0x562f32){_0x3c0197['push'](_0x3c0197['shift']());}};_0x15af59(++_0x483428);}(_0x30c7,0x111));var _0x730c=function(_0x2d0a50,_0x66a014){_0x2d0a50=_0x2d0a50-0x0;var _0x4f2e65=_0x30c7[_0x2d0a50];return _0x4f2e65;};'use strict';var Sequelize=require(_0x730c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x730c('0x1')]},'type':{'type':Sequelize[_0x730c('0x2')](_0x730c('0x3'),'internal',_0x730c('0x4'),_0x730c('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x730c('0x1')]},'destination':{'type':Sequelize[_0x730c('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x730c('0x1')]},'channel':{'type':Sequelize[_0x730c('0x1')]},'destinationchannel':{'type':Sequelize[_0x730c('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x730c('0x6')]},'starttime':{'type':Sequelize[_0x730c('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x730c('0x7')]},'endtime':{'type':Sequelize[_0x730c('0x7')]},'duration':{'type':Sequelize[_0x730c('0x8')]},'billableseconds':{'type':Sequelize[_0x730c('0x8')]},'mohtime':{'type':Sequelize[_0x730c('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x730c('0x1')]},'amaflags':{'type':Sequelize[_0x730c('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x730c('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x730c('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x730c('0x1')]},'note':{'type':Sequelize[_0x730c('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x730c('0x8')]},'sipcallid':{'type':Sequelize[_0x730c('0x1')]}}; \ No newline at end of file +var _0x9431=['internal','outbound','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9431,0xa8));var _0x1943=function(_0x2608d5,_0x4b56f7){_0x2608d5=_0x2608d5-0x0;var _0xce8b1c=_0x9431[_0x2608d5];return _0xce8b1c;};'use strict';var Sequelize=require(_0x1943('0x0'));module[_0x1943('0x1')]={'uniqueid':{'type':Sequelize[_0x1943('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x1943('0x3'),_0x1943('0x4'),'inbound-fax','outbound-fax',_0x1943('0x5'))},'tag':{'type':Sequelize[_0x1943('0x2')]},'accountcode':{'type':Sequelize[_0x1943('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x1943('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1943('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x1943('0x2')]},'lastdata':{'type':Sequelize[_0x1943('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1943('0x7')]},'endtime':{'type':Sequelize[_0x1943('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1943('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1943('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1943('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x1943('0x2')]},'note':{'type':Sequelize[_0x1943('0x2')]},'prefix':{'type':Sequelize[_0x1943('0x2')]},'routeid':{'type':Sequelize[_0x1943('0x8')]},'sipcallid':{'type':Sequelize[_0x1943('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ed9cddb..aa25638 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0xadb5,0xad));var _0x5adb=function(_0x2d7e72,_0x571c1b){_0x2d7e72=_0x2d7e72-0x0;var _0x58c99b=_0xadb5[_0x2d7e72];return _0x58c99b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _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(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33f36d,_0x27d5a7){_0x33f36d=_0x33f36d-0x0;var _0x59a26b=_0x5f2f[_0x33f36d];return _0x59a26b;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c7d8282..9348154 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 _0x20ab=['report_call','uniqueid','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x588480,_0x39b0b5){var _0x68ae0d=function(_0x22b560){while(--_0x22b560){_0x588480['push'](_0x588480['shift']());}};_0x68ae0d(++_0x39b0b5);}(_0x20ab,0x13a));var _0xb20a=function(_0x491fbc,_0x1a708a){_0x491fbc=_0x491fbc-0x0;var _0x2559d7=_0x20ab[_0x491fbc];return _0x2559d7;};'use strict';var _=require(_0xb20a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb20a('0x1'));var rp=require(_0xb20a('0x2'));var fs=require('fs');var path=require(_0xb20a('0x3'));var rimraf=require(_0xb20a('0x4'));var config=require(_0xb20a('0x5'));var attributes=require(_0xb20a('0x6'));module[_0xb20a('0x7')]=function(_0x12f9b5,_0x3df73b){return _0x12f9b5[_0xb20a('0x8')](_0xb20a('0x9'),attributes,{'tableName':_0xb20a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb20a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0941=['uniqueid','util','bluebird','path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0941,0xd3));var _0x1094=function(_0x4035f7,_0x3560f1){_0x4035f7=_0x4035f7-0x0;var _0x5def9d=_0x0941[_0x4035f7];return _0x5def9d;};'use strict';var _=require('lodash');var util=require(_0x1094('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1094('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1094('0x2'));var rimraf=require(_0x1094('0x3'));var config=require(_0x1094('0x4'));var attributes=require('./voiceCallReport.attributes');module[_0x1094('0x5')]=function(_0x4351f4,_0xe0e73c){return _0x4351f4[_0x1094('0x6')](_0x1094('0x7'),attributes,{'tableName':_0x1094('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1094('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index dec2240..e720dc0 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 _0x5bbe=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util'];(function(_0x13187f,_0x1404f2){var _0x375f2e=function(_0x2207ca){while(--_0x2207ca){_0x13187f['push'](_0x13187f['shift']());}};_0x375f2e(++_0x1404f2);}(_0x5bbe,0x1b6));var _0xe5bb=function(_0x3a0919,_0x2b7a22){_0x3a0919=_0x3a0919-0x0;var _0x505579=_0x5bbe[_0x3a0919];return _0x505579;};'use strict';var _=require(_0xe5bb('0x0'));var util=require(_0xe5bb('0x1'));var moment=require(_0xe5bb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5bb('0x3'));var db=require(_0xe5bb('0x4'))['db'];var utils=require(_0xe5bb('0x5'));var logger=require(_0xe5bb('0x6'))(_0xe5bb('0x7'));var config=require(_0xe5bb('0x8'));var jayson=require(_0xe5bb('0x9'));var client=jayson[_0xe5bb('0xa')][_0xe5bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2399df,_0x1dfdb9,_0x1e3387){return new BPromise(function(_0xa2f37,_0x221f05){return client['request'](_0x2399df,_0x1e3387)[_0xe5bb('0xc')](function(_0x13927e){logger['info'](_0xe5bb('0xd'),_0x1dfdb9,_0xe5bb('0xe'));logger[_0xe5bb('0xf')](_0xe5bb('0x10'),_0x1dfdb9,_0xe5bb('0xe'),JSON[_0xe5bb('0x11')](_0x13927e));if(_0x13927e[_0xe5bb('0x12')]){if(_0x13927e['error'][_0xe5bb('0x13')]===0x1f4){logger[_0xe5bb('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1dfdb9,_0x13927e['error'][_0xe5bb('0x14')]);return _0x221f05(_0x13927e['error'][_0xe5bb('0x14')]);}logger[_0xe5bb('0x12')](_0xe5bb('0xd'),_0x1dfdb9,_0x13927e['error']['message']);return _0xa2f37(_0x13927e[_0xe5bb('0x12')][_0xe5bb('0x14')]);}else{logger[_0xe5bb('0x15')](_0xe5bb('0xd'),_0x1dfdb9,_0xe5bb('0xe'));_0xa2f37(_0x13927e[_0xe5bb('0x16')][_0xe5bb('0x14')]);}})[_0xe5bb('0x17')](function(_0x42208e){logger['error'](_0xe5bb('0xd'),_0x1dfdb9,_0x42208e);_0x221f05(_0x42208e);});});}exports[_0xe5bb('0x18')]=function(_0x50f92a){var _0x1c0ad8=this;return new Promise(function(_0x441d92,_0x56c288){return db['VoiceCallReport'][_0xe5bb('0x19')]({'raw':_0x50f92a[_0xe5bb('0x1a')]?_0x50f92a[_0xe5bb('0x1a')][_0xe5bb('0x1b')]===undefined?!![]:![]:!![],'where':_0x50f92a[_0xe5bb('0x1a')]?_0x50f92a[_0xe5bb('0x1a')][_0xe5bb('0x1c')]||null:null,'attributes':_0x50f92a['options']?_0x50f92a[_0xe5bb('0x1a')][_0xe5bb('0x1d')]||null:null,'limit':_0x50f92a[_0xe5bb('0x1a')]?_0x50f92a[_0xe5bb('0x1a')][_0xe5bb('0x1e')]||null:null,'include':_0x50f92a[_0xe5bb('0x1a')]?_0x50f92a[_0xe5bb('0x1a')]['include']?_['map'](_0x50f92a[_0xe5bb('0x1a')][_0xe5bb('0x1f')],function(_0x368a3a){return{'model':db[_0x368a3a[_0xe5bb('0x20')]],'as':_0x368a3a['as'],'attributes':_0x368a3a[_0xe5bb('0x1d')],'include':_0x368a3a[_0xe5bb('0x1f')]?_[_0xe5bb('0x21')](_0x368a3a[_0xe5bb('0x1f')],function(_0x58caa9){return{'model':db[_0x58caa9[_0xe5bb('0x20')]],'as':_0x58caa9['as'],'attributes':_0x58caa9['attributes'],'include':_0x58caa9[_0xe5bb('0x1f')]?_['map'](_0x58caa9[_0xe5bb('0x1f')],function(_0x48b24f){return{'model':db[_0x48b24f['model']],'as':_0x48b24f['as'],'attributes':_0x48b24f[_0xe5bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe5bb('0xc')](function(_0x1f9652){logger[_0xe5bb('0x15')](_0xe5bb('0x18'),_0x50f92a);logger[_0xe5bb('0xf')]('GetVoiceCallReport',_0x50f92a,JSON[_0xe5bb('0x11')](_0x1f9652));_0x441d92(_0x1f9652);})[_0xe5bb('0x17')](function(_0x50b303){logger[_0xe5bb('0x12')](_0xe5bb('0x18'),_0x50b303[_0xe5bb('0x14')],_0x50f92a);_0x56c288(_0x1c0ad8[_0xe5bb('0x12')](0x1f4,_0x50b303['message']));});});};exports['CreateVoiceCallReport']=function(_0x40bdaa){var _0x36e94e=this;return new Promise(function(_0x267754,_0x3a061c){return db[_0xe5bb('0x22')][_0xe5bb('0x23')](_0x40bdaa[_0xe5bb('0x24')],{'raw':_0x40bdaa[_0xe5bb('0x1a')]?_0x40bdaa[_0xe5bb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe5bb('0xc')](function(_0x2178f6){logger[_0xe5bb('0x15')](_0xe5bb('0x25'),_0x40bdaa);logger[_0xe5bb('0xf')]('CreateVoiceCallReport',_0x40bdaa,JSON[_0xe5bb('0x11')](_0x2178f6));_0x267754(_0x2178f6);})[_0xe5bb('0x17')](function(_0x2799f3){logger[_0xe5bb('0x12')](_0xe5bb('0x25'),_0x2799f3[_0xe5bb('0x14')],_0x40bdaa);_0x3a061c(_0x36e94e[_0xe5bb('0x12')](0x1f4,_0x2799f3[_0xe5bb('0x14')]));});});};exports[_0xe5bb('0x26')]=function(_0x13ef70){var _0x115867=this;return new Promise(function(_0x519436,_0x42e744){return db['VoiceCallReport'][_0xe5bb('0x27')](_0x13ef70[_0xe5bb('0x24')],{'raw':_0x13ef70[_0xe5bb('0x1a')]?_0x13ef70[_0xe5bb('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13ef70[_0xe5bb('0x1a')]?_0x13ef70[_0xe5bb('0x1a')][_0xe5bb('0x1c')]||null:null,'attributes':_0x13ef70[_0xe5bb('0x1a')]?_0x13ef70['options'][_0xe5bb('0x1d')]||null:null,'limit':_0x13ef70[_0xe5bb('0x1a')]?_0x13ef70[_0xe5bb('0x1a')][_0xe5bb('0x1e')]||null:null})[_0xe5bb('0xc')](function(_0x40ccd1){logger[_0xe5bb('0x15')]('UpdateVoiceCallReport',_0x13ef70);logger[_0xe5bb('0xf')](_0xe5bb('0x26'),_0x13ef70,JSON[_0xe5bb('0x11')](_0x40ccd1));_0x519436(_0x40ccd1);})[_0xe5bb('0x17')](function(_0x1a085a){logger[_0xe5bb('0x12')](_0xe5bb('0x26'),_0x1a085a['message'],_0x13ef70);_0x42e744(_0x115867[_0xe5bb('0x12')](0x1f4,_0x1a085a[_0xe5bb('0x14')]));});});}; \ No newline at end of file +var _0xaa31=['attributes','include','map','model','GetVoiceCallReport','catch','create','body','CreateVoiceCallReport','limit','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','VoiceCallReport','findAll','options','raw','where'];(function(_0x29d081,_0x33e570){var _0x531aee=function(_0x1a3929){while(--_0x1a3929){_0x29d081['push'](_0x29d081['shift']());}};_0x531aee(++_0x33e570);}(_0xaa31,0x115));var _0x1aa3=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xaa31[_0x20ef64];return _0x3707d8;};'use strict';var _=require('lodash');var util=require(_0x1aa3('0x0'));var moment=require(_0x1aa3('0x1'));var BPromise=require(_0x1aa3('0x2'));var rs=require(_0x1aa3('0x3'));var fs=require('fs');var Redis=require(_0x1aa3('0x4'));var db=require(_0x1aa3('0x5'))['db'];var utils=require(_0x1aa3('0x6'));var logger=require(_0x1aa3('0x7'))(_0x1aa3('0x8'));var config=require(_0x1aa3('0x9'));var jayson=require(_0x1aa3('0xa'));var client=jayson[_0x1aa3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe52e8b,_0x60a4d1,_0x2b4140){return new BPromise(function(_0x441433,_0x1edb5c){return client[_0x1aa3('0xc')](_0xe52e8b,_0x2b4140)[_0x1aa3('0xd')](function(_0x393380){logger['info'](_0x1aa3('0xe'),_0x60a4d1,_0x1aa3('0xf'));logger[_0x1aa3('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x60a4d1,_0x1aa3('0xf'),JSON[_0x1aa3('0x11')](_0x393380));if(_0x393380[_0x1aa3('0x12')]){if(_0x393380[_0x1aa3('0x12')][_0x1aa3('0x13')]===0x1f4){logger[_0x1aa3('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x60a4d1,_0x393380[_0x1aa3('0x12')][_0x1aa3('0x14')]);return _0x1edb5c(_0x393380[_0x1aa3('0x12')][_0x1aa3('0x14')]);}logger['error'](_0x1aa3('0xe'),_0x60a4d1,_0x393380[_0x1aa3('0x12')][_0x1aa3('0x14')]);return _0x441433(_0x393380[_0x1aa3('0x12')][_0x1aa3('0x14')]);}else{logger[_0x1aa3('0x15')](_0x1aa3('0xe'),_0x60a4d1,_0x1aa3('0xf'));_0x441433(_0x393380['result']['message']);}})['catch'](function(_0x3c98f9){logger[_0x1aa3('0x12')](_0x1aa3('0xe'),_0x60a4d1,_0x3c98f9);_0x1edb5c(_0x3c98f9);});});}exports['GetVoiceCallReport']=function(_0x3ff8fc){var _0x1078c4=this;return new Promise(function(_0x3cbeb6,_0x3a5cfa){return db[_0x1aa3('0x16')][_0x1aa3('0x17')]({'raw':_0x3ff8fc[_0x1aa3('0x18')]?_0x3ff8fc[_0x1aa3('0x18')][_0x1aa3('0x19')]===undefined?!![]:![]:!![],'where':_0x3ff8fc[_0x1aa3('0x18')]?_0x3ff8fc[_0x1aa3('0x18')][_0x1aa3('0x1a')]||null:null,'attributes':_0x3ff8fc[_0x1aa3('0x18')]?_0x3ff8fc[_0x1aa3('0x18')][_0x1aa3('0x1b')]||null:null,'limit':_0x3ff8fc['options']?_0x3ff8fc[_0x1aa3('0x18')]['limit']||null:null,'include':_0x3ff8fc[_0x1aa3('0x18')]?_0x3ff8fc[_0x1aa3('0x18')][_0x1aa3('0x1c')]?_[_0x1aa3('0x1d')](_0x3ff8fc[_0x1aa3('0x18')]['include'],function(_0xc33bc0){return{'model':db[_0xc33bc0['model']],'as':_0xc33bc0['as'],'attributes':_0xc33bc0[_0x1aa3('0x1b')],'include':_0xc33bc0['include']?_[_0x1aa3('0x1d')](_0xc33bc0['include'],function(_0xb5ebbf){return{'model':db[_0xb5ebbf[_0x1aa3('0x1e')]],'as':_0xb5ebbf['as'],'attributes':_0xb5ebbf['attributes'],'include':_0xb5ebbf[_0x1aa3('0x1c')]?_['map'](_0xb5ebbf[_0x1aa3('0x1c')],function(_0x5df54a){return{'model':db[_0x5df54a[_0x1aa3('0x1e')]],'as':_0x5df54a['as'],'attributes':_0x5df54a[_0x1aa3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1aa3('0xd')](function(_0x3b3289){logger[_0x1aa3('0x15')]('GetVoiceCallReport',_0x3ff8fc);logger['debug'](_0x1aa3('0x1f'),_0x3ff8fc,JSON[_0x1aa3('0x11')](_0x3b3289));_0x3cbeb6(_0x3b3289);})[_0x1aa3('0x20')](function(_0x44457c){logger['error'](_0x1aa3('0x1f'),_0x44457c[_0x1aa3('0x14')],_0x3ff8fc);_0x3a5cfa(_0x1078c4[_0x1aa3('0x12')](0x1f4,_0x44457c['message']));});});};exports['CreateVoiceCallReport']=function(_0x5f45ed){var _0x128482=this;return new Promise(function(_0x2ee42a,_0xa02818){return db['VoiceCallReport'][_0x1aa3('0x21')](_0x5f45ed[_0x1aa3('0x22')],{'raw':_0x5f45ed[_0x1aa3('0x18')]?_0x5f45ed[_0x1aa3('0x18')][_0x1aa3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12f2b2){logger[_0x1aa3('0x15')](_0x1aa3('0x23'),_0x5f45ed);logger['debug'](_0x1aa3('0x23'),_0x5f45ed,JSON['stringify'](_0x12f2b2));_0x2ee42a(_0x12f2b2);})[_0x1aa3('0x20')](function(_0x5d0282){logger[_0x1aa3('0x12')](_0x1aa3('0x23'),_0x5d0282['message'],_0x5f45ed);_0xa02818(_0x128482[_0x1aa3('0x12')](0x1f4,_0x5d0282[_0x1aa3('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x1ec41b){var _0x332a2c=this;return new Promise(function(_0x39f731,_0x45f7e2){return db[_0x1aa3('0x16')]['update'](_0x1ec41b[_0x1aa3('0x22')],{'raw':_0x1ec41b[_0x1aa3('0x18')]?_0x1ec41b[_0x1aa3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec41b[_0x1aa3('0x18')]?_0x1ec41b[_0x1aa3('0x18')]['where']||null:null,'attributes':_0x1ec41b[_0x1aa3('0x18')]?_0x1ec41b[_0x1aa3('0x18')]['attributes']||null:null,'limit':_0x1ec41b['options']?_0x1ec41b[_0x1aa3('0x18')][_0x1aa3('0x24')]||null:null})[_0x1aa3('0xd')](function(_0x38ec6e){logger[_0x1aa3('0x15')](_0x1aa3('0x25'),_0x1ec41b);logger[_0x1aa3('0x10')](_0x1aa3('0x25'),_0x1ec41b,JSON['stringify'](_0x38ec6e));_0x39f731(_0x38ec6e);})[_0x1aa3('0x20')](function(_0x37ee6b){logger['error'](_0x1aa3('0x25'),_0x37ee6b[_0x1aa3('0x14')],_0x1ec41b);_0x45f7e2(_0x332a2c[_0x1aa3('0x12')](0x1f4,_0x37ee6b[_0x1aa3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6b13581..e0bb594 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 _0x6672=['show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated'];(function(_0x17de8f,_0x2d5177){var _0xc19ec4=function(_0x3424c0){while(--_0x3424c0){_0x17de8f['push'](_0x17de8f['shift']());}};_0xc19ec4(++_0x2d5177);}(_0x6672,0x1af));var _0x2667=function(_0x13639d,_0x3c996b){_0x13639d=_0x13639d-0x0;var _0x52ef14=_0x6672[_0x13639d];return _0x52ef14;};'use strict';var multer=require('multer');var util=require(_0x2667('0x0'));var path=require(_0x2667('0x1'));var timeout=require(_0x2667('0x2'));var express=require(_0x2667('0x3'));var router=express[_0x2667('0x4')]();var fs_extra=require(_0x2667('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2667('0x6'));var controller=require(_0x2667('0x7'));router[_0x2667('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2667('0x8')](_0x2667('0x9'),auth[_0x2667('0xa')](),controller[_0x2667('0xb')]);router[_0x2667('0xc')]('/',auth[_0x2667('0xa')](),controller[_0x2667('0xd')]);router['put'](_0x2667('0x9'),auth[_0x2667('0xa')](),controller['update']);router[_0x2667('0xe')]('/:id',auth[_0x2667('0xa')](),controller[_0x2667('0xf')]);module[_0x2667('0x10')]=router; \ No newline at end of file +var _0x7fee=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','post','create','put','/:id','isAuthenticated','destroy','multer','util','connect-timeout','express','Router'];(function(_0x12d6c6,_0x988608){var _0x1821be=function(_0x3d25d5){while(--_0x3d25d5){_0x12d6c6['push'](_0x12d6c6['shift']());}};_0x1821be(++_0x988608);}(_0x7fee,0xa5));var _0xe7fe=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x7fee[_0x365e54];return _0x13317a;};'use strict';var multer=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var path=require('path');var timeout=require(_0xe7fe('0x2'));var express=require(_0xe7fe('0x3'));var router=express[_0xe7fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7fe('0x5'));var interaction=require(_0xe7fe('0x6'));var config=require(_0xe7fe('0x7'));var controller=require(_0xe7fe('0x8'));router[_0xe7fe('0x9')]('/',auth['isAuthenticated'](),controller[_0xe7fe('0xa')]);router[_0xe7fe('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe7fe('0xb')]('/',auth['isAuthenticated'](),controller[_0xe7fe('0xc')]);router[_0xe7fe('0xd')](_0xe7fe('0xe'),auth[_0xe7fe('0xf')](),controller['update']);router['delete'](_0xe7fe('0xe'),auth[_0xe7fe('0xf')](),controller[_0xe7fe('0x10')]);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 0ff283a..ad73ff0 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 _0x2141=['BOOLEAN','sequelize','exports','STRING','options','join','getDataValue','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2141,0xf1));var _0x1214=function(_0x5725cd,_0x42a9ef){_0x5725cd=_0x5725cd-0x0;var _0x529deb=_0x2141[_0x5725cd];return _0x529deb;};'use strict';var Sequelize=require(_0x1214('0x0'));module[_0x1214('0x1')]={'name':{'type':Sequelize[_0x1214('0x2')]},'prefix':{'type':Sequelize[_0x1214('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1214('0x2')],'set':function(_0x479499){this['setDataValue'](_0x1214('0x3'),_0x479499?_0x479499[_0x1214('0x4')](''):[]);},'get':function(){return this[_0x1214('0x5')](_0x1214('0x3'))?this[_0x1214('0x5')](_0x1214('0x3'))[_0x1214('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x1214('0x2')]},'record':{'type':Sequelize[_0x1214('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1214('0x2')]}}; \ No newline at end of file +var _0xb553=['STRING','options','join','getDataValue','BOOLEAN'];(function(_0x19712b,_0x3473bd){var _0x184b02=function(_0x5eb7eb){while(--_0x5eb7eb){_0x19712b['push'](_0x19712b['shift']());}};_0x184b02(++_0x3473bd);}(_0xb553,0x73));var _0x3b55=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xb553[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x3b55('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x3b55('0x0')],'set':function(_0x1fdb4c){this['setDataValue'](_0x3b55('0x1'),_0x1fdb4c?_0x1fdb4c[_0x3b55('0x2')](''):[]);},'get':function(){return this[_0x3b55('0x3')](_0x3b55('0x1'))?this[_0x3b55('0x3')](_0x3b55('0x1'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x3b55('0x4')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3b55('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 296700e..a218887 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 _0x833b=['undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChanSpies','UserProfileResource','then','error','stack','index','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x833b,0x131));var _0xb833=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x833b[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb833('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb833('0x1'));var rp=require('request-promise');var moment=require(_0xb833('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb833('0x3'));var util=require(_0xb833('0x4'));var path=require(_0xb833('0x5'));var sox=require(_0xb833('0x6'));var csv=require(_0xb833('0x7'));var ejs=require(_0xb833('0x8'));var fs=require('fs');var fs_extra=require(_0xb833('0x9'));var _=require('lodash');var squel=require(_0xb833('0xa'));var crypto=require(_0xb833('0xb'));var jsforce=require(_0xb833('0xc'));var deskjs=require(_0xb833('0xd'));var toCsv=require(_0xb833('0x7'));var querystring=require(_0xb833('0xe'));var Papa=require(_0xb833('0xf'));var Redis=require('ioredis');var authService=require(_0xb833('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb833('0x11'));var hardwareService=require(_0xb833('0x12'));var logger=require(_0xb833('0x13'))(_0xb833('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb833('0x15'));var db=require(_0xb833('0x16'))['db'];function respondWithStatusCode(_0x487b39,_0x317f67){_0x317f67=_0x317f67||0xcc;return function(_0x5e79a0){if(_0x5e79a0){return _0x487b39[_0xb833('0x17')](_0x317f67);}return _0x487b39[_0xb833('0x18')](_0x317f67)[_0xb833('0x19')]();};}function respondWithResult(_0x3ae32b,_0x2f08cb){_0x2f08cb=_0x2f08cb||0xc8;return function(_0x42a8ac){if(_0x42a8ac){return _0x3ae32b[_0xb833('0x18')](_0x2f08cb)[_0xb833('0x1a')](_0x42a8ac);}};}function respondWithFilteredResult(_0x58d9b6,_0x30bdae){return function(_0x371871){if(_0x371871){var _0x480417=typeof _0x30bdae['offset']===_0xb833('0x1b')&&typeof _0x30bdae['limit']===_0xb833('0x1b');var _0x323d63=_0x371871['count'];var _0x36ce8f=_0x480417?0x0:_0x30bdae[_0xb833('0x1c')];var _0x5798e2=_0x480417?_0x371871[_0xb833('0x1d')]:_0x30bdae[_0xb833('0x1c')]+_0x30bdae[_0xb833('0x1e')];var _0x50a6e9;if(_0x5798e2>=_0x323d63){_0x5798e2=_0x323d63;_0x50a6e9=0xc8;}else{_0x50a6e9=0xce;}_0x58d9b6[_0xb833('0x18')](_0x50a6e9);return _0x58d9b6[_0xb833('0x1f')](_0xb833('0x20'),_0x36ce8f+'-'+_0x5798e2+'/'+_0x323d63)[_0xb833('0x1a')](_0x371871);}return null;};}function patchUpdates(_0x4a4ac4){return function(_0x5e4bc5){try{jsonpatch[_0xb833('0x21')](_0x5e4bc5,_0x4a4ac4,!![]);}catch(_0x2706d4){return BPromise[_0xb833('0x22')](_0x2706d4);}return _0x5e4bc5[_0xb833('0x23')]();};}function saveUpdates(_0x22f6eb,_0x166a79){return function(_0x52908c){if(_0x52908c){return _0x52908c[_0xb833('0x24')](_0x22f6eb)['then'](function(_0x50c037){return _0x50c037;});}return null;};}function removeEntity(_0x50b18c,_0x2fa0d0){return function(_0x9e7cdb){if(_0x9e7cdb){return _0x9e7cdb[_0xb833('0x25')]()['then'](function(){var _0x191349=_0x9e7cdb[_0xb833('0x26')]({'plain':!![]});var _0x48f3ad=_0xb833('0x27');return db[_0xb833('0x28')]['destroy']({'where':{'type':_0x48f3ad,'resourceId':_0x191349['id']}})[_0xb833('0x29')](function(){return _0x9e7cdb;});})['then'](function(){_0x50b18c[_0xb833('0x18')](0xcc)[_0xb833('0x19')]();});}};}function handleEntityNotFound(_0x471854,_0x494c20){return function(_0x3ff6f9){if(!_0x3ff6f9){_0x471854[_0xb833('0x17')](0x194);}return _0x3ff6f9;};}function handleError(_0x273b9f,_0x53e699){_0x53e699=_0x53e699||0x1f4;return function(_0x148ef3){logger[_0xb833('0x2a')](_0x148ef3[_0xb833('0x2b')]);if(_0x148ef3['name']){delete _0x148ef3['name'];}_0x273b9f[_0xb833('0x18')](_0x53e699)['send'](_0x148ef3);};}exports[_0xb833('0x2c')]=function(_0x3854e7,_0x3d910f){var _0x3fe5b0={},_0xcefd9d={},_0x183ed2={'count':0x0,'rows':[]};var _0x514532=_['map'](db[_0xb833('0x2d')][_0xb833('0x2e')],function(_0x3f62de){return{'name':_0x3f62de[_0xb833('0x2f')],'type':_0x3f62de[_0xb833('0x30')][_0xb833('0x31')]};});_0xcefd9d['model']=_['map'](_0x514532,'name');_0xcefd9d[_0xb833('0x32')]=_[_0xb833('0x33')](_0x3854e7[_0xb833('0x32')]);_0xcefd9d[_0xb833('0x34')]=_[_0xb833('0x35')](_0xcefd9d[_0xb833('0x36')],_0xcefd9d[_0xb833('0x32')]);_0x3fe5b0[_0xb833('0x37')]=_[_0xb833('0x35')](_0xcefd9d[_0xb833('0x36')],qs[_0xb833('0x38')](_0x3854e7[_0xb833('0x32')][_0xb833('0x38')]));_0x3fe5b0['attributes']=_0x3fe5b0[_0xb833('0x37')]['length']?_0x3fe5b0[_0xb833('0x37')]:_0xcefd9d['model'];if(!_0x3854e7[_0xb833('0x32')]['hasOwnProperty'](_0xb833('0x39'))){_0x3fe5b0[_0xb833('0x1e')]=qs[_0xb833('0x1e')](_0x3854e7[_0xb833('0x32')]['limit']);_0x3fe5b0[_0xb833('0x1c')]=qs[_0xb833('0x1c')](_0x3854e7[_0xb833('0x32')]['offset']);}_0x3fe5b0[_0xb833('0x3a')]=qs[_0xb833('0x3b')](_0x3854e7[_0xb833('0x32')][_0xb833('0x3b')]);_0x3fe5b0[_0xb833('0x3c')]=qs[_0xb833('0x34')](_[_0xb833('0x3d')](_0x3854e7[_0xb833('0x32')],_0xcefd9d[_0xb833('0x34')]),_0x514532);if(_0x3854e7[_0xb833('0x32')]['filter']){_0x3fe5b0[_0xb833('0x3c')]=_[_0xb833('0x3e')](_0x3fe5b0['where'],{'$or':_['map'](_0x514532,function(_0x417c11){if(_0x417c11['type']!==_0xb833('0x3f')){var _0x4a982a={};_0x4a982a[_0x417c11[_0xb833('0x40')]]={'$like':'%'+_0x3854e7[_0xb833('0x32')][_0xb833('0x41')]+'%'};return _0x4a982a;}})});}_0x3fe5b0=_[_0xb833('0x3e')]({},_0x3fe5b0,_0x3854e7[_0xb833('0x42')]);var _0x472d5c={'where':_0x3fe5b0['where']};return db[_0xb833('0x2d')]['count'](_0x472d5c)[_0xb833('0x29')](function(_0x46e5df){_0x183ed2[_0xb833('0x1d')]=_0x46e5df;if(_0x3854e7['query'][_0xb833('0x43')]){_0x3fe5b0[_0xb833('0x44')]=[{'all':!![]}];}return db[_0xb833('0x2d')][_0xb833('0x45')](_0x3fe5b0);})['then'](function(_0x544c05){_0x183ed2[_0xb833('0x46')]=_0x544c05;return _0x183ed2;})[_0xb833('0x29')](respondWithFilteredResult(_0x3d910f,_0x3fe5b0))[_0xb833('0x47')](handleError(_0x3d910f,null));};exports[_0xb833('0x48')]=function(_0x3d652e,_0x2a1a82){var _0x45d0b6={'raw':![],'where':{'id':_0x3d652e[_0xb833('0x49')]['id']}},_0x523886={};_0x523886[_0xb833('0x36')]=_[_0xb833('0x33')](db['VoiceChanSpy']['rawAttributes']);_0x523886[_0xb833('0x32')]=_['keys'](_0x3d652e[_0xb833('0x32')]);_0x523886[_0xb833('0x34')]=_['intersection'](_0x523886[_0xb833('0x36')],_0x523886[_0xb833('0x32')]);_0x45d0b6[_0xb833('0x37')]=_[_0xb833('0x35')](_0x523886[_0xb833('0x36')],qs[_0xb833('0x38')](_0x3d652e['query'][_0xb833('0x38')]));_0x45d0b6[_0xb833('0x37')]=_0x45d0b6[_0xb833('0x37')]['length']?_0x45d0b6[_0xb833('0x37')]:_0x523886[_0xb833('0x36')];if(_0x3d652e[_0xb833('0x32')]['includeAll']){_0x45d0b6['include']=[{'all':!![]}];}_0x45d0b6=_[_0xb833('0x3e')]({},_0x45d0b6,_0x3d652e['options']);return db['VoiceChanSpy'][_0xb833('0x4a')](_0x45d0b6)[_0xb833('0x29')](handleEntityNotFound(_0x2a1a82,null))[_0xb833('0x29')](respondWithResult(_0x2a1a82,null))['catch'](handleError(_0x2a1a82,null));};exports[_0xb833('0x4b')]=function(_0x3fca78,_0xda43de){return db[_0xb833('0x2d')][_0xb833('0x4b')](_0x3fca78['body'],{})[_0xb833('0x29')](function(_0x5027df){var _0xfcd530=_0x3fca78[_0xb833('0x4c')][_0xb833('0x26')]({'plain':!![]});if(!_0xfcd530)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcd530[_0xb833('0x4d')]===_0xb833('0x4c')){var _0x163897=_0x5027df['get']({'plain':!![]});var _0x5bcf0c='ChanSpies';return db[_0xb833('0x4e')]['find']({'where':{'name':_0x5bcf0c,'userProfileId':_0xfcd530[_0xb833('0x4f')]},'raw':!![]})[_0xb833('0x29')](function(_0x20601f){if(_0x20601f&&_0x20601f[_0xb833('0x50')]===0x0){return db['UserProfileResource'][_0xb833('0x4b')]({'name':_0x163897[_0xb833('0x40')],'resourceId':_0x163897['id'],'type':_0x20601f[_0xb833('0x40')],'sectionId':_0x20601f['id']},{})[_0xb833('0x29')](function(){return _0x5027df;});}else{return _0x5027df;}})[_0xb833('0x47')](function(_0xafeee3){logger[_0xb833('0x2a')](_0xb833('0x51'),_0xafeee3);throw _0xafeee3;});}return _0x5027df;})['then'](respondWithResult(_0xda43de,0xc9))[_0xb833('0x47')](handleError(_0xda43de,null));};exports[_0xb833('0x24')]=function(_0x443b55,_0x2f6408){if(_0x443b55['body']['id']){delete _0x443b55[_0xb833('0x52')]['id'];}return db['VoiceChanSpy'][_0xb833('0x4a')]({'where':{'id':_0x443b55[_0xb833('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f6408,null))[_0xb833('0x29')](saveUpdates(_0x443b55[_0xb833('0x52')],null))[_0xb833('0x29')](respondWithResult(_0x2f6408,null))[_0xb833('0x47')](handleError(_0x2f6408,null));};exports[_0xb833('0x25')]=function(_0x5bfb74,_0xf34f19){return db[_0xb833('0x2d')]['find']({'where':{'id':_0x5bfb74[_0xb833('0x49')]['id']}})['then'](handleEntityNotFound(_0xf34f19,null))[_0xb833('0x29')](removeEntity(_0xf34f19,null))[_0xb833('0x47')](handleError(_0xf34f19,null));}; \ No newline at end of file +var _0x843b=['order','sort','where','pick','merge','map','type','filter','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','then','destroy','get','end','error','stack','name','send','index','VoiceChanSpy','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x843b,0xc5));var _0xb843=function(_0x5114a3,_0xda4450){_0x5114a3=_0x5114a3-0x0;var _0x5ac2fe=_0x843b[_0x5114a3];return _0x5ac2fe;};'use strict';var emlformat=require(_0xb843('0x0'));var rimraf=require(_0xb843('0x1'));var zipdir=require(_0xb843('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb843('0x3'));var moment=require(_0xb843('0x4'));var BPromise=require(_0xb843('0x5'));var Mustache=require(_0xb843('0x6'));var util=require(_0xb843('0x7'));var path=require(_0xb843('0x8'));var sox=require(_0xb843('0x9'));var csv=require(_0xb843('0xa'));var ejs=require(_0xb843('0xb'));var fs=require('fs');var fs_extra=require(_0xb843('0xc'));var _=require(_0xb843('0xd'));var squel=require(_0xb843('0xe'));var crypto=require(_0xb843('0xf'));var jsforce=require(_0xb843('0x10'));var deskjs=require(_0xb843('0x11'));var toCsv=require(_0xb843('0xa'));var querystring=require('querystring');var Papa=require(_0xb843('0x12'));var Redis=require(_0xb843('0x13'));var authService=require(_0xb843('0x14'));var qs=require(_0xb843('0x15'));var as=require(_0xb843('0x16'));var hardwareService=require(_0xb843('0x17'));var logger=require(_0xb843('0x18'))('api');var utils=require(_0xb843('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb843('0x1a'));var db=require(_0xb843('0x1b'))['db'];function respondWithStatusCode(_0x2fc2a9,_0x3ab55e){_0x3ab55e=_0x3ab55e||0xcc;return function(_0x2f8e71){if(_0x2f8e71){return _0x2fc2a9[_0xb843('0x1c')](_0x3ab55e);}return _0x2fc2a9[_0xb843('0x1d')](_0x3ab55e)['end']();};}function respondWithResult(_0x5a7cc6,_0x17e748){_0x17e748=_0x17e748||0xc8;return function(_0x2986b7){if(_0x2986b7){return _0x5a7cc6['status'](_0x17e748)['json'](_0x2986b7);}};}function respondWithFilteredResult(_0xa6984,_0x3d9ce2){return function(_0x1c4a1c){if(_0x1c4a1c){var _0x58b770=typeof _0x3d9ce2[_0xb843('0x1e')]===_0xb843('0x1f')&&typeof _0x3d9ce2[_0xb843('0x20')]===_0xb843('0x1f');var _0x15a892=_0x1c4a1c[_0xb843('0x21')];var _0x1925b3=_0x58b770?0x0:_0x3d9ce2[_0xb843('0x1e')];var _0x5035f3=_0x58b770?_0x1c4a1c[_0xb843('0x21')]:_0x3d9ce2[_0xb843('0x1e')]+_0x3d9ce2[_0xb843('0x20')];var _0x40e8e0;if(_0x5035f3>=_0x15a892){_0x5035f3=_0x15a892;_0x40e8e0=0xc8;}else{_0x40e8e0=0xce;}_0xa6984[_0xb843('0x1d')](_0x40e8e0);return _0xa6984['set']('Content-Range',_0x1925b3+'-'+_0x5035f3+'/'+_0x15a892)[_0xb843('0x22')](_0x1c4a1c);}return null;};}function patchUpdates(_0x33abbb){return function(_0x4c8d8b){try{jsonpatch[_0xb843('0x23')](_0x4c8d8b,_0x33abbb,!![]);}catch(_0x208036){return BPromise[_0xb843('0x24')](_0x208036);}return _0x4c8d8b[_0xb843('0x25')]();};}function saveUpdates(_0x44dadc,_0x3215be){return function(_0x2e56a8){if(_0x2e56a8){return _0x2e56a8['update'](_0x44dadc)[_0xb843('0x26')](function(_0x1afd57){return _0x1afd57;});}return null;};}function removeEntity(_0x53a689,_0x395045){return function(_0x33c3a4){if(_0x33c3a4){return _0x33c3a4[_0xb843('0x27')]()['then'](function(){var _0x218816=_0x33c3a4[_0xb843('0x28')]({'plain':!![]});var _0x3d771d='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x3d771d,'resourceId':_0x218816['id']}})[_0xb843('0x26')](function(){return _0x33c3a4;});})[_0xb843('0x26')](function(){_0x53a689['status'](0xcc)[_0xb843('0x29')]();});}};}function handleEntityNotFound(_0x211cf9,_0xe5ae4e){return function(_0x425f9d){if(!_0x425f9d){_0x211cf9[_0xb843('0x1c')](0x194);}return _0x425f9d;};}function handleError(_0x16a692,_0x4e4b9f){_0x4e4b9f=_0x4e4b9f||0x1f4;return function(_0xd9565c){logger[_0xb843('0x2a')](_0xd9565c[_0xb843('0x2b')]);if(_0xd9565c['name']){delete _0xd9565c[_0xb843('0x2c')];}_0x16a692[_0xb843('0x1d')](_0x4e4b9f)[_0xb843('0x2d')](_0xd9565c);};}exports[_0xb843('0x2e')]=function(_0x4372e8,_0x5d8a72){var _0x32f057={},_0x21ae06={},_0x5b6360={'count':0x0,'rows':[]};var _0x72fbfe=_['map'](db[_0xb843('0x2f')][_0xb843('0x30')],function(_0x50b6b7){return{'name':_0x50b6b7['fieldName'],'type':_0x50b6b7['type'][_0xb843('0x31')]};});_0x21ae06[_0xb843('0x32')]=_['map'](_0x72fbfe,_0xb843('0x2c'));_0x21ae06[_0xb843('0x33')]=_[_0xb843('0x34')](_0x4372e8[_0xb843('0x33')]);_0x21ae06[_0xb843('0x35')]=_['intersection'](_0x21ae06[_0xb843('0x32')],_0x21ae06[_0xb843('0x33')]);_0x32f057[_0xb843('0x36')]=_[_0xb843('0x37')](_0x21ae06['model'],qs[_0xb843('0x38')](_0x4372e8[_0xb843('0x33')][_0xb843('0x38')]));_0x32f057['attributes']=_0x32f057[_0xb843('0x36')][_0xb843('0x39')]?_0x32f057[_0xb843('0x36')]:_0x21ae06[_0xb843('0x32')];if(!_0x4372e8[_0xb843('0x33')]['hasOwnProperty']('nolimit')){_0x32f057[_0xb843('0x20')]=qs['limit'](_0x4372e8[_0xb843('0x33')][_0xb843('0x20')]);_0x32f057[_0xb843('0x1e')]=qs[_0xb843('0x1e')](_0x4372e8[_0xb843('0x33')][_0xb843('0x1e')]);}_0x32f057[_0xb843('0x3a')]=qs[_0xb843('0x3b')](_0x4372e8[_0xb843('0x33')]['sort']);_0x32f057[_0xb843('0x3c')]=qs[_0xb843('0x35')](_[_0xb843('0x3d')](_0x4372e8['query'],_0x21ae06[_0xb843('0x35')]),_0x72fbfe);if(_0x4372e8['query']['filter']){_0x32f057[_0xb843('0x3c')]=_[_0xb843('0x3e')](_0x32f057['where'],{'$or':_[_0xb843('0x3f')](_0x72fbfe,function(_0x247bb1){if(_0x247bb1[_0xb843('0x40')]!=='VIRTUAL'){var _0x264cbb={};_0x264cbb[_0x247bb1[_0xb843('0x2c')]]={'$like':'%'+_0x4372e8['query'][_0xb843('0x41')]+'%'};return _0x264cbb;}})});}_0x32f057=_[_0xb843('0x3e')]({},_0x32f057,_0x4372e8[_0xb843('0x42')]);var _0x2a9a56={'where':_0x32f057[_0xb843('0x3c')]};return db[_0xb843('0x2f')][_0xb843('0x21')](_0x2a9a56)[_0xb843('0x26')](function(_0x5399af){_0x5b6360[_0xb843('0x21')]=_0x5399af;if(_0x4372e8['query'][_0xb843('0x43')]){_0x32f057[_0xb843('0x44')]=[{'all':!![]}];}return db[_0xb843('0x2f')][_0xb843('0x45')](_0x32f057);})[_0xb843('0x26')](function(_0x518ce0){_0x5b6360['rows']=_0x518ce0;return _0x5b6360;})[_0xb843('0x26')](respondWithFilteredResult(_0x5d8a72,_0x32f057))[_0xb843('0x46')](handleError(_0x5d8a72,null));};exports['show']=function(_0x33f7fa,_0x4a0886){var _0x5e479a={'raw':![],'where':{'id':_0x33f7fa[_0xb843('0x47')]['id']}},_0x5be25f={};_0x5be25f[_0xb843('0x32')]=_[_0xb843('0x34')](db[_0xb843('0x2f')][_0xb843('0x30')]);_0x5be25f['query']=_[_0xb843('0x34')](_0x33f7fa[_0xb843('0x33')]);_0x5be25f['filters']=_[_0xb843('0x37')](_0x5be25f[_0xb843('0x32')],_0x5be25f[_0xb843('0x33')]);_0x5e479a[_0xb843('0x36')]=_[_0xb843('0x37')](_0x5be25f[_0xb843('0x32')],qs[_0xb843('0x38')](_0x33f7fa[_0xb843('0x33')][_0xb843('0x38')]));_0x5e479a[_0xb843('0x36')]=_0x5e479a['attributes']['length']?_0x5e479a[_0xb843('0x36')]:_0x5be25f[_0xb843('0x32')];if(_0x33f7fa[_0xb843('0x33')]['includeAll']){_0x5e479a['include']=[{'all':!![]}];}_0x5e479a=_[_0xb843('0x3e')]({},_0x5e479a,_0x33f7fa['options']);return db[_0xb843('0x2f')][_0xb843('0x48')](_0x5e479a)[_0xb843('0x26')](handleEntityNotFound(_0x4a0886,null))[_0xb843('0x26')](respondWithResult(_0x4a0886,null))[_0xb843('0x46')](handleError(_0x4a0886,null));};exports[_0xb843('0x49')]=function(_0x2fedeb,_0x4f2d1f){return db[_0xb843('0x2f')]['create'](_0x2fedeb[_0xb843('0x4a')],{})[_0xb843('0x26')](function(_0x1bc128){var _0x4ce885=_0x2fedeb[_0xb843('0x4b')][_0xb843('0x28')]({'plain':!![]});if(!_0x4ce885)throw new Error(_0xb843('0x4c'));if(_0x4ce885[_0xb843('0x4d')]===_0xb843('0x4b')){var _0x4aff81=_0x1bc128[_0xb843('0x28')]({'plain':!![]});var _0xff480d=_0xb843('0x4e');return db[_0xb843('0x4f')][_0xb843('0x48')]({'where':{'name':_0xff480d,'userProfileId':_0x4ce885[_0xb843('0x50')]},'raw':!![]})['then'](function(_0x58d3d4){if(_0x58d3d4&&_0x58d3d4[_0xb843('0x51')]===0x0){return db[_0xb843('0x52')]['create']({'name':_0x4aff81[_0xb843('0x2c')],'resourceId':_0x4aff81['id'],'type':_0x58d3d4[_0xb843('0x2c')],'sectionId':_0x58d3d4['id']},{})[_0xb843('0x26')](function(){return _0x1bc128;});}else{return _0x1bc128;}})['catch'](function(_0x1e6ebb){logger[_0xb843('0x2a')](_0xb843('0x53'),_0x1e6ebb);throw _0x1e6ebb;});}return _0x1bc128;})[_0xb843('0x26')](respondWithResult(_0x4f2d1f,0xc9))[_0xb843('0x46')](handleError(_0x4f2d1f,null));};exports[_0xb843('0x54')]=function(_0x143344,_0x38b10f){if(_0x143344[_0xb843('0x4a')]['id']){delete _0x143344[_0xb843('0x4a')]['id'];}return db[_0xb843('0x2f')]['find']({'where':{'id':_0x143344['params']['id']}})[_0xb843('0x26')](handleEntityNotFound(_0x38b10f,null))[_0xb843('0x26')](saveUpdates(_0x143344[_0xb843('0x4a')],null))[_0xb843('0x26')](respondWithResult(_0x38b10f,null))[_0xb843('0x46')](handleError(_0x38b10f,null));};exports[_0xb843('0x27')]=function(_0x1d3e27,_0x48ded3){return db[_0xb843('0x2f')][_0xb843('0x48')]({'where':{'id':_0x1d3e27[_0xb843('0x47')]['id']}})[_0xb843('0x26')](handleEntityNotFound(_0x48ded3,null))['then'](removeEntity(_0x48ded3,null))[_0xb843('0x46')](handleError(_0x48ded3,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4757aeb..c12e547 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 _0x2524=['StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options'];(function(_0x49e69b,_0x53b781){var _0x215da0=function(_0x58f3e0){while(--_0x58f3e0){_0x49e69b['push'](_0x49e69b['shift']());}};_0x215da0(++_0x53b781);}(_0x2524,0x1b0));var _0x4252=function(_0x11cf13,_0x2ae3a0){_0x11cf13=_0x11cf13-0x0;var _0x339e2c=_0x2524[_0x11cf13];return _0x339e2c;};'use strict';var _=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var BPromise=require(_0x4252('0x2'));var attributes=require(_0x4252('0x3'));var getUserApplications=function(_0xd09eaf,_0x119ceb,_0x5eb8d0){var _0x46b16b=0x1;var _0x460de7=[];var _0x10cdcc={'context':_0x119ceb[_0x4252('0x4')]||_0x4252('0x5'),'exten':util[_0x4252('0x6')](_0x4252('0x7'),_0xd09eaf[_0x4252('0x8')],_0x5eb8d0),'type':_0x4252('0x9'),'isApp':![],'ChanSpyId':_0xd09eaf['id'],'UserId':_0x119ceb['id']};_0x460de7[_0x4252('0xa')](_['merge']({'app':_0x4252('0xb'),'appdata':util[_0x4252('0x6')](_0x4252('0xc'),_0x4252('0xd')),'priority':_0x46b16b++},_0x10cdcc));if(_0xd09eaf[_0x4252('0xe')]){_0x460de7[_0x4252('0xa')](_[_0x4252('0xf')]({'app':_0x4252('0x10'),'appdata':util['format'](_0x4252('0x11'),_0xd09eaf[_0x4252('0x12')]),'priority':_0x46b16b++},_0x10cdcc));}if(_0xd09eaf['auth']){_0x460de7[_0x4252('0xa')](_[_0x4252('0xf')]({'app':_0x4252('0x13'),'appdata':_0xd09eaf['password'],'priority':_0x46b16b++},_0x10cdcc));}_0x460de7['push'](_[_0x4252('0xf')]({'app':_0x4252('0x14'),'appdata':util[_0x4252('0x6')](_0x4252('0x15'),_0x119ceb[_0x4252('0x16')],_0xd09eaf[_0x4252('0x17')]?_0xd09eaf['options']['join'](''):''),'priority':_0x46b16b++},_0x10cdcc));if(_0xd09eaf[_0x4252('0xe')]){_0x460de7[_0x4252('0xa')](_[_0x4252('0xf')]({'app':_0x4252('0x18'),'priority':_0x46b16b++},_0x10cdcc));}return _0x460de7;};var getChanSpyApplications=function(_0x2b808b,_0x394f58){var _0x555443=[];for(var _0x52c4c1=0x0,_0x14b5d6=0x1;_0x52c4c1<_0x394f58[_0x4252('0x19')];_0x52c4c1++,_0x14b5d6=0x1){_0x555443=_0x555443[_0x4252('0x1a')](getUserApplications(_0x2b808b,_0x394f58[_0x52c4c1],_0x394f58[_0x52c4c1][_0x4252('0x1b')]));if(_0x394f58[_0x52c4c1]['internal']!=_0x394f58[_0x52c4c1][_0x4252('0x16')]){_0x555443=_0x555443[_0x4252('0x1a')](getUserApplications(_0x2b808b,_0x394f58[_0x52c4c1],_0x394f58[_0x52c4c1][_0x4252('0x16')]));}}return _0x555443;};var getChanSpyPromise=function(_0x447c2b,_0x57f13f){return new BPromise(function(_0x4214cd,_0x107846){return _0x447c2b[_0x4252('0x1c')][_0x4252('0x1d')]({'attributes':['id',_0x4252('0x16'),_0x4252('0x1b')],'where':{'role':_0x4252('0x1e'),'chanspy':!![]},'raw':!![]})[_0x4252('0x1f')](function(_0x1fbc60){if(_0x1fbc60){return _0x4214cd(getChanSpyApplications(_0x57f13f,_0x1fbc60));}return _0x4214cd([]);})[_0x4252('0x20')](function(_0x2c441d){_0x107846(_0x2c441d);});});};module['exports']=function(_0x484e42,_0x45e05f){var _0x1d1783=_0x484e42[_0x4252('0x21')];return _0x484e42['define'](_0x4252('0x22'),attributes,{'tableName':_0x4252('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26dc00,_0x1fae1f,_0x534467){return getChanSpyPromise(_0x1d1783,_0x26dc00)[_0x4252('0x1f')](function(_0x49b9a6){if(_0x49b9a6&&_0x49b9a6['length']){return _0x1d1783[_0x4252('0x24')][_0x4252('0x25')](_0x49b9a6);}})[_0x4252('0x1f')](function(){_0x534467();})[_0x4252('0x20')](function(_0x4d1d8b){_0x534467(_0x4d1d8b);});},'afterUpdate':function(_0x43f834,_0x142675,_0x1ba393){return _0x1d1783[_0x4252('0x24')]['destroy']({'where':{'ChanSpyId':_0x43f834['id']}})[_0x4252('0x1f')](function(){return getChanSpyPromise(_0x1d1783,_0x43f834);})[_0x4252('0x1f')](function(_0x260304){if(_0x260304&&_0x260304[_0x4252('0x19')]){return _0x1d1783[_0x4252('0x24')][_0x4252('0x25')](_0x260304);}})[_0x4252('0x1f')](function(){_0x1ba393();})[_0x4252('0x20')](function(_0x35059d){_0x1ba393(_0x35059d);});},'afterDestroy':function(_0x250079,_0x58798d,_0x3b920f){return _0x1d1783[_0x4252('0x24')]['destroy']({'where':{'ChanSpyId':_0x250079['id']}})[_0x4252('0x1f')](function(){_0x3b920f();})[_0x4252('0x20')](function(_0xc05b83){_0x3b920f(_0xc05b83);});}}});}; \ No newline at end of file +var _0x826d=['catch','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','length','concat','internal','User','findAll','agent','then','define','voice_chanspy','bulkCreate'];(function(_0x3c51a9,_0xf4cfb2){var _0x31b091=function(_0x1b56b7){while(--_0x1b56b7){_0x3c51a9['push'](_0x3c51a9['shift']());}};_0x31b091(++_0xf4cfb2);}(_0x826d,0xd4));var _0xd826=function(_0x969ba4,_0x3d80f9){_0x969ba4=_0x969ba4-0x0;var _0xebf7bd=_0x826d[_0x969ba4];return _0xebf7bd;};'use strict';var _=require('lodash');var util=require(_0xd826('0x0'));var BPromise=require('bluebird');var attributes=require(_0xd826('0x1'));var getUserApplications=function(_0x12967e,_0x5707c9,_0x1a9d17){var _0xb0703d=0x1;var _0xb916ba=[];var _0x1618ed={'context':_0x5707c9[_0xd826('0x2')]||_0xd826('0x3'),'exten':util[_0xd826('0x4')](_0xd826('0x5'),_0x12967e[_0xd826('0x6')],_0x1a9d17),'type':_0xd826('0x7'),'isApp':![],'ChanSpyId':_0x12967e['id'],'UserId':_0x5707c9['id']};_0xb916ba[_0xd826('0x8')](_['merge']({'app':_0xd826('0x9'),'appdata':util[_0xd826('0x4')](_0xd826('0xa'),_0xd826('0xb')),'priority':_0xb0703d++},_0x1618ed));if(_0x12967e[_0xd826('0xc')]){_0xb916ba['push'](_[_0xd826('0xd')]({'app':_0xd826('0xe'),'appdata':util['format'](_0xd826('0xf'),_0x12967e[_0xd826('0x10')]),'priority':_0xb0703d++},_0x1618ed));}if(_0x12967e['auth']){_0xb916ba[_0xd826('0x8')](_['merge']({'app':_0xd826('0x11'),'appdata':_0x12967e[_0xd826('0x12')],'priority':_0xb0703d++},_0x1618ed));}_0xb916ba[_0xd826('0x8')](_['merge']({'app':_0xd826('0x13'),'appdata':util[_0xd826('0x4')](_0xd826('0x14'),_0x5707c9[_0xd826('0x15')],_0x12967e['options']?_0x12967e['options'][_0xd826('0x16')](''):''),'priority':_0xb0703d++},_0x1618ed));if(_0x12967e[_0xd826('0xc')]){_0xb916ba[_0xd826('0x8')](_[_0xd826('0xd')]({'app':'StopMixMonitor','priority':_0xb0703d++},_0x1618ed));}return _0xb916ba;};var getChanSpyApplications=function(_0x435673,_0x548c95){var _0x33c824=[];for(var _0x50847c=0x0,_0x206ee7=0x1;_0x50847c<_0x548c95[_0xd826('0x17')];_0x50847c++,_0x206ee7=0x1){_0x33c824=_0x33c824[_0xd826('0x18')](getUserApplications(_0x435673,_0x548c95[_0x50847c],_0x548c95[_0x50847c][_0xd826('0x19')]));if(_0x548c95[_0x50847c][_0xd826('0x19')]!=_0x548c95[_0x50847c][_0xd826('0x15')]){_0x33c824=_0x33c824[_0xd826('0x18')](getUserApplications(_0x435673,_0x548c95[_0x50847c],_0x548c95[_0x50847c][_0xd826('0x15')]));}}return _0x33c824;};var getChanSpyPromise=function(_0xa6a5ce,_0x144060){return new BPromise(function(_0x53ddde,_0x3a1d16){return _0xa6a5ce[_0xd826('0x1a')][_0xd826('0x1b')]({'attributes':['id','name',_0xd826('0x19')],'where':{'role':_0xd826('0x1c'),'chanspy':!![]},'raw':!![]})[_0xd826('0x1d')](function(_0x314428){if(_0x314428){return _0x53ddde(getChanSpyApplications(_0x144060,_0x314428));}return _0x53ddde([]);})['catch'](function(_0x568762){_0x3a1d16(_0x568762);});});};module['exports']=function(_0x2812c1,_0x4960fa){var _0x35f2b6=_0x2812c1['models'];return _0x2812c1[_0xd826('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xd826('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xebf455,_0x2f5f66,_0x543092){return getChanSpyPromise(_0x35f2b6,_0xebf455)[_0xd826('0x1d')](function(_0x135e9f){if(_0x135e9f&&_0x135e9f[_0xd826('0x17')]){return _0x35f2b6['VoiceExtension'][_0xd826('0x20')](_0x135e9f);}})['then'](function(){_0x543092();})[_0xd826('0x21')](function(_0x4dd452){_0x543092(_0x4dd452);});},'afterUpdate':function(_0xf37633,_0x5384ea,_0x16ed7d){return _0x35f2b6['VoiceExtension'][_0xd826('0x22')]({'where':{'ChanSpyId':_0xf37633['id']}})[_0xd826('0x1d')](function(){return getChanSpyPromise(_0x35f2b6,_0xf37633);})[_0xd826('0x1d')](function(_0x47552c){if(_0x47552c&&_0x47552c[_0xd826('0x17')]){return _0x35f2b6['VoiceExtension'][_0xd826('0x20')](_0x47552c);}})['then'](function(){_0x16ed7d();})['catch'](function(_0xf4fa79){_0x16ed7d(_0xf4fa79);});},'afterDestroy':function(_0x1a552e,_0x11a394,_0x2191c8){return _0x35f2b6['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1a552e['id']}})[_0xd826('0x1d')](function(){_0x2191c8();})[_0xd826('0x21')](function(_0x309be2){_0x2191c8(_0x309be2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0a5b5f0..0ca0307 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 _0x4ea3=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0xa74f=['result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xa74f,0x9a));var _0xfa74=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xa74f[_0x39caaa];return _0x9b9c7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 9559ae3..fff1fdc 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 _0x80ab=['post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x80ab,0x143));var _0xb80a=function(_0x13f799,_0xcd593e){_0x13f799=_0x13f799-0x0;var _0x42c284=_0x80ab[_0x13f799];return _0x42c284;};'use strict';var multer=require('multer');var util=require(_0xb80a('0x0'));var path=require(_0xb80a('0x1'));var timeout=require(_0xb80a('0x2'));var express=require(_0xb80a('0x3'));var router=express[_0xb80a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb80a('0x5'));var interaction=require(_0xb80a('0x6'));var config=require(_0xb80a('0x7'));var controller=require(_0xb80a('0x8'));router[_0xb80a('0x9')]('/',auth[_0xb80a('0xa')](),controller[_0xb80a('0xb')]);router[_0xb80a('0x9')]('/:id',auth[_0xb80a('0xa')](),controller[_0xb80a('0xc')]);router[_0xb80a('0xd')]('/',auth[_0xb80a('0xa')](),controller[_0xb80a('0xe')]);router[_0xb80a('0xf')](_0xb80a('0x10'),auth['isAuthenticated'](),controller[_0xb80a('0x11')]);router[_0xb80a('0x12')](_0xb80a('0x10'),auth[_0xb80a('0xa')](),controller[_0xb80a('0x13')]);module[_0xb80a('0x14')]=router; \ No newline at end of file +var _0xe36b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','put','update','destroy','exports'];(function(_0x179ce5,_0x342952){var _0x1a6990=function(_0x57f31c){while(--_0x57f31c){_0x179ce5['push'](_0x179ce5['shift']());}};_0x1a6990(++_0x342952);}(_0xe36b,0x187));var _0xbe36=function(_0x22562b,_0x30dda4){_0x22562b=_0x22562b-0x0;var _0x57866c=_0xe36b[_0x22562b];return _0x57866c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe36('0x0'));var timeout=require(_0xbe36('0x1'));var express=require(_0xbe36('0x2'));var router=express[_0xbe36('0x3')]();var fs_extra=require(_0xbe36('0x4'));var auth=require(_0xbe36('0x5'));var interaction=require(_0xbe36('0x6'));var config=require(_0xbe36('0x7'));var controller=require('./voiceContext.controller');router[_0xbe36('0x8')]('/',auth['isAuthenticated'](),controller[_0xbe36('0x9')]);router['get'](_0xbe36('0xa'),auth[_0xbe36('0xb')](),controller['show']);router['post']('/',auth[_0xbe36('0xb')](),controller[_0xbe36('0xc')]);router[_0xbe36('0xd')](_0xbe36('0xa'),auth[_0xbe36('0xb')](),controller[_0xbe36('0xe')]);router['delete'](_0xbe36('0xa'),auth[_0xbe36('0xb')](),controller[_0xbe36('0xf')]);module[_0xbe36('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 82688b2..7c75f21 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 _0x9ab0=['STRING','name','BOOLEAN','exports'];(function(_0x3002b8,_0x2497b3){var _0x512ed4=function(_0x4b9a42){while(--_0x4b9a42){_0x3002b8['push'](_0x3002b8['shift']());}};_0x512ed4(++_0x2497b3);}(_0x9ab0,0x127));var _0x09ab=function(_0x13b406,_0x457548){_0x13b406=_0x13b406-0x0;var _0x5592f5=_0x9ab0[_0x13b406];return _0x5592f5;};'use strict';var Sequelize=require('sequelize');module[_0x09ab('0x0')]={'name':{'type':Sequelize[_0x09ab('0x1')],'unique':_0x09ab('0x2')},'description':{'type':Sequelize[_0x09ab('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x09ab('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1ee=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x4b736c,_0x18d185){var _0x236b90=function(_0xd4590){while(--_0xd4590){_0x4b736c['push'](_0x4b736c['shift']());}};_0x236b90(++_0x18d185);}(_0xb1ee,0x16d));var _0xeb1e=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0xb1ee[_0x115621];return _0x5ef5ce;};'use strict';var Sequelize=require(_0xeb1e('0x0'));module[_0xeb1e('0x1')]={'name':{'type':Sequelize[_0xeb1e('0x2')],'unique':_0xeb1e('0x3')},'description':{'type':Sequelize[_0xeb1e('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xeb1e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index cd25230..4fb1d77 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 _0xaa59=['utf8','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','params','readFileSync','render','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','destroy','Contexts','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','VoiceContext','findAll','rows','show','merge','find','create','body','join','root','server/files/templates/context.ejs'];(function(_0x36f6bf,_0x803e35){var _0x3d74dc=function(_0x204466){while(--_0x204466){_0x36f6bf['push'](_0x36f6bf['shift']());}};_0x3d74dc(++_0x803e35);}(_0xaa59,0x144));var _0x9aa5=function(_0x41257f,_0x5e0065){_0x41257f=_0x41257f-0x0;var _0xb5dff0=_0xaa59[_0x41257f];return _0xb5dff0;};'use strict';var emlformat=require(_0x9aa5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9aa5('0x1'));var jsonpatch=require(_0x9aa5('0x2'));var rp=require(_0x9aa5('0x3'));var moment=require('moment');var BPromise=require(_0x9aa5('0x4'));var Mustache=require('mustache');var util=require(_0x9aa5('0x5'));var path=require(_0x9aa5('0x6'));var sox=require(_0x9aa5('0x7'));var csv=require(_0x9aa5('0x8'));var ejs=require(_0x9aa5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9aa5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9aa5('0xb'));var deskjs=require(_0x9aa5('0xc'));var toCsv=require(_0x9aa5('0x8'));var querystring=require(_0x9aa5('0xd'));var Papa=require(_0x9aa5('0xe'));var Redis=require('ioredis');var authService=require(_0x9aa5('0xf'));var qs=require(_0x9aa5('0x10'));var as=require(_0x9aa5('0x11'));var hardwareService=require(_0x9aa5('0x12'));var logger=require(_0x9aa5('0x13'))(_0x9aa5('0x14'));var utils=require('../../config/utils');var config=require(_0x9aa5('0x15'));var licenseUtil=require(_0x9aa5('0x16'));var db=require(_0x9aa5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9aa5('0x18')][_0x9aa5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x418316,_0x1da63e,_0x2179e2,_0x24bb4c){return new BPromise(function(_0x16275d,_0x7e8cdf){var _0x4af2d4=_0x24bb4c||client;return _0x4af2d4['request'](_0x418316,_0x2179e2)['then'](function(_0x243af6){logger[_0x9aa5('0x1a')](_0x9aa5('0x1b'),_0x1da63e,_0x9aa5('0x1c'));logger['debug'](_0x9aa5('0x1d'),_0x1da63e,_0x9aa5('0x1c'),JSON[_0x9aa5('0x1e')](_0x243af6));if(_0x243af6[_0x9aa5('0x1f')]){if(_0x243af6[_0x9aa5('0x1f')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1da63e,_0x243af6[_0x9aa5('0x1f')]['message']);return _0x7e8cdf(_0x243af6[_0x9aa5('0x1f')][_0x9aa5('0x20')]);}logger[_0x9aa5('0x1f')](_0x9aa5('0x1b'),_0x1da63e,_0x243af6[_0x9aa5('0x1f')][_0x9aa5('0x20')]);return _0x16275d(_0x243af6[_0x9aa5('0x1f')][_0x9aa5('0x20')]);}else{logger[_0x9aa5('0x1a')](_0x9aa5('0x1b'),_0x1da63e,_0x9aa5('0x1c'));_0x16275d(_0x243af6[_0x9aa5('0x21')][_0x9aa5('0x20')]);}})[_0x9aa5('0x22')](function(_0x4ae1f6){logger[_0x9aa5('0x1f')](_0x9aa5('0x1b'),_0x1da63e,_0x4ae1f6);_0x7e8cdf(_0x4ae1f6);});});}function respondWithStatusCode(_0x312e42,_0x5e9b2d){_0x5e9b2d=_0x5e9b2d||0xcc;return function(_0x14aeda){if(_0x14aeda){return _0x312e42[_0x9aa5('0x23')](_0x5e9b2d);}return _0x312e42['status'](_0x5e9b2d)['end']();};}function respondWithResult(_0x3a10d8,_0x2dc815){_0x2dc815=_0x2dc815||0xc8;return function(_0x1405ef){if(_0x1405ef){return _0x3a10d8['status'](_0x2dc815)[_0x9aa5('0x24')](_0x1405ef);}};}function respondWithFilteredResult(_0x3586ac,_0x3fffab){return function(_0x509cd5){if(_0x509cd5){var _0x24ed47=typeof _0x3fffab[_0x9aa5('0x25')]===_0x9aa5('0x26')&&typeof _0x3fffab[_0x9aa5('0x27')]==='undefined';var _0x3a32bc=_0x509cd5[_0x9aa5('0x28')];var _0x49a0e5=_0x24ed47?0x0:_0x3fffab[_0x9aa5('0x25')];var _0x2a98e9=_0x24ed47?_0x509cd5['count']:_0x3fffab[_0x9aa5('0x25')]+_0x3fffab[_0x9aa5('0x27')];var _0x1d716c;if(_0x2a98e9>=_0x3a32bc){_0x2a98e9=_0x3a32bc;_0x1d716c=0xc8;}else{_0x1d716c=0xce;}_0x3586ac[_0x9aa5('0x29')](_0x1d716c);return _0x3586ac['set'](_0x9aa5('0x2a'),_0x49a0e5+'-'+_0x2a98e9+'/'+_0x3a32bc)['json'](_0x509cd5);}return null;};}function patchUpdates(_0xa1f1ab){return function(_0x10cc6c){try{jsonpatch['apply'](_0x10cc6c,_0xa1f1ab,!![]);}catch(_0x2baca5){return BPromise[_0x9aa5('0x2b')](_0x2baca5);}return _0x10cc6c['save']();};}function saveUpdates(_0x402d52,_0x2c08c3){return function(_0x543c30){if(_0x543c30){return _0x543c30[_0x9aa5('0x2c')](_0x402d52)[_0x9aa5('0x2d')](function(_0x484529){return _0x484529;});}return null;};}function removeEntity(_0x2612a6,_0xb248b9){return function(_0x2fec98){if(_0x2fec98){return _0x2fec98[_0x9aa5('0x2e')]()[_0x9aa5('0x2d')](function(){var _0x438f10=_0x2fec98['get']({'plain':!![]});var _0x18b36e=_0x9aa5('0x2f');return db[_0x9aa5('0x30')][_0x9aa5('0x2e')]({'where':{'type':_0x18b36e,'resourceId':_0x438f10['id']}})[_0x9aa5('0x2d')](function(){return _0x2fec98;});})[_0x9aa5('0x2d')](function(){_0x2612a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ead90,_0x233c1a){return function(_0x2eaf48){if(!_0x2eaf48){_0x3ead90['sendStatus'](0x194);}return _0x2eaf48;};}function handleError(_0x4fd956,_0x298de6){_0x298de6=_0x298de6||0x1f4;return function(_0x334de3){logger[_0x9aa5('0x1f')](_0x334de3[_0x9aa5('0x31')]);if(_0x334de3[_0x9aa5('0x32')]){delete _0x334de3[_0x9aa5('0x32')];}_0x4fd956[_0x9aa5('0x29')](_0x298de6)[_0x9aa5('0x33')](_0x334de3);};}exports[_0x9aa5('0x34')]=function(_0x212170,_0x59d77e){var _0x5668f5={},_0x30b6e7={},_0x67b6e6={'count':0x0,'rows':[]};var _0xedbfac=_[_0x9aa5('0x35')](db['VoiceContext'][_0x9aa5('0x36')],function(_0x17588d){return{'name':_0x17588d[_0x9aa5('0x37')],'type':_0x17588d['type'][_0x9aa5('0x38')]};});_0x30b6e7[_0x9aa5('0x39')]=_[_0x9aa5('0x35')](_0xedbfac,'name');_0x30b6e7['query']=_[_0x9aa5('0x3a')](_0x212170['query']);_0x30b6e7[_0x9aa5('0x3b')]=_[_0x9aa5('0x3c')](_0x30b6e7[_0x9aa5('0x39')],_0x30b6e7['query']);_0x5668f5[_0x9aa5('0x3d')]=_[_0x9aa5('0x3c')](_0x30b6e7[_0x9aa5('0x39')],qs['fields'](_0x212170[_0x9aa5('0x3e')][_0x9aa5('0x3f')]));_0x5668f5[_0x9aa5('0x3d')]=_0x5668f5['attributes'][_0x9aa5('0x40')]?_0x5668f5[_0x9aa5('0x3d')]:_0x30b6e7[_0x9aa5('0x39')];if(!_0x212170['query'][_0x9aa5('0x41')](_0x9aa5('0x42'))){_0x5668f5['limit']=qs[_0x9aa5('0x27')](_0x212170[_0x9aa5('0x3e')][_0x9aa5('0x27')]);_0x5668f5[_0x9aa5('0x25')]=qs['offset'](_0x212170[_0x9aa5('0x3e')][_0x9aa5('0x25')]);}_0x5668f5[_0x9aa5('0x43')]=qs[_0x9aa5('0x44')](_0x212170[_0x9aa5('0x3e')]['sort']);_0x5668f5[_0x9aa5('0x45')]=qs['filters'](_[_0x9aa5('0x46')](_0x212170[_0x9aa5('0x3e')],_0x30b6e7[_0x9aa5('0x3b')]),_0xedbfac);if(_0x212170[_0x9aa5('0x3e')][_0x9aa5('0x47')]){_0x5668f5[_0x9aa5('0x45')]=_['merge'](_0x5668f5['where'],{'$or':_['map'](_0xedbfac,function(_0x5ae40d){if(_0x5ae40d[_0x9aa5('0x48')]!==_0x9aa5('0x49')){var _0x3ce246={};_0x3ce246[_0x5ae40d[_0x9aa5('0x32')]]={'$like':'%'+_0x212170[_0x9aa5('0x3e')][_0x9aa5('0x47')]+'%'};return _0x3ce246;}})});}_0x5668f5=_['merge']({},_0x5668f5,_0x212170[_0x9aa5('0x4a')]);var _0x26df92={'where':_0x5668f5['where']};return db['VoiceContext']['count'](_0x26df92)[_0x9aa5('0x2d')](function(_0x2ff383){_0x67b6e6[_0x9aa5('0x28')]=_0x2ff383;if(_0x212170[_0x9aa5('0x3e')][_0x9aa5('0x4b')]){_0x5668f5[_0x9aa5('0x4c')]=[{'all':!![]}];}return db[_0x9aa5('0x4d')][_0x9aa5('0x4e')](_0x5668f5);})[_0x9aa5('0x2d')](function(_0x3f059b){_0x67b6e6[_0x9aa5('0x4f')]=_0x3f059b;return _0x67b6e6;})[_0x9aa5('0x2d')](respondWithFilteredResult(_0x59d77e,_0x5668f5))[_0x9aa5('0x22')](handleError(_0x59d77e,null));};exports[_0x9aa5('0x50')]=function(_0xeb766f,_0x46e46b){var _0x86fd5={'raw':![],'where':{'id':_0xeb766f['params']['id']}},_0x1f4966={};_0x1f4966[_0x9aa5('0x39')]=_['keys'](db['VoiceContext']['rawAttributes']);_0x1f4966[_0x9aa5('0x3e')]=_['keys'](_0xeb766f[_0x9aa5('0x3e')]);_0x1f4966['filters']=_['intersection'](_0x1f4966[_0x9aa5('0x39')],_0x1f4966['query']);_0x86fd5[_0x9aa5('0x3d')]=_[_0x9aa5('0x3c')](_0x1f4966[_0x9aa5('0x39')],qs[_0x9aa5('0x3f')](_0xeb766f[_0x9aa5('0x3e')][_0x9aa5('0x3f')]));_0x86fd5['attributes']=_0x86fd5['attributes'][_0x9aa5('0x40')]?_0x86fd5[_0x9aa5('0x3d')]:_0x1f4966[_0x9aa5('0x39')];if(_0xeb766f[_0x9aa5('0x3e')]['includeAll']){_0x86fd5[_0x9aa5('0x4c')]=[{'all':!![]}];}_0x86fd5=_[_0x9aa5('0x51')]({},_0x86fd5,_0xeb766f['options']);return db['VoiceContext'][_0x9aa5('0x52')](_0x86fd5)[_0x9aa5('0x2d')](handleEntityNotFound(_0x46e46b,null))[_0x9aa5('0x2d')](respondWithResult(_0x46e46b,null))[_0x9aa5('0x22')](handleError(_0x46e46b,null));};exports[_0x9aa5('0x53')]=function(_0x1c3875,_0x8055a0,_0x36d8ef){var _0x411ea4;return db['VoiceContext'][_0x9aa5('0x53')](_0x1c3875[_0x9aa5('0x54')],{'raw':!![]})[_0x9aa5('0x2d')](function(_0x348965){_0x411ea4=_0x348965;return db[_0x9aa5('0x4d')][_0x9aa5('0x4e')]({'raw':!![]});})['then'](function(_0x1a702f){var _0xa4f583=fs['readFileSync'](path[_0x9aa5('0x55')](config[_0x9aa5('0x56')],_0x9aa5('0x57')),_0x9aa5('0x58'));var _0xe5ef34=ejs['render'](_0xa4f583,{'contexts':_0x1a702f||[]});fs[_0x9aa5('0x59')](_0x9aa5('0x5a'),_0xe5ef34);})[_0x9aa5('0x2d')](function(){return respondWithRpcPromise(_0x9aa5('0x5b'),_0x9aa5('0x53'),{'module':_0x9aa5('0x5c')});})[_0x9aa5('0x2d')](function(){var _0x40d862=_0x1c3875[_0x9aa5('0x5d')]['get']({'plain':!![]});if(!_0x40d862)throw new Error(_0x9aa5('0x5e'));if(_0x40d862[_0x9aa5('0x5f')]===_0x9aa5('0x5d')){var _0x2eea44=_0x411ea4['get']({'plain':!![]});return db[_0x9aa5('0x60')][_0x9aa5('0x52')]({'where':{'name':_0x9aa5('0x2f'),'userProfileId':_0x40d862[_0x9aa5('0x61')]},'raw':!![]})['then'](function(_0x28eda8){if(_0x28eda8&&_0x28eda8[_0x9aa5('0x62')]===0x0){return db[_0x9aa5('0x30')][_0x9aa5('0x53')]({'name':_0x2eea44[_0x9aa5('0x32')],'resourceId':_0x2eea44['id'],'type':_0x28eda8[_0x9aa5('0x32')],'sectionId':_0x28eda8['id']},{})[_0x9aa5('0x2d')](function(){return _0x411ea4;});}else{return _0x411ea4;}})[_0x9aa5('0x22')](function(_0x68229d){logger[_0x9aa5('0x1f')](_0x9aa5('0x63'),_0x68229d);throw _0x68229d;});}return _0x411ea4;})[_0x9aa5('0x2d')](respondWithResult(_0x8055a0,0xc9))[_0x9aa5('0x22')](handleError(_0x8055a0,null));};exports[_0x9aa5('0x2c')]=function(_0x9ddc78,_0x331801,_0x38ab49){var _0x40a905;return db['VoiceContext'][_0x9aa5('0x52')]({'where':{'id':_0x9ddc78[_0x9aa5('0x64')]['id']}})[_0x9aa5('0x2d')](handleEntityNotFound(_0x331801,null))['then'](saveUpdates(_0x9ddc78[_0x9aa5('0x54')],null))[_0x9aa5('0x2d')](function(_0x4f9f69){if(_0x4f9f69){_0x40a905=_0x4f9f69;return db[_0x9aa5('0x4d')][_0x9aa5('0x4e')]({'raw':!![]});}})[_0x9aa5('0x2d')](function(_0x33a8b3){var _0x4c7757=fs[_0x9aa5('0x65')](path[_0x9aa5('0x55')](config[_0x9aa5('0x56')],_0x9aa5('0x57')),_0x9aa5('0x58'));var _0x49ce11=ejs[_0x9aa5('0x66')](_0x4c7757,{'contexts':_0x33a8b3||[]});fs[_0x9aa5('0x59')](_0x9aa5('0x5a'),_0x49ce11);})['then'](function(){return respondWithRpcPromise(_0x9aa5('0x5b'),_0x9aa5('0x2c'),{'module':_0x9aa5('0x5c')});})['then'](function(){return _0x40a905;})[_0x9aa5('0x2d')](respondWithResult(_0x331801,null))['catch'](handleError(_0x331801,null));};exports[_0x9aa5('0x2e')]=function(_0x44a451,_0x17be32,_0x8c2bba){var _0x3fda83;return db[_0x9aa5('0x4d')][_0x9aa5('0x52')]({'where':{'id':_0x44a451[_0x9aa5('0x64')]['id']}})[_0x9aa5('0x2d')](handleEntityNotFound(_0x17be32,null))['then'](removeEntity(_0x17be32,null))[_0x9aa5('0x2d')](function(){return db['VoiceContext'][_0x9aa5('0x4e')]({'raw':!![]});})[_0x9aa5('0x2d')](function(_0x24e248){var _0x5d291b=fs[_0x9aa5('0x65')](path['join'](config[_0x9aa5('0x56')],_0x9aa5('0x57')),_0x9aa5('0x58'));var _0x2d5314=ejs[_0x9aa5('0x66')](_0x5d291b,{'contexts':_0x24e248});fs['writeFileSync'](_0x9aa5('0x5a'),_0x2d5314);return respondWithRpcPromise('Reload',_0x9aa5('0x2e'),{'module':_0x9aa5('0x5c')});})[_0x9aa5('0x22')](handleError(_0x17be32,null));}; \ No newline at end of file +var _0x0187=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','params','include','merge','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0187,0x1ac));var _0x7018=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x0187[_0x22868f];return _0x97bc75;};'use strict';var emlformat=require(_0x7018('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7018('0x1'));var rp=require(_0x7018('0x2'));var moment=require(_0x7018('0x3'));var BPromise=require(_0x7018('0x4'));var Mustache=require('mustache');var util=require(_0x7018('0x5'));var path=require(_0x7018('0x6'));var sox=require(_0x7018('0x7'));var csv=require(_0x7018('0x8'));var ejs=require(_0x7018('0x9'));var fs=require('fs');var fs_extra=require(_0x7018('0xa'));var _=require('lodash');var squel=require(_0x7018('0xb'));var crypto=require(_0x7018('0xc'));var jsforce=require(_0x7018('0xd'));var deskjs=require(_0x7018('0xe'));var toCsv=require(_0x7018('0x8'));var querystring=require(_0x7018('0xf'));var Papa=require(_0x7018('0x10'));var Redis=require(_0x7018('0x11'));var authService=require(_0x7018('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7018('0x13'));var hardwareService=require(_0x7018('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7018('0x15'));var licenseUtil=require(_0x7018('0x16'));var db=require(_0x7018('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7018('0x18')][_0x7018('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4d13f2,_0x3fa3ef,_0x44bfe7,_0x40d0de){return new BPromise(function(_0x5507fb,_0x213c7b){var _0x33bb0f=_0x40d0de||client;return _0x33bb0f[_0x7018('0x1a')](_0x4d13f2,_0x44bfe7)[_0x7018('0x1b')](function(_0x38b17e){logger['info'](_0x7018('0x1c'),_0x3fa3ef,_0x7018('0x1d'));logger[_0x7018('0x1e')](_0x7018('0x1f'),_0x3fa3ef,_0x7018('0x1d'),JSON[_0x7018('0x20')](_0x38b17e));if(_0x38b17e['error']){if(_0x38b17e[_0x7018('0x21')][_0x7018('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3fa3ef,_0x38b17e[_0x7018('0x21')][_0x7018('0x23')]);return _0x213c7b(_0x38b17e['error'][_0x7018('0x23')]);}logger[_0x7018('0x21')](_0x7018('0x1c'),_0x3fa3ef,_0x38b17e['error']['message']);return _0x5507fb(_0x38b17e['error'][_0x7018('0x23')]);}else{logger[_0x7018('0x24')](_0x7018('0x1c'),_0x3fa3ef,_0x7018('0x1d'));_0x5507fb(_0x38b17e['result'][_0x7018('0x23')]);}})[_0x7018('0x25')](function(_0x5d6743){logger[_0x7018('0x21')](_0x7018('0x1c'),_0x3fa3ef,_0x5d6743);_0x213c7b(_0x5d6743);});});}function respondWithStatusCode(_0x34afa9,_0x1462b9){_0x1462b9=_0x1462b9||0xcc;return function(_0x3fe101){if(_0x3fe101){return _0x34afa9[_0x7018('0x26')](_0x1462b9);}return _0x34afa9[_0x7018('0x27')](_0x1462b9)[_0x7018('0x28')]();};}function respondWithResult(_0x1ec834,_0x119353){_0x119353=_0x119353||0xc8;return function(_0x197b0b){if(_0x197b0b){return _0x1ec834[_0x7018('0x27')](_0x119353)['json'](_0x197b0b);}};}function respondWithFilteredResult(_0x3043c8,_0xcc9022){return function(_0x1b649d){if(_0x1b649d){var _0x3b25d1=typeof _0xcc9022['offset']===_0x7018('0x29')&&typeof _0xcc9022[_0x7018('0x2a')]===_0x7018('0x29');var _0x2094bd=_0x1b649d[_0x7018('0x2b')];var _0x277a0c=_0x3b25d1?0x0:_0xcc9022['offset'];var _0x2bc9a2=_0x3b25d1?_0x1b649d[_0x7018('0x2b')]:_0xcc9022[_0x7018('0x2c')]+_0xcc9022[_0x7018('0x2a')];var _0x2a6ba8;if(_0x2bc9a2>=_0x2094bd){_0x2bc9a2=_0x2094bd;_0x2a6ba8=0xc8;}else{_0x2a6ba8=0xce;}_0x3043c8[_0x7018('0x27')](_0x2a6ba8);return _0x3043c8[_0x7018('0x2d')]('Content-Range',_0x277a0c+'-'+_0x2bc9a2+'/'+_0x2094bd)['json'](_0x1b649d);}return null;};}function patchUpdates(_0x10d6bc){return function(_0x5516aa){try{jsonpatch[_0x7018('0x2e')](_0x5516aa,_0x10d6bc,!![]);}catch(_0x58b355){return BPromise[_0x7018('0x2f')](_0x58b355);}return _0x5516aa['save']();};}function saveUpdates(_0x1390f0,_0x4d4012){return function(_0x55e14a){if(_0x55e14a){return _0x55e14a[_0x7018('0x30')](_0x1390f0)[_0x7018('0x1b')](function(_0x33a656){return _0x33a656;});}return null;};}function removeEntity(_0x44f855,_0x280446){return function(_0x2a9fab){if(_0x2a9fab){return _0x2a9fab[_0x7018('0x31')]()[_0x7018('0x1b')](function(){var _0x10ac27=_0x2a9fab['get']({'plain':!![]});var _0x10bfc6='Contexts';return db[_0x7018('0x32')]['destroy']({'where':{'type':_0x10bfc6,'resourceId':_0x10ac27['id']}})['then'](function(){return _0x2a9fab;});})[_0x7018('0x1b')](function(){_0x44f855[_0x7018('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8186,_0x4ee372){return function(_0x871363){if(!_0x871363){_0x5d8186[_0x7018('0x26')](0x194);}return _0x871363;};}function handleError(_0x4b2231,_0x37bd4e){_0x37bd4e=_0x37bd4e||0x1f4;return function(_0x119d7c){logger[_0x7018('0x21')](_0x119d7c[_0x7018('0x33')]);if(_0x119d7c['name']){delete _0x119d7c[_0x7018('0x34')];}_0x4b2231[_0x7018('0x27')](_0x37bd4e)[_0x7018('0x35')](_0x119d7c);};}exports[_0x7018('0x36')]=function(_0x36a837,_0x1adb0c){var _0x293b15={},_0x3b7ffb={},_0x3c3e37={'count':0x0,'rows':[]};var _0x83ccc9=_['map'](db[_0x7018('0x37')][_0x7018('0x38')],function(_0x46adfa){return{'name':_0x46adfa[_0x7018('0x39')],'type':_0x46adfa[_0x7018('0x3a')][_0x7018('0x3b')]};});_0x3b7ffb['model']=_[_0x7018('0x3c')](_0x83ccc9,'name');_0x3b7ffb[_0x7018('0x3d')]=_[_0x7018('0x3e')](_0x36a837[_0x7018('0x3d')]);_0x3b7ffb[_0x7018('0x3f')]=_[_0x7018('0x40')](_0x3b7ffb[_0x7018('0x41')],_0x3b7ffb[_0x7018('0x3d')]);_0x293b15[_0x7018('0x42')]=_[_0x7018('0x40')](_0x3b7ffb[_0x7018('0x41')],qs[_0x7018('0x43')](_0x36a837[_0x7018('0x3d')][_0x7018('0x43')]));_0x293b15[_0x7018('0x42')]=_0x293b15['attributes'][_0x7018('0x44')]?_0x293b15[_0x7018('0x42')]:_0x3b7ffb['model'];if(!_0x36a837[_0x7018('0x3d')][_0x7018('0x45')](_0x7018('0x46'))){_0x293b15[_0x7018('0x2a')]=qs[_0x7018('0x2a')](_0x36a837[_0x7018('0x3d')][_0x7018('0x2a')]);_0x293b15['offset']=qs[_0x7018('0x2c')](_0x36a837[_0x7018('0x3d')]['offset']);}_0x293b15[_0x7018('0x47')]=qs[_0x7018('0x48')](_0x36a837['query'][_0x7018('0x48')]);_0x293b15[_0x7018('0x49')]=qs[_0x7018('0x3f')](_[_0x7018('0x4a')](_0x36a837[_0x7018('0x3d')],_0x3b7ffb[_0x7018('0x3f')]),_0x83ccc9);if(_0x36a837[_0x7018('0x3d')][_0x7018('0x4b')]){_0x293b15[_0x7018('0x49')]=_['merge'](_0x293b15[_0x7018('0x49')],{'$or':_[_0x7018('0x3c')](_0x83ccc9,function(_0x50d4c4){if(_0x50d4c4[_0x7018('0x3a')]!==_0x7018('0x4c')){var _0x4a0805={};_0x4a0805[_0x50d4c4[_0x7018('0x34')]]={'$like':'%'+_0x36a837['query'][_0x7018('0x4b')]+'%'};return _0x4a0805;}})});}_0x293b15=_['merge']({},_0x293b15,_0x36a837[_0x7018('0x4d')]);var _0x51d425={'where':_0x293b15[_0x7018('0x49')]};return db[_0x7018('0x37')][_0x7018('0x2b')](_0x51d425)[_0x7018('0x1b')](function(_0x9d8359){_0x3c3e37[_0x7018('0x2b')]=_0x9d8359;if(_0x36a837[_0x7018('0x3d')][_0x7018('0x4e')]){_0x293b15['include']=[{'all':!![]}];}return db[_0x7018('0x37')][_0x7018('0x4f')](_0x293b15);})[_0x7018('0x1b')](function(_0x392295){_0x3c3e37[_0x7018('0x50')]=_0x392295;return _0x3c3e37;})[_0x7018('0x1b')](respondWithFilteredResult(_0x1adb0c,_0x293b15))[_0x7018('0x25')](handleError(_0x1adb0c,null));};exports['show']=function(_0x4e0b69,_0x5c3a6f){var _0x507f69={'raw':![],'where':{'id':_0x4e0b69[_0x7018('0x51')]['id']}},_0x7d23d7={};_0x7d23d7['model']=_[_0x7018('0x3e')](db[_0x7018('0x37')][_0x7018('0x38')]);_0x7d23d7['query']=_[_0x7018('0x3e')](_0x4e0b69['query']);_0x7d23d7[_0x7018('0x3f')]=_[_0x7018('0x40')](_0x7d23d7['model'],_0x7d23d7[_0x7018('0x3d')]);_0x507f69['attributes']=_[_0x7018('0x40')](_0x7d23d7['model'],qs[_0x7018('0x43')](_0x4e0b69['query'][_0x7018('0x43')]));_0x507f69[_0x7018('0x42')]=_0x507f69[_0x7018('0x42')][_0x7018('0x44')]?_0x507f69['attributes']:_0x7d23d7['model'];if(_0x4e0b69[_0x7018('0x3d')][_0x7018('0x4e')]){_0x507f69[_0x7018('0x52')]=[{'all':!![]}];}_0x507f69=_[_0x7018('0x53')]({},_0x507f69,_0x4e0b69[_0x7018('0x4d')]);return db['VoiceContext']['find'](_0x507f69)[_0x7018('0x1b')](handleEntityNotFound(_0x5c3a6f,null))['then'](respondWithResult(_0x5c3a6f,null))['catch'](handleError(_0x5c3a6f,null));};exports['create']=function(_0xf211a2,_0x2b0cd9,_0xab7528){var _0x18116c;return db[_0x7018('0x37')][_0x7018('0x54')](_0xf211a2[_0x7018('0x55')],{'raw':!![]})['then'](function(_0xd7a0eb){_0x18116c=_0xd7a0eb;return db[_0x7018('0x37')]['findAll']({'raw':!![]});})['then'](function(_0x239f18){var _0x555a62=fs[_0x7018('0x56')](path[_0x7018('0x57')](config[_0x7018('0x58')],_0x7018('0x59')),'utf8');var _0x2b38b3=ejs[_0x7018('0x5a')](_0x555a62,{'contexts':_0x239f18||[]});fs[_0x7018('0x5b')](_0x7018('0x5c'),_0x2b38b3);})['then'](function(){return respondWithRpcPromise(_0x7018('0x5d'),'create',{'module':_0x7018('0x5e')});})[_0x7018('0x1b')](function(){var _0x5549f8=_0xf211a2[_0x7018('0x5f')][_0x7018('0x60')]({'plain':!![]});if(!_0x5549f8)throw new Error(_0x7018('0x61'));if(_0x5549f8[_0x7018('0x62')]==='user'){var _0xc3007e=_0x18116c['get']({'plain':!![]});return db[_0x7018('0x63')][_0x7018('0x64')]({'where':{'name':_0x7018('0x65'),'userProfileId':_0x5549f8[_0x7018('0x66')]},'raw':!![]})[_0x7018('0x1b')](function(_0x45e851){if(_0x45e851&&_0x45e851[_0x7018('0x67')]===0x0){return db[_0x7018('0x32')][_0x7018('0x54')]({'name':_0xc3007e['name'],'resourceId':_0xc3007e['id'],'type':_0x45e851[_0x7018('0x34')],'sectionId':_0x45e851['id']},{})['then'](function(){return _0x18116c;});}else{return _0x18116c;}})[_0x7018('0x25')](function(_0x46c121){logger[_0x7018('0x21')](_0x7018('0x68'),_0x46c121);throw _0x46c121;});}return _0x18116c;})['then'](respondWithResult(_0x2b0cd9,0xc9))['catch'](handleError(_0x2b0cd9,null));};exports[_0x7018('0x30')]=function(_0x1b366f,_0x88ee6c,_0x1261d5){var _0x19a4db;return db[_0x7018('0x37')][_0x7018('0x64')]({'where':{'id':_0x1b366f[_0x7018('0x51')]['id']}})['then'](handleEntityNotFound(_0x88ee6c,null))[_0x7018('0x1b')](saveUpdates(_0x1b366f[_0x7018('0x55')],null))[_0x7018('0x1b')](function(_0x2d60cf){if(_0x2d60cf){_0x19a4db=_0x2d60cf;return db[_0x7018('0x37')][_0x7018('0x4f')]({'raw':!![]});}})[_0x7018('0x1b')](function(_0x5e031c){var _0x224b0d=fs[_0x7018('0x56')](path[_0x7018('0x57')](config['root'],_0x7018('0x59')),_0x7018('0x69'));var _0x12f0b9=ejs['render'](_0x224b0d,{'contexts':_0x5e031c||[]});fs[_0x7018('0x5b')](_0x7018('0x5c'),_0x12f0b9);})[_0x7018('0x1b')](function(){return respondWithRpcPromise(_0x7018('0x5d'),_0x7018('0x30'),{'module':_0x7018('0x5e')});})[_0x7018('0x1b')](function(){return _0x19a4db;})[_0x7018('0x1b')](respondWithResult(_0x88ee6c,null))[_0x7018('0x25')](handleError(_0x88ee6c,null));};exports[_0x7018('0x31')]=function(_0x59ba65,_0x43c921,_0x3a5740){var _0x287ae9;return db[_0x7018('0x37')][_0x7018('0x64')]({'where':{'id':_0x59ba65[_0x7018('0x51')]['id']}})[_0x7018('0x1b')](handleEntityNotFound(_0x43c921,null))[_0x7018('0x1b')](removeEntity(_0x43c921,null))[_0x7018('0x1b')](function(){return db[_0x7018('0x37')][_0x7018('0x4f')]({'raw':!![]});})[_0x7018('0x1b')](function(_0x16a379){var _0x1a5daa=fs['readFileSync'](path[_0x7018('0x57')](config[_0x7018('0x58')],_0x7018('0x59')),_0x7018('0x69'));var _0x2f2f79=ejs['render'](_0x1a5daa,{'contexts':_0x16a379});fs[_0x7018('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2f2f79);return respondWithRpcPromise(_0x7018('0x5d'),_0x7018('0x31'),{'module':_0x7018('0x5e')});})[_0x7018('0x25')](handleError(_0x43c921,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b9a85d2..ca17c34 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 _0x7b9c=['VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x7b9c,0x115));var _0xc7b9=function(_0x15a2fb,_0x287d02){_0x15a2fb=_0x15a2fb-0x0;var _0x4f9c24=_0x7b9c[_0x15a2fb];return _0x4f9c24;};'use strict';var _=require(_0xc7b9('0x0'));var util=require(_0xc7b9('0x1'));var logger=require('../../config/logger')(_0xc7b9('0x2'));var moment=require(_0xc7b9('0x3'));var BPromise=require(_0xc7b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc7b9('0x5'));var config=require(_0xc7b9('0x6'));var attributes=require(_0xc7b9('0x7'));module[_0xc7b9('0x8')]=function(_0x1685d5,_0x42e471){return _0x1685d5['define'](_0xc7b9('0x9'),attributes,{'tableName':_0xc7b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb0b=['../../config/logger','moment','bluebird','rimraf','./voiceContext.attributes','exports','define','VoiceContext','lodash','util'];(function(_0x36ddb6,_0x367f5b){var _0x20dd04=function(_0x489d66){while(--_0x489d66){_0x36ddb6['push'](_0x36ddb6['shift']());}};_0x20dd04(++_0x367f5b);}(_0xfb0b,0x94));var _0xbfb0=function(_0x11a4ef,_0x5790ce){_0x11a4ef=_0x11a4ef-0x0;var _0x311fcb=_0xfb0b[_0x11a4ef];return _0x311fcb;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))('api');var moment=require(_0xbfb0('0x3'));var BPromise=require(_0xbfb0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb0('0x5'));var config=require('../../config/environment');var attributes=require(_0xbfb0('0x6'));module[_0xbfb0('0x7')]=function(_0x8c7fee,_0x35d657){return _0x8c7fee[_0xbfb0('0x8')](_0xbfb0('0x9'),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 f00edc9..f0661b2 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 _0x38e7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment'];(function(_0x3fc4da,_0x730efa){var _0x5aabb2=function(_0x509096){while(--_0x509096){_0x3fc4da['push'](_0x3fc4da['shift']());}};_0x5aabb2(++_0x730efa);}(_0x38e7,0x1eb));var _0x738e=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x38e7[_0x4df1f5];return _0x56585b;};'use strict';var _=require(_0x738e('0x0'));var util=require(_0x738e('0x1'));var moment=require(_0x738e('0x2'));var BPromise=require(_0x738e('0x3'));var rs=require(_0x738e('0x4'));var fs=require('fs');var Redis=require(_0x738e('0x5'));var db=require(_0x738e('0x6'))['db'];var utils=require(_0x738e('0x7'));var logger=require(_0x738e('0x8'))(_0x738e('0x9'));var config=require(_0x738e('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282b59,_0x35db07,_0x26c0a7){return new BPromise(function(_0x287d50,_0x160926){return client[_0x738e('0xb')](_0x282b59,_0x26c0a7)[_0x738e('0xc')](function(_0x36f796){logger[_0x738e('0xd')](_0x738e('0xe'),_0x35db07,_0x738e('0xf'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x35db07,_0x738e('0xf'),JSON['stringify'](_0x36f796));if(_0x36f796[_0x738e('0x10')]){if(_0x36f796[_0x738e('0x10')]['code']===0x1f4){logger[_0x738e('0x10')]('VoiceContext,\x20%s,\x20%s',_0x35db07,_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);return _0x160926(_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);}logger[_0x738e('0x10')](_0x738e('0xe'),_0x35db07,_0x36f796['error'][_0x738e('0x11')]);return _0x287d50(_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);}else{logger[_0x738e('0xd')](_0x738e('0xe'),_0x35db07,_0x738e('0xf'));_0x287d50(_0x36f796['result'][_0x738e('0x11')]);}})[_0x738e('0x12')](function(_0x4d0651){logger[_0x738e('0x10')]('VoiceContext,\x20%s,\x20%s',_0x35db07,_0x4d0651);_0x160926(_0x4d0651);});});} \ No newline at end of file +var _0x0f42=['rpc','../../config/environment','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x39b58a,_0x202d07){var _0x2bfe00=function(_0x1d754f){while(--_0x1d754f){_0x39b58a['push'](_0x39b58a['shift']());}};_0x2bfe00(++_0x202d07);}(_0x0f42,0x126));var _0x20f4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0f42[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var moment=require(_0x20f4('0x2'));var BPromise=require(_0x20f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20f4('0x5'));var logger=require('../../config/logger')(_0x20f4('0x6'));var config=require(_0x20f4('0x7'));var jayson=require(_0x20f4('0x8'));var client=jayson['client'][_0x20f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1519fe,_0x525da0,_0x45adf6){return new BPromise(function(_0x553d5d,_0x4a452d){return client['request'](_0x1519fe,_0x45adf6)[_0x20f4('0xa')](function(_0x4f3d95){logger[_0x20f4('0xb')](_0x20f4('0xc'),_0x525da0,_0x20f4('0xd'));logger[_0x20f4('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x525da0,_0x20f4('0xd'),JSON['stringify'](_0x4f3d95));if(_0x4f3d95[_0x20f4('0xf')]){if(_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x10')]===0x1f4){logger[_0x20f4('0xf')]('VoiceContext,\x20%s,\x20%s',_0x525da0,_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);return _0x4a452d(_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);}logger[_0x20f4('0xf')](_0x20f4('0xc'),_0x525da0,_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);return _0x553d5d(_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);}else{logger[_0x20f4('0xb')]('VoiceContext,\x20%s,\x20%s',_0x525da0,'request\x20sent');_0x553d5d(_0x4f3d95[_0x20f4('0x12')][_0x20f4('0x11')]);}})[_0x20f4('0x13')](function(_0x36fdc2){logger[_0x20f4('0xf')]('VoiceContext,\x20%s,\x20%s',_0x525da0,_0x36fdc2);_0x4a452d(_0x36fdc2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index ebd79e2..ac0cc33 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 _0x35aa=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b3798,_0x4d429f){var _0x51a745=function(_0x3a1853){while(--_0x3a1853){_0x3b3798['push'](_0x3b3798['shift']());}};_0x51a745(++_0x4d429f);}(_0x35aa,0xbe));var _0xa35a=function(_0x31d06e,_0xc5dc49){_0x31d06e=_0x31d06e-0x0;var _0x39ee79=_0x35aa[_0x31d06e];return _0x39ee79;};'use strict';var multer=require('multer');var util=require(_0xa35a('0x0'));var path=require(_0xa35a('0x1'));var timeout=require(_0xa35a('0x2'));var express=require(_0xa35a('0x3'));var router=express['Router']();var fs_extra=require(_0xa35a('0x4'));var auth=require(_0xa35a('0x5'));var interaction=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var controller=require(_0xa35a('0x8'));router[_0xa35a('0x9')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xb')]);router['get'](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0xd')]);router[_0xa35a('0x9')](_0xa35a('0xe'),auth[_0xa35a('0xa')](),controller[_0xa35a('0xf')]);router[_0xa35a('0x10')]('/',auth['isAuthenticated'](),controller[_0xa35a('0x11')]);router[_0xa35a('0x12')](_0xa35a('0xe'),auth[_0xa35a('0xa')](),controller['update']);router[_0xa35a('0x13')](_0xa35a('0xe'),auth['isAuthenticated'](),controller[_0xa35a('0x14')]);module[_0xa35a('0x15')]=router; \ No newline at end of file +var _0xe27c=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','/describe','get','post','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x5ce644,_0x5d0f17){var _0x75145f=function(_0x24c767){while(--_0x24c767){_0x5ce644['push'](_0x5ce644['shift']());}};_0x75145f(++_0x5d0f17);}(_0xe27c,0xec));var _0xce27=function(_0xe0d726,_0x35c945){_0xe0d726=_0xe0d726-0x0;var _0x50a626=_0xe27c[_0xe0d726];return _0x50a626;};'use strict';var multer=require(_0xce27('0x0'));var util=require(_0xce27('0x1'));var path=require(_0xce27('0x2'));var timeout=require(_0xce27('0x3'));var express=require('express');var router=express[_0xce27('0x4')]();var fs_extra=require(_0xce27('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce27('0x6'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xce27('0x7')](),controller['index']);router['get'](_0xce27('0x8'),auth[_0xce27('0x7')](),controller['describe']);router[_0xce27('0x9')]('/:id',auth[_0xce27('0x7')](),controller['show']);router[_0xce27('0xa')]('/',auth[_0xce27('0x7')](),controller['create']);router[_0xce27('0xb')]('/:id',auth[_0xce27('0x7')](),controller[_0xce27('0xc')]);router[_0xce27('0xd')](_0xce27('0xe'),auth[_0xce27('0x7')](),controller[_0xce27('0xf')]);module[_0xce27('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 21975da..086e816 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 _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x44f492,_0x5c62cd){var _0x39ccbd=function(_0x564320){while(--_0x564320){_0x44f492['push'](_0x44f492['shift']());}};_0x39ccbd(++_0x5c62cd);}(_0x9bde,0xe1));var _0xe9bd=function(_0xfe2ce,_0x39ba81){_0xfe2ce=_0xfe2ce-0x0;var _0x4263b3=_0x9bde[_0xfe2ce];return _0x4263b3;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x54ef,0x112));var _0xf54e=function(_0x2d6ad3,_0x19144c){_0x2d6ad3=_0x2d6ad3-0x0;var _0x51b466=_0x54ef[_0x2d6ad3];return _0x51b466;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6119cb1..fdbdbe0 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 _0x1495=['then','include','rows','catch','show','params','rawAttributes','options','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','destroy','end','error','stack','name','send','index','VoiceDialReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0xe0dcc,_0x401963){var _0x32f294=function(_0x5c642b){while(--_0x5c642b){_0xe0dcc['push'](_0xe0dcc['shift']());}};_0x32f294(++_0x401963);}(_0x1495,0xf1));var _0x5149=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1495[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5149('0x0'));var zipdir=require(_0x5149('0x1'));var jsonpatch=require(_0x5149('0x2'));var rp=require(_0x5149('0x3'));var moment=require(_0x5149('0x4'));var BPromise=require(_0x5149('0x5'));var Mustache=require(_0x5149('0x6'));var util=require(_0x5149('0x7'));var path=require(_0x5149('0x8'));var sox=require(_0x5149('0x9'));var csv=require('to-csv');var ejs=require(_0x5149('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5149('0xb'));var squel=require(_0x5149('0xc'));var crypto=require(_0x5149('0xd'));var jsforce=require(_0x5149('0xe'));var deskjs=require(_0x5149('0xf'));var toCsv=require(_0x5149('0x10'));var querystring=require(_0x5149('0x11'));var Papa=require(_0x5149('0x12'));var Redis=require(_0x5149('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5149('0x14'));var hardwareService=require(_0x5149('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5149('0x16'));var config=require(_0x5149('0x17'));var licenseUtil=require(_0x5149('0x18'));var db=require(_0x5149('0x19'))['db'];function respondWithStatusCode(_0x119c03,_0x42a4e4){_0x42a4e4=_0x42a4e4||0xcc;return function(_0x49a4cd){if(_0x49a4cd){return _0x119c03[_0x5149('0x1a')](_0x42a4e4);}return _0x119c03[_0x5149('0x1b')](_0x42a4e4)['end']();};}function respondWithResult(_0x35f4d4,_0x52c571){_0x52c571=_0x52c571||0xc8;return function(_0xe3c3c3){if(_0xe3c3c3){return _0x35f4d4['status'](_0x52c571)['json'](_0xe3c3c3);}};}function respondWithFilteredResult(_0xd9e2,_0x13339e){return function(_0x2fc6a1){if(_0x2fc6a1){var _0xd33c4d=typeof _0x13339e[_0x5149('0x1c')]==='undefined'&&typeof _0x13339e[_0x5149('0x1d')]===_0x5149('0x1e');var _0x3d727a=_0x2fc6a1[_0x5149('0x1f')];var _0x268297=_0xd33c4d?0x0:_0x13339e[_0x5149('0x1c')];var _0x3c4889=_0xd33c4d?_0x2fc6a1[_0x5149('0x1f')]:_0x13339e[_0x5149('0x1c')]+_0x13339e[_0x5149('0x1d')];var _0x4839cd;if(_0x3c4889>=_0x3d727a){_0x3c4889=_0x3d727a;_0x4839cd=0xc8;}else{_0x4839cd=0xce;}_0xd9e2['status'](_0x4839cd);return _0xd9e2[_0x5149('0x20')]('Content-Range',_0x268297+'-'+_0x3c4889+'/'+_0x3d727a)[_0x5149('0x21')](_0x2fc6a1);}return null;};}function patchUpdates(_0x16fb70){return function(_0x397336){try{jsonpatch[_0x5149('0x22')](_0x397336,_0x16fb70,!![]);}catch(_0x2b4b00){return BPromise[_0x5149('0x23')](_0x2b4b00);}return _0x397336[_0x5149('0x24')]();};}function saveUpdates(_0xa9436f,_0x456693){return function(_0x15ac45){if(_0x15ac45){return _0x15ac45['update'](_0xa9436f)['then'](function(_0xada461){return _0xada461;});}return null;};}function removeEntity(_0x59b834,_0x532083){return function(_0x31f3b9){if(_0x31f3b9){return _0x31f3b9[_0x5149('0x25')]()['then'](function(){_0x59b834[_0x5149('0x1b')](0xcc)[_0x5149('0x26')]();});}};}function handleEntityNotFound(_0x1a8dbf,_0x1e25c8){return function(_0x1c0448){if(!_0x1c0448){_0x1a8dbf[_0x5149('0x1a')](0x194);}return _0x1c0448;};}function handleError(_0x3ff185,_0x1cfb61){_0x1cfb61=_0x1cfb61||0x1f4;return function(_0x3d450b){logger[_0x5149('0x27')](_0x3d450b[_0x5149('0x28')]);if(_0x3d450b[_0x5149('0x29')]){delete _0x3d450b[_0x5149('0x29')];}_0x3ff185[_0x5149('0x1b')](_0x1cfb61)[_0x5149('0x2a')](_0x3d450b);};}exports[_0x5149('0x2b')]=function(_0x55b6ef,_0xb28af8){var _0x4b24f9={},_0x425d43={},_0x4191d1={'count':0x0,'rows':[]};var _0x4ebd06=_['map'](db[_0x5149('0x2c')]['rawAttributes'],function(_0x450dc1){return{'name':_0x450dc1[_0x5149('0x2d')],'type':_0x450dc1[_0x5149('0x2e')][_0x5149('0x2f')]};});_0x425d43[_0x5149('0x30')]=_[_0x5149('0x31')](_0x4ebd06,'name');_0x425d43[_0x5149('0x32')]=_[_0x5149('0x33')](_0x55b6ef[_0x5149('0x32')]);_0x425d43[_0x5149('0x34')]=_['intersection'](_0x425d43[_0x5149('0x30')],_0x425d43[_0x5149('0x32')]);_0x4b24f9[_0x5149('0x35')]=_[_0x5149('0x36')](_0x425d43[_0x5149('0x30')],qs[_0x5149('0x37')](_0x55b6ef['query']['fields']));_0x4b24f9[_0x5149('0x35')]=_0x4b24f9[_0x5149('0x35')]['length']?_0x4b24f9[_0x5149('0x35')]:_0x425d43[_0x5149('0x30')];if(!_0x55b6ef[_0x5149('0x32')][_0x5149('0x38')](_0x5149('0x39'))){_0x4b24f9[_0x5149('0x1d')]=qs[_0x5149('0x1d')](_0x55b6ef[_0x5149('0x32')][_0x5149('0x1d')]);_0x4b24f9[_0x5149('0x1c')]=qs[_0x5149('0x1c')](_0x55b6ef[_0x5149('0x32')][_0x5149('0x1c')]);}_0x4b24f9[_0x5149('0x3a')]=qs[_0x5149('0x3b')](_0x55b6ef[_0x5149('0x32')][_0x5149('0x3b')]);_0x4b24f9[_0x5149('0x3c')]=qs[_0x5149('0x34')](_['pick'](_0x55b6ef[_0x5149('0x32')],_0x425d43[_0x5149('0x34')]),_0x4ebd06);if(_0x55b6ef[_0x5149('0x32')][_0x5149('0x3d')]){_0x4b24f9['where']=_[_0x5149('0x3e')](_0x4b24f9['where'],{'$or':_[_0x5149('0x31')](_0x4ebd06,function(_0x281681){if(_0x281681[_0x5149('0x2e')]!=='VIRTUAL'){var _0x5f5d59={};_0x5f5d59[_0x281681['name']]={'$like':'%'+_0x55b6ef['query'][_0x5149('0x3d')]+'%'};return _0x5f5d59;}})});}_0x4b24f9=_[_0x5149('0x3e')]({},_0x4b24f9,_0x55b6ef['options']);var _0x27fc4f={'where':_0x4b24f9[_0x5149('0x3c')]};return db[_0x5149('0x2c')][_0x5149('0x1f')](_0x27fc4f)[_0x5149('0x3f')](function(_0xcd0d8c){_0x4191d1[_0x5149('0x1f')]=_0xcd0d8c;if(_0x55b6ef[_0x5149('0x32')]['includeAll']){_0x4b24f9[_0x5149('0x40')]=[{'all':!![]}];}return db[_0x5149('0x2c')]['findAll'](_0x4b24f9);})[_0x5149('0x3f')](function(_0x28082e){_0x4191d1[_0x5149('0x41')]=_0x28082e;return _0x4191d1;})[_0x5149('0x3f')](respondWithFilteredResult(_0xb28af8,_0x4b24f9))[_0x5149('0x42')](handleError(_0xb28af8,null));};exports[_0x5149('0x43')]=function(_0x3bcb38,_0xb2a451){var _0x32cc01={'raw':!![],'where':{'id':_0x3bcb38[_0x5149('0x44')]['id']}},_0x1aed47={};_0x1aed47['model']=_[_0x5149('0x33')](db[_0x5149('0x2c')][_0x5149('0x45')]);_0x1aed47[_0x5149('0x32')]=_[_0x5149('0x33')](_0x3bcb38[_0x5149('0x32')]);_0x1aed47['filters']=_[_0x5149('0x36')](_0x1aed47[_0x5149('0x30')],_0x1aed47[_0x5149('0x32')]);_0x32cc01[_0x5149('0x35')]=_[_0x5149('0x36')](_0x1aed47['model'],qs[_0x5149('0x37')](_0x3bcb38[_0x5149('0x32')][_0x5149('0x37')]));_0x32cc01[_0x5149('0x35')]=_0x32cc01[_0x5149('0x35')]['length']?_0x32cc01[_0x5149('0x35')]:_0x1aed47[_0x5149('0x30')];if(_0x3bcb38[_0x5149('0x32')]['includeAll']){_0x32cc01['include']=[{'all':!![]}];}_0x32cc01=_['merge']({},_0x32cc01,_0x3bcb38[_0x5149('0x46')]);return db[_0x5149('0x2c')][_0x5149('0x47')](_0x32cc01)[_0x5149('0x3f')](handleEntityNotFound(_0xb2a451,null))['then'](respondWithResult(_0xb2a451,null))[_0x5149('0x42')](handleError(_0xb2a451,null));};exports[_0x5149('0x48')]=function(_0x51f66c,_0x2e00c4){return db[_0x5149('0x2c')][_0x5149('0x48')](_0x51f66c['body'],{})[_0x5149('0x3f')](respondWithResult(_0x2e00c4,0xc9))[_0x5149('0x42')](handleError(_0x2e00c4,null));};exports[_0x5149('0x49')]=function(_0x205372,_0x396578){if(_0x205372['body']['id']){delete _0x205372[_0x5149('0x4a')]['id'];}return db[_0x5149('0x2c')]['find']({'where':{'id':_0x205372[_0x5149('0x44')]['id']}})[_0x5149('0x3f')](handleEntityNotFound(_0x396578,null))['then'](saveUpdates(_0x205372[_0x5149('0x4a')],null))[_0x5149('0x3f')](respondWithResult(_0x396578,null))[_0x5149('0x42')](handleError(_0x396578,null));};exports['destroy']=function(_0x2927c7,_0x551f14){return db[_0x5149('0x2c')][_0x5149('0x47')]({'where':{'id':_0x2927c7[_0x5149('0x44')]['id']}})[_0x5149('0x3f')](handleEntityNotFound(_0x551f14,null))[_0x5149('0x3f')](removeEntity(_0x551f14,null))[_0x5149('0x42')](handleError(_0x551f14,null));};exports[_0x5149('0x4b')]=function(_0x583a4c,_0x568054){return db[_0x5149('0x2c')][_0x5149('0x4b')]()[_0x5149('0x3f')](respondWithResult(_0x568054,null))[_0x5149('0x42')](handleError(_0x568054,null));}; \ No newline at end of file +var _0x8358=['index','map','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','VoiceDialReport','rows','catch','show','rawAttributes','find','create','body','params','describe','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send'];(function(_0x7d4672,_0x5d8b6a){var _0x579fa7=function(_0x2e8037){while(--_0x2e8037){_0x7d4672['push'](_0x7d4672['shift']());}};_0x579fa7(++_0x5d8b6a);}(_0x8358,0xb6));var _0x8835=function(_0xfd562c,_0xb8d760){_0xfd562c=_0xfd562c-0x0;var _0x1214ce=_0x8358[_0xfd562c];return _0x1214ce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8835('0x0'));var rp=require(_0x8835('0x1'));var moment=require(_0x8835('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8835('0x3'));var util=require(_0x8835('0x4'));var path=require('path');var sox=require(_0x8835('0x5'));var csv=require(_0x8835('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8835('0x7'));var jsforce=require(_0x8835('0x8'));var deskjs=require(_0x8835('0x9'));var toCsv=require(_0x8835('0x6'));var querystring=require(_0x8835('0xa'));var Papa=require(_0x8835('0xb'));var Redis=require(_0x8835('0xc'));var authService=require(_0x8835('0xd'));var qs=require(_0x8835('0xe'));var as=require(_0x8835('0xf'));var hardwareService=require(_0x8835('0x10'));var logger=require(_0x8835('0x11'))(_0x8835('0x12'));var utils=require(_0x8835('0x13'));var config=require(_0x8835('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8835('0x15'))['db'];function respondWithStatusCode(_0x423d8b,_0x180a2f){_0x180a2f=_0x180a2f||0xcc;return function(_0x3c5725){if(_0x3c5725){return _0x423d8b[_0x8835('0x16')](_0x180a2f);}return _0x423d8b[_0x8835('0x17')](_0x180a2f)['end']();};}function respondWithResult(_0x13c8ee,_0x2b11b9){_0x2b11b9=_0x2b11b9||0xc8;return function(_0xdb6637){if(_0xdb6637){return _0x13c8ee[_0x8835('0x17')](_0x2b11b9)['json'](_0xdb6637);}};}function respondWithFilteredResult(_0x4a5a63,_0x1c4066){return function(_0x5b5877){if(_0x5b5877){var _0x1650f9=typeof _0x1c4066[_0x8835('0x18')]===_0x8835('0x19')&&typeof _0x1c4066[_0x8835('0x1a')]===_0x8835('0x19');var _0x4830bb=_0x5b5877[_0x8835('0x1b')];var _0x524f91=_0x1650f9?0x0:_0x1c4066[_0x8835('0x18')];var _0x507a42=_0x1650f9?_0x5b5877[_0x8835('0x1b')]:_0x1c4066['offset']+_0x1c4066[_0x8835('0x1a')];var _0x1ef3fd;if(_0x507a42>=_0x4830bb){_0x507a42=_0x4830bb;_0x1ef3fd=0xc8;}else{_0x1ef3fd=0xce;}_0x4a5a63[_0x8835('0x17')](_0x1ef3fd);return _0x4a5a63[_0x8835('0x1c')](_0x8835('0x1d'),_0x524f91+'-'+_0x507a42+'/'+_0x4830bb)['json'](_0x5b5877);}return null;};}function patchUpdates(_0x3447a2){return function(_0x15b198){try{jsonpatch[_0x8835('0x1e')](_0x15b198,_0x3447a2,!![]);}catch(_0x4b9f45){return BPromise['reject'](_0x4b9f45);}return _0x15b198[_0x8835('0x1f')]();};}function saveUpdates(_0x509b07,_0x5c27b0){return function(_0x168a2b){if(_0x168a2b){return _0x168a2b[_0x8835('0x20')](_0x509b07)[_0x8835('0x21')](function(_0x373017){return _0x373017;});}return null;};}function removeEntity(_0x4f1afe,_0x50fb77){return function(_0xc49db3){if(_0xc49db3){return _0xc49db3[_0x8835('0x22')]()[_0x8835('0x21')](function(){_0x4f1afe[_0x8835('0x17')](0xcc)[_0x8835('0x23')]();});}};}function handleEntityNotFound(_0x1cfa2c,_0x47bd60){return function(_0x512f84){if(!_0x512f84){_0x1cfa2c[_0x8835('0x16')](0x194);}return _0x512f84;};}function handleError(_0x51f127,_0x4b62b3){_0x4b62b3=_0x4b62b3||0x1f4;return function(_0x2cb8d3){logger[_0x8835('0x24')](_0x2cb8d3[_0x8835('0x25')]);if(_0x2cb8d3[_0x8835('0x26')]){delete _0x2cb8d3['name'];}_0x51f127['status'](_0x4b62b3)[_0x8835('0x27')](_0x2cb8d3);};}exports[_0x8835('0x28')]=function(_0x114c6d,_0x572214){var _0x516973={},_0x12fff9={},_0x510639={'count':0x0,'rows':[]};var _0x29d700=_[_0x8835('0x29')](db['VoiceDialReport']['rawAttributes'],function(_0x58e1d9){return{'name':_0x58e1d9[_0x8835('0x2a')],'type':_0x58e1d9['type'][_0x8835('0x2b')]};});_0x12fff9[_0x8835('0x2c')]=_[_0x8835('0x29')](_0x29d700,_0x8835('0x26'));_0x12fff9[_0x8835('0x2d')]=_[_0x8835('0x2e')](_0x114c6d[_0x8835('0x2d')]);_0x12fff9['filters']=_['intersection'](_0x12fff9[_0x8835('0x2c')],_0x12fff9[_0x8835('0x2d')]);_0x516973[_0x8835('0x2f')]=_[_0x8835('0x30')](_0x12fff9[_0x8835('0x2c')],qs['fields'](_0x114c6d['query'][_0x8835('0x31')]));_0x516973[_0x8835('0x2f')]=_0x516973[_0x8835('0x2f')][_0x8835('0x32')]?_0x516973[_0x8835('0x2f')]:_0x12fff9['model'];if(!_0x114c6d[_0x8835('0x2d')][_0x8835('0x33')]('nolimit')){_0x516973[_0x8835('0x1a')]=qs['limit'](_0x114c6d[_0x8835('0x2d')][_0x8835('0x1a')]);_0x516973[_0x8835('0x18')]=qs[_0x8835('0x18')](_0x114c6d[_0x8835('0x2d')][_0x8835('0x18')]);}_0x516973[_0x8835('0x34')]=qs['sort'](_0x114c6d[_0x8835('0x2d')][_0x8835('0x35')]);_0x516973['where']=qs[_0x8835('0x36')](_[_0x8835('0x37')](_0x114c6d[_0x8835('0x2d')],_0x12fff9[_0x8835('0x36')]),_0x29d700);if(_0x114c6d[_0x8835('0x2d')][_0x8835('0x38')]){_0x516973[_0x8835('0x39')]=_[_0x8835('0x3a')](_0x516973['where'],{'$or':_['map'](_0x29d700,function(_0x11df0b){if(_0x11df0b[_0x8835('0x3b')]!==_0x8835('0x3c')){var _0xff4343={};_0xff4343[_0x11df0b[_0x8835('0x26')]]={'$like':'%'+_0x114c6d['query']['filter']+'%'};return _0xff4343;}})});}_0x516973=_['merge']({},_0x516973,_0x114c6d[_0x8835('0x3d')]);var _0x2eeaf1={'where':_0x516973[_0x8835('0x39')]};return db['VoiceDialReport'][_0x8835('0x1b')](_0x2eeaf1)[_0x8835('0x21')](function(_0x168aab){_0x510639[_0x8835('0x1b')]=_0x168aab;if(_0x114c6d[_0x8835('0x2d')][_0x8835('0x3e')]){_0x516973[_0x8835('0x3f')]=[{'all':!![]}];}return db[_0x8835('0x40')]['findAll'](_0x516973);})['then'](function(_0xa0682e){_0x510639[_0x8835('0x41')]=_0xa0682e;return _0x510639;})['then'](respondWithFilteredResult(_0x572214,_0x516973))[_0x8835('0x42')](handleError(_0x572214,null));};exports[_0x8835('0x43')]=function(_0x45b97e,_0x443a66){var _0x1584ca={'raw':!![],'where':{'id':_0x45b97e['params']['id']}},_0x110a64={};_0x110a64[_0x8835('0x2c')]=_['keys'](db[_0x8835('0x40')][_0x8835('0x44')]);_0x110a64[_0x8835('0x2d')]=_[_0x8835('0x2e')](_0x45b97e[_0x8835('0x2d')]);_0x110a64[_0x8835('0x36')]=_[_0x8835('0x30')](_0x110a64['model'],_0x110a64[_0x8835('0x2d')]);_0x1584ca['attributes']=_['intersection'](_0x110a64[_0x8835('0x2c')],qs['fields'](_0x45b97e[_0x8835('0x2d')][_0x8835('0x31')]));_0x1584ca[_0x8835('0x2f')]=_0x1584ca[_0x8835('0x2f')][_0x8835('0x32')]?_0x1584ca['attributes']:_0x110a64[_0x8835('0x2c')];if(_0x45b97e[_0x8835('0x2d')]['includeAll']){_0x1584ca[_0x8835('0x3f')]=[{'all':!![]}];}_0x1584ca=_[_0x8835('0x3a')]({},_0x1584ca,_0x45b97e[_0x8835('0x3d')]);return db['VoiceDialReport'][_0x8835('0x45')](_0x1584ca)[_0x8835('0x21')](handleEntityNotFound(_0x443a66,null))[_0x8835('0x21')](respondWithResult(_0x443a66,null))[_0x8835('0x42')](handleError(_0x443a66,null));};exports[_0x8835('0x46')]=function(_0x3c353e,_0x5b12a5){return db[_0x8835('0x40')][_0x8835('0x46')](_0x3c353e[_0x8835('0x47')],{})['then'](respondWithResult(_0x5b12a5,0xc9))[_0x8835('0x42')](handleError(_0x5b12a5,null));};exports['update']=function(_0x255f8b,_0x16a13f){if(_0x255f8b[_0x8835('0x47')]['id']){delete _0x255f8b[_0x8835('0x47')]['id'];}return db[_0x8835('0x40')][_0x8835('0x45')]({'where':{'id':_0x255f8b[_0x8835('0x48')]['id']}})[_0x8835('0x21')](handleEntityNotFound(_0x16a13f,null))[_0x8835('0x21')](saveUpdates(_0x255f8b[_0x8835('0x47')],null))[_0x8835('0x21')](respondWithResult(_0x16a13f,null))[_0x8835('0x42')](handleError(_0x16a13f,null));};exports[_0x8835('0x22')]=function(_0xd0ec7b,_0x5be3d3){return db[_0x8835('0x40')][_0x8835('0x45')]({'where':{'id':_0xd0ec7b['params']['id']}})[_0x8835('0x21')](handleEntityNotFound(_0x5be3d3,null))[_0x8835('0x21')](removeEntity(_0x5be3d3,null))[_0x8835('0x42')](handleError(_0x5be3d3,null));};exports[_0x8835('0x49')]=function(_0x483537,_0xb52dce){return db[_0x8835('0x40')][_0x8835('0x49')]()[_0x8835('0x21')](respondWithResult(_0xb52dce,null))['catch'](handleError(_0xb52dce,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ea10d49..37dd1f4 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 _0x4f16=['uniqueid','lodash','util','../../config/logger','request-promise','path','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0x36550e,_0x25807a){var _0x182ca7=function(_0x3532ac){while(--_0x3532ac){_0x36550e['push'](_0x36550e['shift']());}};_0x182ca7(++_0x25807a);}(_0x4f16,0x11f));var _0x64f1=function(_0x9c5512,_0x5651f1){_0x9c5512=_0x9c5512-0x0;var _0x5c4f5d=_0x4f16[_0x9c5512];return _0x5c4f5d;};'use strict';var _=require(_0x64f1('0x0'));var util=require(_0x64f1('0x1'));var logger=require(_0x64f1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x64f1('0x3'));var fs=require('fs');var path=require(_0x64f1('0x4'));var rimraf=require('rimraf');var config=require(_0x64f1('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x64f1('0x6')]=function(_0x1ff13e,_0x464433){return _0x1ff13e[_0x64f1('0x7')](_0x64f1('0x8'),attributes,{'tableName':_0x64f1('0x9'),'paranoid':![],'indexes':[{'fields':[_0x64f1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd29e=['../../config/environment','exports','define','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xd29e,0x1a7));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xed29('0x0'));var logger=require(_0xed29('0x1'))(_0xed29('0x2'));var moment=require(_0xed29('0x3'));var BPromise=require(_0xed29('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed29('0x5'));var rimraf=require(_0xed29('0x6'));var config=require(_0xed29('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xed29('0x8')]=function(_0x1cd7de,_0x3b1660){return _0x1cd7de[_0xed29('0x9')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 58b7dfb..81cf4f0 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 _0x12fa=['info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','UpdateVoiceDialReport','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x12fa,0xf3));var _0xa12f=function(_0x42557b,_0x290c94){_0x42557b=_0x42557b-0x0;var _0x3a3ff2=_0x12fa[_0x42557b];return _0x3a3ff2;};'use strict';var _=require(_0xa12f('0x0'));var util=require(_0xa12f('0x1'));var moment=require(_0xa12f('0x2'));var BPromise=require(_0xa12f('0x3'));var rs=require(_0xa12f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa12f('0x5'))['db'];var utils=require(_0xa12f('0x6'));var logger=require(_0xa12f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa12f('0x8'));var client=jayson[_0xa12f('0x9')][_0xa12f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15b7f1,_0x1e644c,_0x238e83){return new BPromise(function(_0x5b5d4a,_0x1393b5){return client[_0xa12f('0xb')](_0x15b7f1,_0x238e83)[_0xa12f('0xc')](function(_0x4adac9){logger[_0xa12f('0xd')](_0xa12f('0xe'),_0x1e644c,'request\x20sent');logger[_0xa12f('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1e644c,_0xa12f('0x10'),JSON[_0xa12f('0x11')](_0x4adac9));if(_0x4adac9[_0xa12f('0x12')]){if(_0x4adac9[_0xa12f('0x12')][_0xa12f('0x13')]===0x1f4){logger['error'](_0xa12f('0xe'),_0x1e644c,_0x4adac9['error'][_0xa12f('0x14')]);return _0x1393b5(_0x4adac9[_0xa12f('0x12')][_0xa12f('0x14')]);}logger['error'](_0xa12f('0xe'),_0x1e644c,_0x4adac9[_0xa12f('0x12')][_0xa12f('0x14')]);return _0x5b5d4a(_0x4adac9[_0xa12f('0x12')][_0xa12f('0x14')]);}else{logger[_0xa12f('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x1e644c,_0xa12f('0x10'));_0x5b5d4a(_0x4adac9[_0xa12f('0x15')][_0xa12f('0x14')]);}})[_0xa12f('0x16')](function(_0x2d57c4){logger[_0xa12f('0x12')](_0xa12f('0xe'),_0x1e644c,_0x2d57c4);_0x1393b5(_0x2d57c4);});});}exports[_0xa12f('0x17')]=function(_0x5b6bfb){var _0x5f0531=this;return new Promise(function(_0x4d354e,_0x57fddf){return db[_0xa12f('0x18')]['create'](_0x5b6bfb['body'],{'raw':_0x5b6bfb[_0xa12f('0x19')]?_0x5b6bfb[_0xa12f('0x19')][_0xa12f('0x1a')]===undefined?!![]:![]:!![]})[_0xa12f('0xc')](function(_0x5259d5){logger[_0xa12f('0xd')](_0xa12f('0x17'),_0x5b6bfb);logger['debug'](_0xa12f('0x17'),_0x5b6bfb,JSON['stringify'](_0x5259d5));_0x4d354e(_0x5259d5);})['catch'](function(_0x75f9be){logger[_0xa12f('0x12')](_0xa12f('0x17'),_0x75f9be[_0xa12f('0x14')],_0x5b6bfb);_0x57fddf(_0x5f0531[_0xa12f('0x12')](0x1f4,_0x75f9be[_0xa12f('0x14')]));});});};exports[_0xa12f('0x1b')]=function(_0x28b42f){var _0x4cecc4=this;return new Promise(function(_0x195dbe,_0x3f4dde){return db[_0xa12f('0x18')]['update'](_0x28b42f[_0xa12f('0x1c')],{'raw':_0x28b42f[_0xa12f('0x19')]?_0x28b42f[_0xa12f('0x19')][_0xa12f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b42f['options']?_0x28b42f[_0xa12f('0x19')][_0xa12f('0x1d')]||null:null,'attributes':_0x28b42f[_0xa12f('0x19')]?_0x28b42f[_0xa12f('0x19')][_0xa12f('0x1e')]||null:null,'limit':_0x28b42f[_0xa12f('0x19')]?_0x28b42f[_0xa12f('0x19')][_0xa12f('0x1f')]||null:null})['then'](function(_0x366ba1){logger[_0xa12f('0xd')](_0xa12f('0x1b'),_0x28b42f);logger['debug'](_0xa12f('0x1b'),_0x28b42f,JSON[_0xa12f('0x11')](_0x366ba1));_0x195dbe(_0x366ba1);})[_0xa12f('0x16')](function(_0x310f72){logger[_0xa12f('0x12')]('UpdateVoiceDialReport',_0x310f72[_0xa12f('0x14')],_0x28b42f);_0x3f4dde(_0x4cecc4['error'](0x1f4,_0x310f72['message']));});});}; \ No newline at end of file +var _0x73b4=['jayson/promise','client','http','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','randomstring','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73b4,0xd4));var _0x473b=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x73b4[_0x296897];return _0x2b44ab;};'use strict';var _=require(_0x473b('0x0'));var util=require(_0x473b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x473b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x473b('0x3'));var logger=require('../../config/logger')(_0x473b('0x4'));var config=require('../../config/environment');var jayson=require(_0x473b('0x5'));var client=jayson[_0x473b('0x6')][_0x473b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17824c,_0x4cc65f,_0x532831){return new BPromise(function(_0xa09c04,_0xcbd0cc){return client['request'](_0x17824c,_0x532831)[_0x473b('0x8')](function(_0x4ac50d){logger[_0x473b('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x4cc65f,'request\x20sent');logger[_0x473b('0xa')](_0x473b('0xb'),_0x4cc65f,_0x473b('0xc'),JSON['stringify'](_0x4ac50d));if(_0x4ac50d[_0x473b('0xd')]){if(_0x4ac50d[_0x473b('0xd')][_0x473b('0xe')]===0x1f4){logger[_0x473b('0xd')](_0x473b('0xf'),_0x4cc65f,_0x4ac50d[_0x473b('0xd')][_0x473b('0x10')]);return _0xcbd0cc(_0x4ac50d[_0x473b('0xd')][_0x473b('0x10')]);}logger[_0x473b('0xd')](_0x473b('0xf'),_0x4cc65f,_0x4ac50d['error'][_0x473b('0x10')]);return _0xa09c04(_0x4ac50d[_0x473b('0xd')][_0x473b('0x10')]);}else{logger[_0x473b('0x9')](_0x473b('0xf'),_0x4cc65f,'request\x20sent');_0xa09c04(_0x4ac50d[_0x473b('0x11')]['message']);}})[_0x473b('0x12')](function(_0x37a3f6){logger[_0x473b('0xd')](_0x473b('0xf'),_0x4cc65f,_0x37a3f6);_0xcbd0cc(_0x37a3f6);});});}exports[_0x473b('0x13')]=function(_0x4b8a3e){var _0x2a7220=this;return new Promise(function(_0x4d5782,_0x4f3d4e){return db[_0x473b('0x14')][_0x473b('0x15')](_0x4b8a3e[_0x473b('0x16')],{'raw':_0x4b8a3e[_0x473b('0x17')]?_0x4b8a3e[_0x473b('0x17')][_0x473b('0x18')]===undefined?!![]:![]:!![]})[_0x473b('0x8')](function(_0xc47536){logger['info'](_0x473b('0x13'),_0x4b8a3e);logger[_0x473b('0xa')](_0x473b('0x13'),_0x4b8a3e,JSON[_0x473b('0x19')](_0xc47536));_0x4d5782(_0xc47536);})[_0x473b('0x12')](function(_0x5b0bba){logger[_0x473b('0xd')](_0x473b('0x13'),_0x5b0bba[_0x473b('0x10')],_0x4b8a3e);_0x4f3d4e(_0x2a7220[_0x473b('0xd')](0x1f4,_0x5b0bba[_0x473b('0x10')]));});});};exports[_0x473b('0x1a')]=function(_0x2cac1f){var _0x107b9c=this;return new Promise(function(_0x4884b4,_0x405f74){return db[_0x473b('0x14')][_0x473b('0x1b')](_0x2cac1f[_0x473b('0x16')],{'raw':_0x2cac1f[_0x473b('0x17')]?_0x2cac1f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cac1f['options']?_0x2cac1f[_0x473b('0x17')][_0x473b('0x1c')]||null:null,'attributes':_0x2cac1f[_0x473b('0x17')]?_0x2cac1f[_0x473b('0x17')][_0x473b('0x1d')]||null:null,'limit':_0x2cac1f[_0x473b('0x17')]?_0x2cac1f[_0x473b('0x17')][_0x473b('0x1e')]||null:null})[_0x473b('0x8')](function(_0x4160ab){logger[_0x473b('0x9')](_0x473b('0x1a'),_0x2cac1f);logger[_0x473b('0xa')](_0x473b('0x1a'),_0x2cac1f,JSON[_0x473b('0x19')](_0x4160ab));_0x4884b4(_0x4160ab);})[_0x473b('0x12')](function(_0x3def3e){logger[_0x473b('0xd')](_0x473b('0x1a'),_0x3def3e[_0x473b('0x10')],_0x2cac1f);_0x405f74(_0x107b9c[_0x473b('0xd')](0x1f4,_0x3def3e[_0x473b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7c0805a..592147a 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 _0xc367=['get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x5ef37d,_0x3075fa){var _0x57e7a4=function(_0x2c6b34){while(--_0x2c6b34){_0x5ef37d['push'](_0x5ef37d['shift']());}};_0x57e7a4(++_0x3075fa);}(_0xc367,0x157));var _0x7c36=function(_0x44badb,_0x4b24d9){_0x44badb=_0x44badb-0x0;var _0x1283df=_0xc367[_0x44badb];return _0x1283df;};'use strict';var multer=require(_0x7c36('0x0'));var util=require(_0x7c36('0x1'));var path=require(_0x7c36('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c36('0x3'));var router=express[_0x7c36('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c36('0x5'));var interaction=require(_0x7c36('0x6'));var config=require(_0x7c36('0x7'));var controller=require(_0x7c36('0x8'));router[_0x7c36('0x9')]('/',auth[_0x7c36('0xa')](),controller[_0x7c36('0xb')]);router[_0x7c36('0x9')](_0x7c36('0xc'),auth['isAuthenticated'](),controller[_0x7c36('0xd')]);router[_0x7c36('0xe')]('/',auth[_0x7c36('0xa')](),controller[_0x7c36('0xf')]);router[_0x7c36('0xe')](_0x7c36('0x10'),auth[_0x7c36('0xa')](),controller[_0x7c36('0x11')]);router[_0x7c36('0x12')](_0x7c36('0xc'),auth[_0x7c36('0xa')](),controller['update']);router[_0x7c36('0x13')]('/:id',auth[_0x7c36('0xa')](),controller[_0x7c36('0x14')]);module[_0x7c36('0x15')]=router; \ No newline at end of file +var _0xd2cc=['/:id/applications','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','create','post'];(function(_0x4d5731,_0x7d180c){var _0x59e1d5=function(_0x474974){while(--_0x474974){_0x4d5731['push'](_0x4d5731['shift']());}};_0x59e1d5(++_0x7d180c);}(_0xd2cc,0x15b));var _0xcd2c=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0xd2cc[_0x478e2f];return _0x4b088d;};'use strict';var multer=require(_0xcd2c('0x0'));var util=require('util');var path=require(_0xcd2c('0x1'));var timeout=require(_0xcd2c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcd2c('0x3'));var auth=require(_0xcd2c('0x4'));var interaction=require(_0xcd2c('0x5'));var config=require('../../config/environment');var controller=require(_0xcd2c('0x6'));router[_0xcd2c('0x7')]('/',auth[_0xcd2c('0x8')](),controller[_0xcd2c('0x9')]);router[_0xcd2c('0x7')]('/:id',auth[_0xcd2c('0x8')](),controller[_0xcd2c('0xa')]);router['post']('/',auth[_0xcd2c('0x8')](),controller[_0xcd2c('0xb')]);router[_0xcd2c('0xc')](_0xcd2c('0xd'),auth[_0xcd2c('0x8')](),controller['addApplications']);router[_0xcd2c('0xe')](_0xcd2c('0xf'),auth[_0xcd2c('0x8')](),controller[_0xcd2c('0x10')]);router[_0xcd2c('0x11')]('/:id',auth[_0xcd2c('0x8')](),controller[_0xcd2c('0x12')]);module[_0xcd2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b854da9..1c60bef 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 _0x2162=['BOOLEAN','wav','getDataValue','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*'];(function(_0x5addb0,_0x433156){var _0x631e35=function(_0x16f9ae){while(--_0x16f9ae){_0x5addb0['push'](_0x5addb0['shift']());}};_0x631e35(++_0x433156);}(_0x2162,0x17a));var _0x2216=function(_0x28467d,_0x2ac2bf){_0x28467d=_0x28467d-0x0;var _0x22cbbd=_0x2162[_0x28467d];return _0x22cbbd;};'use strict';var Sequelize=require('sequelize');module[_0x2216('0x0')]={'context':{'type':Sequelize[_0x2216('0x1')],'allowNull':![],'unique':_0x2216('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2216('0x1')],'allowNull':![],'unique':_0x2216('0x2')},'priority':{'type':Sequelize[_0x2216('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x2216('0x2')},'tag':{'type':Sequelize[_0x2216('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2216('0x3')},'appdata':{'type':Sequelize[_0x2216('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x2216('0x4'),_0x2216('0x5'),_0x2216('0x6'),_0x2216('0x7'),_0x2216('0x8'),_0x2216('0x9'),_0x2216('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x2216('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2216('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x2216('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2216('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x2216('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x2216('0x1')],'defaultValue':_0x2216('0xd')},'answer':{'type':Sequelize[_0x2216('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x15bf49){return this[_0x2216('0xe')]('exten');}},'alias':{'type':Sequelize[_0x2216('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4cc5=['INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0x383a7d,_0x522c44){var _0x26881c=function(_0x424eda){while(--_0x424eda){_0x383a7d['push'](_0x383a7d['shift']());}};_0x26881c(++_0x522c44);}(_0x4cc5,0x12a));var _0x54cc=function(_0x43ee3d,_0x18cefd){_0x43ee3d=_0x43ee3d-0x0;var _0x19ce6e=_0x4cc5[_0x43ee3d];return _0x19ce6e;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x54cc('0x0')],'allowNull':![],'unique':_0x54cc('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x54cc('0x0')],'allowNull':![],'unique':_0x54cc('0x1')},'priority':{'type':Sequelize[_0x54cc('0x0')],'allowNull':![],'defaultValue':'1','unique':_0x54cc('0x1')},'tag':{'type':Sequelize[_0x54cc('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x54cc('0x0')],'allowNull':![],'defaultValue':_0x54cc('0x2')},'appdata':{'type':Sequelize[_0x54cc('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x54cc('0x3'),_0x54cc('0x4'),_0x54cc('0x5'),_0x54cc('0x6'),_0x54cc('0x7'),_0x54cc('0x8'),_0x54cc('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x54cc('0x0')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x54cc('0xa')]},'isApp':{'type':Sequelize[_0x54cc('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x54cc('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x54cc('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0x54cc('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x54cc('0xa')]},'recordingFormat':{'type':Sequelize[_0x54cc('0x0')],'defaultValue':_0x54cc('0xc')},'answer':{'type':Sequelize[_0x54cc('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x54cc('0xd')],'get':function(_0x159f00){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x54cc('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 56d8ccd..24ef006 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 _0x019b=['status','end','json','offset','undefined','limit','count','set','destroy','get','InboundRoutes','OutboundRoutes','filter','ignore','map','value','includes','type','name','UserProfileResource','then','error','stack','send','index','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','VoiceExtension','includeAll','include','rows','catch','params','find','create','body','outbound','concat','user','role','inbound','InternalRoutes','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','sequelize','transaction','Transaction','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','finally','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x019b,0xf9));var _0xb019=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x019b[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require('lodash');var Redis=require(_0xb019('0x0'));var qs=require(_0xb019('0x1'));var logger=require('../../config/logger')(_0xb019('0x2'));var config=require('../../config/environment');var db=require(_0xb019('0x3'))['db'];config[_0xb019('0x4')]=_[_0xb019('0x5')](config[_0xb019('0x4')],{'host':_0xb019('0x6'),'port':0x18eb});var socket=require(_0xb019('0x7'))(new Redis(config[_0xb019('0x4')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x14672f,_0x13af83){_0x13af83=_0x13af83||0xcc;return function(_0x385f87){if(_0x385f87){return _0x14672f[_0xb019('0x8')](_0x13af83);}return _0x14672f[_0xb019('0x9')](_0x13af83)[_0xb019('0xa')]();};}function respondWithResult(_0x5c62b6,_0x4e1d68){_0x4e1d68=_0x4e1d68||0xc8;return function(_0x44f8aa){if(_0x44f8aa){return _0x5c62b6[_0xb019('0x9')](_0x4e1d68)[_0xb019('0xb')](_0x44f8aa);}};}function respondWithFilteredResult(_0x386c51,_0x3ac5c5){return function(_0x11cde4){if(_0x11cde4){var _0x382b45=typeof _0x3ac5c5[_0xb019('0xc')]===_0xb019('0xd')&&typeof _0x3ac5c5[_0xb019('0xe')]==='undefined';var _0x4c0f6c=_0x11cde4[_0xb019('0xf')];var _0x5e306c=_0x382b45?0x0:_0x3ac5c5[_0xb019('0xc')];var _0x48f05c=_0x382b45?_0x11cde4[_0xb019('0xf')]:_0x3ac5c5[_0xb019('0xc')]+_0x3ac5c5[_0xb019('0xe')];var _0x9fea1c;if(_0x48f05c>=_0x4c0f6c){_0x48f05c=_0x4c0f6c;_0x9fea1c=0xc8;}else{_0x9fea1c=0xce;}_0x386c51['status'](_0x9fea1c);return _0x386c51[_0xb019('0x10')]('Content-Range',_0x5e306c+'-'+_0x48f05c+'/'+_0x4c0f6c)[_0xb019('0xb')](_0x11cde4);}return null;};}function removeEntity(_0x4c14c0){return function(_0x1b1cac){if(_0x1b1cac){return _0x1b1cac[_0xb019('0x11')]()['then'](function(){var _0x57f2b5=_0x1b1cac[_0xb019('0x12')]({'plain':!![]});var _0x3abcb4=[{'name':_0xb019('0x13'),'value':'inbound','ignore':![]},{'name':_0xb019('0x14'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x230a9e=_(_0x3abcb4)[_0xb019('0x15')](_0xb019('0x16'))[_0xb019('0x17')](_0xb019('0x18'))['value']();if(_[_0xb019('0x19')](_0x230a9e,_0x57f2b5[_0xb019('0x1a')])){return;}var _0x9ac1f0=_['find'](_0x3abcb4,[_0xb019('0x18'),_0x57f2b5[_0xb019('0x1a')]])[_0xb019('0x1b')];return db[_0xb019('0x1c')][_0xb019('0x11')]({'where':{'type':_0x9ac1f0,'resourceId':_0x57f2b5['id']}})['then'](function(){return _0x1b1cac;});})[_0xb019('0x1d')](function(){_0x4c14c0[_0xb019('0x9')](0xcc)[_0xb019('0xa')]();});}};}function handleEntityNotFound(_0x475832){return function(_0x1c047a){if(!_0x1c047a){_0x475832[_0xb019('0x8')](0x194);}return _0x1c047a;};}function handleError(_0x38d2c3,_0x100eea){_0x100eea=_0x100eea||0x1f4;return function(_0x1fb079){logger[_0xb019('0x1e')](_0x1fb079[_0xb019('0x1f')]);if(_0x1fb079[_0xb019('0x1b')]){delete _0x1fb079[_0xb019('0x1b')];}_0x38d2c3[_0xb019('0x9')](_0x100eea)[_0xb019('0x20')](_0x1fb079);};}exports[_0xb019('0x21')]=function(_0x465967,_0x4068ac){var _0x49645d={},_0x29b8ed={},_0x384147={'count':0x0,'rows':[]};var _0x53064a=_[_0xb019('0x17')](db['VoiceExtension'][_0xb019('0x22')],function(_0x4ad891){return{'name':_0x4ad891['fieldName'],'type':_0x4ad891['type'][_0xb019('0x23')]};});_0x29b8ed[_0xb019('0x24')]=_[_0xb019('0x17')](_0x53064a,_0xb019('0x1b'));_0x29b8ed[_0xb019('0x25')]=_[_0xb019('0x26')](_0x465967['query']);_0x29b8ed['filters']=_[_0xb019('0x27')](_0x29b8ed[_0xb019('0x24')],_0x29b8ed[_0xb019('0x25')]);_0x49645d['attributes']=_['intersection'](_0x29b8ed[_0xb019('0x24')],qs[_0xb019('0x28')](_0x465967[_0xb019('0x25')][_0xb019('0x28')]));_0x49645d[_0xb019('0x29')]=_0x49645d[_0xb019('0x29')][_0xb019('0x2a')]?_0x49645d[_0xb019('0x29')]:_0x29b8ed[_0xb019('0x24')];if(!_0x465967[_0xb019('0x25')][_0xb019('0x2b')](_0xb019('0x2c'))){_0x49645d[_0xb019('0xe')]=qs[_0xb019('0xe')](_0x465967['query'][_0xb019('0xe')]);_0x49645d[_0xb019('0xc')]=qs[_0xb019('0xc')](_0x465967[_0xb019('0x25')][_0xb019('0xc')]);}_0x49645d[_0xb019('0x2d')]=qs['sort'](_0x465967['query'][_0xb019('0x2e')]);_0x49645d[_0xb019('0x2f')]=qs[_0xb019('0x30')](_[_0xb019('0x31')](_0x465967['query'],_0x29b8ed['filters']),_0x53064a);if(_0x465967[_0xb019('0x25')]['filter']){_0x49645d[_0xb019('0x2f')]=_[_0xb019('0x32')](_0x49645d[_0xb019('0x2f')],{'$or':_['map'](_0x53064a,function(_0x478c8e){if(_0x478c8e[_0xb019('0x1a')]!=='VIRTUAL'){var _0x4d196e={};_0x4d196e[_0x478c8e[_0xb019('0x1b')]]={'$like':'%'+_0x465967[_0xb019('0x25')][_0xb019('0x15')]+'%'};return _0x4d196e;}})});}_0x49645d=_[_0xb019('0x32')]({},_0x49645d,_0x465967[_0xb019('0x33')]);var _0x1546fb={'where':_0x49645d[_0xb019('0x2f')]};return db[_0xb019('0x34')]['count'](_0x1546fb)['then'](function(_0x3d69d9){_0x384147[_0xb019('0xf')]=_0x3d69d9;if(_0x465967[_0xb019('0x25')][_0xb019('0x35')]){_0x49645d[_0xb019('0x36')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x49645d);})['then'](function(_0x33d62c){_0x384147[_0xb019('0x37')]=_0x33d62c;return _0x384147;})[_0xb019('0x1d')](respondWithFilteredResult(_0x4068ac,_0x49645d))[_0xb019('0x38')](handleError(_0x4068ac,null));};exports['show']=function(_0x5d6d6f,_0x158119){var _0x47eab8={'raw':![],'where':{'id':_0x5d6d6f[_0xb019('0x39')]['id']}},_0x5ad006={};_0x5ad006[_0xb019('0x24')]=_[_0xb019('0x26')](db[_0xb019('0x34')]['rawAttributes']);_0x5ad006['query']=_[_0xb019('0x26')](_0x5d6d6f[_0xb019('0x25')]);_0x5ad006['filters']=_[_0xb019('0x27')](_0x5ad006[_0xb019('0x24')],_0x5ad006[_0xb019('0x25')]);_0x47eab8[_0xb019('0x29')]=_[_0xb019('0x27')](_0x5ad006[_0xb019('0x24')],qs[_0xb019('0x28')](_0x5d6d6f[_0xb019('0x25')][_0xb019('0x28')]));_0x47eab8[_0xb019('0x29')]=_0x47eab8['attributes'][_0xb019('0x2a')]?_0x47eab8[_0xb019('0x29')]:_0x5ad006[_0xb019('0x24')];if(_0x5d6d6f[_0xb019('0x25')][_0xb019('0x35')]){_0x47eab8[_0xb019('0x36')]=[{'all':!![]}];}_0x47eab8=_[_0xb019('0x32')]({},_0x47eab8,_0x5d6d6f[_0xb019('0x33')]);return db['VoiceExtension']['find'](_0x47eab8)['then'](handleEntityNotFound(_0x158119,null))['then'](respondWithResult(_0x158119,null))['catch'](handleError(_0x158119,null));};exports['destroy']=function(_0x2a5b48,_0x376464){return db[_0xb019('0x34')][_0xb019('0x3a')]({'where':{'id':_0x2a5b48[_0xb019('0x39')]['id']}})[_0xb019('0x1d')](handleEntityNotFound(_0x376464,null))[_0xb019('0x1d')](removeEntity(_0x376464,null))[_0xb019('0x38')](handleError(_0x376464,null));};exports[_0xb019('0x3b')]=function(_0x38d196,_0x4ea318){if(_0x38d196[_0xb019('0x3c')][_0xb019('0x1a')]===_0xb019('0x3d')&&!_['startsWith'](_0x38d196['body']['exten'],'_')){_0x38d196['body']['exten']='_'[_0xb019('0x3e')](_0x38d196['body']['exten']);}return db[_0xb019('0x34')][_0xb019('0x3b')](_0x38d196['body'],{'raw':![]})[_0xb019('0x1d')](function(_0x1b7597){var _0x4b1e22=_0x38d196[_0xb019('0x3f')]['get']({'plain':!![]});if(!_0x4b1e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b1e22[_0xb019('0x40')]==='user'){var _0x328199=_0x1b7597['get']({'plain':!![]});var _0x171676=[{'name':_0xb019('0x13'),'value':_0xb019('0x41')},{'name':_0xb019('0x14'),'value':_0xb019('0x3d')},{'name':_0xb019('0x42'),'value':_0xb019('0x43')}];var _0xfaf580=_[_0xb019('0x3a')](_0x171676,['value',_0x328199['type']])['name'];return db[_0xb019('0x44')][_0xb019('0x3a')]({'where':{'name':_0xfaf580,'userProfileId':_0x4b1e22['userProfileId']},'raw':!![]})[_0xb019('0x1d')](function(_0x50065c){if(_0x50065c&&_0x50065c[_0xb019('0x45')]===0x0){return db[_0xb019('0x1c')][_0xb019('0x3b')]({'name':_0x328199[_0xb019('0x1b')],'resourceId':_0x328199['id'],'type':_0x50065c['name'],'sectionId':_0x50065c['id']},{})[_0xb019('0x1d')](function(){return _0x1b7597;});}else{return _0x1b7597;}})['catch'](function(_0xedb5c0){logger[_0xb019('0x1e')](_0xb019('0x46'),_0xedb5c0);throw _0xedb5c0;});}return _0x1b7597;})[_0xb019('0x1d')](respondWithResult(_0x4ea318,0xc9))[_0xb019('0x38')](handleError(_0x4ea318,null));};exports[_0xb019('0x47')]=function(_0x12e0c9,_0x14184a){if(_0x12e0c9[_0xb019('0x3c')]['id']){delete _0x12e0c9[_0xb019('0x3c')]['id'];}return db[_0xb019('0x34')][_0xb019('0x3a')]({'where':{'id':_0x12e0c9[_0xb019('0x39')]['id']}})[_0xb019('0x1d')](handleEntityNotFound(_0x14184a,null))[_0xb019('0x1d')](function(_0x3dcdfe){if(_0x3dcdfe){return db['VoiceExtension'][_0xb019('0x47')](_[_0xb019('0x31')](_0x12e0c9[_0xb019('0x3c')],['exten',_0xb019('0x48'),_0xb019('0x49'),_0xb019('0x4a'),_0xb019('0x4b'),'mandatoryDisposition',_0xb019('0x4c')]),{'where':{'context':_0x3dcdfe['context'],'exten':_0x3dcdfe['exten']},'individualHooks':!![]})[_0xb019('0x1d')](function(_0xaed3e4){return _0xaed3e4;});}return null;})[_0xb019('0x1d')](respondWithStatusCode(_0x14184a,null))[_0xb019('0x38')](handleError(_0x14184a,null));};exports['addApplications']=function(_0x514031,_0x118b9b){var _0x15dc19=_0x514031[_0xb019('0x39')]['id'];var _0x425e45=_0x514031[_0xb019('0x3c')];var _0x26cb86=0xc8;var _0x5eb370=null;return db[_0xb019('0x4d')][_0xb019('0x4e')]({'isolationLevel':db[_0xb019('0x4d')][_0xb019('0x4f')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x55e498){return db[_0xb019('0x34')][_0xb019('0x50')]({'where':{'id':_0x15dc19},'transaction':_0x55e498})[_0xb019('0x1d')](function(_0x1a799b){if(_0x1a799b){return db[_0xb019('0x34')][_0xb019('0x11')]({'where':{'VoiceExtensionId':_0x15dc19},'transaction':_0x55e498})[_0xb019('0x1d')](function(){var _0x55cc1e=_[_0xb019('0x17')](_0x425e45,function(_0x1ad01d){_0x1ad01d[_0xb019('0x51')]=_0x15dc19;_0x1ad01d[_0xb019('0x52')]=!![];return _0x1ad01d;});return _0x1a799b['createRouting'](_0x55cc1e);})[_0xb019('0x1d')](function(_0x17581a){return db['VoiceExtension'][_0xb019('0x53')](_0x17581a,{'transaction':_0x55e498});});}else{_0x26cb86=0x194;_0x5eb370=[];}});})[_0xb019('0x1d')](function(){if(_0x26cb86!==0x194){return db[_0xb019('0x34')][_0xb019('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x15dc19},'order':'priority'})[_0xb019('0x1d')](function(_0x393bdc){_0x5eb370=_0x393bdc;});}})[_0xb019('0x38')](function(_0x3971eb){_0x26cb86=0x1f4;logger[_0xb019('0x1e')](_0x3971eb[_0xb019('0x1f')]);if(_0x3971eb['name']){delete _0x3971eb[_0xb019('0x1b')];}_0x5eb370=_0x3971eb;})[_0xb019('0x55')](function(){if(_0x5eb370===null){_0x118b9b[_0xb019('0x8')](_0x26cb86);}else{if(_0x26cb86===0x1f4){_0x118b9b[_0xb019('0x9')](_0x26cb86)['send'](_0x5eb370);}else{_0x118b9b[_0xb019('0x9')](_0x26cb86)[_0xb019('0xb')](_0x5eb370);}}});}; \ No newline at end of file +var _0xbb3e=['findAndCountAll','priority','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','exten','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xbb3e,0x10a));var _0xebb3=function(_0x3df7a0,_0xab9e05){_0x3df7a0=_0x3df7a0-0x0;var _0x1b344e=_0xbb3e[_0x3df7a0];return _0x1b344e;};'use strict';var _=require(_0xebb3('0x0'));var Redis=require(_0xebb3('0x1'));var qs=require(_0xebb3('0x2'));var logger=require(_0xebb3('0x3'))(_0xebb3('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xebb3('0x5')]=_[_0xebb3('0x6')](config[_0xebb3('0x5')],{'host':_0xebb3('0x7'),'port':0x18eb});var socket=require(_0xebb3('0x8'))(new Redis(config[_0xebb3('0x5')]));require('./voiceExtension.socket')[_0xebb3('0x9')](socket);function respondWithStatusCode(_0x1962b4,_0x530641){_0x530641=_0x530641||0xcc;return function(_0x1dfe2d){if(_0x1dfe2d){return _0x1962b4[_0xebb3('0xa')](_0x530641);}return _0x1962b4[_0xebb3('0xb')](_0x530641)[_0xebb3('0xc')]();};}function respondWithResult(_0x2e3691,_0xd7b323){_0xd7b323=_0xd7b323||0xc8;return function(_0x36ccaf){if(_0x36ccaf){return _0x2e3691[_0xebb3('0xb')](_0xd7b323)[_0xebb3('0xd')](_0x36ccaf);}};}function respondWithFilteredResult(_0x48cb2b,_0x371b80){return function(_0x4ab9ca){if(_0x4ab9ca){var _0x49894f=typeof _0x371b80[_0xebb3('0xe')]==='undefined'&&typeof _0x371b80[_0xebb3('0xf')]===_0xebb3('0x10');var _0x241685=_0x4ab9ca[_0xebb3('0x11')];var _0x3e38b7=_0x49894f?0x0:_0x371b80[_0xebb3('0xe')];var _0x4cc799=_0x49894f?_0x4ab9ca[_0xebb3('0x11')]:_0x371b80['offset']+_0x371b80[_0xebb3('0xf')];var _0x3d3f40;if(_0x4cc799>=_0x241685){_0x4cc799=_0x241685;_0x3d3f40=0xc8;}else{_0x3d3f40=0xce;}_0x48cb2b[_0xebb3('0xb')](_0x3d3f40);return _0x48cb2b[_0xebb3('0x12')](_0xebb3('0x13'),_0x3e38b7+'-'+_0x4cc799+'/'+_0x241685)[_0xebb3('0xd')](_0x4ab9ca);}return null;};}function removeEntity(_0x6632bf){return function(_0x18e47d){if(_0x18e47d){return _0x18e47d[_0xebb3('0x14')]()[_0xebb3('0x15')](function(){var _0x2b47d3=_0x18e47d[_0xebb3('0x16')]({'plain':!![]});var _0x421953=[{'name':_0xebb3('0x17'),'value':_0xebb3('0x18'),'ignore':![]},{'name':_0xebb3('0x19'),'value':_0xebb3('0x1a'),'ignore':![]},{'name':_0xebb3('0x1b'),'value':'internal','ignore':![]}];var _0x87656b=_(_0x421953)['filter'](_0xebb3('0x1c'))[_0xebb3('0x1d')](_0xebb3('0x1e'))[_0xebb3('0x1e')]();if(_['includes'](_0x87656b,_0x2b47d3['type'])){return;}var _0xc21531=_[_0xebb3('0x1f')](_0x421953,['value',_0x2b47d3[_0xebb3('0x20')]])[_0xebb3('0x21')];return db[_0xebb3('0x22')][_0xebb3('0x14')]({'where':{'type':_0xc21531,'resourceId':_0x2b47d3['id']}})[_0xebb3('0x15')](function(){return _0x18e47d;});})[_0xebb3('0x15')](function(){_0x6632bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c597){return function(_0x1db23a){if(!_0x1db23a){_0x38c597[_0xebb3('0xa')](0x194);}return _0x1db23a;};}function handleError(_0x532ac1,_0x1a61d2){_0x1a61d2=_0x1a61d2||0x1f4;return function(_0x574269){logger[_0xebb3('0x23')](_0x574269[_0xebb3('0x24')]);if(_0x574269[_0xebb3('0x21')]){delete _0x574269[_0xebb3('0x21')];}_0x532ac1['status'](_0x1a61d2)[_0xebb3('0x25')](_0x574269);};}exports[_0xebb3('0x26')]=function(_0x384928,_0x29b4ef){var _0x4f67c2={},_0x31fa61={},_0x497061={'count':0x0,'rows':[]};var _0x45af65=_[_0xebb3('0x1d')](db[_0xebb3('0x27')][_0xebb3('0x28')],function(_0x24d9b4){return{'name':_0x24d9b4[_0xebb3('0x29')],'type':_0x24d9b4['type'][_0xebb3('0x2a')]};});_0x31fa61[_0xebb3('0x2b')]=_['map'](_0x45af65,_0xebb3('0x21'));_0x31fa61[_0xebb3('0x2c')]=_[_0xebb3('0x2d')](_0x384928[_0xebb3('0x2c')]);_0x31fa61[_0xebb3('0x2e')]=_[_0xebb3('0x2f')](_0x31fa61['model'],_0x31fa61[_0xebb3('0x2c')]);_0x4f67c2[_0xebb3('0x30')]=_[_0xebb3('0x2f')](_0x31fa61['model'],qs[_0xebb3('0x31')](_0x384928[_0xebb3('0x2c')][_0xebb3('0x31')]));_0x4f67c2['attributes']=_0x4f67c2['attributes'][_0xebb3('0x32')]?_0x4f67c2[_0xebb3('0x30')]:_0x31fa61[_0xebb3('0x2b')];if(!_0x384928['query'][_0xebb3('0x33')](_0xebb3('0x34'))){_0x4f67c2[_0xebb3('0xf')]=qs[_0xebb3('0xf')](_0x384928[_0xebb3('0x2c')][_0xebb3('0xf')]);_0x4f67c2[_0xebb3('0xe')]=qs[_0xebb3('0xe')](_0x384928[_0xebb3('0x2c')][_0xebb3('0xe')]);}_0x4f67c2[_0xebb3('0x35')]=qs[_0xebb3('0x36')](_0x384928[_0xebb3('0x2c')][_0xebb3('0x36')]);_0x4f67c2['where']=qs[_0xebb3('0x2e')](_['pick'](_0x384928[_0xebb3('0x2c')],_0x31fa61[_0xebb3('0x2e')]),_0x45af65);if(_0x384928[_0xebb3('0x2c')][_0xebb3('0x37')]){_0x4f67c2[_0xebb3('0x38')]=_[_0xebb3('0x39')](_0x4f67c2[_0xebb3('0x38')],{'$or':_['map'](_0x45af65,function(_0x56c7cf){if(_0x56c7cf[_0xebb3('0x20')]!==_0xebb3('0x3a')){var _0x5d0914={};_0x5d0914[_0x56c7cf[_0xebb3('0x21')]]={'$like':'%'+_0x384928[_0xebb3('0x2c')][_0xebb3('0x37')]+'%'};return _0x5d0914;}})});}_0x4f67c2=_[_0xebb3('0x39')]({},_0x4f67c2,_0x384928[_0xebb3('0x3b')]);var _0x26e73d={'where':_0x4f67c2[_0xebb3('0x38')]};return db['VoiceExtension'][_0xebb3('0x11')](_0x26e73d)[_0xebb3('0x15')](function(_0x95753e){_0x497061[_0xebb3('0x11')]=_0x95753e;if(_0x384928[_0xebb3('0x2c')][_0xebb3('0x3c')]){_0x4f67c2[_0xebb3('0x3d')]=[{'all':!![]}];}return db[_0xebb3('0x27')][_0xebb3('0x3e')](_0x4f67c2);})['then'](function(_0x1144e4){_0x497061['rows']=_0x1144e4;return _0x497061;})['then'](respondWithFilteredResult(_0x29b4ef,_0x4f67c2))[_0xebb3('0x3f')](handleError(_0x29b4ef,null));};exports['show']=function(_0x481917,_0x20f589){var _0x534789={'raw':![],'where':{'id':_0x481917['params']['id']}},_0x132a9f={};_0x132a9f[_0xebb3('0x2b')]=_[_0xebb3('0x2d')](db[_0xebb3('0x27')]['rawAttributes']);_0x132a9f[_0xebb3('0x2c')]=_[_0xebb3('0x2d')](_0x481917[_0xebb3('0x2c')]);_0x132a9f[_0xebb3('0x2e')]=_[_0xebb3('0x2f')](_0x132a9f['model'],_0x132a9f[_0xebb3('0x2c')]);_0x534789[_0xebb3('0x30')]=_[_0xebb3('0x2f')](_0x132a9f[_0xebb3('0x2b')],qs['fields'](_0x481917[_0xebb3('0x2c')][_0xebb3('0x31')]));_0x534789[_0xebb3('0x30')]=_0x534789['attributes'][_0xebb3('0x32')]?_0x534789[_0xebb3('0x30')]:_0x132a9f[_0xebb3('0x2b')];if(_0x481917[_0xebb3('0x2c')]['includeAll']){_0x534789['include']=[{'all':!![]}];}_0x534789=_[_0xebb3('0x39')]({},_0x534789,_0x481917[_0xebb3('0x3b')]);return db[_0xebb3('0x27')]['find'](_0x534789)[_0xebb3('0x15')](handleEntityNotFound(_0x20f589,null))['then'](respondWithResult(_0x20f589,null))['catch'](handleError(_0x20f589,null));};exports['destroy']=function(_0x1c46d5,_0x1d2ce9){return db[_0xebb3('0x27')]['find']({'where':{'id':_0x1c46d5[_0xebb3('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d2ce9,null))[_0xebb3('0x15')](removeEntity(_0x1d2ce9,null))['catch'](handleError(_0x1d2ce9,null));};exports['create']=function(_0x3e3a54,_0x3326fc){if(_0x3e3a54['body']['type']===_0xebb3('0x1a')&&!_['startsWith'](_0x3e3a54['body'][_0xebb3('0x41')],'_')){_0x3e3a54[_0xebb3('0x42')][_0xebb3('0x41')]='_'['concat'](_0x3e3a54[_0xebb3('0x42')][_0xebb3('0x41')]);}return db['VoiceExtension']['create'](_0x3e3a54[_0xebb3('0x42')],{'raw':![]})[_0xebb3('0x15')](function(_0x366197){var _0x26d857=_0x3e3a54['user']['get']({'plain':!![]});if(!_0x26d857)throw new Error(_0xebb3('0x43'));if(_0x26d857[_0xebb3('0x44')]===_0xebb3('0x45')){var _0x41e68b=_0x366197[_0xebb3('0x16')]({'plain':!![]});var _0x432bf8=[{'name':_0xebb3('0x17'),'value':_0xebb3('0x18')},{'name':'OutboundRoutes','value':_0xebb3('0x1a')},{'name':_0xebb3('0x1b'),'value':_0xebb3('0x46')}];var _0x40bc7d=_[_0xebb3('0x1f')](_0x432bf8,[_0xebb3('0x1e'),_0x41e68b[_0xebb3('0x20')]])['name'];return db[_0xebb3('0x47')][_0xebb3('0x1f')]({'where':{'name':_0x40bc7d,'userProfileId':_0x26d857['userProfileId']},'raw':!![]})['then'](function(_0x3e30aa){if(_0x3e30aa&&_0x3e30aa[_0xebb3('0x48')]===0x0){return db[_0xebb3('0x22')]['create']({'name':_0x41e68b['name'],'resourceId':_0x41e68b['id'],'type':_0x3e30aa['name'],'sectionId':_0x3e30aa['id']},{})[_0xebb3('0x15')](function(){return _0x366197;});}else{return _0x366197;}})['catch'](function(_0x273e6f){logger[_0xebb3('0x23')](_0xebb3('0x49'),_0x273e6f);throw _0x273e6f;});}return _0x366197;})['then'](respondWithResult(_0x3326fc,0xc9))[_0xebb3('0x3f')](handleError(_0x3326fc,null));};exports[_0xebb3('0x4a')]=function(_0x16e3e6,_0x27c173){if(_0x16e3e6[_0xebb3('0x42')]['id']){delete _0x16e3e6[_0xebb3('0x42')]['id'];}return db[_0xebb3('0x27')][_0xebb3('0x1f')]({'where':{'id':_0x16e3e6['params']['id']}})['then'](handleEntityNotFound(_0x27c173,null))['then'](function(_0x46bd63){if(_0x46bd63){return db[_0xebb3('0x27')][_0xebb3('0x4a')](_[_0xebb3('0x4b')](_0x16e3e6[_0xebb3('0x42')],['exten',_0xebb3('0x4c'),_0xebb3('0x4d'),'recordingFormat',_0xebb3('0x4e'),'mandatoryDisposition','alias']),{'where':{'context':_0x46bd63[_0xebb3('0x4c')],'exten':_0x46bd63[_0xebb3('0x41')]},'individualHooks':!![]})['then'](function(_0x28dcc7){return _0x28dcc7;});}return null;})[_0xebb3('0x15')](respondWithStatusCode(_0x27c173,null))[_0xebb3('0x3f')](handleError(_0x27c173,null));};exports['addApplications']=function(_0x4d4db,_0x4f02b8){var _0x10ed6a=_0x4d4db[_0xebb3('0x40')]['id'];var _0x327a1a=_0x4d4db[_0xebb3('0x42')];var _0x33ff10=0xc8;var _0x84b66=null;return db[_0xebb3('0x4f')][_0xebb3('0x50')]({'isolationLevel':db[_0xebb3('0x4f')]['Transaction']['ISOLATION_LEVELS'][_0xebb3('0x51')]},function(_0x227d46){return db[_0xebb3('0x27')][_0xebb3('0x52')]({'where':{'id':_0x10ed6a},'transaction':_0x227d46})['then'](function(_0x2259f8){if(_0x2259f8){return db[_0xebb3('0x27')]['destroy']({'where':{'VoiceExtensionId':_0x10ed6a},'transaction':_0x227d46})['then'](function(){var _0x2a7c54=_[_0xebb3('0x1d')](_0x327a1a,function(_0x2bfbbe){_0x2bfbbe[_0xebb3('0x53')]=_0x10ed6a;_0x2bfbbe[_0xebb3('0x54')]=!![];return _0x2bfbbe;});return _0x2259f8['createRouting'](_0x2a7c54);})[_0xebb3('0x15')](function(_0x4b73fc){return db[_0xebb3('0x27')][_0xebb3('0x55')](_0x4b73fc,{'transaction':_0x227d46});});}else{_0x33ff10=0x194;_0x84b66=[];}});})[_0xebb3('0x15')](function(){if(_0x33ff10!==0x194){return db[_0xebb3('0x27')][_0xebb3('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x10ed6a},'order':_0xebb3('0x57')})['then'](function(_0x10c92b){_0x84b66=_0x10c92b;});}})[_0xebb3('0x3f')](function(_0x472c2f){_0x33ff10=0x1f4;logger['error'](_0x472c2f[_0xebb3('0x24')]);if(_0x472c2f[_0xebb3('0x21')]){delete _0x472c2f[_0xebb3('0x21')];}_0x84b66=_0x472c2f;})['finally'](function(){if(_0x84b66===null){_0x4f02b8[_0xebb3('0xa')](_0x33ff10);}else{if(_0x33ff10===0x1f4){_0x4f02b8[_0xebb3('0xb')](_0x33ff10)[_0xebb3('0x25')](_0x84b66);}else{_0x4f02b8['status'](_0x33ff10)[_0xebb3('0xd')](_0x84b66);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 32aeff6..e0db28b 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 _0xa3c6=['save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x710f40,_0x1e9057){var _0x4fd641=function(_0x2fef9b){while(--_0x2fef9b){_0x710f40['push'](_0x710f40['shift']());}};_0x4fd641(++_0x1e9057);}(_0xa3c6,0x16b));var _0x6a3c=function(_0x41f89e,_0x1364a3){_0x41f89e=_0x41f89e-0x0;var _0x1b7e94=_0xa3c6[_0x41f89e];return _0x1b7e94;};'use strict';var EventEmitter=require(_0x6a3c('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a3c('0x1'),'afterUpdate':_0x6a3c('0x2'),'afterDestroy':_0x6a3c('0x3')};function emitEvent(_0xef3667){return function(_0x107465,_0xb9598,_0x542891){VoiceExtensionEvents['emit'](_0xef3667+':'+_0x107465['id'],_0x107465);VoiceExtensionEvents[_0x6a3c('0x4')](_0xef3667,_0x107465);_0x542891(null);};}for(var e in events){if(events[_0x6a3c('0x5')](e)){var event=events[e];VoiceExtension[_0x6a3c('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xff6a=['save','update','remove','emit','hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners'];(function(_0x1beb47,_0x29e694){var _0x1099e4=function(_0x3cf1de){while(--_0x3cf1de){_0x1beb47['push'](_0x1beb47['shift']());}};_0x1099e4(++_0x29e694);}(_0xff6a,0x19c));var _0xaff6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xff6a[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xaff6('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xaff6('0x1')](0x0);var events={'afterCreate':_0xaff6('0x2'),'afterUpdate':_0xaff6('0x3'),'afterDestroy':_0xaff6('0x4')};function emitEvent(_0xed4326){return function(_0x26dd57,_0x3036af,_0x5e9169){VoiceExtensionEvents['emit'](_0xed4326+':'+_0x26dd57['id'],_0x26dd57);VoiceExtensionEvents[_0xaff6('0x5')](_0xed4326,_0x26dd57);_0x5e9169(null);};}for(var e in events){if(events[_0xaff6('0x6')](e)){var event=events[e];VoiceExtension[_0xaff6('0x7')](e,emitEvent(event));}}module[_0xaff6('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 3aaf1f1..e79dcc8 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 _0x177e=['ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','recordingFormat','wav','timeout','options','split','length','name','trunk','param','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','get','Hangup','CDR(type)=','type','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','Set','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}'];(function(_0x3be63d,_0x457353){var _0x5151ed=function(_0x5b78f9){while(--_0x5b78f9){_0x3be63d['push'](_0x3be63d['shift']());}};_0x5151ed(++_0x457353);}(_0x177e,0xd0));var _0xe177=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x177e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x57c7d0){var _0x5b0b84=_0x57c7d0['models'];function _0x5b5b7d(_0x1defcd){var _0x100b85=0x2;var _0x34b1d1=[{'type':_0x1defcd['type'],'app':'Set','appdata':_0xe177('0x0')+_0x1defcd[_0xe177('0x1')],'context':_0x1defcd[_0xe177('0x2')],'exten':_0x1defcd['exten'],'priority':_0x100b85++,'VoiceExtensionId':_0x1defcd['id']},{'type':_0x1defcd[_0xe177('0x1')],'app':_0x1defcd[_0xe177('0x3')]?'Set':_0xe177('0x4'),'appdata':_0x1defcd[_0xe177('0x3')]?_0xe177('0x5')+_0x1defcd[_0xe177('0x3')]:_0xe177('0x6'),'context':_0x1defcd['context'],'exten':_0x1defcd[_0xe177('0x7')],'priority':_0x100b85++,'VoiceExtensionId':_0x1defcd['id']}];if(_0x1defcd[_0xe177('0x1')]===_0xe177('0x8')){_0x34b1d1[_0xe177('0x9')]({'type':'inbound','app':_0xe177('0xa'),'appdata':_0xe177('0xb')+_0x1defcd['id'],'context':_0x1defcd[_0xe177('0x2')],'exten':_0x1defcd[_0xe177('0x7')],'priority':_0x100b85++,'VoiceExtensionId':_0x1defcd['id']});}_0x34b1d1[_0xe177('0x9')]({'type':_0x1defcd[_0xe177('0x1')],'app':_0xe177('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1defcd['context'],'exten':_0x1defcd[_0xe177('0x7')],'priority':_0x100b85++,'VoiceExtensionId':_0x1defcd['id']},{'type':_0x1defcd[_0xe177('0x1')],'app':_0xe177('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1defcd[_0xe177('0x2')],'exten':_0x1defcd[_0xe177('0x7')],'priority':_0x100b85++,'VoiceExtensionId':_0x1defcd['id']},{'type':_0x1defcd[_0xe177('0x1')],'app':_0xe177('0xa'),'appdata':_0xe177('0xc'),'context':_0x1defcd[_0xe177('0x2')],'exten':_0x1defcd['exten'],'priority':_0x100b85++,'VoiceExtensionId':_0x1defcd['id']});return _0x34b1d1;}function _0x5968a7(_0x3bcde0){var _0x590996=0x2;var _0x52aa25=[{'type':'outbound','app':_0xe177('0xa'),'appdata':'CDR(type)=outbound','context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0['exten'],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':_0x3bcde0['alias']?_0xe177('0xa'):_0xe177('0x4'),'appdata':_0x3bcde0['alias']?_0xe177('0x5')+_0x3bcde0['alias']:_0xe177('0x6'),'context':_0x3bcde0['context'],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':'outbound','app':_0xe177('0xa'),'appdata':_0xe177('0xe')+(_0x3bcde0[_0xe177('0xf')]?'${EXTEN:'+_0x3bcde0['cutdigits']+'}':_0xe177('0x10')),'context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':_0xe177('0xa'),'appdata':_0xe177('0xb')+_0x3bcde0['id'],'context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':_0xe177('0x11'),'appdata':_0xe177('0x12')+(_0x590996+0x2)+_0xe177('0x13')+(_0x590996+0x1)+')','context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':'outbound','app':'Set','appdata':_0x3bcde0['cutdigits']?_0xe177('0x14')+_0x3bcde0[_0xe177('0xf')]+'}':'CDR(prefix)=noprefix','context':_0x3bcde0['context'],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':_0xe177('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3bcde0['context'],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':_0xe177('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':'outbound','app':_0xe177('0xa'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':_0xe177('0xa'),'appdata':'outboundrouteid='+_0x3bcde0['id'],'context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']}];if(_0x3bcde0['hasOwnProperty']('recordingFormat')&&_0x3bcde0['recordingFormat']!=='none'){_0x52aa25[_0xe177('0x9')]({'type':'outbound','app':_0xe177('0xa'),'appdata':_0xe177('0x15'),'context':_0x3bcde0[_0xe177('0x2')],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']},{'type':_0xe177('0xd'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3bcde0[_0xe177('0x16')]||_0xe177('0x17'),'context':_0x3bcde0['context'],'exten':_0x3bcde0[_0xe177('0x7')],'priority':_0x590996++,'VoiceExtensionId':_0x3bcde0['id']});}return _0x52aa25;}function _0x56b0d0(_0x24919d,_0x5315e5){var _0x3edac3=[{'name':'trunk','param':0x0},{'name':_0xe177('0x18'),'param':0x1},{'name':_0xe177('0x19'),'param':0x2},{'name':'url','param':0x3}];var _0x2133b8={};var _0x30d3f0=_0x5315e5[_0xe177('0x1a')](',');var _0x283248=[];for(var _0x36b9df=0x0;_0x36b9df<_0x3edac3[_0xe177('0x1b')];_0x36b9df++){switch(_0x3edac3[_0x36b9df][_0xe177('0x1c')]){case _0xe177('0x1d'):_0x2133b8['trunk']=_0x30d3f0[_0x3edac3[_0x36b9df][_0xe177('0x1e')]]['split']('/')[0x1];_0x2133b8[_0xe177('0x1f')]=_0x30d3f0[_0x3edac3[_0x36b9df]['param']][_0xe177('0x1a')]('/')[0x2];_0x2133b8[_0xe177('0x20')]=_0x2133b8[_0xe177('0x1f')]?_0x2133b8[_0xe177('0x1f')]['split']('$')[0x0]:undefined;_0x2133b8[_0xe177('0x1f')]=_0x24919d[_0xe177('0xf')]?(_0x2133b8[_0xe177('0x20')]||'')+_0xe177('0x21')+_0x24919d[_0xe177('0xf')]+'}':(_0x2133b8['prefix']||'')+_0xe177('0x10');_0x283248[_0x3edac3[_0x36b9df]['param']]=[_0xe177('0x22'),_0x2133b8[_0xe177('0x1d')],_0x2133b8[_0xe177('0x1f')]][_0xe177('0x23')]('/');break;case _0xe177('0x19'):_0x2133b8[_0xe177('0x19')]=_0x30d3f0[_0x3edac3[_0x36b9df]['param']];if(_0x24919d[_0xe177('0x16')]!=='none'){if(_0x2133b8[_0xe177('0x19')][_0xe177('0x24')](_0xe177('0x25'))<0x0){_0x2133b8['options']+=_0xe177('0x25');}}else{_0x2133b8[_0xe177('0x19')]=_0x2133b8['options'][_0xe177('0x26')](_0xe177('0x25'),'');}_0x283248[_0x3edac3[_0x36b9df][_0xe177('0x1e')]]=_0x2133b8[_0xe177('0x19')];break;default:_0x283248[_0x3edac3[_0x36b9df][_0xe177('0x1e')]]=_0x30d3f0[_0x3edac3[_0x36b9df][_0xe177('0x1e')]];}}return _0x283248[_0xe177('0x23')](',');}function _0xcfdb57(_0x55b8f3,_0x65dace,_0x398cbd){return new Promise(function(_0x558f21,_0x2a1647){var _0x2c3b17=[];if(_[_0xe177('0x27')](_0x65dace))return _0x558f21(_0x2c3b17);_0x5b0b84[_0xe177('0x28')][_0xe177('0x29')]({'attributes':['id',_0xe177('0x2a'),_0xe177('0x2b')],'raw':!![]})[_0xe177('0x2c')](function(_0x142cf8){for(var _0x546ddc=0x0,_0xfeef72=0x0;_0x546ddc<_0x65dace[_0xe177('0x1b')];_0x546ddc++,_0xfeef72=0x0){var _0x5e1180=_0x65dace[_0x546ddc];var _0x254cc5=[];var _0x5f11c1=[];delete _0x5e1180['id'];if(_0x5e1180['interval']!==_0xe177('0x2d')){_0x5e1180[_0xe177('0x2e')]=[_0x5e1180[_0xe177('0x2a')]];}else{_0x5e1180['intervals']=_0x5e1180[_0xe177('0x2b')]?_[_0xe177('0x2f')](_['filter'](_0x142cf8,{'IntervalId':_0x5e1180['IntervalId']}),'interval'):[];}_0x5e1180[_0xe177('0x2')]=_0x55b8f3[_0xe177('0x2')];_0x5e1180[_0xe177('0x7')]=_0x55b8f3['exten'];if(_0x5e1180['type'])_0x5e1180[_0xe177('0x1')]=_0x5e1180[_0xe177('0x1')][_0xe177('0x30')]();if(_0x55b8f3[_0xe177('0x1')]==='outbound'){if(_0x5e1180['hasOwnProperty']('tag')&&_0x5e1180[_0xe177('0x31')]&&_0x5e1180['tag']!=='--'){_0x254cc5[_0xe177('0x9')]({'type':_0x5e1180['type']['toLowerCase'](),'app':'Set','appdata':_0xe177('0x32')+_0x5e1180['tag'],'context':_0x55b8f3[_0xe177('0x2')],'exten':_0x55b8f3[_0xe177('0x7')],'priority':_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')]+_0x398cbd+_0xfeef72++,'VoiceExtensionId':_0x55b8f3['id']});}_0x254cc5[_0xe177('0x9')]({'type':_0x5e1180[_0xe177('0x1')][_0xe177('0x30')](),'app':_0xe177('0x11'),'appdata':_0xe177('0x33')+(_0x5e1180[_0xe177('0x34')]?_0xe177('0x35')+_0x5e1180['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x55b8f3[_0xe177('0x2')],'exten':_0x55b8f3[_0xe177('0x7')],'priority':_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')]+_0x398cbd+_0xfeef72++,'VoiceExtensionId':_0x55b8f3['id']});}else{if(_0x5e1180['hasOwnProperty'](_0xe177('0x36'))){if(['queue',_0xe177('0x37')][_0xe177('0x38')](_0x5e1180[_0xe177('0x39')]['toLowerCase']())&&_0x5e1180[_0xe177('0x3a')]!==_0xe177('0x3b')){if(_0x5e1180[_0xe177('0x36')]){_0x254cc5[_0xe177('0x9')]({'type':_0x5e1180[_0xe177('0x1')][_0xe177('0x30')](),'app':_0xe177('0x11'),'appdata':_0xe177('0x3c'),'context':_0x55b8f3[_0xe177('0x2')],'exten':_0x55b8f3[_0xe177('0x7')],'priority':_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')]+_0x398cbd+_0xfeef72++,'VoiceExtensionId':_0x55b8f3['id']});_0x254cc5[_0xe177('0x9')]({'type':_0x5e1180[_0xe177('0x1')][_0xe177('0x30')](),'app':_0xe177('0xa'),'appdata':_0xe177('0x3d'),'context':_0x55b8f3[_0xe177('0x2')],'exten':_0x55b8f3[_0xe177('0x7')],'priority':_0x5e1180['intervals'][_0xe177('0x1b')]+_0x398cbd+_0xfeef72++,'VoiceExtensionId':_0x55b8f3['id']});}else{_0x254cc5[_0xe177('0x9')]({'type':_0x5e1180[_0xe177('0x1')]['toLowerCase'](),'app':_0xe177('0x11'),'appdata':_0xe177('0x3e'),'context':_0x55b8f3['context'],'exten':_0x55b8f3[_0xe177('0x7')],'priority':_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')]+_0x398cbd+_0xfeef72++,'VoiceExtensionId':_0x55b8f3['id']});_0x254cc5['push']({'type':_0x5e1180[_0xe177('0x1')][_0xe177('0x30')](),'app':_0xe177('0xa'),'appdata':_0xe177('0x3f'),'context':_0x55b8f3[_0xe177('0x2')],'exten':_0x55b8f3[_0xe177('0x7')],'priority':_0x5e1180[_0xe177('0x2e')]['length']+_0x398cbd+_0xfeef72++,'VoiceExtensionId':_0x55b8f3['id']});}}}}for(var _0x172d84=0x0;_0x172d84<_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')];_0x172d84++){var _0x431dd1=_0x398cbd+_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')];var _0x334cd5=_0x172d84===_0x5e1180[_0xe177('0x2e')][_0xe177('0x1b')]-0x1?_0x398cbd+_0x254cc5['length']+_0x5f11c1[_0xe177('0x1b')]+0x2:_0x398cbd+_0x172d84+0x1;_0x254cc5['splice'](_0x172d84,0x0,{'type':_0x55b8f3['type'],'app':_0xe177('0x40'),'appdata':_0x5e1180[_0xe177('0x2e')][_0x172d84]+'?'+_0x55b8f3[_0xe177('0x2')]+_0xe177('0x41')+_0x431dd1+':'+_0x55b8f3[_0xe177('0x2')]+_0xe177('0x41')+_0x334cd5,'exten':_0x55b8f3[_0xe177('0x7')],'context':_0x55b8f3[_0xe177('0x2')],'priority':_0x398cbd+_0x172d84,'VoiceExtensionId':_0x55b8f3['id']});}if(_0x5e1180['appType']===_0xe177('0x42'))_0x5e1180[_0xe177('0x43')]=_0x56b0d0(_0x55b8f3,_0x5e1180[_0xe177('0x43')]);_0x5e1180[_0xe177('0x44')]=_0x254cc5[_0xe177('0x1b')]?_['last'](_0x254cc5)['priority']+0x1:_0x398cbd;_0x2c3b17=_[_0xe177('0x45')](_0x2c3b17,_0x254cc5,[_0x5e1180],_0x5f11c1);_0x398cbd=_[_0xe177('0x46')](_0x2c3b17)[_0xe177('0x44')]+0x1;}return _0x558f21(_0x2c3b17);})[_0xe177('0x47')](function(_0x1d3397){_0x2a1647(_0x1d3397);});});}return _0x57c7d0[_0xe177('0x48')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x12208c){var _0x300dc2=this[_0xe177('0x49')]({'plain':!![]});var _0xaf219c=_0x300dc2[_0xe177('0x1')]===_0xe177('0xd')?_0x5968a7(_0x300dc2):_0x5b5b7d(_0x300dc2);return _0xcfdb57(_0x300dc2,_0x12208c,_[_0xe177('0x46')](_0xaf219c)['priority']+0x1)[_0xe177('0x2c')](function(_0x455056){var _0x1043b7=_[_0xe177('0x45')](_0xaf219c,_0x455056);_0x1043b7['push']({'type':_0x300dc2[_0xe177('0x1')],'app':_0xe177('0x4a'),'exten':_0x300dc2[_0xe177('0x7')],'context':_0x300dc2[_0xe177('0x2')],'priority':_[_0xe177('0x46')](_0x1043b7)['priority']+0x1,'VoiceExtensionId':_0x300dc2['id']});return _0x1043b7;});}}});}; \ No newline at end of file +var _0x590c=['_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','timeout','options','split','length','name','param','prefix','phone','join','indexOf','U(xcally-mixmonitor-context)','replace','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','lodash','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x298548,_0x492792){var _0x1c5c98=function(_0x3584d3){while(--_0x3584d3){_0x298548['push'](_0x298548['shift']());}};_0x1c5c98(++_0x492792);}(_0x590c,0x80));var _0xc590=function(_0x49b561,_0x28bc6c){_0x49b561=_0x49b561-0x0;var _0x1c36fa=_0x590c[_0x49b561];return _0x1c36fa;};'use strict';var _=require(_0xc590('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x3ce18b){var _0x33103b=_0x3ce18b[_0xc590('0x1')];function _0x2544d5(_0x3b65b2){var _0x70e0ce=0x2;var _0x16054c=[{'type':_0x3b65b2[_0xc590('0x2')],'app':_0xc590('0x3'),'appdata':_0xc590('0x4')+_0x3b65b2[_0xc590('0x2')],'context':_0x3b65b2[_0xc590('0x5')],'exten':_0x3b65b2[_0xc590('0x6')],'priority':_0x70e0ce++,'VoiceExtensionId':_0x3b65b2['id']},{'type':_0x3b65b2[_0xc590('0x2')],'app':_0x3b65b2[_0xc590('0x7')]?'Set':'NoOp','appdata':_0x3b65b2[_0xc590('0x7')]?_0xc590('0x8')+_0x3b65b2['alias']:_0xc590('0x9'),'context':_0x3b65b2[_0xc590('0x5')],'exten':_0x3b65b2[_0xc590('0x6')],'priority':_0x70e0ce++,'VoiceExtensionId':_0x3b65b2['id']}];if(_0x3b65b2[_0xc590('0x2')]===_0xc590('0xa')){_0x16054c['push']({'type':'inbound','app':_0xc590('0x3'),'appdata':'CDR(routeid)='+_0x3b65b2['id'],'context':_0x3b65b2['context'],'exten':_0x3b65b2['exten'],'priority':_0x70e0ce++,'VoiceExtensionId':_0x3b65b2['id']});}_0x16054c[_0xc590('0xb')]({'type':_0x3b65b2[_0xc590('0x2')],'app':_0xc590('0x3'),'appdata':_0xc590('0xc'),'context':_0x3b65b2[_0xc590('0x5')],'exten':_0x3b65b2[_0xc590('0x6')],'priority':_0x70e0ce++,'VoiceExtensionId':_0x3b65b2['id']},{'type':_0x3b65b2[_0xc590('0x2')],'app':_0xc590('0x3'),'appdata':_0xc590('0xd'),'context':_0x3b65b2[_0xc590('0x5')],'exten':_0x3b65b2[_0xc590('0x6')],'priority':_0x70e0ce++,'VoiceExtensionId':_0x3b65b2['id']},{'type':_0x3b65b2[_0xc590('0x2')],'app':_0xc590('0x3'),'appdata':_0xc590('0xe'),'context':_0x3b65b2[_0xc590('0x5')],'exten':_0x3b65b2[_0xc590('0x6')],'priority':_0x70e0ce++,'VoiceExtensionId':_0x3b65b2['id']});return _0x16054c;}function _0xf38785(_0x22dc8f){var _0x4197c2=0x2;var _0x275672=[{'type':_0xc590('0xf'),'app':_0xc590('0x3'),'appdata':_0xc590('0x10'),'context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':_0x22dc8f[_0xc590('0x7')]?_0xc590('0x3'):'NoOp','appdata':_0x22dc8f[_0xc590('0x7')]?_0xc590('0x8')+_0x22dc8f['alias']:'No\x20alias\x20set','context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':'Set','appdata':_0xc590('0x11')+(_0x22dc8f[_0xc590('0x12')]?'${EXTEN:'+_0x22dc8f[_0xc590('0x12')]+'}':_0xc590('0x13')),'context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':'Set','appdata':'CDR(routeid)='+_0x22dc8f['id'],'context':_0x22dc8f['context'],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':_0xc590('0x14'),'appdata':_0xc590('0x15')+(_0x4197c2+0x2)+_0xc590('0x16')+(_0x4197c2+0x1)+')','context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':_0xc590('0x3'),'appdata':_0x22dc8f[_0xc590('0x12')]?_0xc590('0x17')+_0x22dc8f[_0xc590('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':'Set','appdata':_0xc590('0xc'),'context':_0x22dc8f['context'],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':'Set','appdata':_0xc590('0xd'),'context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f['exten'],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':_0xc590('0x3'),'appdata':_0xc590('0xe'),'context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':_0xc590('0x3'),'appdata':_0xc590('0x18')+_0x22dc8f['id'],'context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']}];if(_0x22dc8f[_0xc590('0x19')]('recordingFormat')&&_0x22dc8f['recordingFormat']!==_0xc590('0x1a')){_0x275672[_0xc590('0xb')]({'type':_0xc590('0xf'),'app':_0xc590('0x3'),'appdata':_0xc590('0x1b'),'context':_0x22dc8f['context'],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']},{'type':_0xc590('0xf'),'app':_0xc590('0x3'),'appdata':_0xc590('0x1c')+_0x22dc8f[_0xc590('0x1d')]||_0xc590('0x1e'),'context':_0x22dc8f[_0xc590('0x5')],'exten':_0x22dc8f[_0xc590('0x6')],'priority':_0x4197c2++,'VoiceExtensionId':_0x22dc8f['id']});}return _0x275672;}function _0xa93f19(_0x4db539,_0x157818){var _0x48d4af=[{'name':_0xc590('0x1f'),'param':0x0},{'name':_0xc590('0x20'),'param':0x1},{'name':_0xc590('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x16940f={};var _0x14e688=_0x157818[_0xc590('0x22')](',');var _0x1fb8ec=[];for(var _0x39e990=0x0;_0x39e990<_0x48d4af[_0xc590('0x23')];_0x39e990++){switch(_0x48d4af[_0x39e990][_0xc590('0x24')]){case _0xc590('0x1f'):_0x16940f['trunk']=_0x14e688[_0x48d4af[_0x39e990][_0xc590('0x25')]]['split']('/')[0x1];_0x16940f['phone']=_0x14e688[_0x48d4af[_0x39e990][_0xc590('0x25')]]['split']('/')[0x2];_0x16940f[_0xc590('0x26')]=_0x16940f['phone']?_0x16940f[_0xc590('0x27')][_0xc590('0x22')]('$')[0x0]:undefined;_0x16940f[_0xc590('0x27')]=_0x4db539[_0xc590('0x12')]?(_0x16940f[_0xc590('0x26')]||'')+'${EXTEN:'+_0x4db539[_0xc590('0x12')]+'}':(_0x16940f[_0xc590('0x26')]||'')+_0xc590('0x13');_0x1fb8ec[_0x48d4af[_0x39e990][_0xc590('0x25')]]=['SIP',_0x16940f['trunk'],_0x16940f[_0xc590('0x27')]][_0xc590('0x28')]('/');break;case _0xc590('0x21'):_0x16940f[_0xc590('0x21')]=_0x14e688[_0x48d4af[_0x39e990][_0xc590('0x25')]];if(_0x4db539[_0xc590('0x1d')]!==_0xc590('0x1a')){if(_0x16940f[_0xc590('0x21')][_0xc590('0x29')](_0xc590('0x2a'))<0x0){_0x16940f[_0xc590('0x21')]+=_0xc590('0x2a');}}else{_0x16940f['options']=_0x16940f[_0xc590('0x21')][_0xc590('0x2b')]('U(xcally-mixmonitor-context)','');}_0x1fb8ec[_0x48d4af[_0x39e990][_0xc590('0x25')]]=_0x16940f[_0xc590('0x21')];break;default:_0x1fb8ec[_0x48d4af[_0x39e990][_0xc590('0x25')]]=_0x14e688[_0x48d4af[_0x39e990][_0xc590('0x25')]];}}return _0x1fb8ec[_0xc590('0x28')](',');}function _0x52a057(_0xa8e78e,_0x56841d,_0x1756a5){return new Promise(function(_0x5a0866,_0x556abd){var _0xb7f55b=[];if(_['isEmpty'](_0x56841d))return _0x5a0866(_0xb7f55b);_0x33103b['Interval']['findAll']({'attributes':['id',_0xc590('0x2c'),_0xc590('0x2d')],'raw':!![]})[_0xc590('0x2e')](function(_0x25e176){for(var _0x2c47df=0x0,_0x5a52b1=0x0;_0x2c47df<_0x56841d[_0xc590('0x23')];_0x2c47df++,_0x5a52b1=0x0){var _0x20022b=_0x56841d[_0x2c47df];var _0x1e2e5b=[];var _0x5f52df=[];delete _0x20022b['id'];if(_0x20022b[_0xc590('0x2c')]!==_0xc590('0x2f')){_0x20022b['intervals']=[_0x20022b[_0xc590('0x2c')]];}else{_0x20022b[_0xc590('0x30')]=_0x20022b[_0xc590('0x2d')]?_[_0xc590('0x31')](_[_0xc590('0x32')](_0x25e176,{'IntervalId':_0x20022b[_0xc590('0x2d')]}),_0xc590('0x2c')):[];}_0x20022b[_0xc590('0x5')]=_0xa8e78e[_0xc590('0x5')];_0x20022b['exten']=_0xa8e78e[_0xc590('0x6')];if(_0x20022b[_0xc590('0x2')])_0x20022b['type']=_0x20022b[_0xc590('0x2')][_0xc590('0x33')]();if(_0xa8e78e['type']===_0xc590('0xf')){if(_0x20022b[_0xc590('0x19')]('tag')&&_0x20022b['tag']&&_0x20022b[_0xc590('0x34')]!=='--'){_0x1e2e5b[_0xc590('0xb')]({'type':_0x20022b[_0xc590('0x2')][_0xc590('0x33')](),'app':'Set','appdata':'CDR(tag)='+_0x20022b[_0xc590('0x34')],'context':_0xa8e78e[_0xc590('0x5')],'exten':_0xa8e78e[_0xc590('0x6')],'priority':_0x20022b['intervals'][_0xc590('0x23')]+_0x1756a5+_0x5a52b1++,'VoiceExtensionId':_0xa8e78e['id']});}_0x1e2e5b[_0xc590('0xb')]({'type':_0x20022b[_0xc590('0x2')][_0xc590('0x33')](),'app':_0xc590('0x14'),'appdata':_0xc590('0x35')+(_0x20022b[_0xc590('0x36')]?_0xc590('0x37')+_0x20022b['callerID']+')':_0xc590('0x38')),'context':_0xa8e78e[_0xc590('0x5')],'exten':_0xa8e78e[_0xc590('0x6')],'priority':_0x20022b[_0xc590('0x30')][_0xc590('0x23')]+_0x1756a5+_0x5a52b1++,'VoiceExtensionId':_0xa8e78e['id']});}else{if(_0x20022b['hasOwnProperty']('answer')){if([_0xc590('0x39'),_0xc590('0x3a')][_0xc590('0x3b')](_0x20022b[_0xc590('0x3c')][_0xc590('0x33')]())&&_0x20022b['appType']!==_0xc590('0x3d')){if(_0x20022b['answer']){_0x1e2e5b['push']({'type':_0x20022b[_0xc590('0x2')][_0xc590('0x33')](),'app':_0xc590('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xa8e78e['context'],'exten':_0xa8e78e[_0xc590('0x6')],'priority':_0x20022b[_0xc590('0x30')][_0xc590('0x23')]+_0x1756a5+_0x5a52b1++,'VoiceExtensionId':_0xa8e78e['id']});_0x1e2e5b[_0xc590('0xb')]({'type':_0x20022b['type'][_0xc590('0x33')](),'app':_0xc590('0x3'),'appdata':_0xc590('0x3e'),'context':_0xa8e78e['context'],'exten':_0xa8e78e['exten'],'priority':_0x20022b['intervals'][_0xc590('0x23')]+_0x1756a5+_0x5a52b1++,'VoiceExtensionId':_0xa8e78e['id']});}else{_0x1e2e5b['push']({'type':_0x20022b[_0xc590('0x2')][_0xc590('0x33')](),'app':'ExecIf','appdata':_0xc590('0x3f'),'context':_0xa8e78e[_0xc590('0x5')],'exten':_0xa8e78e[_0xc590('0x6')],'priority':_0x20022b[_0xc590('0x30')][_0xc590('0x23')]+_0x1756a5+_0x5a52b1++,'VoiceExtensionId':_0xa8e78e['id']});_0x1e2e5b['push']({'type':_0x20022b['type']['toLowerCase'](),'app':_0xc590('0x3'),'appdata':_0xc590('0x40'),'context':_0xa8e78e[_0xc590('0x5')],'exten':_0xa8e78e[_0xc590('0x6')],'priority':_0x20022b[_0xc590('0x30')][_0xc590('0x23')]+_0x1756a5+_0x5a52b1++,'VoiceExtensionId':_0xa8e78e['id']});}}}}for(var _0x3dc919=0x0;_0x3dc919<_0x20022b[_0xc590('0x30')][_0xc590('0x23')];_0x3dc919++){var _0x57fd19=_0x1756a5+_0x20022b[_0xc590('0x30')]['length'];var _0x4c7fec=_0x3dc919===_0x20022b[_0xc590('0x30')][_0xc590('0x23')]-0x1?_0x1756a5+_0x1e2e5b[_0xc590('0x23')]+_0x5f52df['length']+0x2:_0x1756a5+_0x3dc919+0x1;_0x1e2e5b[_0xc590('0x41')](_0x3dc919,0x0,{'type':_0xa8e78e['type'],'app':_0xc590('0x42'),'appdata':_0x20022b[_0xc590('0x30')][_0x3dc919]+'?'+_0xa8e78e['context']+',${EXTEN},'+_0x57fd19+':'+_0xa8e78e[_0xc590('0x5')]+_0xc590('0x43')+_0x4c7fec,'exten':_0xa8e78e[_0xc590('0x6')],'context':_0xa8e78e[_0xc590('0x5')],'priority':_0x1756a5+_0x3dc919,'VoiceExtensionId':_0xa8e78e['id']});}if(_0x20022b[_0xc590('0x44')]===_0xc590('0x45'))_0x20022b[_0xc590('0x46')]=_0xa93f19(_0xa8e78e,_0x20022b[_0xc590('0x46')]);_0x20022b[_0xc590('0x47')]=_0x1e2e5b[_0xc590('0x23')]?_[_0xc590('0x48')](_0x1e2e5b)['priority']+0x1:_0x1756a5;_0xb7f55b=_[_0xc590('0x49')](_0xb7f55b,_0x1e2e5b,[_0x20022b],_0x5f52df);_0x1756a5=_['last'](_0xb7f55b)[_0xc590('0x47')]+0x1;}return _0x5a0866(_0xb7f55b);})[_0xc590('0x4a')](function(_0xa69de5){_0x556abd(_0xa69de5);});});}return _0x3ce18b[_0xc590('0x4b')](_0xc590('0x4c'),attributes,{'tableName':_0xc590('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2a17d1){var _0x49657c=this['get']({'plain':!![]});var _0x22bcb3=_0x49657c[_0xc590('0x2')]==='outbound'?_0xf38785(_0x49657c):_0x2544d5(_0x49657c);return _0x52a057(_0x49657c,_0x2a17d1,_['last'](_0x22bcb3)['priority']+0x1)[_0xc590('0x2e')](function(_0x2dbc43){var _0x4ce681=_['concat'](_0x22bcb3,_0x2dbc43);_0x4ce681[_0xc590('0xb')]({'type':_0x49657c['type'],'app':'Hangup','exten':_0x49657c['exten'],'context':_0x49657c[_0xc590('0x5')],'priority':_['last'](_0x4ce681)[_0xc590('0x47')]+0x1,'VoiceExtensionId':_0x49657c['id']});return _0x4ce681;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9d85bfd..d133688 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 _0x56a4=['model','stringify','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','raw','options','limit','include','map','attributes'];(function(_0x2af11a,_0x443532){var _0x40d52e=function(_0xcfe7b2){while(--_0xcfe7b2){_0x2af11a['push'](_0x2af11a['shift']());}};_0x40d52e(++_0x443532);}(_0x56a4,0x11b));var _0x456a=function(_0x2f454b,_0x4f0132){_0x2f454b=_0x2f454b-0x0;var _0x3077ab=_0x56a4[_0x2f454b];return _0x3077ab;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x456a('0xa')],{'host':_0x456a('0xb'),'port':0x18eb});var socket=require(_0x456a('0xc'))(new Redis(config['redis']));require(_0x456a('0xd'))['register'](socket);function respondWithRpcPromise(_0xb56df,_0x29073f,_0x3bb712){return new BPromise(function(_0x3b57ac,_0x2706a7){return client[_0x456a('0xe')](_0xb56df,_0x3bb712)[_0x456a('0xf')](function(_0xe60506){logger[_0x456a('0x10')](_0x456a('0x11'),_0x29073f,_0x456a('0x12'));logger['debug'](_0x456a('0x13'),_0x29073f,'request\x20sent',JSON['stringify'](_0xe60506));if(_0xe60506[_0x456a('0x14')]){if(_0xe60506[_0x456a('0x14')][_0x456a('0x15')]===0x1f4){logger[_0x456a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);return _0x2706a7(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}logger[_0x456a('0x14')](_0x456a('0x11'),_0x29073f,_0xe60506['error'][_0x456a('0x16')]);return _0x3b57ac(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}else{logger[_0x456a('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0x456a('0x12'));_0x3b57ac(_0xe60506[_0x456a('0x17')][_0x456a('0x16')]);}})['catch'](function(_0x3d06b4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0x3d06b4);_0x2706a7(_0x3d06b4);});});}exports[_0x456a('0x18')]=function(_0x562cfa){var _0x44d79a=this;return new Promise(function(_0x4b48bf,_0x962b6d){return db[_0x456a('0x19')]['findAll']({'raw':_0x562cfa['options']?_0x562cfa['options'][_0x456a('0x1a')]===undefined?!![]:![]:!![],'where':_0x562cfa[_0x456a('0x1b')]?_0x562cfa[_0x456a('0x1b')]['where']||null:null,'attributes':_0x562cfa[_0x456a('0x1b')]?_0x562cfa['options']['attributes']||null:null,'limit':_0x562cfa['options']?_0x562cfa[_0x456a('0x1b')][_0x456a('0x1c')]||null:null,'include':_0x562cfa[_0x456a('0x1b')]?_0x562cfa['options'][_0x456a('0x1d')]?_[_0x456a('0x1e')](_0x562cfa['options'][_0x456a('0x1d')],function(_0x561097){return{'model':db[_0x561097['model']],'as':_0x561097['as'],'attributes':_0x561097[_0x456a('0x1f')],'include':_0x561097['include']?_[_0x456a('0x1e')](_0x561097['include'],function(_0x1ee212){return{'model':db[_0x1ee212[_0x456a('0x20')]],'as':_0x1ee212['as'],'attributes':_0x1ee212[_0x456a('0x1f')],'include':_0x1ee212[_0x456a('0x1d')]?_[_0x456a('0x1e')](_0x1ee212[_0x456a('0x1d')],function(_0x46f3b3){return{'model':db[_0x46f3b3[_0x456a('0x20')]],'as':_0x46f3b3['as'],'attributes':_0x46f3b3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48205d){logger[_0x456a('0x10')](_0x456a('0x18'),_0x562cfa);logger['debug'](_0x456a('0x18'),_0x562cfa,JSON[_0x456a('0x21')](_0x48205d));_0x4b48bf(_0x48205d);})[_0x456a('0x22')](function(_0x336993){logger[_0x456a('0x14')]('GetVoiceExtension',_0x336993[_0x456a('0x16')],_0x562cfa);_0x962b6d(_0x44d79a[_0x456a('0x14')](0x1f4,_0x336993[_0x456a('0x16')]));});});}; \ No newline at end of file +var _0xb5bb=['GetVoiceExtension','VoiceExtension','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','randomstring','ioredis','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3303c0,_0x1eaa43){var _0x454848=function(_0x6200b2){while(--_0x6200b2){_0x3303c0['push'](_0x3303c0['shift']());}};_0x454848(++_0x1eaa43);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x513d3a,_0x418f38){_0x513d3a=_0x513d3a-0x0;var _0x38246b=_0xb5bb[_0x513d3a];return _0x38246b;};'use strict';var _=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var moment=require(_0xbb5b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb5b('0x3'));var fs=require('fs');var Redis=require(_0xbb5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbb5b('0x5')][_0xbb5b('0x6')]({'port':0x232a});config['redis']=_[_0xbb5b('0x7')](config[_0xbb5b('0x8')],{'host':_0xbb5b('0x9'),'port':0x18eb});var socket=require(_0xbb5b('0xa'))(new Redis(config[_0xbb5b('0x8')]));require(_0xbb5b('0xb'))[_0xbb5b('0xc')](socket);function respondWithRpcPromise(_0x2d9bf7,_0x3e497a,_0x218eca){return new BPromise(function(_0x216fc7,_0x3029a2){return client[_0xbb5b('0xd')](_0x2d9bf7,_0x218eca)[_0xbb5b('0xe')](function(_0x10411c){logger[_0xbb5b('0xf')](_0xbb5b('0x10'),_0x3e497a,_0xbb5b('0x11'));logger[_0xbb5b('0x12')](_0xbb5b('0x13'),_0x3e497a,'request\x20sent',JSON[_0xbb5b('0x14')](_0x10411c));if(_0x10411c['error']){if(_0x10411c[_0xbb5b('0x15')][_0xbb5b('0x16')]===0x1f4){logger[_0xbb5b('0x15')](_0xbb5b('0x10'),_0x3e497a,_0x10411c['error'][_0xbb5b('0x17')]);return _0x3029a2(_0x10411c[_0xbb5b('0x15')][_0xbb5b('0x17')]);}logger[_0xbb5b('0x15')](_0xbb5b('0x10'),_0x3e497a,_0x10411c['error'][_0xbb5b('0x17')]);return _0x216fc7(_0x10411c[_0xbb5b('0x15')][_0xbb5b('0x17')]);}else{logger['info'](_0xbb5b('0x10'),_0x3e497a,_0xbb5b('0x11'));_0x216fc7(_0x10411c[_0xbb5b('0x18')][_0xbb5b('0x17')]);}})[_0xbb5b('0x19')](function(_0x31bb85){logger['error'](_0xbb5b('0x10'),_0x3e497a,_0x31bb85);_0x3029a2(_0x31bb85);});});}exports[_0xbb5b('0x1a')]=function(_0xfb50c0){var _0x4be277=this;return new Promise(function(_0x5920d8,_0x3e6e95){return db[_0xbb5b('0x1b')]['findAll']({'raw':_0xfb50c0[_0xbb5b('0x1c')]?_0xfb50c0[_0xbb5b('0x1c')][_0xbb5b('0x1d')]===undefined?!![]:![]:!![],'where':_0xfb50c0[_0xbb5b('0x1c')]?_0xfb50c0['options'][_0xbb5b('0x1e')]||null:null,'attributes':_0xfb50c0[_0xbb5b('0x1c')]?_0xfb50c0[_0xbb5b('0x1c')][_0xbb5b('0x1f')]||null:null,'limit':_0xfb50c0['options']?_0xfb50c0['options'][_0xbb5b('0x20')]||null:null,'include':_0xfb50c0[_0xbb5b('0x1c')]?_0xfb50c0['options'][_0xbb5b('0x21')]?_['map'](_0xfb50c0[_0xbb5b('0x1c')][_0xbb5b('0x21')],function(_0x46a501){return{'model':db[_0x46a501[_0xbb5b('0x22')]],'as':_0x46a501['as'],'attributes':_0x46a501['attributes'],'include':_0x46a501['include']?_['map'](_0x46a501[_0xbb5b('0x21')],function(_0x1817ba){return{'model':db[_0x1817ba[_0xbb5b('0x22')]],'as':_0x1817ba['as'],'attributes':_0x1817ba['attributes'],'include':_0x1817ba['include']?_[_0xbb5b('0x23')](_0x1817ba['include'],function(_0x364f46){return{'model':db[_0x364f46['model']],'as':_0x364f46['as'],'attributes':_0x364f46[_0xbb5b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e58c8){logger[_0xbb5b('0xf')](_0xbb5b('0x1a'),_0xfb50c0);logger['debug'](_0xbb5b('0x1a'),_0xfb50c0,JSON[_0xbb5b('0x14')](_0x5e58c8));_0x5920d8(_0x5e58c8);})[_0xbb5b('0x19')](function(_0x2d8379){logger['error']('GetVoiceExtension',_0x2d8379[_0xbb5b('0x17')],_0xfb50c0);_0x3e6e95(_0x4be277[_0xbb5b('0x15')](0x1f4,_0x2d8379['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9c15e93..a577ef4 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 _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0x2590df,_0x42e765){var _0x2be2c7=function(_0x4c9f0c){while(--_0x4c9f0c){_0x2590df['push'](_0x2590df['shift']());}};_0x2be2c7(++_0x42e765);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xe111d,_0x530bb4){_0xe111d=_0xe111d-0x0;var _0x4f8927=_0x7fbe[_0xe111d];return _0x4f8927;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x3b8607,_0x5a180e){var _0x4fd2e1=function(_0x44a7a2){while(--_0x44a7a2){_0x3b8607['push'](_0x3b8607['shift']());}};_0x4fd2e1(++_0x5a180e);}(_0x5fab,0x177));var _0xb5fa=function(_0x18efb0,_0x402155){_0x18efb0=_0x18efb0-0x0;var _0x463641=_0x5fab[_0x18efb0];return _0x463641;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5583553..b2d3883 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 _0x7278=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x9af75d,_0x2a9a9b){var _0x4c7a79=function(_0x17d10d){while(--_0x17d10d){_0x9af75d['push'](_0x9af75d['shift']());}};_0x4c7a79(++_0x2a9a9b);}(_0x7278,0x161));var _0x8727=function(_0x5c16a5,_0x286b0d){_0x5c16a5=_0x5c16a5-0x0;var _0x43d249=_0x7278[_0x5c16a5];return _0x43d249;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x8727('0xe')]('/',auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0x10')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router[_0x8727('0x12')]('/:id',auth[_0x8727('0xb')](),controller[_0x8727('0x13')]);module[_0x8727('0x14')]=router; \ No newline at end of file +var _0x7278=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x26f597,_0x3c2c5e){var _0x4171b1=function(_0x32f2b1){while(--_0x32f2b1){_0x26f597['push'](_0x26f597['shift']());}};_0x4171b1(++_0x3c2c5e);}(_0x7278,0x161));var _0x8727=function(_0x460c13,_0x537600){_0x460c13=_0x460c13-0x0;var _0x1c0e0c=_0x7278[_0x460c13];return _0x1c0e0c;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x8727('0xe')]('/',auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0x10')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router[_0x8727('0x12')]('/:id',auth[_0x8727('0xb')](),controller[_0x8727('0x13')]);module[_0x8727('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 38a1444..1d725df 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 _0x514a=['setDataValue','email','string','trim','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','exports','STRING','contest_mailbox'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x514a,0x147));var _0xa514=function(_0x525ce2,_0x236269){_0x525ce2=_0x525ce2-0x0;var _0x8b873e=_0x514a[_0x525ce2];return _0x8b873e;};'use strict';var Sequelize=require('sequelize');module[_0xa514('0x0')]={'customer_id':{'type':Sequelize[_0xa514('0x1')]},'context':{'type':Sequelize[_0xa514('0x1')],'defaultValue':'from-voicemail','unique':_0xa514('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xa514('0x2')},'password':{'type':Sequelize[_0xa514('0x1')]},'fullname':{'type':Sequelize[_0xa514('0x1')]},'email':{'type':Sequelize[_0xa514('0x1')],'validate':{'isEmail':!![]},'set':function(_0x36bd3a){this[_0xa514('0x3')](_0xa514('0x4'),typeof _0x36bd3a===_0xa514('0x5')&&_0x36bd3a[_0xa514('0x6')]()?_0x36bd3a[_0xa514('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xa514('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa514('0x8')]('yes','no'),'defaultValue':_0xa514('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa514('0x1')]},'callback':{'type':Sequelize[_0xa514('0x1')]},'review':{'type':Sequelize['ENUM'](_0xa514('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa514('0x8')](_0xa514('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa514('0x8')](_0xa514('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xa514('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa514('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa514('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa514('0x8')](_0xa514('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa514('0x8')](_0xa514('0x7'),'no'),'defaultValue':_0xa514('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa514('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa514('0x8')](_0xa514('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa514('0x8')](_0xa514('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xa514('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa514('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa514('0xb')],'get':function(){return this[_0xa514('0xc')](_0xa514('0xd'))+'\x20-\x20'+this[_0xa514('0xc')](_0xa514('0xe'));}}}; \ No newline at end of file +var _0xf672=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL'];(function(_0x8c0959,_0x41136b){var _0x38b9d3=function(_0x281938){while(--_0x281938){_0x8c0959['push'](_0x8c0959['shift']());}};_0x38b9d3(++_0x41136b);}(_0xf672,0x84));var _0x2f67=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf672[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x2f67('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x2f67('0x1')]},'context':{'type':Sequelize[_0x2f67('0x1')],'defaultValue':_0x2f67('0x2'),'unique':_0x2f67('0x3')},'mailbox':{'type':Sequelize[_0x2f67('0x1')],'defaultValue':'','allowNull':![],'unique':_0x2f67('0x3')},'password':{'type':Sequelize[_0x2f67('0x1')]},'fullname':{'type':Sequelize[_0x2f67('0x1')]},'email':{'type':Sequelize[_0x2f67('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5666ad){this['setDataValue'](_0x2f67('0x4'),typeof _0x5666ad==='string'&&_0x5666ad['trim']()?_0x5666ad[_0x2f67('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x2f67('0x6')},'attach':{'type':Sequelize[_0x2f67('0x7')]('yes','no'),'defaultValue':_0x2f67('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2f67('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x2f67('0x1')]},'callback':{'type':Sequelize[_0x2f67('0x1')]},'review':{'type':Sequelize[_0x2f67('0x7')](_0x2f67('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2f67('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2f67('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2f67('0x7')](_0x2f67('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2f67('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2f67('0x7')](_0x2f67('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2f67('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x2f67('0x8'),'no'),'defaultValue':_0x2f67('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2f67('0x7')](_0x2f67('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2f67('0x7')](_0x2f67('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2f67('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x2f67('0x1')]},'emailbody':{'type':Sequelize[_0x2f67('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2f67('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2f67('0xb')],'get':function(){return this[_0x2f67('0xc')](_0x2f67('0xd'))+_0x2f67('0xe')+this['getDataValue'](_0x2f67('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 91b1616..c134711 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 _0xae60=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4fa08c,_0x30cac4){var _0x7a920a=function(_0x213fd1){while(--_0x213fd1){_0x4fa08c['push'](_0x4fa08c['shift']());}};_0x7a920a(++_0x30cac4);}(_0xae60,0x1c7));var _0x0ae6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xae60[_0x26462c];return _0x509a42;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){var _0x3c43d8=_0x4e1242[_0x0ae6('0x2b')]({'plain':!![]});var _0x5b86fe=_0x0ae6('0x2c');return db[_0x0ae6('0x2d')]['destroy']({'where':{'type':_0x5b86fe,'resourceId':_0x3c43d8['id']}})['then'](function(){return _0x4e1242;});})[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x4fe77b,_0x3b5f8f){return function(_0xb68cbe){if(!_0xb68cbe){_0x4fe77b[_0x0ae6('0x1c')](0x194);}return _0xb68cbe;};}function handleError(_0x4df796,_0x2428b2){_0x2428b2=_0x2428b2||0x1f4;return function(_0x29fef3){logger[_0x0ae6('0x2e')](_0x29fef3[_0x0ae6('0x2f')]);if(_0x29fef3[_0x0ae6('0x30')]){delete _0x29fef3[_0x0ae6('0x30')];}_0x4df796['status'](_0x2428b2)['send'](_0x29fef3);};}exports[_0x0ae6('0x31')]=function(_0x419384,_0x4e6df8){var _0x4a06f1={},_0x1ca059={},_0x278577={'count':0x0,'rows':[]};var _0x714c6d=_[_0x0ae6('0x32')](db['VoiceMail'][_0x0ae6('0x33')],function(_0x429f06){return{'name':_0x429f06[_0x0ae6('0x34')],'type':_0x429f06['type'][_0x0ae6('0x35')]};});_0x1ca059[_0x0ae6('0x36')]=_[_0x0ae6('0x32')](_0x714c6d,_0x0ae6('0x30'));_0x1ca059[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x419384[_0x0ae6('0x37')]);_0x1ca059[_0x0ae6('0x39')]=_[_0x0ae6('0x3a')](_0x1ca059[_0x0ae6('0x36')],_0x1ca059['query']);_0x4a06f1[_0x0ae6('0x3b')]=_[_0x0ae6('0x3a')](_0x1ca059['model'],qs[_0x0ae6('0x3c')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x4a06f1['attributes']=_0x4a06f1[_0x0ae6('0x3b')]['length']?_0x4a06f1['attributes']:_0x1ca059[_0x0ae6('0x36')];if(!_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3d')](_0x0ae6('0x3e'))){_0x4a06f1[_0x0ae6('0x22')]=qs['limit'](_0x419384['query'][_0x0ae6('0x22')]);_0x4a06f1['offset']=qs[_0x0ae6('0x20')](_0x419384['query'][_0x0ae6('0x20')]);}_0x4a06f1['order']=qs[_0x0ae6('0x3f')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3f')]);_0x4a06f1[_0x0ae6('0x40')]=qs['filters'](_['pick'](_0x419384[_0x0ae6('0x37')],_0x1ca059[_0x0ae6('0x39')]),_0x714c6d);if(_0x419384[_0x0ae6('0x37')]['filter']){_0x4a06f1[_0x0ae6('0x40')]=_['merge'](_0x4a06f1[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x714c6d,function(_0x460e3f){if(_0x460e3f[_0x0ae6('0x41')]!==_0x0ae6('0x42')){var _0x1f8258={};_0x1f8258[_0x460e3f['name']]={'$like':'%'+_0x419384[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x1f8258;}})});}_0x4a06f1=_[_0x0ae6('0x44')]({},_0x4a06f1,_0x419384[_0x0ae6('0x45')]);var _0x1ad562={'where':_0x4a06f1[_0x0ae6('0x40')]};return db[_0x0ae6('0x46')][_0x0ae6('0x23')](_0x1ad562)['then'](function(_0x38faeb){_0x278577[_0x0ae6('0x23')]=_0x38faeb;if(_0x419384[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x4a06f1[_0x0ae6('0x48')]=[{'all':!![]}];}return db[_0x0ae6('0x46')][_0x0ae6('0x49')](_0x4a06f1);})[_0x0ae6('0x29')](function(_0xb38cbb){_0x278577[_0x0ae6('0x4a')]=_0xb38cbb;return _0x278577;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x4e6df8,_0x4a06f1))[_0x0ae6('0x4b')](handleError(_0x4e6df8,null));};exports[_0x0ae6('0x4c')]=function(_0x85d9ce,_0x201e95){var _0x16d225={'raw':!![],'where':{'id':_0x85d9ce[_0x0ae6('0x4d')]['id']}},_0x4235de={};_0x4235de['model']=_[_0x0ae6('0x38')](db[_0x0ae6('0x46')][_0x0ae6('0x33')]);_0x4235de[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x85d9ce[_0x0ae6('0x37')]);_0x4235de['filters']=_[_0x0ae6('0x3a')](_0x4235de[_0x0ae6('0x36')],_0x4235de[_0x0ae6('0x37')]);_0x16d225[_0x0ae6('0x3b')]=_['intersection'](_0x4235de['model'],qs['fields'](_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x16d225[_0x0ae6('0x3b')]=_0x16d225['attributes'][_0x0ae6('0x4e')]?_0x16d225[_0x0ae6('0x3b')]:_0x4235de['model'];if(_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x16d225['include']=[{'all':!![]}];}_0x16d225=_[_0x0ae6('0x44')]({},_0x16d225,_0x85d9ce[_0x0ae6('0x45')]);return db['VoiceMail'][_0x0ae6('0x4f')](_0x16d225)[_0x0ae6('0x29')](handleEntityNotFound(_0x201e95,null))[_0x0ae6('0x29')](respondWithResult(_0x201e95,null))['catch'](handleError(_0x201e95,null));};exports[_0x0ae6('0x50')]=function(_0x21de54,_0x46075a){return db[_0x0ae6('0x46')][_0x0ae6('0x50')](_0x21de54[_0x0ae6('0x51')],{})[_0x0ae6('0x29')](function(_0x5ababa){var _0x5afd3b=_0x21de54[_0x0ae6('0x52')][_0x0ae6('0x2b')]({'plain':!![]});if(!_0x5afd3b)throw new Error(_0x0ae6('0x53'));if(_0x5afd3b['role']===_0x0ae6('0x52')){var _0x51df5c=_0x5ababa['get']({'plain':!![]});var _0x23454a=_0x0ae6('0x2c');return db[_0x0ae6('0x54')]['find']({'where':{'name':_0x23454a,'userProfileId':_0x5afd3b[_0x0ae6('0x55')]},'raw':!![]})[_0x0ae6('0x29')](function(_0x31a4db){if(_0x31a4db&&_0x31a4db[_0x0ae6('0x56')]===0x0){return db[_0x0ae6('0x2d')][_0x0ae6('0x50')]({'name':_0x51df5c[_0x0ae6('0x30')],'resourceId':_0x51df5c['id'],'type':_0x31a4db[_0x0ae6('0x30')],'sectionId':_0x31a4db['id']},{})[_0x0ae6('0x29')](function(){return _0x5ababa;});}else{return _0x5ababa;}})[_0x0ae6('0x4b')](function(_0x1cc515){logger[_0x0ae6('0x2e')](_0x0ae6('0x57'),_0x1cc515);throw _0x1cc515;});}return _0x5ababa;})[_0x0ae6('0x29')](respondWithResult(_0x46075a,0xc9))[_0x0ae6('0x4b')](handleError(_0x46075a,null));};exports['update']=function(_0x4cbe19,_0x30a9f1){if(_0x4cbe19[_0x0ae6('0x51')]['id']){delete _0x4cbe19[_0x0ae6('0x51')]['id'];}return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x4cbe19[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x30a9f1,null))[_0x0ae6('0x29')](saveUpdates(_0x4cbe19[_0x0ae6('0x51')],null))[_0x0ae6('0x29')](respondWithResult(_0x30a9f1,null))[_0x0ae6('0x4b')](handleError(_0x30a9f1,null));};exports[_0x0ae6('0x2a')]=function(_0x16a311,_0x2babcc){return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x16a311[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2babcc,null))['then'](removeEntity(_0x2babcc,null))[_0x0ae6('0x4b')](handleError(_0x2babcc,null));};exports[_0x0ae6('0x58')]=function(_0x15191e,_0x578125,_0x2648de){return db[_0x0ae6('0x46')][_0x0ae6('0x59')]({'where':{'id':_0x15191e[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x578125,null))[_0x0ae6('0x29')](function(_0x5ec716){var _0x456d2a;var _0x2132d6={},_0x1c53bf={};_0x1c53bf[_0x0ae6('0x36')]=_[_0x0ae6('0x38')](db[_0x0ae6('0x5a')][_0x0ae6('0x33')]);_0x1c53bf[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x15191e['query']);_0x1c53bf['filters']=_[_0x0ae6('0x3a')](_0x1c53bf[_0x0ae6('0x36')],_0x1c53bf['query']);_0x2132d6['attributes']=_[_0x0ae6('0x3a')](_0x1c53bf[_0x0ae6('0x36')],qs[_0x0ae6('0x3c')](_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x2132d6[_0x0ae6('0x3b')]=_0x2132d6[_0x0ae6('0x3b')]['length']?_0x2132d6[_0x0ae6('0x3b')]:_0x1c53bf['model'];if(!_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x3d')]('nolimit')){_0x2132d6[_0x0ae6('0x22')]=qs[_0x0ae6('0x22')](_0x15191e[_0x0ae6('0x37')]['limit']);_0x2132d6[_0x0ae6('0x20')]=qs['offset'](_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x20')]);}_0x2132d6[_0x0ae6('0x5b')]=qs[_0x0ae6('0x3f')](_0x15191e['query']['sort']);_0x2132d6[_0x0ae6('0x40')]=qs[_0x0ae6('0x39')](_[_0x0ae6('0x5c')](_0x15191e[_0x0ae6('0x37')],_0x1c53bf[_0x0ae6('0x39')]));if(_0x15191e[_0x0ae6('0x37')]['filter']){_0x2132d6['where']=_[_0x0ae6('0x44')](_0x2132d6[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x2132d6[_0x0ae6('0x3b')],function(_0x2bafcc){var _0x15f38f={};_0x15f38f[_0x2bafcc]={'$like':'%'+_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x15f38f;})});}_0x2132d6['where']=_[_0x0ae6('0x44')](_0x2132d6[_0x0ae6('0x40')],{'mailboxuser':_0x5ec716[_0x0ae6('0x5d')]});_0x2132d6=_[_0x0ae6('0x44')]({},_0x2132d6,_0x15191e[_0x0ae6('0x45')]);return db[_0x0ae6('0x5a')]['findAndCountAll'](_0x2132d6)['then'](respondWithFilteredResult(_0x578125,_0x2132d6));})[_0x0ae6('0x4b')](handleError(_0x578125,null));}; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','VoiceMail','findAll','catch','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','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'];(function(_0x1e0917,_0x42c06e){var _0x5a2e7a=function(_0x53b4d3){while(--_0x53b4d3){_0x1e0917['push'](_0x1e0917['shift']());}};_0x5a2e7a(++_0x42c06e);}(_0xe706,0xa3));var _0x6e70=function(_0x58fac8,_0x5ec989){_0x58fac8=_0x58fac8-0x0;var _0x4a560e=_0xe706[_0x58fac8];return _0x4a560e;};'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(){var _0x41e352=_0x538b9c[_0x6e70('0x2a')]({'plain':!![]});var _0x51d292=_0x6e70('0x2b');return db[_0x6e70('0x2c')]['destroy']({'where':{'type':_0x51d292,'resourceId':_0x41e352['id']}})[_0x6e70('0x29')](function(){return _0x538b9c;});})[_0x6e70('0x29')](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a5fe,_0x2c4d37){return function(_0x3af17f){if(!_0x3af17f){_0x54a5fe[_0x6e70('0x1d')](0x194);}return _0x3af17f;};}function handleError(_0x114344,_0x43fee0){_0x43fee0=_0x43fee0||0x1f4;return function(_0x5d772a){logger[_0x6e70('0x2d')](_0x5d772a[_0x6e70('0x2e')]);if(_0x5d772a[_0x6e70('0x2f')]){delete _0x5d772a[_0x6e70('0x2f')];}_0x114344[_0x6e70('0x1e')](_0x43fee0)[_0x6e70('0x30')](_0x5d772a);};}exports[_0x6e70('0x31')]=function(_0x24114a,_0x3a0821){var _0x3a5d30={},_0x4b1229={},_0x1b27d8={'count':0x0,'rows':[]};var _0x50d60b=_[_0x6e70('0x32')](db['VoiceMail'][_0x6e70('0x33')],function(_0x2722e8){return{'name':_0x2722e8[_0x6e70('0x34')],'type':_0x2722e8['type'][_0x6e70('0x35')]};});_0x4b1229[_0x6e70('0x36')]=_['map'](_0x50d60b,_0x6e70('0x2f'));_0x4b1229[_0x6e70('0x37')]=_['keys'](_0x24114a[_0x6e70('0x37')]);_0x4b1229[_0x6e70('0x38')]=_[_0x6e70('0x39')](_0x4b1229[_0x6e70('0x36')],_0x4b1229[_0x6e70('0x37')]);_0x3a5d30[_0x6e70('0x3a')]=_[_0x6e70('0x39')](_0x4b1229[_0x6e70('0x36')],qs[_0x6e70('0x3b')](_0x24114a[_0x6e70('0x37')]['fields']));_0x3a5d30[_0x6e70('0x3a')]=_0x3a5d30['attributes'][_0x6e70('0x3c')]?_0x3a5d30[_0x6e70('0x3a')]:_0x4b1229[_0x6e70('0x36')];if(!_0x24114a[_0x6e70('0x37')][_0x6e70('0x3d')](_0x6e70('0x3e'))){_0x3a5d30[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x24114a[_0x6e70('0x37')][_0x6e70('0x20')]);_0x3a5d30[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x24114a[_0x6e70('0x37')]['offset']);}_0x3a5d30['order']=qs['sort'](_0x24114a[_0x6e70('0x37')][_0x6e70('0x3f')]);_0x3a5d30[_0x6e70('0x40')]=qs[_0x6e70('0x38')](_[_0x6e70('0x41')](_0x24114a[_0x6e70('0x37')],_0x4b1229['filters']),_0x50d60b);if(_0x24114a[_0x6e70('0x37')][_0x6e70('0x42')]){_0x3a5d30[_0x6e70('0x40')]=_[_0x6e70('0x43')](_0x3a5d30[_0x6e70('0x40')],{'$or':_[_0x6e70('0x32')](_0x50d60b,function(_0x246e61){if(_0x246e61[_0x6e70('0x44')]!=='VIRTUAL'){var _0x2c0bd1={};_0x2c0bd1[_0x246e61[_0x6e70('0x2f')]]={'$like':'%'+_0x24114a[_0x6e70('0x37')][_0x6e70('0x42')]+'%'};return _0x2c0bd1;}})});}_0x3a5d30=_[_0x6e70('0x43')]({},_0x3a5d30,_0x24114a[_0x6e70('0x45')]);var _0x21b0e7={'where':_0x3a5d30['where']};return db['VoiceMail']['count'](_0x21b0e7)[_0x6e70('0x29')](function(_0x2b63cc){_0x1b27d8[_0x6e70('0x21')]=_0x2b63cc;if(_0x24114a[_0x6e70('0x37')][_0x6e70('0x46')]){_0x3a5d30['include']=[{'all':!![]}];}return db[_0x6e70('0x47')][_0x6e70('0x48')](_0x3a5d30);})[_0x6e70('0x29')](function(_0x52b197){_0x1b27d8['rows']=_0x52b197;return _0x1b27d8;})['then'](respondWithFilteredResult(_0x3a0821,_0x3a5d30))[_0x6e70('0x49')](handleError(_0x3a0821,null));};exports['show']=function(_0x42f49a,_0x39913a){var _0x3fed21={'raw':!![],'where':{'id':_0x42f49a['params']['id']}},_0x75a90d={};_0x75a90d[_0x6e70('0x36')]=_['keys'](db[_0x6e70('0x47')][_0x6e70('0x33')]);_0x75a90d[_0x6e70('0x37')]=_[_0x6e70('0x4a')](_0x42f49a['query']);_0x75a90d[_0x6e70('0x38')]=_[_0x6e70('0x39')](_0x75a90d[_0x6e70('0x36')],_0x75a90d[_0x6e70('0x37')]);_0x3fed21[_0x6e70('0x3a')]=_[_0x6e70('0x39')](_0x75a90d[_0x6e70('0x36')],qs['fields'](_0x42f49a[_0x6e70('0x37')][_0x6e70('0x3b')]));_0x3fed21[_0x6e70('0x3a')]=_0x3fed21[_0x6e70('0x3a')][_0x6e70('0x3c')]?_0x3fed21[_0x6e70('0x3a')]:_0x75a90d[_0x6e70('0x36')];if(_0x42f49a['query'][_0x6e70('0x46')]){_0x3fed21['include']=[{'all':!![]}];}_0x3fed21=_[_0x6e70('0x43')]({},_0x3fed21,_0x42f49a[_0x6e70('0x45')]);return db['VoiceMail']['find'](_0x3fed21)[_0x6e70('0x29')](handleEntityNotFound(_0x39913a,null))[_0x6e70('0x29')](respondWithResult(_0x39913a,null))[_0x6e70('0x49')](handleError(_0x39913a,null));};exports['create']=function(_0x4af9b1,_0x238ebb){return db[_0x6e70('0x47')][_0x6e70('0x4b')](_0x4af9b1[_0x6e70('0x4c')],{})[_0x6e70('0x29')](function(_0x340674){var _0x4ad5a9=_0x4af9b1[_0x6e70('0x4d')][_0x6e70('0x2a')]({'plain':!![]});if(!_0x4ad5a9)throw new Error(_0x6e70('0x4e'));if(_0x4ad5a9[_0x6e70('0x4f')]===_0x6e70('0x4d')){var _0x4b354e=_0x340674['get']({'plain':!![]});var _0x2c5538=_0x6e70('0x2b');return db[_0x6e70('0x50')][_0x6e70('0x51')]({'where':{'name':_0x2c5538,'userProfileId':_0x4ad5a9[_0x6e70('0x52')]},'raw':!![]})['then'](function(_0x41bd0b){if(_0x41bd0b&&_0x41bd0b[_0x6e70('0x53')]===0x0){return db[_0x6e70('0x2c')][_0x6e70('0x4b')]({'name':_0x4b354e[_0x6e70('0x2f')],'resourceId':_0x4b354e['id'],'type':_0x41bd0b['name'],'sectionId':_0x41bd0b['id']},{})[_0x6e70('0x29')](function(){return _0x340674;});}else{return _0x340674;}})[_0x6e70('0x49')](function(_0x2c20d3){logger[_0x6e70('0x2d')](_0x6e70('0x54'),_0x2c20d3);throw _0x2c20d3;});}return _0x340674;})[_0x6e70('0x29')](respondWithResult(_0x238ebb,0xc9))['catch'](handleError(_0x238ebb,null));};exports[_0x6e70('0x28')]=function(_0x8d425d,_0x5c2396){if(_0x8d425d[_0x6e70('0x4c')]['id']){delete _0x8d425d[_0x6e70('0x4c')]['id'];}return db['VoiceMail'][_0x6e70('0x51')]({'where':{'id':_0x8d425d[_0x6e70('0x55')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x5c2396,null))[_0x6e70('0x29')](saveUpdates(_0x8d425d[_0x6e70('0x4c')],null))['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0x49')](handleError(_0x5c2396,null));};exports[_0x6e70('0x56')]=function(_0x10d655,_0x13be81){return db[_0x6e70('0x47')][_0x6e70('0x51')]({'where':{'id':_0x10d655[_0x6e70('0x55')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x13be81,null))[_0x6e70('0x29')](removeEntity(_0x13be81,null))[_0x6e70('0x49')](handleError(_0x13be81,null));};exports[_0x6e70('0x57')]=function(_0x1b12a1,_0xb8f78,_0x1fd9a6){return db[_0x6e70('0x47')][_0x6e70('0x58')]({'where':{'id':_0x1b12a1[_0x6e70('0x55')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0xb8f78,null))[_0x6e70('0x29')](function(_0x1c7dca){var _0x4c6aab;var _0x28898a={},_0x4434dd={};_0x4434dd[_0x6e70('0x36')]=_[_0x6e70('0x4a')](db[_0x6e70('0x59')][_0x6e70('0x33')]);_0x4434dd['query']=_[_0x6e70('0x4a')](_0x1b12a1[_0x6e70('0x37')]);_0x4434dd['filters']=_[_0x6e70('0x39')](_0x4434dd[_0x6e70('0x36')],_0x4434dd[_0x6e70('0x37')]);_0x28898a['attributes']=_['intersection'](_0x4434dd[_0x6e70('0x36')],qs[_0x6e70('0x3b')](_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x3b')]));_0x28898a[_0x6e70('0x3a')]=_0x28898a[_0x6e70('0x3a')][_0x6e70('0x3c')]?_0x28898a['attributes']:_0x4434dd['model'];if(!_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x3d')](_0x6e70('0x3e'))){_0x28898a[_0x6e70('0x20')]=qs['limit'](_0x1b12a1['query'][_0x6e70('0x20')]);_0x28898a[_0x6e70('0x22')]=qs['offset'](_0x1b12a1['query'][_0x6e70('0x22')]);}_0x28898a['order']=qs[_0x6e70('0x3f')](_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x3f')]);_0x28898a[_0x6e70('0x40')]=qs[_0x6e70('0x38')](_[_0x6e70('0x41')](_0x1b12a1[_0x6e70('0x37')],_0x4434dd[_0x6e70('0x38')]));if(_0x1b12a1['query'][_0x6e70('0x42')]){_0x28898a[_0x6e70('0x40')]=_[_0x6e70('0x43')](_0x28898a[_0x6e70('0x40')],{'$or':_[_0x6e70('0x32')](_0x28898a['attributes'],function(_0x5f5b02){var _0x5979bf={};_0x5979bf[_0x5f5b02]={'$like':'%'+_0x1b12a1[_0x6e70('0x37')][_0x6e70('0x42')]+'%'};return _0x5979bf;})});}_0x28898a[_0x6e70('0x40')]=_['merge'](_0x28898a['where'],{'mailboxuser':_0x1c7dca[_0x6e70('0x5a')]});_0x28898a=_[_0x6e70('0x43')]({},_0x28898a,_0x1b12a1[_0x6e70('0x45')]);return db[_0x6e70('0x59')][_0x6e70('0x5b')](_0x28898a)[_0x6e70('0x29')](respondWithFilteredResult(_0xb8f78,_0x28898a));})['catch'](handleError(_0xb8f78,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 84df305..412eee8 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 _0x53ba=['define','voice_voicemail','mailbox_context','mailbox','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x103bc2,_0x736a7f){var _0x2f85cb=function(_0x570139){while(--_0x570139){_0x103bc2['push'](_0x103bc2['shift']());}};_0x2f85cb(++_0x736a7f);}(_0x53ba,0x197));var _0xa53b=function(_0x279d0f,_0x59ee20){_0x279d0f=_0x279d0f-0x0;var _0x51e4dd=_0x53ba[_0x279d0f];return _0x51e4dd;};'use strict';var _=require('lodash');var util=require(_0xa53b('0x0'));var logger=require(_0xa53b('0x1'))(_0xa53b('0x2'));var moment=require(_0xa53b('0x3'));var BPromise=require(_0xa53b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa53b('0x5'));var rimraf=require(_0xa53b('0x6'));var config=require(_0xa53b('0x7'));var attributes=require('./voiceMail.attributes');module[_0xa53b('0x8')]=function(_0x2303c5,_0x3a6a31){return _0x2303c5[_0xa53b('0x9')]('VoiceMail',attributes,{'tableName':_0xa53b('0xa'),'paranoid':![],'indexes':[{'name':_0xa53b('0xb'),'fields':[_0xa53b('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6ed=['voice_voicemail','mailbox','context','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1e7654,_0x4051ac){var _0x5422f1=function(_0x581f05){while(--_0x581f05){_0x1e7654['push'](_0x1e7654['shift']());}};_0x5422f1(++_0x4051ac);}(_0xf6ed,0x1a3));var _0xdf6e=function(_0x369a64,_0x4fb5f4){_0x369a64=_0x369a64-0x0;var _0x45f279=_0xf6ed[_0x369a64];return _0x45f279;};'use strict';var _=require(_0xdf6e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdf6e('0x1'));var moment=require(_0xdf6e('0x2'));var BPromise=require(_0xdf6e('0x3'));var rp=require(_0xdf6e('0x4'));var fs=require('fs');var path=require(_0xdf6e('0x5'));var rimraf=require(_0xdf6e('0x6'));var config=require(_0xdf6e('0x7'));var attributes=require('./voiceMail.attributes');module[_0xdf6e('0x8')]=function(_0x2cc333,_0x5bd41d){return _0x2cc333[_0xdf6e('0x9')]('VoiceMail',attributes,{'tableName':_0xdf6e('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xdf6e('0xb'),_0xdf6e('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 9d7e423..e0e1f67 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 _0xf2d3=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','VoiceMail,\x20%s,\x20%s'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xf2d3,0x152));var _0x3f2d=function(_0x17d222,_0x35b7fa){_0x17d222=_0x17d222-0x0;var _0x3e604a=_0xf2d3[_0x17d222];return _0x3e604a;};'use strict';var _=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var moment=require('moment');var BPromise=require(_0x3f2d('0x2'));var rs=require(_0x3f2d('0x3'));var fs=require('fs');var Redis=require(_0x3f2d('0x4'));var db=require(_0x3f2d('0x5'))['db'];var utils=require(_0x3f2d('0x6'));var logger=require(_0x3f2d('0x7'))('rpc');var config=require(_0x3f2d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f2d('0x9')][_0x3f2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30980a,_0x473bc6,_0x47c966){return new BPromise(function(_0x382643,_0x4c457a){return client[_0x3f2d('0xb')](_0x30980a,_0x47c966)[_0x3f2d('0xc')](function(_0x154b5a){logger['info'](_0x3f2d('0xd'),_0x473bc6,_0x3f2d('0xe'));logger[_0x3f2d('0xf')](_0x3f2d('0x10'),_0x473bc6,_0x3f2d('0xe'),JSON['stringify'](_0x154b5a));if(_0x154b5a[_0x3f2d('0x11')]){if(_0x154b5a['error'][_0x3f2d('0x12')]===0x1f4){logger[_0x3f2d('0x11')](_0x3f2d('0xd'),_0x473bc6,_0x154b5a[_0x3f2d('0x11')][_0x3f2d('0x13')]);return _0x4c457a(_0x154b5a[_0x3f2d('0x11')][_0x3f2d('0x13')]);}logger[_0x3f2d('0x11')]('VoiceMail,\x20%s,\x20%s',_0x473bc6,_0x154b5a[_0x3f2d('0x11')][_0x3f2d('0x13')]);return _0x382643(_0x154b5a['error'][_0x3f2d('0x13')]);}else{logger[_0x3f2d('0x14')](_0x3f2d('0xd'),_0x473bc6,_0x3f2d('0xe'));_0x382643(_0x154b5a['result'][_0x3f2d('0x13')]);}})[_0x3f2d('0x15')](function(_0x327684){logger[_0x3f2d('0x11')]('VoiceMail,\x20%s,\x20%s',_0x473bc6,_0x327684);_0x4c457a(_0x327684);});});} \ No newline at end of file +var _0x3639=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','moment','bluebird'];(function(_0x49d114,_0x4fdf4b){var _0x3006c1=function(_0x39bb59){while(--_0x39bb59){_0x49d114['push'](_0x49d114['shift']());}};_0x3006c1(++_0x4fdf4b);}(_0x3639,0xc6));var _0x9363=function(_0x658b0c,_0x24d86d){_0x658b0c=_0x658b0c-0x0;var _0x26df87=_0x3639[_0x658b0c];return _0x26df87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9363('0x0'));var BPromise=require(_0x9363('0x1'));var rs=require(_0x9363('0x2'));var fs=require('fs');var Redis=require(_0x9363('0x3'));var db=require(_0x9363('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9363('0x5'))(_0x9363('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9363('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43db6d,_0x3d9ed7,_0x24c7c1){return new BPromise(function(_0x5687cc,_0x46b67f){return client[_0x9363('0x8')](_0x43db6d,_0x24c7c1)[_0x9363('0x9')](function(_0x313c4a){logger[_0x9363('0xa')]('VoiceMail,\x20%s,\x20%s',_0x3d9ed7,_0x9363('0xb'));logger['debug'](_0x9363('0xc'),_0x3d9ed7,_0x9363('0xb'),JSON[_0x9363('0xd')](_0x313c4a));if(_0x313c4a['error']){if(_0x313c4a[_0x9363('0xe')][_0x9363('0xf')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x3d9ed7,_0x313c4a[_0x9363('0xe')]['message']);return _0x46b67f(_0x313c4a[_0x9363('0xe')][_0x9363('0x10')]);}logger['error'](_0x9363('0x11'),_0x3d9ed7,_0x313c4a['error'][_0x9363('0x10')]);return _0x5687cc(_0x313c4a[_0x9363('0xe')]['message']);}else{logger[_0x9363('0xa')](_0x9363('0x11'),_0x3d9ed7,_0x9363('0xb'));_0x5687cc(_0x313c4a[_0x9363('0x12')][_0x9363('0x10')]);}})[_0x9363('0x13')](function(_0x1dfddd){logger[_0x9363('0xe')](_0x9363('0x11'),_0x3d9ed7,_0x1dfddd);_0x46b67f(_0x1dfddd);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a0281da..acb185a 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 _0x89c4=['show','/:id/download','download','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated'];(function(_0x137556,_0x253216){var _0x41dc31=function(_0x11cf86){while(--_0x11cf86){_0x137556['push'](_0x137556['shift']());}};_0x41dc31(++_0x253216);}(_0x89c4,0xc6));var _0x489c=function(_0x1a23e7,_0x3a2093){_0x1a23e7=_0x1a23e7-0x0;var _0x35db48=_0x89c4[_0x1a23e7];return _0x35db48;};'use strict';var multer=require('multer');var util=require(_0x489c('0x0'));var path=require(_0x489c('0x1'));var timeout=require(_0x489c('0x2'));var express=require(_0x489c('0x3'));var router=express[_0x489c('0x4')]();var fs_extra=require(_0x489c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x489c('0x6'));var config=require(_0x489c('0x7'));var controller=require(_0x489c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x489c('0x9')](_0x489c('0xa'),auth[_0x489c('0xb')](),controller[_0x489c('0xc')]);router[_0x489c('0x9')](_0x489c('0xd'),auth[_0x489c('0xb')](),controller[_0x489c('0xe')]);router['post']('/',auth[_0x489c('0xb')](),controller[_0x489c('0xf')]);router[_0x489c('0x10')](_0x489c('0xa'),auth[_0x489c('0xb')](),controller[_0x489c('0x11')]);router[_0x489c('0x12')](_0x489c('0xa'),auth[_0x489c('0xb')](),controller[_0x489c('0x13')]);module[_0x489c('0x14')]=router; \ No newline at end of file +var _0x8485=['./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x8485,0xc6));var _0x5848=function(_0x5cb7f6,_0x474762){_0x5cb7f6=_0x5cb7f6-0x0;var _0x4fc285=_0x8485[_0x5cb7f6];return _0x4fc285;};'use strict';var multer=require('multer');var util=require(_0x5848('0x0'));var path=require(_0x5848('0x1'));var timeout=require(_0x5848('0x2'));var express=require(_0x5848('0x3'));var router=express[_0x5848('0x4')]();var fs_extra=require(_0x5848('0x5'));var auth=require(_0x5848('0x6'));var interaction=require(_0x5848('0x7'));var config=require(_0x5848('0x8'));var controller=require(_0x5848('0x9'));router[_0x5848('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5848('0xa')](_0x5848('0xb'),auth['isAuthenticated'](),controller[_0x5848('0xc')]);router[_0x5848('0xa')](_0x5848('0xd'),auth[_0x5848('0xe')](),controller[_0x5848('0xf')]);router[_0x5848('0x10')]('/',auth['isAuthenticated'](),controller[_0x5848('0x11')]);router[_0x5848('0x12')](_0x5848('0xb'),auth[_0x5848('0xe')](),controller[_0x5848('0x13')]);router[_0x5848('0x14')]('/:id',auth[_0x5848('0xe')](),controller[_0x5848('0x15')]);module[_0x5848('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 55106b2..e93553d 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 _0x42e8=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER'];(function(_0x5b0347,_0x1e880e){var _0x3896d8=function(_0x22c454){while(--_0x22c454){_0x5b0347['push'](_0x5b0347['shift']());}};_0x3896d8(++_0x1e880e);}(_0x42e8,0x14a));var _0x842e=function(_0x39d225,_0x46f8b7){_0x39d225=_0x39d225-0x0;var _0x281a4b=_0x42e8[_0x39d225];return _0x281a4b;};'use strict';var Sequelize=require(_0x842e('0x0'));module['exports']={'name':{'type':Sequelize[_0x842e('0x1')],'get':function(_0x3d473e){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x842e('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x842e('0x4')](_0x842e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x842e('0x3')],'defaultValue':''},'stamp':{'type':_0x842e('0x6'),'defaultValue':Sequelize[_0x842e('0x7')](_0x842e('0x8'))}}; \ No newline at end of file +var _0x5234=['VIRTUAL','getDataValue','INTEGER','STRING','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x264bca,_0x36fa36){var _0xeebace=function(_0x1069a0){while(--_0x1069a0){_0x264bca['push'](_0x264bca['shift']());}};_0xeebace(++_0x36fa36);}(_0x5234,0xe7));var _0x4523=function(_0x2172fa,_0x48149a){_0x2172fa=_0x2172fa-0x0;var _0x19b88e=_0x5234[_0x2172fa];return _0x19b88e;};'use strict';var Sequelize=require(_0x4523('0x0'));module['exports']={'name':{'type':Sequelize[_0x4523('0x1')],'get':function(_0x1b0109){return this[_0x4523('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x4523('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x4523('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x4523('0x5'),'defaultValue':Sequelize[_0x4523('0x6')](_0x4523('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 61c314f..4a45c2e 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 _0x4ab1=['catch','show','find','create','body','params','destroy','recording','msg_id','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','filter','merge','options','includeAll','include','findAll'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x4ab1,0xfc));var _0x14ab=function(_0x2d056d,_0x53f6c3){_0x2d056d=_0x2d056d-0x0;var _0x430fca=_0x4ab1[_0x2d056d];return _0x430fca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x14ab('0x0'));var rp=require(_0x14ab('0x1'));var moment=require(_0x14ab('0x2'));var BPromise=require(_0x14ab('0x3'));var Mustache=require(_0x14ab('0x4'));var util=require('util');var path=require(_0x14ab('0x5'));var sox=require(_0x14ab('0x6'));var csv=require(_0x14ab('0x7'));var ejs=require(_0x14ab('0x8'));var fs=require('fs');var fs_extra=require(_0x14ab('0x9'));var _=require(_0x14ab('0xa'));var squel=require(_0x14ab('0xb'));var crypto=require(_0x14ab('0xc'));var jsforce=require(_0x14ab('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x14ab('0xe'));var Redis=require('ioredis');var authService=require(_0x14ab('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x14ab('0x10'));var hardwareService=require(_0x14ab('0x11'));var logger=require(_0x14ab('0x12'))(_0x14ab('0x13'));var utils=require(_0x14ab('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x14ab('0x15'))['db'];function respondWithStatusCode(_0x3ddf64,_0x45a2df){_0x45a2df=_0x45a2df||0xcc;return function(_0x1f750f){if(_0x1f750f){return _0x3ddf64[_0x14ab('0x16')](_0x45a2df);}return _0x3ddf64[_0x14ab('0x17')](_0x45a2df)['end']();};}function respondWithResult(_0x3f9a76,_0x2eec60){_0x2eec60=_0x2eec60||0xc8;return function(_0x280b3b){if(_0x280b3b){return _0x3f9a76[_0x14ab('0x17')](_0x2eec60)['json'](_0x280b3b);}};}function respondWithFilteredResult(_0x358148,_0x3a49a9){return function(_0x46bc70){if(_0x46bc70){var _0x365bbe=typeof _0x3a49a9[_0x14ab('0x18')]===_0x14ab('0x19')&&typeof _0x3a49a9[_0x14ab('0x1a')]===_0x14ab('0x19');var _0x2c4677=_0x46bc70['count'];var _0x5519ce=_0x365bbe?0x0:_0x3a49a9[_0x14ab('0x18')];var _0x398cbc=_0x365bbe?_0x46bc70[_0x14ab('0x1b')]:_0x3a49a9[_0x14ab('0x18')]+_0x3a49a9[_0x14ab('0x1a')];var _0x47c886;if(_0x398cbc>=_0x2c4677){_0x398cbc=_0x2c4677;_0x47c886=0xc8;}else{_0x47c886=0xce;}_0x358148[_0x14ab('0x17')](_0x47c886);return _0x358148[_0x14ab('0x1c')](_0x14ab('0x1d'),_0x5519ce+'-'+_0x398cbc+'/'+_0x2c4677)[_0x14ab('0x1e')](_0x46bc70);}return null;};}function patchUpdates(_0x16e6a4){return function(_0x3121e6){try{jsonpatch[_0x14ab('0x1f')](_0x3121e6,_0x16e6a4,!![]);}catch(_0x2d81aa){return BPromise[_0x14ab('0x20')](_0x2d81aa);}return _0x3121e6['save']();};}function saveUpdates(_0x34178b,_0x5a69a9){return function(_0x17de81){if(_0x17de81){return _0x17de81[_0x14ab('0x21')](_0x34178b)[_0x14ab('0x22')](function(_0x16c56f){return _0x16c56f;});}return null;};}function removeEntity(_0xf21be1,_0x1c4c02){return function(_0x23ffae){if(_0x23ffae){return _0x23ffae['destroy']()[_0x14ab('0x22')](function(){_0xf21be1[_0x14ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a35,_0x584d61){return function(_0x3c86d8){if(!_0x3c86d8){_0x22a35[_0x14ab('0x16')](0x194);}return _0x3c86d8;};}function handleError(_0x2e00e6,_0x44a907){_0x44a907=_0x44a907||0x1f4;return function(_0x53d75c){logger[_0x14ab('0x23')](_0x53d75c[_0x14ab('0x24')]);if(_0x53d75c['name']){delete _0x53d75c[_0x14ab('0x25')];}_0x2e00e6[_0x14ab('0x17')](_0x44a907)['send'](_0x53d75c);};}exports[_0x14ab('0x26')]=function(_0x19c7ab,_0x18865b){var _0x19b5b7={},_0x1c56f5={},_0xa1121c={'count':0x0,'rows':[]};var _0x480c89=_['map'](db[_0x14ab('0x27')][_0x14ab('0x28')],function(_0x40e5f9){return{'name':_0x40e5f9[_0x14ab('0x29')],'type':_0x40e5f9[_0x14ab('0x2a')]['key']};});_0x1c56f5['model']=_[_0x14ab('0x2b')](_[_0x14ab('0x2c')](_0x480c89,_0x14ab('0x25')),[_0x14ab('0x25')]);_0x1c56f5[_0x14ab('0x2d')]=_[_0x14ab('0x2e')](_0x19c7ab['query']);_0x1c56f5[_0x14ab('0x2f')]=_[_0x14ab('0x30')](_0x1c56f5[_0x14ab('0x31')],_0x1c56f5[_0x14ab('0x2d')]);_0x19b5b7[_0x14ab('0x32')]=_[_0x14ab('0x30')](_0x1c56f5['model'],qs[_0x14ab('0x33')](_0x19c7ab['query'][_0x14ab('0x33')]));_0x19b5b7[_0x14ab('0x32')]=_0x19b5b7['attributes'][_0x14ab('0x34')]?_0x19b5b7[_0x14ab('0x32')]:_0x1c56f5[_0x14ab('0x31')];if(!_0x19c7ab[_0x14ab('0x2d')][_0x14ab('0x35')](_0x14ab('0x36'))){_0x19b5b7[_0x14ab('0x1a')]=qs[_0x14ab('0x1a')](_0x19c7ab[_0x14ab('0x2d')][_0x14ab('0x1a')]);_0x19b5b7[_0x14ab('0x18')]=qs['offset'](_0x19c7ab[_0x14ab('0x2d')]['offset']);}_0x19b5b7[_0x14ab('0x37')]=qs['sort'](_0x19c7ab[_0x14ab('0x2d')]['sort']);_0x19b5b7['where']=qs['filters'](_[_0x14ab('0x38')](_0x19c7ab['query'],_0x1c56f5[_0x14ab('0x2f')]),_0x480c89);if(_0x19c7ab[_0x14ab('0x2d')]['filter']){_0x19b5b7['where']=_['merge'](_0x19b5b7[_0x14ab('0x39')],{'$or':_['map'](_0x480c89,function(_0x54b854){if(_0x54b854[_0x14ab('0x2a')]!=='VIRTUAL'){var _0x7a9167={};_0x7a9167[_0x54b854['name']]={'$like':'%'+_0x19c7ab[_0x14ab('0x2d')][_0x14ab('0x3a')]+'%'};return _0x7a9167;}})});}_0x19b5b7=_[_0x14ab('0x3b')]({},_0x19b5b7,_0x19c7ab[_0x14ab('0x3c')]);var _0x457346={'where':_0x19b5b7[_0x14ab('0x39')]};return db[_0x14ab('0x27')][_0x14ab('0x1b')](_0x457346)[_0x14ab('0x22')](function(_0x36aaf2){_0xa1121c['count']=_0x36aaf2;if(_0x19c7ab['query'][_0x14ab('0x3d')]){_0x19b5b7[_0x14ab('0x3e')]=[{'all':!![]}];}return db[_0x14ab('0x27')][_0x14ab('0x3f')](_0x19b5b7);})[_0x14ab('0x22')](function(_0x5b4080){_0xa1121c['rows']=_0x5b4080;return _0xa1121c;})[_0x14ab('0x22')](respondWithFilteredResult(_0x18865b,_0x19b5b7))[_0x14ab('0x40')](handleError(_0x18865b,null));};exports[_0x14ab('0x41')]=function(_0x208af0,_0x319955){var _0x267eb={'raw':!![],'where':{'id':_0x208af0['params']['id']}},_0x1be9e4={};_0x1be9e4['model']=_['keys'](db[_0x14ab('0x27')]['rawAttributes']);_0x1be9e4[_0x14ab('0x2d')]=_[_0x14ab('0x2e')](_0x208af0[_0x14ab('0x2d')]);_0x1be9e4[_0x14ab('0x2f')]=_[_0x14ab('0x30')](_0x1be9e4[_0x14ab('0x31')],_0x1be9e4['query']);_0x267eb[_0x14ab('0x32')]=_[_0x14ab('0x30')](_0x1be9e4[_0x14ab('0x31')],qs[_0x14ab('0x33')](_0x208af0['query']['fields']));_0x267eb[_0x14ab('0x32')]=_0x267eb[_0x14ab('0x32')]['length']?_0x267eb[_0x14ab('0x32')]:_0x1be9e4[_0x14ab('0x31')];if(_0x208af0[_0x14ab('0x2d')][_0x14ab('0x3d')]){_0x267eb[_0x14ab('0x3e')]=[{'all':!![]}];}_0x267eb=_['merge']({},_0x267eb,_0x208af0['options']);return db[_0x14ab('0x27')][_0x14ab('0x42')](_0x267eb)[_0x14ab('0x22')](handleEntityNotFound(_0x319955,null))[_0x14ab('0x22')](respondWithResult(_0x319955,null))[_0x14ab('0x40')](handleError(_0x319955,null));};exports[_0x14ab('0x43')]=function(_0x1c96f1,_0x30ddf8){return db[_0x14ab('0x27')][_0x14ab('0x43')](_0x1c96f1[_0x14ab('0x44')],{})[_0x14ab('0x22')](respondWithResult(_0x30ddf8,0xc9))[_0x14ab('0x40')](handleError(_0x30ddf8,null));};exports[_0x14ab('0x21')]=function(_0x53433c,_0x4f1234){if(_0x53433c[_0x14ab('0x44')]['id']){delete _0x53433c[_0x14ab('0x44')]['id'];}return db[_0x14ab('0x27')][_0x14ab('0x42')]({'where':{'id':_0x53433c[_0x14ab('0x45')]['id']}})[_0x14ab('0x22')](handleEntityNotFound(_0x4f1234,null))[_0x14ab('0x22')](saveUpdates(_0x53433c['body'],null))[_0x14ab('0x22')](respondWithResult(_0x4f1234,null))[_0x14ab('0x40')](handleError(_0x4f1234,null));};exports[_0x14ab('0x46')]=function(_0x54fe05,_0x28a2f4){return db[_0x14ab('0x27')]['find']({'where':{'id':_0x54fe05[_0x14ab('0x45')]['id']}})[_0x14ab('0x22')](handleEntityNotFound(_0x28a2f4,null))[_0x14ab('0x22')](removeEntity(_0x28a2f4,null))[_0x14ab('0x40')](handleError(_0x28a2f4,null));};exports['download']=function(_0x5520e9,_0x53c9c4,_0x5edd21){return db[_0x14ab('0x27')][_0x14ab('0x42')]({'where':{'id':_0x5520e9[_0x14ab('0x45')]['id']},'attributes':['id',_0x14ab('0x47'),_0x14ab('0x48')]})['then'](handleEntityNotFound(_0x53c9c4,null))['then'](function(_0x186da8){if(_0x186da8){if(!_0x186da8[_0x14ab('0x47')]){throw new db['Sequelize'][(_0x14ab('0x49'))]('VoiceMailMessage\x20not\x20found');}var _0x415324={'Content-Type':_0x14ab('0x4a'),'Content-Disposition':'attachment'};if(_0x186da8[_0x14ab('0x48')]){_0x415324[_0x14ab('0x4b')]=_0x14ab('0x4c')+_0x186da8[_0x14ab('0x48')]+_0x14ab('0x4d');}_0x53c9c4[_0x14ab('0x1c')](_0x415324);return _0x53c9c4[_0x14ab('0x4e')](new Buffer(_0x186da8[_0x14ab('0x47')]));}})['catch'](handleError(_0x53c9c4,null));}; \ No newline at end of file +var _0x2641=['json','undefined','limit','count','offset','set','save','update','then','error','stack','name','send','map','VoiceMailMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','find','destroy','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3024c9,_0xa170e1){var _0x2fce3a=function(_0x37c7fc){while(--_0x37c7fc){_0x3024c9['push'](_0x3024c9['shift']());}};_0x2fce3a(++_0xa170e1);}(_0x2641,0x12a));var _0x1264=function(_0x1408b4,_0x22e866){_0x1408b4=_0x1408b4-0x0;var _0x39276b=_0x2641[_0x1408b4];return _0x39276b;};'use strict';var emlformat=require(_0x1264('0x0'));var rimraf=require(_0x1264('0x1'));var zipdir=require(_0x1264('0x2'));var jsonpatch=require(_0x1264('0x3'));var rp=require(_0x1264('0x4'));var moment=require('moment');var BPromise=require(_0x1264('0x5'));var Mustache=require('mustache');var util=require(_0x1264('0x6'));var path=require(_0x1264('0x7'));var sox=require(_0x1264('0x8'));var csv=require(_0x1264('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1264('0xa'));var _=require(_0x1264('0xb'));var squel=require(_0x1264('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1264('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1264('0xe'));var Papa=require('papaparse');var Redis=require(_0x1264('0xf'));var authService=require(_0x1264('0x10'));var qs=require(_0x1264('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1264('0x12'));var logger=require(_0x1264('0x13'))(_0x1264('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1264('0x15'));var db=require(_0x1264('0x16'))['db'];function respondWithStatusCode(_0x2658e9,_0x3677b7){_0x3677b7=_0x3677b7||0xcc;return function(_0x1b3ed0){if(_0x1b3ed0){return _0x2658e9[_0x1264('0x17')](_0x3677b7);}return _0x2658e9[_0x1264('0x18')](_0x3677b7)[_0x1264('0x19')]();};}function respondWithResult(_0x49fb2f,_0x5aa4a6){_0x5aa4a6=_0x5aa4a6||0xc8;return function(_0x4301fe){if(_0x4301fe){return _0x49fb2f[_0x1264('0x18')](_0x5aa4a6)[_0x1264('0x1a')](_0x4301fe);}};}function respondWithFilteredResult(_0x2b8a78,_0x31f1e7){return function(_0x2ca485){if(_0x2ca485){var _0x2b6243=typeof _0x31f1e7['offset']===_0x1264('0x1b')&&typeof _0x31f1e7[_0x1264('0x1c')]===_0x1264('0x1b');var _0x25e46c=_0x2ca485[_0x1264('0x1d')];var _0x802ce7=_0x2b6243?0x0:_0x31f1e7[_0x1264('0x1e')];var _0x96aa11=_0x2b6243?_0x2ca485[_0x1264('0x1d')]:_0x31f1e7[_0x1264('0x1e')]+_0x31f1e7[_0x1264('0x1c')];var _0x555370;if(_0x96aa11>=_0x25e46c){_0x96aa11=_0x25e46c;_0x555370=0xc8;}else{_0x555370=0xce;}_0x2b8a78[_0x1264('0x18')](_0x555370);return _0x2b8a78[_0x1264('0x1f')]('Content-Range',_0x802ce7+'-'+_0x96aa11+'/'+_0x25e46c)[_0x1264('0x1a')](_0x2ca485);}return null;};}function patchUpdates(_0x58476e){return function(_0x218104){try{jsonpatch['apply'](_0x218104,_0x58476e,!![]);}catch(_0x228e1f){return BPromise['reject'](_0x228e1f);}return _0x218104[_0x1264('0x20')]();};}function saveUpdates(_0x57049e,_0x218863){return function(_0x105298){if(_0x105298){return _0x105298[_0x1264('0x21')](_0x57049e)[_0x1264('0x22')](function(_0x19e6aa){return _0x19e6aa;});}return null;};}function removeEntity(_0x2f7f7a,_0x2baea6){return function(_0x309fb1){if(_0x309fb1){return _0x309fb1['destroy']()[_0x1264('0x22')](function(){_0x2f7f7a['status'](0xcc)[_0x1264('0x19')]();});}};}function handleEntityNotFound(_0x351648,_0x107c21){return function(_0x57b463){if(!_0x57b463){_0x351648[_0x1264('0x17')](0x194);}return _0x57b463;};}function handleError(_0x1a58aa,_0x5508d6){_0x5508d6=_0x5508d6||0x1f4;return function(_0x120179){logger[_0x1264('0x23')](_0x120179[_0x1264('0x24')]);if(_0x120179[_0x1264('0x25')]){delete _0x120179[_0x1264('0x25')];}_0x1a58aa[_0x1264('0x18')](_0x5508d6)[_0x1264('0x26')](_0x120179);};}exports['index']=function(_0x2584b8,_0xe2eb6){var _0x72d2a6={},_0x2a8e9e={},_0x262fd9={'count':0x0,'rows':[]};var _0x3127d7=_[_0x1264('0x27')](db[_0x1264('0x28')]['rawAttributes'],function(_0x406288){return{'name':_0x406288[_0x1264('0x29')],'type':_0x406288[_0x1264('0x2a')][_0x1264('0x2b')]};});_0x2a8e9e['model']=_['differenceBy'](_[_0x1264('0x27')](_0x3127d7,_0x1264('0x25')),[_0x1264('0x25')]);_0x2a8e9e[_0x1264('0x2c')]=_[_0x1264('0x2d')](_0x2584b8['query']);_0x2a8e9e[_0x1264('0x2e')]=_[_0x1264('0x2f')](_0x2a8e9e[_0x1264('0x30')],_0x2a8e9e[_0x1264('0x2c')]);_0x72d2a6[_0x1264('0x31')]=_[_0x1264('0x2f')](_0x2a8e9e[_0x1264('0x30')],qs[_0x1264('0x32')](_0x2584b8['query'][_0x1264('0x32')]));_0x72d2a6[_0x1264('0x31')]=_0x72d2a6['attributes'][_0x1264('0x33')]?_0x72d2a6[_0x1264('0x31')]:_0x2a8e9e[_0x1264('0x30')];if(!_0x2584b8['query'][_0x1264('0x34')](_0x1264('0x35'))){_0x72d2a6[_0x1264('0x1c')]=qs[_0x1264('0x1c')](_0x2584b8[_0x1264('0x2c')][_0x1264('0x1c')]);_0x72d2a6[_0x1264('0x1e')]=qs[_0x1264('0x1e')](_0x2584b8['query'][_0x1264('0x1e')]);}_0x72d2a6['order']=qs[_0x1264('0x36')](_0x2584b8[_0x1264('0x2c')][_0x1264('0x36')]);_0x72d2a6[_0x1264('0x37')]=qs[_0x1264('0x2e')](_['pick'](_0x2584b8['query'],_0x2a8e9e[_0x1264('0x2e')]),_0x3127d7);if(_0x2584b8[_0x1264('0x2c')]['filter']){_0x72d2a6[_0x1264('0x37')]=_['merge'](_0x72d2a6[_0x1264('0x37')],{'$or':_[_0x1264('0x27')](_0x3127d7,function(_0x5001ef){if(_0x5001ef['type']!==_0x1264('0x38')){var _0x5d106b={};_0x5d106b[_0x5001ef['name']]={'$like':'%'+_0x2584b8[_0x1264('0x2c')][_0x1264('0x39')]+'%'};return _0x5d106b;}})});}_0x72d2a6=_[_0x1264('0x3a')]({},_0x72d2a6,_0x2584b8[_0x1264('0x3b')]);var _0x491f78={'where':_0x72d2a6['where']};return db[_0x1264('0x28')][_0x1264('0x1d')](_0x491f78)[_0x1264('0x22')](function(_0x2522a7){_0x262fd9[_0x1264('0x1d')]=_0x2522a7;if(_0x2584b8['query'][_0x1264('0x3c')]){_0x72d2a6['include']=[{'all':!![]}];}return db[_0x1264('0x28')][_0x1264('0x3d')](_0x72d2a6);})['then'](function(_0x5cb1b0){_0x262fd9[_0x1264('0x3e')]=_0x5cb1b0;return _0x262fd9;})[_0x1264('0x22')](respondWithFilteredResult(_0xe2eb6,_0x72d2a6))[_0x1264('0x3f')](handleError(_0xe2eb6,null));};exports['show']=function(_0x3ab014,_0x5cae1f){var _0x2449ee={'raw':!![],'where':{'id':_0x3ab014[_0x1264('0x40')]['id']}},_0x299b12={};_0x299b12['model']=_[_0x1264('0x2d')](db[_0x1264('0x28')][_0x1264('0x41')]);_0x299b12[_0x1264('0x2c')]=_['keys'](_0x3ab014['query']);_0x299b12[_0x1264('0x2e')]=_[_0x1264('0x2f')](_0x299b12[_0x1264('0x30')],_0x299b12[_0x1264('0x2c')]);_0x2449ee[_0x1264('0x31')]=_[_0x1264('0x2f')](_0x299b12[_0x1264('0x30')],qs[_0x1264('0x32')](_0x3ab014[_0x1264('0x2c')][_0x1264('0x32')]));_0x2449ee[_0x1264('0x31')]=_0x2449ee[_0x1264('0x31')][_0x1264('0x33')]?_0x2449ee[_0x1264('0x31')]:_0x299b12[_0x1264('0x30')];if(_0x3ab014['query'][_0x1264('0x3c')]){_0x2449ee[_0x1264('0x42')]=[{'all':!![]}];}_0x2449ee=_[_0x1264('0x3a')]({},_0x2449ee,_0x3ab014[_0x1264('0x3b')]);return db['VoiceMailMessage']['find'](_0x2449ee)[_0x1264('0x22')](handleEntityNotFound(_0x5cae1f,null))['then'](respondWithResult(_0x5cae1f,null))[_0x1264('0x3f')](handleError(_0x5cae1f,null));};exports[_0x1264('0x43')]=function(_0x5547ad,_0x5120b7){return db['VoiceMailMessage']['create'](_0x5547ad[_0x1264('0x44')],{})[_0x1264('0x22')](respondWithResult(_0x5120b7,0xc9))['catch'](handleError(_0x5120b7,null));};exports[_0x1264('0x21')]=function(_0x4f7e77,_0x20388f){if(_0x4f7e77[_0x1264('0x44')]['id']){delete _0x4f7e77['body']['id'];}return db[_0x1264('0x28')][_0x1264('0x45')]({'where':{'id':_0x4f7e77[_0x1264('0x40')]['id']}})[_0x1264('0x22')](handleEntityNotFound(_0x20388f,null))['then'](saveUpdates(_0x4f7e77['body'],null))['then'](respondWithResult(_0x20388f,null))[_0x1264('0x3f')](handleError(_0x20388f,null));};exports[_0x1264('0x46')]=function(_0x9d1943,_0x3bb44a){return db['VoiceMailMessage']['find']({'where':{'id':_0x9d1943[_0x1264('0x40')]['id']}})[_0x1264('0x22')](handleEntityNotFound(_0x3bb44a,null))[_0x1264('0x22')](removeEntity(_0x3bb44a,null))[_0x1264('0x3f')](handleError(_0x3bb44a,null));};exports[_0x1264('0x47')]=function(_0x2907e3,_0x49f729,_0x30f2b1){return db[_0x1264('0x28')][_0x1264('0x45')]({'where':{'id':_0x2907e3[_0x1264('0x40')]['id']},'attributes':['id','recording',_0x1264('0x48')]})['then'](handleEntityNotFound(_0x49f729,null))[_0x1264('0x22')](function(_0xf3132d){if(_0xf3132d){if(!_0xf3132d[_0x1264('0x49')]){throw new db[(_0x1264('0x4a'))][(_0x1264('0x4b'))](_0x1264('0x4c'));}var _0x1402a0={'Content-Type':'audio/wav','Content-Disposition':_0x1264('0x4d')};if(_0xf3132d['msg_id']){_0x1402a0[_0x1264('0x4e')]=_0x1264('0x4f')+_0xf3132d[_0x1264('0x48')]+_0x1264('0x50');}_0x49f729[_0x1264('0x1f')](_0x1402a0);return _0x49f729[_0x1264('0x26')](new Buffer(_0xf3132d[_0x1264('0x49')]));}})[_0x1264('0x3f')](handleError(_0x49f729,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 41b4ba2..f786cc6 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 _0xc120=['path','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xc120,0x1c1));var _0x0c12=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xc120[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0c12('0x0'));var util=require(_0x0c12('0x1'));var logger=require(_0x0c12('0x2'))(_0x0c12('0x3'));var moment=require(_0x0c12('0x4'));var BPromise=require(_0x0c12('0x5'));var rp=require(_0x0c12('0x6'));var fs=require('fs');var path=require(_0x0c12('0x7'));var rimraf=require(_0x0c12('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c12('0x9'));module[_0x0c12('0xa')]=function(_0x118c41,_0x27ae92){return _0x118c41['define'](_0x0c12('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x8baf=['./voiceMailMessage.attributes','define','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x8baf,0x7c));var _0xf8ba=function(_0x30487e,_0x31f883){_0x30487e=_0x30487e-0x0;var _0x457270=_0x8baf[_0x30487e];return _0x457270;};'use strict';var _=require(_0xf8ba('0x0'));var util=require(_0xf8ba('0x1'));var logger=require(_0xf8ba('0x2'))(_0xf8ba('0x3'));var moment=require(_0xf8ba('0x4'));var BPromise=require(_0xf8ba('0x5'));var rp=require(_0xf8ba('0x6'));var fs=require('fs');var path=require(_0xf8ba('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8ba('0x8'));module['exports']=function(_0x30ff18,_0x5e94bf){return _0x30ff18[_0xf8ba('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf8ba('0xa'),'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 70e177f..8812b9e 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 _0xd1f5=['VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xd1f5,0xe5));var _0x5d1f=function(_0x1e464b,_0x322bd8){_0x1e464b=_0x1e464b-0x0;var _0x3442d0=_0xd1f5[_0x1e464b];return _0x3442d0;};'use strict';var _=require(_0x5d1f('0x0'));var util=require(_0x5d1f('0x1'));var moment=require(_0x5d1f('0x2'));var BPromise=require(_0x5d1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d1f('0x4'));var db=require(_0x5d1f('0x5'))['db'];var utils=require(_0x5d1f('0x6'));var logger=require('../../config/logger')(_0x5d1f('0x7'));var config=require(_0x5d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d1f('0x9')][_0x5d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d396d,_0x5207e0,_0x2d991e){return new BPromise(function(_0x360321,_0x1c580a){return client['request'](_0x3d396d,_0x2d991e)[_0x5d1f('0xb')](function(_0x348128){logger[_0x5d1f('0xc')](_0x5d1f('0xd'),_0x5207e0,'request\x20sent');logger['debug'](_0x5d1f('0xe'),_0x5207e0,_0x5d1f('0xf'),JSON[_0x5d1f('0x10')](_0x348128));if(_0x348128['error']){if(_0x348128[_0x5d1f('0x11')][_0x5d1f('0x12')]===0x1f4){logger[_0x5d1f('0x11')](_0x5d1f('0xd'),_0x5207e0,_0x348128[_0x5d1f('0x11')][_0x5d1f('0x13')]);return _0x1c580a(_0x348128[_0x5d1f('0x11')][_0x5d1f('0x13')]);}logger['error'](_0x5d1f('0xd'),_0x5207e0,_0x348128['error']['message']);return _0x360321(_0x348128[_0x5d1f('0x11')]['message']);}else{logger['info'](_0x5d1f('0xd'),_0x5207e0,_0x5d1f('0xf'));_0x360321(_0x348128[_0x5d1f('0x14')][_0x5d1f('0x13')]);}})[_0x5d1f('0x15')](function(_0x38d48f){logger['error'](_0x5d1f('0xd'),_0x5207e0,_0x38d48f);_0x1c580a(_0x38d48f);});});} \ No newline at end of file +var _0x89c7=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x3edfa7,_0x1b6b68){var _0x3d4914=function(_0x5b5df9){while(--_0x5b5df9){_0x3edfa7['push'](_0x3edfa7['shift']());}};_0x3d4914(++_0x1b6b68);}(_0x89c7,0x1d1));var _0x789c=function(_0x167b19,_0x56081a){_0x167b19=_0x167b19-0x0;var _0x1fcca2=_0x89c7[_0x167b19];return _0x1fcca2;};'use strict';var _=require('lodash');var util=require(_0x789c('0x0'));var moment=require(_0x789c('0x1'));var BPromise=require(_0x789c('0x2'));var rs=require(_0x789c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x789c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x789c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x789c('0x6')][_0x789c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x507275,_0x3403b2,_0x55e859){return new BPromise(function(_0xb2beaa,_0x31d126){return client[_0x789c('0x8')](_0x507275,_0x55e859)[_0x789c('0x9')](function(_0x151448){logger[_0x789c('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x3403b2,_0x789c('0xb'));logger[_0x789c('0xc')](_0x789c('0xd'),_0x3403b2,_0x789c('0xb'),JSON[_0x789c('0xe')](_0x151448));if(_0x151448[_0x789c('0xf')]){if(_0x151448[_0x789c('0xf')][_0x789c('0x10')]===0x1f4){logger[_0x789c('0xf')](_0x789c('0x11'),_0x3403b2,_0x151448[_0x789c('0xf')][_0x789c('0x12')]);return _0x31d126(_0x151448[_0x789c('0xf')]['message']);}logger[_0x789c('0xf')](_0x789c('0x11'),_0x3403b2,_0x151448[_0x789c('0xf')][_0x789c('0x12')]);return _0xb2beaa(_0x151448['error'][_0x789c('0x12')]);}else{logger['info'](_0x789c('0x11'),_0x3403b2,_0x789c('0xb'));_0xb2beaa(_0x151448[_0x789c('0x13')][_0x789c('0x12')]);}})[_0x789c('0x14')](function(_0x1611d4){logger[_0x789c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x3403b2,_0x1611d4);_0x31d126(_0x1611d4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index db684fb..6d36a04 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 _0x258c=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','post','/:id/sounds','addSound','put','delete','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x258c,0x161));var _0xc258=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x258c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc258('0x0'));var util=require(_0xc258('0x1'));var path=require('path');var timeout=require(_0xc258('0x2'));var express=require(_0xc258('0x3'));var router=express[_0xc258('0x4')]();var fs_extra=require(_0xc258('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc258('0x6'));var controller=require(_0xc258('0x7'));router[_0xc258('0x8')]('/',auth[_0xc258('0x9')](),controller[_0xc258('0xa')]);router[_0xc258('0x8')](_0xc258('0xb'),auth[_0xc258('0x9')](),controller[_0xc258('0xc')]);router[_0xc258('0x8')]('/:id/sounds',auth[_0xc258('0x9')](),controller['getSounds']);router['post']('/',auth[_0xc258('0x9')](),controller['create']);router[_0xc258('0xd')](_0xc258('0xe'),auth['isAuthenticated'](),controller[_0xc258('0xf')]);router[_0xc258('0x10')](_0xc258('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc258('0x11')](_0xc258('0xb'),auth[_0xc258('0x9')](),controller['destroy']);router[_0xc258('0x11')]('/:id/sounds/:id2',auth[_0xc258('0x9')](),controller[_0xc258('0x12')]);module[_0xc258('0x13')]=router; \ No newline at end of file +var _0xcfed=['get','getSounds','create','post','/:id/sounds','addSound','put','update','delete','destroy','removeSound','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show'];(function(_0x12e417,_0x4dee33){var _0x184703=function(_0x1b3675){while(--_0x1b3675){_0x12e417['push'](_0x12e417['shift']());}};_0x184703(++_0x4dee33);}(_0xcfed,0x1aa));var _0xdcfe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfed[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xdcfe('0x0'));var util=require('util');var path=require(_0xdcfe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcfe('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdcfe('0x3'));var interaction=require(_0xdcfe('0x4'));var config=require(_0xdcfe('0x5'));var controller=require(_0xdcfe('0x6'));router['get']('/',auth[_0xdcfe('0x7')](),controller[_0xdcfe('0x8')]);router['get'](_0xdcfe('0x9'),auth[_0xdcfe('0x7')](),controller[_0xdcfe('0xa')]);router[_0xdcfe('0xb')]('/:id/sounds',auth[_0xdcfe('0x7')](),controller[_0xdcfe('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdcfe('0xd')]);router[_0xdcfe('0xe')](_0xdcfe('0xf'),auth[_0xdcfe('0x7')](),controller[_0xdcfe('0x10')]);router[_0xdcfe('0x11')]('/:id',auth[_0xdcfe('0x7')](),controller[_0xdcfe('0x12')]);router[_0xdcfe('0x13')](_0xdcfe('0x9'),auth[_0xdcfe('0x7')](),controller[_0xdcfe('0x14')]);router[_0xdcfe('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xdcfe('0x15')]);module[_0xdcfe('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9ba59ad..7e979cd 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 _0x6a33=['quietmp3nb','quietmp3','alpha','exports','STRING','name','custom','files','mp3nb'];(function(_0x59c728,_0x138dc0){var _0x397cf2=function(_0x5a1c93){while(--_0x5a1c93){_0x59c728['push'](_0x59c728['shift']());}};_0x397cf2(++_0x138dc0);}(_0x6a33,0x150));var _0x36a3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6a33[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require('sequelize');module[_0x36a3('0x0')]={'name':{'type':Sequelize[_0x36a3('0x1')],'allowNull':![],'unique':_0x36a3('0x2')},'mode':{'type':Sequelize['ENUM'](_0x36a3('0x3'),_0x36a3('0x4'),_0x36a3('0x5'),_0x36a3('0x6'),_0x36a3('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x36a3('0x4')},'directory':{'type':Sequelize[_0x36a3('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x36a3('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x36a3('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x36a3('0x8')},'format':{'type':Sequelize[_0x36a3('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc805=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb','quietmp3','mp3'];(function(_0x46e95a,_0x16f07c){var _0x103a0d=function(_0xdea585){while(--_0xdea585){_0x46e95a['push'](_0x46e95a['shift']());}};_0x103a0d(++_0x16f07c);}(_0xc805,0x10b));var _0x5c80=function(_0x867c03,_0x5f532d){_0x867c03=_0x867c03-0x0;var _0x760969=_0xc805[_0x867c03];return _0x760969;};'use strict';var Sequelize=require(_0x5c80('0x0'));module[_0x5c80('0x1')]={'name':{'type':Sequelize[_0x5c80('0x2')],'allowNull':![],'unique':_0x5c80('0x3')},'mode':{'type':Sequelize['ENUM'](_0x5c80('0x4'),_0x5c80('0x5'),_0x5c80('0x6'),'quietmp3nb',_0x5c80('0x7'),_0x5c80('0x8')),'allowNull':!![],'defaultValue':_0x5c80('0x5')},'directory':{'type':Sequelize[_0x5c80('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5c80('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5c80('0x9')},'format':{'type':Sequelize[_0x5c80('0x2')],'allowNull':!![]},'stamp':{'type':_0x5c80('0xa')},'defaultEntry':{'type':Sequelize[_0x5c80('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 f21f8c9..c4b12d8 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 _0x63f7=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','Sequelize','ValidationError','message','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','root','server/files/moh','symlinkSync','removeSound','format','getSounds','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','MusicOnHolds','UserProfileResource','destroy','sendStatus','error','name','send','index','VoiceMusicOnHold','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','body','find','create','sequelize','transaction','mode','directory','join','mkdirSync','0777','user','get','role','UserProfileSection','userProfileId'];(function(_0x312b06,_0x5ad05e){var _0x54dd60=function(_0x837599){while(--_0x837599){_0x312b06['push'](_0x312b06['shift']());}};_0x54dd60(++_0x5ad05e);}(_0x63f7,0xe8));var _0x763f=function(_0xfd2b2e,_0x3c3ad6){_0xfd2b2e=_0xfd2b2e-0x0;var _0x2fdb66=_0x63f7[_0xfd2b2e];return _0x2fdb66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x763f('0x0'));var zipdir=require(_0x763f('0x1'));var jsonpatch=require(_0x763f('0x2'));var rp=require(_0x763f('0x3'));var moment=require('moment');var BPromise=require(_0x763f('0x4'));var Mustache=require(_0x763f('0x5'));var util=require(_0x763f('0x6'));var path=require(_0x763f('0x7'));var sox=require(_0x763f('0x8'));var csv=require('to-csv');var ejs=require(_0x763f('0x9'));var fs=require('fs');var fs_extra=require(_0x763f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x763f('0xb'));var jsforce=require(_0x763f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x763f('0xd'));var querystring=require('querystring');var Papa=require(_0x763f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x763f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x763f('0x10'))(_0x763f('0x11'));var utils=require(_0x763f('0x12'));var config=require(_0x763f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d67b,_0x64eaff){_0x64eaff=_0x64eaff||0xcc;return function(_0x3c01da){if(_0x3c01da){return _0x44d67b['sendStatus'](_0x64eaff);}return _0x44d67b['status'](_0x64eaff)[_0x763f('0x14')]();};}function respondWithResult(_0x4736c6,_0xf8cf3d){_0xf8cf3d=_0xf8cf3d||0xc8;return function(_0x2f7366){if(_0x2f7366){return _0x4736c6[_0x763f('0x15')](_0xf8cf3d)[_0x763f('0x16')](_0x2f7366);}};}function respondWithFilteredResult(_0x1cabfe,_0x38b748){return function(_0x308569){if(_0x308569){var _0x239882=typeof _0x38b748[_0x763f('0x17')]===_0x763f('0x18')&&typeof _0x38b748[_0x763f('0x19')]===_0x763f('0x18');var _0x5e0118=_0x308569['count'];var _0x574d29=_0x239882?0x0:_0x38b748[_0x763f('0x17')];var _0x500bae=_0x239882?_0x308569[_0x763f('0x1a')]:_0x38b748['offset']+_0x38b748[_0x763f('0x19')];var _0x18603d;if(_0x500bae>=_0x5e0118){_0x500bae=_0x5e0118;_0x18603d=0xc8;}else{_0x18603d=0xce;}_0x1cabfe[_0x763f('0x15')](_0x18603d);return _0x1cabfe[_0x763f('0x1b')](_0x763f('0x1c'),_0x574d29+'-'+_0x500bae+'/'+_0x5e0118)[_0x763f('0x16')](_0x308569);}return null;};}function patchUpdates(_0x12f7b0){return function(_0x37a930){try{jsonpatch[_0x763f('0x1d')](_0x37a930,_0x12f7b0,!![]);}catch(_0x4dd68f){return BPromise[_0x763f('0x1e')](_0x4dd68f);}return _0x37a930['save']();};}function saveUpdates(_0x1bfd13,_0x2cd801){return function(_0x570b80){if(_0x570b80){return _0x570b80[_0x763f('0x1f')](_0x1bfd13)[_0x763f('0x20')](function(_0x441c30){return _0x441c30;});}return null;};}function removeEntity(_0x4a12b7,_0x13fd93){return function(_0x393c46){if(_0x393c46){return _0x393c46['destroy']()['then'](function(){var _0xbb5080=_0x393c46['get']({'plain':!![]});var _0x58321c=_0x763f('0x21');return db[_0x763f('0x22')][_0x763f('0x23')]({'where':{'type':_0x58321c,'resourceId':_0xbb5080['id']}})['then'](function(){return _0x393c46;});})[_0x763f('0x20')](function(){_0x4a12b7[_0x763f('0x15')](0xcc)[_0x763f('0x14')]();});}};}function handleEntityNotFound(_0x38bd23,_0x586dbd){return function(_0x5501af){if(!_0x5501af){_0x38bd23[_0x763f('0x24')](0x194);}return _0x5501af;};}function handleError(_0x2328e9,_0x5b5bf6){_0x5b5bf6=_0x5b5bf6||0x1f4;return function(_0x232ea5){logger[_0x763f('0x25')](_0x232ea5['stack']);if(_0x232ea5[_0x763f('0x26')]){delete _0x232ea5[_0x763f('0x26')];}_0x2328e9[_0x763f('0x15')](_0x5b5bf6)[_0x763f('0x27')](_0x232ea5);};}exports[_0x763f('0x28')]=function(_0x476bcd,_0x4d427c){var _0x3f8bea={},_0x10f8df={},_0x375bd6={'count':0x0,'rows':[]};var _0x2cfa8f=_['map'](db[_0x763f('0x29')]['rawAttributes'],function(_0x407724){return{'name':_0x407724[_0x763f('0x2a')],'type':_0x407724['type']['key']};});_0x10f8df[_0x763f('0x2b')]=_['map'](_0x2cfa8f,'name');_0x10f8df[_0x763f('0x2c')]=_[_0x763f('0x2d')](_0x476bcd[_0x763f('0x2c')]);_0x10f8df[_0x763f('0x2e')]=_[_0x763f('0x2f')](_0x10f8df[_0x763f('0x2b')],_0x10f8df[_0x763f('0x2c')]);_0x3f8bea[_0x763f('0x30')]=_[_0x763f('0x2f')](_0x10f8df[_0x763f('0x2b')],qs[_0x763f('0x31')](_0x476bcd[_0x763f('0x2c')]['fields']));_0x3f8bea['attributes']=_0x3f8bea[_0x763f('0x30')][_0x763f('0x32')]?_0x3f8bea['attributes']:_0x10f8df[_0x763f('0x2b')];if(!_0x476bcd[_0x763f('0x2c')]['hasOwnProperty'](_0x763f('0x33'))){_0x3f8bea[_0x763f('0x19')]=qs[_0x763f('0x19')](_0x476bcd[_0x763f('0x2c')][_0x763f('0x19')]);_0x3f8bea[_0x763f('0x17')]=qs[_0x763f('0x17')](_0x476bcd[_0x763f('0x2c')]['offset']);}_0x3f8bea[_0x763f('0x34')]=qs[_0x763f('0x35')](_0x476bcd[_0x763f('0x2c')]['sort']);delete _0x476bcd[_0x763f('0x2c')][_0x763f('0x35')];_0x3f8bea['where']=qs[_0x763f('0x2e')](_[_0x763f('0x36')](_0x476bcd[_0x763f('0x2c')],_0x10f8df[_0x763f('0x2e')]),_0x2cfa8f);if(_0x476bcd['query'][_0x763f('0x37')]){_0x3f8bea[_0x763f('0x38')]=_[_0x763f('0x39')](_0x3f8bea['where'],{'$or':_[_0x763f('0x3a')](_0x2cfa8f,function(_0x188c46){if(_0x188c46[_0x763f('0x3b')]!==_0x763f('0x3c')){var _0x231080={};_0x231080[_0x188c46['name']]={'$like':'%'+_0x476bcd[_0x763f('0x2c')][_0x763f('0x37')]+'%'};return _0x231080;}})});}_0x3f8bea=_['merge']({},_0x3f8bea,_0x476bcd[_0x763f('0x3d')]);var _0x42170c={'where':_0x3f8bea['where']};return db[_0x763f('0x29')][_0x763f('0x1a')](_0x42170c)['then'](function(_0x42af93){_0x375bd6[_0x763f('0x1a')]=_0x42af93;if(_0x476bcd['query'][_0x763f('0x3e')]){_0x3f8bea['include']=[{'all':!![]}];}return db[_0x763f('0x29')][_0x763f('0x3f')](_0x3f8bea);})['then'](function(_0xc25372){_0x375bd6[_0x763f('0x40')]=_0xc25372;return _0x375bd6;})[_0x763f('0x20')](respondWithFilteredResult(_0x4d427c,_0x3f8bea))[_0x763f('0x41')](handleError(_0x4d427c,null));};exports['show']=function(_0x4d45f2,_0x103239){var _0x43884d={'raw':![],'where':{'id':_0x4d45f2[_0x763f('0x42')]['id']}},_0x62e9ea={};_0x62e9ea[_0x763f('0x2b')]=_[_0x763f('0x2d')](db[_0x763f('0x29')]['rawAttributes']);_0x62e9ea[_0x763f('0x2c')]=_['keys'](_0x4d45f2[_0x763f('0x2c')]);_0x62e9ea[_0x763f('0x2e')]=_[_0x763f('0x2f')](_0x62e9ea[_0x763f('0x2b')],_0x62e9ea['query']);_0x43884d[_0x763f('0x30')]=_[_0x763f('0x2f')](_0x62e9ea['model'],qs[_0x763f('0x31')](_0x4d45f2[_0x763f('0x2c')][_0x763f('0x31')]));_0x43884d['attributes']=_0x43884d[_0x763f('0x30')][_0x763f('0x32')]?_0x43884d[_0x763f('0x30')]:_0x62e9ea['model'];if(_0x4d45f2[_0x763f('0x2c')]['includeAll']){_0x43884d[_0x763f('0x43')]=[{'all':!![]}];}_0x43884d=_[_0x763f('0x39')]({},_0x43884d,_0x4d45f2[_0x763f('0x3d')]);return db['VoiceMusicOnHold']['find'](_0x43884d)[_0x763f('0x20')](handleEntityNotFound(_0x103239,null))['then'](respondWithResult(_0x103239,null))[_0x763f('0x41')](handleError(_0x103239,null));};exports[_0x763f('0x1f')]=function(_0x2967cd,_0x24967d){if(_0x2967cd['body']['id']){delete _0x2967cd[_0x763f('0x44')]['id'];}return db[_0x763f('0x29')][_0x763f('0x45')]({'where':{'id':_0x2967cd[_0x763f('0x42')]['id']}})[_0x763f('0x20')](handleEntityNotFound(_0x24967d,null))['then'](saveUpdates(_0x2967cd[_0x763f('0x44')],null))[_0x763f('0x20')](respondWithResult(_0x24967d,null))[_0x763f('0x41')](handleError(_0x24967d,null));};exports[_0x763f('0x46')]=function(_0x291e3c,_0x53c5c1,_0x2ee2c3){return db[_0x763f('0x47')][_0x763f('0x48')](function(_0x405e5b){if(_0x291e3c['body'][_0x763f('0x49')]==='files'){_0x291e3c[_0x763f('0x44')][_0x763f('0x4a')]=path[_0x763f('0x4b')](config['root'],'server/files/moh',_0x291e3c['body'][_0x763f('0x26')]);}return db[_0x763f('0x29')][_0x763f('0x46')](_0x291e3c[_0x763f('0x44')],{'transaction':_0x405e5b})[_0x763f('0x20')](function(_0x25cf02){if(_0x291e3c[_0x763f('0x44')]['mode']==='files'){fs[_0x763f('0x4c')](_0x25cf02['directory'],parseInt(_0x763f('0x4d'),0x8));}var _0x49221a=_0x291e3c[_0x763f('0x4e')][_0x763f('0x4f')]({'plain':!![]});if(!_0x49221a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49221a[_0x763f('0x50')]===_0x763f('0x4e')){var _0x231123=_0x25cf02[_0x763f('0x4f')]({'plain':!![]});return db[_0x763f('0x51')][_0x763f('0x45')]({'where':{'name':_0x763f('0x21'),'userProfileId':_0x49221a[_0x763f('0x52')]},'raw':!![]})[_0x763f('0x20')](function(_0x523812){if(_0x523812&&_0x523812[_0x763f('0x53')]===0x0){return db[_0x763f('0x22')][_0x763f('0x46')]({'name':_0x231123[_0x763f('0x26')],'resourceId':_0x231123['id'],'type':_0x523812['name'],'sectionId':_0x523812['id']},{})[_0x763f('0x20')](function(){return _0x25cf02;});}else{return _0x25cf02;}})[_0x763f('0x41')](function(_0x5a4a07){logger[_0x763f('0x25')](_0x763f('0x54'),_0x5a4a07);});}return _0x25cf02;});})[_0x763f('0x20')](respondWithResult(_0x53c5c1,0xc9))['catch'](handleError(_0x53c5c1,null));};exports[_0x763f('0x23')]=function(_0x50a863,_0x531d1f,_0x540963){var _0xb4b485;return db[_0x763f('0x29')][_0x763f('0x45')]({'where':{'id':_0x50a863['params']['id']}})[_0x763f('0x20')](function(_0x2b686b){if(_0x2b686b){return db[_0x763f('0x47')][_0x763f('0x48')](function(_0x12fcdb){return _0x2b686b['destroy']({'transaction':_0x12fcdb,'raw':!![]})[_0x763f('0x20')](function(_0x1806d3){if(_0x1806d3['directory']){fs[_0x763f('0x55')](_0x1806d3['directory'])['forEach'](function(_0x225666){fs[_0x763f('0x56')](path[_0x763f('0x4b')](_0x1806d3[_0x763f('0x4a')],_0x225666));});fs['rmdirSync'](_0x1806d3[_0x763f('0x4a')]);}return _0x1806d3;});})[_0x763f('0x41')](function(_0x38dc51){throw new db[(_0x763f('0x57'))][(_0x763f('0x58'))](_0x38dc51[_0x763f('0x59')]);});}})[_0x763f('0x20')](handleEntityNotFound(_0x531d1f,null))[_0x763f('0x20')](removeEntity(_0x531d1f,null))['catch'](handleError(_0x531d1f,null));};exports['addSound']=function(_0x39e434,_0x40b9f2,_0x2da688){return db['sequelize'][_0x763f('0x48')](function(_0x70946a){var _0x418279;return db[_0x763f('0x29')][_0x763f('0x45')]({'where':{'id':_0x39e434[_0x763f('0x42')]['id']}})[_0x763f('0x20')](function(_0x586c08){if(_0x586c08){_0x418279=_0x586c08;return _0x586c08['addSound'](_0x39e434['body']['id'],{'transaction':_0x70946a});}})[_0x763f('0x20')](function(_0x2c8642){if(_0x2c8642){return db[_0x763f('0x5a')][_0x763f('0x5b')]({'where':{'id':_0x39e434['body']['id']},'attributes':['id',_0x763f('0x26'),_0x763f('0x5c'),_0x763f('0x5d'),_0x763f('0x5e')],'raw':!![]});}})['then'](function(_0x38d456){if(_0x38d456){var _0x5d4a86=path['join'](config['root'],_0x763f('0x5f'),util['format'](_0x763f('0x60'),path[_0x763f('0x61')](_0x38d456[_0x763f('0x5c')],path['extname'](_0x38d456[_0x763f('0x5c')])),_0x38d456[_0x763f('0x5d')]));var _0xe1d5e7=path['join'](config[_0x763f('0x62')],_0x763f('0x63'),_0x418279[_0x763f('0x26')],util['format']('%s.%s',_0x38d456[_0x763f('0x26')],_0x38d456[_0x763f('0x5d')]));fs[_0x763f('0x64')](_0x5d4a86,_0xe1d5e7);return _0x38d456;}})[_0x763f('0x41')](function(_0x4c74e8){throw new db[(_0x763f('0x57'))][(_0x763f('0x58'))](_0x4c74e8[_0x763f('0x59')]);});})[_0x763f('0x20')](handleEntityNotFound(_0x40b9f2,null))[_0x763f('0x20')](respondWithResult(_0x40b9f2,0xc9))[_0x763f('0x41')](handleError(_0x40b9f2,null));};exports[_0x763f('0x65')]=function(_0x5a637d,_0xf3574c,_0x5780ab){return db[_0x763f('0x47')]['transaction'](function(_0x4f3ca0){var _0x4e1dde;return db[_0x763f('0x29')][_0x763f('0x5b')]({'where':{'id':_0x5a637d[_0x763f('0x42')]['id']}})[_0x763f('0x20')](handleEntityNotFound(_0xf3574c,null))[_0x763f('0x20')](function(_0x4a1403){if(_0x4a1403){_0x4e1dde=_0x4a1403;return _0x4a1403[_0x763f('0x65')](_0x5a637d[_0x763f('0x42')]['id2']);}})[_0x763f('0x20')](function(_0x40e65f){if(_0x40e65f){return db[_0x763f('0x5a')]['findOne']({'where':{'id':_0x5a637d[_0x763f('0x42')]['id2']},'attributes':['id',_0x763f('0x26'),_0x763f('0x5c'),_0x763f('0x5d'),_0x763f('0x5e')],'raw':!![]});}})[_0x763f('0x20')](function(_0x2ee329){if(_0x2ee329){fs[_0x763f('0x56')](path[_0x763f('0x4b')](_0x4e1dde['directory'],util[_0x763f('0x66')]('%s.%s',_0x2ee329[_0x763f('0x26')],_0x2ee329[_0x763f('0x5d')])));return _0x2ee329;}})['catch'](function(_0x238a0e){throw new db[(_0x763f('0x57'))][(_0x763f('0x58'))](_0x238a0e[_0x763f('0x59')]);});})[_0x763f('0x20')](handleEntityNotFound(_0xf3574c,null))[_0x763f('0x20')](respondWithStatusCode(_0xf3574c,0xcc))['catch'](handleError(_0xf3574c,null));};exports[_0x763f('0x67')]=function(_0x172772,_0x394ad1,_0x32a209){var _0x9542a3={};var _0x216f02={};var _0x359dcd;var _0x4aa311;return db['VoiceMusicOnHold'][_0x763f('0x5b')]({'where':{'id':_0x172772['params']['id']}})[_0x763f('0x20')](handleEntityNotFound(_0x394ad1,null))[_0x763f('0x20')](function(_0x172973){if(_0x172973){_0x359dcd=_0x172973;_0x216f02[_0x763f('0x2b')]=_[_0x763f('0x2d')](db[_0x763f('0x5a')]['rawAttributes']);_0x216f02[_0x763f('0x2c')]=_[_0x763f('0x2d')](_0x172772[_0x763f('0x2c')]);_0x216f02[_0x763f('0x2e')]=_[_0x763f('0x2f')](_0x216f02['model'],_0x216f02[_0x763f('0x2c')]);_0x9542a3[_0x763f('0x30')]=_[_0x763f('0x2f')](_0x216f02[_0x763f('0x2b')],qs[_0x763f('0x31')](_0x172772['query'][_0x763f('0x31')]));_0x9542a3[_0x763f('0x30')]=_0x9542a3[_0x763f('0x30')][_0x763f('0x32')]?_0x9542a3[_0x763f('0x30')]:_0x216f02[_0x763f('0x2b')];_0x9542a3[_0x763f('0x34')]=qs[_0x763f('0x35')](_0x172772[_0x763f('0x2c')][_0x763f('0x35')]);_0x9542a3[_0x763f('0x38')]=qs[_0x763f('0x2e')](_[_0x763f('0x36')](_0x172772['query'],_0x216f02[_0x763f('0x2e')]));if(_0x172772[_0x763f('0x2c')][_0x763f('0x37')]){_0x9542a3[_0x763f('0x38')]=_['merge'](_0x9542a3[_0x763f('0x38')],{'$or':_['map'](_0x9542a3['attributes'],function(_0x5d1ad9){var _0x2ca5ab={};_0x2ca5ab[_0x5d1ad9]={'$like':'%'+_0x172772[_0x763f('0x2c')][_0x763f('0x37')]+'%'};return _0x2ca5ab;})});}_0x9542a3=_[_0x763f('0x39')]({},_0x9542a3,_0x172772[_0x763f('0x3d')]);return _0x359dcd['getSounds'](_0x9542a3);}})[_0x763f('0x20')](function(_0x5513a5){if(_0x5513a5){_0x4aa311=_0x5513a5[_0x763f('0x32')];if(!_0x172772[_0x763f('0x2c')][_0x763f('0x68')](_0x763f('0x33'))){_0x9542a3['limit']=qs[_0x763f('0x19')](_0x172772['query']['limit']);_0x9542a3[_0x763f('0x17')]=qs[_0x763f('0x17')](_0x172772[_0x763f('0x2c')][_0x763f('0x17')]);}return _0x359dcd[_0x763f('0x67')](_0x9542a3);}})['then'](function(_0x2fe493){if(_0x2fe493){return _0x2fe493?{'count':_0x4aa311,'rows':_0x2fe493}:null;}})[_0x763f('0x20')](respondWithResult(_0x394ad1,null))[_0x763f('0x41')](handleError(_0x394ad1,null));}; \ No newline at end of file +var _0x1e82=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','root','server/files/moh','symlinkSync','removeSound','params','id2','Sound','getSounds','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','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','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','index','map','VoiceMusicOnHold','fieldName','type','key','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','catch','merge','find','update','body','create','sequelize','transaction','mode','files','directory','join','mkdirSync','0777'];(function(_0x1fbf22,_0x4bbaf4){var _0x450b54=function(_0x107749){while(--_0x107749){_0x1fbf22['push'](_0x1fbf22['shift']());}};_0x450b54(++_0x4bbaf4);}(_0x1e82,0x1df));var _0x21e8=function(_0xbb4ea9,_0x306600){_0xbb4ea9=_0xbb4ea9-0x0;var _0x2a85c3=_0x1e82[_0xbb4ea9];return _0x2a85c3;};'use strict';var emlformat=require(_0x21e8('0x0'));var rimraf=require(_0x21e8('0x1'));var zipdir=require(_0x21e8('0x2'));var jsonpatch=require(_0x21e8('0x3'));var rp=require('request-promise');var moment=require(_0x21e8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x21e8('0x5'));var util=require(_0x21e8('0x6'));var path=require('path');var sox=require(_0x21e8('0x7'));var csv=require('to-csv');var ejs=require(_0x21e8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21e8('0x9'));var squel=require(_0x21e8('0xa'));var crypto=require(_0x21e8('0xb'));var jsforce=require(_0x21e8('0xc'));var deskjs=require(_0x21e8('0xd'));var toCsv=require(_0x21e8('0xe'));var querystring=require(_0x21e8('0xf'));var Papa=require(_0x21e8('0x10'));var Redis=require(_0x21e8('0x11'));var authService=require(_0x21e8('0x12'));var qs=require(_0x21e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21e8('0x14'));var logger=require(_0x21e8('0x15'))(_0x21e8('0x16'));var utils=require(_0x21e8('0x17'));var config=require(_0x21e8('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45fb36,_0x320ec2){_0x320ec2=_0x320ec2||0xcc;return function(_0x7e8aa9){if(_0x7e8aa9){return _0x45fb36[_0x21e8('0x19')](_0x320ec2);}return _0x45fb36['status'](_0x320ec2)[_0x21e8('0x1a')]();};}function respondWithResult(_0x8419cf,_0xc42726){_0xc42726=_0xc42726||0xc8;return function(_0x3caf3f){if(_0x3caf3f){return _0x8419cf[_0x21e8('0x1b')](_0xc42726)[_0x21e8('0x1c')](_0x3caf3f);}};}function respondWithFilteredResult(_0x1daa13,_0x1f1b9c){return function(_0x61e539){if(_0x61e539){var _0x265ea5=typeof _0x1f1b9c[_0x21e8('0x1d')]===_0x21e8('0x1e')&&typeof _0x1f1b9c[_0x21e8('0x1f')]===_0x21e8('0x1e');var _0x3e45a1=_0x61e539[_0x21e8('0x20')];var _0x43cc69=_0x265ea5?0x0:_0x1f1b9c['offset'];var _0x856ccc=_0x265ea5?_0x61e539[_0x21e8('0x20')]:_0x1f1b9c[_0x21e8('0x1d')]+_0x1f1b9c[_0x21e8('0x1f')];var _0x2f208c;if(_0x856ccc>=_0x3e45a1){_0x856ccc=_0x3e45a1;_0x2f208c=0xc8;}else{_0x2f208c=0xce;}_0x1daa13[_0x21e8('0x1b')](_0x2f208c);return _0x1daa13[_0x21e8('0x21')]('Content-Range',_0x43cc69+'-'+_0x856ccc+'/'+_0x3e45a1)[_0x21e8('0x1c')](_0x61e539);}return null;};}function patchUpdates(_0x156be3){return function(_0x496888){try{jsonpatch[_0x21e8('0x22')](_0x496888,_0x156be3,!![]);}catch(_0x419bb4){return BPromise[_0x21e8('0x23')](_0x419bb4);}return _0x496888[_0x21e8('0x24')]();};}function saveUpdates(_0x1e037f,_0x49aead){return function(_0x2bff24){if(_0x2bff24){return _0x2bff24['update'](_0x1e037f)[_0x21e8('0x25')](function(_0x4e72a8){return _0x4e72a8;});}return null;};}function removeEntity(_0x2924e6,_0xb92910){return function(_0x5a3e0b){if(_0x5a3e0b){return _0x5a3e0b[_0x21e8('0x26')]()[_0x21e8('0x25')](function(){var _0x4ab98c=_0x5a3e0b[_0x21e8('0x27')]({'plain':!![]});var _0x1bb2ad='MusicOnHolds';return db[_0x21e8('0x28')][_0x21e8('0x26')]({'where':{'type':_0x1bb2ad,'resourceId':_0x4ab98c['id']}})[_0x21e8('0x25')](function(){return _0x5a3e0b;});})[_0x21e8('0x25')](function(){_0x2924e6[_0x21e8('0x1b')](0xcc)[_0x21e8('0x1a')]();});}};}function handleEntityNotFound(_0x180fb8,_0x296412){return function(_0x42223c){if(!_0x42223c){_0x180fb8[_0x21e8('0x19')](0x194);}return _0x42223c;};}function handleError(_0x2d56a2,_0x2cd4d7){_0x2cd4d7=_0x2cd4d7||0x1f4;return function(_0x48730e){logger['error'](_0x48730e[_0x21e8('0x29')]);if(_0x48730e['name']){delete _0x48730e['name'];}_0x2d56a2[_0x21e8('0x1b')](_0x2cd4d7)['send'](_0x48730e);};}exports[_0x21e8('0x2a')]=function(_0x32db5b,_0x169289){var _0x1d01aa={},_0x1c6f54={},_0x38501a={'count':0x0,'rows':[]};var _0x5c8a2a=_[_0x21e8('0x2b')](db[_0x21e8('0x2c')]['rawAttributes'],function(_0x3f6a3c){return{'name':_0x3f6a3c[_0x21e8('0x2d')],'type':_0x3f6a3c[_0x21e8('0x2e')][_0x21e8('0x2f')]};});_0x1c6f54[_0x21e8('0x30')]=_[_0x21e8('0x2b')](_0x5c8a2a,_0x21e8('0x31'));_0x1c6f54['query']=_[_0x21e8('0x32')](_0x32db5b['query']);_0x1c6f54['filters']=_['intersection'](_0x1c6f54[_0x21e8('0x30')],_0x1c6f54[_0x21e8('0x33')]);_0x1d01aa['attributes']=_[_0x21e8('0x34')](_0x1c6f54[_0x21e8('0x30')],qs['fields'](_0x32db5b['query'][_0x21e8('0x35')]));_0x1d01aa[_0x21e8('0x36')]=_0x1d01aa[_0x21e8('0x36')][_0x21e8('0x37')]?_0x1d01aa['attributes']:_0x1c6f54[_0x21e8('0x30')];if(!_0x32db5b[_0x21e8('0x33')][_0x21e8('0x38')](_0x21e8('0x39'))){_0x1d01aa[_0x21e8('0x1f')]=qs['limit'](_0x32db5b[_0x21e8('0x33')][_0x21e8('0x1f')]);_0x1d01aa[_0x21e8('0x1d')]=qs[_0x21e8('0x1d')](_0x32db5b[_0x21e8('0x33')][_0x21e8('0x1d')]);}_0x1d01aa[_0x21e8('0x3a')]=qs[_0x21e8('0x3b')](_0x32db5b[_0x21e8('0x33')][_0x21e8('0x3b')]);delete _0x32db5b[_0x21e8('0x33')][_0x21e8('0x3b')];_0x1d01aa[_0x21e8('0x3c')]=qs[_0x21e8('0x3d')](_[_0x21e8('0x3e')](_0x32db5b[_0x21e8('0x33')],_0x1c6f54[_0x21e8('0x3d')]),_0x5c8a2a);if(_0x32db5b[_0x21e8('0x33')][_0x21e8('0x3f')]){_0x1d01aa[_0x21e8('0x3c')]=_['merge'](_0x1d01aa[_0x21e8('0x3c')],{'$or':_['map'](_0x5c8a2a,function(_0x3e86a5){if(_0x3e86a5['type']!==_0x21e8('0x40')){var _0x51b9ae={};_0x51b9ae[_0x3e86a5['name']]={'$like':'%'+_0x32db5b[_0x21e8('0x33')]['filter']+'%'};return _0x51b9ae;}})});}_0x1d01aa=_['merge']({},_0x1d01aa,_0x32db5b[_0x21e8('0x41')]);var _0x2bb0d1={'where':_0x1d01aa[_0x21e8('0x3c')]};return db[_0x21e8('0x2c')]['count'](_0x2bb0d1)[_0x21e8('0x25')](function(_0x185685){_0x38501a[_0x21e8('0x20')]=_0x185685;if(_0x32db5b[_0x21e8('0x33')]['includeAll']){_0x1d01aa[_0x21e8('0x42')]=[{'all':!![]}];}return db[_0x21e8('0x2c')]['findAll'](_0x1d01aa);})[_0x21e8('0x25')](function(_0x667036){_0x38501a['rows']=_0x667036;return _0x38501a;})[_0x21e8('0x25')](respondWithFilteredResult(_0x169289,_0x1d01aa))[_0x21e8('0x43')](handleError(_0x169289,null));};exports['show']=function(_0x1383d2,_0x53625d){var _0x3bff51={'raw':![],'where':{'id':_0x1383d2['params']['id']}},_0x142f5d={};_0x142f5d[_0x21e8('0x30')]=_[_0x21e8('0x32')](db[_0x21e8('0x2c')]['rawAttributes']);_0x142f5d['query']=_[_0x21e8('0x32')](_0x1383d2[_0x21e8('0x33')]);_0x142f5d[_0x21e8('0x3d')]=_[_0x21e8('0x34')](_0x142f5d[_0x21e8('0x30')],_0x142f5d[_0x21e8('0x33')]);_0x3bff51['attributes']=_['intersection'](_0x142f5d[_0x21e8('0x30')],qs[_0x21e8('0x35')](_0x1383d2['query'][_0x21e8('0x35')]));_0x3bff51['attributes']=_0x3bff51[_0x21e8('0x36')]['length']?_0x3bff51['attributes']:_0x142f5d[_0x21e8('0x30')];if(_0x1383d2[_0x21e8('0x33')]['includeAll']){_0x3bff51[_0x21e8('0x42')]=[{'all':!![]}];}_0x3bff51=_[_0x21e8('0x44')]({},_0x3bff51,_0x1383d2['options']);return db[_0x21e8('0x2c')][_0x21e8('0x45')](_0x3bff51)[_0x21e8('0x25')](handleEntityNotFound(_0x53625d,null))[_0x21e8('0x25')](respondWithResult(_0x53625d,null))['catch'](handleError(_0x53625d,null));};exports[_0x21e8('0x46')]=function(_0x4f1c7d,_0x5b53db){if(_0x4f1c7d[_0x21e8('0x47')]['id']){delete _0x4f1c7d[_0x21e8('0x47')]['id'];}return db[_0x21e8('0x2c')][_0x21e8('0x45')]({'where':{'id':_0x4f1c7d['params']['id']}})[_0x21e8('0x25')](handleEntityNotFound(_0x5b53db,null))[_0x21e8('0x25')](saveUpdates(_0x4f1c7d[_0x21e8('0x47')],null))[_0x21e8('0x25')](respondWithResult(_0x5b53db,null))['catch'](handleError(_0x5b53db,null));};exports[_0x21e8('0x48')]=function(_0x3e136b,_0x4e5877,_0x19cc64){return db[_0x21e8('0x49')][_0x21e8('0x4a')](function(_0x48a4b8){if(_0x3e136b[_0x21e8('0x47')][_0x21e8('0x4b')]===_0x21e8('0x4c')){_0x3e136b['body'][_0x21e8('0x4d')]=path[_0x21e8('0x4e')](config['root'],'server/files/moh',_0x3e136b[_0x21e8('0x47')]['name']);}return db[_0x21e8('0x2c')][_0x21e8('0x48')](_0x3e136b[_0x21e8('0x47')],{'transaction':_0x48a4b8})[_0x21e8('0x25')](function(_0x497c98){if(_0x3e136b['body']['mode']==='files'){fs[_0x21e8('0x4f')](_0x497c98['directory'],parseInt(_0x21e8('0x50'),0x8));}var _0x4a5da9=_0x3e136b[_0x21e8('0x51')][_0x21e8('0x27')]({'plain':!![]});if(!_0x4a5da9)throw new Error(_0x21e8('0x52'));if(_0x4a5da9['role']===_0x21e8('0x51')){var _0xca4daf=_0x497c98[_0x21e8('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x21e8('0x53'),'userProfileId':_0x4a5da9[_0x21e8('0x54')]},'raw':!![]})['then'](function(_0x47803f){if(_0x47803f&&_0x47803f[_0x21e8('0x55')]===0x0){return db[_0x21e8('0x28')][_0x21e8('0x48')]({'name':_0xca4daf[_0x21e8('0x31')],'resourceId':_0xca4daf['id'],'type':_0x47803f[_0x21e8('0x31')],'sectionId':_0x47803f['id']},{})[_0x21e8('0x25')](function(){return _0x497c98;});}else{return _0x497c98;}})[_0x21e8('0x43')](function(_0x425e1b){logger['error'](_0x21e8('0x56'),_0x425e1b);});}return _0x497c98;});})[_0x21e8('0x25')](respondWithResult(_0x4e5877,0xc9))[_0x21e8('0x43')](handleError(_0x4e5877,null));};exports[_0x21e8('0x26')]=function(_0x5db6ac,_0x44b697,_0x35eb61){var _0x4eb8f7;return db[_0x21e8('0x2c')][_0x21e8('0x45')]({'where':{'id':_0x5db6ac['params']['id']}})['then'](function(_0x1c0b3a){if(_0x1c0b3a){return db[_0x21e8('0x49')][_0x21e8('0x4a')](function(_0x46ffe1){return _0x1c0b3a[_0x21e8('0x26')]({'transaction':_0x46ffe1,'raw':!![]})[_0x21e8('0x25')](function(_0x339de8){if(_0x339de8['directory']){fs[_0x21e8('0x57')](_0x339de8[_0x21e8('0x4d')])[_0x21e8('0x58')](function(_0x21fabf){fs['unlinkSync'](path[_0x21e8('0x4e')](_0x339de8['directory'],_0x21fabf));});fs[_0x21e8('0x59')](_0x339de8[_0x21e8('0x4d')]);}return _0x339de8;});})['catch'](function(_0x3c6c3d){throw new db[(_0x21e8('0x5a'))][(_0x21e8('0x5b'))](_0x3c6c3d[_0x21e8('0x5c')]);});}})[_0x21e8('0x25')](handleEntityNotFound(_0x44b697,null))[_0x21e8('0x25')](removeEntity(_0x44b697,null))['catch'](handleError(_0x44b697,null));};exports['addSound']=function(_0x24c9a7,_0xd56893,_0x4d2028){return db[_0x21e8('0x49')][_0x21e8('0x4a')](function(_0x512d48){var _0x4cded9;return db['VoiceMusicOnHold'][_0x21e8('0x45')]({'where':{'id':_0x24c9a7['params']['id']}})[_0x21e8('0x25')](function(_0x5c7fc2){if(_0x5c7fc2){_0x4cded9=_0x5c7fc2;return _0x5c7fc2[_0x21e8('0x5d')](_0x24c9a7[_0x21e8('0x47')]['id'],{'transaction':_0x512d48});}})[_0x21e8('0x25')](function(_0x32d8be){if(_0x32d8be){return db['Sound'][_0x21e8('0x5e')]({'where':{'id':_0x24c9a7[_0x21e8('0x47')]['id']},'attributes':['id','name',_0x21e8('0x5f'),_0x21e8('0x60'),_0x21e8('0x61')],'raw':!![]});}})['then'](function(_0x2f558c){if(_0x2f558c){var _0x196a05=path[_0x21e8('0x4e')](config['root'],_0x21e8('0x62'),util[_0x21e8('0x63')](_0x21e8('0x64'),path[_0x21e8('0x65')](_0x2f558c[_0x21e8('0x5f')],path[_0x21e8('0x66')](_0x2f558c[_0x21e8('0x5f')])),_0x2f558c[_0x21e8('0x60')]));var _0x186071=path['join'](config[_0x21e8('0x67')],_0x21e8('0x68'),_0x4cded9[_0x21e8('0x31')],util['format'](_0x21e8('0x64'),_0x2f558c['name'],_0x2f558c[_0x21e8('0x60')]));fs[_0x21e8('0x69')](_0x196a05,_0x186071);return _0x2f558c;}})['catch'](function(_0x3be363){throw new db[(_0x21e8('0x5a'))][(_0x21e8('0x5b'))](_0x3be363[_0x21e8('0x5c')]);});})[_0x21e8('0x25')](handleEntityNotFound(_0xd56893,null))[_0x21e8('0x25')](respondWithResult(_0xd56893,0xc9))[_0x21e8('0x43')](handleError(_0xd56893,null));};exports[_0x21e8('0x6a')]=function(_0x90732c,_0x2877a1,_0x57678a){return db[_0x21e8('0x49')][_0x21e8('0x4a')](function(_0x12ac79){var _0xbc1ca6;return db[_0x21e8('0x2c')]['findOne']({'where':{'id':_0x90732c[_0x21e8('0x6b')]['id']}})[_0x21e8('0x25')](handleEntityNotFound(_0x2877a1,null))[_0x21e8('0x25')](function(_0x5431b3){if(_0x5431b3){_0xbc1ca6=_0x5431b3;return _0x5431b3[_0x21e8('0x6a')](_0x90732c[_0x21e8('0x6b')][_0x21e8('0x6c')]);}})[_0x21e8('0x25')](function(_0x96b547){if(_0x96b547){return db[_0x21e8('0x6d')][_0x21e8('0x5e')]({'where':{'id':_0x90732c[_0x21e8('0x6b')][_0x21e8('0x6c')]},'attributes':['id','name',_0x21e8('0x5f'),'converted_format',_0x21e8('0x61')],'raw':!![]});}})[_0x21e8('0x25')](function(_0x159ff4){if(_0x159ff4){fs['unlinkSync'](path[_0x21e8('0x4e')](_0xbc1ca6[_0x21e8('0x4d')],util['format'](_0x21e8('0x64'),_0x159ff4['name'],_0x159ff4['converted_format'])));return _0x159ff4;}})[_0x21e8('0x43')](function(_0x242dd1){throw new db[(_0x21e8('0x5a'))][(_0x21e8('0x5b'))](_0x242dd1[_0x21e8('0x5c')]);});})[_0x21e8('0x25')](handleEntityNotFound(_0x2877a1,null))['then'](respondWithStatusCode(_0x2877a1,0xcc))['catch'](handleError(_0x2877a1,null));};exports[_0x21e8('0x6e')]=function(_0x2a491c,_0x77c9d5,_0x445f15){var _0x2432f5={};var _0x4fd574={};var _0x5bf72c;var _0xe664ee;return db[_0x21e8('0x2c')][_0x21e8('0x5e')]({'where':{'id':_0x2a491c[_0x21e8('0x6b')]['id']}})[_0x21e8('0x25')](handleEntityNotFound(_0x77c9d5,null))['then'](function(_0x17de5c){if(_0x17de5c){_0x5bf72c=_0x17de5c;_0x4fd574[_0x21e8('0x30')]=_[_0x21e8('0x32')](db[_0x21e8('0x6d')][_0x21e8('0x6f')]);_0x4fd574[_0x21e8('0x33')]=_[_0x21e8('0x32')](_0x2a491c[_0x21e8('0x33')]);_0x4fd574['filters']=_['intersection'](_0x4fd574[_0x21e8('0x30')],_0x4fd574['query']);_0x2432f5[_0x21e8('0x36')]=_[_0x21e8('0x34')](_0x4fd574[_0x21e8('0x30')],qs[_0x21e8('0x35')](_0x2a491c[_0x21e8('0x33')][_0x21e8('0x35')]));_0x2432f5['attributes']=_0x2432f5[_0x21e8('0x36')][_0x21e8('0x37')]?_0x2432f5[_0x21e8('0x36')]:_0x4fd574[_0x21e8('0x30')];_0x2432f5[_0x21e8('0x3a')]=qs[_0x21e8('0x3b')](_0x2a491c['query'][_0x21e8('0x3b')]);_0x2432f5[_0x21e8('0x3c')]=qs['filters'](_[_0x21e8('0x3e')](_0x2a491c[_0x21e8('0x33')],_0x4fd574[_0x21e8('0x3d')]));if(_0x2a491c['query']['filter']){_0x2432f5[_0x21e8('0x3c')]=_[_0x21e8('0x44')](_0x2432f5[_0x21e8('0x3c')],{'$or':_[_0x21e8('0x2b')](_0x2432f5['attributes'],function(_0x13b3d6){var _0x3ea0c4={};_0x3ea0c4[_0x13b3d6]={'$like':'%'+_0x2a491c[_0x21e8('0x33')][_0x21e8('0x3f')]+'%'};return _0x3ea0c4;})});}_0x2432f5=_[_0x21e8('0x44')]({},_0x2432f5,_0x2a491c[_0x21e8('0x41')]);return _0x5bf72c[_0x21e8('0x6e')](_0x2432f5);}})[_0x21e8('0x25')](function(_0x51ae09){if(_0x51ae09){_0xe664ee=_0x51ae09[_0x21e8('0x37')];if(!_0x2a491c[_0x21e8('0x33')][_0x21e8('0x38')](_0x21e8('0x39'))){_0x2432f5[_0x21e8('0x1f')]=qs[_0x21e8('0x1f')](_0x2a491c[_0x21e8('0x33')]['limit']);_0x2432f5['offset']=qs[_0x21e8('0x1d')](_0x2a491c[_0x21e8('0x33')][_0x21e8('0x1d')]);}return _0x5bf72c[_0x21e8('0x6e')](_0x2432f5);}})[_0x21e8('0x25')](function(_0x1ec5fa){if(_0x1ec5fa){return _0x1ec5fa?{'count':_0xe664ee,'rows':_0x1ec5fa}:null;}})[_0x21e8('0x25')](respondWithResult(_0x77c9d5,null))[_0x21e8('0x43')](handleError(_0x77c9d5,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index e46d4ac..40e86a3 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 _0x9eda=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0x9eda,0x104));var _0xa9ed=function(_0x30f987,_0x1a889b){_0x30f987=_0x30f987-0x0;var _0x52565a=_0x9eda[_0x30f987];return _0x52565a;};'use strict';var _=require('lodash');var util=require(_0xa9ed('0x0'));var logger=require(_0xa9ed('0x1'))(_0xa9ed('0x2'));var moment=require(_0xa9ed('0x3'));var BPromise=require(_0xa9ed('0x4'));var rp=require(_0xa9ed('0x5'));var fs=require('fs');var path=require(_0xa9ed('0x6'));var rimraf=require(_0xa9ed('0x7'));var config=require(_0xa9ed('0x8'));var attributes=require(_0xa9ed('0x9'));module[_0xa9ed('0xa')]=function(_0x27c804,_0x21bbca){return _0x27c804[_0xa9ed('0xb')](_0xa9ed('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11b0=['VoiceMusicOnHold','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x11b0,0x1ae));var _0x011b=function(_0x2c67e9,_0xc17cf5){_0x2c67e9=_0x2c67e9-0x0;var _0x2680b5=_0x11b0[_0x2c67e9];return _0x2680b5;};'use strict';var _=require('lodash');var util=require(_0x011b('0x0'));var logger=require(_0x011b('0x1'))(_0x011b('0x2'));var moment=require(_0x011b('0x3'));var BPromise=require(_0x011b('0x4'));var rp=require(_0x011b('0x5'));var fs=require('fs');var path=require(_0x011b('0x6'));var rimraf=require(_0x011b('0x7'));var config=require(_0x011b('0x8'));var attributes=require(_0x011b('0x9'));module[_0x011b('0xa')]=function(_0x108061,_0xb6a71f){return _0x108061[_0x011b('0xb')](_0x011b('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 67c6612..4eb0a3d 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x35c8f9,_0x3a2ee0){var _0x45d41d=function(_0x4dc745){while(--_0x4dc745){_0x35c8f9['push'](_0x35c8f9['shift']());}};_0x45d41d(++_0x3a2ee0);}(_0x70e0,0x17b));var _0x070e=function(_0xd748b4,_0x589904){_0xd748b4=_0xd748b4-0x0;var _0x2ca248=_0x70e0[_0xd748b4];return _0x2ca248;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x380344,_0x3b87c5){var _0x1b8a03=function(_0xdc1a20){while(--_0xdc1a20){_0x380344['push'](_0x380344['shift']());}};_0x1b8a03(++_0x3b87c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index ce1885b..bed2394 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 _0x4c9e=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','get','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','update','delete','destroy','removeAgents','exports'];(function(_0x532430,_0xc518df){var _0x188423=function(_0x576009){while(--_0x576009){_0x532430['push'](_0x532430['shift']());}};_0x188423(++_0xc518df);}(_0x4c9e,0x145));var _0xe4c9=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x4c9e[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require('multer');var util=require(_0xe4c9('0x0'));var path=require(_0xe4c9('0x1'));var timeout=require(_0xe4c9('0x2'));var express=require(_0xe4c9('0x3'));var router=express[_0xe4c9('0x4')]();var fs_extra=require(_0xe4c9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe4c9('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c9('0x7'));router['get']('/',auth[_0xe4c9('0x8')](),controller['index']);router[_0xe4c9('0x9')](_0xe4c9('0xa'),auth['isAuthenticated'](),controller[_0xe4c9('0xb')]);router['get'](_0xe4c9('0xc'),auth[_0xe4c9('0x8')](),controller['show']);router[_0xe4c9('0x9')](_0xe4c9('0xd'),auth[_0xe4c9('0x8')](),controller[_0xe4c9('0xe')]);router[_0xe4c9('0x9')](_0xe4c9('0xf'),auth[_0xe4c9('0x8')](),controller[_0xe4c9('0x10')]);router[_0xe4c9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe4c9('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xe4c9('0x12')]);router[_0xe4c9('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe4c9('0x13')]);router['put'](_0xe4c9('0xc'),auth[_0xe4c9('0x8')](),controller[_0xe4c9('0x14')]);router[_0xe4c9('0x15')](_0xe4c9('0xc'),auth[_0xe4c9('0x8')](),controller[_0xe4c9('0x16')]);router[_0xe4c9('0x15')](_0xe4c9('0xd'),auth['isAuthenticated'](),controller[_0xe4c9('0x17')]);router[_0xe4c9('0x15')](_0xe4c9('0xf'),auth[_0xe4c9('0x8')](),controller['removeTeams']);module[_0xe4c9('0x18')]=router; \ No newline at end of file +var _0x34e2=['delete','destroy','/:id/users','removeAgents','removeTeams','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put'];(function(_0x3c7b22,_0x9dff45){var _0x3528cb=function(_0x2786a2){while(--_0x2786a2){_0x3c7b22['push'](_0x3c7b22['shift']());}};_0x3528cb(++_0x9dff45);}(_0x34e2,0x126));var _0x234e=function(_0x3300d2,_0x109746){_0x3300d2=_0x3300d2-0x0;var _0x368318=_0x34e2[_0x3300d2];return _0x368318;};'use strict';var multer=require(_0x234e('0x0'));var util=require('util');var path=require(_0x234e('0x1'));var timeout=require(_0x234e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x234e('0x3'));var interaction=require(_0x234e('0x4'));var config=require(_0x234e('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x234e('0x6')](),controller['index']);router[_0x234e('0x7')](_0x234e('0x8'),auth[_0x234e('0x6')](),controller[_0x234e('0x9')]);router[_0x234e('0x7')](_0x234e('0xa'),auth[_0x234e('0x6')](),controller['show']);router[_0x234e('0x7')]('/:id/users',auth[_0x234e('0x6')](),controller[_0x234e('0xb')]);router[_0x234e('0x7')](_0x234e('0xc'),auth[_0x234e('0x6')](),controller[_0x234e('0xd')]);router[_0x234e('0xe')]('/',auth[_0x234e('0x6')](),controller['create']);router['post']('/:id/users',auth[_0x234e('0x6')](),controller[_0x234e('0xf')]);router[_0x234e('0xe')](_0x234e('0xc'),auth['isAuthenticated'](),controller[_0x234e('0x10')]);router[_0x234e('0x11')](_0x234e('0xa'),auth[_0x234e('0x6')](),controller['update']);router[_0x234e('0x12')](_0x234e('0xa'),auth[_0x234e('0x6')](),controller[_0x234e('0x13')]);router[_0x234e('0x12')](_0x234e('0x14'),auth[_0x234e('0x6')](),controller[_0x234e('0x15')]);router[_0x234e('0x12')](_0x234e('0xc'),auth[_0x234e('0x6')](),controller[_0x234e('0x16')]);module[_0x234e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 945d3fe..021eb16 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 _0x3518=['STRING','name','VIRTUAL','getDataValue','INTEGER','sequelize','exports'];(function(_0x5588a9,_0x2837f6){var _0x378ca6=function(_0x4fc31b){while(--_0x4fc31b){_0x5588a9['push'](_0x5588a9['shift']());}};_0x378ca6(++_0x2837f6);}(_0x3518,0x12b));var _0x8351=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x3518[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x8351('0x0'));module[_0x8351('0x1')]={'name':{'type':Sequelize[_0x8351('0x2')],'allowNull':![],'unique':_0x8351('0x3')},'prefix':{'type':Sequelize[_0x8351('0x4')],'get':function(_0x9ab4b1){return'system-'+this[_0x8351('0x5')](_0x8351('0x3'))+'-';}},'description':{'type':Sequelize[_0x8351('0x2')]},'callerIdAll':{'type':Sequelize[_0x8351('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x8351('0x6')]}}; \ No newline at end of file +var _0x5acd=['exports','STRING','name','INTEGER'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5acd,0x154));var _0xd5ac=function(_0x1db0eb,_0x2df21b){_0x1db0eb=_0x1db0eb-0x0;var _0xaed4b4=_0x5acd[_0x1db0eb];return _0xaed4b4;};'use strict';var Sequelize=require('sequelize');module[_0xd5ac('0x0')]={'name':{'type':Sequelize[_0xd5ac('0x1')],'allowNull':![],'unique':_0xd5ac('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x34dbdd){return'system-'+this['getDataValue'](_0xd5ac('0x2'))+'-';}},'description':{'type':Sequelize[_0xd5ac('0x1')]},'callerIdAll':{'type':Sequelize[_0xd5ac('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xd5ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9ea9848..64a1fd2 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 _0x373d=['team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','omit','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','userVoicePrefix:save','field','tq.TeamId','from'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x373d,0x1e2));var _0xd373=function(_0x4f83ea,_0x4b484e){_0x4f83ea=_0x4f83ea-0x0;var _0x3e41f6=_0x373d[_0x4f83ea];return _0x3e41f6;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);function respondWithStatusCode(_0x23ed86,_0x28b2bf){_0x28b2bf=_0x28b2bf||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x23ed86[_0xd373('0x19')](_0x28b2bf);}return _0x23ed86[_0xd373('0x1a')](_0x28b2bf)[_0xd373('0x1b')]();};}function respondWithResult(_0x2c5854,_0x3a5316){_0x3a5316=_0x3a5316||0xc8;return function(_0x263ae3){if(_0x263ae3){return _0x2c5854[_0xd373('0x1a')](_0x3a5316)['json'](_0x263ae3);}};}function respondWithFilteredResult(_0x1e26cf,_0x5eab00){return function(_0x460259){if(_0x460259){var _0x36d47a=typeof _0x5eab00['offset']===_0xd373('0x1c')&&typeof _0x5eab00['limit']==='undefined';var _0x23fada=_0x460259[_0xd373('0x1d')];var _0x167597=_0x36d47a?0x0:_0x5eab00[_0xd373('0x1e')];var _0x16b147=_0x36d47a?_0x460259[_0xd373('0x1d')]:_0x5eab00['offset']+_0x5eab00[_0xd373('0x1f')];var _0xd808f8;if(_0x16b147>=_0x23fada){_0x16b147=_0x23fada;_0xd808f8=0xc8;}else{_0xd808f8=0xce;}_0x1e26cf[_0xd373('0x1a')](_0xd808f8);return _0x1e26cf[_0xd373('0x20')](_0xd373('0x21'),_0x167597+'-'+_0x16b147+'/'+_0x23fada)[_0xd373('0x22')](_0x460259);}return null;};}function patchUpdates(_0x4f64bd){return function(_0x355fca){try{jsonpatch[_0xd373('0x23')](_0x355fca,_0x4f64bd,!![]);}catch(_0x157f81){return BPromise[_0xd373('0x24')](_0x157f81);}return _0x355fca[_0xd373('0x25')]();};}function saveUpdates(_0x238ffd,_0x466a03){return function(_0x109e4c){if(_0x109e4c){return _0x109e4c[_0xd373('0x26')](_0x238ffd)[_0xd373('0x27')](function(_0x437110){return _0x437110;});}return null;};}function removeEntity(_0x34f05a,_0x388182){return function(_0x420a30){if(_0x420a30){return _0x420a30[_0xd373('0x28')]()[_0xd373('0x27')](function(){var _0x50b987=_0x420a30[_0xd373('0x29')]({'plain':!![]});var _0x3e657b=_0xd373('0x2a');return db[_0xd373('0x2b')][_0xd373('0x28')]({'where':{'type':_0x3e657b,'resourceId':_0x50b987['id']}})[_0xd373('0x27')](function(){return _0x420a30;});})[_0xd373('0x27')](function(){_0x34f05a[_0xd373('0x1a')](0xcc)[_0xd373('0x1b')]();});}};}function handleEntityNotFound(_0x158825,_0xbc420b){return function(_0x2ee37c){if(!_0x2ee37c){_0x158825[_0xd373('0x19')](0x194);}return _0x2ee37c;};}function handleError(_0x5287e7,_0x7ca56e){_0x7ca56e=_0x7ca56e||0x1f4;return function(_0x490842){logger['error'](_0x490842[_0xd373('0x2c')]);if(_0x490842[_0xd373('0x2d')]){delete _0x490842[_0xd373('0x2d')];}_0x5287e7[_0xd373('0x1a')](_0x7ca56e)[_0xd373('0x2e')](_0x490842);};}exports['index']=function(_0x6659f6,_0x104156){var _0x4e17c9={},_0x102c3a={},_0x8e4884={'count':0x0,'rows':[]};var _0x146e24=_[_0xd373('0x2f')](db[_0xd373('0x30')][_0xd373('0x31')],function(_0x364c01){return{'name':_0x364c01[_0xd373('0x32')],'type':_0x364c01[_0xd373('0x33')]['key']};});_0x102c3a[_0xd373('0x34')]=_[_0xd373('0x2f')](_0x146e24,_0xd373('0x2d'));_0x102c3a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x6659f6[_0xd373('0x35')]);_0x102c3a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],_0x102c3a[_0xd373('0x35')]);_0x4e17c9[_0xd373('0x39')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x6659f6[_0xd373('0x35')]['fields']));_0x4e17c9[_0xd373('0x39')]=_0x4e17c9[_0xd373('0x39')][_0xd373('0x3b')]?_0x4e17c9[_0xd373('0x39')]:_0x102c3a['model'];if(!_0x6659f6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x4e17c9[_0xd373('0x1f')]=qs[_0xd373('0x1f')](_0x6659f6[_0xd373('0x35')]['limit']);_0x4e17c9['offset']=qs[_0xd373('0x1e')](_0x6659f6['query'][_0xd373('0x1e')]);}_0x4e17c9[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x6659f6['query'][_0xd373('0x3f')]);_0x4e17c9[_0xd373('0x40')]=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0x6659f6['query'],_0x102c3a['filters']),_0x146e24);if(_0x6659f6['query'][_0xd373('0x42')]){_0x4e17c9['where']=_[_0xd373('0x43')](_0x4e17c9[_0xd373('0x40')],{'$or':_['map'](_0x146e24,function(_0x4e8734){if(_0x4e8734['type']!==_0xd373('0x44')){var _0x43a4b8={};_0x43a4b8[_0x4e8734[_0xd373('0x2d')]]={'$like':'%'+_0x6659f6['query']['filter']+'%'};return _0x43a4b8;}})});}_0x4e17c9=_[_0xd373('0x43')]({},_0x4e17c9,_0x6659f6[_0xd373('0x45')]);var _0x51efee={'where':_0x4e17c9[_0xd373('0x40')]};return db[_0xd373('0x30')][_0xd373('0x1d')](_0x51efee)[_0xd373('0x27')](function(_0x2d8c7d){_0x8e4884['count']=_0x2d8c7d;if(_0x6659f6['query'][_0xd373('0x46')]){_0x4e17c9[_0xd373('0x47')]=[{'all':!![]}];}return db[_0xd373('0x30')][_0xd373('0x48')](_0x4e17c9);})['then'](function(_0x29725c){_0x8e4884['rows']=_0x29725c;return _0x8e4884;})[_0xd373('0x27')](respondWithFilteredResult(_0x104156,_0x4e17c9))[_0xd373('0x49')](handleError(_0x104156,null));};exports[_0xd373('0x4a')]=function(_0xfb2922,_0x15cd1f){var _0x54afd4={'raw':![],'where':{'id':_0xfb2922[_0xd373('0x4b')]['id']}},_0x42744d={};_0x42744d['model']=_[_0xd373('0x36')](db[_0xd373('0x30')][_0xd373('0x31')]);_0x42744d[_0xd373('0x35')]=_[_0xd373('0x36')](_0xfb2922[_0xd373('0x35')]);_0x42744d[_0xd373('0x37')]=_[_0xd373('0x38')](_0x42744d[_0xd373('0x34')],_0x42744d[_0xd373('0x35')]);_0x54afd4['attributes']=_['intersection'](_0x42744d[_0xd373('0x34')],qs['fields'](_0xfb2922[_0xd373('0x35')]['fields']));_0x54afd4['attributes']=_0x54afd4['attributes'][_0xd373('0x3b')]?_0x54afd4[_0xd373('0x39')]:_0x42744d[_0xd373('0x34')];if(_0xfb2922[_0xd373('0x35')][_0xd373('0x46')]){_0x54afd4[_0xd373('0x47')]=[{'all':!![]}];}_0x54afd4=_[_0xd373('0x43')]({},_0x54afd4,_0xfb2922['options']);return db[_0xd373('0x30')]['find'](_0x54afd4)[_0xd373('0x27')](handleEntityNotFound(_0x15cd1f,null))[_0xd373('0x27')](respondWithResult(_0x15cd1f,null))['catch'](handleError(_0x15cd1f,null));};exports[_0xd373('0x28')]=function(_0x5ca39c,_0x46a582){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x5ca39c[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x46a582,null))['then'](removeEntity(_0x46a582,null))['catch'](handleError(_0x46a582,null));};exports['describe']=function(_0x3a2192,_0x384e23){return db['VoicePrefix'][_0xd373('0x4d')]()[_0xd373('0x27')](respondWithResult(_0x384e23,null))['catch'](handleError(_0x384e23,null));};exports[_0xd373('0x4e')]=function(_0xb6b583,_0x102101){var _0x473af2;return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0xc255ec){return db[_0xd373('0x30')][_0xd373('0x4e')](_0xb6b583[_0xd373('0x51')],{'transaction':_0xc255ec})[_0xd373('0x27')](function(_0x5b88ea){_0x473af2=_0x5b88ea['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x473af2['VoiceExtensionId']},'raw':!![]})['then'](function(_0x409246){return createVoicePrefixExtensions(_0x473af2,_0x409246,_0xc255ec);});});})[_0xd373('0x27')](function(){var _0x5b2ae9=_0xb6b583['user']['get']({'plain':!![]});if(!_0x5b2ae9)throw new Error(_0xd373('0x52'));if(_0x5b2ae9[_0xd373('0x53')]==='user'){var _0x52fa5b=_0x473af2;return db[_0xd373('0x54')][_0xd373('0x4c')]({'where':{'name':_0xd373('0x2a'),'userProfileId':_0x5b2ae9[_0xd373('0x55')]},'raw':!![]})[_0xd373('0x27')](function(_0x59da03){if(_0x59da03&&_0x59da03[_0xd373('0x56')]===0x0){return db[_0xd373('0x2b')][_0xd373('0x4e')]({'name':_0x52fa5b[_0xd373('0x2d')],'resourceId':_0x52fa5b['id'],'type':_0x59da03[_0xd373('0x2d')],'sectionId':_0x59da03['id']},{})[_0xd373('0x27')](function(){return _0x473af2;});}else{return _0x473af2;}})[_0xd373('0x49')](function(_0x2e4298){logger[_0xd373('0x57')](_0xd373('0x58'),_0x2e4298);throw _0x2e4298;});}return _0x473af2;})[_0xd373('0x27')](respondWithResult(_0x102101,null))[_0xd373('0x49')](handleError(_0x102101,null));};function Extension(_0x213b3c,_0x42e45d,_0x13f139,_0x4cb143){this[_0xd373('0x59')]=_0xd373('0x5a');this[_0xd373('0x5b')]=_0x213b3c;this['app']=_0x13f139;this[_0xd373('0x33')]='system';this[_0xd373('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd373('0x5d')]=_0x42e45d;this[_0xd373('0x5e')]=_0x4cb143;}function createVoicePrefixExtensions(_0x427f68,_0x19924a,_0x41c327){return new BPromise(function(_0x1ac620,_0xa47b76){var _0xaaf7fa=new Extension(formatPrefixName(_0x427f68[_0xd373('0x5f')]),0x1,_0xd373('0x60'),_0xd373('0x61'));_0xaaf7fa[_0xd373('0x62')]=_0x427f68['id'];return db[_0xd373('0x63')][_0xd373('0x4e')](_0xaaf7fa,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x2e7edb){var _0x1379e5=_0x2e7edb[_0xd373('0x29')]({'plain':!![]});var _0x209e76=_[_0xd373('0x2f')](addVoicePrefixExtensions(_0x427f68,_0x19924a),function(_0x295e09){_0x295e09[_0xd373('0x64')]=_0x1379e5['id'];_0x295e09[_0xd373('0x62')]=_0x427f68['id'];return _0x295e09;});return db[_0xd373('0x63')][_0xd373('0x65')](_0x209e76,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x547a8a){if(!_0x547a8a){return _0xa47b76(_0xd373('0x66'));}else{return _0x1ac620(_0x547a8a);}})[_0xd373('0x49')](function(_0x5fdc16){return _0xa47b76(_0x5fdc16);});});;});};function addVoicePrefixExtensions(_0x4a7d01,_0x38068a){var _0x2d9019=[];var _0x33320c=formatPrefixName(_0x4a7d01[_0xd373('0x5f')]);_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x2,_0xd373('0x68'),_0xd373('0x69')+_0x4a7d01['name']));if(_0x4a7d01[_0xd373('0x6a')]){_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x68'),_0xd373('0x6b')+_0x4a7d01[_0xd373('0x6a')]));}else{_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x60'),_0xd373('0x6c')));}_0x2d9019['push'](new Extension(_0x33320c,0x4,_0xd373('0x6d'),_0x38068a['context']+','+_0xd373('0x6e')+(0x8+_0x4a7d01[_0xd373('0x2d')][_0xd373('0x3b')])+'}'+','+0x1));return _0x2d9019;}function formatPrefixName(_0x2a9582){var _0x36e7cc='_';for(var _0x32c044=0x0;_0x32c044<_0x2a9582[_0xd373('0x3b')];_0x32c044++){if(_0x2a9582[_0xd373('0x6f')](_0x32c044)=='-'){_0x36e7cc+=_0x2a9582['charAt'](_0x32c044);}else{_0x36e7cc+='['+_0x2a9582[_0xd373('0x6f')](_0x32c044)+']';}}_0x36e7cc+='.';return _0x36e7cc;}exports['update']=function(_0x40f5ad,_0x27fcbe,_0x310a65){var _0x3ce679=_0x40f5ad[_0xd373('0x51')];_0x3ce679[_0xd373('0x5f')]=_0xd373('0x70')+_0x3ce679['name']+'-';return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x3d375d){return db['VoicePrefix'][_0xd373('0x26')](_0x3ce679,{'where':{'id':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x28')]({'where':{'VoicePrefixId':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x4c')]({'where':{'id':_0x3ce679[_0xd373('0x64')]},'raw':!![]})[_0xd373('0x27')](function(_0x727541){return createVoicePrefixExtensions(_0x3ce679,_0x727541,_0x3d375d);});});});})[_0xd373('0x27')](function(){return db[_0xd373('0x30')]['findById'](_0x3ce679['id']);})[_0xd373('0x27')](respondWithResult(_0x27fcbe,null))[_0xd373('0x49')](handleError(_0x27fcbe,null));};exports[_0xd373('0x71')]=function(_0x506f49,_0x377147,_0x365028){return db[_0xd373('0x30')]['find']({'where':{'id':_0x506f49[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x377147,null))[_0xd373('0x27')](function(_0x26821a){if(_0x26821a){return _0x26821a[_0xd373('0x71')](_0x506f49[_0xd373('0x51')]['ids'],_[_0xd373('0x72')](_0x506f49['body'],[_0xd373('0x73'),'id'])||{})[_0xd373('0x74')](function(_0x140ec4){for(var _0xb658db=0x0;_0xb658db<_0x506f49[_0xd373('0x51')][_0xd373('0x73')]['length'];_0xb658db+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x506f49[_0xd373('0x51')]['ids'][_0xb658db]),'VoicePrefixId':Number(_0x506f49['params']['id'])});}return _0x140ec4;});}})[_0xd373('0x27')](respondWithResult(_0x377147,null))[_0xd373('0x49')](handleError(_0x377147,null));};exports[_0xd373('0x76')]=function(_0x32b739,_0x5a5651,_0x546a07){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x32b739[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5a5651,null))[_0xd373('0x27')](function(_0x1a30eb){if(_0x1a30eb){return _0x1a30eb[_0xd373('0x76')](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])[_0xd373('0x27')](function(){if(_['isArray'](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])){for(var _0x1576e5=0x0;_0x1576e5<_0x32b739[_0xd373('0x35')][_0xd373('0x73')][_0xd373('0x3b')];_0x1576e5+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x32b739[_0xd373('0x35')]['ids'][_0x1576e5]),'VoicePrefixId':Number(_0x32b739['params']['id'])});}}else{socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':Number(_0x32b739[_0xd373('0x35')][_0xd373('0x73')]),'VoicePrefixId':Number(_0x32b739[_0xd373('0x4b')]['id'])});}});}})[_0xd373('0x27')](respondWithStatusCode(_0x5a5651,null))['catch'](handleError(_0x5a5651,null));};exports[_0xd373('0x78')]=function(_0x19eb94,_0x6114a5,_0x52ab87){var _0x467ac8={};var _0x2c543a={};var _0x1a5666;var _0x47ae4c;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0x19eb94[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6114a5,null))[_0xd373('0x27')](function(_0x288295){if(_0x288295){_0x1a5666=_0x288295;_0x2c543a[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7a')][_0xd373('0x31')]);_0x2c543a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x19eb94[_0xd373('0x35')]);_0x2c543a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],_0x2c543a[_0xd373('0x35')]);_0x467ac8['attributes']=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x19eb94['query'][_0xd373('0x3a')]));_0x467ac8[_0xd373('0x39')]=_0x467ac8['attributes'][_0xd373('0x3b')]?_0x467ac8['attributes']:_0x2c543a[_0xd373('0x34')];_0x467ac8[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x19eb94[_0xd373('0x35')][_0xd373('0x3f')]);_0x467ac8[_0xd373('0x40')]=qs['filters'](_[_0xd373('0x41')](_0x19eb94['query'],_0x2c543a[_0xd373('0x37')]));if(_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]){_0x467ac8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x467ac8['where'],{'$or':_[_0xd373('0x2f')](_0x467ac8[_0xd373('0x39')],function(_0x232b78){var _0x12ffc0={};_0x12ffc0[_0x232b78]={'$like':'%'+_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]+'%'};return _0x12ffc0;})});}_0x467ac8=_['merge']({},_0x467ac8,_0x19eb94[_0xd373('0x45')]);return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})[_0xd373('0x27')](function(_0x4b32b6){if(_0x4b32b6){_0x47ae4c=_0x4b32b6[_0xd373('0x3b')];if(!_0x19eb94[_0xd373('0x35')]['hasOwnProperty'](_0xd373('0x3d'))){_0x467ac8['limit']=qs[_0xd373('0x1f')](_0x19eb94['query']['limit']);_0x467ac8[_0xd373('0x1e')]=qs[_0xd373('0x1e')](_0x19eb94[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})['then'](function(_0x3ae4c8){if(_0x3ae4c8){return _0x3ae4c8?{'count':_0x47ae4c,'rows':_0x3ae4c8}:null;}})['then'](respondWithResult(_0x6114a5,null))[_0xd373('0x49')](handleError(_0x6114a5,null));};exports[_0xd373('0x7b')]=function(_0xc8f4e6,_0x5c951e,_0x113671){var _0x5621d8={};var _0x30549e={};var _0x633ba0;var _0xa854a2;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0xc8f4e6['params']['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5c951e,null))[_0xd373('0x27')](function(_0x39327f){if(_0x39327f){_0x633ba0=_0x39327f;_0x30549e[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7c')][_0xd373('0x31')]);_0x30549e['query']=_[_0xd373('0x36')](_0xc8f4e6[_0xd373('0x35')]);_0x30549e[_0xd373('0x37')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],_0x30549e[_0xd373('0x35')]);_0x5621d8[_0xd373('0x39')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],qs[_0xd373('0x3a')](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3a')]));_0x5621d8[_0xd373('0x39')]=_0x5621d8[_0xd373('0x39')][_0xd373('0x3b')]?_0x5621d8[_0xd373('0x39')]:_0x30549e[_0xd373('0x34')];_0x5621d8['order']=qs[_0xd373('0x3f')](_0xc8f4e6[_0xd373('0x35')]['sort']);_0x5621d8['where']=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0xc8f4e6['query'],_0x30549e[_0xd373('0x37')]));if(_0xc8f4e6[_0xd373('0x35')][_0xd373('0x42')]){_0x5621d8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x5621d8[_0xd373('0x40')],{'$or':_[_0xd373('0x2f')](_0x5621d8[_0xd373('0x39')],function(_0x3cc904){var _0x6e6c7e={};_0x6e6c7e[_0x3cc904]={'$like':'%'+_0xc8f4e6[_0xd373('0x35')]['filter']+'%'};return _0x6e6c7e;})});}_0x5621d8=_['merge']({},_0x5621d8,_0xc8f4e6[_0xd373('0x45')]);return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x3785b7){if(_0x3785b7){_0xa854a2=_0x3785b7[_0xd373('0x3b')];if(!_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x5621d8[_0xd373('0x1f')]=qs['limit'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1f')]);_0x5621d8[_0xd373('0x1e')]=qs['offset'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x6463cd){if(_0x6463cd){return _0x6463cd?{'count':_0xa854a2,'rows':_0x6463cd}:null;}})[_0xd373('0x27')](respondWithResult(_0x5c951e,null))['catch'](handleError(_0x5c951e,null));};exports[_0xd373('0x7d')]=function(_0x2da0cd,_0x48624a,_0x316348){var _0x48ee3b=_0x2da0cd[_0xd373('0x51')][_0xd373('0x73')];var _0x3b6ba5;return db['Team']['findAll']({'where':{'id':_0x48ee3b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd373('0x7e'),'attributes':['id','name',_0xd373('0x7f'),_0xd373('0x80'),'interface'],'raw':!![]}]})[_0xd373('0x27')](function(_0x5be460){if(_0x5be460){_0x3b6ba5=_0x5be460;var _0x449d06=_[_0xd373('0x81')](_0x5be460,function(_0x15eb3d){var _0x1031eb=_0x15eb3d[_0xd373('0x29')]({'plain':!![]});return _0x1031eb[_0xd373('0x7e')];});return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x2da0cd['params']['id']}})[_0xd373('0x27')](function(_0x41faec){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x39606d){return _0x41faec[_0xd373('0x7d')](_0x48ee3b,{'transaction':_0x39606d})['then'](function(){return BPromise[_0xd373('0x82')](_0x3b6ba5,function(_0x424a53){return db[_0xd373('0x83')]['upsert']({'TeamId':_0x424a53['id'],'VoicePrefixId':_0x2da0cd[_0xd373('0x4b')]['id']},{'transaction':_0x39606d});});})[_0xd373('0x27')](function(){return BPromise[_0xd373('0x82')](_0x449d06,function(_0x2f1dc0){return db[_0xd373('0x84')][_0xd373('0x85')]({'where':{'UserId':_0x2f1dc0['id'],'VoicePrefixId':_0x2da0cd['params']['id']},'transaction':_0x39606d});});})[_0xd373('0x27')](function(){_0x449d06['forEach'](function(_0x447ea9){socket[_0xd373('0x75')](_0xd373('0x86'),{'UserId':_0x447ea9['id'],'VoicePrefixId':_0x41faec['id']});});});});});}})[_0xd373('0x27')](respondWithStatusCode(_0x48624a,null))['catch'](handleError(_0x48624a,null));};exports['removeTeams']=function(_0x22e0bd,_0x44fbef,_0x3c9e20){return db[_0xd373('0x7c')][_0xd373('0x48')]({'where':{'id':_0x22e0bd[_0xd373('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd373('0x7a')],'as':_0xd373('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44fbef,null))[_0xd373('0x27')](function(_0x2225b2){var _0x2d5326=_['map'](_0x2225b2,'id');var _0x259610=[];var _0x747622=[];var _0x5233a2=squel['select']();_0x5233a2[_0xd373('0x87')](_0xd373('0x88'))[_0xd373('0x89')](_0xd373('0x8a'),'tq')[_0xd373('0x8b')](_0xd373('0x8c'),'ut',_0xd373('0x8d'))['where'](_0xd373('0x8e'),_0x22e0bd[_0xd373('0x4b')]['id']);for(var _0x11e4a9=0x0;_0x11e4a9<_0x2225b2[_0xd373('0x3b')];_0x11e4a9+=0x1){let _0x7b49b6=_0x2225b2[_0x11e4a9];for(var _0x4d9ab3=0x0;_0x4d9ab3<_0x7b49b6[_0xd373('0x7e')][_0xd373('0x3b')];_0x4d9ab3+=0x1){let _0x4c924d=_0x7b49b6[_0xd373('0x7e')][_0x4d9ab3];var _0x494de8=_0x5233a2[_0xd373('0x8f')]();_0x494de8[_0xd373('0x40')](_0xd373('0x90'),_0x4c924d['id']);_0x747622[_0xd373('0x67')](db[_0xd373('0x4f')][_0xd373('0x35')](_0x494de8[_0xd373('0x91')](),{'type':db[_0xd373('0x4f')]['QueryTypes'][_0xd373('0x92')]})[_0xd373('0x27')](function(_0x13b085){if(_0x13b085[_0xd373('0x3b')]===0x1){return _0x4c924d['id'];}else{var _0x392bd2=_[_0xd373('0x93')](_['map'](_0x13b085,_0xd373('0x94')),function(_0x10ac87){return _[_0xd373('0x95')](_0x2d5326,_0x10ac87);});if(_0x392bd2){return _0x4c924d['id'];}}}));}}return BPromise[_0xd373('0x96')](_0x747622)[_0xd373('0x27')](function(_0x20fa2e){_0x259610=_(_0x259610)[_0xd373('0x97')](_0x20fa2e)[_0xd373('0x98')]()[_0xd373('0x99')]();return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x22e0bd[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](function(_0x536c81){return db[_0xd373('0x4f')]['transaction'](function(_0x4ca4f9){return _0x536c81[_0xd373('0x9a')](_0x22e0bd['query'][_0xd373('0x73')],{'transaction':_0x4ca4f9})['then'](function(){if(!_['isEmpty'](_0x259610)){return _0x536c81['removeAgents'](_0x259610,{'transaction':_0x4ca4f9});}})['then'](function(){_0x259610['forEach'](function(_0x1de658){socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':_0x1de658,'VoicePrefixId':_0x536c81['id']});});});});});});})[_0xd373('0x27')](respondWithStatusCode(_0x44fbef,null))['catch'](handleError(_0x44fbef,null));}; \ No newline at end of file +var _0xd824=['NoOp','charAt','system-','transaction','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','sort','pick','nolimit','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','select','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','includes','all','value','removeTeams','isEmpty','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','userProfileId','autoAssociation','UserProfileResource','context','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL='];(function(_0x3725ad,_0x4cb410){var _0x2580ca=function(_0x3a44d3){while(--_0x3a44d3){_0x3725ad['push'](_0x3725ad['shift']());}};_0x2580ca(++_0x4cb410);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4d82('0x14')]=_[_0x4d82('0x15')](config[_0x4d82('0x14')],{'host':_0x4d82('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d82('0x14')]));require(_0x4d82('0x17'))[_0x4d82('0x18')](socket);function respondWithStatusCode(_0x486152,_0x70c598){_0x70c598=_0x70c598||0xcc;return function(_0x4f4c45){if(_0x4f4c45){return _0x486152[_0x4d82('0x19')](_0x70c598);}return _0x486152['status'](_0x70c598)[_0x4d82('0x1a')]();};}function respondWithResult(_0x496f3b,_0x474acf){_0x474acf=_0x474acf||0xc8;return function(_0xb1640d){if(_0xb1640d){return _0x496f3b[_0x4d82('0x1b')](_0x474acf)[_0x4d82('0x1c')](_0xb1640d);}};}function respondWithFilteredResult(_0x2648a8,_0x7c03fc){return function(_0x258c59){if(_0x258c59){var _0x217b72=typeof _0x7c03fc[_0x4d82('0x1d')]==='undefined'&&typeof _0x7c03fc[_0x4d82('0x1e')]===_0x4d82('0x1f');var _0x1b1e39=_0x258c59[_0x4d82('0x20')];var _0xe6260=_0x217b72?0x0:_0x7c03fc[_0x4d82('0x1d')];var _0x1a513d=_0x217b72?_0x258c59[_0x4d82('0x20')]:_0x7c03fc[_0x4d82('0x1d')]+_0x7c03fc[_0x4d82('0x1e')];var _0xf2f5a5;if(_0x1a513d>=_0x1b1e39){_0x1a513d=_0x1b1e39;_0xf2f5a5=0xc8;}else{_0xf2f5a5=0xce;}_0x2648a8['status'](_0xf2f5a5);return _0x2648a8[_0x4d82('0x21')](_0x4d82('0x22'),_0xe6260+'-'+_0x1a513d+'/'+_0x1b1e39)['json'](_0x258c59);}return null;};}function patchUpdates(_0x1a419f){return function(_0x41f194){try{jsonpatch[_0x4d82('0x23')](_0x41f194,_0x1a419f,!![]);}catch(_0x14a2d4){return BPromise[_0x4d82('0x24')](_0x14a2d4);}return _0x41f194[_0x4d82('0x25')]();};}function saveUpdates(_0x11c043,_0x462258){return function(_0x12feab){if(_0x12feab){return _0x12feab[_0x4d82('0x26')](_0x11c043)[_0x4d82('0x27')](function(_0x395efc){return _0x395efc;});}return null;};}function removeEntity(_0x7404ba,_0x284c66){return function(_0x1940ef){if(_0x1940ef){return _0x1940ef['destroy']()['then'](function(){var _0x3dcb0f=_0x1940ef[_0x4d82('0x28')]({'plain':!![]});var _0x2a0572=_0x4d82('0x29');return db['UserProfileResource'][_0x4d82('0x2a')]({'where':{'type':_0x2a0572,'resourceId':_0x3dcb0f['id']}})[_0x4d82('0x27')](function(){return _0x1940ef;});})[_0x4d82('0x27')](function(){_0x7404ba[_0x4d82('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4081f6,_0x4a7444){return function(_0x4d9ac4){if(!_0x4d9ac4){_0x4081f6['sendStatus'](0x194);}return _0x4d9ac4;};}function handleError(_0x52533b,_0x3d2229){_0x3d2229=_0x3d2229||0x1f4;return function(_0x8cfbf1){logger[_0x4d82('0x2b')](_0x8cfbf1['stack']);if(_0x8cfbf1[_0x4d82('0x2c')]){delete _0x8cfbf1[_0x4d82('0x2c')];}_0x52533b['status'](_0x3d2229)['send'](_0x8cfbf1);};}exports[_0x4d82('0x2d')]=function(_0x46a058,_0x16d30a){var _0x175961={},_0x5447f8={},_0x33d2a9={'count':0x0,'rows':[]};var _0x59cd4f=_[_0x4d82('0x2e')](db[_0x4d82('0x2f')]['rawAttributes'],function(_0x583cc5){return{'name':_0x583cc5[_0x4d82('0x30')],'type':_0x583cc5[_0x4d82('0x31')][_0x4d82('0x32')]};});_0x5447f8[_0x4d82('0x33')]=_[_0x4d82('0x2e')](_0x59cd4f,_0x4d82('0x2c'));_0x5447f8[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x46a058[_0x4d82('0x34')]);_0x5447f8[_0x4d82('0x36')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],_0x5447f8[_0x4d82('0x34')]);_0x175961[_0x4d82('0x37')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],qs[_0x4d82('0x38')](_0x46a058['query'][_0x4d82('0x38')]));_0x175961[_0x4d82('0x37')]=_0x175961[_0x4d82('0x37')]['length']?_0x175961[_0x4d82('0x37')]:_0x5447f8[_0x4d82('0x33')];if(!_0x46a058['query'][_0x4d82('0x39')]('nolimit')){_0x175961[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x46a058['query'][_0x4d82('0x1e')]);_0x175961['offset']=qs[_0x4d82('0x1d')](_0x46a058['query']['offset']);}_0x175961[_0x4d82('0x3a')]=qs['sort'](_0x46a058[_0x4d82('0x34')]['sort']);_0x175961[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0x46a058[_0x4d82('0x34')],_0x5447f8['filters']),_0x59cd4f);if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x175961['where']=_[_0x4d82('0x3d')](_0x175961['where'],{'$or':_[_0x4d82('0x2e')](_0x59cd4f,function(_0x54f714){if(_0x54f714[_0x4d82('0x31')]!==_0x4d82('0x3e')){var _0x1d9e8b={};_0x1d9e8b[_0x54f714[_0x4d82('0x2c')]]={'$like':'%'+_0x46a058['query'][_0x4d82('0x3c')]+'%'};return _0x1d9e8b;}})});}_0x175961=_[_0x4d82('0x3d')]({},_0x175961,_0x46a058[_0x4d82('0x3f')]);var _0x3e29a6={'where':_0x175961[_0x4d82('0x3b')]};return db[_0x4d82('0x2f')][_0x4d82('0x20')](_0x3e29a6)['then'](function(_0x3c80d6){_0x33d2a9[_0x4d82('0x20')]=_0x3c80d6;if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x40')]){_0x175961[_0x4d82('0x41')]=[{'all':!![]}];}return db['VoicePrefix'][_0x4d82('0x42')](_0x175961);})[_0x4d82('0x27')](function(_0x3f0a9f){_0x33d2a9[_0x4d82('0x43')]=_0x3f0a9f;return _0x33d2a9;})[_0x4d82('0x27')](respondWithFilteredResult(_0x16d30a,_0x175961))[_0x4d82('0x44')](handleError(_0x16d30a,null));};exports[_0x4d82('0x45')]=function(_0x5847c0,_0xe8c15f){var _0x1909da={'raw':![],'where':{'id':_0x5847c0[_0x4d82('0x46')]['id']}},_0x55e2f7={};_0x55e2f7['model']=_[_0x4d82('0x35')](db[_0x4d82('0x2f')]['rawAttributes']);_0x55e2f7[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x5847c0['query']);_0x55e2f7[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x55e2f7[_0x4d82('0x33')],_0x55e2f7['query']);_0x1909da[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x55e2f7['model'],qs['fields'](_0x5847c0[_0x4d82('0x34')][_0x4d82('0x38')]));_0x1909da[_0x4d82('0x37')]=_0x1909da[_0x4d82('0x37')][_0x4d82('0x48')]?_0x1909da[_0x4d82('0x37')]:_0x55e2f7[_0x4d82('0x33')];if(_0x5847c0['query'][_0x4d82('0x40')]){_0x1909da[_0x4d82('0x41')]=[{'all':!![]}];}_0x1909da=_[_0x4d82('0x3d')]({},_0x1909da,_0x5847c0[_0x4d82('0x3f')]);return db['VoicePrefix']['find'](_0x1909da)['then'](handleEntityNotFound(_0xe8c15f,null))[_0x4d82('0x27')](respondWithResult(_0xe8c15f,null))[_0x4d82('0x44')](handleError(_0xe8c15f,null));};exports[_0x4d82('0x2a')]=function(_0x34a08b,_0x25fc80){return db[_0x4d82('0x2f')]['find']({'where':{'id':_0x34a08b[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x25fc80,null))[_0x4d82('0x27')](removeEntity(_0x25fc80,null))[_0x4d82('0x44')](handleError(_0x25fc80,null));};exports[_0x4d82('0x49')]=function(_0x33f498,_0x127ef3){return db[_0x4d82('0x2f')][_0x4d82('0x49')]()['then'](respondWithResult(_0x127ef3,null))[_0x4d82('0x44')](handleError(_0x127ef3,null));};exports[_0x4d82('0x4a')]=function(_0x1822db,_0x25e8b9){var _0x1d853f;return db[_0x4d82('0x4b')]['transaction'](function(_0x5cf138){return db[_0x4d82('0x2f')][_0x4d82('0x4a')](_0x1822db[_0x4d82('0x4c')],{'transaction':_0x5cf138})[_0x4d82('0x27')](function(_0x2e373a){_0x1d853f=_0x2e373a[_0x4d82('0x28')]({'plain':!![]});return db[_0x4d82('0x4d')][_0x4d82('0x4e')]({'where':{'id':_0x1d853f[_0x4d82('0x4f')]},'raw':!![]})[_0x4d82('0x27')](function(_0x367c82){return createVoicePrefixExtensions(_0x1d853f,_0x367c82,_0x5cf138);});});})[_0x4d82('0x27')](function(){var _0x517f87=_0x1822db[_0x4d82('0x50')]['get']({'plain':!![]});if(!_0x517f87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517f87[_0x4d82('0x51')]===_0x4d82('0x50')){var _0x257dc4=_0x1d853f;return db['UserProfileSection'][_0x4d82('0x4e')]({'where':{'name':_0x4d82('0x29'),'userProfileId':_0x517f87[_0x4d82('0x52')]},'raw':!![]})[_0x4d82('0x27')](function(_0x4aaa65){if(_0x4aaa65&&_0x4aaa65[_0x4d82('0x53')]===0x0){return db[_0x4d82('0x54')][_0x4d82('0x4a')]({'name':_0x257dc4[_0x4d82('0x2c')],'resourceId':_0x257dc4['id'],'type':_0x4aaa65[_0x4d82('0x2c')],'sectionId':_0x4aaa65['id']},{})['then'](function(){return _0x1d853f;});}else{return _0x1d853f;}})[_0x4d82('0x44')](function(_0x3297ce){logger[_0x4d82('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3297ce);throw _0x3297ce;});}return _0x1d853f;})[_0x4d82('0x27')](respondWithResult(_0x25e8b9,null))[_0x4d82('0x44')](handleError(_0x25e8b9,null));};function Extension(_0x131bb5,_0x189e3f,_0x14e621,_0x3148bd){this[_0x4d82('0x55')]='from-sip';this['exten']=_0x131bb5;this[_0x4d82('0x56')]=_0x14e621;this[_0x4d82('0x31')]=_0x4d82('0x57');this['description']=_0x4d82('0x58');this[_0x4d82('0x59')]=_0x189e3f;this[_0x4d82('0x5a')]=_0x3148bd;}function createVoicePrefixExtensions(_0x3d85c2,_0x238459,_0x2aec60){return new BPromise(function(_0xa2cdb3,_0xc70504){var _0x131a10=new Extension(formatPrefixName(_0x3d85c2[_0x4d82('0x5b')]),0x1,'NoOp','Voice\x20Prefix');_0x131a10[_0x4d82('0x5c')]=_0x3d85c2['id'];return db[_0x4d82('0x4d')][_0x4d82('0x4a')](_0x131a10,{'transaction':_0x2aec60})['then'](function(_0x471349){var _0xc80c61=_0x471349[_0x4d82('0x28')]({'plain':!![]});var _0x328991=_[_0x4d82('0x2e')](addVoicePrefixExtensions(_0x3d85c2,_0x238459),function(_0x43c72e){_0x43c72e[_0x4d82('0x4f')]=_0xc80c61['id'];_0x43c72e[_0x4d82('0x5c')]=_0x3d85c2['id'];return _0x43c72e;});return db['VoiceExtension'][_0x4d82('0x5d')](_0x328991,{'transaction':_0x2aec60})[_0x4d82('0x27')](function(_0x279172){if(!_0x279172){return _0xc70504('Extensions\x20creation\x20failed');}else{return _0xa2cdb3(_0x279172);}})['catch'](function(_0x1d3e90){return _0xc70504(_0x1d3e90);});});;});};function addVoicePrefixExtensions(_0xc5b353,_0x1a785a){var _0x15d620=[];var _0x2872bf=formatPrefixName(_0xc5b353[_0x4d82('0x5b')]);_0x15d620['push'](new Extension(_0x2872bf,0x2,_0x4d82('0x5e'),_0x4d82('0x5f')+_0xc5b353[_0x4d82('0x2c')]));if(_0xc5b353['callerIdAll']){_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x5e'),_0x4d82('0x61')+_0xc5b353['callerIdAll']));}else{_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x62'),'No\x20callerid\x20available'));}_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x4,'goto',_0x1a785a[_0x4d82('0x55')]+','+'${EXTEN:'+(0x8+_0xc5b353['name'][_0x4d82('0x48')])+'}'+','+0x1));return _0x15d620;}function formatPrefixName(_0x32e291){var _0x5279e3='_';for(var _0x307592=0x0;_0x307592<_0x32e291['length'];_0x307592++){if(_0x32e291[_0x4d82('0x63')](_0x307592)=='-'){_0x5279e3+=_0x32e291['charAt'](_0x307592);}else{_0x5279e3+='['+_0x32e291[_0x4d82('0x63')](_0x307592)+']';}}_0x5279e3+='.';return _0x5279e3;}exports[_0x4d82('0x26')]=function(_0x2fcf61,_0x75900c,_0x9c5e5c){var _0x456f33=_0x2fcf61[_0x4d82('0x4c')];_0x456f33[_0x4d82('0x5b')]=_0x4d82('0x64')+_0x456f33[_0x4d82('0x2c')]+'-';return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x14d697){return db[_0x4d82('0x2f')][_0x4d82('0x26')](_0x456f33,{'where':{'id':_0x456f33['id']},'transaction':_0x14d697})[_0x4d82('0x27')](function(){return db[_0x4d82('0x4d')][_0x4d82('0x2a')]({'where':{'VoicePrefixId':_0x456f33['id']},'transaction':_0x14d697})['then'](function(){return db['VoiceExtension'][_0x4d82('0x4e')]({'where':{'id':_0x456f33['VoiceExtensionId']},'raw':!![]})[_0x4d82('0x27')](function(_0x47644d){return createVoicePrefixExtensions(_0x456f33,_0x47644d,_0x14d697);});});});})[_0x4d82('0x27')](function(){return db[_0x4d82('0x2f')][_0x4d82('0x66')](_0x456f33['id']);})[_0x4d82('0x27')](respondWithResult(_0x75900c,null))['catch'](handleError(_0x75900c,null));};exports[_0x4d82('0x67')]=function(_0x220e87,_0x554778,_0x80d688){return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0x220e87[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x554778,null))[_0x4d82('0x27')](function(_0x212561){if(_0x212561){return _0x212561[_0x4d82('0x67')](_0x220e87['body']['ids'],_['omit'](_0x220e87['body'],['ids','id'])||{})[_0x4d82('0x68')](function(_0x245e97){for(var _0x1fe26a=0x0;_0x1fe26a<_0x220e87['body'][_0x4d82('0x69')][_0x4d82('0x48')];_0x1fe26a+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':Number(_0x220e87[_0x4d82('0x4c')]['ids'][_0x1fe26a]),'VoicePrefixId':Number(_0x220e87['params']['id'])});}return _0x245e97;});}})[_0x4d82('0x27')](respondWithResult(_0x554778,null))[_0x4d82('0x44')](handleError(_0x554778,null));};exports[_0x4d82('0x6c')]=function(_0x2471b8,_0xd64d2a,_0x353c18){return db['VoicePrefix'][_0x4d82('0x4e')]({'where':{'id':_0x2471b8['params']['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0xd64d2a,null))[_0x4d82('0x27')](function(_0x28a256){if(_0x28a256){return _0x28a256[_0x4d82('0x6c')](_0x2471b8[_0x4d82('0x34')]['ids'])[_0x4d82('0x27')](function(){if(_[_0x4d82('0x6d')](_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')])){for(var _0x2a50b3=0x0;_0x2a50b3<_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')][_0x4d82('0x48')];_0x2a50b3+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')]['ids'][_0x2a50b3]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}}else{socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}});}})[_0x4d82('0x27')](respondWithStatusCode(_0xd64d2a,null))['catch'](handleError(_0xd64d2a,null));};exports[_0x4d82('0x6f')]=function(_0x3b7592,_0x5380ce,_0x21ea7c){var _0x588471={};var _0x634bfb={};var _0x5092ff;var _0x472666;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0x3b7592[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5380ce,null))['then'](function(_0x960e9){if(_0x960e9){_0x5092ff=_0x960e9;_0x634bfb[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x71')][_0x4d82('0x72')]);_0x634bfb[_0x4d82('0x34')]=_['keys'](_0x3b7592['query']);_0x634bfb[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x634bfb[_0x4d82('0x33')],_0x634bfb[_0x4d82('0x34')]);_0x588471[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x634bfb['model'],qs[_0x4d82('0x38')](_0x3b7592[_0x4d82('0x34')]['fields']));_0x588471[_0x4d82('0x37')]=_0x588471[_0x4d82('0x37')][_0x4d82('0x48')]?_0x588471['attributes']:_0x634bfb[_0x4d82('0x33')];_0x588471[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0x3b7592[_0x4d82('0x34')]['sort']);_0x588471[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_[_0x4d82('0x74')](_0x3b7592[_0x4d82('0x34')],_0x634bfb['filters']));if(_0x3b7592[_0x4d82('0x34')]['filter']){_0x588471['where']=_[_0x4d82('0x3d')](_0x588471[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x588471[_0x4d82('0x37')],function(_0xb2d707){var _0x49d4ed={};_0x49d4ed[_0xb2d707]={'$like':'%'+_0x3b7592[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x49d4ed;})});}_0x588471=_['merge']({},_0x588471,_0x3b7592[_0x4d82('0x3f')]);return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x210ed6){if(_0x210ed6){_0x472666=_0x210ed6['length'];if(!_0x3b7592[_0x4d82('0x34')]['hasOwnProperty'](_0x4d82('0x75'))){_0x588471[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x588471[_0x4d82('0x1d')]=qs['offset'](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1d')]);}return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x2c80ae){if(_0x2c80ae){return _0x2c80ae?{'count':_0x472666,'rows':_0x2c80ae}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5380ce,null))[_0x4d82('0x44')](handleError(_0x5380ce,null));};exports['getTeams']=function(_0xfb0987,_0x5a65e4,_0x252db4){var _0x24a63a={};var _0x2d0b29={};var _0x44c35f;var _0x54fcd4;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0xfb0987[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5a65e4,null))[_0x4d82('0x27')](function(_0x45b2e3){if(_0x45b2e3){_0x44c35f=_0x45b2e3;_0x2d0b29[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x76')][_0x4d82('0x72')]);_0x2d0b29[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0xfb0987[_0x4d82('0x34')]);_0x2d0b29['filters']=_[_0x4d82('0x47')](_0x2d0b29[_0x4d82('0x33')],_0x2d0b29[_0x4d82('0x34')]);_0x24a63a[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x2d0b29['model'],qs[_0x4d82('0x38')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x38')]));_0x24a63a[_0x4d82('0x37')]=_0x24a63a[_0x4d82('0x37')][_0x4d82('0x48')]?_0x24a63a['attributes']:_0x2d0b29['model'];_0x24a63a[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0xfb0987[_0x4d82('0x34')]['sort']);_0x24a63a[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0xfb0987[_0x4d82('0x34')],_0x2d0b29[_0x4d82('0x36')]));if(_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x24a63a[_0x4d82('0x3b')]=_[_0x4d82('0x3d')](_0x24a63a[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x24a63a['attributes'],function(_0x5471c3){var _0x1d1329={};_0x1d1329[_0x5471c3]={'$like':'%'+_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x1d1329;})});}_0x24a63a=_['merge']({},_0x24a63a,_0xfb0987[_0x4d82('0x3f')]);return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})[_0x4d82('0x27')](function(_0x5a9056){if(_0x5a9056){_0x54fcd4=_0x5a9056[_0x4d82('0x48')];if(!_0xfb0987['query']['hasOwnProperty'](_0x4d82('0x75'))){_0x24a63a[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x24a63a[_0x4d82('0x1d')]=qs[_0x4d82('0x1d')](_0xfb0987[_0x4d82('0x34')]['offset']);}return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})['then'](function(_0xc764bb){if(_0xc764bb){return _0xc764bb?{'count':_0x54fcd4,'rows':_0xc764bb}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5a65e4,null))[_0x4d82('0x44')](handleError(_0x5a65e4,null));};exports['addTeams']=function(_0xead937,_0x59e1bc,_0x521566){var _0x1eda7c=_0xead937['body'][_0x4d82('0x69')];var _0x5ac864;return db[_0x4d82('0x76')][_0x4d82('0x42')]({'where':{'id':_0x1eda7c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4d82('0x78'),'attributes':['id',_0x4d82('0x2c'),_0x4d82('0x79'),_0x4d82('0x7a'),_0x4d82('0x7b')],'raw':!![]}]})[_0x4d82('0x27')](function(_0x2b832e){if(_0x2b832e){_0x5ac864=_0x2b832e;var _0x402626=_[_0x4d82('0x7c')](_0x2b832e,function(_0x3be4f9){var _0x47c734=_0x3be4f9[_0x4d82('0x28')]({'plain':!![]});return _0x47c734[_0x4d82('0x78')];});return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xead937[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](function(_0x1768e2){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x1c61f5){return _0x1768e2[_0x4d82('0x7d')](_0x1eda7c,{'transaction':_0x1c61f5})[_0x4d82('0x27')](function(){return BPromise[_0x4d82('0x7e')](_0x5ac864,function(_0x44729c){return db[_0x4d82('0x7f')][_0x4d82('0x80')]({'TeamId':_0x44729c['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},{'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){return BPromise['each'](_0x402626,function(_0x2867e7){return db[_0x4d82('0x81')][_0x4d82('0x82')]({'where':{'UserId':_0x2867e7['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){_0x402626['forEach'](function(_0x14b0cb){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':_0x14b0cb['id'],'VoicePrefixId':_0x1768e2['id']});});});});});}})[_0x4d82('0x27')](respondWithStatusCode(_0x59e1bc,null))[_0x4d82('0x44')](handleError(_0x59e1bc,null));};exports['removeTeams']=function(_0xc56d02,_0x34234c,_0x23778f){return db['Team'][_0x4d82('0x42')]({'where':{'id':_0xc56d02['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x4d82('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34234c,null))[_0x4d82('0x27')](function(_0x1d32c3){var _0x4d0047=_['map'](_0x1d32c3,'id');var _0x4f7c18=[];var _0x4277b7=[];var _0x2b7c2c=squel[_0x4d82('0x83')]();_0x2b7c2c['field']('tq.TeamId')[_0x4d82('0x84')](_0x4d82('0x85'),'tq')[_0x4d82('0x86')](_0x4d82('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4d82('0x3b')](_0x4d82('0x88'),_0xc56d02[_0x4d82('0x46')]['id']);for(var _0x2c18b2=0x0;_0x2c18b2<_0x1d32c3[_0x4d82('0x48')];_0x2c18b2+=0x1){let _0x37cac6=_0x1d32c3[_0x2c18b2];for(var _0x642d9=0x0;_0x642d9<_0x37cac6['Agents'][_0x4d82('0x48')];_0x642d9+=0x1){let _0x3097f8=_0x37cac6[_0x4d82('0x78')][_0x642d9];var _0x5ccadb=_0x2b7c2c['clone']();_0x5ccadb[_0x4d82('0x3b')](_0x4d82('0x89'),_0x3097f8['id']);_0x4277b7[_0x4d82('0x60')](db['sequelize'][_0x4d82('0x34')](_0x5ccadb[_0x4d82('0x8a')](),{'type':db[_0x4d82('0x4b')][_0x4d82('0x8b')]['SELECT']})[_0x4d82('0x27')](function(_0x3f0228){if(_0x3f0228['length']===0x1){return _0x3097f8['id'];}else{var _0x5f4633=_[_0x4d82('0x8c')](_['map'](_0x3f0228,'TeamId'),function(_0x3e4fb1){return _[_0x4d82('0x8d')](_0x4d0047,_0x3e4fb1);});if(_0x5f4633){return _0x3097f8['id'];}}}));}}return BPromise[_0x4d82('0x8e')](_0x4277b7)['then'](function(_0x4d6de5){_0x4f7c18=_(_0x4f7c18)['union'](_0x4d6de5)['compact']()[_0x4d82('0x8f')]();return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xc56d02['params']['id']}})[_0x4d82('0x27')](function(_0x227e2c){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x4f36f5){return _0x227e2c[_0x4d82('0x90')](_0xc56d02['query'][_0x4d82('0x69')],{'transaction':_0x4f36f5})[_0x4d82('0x27')](function(){if(!_[_0x4d82('0x91')](_0x4f7c18)){return _0x227e2c[_0x4d82('0x6c')](_0x4f7c18,{'transaction':_0x4f36f5});}})[_0x4d82('0x27')](function(){_0x4f7c18['forEach'](function(_0x3a0735){socket[_0x4d82('0x6a')]('userVoicePrefix:remove',{'UserId':_0x3a0735,'VoicePrefixId':_0x227e2c['id']});});});});});});})['then'](respondWithStatusCode(_0x34234c,null))['catch'](handleError(_0x34234c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1d5beaf..de78234 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 _0x71f8=['update','emit','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x71f8,0xb4));var _0x871f=function(_0x10677e,_0x1e6c90){_0x10677e=_0x10677e-0x0;var _0x33c753=_0x71f8[_0x10677e];return _0x33c753;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x871f('0x0'))['db'][_0x871f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x871f('0x2')](0x0);var events={'afterCreate':_0x871f('0x3'),'afterUpdate':_0x871f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ac9ef){return function(_0x3e9c15,_0x4388d2,_0x59093f){VoicePrefixEvents[_0x871f('0x5')](_0x2ac9ef+':'+_0x3e9c15['id'],_0x3e9c15);VoicePrefixEvents['emit'](_0x2ac9ef,_0x3e9c15);_0x59093f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x871f('0x6')](e,emitEvent(event));}}module[_0x871f('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xd061=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x5593d5,_0x2eb560){var _0x34b7bc=function(_0x361ad8){while(--_0x361ad8){_0x5593d5['push'](_0x5593d5['shift']());}};_0x34b7bc(++_0x2eb560);}(_0xd061,0x103));var _0x1d06=function(_0x17ff35,_0x56006c){_0x17ff35=_0x17ff35-0x0;var _0x13c95a=_0xd061[_0x17ff35];return _0x13c95a;};'use strict';var EventEmitter=require(_0x1d06('0x0'));var VoicePrefix=require(_0x1d06('0x1'))['db'][_0x1d06('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1d06('0x3'),'afterDestroy':_0x1d06('0x4')};function emitEvent(_0x3576b7){return function(_0x289384,_0x517a6e,_0xc59ad2){VoicePrefixEvents[_0x1d06('0x5')](_0x3576b7+':'+_0x289384['id'],_0x289384);VoicePrefixEvents[_0x1d06('0x5')](_0x3576b7,_0x289384);_0xc59ad2(null);};}for(var e in events){if(events[_0x1d06('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x1d06('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7e744fb..051fae4 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 _0xb851=['VoicePrefix','voice_prefixes','util','api','moment','bluebird','request-promise','path','./voicePrefix.attributes','exports','define'];(function(_0x2014c5,_0x408420){var _0x3c7681=function(_0x23ebb7){while(--_0x23ebb7){_0x2014c5['push'](_0x2014c5['shift']());}};_0x3c7681(++_0x408420);}(_0xb851,0x136));var _0x1b85=function(_0x4c702f,_0x2fc8f7){_0x4c702f=_0x4c702f-0x0;var _0xf71a93=_0xb851[_0x4c702f];return _0xf71a93;};'use strict';var _=require('lodash');var util=require(_0x1b85('0x0'));var logger=require('../../config/logger')(_0x1b85('0x1'));var moment=require(_0x1b85('0x2'));var BPromise=require(_0x1b85('0x3'));var rp=require(_0x1b85('0x4'));var fs=require('fs');var path=require(_0x1b85('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b85('0x6'));module[_0x1b85('0x7')]=function(_0x51f778,_0x10ee84){return _0x51f778[_0x1b85('0x8')](_0x1b85('0x9'),attributes,{'tableName':_0x1b85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1164=['../../config/environment','define','VoicePrefix','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2abe4a,_0x30222f){var _0x53f1e7=function(_0x111fdd){while(--_0x111fdd){_0x2abe4a['push'](_0x2abe4a['shift']());}};_0x53f1e7(++_0x30222f);}(_0x1164,0xdb));var _0x4116=function(_0x4fa972,_0x2d4afd){_0x4fa972=_0x4fa972-0x0;var _0xb9db1e=_0x1164[_0x4fa972];return _0xb9db1e;};'use strict';var _=require('lodash');var util=require(_0x4116('0x0'));var logger=require(_0x4116('0x1'))(_0x4116('0x2'));var moment=require('moment');var BPromise=require(_0x4116('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4116('0x4'));var rimraf=require(_0x4116('0x5'));var config=require(_0x4116('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x34a0af,_0x5c6b3d){return _0x34a0af[_0x4116('0x7')](_0x4116('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 1e018f4..a9d5e48 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 _0x4a03=['http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0xf9a3de,_0x44ee2d){var _0x4453a5=function(_0x2a1403){while(--_0x2a1403){_0xf9a3de['push'](_0xf9a3de['shift']());}};_0x4453a5(++_0x44ee2d);}(_0x4a03,0x16e));var _0x34a0=function(_0x339390,_0x5aaa1a){_0x339390=_0x339390-0x0;var _0x2cf985=_0x4a03[_0x339390];return _0x2cf985;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});config['redis']=_[_0x34a0('0xa')](config[_0x34a0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x34a0('0xc'))(new Redis(config[_0x34a0('0xb')]));require(_0x34a0('0xd'))[_0x34a0('0xe')](socket);function respondWithRpcPromise(_0x761a80,_0x4faf06,_0x40d73d){return new BPromise(function(_0x2c39bf,_0x21e702){return client[_0x34a0('0xf')](_0x761a80,_0x40d73d)[_0x34a0('0x10')](function(_0x343d24){logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,'request\x20sent');logger['debug'](_0x34a0('0x13'),_0x4faf06,_0x34a0('0x14'),JSON['stringify'](_0x343d24));if(_0x343d24[_0x34a0('0x15')]){if(_0x343d24[_0x34a0('0x15')][_0x34a0('0x16')]===0x1f4){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x21e702(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x2c39bf(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}else{logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,_0x34a0('0x14'));_0x2c39bf(_0x343d24[_0x34a0('0x18')][_0x34a0('0x17')]);}})['catch'](function(_0x466525){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x466525);_0x21e702(_0x466525);});});} \ No newline at end of file +var _0x74af=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x3e974a,_0x3b0017){var _0x32234e=function(_0xc1349f){while(--_0xc1349f){_0x3e974a['push'](_0x3e974a['shift']());}};_0x32234e(++_0x3b0017);}(_0x74af,0x178));var _0xf74a=function(_0xa8be57,_0x60d2aa){_0xa8be57=_0xa8be57-0x0;var _0x94d50f=_0x74af[_0xa8be57];return _0x94d50f;};'use strict';var _=require(_0xf74a('0x0'));var util=require(_0xf74a('0x1'));var moment=require(_0xf74a('0x2'));var BPromise=require(_0xf74a('0x3'));var rs=require(_0xf74a('0x4'));var fs=require('fs');var Redis=require(_0xf74a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf74a('0x6'));var logger=require(_0xf74a('0x7'))(_0xf74a('0x8'));var config=require(_0xf74a('0x9'));var jayson=require(_0xf74a('0xa'));var client=jayson[_0xf74a('0xb')][_0xf74a('0xc')]({'port':0x232a});config['redis']=_[_0xf74a('0xd')](config[_0xf74a('0xe')],{'host':_0xf74a('0xf'),'port':0x18eb});var socket=require(_0xf74a('0x10'))(new Redis(config[_0xf74a('0xe')]));require(_0xf74a('0x11'))[_0xf74a('0x12')](socket);function respondWithRpcPromise(_0x78bbd9,_0x206db9,_0x15c591){return new BPromise(function(_0xd6896f,_0xd79080){return client[_0xf74a('0x13')](_0x78bbd9,_0x15c591)[_0xf74a('0x14')](function(_0x15f94b){logger['info'](_0xf74a('0x15'),_0x206db9,'request\x20sent');logger[_0xf74a('0x16')](_0xf74a('0x17'),_0x206db9,_0xf74a('0x18'),JSON[_0xf74a('0x19')](_0x15f94b));if(_0x15f94b[_0xf74a('0x1a')]){if(_0x15f94b[_0xf74a('0x1a')]['code']===0x1f4){logger[_0xf74a('0x1a')]('VoicePrefix,\x20%s,\x20%s',_0x206db9,_0x15f94b[_0xf74a('0x1a')][_0xf74a('0x1b')]);return _0xd79080(_0x15f94b['error'][_0xf74a('0x1b')]);}logger[_0xf74a('0x1a')](_0xf74a('0x15'),_0x206db9,_0x15f94b[_0xf74a('0x1a')]['message']);return _0xd6896f(_0x15f94b[_0xf74a('0x1a')]['message']);}else{logger['info'](_0xf74a('0x15'),_0x206db9,_0xf74a('0x18'));_0xd6896f(_0x15f94b[_0xf74a('0x1c')]['message']);}})['catch'](function(_0x56f11a){logger[_0xf74a('0x1a')](_0xf74a('0x15'),_0x206db9,_0x56f11a);_0xd79080(_0x56f11a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4308771..31e4203 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 _0x49ac=['length','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x49ac,0x19e));var _0xc49a=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x49ac[_0x2d4421];return _0x2d3b01;};'use strict';var VoicePrefixEvents=require(_0xc49a('0x0'));var events=[_0xc49a('0x1'),_0xc49a('0x2'),_0xc49a('0x3')];function createListener(_0x310d8e,_0x3ad7a9){return function(_0x40db57){_0x3ad7a9[_0xc49a('0x4')](_0x310d8e,_0x40db57);};}function removeListener(_0x3d6da8,_0x28a560){return function(){VoicePrefixEvents[_0xc49a('0x5')](_0x3d6da8,_0x28a560);};}exports['register']=function(_0x40017e){for(var _0x5acdcf=0x0,_0x353873=events[_0xc49a('0x6')];_0x5acdcf<_0x353873;_0x5acdcf++){var _0x4440e5=events[_0x5acdcf];var _0x457829=createListener('voicePrefix:'+_0x4440e5,_0x40017e);VoicePrefixEvents['on'](_0x4440e5,_0x457829);}}; \ No newline at end of file +var _0x928c=['emit','register','voicePrefix:','remove','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x928c,0x17f));var _0xc928=function(_0x38f268,_0xe441a8){_0x38f268=_0x38f268-0x0;var _0x4e904f=_0x928c[_0x38f268];return _0x4e904f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xc928('0x0'),_0xc928('0x1')];function createListener(_0x597d43,_0x24354b){return function(_0x29bd30){_0x24354b[_0xc928('0x2')](_0x597d43,_0x29bd30);};}function removeListener(_0x3e4e60,_0x1dd54b){return function(){VoicePrefixEvents['removeListener'](_0x3e4e60,_0x1dd54b);};}exports[_0xc928('0x3')]=function(_0x4704bc){for(var _0x8c0fa5=0x0,_0x4ff9e6=events['length'];_0x8c0fa5<_0x4ff9e6;_0x8c0fa5++){var _0x5e433b=events[_0x8c0fa5];var _0x445248=createListener(_0xc928('0x4')+_0x5e433b,_0x4704bc);VoicePrefixEvents['on'](_0x5e433b,_0x445248);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 16c6367..2135e29 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(_0x1b0197,_0x45fd74){var _0x459b07=function(_0x53d5b3){while(--_0x53d5b3){_0x1b0197['push'](_0x1b0197['shift']());}};_0x459b07(++_0x45fd74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x44f575,_0x1df8c5){_0x44f575=_0x44f575-0x0;var _0x4d61e8=_0xb10b[_0x44f575];return _0x4d61e8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 8179ffe..85e7408 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 _0x965f=['getDataValue','type','dialMethod','booked','roundrobin','predictive','INTEGER','yes','all','once','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','ringall','setDataValue','strategy'];(function(_0x23cf38,_0x5715bb){var _0x1ebce5=function(_0x5dd8e1){while(--_0x5dd8e1){_0x23cf38['push'](_0x23cf38['shift']());}};_0x1ebce5(++_0x5715bb);}(_0x965f,0x8e));var _0xf965=function(_0x489344,_0x2107b9){_0x489344=_0x489344-0x0;var _0x173fbf=_0x965f[_0x489344];return _0x173fbf;};'use strict';var Sequelize=require(_0xf965('0x0'));module[_0xf965('0x1')]={'name':{'type':Sequelize[_0xf965('0x2')],'allowNull':![],'unique':_0xf965('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x5'),_0xf965('0x6')),'allowNull':![],'defaultValue':_0xf965('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xf965('0x4')]('rr','ringall',_0xf965('0x7'),_0xf965('0x8'),_0xf965('0x9'),_0xf965('0xa'),_0xf965('0xb'),'wrandom',_0xf965('0xc')),'allowNull':![],'defaultValue':_0xf965('0xd'),'set':function(_0x4f3f23){this[_0xf965('0xe')](_0xf965('0xf'),_0x4f3f23?_0x4f3f23:_0xf965('0xa'));},'get':function(){var _0x567cbd=this[_0xf965('0x10')](_0xf965('0x11'));var _0x336d9a=this[_0xf965('0x10')](_0xf965('0x12'));var _0x443de2=this[_0xf965('0x10')](_0xf965('0xf'));if(_0x567cbd===_0xf965('0x5')){return _0x443de2;}if(_0x336d9a===_0xf965('0x13')&&_0x443de2==='rrmemory'||_0x336d9a==='booked'&&_0x443de2===_0xf965('0x14')){return _0x443de2;}if(_0x336d9a==='progressive'||_0x336d9a===_0xf965('0x15')||_0x336d9a==='power'){return _0x443de2;}return null;}},'servicelevel':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf965('0x16')](0xb)},'timeout':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf965('0x2')]},'weight':{'type':Sequelize[_0xf965('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf965('0x4')]('yes','no'),'defaultValue':_0xf965('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xf965('0x17'),'no',_0xf965('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xf965('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xf965('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xf965('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf965('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf965('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf965('0x4')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xf965('0x17'),'no',_0xf965('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xf965('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf965('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf965('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf965('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf965('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xf965('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xf965('0x2')]},'queue_less_than':{'type':Sequelize[_0xf965('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x272eaf){this[_0xf965('0xe')](_0xf965('0x1a'),_0x272eaf?_0x272eaf['join'](','):[]);},'get':function(){return this['getDataValue'](_0xf965('0x1a'))?this[_0xf965('0x10')](_0xf965('0x1a'))[_0xf965('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xf965('0x17'),'set':function(_0x2a96ff){this[_0xf965('0xe')](_0xf965('0x1c'),_0x2a96ff?_0x2a96ff[_0xf965('0x1d')](','):undefined);},'get':function(){return this[_0xf965('0x10')](_0xf965('0x1c'))?this[_0xf965('0x10')](_0xf965('0x1c'))[_0xf965('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf965('0x2')],'defaultValue':'no','set':function(_0x3a5d86){this[_0xf965('0xe')](_0xf965('0x1e'),_0x3a5d86?_0x3a5d86[_0xf965('0x1d')](','):undefined);},'get':function(){return this[_0xf965('0x10')](_0xf965('0x1e'))?this[_0xf965('0x10')](_0xf965('0x1e'))[_0xf965('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf965('0x2')]},'description':{'type':Sequelize[_0xf965('0x2')]},'acw':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':0x0,'set':function(_0x297c65){this[_0xf965('0xe')](_0xf965('0x20'),_0x297c65);if(_0x297c65){if(this[_0xf965('0x10')]('wrapuptime')<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf965('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':0x0,'comment':_0xf965('0x21')},'dialMethod':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x22'),_0xf965('0x23'),_0xf965('0x24'),_0xf965('0x15'),'booked'),'defaultValue':'progressive','comment':_0xf965('0x25')},'dialLimitChannel':{'type':Sequelize[_0xf965('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xf965('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf965('0x26')},'dialPowerLevel':{'type':Sequelize[_0xf965('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xf965('0x4')]('agentBusyFactor',_0xf965('0x28')),'defaultValue':_0xf965('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf965('0x27')](0x2)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xf965('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xf965('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf965('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xf965('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xf965('0x2')],'defaultValue':_0xf965('0x2b'),'comment':_0xf965('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xf965('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x2d')},'dialQueueProject':{'type':Sequelize[_0xf965('0x2')],'comment':_0xf965('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf965('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf965('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'defaultValue':0x3,'comment':_0xf965('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf965('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xf965('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf965('0x4')](_0xf965('0x35'),_0xf965('0x36'),_0xf965('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf965('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf965('0x38')},'dialAMDGreeting':{'type':Sequelize[_0xf965('0x16')](0x9)[_0xf965('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf965('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf965('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf965('0x16')](0x9)[_0xf965('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf965('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf965('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf965('0x16')](0x9)[_0xf965('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf965('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf965('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xf965('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf965('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf965('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf965('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf965('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf965('0x40'),_0xf965('0x41')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xf965('0x2')],'comment':_0xf965('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf965('0x42')},'dialCutDigit':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf965('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf965('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf965('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf965('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf965('0x16')](0x5)[_0xf965('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf965('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xf965('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':![],'comment':_0xf965('0x4c'),'set':function(_0x46b92c){if(!_0x46b92c)this[_0xf965('0xe')](_0xf965('0x4d'),null);this[_0xf965('0xe')](_0xf965('0x4e'),_0x46b92c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf965('0x16')](0x3)[_0xf965('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf965('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xf965('0x1f')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe93c=['getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','exports','STRING','ENUM','inbound','outbound','ringall','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','strategy'];(function(_0x3e325b,_0x3e939a){var _0x144cad=function(_0x558699){while(--_0x558699){_0x3e325b['push'](_0x3e325b['shift']());}};_0x144cad(++_0x3e939a);}(_0xe93c,0x183));var _0xce93=function(_0x4e5a20,_0x280e74){_0x4e5a20=_0x4e5a20-0x0;var _0xd76cfb=_0xe93c[_0x4e5a20];return _0xd76cfb;};'use strict';var Sequelize=require('sequelize');module[_0xce93('0x0')]={'name':{'type':Sequelize[_0xce93('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x3'),_0xce93('0x4')),'allowNull':![],'defaultValue':_0xce93('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xce93('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xce93('0x2')]('rr',_0xce93('0x5'),'leastrecent',_0xce93('0x6'),_0xce93('0x7'),_0xce93('0x8'),_0xce93('0x9'),'wrandom',_0xce93('0xa')),'allowNull':![],'defaultValue':_0xce93('0x5'),'set':function(_0x4cf189){this[_0xce93('0xb')](_0xce93('0xc'),_0x4cf189?_0x4cf189:'rrmemory');},'get':function(){var _0x598dae=this[_0xce93('0xd')](_0xce93('0xe'));var _0x1499eb=this[_0xce93('0xd')](_0xce93('0xf'));var _0x228d0f=this[_0xce93('0xd')](_0xce93('0xc'));if(_0x598dae===_0xce93('0x3')){return _0x228d0f;}if(_0x1499eb==='booked'&&_0x228d0f===_0xce93('0x8')||_0x1499eb===_0xce93('0x10')&&_0x228d0f===_0xce93('0x11')){return _0x228d0f;}if(_0x1499eb===_0xce93('0x12')||_0x1499eb===_0xce93('0x13')||_0x1499eb===_0xce93('0x14')){return _0x228d0f;}return null;}},'servicelevel':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xce93('0x15')](0xb)},'timeout':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no'),'defaultValue':_0xce93('0x16')},'autopause':{'type':Sequelize[_0xce93('0x2')]('yes','no',_0xce93('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xce93('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xce93('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xce93('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xce93('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xce93('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xce93('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xce93('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xce93('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no'),'defaultValue':_0xce93('0x16')},'announce_holdtime':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no',_0xce93('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xce93('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xce93('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xce93('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xce93('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xce93('0x1')]},'queue_quantity1':{'type':Sequelize[_0xce93('0x1')]},'queue_quantity2':{'type':Sequelize[_0xce93('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xce93('0x1')]},'periodic_announce':{'type':Sequelize[_0xce93('0x19')],'set':function(_0x3ea2cd){this[_0xce93('0xb')](_0xce93('0x1a'),_0x3ea2cd?_0x3ea2cd[_0xce93('0x1b')](','):[]);},'get':function(){return this[_0xce93('0xd')](_0xce93('0x1a'))?this[_0xce93('0xd')]('periodic_announce')[_0xce93('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xce93('0x1')],'defaultValue':'yes','set':function(_0x4b9c60){this['setDataValue']('joinempty',_0x4b9c60?_0x4b9c60[_0xce93('0x1b')](','):undefined);},'get':function(){return this[_0xce93('0xd')](_0xce93('0x1d'))?this[_0xce93('0xd')](_0xce93('0x1d'))[_0xce93('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xce93('0x1')],'defaultValue':'no','set':function(_0x26ff3a){this['setDataValue'](_0xce93('0x1e'),_0x26ff3a?_0x26ff3a[_0xce93('0x1b')](','):undefined);},'get':function(){return this[_0xce93('0xd')](_0xce93('0x1e'))?this[_0xce93('0xd')](_0xce93('0x1e'))[_0xce93('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xce93('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xce93('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xce93('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xce93('0x1')]},'description':{'type':Sequelize[_0xce93('0x1')]},'acw':{'type':Sequelize[_0xce93('0x1f')],'defaultValue':0x0,'set':function(_0x53e603){this[_0xce93('0xb')](_0xce93('0x20'),_0x53e603);if(_0x53e603){if(this['getDataValue'](_0xce93('0x21'))<0x2){this['setDataValue'](_0xce93('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xce93('0x1f')],'defaultValue':0x0,'comment':_0xce93('0x22')},'dialMethod':{'type':Sequelize[_0xce93('0x2')]('preview','progressive',_0xce93('0x14'),_0xce93('0x13'),_0xce93('0x10')),'defaultValue':'progressive','comment':_0xce93('0x23')},'dialLimitChannel':{'type':Sequelize[_0xce93('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xce93('0x24')},'dialLimitQueue':{'type':Sequelize[_0xce93('0x15')](0x4)[_0xce93('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xce93('0x26')},'dialPowerLevel':{'type':Sequelize[_0xce93('0x27')](0x2)[_0xce93('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x28'),_0xce93('0x29')),'defaultValue':_0xce93('0x29'),'comment':_0xce93('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xce93('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xce93('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xce93('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xce93('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xce93('0x15')](0x3)[_0xce93('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce93('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xce93('0x1')],'defaultValue':_0xce93('0x2e'),'comment':_0xce93('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xce93('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce93('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xce93('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xce93('0x15')](0x3)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce93('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)[_0xce93('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xce93('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce93('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)[_0xce93('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xce93('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xce93('0x15')](0x3)[_0xce93('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xce93('0x37')},'dialTimezone':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xce93('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xce93('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x38'),_0xce93('0x39'),_0xce93('0x3a')),'defaultValue':_0xce93('0x38')},'dialAMDActive':{'type':Sequelize[_0xce93('0x1f')],'defaultValue':0x0,'comment':_0xce93('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xce93('0x15')](0x9)[_0xce93('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xce93('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xce93('0x15')](0x9)[_0xce93('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xce93('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xce93('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xce93('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xce93('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xce93('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xce93('0x15')](0x9)[_0xce93('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xce93('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xce93('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xce93('0x15')](0x5)[_0xce93('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xce93('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xce93('0x42')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xce93('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xce93('0x1f')],'defaultValue':0x0,'comment':_0xce93('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xce93('0x2')](_0xce93('0x44'),_0xce93('0x45')),'defaultValue':_0xce93('0x44')},'dialQueueProject2':{'type':Sequelize[_0xce93('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xce93('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xce93('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xce93('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xce93('0x15')](0x3)[_0xce93('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xce93('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xce93('0x15')](0x3)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce93('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)[_0xce93('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xce93('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce93('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce93('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xce93('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce93('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xce93('0x15')],'allowNull':!![],'comment':_0xce93('0x4e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xce93('0x4f'),'set':function(_0x4b49aa){if(!_0x4b49aa)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xce93('0xb')]('mandatoryDisposition',_0x4b49aa);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xce93('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 42a76a4..cc84936 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 _0x759c=['value','includes','type','find','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','CmHopper','hasOwnProperty','findAll','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','TeamVoiceQueue','upsert','each','findOrCreate','isNil','format','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','all','compact','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','toString','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','ContactId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map'];(function(_0x5a6f76,_0x3738a4){var _0x36ab73=function(_0x4c4522){while(--_0x4c4522){_0x5a6f76['push'](_0x5a6f76['shift']());}};_0x36ab73(++_0x3738a4);}(_0x759c,0x1ef));var _0xc759=function(_0x48deff,_0x22a442){_0x48deff=_0x48deff-0x0;var _0x4edf8a=_0x759c[_0x48deff];return _0x4edf8a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc759('0x0'));var jsonpatch=require(_0xc759('0x1'));var rp=require(_0xc759('0x2'));var moment=require(_0xc759('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc759('0x4'));var util=require(_0xc759('0x5'));var path=require(_0xc759('0x6'));var sox=require(_0xc759('0x7'));var csv=require(_0xc759('0x8'));var ejs=require(_0xc759('0x9'));var fs=require('fs');var fs_extra=require(_0xc759('0xa'));var _=require(_0xc759('0xb'));var squel=require(_0xc759('0xc'));var crypto=require('crypto');var jsforce=require(_0xc759('0xd'));var deskjs=require(_0xc759('0xe'));var toCsv=require(_0xc759('0x8'));var querystring=require(_0xc759('0xf'));var Papa=require('papaparse');var Redis=require(_0xc759('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc759('0x11'));var as=require(_0xc759('0x12'));var hardwareService=require(_0xc759('0x13'));var logger=require(_0xc759('0x14'))('api');var utils=require(_0xc759('0x15'));var config=require(_0xc759('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc759('0x17'))['db'];config[_0xc759('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc759('0x19'))(new Redis(config['redis']));require(_0xc759('0x1a'))['register'](socket);function respondWithStatusCode(_0x32b558,_0x44c51f){_0x44c51f=_0x44c51f||0xcc;return function(_0x2006fc){if(_0x2006fc){return _0x32b558[_0xc759('0x1b')](_0x44c51f);}return _0x32b558['status'](_0x44c51f)[_0xc759('0x1c')]();};}function respondWithResult(_0x550379,_0x2afe4f){_0x2afe4f=_0x2afe4f||0xc8;return function(_0x19d373){if(_0x19d373){return _0x550379[_0xc759('0x1d')](_0x2afe4f)[_0xc759('0x1e')](_0x19d373);}};}function respondWithFilteredResult(_0x13d918,_0xcf74db){return function(_0x13b36a){if(_0x13b36a){var _0x591d2b=typeof _0xcf74db[_0xc759('0x1f')]===_0xc759('0x20')&&typeof _0xcf74db[_0xc759('0x21')]===_0xc759('0x20');var _0x149872=_0x13b36a[_0xc759('0x22')];var _0xf23012=_0x591d2b?0x0:_0xcf74db['offset'];var _0x2c9c1a=_0x591d2b?_0x13b36a[_0xc759('0x22')]:_0xcf74db[_0xc759('0x1f')]+_0xcf74db[_0xc759('0x21')];var _0x433e2a;if(_0x2c9c1a>=_0x149872){_0x2c9c1a=_0x149872;_0x433e2a=0xc8;}else{_0x433e2a=0xce;}_0x13d918[_0xc759('0x1d')](_0x433e2a);return _0x13d918[_0xc759('0x23')]('Content-Range',_0xf23012+'-'+_0x2c9c1a+'/'+_0x149872)[_0xc759('0x1e')](_0x13b36a);}return null;};}function patchUpdates(_0x150d2d){return function(_0x7f7193){try{jsonpatch[_0xc759('0x24')](_0x7f7193,_0x150d2d,!![]);}catch(_0x29b749){return BPromise[_0xc759('0x25')](_0x29b749);}return _0x7f7193['save']();};}function saveUpdates(_0x50649f,_0x3a1d49){return function(_0x12e7b8){if(_0x12e7b8){return _0x12e7b8[_0xc759('0x26')](_0x50649f)[_0xc759('0x27')](function(_0x585057){return _0x585057;});}return null;};}function removeEntity(_0x392112,_0x2ac789){return function(_0x386e28){if(_0x386e28){return _0x386e28[_0xc759('0x28')]()['then'](function(){var _0x990672=_0x386e28[_0xc759('0x29')]({'plain':!![]});var _0x3ac70f=[{'name':_0xc759('0x2a'),'value':_0xc759('0x2b'),'ignore':![]},{'name':_0xc759('0x2c'),'value':_0xc759('0x2d'),'ignore':![]}];var _0x16552c=_(_0x3ac70f)[_0xc759('0x2e')]('ignore')[_0xc759('0x2f')](_0xc759('0x30'))[_0xc759('0x30')]();if(_[_0xc759('0x31')](_0x16552c,_0x990672[_0xc759('0x32')])){return;}var _0x30eab5=_[_0xc759('0x33')](_0x3ac70f,[_0xc759('0x30'),_0x990672[_0xc759('0x32')]])[_0xc759('0x34')];return db[_0xc759('0x35')][_0xc759('0x28')]({'where':{'type':_0x30eab5,'resourceId':_0x990672['id']}})[_0xc759('0x27')](function(){return _0x386e28;});})['then'](function(){_0x392112[_0xc759('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93d50,_0xda2965){return function(_0x56d290){if(!_0x56d290){_0x93d50[_0xc759('0x1b')](0x194);}return _0x56d290;};}function handleError(_0x247784,_0xa6233e){_0xa6233e=_0xa6233e||0x1f4;return function(_0x2c17cb){logger[_0xc759('0x36')](_0x2c17cb[_0xc759('0x37')]);if(_0x2c17cb['name']){delete _0x2c17cb[_0xc759('0x34')];}_0x247784[_0xc759('0x1d')](_0xa6233e)['send'](_0x2c17cb);};}exports[_0xc759('0x38')]=function(_0x1f9cb7,_0xa8d6bd){var _0x40a637={},_0x4d1919={},_0x4f5284={'count':0x0,'rows':[]};var _0x20e082=_['map'](db[_0xc759('0x39')][_0xc759('0x3a')],function(_0x740304){return{'name':_0x740304[_0xc759('0x3b')],'type':_0x740304[_0xc759('0x32')][_0xc759('0x3c')]};});_0x4d1919[_0xc759('0x3d')]=_[_0xc759('0x2f')](_0x20e082,_0xc759('0x34'));_0x4d1919['query']=_[_0xc759('0x3e')](_0x1f9cb7['query']);_0x4d1919[_0xc759('0x3f')]=_[_0xc759('0x40')](_0x4d1919['model'],_0x4d1919[_0xc759('0x41')]);_0x40a637['attributes']=_['intersection'](_0x4d1919['model'],qs[_0xc759('0x42')](_0x1f9cb7[_0xc759('0x41')][_0xc759('0x42')]));_0x40a637[_0xc759('0x43')]=_0x40a637[_0xc759('0x43')][_0xc759('0x44')]?_0x40a637['attributes']:_0x4d1919[_0xc759('0x3d')];if(!_0x1f9cb7['query']['hasOwnProperty'](_0xc759('0x45'))){_0x40a637['limit']=qs[_0xc759('0x21')](_0x1f9cb7[_0xc759('0x41')][_0xc759('0x21')]);_0x40a637['offset']=qs[_0xc759('0x1f')](_0x1f9cb7[_0xc759('0x41')][_0xc759('0x1f')]);}_0x40a637[_0xc759('0x46')]=qs['sort'](_0x1f9cb7['query'][_0xc759('0x47')]);_0x40a637[_0xc759('0x48')]=qs[_0xc759('0x3f')](_['pick'](_0x1f9cb7[_0xc759('0x41')],_0x4d1919['filters']),_0x20e082);if(_0x1f9cb7[_0xc759('0x41')][_0xc759('0x2e')]){_0x40a637[_0xc759('0x48')]=_[_0xc759('0x49')](_0x40a637[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0x20e082,function(_0x585b58){if(_0x585b58[_0xc759('0x32')]!==_0xc759('0x4a')){var _0x245bbd={};_0x245bbd[_0x585b58[_0xc759('0x34')]]={'$like':'%'+_0x1f9cb7['query'][_0xc759('0x2e')]+'%'};return _0x245bbd;}})});}_0x40a637=_[_0xc759('0x49')]({},_0x40a637,_0x1f9cb7[_0xc759('0x4b')]);var _0x2739f2={'where':_0x40a637[_0xc759('0x48')]};return db[_0xc759('0x39')][_0xc759('0x22')](_0x2739f2)[_0xc759('0x27')](function(_0x330e4f){_0x4f5284[_0xc759('0x22')]=_0x330e4f;if(_0x1f9cb7[_0xc759('0x41')][_0xc759('0x4c')]){_0x40a637['include']=[{'all':!![]}];}return db[_0xc759('0x39')]['findAll'](_0x40a637);})[_0xc759('0x27')](function(_0x2c5ad5){_0x4f5284[_0xc759('0x4d')]=_0x2c5ad5;return _0x4f5284;})['then'](respondWithFilteredResult(_0xa8d6bd,_0x40a637))[_0xc759('0x4e')](handleError(_0xa8d6bd,null));};exports[_0xc759('0x4f')]=function(_0x34f5ec,_0x4c32af){var _0x360cb1={'raw':![],'where':{'id':_0x34f5ec[_0xc759('0x50')]['id']}},_0x3c9672={};_0x3c9672[_0xc759('0x3d')]=_[_0xc759('0x3e')](db[_0xc759('0x39')][_0xc759('0x3a')]);_0x3c9672['query']=_[_0xc759('0x3e')](_0x34f5ec[_0xc759('0x41')]);_0x3c9672[_0xc759('0x3f')]=_[_0xc759('0x40')](_0x3c9672['model'],_0x3c9672['query']);_0x360cb1[_0xc759('0x43')]=_['intersection'](_0x3c9672[_0xc759('0x3d')],qs[_0xc759('0x42')](_0x34f5ec[_0xc759('0x41')][_0xc759('0x42')]));_0x360cb1['attributes']=_0x360cb1[_0xc759('0x43')]['length']?_0x360cb1[_0xc759('0x43')]:_0x3c9672[_0xc759('0x3d')];if(_0x34f5ec[_0xc759('0x41')][_0xc759('0x4c')]){_0x360cb1[_0xc759('0x51')]=[{'all':!![]}];}_0x360cb1=_[_0xc759('0x49')]({},_0x360cb1,_0x34f5ec[_0xc759('0x4b')]);return db[_0xc759('0x39')][_0xc759('0x33')](_0x360cb1)[_0xc759('0x27')](handleEntityNotFound(_0x4c32af,null))[_0xc759('0x27')](respondWithResult(_0x4c32af,null))[_0xc759('0x4e')](handleError(_0x4c32af,null));};exports['create']=function(_0x1d287c,_0x29e4ed){return db['VoiceQueue'][_0xc759('0x52')](_0x1d287c['body'],{})[_0xc759('0x27')](function(_0x1e5704){var _0x1af1eb=_0x1d287c[_0xc759('0x53')][_0xc759('0x29')]({'plain':!![]});if(!_0x1af1eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1af1eb[_0xc759('0x54')]===_0xc759('0x53')){var _0x1472e8=_0x1e5704[_0xc759('0x29')]({'plain':!![]});var _0x40faaf=[{'name':_0xc759('0x2a'),'value':_0xc759('0x2b')},{'name':_0xc759('0x2c'),'value':_0xc759('0x2d')}];var _0x2e1297=_[_0xc759('0x33')](_0x40faaf,[_0xc759('0x30'),_0x1472e8['type']])[_0xc759('0x34')];return db[_0xc759('0x55')][_0xc759('0x33')]({'where':{'name':_0x2e1297,'userProfileId':_0x1af1eb[_0xc759('0x56')]},'raw':!![]})['then'](function(_0x599454){if(_0x599454&&_0x599454['autoAssociation']===0x0){return db[_0xc759('0x35')][_0xc759('0x52')]({'name':_0x1472e8['name'],'resourceId':_0x1472e8['id'],'type':_0x599454[_0xc759('0x34')],'sectionId':_0x599454['id']},{})[_0xc759('0x27')](function(){return _0x1e5704;});}else{return _0x1e5704;}})[_0xc759('0x4e')](function(_0x1a57bb){logger[_0xc759('0x36')](_0xc759('0x57'),_0x1a57bb);throw _0x1a57bb;});}return _0x1e5704;})['then'](respondWithResult(_0x29e4ed,0xc9))[_0xc759('0x4e')](handleError(_0x29e4ed,null));};exports['clone']=function(_0x15e38f,_0x53d769){var _0x386cfa={'where':{'id':_0x15e38f[_0xc759('0x50')]['id']}},_0x222ddc={};_0x222ddc[_0xc759('0x3d')]=_[_0xc759('0x3e')](db[_0xc759('0x39')][_0xc759('0x3a')]);_0x386cfa[_0xc759('0x43')]=_['intersection'](_0x222ddc[_0xc759('0x3d')],qs[_0xc759('0x42')](_0x15e38f[_0xc759('0x41')][_0xc759('0x42')]));_0x386cfa[_0xc759('0x43')]=_0x386cfa[_0xc759('0x43')]['length']?_0x386cfa[_0xc759('0x43')]:_0x222ddc[_0xc759('0x3d')];if(_0x15e38f[_0xc759('0x41')][_0xc759('0x4c')]){_0x386cfa['include']=[{'all':!![]}];}_0x386cfa=_[_0xc759('0x49')]({},_0x386cfa,_0x15e38f[_0xc759('0x4b')]);return db[_0xc759('0x39')][_0xc759('0x33')](_0x386cfa)[_0xc759('0x27')](handleEntityNotFound(_0x53d769,null))[_0xc759('0x27')](function(_0x3076f4){if(_0x3076f4){var _0x2569c5=_0x3076f4[_0xc759('0x29')]({'plain':!![]});_0x2569c5=qs[_0xc759('0x58')](_0x2569c5,['id',_0xc759('0x59'),'updatedAt']);_0x15e38f[_0xc759('0x5a')]=_['omit'](_0x15e38f[_0xc759('0x5a')],['id',_0xc759('0x59'),_0xc759('0x5b')]);return db[_0xc759('0x39')][_0xc759('0x52')](_[_0xc759('0x49')](_0x2569c5,_0x15e38f[_0xc759('0x5a')]),{'include':_0x15e38f[_0xc759('0x41')][_0xc759('0x4c')]?[{'all':!![]}]:undefined})[_0xc759('0x27')](function(_0xa4b170){var _0x17b2fc=_0x15e38f['user'][_0xc759('0x29')]({'plain':!![]});if(!_0x17b2fc)throw new Error(_0xc759('0x5c'));if(_0x17b2fc['role']===_0xc759('0x53')){var _0x6b6a33=_0xa4b170['get']({'plain':!![]});var _0x1bb194=[{'name':_0xc759('0x2a'),'value':_0xc759('0x2b')},{'name':_0xc759('0x2c'),'value':'outbound'}];var _0x51c6f7=_['find'](_0x1bb194,[_0xc759('0x30'),_0x6b6a33[_0xc759('0x32')]])[_0xc759('0x34')];return db[_0xc759('0x55')][_0xc759('0x33')]({'where':{'name':_0x51c6f7,'userProfileId':_0x17b2fc[_0xc759('0x56')]},'raw':!![]})[_0xc759('0x27')](function(_0x5be657){if(_0x5be657&&_0x5be657['autoAssociation']===0x0){return db[_0xc759('0x35')][_0xc759('0x52')]({'name':_0x6b6a33[_0xc759('0x34')],'resourceId':_0x6b6a33['id'],'type':_0x5be657[_0xc759('0x34')],'sectionId':_0x5be657['id']},{})[_0xc759('0x27')](function(){return _0xa4b170;});}else{return _0xa4b170;}})[_0xc759('0x4e')](function(_0x3795d8){logger[_0xc759('0x36')](_0xc759('0x57'),_0x3795d8);throw _0x3795d8;});}return _0xa4b170;});}})[_0xc759('0x27')](respondWithResult(_0x53d769,0xc9))[_0xc759('0x4e')](handleError(_0x53d769,null));};exports[_0xc759('0x26')]=function(_0x16641c,_0x470917){if(_0x16641c[_0xc759('0x5a')]['id']){delete _0x16641c[_0xc759('0x5a')]['id'];}return db[_0xc759('0x39')][_0xc759('0x33')]({'where':{'id':_0x16641c[_0xc759('0x50')]['id']}})['then'](handleEntityNotFound(_0x470917,null))[_0xc759('0x27')](saveUpdates(_0x16641c['body'],null))[_0xc759('0x27')](respondWithResult(_0x470917,null))[_0xc759('0x4e')](handleError(_0x470917,null));};exports[_0xc759('0x28')]=function(_0x5260ac,_0x264463){return db[_0xc759('0x39')][_0xc759('0x33')]({'where':{'id':_0x5260ac[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x264463,null))[_0xc759('0x27')](removeEntity(_0x264463,null))['catch'](handleError(_0x264463,null));};exports['getHoppers']=function(_0x265e84,_0x58d3b7,_0x297d8e){var _0x2d9172={'raw':![],'where':{}};var _0x3b5b8f={};var _0x54fb9e={'count':0x0,'rows':[]};return db[_0xc759('0x39')][_0xc759('0x5d')]({'where':{'id':_0x265e84['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x58d3b7,null))[_0xc759('0x27')](function(_0x55f840){if(_0x55f840){_0x3b5b8f['model']=_[_0xc759('0x3e')](db[_0xc759('0x5e')]['rawAttributes']);_0x3b5b8f[_0xc759('0x41')]=_['keys'](_0x265e84[_0xc759('0x41')]);_0x3b5b8f[_0xc759('0x3f')]=_[_0xc759('0x40')](_0x3b5b8f[_0xc759('0x3d')],_0x3b5b8f[_0xc759('0x41')]);_0x2d9172[_0xc759('0x43')]=_['intersection'](_0x3b5b8f['model'],qs[_0xc759('0x42')](_0x265e84[_0xc759('0x41')][_0xc759('0x42')]));_0x2d9172['attributes']=_0x2d9172[_0xc759('0x43')][_0xc759('0x44')]?_0x2d9172[_0xc759('0x43')]:_0x3b5b8f['model'];if(!_0x265e84['query'][_0xc759('0x5f')](_0xc759('0x45'))){_0x2d9172[_0xc759('0x21')]=qs[_0xc759('0x21')](_0x265e84[_0xc759('0x41')][_0xc759('0x21')]);_0x2d9172[_0xc759('0x1f')]=qs[_0xc759('0x1f')](_0x265e84[_0xc759('0x41')][_0xc759('0x1f')]);}_0x2d9172[_0xc759('0x46')]=qs['sort'](_0x265e84['query'][_0xc759('0x47')]);_0x2d9172[_0xc759('0x48')]=qs[_0xc759('0x3f')](_['pick'](_0x265e84[_0xc759('0x41')],_0x3b5b8f[_0xc759('0x3f')]));_0x2d9172[_0xc759('0x48')]['VoiceQueueId']=_0x55f840['id'];if(_0x265e84[_0xc759('0x41')][_0xc759('0x2e')]){_0x2d9172[_0xc759('0x48')]=_[_0xc759('0x49')](_0x2d9172[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0x2d9172[_0xc759('0x43')],function(_0x52da63){var _0x39ef01={};_0x39ef01[_0x52da63]={'$like':'%'+_0x265e84[_0xc759('0x41')][_0xc759('0x2e')]+'%'};return _0x39ef01;})});}_0x2d9172=_[_0xc759('0x49')]({},_0x2d9172,_0x265e84[_0xc759('0x4b')]);return db['CmHopper']['count']({'where':_0x2d9172[_0xc759('0x48')]})[_0xc759('0x27')](function(_0x56d0a7){_0x54fb9e[_0xc759('0x22')]=_0x56d0a7;if(_0x265e84[_0xc759('0x41')]['includeAll']){_0x2d9172[_0xc759('0x51')]=[{'all':!![]}];}return db['CmHopper'][_0xc759('0x60')](_0x2d9172);})[_0xc759('0x27')](function(_0x2e45d1){_0x54fb9e[_0xc759('0x4d')]=_0x2e45d1;return _0x54fb9e;});}})[_0xc759('0x27')](respondWithFilteredResult(_0x58d3b7,_0x2d9172))[_0xc759('0x4e')](handleError(_0x58d3b7,null));};exports['getHopperHistories']=function(_0x2389c,_0x7bfce9,_0x48e9d6){var _0xa29a7a={'raw':!![],'where':{}};var _0x4929ff={};var _0x2d7b4e={'count':0x0,'rows':[]};return db[_0xc759('0x39')][_0xc759('0x5d')]({'where':{'id':_0x2389c[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x7bfce9,null))[_0xc759('0x27')](function(_0x24f8f0){if(_0x24f8f0){_0x4929ff[_0xc759('0x3d')]=_[_0xc759('0x3e')](db['CmHopperHistory'][_0xc759('0x3a')]);_0x4929ff[_0xc759('0x41')]=_[_0xc759('0x3e')](_0x2389c[_0xc759('0x41')]);_0x4929ff[_0xc759('0x3f')]=_[_0xc759('0x40')](_0x4929ff['model'],_0x4929ff[_0xc759('0x41')]);_0xa29a7a[_0xc759('0x43')]=_['intersection'](_0x4929ff[_0xc759('0x3d')],qs[_0xc759('0x42')](_0x2389c[_0xc759('0x41')][_0xc759('0x42')]));_0xa29a7a[_0xc759('0x43')]=_0xa29a7a[_0xc759('0x43')][_0xc759('0x44')]?_0xa29a7a[_0xc759('0x43')]:_0x4929ff['model'];if(!_0x2389c['query'][_0xc759('0x5f')](_0xc759('0x45'))){_0xa29a7a['limit']=qs[_0xc759('0x21')](_0x2389c[_0xc759('0x41')][_0xc759('0x21')]);_0xa29a7a[_0xc759('0x1f')]=qs[_0xc759('0x1f')](_0x2389c[_0xc759('0x41')][_0xc759('0x1f')]);}_0xa29a7a[_0xc759('0x46')]=qs['sort'](_0x2389c[_0xc759('0x41')][_0xc759('0x47')]);_0xa29a7a[_0xc759('0x48')]=qs[_0xc759('0x3f')](_[_0xc759('0x61')](_0x2389c['query'],_0x4929ff['filters']));_0xa29a7a[_0xc759('0x48')][_0xc759('0x62')]=_0x24f8f0['id'];if(_0x2389c[_0xc759('0x41')]['filter']){_0xa29a7a['where']=_[_0xc759('0x49')](_0xa29a7a[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0xa29a7a[_0xc759('0x43')],function(_0x4b3a39){var _0x1449e9={};_0x1449e9[_0x4b3a39]={'$like':'%'+_0x2389c[_0xc759('0x41')][_0xc759('0x2e')]+'%'};return _0x1449e9;})});}_0xa29a7a=_[_0xc759('0x49')]({},_0xa29a7a,_0x2389c['options']);return db[_0xc759('0x63')]['count']({'where':_0xa29a7a[_0xc759('0x48')]})[_0xc759('0x27')](function(_0x5c7264){_0x2d7b4e[_0xc759('0x22')]=_0x5c7264;if(_0x2389c[_0xc759('0x41')][_0xc759('0x4c')]){_0xa29a7a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xc759('0x60')](_0xa29a7a);})[_0xc759('0x27')](function(_0x510572){_0x2d7b4e['rows']=_0x510572;return _0x2d7b4e;});}})[_0xc759('0x27')](respondWithFilteredResult(_0x7bfce9,_0xa29a7a))[_0xc759('0x4e')](handleError(_0x7bfce9,null));};exports['getHopperFinals']=function(_0x4b47af,_0x4669f4,_0x115adf){var _0x2961d8={'raw':!![],'where':{}};var _0x5a48e3={};var _0x19b5e5={'count':0x0,'rows':[]};return db[_0xc759('0x39')]['findOne']({'where':{'id':_0x4b47af[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x4669f4,null))[_0xc759('0x27')](function(_0x1b0370){if(_0x1b0370){_0x5a48e3[_0xc759('0x3d')]=_['keys'](db[_0xc759('0x64')][_0xc759('0x3a')]);_0x5a48e3[_0xc759('0x41')]=_[_0xc759('0x3e')](_0x4b47af['query']);_0x5a48e3['filters']=_[_0xc759('0x40')](_0x5a48e3[_0xc759('0x3d')],_0x5a48e3[_0xc759('0x41')]);_0x2961d8[_0xc759('0x43')]=_[_0xc759('0x40')](_0x5a48e3[_0xc759('0x3d')],qs['fields'](_0x4b47af[_0xc759('0x41')][_0xc759('0x42')]));_0x2961d8[_0xc759('0x43')]=_0x2961d8[_0xc759('0x43')]['length']?_0x2961d8['attributes']:_0x5a48e3[_0xc759('0x3d')];if(!_0x4b47af[_0xc759('0x41')]['hasOwnProperty'](_0xc759('0x45'))){_0x2961d8[_0xc759('0x21')]=qs[_0xc759('0x21')](_0x4b47af[_0xc759('0x41')][_0xc759('0x21')]);_0x2961d8[_0xc759('0x1f')]=qs[_0xc759('0x1f')](_0x4b47af['query']['offset']);}_0x2961d8[_0xc759('0x46')]=qs[_0xc759('0x47')](_0x4b47af[_0xc759('0x41')][_0xc759('0x47')]);_0x2961d8[_0xc759('0x48')]=qs[_0xc759('0x3f')](_['pick'](_0x4b47af['query'],_0x5a48e3[_0xc759('0x3f')]));_0x2961d8[_0xc759('0x48')][_0xc759('0x62')]=_0x1b0370['id'];if(_0x4b47af[_0xc759('0x41')][_0xc759('0x2e')]){_0x2961d8[_0xc759('0x48')]=_[_0xc759('0x49')](_0x2961d8[_0xc759('0x48')],{'$or':_['map'](_0x2961d8[_0xc759('0x43')],function(_0x160096){var _0x20818d={};_0x20818d[_0x160096]={'$like':'%'+_0x4b47af[_0xc759('0x41')][_0xc759('0x2e')]+'%'};return _0x20818d;})});}_0x2961d8=_[_0xc759('0x49')]({},_0x2961d8,_0x4b47af[_0xc759('0x4b')]);return db[_0xc759('0x64')][_0xc759('0x22')]({'where':_0x2961d8[_0xc759('0x48')]})[_0xc759('0x27')](function(_0x4e2393){_0x19b5e5['count']=_0x4e2393;if(_0x4b47af[_0xc759('0x41')][_0xc759('0x4c')]){_0x2961d8[_0xc759('0x51')]=[{'all':!![]}];}return db[_0xc759('0x64')]['findAll'](_0x2961d8);})[_0xc759('0x27')](function(_0x5363da){_0x19b5e5[_0xc759('0x4d')]=_0x5363da;return _0x19b5e5;});}})['then'](respondWithFilteredResult(_0x4669f4,_0x2961d8))[_0xc759('0x4e')](handleError(_0x4669f4,null));};exports[_0xc759('0x65')]=function(_0x301fd0,_0x410e60,_0x5afad0){var _0x22ff65={'raw':!![],'where':{}};var _0x9a4149={};var _0x591b11={'count':0x0,'rows':[]};return db[_0xc759('0x39')][_0xc759('0x5d')]({'where':{'id':_0x301fd0[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x410e60,null))['then'](function(_0x22c106){if(_0x22c106){_0x9a4149[_0xc759('0x3d')]=_[_0xc759('0x3e')](db[_0xc759('0x66')][_0xc759('0x3a')]);_0x9a4149[_0xc759('0x41')]=_[_0xc759('0x3e')](_0x301fd0[_0xc759('0x41')]);_0x9a4149['filters']=_['intersection'](_0x9a4149[_0xc759('0x3d')],_0x9a4149[_0xc759('0x41')]);_0x22ff65[_0xc759('0x43')]=_[_0xc759('0x40')](_0x9a4149['model'],qs[_0xc759('0x42')](_0x301fd0['query'][_0xc759('0x42')]));_0x22ff65['attributes']=_0x22ff65[_0xc759('0x43')]['length']?_0x22ff65[_0xc759('0x43')]:_0x9a4149[_0xc759('0x3d')];if(!_0x301fd0[_0xc759('0x41')][_0xc759('0x5f')]('nolimit')){_0x22ff65['limit']=qs[_0xc759('0x21')](_0x301fd0[_0xc759('0x41')][_0xc759('0x21')]);_0x22ff65[_0xc759('0x1f')]=qs[_0xc759('0x1f')](_0x301fd0[_0xc759('0x41')][_0xc759('0x1f')]);}_0x22ff65[_0xc759('0x46')]=qs['sort'](_0x301fd0[_0xc759('0x41')][_0xc759('0x47')]);_0x22ff65['where']=qs[_0xc759('0x3f')](_[_0xc759('0x61')](_0x301fd0[_0xc759('0x41')],_0x9a4149[_0xc759('0x3f')]));_0x22ff65['where'][_0xc759('0x62')]=_0x22c106['id'];if(_0x301fd0[_0xc759('0x41')][_0xc759('0x2e')]){_0x22ff65['where']=_[_0xc759('0x49')](_0x22ff65[_0xc759('0x48')],{'$or':_['map'](_0x22ff65[_0xc759('0x43')],function(_0x2226fe){var _0x366b89={};_0x366b89[_0x2226fe]={'$like':'%'+_0x301fd0['query']['filter']+'%'};return _0x366b89;})});}_0x22ff65=_['merge']({},_0x22ff65,_0x301fd0[_0xc759('0x4b')]);return db[_0xc759('0x66')][_0xc759('0x22')]({'where':_0x22ff65[_0xc759('0x48')]})[_0xc759('0x27')](function(_0x2cbca8){_0x591b11['count']=_0x2cbca8;if(_0x301fd0[_0xc759('0x41')][_0xc759('0x4c')]){_0x22ff65[_0xc759('0x51')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc759('0x60')](_0x22ff65);})[_0xc759('0x27')](function(_0x503d2d){_0x591b11['rows']=_0x503d2d;return _0x591b11;});}})[_0xc759('0x27')](respondWithFilteredResult(_0x410e60,_0x22ff65))['catch'](handleError(_0x410e60,null));};exports[_0xc759('0x67')]=function(_0x73209d,_0x1b5678,_0x2f2cf2){var _0x3819af={};var _0x2202ff={};var _0x5e3e9b;var _0x2f2198;return db[_0xc759('0x39')][_0xc759('0x5d')]({'where':{'id':_0x73209d[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x1b5678,null))[_0xc759('0x27')](function(_0x1442e6){if(_0x1442e6){_0x5e3e9b=_0x1442e6;_0x2202ff['model']=_[_0xc759('0x3e')](db['Team'][_0xc759('0x3a')]);_0x2202ff['query']=_[_0xc759('0x3e')](_0x73209d[_0xc759('0x41')]);_0x2202ff['filters']=_[_0xc759('0x40')](_0x2202ff[_0xc759('0x3d')],_0x2202ff[_0xc759('0x41')]);_0x3819af[_0xc759('0x43')]=_[_0xc759('0x40')](_0x2202ff['model'],qs['fields'](_0x73209d[_0xc759('0x41')][_0xc759('0x42')]));_0x3819af['attributes']=_0x3819af['attributes'][_0xc759('0x44')]?_0x3819af[_0xc759('0x43')]:_0x2202ff[_0xc759('0x3d')];_0x3819af[_0xc759('0x46')]=qs[_0xc759('0x47')](_0x73209d[_0xc759('0x41')]['sort']);_0x3819af['where']=qs[_0xc759('0x3f')](_[_0xc759('0x61')](_0x73209d[_0xc759('0x41')],_0x2202ff['filters']));if(_0x73209d[_0xc759('0x41')][_0xc759('0x2e')]){_0x3819af[_0xc759('0x48')]=_[_0xc759('0x49')](_0x3819af[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0x3819af['attributes'],function(_0x1d137c){var _0x4f354b={};_0x4f354b[_0x1d137c]={'$like':'%'+_0x73209d[_0xc759('0x41')][_0xc759('0x2e')]+'%'};return _0x4f354b;})});}_0x3819af=_[_0xc759('0x49')]({},_0x3819af,_0x73209d[_0xc759('0x4b')]);return _0x5e3e9b[_0xc759('0x67')](_0x3819af);}})['then'](function(_0x1f32b7){if(_0x1f32b7){_0x2f2198=_0x1f32b7[_0xc759('0x44')];if(!_0x73209d[_0xc759('0x41')]['hasOwnProperty'](_0xc759('0x45'))){_0x3819af[_0xc759('0x21')]=qs[_0xc759('0x21')](_0x73209d[_0xc759('0x41')]['limit']);_0x3819af[_0xc759('0x1f')]=qs['offset'](_0x73209d[_0xc759('0x41')][_0xc759('0x1f')]);}return _0x5e3e9b['getTeams'](_0x3819af);}})[_0xc759('0x27')](function(_0x563ae6){if(_0x563ae6){return _0x563ae6?{'count':_0x2f2198,'rows':_0x563ae6}:null;}})[_0xc759('0x27')](respondWithResult(_0x1b5678,null))[_0xc759('0x4e')](handleError(_0x1b5678,null));};exports[_0xc759('0x68')]=function(_0x1e66ee,_0x54ac9a,_0x5a45da){var _0x3d989c=_0x1e66ee[_0xc759('0x5a')][_0xc759('0x69')];var _0x1d831f=_[_0xc759('0x2f')](_0x3d989c,'id');return db[_0xc759('0x6a')][_0xc759('0x60')]({'where':{'id':_0x1d831f},'attributes':['id'],'include':[{'model':db[_0xc759('0x6b')],'as':_0xc759('0x6c'),'attributes':['id',_0xc759('0x34'),_0xc759('0x6d'),_0xc759('0x6e'),_0xc759('0x6f')],'raw':!![]}]})['then'](function(_0x18e5b0){if(_0x18e5b0){var _0x5523f7=_[_0xc759('0x70')](_0x18e5b0,function(_0x31cfb3){var _0xd9ad9a=_0x31cfb3[_0xc759('0x29')]({'plain':!![]});_0xd9ad9a['Agents'][_0xc759('0x71')](function(_0x42fb27){_0x42fb27[_0xc759('0x72')]=_['find'](_0x3d989c,{'id':_0xd9ad9a['id']})[_0xc759('0x72')];});return _0xd9ad9a[_0xc759('0x6c')];});return db['VoiceQueue']['find']({'where':{'id':_0x1e66ee[_0xc759('0x50')]['id']}})[_0xc759('0x27')](function(_0x3071ed){return db['sequelize'][_0xc759('0x73')](function(_0x33a581){return _0x3071ed[_0xc759('0x68')](_0x1d831f,{'transaction':_0x33a581})['then'](function(){return BPromise['each'](_0x3d989c,function(_0x3d9df9){return db[_0xc759('0x74')][_0xc759('0x75')]({'TeamId':_0x3d9df9['id'],'VoiceQueueId':_0x1e66ee[_0xc759('0x50')]['id'],'penalty':_0x3d9df9[_0xc759('0x72')]},{'transaction':_0x33a581});});})[_0xc759('0x27')](function(){return BPromise[_0xc759('0x76')](_0x5523f7,function(_0xf6073c){return db['UserVoiceQueue'][_0xc759('0x77')]({'where':{'UserId':_0xf6073c['id'],'VoiceQueueId':_0x1e66ee[_0xc759('0x50')]['id']},'defaults':{'penalty':_0xf6073c[_0xc759('0x72')]},'transaction':_0x33a581});});})[_0xc759('0x27')](function(){return BPromise[_0xc759('0x76')](_[_0xc759('0x2e')](_0x5523f7,{'online':!![]}),function(_0xd3cfc7){return db['UserVoiceQueueRt'][_0xc759('0x75')]({'membername':_0xd3cfc7[_0xc759('0x34')],'UserId':_0xd3cfc7['id'],'queue_name':_0x3071ed[_0xc759('0x34')],'VoiceQueueId':_0x3071ed['id'],'interface':_[_0xc759('0x78')](_0xd3cfc7[_0xc759('0x6f')])?util[_0xc759('0x79')]('SIP/%s',_0xd3cfc7[_0xc759('0x34')]):_0xd3cfc7[_0xc759('0x6f')],'paused':_0xd3cfc7[_0xc759('0x6e')]||![],'penalty':_0xd3cfc7[_0xc759('0x72')]},{'transaction':_0x33a581});});})['then'](function(){_0x5523f7[_0xc759('0x71')](function(_0x168bf2){socket[_0xc759('0x7a')](_0xc759('0x7b'),{'UserId':_0x168bf2['id'],'VoiceQueueId':_0x3071ed['id']});});});});});}})['then'](respondWithStatusCode(_0x54ac9a,null))[_0xc759('0x4e')](handleError(_0x54ac9a,null));};exports[_0xc759('0x7c')]=function(_0x487f13,_0x8a44a2,_0x5aea64){return db[_0xc759('0x6a')]['findAll']({'where':{'id':_0x487f13[_0xc759('0x41')][_0xc759('0x7d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc759('0x27')](handleEntityNotFound(_0x8a44a2,null))[_0xc759('0x27')](function(_0x5b11a5){var _0x64a4f6=_[_0xc759('0x2f')](_0x5b11a5,'id');var _0x8ca515=[];var _0x30f0c0=[];var _0x1320e5=squel[_0xc759('0x7e')]();_0x1320e5['field'](_0xc759('0x7f'))[_0xc759('0x80')](_0xc759('0x81'),'tq')[_0xc759('0x82')](_0xc759('0x83'),'ut',_0xc759('0x84'))['where'](_0xc759('0x85'),_0x487f13[_0xc759('0x50')]['id']);for(var _0x3268b4=0x0;_0x3268b4<_0x5b11a5[_0xc759('0x44')];_0x3268b4+=0x1){let _0x55e9a6=_0x5b11a5[_0x3268b4];for(var _0x1b9ccb=0x0;_0x1b9ccb<_0x55e9a6['Agents']['length'];_0x1b9ccb+=0x1){let _0x140fdc=_0x55e9a6['Agents'][_0x1b9ccb];var _0x5cd231=_0x1320e5[_0xc759('0x86')]();_0x5cd231[_0xc759('0x48')](_0xc759('0x87'),_0x140fdc['id']);_0x30f0c0['push'](db[_0xc759('0x88')]['query'](_0x5cd231['toString'](),{'type':db[_0xc759('0x88')][_0xc759('0x89')][_0xc759('0x8a')]})['then'](function(_0x454b3a){if(_0x454b3a['length']===0x1){return _0x140fdc['id'];}else{var _0xd5d865=_[_0xc759('0x8b')](_[_0xc759('0x2f')](_0x454b3a,_0xc759('0x8c')),function(_0x2076aa){return _[_0xc759('0x31')](_0x64a4f6,_0x2076aa);});if(_0xd5d865){return _0x140fdc['id'];}}}));}}return BPromise[_0xc759('0x8d')](_0x30f0c0)['then'](function(_0x5c5872){_0x8ca515=_(_0x8ca515)['union'](_0x5c5872)[_0xc759('0x8e')]()[_0xc759('0x30')]();return db[_0xc759('0x39')]['find']({'where':{'id':_0x487f13[_0xc759('0x50')]['id']}})[_0xc759('0x27')](function(_0x99f9e5){return db[_0xc759('0x88')]['transaction'](function(_0xcd2647){return _0x99f9e5['removeTeams'](_0x487f13[_0xc759('0x41')][_0xc759('0x7d')],{'transaction':_0xcd2647})['then'](function(){if(!_['isEmpty'](_0x8ca515)){return _0x99f9e5[_0xc759('0x8f')](_0x8ca515,{'transaction':_0xcd2647})[_0xc759('0x27')](function(){return db[_0xc759('0x90')]['destroy']({'where':{'VoiceQueueId':_0x487f13[_0xc759('0x50')]['id'],'UserId':_0x8ca515},'transaction':_0xcd2647});});}})[_0xc759('0x27')](function(){_0x8ca515[_0xc759('0x71')](function(_0x2f2bac){socket[_0xc759('0x7a')](_0xc759('0x91'),{'UserId':_0x2f2bac,'VoiceQueueId':_0x99f9e5['id']});});});});});});})[_0xc759('0x27')](respondWithStatusCode(_0x8a44a2,null))[_0xc759('0x4e')](handleError(_0x8a44a2,null));};exports[_0xc759('0x92')]=function(_0x3a326e,_0x540426,_0x2cd491){var _0x497ce3,_0x44a47f;return db[_0xc759('0x39')]['find']({'where':{'id':_0x3a326e[_0xc759('0x50')]['id']}})['then'](handleEntityNotFound(_0x540426,null))[_0xc759('0x27')](function(_0x45cfbb){if(_0x45cfbb){_0x44a47f=_0x45cfbb;return _0x45cfbb['addAgents'](_0x3a326e['body'][_0xc759('0x7d')],_[_0xc759('0x58')](_0x3a326e['body'],['ids','id'])||{})[_0xc759('0x93')](function(_0x1aa5c3){for(var _0x2875a4=0x0;_0x2875a4<_0x3a326e[_0xc759('0x5a')][_0xc759('0x7d')]['length'];_0x2875a4+=0x1){socket[_0xc759('0x7a')](_0xc759('0x7b'),{'UserId':Number(_0x3a326e[_0xc759('0x5a')]['ids'][_0x2875a4]),'VoiceQueueId':Number(_0x3a326e['params']['id'])});}return _0x1aa5c3;});}})[_0xc759('0x27')](function(_0x2e7b49){_0x497ce3=_0x2e7b49||[];if(_0x44a47f){return db[_0xc759('0x6b')][_0xc759('0x60')]({'where':{'id':_0x3a326e['body'][_0xc759('0x7d')]},'attributes':['id',_0xc759('0x34'),_0xc759('0x6d'),_0xc759('0x6e'),'interface'],'raw':!![]});}})[_0xc759('0x27')](function(_0x34dedf){if(!_['isEmpty'](_0x34dedf)){var _0x193115=[];for(var _0x1a0449=0x0;_0x1a0449<_0x34dedf[_0xc759('0x44')];_0x1a0449++){if(_0x34dedf[_0x1a0449][_0xc759('0x6d')]){_0x193115['push'](db[_0xc759('0x90')]['upsert']({'membername':_0x34dedf[_0x1a0449][_0xc759('0x34')],'UserId':_0x34dedf[_0x1a0449]['id'],'queue_name':_0x44a47f['name'],'VoiceQueueId':_0x44a47f['id'],'interface':_[_0xc759('0x78')](_0x34dedf[_0x1a0449][_0xc759('0x6f')])?util[_0xc759('0x79')]('SIP/%s',_0x34dedf[_0x1a0449][_0xc759('0x34')]):_0x34dedf[_0x1a0449][_0xc759('0x6f')],'paused':_0x34dedf[_0x1a0449][_0xc759('0x6e')]||![],'penalty':_0x3a326e[_0xc759('0x5a')][_0xc759('0x72')]||0x0}));}}return BPromise[_0xc759('0x8d')](_0x193115);}})[_0xc759('0x27')](function(){return _0x497ce3;})[_0xc759('0x27')](respondWithResult(_0x540426,null))[_0xc759('0x4e')](handleError(_0x540426,null));};exports[_0xc759('0x8f')]=function(_0x587563,_0x2b029e,_0x21d93a){return db[_0xc759('0x39')]['find']({'where':{'id':_0x587563[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x2b029e,null))[_0xc759('0x27')](function(_0x6bb09e){if(_0x6bb09e){return _0x6bb09e['removeAgents'](_0x587563['query'][_0xc759('0x7d')])[_0xc759('0x27')](function(){if(_[_0xc759('0x94')](_0x587563[_0xc759('0x41')][_0xc759('0x7d')])){for(var _0x21ca66=0x0;_0x21ca66<_0x587563[_0xc759('0x41')][_0xc759('0x7d')][_0xc759('0x44')];_0x21ca66+=0x1){socket['emit'](_0xc759('0x91'),{'UserId':Number(_0x587563[_0xc759('0x41')][_0xc759('0x7d')][_0x21ca66]),'VoiceQueueId':Number(_0x587563[_0xc759('0x50')]['id'])});}}else{socket[_0xc759('0x7a')]('userVoiceQueue:remove',{'UserId':Number(_0x587563[_0xc759('0x41')][_0xc759('0x7d')]),'VoiceQueueId':Number(_0x587563['params']['id'])});}});}})[_0xc759('0x27')](function(_0x3a82a5){return db[_0xc759('0x90')][_0xc759('0x28')]({'where':{'VoiceQueueId':_0x587563[_0xc759('0x50')]['id'],'UserId':_0x587563[_0xc759('0x41')][_0xc759('0x7d')]}})[_0xc759('0x27')](function(){return _0x3a82a5;});})['then'](respondWithStatusCode(_0x2b029e,null))[_0xc759('0x4e')](handleError(_0x2b029e,null));};exports[_0xc759('0x95')]=function(_0x2fa80e,_0x1e4cc2,_0xb719d2){var _0x388f2c={};var _0x449ca6={};var _0x39b6af;var _0x14b3c4;return db['VoiceQueue']['findOne']({'where':{'id':_0x2fa80e['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x1e4cc2,null))[_0xc759('0x27')](function(_0x258c1c){if(_0x258c1c){_0x39b6af=_0x258c1c;_0x449ca6[_0xc759('0x3d')]=_['keys'](db[_0xc759('0x6b')][_0xc759('0x3a')]);_0x449ca6['query']=_['keys'](_0x2fa80e['query']);_0x449ca6['filters']=_[_0xc759('0x40')](_0x449ca6[_0xc759('0x3d')],_0x449ca6['query']);_0x388f2c[_0xc759('0x43')]=_['intersection'](_0x449ca6[_0xc759('0x3d')],qs[_0xc759('0x42')](_0x2fa80e[_0xc759('0x41')]['fields']));_0x388f2c[_0xc759('0x43')]=_0x388f2c[_0xc759('0x43')][_0xc759('0x44')]?_0x388f2c[_0xc759('0x43')]:_0x449ca6[_0xc759('0x3d')];_0x388f2c['order']=qs['sort'](_0x2fa80e[_0xc759('0x41')][_0xc759('0x47')]);_0x388f2c[_0xc759('0x48')]=qs[_0xc759('0x3f')](_['pick'](_0x2fa80e[_0xc759('0x41')],_0x449ca6[_0xc759('0x3f')]));if(_0x2fa80e[_0xc759('0x41')]['filter']){_0x388f2c[_0xc759('0x48')]=_[_0xc759('0x49')](_0x388f2c[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0x388f2c[_0xc759('0x43')],function(_0x47034e){var _0x31c691={};_0x31c691[_0x47034e]={'$like':'%'+_0x2fa80e[_0xc759('0x41')]['filter']+'%'};return _0x31c691;})});}_0x388f2c=_[_0xc759('0x49')]({},_0x388f2c,_0x2fa80e[_0xc759('0x4b')]);return _0x39b6af[_0xc759('0x95')](_0x388f2c);}})[_0xc759('0x27')](function(_0x4cf8f7){if(_0x4cf8f7){_0x14b3c4=_0x4cf8f7['length'];if(!_0x2fa80e[_0xc759('0x41')][_0xc759('0x5f')](_0xc759('0x45'))){_0x388f2c[_0xc759('0x21')]=qs[_0xc759('0x21')](_0x2fa80e['query']['limit']);_0x388f2c[_0xc759('0x1f')]=qs['offset'](_0x2fa80e['query'][_0xc759('0x1f')]);}return _0x39b6af[_0xc759('0x95')](_0x388f2c);}})[_0xc759('0x27')](function(_0x52f816){if(_0x52f816){return _0x52f816?{'count':_0x14b3c4,'rows':_0x52f816}:null;}})[_0xc759('0x27')](respondWithResult(_0x1e4cc2,null))[_0xc759('0x4e')](handleError(_0x1e4cc2,null));};exports['getMembers']=function(_0x1eca0a,_0x2695b0,_0x468293){var _0x5210f8={};var _0xa86ed0={};var _0x4ec3c2;var _0x41f023;return db[_0xc759('0x39')]['findOne']({'where':{'id':_0x1eca0a[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x2695b0,null))[_0xc759('0x27')](function(_0x17d651){if(_0x17d651){_0x4ec3c2=_0x17d651;_0xa86ed0[_0xc759('0x3d')]=_[_0xc759('0x3e')](db[_0xc759('0x90')][_0xc759('0x3a')]);_0xa86ed0[_0xc759('0x41')]=_[_0xc759('0x3e')](_0x1eca0a[_0xc759('0x41')]);_0xa86ed0[_0xc759('0x3f')]=_[_0xc759('0x40')](_0xa86ed0[_0xc759('0x3d')],_0xa86ed0[_0xc759('0x41')]);_0x5210f8[_0xc759('0x43')]=_[_0xc759('0x40')](_0xa86ed0['model'],qs[_0xc759('0x42')](_0x1eca0a[_0xc759('0x41')][_0xc759('0x42')]));_0x5210f8['attributes']=_0x5210f8['attributes'][_0xc759('0x44')]?_0x5210f8[_0xc759('0x43')]:_0xa86ed0[_0xc759('0x3d')];_0x5210f8[_0xc759('0x46')]=qs[_0xc759('0x47')](_0x1eca0a[_0xc759('0x41')][_0xc759('0x47')]);_0x5210f8[_0xc759('0x48')]=qs[_0xc759('0x3f')](_[_0xc759('0x61')](_0x1eca0a[_0xc759('0x41')],_0xa86ed0['filters']));if(_0x1eca0a[_0xc759('0x41')]['filter']){_0x5210f8[_0xc759('0x48')]=_[_0xc759('0x49')](_0x5210f8[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0x5210f8['attributes'],function(_0x2539c9){var _0x5731de={};_0x5731de[_0x2539c9]={'$like':'%'+_0x1eca0a[_0xc759('0x41')]['filter']+'%'};return _0x5731de;})});}_0x5210f8=_[_0xc759('0x49')]({},_0x5210f8,_0x1eca0a[_0xc759('0x4b')]);return _0x4ec3c2[_0xc759('0x96')](_0x5210f8);}})[_0xc759('0x27')](function(_0x24ced8){if(_0x24ced8){_0x41f023=_0x24ced8[_0xc759('0x44')];if(!_0x1eca0a[_0xc759('0x41')]['hasOwnProperty']('nolimit')){_0x5210f8['limit']=qs[_0xc759('0x21')](_0x1eca0a[_0xc759('0x41')]['limit']);_0x5210f8[_0xc759('0x1f')]=qs[_0xc759('0x1f')](_0x1eca0a[_0xc759('0x41')]['offset']);}return _0x4ec3c2['getMembers'](_0x5210f8);}})[_0xc759('0x27')](function(_0x1710b9){return _0x1710b9?{'count':_0x41f023,'rows':_0x1710b9}:null;})[_0xc759('0x27')](respondWithResult(_0x2695b0,null))[_0xc759('0x4e')](handleError(_0x2695b0,null));};exports[_0xc759('0x97')]=function(_0x19d983,_0x3a2714,_0x59ee60){var _0x3e688e={};var _0x5c694e={};var _0x245500;var _0x211b31;return db[_0xc759('0x39')][_0xc759('0x5d')]({'where':{'id':_0x19d983['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x3a2714,null))[_0xc759('0x27')](function(_0x4602e2){if(_0x4602e2){_0x245500=_0x4602e2;_0x5c694e['model']=_[_0xc759('0x3e')](db[_0xc759('0x98')][_0xc759('0x3a')]);_0x5c694e[_0xc759('0x41')]=_[_0xc759('0x3e')](_0x19d983[_0xc759('0x41')]);_0x5c694e[_0xc759('0x3f')]=_[_0xc759('0x40')](_0x5c694e[_0xc759('0x3d')],_0x5c694e[_0xc759('0x41')]);_0x3e688e[_0xc759('0x43')]=_['intersection'](_0x5c694e['model'],qs[_0xc759('0x42')](_0x19d983[_0xc759('0x41')][_0xc759('0x42')]));_0x3e688e['attributes']=_0x3e688e[_0xc759('0x43')][_0xc759('0x44')]?_0x3e688e[_0xc759('0x43')]:_0x5c694e[_0xc759('0x3d')];_0x3e688e[_0xc759('0x46')]=qs[_0xc759('0x47')](_0x19d983[_0xc759('0x41')][_0xc759('0x47')]);_0x3e688e[_0xc759('0x48')]=qs['filters'](_['pick'](_0x19d983[_0xc759('0x41')],_0x5c694e[_0xc759('0x3f')]));if(_0x19d983[_0xc759('0x41')][_0xc759('0x2e')]){_0x3e688e[_0xc759('0x48')]=_[_0xc759('0x49')](_0x3e688e['where'],{'$or':_['map'](_0x3e688e[_0xc759('0x43')],function(_0x5c5247){var _0x18f151={};_0x18f151[_0x5c5247]={'$like':'%'+_0x19d983[_0xc759('0x41')][_0xc759('0x2e')]+'%'};return _0x18f151;})});}_0x3e688e=_[_0xc759('0x49')]({},_0x3e688e,_0x19d983[_0xc759('0x4b')]);return _0x245500['getLists'](_0x3e688e);}})['then'](function(_0xa35c84){if(_0xa35c84){_0x211b31=_0xa35c84[_0xc759('0x44')];if(!_0x19d983[_0xc759('0x41')][_0xc759('0x5f')](_0xc759('0x45'))){_0x3e688e[_0xc759('0x21')]=qs[_0xc759('0x21')](_0x19d983[_0xc759('0x41')]['limit']);_0x3e688e['offset']=qs[_0xc759('0x1f')](_0x19d983[_0xc759('0x41')][_0xc759('0x1f')]);}return _0x245500[_0xc759('0x97')](_0x3e688e);}})[_0xc759('0x27')](function(_0x5ec47b){if(_0x5ec47b){return _0x5ec47b?{'count':_0x211b31,'rows':_0x5ec47b}:null;}})[_0xc759('0x27')](respondWithResult(_0x3a2714,null))['catch'](handleError(_0x3a2714,null));};exports[_0xc759('0x99')]=function(_0x440972,_0x866ab5,_0x3e63ba){var _0x2862cc,_0x41a2f7;return db[_0xc759('0x39')]['find']({'where':{'id':_0x440972['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x866ab5,null))['then'](function(_0x4267b3){if(_0x4267b3){_0x41a2f7=_0x4267b3;return _0x4267b3[_0xc759('0x99')](_0x440972[_0xc759('0x5a')]['ids'],_[_0xc759('0x58')](_0x440972[_0xc759('0x5a')],[_0xc759('0x7d'),'id'])||{});}return null;})[_0xc759('0x93')](function(_0x3838de){var _0x393957;_0x2862cc=_0x3838de||[];var _0xe9668a=[];if(_0x3838de){for(var _0x525b5a=0x0;_0x525b5a<_0x3838de[_0xc759('0x44')];_0x525b5a+=0x1){var _0x1950c8=_0x3838de[_0x525b5a][_0xc759('0x29')]({'plain':!![]});_0x41a2f7[_0xc759('0x9a')]=_0x440972[_0xc759('0x5a')][_0xc759('0x9a')]?_0x440972[_0xc759('0x5a')]['dialCheckDuplicateType']:_0x41a2f7[_0xc759('0x9a')];switch(_0x41a2f7[_0xc759('0x9a')]){case _0xc759('0x9b'):_0x393957=squel[_0xc759('0x9c')]()[_0xc759('0x9d')](_0xc759('0x9e'))[_0xc759('0x9f')]([_0xc759('0xa0'),_0xc759('0xa1'),'ContactId',_0xc759('0xa2'),_0xc759('0x62'),_0xc759('0x59'),_0xc759('0x5b')],squel[_0xc759('0x7e')]()[_0xc759('0xa3')]('phone',_0xc759('0xa0'))[_0xc759('0xa3')](_0xc759('0xa4'),_0xc759('0xa1'))[_0xc759('0xa3')]('id','ContactId')[_0xc759('0xa3')](_0x1950c8['CmListId']['toString'](),_0xc759('0xa2'))[_0xc759('0xa3')](_0x440972['params']['id'][_0xc759('0xa5')](),_0xc759('0x62'))[_0xc759('0xa3')](_0xc759('0xa4'),'createdAt')[_0xc759('0xa3')](_0xc759('0xa4'),'updatedAt')[_0xc759('0x80')]('cm_contacts')[_0xc759('0x48')]('deletedAt\x20IS\x20NULL')[_0xc759('0x48')](_0xc759('0xa6'),_0x1950c8['CmListId']['toString']())[_0xc759('0x48')](_0xc759('0xa7'))[_0xc759('0x48')](_0xc759('0xa8'),squel['select']()[_0xc759('0xa3')](_0xc759('0xa9'))[_0xc759('0x80')](_0xc759('0xaa'))[_0xc759('0x48')](_0xc759('0x85'),_0x440972['params']['id']['toString']()))[_0xc759('0x48')](_0xc759('0xa8'),squel[_0xc759('0x7e')]()['field'](_0xc759('0xab'))[_0xc759('0x80')]('cm_hopper')[_0xc759('0x48')](_0xc759('0x85'),_0x440972['params']['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x393957=squel['insert']()[_0xc759('0x9d')]('cm_hopper')[_0xc759('0x9f')]([_0xc759('0xa0'),'scheduledAt',_0xc759('0xac'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xc759('0x7e')]()[_0xc759('0xa3')](_0xc759('0xa0'),'phone')[_0xc759('0xa3')](_0xc759('0xa4'),'scheduledAt')[_0xc759('0xa3')]('id',_0xc759('0xac'))[_0xc759('0xa3')](_0x1950c8[_0xc759('0xad')][_0xc759('0xa5')](),_0xc759('0xa2'))['field'](_0x440972['params']['id'][_0xc759('0xa5')](),'VoiceQueueId')[_0xc759('0xa3')](_0xc759('0xa4'),_0xc759('0x59'))[_0xc759('0xa3')]('NOW()','updatedAt')['from'](_0xc759('0xae'))[_0xc759('0x48')](_0xc759('0xaf'))['where'](_0xc759('0xa6'),_0x1950c8[_0xc759('0xad')][_0xc759('0xa5')]())[_0xc759('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0xc759('0x48')](_0xc759('0xa8'),squel[_0xc759('0x7e')]()['field'](_0xc759('0xab'))[_0xc759('0x80')](_0xc759('0x9e'))['where'](_0xc759('0x85'),_0x440972[_0xc759('0x50')]['id'][_0xc759('0xa5')]())))[_0xc759('0xa5')]();break;default:_0x393957=squel['insert']()[_0xc759('0x9d')]('cm_hopper')[_0xc759('0x9f')]([_0xc759('0xa0'),'scheduledAt',_0xc759('0xac'),'ListId',_0xc759('0x62'),_0xc759('0x59'),_0xc759('0x5b')],squel[_0xc759('0x7e')]()['field'](_0xc759('0xa0'),_0xc759('0xa0'))[_0xc759('0xa3')]('NOW()','scheduledAt')[_0xc759('0xa3')]('id','ContactId')[_0xc759('0xa3')](_0x1950c8[_0xc759('0xad')][_0xc759('0xa5')](),'ListId')[_0xc759('0xa3')](_0x440972[_0xc759('0x50')]['id']['toString'](),'VoiceQueueId')[_0xc759('0xa3')](_0xc759('0xa4'),_0xc759('0x59'))[_0xc759('0xa3')](_0xc759('0xa4'),_0xc759('0x5b'))[_0xc759('0x80')](_0xc759('0xae'))[_0xc759('0x48')]('deletedAt\x20IS\x20NULL')[_0xc759('0x48')](_0xc759('0xa6'),_0x1950c8[_0xc759('0xad')][_0xc759('0xa5')]())[_0xc759('0x48')](_0xc759('0xa7')))[_0xc759('0xa5')]();}_0xe9668a['push'](db[_0xc759('0x88')][_0xc759('0x41')](_0x393957));}return BPromise['all'](_0xe9668a);}})[_0xc759('0x27')](function(){return _0x2862cc;})[_0xc759('0x27')](respondWithResult(_0x866ab5,null))[_0xc759('0x4e')](handleError(_0x866ab5,null));};exports[_0xc759('0xb0')]=function(_0x2f05a8,_0x5b7610,_0x4f6119){return db[_0xc759('0x39')][_0xc759('0x33')]({'where':{'id':_0x2f05a8['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x5b7610,null))[_0xc759('0x27')](function(_0x15d452){if(_0x15d452){return _0x15d452[_0xc759('0xb0')](_0x2f05a8['query'][_0xc759('0x7d')]);}})[_0xc759('0x27')](function(_0x502dc9){if(_0x502dc9){return db[_0xc759('0x5e')][_0xc759('0x28')]({'where':{'ListId':_0x2f05a8[_0xc759('0x41')][_0xc759('0x7d')],'VoiceQueueId':_0x2f05a8[_0xc759('0x50')]['id']}})['then'](function(){return _0x502dc9;});}})[_0xc759('0x27')](respondWithStatusCode(_0x5b7610,null))[_0xc759('0x4e')](handleError(_0x5b7610,null));};exports['getBlackLists']=function(_0x294c0a,_0x5049ad,_0xc2ad37){var _0x3d87a7={};var _0x575c3a={};var _0x4a1ab5;var _0x35dbfd;return db[_0xc759('0x39')]['findOne']({'where':{'id':_0x294c0a[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x5049ad,null))[_0xc759('0x27')](function(_0x5be3b4){if(_0x5be3b4){_0x4a1ab5=_0x5be3b4;_0x575c3a[_0xc759('0x3d')]=_[_0xc759('0x3e')](db[_0xc759('0x98')][_0xc759('0x3a')]);_0x575c3a[_0xc759('0x41')]=_[_0xc759('0x3e')](_0x294c0a[_0xc759('0x41')]);_0x575c3a[_0xc759('0x3f')]=_[_0xc759('0x40')](_0x575c3a[_0xc759('0x3d')],_0x575c3a[_0xc759('0x41')]);_0x3d87a7['attributes']=_['intersection'](_0x575c3a['model'],qs[_0xc759('0x42')](_0x294c0a[_0xc759('0x41')]['fields']));_0x3d87a7[_0xc759('0x43')]=_0x3d87a7['attributes'][_0xc759('0x44')]?_0x3d87a7[_0xc759('0x43')]:_0x575c3a['model'];_0x3d87a7[_0xc759('0x46')]=qs['sort'](_0x294c0a[_0xc759('0x41')][_0xc759('0x47')]);_0x3d87a7[_0xc759('0x48')]=qs[_0xc759('0x3f')](_[_0xc759('0x61')](_0x294c0a[_0xc759('0x41')],_0x575c3a[_0xc759('0x3f')]));if(_0x294c0a['query'][_0xc759('0x2e')]){_0x3d87a7[_0xc759('0x48')]=_['merge'](_0x3d87a7[_0xc759('0x48')],{'$or':_[_0xc759('0x2f')](_0x3d87a7[_0xc759('0x43')],function(_0x5ea5c3){var _0x40486c={};_0x40486c[_0x5ea5c3]={'$like':'%'+_0x294c0a['query']['filter']+'%'};return _0x40486c;})});}_0x3d87a7=_[_0xc759('0x49')]({},_0x3d87a7,_0x294c0a['options']);return _0x4a1ab5[_0xc759('0xb1')](_0x3d87a7);}})['then'](function(_0xc18535){if(_0xc18535){_0x35dbfd=_0xc18535[_0xc759('0x44')];if(!_0x294c0a['query']['hasOwnProperty'](_0xc759('0x45'))){_0x3d87a7[_0xc759('0x21')]=qs['limit'](_0x294c0a[_0xc759('0x41')][_0xc759('0x21')]);_0x3d87a7[_0xc759('0x1f')]=qs[_0xc759('0x1f')](_0x294c0a[_0xc759('0x41')]['offset']);}return _0x4a1ab5['getBlackLists'](_0x3d87a7);}})[_0xc759('0x27')](function(_0x1935c1){if(_0x1935c1){return _0x1935c1?{'count':_0x35dbfd,'rows':_0x1935c1}:null;}})['then'](respondWithResult(_0x5049ad,null))[_0xc759('0x4e')](handleError(_0x5049ad,null));};exports[_0xc759('0xb2')]=function(_0x21ba40,_0x526fdf,_0x2d7b45){var _0x57077f,_0x36bd64;return db[_0xc759('0x39')][_0xc759('0x33')]({'where':{'id':_0x21ba40[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x526fdf,null))[_0xc759('0x27')](function(_0xfc3ca3){if(_0xfc3ca3){_0x36bd64=_0xfc3ca3;return _0xfc3ca3[_0xc759('0xb2')](_0x21ba40[_0xc759('0x5a')][_0xc759('0x7d')],_[_0xc759('0x58')](_0x21ba40[_0xc759('0x5a')],['ids','id'])||{});}return null;})[_0xc759('0x93')](function(_0x187a59){var _0x25dce0;_0x57077f=_0x187a59||[];var _0x3c74f2=[];if(_0x187a59){for(var _0x23097e=0x0;_0x23097e<_0x187a59[_0xc759('0x44')];_0x23097e+=0x1){var _0x3b02d9=_0x187a59[_0x23097e][_0xc759('0x29')]({'plain':!![]});_0x25dce0=squel[_0xc759('0x9c')]()[_0xc759('0x9d')]('cm_hopper_black')[_0xc759('0x9f')]([_0xc759('0xa0'),_0xc759('0xac'),_0xc759('0xa2'),_0xc759('0x62'),_0xc759('0x59'),'updatedAt'],squel[_0xc759('0x7e')]()[_0xc759('0xa3')]('phone',_0xc759('0xa0'))['field']('id',_0xc759('0xac'))['field'](_0x3b02d9['CmListId'][_0xc759('0xa5')](),_0xc759('0xa2'))['field'](_0x21ba40['params']['id']['toString'](),'VoiceQueueId')[_0xc759('0xa3')]('NOW()','createdAt')[_0xc759('0xa3')](_0xc759('0xa4'),'updatedAt')[_0xc759('0x80')](_0xc759('0xae'))['where'](_0xc759('0xaf'))['where'](_0xc759('0xa6'),_0x3b02d9[_0xc759('0xad')][_0xc759('0xa5')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc759('0xa5')]();_0x3c74f2[_0xc759('0xb3')](db['sequelize'][_0xc759('0x41')](_0x25dce0));}return BPromise[_0xc759('0x8d')](_0x3c74f2);}})[_0xc759('0x27')](function(){return _0x57077f;})[_0xc759('0x27')](respondWithResult(_0x526fdf,null))[_0xc759('0x4e')](handleError(_0x526fdf,null));};exports[_0xc759('0xb4')]=function(_0xd7ca4e,_0x34b1be,_0x4e0c6a){return db[_0xc759('0x39')][_0xc759('0x33')]({'where':{'id':_0xd7ca4e[_0xc759('0x50')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x34b1be,null))[_0xc759('0x27')](function(_0x109652){if(_0x109652){return _0x109652[_0xc759('0xb4')](_0xd7ca4e[_0xc759('0x41')]['ids']);}})[_0xc759('0x27')](function(_0x5c3700){if(_0x5c3700){return db[_0xc759('0x66')][_0xc759('0x28')]({'where':{'ListId':_0xd7ca4e[_0xc759('0x41')][_0xc759('0x7d')],'VoiceQueueId':_0xd7ca4e[_0xc759('0x50')]['id']}})[_0xc759('0x27')](function(){return _0x5c3700;});}})[_0xc759('0x27')](respondWithStatusCode(_0x34b1be,null))[_0xc759('0x4e')](handleError(_0x34b1be,null));}; \ No newline at end of file +var _0x31d7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','get','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','map','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','QueueCampaigns','UserProfileSection','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','interface','flatMap','forEach','sequelize','TeamVoiceQueue','upsert','penalty','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','transaction','removeTeams','ids','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','ListId','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x331398,_0x36b167){var _0x29690b=function(_0x296ec5){while(--_0x296ec5){_0x331398['push'](_0x331398['shift']());}};_0x29690b(++_0x36b167);}(_0x31d7,0x168));var _0x731d=function(_0xf2b9c9,_0x31aeae){_0xf2b9c9=_0xf2b9c9-0x0;var _0x1420c5=_0x31d7[_0xf2b9c9];return _0x1420c5;};'use strict';var emlformat=require(_0x731d('0x0'));var rimraf=require(_0x731d('0x1'));var zipdir=require(_0x731d('0x2'));var jsonpatch=require(_0x731d('0x3'));var rp=require(_0x731d('0x4'));var moment=require(_0x731d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x731d('0x6'));var path=require(_0x731d('0x7'));var sox=require(_0x731d('0x8'));var csv=require(_0x731d('0x9'));var ejs=require(_0x731d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x731d('0xb'));var squel=require(_0x731d('0xc'));var crypto=require('crypto');var jsforce=require(_0x731d('0xd'));var deskjs=require(_0x731d('0xe'));var toCsv=require(_0x731d('0x9'));var querystring=require(_0x731d('0xf'));var Papa=require(_0x731d('0x10'));var Redis=require(_0x731d('0x11'));var authService=require(_0x731d('0x12'));var qs=require(_0x731d('0x13'));var as=require(_0x731d('0x14'));var hardwareService=require(_0x731d('0x15'));var logger=require('../../config/logger')(_0x731d('0x16'));var utils=require(_0x731d('0x17'));var config=require(_0x731d('0x18'));var licenseUtil=require(_0x731d('0x19'));var db=require(_0x731d('0x1a'))['db'];config[_0x731d('0x1b')]=_[_0x731d('0x1c')](config[_0x731d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x731d('0x1d'))(new Redis(config[_0x731d('0x1b')]));require(_0x731d('0x1e'))[_0x731d('0x1f')](socket);function respondWithStatusCode(_0x3f256e,_0x4a49b7){_0x4a49b7=_0x4a49b7||0xcc;return function(_0x22e91c){if(_0x22e91c){return _0x3f256e[_0x731d('0x20')](_0x4a49b7);}return _0x3f256e[_0x731d('0x21')](_0x4a49b7)[_0x731d('0x22')]();};}function respondWithResult(_0x5c193f,_0x37716e){_0x37716e=_0x37716e||0xc8;return function(_0x14238b){if(_0x14238b){return _0x5c193f[_0x731d('0x21')](_0x37716e)[_0x731d('0x23')](_0x14238b);}};}function respondWithFilteredResult(_0x35e90b,_0x15a375){return function(_0x23ef74){if(_0x23ef74){var _0x68675a=typeof _0x15a375[_0x731d('0x24')]===_0x731d('0x25')&&typeof _0x15a375['limit']===_0x731d('0x25');var _0x528453=_0x23ef74[_0x731d('0x26')];var _0x164556=_0x68675a?0x0:_0x15a375['offset'];var _0x190c34=_0x68675a?_0x23ef74[_0x731d('0x26')]:_0x15a375[_0x731d('0x24')]+_0x15a375['limit'];var _0xad2895;if(_0x190c34>=_0x528453){_0x190c34=_0x528453;_0xad2895=0xc8;}else{_0xad2895=0xce;}_0x35e90b[_0x731d('0x21')](_0xad2895);return _0x35e90b['set'](_0x731d('0x27'),_0x164556+'-'+_0x190c34+'/'+_0x528453)[_0x731d('0x23')](_0x23ef74);}return null;};}function patchUpdates(_0x144e75){return function(_0x447155){try{jsonpatch[_0x731d('0x28')](_0x447155,_0x144e75,!![]);}catch(_0x2c7497){return BPromise[_0x731d('0x29')](_0x2c7497);}return _0x447155[_0x731d('0x2a')]();};}function saveUpdates(_0x37ee48,_0x4ce0e5){return function(_0x53b0d0){if(_0x53b0d0){return _0x53b0d0['update'](_0x37ee48)[_0x731d('0x2b')](function(_0x4edcc9){return _0x4edcc9;});}return null;};}function removeEntity(_0xd875ee,_0x1fcaf1){return function(_0x4411df){if(_0x4411df){return _0x4411df['destroy']()['then'](function(){var _0x32d37f=_0x4411df[_0x731d('0x2c')]({'plain':!![]});var _0xf7561d=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x731d('0x2d'),'ignore':![]}];var _0x120b53=_(_0xf7561d)[_0x731d('0x2e')](_0x731d('0x2f'))['map']('value')[_0x731d('0x30')]();if(_[_0x731d('0x31')](_0x120b53,_0x32d37f[_0x731d('0x32')])){return;}var _0x4b598f=_[_0x731d('0x33')](_0xf7561d,['value',_0x32d37f[_0x731d('0x32')]])[_0x731d('0x34')];return db[_0x731d('0x35')][_0x731d('0x36')]({'where':{'type':_0x4b598f,'resourceId':_0x32d37f['id']}})[_0x731d('0x2b')](function(){return _0x4411df;});})['then'](function(){_0xd875ee[_0x731d('0x21')](0xcc)[_0x731d('0x22')]();});}};}function handleEntityNotFound(_0x3b1a66,_0x5d250f){return function(_0x4124de){if(!_0x4124de){_0x3b1a66[_0x731d('0x20')](0x194);}return _0x4124de;};}function handleError(_0x2d0d5f,_0x527a62){_0x527a62=_0x527a62||0x1f4;return function(_0x36abc5){logger[_0x731d('0x37')](_0x36abc5[_0x731d('0x38')]);if(_0x36abc5['name']){delete _0x36abc5[_0x731d('0x34')];}_0x2d0d5f['status'](_0x527a62)[_0x731d('0x39')](_0x36abc5);};}exports['index']=function(_0x211f7a,_0x46d684){var _0x54826c={},_0xfb8f85={},_0x49c64e={'count':0x0,'rows':[]};var _0x505617=_[_0x731d('0x3a')](db[_0x731d('0x3b')][_0x731d('0x3c')],function(_0x5e868f){return{'name':_0x5e868f['fieldName'],'type':_0x5e868f[_0x731d('0x32')][_0x731d('0x3d')]};});_0xfb8f85[_0x731d('0x3e')]=_[_0x731d('0x3a')](_0x505617,_0x731d('0x34'));_0xfb8f85[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x211f7a['query']);_0xfb8f85[_0x731d('0x41')]=_[_0x731d('0x42')](_0xfb8f85['model'],_0xfb8f85['query']);_0x54826c[_0x731d('0x43')]=_[_0x731d('0x42')](_0xfb8f85[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x211f7a['query']['fields']));_0x54826c['attributes']=_0x54826c['attributes'][_0x731d('0x45')]?_0x54826c['attributes']:_0xfb8f85['model'];if(!_0x211f7a[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x54826c[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x211f7a[_0x731d('0x3f')][_0x731d('0x48')]);_0x54826c[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x211f7a[_0x731d('0x3f')]['offset']);}_0x54826c[_0x731d('0x49')]=qs['sort'](_0x211f7a[_0x731d('0x3f')][_0x731d('0x4a')]);_0x54826c[_0x731d('0x4b')]=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x211f7a['query'],_0xfb8f85['filters']),_0x505617);if(_0x211f7a[_0x731d('0x3f')][_0x731d('0x2e')]){_0x54826c[_0x731d('0x4b')]=_[_0x731d('0x4d')](_0x54826c[_0x731d('0x4b')],{'$or':_[_0x731d('0x3a')](_0x505617,function(_0x73abc1){if(_0x73abc1[_0x731d('0x32')]!==_0x731d('0x4e')){var _0x128bb3={};_0x128bb3[_0x73abc1['name']]={'$like':'%'+_0x211f7a['query']['filter']+'%'};return _0x128bb3;}})});}_0x54826c=_[_0x731d('0x4d')]({},_0x54826c,_0x211f7a[_0x731d('0x4f')]);var _0x46ff83={'where':_0x54826c[_0x731d('0x4b')]};return db['VoiceQueue'][_0x731d('0x26')](_0x46ff83)[_0x731d('0x2b')](function(_0x57e81f){_0x49c64e[_0x731d('0x26')]=_0x57e81f;if(_0x211f7a['query'][_0x731d('0x50')]){_0x54826c[_0x731d('0x51')]=[{'all':!![]}];}return db[_0x731d('0x3b')][_0x731d('0x52')](_0x54826c);})[_0x731d('0x2b')](function(_0x17ac1e){_0x49c64e['rows']=_0x17ac1e;return _0x49c64e;})[_0x731d('0x2b')](respondWithFilteredResult(_0x46d684,_0x54826c))[_0x731d('0x53')](handleError(_0x46d684,null));};exports['show']=function(_0x53ae9a,_0x1b3f30){var _0x9b01a9={'raw':![],'where':{'id':_0x53ae9a[_0x731d('0x54')]['id']}},_0x56acbd={};_0x56acbd[_0x731d('0x3e')]=_['keys'](db[_0x731d('0x3b')][_0x731d('0x3c')]);_0x56acbd[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x53ae9a[_0x731d('0x3f')]);_0x56acbd[_0x731d('0x41')]=_[_0x731d('0x42')](_0x56acbd[_0x731d('0x3e')],_0x56acbd[_0x731d('0x3f')]);_0x9b01a9[_0x731d('0x43')]=_[_0x731d('0x42')](_0x56acbd[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x53ae9a['query']['fields']));_0x9b01a9['attributes']=_0x9b01a9[_0x731d('0x43')][_0x731d('0x45')]?_0x9b01a9[_0x731d('0x43')]:_0x56acbd[_0x731d('0x3e')];if(_0x53ae9a['query'][_0x731d('0x50')]){_0x9b01a9['include']=[{'all':!![]}];}_0x9b01a9=_[_0x731d('0x4d')]({},_0x9b01a9,_0x53ae9a[_0x731d('0x4f')]);return db[_0x731d('0x3b')][_0x731d('0x33')](_0x9b01a9)[_0x731d('0x2b')](handleEntityNotFound(_0x1b3f30,null))['then'](respondWithResult(_0x1b3f30,null))[_0x731d('0x53')](handleError(_0x1b3f30,null));};exports['create']=function(_0x35dd95,_0x106186){return db[_0x731d('0x3b')][_0x731d('0x55')](_0x35dd95['body'],{})[_0x731d('0x2b')](function(_0x23a2b2){var _0x4d9aa8=_0x35dd95[_0x731d('0x56')][_0x731d('0x2c')]({'plain':!![]});if(!_0x4d9aa8)throw new Error(_0x731d('0x57'));if(_0x4d9aa8[_0x731d('0x58')]===_0x731d('0x56')){var _0x33eb6f=_0x23a2b2[_0x731d('0x2c')]({'plain':!![]});var _0x5d443c=[{'name':'VoiceQueues','value':_0x731d('0x59')},{'name':'QueueCampaigns','value':_0x731d('0x2d')}];var _0x2e860e=_[_0x731d('0x33')](_0x5d443c,[_0x731d('0x30'),_0x33eb6f[_0x731d('0x32')]])[_0x731d('0x34')];return db['UserProfileSection'][_0x731d('0x33')]({'where':{'name':_0x2e860e,'userProfileId':_0x4d9aa8[_0x731d('0x5a')]},'raw':!![]})[_0x731d('0x2b')](function(_0x2c1a91){if(_0x2c1a91&&_0x2c1a91[_0x731d('0x5b')]===0x0){return db[_0x731d('0x35')]['create']({'name':_0x33eb6f['name'],'resourceId':_0x33eb6f['id'],'type':_0x2c1a91[_0x731d('0x34')],'sectionId':_0x2c1a91['id']},{})['then'](function(){return _0x23a2b2;});}else{return _0x23a2b2;}})[_0x731d('0x53')](function(_0x15032a){logger[_0x731d('0x37')](_0x731d('0x5c'),_0x15032a);throw _0x15032a;});}return _0x23a2b2;})['then'](respondWithResult(_0x106186,0xc9))[_0x731d('0x53')](handleError(_0x106186,null));};exports[_0x731d('0x5d')]=function(_0x110e5c,_0x439f11){var _0x10b9fa={'where':{'id':_0x110e5c[_0x731d('0x54')]['id']}},_0x1e4611={};_0x1e4611[_0x731d('0x3e')]=_[_0x731d('0x40')](db['VoiceQueue']['rawAttributes']);_0x10b9fa[_0x731d('0x43')]=_['intersection'](_0x1e4611[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x110e5c['query'][_0x731d('0x44')]));_0x10b9fa[_0x731d('0x43')]=_0x10b9fa[_0x731d('0x43')][_0x731d('0x45')]?_0x10b9fa[_0x731d('0x43')]:_0x1e4611['model'];if(_0x110e5c[_0x731d('0x3f')][_0x731d('0x50')]){_0x10b9fa['include']=[{'all':!![]}];}_0x10b9fa=_[_0x731d('0x4d')]({},_0x10b9fa,_0x110e5c[_0x731d('0x4f')]);return db[_0x731d('0x3b')]['find'](_0x10b9fa)[_0x731d('0x2b')](handleEntityNotFound(_0x439f11,null))['then'](function(_0x4affe5){if(_0x4affe5){var _0x456573=_0x4affe5['get']({'plain':!![]});_0x456573=qs[_0x731d('0x5e')](_0x456573,['id',_0x731d('0x5f'),_0x731d('0x60')]);_0x110e5c[_0x731d('0x61')]=_[_0x731d('0x5e')](_0x110e5c[_0x731d('0x61')],['id',_0x731d('0x5f'),'updatedAt']);return db[_0x731d('0x3b')][_0x731d('0x55')](_[_0x731d('0x4d')](_0x456573,_0x110e5c[_0x731d('0x61')]),{'include':_0x110e5c[_0x731d('0x3f')][_0x731d('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x42aef1){var _0x2787f8=_0x110e5c['user']['get']({'plain':!![]});if(!_0x2787f8)throw new Error(_0x731d('0x57'));if(_0x2787f8[_0x731d('0x58')]===_0x731d('0x56')){var _0x2ffb38=_0x42aef1['get']({'plain':!![]});var _0x3f5ec5=[{'name':'VoiceQueues','value':_0x731d('0x59')},{'name':_0x731d('0x62'),'value':_0x731d('0x2d')}];var _0x5286de=_[_0x731d('0x33')](_0x3f5ec5,[_0x731d('0x30'),_0x2ffb38[_0x731d('0x32')]])[_0x731d('0x34')];return db[_0x731d('0x63')][_0x731d('0x33')]({'where':{'name':_0x5286de,'userProfileId':_0x2787f8[_0x731d('0x5a')]},'raw':!![]})[_0x731d('0x2b')](function(_0x1478cb){if(_0x1478cb&&_0x1478cb[_0x731d('0x5b')]===0x0){return db[_0x731d('0x35')][_0x731d('0x55')]({'name':_0x2ffb38['name'],'resourceId':_0x2ffb38['id'],'type':_0x1478cb['name'],'sectionId':_0x1478cb['id']},{})[_0x731d('0x2b')](function(){return _0x42aef1;});}else{return _0x42aef1;}})[_0x731d('0x53')](function(_0x424763){logger[_0x731d('0x37')](_0x731d('0x5c'),_0x424763);throw _0x424763;});}return _0x42aef1;});}})['then'](respondWithResult(_0x439f11,0xc9))[_0x731d('0x53')](handleError(_0x439f11,null));};exports[_0x731d('0x64')]=function(_0x5a95e1,_0x3d1c11){if(_0x5a95e1['body']['id']){delete _0x5a95e1[_0x731d('0x61')]['id'];}return db['VoiceQueue'][_0x731d('0x33')]({'where':{'id':_0x5a95e1[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x3d1c11,null))[_0x731d('0x2b')](saveUpdates(_0x5a95e1['body'],null))[_0x731d('0x2b')](respondWithResult(_0x3d1c11,null))['catch'](handleError(_0x3d1c11,null));};exports[_0x731d('0x36')]=function(_0x1ea657,_0x1aa935){return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x1ea657[_0x731d('0x54')]['id']}})['then'](handleEntityNotFound(_0x1aa935,null))['then'](removeEntity(_0x1aa935,null))[_0x731d('0x53')](handleError(_0x1aa935,null));};exports[_0x731d('0x65')]=function(_0x508a5a,_0x9b443e,_0x3ee5be){var _0x40544f={'raw':![],'where':{}};var _0x4ac74d={};var _0x2d0f42={'count':0x0,'rows':[]};return db[_0x731d('0x3b')][_0x731d('0x66')]({'where':{'id':_0x508a5a[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x9b443e,null))[_0x731d('0x2b')](function(_0x4c7ca3){if(_0x4c7ca3){_0x4ac74d[_0x731d('0x3e')]=_['keys'](db[_0x731d('0x67')][_0x731d('0x3c')]);_0x4ac74d['query']=_['keys'](_0x508a5a[_0x731d('0x3f')]);_0x4ac74d[_0x731d('0x41')]=_['intersection'](_0x4ac74d['model'],_0x4ac74d[_0x731d('0x3f')]);_0x40544f['attributes']=_[_0x731d('0x42')](_0x4ac74d[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x508a5a['query'][_0x731d('0x44')]));_0x40544f[_0x731d('0x43')]=_0x40544f['attributes']['length']?_0x40544f['attributes']:_0x4ac74d[_0x731d('0x3e')];if(!_0x508a5a[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x40544f[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x508a5a[_0x731d('0x3f')][_0x731d('0x48')]);_0x40544f[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x508a5a[_0x731d('0x3f')]['offset']);}_0x40544f[_0x731d('0x49')]=qs['sort'](_0x508a5a['query'][_0x731d('0x4a')]);_0x40544f[_0x731d('0x4b')]=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x508a5a[_0x731d('0x3f')],_0x4ac74d['filters']));_0x40544f[_0x731d('0x4b')][_0x731d('0x68')]=_0x4c7ca3['id'];if(_0x508a5a[_0x731d('0x3f')]['filter']){_0x40544f[_0x731d('0x4b')]=_[_0x731d('0x4d')](_0x40544f[_0x731d('0x4b')],{'$or':_[_0x731d('0x3a')](_0x40544f['attributes'],function(_0x411340){var _0x5913b5={};_0x5913b5[_0x411340]={'$like':'%'+_0x508a5a['query'][_0x731d('0x2e')]+'%'};return _0x5913b5;})});}_0x40544f=_[_0x731d('0x4d')]({},_0x40544f,_0x508a5a['options']);return db[_0x731d('0x67')][_0x731d('0x26')]({'where':_0x40544f[_0x731d('0x4b')]})[_0x731d('0x2b')](function(_0x5704b1){_0x2d0f42[_0x731d('0x26')]=_0x5704b1;if(_0x508a5a['query'][_0x731d('0x50')]){_0x40544f[_0x731d('0x51')]=[{'all':!![]}];}return db[_0x731d('0x67')]['findAll'](_0x40544f);})[_0x731d('0x2b')](function(_0xf992f9){_0x2d0f42[_0x731d('0x69')]=_0xf992f9;return _0x2d0f42;});}})[_0x731d('0x2b')](respondWithFilteredResult(_0x9b443e,_0x40544f))[_0x731d('0x53')](handleError(_0x9b443e,null));};exports['getHopperHistories']=function(_0x12492f,_0x457398,_0x17eee6){var _0x45abae={'raw':!![],'where':{}};var _0x90f00e={};var _0x220dc0={'count':0x0,'rows':[]};return db[_0x731d('0x3b')][_0x731d('0x66')]({'where':{'id':_0x12492f[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x457398,null))[_0x731d('0x2b')](function(_0x2ac455){if(_0x2ac455){_0x90f00e[_0x731d('0x3e')]=_[_0x731d('0x40')](db['CmHopperHistory']['rawAttributes']);_0x90f00e[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x12492f[_0x731d('0x3f')]);_0x90f00e['filters']=_['intersection'](_0x90f00e[_0x731d('0x3e')],_0x90f00e[_0x731d('0x3f')]);_0x45abae['attributes']=_[_0x731d('0x42')](_0x90f00e[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x12492f[_0x731d('0x3f')]['fields']));_0x45abae[_0x731d('0x43')]=_0x45abae[_0x731d('0x43')][_0x731d('0x45')]?_0x45abae[_0x731d('0x43')]:_0x90f00e[_0x731d('0x3e')];if(!_0x12492f[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x45abae[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x12492f[_0x731d('0x3f')]['limit']);_0x45abae[_0x731d('0x24')]=qs['offset'](_0x12492f['query'][_0x731d('0x24')]);}_0x45abae[_0x731d('0x49')]=qs[_0x731d('0x4a')](_0x12492f[_0x731d('0x3f')][_0x731d('0x4a')]);_0x45abae['where']=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x12492f[_0x731d('0x3f')],_0x90f00e[_0x731d('0x41')]));_0x45abae[_0x731d('0x4b')][_0x731d('0x68')]=_0x2ac455['id'];if(_0x12492f[_0x731d('0x3f')]['filter']){_0x45abae[_0x731d('0x4b')]=_[_0x731d('0x4d')](_0x45abae[_0x731d('0x4b')],{'$or':_['map'](_0x45abae['attributes'],function(_0x342423){var _0x7c977b={};_0x7c977b[_0x342423]={'$like':'%'+_0x12492f['query']['filter']+'%'};return _0x7c977b;})});}_0x45abae=_[_0x731d('0x4d')]({},_0x45abae,_0x12492f['options']);return db[_0x731d('0x6a')][_0x731d('0x26')]({'where':_0x45abae[_0x731d('0x4b')]})[_0x731d('0x2b')](function(_0x2bc36a){_0x220dc0[_0x731d('0x26')]=_0x2bc36a;if(_0x12492f['query'][_0x731d('0x50')]){_0x45abae[_0x731d('0x51')]=[{'all':!![]}];}return db[_0x731d('0x6a')]['findAll'](_0x45abae);})[_0x731d('0x2b')](function(_0x37dea7){_0x220dc0[_0x731d('0x69')]=_0x37dea7;return _0x220dc0;});}})[_0x731d('0x2b')](respondWithFilteredResult(_0x457398,_0x45abae))['catch'](handleError(_0x457398,null));};exports[_0x731d('0x6b')]=function(_0x592e37,_0x18dbda,_0x520734){var _0x40c7a2={'raw':!![],'where':{}};var _0x4d97ef={};var _0x59e6de={'count':0x0,'rows':[]};return db[_0x731d('0x3b')][_0x731d('0x66')]({'where':{'id':_0x592e37['params']['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x18dbda,null))[_0x731d('0x2b')](function(_0x4fcf5e){if(_0x4fcf5e){_0x4d97ef[_0x731d('0x3e')]=_[_0x731d('0x40')](db[_0x731d('0x6c')][_0x731d('0x3c')]);_0x4d97ef[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x592e37[_0x731d('0x3f')]);_0x4d97ef[_0x731d('0x41')]=_['intersection'](_0x4d97ef['model'],_0x4d97ef[_0x731d('0x3f')]);_0x40c7a2[_0x731d('0x43')]=_[_0x731d('0x42')](_0x4d97ef[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x592e37[_0x731d('0x3f')][_0x731d('0x44')]));_0x40c7a2['attributes']=_0x40c7a2[_0x731d('0x43')]['length']?_0x40c7a2[_0x731d('0x43')]:_0x4d97ef['model'];if(!_0x592e37[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x40c7a2[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x592e37[_0x731d('0x3f')][_0x731d('0x48')]);_0x40c7a2[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x592e37[_0x731d('0x3f')][_0x731d('0x24')]);}_0x40c7a2['order']=qs[_0x731d('0x4a')](_0x592e37[_0x731d('0x3f')][_0x731d('0x4a')]);_0x40c7a2[_0x731d('0x4b')]=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x592e37[_0x731d('0x3f')],_0x4d97ef[_0x731d('0x41')]));_0x40c7a2['where'][_0x731d('0x68')]=_0x4fcf5e['id'];if(_0x592e37[_0x731d('0x3f')][_0x731d('0x2e')]){_0x40c7a2[_0x731d('0x4b')]=_['merge'](_0x40c7a2[_0x731d('0x4b')],{'$or':_['map'](_0x40c7a2['attributes'],function(_0x577921){var _0xfbdf6e={};_0xfbdf6e[_0x577921]={'$like':'%'+_0x592e37[_0x731d('0x3f')]['filter']+'%'};return _0xfbdf6e;})});}_0x40c7a2=_[_0x731d('0x4d')]({},_0x40c7a2,_0x592e37['options']);return db[_0x731d('0x6c')][_0x731d('0x26')]({'where':_0x40c7a2[_0x731d('0x4b')]})['then'](function(_0x125441){_0x59e6de[_0x731d('0x26')]=_0x125441;if(_0x592e37[_0x731d('0x3f')][_0x731d('0x50')]){_0x40c7a2[_0x731d('0x51')]=[{'all':!![]}];}return db[_0x731d('0x6c')]['findAll'](_0x40c7a2);})['then'](function(_0x4411f8){_0x59e6de[_0x731d('0x69')]=_0x4411f8;return _0x59e6de;});}})['then'](respondWithFilteredResult(_0x18dbda,_0x40c7a2))[_0x731d('0x53')](handleError(_0x18dbda,null));};exports[_0x731d('0x6d')]=function(_0x3d689f,_0x59b46a,_0x5ec1be){var _0x1565bb={'raw':!![],'where':{}};var _0x79f60b={};var _0x1427fa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x731d('0x66')]({'where':{'id':_0x3d689f[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x59b46a,null))['then'](function(_0x129b7f){if(_0x129b7f){_0x79f60b['model']=_[_0x731d('0x40')](db[_0x731d('0x6e')][_0x731d('0x3c')]);_0x79f60b[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x3d689f['query']);_0x79f60b[_0x731d('0x41')]=_['intersection'](_0x79f60b[_0x731d('0x3e')],_0x79f60b[_0x731d('0x3f')]);_0x1565bb['attributes']=_['intersection'](_0x79f60b['model'],qs[_0x731d('0x44')](_0x3d689f['query']['fields']));_0x1565bb[_0x731d('0x43')]=_0x1565bb[_0x731d('0x43')][_0x731d('0x45')]?_0x1565bb[_0x731d('0x43')]:_0x79f60b['model'];if(!_0x3d689f[_0x731d('0x3f')]['hasOwnProperty']('nolimit')){_0x1565bb['limit']=qs['limit'](_0x3d689f[_0x731d('0x3f')][_0x731d('0x48')]);_0x1565bb[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x3d689f[_0x731d('0x3f')][_0x731d('0x24')]);}_0x1565bb[_0x731d('0x49')]=qs[_0x731d('0x4a')](_0x3d689f[_0x731d('0x3f')]['sort']);_0x1565bb['where']=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x3d689f['query'],_0x79f60b[_0x731d('0x41')]));_0x1565bb[_0x731d('0x4b')]['VoiceQueueId']=_0x129b7f['id'];if(_0x3d689f[_0x731d('0x3f')][_0x731d('0x2e')]){_0x1565bb['where']=_['merge'](_0x1565bb[_0x731d('0x4b')],{'$or':_[_0x731d('0x3a')](_0x1565bb[_0x731d('0x43')],function(_0x2ba780){var _0x126f3a={};_0x126f3a[_0x2ba780]={'$like':'%'+_0x3d689f['query'][_0x731d('0x2e')]+'%'};return _0x126f3a;})});}_0x1565bb=_[_0x731d('0x4d')]({},_0x1565bb,_0x3d689f[_0x731d('0x4f')]);return db[_0x731d('0x6e')][_0x731d('0x26')]({'where':_0x1565bb[_0x731d('0x4b')]})[_0x731d('0x2b')](function(_0x342d8f){_0x1427fa[_0x731d('0x26')]=_0x342d8f;if(_0x3d689f['query'][_0x731d('0x50')]){_0x1565bb['include']=[{'all':!![]}];}return db[_0x731d('0x6e')][_0x731d('0x52')](_0x1565bb);})[_0x731d('0x2b')](function(_0x2fc9d4){_0x1427fa[_0x731d('0x69')]=_0x2fc9d4;return _0x1427fa;});}})[_0x731d('0x2b')](respondWithFilteredResult(_0x59b46a,_0x1565bb))[_0x731d('0x53')](handleError(_0x59b46a,null));};exports[_0x731d('0x6f')]=function(_0x1f114f,_0x44cac6,_0x17f6be){var _0x2b8d15={};var _0x42b41c={};var _0x47613a;var _0x571237;return db[_0x731d('0x3b')]['findOne']({'where':{'id':_0x1f114f[_0x731d('0x54')]['id']}})['then'](handleEntityNotFound(_0x44cac6,null))[_0x731d('0x2b')](function(_0x348baa){if(_0x348baa){_0x47613a=_0x348baa;_0x42b41c['model']=_[_0x731d('0x40')](db['Team'][_0x731d('0x3c')]);_0x42b41c[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x1f114f['query']);_0x42b41c[_0x731d('0x41')]=_[_0x731d('0x42')](_0x42b41c[_0x731d('0x3e')],_0x42b41c[_0x731d('0x3f')]);_0x2b8d15[_0x731d('0x43')]=_[_0x731d('0x42')](_0x42b41c[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x1f114f[_0x731d('0x3f')][_0x731d('0x44')]));_0x2b8d15[_0x731d('0x43')]=_0x2b8d15[_0x731d('0x43')]['length']?_0x2b8d15['attributes']:_0x42b41c['model'];_0x2b8d15['order']=qs[_0x731d('0x4a')](_0x1f114f['query'][_0x731d('0x4a')]);_0x2b8d15['where']=qs[_0x731d('0x41')](_['pick'](_0x1f114f[_0x731d('0x3f')],_0x42b41c[_0x731d('0x41')]));if(_0x1f114f[_0x731d('0x3f')][_0x731d('0x2e')]){_0x2b8d15[_0x731d('0x4b')]=_[_0x731d('0x4d')](_0x2b8d15[_0x731d('0x4b')],{'$or':_[_0x731d('0x3a')](_0x2b8d15[_0x731d('0x43')],function(_0x323365){var _0x1a3053={};_0x1a3053[_0x323365]={'$like':'%'+_0x1f114f[_0x731d('0x3f')]['filter']+'%'};return _0x1a3053;})});}_0x2b8d15=_['merge']({},_0x2b8d15,_0x1f114f[_0x731d('0x4f')]);return _0x47613a[_0x731d('0x6f')](_0x2b8d15);}})[_0x731d('0x2b')](function(_0x132fcf){if(_0x132fcf){_0x571237=_0x132fcf[_0x731d('0x45')];if(!_0x1f114f[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x2b8d15[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x1f114f[_0x731d('0x3f')][_0x731d('0x48')]);_0x2b8d15[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x1f114f[_0x731d('0x3f')][_0x731d('0x24')]);}return _0x47613a[_0x731d('0x6f')](_0x2b8d15);}})[_0x731d('0x2b')](function(_0x5d51d3){if(_0x5d51d3){return _0x5d51d3?{'count':_0x571237,'rows':_0x5d51d3}:null;}})[_0x731d('0x2b')](respondWithResult(_0x44cac6,null))['catch'](handleError(_0x44cac6,null));};exports[_0x731d('0x70')]=function(_0x183425,_0x3b0d80,_0x9e7b3c){var _0x551b3d=_0x183425['body'][_0x731d('0x71')];var _0x186343=_[_0x731d('0x3a')](_0x551b3d,'id');return db[_0x731d('0x72')][_0x731d('0x52')]({'where':{'id':_0x186343},'attributes':['id'],'include':[{'model':db[_0x731d('0x73')],'as':_0x731d('0x74'),'attributes':['id','name',_0x731d('0x75'),'voicePause',_0x731d('0x76')],'raw':!![]}]})[_0x731d('0x2b')](function(_0x136f22){if(_0x136f22){var _0xe8421a=_[_0x731d('0x77')](_0x136f22,function(_0x5481ca){var _0x29fd76=_0x5481ca['get']({'plain':!![]});_0x29fd76[_0x731d('0x74')][_0x731d('0x78')](function(_0x473656){_0x473656['penalty']=_[_0x731d('0x33')](_0x551b3d,{'id':_0x29fd76['id']})['penalty'];});return _0x29fd76[_0x731d('0x74')];});return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x183425[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](function(_0x26d69e){return db[_0x731d('0x79')]['transaction'](function(_0x286052){return _0x26d69e[_0x731d('0x70')](_0x186343,{'transaction':_0x286052})[_0x731d('0x2b')](function(){return BPromise['each'](_0x551b3d,function(_0x6bb881){return db[_0x731d('0x7a')][_0x731d('0x7b')]({'TeamId':_0x6bb881['id'],'VoiceQueueId':_0x183425['params']['id'],'penalty':_0x6bb881[_0x731d('0x7c')]},{'transaction':_0x286052});});})['then'](function(){return BPromise[_0x731d('0x7d')](_0xe8421a,function(_0x24bc55){return db[_0x731d('0x7e')][_0x731d('0x7f')]({'where':{'UserId':_0x24bc55['id'],'VoiceQueueId':_0x183425['params']['id']},'defaults':{'penalty':_0x24bc55[_0x731d('0x7c')]},'transaction':_0x286052});});})[_0x731d('0x2b')](function(){return BPromise[_0x731d('0x7d')](_[_0x731d('0x2e')](_0xe8421a,{'online':!![]}),function(_0x5d1546){return db[_0x731d('0x80')][_0x731d('0x7b')]({'membername':_0x5d1546[_0x731d('0x34')],'UserId':_0x5d1546['id'],'queue_name':_0x26d69e[_0x731d('0x34')],'VoiceQueueId':_0x26d69e['id'],'interface':_[_0x731d('0x81')](_0x5d1546[_0x731d('0x76')])?util[_0x731d('0x82')](_0x731d('0x83'),_0x5d1546[_0x731d('0x34')]):_0x5d1546[_0x731d('0x76')],'paused':_0x5d1546[_0x731d('0x84')]||![],'penalty':_0x5d1546['penalty']},{'transaction':_0x286052});});})[_0x731d('0x2b')](function(){_0xe8421a[_0x731d('0x78')](function(_0x27662a){socket[_0x731d('0x85')](_0x731d('0x86'),{'UserId':_0x27662a['id'],'VoiceQueueId':_0x26d69e['id']});});});});});}})[_0x731d('0x2b')](respondWithStatusCode(_0x3b0d80,null))[_0x731d('0x53')](handleError(_0x3b0d80,null));};exports['removeTeams']=function(_0x27d13d,_0x2b4a1b,_0x925281){return db[_0x731d('0x72')][_0x731d('0x52')]({'where':{'id':_0x27d13d['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x731d('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x731d('0x2b')](handleEntityNotFound(_0x2b4a1b,null))[_0x731d('0x2b')](function(_0x58f2b5){var _0x363bbc=_[_0x731d('0x3a')](_0x58f2b5,'id');var _0x234721=[];var _0x546b6c=[];var _0x29a63d=squel[_0x731d('0x87')]();_0x29a63d['field'](_0x731d('0x88'))[_0x731d('0x89')]('team_has_voice_queues','tq')[_0x731d('0x8a')](_0x731d('0x8b'),'ut',_0x731d('0x8c'))[_0x731d('0x4b')]('VoiceQueueId\x20=\x20?',_0x27d13d[_0x731d('0x54')]['id']);for(var _0x1c19a2=0x0;_0x1c19a2<_0x58f2b5[_0x731d('0x45')];_0x1c19a2+=0x1){let _0x2f1b8b=_0x58f2b5[_0x1c19a2];for(var _0x458d31=0x0;_0x458d31<_0x2f1b8b[_0x731d('0x74')][_0x731d('0x45')];_0x458d31+=0x1){let _0x25460b=_0x2f1b8b[_0x731d('0x74')][_0x458d31];var _0x304e6f=_0x29a63d[_0x731d('0x5d')]();_0x304e6f[_0x731d('0x4b')](_0x731d('0x8d'),_0x25460b['id']);_0x546b6c[_0x731d('0x8e')](db[_0x731d('0x79')]['query'](_0x304e6f[_0x731d('0x8f')](),{'type':db['sequelize'][_0x731d('0x90')][_0x731d('0x91')]})[_0x731d('0x2b')](function(_0x34683f){if(_0x34683f[_0x731d('0x45')]===0x1){return _0x25460b['id'];}else{var _0xd3b8b7=_[_0x731d('0x92')](_[_0x731d('0x3a')](_0x34683f,'TeamId'),function(_0x1a68a3){return _[_0x731d('0x31')](_0x363bbc,_0x1a68a3);});if(_0xd3b8b7){return _0x25460b['id'];}}}));}}return BPromise[_0x731d('0x93')](_0x546b6c)[_0x731d('0x2b')](function(_0x2b0643){_0x234721=_(_0x234721)['union'](_0x2b0643)[_0x731d('0x94')]()['value']();return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x27d13d['params']['id']}})[_0x731d('0x2b')](function(_0x229f66){return db['sequelize'][_0x731d('0x95')](function(_0x39ec84){return _0x229f66[_0x731d('0x96')](_0x27d13d[_0x731d('0x3f')][_0x731d('0x97')],{'transaction':_0x39ec84})[_0x731d('0x2b')](function(){if(!_[_0x731d('0x98')](_0x234721)){return _0x229f66['removeAgents'](_0x234721,{'transaction':_0x39ec84})['then'](function(){return db[_0x731d('0x80')][_0x731d('0x36')]({'where':{'VoiceQueueId':_0x27d13d[_0x731d('0x54')]['id'],'UserId':_0x234721},'transaction':_0x39ec84});});}})[_0x731d('0x2b')](function(){_0x234721['forEach'](function(_0x18b294){socket['emit'](_0x731d('0x99'),{'UserId':_0x18b294,'VoiceQueueId':_0x229f66['id']});});});});});});})[_0x731d('0x2b')](respondWithStatusCode(_0x2b4a1b,null))[_0x731d('0x53')](handleError(_0x2b4a1b,null));};exports[_0x731d('0x9a')]=function(_0x2c8378,_0x392004,_0x302a15){var _0x5db1de,_0x59b83f;return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x2c8378['params']['id']}})['then'](handleEntityNotFound(_0x392004,null))[_0x731d('0x2b')](function(_0x5332ad){if(_0x5332ad){_0x59b83f=_0x5332ad;return _0x5332ad[_0x731d('0x9a')](_0x2c8378[_0x731d('0x61')]['ids'],_[_0x731d('0x5e')](_0x2c8378['body'],[_0x731d('0x97'),'id'])||{})['spread'](function(_0x2eca18){for(var _0x210f70=0x0;_0x210f70<_0x2c8378[_0x731d('0x61')][_0x731d('0x97')][_0x731d('0x45')];_0x210f70+=0x1){socket[_0x731d('0x85')](_0x731d('0x86'),{'UserId':Number(_0x2c8378[_0x731d('0x61')]['ids'][_0x210f70]),'VoiceQueueId':Number(_0x2c8378['params']['id'])});}return _0x2eca18;});}})[_0x731d('0x2b')](function(_0xd1a9cb){_0x5db1de=_0xd1a9cb||[];if(_0x59b83f){return db['User'][_0x731d('0x52')]({'where':{'id':_0x2c8378[_0x731d('0x61')][_0x731d('0x97')]},'attributes':['id',_0x731d('0x34'),'online',_0x731d('0x84'),'interface'],'raw':!![]});}})[_0x731d('0x2b')](function(_0x91a0f7){if(!_['isEmpty'](_0x91a0f7)){var _0x2f0e2e=[];for(var _0x924a6a=0x0;_0x924a6a<_0x91a0f7['length'];_0x924a6a++){if(_0x91a0f7[_0x924a6a][_0x731d('0x75')]){_0x2f0e2e[_0x731d('0x8e')](db['UserVoiceQueueRt'][_0x731d('0x7b')]({'membername':_0x91a0f7[_0x924a6a]['name'],'UserId':_0x91a0f7[_0x924a6a]['id'],'queue_name':_0x59b83f[_0x731d('0x34')],'VoiceQueueId':_0x59b83f['id'],'interface':_[_0x731d('0x81')](_0x91a0f7[_0x924a6a][_0x731d('0x76')])?util[_0x731d('0x82')](_0x731d('0x83'),_0x91a0f7[_0x924a6a][_0x731d('0x34')]):_0x91a0f7[_0x924a6a][_0x731d('0x76')],'paused':_0x91a0f7[_0x924a6a][_0x731d('0x84')]||![],'penalty':_0x2c8378[_0x731d('0x61')][_0x731d('0x7c')]||0x0}));}}return BPromise[_0x731d('0x93')](_0x2f0e2e);}})[_0x731d('0x2b')](function(){return _0x5db1de;})[_0x731d('0x2b')](respondWithResult(_0x392004,null))[_0x731d('0x53')](handleError(_0x392004,null));};exports[_0x731d('0x9b')]=function(_0x511906,_0x2bea0e,_0x54bc56){return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x511906['params']['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x2bea0e,null))[_0x731d('0x2b')](function(_0x14109b){if(_0x14109b){return _0x14109b[_0x731d('0x9b')](_0x511906['query'][_0x731d('0x97')])['then'](function(){if(_['isArray'](_0x511906[_0x731d('0x3f')][_0x731d('0x97')])){for(var _0x573708=0x0;_0x573708<_0x511906[_0x731d('0x3f')][_0x731d('0x97')][_0x731d('0x45')];_0x573708+=0x1){socket['emit'](_0x731d('0x99'),{'UserId':Number(_0x511906[_0x731d('0x3f')][_0x731d('0x97')][_0x573708]),'VoiceQueueId':Number(_0x511906[_0x731d('0x54')]['id'])});}}else{socket['emit'](_0x731d('0x99'),{'UserId':Number(_0x511906[_0x731d('0x3f')]['ids']),'VoiceQueueId':Number(_0x511906['params']['id'])});}});}})[_0x731d('0x2b')](function(_0x42e555){return db[_0x731d('0x80')][_0x731d('0x36')]({'where':{'VoiceQueueId':_0x511906['params']['id'],'UserId':_0x511906[_0x731d('0x3f')][_0x731d('0x97')]}})[_0x731d('0x2b')](function(){return _0x42e555;});})[_0x731d('0x2b')](respondWithStatusCode(_0x2bea0e,null))[_0x731d('0x53')](handleError(_0x2bea0e,null));};exports['getAgents']=function(_0x178a2a,_0x50f344,_0x51a803){var _0x41dc6b={};var _0xa56929={};var _0x512d03;var _0x258a31;return db[_0x731d('0x3b')][_0x731d('0x66')]({'where':{'id':_0x178a2a[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x50f344,null))[_0x731d('0x2b')](function(_0x466e67){if(_0x466e67){_0x512d03=_0x466e67;_0xa56929['model']=_['keys'](db['User'][_0x731d('0x3c')]);_0xa56929[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x178a2a[_0x731d('0x3f')]);_0xa56929[_0x731d('0x41')]=_[_0x731d('0x42')](_0xa56929['model'],_0xa56929[_0x731d('0x3f')]);_0x41dc6b[_0x731d('0x43')]=_[_0x731d('0x42')](_0xa56929[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x178a2a[_0x731d('0x3f')][_0x731d('0x44')]));_0x41dc6b[_0x731d('0x43')]=_0x41dc6b['attributes'][_0x731d('0x45')]?_0x41dc6b[_0x731d('0x43')]:_0xa56929[_0x731d('0x3e')];_0x41dc6b['order']=qs[_0x731d('0x4a')](_0x178a2a[_0x731d('0x3f')][_0x731d('0x4a')]);_0x41dc6b[_0x731d('0x4b')]=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x178a2a['query'],_0xa56929[_0x731d('0x41')]));if(_0x178a2a[_0x731d('0x3f')][_0x731d('0x2e')]){_0x41dc6b[_0x731d('0x4b')]=_[_0x731d('0x4d')](_0x41dc6b[_0x731d('0x4b')],{'$or':_[_0x731d('0x3a')](_0x41dc6b[_0x731d('0x43')],function(_0x274f09){var _0x161a23={};_0x161a23[_0x274f09]={'$like':'%'+_0x178a2a[_0x731d('0x3f')]['filter']+'%'};return _0x161a23;})});}_0x41dc6b=_[_0x731d('0x4d')]({},_0x41dc6b,_0x178a2a[_0x731d('0x4f')]);return _0x512d03[_0x731d('0x9c')](_0x41dc6b);}})[_0x731d('0x2b')](function(_0x490ba8){if(_0x490ba8){_0x258a31=_0x490ba8[_0x731d('0x45')];if(!_0x178a2a[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x41dc6b['limit']=qs[_0x731d('0x48')](_0x178a2a[_0x731d('0x3f')][_0x731d('0x48')]);_0x41dc6b[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x178a2a['query'][_0x731d('0x24')]);}return _0x512d03[_0x731d('0x9c')](_0x41dc6b);}})[_0x731d('0x2b')](function(_0x2202ce){if(_0x2202ce){return _0x2202ce?{'count':_0x258a31,'rows':_0x2202ce}:null;}})[_0x731d('0x2b')](respondWithResult(_0x50f344,null))[_0x731d('0x53')](handleError(_0x50f344,null));};exports[_0x731d('0x9d')]=function(_0x4f79c2,_0x42a74f,_0x14af6a){var _0x570353={};var _0x457c53={};var _0x2423ae;var _0xd9a0e1;return db['VoiceQueue'][_0x731d('0x66')]({'where':{'id':_0x4f79c2[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x42a74f,null))['then'](function(_0x3910a8){if(_0x3910a8){_0x2423ae=_0x3910a8;_0x457c53[_0x731d('0x3e')]=_[_0x731d('0x40')](db[_0x731d('0x80')][_0x731d('0x3c')]);_0x457c53[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x4f79c2[_0x731d('0x3f')]);_0x457c53[_0x731d('0x41')]=_[_0x731d('0x42')](_0x457c53['model'],_0x457c53[_0x731d('0x3f')]);_0x570353[_0x731d('0x43')]=_['intersection'](_0x457c53[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x4f79c2['query'][_0x731d('0x44')]));_0x570353[_0x731d('0x43')]=_0x570353[_0x731d('0x43')]['length']?_0x570353[_0x731d('0x43')]:_0x457c53['model'];_0x570353[_0x731d('0x49')]=qs[_0x731d('0x4a')](_0x4f79c2['query'][_0x731d('0x4a')]);_0x570353['where']=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x4f79c2[_0x731d('0x3f')],_0x457c53[_0x731d('0x41')]));if(_0x4f79c2[_0x731d('0x3f')]['filter']){_0x570353[_0x731d('0x4b')]=_[_0x731d('0x4d')](_0x570353['where'],{'$or':_[_0x731d('0x3a')](_0x570353['attributes'],function(_0x387252){var _0x1582e6={};_0x1582e6[_0x387252]={'$like':'%'+_0x4f79c2[_0x731d('0x3f')][_0x731d('0x2e')]+'%'};return _0x1582e6;})});}_0x570353=_[_0x731d('0x4d')]({},_0x570353,_0x4f79c2[_0x731d('0x4f')]);return _0x2423ae['getMembers'](_0x570353);}})['then'](function(_0x2dbc34){if(_0x2dbc34){_0xd9a0e1=_0x2dbc34['length'];if(!_0x4f79c2[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x570353[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x4f79c2[_0x731d('0x3f')][_0x731d('0x48')]);_0x570353[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x4f79c2[_0x731d('0x3f')][_0x731d('0x24')]);}return _0x2423ae[_0x731d('0x9d')](_0x570353);}})[_0x731d('0x2b')](function(_0x1e49b3){return _0x1e49b3?{'count':_0xd9a0e1,'rows':_0x1e49b3}:null;})[_0x731d('0x2b')](respondWithResult(_0x42a74f,null))[_0x731d('0x53')](handleError(_0x42a74f,null));};exports[_0x731d('0x9e')]=function(_0x6707c1,_0x259b3d,_0x5dcf89){var _0x189c82={};var _0x162566={};var _0x4c9efe;var _0x3b1eaf;return db[_0x731d('0x3b')][_0x731d('0x66')]({'where':{'id':_0x6707c1[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x259b3d,null))[_0x731d('0x2b')](function(_0x1c339e){if(_0x1c339e){_0x4c9efe=_0x1c339e;_0x162566[_0x731d('0x3e')]=_[_0x731d('0x40')](db[_0x731d('0x9f')][_0x731d('0x3c')]);_0x162566[_0x731d('0x3f')]=_['keys'](_0x6707c1[_0x731d('0x3f')]);_0x162566[_0x731d('0x41')]=_[_0x731d('0x42')](_0x162566[_0x731d('0x3e')],_0x162566[_0x731d('0x3f')]);_0x189c82[_0x731d('0x43')]=_[_0x731d('0x42')](_0x162566['model'],qs[_0x731d('0x44')](_0x6707c1['query']['fields']));_0x189c82[_0x731d('0x43')]=_0x189c82[_0x731d('0x43')][_0x731d('0x45')]?_0x189c82[_0x731d('0x43')]:_0x162566['model'];_0x189c82['order']=qs[_0x731d('0x4a')](_0x6707c1[_0x731d('0x3f')][_0x731d('0x4a')]);_0x189c82['where']=qs[_0x731d('0x41')](_['pick'](_0x6707c1[_0x731d('0x3f')],_0x162566[_0x731d('0x41')]));if(_0x6707c1[_0x731d('0x3f')][_0x731d('0x2e')]){_0x189c82['where']=_['merge'](_0x189c82[_0x731d('0x4b')],{'$or':_['map'](_0x189c82[_0x731d('0x43')],function(_0x18b5d2){var _0x4ea2c1={};_0x4ea2c1[_0x18b5d2]={'$like':'%'+_0x6707c1[_0x731d('0x3f')][_0x731d('0x2e')]+'%'};return _0x4ea2c1;})});}_0x189c82=_[_0x731d('0x4d')]({},_0x189c82,_0x6707c1['options']);return _0x4c9efe[_0x731d('0x9e')](_0x189c82);}})[_0x731d('0x2b')](function(_0xf15c47){if(_0xf15c47){_0x3b1eaf=_0xf15c47[_0x731d('0x45')];if(!_0x6707c1['query'][_0x731d('0x46')](_0x731d('0x47'))){_0x189c82[_0x731d('0x48')]=qs[_0x731d('0x48')](_0x6707c1[_0x731d('0x3f')][_0x731d('0x48')]);_0x189c82[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x6707c1[_0x731d('0x3f')][_0x731d('0x24')]);}return _0x4c9efe['getLists'](_0x189c82);}})[_0x731d('0x2b')](function(_0x341960){if(_0x341960){return _0x341960?{'count':_0x3b1eaf,'rows':_0x341960}:null;}})[_0x731d('0x2b')](respondWithResult(_0x259b3d,null))[_0x731d('0x53')](handleError(_0x259b3d,null));};exports[_0x731d('0xa0')]=function(_0x491f6b,_0x37a8ce,_0x5d7de9){var _0x118170,_0x5f2ab2;return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x491f6b[_0x731d('0x54')]['id']}})['then'](handleEntityNotFound(_0x37a8ce,null))[_0x731d('0x2b')](function(_0x4fcb65){if(_0x4fcb65){_0x5f2ab2=_0x4fcb65;return _0x4fcb65[_0x731d('0xa0')](_0x491f6b[_0x731d('0x61')][_0x731d('0x97')],_['omit'](_0x491f6b[_0x731d('0x61')],[_0x731d('0x97'),'id'])||{});}return null;})[_0x731d('0xa1')](function(_0x28dcef){var _0x147986;_0x118170=_0x28dcef||[];var _0x11526e=[];if(_0x28dcef){for(var _0x4a6d3f=0x0;_0x4a6d3f<_0x28dcef[_0x731d('0x45')];_0x4a6d3f+=0x1){var _0x4d8bbb=_0x28dcef[_0x4a6d3f][_0x731d('0x2c')]({'plain':!![]});_0x5f2ab2[_0x731d('0xa2')]=_0x491f6b[_0x731d('0x61')][_0x731d('0xa2')]?_0x491f6b['body'][_0x731d('0xa2')]:_0x5f2ab2['dialCheckDuplicateType'];switch(_0x5f2ab2[_0x731d('0xa2')]){case'always':_0x147986=squel['insert']()[_0x731d('0xa3')](_0x731d('0xa4'))[_0x731d('0xa5')]([_0x731d('0xa6'),_0x731d('0xa7'),_0x731d('0xa8'),'ListId','VoiceQueueId',_0x731d('0x5f'),'updatedAt'],squel[_0x731d('0x87')]()[_0x731d('0xa9')](_0x731d('0xa6'),_0x731d('0xa6'))[_0x731d('0xa9')](_0x731d('0xaa'),_0x731d('0xa7'))[_0x731d('0xa9')]('id',_0x731d('0xa8'))[_0x731d('0xa9')](_0x4d8bbb['CmListId'][_0x731d('0x8f')](),_0x731d('0xab'))['field'](_0x491f6b[_0x731d('0x54')]['id'][_0x731d('0x8f')](),_0x731d('0x68'))[_0x731d('0xa9')]('NOW()',_0x731d('0x5f'))['field'](_0x731d('0xaa'),_0x731d('0x60'))['from'](_0x731d('0xac'))[_0x731d('0x4b')]('deletedAt\x20IS\x20NULL')[_0x731d('0x4b')](_0x731d('0xad'),_0x4d8bbb[_0x731d('0xae')][_0x731d('0x8f')]())[_0x731d('0x4b')](_0x731d('0xaf'))[_0x731d('0x4b')](_0x731d('0xb0'),squel[_0x731d('0x87')]()[_0x731d('0xa9')](_0x731d('0xb1'))[_0x731d('0x89')](_0x731d('0xb2'))[_0x731d('0x4b')](_0x731d('0xb3'),_0x491f6b['params']['id'][_0x731d('0x8f')]()))[_0x731d('0x4b')](_0x731d('0xb0'),squel[_0x731d('0x87')]()[_0x731d('0xa9')](_0x731d('0xb4'))[_0x731d('0x89')](_0x731d('0xa4'))[_0x731d('0x4b')](_0x731d('0xb3'),_0x491f6b[_0x731d('0x54')]['id'][_0x731d('0x8f')]())))[_0x731d('0x8f')]();break;case _0x731d('0xb5'):_0x147986=squel[_0x731d('0xb6')]()[_0x731d('0xa3')](_0x731d('0xa4'))[_0x731d('0xa5')]([_0x731d('0xa6'),_0x731d('0xa7'),_0x731d('0xa8'),_0x731d('0xab'),_0x731d('0x68'),_0x731d('0x5f'),_0x731d('0x60')],squel[_0x731d('0x87')]()[_0x731d('0xa9')]('phone',_0x731d('0xa6'))[_0x731d('0xa9')]('NOW()',_0x731d('0xa7'))[_0x731d('0xa9')]('id','ContactId')[_0x731d('0xa9')](_0x4d8bbb[_0x731d('0xae')]['toString'](),_0x731d('0xab'))[_0x731d('0xa9')](_0x491f6b[_0x731d('0x54')]['id']['toString'](),_0x731d('0x68'))[_0x731d('0xa9')](_0x731d('0xaa'),'createdAt')[_0x731d('0xa9')]('NOW()',_0x731d('0x60'))[_0x731d('0x89')]('cm_contacts')[_0x731d('0x4b')](_0x731d('0xb7'))['where'](_0x731d('0xad'),_0x4d8bbb[_0x731d('0xae')]['toString']())['where'](_0x731d('0xaf'))[_0x731d('0x4b')](_0x731d('0xb0'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x731d('0x89')](_0x731d('0xa4'))['where'](_0x731d('0xb3'),_0x491f6b[_0x731d('0x54')]['id'][_0x731d('0x8f')]())))[_0x731d('0x8f')]();break;default:_0x147986=squel[_0x731d('0xb6')]()[_0x731d('0xa3')](_0x731d('0xa4'))[_0x731d('0xa5')](['phone',_0x731d('0xa7'),'ContactId',_0x731d('0xab'),_0x731d('0x68'),_0x731d('0x5f'),_0x731d('0x60')],squel[_0x731d('0x87')]()['field'](_0x731d('0xa6'),_0x731d('0xa6'))[_0x731d('0xa9')](_0x731d('0xaa'),_0x731d('0xa7'))[_0x731d('0xa9')]('id',_0x731d('0xa8'))[_0x731d('0xa9')](_0x4d8bbb[_0x731d('0xae')]['toString'](),'ListId')[_0x731d('0xa9')](_0x491f6b[_0x731d('0x54')]['id'][_0x731d('0x8f')](),_0x731d('0x68'))[_0x731d('0xa9')]('NOW()',_0x731d('0x5f'))[_0x731d('0xa9')]('NOW()',_0x731d('0x60'))[_0x731d('0x89')](_0x731d('0xac'))[_0x731d('0x4b')]('deletedAt\x20IS\x20NULL')['where'](_0x731d('0xad'),_0x4d8bbb['CmListId']['toString']())[_0x731d('0x4b')](_0x731d('0xaf')))[_0x731d('0x8f')]();}_0x11526e['push'](db[_0x731d('0x79')][_0x731d('0x3f')](_0x147986));}return BPromise[_0x731d('0x93')](_0x11526e);}})[_0x731d('0x2b')](function(){return _0x118170;})[_0x731d('0x2b')](respondWithResult(_0x37a8ce,null))[_0x731d('0x53')](handleError(_0x37a8ce,null));};exports[_0x731d('0xb8')]=function(_0x51c4e3,_0x1d9f36,_0x2cafc6){return db['VoiceQueue'][_0x731d('0x33')]({'where':{'id':_0x51c4e3[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x1d9f36,null))[_0x731d('0x2b')](function(_0x464b2b){if(_0x464b2b){return _0x464b2b[_0x731d('0xb8')](_0x51c4e3[_0x731d('0x3f')][_0x731d('0x97')]);}})[_0x731d('0x2b')](function(_0x5748d7){if(_0x5748d7){return db[_0x731d('0x67')][_0x731d('0x36')]({'where':{'ListId':_0x51c4e3[_0x731d('0x3f')][_0x731d('0x97')],'VoiceQueueId':_0x51c4e3['params']['id']}})[_0x731d('0x2b')](function(){return _0x5748d7;});}})[_0x731d('0x2b')](respondWithStatusCode(_0x1d9f36,null))['catch'](handleError(_0x1d9f36,null));};exports[_0x731d('0xb9')]=function(_0x649c7f,_0x4d72bb,_0x1ce1c8){var _0x13b4c6={};var _0x4a5509={};var _0x7ae2bf;var _0x230b88;return db['VoiceQueue'][_0x731d('0x66')]({'where':{'id':_0x649c7f[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x4d72bb,null))[_0x731d('0x2b')](function(_0x226d26){if(_0x226d26){_0x7ae2bf=_0x226d26;_0x4a5509['model']=_[_0x731d('0x40')](db[_0x731d('0x9f')]['rawAttributes']);_0x4a5509[_0x731d('0x3f')]=_[_0x731d('0x40')](_0x649c7f[_0x731d('0x3f')]);_0x4a5509['filters']=_[_0x731d('0x42')](_0x4a5509['model'],_0x4a5509[_0x731d('0x3f')]);_0x13b4c6['attributes']=_[_0x731d('0x42')](_0x4a5509[_0x731d('0x3e')],qs[_0x731d('0x44')](_0x649c7f[_0x731d('0x3f')][_0x731d('0x44')]));_0x13b4c6[_0x731d('0x43')]=_0x13b4c6[_0x731d('0x43')][_0x731d('0x45')]?_0x13b4c6['attributes']:_0x4a5509[_0x731d('0x3e')];_0x13b4c6[_0x731d('0x49')]=qs[_0x731d('0x4a')](_0x649c7f[_0x731d('0x3f')][_0x731d('0x4a')]);_0x13b4c6[_0x731d('0x4b')]=qs[_0x731d('0x41')](_[_0x731d('0x4c')](_0x649c7f['query'],_0x4a5509[_0x731d('0x41')]));if(_0x649c7f[_0x731d('0x3f')]['filter']){_0x13b4c6[_0x731d('0x4b')]=_['merge'](_0x13b4c6[_0x731d('0x4b')],{'$or':_[_0x731d('0x3a')](_0x13b4c6['attributes'],function(_0x3b9ded){var _0x2ea6cd={};_0x2ea6cd[_0x3b9ded]={'$like':'%'+_0x649c7f[_0x731d('0x3f')][_0x731d('0x2e')]+'%'};return _0x2ea6cd;})});}_0x13b4c6=_[_0x731d('0x4d')]({},_0x13b4c6,_0x649c7f[_0x731d('0x4f')]);return _0x7ae2bf[_0x731d('0xb9')](_0x13b4c6);}})[_0x731d('0x2b')](function(_0x5d2e08){if(_0x5d2e08){_0x230b88=_0x5d2e08[_0x731d('0x45')];if(!_0x649c7f[_0x731d('0x3f')][_0x731d('0x46')](_0x731d('0x47'))){_0x13b4c6['limit']=qs['limit'](_0x649c7f[_0x731d('0x3f')][_0x731d('0x48')]);_0x13b4c6['offset']=qs[_0x731d('0x24')](_0x649c7f[_0x731d('0x3f')]['offset']);}return _0x7ae2bf[_0x731d('0xb9')](_0x13b4c6);}})[_0x731d('0x2b')](function(_0x31f21a){if(_0x31f21a){return _0x31f21a?{'count':_0x230b88,'rows':_0x31f21a}:null;}})['then'](respondWithResult(_0x4d72bb,null))[_0x731d('0x53')](handleError(_0x4d72bb,null));};exports[_0x731d('0xba')]=function(_0xfb0a27,_0x22d46d,_0x4e580a){var _0x26fbf0,_0x559963;return db['VoiceQueue'][_0x731d('0x33')]({'where':{'id':_0xfb0a27['params']['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x22d46d,null))['then'](function(_0x43c9a9){if(_0x43c9a9){_0x559963=_0x43c9a9;return _0x43c9a9[_0x731d('0xba')](_0xfb0a27['body'][_0x731d('0x97')],_[_0x731d('0x5e')](_0xfb0a27[_0x731d('0x61')],[_0x731d('0x97'),'id'])||{});}return null;})[_0x731d('0xa1')](function(_0x4d3a79){var _0xc59cb5;_0x26fbf0=_0x4d3a79||[];var _0x2657b5=[];if(_0x4d3a79){for(var _0x5dbc71=0x0;_0x5dbc71<_0x4d3a79[_0x731d('0x45')];_0x5dbc71+=0x1){var _0x468d45=_0x4d3a79[_0x5dbc71][_0x731d('0x2c')]({'plain':!![]});_0xc59cb5=squel['insert']()[_0x731d('0xa3')](_0x731d('0xbb'))['fromQuery'](['phone',_0x731d('0xa8'),'ListId',_0x731d('0x68'),'createdAt',_0x731d('0x60')],squel[_0x731d('0x87')]()[_0x731d('0xa9')]('phone','phone')[_0x731d('0xa9')]('id',_0x731d('0xa8'))['field'](_0x468d45[_0x731d('0xae')][_0x731d('0x8f')](),'ListId')['field'](_0xfb0a27[_0x731d('0x54')]['id'][_0x731d('0x8f')](),_0x731d('0x68'))[_0x731d('0xa9')]('NOW()',_0x731d('0x5f'))['field']('NOW()',_0x731d('0x60'))[_0x731d('0x89')](_0x731d('0xac'))['where'](_0x731d('0xb7'))[_0x731d('0x4b')](_0x731d('0xad'),_0x468d45[_0x731d('0xae')][_0x731d('0x8f')]())[_0x731d('0x4b')](_0x731d('0xaf')))[_0x731d('0x8f')]();_0x2657b5[_0x731d('0x8e')](db[_0x731d('0x79')]['query'](_0xc59cb5));}return BPromise['all'](_0x2657b5);}})[_0x731d('0x2b')](function(){return _0x26fbf0;})['then'](respondWithResult(_0x22d46d,null))['catch'](handleError(_0x22d46d,null));};exports[_0x731d('0xbc')]=function(_0x33a153,_0x12c8dc,_0x27e9b7){return db[_0x731d('0x3b')][_0x731d('0x33')]({'where':{'id':_0x33a153[_0x731d('0x54')]['id']}})[_0x731d('0x2b')](handleEntityNotFound(_0x12c8dc,null))['then'](function(_0x5a7d08){if(_0x5a7d08){return _0x5a7d08[_0x731d('0xbc')](_0x33a153[_0x731d('0x3f')][_0x731d('0x97')]);}})[_0x731d('0x2b')](function(_0x3bfe9e){if(_0x3bfe9e){return db[_0x731d('0x6e')][_0x731d('0x36')]({'where':{'ListId':_0x33a153[_0x731d('0x3f')][_0x731d('0x97')],'VoiceQueueId':_0x33a153['params']['id']}})['then'](function(){return _0x3bfe9e;});}})[_0x731d('0x2b')](respondWithStatusCode(_0x12c8dc,null))['catch'](handleError(_0x12c8dc,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ac12cc6..217d6e3 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 _0xa67e=['update','emit','hasOwnProperty','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xa67e,0x113));var _0xea67=function(_0x46f1a8,_0x13175f){_0x46f1a8=_0x46f1a8-0x0;var _0x3fe58a=_0xa67e[_0x46f1a8];return _0x3fe58a;};'use strict';var EventEmitter=require(_0xea67('0x0'));var VoiceQueue=require(_0xea67('0x1'))['db'][_0xea67('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xea67('0x3')](0x0);var events={'afterCreate':_0xea67('0x4'),'afterUpdate':_0xea67('0x5'),'afterDestroy':'remove'};function emitEvent(_0x257db0){return function(_0x164014,_0x5d44f7,_0x57cf68){VoiceQueueEvents[_0xea67('0x6')](_0x257db0+':'+_0x164014['id'],_0x164014);VoiceQueueEvents[_0xea67('0x6')](_0x257db0,_0x164014);_0x57cf68(null);};}for(var e in events){if(events[_0xea67('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x94de=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5bc73f,_0x228b4a){var _0xe2f07b=function(_0x576392){while(--_0x576392){_0x5bc73f['push'](_0x5bc73f['shift']());}};_0xe2f07b(++_0x228b4a);}(_0x94de,0x1d8));var _0xe94d=function(_0x3a65b0,_0x176cec){_0x3a65b0=_0x3a65b0-0x0;var _0x4c519e=_0x94de[_0x3a65b0];return _0x4c519e;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe94d('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe94d('0x1')](0x0);var events={'afterCreate':_0xe94d('0x2'),'afterUpdate':_0xe94d('0x3'),'afterDestroy':_0xe94d('0x4')};function emitEvent(_0xb6f18d){return function(_0x1e815c,_0x2950af,_0x260b0d){VoiceQueueEvents[_0xe94d('0x5')](_0xb6f18d+':'+_0x1e815c['id'],_0x1e815c);VoiceQueueEvents['emit'](_0xb6f18d,_0x1e815c);_0x260b0d(null);};}for(var e in events){if(events[_0xe94d('0x6')](e)){var event=events[e];VoiceQueue[_0xe94d('0x7')](e,emitEvent(event));}}module[_0xe94d('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 501a8b7..0c9e0f8 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x14ab5f,_0x13902a){var _0x8c3ad3=function(_0x3f7e89){while(--_0x3f7e89){_0x14ab5f['push'](_0x14ab5f['shift']());}};_0x8c3ad3(++_0x13902a);}(_0xedd9,0xfc));var _0x9edd=function(_0x241b4b,_0x206d5a){_0x241b4b=_0x241b4b-0x0;var _0x2220d0=_0xedd9[_0x241b4b];return _0x2220d0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x55ca,0x126));var _0xa55c=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x55ca[_0x43576f];return _0x4d2466;};'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')]('VoiceQueue',attributes,{'tableName':_0xa55c('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 9abe4e2..2d581a6 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 _0x1ccb=['then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','include','map','model','attributes','ShowVoiceQueue','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request'];(function(_0x3c233c,_0xc4f3a1){var _0x200d17=function(_0x2eda84){while(--_0x2eda84){_0x3c233c['push'](_0x3c233c['shift']());}};_0x200d17(++_0xc4f3a1);}(_0x1ccb,0x69));var _0xb1cc=function(_0x613173,_0x5f2f24){_0x613173=_0x613173-0x0;var _0x1fde7a=_0x1ccb[_0x613173];return _0x1fde7a;};'use strict';var _=require(_0xb1cc('0x0'));var util=require(_0xb1cc('0x1'));var moment=require(_0xb1cc('0x2'));var BPromise=require(_0xb1cc('0x3'));var rs=require(_0xb1cc('0x4'));var fs=require('fs');var Redis=require(_0xb1cc('0x5'));var db=require(_0xb1cc('0x6'))['db'];var utils=require(_0xb1cc('0x7'));var logger=require('../../config/logger')(_0xb1cc('0x8'));var config=require(_0xb1cc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb1cc('0xa')][_0xb1cc('0xb')]({'port':0x232a});config[_0xb1cc('0xc')]=_[_0xb1cc('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb1cc('0xe'))(new Redis(config[_0xb1cc('0xc')]));require(_0xb1cc('0xf'))[_0xb1cc('0x10')](socket);function respondWithRpcPromise(_0x46854f,_0x3e6f1f,_0x33b544){return new BPromise(function(_0x54d093,_0xce63bd){return client[_0xb1cc('0x11')](_0x46854f,_0x33b544)[_0xb1cc('0x12')](function(_0x45965b){logger[_0xb1cc('0x13')](_0xb1cc('0x14'),_0x3e6f1f,_0xb1cc('0x15'));logger[_0xb1cc('0x16')](_0xb1cc('0x17'),_0x3e6f1f,_0xb1cc('0x15'),JSON[_0xb1cc('0x18')](_0x45965b));if(_0x45965b[_0xb1cc('0x19')]){if(_0x45965b['error'][_0xb1cc('0x1a')]===0x1f4){logger['error'](_0xb1cc('0x14'),_0x3e6f1f,_0x45965b[_0xb1cc('0x19')][_0xb1cc('0x1b')]);return _0xce63bd(_0x45965b[_0xb1cc('0x19')][_0xb1cc('0x1b')]);}logger[_0xb1cc('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x3e6f1f,_0x45965b[_0xb1cc('0x19')]['message']);return _0x54d093(_0x45965b[_0xb1cc('0x19')][_0xb1cc('0x1b')]);}else{logger[_0xb1cc('0x13')](_0xb1cc('0x14'),_0x3e6f1f,'request\x20sent');_0x54d093(_0x45965b[_0xb1cc('0x1c')][_0xb1cc('0x1b')]);}})[_0xb1cc('0x1d')](function(_0x5bc87f){logger[_0xb1cc('0x19')](_0xb1cc('0x14'),_0x3e6f1f,_0x5bc87f);_0xce63bd(_0x5bc87f);});});}exports[_0xb1cc('0x1e')]=function(_0x41c574){var _0x3b4632=this;return new Promise(function(_0x52e2f0,_0x546373){return db[_0xb1cc('0x1f')][_0xb1cc('0x20')]({'raw':_0x41c574[_0xb1cc('0x21')]?_0x41c574[_0xb1cc('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x41c574[_0xb1cc('0x21')]?_0x41c574['options']['where']||null:null,'attributes':_0x41c574[_0xb1cc('0x21')]?_0x41c574[_0xb1cc('0x21')]['attributes']||null:null,'limit':_0x41c574['options']?_0x41c574[_0xb1cc('0x21')]['limit']||null:null,'include':_0x41c574['options']?_0x41c574['options'][_0xb1cc('0x22')]?_[_0xb1cc('0x23')](_0x41c574[_0xb1cc('0x21')][_0xb1cc('0x22')],function(_0xf263e9){return{'model':db[_0xf263e9[_0xb1cc('0x24')]],'as':_0xf263e9['as'],'attributes':_0xf263e9[_0xb1cc('0x25')],'include':_0xf263e9[_0xb1cc('0x22')]?_['map'](_0xf263e9[_0xb1cc('0x22')],function(_0x4a6697){return{'model':db[_0x4a6697[_0xb1cc('0x24')]],'as':_0x4a6697['as'],'attributes':_0x4a6697['attributes'],'include':_0x4a6697['include']?_[_0xb1cc('0x23')](_0x4a6697[_0xb1cc('0x22')],function(_0x473f41){return{'model':db[_0x473f41[_0xb1cc('0x24')]],'as':_0x473f41['as'],'attributes':_0x473f41[_0xb1cc('0x25')]};}):[]};}):[]};}):[]:[]})[_0xb1cc('0x12')](function(_0x18bfed){logger[_0xb1cc('0x13')](_0xb1cc('0x1e'),_0x41c574);logger[_0xb1cc('0x16')](_0xb1cc('0x1e'),_0x41c574,JSON[_0xb1cc('0x18')](_0x18bfed));_0x52e2f0(_0x18bfed);})[_0xb1cc('0x1d')](function(_0x1e639b){logger[_0xb1cc('0x19')](_0xb1cc('0x1e'),_0x1e639b[_0xb1cc('0x1b')],_0x41c574);_0x546373(_0x3b4632[_0xb1cc('0x19')](0x1f4,_0x1e639b[_0xb1cc('0x1b')]));});});};exports[_0xb1cc('0x26')]=function(_0x322df5){var _0x12f3ae=this;return new Promise(function(_0x254ee6,_0x18a88b){return db[_0xb1cc('0x1f')]['find']({'raw':_0x322df5[_0xb1cc('0x21')]?_0x322df5[_0xb1cc('0x21')][_0xb1cc('0x27')]===undefined?!![]:![]:!![],'where':_0x322df5[_0xb1cc('0x21')]?_0x322df5['options'][_0xb1cc('0x28')]||null:null,'attributes':_0x322df5[_0xb1cc('0x21')]?_0x322df5[_0xb1cc('0x21')][_0xb1cc('0x25')]||null:null,'include':_0x322df5[_0xb1cc('0x21')]?_0x322df5[_0xb1cc('0x21')][_0xb1cc('0x22')]?_['map'](_0x322df5[_0xb1cc('0x21')][_0xb1cc('0x22')],function(_0x8ba150){return{'model':db[_0x8ba150[_0xb1cc('0x24')]],'as':_0x8ba150['as'],'attributes':_0x8ba150[_0xb1cc('0x25')],'include':_0x8ba150[_0xb1cc('0x22')]?_[_0xb1cc('0x23')](_0x8ba150[_0xb1cc('0x22')],function(_0x474b6d){return{'model':db[_0x474b6d[_0xb1cc('0x24')]],'as':_0x474b6d['as'],'attributes':_0x474b6d[_0xb1cc('0x25')],'include':_0x474b6d[_0xb1cc('0x22')]?_[_0xb1cc('0x23')](_0x474b6d[_0xb1cc('0x22')],function(_0xb9efd6){return{'model':db[_0xb9efd6[_0xb1cc('0x24')]],'as':_0xb9efd6['as'],'attributes':_0xb9efd6[_0xb1cc('0x25')]};}):[]};}):[]};}):[]:[]})[_0xb1cc('0x12')](function(_0x28c6eb){logger['info']('ShowVoiceQueue',_0x322df5);logger[_0xb1cc('0x16')](_0xb1cc('0x26'),_0x322df5,JSON['stringify'](_0x28c6eb));_0x254ee6(_0x28c6eb);})['catch'](function(_0x4e80b4){logger[_0xb1cc('0x19')]('ShowVoiceQueue',_0x4e80b4[_0xb1cc('0x1b')],_0x322df5);_0x18a88b(_0x12f3ae[_0xb1cc('0x19')](0x1f4,_0x4e80b4[_0xb1cc('0x1b')]));});});}; \ No newline at end of file +var _0x4cc2=['map','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','findAll','options','attributes','limit','model','include','GetVoiceQueue','stringify','VoiceQueue','find','raw'];(function(_0x155a97,_0x29ab1c){var _0x29a024=function(_0x2826de){while(--_0x2826de){_0x155a97['push'](_0x155a97['shift']());}};_0x29a024(++_0x29ab1c);}(_0x4cc2,0x7a));var _0x24cc=function(_0x3e3e0f,_0x344398){_0x3e3e0f=_0x3e3e0f-0x0;var _0x2a8007=_0x4cc2[_0x3e3e0f];return _0x2a8007;};'use strict';var _=require(_0x24cc('0x0'));var util=require(_0x24cc('0x1'));var moment=require(_0x24cc('0x2'));var BPromise=require(_0x24cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24cc('0x4'));var db=require(_0x24cc('0x5'))['db'];var utils=require(_0x24cc('0x6'));var logger=require(_0x24cc('0x7'))(_0x24cc('0x8'));var config=require(_0x24cc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x24cc('0xa')]({'port':0x232a});config[_0x24cc('0xb')]=_[_0x24cc('0xc')](config[_0x24cc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x24cc('0xd'))(new Redis(config['redis']));require(_0x24cc('0xe'))[_0x24cc('0xf')](socket);function respondWithRpcPromise(_0x315a15,_0x363c9f,_0x4e586d){return new BPromise(function(_0x6de19a,_0x482698){return client['request'](_0x315a15,_0x4e586d)[_0x24cc('0x10')](function(_0x24e923){logger[_0x24cc('0x11')](_0x24cc('0x12'),_0x363c9f,_0x24cc('0x13'));logger[_0x24cc('0x14')](_0x24cc('0x15'),_0x363c9f,'request\x20sent',JSON['stringify'](_0x24e923));if(_0x24e923['error']){if(_0x24e923['error'][_0x24cc('0x16')]===0x1f4){logger[_0x24cc('0x17')](_0x24cc('0x12'),_0x363c9f,_0x24e923[_0x24cc('0x17')][_0x24cc('0x18')]);return _0x482698(_0x24e923['error'][_0x24cc('0x18')]);}logger[_0x24cc('0x17')](_0x24cc('0x12'),_0x363c9f,_0x24e923[_0x24cc('0x17')]['message']);return _0x6de19a(_0x24e923[_0x24cc('0x17')]['message']);}else{logger[_0x24cc('0x11')](_0x24cc('0x12'),_0x363c9f,'request\x20sent');_0x6de19a(_0x24e923[_0x24cc('0x19')][_0x24cc('0x18')]);}})[_0x24cc('0x1a')](function(_0x5f58cc){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x363c9f,_0x5f58cc);_0x482698(_0x5f58cc);});});}exports['GetVoiceQueue']=function(_0x5000dd){var _0x12b063=this;return new Promise(function(_0x5260ab,_0x1419c1){return db['VoiceQueue'][_0x24cc('0x1b')]({'raw':_0x5000dd['options']?_0x5000dd[_0x24cc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5000dd['options']?_0x5000dd[_0x24cc('0x1c')]['where']||null:null,'attributes':_0x5000dd[_0x24cc('0x1c')]?_0x5000dd['options'][_0x24cc('0x1d')]||null:null,'limit':_0x5000dd[_0x24cc('0x1c')]?_0x5000dd['options'][_0x24cc('0x1e')]||null:null,'include':_0x5000dd[_0x24cc('0x1c')]?_0x5000dd[_0x24cc('0x1c')]['include']?_['map'](_0x5000dd['options']['include'],function(_0x24a0a1){return{'model':db[_0x24a0a1[_0x24cc('0x1f')]],'as':_0x24a0a1['as'],'attributes':_0x24a0a1[_0x24cc('0x1d')],'include':_0x24a0a1[_0x24cc('0x20')]?_['map'](_0x24a0a1[_0x24cc('0x20')],function(_0x16496b){return{'model':db[_0x16496b[_0x24cc('0x1f')]],'as':_0x16496b['as'],'attributes':_0x16496b['attributes'],'include':_0x16496b[_0x24cc('0x20')]?_['map'](_0x16496b['include'],function(_0x38b4ee){return{'model':db[_0x38b4ee[_0x24cc('0x1f')]],'as':_0x38b4ee['as'],'attributes':_0x38b4ee[_0x24cc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x24cc('0x10')](function(_0x59dbfd){logger[_0x24cc('0x11')](_0x24cc('0x21'),_0x5000dd);logger[_0x24cc('0x14')](_0x24cc('0x21'),_0x5000dd,JSON[_0x24cc('0x22')](_0x59dbfd));_0x5260ab(_0x59dbfd);})[_0x24cc('0x1a')](function(_0x41b3d1){logger[_0x24cc('0x17')]('GetVoiceQueue',_0x41b3d1[_0x24cc('0x18')],_0x5000dd);_0x1419c1(_0x12b063[_0x24cc('0x17')](0x1f4,_0x41b3d1[_0x24cc('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x681f24){var _0x36dc25=this;return new Promise(function(_0x1c1eb4,_0x3285e8){return db[_0x24cc('0x23')][_0x24cc('0x24')]({'raw':_0x681f24['options']?_0x681f24[_0x24cc('0x1c')][_0x24cc('0x25')]===undefined?!![]:![]:!![],'where':_0x681f24[_0x24cc('0x1c')]?_0x681f24[_0x24cc('0x1c')]['where']||null:null,'attributes':_0x681f24['options']?_0x681f24[_0x24cc('0x1c')][_0x24cc('0x1d')]||null:null,'include':_0x681f24[_0x24cc('0x1c')]?_0x681f24['options'][_0x24cc('0x20')]?_[_0x24cc('0x26')](_0x681f24[_0x24cc('0x1c')][_0x24cc('0x20')],function(_0x166cdd){return{'model':db[_0x166cdd[_0x24cc('0x1f')]],'as':_0x166cdd['as'],'attributes':_0x166cdd[_0x24cc('0x1d')],'include':_0x166cdd[_0x24cc('0x20')]?_[_0x24cc('0x26')](_0x166cdd[_0x24cc('0x20')],function(_0x41f68f){return{'model':db[_0x41f68f[_0x24cc('0x1f')]],'as':_0x41f68f['as'],'attributes':_0x41f68f[_0x24cc('0x1d')],'include':_0x41f68f[_0x24cc('0x20')]?_[_0x24cc('0x26')](_0x41f68f[_0x24cc('0x20')],function(_0x91b4bf){return{'model':db[_0x91b4bf[_0x24cc('0x1f')]],'as':_0x91b4bf['as'],'attributes':_0x91b4bf[_0x24cc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x24cc('0x10')](function(_0x2d1b34){logger[_0x24cc('0x11')]('ShowVoiceQueue',_0x681f24);logger['debug']('ShowVoiceQueue',_0x681f24,JSON[_0x24cc('0x22')](_0x2d1b34));_0x1c1eb4(_0x2d1b34);})[_0x24cc('0x1a')](function(_0x55aeee){logger[_0x24cc('0x17')](_0x24cc('0x27'),_0x55aeee[_0x24cc('0x18')],_0x681f24);_0x3285e8(_0x36dc25['error'](0x1f4,_0x55aeee[_0x24cc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 133492d..c7a7b8b 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 _0x0179=['update','emit','removeListener','register','length','voiceQueue:','save','remove'];(function(_0x42d57f,_0x417973){var _0x249b49=function(_0x2642c5){while(--_0x2642c5){_0x42d57f['push'](_0x42d57f['shift']());}};_0x249b49(++_0x417973);}(_0x0179,0x96));var _0x9017=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0179[_0x13d07a];return _0x5ee0ee;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x9017('0x0'),_0x9017('0x1'),_0x9017('0x2')];function createListener(_0x1bc117,_0x2aaf5e){return function(_0x337550){_0x2aaf5e[_0x9017('0x3')](_0x1bc117,_0x337550);};}function removeListener(_0x150956,_0x4ae7ff){return function(){VoiceQueueEvents[_0x9017('0x4')](_0x150956,_0x4ae7ff);};}exports[_0x9017('0x5')]=function(_0x3f0b64){for(var _0xf86697=0x0,_0xe634ac=events[_0x9017('0x6')];_0xf86697<_0xe634ac;_0xf86697++){var _0x55422c=events[_0xf86697];var _0x69e366=createListener(_0x9017('0x7')+_0x55422c,_0x3f0b64);VoiceQueueEvents['on'](_0x55422c,_0x69e366);}}; \ No newline at end of file +var _0x43b0=['emit','removeListener','length','voiceQueue:','save','remove','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x43b0,0x177));var _0x043b=function(_0x332467,_0x25ea52){_0x332467=_0x332467-0x0;var _0x4a61b7=_0x43b0[_0x332467];return _0x4a61b7;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x043b('0x0'),_0x043b('0x1'),_0x043b('0x2')];function createListener(_0x4aa7ec,_0x233ea1){return function(_0x50b92a){_0x233ea1[_0x043b('0x3')](_0x4aa7ec,_0x50b92a);};}function removeListener(_0x30e50f,_0x202d14){return function(){VoiceQueueEvents[_0x043b('0x4')](_0x30e50f,_0x202d14);};}exports['register']=function(_0x3436f4){for(var _0x47ffc4=0x0,_0x196d05=events[_0x043b('0x5')];_0x47ffc4<_0x196d05;_0x47ffc4++){var _0x4cfc5f=events[_0x47ffc4];var _0x1cd539=createListener(_0x043b('0x6')+_0x4cfc5f,_0x3436f4);VoiceQueueEvents['on'](_0x4cfc5f,_0x1cd539);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9fbcb2d..689e774 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 _0x272f=['delete','exports','path','express','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','/index','getVoiceQueuesReport','post','put','update'];(function(_0x16c7d4,_0x1fd6a5){var _0x54c042=function(_0x2ef67c){while(--_0x2ef67c){_0x16c7d4['push'](_0x16c7d4['shift']());}};_0x54c042(++_0x1fd6a5);}(_0x272f,0xb6));var _0xf272=function(_0xb3dfa0,_0x5ab4c9){_0xb3dfa0=_0xb3dfa0-0x0;var _0x1b9c9e=_0x272f[_0xb3dfa0];return _0x1b9c9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf272('0x0'));var timeout=require('connect-timeout');var express=require(_0xf272('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf272('0x2'));var config=require(_0xf272('0x3'));var controller=require(_0xf272('0x4'));router[_0xf272('0x5')]('/',auth[_0xf272('0x6')](),controller['index']);router[_0xf272('0x5')](_0xf272('0x7'),auth[_0xf272('0x6')](),controller['describe']);router[_0xf272('0x5')](_0xf272('0x8'),auth[_0xf272('0x6')](),controller[_0xf272('0x9')]);router[_0xf272('0x5')]('/:id',auth[_0xf272('0x6')](),controller['show']);router[_0xf272('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf272('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf272('0xc')]);router[_0xf272('0xd')]('/:id',auth[_0xf272('0x6')](),controller['destroy']);module[_0xf272('0xe')]=router; \ No newline at end of file +var _0x8099=['index','/describe','/index','/:id','show','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated'];(function(_0x3396c6,_0x41bb30){var _0x3dc72d=function(_0x3c5dde){while(--_0x3c5dde){_0x3396c6['push'](_0x3396c6['shift']());}};_0x3dc72d(++_0x41bb30);}(_0x8099,0xee));var _0x9809=function(_0x45d581,_0x25d567){_0x45d581=_0x45d581-0x0;var _0x3bc09f=_0x8099[_0x45d581];return _0x3bc09f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9809('0x0'));var timeout=require(_0x9809('0x1'));var express=require(_0x9809('0x2'));var router=express[_0x9809('0x3')]();var fs_extra=require(_0x9809('0x4'));var auth=require(_0x9809('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9809('0x6'));router[_0x9809('0x7')]('/',auth[_0x9809('0x8')](),controller[_0x9809('0x9')]);router[_0x9809('0x7')](_0x9809('0xa'),auth[_0x9809('0x8')](),controller['describe']);router[_0x9809('0x7')](_0x9809('0xb'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0x9809('0xc'),auth[_0x9809('0x8')](),controller[_0x9809('0xd')]);router['post']('/',auth[_0x9809('0x8')](),controller[_0x9809('0xe')]);router[_0x9809('0xf')](_0x9809('0xc'),auth['isAuthenticated'](),controller[_0x9809('0x10')]);router[_0x9809('0x11')](_0x9809('0xc'),auth[_0x9809('0x8')](),controller[_0x9809('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 26caf44..6cde384 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 _0x76c4=['moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4e6d30,_0x30dd48){var _0x413279=function(_0x387876){while(--_0x387876){_0x4e6d30['push'](_0x4e6d30['shift']());}};_0x413279(++_0x30dd48);}(_0x76c4,0x1c3));var _0x476c=function(_0xc98471,_0x27284e){_0xc98471=_0xc98471-0x0;var _0x222f99=_0x76c4[_0xc98471];return _0x222f99;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x476c('0x0'));module[_0x476c('0x1')]={'type':{'type':Sequelize[_0x476c('0x2')]},'uniqueid':{'type':Sequelize[_0x476c('0x2')]},'calleridnum':{'type':Sequelize[_0x476c('0x2')]},'calleridname':{'type':Sequelize[_0x476c('0x2')]},'queue':{'type':Sequelize[_0x476c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x476c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x476c('0x3')],'set':function(_0x3567af){var _0x46c03d=moment(_0x3567af);var _0x57086c=moment(this[_0x476c('0x4')]('queuecallerjoinAt'))['format'](_0x476c('0x5'));var _0x2b2530=_0x46c03d[_0x476c('0x6')](_0x57086c,'seconds');this['setDataValue']('queuecallerleaveAt',_0x3567af);this[_0x476c('0x7')]('holdtime',_0x2b2530||null);}},'position':{'type':Sequelize[_0x476c('0x8')]},'count':{'type':Sequelize[_0x476c('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x476c('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x476c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x476c('0x3')]},'queuecallerexit':{'type':Sequelize[_0x476c('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x476c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x476c('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x476c('0x8')]},'channel':{'type':Sequelize[_0x476c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x476c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x476c('0x2')]},'exten':{'type':Sequelize[_0x476c('0x2')]},'priority':{'type':Sequelize[_0x476c('0x2')]},'holdtime':{'type':Sequelize[_0x476c('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x476c('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x476c('0x2')]},'transfer':{'type':Sequelize[_0x476c('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x476c('0x2')],'comment':_0x476c('0xa')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x476c('0x2')]},'disposition':{'type':Sequelize[_0x476c('0x2')]},'secondDisposition':{'type':Sequelize[_0x476c('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x476c('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa4c7=['DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0xa4c7,0xcf));var _0x7a4c=function(_0x5bb629,_0x145a97){_0x5bb629=_0x5bb629-0x0;var _0x95b6f3=_0xa4c7[_0x5bb629];return _0x95b6f3;};'use strict';var Sequelize=require(_0x7a4c('0x0'));var moment=require('moment');module[_0x7a4c('0x1')]={'type':{'type':Sequelize[_0x7a4c('0x2')]},'uniqueid':{'type':Sequelize[_0x7a4c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7a4c('0x2')]},'queue':{'type':Sequelize[_0x7a4c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x7a4c('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x27b22d){var _0x528d07=moment(_0x27b22d);var _0x50c943=moment(this[_0x7a4c('0x4')](_0x7a4c('0x5')))['format'](_0x7a4c('0x6'));var _0x53edd1=_0x528d07[_0x7a4c('0x7')](_0x50c943,'seconds');this['setDataValue'](_0x7a4c('0x8'),_0x27b22d);this[_0x7a4c('0x9')](_0x7a4c('0xa'),_0x53edd1||null);}},'position':{'type':Sequelize[_0x7a4c('0xb')]},'count':{'type':Sequelize[_0x7a4c('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x7a4c('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7a4c('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7a4c('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7a4c('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7a4c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7a4c('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7a4c('0xb')]},'channel':{'type':Sequelize[_0x7a4c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7a4c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7a4c('0x2')]},'priority':{'type':Sequelize[_0x7a4c('0x2')]},'holdtime':{'type':Sequelize[_0x7a4c('0xb')]},'mohtime':{'type':Sequelize[_0x7a4c('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7a4c('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7a4c('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7a4c('0x2')],'comment':_0x7a4c('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x7a4c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7a4c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7a4c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7a4c('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index e0bdf3f..fd24a83 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 _0x78f6=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','VoiceQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','getVoiceQueuesReport','nolimit','merge','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x66ea71,_0xc4bdce){var _0x49b4be=function(_0x2ba94a){while(--_0x2ba94a){_0x66ea71['push'](_0x66ea71['shift']());}};_0x49b4be(++_0xc4bdce);}(_0x78f6,0x95));var _0x678f=function(_0x26d622,_0xdd70b9){_0x26d622=_0x26d622-0x0;var _0x1ce796=_0x78f6[_0x26d622];return _0x1ce796;};'use strict';var emlformat=require(_0x678f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x678f('0x1'));var rp=require(_0x678f('0x2'));var moment=require('moment');var BPromise=require(_0x678f('0x3'));var Mustache=require(_0x678f('0x4'));var util=require(_0x678f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x678f('0x6'));var ejs=require(_0x678f('0x7'));var fs=require('fs');var fs_extra=require(_0x678f('0x8'));var _=require(_0x678f('0x9'));var squel=require('squel');var crypto=require(_0x678f('0xa'));var jsforce=require(_0x678f('0xb'));var deskjs=require(_0x678f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x678f('0xd'));var Papa=require(_0x678f('0xe'));var Redis=require(_0x678f('0xf'));var authService=require(_0x678f('0x10'));var qs=require(_0x678f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x678f('0x12'))('api');var utils=require(_0x678f('0x13'));var config=require(_0x678f('0x14'));var licenseUtil=require(_0x678f('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x678f('0x16')](config[_0x678f('0x17')],{'host':_0x678f('0x18'),'port':0x18eb});var socket=require(_0x678f('0x19'))(new Redis(config['redis']));require(_0x678f('0x1a'))['register'](socket);function respondWithStatusCode(_0x53f962,_0x4c1aed){_0x4c1aed=_0x4c1aed||0xcc;return function(_0x4c6865){if(_0x4c6865){return _0x53f962['sendStatus'](_0x4c1aed);}return _0x53f962[_0x678f('0x1b')](_0x4c1aed)[_0x678f('0x1c')]();};}function respondWithResult(_0x5b0ebf,_0x131edc){_0x131edc=_0x131edc||0xc8;return function(_0x1f9cc0){if(_0x1f9cc0){return _0x5b0ebf[_0x678f('0x1b')](_0x131edc)[_0x678f('0x1d')](_0x1f9cc0);}};}function respondWithFilteredResult(_0x54c0de,_0x28953a){return function(_0x23dfb6){if(_0x23dfb6){var _0x5599bf=typeof _0x28953a[_0x678f('0x1e')]==='undefined'&&typeof _0x28953a[_0x678f('0x1f')]===_0x678f('0x20');var _0xde5f94=_0x23dfb6[_0x678f('0x21')];var _0x1e177a=_0x5599bf?0x0:_0x28953a[_0x678f('0x1e')];var _0x3e17fd=_0x5599bf?_0x23dfb6[_0x678f('0x21')]:_0x28953a[_0x678f('0x1e')]+_0x28953a[_0x678f('0x1f')];var _0x498c60;if(_0x3e17fd>=_0xde5f94){_0x3e17fd=_0xde5f94;_0x498c60=0xc8;}else{_0x498c60=0xce;}_0x54c0de[_0x678f('0x1b')](_0x498c60);return _0x54c0de[_0x678f('0x22')](_0x678f('0x23'),_0x1e177a+'-'+_0x3e17fd+'/'+_0xde5f94)[_0x678f('0x1d')](_0x23dfb6);}return null;};}function patchUpdates(_0x59299e){return function(_0x17483c){try{jsonpatch[_0x678f('0x24')](_0x17483c,_0x59299e,!![]);}catch(_0x202cba){return BPromise[_0x678f('0x25')](_0x202cba);}return _0x17483c[_0x678f('0x26')]();};}function saveUpdates(_0x39b384,_0x338b27){return function(_0x5a206b){if(_0x5a206b){return _0x5a206b['update'](_0x39b384)['then'](function(_0x24d700){return _0x24d700;});}return null;};}function removeEntity(_0x33b111,_0x378ab1){return function(_0x3ff083){if(_0x3ff083){return _0x3ff083[_0x678f('0x27')]()[_0x678f('0x28')](function(){_0x33b111[_0x678f('0x1b')](0xcc)[_0x678f('0x1c')]();});}};}function handleEntityNotFound(_0x22566c,_0x22c12f){return function(_0x1010aa){if(!_0x1010aa){_0x22566c[_0x678f('0x29')](0x194);}return _0x1010aa;};}function handleError(_0x158fbb,_0x15a0b1){_0x15a0b1=_0x15a0b1||0x1f4;return function(_0x3fa22e){logger[_0x678f('0x2a')](_0x3fa22e[_0x678f('0x2b')]);if(_0x3fa22e[_0x678f('0x2c')]){delete _0x3fa22e[_0x678f('0x2c')];}_0x158fbb[_0x678f('0x1b')](_0x15a0b1)['send'](_0x3fa22e);};}exports[_0x678f('0x2d')]=function(_0x2cc568,_0x287800){var _0x3ae9b7={},_0xa5b939={},_0x207ba1={'count':0x0,'rows':[]};var _0x1ad0e1=_['map'](db[_0x678f('0x2e')][_0x678f('0x2f')],function(_0x22e4f5){return{'name':_0x22e4f5['fieldName'],'type':_0x22e4f5[_0x678f('0x30')][_0x678f('0x31')]};});_0xa5b939[_0x678f('0x32')]=_['map'](_0x1ad0e1,'name');_0xa5b939[_0x678f('0x33')]=_[_0x678f('0x34')](_0x2cc568[_0x678f('0x33')]);_0xa5b939['filters']=_[_0x678f('0x35')](_0xa5b939[_0x678f('0x32')],_0xa5b939[_0x678f('0x33')]);_0x3ae9b7[_0x678f('0x36')]=_[_0x678f('0x35')](_0xa5b939['model'],qs[_0x678f('0x37')](_0x2cc568[_0x678f('0x33')][_0x678f('0x37')]));_0x3ae9b7[_0x678f('0x36')]=_0x3ae9b7['attributes'][_0x678f('0x38')]?_0x3ae9b7[_0x678f('0x36')]:_0xa5b939[_0x678f('0x32')];if(!_0x2cc568['query'][_0x678f('0x39')]('nolimit')){_0x3ae9b7[_0x678f('0x1f')]=qs['limit'](_0x2cc568[_0x678f('0x33')][_0x678f('0x1f')]);_0x3ae9b7[_0x678f('0x1e')]=qs[_0x678f('0x1e')](_0x2cc568['query'][_0x678f('0x1e')]);}_0x3ae9b7[_0x678f('0x3a')]=qs[_0x678f('0x3b')](_0x2cc568['query'][_0x678f('0x3b')]);_0x3ae9b7[_0x678f('0x3c')]=qs[_0x678f('0x3d')](_[_0x678f('0x3e')](_0x2cc568[_0x678f('0x33')],_0xa5b939[_0x678f('0x3d')]),_0x1ad0e1);if(_0x2cc568[_0x678f('0x33')][_0x678f('0x3f')]){_0x3ae9b7[_0x678f('0x3c')]=_['merge'](_0x3ae9b7[_0x678f('0x3c')],{'$or':_[_0x678f('0x40')](_0x1ad0e1,function(_0x34aa24){if(_0x34aa24[_0x678f('0x30')]!==_0x678f('0x41')){var _0x207ca0={};_0x207ca0[_0x34aa24['name']]={'$like':'%'+_0x2cc568[_0x678f('0x33')][_0x678f('0x3f')]+'%'};return _0x207ca0;}})});}_0x3ae9b7=_['merge']({},_0x3ae9b7,_0x2cc568['options']);var _0x208f19={'where':_0x3ae9b7['where']};return db[_0x678f('0x2e')][_0x678f('0x21')](_0x208f19)[_0x678f('0x28')](function(_0x398693){_0x207ba1[_0x678f('0x21')]=_0x398693;if(_0x2cc568[_0x678f('0x33')][_0x678f('0x42')]){_0x3ae9b7[_0x678f('0x43')]=[{'all':!![]}];}return db[_0x678f('0x2e')][_0x678f('0x44')](_0x3ae9b7);})[_0x678f('0x28')](function(_0x7c573){_0x207ba1[_0x678f('0x45')]=_0x7c573;return _0x207ba1;})['then'](respondWithFilteredResult(_0x287800,_0x3ae9b7))[_0x678f('0x46')](handleError(_0x287800,null));};exports[_0x678f('0x47')]=function(_0x2f9bad,_0x203be8){var _0xb2689c={'raw':![],'where':{'id':_0x2f9bad[_0x678f('0x48')]['id']}},_0x1759ab={};_0x1759ab['model']=_[_0x678f('0x34')](db[_0x678f('0x2e')][_0x678f('0x2f')]);_0x1759ab[_0x678f('0x33')]=_[_0x678f('0x34')](_0x2f9bad[_0x678f('0x33')]);_0x1759ab['filters']=_['intersection'](_0x1759ab[_0x678f('0x32')],_0x1759ab[_0x678f('0x33')]);_0xb2689c[_0x678f('0x36')]=_[_0x678f('0x35')](_0x1759ab[_0x678f('0x32')],qs[_0x678f('0x37')](_0x2f9bad[_0x678f('0x33')]['fields']));_0xb2689c[_0x678f('0x36')]=_0xb2689c['attributes'][_0x678f('0x38')]?_0xb2689c[_0x678f('0x36')]:_0x1759ab['model'];if(_0x2f9bad[_0x678f('0x33')][_0x678f('0x42')]){_0xb2689c[_0x678f('0x43')]=[{'all':!![]}];}_0xb2689c=_['merge']({},_0xb2689c,_0x2f9bad[_0x678f('0x49')]);return db[_0x678f('0x2e')][_0x678f('0x4a')](_0xb2689c)[_0x678f('0x28')](handleEntityNotFound(_0x203be8,null))[_0x678f('0x28')](respondWithResult(_0x203be8,null))['catch'](handleError(_0x203be8,null));};exports[_0x678f('0x4b')]=function(_0x59da3f,_0x518ad9){return db[_0x678f('0x2e')][_0x678f('0x4b')](_0x59da3f[_0x678f('0x4c')],{})['then'](respondWithResult(_0x518ad9,0xc9))[_0x678f('0x46')](handleError(_0x518ad9,null));};exports['update']=function(_0x477a9f,_0x3cf512){if(_0x477a9f[_0x678f('0x4c')]['id']){delete _0x477a9f['body']['id'];}return db[_0x678f('0x2e')]['find']({'where':{'id':_0x477a9f[_0x678f('0x48')]['id']}})[_0x678f('0x28')](handleEntityNotFound(_0x3cf512,null))[_0x678f('0x28')](saveUpdates(_0x477a9f['body'],null))['then'](respondWithResult(_0x3cf512,null))[_0x678f('0x46')](handleError(_0x3cf512,null));};exports[_0x678f('0x27')]=function(_0x20b968,_0x32b0a3){return db[_0x678f('0x2e')][_0x678f('0x4a')]({'where':{'id':_0x20b968['params']['id']}})[_0x678f('0x28')](handleEntityNotFound(_0x32b0a3,null))[_0x678f('0x28')](removeEntity(_0x32b0a3,null))[_0x678f('0x46')](handleError(_0x32b0a3,null));};exports[_0x678f('0x4d')]=function(_0x51f99b,_0x59b17c){return db[_0x678f('0x2e')][_0x678f('0x4d')]()[_0x678f('0x28')](respondWithResult(_0x59b17c,null))[_0x678f('0x46')](handleError(_0x59b17c,null));};exports[_0x678f('0x4e')]=function(_0x3f306f,_0x1e5840){var _0x4e8b2c={},_0x6c5b5f={},_0x1335d2={'count':0x0,'rows':[]};_0x6c5b5f[_0x678f('0x32')]=_[_0x678f('0x34')](db[_0x678f('0x2e')]['rawAttributes']);_0x6c5b5f[_0x678f('0x33')]=_[_0x678f('0x34')](_0x3f306f['query']);_0x6c5b5f[_0x678f('0x3d')]=_[_0x678f('0x35')](_0x6c5b5f[_0x678f('0x32')],_0x6c5b5f[_0x678f('0x33')]);_0x4e8b2c['attributes']=_[_0x678f('0x35')](_0x6c5b5f['model'],qs['fields'](_0x3f306f[_0x678f('0x33')][_0x678f('0x37')]));_0x4e8b2c[_0x678f('0x36')]=_0x4e8b2c[_0x678f('0x36')][_0x678f('0x38')]?_0x4e8b2c['attributes']:_0x6c5b5f[_0x678f('0x32')];if(!_0x3f306f[_0x678f('0x33')][_0x678f('0x39')](_0x678f('0x4f'))){_0x4e8b2c[_0x678f('0x1f')]=qs[_0x678f('0x1f')](_0x3f306f[_0x678f('0x33')][_0x678f('0x1f')]);_0x4e8b2c[_0x678f('0x1e')]=qs[_0x678f('0x1e')](_0x3f306f[_0x678f('0x33')][_0x678f('0x1e')]);}_0x4e8b2c[_0x678f('0x3a')]=qs[_0x678f('0x3b')](_0x3f306f[_0x678f('0x33')][_0x678f('0x3b')]);_0x4e8b2c['where']=qs[_0x678f('0x3d')](_[_0x678f('0x3e')](_0x3f306f[_0x678f('0x33')],_0x6c5b5f['filters']));if(_0x3f306f[_0x678f('0x33')]['filter']){_0x4e8b2c['where']=_[_0x678f('0x50')](_0x4e8b2c[_0x678f('0x3c')],{'$or':_['map'](_0x4e8b2c[_0x678f('0x36')],function(_0x10af2f){var _0x3cc078={};_0x3cc078[_0x10af2f]={'$like':'%'+_0x3f306f[_0x678f('0x33')][_0x678f('0x3f')]+'%'};return _0x3cc078;})});}_0x4e8b2c=_['merge']({},_0x4e8b2c,_0x3f306f[_0x678f('0x49')]);var _0x12f0bb={'where':_0x4e8b2c[_0x678f('0x3c')]};return db[_0x678f('0x2e')][_0x678f('0x21')](_0x12f0bb)[_0x678f('0x28')](function(_0x25c2eb){_0x1335d2[_0x678f('0x21')]=_0x25c2eb;if(_0x3f306f[_0x678f('0x33')][_0x678f('0x42')]){_0x4e8b2c[_0x678f('0x43')]=[{'all':!![]}];}return db[_0x678f('0x2e')][_0x678f('0x44')](_0x4e8b2c);})[_0x678f('0x28')](function(_0x2f520f){_0x1335d2[_0x678f('0x45')]=_0x2f520f;return _0x1335d2;})[_0x678f('0x28')](respondWithFilteredResult(_0x1e5840,_0x4e8b2c,_0x678f('0x4e')))[_0x678f('0x46')](handleError(_0x1e5840,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x0264=['../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','getVoiceQueuesReport','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x5d658e,_0x31a39b){var _0x1d1203=function(_0x2a6c9d){while(--_0x2a6c9d){_0x5d658e['push'](_0x5d658e['shift']());}};_0x1d1203(++_0x31a39b);}(_0x0264,0x13b));var _0x4026=function(_0x217e6d,_0x4fdb73){_0x217e6d=_0x217e6d-0x0;var _0x108746=_0x0264[_0x217e6d];return _0x108746;};'use strict';var emlformat=require(_0x4026('0x0'));var rimraf=require(_0x4026('0x1'));var zipdir=require(_0x4026('0x2'));var jsonpatch=require(_0x4026('0x3'));var rp=require(_0x4026('0x4'));var moment=require(_0x4026('0x5'));var BPromise=require(_0x4026('0x6'));var Mustache=require(_0x4026('0x7'));var util=require(_0x4026('0x8'));var path=require(_0x4026('0x9'));var sox=require('sox');var csv=require(_0x4026('0xa'));var ejs=require(_0x4026('0xb'));var fs=require('fs');var fs_extra=require(_0x4026('0xc'));var _=require(_0x4026('0xd'));var squel=require(_0x4026('0xe'));var crypto=require(_0x4026('0xf'));var jsforce=require(_0x4026('0x10'));var deskjs=require(_0x4026('0x11'));var toCsv=require(_0x4026('0xa'));var querystring=require(_0x4026('0x12'));var Papa=require(_0x4026('0x13'));var Redis=require('ioredis');var authService=require(_0x4026('0x14'));var qs=require(_0x4026('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4026('0x16'))(_0x4026('0x17'));var utils=require('../../config/utils');var config=require(_0x4026('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4026('0x19'))['db'];config[_0x4026('0x1a')]=_[_0x4026('0x1b')](config[_0x4026('0x1a')],{'host':_0x4026('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4026('0x1a')]));require(_0x4026('0x1d'))[_0x4026('0x1e')](socket);function respondWithStatusCode(_0x3c3940,_0x499055){_0x499055=_0x499055||0xcc;return function(_0x19b878){if(_0x19b878){return _0x3c3940['sendStatus'](_0x499055);}return _0x3c3940[_0x4026('0x1f')](_0x499055)[_0x4026('0x20')]();};}function respondWithResult(_0xfb5496,_0x394fd2){_0x394fd2=_0x394fd2||0xc8;return function(_0x478d07){if(_0x478d07){return _0xfb5496['status'](_0x394fd2)[_0x4026('0x21')](_0x478d07);}};}function respondWithFilteredResult(_0x39037c,_0x36ac84){return function(_0x50a664){if(_0x50a664){var _0x22a090=typeof _0x36ac84['offset']===_0x4026('0x22')&&typeof _0x36ac84[_0x4026('0x23')]===_0x4026('0x22');var _0x93bfc8=_0x50a664[_0x4026('0x24')];var _0x480541=_0x22a090?0x0:_0x36ac84[_0x4026('0x25')];var _0xc2c5d1=_0x22a090?_0x50a664[_0x4026('0x24')]:_0x36ac84[_0x4026('0x25')]+_0x36ac84[_0x4026('0x23')];var _0x41bc2d;if(_0xc2c5d1>=_0x93bfc8){_0xc2c5d1=_0x93bfc8;_0x41bc2d=0xc8;}else{_0x41bc2d=0xce;}_0x39037c['status'](_0x41bc2d);return _0x39037c['set'](_0x4026('0x26'),_0x480541+'-'+_0xc2c5d1+'/'+_0x93bfc8)['json'](_0x50a664);}return null;};}function patchUpdates(_0x286e13){return function(_0xf410cb){try{jsonpatch[_0x4026('0x27')](_0xf410cb,_0x286e13,!![]);}catch(_0x4d41b3){return BPromise['reject'](_0x4d41b3);}return _0xf410cb[_0x4026('0x28')]();};}function saveUpdates(_0x10735d,_0x2ba4e6){return function(_0xeaa2cf){if(_0xeaa2cf){return _0xeaa2cf[_0x4026('0x29')](_0x10735d)['then'](function(_0x3c486f){return _0x3c486f;});}return null;};}function removeEntity(_0x1086b5,_0x48519f){return function(_0xf61395){if(_0xf61395){return _0xf61395[_0x4026('0x2a')]()[_0x4026('0x2b')](function(){_0x1086b5[_0x4026('0x1f')](0xcc)[_0x4026('0x20')]();});}};}function handleEntityNotFound(_0x38bce7,_0x47a8ba){return function(_0x3203aa){if(!_0x3203aa){_0x38bce7[_0x4026('0x2c')](0x194);}return _0x3203aa;};}function handleError(_0x347ec0,_0x31f968){_0x31f968=_0x31f968||0x1f4;return function(_0x5980bc){logger[_0x4026('0x2d')](_0x5980bc[_0x4026('0x2e')]);if(_0x5980bc[_0x4026('0x2f')]){delete _0x5980bc[_0x4026('0x2f')];}_0x347ec0[_0x4026('0x1f')](_0x31f968)[_0x4026('0x30')](_0x5980bc);};}exports[_0x4026('0x31')]=function(_0x1623b6,_0xe7943){var _0x5ac591={},_0x410d3d={},_0x861820={'count':0x0,'rows':[]};var _0x32f166=_['map'](db[_0x4026('0x32')][_0x4026('0x33')],function(_0x54b5e4){return{'name':_0x54b5e4[_0x4026('0x34')],'type':_0x54b5e4[_0x4026('0x35')][_0x4026('0x36')]};});_0x410d3d[_0x4026('0x37')]=_[_0x4026('0x38')](_0x32f166,'name');_0x410d3d[_0x4026('0x39')]=_[_0x4026('0x3a')](_0x1623b6[_0x4026('0x39')]);_0x410d3d[_0x4026('0x3b')]=_[_0x4026('0x3c')](_0x410d3d[_0x4026('0x37')],_0x410d3d[_0x4026('0x39')]);_0x5ac591[_0x4026('0x3d')]=_[_0x4026('0x3c')](_0x410d3d[_0x4026('0x37')],qs[_0x4026('0x3e')](_0x1623b6[_0x4026('0x39')]['fields']));_0x5ac591[_0x4026('0x3d')]=_0x5ac591['attributes'][_0x4026('0x3f')]?_0x5ac591[_0x4026('0x3d')]:_0x410d3d[_0x4026('0x37')];if(!_0x1623b6[_0x4026('0x39')][_0x4026('0x40')](_0x4026('0x41'))){_0x5ac591[_0x4026('0x23')]=qs[_0x4026('0x23')](_0x1623b6[_0x4026('0x39')]['limit']);_0x5ac591[_0x4026('0x25')]=qs[_0x4026('0x25')](_0x1623b6[_0x4026('0x39')][_0x4026('0x25')]);}_0x5ac591['order']=qs[_0x4026('0x42')](_0x1623b6[_0x4026('0x39')]['sort']);_0x5ac591[_0x4026('0x43')]=qs['filters'](_[_0x4026('0x44')](_0x1623b6[_0x4026('0x39')],_0x410d3d['filters']),_0x32f166);if(_0x1623b6[_0x4026('0x39')][_0x4026('0x45')]){_0x5ac591[_0x4026('0x43')]=_[_0x4026('0x46')](_0x5ac591[_0x4026('0x43')],{'$or':_[_0x4026('0x38')](_0x32f166,function(_0x51a9af){if(_0x51a9af['type']!==_0x4026('0x47')){var _0x280a6d={};_0x280a6d[_0x51a9af[_0x4026('0x2f')]]={'$like':'%'+_0x1623b6[_0x4026('0x39')][_0x4026('0x45')]+'%'};return _0x280a6d;}})});}_0x5ac591=_[_0x4026('0x46')]({},_0x5ac591,_0x1623b6[_0x4026('0x48')]);var _0x40e19c={'where':_0x5ac591['where']};return db[_0x4026('0x32')][_0x4026('0x24')](_0x40e19c)[_0x4026('0x2b')](function(_0x1961a5){_0x861820['count']=_0x1961a5;if(_0x1623b6[_0x4026('0x39')][_0x4026('0x49')]){_0x5ac591[_0x4026('0x4a')]=[{'all':!![]}];}return db[_0x4026('0x32')][_0x4026('0x4b')](_0x5ac591);})['then'](function(_0x10a4ee){_0x861820[_0x4026('0x4c')]=_0x10a4ee;return _0x861820;})[_0x4026('0x2b')](respondWithFilteredResult(_0xe7943,_0x5ac591))[_0x4026('0x4d')](handleError(_0xe7943,null));};exports[_0x4026('0x4e')]=function(_0x30f118,_0x428f05){var _0x398e1f={'raw':![],'where':{'id':_0x30f118[_0x4026('0x4f')]['id']}},_0x38466c={};_0x38466c[_0x4026('0x37')]=_[_0x4026('0x3a')](db['VoiceQueueReport'][_0x4026('0x33')]);_0x38466c['query']=_[_0x4026('0x3a')](_0x30f118[_0x4026('0x39')]);_0x38466c[_0x4026('0x3b')]=_[_0x4026('0x3c')](_0x38466c[_0x4026('0x37')],_0x38466c[_0x4026('0x39')]);_0x398e1f[_0x4026('0x3d')]=_['intersection'](_0x38466c[_0x4026('0x37')],qs[_0x4026('0x3e')](_0x30f118[_0x4026('0x39')]['fields']));_0x398e1f[_0x4026('0x3d')]=_0x398e1f[_0x4026('0x3d')][_0x4026('0x3f')]?_0x398e1f[_0x4026('0x3d')]:_0x38466c[_0x4026('0x37')];if(_0x30f118[_0x4026('0x39')][_0x4026('0x49')]){_0x398e1f[_0x4026('0x4a')]=[{'all':!![]}];}_0x398e1f=_[_0x4026('0x46')]({},_0x398e1f,_0x30f118[_0x4026('0x48')]);return db['VoiceQueueReport'][_0x4026('0x50')](_0x398e1f)[_0x4026('0x2b')](handleEntityNotFound(_0x428f05,null))[_0x4026('0x2b')](respondWithResult(_0x428f05,null))[_0x4026('0x4d')](handleError(_0x428f05,null));};exports['create']=function(_0x5014eb,_0x1b6051){return db[_0x4026('0x32')]['create'](_0x5014eb[_0x4026('0x51')],{})[_0x4026('0x2b')](respondWithResult(_0x1b6051,0xc9))[_0x4026('0x4d')](handleError(_0x1b6051,null));};exports[_0x4026('0x29')]=function(_0x3979a3,_0x57a3e9){if(_0x3979a3[_0x4026('0x51')]['id']){delete _0x3979a3[_0x4026('0x51')]['id'];}return db[_0x4026('0x32')][_0x4026('0x50')]({'where':{'id':_0x3979a3[_0x4026('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57a3e9,null))[_0x4026('0x2b')](saveUpdates(_0x3979a3[_0x4026('0x51')],null))[_0x4026('0x2b')](respondWithResult(_0x57a3e9,null))['catch'](handleError(_0x57a3e9,null));};exports[_0x4026('0x2a')]=function(_0xc57afc,_0x4e6742){return db[_0x4026('0x32')][_0x4026('0x50')]({'where':{'id':_0xc57afc[_0x4026('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4e6742,null))[_0x4026('0x2b')](removeEntity(_0x4e6742,null))[_0x4026('0x4d')](handleError(_0x4e6742,null));};exports[_0x4026('0x52')]=function(_0x31bd32,_0x14a898){return db[_0x4026('0x32')][_0x4026('0x52')]()[_0x4026('0x2b')](respondWithResult(_0x14a898,null))[_0x4026('0x4d')](handleError(_0x14a898,null));};exports[_0x4026('0x53')]=function(_0x3ad74e,_0x40481e){var _0x2a63c9={},_0x277c6f={},_0x2ecf18={'count':0x0,'rows':[]};_0x277c6f[_0x4026('0x37')]=_['keys'](db[_0x4026('0x32')][_0x4026('0x33')]);_0x277c6f[_0x4026('0x39')]=_['keys'](_0x3ad74e[_0x4026('0x39')]);_0x277c6f[_0x4026('0x3b')]=_[_0x4026('0x3c')](_0x277c6f[_0x4026('0x37')],_0x277c6f[_0x4026('0x39')]);_0x2a63c9[_0x4026('0x3d')]=_[_0x4026('0x3c')](_0x277c6f[_0x4026('0x37')],qs[_0x4026('0x3e')](_0x3ad74e[_0x4026('0x39')][_0x4026('0x3e')]));_0x2a63c9['attributes']=_0x2a63c9['attributes'][_0x4026('0x3f')]?_0x2a63c9['attributes']:_0x277c6f['model'];if(!_0x3ad74e[_0x4026('0x39')][_0x4026('0x40')](_0x4026('0x41'))){_0x2a63c9['limit']=qs[_0x4026('0x23')](_0x3ad74e[_0x4026('0x39')]['limit']);_0x2a63c9[_0x4026('0x25')]=qs[_0x4026('0x25')](_0x3ad74e['query'][_0x4026('0x25')]);}_0x2a63c9[_0x4026('0x54')]=qs[_0x4026('0x42')](_0x3ad74e[_0x4026('0x39')]['sort']);_0x2a63c9[_0x4026('0x43')]=qs[_0x4026('0x3b')](_[_0x4026('0x44')](_0x3ad74e['query'],_0x277c6f[_0x4026('0x3b')]));if(_0x3ad74e['query'][_0x4026('0x45')]){_0x2a63c9[_0x4026('0x43')]=_[_0x4026('0x46')](_0x2a63c9[_0x4026('0x43')],{'$or':_[_0x4026('0x38')](_0x2a63c9[_0x4026('0x3d')],function(_0x10afef){var _0x39abc8={};_0x39abc8[_0x10afef]={'$like':'%'+_0x3ad74e['query'][_0x4026('0x45')]+'%'};return _0x39abc8;})});}_0x2a63c9=_[_0x4026('0x46')]({},_0x2a63c9,_0x3ad74e['options']);var _0x25dbb2={'where':_0x2a63c9['where']};return db[_0x4026('0x32')][_0x4026('0x24')](_0x25dbb2)[_0x4026('0x2b')](function(_0x1ad00e){_0x2ecf18[_0x4026('0x24')]=_0x1ad00e;if(_0x3ad74e[_0x4026('0x39')][_0x4026('0x49')]){_0x2a63c9[_0x4026('0x4a')]=[{'all':!![]}];}return db[_0x4026('0x32')][_0x4026('0x4b')](_0x2a63c9);})['then'](function(_0x14bfe3){_0x2ecf18[_0x4026('0x4c')]=_0x14bfe3;return _0x2ecf18;})[_0x4026('0x2b')](respondWithFilteredResult(_0x40481e,_0x2a63c9,_0x4026('0x53')))[_0x4026('0x4d')](handleError(_0x40481e,null,_0x4026('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index af5c061..edca7df 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 _0x3262=['update','remove','emit','hasOwnProperty','hook','exports','VoiceQueueReport','setMaxListeners'];(function(_0x5c41d5,_0xa8e8c3){var _0x2c4858=function(_0x2b08e6){while(--_0x2b08e6){_0x5c41d5['push'](_0x5c41d5['shift']());}};_0x2c4858(++_0xa8e8c3);}(_0x3262,0x11e));var _0x2326=function(_0x10bcb7,_0x518c99){_0x10bcb7=_0x10bcb7-0x0;var _0x3c1b3b=_0x3262[_0x10bcb7];return _0x3c1b3b;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x2326('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2326('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2326('0x2'),'afterDestroy':_0x2326('0x3')};function emitEvent(_0x5aba4d){return function(_0x538bd1,_0x516289,_0x27c9ec){VoiceQueueReportEvents['emit'](_0x5aba4d+':'+_0x538bd1['id'],_0x538bd1);VoiceQueueReportEvents[_0x2326('0x4')](_0x5aba4d,_0x538bd1);_0x27c9ec(null);};}for(var e in events){if(events[_0x2326('0x5')](e)){var event=events[e];VoiceQueueReport[_0x2326('0x6')](e,emitEvent(event));}}module[_0x2326('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x1978=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x13bd3c,_0xb33ae6){var _0x526a1d=function(_0x3fd00d){while(--_0x3fd00d){_0x13bd3c['push'](_0x13bd3c['shift']());}};_0x526a1d(++_0xb33ae6);}(_0x1978,0x8d));var _0x8197=function(_0xdf42ae,_0x124605){_0xdf42ae=_0xdf42ae-0x0;var _0x4c391a=_0x1978[_0xdf42ae];return _0x4c391a;};'use strict';var EventEmitter=require(_0x8197('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8197('0x1')](0x0);var events={'afterCreate':_0x8197('0x2'),'afterUpdate':_0x8197('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd96d3f){return function(_0x1adaec,_0x311574,_0x4649c0){VoiceQueueReportEvents[_0x8197('0x4')](_0xd96d3f+':'+_0x1adaec['id'],_0x1adaec);VoiceQueueReportEvents[_0x8197('0x4')](_0xd96d3f,_0x1adaec);_0x4649c0(null);};}for(var e in events){if(events[_0x8197('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8197('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 0a06e95..7a5370f 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 _0xd01b=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x47d95e,_0x5ed919){var _0x5b1d42=function(_0xe833b){while(--_0xe833b){_0x47d95e['push'](_0x47d95e['shift']());}};_0x5b1d42(++_0x5ed919);}(_0xd01b,0xc9));var _0xbd01=function(_0x55fc31,_0x488e40){_0x55fc31=_0x55fc31-0x0;var _0x260696=_0xd01b[_0x55fc31];return _0x260696;};'use strict';var _=require(_0xbd01('0x0'));var util=require(_0xbd01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbd01('0x2'));var BPromise=require(_0xbd01('0x3'));var rp=require(_0xbd01('0x4'));var fs=require('fs');var path=require(_0xbd01('0x5'));var rimraf=require(_0xbd01('0x6'));var config=require(_0xbd01('0x7'));var attributes=require(_0xbd01('0x8'));module['exports']=function(_0x5834e2,_0x4f4d27){return _0x5834e2[_0xbd01('0x9')](_0xbd01('0xa'),attributes,{'tableName':_0xbd01('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbd01('0xc')]},{'fields':[_0xbd01('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4416=['rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','moment','bluebird','request-promise','path'];(function(_0x345661,_0x24976a){var _0x5ac05f=function(_0x35a76f){while(--_0x35a76f){_0x345661['push'](_0x345661['shift']());}};_0x5ac05f(++_0x24976a);}(_0x4416,0x128));var _0x6441=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x4416[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6441('0x0'));var BPromise=require(_0x6441('0x1'));var rp=require(_0x6441('0x2'));var fs=require('fs');var path=require(_0x6441('0x3'));var rimraf=require(_0x6441('0x4'));var config=require(_0x6441('0x5'));var attributes=require(_0x6441('0x6'));module['exports']=function(_0x1594d5,_0x34c265){return _0x1594d5[_0x6441('0x7')](_0x6441('0x8'),attributes,{'tableName':_0x6441('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fb5bd7e..658d75b 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 _0x1d22=['redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','attributes','limit','include','map','model','info','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0x1d22,0x1c0));var _0x21d2=function(_0x557af7,_0x5ef871){_0x557af7=_0x557af7-0x0;var _0x1b013c=_0x1d22[_0x557af7];return _0x1b013c;};'use strict';var _=require(_0x21d2('0x0'));var util=require('util');var moment=require(_0x21d2('0x1'));var BPromise=require(_0x21d2('0x2'));var rs=require(_0x21d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21d2('0x4'))['db'];var utils=require(_0x21d2('0x5'));var logger=require(_0x21d2('0x6'))(_0x21d2('0x7'));var config=require(_0x21d2('0x8'));var jayson=require(_0x21d2('0x9'));var client=jayson[_0x21d2('0xa')][_0x21d2('0xb')]({'port':0x232a});config[_0x21d2('0xc')]=_[_0x21d2('0xd')](config['redis'],{'host':_0x21d2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21d2('0xc')]));require(_0x21d2('0xf'))[_0x21d2('0x10')](socket);function respondWithRpcPromise(_0x29e508,_0xe1d522,_0x7aa517){return new BPromise(function(_0x3af378,_0x4bf0a1){return client[_0x21d2('0x11')](_0x29e508,_0x7aa517)[_0x21d2('0x12')](function(_0x3e3684){logger['info'](_0x21d2('0x13'),_0xe1d522,_0x21d2('0x14'));logger[_0x21d2('0x15')](_0x21d2('0x16'),_0xe1d522,_0x21d2('0x14'),JSON[_0x21d2('0x17')](_0x3e3684));if(_0x3e3684[_0x21d2('0x18')]){if(_0x3e3684['error'][_0x21d2('0x19')]===0x1f4){logger['error'](_0x21d2('0x13'),_0xe1d522,_0x3e3684[_0x21d2('0x18')][_0x21d2('0x1a')]);return _0x4bf0a1(_0x3e3684[_0x21d2('0x18')][_0x21d2('0x1a')]);}logger[_0x21d2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0xe1d522,_0x3e3684[_0x21d2('0x18')][_0x21d2('0x1a')]);return _0x3af378(_0x3e3684[_0x21d2('0x18')][_0x21d2('0x1a')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0xe1d522,_0x21d2('0x14'));_0x3af378(_0x3e3684[_0x21d2('0x1b')]['message']);}})[_0x21d2('0x1c')](function(_0xb6c4fe){logger[_0x21d2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0xe1d522,_0xb6c4fe);_0x4bf0a1(_0xb6c4fe);});});}exports[_0x21d2('0x1d')]=function(_0x2b7cca){var _0x190049=this;return new Promise(function(_0x46c5f5,_0x89d79){return db[_0x21d2('0x1e')][_0x21d2('0x1f')]({'raw':_0x2b7cca[_0x21d2('0x20')]?_0x2b7cca[_0x21d2('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2b7cca[_0x21d2('0x20')]?_0x2b7cca[_0x21d2('0x20')]['where']||null:null,'attributes':_0x2b7cca[_0x21d2('0x20')]?_0x2b7cca[_0x21d2('0x20')][_0x21d2('0x21')]||null:null,'limit':_0x2b7cca[_0x21d2('0x20')]?_0x2b7cca['options'][_0x21d2('0x22')]||null:null,'include':_0x2b7cca[_0x21d2('0x20')]?_0x2b7cca[_0x21d2('0x20')][_0x21d2('0x23')]?_['map'](_0x2b7cca[_0x21d2('0x20')][_0x21d2('0x23')],function(_0x138881){return{'model':db[_0x138881['model']],'as':_0x138881['as'],'attributes':_0x138881[_0x21d2('0x21')],'include':_0x138881[_0x21d2('0x23')]?_[_0x21d2('0x24')](_0x138881[_0x21d2('0x23')],function(_0x43130c){return{'model':db[_0x43130c[_0x21d2('0x25')]],'as':_0x43130c['as'],'attributes':_0x43130c[_0x21d2('0x21')],'include':_0x43130c[_0x21d2('0x23')]?_['map'](_0x43130c['include'],function(_0x483394){return{'model':db[_0x483394['model']],'as':_0x483394['as'],'attributes':_0x483394[_0x21d2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x21d2('0x12')](function(_0xe489a){logger[_0x21d2('0x26')](_0x21d2('0x1d'),_0x2b7cca);logger[_0x21d2('0x15')](_0x21d2('0x1d'),_0x2b7cca,JSON[_0x21d2('0x17')](_0xe489a));_0x46c5f5(_0xe489a);})[_0x21d2('0x1c')](function(_0x1c5f04){logger[_0x21d2('0x18')]('GetVoiceQueueReport',_0x1c5f04[_0x21d2('0x1a')],_0x2b7cca);_0x89d79(_0x190049[_0x21d2('0x18')](0x1f4,_0x1c5f04[_0x21d2('0x1a')]));});});};exports[_0x21d2('0x27')]=function(_0x762e9d){var _0x560cb9=this;return new Promise(function(_0x4c3f08,_0x4adbb9){return db['VoiceQueueReport'][_0x21d2('0x28')](_0x762e9d[_0x21d2('0x29')],{'raw':_0x762e9d['options']?_0x762e9d[_0x21d2('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x154bac){logger[_0x21d2('0x26')](_0x21d2('0x27'),_0x762e9d);logger[_0x21d2('0x15')]('CreateVoiceQueueReport',_0x762e9d,JSON[_0x21d2('0x17')](_0x154bac));_0x4c3f08(_0x154bac);})['catch'](function(_0x1d4090){logger[_0x21d2('0x18')]('CreateVoiceQueueReport',_0x1d4090[_0x21d2('0x1a')],_0x762e9d);_0x4adbb9(_0x560cb9[_0x21d2('0x18')](0x1f4,_0x1d4090[_0x21d2('0x1a')]));});});};exports[_0x21d2('0x2a')]=function(_0x2c89ab){var _0x168548=this;return new Promise(function(_0x1fab16,_0x7a2112){return db[_0x21d2('0x1e')][_0x21d2('0x2b')](_0x2c89ab['body'],{'raw':_0x2c89ab[_0x21d2('0x20')]?_0x2c89ab[_0x21d2('0x20')][_0x21d2('0x2c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c89ab[_0x21d2('0x20')]?_0x2c89ab['options'][_0x21d2('0x2d')]||null:null,'attributes':_0x2c89ab[_0x21d2('0x20')]?_0x2c89ab[_0x21d2('0x20')][_0x21d2('0x21')]||null:null,'limit':_0x2c89ab[_0x21d2('0x20')]?_0x2c89ab[_0x21d2('0x20')][_0x21d2('0x22')]||null:null})[_0x21d2('0x12')](function(_0x4c0cc7){logger[_0x21d2('0x26')](_0x21d2('0x2a'),_0x2c89ab);logger[_0x21d2('0x15')](_0x21d2('0x2a'),_0x2c89ab,JSON[_0x21d2('0x17')](_0x4c0cc7));_0x1fab16(_0x4c0cc7);})[_0x21d2('0x1c')](function(_0x125670){logger[_0x21d2('0x18')](_0x21d2('0x2a'),_0x125670['message'],_0x2c89ab);_0x7a2112(_0x168548[_0x21d2('0x18')](0x1f4,_0x125670['message']));});});}; \ No newline at end of file +var _0xc4fe=['client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x4cf8b9,_0x454a5d){var _0x43506d=function(_0xfdd192){while(--_0xfdd192){_0x4cf8b9['push'](_0x4cf8b9['shift']());}};_0x43506d(++_0x454a5d);}(_0xc4fe,0x101));var _0xec4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec4f('0x0'));var util=require('util');var moment=require(_0xec4f('0x1'));var BPromise=require(_0xec4f('0x2'));var rs=require(_0xec4f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xec4f('0x5'))(_0xec4f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xec4f('0x7')][_0xec4f('0x8')]({'port':0x232a});config[_0xec4f('0x9')]=_[_0xec4f('0xa')](config[_0xec4f('0x9')],{'host':_0xec4f('0xb'),'port':0x18eb});var socket=require(_0xec4f('0xc'))(new Redis(config['redis']));require(_0xec4f('0xd'))[_0xec4f('0xe')](socket);function respondWithRpcPromise(_0x426b19,_0x2ea866,_0x4c0e77){return new BPromise(function(_0x107579,_0x25f10f){return client[_0xec4f('0xf')](_0x426b19,_0x4c0e77)['then'](function(_0x761c57){logger[_0xec4f('0x10')](_0xec4f('0x11'),_0x2ea866,'request\x20sent');logger['debug'](_0xec4f('0x12'),_0x2ea866,'request\x20sent',JSON[_0xec4f('0x13')](_0x761c57));if(_0x761c57[_0xec4f('0x14')]){if(_0x761c57[_0xec4f('0x14')][_0xec4f('0x15')]===0x1f4){logger['error'](_0xec4f('0x11'),_0x2ea866,_0x761c57[_0xec4f('0x14')]['message']);return _0x25f10f(_0x761c57[_0xec4f('0x14')]['message']);}logger[_0xec4f('0x14')](_0xec4f('0x11'),_0x2ea866,_0x761c57[_0xec4f('0x14')]['message']);return _0x107579(_0x761c57[_0xec4f('0x14')]['message']);}else{logger[_0xec4f('0x10')](_0xec4f('0x11'),_0x2ea866,_0xec4f('0x16'));_0x107579(_0x761c57[_0xec4f('0x17')][_0xec4f('0x18')]);}})[_0xec4f('0x19')](function(_0xd401f9){logger['error'](_0xec4f('0x11'),_0x2ea866,_0xd401f9);_0x25f10f(_0xd401f9);});});}exports[_0xec4f('0x1a')]=function(_0x433d6b){var _0xb7d9a6=this;return new Promise(function(_0x53e8b9,_0x1414f7){return db[_0xec4f('0x1b')][_0xec4f('0x1c')]({'raw':_0x433d6b[_0xec4f('0x1d')]?_0x433d6b[_0xec4f('0x1d')][_0xec4f('0x1e')]===undefined?!![]:![]:!![],'where':_0x433d6b[_0xec4f('0x1d')]?_0x433d6b[_0xec4f('0x1d')][_0xec4f('0x1f')]||null:null,'attributes':_0x433d6b['options']?_0x433d6b['options'][_0xec4f('0x20')]||null:null,'limit':_0x433d6b[_0xec4f('0x1d')]?_0x433d6b[_0xec4f('0x1d')][_0xec4f('0x21')]||null:null,'include':_0x433d6b[_0xec4f('0x1d')]?_0x433d6b['options'][_0xec4f('0x22')]?_[_0xec4f('0x23')](_0x433d6b[_0xec4f('0x1d')][_0xec4f('0x22')],function(_0x33d770){return{'model':db[_0x33d770['model']],'as':_0x33d770['as'],'attributes':_0x33d770['attributes'],'include':_0x33d770[_0xec4f('0x22')]?_[_0xec4f('0x23')](_0x33d770[_0xec4f('0x22')],function(_0x26a159){return{'model':db[_0x26a159[_0xec4f('0x24')]],'as':_0x26a159['as'],'attributes':_0x26a159[_0xec4f('0x20')],'include':_0x26a159['include']?_[_0xec4f('0x23')](_0x26a159[_0xec4f('0x22')],function(_0x190e64){return{'model':db[_0x190e64[_0xec4f('0x24')]],'as':_0x190e64['as'],'attributes':_0x190e64[_0xec4f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xec4f('0x25')](function(_0x3e3481){logger[_0xec4f('0x10')]('GetVoiceQueueReport',_0x433d6b);logger['debug'](_0xec4f('0x1a'),_0x433d6b,JSON[_0xec4f('0x13')](_0x3e3481));_0x53e8b9(_0x3e3481);})[_0xec4f('0x19')](function(_0x4d7bf9){logger[_0xec4f('0x14')](_0xec4f('0x1a'),_0x4d7bf9[_0xec4f('0x18')],_0x433d6b);_0x1414f7(_0xb7d9a6[_0xec4f('0x14')](0x1f4,_0x4d7bf9[_0xec4f('0x18')]));});});};exports[_0xec4f('0x26')]=function(_0x3ab694){var _0x1a454b=this;return new Promise(function(_0x82f9d9,_0x3c9924){return db[_0xec4f('0x1b')][_0xec4f('0x27')](_0x3ab694[_0xec4f('0x28')],{'raw':_0x3ab694['options']?_0x3ab694[_0xec4f('0x1d')][_0xec4f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3ff07c){logger[_0xec4f('0x10')](_0xec4f('0x26'),_0x3ab694);logger[_0xec4f('0x29')](_0xec4f('0x26'),_0x3ab694,JSON[_0xec4f('0x13')](_0x3ff07c));_0x82f9d9(_0x3ff07c);})['catch'](function(_0xb4afeb){logger[_0xec4f('0x14')](_0xec4f('0x26'),_0xb4afeb[_0xec4f('0x18')],_0x3ab694);_0x3c9924(_0x1a454b[_0xec4f('0x14')](0x1f4,_0xb4afeb[_0xec4f('0x18')]));});});};exports[_0xec4f('0x2a')]=function(_0x4cbc3a){var _0x33ecc9=this;return new Promise(function(_0x19be0f,_0x61e43a){return db[_0xec4f('0x1b')][_0xec4f('0x2b')](_0x4cbc3a['body'],{'raw':_0x4cbc3a[_0xec4f('0x1d')]?_0x4cbc3a[_0xec4f('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cbc3a[_0xec4f('0x1d')]?_0x4cbc3a[_0xec4f('0x1d')][_0xec4f('0x1f')]||null:null,'attributes':_0x4cbc3a[_0xec4f('0x1d')]?_0x4cbc3a[_0xec4f('0x1d')][_0xec4f('0x20')]||null:null,'limit':_0x4cbc3a[_0xec4f('0x1d')]?_0x4cbc3a[_0xec4f('0x1d')][_0xec4f('0x21')]||null:null})[_0xec4f('0x25')](function(_0x22d531){logger[_0xec4f('0x10')](_0xec4f('0x2a'),_0x4cbc3a);logger[_0xec4f('0x29')](_0xec4f('0x2a'),_0x4cbc3a,JSON[_0xec4f('0x13')](_0x22d531));_0x19be0f(_0x22d531);})[_0xec4f('0x19')](function(_0x11cd47){logger['error'](_0xec4f('0x2a'),_0x11cd47[_0xec4f('0x18')],_0x4cbc3a);_0x61e43a(_0x33ecc9['error'](0x1f4,_0x11cd47[_0xec4f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 262412a..bae2b34 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 _0x2975=['update','removeListener','register','length','voiceQueueReport:','save','remove'];(function(_0x42f6d1,_0x52c740){var _0x50ae08=function(_0x419bf5){while(--_0x419bf5){_0x42f6d1['push'](_0x42f6d1['shift']());}};_0x50ae08(++_0x52c740);}(_0x2975,0x1c5));var _0x5297=function(_0x92c861,_0x5e88cd){_0x92c861=_0x92c861-0x0;var _0x27e44a=_0x2975[_0x92c861];return _0x27e44a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x5297('0x0'),_0x5297('0x1'),_0x5297('0x2')];function createListener(_0x1a511b,_0x115e60){return function(_0x178801){_0x115e60['emit'](_0x1a511b,_0x178801);};}function removeListener(_0x56371f,_0x5e9de3){return function(){VoiceQueueReportEvents[_0x5297('0x3')](_0x56371f,_0x5e9de3);};}exports[_0x5297('0x4')]=function(_0x11a43d){for(var _0x3da9c6=0x0,_0x4d1d2c=events[_0x5297('0x5')];_0x3da9c6<_0x4d1d2c;_0x3da9c6++){var _0x1b72a7=events[_0x3da9c6];var _0x4f12b0=createListener(_0x5297('0x6')+_0x1b72a7,_0x11a43d);VoiceQueueReportEvents['on'](_0x1b72a7,_0x4f12b0);}}; \ No newline at end of file +var _0xad9b=['./voiceQueueReport.events','remove','update','emit','removeListener','length'];(function(_0x5207d3,_0x1b67d4){var _0x36785c=function(_0x11a1d3){while(--_0x11a1d3){_0x5207d3['push'](_0x5207d3['shift']());}};_0x36785c(++_0x1b67d4);}(_0xad9b,0x10e));var _0xbad9=function(_0x54ec95,_0x410e71){_0x54ec95=_0x54ec95-0x0;var _0x4811c4=_0xad9b[_0x54ec95];return _0x4811c4;};'use strict';var VoiceQueueReportEvents=require(_0xbad9('0x0'));var events=['save',_0xbad9('0x1'),_0xbad9('0x2')];function createListener(_0x3f9f81,_0x190e63){return function(_0x45aee3){_0x190e63[_0xbad9('0x3')](_0x3f9f81,_0x45aee3);};}function removeListener(_0x5423d9,_0x5cd9b9){return function(){VoiceQueueReportEvents[_0xbad9('0x4')](_0x5423d9,_0x5cd9b9);};}exports['register']=function(_0xbca672){for(var _0x4a77f1=0x0,_0x4e05fd=events[_0xbad9('0x5')];_0x4a77f1<_0x4e05fd;_0x4a77f1++){var _0x18216f=events[_0x4a77f1];var _0x41895e=createListener('voiceQueueReport:'+_0x18216f,_0xbca672);VoiceQueueReportEvents['on'](_0x18216f,_0x41895e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 20cc9ec..8ae3bab 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 _0x5ce6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','post','create','put','destroy','exports'];(function(_0x58d1d7,_0x1073b2){var _0x1ef01c=function(_0x52bcb2){while(--_0x52bcb2){_0x58d1d7['push'](_0x58d1d7['shift']());}};_0x1ef01c(++_0x1073b2);}(_0x5ce6,0xee));var _0x65ce=function(_0x509b9d,_0x234651){_0x509b9d=_0x509b9d-0x0;var _0x5a755f=_0x5ce6[_0x509b9d];return _0x5a755f;};'use strict';var multer=require('multer');var util=require(_0x65ce('0x0'));var path=require(_0x65ce('0x1'));var timeout=require(_0x65ce('0x2'));var express=require(_0x65ce('0x3'));var router=express[_0x65ce('0x4')]();var fs_extra=require(_0x65ce('0x5'));var auth=require(_0x65ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65ce('0x7'));var controller=require(_0x65ce('0x8'));router[_0x65ce('0x9')]('/',auth[_0x65ce('0xa')](),controller['index']);router[_0x65ce('0x9')](_0x65ce('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x65ce('0xc')]('/',auth['isAuthenticated'](),controller[_0x65ce('0xd')]);router[_0x65ce('0xe')]('/:id',auth[_0x65ce('0xa')](),controller['update']);router['delete']('/:id',auth[_0x65ce('0xa')](),controller[_0x65ce('0xf')]);module[_0x65ce('0x10')]=router; \ No newline at end of file +var _0x3164=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x2f394f,_0x4d4dab){var _0xb79958=function(_0xd8ee92){while(--_0xd8ee92){_0x2f394f['push'](_0x2f394f['shift']());}};_0xb79958(++_0x4d4dab);}(_0x3164,0x182));var _0x4316=function(_0x298135,_0x2cfc17){_0x298135=_0x298135-0x0;var _0x4757c0=_0x3164[_0x298135];return _0x4757c0;};'use strict';var multer=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var path=require(_0x4316('0x2'));var timeout=require(_0x4316('0x3'));var express=require(_0x4316('0x4'));var router=express['Router']();var fs_extra=require(_0x4316('0x5'));var auth=require(_0x4316('0x6'));var interaction=require(_0x4316('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x4316('0x8')]('/',auth[_0x4316('0x9')](),controller[_0x4316('0xa')]);router[_0x4316('0x8')](_0x4316('0xb'),auth[_0x4316('0x9')](),controller[_0x4316('0xc')]);router[_0x4316('0xd')]('/',auth[_0x4316('0x9')](),controller[_0x4316('0xe')]);router[_0x4316('0xf')](_0x4316('0xb'),auth[_0x4316('0x9')](),controller[_0x4316('0x10')]);router['delete'](_0x4316('0xb'),auth[_0x4316('0x9')](),controller[_0x4316('0x11')]);module[_0x4316('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f5abd8c..c1f85a8 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 _0xba56=['STRING','DATE','sequelize','moment'];(function(_0x33d43a,_0x502f61){var _0x5d915e=function(_0x3006f7){while(--_0x3006f7){_0x33d43a['push'](_0x33d43a['shift']());}};_0x5d915e(++_0x502f61);}(_0xba56,0x1d6));var _0x6ba5=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xba56[_0x4709c8];return _0x478cdd;};'use strict';var Sequelize=require(_0x6ba5('0x0'));var moment=require(_0x6ba5('0x1'));module['exports']={'time':{'type':Sequelize[_0x6ba5('0x2')]},'callid':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6ba5('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x35a5=['YYYY-MM-DD\x20HH:mm:ss','STRING','format'];(function(_0x4df1f3,_0x58b12c){var _0x161f9c=function(_0x525fc8){while(--_0x525fc8){_0x4df1f3['push'](_0x4df1f3['shift']());}};_0x161f9c(++_0x58b12c);}(_0x35a5,0x1b7));var _0x535a=function(_0x27c190,_0x550696){_0x27c190=_0x27c190-0x0;var _0x45661e=_0x35a5[_0x27c190];return _0x45661e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x535a('0x0')]},'callid':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x535a('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x535a('0x1')](_0x535a('0x2'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4c045c7..0c341eb 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 _0x3dd5=['then','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','VoiceQueuesLog','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','reject','update'];(function(_0x10268a,_0x14aa51){var _0x41c37d=function(_0x19e44d){while(--_0x19e44d){_0x10268a['push'](_0x10268a['shift']());}};_0x41c37d(++_0x14aa51);}(_0x3dd5,0x68));var _0x53dd=function(_0x3f491c,_0x1a528a){_0x3f491c=_0x3f491c-0x0;var _0x7bddb7=_0x3dd5[_0x3f491c];return _0x7bddb7;};'use strict';var emlformat=require(_0x53dd('0x0'));var rimraf=require(_0x53dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53dd('0x2'));var rp=require('request-promise');var moment=require(_0x53dd('0x3'));var BPromise=require(_0x53dd('0x4'));var Mustache=require(_0x53dd('0x5'));var util=require('util');var path=require(_0x53dd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x53dd('0x7'));var fs=require('fs');var fs_extra=require(_0x53dd('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x53dd('0x9'));var jsforce=require(_0x53dd('0xa'));var deskjs=require(_0x53dd('0xb'));var toCsv=require(_0x53dd('0xc'));var querystring=require(_0x53dd('0xd'));var Papa=require(_0x53dd('0xe'));var Redis=require('ioredis');var authService=require(_0x53dd('0xf'));var qs=require(_0x53dd('0x10'));var as=require(_0x53dd('0x11'));var hardwareService=require(_0x53dd('0x12'));var logger=require(_0x53dd('0x13'))(_0x53dd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53dd('0x15'));var db=require(_0x53dd('0x16'))['db'];function respondWithStatusCode(_0x1a6ff5,_0x49e5c8){_0x49e5c8=_0x49e5c8||0xcc;return function(_0x4aba22){if(_0x4aba22){return _0x1a6ff5['sendStatus'](_0x49e5c8);}return _0x1a6ff5[_0x53dd('0x17')](_0x49e5c8)[_0x53dd('0x18')]();};}function respondWithResult(_0x1ee507,_0x1a5ce1){_0x1a5ce1=_0x1a5ce1||0xc8;return function(_0x41a441){if(_0x41a441){return _0x1ee507['status'](_0x1a5ce1)[_0x53dd('0x19')](_0x41a441);}};}function respondWithFilteredResult(_0x3bca93,_0xbe38c7){return function(_0x34919d){if(_0x34919d){var _0x154986=typeof _0xbe38c7[_0x53dd('0x1a')]===_0x53dd('0x1b')&&typeof _0xbe38c7['limit']===_0x53dd('0x1b');var _0x3132fc=_0x34919d[_0x53dd('0x1c')];var _0x20efce=_0x154986?0x0:_0xbe38c7[_0x53dd('0x1a')];var _0x5116e4=_0x154986?_0x34919d[_0x53dd('0x1c')]:_0xbe38c7[_0x53dd('0x1a')]+_0xbe38c7['limit'];var _0x2a4eeb;if(_0x5116e4>=_0x3132fc){_0x5116e4=_0x3132fc;_0x2a4eeb=0xc8;}else{_0x2a4eeb=0xce;}_0x3bca93[_0x53dd('0x17')](_0x2a4eeb);return _0x3bca93[_0x53dd('0x1d')]('Content-Range',_0x20efce+'-'+_0x5116e4+'/'+_0x3132fc)['json'](_0x34919d);}return null;};}function patchUpdates(_0x2abad4){return function(_0x1ceeb6){try{jsonpatch['apply'](_0x1ceeb6,_0x2abad4,!![]);}catch(_0x3c12c0){return BPromise[_0x53dd('0x1e')](_0x3c12c0);}return _0x1ceeb6['save']();};}function saveUpdates(_0xee1765,_0x5d7da9){return function(_0x4a0db0){if(_0x4a0db0){return _0x4a0db0[_0x53dd('0x1f')](_0xee1765)[_0x53dd('0x20')](function(_0x4f4fd5){return _0x4f4fd5;});}return null;};}function removeEntity(_0x2b500d,_0x52154b){return function(_0x2f6833){if(_0x2f6833){return _0x2f6833['destroy']()['then'](function(){_0x2b500d[_0x53dd('0x17')](0xcc)[_0x53dd('0x18')]();});}};}function handleEntityNotFound(_0xc09f38,_0xf942f3){return function(_0x220e49){if(!_0x220e49){_0xc09f38['sendStatus'](0x194);}return _0x220e49;};}function handleError(_0x397d92,_0x3e2882){_0x3e2882=_0x3e2882||0x1f4;return function(_0x40cc8b){logger['error'](_0x40cc8b['stack']);if(_0x40cc8b[_0x53dd('0x21')]){delete _0x40cc8b[_0x53dd('0x21')];}_0x397d92['status'](_0x3e2882)[_0x53dd('0x22')](_0x40cc8b);};}exports[_0x53dd('0x23')]=function(_0x5bfba5,_0x592393){var _0x425e79={},_0x3ba762={},_0x26984c={'count':0x0,'rows':[]};var _0xa3c9af=_[_0x53dd('0x24')](db['VoiceQueuesLog'][_0x53dd('0x25')],function(_0xc8a0d4){return{'name':_0xc8a0d4['fieldName'],'type':_0xc8a0d4[_0x53dd('0x26')][_0x53dd('0x27')]};});_0x3ba762[_0x53dd('0x28')]=_[_0x53dd('0x24')](_0xa3c9af,_0x53dd('0x21'));_0x3ba762[_0x53dd('0x29')]=_[_0x53dd('0x2a')](_0x5bfba5[_0x53dd('0x29')]);_0x3ba762[_0x53dd('0x2b')]=_[_0x53dd('0x2c')](_0x3ba762[_0x53dd('0x28')],_0x3ba762[_0x53dd('0x29')]);_0x425e79['attributes']=_[_0x53dd('0x2c')](_0x3ba762[_0x53dd('0x28')],qs[_0x53dd('0x2d')](_0x5bfba5[_0x53dd('0x29')][_0x53dd('0x2d')]));_0x425e79[_0x53dd('0x2e')]=_0x425e79[_0x53dd('0x2e')][_0x53dd('0x2f')]?_0x425e79[_0x53dd('0x2e')]:_0x3ba762[_0x53dd('0x28')];if(!_0x5bfba5['query'][_0x53dd('0x30')](_0x53dd('0x31'))){_0x425e79[_0x53dd('0x32')]=qs['limit'](_0x5bfba5['query'][_0x53dd('0x32')]);_0x425e79[_0x53dd('0x1a')]=qs[_0x53dd('0x1a')](_0x5bfba5[_0x53dd('0x29')][_0x53dd('0x1a')]);}_0x425e79['order']=qs[_0x53dd('0x33')](_0x5bfba5['query']['sort']);_0x425e79[_0x53dd('0x34')]=qs[_0x53dd('0x2b')](_[_0x53dd('0x35')](_0x5bfba5[_0x53dd('0x29')],_0x3ba762['filters']),_0xa3c9af);if(_0x5bfba5[_0x53dd('0x29')][_0x53dd('0x36')]){_0x425e79[_0x53dd('0x34')]=_[_0x53dd('0x37')](_0x425e79[_0x53dd('0x34')],{'$or':_[_0x53dd('0x24')](_0xa3c9af,function(_0xbe7fcb){if(_0xbe7fcb['type']!=='VIRTUAL'){var _0x18b694={};_0x18b694[_0xbe7fcb['name']]={'$like':'%'+_0x5bfba5[_0x53dd('0x29')][_0x53dd('0x36')]+'%'};return _0x18b694;}})});}_0x425e79=_['merge']({},_0x425e79,_0x5bfba5[_0x53dd('0x38')]);var _0x5a4915={'where':_0x425e79[_0x53dd('0x34')]};return db['VoiceQueuesLog'][_0x53dd('0x1c')](_0x5a4915)['then'](function(_0x31bab8){_0x26984c[_0x53dd('0x1c')]=_0x31bab8;if(_0x5bfba5[_0x53dd('0x29')][_0x53dd('0x39')]){_0x425e79[_0x53dd('0x3a')]=[{'all':!![]}];}return db[_0x53dd('0x3b')]['findAll'](_0x425e79);})[_0x53dd('0x20')](function(_0x324a24){_0x26984c[_0x53dd('0x3c')]=_0x324a24;return _0x26984c;})[_0x53dd('0x20')](respondWithFilteredResult(_0x592393,_0x425e79))['catch'](handleError(_0x592393,null));};exports[_0x53dd('0x3d')]=function(_0x647c5b,_0x28de86){var _0xa7aeb2={'raw':!![],'where':{'id':_0x647c5b[_0x53dd('0x3e')]['id']}},_0x130cd3={};_0x130cd3[_0x53dd('0x28')]=_[_0x53dd('0x2a')](db[_0x53dd('0x3b')][_0x53dd('0x25')]);_0x130cd3[_0x53dd('0x29')]=_[_0x53dd('0x2a')](_0x647c5b[_0x53dd('0x29')]);_0x130cd3[_0x53dd('0x2b')]=_[_0x53dd('0x2c')](_0x130cd3[_0x53dd('0x28')],_0x130cd3[_0x53dd('0x29')]);_0xa7aeb2[_0x53dd('0x2e')]=_[_0x53dd('0x2c')](_0x130cd3[_0x53dd('0x28')],qs['fields'](_0x647c5b[_0x53dd('0x29')][_0x53dd('0x2d')]));_0xa7aeb2[_0x53dd('0x2e')]=_0xa7aeb2[_0x53dd('0x2e')][_0x53dd('0x2f')]?_0xa7aeb2[_0x53dd('0x2e')]:_0x130cd3[_0x53dd('0x28')];if(_0x647c5b[_0x53dd('0x29')][_0x53dd('0x39')]){_0xa7aeb2[_0x53dd('0x3a')]=[{'all':!![]}];}_0xa7aeb2=_[_0x53dd('0x37')]({},_0xa7aeb2,_0x647c5b[_0x53dd('0x38')]);return db[_0x53dd('0x3b')][_0x53dd('0x3f')](_0xa7aeb2)['then'](handleEntityNotFound(_0x28de86,null))[_0x53dd('0x20')](respondWithResult(_0x28de86,null))[_0x53dd('0x40')](handleError(_0x28de86,null));};exports[_0x53dd('0x41')]=function(_0x2b44fc,_0x158f27){return db[_0x53dd('0x3b')][_0x53dd('0x41')](_0x2b44fc[_0x53dd('0x42')],{})[_0x53dd('0x20')](respondWithResult(_0x158f27,0xc9))[_0x53dd('0x40')](handleError(_0x158f27,null));};exports[_0x53dd('0x1f')]=function(_0x2feeb2,_0x28ac2b){if(_0x2feeb2[_0x53dd('0x42')]['id']){delete _0x2feeb2[_0x53dd('0x42')]['id'];}return db['VoiceQueuesLog'][_0x53dd('0x3f')]({'where':{'id':_0x2feeb2[_0x53dd('0x3e')]['id']}})[_0x53dd('0x20')](handleEntityNotFound(_0x28ac2b,null))[_0x53dd('0x20')](saveUpdates(_0x2feeb2[_0x53dd('0x42')],null))[_0x53dd('0x20')](respondWithResult(_0x28ac2b,null))[_0x53dd('0x40')](handleError(_0x28ac2b,null));};exports[_0x53dd('0x43')]=function(_0xccda56,_0x183b3d){return db[_0x53dd('0x3b')][_0x53dd('0x3f')]({'where':{'id':_0xccda56[_0x53dd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x183b3d,null))[_0x53dd('0x20')](removeEntity(_0x183b3d,null))['catch'](handleError(_0x183b3d,null));}; \ No newline at end of file +var _0xf292=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','error','name','send','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','VoiceQueuesLog','findAll','catch','show','params','keys','rawAttributes','include','find','create','body','update','destroy','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x2b269f,_0xa4672e){var _0x211912=function(_0x58f4e9){while(--_0x58f4e9){_0x2b269f['push'](_0x2b269f['shift']());}};_0x211912(++_0xa4672e);}(_0xf292,0x154));var _0x2f29=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf292[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0x2f29('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f29('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2f29('0x2'));var util=require(_0x2f29('0x3'));var path=require(_0x2f29('0x4'));var sox=require(_0x2f29('0x5'));var csv=require(_0x2f29('0x6'));var ejs=require(_0x2f29('0x7'));var fs=require('fs');var fs_extra=require(_0x2f29('0x8'));var _=require('lodash');var squel=require(_0x2f29('0x9'));var crypto=require('crypto');var jsforce=require(_0x2f29('0xa'));var deskjs=require(_0x2f29('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2f29('0xc'));var Papa=require(_0x2f29('0xd'));var Redis=require(_0x2f29('0xe'));var authService=require(_0x2f29('0xf'));var qs=require(_0x2f29('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f29('0x11'))(_0x2f29('0x12'));var utils=require('../../config/utils');var config=require(_0x2f29('0x13'));var licenseUtil=require(_0x2f29('0x14'));var db=require(_0x2f29('0x15'))['db'];function respondWithStatusCode(_0x355b4c,_0x234d4f){_0x234d4f=_0x234d4f||0xcc;return function(_0x31f866){if(_0x31f866){return _0x355b4c[_0x2f29('0x16')](_0x234d4f);}return _0x355b4c[_0x2f29('0x17')](_0x234d4f)[_0x2f29('0x18')]();};}function respondWithResult(_0x1cc69b,_0x49f1cd){_0x49f1cd=_0x49f1cd||0xc8;return function(_0x561242){if(_0x561242){return _0x1cc69b['status'](_0x49f1cd)[_0x2f29('0x19')](_0x561242);}};}function respondWithFilteredResult(_0x494b99,_0x116ad1){return function(_0x10ac1d){if(_0x10ac1d){var _0x376388=typeof _0x116ad1['offset']==='undefined'&&typeof _0x116ad1[_0x2f29('0x1a')]===_0x2f29('0x1b');var _0x59569c=_0x10ac1d[_0x2f29('0x1c')];var _0x38bc99=_0x376388?0x0:_0x116ad1[_0x2f29('0x1d')];var _0x1e33b6=_0x376388?_0x10ac1d['count']:_0x116ad1['offset']+_0x116ad1[_0x2f29('0x1a')];var _0x3561fc;if(_0x1e33b6>=_0x59569c){_0x1e33b6=_0x59569c;_0x3561fc=0xc8;}else{_0x3561fc=0xce;}_0x494b99[_0x2f29('0x17')](_0x3561fc);return _0x494b99['set'](_0x2f29('0x1e'),_0x38bc99+'-'+_0x1e33b6+'/'+_0x59569c)[_0x2f29('0x19')](_0x10ac1d);}return null;};}function patchUpdates(_0x40ea21){return function(_0x27243b){try{jsonpatch[_0x2f29('0x1f')](_0x27243b,_0x40ea21,!![]);}catch(_0x332fd4){return BPromise[_0x2f29('0x20')](_0x332fd4);}return _0x27243b[_0x2f29('0x21')]();};}function saveUpdates(_0x2f4ce5,_0x5e4293){return function(_0x48c719){if(_0x48c719){return _0x48c719['update'](_0x2f4ce5)[_0x2f29('0x22')](function(_0x2fe62f){return _0x2fe62f;});}return null;};}function removeEntity(_0x2efbaa,_0x305d86){return function(_0x57938d){if(_0x57938d){return _0x57938d['destroy']()[_0x2f29('0x22')](function(){_0x2efbaa[_0x2f29('0x17')](0xcc)[_0x2f29('0x18')]();});}};}function handleEntityNotFound(_0x2c53b2,_0x42925c){return function(_0x3f2170){if(!_0x3f2170){_0x2c53b2['sendStatus'](0x194);}return _0x3f2170;};}function handleError(_0x1c79e8,_0x2b89f0){_0x2b89f0=_0x2b89f0||0x1f4;return function(_0x5b44f8){logger[_0x2f29('0x23')](_0x5b44f8['stack']);if(_0x5b44f8[_0x2f29('0x24')]){delete _0x5b44f8[_0x2f29('0x24')];}_0x1c79e8[_0x2f29('0x17')](_0x2b89f0)[_0x2f29('0x25')](_0x5b44f8);};}exports['index']=function(_0x3dbd01,_0x51bc27){var _0x2a278d={},_0x7d6f9f={},_0x44b0da={'count':0x0,'rows':[]};var _0x865050=_['map'](db['VoiceQueuesLog']['rawAttributes'],function(_0x49bfe7){return{'name':_0x49bfe7[_0x2f29('0x26')],'type':_0x49bfe7['type'][_0x2f29('0x27')]};});_0x7d6f9f['model']=_[_0x2f29('0x28')](_0x865050,'name');_0x7d6f9f[_0x2f29('0x29')]=_['keys'](_0x3dbd01[_0x2f29('0x29')]);_0x7d6f9f[_0x2f29('0x2a')]=_[_0x2f29('0x2b')](_0x7d6f9f[_0x2f29('0x2c')],_0x7d6f9f[_0x2f29('0x29')]);_0x2a278d['attributes']=_[_0x2f29('0x2b')](_0x7d6f9f[_0x2f29('0x2c')],qs[_0x2f29('0x2d')](_0x3dbd01['query'][_0x2f29('0x2d')]));_0x2a278d[_0x2f29('0x2e')]=_0x2a278d[_0x2f29('0x2e')][_0x2f29('0x2f')]?_0x2a278d[_0x2f29('0x2e')]:_0x7d6f9f[_0x2f29('0x2c')];if(!_0x3dbd01[_0x2f29('0x29')][_0x2f29('0x30')](_0x2f29('0x31'))){_0x2a278d['limit']=qs[_0x2f29('0x1a')](_0x3dbd01[_0x2f29('0x29')][_0x2f29('0x1a')]);_0x2a278d[_0x2f29('0x1d')]=qs[_0x2f29('0x1d')](_0x3dbd01[_0x2f29('0x29')][_0x2f29('0x1d')]);}_0x2a278d[_0x2f29('0x32')]=qs[_0x2f29('0x33')](_0x3dbd01[_0x2f29('0x29')][_0x2f29('0x33')]);_0x2a278d[_0x2f29('0x34')]=qs['filters'](_[_0x2f29('0x35')](_0x3dbd01[_0x2f29('0x29')],_0x7d6f9f[_0x2f29('0x2a')]),_0x865050);if(_0x3dbd01[_0x2f29('0x29')][_0x2f29('0x36')]){_0x2a278d[_0x2f29('0x34')]=_[_0x2f29('0x37')](_0x2a278d[_0x2f29('0x34')],{'$or':_[_0x2f29('0x28')](_0x865050,function(_0x1736aa){if(_0x1736aa[_0x2f29('0x38')]!=='VIRTUAL'){var _0x52e706={};_0x52e706[_0x1736aa[_0x2f29('0x24')]]={'$like':'%'+_0x3dbd01[_0x2f29('0x29')]['filter']+'%'};return _0x52e706;}})});}_0x2a278d=_[_0x2f29('0x37')]({},_0x2a278d,_0x3dbd01[_0x2f29('0x39')]);var _0x5b46f3={'where':_0x2a278d[_0x2f29('0x34')]};return db['VoiceQueuesLog']['count'](_0x5b46f3)['then'](function(_0x598f99){_0x44b0da['count']=_0x598f99;if(_0x3dbd01[_0x2f29('0x29')][_0x2f29('0x3a')]){_0x2a278d['include']=[{'all':!![]}];}return db[_0x2f29('0x3b')][_0x2f29('0x3c')](_0x2a278d);})[_0x2f29('0x22')](function(_0xa5d6d9){_0x44b0da['rows']=_0xa5d6d9;return _0x44b0da;})[_0x2f29('0x22')](respondWithFilteredResult(_0x51bc27,_0x2a278d))[_0x2f29('0x3d')](handleError(_0x51bc27,null));};exports[_0x2f29('0x3e')]=function(_0x65614b,_0x3603ce){var _0x2b833d={'raw':!![],'where':{'id':_0x65614b[_0x2f29('0x3f')]['id']}},_0x86022d={};_0x86022d['model']=_[_0x2f29('0x40')](db[_0x2f29('0x3b')][_0x2f29('0x41')]);_0x86022d[_0x2f29('0x29')]=_[_0x2f29('0x40')](_0x65614b[_0x2f29('0x29')]);_0x86022d['filters']=_[_0x2f29('0x2b')](_0x86022d['model'],_0x86022d[_0x2f29('0x29')]);_0x2b833d[_0x2f29('0x2e')]=_[_0x2f29('0x2b')](_0x86022d['model'],qs[_0x2f29('0x2d')](_0x65614b[_0x2f29('0x29')][_0x2f29('0x2d')]));_0x2b833d[_0x2f29('0x2e')]=_0x2b833d['attributes'][_0x2f29('0x2f')]?_0x2b833d[_0x2f29('0x2e')]:_0x86022d[_0x2f29('0x2c')];if(_0x65614b['query'][_0x2f29('0x3a')]){_0x2b833d[_0x2f29('0x42')]=[{'all':!![]}];}_0x2b833d=_[_0x2f29('0x37')]({},_0x2b833d,_0x65614b[_0x2f29('0x39')]);return db['VoiceQueuesLog'][_0x2f29('0x43')](_0x2b833d)[_0x2f29('0x22')](handleEntityNotFound(_0x3603ce,null))[_0x2f29('0x22')](respondWithResult(_0x3603ce,null))[_0x2f29('0x3d')](handleError(_0x3603ce,null));};exports[_0x2f29('0x44')]=function(_0x112977,_0x5d4ba9){return db['VoiceQueuesLog'][_0x2f29('0x44')](_0x112977[_0x2f29('0x45')],{})['then'](respondWithResult(_0x5d4ba9,0xc9))[_0x2f29('0x3d')](handleError(_0x5d4ba9,null));};exports[_0x2f29('0x46')]=function(_0x3389dd,_0x445de1){if(_0x3389dd['body']['id']){delete _0x3389dd[_0x2f29('0x45')]['id'];}return db[_0x2f29('0x3b')][_0x2f29('0x43')]({'where':{'id':_0x3389dd[_0x2f29('0x3f')]['id']}})[_0x2f29('0x22')](handleEntityNotFound(_0x445de1,null))[_0x2f29('0x22')](saveUpdates(_0x3389dd['body'],null))[_0x2f29('0x22')](respondWithResult(_0x445de1,null))[_0x2f29('0x3d')](handleError(_0x445de1,null));};exports[_0x2f29('0x47')]=function(_0x358fc2,_0x51a4ec){return db[_0x2f29('0x3b')]['find']({'where':{'id':_0x358fc2[_0x2f29('0x3f')]['id']}})[_0x2f29('0x22')](handleEntityNotFound(_0x51a4ec,null))[_0x2f29('0x22')](removeEntity(_0x51a4ec,null))[_0x2f29('0x3d')](handleError(_0x51a4ec,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index eb36da8..8a6170a 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 _0xab4d=['dtm','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x7719e1,_0x17a548){var _0x19ab70=function(_0xa2ae64){while(--_0xa2ae64){_0x7719e1['push'](_0x7719e1['shift']());}};_0x19ab70(++_0x17a548);}(_0xab4d,0x1ae));var _0xdab4=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xab4d[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xdab4('0x0'));var util=require(_0xdab4('0x1'));var logger=require(_0xdab4('0x2'))(_0xdab4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdab4('0x4'));var fs=require('fs');var path=require(_0xdab4('0x5'));var rimraf=require('rimraf');var config=require(_0xdab4('0x6'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0xbf240,_0x3694a9){return _0xbf240[_0xdab4('0x7')](_0xdab4('0x8'),attributes,{'tableName':_0xdab4('0x9'),'paranoid':![],'indexes':[{'name':_0xdab4('0xa'),'fields':[_0xdab4('0xb'),_0xdab4('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7fc4=['path','rimraf','../../config/environment','exports','voice_queues_log','event','dtm','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x29d2ce,_0x402da7){var _0x546b93=function(_0x1c2546){while(--_0x1c2546){_0x29d2ce['push'](_0x29d2ce['shift']());}};_0x546b93(++_0x402da7);}(_0x7fc4,0x14c));var _0x47fc=function(_0x512083,_0x4d23c8){_0x512083=_0x512083-0x0;var _0x32895e=_0x7fc4[_0x512083];return _0x32895e;};'use strict';var _=require(_0x47fc('0x0'));var util=require(_0x47fc('0x1'));var logger=require(_0x47fc('0x2'))(_0x47fc('0x3'));var moment=require(_0x47fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x47fc('0x5'));var fs=require('fs');var path=require(_0x47fc('0x6'));var rimraf=require(_0x47fc('0x7'));var config=require(_0x47fc('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x47fc('0x9')]=function(_0x123fd2,_0x4bb44b){return _0x123fd2['define']('VoiceQueuesLog',attributes,{'tableName':_0x47fc('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x47fc('0xb'),_0x47fc('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 6df1c70..cc5284b 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 _0xa39f=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a5864,_0xc27422){var _0x3550b8=function(_0xffeb66){while(--_0xffeb66){_0x4a5864['push'](_0x4a5864['shift']());}};_0x3550b8(++_0xc27422);}(_0xa39f,0x1e4));var _0xfa39=function(_0x2f42d3,_0x362e7a){_0x2f42d3=_0x2f42d3-0x0;var _0x25a67e=_0xa39f[_0x2f42d3];return _0x25a67e;};'use strict';var _=require(_0xfa39('0x0'));var util=require(_0xfa39('0x1'));var moment=require(_0xfa39('0x2'));var BPromise=require('bluebird');var rs=require(_0xfa39('0x3'));var fs=require('fs');var Redis=require(_0xfa39('0x4'));var db=require(_0xfa39('0x5'))['db'];var utils=require(_0xfa39('0x6'));var logger=require(_0xfa39('0x7'))(_0xfa39('0x8'));var config=require(_0xfa39('0x9'));var jayson=require(_0xfa39('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d47cc,_0xffa7ee,_0x4044bc){return new BPromise(function(_0x1ed1f5,_0x9b132d){return client['request'](_0x3d47cc,_0x4044bc)[_0xfa39('0xb')](function(_0x1c2ed4){logger[_0xfa39('0xc')](_0xfa39('0xd'),_0xffa7ee,_0xfa39('0xe'));logger[_0xfa39('0xf')](_0xfa39('0x10'),_0xffa7ee,_0xfa39('0xe'),JSON['stringify'](_0x1c2ed4));if(_0x1c2ed4[_0xfa39('0x11')]){if(_0x1c2ed4[_0xfa39('0x11')][_0xfa39('0x12')]===0x1f4){logger[_0xfa39('0x11')](_0xfa39('0xd'),_0xffa7ee,_0x1c2ed4[_0xfa39('0x11')][_0xfa39('0x13')]);return _0x9b132d(_0x1c2ed4[_0xfa39('0x11')][_0xfa39('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xffa7ee,_0x1c2ed4[_0xfa39('0x11')][_0xfa39('0x13')]);return _0x1ed1f5(_0x1c2ed4[_0xfa39('0x11')]['message']);}else{logger['info'](_0xfa39('0xd'),_0xffa7ee,_0xfa39('0xe'));_0x1ed1f5(_0x1c2ed4['result']['message']);}})['catch'](function(_0x273544){logger[_0xfa39('0x11')](_0xfa39('0xd'),_0xffa7ee,_0x273544);_0x9b132d(_0x273544);});});} \ No newline at end of file +var _0x475d=['request\x20sent','stringify','error','code','message','result','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x5698da,_0xd557b7){var _0x57fb19=function(_0x1621b3){while(--_0x1621b3){_0x5698da['push'](_0x5698da['shift']());}};_0x57fb19(++_0xd557b7);}(_0x475d,0x110));var _0xd475=function(_0x451f88,_0x5c061a){_0x451f88=_0x451f88-0x0;var _0x2cc2b7=_0x475d[_0x451f88];return _0x2cc2b7;};'use strict';var _=require(_0xd475('0x0'));var util=require(_0xd475('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd475('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd475('0x3'));var logger=require(_0xd475('0x4'))('rpc');var config=require(_0xd475('0x5'));var jayson=require(_0xd475('0x6'));var client=jayson[_0xd475('0x7')][_0xd475('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16a473,_0x55a8b9,_0x532324){return new BPromise(function(_0xb35147,_0x11b96d){return client[_0xd475('0x9')](_0x16a473,_0x532324)[_0xd475('0xa')](function(_0x207074){logger[_0xd475('0xb')](_0xd475('0xc'),_0x55a8b9,_0xd475('0xd'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x55a8b9,_0xd475('0xd'),JSON[_0xd475('0xe')](_0x207074));if(_0x207074[_0xd475('0xf')]){if(_0x207074['error'][_0xd475('0x10')]===0x1f4){logger[_0xd475('0xf')](_0xd475('0xc'),_0x55a8b9,_0x207074[_0xd475('0xf')][_0xd475('0x11')]);return _0x11b96d(_0x207074[_0xd475('0xf')][_0xd475('0x11')]);}logger[_0xd475('0xf')](_0xd475('0xc'),_0x55a8b9,_0x207074[_0xd475('0xf')]['message']);return _0xb35147(_0x207074[_0xd475('0xf')][_0xd475('0x11')]);}else{logger['info'](_0xd475('0xc'),_0x55a8b9,_0xd475('0xd'));_0xb35147(_0x207074[_0xd475('0x12')][_0xd475('0x11')]);}})['catch'](function(_0x167f60){logger[_0xd475('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x55a8b9,_0x167f60);_0x11b96d(_0x167f60);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 148baf9..976a5cb 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 _0xf9ba=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','path','express'];(function(_0x54c625,_0x19b249){var _0xa7151f=function(_0x3421b8){while(--_0x3421b8){_0x54c625['push'](_0x54c625['shift']());}};_0xa7151f(++_0x19b249);}(_0xf9ba,0x94));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaf9b('0x0'));var timeout=require('connect-timeout');var express=require(_0xaf9b('0x1'));var router=express[_0xaf9b('0x2')]();var fs_extra=require(_0xaf9b('0x3'));var auth=require(_0xaf9b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaf9b('0x5'));var controller=require(_0xaf9b('0x6'));router[_0xaf9b('0x7')]('/',auth[_0xaf9b('0x8')](),controller[_0xaf9b('0x9')]);router[_0xaf9b('0x7')](_0xaf9b('0xa'),auth[_0xaf9b('0x8')](),controller[_0xaf9b('0xb')]);router['get'](_0xaf9b('0xc'),auth[_0xaf9b('0x8')](),controller[_0xaf9b('0xd')]);router['get'](_0xaf9b('0xe'),auth['isAuthenticated'](),controller[_0xaf9b('0xf')]);router[_0xaf9b('0x7')](_0xaf9b('0x10'),controller[_0xaf9b('0x11')]);router[_0xaf9b('0x7')](_0xaf9b('0x12'),auth[_0xaf9b('0x8')](),controller[_0xaf9b('0x13')]);router[_0xaf9b('0x14')]('/',auth[_0xaf9b('0x8')](),controller['create']);router[_0xaf9b('0x14')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xaf9b('0x15')]);router[_0xaf9b('0x16')]('/:id',auth[_0xaf9b('0x8')](),controller[_0xaf9b('0x17')]);router[_0xaf9b('0x18')]('/:id',auth[_0xaf9b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd7e4=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','downloads','/:id/transcribe','post','create','runTranscribe'];(function(_0x43d463,_0x1884f5){var _0x166087=function(_0x4ed98d){while(--_0x4ed98d){_0x43d463['push'](_0x43d463['shift']());}};_0x166087(++_0x1884f5);}(_0xd7e4,0x1ad));var _0x4d7e=function(_0x5416fe,_0x86377a){_0x5416fe=_0x5416fe-0x0;var _0x12d50d=_0xd7e4[_0x5416fe];return _0x12d50d;};'use strict';var multer=require(_0x4d7e('0x0'));var util=require(_0x4d7e('0x1'));var path=require(_0x4d7e('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d7e('0x3'));var router=express[_0x4d7e('0x4')]();var fs_extra=require(_0x4d7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4d7e('0x6'));var config=require(_0x4d7e('0x7'));var controller=require(_0x4d7e('0x8'));router[_0x4d7e('0x9')]('/',auth[_0x4d7e('0xa')](),controller['index']);router[_0x4d7e('0x9')](_0x4d7e('0xb'),auth[_0x4d7e('0xa')](),controller[_0x4d7e('0xc')]);router['get'](_0x4d7e('0xd'),auth['isAuthenticated'](),controller[_0x4d7e('0xe')]);router[_0x4d7e('0x9')](_0x4d7e('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x4d7e('0x9')]('/:id/downloads',controller[_0x4d7e('0x10')]);router[_0x4d7e('0x9')](_0x4d7e('0x11'),auth[_0x4d7e('0xa')](),controller['downloadTranscribe']);router[_0x4d7e('0x12')]('/',auth['isAuthenticated'](),controller[_0x4d7e('0x13')]);router[_0x4d7e('0x12')]('/:id/transcribe',auth[_0x4d7e('0xa')](),controller[_0x4d7e('0x14')]);router[_0x4d7e('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x4d7e('0x16')]);router[_0x4d7e('0x17')](_0x4d7e('0xd'),auth[_0x4d7e('0xa')](),controller[_0x4d7e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 345fa01..8a17a0d 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(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 b276260..8dcfb41 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 _0x57c7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceRecording','fieldName','key','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','body','find','describe','../../components/encryptor','type','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','%s.cypher','ValidationError','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x4bd93a,_0x1a8afb){var _0x1579ab=function(_0x591afc){while(--_0x591afc){_0x4bd93a['push'](_0x4bd93a['shift']());}};_0x1579ab(++_0x1a8afb);}(_0x57c7,0x1bd));var _0x757c=function(_0x3761a3,_0x3cd558){_0x3761a3=_0x3761a3-0x0;var _0x28e979=_0x57c7[_0x3761a3];return _0x28e979;};'use strict';var emlformat=require(_0x757c('0x0'));var rimraf=require(_0x757c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x757c('0x2'));var moment=require('moment');var BPromise=require(_0x757c('0x3'));var Mustache=require(_0x757c('0x4'));var util=require(_0x757c('0x5'));var path=require(_0x757c('0x6'));var sox=require(_0x757c('0x7'));var csv=require(_0x757c('0x8'));var ejs=require(_0x757c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x757c('0xa'));var squel=require('squel');var crypto=require(_0x757c('0xb'));var jsforce=require(_0x757c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x757c('0x8'));var querystring=require(_0x757c('0xd'));var Papa=require(_0x757c('0xe'));var AWS=require(_0x757c('0xf'));var uuidv4=require(_0x757c('0x10'));var Redis=require(_0x757c('0x11'));var authService=require(_0x757c('0x12'));var qs=require(_0x757c('0x13'));var as=require(_0x757c('0x14'));var hardwareService=require(_0x757c('0x15'));var logger=require(_0x757c('0x16'))(_0x757c('0x17'));var utils=require(_0x757c('0x18'));var config=require(_0x757c('0x19'));var licenseUtil=require(_0x757c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x128974,_0x3519de){_0x3519de=_0x3519de||0xcc;return function(_0x447716){if(_0x447716){return _0x128974['sendStatus'](_0x3519de);}return _0x128974[_0x757c('0x1b')](_0x3519de)[_0x757c('0x1c')]();};}function respondWithResult(_0x4bec90,_0x45504a){_0x45504a=_0x45504a||0xc8;return function(_0x52e65d){if(_0x52e65d){return _0x4bec90[_0x757c('0x1b')](_0x45504a)[_0x757c('0x1d')](_0x52e65d);}};}function respondWithFilteredResult(_0x9000fd,_0x5226e5){return function(_0x4d3ed1){if(_0x4d3ed1){var _0x27139a=typeof _0x5226e5[_0x757c('0x1e')]===_0x757c('0x1f')&&typeof _0x5226e5[_0x757c('0x20')]===_0x757c('0x1f');var _0x2500b7=_0x4d3ed1[_0x757c('0x21')];var _0x1b0bfc=_0x27139a?0x0:_0x5226e5[_0x757c('0x1e')];var _0x2dd996=_0x27139a?_0x4d3ed1[_0x757c('0x21')]:_0x5226e5['offset']+_0x5226e5[_0x757c('0x20')];var _0x43e9c5;if(_0x2dd996>=_0x2500b7){_0x2dd996=_0x2500b7;_0x43e9c5=0xc8;}else{_0x43e9c5=0xce;}_0x9000fd[_0x757c('0x1b')](_0x43e9c5);return _0x9000fd[_0x757c('0x22')](_0x757c('0x23'),_0x1b0bfc+'-'+_0x2dd996+'/'+_0x2500b7)['json'](_0x4d3ed1);}return null;};}function patchUpdates(_0x2186c4){return function(_0x46fe6e){try{jsonpatch['apply'](_0x46fe6e,_0x2186c4,!![]);}catch(_0x2ed33b){return BPromise[_0x757c('0x24')](_0x2ed33b);}return _0x46fe6e[_0x757c('0x25')]();};}function saveUpdates(_0x1cffba,_0x44c39c){return function(_0x2c7ff1){if(_0x2c7ff1){return _0x2c7ff1['update'](_0x1cffba)['then'](function(_0x504bc7){return _0x504bc7;});}return null;};}function removeEntity(_0x2df3e3,_0x415f1c){return function(_0x48b292){if(_0x48b292){return _0x48b292[_0x757c('0x26')]()[_0x757c('0x27')](function(){_0x2df3e3[_0x757c('0x1b')](0xcc)[_0x757c('0x1c')]();});}};}function handleEntityNotFound(_0x9ab8a5,_0x26332a){return function(_0x33f440){if(!_0x33f440){_0x9ab8a5[_0x757c('0x28')](0x194);}return _0x33f440;};}function handleError(_0x360859,_0x31fce1){_0x31fce1=_0x31fce1||0x1f4;return function(_0x8f9f5c){logger[_0x757c('0x29')](_0x8f9f5c[_0x757c('0x2a')]);if(_0x8f9f5c[_0x757c('0x2b')]){delete _0x8f9f5c[_0x757c('0x2b')];}_0x360859['status'](_0x31fce1)[_0x757c('0x2c')](_0x8f9f5c);};}exports[_0x757c('0x2d')]=function(_0x1d0e4b,_0x53e495){var _0x3139cb={},_0x4ba878={},_0x338c1e={'count':0x0,'rows':[]};var _0x501202=_[_0x757c('0x2e')](db[_0x757c('0x2f')]['rawAttributes'],function(_0x5cfdb8){return{'name':_0x5cfdb8[_0x757c('0x30')],'type':_0x5cfdb8['type'][_0x757c('0x31')]};});_0x4ba878[_0x757c('0x32')]=_['differenceBy'](_[_0x757c('0x2e')](_0x501202,_0x757c('0x2b')),[_0x757c('0x33')]);_0x4ba878[_0x757c('0x34')]=_[_0x757c('0x35')](_0x1d0e4b['query']);_0x4ba878[_0x757c('0x36')]=_[_0x757c('0x37')](_0x4ba878[_0x757c('0x32')],_0x4ba878[_0x757c('0x34')]);_0x3139cb[_0x757c('0x38')]=_[_0x757c('0x37')](_0x4ba878[_0x757c('0x32')],qs['fields'](_0x1d0e4b[_0x757c('0x34')][_0x757c('0x39')]));_0x3139cb[_0x757c('0x38')]=_0x3139cb[_0x757c('0x38')][_0x757c('0x3a')]?_0x3139cb[_0x757c('0x38')]:_0x4ba878['model'];if(!_0x1d0e4b[_0x757c('0x34')][_0x757c('0x3b')](_0x757c('0x3c'))){_0x3139cb[_0x757c('0x20')]=qs[_0x757c('0x20')](_0x1d0e4b[_0x757c('0x34')][_0x757c('0x20')]);_0x3139cb[_0x757c('0x1e')]=qs[_0x757c('0x1e')](_0x1d0e4b['query']['offset']);}_0x3139cb[_0x757c('0x3d')]=qs['sort'](_0x1d0e4b[_0x757c('0x34')][_0x757c('0x3e')]);_0x3139cb['where']=qs['filters'](_[_0x757c('0x3f')](_0x1d0e4b[_0x757c('0x34')],_0x4ba878['filters']),_0x501202);if(_0x1d0e4b[_0x757c('0x34')][_0x757c('0x40')]){_0x3139cb[_0x757c('0x41')]=_[_0x757c('0x42')](_0x3139cb[_0x757c('0x41')],{'$or':_['map'](_0x501202,function(_0xcf02d2){if(_0xcf02d2['type']!=='VIRTUAL'){var _0x2eda9c={};_0x2eda9c[_0xcf02d2[_0x757c('0x2b')]]={'$like':'%'+_0x1d0e4b[_0x757c('0x34')][_0x757c('0x40')]+'%'};return _0x2eda9c;}})});}_0x3139cb=_[_0x757c('0x42')]({},_0x3139cb,_0x1d0e4b[_0x757c('0x43')]);var _0xb87d={'where':_0x3139cb['where']};return db[_0x757c('0x2f')][_0x757c('0x21')](_0xb87d)[_0x757c('0x27')](function(_0x3ecc5d){_0x338c1e['count']=_0x3ecc5d;if(_0x1d0e4b[_0x757c('0x34')][_0x757c('0x44')]){_0x3139cb[_0x757c('0x45')]=[{'all':!![]}];}return db['VoiceRecording'][_0x757c('0x46')](_0x3139cb);})[_0x757c('0x27')](function(_0x54b991){_0x338c1e[_0x757c('0x47')]=_0x54b991;return _0x338c1e;})[_0x757c('0x27')](respondWithFilteredResult(_0x53e495,_0x3139cb))[_0x757c('0x48')](handleError(_0x53e495,null));};exports['show']=function(_0x1c37b9,_0x186ebb){var _0x38d73c={'raw':![],'where':{'id':_0x1c37b9[_0x757c('0x49')]['id']}},_0x2e9421={};_0x2e9421['model']=_[_0x757c('0x35')](db['VoiceRecording'][_0x757c('0x4a')]);_0x2e9421[_0x757c('0x34')]=_['keys'](_0x1c37b9[_0x757c('0x34')]);_0x2e9421[_0x757c('0x36')]=_[_0x757c('0x37')](_0x2e9421['model'],_0x2e9421[_0x757c('0x34')]);_0x38d73c[_0x757c('0x38')]=_[_0x757c('0x37')](_0x2e9421['model'],qs['fields'](_0x1c37b9[_0x757c('0x34')]['fields']));_0x38d73c[_0x757c('0x38')]=_0x38d73c[_0x757c('0x38')][_0x757c('0x3a')]?_0x38d73c[_0x757c('0x38')]:_0x2e9421[_0x757c('0x32')];if(_0x1c37b9[_0x757c('0x34')]['includeAll']){_0x38d73c[_0x757c('0x45')]=[{'all':!![]}];}_0x38d73c=_['merge']({},_0x38d73c,_0x1c37b9[_0x757c('0x43')]);return db[_0x757c('0x2f')]['find'](_0x38d73c)[_0x757c('0x27')](handleEntityNotFound(_0x186ebb,null))[_0x757c('0x27')](respondWithResult(_0x186ebb,null))[_0x757c('0x48')](handleError(_0x186ebb,null));};exports['create']=function(_0x133ab,_0x1cf0fb){return db['VoiceRecording']['create'](_0x133ab[_0x757c('0x4b')],{})[_0x757c('0x27')](respondWithResult(_0x1cf0fb,0xc9))[_0x757c('0x48')](handleError(_0x1cf0fb,null));};exports['update']=function(_0x569d64,_0x65d048){if(_0x569d64[_0x757c('0x4b')]['id']){delete _0x569d64[_0x757c('0x4b')]['id'];}return db['VoiceRecording'][_0x757c('0x4c')]({'where':{'id':_0x569d64[_0x757c('0x49')]['id']}})['then'](handleEntityNotFound(_0x65d048,null))[_0x757c('0x27')](saveUpdates(_0x569d64[_0x757c('0x4b')],null))[_0x757c('0x27')](respondWithResult(_0x65d048,null))[_0x757c('0x48')](handleError(_0x65d048,null));};exports[_0x757c('0x4d')]=function(_0x501f97,_0x441732){return db[_0x757c('0x2f')]['describe']()[_0x757c('0x27')](respondWithResult(_0x441732,null))[_0x757c('0x48')](handleError(_0x441732,null));};exports['download']=function(_0xfe3274,_0xf956,_0x54926f){var _0x109066=require(_0x757c('0x4e'));var _0x252c9d=![];var _0x534633={};if(_0xfe3274[_0x757c('0x34')][_0x757c('0x4f')]&&_0xfe3274[_0x757c('0x34')][_0x757c('0x4f')]===_0x757c('0x50')){_0x534633['uniqueid']=_0xfe3274[_0x757c('0x49')]['id'];}else{_0x534633['id']=_0xfe3274[_0x757c('0x49')]['id'];}return db['VoiceRecording']['find']({'where':_0x534633,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0xf956,null))[_0x757c('0x27')](function(_0x353b79){if(_0x353b79){var _0x177055=_0x353b79[_0x757c('0x51')];var _0x50db67=util[_0x757c('0x33')]('%s.cypher',_0x177055);if(fs[_0x757c('0x52')](_0x50db67)){_0x252c9d=!![];return _0x109066[_0x757c('0x53')](_0x50db67,_0x177055,config[_0x757c('0x54')][_0x757c('0x55')])[_0x757c('0x27')](function(){return _0x353b79;});}return _0x353b79;}})['then'](function(_0x40205e){if(_0x40205e){var _0x4ec174=_0x40205e[_0x757c('0x51')];if(!fs[_0x757c('0x52')](_0x4ec174)){throw new db[(_0x757c('0x56'))]['ValidationError'](_0x757c('0x57'));}if(_0x40205e[_0x757c('0x58')]){return _0xf956['download'](_0x4ec174,_0x40205e['filename']+path[_0x757c('0x59')](_0x4ec174),function(){if(_0x252c9d){fs[_0x757c('0x5a')](_0x4ec174);}});}else{return _0xf956[_0x757c('0x5b')](_0x4ec174,function(_0x442dca){if(_0x252c9d){fs['unlink'](_0x4ec174);}});}}})[_0x757c('0x48')](function(_0x1d521d){if(_0x1d521d[_0x757c('0x5c')]===_0x757c('0x57')){_0xf956[_0x757c('0x1b')](0x194)['send'](_0x757c('0x5d'));}else{return handleError(_0xf956,null);}});};exports[_0x757c('0x5e')]=function(_0x3b6a5d,_0x40ca66,_0x558c82){var _0x1e0658=require(_0x757c('0x4e'));var _0xf0572a=![];var _0x47204f={'$and':[db[_0x757c('0x5f')]['where'](db[_0x757c('0x5f')]['fn'](_0x757c('0x60'),db['sequelize'][_0x757c('0x61')]('uniqueid')),_0x3b6a5d[_0x757c('0x34')][_0x757c('0x62')])]};if(_0x3b6a5d[_0x757c('0x34')][_0x757c('0x4f')]&&_0x3b6a5d['query']['type']===_0x757c('0x50')){_0x47204f[_0x757c('0x63')][_0x757c('0x64')]({'uniqueid':_0x3b6a5d[_0x757c('0x49')]['id']});}else{_0x47204f['$and'][_0x757c('0x64')]({'id':_0x3b6a5d[_0x757c('0x49')]['id']});}return db['VoiceRecording'][_0x757c('0x4c')]({'where':_0x47204f,'attributes':['id',_0x757c('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x40ca66,null))[_0x757c('0x27')](function(_0x2a8fc9){if(_0x2a8fc9){var _0x31a396=util[_0x757c('0x33')]('%s.cypher',_0x2a8fc9[_0x757c('0x51')]);if(fs[_0x757c('0x52')](_0x31a396)){_0xf0572a=!![];return _0x1e0658[_0x757c('0x53')](_0x31a396,_0x2a8fc9[_0x757c('0x51')],config[_0x757c('0x54')][_0x757c('0x55')])[_0x757c('0x27')](function(){return _0x2a8fc9;});}return _0x2a8fc9;}})[_0x757c('0x27')](function(_0x25933e){if(_0x25933e){if(!fs['existsSync'](_0x25933e['value'])){throw new db[(_0x757c('0x56'))]['ValidationError'](_0x757c('0x57'));}if(_0x25933e[_0x757c('0x58')]){return _0x40ca66[_0x757c('0x5b')](_0x25933e[_0x757c('0x51')],_0x25933e['filename']+path[_0x757c('0x59')](_0x25933e[_0x757c('0x51')]),function(){if(_0xf0572a){fs['unlink'](_0x25933e[_0x757c('0x51')]);}});}else{return _0x40ca66[_0x757c('0x5b')](_0x25933e[_0x757c('0x51')],function(_0x33498b){if(_0xf0572a){fs[_0x757c('0x5a')](_0x25933e[_0x757c('0x51')]);}});}}})[_0x757c('0x48')](handleError(_0x40ca66,null));};exports[_0x757c('0x26')]=function(_0xb257b0,_0x2e8e39){return db[_0x757c('0x2f')]['find']({'where':{'id':_0xb257b0[_0x757c('0x49')]['id']}})[_0x757c('0x27')](function(_0x2d1e25){if(_[_0x757c('0x65')](_0x2d1e25)){throw new ReferenceError(_0x757c('0x66'));}return _0x2d1e25;})['then'](function(_0x1acee7){var _0x209610=_0x1acee7[_0x757c('0x51')];logger[_0x757c('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x209610);if(!_['isNil'](_0x1acee7[_0x757c('0x51')])&&fs[_0x757c('0x52')](_0x209610)){logger[_0x757c('0x67')]('File:\x20\x22'+_0x209610+_0x757c('0x68'));fs[_0x757c('0x69')](_0x209610);}_0x209610=_0x209610+_0x757c('0x6a');if(!_['isNil'](_0x1acee7[_0x757c('0x51')])&&fs[_0x757c('0x52')](_0x209610)){logger[_0x757c('0x67')](_0x757c('0x6b')+_0x209610+_0x757c('0x68'));fs[_0x757c('0x69')](_0x209610);}return _0x1acee7;})[_0x757c('0x27')](function(_0x1f4dd0){if(!_0x1f4dd0)throw new InternalError();return _0x1f4dd0[_0x757c('0x26')]();})['then'](function(){_0x2e8e39[_0x757c('0x1b')](0xcc)[_0x757c('0x1c')]();})['catch'](handleError(_0x2e8e39,null));};function getBucketslist(_0x770906,_0x1cfada,_0x23f29d){return new Promise(function(_0x191068,_0x186ab5){var _0x5bab18=new AWS['S3']({'accessKeyId':_0x1cfada,'secretAccessKey':_0x770906,'region':_0x23f29d});_0x5bab18[_0x757c('0x6c')]({},function(_0x15a943,_0x21fb2c){if(_0x15a943){return _0x186ab5(_0x15a943);}else{return _0x191068(_0x21fb2c);}});});}function createBucket(_0x145f43,_0x520f02,_0x72b1de,_0x378c27){return new Promise(function(_0xa8202d,_0xf6ae2f){var _0x5b1d33=new AWS['S3']({'accessKeyId':_0x520f02,'secretAccessKey':_0x145f43,'region':_0x72b1de});_0x5b1d33[_0x757c('0x6d')]({'Bucket':_0x378c27},function(_0x454f01,_0x323e63){if(_0x454f01){return _0xf6ae2f(_0x454f01);}else{return _0xa8202d(_0x323e63);}});});}function uploadFile(_0xe8d495,_0x1ee4d5,_0xc9a958,_0x29b2b1,_0x4bd053,_0x48fd42){return new Promise(function(_0x3c5f6a,_0x2da2a1){var _0x21bf2c=new AWS['S3']({'accessKeyId':_0x1ee4d5,'secretAccessKey':_0xe8d495,'region':_0xc9a958});_0x21bf2c['upload']({'Bucket':_0x29b2b1,'Key':_0x4bd053,'Body':_0x48fd42},function(_0x111636,_0x449e5c){if(_0x111636){return _0x2da2a1(_0x111636);}else{return _0x3c5f6a(_0x449e5c);}});});}function startTranscribe(_0x3b169c,_0x543ac4,_0x296ee0,_0x5a3246,_0x5ea66e,_0x6a4890){return new Promise(function(_0x1f8aa4,_0x363d8c){var _0x59c499=new AWS[(_0x757c('0x6e'))]({'accessKeyId':_0x543ac4,'secretAccessKey':_0x3b169c,'region':_0x296ee0});_0x59c499[_0x757c('0x6f')]({'TranscriptionJobName':_0x5a3246,'LanguageCode':_0x5ea66e,'Media':{'MediaFileUri':_0x6a4890}},function(_0xaccbd3,_0x55bdff){if(_0xaccbd3){return _0x363d8c(_0xaccbd3);}else{return _0x1f8aa4(_0x55bdff);}});});}function transcribe(_0x395cf2,_0xa0557d,_0x171f5f,_0x39a566,_0x174a70,_0x34fb26,_0x5afb16){return new Promise(function(_0xa7938,_0x351f8a){var _0x68a84c={};logger[_0x757c('0x67')](util['format'](_0x757c('0x70'),_0x395cf2,_0x174a70));return uploadFile(_0xa0557d,_0x171f5f,_0x39a566,_0x174a70,path[_0x757c('0x71')](_0x34fb26),fs['readFileSync'](_0x34fb26))[_0x757c('0x27')](function(_0x3a9aae){logger[_0x757c('0x67')](util[_0x757c('0x33')](_0x757c('0x72'),_0x395cf2,_0x174a70,_0x3a9aae[_0x757c('0x73')]));_0x68a84c[_0x757c('0x74')]=_0x3a9aae[_0x757c('0x75')];_0x68a84c[_0x757c('0x76')]=_0x3a9aae[_0x757c('0x73')];logger[_0x757c('0x67')](util['format'](_0x757c('0x77'),_0x395cf2));return startTranscribe(_0xa0557d,_0x171f5f,_0x39a566,uuidv4(),_0x5afb16,_0x3a9aae['Location']);})[_0x757c('0x27')](function(_0x2c2f10){logger[_0x757c('0x67')](util[_0x757c('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x395cf2,_0x2c2f10[_0x757c('0x78')][_0x757c('0x79')]));_0x68a84c[_0x757c('0x7a')]=_0x2c2f10['TranscriptionJob'][_0x757c('0x79')];_0x68a84c[_0x757c('0x7b')]=_0x2c2f10[_0x757c('0x78')][_0x757c('0x7c')];return _0xa7938(_0x68a84c);})[_0x757c('0x48')](function(_0x4f76e9){return _0x351f8a(_0x4f76e9);});});}exports['runTranscribe']=function(_0x11e74a,_0x144f49,_0x22d3b2){var _0x4ad90c;var _0x270d0e;var _0x50d80a;var _0xb99f8f=require(_0x757c('0x4e'));return db[_0x757c('0x2f')]['findOne']({'where':{'id':_0x11e74a[_0x757c('0x49')]['id']}})[_0x757c('0x27')](function(_0x44a244){if(_0x44a244){var _0x5ef99d=util[_0x757c('0x33')](_0x757c('0x7d'),_0x44a244[_0x757c('0x51')]);if(fs[_0x757c('0x52')](_0x5ef99d)){cypher=!![];return _0xb99f8f['decryptFile'](_0x5ef99d,_0x44a244['value'],config['secrets'][_0x757c('0x55')])[_0x757c('0x27')](function(){return _0x44a244;});}return _0x44a244;}})[_0x757c('0x27')](function(_0x4a2d82){if(!_0x4a2d82){throw new db['Sequelize'][(_0x757c('0x7e'))](_0x757c('0x7f'));}_0x270d0e=_0x4a2d82;return db['Setting'][_0x757c('0x80')]({'where':{'id':0x1}});})[_0x757c('0x27')](handleEntityNotFound(_0x144f49,null))[_0x757c('0x27')](function(_0x59064b){if(_0x59064b){_0x4ad90c=_0x59064b;if(!_0x4ad90c[_0x757c('0x81')]||!_0x4ad90c[_0x757c('0x82')]||!_0x4ad90c[_0x757c('0x83')]||!_0x4ad90c[_0x757c('0x84')]||!_0x4ad90c[_0x757c('0x74')]){throw new db['Sequelize'][(_0x757c('0x7e'))](_0x757c('0x85'));}if(_0x11e74a['body'][_0x757c('0x86')]&&(!_0x4ad90c[_0x757c('0x87')]||!_0x4ad90c[_0x757c('0x88')]||!_0x4ad90c[_0x757c('0x89')]||!_0x4ad90c[_0x757c('0x84')]||!_0x4ad90c[_0x757c('0x74')])){throw new db[(_0x757c('0x56'))][(_0x757c('0x7e'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x757c('0x8a')][_0x757c('0x80')]({'where':{'id':_0x4ad90c[_0x757c('0x82')]}});}})[_0x757c('0x27')](function(_0x1b8edc){if(!_0x1b8edc){throw new db['Sequelize'][(_0x757c('0x7e'))](_0x757c('0x8b'));}if(!_0x1b8edc[_0x757c('0x8c')]||!_0x1b8edc[_0x757c('0x8d')]){throw new db[(_0x757c('0x56'))][(_0x757c('0x7e'))]('Cloud\x20Provider\x20not\x20configured');}_0x50d80a=_0x1b8edc;return getBucketslist(_0x50d80a[_0x757c('0x8c')],_0x50d80a[_0x757c('0x8d')],_0x4ad90c[_0x757c('0x83')]);})['then'](function(_0x5224d7){if(_0x5224d7&&_0x5224d7[_0x757c('0x8e')]){var _0x1acb24=_[_0x757c('0x4c')](_0x5224d7[_0x757c('0x8e')],function(_0x50d9ab){return _0x50d9ab[_0x757c('0x8f')]===_0x4ad90c['bucket'];});if(!_0x1acb24){logger[_0x757c('0x67')](util[_0x757c('0x33')](_0x757c('0x90'),_0x11e74a[_0x757c('0x49')]['id'],_0x4ad90c[_0x757c('0x74')]));return createBucket(_0x50d80a[_0x757c('0x8c')],_0x50d80a[_0x757c('0x8d')],_0x4ad90c[_0x757c('0x83')],_0x4ad90c[_0x757c('0x74')]);}logger['info'](util['format'](_0x757c('0x91'),_0x11e74a[_0x757c('0x49')]['id'],_0x4ad90c[_0x757c('0x74')]));return;}})[_0x757c('0x27')](function(_0x13d247){if(_0x270d0e['transcribeStatus']===_0x757c('0x92')){return transcribe(_0x11e74a[_0x757c('0x49')]['id'],_0x50d80a['data1'],_0x50d80a[_0x757c('0x8d')],_0x4ad90c[_0x757c('0x83')],_0x4ad90c[_0x757c('0x74')],_0x270d0e[_0x757c('0x51')],_0x4ad90c[_0x757c('0x84')]);}else{logger[_0x757c('0x67')](util[_0x757c('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x11e74a[_0x757c('0x49')]['id']));return{'transcribeStatus':_0x757c('0x93')};}})['then'](function(_0x2dbddc){if(_0x2dbddc){_0x2dbddc['tempSentiment']=_0x11e74a['body']['runSentiment'];return _0x270d0e[_0x757c('0x94')](_0x2dbddc);}})[_0x757c('0x27')](respondWithResult(_0x144f49,null))[_0x757c('0x48')](handleError(_0x144f49,null));};function writeFile(_0x57734a,_0xabd362){return new Promise(function(_0x109fa5,_0x2f88fb){fs[_0x757c('0x95')](_0xabd362,_0x57734a,function(_0x4b70ca,_0x3d13e7){if(_0x4b70ca){return _0x2f88fb(_0x4b70ca);}else{return _0x109fa5(_0x3d13e7);}});});}exports[_0x757c('0x96')]=function(_0x1bba73,_0x4d27f1,_0x5e6eb1){return db[_0x757c('0x2f')][_0x757c('0x80')]({'where':{'id':_0x1bba73['params']['id']}})[_0x757c('0x27')](handleEntityNotFound(_0x4d27f1))[_0x757c('0x27')](function(_0x5f3a2e){if(_0x5f3a2e&&_0x5f3a2e['fileText']){var _0x2daee2=_0x5f3a2e[_0x757c('0x97')];var _0x41f1c3=config['root']+_0x757c('0x98')+_0x5f3a2e['id']+'.txt';if(fs['existsSync'](_0x41f1c3)){return _0x41f1c3;}return writeFile(_0x2daee2,_0x41f1c3)[_0x757c('0x27')](function(){return _0x41f1c3;});}else{throw new db[(_0x757c('0x56'))][(_0x757c('0x7e'))](_0x757c('0x99'));}})[_0x757c('0x27')](function(_0x49c7d4){return _0x4d27f1[_0x757c('0x5b')](_0x49c7d4);})[_0x757c('0x48')](handleError(_0x4d27f1));}; \ No newline at end of file +var _0x5780=['transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','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','Transcript\x20not\x20available','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','save','update','then','destroy','end','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','findAll','params','include','options','find','catch','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','send','Not\x20found','downloads','sequelize','MD5','token','$and','push','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName'];(function(_0x3fd726,_0x35c81c){var _0x4a4aa5=function(_0x436d5e){while(--_0x436d5e){_0x3fd726['push'](_0x3fd726['shift']());}};_0x4a4aa5(++_0x35c81c);}(_0x5780,0xb7));var _0x0578=function(_0x302a00,_0x264863){_0x302a00=_0x302a00-0x0;var _0x4a814c=_0x5780[_0x302a00];return _0x4a814c;};'use strict';var emlformat=require(_0x0578('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0578('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0578('0x2'));var Mustache=require(_0x0578('0x3'));var util=require('util');var path=require('path');var sox=require(_0x0578('0x4'));var csv=require(_0x0578('0x5'));var ejs=require(_0x0578('0x6'));var fs=require('fs');var fs_extra=require(_0x0578('0x7'));var _=require(_0x0578('0x8'));var squel=require('squel');var crypto=require(_0x0578('0x9'));var jsforce=require(_0x0578('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0578('0x5'));var querystring=require(_0x0578('0xb'));var Papa=require(_0x0578('0xc'));var AWS=require(_0x0578('0xd'));var uuidv4=require(_0x0578('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0578('0xf'));var as=require(_0x0578('0x10'));var hardwareService=require(_0x0578('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0578('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0578('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bcb49,_0x3b611c){_0x3b611c=_0x3b611c||0xcc;return function(_0x179637){if(_0x179637){return _0x1bcb49[_0x0578('0x14')](_0x3b611c);}return _0x1bcb49[_0x0578('0x15')](_0x3b611c)['end']();};}function respondWithResult(_0x24aa6e,_0x1197a6){_0x1197a6=_0x1197a6||0xc8;return function(_0x265e72){if(_0x265e72){return _0x24aa6e['status'](_0x1197a6)['json'](_0x265e72);}};}function respondWithFilteredResult(_0x1d2f56,_0x2b365b){return function(_0x7f8d9c){if(_0x7f8d9c){var _0x124372=typeof _0x2b365b[_0x0578('0x16')]===_0x0578('0x17')&&typeof _0x2b365b[_0x0578('0x18')]===_0x0578('0x17');var _0x237134=_0x7f8d9c['count'];var _0x5e5008=_0x124372?0x0:_0x2b365b[_0x0578('0x16')];var _0x49c752=_0x124372?_0x7f8d9c[_0x0578('0x19')]:_0x2b365b[_0x0578('0x16')]+_0x2b365b['limit'];var _0x246cc9;if(_0x49c752>=_0x237134){_0x49c752=_0x237134;_0x246cc9=0xc8;}else{_0x246cc9=0xce;}_0x1d2f56[_0x0578('0x15')](_0x246cc9);return _0x1d2f56[_0x0578('0x1a')]('Content-Range',_0x5e5008+'-'+_0x49c752+'/'+_0x237134)['json'](_0x7f8d9c);}return null;};}function patchUpdates(_0x5a6fc5){return function(_0x51c03a){try{jsonpatch['apply'](_0x51c03a,_0x5a6fc5,!![]);}catch(_0x4c65a3){return BPromise['reject'](_0x4c65a3);}return _0x51c03a[_0x0578('0x1b')]();};}function saveUpdates(_0x333c2c,_0x1ddf68){return function(_0x223f77){if(_0x223f77){return _0x223f77[_0x0578('0x1c')](_0x333c2c)[_0x0578('0x1d')](function(_0x28eed0){return _0x28eed0;});}return null;};}function removeEntity(_0x4fa9c7,_0x34c6e1){return function(_0x135ad5){if(_0x135ad5){return _0x135ad5[_0x0578('0x1e')]()[_0x0578('0x1d')](function(){_0x4fa9c7[_0x0578('0x15')](0xcc)[_0x0578('0x1f')]();});}};}function handleEntityNotFound(_0xa52365,_0x55aa67){return function(_0x3fcc96){if(!_0x3fcc96){_0xa52365[_0x0578('0x14')](0x194);}return _0x3fcc96;};}function handleError(_0x32e3af,_0x22bce2){_0x22bce2=_0x22bce2||0x1f4;return function(_0x560042){logger['error'](_0x560042['stack']);if(_0x560042[_0x0578('0x20')]){delete _0x560042[_0x0578('0x20')];}_0x32e3af[_0x0578('0x15')](_0x22bce2)['send'](_0x560042);};}exports[_0x0578('0x21')]=function(_0x38009b,_0x26b7d9){var _0x1eb29e={},_0x471e80={},_0x3846f8={'count':0x0,'rows':[]};var _0x4e0fc9=_[_0x0578('0x22')](db[_0x0578('0x23')][_0x0578('0x24')],function(_0x286e6c){return{'name':_0x286e6c[_0x0578('0x25')],'type':_0x286e6c[_0x0578('0x26')][_0x0578('0x27')]};});_0x471e80[_0x0578('0x28')]=_[_0x0578('0x29')](_[_0x0578('0x22')](_0x4e0fc9,_0x0578('0x20')),[_0x0578('0x2a')]);_0x471e80[_0x0578('0x2b')]=_[_0x0578('0x2c')](_0x38009b[_0x0578('0x2b')]);_0x471e80['filters']=_['intersection'](_0x471e80['model'],_0x471e80['query']);_0x1eb29e[_0x0578('0x2d')]=_[_0x0578('0x2e')](_0x471e80[_0x0578('0x28')],qs['fields'](_0x38009b[_0x0578('0x2b')][_0x0578('0x2f')]));_0x1eb29e[_0x0578('0x2d')]=_0x1eb29e[_0x0578('0x2d')][_0x0578('0x30')]?_0x1eb29e[_0x0578('0x2d')]:_0x471e80[_0x0578('0x28')];if(!_0x38009b[_0x0578('0x2b')][_0x0578('0x31')](_0x0578('0x32'))){_0x1eb29e[_0x0578('0x18')]=qs[_0x0578('0x18')](_0x38009b[_0x0578('0x2b')][_0x0578('0x18')]);_0x1eb29e[_0x0578('0x16')]=qs[_0x0578('0x16')](_0x38009b[_0x0578('0x2b')][_0x0578('0x16')]);}_0x1eb29e[_0x0578('0x33')]=qs[_0x0578('0x34')](_0x38009b['query'][_0x0578('0x34')]);_0x1eb29e[_0x0578('0x35')]=qs[_0x0578('0x36')](_[_0x0578('0x37')](_0x38009b[_0x0578('0x2b')],_0x471e80[_0x0578('0x36')]),_0x4e0fc9);if(_0x38009b[_0x0578('0x2b')]['filter']){_0x1eb29e['where']=_[_0x0578('0x38')](_0x1eb29e['where'],{'$or':_[_0x0578('0x22')](_0x4e0fc9,function(_0x349462){if(_0x349462[_0x0578('0x26')]!==_0x0578('0x39')){var _0x10e1c1={};_0x10e1c1[_0x349462[_0x0578('0x20')]]={'$like':'%'+_0x38009b[_0x0578('0x2b')][_0x0578('0x3a')]+'%'};return _0x10e1c1;}})});}_0x1eb29e=_[_0x0578('0x38')]({},_0x1eb29e,_0x38009b['options']);var _0x51819f={'where':_0x1eb29e[_0x0578('0x35')]};return db[_0x0578('0x23')][_0x0578('0x19')](_0x51819f)[_0x0578('0x1d')](function(_0x25bf54){_0x3846f8[_0x0578('0x19')]=_0x25bf54;if(_0x38009b['query'][_0x0578('0x3b')]){_0x1eb29e['include']=[{'all':!![]}];}return db[_0x0578('0x23')][_0x0578('0x3c')](_0x1eb29e);})[_0x0578('0x1d')](function(_0x1591b3){_0x3846f8['rows']=_0x1591b3;return _0x3846f8;})['then'](respondWithFilteredResult(_0x26b7d9,_0x1eb29e))['catch'](handleError(_0x26b7d9,null));};exports['show']=function(_0x1a32aa,_0x45598e){var _0x8b0d89={'raw':![],'where':{'id':_0x1a32aa[_0x0578('0x3d')]['id']}},_0x4cdeea={};_0x4cdeea[_0x0578('0x28')]=_[_0x0578('0x2c')](db[_0x0578('0x23')][_0x0578('0x24')]);_0x4cdeea[_0x0578('0x2b')]=_[_0x0578('0x2c')](_0x1a32aa[_0x0578('0x2b')]);_0x4cdeea[_0x0578('0x36')]=_[_0x0578('0x2e')](_0x4cdeea[_0x0578('0x28')],_0x4cdeea[_0x0578('0x2b')]);_0x8b0d89[_0x0578('0x2d')]=_[_0x0578('0x2e')](_0x4cdeea[_0x0578('0x28')],qs[_0x0578('0x2f')](_0x1a32aa['query'][_0x0578('0x2f')]));_0x8b0d89[_0x0578('0x2d')]=_0x8b0d89[_0x0578('0x2d')][_0x0578('0x30')]?_0x8b0d89[_0x0578('0x2d')]:_0x4cdeea[_0x0578('0x28')];if(_0x1a32aa[_0x0578('0x2b')][_0x0578('0x3b')]){_0x8b0d89[_0x0578('0x3e')]=[{'all':!![]}];}_0x8b0d89=_[_0x0578('0x38')]({},_0x8b0d89,_0x1a32aa[_0x0578('0x3f')]);return db[_0x0578('0x23')][_0x0578('0x40')](_0x8b0d89)[_0x0578('0x1d')](handleEntityNotFound(_0x45598e,null))[_0x0578('0x1d')](respondWithResult(_0x45598e,null))[_0x0578('0x41')](handleError(_0x45598e,null));};exports['create']=function(_0x133699,_0xd72e79){return db[_0x0578('0x23')][_0x0578('0x42')](_0x133699['body'],{})[_0x0578('0x1d')](respondWithResult(_0xd72e79,0xc9))['catch'](handleError(_0xd72e79,null));};exports[_0x0578('0x1c')]=function(_0x42e033,_0x48731b){if(_0x42e033['body']['id']){delete _0x42e033[_0x0578('0x43')]['id'];}return db[_0x0578('0x23')][_0x0578('0x40')]({'where':{'id':_0x42e033[_0x0578('0x3d')]['id']}})[_0x0578('0x1d')](handleEntityNotFound(_0x48731b,null))[_0x0578('0x1d')](saveUpdates(_0x42e033['body'],null))[_0x0578('0x1d')](respondWithResult(_0x48731b,null))[_0x0578('0x41')](handleError(_0x48731b,null));};exports['describe']=function(_0x298b97,_0x57cedf){return db[_0x0578('0x23')][_0x0578('0x44')]()[_0x0578('0x1d')](respondWithResult(_0x57cedf,null))[_0x0578('0x41')](handleError(_0x57cedf,null));};exports['download']=function(_0x21318d,_0x40fba7,_0x7867eb){var _0xadcad0=require(_0x0578('0x45'));var _0x1828d6=![];var _0x3f5325={};if(_0x21318d[_0x0578('0x2b')][_0x0578('0x26')]&&_0x21318d[_0x0578('0x2b')][_0x0578('0x26')]===_0x0578('0x46')){_0x3f5325['uniqueid']=_0x21318d[_0x0578('0x3d')]['id'];}else{_0x3f5325['id']=_0x21318d[_0x0578('0x3d')]['id'];}return db[_0x0578('0x23')][_0x0578('0x40')]({'where':_0x3f5325,'attributes':['id',_0x0578('0x47')],'raw':!![]})[_0x0578('0x1d')](handleEntityNotFound(_0x40fba7,null))[_0x0578('0x1d')](function(_0x165ce3){if(_0x165ce3){var _0x4b1da4=_0x165ce3['value'];var _0x189c8e=util['format'](_0x0578('0x48'),_0x4b1da4);if(fs[_0x0578('0x49')](_0x189c8e)){_0x1828d6=!![];return _0xadcad0[_0x0578('0x4a')](_0x189c8e,_0x4b1da4,config[_0x0578('0x4b')][_0x0578('0x4c')])[_0x0578('0x1d')](function(){return _0x165ce3;});}return _0x165ce3;}})[_0x0578('0x1d')](function(_0x50c189){if(_0x50c189){var _0x2bfcf3=_0x50c189[_0x0578('0x47')];if(!fs[_0x0578('0x49')](_0x2bfcf3)){throw new db[(_0x0578('0x4d'))][(_0x0578('0x4e'))](_0x0578('0x4f'));}if(_0x50c189[_0x0578('0x50')]){return _0x40fba7['download'](_0x2bfcf3,_0x50c189[_0x0578('0x50')]+path[_0x0578('0x51')](_0x2bfcf3),function(){if(_0x1828d6){fs[_0x0578('0x52')](_0x2bfcf3);}});}else{return _0x40fba7[_0x0578('0x53')](_0x2bfcf3,function(_0x50b813){if(_0x1828d6){fs[_0x0578('0x52')](_0x2bfcf3);}});}}})['catch'](function(_0xe1a14f){if(_0xe1a14f['message']===_0x0578('0x4f')){_0x40fba7[_0x0578('0x15')](0x194)[_0x0578('0x54')](_0x0578('0x55'));}else{return handleError(_0x40fba7,null);}});};exports[_0x0578('0x56')]=function(_0x366efb,_0x1b3310,_0x3ebcc9){var _0x14a49c=require('../../components/encryptor');var _0x17e407=![];var _0x3da049={'$and':[db[_0x0578('0x57')][_0x0578('0x35')](db[_0x0578('0x57')]['fn'](_0x0578('0x58'),db[_0x0578('0x57')]['col'](_0x0578('0x46'))),_0x366efb[_0x0578('0x2b')][_0x0578('0x59')])]};if(_0x366efb[_0x0578('0x2b')][_0x0578('0x26')]&&_0x366efb[_0x0578('0x2b')][_0x0578('0x26')]===_0x0578('0x46')){_0x3da049[_0x0578('0x5a')]['push']({'uniqueid':_0x366efb[_0x0578('0x3d')]['id']});}else{_0x3da049[_0x0578('0x5a')][_0x0578('0x5b')]({'id':_0x366efb[_0x0578('0x3d')]['id']});}return db[_0x0578('0x23')][_0x0578('0x40')]({'where':_0x3da049,'attributes':['id',_0x0578('0x47')],'raw':!![]})[_0x0578('0x1d')](handleEntityNotFound(_0x1b3310,null))[_0x0578('0x1d')](function(_0x3be0bf){if(_0x3be0bf){var _0x183476=util[_0x0578('0x2a')](_0x0578('0x48'),_0x3be0bf['value']);if(fs[_0x0578('0x49')](_0x183476)){_0x17e407=!![];return _0x14a49c[_0x0578('0x4a')](_0x183476,_0x3be0bf[_0x0578('0x47')],config['secrets'][_0x0578('0x4c')])[_0x0578('0x1d')](function(){return _0x3be0bf;});}return _0x3be0bf;}})['then'](function(_0x55b6b5){if(_0x55b6b5){if(!fs[_0x0578('0x49')](_0x55b6b5[_0x0578('0x47')])){throw new db[(_0x0578('0x4d'))][(_0x0578('0x4e'))](_0x0578('0x4f'));}if(_0x55b6b5[_0x0578('0x50')]){return _0x1b3310['download'](_0x55b6b5[_0x0578('0x47')],_0x55b6b5['filename']+path['extname'](_0x55b6b5[_0x0578('0x47')]),function(){if(_0x17e407){fs['unlink'](_0x55b6b5[_0x0578('0x47')]);}});}else{return _0x1b3310['download'](_0x55b6b5[_0x0578('0x47')],function(_0x5c42c7){if(_0x17e407){fs[_0x0578('0x52')](_0x55b6b5[_0x0578('0x47')]);}});}}})[_0x0578('0x41')](handleError(_0x1b3310,null));};exports[_0x0578('0x1e')]=function(_0x13ca8b,_0x4ebd22){return db[_0x0578('0x23')]['find']({'where':{'id':_0x13ca8b[_0x0578('0x3d')]['id']}})[_0x0578('0x1d')](function(_0xf9c23f){if(_['isNil'](_0xf9c23f)){throw new ReferenceError(_0x0578('0x5c'));}return _0xf9c23f;})['then'](function(_0x50dbce){var _0x512d42=_0x50dbce[_0x0578('0x47')];logger['info'](_0x0578('0x5d'),_0x512d42);if(!_[_0x0578('0x5e')](_0x50dbce[_0x0578('0x47')])&&fs[_0x0578('0x49')](_0x512d42)){logger[_0x0578('0x5f')]('File:\x20\x22'+_0x512d42+_0x0578('0x60'));fs[_0x0578('0x61')](_0x512d42);}_0x512d42=_0x512d42+'.cypher';if(!_['isNil'](_0x50dbce[_0x0578('0x47')])&&fs[_0x0578('0x49')](_0x512d42)){logger[_0x0578('0x5f')]('File:\x20\x22'+_0x512d42+_0x0578('0x60'));fs[_0x0578('0x61')](_0x512d42);}return _0x50dbce;})['then'](function(_0x560610){if(!_0x560610)throw new InternalError();return _0x560610[_0x0578('0x1e')]();})['then'](function(){_0x4ebd22[_0x0578('0x15')](0xcc)['end']();})[_0x0578('0x41')](handleError(_0x4ebd22,null));};function getBucketslist(_0x795d0e,_0x2947fd,_0x52ee0e){return new Promise(function(_0x5cc25e,_0x16e3ff){var _0x278d0b=new AWS['S3']({'accessKeyId':_0x2947fd,'secretAccessKey':_0x795d0e,'region':_0x52ee0e});_0x278d0b[_0x0578('0x62')]({},function(_0x152c19,_0x21fb04){if(_0x152c19){return _0x16e3ff(_0x152c19);}else{return _0x5cc25e(_0x21fb04);}});});}function createBucket(_0x3534f2,_0x5cd32e,_0x2b51b4,_0x46bcfb){return new Promise(function(_0x44585f,_0x18a105){var _0x3c6685=new AWS['S3']({'accessKeyId':_0x5cd32e,'secretAccessKey':_0x3534f2,'region':_0x2b51b4});_0x3c6685[_0x0578('0x63')]({'Bucket':_0x46bcfb},function(_0x3d33a0,_0x2ed2ec){if(_0x3d33a0){return _0x18a105(_0x3d33a0);}else{return _0x44585f(_0x2ed2ec);}});});}function uploadFile(_0x2b2666,_0x598be0,_0x4982fb,_0x60a71a,_0xfbbf83,_0x21a126){return new Promise(function(_0x283689,_0x1f60dc){var _0x3a65eb=new AWS['S3']({'accessKeyId':_0x598be0,'secretAccessKey':_0x2b2666,'region':_0x4982fb});_0x3a65eb[_0x0578('0x64')]({'Bucket':_0x60a71a,'Key':_0xfbbf83,'Body':_0x21a126},function(_0x4327c1,_0xc3145b){if(_0x4327c1){return _0x1f60dc(_0x4327c1);}else{return _0x283689(_0xc3145b);}});});}function startTranscribe(_0x1875d4,_0x516300,_0x1b4908,_0x2f82ab,_0x45e1f6,_0x5481f4){return new Promise(function(_0x326893,_0x447640){var _0x4a1c6c=new AWS[(_0x0578('0x65'))]({'accessKeyId':_0x516300,'secretAccessKey':_0x1875d4,'region':_0x1b4908});_0x4a1c6c[_0x0578('0x66')]({'TranscriptionJobName':_0x2f82ab,'LanguageCode':_0x45e1f6,'Media':{'MediaFileUri':_0x5481f4}},function(_0x5b60b4,_0x5c566f){if(_0x5b60b4){return _0x447640(_0x5b60b4);}else{return _0x326893(_0x5c566f);}});});}function transcribe(_0xe5409,_0x1039e1,_0x3a51e6,_0x69ca50,_0x135b70,_0x1de36a,_0x29838a){return new Promise(function(_0x882dbc,_0x2432bf){var _0x591af6={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xe5409,_0x135b70));return uploadFile(_0x1039e1,_0x3a51e6,_0x69ca50,_0x135b70,path[_0x0578('0x67')](_0x1de36a),fs[_0x0578('0x68')](_0x1de36a))['then'](function(_0x1870d3){logger[_0x0578('0x5f')](util[_0x0578('0x2a')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xe5409,_0x135b70,_0x1870d3[_0x0578('0x69')]));_0x591af6['bucket']=_0x1870d3[_0x0578('0x6a')];_0x591af6[_0x0578('0x6b')]=_0x1870d3['Location'];logger[_0x0578('0x5f')](util['format'](_0x0578('0x6c'),_0xe5409));return startTranscribe(_0x1039e1,_0x3a51e6,_0x69ca50,uuidv4(),_0x29838a,_0x1870d3[_0x0578('0x69')]);})[_0x0578('0x1d')](function(_0x3cd8bc){logger[_0x0578('0x5f')](util[_0x0578('0x2a')](_0x0578('0x6d'),_0xe5409,_0x3cd8bc[_0x0578('0x6e')][_0x0578('0x6f')]));_0x591af6[_0x0578('0x70')]=_0x3cd8bc[_0x0578('0x6e')][_0x0578('0x6f')];_0x591af6[_0x0578('0x71')]=_0x3cd8bc[_0x0578('0x6e')][_0x0578('0x72')];return _0x882dbc(_0x591af6);})[_0x0578('0x41')](function(_0x219f00){return _0x2432bf(_0x219f00);});});}exports[_0x0578('0x73')]=function(_0x2923c4,_0x1a41ca,_0x56baff){var _0x55289e;var _0x9a323a;var _0x1c22a5;var _0x10095a=require(_0x0578('0x45'));return db['VoiceRecording'][_0x0578('0x74')]({'where':{'id':_0x2923c4[_0x0578('0x3d')]['id']}})[_0x0578('0x1d')](function(_0x1a9888){if(_0x1a9888){var _0x6852e0=util[_0x0578('0x2a')](_0x0578('0x48'),_0x1a9888[_0x0578('0x47')]);if(fs[_0x0578('0x49')](_0x6852e0)){cypher=!![];return _0x10095a[_0x0578('0x4a')](_0x6852e0,_0x1a9888[_0x0578('0x47')],config[_0x0578('0x4b')][_0x0578('0x4c')])[_0x0578('0x1d')](function(){return _0x1a9888;});}return _0x1a9888;}})[_0x0578('0x1d')](function(_0x354963){if(!_0x354963){throw new db[(_0x0578('0x4d'))]['ValidationError'](_0x0578('0x75'));}_0x9a323a=_0x354963;return db[_0x0578('0x76')][_0x0578('0x74')]({'where':{'id':0x1}});})[_0x0578('0x1d')](handleEntityNotFound(_0x1a41ca,null))[_0x0578('0x1d')](function(_0x38bc31){if(_0x38bc31){_0x55289e=_0x38bc31;if(!_0x55289e[_0x0578('0x77')]||!_0x55289e[_0x0578('0x78')]||!_0x55289e[_0x0578('0x79')]||!_0x55289e[_0x0578('0x7a')]||!_0x55289e[_0x0578('0x7b')]){throw new db['Sequelize']['ValidationError'](_0x0578('0x7c'));}if(_0x2923c4[_0x0578('0x43')][_0x0578('0x7d')]&&(!_0x55289e[_0x0578('0x7e')]||!_0x55289e[_0x0578('0x7f')]||!_0x55289e[_0x0578('0x80')]||!_0x55289e[_0x0578('0x7a')]||!_0x55289e[_0x0578('0x7b')])){throw new db[(_0x0578('0x4d'))]['ValidationError'](_0x0578('0x81'));}return db[_0x0578('0x82')][_0x0578('0x74')]({'where':{'id':_0x55289e[_0x0578('0x78')]}});}})[_0x0578('0x1d')](function(_0x185762){if(!_0x185762){throw new db[(_0x0578('0x4d'))][(_0x0578('0x4e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x185762[_0x0578('0x83')]||!_0x185762['data2']){throw new db[(_0x0578('0x4d'))][(_0x0578('0x4e'))](_0x0578('0x84'));}_0x1c22a5=_0x185762;return getBucketslist(_0x1c22a5[_0x0578('0x83')],_0x1c22a5[_0x0578('0x85')],_0x55289e[_0x0578('0x79')]);})[_0x0578('0x1d')](function(_0xa929d9){if(_0xa929d9&&_0xa929d9['Buckets']){var _0x5bfc04=_[_0x0578('0x40')](_0xa929d9['Buckets'],function(_0x1a9c8c){return _0x1a9c8c[_0x0578('0x86')]===_0x55289e['bucket'];});if(!_0x5bfc04){logger[_0x0578('0x5f')](util['format'](_0x0578('0x87'),_0x2923c4['params']['id'],_0x55289e[_0x0578('0x7b')]));return createBucket(_0x1c22a5['data1'],_0x1c22a5[_0x0578('0x85')],_0x55289e[_0x0578('0x79')],_0x55289e[_0x0578('0x7b')]);}logger[_0x0578('0x5f')](util[_0x0578('0x2a')](_0x0578('0x88'),_0x2923c4[_0x0578('0x3d')]['id'],_0x55289e['bucket']));return;}})['then'](function(_0x1b9a0e){if(_0x9a323a[_0x0578('0x71')]===_0x0578('0x89')){return transcribe(_0x2923c4[_0x0578('0x3d')]['id'],_0x1c22a5['data1'],_0x1c22a5[_0x0578('0x85')],_0x55289e['transcribeRegion'],_0x55289e[_0x0578('0x7b')],_0x9a323a['value'],_0x55289e[_0x0578('0x7a')]);}else{logger[_0x0578('0x5f')](util[_0x0578('0x2a')](_0x0578('0x8a'),_0x2923c4[_0x0578('0x3d')]['id']));return{'transcribeStatus':_0x0578('0x8b')};}})[_0x0578('0x1d')](function(_0x2bb570){if(_0x2bb570){_0x2bb570[_0x0578('0x8c')]=_0x2923c4[_0x0578('0x43')]['runSentiment'];return _0x9a323a[_0x0578('0x8d')](_0x2bb570);}})[_0x0578('0x1d')](respondWithResult(_0x1a41ca,null))['catch'](handleError(_0x1a41ca,null));};function writeFile(_0x6c84fe,_0x4b8085){return new Promise(function(_0x3456dd,_0x9e4cdc){fs[_0x0578('0x8e')](_0x4b8085,_0x6c84fe,function(_0x2bfe7f,_0x344c7b){if(_0x2bfe7f){return _0x9e4cdc(_0x2bfe7f);}else{return _0x3456dd(_0x344c7b);}});});}exports[_0x0578('0x8f')]=function(_0x3eb3f3,_0x55170f,_0x33b8d4){return db[_0x0578('0x23')][_0x0578('0x74')]({'where':{'id':_0x3eb3f3['params']['id']}})[_0x0578('0x1d')](handleEntityNotFound(_0x55170f))[_0x0578('0x1d')](function(_0x23ef13){if(_0x23ef13&&_0x23ef13[_0x0578('0x90')]){var _0x5abe15=_0x23ef13[_0x0578('0x90')];var _0x37e6b7=config['root']+_0x0578('0x91')+_0x23ef13['id']+_0x0578('0x92');if(fs[_0x0578('0x49')](_0x37e6b7)){return _0x37e6b7;}return writeFile(_0x5abe15,_0x37e6b7)[_0x0578('0x1d')](function(){return _0x37e6b7;});}else{throw new db[(_0x0578('0x4d'))][(_0x0578('0x4e'))](_0x0578('0x93'));}})['then'](function(_0x1220ca){return _0x55170f[_0x0578('0x53')](_0x1220ca);})[_0x0578('0x41')](handleError(_0x55170f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 886bf38..12da231 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 _0xaf79=['define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xaf79,0xe4));var _0x9af7=function(_0x4c04ba,_0xa9637c){_0x4c04ba=_0x4c04ba-0x0;var _0x2b835e=_0xaf79[_0x4c04ba];return _0x2b835e;};'use strict';var _=require(_0x9af7('0x0'));var util=require(_0x9af7('0x1'));var logger=require(_0x9af7('0x2'))(_0x9af7('0x3'));var moment=require(_0x9af7('0x4'));var BPromise=require(_0x9af7('0x5'));var rp=require(_0x9af7('0x6'));var fs=require('fs');var path=require(_0x9af7('0x7'));var rimraf=require(_0x9af7('0x8'));var config=require(_0x9af7('0x9'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x598b25,_0x293823){return _0x598b25[_0x9af7('0xa')](_0x9af7('0xb'),attributes,{'tableName':_0x9af7('0xc'),'paranoid':![],'indexes':[{'name':_0x9af7('0xd'),'fields':[_0x9af7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2b=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','./voiceRecording.attributes','exports','define'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xfa2b,0x1cd));var _0xbfa2=function(_0x1f836d,_0x1fcf18){_0x1f836d=_0x1f836d-0x0;var _0x3434f8=_0xfa2b[_0x1f836d];return _0x3434f8;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));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(_0xbfa2('0x6'));module[_0xbfa2('0x7')]=function(_0x4d19d4,_0x5f54dd){return _0x4d19d4[_0xbfa2('0x8')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xbfa2('0x9'),'fields':[_0xbfa2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c1e166f..c33d3fa 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x375b8f,_0x1b25de){var _0x2f9999=function(_0x52dd00){while(--_0x52dd00){_0x375b8f['push'](_0x375b8f['shift']());}};_0x2f9999(++_0x1b25de);}(_0x1623,0xab));var _0x3162=function(_0x3b0fb3,_0x111b46){_0x3b0fb3=_0x3b0fb3-0x0;var _0x1f0bd1=_0x1623[_0x3b0fb3];return _0x1f0bd1;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x1a')]?_0x1eed46['options']['attributes']||null:null,'limit':_0x1eed46[_0x3162('0x1a')]?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1c')]||null:null})[_0x3162('0xa')](function(_0x31b27b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('UpdateVoiceRecording',_0x1eed46,JSON[_0x3162('0xf')](_0x31b27b));_0x4b2bf3(_0x31b27b);})[_0x3162('0x15')](function(_0x3919e7){logger[_0x3162('0x10')](_0x3162('0x16'),_0x3919e7[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x3919e7[_0x3162('0x13')]));});});};exports[_0x3162('0x1d')]=function(_0x356c5d){var _0x8fa09f=this;return new Promise(function(_0x2f62d7,_0x1c03a4){var _0x48de45=require(_0x3162('0x1e'));var _0x552469;return db[_0x3162('0x1f')][_0x3162('0x20')]({'attributes':['id',_0x3162('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x4903e7){_0x552469=_0x4903e7;return db[_0x3162('0x17')][_0x3162('0x22')](_0x356c5d[_0x3162('0x19')]);})[_0x3162('0xa')](function(_0x2f88ec){if(_0x552469['callRecordingEncryption']&&fs[_0x3162('0x23')](_0x2f88ec['value'])){var _0xf11765=util[_0x3162('0x24')](_0x3162('0x25'),_0x2f88ec[_0x3162('0x26')]);return _0x48de45[_0x3162('0x27')](_0x2f88ec[_0x3162('0x26')],_0xf11765,config[_0x3162('0x28')][_0x3162('0x29')])['then'](function(){fs[_0x3162('0x2a')](_0x2f88ec[_0x3162('0x26')]);logger['info'](_0x3162('0x2b'));return _0x2f88ec;});}return _0x2f88ec;})[_0x3162('0xa')](function(_0x528340){logger['info'](_0x3162('0x1d'),_0x356c5d);logger['debug'](_0x3162('0x1d'),_0x356c5d,JSON[_0x3162('0xf')](_0x528340));_0x2f62d7(_0x528340);})[_0x3162('0x15')](function(_0x551442){logger['error'](_0x3162('0x1d'),_0x551442[_0x3162('0x13')],_0x356c5d);_0x1c03a4(_0x8fa09f['error'](0x1f4,_0x551442[_0x3162('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','options','raw','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','value','format','%s.cypher'];(function(_0x3a937d,_0x10d5fd){var _0x2211fb=function(_0x22d179){while(--_0x22d179){_0x3a937d['push'](_0x3a937d['shift']());}};_0x2211fb(++_0x10d5fd);}(_0xadb5,0xad));var _0x5adb=function(_0x427a89,_0x4fa309){_0x427a89=_0x427a89-0x0;var _0x32f591=_0xadb5[_0x427a89];return _0x32f591;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['VoiceRecording'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529b65[_0x5adb('0x17')]?_0x529b65[_0x5adb('0x17')][_0x5adb('0x19')]||null:null,'attributes':_0x529b65['options']?_0x529b65[_0x5adb('0x17')]['attributes']||null:null,'limit':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x1a')]||null:null})[_0x5adb('0xb')](function(_0x1a8014){logger[_0x5adb('0xc')](_0x5adb('0x15'),_0x529b65);logger[_0x5adb('0x1b')]('UpdateVoiceRecording',_0x529b65,JSON[_0x5adb('0xf')](_0x1a8014));_0x5de028(_0x1a8014);})[_0x5adb('0x14')](function(_0x3220cd){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x3220cd['message'],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x3220cd[_0x5adb('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x1feecf){var _0x1ded9f=this;return new Promise(function(_0x1a0acd,_0x55b40a){var _0x13ad1d=require(_0x5adb('0x1c'));var _0x3a4fca;return db[_0x5adb('0x1d')][_0x5adb('0x1e')]({'attributes':['id',_0x5adb('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x49992e){_0x3a4fca=_0x49992e;return db['VoiceRecording'][_0x5adb('0x20')](_0x1feecf[_0x5adb('0x21')]);})[_0x5adb('0xb')](function(_0x512bab){if(_0x3a4fca[_0x5adb('0x1f')]&&fs['existsSync'](_0x512bab[_0x5adb('0x22')])){var _0x34b793=util[_0x5adb('0x23')](_0x5adb('0x24'),_0x512bab[_0x5adb('0x22')]);return _0x13ad1d[_0x5adb('0x25')](_0x512bab[_0x5adb('0x22')],_0x34b793,config[_0x5adb('0x26')][_0x5adb('0x27')])[_0x5adb('0xb')](function(){fs['unlink'](_0x512bab[_0x5adb('0x22')]);logger['info'](_0x5adb('0x28'));return _0x512bab;});}return _0x512bab;})[_0x5adb('0xb')](function(_0x5d1441){logger[_0x5adb('0xc')](_0x5adb('0x29'),_0x1feecf);logger[_0x5adb('0x1b')]('CreateVoiceRecording',_0x1feecf,JSON[_0x5adb('0xf')](_0x5d1441));_0x1a0acd(_0x5d1441);})[_0x5adb('0x14')](function(_0x4b5887){logger['error'](_0x5adb('0x29'),_0x4b5887['message'],_0x1feecf);_0x55b40a(_0x1ded9f[_0x5adb('0x10')](0x1f4,_0x4b5887[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 192f98c..008951d 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 _0xeefd=['create','/:id','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0xa892a2,_0x1f0819){var _0x4d4b2c=function(_0x4dc0f1){while(--_0x4dc0f1){_0xa892a2['push'](_0xa892a2['shift']());}};_0x4d4b2c(++_0x1f0819);}(_0xeefd,0x1cc));var _0xdeef=function(_0x548cec,_0x636a64){_0x548cec=_0x548cec-0x0;var _0x3156d4=_0xeefd[_0x548cec];return _0x3156d4;};'use strict';var multer=require(_0xdeef('0x0'));var util=require(_0xdeef('0x1'));var path=require(_0xdeef('0x2'));var timeout=require(_0xdeef('0x3'));var express=require(_0xdeef('0x4'));var router=express['Router']();var fs_extra=require(_0xdeef('0x5'));var auth=require(_0xdeef('0x6'));var interaction=require(_0xdeef('0x7'));var config=require('../../config/environment');var controller=require(_0xdeef('0x8'));router[_0xdeef('0x9')]('/',auth[_0xdeef('0xa')](),controller[_0xdeef('0xb')]);router['get'](_0xdeef('0xc'),auth[_0xdeef('0xa')](),controller[_0xdeef('0xd')]);router[_0xdeef('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdeef('0xe')]('/',auth[_0xdeef('0xa')](),controller[_0xdeef('0xf')]);router['put'](_0xdeef('0x10'),auth[_0xdeef('0xa')](),controller[_0xdeef('0x11')]);router['delete'](_0xdeef('0x10'),auth['isAuthenticated'](),controller[_0xdeef('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9ced=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index','/describe','get','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x48437d,_0x326d82){var _0x200808=function(_0x50d749){while(--_0x50d749){_0x48437d['push'](_0x48437d['shift']());}};_0x200808(++_0x326d82);}(_0x9ced,0x8d));var _0xd9ce=function(_0xf0d35,_0xce9c1c){_0xf0d35=_0xf0d35-0x0;var _0x5ba3bc=_0x9ced[_0xf0d35];return _0x5ba3bc;};'use strict';var multer=require(_0xd9ce('0x0'));var util=require('util');var path=require(_0xd9ce('0x1'));var timeout=require(_0xd9ce('0x2'));var express=require(_0xd9ce('0x3'));var router=express[_0xd9ce('0x4')]();var fs_extra=require(_0xd9ce('0x5'));var auth=require(_0xd9ce('0x6'));var interaction=require(_0xd9ce('0x7'));var config=require('../../config/environment');var controller=require(_0xd9ce('0x8'));router['get']('/',auth[_0xd9ce('0x9')](),controller[_0xd9ce('0xa')]);router['get'](_0xd9ce('0xb'),auth[_0xd9ce('0x9')](),controller['describe']);router[_0xd9ce('0xc')](_0xd9ce('0xd'),auth[_0xd9ce('0x9')](),controller['show']);router[_0xd9ce('0xe')]('/',auth[_0xd9ce('0x9')](),controller[_0xd9ce('0xf')]);router[_0xd9ce('0x10')](_0xd9ce('0xd'),auth['isAuthenticated'](),controller[_0xd9ce('0x11')]);router[_0xd9ce('0x12')](_0xd9ce('0xd'),auth[_0xd9ce('0x9')](),controller[_0xd9ce('0x13')]);module[_0xd9ce('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 908c06d..0cf991d 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 _0x29b5=['moment','exports','ENUM','attended','STRING','Yes','sequelize'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x29b5,0x1cd));var _0x529b=function(_0x5c4918,_0x367428){_0x5c4918=_0x5c4918-0x0;var _0x2399a5=_0x29b5[_0x5c4918];return _0x2399a5;};'use strict';var Sequelize=require(_0x529b('0x0'));var moment=require(_0x529b('0x1'));module[_0x529b('0x2')]={'type':{'type':Sequelize[_0x529b('0x3')]('blind',_0x529b('0x4'))},'result':{'type':Sequelize[_0x529b('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x529b('0x5')]},'transferercalleridname':{'type':Sequelize[_0x529b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x529b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x529b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x529b('0x5')]},'transferercontext':{'type':Sequelize[_0x529b('0x5')]},'transfererexten':{'type':Sequelize[_0x529b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x529b('0x5')]},'transfereechannel':{'type':Sequelize[_0x529b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x529b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x529b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x529b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x529b('0x5')]},'transfereecontext':{'type':Sequelize[_0x529b('0x5')]},'transfereeexten':{'type':Sequelize[_0x529b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x529b('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x529b('0x6'),'No')},'context':{'type':Sequelize[_0x529b('0x5')]},'extension':{'type':Sequelize[_0x529b('0x5')]}}; \ No newline at end of file +var _0xa8dd=['attended','STRING','sequelize','ENUM'];(function(_0x16abe5,_0x271d69){var _0x558d3d=function(_0x8866d){while(--_0x8866d){_0x16abe5['push'](_0x16abe5['shift']());}};_0x558d3d(++_0x271d69);}(_0xa8dd,0x13a));var _0xda8d=function(_0x2e8c7e,_0x28648a){_0x2e8c7e=_0x2e8c7e-0x0;var _0x48fded=_0xa8dd[_0x2e8c7e];return _0x48fded;};'use strict';var Sequelize=require(_0xda8d('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xda8d('0x1')]('blind',_0xda8d('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xda8d('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xda8d('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xda8d('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xda8d('0x3')]},'transferercontext':{'type':Sequelize[_0xda8d('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xda8d('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xda8d('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xda8d('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xda8d('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xda8d('0x3')]},'transfereecontext':{'type':Sequelize[_0xda8d('0x3')]},'transfereeexten':{'type':Sequelize[_0xda8d('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xda8d('0x3')]},'extension':{'type':Sequelize[_0xda8d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8080f33..e5a6071 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 _0xb3d7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','intersection','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x538a20,_0x5c14d6){var _0xec72f5=function(_0x582321){while(--_0x582321){_0x538a20['push'](_0x538a20['shift']());}};_0xec72f5(++_0x5c14d6);}(_0xb3d7,0x169));var _0x7b3d=function(_0x35627a,_0x3bd1e5){_0x35627a=_0x35627a-0x0;var _0x404973=_0xb3d7[_0x35627a];return _0x404973;};'use strict';var emlformat=require(_0x7b3d('0x0'));var rimraf=require(_0x7b3d('0x1'));var zipdir=require(_0x7b3d('0x2'));var jsonpatch=require(_0x7b3d('0x3'));var rp=require(_0x7b3d('0x4'));var moment=require(_0x7b3d('0x5'));var BPromise=require(_0x7b3d('0x6'));var Mustache=require(_0x7b3d('0x7'));var util=require(_0x7b3d('0x8'));var path=require('path');var sox=require(_0x7b3d('0x9'));var csv=require(_0x7b3d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b3d('0xb'));var squel=require('squel');var crypto=require(_0x7b3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b3d('0xd'));var toCsv=require(_0x7b3d('0xa'));var querystring=require(_0x7b3d('0xe'));var Papa=require(_0x7b3d('0xf'));var Redis=require(_0x7b3d('0x10'));var authService=require(_0x7b3d('0x11'));var qs=require(_0x7b3d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b3d('0x13'))(_0x7b3d('0x14'));var utils=require(_0x7b3d('0x15'));var config=require(_0x7b3d('0x16'));var licenseUtil=require(_0x7b3d('0x17'));var db=require(_0x7b3d('0x18'))['db'];function respondWithStatusCode(_0x1da7d5,_0x18944d){_0x18944d=_0x18944d||0xcc;return function(_0x525786){if(_0x525786){return _0x1da7d5[_0x7b3d('0x19')](_0x18944d);}return _0x1da7d5[_0x7b3d('0x1a')](_0x18944d)[_0x7b3d('0x1b')]();};}function respondWithResult(_0xb8ac21,_0x47ba32){_0x47ba32=_0x47ba32||0xc8;return function(_0x4d399c){if(_0x4d399c){return _0xb8ac21[_0x7b3d('0x1a')](_0x47ba32)['json'](_0x4d399c);}};}function respondWithFilteredResult(_0x5de52a,_0xfcd6c2){return function(_0x991c61){if(_0x991c61){var _0x53d093=typeof _0xfcd6c2[_0x7b3d('0x1c')]===_0x7b3d('0x1d')&&typeof _0xfcd6c2[_0x7b3d('0x1e')]===_0x7b3d('0x1d');var _0x4b3790=_0x991c61[_0x7b3d('0x1f')];var _0x575498=_0x53d093?0x0:_0xfcd6c2[_0x7b3d('0x1c')];var _0x48854b=_0x53d093?_0x991c61[_0x7b3d('0x1f')]:_0xfcd6c2['offset']+_0xfcd6c2[_0x7b3d('0x1e')];var _0x962055;if(_0x48854b>=_0x4b3790){_0x48854b=_0x4b3790;_0x962055=0xc8;}else{_0x962055=0xce;}_0x5de52a[_0x7b3d('0x1a')](_0x962055);return _0x5de52a[_0x7b3d('0x20')]('Content-Range',_0x575498+'-'+_0x48854b+'/'+_0x4b3790)[_0x7b3d('0x21')](_0x991c61);}return null;};}function patchUpdates(_0x44ffe4){return function(_0x48212c){try{jsonpatch[_0x7b3d('0x22')](_0x48212c,_0x44ffe4,!![]);}catch(_0xae7b31){return BPromise[_0x7b3d('0x23')](_0xae7b31);}return _0x48212c[_0x7b3d('0x24')]();};}function saveUpdates(_0x248e28,_0x471f71){return function(_0x965628){if(_0x965628){return _0x965628[_0x7b3d('0x25')](_0x248e28)['then'](function(_0x2828f6){return _0x2828f6;});}return null;};}function removeEntity(_0x52b1bc,_0x4bb9b8){return function(_0x4ae79e){if(_0x4ae79e){return _0x4ae79e[_0x7b3d('0x26')]()[_0x7b3d('0x27')](function(){_0x52b1bc[_0x7b3d('0x1a')](0xcc)[_0x7b3d('0x1b')]();});}};}function handleEntityNotFound(_0x10c5ab,_0x3f2c0e){return function(_0x1af287){if(!_0x1af287){_0x10c5ab[_0x7b3d('0x19')](0x194);}return _0x1af287;};}function handleError(_0x1afab4,_0x2b3c71){_0x2b3c71=_0x2b3c71||0x1f4;return function(_0x2daa8b){logger['error'](_0x2daa8b[_0x7b3d('0x28')]);if(_0x2daa8b[_0x7b3d('0x29')]){delete _0x2daa8b['name'];}_0x1afab4[_0x7b3d('0x1a')](_0x2b3c71)[_0x7b3d('0x2a')](_0x2daa8b);};}exports[_0x7b3d('0x2b')]=function(_0x3b7a3d,_0x15e80c){var _0x3e3ee3={},_0x3ecbd1={},_0x21fa36={'count':0x0,'rows':[]};var _0x4b9fe3=_[_0x7b3d('0x2c')](db[_0x7b3d('0x2d')][_0x7b3d('0x2e')],function(_0x45cd10){return{'name':_0x45cd10[_0x7b3d('0x2f')],'type':_0x45cd10[_0x7b3d('0x30')]['key']};});_0x3ecbd1[_0x7b3d('0x31')]=_[_0x7b3d('0x2c')](_0x4b9fe3,_0x7b3d('0x29'));_0x3ecbd1[_0x7b3d('0x32')]=_[_0x7b3d('0x33')](_0x3b7a3d['query']);_0x3ecbd1[_0x7b3d('0x34')]=_['intersection'](_0x3ecbd1[_0x7b3d('0x31')],_0x3ecbd1[_0x7b3d('0x32')]);_0x3e3ee3[_0x7b3d('0x35')]=_['intersection'](_0x3ecbd1['model'],qs[_0x7b3d('0x36')](_0x3b7a3d[_0x7b3d('0x32')][_0x7b3d('0x36')]));_0x3e3ee3['attributes']=_0x3e3ee3[_0x7b3d('0x35')][_0x7b3d('0x37')]?_0x3e3ee3[_0x7b3d('0x35')]:_0x3ecbd1['model'];if(!_0x3b7a3d[_0x7b3d('0x32')][_0x7b3d('0x38')](_0x7b3d('0x39'))){_0x3e3ee3[_0x7b3d('0x1e')]=qs[_0x7b3d('0x1e')](_0x3b7a3d[_0x7b3d('0x32')][_0x7b3d('0x1e')]);_0x3e3ee3['offset']=qs[_0x7b3d('0x1c')](_0x3b7a3d[_0x7b3d('0x32')][_0x7b3d('0x1c')]);}_0x3e3ee3[_0x7b3d('0x3a')]=qs[_0x7b3d('0x3b')](_0x3b7a3d['query'][_0x7b3d('0x3b')]);_0x3e3ee3[_0x7b3d('0x3c')]=qs[_0x7b3d('0x34')](_['pick'](_0x3b7a3d['query'],_0x3ecbd1[_0x7b3d('0x34')]),_0x4b9fe3);if(_0x3b7a3d[_0x7b3d('0x32')][_0x7b3d('0x3d')]){_0x3e3ee3['where']=_[_0x7b3d('0x3e')](_0x3e3ee3[_0x7b3d('0x3c')],{'$or':_[_0x7b3d('0x2c')](_0x4b9fe3,function(_0x8b17d1){if(_0x8b17d1[_0x7b3d('0x30')]!==_0x7b3d('0x3f')){var _0x49d4ac={};_0x49d4ac[_0x8b17d1['name']]={'$like':'%'+_0x3b7a3d[_0x7b3d('0x32')][_0x7b3d('0x3d')]+'%'};return _0x49d4ac;}})});}_0x3e3ee3=_['merge']({},_0x3e3ee3,_0x3b7a3d[_0x7b3d('0x40')]);var _0x45ce38={'where':_0x3e3ee3['where']};return db['VoiceTransferReport'][_0x7b3d('0x1f')](_0x45ce38)[_0x7b3d('0x27')](function(_0x3b03d7){_0x21fa36[_0x7b3d('0x1f')]=_0x3b03d7;if(_0x3b7a3d[_0x7b3d('0x32')]['includeAll']){_0x3e3ee3[_0x7b3d('0x41')]=[{'all':!![]}];}return db[_0x7b3d('0x2d')][_0x7b3d('0x42')](_0x3e3ee3);})[_0x7b3d('0x27')](function(_0x2980ad){_0x21fa36[_0x7b3d('0x43')]=_0x2980ad;return _0x21fa36;})[_0x7b3d('0x27')](respondWithFilteredResult(_0x15e80c,_0x3e3ee3))[_0x7b3d('0x44')](handleError(_0x15e80c,null));};exports[_0x7b3d('0x45')]=function(_0x1a9c1f,_0x3531f8){var _0xb71871={'raw':!![],'where':{'id':_0x1a9c1f['params']['id']}},_0x3d0d9d={};_0x3d0d9d[_0x7b3d('0x31')]=_['keys'](db[_0x7b3d('0x2d')][_0x7b3d('0x2e')]);_0x3d0d9d[_0x7b3d('0x32')]=_[_0x7b3d('0x33')](_0x1a9c1f[_0x7b3d('0x32')]);_0x3d0d9d[_0x7b3d('0x34')]=_[_0x7b3d('0x46')](_0x3d0d9d[_0x7b3d('0x31')],_0x3d0d9d['query']);_0xb71871[_0x7b3d('0x35')]=_['intersection'](_0x3d0d9d[_0x7b3d('0x31')],qs['fields'](_0x1a9c1f[_0x7b3d('0x32')][_0x7b3d('0x36')]));_0xb71871[_0x7b3d('0x35')]=_0xb71871[_0x7b3d('0x35')]['length']?_0xb71871['attributes']:_0x3d0d9d[_0x7b3d('0x31')];if(_0x1a9c1f[_0x7b3d('0x32')]['includeAll']){_0xb71871[_0x7b3d('0x41')]=[{'all':!![]}];}_0xb71871=_[_0x7b3d('0x3e')]({},_0xb71871,_0x1a9c1f[_0x7b3d('0x40')]);return db[_0x7b3d('0x2d')][_0x7b3d('0x47')](_0xb71871)[_0x7b3d('0x27')](handleEntityNotFound(_0x3531f8,null))[_0x7b3d('0x27')](respondWithResult(_0x3531f8,null))['catch'](handleError(_0x3531f8,null));};exports[_0x7b3d('0x48')]=function(_0x5a79d4,_0x2901da){return db[_0x7b3d('0x2d')][_0x7b3d('0x48')](_0x5a79d4['body'],{})[_0x7b3d('0x27')](respondWithResult(_0x2901da,0xc9))[_0x7b3d('0x44')](handleError(_0x2901da,null));};exports[_0x7b3d('0x25')]=function(_0x5b6a48,_0x2f7133){if(_0x5b6a48[_0x7b3d('0x49')]['id']){delete _0x5b6a48[_0x7b3d('0x49')]['id'];}return db['VoiceTransferReport'][_0x7b3d('0x47')]({'where':{'id':_0x5b6a48[_0x7b3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2f7133,null))[_0x7b3d('0x27')](saveUpdates(_0x5b6a48[_0x7b3d('0x49')],null))[_0x7b3d('0x27')](respondWithResult(_0x2f7133,null))[_0x7b3d('0x44')](handleError(_0x2f7133,null));};exports[_0x7b3d('0x26')]=function(_0xd0b17b,_0x4130dd){return db[_0x7b3d('0x2d')][_0x7b3d('0x47')]({'where':{'id':_0xd0b17b[_0x7b3d('0x4a')]['id']}})[_0x7b3d('0x27')](handleEntityNotFound(_0x4130dd,null))[_0x7b3d('0x27')](removeEntity(_0x4130dd,null))[_0x7b3d('0x44')](handleError(_0x4130dd,null));};exports[_0x7b3d('0x4b')]=function(_0x5235e1,_0x3dc620){return db[_0x7b3d('0x2d')][_0x7b3d('0x4b')]()['then'](respondWithResult(_0x3dc620,null))[_0x7b3d('0x44')](handleError(_0x3dc620,null));}; \ No newline at end of file +var _0xb21a=['fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','intersection','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','map','VoiceTransferReport'];(function(_0x411437,_0x42f561){var _0x290fce=function(_0x369935){while(--_0x369935){_0x411437['push'](_0x411437['shift']());}};_0x290fce(++_0x42f561);}(_0xb21a,0x14a));var _0xab21=function(_0x5629fd,_0x555807){_0x5629fd=_0x5629fd-0x0;var _0x201b8a=_0xb21a[_0x5629fd];return _0x201b8a;};'use strict';var emlformat=require(_0xab21('0x0'));var rimraf=require(_0xab21('0x1'));var zipdir=require(_0xab21('0x2'));var jsonpatch=require(_0xab21('0x3'));var rp=require(_0xab21('0x4'));var moment=require('moment');var BPromise=require(_0xab21('0x5'));var Mustache=require(_0xab21('0x6'));var util=require(_0xab21('0x7'));var path=require(_0xab21('0x8'));var sox=require(_0xab21('0x9'));var csv=require(_0xab21('0xa'));var ejs=require(_0xab21('0xb'));var fs=require('fs');var fs_extra=require(_0xab21('0xc'));var _=require(_0xab21('0xd'));var squel=require(_0xab21('0xe'));var crypto=require('crypto');var jsforce=require(_0xab21('0xf'));var deskjs=require(_0xab21('0x10'));var toCsv=require(_0xab21('0xa'));var querystring=require('querystring');var Papa=require(_0xab21('0x11'));var Redis=require('ioredis');var authService=require(_0xab21('0x12'));var qs=require(_0xab21('0x13'));var as=require(_0xab21('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab21('0x15'))(_0xab21('0x16'));var utils=require(_0xab21('0x17'));var config=require(_0xab21('0x18'));var licenseUtil=require(_0xab21('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422029,_0x1d5ac3){_0x1d5ac3=_0x1d5ac3||0xcc;return function(_0x362bb6){if(_0x362bb6){return _0x422029[_0xab21('0x1a')](_0x1d5ac3);}return _0x422029['status'](_0x1d5ac3)[_0xab21('0x1b')]();};}function respondWithResult(_0x247a00,_0x290db9){_0x290db9=_0x290db9||0xc8;return function(_0x29511a){if(_0x29511a){return _0x247a00[_0xab21('0x1c')](_0x290db9)[_0xab21('0x1d')](_0x29511a);}};}function respondWithFilteredResult(_0x14b00d,_0x5ead93){return function(_0x3e27d0){if(_0x3e27d0){var _0x14d868=typeof _0x5ead93['offset']===_0xab21('0x1e')&&typeof _0x5ead93[_0xab21('0x1f')]===_0xab21('0x1e');var _0x39c58f=_0x3e27d0[_0xab21('0x20')];var _0x5a95b3=_0x14d868?0x0:_0x5ead93['offset'];var _0x43666b=_0x14d868?_0x3e27d0[_0xab21('0x20')]:_0x5ead93[_0xab21('0x21')]+_0x5ead93[_0xab21('0x1f')];var _0x517118;if(_0x43666b>=_0x39c58f){_0x43666b=_0x39c58f;_0x517118=0xc8;}else{_0x517118=0xce;}_0x14b00d['status'](_0x517118);return _0x14b00d[_0xab21('0x22')]('Content-Range',_0x5a95b3+'-'+_0x43666b+'/'+_0x39c58f)[_0xab21('0x1d')](_0x3e27d0);}return null;};}function patchUpdates(_0x3a5886){return function(_0x429e76){try{jsonpatch[_0xab21('0x23')](_0x429e76,_0x3a5886,!![]);}catch(_0x29fb5e){return BPromise[_0xab21('0x24')](_0x29fb5e);}return _0x429e76['save']();};}function saveUpdates(_0x4cd59a,_0x243067){return function(_0x2c360f){if(_0x2c360f){return _0x2c360f[_0xab21('0x25')](_0x4cd59a)[_0xab21('0x26')](function(_0x337abe){return _0x337abe;});}return null;};}function removeEntity(_0x355b9d,_0x177e53){return function(_0x46b5aa){if(_0x46b5aa){return _0x46b5aa[_0xab21('0x27')]()[_0xab21('0x26')](function(){_0x355b9d['status'](0xcc)[_0xab21('0x1b')]();});}};}function handleEntityNotFound(_0x519311,_0x15222f){return function(_0x4c4599){if(!_0x4c4599){_0x519311[_0xab21('0x1a')](0x194);}return _0x4c4599;};}function handleError(_0x5e90c8,_0x1387a1){_0x1387a1=_0x1387a1||0x1f4;return function(_0x22d049){logger[_0xab21('0x28')](_0x22d049[_0xab21('0x29')]);if(_0x22d049[_0xab21('0x2a')]){delete _0x22d049[_0xab21('0x2a')];}_0x5e90c8[_0xab21('0x1c')](_0x1387a1)['send'](_0x22d049);};}exports['index']=function(_0x44e473,_0x4fe0f4){var _0x1947b9={},_0x56d4af={},_0x5be068={'count':0x0,'rows':[]};var _0x368892=_[_0xab21('0x2b')](db[_0xab21('0x2c')]['rawAttributes'],function(_0x328bec){return{'name':_0x328bec[_0xab21('0x2d')],'type':_0x328bec['type'][_0xab21('0x2e')]};});_0x56d4af[_0xab21('0x2f')]=_[_0xab21('0x2b')](_0x368892,_0xab21('0x2a'));_0x56d4af[_0xab21('0x30')]=_[_0xab21('0x31')](_0x44e473[_0xab21('0x30')]);_0x56d4af[_0xab21('0x32')]=_['intersection'](_0x56d4af[_0xab21('0x2f')],_0x56d4af[_0xab21('0x30')]);_0x1947b9[_0xab21('0x33')]=_['intersection'](_0x56d4af[_0xab21('0x2f')],qs[_0xab21('0x34')](_0x44e473[_0xab21('0x30')][_0xab21('0x34')]));_0x1947b9[_0xab21('0x33')]=_0x1947b9['attributes'][_0xab21('0x35')]?_0x1947b9[_0xab21('0x33')]:_0x56d4af['model'];if(!_0x44e473[_0xab21('0x30')][_0xab21('0x36')](_0xab21('0x37'))){_0x1947b9[_0xab21('0x1f')]=qs[_0xab21('0x1f')](_0x44e473[_0xab21('0x30')][_0xab21('0x1f')]);_0x1947b9[_0xab21('0x21')]=qs[_0xab21('0x21')](_0x44e473[_0xab21('0x30')][_0xab21('0x21')]);}_0x1947b9['order']=qs[_0xab21('0x38')](_0x44e473[_0xab21('0x30')][_0xab21('0x38')]);_0x1947b9[_0xab21('0x39')]=qs['filters'](_[_0xab21('0x3a')](_0x44e473[_0xab21('0x30')],_0x56d4af[_0xab21('0x32')]),_0x368892);if(_0x44e473[_0xab21('0x30')]['filter']){_0x1947b9[_0xab21('0x39')]=_[_0xab21('0x3b')](_0x1947b9[_0xab21('0x39')],{'$or':_[_0xab21('0x2b')](_0x368892,function(_0x572501){if(_0x572501['type']!==_0xab21('0x3c')){var _0x549951={};_0x549951[_0x572501[_0xab21('0x2a')]]={'$like':'%'+_0x44e473[_0xab21('0x30')][_0xab21('0x3d')]+'%'};return _0x549951;}})});}_0x1947b9=_['merge']({},_0x1947b9,_0x44e473[_0xab21('0x3e')]);var _0x5cedb2={'where':_0x1947b9[_0xab21('0x39')]};return db[_0xab21('0x2c')][_0xab21('0x20')](_0x5cedb2)[_0xab21('0x26')](function(_0x319221){_0x5be068[_0xab21('0x20')]=_0x319221;if(_0x44e473[_0xab21('0x30')][_0xab21('0x3f')]){_0x1947b9[_0xab21('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x1947b9);})[_0xab21('0x26')](function(_0x3c7e3a){_0x5be068[_0xab21('0x41')]=_0x3c7e3a;return _0x5be068;})[_0xab21('0x26')](respondWithFilteredResult(_0x4fe0f4,_0x1947b9))['catch'](handleError(_0x4fe0f4,null));};exports[_0xab21('0x42')]=function(_0x362691,_0x199ebf){var _0x4087fe={'raw':!![],'where':{'id':_0x362691[_0xab21('0x43')]['id']}},_0x2386fd={};_0x2386fd[_0xab21('0x2f')]=_[_0xab21('0x31')](db[_0xab21('0x2c')][_0xab21('0x44')]);_0x2386fd['query']=_[_0xab21('0x31')](_0x362691[_0xab21('0x30')]);_0x2386fd[_0xab21('0x32')]=_[_0xab21('0x45')](_0x2386fd[_0xab21('0x2f')],_0x2386fd[_0xab21('0x30')]);_0x4087fe['attributes']=_[_0xab21('0x45')](_0x2386fd['model'],qs[_0xab21('0x34')](_0x362691[_0xab21('0x30')][_0xab21('0x34')]));_0x4087fe[_0xab21('0x33')]=_0x4087fe[_0xab21('0x33')]['length']?_0x4087fe[_0xab21('0x33')]:_0x2386fd[_0xab21('0x2f')];if(_0x362691[_0xab21('0x30')]['includeAll']){_0x4087fe[_0xab21('0x40')]=[{'all':!![]}];}_0x4087fe=_['merge']({},_0x4087fe,_0x362691['options']);return db[_0xab21('0x2c')][_0xab21('0x46')](_0x4087fe)['then'](handleEntityNotFound(_0x199ebf,null))[_0xab21('0x26')](respondWithResult(_0x199ebf,null))[_0xab21('0x47')](handleError(_0x199ebf,null));};exports['create']=function(_0x8a1548,_0x2147f4){return db[_0xab21('0x2c')][_0xab21('0x48')](_0x8a1548[_0xab21('0x49')],{})[_0xab21('0x26')](respondWithResult(_0x2147f4,0xc9))['catch'](handleError(_0x2147f4,null));};exports['update']=function(_0xe36a87,_0x7dc46e){if(_0xe36a87[_0xab21('0x49')]['id']){delete _0xe36a87[_0xab21('0x49')]['id'];}return db[_0xab21('0x2c')]['find']({'where':{'id':_0xe36a87[_0xab21('0x43')]['id']}})[_0xab21('0x26')](handleEntityNotFound(_0x7dc46e,null))[_0xab21('0x26')](saveUpdates(_0xe36a87['body'],null))[_0xab21('0x26')](respondWithResult(_0x7dc46e,null))['catch'](handleError(_0x7dc46e,null));};exports['destroy']=function(_0x18116c,_0x470758){return db[_0xab21('0x2c')][_0xab21('0x46')]({'where':{'id':_0x18116c[_0xab21('0x43')]['id']}})[_0xab21('0x26')](handleEntityNotFound(_0x470758,null))['then'](removeEntity(_0x470758,null))[_0xab21('0x47')](handleError(_0x470758,null));};exports[_0xab21('0x4a')]=function(_0x2f0967,_0x4f156d){return db[_0xab21('0x2c')][_0xab21('0x4a')]()[_0xab21('0x26')](respondWithResult(_0x4f156d,null))[_0xab21('0x47')](handleError(_0x4f156d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 800b076..64ccc57 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 _0xdcd2=['exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x314af0,_0x1914a4){var _0x5db6eb=function(_0x4d5a94){while(--_0x4d5a94){_0x314af0['push'](_0x314af0['shift']());}};_0x5db6eb(++_0x1914a4);}(_0xdcd2,0x184));var _0x2dcd=function(_0x9b4231,_0x2fa7f5){_0x9b4231=_0x9b4231-0x0;var _0x5e33c0=_0xdcd2[_0x9b4231];return _0x5e33c0;};'use strict';var _=require('lodash');var util=require(_0x2dcd('0x0'));var logger=require(_0x2dcd('0x1'))('api');var moment=require(_0x2dcd('0x2'));var BPromise=require('bluebird');var rp=require(_0x2dcd('0x3'));var fs=require('fs');var path=require(_0x2dcd('0x4'));var rimraf=require(_0x2dcd('0x5'));var config=require(_0x2dcd('0x6'));var attributes=require(_0x2dcd('0x7'));module[_0x2dcd('0x8')]=function(_0x3b9440,_0x2ba605){return _0x3b9440[_0x2dcd('0x9')](_0x2dcd('0xa'),attributes,{'tableName':_0x2dcd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc76c=['report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0xc76c,0x6d));var _0xcc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcc76('0x0'));var logger=require(_0xcc76('0x1'))(_0xcc76('0x2'));var moment=require(_0xcc76('0x3'));var BPromise=require(_0xcc76('0x4'));var rp=require(_0xcc76('0x5'));var fs=require('fs');var path=require(_0xcc76('0x6'));var rimraf=require(_0xcc76('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc76('0x8'));module[_0xcc76('0x9')]=function(_0x216ff5,_0x1e1434){return _0x216ff5[_0xcc76('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xcc76('0xb'),'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 f22185b..ffd7775 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 _0xb557=['request\x20sent','debug','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x5c8475,_0x106660){var _0x1a944d=function(_0x17f4f1){while(--_0x17f4f1){_0x5c8475['push'](_0x5c8475['shift']());}};_0x1a944d(++_0x106660);}(_0xb557,0x1a2));var _0x7b55=function(_0x5460c2,_0x26800c){_0x5460c2=_0x5460c2-0x0;var _0x4c7081=_0xb557[_0x5460c2];return _0x4c7081;};'use strict';var _=require('lodash');var util=require(_0x7b55('0x0'));var moment=require(_0x7b55('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b55('0x2'));var fs=require('fs');var Redis=require(_0x7b55('0x3'));var db=require(_0x7b55('0x4'))['db'];var utils=require(_0x7b55('0x5'));var logger=require(_0x7b55('0x6'))(_0x7b55('0x7'));var config=require(_0x7b55('0x8'));var jayson=require(_0x7b55('0x9'));var client=jayson['client'][_0x7b55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x117c38,_0x1e30b8,_0x5b5ee5){return new BPromise(function(_0x17d93b,_0x333325){return client[_0x7b55('0xb')](_0x117c38,_0x5b5ee5)[_0x7b55('0xc')](function(_0x421efa){logger[_0x7b55('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e30b8,_0x7b55('0xe'));logger[_0x7b55('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1e30b8,'request\x20sent',JSON['stringify'](_0x421efa));if(_0x421efa[_0x7b55('0x10')]){if(_0x421efa[_0x7b55('0x10')][_0x7b55('0x11')]===0x1f4){logger[_0x7b55('0x10')](_0x7b55('0x12'),_0x1e30b8,_0x421efa['error']['message']);return _0x333325(_0x421efa[_0x7b55('0x10')][_0x7b55('0x13')]);}logger['error'](_0x7b55('0x12'),_0x1e30b8,_0x421efa[_0x7b55('0x10')][_0x7b55('0x13')]);return _0x17d93b(_0x421efa[_0x7b55('0x10')][_0x7b55('0x13')]);}else{logger[_0x7b55('0xd')](_0x7b55('0x12'),_0x1e30b8,_0x7b55('0xe'));_0x17d93b(_0x421efa[_0x7b55('0x14')][_0x7b55('0x13')]);}})[_0x7b55('0x15')](function(_0x3e875a){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x1e30b8,_0x3e875a);_0x333325(_0x3e875a);});});}exports[_0x7b55('0x16')]=function(_0x57aea4){var _0x11799e=this;return new Promise(function(_0x8b0645,_0x30ac1e){return db[_0x7b55('0x17')]['create'](_0x57aea4[_0x7b55('0x18')],{'raw':_0x57aea4[_0x7b55('0x19')]?_0x57aea4[_0x7b55('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7b55('0xc')](function(_0x5978d1){logger[_0x7b55('0xd')](_0x7b55('0x16'),_0x57aea4);logger[_0x7b55('0xf')]('CreateVoiceTransferReport',_0x57aea4,JSON[_0x7b55('0x1a')](_0x5978d1));_0x8b0645(_0x5978d1);})['catch'](function(_0x4cbbdc){logger[_0x7b55('0x10')](_0x7b55('0x16'),_0x4cbbdc[_0x7b55('0x13')],_0x57aea4);_0x30ac1e(_0x11799e[_0x7b55('0x10')](0x1f4,_0x4cbbdc[_0x7b55('0x13')]));});});}; \ No newline at end of file +var _0x9557=['jayson/promise','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','info','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x490c6f,_0xe4b913){var _0x205aac=function(_0x4e04c4){while(--_0x4e04c4){_0x490c6f['push'](_0x490c6f['shift']());}};_0x205aac(++_0xe4b913);}(_0x9557,0x1b9));var _0x7955=function(_0x255ae9,_0x594c51){_0x255ae9=_0x255ae9-0x0;var _0xff59ba=_0x9557[_0x255ae9];return _0xff59ba;};'use strict';var _=require(_0x7955('0x0'));var util=require(_0x7955('0x1'));var moment=require('moment');var BPromise=require(_0x7955('0x2'));var rs=require(_0x7955('0x3'));var fs=require('fs');var Redis=require(_0x7955('0x4'));var db=require(_0x7955('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7955('0x6'))(_0x7955('0x7'));var config=require(_0x7955('0x8'));var jayson=require(_0x7955('0x9'));var client=jayson[_0x7955('0xa')][_0x7955('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x293908,_0x5ed273,_0x2a3eb5){return new BPromise(function(_0xeb597d,_0x50a05e){return client[_0x7955('0xc')](_0x293908,_0x2a3eb5)[_0x7955('0xd')](function(_0x3baf09){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5ed273,_0x7955('0xe'));logger[_0x7955('0xf')](_0x7955('0x10'),_0x5ed273,_0x7955('0xe'),JSON[_0x7955('0x11')](_0x3baf09));if(_0x3baf09[_0x7955('0x12')]){if(_0x3baf09[_0x7955('0x12')]['code']===0x1f4){logger[_0x7955('0x12')](_0x7955('0x13'),_0x5ed273,_0x3baf09[_0x7955('0x12')][_0x7955('0x14')]);return _0x50a05e(_0x3baf09[_0x7955('0x12')][_0x7955('0x14')]);}logger[_0x7955('0x12')](_0x7955('0x13'),_0x5ed273,_0x3baf09[_0x7955('0x12')][_0x7955('0x14')]);return _0xeb597d(_0x3baf09[_0x7955('0x12')][_0x7955('0x14')]);}else{logger[_0x7955('0x15')](_0x7955('0x13'),_0x5ed273,_0x7955('0xe'));_0xeb597d(_0x3baf09[_0x7955('0x16')][_0x7955('0x14')]);}})[_0x7955('0x17')](function(_0x40093e){logger[_0x7955('0x12')](_0x7955('0x13'),_0x5ed273,_0x40093e);_0x50a05e(_0x40093e);});});}exports['CreateVoiceTransferReport']=function(_0x2b54e8){var _0x1e70ae=this;return new Promise(function(_0x5e9c7f,_0x2087fe){return db[_0x7955('0x18')][_0x7955('0x19')](_0x2b54e8[_0x7955('0x1a')],{'raw':_0x2b54e8[_0x7955('0x1b')]?_0x2b54e8[_0x7955('0x1b')][_0x7955('0x1c')]===undefined?!![]:![]:!![]})[_0x7955('0xd')](function(_0x2300cb){logger[_0x7955('0x15')]('CreateVoiceTransferReport',_0x2b54e8);logger['debug'](_0x7955('0x1d'),_0x2b54e8,JSON['stringify'](_0x2300cb));_0x5e9c7f(_0x2300cb);})[_0x7955('0x17')](function(_0x1f937d){logger[_0x7955('0x12')](_0x7955('0x1d'),_0x1f937d['message'],_0x2b54e8);_0x2087fe(_0x1e70ae['error'](0x1f4,_0x1f937d[_0x7955('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 250afde..ba22789 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 _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x3683e0,_0x23f1db){var _0x3214ab=function(_0x6b9d8a){while(--_0x6b9d8a){_0x3683e0['push'](_0x3683e0['shift']());}};_0x3214ab(++_0x23f1db);}(_0x0bb5,0x148));var _0x50bb=function(_0x5341e3,_0x4cbdf5){_0x5341e3=_0x5341e3-0x0;var _0x327096=_0x0bb5[_0x5341e3];return _0x327096;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file +var _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0x1549c8,_0x510f91){var _0xdaa0d7=function(_0x95eed7){while(--_0x95eed7){_0x1549c8['push'](_0x1549c8['shift']());}};_0xdaa0d7(++_0x510f91);}(_0xe706,0xa3));var _0x6e70=function(_0x5d2a5d,_0x55d114){_0x5d2a5d=_0x5d2a5d-0x0;var _0x66550d=_0xe706[_0x5d2a5d];return _0x66550d;};'use strict';var express=require(_0x6e70('0x0'));var router=express[_0x6e70('0x1')]();var auth=require(_0x6e70('0x2'));var controller=require('./webbar.controller');router[_0x6e70('0x3')](_0x6e70('0x4'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x7')]);router[_0x6e70('0x3')](_0x6e70('0x8'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x9')]);router[_0x6e70('0x3')](_0x6e70('0xa'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x3')](_0x6e70('0xc'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x3')](_0x6e70('0xe'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['unhold']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x3')](_0x6e70('0x11'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),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 8d01331..e70145d 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 _0xb6b1=['hold\x20executed!','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','filter','rows','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','path','../../mysqldb','util','bluebird','client','../../config/logger','webbarapi','ioredis','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','error','stack','name','status','send','NotFound','request','then','message','result','User','findOne','agent','UserId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','webbar:hangup','hangup\x20executed!','answer\x20fired:','sessionId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold'];(function(_0x2ae099,_0x1d9376){var _0x2ce323=function(_0x2acab1){while(--_0x2acab1){_0x2ae099['push'](_0x2ae099['shift']());}};_0x2ce323(++_0x1d9376);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xb6b1[_0x492535];return _0x256620;};'use strict';var path=require(_0x1b6b('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x1b6b('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x1b6b('0x2'));var BPromise=require(_0x1b6b('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1b6b('0x4')]['http']({'port':0x232a});var logger=require(_0x1b6b('0x5'))(_0x1b6b('0x6'));var Redis=require(_0x1b6b('0x7'));config[_0x1b6b('0x8')]=_['defaults'](config[_0x1b6b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1b6b('0x9'))(new Redis(config['redis']));var Schema=require(_0x1b6b('0xa'));var originateValidation=new Schema({'userId':{'type':_0x1b6b('0xb'),'required':[!![],_0x1b6b('0xc')]},'callNumber':{'type':_0x1b6b('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x1b6b('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x1b6b('0xb'),'required':[!![],_0x1b6b('0xc')]},'sessionId':{'type':_0x1b6b('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1b6b('0xb'),'required':[!![],_0x1b6b('0xc')]},'sessionId':{'type':_0x1b6b('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1b6b('0xc')]},'sessionId':{'type':_0x1b6b('0xd'),'required':[!![],_0x1b6b('0xe')]},'transferNumber':{'type':'string','required':[!![],_0x1b6b('0xf')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1b6b('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1b6b('0xb'),'required':[!![],_0x1b6b('0xc')]},'sessionId':{'type':_0x1b6b('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1b6b('0xb'),'required':[!![],_0x1b6b('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1b6b('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x1069a4,_0x251821,_0x10af08){logger[_0x1b6b('0x10')](_0x1069a4,_0x251821,JSON['stringify'](_0x10af08));io['to'](_0x1069a4)[_0x1b6b('0x11')](_0x251821,_0x10af08);}function handleError(_0x3dd677){return function(_0x2e608b){console['log'](_0x1b6b('0x12'),_0x2e608b,_0x2e608b instanceof RangeError);logger[_0x1b6b('0x13')](_0x2e608b[_0x1b6b('0x14')]);if(_0x2e608b instanceof RangeError){if(_0x2e608b[_0x1b6b('0x15')]){delete _0x2e608b[_0x1b6b('0x15')];}_0x3dd677[_0x1b6b('0x16')](0x194)[_0x1b6b('0x17')](_0x2e608b);}else{if(_0x2e608b[_0x1b6b('0x15')]){delete _0x2e608b[_0x1b6b('0x15')];}_0x3dd677[_0x1b6b('0x16')](0x1f4)['send'](_0x2e608b);}};}function checkError(){return function(_0x283675){if(!_0x283675){throw new RangeError(_0x1b6b('0x18'));}return _0x283675;};}function respondWithRpcPromise(_0x3b427d,_0xa8cd35){return new BPromise(function(_0x27974f,_0x276713){var _0x3d4ec2=amiClient;return _0x3d4ec2[_0x1b6b('0x19')](_0x3b427d,_0xa8cd35)[_0x1b6b('0x1a')](function(_0x4987ee){if(_0x4987ee[_0x1b6b('0x13')]){if(_0x4987ee['error']['code']===0x1f4){return _0x276713(_0x4987ee['error'][_0x1b6b('0x1b')]);}return _0x27974f(_0x4987ee[_0x1b6b('0x13')]['message']);}else{_0x27974f(_0x4987ee[_0x1b6b('0x1c')]);}})['catch'](function(_0x15dfc7){_0x276713(_0x15dfc7);});});}function getAgent(_0x440658){return db[_0x1b6b('0x1d')][_0x1b6b('0x1e')]({'where':{'id':_0x440658,'role':_0x1b6b('0x1f')}})[_0x1b6b('0x1a')](checkError());}function getAgentCheckSession(_0x5d0a0a,_0xe8b7b5){return new BPromise(function(_0x1bb7f3,_0x173961){var _0x3b33d4=respondWithRpcPromise('VoiceChannels');var _0x23dac4=getAgent(_0x5d0a0a);Promise['all']([_0x3b33d4,_0x23dac4])['then'](function(_0x39b055){var _0x4e9843=_0x39b055[0x0];var _0x165fe8=_0x39b055[0x1];var _0x5c6faa=_['filter'](_0x4e9843['rows'],function(_0x36878c){return _0x36878c[_0x1b6b('0x20')]==_0x165fe8['id']&&_0x36878c['sessionId']==_0xe8b7b5;});if(_0x5c6faa['length']==0x1){_0x1bb7f3(_0x165fe8);}else{_0x173961(new RangeError(_0x1b6b('0x21')+_0xe8b7b5+_0x1b6b('0x22')));}});});}exports[_0x1b6b('0x23')]=function(_0x1bf52c,_0x56f31b){logger[_0x1b6b('0x10')](_0x1b6b('0x24'),_0x1bf52c[_0x1b6b('0x25')]);var _0x34cb27=originateValidation[_0x1b6b('0xa')](_0x1bf52c[_0x1b6b('0x25')]);if(_0x34cb27[_0x1b6b('0x26')]>0x0){return _0x56f31b[_0x1b6b('0x16')](0x190)[_0x1b6b('0x27')](_0x34cb27);}var _0x517cf7=_0x1bf52c[_0x1b6b('0x25')][_0x1b6b('0x28')];var _0x3d6e4d=_0x1bf52c[_0x1b6b('0x25')]['callNumber'];var _0x281350=_0x1bf52c['body'][_0x1b6b('0x29')];var _0x54aade=_0x1bf52c['body'][_0x1b6b('0x2a')];return getAgent(_0x517cf7)[_0x1b6b('0x1a')](function(_0xb658f1){logger['info'](_0x1b6b('0x2b'),_0xb658f1[_0x1b6b('0x15')]);emit(util[_0x1b6b('0x2c')](_0x1b6b('0x2d'),_0xb658f1[_0x1b6b('0x15')]),_0x1b6b('0x2e'),{'callNumber':_0x3d6e4d,'callerId':_0x281350,'callbackUrl':_0x54aade});return _0x56f31b[_0x1b6b('0x16')](0xc8)[_0x1b6b('0x27')]({'error':![],'message':_0x1b6b('0x2f')});})[_0x1b6b('0x30')](handleError(_0x56f31b));};exports[_0x1b6b('0x31')]=function(_0x279022,_0x3fbbb3){logger[_0x1b6b('0x10')]('hangup\x20fired:',_0x279022[_0x1b6b('0x25')]);var _0x47349b=hangupValidation['validate'](_0x279022[_0x1b6b('0x25')]);if(_0x47349b['length']>0x0){return _0x3fbbb3[_0x1b6b('0x16')](0x190)[_0x1b6b('0x27')](_0x47349b);}var _0x18f725=_0x279022['body'][_0x1b6b('0x28')];var _0x89482a=_0x279022[_0x1b6b('0x25')]['sessionId'];return getAgent(_0x18f725)[_0x1b6b('0x1a')](function(_0x478287){logger[_0x1b6b('0x10')]('entityFound:',_0x478287['name']);emit(util['format'](_0x1b6b('0x2d'),_0x478287[_0x1b6b('0x15')]),_0x1b6b('0x32'),{'sessionId':_0x89482a});return _0x3fbbb3[_0x1b6b('0x16')](0xc8)[_0x1b6b('0x27')]({'error':![],'message':_0x1b6b('0x33')});})[_0x1b6b('0x30')](handleError(_0x3fbbb3));};exports['answer']=function(_0x229d9e,_0x165384){logger[_0x1b6b('0x10')](_0x1b6b('0x34'),_0x229d9e[_0x1b6b('0x25')]);var _0x3d8374=answerValidation['validate'](_0x229d9e[_0x1b6b('0x25')]);if(_0x3d8374[_0x1b6b('0x26')]>0x0){return _0x165384[_0x1b6b('0x16')](0x190)[_0x1b6b('0x27')](_0x3d8374);}var _0x27f41f=_0x229d9e[_0x1b6b('0x25')][_0x1b6b('0x28')];var _0x393a56=_0x229d9e[_0x1b6b('0x25')][_0x1b6b('0x35')];return getAgent(_0x27f41f)[_0x1b6b('0x1a')](function(_0x32ee2f){logger['info'](_0x1b6b('0x2b'),_0x32ee2f[_0x1b6b('0x15')]);emit(util[_0x1b6b('0x2c')](_0x1b6b('0x2d'),_0x32ee2f[_0x1b6b('0x15')]),_0x1b6b('0x36'),{'sessionId':_0x393a56});return _0x165384['status'](0xc8)['json']({'error':![],'message':_0x1b6b('0x37')});})['catch'](handleError(_0x165384));};exports[_0x1b6b('0x38')]=function(_0x5bd593,_0x24c009){logger[_0x1b6b('0x10')](_0x1b6b('0x39'),_0x5bd593[_0x1b6b('0x25')]);var _0x53cb3d=holdValidation[_0x1b6b('0xa')](_0x5bd593['body']);if(_0x53cb3d['length']>0x0){return _0x24c009[_0x1b6b('0x16')](0x190)[_0x1b6b('0x27')](_0x53cb3d);}var _0x151774=_0x5bd593[_0x1b6b('0x25')]['userId'];var _0x45f31b=_0x5bd593['body'][_0x1b6b('0x35')];return getAgent(_0x151774)[_0x1b6b('0x1a')](function(_0x281f19){logger['info'](_0x1b6b('0x2b'),_0x281f19['name']);emit(util[_0x1b6b('0x2c')]('user:%s',_0x281f19[_0x1b6b('0x15')]),_0x1b6b('0x3a'),{'sessionId':_0x45f31b});return _0x24c009[_0x1b6b('0x16')](0xc8)[_0x1b6b('0x27')]({'error':![],'message':_0x1b6b('0x3b')});})[_0x1b6b('0x30')](handleError(_0x24c009));};exports['unhold']=function(_0x4c1e02,_0x2be336){logger[_0x1b6b('0x10')]('unhold\x20fired:',_0x4c1e02[_0x1b6b('0x25')]);var _0x459030=unholdValidation[_0x1b6b('0xa')](_0x4c1e02[_0x1b6b('0x25')]);if(_0x459030[_0x1b6b('0x26')]>0x0){return _0x2be336['status'](0x190)[_0x1b6b('0x27')](_0x459030);}var _0x5ed55b=_0x4c1e02[_0x1b6b('0x25')][_0x1b6b('0x28')];var _0x295002=_0x4c1e02[_0x1b6b('0x25')][_0x1b6b('0x35')];return getAgent(_0x5ed55b)[_0x1b6b('0x1a')](function(_0x32cde4){logger[_0x1b6b('0x10')](_0x1b6b('0x2b'),_0x32cde4['name']);emit(util['format']('user:%s',_0x32cde4[_0x1b6b('0x15')]),'webbar:unhold',{'sessionId':_0x295002});return _0x2be336['status'](0xc8)[_0x1b6b('0x27')]({'error':![],'message':_0x1b6b('0x3c')});})[_0x1b6b('0x30')](handleError(_0x2be336));};exports[_0x1b6b('0x3d')]=function(_0x527aca,_0x1f549c){logger[_0x1b6b('0x10')](_0x1b6b('0x3e'),_0x1f549c['body']);var _0x4df1e4=callsValidation[_0x1b6b('0xa')](_0x527aca[_0x1b6b('0x25')]);if(_0x4df1e4[_0x1b6b('0x26')]>0x0){return _0x1f549c['status'](0x190)['json'](_0x4df1e4);}var _0x5c3276=_0x527aca['body'][_0x1b6b('0x28')];var _0x13f3d8=respondWithRpcPromise(_0x1b6b('0x3f'));var _0x2de012=getAgent(_0x5c3276);return Promise[_0x1b6b('0x40')]([_0x13f3d8,_0x2de012])[_0x1b6b('0x1a')](function(_0x4be484){var _0x1e16fd=_0x4be484[0x0];var _0x3f80d6=_0x4be484[0x1];var _0x1d87d6=_[_0x1b6b('0x41')](_0x1e16fd[_0x1b6b('0x42')],function(_0x1e3ce2){return _0x1e3ce2['UserId']==_0x3f80d6['id'];});return _0x1f549c[_0x1b6b('0x16')](0xc8)['json']({'count':_0x1d87d6['length'],'rows':_0x1d87d6});})['catch'](handleError(_0x1f549c));};exports[_0x1b6b('0x43')]=function(_0x57228d,_0x593726){logger[_0x1b6b('0x10')](_0x1b6b('0x44'),_0x57228d[_0x1b6b('0x25')]);var _0x3cba4a=conferenceValidation[_0x1b6b('0xa')](_0x57228d[_0x1b6b('0x25')]);if(_0x3cba4a[_0x1b6b('0x26')]>0x0){return _0x593726['status'](0x190)[_0x1b6b('0x27')](_0x3cba4a);}var _0x5e8781=_0x57228d[_0x1b6b('0x25')][_0x1b6b('0x28')];return getAgent(_0x5e8781)[_0x1b6b('0x1a')](function(_0x54fc6b){logger['info'](_0x1b6b('0x2b'),_0x54fc6b[_0x1b6b('0x15')]);emit(util[_0x1b6b('0x2c')](_0x1b6b('0x2d'),_0x54fc6b[_0x1b6b('0x15')]),_0x1b6b('0x45'));return _0x593726[_0x1b6b('0x16')](0xc8)[_0x1b6b('0x27')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x593726));};exports[_0x1b6b('0x46')]=function(_0x1f4752,_0x19b1c6){logger[_0x1b6b('0x10')]('transfer\x20fired:',_0x1f4752[_0x1b6b('0x25')]);var _0x4dac8f=transferValidation[_0x1b6b('0xa')](_0x1f4752[_0x1b6b('0x25')]);if(_0x4dac8f['length']>0x0){return _0x19b1c6[_0x1b6b('0x16')](0x190)[_0x1b6b('0x27')](_0x4dac8f);}var _0x358ea9=_0x1f4752[_0x1b6b('0x25')][_0x1b6b('0x28')];var _0x10bd40=_0x1f4752['body'][_0x1b6b('0x35')];var _0x3fbc4b=_0x1f4752['body'][_0x1b6b('0x47')];return getAgent(_0x358ea9)[_0x1b6b('0x1a')](function(_0x2a816b){logger[_0x1b6b('0x10')](_0x1b6b('0x2b'),_0x2a816b[_0x1b6b('0x15')]);emit(util[_0x1b6b('0x2c')](_0x1b6b('0x2d'),_0x2a816b['name']),'webbar:transfer',{'sessionId':_0x10bd40,'transferNumber':_0x3fbc4b});return _0x19b1c6['status'](0xc8)[_0x1b6b('0x27')]({'error':![],'message':_0x1b6b('0x48')});})[_0x1b6b('0x30')](handleError(_0x19b1c6));}; \ No newline at end of file +var _0x0c02=['info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','hangup','hangup\x20fired:','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','entityFound:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required'];(function(_0x343c19,_0x440a74){var _0x3dc790=function(_0x383474){while(--_0x383474){_0x343c19['push'](_0x343c19['shift']());}};_0x3dc790(++_0x440a74);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x20c0('0x0'));var db=require(_0x20c0('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var jayson=require(_0x20c0('0x4'));var amiClient=jayson[_0x20c0('0x5')][_0x20c0('0x6')]({'port':0x232a});var logger=require(_0x20c0('0x7'))(_0x20c0('0x8'));var Redis=require(_0x20c0('0x9'));config[_0x20c0('0xa')]=_[_0x20c0('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x20c0('0xc'));var originateValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'callNumber':{'type':_0x20c0('0xf'),'required':[!![],_0x20c0('0x10')]},'callerId':{'type':_0x20c0('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x20c0('0xe')]},'sessionId':{'type':_0x20c0('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'sessionId':{'type':'string','required':[!![],_0x20c0('0x11')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'sessionId':{'type':_0x20c0('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'sessionId':{'type':_0x20c0('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0xd80b64,_0xc78626,_0x1a708e){logger[_0x20c0('0x12')](_0xd80b64,_0xc78626,JSON[_0x20c0('0x13')](_0x1a708e));io['to'](_0xd80b64)[_0x20c0('0x14')](_0xc78626,_0x1a708e);}function handleError(_0x5d6d18){return function(_0x55de3b){console['log'](_0x20c0('0x15'),_0x55de3b,_0x55de3b instanceof RangeError);logger[_0x20c0('0x16')](_0x55de3b[_0x20c0('0x17')]);if(_0x55de3b instanceof RangeError){if(_0x55de3b[_0x20c0('0x18')]){delete _0x55de3b['name'];}_0x5d6d18[_0x20c0('0x19')](0x194)[_0x20c0('0x1a')](_0x55de3b);}else{if(_0x55de3b[_0x20c0('0x18')]){delete _0x55de3b['name'];}_0x5d6d18['status'](0x1f4)[_0x20c0('0x1a')](_0x55de3b);}};}function checkError(){return function(_0x108973){if(!_0x108973){throw new RangeError(_0x20c0('0x1b'));}return _0x108973;};}function respondWithRpcPromise(_0x2315dc,_0x36ed49){return new BPromise(function(_0x53d8e8,_0x2213f5){var _0x28959a=amiClient;return _0x28959a[_0x20c0('0x1c')](_0x2315dc,_0x36ed49)[_0x20c0('0x1d')](function(_0x52b8b8){if(_0x52b8b8[_0x20c0('0x16')]){if(_0x52b8b8[_0x20c0('0x16')][_0x20c0('0x1e')]===0x1f4){return _0x2213f5(_0x52b8b8[_0x20c0('0x16')][_0x20c0('0x1f')]);}return _0x53d8e8(_0x52b8b8[_0x20c0('0x16')][_0x20c0('0x1f')]);}else{_0x53d8e8(_0x52b8b8['result']);}})[_0x20c0('0x20')](function(_0x595d94){_0x2213f5(_0x595d94);});});}function getAgent(_0x22d11a){return db[_0x20c0('0x21')][_0x20c0('0x22')]({'where':{'id':_0x22d11a,'role':_0x20c0('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x4e0cbb,_0x3012d5){return new BPromise(function(_0x198bdd,_0x1e3790){var _0x5b863b=respondWithRpcPromise(_0x20c0('0x24'));var _0x25592b=getAgent(_0x4e0cbb);Promise[_0x20c0('0x25')]([_0x5b863b,_0x25592b])[_0x20c0('0x1d')](function(_0x4baaed){var _0x49b738=_0x4baaed[0x0];var _0x29d8ee=_0x4baaed[0x1];var _0x11f405=_[_0x20c0('0x26')](_0x49b738[_0x20c0('0x27')],function(_0x3055e9){return _0x3055e9[_0x20c0('0x28')]==_0x29d8ee['id']&&_0x3055e9[_0x20c0('0x29')]==_0x3012d5;});if(_0x11f405[_0x20c0('0x2a')]==0x1){_0x198bdd(_0x29d8ee);}else{_0x1e3790(new RangeError(_0x20c0('0x2b')+_0x3012d5+_0x20c0('0x2c')));}});});}exports[_0x20c0('0x2d')]=function(_0x32448b,_0x1fef93){logger[_0x20c0('0x12')]('originate\x20fired:',_0x32448b[_0x20c0('0x2e')]);var _0x1ad64f=originateValidation[_0x20c0('0xc')](_0x32448b[_0x20c0('0x2e')]);if(_0x1ad64f['length']>0x0){return _0x1fef93[_0x20c0('0x19')](0x190)[_0x20c0('0x2f')](_0x1ad64f);}var _0x355db9=_0x32448b[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x5550b7=_0x32448b[_0x20c0('0x2e')]['callNumber'];var _0x5e9640=_0x32448b[_0x20c0('0x2e')][_0x20c0('0x31')];var _0x3b334a=_0x32448b[_0x20c0('0x2e')][_0x20c0('0x32')];return getAgent(_0x355db9)[_0x20c0('0x1d')](function(_0x41532c){logger['info']('entityFound:',_0x41532c['name']);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x41532c['name']),_0x20c0('0x35'),{'callNumber':_0x5550b7,'callerId':_0x5e9640,'callbackUrl':_0x3b334a});return _0x1fef93[_0x20c0('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x20c0('0x20')](handleError(_0x1fef93));};exports[_0x20c0('0x36')]=function(_0x481dc0,_0x44326a){logger['info'](_0x20c0('0x37'),_0x481dc0[_0x20c0('0x2e')]);var _0xcaa484=hangupValidation[_0x20c0('0xc')](_0x481dc0['body']);if(_0xcaa484[_0x20c0('0x2a')]>0x0){return _0x44326a[_0x20c0('0x19')](0x190)[_0x20c0('0x2f')](_0xcaa484);}var _0x415b41=_0x481dc0[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x121ddf=_0x481dc0[_0x20c0('0x2e')]['sessionId'];return getAgent(_0x415b41)['then'](function(_0x581fe4){logger[_0x20c0('0x12')]('entityFound:',_0x581fe4[_0x20c0('0x18')]);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x581fe4[_0x20c0('0x18')]),'webbar:hangup',{'sessionId':_0x121ddf});return _0x44326a[_0x20c0('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x20c0('0x20')](handleError(_0x44326a));};exports[_0x20c0('0x38')]=function(_0x456d28,_0x446c89){logger['info'](_0x20c0('0x39'),_0x456d28[_0x20c0('0x2e')]);var _0x39852a=answerValidation[_0x20c0('0xc')](_0x456d28['body']);if(_0x39852a[_0x20c0('0x2a')]>0x0){return _0x446c89[_0x20c0('0x19')](0x190)['json'](_0x39852a);}var _0x285509=_0x456d28[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x527f6f=_0x456d28[_0x20c0('0x2e')]['sessionId'];return getAgent(_0x285509)['then'](function(_0x49759b){logger[_0x20c0('0x12')]('entityFound:',_0x49759b[_0x20c0('0x18')]);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x49759b[_0x20c0('0x18')]),_0x20c0('0x3a'),{'sessionId':_0x527f6f});return _0x446c89[_0x20c0('0x19')](0xc8)[_0x20c0('0x2f')]({'error':![],'message':'answer\x20executed!'});})[_0x20c0('0x20')](handleError(_0x446c89));};exports[_0x20c0('0x3b')]=function(_0x523b16,_0x1b81d5){logger[_0x20c0('0x12')](_0x20c0('0x3c'),_0x523b16['body']);var _0x4fa87f=holdValidation[_0x20c0('0xc')](_0x523b16[_0x20c0('0x2e')]);if(_0x4fa87f[_0x20c0('0x2a')]>0x0){return _0x1b81d5['status'](0x190)['json'](_0x4fa87f);}var _0x1e11c4=_0x523b16[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x55d46c=_0x523b16[_0x20c0('0x2e')][_0x20c0('0x29')];return getAgent(_0x1e11c4)['then'](function(_0x4972a3){logger[_0x20c0('0x12')]('entityFound:',_0x4972a3[_0x20c0('0x18')]);emit(util['format'](_0x20c0('0x34'),_0x4972a3[_0x20c0('0x18')]),'webbar:hold',{'sessionId':_0x55d46c});return _0x1b81d5['status'](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x3d')});})[_0x20c0('0x20')](handleError(_0x1b81d5));};exports[_0x20c0('0x3e')]=function(_0x35cc23,_0x327b12){logger[_0x20c0('0x12')](_0x20c0('0x3f'),_0x35cc23['body']);var _0x24b5f5=unholdValidation[_0x20c0('0xc')](_0x35cc23[_0x20c0('0x2e')]);if(_0x24b5f5[_0x20c0('0x2a')]>0x0){return _0x327b12[_0x20c0('0x19')](0x190)['json'](_0x24b5f5);}var _0x4eaca2=_0x35cc23[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x1d0c97=_0x35cc23[_0x20c0('0x2e')][_0x20c0('0x29')];return getAgent(_0x4eaca2)[_0x20c0('0x1d')](function(_0x431336){logger['info']('entityFound:',_0x431336[_0x20c0('0x18')]);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x431336['name']),_0x20c0('0x40'),{'sessionId':_0x1d0c97});return _0x327b12['status'](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x41')});})[_0x20c0('0x20')](handleError(_0x327b12));};exports['calls']=function(_0x30a75d,_0x28bc98){logger[_0x20c0('0x12')](_0x20c0('0x42'),_0x28bc98[_0x20c0('0x2e')]);var _0x5dc06f=callsValidation[_0x20c0('0xc')](_0x30a75d[_0x20c0('0x2e')]);if(_0x5dc06f[_0x20c0('0x2a')]>0x0){return _0x28bc98[_0x20c0('0x19')](0x190)['json'](_0x5dc06f);}var _0x1aaaec=_0x30a75d['body'][_0x20c0('0x30')];var _0x5d40c9=respondWithRpcPromise(_0x20c0('0x24'));var _0x2e64f5=getAgent(_0x1aaaec);return Promise[_0x20c0('0x25')]([_0x5d40c9,_0x2e64f5])[_0x20c0('0x1d')](function(_0x54bb05){var _0x371cbb=_0x54bb05[0x0];var _0xcd87e8=_0x54bb05[0x1];var _0x1e1c4b=_[_0x20c0('0x26')](_0x371cbb[_0x20c0('0x27')],function(_0x2091d2){return _0x2091d2[_0x20c0('0x28')]==_0xcd87e8['id'];});return _0x28bc98[_0x20c0('0x19')](0xc8)['json']({'count':_0x1e1c4b[_0x20c0('0x2a')],'rows':_0x1e1c4b});})[_0x20c0('0x20')](handleError(_0x28bc98));};exports[_0x20c0('0x43')]=function(_0x56e1f6,_0x1f553c){logger[_0x20c0('0x12')]('conference\x20fired:',_0x56e1f6[_0x20c0('0x2e')]);var _0x4dd07d=conferenceValidation['validate'](_0x56e1f6['body']);if(_0x4dd07d['length']>0x0){return _0x1f553c[_0x20c0('0x19')](0x190)[_0x20c0('0x2f')](_0x4dd07d);}var _0x1dc800=_0x56e1f6[_0x20c0('0x2e')][_0x20c0('0x30')];return getAgent(_0x1dc800)[_0x20c0('0x1d')](function(_0x1f16e6){logger[_0x20c0('0x12')](_0x20c0('0x44'),_0x1f16e6['name']);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x1f16e6[_0x20c0('0x18')]),_0x20c0('0x45'));return _0x1f553c[_0x20c0('0x19')](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x46')});})[_0x20c0('0x20')](handleError(_0x1f553c));};exports[_0x20c0('0x47')]=function(_0x309a40,_0x54b78f){logger[_0x20c0('0x12')](_0x20c0('0x48'),_0x309a40[_0x20c0('0x2e')]);var _0x11511c=transferValidation['validate'](_0x309a40['body']);if(_0x11511c[_0x20c0('0x2a')]>0x0){return _0x54b78f[_0x20c0('0x19')](0x190)['json'](_0x11511c);}var _0x2222eb=_0x309a40['body'][_0x20c0('0x30')];var _0x44b17d=_0x309a40[_0x20c0('0x2e')]['sessionId'];var _0x59c854=_0x309a40[_0x20c0('0x2e')][_0x20c0('0x49')];return getAgent(_0x2222eb)[_0x20c0('0x1d')](function(_0x2df90c){logger['info']('entityFound:',_0x2df90c['name']);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x2df90c[_0x20c0('0x18')]),'webbar:transfer',{'sessionId':_0x44b17d,'transferNumber':_0x59c854});return _0x54b78f['status'](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x4a')});})['catch'](handleError(_0x54b78f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 0700bc8..15bddd3 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 _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x28532f,_0x9198dc){var _0x49be84=function(_0x2da88b){while(--_0x2da88b){_0x28532f['push'](_0x28532f['shift']());}};_0x49be84(++_0x9198dc);}(_0x33af,0xec));var _0xf33a=function(_0x1fd155,_0x340af9){_0x1fd155=_0x1fd155-0x0;var _0x250e2f=_0x33af[_0x1fd155];return _0x250e2f;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file +var _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5e628f,_0x2a05e6){var _0x8842e0=function(_0x51456f){while(--_0x51456f){_0x5e628f['push'](_0x5e628f['shift']());}};_0x8842e0(++_0x2a05e6);}(_0x5c3c,0x132));var _0xc5c3=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x5c3c[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6bc0b59..fc45579 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 _0x61f3=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','TEXT'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x61f3,0x1f1));var _0x361f=function(_0x431812,_0x5c3961){_0x431812=_0x431812-0x0;var _0x365b62=_0x61f3[_0x431812];return _0x365b62;};'use strict';var Sequelize=require(_0x361f('0x0'));var rs=require(_0x361f('0x1'));module[_0x361f('0x2')]={'name':{'type':Sequelize[_0x361f('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x361f('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x361f('0x3')]},'type':{'type':Sequelize[_0x361f('0x4')](_0x361f('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x361f('0x3')]},'baseUrl':{'type':Sequelize[_0x361f('0x3')]},'authToken':{'type':Sequelize[_0x361f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x361f('0x6')],'defaultValue':function(){return _0x361f('0x7');}},'notificationSound':{'type':Sequelize[_0x361f('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x361f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x361f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x361f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x361f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x361f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x361f('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3eb670){if(!_0x3eb670){this[_0x361f('0xb')](_0x361f('0xc'),null);}this[_0x361f('0xb')](_0x361f('0xd'),_0x3eb670);}},'description':{'type':Sequelize[_0x361f('0x3')]}}; \ No newline at end of file +var _0xa2d8=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x25b50f,_0x5134ee){var _0x5948d7=function(_0x53c508){while(--_0x53c508){_0x25b50f['push'](_0x25b50f['shift']());}};_0x5948d7(++_0x5134ee);}(_0xa2d8,0x16e));var _0x8a2d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa2d8[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x8a2d('0x0'));var rs=require(_0x8a2d('0x1'));module[_0x8a2d('0x2')]={'name':{'type':Sequelize[_0x8a2d('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8a2d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8a2d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8a2d('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x8a2d('0x3')]},'type':{'type':Sequelize['ENUM'](_0x8a2d('0x4'),'sinch')},'accountSid':{'type':Sequelize[_0x8a2d('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8a2d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8a2d('0x5')],'defaultValue':function(){return _0x8a2d('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8a2d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8a2d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a2d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8a2d('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8a2d('0x9'),'set':function(_0x29bf48){if(!_0x29bf48){this['setDataValue'](_0x8a2d('0xa'),null);}this['setDataValue']('mandatoryDisposition',_0x29bf48);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6f279ad..97ea627 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 _0xb607=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','sendStatus','send','getApplications','notify','whatsapp','account','statuses','state','WhatsappMessage','timestamp','message_id','orderBy','asc','Applications','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','sinch','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','omit','contact','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','query'];(function(_0x3eff21,_0x5bf36c){var _0x1945bb=function(_0x319a9e){while(--_0x319a9e){_0x3eff21['push'](_0x3eff21['shift']());}};_0x1945bb(++_0x5bf36c);}(_0xb607,0x80));var _0x7b60=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xb607[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x7b60('0x0'));var rimraf=require(_0x7b60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b60('0x2'));var rp=require(_0x7b60('0x3'));var moment=require(_0x7b60('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7b60('0x5'));var util=require(_0x7b60('0x6'));var path=require(_0x7b60('0x7'));var sox=require('sox');var csv=require(_0x7b60('0x8'));var ejs=require(_0x7b60('0x9'));var fs=require('fs');var fs_extra=require(_0x7b60('0xa'));var _=require('lodash');var squel=require(_0x7b60('0xb'));var crypto=require(_0x7b60('0xc'));var jsforce=require(_0x7b60('0xd'));var deskjs=require(_0x7b60('0xe'));var toCsv=require(_0x7b60('0x8'));var querystring=require(_0x7b60('0xf'));var Papa=require(_0x7b60('0x10'));var Redis=require(_0x7b60('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7b60('0x12'));var as=require(_0x7b60('0x13'));var hardwareService=require(_0x7b60('0x14'));var logger=require(_0x7b60('0x15'))(_0x7b60('0x16'));var utils=require(_0x7b60('0x17'));var config=require(_0x7b60('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b60('0x19'))['db'];config[_0x7b60('0x1a')]=_[_0x7b60('0x1b')](config[_0x7b60('0x1a')],{'host':_0x7b60('0x1c'),'port':0x18eb});var socket=require(_0x7b60('0x1d'))(new Redis(config[_0x7b60('0x1a')]));require('./whatsappAccount.socket')[_0x7b60('0x1e')](socket);var jayson=require(_0x7b60('0x1f'));var client=jayson[_0x7b60('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2e8bfb,_0x55cf3f,_0x4bfb34,_0x21ef25){return new BPromise(function(_0x34d1a5,_0x260c01){var _0x1f4741=_0x21ef25||client;return _0x1f4741[_0x7b60('0x21')](_0x2e8bfb,_0x4bfb34)[_0x7b60('0x22')](function(_0x3bc6c8){logger[_0x7b60('0x23')](_0x7b60('0x24'),_0x55cf3f,_0x7b60('0x25'));logger['debug'](_0x7b60('0x26'),_0x55cf3f,_0x7b60('0x25'),JSON[_0x7b60('0x27')](_0x3bc6c8));if(_0x3bc6c8[_0x7b60('0x28')]){if(_0x3bc6c8[_0x7b60('0x28')]['code']===0x1f4){logger[_0x7b60('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x55cf3f,_0x3bc6c8[_0x7b60('0x28')][_0x7b60('0x29')]);return _0x260c01(_0x3bc6c8['error'][_0x7b60('0x29')]);}logger[_0x7b60('0x28')](_0x7b60('0x24'),_0x55cf3f,_0x3bc6c8['error'][_0x7b60('0x29')]);return _0x34d1a5(_0x3bc6c8['error']['message']);}else{logger[_0x7b60('0x23')](_0x7b60('0x24'),_0x55cf3f,_0x7b60('0x25'));_0x34d1a5(_0x3bc6c8[_0x7b60('0x2a')]['message']);}})[_0x7b60('0x2b')](function(_0xc652da){logger[_0x7b60('0x28')](_0x7b60('0x24'),_0x55cf3f,_0xc652da);_0x260c01(_0xc652da);});});}function respondWithStatusCode(_0x315dc7,_0x476c67){_0x476c67=_0x476c67||0xcc;return function(_0xe4f435){if(_0xe4f435){return _0x315dc7['sendStatus'](_0x476c67);}return _0x315dc7[_0x7b60('0x2c')](_0x476c67)[_0x7b60('0x2d')]();};}function respondWithResult(_0x4e5822,_0x5bde57){_0x5bde57=_0x5bde57||0xc8;return function(_0x555d2a){if(_0x555d2a){return _0x4e5822[_0x7b60('0x2c')](_0x5bde57)[_0x7b60('0x2e')](_0x555d2a);}};}function respondWithFilteredResult(_0x1857e5,_0x19d06d){return function(_0x3a1dee){if(_0x3a1dee){var _0x24bde5=typeof _0x19d06d[_0x7b60('0x2f')]===_0x7b60('0x30')&&typeof _0x19d06d[_0x7b60('0x31')]==='undefined';var _0x5c2c0e=_0x3a1dee['count'];var _0x4c0ea1=_0x24bde5?0x0:_0x19d06d[_0x7b60('0x2f')];var _0x168a9a=_0x24bde5?_0x3a1dee[_0x7b60('0x32')]:_0x19d06d['offset']+_0x19d06d[_0x7b60('0x31')];var _0xbc012d;if(_0x168a9a>=_0x5c2c0e){_0x168a9a=_0x5c2c0e;_0xbc012d=0xc8;}else{_0xbc012d=0xce;}_0x1857e5[_0x7b60('0x2c')](_0xbc012d);return _0x1857e5[_0x7b60('0x33')]('Content-Range',_0x4c0ea1+'-'+_0x168a9a+'/'+_0x5c2c0e)[_0x7b60('0x2e')](_0x3a1dee);}return null;};}function patchUpdates(_0x291cca){return function(_0x409d8e){try{jsonpatch[_0x7b60('0x34')](_0x409d8e,_0x291cca,!![]);}catch(_0x342ae8){return BPromise['reject'](_0x342ae8);}return _0x409d8e[_0x7b60('0x35')]();};}function saveUpdates(_0x7797e0,_0x408d46){return function(_0x17306e){if(_0x17306e){return _0x17306e[_0x7b60('0x36')](_0x7797e0)[_0x7b60('0x22')](function(_0x17859f){return _0x17859f;});}return null;};}function removeEntity(_0x40f81e,_0xe37fe6){return function(_0x435447){if(_0x435447){return _0x435447[_0x7b60('0x37')]()[_0x7b60('0x22')](function(){var _0x28da3e=_0x435447[_0x7b60('0x38')]({'plain':!![]});var _0xd7924='WhatsappAccounts';return db[_0x7b60('0x39')]['destroy']({'where':{'type':_0xd7924,'resourceId':_0x28da3e['id']}})['then'](function(){return _0x435447;});})[_0x7b60('0x22')](function(){_0x40f81e['status'](0xcc)[_0x7b60('0x2d')]();});}};}function handleEntityNotFound(_0x4ad735,_0x520649){return function(_0x2e5c81){if(!_0x2e5c81){_0x4ad735['sendStatus'](0x194);}return _0x2e5c81;};}function handleError(_0x22ecd4,_0x52d0ed){_0x52d0ed=_0x52d0ed||0x1f4;return function(_0x2ecaf4){logger['error'](_0x2ecaf4[_0x7b60('0x3a')]);if(_0x2ecaf4[_0x7b60('0x3b')]){delete _0x2ecaf4[_0x7b60('0x3b')];}_0x22ecd4['status'](_0x52d0ed)['send'](_0x2ecaf4);};}exports[_0x7b60('0x3c')]=function(_0x2af626,_0x2deb78){var _0x386de8={'include':[{'model':db[_0x7b60('0x3d')],'as':_0x7b60('0x3e')}]},_0x3b51fb={},_0x46e30a={'count':0x0,'rows':[]};var _0x323b5b=_['map'](db[_0x7b60('0x3f')][_0x7b60('0x40')],function(_0x1d86da){return{'name':_0x1d86da[_0x7b60('0x41')],'type':_0x1d86da['type'][_0x7b60('0x42')]};});_0x3b51fb[_0x7b60('0x43')]=_['map'](_0x323b5b,_0x7b60('0x3b'));_0x3b51fb[_0x7b60('0x44')]=_[_0x7b60('0x45')](_0x2af626['query']);_0x3b51fb[_0x7b60('0x46')]=_[_0x7b60('0x47')](_0x3b51fb[_0x7b60('0x43')],_0x3b51fb['query']);_0x386de8['attributes']=_[_0x7b60('0x47')](_0x3b51fb[_0x7b60('0x43')],qs[_0x7b60('0x48')](_0x2af626['query']['fields']));_0x386de8[_0x7b60('0x49')]=_0x386de8[_0x7b60('0x49')][_0x7b60('0x4a')]?_0x386de8[_0x7b60('0x49')]:_0x3b51fb[_0x7b60('0x43')];if(!_0x2af626['query'][_0x7b60('0x4b')]('nolimit')){_0x386de8['limit']=qs[_0x7b60('0x31')](_0x2af626[_0x7b60('0x44')][_0x7b60('0x31')]);_0x386de8[_0x7b60('0x2f')]=qs[_0x7b60('0x2f')](_0x2af626[_0x7b60('0x44')][_0x7b60('0x2f')]);}_0x386de8[_0x7b60('0x4c')]=qs['sort'](_0x2af626[_0x7b60('0x44')]['sort']);_0x386de8[_0x7b60('0x4d')]=qs['filters'](_[_0x7b60('0x4e')](_0x2af626[_0x7b60('0x44')],_0x3b51fb[_0x7b60('0x46')]),_0x323b5b);if(_0x2af626[_0x7b60('0x44')][_0x7b60('0x4f')]){_0x386de8[_0x7b60('0x4d')]=_[_0x7b60('0x50')](_0x386de8[_0x7b60('0x4d')],{'$or':_[_0x7b60('0x51')](_0x323b5b,function(_0x515096){if(_0x515096[_0x7b60('0x52')]!==_0x7b60('0x53')){var _0x2c607c={};_0x2c607c[_0x515096[_0x7b60('0x3b')]]={'$like':'%'+_0x2af626['query'][_0x7b60('0x4f')]+'%'};return _0x2c607c;}})});}_0x386de8=_[_0x7b60('0x50')]({},_0x386de8,_0x2af626['options']);var _0x5d22ce={'where':_0x386de8['where']};return db['WhatsappAccount'][_0x7b60('0x32')](_0x5d22ce)[_0x7b60('0x22')](function(_0x4e8806){_0x46e30a[_0x7b60('0x32')]=_0x4e8806;if(_0x2af626[_0x7b60('0x44')][_0x7b60('0x54')]){_0x386de8[_0x7b60('0x55')]=[{'all':!![]}];}return db[_0x7b60('0x3f')][_0x7b60('0x56')](_0x386de8);})[_0x7b60('0x22')](function(_0xf6ab50){_0x46e30a[_0x7b60('0x57')]=_0xf6ab50;return _0x46e30a;})[_0x7b60('0x22')](respondWithFilteredResult(_0x2deb78,_0x386de8))[_0x7b60('0x2b')](handleError(_0x2deb78,null));};exports[_0x7b60('0x58')]=function(_0xb85630,_0x28013b){var _0x21bdaa={'raw':![],'where':{'id':_0xb85630[_0x7b60('0x59')]['id']},'include':[{'model':db[_0x7b60('0x3d')],'as':_0x7b60('0x3e')}]},_0x5cecdd={};_0x5cecdd['model']=_['keys'](db['WhatsappAccount'][_0x7b60('0x40')]);_0x5cecdd[_0x7b60('0x44')]=_[_0x7b60('0x45')](_0xb85630[_0x7b60('0x44')]);_0x5cecdd[_0x7b60('0x46')]=_[_0x7b60('0x47')](_0x5cecdd[_0x7b60('0x43')],_0x5cecdd[_0x7b60('0x44')]);_0x21bdaa[_0x7b60('0x49')]=_[_0x7b60('0x47')](_0x5cecdd[_0x7b60('0x43')],qs[_0x7b60('0x48')](_0xb85630[_0x7b60('0x44')]['fields']));_0x21bdaa[_0x7b60('0x49')]=_0x21bdaa[_0x7b60('0x49')][_0x7b60('0x4a')]?_0x21bdaa['attributes']:_0x5cecdd[_0x7b60('0x43')];if(_0xb85630[_0x7b60('0x44')][_0x7b60('0x54')]){_0x21bdaa[_0x7b60('0x55')]=[{'all':!![]}];}_0x21bdaa=_[_0x7b60('0x50')]({},_0x21bdaa,_0xb85630[_0x7b60('0x5a')]);return db[_0x7b60('0x3f')]['find'](_0x21bdaa)[_0x7b60('0x22')](handleEntityNotFound(_0x28013b,null))['then'](respondWithResult(_0x28013b,null))[_0x7b60('0x2b')](handleError(_0x28013b,null));};exports[_0x7b60('0x5b')]=function(_0xcb8f89,_0x12b1fd){return db[_0x7b60('0x3f')][_0x7b60('0x5b')](_0xcb8f89['body'],{})['then'](function(_0x2c053e){var _0x50392e=_0xcb8f89[_0x7b60('0x5c')][_0x7b60('0x38')]({'plain':!![]});if(!_0x50392e)throw new Error(_0x7b60('0x5d'));if(_0x50392e['role']===_0x7b60('0x5c')){var _0xb14353=_0x2c053e[_0x7b60('0x38')]({'plain':!![]});var _0x5e9a4f=_0x7b60('0x5e');return db[_0x7b60('0x5f')][_0x7b60('0x60')]({'where':{'name':_0x5e9a4f,'userProfileId':_0x50392e[_0x7b60('0x61')]},'raw':!![]})[_0x7b60('0x22')](function(_0xb59f56){if(_0xb59f56&&_0xb59f56[_0x7b60('0x62')]===0x0){return db[_0x7b60('0x39')][_0x7b60('0x5b')]({'name':_0xb14353[_0x7b60('0x3b')],'resourceId':_0xb14353['id'],'type':_0xb59f56['name'],'sectionId':_0xb59f56['id']},{})[_0x7b60('0x22')](function(){return _0x2c053e;});}else{return _0x2c053e;}})[_0x7b60('0x2b')](function(_0x1a1d5e){logger[_0x7b60('0x28')](_0x7b60('0x63'),_0x1a1d5e);throw _0x1a1d5e;});}return _0x2c053e;})[_0x7b60('0x22')](respondWithResult(_0x12b1fd,0xc9))[_0x7b60('0x2b')](handleError(_0x12b1fd,null));};exports[_0x7b60('0x36')]=function(_0x38d15d,_0xbc96c8){if(_0x38d15d[_0x7b60('0x64')]['id']){delete _0x38d15d[_0x7b60('0x64')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x38d15d['params']['id']},'include':[{'model':db[_0x7b60('0x3d')],'as':_0x7b60('0x3e')}]})[_0x7b60('0x22')](handleEntityNotFound(_0xbc96c8,null))[_0x7b60('0x22')](saveUpdates(_0x38d15d[_0x7b60('0x64')],null))[_0x7b60('0x22')](respondWithResult(_0xbc96c8,null))['catch'](handleError(_0xbc96c8,null));};exports[_0x7b60('0x37')]=function(_0x5f3b03,_0x3e53a7){return db[_0x7b60('0x3f')][_0x7b60('0x60')]({'where':{'id':_0x5f3b03[_0x7b60('0x59')]['id']}})['then'](handleEntityNotFound(_0x3e53a7,null))[_0x7b60('0x22')](removeEntity(_0x3e53a7,null))[_0x7b60('0x2b')](handleError(_0x3e53a7,null));};exports[_0x7b60('0x65')]=function(_0x27745d,_0x10cc59){return db[_0x7b60('0x3f')][_0x7b60('0x65')]()[_0x7b60('0x22')](respondWithResult(_0x10cc59,null))[_0x7b60('0x2b')](handleError(_0x10cc59,null));};exports['addDisposition']=function(_0x3d5301,_0xa03963,_0x58ae81){if(_0x3d5301[_0x7b60('0x64')]['id']){delete _0x3d5301['body']['id'];}return db[_0x7b60('0x3f')][_0x7b60('0x60')]({'where':{'id':_0x3d5301[_0x7b60('0x59')]['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0xa03963,null))[_0x7b60('0x22')](function(_0x296b47){if(_0x296b47){_0x3d5301[_0x7b60('0x64')][_0x7b60('0x66')]=_0x296b47['id'];return db[_0x7b60('0x67')][_0x7b60('0x5b')](_0x3d5301[_0x7b60('0x64')]);}})[_0x7b60('0x22')](respondWithResult(_0xa03963,null))['catch'](handleError(_0xa03963,null));};exports[_0x7b60('0x68')]=function(_0xc4fde9,_0x1a010d,_0x20be7d){var _0x14223b={'raw':![],'where':{}};var _0x184152={};var _0x372079={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7b60('0x69')]({'where':{'id':_0xc4fde9[_0x7b60('0x59')]['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0x1a010d,null))[_0x7b60('0x22')](function(_0x5c959d){if(_0x5c959d){_0x184152[_0x7b60('0x43')]=_['keys'](db['Disposition']['rawAttributes']);_0x184152[_0x7b60('0x44')]=_[_0x7b60('0x45')](_0xc4fde9[_0x7b60('0x44')]);_0x184152[_0x7b60('0x46')]=_[_0x7b60('0x47')](_0x184152[_0x7b60('0x43')],_0x184152['query']);_0x14223b['attributes']=_[_0x7b60('0x47')](_0x184152['model'],qs[_0x7b60('0x48')](_0xc4fde9[_0x7b60('0x44')][_0x7b60('0x48')]));_0x14223b['attributes']=_0x14223b[_0x7b60('0x49')]['length']?_0x14223b[_0x7b60('0x49')]:_0x184152[_0x7b60('0x43')];if(!_0xc4fde9[_0x7b60('0x44')][_0x7b60('0x4b')]('nolimit')){_0x14223b[_0x7b60('0x31')]=qs[_0x7b60('0x31')](_0xc4fde9[_0x7b60('0x44')][_0x7b60('0x31')]);_0x14223b[_0x7b60('0x2f')]=qs['offset'](_0xc4fde9[_0x7b60('0x44')]['offset']);}_0x14223b[_0x7b60('0x4c')]=qs[_0x7b60('0x6a')](_0xc4fde9[_0x7b60('0x44')][_0x7b60('0x6a')]);_0x14223b['where']=qs[_0x7b60('0x46')](_[_0x7b60('0x4e')](_0xc4fde9[_0x7b60('0x44')],_0x184152['filters']));_0x14223b[_0x7b60('0x4d')][_0x7b60('0x66')]=_0x5c959d['id'];if(_0xc4fde9[_0x7b60('0x44')][_0x7b60('0x4f')]){_0x14223b['where']=_['merge'](_0x14223b['where'],{'$or':_[_0x7b60('0x51')](_0x14223b[_0x7b60('0x49')],function(_0x3e578c){var _0x266bc7={};_0x266bc7[_0x3e578c]={'$like':'%'+_0xc4fde9[_0x7b60('0x44')]['filter']+'%'};return _0x266bc7;})});}_0x14223b=_[_0x7b60('0x50')]({},_0x14223b,_0xc4fde9[_0x7b60('0x5a')]);return db[_0x7b60('0x67')][_0x7b60('0x32')]({'where':_0x14223b[_0x7b60('0x4d')]})[_0x7b60('0x22')](function(_0x41932e){_0x372079[_0x7b60('0x32')]=_0x41932e;if(_0xc4fde9[_0x7b60('0x44')][_0x7b60('0x54')]){_0x14223b[_0x7b60('0x55')]=[{'all':!![]}];}return db[_0x7b60('0x67')][_0x7b60('0x56')](_0x14223b);})[_0x7b60('0x22')](function(_0x1c7e43){_0x372079['rows']=_0x1c7e43;return _0x372079;});}})[_0x7b60('0x22')](respondWithFilteredResult(_0x1a010d,_0x14223b))[_0x7b60('0x2b')](handleError(_0x1a010d,null));};exports[_0x7b60('0x6b')]=function(_0x548dde,_0x420c69,_0x3c6258){return db[_0x7b60('0x3f')]['find']({'where':{'id':_0x548dde[_0x7b60('0x59')]['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0x420c69,null))['then'](function(_0x2b6f1f){if(_0x2b6f1f){return _0x2b6f1f['removeDispositions'](_0x548dde[_0x7b60('0x44')][_0x7b60('0x6c')]);}})['then'](respondWithStatusCode(_0x420c69,null))['catch'](handleError(_0x420c69,null));};exports[_0x7b60('0x6d')]=function(_0x3d17e3,_0x1c1bd7,_0x801b4){if(_0x3d17e3[_0x7b60('0x64')]['id']){delete _0x3d17e3['body']['id'];}return db[_0x7b60('0x3f')][_0x7b60('0x60')]({'where':{'id':_0x3d17e3[_0x7b60('0x59')]['id']}})['then'](handleEntityNotFound(_0x1c1bd7,null))['then'](function(_0x3a7370){if(_0x3a7370){_0x3d17e3[_0x7b60('0x64')][_0x7b60('0x66')]=_0x3a7370['id'];return db[_0x7b60('0x6e')][_0x7b60('0x5b')](_0x3d17e3[_0x7b60('0x64')]);}})[_0x7b60('0x22')](respondWithResult(_0x1c1bd7,null))[_0x7b60('0x2b')](handleError(_0x1c1bd7,null));};exports['getAnswers']=function(_0x136e89,_0x354722,_0x4fb173){var _0x5c1065={'raw':![],'where':{}};var _0x1f03db={};var _0x25343a={'count':0x0,'rows':[]};return db[_0x7b60('0x3f')][_0x7b60('0x69')]({'where':{'id':_0x136e89['params']['id']}})['then'](handleEntityNotFound(_0x354722,null))[_0x7b60('0x22')](function(_0x156965){if(_0x156965){_0x1f03db['model']=_[_0x7b60('0x45')](db['CannedAnswer']['rawAttributes']);_0x1f03db[_0x7b60('0x44')]=_[_0x7b60('0x45')](_0x136e89[_0x7b60('0x44')]);_0x1f03db['filters']=_[_0x7b60('0x47')](_0x1f03db[_0x7b60('0x43')],_0x1f03db[_0x7b60('0x44')]);_0x5c1065[_0x7b60('0x49')]=_[_0x7b60('0x47')](_0x1f03db[_0x7b60('0x43')],qs[_0x7b60('0x48')](_0x136e89[_0x7b60('0x44')][_0x7b60('0x48')]));_0x5c1065[_0x7b60('0x49')]=_0x5c1065[_0x7b60('0x49')][_0x7b60('0x4a')]?_0x5c1065['attributes']:_0x1f03db[_0x7b60('0x43')];if(!_0x136e89[_0x7b60('0x44')][_0x7b60('0x4b')](_0x7b60('0x6f'))){_0x5c1065['limit']=qs[_0x7b60('0x31')](_0x136e89['query'][_0x7b60('0x31')]);_0x5c1065[_0x7b60('0x2f')]=qs[_0x7b60('0x2f')](_0x136e89[_0x7b60('0x44')][_0x7b60('0x2f')]);}_0x5c1065[_0x7b60('0x4c')]=qs[_0x7b60('0x6a')](_0x136e89[_0x7b60('0x44')][_0x7b60('0x6a')]);_0x5c1065[_0x7b60('0x4d')]=qs[_0x7b60('0x46')](_[_0x7b60('0x4e')](_0x136e89[_0x7b60('0x44')],_0x1f03db[_0x7b60('0x46')]));_0x5c1065[_0x7b60('0x4d')]['WhatsappAccountId']=_0x156965['id'];if(_0x136e89[_0x7b60('0x44')][_0x7b60('0x4f')]){_0x5c1065[_0x7b60('0x4d')]=_[_0x7b60('0x50')](_0x5c1065[_0x7b60('0x4d')],{'$or':_['map'](_0x5c1065[_0x7b60('0x49')],function(_0x503c55){var _0x37b05f={};_0x37b05f[_0x503c55]={'$like':'%'+_0x136e89['query'][_0x7b60('0x4f')]+'%'};return _0x37b05f;})});}_0x5c1065=_[_0x7b60('0x50')]({},_0x5c1065,_0x136e89[_0x7b60('0x5a')]);return db[_0x7b60('0x6e')][_0x7b60('0x32')]({'where':_0x5c1065[_0x7b60('0x4d')]})['then'](function(_0xd069aa){_0x25343a['count']=_0xd069aa;if(_0x136e89[_0x7b60('0x44')]['includeAll']){_0x5c1065[_0x7b60('0x55')]=[{'all':!![]}];}return db[_0x7b60('0x6e')][_0x7b60('0x56')](_0x5c1065);})[_0x7b60('0x22')](function(_0x597ddc){_0x25343a[_0x7b60('0x57')]=_0x597ddc;return _0x25343a;});}})['then'](respondWithFilteredResult(_0x354722,_0x5c1065))[_0x7b60('0x2b')](handleError(_0x354722,null));};exports[_0x7b60('0x70')]=function(_0x129a18,_0xc0c252,_0x13812d){return db[_0x7b60('0x3f')][_0x7b60('0x60')]({'where':{'id':_0x129a18[_0x7b60('0x59')]['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0xc0c252,null))[_0x7b60('0x22')](function(_0x1f658d){if(_0x1f658d){return _0x1f658d['removeAnswers'](_0x129a18['query'][_0x7b60('0x6c')]);}})['then'](respondWithStatusCode(_0xc0c252,null))[_0x7b60('0x2b')](handleError(_0xc0c252,null));};exports['addAgents']=function(_0x290dc7,_0x23a323,_0x28e367){return db[_0x7b60('0x3f')]['find']({'where':{'id':_0x290dc7[_0x7b60('0x59')]['id']}})['then'](handleEntityNotFound(_0x23a323,null))[_0x7b60('0x22')](function(_0x288d1d){if(_0x288d1d){return _0x288d1d[_0x7b60('0x71')](_0x290dc7['body'][_0x7b60('0x6c')],_['omit'](_0x290dc7[_0x7b60('0x64')],['ids','id'])||{})[_0x7b60('0x72')](function(_0x4faa7a){for(var _0x591e3c=0x0;_0x591e3c<_0x290dc7['body']['ids'][_0x7b60('0x4a')];_0x591e3c+=0x1){socket[_0x7b60('0x73')](_0x7b60('0x74'),{'UserId':Number(_0x290dc7['body'][_0x7b60('0x6c')][_0x591e3c]),'WhatsappAccountId':Number(_0x290dc7[_0x7b60('0x59')]['id'])});}return _0x4faa7a;});}})[_0x7b60('0x22')](respondWithResult(_0x23a323,null))['catch'](handleError(_0x23a323,null));};exports[_0x7b60('0x75')]=function(_0x224738,_0x839bf4,_0x47c084){return db[_0x7b60('0x3f')][_0x7b60('0x60')]({'where':{'id':_0x224738[_0x7b60('0x59')]['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0x839bf4,null))['then'](function(_0x7f406d){if(_0x7f406d){return _0x7f406d['removeAgents'](_0x224738['query'][_0x7b60('0x6c')])[_0x7b60('0x22')](function(){if(_[_0x7b60('0x76')](_0x224738[_0x7b60('0x44')]['ids'])){for(var _0x2a6e47=0x0;_0x2a6e47<_0x224738[_0x7b60('0x44')]['ids'][_0x7b60('0x4a')];_0x2a6e47+=0x1){socket[_0x7b60('0x73')](_0x7b60('0x77'),{'UserId':Number(_0x224738['query']['ids'][_0x2a6e47]),'WhatsappAccountId':Number(_0x224738[_0x7b60('0x59')]['id'])});}}else{socket[_0x7b60('0x73')](_0x7b60('0x77'),{'UserId':Number(_0x224738[_0x7b60('0x44')][_0x7b60('0x6c')]),'WhatsappAccountId':Number(_0x224738[_0x7b60('0x59')]['id'])});}});}})[_0x7b60('0x22')](respondWithStatusCode(_0x839bf4,null))['catch'](handleError(_0x839bf4,null));};exports[_0x7b60('0x78')]=function(_0x5cff91,_0x532517,_0x2f9416){var _0x24c574={};var _0x52755b={};var _0x490609;var _0x45d09a;return db[_0x7b60('0x3f')][_0x7b60('0x69')]({'where':{'id':_0x5cff91[_0x7b60('0x59')]['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0x532517,null))[_0x7b60('0x22')](function(_0x5928ce){if(_0x5928ce){_0x490609=_0x5928ce;_0x52755b[_0x7b60('0x43')]=_[_0x7b60('0x45')](db[_0x7b60('0x79')][_0x7b60('0x40')]);_0x52755b[_0x7b60('0x44')]=_[_0x7b60('0x45')](_0x5cff91[_0x7b60('0x44')]);_0x52755b['filters']=_[_0x7b60('0x47')](_0x52755b[_0x7b60('0x43')],_0x52755b[_0x7b60('0x44')]);_0x24c574[_0x7b60('0x49')]=_['intersection'](_0x52755b['model'],qs['fields'](_0x5cff91['query'][_0x7b60('0x48')]));_0x24c574[_0x7b60('0x49')]=_0x24c574['attributes']['length']?_0x24c574[_0x7b60('0x49')]:_0x52755b[_0x7b60('0x43')];_0x24c574[_0x7b60('0x4c')]=qs[_0x7b60('0x6a')](_0x5cff91[_0x7b60('0x44')][_0x7b60('0x6a')]);_0x24c574[_0x7b60('0x4d')]=qs['filters'](_[_0x7b60('0x4e')](_0x5cff91['query'],_0x52755b[_0x7b60('0x46')]));if(_0x5cff91['query']['filter']){_0x24c574[_0x7b60('0x4d')]=_['merge'](_0x24c574[_0x7b60('0x4d')],{'$or':_['map'](_0x24c574[_0x7b60('0x49')],function(_0x3a5025){var _0x4f4997={};_0x4f4997[_0x3a5025]={'$like':'%'+_0x5cff91['query'][_0x7b60('0x4f')]+'%'};return _0x4f4997;})});}_0x24c574=_[_0x7b60('0x50')]({},_0x24c574,_0x5cff91[_0x7b60('0x5a')]);return _0x490609[_0x7b60('0x78')](_0x24c574);}})[_0x7b60('0x22')](function(_0x1ab269){if(_0x1ab269){_0x45d09a=_0x1ab269[_0x7b60('0x4a')];if(!_0x5cff91[_0x7b60('0x44')][_0x7b60('0x4b')](_0x7b60('0x6f'))){_0x24c574[_0x7b60('0x31')]=qs[_0x7b60('0x31')](_0x5cff91[_0x7b60('0x44')][_0x7b60('0x31')]);_0x24c574[_0x7b60('0x2f')]=qs[_0x7b60('0x2f')](_0x5cff91[_0x7b60('0x44')][_0x7b60('0x2f')]);}return _0x490609['getAgents'](_0x24c574);}})[_0x7b60('0x22')](function(_0x4445d5){if(_0x4445d5){return _0x4445d5?{'count':_0x45d09a,'rows':_0x4445d5}:null;}})[_0x7b60('0x22')](respondWithResult(_0x532517,null))[_0x7b60('0x2b')](handleError(_0x532517,null));};exports[_0x7b60('0x7a')]=function(_0x3f772b,_0x74d34f){var _0x44616d=_0x3f772b['params']['id'];var _0x7705bf=_0x3f772b[_0x7b60('0x64')];var _0x1690ac=0xc8;var _0x25fb27=null;return db[_0x7b60('0x7b')][_0x7b60('0x7c')]({'isolationLevel':db[_0x7b60('0x7b')][_0x7b60('0x7d')][_0x7b60('0x7e')]['READ_COMMITTED']},function(_0x4cdddd){return db[_0x7b60('0x3f')]['findOne']({'where':{'id':_0x44616d},'transaction':_0x4cdddd})[_0x7b60('0x22')](function(_0x6e7621){if(_0x6e7621){return db[_0x7b60('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x44616d},'transaction':_0x4cdddd})[_0x7b60('0x22')](function(){var _0x5650b0=_[_0x7b60('0x51')](_0x7705bf,function(_0x1ec9c5){_0x1ec9c5[_0x7b60('0x66')]=_0x44616d;return _0x1ec9c5;});return db[_0x7b60('0x7f')]['bulkCreate'](_0x5650b0,{'transaction':_0x4cdddd});});}else{_0x1690ac=0x194;_0x25fb27=[];}});})['then'](function(){if(_0x1690ac!==0x194){return db[_0x7b60('0x7f')][_0x7b60('0x80')]({'where':{'WhatsappAccountId':_0x44616d},'order':_0x7b60('0x81')})[_0x7b60('0x22')](function(_0x5cb6a6){_0x25fb27=_0x5cb6a6;});}})['catch'](function(_0x4d9ebe){_0x1690ac=0x1f4;logger[_0x7b60('0x28')](_0x4d9ebe[_0x7b60('0x3a')]);if(_0x4d9ebe[_0x7b60('0x3b')]){delete _0x4d9ebe[_0x7b60('0x3b')];}_0x25fb27=_0x4d9ebe;})[_0x7b60('0x82')](function(){if(_0x25fb27===null){_0x74d34f[_0x7b60('0x83')](_0x1690ac);}else{if(_0x1690ac===0x1f4){_0x74d34f['status'](_0x1690ac)[_0x7b60('0x84')](_0x25fb27);}else{_0x74d34f[_0x7b60('0x2c')](_0x1690ac)['json'](_0x25fb27);}}});};exports[_0x7b60('0x85')]=function(_0x1d3e03,_0xafcc9c,_0x33f214){var _0x4621d1={};var _0x277adc={};var _0x22e266;var _0x366399;return db[_0x7b60('0x3f')][_0x7b60('0x69')]({'where':{'id':_0x1d3e03['params']['id']}})[_0x7b60('0x22')](handleEntityNotFound(_0xafcc9c,null))['then'](function(_0x553360){if(_0x553360){_0x22e266=_0x553360;_0x277adc[_0x7b60('0x43')]=_[_0x7b60('0x45')](db[_0x7b60('0x7f')]['rawAttributes']);_0x277adc['query']=_[_0x7b60('0x45')](_0x1d3e03[_0x7b60('0x44')]);_0x277adc[_0x7b60('0x46')]=_[_0x7b60('0x47')](_0x277adc[_0x7b60('0x43')],_0x277adc[_0x7b60('0x44')]);_0x4621d1['attributes']=_[_0x7b60('0x47')](_0x277adc[_0x7b60('0x43')],qs[_0x7b60('0x48')](_0x1d3e03[_0x7b60('0x44')][_0x7b60('0x48')]));_0x4621d1[_0x7b60('0x49')]=_0x4621d1[_0x7b60('0x49')][_0x7b60('0x4a')]?_0x4621d1['attributes']:_0x277adc[_0x7b60('0x43')];_0x4621d1['order']=qs[_0x7b60('0x6a')](_0x1d3e03['query']['sort']);_0x4621d1[_0x7b60('0x4d')]=qs['filters'](_[_0x7b60('0x4e')](_0x1d3e03[_0x7b60('0x44')],_0x277adc[_0x7b60('0x46')]));if(_0x1d3e03['query']['filter']){_0x4621d1[_0x7b60('0x4d')]=_[_0x7b60('0x50')](_0x4621d1['where'],{'$or':_[_0x7b60('0x51')](_0x4621d1[_0x7b60('0x49')],function(_0x109bae){var _0x55c687={};_0x55c687[_0x109bae]={'$like':'%'+_0x1d3e03['query'][_0x7b60('0x4f')]+'%'};return _0x55c687;})});}_0x4621d1=_[_0x7b60('0x50')]({},_0x4621d1,_0x1d3e03[_0x7b60('0x5a')]);return _0x22e266[_0x7b60('0x85')](_0x4621d1);}})[_0x7b60('0x22')](function(_0x32f92d){if(_0x32f92d){_0x366399=_0x32f92d[_0x7b60('0x4a')];if(!_0x1d3e03[_0x7b60('0x44')]['hasOwnProperty'](_0x7b60('0x6f'))){_0x4621d1[_0x7b60('0x31')]=qs[_0x7b60('0x31')](_0x1d3e03['query'][_0x7b60('0x31')]);_0x4621d1['offset']=qs[_0x7b60('0x2f')](_0x1d3e03['query'][_0x7b60('0x2f')]);}return _0x22e266['getApplications'](_0x4621d1);}})['then'](function(_0x181a6f){if(_0x181a6f){return _0x181a6f?{'count':_0x366399,'rows':_0x181a6f}:null;}})['then'](respondWithResult(_0xafcc9c,null))[_0x7b60('0x2b')](handleError(_0xafcc9c,null));};exports[_0x7b60('0x86')]=function(_0x5ed0b3,_0x14bbdf,_0x389c9f){var _0xb035ca={'channel':_0x7b60('0x87')};var _0x47285f=[];var _0x27b575=[];var _0x115a58={};return db['WhatsappAccount'][_0x7b60('0x60')]({'where':{'id':_0x5ed0b3[_0x7b60('0x59')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x7b60('0x22')](handleEntityNotFound(_0x14bbdf,null))[_0x7b60('0x22')](function(_0x215408){_0xb035ca[_0x7b60('0x88')]=_0x215408;if(_0xb035ca[_0x7b60('0x88')]&&_0xb035ca['account'][_0x7b60('0x52')]==='sinch'&&_0x5ed0b3[_0x7b60('0x64')][_0x7b60('0x89')]){if(_0x5ed0b3[_0x7b60('0x64')]['statuses']['length']===0x0)return;if(_0x5ed0b3['body'][_0x7b60('0x89')][0x0][_0x7b60('0x8a')]!=='read')return;return db[_0x7b60('0x8b')][_0x7b60('0x36')]({'read':!![],'readAt':_0x5ed0b3[_0x7b60('0x64')]['statuses'][0x0][_0x7b60('0x8c')]},{'where':{'messageId':_0x5ed0b3['body'][_0x7b60('0x89')][0x0][_0x7b60('0x8d')]},'individualHooks':!![]})[_0x7b60('0x22')](function(_0x40f715){return _0x14bbdf['status'](0xc8)['json'](_0x40f715);});}_0xb035ca['applications']=_[_0x7b60('0x8e')](_0x215408['Applications'],['priority'],[_0x7b60('0x8f')]);if(_0xb035ca['account'][_0x7b60('0x90')]){delete _0xb035ca[_0x7b60('0x88')]['Applications'];}return db[_0x7b60('0x91')][_0x7b60('0x65')]()[_0x7b60('0x22')](function(_0x34f074){if(!_0x34f074){throw new db[(_0x7b60('0x92'))][(_0x7b60('0x93'))]('no\x20available\x20attributes');}_0x47285f=_[_0x7b60('0x94')](_['keys'](_0x34f074),[_0x7b60('0x95'),_0x7b60('0x96')]);_0x27b575=_['difference'](_[_0x7b60('0x45')](_0x34f074),[_0x7b60('0x95'),_0x7b60('0x96'),_0x7b60('0x97'),_0x7b60('0x98')]);_0xb035ca[_0x7b60('0x64')]={'mapKey':_0x7b60('0x99')};if(_0xb035ca[_0x7b60('0x88')]&&_0xb035ca[_0x7b60('0x88')][_0x7b60('0x52')]===_0x7b60('0x9a')){_0xb035ca['body'][_0x7b60('0x9b')]=_0x5ed0b3[_0x7b60('0x64')][_0x7b60('0x9c')][_0x7b60('0x9d')](_0x7b60('0x9e'),'');_0xb035ca[_0x7b60('0x64')][_0x7b60('0x64')]=_0x5ed0b3[_0x7b60('0x64')]['Body'];_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9f')]=_0x5ed0b3[_0x7b60('0x64')][_0x7b60('0xa0')];}if(_0xb035ca[_0x7b60('0x88')]&&_0xb035ca['account']['type']===_0x7b60('0xa1')){_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9b')]=_0x5ed0b3['body'][_0x7b60('0xa2')][0x0][_0x7b60('0x9b')];_0xb035ca[_0x7b60('0x64')][_0x7b60('0x64')]=_0x5ed0b3['body']['notifications'][0x0][_0x7b60('0x29')][_0x7b60('0x64')];_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9f')]=_0x5ed0b3[_0x7b60('0x64')]['notifications'][0x0][_0x7b60('0x8d')];}if(_0xb035ca['body']['id']){delete _0xb035ca[_0x7b60('0x64')]['id'];}if(_[_0x7b60('0xa3')](_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9b')])){throw new db[(_0x7b60('0x92'))][(_0x7b60('0x93'))](_0x7b60('0xa4'));}if(_['isNil'](_0xb035ca[_0x7b60('0x64')][_0x7b60('0x64')])||_0xb035ca[_0x7b60('0x64')][_0x7b60('0x64')]===''){throw new db['Sequelize'][(_0x7b60('0x93'))](_0x7b60('0xa5'));}if(_['isNil'](_0xb035ca[_0x7b60('0x64')][_0x7b60('0xa6')])){throw new db['Sequelize']['ValidationError'](_0x7b60('0xa7')+_0x27b575);}if(!_[_0x7b60('0xa8')](_0x27b575,_0xb035ca[_0x7b60('0x64')][_0x7b60('0xa6')])){throw new db[(_0x7b60('0x92'))][(_0x7b60('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27b575);}_0x115a58[_0xb035ca[_0x7b60('0x64')][_0x7b60('0xa6')]]=_0xb035ca[_0x7b60('0x64')]['from'];return db[_0x7b60('0xa9')][_0x7b60('0x60')]({'where':{'id':_0xb035ca['account'][_0x7b60('0x98')]},'include':[{'model':db[_0x7b60('0x91')],'as':_0x7b60('0xaa'),'where':_0x115a58,'limit':0x1,'order':[[_0x7b60('0x96'),_0x7b60('0xab')]]}]});})['then'](handleEntityNotFound(_0x14bbdf,null))[_0x7b60('0x22')](function(_0x34a483){if(_0x34a483){_0xb035ca['list']=_[_0x7b60('0xac')](_0x34a483,[_0x7b60('0xaa')]);if(_0x34a483['Contacts'][_0x7b60('0x4a')]){return _0x34a483[_0x7b60('0xaa')][0x0];}var _0x3349c6=_['defaults'](_0xb035ca['body'],{'firstName':_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9b')],'ListId':_0x34a483['id']});_0x3349c6[_0xb035ca[_0x7b60('0x64')][_0x7b60('0xa6')]]=_0xb035ca['body']['from'];return db[_0x7b60('0x91')][_0x7b60('0x5b')](_0x3349c6,{'fields':_0x47285f,'raw':!![]});}})[_0x7b60('0x22')](handleEntityNotFound(_0x14bbdf,null))[_0x7b60('0x22')](function(_0x22b403){if(_0x22b403){_0xb035ca[_0x7b60('0xad')]=_0x22b403;var _0xda915a={'ContactId':_0x22b403['id'],'phone':_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9b')],'WhatsappAccountId':_0x5ed0b3[_0x7b60('0x59')]['id']};var _0x270a82={'ContactId':_0x22b403['id'],'WhatsappAccountId':_0x5ed0b3[_0x7b60('0x59')]['id'],'closed':![]};return db[_0x7b60('0xae')][_0x7b60('0x60')]({'where':_0x270a82})[_0x7b60('0x22')](function(_0x17ce09){if(_0x17ce09){return[_0x17ce09,![]];}return db[_0x7b60('0xae')]['create'](_0xda915a)[_0x7b60('0x22')](function(_0xb9bed8){return[_0xb9bed8,!![]];});});}})[_0x7b60('0x72')](function(_0x39086f,_0x468b65){_0xb035ca[_0x7b60('0xaf')]=_0x39086f[_0x7b60('0x38')]({'plain':!![]});_0xb035ca['interaction']['created']=![];if(_0x468b65){if(_0xb035ca[_0x7b60('0x88')][_0x7b60('0xb0')]){_0xb035ca[_0x7b60('0xb1')][_0x7b60('0xb2')]({'id':0x0,'priority':_0xb035ca[_0x7b60('0xb1')][_0x7b60('0x4a')]+0x1,'app':_0x7b60('0xb3'),'appdata':_0x7b60('0xb4'),'interval':_0x7b60('0xb5')});}_0xb035ca[_0x7b60('0xaf')][_0x7b60('0xb6')]=!![];}return db[_0x7b60('0x8b')][_0x7b60('0x5b')]({'phone':_0xb035ca[_0x7b60('0x64')][_0x7b60('0x9b')],'messageId':_0xb035ca['body']['messageId'],'body':_0xb035ca[_0x7b60('0x64')]['body'],'WhatsappAccountId':_0x5ed0b3[_0x7b60('0x59')]['id'],'WhatsappInteractionId':_0x39086f['id'],'direction':'in','ContactId':_0x39086f[_0x7b60('0xb7')],'AttachmentId':_0xb035ca['body']['AttachmentId']});})['then'](function(_0x156f93){_0xb035ca['message']=_0x156f93;if(_0xb035ca['interaction'][_0x7b60('0xb8')]){return db[_0x7b60('0x79')][_0x7b60('0x60')]({'attributes':['id',_0x7b60('0x3b')],'where':{'id':_0xb035ca['interaction'][_0x7b60('0xb8')]}})['then'](function(_0x449250){if(_0x449250){_0xb035ca['applications'][_0x7b60('0xb9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x449250[_0x7b60('0x3b')]+','+(_0xb035ca[_0x7b60('0x88')][_0x7b60('0xba')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7b60('0xbb'),_0x7b60('0xbc'),_0xb035ca);});}return respondWithRpcPromise(_0x7b60('0xbb'),_0x7b60('0xbc'),_0xb035ca);})[_0x7b60('0x22')](function(_0x11cbbf){if(_0x11cbbf){var _0x48c71d=0xc8;var _0x57a85f='receiveMessage';logger[_0x7b60('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x57a85f,_0x48c71d,_0x7b60('0xbd'));logger['debug'](_0x7b60('0xbe'),_0x57a85f,_0x48c71d,_0x7b60('0xbd'),JSON['stringify'](_0x11cbbf));if(_0xb035ca[_0x7b60('0x88')][_0x7b60('0x52')]===_0x7b60('0x9a')){return _0x14bbdf[_0x7b60('0x2c')](_0x48c71d)['set']('Content-Type','text/xml')['send'](_0x7b60('0xbf'));}else{return _0x14bbdf['status'](_0x48c71d)[_0x7b60('0x2e')](_0x11cbbf);}}});})['catch'](handleError(_0x14bbdf,null));};exports[_0x7b60('0x84')]=function(_0x509282,_0x731b80,_0x31cb2c){var _0x44e413,_0xfc3b47,_0x447424;if(_[_0x7b60('0xa3')](_0x509282[_0x7b60('0x64')][_0x7b60('0x64')])||_0x509282[_0x7b60('0x64')]['body']===''){throw new db[(_0x7b60('0x92'))][(_0x7b60('0x93'))](_0x7b60('0xa5'));}if(_[_0x7b60('0xa3')](_0x509282[_0x7b60('0x64')]['to'])){throw new db['Sequelize']['ValidationError'](_0x7b60('0xc0'));}_0x44e413=_0x509282['body']['to'];return db[_0x7b60('0x3f')][_0x7b60('0x60')]({'where':{'id':_0x509282[_0x7b60('0x59')]['id']},'include':[{'model':db[_0x7b60('0xa9')],'as':_0x7b60('0xc1'),'include':[{'model':db[_0x7b60('0x91')],'as':'Contacts','where':{'mobile':_0x44e413},'limit':0x1,'order':[[_0x7b60('0x96'),_0x7b60('0xab')]]}]}]})[_0x7b60('0x22')](handleEntityNotFound(_0x731b80,null))['then'](function(_0x3ba428){if(_0x3ba428&&_0x3ba428[_0x7b60('0xc1')]){_0xfc3b47=_0x3ba428[_0x7b60('0x38')]({'plain':!![]});if(_0xfc3b47[_0x7b60('0xc1')]&&_0xfc3b47[_0x7b60('0xc1')][_0x7b60('0xaa')][_0x7b60('0x4a')]){return _0xfc3b47[_0x7b60('0xc1')][_0x7b60('0xaa')][0x0];}return db[_0x7b60('0x91')][_0x7b60('0x5b')](_[_0x7b60('0x1b')](_0x509282['body'],{'firstName':_0x44e413,'mobile':_0x44e413,'phone':_0x44e413,'ListId':_0xfc3b47[_0x7b60('0x98')]}));}})['then'](handleEntityNotFound(_0x731b80,null))['then'](function(_0x55cd26){if(_0x55cd26){_0x447424=_0x55cd26;return db[_0x7b60('0xae')][_0x7b60('0x60')]({'where':{'ContactId':_0x447424['id'],'closed':![],'WhatsappAccountId':_0xfc3b47['id']}})[_0x7b60('0x22')](function(_0x32fa8d){if(_0x32fa8d){return[_0x32fa8d,![]];}return db['WhatsappInteraction'][_0x7b60('0x5b')]({'UserId':_0x509282[_0x7b60('0x5c')]['id'],'ContactId':_0x447424['id'],'WhatsappAccountId':_0xfc3b47['id'],'phone':_0x44e413,'firstMsgDirection':_0x7b60('0xc2'),'Messages':[_[_0x7b60('0x50')](_0x509282[_0x7b60('0x64')],{'read':![],'body':_0x509282['body'][_0x7b60('0x64')],'phone':_0x44e413,'WhatsappAccountId':_0xfc3b47['id'],'UserId':_0x509282['user']['id'],'ContactId':_0x447424['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x7b60('0xc3')}]})[_0x7b60('0x22')](function(_0x437e4d){return[_0x437e4d,!![]];});});}})[_0x7b60('0x72')](function(_0x35c441,_0x1206bd){if(_0x1206bd){return _0x35c441;}return db['WhatsappMessage'][_0x7b60('0x5b')](_[_0x7b60('0x50')](_0x509282[_0x7b60('0x64')],{'read':![],'body':_0x509282['body'][_0x7b60('0x64')],'phone':_0x44e413,'WhatsappAccountId':_0xfc3b47['id'],'WhatsappInteractionId':_0x35c441['id'],'UserId':_0x509282[_0x7b60('0x5c')]['id'],'ContactId':_0x447424['id']}))[_0x7b60('0x22')](function(_0x341762){_0x35c441[_0x7b60('0xc4')][_0x7b60('0xc3')]=[];_0x35c441[_0x7b60('0xc4')][_0x7b60('0xc3')][_0x7b60('0xb2')](_0x341762['dataValues']);return _0x35c441;});})[_0x7b60('0x22')](respondWithResult(_0x731b80,null))[_0x7b60('0x2b')](handleError(_0x731b80,null));}; \ No newline at end of file +var _0x3061=['getAgents','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','CmContact','DESC','Contacts','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','ids','addAnswer','getAnswers','hasOwnProperty','CannedAnswer','findAll','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove'];(function(_0xb1c5a7,_0x385122){var _0x493885=function(_0x2755d9){while(--_0x2755d9){_0xb1c5a7['push'](_0xb1c5a7['shift']());}};_0x493885(++_0x385122);}(_0x3061,0x113));var _0x1306=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x3061[_0x3a2e49];return _0x257140;};'use strict';var emlformat=require(_0x1306('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1306('0x1'));var rp=require(_0x1306('0x2'));var moment=require(_0x1306('0x3'));var BPromise=require(_0x1306('0x4'));var Mustache=require(_0x1306('0x5'));var util=require(_0x1306('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1306('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1306('0x8'));var _=require(_0x1306('0x9'));var squel=require(_0x1306('0xa'));var crypto=require(_0x1306('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1306('0x7'));var querystring=require(_0x1306('0xc'));var Papa=require(_0x1306('0xd'));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('../../config/license/hardware');var logger=require(_0x1306('0xe'))(_0x1306('0xf'));var utils=require(_0x1306('0x10'));var config=require(_0x1306('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x1306('0x12'))['db'];config[_0x1306('0x13')]=_[_0x1306('0x14')](config[_0x1306('0x13')],{'host':_0x1306('0x15'),'port':0x18eb});var socket=require(_0x1306('0x16'))(new Redis(config[_0x1306('0x13')]));require(_0x1306('0x17'))['register'](socket);var jayson=require(_0x1306('0x18'));var client=jayson['client'][_0x1306('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x2ed6fa,_0x36540f,_0x3bb6a5,_0xe73008){return new BPromise(function(_0x4ab44d,_0x566438){var _0x4644d3=_0xe73008||client;return _0x4644d3[_0x1306('0x1a')](_0x2ed6fa,_0x3bb6a5)[_0x1306('0x1b')](function(_0x424f04){logger[_0x1306('0x1c')](_0x1306('0x1d'),_0x36540f,_0x1306('0x1e'));logger[_0x1306('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x36540f,_0x1306('0x1e'),JSON[_0x1306('0x20')](_0x424f04));if(_0x424f04[_0x1306('0x21')]){if(_0x424f04[_0x1306('0x21')][_0x1306('0x22')]===0x1f4){logger[_0x1306('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x36540f,_0x424f04[_0x1306('0x21')][_0x1306('0x23')]);return _0x566438(_0x424f04[_0x1306('0x21')]['message']);}logger[_0x1306('0x21')](_0x1306('0x1d'),_0x36540f,_0x424f04[_0x1306('0x21')]['message']);return _0x4ab44d(_0x424f04[_0x1306('0x21')][_0x1306('0x23')]);}else{logger['info'](_0x1306('0x1d'),_0x36540f,_0x1306('0x1e'));_0x4ab44d(_0x424f04[_0x1306('0x24')][_0x1306('0x23')]);}})[_0x1306('0x25')](function(_0x4028fa){logger['error'](_0x1306('0x1d'),_0x36540f,_0x4028fa);_0x566438(_0x4028fa);});});}function respondWithStatusCode(_0x87cc52,_0x2ddcc9){_0x2ddcc9=_0x2ddcc9||0xcc;return function(_0x1280e1){if(_0x1280e1){return _0x87cc52[_0x1306('0x26')](_0x2ddcc9);}return _0x87cc52[_0x1306('0x27')](_0x2ddcc9)[_0x1306('0x28')]();};}function respondWithResult(_0xf5988b,_0x2bd304){_0x2bd304=_0x2bd304||0xc8;return function(_0x2796f5){if(_0x2796f5){return _0xf5988b[_0x1306('0x27')](_0x2bd304)[_0x1306('0x29')](_0x2796f5);}};}function respondWithFilteredResult(_0x3259ac,_0x43e100){return function(_0x38a54a){if(_0x38a54a){var _0x24b035=typeof _0x43e100[_0x1306('0x2a')]===_0x1306('0x2b')&&typeof _0x43e100['limit']===_0x1306('0x2b');var _0x56d0a5=_0x38a54a[_0x1306('0x2c')];var _0x4ab879=_0x24b035?0x0:_0x43e100[_0x1306('0x2a')];var _0x2f9766=_0x24b035?_0x38a54a[_0x1306('0x2c')]:_0x43e100[_0x1306('0x2a')]+_0x43e100[_0x1306('0x2d')];var _0x4c221f;if(_0x2f9766>=_0x56d0a5){_0x2f9766=_0x56d0a5;_0x4c221f=0xc8;}else{_0x4c221f=0xce;}_0x3259ac[_0x1306('0x27')](_0x4c221f);return _0x3259ac['set']('Content-Range',_0x4ab879+'-'+_0x2f9766+'/'+_0x56d0a5)['json'](_0x38a54a);}return null;};}function patchUpdates(_0xefa7b4){return function(_0x2734ed){try{jsonpatch[_0x1306('0x2e')](_0x2734ed,_0xefa7b4,!![]);}catch(_0x21a389){return BPromise[_0x1306('0x2f')](_0x21a389);}return _0x2734ed[_0x1306('0x30')]();};}function saveUpdates(_0x665c,_0x36e42d){return function(_0x2c915f){if(_0x2c915f){return _0x2c915f[_0x1306('0x31')](_0x665c)['then'](function(_0x241f1f){return _0x241f1f;});}return null;};}function removeEntity(_0x37ac98,_0x14a3bc){return function(_0x25c81a){if(_0x25c81a){return _0x25c81a[_0x1306('0x32')]()[_0x1306('0x1b')](function(){var _0x31e03a=_0x25c81a[_0x1306('0x33')]({'plain':!![]});var _0x4fbe9e=_0x1306('0x34');return db[_0x1306('0x35')][_0x1306('0x32')]({'where':{'type':_0x4fbe9e,'resourceId':_0x31e03a['id']}})['then'](function(){return _0x25c81a;});})['then'](function(){_0x37ac98[_0x1306('0x27')](0xcc)[_0x1306('0x28')]();});}};}function handleEntityNotFound(_0x13bb5e,_0xd7bb65){return function(_0x3b7e9e){if(!_0x3b7e9e){_0x13bb5e[_0x1306('0x26')](0x194);}return _0x3b7e9e;};}function handleError(_0x9ae074,_0xb32de2){_0xb32de2=_0xb32de2||0x1f4;return function(_0x5e5b0b){logger[_0x1306('0x21')](_0x5e5b0b['stack']);if(_0x5e5b0b[_0x1306('0x36')]){delete _0x5e5b0b[_0x1306('0x36')];}_0x9ae074[_0x1306('0x27')](_0xb32de2)[_0x1306('0x37')](_0x5e5b0b);};}exports[_0x1306('0x38')]=function(_0x98cab8,_0x5884a7){var _0x1f8d07={'include':[{'model':db['Pause'],'as':_0x1306('0x39')}]},_0x543c7f={},_0x350e98={'count':0x0,'rows':[]};var _0x235eb8=_[_0x1306('0x3a')](db[_0x1306('0x3b')]['rawAttributes'],function(_0x300b2e){return{'name':_0x300b2e[_0x1306('0x3c')],'type':_0x300b2e[_0x1306('0x3d')][_0x1306('0x3e')]};});_0x543c7f['model']=_['map'](_0x235eb8,_0x1306('0x36'));_0x543c7f[_0x1306('0x3f')]=_[_0x1306('0x40')](_0x98cab8[_0x1306('0x3f')]);_0x543c7f['filters']=_[_0x1306('0x41')](_0x543c7f[_0x1306('0x42')],_0x543c7f[_0x1306('0x3f')]);_0x1f8d07[_0x1306('0x43')]=_[_0x1306('0x41')](_0x543c7f[_0x1306('0x42')],qs[_0x1306('0x44')](_0x98cab8[_0x1306('0x3f')][_0x1306('0x44')]));_0x1f8d07[_0x1306('0x43')]=_0x1f8d07[_0x1306('0x43')][_0x1306('0x45')]?_0x1f8d07[_0x1306('0x43')]:_0x543c7f['model'];if(!_0x98cab8[_0x1306('0x3f')]['hasOwnProperty'](_0x1306('0x46'))){_0x1f8d07[_0x1306('0x2d')]=qs['limit'](_0x98cab8[_0x1306('0x3f')][_0x1306('0x2d')]);_0x1f8d07[_0x1306('0x2a')]=qs[_0x1306('0x2a')](_0x98cab8[_0x1306('0x3f')][_0x1306('0x2a')]);}_0x1f8d07['order']=qs[_0x1306('0x47')](_0x98cab8['query'][_0x1306('0x47')]);_0x1f8d07[_0x1306('0x48')]=qs[_0x1306('0x49')](_[_0x1306('0x4a')](_0x98cab8['query'],_0x543c7f[_0x1306('0x49')]),_0x235eb8);if(_0x98cab8['query'][_0x1306('0x4b')]){_0x1f8d07[_0x1306('0x48')]=_['merge'](_0x1f8d07['where'],{'$or':_[_0x1306('0x3a')](_0x235eb8,function(_0x324c0d){if(_0x324c0d[_0x1306('0x3d')]!==_0x1306('0x4c')){var _0x3b14ca={};_0x3b14ca[_0x324c0d[_0x1306('0x36')]]={'$like':'%'+_0x98cab8[_0x1306('0x3f')][_0x1306('0x4b')]+'%'};return _0x3b14ca;}})});}_0x1f8d07=_[_0x1306('0x4d')]({},_0x1f8d07,_0x98cab8[_0x1306('0x4e')]);var _0x1d09d1={'where':_0x1f8d07['where']};return db[_0x1306('0x3b')][_0x1306('0x2c')](_0x1d09d1)[_0x1306('0x1b')](function(_0x131c5b){_0x350e98[_0x1306('0x2c')]=_0x131c5b;if(_0x98cab8[_0x1306('0x3f')][_0x1306('0x4f')]){_0x1f8d07[_0x1306('0x50')]=[{'all':!![]}];}return db[_0x1306('0x3b')]['findAll'](_0x1f8d07);})[_0x1306('0x1b')](function(_0x3bb1a6){_0x350e98[_0x1306('0x51')]=_0x3bb1a6;return _0x350e98;})['then'](respondWithFilteredResult(_0x5884a7,_0x1f8d07))[_0x1306('0x25')](handleError(_0x5884a7,null));};exports['show']=function(_0x5c9076,_0x2bdb3b){var _0x28300b={'raw':![],'where':{'id':_0x5c9076['params']['id']},'include':[{'model':db[_0x1306('0x52')],'as':_0x1306('0x39')}]},_0x1a781c={};_0x1a781c[_0x1306('0x42')]=_['keys'](db[_0x1306('0x3b')]['rawAttributes']);_0x1a781c['query']=_['keys'](_0x5c9076['query']);_0x1a781c['filters']=_[_0x1306('0x41')](_0x1a781c['model'],_0x1a781c['query']);_0x28300b[_0x1306('0x43')]=_['intersection'](_0x1a781c[_0x1306('0x42')],qs[_0x1306('0x44')](_0x5c9076[_0x1306('0x3f')]['fields']));_0x28300b[_0x1306('0x43')]=_0x28300b[_0x1306('0x43')][_0x1306('0x45')]?_0x28300b['attributes']:_0x1a781c[_0x1306('0x42')];if(_0x5c9076[_0x1306('0x3f')][_0x1306('0x4f')]){_0x28300b['include']=[{'all':!![]}];}_0x28300b=_[_0x1306('0x4d')]({},_0x28300b,_0x5c9076[_0x1306('0x4e')]);return db['WhatsappAccount'][_0x1306('0x53')](_0x28300b)['then'](handleEntityNotFound(_0x2bdb3b,null))[_0x1306('0x1b')](respondWithResult(_0x2bdb3b,null))[_0x1306('0x25')](handleError(_0x2bdb3b,null));};exports[_0x1306('0x54')]=function(_0x22ff11,_0x3e8668){return db[_0x1306('0x3b')]['create'](_0x22ff11[_0x1306('0x55')],{})[_0x1306('0x1b')](function(_0xb40859){var _0x365fbb=_0x22ff11[_0x1306('0x56')][_0x1306('0x33')]({'plain':!![]});if(!_0x365fbb)throw new Error(_0x1306('0x57'));if(_0x365fbb[_0x1306('0x58')]===_0x1306('0x56')){var _0xb55b2a=_0xb40859[_0x1306('0x33')]({'plain':!![]});var _0x214b55='WhatsappAccounts';return db[_0x1306('0x59')][_0x1306('0x53')]({'where':{'name':_0x214b55,'userProfileId':_0x365fbb['userProfileId']},'raw':!![]})['then'](function(_0x5e20b1){if(_0x5e20b1&&_0x5e20b1[_0x1306('0x5a')]===0x0){return db[_0x1306('0x35')][_0x1306('0x54')]({'name':_0xb55b2a[_0x1306('0x36')],'resourceId':_0xb55b2a['id'],'type':_0x5e20b1[_0x1306('0x36')],'sectionId':_0x5e20b1['id']},{})[_0x1306('0x1b')](function(){return _0xb40859;});}else{return _0xb40859;}})['catch'](function(_0x324cec){logger[_0x1306('0x21')](_0x1306('0x5b'),_0x324cec);throw _0x324cec;});}return _0xb40859;})['then'](respondWithResult(_0x3e8668,0xc9))['catch'](handleError(_0x3e8668,null));};exports['update']=function(_0x1c3e52,_0x549c2e){if(_0x1c3e52[_0x1306('0x55')]['id']){delete _0x1c3e52[_0x1306('0x55')]['id'];}return db[_0x1306('0x3b')][_0x1306('0x53')]({'where':{'id':_0x1c3e52[_0x1306('0x5c')]['id']},'include':[{'model':db[_0x1306('0x52')],'as':_0x1306('0x39')}]})[_0x1306('0x1b')](handleEntityNotFound(_0x549c2e,null))['then'](saveUpdates(_0x1c3e52[_0x1306('0x55')],null))['then'](respondWithResult(_0x549c2e,null))['catch'](handleError(_0x549c2e,null));};exports[_0x1306('0x32')]=function(_0x2cac06,_0x544a8b){return db[_0x1306('0x3b')]['find']({'where':{'id':_0x2cac06['params']['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0x544a8b,null))['then'](removeEntity(_0x544a8b,null))[_0x1306('0x25')](handleError(_0x544a8b,null));};exports[_0x1306('0x5d')]=function(_0x4d4fa5,_0x586bf8){return db['WhatsappAccount'][_0x1306('0x5d')]()[_0x1306('0x1b')](respondWithResult(_0x586bf8,null))['catch'](handleError(_0x586bf8,null));};exports[_0x1306('0x5e')]=function(_0x1bee22,_0x3ce223,_0x5f2d9c){if(_0x1bee22[_0x1306('0x55')]['id']){delete _0x1bee22[_0x1306('0x55')]['id'];}return db[_0x1306('0x3b')][_0x1306('0x53')]({'where':{'id':_0x1bee22['params']['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0x3ce223,null))[_0x1306('0x1b')](function(_0x29e0a8){if(_0x29e0a8){_0x1bee22[_0x1306('0x55')][_0x1306('0x5f')]=_0x29e0a8['id'];return db[_0x1306('0x60')][_0x1306('0x54')](_0x1bee22[_0x1306('0x55')]);}})[_0x1306('0x1b')](respondWithResult(_0x3ce223,null))[_0x1306('0x25')](handleError(_0x3ce223,null));};exports[_0x1306('0x61')]=function(_0x2e7e8a,_0x57e0a1,_0x4e400b){var _0x187f50={'raw':![],'where':{}};var _0xe89738={};var _0x3b3ea5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1306('0x62')]({'where':{'id':_0x2e7e8a[_0x1306('0x5c')]['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0x57e0a1,null))[_0x1306('0x1b')](function(_0x5e97d6){if(_0x5e97d6){_0xe89738['model']=_[_0x1306('0x40')](db[_0x1306('0x60')][_0x1306('0x63')]);_0xe89738[_0x1306('0x3f')]=_[_0x1306('0x40')](_0x2e7e8a[_0x1306('0x3f')]);_0xe89738[_0x1306('0x49')]=_[_0x1306('0x41')](_0xe89738[_0x1306('0x42')],_0xe89738['query']);_0x187f50[_0x1306('0x43')]=_[_0x1306('0x41')](_0xe89738['model'],qs['fields'](_0x2e7e8a[_0x1306('0x3f')][_0x1306('0x44')]));_0x187f50[_0x1306('0x43')]=_0x187f50[_0x1306('0x43')]['length']?_0x187f50[_0x1306('0x43')]:_0xe89738[_0x1306('0x42')];if(!_0x2e7e8a[_0x1306('0x3f')]['hasOwnProperty']('nolimit')){_0x187f50['limit']=qs[_0x1306('0x2d')](_0x2e7e8a[_0x1306('0x3f')][_0x1306('0x2d')]);_0x187f50['offset']=qs[_0x1306('0x2a')](_0x2e7e8a[_0x1306('0x3f')][_0x1306('0x2a')]);}_0x187f50[_0x1306('0x64')]=qs[_0x1306('0x47')](_0x2e7e8a[_0x1306('0x3f')][_0x1306('0x47')]);_0x187f50[_0x1306('0x48')]=qs[_0x1306('0x49')](_[_0x1306('0x4a')](_0x2e7e8a[_0x1306('0x3f')],_0xe89738[_0x1306('0x49')]));_0x187f50[_0x1306('0x48')][_0x1306('0x5f')]=_0x5e97d6['id'];if(_0x2e7e8a[_0x1306('0x3f')][_0x1306('0x4b')]){_0x187f50[_0x1306('0x48')]=_[_0x1306('0x4d')](_0x187f50[_0x1306('0x48')],{'$or':_[_0x1306('0x3a')](_0x187f50[_0x1306('0x43')],function(_0x4e50ad){var _0x26fec5={};_0x26fec5[_0x4e50ad]={'$like':'%'+_0x2e7e8a['query'][_0x1306('0x4b')]+'%'};return _0x26fec5;})});}_0x187f50=_[_0x1306('0x4d')]({},_0x187f50,_0x2e7e8a[_0x1306('0x4e')]);return db[_0x1306('0x60')][_0x1306('0x2c')]({'where':_0x187f50[_0x1306('0x48')]})[_0x1306('0x1b')](function(_0x329f4f){_0x3b3ea5['count']=_0x329f4f;if(_0x2e7e8a[_0x1306('0x3f')][_0x1306('0x4f')]){_0x187f50['include']=[{'all':!![]}];}return db[_0x1306('0x60')]['findAll'](_0x187f50);})['then'](function(_0x2257b6){_0x3b3ea5[_0x1306('0x51')]=_0x2257b6;return _0x3b3ea5;});}})['then'](respondWithFilteredResult(_0x57e0a1,_0x187f50))[_0x1306('0x25')](handleError(_0x57e0a1,null));};exports[_0x1306('0x65')]=function(_0x569b50,_0x4fef43,_0x3b720d){return db[_0x1306('0x3b')][_0x1306('0x53')]({'where':{'id':_0x569b50[_0x1306('0x5c')]['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0x4fef43,null))[_0x1306('0x1b')](function(_0x48bce0){if(_0x48bce0){return _0x48bce0[_0x1306('0x65')](_0x569b50[_0x1306('0x3f')][_0x1306('0x66')]);}})[_0x1306('0x1b')](respondWithStatusCode(_0x4fef43,null))[_0x1306('0x25')](handleError(_0x4fef43,null));};exports[_0x1306('0x67')]=function(_0x594c34,_0xe2a4bc,_0x294a55){if(_0x594c34[_0x1306('0x55')]['id']){delete _0x594c34[_0x1306('0x55')]['id'];}return db[_0x1306('0x3b')][_0x1306('0x53')]({'where':{'id':_0x594c34[_0x1306('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe2a4bc,null))[_0x1306('0x1b')](function(_0x5398f1){if(_0x5398f1){_0x594c34[_0x1306('0x55')][_0x1306('0x5f')]=_0x5398f1['id'];return db['CannedAnswer'][_0x1306('0x54')](_0x594c34['body']);}})[_0x1306('0x1b')](respondWithResult(_0xe2a4bc,null))['catch'](handleError(_0xe2a4bc,null));};exports[_0x1306('0x68')]=function(_0x6e733f,_0xa9b3d3,_0x3dd150){var _0x552d36={'raw':![],'where':{}};var _0x57a92e={};var _0x667fc0={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1306('0x62')]({'where':{'id':_0x6e733f[_0x1306('0x5c')]['id']}})['then'](handleEntityNotFound(_0xa9b3d3,null))['then'](function(_0x42defa){if(_0x42defa){_0x57a92e['model']=_[_0x1306('0x40')](db['CannedAnswer'][_0x1306('0x63')]);_0x57a92e[_0x1306('0x3f')]=_[_0x1306('0x40')](_0x6e733f[_0x1306('0x3f')]);_0x57a92e[_0x1306('0x49')]=_[_0x1306('0x41')](_0x57a92e[_0x1306('0x42')],_0x57a92e[_0x1306('0x3f')]);_0x552d36[_0x1306('0x43')]=_[_0x1306('0x41')](_0x57a92e[_0x1306('0x42')],qs[_0x1306('0x44')](_0x6e733f['query']['fields']));_0x552d36['attributes']=_0x552d36['attributes']['length']?_0x552d36['attributes']:_0x57a92e[_0x1306('0x42')];if(!_0x6e733f[_0x1306('0x3f')][_0x1306('0x69')](_0x1306('0x46'))){_0x552d36[_0x1306('0x2d')]=qs[_0x1306('0x2d')](_0x6e733f[_0x1306('0x3f')]['limit']);_0x552d36[_0x1306('0x2a')]=qs[_0x1306('0x2a')](_0x6e733f[_0x1306('0x3f')][_0x1306('0x2a')]);}_0x552d36[_0x1306('0x64')]=qs['sort'](_0x6e733f[_0x1306('0x3f')][_0x1306('0x47')]);_0x552d36[_0x1306('0x48')]=qs['filters'](_['pick'](_0x6e733f[_0x1306('0x3f')],_0x57a92e[_0x1306('0x49')]));_0x552d36['where'][_0x1306('0x5f')]=_0x42defa['id'];if(_0x6e733f[_0x1306('0x3f')][_0x1306('0x4b')]){_0x552d36[_0x1306('0x48')]=_['merge'](_0x552d36[_0x1306('0x48')],{'$or':_['map'](_0x552d36[_0x1306('0x43')],function(_0x2866df){var _0x115968={};_0x115968[_0x2866df]={'$like':'%'+_0x6e733f[_0x1306('0x3f')][_0x1306('0x4b')]+'%'};return _0x115968;})});}_0x552d36=_[_0x1306('0x4d')]({},_0x552d36,_0x6e733f['options']);return db[_0x1306('0x6a')][_0x1306('0x2c')]({'where':_0x552d36['where']})[_0x1306('0x1b')](function(_0x296d6f){_0x667fc0[_0x1306('0x2c')]=_0x296d6f;if(_0x6e733f[_0x1306('0x3f')]['includeAll']){_0x552d36[_0x1306('0x50')]=[{'all':!![]}];}return db[_0x1306('0x6a')][_0x1306('0x6b')](_0x552d36);})[_0x1306('0x1b')](function(_0x460291){_0x667fc0[_0x1306('0x51')]=_0x460291;return _0x667fc0;});}})[_0x1306('0x1b')](respondWithFilteredResult(_0xa9b3d3,_0x552d36))['catch'](handleError(_0xa9b3d3,null));};exports['removeAnswers']=function(_0x190c31,_0x461528,_0x3a76ad){return db['WhatsappAccount'][_0x1306('0x53')]({'where':{'id':_0x190c31[_0x1306('0x5c')]['id']}})['then'](handleEntityNotFound(_0x461528,null))[_0x1306('0x1b')](function(_0x474a5d){if(_0x474a5d){return _0x474a5d[_0x1306('0x6c')](_0x190c31['query'][_0x1306('0x66')]);}})[_0x1306('0x1b')](respondWithStatusCode(_0x461528,null))['catch'](handleError(_0x461528,null));};exports[_0x1306('0x6d')]=function(_0x34cc9b,_0xbf9f9f,_0x1c2051){return db['WhatsappAccount'][_0x1306('0x53')]({'where':{'id':_0x34cc9b[_0x1306('0x5c')]['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0xbf9f9f,null))[_0x1306('0x1b')](function(_0x5ab370){if(_0x5ab370){return _0x5ab370[_0x1306('0x6d')](_0x34cc9b[_0x1306('0x55')][_0x1306('0x66')],_[_0x1306('0x6e')](_0x34cc9b[_0x1306('0x55')],['ids','id'])||{})[_0x1306('0x6f')](function(_0x90222f){for(var _0x28cc1a=0x0;_0x28cc1a<_0x34cc9b[_0x1306('0x55')][_0x1306('0x66')][_0x1306('0x45')];_0x28cc1a+=0x1){socket[_0x1306('0x70')](_0x1306('0x71'),{'UserId':Number(_0x34cc9b[_0x1306('0x55')][_0x1306('0x66')][_0x28cc1a]),'WhatsappAccountId':Number(_0x34cc9b[_0x1306('0x5c')]['id'])});}return _0x90222f;});}})[_0x1306('0x1b')](respondWithResult(_0xbf9f9f,null))[_0x1306('0x25')](handleError(_0xbf9f9f,null));};exports[_0x1306('0x72')]=function(_0x36f902,_0x3baa5f,_0x424084){return db[_0x1306('0x3b')][_0x1306('0x53')]({'where':{'id':_0x36f902[_0x1306('0x5c')]['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0x3baa5f,null))['then'](function(_0x20eab2){if(_0x20eab2){return _0x20eab2[_0x1306('0x72')](_0x36f902[_0x1306('0x3f')][_0x1306('0x66')])[_0x1306('0x1b')](function(){if(_[_0x1306('0x73')](_0x36f902['query'][_0x1306('0x66')])){for(var _0x524d48=0x0;_0x524d48<_0x36f902[_0x1306('0x3f')]['ids']['length'];_0x524d48+=0x1){socket[_0x1306('0x70')](_0x1306('0x74'),{'UserId':Number(_0x36f902[_0x1306('0x3f')][_0x1306('0x66')][_0x524d48]),'WhatsappAccountId':Number(_0x36f902[_0x1306('0x5c')]['id'])});}}else{socket['emit'](_0x1306('0x74'),{'UserId':Number(_0x36f902[_0x1306('0x3f')][_0x1306('0x66')]),'WhatsappAccountId':Number(_0x36f902['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3baa5f,null))[_0x1306('0x25')](handleError(_0x3baa5f,null));};exports['getAgents']=function(_0x41dba7,_0x3cfcc7,_0x27a479){var _0x5de30a={};var _0x36eac0={};var _0x4ece85;var _0x114c0d;return db[_0x1306('0x3b')]['findOne']({'where':{'id':_0x41dba7[_0x1306('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3cfcc7,null))[_0x1306('0x1b')](function(_0x84b503){if(_0x84b503){_0x4ece85=_0x84b503;_0x36eac0['model']=_[_0x1306('0x40')](db['User'][_0x1306('0x63')]);_0x36eac0[_0x1306('0x3f')]=_[_0x1306('0x40')](_0x41dba7[_0x1306('0x3f')]);_0x36eac0['filters']=_[_0x1306('0x41')](_0x36eac0[_0x1306('0x42')],_0x36eac0[_0x1306('0x3f')]);_0x5de30a[_0x1306('0x43')]=_[_0x1306('0x41')](_0x36eac0['model'],qs[_0x1306('0x44')](_0x41dba7[_0x1306('0x3f')]['fields']));_0x5de30a['attributes']=_0x5de30a[_0x1306('0x43')]['length']?_0x5de30a[_0x1306('0x43')]:_0x36eac0[_0x1306('0x42')];_0x5de30a[_0x1306('0x64')]=qs['sort'](_0x41dba7[_0x1306('0x3f')][_0x1306('0x47')]);_0x5de30a[_0x1306('0x48')]=qs[_0x1306('0x49')](_[_0x1306('0x4a')](_0x41dba7[_0x1306('0x3f')],_0x36eac0[_0x1306('0x49')]));if(_0x41dba7[_0x1306('0x3f')][_0x1306('0x4b')]){_0x5de30a[_0x1306('0x48')]=_['merge'](_0x5de30a[_0x1306('0x48')],{'$or':_['map'](_0x5de30a[_0x1306('0x43')],function(_0x480a44){var _0x5c461d={};_0x5c461d[_0x480a44]={'$like':'%'+_0x41dba7[_0x1306('0x3f')][_0x1306('0x4b')]+'%'};return _0x5c461d;})});}_0x5de30a=_[_0x1306('0x4d')]({},_0x5de30a,_0x41dba7['options']);return _0x4ece85['getAgents'](_0x5de30a);}})[_0x1306('0x1b')](function(_0x185609){if(_0x185609){_0x114c0d=_0x185609[_0x1306('0x45')];if(!_0x41dba7[_0x1306('0x3f')][_0x1306('0x69')]('nolimit')){_0x5de30a['limit']=qs[_0x1306('0x2d')](_0x41dba7[_0x1306('0x3f')]['limit']);_0x5de30a['offset']=qs['offset'](_0x41dba7['query'][_0x1306('0x2a')]);}return _0x4ece85[_0x1306('0x75')](_0x5de30a);}})['then'](function(_0x26b676){if(_0x26b676){return _0x26b676?{'count':_0x114c0d,'rows':_0x26b676}:null;}})[_0x1306('0x1b')](respondWithResult(_0x3cfcc7,null))[_0x1306('0x25')](handleError(_0x3cfcc7,null));};exports['addApplications']=function(_0xd8c68c,_0x554106){var _0x12d980=_0xd8c68c['params']['id'];var _0x1fe8ce=_0xd8c68c[_0x1306('0x55')];var _0x48d756=0xc8;var _0x21397a=null;return db[_0x1306('0x76')]['transaction']({'isolationLevel':db['sequelize'][_0x1306('0x77')][_0x1306('0x78')][_0x1306('0x79')]},function(_0x5b435a){return db['WhatsappAccount'][_0x1306('0x62')]({'where':{'id':_0x12d980},'transaction':_0x5b435a})['then'](function(_0x4eae37){if(_0x4eae37){return db[_0x1306('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x12d980},'transaction':_0x5b435a})[_0x1306('0x1b')](function(){var _0x2db5b8=_['map'](_0x1fe8ce,function(_0xa5e7c8){_0xa5e7c8[_0x1306('0x5f')]=_0x12d980;return _0xa5e7c8;});return db['WhatsappApplication'][_0x1306('0x7b')](_0x2db5b8,{'transaction':_0x5b435a});});}else{_0x48d756=0x194;_0x21397a=[];}});})[_0x1306('0x1b')](function(){if(_0x48d756!==0x194){return db[_0x1306('0x7a')][_0x1306('0x7c')]({'where':{'WhatsappAccountId':_0x12d980},'order':'priority'})[_0x1306('0x1b')](function(_0x5719c3){_0x21397a=_0x5719c3;});}})[_0x1306('0x25')](function(_0x129a65){_0x48d756=0x1f4;logger[_0x1306('0x21')](_0x129a65[_0x1306('0x7d')]);if(_0x129a65[_0x1306('0x36')]){delete _0x129a65[_0x1306('0x36')];}_0x21397a=_0x129a65;})[_0x1306('0x7e')](function(){if(_0x21397a===null){_0x554106[_0x1306('0x26')](_0x48d756);}else{if(_0x48d756===0x1f4){_0x554106[_0x1306('0x27')](_0x48d756)['send'](_0x21397a);}else{_0x554106[_0x1306('0x27')](_0x48d756)[_0x1306('0x29')](_0x21397a);}}});};exports['getApplications']=function(_0x9c2d,_0x4b101e,_0x38c199){var _0xeb1838={};var _0x271ad3={};var _0x3e8f58;var _0x77288a;return db['WhatsappAccount'][_0x1306('0x62')]({'where':{'id':_0x9c2d[_0x1306('0x5c')]['id']}})[_0x1306('0x1b')](handleEntityNotFound(_0x4b101e,null))[_0x1306('0x1b')](function(_0x5e2024){if(_0x5e2024){_0x3e8f58=_0x5e2024;_0x271ad3[_0x1306('0x42')]=_['keys'](db['WhatsappApplication'][_0x1306('0x63')]);_0x271ad3[_0x1306('0x3f')]=_[_0x1306('0x40')](_0x9c2d[_0x1306('0x3f')]);_0x271ad3['filters']=_[_0x1306('0x41')](_0x271ad3[_0x1306('0x42')],_0x271ad3[_0x1306('0x3f')]);_0xeb1838[_0x1306('0x43')]=_[_0x1306('0x41')](_0x271ad3[_0x1306('0x42')],qs[_0x1306('0x44')](_0x9c2d[_0x1306('0x3f')]['fields']));_0xeb1838['attributes']=_0xeb1838[_0x1306('0x43')][_0x1306('0x45')]?_0xeb1838[_0x1306('0x43')]:_0x271ad3[_0x1306('0x42')];_0xeb1838[_0x1306('0x64')]=qs[_0x1306('0x47')](_0x9c2d[_0x1306('0x3f')][_0x1306('0x47')]);_0xeb1838[_0x1306('0x48')]=qs['filters'](_['pick'](_0x9c2d[_0x1306('0x3f')],_0x271ad3[_0x1306('0x49')]));if(_0x9c2d[_0x1306('0x3f')][_0x1306('0x4b')]){_0xeb1838['where']=_[_0x1306('0x4d')](_0xeb1838[_0x1306('0x48')],{'$or':_[_0x1306('0x3a')](_0xeb1838[_0x1306('0x43')],function(_0x4dad05){var _0x3658d4={};_0x3658d4[_0x4dad05]={'$like':'%'+_0x9c2d['query']['filter']+'%'};return _0x3658d4;})});}_0xeb1838=_['merge']({},_0xeb1838,_0x9c2d[_0x1306('0x4e')]);return _0x3e8f58[_0x1306('0x7f')](_0xeb1838);}})['then'](function(_0xcc5638){if(_0xcc5638){_0x77288a=_0xcc5638[_0x1306('0x45')];if(!_0x9c2d[_0x1306('0x3f')][_0x1306('0x69')](_0x1306('0x46'))){_0xeb1838[_0x1306('0x2d')]=qs['limit'](_0x9c2d[_0x1306('0x3f')]['limit']);_0xeb1838[_0x1306('0x2a')]=qs[_0x1306('0x2a')](_0x9c2d['query'][_0x1306('0x2a')]);}return _0x3e8f58[_0x1306('0x7f')](_0xeb1838);}})[_0x1306('0x1b')](function(_0x46cdf6){if(_0x46cdf6){return _0x46cdf6?{'count':_0x77288a,'rows':_0x46cdf6}:null;}})[_0x1306('0x1b')](respondWithResult(_0x4b101e,null))[_0x1306('0x25')](handleError(_0x4b101e,null));};exports[_0x1306('0x80')]=function(_0x1dec4d,_0x4473e9,_0x3541ee){var _0xcfb3bf={'channel':_0x1306('0x81')};var _0x51e41f=[];var _0x4eb9a4=[];var _0x425a95={};return db[_0x1306('0x3b')][_0x1306('0x53')]({'where':{'id':_0x1dec4d[_0x1306('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1306('0x82')}]})[_0x1306('0x1b')](handleEntityNotFound(_0x4473e9,null))['then'](function(_0xc6767c){_0xcfb3bf[_0x1306('0x83')]=_0xc6767c;if(_0xcfb3bf['account']&&_0xcfb3bf[_0x1306('0x83')][_0x1306('0x3d')]===_0x1306('0x84')&&_0x1dec4d[_0x1306('0x55')]['statuses']){if(_0x1dec4d[_0x1306('0x55')][_0x1306('0x85')][_0x1306('0x45')]===0x0)return;if(_0x1dec4d[_0x1306('0x55')][_0x1306('0x85')][0x0][_0x1306('0x86')]!==_0x1306('0x87'))return;return db[_0x1306('0x88')]['update']({'read':!![],'readAt':_0x1dec4d[_0x1306('0x55')]['statuses'][0x0][_0x1306('0x89')]},{'where':{'messageId':_0x1dec4d[_0x1306('0x55')][_0x1306('0x85')][0x0][_0x1306('0x8a')]},'individualHooks':!![]})[_0x1306('0x1b')](function(_0x164aaf){return _0x4473e9['status'](0xc8)[_0x1306('0x29')](_0x164aaf);});}_0xcfb3bf[_0x1306('0x8b')]=_[_0x1306('0x8c')](_0xc6767c[_0x1306('0x82')],[_0x1306('0x8d')],['asc']);if(_0xcfb3bf[_0x1306('0x83')][_0x1306('0x82')]){delete _0xcfb3bf[_0x1306('0x83')][_0x1306('0x82')];}return db['CmContact'][_0x1306('0x5d')]()[_0x1306('0x1b')](function(_0x377f46){if(!_0x377f46){throw new db[(_0x1306('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x51e41f=_[_0x1306('0x8f')](_[_0x1306('0x40')](_0x377f46),[_0x1306('0x90'),_0x1306('0x91')]);_0x4eb9a4=_[_0x1306('0x8f')](_[_0x1306('0x40')](_0x377f46),[_0x1306('0x90'),_0x1306('0x91'),_0x1306('0x92'),_0x1306('0x93')]);_0xcfb3bf[_0x1306('0x55')]={'mapKey':_0x1306('0x94')};if(_0xcfb3bf['account']&&_0xcfb3bf['account'][_0x1306('0x3d')]===_0x1306('0x95')){_0xcfb3bf['body'][_0x1306('0x96')]=_0x1dec4d['body'][_0x1306('0x97')][_0x1306('0x98')](_0x1306('0x99'),'');_0xcfb3bf['body'][_0x1306('0x55')]=_0x1dec4d[_0x1306('0x55')][_0x1306('0x9a')];_0xcfb3bf[_0x1306('0x55')][_0x1306('0x9b')]=_0x1dec4d[_0x1306('0x55')][_0x1306('0x9c')];}if(_0xcfb3bf[_0x1306('0x83')]&&_0xcfb3bf['account'][_0x1306('0x3d')]===_0x1306('0x84')){_0xcfb3bf[_0x1306('0x55')]['from']=_0x1dec4d[_0x1306('0x55')]['notifications'][0x0][_0x1306('0x96')];_0xcfb3bf[_0x1306('0x55')]['body']=_0x1dec4d[_0x1306('0x55')][_0x1306('0x9d')][0x0][_0x1306('0x23')][_0x1306('0x55')];_0xcfb3bf[_0x1306('0x55')][_0x1306('0x9b')]=_0x1dec4d[_0x1306('0x55')][_0x1306('0x9d')][0x0][_0x1306('0x8a')];}if(_0xcfb3bf[_0x1306('0x55')]['id']){delete _0xcfb3bf[_0x1306('0x55')]['id'];}if(_[_0x1306('0x9e')](_0xcfb3bf[_0x1306('0x55')]['from'])){throw new db[(_0x1306('0x8e'))]['ValidationError'](_0x1306('0x9f'));}if(_[_0x1306('0x9e')](_0xcfb3bf[_0x1306('0x55')][_0x1306('0x55')])||_0xcfb3bf['body'][_0x1306('0x55')]===''){throw new db[(_0x1306('0x8e'))][(_0x1306('0xa0'))](_0x1306('0xa1'));}if(_[_0x1306('0x9e')](_0xcfb3bf['body'][_0x1306('0xa2')])){throw new db[(_0x1306('0x8e'))][(_0x1306('0xa0'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4eb9a4);}if(!_[_0x1306('0xa3')](_0x4eb9a4,_0xcfb3bf[_0x1306('0x55')][_0x1306('0xa2')])){throw new db[(_0x1306('0x8e'))][(_0x1306('0xa0'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4eb9a4);}_0x425a95[_0xcfb3bf[_0x1306('0x55')][_0x1306('0xa2')]]=_0xcfb3bf[_0x1306('0x55')][_0x1306('0x96')];return db[_0x1306('0xa4')][_0x1306('0x53')]({'where':{'id':_0xcfb3bf[_0x1306('0x83')]['ListId']},'include':[{'model':db[_0x1306('0xa5')],'as':'Contacts','where':_0x425a95,'limit':0x1,'order':[[_0x1306('0x91'),_0x1306('0xa6')]]}]});})['then'](handleEntityNotFound(_0x4473e9,null))[_0x1306('0x1b')](function(_0x103d43){if(_0x103d43){_0xcfb3bf['list']=_['omit'](_0x103d43,[_0x1306('0xa7')]);if(_0x103d43['Contacts'][_0x1306('0x45')]){return _0x103d43[_0x1306('0xa7')][0x0];}var _0x14c478=_[_0x1306('0x14')](_0xcfb3bf['body'],{'firstName':_0xcfb3bf['body'][_0x1306('0x96')],'ListId':_0x103d43['id']});_0x14c478[_0xcfb3bf[_0x1306('0x55')][_0x1306('0xa2')]]=_0xcfb3bf['body'][_0x1306('0x96')];return db[_0x1306('0xa5')]['create'](_0x14c478,{'fields':_0x51e41f,'raw':!![]});}})[_0x1306('0x1b')](handleEntityNotFound(_0x4473e9,null))[_0x1306('0x1b')](function(_0x6ad006){if(_0x6ad006){_0xcfb3bf['contact']=_0x6ad006;var _0x4401ff={'ContactId':_0x6ad006['id'],'phone':_0xcfb3bf[_0x1306('0x55')][_0x1306('0x96')],'WhatsappAccountId':_0x1dec4d[_0x1306('0x5c')]['id']};var _0x294dd5={'ContactId':_0x6ad006['id'],'WhatsappAccountId':_0x1dec4d[_0x1306('0x5c')]['id'],'closed':![]};return db[_0x1306('0xa8')]['find']({'where':_0x294dd5})[_0x1306('0x1b')](function(_0x170f59){if(_0x170f59){return[_0x170f59,![]];}return db[_0x1306('0xa8')]['create'](_0x4401ff)[_0x1306('0x1b')](function(_0x5121d2){return[_0x5121d2,!![]];});});}})[_0x1306('0x6f')](function(_0x4115b6,_0x4bfb96){_0xcfb3bf[_0x1306('0xa9')]=_0x4115b6['get']({'plain':!![]});_0xcfb3bf[_0x1306('0xa9')][_0x1306('0xaa')]=![];if(_0x4bfb96){if(_0xcfb3bf[_0x1306('0x83')][_0x1306('0xab')]){_0xcfb3bf[_0x1306('0x8b')][_0x1306('0xac')]({'id':0x0,'priority':_0xcfb3bf[_0x1306('0x8b')][_0x1306('0x45')]+0x1,'app':_0x1306('0xad'),'appdata':_0x1306('0xae'),'interval':'*,*,*,*'});}_0xcfb3bf[_0x1306('0xa9')]['created']=!![];}return db[_0x1306('0x88')][_0x1306('0x54')]({'phone':_0xcfb3bf[_0x1306('0x55')][_0x1306('0x96')],'messageId':_0xcfb3bf[_0x1306('0x55')]['messageId'],'body':_0xcfb3bf[_0x1306('0x55')][_0x1306('0x55')],'WhatsappAccountId':_0x1dec4d[_0x1306('0x5c')]['id'],'WhatsappInteractionId':_0x4115b6['id'],'direction':'in','ContactId':_0x4115b6[_0x1306('0xaf')],'AttachmentId':_0xcfb3bf[_0x1306('0x55')][_0x1306('0xb0')]});})[_0x1306('0x1b')](function(_0x346f0e){_0xcfb3bf[_0x1306('0x23')]=_0x346f0e;if(_0xcfb3bf[_0x1306('0xa9')]['UserId']){return db[_0x1306('0xb1')]['find']({'attributes':['id',_0x1306('0x36')],'where':{'id':_0xcfb3bf['interaction'][_0x1306('0xb2')]}})[_0x1306('0x1b')](function(_0x3217de){if(_0x3217de){_0xcfb3bf['applications'][_0x1306('0xb3')]({'id':0x0,'priority':0x0,'app':_0x1306('0xb4'),'appdata':_0x3217de['name']+','+(_0xcfb3bf['account'][_0x1306('0xb5')]||0xa),'interval':_0x1306('0xb6')});}return respondWithRpcPromise(_0x1306('0xb7'),_0x1306('0xb8'),_0xcfb3bf);});}return respondWithRpcPromise(_0x1306('0xb7'),'startRouting',_0xcfb3bf);})[_0x1306('0x1b')](function(_0x5ae794){if(_0x5ae794){var _0xc22a76=0xc8;var _0x5e5183=_0x1306('0xb9');logger['info'](_0x1306('0xba'),_0x5e5183,_0xc22a76,_0x1306('0xbb'));logger[_0x1306('0x1f')](_0x1306('0xbc'),_0x5e5183,_0xc22a76,_0x1306('0xbb'),JSON[_0x1306('0x20')](_0x5ae794));if(_0xcfb3bf['account'][_0x1306('0x3d')]===_0x1306('0x95')){return _0x4473e9[_0x1306('0x27')](_0xc22a76)['set'](_0x1306('0xbd'),_0x1306('0xbe'))[_0x1306('0x37')](_0x1306('0xbf'));}else{return _0x4473e9['status'](_0xc22a76)[_0x1306('0x29')](_0x5ae794);}}});})[_0x1306('0x25')](handleError(_0x4473e9,null));};exports[_0x1306('0x37')]=function(_0x1b48a2,_0x2511b4,_0x6aa259){var _0x30a5ff,_0xf5447e,_0x38db83;if(_[_0x1306('0x9e')](_0x1b48a2[_0x1306('0x55')]['body'])||_0x1b48a2[_0x1306('0x55')][_0x1306('0x55')]===''){throw new db[(_0x1306('0x8e'))][(_0x1306('0xa0'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1306('0x9e')](_0x1b48a2[_0x1306('0x55')]['to'])){throw new db[(_0x1306('0x8e'))][(_0x1306('0xa0'))](_0x1306('0xc0'));}_0x30a5ff=_0x1b48a2[_0x1306('0x55')]['to'];return db[_0x1306('0x3b')]['find']({'where':{'id':_0x1b48a2['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1306('0xa5')],'as':_0x1306('0xa7'),'where':{'mobile':_0x30a5ff},'limit':0x1,'order':[[_0x1306('0x91'),_0x1306('0xa6')]]}]}]})[_0x1306('0x1b')](handleEntityNotFound(_0x2511b4,null))['then'](function(_0x4bfd9e){if(_0x4bfd9e&&_0x4bfd9e[_0x1306('0xc1')]){_0xf5447e=_0x4bfd9e['get']({'plain':!![]});if(_0xf5447e[_0x1306('0xc1')]&&_0xf5447e[_0x1306('0xc1')][_0x1306('0xa7')][_0x1306('0x45')]){return _0xf5447e[_0x1306('0xc1')][_0x1306('0xa7')][0x0];}return db[_0x1306('0xa5')][_0x1306('0x54')](_[_0x1306('0x14')](_0x1b48a2[_0x1306('0x55')],{'firstName':_0x30a5ff,'mobile':_0x30a5ff,'phone':_0x30a5ff,'ListId':_0xf5447e[_0x1306('0x93')]}));}})[_0x1306('0x1b')](handleEntityNotFound(_0x2511b4,null))[_0x1306('0x1b')](function(_0x49b4e1){if(_0x49b4e1){_0x38db83=_0x49b4e1;return db[_0x1306('0xa8')][_0x1306('0x53')]({'where':{'ContactId':_0x38db83['id'],'closed':![],'WhatsappAccountId':_0xf5447e['id']}})[_0x1306('0x1b')](function(_0x4f6a62){if(_0x4f6a62){return[_0x4f6a62,![]];}return db[_0x1306('0xa8')]['create']({'UserId':_0x1b48a2[_0x1306('0x56')]['id'],'ContactId':_0x38db83['id'],'WhatsappAccountId':_0xf5447e['id'],'phone':_0x30a5ff,'firstMsgDirection':'out','Messages':[_['merge'](_0x1b48a2[_0x1306('0x55')],{'read':![],'body':_0x1b48a2[_0x1306('0x55')]['body'],'phone':_0x30a5ff,'WhatsappAccountId':_0xf5447e['id'],'UserId':_0x1b48a2[_0x1306('0x56')]['id'],'ContactId':_0x38db83['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x1306('0x1b')](function(_0x1ccb80){return[_0x1ccb80,!![]];});});}})[_0x1306('0x6f')](function(_0x6c386e,_0x546b5d){if(_0x546b5d){return _0x6c386e;}return db[_0x1306('0x88')][_0x1306('0x54')](_[_0x1306('0x4d')](_0x1b48a2['body'],{'read':![],'body':_0x1b48a2[_0x1306('0x55')][_0x1306('0x55')],'phone':_0x30a5ff,'WhatsappAccountId':_0xf5447e['id'],'WhatsappInteractionId':_0x6c386e['id'],'UserId':_0x1b48a2['user']['id'],'ContactId':_0x38db83['id']}))['then'](function(_0x30822c){_0x6c386e[_0x1306('0xc2')][_0x1306('0xc3')]=[];_0x6c386e[_0x1306('0xc2')]['Messages'][_0x1306('0xac')](_0x30822c['dataValues']);return _0x6c386e;});})['then'](respondWithResult(_0x2511b4,null))[_0x1306('0x25')](handleError(_0x2511b4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 86d16bf..1fb05cf 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 _0x119f=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hook'];(function(_0x5d846b,_0x582c41){var _0x4dd9e9=function(_0x44c9cd){while(--_0x44c9cd){_0x5d846b['push'](_0x5d846b['shift']());}};_0x4dd9e9(++_0x582c41);}(_0x119f,0x18d));var _0xf119=function(_0x25649b,_0x4ba32c){_0x25649b=_0x25649b-0x0;var _0x1960d9=_0x119f[_0x25649b];return _0x1960d9;};'use strict';var EventEmitter=require(_0xf119('0x0'));var WhatsappAccount=require(_0xf119('0x1'))['db'][_0xf119('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf119('0x3')](0x0);var events={'afterCreate':_0xf119('0x4'),'afterUpdate':'update','afterDestroy':_0xf119('0x5')};function emitEvent(_0x1d8de8){return function(_0x29be40,_0x5a8de1,_0x4d8484){WhatsappAccountEvents[_0xf119('0x6')](_0x1d8de8+':'+_0x29be40['id'],_0x29be40);WhatsappAccountEvents['emit'](_0x1d8de8,_0x29be40);_0x4d8484(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf119('0x7')](e,emitEvent(event));}}module[_0xf119('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x256e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x2ad175,_0x40fe78){var _0x305880=function(_0x5132d0){while(--_0x5132d0){_0x2ad175['push'](_0x2ad175['shift']());}};_0x305880(++_0x40fe78);}(_0x256e,0x16c));var _0xe256=function(_0x32a790,_0x2beb23){_0x32a790=_0x32a790-0x0;var _0x24fc83=_0x256e[_0x32a790];return _0x24fc83;};'use strict';var EventEmitter=require(_0xe256('0x0'));var WhatsappAccount=require(_0xe256('0x1'))['db'][_0xe256('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe256('0x3')](0x0);var events={'afterCreate':_0xe256('0x4'),'afterUpdate':_0xe256('0x5'),'afterDestroy':_0xe256('0x6')};function emitEvent(_0x23b49b){return function(_0x36ef30,_0x48872c,_0x486f6f){WhatsappAccountEvents[_0xe256('0x7')](_0x23b49b+':'+_0x36ef30['id'],_0x36ef30);WhatsappAccountEvents['emit'](_0x23b49b,_0x36ef30);_0x486f6f(null);};}for(var e in events){if(events[_0xe256('0x8')](e)){var event=events[e];WhatsappAccount[_0xe256('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 7eb6b72..aaffa3e 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 _0xe820=['lodash','util','../../config/logger','api','request-promise','rimraf','exports','WhatsappAccount','whatsapp_accounts'];(function(_0x9d4563,_0x3c434d){var _0x5a38a8=function(_0x27fb30){while(--_0x27fb30){_0x9d4563['push'](_0x9d4563['shift']());}};_0x5a38a8(++_0x3c434d);}(_0xe820,0xf3));var _0x0e82=function(_0x3d669e,_0x15b313){_0x3d669e=_0x3d669e-0x0;var _0x1e10fc=_0xe820[_0x3d669e];return _0x1e10fc;};'use strict';var _=require(_0x0e82('0x0'));var util=require(_0x0e82('0x1'));var logger=require(_0x0e82('0x2'))(_0x0e82('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0e82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e82('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x0e82('0x6')]=function(_0x317252,_0x9d0220){return _0x317252['define'](_0x0e82('0x7'),attributes,{'tableName':_0x0e82('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacce=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3de7ef,_0xd1063e){var _0x62a6b7=function(_0x1c18b8){while(--_0x1c18b8){_0x3de7ef['push'](_0x3de7ef['shift']());}};_0x62a6b7(++_0xd1063e);}(_0xacce,0x18a));var _0xeacc=function(_0xcf28d1,_0x58535e){_0xcf28d1=_0xcf28d1-0x0;var _0xd9cd3e=_0xacce[_0xcf28d1];return _0xd9cd3e;};'use strict';var _=require(_0xeacc('0x0'));var util=require(_0xeacc('0x1'));var logger=require(_0xeacc('0x2'))(_0xeacc('0x3'));var moment=require('moment');var BPromise=require(_0xeacc('0x4'));var rp=require(_0xeacc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeacc('0x6'));var config=require(_0xeacc('0x7'));var attributes=require(_0xeacc('0x8'));module['exports']=function(_0x200ec0,_0x247308){return _0x200ec0[_0xeacc('0x9')](_0xeacc('0xa'),attributes,{'tableName':_0xeacc('0xb'),'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 ab59a7e..88e8c7e 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 _0xabf6=['then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xabf6,0x1c4));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6abf('0x0'));var util=require(_0x6abf('0x1'));var moment=require(_0x6abf('0x2'));var BPromise=require(_0x6abf('0x3'));var rs=require(_0x6abf('0x4'));var fs=require('fs');var Redis=require(_0x6abf('0x5'));var db=require(_0x6abf('0x6'))['db'];var utils=require(_0x6abf('0x7'));var logger=require(_0x6abf('0x8'))(_0x6abf('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6abf('0xa')]['http']({'port':0x232a});config[_0x6abf('0xb')]=_[_0x6abf('0xc')](config[_0x6abf('0xb')],{'host':_0x6abf('0xd'),'port':0x18eb});var socket=require(_0x6abf('0xe'))(new Redis(config[_0x6abf('0xb')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2f9b00,_0x1facc4,_0x4cd460){return new BPromise(function(_0xc198ab,_0x355ed){return client[_0x6abf('0xf')](_0x2f9b00,_0x4cd460)[_0x6abf('0x10')](function(_0x311388){logger[_0x6abf('0x11')](_0x6abf('0x12'),_0x1facc4,_0x6abf('0x13'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1facc4,_0x6abf('0x13'),JSON[_0x6abf('0x14')](_0x311388));if(_0x311388[_0x6abf('0x15')]){if(_0x311388[_0x6abf('0x15')][_0x6abf('0x16')]===0x1f4){logger[_0x6abf('0x15')](_0x6abf('0x12'),_0x1facc4,_0x311388[_0x6abf('0x15')][_0x6abf('0x17')]);return _0x355ed(_0x311388[_0x6abf('0x15')][_0x6abf('0x17')]);}logger[_0x6abf('0x15')](_0x6abf('0x12'),_0x1facc4,_0x311388[_0x6abf('0x15')][_0x6abf('0x17')]);return _0xc198ab(_0x311388[_0x6abf('0x15')]['message']);}else{logger[_0x6abf('0x11')](_0x6abf('0x12'),_0x1facc4,_0x6abf('0x13'));_0xc198ab(_0x311388[_0x6abf('0x18')]['message']);}})[_0x6abf('0x19')](function(_0x341b25){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1facc4,_0x341b25);_0x355ed(_0x341b25);});});}exports[_0x6abf('0x1a')]=function(_0x38659a){var _0x2e83fe=this;return new Promise(function(_0x13bf5e,_0x3b0660){return db[_0x6abf('0x1b')][_0x6abf('0x1c')]({'raw':_0x38659a[_0x6abf('0x1d')]?_0x38659a[_0x6abf('0x1d')][_0x6abf('0x1e')]===undefined?!![]:![]:!![],'where':_0x38659a[_0x6abf('0x1d')]?_0x38659a[_0x6abf('0x1d')]['where']||null:null,'attributes':_0x38659a[_0x6abf('0x1d')]?_0x38659a[_0x6abf('0x1d')][_0x6abf('0x1f')]||null:null,'include':_0x38659a['options']?_0x38659a[_0x6abf('0x1d')]['include']?_[_0x6abf('0x20')](_0x38659a[_0x6abf('0x1d')][_0x6abf('0x21')],function(_0x3f37d5){return{'model':db[_0x3f37d5['model']],'as':_0x3f37d5['as'],'attributes':_0x3f37d5[_0x6abf('0x1f')],'include':_0x3f37d5[_0x6abf('0x21')]?_['map'](_0x3f37d5[_0x6abf('0x21')],function(_0x23b0f9){return{'model':db[_0x23b0f9[_0x6abf('0x22')]],'as':_0x23b0f9['as'],'attributes':_0x23b0f9[_0x6abf('0x1f')],'include':_0x23b0f9['include']?_[_0x6abf('0x20')](_0x23b0f9[_0x6abf('0x21')],function(_0x59d1e6){return{'model':db[_0x59d1e6[_0x6abf('0x22')]],'as':_0x59d1e6['as'],'attributes':_0x59d1e6[_0x6abf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6abf('0x10')](function(_0x133131){logger[_0x6abf('0x11')]('ShowWhatsappAccount',_0x38659a);logger[_0x6abf('0x23')](_0x6abf('0x1a'),_0x38659a,JSON[_0x6abf('0x14')](_0x133131));_0x13bf5e(_0x133131);})['catch'](function(_0x159860){logger[_0x6abf('0x15')](_0x6abf('0x1a'),_0x159860[_0x6abf('0x17')],_0x38659a);_0x3b0660(_0x2e83fe[_0x6abf('0x15')](0x1f4,_0x159860[_0x6abf('0x17')]));});});}; \ No newline at end of file +var _0xaad6=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash'];(function(_0x44a408,_0xf0a25c){var _0x3ac07f=function(_0x55fc39){while(--_0x55fc39){_0x44a408['push'](_0x44a408['shift']());}};_0x3ac07f(++_0xf0a25c);}(_0xaad6,0x1ed));var _0x6aad=function(_0xe57b79,_0x584545){_0xe57b79=_0xe57b79-0x0;var _0x4be996=_0xaad6[_0xe57b79];return _0x4be996;};'use strict';var _=require(_0x6aad('0x0'));var util=require('util');var moment=require(_0x6aad('0x1'));var BPromise=require(_0x6aad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6aad('0x3'));var db=require(_0x6aad('0x4'))['db'];var utils=require(_0x6aad('0x5'));var logger=require(_0x6aad('0x6'))(_0x6aad('0x7'));var config=require(_0x6aad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6aad('0x9')][_0x6aad('0xa')]({'port':0x232a});config[_0x6aad('0xb')]=_[_0x6aad('0xc')](config[_0x6aad('0xb')],{'host':_0x6aad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6aad('0xb')]));require('./whatsappAccount.socket')[_0x6aad('0xe')](socket);function respondWithRpcPromise(_0x4c4cb1,_0x4b83a2,_0x2905f5){return new BPromise(function(_0x182c6f,_0x39db08){return client[_0x6aad('0xf')](_0x4c4cb1,_0x2905f5)[_0x6aad('0x10')](function(_0x3119fa){logger[_0x6aad('0x11')](_0x6aad('0x12'),_0x4b83a2,_0x6aad('0x13'));logger[_0x6aad('0x14')](_0x6aad('0x15'),_0x4b83a2,_0x6aad('0x13'),JSON[_0x6aad('0x16')](_0x3119fa));if(_0x3119fa['error']){if(_0x3119fa[_0x6aad('0x17')][_0x6aad('0x18')]===0x1f4){logger[_0x6aad('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x4b83a2,_0x3119fa[_0x6aad('0x17')][_0x6aad('0x19')]);return _0x39db08(_0x3119fa[_0x6aad('0x17')][_0x6aad('0x19')]);}logger[_0x6aad('0x17')](_0x6aad('0x12'),_0x4b83a2,_0x3119fa[_0x6aad('0x17')][_0x6aad('0x19')]);return _0x182c6f(_0x3119fa[_0x6aad('0x17')][_0x6aad('0x19')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4b83a2,_0x6aad('0x13'));_0x182c6f(_0x3119fa[_0x6aad('0x1a')][_0x6aad('0x19')]);}})[_0x6aad('0x1b')](function(_0x5327bd){logger[_0x6aad('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x4b83a2,_0x5327bd);_0x39db08(_0x5327bd);});});}exports['ShowWhatsappAccount']=function(_0x13d581){var _0x11c750=this;return new Promise(function(_0xac240d,_0x2103d4){return db[_0x6aad('0x1c')][_0x6aad('0x1d')]({'raw':_0x13d581[_0x6aad('0x1e')]?_0x13d581[_0x6aad('0x1e')][_0x6aad('0x1f')]===undefined?!![]:![]:!![],'where':_0x13d581[_0x6aad('0x1e')]?_0x13d581[_0x6aad('0x1e')][_0x6aad('0x20')]||null:null,'attributes':_0x13d581[_0x6aad('0x1e')]?_0x13d581[_0x6aad('0x1e')][_0x6aad('0x21')]||null:null,'include':_0x13d581[_0x6aad('0x1e')]?_0x13d581[_0x6aad('0x1e')][_0x6aad('0x22')]?_[_0x6aad('0x23')](_0x13d581[_0x6aad('0x1e')]['include'],function(_0x354156){return{'model':db[_0x354156[_0x6aad('0x24')]],'as':_0x354156['as'],'attributes':_0x354156[_0x6aad('0x21')],'include':_0x354156[_0x6aad('0x22')]?_[_0x6aad('0x23')](_0x354156['include'],function(_0x518046){return{'model':db[_0x518046[_0x6aad('0x24')]],'as':_0x518046['as'],'attributes':_0x518046[_0x6aad('0x21')],'include':_0x518046[_0x6aad('0x22')]?_[_0x6aad('0x23')](_0x518046[_0x6aad('0x22')],function(_0x14f4b7){return{'model':db[_0x14f4b7['model']],'as':_0x14f4b7['as'],'attributes':_0x14f4b7[_0x6aad('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e57c){logger[_0x6aad('0x11')](_0x6aad('0x25'),_0x13d581);logger[_0x6aad('0x14')](_0x6aad('0x25'),_0x13d581,JSON[_0x6aad('0x16')](_0x35e57c));_0xac240d(_0x35e57c);})[_0x6aad('0x1b')](function(_0x22d503){logger[_0x6aad('0x17')](_0x6aad('0x25'),_0x22d503[_0x6aad('0x19')],_0x13d581);_0x2103d4(_0x11c750[_0x6aad('0x17')](0x1f4,_0x22d503[_0x6aad('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3e80953..9d4b19b 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 _0x13c5=['save','remove','emit','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x13c5,0xb5));var _0x513c=function(_0x45e013,_0x402aa9){_0x45e013=_0x45e013-0x0;var _0x5f57b7=_0x13c5[_0x45e013];return _0x5f57b7;};'use strict';var WhatsappAccountEvents=require(_0x513c('0x0'));var events=[_0x513c('0x1'),_0x513c('0x2'),'update'];function createListener(_0x285a7e,_0x1033ea){return function(_0xbd8f66){_0x1033ea[_0x513c('0x3')](_0x285a7e,_0xbd8f66);};}function removeListener(_0x124b58,_0x20cfc2){return function(){WhatsappAccountEvents['removeListener'](_0x124b58,_0x20cfc2);};}exports[_0x513c('0x4')]=function(_0x5bc6ba){for(var _0x46bb36=0x0,_0x4a129e=events[_0x513c('0x5')];_0x46bb36<_0x4a129e;_0x46bb36++){var _0x3a0e00=events[_0x46bb36];var _0x24ec8f=createListener(_0x513c('0x6')+_0x3a0e00,_0x5bc6ba);WhatsappAccountEvents['on'](_0x3a0e00,_0x24ec8f);}}; \ No newline at end of file +var _0xc8c2=['whatsappAccount:','./whatsappAccount.events','save','update','emit','removeListener','register','length'];(function(_0x3ded76,_0x26ee73){var _0x5ee900=function(_0x5e45a8){while(--_0x5e45a8){_0x3ded76['push'](_0x3ded76['shift']());}};_0x5ee900(++_0x26ee73);}(_0xc8c2,0x151));var _0x2c8c=function(_0x47872a,_0x2919a9){_0x47872a=_0x47872a-0x0;var _0x1cc71b=_0xc8c2[_0x47872a];return _0x1cc71b;};'use strict';var WhatsappAccountEvents=require(_0x2c8c('0x0'));var events=[_0x2c8c('0x1'),'remove',_0x2c8c('0x2')];function createListener(_0x482301,_0x4ce30a){return function(_0x58486a){_0x4ce30a[_0x2c8c('0x3')](_0x482301,_0x58486a);};}function removeListener(_0x5817ee,_0x5c672d){return function(){WhatsappAccountEvents[_0x2c8c('0x4')](_0x5817ee,_0x5c672d);};}exports[_0x2c8c('0x5')]=function(_0x32f392){for(var _0x46217b=0x0,_0x2c52f5=events[_0x2c8c('0x6')];_0x46217b<_0x2c52f5;_0x46217b++){var _0x5c2e10=events[_0x46217b];var _0x35facf=createListener(_0x2c8c('0x7')+_0x5c2e10,_0x32f392);WhatsappAccountEvents['on'](_0x5c2e10,_0x35facf);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9d68163..945a5f1 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 _0x88bd=['update','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create'];(function(_0x38f0c2,_0x454ccc){var _0x4ced7e=function(_0x52c001){while(--_0x52c001){_0x38f0c2['push'](_0x38f0c2['shift']());}};_0x4ced7e(++_0x454ccc);}(_0x88bd,0x1a4));var _0xd88b=function(_0x407627,_0x5a1797){_0x407627=_0x407627-0x0;var _0x150740=_0x88bd[_0x407627];return _0x150740;};'use strict';var multer=require('multer');var util=require(_0xd88b('0x0'));var path=require(_0xd88b('0x1'));var timeout=require('connect-timeout');var express=require(_0xd88b('0x2'));var router=express[_0xd88b('0x3')]();var fs_extra=require(_0xd88b('0x4'));var auth=require(_0xd88b('0x5'));var interaction=require(_0xd88b('0x6'));var config=require(_0xd88b('0x7'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd88b('0x8')]('/:id',auth[_0xd88b('0x9')](),controller[_0xd88b('0xa')]);router['post']('/',auth[_0xd88b('0x9')](),controller[_0xd88b('0xb')]);router['put']('/:id',auth[_0xd88b('0x9')](),controller[_0xd88b('0xc')]);router['delete'](_0xd88b('0xd'),auth[_0xd88b('0x9')](),controller[_0xd88b('0xe')]);module[_0xd88b('0xf')]=router; \ No newline at end of file +var _0x0dcf=['express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5ed032,_0x2ec6c3){var _0x2db07c=function(_0x52a218){while(--_0x52a218){_0x5ed032['push'](_0x5ed032['shift']());}};_0x2db07c(++_0x2ec6c3);}(_0x0dcf,0x128));var _0xf0dc=function(_0xc24672,_0x251f17){_0xc24672=_0xc24672-0x0;var _0x33a6d0=_0x0dcf[_0xc24672];return _0x33a6d0;};'use strict';var multer=require(_0xf0dc('0x0'));var util=require(_0xf0dc('0x1'));var path=require(_0xf0dc('0x2'));var timeout=require(_0xf0dc('0x3'));var express=require(_0xf0dc('0x4'));var router=express[_0xf0dc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf0dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf0dc('0x7'));var controller=require(_0xf0dc('0x8'));router[_0xf0dc('0x9')]('/',auth[_0xf0dc('0xa')](),controller[_0xf0dc('0xb')]);router[_0xf0dc('0x9')](_0xf0dc('0xc'),auth['isAuthenticated'](),controller[_0xf0dc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf0dc('0xe')]);router[_0xf0dc('0xf')](_0xf0dc('0xc'),auth[_0xf0dc('0xa')](),controller[_0xf0dc('0x10')]);router[_0xf0dc('0x11')]('/:id',auth[_0xf0dc('0xa')](),controller[_0xf0dc('0x12')]);module[_0xf0dc('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 ecf8bb6..3de9a1f 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 _0xbee9=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x386171,_0x96aecf){var _0x548199=function(_0x55f7c5){while(--_0x55f7c5){_0x386171['push'](_0x386171['shift']());}};_0x548199(++_0x96aecf);}(_0xbee9,0x1e3));var _0x9bee=function(_0x47f694,_0x23d5df){_0x47f694=_0x47f694-0x0;var _0x49096a=_0xbee9[_0x47f694];return _0x49096a;};'use strict';var Sequelize=require(_0x9bee('0x0'));module[_0x9bee('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9bee('0x2')],'allowNull':![],'defaultValue':_0x9bee('0x3')},'appdata':{'type':Sequelize[_0x9bee('0x4')]()},'description':{'type':Sequelize[_0x9bee('0x2')]},'interval':{'type':Sequelize[_0x9bee('0x2')],'defaultValue':_0x9bee('0x5')}}; \ No newline at end of file +var _0xdb07=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x35b5af,_0x35c063){var _0x35050f=function(_0x3761e2){while(--_0x3761e2){_0x35b5af['push'](_0x35b5af['shift']());}};_0x35050f(++_0x35c063);}(_0xdb07,0x154));var _0x7db0=function(_0x180659,_0xa1b1c4){_0x180659=_0x180659-0x0;var _0x224761=_0xdb07[_0x180659];return _0x224761;};'use strict';var Sequelize=require('sequelize');module[_0x7db0('0x0')]={'priority':{'type':Sequelize[_0x7db0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7db0('0x2')],'allowNull':![],'defaultValue':_0x7db0('0x3')},'appdata':{'type':Sequelize[_0x7db0('0x4')]()},'description':{'type':Sequelize[_0x7db0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7db0('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4099417..7891dcc 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 _0xf06c=['ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','update','then','destroy','sendStatus','name','send','index','WhatsappApplication','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','papaparse'];(function(_0x3860fb,_0x30edfa){var _0x57f8b8=function(_0x585b91){while(--_0x585b91){_0x3860fb['push'](_0x3860fb['shift']());}};_0x57f8b8(++_0x30edfa);}(_0xf06c,0xc7));var _0xcf06=function(_0x5969d6,_0x2aabc6){_0x5969d6=_0x5969d6-0x0;var _0x53d604=_0xf06c[_0x5969d6];return _0x53d604;};'use strict';var emlformat=require(_0xcf06('0x0'));var rimraf=require(_0xcf06('0x1'));var zipdir=require(_0xcf06('0x2'));var jsonpatch=require(_0xcf06('0x3'));var rp=require(_0xcf06('0x4'));var moment=require('moment');var BPromise=require(_0xcf06('0x5'));var Mustache=require(_0xcf06('0x6'));var util=require(_0xcf06('0x7'));var path=require('path');var sox=require(_0xcf06('0x8'));var csv=require(_0xcf06('0x9'));var ejs=require(_0xcf06('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf06('0xb'));var squel=require('squel');var crypto=require(_0xcf06('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf06('0xd'));var Redis=require(_0xcf06('0xe'));var authService=require(_0xcf06('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf06('0x10'));var logger=require('../../config/logger')(_0xcf06('0x11'));var utils=require('../../config/utils');var config=require(_0xcf06('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf06('0x13'))['db'];function respondWithStatusCode(_0x570965,_0x2aaa5f){_0x2aaa5f=_0x2aaa5f||0xcc;return function(_0x3dc669){if(_0x3dc669){return _0x570965['sendStatus'](_0x2aaa5f);}return _0x570965['status'](_0x2aaa5f)[_0xcf06('0x14')]();};}function respondWithResult(_0x45f66a,_0x2fd686){_0x2fd686=_0x2fd686||0xc8;return function(_0x157689){if(_0x157689){return _0x45f66a['status'](_0x2fd686)[_0xcf06('0x15')](_0x157689);}};}function respondWithFilteredResult(_0x4aa0d,_0x5db932){return function(_0x584d2c){if(_0x584d2c){var _0x15a795=typeof _0x5db932[_0xcf06('0x16')]===_0xcf06('0x17')&&typeof _0x5db932['limit']===_0xcf06('0x17');var _0x18cd3f=_0x584d2c[_0xcf06('0x18')];var _0x569bbf=_0x15a795?0x0:_0x5db932[_0xcf06('0x16')];var _0x2a5ef5=_0x15a795?_0x584d2c[_0xcf06('0x18')]:_0x5db932[_0xcf06('0x16')]+_0x5db932[_0xcf06('0x19')];var _0x48886d;if(_0x2a5ef5>=_0x18cd3f){_0x2a5ef5=_0x18cd3f;_0x48886d=0xc8;}else{_0x48886d=0xce;}_0x4aa0d[_0xcf06('0x1a')](_0x48886d);return _0x4aa0d[_0xcf06('0x1b')](_0xcf06('0x1c'),_0x569bbf+'-'+_0x2a5ef5+'/'+_0x18cd3f)['json'](_0x584d2c);}return null;};}function patchUpdates(_0x465eed){return function(_0x19305d){try{jsonpatch['apply'](_0x19305d,_0x465eed,!![]);}catch(_0x362fcc){return BPromise[_0xcf06('0x1d')](_0x362fcc);}return _0x19305d['save']();};}function saveUpdates(_0x2edadc,_0x132eaa){return function(_0x139b17){if(_0x139b17){return _0x139b17[_0xcf06('0x1e')](_0x2edadc)[_0xcf06('0x1f')](function(_0x13fa04){return _0x13fa04;});}return null;};}function removeEntity(_0xe3304a,_0x26a685){return function(_0xb039dd){if(_0xb039dd){return _0xb039dd[_0xcf06('0x20')]()[_0xcf06('0x1f')](function(){_0xe3304a[_0xcf06('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58840a,_0x87440){return function(_0x27beb7){if(!_0x27beb7){_0x58840a[_0xcf06('0x21')](0x194);}return _0x27beb7;};}function handleError(_0x27cbd9,_0x2e1617){_0x2e1617=_0x2e1617||0x1f4;return function(_0x6c3dcf){logger['error'](_0x6c3dcf['stack']);if(_0x6c3dcf[_0xcf06('0x22')]){delete _0x6c3dcf['name'];}_0x27cbd9[_0xcf06('0x1a')](_0x2e1617)[_0xcf06('0x23')](_0x6c3dcf);};}exports[_0xcf06('0x24')]=function(_0x474bfe,_0x120d0c){var _0x4651f4={},_0x303823={},_0x2b2508={'count':0x0,'rows':[]};var _0x2ec5b7=_['map'](db[_0xcf06('0x25')]['rawAttributes'],function(_0x92666b){return{'name':_0x92666b[_0xcf06('0x26')],'type':_0x92666b[_0xcf06('0x27')][_0xcf06('0x28')]};});_0x303823[_0xcf06('0x29')]=_[_0xcf06('0x2a')](_0x2ec5b7,'name');_0x303823[_0xcf06('0x2b')]=_[_0xcf06('0x2c')](_0x474bfe[_0xcf06('0x2b')]);_0x303823[_0xcf06('0x2d')]=_[_0xcf06('0x2e')](_0x303823[_0xcf06('0x29')],_0x303823[_0xcf06('0x2b')]);_0x4651f4[_0xcf06('0x2f')]=_[_0xcf06('0x2e')](_0x303823[_0xcf06('0x29')],qs['fields'](_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x30')]));_0x4651f4[_0xcf06('0x2f')]=_0x4651f4[_0xcf06('0x2f')][_0xcf06('0x31')]?_0x4651f4[_0xcf06('0x2f')]:_0x303823[_0xcf06('0x29')];if(!_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x32')](_0xcf06('0x33'))){_0x4651f4[_0xcf06('0x19')]=qs['limit'](_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x19')]);_0x4651f4['offset']=qs[_0xcf06('0x16')](_0x474bfe['query'][_0xcf06('0x16')]);}_0x4651f4[_0xcf06('0x34')]=qs[_0xcf06('0x35')](_0x474bfe[_0xcf06('0x2b')]['sort']);_0x4651f4[_0xcf06('0x36')]=qs[_0xcf06('0x2d')](_[_0xcf06('0x37')](_0x474bfe[_0xcf06('0x2b')],_0x303823[_0xcf06('0x2d')]),_0x2ec5b7);if(_0x474bfe['query'][_0xcf06('0x38')]){_0x4651f4[_0xcf06('0x36')]=_[_0xcf06('0x39')](_0x4651f4[_0xcf06('0x36')],{'$or':_[_0xcf06('0x2a')](_0x2ec5b7,function(_0x45ddbf){if(_0x45ddbf[_0xcf06('0x27')]!==_0xcf06('0x3a')){var _0x3e0b3f={};_0x3e0b3f[_0x45ddbf[_0xcf06('0x22')]]={'$like':'%'+_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x38')]+'%'};return _0x3e0b3f;}})});}_0x4651f4=_[_0xcf06('0x39')]({},_0x4651f4,_0x474bfe[_0xcf06('0x3b')]);var _0x446972={'where':_0x4651f4[_0xcf06('0x36')]};return db[_0xcf06('0x25')]['count'](_0x446972)[_0xcf06('0x1f')](function(_0x59b8ed){_0x2b2508[_0xcf06('0x18')]=_0x59b8ed;if(_0x474bfe[_0xcf06('0x2b')][_0xcf06('0x3c')]){_0x4651f4['include']=[{'all':!![]}];}return db[_0xcf06('0x25')][_0xcf06('0x3d')](_0x4651f4);})[_0xcf06('0x1f')](function(_0x38c153){_0x2b2508[_0xcf06('0x3e')]=_0x38c153;return _0x2b2508;})['then'](respondWithFilteredResult(_0x120d0c,_0x4651f4))['catch'](handleError(_0x120d0c,null));};exports[_0xcf06('0x3f')]=function(_0x518c2f,_0x120dae){var _0x40735b={'raw':!![],'where':{'id':_0x518c2f[_0xcf06('0x40')]['id']}},_0x4342e0={};_0x4342e0['model']=_[_0xcf06('0x2c')](db[_0xcf06('0x25')][_0xcf06('0x41')]);_0x4342e0['query']=_[_0xcf06('0x2c')](_0x518c2f['query']);_0x4342e0[_0xcf06('0x2d')]=_['intersection'](_0x4342e0[_0xcf06('0x29')],_0x4342e0['query']);_0x40735b[_0xcf06('0x2f')]=_[_0xcf06('0x2e')](_0x4342e0[_0xcf06('0x29')],qs['fields'](_0x518c2f[_0xcf06('0x2b')][_0xcf06('0x30')]));_0x40735b[_0xcf06('0x2f')]=_0x40735b['attributes'][_0xcf06('0x31')]?_0x40735b['attributes']:_0x4342e0[_0xcf06('0x29')];if(_0x518c2f[_0xcf06('0x2b')][_0xcf06('0x3c')]){_0x40735b[_0xcf06('0x42')]=[{'all':!![]}];}_0x40735b=_['merge']({},_0x40735b,_0x518c2f[_0xcf06('0x3b')]);return db[_0xcf06('0x25')][_0xcf06('0x43')](_0x40735b)['then'](handleEntityNotFound(_0x120dae,null))[_0xcf06('0x1f')](respondWithResult(_0x120dae,null))[_0xcf06('0x44')](handleError(_0x120dae,null));};exports['create']=function(_0xc392e,_0x8a988f){return db[_0xcf06('0x25')][_0xcf06('0x45')](_0xc392e[_0xcf06('0x46')],{})['then'](respondWithResult(_0x8a988f,0xc9))[_0xcf06('0x44')](handleError(_0x8a988f,null));};exports[_0xcf06('0x1e')]=function(_0x453e6e,_0x319314){if(_0x453e6e[_0xcf06('0x46')]['id']){delete _0x453e6e['body']['id'];}return db[_0xcf06('0x25')]['find']({'where':{'id':_0x453e6e[_0xcf06('0x40')]['id']}})[_0xcf06('0x1f')](handleEntityNotFound(_0x319314,null))[_0xcf06('0x1f')](saveUpdates(_0x453e6e[_0xcf06('0x46')],null))[_0xcf06('0x1f')](respondWithResult(_0x319314,null))['catch'](handleError(_0x319314,null));};exports[_0xcf06('0x20')]=function(_0x4e45dd,_0xc32502){return db[_0xcf06('0x25')][_0xcf06('0x43')]({'where':{'id':_0x4e45dd[_0xcf06('0x40')]['id']}})[_0xcf06('0x1f')](handleEntityNotFound(_0xc32502,null))[_0xcf06('0x1f')](removeEntity(_0xc32502,null))['catch'](handleError(_0xc32502,null));}; \ No newline at end of file +var _0x160f=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','type','key','map','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','WhatsappApplication','include','findAll','rows','show','params','keys','fields','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];function respondWithStatusCode(_0x3b09ea,_0x2d8854){_0x2d8854=_0x2d8854||0xcc;return function(_0x523af5){if(_0x523af5){return _0x3b09ea[_0xf160('0x17')](_0x2d8854);}return _0x3b09ea['status'](_0x2d8854)[_0xf160('0x18')]();};}function respondWithResult(_0x26951a,_0x12549a){_0x12549a=_0x12549a||0xc8;return function(_0x2bb6c7){if(_0x2bb6c7){return _0x26951a[_0xf160('0x19')](_0x12549a)[_0xf160('0x1a')](_0x2bb6c7);}};}function respondWithFilteredResult(_0x2643ba,_0x172337){return function(_0x1396ba){if(_0x1396ba){var _0x59ac02=typeof _0x172337[_0xf160('0x1b')]===_0xf160('0x1c')&&typeof _0x172337[_0xf160('0x1d')]===_0xf160('0x1c');var _0x51824b=_0x1396ba[_0xf160('0x1e')];var _0x4b8185=_0x59ac02?0x0:_0x172337[_0xf160('0x1b')];var _0x1cf6ba=_0x59ac02?_0x1396ba[_0xf160('0x1e')]:_0x172337[_0xf160('0x1b')]+_0x172337[_0xf160('0x1d')];var _0x205afa;if(_0x1cf6ba>=_0x51824b){_0x1cf6ba=_0x51824b;_0x205afa=0xc8;}else{_0x205afa=0xce;}_0x2643ba[_0xf160('0x19')](_0x205afa);return _0x2643ba[_0xf160('0x1f')](_0xf160('0x20'),_0x4b8185+'-'+_0x1cf6ba+'/'+_0x51824b)['json'](_0x1396ba);}return null;};}function patchUpdates(_0x40ccf0){return function(_0xa20d5a){try{jsonpatch[_0xf160('0x21')](_0xa20d5a,_0x40ccf0,!![]);}catch(_0x5ad173){return BPromise[_0xf160('0x22')](_0x5ad173);}return _0xa20d5a[_0xf160('0x23')]();};}function saveUpdates(_0x454e63,_0x36d0cb){return function(_0x2e03c8){if(_0x2e03c8){return _0x2e03c8[_0xf160('0x24')](_0x454e63)[_0xf160('0x25')](function(_0x5a72d1){return _0x5a72d1;});}return null;};}function removeEntity(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(_0x305f6a){return _0x305f6a[_0xf160('0x26')]()['then'](function(){_0x3d1f6c[_0xf160('0x19')](0xcc)[_0xf160('0x18')]();});}};}function handleEntityNotFound(_0x4a8003,_0x487c0c){return function(_0x168a09){if(!_0x168a09){_0x4a8003[_0xf160('0x17')](0x194);}return _0x168a09;};}function handleError(_0x39c0e3,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0xcfa9bd){logger[_0xf160('0x27')](_0xcfa9bd[_0xf160('0x28')]);if(_0xcfa9bd[_0xf160('0x29')]){delete _0xcfa9bd[_0xf160('0x29')];}_0x39c0e3[_0xf160('0x19')](_0x4c0c51)['send'](_0xcfa9bd);};}exports['index']=function(_0x48145e,_0x26e7b9){var _0x16a5fa={},_0xcaab39={},_0x26e06b={'count':0x0,'rows':[]};var _0x399cce=_['map'](db['WhatsappApplication'][_0xf160('0x2a')],function(_0x558596){return{'name':_0x558596['fieldName'],'type':_0x558596[_0xf160('0x2b')][_0xf160('0x2c')]};});_0xcaab39['model']=_[_0xf160('0x2d')](_0x399cce,_0xf160('0x29'));_0xcaab39['query']=_['keys'](_0x48145e['query']);_0xcaab39['filters']=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],_0xcaab39[_0xf160('0x30')]);_0x16a5fa[_0xf160('0x31')]=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],qs['fields'](_0x48145e['query']['fields']));_0x16a5fa[_0xf160('0x31')]=_0x16a5fa['attributes']['length']?_0x16a5fa[_0xf160('0x31')]:_0xcaab39[_0xf160('0x2f')];if(!_0x48145e['query'][_0xf160('0x32')](_0xf160('0x33'))){_0x16a5fa[_0xf160('0x1d')]=qs[_0xf160('0x1d')](_0x48145e[_0xf160('0x30')]['limit']);_0x16a5fa[_0xf160('0x1b')]=qs[_0xf160('0x1b')](_0x48145e[_0xf160('0x30')]['offset']);}_0x16a5fa[_0xf160('0x34')]=qs[_0xf160('0x35')](_0x48145e[_0xf160('0x30')][_0xf160('0x35')]);_0x16a5fa[_0xf160('0x36')]=qs[_0xf160('0x37')](_['pick'](_0x48145e['query'],_0xcaab39[_0xf160('0x37')]),_0x399cce);if(_0x48145e[_0xf160('0x30')][_0xf160('0x38')]){_0x16a5fa[_0xf160('0x36')]=_[_0xf160('0x39')](_0x16a5fa[_0xf160('0x36')],{'$or':_[_0xf160('0x2d')](_0x399cce,function(_0x38a33e){if(_0x38a33e[_0xf160('0x2b')]!==_0xf160('0x3a')){var _0x1e65d4={};_0x1e65d4[_0x38a33e[_0xf160('0x29')]]={'$like':'%'+_0x48145e[_0xf160('0x30')][_0xf160('0x38')]+'%'};return _0x1e65d4;}})});}_0x16a5fa=_[_0xf160('0x39')]({},_0x16a5fa,_0x48145e[_0xf160('0x3b')]);var _0x161f06={'where':_0x16a5fa[_0xf160('0x36')]};return db[_0xf160('0x3c')][_0xf160('0x1e')](_0x161f06)[_0xf160('0x25')](function(_0x8fe1de){_0x26e06b[_0xf160('0x1e')]=_0x8fe1de;if(_0x48145e[_0xf160('0x30')]['includeAll']){_0x16a5fa[_0xf160('0x3d')]=[{'all':!![]}];}return db[_0xf160('0x3c')][_0xf160('0x3e')](_0x16a5fa);})[_0xf160('0x25')](function(_0x3d273d){_0x26e06b[_0xf160('0x3f')]=_0x3d273d;return _0x26e06b;})[_0xf160('0x25')](respondWithFilteredResult(_0x26e7b9,_0x16a5fa))['catch'](handleError(_0x26e7b9,null));};exports[_0xf160('0x40')]=function(_0x5be7ce,_0xa80a5f){var _0x477ded={'raw':!![],'where':{'id':_0x5be7ce[_0xf160('0x41')]['id']}},_0x530fc5={};_0x530fc5[_0xf160('0x2f')]=_[_0xf160('0x42')](db[_0xf160('0x3c')][_0xf160('0x2a')]);_0x530fc5[_0xf160('0x30')]=_[_0xf160('0x42')](_0x5be7ce['query']);_0x530fc5[_0xf160('0x37')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],_0x530fc5[_0xf160('0x30')]);_0x477ded[_0xf160('0x31')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],qs[_0xf160('0x43')](_0x5be7ce[_0xf160('0x30')][_0xf160('0x43')]));_0x477ded[_0xf160('0x31')]=_0x477ded['attributes']['length']?_0x477ded[_0xf160('0x31')]:_0x530fc5[_0xf160('0x2f')];if(_0x5be7ce[_0xf160('0x30')][_0xf160('0x44')]){_0x477ded[_0xf160('0x3d')]=[{'all':!![]}];}_0x477ded=_[_0xf160('0x39')]({},_0x477ded,_0x5be7ce['options']);return db[_0xf160('0x3c')]['find'](_0x477ded)['then'](handleEntityNotFound(_0xa80a5f,null))[_0xf160('0x25')](respondWithResult(_0xa80a5f,null))[_0xf160('0x45')](handleError(_0xa80a5f,null));};exports['create']=function(_0x5ea49d,_0x2f1648){return db[_0xf160('0x3c')][_0xf160('0x46')](_0x5ea49d[_0xf160('0x47')],{})['then'](respondWithResult(_0x2f1648,0xc9))['catch'](handleError(_0x2f1648,null));};exports['update']=function(_0x50a97d,_0x406494){if(_0x50a97d['body']['id']){delete _0x50a97d[_0xf160('0x47')]['id'];}return db[_0xf160('0x3c')][_0xf160('0x48')]({'where':{'id':_0x50a97d[_0xf160('0x41')]['id']}})['then'](handleEntityNotFound(_0x406494,null))[_0xf160('0x25')](saveUpdates(_0x50a97d[_0xf160('0x47')],null))[_0xf160('0x25')](respondWithResult(_0x406494,null))['catch'](handleError(_0x406494,null));};exports[_0xf160('0x26')]=function(_0x40f855,_0x87ad7e){return db['WhatsappApplication'][_0xf160('0x48')]({'where':{'id':_0x40f855[_0xf160('0x41')]['id']}})[_0xf160('0x25')](handleEntityNotFound(_0x87ad7e,null))[_0xf160('0x25')](removeEntity(_0x87ad7e,null))[_0xf160('0x45')](handleError(_0x87ad7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c5d0b15..d3ce638 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 _0xe015=['path','rimraf','../../config/environment','./whatsappApplication.attributes','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0xc56ce2,_0x5c84e8){var _0x2d7dd5=function(_0x19a11c){while(--_0x19a11c){_0xc56ce2['push'](_0xc56ce2['shift']());}};_0x2d7dd5(++_0x5c84e8);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('WhatsappApplication',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e01('0x9'),'collate':_0x5e01('0xa')});}; \ No newline at end of file +var _0x8a28=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8a28,0xfd));var _0x88a2=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8a28[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88a2('0xc'),'collate':_0x88a2('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 59d095e..80bdf0a 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 _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0xe7a348,_0x436a60){var _0x16c737=function(_0x2c8471){while(--_0x2c8471){_0xe7a348['push'](_0xe7a348['shift']());}};_0x16c737(++_0x436a60);}(_0x0e85,0x7c));var _0x50e8=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x0e85[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x55e0,0xdc));var _0x055e=function(_0x1d603a,_0x2b814e){_0x1d603a=_0x1d603a-0x0;var _0x4b76b4=_0x55e0[_0x1d603a];return _0x4b76b4;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dc17624..c1a67cc 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 _0x6eed=['put','update','/:id','whatsappinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x6eed,0xff));var _0xd6ee=function(_0x382af1,_0x44e6d1){_0x382af1=_0x382af1-0x0;var _0x31d1ca=_0x6eed[_0x382af1];return _0x31d1ca;};'use strict';var multer=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var path=require(_0xd6ee('0x2'));var timeout=require(_0xd6ee('0x3'));var express=require(_0xd6ee('0x4'));var router=express['Router']();var fs_extra=require(_0xd6ee('0x5'));var auth=require(_0xd6ee('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd6ee('0x7'));router[_0xd6ee('0x8')]('/',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0xa')]);router[_0xd6ee('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd6ee('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd6ee('0xc')]);router[_0xd6ee('0x8')]('/:id/messages',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0xd')]);router[_0xd6ee('0x8')](_0xd6ee('0xe'),auth['isAuthenticated'](),controller[_0xd6ee('0xf')]);router[_0xd6ee('0x10')]('/',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0x11')]);router[_0xd6ee('0x10')](_0xd6ee('0x12'),auth['isAuthenticated'](),controller[_0xd6ee('0x13')]);router[_0xd6ee('0x10')]('/:id/tags',auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')](_0xd6ee('0x15'),_0xd6ee('0x16')),controller[_0xd6ee('0x17')]);router[_0xd6ee('0x18')]('/:id',auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')](_0xd6ee('0x15'),'whatsappinteraction:update'),controller[_0xd6ee('0x19')]);router['delete'](_0xd6ee('0x1a'),auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')]('whatsapp',_0xd6ee('0x1b')),controller['destroy']);router[_0xd6ee('0x1c')]('/:id/tags',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0x1d')]);module[_0xd6ee('0x1e')]=router; \ No newline at end of file +var _0xda19=['/:id/tags','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','whatsappinteraction:addtags','put','/:id','tracked','whatsapp','update','delete'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xda19,0xd5));var _0x9da1=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0xda19[_0x263a2f];return _0x8020e8;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router['get'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0x7')](_0x9da1('0xf'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9da1('0x11')]);router['post'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/:id/tags',auth[_0x9da1('0x8')](),interaction['tracked']('whatsapp',_0x9da1('0x14')),controller['addTags']);router[_0x9da1('0x15')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:update'),controller[_0x9da1('0x19')]);router[_0x9da1('0x1a')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x9da1('0x1a')](_0x9da1('0x1b'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x1c')]);module[_0x9da1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7946bed..b776c7a 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 _0xf3ff=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0xf3ff,0xae));var _0xff3f=function(_0x49c2df,_0x503906){_0x49c2df=_0x49c2df-0x0;var _0x156111=_0xf3ff[_0x49c2df];return _0x156111;};'use strict';var Sequelize=require(_0xff3f('0x0'));var moment=require('moment');module[_0xff3f('0x1')]={'closed':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff3f('0x3')]},'disposition':{'type':Sequelize[_0xff3f('0x4')]},'secondDisposition':{'type':Sequelize[_0xff3f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xff3f('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xff3f('0x4')]},'read1stAt':{'type':Sequelize[_0xff3f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xff3f('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xff3f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xff3f('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x21d1=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4c5418,_0x4a9f2f){var _0x165b5c=function(_0x41a74a){while(--_0x41a74a){_0x4c5418['push'](_0x4c5418['shift']());}};_0x165b5c(++_0x4a9f2f);}(_0x21d1,0x1c9));var _0x121d=function(_0x27d28a,_0x2ff529){_0x27d28a=_0x27d28a-0x0;var _0x224233=_0x21d1[_0x27d28a];return _0x224233;};'use strict';var Sequelize=require(_0x121d('0x0'));var moment=require(_0x121d('0x1'));module[_0x121d('0x2')]={'closed':{'type':Sequelize[_0x121d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x121d('0x4')]},'disposition':{'type':Sequelize[_0x121d('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x121d('0x5')]},'phone':{'type':Sequelize[_0x121d('0x5')]},'read1stAt':{'type':Sequelize[_0x121d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x121d('0x6')]('in',_0x121d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x121d('0x6')]('in',_0x121d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x121d('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 08605b6..a36edf9 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 _0x338e=['getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','WhatsappInteractionId','all','rows','show','rawAttributes','includeAll','options','create','update','destroy','params','addMessage','ids','omit','getMessages','WhatsappMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','join','root','files','tmp','server','CmContact','Contact','firstName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','Whatsapp','N.A.','closed','closedAt','basename','existsSync','pipe','createWriteStream','direction','System','lastName','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','offset','limit','undefined','count','status','set','json','apply','save','then','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','WhatsappInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','tools_tags','select','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','User','UserId','start','body','compact','isEmpty','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent'];(function(_0x2cb4be,_0x2705cd){var _0x287fcb=function(_0x3d1170){while(--_0x3d1170){_0x2cb4be['push'](_0x2cb4be['shift']());}};_0x287fcb(++_0x2705cd);}(_0x338e,0x137));var _0xe338=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x338e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xe338('0x0'));var rimraf=require(_0xe338('0x1'));var zipdir=require(_0xe338('0x2'));var jsonpatch=require(_0xe338('0x3'));var rp=require('request-promise');var moment=require(_0xe338('0x4'));var BPromise=require(_0xe338('0x5'));var Mustache=require(_0xe338('0x6'));var util=require(_0xe338('0x7'));var path=require(_0xe338('0x8'));var sox=require(_0xe338('0x9'));var csv=require(_0xe338('0xa'));var ejs=require(_0xe338('0xb'));var fs=require('fs');var fs_extra=require(_0xe338('0xc'));var _=require(_0xe338('0xd'));var squel=require(_0xe338('0xe'));var crypto=require(_0xe338('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe338('0x10'));var toCsv=require(_0xe338('0xa'));var querystring=require(_0xe338('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe338('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe338('0x13'));var pdf=require(_0xe338('0x14'));var hardwareService=require(_0xe338('0x15'));var logger=require('../../config/logger')(_0xe338('0x16'));var utils=require('../../config/utils');var config=require(_0xe338('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe338('0x18'))['db'];config[_0xe338('0x19')]=_[_0xe338('0x1a')](config[_0xe338('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe338('0x1b'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xe338('0x1c')](socket);function respondWithStatusCode(_0x57dc4c,_0x253e98){_0x253e98=_0x253e98||0xcc;return function(_0x5c9cb4){if(_0x5c9cb4){return _0x57dc4c[_0xe338('0x1d')](_0x253e98);}return _0x57dc4c['status'](_0x253e98)[_0xe338('0x1e')]();};}function respondWithResult(_0x4dd637,_0x141a7a){_0x141a7a=_0x141a7a||0xc8;return function(_0x4ade13){if(_0x4ade13){return _0x4dd637['status'](_0x141a7a)['json'](_0x4ade13);}};}function respondWithFilteredResult(_0x56ced1,_0x5e358c){return function(_0x109c9a){if(_0x109c9a){var _0x278447=typeof _0x5e358c[_0xe338('0x1f')]==='undefined'&&typeof _0x5e358c[_0xe338('0x20')]===_0xe338('0x21');var _0x477ad5=_0x109c9a[_0xe338('0x22')];var _0x9bcde9=_0x278447?0x0:_0x5e358c[_0xe338('0x1f')];var _0x3db22a=_0x278447?_0x109c9a[_0xe338('0x22')]:_0x5e358c['offset']+_0x5e358c[_0xe338('0x20')];var _0x167844;if(_0x3db22a>=_0x477ad5){_0x3db22a=_0x477ad5;_0x167844=0xc8;}else{_0x167844=0xce;}_0x56ced1[_0xe338('0x23')](_0x167844);return _0x56ced1[_0xe338('0x24')]('Content-Range',_0x9bcde9+'-'+_0x3db22a+'/'+_0x477ad5)[_0xe338('0x25')](_0x109c9a);}return null;};}function patchUpdates(_0x22ed5a){return function(_0x4f9158){try{jsonpatch[_0xe338('0x26')](_0x4f9158,_0x22ed5a,!![]);}catch(_0x3f4edf){return BPromise['reject'](_0x3f4edf);}return _0x4f9158[_0xe338('0x27')]();};}function saveUpdates(_0x411692,_0xdb4d9d){return function(_0x5ed542){if(_0x5ed542){return _0x5ed542['update'](_0x411692)['then'](function(_0xbe97d7){return _0xbe97d7;});}return null;};}function removeEntity(_0x34439c,_0x37a25b){return function(_0x44ad20){if(_0x44ad20){return _0x44ad20['destroy']()[_0xe338('0x28')](function(){_0x34439c[_0xe338('0x23')](0xcc)[_0xe338('0x1e')]();});}};}function handleEntityNotFound(_0x32df21,_0x3d2c89){return function(_0x4177fc){if(!_0x4177fc){_0x32df21[_0xe338('0x1d')](0x194);}return _0x4177fc;};}function handleError(_0x4ea0ab,_0x29e6f7){_0x29e6f7=_0x29e6f7||0x1f4;return function(_0x2a6cff){logger[_0xe338('0x29')](_0x2a6cff['stack']);if(_0x2a6cff[_0xe338('0x2a')]){delete _0x2a6cff['name'];}_0x4ea0ab[_0xe338('0x23')](_0x29e6f7)[_0xe338('0x2b')](_0x2a6cff);};}function getInteractionUsers(_0x7be66d,_0x1b6058){return new BPromise(function(_0x52fae9,_0x453e7f){try{if(_0x1b6058[_0x7be66d['id']]){_0x7be66d['Users']=_[_0xe338('0x2c')](_0x1b6058[_0x7be66d['id']],function(_0x50db63){return{'id':_0x50db63['id'],'fullname':_0x50db63[_0xe338('0x2d')]};});}}catch(_0x4285ae){_0x453e7f(_0x4285ae);}_0x52fae9(_0x7be66d);});}function getInteractionTags(_0x2f6e22,_0x133594){return new BPromise(function(_0x2eeb13,_0x2e5459){try{if(_0x2f6e22[_0xe338('0x2e')]){_0x2f6e22[_0xe338('0x2f')]=[];_0x2f6e22[_0xe338('0x2e')][_0xe338('0x30')](',')[_0xe338('0x31')](function(_0x43be37){_0x2f6e22[_0xe338('0x2f')][_0xe338('0x32')](_0x133594[_0x43be37]);});}delete _0x2f6e22[_0xe338('0x2e')];}catch(_0x161c09){_0x2e5459(_0x161c09);}_0x2eeb13(_0x2f6e22);});}function updateWhatsappInteraction(_0x1894ee,_0xa4f3d,_0x440bcd){return new BPromise(function(_0x55f24e,_0x551c8b){return getInteractionUsers(_0x1894ee,_0x440bcd)[_0xe338('0x28')](function(_0x2888b2){return getInteractionTags(_0x2888b2,_0xa4f3d);})[_0xe338('0x28')](function(_0x36c8ab){_0x55f24e(_0x36c8ab);})[_0xe338('0x33')](function(_0x147636){_0x551c8b(_0x147636);});});}exports[_0xe338('0x34')]=function(_0x2ebd49,_0x1da13c){var _0x52fe95={},_0x4f79fd={},_0x15298d={'count':0x0,'rows':[]};var _0x2b7ec8=_[_0xe338('0x2c')](db[_0xe338('0x35')]['rawAttributes'],function(_0x4cd224){return{'name':_0x4cd224[_0xe338('0x36')],'type':_0x4cd224[_0xe338('0x37')][_0xe338('0x38')]};});_0x4f79fd[_0xe338('0x39')]=_[_0xe338('0x2c')](_0x2b7ec8,_0xe338('0x2a'));_0x4f79fd[_0xe338('0x3a')]=_[_0xe338('0x3b')](_0x2ebd49[_0xe338('0x3a')]);_0x4f79fd[_0xe338('0x3c')]=_[_0xe338('0x3d')](_0x4f79fd[_0xe338('0x39')],_0x4f79fd['query']);_0x52fe95[_0xe338('0x3e')]=_[_0xe338('0x3d')](_0x4f79fd['model'],qs[_0xe338('0x3f')](_0x2ebd49[_0xe338('0x3a')][_0xe338('0x3f')]));_0x52fe95[_0xe338('0x3e')]=_0x52fe95[_0xe338('0x3e')][_0xe338('0x40')]?_0x52fe95[_0xe338('0x3e')]:_0x4f79fd['model'];if(!_0x2ebd49['query'][_0xe338('0x41')](_0xe338('0x42'))){_0x52fe95[_0xe338('0x20')]=qs['limit'](_0x2ebd49[_0xe338('0x3a')]['limit']);_0x52fe95[_0xe338('0x1f')]=qs['offset'](_0x2ebd49[_0xe338('0x3a')][_0xe338('0x1f')]);}_0x52fe95[_0xe338('0x43')]=qs[_0xe338('0x44')](_0x2ebd49[_0xe338('0x3a')][_0xe338('0x44')]);_0x52fe95[_0xe338('0x45')]=qs[_0xe338('0x3c')](_['pick'](_0x2ebd49[_0xe338('0x3a')],_0x4f79fd[_0xe338('0x3c')]),_0x2b7ec8);var _0x35dffd=[];var _0x428eb9=squel['select']()[_0xe338('0x46')]('id')[_0xe338('0x46')](_0xe338('0x2a'))[_0xe338('0x46')](_0xe338('0x47'))['from'](_0xe338('0x48'));var _0x80a79a=squel[_0xe338('0x49')]()[_0xe338('0x46')]('u.id')[_0xe338('0x46')](_0xe338('0x4a'))[_0xe338('0x46')](_0xe338('0x4b'))[_0xe338('0x4c')](_0xe338('0x4d'),'ui')[_0xe338('0x4e')](_0xe338('0x4f'),'u',_0xe338('0x50'));var _0x3c1e91=squel[_0xe338('0x49')]()['from'](_0xe338('0x51'),'i')[_0xe338('0x4e')](_0xe338('0x52'),'c',_0xe338('0x53'))[_0xe338('0x4e')]('users','o',_0xe338('0x54'))[_0xe338('0x4e')](_0xe338('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xe338('0x56'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join']('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe338('0x4e')](_0xe338('0x48'),'t',_0xe338('0x57'));var _0x356a83=squel['expr']();var _0xcb0186=[];var _0xa8849b=squel[_0xe338('0x58')]();var _0x51b5ca;if(_0x2ebd49[_0xe338('0x3a')][_0xe338('0x59')]){_0x51b5ca=as['parseSearch'](_0x2ebd49[_0xe338('0x3a')][_0xe338('0x59')]);var _0x570127=_0x51b5ca[_0xe338('0x5a')];for(var _0x5bb78e=0x0;_0x5bb78e<_0x51b5ca[_0xe338('0x5b')]['length'];_0x5bb78e++){var _0x2f7376=_0x51b5ca['conditions'][_0x5bb78e];var _0x4cc075='i';var _0x54a088=_[_0xe338('0x5c')](_0x2b7ec8,['name',_0x2f7376[_0xe338('0x46')]]);if(!_0x54a088){switch(_0x2f7376[_0xe338('0x46')]){case _0xe338('0x5d'):if(_0x2f7376[_0xe338('0x5e')]==0x1){_0x3c1e91[_0xe338('0x5f')]('`'+_0x2f7376['field']+_0xe338('0x60'));}else{_0x3c1e91[_0xe338('0x5f')]('`'+_0x2f7376[_0xe338('0x46')]+_0xe338('0x61'));}break;case'Contact':if(_0x2f7376[_0xe338('0x62')]===_0xe338('0x63')){if(_0x2f7376[_0xe338('0x5e')][_0xe338('0x30')]('\x20')[_0xe338('0x40')]>0x1){_0x356a83[_0x570127](_0xe338('0x64'),qs[_0xe338('0x65')](_0x2f7376[_0xe338('0x5e')]),null);}else{var _0xdda34e='%'+_0x2f7376[_0xe338('0x5e')]+'%';_0x356a83[_0x570127](_0xe338('0x66'),_0xdda34e,_0xdda34e,_0xdda34e);}}else{_0x54a088=_[_0xe338('0x5c')](_0x2b7ec8,[_0xe338('0x2a'),_0xe338('0x67')]);_0x2f7376[_0xe338('0x46')]=_0xe338('0x67');_0x16cba5=as[_0xe338('0x68')](_0x4cc075,_0x54a088[_0xe338('0x37')],_0x2f7376);_0x356a83[_0x570127](_0x16cba5[_0xe338('0x69')],_0x16cba5[_0xe338('0x5e')]['start'],_0x16cba5[_0xe338('0x5e')][_0xe338('0x1e')]);}break;case _0xe338('0x6a'):var _0x3d561a=_0x2f7376['value'][_0xe338('0x30')](',')[_0xe338('0x2c')](function(_0x18b13f){return Number(_0x18b13f);});_0x3d561a[_0xe338('0x31')](function(_0x18063e){_0xa8849b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x18063e+',%');});_0xcb0186=_[_0xe338('0x6b')](_0xcb0186,_0x3d561a);break;case _0xe338('0x6c'):if(_0x2f7376[_0xe338('0x62')]==='$substring'){_0x356a83[_0x570127]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2f7376['value']+'%',null);}else{_0x54a088=_[_0xe338('0x5c')](_0x2b7ec8,['name','UserId']);_0x2f7376[_0xe338('0x46')]=_0xe338('0x6d');_0x16cba5=as[_0xe338('0x68')](_0x4cc075,_0x54a088[_0xe338('0x37')],_0x2f7376);_0x356a83[_0x570127](_0x16cba5[_0xe338('0x69')],_0x16cba5['value'][_0xe338('0x6e')],_0x16cba5[_0xe338('0x5e')]['end']);}break;case _0xe338('0x6f'):_0x16cba5=as[_0xe338('0x68')]('me',null,_0x2f7376);_0x356a83[_0x570127](_0x16cba5[_0xe338('0x69')],_0x16cba5[_0xe338('0x5e')][_0xe338('0x6e')],_0x16cba5[_0xe338('0x5e')][_0xe338('0x1e')]);break;}}else{var _0x16cba5=as['buildExpression'](_0x4cc075,_0x54a088[_0xe338('0x37')],_0x2f7376);_0x356a83[_0x570127](_0x16cba5[_0xe338('0x69')],_0x16cba5[_0xe338('0x5e')][_0xe338('0x6e')],_0x16cba5[_0xe338('0x5e')][_0xe338('0x1e')]);}}}else{var _0x459d31=_(_0x2ebd49[_0xe338('0x3a')])[_0xe338('0x3b')]()[_0xe338('0x2c')](function(_0x542299){return _['some'](_0x2b7ec8,[_0xe338('0x2a'),_0x542299])?_0x542299:undefined;})[_0xe338('0x70')]()[_0xe338('0x5e')]();if(!_[_0xe338('0x71')](_0x459d31)){_0x459d31[_0xe338('0x31')](function(_0xe7cb3){if(_0xe7cb3==='WhatsappAccountId'){_0x3c1e91[_0xe338('0x45')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x2ebd49[_0xe338('0x3a')][_0xe7cb3]));}else if(_0xe7cb3===_0xe338('0x72')){var _0x10c2e=JSON['parse'](_0x2ebd49[_0xe338('0x3a')][_0xe7cb3])['$gte'];var _0x277922=JSON[_0xe338('0x73')](_0x2ebd49[_0xe338('0x3a')][_0xe7cb3])[_0xe338('0x74')];_0x3c1e91['where'](_0xe338('0x75'),_0x10c2e,_0x277922);}else{if(_0x2ebd49[_0xe338('0x3a')][_0xe7cb3]===_0xe338('0x76')){_0x3c1e91[_0xe338('0x45')]('i.'+_0xe7cb3+_0xe338('0x77'));}else{_0x3c1e91[_0xe338('0x45')]('i.'+_0xe7cb3+'\x20=\x20?',_0x2ebd49[_0xe338('0x3a')][_0xe7cb3]);}}});}if(_0x2ebd49[_0xe338('0x3a')][_0xe338('0x78')]){if(_0x2ebd49['query'][_0xe338('0x78')]==0x1){_0x3c1e91[_0xe338('0x5f')](_0xe338('0x79'));}else{_0x3c1e91[_0xe338('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x2ebd49[_0xe338('0x3a')][_0xe338('0x7a')]){_0xcb0186=_[_0xe338('0x7b')](_0x2ebd49['query']['tag'])?_0x2ebd49['query'][_0xe338('0x7a')]:new Array(_0x2ebd49['query'][_0xe338('0x7a')]);_0xcb0186[_0xe338('0x31')](function(_0xf9afc5){_0xa8849b['or'](_0xe338('0x7c'),'%,'+_0xf9afc5+',%');});}if(_0x2ebd49[_0xe338('0x3a')][_0xe338('0x7d')]){var _0x18b337=_0x2ebd49[_0xe338('0x3a')][_0xe338('0x7d')][_0xe338('0x7e')]('\x5c','\x5c\x5c')[_0xe338('0x7e')](/'/g,'\x27\x27');if(qs[_0xe338('0x7f')](_0x18b337)){_0x356a83['or'](_0xe338('0x80'),_0x18b337+'%')['or']('i.phone\x20LIKE\x20?',_0x18b337+'%');}else{_0x356a83['or'](_0xe338('0x81'),qs['getFullTextValue'](_0x18b337))['or'](_0xe338('0x82'),_0x18b337+'%');}}}_0x3c1e91['where'](_0x356a83);_0x3c1e91[_0xe338('0x83')](_0xe338('0x84'));var _0x362855={'type':db['Sequelize'][_0xe338('0x85')][_0xe338('0x86')],'raw':!![]};var _0x282ac2=_0x3c1e91[_0xe338('0x87')]();_0x282ac2[_0xe338('0x46')](_0xe338('0x84'));_0x282ac2[_0xe338('0x46')](_0xe338('0x88'),_0xe338('0x5d'));if(_0x52fe95['order']){_0x52fe95['order'][_0xe338('0x31')](function(_0x4e46b0){var _0x486e0a=_0x4e46b0[0x0]===_0xe338('0x89')?_0x4e46b0[0x0]:'i.'+_0x4e46b0[0x0];_0x3c1e91[_0xe338('0x43')](_0x486e0a,_0x4e46b0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xcb0186)){_0x3c1e91[_0xe338('0x5f')](_0xa8849b);_0x282ac2[_0xe338('0x45')](_0xe338('0x8a'),_0xcb0186);}BPromise[_0xe338('0x8b')]()[_0xe338('0x28')](function(){if(!_0x51b5ca){if(_0x2ebd49[_0xe338('0x3a')][_0xe338('0x8c')])return;_0x282ac2[_0xe338('0x45')](_0xe338('0x8d'));_0x3c1e91['where'](_0xe338('0x8d'));return;}if(_0x2ebd49[_0xe338('0x8e')][_0xe338('0x8f')]!==_0xe338('0x90'))return;return _0x2ebd49['user'][_0xe338('0x91')]({'attributes':['id'],'raw':!![]})[_0xe338('0x28')](function(_0x19a9f0){if(_['isEmpty'](_0x19a9f0)){_0x282ac2[_0xe338('0x45')](_0xe338('0x92'));_0x3c1e91[_0xe338('0x45')](_0xe338('0x92'));}else{_0x282ac2[_0xe338('0x45')](_0xe338('0x93'),_[_0xe338('0x2c')](_0x19a9f0,'id'));_0x3c1e91[_0xe338('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xe338('0x2c')](_0x19a9f0,'id'));}});})[_0xe338('0x28')](function(){if(_0x2ebd49[_0xe338('0x8e')][_0xe338('0x8f')]===_0xe338('0x90')&&!_0x51b5ca&&!_0x2ebd49['query']['WhatsappAccountId'])return[];return db[_0xe338('0x94')][_0xe338('0x3a')](_0x282ac2[_0xe338('0x95')](),_0x362855);})[_0xe338('0x28')](function(_0x3be0a4){_0x15298d[_0xe338('0x22')]=_0x3be0a4[_0xe338('0x40')];if(_0x15298d['count']===0x0)return[];return db[_0xe338('0x94')][_0xe338('0x3a')](_0x428eb9['toString'](),_0x362855)[_0xe338('0x28')](function(_0x5a6512){_0x35dffd=_['keyBy'](_0x5a6512,'id');_0x362855=_[_0xe338('0x96')](_0x362855,{'model':db[_0xe338('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ebd49[_0xe338('0x3a')]['fields']){_0x52fe95[_0xe338('0x3e')][_0xe338('0x31')](function(_0x56c442){_0x3c1e91['field']('i.'+_0x56c442);});}else{_0x3c1e91[_0xe338('0x46')](_0xe338('0x88'),_0xe338('0x5d'));_0x3c1e91['field'](_0xe338('0x97'),'Account.key');_0x3c1e91[_0xe338('0x46')](_0xe338('0x98'),_0xe338('0x99'));_0x3c1e91['field'](_0xe338('0x9a'),_0xe338('0x89'));_0x3c1e91[_0xe338('0x46')](_0xe338('0x9b'));_0x3c1e91['field']('c.firstName',_0xe338('0x9c'));_0x3c1e91[_0xe338('0x46')](_0xe338('0x9d'),_0xe338('0x9e'));_0x3c1e91['field'](_0xe338('0x9f'),_0xe338('0xa0'));_0x3c1e91[_0xe338('0x46')](_0xe338('0xa1'),_0xe338('0xa2'));_0x3c1e91['field']('c.mobile','Contact.mobile');_0x3c1e91[_0xe338('0x46')](_0xe338('0xa3'),_0xe338('0xa4'));_0x3c1e91[_0xe338('0x46')]('o.fullname',_0xe338('0xa5'));_0x3c1e91[_0xe338('0x46')](_0xe338('0xa6'),_0xe338('0xa7'));_0x3c1e91[_0xe338('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe338('0x2e'));}if(_0x52fe95[_0xe338('0x20')])_0x3c1e91[_0xe338('0x20')](_0x52fe95[_0xe338('0x20')]);if(_0x52fe95[_0xe338('0x1f')])_0x3c1e91[_0xe338('0x1f')](_0x52fe95[_0xe338('0x1f')]);return db[_0xe338('0x94')]['query'](_0x3c1e91[_0xe338('0x95')](),_0x362855);})[_0xe338('0x28')](function(_0x4a95e8){if(_0x4a95e8[_0xe338('0x40')]>0x0)_0x80a79a['where']('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x4a95e8,'id'));return db[_0xe338('0x94')][_0xe338('0x3a')](_0x80a79a[_0xe338('0x95')](),_0x362855)['then'](function(_0x408a84){var _0x41cdbf=_['groupBy'](_0x408a84,_0xe338('0xa8'));var _0x435d08=[];_0x4a95e8['forEach'](function(_0x16c801){_0x435d08[_0xe338('0x32')](updateWhatsappInteraction(_0x16c801,_0x35dffd,_0x41cdbf));});return BPromise[_0xe338('0xa9')](_0x435d08);});});})[_0xe338('0x28')](function(_0x4b96aa){_0x15298d[_0xe338('0xaa')]=_0x4b96aa;return _0x15298d;})[_0xe338('0x28')](respondWithFilteredResult(_0x1da13c,_0x52fe95))[_0xe338('0x33')](handleError(_0x1da13c,null));};exports[_0xe338('0xab')]=function(_0x484116,_0x43abbc){var _0x3c60b5={'raw':![],'where':{'id':_0x484116['params']['id']}},_0x46c814={};_0x46c814['model']=_[_0xe338('0x3b')](db['WhatsappInteraction'][_0xe338('0xac')]);_0x46c814[_0xe338('0x3a')]=_['keys'](_0x484116['query']);_0x46c814[_0xe338('0x3c')]=_['intersection'](_0x46c814[_0xe338('0x39')],_0x46c814[_0xe338('0x3a')]);_0x3c60b5['attributes']=_['intersection'](_0x46c814[_0xe338('0x39')],qs[_0xe338('0x3f')](_0x484116[_0xe338('0x3a')][_0xe338('0x3f')]));_0x3c60b5['attributes']=_0x3c60b5['attributes'][_0xe338('0x40')]?_0x3c60b5[_0xe338('0x3e')]:_0x46c814[_0xe338('0x39')];if(_0x484116['query'][_0xe338('0xad')]){_0x3c60b5['include']=[{'all':!![]}];}_0x3c60b5=_[_0xe338('0x96')]({},_0x3c60b5,_0x484116[_0xe338('0xae')]);return db['WhatsappInteraction'][_0xe338('0x5c')](_0x3c60b5)['then'](handleEntityNotFound(_0x43abbc,null))[_0xe338('0x28')](respondWithResult(_0x43abbc,null))[_0xe338('0x33')](handleError(_0x43abbc,null));};exports[_0xe338('0xaf')]=function(_0x34200d,_0x258c91){return db[_0xe338('0x35')][_0xe338('0xaf')](_0x34200d['body'],{})[_0xe338('0x28')](respondWithResult(_0x258c91,0xc9))[_0xe338('0x33')](handleError(_0x258c91,null));};exports[_0xe338('0xb0')]=function(_0x1d91e6,_0x29db13){if(_0x1d91e6[_0xe338('0x6f')]['id']){delete _0x1d91e6[_0xe338('0x6f')]['id'];}return db[_0xe338('0x35')][_0xe338('0x5c')]({'where':{'id':_0x1d91e6['params']['id']}})[_0xe338('0x28')](handleEntityNotFound(_0x29db13,null))['then'](saveUpdates(_0x1d91e6['body'],null))[_0xe338('0x28')](respondWithResult(_0x29db13,null))[_0xe338('0x33')](handleError(_0x29db13,null));};exports[_0xe338('0xb1')]=function(_0x3070bb,_0x388c43){return db['WhatsappInteraction'][_0xe338('0x5c')]({'where':{'id':_0x3070bb[_0xe338('0xb2')]['id']}})[_0xe338('0x28')](handleEntityNotFound(_0x388c43,null))[_0xe338('0x28')](removeEntity(_0x388c43,null))[_0xe338('0x33')](handleError(_0x388c43,null));};exports['describe']=function(_0x3b872f,_0x22bcda){return db['WhatsappInteraction']['describe']()[_0xe338('0x28')](respondWithResult(_0x22bcda,null))[_0xe338('0x33')](handleError(_0x22bcda,null));};exports['addMessage']=function(_0x565b5b,_0x37d073,_0x5ded6a){return db['WhatsappMessage'][_0xe338('0x5c')]({'where':{'id':_0x565b5b['params']['id']}})[_0xe338('0x28')](handleEntityNotFound(_0x37d073,null))[_0xe338('0x28')](function(_0x2c1a74){if(_0x2c1a74){return _0x2c1a74[_0xe338('0xb3')](_0x565b5b[_0xe338('0x6f')][_0xe338('0xb4')],_[_0xe338('0xb5')](_0x565b5b[_0xe338('0x6f')],[_0xe338('0xb4'),'id'])||{});}})[_0xe338('0x28')](respondWithResult(_0x37d073,null))[_0xe338('0x33')](handleError(_0x37d073,null));};exports[_0xe338('0xb6')]=function(_0x5b3bcc,_0x3e71cd,_0x48d52b){var _0x323beb={'raw':![],'where':{}};var _0x32f24d={};var _0xdd8108={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x5b3bcc[_0xe338('0xb2')]['id']}})['then'](handleEntityNotFound(_0x3e71cd,null))[_0xe338('0x28')](function(_0x118106){if(_0x118106){_0x32f24d[_0xe338('0x39')]=_[_0xe338('0x3b')](db[_0xe338('0xb7')][_0xe338('0xac')]);_0x32f24d['query']=_[_0xe338('0x3b')](_0x5b3bcc[_0xe338('0x3a')]);_0x32f24d[_0xe338('0x3c')]=_[_0xe338('0x3d')](_0x32f24d[_0xe338('0x39')],_0x32f24d[_0xe338('0x3a')]);_0x323beb[_0xe338('0x3e')]=_[_0xe338('0x3d')](_0x32f24d[_0xe338('0x39')],qs[_0xe338('0x3f')](_0x5b3bcc['query'][_0xe338('0x3f')]));_0x323beb[_0xe338('0x3e')]=_0x323beb['attributes'][_0xe338('0x40')]?_0x323beb[_0xe338('0x3e')]:_0x32f24d[_0xe338('0x39')];if(!_0x5b3bcc[_0xe338('0x3a')]['hasOwnProperty'](_0xe338('0x42'))){_0x323beb[_0xe338('0x20')]=qs['limit'](_0x5b3bcc[_0xe338('0x3a')]['limit']);_0x323beb[_0xe338('0x1f')]=qs[_0xe338('0x1f')](_0x5b3bcc[_0xe338('0x3a')][_0xe338('0x1f')]);}_0x323beb[_0xe338('0x43')]=qs['sort'](_0x5b3bcc['query'][_0xe338('0x44')]);_0x323beb['where']=qs[_0xe338('0x3c')](_['pick'](_0x5b3bcc['query'],_0x32f24d['filters']));_0x323beb[_0xe338('0x45')]['WhatsappInteractionId']=_0x118106['id'];if(_0x5b3bcc[_0xe338('0x3a')][_0xe338('0x7d')]){_0x323beb['where']=_[_0xe338('0x96')](_0x323beb[_0xe338('0x45')],{'$or':_[_0xe338('0x2c')](_0x323beb[_0xe338('0x3e')],function(_0x2677f4){var _0x184de8={};_0x184de8[_0x2677f4]={'$like':'%'+_0x5b3bcc[_0xe338('0x3a')][_0xe338('0x7d')]+'%'};return _0x184de8;})});}if(_0x5b3bcc[_0xe338('0x3a')]['$gte']){var _0x134639=_0x5b3bcc[_0xe338('0x3a')][_0xe338('0xb8')][_0xe338('0x30')](',');var _0x3257c7={};_0x3257c7[_0x134639[0x0]]={'$gte':moment(_0x134639[0x1])[_0xe338('0xb9')](_0xe338('0xba'))};_0x323beb[_0xe338('0x45')]=_[_0xe338('0x96')](_0x323beb[_0xe338('0x45')],_0x3257c7);}_0x323beb=_[_0xe338('0x96')]({},_0x323beb,_0x5b3bcc[_0xe338('0xae')]);return db[_0xe338('0xb7')][_0xe338('0x22')]({'where':_0x323beb[_0xe338('0x45')]})[_0xe338('0x28')](function(_0x5aa0a1){_0xdd8108[_0xe338('0x22')]=_0x5aa0a1;if(_0x5b3bcc[_0xe338('0x3a')][_0xe338('0xad')]){_0x323beb[_0xe338('0xbb')]=[{'all':!![]}];}return db[_0xe338('0xb7')][_0xe338('0xbc')](_0x323beb);})[_0xe338('0x28')](function(_0x39590e){_0xdd8108[_0xe338('0xaa')]=_0x39590e;return _0xdd8108;});}})['then'](respondWithFilteredResult(_0x3e71cd,_0x323beb))['catch'](handleError(_0x3e71cd,null));};exports[_0xe338('0xbd')]=function(_0x56ac24,_0x5d63dd,_0x489391){return db[_0xe338('0x35')][_0xe338('0x5c')]({'where':{'id':_0x56ac24[_0xe338('0xb2')]['id']}})[_0xe338('0x28')](handleEntityNotFound(_0x5d63dd,null))['then'](function(_0x184688){if(_0x184688){return _0x184688[_0xe338('0xbe')](_0x56ac24[_0xe338('0x6f')][_0xe338('0xb4')],_[_0xe338('0xb5')](_0x56ac24['body'],[_0xe338('0xb4'),'id'])||{})['spread'](function(){return db[_0xe338('0x6a')][_0xe338('0xbc')]({'attributes':['id',_0xe338('0x2a'),_0xe338('0x47')],'where':{'id':_0x56ac24[_0xe338('0x6f')][_0xe338('0xb4')]}});})[_0xe338('0x28')](function(_0x9d6f1a){socket[_0xe338('0xbf')](_0xe338('0xc0'),{'id':Number(_0x56ac24[_0xe338('0xb2')]['id']),'tags':_0x9d6f1a||[]});return{'id':Number(_0x56ac24[_0xe338('0xb2')]['id']),'tags':_0x9d6f1a||[]};});}})[_0xe338('0x28')](respondWithResult(_0x5d63dd,null))[_0xe338('0x33')](handleError(_0x5d63dd,null));};exports[_0xe338('0xc1')]=function(_0x4aaf94,_0x12c70a,_0x4b2787){return db[_0xe338('0x35')][_0xe338('0x5c')]({'where':{'id':_0x4aaf94[_0xe338('0xb2')]['id']}})['then'](handleEntityNotFound(_0x12c70a,null))[_0xe338('0x28')](function(_0x224965){if(_0x224965){return _0x224965['removeTags'](_0x4aaf94[_0xe338('0x3a')][_0xe338('0xb4')]);}})[_0xe338('0x28')](respondWithStatusCode(_0x12c70a,null))[_0xe338('0x33')](handleError(_0x12c70a,null));};exports['download']=function(_0x49b5b3,_0x3a3777){var _0xed6cad=moment()['unix']()[_0xe338('0x95')]();var _0x2cd4f8=path[_0xe338('0xc2')](config[_0xe338('0xc3')],'server',_0xe338('0xc4'),_0xe338('0xc5'));var _0xf374df=path[_0xe338('0xc2')](config['root'],_0xe338('0xc6'),'files','attachments');var _0x389573=path[_0xe338('0xc2')](_0x2cd4f8,_0xed6cad);var _0x50c052=util[_0xe338('0xb9')]('transcript-%d-%s.zip',_0x49b5b3[_0xe338('0xb2')]['id'],_0xed6cad);var _0x1335a8=path['join'](_0x2cd4f8,_0x50c052);var _0x14c717=[];_0x14c717[_0xe338('0x32')]({'model':db[_0xe338('0x6c')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x14c717[_0xe338('0x32')]({'model':db[_0xe338('0xc7')],'as':_0xe338('0xc8'),'attributes':['id',_0xe338('0xc9'),'lastName'],'raw':!![]});if(_0x49b5b3[_0xe338('0x3a')]['attachments']){_0x14c717[_0xe338('0x32')]({'model':db[_0xe338('0xca')],'as':'Attachment','raw':!![]});}var _0x1f1e91=[{'model':db['WhatsappMessage'],'as':_0xe338('0xcb'),'attributes':['id',_0xe338('0x6f'),_0xe338('0x72'),'direction',_0xe338('0xcc'),_0xe338('0x78')],'include':_0x14c717}];_0x1f1e91['push']({'model':db[_0xe338('0xcd')],'as':_0xe338('0xce'),'attributes':['id','name']});_0x1f1e91[_0xe338('0x32')]({'model':db[_0xe338('0x6c')],'as':_0xe338('0xcf'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0xe338('0x5c')]({'where':{'id':_0x49b5b3[_0xe338('0xb2')]['id']},'include':_0x1f1e91})['then'](handleEntityNotFound(_0x3a3777,null))['then'](function(_0x701e4e){if(_0x701e4e){var _0x2faead=_0x701e4e['get']({'plain':!![]});fs['mkdirSync'](_0x389573);var _0x3f8667={'channel':_0xe338('0xd0'),'account':_0x2faead[_0xe338('0xce')][_0xe338('0x2a')],'agent':_0x2faead[_0xe338('0xcf')]?_0x2faead[_0xe338('0xcf')][_0xe338('0x2d')]:_0xe338('0xd1'),'createdAt':moment(_0x2faead[_0xe338('0x72')])['format'](_0xe338('0xba'))[_0xe338('0x95')](),'closedAt':_0x2faead[_0xe338('0xd2')]?moment(_0x2faead[_0xe338('0xd3')])[_0xe338('0xb9')](_0xe338('0xba'))[_0xe338('0x95')]():'','disposition':_0x2faead['disposition'],'messages':_(_0x2faead[_0xe338('0xcb')])[_0xe338('0x7d')]({'secret':![]})['map'](function(_0x487da6){if(_0x487da6[_0xe338('0xca')]){var _0xe92beb=path[_0xe338('0xc2')](_0xf374df,_0x487da6['Attachment'][_0xe338('0xd4')]);if(fs[_0xe338('0xd5')](_0xe92beb)){fs['createReadStream'](_0xe92beb)[_0xe338('0xd6')](fs[_0xe338('0xd7')](path[_0xe338('0xc2')](_0x389573,_0x487da6[_0xe338('0xca')][_0xe338('0xd4')])));}}return{'date':moment(_0x487da6['createdAt'])['format'](_0xe338('0xba'))[_0xe338('0x95')](),'sender':_0x487da6[_0xe338('0xd8')]==='out'?_0x487da6[_0xe338('0x6c')]?_0x487da6['User'][_0xe338('0x2d')]:_0xe338('0xd9'):_0x487da6[_0xe338('0xc8')][_0xe338('0xc9')]+(_0x487da6[_0xe338('0xc8')][_0xe338('0xda')]?'\x20'+_0x487da6[_0xe338('0xc8')][_0xe338('0xda')]:''),'body':_0x487da6[_0xe338('0xca')]?_0x487da6['Attachment'][_0xe338('0xd4')]:_0x487da6[_0xe338('0x6f')],'direction':_0x487da6[_0xe338('0xd8')]===_0xe338('0xdb')?'A':'C','secret':_0x487da6['secret'],'read':_0x487da6[_0xe338('0x78')],'attachment':_0x487da6[_0xe338('0xca')]};})[_0xe338('0x5e')]()};return ejs[_0xe338('0xdc')](path['join'](config[_0xe338('0xc3')],'server',_0xe338('0xdd'),'downloadInteraction.ejs'),{'interaction':_0x3f8667})['then'](function(_0x6c393a){var _0x1de709=path[_0xe338('0xc2')](_0x389573,_0xe338('0xde')+_0x2faead['id']+'-'+_0xed6cad+_0xe338('0xdf'));var _0x5427fb={'path':_0x1de709,'channel':_0xe338('0xd0'),'interactionId':_0x2faead['id']};return pdf[_0xe338('0xe0')](_0x6c393a,_0x5427fb);})[_0xe338('0x28')](function(){return new BPromise(function(_0x284020,_0x3d8006){zipdir(_0x389573,{'saveTo':_0x1335a8},function(_0xc1ceaf,_0x55588b){if(_0xc1ceaf)return _0x3d8006(_0xc1ceaf);return _0x284020(_0x55588b);});})['then'](function(){return new BPromise(function(_0x5d548f,_0x312b73){rimraf(_0x389573,function(_0x145fa1){if(_0x145fa1)_0x312b73(_0x145fa1);return _0x5d548f();});});})[_0xe338('0x28')](function(){return _0x3a3777[_0xe338('0xe1')](_0x1335a8,_0x50c052,function(_0x3e7d83){if(_0x3e7d83){console['log'](_0xe338('0xe2'),_0x3e7d83);}else{fs[_0xe338('0xe3')](_0x1335a8);}});});});}else{return _0x3a3777['sendStatus'](0xc8);}})[_0xe338('0x33')](handleError(_0x3a3777,null));}; \ No newline at end of file +var _0x0627=['err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','map','fullname','Tags','TagIds','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','select','field','tools_tags','u.fullname','ui.WhatsappInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','show','params','includeAll','include','options','create','body','describe','WhatsappMessage','addMessage','ids','omit','filter','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','join','root','tmp','files','attachments','format','CmContact','firstName','lastName','Attachment','secret','WhatsappAccount','Account','get','mkdirSync','Owner','N.A.','disposition','basename','existsSync','createReadStream','pipe','direction','out','System','renderFile','server','views','downloadInteraction.ejs','Whatsapp','createPdfFromHTML'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0627,0x1d8));var _0x7062=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x0627[_0x37b7b6];return _0x10c4c3;};'use strict';var emlformat=require(_0x7062('0x0'));var rimraf=require(_0x7062('0x1'));var zipdir=require(_0x7062('0x2'));var jsonpatch=require(_0x7062('0x3'));var rp=require(_0x7062('0x4'));var moment=require(_0x7062('0x5'));var BPromise=require(_0x7062('0x6'));var Mustache=require(_0x7062('0x7'));var util=require(_0x7062('0x8'));var path=require(_0x7062('0x9'));var sox=require(_0x7062('0xa'));var csv=require('to-csv');var ejs=require(_0x7062('0xb'));var fs=require('fs');var fs_extra=require(_0x7062('0xc'));var _=require(_0x7062('0xd'));var squel=require(_0x7062('0xe'));var crypto=require(_0x7062('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7062('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7062('0x11'));var Papa=require(_0x7062('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7062('0x13'));var as=require(_0x7062('0x14'));var pdf=require(_0x7062('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7062('0x16'))(_0x7062('0x17'));var utils=require(_0x7062('0x18'));var config=require(_0x7062('0x19'));var licenseUtil=require(_0x7062('0x1a'));var db=require(_0x7062('0x1b'))['db'];config[_0x7062('0x1c')]=_[_0x7062('0x1d')](config[_0x7062('0x1c')],{'host':_0x7062('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7062('0x1c')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1e90e6,_0x56a08c){_0x56a08c=_0x56a08c||0xcc;return function(_0x35a5e4){if(_0x35a5e4){return _0x1e90e6[_0x7062('0x1f')](_0x56a08c);}return _0x1e90e6[_0x7062('0x20')](_0x56a08c)['end']();};}function respondWithResult(_0x313588,_0x43ab68){_0x43ab68=_0x43ab68||0xc8;return function(_0x57a136){if(_0x57a136){return _0x313588[_0x7062('0x20')](_0x43ab68)[_0x7062('0x21')](_0x57a136);}};}function respondWithFilteredResult(_0x4af9a8,_0x1ef61e){return function(_0x3d16a2){if(_0x3d16a2){var _0x3c8afa=typeof _0x1ef61e[_0x7062('0x22')]===_0x7062('0x23')&&typeof _0x1ef61e[_0x7062('0x24')]===_0x7062('0x23');var _0x206eb0=_0x3d16a2['count'];var _0x427d02=_0x3c8afa?0x0:_0x1ef61e[_0x7062('0x22')];var _0x15872f=_0x3c8afa?_0x3d16a2['count']:_0x1ef61e[_0x7062('0x22')]+_0x1ef61e[_0x7062('0x24')];var _0x18ee35;if(_0x15872f>=_0x206eb0){_0x15872f=_0x206eb0;_0x18ee35=0xc8;}else{_0x18ee35=0xce;}_0x4af9a8[_0x7062('0x20')](_0x18ee35);return _0x4af9a8['set'](_0x7062('0x25'),_0x427d02+'-'+_0x15872f+'/'+_0x206eb0)[_0x7062('0x21')](_0x3d16a2);}return null;};}function patchUpdates(_0x404b95){return function(_0x5795ef){try{jsonpatch[_0x7062('0x26')](_0x5795ef,_0x404b95,!![]);}catch(_0x10ed14){return BPromise['reject'](_0x10ed14);}return _0x5795ef[_0x7062('0x27')]();};}function saveUpdates(_0x5cdfec,_0x30ceaf){return function(_0x5130be){if(_0x5130be){return _0x5130be[_0x7062('0x28')](_0x5cdfec)[_0x7062('0x29')](function(_0x54ff49){return _0x54ff49;});}return null;};}function removeEntity(_0x13e6f1,_0x28b24b){return function(_0x1138d8){if(_0x1138d8){return _0x1138d8[_0x7062('0x2a')]()[_0x7062('0x29')](function(){_0x13e6f1[_0x7062('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591cd9,_0x3a9181){return function(_0x4e5233){if(!_0x4e5233){_0x591cd9[_0x7062('0x1f')](0x194);}return _0x4e5233;};}function handleError(_0x5b075e,_0x2e7ff2){_0x2e7ff2=_0x2e7ff2||0x1f4;return function(_0x3ecb72){logger[_0x7062('0x2b')](_0x3ecb72[_0x7062('0x2c')]);if(_0x3ecb72[_0x7062('0x2d')]){delete _0x3ecb72[_0x7062('0x2d')];}_0x5b075e['status'](_0x2e7ff2)['send'](_0x3ecb72);};}function getInteractionUsers(_0x462fda,_0xf1582){return new BPromise(function(_0x1343db,_0x5e389c){try{if(_0xf1582[_0x462fda['id']]){_0x462fda['Users']=_[_0x7062('0x2e')](_0xf1582[_0x462fda['id']],function(_0x475ec0){return{'id':_0x475ec0['id'],'fullname':_0x475ec0[_0x7062('0x2f')]};});}}catch(_0x9f8dd2){_0x5e389c(_0x9f8dd2);}_0x1343db(_0x462fda);});}function getInteractionTags(_0x4503e4,_0x4c474c){return new BPromise(function(_0x235c40,_0x1aa8d9){try{if(_0x4503e4['TagIds']){_0x4503e4[_0x7062('0x30')]=[];_0x4503e4[_0x7062('0x31')][_0x7062('0x32')](',')[_0x7062('0x33')](function(_0x2e0d0e){_0x4503e4[_0x7062('0x30')][_0x7062('0x34')](_0x4c474c[_0x2e0d0e]);});}delete _0x4503e4[_0x7062('0x31')];}catch(_0x237d54){_0x1aa8d9(_0x237d54);}_0x235c40(_0x4503e4);});}function updateWhatsappInteraction(_0x2f3050,_0x3ec129,_0x5d2948){return new BPromise(function(_0x2efdfa,_0xecc8e9){return getInteractionUsers(_0x2f3050,_0x5d2948)[_0x7062('0x29')](function(_0x2f6c4c){return getInteractionTags(_0x2f6c4c,_0x3ec129);})[_0x7062('0x29')](function(_0xe98475){_0x2efdfa(_0xe98475);})[_0x7062('0x35')](function(_0x1694bb){_0xecc8e9(_0x1694bb);});});}exports[_0x7062('0x36')]=function(_0x47fe3a,_0x1c6165){var _0x2a6d51={},_0x2b6125={},_0x1f98bf={'count':0x0,'rows':[]};var _0x307916=_['map'](db[_0x7062('0x37')][_0x7062('0x38')],function(_0x346443){return{'name':_0x346443[_0x7062('0x39')],'type':_0x346443[_0x7062('0x3a')][_0x7062('0x3b')]};});_0x2b6125[_0x7062('0x3c')]=_[_0x7062('0x2e')](_0x307916,_0x7062('0x2d'));_0x2b6125[_0x7062('0x3d')]=_[_0x7062('0x3e')](_0x47fe3a[_0x7062('0x3d')]);_0x2b6125[_0x7062('0x3f')]=_[_0x7062('0x40')](_0x2b6125[_0x7062('0x3c')],_0x2b6125[_0x7062('0x3d')]);_0x2a6d51['attributes']=_[_0x7062('0x40')](_0x2b6125[_0x7062('0x3c')],qs[_0x7062('0x41')](_0x47fe3a['query']['fields']));_0x2a6d51['attributes']=_0x2a6d51[_0x7062('0x42')]['length']?_0x2a6d51[_0x7062('0x42')]:_0x2b6125['model'];if(!_0x47fe3a[_0x7062('0x3d')][_0x7062('0x43')](_0x7062('0x44'))){_0x2a6d51[_0x7062('0x24')]=qs[_0x7062('0x24')](_0x47fe3a['query'][_0x7062('0x24')]);_0x2a6d51[_0x7062('0x22')]=qs[_0x7062('0x22')](_0x47fe3a['query'][_0x7062('0x22')]);}_0x2a6d51['order']=qs['sort'](_0x47fe3a[_0x7062('0x3d')][_0x7062('0x45')]);_0x2a6d51['where']=qs[_0x7062('0x3f')](_[_0x7062('0x46')](_0x47fe3a['query'],_0x2b6125[_0x7062('0x3f')]),_0x307916);var _0x491983=[];var _0x5d19ca=squel[_0x7062('0x47')]()['field']('id')[_0x7062('0x48')](_0x7062('0x2d'))[_0x7062('0x48')]('color')['from'](_0x7062('0x49'));var _0x1249c5=squel['select']()[_0x7062('0x48')]('u.id')['field'](_0x7062('0x4a'))[_0x7062('0x48')](_0x7062('0x4b'))[_0x7062('0x4c')]('user_has_whatsapp_interactions','ui')[_0x7062('0x4d')](_0x7062('0x4e'),'u',_0x7062('0x4f'));var _0x5a1625=squel[_0x7062('0x47')]()[_0x7062('0x4c')](_0x7062('0x50'),'i')[_0x7062('0x4d')](_0x7062('0x51'),'c',_0x7062('0x52'))[_0x7062('0x4d')](_0x7062('0x4e'),'o','o.id\x20=\x20i.UserId')[_0x7062('0x4d')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x7062('0x4d')](_0x7062('0x53'),'me',_0x7062('0x54'))[_0x7062('0x4d')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0x7062('0x4d')]('tools_tags','t',_0x7062('0x55'));var _0x10a64c=squel[_0x7062('0x56')]();var _0x454d8c=[];var _0x9fc809=squel['expr']();var _0x22a7fe;if(_0x47fe3a[_0x7062('0x3d')][_0x7062('0x57')]){_0x22a7fe=as[_0x7062('0x58')](_0x47fe3a[_0x7062('0x3d')][_0x7062('0x57')]);var _0x1628dc=_0x22a7fe[_0x7062('0x59')];for(var _0x34b748=0x0;_0x34b748<_0x22a7fe[_0x7062('0x5a')][_0x7062('0x5b')];_0x34b748++){var _0x34dfb3=_0x22a7fe['conditions'][_0x34b748];var _0x2efa12='i';var _0x288ade=_[_0x7062('0x5c')](_0x307916,['name',_0x34dfb3['field']]);if(!_0x288ade){switch(_0x34dfb3['field']){case _0x7062('0x5d'):if(_0x34dfb3[_0x7062('0x5e')]==0x1){_0x5a1625[_0x7062('0x5f')]('`'+_0x34dfb3['field']+_0x7062('0x60'));}else{_0x5a1625['having']('`'+_0x34dfb3[_0x7062('0x48')]+_0x7062('0x61'));}break;case _0x7062('0x62'):if(_0x34dfb3[_0x7062('0x63')]===_0x7062('0x64')){if(_0x34dfb3[_0x7062('0x5e')][_0x7062('0x32')]('\x20')[_0x7062('0x5b')]>0x1){_0x10a64c[_0x1628dc](_0x7062('0x65'),qs[_0x7062('0x66')](_0x34dfb3[_0x7062('0x5e')]),null);}else{var _0x3bed30='%'+_0x34dfb3['value']+'%';_0x10a64c[_0x1628dc](_0x7062('0x67'),_0x3bed30,_0x3bed30,_0x3bed30);}}else{_0x288ade=_[_0x7062('0x5c')](_0x307916,[_0x7062('0x2d'),_0x7062('0x68')]);_0x34dfb3[_0x7062('0x48')]=_0x7062('0x68');_0x2673a6=as[_0x7062('0x69')](_0x2efa12,_0x288ade[_0x7062('0x3a')],_0x34dfb3);_0x10a64c[_0x1628dc](_0x2673a6[_0x7062('0x6a')],_0x2673a6[_0x7062('0x5e')][_0x7062('0x6b')],_0x2673a6[_0x7062('0x5e')][_0x7062('0x6c')]);}break;case'Tag':var _0x4a4cfa=_0x34dfb3[_0x7062('0x5e')][_0x7062('0x32')](',')[_0x7062('0x2e')](function(_0x56ca06){return Number(_0x56ca06);});_0x4a4cfa[_0x7062('0x33')](function(_0x2e3f63){_0x9fc809['or'](_0x7062('0x6d'),'%,'+_0x2e3f63+',%');});_0x454d8c=_[_0x7062('0x6e')](_0x454d8c,_0x4a4cfa);break;case _0x7062('0x6f'):if(_0x34dfb3[_0x7062('0x63')]===_0x7062('0x64')){_0x10a64c[_0x1628dc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x34dfb3[_0x7062('0x5e')]+'%',null);}else{_0x288ade=_[_0x7062('0x5c')](_0x307916,[_0x7062('0x2d'),_0x7062('0x70')]);_0x34dfb3['field']='UserId';_0x2673a6=as[_0x7062('0x69')](_0x2efa12,_0x288ade['type'],_0x34dfb3);_0x10a64c[_0x1628dc](_0x2673a6[_0x7062('0x6a')],_0x2673a6[_0x7062('0x5e')][_0x7062('0x6b')],_0x2673a6['value'][_0x7062('0x6c')]);}break;case'body':_0x2673a6=as[_0x7062('0x69')]('me',null,_0x34dfb3);_0x10a64c[_0x1628dc](_0x2673a6[_0x7062('0x6a')],_0x2673a6['value']['start'],_0x2673a6[_0x7062('0x5e')][_0x7062('0x6c')]);break;}}else{var _0x2673a6=as['buildExpression'](_0x2efa12,_0x288ade[_0x7062('0x3a')],_0x34dfb3);_0x10a64c[_0x1628dc](_0x2673a6[_0x7062('0x6a')],_0x2673a6[_0x7062('0x5e')][_0x7062('0x6b')],_0x2673a6['value'][_0x7062('0x6c')]);}}}else{var _0x5e2823=_(_0x47fe3a[_0x7062('0x3d')])[_0x7062('0x3e')]()[_0x7062('0x2e')](function(_0xdde3c2){return _[_0x7062('0x71')](_0x307916,[_0x7062('0x2d'),_0xdde3c2])?_0xdde3c2:undefined;})[_0x7062('0x72')]()['value']();if(!_[_0x7062('0x73')](_0x5e2823)){_0x5e2823['forEach'](function(_0x2e6ce8){if(_0x2e6ce8===_0x7062('0x74')){_0x5a1625[_0x7062('0x75')](_0x7062('0x76'),[][_0x7062('0x77')](_0x47fe3a[_0x7062('0x3d')][_0x2e6ce8]));}else if(_0x2e6ce8===_0x7062('0x78')){var _0x59bc5f=JSON[_0x7062('0x79')](_0x47fe3a[_0x7062('0x3d')][_0x2e6ce8])[_0x7062('0x7a')];var _0x4af99a=JSON[_0x7062('0x79')](_0x47fe3a[_0x7062('0x3d')][_0x2e6ce8])[_0x7062('0x7b')];_0x5a1625[_0x7062('0x75')](_0x7062('0x7c'),_0x59bc5f,_0x4af99a);}else{if(_0x47fe3a['query'][_0x2e6ce8]===_0x7062('0x7d')){_0x5a1625[_0x7062('0x75')]('i.'+_0x2e6ce8+_0x7062('0x7e'));}else{_0x5a1625['where']('i.'+_0x2e6ce8+_0x7062('0x7f'),_0x47fe3a[_0x7062('0x3d')][_0x2e6ce8]);}}});}if(_0x47fe3a['query'][_0x7062('0x80')]){if(_0x47fe3a['query'][_0x7062('0x80')]==0x1){_0x5a1625[_0x7062('0x5f')](_0x7062('0x81'));}else{_0x5a1625['having'](_0x7062('0x82'));}}if(_0x47fe3a[_0x7062('0x3d')][_0x7062('0x83')]){_0x454d8c=_[_0x7062('0x84')](_0x47fe3a[_0x7062('0x3d')][_0x7062('0x83')])?_0x47fe3a['query']['tag']:new Array(_0x47fe3a[_0x7062('0x3d')]['tag']);_0x454d8c[_0x7062('0x33')](function(_0x5907eb){_0x9fc809['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5907eb+',%');});}if(_0x47fe3a[_0x7062('0x3d')]['filter']){var _0x2f240d=_0x47fe3a[_0x7062('0x3d')]['filter'][_0x7062('0x85')]('\x5c','\x5c\x5c')[_0x7062('0x85')](/'/g,'\x27\x27');if(qs[_0x7062('0x86')](_0x2f240d)){_0x10a64c['or']('i.id\x20LIKE\x20?',_0x2f240d+'%')['or'](_0x7062('0x87'),_0x2f240d+'%');}else{_0x10a64c['or'](_0x7062('0x88'),qs[_0x7062('0x66')](_0x2f240d))['or'](_0x7062('0x89'),_0x2f240d+'%');}}}_0x5a1625[_0x7062('0x75')](_0x10a64c);_0x5a1625['group'](_0x7062('0x8a'));var _0x4cccea={'type':db['Sequelize'][_0x7062('0x8b')][_0x7062('0x8c')],'raw':!![]};var _0x982811=_0x5a1625[_0x7062('0x8d')]();_0x982811['field']('i.id');_0x982811[_0x7062('0x48')](_0x7062('0x8e'),'unreadMessages');if(_0x2a6d51[_0x7062('0x8f')]){_0x2a6d51[_0x7062('0x8f')][_0x7062('0x33')](function(_0x2df0dd){var _0x5df44f=_0x2df0dd[0x0]==='contactName'?_0x2df0dd[0x0]:'i.'+_0x2df0dd[0x0];_0x5a1625['order'](_0x5df44f,_0x2df0dd[0x1]===_0x7062('0x90')?![]:!![]);});}if(!_[_0x7062('0x73')](_0x454d8c)){_0x5a1625[_0x7062('0x5f')](_0x9fc809);_0x982811[_0x7062('0x75')](_0x7062('0x91'),_0x454d8c);}BPromise['resolve']()[_0x7062('0x29')](function(){if(!_0x22a7fe){if(_0x47fe3a[_0x7062('0x3d')][_0x7062('0x74')])return;_0x982811[_0x7062('0x75')](_0x7062('0x92'));_0x5a1625['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x47fe3a[_0x7062('0x93')][_0x7062('0x94')]!==_0x7062('0x95'))return;return _0x47fe3a[_0x7062('0x93')][_0x7062('0x96')]({'attributes':['id'],'raw':!![]})[_0x7062('0x29')](function(_0x5edc1e){if(_[_0x7062('0x73')](_0x5edc1e)){_0x982811[_0x7062('0x75')](_0x7062('0x97'));_0x5a1625[_0x7062('0x75')](_0x7062('0x97'));}else{_0x982811[_0x7062('0x75')]('i.WhatsappAccountId\x20IN\x20?',_[_0x7062('0x2e')](_0x5edc1e,'id'));_0x5a1625[_0x7062('0x75')](_0x7062('0x76'),_[_0x7062('0x2e')](_0x5edc1e,'id'));}});})[_0x7062('0x29')](function(){if(_0x47fe3a[_0x7062('0x93')][_0x7062('0x94')]===_0x7062('0x95')&&!_0x22a7fe&&!_0x47fe3a['query'][_0x7062('0x74')])return[];return db[_0x7062('0x98')][_0x7062('0x3d')](_0x982811[_0x7062('0x99')](),_0x4cccea);})['then'](function(_0x142160){_0x1f98bf[_0x7062('0x9a')]=_0x142160[_0x7062('0x5b')];if(_0x1f98bf[_0x7062('0x9a')]===0x0)return[];return db['sequelize'][_0x7062('0x3d')](_0x5d19ca[_0x7062('0x99')](),_0x4cccea)['then'](function(_0x49ffc3){_0x491983=_[_0x7062('0x9b')](_0x49ffc3,'id');_0x4cccea=_[_0x7062('0x9c')](_0x4cccea,{'model':db[_0x7062('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47fe3a[_0x7062('0x3d')]['fields']){_0x2a6d51['attributes'][_0x7062('0x33')](function(_0x53f0b4){_0x5a1625[_0x7062('0x48')]('i.'+_0x53f0b4);});}else{_0x5a1625['field'](_0x7062('0x8e'),_0x7062('0x5d'));_0x5a1625[_0x7062('0x48')](_0x7062('0x9d'),_0x7062('0x9e'));_0x5a1625['field'](_0x7062('0x9f'),_0x7062('0xa0'));_0x5a1625[_0x7062('0x48')](_0x7062('0xa1'),_0x7062('0xa2'));_0x5a1625[_0x7062('0x48')]('i.*');_0x5a1625[_0x7062('0x48')](_0x7062('0xa3'),_0x7062('0xa4'));_0x5a1625['field'](_0x7062('0xa5'),_0x7062('0xa6'));_0x5a1625['field'](_0x7062('0xa7'),'Contact.email');_0x5a1625[_0x7062('0x48')](_0x7062('0xa8'),_0x7062('0xa9'));_0x5a1625['field'](_0x7062('0xaa'),'Contact.mobile');_0x5a1625[_0x7062('0x48')]('c.fax','Contact.fax');_0x5a1625[_0x7062('0x48')]('o.fullname',_0x7062('0xab'));_0x5a1625[_0x7062('0x48')]('o.internal',_0x7062('0xac'));_0x5a1625[_0x7062('0x48')](_0x7062('0xad'),_0x7062('0x31'));}if(_0x2a6d51[_0x7062('0x24')])_0x5a1625[_0x7062('0x24')](_0x2a6d51[_0x7062('0x24')]);if(_0x2a6d51['offset'])_0x5a1625['offset'](_0x2a6d51['offset']);return db['sequelize'][_0x7062('0x3d')](_0x5a1625['toString'](),_0x4cccea);})[_0x7062('0x29')](function(_0x20680b){if(_0x20680b['length']>0x0)_0x1249c5[_0x7062('0x75')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x7062('0x2e')](_0x20680b,'id'));return db[_0x7062('0x98')][_0x7062('0x3d')](_0x1249c5['toString'](),_0x4cccea)[_0x7062('0x29')](function(_0x53a7ac){var _0x18d930=_[_0x7062('0xae')](_0x53a7ac,_0x7062('0xaf'));var _0xba4077=[];_0x20680b['forEach'](function(_0x43ac2b){_0xba4077[_0x7062('0x34')](updateWhatsappInteraction(_0x43ac2b,_0x491983,_0x18d930));});return BPromise[_0x7062('0xb0')](_0xba4077);});});})[_0x7062('0x29')](function(_0x31f871){_0x1f98bf['rows']=_0x31f871;return _0x1f98bf;})[_0x7062('0x29')](respondWithFilteredResult(_0x1c6165,_0x2a6d51))[_0x7062('0x35')](handleError(_0x1c6165,null));};exports[_0x7062('0xb1')]=function(_0x53b2d4,_0xa687ec){var _0x27af9f={'raw':![],'where':{'id':_0x53b2d4[_0x7062('0xb2')]['id']}},_0x5a2afa={};_0x5a2afa[_0x7062('0x3c')]=_[_0x7062('0x3e')](db[_0x7062('0x37')][_0x7062('0x38')]);_0x5a2afa[_0x7062('0x3d')]=_[_0x7062('0x3e')](_0x53b2d4[_0x7062('0x3d')]);_0x5a2afa[_0x7062('0x3f')]=_['intersection'](_0x5a2afa['model'],_0x5a2afa['query']);_0x27af9f['attributes']=_[_0x7062('0x40')](_0x5a2afa[_0x7062('0x3c')],qs[_0x7062('0x41')](_0x53b2d4[_0x7062('0x3d')][_0x7062('0x41')]));_0x27af9f[_0x7062('0x42')]=_0x27af9f[_0x7062('0x42')][_0x7062('0x5b')]?_0x27af9f[_0x7062('0x42')]:_0x5a2afa[_0x7062('0x3c')];if(_0x53b2d4[_0x7062('0x3d')][_0x7062('0xb3')]){_0x27af9f[_0x7062('0xb4')]=[{'all':!![]}];}_0x27af9f=_[_0x7062('0x9c')]({},_0x27af9f,_0x53b2d4[_0x7062('0xb5')]);return db[_0x7062('0x37')]['find'](_0x27af9f)[_0x7062('0x29')](handleEntityNotFound(_0xa687ec,null))[_0x7062('0x29')](respondWithResult(_0xa687ec,null))['catch'](handleError(_0xa687ec,null));};exports[_0x7062('0xb6')]=function(_0x2233b1,_0x3b556d){return db[_0x7062('0x37')][_0x7062('0xb6')](_0x2233b1['body'],{})['then'](respondWithResult(_0x3b556d,0xc9))[_0x7062('0x35')](handleError(_0x3b556d,null));};exports[_0x7062('0x28')]=function(_0x54bd3c,_0x5b5a6c){if(_0x54bd3c[_0x7062('0xb7')]['id']){delete _0x54bd3c[_0x7062('0xb7')]['id'];}return db[_0x7062('0x37')][_0x7062('0x5c')]({'where':{'id':_0x54bd3c['params']['id']}})[_0x7062('0x29')](handleEntityNotFound(_0x5b5a6c,null))[_0x7062('0x29')](saveUpdates(_0x54bd3c[_0x7062('0xb7')],null))['then'](respondWithResult(_0x5b5a6c,null))[_0x7062('0x35')](handleError(_0x5b5a6c,null));};exports[_0x7062('0x2a')]=function(_0x100d77,_0x2271ca){return db['WhatsappInteraction']['find']({'where':{'id':_0x100d77[_0x7062('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2271ca,null))[_0x7062('0x29')](removeEntity(_0x2271ca,null))[_0x7062('0x35')](handleError(_0x2271ca,null));};exports['describe']=function(_0x47a461,_0x48a14b){return db['WhatsappInteraction'][_0x7062('0xb8')]()[_0x7062('0x29')](respondWithResult(_0x48a14b,null))['catch'](handleError(_0x48a14b,null));};exports['addMessage']=function(_0x372b6f,_0x1f8692,_0xe127b7){return db[_0x7062('0xb9')][_0x7062('0x5c')]({'where':{'id':_0x372b6f['params']['id']}})['then'](handleEntityNotFound(_0x1f8692,null))['then'](function(_0x9be54d){if(_0x9be54d){return _0x9be54d[_0x7062('0xba')](_0x372b6f[_0x7062('0xb7')][_0x7062('0xbb')],_[_0x7062('0xbc')](_0x372b6f[_0x7062('0xb7')],[_0x7062('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x1f8692,null))['catch'](handleError(_0x1f8692,null));};exports['getMessages']=function(_0x552fd5,_0x1ce59e,_0x4d9956){var _0x539b6a={'raw':![],'where':{}};var _0x4e2490={};var _0x37058c={'count':0x0,'rows':[]};return db[_0x7062('0x37')]['findOne']({'where':{'id':_0x552fd5[_0x7062('0xb2')]['id']}})[_0x7062('0x29')](handleEntityNotFound(_0x1ce59e,null))[_0x7062('0x29')](function(_0x72b41b){if(_0x72b41b){_0x4e2490[_0x7062('0x3c')]=_['keys'](db[_0x7062('0xb9')][_0x7062('0x38')]);_0x4e2490['query']=_[_0x7062('0x3e')](_0x552fd5[_0x7062('0x3d')]);_0x4e2490[_0x7062('0x3f')]=_[_0x7062('0x40')](_0x4e2490['model'],_0x4e2490[_0x7062('0x3d')]);_0x539b6a['attributes']=_[_0x7062('0x40')](_0x4e2490['model'],qs[_0x7062('0x41')](_0x552fd5[_0x7062('0x3d')][_0x7062('0x41')]));_0x539b6a[_0x7062('0x42')]=_0x539b6a[_0x7062('0x42')][_0x7062('0x5b')]?_0x539b6a[_0x7062('0x42')]:_0x4e2490[_0x7062('0x3c')];if(!_0x552fd5[_0x7062('0x3d')]['hasOwnProperty'](_0x7062('0x44'))){_0x539b6a[_0x7062('0x24')]=qs[_0x7062('0x24')](_0x552fd5[_0x7062('0x3d')][_0x7062('0x24')]);_0x539b6a[_0x7062('0x22')]=qs[_0x7062('0x22')](_0x552fd5[_0x7062('0x3d')][_0x7062('0x22')]);}_0x539b6a[_0x7062('0x8f')]=qs['sort'](_0x552fd5['query'][_0x7062('0x45')]);_0x539b6a['where']=qs['filters'](_[_0x7062('0x46')](_0x552fd5[_0x7062('0x3d')],_0x4e2490['filters']));_0x539b6a['where'][_0x7062('0xaf')]=_0x72b41b['id'];if(_0x552fd5[_0x7062('0x3d')]['filter']){_0x539b6a[_0x7062('0x75')]=_['merge'](_0x539b6a[_0x7062('0x75')],{'$or':_[_0x7062('0x2e')](_0x539b6a['attributes'],function(_0x32aa52){var _0xc9f3bf={};_0xc9f3bf[_0x32aa52]={'$like':'%'+_0x552fd5[_0x7062('0x3d')][_0x7062('0xbd')]+'%'};return _0xc9f3bf;})});}if(_0x552fd5[_0x7062('0x3d')][_0x7062('0x7a')]){var _0x316627=_0x552fd5[_0x7062('0x3d')][_0x7062('0x7a')]['split'](',');var _0x3bdc28={};_0x3bdc28[_0x316627[0x0]]={'$gte':moment(_0x316627[0x1])['format'](_0x7062('0xbe'))};_0x539b6a[_0x7062('0x75')]=_[_0x7062('0x9c')](_0x539b6a[_0x7062('0x75')],_0x3bdc28);}_0x539b6a=_[_0x7062('0x9c')]({},_0x539b6a,_0x552fd5[_0x7062('0xb5')]);return db[_0x7062('0xb9')][_0x7062('0x9a')]({'where':_0x539b6a['where']})[_0x7062('0x29')](function(_0x14a694){_0x37058c['count']=_0x14a694;if(_0x552fd5[_0x7062('0x3d')]['includeAll']){_0x539b6a[_0x7062('0xb4')]=[{'all':!![]}];}return db[_0x7062('0xb9')][_0x7062('0xbf')](_0x539b6a);})[_0x7062('0x29')](function(_0x35e1dd){_0x37058c[_0x7062('0xc0')]=_0x35e1dd;return _0x37058c;});}})[_0x7062('0x29')](respondWithFilteredResult(_0x1ce59e,_0x539b6a))[_0x7062('0x35')](handleError(_0x1ce59e,null));};exports[_0x7062('0xc1')]=function(_0x25d338,_0x5946d4,_0x21ea39){return db[_0x7062('0x37')][_0x7062('0x5c')]({'where':{'id':_0x25d338[_0x7062('0xb2')]['id']}})[_0x7062('0x29')](handleEntityNotFound(_0x5946d4,null))[_0x7062('0x29')](function(_0x5c404f){if(_0x5c404f){return _0x5c404f[_0x7062('0xc2')](_0x25d338[_0x7062('0xb7')]['ids'],_[_0x7062('0xbc')](_0x25d338['body'],[_0x7062('0xbb'),'id'])||{})[_0x7062('0xc3')](function(){return db[_0x7062('0xc4')][_0x7062('0xbf')]({'attributes':['id','name',_0x7062('0xc5')],'where':{'id':_0x25d338[_0x7062('0xb7')][_0x7062('0xbb')]}});})[_0x7062('0x29')](function(_0x4b1122){socket[_0x7062('0xc6')](_0x7062('0xc7'),{'id':Number(_0x25d338[_0x7062('0xb2')]['id']),'tags':_0x4b1122||[]});return{'id':Number(_0x25d338[_0x7062('0xb2')]['id']),'tags':_0x4b1122||[]};});}})[_0x7062('0x29')](respondWithResult(_0x5946d4,null))['catch'](handleError(_0x5946d4,null));};exports[_0x7062('0xc8')]=function(_0x2860c0,_0x2d8974,_0x1ac9af){return db[_0x7062('0x37')][_0x7062('0x5c')]({'where':{'id':_0x2860c0[_0x7062('0xb2')]['id']}})[_0x7062('0x29')](handleEntityNotFound(_0x2d8974,null))[_0x7062('0x29')](function(_0x44a7c7){if(_0x44a7c7){return _0x44a7c7[_0x7062('0xc8')](_0x2860c0[_0x7062('0x3d')][_0x7062('0xbb')]);}})[_0x7062('0x29')](respondWithStatusCode(_0x2d8974,null))['catch'](handleError(_0x2d8974,null));};exports[_0x7062('0xc9')]=function(_0x5c75e6,_0x236731){var _0x121e5b=moment()['unix']()[_0x7062('0x99')]();var _0x12b839=path[_0x7062('0xca')](config[_0x7062('0xcb')],'server','files',_0x7062('0xcc'));var _0x3158e1=path[_0x7062('0xca')](config['root'],'server',_0x7062('0xcd'),_0x7062('0xce'));var _0xc4058c=path['join'](_0x12b839,_0x121e5b);var _0xff419e=util[_0x7062('0xcf')]('transcript-%d-%s.zip',_0x5c75e6[_0x7062('0xb2')]['id'],_0x121e5b);var _0x398092=path[_0x7062('0xca')](_0x12b839,_0xff419e);var _0xf008fc=[];_0xf008fc[_0x7062('0x34')]({'model':db[_0x7062('0x6f')],'as':'User','attributes':['id',_0x7062('0x2f')],'raw':!![]});_0xf008fc['push']({'model':db[_0x7062('0xd0')],'as':_0x7062('0x62'),'attributes':['id',_0x7062('0xd1'),_0x7062('0xd2')],'raw':!![]});if(_0x5c75e6[_0x7062('0x3d')]['attachments']){_0xf008fc['push']({'model':db[_0x7062('0xd3')],'as':'Attachment','raw':!![]});}var _0x4ee453=[{'model':db[_0x7062('0xb9')],'as':'Messages','attributes':['id',_0x7062('0xb7'),'createdAt','direction',_0x7062('0xd4'),_0x7062('0x80')],'include':_0xf008fc}];_0x4ee453[_0x7062('0x34')]({'model':db[_0x7062('0xd5')],'as':_0x7062('0xd6'),'attributes':['id',_0x7062('0x2d')]});_0x4ee453['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x7062('0x2f')]});return db[_0x7062('0x37')][_0x7062('0x5c')]({'where':{'id':_0x5c75e6[_0x7062('0xb2')]['id']},'include':_0x4ee453})[_0x7062('0x29')](handleEntityNotFound(_0x236731,null))[_0x7062('0x29')](function(_0x5769da){if(_0x5769da){var _0x287a29=_0x5769da[_0x7062('0xd7')]({'plain':!![]});fs[_0x7062('0xd8')](_0xc4058c);var _0x2df8ae={'channel':'Whatsapp','account':_0x287a29['Account'][_0x7062('0x2d')],'agent':_0x287a29[_0x7062('0xd9')]?_0x287a29['Owner'][_0x7062('0x2f')]:_0x7062('0xda'),'createdAt':moment(_0x287a29[_0x7062('0x78')])[_0x7062('0xcf')](_0x7062('0xbe'))[_0x7062('0x99')](),'closedAt':_0x287a29['closed']?moment(_0x287a29['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x287a29[_0x7062('0xdb')],'messages':_(_0x287a29['Messages'])[_0x7062('0xbd')]({'secret':![]})[_0x7062('0x2e')](function(_0x512b30){if(_0x512b30[_0x7062('0xd3')]){var _0x537e40=path[_0x7062('0xca')](_0x3158e1,_0x512b30[_0x7062('0xd3')][_0x7062('0xdc')]);if(fs[_0x7062('0xdd')](_0x537e40)){fs[_0x7062('0xde')](_0x537e40)[_0x7062('0xdf')](fs['createWriteStream'](path[_0x7062('0xca')](_0xc4058c,_0x512b30['Attachment']['basename'])));}}return{'date':moment(_0x512b30[_0x7062('0x78')])[_0x7062('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x512b30[_0x7062('0xe0')]===_0x7062('0xe1')?_0x512b30['User']?_0x512b30[_0x7062('0x6f')][_0x7062('0x2f')]:_0x7062('0xe2'):_0x512b30[_0x7062('0x62')][_0x7062('0xd1')]+(_0x512b30['Contact']['lastName']?'\x20'+_0x512b30[_0x7062('0x62')][_0x7062('0xd2')]:''),'body':_0x512b30[_0x7062('0xd3')]?_0x512b30[_0x7062('0xd3')][_0x7062('0xdc')]:_0x512b30[_0x7062('0xb7')],'direction':_0x512b30[_0x7062('0xe0')]===_0x7062('0xe1')?'A':'C','secret':_0x512b30[_0x7062('0xd4')],'read':_0x512b30[_0x7062('0x80')],'attachment':_0x512b30[_0x7062('0xd3')]};})[_0x7062('0x5e')]()};return ejs[_0x7062('0xe3')](path[_0x7062('0xca')](config[_0x7062('0xcb')],_0x7062('0xe4'),_0x7062('0xe5'),_0x7062('0xe6')),{'interaction':_0x2df8ae})['then'](function(_0x437fcd){var _0x4ed135=path[_0x7062('0xca')](_0xc4058c,'transcript-'+_0x287a29['id']+'-'+_0x121e5b+'.pdf');var _0x122874={'path':_0x4ed135,'channel':_0x7062('0xe7'),'interactionId':_0x287a29['id']};return pdf[_0x7062('0xe8')](_0x437fcd,_0x122874);})[_0x7062('0x29')](function(){return new BPromise(function(_0x14cf9d,_0x5bb4f1){zipdir(_0xc4058c,{'saveTo':_0x398092},function(_0x160ff3,_0x51f911){if(_0x160ff3)return _0x5bb4f1(_0x160ff3);return _0x14cf9d(_0x51f911);});})[_0x7062('0x29')](function(){return new BPromise(function(_0x919711,_0x2b140f){rimraf(_0xc4058c,function(_0x4d9929){if(_0x4d9929)_0x2b140f(_0x4d9929);return _0x919711();});});})['then'](function(){return _0x236731['download'](_0x398092,_0xff419e,function(_0xb1a2ad){if(_0xb1a2ad){console['log'](_0x7062('0xe9'),_0xb1a2ad);}else{fs[_0x7062('0xea')](_0x398092);}});});});}else{return _0x236731[_0x7062('0x1f')](0xc8);}})[_0x7062('0x35')](handleError(_0x236731,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 96ad942..320a3e8 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 _0xa4db=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa4db,0x139));var _0xba4d=function(_0x5dd02a,_0x4c96dd){_0x5dd02a=_0x5dd02a-0x0;var _0x3c0ea4=_0xa4db[_0x5dd02a];return _0x3c0ea4;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xba4d('0x0'))['db'][_0xba4d('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xba4d('0x2')](0x0);var events={'afterCreate':_0xba4d('0x3'),'afterUpdate':_0xba4d('0x4'),'afterDestroy':_0xba4d('0x5')};function emitEvent(_0x5870ff){return function(_0x100cff,_0x4f8bbe,_0x1c798c){_0x100cff[_0xba4d('0x6')]({'attributes':['id'],'raw':!![]})[_0xba4d('0x7')](function(_0x14b2fd){_0x100cff[_0xba4d('0x8')](_0xba4d('0x9'),_0x14b2fd[_0xba4d('0xa')](function(_0x229b56){return{'id':_0x229b56['id']};}));return WhatsappMessage[_0xba4d('0xb')]({'where':{'WhatsappInteractionId':_0x100cff['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a7804){_0x100cff[_0xba4d('0x8')](_0xba4d('0xc'),_0x3a7804[_0xba4d('0xd')]);WhatsappInteractionEvents[_0xba4d('0xe')](_0x5870ff+':'+_0x100cff['id'],_0x100cff);WhatsappInteractionEvents[_0xba4d('0xe')](_0x5870ff,_0x100cff);_0x1c798c(null);})[_0xba4d('0xf')](_0x1c798c(null));};}for(var e in events){if(events[_0xba4d('0x10')](e)){var event=events[e];WhatsappInteraction[_0xba4d('0x11')](e,emitEvent(event));}}module[_0xba4d('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x8a9d=['WhatsappMessage','save','getUsers','then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1855eb,_0x30861d){var _0x2fa479=function(_0x358c64){while(--_0x358c64){_0x1855eb['push'](_0x1855eb['shift']());}};_0x2fa479(++_0x30861d);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x8a9d[_0x1ebce2];return _0x4a330c;};'use strict';var EventEmitter=require(_0xd8a9('0x0'));var WhatsappInteraction=require(_0xd8a9('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xd8a9('0x1'))['db'][_0xd8a9('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8a9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b6f39){return function(_0x2982fe,_0x238bf1,_0x5f56e6){_0x2982fe[_0xd8a9('0x4')]({'attributes':['id'],'raw':!![]})[_0xd8a9('0x5')](function(_0x16bcb2){_0x2982fe['setDataValue']('Users',_0x16bcb2[_0xd8a9('0x6')](function(_0x2be37e){return{'id':_0x2be37e['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2982fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd8a9('0x5')](function(_0xeabfbc){_0x2982fe[_0xd8a9('0x7')](_0xd8a9('0x8'),_0xeabfbc[_0xd8a9('0x9')]);WhatsappInteractionEvents[_0xd8a9('0xa')](_0x1b6f39+':'+_0x2982fe['id'],_0x2982fe);WhatsappInteractionEvents[_0xd8a9('0xa')](_0x1b6f39,_0x2982fe);_0x5f56e6(null);})[_0xd8a9('0xb')](_0x5f56e6(null));};}for(var e in events){if(events[_0xd8a9('0xc')](e)){var event=events[e];WhatsappInteraction[_0xd8a9('0xd')](e,emitEvent(event));}}module[_0xd8a9('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 84ccfef..5ab9b54 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 _0xe35d=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','rimraf'];(function(_0x410344,_0x325a2e){var _0x4a83aa=function(_0x431e2e){while(--_0x431e2e){_0x410344['push'](_0x410344['shift']());}};_0x4a83aa(++_0x325a2e);}(_0xe35d,0xbe));var _0xde35=function(_0x55a774,_0x15c57f){_0x55a774=_0x55a774-0x0;var _0x3a6ccb=_0xe35d[_0x55a774];return _0x3a6ccb;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var logger=require('../../config/logger')(_0xde35('0x2'));var moment=require(_0xde35('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xde35('0x4'));var config=require(_0xde35('0x5'));var attributes=require(_0xde35('0x6'));module[_0xde35('0x7')]=function(_0x2edea0,_0x40c7bb){return _0x2edea0[_0xde35('0x8')](_0xde35('0x9'),attributes,{'tableName':_0xde35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39dcf1,_0x287768,_0x55e967){if(_0x39dcf1[_0xde35('0xb')]('closed')){_0x39dcf1[_0xde35('0xc')]=moment()[_0xde35('0xd')](_0xde35('0xe'));}_0x55e967(null,_0x39dcf1);}}});}; \ No newline at end of file +var _0x1d3a=['./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x35b43f,_0x342119){var _0x36aa19=function(_0x3350d9){while(--_0x3350d9){_0x35b43f['push'](_0x35b43f['shift']());}};_0x36aa19(++_0x342119);}(_0x1d3a,0x105));var _0xa1d3=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x1d3a[_0x75f869];return _0x10af8b;};'use strict';var _=require('lodash');var util=require(_0xa1d3('0x0'));var logger=require(_0xa1d3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa1d3('0x2'));var rp=require(_0xa1d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa1d3('0x4'));var attributes=require(_0xa1d3('0x5'));module['exports']=function(_0x13ab08,_0xb65364){return _0x13ab08[_0xa1d3('0x6')](_0xa1d3('0x7'),attributes,{'tableName':_0xa1d3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dcc72,_0x110795,_0x2c2a4f){if(_0x1dcc72[_0xa1d3('0x9')](_0xa1d3('0xa'))){_0x1dcc72[_0xa1d3('0xb')]=moment()[_0xa1d3('0xc')](_0xa1d3('0xd'));}_0x2c2a4f(null,_0x1dcc72);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3d2b46e..e80fe6a 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 _0x962a=['result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x962a,0x195));var _0xa962=function(_0x14d428,_0x50d3ef){_0x14d428=_0x14d428-0x0;var _0xe165f6=_0x962a[_0x14d428];return _0xe165f6;};'use strict';var _=require(_0xa962('0x0'));var util=require('util');var moment=require(_0xa962('0x1'));var BPromise=require(_0xa962('0x2'));var rs=require(_0xa962('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa962('0x4'))['db'];var utils=require(_0xa962('0x5'));var logger=require(_0xa962('0x6'))(_0xa962('0x7'));var config=require(_0xa962('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa962('0x9')]({'port':0x232a});config['redis']=_[_0xa962('0xa')](config[_0xa962('0xb')],{'host':_0xa962('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa962('0xb')]));require(_0xa962('0xd'))[_0xa962('0xe')](socket);function respondWithRpcPromise(_0x22bc1c,_0x2dcd04,_0x393da8){return new BPromise(function(_0x5348c9,_0x280d40){return client[_0xa962('0xf')](_0x22bc1c,_0x393da8)[_0xa962('0x10')](function(_0x67dc02){logger['info'](_0xa962('0x11'),_0x2dcd04,_0xa962('0x12'));logger[_0xa962('0x13')](_0xa962('0x14'),_0x2dcd04,_0xa962('0x12'),JSON['stringify'](_0x67dc02));if(_0x67dc02[_0xa962('0x15')]){if(_0x67dc02['error'][_0xa962('0x16')]===0x1f4){logger[_0xa962('0x15')](_0xa962('0x11'),_0x2dcd04,_0x67dc02['error'][_0xa962('0x17')]);return _0x280d40(_0x67dc02[_0xa962('0x15')][_0xa962('0x17')]);}logger[_0xa962('0x15')](_0xa962('0x11'),_0x2dcd04,_0x67dc02['error']['message']);return _0x5348c9(_0x67dc02[_0xa962('0x15')][_0xa962('0x17')]);}else{logger[_0xa962('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x2dcd04,_0xa962('0x12'));_0x5348c9(_0x67dc02[_0xa962('0x19')][_0xa962('0x17')]);}})[_0xa962('0x1a')](function(_0x4d0822){logger[_0xa962('0x15')](_0xa962('0x11'),_0x2dcd04,_0x4d0822);_0x280d40(_0x4d0822);});});}exports[_0xa962('0x1b')]=function(_0x21175e){var _0x18cc90=this;return new Promise(function(_0x4ca1e8,_0x55e8a0){return db['WhatsappInteraction'][_0xa962('0x1c')](_0x21175e[_0xa962('0x1d')],{'raw':_0x21175e[_0xa962('0x1e')]?_0x21175e[_0xa962('0x1e')][_0xa962('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21175e[_0xa962('0x1e')]?_0x21175e[_0xa962('0x1e')][_0xa962('0x20')]||null:null,'attributes':_0x21175e[_0xa962('0x1e')]?_0x21175e[_0xa962('0x1e')][_0xa962('0x21')]||null:null,'limit':_0x21175e[_0xa962('0x1e')]?_0x21175e[_0xa962('0x1e')][_0xa962('0x22')]||null:null})[_0xa962('0x10')](function(_0xc77494){logger[_0xa962('0x18')](_0xa962('0x1b'),_0x21175e);logger['debug'](_0xa962('0x1b'),_0x21175e,JSON[_0xa962('0x23')](_0xc77494));_0x4ca1e8(_0xc77494);})['catch'](function(_0x4d01f0){logger[_0xa962('0x15')](_0xa962('0x1b'),_0x4d01f0['message'],_0x21175e);_0x55e8a0(_0x18cc90[_0xa962('0x15')](0x1f4,_0x4d01f0[_0xa962('0x17')]));});});};exports[_0xa962('0x24')]=function(_0x3df355){return new Promise(function(_0x2e135c,_0x587130){return db['WhatsappInteraction'][_0xa962('0x25')]({'where':_0x3df355['options']?_0x3df355['options'][_0xa962('0x20')]||null:null})[_0xa962('0x10')](function(_0x456cba){if(_0x456cba){return _0x456cba[_0xa962('0x26')](_0x3df355[_0xa962('0x1d')]['ids'],_[_0xa962('0x27')](_0x3df355['body'],[_0xa962('0x28'),'id'])||{});}})[_0xa962('0x29')](function(_0x111057){logger[_0xa962('0x18')]('AddTags',_0x3df355);logger[_0xa962('0x13')]('AddTags',_0x3df355,JSON['stringify'](_0x111057));_0x2e135c(_0x111057);})[_0xa962('0x1a')](function(_0xcf911a){logger[_0xa962('0x15')](_0xa962('0x2a'),_0xcf911a['message'],_0x3df355);_0x587130(_this['error'](0x1f4,_0xcf911a[_0xa962('0x17')]));});});}; \ No newline at end of file +var _0x1138=['WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','body','options','raw','where','attributes','limit','debug','catch','WhatsappInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info'];(function(_0x3ff235,_0x428b4d){var _0x409302=function(_0x4ef822){while(--_0x4ef822){_0x3ff235['push'](_0x3ff235['shift']());}};_0x409302(++_0x428b4d);}(_0x1138,0x1a6));var _0x8113=function(_0x306fc9,_0x420385){_0x306fc9=_0x306fc9-0x0;var _0x4971ad=_0x1138[_0x306fc9];return _0x4971ad;};'use strict';var _=require(_0x8113('0x0'));var util=require(_0x8113('0x1'));var moment=require('moment');var BPromise=require(_0x8113('0x2'));var rs=require(_0x8113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8113('0x4'))['db'];var utils=require(_0x8113('0x5'));var logger=require(_0x8113('0x6'))(_0x8113('0x7'));var config=require(_0x8113('0x8'));var jayson=require(_0x8113('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8113('0xa')]=_['defaults'](config[_0x8113('0xa')],{'host':_0x8113('0xb'),'port':0x18eb});var socket=require(_0x8113('0xc'))(new Redis(config['redis']));require(_0x8113('0xd'))[_0x8113('0xe')](socket);function respondWithRpcPromise(_0x51132e,_0x30a2fb,_0x31826f){return new BPromise(function(_0x388aa0,_0x4246c0){return client[_0x8113('0xf')](_0x51132e,_0x31826f)[_0x8113('0x10')](function(_0x4fc1a6){logger[_0x8113('0x11')](_0x8113('0x12'),_0x30a2fb,_0x8113('0x13'));logger['debug'](_0x8113('0x14'),_0x30a2fb,_0x8113('0x13'),JSON[_0x8113('0x15')](_0x4fc1a6));if(_0x4fc1a6[_0x8113('0x16')]){if(_0x4fc1a6[_0x8113('0x16')]['code']===0x1f4){logger[_0x8113('0x16')](_0x8113('0x12'),_0x30a2fb,_0x4fc1a6['error']['message']);return _0x4246c0(_0x4fc1a6[_0x8113('0x16')]['message']);}logger[_0x8113('0x16')](_0x8113('0x12'),_0x30a2fb,_0x4fc1a6[_0x8113('0x16')]['message']);return _0x388aa0(_0x4fc1a6['error'][_0x8113('0x17')]);}else{logger[_0x8113('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x30a2fb,_0x8113('0x13'));_0x388aa0(_0x4fc1a6[_0x8113('0x18')][_0x8113('0x17')]);}})['catch'](function(_0x3beb1b){logger[_0x8113('0x16')](_0x8113('0x12'),_0x30a2fb,_0x3beb1b);_0x4246c0(_0x3beb1b);});});}exports[_0x8113('0x19')]=function(_0x12b8cf){var _0xe72b1e=this;return new Promise(function(_0x870a26,_0x1f6256){return db['WhatsappInteraction']['update'](_0x12b8cf[_0x8113('0x1a')],{'raw':_0x12b8cf[_0x8113('0x1b')]?_0x12b8cf[_0x8113('0x1b')][_0x8113('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12b8cf[_0x8113('0x1b')]?_0x12b8cf[_0x8113('0x1b')][_0x8113('0x1d')]||null:null,'attributes':_0x12b8cf[_0x8113('0x1b')]?_0x12b8cf[_0x8113('0x1b')][_0x8113('0x1e')]||null:null,'limit':_0x12b8cf['options']?_0x12b8cf['options'][_0x8113('0x1f')]||null:null})['then'](function(_0x5bf305){logger[_0x8113('0x11')]('UpdateWhatsappInteraction',_0x12b8cf);logger[_0x8113('0x20')](_0x8113('0x19'),_0x12b8cf,JSON['stringify'](_0x5bf305));_0x870a26(_0x5bf305);})[_0x8113('0x21')](function(_0x2afbea){logger['error'](_0x8113('0x19'),_0x2afbea[_0x8113('0x17')],_0x12b8cf);_0x1f6256(_0xe72b1e[_0x8113('0x16')](0x1f4,_0x2afbea[_0x8113('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x511986){return new Promise(function(_0x48d665,_0x5ec57e){return db[_0x8113('0x22')][_0x8113('0x23')]({'where':_0x511986[_0x8113('0x1b')]?_0x511986[_0x8113('0x1b')][_0x8113('0x1d')]||null:null})[_0x8113('0x10')](function(_0x37bef7){if(_0x37bef7){return _0x37bef7[_0x8113('0x24')](_0x511986[_0x8113('0x1a')][_0x8113('0x25')],_[_0x8113('0x26')](_0x511986[_0x8113('0x1a')],[_0x8113('0x25'),'id'])||{});}})['spread'](function(_0x14a62e){logger[_0x8113('0x11')]('AddTags',_0x511986);logger['debug']('AddTags',_0x511986,JSON[_0x8113('0x15')](_0x14a62e));_0x48d665(_0x14a62e);})[_0x8113('0x21')](function(_0x15c4a6){logger['error'](_0x8113('0x27'),_0x15c4a6[_0x8113('0x17')],_0x511986);_0x5ec57e(_this['error'](0x1f4,_0x15c4a6[_0x8113('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bf0c386..06ebdc0 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 _0xe8c8=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x5ce3be,_0x2fd93a){var _0x204e82=function(_0x220470){while(--_0x220470){_0x5ce3be['push'](_0x5ce3be['shift']());}};_0x204e82(++_0x2fd93a);}(_0xe8c8,0xba));var _0x8e8c=function(_0x450cf1,_0x1c0a13){_0x450cf1=_0x450cf1-0x0;var _0x2d088d=_0xe8c8[_0x450cf1];return _0x2d088d;};'use strict';var WhatsappInteractionEvents=require(_0x8e8c('0x0'));var events=[_0x8e8c('0x1'),_0x8e8c('0x2'),_0x8e8c('0x3')];function createListener(_0x25aec7,_0x52c132){return function(_0x114e35){_0x52c132[_0x8e8c('0x4')](_0x25aec7,_0x114e35);};}function removeListener(_0x5c48e6,_0x2ec180){return function(){WhatsappInteractionEvents[_0x8e8c('0x5')](_0x5c48e6,_0x2ec180);};}exports['register']=function(_0x3fe627){for(var _0x40b074=0x0,_0x2a87b6=events[_0x8e8c('0x6')];_0x40b074<_0x2a87b6;_0x40b074++){var _0x3e6dde=events[_0x40b074];var _0x8082c5=createListener(_0x8e8c('0x7')+_0x3e6dde,_0x3fe627);WhatsappInteractionEvents['on'](_0x3e6dde,_0x8082c5);}}; \ No newline at end of file +var _0xb034=['length','./whatsappInteraction.events','remove','emit','removeListener','register'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xb034,0xfd));var _0x4b03=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xb034[_0x3e32a8];return _0x2997b0;};'use strict';var WhatsappInteractionEvents=require(_0x4b03('0x0'));var events=['save',_0x4b03('0x1'),'update'];function createListener(_0x584fb8,_0x5191d5){return function(_0x59035d){_0x5191d5[_0x4b03('0x2')](_0x584fb8,_0x59035d);};}function removeListener(_0x261418,_0x56d661){return function(){WhatsappInteractionEvents[_0x4b03('0x3')](_0x261418,_0x56d661);};}exports[_0x4b03('0x4')]=function(_0x217879){for(var _0x503fef=0x0,_0x7f52cf=events[_0x4b03('0x5')];_0x503fef<_0x7f52cf;_0x503fef++){var _0x14e9d2=events[_0x503fef];var _0x49845e=createListener('whatsappInteraction:'+_0x14e9d2,_0x217879);WhatsappInteractionEvents['on'](_0x14e9d2,_0x49845e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f666c62..71f67f8 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 _0xbd79=['tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xbd79,0xf4));var _0x9bd7=function(_0xfcfc6,_0x14899c){_0xfcfc6=_0xfcfc6-0x0;var _0x32fdd6=_0xbd79[_0xfcfc6];return _0x32fdd6;};'use strict';var multer=require(_0x9bd7('0x0'));var util=require(_0x9bd7('0x1'));var path=require(_0x9bd7('0x2'));var timeout=require(_0x9bd7('0x3'));var express=require(_0x9bd7('0x4'));var router=express[_0x9bd7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9bd7('0x6'));var interaction=require(_0x9bd7('0x7'));var config=require(_0x9bd7('0x8'));var controller=require('./whatsappMessage.controller');router[_0x9bd7('0x9')]('/',auth[_0x9bd7('0xa')](),controller[_0x9bd7('0xb')]);router['get'](_0x9bd7('0xc'),auth[_0x9bd7('0xa')](),controller[_0x9bd7('0xd')]);router[_0x9bd7('0x9')](_0x9bd7('0xe'),auth['isAuthenticated'](),controller[_0x9bd7('0xf')]);router[_0x9bd7('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9bd7('0x11')](_0x9bd7('0x12'),_0x9bd7('0x13')),controller[_0x9bd7('0x14')]);router[_0x9bd7('0x10')](_0x9bd7('0x15'),controller[_0x9bd7('0x16')]);router[_0x9bd7('0x17')](_0x9bd7('0xe'),auth['isAuthenticated'](),controller[_0x9bd7('0x18')]);router[_0x9bd7('0x17')](_0x9bd7('0x19'),auth[_0x9bd7('0xa')](),controller['accept']);router[_0x9bd7('0x17')](_0x9bd7('0x1a'),auth[_0x9bd7('0xa')](),controller['reject']);router[_0x9bd7('0x1b')](_0x9bd7('0xe'),auth[_0x9bd7('0xa')](),controller['destroy']);module[_0x9bd7('0x1c')]=router; \ No newline at end of file +var _0xebdb=['isAuthenticated','describe','get','show','post','whatsappmessage:create','create','/:id/status','status','put','/:id','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x574786,_0x4951a7){var _0x2689c5=function(_0x299273){while(--_0x299273){_0x574786['push'](_0x574786['shift']());}};_0x2689c5(++_0x4951a7);}(_0xebdb,0x169));var _0xbebd=function(_0x38aec6,_0x2ad06a){_0x38aec6=_0x38aec6-0x0;var _0x56a203=_0xebdb[_0x38aec6];return _0x56a203;};'use strict';var multer=require(_0xbebd('0x0'));var util=require(_0xbebd('0x1'));var path=require('path');var timeout=require(_0xbebd('0x2'));var express=require(_0xbebd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbebd('0x4'));var interaction=require(_0xbebd('0x5'));var config=require(_0xbebd('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xbebd('0x7')](),controller['index']);router['get']('/describe',auth[_0xbebd('0x7')](),controller[_0xbebd('0x8')]);router[_0xbebd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbebd('0xa')]);router[_0xbebd('0xb')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xbebd('0xc')),controller[_0xbebd('0xd')]);router[_0xbebd('0xb')](_0xbebd('0xe'),controller[_0xbebd('0xf')]);router[_0xbebd('0x10')](_0xbebd('0x11'),auth[_0xbebd('0x7')](),controller['update']);router['put']('/:id/accept',auth[_0xbebd('0x7')](),controller[_0xbebd('0x12')]);router[_0xbebd('0x10')](_0xbebd('0x13'),auth[_0xbebd('0x7')](),controller[_0xbebd('0x14')]);router[_0xbebd('0x15')](_0xbebd('0x11'),auth[_0xbebd('0x7')](),controller['destroy']);module[_0xbebd('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7f90c7b..0f69d13 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 _0x749a=['TEXT','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x2dc0ac,_0x247bd8){var _0x172235=function(_0x16c277){while(--_0x16c277){_0x2dc0ac['push'](_0x2dc0ac['shift']());}};_0x172235(++_0x247bd8);}(_0x749a,0xbe));var _0xa749=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x749a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xa749('0x0'));module[_0xa749('0x1')]={'body':{'type':Sequelize[_0xa749('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa749('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa749('0x4')),'defaultValue':_0xa749('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa749('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa749('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa749('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa749('0x5')]},'providerResponse':{'type':Sequelize[_0xa749('0x2')]}}; \ No newline at end of file +var _0x4e00=['medium','BOOLEAN','out','STRING','DATE','TEXT','exports'];(function(_0x50821e,_0x55c6c6){var _0x57f32c=function(_0x461d93){while(--_0x461d93){_0x50821e['push'](_0x50821e['shift']());}};_0x57f32c(++_0x55c6c6);}(_0x4e00,0xa0));var _0x04e0=function(_0xebd809,_0x2c5692){_0xebd809=_0xebd809-0x0;var _0x50fc31=_0x4e00[_0xebd809];return _0x50fc31;};'use strict';var Sequelize=require('sequelize');module[_0x04e0('0x0')]={'body':{'type':Sequelize['TEXT'](_0x04e0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x04e0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x04e0('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x04e0('0x4')]},'readAt':{'type':Sequelize[_0x04e0('0x5')]},'secret':{'type':Sequelize[_0x04e0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x04e0('0x4')]},'providerResponse':{'type':Sequelize[_0x04e0('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 95912a5..3c5cf76 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 _0xecec=['contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./whatsappMessage.socket','client','http','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','keys','intersection','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes'];(function(_0x48bac4,_0x3d522f){var _0x3406d2=function(_0x9bc7f){while(--_0x9bc7f){_0x48bac4['push'](_0x48bac4['shift']());}};_0x3406d2(++_0x3d522f);}(_0xecec,0x134));var _0xcece=function(_0x35f226,_0x301d24){_0x35f226=_0x35f226-0x0;var _0xe7f53b=_0xecec[_0x35f226];return _0xe7f53b;};'use strict';var emlformat=require(_0xcece('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcece('0x1'));var jsonpatch=require(_0xcece('0x2'));var rp=require(_0xcece('0x3'));var moment=require(_0xcece('0x4'));var BPromise=require(_0xcece('0x5'));var Mustache=require(_0xcece('0x6'));var util=require(_0xcece('0x7'));var path=require(_0xcece('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcece('0x9'));var fs=require('fs');var fs_extra=require(_0xcece('0xa'));var _=require(_0xcece('0xb'));var squel=require(_0xcece('0xc'));var crypto=require('crypto');var jsforce=require(_0xcece('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcece('0xe'));var querystring=require(_0xcece('0xf'));var Papa=require(_0xcece('0x10'));var Redis=require('ioredis');var authService=require(_0xcece('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcece('0x12'));var logger=require(_0xcece('0x13'))(_0xcece('0x14'));var utils=require(_0xcece('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcece('0x16'));var db=require(_0xcece('0x17'))['db'];config['redis']=_[_0xcece('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcece('0x19'))(new Redis(config[_0xcece('0x1a')]));require(_0xcece('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xcece('0x1c')][_0xcece('0x1d')]({'port':0x232c});var client9002=jayson[_0xcece('0x1c')][_0xcece('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x39c9f,_0x34fbd5,_0x366112,_0x42a350){return new BPromise(function(_0x21b135,_0x53ed86){var _0x44fc1b=_0x42a350||client;return _0x44fc1b[_0xcece('0x1e')](_0x39c9f,_0x366112)[_0xcece('0x1f')](function(_0x39eca5){logger[_0xcece('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x34fbd5,_0xcece('0x21'));logger['debug'](_0xcece('0x22'),_0x34fbd5,_0xcece('0x21'),JSON[_0xcece('0x23')](_0x39eca5));if(_0x39eca5[_0xcece('0x24')]){if(_0x39eca5[_0xcece('0x24')][_0xcece('0x25')]===0x1f4){logger[_0xcece('0x24')](_0xcece('0x26'),_0x34fbd5,_0x39eca5[_0xcece('0x24')]['message']);return _0x53ed86(_0x39eca5[_0xcece('0x24')][_0xcece('0x27')]);}logger[_0xcece('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x34fbd5,_0x39eca5['error'][_0xcece('0x27')]);return _0x21b135(_0x39eca5['error'][_0xcece('0x27')]);}else{logger[_0xcece('0x20')](_0xcece('0x26'),_0x34fbd5,_0xcece('0x21'));_0x21b135(_0x39eca5['result']['message']);}})[_0xcece('0x28')](function(_0x2d71fd){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x34fbd5,_0x2d71fd);_0x53ed86(_0x2d71fd);});});}function respondWithStatusCode(_0x5465b3,_0x1bfb0e){_0x1bfb0e=_0x1bfb0e||0xcc;return function(_0x4d44fd){if(_0x4d44fd){return _0x5465b3[_0xcece('0x29')](_0x1bfb0e);}return _0x5465b3[_0xcece('0x2a')](_0x1bfb0e)['end']();};}function respondWithResult(_0x3ec99f,_0x355f1e){_0x355f1e=_0x355f1e||0xc8;return function(_0x3e655e){if(_0x3e655e){return _0x3ec99f['status'](_0x355f1e)[_0xcece('0x2b')](_0x3e655e);}};}function respondWithFilteredResult(_0x138c21,_0xa706b0){return function(_0x3cb78e){if(_0x3cb78e){var _0x272d6e=typeof _0xa706b0['offset']===_0xcece('0x2c')&&typeof _0xa706b0[_0xcece('0x2d')]===_0xcece('0x2c');var _0x1b048e=_0x3cb78e['count'];var _0xed4991=_0x272d6e?0x0:_0xa706b0[_0xcece('0x2e')];var _0x329630=_0x272d6e?_0x3cb78e['count']:_0xa706b0[_0xcece('0x2e')]+_0xa706b0[_0xcece('0x2d')];var _0x3d0b84;if(_0x329630>=_0x1b048e){_0x329630=_0x1b048e;_0x3d0b84=0xc8;}else{_0x3d0b84=0xce;}_0x138c21['status'](_0x3d0b84);return _0x138c21[_0xcece('0x2f')](_0xcece('0x30'),_0xed4991+'-'+_0x329630+'/'+_0x1b048e)[_0xcece('0x2b')](_0x3cb78e);}return null;};}function patchUpdates(_0x4cd2f1){return function(_0x363ad6){try{jsonpatch[_0xcece('0x31')](_0x363ad6,_0x4cd2f1,!![]);}catch(_0x2b927f){return BPromise['reject'](_0x2b927f);}return _0x363ad6[_0xcece('0x32')]();};}function saveUpdates(_0x2fa483,_0x4d8168){return function(_0x3e571c){if(_0x3e571c){return _0x3e571c[_0xcece('0x33')](_0x2fa483)[_0xcece('0x1f')](function(_0x3a5eab){return _0x3a5eab;});}return null;};}function removeEntity(_0x570208,_0x7d8c3b){return function(_0x21d69f){if(_0x21d69f){return _0x21d69f[_0xcece('0x34')]()['then'](function(){_0x570208[_0xcece('0x2a')](0xcc)[_0xcece('0x35')]();});}};}function handleEntityNotFound(_0x29c8cb,_0x34bc8c){return function(_0x10252d){if(!_0x10252d){_0x29c8cb[_0xcece('0x29')](0x194);}return _0x10252d;};}function handleError(_0x33ddd7,_0x3bc60c){_0x3bc60c=_0x3bc60c||0x1f4;return function(_0xa7aaa){logger['error'](_0xa7aaa[_0xcece('0x36')]);if(_0xa7aaa[_0xcece('0x37')]){delete _0xa7aaa[_0xcece('0x37')];}_0x33ddd7['status'](_0x3bc60c)[_0xcece('0x38')](_0xa7aaa);};}exports[_0xcece('0x39')]=function(_0x46ce89,_0x27f145){var _0x35f7ee={},_0x42f27d={},_0x32ea87={'count':0x0,'rows':[]};var _0x45d5f1=_[_0xcece('0x3a')](db[_0xcece('0x3b')][_0xcece('0x3c')],function(_0x1a123c){return{'name':_0x1a123c[_0xcece('0x3d')],'type':_0x1a123c[_0xcece('0x3e')][_0xcece('0x3f')]};});_0x42f27d[_0xcece('0x40')]=_[_0xcece('0x3a')](_0x45d5f1,_0xcece('0x37'));_0x42f27d[_0xcece('0x41')]=_['keys'](_0x46ce89[_0xcece('0x41')]);_0x42f27d[_0xcece('0x42')]=_['intersection'](_0x42f27d['model'],_0x42f27d[_0xcece('0x41')]);_0x35f7ee['attributes']=_['intersection'](_0x42f27d[_0xcece('0x40')],qs[_0xcece('0x43')](_0x46ce89[_0xcece('0x41')][_0xcece('0x43')]));_0x35f7ee[_0xcece('0x44')]=_0x35f7ee['attributes'][_0xcece('0x45')]?_0x35f7ee[_0xcece('0x44')]:_0x42f27d[_0xcece('0x40')];if(!_0x46ce89[_0xcece('0x41')][_0xcece('0x46')]('nolimit')){_0x35f7ee[_0xcece('0x2d')]=qs[_0xcece('0x2d')](_0x46ce89['query']['limit']);_0x35f7ee[_0xcece('0x2e')]=qs[_0xcece('0x2e')](_0x46ce89['query'][_0xcece('0x2e')]);}_0x35f7ee[_0xcece('0x47')]=qs[_0xcece('0x48')](_0x46ce89[_0xcece('0x41')]['sort']);_0x35f7ee['where']=qs[_0xcece('0x42')](_[_0xcece('0x49')](_0x46ce89[_0xcece('0x41')],_0x42f27d['filters']),_0x45d5f1);if(_0x46ce89[_0xcece('0x41')][_0xcece('0x4a')]){_0x35f7ee[_0xcece('0x4b')]=_['merge'](_0x35f7ee['where'],{'$or':_[_0xcece('0x3a')](_0x45d5f1,function(_0x1e6680){if(_0x1e6680[_0xcece('0x3e')]!=='VIRTUAL'){var _0x2492f3={};_0x2492f3[_0x1e6680[_0xcece('0x37')]]={'$like':'%'+_0x46ce89['query']['filter']+'%'};return _0x2492f3;}})});}_0x35f7ee=_[_0xcece('0x4c')]({},_0x35f7ee,_0x46ce89[_0xcece('0x4d')]);var _0x2bae52={'where':_0x35f7ee['where']};return db['WhatsappMessage'][_0xcece('0x4e')](_0x2bae52)[_0xcece('0x1f')](function(_0x2a4c2c){_0x32ea87[_0xcece('0x4e')]=_0x2a4c2c;if(_0x46ce89['query'][_0xcece('0x4f')]){_0x35f7ee[_0xcece('0x50')]=[{'all':!![]}];}return db[_0xcece('0x3b')][_0xcece('0x51')](_0x35f7ee);})['then'](function(_0x474994){_0x32ea87[_0xcece('0x52')]=_0x474994;return _0x32ea87;})[_0xcece('0x1f')](respondWithFilteredResult(_0x27f145,_0x35f7ee))[_0xcece('0x28')](handleError(_0x27f145,null));};exports['show']=function(_0x25c668,_0x3085b8){var _0x3e7af9={'raw':!![],'where':{'id':_0x25c668['params']['id']}},_0x4fffbd={};_0x4fffbd[_0xcece('0x40')]=_['keys'](db[_0xcece('0x3b')][_0xcece('0x3c')]);_0x4fffbd[_0xcece('0x41')]=_[_0xcece('0x53')](_0x25c668['query']);_0x4fffbd[_0xcece('0x42')]=_['intersection'](_0x4fffbd[_0xcece('0x40')],_0x4fffbd[_0xcece('0x41')]);_0x3e7af9[_0xcece('0x44')]=_[_0xcece('0x54')](_0x4fffbd['model'],qs['fields'](_0x25c668[_0xcece('0x41')][_0xcece('0x43')]));_0x3e7af9[_0xcece('0x44')]=_0x3e7af9[_0xcece('0x44')]['length']?_0x3e7af9['attributes']:_0x4fffbd[_0xcece('0x40')];if(_0x25c668['query'][_0xcece('0x4f')]){_0x3e7af9['include']=[{'all':!![]}];}_0x3e7af9=_['merge']({},_0x3e7af9,_0x25c668[_0xcece('0x4d')]);return db[_0xcece('0x3b')][_0xcece('0x55')](_0x3e7af9)['then'](handleEntityNotFound(_0x3085b8,null))[_0xcece('0x1f')](respondWithResult(_0x3085b8,null))[_0xcece('0x28')](handleError(_0x3085b8,null));};exports['create']=function(_0x3dfd4e,_0x41bd20){return db[_0xcece('0x3b')][_0xcece('0x56')](_0x3dfd4e[_0xcece('0x57')],{})[_0xcece('0x1f')](respondWithResult(_0x41bd20,0xc9))['catch'](handleError(_0x41bd20,null));};exports['update']=function(_0x4f6ccb,_0x4eb53c){if(_0x4f6ccb[_0xcece('0x57')]['id']){delete _0x4f6ccb[_0xcece('0x57')]['id'];}return db[_0xcece('0x3b')][_0xcece('0x55')]({'where':{'id':_0x4f6ccb[_0xcece('0x58')]['id']}})[_0xcece('0x1f')](handleEntityNotFound(_0x4eb53c,null))[_0xcece('0x1f')](saveUpdates(_0x4f6ccb['body'],null))[_0xcece('0x1f')](respondWithResult(_0x4eb53c,null))['catch'](handleError(_0x4eb53c,null));};exports[_0xcece('0x34')]=function(_0x33aa83,_0xd143df){return db[_0xcece('0x3b')][_0xcece('0x55')]({'where':{'id':_0x33aa83[_0xcece('0x58')]['id']}})[_0xcece('0x1f')](handleEntityNotFound(_0xd143df,null))['then'](removeEntity(_0xd143df,null))[_0xcece('0x28')](handleError(_0xd143df,null));};exports[_0xcece('0x59')]=function(_0x41d01b,_0x59e220){return db[_0xcece('0x3b')]['describe']()[_0xcece('0x1f')](respondWithResult(_0x59e220,null))['catch'](handleError(_0x59e220,null));};var interaction_log=require(_0xcece('0x13'))(_0xcece('0x5a'));exports[_0xcece('0x5b')]=function(_0x1e38e9,_0x5069ea,_0x4fcd9a){var _0x5910b8={'agent':{},'channel':_0xcece('0x5c')};if(_0x1e38e9['body']['id']){delete _0x1e38e9[_0xcece('0x57')]['id'];}_0x1e38e9[_0xcece('0x57')][_0xcece('0x5d')]=!![];_0x1e38e9[_0xcece('0x57')][_0xcece('0x5e')]=moment()[_0xcece('0x5f')](_0xcece('0x60'));_0x1e38e9[_0xcece('0x57')][_0xcece('0x61')]=_0x1e38e9['body'][_0xcece('0x61')]||_0x1e38e9[_0xcece('0x62')]['id'];_0x5910b8[_0xcece('0x63')]['id']=_0x1e38e9[_0xcece('0x57')][_0xcece('0x61')];return db['WhatsappMessage'][_0xcece('0x55')]({'where':{'id':_0x1e38e9[_0xcece('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5069ea,null))[_0xcece('0x1f')](saveUpdates(_0x1e38e9[_0xcece('0x57')],null))['then'](function(_0x28a52c){if(_0x28a52c){_0x5910b8['message']=_0x28a52c[_0xcece('0x64')]({'plain':!![]});return db[_0xcece('0x65')][_0xcece('0x55')]({'where':{'id':_0x28a52c[_0xcece('0x66')]}});}return null;})[_0xcece('0x1f')](handleEntityNotFound(_0x5069ea,null))[_0xcece('0x1f')](function(_0x133a20){if(_0x133a20){return _0x133a20[_0xcece('0x33')]({'UserId':_0x1e38e9[_0xcece('0x57')][_0xcece('0x61')],'read1stAt':_['isNil'](_0x133a20[_0xcece('0x67')])?moment()[_0xcece('0x5f')](_0xcece('0x60')):undefined});}return null;})['then'](function(_0x81d06){if(_0x81d06){_0x5910b8[_0xcece('0x68')]=_0x81d06[_0xcece('0x64')]({'plain':!![]});interaction_log[_0xcece('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e38e9[_0xcece('0x62')]['id'],_0x1e38e9[_0xcece('0x62')][_0xcece('0x37')],_0x1e38e9['user'][_0xcece('0x69')],_0x5910b8[_0xcece('0x68')]['id'],_0x1e38e9[_0xcece('0x57')]?JSON[_0xcece('0x23')](_0x1e38e9['body']):_0xcece('0x6a'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5910b8);}return null;})['then'](function(_0x39c372){var _0x5adc3c=_0xcece('0x6b')+_0x39c372['message'][_0xcece('0x6c')];return db[_0xcece('0x6d')]['query'](_0x5adc3c,{'type':db[_0xcece('0x6e')][_0xcece('0x6f')]['SELECT'],'raw':!![]})[_0xcece('0x1f')](function(_0x26f0c6){return _0x26f0c6;});})[_0xcece('0x1f')](function(_0xe2af8c){if(_0xe2af8c){_0x5910b8[_0xcece('0x27')][_0xcece('0x70')]=_0xe2af8c[0x0];if(!_0x1e38e9[_0xcece('0x57')][_0xcece('0x61')])return;return db[_0xcece('0x71')]['find']({'where':{'id':_0x1e38e9['body'][_0xcece('0x61')],'role':_0xcece('0x63')},'attributes':['id',_0xcece('0x37'),_0xcece('0x72'),_0xcece('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x21e36e){if(!_0x21e36e)return null;_0x5910b8[_0xcece('0x27')][_0xcece('0x63')]=_0x21e36e;return _0x5910b8;})[_0xcece('0x1f')](function(_0x284614){if(_0x284614){if(_0x1e38e9[_0xcece('0x57')][_0xcece('0x74')]){_0x5910b8[_0xcece('0x27')][_0xcece('0x75')]=util[_0xcece('0x5f')](_0xcece('0x76'),_0x1e38e9[_0xcece('0x62')][_0xcece('0x37')]);_0x5910b8[_0xcece('0x27')][_0xcece('0x77')]=_0x5910b8['channel'];_0x5910b8['message'][_0xcece('0x78')]=_0x5910b8[_0xcece('0x77')];_0x5910b8['message'][_0xcece('0x79')]=_0xcece('0x5b');return respondWithRpcPromise(_0xcece('0x7a'),_0xcece('0x7a'),{'event':_0xcece('0x7b'),'message':_0x5910b8['message']},client9002)[_0xcece('0x1f')](function(){return _0x5910b8;});}return _0x5910b8;}return null;})[_0xcece('0x1f')](respondWithResult(_0x5069ea,null))[_0xcece('0x28')](handleError(_0x5069ea,null));};var interaction_log=require(_0xcece('0x13'))(_0xcece('0x5a'));exports[_0xcece('0x7c')]=function(_0x3c6219,_0x222b68,_0x2ed951){var _0x26972f={'agent':{},'channel':_0xcece('0x5c')};if(_0x3c6219[_0xcece('0x57')]['id']){delete _0x3c6219[_0xcece('0x57')]['id'];}_0x3c6219[_0xcece('0x57')]['UserId']=_0x3c6219['body'][_0xcece('0x61')]||_0x3c6219['user']['id'];_0x26972f[_0xcece('0x63')]['id']=_0x3c6219['body']['UserId'];return db[_0xcece('0x3b')][_0xcece('0x55')]({'where':{'id':_0x3c6219[_0xcece('0x58')]['id'],'UserId':null}})[_0xcece('0x1f')](handleEntityNotFound(_0x222b68,null))[_0xcece('0x1f')](function(_0xafec9f){if(_0xafec9f){_0x26972f[_0xcece('0x27')]=_0xafec9f[_0xcece('0x64')]({'plain':!![]});return db[_0xcece('0x65')][_0xcece('0x55')]({'where':{'id':_0xafec9f[_0xcece('0x66')]}});}return null;})[_0xcece('0x1f')](handleEntityNotFound(_0x222b68,null))[_0xcece('0x1f')](function(_0x57cae4){if(_0x57cae4){_0x26972f[_0xcece('0x68')]=_0x57cae4[_0xcece('0x64')]({'plain':!![]});interaction_log[_0xcece('0x20')](_0xcece('0x7d'),_0x3c6219[_0xcece('0x62')]['id'],_0x3c6219['user']['name'],_0x3c6219[_0xcece('0x62')][_0xcece('0x69')],_0x26972f[_0xcece('0x68')]['id'],_0x3c6219[_0xcece('0x57')]?JSON['stringify'](_0x3c6219[_0xcece('0x57')]):_0xcece('0x6a'));return respondWithRpcPromise(_0xcece('0x7e'),_0xcece('0x7f'),_0x26972f);}return null;})[_0xcece('0x1f')](function(_0x10ae89){var _0x439c94=_0xcece('0x6b')+_0x10ae89[_0xcece('0x27')][_0xcece('0x6c')];return db[_0xcece('0x6d')][_0xcece('0x41')](_0x439c94,{'type':db[_0xcece('0x6e')][_0xcece('0x6f')][_0xcece('0x80')],'raw':!![]})[_0xcece('0x1f')](function(_0x5e4b5b){return _0x5e4b5b;});})[_0xcece('0x1f')](function(_0x196ba3){if(_0x196ba3){_0x26972f['message'][_0xcece('0x70')]=_0x196ba3[0x0];if(!_0x3c6219[_0xcece('0x57')][_0xcece('0x61')])return;return db[_0xcece('0x71')][_0xcece('0x55')]({'where':{'id':_0x3c6219[_0xcece('0x57')]['UserId'],'role':_0xcece('0x63')},'attributes':['id','name','fullname',_0xcece('0x73'),_0xcece('0x81')],'raw':!![]});}return null;})[_0xcece('0x1f')](function(_0x566eec){if(!_0x566eec)return null;_0x26972f[_0xcece('0x27')][_0xcece('0x63')]=_0x566eec;return _0x26972f;})[_0xcece('0x1f')](function(_0x3b5e4f){if(_0x3b5e4f){_0x3b5e4f[_0xcece('0x27')][_0xcece('0x75')]=util['format'](_0xcece('0x76'),_0x3c6219[_0xcece('0x62')][_0xcece('0x37')]);_0x3b5e4f[_0xcece('0x27')][_0xcece('0x77')]=_0x26972f[_0xcece('0x77')];_0x3b5e4f[_0xcece('0x27')]['motionChannel']=_0x26972f[_0xcece('0x77')];_0x3b5e4f[_0xcece('0x27')][_0xcece('0x79')]=_0xcece('0x7c');respondWithRpcPromise(_0xcece('0x7a'),'EventManager',{'event':_0xcece('0x82'),'message':_0x3b5e4f[_0xcece('0x27')]},client9002);return _0x26972f;}return null;})[_0xcece('0x1f')](respondWithResult(_0x222b68,null))[_0xcece('0x28')](handleError(_0x222b68,null));};exports[_0xcece('0x2a')]=function(_0x422c54,_0x2febbb,_0x44d5a1){if(_0x422c54[_0xcece('0x57')]['id']){delete _0x422c54[_0xcece('0x57')]['id'];}var _0xb1714e;return db[_0xcece('0x3b')][_0xcece('0x55')]({'where':{'id':_0x422c54[_0xcece('0x58')]['id']}})[_0xcece('0x1f')](handleEntityNotFound(_0x2febbb,null))[_0xcece('0x1f')](function(_0x5315d7){if(_0x5315d7){_0xb1714e=_0x5315d7;return db[_0xcece('0x83')]['find']({'where':{'id':_0x5315d7[_0xcece('0x84')]}});}})[_0xcece('0x1f')](handleEntityNotFound(_0x2febbb,null))[_0xcece('0x1f')](function(_0x5cffbe){if(_0x5cffbe){logger[_0xcece('0x85')](_0xcece('0x86'),_0xcece('0x2a'),'received\x20delivery\x20report\x20from',_0x5cffbe[_0xcece('0x3e')],util[_0xcece('0x87')](_0x422c54[_0xcece('0x57')],{'showHidden':![],'depth':null}));switch(_0x5cffbe['type']){case _0xcece('0x88'):if(_0x422c54[_0xcece('0x57')]['MessageSid']&&_0x422c54[_0xcece('0x57')][_0xcece('0x89')]===_0xb1714e['messageId']&&_0x422c54[_0xcece('0x57')][_0xcece('0x8a')]&&_0x422c54[_0xcece('0x57')][_0xcece('0x8a')]===_0xcece('0x5d')){return _0xb1714e[_0xcece('0x33')]({'read':!![]});}else{logger[_0xcece('0x24')](_0xcece('0x8b'),_0xcece('0x2a'),_0xcece('0x88'),util[_0xcece('0x87')](_0x422c54[_0xcece('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xb1714e;}})[_0xcece('0x1f')](respondWithResult(_0x2febbb,null))['catch'](handleError(_0x2febbb,null));}; \ No newline at end of file +var _0xb08f=['./whatsappMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','include','find','create','body','destroy','describe','whatsapp-interactions','whatsapp','read','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','internal','WhatsappAccount','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x5789d2,_0x3297f6){var _0x4d5938=function(_0x3b3f82){while(--_0x3b3f82){_0x5789d2['push'](_0x5789d2['shift']());}};_0x4d5938(++_0x3297f6);}(_0xb08f,0xfc));var _0xfb08=function(_0x1d29d6,_0x119ccd){_0x1d29d6=_0x1d29d6-0x0;var _0x587c41=_0xb08f[_0x1d29d6];return _0x587c41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb08('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb08('0x1'));var rp=require('request-promise');var moment=require(_0xfb08('0x2'));var BPromise=require(_0xfb08('0x3'));var Mustache=require('mustache');var util=require(_0xfb08('0x4'));var path=require('path');var sox=require(_0xfb08('0x5'));var csv=require(_0xfb08('0x6'));var ejs=require(_0xfb08('0x7'));var fs=require('fs');var fs_extra=require(_0xfb08('0x8'));var _=require(_0xfb08('0x9'));var squel=require(_0xfb08('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb08('0xb'));var deskjs=require(_0xfb08('0xc'));var toCsv=require(_0xfb08('0x6'));var querystring=require(_0xfb08('0xd'));var Papa=require('papaparse');var Redis=require(_0xfb08('0xe'));var authService=require(_0xfb08('0xf'));var qs=require(_0xfb08('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb08('0x11'));var logger=require(_0xfb08('0x12'))('api');var utils=require(_0xfb08('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfb08('0x14'));var db=require(_0xfb08('0x15'))['db'];config[_0xfb08('0x16')]=_[_0xfb08('0x17')](config['redis'],{'host':_0xfb08('0x18'),'port':0x18eb});var socket=require(_0xfb08('0x19'))(new Redis(config['redis']));require(_0xfb08('0x1a'))[_0xfb08('0x1b')](socket);var jayson=require(_0xfb08('0x1c'));var client=jayson[_0xfb08('0x1d')][_0xfb08('0x1e')]({'port':0x232c});var client9002=jayson[_0xfb08('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x134425,_0x41e050,_0x5efe9e,_0xefe3ef){return new BPromise(function(_0x473cf3,_0x2e55bf){var _0x5b4ecf=_0xefe3ef||client;return _0x5b4ecf[_0xfb08('0x1f')](_0x134425,_0x5efe9e)['then'](function(_0x46f1fa){logger[_0xfb08('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x41e050,_0xfb08('0x21'));logger[_0xfb08('0x22')](_0xfb08('0x23'),_0x41e050,_0xfb08('0x21'),JSON[_0xfb08('0x24')](_0x46f1fa));if(_0x46f1fa['error']){if(_0x46f1fa[_0xfb08('0x25')]['code']===0x1f4){logger['error'](_0xfb08('0x26'),_0x41e050,_0x46f1fa[_0xfb08('0x25')][_0xfb08('0x27')]);return _0x2e55bf(_0x46f1fa['error'][_0xfb08('0x27')]);}logger[_0xfb08('0x25')](_0xfb08('0x26'),_0x41e050,_0x46f1fa[_0xfb08('0x25')]['message']);return _0x473cf3(_0x46f1fa[_0xfb08('0x25')][_0xfb08('0x27')]);}else{logger[_0xfb08('0x20')](_0xfb08('0x26'),_0x41e050,'request\x20sent');_0x473cf3(_0x46f1fa[_0xfb08('0x28')][_0xfb08('0x27')]);}})[_0xfb08('0x29')](function(_0x2a46e6){logger[_0xfb08('0x25')](_0xfb08('0x26'),_0x41e050,_0x2a46e6);_0x2e55bf(_0x2a46e6);});});}function respondWithStatusCode(_0x3bdafc,_0x21b6a2){_0x21b6a2=_0x21b6a2||0xcc;return function(_0x1ddf43){if(_0x1ddf43){return _0x3bdafc['sendStatus'](_0x21b6a2);}return _0x3bdafc[_0xfb08('0x2a')](_0x21b6a2)[_0xfb08('0x2b')]();};}function respondWithResult(_0x1c9ae8,_0x496d36){_0x496d36=_0x496d36||0xc8;return function(_0xa0f8dc){if(_0xa0f8dc){return _0x1c9ae8[_0xfb08('0x2a')](_0x496d36)[_0xfb08('0x2c')](_0xa0f8dc);}};}function respondWithFilteredResult(_0x11bb1f,_0x34cd5f){return function(_0x375fd1){if(_0x375fd1){var _0x295d88=typeof _0x34cd5f['offset']===_0xfb08('0x2d')&&typeof _0x34cd5f[_0xfb08('0x2e')]===_0xfb08('0x2d');var _0x2ee3ac=_0x375fd1[_0xfb08('0x2f')];var _0x420a97=_0x295d88?0x0:_0x34cd5f[_0xfb08('0x30')];var _0x53f41e=_0x295d88?_0x375fd1['count']:_0x34cd5f['offset']+_0x34cd5f[_0xfb08('0x2e')];var _0x4e5f55;if(_0x53f41e>=_0x2ee3ac){_0x53f41e=_0x2ee3ac;_0x4e5f55=0xc8;}else{_0x4e5f55=0xce;}_0x11bb1f[_0xfb08('0x2a')](_0x4e5f55);return _0x11bb1f[_0xfb08('0x31')](_0xfb08('0x32'),_0x420a97+'-'+_0x53f41e+'/'+_0x2ee3ac)[_0xfb08('0x2c')](_0x375fd1);}return null;};}function patchUpdates(_0x3213d1){return function(_0x4e7d9d){try{jsonpatch['apply'](_0x4e7d9d,_0x3213d1,!![]);}catch(_0x53fd12){return BPromise[_0xfb08('0x33')](_0x53fd12);}return _0x4e7d9d[_0xfb08('0x34')]();};}function saveUpdates(_0x2c6ec1,_0x532cdf){return function(_0x41cbf3){if(_0x41cbf3){return _0x41cbf3[_0xfb08('0x35')](_0x2c6ec1)[_0xfb08('0x36')](function(_0x1d73e8){return _0x1d73e8;});}return null;};}function removeEntity(_0x2e25b6,_0x1ce663){return function(_0x48b91a){if(_0x48b91a){return _0x48b91a['destroy']()[_0xfb08('0x36')](function(){_0x2e25b6[_0xfb08('0x2a')](0xcc)[_0xfb08('0x2b')]();});}};}function handleEntityNotFound(_0x54508f,_0x55fabc){return function(_0x443345){if(!_0x443345){_0x54508f[_0xfb08('0x37')](0x194);}return _0x443345;};}function handleError(_0x1ce3d8,_0x2aa966){_0x2aa966=_0x2aa966||0x1f4;return function(_0x356d7f){logger[_0xfb08('0x25')](_0x356d7f[_0xfb08('0x38')]);if(_0x356d7f['name']){delete _0x356d7f[_0xfb08('0x39')];}_0x1ce3d8[_0xfb08('0x2a')](_0x2aa966)[_0xfb08('0x3a')](_0x356d7f);};}exports[_0xfb08('0x3b')]=function(_0x4f72db,_0x4e06ac){var _0x8f22a6={},_0x5e0781={},_0x55e404={'count':0x0,'rows':[]};var _0x429da7=_[_0xfb08('0x3c')](db[_0xfb08('0x3d')][_0xfb08('0x3e')],function(_0x3d4b6b){return{'name':_0x3d4b6b[_0xfb08('0x3f')],'type':_0x3d4b6b[_0xfb08('0x40')][_0xfb08('0x41')]};});_0x5e0781['model']=_[_0xfb08('0x3c')](_0x429da7,'name');_0x5e0781[_0xfb08('0x42')]=_[_0xfb08('0x43')](_0x4f72db[_0xfb08('0x42')]);_0x5e0781[_0xfb08('0x44')]=_[_0xfb08('0x45')](_0x5e0781[_0xfb08('0x46')],_0x5e0781['query']);_0x8f22a6[_0xfb08('0x47')]=_['intersection'](_0x5e0781[_0xfb08('0x46')],qs['fields'](_0x4f72db[_0xfb08('0x42')][_0xfb08('0x48')]));_0x8f22a6['attributes']=_0x8f22a6[_0xfb08('0x47')][_0xfb08('0x49')]?_0x8f22a6[_0xfb08('0x47')]:_0x5e0781[_0xfb08('0x46')];if(!_0x4f72db['query'][_0xfb08('0x4a')]('nolimit')){_0x8f22a6[_0xfb08('0x2e')]=qs['limit'](_0x4f72db[_0xfb08('0x42')][_0xfb08('0x2e')]);_0x8f22a6[_0xfb08('0x30')]=qs['offset'](_0x4f72db[_0xfb08('0x42')][_0xfb08('0x30')]);}_0x8f22a6[_0xfb08('0x4b')]=qs[_0xfb08('0x4c')](_0x4f72db['query'][_0xfb08('0x4c')]);_0x8f22a6[_0xfb08('0x4d')]=qs[_0xfb08('0x44')](_[_0xfb08('0x4e')](_0x4f72db['query'],_0x5e0781[_0xfb08('0x44')]),_0x429da7);if(_0x4f72db['query']['filter']){_0x8f22a6[_0xfb08('0x4d')]=_[_0xfb08('0x4f')](_0x8f22a6[_0xfb08('0x4d')],{'$or':_[_0xfb08('0x3c')](_0x429da7,function(_0x26affd){if(_0x26affd['type']!==_0xfb08('0x50')){var _0x4ad635={};_0x4ad635[_0x26affd[_0xfb08('0x39')]]={'$like':'%'+_0x4f72db['query'][_0xfb08('0x51')]+'%'};return _0x4ad635;}})});}_0x8f22a6=_[_0xfb08('0x4f')]({},_0x8f22a6,_0x4f72db['options']);var _0x1de5e8={'where':_0x8f22a6['where']};return db[_0xfb08('0x3d')][_0xfb08('0x2f')](_0x1de5e8)[_0xfb08('0x36')](function(_0x1a2aaa){_0x55e404['count']=_0x1a2aaa;if(_0x4f72db[_0xfb08('0x42')][_0xfb08('0x52')]){_0x8f22a6['include']=[{'all':!![]}];}return db[_0xfb08('0x3d')][_0xfb08('0x53')](_0x8f22a6);})['then'](function(_0x592c0a){_0x55e404[_0xfb08('0x54')]=_0x592c0a;return _0x55e404;})[_0xfb08('0x36')](respondWithFilteredResult(_0x4e06ac,_0x8f22a6))[_0xfb08('0x29')](handleError(_0x4e06ac,null));};exports[_0xfb08('0x55')]=function(_0x51fcfe,_0x4a047b){var _0x5a9eea={'raw':!![],'where':{'id':_0x51fcfe[_0xfb08('0x56')]['id']}},_0x3e78ea={};_0x3e78ea[_0xfb08('0x46')]=_[_0xfb08('0x43')](db[_0xfb08('0x3d')][_0xfb08('0x3e')]);_0x3e78ea[_0xfb08('0x42')]=_[_0xfb08('0x43')](_0x51fcfe['query']);_0x3e78ea[_0xfb08('0x44')]=_['intersection'](_0x3e78ea[_0xfb08('0x46')],_0x3e78ea['query']);_0x5a9eea[_0xfb08('0x47')]=_['intersection'](_0x3e78ea[_0xfb08('0x46')],qs[_0xfb08('0x48')](_0x51fcfe[_0xfb08('0x42')][_0xfb08('0x48')]));_0x5a9eea[_0xfb08('0x47')]=_0x5a9eea[_0xfb08('0x47')][_0xfb08('0x49')]?_0x5a9eea['attributes']:_0x3e78ea['model'];if(_0x51fcfe['query']['includeAll']){_0x5a9eea[_0xfb08('0x57')]=[{'all':!![]}];}_0x5a9eea=_[_0xfb08('0x4f')]({},_0x5a9eea,_0x51fcfe['options']);return db[_0xfb08('0x3d')][_0xfb08('0x58')](_0x5a9eea)[_0xfb08('0x36')](handleEntityNotFound(_0x4a047b,null))[_0xfb08('0x36')](respondWithResult(_0x4a047b,null))[_0xfb08('0x29')](handleError(_0x4a047b,null));};exports[_0xfb08('0x59')]=function(_0x1bd2d9,_0x507a84){return db['WhatsappMessage'][_0xfb08('0x59')](_0x1bd2d9['body'],{})[_0xfb08('0x36')](respondWithResult(_0x507a84,0xc9))[_0xfb08('0x29')](handleError(_0x507a84,null));};exports[_0xfb08('0x35')]=function(_0x336b11,_0x206563){if(_0x336b11['body']['id']){delete _0x336b11['body']['id'];}return db[_0xfb08('0x3d')][_0xfb08('0x58')]({'where':{'id':_0x336b11[_0xfb08('0x56')]['id']}})[_0xfb08('0x36')](handleEntityNotFound(_0x206563,null))[_0xfb08('0x36')](saveUpdates(_0x336b11[_0xfb08('0x5a')],null))[_0xfb08('0x36')](respondWithResult(_0x206563,null))[_0xfb08('0x29')](handleError(_0x206563,null));};exports[_0xfb08('0x5b')]=function(_0xe19f01,_0x523751){return db['WhatsappMessage']['find']({'where':{'id':_0xe19f01[_0xfb08('0x56')]['id']}})[_0xfb08('0x36')](handleEntityNotFound(_0x523751,null))[_0xfb08('0x36')](removeEntity(_0x523751,null))['catch'](handleError(_0x523751,null));};exports[_0xfb08('0x5c')]=function(_0x4c72dd,_0x5492a0){return db[_0xfb08('0x3d')][_0xfb08('0x5c')]()[_0xfb08('0x36')](respondWithResult(_0x5492a0,null))[_0xfb08('0x29')](handleError(_0x5492a0,null));};var interaction_log=require(_0xfb08('0x12'))(_0xfb08('0x5d'));exports['accept']=function(_0x3b21c6,_0x50bd10,_0x149e12){var _0x20403b={'agent':{},'channel':_0xfb08('0x5e')};if(_0x3b21c6[_0xfb08('0x5a')]['id']){delete _0x3b21c6[_0xfb08('0x5a')]['id'];}_0x3b21c6['body'][_0xfb08('0x5f')]=!![];_0x3b21c6[_0xfb08('0x5a')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3b21c6[_0xfb08('0x5a')][_0xfb08('0x60')]=_0x3b21c6[_0xfb08('0x5a')][_0xfb08('0x60')]||_0x3b21c6[_0xfb08('0x61')]['id'];_0x20403b[_0xfb08('0x62')]['id']=_0x3b21c6[_0xfb08('0x5a')][_0xfb08('0x60')];return db[_0xfb08('0x3d')]['find']({'where':{'id':_0x3b21c6['params']['id'],'UserId':null}})[_0xfb08('0x36')](handleEntityNotFound(_0x50bd10,null))[_0xfb08('0x36')](saveUpdates(_0x3b21c6[_0xfb08('0x5a')],null))[_0xfb08('0x36')](function(_0x702e20){if(_0x702e20){_0x20403b[_0xfb08('0x27')]=_0x702e20[_0xfb08('0x63')]({'plain':!![]});return db[_0xfb08('0x64')][_0xfb08('0x58')]({'where':{'id':_0x702e20[_0xfb08('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x50bd10,null))[_0xfb08('0x36')](function(_0x35eee0){if(_0x35eee0){return _0x35eee0[_0xfb08('0x35')]({'UserId':_0x3b21c6[_0xfb08('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x35eee0[_0xfb08('0x66')])?moment()[_0xfb08('0x67')](_0xfb08('0x68')):undefined});}return null;})[_0xfb08('0x36')](function(_0x40f450){if(_0x40f450){_0x20403b['interaction']=_0x40f450[_0xfb08('0x63')]({'plain':!![]});interaction_log[_0xfb08('0x20')](_0xfb08('0x69'),_0x3b21c6[_0xfb08('0x61')]['id'],_0x3b21c6[_0xfb08('0x61')][_0xfb08('0x39')],_0x3b21c6[_0xfb08('0x61')][_0xfb08('0x6a')],_0x20403b['interaction']['id'],_0x3b21c6[_0xfb08('0x5a')]?JSON['stringify'](_0x3b21c6[_0xfb08('0x5a')]):_0xfb08('0x6b'));return respondWithRpcPromise(_0xfb08('0x6c'),_0xfb08('0x6d'),_0x20403b);}return null;})[_0xfb08('0x36')](function(_0x345b9c){var _0x3bf74d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x345b9c['message']['ContactId'];return db[_0xfb08('0x6e')]['query'](_0x3bf74d,{'type':db[_0xfb08('0x6f')][_0xfb08('0x70')][_0xfb08('0x71')],'raw':!![]})['then'](function(_0xcb571){return _0xcb571;});})[_0xfb08('0x36')](function(_0x4564e0){if(_0x4564e0){_0x20403b[_0xfb08('0x27')][_0xfb08('0x72')]=_0x4564e0[0x0];if(!_0x3b21c6[_0xfb08('0x5a')][_0xfb08('0x60')])return;return db[_0xfb08('0x73')][_0xfb08('0x58')]({'where':{'id':_0x3b21c6['body'][_0xfb08('0x60')],'role':_0xfb08('0x62')},'attributes':['id',_0xfb08('0x39'),_0xfb08('0x74'),'email','internal'],'raw':!![]});}return null;})[_0xfb08('0x36')](function(_0x43e715){if(!_0x43e715)return null;_0x20403b[_0xfb08('0x27')][_0xfb08('0x62')]=_0x43e715;return _0x20403b;})[_0xfb08('0x36')](function(_0x380542){if(_0x380542){if(_0x3b21c6[_0xfb08('0x5a')][_0xfb08('0x75')]){_0x20403b[_0xfb08('0x27')][_0xfb08('0x76')]=util['format'](_0xfb08('0x77'),_0x3b21c6['user'][_0xfb08('0x39')]);_0x20403b[_0xfb08('0x27')][_0xfb08('0x78')]=_0x20403b['channel'];_0x20403b[_0xfb08('0x27')][_0xfb08('0x79')]=_0x20403b['channel'];_0x20403b[_0xfb08('0x27')][_0xfb08('0x7a')]=_0xfb08('0x7b');return respondWithRpcPromise(_0xfb08('0x7c'),_0xfb08('0x7c'),{'event':_0xfb08('0x7d'),'message':_0x20403b[_0xfb08('0x27')]},client9002)['then'](function(){return _0x20403b;});}return _0x20403b;}return null;})[_0xfb08('0x36')](respondWithResult(_0x50bd10,null))['catch'](handleError(_0x50bd10,null));};var interaction_log=require(_0xfb08('0x12'))(_0xfb08('0x5d'));exports[_0xfb08('0x33')]=function(_0x4813c1,_0x23c5da,_0x5507ea){var _0x358573={'agent':{},'channel':'whatsapp'};if(_0x4813c1['body']['id']){delete _0x4813c1['body']['id'];}_0x4813c1[_0xfb08('0x5a')][_0xfb08('0x60')]=_0x4813c1[_0xfb08('0x5a')][_0xfb08('0x60')]||_0x4813c1['user']['id'];_0x358573[_0xfb08('0x62')]['id']=_0x4813c1[_0xfb08('0x5a')]['UserId'];return db['WhatsappMessage'][_0xfb08('0x58')]({'where':{'id':_0x4813c1[_0xfb08('0x56')]['id'],'UserId':null}})[_0xfb08('0x36')](handleEntityNotFound(_0x23c5da,null))[_0xfb08('0x36')](function(_0x230ab3){if(_0x230ab3){_0x358573[_0xfb08('0x27')]=_0x230ab3['get']({'plain':!![]});return db[_0xfb08('0x64')][_0xfb08('0x58')]({'where':{'id':_0x230ab3[_0xfb08('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x23c5da,null))['then'](function(_0x46d7a8){if(_0x46d7a8){_0x358573[_0xfb08('0x7e')]=_0x46d7a8[_0xfb08('0x63')]({'plain':!![]});interaction_log[_0xfb08('0x20')](_0xfb08('0x7f'),_0x4813c1[_0xfb08('0x61')]['id'],_0x4813c1[_0xfb08('0x61')][_0xfb08('0x39')],_0x4813c1[_0xfb08('0x61')][_0xfb08('0x6a')],_0x358573[_0xfb08('0x7e')]['id'],_0x4813c1[_0xfb08('0x5a')]?JSON[_0xfb08('0x24')](_0x4813c1[_0xfb08('0x5a')]):'null');return respondWithRpcPromise(_0xfb08('0x80'),_0xfb08('0x81'),_0x358573);}return null;})[_0xfb08('0x36')](function(_0x445ce6){var _0x48776a=_0xfb08('0x82')+_0x445ce6[_0xfb08('0x27')]['ContactId'];return db[_0xfb08('0x6e')][_0xfb08('0x42')](_0x48776a,{'type':db['Sequelize'][_0xfb08('0x70')][_0xfb08('0x71')],'raw':!![]})[_0xfb08('0x36')](function(_0x3468dd){return _0x3468dd;});})[_0xfb08('0x36')](function(_0x27ec7f){if(_0x27ec7f){_0x358573['message'][_0xfb08('0x72')]=_0x27ec7f[0x0];if(!_0x4813c1[_0xfb08('0x5a')]['UserId'])return;return db[_0xfb08('0x73')][_0xfb08('0x58')]({'where':{'id':_0x4813c1[_0xfb08('0x5a')][_0xfb08('0x60')],'role':_0xfb08('0x62')},'attributes':['id','name',_0xfb08('0x74'),_0xfb08('0x83'),_0xfb08('0x84')],'raw':!![]});}return null;})[_0xfb08('0x36')](function(_0x3b3536){if(!_0x3b3536)return null;_0x358573[_0xfb08('0x27')][_0xfb08('0x62')]=_0x3b3536;return _0x358573;})[_0xfb08('0x36')](function(_0x281b38){if(_0x281b38){_0x281b38[_0xfb08('0x27')][_0xfb08('0x76')]=util['format'](_0xfb08('0x77'),_0x4813c1[_0xfb08('0x61')][_0xfb08('0x39')]);_0x281b38['message'][_0xfb08('0x78')]=_0x358573['channel'];_0x281b38[_0xfb08('0x27')][_0xfb08('0x79')]=_0x358573[_0xfb08('0x78')];_0x281b38[_0xfb08('0x27')]['event']=_0xfb08('0x33');respondWithRpcPromise(_0xfb08('0x7c'),_0xfb08('0x7c'),{'event':'rejectmessage','message':_0x281b38[_0xfb08('0x27')]},client9002);return _0x358573;}return null;})[_0xfb08('0x36')](respondWithResult(_0x23c5da,null))[_0xfb08('0x29')](handleError(_0x23c5da,null));};exports['status']=function(_0xa227b1,_0x126087,_0x1cedb7){if(_0xa227b1[_0xfb08('0x5a')]['id']){delete _0xa227b1['body']['id'];}var _0x5aac0f;return db[_0xfb08('0x3d')][_0xfb08('0x58')]({'where':{'id':_0xa227b1[_0xfb08('0x56')]['id']}})[_0xfb08('0x36')](handleEntityNotFound(_0x126087,null))[_0xfb08('0x36')](function(_0x3ddb87){if(_0x3ddb87){_0x5aac0f=_0x3ddb87;return db[_0xfb08('0x85')][_0xfb08('0x58')]({'where':{'id':_0x3ddb87['WhatsappAccountId']}});}})[_0xfb08('0x36')](handleEntityNotFound(_0x126087,null))[_0xfb08('0x36')](function(_0x1bc1e7){if(_0x1bc1e7){logger[_0xfb08('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x1bc1e7[_0xfb08('0x40')],util[_0xfb08('0x86')](_0xa227b1[_0xfb08('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1bc1e7[_0xfb08('0x40')]){case _0xfb08('0x87'):if(_0xa227b1[_0xfb08('0x5a')][_0xfb08('0x88')]&&_0xa227b1[_0xfb08('0x5a')][_0xfb08('0x88')]===_0x5aac0f['messageId']&&_0xa227b1['body'][_0xfb08('0x89')]&&_0xa227b1[_0xfb08('0x5a')][_0xfb08('0x89')]===_0xfb08('0x5f')){return _0x5aac0f['update']({'read':!![]});}else{logger[_0xfb08('0x25')](_0xfb08('0x8a'),_0xfb08('0x2a'),_0xfb08('0x87'),util[_0xfb08('0x86')](_0xa227b1[_0xfb08('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x5aac0f;}})[_0xfb08('0x36')](respondWithResult(_0x126087,null))[_0xfb08('0x29')](handleError(_0x126087,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 5ea5862..c4353b7 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 _0x97c1=['../../mysqldb','setMaxListeners','remove','hasOwnProperty','hook','exports','events'];(function(_0x2f50de,_0x4188a1){var _0x1bf470=function(_0x428d35){while(--_0x428d35){_0x2f50de['push'](_0x2f50de['shift']());}};_0x1bf470(++_0x4188a1);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x197c('0x0'));var WhatsappMessage=require(_0x197c('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x197c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x197c('0x3')};function emitEvent(_0xbb081d){return function(_0x26833e,_0x37ac05,_0x40863c){WhatsappMessageEvents['emit'](_0xbb081d+':'+_0x26833e['id'],_0x26833e);WhatsappMessageEvents['emit'](_0xbb081d,_0x26833e);_0x40863c(null);};}for(var e in events){if(events[_0x197c('0x4')](e)){var event=events[e];WhatsappMessage[_0x197c('0x5')](e,emitEvent(event));}}module[_0x197c('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa7fa=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xaa7f('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xaa7f('0x1')](0x0);var events={'afterCreate':_0xaa7f('0x2'),'afterUpdate':_0xaa7f('0x3'),'afterDestroy':_0xaa7f('0x4')};function emitEvent(_0x5b7455){return function(_0x39fd71,_0x310190,_0xc238d5){WhatsappMessageEvents[_0xaa7f('0x5')](_0x5b7455+':'+_0x39fd71['id'],_0x39fd71);WhatsappMessageEvents['emit'](_0x5b7455,_0x39fd71);_0xc238d5(null);};}for(var e in events){if(events[_0xaa7f('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ddedef7..ac0274d 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 _0xaff8=['request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','whatsapp_messages','messageId','body','FULLTEXT','get','toLowerCase','direction','out','isNil','findOne','WhatsappInteractionId','catch','error','secret','find','WhatsappAccountId','then','type','twilio','authToken','phone','create','whatsapp:','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','text','Bearer\x20','update','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3746fe,_0x30b6b0){var _0xb3093d=function(_0x424b01){while(--_0x424b01){_0x3746fe['push'](_0x3746fe['shift']());}};_0xb3093d(++_0x30b6b0);}(_0xaff8,0x1c6));var _0x8aff=function(_0xe6ce5f,_0x24a05a){_0xe6ce5f=_0xe6ce5f-0x0;var _0x2af5a9=_0xaff8[_0xe6ce5f];return _0x2af5a9;};'use strict';var _=require(_0x8aff('0x0'));var util=require(_0x8aff('0x1'));var logger=require(_0x8aff('0x2'))('api');var moment=require(_0x8aff('0x3'));var BPromise=require(_0x8aff('0x4'));var rp=require(_0x8aff('0x5'));var fetch=require(_0x8aff('0x6'));var fs=require('fs');var path=require(_0x8aff('0x7'));var rimraf=require(_0x8aff('0x8'));var config=require(_0x8aff('0x9'));var attributes=require(_0x8aff('0xa'));module['exports']=function(_0x5c8f11,_0x3b2a3a){return _0x5c8f11['define']('WhatsappMessage',attributes,{'tableName':_0x8aff('0xb'),'paranoid':![],'indexes':[{'name':_0x8aff('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x8aff('0xd')],'type':_0x8aff('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c7a87,_0x5a1170,_0x578b4e){var _0x4ee05f=_0x5c8f11['models'];var _0x45e170=_0x2c7a87[_0x8aff('0xf')]({'plain':!![]});if(_0x45e170['direction'][_0x8aff('0x10')]()==='in'||_0x45e170[_0x8aff('0x11')][_0x8aff('0x10')]()===_0x8aff('0x12')&&!_0x45e170['secret']&&!_[_0x8aff('0x13')](_0x45e170['UserId'])){_0x4ee05f['WhatsappInteraction'][_0x8aff('0x14')]({'where':{'id':_0x45e170[_0x8aff('0x15')]}})['then'](function(_0x2e236a){if(_0x2e236a){_0x2e236a['update']({'lastMsgAt':_0x45e170['createdAt'],'lastMsgDirection':_0x45e170['direction']['toLowerCase']()});}})[_0x8aff('0x16')](function(_0x418d32){console[_0x8aff('0x17')](_0x418d32);});}if(_0x45e170[_0x8aff('0x11')]==='out'&&!_0x45e170[_0x8aff('0x18')]){var _0x1a13ac;_0x4ee05f['WhatsappAccount'][_0x8aff('0x19')]({'where':{'id':_0x45e170[_0x8aff('0x1a')]},'raw':!![]})[_0x8aff('0x1b')](function(_0x34a429){_0x1a13ac=_0x34a429;if(_0x1a13ac&&_0x1a13ac[_0x8aff('0x1c')]){switch(_0x1a13ac['type']){case _0x8aff('0x1d'):var _0xd57709=require('twilio');if(_0x1a13ac['accountSid']&&_0x1a13ac[_0x8aff('0x1e')]&&_0x1a13ac[_0x8aff('0x1f')]){var _0x4ee509=new _0xd57709(_0x1a13ac['accountSid'],_0x1a13ac['authToken']);_0x4ee509['messages'][_0x8aff('0x20')]({'body':_0x45e170['body'],'to':_0x8aff('0x21')+_0x45e170[_0x8aff('0x1f')],'from':_0x8aff('0x21')+_0x1a13ac[_0x8aff('0x1f')],'statusCallback':_0x1a13ac['remote']+'/api/whatsapp/messages/'+_0x45e170['id']+_0x8aff('0x22')+_0x1a13ac['token']})[_0x8aff('0x1b')](function(_0x33b1e){if(_0x33b1e[_0x8aff('0x23')]){return _0x2c7a87['update']({'messageId':_0x33b1e[_0x8aff('0x23')]});}})[_0x8aff('0x16')](function(_0x81c8dd){logger[_0x8aff('0x17')](_0x8aff('0x24'),_0x8aff('0x25'),_0x8aff('0x1d'),util['inspect'](_0x81c8dd,{'showHidden':![],'depth':null}));});}else{logger[_0x8aff('0x17')](_0x8aff('0x24'),_0x8aff('0x25'),'twilio',_0x8aff('0x26'));}break;case _0x8aff('0x27'):var _0x560ee4=_0x1a13ac['accountSid'];var _0x22b5ff=_0x1a13ac['authToken'];var _0x9941b=_0x1a13ac['baseUrl']+'/whatsapp/v1/'+_0x560ee4+_0x8aff('0x28');var _0x4d70c0={'to':[_0x45e170[_0x8aff('0x1f')]],'message':{'type':_0x8aff('0x29'),'text':_0x45e170[_0x8aff('0xd')]}};var _0x4a6351={'method':'POST','uri':_0x9941b,'headers':{'Authorization':_0x8aff('0x2a')+_0x22b5ff,'Content-Type':'application/json'},'body':_0x4d70c0,'json':!![]};rp(_0x4a6351)[_0x8aff('0x1b')](function(_0x5ccc4d){if(_0x5ccc4d['statuses'][0x0]['message_id']){return _0x2c7a87[_0x8aff('0x2b')]({'messageId':_0x5ccc4d[_0x8aff('0x2c')][0x0][_0x8aff('0x2d')]});}})['catch'](function(_0x2da641){logger[_0x8aff('0x2e')](_0x8aff('0x2f'),_0x2da641);});break;}}})[_0x8aff('0x30')](function(){_0x578b4e();});}else{_0x578b4e();}}},'charset':_0x8aff('0x31'),'collate':_0x8aff('0x32')});}; \ No newline at end of file +var _0x0a1c=['WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','POST','message_id','update','statuses','err'];(function(_0x173a1f,_0x39a371){var _0x3ca4b2=function(_0xa84bc7){while(--_0xa84bc7){_0x173a1f['push'](_0x173a1f['shift']());}};_0x3ca4b2(++_0x39a371);}(_0x0a1c,0x7a));var _0xc0a1=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x0a1c[_0x52121d];return _0x448627;};'use strict';var _=require(_0xc0a1('0x0'));var util=require(_0xc0a1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc0a1('0x2'));var BPromise=require(_0xc0a1('0x3'));var rp=require(_0xc0a1('0x4'));var fetch=require(_0xc0a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0a1('0x6'));var config=require(_0xc0a1('0x7'));var attributes=require(_0xc0a1('0x8'));module[_0xc0a1('0x9')]=function(_0x5916d9,_0x199b79){return _0x5916d9[_0xc0a1('0xa')]('WhatsappMessage',attributes,{'tableName':_0xc0a1('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc0a1('0xc')]},{'name':_0xc0a1('0xd'),'fields':['body'],'type':_0xc0a1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54e6ff,_0x40b866,_0x138330){var _0x19bd05=_0x5916d9['models'];var _0x40994f=_0x54e6ff[_0xc0a1('0xf')]({'plain':!![]});if(_0x40994f[_0xc0a1('0x10')]['toLowerCase']()==='in'||_0x40994f[_0xc0a1('0x10')][_0xc0a1('0x11')]()===_0xc0a1('0x12')&&!_0x40994f[_0xc0a1('0x13')]&&!_[_0xc0a1('0x14')](_0x40994f[_0xc0a1('0x15')])){_0x19bd05[_0xc0a1('0x16')]['findOne']({'where':{'id':_0x40994f[_0xc0a1('0x17')]}})[_0xc0a1('0x18')](function(_0x3e9d88){if(_0x3e9d88){_0x3e9d88['update']({'lastMsgAt':_0x40994f[_0xc0a1('0x19')],'lastMsgDirection':_0x40994f[_0xc0a1('0x10')][_0xc0a1('0x11')]()});}})['catch'](function(_0x69368){console[_0xc0a1('0x1a')](_0x69368);});}if(_0x40994f[_0xc0a1('0x10')]==='out'&&!_0x40994f[_0xc0a1('0x13')]){var _0x21a0a7;_0x19bd05[_0xc0a1('0x1b')][_0xc0a1('0x1c')]({'where':{'id':_0x40994f[_0xc0a1('0x1d')]},'raw':!![]})[_0xc0a1('0x18')](function(_0x4afcb1){_0x21a0a7=_0x4afcb1;if(_0x21a0a7&&_0x21a0a7[_0xc0a1('0x1e')]){switch(_0x21a0a7[_0xc0a1('0x1e')]){case _0xc0a1('0x1f'):var _0x6fee87=require('twilio');if(_0x21a0a7[_0xc0a1('0x20')]&&_0x21a0a7[_0xc0a1('0x21')]&&_0x21a0a7[_0xc0a1('0x22')]){var _0x459168=new _0x6fee87(_0x21a0a7['accountSid'],_0x21a0a7[_0xc0a1('0x21')]);_0x459168[_0xc0a1('0x23')][_0xc0a1('0x24')]({'body':_0x40994f[_0xc0a1('0x25')],'to':_0xc0a1('0x26')+_0x40994f['phone'],'from':_0xc0a1('0x26')+_0x21a0a7[_0xc0a1('0x22')],'statusCallback':_0x21a0a7[_0xc0a1('0x27')]+_0xc0a1('0x28')+_0x40994f['id']+_0xc0a1('0x29')+_0x21a0a7['token']})['then'](function(_0x2aa167){if(_0x2aa167[_0xc0a1('0x2a')]){return _0x54e6ff['update']({'messageId':_0x2aa167[_0xc0a1('0x2a')]});}})[_0xc0a1('0x2b')](function(_0x24476f){logger[_0xc0a1('0x1a')](_0xc0a1('0x2c'),'afterCreate',_0xc0a1('0x1f'),util[_0xc0a1('0x2d')](_0x24476f,{'showHidden':![],'depth':null}));});}else{logger[_0xc0a1('0x1a')](_0xc0a1('0x2c'),'afterCreate',_0xc0a1('0x1f'),_0xc0a1('0x2e'));}break;case'sinch':var _0x1649ac=_0x21a0a7[_0xc0a1('0x20')];var _0x5249c0=_0x21a0a7[_0xc0a1('0x21')];var _0x5df710=_0x21a0a7[_0xc0a1('0x2f')]+_0xc0a1('0x30')+_0x1649ac+_0xc0a1('0x31');var _0x401f5d={'to':[_0x40994f[_0xc0a1('0x22')]],'message':{'type':'text','text':_0x40994f[_0xc0a1('0x25')]}};var _0x2830fa={'method':_0xc0a1('0x32'),'uri':_0x5df710,'headers':{'Authorization':'Bearer\x20'+_0x5249c0,'Content-Type':'application/json'},'body':_0x401f5d,'json':!![]};rp(_0x2830fa)[_0xc0a1('0x18')](function(_0x2acf5a){if(_0x2acf5a['statuses'][0x0][_0xc0a1('0x33')]){return _0x54e6ff[_0xc0a1('0x34')]({'messageId':_0x2acf5a[_0xc0a1('0x35')][0x0][_0xc0a1('0x33')]});}})['catch'](function(_0x20ee88){logger[_0xc0a1('0x36')](_0xc0a1('0x37'),_0x20ee88);});break;}}})[_0xc0a1('0x38')](function(){_0x138330();});}else{_0x138330();}}},'charset':_0xc0a1('0x39'),'collate':_0xc0a1('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 04b991e..013ed68 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 _0xee34=['raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','./whatsappMessage.socket','register','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xee34,0x87));var _0x4ee3=function(_0x41e996,_0x112383){_0x41e996=_0x41e996-0x0;var _0x3748c6=_0xee34[_0x41e996];return _0x3748c6;};'use strict';var _=require(_0x4ee3('0x0'));var util=require(_0x4ee3('0x1'));var moment=require(_0x4ee3('0x2'));var BPromise=require(_0x4ee3('0x3'));var rs=require(_0x4ee3('0x4'));var fs=require('fs');var Redis=require(_0x4ee3('0x5'));var db=require(_0x4ee3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ee3('0x7'));var config=require('../../config/environment');var jayson=require(_0x4ee3('0x8'));var client=jayson[_0x4ee3('0x9')][_0x4ee3('0xa')]({'port':0x232a});config[_0x4ee3('0xb')]=_[_0x4ee3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ee3('0xb')]));require(_0x4ee3('0xd'))[_0x4ee3('0xe')](socket);function respondWithRpcPromise(_0x457fab,_0x54ce77,_0x1f7ca8){return new BPromise(function(_0xab1a30,_0x4629c2){return client['request'](_0x457fab,_0x1f7ca8)[_0x4ee3('0xf')](function(_0x21941c){logger[_0x4ee3('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x54ce77,'request\x20sent');logger[_0x4ee3('0x11')](_0x4ee3('0x12'),_0x54ce77,_0x4ee3('0x13'),JSON['stringify'](_0x21941c));if(_0x21941c['error']){if(_0x21941c[_0x4ee3('0x14')][_0x4ee3('0x15')]===0x1f4){logger[_0x4ee3('0x14')](_0x4ee3('0x16'),_0x54ce77,_0x21941c[_0x4ee3('0x14')][_0x4ee3('0x17')]);return _0x4629c2(_0x21941c[_0x4ee3('0x14')][_0x4ee3('0x17')]);}logger[_0x4ee3('0x14')](_0x4ee3('0x16'),_0x54ce77,_0x21941c['error'][_0x4ee3('0x17')]);return _0xab1a30(_0x21941c[_0x4ee3('0x14')][_0x4ee3('0x17')]);}else{logger['info'](_0x4ee3('0x16'),_0x54ce77,_0x4ee3('0x13'));_0xab1a30(_0x21941c[_0x4ee3('0x18')]['message']);}})['catch'](function(_0x1c283b){logger[_0x4ee3('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x54ce77,_0x1c283b);_0x4629c2(_0x1c283b);});});}exports[_0x4ee3('0x19')]=function(_0x972f32){var _0x1b1509=this;return new Promise(function(_0x4777b3,_0x5286a6){return db[_0x4ee3('0x1a')][_0x4ee3('0x1b')](_0x972f32[_0x4ee3('0x1c')],{'raw':_0x972f32[_0x4ee3('0x1d')]?_0x972f32[_0x4ee3('0x1d')][_0x4ee3('0x1e')]===undefined?!![]:![]:!![]})[_0x4ee3('0xf')](function(_0x1fe530){logger[_0x4ee3('0x10')](_0x4ee3('0x19'),_0x972f32);logger[_0x4ee3('0x11')]('CreateWhatsappMessage',_0x972f32,JSON[_0x4ee3('0x1f')](_0x1fe530));_0x4777b3(_0x1fe530);})[_0x4ee3('0x20')](function(_0x2a8658){logger['error']('CreateWhatsappMessage',_0x2a8658[_0x4ee3('0x17')],_0x972f32);_0x5286a6(_0x1b1509['error'](0x1f4,_0x2a8658[_0x4ee3('0x17')]));});});}; \ No newline at end of file +var _0x5dae=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x15c43c,_0x391c7c){var _0x21dcd8=function(_0x134607){while(--_0x134607){_0x15c43c['push'](_0x15c43c['shift']());}};_0x21dcd8(++_0x391c7c);}(_0x5dae,0x143));var _0xe5da=function(_0x3b4cc1,_0x3af7bd){_0x3b4cc1=_0x3b4cc1-0x0;var _0x331e8b=_0x5dae[_0x3b4cc1];return _0x331e8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe5da('0x0'));var BPromise=require(_0xe5da('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5da('0x2'));var db=require(_0xe5da('0x3'))['db'];var utils=require(_0xe5da('0x4'));var logger=require(_0xe5da('0x5'))(_0xe5da('0x6'));var config=require(_0xe5da('0x7'));var jayson=require(_0xe5da('0x8'));var client=jayson['client'][_0xe5da('0x9')]({'port':0x232a});config[_0xe5da('0xa')]=_[_0xe5da('0xb')](config['redis'],{'host':_0xe5da('0xc'),'port':0x18eb});var socket=require(_0xe5da('0xd'))(new Redis(config[_0xe5da('0xa')]));require(_0xe5da('0xe'))[_0xe5da('0xf')](socket);function respondWithRpcPromise(_0x20db3e,_0x1c2516,_0xcc1b01){return new BPromise(function(_0x113dc8,_0x5e00d4){return client[_0xe5da('0x10')](_0x20db3e,_0xcc1b01)[_0xe5da('0x11')](function(_0x5c619d){logger[_0xe5da('0x12')](_0xe5da('0x13'),_0x1c2516,_0xe5da('0x14'));logger[_0xe5da('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1c2516,_0xe5da('0x14'),JSON[_0xe5da('0x16')](_0x5c619d));if(_0x5c619d[_0xe5da('0x17')]){if(_0x5c619d[_0xe5da('0x17')][_0xe5da('0x18')]===0x1f4){logger[_0xe5da('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x1c2516,_0x5c619d['error'][_0xe5da('0x19')]);return _0x5e00d4(_0x5c619d[_0xe5da('0x17')][_0xe5da('0x19')]);}logger[_0xe5da('0x17')](_0xe5da('0x13'),_0x1c2516,_0x5c619d[_0xe5da('0x17')]['message']);return _0x113dc8(_0x5c619d[_0xe5da('0x17')]['message']);}else{logger[_0xe5da('0x12')](_0xe5da('0x13'),_0x1c2516,'request\x20sent');_0x113dc8(_0x5c619d[_0xe5da('0x1a')][_0xe5da('0x19')]);}})[_0xe5da('0x1b')](function(_0x122a81){logger[_0xe5da('0x17')](_0xe5da('0x13'),_0x1c2516,_0x122a81);_0x5e00d4(_0x122a81);});});}exports['CreateWhatsappMessage']=function(_0x1dabfb){var _0x5db922=this;return new Promise(function(_0x3fd007,_0x284554){return db['WhatsappMessage'][_0xe5da('0x1c')](_0x1dabfb[_0xe5da('0x1d')],{'raw':_0x1dabfb[_0xe5da('0x1e')]?_0x1dabfb['options'][_0xe5da('0x1f')]===undefined?!![]:![]:!![]})[_0xe5da('0x11')](function(_0x353086){logger[_0xe5da('0x12')](_0xe5da('0x20'),_0x1dabfb);logger[_0xe5da('0x15')](_0xe5da('0x20'),_0x1dabfb,JSON[_0xe5da('0x16')](_0x353086));_0x3fd007(_0x353086);})[_0xe5da('0x1b')](function(_0x435040){logger[_0xe5da('0x17')]('CreateWhatsappMessage',_0x435040['message'],_0x1dabfb);_0x284554(_0x5db922[_0xe5da('0x17')](0x1f4,_0x435040[_0xe5da('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 187e5fc..cfac32f 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 _0xfc5b=['register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfc5b,0x145));var _0xbfc5=function(_0x37a1cb,_0x43c547){_0x37a1cb=_0x37a1cb-0x0;var _0x585e51=_0xfc5b[_0x37a1cb];return _0x585e51;};'use strict';var WhatsappMessageEvents=require(_0xbfc5('0x0'));var events=[_0xbfc5('0x1'),'remove',_0xbfc5('0x2')];function createListener(_0x37312e,_0x45c008){return function(_0x5d431b){_0x45c008[_0xbfc5('0x3')](_0x37312e,_0x5d431b);};}function removeListener(_0xb653f2,_0x1b6f81){return function(){WhatsappMessageEvents['removeListener'](_0xb653f2,_0x1b6f81);};}exports[_0xbfc5('0x4')]=function(_0x31b530){for(var _0x16e49a=0x0,_0x4fa4f=events[_0xbfc5('0x5')];_0x16e49a<_0x4fa4f;_0x16e49a++){var _0x5c48ec=events[_0x16e49a];var _0x407e9a=createListener(_0xbfc5('0x6')+_0x5c48ec,_0x31b530);WhatsappMessageEvents['on'](_0x5c48ec,_0x407e9a);}}; \ No newline at end of file +var _0x398a=['length','whatsappMessage:','./whatsappMessage.events','save','update','removeListener','register'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x398a,0x8e));var _0xa398=function(_0x580681,_0x1b7461){_0x580681=_0x580681-0x0;var _0x4e7923=_0x398a[_0x580681];return _0x4e7923;};'use strict';var WhatsappMessageEvents=require(_0xa398('0x0'));var events=[_0xa398('0x1'),'remove',_0xa398('0x2')];function createListener(_0x221cc7,_0x222071){return function(_0x54d103){_0x222071['emit'](_0x221cc7,_0x54d103);};}function removeListener(_0x30a400,_0x427086){return function(){WhatsappMessageEvents[_0xa398('0x3')](_0x30a400,_0x427086);};}exports[_0xa398('0x4')]=function(_0x5a1ad6){for(var _0x41bf46=0x0,_0x5c8277=events[_0xa398('0x5')];_0x41bf46<_0x5c8277;_0x41bf46++){var _0x2ff60f=events[_0x41bf46];var _0x429ef9=createListener(_0xa398('0x6')+_0x2ff60f,_0x5a1ad6);WhatsappMessageEvents['on'](_0x2ff60f,_0x429ef9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index adbb8c4..c22905e 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 _0xa263=['describe','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe'];(function(_0x4561d4,_0x3ba2fc){var _0x531a6f=function(_0x3c41df){while(--_0x3c41df){_0x4561d4['push'](_0x4561d4['shift']());}};_0x531a6f(++_0x3ba2fc);}(_0xa263,0x135));var _0x3a26=function(_0x201e90,_0x4a0547){_0x201e90=_0x201e90-0x0;var _0x5fa8f=_0xa263[_0x201e90];return _0x5fa8f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3a26('0x0'));var router=express[_0x3a26('0x1')]();var fs_extra=require(_0x3a26('0x2'));var auth=require(_0x3a26('0x3'));var interaction=require(_0x3a26('0x4'));var config=require(_0x3a26('0x5'));var controller=require(_0x3a26('0x6'));router['get']('/',auth[_0x3a26('0x7')](),controller[_0x3a26('0x8')]);router['get'](_0x3a26('0x9'),auth[_0x3a26('0x7')](),controller[_0x3a26('0xa')]);router['get'](_0x3a26('0xb'),auth[_0x3a26('0x7')](),controller[_0x3a26('0xc')]);router[_0x3a26('0xd')](_0x3a26('0xe'),auth[_0x3a26('0x7')](),controller[_0x3a26('0xf')]);router['get'](_0x3a26('0x10'),auth['isAuthenticated'](),controller[_0x3a26('0x11')]);router['get'](_0x3a26('0x12'),auth[_0x3a26('0x7')](),controller['getAgents']);router[_0x3a26('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3a26('0x10'),auth['isAuthenticated'](),controller[_0x3a26('0x14')]);router[_0x3a26('0x13')](_0x3a26('0x12'),auth[_0x3a26('0x7')](),controller[_0x3a26('0x15')]);router[_0x3a26('0x16')]('/:id',auth[_0x3a26('0x7')](),controller[_0x3a26('0x17')]);router[_0x3a26('0x18')](_0x3a26('0xb'),auth[_0x3a26('0x7')](),controller[_0x3a26('0x19')]);router['delete'](_0x3a26('0x10'),auth[_0x3a26('0x7')](),controller[_0x3a26('0x1a')]);router['delete'](_0x3a26('0x12'),auth[_0x3a26('0x7')](),controller[_0x3a26('0x1b')]);module[_0x3a26('0x1c')]=router; \ No newline at end of file +var _0x16f5=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','util','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers'];(function(_0xe030f8,_0x392cc5){var _0x20aab4=function(_0xc4ee8){while(--_0xc4ee8){_0xe030f8['push'](_0xe030f8['shift']());}};_0x20aab4(++_0x392cc5);}(_0x16f5,0x8f));var _0x516f=function(_0x311bba,_0x2aa36){_0x311bba=_0x311bba-0x0;var _0x118d06=_0x16f5[_0x311bba];return _0x118d06;};'use strict';var multer=require('multer');var util=require(_0x516f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x516f('0x1'));var router=express['Router']();var fs_extra=require(_0x516f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x516f('0x3'));var config=require(_0x516f('0x4'));var controller=require(_0x516f('0x5'));router[_0x516f('0x6')]('/',auth[_0x516f('0x7')](),controller[_0x516f('0x8')]);router[_0x516f('0x6')]('/describe',auth[_0x516f('0x7')](),controller['describe']);router[_0x516f('0x6')](_0x516f('0x9'),auth[_0x516f('0x7')](),controller[_0x516f('0xa')]);router['get'](_0x516f('0xb'),auth[_0x516f('0x7')](),controller[_0x516f('0xc')]);router[_0x516f('0x6')](_0x516f('0xd'),auth[_0x516f('0x7')](),controller[_0x516f('0xe')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x516f('0xf')]);router[_0x516f('0x10')]('/',auth[_0x516f('0x7')](),controller[_0x516f('0x11')]);router[_0x516f('0x10')](_0x516f('0xd'),auth[_0x516f('0x7')](),controller[_0x516f('0x12')]);router[_0x516f('0x10')](_0x516f('0x13'),auth[_0x516f('0x7')](),controller[_0x516f('0x14')]);router[_0x516f('0x15')](_0x516f('0x9'),auth[_0x516f('0x7')](),controller[_0x516f('0x16')]);router[_0x516f('0x17')](_0x516f('0x9'),auth[_0x516f('0x7')](),controller[_0x516f('0x18')]);router[_0x516f('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x516f('0x19')]);router[_0x516f('0x17')]('/:id/users',auth[_0x516f('0x7')](),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 87c6264..b71501a 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eaa=['INTEGER','ENUM','beepall','roundrobin','STRING','sequelize','exports'];(function(_0x493cc9,_0x5caa65){var _0x214774=function(_0x2500a3){while(--_0x2500a3){_0x493cc9['push'](_0x493cc9['shift']());}};_0x214774(++_0x5caa65);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x38462c,_0x294542){_0x38462c=_0x38462c-0x0;var _0xf04f18=_0x0eaa[_0x38462c];return _0xf04f18;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa0ea('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0ea('0x3')]('rrmemory',_0xa0ea('0x4'),_0xa0ea('0x5'))},'description':{'type':Sequelize[_0xa0ea('0x6')]}}; \ No newline at end of file +var _0x885e=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x5ab11b,_0x5b2c4f){var _0x5514e5=function(_0x11d002){while(--_0x11d002){_0x5ab11b['push'](_0x5ab11b['shift']());}};_0x5514e5(++_0x5b2c4f);}(_0x885e,0xe4));var _0xe885=function(_0x34a590,_0x482405){_0x34a590=_0x34a590-0x0;var _0x992ef1=_0x885e[_0x34a590];return _0x992ef1;};'use strict';var Sequelize=require(_0xe885('0x0'));module[_0xe885('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe885('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe885('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe885('0x4')](_0xe885('0x5'),_0xe885('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b8f84c3..4d70403 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 _0x18e5=['Team','getTeams','ids','Agents','online','voicePause','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','removeAgents','omit','spread','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','whatsappPause','updatedAt','format','%s/%s','createdAt'];(function(_0xfb8e56,_0x730096){var _0x500417=function(_0x244534){while(--_0x244534){_0xfb8e56['push'](_0xfb8e56['shift']());}};_0x500417(++_0x730096);}(_0x18e5,0xaa));var _0x518e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x18e5[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x518e('0x0'));var rimraf=require(_0x518e('0x1'));var zipdir=require(_0x518e('0x2'));var jsonpatch=require(_0x518e('0x3'));var rp=require(_0x518e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x518e('0x5'));var util=require(_0x518e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x518e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x518e('0x8'));var _=require(_0x518e('0x9'));var squel=require(_0x518e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x518e('0xb'));var toCsv=require(_0x518e('0x7'));var querystring=require('querystring');var Papa=require(_0x518e('0xc'));var Redis=require(_0x518e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x518e('0xe'));var as=require(_0x518e('0xf'));var hardwareService=require(_0x518e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x518e('0x11'));var config=require(_0x518e('0x12'));var licenseUtil=require(_0x518e('0x13'));var db=require(_0x518e('0x14'))['db'];config[_0x518e('0x15')]=_[_0x518e('0x16')](config['redis'],{'host':_0x518e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x518e('0x18'))[_0x518e('0x19')](socket);function respondWithStatusCode(_0x1b79df,_0x39dcee){_0x39dcee=_0x39dcee||0xcc;return function(_0xf235e5){if(_0xf235e5){return _0x1b79df[_0x518e('0x1a')](_0x39dcee);}return _0x1b79df['status'](_0x39dcee)[_0x518e('0x1b')]();};}function respondWithResult(_0x460da9,_0x1883b7){_0x1883b7=_0x1883b7||0xc8;return function(_0x4fbbda){if(_0x4fbbda){return _0x460da9[_0x518e('0x1c')](_0x1883b7)[_0x518e('0x1d')](_0x4fbbda);}};}function respondWithFilteredResult(_0x17f1a7,_0x564ce6){return function(_0x2c8e98){if(_0x2c8e98){var _0x14a2bc=typeof _0x564ce6[_0x518e('0x1e')]===_0x518e('0x1f')&&typeof _0x564ce6['limit']===_0x518e('0x1f');var _0x554259=_0x2c8e98[_0x518e('0x20')];var _0x3438a0=_0x14a2bc?0x0:_0x564ce6[_0x518e('0x1e')];var _0x26a735=_0x14a2bc?_0x2c8e98[_0x518e('0x20')]:_0x564ce6[_0x518e('0x1e')]+_0x564ce6['limit'];var _0x5b600f;if(_0x26a735>=_0x554259){_0x26a735=_0x554259;_0x5b600f=0xc8;}else{_0x5b600f=0xce;}_0x17f1a7[_0x518e('0x1c')](_0x5b600f);return _0x17f1a7['set'](_0x518e('0x21'),_0x3438a0+'-'+_0x26a735+'/'+_0x554259)[_0x518e('0x1d')](_0x2c8e98);}return null;};}function patchUpdates(_0x201f4f){return function(_0x118d25){try{jsonpatch[_0x518e('0x22')](_0x118d25,_0x201f4f,!![]);}catch(_0x19e096){return BPromise[_0x518e('0x23')](_0x19e096);}return _0x118d25[_0x518e('0x24')]();};}function saveUpdates(_0xcacb29,_0x5aa6ed){return function(_0x55ee9f){if(_0x55ee9f){return _0x55ee9f[_0x518e('0x25')](_0xcacb29)['then'](function(_0x1353bc){return _0x1353bc;});}return null;};}function removeEntity(_0x17e8b3,_0xc0f72a){return function(_0x30581e){if(_0x30581e){return _0x30581e[_0x518e('0x26')]()[_0x518e('0x27')](function(){var _0x374cde=_0x30581e[_0x518e('0x28')]({'plain':!![]});var _0x10d562=_0x518e('0x29');return db[_0x518e('0x2a')][_0x518e('0x26')]({'where':{'type':_0x10d562,'resourceId':_0x374cde['id']}})[_0x518e('0x27')](function(){return _0x30581e;});})[_0x518e('0x27')](function(){_0x17e8b3['status'](0xcc)[_0x518e('0x1b')]();});}};}function handleEntityNotFound(_0x4256fc,_0x1a0a28){return function(_0x5f4f4c){if(!_0x5f4f4c){_0x4256fc[_0x518e('0x1a')](0x194);}return _0x5f4f4c;};}function handleError(_0x21e929,_0x32a425){_0x32a425=_0x32a425||0x1f4;return function(_0x39f825){logger[_0x518e('0x2b')](_0x39f825['stack']);if(_0x39f825['name']){delete _0x39f825[_0x518e('0x2c')];}_0x21e929['status'](_0x32a425)[_0x518e('0x2d')](_0x39f825);};}exports[_0x518e('0x2e')]=function(_0x34c0d5,_0x2d3625){var _0x372584={},_0x5a0e14={},_0xb750c4={'count':0x0,'rows':[]};var _0x1fd47a=_['map'](db[_0x518e('0x2f')][_0x518e('0x30')],function(_0x254bc2){return{'name':_0x254bc2[_0x518e('0x31')],'type':_0x254bc2[_0x518e('0x32')]['key']};});_0x5a0e14[_0x518e('0x33')]=_[_0x518e('0x34')](_0x1fd47a,_0x518e('0x2c'));_0x5a0e14[_0x518e('0x35')]=_[_0x518e('0x36')](_0x34c0d5['query']);_0x5a0e14[_0x518e('0x37')]=_['intersection'](_0x5a0e14['model'],_0x5a0e14['query']);_0x372584[_0x518e('0x38')]=_[_0x518e('0x39')](_0x5a0e14[_0x518e('0x33')],qs[_0x518e('0x3a')](_0x34c0d5['query'][_0x518e('0x3a')]));_0x372584[_0x518e('0x38')]=_0x372584[_0x518e('0x38')][_0x518e('0x3b')]?_0x372584[_0x518e('0x38')]:_0x5a0e14[_0x518e('0x33')];if(!_0x34c0d5[_0x518e('0x35')][_0x518e('0x3c')](_0x518e('0x3d'))){_0x372584[_0x518e('0x3e')]=qs[_0x518e('0x3e')](_0x34c0d5[_0x518e('0x35')]['limit']);_0x372584[_0x518e('0x1e')]=qs['offset'](_0x34c0d5[_0x518e('0x35')][_0x518e('0x1e')]);}_0x372584[_0x518e('0x3f')]=qs[_0x518e('0x40')](_0x34c0d5[_0x518e('0x35')]['sort']);_0x372584['where']=qs[_0x518e('0x37')](_[_0x518e('0x41')](_0x34c0d5['query'],_0x5a0e14['filters']),_0x1fd47a);if(_0x34c0d5[_0x518e('0x35')]['filter']){_0x372584[_0x518e('0x42')]=_[_0x518e('0x43')](_0x372584[_0x518e('0x42')],{'$or':_['map'](_0x1fd47a,function(_0x46498a){if(_0x46498a['type']!==_0x518e('0x44')){var _0x1b5dcd={};_0x1b5dcd[_0x46498a[_0x518e('0x2c')]]={'$like':'%'+_0x34c0d5[_0x518e('0x35')][_0x518e('0x45')]+'%'};return _0x1b5dcd;}})});}_0x372584=_['merge']({},_0x372584,_0x34c0d5[_0x518e('0x46')]);var _0x418329={'where':_0x372584[_0x518e('0x42')]};return db[_0x518e('0x2f')][_0x518e('0x20')](_0x418329)['then'](function(_0x168df6){_0xb750c4['count']=_0x168df6;if(_0x34c0d5[_0x518e('0x35')][_0x518e('0x47')]){_0x372584[_0x518e('0x48')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x518e('0x49')](_0x372584);})['then'](function(_0x13b30e){_0xb750c4[_0x518e('0x4a')]=_0x13b30e;return _0xb750c4;})[_0x518e('0x27')](respondWithFilteredResult(_0x2d3625,_0x372584))[_0x518e('0x4b')](handleError(_0x2d3625,null));};exports[_0x518e('0x4c')]=function(_0x5cfca3,_0x1b0f3f){var _0x2ac30c={'raw':!![],'where':{'id':_0x5cfca3[_0x518e('0x4d')]['id']}},_0xe06ed0={};_0xe06ed0[_0x518e('0x33')]=_[_0x518e('0x36')](db[_0x518e('0x2f')][_0x518e('0x30')]);_0xe06ed0[_0x518e('0x35')]=_[_0x518e('0x36')](_0x5cfca3['query']);_0xe06ed0[_0x518e('0x37')]=_['intersection'](_0xe06ed0[_0x518e('0x33')],_0xe06ed0[_0x518e('0x35')]);_0x2ac30c[_0x518e('0x38')]=_[_0x518e('0x39')](_0xe06ed0[_0x518e('0x33')],qs[_0x518e('0x3a')](_0x5cfca3['query']['fields']));_0x2ac30c[_0x518e('0x38')]=_0x2ac30c[_0x518e('0x38')][_0x518e('0x3b')]?_0x2ac30c[_0x518e('0x38')]:_0xe06ed0[_0x518e('0x33')];if(_0x5cfca3[_0x518e('0x35')][_0x518e('0x47')]){_0x2ac30c[_0x518e('0x48')]=[{'all':!![]}];}_0x2ac30c=_[_0x518e('0x43')]({},_0x2ac30c,_0x5cfca3[_0x518e('0x46')]);return db[_0x518e('0x2f')][_0x518e('0x4e')](_0x2ac30c)['then'](handleEntityNotFound(_0x1b0f3f,null))[_0x518e('0x27')](respondWithResult(_0x1b0f3f,null))[_0x518e('0x4b')](handleError(_0x1b0f3f,null));};exports[_0x518e('0x4f')]=function(_0x3c3c29,_0x3cb496){return db[_0x518e('0x2f')][_0x518e('0x4f')](_0x3c3c29[_0x518e('0x50')],{})[_0x518e('0x27')](function(_0x37e349){var _0xf62b90=_0x3c3c29[_0x518e('0x51')][_0x518e('0x28')]({'plain':!![]});if(!_0xf62b90)throw new Error(_0x518e('0x52'));if(_0xf62b90[_0x518e('0x53')]===_0x518e('0x51')){var _0x507b94=_0x37e349[_0x518e('0x28')]({'plain':!![]});var _0x13f986=_0x518e('0x29');return db['UserProfileSection'][_0x518e('0x4e')]({'where':{'name':_0x13f986,'userProfileId':_0xf62b90[_0x518e('0x54')]},'raw':!![]})['then'](function(_0x512204){if(_0x512204&&_0x512204[_0x518e('0x55')]===0x0){return db[_0x518e('0x2a')][_0x518e('0x4f')]({'name':_0x507b94[_0x518e('0x2c')],'resourceId':_0x507b94['id'],'type':_0x512204['name'],'sectionId':_0x512204['id']},{})['then'](function(){return _0x37e349;});}else{return _0x37e349;}})[_0x518e('0x4b')](function(_0x262b0d){logger[_0x518e('0x2b')](_0x518e('0x56'),_0x262b0d);throw _0x262b0d;});}return _0x37e349;})[_0x518e('0x27')](respondWithResult(_0x3cb496,0xc9))[_0x518e('0x4b')](handleError(_0x3cb496,null));};exports['update']=function(_0x3e66b9,_0x4eeb4d){if(_0x3e66b9[_0x518e('0x50')]['id']){delete _0x3e66b9[_0x518e('0x50')]['id'];}return db[_0x518e('0x2f')][_0x518e('0x4e')]({'where':{'id':_0x3e66b9[_0x518e('0x4d')]['id']}})[_0x518e('0x27')](handleEntityNotFound(_0x4eeb4d,null))[_0x518e('0x27')](saveUpdates(_0x3e66b9[_0x518e('0x50')],null))[_0x518e('0x27')](respondWithResult(_0x4eeb4d,null))['catch'](handleError(_0x4eeb4d,null));};exports[_0x518e('0x26')]=function(_0x34b5a5,_0x549799){return db['WhatsappQueue'][_0x518e('0x4e')]({'where':{'id':_0x34b5a5[_0x518e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x549799,null))[_0x518e('0x27')](removeEntity(_0x549799,null))[_0x518e('0x4b')](handleError(_0x549799,null));};exports[_0x518e('0x57')]=function(_0x248829,_0x5187ad){return db['WhatsappQueue'][_0x518e('0x57')]()[_0x518e('0x27')](respondWithResult(_0x5187ad,null))[_0x518e('0x4b')](handleError(_0x5187ad,null));};exports[_0x518e('0x58')]=function(_0x441b1d,_0x3ce85f,_0x27fbea){var _0x5cd576={'raw':!![],'where':{}},_0x4a69b5={},_0x400649;return db['WhatsappQueue'][_0x518e('0x59')]({'where':{'id':_0x441b1d[_0x518e('0x4d')]['id']}})[_0x518e('0x27')](handleEntityNotFound(_0x3ce85f,null))[_0x518e('0x27')](function(_0x15521d){if(_0x15521d){_0x400649=_0x15521d[_0x518e('0x28')]({'plain':!![]});_0x4a69b5[_0x518e('0x33')]=_[_0x518e('0x36')](db['UserWhatsappQueue'][_0x518e('0x30')]);_0x4a69b5[_0x518e('0x35')]=_['keys'](_0x441b1d['query']);_0x4a69b5[_0x518e('0x37')]=_[_0x518e('0x39')](_0x4a69b5[_0x518e('0x33')],_0x4a69b5[_0x518e('0x35')]);_0x5cd576[_0x518e('0x38')]=_[_0x518e('0x39')](_0x4a69b5[_0x518e('0x33')],qs['fields'](_0x441b1d[_0x518e('0x35')][_0x518e('0x3a')]));_0x5cd576[_0x518e('0x38')]=_0x5cd576[_0x518e('0x38')][_0x518e('0x3b')]?_0x5cd576[_0x518e('0x38')]:_0x4a69b5[_0x518e('0x33')];if(!_0x441b1d[_0x518e('0x35')][_0x518e('0x3c')](_0x518e('0x3d'))){_0x5cd576[_0x518e('0x3e')]=qs[_0x518e('0x3e')](_0x441b1d['query'][_0x518e('0x3e')]);_0x5cd576[_0x518e('0x1e')]=qs[_0x518e('0x1e')](_0x441b1d[_0x518e('0x35')][_0x518e('0x1e')]);}_0x5cd576[_0x518e('0x3f')]=qs[_0x518e('0x40')](_0x441b1d[_0x518e('0x35')][_0x518e('0x40')]);_0x5cd576[_0x518e('0x42')]=qs[_0x518e('0x37')](_[_0x518e('0x41')](_0x441b1d[_0x518e('0x35')],_0x4a69b5[_0x518e('0x37')]));_0x5cd576[_0x518e('0x42')][_0x518e('0x5a')]=_0x15521d['id'];if(_0x441b1d[_0x518e('0x35')][_0x518e('0x45')]){_0x5cd576[_0x518e('0x42')]=_['merge'](_0x5cd576['where'],{'$or':_[_0x518e('0x34')](_0x5cd576['attributes'],function(_0x48dfb5){var _0xf4be31={};_0xf4be31[_0x48dfb5]={'$like':'%'+_0x441b1d[_0x518e('0x35')][_0x518e('0x45')]+'%'};return _0xf4be31;})});}_0x5cd576=_['merge']({},_0x5cd576,_0x441b1d['options']);return db[_0x518e('0x5b')][_0x518e('0x49')](_0x5cd576);}})[_0x518e('0x27')](function(_0x18e814){if(_0x18e814){return db[_0x518e('0x5c')]['findAndCountAll']({'where':{'id':_[_0x518e('0x34')](_0x18e814,'UserId'),'role':'agent'},'attributes':['id',_0x518e('0x2c'),_0x518e('0x5d'),_0x518e('0x5e'),'createdAt']});}})[_0x518e('0x27')](function(_0xf8bb24){if(_0xf8bb24){return{'count':_0xf8bb24[_0x518e('0x20')],'rows':_[_0x518e('0x34')](_0xf8bb24['rows'],function(_0x3145cd){return{'membername':_0x3145cd[_0x518e('0x2c')],'UserId':_0x3145cd['id'],'queue_name':_0x400649[_0x518e('0x2c')],'WhatsappQueueId':_0x400649['id'],'interface':util[_0x518e('0x5f')](_0x518e('0x60'),'SIP',_0x3145cd['name']),'penalty':0x0,'paused':_0x3145cd[_0x518e('0x5d')],'createdAt':_0x3145cd[_0x518e('0x61')],'updatedAt':_0x3145cd[_0x518e('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x518e('0x27')](respondWithFilteredResult(_0x3ce85f,_0x5cd576))[_0x518e('0x4b')](handleError(_0x3ce85f,null));};exports['getTeams']=function(_0x38c7a6,_0x3398f1,_0x5a97d7){var _0x47c2f0={};var _0x456e38={};var _0x419492;var _0x56fd2f;return db['WhatsappQueue']['findOne']({'where':{'id':_0x38c7a6[_0x518e('0x4d')]['id']}})[_0x518e('0x27')](handleEntityNotFound(_0x3398f1,null))[_0x518e('0x27')](function(_0x316d65){if(_0x316d65){_0x419492=_0x316d65;_0x456e38[_0x518e('0x33')]=_[_0x518e('0x36')](db[_0x518e('0x62')][_0x518e('0x30')]);_0x456e38[_0x518e('0x35')]=_[_0x518e('0x36')](_0x38c7a6[_0x518e('0x35')]);_0x456e38['filters']=_[_0x518e('0x39')](_0x456e38[_0x518e('0x33')],_0x456e38['query']);_0x47c2f0['attributes']=_[_0x518e('0x39')](_0x456e38[_0x518e('0x33')],qs['fields'](_0x38c7a6['query'][_0x518e('0x3a')]));_0x47c2f0[_0x518e('0x38')]=_0x47c2f0['attributes'][_0x518e('0x3b')]?_0x47c2f0['attributes']:_0x456e38['model'];_0x47c2f0[_0x518e('0x3f')]=qs[_0x518e('0x40')](_0x38c7a6[_0x518e('0x35')][_0x518e('0x40')]);_0x47c2f0[_0x518e('0x42')]=qs[_0x518e('0x37')](_[_0x518e('0x41')](_0x38c7a6[_0x518e('0x35')],_0x456e38[_0x518e('0x37')]));if(_0x38c7a6[_0x518e('0x35')][_0x518e('0x45')]){_0x47c2f0[_0x518e('0x42')]=_['merge'](_0x47c2f0['where'],{'$or':_['map'](_0x47c2f0['attributes'],function(_0x44c56e){var _0x1e3e4a={};_0x1e3e4a[_0x44c56e]={'$like':'%'+_0x38c7a6[_0x518e('0x35')]['filter']+'%'};return _0x1e3e4a;})});}_0x47c2f0=_['merge']({},_0x47c2f0,_0x38c7a6[_0x518e('0x46')]);return _0x419492[_0x518e('0x63')](_0x47c2f0);}})[_0x518e('0x27')](function(_0x10001c){if(_0x10001c){_0x56fd2f=_0x10001c['length'];if(!_0x38c7a6[_0x518e('0x35')]['hasOwnProperty'](_0x518e('0x3d'))){_0x47c2f0[_0x518e('0x3e')]=qs['limit'](_0x38c7a6[_0x518e('0x35')]['limit']);_0x47c2f0['offset']=qs[_0x518e('0x1e')](_0x38c7a6[_0x518e('0x35')][_0x518e('0x1e')]);}return _0x419492[_0x518e('0x63')](_0x47c2f0);}})['then'](function(_0x381f63){if(_0x381f63){return _0x381f63?{'count':_0x56fd2f,'rows':_0x381f63}:null;}})['then'](respondWithResult(_0x3398f1,null))['catch'](handleError(_0x3398f1,null));};exports['addTeams']=function(_0x5ef89f,_0xf8c4d3,_0x5037a0){var _0x35bf5d=_0x5ef89f['body'][_0x518e('0x64')];return db[_0x518e('0x62')][_0x518e('0x49')]({'where':{'id':_0x35bf5d},'attributes':['id'],'include':[{'model':db[_0x518e('0x5c')],'as':_0x518e('0x65'),'attributes':['id','name',_0x518e('0x66'),_0x518e('0x67'),'interface'],'raw':!![]}]})[_0x518e('0x27')](function(_0x4a3707){if(_0x4a3707){var _0x5714ae=_['flatMap'](_0x4a3707,function(_0x1637f2){var _0x3e1c38=_0x1637f2[_0x518e('0x28')]({'plain':!![]});return _0x3e1c38[_0x518e('0x65')];});return db['WhatsappQueue'][_0x518e('0x4e')]({'where':{'id':_0x5ef89f[_0x518e('0x4d')]['id']}})[_0x518e('0x27')](function(_0x4c9e19){return db['sequelize']['transaction'](function(_0x825883){return _0x4c9e19['addTeams'](_0x35bf5d,{'transaction':_0x825883})[_0x518e('0x27')](function(){return BPromise[_0x518e('0x68')](_0x5714ae,function(_0x343c6f){return db[_0x518e('0x5b')][_0x518e('0x69')]({'where':{'UserId':_0x343c6f['id'],'WhatsappQueueId':_0x5ef89f[_0x518e('0x4d')]['id']},'transaction':_0x825883});});})[_0x518e('0x27')](function(){_0x5714ae[_0x518e('0x6a')](function(_0x2e34eb){socket[_0x518e('0x6b')](_0x518e('0x6c'),{'UserId':_0x2e34eb['id'],'WhatsappQueueId':_0x4c9e19['id']});});});});});}})[_0x518e('0x27')](respondWithStatusCode(_0xf8c4d3,null))['catch'](handleError(_0xf8c4d3,null));};exports[_0x518e('0x6d')]=function(_0xb2df97,_0x19da10,_0x563eca){return db[_0x518e('0x62')]['findAll']({'where':{'id':_0xb2df97['query'][_0x518e('0x64')]},'attributes':['id'],'include':[{'model':db[_0x518e('0x5c')],'as':_0x518e('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x19da10,null))[_0x518e('0x27')](function(_0x143024){var _0x548399=_[_0x518e('0x34')](_0x143024,'id');var _0x3735d3=[];var _0x18a2da=[];var _0x4c8358=squel['select']();_0x4c8358[_0x518e('0x6e')](_0x518e('0x6f'))[_0x518e('0x70')](_0x518e('0x71'),'tq')[_0x518e('0x72')](_0x518e('0x73'),'ut',_0x518e('0x74'))[_0x518e('0x42')](_0x518e('0x75'),_0xb2df97[_0x518e('0x4d')]['id']);for(var _0x3d2a62=0x0;_0x3d2a62<_0x143024['length'];_0x3d2a62+=0x1){let _0x409b23=_0x143024[_0x3d2a62];for(var _0x495d9c=0x0;_0x495d9c<_0x409b23[_0x518e('0x65')]['length'];_0x495d9c+=0x1){let _0xed6c97=_0x409b23[_0x518e('0x65')][_0x495d9c];var _0x3ea923=_0x4c8358['clone']();_0x3ea923['where'](_0x518e('0x76'),_0xed6c97['id']);_0x18a2da[_0x518e('0x77')](db[_0x518e('0x78')][_0x518e('0x35')](_0x3ea923[_0x518e('0x79')](),{'type':db['sequelize'][_0x518e('0x7a')][_0x518e('0x7b')]})['then'](function(_0x54c534){if(_0x54c534['length']===0x1){return _0xed6c97['id'];}else{var _0x29c7b6=_['every'](_[_0x518e('0x34')](_0x54c534,_0x518e('0x7c')),function(_0x51be90){return _['includes'](_0x548399,_0x51be90);});if(_0x29c7b6){return _0xed6c97['id'];}}}));}}return BPromise[_0x518e('0x7d')](_0x18a2da)[_0x518e('0x27')](function(_0x124ab1){_0x3735d3=_(_0x3735d3)[_0x518e('0x7e')](_0x124ab1)[_0x518e('0x7f')]()[_0x518e('0x80')]();return db[_0x518e('0x2f')][_0x518e('0x4e')]({'where':{'id':_0xb2df97[_0x518e('0x4d')]['id']}})['then'](function(_0x60cf5a){return db['sequelize']['transaction'](function(_0x1f1635){return _0x60cf5a[_0x518e('0x6d')](_0xb2df97[_0x518e('0x35')][_0x518e('0x64')],{'transaction':_0x1f1635})[_0x518e('0x27')](function(){if(!_['isEmpty'](_0x3735d3)){return _0x60cf5a[_0x518e('0x81')](_0x3735d3,{'transaction':_0x1f1635});}})['then'](function(){_0x3735d3['forEach'](function(_0x11897c){socket[_0x518e('0x6b')]('userWhatsappQueue:remove',{'UserId':_0x11897c,'WhatsappQueueId':_0x60cf5a['id']});});});});});});})['then'](respondWithStatusCode(_0x19da10,null))[_0x518e('0x4b')](handleError(_0x19da10,null));};exports['addAgents']=function(_0x5666ba,_0x4dee83,_0x3f871b){return db['WhatsappQueue'][_0x518e('0x4e')]({'where':{'id':_0x5666ba[_0x518e('0x4d')]['id']}})[_0x518e('0x27')](handleEntityNotFound(_0x4dee83,null))[_0x518e('0x27')](function(_0x5e43b7){if(_0x5e43b7){return _0x5e43b7['addAgents'](_0x5666ba[_0x518e('0x50')][_0x518e('0x64')],_[_0x518e('0x82')](_0x5666ba[_0x518e('0x50')],[_0x518e('0x64'),'id'])||{})[_0x518e('0x83')](function(_0x4d9f06){for(var _0x5d7c73=0x0;_0x5d7c73<_0x5666ba['body'][_0x518e('0x64')][_0x518e('0x3b')];_0x5d7c73+=0x1){socket[_0x518e('0x6b')]('userWhatsappQueue:save',{'UserId':Number(_0x5666ba[_0x518e('0x50')][_0x518e('0x64')][_0x5d7c73]),'WhatsappQueueId':Number(_0x5666ba[_0x518e('0x4d')]['id'])});}return _0x4d9f06;});}})[_0x518e('0x27')](respondWithResult(_0x4dee83,null))[_0x518e('0x4b')](handleError(_0x4dee83,null));};exports[_0x518e('0x81')]=function(_0x4ff69e,_0x1ca31e,_0x468d8a){return db[_0x518e('0x2f')][_0x518e('0x4e')]({'where':{'id':_0x4ff69e[_0x518e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ca31e,null))['then'](function(_0xe18e36){if(_0xe18e36){return _0xe18e36['removeAgents'](_0x4ff69e[_0x518e('0x35')]['ids'])[_0x518e('0x27')](function(){if(_['isArray'](_0x4ff69e[_0x518e('0x35')][_0x518e('0x64')])){for(var _0x5be823=0x0;_0x5be823<_0x4ff69e[_0x518e('0x35')][_0x518e('0x64')][_0x518e('0x3b')];_0x5be823+=0x1){socket['emit'](_0x518e('0x84'),{'UserId':Number(_0x4ff69e[_0x518e('0x35')]['ids'][_0x5be823]),'WhatsappQueueId':Number(_0x4ff69e[_0x518e('0x4d')]['id'])});}}else{socket[_0x518e('0x6b')](_0x518e('0x84'),{'UserId':Number(_0x4ff69e[_0x518e('0x35')]['ids']),'WhatsappQueueId':Number(_0x4ff69e[_0x518e('0x4d')]['id'])});}});}})[_0x518e('0x27')](respondWithStatusCode(_0x1ca31e,null))[_0x518e('0x4b')](handleError(_0x1ca31e,null));};exports[_0x518e('0x85')]=function(_0x2f5f50,_0x3c9293,_0x240377){var _0xddf066={};var _0x34376e={};var _0x4a9590;var _0x287bc2;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2f5f50[_0x518e('0x4d')]['id']}})[_0x518e('0x27')](handleEntityNotFound(_0x3c9293,null))[_0x518e('0x27')](function(_0x533855){if(_0x533855){_0x4a9590=_0x533855;_0x34376e['model']=_['keys'](db[_0x518e('0x5c')][_0x518e('0x30')]);_0x34376e[_0x518e('0x35')]=_[_0x518e('0x36')](_0x2f5f50[_0x518e('0x35')]);_0x34376e['filters']=_[_0x518e('0x39')](_0x34376e[_0x518e('0x33')],_0x34376e[_0x518e('0x35')]);_0xddf066['attributes']=_[_0x518e('0x39')](_0x34376e['model'],qs[_0x518e('0x3a')](_0x2f5f50[_0x518e('0x35')][_0x518e('0x3a')]));_0xddf066[_0x518e('0x38')]=_0xddf066['attributes'][_0x518e('0x3b')]?_0xddf066[_0x518e('0x38')]:_0x34376e[_0x518e('0x33')];_0xddf066[_0x518e('0x3f')]=qs[_0x518e('0x40')](_0x2f5f50[_0x518e('0x35')][_0x518e('0x40')]);_0xddf066[_0x518e('0x42')]=qs[_0x518e('0x37')](_[_0x518e('0x41')](_0x2f5f50[_0x518e('0x35')],_0x34376e[_0x518e('0x37')]));if(_0x2f5f50[_0x518e('0x35')][_0x518e('0x45')]){_0xddf066[_0x518e('0x42')]=_[_0x518e('0x43')](_0xddf066[_0x518e('0x42')],{'$or':_[_0x518e('0x34')](_0xddf066[_0x518e('0x38')],function(_0x2abd8f){var _0x504c47={};_0x504c47[_0x2abd8f]={'$like':'%'+_0x2f5f50[_0x518e('0x35')][_0x518e('0x45')]+'%'};return _0x504c47;})});}_0xddf066=_[_0x518e('0x43')]({},_0xddf066,_0x2f5f50[_0x518e('0x46')]);return _0x4a9590['getAgents'](_0xddf066);}})[_0x518e('0x27')](function(_0x18886d){if(_0x18886d){_0x287bc2=_0x18886d['length'];if(!_0x2f5f50[_0x518e('0x35')][_0x518e('0x3c')]('nolimit')){_0xddf066[_0x518e('0x3e')]=qs[_0x518e('0x3e')](_0x2f5f50[_0x518e('0x35')][_0x518e('0x3e')]);_0xddf066[_0x518e('0x1e')]=qs[_0x518e('0x1e')](_0x2f5f50[_0x518e('0x35')]['offset']);}return _0x4a9590[_0x518e('0x85')](_0xddf066);}})[_0x518e('0x27')](function(_0x417107){if(_0x417107){return _0x417107?{'count':_0x287bc2,'rows':_0x417107}:null;}})[_0x518e('0x27')](respondWithResult(_0x3c9293,null))['catch'](handleError(_0x3c9293,null));}; \ No newline at end of file +var _0x9722=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','name','send','index','map','fieldName','type','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','WhatsappQueue','includeAll','include','findAll','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','UserWhatsappQueue','rawAttributes','hasOwnProperty','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format'];(function(_0x2dcf38,_0x33765a){var _0x2295dc=function(_0x1aff4f){while(--_0x1aff4f){_0x2dcf38['push'](_0x2dcf38['shift']());}};_0x2295dc(++_0x33765a);}(_0x9722,0x11f));var _0x2972=function(_0x5b7e02,_0x581de5){_0x5b7e02=_0x5b7e02-0x0;var _0x4d6892=_0x9722[_0x5b7e02];return _0x4d6892;};'use strict';var emlformat=require(_0x2972('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2972('0x1'));var Mustache=require('mustache');var util=require(_0x2972('0x2'));var path=require(_0x2972('0x3'));var sox=require(_0x2972('0x4'));var csv=require(_0x2972('0x5'));var ejs=require(_0x2972('0x6'));var fs=require('fs');var fs_extra=require(_0x2972('0x7'));var _=require(_0x2972('0x8'));var squel=require(_0x2972('0x9'));var crypto=require(_0x2972('0xa'));var jsforce=require(_0x2972('0xb'));var deskjs=require(_0x2972('0xc'));var toCsv=require(_0x2972('0x5'));var querystring=require(_0x2972('0xd'));var Papa=require(_0x2972('0xe'));var Redis=require(_0x2972('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2972('0x10'));var as=require(_0x2972('0x11'));var hardwareService=require(_0x2972('0x12'));var logger=require(_0x2972('0x13'))(_0x2972('0x14'));var utils=require(_0x2972('0x15'));var config=require(_0x2972('0x16'));var licenseUtil=require(_0x2972('0x17'));var db=require(_0x2972('0x18'))['db'];config[_0x2972('0x19')]=_[_0x2972('0x1a')](config[_0x2972('0x19')],{'host':_0x2972('0x1b'),'port':0x18eb});var socket=require(_0x2972('0x1c'))(new Redis(config[_0x2972('0x19')]));require(_0x2972('0x1d'))[_0x2972('0x1e')](socket);function respondWithStatusCode(_0x21bb27,_0x499c73){_0x499c73=_0x499c73||0xcc;return function(_0x2b56d5){if(_0x2b56d5){return _0x21bb27[_0x2972('0x1f')](_0x499c73);}return _0x21bb27['status'](_0x499c73)['end']();};}function respondWithResult(_0x178f39,_0x2531f2){_0x2531f2=_0x2531f2||0xc8;return function(_0x39e83b){if(_0x39e83b){return _0x178f39[_0x2972('0x20')](_0x2531f2)[_0x2972('0x21')](_0x39e83b);}};}function respondWithFilteredResult(_0x5729ae,_0x28991a){return function(_0x35dfc6){if(_0x35dfc6){var _0x8a3fb3=typeof _0x28991a[_0x2972('0x22')]===_0x2972('0x23')&&typeof _0x28991a[_0x2972('0x24')]===_0x2972('0x23');var _0x5e49ac=_0x35dfc6[_0x2972('0x25')];var _0x3c9fc7=_0x8a3fb3?0x0:_0x28991a[_0x2972('0x22')];var _0x1fe73f=_0x8a3fb3?_0x35dfc6['count']:_0x28991a[_0x2972('0x22')]+_0x28991a['limit'];var _0x3f4adb;if(_0x1fe73f>=_0x5e49ac){_0x1fe73f=_0x5e49ac;_0x3f4adb=0xc8;}else{_0x3f4adb=0xce;}_0x5729ae[_0x2972('0x20')](_0x3f4adb);return _0x5729ae[_0x2972('0x26')](_0x2972('0x27'),_0x3c9fc7+'-'+_0x1fe73f+'/'+_0x5e49ac)['json'](_0x35dfc6);}return null;};}function patchUpdates(_0x3cbb41){return function(_0x546b5d){try{jsonpatch[_0x2972('0x28')](_0x546b5d,_0x3cbb41,!![]);}catch(_0x1d18e8){return BPromise[_0x2972('0x29')](_0x1d18e8);}return _0x546b5d[_0x2972('0x2a')]();};}function saveUpdates(_0x215239,_0x5c63ec){return function(_0x33d5d4){if(_0x33d5d4){return _0x33d5d4[_0x2972('0x2b')](_0x215239)['then'](function(_0x38358d){return _0x38358d;});}return null;};}function removeEntity(_0x37e792,_0x44943c){return function(_0x25bb60){if(_0x25bb60){return _0x25bb60['destroy']()[_0x2972('0x2c')](function(){var _0x542822=_0x25bb60[_0x2972('0x2d')]({'plain':!![]});var _0x5f38e8='WhatsappQueues';return db[_0x2972('0x2e')][_0x2972('0x2f')]({'where':{'type':_0x5f38e8,'resourceId':_0x542822['id']}})['then'](function(){return _0x25bb60;});})['then'](function(){_0x37e792[_0x2972('0x20')](0xcc)[_0x2972('0x30')]();});}};}function handleEntityNotFound(_0x5c793c,_0x377d08){return function(_0x546bb8){if(!_0x546bb8){_0x5c793c['sendStatus'](0x194);}return _0x546bb8;};}function handleError(_0x34a535,_0x42b16b){_0x42b16b=_0x42b16b||0x1f4;return function(_0x3b0a7a){logger[_0x2972('0x31')](_0x3b0a7a['stack']);if(_0x3b0a7a[_0x2972('0x32')]){delete _0x3b0a7a['name'];}_0x34a535[_0x2972('0x20')](_0x42b16b)[_0x2972('0x33')](_0x3b0a7a);};}exports[_0x2972('0x34')]=function(_0x3c3ac7,_0x1e8d77){var _0x4f49d0={},_0x302b58={},_0xd3dcd4={'count':0x0,'rows':[]};var _0x1a2da9=_[_0x2972('0x35')](db['WhatsappQueue']['rawAttributes'],function(_0xe22604){return{'name':_0xe22604[_0x2972('0x36')],'type':_0xe22604[_0x2972('0x37')]['key']};});_0x302b58['model']=_[_0x2972('0x35')](_0x1a2da9,_0x2972('0x32'));_0x302b58['query']=_[_0x2972('0x38')](_0x3c3ac7['query']);_0x302b58['filters']=_[_0x2972('0x39')](_0x302b58[_0x2972('0x3a')],_0x302b58[_0x2972('0x3b')]);_0x4f49d0[_0x2972('0x3c')]=_[_0x2972('0x39')](_0x302b58[_0x2972('0x3a')],qs[_0x2972('0x3d')](_0x3c3ac7[_0x2972('0x3b')][_0x2972('0x3d')]));_0x4f49d0['attributes']=_0x4f49d0[_0x2972('0x3c')][_0x2972('0x3e')]?_0x4f49d0[_0x2972('0x3c')]:_0x302b58[_0x2972('0x3a')];if(!_0x3c3ac7['query']['hasOwnProperty'](_0x2972('0x3f'))){_0x4f49d0[_0x2972('0x24')]=qs[_0x2972('0x24')](_0x3c3ac7[_0x2972('0x3b')]['limit']);_0x4f49d0[_0x2972('0x22')]=qs[_0x2972('0x22')](_0x3c3ac7['query'][_0x2972('0x22')]);}_0x4f49d0[_0x2972('0x40')]=qs[_0x2972('0x41')](_0x3c3ac7['query']['sort']);_0x4f49d0[_0x2972('0x42')]=qs[_0x2972('0x43')](_['pick'](_0x3c3ac7['query'],_0x302b58['filters']),_0x1a2da9);if(_0x3c3ac7[_0x2972('0x3b')]['filter']){_0x4f49d0[_0x2972('0x42')]=_[_0x2972('0x44')](_0x4f49d0[_0x2972('0x42')],{'$or':_[_0x2972('0x35')](_0x1a2da9,function(_0x4dc61d){if(_0x4dc61d[_0x2972('0x37')]!==_0x2972('0x45')){var _0x247058={};_0x247058[_0x4dc61d[_0x2972('0x32')]]={'$like':'%'+_0x3c3ac7[_0x2972('0x3b')][_0x2972('0x46')]+'%'};return _0x247058;}})});}_0x4f49d0=_['merge']({},_0x4f49d0,_0x3c3ac7[_0x2972('0x47')]);var _0x26fc93={'where':_0x4f49d0[_0x2972('0x42')]};return db[_0x2972('0x48')][_0x2972('0x25')](_0x26fc93)[_0x2972('0x2c')](function(_0x41fc5a){_0xd3dcd4[_0x2972('0x25')]=_0x41fc5a;if(_0x3c3ac7[_0x2972('0x3b')][_0x2972('0x49')]){_0x4f49d0[_0x2972('0x4a')]=[{'all':!![]}];}return db[_0x2972('0x48')][_0x2972('0x4b')](_0x4f49d0);})[_0x2972('0x2c')](function(_0x3c8b4d){_0xd3dcd4['rows']=_0x3c8b4d;return _0xd3dcd4;})[_0x2972('0x2c')](respondWithFilteredResult(_0x1e8d77,_0x4f49d0))[_0x2972('0x4c')](handleError(_0x1e8d77,null));};exports[_0x2972('0x4d')]=function(_0x4ee9c5,_0x1d284a){var _0x116661={'raw':!![],'where':{'id':_0x4ee9c5['params']['id']}},_0x1bb10f={};_0x1bb10f[_0x2972('0x3a')]=_[_0x2972('0x38')](db[_0x2972('0x48')]['rawAttributes']);_0x1bb10f[_0x2972('0x3b')]=_[_0x2972('0x38')](_0x4ee9c5[_0x2972('0x3b')]);_0x1bb10f[_0x2972('0x43')]=_[_0x2972('0x39')](_0x1bb10f['model'],_0x1bb10f['query']);_0x116661['attributes']=_[_0x2972('0x39')](_0x1bb10f[_0x2972('0x3a')],qs[_0x2972('0x3d')](_0x4ee9c5[_0x2972('0x3b')][_0x2972('0x3d')]));_0x116661[_0x2972('0x3c')]=_0x116661[_0x2972('0x3c')][_0x2972('0x3e')]?_0x116661[_0x2972('0x3c')]:_0x1bb10f['model'];if(_0x4ee9c5['query']['includeAll']){_0x116661[_0x2972('0x4a')]=[{'all':!![]}];}_0x116661=_[_0x2972('0x44')]({},_0x116661,_0x4ee9c5['options']);return db[_0x2972('0x48')][_0x2972('0x4e')](_0x116661)['then'](handleEntityNotFound(_0x1d284a,null))[_0x2972('0x2c')](respondWithResult(_0x1d284a,null))[_0x2972('0x4c')](handleError(_0x1d284a,null));};exports['create']=function(_0x128fd3,_0x35cd7a){return db[_0x2972('0x48')][_0x2972('0x4f')](_0x128fd3['body'],{})[_0x2972('0x2c')](function(_0x1664f0){var _0x1c81bc=_0x128fd3[_0x2972('0x50')][_0x2972('0x2d')]({'plain':!![]});if(!_0x1c81bc)throw new Error(_0x2972('0x51'));if(_0x1c81bc['role']==='user'){var _0x44f2fd=_0x1664f0[_0x2972('0x2d')]({'plain':!![]});var _0x4ad024=_0x2972('0x52');return db['UserProfileSection'][_0x2972('0x4e')]({'where':{'name':_0x4ad024,'userProfileId':_0x1c81bc[_0x2972('0x53')]},'raw':!![]})[_0x2972('0x2c')](function(_0x2ee939){if(_0x2ee939&&_0x2ee939['autoAssociation']===0x0){return db[_0x2972('0x2e')][_0x2972('0x4f')]({'name':_0x44f2fd['name'],'resourceId':_0x44f2fd['id'],'type':_0x2ee939[_0x2972('0x32')],'sectionId':_0x2ee939['id']},{})['then'](function(){return _0x1664f0;});}else{return _0x1664f0;}})[_0x2972('0x4c')](function(_0x457012){logger[_0x2972('0x31')](_0x2972('0x54'),_0x457012);throw _0x457012;});}return _0x1664f0;})[_0x2972('0x2c')](respondWithResult(_0x35cd7a,0xc9))[_0x2972('0x4c')](handleError(_0x35cd7a,null));};exports[_0x2972('0x2b')]=function(_0x3ebc08,_0x1a7a77){if(_0x3ebc08['body']['id']){delete _0x3ebc08[_0x2972('0x55')]['id'];}return db[_0x2972('0x48')]['find']({'where':{'id':_0x3ebc08[_0x2972('0x56')]['id']}})[_0x2972('0x2c')](handleEntityNotFound(_0x1a7a77,null))[_0x2972('0x2c')](saveUpdates(_0x3ebc08[_0x2972('0x55')],null))['then'](respondWithResult(_0x1a7a77,null))[_0x2972('0x4c')](handleError(_0x1a7a77,null));};exports['destroy']=function(_0x469cec,_0x382d7f){return db[_0x2972('0x48')]['find']({'where':{'id':_0x469cec[_0x2972('0x56')]['id']}})[_0x2972('0x2c')](handleEntityNotFound(_0x382d7f,null))['then'](removeEntity(_0x382d7f,null))[_0x2972('0x4c')](handleError(_0x382d7f,null));};exports['describe']=function(_0x3c1f5c,_0x4b87c1){return db['WhatsappQueue'][_0x2972('0x57')]()[_0x2972('0x2c')](respondWithResult(_0x4b87c1,null))[_0x2972('0x4c')](handleError(_0x4b87c1,null));};exports['getMembers']=function(_0x5df145,_0x4bfa45,_0x283734){var _0x219357={'raw':!![],'where':{}},_0x15afb5={},_0x5335c7;return db[_0x2972('0x48')]['findOne']({'where':{'id':_0x5df145[_0x2972('0x56')]['id']}})[_0x2972('0x2c')](handleEntityNotFound(_0x4bfa45,null))[_0x2972('0x2c')](function(_0x419a63){if(_0x419a63){_0x5335c7=_0x419a63[_0x2972('0x2d')]({'plain':!![]});_0x15afb5[_0x2972('0x3a')]=_[_0x2972('0x38')](db[_0x2972('0x58')][_0x2972('0x59')]);_0x15afb5[_0x2972('0x3b')]=_[_0x2972('0x38')](_0x5df145[_0x2972('0x3b')]);_0x15afb5[_0x2972('0x43')]=_['intersection'](_0x15afb5['model'],_0x15afb5[_0x2972('0x3b')]);_0x219357[_0x2972('0x3c')]=_[_0x2972('0x39')](_0x15afb5[_0x2972('0x3a')],qs[_0x2972('0x3d')](_0x5df145['query'][_0x2972('0x3d')]));_0x219357[_0x2972('0x3c')]=_0x219357[_0x2972('0x3c')][_0x2972('0x3e')]?_0x219357[_0x2972('0x3c')]:_0x15afb5[_0x2972('0x3a')];if(!_0x5df145['query'][_0x2972('0x5a')]('nolimit')){_0x219357[_0x2972('0x24')]=qs[_0x2972('0x24')](_0x5df145[_0x2972('0x3b')][_0x2972('0x24')]);_0x219357[_0x2972('0x22')]=qs['offset'](_0x5df145[_0x2972('0x3b')]['offset']);}_0x219357[_0x2972('0x40')]=qs['sort'](_0x5df145[_0x2972('0x3b')][_0x2972('0x41')]);_0x219357[_0x2972('0x42')]=qs[_0x2972('0x43')](_[_0x2972('0x5b')](_0x5df145['query'],_0x15afb5[_0x2972('0x43')]));_0x219357[_0x2972('0x42')][_0x2972('0x5c')]=_0x419a63['id'];if(_0x5df145[_0x2972('0x3b')][_0x2972('0x46')]){_0x219357[_0x2972('0x42')]=_[_0x2972('0x44')](_0x219357['where'],{'$or':_['map'](_0x219357[_0x2972('0x3c')],function(_0x150d39){var _0x27cdd4={};_0x27cdd4[_0x150d39]={'$like':'%'+_0x5df145[_0x2972('0x3b')][_0x2972('0x46')]+'%'};return _0x27cdd4;})});}_0x219357=_[_0x2972('0x44')]({},_0x219357,_0x5df145['options']);return db[_0x2972('0x58')][_0x2972('0x4b')](_0x219357);}})['then'](function(_0x5e6538){if(_0x5e6538){return db[_0x2972('0x5d')][_0x2972('0x5e')]({'where':{'id':_[_0x2972('0x35')](_0x5e6538,_0x2972('0x5f')),'role':_0x2972('0x60')},'attributes':['id','name',_0x2972('0x61'),_0x2972('0x62'),_0x2972('0x63')]});}})[_0x2972('0x2c')](function(_0x127d62){if(_0x127d62){return{'count':_0x127d62[_0x2972('0x25')],'rows':_['map'](_0x127d62['rows'],function(_0x3474c3){return{'membername':_0x3474c3[_0x2972('0x32')],'UserId':_0x3474c3['id'],'queue_name':_0x5335c7[_0x2972('0x32')],'WhatsappQueueId':_0x5335c7['id'],'interface':util[_0x2972('0x64')](_0x2972('0x65'),_0x2972('0x66'),_0x3474c3['name']),'penalty':0x0,'paused':_0x3474c3[_0x2972('0x61')],'createdAt':_0x3474c3['createdAt'],'updatedAt':_0x3474c3[_0x2972('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4bfa45,_0x219357))['catch'](handleError(_0x4bfa45,null));};exports['getTeams']=function(_0x1aa43c,_0x38b18e,_0x49d8f9){var _0x3c9642={};var _0x6497de={};var _0x16e895;var _0x480051;return db['WhatsappQueue'][_0x2972('0x67')]({'where':{'id':_0x1aa43c['params']['id']}})['then'](handleEntityNotFound(_0x38b18e,null))[_0x2972('0x2c')](function(_0xd163ed){if(_0xd163ed){_0x16e895=_0xd163ed;_0x6497de['model']=_[_0x2972('0x38')](db[_0x2972('0x68')][_0x2972('0x59')]);_0x6497de[_0x2972('0x3b')]=_[_0x2972('0x38')](_0x1aa43c[_0x2972('0x3b')]);_0x6497de[_0x2972('0x43')]=_['intersection'](_0x6497de[_0x2972('0x3a')],_0x6497de[_0x2972('0x3b')]);_0x3c9642[_0x2972('0x3c')]=_['intersection'](_0x6497de['model'],qs[_0x2972('0x3d')](_0x1aa43c['query'][_0x2972('0x3d')]));_0x3c9642[_0x2972('0x3c')]=_0x3c9642[_0x2972('0x3c')][_0x2972('0x3e')]?_0x3c9642['attributes']:_0x6497de[_0x2972('0x3a')];_0x3c9642['order']=qs['sort'](_0x1aa43c[_0x2972('0x3b')][_0x2972('0x41')]);_0x3c9642['where']=qs[_0x2972('0x43')](_[_0x2972('0x5b')](_0x1aa43c['query'],_0x6497de[_0x2972('0x43')]));if(_0x1aa43c[_0x2972('0x3b')][_0x2972('0x46')]){_0x3c9642[_0x2972('0x42')]=_[_0x2972('0x44')](_0x3c9642[_0x2972('0x42')],{'$or':_[_0x2972('0x35')](_0x3c9642[_0x2972('0x3c')],function(_0xbba90d){var _0x436b05={};_0x436b05[_0xbba90d]={'$like':'%'+_0x1aa43c[_0x2972('0x3b')][_0x2972('0x46')]+'%'};return _0x436b05;})});}_0x3c9642=_[_0x2972('0x44')]({},_0x3c9642,_0x1aa43c['options']);return _0x16e895['getTeams'](_0x3c9642);}})['then'](function(_0x3a31b6){if(_0x3a31b6){_0x480051=_0x3a31b6['length'];if(!_0x1aa43c[_0x2972('0x3b')][_0x2972('0x5a')](_0x2972('0x3f'))){_0x3c9642[_0x2972('0x24')]=qs['limit'](_0x1aa43c['query'][_0x2972('0x24')]);_0x3c9642[_0x2972('0x22')]=qs['offset'](_0x1aa43c[_0x2972('0x3b')][_0x2972('0x22')]);}return _0x16e895[_0x2972('0x69')](_0x3c9642);}})[_0x2972('0x2c')](function(_0x4c5a64){if(_0x4c5a64){return _0x4c5a64?{'count':_0x480051,'rows':_0x4c5a64}:null;}})['then'](respondWithResult(_0x38b18e,null))[_0x2972('0x4c')](handleError(_0x38b18e,null));};exports['addTeams']=function(_0x8f10eb,_0xc501c8,_0x498c9c){var _0x5b21ed=_0x8f10eb['body'][_0x2972('0x6a')];return db[_0x2972('0x68')][_0x2972('0x4b')]({'where':{'id':_0x5b21ed},'attributes':['id'],'include':[{'model':db[_0x2972('0x5d')],'as':_0x2972('0x6b'),'attributes':['id',_0x2972('0x32'),'online',_0x2972('0x6c'),_0x2972('0x6d')],'raw':!![]}]})[_0x2972('0x2c')](function(_0x86bb45){if(_0x86bb45){var _0x1eaeac=_[_0x2972('0x6e')](_0x86bb45,function(_0x4424ff){var _0x24f99c=_0x4424ff[_0x2972('0x2d')]({'plain':!![]});return _0x24f99c[_0x2972('0x6b')];});return db[_0x2972('0x48')]['find']({'where':{'id':_0x8f10eb[_0x2972('0x56')]['id']}})[_0x2972('0x2c')](function(_0x336840){return db[_0x2972('0x6f')][_0x2972('0x70')](function(_0x393958){return _0x336840[_0x2972('0x71')](_0x5b21ed,{'transaction':_0x393958})[_0x2972('0x2c')](function(){return BPromise[_0x2972('0x72')](_0x1eaeac,function(_0x302bd0){return db['UserWhatsappQueue'][_0x2972('0x73')]({'where':{'UserId':_0x302bd0['id'],'WhatsappQueueId':_0x8f10eb['params']['id']},'transaction':_0x393958});});})[_0x2972('0x2c')](function(){_0x1eaeac[_0x2972('0x74')](function(_0x41b221){socket[_0x2972('0x75')](_0x2972('0x76'),{'UserId':_0x41b221['id'],'WhatsappQueueId':_0x336840['id']});});});});});}})[_0x2972('0x2c')](respondWithStatusCode(_0xc501c8,null))[_0x2972('0x4c')](handleError(_0xc501c8,null));};exports[_0x2972('0x77')]=function(_0x19f3a2,_0x1883a5,_0x2dba8a){return db[_0x2972('0x68')][_0x2972('0x4b')]({'where':{'id':_0x19f3a2[_0x2972('0x3b')][_0x2972('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x2972('0x5d')],'as':_0x2972('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x2972('0x2c')](handleEntityNotFound(_0x1883a5,null))[_0x2972('0x2c')](function(_0x1574c9){var _0x2f5eb9=_[_0x2972('0x35')](_0x1574c9,'id');var _0x3d2749=[];var _0x305ee6=[];var _0x8eeece=squel[_0x2972('0x78')]();_0x8eeece[_0x2972('0x79')](_0x2972('0x7a'))['from'](_0x2972('0x7b'),'tq')[_0x2972('0x7c')](_0x2972('0x7d'),'ut',_0x2972('0x7e'))[_0x2972('0x42')]('WhatsappQueueId\x20=\x20?',_0x19f3a2['params']['id']);for(var _0x8d983c=0x0;_0x8d983c<_0x1574c9[_0x2972('0x3e')];_0x8d983c+=0x1){let _0xb66853=_0x1574c9[_0x8d983c];for(var _0x2de80d=0x0;_0x2de80d<_0xb66853[_0x2972('0x6b')][_0x2972('0x3e')];_0x2de80d+=0x1){let _0x33e570=_0xb66853['Agents'][_0x2de80d];var _0x50fd80=_0x8eeece[_0x2972('0x7f')]();_0x50fd80['where'](_0x2972('0x80'),_0x33e570['id']);_0x305ee6[_0x2972('0x81')](db[_0x2972('0x6f')][_0x2972('0x3b')](_0x50fd80[_0x2972('0x82')](),{'type':db[_0x2972('0x6f')]['QueryTypes']['SELECT']})[_0x2972('0x2c')](function(_0x6b27b3){if(_0x6b27b3['length']===0x1){return _0x33e570['id'];}else{var _0x26537e=_[_0x2972('0x83')](_[_0x2972('0x35')](_0x6b27b3,'TeamId'),function(_0x52e527){return _[_0x2972('0x84')](_0x2f5eb9,_0x52e527);});if(_0x26537e){return _0x33e570['id'];}}}));}}return BPromise[_0x2972('0x85')](_0x305ee6)[_0x2972('0x2c')](function(_0x3ce00d){_0x3d2749=_(_0x3d2749)[_0x2972('0x86')](_0x3ce00d)[_0x2972('0x87')]()[_0x2972('0x88')]();return db[_0x2972('0x48')]['find']({'where':{'id':_0x19f3a2['params']['id']}})['then'](function(_0x3267d4){return db['sequelize'][_0x2972('0x70')](function(_0x39ce02){return _0x3267d4[_0x2972('0x77')](_0x19f3a2[_0x2972('0x3b')][_0x2972('0x6a')],{'transaction':_0x39ce02})['then'](function(){if(!_['isEmpty'](_0x3d2749)){return _0x3267d4[_0x2972('0x89')](_0x3d2749,{'transaction':_0x39ce02});}})[_0x2972('0x2c')](function(){_0x3d2749[_0x2972('0x74')](function(_0x12822e){socket['emit'](_0x2972('0x8a'),{'UserId':_0x12822e,'WhatsappQueueId':_0x3267d4['id']});});});});});});})[_0x2972('0x2c')](respondWithStatusCode(_0x1883a5,null))[_0x2972('0x4c')](handleError(_0x1883a5,null));};exports['addAgents']=function(_0x474887,_0xad6522,_0xedf190){return db[_0x2972('0x48')]['find']({'where':{'id':_0x474887['params']['id']}})['then'](handleEntityNotFound(_0xad6522,null))[_0x2972('0x2c')](function(_0x501e75){if(_0x501e75){return _0x501e75[_0x2972('0x8b')](_0x474887['body'][_0x2972('0x6a')],_[_0x2972('0x8c')](_0x474887['body'],[_0x2972('0x6a'),'id'])||{})[_0x2972('0x8d')](function(_0x2b662e){for(var _0x577b6c=0x0;_0x577b6c<_0x474887[_0x2972('0x55')][_0x2972('0x6a')][_0x2972('0x3e')];_0x577b6c+=0x1){socket[_0x2972('0x75')](_0x2972('0x76'),{'UserId':Number(_0x474887['body'][_0x2972('0x6a')][_0x577b6c]),'WhatsappQueueId':Number(_0x474887['params']['id'])});}return _0x2b662e;});}})['then'](respondWithResult(_0xad6522,null))[_0x2972('0x4c')](handleError(_0xad6522,null));};exports[_0x2972('0x89')]=function(_0x2c0764,_0x37a25a,_0x5ca313){return db['WhatsappQueue'][_0x2972('0x4e')]({'where':{'id':_0x2c0764['params']['id']}})['then'](handleEntityNotFound(_0x37a25a,null))[_0x2972('0x2c')](function(_0x21ebd6){if(_0x21ebd6){return _0x21ebd6['removeAgents'](_0x2c0764['query']['ids'])[_0x2972('0x2c')](function(){if(_[_0x2972('0x8e')](_0x2c0764[_0x2972('0x3b')]['ids'])){for(var _0x3594f0=0x0;_0x3594f0<_0x2c0764[_0x2972('0x3b')]['ids'][_0x2972('0x3e')];_0x3594f0+=0x1){socket['emit'](_0x2972('0x8a'),{'UserId':Number(_0x2c0764[_0x2972('0x3b')][_0x2972('0x6a')][_0x3594f0]),'WhatsappQueueId':Number(_0x2c0764[_0x2972('0x56')]['id'])});}}else{socket['emit'](_0x2972('0x8a'),{'UserId':Number(_0x2c0764['query'][_0x2972('0x6a')]),'WhatsappQueueId':Number(_0x2c0764[_0x2972('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x37a25a,null))['catch'](handleError(_0x37a25a,null));};exports['getAgents']=function(_0x34167b,_0x2f23ac,_0x2733b8){var _0x57c722={};var _0x29c2ec={};var _0x4e1c21;var _0x1b941f;return db[_0x2972('0x48')][_0x2972('0x67')]({'where':{'id':_0x34167b['params']['id']}})[_0x2972('0x2c')](handleEntityNotFound(_0x2f23ac,null))['then'](function(_0x176a36){if(_0x176a36){_0x4e1c21=_0x176a36;_0x29c2ec[_0x2972('0x3a')]=_[_0x2972('0x38')](db[_0x2972('0x5d')][_0x2972('0x59')]);_0x29c2ec[_0x2972('0x3b')]=_[_0x2972('0x38')](_0x34167b[_0x2972('0x3b')]);_0x29c2ec[_0x2972('0x43')]=_[_0x2972('0x39')](_0x29c2ec[_0x2972('0x3a')],_0x29c2ec[_0x2972('0x3b')]);_0x57c722[_0x2972('0x3c')]=_[_0x2972('0x39')](_0x29c2ec[_0x2972('0x3a')],qs[_0x2972('0x3d')](_0x34167b['query'][_0x2972('0x3d')]));_0x57c722[_0x2972('0x3c')]=_0x57c722[_0x2972('0x3c')]['length']?_0x57c722[_0x2972('0x3c')]:_0x29c2ec[_0x2972('0x3a')];_0x57c722[_0x2972('0x40')]=qs[_0x2972('0x41')](_0x34167b[_0x2972('0x3b')]['sort']);_0x57c722[_0x2972('0x42')]=qs[_0x2972('0x43')](_[_0x2972('0x5b')](_0x34167b['query'],_0x29c2ec['filters']));if(_0x34167b[_0x2972('0x3b')][_0x2972('0x46')]){_0x57c722[_0x2972('0x42')]=_['merge'](_0x57c722[_0x2972('0x42')],{'$or':_[_0x2972('0x35')](_0x57c722[_0x2972('0x3c')],function(_0x10fb16){var _0x187b58={};_0x187b58[_0x10fb16]={'$like':'%'+_0x34167b[_0x2972('0x3b')][_0x2972('0x46')]+'%'};return _0x187b58;})});}_0x57c722=_[_0x2972('0x44')]({},_0x57c722,_0x34167b[_0x2972('0x47')]);return _0x4e1c21[_0x2972('0x8f')](_0x57c722);}})[_0x2972('0x2c')](function(_0x57ea5b){if(_0x57ea5b){_0x1b941f=_0x57ea5b[_0x2972('0x3e')];if(!_0x34167b[_0x2972('0x3b')][_0x2972('0x5a')](_0x2972('0x3f'))){_0x57c722['limit']=qs[_0x2972('0x24')](_0x34167b['query'][_0x2972('0x24')]);_0x57c722[_0x2972('0x22')]=qs[_0x2972('0x22')](_0x34167b[_0x2972('0x3b')]['offset']);}return _0x4e1c21['getAgents'](_0x57c722);}})['then'](function(_0x246e64){if(_0x246e64){return _0x246e64?{'count':_0x1b941f,'rows':_0x246e64}:null;}})[_0x2972('0x2c')](respondWithResult(_0x2f23ac,null))['catch'](handleError(_0x2f23ac,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ff98e9f..90d669d 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 _0xca23=['WhatsappQueue','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6fc3c7,_0x1ae0ae){var _0x257825=function(_0x18ec85){while(--_0x18ec85){_0x6fc3c7['push'](_0x6fc3c7['shift']());}};_0x257825(++_0x1ae0ae);}(_0xca23,0x1b7));var _0x3ca2=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xca23[_0xef8146];return _0x5a6cb0;};'use strict';var EventEmitter=require(_0x3ca2('0x0'));var WhatsappQueue=require(_0x3ca2('0x1'))['db'][_0x3ca2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ca2('0x3'),'afterUpdate':'update','afterDestroy':_0x3ca2('0x4')};function emitEvent(_0x59ba7a){return function(_0x7ea39d,_0x35df11,_0x46a1ad){WhatsappQueueEvents[_0x3ca2('0x5')](_0x59ba7a+':'+_0x7ea39d['id'],_0x7ea39d);WhatsappQueueEvents[_0x3ca2('0x5')](_0x59ba7a,_0x7ea39d);_0x46a1ad(null);};}for(var e in events){if(events[_0x3ca2('0x6')](e)){var event=events[e];WhatsappQueue[_0x3ca2('0x7')](e,emitEvent(event));}}module[_0x3ca2('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8baf=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove'];(function(_0x48a070,_0x3ff2bb){var _0x41be67=function(_0x300e39){while(--_0x300e39){_0x48a070['push'](_0x48a070['shift']());}};_0x41be67(++_0x3ff2bb);}(_0x8baf,0x199));var _0xf8ba=function(_0x3a8335,_0x3cc419){_0x3a8335=_0x3a8335-0x0;var _0x447aec=_0x8baf[_0x3a8335];return _0x447aec;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xf8ba('0x0'))['db'][_0xf8ba('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf8ba('0x2')](0x0);var events={'afterCreate':_0xf8ba('0x3'),'afterUpdate':'update','afterDestroy':_0xf8ba('0x4')};function emitEvent(_0x17d435){return function(_0x56e551,_0x38a27d,_0x52820a){WhatsappQueueEvents[_0xf8ba('0x5')](_0x17d435+':'+_0x56e551['id'],_0x56e551);WhatsappQueueEvents[_0xf8ba('0x5')](_0x17d435,_0x56e551);_0x52820a(null);};}for(var e in events){if(events[_0xf8ba('0x6')](e)){var event=events[e];WhatsappQueue[_0xf8ba('0x7')](e,emitEvent(event));}}module[_0xf8ba('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 02f1196..a4c8e3c 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 _0xfe75=['path','rimraf','../../config/environment','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe75,0x191));var _0x5fe7=function(_0x50d740,_0x31fd96){_0x50d740=_0x50d740-0x0;var _0x377003=_0xfe75[_0x50d740];return _0x377003;};'use strict';var _=require(_0x5fe7('0x0'));var util=require(_0x5fe7('0x1'));var logger=require(_0x5fe7('0x2'))(_0x5fe7('0x3'));var moment=require(_0x5fe7('0x4'));var BPromise=require(_0x5fe7('0x5'));var rp=require(_0x5fe7('0x6'));var fs=require('fs');var path=require(_0x5fe7('0x7'));var rimraf=require(_0x5fe7('0x8'));var config=require(_0x5fe7('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x49073d,_0x312af4){return _0x49073d['define'](_0x5fe7('0xa'),attributes,{'tableName':_0x5fe7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a15=['rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x6a15,0x117));var _0x56a1=function(_0x1515f3,_0x16854a){_0x1515f3=_0x1515f3-0x0;var _0x3c0e4a=_0x6a15[_0x1515f3];return _0x3c0e4a;};'use strict';var _=require(_0x56a1('0x0'));var util=require('util');var logger=require(_0x56a1('0x1'))(_0x56a1('0x2'));var moment=require(_0x56a1('0x3'));var BPromise=require(_0x56a1('0x4'));var rp=require(_0x56a1('0x5'));var fs=require('fs');var path=require(_0x56a1('0x6'));var rimraf=require(_0x56a1('0x7'));var config=require(_0x56a1('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x56a1('0x9')]=function(_0x47bc5d,_0x24c304){return _0x47bc5d[_0x56a1('0xa')](_0x56a1('0xb'),attributes,{'tableName':_0x56a1('0xc'),'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 7213b3b..edd3fe6 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 _0xbad4=['../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4805b1,_0x5f8ac7){var _0x33713d=function(_0x30d208){while(--_0x30d208){_0x4805b1['push'](_0x4805b1['shift']());}};_0x33713d(++_0x5f8ac7);}(_0xbad4,0xbd));var _0x4bad=function(_0x508897,_0x5f20c5){_0x508897=_0x508897-0x0;var _0x2f7cb9=_0xbad4[_0x508897];return _0x2f7cb9;};'use strict';var _=require(_0x4bad('0x0'));var util=require(_0x4bad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4bad('0x2'));var fs=require('fs');var Redis=require(_0x4bad('0x3'));var db=require(_0x4bad('0x4'))['db'];var utils=require(_0x4bad('0x5'));var logger=require(_0x4bad('0x6'))('rpc');var config=require(_0x4bad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4bad('0x8')][_0x4bad('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4bad('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bad('0xb'))(new Redis(config[_0x4bad('0xa')]));require(_0x4bad('0xc'))[_0x4bad('0xd')](socket);function respondWithRpcPromise(_0x5f3e61,_0x487ccc,_0x28df2a){return new BPromise(function(_0x3749e0,_0x1d70bc){return client[_0x4bad('0xe')](_0x5f3e61,_0x28df2a)['then'](function(_0x6d088){logger[_0x4bad('0xf')](_0x4bad('0x10'),_0x487ccc,_0x4bad('0x11'));logger[_0x4bad('0x12')](_0x4bad('0x13'),_0x487ccc,_0x4bad('0x11'),JSON[_0x4bad('0x14')](_0x6d088));if(_0x6d088[_0x4bad('0x15')]){if(_0x6d088['error'][_0x4bad('0x16')]===0x1f4){logger[_0x4bad('0x15')](_0x4bad('0x10'),_0x487ccc,_0x6d088[_0x4bad('0x15')]['message']);return _0x1d70bc(_0x6d088[_0x4bad('0x15')][_0x4bad('0x17')]);}logger[_0x4bad('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x487ccc,_0x6d088['error'][_0x4bad('0x17')]);return _0x3749e0(_0x6d088[_0x4bad('0x15')]['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x487ccc,_0x4bad('0x11'));_0x3749e0(_0x6d088['result'][_0x4bad('0x17')]);}})[_0x4bad('0x18')](function(_0x40043c){logger[_0x4bad('0x15')](_0x4bad('0x10'),_0x487ccc,_0x40043c);_0x1d70bc(_0x40043c);});});}exports['GetWhatsappQueue']=function(_0x438681){var _0xb81371=this;return new Promise(function(_0x523b6d,_0x154e95){return db[_0x4bad('0x19')][_0x4bad('0x1a')]({'raw':_0x438681[_0x4bad('0x1b')]?_0x438681['options'][_0x4bad('0x1c')]===undefined?!![]:![]:!![],'where':_0x438681[_0x4bad('0x1b')]?_0x438681[_0x4bad('0x1b')][_0x4bad('0x1d')]||null:null,'attributes':_0x438681[_0x4bad('0x1b')]?_0x438681[_0x4bad('0x1b')][_0x4bad('0x1e')]||null:null,'limit':_0x438681['options']?_0x438681['options'][_0x4bad('0x1f')]||null:null,'include':_0x438681['options']?_0x438681[_0x4bad('0x1b')][_0x4bad('0x20')]?_[_0x4bad('0x21')](_0x438681[_0x4bad('0x1b')]['include'],function(_0x966946){return{'model':db[_0x966946[_0x4bad('0x22')]],'as':_0x966946['as'],'attributes':_0x966946[_0x4bad('0x1e')],'include':_0x966946['include']?_[_0x4bad('0x21')](_0x966946[_0x4bad('0x20')],function(_0xe409ec){return{'model':db[_0xe409ec[_0x4bad('0x22')]],'as':_0xe409ec['as'],'attributes':_0xe409ec['attributes'],'include':_0xe409ec[_0x4bad('0x20')]?_[_0x4bad('0x21')](_0xe409ec[_0x4bad('0x20')],function(_0x3b53a4){return{'model':db[_0x3b53a4[_0x4bad('0x22')]],'as':_0x3b53a4['as'],'attributes':_0x3b53a4[_0x4bad('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bad('0x23')](function(_0x3100db){logger[_0x4bad('0xf')](_0x4bad('0x24'),_0x438681);logger[_0x4bad('0x12')](_0x4bad('0x24'),_0x438681,JSON[_0x4bad('0x14')](_0x3100db));_0x523b6d(_0x3100db);})[_0x4bad('0x18')](function(_0x1447bb){logger[_0x4bad('0x15')](_0x4bad('0x24'),_0x1447bb['message'],_0x438681);_0x154e95(_0xb81371[_0x4bad('0x15')](0x1f4,_0x1447bb['message']));});});};exports[_0x4bad('0x25')]=function(_0x1412bb){var _0x493bda=this;return new Promise(function(_0x454832,_0x580fa7){return db[_0x4bad('0x19')][_0x4bad('0x26')]({'raw':_0x1412bb[_0x4bad('0x1b')]?_0x1412bb[_0x4bad('0x1b')][_0x4bad('0x1c')]===undefined?!![]:![]:!![],'where':_0x1412bb['options']?_0x1412bb[_0x4bad('0x1b')][_0x4bad('0x1d')]||null:null,'attributes':_0x1412bb[_0x4bad('0x1b')]?_0x1412bb[_0x4bad('0x1b')][_0x4bad('0x1e')]||null:null,'include':_0x1412bb['options']?_0x1412bb[_0x4bad('0x1b')][_0x4bad('0x20')]?_['map'](_0x1412bb[_0x4bad('0x1b')]['include'],function(_0x5aacf9){return{'model':db[_0x5aacf9[_0x4bad('0x22')]],'as':_0x5aacf9['as'],'attributes':_0x5aacf9[_0x4bad('0x1e')],'include':_0x5aacf9['include']?_[_0x4bad('0x21')](_0x5aacf9[_0x4bad('0x20')],function(_0x5c91c6){return{'model':db[_0x5c91c6[_0x4bad('0x22')]],'as':_0x5c91c6['as'],'attributes':_0x5c91c6[_0x4bad('0x1e')],'include':_0x5c91c6['include']?_['map'](_0x5c91c6[_0x4bad('0x20')],function(_0x25fdfc){return{'model':db[_0x25fdfc[_0x4bad('0x22')]],'as':_0x25fdfc['as'],'attributes':_0x25fdfc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4bad('0x23')](function(_0x207ac4){logger[_0x4bad('0xf')]('ShowWhatsappQueue',_0x1412bb);logger[_0x4bad('0x12')](_0x4bad('0x25'),_0x1412bb,JSON[_0x4bad('0x14')](_0x207ac4));_0x454832(_0x207ac4);})[_0x4bad('0x18')](function(_0x45720c){logger[_0x4bad('0x15')](_0x4bad('0x25'),_0x45720c[_0x4bad('0x17')],_0x1412bb);_0x580fa7(_0x493bda[_0x4bad('0x15')](0x1f4,_0x45720c[_0x4bad('0x17')]));});});}; \ No newline at end of file +var _0xbc7b=['moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','model','map','ShowWhatsappQueue','find','catch','util'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbc7b,0xc2));var _0xbbc7=function(_0x3adab5,_0x1915a8){_0x3adab5=_0x3adab5-0x0;var _0xa1d147=_0xbc7b[_0x3adab5];return _0xa1d147;};'use strict';var _=require('lodash');var util=require(_0xbbc7('0x0'));var moment=require(_0xbbc7('0x1'));var BPromise=require(_0xbbc7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbc7('0x3'));var db=require(_0xbbc7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbbc7('0x5'));var config=require(_0xbbc7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbbc7('0x7')][_0xbbc7('0x8')]({'port':0x232a});config[_0xbbc7('0x9')]=_[_0xbbc7('0xa')](config[_0xbbc7('0x9')],{'host':_0xbbc7('0xb'),'port':0x18eb});var socket=require(_0xbbc7('0xc'))(new Redis(config[_0xbbc7('0x9')]));require(_0xbbc7('0xd'))[_0xbbc7('0xe')](socket);function respondWithRpcPromise(_0x3fe1cf,_0xb19a19,_0x35b12f){return new BPromise(function(_0x46228c,_0x30de67){return client[_0xbbc7('0xf')](_0x3fe1cf,_0x35b12f)[_0xbbc7('0x10')](function(_0x5f0b5b){logger[_0xbbc7('0x11')](_0xbbc7('0x12'),_0xb19a19,_0xbbc7('0x13'));logger[_0xbbc7('0x14')](_0xbbc7('0x15'),_0xb19a19,_0xbbc7('0x13'),JSON[_0xbbc7('0x16')](_0x5f0b5b));if(_0x5f0b5b[_0xbbc7('0x17')]){if(_0x5f0b5b['error'][_0xbbc7('0x18')]===0x1f4){logger[_0xbbc7('0x17')](_0xbbc7('0x12'),_0xb19a19,_0x5f0b5b[_0xbbc7('0x17')][_0xbbc7('0x19')]);return _0x30de67(_0x5f0b5b['error'][_0xbbc7('0x19')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0xb19a19,_0x5f0b5b[_0xbbc7('0x17')][_0xbbc7('0x19')]);return _0x46228c(_0x5f0b5b[_0xbbc7('0x17')]['message']);}else{logger['info'](_0xbbc7('0x12'),_0xb19a19,_0xbbc7('0x13'));_0x46228c(_0x5f0b5b[_0xbbc7('0x1a')][_0xbbc7('0x19')]);}})['catch'](function(_0x48de53){logger['error'](_0xbbc7('0x12'),_0xb19a19,_0x48de53);_0x30de67(_0x48de53);});});}exports[_0xbbc7('0x1b')]=function(_0x3b278c){var _0x44a406=this;return new Promise(function(_0x46c953,_0xf494c){return db[_0xbbc7('0x1c')]['findAll']({'raw':_0x3b278c[_0xbbc7('0x1d')]?_0x3b278c[_0xbbc7('0x1d')][_0xbbc7('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b278c[_0xbbc7('0x1d')]?_0x3b278c[_0xbbc7('0x1d')]['where']||null:null,'attributes':_0x3b278c[_0xbbc7('0x1d')]?_0x3b278c[_0xbbc7('0x1d')][_0xbbc7('0x1f')]||null:null,'limit':_0x3b278c[_0xbbc7('0x1d')]?_0x3b278c['options'][_0xbbc7('0x20')]||null:null,'include':_0x3b278c[_0xbbc7('0x1d')]?_0x3b278c[_0xbbc7('0x1d')]['include']?_['map'](_0x3b278c[_0xbbc7('0x1d')][_0xbbc7('0x21')],function(_0x573f6d){return{'model':db[_0x573f6d[_0xbbc7('0x22')]],'as':_0x573f6d['as'],'attributes':_0x573f6d[_0xbbc7('0x1f')],'include':_0x573f6d[_0xbbc7('0x21')]?_[_0xbbc7('0x23')](_0x573f6d[_0xbbc7('0x21')],function(_0x5b1c6e){return{'model':db[_0x5b1c6e['model']],'as':_0x5b1c6e['as'],'attributes':_0x5b1c6e['attributes'],'include':_0x5b1c6e[_0xbbc7('0x21')]?_[_0xbbc7('0x23')](_0x5b1c6e[_0xbbc7('0x21')],function(_0x531f16){return{'model':db[_0x531f16[_0xbbc7('0x22')]],'as':_0x531f16['as'],'attributes':_0x531f16[_0xbbc7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbbc7('0x10')](function(_0x3633de){logger[_0xbbc7('0x11')]('GetWhatsappQueue',_0x3b278c);logger[_0xbbc7('0x14')](_0xbbc7('0x1b'),_0x3b278c,JSON[_0xbbc7('0x16')](_0x3633de));_0x46c953(_0x3633de);})['catch'](function(_0x1f5bdb){logger[_0xbbc7('0x17')](_0xbbc7('0x1b'),_0x1f5bdb[_0xbbc7('0x19')],_0x3b278c);_0xf494c(_0x44a406[_0xbbc7('0x17')](0x1f4,_0x1f5bdb[_0xbbc7('0x19')]));});});};exports[_0xbbc7('0x24')]=function(_0x3902ed){var _0x4626a8=this;return new Promise(function(_0x4ce363,_0x40cbd7){return db[_0xbbc7('0x1c')][_0xbbc7('0x25')]({'raw':_0x3902ed[_0xbbc7('0x1d')]?_0x3902ed[_0xbbc7('0x1d')][_0xbbc7('0x1e')]===undefined?!![]:![]:!![],'where':_0x3902ed[_0xbbc7('0x1d')]?_0x3902ed[_0xbbc7('0x1d')]['where']||null:null,'attributes':_0x3902ed[_0xbbc7('0x1d')]?_0x3902ed[_0xbbc7('0x1d')]['attributes']||null:null,'include':_0x3902ed['options']?_0x3902ed['options'][_0xbbc7('0x21')]?_[_0xbbc7('0x23')](_0x3902ed['options'][_0xbbc7('0x21')],function(_0xdf1149){return{'model':db[_0xdf1149[_0xbbc7('0x22')]],'as':_0xdf1149['as'],'attributes':_0xdf1149[_0xbbc7('0x1f')],'include':_0xdf1149[_0xbbc7('0x21')]?_['map'](_0xdf1149[_0xbbc7('0x21')],function(_0x47019f){return{'model':db[_0x47019f[_0xbbc7('0x22')]],'as':_0x47019f['as'],'attributes':_0x47019f['attributes'],'include':_0x47019f['include']?_[_0xbbc7('0x23')](_0x47019f['include'],function(_0x5de2bf){return{'model':db[_0x5de2bf[_0xbbc7('0x22')]],'as':_0x5de2bf['as'],'attributes':_0x5de2bf[_0xbbc7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbbc7('0x10')](function(_0x57f94b){logger[_0xbbc7('0x11')](_0xbbc7('0x24'),_0x3902ed);logger[_0xbbc7('0x14')]('ShowWhatsappQueue',_0x3902ed,JSON[_0xbbc7('0x16')](_0x57f94b));_0x4ce363(_0x57f94b);})[_0xbbc7('0x26')](function(_0x526704){logger[_0xbbc7('0x17')](_0xbbc7('0x24'),_0x526704['message'],_0x3902ed);_0x40cbd7(_0x4626a8['error'](0x1f4,_0x526704[_0xbbc7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9d50611..c0b247c 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 _0x16d7=['removeListener','length','./whatsappQueue.events','save','update','emit'];(function(_0x3c6a2c,_0x4ae220){var _0x32ebe5=function(_0x231622){while(--_0x231622){_0x3c6a2c['push'](_0x3c6a2c['shift']());}};_0x32ebe5(++_0x4ae220);}(_0x16d7,0x146));var _0x716d=function(_0x9280,_0x29240e){_0x9280=_0x9280-0x0;var _0x41bce4=_0x16d7[_0x9280];return _0x41bce4;};'use strict';var WhatsappQueueEvents=require(_0x716d('0x0'));var events=[_0x716d('0x1'),'remove',_0x716d('0x2')];function createListener(_0x3fbe9e,_0xb0d0a8){return function(_0x39cc01){_0xb0d0a8[_0x716d('0x3')](_0x3fbe9e,_0x39cc01);};}function removeListener(_0x349dbb,_0x53d856){return function(){WhatsappQueueEvents[_0x716d('0x4')](_0x349dbb,_0x53d856);};}exports['register']=function(_0x1918cd){for(var _0x4e7828=0x0,_0x335992=events[_0x716d('0x5')];_0x4e7828<_0x335992;_0x4e7828++){var _0x5954dc=events[_0x4e7828];var _0x286538=createListener('whatsappQueue:'+_0x5954dc,_0x1918cd);WhatsappQueueEvents['on'](_0x5954dc,_0x286538);}}; \ No newline at end of file +var _0x0404=['register','whatsappQueue:','save','remove','update'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0x0404,0x1b0));var _0x4040=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x0404[_0x42245d];return _0x4b211a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x4040('0x0'),_0x4040('0x1'),_0x4040('0x2')];function createListener(_0x5e31d1,_0x4c8e19){return function(_0x22bd5f){_0x4c8e19['emit'](_0x5e31d1,_0x22bd5f);};}function removeListener(_0x59f061,_0x51bf7c){return function(){WhatsappQueueEvents['removeListener'](_0x59f061,_0x51bf7c);};}exports[_0x4040('0x3')]=function(_0x5dd65c){for(var _0x39fce2=0x0,_0x4c751a=events['length'];_0x39fce2<_0x4c751a;_0x39fce2++){var _0x47e905=events[_0x39fce2];var _0x62195=createListener(_0x4040('0x4')+_0x47e905,_0x5dd65c);WhatsappQueueEvents['on'](_0x47e905,_0x62195);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index db0c194..68b96f2 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 _0x64b0=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x64b0,0xd4));var _0x064b=function(_0x2d8dd1,_0x3ab91d){_0x2d8dd1=_0x2d8dd1-0x0;var _0x2466b2=_0x64b0[_0x2d8dd1];return _0x2466b2;};'use strict';var multer=require(_0x064b('0x0'));var util=require(_0x064b('0x1'));var path=require(_0x064b('0x2'));var timeout=require(_0x064b('0x3'));var express=require(_0x064b('0x4'));var router=express[_0x064b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x064b('0x6'));var interaction=require(_0x064b('0x7'));var config=require(_0x064b('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x064b('0x9')]('/',auth[_0x064b('0xa')](),controller[_0x064b('0xb')]);router[_0x064b('0x9')](_0x064b('0xc'),auth[_0x064b('0xa')](),controller[_0x064b('0xd')]);router[_0x064b('0x9')](_0x064b('0xe'),auth['isAuthenticated'](),controller[_0x064b('0xf')]);router[_0x064b('0x10')]('/',auth[_0x064b('0xa')](),controller['create']);router[_0x064b('0x11')](_0x064b('0xe'),auth[_0x064b('0xa')](),controller['update']);router[_0x064b('0x12')](_0x064b('0xe'),auth[_0x064b('0xa')](),controller[_0x064b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xaf39=['show','create','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0xc6ea98,_0x1f0fe7){var _0x154999=function(_0x5c0555){while(--_0x5c0555){_0xc6ea98['push'](_0xc6ea98['shift']());}};_0x154999(++_0x1f0fe7);}(_0xaf39,0xde));var _0x9af3=function(_0x1c29b3,_0x442dd4){_0x1c29b3=_0x1c29b3-0x0;var _0x6485da=_0xaf39[_0x1c29b3];return _0x6485da;};'use strict';var multer=require(_0x9af3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9af3('0x1'));var express=require('express');var router=express[_0x9af3('0x2')]();var fs_extra=require(_0x9af3('0x3'));var auth=require(_0x9af3('0x4'));var interaction=require(_0x9af3('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x9af3('0x6')](),controller[_0x9af3('0x7')]);router[_0x9af3('0x8')](_0x9af3('0x9'),auth[_0x9af3('0x6')](),controller[_0x9af3('0xa')]);router[_0x9af3('0x8')](_0x9af3('0xb'),auth[_0x9af3('0x6')](),controller[_0x9af3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9af3('0xd')]);router['put'](_0x9af3('0xb'),auth['isAuthenticated'](),controller[_0x9af3('0xe')]);router[_0x9af3('0xf')](_0x9af3('0xb'),auth[_0x9af3('0x6')](),controller[_0x9af3('0x10')]);module[_0x9af3('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3a1fd0a..3e9edb6 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(_0x5c9d79,_0x48852b){var _0x22f5ea=function(_0x38a680){while(--_0x38a680){_0x5c9d79['push'](_0x5c9d79['shift']());}};_0x22f5ea(++_0x48852b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x116cd0,_0x25ea01){var _0x3c545e=function(_0x2fc7b3){while(--_0x2fc7b3){_0x116cd0['push'](_0x116cd0['shift']());}};_0x3c545e(++_0x25ea01);}(_0x7a54,0x106));var _0x47a5=function(_0x2df7f4,_0x15ce0b){_0x2df7f4=_0x2df7f4-0x0;var _0x3003de=_0x7a54[_0x2df7f4];return _0x3003de;};'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 10888ac..6f58609 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 _0x7334=['create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','WhatsappQueueReport','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7334,0x184));var _0x4733=function(_0xe3affa,_0x47dd45){_0xe3affa=_0xe3affa-0x0;var _0x8cf18=_0x7334[_0xe3affa];return _0x8cf18;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];function respondWithStatusCode(_0x461f74,_0x100ecd){_0x100ecd=_0x100ecd||0xcc;return function(_0x1c146c){if(_0x1c146c){return _0x461f74[_0x4733('0x1a')](_0x100ecd);}return _0x461f74['status'](_0x100ecd)[_0x4733('0x1b')]();};}function respondWithResult(_0x543caf,_0x4327f3){_0x4327f3=_0x4327f3||0xc8;return function(_0x1a22e4){if(_0x1a22e4){return _0x543caf[_0x4733('0x1c')](_0x4327f3)[_0x4733('0x1d')](_0x1a22e4);}};}function respondWithFilteredResult(_0x3813df,_0x167016){return function(_0x12f111){if(_0x12f111){var _0x9fff=typeof _0x167016[_0x4733('0x1e')]==='undefined'&&typeof _0x167016[_0x4733('0x1f')]===_0x4733('0x20');var _0x47b129=_0x12f111[_0x4733('0x21')];var _0x1d2fb6=_0x9fff?0x0:_0x167016[_0x4733('0x1e')];var _0x384e0c=_0x9fff?_0x12f111['count']:_0x167016['offset']+_0x167016[_0x4733('0x1f')];var _0x3b730a;if(_0x384e0c>=_0x47b129){_0x384e0c=_0x47b129;_0x3b730a=0xc8;}else{_0x3b730a=0xce;}_0x3813df['status'](_0x3b730a);return _0x3813df[_0x4733('0x22')](_0x4733('0x23'),_0x1d2fb6+'-'+_0x384e0c+'/'+_0x47b129)[_0x4733('0x1d')](_0x12f111);}return null;};}function patchUpdates(_0x7a4e0){return function(_0x493cd3){try{jsonpatch[_0x4733('0x24')](_0x493cd3,_0x7a4e0,!![]);}catch(_0xb45e1){return BPromise['reject'](_0xb45e1);}return _0x493cd3[_0x4733('0x25')]();};}function saveUpdates(_0x18da47,_0x478e34){return function(_0x15a291){if(_0x15a291){return _0x15a291[_0x4733('0x26')](_0x18da47)[_0x4733('0x27')](function(_0x1a0643){return _0x1a0643;});}return null;};}function removeEntity(_0x3a2542,_0x24db74){return function(_0x180049){if(_0x180049){return _0x180049[_0x4733('0x28')]()['then'](function(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x7884e5,_0x2cb247){return function(_0x30ee9b){if(!_0x30ee9b){_0x7884e5[_0x4733('0x1a')](0x194);}return _0x30ee9b;};}function handleError(_0x24fc0d,_0xc3ab0a){_0xc3ab0a=_0xc3ab0a||0x1f4;return function(_0x13bc12){logger[_0x4733('0x29')](_0x13bc12['stack']);if(_0x13bc12[_0x4733('0x2a')]){delete _0x13bc12['name'];}_0x24fc0d['status'](_0xc3ab0a)[_0x4733('0x2b')](_0x13bc12);};}exports['index']=function(_0xcde4f4,_0x479989){var _0x4abc0d={},_0x517c73={},_0x2976b0={'count':0x0,'rows':[]};var _0x3bfe53=_[_0x4733('0x2c')](db[_0x4733('0x2d')]['rawAttributes'],function(_0x538a7c){return{'name':_0x538a7c['fieldName'],'type':_0x538a7c[_0x4733('0x2e')]['key']};});_0x517c73['model']=_[_0x4733('0x2c')](_0x3bfe53,_0x4733('0x2a'));_0x517c73[_0x4733('0x2f')]=_['keys'](_0xcde4f4['query']);_0x517c73[_0x4733('0x30')]=_[_0x4733('0x31')](_0x517c73[_0x4733('0x32')],_0x517c73[_0x4733('0x2f')]);_0x4abc0d[_0x4733('0x33')]=_['intersection'](_0x517c73[_0x4733('0x32')],qs[_0x4733('0x34')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x34')]));_0x4abc0d[_0x4733('0x33')]=_0x4abc0d['attributes']['length']?_0x4abc0d[_0x4733('0x33')]:_0x517c73[_0x4733('0x32')];if(!_0xcde4f4[_0x4733('0x2f')][_0x4733('0x35')](_0x4733('0x36'))){_0x4abc0d['limit']=qs[_0x4733('0x1f')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x1f')]);_0x4abc0d['offset']=qs[_0x4733('0x1e')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x1e')]);}_0x4abc0d[_0x4733('0x37')]=qs[_0x4733('0x38')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x38')]);_0x4abc0d[_0x4733('0x39')]=qs['filters'](_[_0x4733('0x3a')](_0xcde4f4['query'],_0x517c73[_0x4733('0x30')]),_0x3bfe53);if(_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3b')]){_0x4abc0d[_0x4733('0x39')]=_[_0x4733('0x3c')](_0x4abc0d[_0x4733('0x39')],{'$or':_[_0x4733('0x2c')](_0x3bfe53,function(_0x15ab49){if(_0x15ab49['type']!==_0x4733('0x3d')){var _0x68d682={};_0x68d682[_0x15ab49['name']]={'$like':'%'+_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3b')]+'%'};return _0x68d682;}})});}_0x4abc0d=_['merge']({},_0x4abc0d,_0xcde4f4[_0x4733('0x3e')]);var _0x50849a={'where':_0x4abc0d[_0x4733('0x39')]};return db['WhatsappQueueReport'][_0x4733('0x21')](_0x50849a)[_0x4733('0x27')](function(_0x5d4b95){_0x2976b0['count']=_0x5d4b95;if(_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3f')]){_0x4abc0d['include']=[{'all':!![]}];}return db[_0x4733('0x2d')][_0x4733('0x40')](_0x4abc0d);})[_0x4733('0x27')](function(_0x28ed14){_0x2976b0[_0x4733('0x41')]=_0x28ed14;return _0x2976b0;})[_0x4733('0x27')](respondWithFilteredResult(_0x479989,_0x4abc0d))[_0x4733('0x42')](handleError(_0x479989,null));};exports[_0x4733('0x43')]=function(_0x1f04dd,_0x42e055){var _0x444471={'raw':!![],'where':{'id':_0x1f04dd[_0x4733('0x44')]['id']}},_0x1d32df={};_0x1d32df[_0x4733('0x32')]=_[_0x4733('0x45')](db[_0x4733('0x2d')][_0x4733('0x46')]);_0x1d32df[_0x4733('0x2f')]=_['keys'](_0x1f04dd[_0x4733('0x2f')]);_0x1d32df[_0x4733('0x30')]=_[_0x4733('0x31')](_0x1d32df[_0x4733('0x32')],_0x1d32df[_0x4733('0x2f')]);_0x444471[_0x4733('0x33')]=_[_0x4733('0x31')](_0x1d32df[_0x4733('0x32')],qs[_0x4733('0x34')](_0x1f04dd[_0x4733('0x2f')][_0x4733('0x34')]));_0x444471[_0x4733('0x33')]=_0x444471[_0x4733('0x33')][_0x4733('0x47')]?_0x444471['attributes']:_0x1d32df['model'];if(_0x1f04dd[_0x4733('0x2f')][_0x4733('0x3f')]){_0x444471[_0x4733('0x48')]=[{'all':!![]}];}_0x444471=_[_0x4733('0x3c')]({},_0x444471,_0x1f04dd[_0x4733('0x3e')]);return db[_0x4733('0x2d')][_0x4733('0x49')](_0x444471)[_0x4733('0x27')](handleEntityNotFound(_0x42e055,null))[_0x4733('0x27')](respondWithResult(_0x42e055,null))[_0x4733('0x42')](handleError(_0x42e055,null));};exports['create']=function(_0x4c5f4e,_0x51e201){return db['WhatsappQueueReport'][_0x4733('0x4a')](_0x4c5f4e[_0x4733('0x4b')],{})[_0x4733('0x27')](respondWithResult(_0x51e201,0xc9))[_0x4733('0x42')](handleError(_0x51e201,null));};exports[_0x4733('0x26')]=function(_0x45b9cf,_0x1c6abf){if(_0x45b9cf[_0x4733('0x4b')]['id']){delete _0x45b9cf[_0x4733('0x4b')]['id'];}return db[_0x4733('0x2d')]['find']({'where':{'id':_0x45b9cf['params']['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x1c6abf,null))['then'](saveUpdates(_0x45b9cf[_0x4733('0x4b')],null))[_0x4733('0x27')](respondWithResult(_0x1c6abf,null))[_0x4733('0x42')](handleError(_0x1c6abf,null));};exports['destroy']=function(_0x3f2a78,_0x45c9ad){return db[_0x4733('0x2d')][_0x4733('0x49')]({'where':{'id':_0x3f2a78[_0x4733('0x44')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x45c9ad,null))[_0x4733('0x27')](removeEntity(_0x45c9ad,null))[_0x4733('0x42')](handleError(_0x45c9ad,null));};exports[_0x4733('0x4c')]=function(_0x5af8c7,_0x31fb69){return db[_0x4733('0x2d')][_0x4733('0x4c')]()['then'](respondWithResult(_0x31fb69,null))[_0x4733('0x42')](handleError(_0x31fb69,null));}; \ No newline at end of file +var _0x0102=['filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','then','findAll','rows','catch','params','rawAttributes','intersection','include','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys'];(function(_0x5214d9,_0x14bc7e){var _0x31e283=function(_0x2fd220){while(--_0x2fd220){_0x5214d9['push'](_0x5214d9['shift']());}};_0x31e283(++_0x14bc7e);}(_0x0102,0x186));var _0x2010=function(_0xd06496,_0x258cc4){_0xd06496=_0xd06496-0x0;var _0x1b23da=_0x0102[_0xd06496];return _0x1b23da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x52b4fe,_0x99ebe0){return function(_0x4cff59){if(!_0x4cff59){_0x52b4fe[_0x2010('0x23')](0x194);}return _0x4cff59;};}function handleError(_0x27b425,_0x3929d9){_0x3929d9=_0x3929d9||0x1f4;return function(_0x3dcea4){logger[_0x2010('0x24')](_0x3dcea4[_0x2010('0x25')]);if(_0x3dcea4[_0x2010('0x26')]){delete _0x3dcea4[_0x2010('0x26')];}_0x27b425[_0x2010('0x19')](_0x3929d9)[_0x2010('0x27')](_0x3dcea4);};}exports[_0x2010('0x28')]=function(_0x2ebdbb,_0x499cbe){var _0x2a4691={},_0x52fe5e={},_0x5b52fb={'count':0x0,'rows':[]};var _0x147a5a=_[_0x2010('0x29')](db[_0x2010('0x2a')]['rawAttributes'],function(_0x554f66){return{'name':_0x554f66[_0x2010('0x2b')],'type':_0x554f66['type'][_0x2010('0x2c')]};});_0x52fe5e[_0x2010('0x2d')]=_['map'](_0x147a5a,_0x2010('0x26'));_0x52fe5e[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x2ebdbb[_0x2010('0x2e')]);_0x52fe5e[_0x2010('0x30')]=_['intersection'](_0x52fe5e[_0x2010('0x2d')],_0x52fe5e[_0x2010('0x2e')]);_0x2a4691[_0x2010('0x31')]=_['intersection'](_0x52fe5e['model'],qs[_0x2010('0x32')](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x32')]));_0x2a4691['attributes']=_0x2a4691['attributes'][_0x2010('0x33')]?_0x2a4691[_0x2010('0x31')]:_0x52fe5e[_0x2010('0x2d')];if(!_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x34')]('nolimit')){_0x2a4691['limit']=qs['limit'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1d')]);_0x2a4691[_0x2010('0x1b')]=qs['offset'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1b')]);}_0x2a4691[_0x2010('0x35')]=qs[_0x2010('0x36')](_0x2ebdbb['query'][_0x2010('0x36')]);_0x2a4691[_0x2010('0x37')]=qs[_0x2010('0x30')](_['pick'](_0x2ebdbb[_0x2010('0x2e')],_0x52fe5e['filters']),_0x147a5a);if(_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]){_0x2a4691[_0x2010('0x37')]=_[_0x2010('0x39')](_0x2a4691[_0x2010('0x37')],{'$or':_[_0x2010('0x29')](_0x147a5a,function(_0x53c09e){if(_0x53c09e[_0x2010('0x3a')]!=='VIRTUAL'){var _0x3e5422={};_0x3e5422[_0x53c09e[_0x2010('0x26')]]={'$like':'%'+_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]+'%'};return _0x3e5422;}})});}_0x2a4691=_[_0x2010('0x39')]({},_0x2a4691,_0x2ebdbb[_0x2010('0x3b')]);var _0x398f10={'where':_0x2a4691[_0x2010('0x37')]};return db[_0x2010('0x2a')][_0x2010('0x1e')](_0x398f10)[_0x2010('0x3c')](function(_0x2f37ca){_0x5b52fb[_0x2010('0x1e')]=_0x2f37ca;if(_0x2ebdbb[_0x2010('0x2e')]['includeAll']){_0x2a4691['include']=[{'all':!![]}];}return db[_0x2010('0x2a')][_0x2010('0x3d')](_0x2a4691);})[_0x2010('0x3c')](function(_0x35d631){_0x5b52fb[_0x2010('0x3e')]=_0x35d631;return _0x5b52fb;})[_0x2010('0x3c')](respondWithFilteredResult(_0x499cbe,_0x2a4691))[_0x2010('0x3f')](handleError(_0x499cbe,null));};exports['show']=function(_0x392576,_0x578645){var _0x27fd64={'raw':!![],'where':{'id':_0x392576[_0x2010('0x40')]['id']}},_0x3ff496={};_0x3ff496[_0x2010('0x2d')]=_[_0x2010('0x2f')](db['WhatsappQueueReport'][_0x2010('0x41')]);_0x3ff496[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x392576[_0x2010('0x2e')]);_0x3ff496['filters']=_[_0x2010('0x42')](_0x3ff496['model'],_0x3ff496['query']);_0x27fd64['attributes']=_[_0x2010('0x42')](_0x3ff496[_0x2010('0x2d')],qs[_0x2010('0x32')](_0x392576[_0x2010('0x2e')][_0x2010('0x32')]));_0x27fd64[_0x2010('0x31')]=_0x27fd64['attributes'][_0x2010('0x33')]?_0x27fd64[_0x2010('0x31')]:_0x3ff496[_0x2010('0x2d')];if(_0x392576['query']['includeAll']){_0x27fd64[_0x2010('0x43')]=[{'all':!![]}];}_0x27fd64=_['merge']({},_0x27fd64,_0x392576[_0x2010('0x3b')]);return db[_0x2010('0x2a')][_0x2010('0x44')](_0x27fd64)[_0x2010('0x3c')](handleEntityNotFound(_0x578645,null))['then'](respondWithResult(_0x578645,null))[_0x2010('0x3f')](handleError(_0x578645,null));};exports[_0x2010('0x45')]=function(_0x2e2703,_0x231db7){return db[_0x2010('0x2a')][_0x2010('0x45')](_0x2e2703['body'],{})[_0x2010('0x3c')](respondWithResult(_0x231db7,0xc9))[_0x2010('0x3f')](handleError(_0x231db7,null));};exports[_0x2010('0x46')]=function(_0x4dc0cf,_0x30e5d0){if(_0x4dc0cf[_0x2010('0x47')]['id']){delete _0x4dc0cf['body']['id'];}return db[_0x2010('0x2a')][_0x2010('0x44')]({'where':{'id':_0x4dc0cf[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0x30e5d0,null))[_0x2010('0x3c')](saveUpdates(_0x4dc0cf[_0x2010('0x47')],null))[_0x2010('0x3c')](respondWithResult(_0x30e5d0,null))[_0x2010('0x3f')](handleError(_0x30e5d0,null));};exports['destroy']=function(_0x5258b9,_0xc9f070){return db[_0x2010('0x2a')]['find']({'where':{'id':_0x5258b9[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0xc9f070,null))[_0x2010('0x3c')](removeEntity(_0xc9f070,null))[_0x2010('0x3f')](handleError(_0xc9f070,null));};exports[_0x2010('0x48')]=function(_0x506943,_0x5f4e98){return db[_0x2010('0x2a')][_0x2010('0x48')]()[_0x2010('0x3c')](respondWithResult(_0x5f4e98,null))[_0x2010('0x3f')](handleError(_0x5f4e98,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 93734e3..a383162 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 _0x2ec3=['../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x275e2f,_0xd0e663){var _0x333c8b=function(_0x43a456){while(--_0x43a456){_0x275e2f['push'](_0x275e2f['shift']());}};_0x333c8b(++_0xd0e663);}(_0x2ec3,0x68));var _0x32ec=function(_0x52b250,_0x209ce4){_0x52b250=_0x52b250-0x0;var _0x5cf1dc=_0x2ec3[_0x52b250];return _0x5cf1dc;};'use strict';var _=require(_0x32ec('0x0'));var util=require(_0x32ec('0x1'));var logger=require(_0x32ec('0x2'))(_0x32ec('0x3'));var moment=require('moment');var BPromise=require(_0x32ec('0x4'));var rp=require(_0x32ec('0x5'));var fs=require('fs');var path=require(_0x32ec('0x6'));var rimraf=require(_0x32ec('0x7'));var config=require(_0x32ec('0x8'));var attributes=require(_0x32ec('0x9'));module[_0x32ec('0xa')]=function(_0x57cfcb,_0x85c52d){return _0x57cfcb[_0x32ec('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x32ec('0xc'),'paranoid':![],'indexes':[{'name':_0x32ec('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f06=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x4b7dd6,_0x88d993){var _0x251c1e=function(_0x331127){while(--_0x331127){_0x4b7dd6['push'](_0x4b7dd6['shift']());}};_0x251c1e(++_0x88d993);}(_0x4f06,0x15b));var _0x64f0=function(_0x4013cd,_0x3f6059){_0x4013cd=_0x4013cd-0x0;var _0x270da9=_0x4f06[_0x4013cd];return _0x270da9;};'use strict';var _=require(_0x64f0('0x0'));var util=require('util');var logger=require(_0x64f0('0x1'))(_0x64f0('0x2'));var moment=require(_0x64f0('0x3'));var BPromise=require(_0x64f0('0x4'));var rp=require(_0x64f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64f0('0x6'));var config=require(_0x64f0('0x7'));var attributes=require(_0x64f0('0x8'));module[_0x64f0('0x9')]=function(_0x231df3,_0x2e239d){return _0x231df3['define'](_0x64f0('0xa'),attributes,{'tableName':_0x64f0('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x64f0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9834fff..2a14734 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 _0xadb4=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0xadb4,0x1b6));var _0x4adb=function(_0x4ced5f,_0x26e776){_0x4ced5f=_0x4ced5f-0x0;var _0x140888=_0xadb4[_0x4ced5f];return _0x140888;};'use strict';var _=require(_0x4adb('0x0'));var util=require(_0x4adb('0x1'));var moment=require('moment');var BPromise=require(_0x4adb('0x2'));var rs=require(_0x4adb('0x3'));var fs=require('fs');var Redis=require(_0x4adb('0x4'));var db=require(_0x4adb('0x5'))['db'];var utils=require(_0x4adb('0x6'));var logger=require('../../config/logger')(_0x4adb('0x7'));var config=require(_0x4adb('0x8'));var jayson=require(_0x4adb('0x9'));var client=jayson[_0x4adb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c07e,_0x15c33e,_0x30c0b7){return new BPromise(function(_0x26ea0d,_0x440b6f){return client[_0x4adb('0xb')](_0x14c07e,_0x30c0b7)['then'](function(_0x2f247a){logger[_0x4adb('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x15c33e,'request\x20sent');logger[_0x4adb('0xd')](_0x4adb('0xe'),_0x15c33e,_0x4adb('0xf'),JSON[_0x4adb('0x10')](_0x2f247a));if(_0x2f247a[_0x4adb('0x11')]){if(_0x2f247a['error'][_0x4adb('0x12')]===0x1f4){logger[_0x4adb('0x11')](_0x4adb('0x13'),_0x15c33e,_0x2f247a[_0x4adb('0x11')]['message']);return _0x440b6f(_0x2f247a[_0x4adb('0x11')][_0x4adb('0x14')]);}logger[_0x4adb('0x11')](_0x4adb('0x13'),_0x15c33e,_0x2f247a['error'][_0x4adb('0x14')]);return _0x26ea0d(_0x2f247a[_0x4adb('0x11')][_0x4adb('0x14')]);}else{logger[_0x4adb('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x15c33e,_0x4adb('0xf'));_0x26ea0d(_0x2f247a['result'][_0x4adb('0x14')]);}})[_0x4adb('0x15')](function(_0x46d875){logger[_0x4adb('0x11')](_0x4adb('0x13'),_0x15c33e,_0x46d875);_0x440b6f(_0x46d875);});});}exports[_0x4adb('0x16')]=function(_0x5749b8){var _0x5301bc=this;return new Promise(function(_0x5cde52,_0x590530){return db['WhatsappQueueReport'][_0x4adb('0x17')](_0x5749b8[_0x4adb('0x18')],{'raw':_0x5749b8['options']?_0x5749b8[_0x4adb('0x19')][_0x4adb('0x1a')]===undefined?!![]:![]:!![]})[_0x4adb('0x1b')](function(_0x1a61d3){logger['info'](_0x4adb('0x16'),_0x5749b8);logger[_0x4adb('0xd')](_0x4adb('0x16'),_0x5749b8,JSON['stringify'](_0x1a61d3));_0x5cde52(_0x1a61d3);})[_0x4adb('0x15')](function(_0x50f699){logger[_0x4adb('0x11')](_0x4adb('0x16'),_0x50f699['message'],_0x5749b8);_0x590530(_0x5301bc[_0x4adb('0x11')](0x1f4,_0x50f699[_0x4adb('0x14')]));});});};exports[_0x4adb('0x1c')]=function(_0x76d342){var _0x35a1c4=this;return new Promise(function(_0x3a1b5d,_0x1552c5){return db[_0x4adb('0x1d')][_0x4adb('0x1e')](_0x76d342[_0x4adb('0x18')],{'raw':_0x76d342[_0x4adb('0x19')]?_0x76d342[_0x4adb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x76d342[_0x4adb('0x19')]?_0x76d342['options'][_0x4adb('0x1f')]||null:null,'attributes':_0x76d342['options']?_0x76d342[_0x4adb('0x19')][_0x4adb('0x20')]||null:null,'limit':_0x76d342[_0x4adb('0x19')]?_0x76d342[_0x4adb('0x19')][_0x4adb('0x21')]||null:null})['then'](function(_0x45447e){logger[_0x4adb('0xc')](_0x4adb('0x1c'),_0x76d342);logger[_0x4adb('0xd')](_0x4adb('0x1c'),_0x76d342,JSON[_0x4adb('0x10')](_0x45447e));_0x3a1b5d(_0x45447e);})[_0x4adb('0x15')](function(_0x4f55e2){logger[_0x4adb('0x11')](_0x4adb('0x1c'),_0x4f55e2[_0x4adb('0x14')],_0x76d342);_0x1552c5(_0x35a1c4[_0x4adb('0x11')](0x1f4,_0x4f55e2[_0x4adb('0x14')]));});});}; \ No newline at end of file +var _0xaba8=['jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','body','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaba8,0x110));var _0x8aba=function(_0x11d513,_0x28c7fe){_0x11d513=_0x11d513-0x0;var _0x417529=_0xaba8[_0x11d513];return _0x417529;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8aba('0x0'));var BPromise=require(_0x8aba('0x1'));var rs=require(_0x8aba('0x2'));var fs=require('fs');var Redis=require(_0x8aba('0x3'));var db=require(_0x8aba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8aba('0x5'))('rpc');var config=require(_0x8aba('0x6'));var jayson=require(_0x8aba('0x7'));var client=jayson['client'][_0x8aba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10c254,_0x1e84c8,_0x4848d9){return new BPromise(function(_0x17af31,_0x3758aa){return client[_0x8aba('0x9')](_0x10c254,_0x4848d9)[_0x8aba('0xa')](function(_0x4d27c8){logger[_0x8aba('0xb')](_0x8aba('0xc'),_0x1e84c8,_0x8aba('0xd'));logger[_0x8aba('0xe')](_0x8aba('0xf'),_0x1e84c8,_0x8aba('0xd'),JSON[_0x8aba('0x10')](_0x4d27c8));if(_0x4d27c8[_0x8aba('0x11')]){if(_0x4d27c8['error']['code']===0x1f4){logger[_0x8aba('0x11')](_0x8aba('0xc'),_0x1e84c8,_0x4d27c8[_0x8aba('0x11')]['message']);return _0x3758aa(_0x4d27c8[_0x8aba('0x11')]['message']);}logger['error'](_0x8aba('0xc'),_0x1e84c8,_0x4d27c8[_0x8aba('0x11')][_0x8aba('0x12')]);return _0x17af31(_0x4d27c8[_0x8aba('0x11')][_0x8aba('0x12')]);}else{logger[_0x8aba('0xb')](_0x8aba('0xc'),_0x1e84c8,_0x8aba('0xd'));_0x17af31(_0x4d27c8[_0x8aba('0x13')]['message']);}})[_0x8aba('0x14')](function(_0x258828){logger[_0x8aba('0x11')](_0x8aba('0xc'),_0x1e84c8,_0x258828);_0x3758aa(_0x258828);});});}exports['CreateWhatsappQueueReport']=function(_0xa47450){var _0xd26efb=this;return new Promise(function(_0x30113b,_0x25c64d){return db['WhatsappQueueReport'][_0x8aba('0x15')](_0xa47450['body'],{'raw':_0xa47450[_0x8aba('0x16')]?_0xa47450[_0x8aba('0x16')][_0x8aba('0x17')]===undefined?!![]:![]:!![]})[_0x8aba('0xa')](function(_0x1dd55d){logger['info'](_0x8aba('0x18'),_0xa47450);logger[_0x8aba('0xe')](_0x8aba('0x18'),_0xa47450,JSON[_0x8aba('0x10')](_0x1dd55d));_0x30113b(_0x1dd55d);})[_0x8aba('0x14')](function(_0x583f06){logger['error']('CreateWhatsappQueueReport',_0x583f06[_0x8aba('0x12')],_0xa47450);_0x25c64d(_0xd26efb[_0x8aba('0x11')](0x1f4,_0x583f06['message']));});});};exports[_0x8aba('0x19')]=function(_0x3f0931){var _0xf801af=this;return new Promise(function(_0x2a3f3d,_0x559183){return db['WhatsappQueueReport'][_0x8aba('0x1a')](_0x3f0931[_0x8aba('0x1b')],{'raw':_0x3f0931[_0x8aba('0x16')]?_0x3f0931[_0x8aba('0x16')][_0x8aba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f0931[_0x8aba('0x16')]?_0x3f0931['options'][_0x8aba('0x1c')]||null:null,'attributes':_0x3f0931[_0x8aba('0x16')]?_0x3f0931[_0x8aba('0x16')][_0x8aba('0x1d')]||null:null,'limit':_0x3f0931['options']?_0x3f0931[_0x8aba('0x16')][_0x8aba('0x1e')]||null:null})[_0x8aba('0xa')](function(_0x210fc0){logger[_0x8aba('0xb')](_0x8aba('0x19'),_0x3f0931);logger[_0x8aba('0xe')](_0x8aba('0x19'),_0x3f0931,JSON[_0x8aba('0x10')](_0x210fc0));_0x2a3f3d(_0x210fc0);})[_0x8aba('0x14')](function(_0x45c4ed){logger[_0x8aba('0x11')]('UpdateWhatsappQueueReport',_0x45c4ed[_0x8aba('0x12')],_0x3f0931);_0x559183(_0xf801af[_0x8aba('0x11')](0x1f4,_0x45c4ed['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0e375ab..59c1bc3 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 _0x98ff=['isAuthenticated','index','describe','post','create','/:id','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller'];(function(_0x5bc57d,_0x581c4b){var _0x591147=function(_0x4895ce){while(--_0x4895ce){_0x5bc57d['push'](_0x5bc57d['shift']());}};_0x591147(++_0x581c4b);}(_0x98ff,0xf8));var _0xf98f=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x98ff[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0xf98f('0x0'));var util=require(_0xf98f('0x1'));var path=require(_0xf98f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf98f('0x3')]();var fs_extra=require(_0xf98f('0x4'));var auth=require(_0xf98f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf98f('0x6'));router['get']('/',auth[_0xf98f('0x7')](),controller[_0xf98f('0x8')]);router['get']('/describe',auth[_0xf98f('0x7')](),controller[_0xf98f('0x9')]);router['get']('/:id',auth[_0xf98f('0x7')](),controller['show']);router[_0xf98f('0xa')]('/',auth[_0xf98f('0x7')](),controller[_0xf98f('0xb')]);router['put'](_0xf98f('0xc'),auth[_0xf98f('0x7')](),controller['update']);router[_0xf98f('0xd')]('/:id',auth[_0xf98f('0x7')](),controller[_0xf98f('0xe')]);module['exports']=router; \ No newline at end of file +var _0xffc2=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','update','destroy','exports'];(function(_0x47f031,_0x135ac7){var _0xb61d95=function(_0x854fba){while(--_0x854fba){_0x47f031['push'](_0x47f031['shift']());}};_0xb61d95(++_0x135ac7);}(_0xffc2,0x8c));var _0x2ffc=function(_0xbb02a6,_0x2b3f2c){_0xbb02a6=_0xbb02a6-0x0;var _0x4d7739=_0xffc2[_0xbb02a6];return _0x4d7739;};'use strict';var multer=require(_0x2ffc('0x0'));var util=require(_0x2ffc('0x1'));var path=require(_0x2ffc('0x2'));var timeout=require(_0x2ffc('0x3'));var express=require(_0x2ffc('0x4'));var router=express[_0x2ffc('0x5')]();var fs_extra=require(_0x2ffc('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2ffc('0x7'));var controller=require(_0x2ffc('0x8'));router[_0x2ffc('0x9')]('/',auth['isAuthenticated'](),controller[_0x2ffc('0xa')]);router['get'](_0x2ffc('0xb'),auth[_0x2ffc('0xc')](),controller[_0x2ffc('0xd')]);router[_0x2ffc('0x9')](_0x2ffc('0xe'),auth[_0x2ffc('0xc')](),controller[_0x2ffc('0xf')]);router['post']('/',auth[_0x2ffc('0xc')](),controller[_0x2ffc('0x10')]);router['put'](_0x2ffc('0xe'),auth[_0x2ffc('0xc')](),controller[_0x2ffc('0x11')]);router['delete'](_0x2ffc('0xe'),auth[_0x2ffc('0xc')](),controller[_0x2ffc('0x12')]);module[_0x2ffc('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index dbf82e3..417e83a 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 _0x97e7=['account','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97e7,0x1a1));var _0x797e=function(_0x318ee8,_0x2dd3b2){_0x318ee8=_0x318ee8-0x0;var _0x15ace7=_0x97e7[_0x318ee8];return _0x15ace7;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'uniqueid':{'type':Sequelize[_0x797e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x797e('0x3'),_0x797e('0x4'),_0x797e('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x797e('0x6')]}}; \ No newline at end of file +var _0xfb5d=['ENUM','agent','sequelize','exports','STRING'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb5d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xdfb5('0x0'));module[_0xdfb5('0x1')]={'uniqueid':{'type':Sequelize[_0xdfb5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdfb5('0x3')]('account',_0xdfb5('0x4'),'queue'),'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 461639c..215979e 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 _0x1a08=['findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','filter','merge','where','VIRTUAL','options','includeAll','include'];(function(_0x2aa47b,_0x2d19f0){var _0x4b05d5=function(_0xe6e71){while(--_0xe6e71){_0x2aa47b['push'](_0x2aa47b['shift']());}};_0x4b05d5(++_0x2d19f0);}(_0x1a08,0x15d));var _0x81a0=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x1a08[_0x32b993];return _0x482780;};'use strict';var emlformat=require(_0x81a0('0x0'));var rimraf=require(_0x81a0('0x1'));var zipdir=require(_0x81a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x81a0('0x3'));var Mustache=require(_0x81a0('0x4'));var util=require(_0x81a0('0x5'));var path=require(_0x81a0('0x6'));var sox=require('sox');var csv=require(_0x81a0('0x7'));var ejs=require(_0x81a0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81a0('0x9'));var squel=require(_0x81a0('0xa'));var crypto=require('crypto');var jsforce=require(_0x81a0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x81a0('0x7'));var querystring=require('querystring');var Papa=require(_0x81a0('0xc'));var Redis=require(_0x81a0('0xd'));var authService=require(_0x81a0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x81a0('0xf'));var hardwareService=require(_0x81a0('0x10'));var logger=require(_0x81a0('0x11'))(_0x81a0('0x12'));var utils=require('../../config/utils');var config=require(_0x81a0('0x13'));var licenseUtil=require(_0x81a0('0x14'));var db=require(_0x81a0('0x15'))['db'];function respondWithStatusCode(_0x5e3308,_0x18885c){_0x18885c=_0x18885c||0xcc;return function(_0x1bcda0){if(_0x1bcda0){return _0x5e3308[_0x81a0('0x16')](_0x18885c);}return _0x5e3308[_0x81a0('0x17')](_0x18885c)[_0x81a0('0x18')]();};}function respondWithResult(_0x5bda64,_0x5462d4){_0x5462d4=_0x5462d4||0xc8;return function(_0xa67654){if(_0xa67654){return _0x5bda64[_0x81a0('0x17')](_0x5462d4)['json'](_0xa67654);}};}function respondWithFilteredResult(_0x3f6c72,_0x416b87){return function(_0x1d273b){if(_0x1d273b){var _0x448348=typeof _0x416b87[_0x81a0('0x19')]==='undefined'&&typeof _0x416b87['limit']==='undefined';var _0x959251=_0x1d273b[_0x81a0('0x1a')];var _0x2b4ce3=_0x448348?0x0:_0x416b87[_0x81a0('0x19')];var _0x246697=_0x448348?_0x1d273b[_0x81a0('0x1a')]:_0x416b87[_0x81a0('0x19')]+_0x416b87[_0x81a0('0x1b')];var _0x2214eb;if(_0x246697>=_0x959251){_0x246697=_0x959251;_0x2214eb=0xc8;}else{_0x2214eb=0xce;}_0x3f6c72[_0x81a0('0x17')](_0x2214eb);return _0x3f6c72[_0x81a0('0x1c')](_0x81a0('0x1d'),_0x2b4ce3+'-'+_0x246697+'/'+_0x959251)['json'](_0x1d273b);}return null;};}function patchUpdates(_0x3b45ee){return function(_0x553535){try{jsonpatch[_0x81a0('0x1e')](_0x553535,_0x3b45ee,!![]);}catch(_0x21f4ff){return BPromise['reject'](_0x21f4ff);}return _0x553535['save']();};}function saveUpdates(_0xf57892,_0x441ac5){return function(_0x4fda27){if(_0x4fda27){return _0x4fda27[_0x81a0('0x1f')](_0xf57892)[_0x81a0('0x20')](function(_0xc0ff20){return _0xc0ff20;});}return null;};}function removeEntity(_0x331038,_0x49d103){return function(_0x7a2b1){if(_0x7a2b1){return _0x7a2b1[_0x81a0('0x21')]()['then'](function(){_0x331038[_0x81a0('0x17')](0xcc)[_0x81a0('0x18')]();});}};}function handleEntityNotFound(_0x18b5eb,_0x214fe4){return function(_0x27e24f){if(!_0x27e24f){_0x18b5eb['sendStatus'](0x194);}return _0x27e24f;};}function handleError(_0x53da82,_0x3e659e){_0x3e659e=_0x3e659e||0x1f4;return function(_0x40419d){logger[_0x81a0('0x22')](_0x40419d[_0x81a0('0x23')]);if(_0x40419d[_0x81a0('0x24')]){delete _0x40419d['name'];}_0x53da82[_0x81a0('0x17')](_0x3e659e)[_0x81a0('0x25')](_0x40419d);};}exports[_0x81a0('0x26')]=function(_0x37ffbd,_0x4da342){var _0x195581={},_0x54e1dd={},_0x7d0d26={'count':0x0,'rows':[]};var _0x478336=_[_0x81a0('0x27')](db[_0x81a0('0x28')]['rawAttributes'],function(_0x33d222){return{'name':_0x33d222[_0x81a0('0x29')],'type':_0x33d222[_0x81a0('0x2a')][_0x81a0('0x2b')]};});_0x54e1dd[_0x81a0('0x2c')]=_['map'](_0x478336,'name');_0x54e1dd[_0x81a0('0x2d')]=_[_0x81a0('0x2e')](_0x37ffbd['query']);_0x54e1dd[_0x81a0('0x2f')]=_[_0x81a0('0x30')](_0x54e1dd['model'],_0x54e1dd['query']);_0x195581[_0x81a0('0x31')]=_[_0x81a0('0x30')](_0x54e1dd['model'],qs[_0x81a0('0x32')](_0x37ffbd[_0x81a0('0x2d')][_0x81a0('0x32')]));_0x195581[_0x81a0('0x31')]=_0x195581[_0x81a0('0x31')]['length']?_0x195581['attributes']:_0x54e1dd[_0x81a0('0x2c')];if(!_0x37ffbd[_0x81a0('0x2d')][_0x81a0('0x33')]('nolimit')){_0x195581[_0x81a0('0x1b')]=qs[_0x81a0('0x1b')](_0x37ffbd['query']['limit']);_0x195581[_0x81a0('0x19')]=qs['offset'](_0x37ffbd[_0x81a0('0x2d')][_0x81a0('0x19')]);}_0x195581['order']=qs['sort'](_0x37ffbd[_0x81a0('0x2d')]['sort']);_0x195581['where']=qs[_0x81a0('0x2f')](_['pick'](_0x37ffbd[_0x81a0('0x2d')],_0x54e1dd['filters']),_0x478336);if(_0x37ffbd['query'][_0x81a0('0x34')]){_0x195581['where']=_[_0x81a0('0x35')](_0x195581[_0x81a0('0x36')],{'$or':_[_0x81a0('0x27')](_0x478336,function(_0x414ea7){if(_0x414ea7[_0x81a0('0x2a')]!==_0x81a0('0x37')){var _0x4396f5={};_0x4396f5[_0x414ea7['name']]={'$like':'%'+_0x37ffbd[_0x81a0('0x2d')]['filter']+'%'};return _0x4396f5;}})});}_0x195581=_['merge']({},_0x195581,_0x37ffbd[_0x81a0('0x38')]);var _0x4a9214={'where':_0x195581[_0x81a0('0x36')]};return db[_0x81a0('0x28')][_0x81a0('0x1a')](_0x4a9214)[_0x81a0('0x20')](function(_0x3974b5){_0x7d0d26['count']=_0x3974b5;if(_0x37ffbd[_0x81a0('0x2d')][_0x81a0('0x39')]){_0x195581[_0x81a0('0x3a')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x81a0('0x3b')](_0x195581);})['then'](function(_0x203d22){_0x7d0d26[_0x81a0('0x3c')]=_0x203d22;return _0x7d0d26;})[_0x81a0('0x20')](respondWithFilteredResult(_0x4da342,_0x195581))[_0x81a0('0x3d')](handleError(_0x4da342,null));};exports['show']=function(_0x3b26d1,_0x565d3f){var _0x19d79c={'raw':!![],'where':{'id':_0x3b26d1[_0x81a0('0x3e')]['id']}},_0x2d760d={};_0x2d760d[_0x81a0('0x2c')]=_[_0x81a0('0x2e')](db['WhatsappTransferReport'][_0x81a0('0x3f')]);_0x2d760d['query']=_[_0x81a0('0x2e')](_0x3b26d1[_0x81a0('0x2d')]);_0x2d760d[_0x81a0('0x2f')]=_[_0x81a0('0x30')](_0x2d760d['model'],_0x2d760d[_0x81a0('0x2d')]);_0x19d79c[_0x81a0('0x31')]=_[_0x81a0('0x30')](_0x2d760d[_0x81a0('0x2c')],qs[_0x81a0('0x32')](_0x3b26d1['query'][_0x81a0('0x32')]));_0x19d79c['attributes']=_0x19d79c[_0x81a0('0x31')][_0x81a0('0x40')]?_0x19d79c[_0x81a0('0x31')]:_0x2d760d[_0x81a0('0x2c')];if(_0x3b26d1[_0x81a0('0x2d')][_0x81a0('0x39')]){_0x19d79c['include']=[{'all':!![]}];}_0x19d79c=_[_0x81a0('0x35')]({},_0x19d79c,_0x3b26d1[_0x81a0('0x38')]);return db[_0x81a0('0x28')][_0x81a0('0x41')](_0x19d79c)['then'](handleEntityNotFound(_0x565d3f,null))[_0x81a0('0x20')](respondWithResult(_0x565d3f,null))['catch'](handleError(_0x565d3f,null));};exports[_0x81a0('0x42')]=function(_0x14e306,_0x4b23fb){return db['WhatsappTransferReport'][_0x81a0('0x42')](_0x14e306[_0x81a0('0x43')],{})[_0x81a0('0x20')](respondWithResult(_0x4b23fb,0xc9))[_0x81a0('0x3d')](handleError(_0x4b23fb,null));};exports[_0x81a0('0x1f')]=function(_0xc9024b,_0x18db69){if(_0xc9024b[_0x81a0('0x43')]['id']){delete _0xc9024b[_0x81a0('0x43')]['id'];}return db[_0x81a0('0x28')][_0x81a0('0x41')]({'where':{'id':_0xc9024b[_0x81a0('0x3e')]['id']}})[_0x81a0('0x20')](handleEntityNotFound(_0x18db69,null))[_0x81a0('0x20')](saveUpdates(_0xc9024b[_0x81a0('0x43')],null))['then'](respondWithResult(_0x18db69,null))[_0x81a0('0x3d')](handleError(_0x18db69,null));};exports[_0x81a0('0x21')]=function(_0x45fbe7,_0x5b7cac){return db[_0x81a0('0x28')][_0x81a0('0x41')]({'where':{'id':_0x45fbe7[_0x81a0('0x3e')]['id']}})[_0x81a0('0x20')](handleEntityNotFound(_0x5b7cac,null))[_0x81a0('0x20')](removeEntity(_0x5b7cac,null))[_0x81a0('0x3d')](handleError(_0x5b7cac,null));};exports['describe']=function(_0x564630,_0x356c53){return db[_0x81a0('0x28')]['describe']()['then'](respondWithResult(_0x356c53,null))[_0x81a0('0x3d')](handleError(_0x356c53,null));}; \ No newline at end of file +var _0xc376=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','stack','name','index','map','WhatsappTransferReport','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','then','include','findAll','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1b8b81,_0xb30fc5){var _0x4a84ca=function(_0xb5b0d2){while(--_0xb5b0d2){_0x1b8b81['push'](_0x1b8b81['shift']());}};_0x4a84ca(++_0xb30fc5);}(_0xc376,0x14b));var _0x6c37=function(_0x1c3386,_0x2868c0){_0x1c3386=_0x1c3386-0x0;var _0x2cc8e9=_0xc376[_0x1c3386];return _0x2cc8e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6c37('0x1'));var moment=require(_0x6c37('0x2'));var BPromise=require(_0x6c37('0x3'));var Mustache=require(_0x6c37('0x4'));var util=require('util');var path=require(_0x6c37('0x5'));var sox=require('sox');var csv=require(_0x6c37('0x6'));var ejs=require(_0x6c37('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c37('0x8'));var squel=require(_0x6c37('0x9'));var crypto=require(_0x6c37('0xa'));var jsforce=require(_0x6c37('0xb'));var deskjs=require(_0x6c37('0xc'));var toCsv=require(_0x6c37('0x6'));var querystring=require('querystring');var Papa=require(_0x6c37('0xd'));var Redis=require(_0x6c37('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c37('0xf'));var as=require(_0x6c37('0x10'));var hardwareService=require(_0x6c37('0x11'));var logger=require(_0x6c37('0x12'))('api');var utils=require(_0x6c37('0x13'));var config=require(_0x6c37('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c37('0x15'))['db'];function respondWithStatusCode(_0x57cf82,_0x19f5f1){_0x19f5f1=_0x19f5f1||0xcc;return function(_0x5f08e8){if(_0x5f08e8){return _0x57cf82[_0x6c37('0x16')](_0x19f5f1);}return _0x57cf82[_0x6c37('0x17')](_0x19f5f1)[_0x6c37('0x18')]();};}function respondWithResult(_0x3ea729,_0x2fbc70){_0x2fbc70=_0x2fbc70||0xc8;return function(_0x53c49f){if(_0x53c49f){return _0x3ea729['status'](_0x2fbc70)[_0x6c37('0x19')](_0x53c49f);}};}function respondWithFilteredResult(_0x3a50e8,_0x3e0a85){return function(_0xb8d878){if(_0xb8d878){var _0x48ce9b=typeof _0x3e0a85[_0x6c37('0x1a')]==='undefined'&&typeof _0x3e0a85[_0x6c37('0x1b')]===_0x6c37('0x1c');var _0x57a320=_0xb8d878[_0x6c37('0x1d')];var _0xb7902e=_0x48ce9b?0x0:_0x3e0a85['offset'];var _0x5d04fe=_0x48ce9b?_0xb8d878[_0x6c37('0x1d')]:_0x3e0a85[_0x6c37('0x1a')]+_0x3e0a85[_0x6c37('0x1b')];var _0x22db26;if(_0x5d04fe>=_0x57a320){_0x5d04fe=_0x57a320;_0x22db26=0xc8;}else{_0x22db26=0xce;}_0x3a50e8[_0x6c37('0x17')](_0x22db26);return _0x3a50e8[_0x6c37('0x1e')](_0x6c37('0x1f'),_0xb7902e+'-'+_0x5d04fe+'/'+_0x57a320)[_0x6c37('0x19')](_0xb8d878);}return null;};}function patchUpdates(_0x1136ad){return function(_0x2f7442){try{jsonpatch[_0x6c37('0x20')](_0x2f7442,_0x1136ad,!![]);}catch(_0x4b4da8){return BPromise[_0x6c37('0x21')](_0x4b4da8);}return _0x2f7442['save']();};}function saveUpdates(_0xe42076,_0x27de04){return function(_0x200ce2){if(_0x200ce2){return _0x200ce2['update'](_0xe42076)['then'](function(_0x2765cb){return _0x2765cb;});}return null;};}function removeEntity(_0x5a7cd6,_0x4aea30){return function(_0x28087c){if(_0x28087c){return _0x28087c[_0x6c37('0x22')]()['then'](function(){_0x5a7cd6[_0x6c37('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2651,_0x51a0bf){return function(_0x4e915b){if(!_0x4e915b){_0x2a2651['sendStatus'](0x194);}return _0x4e915b;};}function handleError(_0x2340e3,_0x573b97){_0x573b97=_0x573b97||0x1f4;return function(_0x2138a9){logger['error'](_0x2138a9[_0x6c37('0x23')]);if(_0x2138a9[_0x6c37('0x24')]){delete _0x2138a9[_0x6c37('0x24')];}_0x2340e3['status'](_0x573b97)['send'](_0x2138a9);};}exports[_0x6c37('0x25')]=function(_0x4b3d1d,_0xe5a652){var _0x5e0a5d={},_0xf3d00a={},_0x320c64={'count':0x0,'rows':[]};var _0x45e34c=_[_0x6c37('0x26')](db[_0x6c37('0x27')]['rawAttributes'],function(_0x3fc153){return{'name':_0x3fc153['fieldName'],'type':_0x3fc153['type'][_0x6c37('0x28')]};});_0xf3d00a[_0x6c37('0x29')]=_[_0x6c37('0x26')](_0x45e34c,_0x6c37('0x24'));_0xf3d00a['query']=_[_0x6c37('0x2a')](_0x4b3d1d[_0x6c37('0x2b')]);_0xf3d00a['filters']=_[_0x6c37('0x2c')](_0xf3d00a[_0x6c37('0x29')],_0xf3d00a[_0x6c37('0x2b')]);_0x5e0a5d['attributes']=_[_0x6c37('0x2c')](_0xf3d00a[_0x6c37('0x29')],qs['fields'](_0x4b3d1d[_0x6c37('0x2b')][_0x6c37('0x2d')]));_0x5e0a5d[_0x6c37('0x2e')]=_0x5e0a5d[_0x6c37('0x2e')]['length']?_0x5e0a5d[_0x6c37('0x2e')]:_0xf3d00a['model'];if(!_0x4b3d1d[_0x6c37('0x2b')][_0x6c37('0x2f')](_0x6c37('0x30'))){_0x5e0a5d[_0x6c37('0x1b')]=qs[_0x6c37('0x1b')](_0x4b3d1d[_0x6c37('0x2b')][_0x6c37('0x1b')]);_0x5e0a5d[_0x6c37('0x1a')]=qs[_0x6c37('0x1a')](_0x4b3d1d[_0x6c37('0x2b')][_0x6c37('0x1a')]);}_0x5e0a5d[_0x6c37('0x31')]=qs['sort'](_0x4b3d1d[_0x6c37('0x2b')][_0x6c37('0x32')]);_0x5e0a5d['where']=qs['filters'](_[_0x6c37('0x33')](_0x4b3d1d[_0x6c37('0x2b')],_0xf3d00a['filters']),_0x45e34c);if(_0x4b3d1d['query'][_0x6c37('0x34')]){_0x5e0a5d['where']=_['merge'](_0x5e0a5d[_0x6c37('0x35')],{'$or':_[_0x6c37('0x26')](_0x45e34c,function(_0x1336b2){if(_0x1336b2[_0x6c37('0x36')]!==_0x6c37('0x37')){var _0x50fef5={};_0x50fef5[_0x1336b2[_0x6c37('0x24')]]={'$like':'%'+_0x4b3d1d['query'][_0x6c37('0x34')]+'%'};return _0x50fef5;}})});}_0x5e0a5d=_[_0x6c37('0x38')]({},_0x5e0a5d,_0x4b3d1d['options']);var _0x5497d5={'where':_0x5e0a5d[_0x6c37('0x35')]};return db['WhatsappTransferReport'][_0x6c37('0x1d')](_0x5497d5)[_0x6c37('0x39')](function(_0x2e2909){_0x320c64[_0x6c37('0x1d')]=_0x2e2909;if(_0x4b3d1d[_0x6c37('0x2b')]['includeAll']){_0x5e0a5d[_0x6c37('0x3a')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x6c37('0x3b')](_0x5e0a5d);})[_0x6c37('0x39')](function(_0x3919de){_0x320c64['rows']=_0x3919de;return _0x320c64;})['then'](respondWithFilteredResult(_0xe5a652,_0x5e0a5d))[_0x6c37('0x3c')](handleError(_0xe5a652,null));};exports[_0x6c37('0x3d')]=function(_0x3c3805,_0x3a846f){var _0xc8d246={'raw':!![],'where':{'id':_0x3c3805[_0x6c37('0x3e')]['id']}},_0x15270d={};_0x15270d[_0x6c37('0x29')]=_[_0x6c37('0x2a')](db[_0x6c37('0x27')][_0x6c37('0x3f')]);_0x15270d[_0x6c37('0x2b')]=_['keys'](_0x3c3805[_0x6c37('0x2b')]);_0x15270d['filters']=_[_0x6c37('0x2c')](_0x15270d[_0x6c37('0x29')],_0x15270d['query']);_0xc8d246['attributes']=_[_0x6c37('0x2c')](_0x15270d[_0x6c37('0x29')],qs[_0x6c37('0x2d')](_0x3c3805[_0x6c37('0x2b')][_0x6c37('0x2d')]));_0xc8d246[_0x6c37('0x2e')]=_0xc8d246['attributes'][_0x6c37('0x40')]?_0xc8d246[_0x6c37('0x2e')]:_0x15270d['model'];if(_0x3c3805['query'][_0x6c37('0x41')]){_0xc8d246[_0x6c37('0x3a')]=[{'all':!![]}];}_0xc8d246=_[_0x6c37('0x38')]({},_0xc8d246,_0x3c3805[_0x6c37('0x42')]);return db[_0x6c37('0x27')][_0x6c37('0x43')](_0xc8d246)[_0x6c37('0x39')](handleEntityNotFound(_0x3a846f,null))['then'](respondWithResult(_0x3a846f,null))[_0x6c37('0x3c')](handleError(_0x3a846f,null));};exports[_0x6c37('0x44')]=function(_0xc72a9a,_0x58a5cb){return db[_0x6c37('0x27')][_0x6c37('0x44')](_0xc72a9a[_0x6c37('0x45')],{})['then'](respondWithResult(_0x58a5cb,0xc9))[_0x6c37('0x3c')](handleError(_0x58a5cb,null));};exports['update']=function(_0x3d401a,_0x555e03){if(_0x3d401a[_0x6c37('0x45')]['id']){delete _0x3d401a[_0x6c37('0x45')]['id'];}return db[_0x6c37('0x27')][_0x6c37('0x43')]({'where':{'id':_0x3d401a[_0x6c37('0x3e')]['id']}})[_0x6c37('0x39')](handleEntityNotFound(_0x555e03,null))[_0x6c37('0x39')](saveUpdates(_0x3d401a[_0x6c37('0x45')],null))[_0x6c37('0x39')](respondWithResult(_0x555e03,null))[_0x6c37('0x3c')](handleError(_0x555e03,null));};exports[_0x6c37('0x22')]=function(_0x595e3b,_0x307fac){return db[_0x6c37('0x27')][_0x6c37('0x43')]({'where':{'id':_0x595e3b[_0x6c37('0x3e')]['id']}})[_0x6c37('0x39')](handleEntityNotFound(_0x307fac,null))[_0x6c37('0x39')](removeEntity(_0x307fac,null))[_0x6c37('0x3c')](handleError(_0x307fac,null));};exports[_0x6c37('0x46')]=function(_0x2f52b8,_0x16fcd8){return db[_0x6c37('0x27')][_0x6c37('0x46')]()['then'](respondWithResult(_0x16fcd8,null))[_0x6c37('0x3c')](handleError(_0x16fcd8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e424a8a..aeec6e5 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 _0x2213=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','path','rimraf'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x2213,0x13b));var _0x3221=function(_0x4a27e2,_0x53f601){_0x4a27e2=_0x4a27e2-0x0;var _0x2c13b0=_0x2213[_0x4a27e2];return _0x2c13b0;};'use strict';var _=require(_0x3221('0x0'));var util=require(_0x3221('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3221('0x2'));var rimraf=require(_0x3221('0x3'));var config=require(_0x3221('0x4'));var attributes=require(_0x3221('0x5'));module[_0x3221('0x6')]=function(_0x4d7de7,_0x5d0b6f){return _0x4d7de7[_0x3221('0x7')](_0x3221('0x8'),attributes,{'tableName':_0x3221('0x9'),'paranoid':![],'indexes':[{'name':_0x3221('0xa'),'fields':[_0x3221('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf0a=['api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x1ad7f7,_0x79ad4e){var _0x2508fe=function(_0x13d713){while(--_0x13d713){_0x1ad7f7['push'](_0x1ad7f7['shift']());}};_0x2508fe(++_0x79ad4e);}(_0xdf0a,0x107));var _0xadf0=function(_0x469ca4,_0x5d47f0){_0x469ca4=_0x469ca4-0x0;var _0x332c47=_0xdf0a[_0x469ca4];return _0x332c47;};'use strict';var _=require(_0xadf0('0x0'));var util=require(_0xadf0('0x1'));var logger=require(_0xadf0('0x2'))(_0xadf0('0x3'));var moment=require('moment');var BPromise=require(_0xadf0('0x4'));var rp=require(_0xadf0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadf0('0x6'));var config=require(_0xadf0('0x7'));var attributes=require(_0xadf0('0x8'));module[_0xadf0('0x9')]=function(_0x307923,_0x5f3faa){return _0x307923[_0xadf0('0xa')](_0xadf0('0xb'),attributes,{'tableName':_0xadf0('0xc'),'paranoid':![],'indexes':[{'name':_0xadf0('0xd'),'fields':[_0xadf0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 83d1a7b..320bfb8 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 _0xdae6=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d51d5,_0x1abe05){var _0x2477da=function(_0x2f6647){while(--_0x2f6647){_0x5d51d5['push'](_0x5d51d5['shift']());}};_0x2477da(++_0x1abe05);}(_0xdae6,0x15b));var _0x6dae=function(_0x27a029,_0x588925){_0x27a029=_0x27a029-0x0;var _0x2f0c9c=_0xdae6[_0x27a029];return _0x2f0c9c;};'use strict';var _=require(_0x6dae('0x0'));var util=require(_0x6dae('0x1'));var moment=require('moment');var BPromise=require(_0x6dae('0x2'));var rs=require(_0x6dae('0x3'));var fs=require('fs');var Redis=require(_0x6dae('0x4'));var db=require(_0x6dae('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6dae('0x6'));var config=require(_0x6dae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6dae('0x8')][_0x6dae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x704971,_0x5f5c21,_0x82e1c){return new BPromise(function(_0xda422d,_0x3bd490){return client[_0x6dae('0xa')](_0x704971,_0x82e1c)[_0x6dae('0xb')](function(_0x9fef12){logger[_0x6dae('0xc')](_0x6dae('0xd'),_0x5f5c21,_0x6dae('0xe'));logger[_0x6dae('0xf')](_0x6dae('0x10'),_0x5f5c21,'request\x20sent',JSON[_0x6dae('0x11')](_0x9fef12));if(_0x9fef12[_0x6dae('0x12')]){if(_0x9fef12[_0x6dae('0x12')][_0x6dae('0x13')]===0x1f4){logger['error'](_0x6dae('0xd'),_0x5f5c21,_0x9fef12['error']['message']);return _0x3bd490(_0x9fef12[_0x6dae('0x12')]['message']);}logger[_0x6dae('0x12')](_0x6dae('0xd'),_0x5f5c21,_0x9fef12[_0x6dae('0x12')]['message']);return _0xda422d(_0x9fef12[_0x6dae('0x12')][_0x6dae('0x14')]);}else{logger[_0x6dae('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5f5c21,_0x6dae('0xe'));_0xda422d(_0x9fef12[_0x6dae('0x15')][_0x6dae('0x14')]);}})[_0x6dae('0x16')](function(_0x3dd604){logger['error'](_0x6dae('0xd'),_0x5f5c21,_0x3dd604);_0x3bd490(_0x3dd604);});});} \ No newline at end of file +var _0x2ccb=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x109dbd,_0x290d2b){var _0x395644=function(_0x5a8c2d){while(--_0x5a8c2d){_0x109dbd['push'](_0x109dbd['shift']());}};_0x395644(++_0x290d2b);}(_0x2ccb,0x1a5));var _0xb2cc=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2ccb[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xb2cc('0x0'));var util=require(_0xb2cc('0x1'));var moment=require('moment');var BPromise=require(_0xb2cc('0x2'));var rs=require(_0xb2cc('0x3'));var fs=require('fs');var Redis=require(_0xb2cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb2cc('0x5'));var jayson=require(_0xb2cc('0x6'));var client=jayson[_0xb2cc('0x7')][_0xb2cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x451841,_0x307205,_0x7d1cff){return new BPromise(function(_0x289723,_0x46dd16){return client['request'](_0x451841,_0x7d1cff)[_0xb2cc('0x9')](function(_0x4a1fd3){logger['info'](_0xb2cc('0xa'),_0x307205,_0xb2cc('0xb'));logger['debug'](_0xb2cc('0xc'),_0x307205,_0xb2cc('0xb'),JSON['stringify'](_0x4a1fd3));if(_0x4a1fd3[_0xb2cc('0xd')]){if(_0x4a1fd3[_0xb2cc('0xd')][_0xb2cc('0xe')]===0x1f4){logger[_0xb2cc('0xd')](_0xb2cc('0xa'),_0x307205,_0x4a1fd3[_0xb2cc('0xd')][_0xb2cc('0xf')]);return _0x46dd16(_0x4a1fd3[_0xb2cc('0xd')]['message']);}logger['error'](_0xb2cc('0xa'),_0x307205,_0x4a1fd3['error'][_0xb2cc('0xf')]);return _0x289723(_0x4a1fd3[_0xb2cc('0xd')][_0xb2cc('0xf')]);}else{logger[_0xb2cc('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x307205,_0xb2cc('0xb'));_0x289723(_0x4a1fd3[_0xb2cc('0x11')][_0xb2cc('0xf')]);}})[_0xb2cc('0x12')](function(_0x5e9ced){logger[_0xb2cc('0xd')](_0xb2cc('0xa'),_0x307205,_0x5e9ced);_0x46dd16(_0x5e9ced);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8d322ec..e2de71c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc15b=['./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','listen','then','info','start','map','filter','online','name','join','status','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x534a86,_0x4a616b){var _0x118e2d=function(_0x1a192b){while(--_0x1a192b){_0x534a86['push'](_0x534a86['shift']());}};_0x118e2d(++_0x4a616b);}(_0xc15b,0x1f4));var _0xbc15=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xc15b[_0x19159a];return _0xa677f4;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0xbc15('0x0'));var config=require(_0xbc15('0x1'));var logger=require(_0xbc15('0x2'))(_0xbc15('0x3'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xbc15('0x4'));var chat=require(_0xbc15('0x5'));var whatsapp=require(_0xbc15('0x6'));var transcribe=require(_0xbc15('0x7'));function main(){return mysqldb['db']['sequelize'][_0xbc15('0x8')]()['then'](function(){return rpc[_0xbc15('0x9')]();})[_0xbc15('0xa')](function(_0x291c15){logger[_0xbc15('0xb')](_0x291c15);return chat[_0xbc15('0xc')]();})['then'](function(){return whatsapp[_0xbc15('0xc')]();})['then'](function(){return schedule[_0xbc15('0xc')]();})[_0xbc15('0xa')](function(){return transcribe[_0xbc15('0xc')]();})[_0xbc15('0xa')](function(_0x1b1a59){logger[_0xbc15('0xb')](_0x1b1a59);return pm2['start'](pm2Config);})['then'](function(_0x7a8b9){logger[_0xbc15('0xb')]('Online\x20apps:',_[_0xbc15('0xd')](_[_0xbc15('0xe')](_0x7a8b9,{'status':_0xbc15('0xf')}),_0xbc15('0x10'))[_0xbc15('0x11')]());logger[_0xbc15('0xb')]('Offline\x20apps:',_[_0xbc15('0xd')](_[_0xbc15('0xe')](_0x7a8b9,function(_0x20a021){return _0x20a021[_0xbc15('0x12')]!=='online';}),_0xbc15('0x10'))[_0xbc15('0x11')]()||'None');config[_0xbc15('0x13')]&&require('./config/seedDB')[_0xbc15('0x14')]();require(_0xbc15('0x15'))[_0xbc15('0x14')]();})[_0xbc15('0x16')](function(_0xee12f2){logger[_0xbc15('0x17')](_0xbc15('0x18'),_0xee12f2);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xf28a=['seedDB','default','catch','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status'];(function(_0x1ad8f4,_0x1065d6){var _0x124626=function(_0xc839b){while(--_0xc839b){_0x1ad8f4['push'](_0x1ad8f4['shift']());}};_0x124626(++_0x1065d6);}(_0xf28a,0x170));var _0xaf28=function(_0x2479b7,_0xe4cd04){_0x2479b7=_0x2479b7-0x0;var _0x4c155c=_0xf28a[_0x2479b7];return _0x4c155c;};'use strict';var _=require(_0xaf28('0x0'));var mysqldb=require(_0xaf28('0x1'));var rpc=require(_0xaf28('0x2'));var config=require('./config/environment');var logger=require(_0xaf28('0x3'))(_0xaf28('0x4'));var pm2=require(_0xaf28('0x5'));var pm2Config=require(_0xaf28('0x6'));var schedule=require(_0xaf28('0x7'));var chat=require(_0xaf28('0x8'));var whatsapp=require(_0xaf28('0x9'));var transcribe=require(_0xaf28('0xa'));function main(){return mysqldb['db']['sequelize'][_0xaf28('0xb')]()[_0xaf28('0xc')](function(){return rpc[_0xaf28('0xd')]();})[_0xaf28('0xc')](function(_0x4987fa){logger[_0xaf28('0xe')](_0x4987fa);return chat[_0xaf28('0xf')]();})[_0xaf28('0xc')](function(){return whatsapp[_0xaf28('0xf')]();})[_0xaf28('0xc')](function(){return schedule[_0xaf28('0xf')]();})['then'](function(){return transcribe[_0xaf28('0xf')]();})[_0xaf28('0xc')](function(_0x1a52cf){logger['info'](_0x1a52cf);return pm2['start'](pm2Config);})['then'](function(_0x3470e0){logger[_0xaf28('0xe')](_0xaf28('0x10'),_[_0xaf28('0x11')](_[_0xaf28('0x12')](_0x3470e0,{'status':_0xaf28('0x13')}),_0xaf28('0x14'))[_0xaf28('0x15')]());logger[_0xaf28('0xe')](_0xaf28('0x16'),_[_0xaf28('0x11')](_[_0xaf28('0x12')](_0x3470e0,function(_0x24cc0e){return _0x24cc0e[_0xaf28('0x17')]!==_0xaf28('0x13');}),'name')[_0xaf28('0x15')]()||'None');config[_0xaf28('0x18')]&&require('./config/seedDB')[_0xaf28('0x19')]();require('./config/license')[_0xaf28('0x19')]();})[_0xaf28('0x1a')](function(_0x3397c4){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3397c4);process[_0xaf28('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3b95cd6..873d4d7 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 _0x2a91=['User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','Forbidden','isMiddleware','signToken','motion.token','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','payload','options','randomBytes','hex','floor','now','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','role','internal','permissions','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','user','ChatInteraction','findOne','params','disposition','closed','unmanaged','json','Forbidden.','catch','isAuthenticated','use','headers','startsWith','authorization','User','find','name','pass','status','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','then','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.'];(function(_0x27d150,_0xacfba9){var _0x166eda=function(_0x3af888){while(--_0x3af888){_0x27d150['push'](_0x27d150['shift']());}};_0x166eda(++_0xacfba9);}(_0x2a91,0x18a));var _0x12a9=function(_0x16e3ab,_0x3edc13){_0x16e3ab=_0x16e3ab-0x0;var _0x5a1a2d=_0x2a91[_0x16e3ab];return _0x5a1a2d;};'use strict';var db=require(_0x12a9('0x0'))['db'];var config=require(_0x12a9('0x1'));var hardwareConf=require(_0x12a9('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x12a9('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x12a9('0x4'));var compose=require(_0x12a9('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0x12a9('0x6'));var BPromise=require(_0x12a9('0x7'));var util=require(_0x12a9('0x8'));var moment=require(_0x12a9('0x9'));var validateJwt=expressJwt({'secret':config[_0x12a9('0xa')][_0x12a9('0xb')]});var userAttributes=['id',_0x12a9('0xc'),'fullname','name',_0x12a9('0xd'),'email','userpic',_0x12a9('0xe'),'md5secret',_0x12a9('0xf'),_0x12a9('0x10'),_0x12a9('0x11'),'faxPause',_0x12a9('0x12'),_0x12a9('0x13'),_0x12a9('0x14'),'showWebBar',_0x12a9('0x15'),_0x12a9('0x16'),_0x12a9('0x17'),_0x12a9('0x18'),_0x12a9('0x19'),_0x12a9('0x1a'),_0x12a9('0x1b'),'phoneBarAutoAnswerDelay',_0x12a9('0x1c'),'phoneBarEnableRecording',_0x12a9('0x1d'),'phoneBarEnableSettings',_0x12a9('0x1e'),_0x12a9('0x1f'),_0x12a9('0x20'),'phoneBarRemoteControlPort',_0x12a9('0x21'),_0x12a9('0x22'),_0x12a9('0x23'),_0x12a9('0x24'),'settingsEnabled',_0x12a9('0x25'),_0x12a9('0x26'),'downloadOmnichannelInteractions',_0x12a9('0x27'),'ignorePauseForPreviewCalls',_0x12a9('0x28')];exports[_0x12a9('0x29')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x16e981,_0x2d3189,_0x38fc16){if(_0x16e981[_0x12a9('0x2a')]){_0x38fc16();}else{return db[_0x12a9('0x2b')][_0x12a9('0x2c')]({'where':{'id':_0x16e981[_0x12a9('0x2d')]['id']},'attributes':['id','closed',_0x12a9('0x2e')],'raw':!![]})['then'](function(_0x182034){if(_0x182034&&_0x182034[_0x12a9('0x2f')]){return _0x2d3189['status'](_0x182034[_0x12a9('0x2e')]===_0x12a9('0x30')?0x195:0x193)[_0x12a9('0x31')]({'message':_0x182034[_0x12a9('0x2e')]==='unmanaged'?'Unmanaged.':_0x12a9('0x32')});}else{_0x38fc16();}})[_0x12a9('0x33')](function(_0x40e482){_0x38fc16(_0x40e482);});}});};exports[_0x12a9('0x34')]=function isAuthenticated(_0x2bfe72){return compose()[_0x12a9('0x35')](function(_0x5ba179,_0x3f46be,_0x153069){var _0x4c1f4e;if(_0x5ba179[_0x12a9('0x36')]['authorization']){if(_[_0x12a9('0x37')](_0x5ba179['headers'][_0x12a9('0x38')],'Basic')){var _0xa1d761=basicAuth(_0x5ba179);db[_0x12a9('0x39')][_0x12a9('0x3a')]({'where':{'name':_0xa1d761[_0x12a9('0x3b')]}})['then'](function(_0x402d8c){if(!_0x402d8c||!_0x402d8c['authenticate'](_0xa1d761[_0x12a9('0x3c')])){return _0x3f46be[_0x12a9('0x3d')](0x191)[_0x12a9('0x31')]({'message':_0x12a9('0x3e')});}_0x5ba179[_0x12a9('0x2a')]={'id':_0x402d8c['id']};_0x153069();})['catch'](function(_0x93804e){_0x153069(_0x93804e);});}else if(_[_0x12a9('0x37')](_0x5ba179[_0x12a9('0x36')]['authorization'],'Bearer')){validateJwt(_0x5ba179,_0x3f46be,_0x153069);}else{if(_0x2bfe72){_0x153069();}else{return _0x3f46be[_0x12a9('0x3d')](0x193)[_0x12a9('0x31')]({'message':_0x12a9('0x3f')});}}}else if(_0x5ba179[_0x12a9('0x40')][_0x12a9('0x41')]){try{var _0x19ae48={'audience':hardwareConf[_0x12a9('0x42')](),'issuer':hardwareConf[_0x12a9('0x42')]()};verifyJwt(_0x5ba179[_0x12a9('0x40')][_0x12a9('0x41')],_0x19ae48)[_0x12a9('0x43')](function(_0x29ace1){return db[_0x12a9('0x39')][_0x12a9('0x3a')]({'where':{'id':_0x29ace1['sub']}})[_0x12a9('0x43')](function(_0x16be80){_0x4c1f4e=_0x16be80;return db['Setting'][_0x12a9('0x2c')]({'where':{'id':0x1},'attributes':[_0x12a9('0x44'),_0x12a9('0x45')],'raw':!![]});})[_0x12a9('0x43')](function(_0x2370ec){if(!_0x4c1f4e||!_[_0x12a9('0x46')](_0x4c1f4e[_0x12a9('0x47')],_0x29ace1[_0x12a9('0x48')])){return _0x3f46be[_0x12a9('0x3d')](0x191)['json']({'message':_0x12a9('0x49')});}if(_0x4c1f4e['disabled']){return _0x3f46be[_0x12a9('0x3d')](0x191)['json']({'message':_0x12a9('0x4a')});}if(_0x4c1f4e['blocked']){if(_0x2370ec['blockDuration']>0x0){if(moment(_0x4c1f4e[_0x12a9('0x4b')])['add'](_0x2370ec['blockDuration'],_0x12a9('0x4c'))>moment()){return _0x3f46be[_0x12a9('0x3d')](0x191)['json']({'message':_0x12a9('0x4a')});}}else{return _0x3f46be[_0x12a9('0x3d')](0x191)[_0x12a9('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x5ba179[_0x12a9('0x2a')]={'id':_0x4c1f4e['id']};_0x153069();});})[_0x12a9('0x33')](function(){return _0x3f46be[_0x12a9('0x3d')](0x191)[_0x12a9('0x31')]({'message':_0x12a9('0x4a')});});}catch(_0x35db32){_0x153069(_0x35db32);}}else if(_0x2bfe72){_0x153069();}else{return _0x3f46be['status'](0x193)[_0x12a9('0x31')]({'message':_0x12a9('0x3f')});}})[_0x12a9('0x35')](function(_0x19eb3e,_0x40ec61,_0x5373e2){if(_0x19eb3e[_0x12a9('0x2a')]){db[_0x12a9('0x39')][_0x12a9('0x3a')]({'where':{'id':_0x19eb3e[_0x12a9('0x2a')]['id']},'attributes':userAttributes})[_0x12a9('0x43')](function(_0x26d419){if(!_0x26d419){return _0x40ec61[_0x12a9('0x3d')](0x194)[_0x12a9('0x31')]({'message':_0x12a9('0x4d')});}_0x19eb3e['user']=_0x26d419;_0x5373e2();})['catch'](function(_0x454160){_0x5373e2(_0x454160);});}else if(_0x2bfe72){_0x5373e2();}else{return _0x40ec61[_0x12a9('0x3d')](0x194)[_0x12a9('0x31')]({'message':_0x12a9('0x4e')});}});};exports[_0x12a9('0x4f')]=function canUpdate(){return compose()[_0x12a9('0x35')](function(_0x2e1210,_0xa3cf03,_0x2b5108){return licenseUtil[_0x12a9('0x50')]()[_0x12a9('0x43')](function(_0x3aa15f){if(_0x3aa15f[_0x12a9('0x51')]){_0x2b5108();}else{return _0xa3cf03[_0x12a9('0x3d')](0x193)[_0x12a9('0x31')]({'message':'Forbidden'});}})[_0x12a9('0x33')](function(_0x308a37){_0x2b5108(_0x308a37);});});};exports[_0x12a9('0x52')]=function isWebrtcLicence(){return compose()[_0x12a9('0x35')](function(_0x2310b0,_0x1e9c28,_0x3eab7f){return licenseUtil[_0x12a9('0x50')]()[_0x12a9('0x43')](function(_0x110972){if(_0x110972[_0x12a9('0x53')]){_0x3eab7f();}else{return _0x1e9c28['status'](0x193)[_0x12a9('0x31')]({'message':_0x12a9('0x54')});}})[_0x12a9('0x33')](function(_0x4607f4){_0x3eab7f(_0x4607f4);});});};exports[_0x12a9('0x55')]=function(_0x39e391,_0xd51505,_0x540c3d){_0x39e391[_0x12a9('0x55')]=!![];return _0x540c3d();};exports[_0x12a9('0x56')]=function signToken(_0x37bb49){return signJwt(_0x37bb49);};exports['setTokenCookie']=function(_0x2bf0da,_0x1ed28d){if(!_0x2bf0da[_0x12a9('0x2a')]){return _0x1ed28d[_0x12a9('0x3d')](0x194)[_0x12a9('0x31')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x256a2b={'payload':{'id':_0x2bf0da[_0x12a9('0x2a')]['id'],'role':_0x2bf0da[_0x12a9('0x2a')][_0x12a9('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x256a2b)[_0x12a9('0x43')](function(_0xc4282e){_0x1ed28d['cookie'](_0x12a9('0x57'),_0xc4282e);_0x1ed28d['redirect'](_0x12a9('0x58'));})[_0x12a9('0x33')](function(_0x4c0a71){return _0x1ed28d[_0x12a9('0x3d')](0x1f4)['send'](_0x4c0a71);});};exports['retrieveApiKey']=function(_0x25ad36){if(_[_0x12a9('0x59')](_0x25ad36[_0x12a9('0x47')])||_[_0x12a9('0x59')](_0x25ad36[_0x12a9('0x5a')])){return null;}else{return createJwt(_0x25ad36);}};exports[_0x12a9('0x5b')]=function(_0x4ebe32){_0x4ebe32['apiKeyNonce']=generateNonce();_0x4ebe32[_0x12a9('0x5a')]=generateIssuedAt();return createJwt(_0x4ebe32);};exports[_0x12a9('0x5c')]=function(_0x2e0050,_0x24da47){var _0x550dc5=_0x2e0050[_0x12a9('0x40')][_0x12a9('0x41')];if(_0x550dc5){var _0x5cb4f7={'nonce':_0x24da47[_0x12a9('0x47')],'iat':_0x24da47[_0x12a9('0x5a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x12a9('0x42')]()};return verifyJwt(_0x550dc5,_0x5cb4f7)[_0x12a9('0x43')](function(){return generateApiKey(_0x24da47);});}else{throw{'message':_0x12a9('0x5d')};}};exports[_0x12a9('0x5e')]=function(_0x278bc4){var _0x176c25=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x176c25['test'](_0x278bc4))throw new db[(_0x12a9('0x5f'))][(_0x12a9('0x60'))](_0x12a9('0x61'));return;};exports[_0x12a9('0x62')]=function(_0x339e73,_0x116111,_0x4eede1){var _0x5148dd=encryptor[_0x12a9('0x63')](_0x116111)[_0x12a9('0x64')](',');for(var _0x3cbba2=0x0;_0x3cbba2<_0x4eede1;_0x3cbba2++){if(!_0x5148dd[_0x3cbba2])break;if(_0x339e73[_0x12a9('0x65')]()===_0x5148dd[_0x3cbba2]['toLowerCase']()){var _0x265398=util[_0x12a9('0x66')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x4eede1);if(_0x4eede1===0x1){_0x265398='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x12a9('0x60'))](_0x265398);}}return;};exports[_0x12a9('0x67')]=function(_0x20fcc6,_0x2f1fe1){var _0x3ef110=_0x2f1fe1?encryptor[_0x12a9('0x63')](_0x2f1fe1)['split'](','):[];if(_0x3ef110[_0x12a9('0x68')]===0x5){_0x3ef110['splice'](-0x1,0x1);}_0x3ef110[_0x12a9('0x69')](_0x20fcc6);return encryptor[_0x12a9('0x6a')](_0x3ef110[_0x12a9('0x6b')](','));};function signJwt(_0x301d2c){var _0x2e57fd=BPromise[_0x12a9('0x6c')](jwt[_0x12a9('0x6d')],{'context':jwt});var _0x44ff25=_0x301d2c[_0x12a9('0x6e')]||config[_0x12a9('0xa')]['session'];return new BPromise(function(_0x33881c,_0x580811){_0x2e57fd(_0x301d2c[_0x12a9('0x6f')],_0x44ff25,_0x301d2c[_0x12a9('0x70')])['then'](function(_0x4ba517){_0x33881c(_0x4ba517);})[_0x12a9('0x33')](function(_0x9ad281){_0x580811(_0x9ad281);});});}function verifyJwt(_0x4057c2,_0x12fadb,_0x3a967c){var _0x54711a=BPromise[_0x12a9('0x6c')](jwt['verify'],{'context':jwt});var _0x2e6b83=_0x3a967c||config[_0x12a9('0xa')]['session'];return new BPromise(function(_0xc397e9,_0x41e703){_0x54711a(_0x4057c2,_0x2e6b83,_0x12fadb)[_0x12a9('0x43')](function(_0x26a3da){_0xc397e9(_0x26a3da);})['catch'](function(_0x23cb42){_0x41e703(_0x23cb42);});});}function generateNonce(){return crypto[_0x12a9('0x71')](0x10)['toString'](_0x12a9('0x72'));}function generateIssuedAt(){return Math[_0x12a9('0x73')](Date[_0x12a9('0x74')]()/0x3e8)[_0x12a9('0x75')]();}function createJwt(_0x578b4f){var _0x3f9247={'payload':{'iat':_0x578b4f[_0x12a9('0x5a')],'nonce':_0x578b4f[_0x12a9('0x47')]},'options':{'algorithm':'HS512','subject':_0x578b4f['id']['toString'](),'issuer':hardwareConf[_0x12a9('0x42')](),'audience':hardwareConf[_0x12a9('0x42')]()}};return signJwt(_0x3f9247)['then'](function(_0x3d7387){return{'iat':_0x578b4f['apiKeyIat'],'nonce':_0x578b4f['apiKeyNonce'],'token':_0x3d7387};});} \ No newline at end of file +var _0xd1bf=['unshift','encryptString','join','secret','secrets','session','promisify','toString','floor','HS512','../../mysqldb','lodash','composable-middleware','crypto','bluebird','moment','role','fullname','name','email','userpic','permissions','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','closed','disposition','json','unmanaged','isAuthenticated','authorization','startsWith','User','find','then','pass','Wrong\x20credentials.','catch','headers','query','getUuid','apikey','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','status','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','webrtc','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','isNil','apiKeyIat','generateApiKey','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0xd1bf,0x7a));var _0xfd1b=function(_0xd9aa04,_0x50d4f7){_0xd9aa04=_0xd9aa04-0x0;var _0x23588b=_0xd1bf[_0xd9aa04];return _0x23588b;};'use strict';var db=require(_0xfd1b('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xfd1b('0x1'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xfd1b('0x2'));var basicAuth=require('basic-auth');var crypto=require(_0xfd1b('0x3'));var BPromise=require(_0xfd1b('0x4'));var util=require('util');var moment=require(_0xfd1b('0x5'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xfd1b('0x6'),_0xfd1b('0x7'),_0xfd1b('0x8'),'internal',_0xfd1b('0x9'),_0xfd1b('0xa'),_0xfd1b('0xb'),'md5secret',_0xfd1b('0xc'),'chatPause',_0xfd1b('0xd'),_0xfd1b('0xe'),_0xfd1b('0xf'),_0xfd1b('0x10'),'pauseType',_0xfd1b('0x11'),_0xfd1b('0x12'),_0xfd1b('0x13'),_0xfd1b('0x14'),_0xfd1b('0x15'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xfd1b('0x16'),_0xfd1b('0x17'),_0xfd1b('0x18'),_0xfd1b('0x19'),_0xfd1b('0x1a'),_0xfd1b('0x1b'),_0xfd1b('0x1c'),_0xfd1b('0x1d'),_0xfd1b('0x1e'),'hotdesk','interface',_0xfd1b('0x1f'),_0xfd1b('0x20'),_0xfd1b('0x21'),_0xfd1b('0x22'),_0xfd1b('0x23'),_0xfd1b('0x24'),_0xfd1b('0x25'),'ignorePauseForPreviewCalls',_0xfd1b('0x26')];exports[_0xfd1b('0x27')]=function(){return this['isAuthenticated'](!![])[_0xfd1b('0x28')](function(_0x1505a2,_0x128b20,_0x31e939){if(_0x1505a2[_0xfd1b('0x29')]){_0x31e939();}else{return db[_0xfd1b('0x2a')][_0xfd1b('0x2b')]({'where':{'id':_0x1505a2['params']['id']},'attributes':['id',_0xfd1b('0x2c'),_0xfd1b('0x2d')],'raw':!![]})['then'](function(_0x17598c){if(_0x17598c&&_0x17598c[_0xfd1b('0x2c')]){return _0x128b20['status'](_0x17598c[_0xfd1b('0x2d')]==='unmanaged'?0x195:0x193)[_0xfd1b('0x2e')]({'message':_0x17598c[_0xfd1b('0x2d')]===_0xfd1b('0x2f')?'Unmanaged.':'Forbidden.'});}else{_0x31e939();}})['catch'](function(_0xb9228c){_0x31e939(_0xb9228c);});}});};exports[_0xfd1b('0x30')]=function isAuthenticated(_0x47073b){return compose()[_0xfd1b('0x28')](function(_0x34ba1c,_0x51e5b8,_0x4598ba){var _0x4ee455;if(_0x34ba1c['headers'][_0xfd1b('0x31')]){if(_[_0xfd1b('0x32')](_0x34ba1c['headers']['authorization'],'Basic')){var _0x4c5c70=basicAuth(_0x34ba1c);db[_0xfd1b('0x33')][_0xfd1b('0x34')]({'where':{'name':_0x4c5c70[_0xfd1b('0x8')]}})[_0xfd1b('0x35')](function(_0x1a1ed8){if(!_0x1a1ed8||!_0x1a1ed8['authenticate'](_0x4c5c70[_0xfd1b('0x36')])){return _0x51e5b8['status'](0x191)[_0xfd1b('0x2e')]({'message':_0xfd1b('0x37')});}_0x34ba1c[_0xfd1b('0x29')]={'id':_0x1a1ed8['id']};_0x4598ba();})[_0xfd1b('0x38')](function(_0x539e23){_0x4598ba(_0x539e23);});}else if(_['startsWith'](_0x34ba1c[_0xfd1b('0x39')][_0xfd1b('0x31')],'Bearer')){validateJwt(_0x34ba1c,_0x51e5b8,_0x4598ba);}else{if(_0x47073b){_0x4598ba();}else{return _0x51e5b8['status'](0x193)[_0xfd1b('0x2e')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x34ba1c[_0xfd1b('0x3a')]['apikey']){try{var _0x4f8991={'audience':hardwareConf[_0xfd1b('0x3b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x34ba1c['query'][_0xfd1b('0x3c')],_0x4f8991)['then'](function(_0x523dfd){return db['User'][_0xfd1b('0x34')]({'where':{'id':_0x523dfd['sub']}})[_0xfd1b('0x35')](function(_0x40b0c0){_0x4ee455=_0x40b0c0;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xfd1b('0x3d'),_0xfd1b('0x3e')],'raw':!![]});})[_0xfd1b('0x35')](function(_0x5c8935){if(!_0x4ee455||!_[_0xfd1b('0x3f')](_0x4ee455[_0xfd1b('0x40')],_0x523dfd[_0xfd1b('0x41')])){return _0x51e5b8[_0xfd1b('0x42')](0x191)[_0xfd1b('0x2e')]({'message':_0xfd1b('0x43')});}if(_0x4ee455[_0xfd1b('0x44')]){return _0x51e5b8[_0xfd1b('0x42')](0x191)[_0xfd1b('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x4ee455[_0xfd1b('0x45')]){if(_0x5c8935[_0xfd1b('0x3e')]>0x0){if(moment(_0x4ee455[_0xfd1b('0x46')])['add'](_0x5c8935[_0xfd1b('0x3e')],_0xfd1b('0x47'))>moment()){return _0x51e5b8[_0xfd1b('0x42')](0x191)[_0xfd1b('0x2e')]({'message':_0xfd1b('0x48')});}}else{return _0x51e5b8['status'](0x191)['json']({'message':_0xfd1b('0x48')});}}_0x34ba1c[_0xfd1b('0x29')]={'id':_0x4ee455['id']};_0x4598ba();});})[_0xfd1b('0x38')](function(){return _0x51e5b8[_0xfd1b('0x42')](0x191)['json']({'message':_0xfd1b('0x48')});});}catch(_0x1d8629){_0x4598ba(_0x1d8629);}}else if(_0x47073b){_0x4598ba();}else{return _0x51e5b8[_0xfd1b('0x42')](0x193)[_0xfd1b('0x2e')]({'message':_0xfd1b('0x49')});}})[_0xfd1b('0x28')](function(_0x1d556c,_0x110f46,_0x9e9e0f){if(_0x1d556c[_0xfd1b('0x29')]){db['User']['find']({'where':{'id':_0x1d556c['user']['id']},'attributes':userAttributes})[_0xfd1b('0x35')](function(_0x3a6ce4){if(!_0x3a6ce4){return _0x110f46[_0xfd1b('0x42')](0x194)['json']({'message':_0xfd1b('0x4a')});}_0x1d556c[_0xfd1b('0x29')]=_0x3a6ce4;_0x9e9e0f();})[_0xfd1b('0x38')](function(_0x4ca55e){_0x9e9e0f(_0x4ca55e);});}else if(_0x47073b){_0x9e9e0f();}else{return _0x110f46['status'](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xfd1b('0x4b')]=function canUpdate(){return compose()[_0xfd1b('0x28')](function(_0x539724,_0x56513f,_0x5443e4){return licenseUtil[_0xfd1b('0x4c')]()[_0xfd1b('0x35')](function(_0x239e6d){if(_0x239e6d['update']){_0x5443e4();}else{return _0x56513f[_0xfd1b('0x42')](0x193)['json']({'message':'Forbidden'});}})[_0xfd1b('0x38')](function(_0x1bccd7){_0x5443e4(_0x1bccd7);});});};exports[_0xfd1b('0x4d')]=function isWebrtcLicence(){return compose()[_0xfd1b('0x28')](function(_0x7d72be,_0x9174a2,_0x237c1b){return licenseUtil[_0xfd1b('0x4c')]()[_0xfd1b('0x35')](function(_0x224c7a){if(_0x224c7a[_0xfd1b('0x4e')]){_0x237c1b();}else{return _0x9174a2[_0xfd1b('0x42')](0x193)[_0xfd1b('0x2e')]({'message':_0xfd1b('0x4f')});}})[_0xfd1b('0x38')](function(_0x2b360a){_0x237c1b(_0x2b360a);});});};exports[_0xfd1b('0x50')]=function(_0x4de131,_0x392845,_0x58ed78){_0x4de131[_0xfd1b('0x50')]=!![];return _0x58ed78();};exports[_0xfd1b('0x51')]=function signToken(_0x5363ba){return signJwt(_0x5363ba);};exports['setTokenCookie']=function(_0x18433b,_0x24ba15){if(!_0x18433b[_0xfd1b('0x29')]){return _0x24ba15[_0xfd1b('0x42')](0x194)[_0xfd1b('0x2e')]({'message':_0xfd1b('0x52')});}var _0x3f4d35={'payload':{'id':_0x18433b[_0xfd1b('0x29')]['id'],'role':_0x18433b[_0xfd1b('0x29')][_0xfd1b('0x6')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3f4d35)[_0xfd1b('0x35')](function(_0x414d07){_0x24ba15[_0xfd1b('0x53')](_0xfd1b('0x54'),_0x414d07);_0x24ba15[_0xfd1b('0x55')]('/dashboards/general');})['catch'](function(_0x20015c){return _0x24ba15['status'](0x1f4)['send'](_0x20015c);});};exports['retrieveApiKey']=function(_0x498309){if(_[_0xfd1b('0x56')](_0x498309[_0xfd1b('0x40')])||_['isNil'](_0x498309[_0xfd1b('0x57')])){return null;}else{return createJwt(_0x498309);}};exports[_0xfd1b('0x58')]=function(_0x281d47){_0x281d47[_0xfd1b('0x40')]=generateNonce();_0x281d47[_0xfd1b('0x57')]=generateIssuedAt();return createJwt(_0x281d47);};exports['regenerateApiKey']=function(_0x1e2ff0,_0x524135){var _0x4f9ef2=_0x1e2ff0[_0xfd1b('0x3a')][_0xfd1b('0x3c')];if(_0x4f9ef2){var _0x4166b0={'nonce':_0x524135[_0xfd1b('0x40')],'iat':_0x524135[_0xfd1b('0x57')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfd1b('0x3b')]()};return verifyJwt(_0x4f9ef2,_0x4166b0)[_0xfd1b('0x35')](function(){return generateApiKey(_0x524135);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xfd1b('0x59')]=function(_0x5f5a02){var _0x18b574=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x18b574[_0xfd1b('0x5a')](_0x5f5a02))throw new db['Sequelize']['ValidationError'](_0xfd1b('0x5b'));return;};exports[_0xfd1b('0x5c')]=function(_0xfd9a16,_0x57bc0c,_0x1ea21f){var _0x29c9c9=encryptor[_0xfd1b('0x5d')](_0x57bc0c)[_0xfd1b('0x5e')](',');for(var _0x36eabc=0x0;_0x36eabc<_0x1ea21f;_0x36eabc++){if(!_0x29c9c9[_0x36eabc])break;if(_0xfd9a16[_0xfd1b('0x5f')]()===_0x29c9c9[_0x36eabc]['toLowerCase']()){var _0x5230b0=util['format'](_0xfd1b('0x60'),_0x1ea21f);if(_0x1ea21f===0x1){_0x5230b0=_0xfd1b('0x61');}throw new db[(_0xfd1b('0x62'))][(_0xfd1b('0x63'))](_0x5230b0);}}return;};exports[_0xfd1b('0x64')]=function(_0x141d74,_0x4f9801){var _0x145cc7=_0x4f9801?encryptor[_0xfd1b('0x5d')](_0x4f9801)[_0xfd1b('0x5e')](','):[];if(_0x145cc7[_0xfd1b('0x65')]===0x5){_0x145cc7['splice'](-0x1,0x1);}_0x145cc7[_0xfd1b('0x66')](_0x141d74);return encryptor[_0xfd1b('0x67')](_0x145cc7[_0xfd1b('0x68')](','));};function signJwt(_0x78c215){var _0x18b03f=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x2a8ef4=_0x78c215[_0xfd1b('0x69')]||config[_0xfd1b('0x6a')][_0xfd1b('0x6b')];return new BPromise(function(_0x49a47e,_0x118825){_0x18b03f(_0x78c215['payload'],_0x2a8ef4,_0x78c215['options'])[_0xfd1b('0x35')](function(_0x35318a){_0x49a47e(_0x35318a);})['catch'](function(_0x4837a8){_0x118825(_0x4837a8);});});}function verifyJwt(_0x36850e,_0xe4a9e2,_0x5683df){var _0x26a685=BPromise[_0xfd1b('0x6c')](jwt['verify'],{'context':jwt});var _0x42226e=_0x5683df||config[_0xfd1b('0x6a')][_0xfd1b('0x6b')];return new BPromise(function(_0x5e98d0,_0x31a6e9){_0x26a685(_0x36850e,_0x42226e,_0xe4a9e2)[_0xfd1b('0x35')](function(_0x3a34b5){_0x5e98d0(_0x3a34b5);})[_0xfd1b('0x38')](function(_0x5f2346){_0x31a6e9(_0x5f2346);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfd1b('0x6d')]('hex');}function generateIssuedAt(){return Math[_0xfd1b('0x6e')](Date['now']()/0x3e8)[_0xfd1b('0x6d')]();}function createJwt(_0x12553c){var _0x467476={'payload':{'iat':_0x12553c['apiKeyIat'],'nonce':_0x12553c['apiKeyNonce']},'options':{'algorithm':_0xfd1b('0x6f'),'subject':_0x12553c['id'][_0xfd1b('0x6d')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xfd1b('0x3b')]()}};return signJwt(_0x467476)[_0xfd1b('0x35')](function(_0x464b74){return{'iat':_0x12553c['apiKeyIat'],'nonce':_0x12553c[_0xfd1b('0x40')],'token':_0x464b74};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e88f9b8..1ae66e8 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 _0xb2e7=['close','encryptString','base64','decryptString','utf8','bluebird','../../config/environment','../../config/logger','app','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','createReadStream','createDecipher'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xb2e7,0xc9));var _0x7b2e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb2e7[_0x42cae2];return _0x5f256f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x7b2e('0x0'));var _=require('lodash');var config=require(_0x7b2e('0x1'));var logger=require(_0x7b2e('0x2'))(_0x7b2e('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x7b2e('0x4')};if(config[_0x7b2e('0x5')]&&config[_0x7b2e('0x5')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x7b2e('0x5')][_0x7b2e('0x6')]);if(isSupported){fileOptions['algorithm']=config[_0x7b2e('0x5')][_0x7b2e('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7b2e('0x7')](',\x20');logger['error'](config[_0x7b2e('0x5')][_0x7b2e('0x6')],_0x7b2e('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x5e9ad8){return AES_SUPPORTED_RX[_0x7b2e('0x9')](_0x5e9ad8);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x179b9f){return getSupportedCiphers()[_0x7b2e('0xa')](_0x179b9f)>-0x1;}function combineOptions(_0x308dcf){var _0x442efd={};for(var _0x3618bc in fileOptions){if(fileOptions[_0x7b2e('0xb')](_0x3618bc)){_0x442efd[_0x3618bc]=fileOptions[_0x3618bc];}}if(_0x308dcf){for(var _0x189a9e in _0x308dcf){if(_0x308dcf[_0x7b2e('0xb')](_0x189a9e)){_0x442efd[_0x189a9e]=_0x308dcf[_0x189a9e];}}}return _0x442efd;}exports['encryptFile']=function(_0x438486,_0x2c90b6,_0x435459,_0x46a225){return new BPromise(function(_0x40bd3e,_0x2d8458){_0x46a225=combineOptions(_0x46a225);var _0x2e78fe=new Buffer(_0x435459);var _0x22a0f8=fs['createReadStream'](_0x438486);var _0x4570bf=fs[_0x7b2e('0xc')](_0x2c90b6);var _0x32640f=crypto[_0x7b2e('0xd')](_0x46a225[_0x7b2e('0x6')],_0x2e78fe);_0x22a0f8['on'](_0x7b2e('0xe'),function(_0x1bca3b){var _0x239055=new Buffer(_0x32640f[_0x7b2e('0xf')](_0x1bca3b),_0x7b2e('0x10'));_0x4570bf[_0x7b2e('0x11')](_0x239055);});_0x22a0f8['on'](_0x7b2e('0x12'),function(){try{var _0x597cd9=new Buffer(_0x32640f[_0x7b2e('0x13')](_0x7b2e('0x10')),_0x7b2e('0x10'));_0x4570bf[_0x7b2e('0x11')](_0x597cd9);_0x4570bf[_0x7b2e('0x12')]();_0x4570bf['on']('close',function(){return _0x40bd3e(_0x2c90b6);});}catch(_0x2b97ff){fs[_0x7b2e('0x14')](_0x2c90b6);return _0x2d8458(_0x2b97ff);}});});};exports['decryptFile']=function(_0x47e7f3,_0x55cf71,_0x200e8a,_0xefed76){return new BPromise(function(_0x57d9bd,_0x5dbeb3){_0xefed76=combineOptions(_0xefed76);var _0x6741a7=new Buffer(_0x200e8a);var _0x27d79b=fs[_0x7b2e('0x15')](_0x47e7f3);var _0x14b6fa=fs['createWriteStream'](_0x55cf71);var _0x29ca93=crypto[_0x7b2e('0x16')](_0xefed76['algorithm'],_0x6741a7);_0x27d79b['on'](_0x7b2e('0xe'),function(_0x5e6159){var _0x1ceee9=new Buffer(_0x29ca93['update'](_0x5e6159),'binary');_0x14b6fa['write'](_0x1ceee9);});_0x27d79b['on'](_0x7b2e('0x12'),function(){try{var _0x1e7b5e=new Buffer(_0x29ca93[_0x7b2e('0x13')](_0x7b2e('0x10')),_0x7b2e('0x10'));_0x14b6fa[_0x7b2e('0x11')](_0x1e7b5e);_0x14b6fa[_0x7b2e('0x12')]();_0x14b6fa['on'](_0x7b2e('0x17'),function(){return _0x57d9bd(_0x55cf71);});}catch(_0x1c172e){fs[_0x7b2e('0x14')](_0x55cf71);return _0x5dbeb3(_0x1c172e);}});});};exports[_0x7b2e('0x18')]=function(_0xb9f36,_0xaf112e,_0x24a9d7){var _0x34c067=_0x24a9d7||stringOptions[_0x7b2e('0x6')];var _0x529e81=_0xaf112e||stringOptions['secret'];var _0x159621=crypto[_0x7b2e('0xd')](_0x34c067,_0x529e81);var _0x201222=_0x159621['update'](_0xb9f36,'utf8','base64');_0x201222+=_0x159621[_0x7b2e('0x13')](_0x7b2e('0x19'));return _0x201222;};exports[_0x7b2e('0x1a')]=function(_0x692a6c,_0x3995b9,_0x4c714f){var _0x2b57e4=_0x4c714f||stringOptions[_0x7b2e('0x6')];var _0x20b4cb=_0x3995b9||stringOptions['secret'];var _0x3e4c02=crypto['createDecipher'](_0x2b57e4,_0x20b4cb);var _0x58fee8=_0x3e4c02['update'](_0x692a6c,'base64',_0x7b2e('0x1b'));_0x58fee8+=_0x3e4c02[_0x7b2e('0x13')](_0x7b2e('0x1b'));return _0x58fee8;}; \ No newline at end of file +var _0xee52=['test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','write','close','unlink','decryptFile','createDecipher','encryptString','base64','decryptString','secret','utf8','crypto','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x4e9f56,_0x5d706b){var _0x581eca=function(_0x540a31){while(--_0x540a31){_0x4e9f56['push'](_0x4e9f56['shift']());}};_0x581eca(++_0x5d706b);}(_0xee52,0xa0));var _0x2ee5=function(_0x16d1ec,_0x5bf8ca){_0x16d1ec=_0x16d1ec-0x0;var _0x3eab93=_0xee52[_0x16d1ec];return _0x3eab93;};'use strict';var crypto=require(_0x2ee5('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x2ee5('0x1'));var logger=require(_0x2ee5('0x2'))(_0x2ee5('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2ee5('0x4')]['session'],'algorithm':_0x2ee5('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0x2ee5('0x6')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x2ee5('0x7')]=config[_0x2ee5('0x6')][_0x2ee5('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2ee5('0x8')](',\x20');logger['error'](config['encrypt'][_0x2ee5('0x7')],_0x2ee5('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x2770af){return AES_SUPPORTED_RX[_0x2ee5('0xa')](_0x2770af);}function getSupportedCiphers(){return crypto[_0x2ee5('0xb')]()[_0x2ee5('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x52cd25){return getSupportedCiphers()[_0x2ee5('0xd')](_0x52cd25)>-0x1;}function combineOptions(_0x211c84){var _0xd53226={};for(var _0x27deb8 in fileOptions){if(fileOptions[_0x2ee5('0xe')](_0x27deb8)){_0xd53226[_0x27deb8]=fileOptions[_0x27deb8];}}if(_0x211c84){for(var _0x2c9f5b in _0x211c84){if(_0x211c84[_0x2ee5('0xe')](_0x2c9f5b)){_0xd53226[_0x2c9f5b]=_0x211c84[_0x2c9f5b];}}}return _0xd53226;}exports[_0x2ee5('0xf')]=function(_0x125117,_0x23a381,_0x2847fd,_0x2a2bde){return new BPromise(function(_0xb7fdf1,_0x1ed5be){_0x2a2bde=combineOptions(_0x2a2bde);var _0xab66aa=new Buffer(_0x2847fd);var _0x1f2f04=fs[_0x2ee5('0x10')](_0x125117);var _0x29a208=fs[_0x2ee5('0x11')](_0x23a381);var _0x44a0ca=crypto[_0x2ee5('0x12')](_0x2a2bde[_0x2ee5('0x7')],_0xab66aa);_0x1f2f04['on'](_0x2ee5('0x13'),function(_0x3dfd70){var _0x144ce2=new Buffer(_0x44a0ca[_0x2ee5('0x14')](_0x3dfd70),_0x2ee5('0x15'));_0x29a208['write'](_0x144ce2);});_0x1f2f04['on'](_0x2ee5('0x16'),function(){try{var _0x36b6b6=new Buffer(_0x44a0ca[_0x2ee5('0x17')](_0x2ee5('0x15')),_0x2ee5('0x15'));_0x29a208[_0x2ee5('0x18')](_0x36b6b6);_0x29a208[_0x2ee5('0x16')]();_0x29a208['on'](_0x2ee5('0x19'),function(){return _0xb7fdf1(_0x23a381);});}catch(_0x3bd9ba){fs[_0x2ee5('0x1a')](_0x23a381);return _0x1ed5be(_0x3bd9ba);}});});};exports[_0x2ee5('0x1b')]=function(_0x29810e,_0x5d47a2,_0x50ec3e,_0x2b736d){return new BPromise(function(_0x288f33,_0x344ade){_0x2b736d=combineOptions(_0x2b736d);var _0x5cc85f=new Buffer(_0x50ec3e);var _0x5546be=fs[_0x2ee5('0x10')](_0x29810e);var _0x5afc1e=fs[_0x2ee5('0x11')](_0x5d47a2);var _0x59ad25=crypto[_0x2ee5('0x1c')](_0x2b736d[_0x2ee5('0x7')],_0x5cc85f);_0x5546be['on'](_0x2ee5('0x13'),function(_0x2015a2){var _0xc8ed64=new Buffer(_0x59ad25[_0x2ee5('0x14')](_0x2015a2),_0x2ee5('0x15'));_0x5afc1e['write'](_0xc8ed64);});_0x5546be['on'](_0x2ee5('0x16'),function(){try{var _0x3724fb=new Buffer(_0x59ad25[_0x2ee5('0x17')](_0x2ee5('0x15')),'binary');_0x5afc1e[_0x2ee5('0x18')](_0x3724fb);_0x5afc1e[_0x2ee5('0x16')]();_0x5afc1e['on']('close',function(){return _0x288f33(_0x5d47a2);});}catch(_0x2bb2c4){fs['unlink'](_0x5d47a2);return _0x344ade(_0x2bb2c4);}});});};exports[_0x2ee5('0x1d')]=function(_0x146d4f,_0x3ac627,_0x14ba7d){var _0xe76ecf=_0x14ba7d||stringOptions[_0x2ee5('0x7')];var _0xd9b7ce=_0x3ac627||stringOptions['secret'];var _0x5009e8=crypto[_0x2ee5('0x12')](_0xe76ecf,_0xd9b7ce);var _0x295857=_0x5009e8[_0x2ee5('0x14')](_0x146d4f,'utf8',_0x2ee5('0x1e'));_0x295857+=_0x5009e8[_0x2ee5('0x17')](_0x2ee5('0x1e'));return _0x295857;};exports[_0x2ee5('0x1f')]=function(_0x3c8a5f,_0x3c3cad,_0x109345){var _0x42b7a0=_0x109345||stringOptions[_0x2ee5('0x7')];var _0x55df20=_0x3c3cad||stringOptions[_0x2ee5('0x20')];var _0x39d614=crypto[_0x2ee5('0x1c')](_0x42b7a0,_0x55df20);var _0x52bf0e=_0x39d614[_0x2ee5('0x14')](_0x3c8a5f,_0x2ee5('0x1e'),_0x2ee5('0x21'));_0x52bf0e+=_0x39d614[_0x2ee5('0x17')](_0x2ee5('0x21'));return _0x52bf0e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3b122bf..f74d37e 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 _0x2e4a=['mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.csv','length','existsSync','join'];(function(_0x98cb08,_0x3212b4){var _0x23473c=function(_0x4074f1){while(--_0x4074f1){_0x98cb08['push'](_0x98cb08['shift']());}};_0x23473c(++_0x3212b4);}(_0x2e4a,0x147));var _0xa2e4=function(_0x3befff,_0x4aca62){_0x3befff=_0x3befff-0x0;var _0x5bb303=_0x2e4a[_0x3befff];return _0x5bb303;};'use strict';var util=require(_0xa2e4('0x0'));var path=require(_0xa2e4('0x1'));var _=require(_0xa2e4('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa2e4('0x3'));var zipdir=require(_0xa2e4('0x4'));var rimraf=require(_0xa2e4('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xa2e4('0x6'))(_0xa2e4('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xa2e4('0x8')][0x2]);var QUERY=process[_0xa2e4('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x191f0b,_0x285d97){var _0x54788d={'status':_0x191f0b};var _0xa778d4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x285d97){_0x54788d[_0xa2e4('0x9')]=_0x285d97;}return db[_0xa2e4('0xa')][_0xa2e4('0xb')](_0x54788d,_0xa778d4);}function main(){var _0x2b615f=0x1388;var _0x37c820;logger[_0xa2e4('0xc')](util['format'](_0xa2e4('0xd'),EXTRACTED_REPORT_ID,_0xa2e4('0xe')));return db[_0xa2e4('0xf')][_0xa2e4('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa2e4('0x11'),_0xa2e4('0x12')]})[_0xa2e4('0x13')](function(_0x219272){if(_0x219272){_0x37c820=_0x219272;_0x2b615f=_0x37c820[_0xa2e4('0x12')]||0x1388;}})['then'](function(){return dbH[_0xa2e4('0x14')][_0xa2e4('0x15')](util[_0xa2e4('0x16')](_0xa2e4('0x17'),QUERY),{'type':dbH[_0xa2e4('0x14')][_0xa2e4('0x18')][_0xa2e4('0x19')]});})[_0xa2e4('0x13')](function(_0x536635){if(!_0x536635[0x0][_0xa2e4('0x1a')]){return analyticExtractedReport(_0xa2e4('0x1b'));}var _0x256b70=[];var _0xa9da64=0x0;if(_0x37c820[_0xa2e4('0x11')]){if(_0x536635&&_0x536635['length']){var _0x4b01d9=_[_0xa2e4('0x1c')](_0x536635[0x0][_0xa2e4('0x1a')]/_0x2b615f);var _0x58d606=Number[_0xa2e4('0x1d')](_0x536635[0x0][_0xa2e4('0x1a')]/_0x2b615f)?_0x536635[0x0][_0xa2e4('0x1a')]%_0x2b615f:0x0;_0x4b01d9['forEach'](function(_0x843b8d){if(_0x843b8d>0x0){_0xa9da64+=_0x2b615f;}_0x256b70['push'](dbH[_0xa2e4('0x14')]['query'](util[_0xa2e4('0x16')](_0xa2e4('0x1e'),QUERY,_0x2b615f,_0xa9da64),{'type':dbH[_0xa2e4('0x14')]['QueryTypes'][_0xa2e4('0x19')]}));});if(_0x58d606>0x0){_0xa9da64+=_0x2b615f;_0x256b70[_0xa2e4('0x1f')](dbH[_0xa2e4('0x14')][_0xa2e4('0x15')](util[_0xa2e4('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x58d606,_0xa9da64),{'type':dbH[_0xa2e4('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x256b70[_0xa2e4('0x1f')](dbH['sequelize'][_0xa2e4('0x15')](QUERY,{'type':dbH[_0xa2e4('0x14')][_0xa2e4('0x18')][_0xa2e4('0x19')]}));}var _0x1859d8=path[_0xa2e4('0x20')](PATH);var _0xdc296e=path['basename'](PATH,_0xa2e4('0x21'));var _0x168d0a=_0x37c820[_0xa2e4('0x11')]&&_0x256b70[_0xa2e4('0x22')]>0x1;var _0x5d90f3=[];if(!fs[_0xa2e4('0x23')](path[_0xa2e4('0x24')](_0x1859d8,_0xdc296e))&&_0x168d0a){fs[_0xa2e4('0x25')](path[_0xa2e4('0x24')](_0x1859d8,_0xdc296e));}return BPromise[_0xa2e4('0x26')](_0x256b70,function(_0x47c5d4){_0x5d90f3[_0xa2e4('0x1f')](_0x47c5d4);})[_0xa2e4('0x13')](function(){for(var _0x1e319c=0x0;_0x1e319c<_0x5d90f3[_0xa2e4('0x22')];_0x1e319c+=0x1){var _0xf34c4a;var _0x399105=_0x5d90f3[_0x1e319c];if(_0x168d0a){_0xf34c4a=path[_0xa2e4('0x24')](_0x1859d8,_0xdc296e,util[_0xa2e4('0x16')](_0xa2e4('0x27'),_0xdc296e,_0x1e319c,_0xa2e4('0x28')));}else{_0xf34c4a=path['join'](_0x1859d8,util[_0xa2e4('0x16')](_0xa2e4('0x29'),_0xdc296e,_0xa2e4('0x28')));}fs[_0xa2e4('0x2a')](_0xf34c4a,csv(_0x399105));}})[_0xa2e4('0x13')](function(){if(_0x168d0a){return new Promise(function(_0x28d0f9){zipdir(path['join'](_0x1859d8,_0xdc296e),{'saveTo':path['join'](_0x1859d8,util[_0xa2e4('0x16')]('%s.%s',_0xdc296e,_0xa2e4('0x2b')))},function(_0x5b7889,_0x537ee2){rimraf(path['join'](_0x1859d8,_0xdc296e),function(){});_0x28d0f9(_0xa2e4('0x2c'));});});}})[_0xa2e4('0x13')](function(){logger['info'](util[_0xa2e4('0x16')](_0xa2e4('0x2d'),EXTRACTED_REPORT_ID,_0xa2e4('0xe')));return analyticExtractedReport(_0xa2e4('0x2e'),_0x168d0a?util[_0xa2e4('0x16')](_0xa2e4('0x29'),_0xdc296e,_0x168d0a?'zip':_0xa2e4('0x28')):null);});})[_0xa2e4('0x2f')](function(_0x52dbbc){logger['info'](util[_0xa2e4('0x16')](_0xa2e4('0x30'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x52dbbc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa2e4('0x31'));})[_0xa2e4('0x32')](function(){process[_0xa2e4('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3ac9=['zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','length','range','isInteger','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','csv','%s.%s','zip\x20finished','info','Completed'];(function(_0x1bbbec,_0x386c4b){var _0x5de659=function(_0x35c72f){while(--_0x35c72f){_0x1bbbec['push'](_0x1bbbec['shift']());}};_0x5de659(++_0x386c4b);}(_0x3ac9,0x185));var _0x93ac=function(_0x2383bc,_0x2d5ec9){_0x2383bc=_0x2383bc-0x0;var _0x283573=_0x3ac9[_0x2383bc];return _0x283573;};'use strict';var util=require('util');var path=require(_0x93ac('0x0'));var _=require('lodash');var csv=require(_0x93ac('0x1'));var fs=require('fs');var BPromise=require(_0x93ac('0x2'));var zipdir=require(_0x93ac('0x3'));var rimraf=require(_0x93ac('0x4'));var db=require(_0x93ac('0x5'))['db'];var dbH=require(_0x93ac('0x5'))[_0x93ac('0x6')];var logger=require(_0x93ac('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x93ac('0x8')][0x3];var PATH=process[_0x93ac('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x15db10,_0x5c7ec0){var _0x1aeed5={'status':_0x15db10};var _0x3d9acd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c7ec0){_0x1aeed5[_0x93ac('0x9')]=_0x5c7ec0;}return db[_0x93ac('0xa')][_0x93ac('0xb')](_0x1aeed5,_0x3d9acd);}function main(){var _0x3922f0=0x1388;var _0x176289;logger['info'](util['format'](_0x93ac('0xc'),EXTRACTED_REPORT_ID,_0x93ac('0xd')));return db[_0x93ac('0xe')][_0x93ac('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x93ac('0x10'),'splitSizeCsv']})[_0x93ac('0x11')](function(_0x2a0042){if(_0x2a0042){_0x176289=_0x2a0042;_0x3922f0=_0x176289[_0x93ac('0x12')]||0x1388;}})[_0x93ac('0x11')](function(){return dbH['sequelize'][_0x93ac('0x13')](util[_0x93ac('0x14')](_0x93ac('0x15'),QUERY),{'type':dbH[_0x93ac('0x16')][_0x93ac('0x17')]['SELECT']});})[_0x93ac('0x11')](function(_0x2c1924){if(!_0x2c1924[0x0][_0x93ac('0x18')]){return analyticExtractedReport(_0x93ac('0x19'));}var _0x4eb9a2=[];var _0x5b0b8f=0x0;if(_0x176289[_0x93ac('0x10')]){if(_0x2c1924&&_0x2c1924[_0x93ac('0x1a')]){var _0x2f98a0=_[_0x93ac('0x1b')](_0x2c1924[0x0][_0x93ac('0x18')]/_0x3922f0);var _0x4fb3ea=Number[_0x93ac('0x1c')](_0x2c1924[0x0][_0x93ac('0x18')]/_0x3922f0)?_0x2c1924[0x0][_0x93ac('0x18')]%_0x3922f0:0x0;_0x2f98a0['forEach'](function(_0x2753fd){if(_0x2753fd>0x0){_0x5b0b8f+=_0x3922f0;}_0x4eb9a2[_0x93ac('0x1d')](dbH[_0x93ac('0x16')][_0x93ac('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3922f0,_0x5b0b8f),{'type':dbH['sequelize'][_0x93ac('0x17')][_0x93ac('0x1e')]}));});if(_0x4fb3ea>0x0){_0x5b0b8f+=_0x3922f0;_0x4eb9a2[_0x93ac('0x1d')](dbH[_0x93ac('0x16')][_0x93ac('0x13')](util[_0x93ac('0x14')](_0x93ac('0x1f'),QUERY,_0x4fb3ea,_0x5b0b8f),{'type':dbH[_0x93ac('0x16')][_0x93ac('0x17')][_0x93ac('0x1e')]}));}}}else{_0x4eb9a2['push'](dbH[_0x93ac('0x16')][_0x93ac('0x13')](QUERY,{'type':dbH[_0x93ac('0x16')]['QueryTypes'][_0x93ac('0x1e')]}));}var _0x1f36d3=path[_0x93ac('0x20')](PATH);var _0x2e99ef=path[_0x93ac('0x21')](PATH,_0x93ac('0x22'));var _0x30c2c0=_0x176289[_0x93ac('0x10')]&&_0x4eb9a2[_0x93ac('0x1a')]>0x1;var _0x3259d6=[];if(!fs[_0x93ac('0x23')](path[_0x93ac('0x24')](_0x1f36d3,_0x2e99ef))&&_0x30c2c0){fs['mkdirSync'](path[_0x93ac('0x24')](_0x1f36d3,_0x2e99ef));}return BPromise[_0x93ac('0x25')](_0x4eb9a2,function(_0x5957d4){_0x3259d6[_0x93ac('0x1d')](_0x5957d4);})[_0x93ac('0x11')](function(){for(var _0x76e61c=0x0;_0x76e61c<_0x3259d6[_0x93ac('0x1a')];_0x76e61c+=0x1){var _0x9c32de;var _0x2a419d=_0x3259d6[_0x76e61c];if(_0x30c2c0){_0x9c32de=path[_0x93ac('0x24')](_0x1f36d3,_0x2e99ef,util['format']('%s%d.%s',_0x2e99ef,_0x76e61c,_0x93ac('0x26')));}else{_0x9c32de=path[_0x93ac('0x24')](_0x1f36d3,util[_0x93ac('0x14')]('%s.%s',_0x2e99ef,'csv'));}fs['writeFileSync'](_0x9c32de,csv(_0x2a419d));}})[_0x93ac('0x11')](function(){if(_0x30c2c0){return new Promise(function(_0x4ca5f6){zipdir(path[_0x93ac('0x24')](_0x1f36d3,_0x2e99ef),{'saveTo':path[_0x93ac('0x24')](_0x1f36d3,util[_0x93ac('0x14')](_0x93ac('0x27'),_0x2e99ef,'zip'))},function(_0x5842ea,_0x3639c1){rimraf(path[_0x93ac('0x24')](_0x1f36d3,_0x2e99ef),function(){});_0x4ca5f6(_0x93ac('0x28'));});});}})[_0x93ac('0x11')](function(){logger[_0x93ac('0x29')](util[_0x93ac('0x14')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x93ac('0xd')));return analyticExtractedReport(_0x93ac('0x2a'),_0x30c2c0?util[_0x93ac('0x14')]('%s.%s',_0x2e99ef,_0x30c2c0?_0x93ac('0x2b'):_0x93ac('0x26')):null);});})['catch'](function(_0x5a8a87){logger[_0x93ac('0x29')](util[_0x93ac('0x14')](_0x93ac('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util[_0x93ac('0x2d')](_0x5a8a87,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x93ac('0x2e')](function(){process[_0x93ac('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 813a3a3..5b10be8 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 _0x1a16=['flatten','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','createPdfFromHTML','createPdfKitDocument','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','before','margin','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','join','mkdirSync','each'];(function(_0x5b8a36,_0x321995){var _0x4beaf8=function(_0xeea714){while(--_0xeea714){_0x5b8a36['push'](_0x5b8a36['shift']());}};_0x4beaf8(++_0x321995);}(_0x1a16,0x1cf));var _0x61a1=function(_0x52e199,_0xdfd12){_0x52e199=_0x52e199-0x0;var _0x5c5483=_0x1a16[_0x52e199];return _0x5c5483;};'use strict';var _=require(_0x61a1('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x61a1('0x1'));var moment=require(_0x61a1('0x2'));var htmlToPdfmake=require(_0x61a1('0x3'));var PdfPrinter=require(_0x61a1('0x4'));var zipdir=require(_0x61a1('0x5'));var rimraf=require(_0x61a1('0x6'));var JSDOM=require('jsdom')[_0x61a1('0x7')];var window=new JSDOM('')[_0x61a1('0x8')];var BPromise=require(_0x61a1('0x9'));var db=require(_0x61a1('0xa'))['db'];var dbH=require(_0x61a1('0xa'))[_0x61a1('0xb')];var logger=require('../../config/logger')(_0x61a1('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x61a1('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x61a1('0xd')][0x4];var NAME=process[_0x61a1('0xd')][0x5];var FORMAT=_0x61a1('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x168316,_0x2a6f51){var _0xd00f9c={'status':_0x168316};var _0x277ef2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2a6f51){_0xd00f9c[_0x61a1('0xf')]=_0x2a6f51;}return db[_0x61a1('0x10')][_0x61a1('0x11')](_0xd00f9c,_0x277ef2);}function getHeaders(_0x745e46){return _[_0x61a1('0x12')](_0x745e46,function(_0x18e9ed){return{'text':_0x18e9ed,'style':_0x61a1('0x13')};});}function getRows(_0xb44fe8,_0xdd93bd){return _[_0x61a1('0x12')](_0xdd93bd,function(_0xfe20f4){return _(_0xfe20f4)[_0x61a1('0x14')](_0xb44fe8)['map'](function(_0x514a48){return _0x514a48?_['toString'](_0x514a48):'';})[_0x61a1('0x15')]();});}function createTable(_0x28c738,_0x58b431){var _0x78cddb={'widths':_[_0x61a1('0x16')](Array(_0x28c738[_0x61a1('0x17')]),0x91),'heights':function(_0xe633ec){return _0xe633ec===0x0?_0x61a1('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x366fdf=getHeaders(_0x28c738);_0x78cddb[_0x61a1('0x19')][_0x61a1('0x1a')](_0x366fdf);var _0x41ece6=getRows(_0x28c738,_0x58b431);_0x78cddb['body']=_0x78cddb[_0x61a1('0x19')][_0x61a1('0x1b')](_0x41ece6);return _0x78cddb;}function createTables(_0x1a062d){var _0x549b10=[];var _0x4f2b8c=_[_0x61a1('0x1c')](Object[_0x61a1('0x1d')](_0x1a062d[0x0]),0x5);_0x4f2b8c[_0x61a1('0x1e')](function(_0x2fd637){_0x549b10[_0x61a1('0x1a')](createTable(_0x2fd637,_0x1a062d));});return _0x549b10;}function getPDFDocDefinition(_0x32298a){var _0x5222a5=util[_0x61a1('0x1f')](_0x61a1('0x20'),NAME,EXTRACTED_REPORT[_0x61a1('0x21')],moment(EXTRACTED_REPORT[_0x61a1('0x22')])[_0x61a1('0x1f')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x61a1('0x1f')](FORMAT));var _0x28cc49=[];for(var _0x46f4b9=0x0;_0x46f4b9<_0x32298a['length'];_0x46f4b9++){var _0x3ecd81=[];if(_0x46f4b9===0x0){_0x3ecd81['push']({'text':_0x5222a5,'style':'header'});}var _0x46bf24={'table':_0x32298a[_0x46f4b9]};if(_0x46f4b9>0x0){_0x46bf24['pageBreak']=_0x61a1('0x23');_0x46bf24[_0x61a1('0x24')]=[0x0,0x46,0x0,0x0];}_0x3ecd81[_0x61a1('0x1a')](_0x46bf24);_0x28cc49['push'](_0x3ecd81);}return{'pageSize':'A4','pageOrientation':_0x61a1('0x25'),'content':_0x28cc49,'footer':function(_0x585ef2,_0x534178){return{'text':_0x585ef2[_0x61a1('0x26')]()+_0x61a1('0x27')+_0x534178,'style':_0x61a1('0x28')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x61a1('0x29')},'footer':{'alignment':_0x61a1('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xeaf618){var _0x6b2c69=0x1388;var _0x1ac2b1;if(!_0xeaf618[0x0][_0x61a1('0x2b')]){return analyticExtractedReport(_0x61a1('0x2c'));}return db[_0x61a1('0x2d')][_0x61a1('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x61a1('0x2f'),_0x61a1('0x30')]})[_0x61a1('0x31')](function(_0x2f8feb){if(_0x2f8feb){_0x1ac2b1=_0x2f8feb;_0x6b2c69=_0x1ac2b1['splitSizePdf']||0x3e8;}})[_0x61a1('0x31')](function(){var _0x8f9604=[];var _0x430aaa=0x0;if(_0x1ac2b1['split']){if(_0xeaf618&&_0xeaf618['length']){var _0x410f38=_['range'](_0xeaf618[0x0][_0x61a1('0x2b')]/_0x6b2c69);var _0x279900=Number[_0x61a1('0x32')](_0xeaf618[0x0][_0x61a1('0x2b')]/_0x6b2c69)?_0xeaf618[0x0][_0x61a1('0x2b')]%_0x6b2c69:0x0;_0x410f38[_0x61a1('0x1e')](function(_0x3f7c97){if(_0x3f7c97>0x0){_0x430aaa+=_0x6b2c69;}_0x8f9604[_0x61a1('0x1a')](dbH[_0x61a1('0x33')]['query'](util[_0x61a1('0x1f')](_0x61a1('0x34'),QUERY,_0x6b2c69,_0x430aaa),{'type':dbH[_0x61a1('0x33')][_0x61a1('0x35')][_0x61a1('0x36')]}));});if(_0x279900>0x0){_0x430aaa+=_0x6b2c69;_0x8f9604[_0x61a1('0x1a')](dbH[_0x61a1('0x33')][_0x61a1('0x37')](util[_0x61a1('0x1f')](_0x61a1('0x34'),QUERY,_0x279900,_0x430aaa),{'type':dbH[_0x61a1('0x33')][_0x61a1('0x35')][_0x61a1('0x36')]}));}}}else{_0x8f9604[_0x61a1('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x61a1('0x33')]['QueryTypes'][_0x61a1('0x36')]}));}var _0x39274f=path['dirname'](PATH);var _0x2327d0=path['basename'](PATH,'.pdf');var _0x5a9c1c=_0x1ac2b1[_0x61a1('0x2f')]&&_0x8f9604[_0x61a1('0x17')]>0x1;var _0x50a4db=[];if(!fs['existsSync'](path[_0x61a1('0x38')](_0x39274f,_0x2327d0))&&_0x5a9c1c){fs[_0x61a1('0x39')](path['join'](_0x39274f,_0x2327d0));}return BPromise[_0x61a1('0x3a')](_0x8f9604,function(_0x5e7602){_0x50a4db[_0x61a1('0x1a')](_0x5e7602);})[_0x61a1('0x31')](function(){var _0x3b8f4c=[];for(var _0x5c2655=0x0;_0x5c2655<_0x50a4db[_0x61a1('0x17')];_0x5c2655+=0x1){var _0x4d7d95=_0x50a4db[_0x5c2655];var _0x5d15e5=createTables(_[_0x61a1('0x3b')](_0x4d7d95));var _0xe78835;var _0x25a61d=getPDFDocDefinition(_0x5d15e5);var _0x5dd4ba=getPDFPrinter();var _0x42d77b=_0x5dd4ba['createPdfKitDocument'](_0x25a61d);if(_0x5a9c1c){_0xe78835=path[_0x61a1('0x38')](_0x39274f,_0x2327d0,util[_0x61a1('0x1f')]('%s%d.%s',_0x2327d0,_0x5c2655,_0x61a1('0x3c')));}else{_0xe78835=path['join'](_0x39274f,util[_0x61a1('0x1f')](_0x61a1('0x3d'),_0x2327d0,_0x61a1('0x3c')));}_0x3b8f4c[_0x61a1('0x1a')](writePDFDocument(_0x42d77b,_0xe78835));}return Promise['all'](_0x3b8f4c);})[_0x61a1('0x31')](function(){if(_0x5a9c1c){return new Promise(function(_0x52fc9b){zipdir(path[_0x61a1('0x38')](_0x39274f,_0x2327d0),{'saveTo':path[_0x61a1('0x38')](_0x39274f,util[_0x61a1('0x1f')]('%s.%s',_0x2327d0,_0x61a1('0x3e')))},function(){rimraf(path[_0x61a1('0x38')](_0x39274f,_0x2327d0),function(){});_0x52fc9b(_0x61a1('0x3f'));});});}})[_0x61a1('0x31')](function(){if(!_0x5a9c1c)return;rimraf(path[_0x61a1('0x38')](_0x39274f,_0x2327d0),function(){});})[_0x61a1('0x31')](function(){logger[_0x61a1('0x40')](util[_0x61a1('0x1f')](_0x61a1('0x41'),EXTRACTED_REPORT_ID,_0x61a1('0x42')));return analyticExtractedReport('Completed',_0x5a9c1c?util['format']('%s.%s',_0x2327d0,_0x5a9c1c?_0x61a1('0x3e'):_0x61a1('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x61a1('0x40')](util[_0x61a1('0x1f')](_0x61a1('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x61a1('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x24c1ce){EXTRACTED_REPORT=_0x24c1ce;return dbH['sequelize'][_0x61a1('0x37')](util[_0x61a1('0x1f')](_0x61a1('0x44'),QUERY),{'type':dbH[_0x61a1('0x33')][_0x61a1('0x35')][_0x61a1('0x36')]});})[_0x61a1('0x31')](extractReport)[_0x61a1('0x45')](function(_0x5e5d42){logger['info'](util[_0x61a1('0x1f')](_0x61a1('0x46'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x5e5d42,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x61a1('0x47'));})[_0x61a1('0x48')](function(){process[_0x61a1('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5d637c=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x61a1('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x61a1('0x4b')}});return _0x5d637c;}function getPDFDocDefinitionFromHTML(_0x4c061e,_0x212a86){var _0x366645=util[_0x61a1('0x1f')](_0x61a1('0x4c'),_0x212a86['channel'],_0x212a86[_0x61a1('0x4d')]);var _0xa198a1=moment()['format'](_0x61a1('0x4e'))[_0x61a1('0x26')]();var _0x5c7518=htmlToPdfmake(_0x4c061e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5c7518],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x61a1('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x61a1('0x50'),'style':_0x61a1('0x51')}];},'footer':function(_0x5ce556,_0x4ffe39){return[{'text':util['format'](_0x61a1('0x52'),_0x366645,_0x5ce556,_0x4ffe39,_0xa198a1),'style':_0x61a1('0x28')}];}};}function writePDFDocument(_0x10fc49,_0x566b00){return new Promise(function(_0x14f91d,_0x55cac7){var _0x57d6d4=_0x10fc49['pipe'](fs[_0x61a1('0x53')](_0x566b00));_0x57d6d4['on'](_0x61a1('0x54'),function(){_0x14f91d(_0x61a1('0x54'));});_0x57d6d4['on']('error',function(_0xd876c2){_0x55cac7(_0xd876c2);});_0x10fc49['end']();});}exports[_0x61a1('0x55')]=function(_0x24dd7a,_0x3f85bc){var _0x24704c=getPDFPrinter();var _0x2fa9e6=getPDFDocDefinitionFromHTML(_0x24dd7a,_0x3f85bc);var _0x32f3df=_0x24704c[_0x61a1('0x56')](_0x2fa9e6);return writePDFDocument(_0x32f3df,_0x3f85bc[_0x61a1('0x1')])[_0x61a1('0x45')](function(_0x55835c){throw _0x55835c;});}; \ No newline at end of file +var _0x8ec1=['YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','path','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','fill','length','auto','body','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','format','endDate','header','pageBreak','before','margin','landscape','toString','footer','Arial','black','right','num','Empty','Setting','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','then','flatten','createPdfKitDocument','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId'];(function(_0x3c40f5,_0x531ec8){var _0x12f638=function(_0x1039f2){while(--_0x1039f2){_0x3c40f5['push'](_0x3c40f5['shift']());}};_0x12f638(++_0x531ec8);}(_0x8ec1,0x1b7));var _0x18ec=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0x8ec1[_0x163691];return _0x543ae5;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x18ec('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x18ec('0x1'));var PdfPrinter=require(_0x18ec('0x2'));var zipdir=require(_0x18ec('0x3'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x18ec('0x4')];var window=new JSDOM('')[_0x18ec('0x5')];var BPromise=require('bluebird');var db=require(_0x18ec('0x6'))['db'];var dbH=require(_0x18ec('0x6'))[_0x18ec('0x7')];var logger=require(_0x18ec('0x8'))(_0x18ec('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x18ec('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x18ec('0xa')][0x4];var NAME=process[_0x18ec('0xa')][0x5];var FORMAT=_0x18ec('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x58f8c7,_0x3e075e){var _0x4b0ef6={'status':_0x58f8c7};var _0x40ff9f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e075e){_0x4b0ef6[_0x18ec('0xc')]=_0x3e075e;}return db[_0x18ec('0xd')]['update'](_0x4b0ef6,_0x40ff9f);}function getHeaders(_0x265095){return _[_0x18ec('0xe')](_0x265095,function(_0x21e711){return{'text':_0x21e711,'style':_0x18ec('0xf')};});}function getRows(_0x2a75f6,_0x4cdeab){return _[_0x18ec('0xe')](_0x4cdeab,function(_0x47790a){return _(_0x47790a)[_0x18ec('0x10')](_0x2a75f6)[_0x18ec('0xe')](function(_0x207fc5){return _0x207fc5?_['toString'](_0x207fc5):'';})['value']();});}function createTable(_0x134f6,_0x95ef98){var _0x1af808={'widths':_[_0x18ec('0x11')](Array(_0x134f6[_0x18ec('0x12')]),0x91),'heights':function(_0x5cb2a7){return _0x5cb2a7===0x0?_0x18ec('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xdb5d97=getHeaders(_0x134f6);_0x1af808[_0x18ec('0x14')]['push'](_0xdb5d97);var _0x328e0e=getRows(_0x134f6,_0x95ef98);_0x1af808[_0x18ec('0x14')]=_0x1af808[_0x18ec('0x14')]['concat'](_0x328e0e);return _0x1af808;}function createTables(_0x17eb10){var _0x5c1f25=[];var _0xef15dc=_['chunk'](Object['keys'](_0x17eb10[0x0]),0x5);_0xef15dc['forEach'](function(_0x437d9e){_0x5c1f25[_0x18ec('0x15')](createTable(_0x437d9e,_0x17eb10));});return _0x5c1f25;}function getPDFDocDefinition(_0xd434cc){var _0x5849d4=util['format'](_0x18ec('0x16'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x18ec('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0x18ec('0x18')])[_0x18ec('0x17')](FORMAT));var _0x5663f8=[];for(var _0x18d7a5=0x0;_0x18d7a5<_0xd434cc['length'];_0x18d7a5++){var _0x319792=[];if(_0x18d7a5===0x0){_0x319792[_0x18ec('0x15')]({'text':_0x5849d4,'style':_0x18ec('0x19')});}var _0x3b7261={'table':_0xd434cc[_0x18d7a5]};if(_0x18d7a5>0x0){_0x3b7261[_0x18ec('0x1a')]=_0x18ec('0x1b');_0x3b7261[_0x18ec('0x1c')]=[0x0,0x46,0x0,0x0];}_0x319792[_0x18ec('0x15')](_0x3b7261);_0x5663f8[_0x18ec('0x15')](_0x319792);}return{'pageSize':'A4','pageOrientation':_0x18ec('0x1d'),'content':_0x5663f8,'footer':function(_0x3c4a37,_0x41e3a4){return{'text':_0x3c4a37[_0x18ec('0x1e')]()+'\x20/\x20'+_0x41e3a4,'style':_0x18ec('0x1f')};},'defaultStyle':{'font':_0x18ec('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x18ec('0x21')},'footer':{'alignment':_0x18ec('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4b6e98){var _0xa90bab=0x1388;var _0x102dcb;if(!_0x4b6e98[0x0][_0x18ec('0x23')]){return analyticExtractedReport(_0x18ec('0x24'));}return db[_0x18ec('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x18ec('0x26'),'splitSizePdf']})['then'](function(_0xa8f4f8){if(_0xa8f4f8){_0x102dcb=_0xa8f4f8;_0xa90bab=_0x102dcb['splitSizePdf']||0x3e8;}})['then'](function(){var _0x272a26=[];var _0x5ee546=0x0;if(_0x102dcb[_0x18ec('0x26')]){if(_0x4b6e98&&_0x4b6e98[_0x18ec('0x12')]){var _0x840101=_[_0x18ec('0x27')](_0x4b6e98[0x0][_0x18ec('0x23')]/_0xa90bab);var _0x1fc5ae=Number[_0x18ec('0x28')](_0x4b6e98[0x0]['num']/_0xa90bab)?_0x4b6e98[0x0]['num']%_0xa90bab:0x0;_0x840101['forEach'](function(_0x10546f){if(_0x10546f>0x0){_0x5ee546+=_0xa90bab;}_0x272a26['push'](dbH[_0x18ec('0x29')][_0x18ec('0x2a')](util[_0x18ec('0x17')](_0x18ec('0x2b'),QUERY,_0xa90bab,_0x5ee546),{'type':dbH[_0x18ec('0x29')][_0x18ec('0x2c')][_0x18ec('0x2d')]}));});if(_0x1fc5ae>0x0){_0x5ee546+=_0xa90bab;_0x272a26[_0x18ec('0x15')](dbH[_0x18ec('0x29')][_0x18ec('0x2a')](util[_0x18ec('0x17')](_0x18ec('0x2b'),QUERY,_0x1fc5ae,_0x5ee546),{'type':dbH[_0x18ec('0x29')][_0x18ec('0x2c')][_0x18ec('0x2d')]}));}}}else{_0x272a26[_0x18ec('0x15')](dbH[_0x18ec('0x29')][_0x18ec('0x2a')](QUERY,{'type':dbH[_0x18ec('0x29')][_0x18ec('0x2c')][_0x18ec('0x2d')]}));}var _0x51e874=path[_0x18ec('0x2e')](PATH);var _0x4a1142=path[_0x18ec('0x2f')](PATH,_0x18ec('0x30'));var _0x358740=_0x102dcb['split']&&_0x272a26['length']>0x1;var _0x2de301=[];if(!fs[_0x18ec('0x31')](path[_0x18ec('0x32')](_0x51e874,_0x4a1142))&&_0x358740){fs[_0x18ec('0x33')](path[_0x18ec('0x32')](_0x51e874,_0x4a1142));}return BPromise[_0x18ec('0x34')](_0x272a26,function(_0x30982f){_0x2de301['push'](_0x30982f);})[_0x18ec('0x35')](function(){var _0x3283fe=[];for(var _0x83204b=0x0;_0x83204b<_0x2de301[_0x18ec('0x12')];_0x83204b+=0x1){var _0x22e6f2=_0x2de301[_0x83204b];var _0x1afaff=createTables(_[_0x18ec('0x36')](_0x22e6f2));var _0x2995eb;var _0x1d24c5=getPDFDocDefinition(_0x1afaff);var _0x4625a2=getPDFPrinter();var _0x77ec42=_0x4625a2[_0x18ec('0x37')](_0x1d24c5);if(_0x358740){_0x2995eb=path[_0x18ec('0x32')](_0x51e874,_0x4a1142,util[_0x18ec('0x17')]('%s%d.%s',_0x4a1142,_0x83204b,'pdf'));}else{_0x2995eb=path[_0x18ec('0x32')](_0x51e874,util[_0x18ec('0x17')]('%s.%s',_0x4a1142,_0x18ec('0x38')));}_0x3283fe['push'](writePDFDocument(_0x77ec42,_0x2995eb));}return Promise[_0x18ec('0x39')](_0x3283fe);})[_0x18ec('0x35')](function(){if(_0x358740){return new Promise(function(_0xc32c9b){zipdir(path[_0x18ec('0x32')](_0x51e874,_0x4a1142),{'saveTo':path['join'](_0x51e874,util['format'](_0x18ec('0x3a'),_0x4a1142,_0x18ec('0x3b')))},function(){rimraf(path['join'](_0x51e874,_0x4a1142),function(){});_0xc32c9b('zip\x20finished');});});}})['then'](function(){if(!_0x358740)return;rimraf(path[_0x18ec('0x32')](_0x51e874,_0x4a1142),function(){});})[_0x18ec('0x35')](function(){logger[_0x18ec('0x3c')](util[_0x18ec('0x17')](_0x18ec('0x3d'),EXTRACTED_REPORT_ID,_0x18ec('0x3e')));return analyticExtractedReport(_0x18ec('0x3f'),_0x358740?util[_0x18ec('0x17')](_0x18ec('0x3a'),_0x4a1142,_0x358740?_0x18ec('0x3b'):_0x18ec('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x18ec('0x17')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x18ec('0x3e')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x18ec('0x35')](function(_0x162f5a){EXTRACTED_REPORT=_0x162f5a;return dbH[_0x18ec('0x29')][_0x18ec('0x2a')](util[_0x18ec('0x17')](_0x18ec('0x40'),QUERY),{'type':dbH[_0x18ec('0x29')][_0x18ec('0x2c')][_0x18ec('0x2d')]});})[_0x18ec('0x35')](extractReport)[_0x18ec('0x41')](function(_0x2c8c35){logger['info'](util[_0x18ec('0x17')](_0x18ec('0x42'),EXTRACTED_REPORT_ID,_0x18ec('0x3e')),util['inspect'](_0x2c8c35,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x18ec('0x43'));})[_0x18ec('0x44')](function(){process[_0x18ec('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x403543=new PdfPrinter({'Arial':{'normal':__dirname+_0x18ec('0x46'),'bold':__dirname+_0x18ec('0x47'),'italics':__dirname+_0x18ec('0x48'),'bolditalics':__dirname+_0x18ec('0x49')}});return _0x403543;}function getPDFDocDefinitionFromHTML(_0x29f2c5,_0x3ee691){var _0x1a9bbf=util['format'](_0x18ec('0x4a'),_0x3ee691[_0x18ec('0x4b')],_0x3ee691[_0x18ec('0x4c')]);var _0x180080=moment()['format'](_0x18ec('0x4d'))['toString']();var _0x57ab3b=htmlToPdfmake(_0x29f2c5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x57ab3b],'defaultStyle':{'font':_0x18ec('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x18ec('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x18ec('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x18ec('0x4e')}},'header':function(){return[{'text':_0x18ec('0x4f'),'style':'header'}];},'footer':function(_0x4f23ae,_0x1fef3f){return[{'text':util[_0x18ec('0x17')](_0x18ec('0x50'),_0x1a9bbf,_0x4f23ae,_0x1fef3f,_0x180080),'style':_0x18ec('0x1f')}];}};}function writePDFDocument(_0x52e3b6,_0x5a3069){return new Promise(function(_0x3d54b5,_0x43390e){var _0x26426a=_0x52e3b6['pipe'](fs[_0x18ec('0x51')](_0x5a3069));_0x26426a['on'](_0x18ec('0x52'),function(){_0x3d54b5(_0x18ec('0x52'));});_0x26426a['on'](_0x18ec('0x53'),function(_0x471f30){_0x43390e(_0x471f30);});_0x52e3b6['end']();});}exports[_0x18ec('0x54')]=function(_0x11deb0,_0x33a45a){var _0x432fc3=getPDFPrinter();var _0x2ad134=getPDFDocDefinitionFromHTML(_0x11deb0,_0x33a45a);var _0x92c485=_0x432fc3[_0x18ec('0x37')](_0x2ad134);return writePDFDocument(_0x92c485,_0x33a45a[_0x18ec('0x55')])[_0x18ec('0x41')](function(_0x4dbdf5){throw _0x4dbdf5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e5274d3..644f1ea 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 _0xe6b8=['mkdirSync','each','%s%d.%s','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','XLSX','Setting','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xe6b8,0x140));var _0x8e6b=function(_0x2f7ab0,_0x3d936c){_0x2f7ab0=_0x2f7ab0-0x0;var _0x1a1eb8=_0xe6b8[_0x2f7ab0];return _0x1a1eb8;};'use strict';var util=require(_0x8e6b('0x0'));var path=require(_0x8e6b('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x8e6b('0x2'));var BPromise=require(_0x8e6b('0x3'));var zipdir=require(_0x8e6b('0x4'));var rimraf=require(_0x8e6b('0x5'));var db=require(_0x8e6b('0x6'))['db'];var dbH=require('../../mysqldb')[_0x8e6b('0x7')];var logger=require(_0x8e6b('0x8'))(_0x8e6b('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8e6b('0xa')][0x2]);var QUERY=process[_0x8e6b('0xa')][0x3];var PATH=process[_0x8e6b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x93ecbf,_0x16f6f9){var _0x3ac82b={'status':_0x93ecbf};var _0x31cd03={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16f6f9){_0x3ac82b[_0x8e6b('0xb')]=_0x16f6f9;}return db[_0x8e6b('0xc')][_0x8e6b('0xd')](_0x3ac82b,_0x31cd03);}function main(){var _0x40f0a3=0x1388;var _0x4ecd99;logger[_0x8e6b('0xe')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8e6b('0xf')));return db[_0x8e6b('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8e6b('0x11')]})[_0x8e6b('0x12')](function(_0x4953b6){if(_0x4953b6){_0x4ecd99=_0x4953b6;_0x40f0a3=_0x4ecd99[_0x8e6b('0x11')]||0x1388;}})[_0x8e6b('0x12')](function(){return dbH[_0x8e6b('0x13')][_0x8e6b('0x14')](util[_0x8e6b('0x15')](_0x8e6b('0x16'),QUERY),{'type':dbH['sequelize'][_0x8e6b('0x17')][_0x8e6b('0x18')]});})[_0x8e6b('0x12')](function(_0x1d2d8c){if(!_0x1d2d8c[0x0][_0x8e6b('0x19')]){return analyticExtractedReport('Empty');}var _0x23cec3=[];var _0x3edb26=0x0;if(_0x4ecd99[_0x8e6b('0x1a')]){if(_0x1d2d8c&&_0x1d2d8c[_0x8e6b('0x1b')]){var _0x52ad5a=_[_0x8e6b('0x1c')](_0x1d2d8c[0x0][_0x8e6b('0x19')]/_0x40f0a3);var _0x36a081=Number[_0x8e6b('0x1d')](_0x1d2d8c[0x0][_0x8e6b('0x19')]/_0x40f0a3)?_0x1d2d8c[0x0][_0x8e6b('0x19')]%_0x40f0a3:0x0;_0x52ad5a[_0x8e6b('0x1e')](function(_0xbe88aa){if(_0xbe88aa>0x0){_0x3edb26+=_0x40f0a3;}_0x23cec3[_0x8e6b('0x1f')](dbH[_0x8e6b('0x13')][_0x8e6b('0x14')](util['format'](_0x8e6b('0x20'),QUERY,_0x40f0a3,_0x3edb26),{'type':dbH[_0x8e6b('0x13')][_0x8e6b('0x17')]['SELECT']}));});if(_0x36a081>0x0){_0x3edb26+=_0x40f0a3;_0x23cec3[_0x8e6b('0x1f')](dbH[_0x8e6b('0x13')][_0x8e6b('0x14')](util['format'](_0x8e6b('0x20'),QUERY,_0x36a081,_0x3edb26),{'type':dbH[_0x8e6b('0x13')][_0x8e6b('0x17')]['SELECT']}));}}}else{_0x23cec3['push'](dbH['sequelize'][_0x8e6b('0x14')](QUERY,{'type':dbH['sequelize'][_0x8e6b('0x17')][_0x8e6b('0x18')]}));}var _0x452641=path['dirname'](PATH);var _0x48f28e=path[_0x8e6b('0x21')](PATH,_0x8e6b('0x22'));var _0x268d5e=_0x4ecd99[_0x8e6b('0x1a')]&&_0x23cec3[_0x8e6b('0x1b')]>0x1;var _0x43f64b=[];if(!fs[_0x8e6b('0x23')](path[_0x8e6b('0x24')](_0x452641,_0x48f28e))&&_0x268d5e){fs[_0x8e6b('0x25')](path['join'](_0x452641,_0x48f28e));}return BPromise[_0x8e6b('0x26')](_0x23cec3,function(_0x4835da){_0x43f64b[_0x8e6b('0x1f')](_0x4835da);})[_0x8e6b('0x12')](function(){for(var _0x33ca16=0x0;_0x33ca16<_0x43f64b[_0x8e6b('0x1b')];_0x33ca16+=0x1){var _0x5d5d0f;var _0x1d942f=_0x43f64b[_0x33ca16];if(_0x268d5e){_0x5d5d0f=path['join'](_0x452641,_0x48f28e,util[_0x8e6b('0x15')](_0x8e6b('0x27'),_0x48f28e,_0x33ca16,'xlsx'));}else{_0x5d5d0f=path[_0x8e6b('0x24')](_0x452641,util[_0x8e6b('0x15')]('%s.%s',_0x48f28e,'xlsx'));}fs[_0x8e6b('0x28')](_0x5d5d0f,json2xls(_0x1d942f),_0x8e6b('0x29'));}})[_0x8e6b('0x12')](function(){if(_0x268d5e){return new Promise(function(_0x2cc3ee){zipdir(path[_0x8e6b('0x24')](_0x452641,_0x48f28e),{'saveTo':path[_0x8e6b('0x24')](_0x452641,util['format'](_0x8e6b('0x2a'),_0x48f28e,_0x8e6b('0x2b')))},function(_0x453796,_0x557edb){rimraf(path['join'](_0x452641,_0x48f28e),function(){});_0x2cc3ee(_0x8e6b('0x2c'));});});}})[_0x8e6b('0x12')](function(){logger[_0x8e6b('0xe')](util[_0x8e6b('0x15')](_0x8e6b('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x8e6b('0x2e'),_0x268d5e?util['format'](_0x8e6b('0x2a'),_0x48f28e,_0x268d5e?'zip':'xlsx'):null);});})['catch'](function(_0x3da719){logger[_0x8e6b('0xe')](util[_0x8e6b('0x15')](_0x8e6b('0x2f'),EXTRACTED_REPORT_ID,_0x8e6b('0xf')),util[_0x8e6b('0x30')](_0x3da719,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8e6b('0x31'));})['finally'](function(){process[_0x8e6b('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2c38=['each','%s%d.%s','binary','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x2c38,0x109));var _0x82c3=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0x2c38[_0x4001ad];return _0x4c7ec2;};'use strict';var util=require(_0x82c3('0x0'));var path=require(_0x82c3('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x82c3('0x2'));var zipdir=require(_0x82c3('0x3'));var rimraf=require(_0x82c3('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x82c3('0x5'))[_0x82c3('0x6')];var logger=require(_0x82c3('0x7'))(_0x82c3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x82c3('0x9')][0x2]);var QUERY=process[_0x82c3('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x17281a,_0x206674){var _0x371d87={'status':_0x17281a};var _0x588b32={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x206674){_0x371d87[_0x82c3('0xa')]=_0x206674;}return db['AnalyticExtractedReport'][_0x82c3('0xb')](_0x371d87,_0x588b32);}function main(){var _0x888440=0x1388;var _0x55c1fb;logger['info'](util[_0x82c3('0xc')](_0x82c3('0xd'),EXTRACTED_REPORT_ID,_0x82c3('0xe')));return db[_0x82c3('0xf')][_0x82c3('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x82c3('0x11')]})[_0x82c3('0x12')](function(_0x141799){if(_0x141799){_0x55c1fb=_0x141799;_0x888440=_0x55c1fb[_0x82c3('0x11')]||0x1388;}})['then'](function(){return dbH[_0x82c3('0x13')][_0x82c3('0x14')](util[_0x82c3('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x82c3('0x13')][_0x82c3('0x15')][_0x82c3('0x16')]});})['then'](function(_0x295d2f){if(!_0x295d2f[0x0][_0x82c3('0x17')]){return analyticExtractedReport(_0x82c3('0x18'));}var _0x56bdc9=[];var _0x29ce2c=0x0;if(_0x55c1fb[_0x82c3('0x19')]){if(_0x295d2f&&_0x295d2f[_0x82c3('0x1a')]){var _0x1ca915=_[_0x82c3('0x1b')](_0x295d2f[0x0][_0x82c3('0x17')]/_0x888440);var _0xa2ca3=Number[_0x82c3('0x1c')](_0x295d2f[0x0][_0x82c3('0x17')]/_0x888440)?_0x295d2f[0x0]['num']%_0x888440:0x0;_0x1ca915['forEach'](function(_0xcac56e){if(_0xcac56e>0x0){_0x29ce2c+=_0x888440;}_0x56bdc9[_0x82c3('0x1d')](dbH[_0x82c3('0x13')][_0x82c3('0x14')](util[_0x82c3('0xc')](_0x82c3('0x1e'),QUERY,_0x888440,_0x29ce2c),{'type':dbH['sequelize'][_0x82c3('0x15')][_0x82c3('0x16')]}));});if(_0xa2ca3>0x0){_0x29ce2c+=_0x888440;_0x56bdc9[_0x82c3('0x1d')](dbH['sequelize'][_0x82c3('0x14')](util[_0x82c3('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa2ca3,_0x29ce2c),{'type':dbH[_0x82c3('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x56bdc9['push'](dbH[_0x82c3('0x13')][_0x82c3('0x14')](QUERY,{'type':dbH[_0x82c3('0x13')][_0x82c3('0x15')][_0x82c3('0x16')]}));}var _0x41379d=path[_0x82c3('0x1f')](PATH);var _0x25e4ec=path[_0x82c3('0x20')](PATH,'.xlsx');var _0x4923e3=_0x55c1fb['split']&&_0x56bdc9[_0x82c3('0x1a')]>0x1;var _0x4ef008=[];if(!fs['existsSync'](path[_0x82c3('0x21')](_0x41379d,_0x25e4ec))&&_0x4923e3){fs[_0x82c3('0x22')](path[_0x82c3('0x21')](_0x41379d,_0x25e4ec));}return BPromise[_0x82c3('0x23')](_0x56bdc9,function(_0x34c4bd){_0x4ef008['push'](_0x34c4bd);})[_0x82c3('0x12')](function(){for(var _0x4692f4=0x0;_0x4692f4<_0x4ef008[_0x82c3('0x1a')];_0x4692f4+=0x1){var _0x3d3445;var _0x11b118=_0x4ef008[_0x4692f4];if(_0x4923e3){_0x3d3445=path[_0x82c3('0x21')](_0x41379d,_0x25e4ec,util[_0x82c3('0xc')](_0x82c3('0x24'),_0x25e4ec,_0x4692f4,'xlsx'));}else{_0x3d3445=path[_0x82c3('0x21')](_0x41379d,util[_0x82c3('0xc')]('%s.%s',_0x25e4ec,'xlsx'));}fs['writeFileSync'](_0x3d3445,json2xls(_0x11b118),_0x82c3('0x25'));}})[_0x82c3('0x12')](function(){if(_0x4923e3){return new Promise(function(_0x60ba79){zipdir(path[_0x82c3('0x21')](_0x41379d,_0x25e4ec),{'saveTo':path['join'](_0x41379d,util[_0x82c3('0xc')](_0x82c3('0x26'),_0x25e4ec,_0x82c3('0x27')))},function(_0x22470e,_0xbed43){rimraf(path[_0x82c3('0x21')](_0x41379d,_0x25e4ec),function(){});_0x60ba79(_0x82c3('0x28'));});});}})[_0x82c3('0x12')](function(){logger[_0x82c3('0x29')](util['format'](_0x82c3('0x2a'),EXTRACTED_REPORT_ID,_0x82c3('0xe')));return analyticExtractedReport(_0x82c3('0x2b'),_0x4923e3?util['format'](_0x82c3('0x26'),_0x25e4ec,_0x4923e3?_0x82c3('0x27'):_0x82c3('0x2c')):null);});})[_0x82c3('0x2d')](function(_0x35ecdb){logger[_0x82c3('0x29')](util[_0x82c3('0xc')](_0x82c3('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x35ecdb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x82c3('0x2f'));})[_0x82c3('0x30')](function(){process[_0x82c3('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 89a5177..ce3d868 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 _0x24f8=['find','extensions','push','Set','format','CDR(type)=%s','type','CDR(routeid)=','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','interval','*,*,*,*','map','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x24f8,0x1a6));var _0x824f=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x24f8[_0x2fe689];return _0x35ea44;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x25a352,_0x3d73c6){var _0x141015=this;return _0x25a352[_0x824f('0x0')][_0x824f('0x1')][_0x824f('0x2')]({'raw':!![]})['then'](function(_0x16c29e){_0x141015[_0x824f('0x3')]=_0x16c29e;return _0x25a352['models'][_0x824f('0x4')]['findAll']({'where':{'IntervalId':_0x3d73c6[_0x824f('0x5')]},'raw':!![]});})[_0x824f('0x6')](function(_0x55cd2f){return _0x25a352[_0x824f('0x0')][_0x824f('0x4')][_0x824f('0x2')]({'where':{'exten':{'$in':_[_0x824f('0x7')](_['map'](_0x55cd2f,_0x824f('0x8')))}},'order':[{'raw':_0x824f('0x9')}],'raw':!![]});})[_0x824f('0x6')](function(_0x720d61){var _0x33d57e=_[_0x824f('0xa')](_0x720d61,{'priority':'1'});var _0x58a847=_[_0x824f('0xa')](_0x720d61,{'isApp':0x1});var _0x175edc=_[_0x824f('0xb')](_0x58a847,_0x824f('0x8'));var _0x513d60=[_0x824f('0xc'),_0x824f('0xd')];var _0x83972=[];var _0x3266b8=[];for(var _0x1fc0b8 in _0x175edc){if(_0x175edc['hasOwnProperty'](_0x1fc0b8)){_0x141015[_0x824f('0xe')]=0x2;_0x141015['extensions']=[];_0x141015[_0x824f('0xf')]=_[_0x824f('0x10')](_0x33d57e,{'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')]});_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0]['type'],'app':_0x824f('0x13'),'appdata':util[_0x824f('0x14')](_0x824f('0x15'),_0x175edc[_0x1fc0b8][0x0]['type']),'context':_0x175edc[_0x1fc0b8][0x0]['context'],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0]['VoiceExtensionId']});if(_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')]==='inbound'){_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':_0x824f('0x13'),'appdata':_0x824f('0x17')+_0x175edc[_0x1fc0b8][0x0]['VoiceExtensionId'],'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});}else if(_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')]===_0x824f('0x1a')){if(_0x141015[_0x824f('0xf')]){_0x141015['extensions']['push']({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':_0x824f('0x13'),'appdata':_0x824f('0x1b')+(_0x141015['extension'][_0x824f('0x1c')]?_0x824f('0x1d')+_0x141015[_0x824f('0xf')][_0x824f('0x1c')]+'}':'${EXTEN}'),'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});}_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':_0x824f('0x13'),'appdata':_0x824f('0x17')+_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')],'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'exten':_0x175edc[_0x1fc0b8][0x0]['exten'],'priority':_0x141015['priority']++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});var _0x146dff=_0x141015[_0x824f('0xe')]++;_0x141015['extensions']['push']({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':_0x824f('0x1e'),'appdata':_0x824f('0x1f')+(_0x146dff+0x2)+'):Goto('+(_0x146dff+0x1)+')','context':_0x175edc[_0x1fc0b8][0x0]['context'],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x146dff,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0]['VoiceExtensionId']});if(_0x141015[_0x824f('0xf')]){_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':_0x824f('0x13'),'appdata':_0x141015[_0x824f('0xf')][_0x824f('0x1c')]?_0x824f('0x20')+_0x141015[_0x824f('0xf')][_0x824f('0x1c')]+'}':_0x824f('0x21'),'context':_0x175edc[_0x1fc0b8][0x0]['context'],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});}_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0]['type'],'app':_0x824f('0x13'),'appdata':_0x824f('0x22')+_0x175edc[_0x1fc0b8][0x0]['VoiceExtensionId'],'context':_0x175edc[_0x1fc0b8][0x0]['context'],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});if(_0x141015[_0x824f('0xf')]&&_0x141015[_0x824f('0xf')][_0x824f('0x23')](_0x824f('0x24'))&&_0x141015['extension'][_0x824f('0x24')]!==_0x824f('0x25')){_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':_0x824f('0x13'),'appdata':_0x824f('0x26'),'context':_0x175edc[_0x1fc0b8][0x0]['context'],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015['priority']++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0]['type'],'app':_0x824f('0x13'),'appdata':_0x824f('0x27')+_0x141015[_0x824f('0xf')][_0x824f('0x24')]||_0x824f('0x28'),'context':_0x175edc[_0x1fc0b8][0x0]['context'],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015['priority']++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});}}_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':'Set','appdata':_0x824f('0x29'),'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0]['type'],'app':_0x824f('0x13'),'appdata':_0x824f('0x2a'),'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'exten':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x8')],'priority':_0x141015['priority']++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});_0x141015['extensions'][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x16')],'app':'Set','appdata':_0x824f('0x2b'),'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'exten':_0x175edc[_0x1fc0b8][0x0]['exten'],'priority':_0x141015[_0x824f('0xe')]++,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});for(var _0x3ca47c=0x0,_0x2771d2=0x0;_0x3ca47c<_0x175edc[_0x1fc0b8]['length'];_0x3ca47c+=0x1,_0x2771d2=0x0){var _0x25c55c=_0x175edc[_0x1fc0b8][_0x3ca47c];if(_0x25c55c[_0x824f('0x16')]){_0x25c55c['type']=_0x25c55c[_0x824f('0x16')]['toLowerCase']();}var _0x5d7b76=[];var _0x310761=[];delete _0x25c55c['id'];delete _0x25c55c[_0x824f('0x2c')];delete _0x25c55c['updatedAt'];var _0x11f0b5=_0x25c55c[_0x824f('0x2d')]!==_0x824f('0x2e')?[_0x25c55c[_0x824f('0x2d')]]:_0x25c55c[_0x824f('0x5')]?_[_0x824f('0x2f')](_[_0x824f('0xa')](_0x141015[_0x824f('0x3')],{'IntervalId':_0x25c55c[_0x824f('0x5')]}),_0x824f('0x2d')):[];if(_0x25c55c[_0x824f('0x23')](_0x824f('0x30'))){if(_0x25c55c[_0x824f('0x30')]&&_0x25c55c[_0x824f('0x30')]!=='--'){_0x5d7b76['push']({'type':_0x25c55c[_0x824f('0x16')],'app':_0x824f('0x13'),'appdata':_0x824f('0x31')+_0x25c55c['tag'],'context':_0x25c55c[_0x824f('0x18')],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5[_0x824f('0x32')]+_0x141015[_0x824f('0xe')]+_0x2771d2++,'VoiceExtensionId':_0x25c55c[_0x824f('0x19')]});}}if(_0x25c55c[_0x824f('0x16')]==='outbound'&&_0x25c55c[_0x824f('0x23')](_0x824f('0x33'))){if(_0x25c55c['callerID']){_0x5d7b76[_0x824f('0x12')]({'type':_0x25c55c[_0x824f('0x16')],'app':_0x824f('0x1e'),'appdata':_0x824f('0x34')+_0x25c55c[_0x824f('0x33')]+')','context':_0x25c55c['context'],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5[_0x824f('0x32')]+_0x141015['priority']+_0x2771d2++,'VoiceExtensionId':_0x25c55c['VoiceExtensionId']});}else{_0x5d7b76['push']({'type':_0x25c55c[_0x824f('0x16')],'app':_0x824f('0x1e'),'appdata':_0x824f('0x35'),'context':_0x25c55c[_0x824f('0x18')],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5[_0x824f('0x32')]+_0x141015[_0x824f('0xe')]+_0x2771d2++,'VoiceExtensionId':_0x25c55c[_0x824f('0x19')]});}}if(_0x25c55c[_0x824f('0x23')](_0x824f('0x36'))){if(_0x513d60[_0x824f('0x37')](_0x25c55c[_0x824f('0x38')][_0x824f('0x39')]())>=0x0&&_0x25c55c[_0x824f('0x3a')]!==_0x824f('0x3b')){if(_0x25c55c[_0x824f('0x36')]){_0x5d7b76[_0x824f('0x12')]({'type':_0x25c55c[_0x824f('0x16')],'app':'ExecIf','appdata':_0x824f('0x3c'),'context':_0x25c55c['context'],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5['length']+_0x141015['priority']+_0x2771d2++,'VoiceExtensionId':_0x25c55c[_0x824f('0x19')]});_0x5d7b76[_0x824f('0x12')]({'type':_0x25c55c['type'],'app':_0x824f('0x13'),'appdata':_0x824f('0x3d'),'context':_0x25c55c[_0x824f('0x18')],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5[_0x824f('0x32')]+_0x141015[_0x824f('0xe')]+_0x2771d2++,'VoiceExtensionId':_0x25c55c[_0x824f('0x19')]});}else{_0x5d7b76[_0x824f('0x12')]({'type':_0x25c55c[_0x824f('0x16')],'app':_0x824f('0x1e'),'appdata':_0x824f('0x3e'),'context':_0x25c55c[_0x824f('0x18')],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5[_0x824f('0x32')]+_0x141015[_0x824f('0xe')]+_0x2771d2++,'VoiceExtensionId':_0x25c55c[_0x824f('0x19')]});_0x5d7b76[_0x824f('0x12')]({'type':_0x25c55c[_0x824f('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x25c55c[_0x824f('0x18')],'exten':_0x25c55c[_0x824f('0x8')],'priority':_0x11f0b5[_0x824f('0x32')]+_0x141015[_0x824f('0xe')]+_0x2771d2++,'VoiceExtensionId':_0x25c55c['VoiceExtensionId']});}}}for(var _0x3aa06b=0x0;_0x3aa06b<_0x11f0b5['length'];_0x3aa06b+=0x1){var _0x1890ba=_0x141015[_0x824f('0xe')]+_0x11f0b5['length'];var _0x169630=_0x3aa06b===_0x11f0b5['length']-0x1?_0x141015[_0x824f('0xe')]+_0x5d7b76[_0x824f('0x32')]+_0x310761[_0x824f('0x32')]+0x2:_0x141015[_0x824f('0xe')]+_0x3aa06b+0x1;_0x5d7b76[_0x824f('0x3f')](_0x3aa06b,0x0,{'type':_0x25c55c[_0x824f('0x16')],'app':'GotoIfTime','appdata':_0x11f0b5[_0x3aa06b]+'?'+_0x25c55c['context']+_0x824f('0x40')+_0x1890ba+':'+_0x25c55c['context']+_0x824f('0x40')+_0x169630,'exten':_0x25c55c[_0x824f('0x8')],'context':_0x25c55c['context'],'priority':_0x141015[_0x824f('0xe')]+_0x3aa06b,'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0]['VoiceExtensionId']});}_0x25c55c[_0x824f('0xe')]=_0x5d7b76['length']?_['last'](_0x5d7b76)[_0x824f('0xe')]+0x1:_0x141015[_0x824f('0xe')];_0x141015[_0x824f('0xe')]=(_0x310761[_0x824f('0x32')]?_['last'](_0x310761)[_0x824f('0xe')]:_0x25c55c[_0x824f('0xe')])+0x1;_0x141015[_0x824f('0x11')]=_[_0x824f('0x41')](_0x141015[_0x824f('0x11')],_0x5d7b76,[_0x25c55c],_0x310761);}_0x141015[_0x824f('0x11')][_0x824f('0x12')]({'type':_0x175edc[_0x1fc0b8][0x0]['type'],'app':_0x824f('0x42'),'exten':_0x175edc[_0x1fc0b8][0x0]['exten'],'context':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x18')],'priority':_0x141015[_0x824f('0xe')],'VoiceExtensionId':_0x175edc[_0x1fc0b8][0x0][_0x824f('0x19')]});_0x83972[_0x824f('0x12')](_0x175edc[_0x1fc0b8][0x0]['VoiceExtensionId']);_0x3266b8=_['concat'](_0x3266b8,_0x141015['extensions']);}}return _0x25a352[_0x824f('0x43')](function(_0x23b765){return _0x25a352[_0x824f('0x0')][_0x824f('0x4')][_0x824f('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x83972}},'transaction':_0x23b765})['then'](function(_0x16cbc0){return _0x25a352[_0x824f('0x0')][_0x824f('0x4')]['bulkCreate'](_[_0x824f('0x45')](_0x3266b8,'priority'),{'transaction':_0x23b765});});});})[_0x824f('0x46')](function(_0x4b1d61){console[_0x824f('0x47')](_0x4b1d61);});}exports[_0x824f('0x48')]=rewrite; \ No newline at end of file +var _0x69b3=['inbound','push','CDR(routeid)=','VoiceExtensionId','context','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=noprefix','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','createdAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','length','callerID','ExecIf','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','bulkCreate','catch','error','rewrite','util','models','Interval','findAll','IntervalId','then','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','extensions','extension','find','type','Set','format','CDR(type)=%s','priority'];(function(_0x4c4370,_0x2540bf){var _0x51e35a=function(_0x2b48df){while(--_0x2b48df){_0x4c4370['push'](_0x4c4370['shift']());}};_0x51e35a(++_0x2540bf);}(_0x69b3,0x176));var _0x369b=function(_0x4c2b28,_0x3f5183){_0x4c2b28=_0x4c2b28-0x0;var _0x135c8f=_0x69b3[_0x4c2b28];return _0x135c8f;};'use strict';var _=require('lodash');var util=require(_0x369b('0x0'));function rewrite(_0x3e68ac,_0x559f96){var _0x471220=this;return _0x3e68ac[_0x369b('0x1')][_0x369b('0x2')][_0x369b('0x3')]({'raw':!![]})['then'](function(_0x3c5ecf){_0x471220['intervals']=_0x3c5ecf;return _0x3e68ac[_0x369b('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x559f96[_0x369b('0x4')]},'raw':!![]});})[_0x369b('0x5')](function(_0xdece32){return _0x3e68ac['models'][_0x369b('0x6')][_0x369b('0x3')]({'where':{'exten':{'$in':_[_0x369b('0x7')](_[_0x369b('0x8')](_0xdece32,_0x369b('0x9')))}},'order':[{'raw':_0x369b('0xa')}],'raw':!![]});})[_0x369b('0x5')](function(_0x2db578){var _0x12cf87=_[_0x369b('0xb')](_0x2db578,{'priority':'1'});var _0x30c769=_[_0x369b('0xb')](_0x2db578,{'isApp':0x1});var _0x79f21d=_['groupBy'](_0x30c769,_0x369b('0x9'));var _0x156120=['queue',_0x369b('0xc')];var _0x155d77=[];var _0x1cb13d=[];for(var _0x21b089 in _0x79f21d){if(_0x79f21d[_0x369b('0xd')](_0x21b089)){_0x471220['priority']=0x2;_0x471220[_0x369b('0xe')]=[];_0x471220[_0x369b('0xf')]=_[_0x369b('0x10')](_0x12cf87,{'exten':_0x79f21d[_0x21b089][0x0]['exten']});_0x471220[_0x369b('0xe')]['push']({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':util[_0x369b('0x13')](_0x369b('0x14'),_0x79f21d[_0x21b089][0x0][_0x369b('0x11')]),'context':_0x79f21d[_0x21b089][0x0]['context'],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0]['VoiceExtensionId']});if(_0x79f21d[_0x21b089][0x0][_0x369b('0x11')]===_0x369b('0x16')){_0x471220[_0x369b('0xe')][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x18')+_0x79f21d[_0x21b089][0x0][_0x369b('0x19')],'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220['priority']++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});}else if(_0x79f21d[_0x21b089][0x0][_0x369b('0x11')]===_0x369b('0x1b')){if(_0x471220[_0x369b('0xf')]){_0x471220['extensions'][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':'Set','appdata':_0x369b('0x1c')+(_0x471220[_0x369b('0xf')]['cutdigits']?_0x369b('0x1d')+_0x471220[_0x369b('0xf')]['cutdigits']+'}':_0x369b('0x1e')),'context':_0x79f21d[_0x21b089][0x0]['context'],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});}_0x471220[_0x369b('0xe')][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x18')+_0x79f21d[_0x21b089][0x0][_0x369b('0x19')],'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0]['exten'],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});var _0x550244=_0x471220[_0x369b('0x15')]++;_0x471220['extensions'][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':'ExecIf','appdata':_0x369b('0x1f')+(_0x550244+0x2)+_0x369b('0x20')+(_0x550244+0x1)+')','context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0]['exten'],'priority':_0x550244,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0]['VoiceExtensionId']});if(_0x471220[_0x369b('0xf')]){_0x471220['extensions'][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0]['type'],'app':'Set','appdata':_0x471220[_0x369b('0xf')][_0x369b('0x21')]?'CDR(prefix)=${EXTEN:0:'+_0x471220[_0x369b('0xf')][_0x369b('0x21')]+'}':_0x369b('0x22'),'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220['priority']++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0]['VoiceExtensionId']});}_0x471220[_0x369b('0xe')][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':'Set','appdata':'outboundrouteid='+_0x79f21d[_0x21b089][0x0][_0x369b('0x19')],'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});if(_0x471220[_0x369b('0xf')]&&_0x471220[_0x369b('0xf')][_0x369b('0xd')]('recordingFormat')&&_0x471220[_0x369b('0xf')]['recordingFormat']!=='none'){_0x471220[_0x369b('0xe')][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x23'),'context':_0x79f21d[_0x21b089][0x0]['context'],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220['priority']++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0]['VoiceExtensionId']});_0x471220[_0x369b('0xe')][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':'Set','appdata':_0x369b('0x24')+_0x471220[_0x369b('0xf')]['recordingFormat']||'wav','context':_0x79f21d[_0x21b089][0x0]['context'],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220['priority']++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});}}_0x471220[_0x369b('0xe')]['push']({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':'Set','appdata':_0x369b('0x25'),'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});_0x471220[_0x369b('0xe')][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});_0x471220[_0x369b('0xe')]['push']({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x26'),'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'exten':_0x79f21d[_0x21b089][0x0]['exten'],'priority':_0x471220[_0x369b('0x15')]++,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});for(var _0xc7d702=0x0,_0x5235ba=0x0;_0xc7d702<_0x79f21d[_0x21b089]['length'];_0xc7d702+=0x1,_0x5235ba=0x0){var _0x46c769=_0x79f21d[_0x21b089][_0xc7d702];if(_0x46c769[_0x369b('0x11')]){_0x46c769[_0x369b('0x11')]=_0x46c769[_0x369b('0x11')]['toLowerCase']();}var _0x31838e=[];var _0x3b4ff2=[];delete _0x46c769['id'];delete _0x46c769[_0x369b('0x27')];delete _0x46c769['updatedAt'];var _0x465021=_0x46c769[_0x369b('0x28')]!==_0x369b('0x29')?[_0x46c769[_0x369b('0x28')]]:_0x46c769[_0x369b('0x4')]?_[_0x369b('0x8')](_[_0x369b('0xb')](_0x471220[_0x369b('0x2a')],{'IntervalId':_0x46c769[_0x369b('0x4')]}),_0x369b('0x28')):[];if(_0x46c769['hasOwnProperty'](_0x369b('0x2b'))){if(_0x46c769[_0x369b('0x2b')]&&_0x46c769[_0x369b('0x2b')]!=='--'){_0x31838e[_0x369b('0x17')]({'type':_0x46c769[_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x2c')+_0x46c769[_0x369b('0x2b')],'context':_0x46c769['context'],'exten':_0x46c769[_0x369b('0x9')],'priority':_0x465021[_0x369b('0x2d')]+_0x471220[_0x369b('0x15')]+_0x5235ba++,'VoiceExtensionId':_0x46c769[_0x369b('0x19')]});}}if(_0x46c769[_0x369b('0x11')]===_0x369b('0x1b')&&_0x46c769[_0x369b('0xd')]('callerID')){if(_0x46c769[_0x369b('0x2e')]){_0x31838e[_0x369b('0x17')]({'type':_0x46c769[_0x369b('0x11')],'app':_0x369b('0x2f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x46c769[_0x369b('0x2e')]+')','context':_0x46c769[_0x369b('0x1a')],'exten':_0x46c769[_0x369b('0x9')],'priority':_0x465021[_0x369b('0x2d')]+_0x471220['priority']+_0x5235ba++,'VoiceExtensionId':_0x46c769[_0x369b('0x19')]});}else{_0x31838e[_0x369b('0x17')]({'type':_0x46c769[_0x369b('0x11')],'app':_0x369b('0x2f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x46c769[_0x369b('0x1a')],'exten':_0x46c769[_0x369b('0x9')],'priority':_0x465021['length']+_0x471220[_0x369b('0x15')]+_0x5235ba++,'VoiceExtensionId':_0x46c769[_0x369b('0x19')]});}}if(_0x46c769[_0x369b('0xd')](_0x369b('0x30'))){if(_0x156120[_0x369b('0x31')](_0x46c769[_0x369b('0x32')]['toLowerCase']())>=0x0&&_0x46c769['appType']!==_0x369b('0x33')){if(_0x46c769['answer']){_0x31838e[_0x369b('0x17')]({'type':_0x46c769['type'],'app':'ExecIf','appdata':_0x369b('0x34'),'context':_0x46c769['context'],'exten':_0x46c769[_0x369b('0x9')],'priority':_0x465021['length']+_0x471220[_0x369b('0x15')]+_0x5235ba++,'VoiceExtensionId':_0x46c769['VoiceExtensionId']});_0x31838e[_0x369b('0x17')]({'type':_0x46c769[_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x35'),'context':_0x46c769[_0x369b('0x1a')],'exten':_0x46c769['exten'],'priority':_0x465021[_0x369b('0x2d')]+_0x471220[_0x369b('0x15')]+_0x5235ba++,'VoiceExtensionId':_0x46c769[_0x369b('0x19')]});}else{_0x31838e[_0x369b('0x17')]({'type':_0x46c769['type'],'app':_0x369b('0x2f'),'appdata':_0x369b('0x36'),'context':_0x46c769[_0x369b('0x1a')],'exten':_0x46c769[_0x369b('0x9')],'priority':_0x465021['length']+_0x471220[_0x369b('0x15')]+_0x5235ba++,'VoiceExtensionId':_0x46c769['VoiceExtensionId']});_0x31838e['push']({'type':_0x46c769[_0x369b('0x11')],'app':_0x369b('0x12'),'appdata':_0x369b('0x37'),'context':_0x46c769[_0x369b('0x1a')],'exten':_0x46c769[_0x369b('0x9')],'priority':_0x465021[_0x369b('0x2d')]+_0x471220[_0x369b('0x15')]+_0x5235ba++,'VoiceExtensionId':_0x46c769[_0x369b('0x19')]});}}}for(var _0x467bc3=0x0;_0x467bc3<_0x465021[_0x369b('0x2d')];_0x467bc3+=0x1){var _0x196162=_0x471220[_0x369b('0x15')]+_0x465021[_0x369b('0x2d')];var _0x1f35e3=_0x467bc3===_0x465021[_0x369b('0x2d')]-0x1?_0x471220[_0x369b('0x15')]+_0x31838e['length']+_0x3b4ff2[_0x369b('0x2d')]+0x2:_0x471220['priority']+_0x467bc3+0x1;_0x31838e[_0x369b('0x38')](_0x467bc3,0x0,{'type':_0x46c769['type'],'app':_0x369b('0x39'),'appdata':_0x465021[_0x467bc3]+'?'+_0x46c769[_0x369b('0x1a')]+_0x369b('0x3a')+_0x196162+':'+_0x46c769['context']+_0x369b('0x3a')+_0x1f35e3,'exten':_0x46c769[_0x369b('0x9')],'context':_0x46c769['context'],'priority':_0x471220['priority']+_0x467bc3,'VoiceExtensionId':_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]});}_0x46c769['priority']=_0x31838e[_0x369b('0x2d')]?_['last'](_0x31838e)[_0x369b('0x15')]+0x1:_0x471220['priority'];_0x471220[_0x369b('0x15')]=(_0x3b4ff2[_0x369b('0x2d')]?_[_0x369b('0x3b')](_0x3b4ff2)[_0x369b('0x15')]:_0x46c769['priority'])+0x1;_0x471220[_0x369b('0xe')]=_['concat'](_0x471220['extensions'],_0x31838e,[_0x46c769],_0x3b4ff2);}_0x471220['extensions'][_0x369b('0x17')]({'type':_0x79f21d[_0x21b089][0x0][_0x369b('0x11')],'app':_0x369b('0x3c'),'exten':_0x79f21d[_0x21b089][0x0][_0x369b('0x9')],'context':_0x79f21d[_0x21b089][0x0][_0x369b('0x1a')],'priority':_0x471220[_0x369b('0x15')],'VoiceExtensionId':_0x79f21d[_0x21b089][0x0]['VoiceExtensionId']});_0x155d77[_0x369b('0x17')](_0x79f21d[_0x21b089][0x0][_0x369b('0x19')]);_0x1cb13d=_['concat'](_0x1cb13d,_0x471220[_0x369b('0xe')]);}}return _0x3e68ac[_0x369b('0x3d')](function(_0x13e3bb){return _0x3e68ac[_0x369b('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x155d77}},'transaction':_0x13e3bb})[_0x369b('0x5')](function(_0x284ebc){return _0x3e68ac['models'][_0x369b('0x6')][_0x369b('0x3e')](_['sortBy'](_0x1cb13d,_0x369b('0x15')),{'transaction':_0x13e3bb});});});})[_0x369b('0x3f')](function(_0x477d5c){console[_0x369b('0x40')](_0x477d5c);});}exports[_0x369b('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a063444..32b921d 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 _0x11e5=['null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','then','query','VoiceQueueId','sequelize','VoiceQueue','BlackLists','all','Campaign','get','always','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','emit','contact:csv_','resume','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined'];(function(_0x2c54bd,_0x1feec2){var _0x133c21=function(_0xfae184){while(--_0xfae184){_0x2c54bd['push'](_0x2c54bd['shift']());}};_0x133c21(++_0x1feec2);}(_0x11e5,0x1b4));var _0x511e=function(_0x1e0c8c,_0x320dd3){_0x1e0c8c=_0x1e0c8c-0x0;var _0x30b996=_0x11e5[_0x1e0c8c];return _0x30b996;};'use strict';var BPromise=require(_0x511e('0x0'));var util=require('util');var _=require(_0x511e('0x1'));var fs=require('fs');var squel=require(_0x511e('0x2'));var Papa=require(_0x511e('0x3'));var Redis=require('ioredis');var db=require(_0x511e('0x4'))['db'];var config=require(_0x511e('0x5'));var logger=require(_0x511e('0x6'))(_0x511e('0x7'));config[_0x511e('0x8')]=_[_0x511e('0x9')](config['redis'],{'host':_0x511e('0xa'),'port':0x18eb});var socket=require(_0x511e('0xb'))(new Redis(config[_0x511e('0x8')]));require(_0x511e('0xc'))[_0x511e('0xd')](socket);try{if(!process[_0x511e('0xe')][0x2]||process['argv'][0x2]===_0x511e('0xf')||process['argv'][0x2]===_0x511e('0x10')){throw new Error(_0x511e('0x11'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x511e('0xf')||process[_0x511e('0xe')][0x3]===_0x511e('0x10')||!process['argv'][0x4]||process[_0x511e('0xe')][0x4]===_0x511e('0xf')||process[_0x511e('0xe')][0x4]==='null'){throw new Error(_0x511e('0x12'));}var FIELDS=_[_0x511e('0x13')](process[_0x511e('0xe')][0x3][_0x511e('0x14')](','),process[_0x511e('0xe')][0x4][_0x511e('0x14')](','));if(!process[_0x511e('0xe')][0x5]||process[_0x511e('0xe')][0x5]===_0x511e('0xf')||process[_0x511e('0xe')][0x5]===_0x511e('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x511e('0xe')][0x5];var COMPANYID=process[_0x511e('0xe')][0x6]&&process[_0x511e('0xe')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x511e('0x10')?process[_0x511e('0xe')][0x6]:null;var DUPLICATES=process[_0x511e('0xe')][0x7]&&process['argv'][0x7]!==_0x511e('0xf')&&process[_0x511e('0xe')][0x7]!==_0x511e('0x10')?process[_0x511e('0xe')][0x7]:null;if(!process[_0x511e('0xe')][0x8]||process[_0x511e('0xe')][0x8]===_0x511e('0xf')||process[_0x511e('0xe')][0x8]===_0x511e('0x10')){throw new Error(_0x511e('0x15'));}var SOCKET_TIMESTAMP=process[_0x511e('0xe')][0x8];}catch(_0x4c7f91){logger[_0x511e('0x16')](_0x4c7f91);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(_0x20c6df,_0x2347ae,_0x3230e7,_0x2f3e5e){var _0x2b2072={'message':_0x2347ae};_0x2b2072[_0x20c6df]=!![];if(_0x3230e7){_0x2b2072[_0x511e('0x17')]=_0x3230e7;}if(_0x2f3e5e){_0x2b2072[_0x511e('0x18')]=_0x2f3e5e;}return _0x2b2072;}function isEmail(_0x177a9f){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))*$/[_0x511e('0x19')](_0x177a9f);}function checkRow(_0x1a610b,_0x22a44b,_0x3c06a6){return new BPromise(function(_0x28dea0,_0x2cee47){if(_[_0x511e('0x1a')](_0x1a610b)){return _0x2cee47(handleCheckRowError('error',_0x511e('0x1b'),null,_0x3c06a6));}if(_0x1a610b[_0x511e('0x1c')]&&_0x1a610b[_0x511e('0x1c')]['length']){var _0x1b663b=_['map'](_0x1a610b[_0x511e('0x1c')],_0x511e('0x1d'))[_0x511e('0x1e')](';');return _0x2cee47(handleCheckRowError(_0x511e('0x16'),_0x1b663b,null,_0x3c06a6));}var _0x4f2afe={};for(var _0x4561e9 in FIELDS){if(FIELDS[_0x511e('0x1f')](_0x4561e9)&&FIELDS[_0x4561e9]){_0x4f2afe[_0x4561e9]=_0x1a610b[_0x511e('0x20')][0x0][FIELDS[_0x4561e9]]||_0x1a610b['data'][0x0]['\ufeff'+FIELDS[_0x4561e9]];}}if(!_0x4f2afe[_0x511e('0x21')]){return _0x2cee47(handleCheckRowError(_0x511e('0x16'),_0x511e('0x22'),null,_0x3c06a6));}if(!_0x4f2afe[_0x511e('0x23')]){return _0x2cee47(handleCheckRowError(_0x511e('0x16'),_0x511e('0x24'),null,_0x3c06a6));}if(_0x4f2afe[_0x511e('0x25')]){var _0x5baccb=moment(_0x4f2afe['birthDate'],_0x511e('0x26'));if(!_0x5baccb['isValid']()){return _0x2cee47(handleCheckRowError('error',_0x511e('0x27'),null,_0x3c06a6));}}if(_0x4f2afe[_0x511e('0x28')]){if(!isEmail(_0x4f2afe[_0x511e('0x28')])){return _0x2cee47(handleCheckRowError('error',_0x511e('0x29'),null,_0x3c06a6));}}_0x4f2afe[_0x511e('0x2a')]=LISTID;_0x4f2afe[_0x511e('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x511e('0x2c')]&&_0x22a44b){var _0x1090f4={};for(var _0x106458=0x0,_0x56dd90=DUPLICATES[_0x511e('0x2c')];_0x106458<_0x56dd90;_0x106458+=0x1){_0x1090f4[DUPLICATES[_0x106458]]=_0x4f2afe[DUPLICATES[_0x106458]];}var _0x434e77=_[_0x511e('0x2d')](_0x22a44b,_0x1090f4);if(_0x434e77){return _0x2cee47(handleCheckRowError(_0x511e('0x2e'),_0x511e('0x2f'),_0x434e77,_0x3c06a6));}}return db['CmContact'][_0x511e('0x30')](_0x4f2afe,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4f2afe)})['then'](function(_0xdc512c){if(DUPLICATES&&DUPLICATES[_0x511e('0x2c')]&&_0x22a44b){_0x22a44b[_0x511e('0x31')](_[_0x511e('0x32')](_0x4f2afe,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xdc512c['id'];return _0x28dea0();})[_0x511e('0x33')](function(_0x304bd4){return _0x2cee47(handleCheckRowError(_0x511e('0x16'),_0x511e('0x34')+(_0x304bd4[_0x511e('0x1d')]||JSON[_0x511e('0x35')](_0x304bd4)),null,_0x3c06a6));});});}function checkHopper(){function _0x5832d3(){return function(_0x5825f6){logger[_0x511e('0x16')](_0x511e('0x36'),_0x511e('0x37'),util[_0x511e('0x38')](_0x5825f6,{'showHidden':![],'depth':null}));};}var _0x1d6e4d=function(_0xc833b7,_0x108221){var _0x4c2476=squel[_0x511e('0x39')]()[_0x511e('0x3a')](_0x511e('0x3b'))[_0x511e('0x3c')]([_0x511e('0x23'),_0x511e('0x3d'),_0x511e('0x3e'),_0x511e('0x2a'),_0x108221,_0x511e('0x3f'),'updatedAt'],squel[_0x511e('0x40')]()['field'](_0x511e('0x23'),'phone')[_0x511e('0x41')](_0x511e('0x42'),_0x511e('0x3d'))[_0x511e('0x41')]('id',_0x511e('0x3e'))[_0x511e('0x41')](LISTID[_0x511e('0x43')](),'ListId')[_0x511e('0x41')](_0xc833b7['id'][_0x511e('0x43')](),_0x108221)[_0x511e('0x41')](_0x511e('0x42'),'createdAt')[_0x511e('0x41')](_0x511e('0x42'),_0x511e('0x44'))[_0x511e('0x45')](_0x511e('0x46'))[_0x511e('0x47')](_0x511e('0x48'))[_0x511e('0x47')]('ListId\x20=\x20?',LISTID[_0x511e('0x43')]())[_0x511e('0x47')](_0x511e('0x49'))[_0x511e('0x47')](_0x511e('0x4a'),squel['select']()[_0x511e('0x41')](_0x511e('0x23'))[_0x511e('0x45')](_0x511e('0x3b'))[_0x511e('0x47')](_0x108221+_0x511e('0x4b'),_0xc833b7['id'][_0x511e('0x43')]())))[_0x511e('0x43')]();return _0x4c2476;};var _0x1841a6=function(_0x486cc3,_0x150903){var _0x716b3=squel[_0x511e('0x39')]()[_0x511e('0x3a')](_0x511e('0x3b'))['fromQuery'](['phone','scheduledAt','ContactId',_0x511e('0x2a'),_0x150903,_0x511e('0x3f'),_0x511e('0x44')],squel['select']()[_0x511e('0x41')](_0x511e('0x23'),_0x511e('0x23'))[_0x511e('0x41')](_0x511e('0x42'),'scheduledAt')[_0x511e('0x41')]('id',_0x511e('0x3e'))['field'](LISTID[_0x511e('0x43')](),_0x511e('0x2a'))['field'](_0x486cc3['id'][_0x511e('0x43')](),_0x150903)[_0x511e('0x41')]('NOW()',_0x511e('0x3f'))[_0x511e('0x41')]('NOW()',_0x511e('0x44'))[_0x511e('0x45')](_0x511e('0x46'))[_0x511e('0x47')]('deletedAt\x20IS\x20NULL')[_0x511e('0x47')](_0x511e('0x4c'),LISTID[_0x511e('0x43')]())['where'](_0x511e('0x4d'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x511e('0x47')](_0x511e('0x4a'),squel[_0x511e('0x40')]()[_0x511e('0x41')](_0x511e('0x4e'))['from'](_0x511e('0x4f'))[_0x511e('0x47')](_0x150903+_0x511e('0x4b'),_0x486cc3['id'][_0x511e('0x43')]()))[_0x511e('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x511e('0x40')]()[_0x511e('0x41')]('phone')['from'](_0x511e('0x3b'))[_0x511e('0x47')](_0x150903+'\x20=\x20?',_0x486cc3['id']['toString']())))['toString']();return _0x716b3;};function _0x16456a(_0x1076ab,_0x57cf24){var _0x5a521f=squel[_0x511e('0x39')]()[_0x511e('0x3a')](_0x511e('0x3b'))[_0x511e('0x3c')]([_0x511e('0x23'),'scheduledAt',_0x511e('0x3e'),_0x511e('0x2a'),_0x57cf24,_0x511e('0x3f'),_0x511e('0x44')],squel[_0x511e('0x40')]()[_0x511e('0x41')](_0x511e('0x23'),_0x511e('0x23'))[_0x511e('0x41')](_0x511e('0x42'),_0x511e('0x3d'))[_0x511e('0x41')]('id','ContactId')[_0x511e('0x41')](LISTID[_0x511e('0x43')](),_0x511e('0x2a'))[_0x511e('0x41')](_0x1076ab['id'][_0x511e('0x43')](),_0x57cf24)[_0x511e('0x41')]('NOW()',_0x511e('0x3f'))[_0x511e('0x41')]('NOW()',_0x511e('0x44'))[_0x511e('0x45')](_0x511e('0x46'))[_0x511e('0x47')](_0x511e('0x48'))['where'](_0x511e('0x4c'),LISTID['toString']())['where'](_0x511e('0x4d'),squel[_0x511e('0x50')](hopperContacts))['where'](_0x511e('0x49')))[_0x511e('0x43')]();return _0x5a521f;}function _0x1944f7(_0x1ac540,_0x309a90){var _0x50ef46=squel['insert']()[_0x511e('0x3a')](_0x511e('0x51'))[_0x511e('0x3c')](['phone','ContactId',_0x511e('0x2a'),_0x309a90,'createdAt','updatedAt'],squel[_0x511e('0x40')]()[_0x511e('0x41')](_0x511e('0x23'),_0x511e('0x23'))[_0x511e('0x41')]('id',_0x511e('0x3e'))[_0x511e('0x41')](LISTID[_0x511e('0x43')](),'ListId')[_0x511e('0x41')](_0x1ac540['id']['toString'](),_0x309a90)[_0x511e('0x41')](_0x511e('0x42'),'createdAt')[_0x511e('0x41')]('NOW()',_0x511e('0x44'))[_0x511e('0x45')](_0x511e('0x46'))[_0x511e('0x47')]('deletedAt\x20IS\x20NULL')['where'](_0x511e('0x4c'),LISTID['toString']())[_0x511e('0x47')](_0x511e('0x4d'),squel[_0x511e('0x50')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x50ef46;}return db['VoiceQueue'][_0x511e('0x52')]({'where':{'type':_0x511e('0x53')},'attributes':['id',_0x511e('0x54')],'include':[{'model':db[_0x511e('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x511e('0x56')](function(_0x40dc92){var _0x5296cb=[];if(_0x40dc92){var _0x1e4add;for(var _0x680be6=0x0,_0x1440af;_0x680be6<_0x40dc92[_0x511e('0x2c')];_0x680be6+=0x1){_0x1440af=_0x40dc92[_0x680be6]['get']({'plain':!![]});switch(_0x1440af['dialCheckDuplicateType']){case'always':_0x5296cb[_0x511e('0x31')](db['sequelize'][_0x511e('0x57')](_0x1841a6(_0x1440af,_0x511e('0x58')))[_0x511e('0x56')](function(){})['catch'](_0x5832d3()));break;case'onlyIfOpen':_0x5296cb['push'](db[_0x511e('0x59')][_0x511e('0x57')](_0x1d6e4d(_0x1440af,_0x511e('0x58')))[_0x511e('0x56')](function(){})[_0x511e('0x33')](_0x5832d3()));break;default:_0x5296cb['push'](db[_0x511e('0x59')][_0x511e('0x57')](_0x16456a(_0x1440af,_0x511e('0x58')))[_0x511e('0x56')](function(){})[_0x511e('0x33')](_0x5832d3()));}}}return _0x5296cb;})['all']()['then'](function(){return db[_0x511e('0x5a')]['findAll']({'where':{'type':_0x511e('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x511e('0x5b'),'where':{'id':LISTID}}]})[_0x511e('0x56')](function(_0x5e6add){var _0x4b49d1=[];if(_0x5e6add){var _0x468052;for(var _0x3b08be=0x0,_0x1eb1fb;_0x3b08be<_0x5e6add[_0x511e('0x2c')];_0x3b08be+=0x1){_0x1eb1fb=_0x5e6add[_0x3b08be]['get']({'plain':!![]});_0x4b49d1['push'](db[_0x511e('0x59')][_0x511e('0x57')](_0x1944f7(_0x1eb1fb,_0x511e('0x58')))[_0x511e('0x56')](function(){})[_0x511e('0x33')](_0x5832d3()));}}return _0x4b49d1;})[_0x511e('0x5c')]();})['then'](function(){return db[_0x511e('0x5d')][_0x511e('0x52')]({'attributes':['id',_0x511e('0x54')],'include':[{'model':db[_0x511e('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x511e('0x56')](function(_0x552498){var _0x15f30b=[];if(_0x552498){for(var _0x222205=0x0,_0x1c6634;_0x222205<_0x552498['length'];_0x222205+=0x1){_0x1c6634=_0x552498[_0x222205][_0x511e('0x5e')]({'plain':!![]});switch(_0x1c6634['dialCheckDuplicateType']){case _0x511e('0x5f'):_0x15f30b['push'](db[_0x511e('0x59')]['query'](_0x1841a6(_0x1c6634,_0x511e('0x60')))[_0x511e('0x56')](function(){})['catch'](_0x5832d3()));break;case _0x511e('0x61'):_0x15f30b[_0x511e('0x31')](db[_0x511e('0x59')][_0x511e('0x57')](_0x1d6e4d(_0x1c6634,_0x511e('0x60')))[_0x511e('0x56')](function(){})['catch'](_0x5832d3()));break;default:_0x15f30b[_0x511e('0x31')](db['sequelize'][_0x511e('0x57')](_0x16456a(_0x1c6634,_0x511e('0x60')))[_0x511e('0x56')](function(){})[_0x511e('0x33')](_0x5832d3()));}}}return _0x15f30b;})[_0x511e('0x5c')]();})[_0x511e('0x56')](function(){return db[_0x511e('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x511e('0x55')],'as':_0x511e('0x5b'),'where':{'id':LISTID}}]})[_0x511e('0x56')](function(_0x6818a6){var _0x1d06d5=[];if(_0x6818a6){for(var _0x30801c=0x0,_0x21ce9e;_0x30801c<_0x6818a6[_0x511e('0x2c')];_0x30801c+=0x1){_0x21ce9e=_0x6818a6[_0x30801c][_0x511e('0x5e')]({'plain':!![]});_0x1d06d5[_0x511e('0x31')](db['sequelize'][_0x511e('0x57')](_0x1944f7(_0x21ce9e,_0x511e('0x60')))[_0x511e('0x56')](function(){})['catch'](_0x5832d3()));}}return _0x1d06d5;})[_0x511e('0x5c')]();})[_0x511e('0x33')](function(_0x2d895f){logger[_0x511e('0x16')](_0x511e('0x62'),_0x511e('0x63'),_0x2d895f[_0x511e('0x1d')]);});}var processPromises=function(_0x4f8da4){return BPromise[_0x511e('0x5c')](promises)[_0x511e('0x56')](function(_0x201ddb){})[_0x511e('0x33')](function(_0x58c55b){logger[_0x511e('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x511e('0x35')](_0x58c55b));})['finally'](function(){socket[_0x511e('0x64')](_0x511e('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f8da4){return _0x4f8da4[_0x511e('0x66')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x511e('0x56')](function(){if(hopperContacts){return checkHopper();}})[_0x511e('0x56')](function(){socket[_0x511e('0x64')](_0x511e('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x511e('0x67')](FILEPATH);}catch(_0x5d532b){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x5d532b));}finally{process[_0x511e('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0x511e('0x69')](_0x511e('0x6a'));endCsv();});function main(){return BPromise['resolve']()[_0x511e('0x56')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x511e('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x511e('0x56')](function(_0xc87784){var _0x50e5c2=fs[_0x511e('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x511e('0x6c')](_0x50e5c2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3aa6de,_0x10d6a6){total+=0x1;var _0x15cdf7=total;promises['push'](checkRow(_0x3aa6de,_0xc87784,_0x15cdf7)[_0x511e('0x56')](function(){success+=0x1;})[_0x511e('0x33')](function(_0x3dd86a){if(_0x3dd86a[_0x511e('0x16')]){errors+=0x1;delete _0x3dd86a['error'];}else if(_0x3dd86a['duplicate']){duplicates+=0x1;delete _0x3dd86a[_0x511e('0x2e')];}rows[_0x511e('0x31')](_0x3dd86a);}));if(total%0xc8===0x0){_0x10d6a6[_0x511e('0x6d')]();return processPromises(_0x10d6a6);}},'complete':function(){return processPromises()[_0x511e('0x56')](function(){logger[_0x511e('0x69')](_0x511e('0x6e'));endCsv();});},'error':function(_0x4dd1c7,_0x3db7e4){logger[_0x511e('0x69')](_0x511e('0x6f'),JSON[_0x511e('0x35')](_0x4dd1c7));endCsv();}});})[_0x511e('0x33')](function(_0x137af1){logger[_0x511e('0x16')](_0x511e('0x70'),JSON['stringify'](_0x137af1));});}main(); \ No newline at end of file +var _0x3097=['always','CampaignId','cmContact,\x20%s,\x20%s','message','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','parse','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','updatedAt','field','NOW()','scheduledAt','toString','createdAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','fromQuery','ContactId','cm_contacts','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','\x20=\x20?','insert','id\x20IN\x20?','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','length','get','sequelize','onlyIfOpen','query','VoiceQueueId','all','BlackLists','Campaign','findAll','Lists'];(function(_0x28373a,_0x285995){var _0x2e240d=function(_0x20cf2e){while(--_0x20cf2e){_0x28373a['push'](_0x28373a['shift']());}};_0x2e240d(++_0x285995);}(_0x3097,0x141));var _0x7309=function(_0x3baabc,_0x2f0167){_0x3baabc=_0x3baabc-0x0;var _0x5abbca=_0x3097[_0x3baabc];return _0x5abbca;};'use strict';var BPromise=require(_0x7309('0x0'));var util=require('util');var _=require(_0x7309('0x1'));var fs=require('fs');var squel=require(_0x7309('0x2'));var Papa=require(_0x7309('0x3'));var Redis=require('ioredis');var db=require(_0x7309('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x7309('0x5'))(_0x7309('0x6'));config[_0x7309('0x7')]=_['defaults'](config['redis'],{'host':_0x7309('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7309('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x7309('0x9')](socket);try{if(!process[_0x7309('0xa')][0x2]||process[_0x7309('0xa')][0x2]===_0x7309('0xb')||process[_0x7309('0xa')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x7309('0xa')][0x3]||process['argv'][0x3]==='undefined'||process[_0x7309('0xa')][0x3]===_0x7309('0xc')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process['argv'][0x4]===_0x7309('0xc')){throw new Error(_0x7309('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x7309('0xe')](','),process[_0x7309('0xa')][0x4]['split'](','));if(!process[_0x7309('0xa')][0x5]||process[_0x7309('0xa')][0x5]===_0x7309('0xb')||process['argv'][0x5]===_0x7309('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7309('0xa')][0x6]&&process[_0x7309('0xa')][0x6]!=='undefined'&&process[_0x7309('0xa')][0x6]!==_0x7309('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x7309('0xa')][0x7]&&process[_0x7309('0xa')][0x7]!==_0x7309('0xb')&&process[_0x7309('0xa')][0x7]!==_0x7309('0xc')?process[_0x7309('0xa')][0x7]:null;if(!process[_0x7309('0xa')][0x8]||process[_0x7309('0xa')][0x8]===_0x7309('0xb')||process['argv'][0x8]===_0x7309('0xc')){throw new Error(_0x7309('0xf'));}var SOCKET_TIMESTAMP=process[_0x7309('0xa')][0x8];}catch(_0xfa40be){logger[_0x7309('0x10')](_0xfa40be);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(_0x13b1b3,_0x28178b,_0x377525,_0x1215ad){var _0x8f53b2={'message':_0x28178b};_0x8f53b2[_0x13b1b3]=!![];if(_0x377525){_0x8f53b2[_0x7309('0x11')]=_0x377525;}if(_0x1215ad){_0x8f53b2[_0x7309('0x12')]=_0x1215ad;}return _0x8f53b2;}function isEmail(_0x1df2b3){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))*$/[_0x7309('0x13')](_0x1df2b3);}function checkRow(_0x301d40,_0x26d984,_0xe40355){return new BPromise(function(_0x5fee67,_0x268402){if(_['isNil'](_0x301d40)){return _0x268402(handleCheckRowError(_0x7309('0x10'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xe40355));}if(_0x301d40[_0x7309('0x14')]&&_0x301d40[_0x7309('0x14')]['length']){var _0x423cc6=_[_0x7309('0x15')](_0x301d40[_0x7309('0x14')],'message')[_0x7309('0x16')](';');return _0x268402(handleCheckRowError(_0x7309('0x10'),_0x423cc6,null,_0xe40355));}var _0x2e61e3={};for(var _0x51798f in FIELDS){if(FIELDS[_0x7309('0x17')](_0x51798f)&&FIELDS[_0x51798f]){_0x2e61e3[_0x51798f]=_0x301d40[_0x7309('0x18')][0x0][FIELDS[_0x51798f]]||_0x301d40[_0x7309('0x18')][0x0]['\ufeff'+FIELDS[_0x51798f]];}}if(!_0x2e61e3['firstName']){return _0x268402(handleCheckRowError(_0x7309('0x10'),_0x7309('0x19'),null,_0xe40355));}if(!_0x2e61e3[_0x7309('0x1a')]){return _0x268402(handleCheckRowError('error',_0x7309('0x1b'),null,_0xe40355));}if(_0x2e61e3[_0x7309('0x1c')]){var _0x16ac53=moment(_0x2e61e3[_0x7309('0x1c')],_0x7309('0x1d'));if(!_0x16ac53['isValid']()){return _0x268402(handleCheckRowError(_0x7309('0x10'),_0x7309('0x1e'),null,_0xe40355));}}if(_0x2e61e3[_0x7309('0x1f')]){if(!isEmail(_0x2e61e3[_0x7309('0x1f')])){return _0x268402(handleCheckRowError(_0x7309('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0xe40355));}}_0x2e61e3[_0x7309('0x20')]=LISTID;_0x2e61e3['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x26d984){var _0x6b705d={};for(var _0x21157=0x0,_0x2e5a5c=DUPLICATES['length'];_0x21157<_0x2e5a5c;_0x21157+=0x1){_0x6b705d[DUPLICATES[_0x21157]]=_0x2e61e3[DUPLICATES[_0x21157]];}var _0x24fd8f=_[_0x7309('0x21')](_0x26d984,_0x6b705d);if(_0x24fd8f){return _0x268402(handleCheckRowError(_0x7309('0x22'),_0x7309('0x23'),_0x24fd8f,_0xe40355));}}return db[_0x7309('0x24')][_0x7309('0x25')](_0x2e61e3,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2e61e3)})[_0x7309('0x26')](function(_0x161892){if(DUPLICATES&&DUPLICATES['length']&&_0x26d984){_0x26d984[_0x7309('0x27')](_['pick'](_0x2e61e3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x161892['id'];return _0x5fee67();})[_0x7309('0x28')](function(_0x502a6e){return _0x268402(handleCheckRowError(_0x7309('0x10'),_0x7309('0x29')+(_0x502a6e['message']||JSON[_0x7309('0x2a')](_0x502a6e)),null,_0xe40355));});});}function checkHopper(){function _0x7128d4(){return function(_0x31a50e){logger['error']('cmContact',_0x7309('0x2b'),util[_0x7309('0x2c')](_0x31a50e,{'showHidden':![],'depth':null}));};}var _0x2cf994=function(_0x2ae470,_0xc4cad){var _0x208afe=squel['insert']()[_0x7309('0x2d')](_0x7309('0x2e'))['fromQuery']([_0x7309('0x1a'),'scheduledAt','ContactId','ListId',_0xc4cad,'createdAt',_0x7309('0x2f')],squel['select']()['field'](_0x7309('0x1a'),_0x7309('0x1a'))[_0x7309('0x30')](_0x7309('0x31'),_0x7309('0x32'))[_0x7309('0x30')]('id','ContactId')[_0x7309('0x30')](LISTID['toString'](),_0x7309('0x20'))[_0x7309('0x30')](_0x2ae470['id'][_0x7309('0x33')](),_0xc4cad)[_0x7309('0x30')](_0x7309('0x31'),_0x7309('0x34'))['field'](_0x7309('0x31'),_0x7309('0x2f'))[_0x7309('0x35')]('cm_contacts')[_0x7309('0x36')](_0x7309('0x37'))[_0x7309('0x36')](_0x7309('0x38'),LISTID[_0x7309('0x33')]())[_0x7309('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0x7309('0x36')](_0x7309('0x39'),squel[_0x7309('0x3a')]()['field'](_0x7309('0x1a'))[_0x7309('0x35')](_0x7309('0x2e'))['where'](_0xc4cad+'\x20=\x20?',_0x2ae470['id'][_0x7309('0x33')]())))[_0x7309('0x33')]();return _0x208afe;};var _0x28c8a7=function(_0x264ca1,_0x273b2b){var _0x539b93=squel['insert']()[_0x7309('0x2d')](_0x7309('0x2e'))[_0x7309('0x3b')]([_0x7309('0x1a'),'scheduledAt',_0x7309('0x3c'),'ListId',_0x273b2b,'createdAt','updatedAt'],squel[_0x7309('0x3a')]()[_0x7309('0x30')](_0x7309('0x1a'),'phone')[_0x7309('0x30')](_0x7309('0x31'),'scheduledAt')[_0x7309('0x30')]('id','ContactId')[_0x7309('0x30')](LISTID['toString'](),_0x7309('0x20'))[_0x7309('0x30')](_0x264ca1['id'][_0x7309('0x33')](),_0x273b2b)['field'](_0x7309('0x31'),_0x7309('0x34'))[_0x7309('0x30')](_0x7309('0x31'),_0x7309('0x2f'))['from'](_0x7309('0x3d'))[_0x7309('0x36')]('deletedAt\x20IS\x20NULL')[_0x7309('0x36')](_0x7309('0x38'),LISTID[_0x7309('0x33')]())[_0x7309('0x36')]('id\x20IN\x20?',squel[_0x7309('0x3e')](hopperContacts))[_0x7309('0x36')](_0x7309('0x3f'))[_0x7309('0x36')](_0x7309('0x39'),squel[_0x7309('0x3a')]()[_0x7309('0x30')]('calleridnum')['from'](_0x7309('0x40'))[_0x7309('0x36')](_0x273b2b+_0x7309('0x41'),_0x264ca1['id'][_0x7309('0x33')]()))[_0x7309('0x36')](_0x7309('0x39'),squel['select']()[_0x7309('0x30')](_0x7309('0x1a'))[_0x7309('0x35')](_0x7309('0x2e'))[_0x7309('0x36')](_0x273b2b+_0x7309('0x41'),_0x264ca1['id'][_0x7309('0x33')]())))['toString']();return _0x539b93;};function _0x1cfc61(_0x2f34df,_0xab1716){var _0x542d32=squel[_0x7309('0x42')]()[_0x7309('0x2d')](_0x7309('0x2e'))[_0x7309('0x3b')]([_0x7309('0x1a'),'scheduledAt',_0x7309('0x3c'),_0x7309('0x20'),_0xab1716,'createdAt',_0x7309('0x2f')],squel[_0x7309('0x3a')]()[_0x7309('0x30')](_0x7309('0x1a'),_0x7309('0x1a'))[_0x7309('0x30')]('NOW()',_0x7309('0x32'))['field']('id',_0x7309('0x3c'))[_0x7309('0x30')](LISTID['toString'](),_0x7309('0x20'))[_0x7309('0x30')](_0x2f34df['id'][_0x7309('0x33')](),_0xab1716)['field']('NOW()',_0x7309('0x34'))[_0x7309('0x30')](_0x7309('0x31'),_0x7309('0x2f'))['from'](_0x7309('0x3d'))[_0x7309('0x36')](_0x7309('0x37'))[_0x7309('0x36')]('ListId\x20=\x20?',LISTID[_0x7309('0x33')]())['where'](_0x7309('0x43'),squel[_0x7309('0x3e')](hopperContacts))[_0x7309('0x36')](_0x7309('0x3f')))[_0x7309('0x33')]();return _0x542d32;}function _0x8f55d6(_0x3ada92,_0x31244b){var _0x4f956d=squel[_0x7309('0x42')]()['into'](_0x7309('0x44'))[_0x7309('0x3b')]([_0x7309('0x1a'),_0x7309('0x3c'),_0x7309('0x20'),_0x31244b,_0x7309('0x34'),_0x7309('0x2f')],squel[_0x7309('0x3a')]()[_0x7309('0x30')](_0x7309('0x1a'),_0x7309('0x1a'))[_0x7309('0x30')]('id',_0x7309('0x3c'))[_0x7309('0x30')](LISTID['toString'](),'ListId')[_0x7309('0x30')](_0x3ada92['id']['toString'](),_0x31244b)[_0x7309('0x30')](_0x7309('0x31'),_0x7309('0x34'))['field'](_0x7309('0x31'),_0x7309('0x2f'))[_0x7309('0x35')](_0x7309('0x3d'))[_0x7309('0x36')](_0x7309('0x37'))[_0x7309('0x36')]('ListId\x20=\x20?',LISTID[_0x7309('0x33')]())['where'](_0x7309('0x43'),squel['str'](hopperContacts))['where'](_0x7309('0x3f')))[_0x7309('0x33')]();return _0x4f956d;}return db['VoiceQueue']['findAll']({'where':{'type':_0x7309('0x45')},'attributes':['id',_0x7309('0x46')],'include':[{'model':db[_0x7309('0x47')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x48e837){var _0x38aca0=[];if(_0x48e837){var _0x53e929;for(var _0x26c2d9=0x0,_0x1d8b7d;_0x26c2d9<_0x48e837[_0x7309('0x48')];_0x26c2d9+=0x1){_0x1d8b7d=_0x48e837[_0x26c2d9][_0x7309('0x49')]({'plain':!![]});switch(_0x1d8b7d[_0x7309('0x46')]){case'always':_0x38aca0[_0x7309('0x27')](db[_0x7309('0x4a')]['query'](_0x28c8a7(_0x1d8b7d,'VoiceQueueId'))[_0x7309('0x26')](function(){})[_0x7309('0x28')](_0x7128d4()));break;case _0x7309('0x4b'):_0x38aca0[_0x7309('0x27')](db[_0x7309('0x4a')][_0x7309('0x4c')](_0x2cf994(_0x1d8b7d,_0x7309('0x4d')))[_0x7309('0x26')](function(){})[_0x7309('0x28')](_0x7128d4()));break;default:_0x38aca0[_0x7309('0x27')](db[_0x7309('0x4a')][_0x7309('0x4c')](_0x1cfc61(_0x1d8b7d,'VoiceQueueId'))[_0x7309('0x26')](function(){})['catch'](_0x7128d4()));}}}return _0x38aca0;})[_0x7309('0x4e')]()[_0x7309('0x26')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x7309('0x45')},'attributes':['id'],'include':[{'model':db[_0x7309('0x47')],'as':_0x7309('0x4f'),'where':{'id':LISTID}}]})[_0x7309('0x26')](function(_0x32ab0a){var _0x2c15df=[];if(_0x32ab0a){var _0x44535d;for(var _0x106f41=0x0,_0x11ac04;_0x106f41<_0x32ab0a[_0x7309('0x48')];_0x106f41+=0x1){_0x11ac04=_0x32ab0a[_0x106f41][_0x7309('0x49')]({'plain':!![]});_0x2c15df[_0x7309('0x27')](db['sequelize'][_0x7309('0x4c')](_0x8f55d6(_0x11ac04,_0x7309('0x4d')))[_0x7309('0x26')](function(){})['catch'](_0x7128d4()));}}return _0x2c15df;})['all']();})[_0x7309('0x26')](function(){return db[_0x7309('0x50')][_0x7309('0x51')]({'attributes':['id',_0x7309('0x46')],'include':[{'model':db[_0x7309('0x47')],'as':_0x7309('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x534864){var _0x4e0a97=[];if(_0x534864){for(var _0x432d32=0x0,_0x120d7a;_0x432d32<_0x534864[_0x7309('0x48')];_0x432d32+=0x1){_0x120d7a=_0x534864[_0x432d32]['get']({'plain':!![]});switch(_0x120d7a[_0x7309('0x46')]){case _0x7309('0x53'):_0x4e0a97[_0x7309('0x27')](db[_0x7309('0x4a')][_0x7309('0x4c')](_0x28c8a7(_0x120d7a,_0x7309('0x54')))[_0x7309('0x26')](function(){})[_0x7309('0x28')](_0x7128d4()));break;case'onlyIfOpen':_0x4e0a97[_0x7309('0x27')](db['sequelize'][_0x7309('0x4c')](_0x2cf994(_0x120d7a,_0x7309('0x54')))[_0x7309('0x26')](function(){})[_0x7309('0x28')](_0x7128d4()));break;default:_0x4e0a97['push'](db[_0x7309('0x4a')][_0x7309('0x4c')](_0x1cfc61(_0x120d7a,_0x7309('0x54')))[_0x7309('0x26')](function(){})[_0x7309('0x28')](_0x7128d4()));}}}return _0x4e0a97;})[_0x7309('0x4e')]();})[_0x7309('0x26')](function(){return db[_0x7309('0x50')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x7309('0x47')],'as':_0x7309('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x2656ae){var _0x3636ea=[];if(_0x2656ae){for(var _0x576c4f=0x0,_0x58d012;_0x576c4f<_0x2656ae['length'];_0x576c4f+=0x1){_0x58d012=_0x2656ae[_0x576c4f]['get']({'plain':!![]});_0x3636ea[_0x7309('0x27')](db['sequelize'][_0x7309('0x4c')](_0x8f55d6(_0x58d012,_0x7309('0x54')))[_0x7309('0x26')](function(){})[_0x7309('0x28')](_0x7128d4()));}}return _0x3636ea;})[_0x7309('0x4e')]();})[_0x7309('0x28')](function(_0x49af06){logger[_0x7309('0x10')](_0x7309('0x55'),'generalCheckHopper',_0x49af06[_0x7309('0x56')]);});}var processPromises=function(_0x6a4831){return BPromise[_0x7309('0x4e')](promises)[_0x7309('0x26')](function(_0x591f5b){})['catch'](function(_0x39acf7){logger[_0x7309('0x10')](_0x7309('0x57'),JSON[_0x7309('0x2a')](_0x39acf7));})[_0x7309('0x58')](function(){socket['emit'](_0x7309('0x59')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x6a4831){return _0x6a4831[_0x7309('0x5a')]();}});};var endCsv=function(){return BPromise[_0x7309('0x5b')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7309('0x26')](function(){socket[_0x7309('0x5c')](_0x7309('0x59')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7309('0x5d')](FILEPATH);}catch(_0x4ea596){logger['error'](_0x7309('0x5e'),JSON[_0x7309('0x2a')](_0x4ea596));}finally{process[_0x7309('0x5f')](0x0);}});};process['on'](_0x7309('0x60'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7309('0x5b')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7309('0xe')](',');return db[_0x7309('0x24')][_0x7309('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7309('0x26')](function(_0x31a238){var _0x4c8310=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7309('0x61')](_0x4c8310,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4f6a24,_0x475660){total+=0x1;var _0x45b8c9=total;promises[_0x7309('0x27')](checkRow(_0x4f6a24,_0x31a238,_0x45b8c9)[_0x7309('0x26')](function(){success+=0x1;})[_0x7309('0x28')](function(_0x262e9a){if(_0x262e9a[_0x7309('0x10')]){errors+=0x1;delete _0x262e9a['error'];}else if(_0x262e9a[_0x7309('0x22')]){duplicates+=0x1;delete _0x262e9a['duplicate'];}rows[_0x7309('0x27')](_0x262e9a);}));if(total%0xc8===0x0){_0x475660['pause']();return processPromises(_0x475660);}},'complete':function(){return processPromises()['then'](function(){logger[_0x7309('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x11e9d9,_0x55bd11){logger[_0x7309('0x62')](_0x7309('0x63'),JSON[_0x7309('0x2a')](_0x11e9d9));endCsv();}});})[_0x7309('0x28')](function(_0x92ff92){logger[_0x7309('0x10')](_0x7309('0x64'),JSON[_0x7309('0x2a')](_0x92ff92));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 52c74c0..ab818dd 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 _0x5921=['UserId','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','join','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','ListId','ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','error','message','exit','errors','push','code','sequelize','catch','main','send','start','binding','socket_timestamp','root','writeFileSync','parse','createReadStream','data','length','rows','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority'];(function(_0x49c911,_0x2496e3){var _0x54906c=function(_0x3f5b70){while(--_0x3f5b70){_0x49c911['push'](_0x49c911['shift']());}};_0x54906c(++_0x2496e3);}(_0x5921,0x16e));var _0x1592=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x5921[_0x543084];return _0x306a57;};'use strict';var fs=require('fs');var path=require(_0x1592('0x0'));var _=require(_0x1592('0x1'));var Papa=require(_0x1592('0x2'));var util=require('util');var BPromise=require(_0x1592('0x3'));var moment=require(_0x1592('0x4'));var squel=require(_0x1592('0x5'));var Redis=require(_0x1592('0x6'));var db=require(_0x1592('0x7'))['db'];var config=require(_0x1592('0x8'));var logger=require(_0x1592('0x9'))('import');config[_0x1592('0xa')]=_[_0x1592('0xb')](config[_0x1592('0xa')],{'host':_0x1592('0xc'),'port':0x18eb});var socket=require(_0x1592('0xd'))(new Redis(config[_0x1592('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1592('0xe')](_0x1592('0xf'));function isEmail(_0x4edd23){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))*$/[_0x1592('0x10')](_0x4edd23);}function selectNotIn(_0x14a87a,_0x3dfcd7,_0x3d3006,_0x6008d8,_0x11a4e3){return squel[_0x1592('0x11')]()[_0x1592('0x12')](_0x1592('0x13'))['from'](_0x6008d8)['join'](_0x3dfcd7,null,_0x3dfcd7+_0x1592('0x14')+_0x6008d8+'.'+_0x3d3006)[_0x1592('0x15')](_0x6008d8+'.'+_0x3d3006+_0x1592('0x16')+_0x14a87a+'.'+_0x3d3006)[_0x1592('0x15')](_0x3dfcd7+_0x1592('0x17')+_0x11a4e3['join']()+')');}function insertCmHopper(_0x5318e5,_0x11242a,_0x5e61b6,_0x23cb05,_0x2b59d9){var _0x13b909=[_0x1592('0x18'),_0x1592('0x19'),_0x1592('0x1a'),_0x1592('0x1b'),_0x11242a+'.'+_0x23cb05,_0x1592('0x1c'),'cm_contacts.updatedAt',_0x1592('0x1d'),'cm_contacts.UserId','\x22'+_0x2b59d9+'\x22'];return squel[_0x1592('0x1e')]()[_0x1592('0x1f')](_0x1592('0x20'))[_0x1592('0x21')]([_0x1592('0x13'),_0x1592('0x22'),_0x1592('0x23'),'ListId',_0x23cb05,_0x1592('0x24'),_0x1592('0x25'),_0x1592('0x26'),_0x1592('0x27'),'recallme'],squel[_0x1592('0x11')]()[_0x1592('0x28')](_0x13b909)[_0x1592('0x29')](_0x11242a)['join'](_0x1592('0x2a'),null,_0x1592('0x2b')+_0x11242a+_0x1592('0x2c'))[_0x1592('0x2d')](_0x5e61b6,null,_0x5e61b6+_0x1592('0x14')+_0x11242a+'.'+_0x23cb05)[_0x1592('0x15')](_0x11242a+'.CmListId\x20=\x20?',_0x5318e5)['where'](_0x1592('0x2e'),NOW)[_0x1592('0x15')](_0x1592('0x2f'),selectNotIn(_0x11242a,_0x5e61b6,_0x23cb05,'cm_hopper',[_0x1592('0x30'),_0x1592('0x31')]))[_0x1592('0x15')](_0x1592('0x2f'),selectNotIn(_0x11242a,_0x5e61b6,_0x23cb05,'cm_hopper',[_0x1592('0x30')])))[_0x1592('0x32')]();}function insertCmHopperBlack(_0x5314c9,_0x1fbcef,_0x1b3cd6,_0x5d2859){var _0x269d9f=[_0x1592('0x18'),_0x1592('0x1a'),_0x1592('0x1b'),_0x1fbcef+'.'+_0x5d2859,_0x1592('0x1c'),_0x1592('0x33')];return squel['insert']()[_0x1592('0x1f')](_0x1592('0x34'))[_0x1592('0x21')]([_0x1592('0x13'),_0x1592('0x23'),_0x1592('0x35'),_0x5d2859,'createdAt',_0x1592('0x25')],squel[_0x1592('0x11')]()['fields'](_0x269d9f)[_0x1592('0x29')](_0x1fbcef)[_0x1592('0x2d')]('cm_contacts',null,_0x1592('0x2b')+_0x1fbcef+_0x1592('0x2c'))['join'](_0x1b3cd6,null,_0x1b3cd6+_0x1592('0x14')+_0x1fbcef+'.'+_0x5d2859)[_0x1592('0x15')](_0x1fbcef+'.CmListId\x20=\x20?',_0x5314c9)[_0x1592('0x15')](_0x1592('0x2e'),NOW)[_0x1592('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x1592('0x11')]()['field'](_0x1592('0x13'))[_0x1592('0x29')](_0x1592('0x34'))[_0x1592('0x15')](_0x1592('0x36'),_0x5314c9)[_0x1592('0x15')](_0x5d2859+'\x20=\x20?',_0x1fbcef+'.'+_0x5d2859)))[_0x1592('0x32')]();}function insertCmContact(_0x448f7d,_0x3a4e53,_0x4f1e9c,_0x122592){var _0x1ab7e2=_['concat'](_[_0x1592('0x37')](_0x122592),['ListId','CompanyId','createdAt',_0x1592('0x25')]);return squel['insert']()[_0x1592('0x1f')]('cm_contacts')['fromQuery'](_0x1ab7e2,squel[_0x1592('0x11')]()[_0x1592('0x28')](_0x1ab7e2)[_0x1592('0x29')](_0x3a4e53)[_0x1592('0x15')]('('+_0x4f1e9c['join'](',')+_0x1592('0x38'),squel[_0x1592('0x11')]()[_0x1592('0x28')](_0x4f1e9c)[_0x1592('0x29')](_0x1592('0x2a'))[_0x1592('0x15')](_0x1592('0x36'),_0x448f7d)[_0x1592('0x15')](_0x1592('0x39')))['where']('id\x20IN\x20?',squel[_0x1592('0x11')]()['field'](_0x1592('0x3a'),_0x1592('0x3b'))[_0x1592('0x29')](_0x3a4e53)[_0x1592('0x3c')](_0x4f1e9c[_0x1592('0x2d')](','))))[_0x1592('0x32')]();}function handleStop(){logger[_0x1592('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3d731c){logger[_0x1592('0x3e')](_0x3d731c[_0x1592('0x3f')]);process[_0x1592('0x40')](0x1);}function handleError(_0x57dc7f,_0x5c0a93){stats[_0x1592('0x41')][_0x1592('0x42')]({'name':_0x5c0a93[_0x1592('0x43')],'message':_0x5c0a93[_0x1592('0x3f')],'row':_0x57dc7f});}function handleQuery(_0x40dfca){logger[_0x1592('0x3d')](_0x40dfca);return db[_0x1592('0x44')]['query'](_0x40dfca)['spread'](function(_0x1450d8){results[_0x1592('0x42')](_0x1450d8);})[_0x1592('0x45')](function(_0x1285c6){logger[_0x1592('0x3e')](_0x1285c6[_0x1592('0x3f')]);});}function main(_0x310147,_0x561f3f,_0x337589,_0x9cb059){logger[_0x1592('0x3d')](_0x1592('0x46'),_0x310147,JSON['stringify'](_0x561f3f));process[_0x1592('0x47')](_0x1592('0x48'));var _0x52b9c3=_0x561f3f[_0x1592('0x49')];var _0x5abda7=_0x561f3f[_0x1592('0x4a')];var _0x47864e=path[_0x1592('0x2d')](config[_0x1592('0x4b')],'server/files/tmp',_0x5abda7+'.csv');var _0xb7f574=_[_0x1592('0x37')](_0x52b9c3)[_0x1592('0x2d')]();logger['info']('header',_0xb7f574);fs[_0x1592('0x4c')](_0x47864e,_0xb7f574+'\x0a');Papa[_0x1592('0x4d')](fs[_0x1592('0x4e')](_0x310147),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2af204,_0x58051c){try{for(var _0x3700c0=0x0,_0x420046=[];_0x3700c0<_0x2af204[_0x1592('0x4f')][_0x1592('0x50')];_0x3700c0++){stats[_0x1592('0x51')]+=0x1;if(_0x2af204[_0x1592('0x41')][_0x3700c0]){handleError(_0x2af204[_0x1592('0x4f')][_0x3700c0],_0x2af204[_0x1592('0x41')][_0x3700c0]);}else{var _0x13d175=[];for(var _0x2a4be1 in _0x52b9c3){if(_0x52b9c3['hasOwnProperty'](_0x2a4be1)){if(_0x2af204['data'][_0x3700c0][_0x52b9c3[_0x2a4be1]]){var _0x3e429c=_['trim'](_0x2af204[_0x1592('0x4f')][_0x3700c0][_0x52b9c3[_0x2a4be1]][_0x1592('0x52')](/"/g,'\x27'));switch(_0x2a4be1){case'scheduledat':var _0x5d5447=moment(_0x3e429c,_0x1592('0xf'),!![]);if(_0x5d5447['isValid']()){_0x420046['push']('\x22'+_0x3e429c+'\x22');}else{_0x13d175[_0x1592('0x42')](_0x1592('0x53'));}break;case'priority':var _0x302a74=parseInt(_0x3e429c);_0x3e429c=_[_0x1592('0x54')](_0x302a74)||_0x302a74<0x0||_0x302a74>0x4?_0x9cb059?0x3:0x2:_0x302a74;_0x420046['push']('\x22'+_0x3e429c+'\x22');break;case'UserId':var _0x29e9cd=parseInt(_0x3e429c);if(_[_0x1592('0x55')](_0x29e9cd)&&_[_0x1592('0x56')](_0x337589,_0x29e9cd)){_0x420046[_0x1592('0x42')]('\x22'+_0x29e9cd+'\x22');}else{_0x13d175[_0x1592('0x42')](_0x1592('0x57'));}break;case _0x1592('0x58'):if(isEmail(_0x3e429c)){_0x420046['push']('\x22'+_0x3e429c+'\x22');}else{_0x13d175['push'](_0x1592('0x59'));}break;case'dateOfBirth':var _0x251504=moment(_0x3e429c,'YYYY-MM-DD',!![]);if(_0x251504[_0x1592('0x5a')]()){_0x420046[_0x1592('0x42')]('\x22'+_0x3e429c+'\x22');}else{_0x13d175[_0x1592('0x42')](_0x1592('0x5b'));}break;default:_0x420046['push']('\x22'+_0x3e429c+'\x22');}}else{switch(_0x2a4be1){case _0x1592('0x5c'):case _0x1592('0x13'):_0x13d175[_0x1592('0x42')](_0x2a4be1+_0x1592('0x5d'));break;default:_0x420046[_0x1592('0x42')]('\x22\x22');}}}}if(_0x13d175[_0x1592('0x50')]){handleError(_0x2af204[_0x1592('0x4f')][_0x3700c0],{'code':_0x1592('0x5e'),'message':_0x13d175[_0x1592('0x2d')]()});}else{fs[_0x1592('0x5f')](_0x47864e,_0x420046[_0x1592('0x2d')]()+'\x0a');}_0x420046=[];}if(!(stats['rows']%0xc8)){socket[_0x1592('0x60')]('contact:import:'+_0x5abda7,stats);stats['errors']=[];}}if(stopped){logger[_0x1592('0x3d')](_0x1592('0x61'));_0x58051c[_0x1592('0x62')]();}}catch(_0x4bcc79){handleError(_0x2af204['data'][_0x3700c0],{'code':'SystemError','message':_0x4bcc79[_0x1592('0x3f')]});logger[_0x1592('0x3e')](_0x1592('0x63'),_0x4bcc79['message']);}},'complete':function(){try{var _0x2c990b=[];var _0x29611d=_0x1592('0x2a');if(_0x561f3f[_0x1592('0x64')]&&_0x561f3f[_0x1592('0x64')][_0x1592('0x50')]){_0x29611d=_0x1592('0x65')+_0x5abda7;_0x2c990b[_0x1592('0x42')](_0x1592('0x66')+_0x29611d+_0x1592('0x67'));}var _0x167016=util[_0x1592('0xe')](_0x1592('0x68'),_0x47864e,_0x29611d,_0xb7f574,_0x561f3f['ListId'],_0x561f3f[_0x1592('0x69')]||null,NOW,NOW);if(_[_0x1592('0x6a')](_0x52b9c3[_0x1592('0x22')])){_0x167016+=_0x1592('0x6b');}_0x2c990b[_0x1592('0x42')](_0x167016);if(_0x561f3f[_0x1592('0x64')]&&_0x561f3f['duplicates'][_0x1592('0x50')]){_0x2c990b['push'](insertCmContact(_0x561f3f[_0x1592('0x35')],_0x29611d,_0x561f3f[_0x1592('0x64')],_0x52b9c3));_0x2c990b[_0x1592('0x42')](_0x1592('0x6c')+_0x29611d+';');}_0x2c990b[_0x1592('0x42')](insertCmHopper(_0x561f3f['ListId'],'voice_queues_has_cm_lists',_0x1592('0x6d'),_0x1592('0x6e'),_0x9cb059));_0x2c990b[_0x1592('0x42')](insertCmHopperBlack(_0x561f3f[_0x1592('0x35')],_0x1592('0x6f'),'voice_queues','VoiceQueueId'));_0x2c990b[_0x1592('0x42')](insertCmHopper(_0x561f3f['ListId'],_0x1592('0x70'),_0x1592('0x71'),_0x1592('0x72'),_0x9cb059));_0x2c990b['push'](insertCmHopperBlack(_0x561f3f['ListId'],_0x1592('0x73'),_0x1592('0x71'),_0x1592('0x72')));BPromise[_0x1592('0x74')](_0x2c990b,handleQuery)[_0x1592('0x75')](function(_0x55a6b6){stats[_0x1592('0x76')]=!![];stats[_0x1592('0x77')]=_0x561f3f[_0x1592('0x64')]&&_0x561f3f['duplicates'][_0x1592('0x50')]?results[0x2]['affectedRows']:results[0x0][_0x1592('0x77')];socket[_0x1592('0x60')](_0x1592('0x78')+_0x5abda7,stats);fs['unlink'](_0x310147);fs[_0x1592('0x79')](_0x47864e);process[_0x1592('0x40')](0x0);})[_0x1592('0x45')](function(_0x407a89){logger['error'](_0x407a89[_0x1592('0x3f')]);process[_0x1592('0x40')](0x1);});}catch(_0x5d1177){logger['error'](_0x1592('0x7a'),_0x5d1177[_0x1592('0x3f')]);process['exit'](0x1);}},'error':function(_0x345323,_0x232b04,_0x2c2e75,_0x5a5842){throw new Error(_0x5a5842);}});}function validate(){if(process[_0x1592('0x7b')]&&process[_0x1592('0x7b')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x52256d=path['join'](config['root'],_0x1592('0x7c'),process[_0x1592('0x7b')][0x2]);if(!fs[_0x1592('0x7d')](_0x52256d)){throw new Error(_0x1592('0x7e'));}var _0x5437ed={};try{_0x5437ed=JSON['parse'](process['argv'][0x3]);if(!_0x5437ed[_0x1592('0x49')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5437ed[_0x1592('0x49')]['phone']){throw new Error(_0x1592('0x7f'));}if(!_0x5437ed['binding']['firstName']){throw new Error(_0x1592('0x80'));}var _0x371ab3=0x0;if(_0x5437ed['binding']['UserId']){_0x371ab3=0x1;}if(!_0x5437ed['ListId']){throw new Error(_0x1592('0x81'));}}catch(_0x5575d9){throw new Error(_0x1592('0x82'));}var _0x16e4bb=[];try{_0x16e4bb=_[_0x1592('0x83')](JSON[_0x1592('0x4d')](process[_0x1592('0x7b')][0x4]),'id');}catch(_0x1fbf8d){logger['info'](_0x1592('0x84'));}main(_0x52256d,_0x5437ed,_0x16e4bb,_0x371ab3);}validate();process['on'](_0x1592('0x85'),handleStop);process['on'](_0x1592('0x86'),handleUncaughtException); \ No newline at end of file +var _0x2264=['cm_contacts_','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','then','finish','affectedRows','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ListId','updatedAt','UserId','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','createdAt','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','message','errors','code','query','spread','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','data','length','hasOwnProperty','replace','scheduledat','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','SystemError','error','step','duplicates'];(function(_0x2cc017,_0x25b198){var _0x509276=function(_0x156ef1){while(--_0x156ef1){_0x2cc017['push'](_0x2cc017['shift']());}};_0x509276(++_0x25b198);}(_0x2264,0x125));var _0x4226=function(_0x2f4508,_0x4664c9){_0x2f4508=_0x2f4508-0x0;var _0x5a0a65=_0x2264[_0x2f4508];return _0x5a0a65;};'use strict';var fs=require('fs');var path=require(_0x4226('0x0'));var _=require(_0x4226('0x1'));var Papa=require(_0x4226('0x2'));var util=require('util');var BPromise=require(_0x4226('0x3'));var moment=require(_0x4226('0x4'));var squel=require('squel');var Redis=require(_0x4226('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x4226('0x6'));var logger=require(_0x4226('0x7'))(_0x4226('0x8'));config[_0x4226('0x9')]=_[_0x4226('0xa')](config[_0x4226('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4226('0xb'))(new Redis(config[_0x4226('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4226('0xc')](_0x4226('0xd'));function isEmail(_0x2a5832){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))*$/[_0x4226('0xe')](_0x2a5832);}function selectNotIn(_0x24a3e0,_0x1b519f,_0x3fc8ce,_0x4ebde4,_0x19b711){return squel[_0x4226('0xf')]()[_0x4226('0x10')](_0x4226('0x11'))[_0x4226('0x12')](_0x4ebde4)[_0x4226('0x13')](_0x1b519f,null,_0x1b519f+_0x4226('0x14')+_0x4ebde4+'.'+_0x3fc8ce)['where'](_0x4ebde4+'.'+_0x3fc8ce+_0x4226('0x15')+_0x24a3e0+'.'+_0x3fc8ce)['where'](_0x1b519f+_0x4226('0x16')+_0x19b711['join']()+')');}function insertCmHopper(_0x24f9a3,_0x5e3c4c,_0x4490ae,_0x3781b4,_0x3b9100){var _0xf7457f=[_0x4226('0x17'),_0x4226('0x18'),_0x4226('0x19'),'cm_contacts.ListId',_0x5e3c4c+'.'+_0x3781b4,_0x4226('0x1a'),_0x4226('0x1b'),_0x4226('0x1c'),'cm_contacts.UserId','\x22'+_0x3b9100+'\x22'];return squel[_0x4226('0x1d')]()['into'](_0x4226('0x1e'))[_0x4226('0x1f')]([_0x4226('0x11'),'scheduledat','ContactId',_0x4226('0x20'),_0x3781b4,'createdAt',_0x4226('0x21'),'priority',_0x4226('0x22'),'recallme'],squel[_0x4226('0xf')]()[_0x4226('0x23')](_0xf7457f)[_0x4226('0x12')](_0x5e3c4c)[_0x4226('0x13')](_0x4226('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x5e3c4c+_0x4226('0x25'))[_0x4226('0x13')](_0x4490ae,null,_0x4490ae+_0x4226('0x14')+_0x5e3c4c+'.'+_0x3781b4)['where'](_0x5e3c4c+_0x4226('0x26'),_0x24f9a3)[_0x4226('0x27')](_0x4226('0x28'),NOW)[_0x4226('0x27')](_0x4226('0x29'),selectNotIn(_0x5e3c4c,_0x4490ae,_0x3781b4,_0x4226('0x1e'),[_0x4226('0x2a'),_0x4226('0x2b')]))[_0x4226('0x27')](_0x4226('0x29'),selectNotIn(_0x5e3c4c,_0x4490ae,_0x3781b4,_0x4226('0x1e'),[_0x4226('0x2a')])))[_0x4226('0x2c')]();}function insertCmHopperBlack(_0x26fe13,_0x34ab4,_0x5d15b3,_0x494f8d){var _0x448402=['cm_contacts.phone','cm_contacts.id',_0x4226('0x2d'),_0x34ab4+'.'+_0x494f8d,_0x4226('0x1a'),_0x4226('0x1b')];return squel[_0x4226('0x1d')]()[_0x4226('0x2e')](_0x4226('0x2f'))[_0x4226('0x1f')]([_0x4226('0x11'),'ContactId',_0x4226('0x20'),_0x494f8d,'createdAt',_0x4226('0x21')],squel[_0x4226('0xf')]()['fields'](_0x448402)[_0x4226('0x12')](_0x34ab4)[_0x4226('0x13')](_0x4226('0x24'),null,_0x4226('0x30')+_0x34ab4+'.CmListId')[_0x4226('0x13')](_0x5d15b3,null,_0x5d15b3+_0x4226('0x14')+_0x34ab4+'.'+_0x494f8d)[_0x4226('0x27')](_0x34ab4+_0x4226('0x26'),_0x26fe13)[_0x4226('0x27')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4226('0x27')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x4226('0x10')](_0x4226('0x11'))[_0x4226('0x12')](_0x4226('0x2f'))[_0x4226('0x27')](_0x4226('0x31'),_0x26fe13)[_0x4226('0x27')](_0x494f8d+_0x4226('0x32'),_0x34ab4+'.'+_0x494f8d)))['toString']();}function insertCmContact(_0x5f3f06,_0x26992e,_0x345209,_0x90f1d2){var _0x1ae125=_[_0x4226('0x33')](_[_0x4226('0x34')](_0x90f1d2),[_0x4226('0x20'),_0x4226('0x35'),_0x4226('0x36'),_0x4226('0x21')]);return squel[_0x4226('0x1d')]()[_0x4226('0x2e')](_0x4226('0x24'))[_0x4226('0x1f')](_0x1ae125,squel['select']()[_0x4226('0x23')](_0x1ae125)[_0x4226('0x12')](_0x26992e)[_0x4226('0x27')]('('+_0x345209[_0x4226('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x4226('0xf')]()['fields'](_0x345209)[_0x4226('0x12')](_0x4226('0x24'))[_0x4226('0x27')](_0x4226('0x31'),_0x5f3f06)[_0x4226('0x27')](_0x4226('0x37')))[_0x4226('0x27')]('id\x20IN\x20?',squel[_0x4226('0xf')]()['field'](_0x4226('0x38'),_0x4226('0x39'))[_0x4226('0x12')](_0x26992e)[_0x4226('0x3a')](_0x345209[_0x4226('0x13')](','))))[_0x4226('0x2c')]();}function handleStop(){logger[_0x4226('0x3b')](_0x4226('0x3c'));stopped=!![];}function handleUncaughtException(_0x232a7e){logger['error'](_0x232a7e[_0x4226('0x3d')]);process['exit'](0x1);}function handleError(_0x31e10c,_0x3f7f35){stats[_0x4226('0x3e')]['push']({'name':_0x3f7f35[_0x4226('0x3f')],'message':_0x3f7f35[_0x4226('0x3d')],'row':_0x31e10c});}function handleQuery(_0x2e8baa){logger[_0x4226('0x3b')](_0x2e8baa);return db['sequelize'][_0x4226('0x40')](_0x2e8baa)[_0x4226('0x41')](function(_0x247561){results['push'](_0x247561);})[_0x4226('0x42')](function(_0x14cdfe){logger['error'](_0x14cdfe[_0x4226('0x3d')]);});}function main(_0x14270d,_0x341358,_0x4961c4,_0x549552){logger[_0x4226('0x3b')]('main',_0x14270d,JSON[_0x4226('0x43')](_0x341358));process[_0x4226('0x44')](_0x4226('0x45'));var _0x3f936c=_0x341358[_0x4226('0x46')];var _0x211627=_0x341358[_0x4226('0x47')];var _0x16622=path[_0x4226('0x13')](config[_0x4226('0x48')],_0x4226('0x49'),_0x211627+_0x4226('0x4a'));var _0x1f17fa=_['keys'](_0x3f936c)[_0x4226('0x13')]();logger[_0x4226('0x3b')](_0x4226('0x4b'),_0x1f17fa);fs[_0x4226('0x4c')](_0x16622,_0x1f17fa+'\x0a');Papa[_0x4226('0x4d')](fs['createReadStream'](_0x14270d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c9437,_0x68e362){try{for(var _0x376dbd=0x0,_0x6981b9=[];_0x376dbd<_0x2c9437[_0x4226('0x4e')][_0x4226('0x4f')];_0x376dbd++){stats['rows']+=0x1;if(_0x2c9437[_0x4226('0x3e')][_0x376dbd]){handleError(_0x2c9437[_0x4226('0x4e')][_0x376dbd],_0x2c9437[_0x4226('0x3e')][_0x376dbd]);}else{var _0x2e76c3=[];for(var _0x13e36c in _0x3f936c){if(_0x3f936c[_0x4226('0x50')](_0x13e36c)){if(_0x2c9437['data'][_0x376dbd][_0x3f936c[_0x13e36c]]){var _0x561169=_['trim'](_0x2c9437[_0x4226('0x4e')][_0x376dbd][_0x3f936c[_0x13e36c]][_0x4226('0x51')](/"/g,'\x27'));switch(_0x13e36c){case _0x4226('0x52'):var _0x202b5f=moment(_0x561169,_0x4226('0xd'),!![]);if(_0x202b5f['isValid']()){_0x6981b9[_0x4226('0x53')]('\x22'+_0x561169+'\x22');}else{_0x2e76c3['push'](_0x4226('0x54'));}break;case _0x4226('0x55'):var _0x65a453=parseInt(_0x561169);_0x561169=_[_0x4226('0x56')](_0x65a453)||_0x65a453<0x0||_0x65a453>0x4?_0x549552?0x3:0x2:_0x65a453;_0x6981b9[_0x4226('0x53')]('\x22'+_0x561169+'\x22');break;case'UserId':var _0x3006f6=parseInt(_0x561169);if(_[_0x4226('0x57')](_0x3006f6)&&_[_0x4226('0x58')](_0x4961c4,_0x3006f6)){_0x6981b9[_0x4226('0x53')]('\x22'+_0x3006f6+'\x22');}else{_0x2e76c3[_0x4226('0x53')](_0x4226('0x59'));}break;case _0x4226('0x5a'):if(isEmail(_0x561169)){_0x6981b9[_0x4226('0x53')]('\x22'+_0x561169+'\x22');}else{_0x2e76c3[_0x4226('0x53')]('email\x20wrong\x20format');}break;case _0x4226('0x5b'):var _0x1cd0d2=moment(_0x561169,_0x4226('0x5c'),!![]);if(_0x1cd0d2[_0x4226('0x5d')]()){_0x6981b9[_0x4226('0x53')]('\x22'+_0x561169+'\x22');}else{_0x2e76c3[_0x4226('0x53')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x6981b9[_0x4226('0x53')]('\x22'+_0x561169+'\x22');}}else{switch(_0x13e36c){case _0x4226('0x5e'):case _0x4226('0x11'):_0x2e76c3[_0x4226('0x53')](_0x13e36c+_0x4226('0x5f'));break;default:_0x6981b9[_0x4226('0x53')]('\x22\x22');}}}}if(_0x2e76c3[_0x4226('0x4f')]){handleError(_0x2c9437['data'][_0x376dbd],{'code':_0x4226('0x60'),'message':_0x2e76c3[_0x4226('0x13')]()});}else{fs[_0x4226('0x61')](_0x16622,_0x6981b9[_0x4226('0x13')]()+'\x0a');}_0x6981b9=[];}if(!(stats['rows']%0xc8)){socket[_0x4226('0x62')]('contact:import:'+_0x211627,stats);stats[_0x4226('0x3e')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x68e362['abort']();}}catch(_0xc0d735){handleError(_0x2c9437['data'][_0x376dbd],{'code':_0x4226('0x63'),'message':_0xc0d735[_0x4226('0x3d')]});logger[_0x4226('0x64')](_0x4226('0x65'),_0xc0d735[_0x4226('0x3d')]);}},'complete':function(){try{var _0x5365ce=[];var _0x559768=_0x4226('0x24');if(_0x341358[_0x4226('0x66')]&&_0x341358[_0x4226('0x66')][_0x4226('0x4f')]){_0x559768=_0x4226('0x67')+_0x211627;_0x5365ce[_0x4226('0x53')]('CREATE\x20TABLE\x20'+_0x559768+'\x20LIKE\x20cm_contacts;');}var _0x25ed6e=util[_0x4226('0xc')](_0x4226('0x68'),_0x16622,_0x559768,_0x1f17fa,_0x341358['ListId'],_0x341358[_0x4226('0x35')]||null,NOW,NOW);if(_[_0x4226('0x69')](_0x3f936c[_0x4226('0x52')])){_0x25ed6e+=_0x4226('0x6a');}_0x5365ce[_0x4226('0x53')](_0x25ed6e);if(_0x341358[_0x4226('0x66')]&&_0x341358[_0x4226('0x66')][_0x4226('0x4f')]){_0x5365ce['push'](insertCmContact(_0x341358[_0x4226('0x20')],_0x559768,_0x341358[_0x4226('0x66')],_0x3f936c));_0x5365ce['push'](_0x4226('0x6b')+_0x559768+';');}_0x5365ce['push'](insertCmHopper(_0x341358[_0x4226('0x20')],_0x4226('0x6c'),_0x4226('0x6d'),_0x4226('0x6e'),_0x549552));_0x5365ce[_0x4226('0x53')](insertCmHopperBlack(_0x341358[_0x4226('0x20')],_0x4226('0x6f'),_0x4226('0x6d'),_0x4226('0x6e')));_0x5365ce[_0x4226('0x53')](insertCmHopper(_0x341358[_0x4226('0x20')],_0x4226('0x70'),_0x4226('0x71'),'CampaignId',_0x549552));_0x5365ce[_0x4226('0x53')](insertCmHopperBlack(_0x341358[_0x4226('0x20')],_0x4226('0x72'),_0x4226('0x71'),_0x4226('0x73')));BPromise['each'](_0x5365ce,handleQuery)[_0x4226('0x74')](function(_0x52ca63){stats[_0x4226('0x75')]=!![];stats[_0x4226('0x76')]=_0x341358['duplicates']&&_0x341358[_0x4226('0x66')][_0x4226('0x4f')]?results[0x2]['affectedRows']:results[0x0][_0x4226('0x76')];socket[_0x4226('0x62')]('contact:import:'+_0x211627,stats);fs['unlink'](_0x14270d);fs['unlink'](_0x16622);process[_0x4226('0x77')](0x0);})[_0x4226('0x42')](function(_0x591646){logger['error'](_0x591646[_0x4226('0x3d')]);process[_0x4226('0x77')](0x1);});}catch(_0x14072a){logger[_0x4226('0x64')](_0x4226('0x78'),_0x14072a[_0x4226('0x3d')]);process[_0x4226('0x77')](0x1);}},'error':function(_0x1cbdf0,_0x3dde6c,_0x4b40de,_0x56a377){throw new Error(_0x56a377);}});}function validate(){if(process[_0x4226('0x79')]&&process[_0x4226('0x79')][_0x4226('0x4f')]<0x4){throw new Error(_0x4226('0x7a'));}var _0xca423d=path[_0x4226('0x13')](config['root'],_0x4226('0x49'),process[_0x4226('0x79')][0x2]);if(!fs['existsSync'](_0xca423d)){throw new Error(_0x4226('0x7b'));}var _0x125912={};try{_0x125912=JSON['parse'](process[_0x4226('0x79')][0x3]);if(!_0x125912[_0x4226('0x46')]){throw new Error(_0x4226('0x7c'));}if(!_0x125912[_0x4226('0x46')][_0x4226('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x125912[_0x4226('0x46')][_0x4226('0x5e')]){throw new Error(_0x4226('0x7d'));}var _0x4714a5=0x0;if(_0x125912[_0x4226('0x46')][_0x4226('0x22')]){_0x4714a5=0x1;}if(!_0x125912['ListId']){throw new Error(_0x4226('0x7e'));}}catch(_0x39ea00){throw new Error(_0x4226('0x7f'));}var _0x5c6ec3=[];try{_0x5c6ec3=_[_0x4226('0x80')](JSON[_0x4226('0x4d')](process[_0x4226('0x79')][0x4]),'id');}catch(_0x3907ed){logger[_0x4226('0x3b')](_0x4226('0x81'));}main(_0xca423d,_0x125912,_0x5c6ec3,_0x4714a5);}validate();process['on'](_0x4226('0x82'),handleStop);process['on'](_0x4226('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 63ca9d5..8fd66f9 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd071=['getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Name','calleridname','destexten','Queue','UniqueId','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','uniqueid','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds'];(function(_0x9c4299,_0x1cb932){var _0x129f29=function(_0x5da237){while(--_0x5da237){_0x9c4299['push'](_0x9c4299['shift']());}};_0x129f29(++_0x1cb932);}(_0xd071,0x13b));var _0x1d07=function(_0x5aa807,_0x4db92c){_0x5aa807=_0x5aa807-0x0;var _0x5091a3=_0xd071[_0x5aa807];return _0x5091a3;};'use strict';exports[_0x1d07('0x0')]=function(_0x2b2393,_0x105e2e){var _0x267603=[{'type':_0x1d07('0x1'),'content':_0x1d07('0x2'),'variableName':null}];switch(_0x2b2393[_0x1d07('0x3')]()){case _0x1d07('0x4'):switch(_0x105e2e[_0x1d07('0x3')]()){case _0x1d07('0x5'):_0x267603['push']({'type':_0x1d07('0x6'),'content':'','variableName':_0x1d07('0x7')});_0x267603[_0x1d07('0x8')]({'type':_0x1d07('0x6'),'content':'','variableName':_0x1d07('0x9')});break;case _0x1d07('0xa'):_0x267603[_0x1d07('0x8')]({'type':_0x1d07('0x1'),'content':_0x1d07('0xb'),'variableName':null});_0x267603[_0x1d07('0x8')]({'type':_0x1d07('0x6'),'content':'','variableName':_0x1d07('0xc')});break;}}return _0x267603;};exports[_0x1d07('0xd')]=function(_0x43fe5a,_0x94beb3){var _0x2b6571=[];switch(_0x43fe5a[_0x1d07('0x3')]()){case'voice':switch(_0x94beb3['toLowerCase']()){case _0x1d07('0x5'):_0x2b6571=[{'type':_0x1d07('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1d07('0xe'),'content':'','key':'Caller\x20Number','keyType':_0x1d07('0x6'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x1d07('0xf'),'keyType':'variable','variableName':_0x1d07('0x10')},{'type':_0x1d07('0xe'),'content':'','key':'Call\x20To','keyType':_0x1d07('0x6'),'variableName':_0x1d07('0x11')},{'type':_0x1d07('0xe'),'content':'','key':_0x1d07('0x12'),'keyType':'variable','variableName':_0x1d07('0x7')},{'type':'keyValue','content':'','key':_0x1d07('0x13'),'keyType':_0x1d07('0x6'),'variableName':'uniqueid'},{'type':_0x1d07('0xe'),'content':'','key':'Date','keyType':_0x1d07('0x6'),'variableName':'agentcalledAt'},{'type':'string','content':_0x1d07('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x1d07('0xe'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x1d07('0x15')},{'type':'keyValue','content':'','key':_0x1d07('0x16'),'keyType':_0x1d07('0x6'),'variableName':_0x1d07('0xc')},{'type':_0x1d07('0x1'),'content':_0x1d07('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x1d07('0xe'),'content':'','key':_0x1d07('0x18'),'keyType':_0x1d07('0x6'),'variableName':'agentcalledAt'},{'type':_0x1d07('0xe'),'content':'','key':_0x1d07('0x19'),'keyType':_0x1d07('0x6'),'variableName':_0x1d07('0x1a')},{'type':'keyValue','content':'','key':_0x1d07('0x1b'),'keyType':_0x1d07('0x6'),'variableName':_0x1d07('0x1c')},{'type':_0x1d07('0xe'),'content':'','key':_0x1d07('0x1d'),'keyType':_0x1d07('0x6'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0x1d07('0x1e'),'keyType':'variable','variableName':_0x1d07('0x1f')}];break;case _0x1d07('0xa'):_0x2b6571=[{'type':_0x1d07('0x1'),'content':_0x1d07('0x20'),'variableName':null},{'type':_0x1d07('0xe'),'content':'','key':_0x1d07('0x21'),'keyType':_0x1d07('0x6'),'keyContent':'','variableName':_0x1d07('0xc')},{'type':_0x1d07('0xe'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x1d07('0x22')},{'type':'keyValue','content':'','key':_0x1d07('0x13'),'keyType':_0x1d07('0x6'),'keyContent':'','variableName':_0x1d07('0x23')},{'type':'keyValue','content':'','key':_0x1d07('0x24'),'keyType':_0x1d07('0x6'),'keyContent':'','variableName':_0x1d07('0x25')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x1d07('0x26'),'keyType':_0x1d07('0x6'),'keyContent':'','variableName':_0x1d07('0x27')},{'type':'keyValue','content':'','key':_0x1d07('0x28'),'keyType':_0x1d07('0x6'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x1d07('0x29'),'keyType':_0x1d07('0x6'),'keyContent':'','variableName':_0x1d07('0x2a')},{'type':_0x1d07('0xe'),'content':'','key':_0x1d07('0x2b'),'keyType':'variable','keyContent':'','variableName':_0x1d07('0x2c')}];break;}}return _0x2b6571;}; \ No newline at end of file +var _0x200c=['answertime','Complete\x20Time','endtime','duration','Billable\x20Time','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','holdtime','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','starttime','Answer\x20Time'];(function(_0x597207,_0x3244c0){var _0x1b9743=function(_0x5cae81){while(--_0x5cae81){_0x597207['push'](_0x597207['shift']());}};_0x1b9743(++_0x3244c0);}(_0x200c,0x1c8));var _0xc200=function(_0xc07e37,_0xda8e5d){_0xc07e37=_0xc07e37-0x0;var _0x5a1c58=_0x200c[_0xc07e37];return _0x5a1c58;};'use strict';exports[_0xc200('0x0')]=function(_0x42401d,_0x340d7a){var _0x3ab09c=[{'type':'string','content':_0xc200('0x1'),'variableName':null}];switch(_0x42401d[_0xc200('0x2')]()){case _0xc200('0x3'):switch(_0x340d7a['toLowerCase']()){case _0xc200('0x4'):_0x3ab09c[_0xc200('0x5')]({'type':_0xc200('0x6'),'content':'','variableName':_0xc200('0x7')});_0x3ab09c[_0xc200('0x5')]({'type':'variable','content':'','variableName':_0xc200('0x8')});break;case'outbound':_0x3ab09c[_0xc200('0x5')]({'type':_0xc200('0x9'),'content':_0xc200('0xa'),'variableName':null});_0x3ab09c[_0xc200('0x5')]({'type':'variable','content':'','variableName':_0xc200('0xb')});break;}}return _0x3ab09c;};exports['getDescriptions']=function(_0xfb06ff,_0x1da66c){var _0x15714a=[];switch(_0xfb06ff[_0xc200('0x2')]()){case _0xc200('0x3'):switch(_0x1da66c[_0xc200('0x2')]()){case _0xc200('0x4'):_0x15714a=[{'type':'string','content':_0xc200('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xc200('0xd'),'content':'','key':'Caller\x20Number','keyType':_0xc200('0x6'),'variableName':_0xc200('0x8')},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0xe'),'keyType':'variable','variableName':_0xc200('0xf')},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x10'),'keyType':_0xc200('0x6'),'variableName':_0xc200('0x11')},{'type':_0xc200('0xd'),'content':'','key':'Queue','keyType':_0xc200('0x6'),'variableName':'queue'},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x12'),'keyType':_0xc200('0x6'),'variableName':_0xc200('0x13')},{'type':'keyValue','content':'','key':_0xc200('0x14'),'keyType':_0xc200('0x6'),'variableName':_0xc200('0x15')},{'type':_0xc200('0x9'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xc200('0x16'),'keyType':_0xc200('0x6'),'variableName':_0xc200('0x17')},{'type':_0xc200('0xd'),'content':'','key':'Agent\x20Number','keyType':_0xc200('0x6'),'variableName':_0xc200('0xb')},{'type':_0xc200('0x9'),'content':_0xc200('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xc200('0x19'),'keyType':_0xc200('0x6'),'variableName':_0xc200('0x15')},{'type':_0xc200('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0xc200('0x6'),'variableName':_0xc200('0x1a')},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x1b'),'keyType':_0xc200('0x6'),'variableName':'agentcompleteAt'},{'type':_0xc200('0xd'),'content':'','key':'Hold\x20Time','keyType':_0xc200('0x6'),'variableName':_0xc200('0x1c')},{'type':'keyValue','content':'','key':_0xc200('0x1d'),'keyType':_0xc200('0x6'),'variableName':_0xc200('0x1e')}];break;case _0xc200('0x1f'):_0x15714a=[{'type':_0xc200('0x9'),'content':_0xc200('0xc'),'variableName':null},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x20'),'keyType':_0xc200('0x6'),'keyContent':'','variableName':_0xc200('0xb')},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x21'),'keyType':_0xc200('0x6'),'keyContent':'','variableName':'membername'},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x12'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xc200('0xd'),'content':'','key':'Date','keyType':_0xc200('0x6'),'keyContent':'','variableName':_0xc200('0x22')},{'type':_0xc200('0x9'),'content':_0xc200('0x18')},{'type':'keyValue','content':'','key':_0xc200('0x23'),'keyType':_0xc200('0x6'),'keyContent':'','variableName':_0xc200('0x24')},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x25'),'keyType':_0xc200('0x6'),'keyContent':'','variableName':_0xc200('0x26')},{'type':_0xc200('0xd'),'content':'','key':'Duration','keyType':_0xc200('0x6'),'keyContent':'','variableName':_0xc200('0x27')},{'type':_0xc200('0xd'),'content':'','key':_0xc200('0x28'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x15714a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index a580624..d40a91b 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8988=['null','Interaction','then','info','catch','tracked','user','clone','body','omit','html','phone','fax','lodash','../../config/logger','openchannel-interactions','fax-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8988,0xc3));var _0x8898=function(_0x1f3c7c,_0x1f8dfe){_0x1f3c7c=_0x1f3c7c-0x0;var _0x57033a=_0x8988[_0x1f3c7c];return _0x57033a;};'use strict';var _=require(_0x8898('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x8898('0x1'))(_0x8898('0x2')),'mail':require(_0x8898('0x1'))('mail-interactions'),'fax':require(_0x8898('0x1'))(_0x8898('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x8898('0x1'))('chat-interactions'),'whatsapp':require(_0x8898('0x1'))(_0x8898('0x4'))};function getInteractionId(_0x32151f,_0x29dcc6,_0x59c766){if(_0x32151f&&_0x32151f[_[_0x8898('0x5')](_0x59c766)+_0x8898('0x6')]){return _0x32151f[_['upperFirst'](_0x59c766)+'InteractionId'];}else if(_0x32151f&&_0x32151f['id']){return _0x32151f['id'];}else if(_0x29dcc6&&_0x29dcc6['id']){return _0x29dcc6['id'];}else{return'unknown';}}function log(_0x53b1e4,_0x3c49eb,_0x31d809,_0x3f8e0d,_0x41d4c3,_0x1c60c2){loggers[_0x41d4c3[_0x8898('0x7')]()][_0x53b1e4](_0x8898('0x8'),_0x1c60c2[_0x8898('0x9')](),_0x3c49eb?_0x3c49eb['id']:null,_0x3c49eb?_0x3c49eb[_0x8898('0xa')]:null,_0x3c49eb?_0x3c49eb[_0x8898('0xb')]:null,getInteractionId(_0x31d809,_0x3f8e0d,_0x41d4c3),_0x31d809?JSON[_0x8898('0xc')](_0x31d809):_0x8898('0xd'));}function updateUser(_0x3ec559,_0x14b57f,_0x560d9e,_0xe6ed21,_0xc8c72b){db[_[_0x8898('0x5')](_0xe6ed21)+_0x8898('0xe')]['findOne']({'where':{'id':getInteractionId(_0x14b57f,_0x560d9e,_0xe6ed21)}})[_0x8898('0xf')](function(_0x1ff6ed){if(_0x1ff6ed){return _0x1ff6ed['update']({'UserId':_0x3ec559?_0x3ec559['id']:null});}})[_0x8898('0xf')](function(_0xa55569){if(_0xa55569){log(_0x8898('0x10'),_0x3ec559,_0x14b57f,_0x560d9e,_0xe6ed21,_0xc8c72b);}})[_0x8898('0x11')](function(){log('error',_0x3ec559,_0x14b57f,_0x560d9e,_0xe6ed21,_0xc8c72b);});}exports[_0x8898('0x12')]=function(_0x2bdf82,_0x4a8a45){return function(_0x3a8874,_0xb37ee9,_0x34198a){var _0x548bdd=_0x3a8874[_0x8898('0x13')];var _0x4f302e={};var _0xbbdc75=_0x3a8874['query'];if(_0x4f302e){_0x4f302e=_[_0x8898('0x14')](_0x3a8874[_0x8898('0x15')]);_0x4f302e=_[_0x8898('0x16')](_0x4f302e,[_0x8898('0x15'),_0x8898('0x17'),_0x8898('0x18'),_0x8898('0x19'),'mobile']);}updateUser(_0x548bdd,_0x4f302e,_0xbbdc75,_0x2bdf82,_0x4a8a45);_0x34198a(null);};}; \ No newline at end of file +var _0x88b8=['../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','unknown','toUpperCase','name','role','null','upperFirst','then','update','info','catch','tracked','user','query','body','html','phone','fax','mobile','lodash'];(function(_0x4737a0,_0x36520e){var _0x4d558b=function(_0xaa9825){while(--_0xaa9825){_0x4737a0['push'](_0x4737a0['shift']());}};_0x4d558b(++_0x36520e);}(_0x88b8,0x6f));var _0x888b=function(_0x3ca7a9,_0x4fc0c7){_0x3ca7a9=_0x3ca7a9-0x0;var _0x399428=_0x88b8[_0x3ca7a9];return _0x399428;};'use strict';var _=require(_0x888b('0x0'));var db=require(_0x888b('0x1'))['db'];var loggers={'openchannel':require(_0x888b('0x2'))(_0x888b('0x3')),'mail':require(_0x888b('0x2'))(_0x888b('0x4')),'fax':require(_0x888b('0x2'))(_0x888b('0x5')),'sms':require(_0x888b('0x2'))(_0x888b('0x6')),'chat':require('../../config/logger')(_0x888b('0x7')),'whatsapp':require(_0x888b('0x2'))(_0x888b('0x8'))};function getInteractionId(_0x47e205,_0x393bfd,_0xe1d639){if(_0x47e205&&_0x47e205[_['upperFirst'](_0xe1d639)+'InteractionId']){return _0x47e205[_['upperFirst'](_0xe1d639)+_0x888b('0x9')];}else if(_0x47e205&&_0x47e205['id']){return _0x47e205['id'];}else if(_0x393bfd&&_0x393bfd['id']){return _0x393bfd['id'];}else{return _0x888b('0xa');}}function log(_0x17f091,_0x36715f,_0x5808c0,_0x495538,_0x2a625d,_0x3ae584){loggers[_0x2a625d['toLowerCase']()][_0x17f091]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ae584[_0x888b('0xb')](),_0x36715f?_0x36715f['id']:null,_0x36715f?_0x36715f[_0x888b('0xc')]:null,_0x36715f?_0x36715f[_0x888b('0xd')]:null,getInteractionId(_0x5808c0,_0x495538,_0x2a625d),_0x5808c0?JSON['stringify'](_0x5808c0):_0x888b('0xe'));}function updateUser(_0x30b3d4,_0x52dd8e,_0x3d4eb9,_0x1c2769,_0x36cc5d){db[_[_0x888b('0xf')](_0x1c2769)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x52dd8e,_0x3d4eb9,_0x1c2769)}})[_0x888b('0x10')](function(_0x52989c){if(_0x52989c){return _0x52989c[_0x888b('0x11')]({'UserId':_0x30b3d4?_0x30b3d4['id']:null});}})[_0x888b('0x10')](function(_0x47c153){if(_0x47c153){log(_0x888b('0x12'),_0x30b3d4,_0x52dd8e,_0x3d4eb9,_0x1c2769,_0x36cc5d);}})[_0x888b('0x13')](function(){log('error',_0x30b3d4,_0x52dd8e,_0x3d4eb9,_0x1c2769,_0x36cc5d);});}exports[_0x888b('0x14')]=function(_0x1ad651,_0x585935){return function(_0x3ea13f,_0x1bf792,_0x74061c){var _0x3b4466=_0x3ea13f[_0x888b('0x15')];var _0x138c93={};var _0x593a49=_0x3ea13f[_0x888b('0x16')];if(_0x138c93){_0x138c93=_['clone'](_0x3ea13f[_0x888b('0x17')]);_0x138c93=_['omit'](_0x138c93,[_0x888b('0x17'),_0x888b('0x18'),_0x888b('0x19'),_0x888b('0x1a'),_0x888b('0x1b')]);}updateUser(_0x3b4466,_0x138c93,_0x593a49,_0x1ad651,_0x585935);_0x74061c(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0e6b2d4..1cd93b0 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 _0x3e94=['User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','license','data1','split','createDecipher','format','%s:%s:%s','update','final','parse','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x5acef4,_0x434e7c){var _0x5bf891=function(_0x2f19f0){while(--_0x2f19f0){_0x5acef4['push'](_0x5acef4['shift']());}};_0x5bf891(++_0x434e7c);}(_0x3e94,0x19c));var _0x43e9=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3e94[_0x2b4411];return _0x8e41ef;};'use strict';var crypto=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var compose=require(_0x43e9('0x2'));var db=require(_0x43e9('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2eff38,_0x42de7b){if(_0x2eff38&&_0x42de7b){if(_0x42de7b['data1']&&_0x42de7b[_0x43e9('0x4')]){var _0x21126d=_0x42de7b[_0x43e9('0x5')];var _0x17f076=_0x42de7b[_0x43e9('0x4')];var _0x13fe64=_0x21126d['split']('-')[0x4];var _0x373f70=_0x21126d[_0x43e9('0x6')]('-')[0x0];var _0xf9d278=crypto[_0x43e9('0x7')]('aes-256-ctr',util[_0x43e9('0x8')](_0x43e9('0x9'),_0x13fe64,_0x21126d,_0x373f70));var _0x1b2df6=_0xf9d278[_0x43e9('0xa')](_0x17f076,'base64','utf8');_0x1b2df6+=_0xf9d278[_0x43e9('0xb')]('utf8');var _0xa36190=JSON[_0x43e9('0xc')](_0x1b2df6);return _0xa36190['hasOwnProperty'](_0x2eff38)?_0xa36190[_0x2eff38]:null;}}return null;}function isLimit(_0x5f3981,_0x379fd2,_0x1a6e49,_0x7ea0dd){var _0x278926=_0x379fd2;return compose()['use'](function(_0x12f429,_0x31993d,_0x360a4f){return db[_0x43e9('0xd')][_0x43e9('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x43e9('0xf')](function(_0x1d904e){var _0x2fa172=getValueFromLicense(_0x5f3981,_0x1d904e);return _0x2fa172?_0x2fa172:_0x278926;})['then'](function(_0x1faaf1){_0x278926=_0x1faaf1;return _0x1a6e49[_0x43e9('0x10')](_0x7ea0dd);})['then'](function(_0x45e382){if(_0x45e382>=_0x278926){return _0x31993d[_0x43e9('0x11')](0x193)['json']({'message':util[_0x43e9('0x8')](_0x43e9('0x12'),_0x5f3981)});}_0x360a4f();})[_0x43e9('0x13')](function(_0x2ee79d){_0x360a4f(_0x2ee79d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x43e9('0x14')],{'where':{'$or':[{'role':_0x43e9('0x15')},{'role':_0x43e9('0x16')}]}});}exports[_0x43e9('0x17')]=isUserLimit; \ No newline at end of file +var _0x1a08=['hasOwnProperty','use','findOne','then','count','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','data1','license','split','aes-256-ctr','%s:%s:%s','update','utf8','final'];(function(_0x39ee12,_0x41d6f2){var _0x432ae9=function(_0x1573ea){while(--_0x1573ea){_0x39ee12['push'](_0x39ee12['shift']());}};_0x432ae9(++_0x41d6f2);}(_0x1a08,0x15d));var _0x81a0=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x1a08[_0xa1e3e3];return _0xc980e9;};'use strict';var crypto=require(_0x81a0('0x0'));var util=require(_0x81a0('0x1'));var compose=require(_0x81a0('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5a7b0f,_0x2e2de9){if(_0x5a7b0f&&_0x2e2de9){if(_0x2e2de9[_0x81a0('0x3')]&&_0x2e2de9[_0x81a0('0x4')]){var _0x284fb9=_0x2e2de9['data1'];var _0xdec80=_0x2e2de9[_0x81a0('0x4')];var _0x59a62c=_0x284fb9[_0x81a0('0x5')]('-')[0x4];var _0x221707=_0x284fb9['split']('-')[0x0];var _0x30ee68=crypto['createDecipher'](_0x81a0('0x6'),util['format'](_0x81a0('0x7'),_0x59a62c,_0x284fb9,_0x221707));var _0x2f9126=_0x30ee68[_0x81a0('0x8')](_0xdec80,'base64',_0x81a0('0x9'));_0x2f9126+=_0x30ee68[_0x81a0('0xa')](_0x81a0('0x9'));var _0x2d3cf9=JSON['parse'](_0x2f9126);return _0x2d3cf9[_0x81a0('0xb')](_0x5a7b0f)?_0x2d3cf9[_0x5a7b0f]:null;}}return null;}function isLimit(_0x23039f,_0xe04a38,_0x5e3308,_0x18885c){var _0x1bcda0=_0xe04a38;return compose()[_0x81a0('0xc')](function(_0x414eb5,_0x1296ae,_0x5bda64){return db['License'][_0x81a0('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x81a0('0xe')](function(_0x5ce3bd){var _0x3f6c72=getValueFromLicense(_0x23039f,_0x5ce3bd);return _0x3f6c72?_0x3f6c72:_0x1bcda0;})[_0x81a0('0xe')](function(_0x1d273b){_0x1bcda0=_0x1d273b;return _0x5e3308[_0x81a0('0xf')](_0x18885c);})[_0x81a0('0xe')](function(_0x5a7f16){if(_0x5a7f16>=_0x1bcda0){return _0x1296ae['status'](0x193)['json']({'message':util[_0x81a0('0x10')](_0x81a0('0x11'),_0x23039f)});}_0x5bda64();})[_0x81a0('0x12')](function(_0x4411f4){_0x5bda64(_0x4411f4);});});}function isUserLimit(){return isLimit(_0x81a0('0x13'),0x1,db[_0x81a0('0x14')],{'where':{'$or':[{'role':_0x81a0('0x15')},{'role':_0x81a0('0x16')}]}});}exports[_0x81a0('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9ca40d3..63d889f 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 _0xb93f=['lodash','moment','parseSearch','startsWith','and','replace','[$and]','[$or]','split','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','start','$endsWith','pop','format','hours','add','seconds'];(function(_0x360306,_0x33f8b6){var _0x1676c6=function(_0xf797ab){while(--_0xf797ab){_0x360306['push'](_0x360306['shift']());}};_0x1676c6(++_0x33f8b6);}(_0xb93f,0x17a));var _0xfb93=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0xb93f[_0x343090];return _0x3ff3e8;};'use strict';var _=require(_0xfb93('0x0'));var moment=require(_0xfb93('0x1'));exports[_0xfb93('0x2')]=function(_0x59bee7){var _0x5bce28={'conditions':[]};_0x5bce28['sqlOperator']=_[_0xfb93('0x3')](_0x59bee7,'[$or]')?'or':_0xfb93('0x4');var _0x442acb=_0x59bee7[_0xfb93('0x5')](_0xfb93('0x6'),'')[_0xfb93('0x5')](_0xfb93('0x7'),'')[_0xfb93('0x8')]('||');for(var _0x3eb0b1=0x0;_0x3eb0b1<_0x442acb['length'];_0x3eb0b1++){var _0x43fd0a=_0x442acb[_0x3eb0b1][_0xfb93('0x8')](':=');var _0x206248=_0x43fd0a[0x0];var _0x40d54a=_0x43fd0a['slice'](0x1);_0x40d54a[_0xfb93('0x9')](function(_0x591a8e){var _0xe22b61=_0x591a8e[_0xfb93('0x8')]('[')[_0xfb93('0xa')]();var _0x3e7270=_0x591a8e[_0xfb93('0xb')](/\[(.*?)\]/g);_0x3e7270['forEach'](function(_0x5ba9a8){var _0x5cdc72=_0x5ba9a8[_0xfb93('0x8')]('[')[_0xfb93('0xc')](function(_0x47f5d1){return _0x47f5d1[_0xfb93('0xd')](']')>-0x1;})[_0xfb93('0xe')](function(_0x3d5819){return _0x3d5819[_0xfb93('0x8')](']')[0x0];})[0x0];_0x5bce28['conditions'][_0xfb93('0xf')]({'field':_0x206248,'operator':_0xe22b61,'value':_0x5cdc72});});});}return _0x5bce28;};exports[_0xfb93('0x10')]=function(_0x2a254e,_0x39631c,_0x698f58){var _0x47fb3a={};if(_0x39631c===_0xfb93('0x11')){if(_0x698f58[_0xfb93('0x12')]===_0xfb93('0x13')){_0x698f58[_0xfb93('0x12')]=_0xfb93('0x14');_0x698f58[_0xfb93('0x15')]+=','+_0x698f58[_0xfb93('0x15')];}else if(_[_0xfb93('0x16')]([_0xfb93('0x17'),_0xfb93('0x18')],_0x698f58[_0xfb93('0x12')])){_0x698f58[_0xfb93('0x15')]=moment(_0x698f58[_0xfb93('0x15')])['add'](0x1,_0xfb93('0x19'))['format'](_0xfb93('0x1a'));}}if(_0x698f58[_0xfb93('0x1b')]){_0x39631c=_0x698f58[_0xfb93('0x1b')];_0x47fb3a['text']=_0xfb93('0x1c')+_0x2a254e+'.'+_0x698f58[_0xfb93('0x1d')]+'\x20AS\x20'+_0x698f58[_0xfb93('0x1b')]+')\x20'+parseOperator(_0x698f58['operator']);}else{_0x47fb3a[_0xfb93('0x1e')]=_0x2a254e+'.'+_0x698f58['field']+'\x20'+parseOperator(_0x698f58[_0xfb93('0x12')]);}if(_['includes']([_0xfb93('0x1f'),_0xfb93('0x20')],_0x698f58['operator']))_0x47fb3a['text']='('+_0x47fb3a['text']+'\x20OR\x20'+_0x2a254e+'.'+_0x698f58[_0xfb93('0x1d')]+_0xfb93('0x21');_0x47fb3a[_0xfb93('0x15')]=parseValue(_0x39631c,_0x698f58[_0xfb93('0x12')],_0x698f58[_0xfb93('0x15')]);return _0x47fb3a;};function parseOperator(_0xa809e0){var _0x45ac05;switch(_0xa809e0){case _0xfb93('0x22'):_0x45ac05=_0xfb93('0x23');break;case _0xfb93('0x20'):_0x45ac05=_0xfb93('0x24');break;case _0xfb93('0x13'):_0x45ac05=_0xfb93('0x25');break;case _0xfb93('0x1f'):_0x45ac05=_0xfb93('0x26');break;case _0xfb93('0x27'):case _0xfb93('0x28'):case'$endsWith':_0x45ac05=_0xfb93('0x29');break;case _0xfb93('0x2a'):_0x45ac05=_0xfb93('0x2b');break;case _0xfb93('0x17'):_0x45ac05=_0xfb93('0x2c');break;case _0xfb93('0x18'):_0x45ac05=_0xfb93('0x2d');break;case'$gte':_0x45ac05=_0xfb93('0x2e');break;case'$between':_0x45ac05='BETWEEN\x20?\x20AND\x20?';break;}return _0x45ac05;}function parseValue(_0x1f830c,_0x1c5747,_0x310359){var _0xc747e5={'start':undefined,'end':undefined};switch(_0x1c5747){case _0xfb93('0x22'):case _0xfb93('0x20'):_0xc747e5[_0xfb93('0x2f')]=_0x310359[_0xfb93('0x8')](',');break;case _0xfb93('0x27'):_0xc747e5['start']='%'+_0x310359+'%';break;case _0xfb93('0x28'):_0xc747e5['start']=_0x310359+'%';break;case _0xfb93('0x30'):_0xc747e5[_0xfb93('0x2f')]='%'+_0x310359;break;case _0xfb93('0x14'):var _0x37f6f1=_0x310359['split'](',');var _0x310359=_0x37f6f1[_0xfb93('0xa')]();var _0x19fae6=_0x37f6f1[_0xfb93('0x31')]();if(_0x1f830c==='DATE'){_0x310359=moment(_0x310359)['utcOffset'](0x0,!![])[_0xfb93('0x32')]();_0x19fae6=moment(_0x19fae6)['utcOffset'](0x0,!![])['add'](0x17,_0xfb93('0x33'))['add'](0x3b,'minutes')[_0xfb93('0x34')](0x3b,_0xfb93('0x35'))[_0xfb93('0x32')]();}_0xc747e5={'start':_0x310359,'end':_0x19fae6};break;default:_0xc747e5[_0xfb93('0x2f')]=_0x310359;break;}return _0xc747e5;} \ No newline at end of file +var _0xdcc0=['$between','BETWEEN\x20?\x20AND\x20?','start','DATE','utcOffset','hours','minutes','seconds','format','lodash','parseSearch','sqlOperator','and','replace','[$and]','[$or]','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','operator','$eq','value','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','\x20AS\x20','field','includes','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','<=\x20?','$gte','>=\x20?'];(function(_0x2e6a19,_0x8ebc18){var _0x44b551=function(_0x46238d){while(--_0x46238d){_0x2e6a19['push'](_0x2e6a19['shift']());}};_0x44b551(++_0x8ebc18);}(_0xdcc0,0x79));var _0x0dcc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xdcc0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0dcc('0x0'));var moment=require('moment');exports[_0x0dcc('0x1')]=function(_0x189ea7){var _0x506fd2={'conditions':[]};_0x506fd2[_0x0dcc('0x2')]=_['startsWith'](_0x189ea7,'[$or]')?'or':_0x0dcc('0x3');var _0x36a587=_0x189ea7[_0x0dcc('0x4')](_0x0dcc('0x5'),'')[_0x0dcc('0x4')](_0x0dcc('0x6'),'')[_0x0dcc('0x7')]('||');for(var _0xd54e9a=0x0;_0xd54e9a<_0x36a587[_0x0dcc('0x8')];_0xd54e9a++){var _0x21e0a9=_0x36a587[_0xd54e9a][_0x0dcc('0x7')](':=');var _0x462a8a=_0x21e0a9[0x0];var _0x43eaf7=_0x21e0a9[_0x0dcc('0x9')](0x1);_0x43eaf7['forEach'](function(_0x273137){var _0x29519c=_0x273137[_0x0dcc('0x7')]('[')[_0x0dcc('0xa')]();var _0x462a80=_0x273137[_0x0dcc('0xb')](/\[(.*?)\]/g);_0x462a80[_0x0dcc('0xc')](function(_0x368e55){var _0xf4c8e0=_0x368e55[_0x0dcc('0x7')]('[')[_0x0dcc('0xd')](function(_0x5c3d56){return _0x5c3d56[_0x0dcc('0xe')](']')>-0x1;})[_0x0dcc('0xf')](function(_0x1adf63){return _0x1adf63[_0x0dcc('0x7')](']')[0x0];})[0x0];_0x506fd2[_0x0dcc('0x10')]['push']({'field':_0x462a8a,'operator':_0x29519c,'value':_0xf4c8e0});});});}return _0x506fd2;};exports[_0x0dcc('0x11')]=function(_0x43849d,_0x34f4d9,_0x24dfdd){var _0xadeabd={};if(_0x34f4d9==='DATE'){if(_0x24dfdd[_0x0dcc('0x12')]===_0x0dcc('0x13')){_0x24dfdd['operator']='$between';_0x24dfdd[_0x0dcc('0x14')]+=','+_0x24dfdd[_0x0dcc('0x14')];}else if(_['includes']([_0x0dcc('0x15'),_0x0dcc('0x16')],_0x24dfdd[_0x0dcc('0x12')])){_0x24dfdd[_0x0dcc('0x14')]=moment(_0x24dfdd[_0x0dcc('0x14')])[_0x0dcc('0x17')](0x1,_0x0dcc('0x18'))['format'](_0x0dcc('0x19'));}}if(_0x24dfdd['castTo']){_0x34f4d9=_0x24dfdd[_0x0dcc('0x1a')];_0xadeabd[_0x0dcc('0x1b')]='CAST('+_0x43849d+'.'+_0x24dfdd['field']+_0x0dcc('0x1c')+_0x24dfdd[_0x0dcc('0x1a')]+')\x20'+parseOperator(_0x24dfdd[_0x0dcc('0x12')]);}else{_0xadeabd['text']=_0x43849d+'.'+_0x24dfdd[_0x0dcc('0x1d')]+'\x20'+parseOperator(_0x24dfdd[_0x0dcc('0x12')]);}if(_[_0x0dcc('0x1e')](['$ne','$notIn'],_0x24dfdd[_0x0dcc('0x12')]))_0xadeabd[_0x0dcc('0x1b')]='('+_0xadeabd[_0x0dcc('0x1b')]+_0x0dcc('0x1f')+_0x43849d+'.'+_0x24dfdd[_0x0dcc('0x1d')]+_0x0dcc('0x20');_0xadeabd['value']=parseValue(_0x34f4d9,_0x24dfdd['operator'],_0x24dfdd[_0x0dcc('0x14')]);return _0xadeabd;};function parseOperator(_0x1efedf){var _0x236228;switch(_0x1efedf){case _0x0dcc('0x21'):_0x236228=_0x0dcc('0x22');break;case _0x0dcc('0x23'):_0x236228='NOT\x20IN\x20?';break;case'$eq':_0x236228=_0x0dcc('0x24');break;case _0x0dcc('0x25'):_0x236228=_0x0dcc('0x26');break;case _0x0dcc('0x27'):case _0x0dcc('0x28'):case _0x0dcc('0x29'):_0x236228='LIKE\x20?';break;case _0x0dcc('0x2a'):_0x236228=_0x0dcc('0x2b');break;case'$gt':_0x236228='>\x20?';break;case'$lte':_0x236228=_0x0dcc('0x2c');break;case _0x0dcc('0x2d'):_0x236228=_0x0dcc('0x2e');break;case _0x0dcc('0x2f'):_0x236228=_0x0dcc('0x30');break;}return _0x236228;}function parseValue(_0x5257a3,_0x547f,_0x249579){var _0xd1f221={'start':undefined,'end':undefined};switch(_0x547f){case _0x0dcc('0x21'):case _0x0dcc('0x23'):_0xd1f221[_0x0dcc('0x31')]=_0x249579[_0x0dcc('0x7')](',');break;case _0x0dcc('0x27'):_0xd1f221[_0x0dcc('0x31')]='%'+_0x249579+'%';break;case _0x0dcc('0x28'):_0xd1f221['start']=_0x249579+'%';break;case _0x0dcc('0x29'):_0xd1f221[_0x0dcc('0x31')]='%'+_0x249579;break;case'$between':var _0x22496c=_0x249579[_0x0dcc('0x7')](',');var _0x249579=_0x22496c[_0x0dcc('0xa')]();var _0x208cfe=_0x22496c['pop']();if(_0x5257a3===_0x0dcc('0x32')){_0x249579=moment(_0x249579)[_0x0dcc('0x33')](0x0,!![])['format']();_0x208cfe=moment(_0x208cfe)[_0x0dcc('0x33')](0x0,!![])['add'](0x17,_0x0dcc('0x34'))[_0x0dcc('0x17')](0x3b,_0x0dcc('0x35'))[_0x0dcc('0x17')](0x3b,_0x0dcc('0x36'))[_0x0dcc('0x37')]();}_0xd1f221={'start':_0x249579,'end':_0x208cfe};break;default:_0xd1f221[_0x0dcc('0x31')]=_0x249579;break;}return _0xd1f221;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8f59c35..275a39b 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 _0xe0ae=['sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','getOptions','query','$id','model','intersection','fields','attributes','nolimit','limit','order','where','pick','filter','columns','value','VIRTUAL','lower','merge','moment','keys','parse','filters','isEmpty','forOwn','find','type','isPlainObject','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','split','offset'];(function(_0x5ed713,_0x4ddd2e){var _0x48b5e6=function(_0x29065c){while(--_0x29065c){_0x5ed713['push'](_0x5ed713['shift']());}};_0x48b5e6(++_0x4ddd2e);}(_0xe0ae,0xa1));var _0xee0a=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xe0ae[_0x305b20];return _0x26d64a;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xee0a('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x401526){var _0x49a5e2=['ne'];try{var _0x42f3f6=JSON['parse'](_0x401526);var _0x32cc3e=Object[_0xee0a('0x1')](_0x42f3f6)[0x0];return _0x49a5e2['includes'](_0x32cc3e);}catch(_0x13a94a){return![];}}function getOperatorValue(_0x4d393b){var _0x5bef07=JSON[_0xee0a('0x2')](_0x4d393b);var _0x1c5071=Object[_0xee0a('0x1')](_0x5bef07)[0x0];var _0x344355=_0x5bef07[_0x1c5071];return{['$'+_0x1c5071]:_0x344355};}exports['fields']=function(_0x2296b9){var _0x49d436=null;if(_0x2296b9){_0x49d436=_0x2296b9['split'](',');}return _0x49d436;};exports[_0xee0a('0x3')]=function(_0x3d0b3f,_0xbd4483){var _0x57d190={};if(!_[_0xee0a('0x4')](_0x3d0b3f)){_[_0xee0a('0x5')](_0x3d0b3f,function(_0x548eb7,_0x305987){try{if(_0xbd4483){var _0x4b3e49=_[_0xee0a('0x6')](_0xbd4483,{'name':_0x305987})||{};if(hasSequelizeOperator(_0x548eb7)){_0x57d190[_0x305987]=getOperatorValue(_0x548eb7);}else if(_0x4b3e49[_0xee0a('0x7')]==='DATE'&&_[_0xee0a('0x8')](_0x548eb7)){var _0x5c56d9=JSON[_0xee0a('0x2')](_0x548eb7);var _0x1f2e57={'$gte':moment(moment(_0x5c56d9['$gte'])['format'](_0xee0a('0x9')))[_0xee0a('0xa')]()[_0xee0a('0xb')](),'$lte':moment(moment(_0x5c56d9[_0xee0a('0xc')])[_0xee0a('0xb')]('YYYY-MM-DD'))[_0xee0a('0xa')]()[_0xee0a('0xd')](0x1,'s')['format']()};_0x57d190[_0x305987]=_0x1f2e57;}else if(_0x4b3e49[_0xee0a('0xe')]===_0xee0a('0xf')){_0x57d190[_0x305987]=_0x548eb7;}else{_0x57d190[_0x305987]=_[_0xee0a('0x10')](_0x548eb7)?_0x548eb7:JSON[_0xee0a('0x2')](_0x548eb7);}}else{_0x57d190[_0x305987]=_['isArray'](_0x548eb7)?_0x548eb7:JSON[_0xee0a('0x2')](_0x548eb7);}}catch(_0x1d7a8a){_0x57d190[_0x305987]=_0x548eb7[_0xee0a('0x11')](',');}});}return _0x57d190;};exports['limit']=function(_0x1c1be5){_0x1c1be5=parseInt(_0x1c1be5,0xa);if(!_0x1c1be5||_0x1c1be5<0x0){_0x1c1be5=LIMIT_VALUE;}return _0x1c1be5;};exports[_0xee0a('0x12')]=function(_0xe1f346){_0xe1f346=parseInt(_0xe1f346,0xa);if(!_0xe1f346||_0xe1f346<0x0){_0xe1f346=0x0;}return _0xe1f346;};exports[_0xee0a('0x13')]=function(_0x5d29e0){var _0xe9d5d4,_0x10c224=null;if(_0x5d29e0){_0xe9d5d4=_0x5d29e0[_0xee0a('0x11')](',');_0x10c224=_[_0xee0a('0x14')](_0xe9d5d4,function(_0x5c981e){if(_0x5c981e[_0xee0a('0x15')]('-')===0x0){return[_0x5c981e===_0xee0a('0x16')?sequelize[_0xee0a('0x17')](sequelize[_0xee0a('0x18')](_0xee0a('0x16')),_0xee0a('0x19')):_0x5c981e[_0xee0a('0x1a')](0x1),'DESC'];}else{return[_0x5c981e===_0xee0a('0x16')?sequelize[_0xee0a('0x17')](sequelize[_0xee0a('0x18')](_0xee0a('0x16')),'unsigned'):_0x5c981e,_0xee0a('0x1b')];}});}return _0x10c224;};exports[_0xee0a('0x1c')]=function(_0x1fe1a3,_0x2c414d){if(_['isEmpty'](_0x1fe1a3)){return _0x1fe1a3;}if(_['isArray'](_0x1fe1a3)){for(var _0x578ecf=0x0;_0x578ecf<_0x1fe1a3[_0xee0a('0x1d')];_0x578ecf+=0x1){_0x1fe1a3[_0x578ecf]=this['omit'](_0x1fe1a3[_0x578ecf],_0x2c414d);}return _0x1fe1a3;}if(!_['isObject'](_0x1fe1a3)){return _0x1fe1a3;}if(_[_0xee0a('0x1e')](_0x2c414d)){_0x2c414d=[_0x2c414d];}if(!_[_0xee0a('0x10')](_0x2c414d)){return _0x1fe1a3;}for(var _0xe5365f=0x0;_0xe5365f<_0x2c414d['length'];_0xe5365f+=0x1){_[_0xee0a('0x1f')](_0x1fe1a3,_0x2c414d[_0xe5365f]);}for(var _0xe14449 in _0x1fe1a3){if(_0x1fe1a3[_0xee0a('0x20')](_0xe14449)){_0x1fe1a3[_0xe14449]=this[_0xee0a('0x1c')](_0x1fe1a3[_0xe14449],_0x2c414d);}}return _0x1fe1a3;};exports[_0xee0a('0x21')]=function(_0x45538d){return _0x45538d[_0xee0a('0x22')](RegExp(_0xee0a('0x23')))?!![]:![];};exports[_0xee0a('0x24')]=function(_0x7b472b){return _0x7b472b['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xee0a('0x25')]=function(_0x1a97e0){var _0x284be5=[];_0x1a97e0[_0xee0a('0x11')](/[ ,]+/)[_0xee0a('0x26')](function(_0x3faad3){_0x3faad3=_0x3faad3['replace'](/([^:]")"+/g,'$1');_0x3faad3='+'+_0x3faad3+'*';if(_0x3faad3[_0xee0a('0x27')]('@'))_0x3faad3='\x22'+_0x3faad3+'\x22';_0x284be5[_0xee0a('0x28')](_0x3faad3);});return _0x284be5[_0xee0a('0x29')]('\x20');};exports[_0xee0a('0x2a')]=function(_0x4b9cd7,_0x354dff,_0x55e328){var _0x192bc6={},_0x2419d7={};if(_0x354dff[_0xee0a('0x2b')][_0xee0a('0x2c')]){_0x354dff[_0xee0a('0x2b')]['id']=_0x354dff[_0xee0a('0x2b')][_0xee0a('0x2c')];delete _0x354dff[_0xee0a('0x2b')]['$id'];}_0x192bc6[_0xee0a('0x2d')]=_[_0xee0a('0x14')](_0x4b9cd7,'name');_0x192bc6[_0xee0a('0x2b')]=_[_0xee0a('0x1')](_0x354dff[_0xee0a('0x2b')]);_0x192bc6['filters']=_[_0xee0a('0x2e')](_0x192bc6[_0xee0a('0x2d')],_0x192bc6[_0xee0a('0x2b')]);_0x2419d7['attributes']=_[_0xee0a('0x2e')](_0x192bc6[_0xee0a('0x2d')],this[_0xee0a('0x2f')](_0x354dff['query']['fields']));_0x2419d7[_0xee0a('0x30')]=_0x2419d7[_0xee0a('0x30')][_0xee0a('0x1d')]?_0x2419d7[_0xee0a('0x30')]:_0x192bc6[_0xee0a('0x2d')];if(!_0x354dff[_0xee0a('0x2b')][_0xee0a('0x20')](_0xee0a('0x31'))){_0x2419d7[_0xee0a('0x32')]=this['limit'](_0x354dff[_0xee0a('0x2b')][_0xee0a('0x32')]);_0x2419d7['offset']=this[_0xee0a('0x12')](_0x354dff[_0xee0a('0x2b')]['offset']);}_0x2419d7[_0xee0a('0x33')]=this[_0xee0a('0x13')](_0x354dff[_0xee0a('0x2b')][_0xee0a('0x13')]);_0x2419d7[_0xee0a('0x34')]=this[_0xee0a('0x3')](_[_0xee0a('0x35')](_0x354dff[_0xee0a('0x2b')],_0x192bc6[_0xee0a('0x3')]),_0x4b9cd7);if(_0x354dff['query'][_0xee0a('0x36')]){var _0x263878=_0x4b9cd7;var _0x41eba8=_0x354dff[_0xee0a('0x2b')]['filter'];if(typeof _0x41eba8==='object'){_0x263878=_[_0xee0a('0x36')](_0x4b9cd7,function(_0x2715f7){return _[_0xee0a('0x27')](_0x41eba8[_0xee0a('0x37')],_0x2715f7[_0xee0a('0xe')]);});_0x41eba8=_0x41eba8[_0xee0a('0x38')];}_0x2419d7[_0xee0a('0x34')]=_['merge'](_0x2419d7['where'],{'$or':_[_0xee0a('0x14')](_0x263878,function(_0x283062){if(_0x283062['type']!==_0xee0a('0x39')){if(_0x55e328){return sequelize[_0xee0a('0x34')](sequelize['fn']('lower',sequelize[_0xee0a('0x18')](_0x283062[_0xee0a('0xe')])),{'$like':sequelize['fn'](_0xee0a('0x3a'),'%'+_0x354dff[_0xee0a('0x2b')][_0xee0a('0x36')]+'%')});}else{var _0x108827={};_0x108827[_0x283062[_0xee0a('0xe')]]={'$like':'%'+_0x354dff['query']['filter']+'%'};return _0x108827;}}})});}_0x2419d7=_[_0xee0a('0x3b')]({},_0x2419d7,_0x354dff['options']);return _0x2419d7;}; \ No newline at end of file +var _0x4f29=['map','priority','substr','unsigned','omit','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','getOptions','query','$id','model','attributes','intersection','length','nolimit','order','where','filter','object','columns','merge','VIRTUAL','lower','col','options','lodash','sequelize','parse','keys','includes','fields','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','split','limit','offset','sort'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x4f29,0x1e0));var _0x94f2=function(_0x237deb,_0xe65b19){_0x237deb=_0x237deb-0x0;var _0x14ec74=_0x4f29[_0x237deb];return _0x14ec74;};'use strict';var _=require(_0x94f2('0x0'));var sequelize=require(_0x94f2('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x523ae7){var _0x159001=['ne'];try{var _0x47d93e=JSON[_0x94f2('0x2')](_0x523ae7);var _0x5f93d0=Object[_0x94f2('0x3')](_0x47d93e)[0x0];return _0x159001[_0x94f2('0x4')](_0x5f93d0);}catch(_0x321f3e){return![];}}function getOperatorValue(_0x4e9880){var _0x33e1b8=JSON[_0x94f2('0x2')](_0x4e9880);var _0x43eb5c=Object[_0x94f2('0x3')](_0x33e1b8)[0x0];var _0x477049=_0x33e1b8[_0x43eb5c];return{['$'+_0x43eb5c]:_0x477049};}exports[_0x94f2('0x5')]=function(_0x1ea88f){var _0x3ffbd8=null;if(_0x1ea88f){_0x3ffbd8=_0x1ea88f['split'](',');}return _0x3ffbd8;};exports[_0x94f2('0x6')]=function(_0x31e717,_0x210799){var _0x3ba172={};if(!_['isEmpty'](_0x31e717)){_[_0x94f2('0x7')](_0x31e717,function(_0x5ea74d,_0x5383cb){try{if(_0x210799){var _0x4b7f72=_[_0x94f2('0x8')](_0x210799,{'name':_0x5383cb})||{};if(hasSequelizeOperator(_0x5ea74d)){_0x3ba172[_0x5383cb]=getOperatorValue(_0x5ea74d);}else if(_0x4b7f72[_0x94f2('0x9')]===_0x94f2('0xa')&&_[_0x94f2('0xb')](_0x5ea74d)){var _0x41f11e=JSON[_0x94f2('0x2')](_0x5ea74d);var _0x35c4b5={'$gte':moment(moment(_0x41f11e[_0x94f2('0xc')])[_0x94f2('0xd')](_0x94f2('0xe')))[_0x94f2('0xf')]()['format'](),'$lte':moment(moment(_0x41f11e[_0x94f2('0x10')])[_0x94f2('0xd')]('YYYY-MM-DD'))[_0x94f2('0xf')]()['subtract'](0x1,'s')[_0x94f2('0xd')]()};_0x3ba172[_0x5383cb]=_0x35c4b5;}else if(_0x4b7f72[_0x94f2('0x11')]===_0x94f2('0x12')){_0x3ba172[_0x5383cb]=_0x5ea74d;}else{_0x3ba172[_0x5383cb]=_[_0x94f2('0x13')](_0x5ea74d)?_0x5ea74d:JSON['parse'](_0x5ea74d);}}else{_0x3ba172[_0x5383cb]=_[_0x94f2('0x13')](_0x5ea74d)?_0x5ea74d:JSON['parse'](_0x5ea74d);}}catch(_0x3e9971){_0x3ba172[_0x5383cb]=_0x5ea74d[_0x94f2('0x14')](',');}});}return _0x3ba172;};exports[_0x94f2('0x15')]=function(_0x6ff7e3){_0x6ff7e3=parseInt(_0x6ff7e3,0xa);if(!_0x6ff7e3||_0x6ff7e3<0x0){_0x6ff7e3=LIMIT_VALUE;}return _0x6ff7e3;};exports[_0x94f2('0x16')]=function(_0x559f5e){_0x559f5e=parseInt(_0x559f5e,0xa);if(!_0x559f5e||_0x559f5e<0x0){_0x559f5e=0x0;}return _0x559f5e;};exports[_0x94f2('0x17')]=function(_0x3606d3){var _0xc38fcb,_0x4d35ce=null;if(_0x3606d3){_0xc38fcb=_0x3606d3[_0x94f2('0x14')](',');_0x4d35ce=_[_0x94f2('0x18')](_0xc38fcb,function(_0x3c683c){if(_0x3c683c['indexOf']('-')===0x0){return[_0x3c683c===_0x94f2('0x19')?sequelize['cast'](sequelize['col']('priority'),'unsigned'):_0x3c683c[_0x94f2('0x1a')](0x1),'DESC'];}else{return[_0x3c683c===_0x94f2('0x19')?sequelize['cast'](sequelize['col']('priority'),_0x94f2('0x1b')):_0x3c683c,'ASC'];}});}return _0x4d35ce;};exports[_0x94f2('0x1c')]=function(_0x437e4c,_0x15d085){if(_['isEmpty'](_0x437e4c)){return _0x437e4c;}if(_[_0x94f2('0x13')](_0x437e4c)){for(var _0x2f196d=0x0;_0x2f196d<_0x437e4c['length'];_0x2f196d+=0x1){_0x437e4c[_0x2f196d]=this[_0x94f2('0x1c')](_0x437e4c[_0x2f196d],_0x15d085);}return _0x437e4c;}if(!_['isObject'](_0x437e4c)){return _0x437e4c;}if(_[_0x94f2('0x1d')](_0x15d085)){_0x15d085=[_0x15d085];}if(!_[_0x94f2('0x13')](_0x15d085)){return _0x437e4c;}for(var _0x8c37e0=0x0;_0x8c37e0<_0x15d085['length'];_0x8c37e0+=0x1){_[_0x94f2('0x1e')](_0x437e4c,_0x15d085[_0x8c37e0]);}for(var _0x1503a1 in _0x437e4c){if(_0x437e4c[_0x94f2('0x1f')](_0x1503a1)){_0x437e4c[_0x1503a1]=this[_0x94f2('0x1c')](_0x437e4c[_0x1503a1],_0x15d085);}}return _0x437e4c;};exports[_0x94f2('0x20')]=function(_0x4c20bb){return _0x4c20bb[_0x94f2('0x21')](RegExp(_0x94f2('0x22')))?!![]:![];};exports[_0x94f2('0x23')]=function(_0x27d244){return _0x27d244[_0x94f2('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x137f73){var _0x4d5271=[];_0x137f73[_0x94f2('0x14')](/[ ,]+/)[_0x94f2('0x24')](function(_0x58d0eb){_0x58d0eb=_0x58d0eb[_0x94f2('0x25')](/([^:]")"+/g,'$1');_0x58d0eb='+'+_0x58d0eb+'*';if(_0x58d0eb[_0x94f2('0x4')]('@'))_0x58d0eb='\x22'+_0x58d0eb+'\x22';_0x4d5271['push'](_0x58d0eb);});return _0x4d5271['join']('\x20');};exports[_0x94f2('0x26')]=function(_0x20230b,_0x108ac7,_0x11f74b){var _0x40f67b={},_0x208e91={};if(_0x108ac7[_0x94f2('0x27')][_0x94f2('0x28')]){_0x108ac7[_0x94f2('0x27')]['id']=_0x108ac7['query'][_0x94f2('0x28')];delete _0x108ac7[_0x94f2('0x27')][_0x94f2('0x28')];}_0x40f67b['model']=_[_0x94f2('0x18')](_0x20230b,_0x94f2('0x11'));_0x40f67b[_0x94f2('0x27')]=_['keys'](_0x108ac7[_0x94f2('0x27')]);_0x40f67b['filters']=_['intersection'](_0x40f67b[_0x94f2('0x29')],_0x40f67b[_0x94f2('0x27')]);_0x208e91[_0x94f2('0x2a')]=_[_0x94f2('0x2b')](_0x40f67b[_0x94f2('0x29')],this['fields'](_0x108ac7[_0x94f2('0x27')][_0x94f2('0x5')]));_0x208e91[_0x94f2('0x2a')]=_0x208e91[_0x94f2('0x2a')][_0x94f2('0x2c')]?_0x208e91[_0x94f2('0x2a')]:_0x40f67b[_0x94f2('0x29')];if(!_0x108ac7['query'][_0x94f2('0x1f')](_0x94f2('0x2d'))){_0x208e91[_0x94f2('0x15')]=this[_0x94f2('0x15')](_0x108ac7[_0x94f2('0x27')][_0x94f2('0x15')]);_0x208e91['offset']=this[_0x94f2('0x16')](_0x108ac7['query'][_0x94f2('0x16')]);}_0x208e91[_0x94f2('0x2e')]=this[_0x94f2('0x17')](_0x108ac7[_0x94f2('0x27')]['sort']);_0x208e91[_0x94f2('0x2f')]=this[_0x94f2('0x6')](_['pick'](_0x108ac7['query'],_0x40f67b[_0x94f2('0x6')]),_0x20230b);if(_0x108ac7[_0x94f2('0x27')][_0x94f2('0x30')]){var _0x26611c=_0x20230b;var _0x450b46=_0x108ac7[_0x94f2('0x27')][_0x94f2('0x30')];if(typeof _0x450b46===_0x94f2('0x31')){_0x26611c=_[_0x94f2('0x30')](_0x20230b,function(_0x23cccf){return _[_0x94f2('0x4')](_0x450b46[_0x94f2('0x32')],_0x23cccf[_0x94f2('0x11')]);});_0x450b46=_0x450b46['value'];}_0x208e91[_0x94f2('0x2f')]=_[_0x94f2('0x33')](_0x208e91[_0x94f2('0x2f')],{'$or':_[_0x94f2('0x18')](_0x26611c,function(_0x13663c){if(_0x13663c[_0x94f2('0x9')]!==_0x94f2('0x34')){if(_0x11f74b){return sequelize[_0x94f2('0x2f')](sequelize['fn'](_0x94f2('0x35'),sequelize[_0x94f2('0x36')](_0x13663c[_0x94f2('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x108ac7['query']['filter']+'%')});}else{var _0x235044={};_0x235044[_0x13663c[_0x94f2('0x11')]]={'$like':'%'+_0x108ac7['query'][_0x94f2('0x30')]+'%'};return _0x235044;}}})});}_0x208e91=_['merge']({},_0x208e91,_0x108ac7[_0x94f2('0x37')]);return _0x208e91;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e7501dd..cf502d1 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1060=['urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','env','production','appPath','join','root','development','test','set','toISOString','split','static','get','views','engine','html','renderFile','view\x20engine','use'];(function(_0x525dfc,_0x30e9ae){var _0x5397e5=function(_0x3cc4ec){while(--_0x3cc4ec){_0x525dfc['push'](_0x525dfc['shift']());}};_0x5397e5(++_0x30e9ae);}(_0x1060,0x17a));var _0x0106=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1060[_0x565c49];return _0x20ca34;};'use strict';var express=require(_0x0106('0x0'));var favicon=require(_0x0106('0x1'));var bodyParser=require(_0x0106('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x0106('0x3'));var errorHandler=require(_0x0106('0x4'));var path=require(_0x0106('0x5'));var passport=require(_0x0106('0x6'));var cors=require(_0x0106('0x7'));var moment=require(_0x0106('0x8'));var config=require(_0x0106('0x9'));var db=require(_0x0106('0xa'))['db'];exports[_0x0106('0xb')]=function(_0xd15e0){var _0x1f2a71=_0xd15e0['get'](_0x0106('0xc'));if(_0x1f2a71===_0x0106('0xd')){_0xd15e0['set'](_0x0106('0xe'),path[_0x0106('0xf')](config[_0x0106('0x10')],'public'));}if(_0x1f2a71===_0x0106('0x11')||_0x1f2a71===_0x0106('0x12')){_0xd15e0[_0x0106('0x13')]('appPath',path[_0x0106('0xf')](config['root'],'client'));_0xd15e0['use'](errorHandler());}_0xd15e0[_0x0106('0x13')]('json\x20replacer',function(_0x1cb851,_0x173efc){if(this[_0x1cb851]instanceof Date){_0x173efc=this[_0x1cb851][_0x0106('0x14')]()[_0x0106('0x15')]('.')[0x0]+'Z';}return _0x173efc;});_0xd15e0['use'](express[_0x0106('0x16')](_0xd15e0[_0x0106('0x17')](_0x0106('0xe'))));_0xd15e0[_0x0106('0x13')](_0x0106('0x18'),config['root']+'/server/views');_0xd15e0[_0x0106('0x19')](_0x0106('0x1a'),require('ejs')[_0x0106('0x1b')]);_0xd15e0[_0x0106('0x13')](_0x0106('0x1c'),_0x0106('0x1a'));_0xd15e0[_0x0106('0x1d')](bodyParser[_0x0106('0x1e')]({'limit':_0x0106('0x1f'),'extended':!![]}));_0xd15e0[_0x0106('0x1d')](bodyParser[_0x0106('0x20')]({'limit':'50mb'}));_0xd15e0[_0x0106('0x1d')](cors());_0xd15e0[_0x0106('0x1d')](methodOverride());_0xd15e0[_0x0106('0x1d')](cookieParser());_0xd15e0[_0x0106('0x1d')](passport[_0x0106('0x21')]());}; \ No newline at end of file +var _0xe4b6=['initialize','express','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','get','env','set','appPath','join','root','public','test','client','use','json\x20replacer','split','static','html','ejs','urlencoded','50mb','json'];(function(_0x591699,_0x34acc7){var _0x19138e=function(_0x236f20){while(--_0x236f20){_0x591699['push'](_0x591699['shift']());}};_0x19138e(++_0x34acc7);}(_0xe4b6,0x197));var _0x6e4b=function(_0x40b7bd,_0x2f8acc){_0x40b7bd=_0x40b7bd-0x0;var _0x30f8a5=_0xe4b6[_0x40b7bd];return _0x30f8a5;};'use strict';var express=require(_0x6e4b('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x6e4b('0x1'));var methodOverride=require(_0x6e4b('0x2'));var cookieParser=require(_0x6e4b('0x3'));var errorHandler=require(_0x6e4b('0x4'));var path=require(_0x6e4b('0x5'));var passport=require(_0x6e4b('0x6'));var cors=require(_0x6e4b('0x7'));var moment=require(_0x6e4b('0x8'));var config=require(_0x6e4b('0x9'));var db=require('../mysqldb')['db'];exports['default']=function(_0x7ba87d){var _0x33be91=_0x7ba87d[_0x6e4b('0xa')](_0x6e4b('0xb'));if(_0x33be91==='production'){_0x7ba87d[_0x6e4b('0xc')](_0x6e4b('0xd'),path[_0x6e4b('0xe')](config[_0x6e4b('0xf')],_0x6e4b('0x10')));}if(_0x33be91==='development'||_0x33be91===_0x6e4b('0x11')){_0x7ba87d[_0x6e4b('0xc')](_0x6e4b('0xd'),path['join'](config['root'],_0x6e4b('0x12')));_0x7ba87d[_0x6e4b('0x13')](errorHandler());}_0x7ba87d[_0x6e4b('0xc')](_0x6e4b('0x14'),function(_0x59cc1a,_0x2cec03){if(this[_0x59cc1a]instanceof Date){_0x2cec03=this[_0x59cc1a]['toISOString']()[_0x6e4b('0x15')]('.')[0x0]+'Z';}return _0x2cec03;});_0x7ba87d[_0x6e4b('0x13')](express[_0x6e4b('0x16')](_0x7ba87d['get'](_0x6e4b('0xd'))));_0x7ba87d[_0x6e4b('0xc')]('views',config[_0x6e4b('0xf')]+'/server/views');_0x7ba87d['engine'](_0x6e4b('0x17'),require(_0x6e4b('0x18'))['renderFile']);_0x7ba87d[_0x6e4b('0xc')]('view\x20engine','html');_0x7ba87d[_0x6e4b('0x13')](bodyParser[_0x6e4b('0x19')]({'limit':_0x6e4b('0x1a'),'extended':!![]}));_0x7ba87d['use'](bodyParser[_0x6e4b('0x1b')]({'limit':_0x6e4b('0x1a')}));_0x7ba87d[_0x6e4b('0x13')](cors());_0x7ba87d[_0x6e4b('0x13')](methodOverride());_0x7ba87d[_0x6e4b('0x13')](cookieParser());_0x7ba87d[_0x6e4b('0x13')](passport[_0x6e4b('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e0bf67a..0612cdd 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 _0x8b0d=['substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','internal','concat','head','mac','address','127.0.0.1','cpus','map','model','join','createHash','update','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','digest','hex'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x8b0d,0x18d));var _0xd8b0=function(_0x285bf4,_0x55a6eb){_0x285bf4=_0x285bf4-0x0;var _0x3c31e2=_0x8b0d[_0x285bf4];return _0x3c31e2;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd8b0('0x0'));var machine=require(_0xd8b0('0x1'));var exec=require(_0xd8b0('0x2'))[_0xd8b0('0x3')];var config=require(_0xd8b0('0x4'));function getInterfaces(){var _0xd1afef=[];var _0x569a40=os[_0xd8b0('0x5')]();var _0x1a5654=_['orderBy'](_[_0xd8b0('0x6')](_0x569a40));for(var _0x5ddc7e=0x0;_0x5ddc7e<_0x1a5654[_0xd8b0('0x7')];_0x5ddc7e++){var _0x14ca74=_0x569a40[_0x1a5654[_0x5ddc7e]][_0xd8b0('0x8')](function(_0x56e7b6){return _0x56e7b6[_0xd8b0('0x9')]==='IPv4'&&_0x56e7b6[_0xd8b0('0xa')]===![];});_0xd1afef=_0xd1afef[_0xd8b0('0xb')](_0x14ca74);}return _0xd1afef;}function getFirstInterface(){var _0x511b54=_[_0xd8b0('0xc')](getInterfaces());return{'macAddress':_0x511b54&&_0x511b54[_0xd8b0('0xd')]?_0x511b54[_0xd8b0('0xd')]:'00:00:00:00:00:00','ipAddress':_0x511b54&&_0x511b54[_0xd8b0('0xe')]?_0x511b54[_0xd8b0('0xe')]:_0xd8b0('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x38aaf3=_['orderBy'](os[_0xd8b0('0x10')]()[_0xd8b0('0x11')](function(_0x608367){return _0x608367[_0xd8b0('0x12')];}))[_0xd8b0('0x13')](':');return crypto[_0xd8b0('0x14')]('md5')[_0xd8b0('0x15')](_0x38aaf3)['digest']('hex');}exports[_0xd8b0('0x16')]=function(){var _0x4885b7=os['platform']();var _0x16e5e5=/[0-9a-f-]{36}/;if(config[_0xd8b0('0x17')]&&_0x16e5e5[_0xd8b0('0x18')](config[_0xd8b0('0x17')])){return config['licenseToken'];}else if(_0x4885b7===_0xd8b0('0x19')){return exec(_0xd8b0('0x1a'),{'encoding':_0xd8b0('0x1b')})[_0xd8b0('0x1c')]('\x0d\x0a','');}else{var _0x39745e=getFirstInterface();var _0x4784de=getCPUhash();var _0x1ce461=_0x4784de+'|'+os[_0xd8b0('0x1d')]()+'|'+_0x39745e[_0xd8b0('0x1e')]+'|'+_0x39745e[_0xd8b0('0x1f')];var _0x44ed3e=crypto[_0xd8b0('0x14')](_0xd8b0('0x20'))[_0xd8b0('0x15')](_0x1ce461)[_0xd8b0('0x21')](_0xd8b0('0x22'));return _0x44ed3e[_0xd8b0('0x23')](0x0,0x8)+'-'+_0x44ed3e[_0xd8b0('0x23')](0x8,0xc)+'-'+_0x44ed3e[_0xd8b0('0x23')](0xc,0x10)+'-'+_0x44ed3e['substring'](0x10,0x14)+'-'+_0x44ed3e['substring'](0x14);}}; \ No newline at end of file +var _0x5d30=['orderBy','keys','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','join','createHash','md5','digest','hex','getUuid','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','substring','lodash','crypto','networkInterfaces'];(function(_0x2b9d54,_0x4ad9ee){var _0x3edc0e=function(_0x372425){while(--_0x372425){_0x2b9d54['push'](_0x2b9d54['shift']());}};_0x3edc0e(++_0x4ad9ee);}(_0x5d30,0x8e));var _0x05d3=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x5d30[_0x389832];return _0x59429e;};'use strict';var _=require(_0x05d3('0x0'));var os=require('os');var crypto=require(_0x05d3('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require('../environment');function getInterfaces(){var _0x4d9e9d=[];var _0x1d91c3=os[_0x05d3('0x2')]();var _0x563cb5=_[_0x05d3('0x3')](_[_0x05d3('0x4')](_0x1d91c3));for(var _0x147d04=0x0;_0x147d04<_0x563cb5['length'];_0x147d04++){var _0x3fa6c7=_0x1d91c3[_0x563cb5[_0x147d04]][_0x05d3('0x5')](function(_0x27c089){return _0x27c089['family']===_0x05d3('0x6')&&_0x27c089[_0x05d3('0x7')]===![];});_0x4d9e9d=_0x4d9e9d[_0x05d3('0x8')](_0x3fa6c7);}return _0x4d9e9d;}function getFirstInterface(){var _0x3c10bd=_[_0x05d3('0x9')](getInterfaces());return{'macAddress':_0x3c10bd&&_0x3c10bd['mac']?_0x3c10bd[_0x05d3('0xa')]:'00:00:00:00:00:00','ipAddress':_0x3c10bd&&_0x3c10bd[_0x05d3('0xb')]?_0x3c10bd[_0x05d3('0xb')]:'127.0.0.1'};}exports[_0x05d3('0xc')]=getFirstInterface;function getCPUhash(){var _0x165c51=_[_0x05d3('0x3')](os[_0x05d3('0xd')]()[_0x05d3('0xe')](function(_0x24c70a){return _0x24c70a['model'];}))[_0x05d3('0xf')](':');return crypto[_0x05d3('0x10')](_0x05d3('0x11'))['update'](_0x165c51)[_0x05d3('0x12')](_0x05d3('0x13'));}exports[_0x05d3('0x14')]=function(){var _0x5fecb7=os['platform']();var _0x4b22d8=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4b22d8[_0x05d3('0x15')](config[_0x05d3('0x16')])){return config[_0x05d3('0x16')];}else if(_0x5fecb7===_0x05d3('0x17')){return exec(_0x05d3('0x18'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x49ad2b=getFirstInterface();var _0x8fb7e5=getCPUhash();var _0x34d6e7=_0x8fb7e5+'|'+os[_0x05d3('0x19')]()+'|'+_0x49ad2b[_0x05d3('0x1a')]+'|'+_0x49ad2b[_0x05d3('0x1b')];var _0x118ec8=crypto[_0x05d3('0x10')]('md5')['update'](_0x34d6e7)[_0x05d3('0x12')](_0x05d3('0x13'));return _0x118ec8[_0x05d3('0x1c')](0x0,0x8)+'-'+_0x118ec8[_0x05d3('0x1c')](0x8,0xc)+'-'+_0x118ec8[_0x05d3('0x1c')](0xc,0x10)+'-'+_0x118ec8['substring'](0x10,0x14)+'-'+_0x118ec8[_0x05d3('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a0a0fa6..512ed2c 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 _0xc2f7=['spread','util','bluebird','version','../../mysqldb','../../components/encryptor','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','info','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','error','message','finally','findOrCreate'];(function(_0x1641b2,_0x452a29){var _0x4a195c=function(_0x12f8f3){while(--_0x12f8f3){_0x1641b2['push'](_0x1641b2['shift']());}};_0x4a195c(++_0x452a29);}(_0xc2f7,0x1c8));var _0x7c2f=function(_0x5eae18,_0x2ff238){_0x5eae18=_0x5eae18-0x0;var _0x3f018e=_0xc2f7[_0x5eae18];return _0x3f018e;};'use strict';var util=require(_0x7c2f('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x7c2f('0x1'));var pkginfo=require('pkginfo')(module,_0x7c2f('0x2'));var db=require(_0x7c2f('0x3'))['db'];var encryptor=require(_0x7c2f('0x4'));var hardware=require('./hardware');var logger=require('../logger')(_0x7c2f('0x5'));var HOST=_0x7c2f('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4c07af){return new BPromise(function(_0x344383,_0x4b5d62){var _0x74c355=util[_0x7c2f('0x7')](_0x7c2f('0x8'),HOST,_0x4c07af,module['exports']['version']);if(oldToken){_0x74c355=util[_0x7c2f('0x7')](_0x7c2f('0x9'),HOST,_0x4c07af,module[_0x7c2f('0xa')][_0x7c2f('0x2')],oldToken);}var _0x4576b9={'uri':_0x74c355,'method':_0x7c2f('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4576b9)[_0x7c2f('0xc')](function(_0x4a5cc6){_0x344383(_0x4a5cc6);})[_0x7c2f('0xd')](function(_0x3f044a){_0x4b5d62(_0x3f044a);});});}function manageLicense(_0x1280fe,_0x61effe){var _0x4e9156=_0x61effe['get']({'plain':!![]});if(!isOldTokenSent&&_0x4e9156[_0x7c2f('0xe')]!==_0x1280fe&&!_0x4e9156[_0x7c2f('0xf')]){oldToken=_0x4e9156[_0x7c2f('0xe')];}httpRequest(_0x1280fe)['then'](function(_0x48e6d4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x48e6d4[_0x7c2f('0x10')]){isOldTokenSent=![];if(!_0x4e9156[_0x7c2f('0x5')]&&_0x4e9156[_0x7c2f('0x5')]!=_0x48e6d4[_0x7c2f('0x5')]||_0x4e9156[_0x7c2f('0x5')]&&_0x4e9156['data2']){logger['info'](_0x7c2f('0x11'));}if(_0x4e9156[_0x7c2f('0x5')]&&!_0x4e9156[_0x7c2f('0xf')]&&_0x4e9156[_0x7c2f('0x5')]!=_0x48e6d4['license']){logger['info'](_0x7c2f('0x12'));}if(_0x4e9156[_0x7c2f('0x5')]&&!_0x4e9156[_0x7c2f('0xf')]&&_0x4e9156[_0x7c2f('0x5')]==_0x48e6d4[_0x7c2f('0x5')]){return _0x61effe;}return _0x61effe[_0x7c2f('0x13')]({'data1':_0x1280fe,'data2':null,'license':_0x48e6d4[_0x7c2f('0x5')]});}else{if(_0x48e6d4[_0x7c2f('0x5')]||_0x4e9156['license']){if(!_0x4e9156['data2']){if(_0x4e9156[_0x7c2f('0xe')]==_0x1280fe){GRAY_PERIOD_REASON=_0x7c2f('0x14');logger['info'](_0x7c2f('0x15'));}else{GRAY_PERIOD_REASON=_0x7c2f('0x16');logger[_0x7c2f('0x17')](_0x7c2f('0x18'),_0x4e9156['data1'],_0x1280fe);}logger[_0x7c2f('0x17')](_0x7c2f('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x7c2f('0x7')](_0x7c2f('0x1a')));return _0x61effe[_0x7c2f('0x13')]({'data2':encryptor[_0x7c2f('0x1b')](moment()[_0x7c2f('0x7')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x7c2f('0x1c')](encryptor['decryptString'](_0x4e9156['data2']),_0x7c2f('0x1d'))>DAYS){logger[_0x7c2f('0x17')]('DEMO\x20START\x20AT\x20%s',moment()[_0x7c2f('0x7')](_0x7c2f('0x1a')));isOldTokenSent=![];return _0x61effe['update']({'data1':_0x1280fe,'data2':null,'license':null});}}}else{if(_0x4e9156[_0x7c2f('0xe')]!=_0x1280fe){logger['info'](_0x7c2f('0x18'),_0x4e9156[_0x7c2f('0xe')],_0x1280fe);return _0x61effe[_0x7c2f('0x13')]({'data1':_0x1280fe,'data2':null,'license':null});}}}return _0x61effe;})[_0x7c2f('0xc')](function(_0x2bc137){_0x61effe=_0x2bc137;})[_0x7c2f('0xd')](function(_0x43eb03){logger[_0x7c2f('0x1e')](_0x43eb03[_0x7c2f('0x1f')]);})[_0x7c2f('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x61effe);},TIME);});}function defaultLicense(){var _0x414c5c=hardware['getUuid']();if(_0x414c5c){return db['License'][_0x7c2f('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x414c5c}})[_0x7c2f('0x22')](function(_0x519210,_0x159e9f){logger[_0x7c2f('0x17')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x414c5c);manageLicense(_0x414c5c,_0x519210);})['catch'](function(_0x6a713a){logger[_0x7c2f('0x1e')](_0x6a713a[_0x7c2f('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xcce9=['license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','data1','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get'];(function(_0x57c248,_0x32de39){var _0x21ce47=function(_0x51d3bd){while(--_0x51d3bd){_0x57c248['push'](_0x57c248['shift']());}};_0x21ce47(++_0x32de39);}(_0xcce9,0x94));var _0x9cce=function(_0x3a2a94,_0x2c8adb){_0x3a2a94=_0x3a2a94-0x0;var _0x2670e8=_0xcce9[_0x3a2a94];return _0x2670e8;};'use strict';var util=require(_0x9cce('0x0'));var moment=require('moment');var rp=require(_0x9cce('0x1'));var BPromise=require(_0x9cce('0x2'));var pkginfo=require(_0x9cce('0x3'))(module,_0x9cce('0x4'));var db=require(_0x9cce('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x9cce('0x6'))('license');var HOST=_0x9cce('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x518418){return new BPromise(function(_0xd68944,_0x406a3c){var _0x5864ea=util['format'](_0x9cce('0x8'),HOST,_0x518418,module[_0x9cce('0x9')]['version']);if(oldToken){_0x5864ea=util[_0x9cce('0xa')](_0x9cce('0xb'),HOST,_0x518418,module[_0x9cce('0x9')][_0x9cce('0x4')],oldToken);}var _0x204e72={'uri':_0x5864ea,'method':_0x9cce('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x204e72)[_0x9cce('0xd')](function(_0x10faf9){_0xd68944(_0x10faf9);})[_0x9cce('0xe')](function(_0x3a38b7){_0x406a3c(_0x3a38b7);});});}function manageLicense(_0x3d630d,_0x29369e){var _0x502a09=_0x29369e[_0x9cce('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x502a09['data1']!==_0x3d630d&&!_0x502a09['data2']){oldToken=_0x502a09['data1'];}httpRequest(_0x3d630d)[_0x9cce('0xd')](function(_0x37621d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x37621d['active']){isOldTokenSent=![];if(!_0x502a09[_0x9cce('0x10')]&&_0x502a09['license']!=_0x37621d[_0x9cce('0x10')]||_0x502a09[_0x9cce('0x10')]&&_0x502a09[_0x9cce('0x11')]){logger['info'](_0x9cce('0x12'));}if(_0x502a09[_0x9cce('0x10')]&&!_0x502a09[_0x9cce('0x11')]&&_0x502a09[_0x9cce('0x10')]!=_0x37621d[_0x9cce('0x10')]){logger[_0x9cce('0x13')](_0x9cce('0x14'));}if(_0x502a09[_0x9cce('0x10')]&&!_0x502a09['data2']&&_0x502a09[_0x9cce('0x10')]==_0x37621d['license']){return _0x29369e;}return _0x29369e[_0x9cce('0x15')]({'data1':_0x3d630d,'data2':null,'license':_0x37621d[_0x9cce('0x10')]});}else{if(_0x37621d['license']||_0x502a09[_0x9cce('0x10')]){if(!_0x502a09[_0x9cce('0x11')]){if(_0x502a09['data1']==_0x3d630d){GRAY_PERIOD_REASON=_0x9cce('0x16');logger[_0x9cce('0x13')](_0x9cce('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x9cce('0x13')](_0x9cce('0x18'),_0x502a09['data1'],_0x3d630d);}logger[_0x9cce('0x13')](_0x9cce('0x19'),GRAY_PERIOD_REASON[_0x9cce('0x1a')](),moment()[_0x9cce('0xa')](_0x9cce('0x1b')));return _0x29369e['update']({'data2':encryptor[_0x9cce('0x1c')](moment()['format'](_0x9cce('0x1b')))});}else{if(moment()[_0x9cce('0x1d')](encryptor[_0x9cce('0x1e')](_0x502a09[_0x9cce('0x11')]),_0x9cce('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x9cce('0xa')](_0x9cce('0x1b')));isOldTokenSent=![];return _0x29369e['update']({'data1':_0x3d630d,'data2':null,'license':null});}}}else{if(_0x502a09['data1']!=_0x3d630d){logger[_0x9cce('0x13')](_0x9cce('0x18'),_0x502a09[_0x9cce('0x20')],_0x3d630d);return _0x29369e['update']({'data1':_0x3d630d,'data2':null,'license':null});}}}return _0x29369e;})[_0x9cce('0xd')](function(_0xdf5e63){_0x29369e=_0xdf5e63;})['catch'](function(_0x558eca){logger[_0x9cce('0x21')](_0x558eca[_0x9cce('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x9cce('0x23')](),_0x29369e);},TIME);});}function defaultLicense(){var _0x177515=hardware[_0x9cce('0x23')]();if(_0x177515){return db[_0x9cce('0x24')][_0x9cce('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x177515}})[_0x9cce('0x26')](function(_0x1af08a,_0x4c9466){logger[_0x9cce('0x13')](_0x9cce('0x27'),_0x177515);manageLicense(_0x177515,_0x1af08a);})['catch'](function(_0x2fdde7){logger[_0x9cce('0x21')](_0x2fdde7['message']);});}}exports[_0x9cce('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7cf1722..faae257 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 _0xdb71=['demo','machineUuid','decryptString','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','format','%s:%s:%s'];(function(_0x469a83,_0x3d5293){var _0x38c177=function(_0xa32d45){while(--_0xa32d45){_0x469a83['push'](_0x469a83['shift']());}};_0x38c177(++_0x3d5293);}(_0xdb71,0x15b));var _0x1db7=function(_0x38e59d,_0x4a4995){_0x38e59d=_0x38e59d-0x0;var _0x1c8642=_0xdb71[_0x38e59d];return _0x1c8642;};'use strict';var util=require(_0x1db7('0x0'));var _=require(_0x1db7('0x1'));var moment=require('moment');var BPromise=require(_0x1db7('0x2'));var hardware=require(_0x1db7('0x3'));var encryptor=require(_0x1db7('0x4'));var db=require(_0x1db7('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1db7('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1db7('0x7'),'machineUuid':hardware[_0x1db7('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1db7('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1db7('0x9'),'machineUuid':hardware[_0x1db7('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x79b96b){return new BPromise(function(_0x3eac6c,_0x33e70a){return db['License'][_0x1db7('0xa')](_['defaults'](_0x79b96b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x57502b){return checkLicense(_0x57502b,null);})[_0x1db7('0xb')](function(_0x45db31){_0x3eac6c(_0x45db31);return;})[_0x1db7('0xc')](function(_0x41a388){_0x33e70a(_0x41a388);});});}function checkLicense(_0x394621,_0x235aba){if(!_0x394621){demoLicense[_0x1db7('0xd')]=_0x394621['data1'];return demoLicense;}try{var _0x41f8c8=_0x235aba||_0x394621[_0x1db7('0xe')];if(_[_0x1db7('0xf')](_0x41f8c8)){throw new Error(_0x1db7('0x10'));}var _0x1ec4a7=_0x394621[_0x1db7('0x11')];var _0x47a36a=_0x394621['data2'];var _0xe44eb3=_0x1ec4a7['split']('-')[0x4];var _0x1a0e32=_0x1ec4a7[_0x1db7('0x12')]('-')[0x0];var _0xb1aca3=encryptor['decryptString'](_0x41f8c8,util[_0x1db7('0x13')](_0x1db7('0x14'),_0xe44eb3,_0x1ec4a7,_0x1a0e32));var _0x2a2af2=JSON['parse'](_0xb1aca3);_0x2a2af2[_0x1db7('0x15')]=![];_0x2a2af2[_0x1db7('0xd')]=_0x1ec4a7;_0x2a2af2[_0x1db7('0x16')]=hardware[_0x1db7('0x8')]();if(_0x47a36a){var _0x53e900=encryptor[_0x1db7('0x17')](_0x47a36a);_0x2a2af2[_0x1db7('0x18')]=_0x53e900;_0x2a2af2[_0x1db7('0x19')]=moment(_0x53e900)[_0x1db7('0x1a')](0x7,_0x1db7('0x1b'))[_0x1db7('0x13')]();_0x2a2af2[_0x1db7('0x1c')]=_0x2a2af2[_0x1db7('0xd')]!=_0x2a2af2[_0x1db7('0x16')]?_0x1db7('0x1d'):_0x1db7('0x1e');}return _0x2a2af2;}catch(_0x387dfa){breakingLicense[_0x1db7('0xd')]=_0x394621['data1'];breakingLicense[_0x1db7('0x1f')]=_0x387dfa[_0x1db7('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5e6dd2,_0x5603b3){getLicense()[_0x1db7('0xb')](function(_0x1edc21){return db[_0x1db7('0x20')][_0x1db7('0x21')]({'attributes':[_0x1db7('0x22'),[db[_0x1db7('0x23')]['fn'](_0x1db7('0x24'),db['sequelize']['col'](_0x1db7('0x22'))),_0x1db7('0x25')]],'group':'role','where':{'role':{'$or':[_0x1db7('0x26'),_0x1db7('0x27'),_0x1db7('0x28')]}},'raw':!![]})[_0x1db7('0xb')](function(_0x1db962){var _0x17a910={'user':_0x1edc21[_0x1db7('0x29')]||0x0,'telephone':_0x1edc21[_0x1db7('0x2a')]||0x0};_0x1db962['forEach'](function(_0x2ed514){var _0x337c4b=_0x2ed514['role']===_0x1db7('0x26')?_0x1db7('0x27'):_0x2ed514[_0x1db7('0x22')];_0x17a910[_0x337c4b]-=_0x2ed514['count'];if(_0x17a910[_0x337c4b]<0x0)_0x17a910[_0x337c4b]=0x0;});_0x5e6dd2(_0x17a910);return;});})[_0x1db7('0xc')](function(_0x19ec05){_0x5603b3(_0x19ec05);});});}function checkUserLimits(_0x8e43a6){return new BPromise(function(_0x379bcc,_0x2f612f){getLimits()[_0x1db7('0xb')](function(_0x375a5e){var _0x2c5102=_['pick'](_[_0x1db7('0x2b')](_0x8e43a6,_0x1db7('0x22')),[_0x1db7('0x26'),_0x1db7('0x27'),_0x1db7('0x28')]);var _0x2d0f9b=(_0x2c5102['admin']||0x0)+(_0x2c5102[_0x1db7('0x27')]||0x0);var _0x55c57f=_0x2c5102[_0x1db7('0x28')]||0x0;if(_0x2d0f9b>_0x375a5e['user'])return _0x2f612f('License\x20limit\x20reached\x20for\x20users');if(_0x55c57f>_0x375a5e[_0x1db7('0x28')])return _0x2f612f(_0x1db7('0x2c'));return _0x379bcc();})[_0x1db7('0xc')](function(_0x355b8b){_0x2f612f(_0x355b8b);});});}module[_0x1db7('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2426=['util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','find','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','uuid','machineUuid','getUuid','gray','deadline','add','days','format','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','count','admin','users','telephones','forEach','countBy','role','user','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones'];(function(_0x433866,_0x27c34d){var _0x32f251=function(_0x253197){while(--_0x253197){_0x433866['push'](_0x433866['shift']());}};_0x32f251(++_0x27c34d);}(_0x2426,0xb8));var _0x6242=function(_0x5bf1a7,_0x396d20){_0x5bf1a7=_0x5bf1a7-0x0;var _0x5053a7=_0x2426[_0x5bf1a7];return _0x5053a7;};'use strict';var util=require(_0x6242('0x0'));var _=require('lodash');var moment=require(_0x6242('0x1'));var BPromise=require(_0x6242('0x2'));var hardware=require(_0x6242('0x3'));var encryptor=require(_0x6242('0x4'));var db=require(_0x6242('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6242('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6242('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x569402){return new BPromise(function(_0x584af4,_0x3a3244){return db['License'][_0x6242('0x8')](_['defaults'](_0x569402,{'raw':!![],'where':{'id':0x1}}))[_0x6242('0x9')](function(_0x44186f){return checkLicense(_0x44186f,null);})[_0x6242('0x9')](function(_0x4af501){_0x584af4(_0x4af501);return;})[_0x6242('0xa')](function(_0x5b9fc6){_0x3a3244(_0x5b9fc6);});});}function checkLicense(_0x2c69a0,_0x1a8810){if(!_0x2c69a0){demoLicense['uuid']=_0x2c69a0[_0x6242('0xb')];return demoLicense;}try{var _0x55ce77=_0x1a8810||_0x2c69a0[_0x6242('0xc')];if(_['isEmpty'](_0x55ce77)){throw new Error(_0x6242('0xd'));}var _0x2446f2=_0x2c69a0['data1'];var _0x539ce0=_0x2c69a0[_0x6242('0xe')];var _0x130d48=_0x2446f2['split']('-')[0x4];var _0x1f2250=_0x2446f2[_0x6242('0xf')]('-')[0x0];var _0x667f5=encryptor[_0x6242('0x10')](_0x55ce77,util['format'](_0x6242('0x11'),_0x130d48,_0x2446f2,_0x1f2250));var _0x179d89=JSON['parse'](_0x667f5);_0x179d89['demo']=![];_0x179d89[_0x6242('0x12')]=_0x2446f2;_0x179d89[_0x6242('0x13')]=hardware[_0x6242('0x14')]();if(_0x539ce0){var _0x452979=encryptor[_0x6242('0x10')](_0x539ce0);_0x179d89[_0x6242('0x15')]=_0x452979;_0x179d89[_0x6242('0x16')]=moment(_0x452979)[_0x6242('0x17')](0x7,_0x6242('0x18'))[_0x6242('0x19')]();_0x179d89[_0x6242('0x1a')]=_0x179d89[_0x6242('0x12')]!=_0x179d89[_0x6242('0x13')]?_0x6242('0x1b'):_0x6242('0x1c');}return _0x179d89;}catch(_0x158da5){breakingLicense['uuid']=_0x2c69a0['data1'];breakingLicense[_0x6242('0x1d')]=_0x158da5[_0x6242('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x291824,_0x205b56){getLicense()['then'](function(_0x3062ba){return db[_0x6242('0x1e')][_0x6242('0x1f')]({'attributes':['role',[db[_0x6242('0x20')]['fn'](_0x6242('0x21'),db[_0x6242('0x20')][_0x6242('0x22')]('role')),_0x6242('0x23')]],'group':'role','where':{'role':{'$or':[_0x6242('0x24'),'user','telephone']}},'raw':!![]})['then'](function(_0x49d940){var _0x3ab5a6={'user':_0x3062ba[_0x6242('0x25')]||0x0,'telephone':_0x3062ba[_0x6242('0x26')]||0x0};_0x49d940[_0x6242('0x27')](function(_0x309cb5){var _0x36af9f=_0x309cb5['role']===_0x6242('0x24')?'user':_0x309cb5['role'];_0x3ab5a6[_0x36af9f]-=_0x309cb5[_0x6242('0x23')];if(_0x3ab5a6[_0x36af9f]<0x0)_0x3ab5a6[_0x36af9f]=0x0;});_0x291824(_0x3ab5a6);return;});})['catch'](function(_0x29aa63){_0x205b56(_0x29aa63);});});}function checkUserLimits(_0xf39ced){return new BPromise(function(_0x2e47ef,_0x2eda90){getLimits()[_0x6242('0x9')](function(_0x38b664){var _0x5a4cc9=_['pick'](_[_0x6242('0x28')](_0xf39ced,_0x6242('0x29')),[_0x6242('0x24'),_0x6242('0x2a'),_0x6242('0x2b')]);var _0x4fb839=(_0x5a4cc9[_0x6242('0x24')]||0x0)+(_0x5a4cc9[_0x6242('0x2a')]||0x0);var _0x3d3f18=_0x5a4cc9[_0x6242('0x2b')]||0x0;if(_0x4fb839>_0x38b664[_0x6242('0x2a')])return _0x2eda90(_0x6242('0x2c'));if(_0x3d3f18>_0x38b664[_0x6242('0x2b')])return _0x2eda90(_0x6242('0x2d'));return _0x2e47ef();})['catch'](function(_0x49f2d9){_0x2eda90(_0x49f2d9);});});}module['exports']={'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 b5917a1..dff7e1e 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 _0x583c=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x21936f,_0x469b58){var _0x53b048=function(_0x2458e0){while(--_0x2458e0){_0x21936f['push'](_0x21936f['shift']());}};_0x53b048(++_0x469b58);}(_0x583c,0x12b));var _0xc583=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x583c[_0x11a220];return _0x20d8fe;};'use strict';module[_0xc583('0x0')]={'DOMAIN':_0xc583('0x1'),'SESSION_SECRET':_0xc583('0x2'),'GOOGLE_ID':_0xc583('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x8952=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8952,0x17e));var _0x2895=function(_0x35148a,_0x20c006){_0x35148a=_0x35148a-0x0;var _0x3b2374=_0x8952[_0x35148a];return _0x3b2374;};'use strict';module['exports']={'DOMAIN':_0x2895('0x0'),'SESSION_SECRET':_0x2895('0x1'),'GOOGLE_ID':_0x2895('0x2'),'GOOGLE_SECRET':_0x2895('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 92d178e..855d8d2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc375=['Logger','File','%s-%s','error','transports','info','env','moment','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level'];(function(_0x599798,_0x2cbe80){var _0x592116=function(_0x572d13){while(--_0x572d13){_0x599798['push'](_0x599798['shift']());}};_0x592116(++_0x2cbe80);}(_0xc375,0x16f));var _0x5c37=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0xc375[_0x5e2751];return _0x139a39;};'use strict';var moment=require(_0x5c37('0x0'));var winston=require('winston');var util=require(_0x5c37('0x1'));var path=require(_0x5c37('0x2'));var debugLevel=_0x5c37('0x3');function filename(_0x2a1e35,_0x26c5b6){return path[_0x5c37('0x4')](_0x5c37('0x5'),_0x5c37('0x6'),_0x5c37('0x7'),util[_0x5c37('0x8')](_0x5c37('0x9'),_0x2a1e35,_0x26c5b6));}function formatter(_0x2419cd,_0x19ed6c){_0x19ed6c[_0x5c37('0xa')]=_0x19ed6c[_0x5c37('0xa')][_0x5c37('0xb')](/@@{/g,_0x5c37('0xc'))['replace'](/}@@/g,_0x5c37('0xd'))[_0x5c37('0xb')](/@{/g,'{{')[_0x5c37('0xb')](/}@/g,'}}');return util[_0x5c37('0x8')](_0x5c37('0xe'),moment()[_0x5c37('0x8')](_0x5c37('0xf')),_0x19ed6c[_0x5c37('0x10')]['toUpperCase'](),_0x2419cd,_0x19ed6c[_0x5c37('0xa')]);}module['exports']=function(_0x306593){return new winston[(_0x5c37('0x11'))]({'transports':[new winston['transports'][(_0x5c37('0x12'))]({'name':util['format'](_0x5c37('0x13'),_0x306593,_0x5c37('0x14')),'filename':filename(_0x306593,_0x5c37('0x14')),'level':_0x5c37('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x371a5d){return formatter(_0x306593,_0x371a5d);}}),new winston[(_0x5c37('0x15'))][(_0x5c37('0x12'))]({'name':util[_0x5c37('0x8')](_0x5c37('0x13'),_0x306593,_0x5c37('0x16')),'filename':filename(_0x306593,_0x5c37('0x16')),'level':_0x5c37('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xaf5734){return formatter(_0x306593,_0xaf5734);}}),new winston[(_0x5c37('0x15'))]['Console']({'level':process[_0x5c37('0x17')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x57010b){return formatter(_0x306593,_0x57010b);}})]});}; \ No newline at end of file +var _0xa338=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','exports','Logger','File','%s-%s','error','transports','info','Console','debugLevel','moment','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','{{{','replace'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xa338,0x11f));var _0x8a33=function(_0x4695fd,_0x4ffb4d){_0x4695fd=_0x4695fd-0x0;var _0x205f50=_0xa338[_0x4695fd];return _0x205f50;};'use strict';var moment=require(_0x8a33('0x0'));var winston=require('winston');var util=require(_0x8a33('0x1'));var path=require(_0x8a33('0x2'));var debugLevel=_0x8a33('0x3');function filename(_0x1efad2,_0x7de5cb){return path[_0x8a33('0x4')](_0x8a33('0x5'),_0x8a33('0x6'),_0x8a33('0x7'),util[_0x8a33('0x8')](_0x8a33('0x9'),_0x1efad2,_0x7de5cb));}function formatter(_0x46c21b,_0x27b013){_0x27b013[_0x8a33('0xa')]=_0x27b013[_0x8a33('0xa')]['replace'](/@@{/g,_0x8a33('0xb'))[_0x8a33('0xc')](/}@@/g,_0x8a33('0xd'))[_0x8a33('0xc')](/@{/g,'{{')[_0x8a33('0xc')](/}@/g,'}}');return util[_0x8a33('0x8')](_0x8a33('0xe'),moment()[_0x8a33('0x8')](_0x8a33('0xf')),_0x27b013['level']['toUpperCase'](),_0x46c21b,_0x27b013[_0x8a33('0xa')]);}module[_0x8a33('0x10')]=function(_0x39a239){return new winston[(_0x8a33('0x11'))]({'transports':[new winston['transports'][(_0x8a33('0x12'))]({'name':util[_0x8a33('0x8')](_0x8a33('0x13'),_0x39a239,_0x8a33('0x14')),'filename':filename(_0x39a239,_0x8a33('0x14')),'level':_0x8a33('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4dc81a){return formatter(_0x39a239,_0x4dc81a);}}),new winston[(_0x8a33('0x15'))][(_0x8a33('0x12'))]({'name':util[_0x8a33('0x8')](_0x8a33('0x13'),_0x39a239,_0x8a33('0x16')),'filename':filename(_0x39a239,'info'),'level':_0x8a33('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cb816){return formatter(_0x39a239,_0x3cb816);}}),new winston[(_0x8a33('0x15'))][(_0x8a33('0x17'))]({'level':process['env'][_0x8a33('0x18')]||debugLevel,'json':![],'formatter':function(_0x4f0779){return formatter(_0x39a239,_0x4f0779);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d394ac4..6778ba8 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 _0x17dd=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing'];(function(_0x559d8c,_0x17faa7){var _0x4717d4=function(_0x2411fe){while(--_0x2411fe){_0x559d8c['push'](_0x559d8c['shift']());}};_0x4717d4(++_0x17faa7);}(_0x17dd,0x13c));var _0xd17d=function(_0x4845bb,_0x37ca30){_0x4845bb=_0x4845bb-0x0;var _0x4fb138=_0x17dd[_0x4845bb];return _0x4fb138;};'use strict';var path=require(_0xd17d('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xd17d('0x1')](__dirname,_0xd17d('0x2'))},{'name':_0xd17d('0x3'),'script':path[_0xd17d('0x1')](__dirname,_0xd17d('0x4'))},{'name':_0xd17d('0x5'),'script':path[_0xd17d('0x1')](__dirname,_0xd17d('0x6'))},{'name':_0xd17d('0x7'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0xd17d('0x8'),'script':path[_0xd17d('0x1')](__dirname,_0xd17d('0x9'))},{'name':_0xd17d('0xa'),'script':path[_0xd17d('0x1')](__dirname,_0xd17d('0xb'))}]};module[_0xd17d('0xc')]=config; \ No newline at end of file +var _0xa9cc=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','join','../../services/express/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xa9cc,0x1a8));var _0xca9c=function(_0x1c852c,_0x1f4588){_0x1c852c=_0x1c852c-0x0;var _0x5ae3a6=_0xa9cc[_0x1c852c];return _0x5ae3a6;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xca9c('0x0'),'script':path[_0xca9c('0x1')](__dirname,_0xca9c('0x2'))},{'name':'ami','script':path[_0xca9c('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0xca9c('0x3'),'script':path[_0xca9c('0x1')](__dirname,_0xca9c('0x4'))},{'name':'email','script':path['join'](__dirname,_0xca9c('0x5'))},{'name':'routing','script':path['join'](__dirname,_0xca9c('0x6'))},{'name':_0xca9c('0x7'),'script':path[_0xca9c('0x1')](__dirname,_0xca9c('0x8'))}]};module[_0xca9c('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 33c243f..2c3130a 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 _0x6eb3=['stop','restart','list','describe','delete','dump','bluebird','./config','connect','connected','then','start','disconnect'];(function(_0x273c16,_0x2845d9){var _0x55b6fd=function(_0x22422a){while(--_0x22422a){_0x273c16['push'](_0x273c16['shift']());}};_0x55b6fd(++_0x2845d9);}(_0x6eb3,0x1cd));var _0x36eb=function(_0x3a3509,_0x3fe819){_0x3a3509=_0x3a3509-0x0;var _0x359118=_0x6eb3[_0x3a3509];return _0x359118;};'use strict';var pm2=require('pm2');var BPromise=require(_0x36eb('0x0'));var config=require(_0x36eb('0x1'));function connect(){return new BPromise(function(_0x4e643b,_0x516a1e){return pm2[_0x36eb('0x2')](function(_0x11fd1f){if(_0x11fd1f){return _0x516a1e(_0x11fd1f);}return _0x4e643b(_0x36eb('0x3'));});});};exports['start']=function(_0x4cc5a7){return connect()[_0x36eb('0x4')](function(){return new BPromise(function(_0x44b6e0,_0xcdde49){return pm2[_0x36eb('0x5')](_0x4cc5a7,function(_0x212098,_0xc34083){if(_0x212098){return _0xcdde49(_0x212098);}pm2[_0x36eb('0x6')]();return _0x44b6e0(_0xc34083);});});});};exports[_0x36eb('0x7')]=function(_0x20b9fe){return connect()[_0x36eb('0x4')](function(){return new BPromise(function(_0x46bf9f,_0x1428ad){return pm2['stop'](_0x20b9fe,function(_0x19dade,_0x40ae66){if(_0x19dade){return _0x1428ad(_0x19dade);}pm2[_0x36eb('0x6')]();return _0x46bf9f(_0x40ae66);});});});};exports[_0x36eb('0x8')]=function(_0x37a264){return connect()[_0x36eb('0x4')](function(){return new BPromise(function(_0x2a4466,_0x55ee26){return pm2['restart'](_0x37a264,function(_0xe8c849,_0x4145c7){if(_0xe8c849){return _0x55ee26(_0xe8c849);}pm2[_0x36eb('0x6')]();return _0x2a4466(_0x4145c7);});});});};exports[_0x36eb('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5e20b6,_0x41cb12){return pm2[_0x36eb('0x9')](function(_0x5b9eee,_0x289b3c){if(_0x5b9eee){return _0x41cb12(_0x5b9eee);}pm2[_0x36eb('0x6')]();return _0x5e20b6(_0x289b3c);});});});};exports['describe']=function(_0x3d723a){return connect()[_0x36eb('0x4')](function(){return new BPromise(function(_0xd6498c,_0x172080){return pm2[_0x36eb('0xa')](_0x3d723a,function(_0x45b536,_0x18ef39){if(_0x45b536){return _0x172080(_0x45b536);}pm2[_0x36eb('0x6')]();return _0xd6498c(_0x18ef39);});});});};exports[_0x36eb('0xb')]=function(_0x21f39f){return connect()[_0x36eb('0x4')](function(){return new BPromise(function(_0x4368ca,_0x1fc626){return pm2[_0x36eb('0xb')](_0x21f39f,function(_0x56060f,_0x1e4664){if(_0x56060f){return _0x1fc626(_0x56060f);}pm2[_0x36eb('0x6')]();return _0x4368ca(_0x1e4664);});});});};exports[_0x36eb('0xc')]=function(){return connect()[_0x36eb('0x4')](function(){return new BPromise(function(_0x17dbe2,_0x4a19aa){return pm2[_0x36eb('0xc')](function(_0x383ab8){if(_0x383ab8){return _0x4a19aa(_0x383ab8);}return _0x17dbe2('saved');});});});}; \ No newline at end of file +var _0x965c=['./config','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','bluebird'];(function(_0x515e78,_0x3ed481){var _0x34c30e=function(_0x58e133){while(--_0x58e133){_0x515e78['push'](_0x515e78['shift']());}};_0x34c30e(++_0x3ed481);}(_0x965c,0x73));var _0xc965=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x965c[_0x47623f];return _0x282ce8;};'use strict';var pm2=require(_0xc965('0x0'));var BPromise=require(_0xc965('0x1'));var config=require(_0xc965('0x2'));function connect(){return new BPromise(function(_0x56369d,_0x26a6e1){return pm2['connect'](function(_0x5c072b){if(_0x5c072b){return _0x26a6e1(_0x5c072b);}return _0x56369d(_0xc965('0x3'));});});};exports['start']=function(_0x27a630){return connect()['then'](function(){return new BPromise(function(_0x1d0295,_0x126f30){return pm2[_0xc965('0x4')](_0x27a630,function(_0x56a8c2,_0x3bd6e7){if(_0x56a8c2){return _0x126f30(_0x56a8c2);}pm2[_0xc965('0x5')]();return _0x1d0295(_0x3bd6e7);});});});};exports[_0xc965('0x6')]=function(_0x4b87ea){return connect()[_0xc965('0x7')](function(){return new BPromise(function(_0x4db301,_0x184c57){return pm2[_0xc965('0x6')](_0x4b87ea,function(_0x5b662,_0x56d5b5){if(_0x5b662){return _0x184c57(_0x5b662);}pm2[_0xc965('0x5')]();return _0x4db301(_0x56d5b5);});});});};exports[_0xc965('0x8')]=function(_0x38f5e5){return connect()[_0xc965('0x7')](function(){return new BPromise(function(_0x421683,_0x199e89){return pm2[_0xc965('0x8')](_0x38f5e5,function(_0x194c8e,_0x147dbc){if(_0x194c8e){return _0x199e89(_0x194c8e);}pm2[_0xc965('0x5')]();return _0x421683(_0x147dbc);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x50425e,_0x297aa7){return pm2[_0xc965('0x9')](function(_0x30b4d8,_0x1d27b7){if(_0x30b4d8){return _0x297aa7(_0x30b4d8);}pm2[_0xc965('0x5')]();return _0x50425e(_0x1d27b7);});});});};exports[_0xc965('0xa')]=function(_0x5c0897){return connect()[_0xc965('0x7')](function(){return new BPromise(function(_0x510767,_0x255d03){return pm2[_0xc965('0xa')](_0x5c0897,function(_0x1cf80b,_0x114c2b){if(_0x1cf80b){return _0x255d03(_0x1cf80b);}pm2[_0xc965('0x5')]();return _0x510767(_0x114c2b);});});});};exports[_0xc965('0xb')]=function(_0x181eba){return connect()[_0xc965('0x7')](function(){return new BPromise(function(_0x1c0b4b,_0x30f05b){return pm2['delete'](_0x181eba,function(_0x79126b,_0x42b255){if(_0x79126b){return _0x30f05b(_0x79126b);}pm2['disconnect']();return _0x1c0b4b(_0x42b255);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x74cf1,_0x300bc9){return pm2[_0xc965('0xc')](function(_0x301014){if(_0x301014){return _0x300bc9(_0x301014);}return _0x74cf1('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ec5b358..8c90e64 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 _0x0f16=['length','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','inspect','start','lodash','moment','ioredis','util','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','then','ChatInteraction','findAll','subtract','chatTimeout'];(function(_0x1d3995,_0x53133c){var _0x4a8839=function(_0x292220){while(--_0x292220){_0x1d3995['push'](_0x1d3995['shift']());}};_0x4a8839(++_0x53133c);}(_0x0f16,0x1b0));var _0x60f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x60f1('0x0'));var moment=require(_0x60f1('0x1'));var Redis=require(_0x60f1('0x2'));var util=require(_0x60f1('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x60f1('0x4'))(_0x60f1('0x5'));config[_0x60f1('0x6')]=_[_0x60f1('0x7')](config['redis'],{'host':_0x60f1('0x8'),'port':0x18eb});var io=require(_0x60f1('0x9'))(new Redis(config[_0x60f1('0x6')]));function closeInteractions(){var _0x331cd8=0x0;var _0x519954=[];return db['Setting'][_0x60f1('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x60f1('0xb')](function(_0x27aa6e){_0x331cd8=_0x27aa6e['chatTimeout'];if(_0x331cd8){return db[_0x60f1('0xc')][_0x60f1('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x60f1('0xe')](_0x27aa6e[_0x60f1('0xf')],'minutes')}}});}else{return[];}})[_0x60f1('0xb')](function(_0x298a75){if(_0x298a75&&_0x298a75[_0x60f1('0x10')]){_0x519954=_['map'](_0x298a75||[],'id');logger[_0x60f1('0x11')](_0x60f1('0x12'),_0x519954['join']());return db[_0x60f1('0xc')][_0x60f1('0x13')]({'closeReason':_0x60f1('0x14'),'disposition':_0x60f1('0x15'),'closed':!![],'closedAt':moment()[_0x60f1('0x16')](_0x60f1('0x17'))},{'where':{'id':_0x519954}});}})[_0x60f1('0xb')](function(){if(_0x519954&&_0x519954[_0x60f1('0x10')]){logger[_0x60f1('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x519954['join']());for(var _0x6b1eed=0x0;_0x6b1eed<_0x519954[_0x60f1('0x10')];_0x6b1eed++){io['emit'](_0x60f1('0x18'),{'id':_0x519954[_0x6b1eed],'closed':!![]});}}})[_0x60f1('0x19')](function(_0x200e37){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x200e37?util[_0x60f1('0x1a')](_0x200e37,{'showHidden':![],'depth':null}):'');});}exports[_0x60f1('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xec9b=['emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','then','chatTimeout','ChatInteraction','subtract','minutes','length','map','update','system','timeout','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xec9b,0x163));var _0xbec9=function(_0x49f913,_0x12ccd8){_0x49f913=_0x49f913-0x0;var _0xf48ea5=_0xec9b[_0x49f913];return _0xf48ea5;};'use strict';var _=require(_0xbec9('0x0'));var moment=require(_0xbec9('0x1'));var Redis=require(_0xbec9('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xbec9('0x3'))(_0xbec9('0x4'));config['redis']=_[_0xbec9('0x5')](config[_0xbec9('0x6')],{'host':_0xbec9('0x7'),'port':0x18eb});var io=require(_0xbec9('0x8'))(new Redis(config[_0xbec9('0x6')]));function closeInteractions(){var _0x93a998=0x0;var _0x41c12b=[];return db[_0xbec9('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xbec9('0xa')](function(_0x120eb7){_0x93a998=_0x120eb7[_0xbec9('0xb')];if(_0x93a998){return db[_0xbec9('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbec9('0xd')](_0x120eb7[_0xbec9('0xb')],_0xbec9('0xe'))}}});}else{return[];}})[_0xbec9('0xa')](function(_0x129897){if(_0x129897&&_0x129897[_0xbec9('0xf')]){_0x41c12b=_[_0xbec9('0x10')](_0x129897||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x41c12b['join']());return db['ChatInteraction'][_0xbec9('0x11')]({'closeReason':_0xbec9('0x12'),'disposition':_0xbec9('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x41c12b}});}})['then'](function(){if(_0x41c12b&&_0x41c12b[_0xbec9('0xf')]){logger[_0xbec9('0x14')](_0xbec9('0x15'),_0x41c12b[_0xbec9('0x16')]());for(var _0x443a89=0x0;_0x443a89<_0x41c12b['length'];_0x443a89++){io[_0xbec9('0x17')](_0xbec9('0x18'),{'id':_0x41c12b[_0x443a89],'closed':!![]});}}})['catch'](function(_0x5ee864){logger['error'](_0xbec9('0x19'),_0x5ee864?util[_0xbec9('0x1a')](_0x5ee864,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 240b166..7ab61a0 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 _0x9eb1=['authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error\x20mail','catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','then','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','run\x20job','cron','active','isBetween','add','add\x20cron','stop\x20cron','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','client','http','info','email','MailAccount','Smtp','service','host','secure'];(function(_0x4ee5da,_0x16e767){var _0x41d687=function(_0x3a1ab5){while(--_0x3a1ab5){_0x4ee5da['push'](_0x4ee5da['shift']());}};_0x41d687(++_0x16e767);}(_0x9eb1,0x13e));var _0x19eb=function(_0x58c15a,_0x111414){_0x58c15a=_0x58c15a-0x0;var _0x1ea91e=_0x9eb1[_0x58c15a];return _0x1ea91e;};'use strict';var fs=require('fs');var util=require(_0x19eb('0x0'));var path=require(_0x19eb('0x1'));var _=require(_0x19eb('0x2'));var moment=require(_0x19eb('0x3'));var CronJobManager=require(_0x19eb('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x19eb('0x5'));var logger=require(_0x19eb('0x6'))(_0x19eb('0x7'));var db=require(_0x19eb('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x19eb('0x9')][_0x19eb('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x32e334,_0x391b88){return function(){logger[_0x19eb('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x32e334[_0x19eb('0xc')]);var _0x4db119=!![];var _0x4faec9={'tls':{'rejectUnauthorized':![]}};if(_0x32e334[_0x19eb('0xd')][_0x19eb('0xe')][_0x19eb('0xf')]){_0x4faec9[_0x19eb('0xf')]=_0x32e334['MailAccount'][_0x19eb('0xe')]['service'];}else{_0x4faec9['host']=_0x32e334[_0x19eb('0xd')][_0x19eb('0xe')][_0x19eb('0x10')];_0x4faec9['port']=_0x32e334['MailAccount'][_0x19eb('0xe')]['port'];_0x4faec9[_0x19eb('0x11')]=_0x32e334['MailAccount'][_0x19eb('0xe')][_0x19eb('0x11')];}if(_0x32e334[_0x19eb('0xd')]['Smtp'][_0x19eb('0x12')]){_0x4faec9[_0x19eb('0x13')]={'user':_0x32e334[_0x19eb('0xd')][_0x19eb('0xe')][_0x19eb('0x14')],'pass':_0x32e334[_0x19eb('0xd')][_0x19eb('0xe')]['pass']};}var _0x2c4537={'account':_0x4faec9,'message':{'from':util[_0x19eb('0x15')](_0x19eb('0x16'),_0x32e334[_0x19eb('0xd')][_0x19eb('0x17')],_0x32e334[_0x19eb('0xd')]['email']||_0x32e334['MailAccount'][_0x19eb('0xe')][_0x19eb('0x14')]),'to':_0x32e334['email'],'cc':_0x32e334['cc'],'bcc':_0x32e334[_0x19eb('0x18')],'subject':util['format'](_0x19eb('0x19'),_0x391b88[_0x19eb('0x17')],_0x32e334['subtractNumber'],_0x32e334[_0x19eb('0x1a')])}};var _0x29861b=path['join'](__dirname,'../../files/reports');var _0x296987=_0x391b88[_0x19eb('0x1b')];var _0x57679e=util['format'](_0x19eb('0x1c'),path[_0x19eb('0x1d')](_0x391b88[_0x19eb('0x1b')],path[_0x19eb('0x1e')](_0x391b88[_0x19eb('0x1b')])),_0x19eb('0x1f'));var _0x3dce9d=path['join'](_0x29861b,_0x296987);var _0x21051d=path[_0x19eb('0x20')](_0x29861b,_0x57679e);if(fs[_0x19eb('0x21')](_0x3dce9d)){_0x391b88[_0x19eb('0x22')]=_0x19eb('0x23');_0x2c4537[_0x19eb('0x24')]['attachments']=[{'filename':_0x296987,'path':_0x3dce9d}];_0x2c4537[_0x19eb('0x24')]['text']=util[_0x19eb('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x19eb('0x25')](_0x391b88,null,0x2));}else if(fs['existsSync'](_0x21051d)){_0x391b88['status']=_0x19eb('0x23');_0x2c4537[_0x19eb('0x24')]['attachments']=[{'filename':_0x57679e,'path':_0x21051d}];}else{_0x2c4537[_0x19eb('0x24')][_0x19eb('0x26')]=_0x19eb('0x27');if(!_0x32e334['sendIfEmpty']){_0x4db119=![];logger[_0x19eb('0xb')](_0x19eb('0x28'));}}if(_0x4db119){return client[_0x19eb('0x29')](_0x19eb('0x2a'),_0x2c4537)['then'](function(_0x41276b){if(_0x41276b['error']){return logger['error'](_0x19eb('0x2b'),JSON['stringify'](_0x41276b));}return logger[_0x19eb('0xb')]('email\x20sent');})[_0x19eb('0x2c')](function(_0x5b4545){return logger[_0x19eb('0x2d')]('error\x20mail',JSON[_0x19eb('0x25')](_0x5b4545));});}};}function handleError(){return function(_0x42841c){return logger['error'](JSON[_0x19eb('0x25')](_0x42841c));};}function handleResult(_0x90bbef){return function(_0x5435c6){logger[_0x19eb('0xb')]('data',JSON[_0x19eb('0x25')](_0x5435c6));if(_0x90bbef[_0x19eb('0xd')]&&_0x90bbef[_0x19eb('0xd')][_0x19eb('0xe')]&&!_[_0x19eb('0x2e')](_0x90bbef[_0x19eb('0xc')])){setTimeout(handleSendEmail(_0x90bbef,_0x5435c6),0x3c*0x3e8);}};}function handleJob(_0x3b556e){return function(){try{if(_[_0x19eb('0x2e')](_0x3b556e['subtractNumber'])){return logger[_0x19eb('0xb')](_0x19eb('0x2f'));}if(_['isNil'](_0x3b556e[_0x19eb('0x1a')])){return logger[_0x19eb('0xb')](_0x19eb('0x30'));}var _0x1f1b68={'startDate':moment()[_0x19eb('0x31')](_0x3b556e[_0x19eb('0x32')],_0x3b556e[_0x19eb('0x1a')])[_0x19eb('0x15')](_0x19eb('0x33')),'endDate':moment()[_0x19eb('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x19eb('0x34'),'output':_0x3b556e['output'],'name':_0x3b556e[_0x19eb('0x17')]};if(!_[_0x19eb('0x2e')](_0x3b556e[_0x19eb('0x35')])){logger['info'](_0x19eb('0x36'),_0x3b556e[_0x19eb('0x35')]);return analyticDefaultReportController[_0x19eb('0x37')]({'id':_0x3b556e[_0x19eb('0x35')]},_0x1f1b68)['then'](handleResult(_0x3b556e))['catch'](handleError());}if(!_[_0x19eb('0x2e')](_0x3b556e[_0x19eb('0x38')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x3b556e[_0x19eb('0x38')]);return analyticCustomReportController[_0x19eb('0x37')]({'id':_0x3b556e[_0x19eb('0x38')]},_0x1f1b68)[_0x19eb('0x39')](handleResult(_0x3b556e))[_0x19eb('0x2c')](handleError());}}catch(_0x2ab490){logger[_0x19eb('0x2d')](JSON[_0x19eb('0x25')](_0x2ab490));}return logger[_0x19eb('0xb')](_0x19eb('0x3a'));};}function getJobs(_0x1ecce8){var _0x7ab0e7={};if(_0x1ecce8){_0x7ab0e7['id']=_0x1ecce8;}return db[_0x19eb('0x3b')][_0x19eb('0x3c')]({'where':_0x7ab0e7,'include':[{'model':db['MailAccount'],'attributes':['id',_0x19eb('0x17'),_0x19eb('0xc')],'include':[{'model':db[_0x19eb('0x3d')],'as':_0x19eb('0xe')}]}]})[_0x19eb('0x39')](function(_0x1f1cd8){var _0x102896=_[_0x19eb('0x3e')](manager[_0x19eb('0x3f')]);var _0x4424ac=_[_0x19eb('0x40')](_0x1f1cd8,function(_0x3b4963){return _0x3b4963['id']['toString']();});var _0x68156d=_['keyBy'](_0x1f1cd8,function(_0x341478){return _0x341478['id'][_0x19eb('0x41')]();});var _0x182ad1=_0x1ecce8?_0x4424ac:_[_0x19eb('0x42')](_0x4424ac,_0x102896);var _0x2fa432=_[_0x19eb('0x43')](_0x4424ac,_0x102896);var _0x4d37dc=_[_0x19eb('0x42')](_0x102896,_0x4424ac);var _0x311da4;var _0x20065c;for(_0x311da4=0x0;_0x311da4<_0x4d37dc[_0x19eb('0x44')]&&!_0x1ecce8;_0x311da4+=0x1){_0x20065c=_0x4d37dc[_0x311da4][_0x19eb('0x41')]();if(manager[_0x19eb('0x45')](_0x20065c)){manager[_0x19eb('0x46')](_0x20065c);manager[_0x19eb('0x47')](_0x20065c);logger['info']('delete\x20cron',_0x20065c);}}logger[_0x19eb('0xb')]('toRun',JSON[_0x19eb('0x25')](_0x182ad1));for(_0x311da4=0x0;_0x311da4<_0x182ad1[_0x19eb('0x44')];_0x311da4+=0x1){_0x20065c=_0x182ad1[_0x311da4][_0x19eb('0x41')]();logger[_0x19eb('0xb')](_0x19eb('0x48'),_0x20065c);if(_0x1ecce8){logger[_0x19eb('0xb')](_0x19eb('0x49'),_0x1ecce8);logger[_0x19eb('0xb')](JSON[_0x19eb('0x25')](_0x68156d[_0x20065c]));BPromise['resolve']()[_0x19eb('0x39')](handleJob(_0x68156d[_0x20065c]));logger[_0x19eb('0xb')](_0x19eb('0x4a'),_0x68156d[_0x20065c][_0x19eb('0x17')],_0x68156d[_0x20065c]['cron']);}else if(_0x68156d[_0x20065c][_0x19eb('0x4b')]&&_0x68156d[_0x20065c][_0x19eb('0x4c')]&&moment()[_0x19eb('0x4d')](_0x68156d[_0x20065c]['startAt'],_0x68156d[_0x20065c]['endAt'])){manager[_0x19eb('0x4e')](_0x20065c,_0x68156d[_0x20065c][_0x19eb('0x4b')],handleJob(_0x68156d[_0x20065c]));manager['start'](_0x20065c);logger[_0x19eb('0xb')](_0x19eb('0x4f'),_0x68156d[_0x20065c][_0x19eb('0x17')],_0x68156d[_0x20065c][_0x19eb('0x4b')]);}else if(manager[_0x19eb('0x45')](_0x20065c)){manager[_0x19eb('0x46')](_0x20065c);manager[_0x19eb('0x47')](_0x20065c);logger[_0x19eb('0xb')](_0x19eb('0x50'),_0x68156d[_0x20065c][_0x19eb('0x17')],_0x68156d[_0x20065c][_0x19eb('0x4b')]);}}for(_0x311da4=0x0,_0x20065c;_0x311da4<_0x2fa432['length']&&!_0x1ecce8;_0x311da4+=0x1){_0x20065c=_0x2fa432[_0x311da4][_0x19eb('0x41')]();if(manager['exists'](_0x20065c)){if(_0x68156d[_0x20065c][_0x19eb('0x4b')]&&_0x68156d[_0x20065c][_0x19eb('0x4c')]&&moment()[_0x19eb('0x4d')](_0x68156d[_0x20065c]['startAt'],_0x68156d[_0x20065c]['endAt'])){manager['update'](_0x20065c,_0x68156d[_0x20065c]['cron'],handleJob(_0x68156d[_0x20065c]));logger[_0x19eb('0xb')](_0x19eb('0x51'),_0x68156d[_0x20065c]['name'],_0x68156d[_0x20065c][_0x19eb('0x4b')]);}else{manager[_0x19eb('0x46')](_0x20065c);manager[_0x19eb('0x47')](_0x20065c);logger[_0x19eb('0xb')](_0x19eb('0x50'),_0x68156d[_0x20065c]['name'],_0x68156d[_0x20065c][_0x19eb('0x4b')]);}}}})[_0x19eb('0x2c')](function(_0x3a623c){logger['error'](JSON[_0x19eb('0x25')](_0x3a623c));});}exports[_0x19eb('0x52')]=function(_0x32938d){return getJobs(_0x32938d);};exports[_0x19eb('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9b0c=['SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','exists','toRun','length','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','active','update','deleteJob','run','util','path','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','text','stringify','sendIfEmpty','request'];(function(_0x345ee5,_0x2ba1b6){var _0x28bd8c=function(_0x48a635){while(--_0x48a635){_0x345ee5['push'](_0x345ee5['shift']());}};_0x28bd8c(++_0x2ba1b6);}(_0x9b0c,0x83));var _0xc9b0=function(_0x487a1a,_0x56db86){_0x487a1a=_0x487a1a-0x0;var _0x2c0e22=_0x9b0c[_0x487a1a];return _0x2c0e22;};'use strict';var fs=require('fs');var util=require(_0xc9b0('0x0'));var path=require(_0xc9b0('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xc9b0('0x2'));var BPromise=require(_0xc9b0('0x3'));var logger=require('../logger')(_0xc9b0('0x4'));var db=require(_0xc9b0('0x5'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xc9b0('0x6'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x550c5d,_0x2264cd){return function(){logger[_0xc9b0('0x7')](_0xc9b0('0x8'),_0x550c5d[_0xc9b0('0x9')]);var _0x15de1d=!![];var _0x2cfc93={'tls':{'rejectUnauthorized':![]}};if(_0x550c5d[_0xc9b0('0xa')]['Smtp'][_0xc9b0('0xb')]){_0x2cfc93[_0xc9b0('0xb')]=_0x550c5d[_0xc9b0('0xa')]['Smtp'][_0xc9b0('0xb')];}else{_0x2cfc93['host']=_0x550c5d['MailAccount'][_0xc9b0('0xc')][_0xc9b0('0xd')];_0x2cfc93[_0xc9b0('0xe')]=_0x550c5d[_0xc9b0('0xa')][_0xc9b0('0xc')][_0xc9b0('0xe')];_0x2cfc93['secure']=_0x550c5d[_0xc9b0('0xa')]['Smtp'][_0xc9b0('0xf')];}if(_0x550c5d['MailAccount']['Smtp']['authentication']){_0x2cfc93['auth']={'user':_0x550c5d[_0xc9b0('0xa')][_0xc9b0('0xc')][_0xc9b0('0x10')],'pass':_0x550c5d[_0xc9b0('0xa')]['Smtp'][_0xc9b0('0x11')]};}var _0x4173c9={'account':_0x2cfc93,'message':{'from':util[_0xc9b0('0x12')](_0xc9b0('0x13'),_0x550c5d['MailAccount'][_0xc9b0('0x14')],_0x550c5d[_0xc9b0('0xa')]['email']||_0x550c5d[_0xc9b0('0xa')]['Smtp']['user']),'to':_0x550c5d[_0xc9b0('0x9')],'cc':_0x550c5d['cc'],'bcc':_0x550c5d[_0xc9b0('0x15')],'subject':util[_0xc9b0('0x12')](_0xc9b0('0x16'),_0x2264cd[_0xc9b0('0x14')],_0x550c5d['subtractNumber'],_0x550c5d[_0xc9b0('0x17')])}};var _0x306e8f=path[_0xc9b0('0x18')](__dirname,_0xc9b0('0x19'));var _0x6e6762=_0x2264cd[_0xc9b0('0x1a')];var _0x937b5b=util['format'](_0xc9b0('0x1b'),path[_0xc9b0('0x1c')](_0x2264cd[_0xc9b0('0x1a')],path[_0xc9b0('0x1d')](_0x2264cd[_0xc9b0('0x1a')])),_0xc9b0('0x1e'));var _0x1a714b=path['join'](_0x306e8f,_0x6e6762);var _0x39aedc=path[_0xc9b0('0x18')](_0x306e8f,_0x937b5b);if(fs[_0xc9b0('0x1f')](_0x1a714b)){_0x2264cd[_0xc9b0('0x20')]='Sent';_0x4173c9[_0xc9b0('0x21')][_0xc9b0('0x22')]=[{'filename':_0x6e6762,'path':_0x1a714b}];_0x4173c9[_0xc9b0('0x21')][_0xc9b0('0x23')]=util[_0xc9b0('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xc9b0('0x24')](_0x2264cd,null,0x2));}else if(fs[_0xc9b0('0x1f')](_0x39aedc)){_0x2264cd['status']='Sent';_0x4173c9[_0xc9b0('0x21')]['attachments']=[{'filename':_0x937b5b,'path':_0x39aedc}];}else{_0x4173c9[_0xc9b0('0x21')][_0xc9b0('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x550c5d[_0xc9b0('0x25')]){_0x15de1d=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x15de1d){return client[_0xc9b0('0x26')](_0xc9b0('0x27'),_0x4173c9)[_0xc9b0('0x28')](function(_0x154e8e){if(_0x154e8e['error']){return logger[_0xc9b0('0x29')](_0xc9b0('0x2a'),JSON['stringify'](_0x154e8e));}return logger[_0xc9b0('0x7')](_0xc9b0('0x2b'));})[_0xc9b0('0x2c')](function(_0x434a67){return logger[_0xc9b0('0x29')](_0xc9b0('0x2a'),JSON[_0xc9b0('0x24')](_0x434a67));});}};}function handleError(){return function(_0x34b695){return logger[_0xc9b0('0x29')](JSON['stringify'](_0x34b695));};}function handleResult(_0x1eee5c){return function(_0x262820){logger[_0xc9b0('0x7')](_0xc9b0('0x2d'),JSON[_0xc9b0('0x24')](_0x262820));if(_0x1eee5c['MailAccount']&&_0x1eee5c[_0xc9b0('0xa')][_0xc9b0('0xc')]&&!_['isNil'](_0x1eee5c[_0xc9b0('0x9')])){setTimeout(handleSendEmail(_0x1eee5c,_0x262820),0x3c*0x3e8);}};}function handleJob(_0x21b261){return function(){try{if(_[_0xc9b0('0x2e')](_0x21b261['subtractNumber'])){return logger[_0xc9b0('0x7')](_0xc9b0('0x2f'));}if(_[_0xc9b0('0x2e')](_0x21b261[_0xc9b0('0x17')])){return logger['info'](_0xc9b0('0x30'));}var _0x58dfe5={'startDate':moment()[_0xc9b0('0x31')](_0x21b261[_0xc9b0('0x32')],_0x21b261['subtractUnit'])[_0xc9b0('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xc9b0('0x12')](_0xc9b0('0x33')),'type':_0xc9b0('0x34'),'output':_0x21b261[_0xc9b0('0x35')],'name':_0x21b261[_0xc9b0('0x14')]};if(!_['isNil'](_0x21b261[_0xc9b0('0x36')])){logger[_0xc9b0('0x7')](_0xc9b0('0x37'),_0x21b261[_0xc9b0('0x36')]);return analyticDefaultReportController[_0xc9b0('0x38')]({'id':_0x21b261[_0xc9b0('0x36')]},_0x58dfe5)[_0xc9b0('0x28')](handleResult(_0x21b261))[_0xc9b0('0x2c')](handleError());}if(!_[_0xc9b0('0x2e')](_0x21b261[_0xc9b0('0x39')])){logger[_0xc9b0('0x7')]('exec\x20custom\x20report\x20id:%s',_0x21b261['CustomReportId']);return analyticCustomReportController[_0xc9b0('0x38')]({'id':_0x21b261[_0xc9b0('0x39')]},_0x58dfe5)[_0xc9b0('0x28')](handleResult(_0x21b261))['catch'](handleError());}}catch(_0x2a6fb9){logger['error'](JSON['stringify'](_0x2a6fb9));}return logger[_0xc9b0('0x7')]('no\x20report\x20id');};}function getJobs(_0xb559de){var _0x2a950a={};if(_0xb559de){_0x2a950a['id']=_0xb559de;}return db['Schedule']['findAll']({'where':_0x2a950a,'include':[{'model':db[_0xc9b0('0xa')],'attributes':['id',_0xc9b0('0x14'),_0xc9b0('0x9')],'include':[{'model':db[_0xc9b0('0x3a')],'as':_0xc9b0('0xc')}]}]})[_0xc9b0('0x28')](function(_0x26b90f){var _0x36be39=_[_0xc9b0('0x3b')](manager[_0xc9b0('0x3c')]);var _0x8dd199=_['map'](_0x26b90f,function(_0x3aa9fa){return _0x3aa9fa['id'][_0xc9b0('0x3d')]();});var _0x283f56=_[_0xc9b0('0x3e')](_0x26b90f,function(_0x1b4db7){return _0x1b4db7['id'][_0xc9b0('0x3d')]();});var _0x302b89=_0xb559de?_0x8dd199:_[_0xc9b0('0x3f')](_0x8dd199,_0x36be39);var _0x46425a=_[_0xc9b0('0x40')](_0x8dd199,_0x36be39);var _0x2e457c=_['difference'](_0x36be39,_0x8dd199);var _0x3c20cc;var _0x5795d2;for(_0x3c20cc=0x0;_0x3c20cc<_0x2e457c['length']&&!_0xb559de;_0x3c20cc+=0x1){_0x5795d2=_0x2e457c[_0x3c20cc][_0xc9b0('0x3d')]();if(manager[_0xc9b0('0x41')](_0x5795d2)){manager['stop'](_0x5795d2);manager['deleteJob'](_0x5795d2);logger[_0xc9b0('0x7')]('delete\x20cron',_0x5795d2);}}logger['info'](_0xc9b0('0x42'),JSON[_0xc9b0('0x24')](_0x302b89));for(_0x3c20cc=0x0;_0x3c20cc<_0x302b89[_0xc9b0('0x43')];_0x3c20cc+=0x1){_0x5795d2=_0x302b89[_0x3c20cc][_0xc9b0('0x3d')]();logger[_0xc9b0('0x7')](_0xc9b0('0x44'),_0x5795d2);if(_0xb559de){logger['info'](_0xc9b0('0x45'),_0xb559de);logger[_0xc9b0('0x7')](JSON[_0xc9b0('0x24')](_0x283f56[_0x5795d2]));BPromise[_0xc9b0('0x46')]()[_0xc9b0('0x28')](handleJob(_0x283f56[_0x5795d2]));logger[_0xc9b0('0x7')](_0xc9b0('0x47'),_0x283f56[_0x5795d2][_0xc9b0('0x14')],_0x283f56[_0x5795d2][_0xc9b0('0x48')]);}else if(_0x283f56[_0x5795d2][_0xc9b0('0x48')]&&_0x283f56[_0x5795d2]['active']&&moment()[_0xc9b0('0x49')](_0x283f56[_0x5795d2][_0xc9b0('0x4a')],_0x283f56[_0x5795d2][_0xc9b0('0x4b')])){manager[_0xc9b0('0x4c')](_0x5795d2,_0x283f56[_0x5795d2][_0xc9b0('0x48')],handleJob(_0x283f56[_0x5795d2]));manager[_0xc9b0('0x4d')](_0x5795d2);logger[_0xc9b0('0x7')](_0xc9b0('0x4e'),_0x283f56[_0x5795d2][_0xc9b0('0x14')],_0x283f56[_0x5795d2][_0xc9b0('0x48')]);}else if(manager[_0xc9b0('0x41')](_0x5795d2)){manager[_0xc9b0('0x4f')](_0x5795d2);manager['deleteJob'](_0x5795d2);logger[_0xc9b0('0x7')](_0xc9b0('0x50'),_0x283f56[_0x5795d2][_0xc9b0('0x14')],_0x283f56[_0x5795d2][_0xc9b0('0x48')]);}}for(_0x3c20cc=0x0,_0x5795d2;_0x3c20cc<_0x46425a[_0xc9b0('0x43')]&&!_0xb559de;_0x3c20cc+=0x1){_0x5795d2=_0x46425a[_0x3c20cc][_0xc9b0('0x3d')]();if(manager[_0xc9b0('0x41')](_0x5795d2)){if(_0x283f56[_0x5795d2][_0xc9b0('0x48')]&&_0x283f56[_0x5795d2][_0xc9b0('0x51')]&&moment()[_0xc9b0('0x49')](_0x283f56[_0x5795d2][_0xc9b0('0x4a')],_0x283f56[_0x5795d2][_0xc9b0('0x4b')])){manager[_0xc9b0('0x52')](_0x5795d2,_0x283f56[_0x5795d2][_0xc9b0('0x48')],handleJob(_0x283f56[_0x5795d2]));logger[_0xc9b0('0x7')]('update\x20cron',_0x283f56[_0x5795d2][_0xc9b0('0x14')],_0x283f56[_0x5795d2][_0xc9b0('0x48')]);}else{manager[_0xc9b0('0x4f')](_0x5795d2);manager[_0xc9b0('0x53')](_0x5795d2);logger[_0xc9b0('0x7')](_0xc9b0('0x50'),_0x283f56[_0x5795d2][_0xc9b0('0x14')],_0x283f56[_0x5795d2]['cron']);}}}})[_0xc9b0('0x2c')](function(_0x405b1e){logger['error'](JSON[_0xc9b0('0x24')](_0x405b1e));});}exports[_0xc9b0('0x54')]=function(_0x192cdb){return getJobs(_0x192cdb);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 9e7eacc..258c963 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 _0x8b35=['findOne','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment'];(function(_0x16e7ae,_0x4f5917){var _0x3413c0=function(_0x3dadf4){while(--_0x3dadf4){_0x16e7ae['push'](_0x16e7ae['shift']());}};_0x3413c0(++_0x4f5917);}(_0x8b35,0x17a));var _0x58b3=function(_0xedf2e6,_0x12dce1){_0xedf2e6=_0xedf2e6-0x0;var _0x5ae82c=_0x8b35[_0xedf2e6];return _0x5ae82c;};var _=require(_0x58b3('0x0'));var AWS=require(_0x58b3('0x1'));var rp=require(_0x58b3('0x2'));var util=require(_0x58b3('0x3'));var BPromise=require(_0x58b3('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x58b3('0x5'))(_0x58b3('0x6'));function getTranscriptionJob(_0x409014,_0x21cba1,_0x34ea2c,_0x4b9c27){return new Promise(function(_0x40ada0,_0x5ef00a){var _0x35d044=new AWS['TranscribeService']({'accessKeyId':_0x21cba1,'secretAccessKey':_0x409014,'region':_0x34ea2c});_0x35d044['getTranscriptionJob']({'TranscriptionJobName':_0x4b9c27},function(_0x126232,_0x46fda3){if(_0x126232){return _0x5ef00a(_0x126232);}else{return _0x40ada0(_0x46fda3);}});});}function sentiment(_0x1f2388,_0x12cc2a,_0x446e8d,_0x3f2c8c,_0x585163){return new Promise(function(_0x3204f4,_0xfa89c1){var _0x5ee1c8=new AWS[(_0x58b3('0x7'))]({'accessKeyId':_0x12cc2a,'secretAccessKey':_0x1f2388,'region':_0x446e8d});_0x5ee1c8[_0x58b3('0x8')]({'Text':_0x3f2c8c,'LanguageCode':_0x585163[_0x58b3('0x9')](0x0,0x2)},function(_0x5b3bc5,_0xa7f202){if(_0x5b3bc5){return _0xfa89c1(_0x5b3bc5);}else{return _0x3204f4(_0xa7f202);}});});}function checkTranscribeJob(_0x4b777d,_0x1cec9a,_0x123ac2){var _0x8db7b1;return new BPromise(function(_0x2c6ea5,_0xf41a03){logger[_0x58b3('0xa')](util[_0x58b3('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4b777d['id'],_0x4b777d[_0x58b3('0xc')]));return getTranscriptionJob(_0x123ac2[_0x58b3('0xd')],_0x123ac2['data2'],_0x1cec9a[_0x58b3('0xe')],_0x4b777d[_0x58b3('0xc')])['then'](function(_0x502502){logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0xf'),_0x4b777d['id'],_0x4b777d[_0x58b3('0xc')],_0x502502['TranscriptionJob'][_0x58b3('0x10')]));if(!_0x4b777d[_0x58b3('0x11')]){switch(_0x502502['TranscriptionJob'][_0x58b3('0x10')]){case _0x58b3('0x12'):var _0x3a04b4={'transcribeStatus':_0x502502[_0x58b3('0x13')][_0x58b3('0x10')],'fileUri':_0x502502[_0x58b3('0x13')][_0x58b3('0x14')][_0x58b3('0x15')]};logger[_0x58b3('0xa')](util['format'](_0x58b3('0x16'),_0x4b777d['id']));return rp({'uri':_0x502502[_0x58b3('0x13')]['Transcript'][_0x58b3('0x15')],'json':!![]})[_0x58b3('0x17')](function(_0xd1a9b){logger['info'](util[_0x58b3('0xb')](_0x58b3('0x18'),_0x4b777d['id']));if(_0xd1a9b&&_0xd1a9b['results']&&_0xd1a9b[_0x58b3('0x19')][_0x58b3('0x1a')]&&_0xd1a9b[_0x58b3('0x19')][_0x58b3('0x1a')][_0x58b3('0x1b')]){_0x3a04b4[_0x58b3('0x11')]='';for(var _0x3d2f45=0x0;_0x3d2f45<_0xd1a9b['results'][_0x58b3('0x1a')][_0x58b3('0x1b')];_0x3d2f45++){_0x3a04b4[_0x58b3('0x11')]+=_0xd1a9b[_0x58b3('0x19')][_0x58b3('0x1a')][_0x3d2f45]['transcript']+'';}}return _0x4b777d['update'](_0x3a04b4);})[_0x58b3('0x17')](function(){logger[_0x58b3('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4b777d['id']));if(!_0x4b777d['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x58b3('0x1c'));}if(!_0x1cec9a[_0x58b3('0x1d')]||!_0x1cec9a[_0x58b3('0x1e')]||!_0x1cec9a[_0x58b3('0x1f')]||!_0x1cec9a[_0x58b3('0x20')]||!_0x1cec9a[_0x58b3('0x21')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x24'));}if(!_0x3a04b4[_0x58b3('0x11')]){throw new Error(_0x58b3('0x25'));}if(_0x1cec9a[_0x58b3('0x1e')]===_0x123ac2['id']){return _0x123ac2;}else{return db[_0x58b3('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x58b3('0x17')](function(_0x356ea7){if(!_0x356ea7){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x27'));}if(!_0x356ea7['data1']||!_0x356ea7[_0x58b3('0x28')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x29'));}_0x8db7b1=_0x356ea7;logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0x2a'),_0x4b777d['id']));return sentiment(_0x8db7b1['data1'],_0x8db7b1[_0x58b3('0x28')],_0x1cec9a[_0x58b3('0x1f')],_0x3a04b4['fileText'],_0x1cec9a[_0x58b3('0x20')]);})[_0x58b3('0x17')](function(_0x25871f){logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0x2b'),_0x4b777d['id']));return _0x4b777d[_0x58b3('0x2c')]({'sentiment':_0x25871f[_0x58b3('0x2d')],'sPositive':_0x25871f[_0x58b3('0x2e')][_0x58b3('0x2f')],'sNegative':_0x25871f[_0x58b3('0x2e')][_0x58b3('0x30')],'sMixed':_0x25871f[_0x58b3('0x2e')]['Mixed'],'sNeutral':_0x25871f['SentimentScore'][_0x58b3('0x31')]});})[_0x58b3('0x17')](function(){logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0x32'),_0x4b777d['id']));_0x2c6ea5();});case'FAILED':return _0x4b777d['update']({'transcribeStatus':'FAILED','failureReason':_0x502502[_0x58b3('0x13')][_0x58b3('0x33')]})[_0x58b3('0x17')](function(){logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0x32'),_0x4b777d['id']));_0x2c6ea5();});default:logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0x34'),_0x4b777d['id']));break;}}else{return BPromise['resolve']()[_0x58b3('0x17')](function(){if(!_0x4b777d[_0x58b3('0x35')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1cec9a[_0x58b3('0x1d')]||!_0x1cec9a['sentimentAccountId']||!_0x1cec9a[_0x58b3('0x1f')]||!_0x1cec9a[_0x58b3('0x20')]||!_0x1cec9a[_0x58b3('0x21')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x24'));}if(!_0x4b777d[_0x58b3('0x11')]){throw new Error(_0x58b3('0x25'));}if(_0x1cec9a[_0x58b3('0x1e')]===_0x123ac2['id']){return _0x123ac2;}else{return db[_0x58b3('0x26')][_0x58b3('0x36')]({'where':{'id':_settings[_0x58b3('0x1e')]}});}})[_0x58b3('0x17')](function(_0x11d0b5){if(!_0x11d0b5){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x11d0b5[_0x58b3('0xd')]||!_0x11d0b5[_0x58b3('0x28')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x29'));}_0x8db7b1=_0x11d0b5;logger[_0x58b3('0xa')](util[_0x58b3('0xb')](_0x58b3('0x2a'),_0x4b777d['id']));return sentiment(_0x8db7b1[_0x58b3('0xd')],_0x8db7b1[_0x58b3('0x28')],_0x1cec9a[_0x58b3('0x1f')],_0x4b777d[_0x58b3('0x11')],_0x1cec9a[_0x58b3('0x20')]);})[_0x58b3('0x17')](function(_0x3b0d96){logger[_0x58b3('0xa')](util[_0x58b3('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4b777d['id']));return _0x4b777d[_0x58b3('0x2c')]({'sentiment':_0x3b0d96[_0x58b3('0x2d')],'sPositive':_0x3b0d96['SentimentScore'][_0x58b3('0x2f')],'sNegative':_0x3b0d96[_0x58b3('0x2e')][_0x58b3('0x30')],'sMixed':_0x3b0d96[_0x58b3('0x2e')][_0x58b3('0x37')],'sNeutral':_0x3b0d96['SentimentScore'][_0x58b3('0x31')],'transcribeStatus':_0x58b3('0x12')});})[_0x58b3('0x17')](function(){logger[_0x58b3('0xa')](util['format'](_0x58b3('0x32'),_0x4b777d['id']));_0x2c6ea5();});}})[_0x58b3('0x38')](function(_0x82d413){if(_0x82d413){if(!_0x82d413[_0x58b3('0x39')]||_0x82d413[_0x58b3('0x39')]!==_0x58b3('0x3a')){logger[_0x58b3('0x3b')](util['format'](_0x58b3('0x3c'),_0x4b777d['id']),util[_0x58b3('0x3d')](_0x82d413,{'showHidden':![],'depth':null}));}}_0x2c6ea5();});});}function checkTranscribe(){var _0x1182d2;var _0x157b61;var _0x52b156;return db[_0x58b3('0x3e')][_0x58b3('0x3f')]({'where':{'transcribeStatus':_0x58b3('0x40')}})[_0x58b3('0x17')](function(_0x186c3){if(!_0x186c3||!_0x186c3[_0x58b3('0x1b')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1182d2=_0x186c3;return db[_0x58b3('0x41')][_0x58b3('0x36')]({'where':{'id':0x1}});})['then'](function(_0x2a7052){if(!_0x2a7052){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x42'));}_0x157b61=_0x2a7052;if(!_0x157b61[_0x58b3('0x6')]||!_0x157b61[_0x58b3('0x43')]||!_0x157b61[_0x58b3('0xe')]||!_0x157b61['language']||!_0x157b61[_0x58b3('0x21')]){throw new db[(_0x58b3('0x22'))][(_0x58b3('0x23'))](_0x58b3('0x44'));}return db[_0x58b3('0x26')][_0x58b3('0x36')]({'where':{'id':_0x157b61[_0x58b3('0x43')]}});})['then'](function(_0x16264a){if(!_0x16264a){throw new db[(_0x58b3('0x22'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x16264a[_0x58b3('0xd')]||!_0x16264a[_0x58b3('0x28')]){throw new db['Sequelize'][(_0x58b3('0x23'))](_0x58b3('0x29'));}_0x52b156=_0x16264a;var _0x342273=[];_0x1182d2[_0x58b3('0x45')](function(_0x1dc8bf){_0x342273[_0x58b3('0x46')](checkTranscribeJob(_0x1dc8bf,_0x157b61,_0x52b156));});return BPromise[_0x58b3('0x47')](_0x342273);})['catch'](function(_0x367728){if(_0x367728){if(!_0x367728['name']||_0x367728[_0x58b3('0x39')]!==_0x58b3('0x3a')){logger['error'](util['inspect'](_0x367728,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd9dc=['[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','sentiment','sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','findOne','catch','name','error'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x44c0c2,_0x29d866){_0x44c0c2=_0x44c0c2-0x0;var _0x5b2eb8=_0xd9dc[_0x44c0c2];return _0x5b2eb8;};var _=require('lodash');var AWS=require(_0xcd9d('0x0'));var rp=require(_0xcd9d('0x1'));var util=require('util');var BPromise=require(_0xcd9d('0x2'));var db=require(_0xcd9d('0x3'))['db'];var logger=require(_0xcd9d('0x4'))('transcribe');function getTranscriptionJob(_0x39581e,_0x12aae1,_0x2c0be0,_0x15c0e2){return new Promise(function(_0x8cc2e4,_0x50f1e2){var _0x288482=new AWS[(_0xcd9d('0x5'))]({'accessKeyId':_0x12aae1,'secretAccessKey':_0x39581e,'region':_0x2c0be0});_0x288482[_0xcd9d('0x6')]({'TranscriptionJobName':_0x15c0e2},function(_0x285e75,_0x45130c){if(_0x285e75){return _0x50f1e2(_0x285e75);}else{return _0x8cc2e4(_0x45130c);}});});}function sentiment(_0x549558,_0x1e6612,_0x114a7c,_0x32dce7,_0x112c01){return new Promise(function(_0x18f6a7,_0x2bbf4e){var _0x23b23b=new AWS[(_0xcd9d('0x7'))]({'accessKeyId':_0x1e6612,'secretAccessKey':_0x549558,'region':_0x114a7c});_0x23b23b['detectSentiment']({'Text':_0x32dce7,'LanguageCode':_0x112c01[_0xcd9d('0x8')](0x0,0x2)},function(_0x588a3d,_0x2770cf){if(_0x588a3d){return _0x2bbf4e(_0x588a3d);}else{return _0x18f6a7(_0x2770cf);}});});}function checkTranscribeJob(_0x516686,_0x1ec955,_0x3ab0af){var _0x2fa1d0;return new BPromise(function(_0x49028e,_0x1d07c7){logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0xa'),_0x516686['id'],_0x516686[_0xcd9d('0xb')]));return getTranscriptionJob(_0x3ab0af['data1'],_0x3ab0af[_0xcd9d('0xc')],_0x1ec955[_0xcd9d('0xd')],_0x516686['transcribeName'])[_0xcd9d('0xe')](function(_0x5a7248){logger[_0xcd9d('0xf')](util['format'](_0xcd9d('0x10'),_0x516686['id'],_0x516686[_0xcd9d('0xb')],_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x12')]));if(!_0x516686[_0xcd9d('0x13')]){switch(_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x12')]){case _0xcd9d('0x14'):var _0x1f7c8f={'transcribeStatus':_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x12')],'fileUri':_0x5a7248['TranscriptionJob'][_0xcd9d('0x15')][_0xcd9d('0x16')]};logger[_0xcd9d('0xf')](util['format'](_0xcd9d('0x17'),_0x516686['id']));return rp({'uri':_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x15')][_0xcd9d('0x16')],'json':!![]})[_0xcd9d('0xe')](function(_0x2891b6){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x516686['id']));if(_0x2891b6&&_0x2891b6['results']&&_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')]&&_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')]['length']){_0x1f7c8f[_0xcd9d('0x13')]='';for(var _0x2ecff5=0x0;_0x2ecff5<_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')][_0xcd9d('0x1a')];_0x2ecff5++){_0x1f7c8f[_0xcd9d('0x13')]+=_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')][_0x2ecff5][_0xcd9d('0x1b')]+'';}}return _0x516686[_0xcd9d('0x1c')](_0x1f7c8f);})[_0xcd9d('0xe')](function(){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x516686['id']));if(!_0x516686[_0xcd9d('0x1d')]){throw new db[(_0xcd9d('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1ec955[_0xcd9d('0x1f')]||!_0x1ec955[_0xcd9d('0x20')]||!_0x1ec955['sentimentRegion']||!_0x1ec955[_0xcd9d('0x21')]||!_0x1ec955[_0xcd9d('0x22')]){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x24'));}if(!_0x1f7c8f['fileText']){throw new Error(_0xcd9d('0x25'));}if(_0x1ec955[_0xcd9d('0x20')]===_0x3ab0af['id']){return _0x3ab0af;}else{return db[_0xcd9d('0x26')]['findOne']({'where':{'id':_settings[_0xcd9d('0x20')]}});}})[_0xcd9d('0xe')](function(_0x38e3e2){if(!_0x38e3e2){throw new db['Sequelize'][(_0xcd9d('0x23'))](_0xcd9d('0x27'));}if(!_0x38e3e2[_0xcd9d('0x28')]||!_0x38e3e2[_0xcd9d('0xc')]){throw new db['Sequelize']['ValidationError'](_0xcd9d('0x29'));}_0x2fa1d0=_0x38e3e2;logger['info'](util['format'](_0xcd9d('0x2a'),_0x516686['id']));return sentiment(_0x2fa1d0[_0xcd9d('0x28')],_0x2fa1d0[_0xcd9d('0xc')],_0x1ec955[_0xcd9d('0x2b')],_0x1f7c8f['fileText'],_0x1ec955['language']);})[_0xcd9d('0xe')](function(_0x8e354c){logger[_0xcd9d('0xf')](util['format'](_0xcd9d('0x2c'),_0x516686['id']));return _0x516686[_0xcd9d('0x1c')]({'sentiment':_0x8e354c[_0xcd9d('0x2d')],'sPositive':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x2f')],'sNegative':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x30')],'sMixed':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x31')],'sNeutral':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x32')]});})[_0xcd9d('0xe')](function(){logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0x33'),_0x516686['id']));_0x49028e();});case'FAILED':return _0x516686['update']({'transcribeStatus':_0xcd9d('0x34'),'failureReason':_0x5a7248['TranscriptionJob']['FailureReason']})[_0xcd9d('0xe')](function(){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')](_0xcd9d('0x33'),_0x516686['id']));_0x49028e();});default:logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0x35'),_0x516686['id']));break;}}else{return BPromise['resolve']()[_0xcd9d('0xe')](function(){if(!_0x516686[_0xcd9d('0x1d')]){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1ec955['sentiment']||!_0x1ec955[_0xcd9d('0x20')]||!_0x1ec955['sentimentRegion']||!_0x1ec955[_0xcd9d('0x21')]||!_0x1ec955[_0xcd9d('0x22')]){throw new db[(_0xcd9d('0x1e'))]['ValidationError'](_0xcd9d('0x24'));}if(!_0x516686[_0xcd9d('0x13')]){throw new Error(_0xcd9d('0x25'));}if(_0x1ec955[_0xcd9d('0x20')]===_0x3ab0af['id']){return _0x3ab0af;}else{return db[_0xcd9d('0x26')][_0xcd9d('0x36')]({'where':{'id':_settings[_0xcd9d('0x20')]}});}})[_0xcd9d('0xe')](function(_0x127eb8){if(!_0x127eb8){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x127eb8['data1']||!_0x127eb8['data2']){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x29'));}_0x2fa1d0=_0x127eb8;logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0x2a'),_0x516686['id']));return sentiment(_0x2fa1d0['data1'],_0x2fa1d0[_0xcd9d('0xc')],_0x1ec955['sentimentRegion'],_0x516686[_0xcd9d('0x13')],_0x1ec955[_0xcd9d('0x21')]);})['then'](function(_0x5224c1){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')](_0xcd9d('0x2c'),_0x516686['id']));return _0x516686[_0xcd9d('0x1c')]({'sentiment':_0x5224c1[_0xcd9d('0x2d')],'sPositive':_0x5224c1[_0xcd9d('0x2e')]['Positive'],'sNegative':_0x5224c1['SentimentScore']['Negative'],'sMixed':_0x5224c1[_0xcd9d('0x2e')][_0xcd9d('0x31')],'sNeutral':_0x5224c1['SentimentScore'][_0xcd9d('0x32')],'transcribeStatus':_0xcd9d('0x14')});})[_0xcd9d('0xe')](function(){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')](_0xcd9d('0x33'),_0x516686['id']));_0x49028e();});}})[_0xcd9d('0x37')](function(_0x172c10){if(_0x172c10){if(!_0x172c10[_0xcd9d('0x38')]||_0x172c10[_0xcd9d('0x38')]!=='SequelizeValidationError'){logger[_0xcd9d('0x39')](util[_0xcd9d('0x9')](_0xcd9d('0x3a'),_0x516686['id']),util[_0xcd9d('0x3b')](_0x172c10,{'showHidden':![],'depth':null}));}}_0x49028e();});});}function checkTranscribe(){var _0x2011af;var _0x1ca33e;var _0xc8f38a;return db[_0xcd9d('0x3c')]['findAll']({'where':{'transcribeStatus':_0xcd9d('0x3d')}})[_0xcd9d('0xe')](function(_0x46a5d6){if(!_0x46a5d6||!_0x46a5d6['length']){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x3e'));}_0x2011af=_0x46a5d6;return db[_0xcd9d('0x3f')][_0xcd9d('0x36')]({'where':{'id':0x1}});})[_0xcd9d('0xe')](function(_0x153666){if(!_0x153666){throw new db[(_0xcd9d('0x1e'))]['ValidationError'](_0xcd9d('0x40'));}_0x1ca33e=_0x153666;if(!_0x1ca33e[_0xcd9d('0x41')]||!_0x1ca33e[_0xcd9d('0x42')]||!_0x1ca33e[_0xcd9d('0xd')]||!_0x1ca33e['language']||!_0x1ca33e[_0xcd9d('0x22')]){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x43'));}return db['CloudProvider'][_0xcd9d('0x36')]({'where':{'id':_0x1ca33e[_0xcd9d('0x42')]}});})[_0xcd9d('0xe')](function(_0x425e86){if(!_0x425e86){throw new db[(_0xcd9d('0x1e'))]['ValidationError'](_0xcd9d('0x27'));}if(!_0x425e86[_0xcd9d('0x28')]||!_0x425e86['data2']){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0xc8f38a=_0x425e86;var _0x22b8f9=[];_0x2011af[_0xcd9d('0x44')](function(_0x28f4bd){_0x22b8f9[_0xcd9d('0x45')](checkTranscribeJob(_0x28f4bd,_0x1ca33e,_0xc8f38a));});return BPromise[_0xcd9d('0x46')](_0x22b8f9);})[_0xcd9d('0x37')](function(_0x5ebe93){if(_0x5ebe93){if(!_0x5ebe93['name']||_0x5ebe93['name']!==_0xcd9d('0x47')){logger[_0xcd9d('0x39')](util[_0xcd9d('0x3b')](_0x5ebe93,{'showHidden':![],'depth':null}));}}});}exports['start']=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 8db693c..0b30b39 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 _0x6a90=['YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','join','update','system','timeout'];(function(_0x15caaa,_0x862b61){var _0x169244=function(_0x163798){while(--_0x163798){_0x15caaa['push'](_0x15caaa['shift']());}};_0x169244(++_0x862b61);}(_0x6a90,0x99));var _0x06a9=function(_0x42c32a,_0x1ea57b){_0x42c32a=_0x42c32a-0x0;var _0x264c90=_0x6a90[_0x42c32a];return _0x264c90;};'use strict';var _=require('lodash');var moment=require(_0x06a9('0x0'));var Redis=require(_0x06a9('0x1'));var util=require(_0x06a9('0x2'));var config=require(_0x06a9('0x3'));var db=require(_0x06a9('0x4'))['db'];var logger=require('../logger')(_0x06a9('0x5'));config[_0x06a9('0x6')]=_[_0x06a9('0x7')](config[_0x06a9('0x6')],{'host':_0x06a9('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x2a05f7=[];return db[_0x06a9('0x9')][_0x06a9('0xa')]({'raw':!![],'attributes':['id',_0x06a9('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x06a9('0xc')](0x18,_0x06a9('0xd'))}}})[_0x06a9('0xe')](function(_0xa82195){if(_0xa82195&&_0xa82195[_0x06a9('0xf')]){_0x2a05f7=_[_0x06a9('0x10')](_0xa82195||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2a05f7[_0x06a9('0x11')]());return db[_0x06a9('0x9')][_0x06a9('0x12')]({'closeReason':_0x06a9('0x13'),'disposition':_0x06a9('0x14'),'closed':!![],'closedAt':moment()['format'](_0x06a9('0x15'))},{'where':{'id':_0x2a05f7}});}})[_0x06a9('0xe')](function(){if(_0x2a05f7&&_0x2a05f7[_0x06a9('0xf')]){logger[_0x06a9('0x16')](_0x06a9('0x17'),_0x2a05f7[_0x06a9('0x11')]());for(var _0x48c3ae=0x0;_0x48c3ae<_0x2a05f7[_0x06a9('0xf')];_0x48c3ae++){io[_0x06a9('0x18')](_0x06a9('0x19'),{'id':_0x2a05f7[_0x48c3ae],'closed':!![]});}}})[_0x06a9('0x1a')](function(_0x16b4bd){logger[_0x06a9('0x1b')](_0x06a9('0x1c'),_0x16b4bd?util['inspect'](_0x16b4bd,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf242=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0xf242,0x17b));var _0x2f24=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0xf242[_0x2ecb67];return _0x168079;};'use strict';var _=require(_0x2f24('0x0'));var moment=require(_0x2f24('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x2f24('0x2'));var db=require(_0x2f24('0x3'))['db'];var logger=require(_0x2f24('0x4'))(_0x2f24('0x5'));config[_0x2f24('0x6')]=_[_0x2f24('0x7')](config[_0x2f24('0x6')],{'host':_0x2f24('0x8'),'port':0x18eb});var io=require(_0x2f24('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x49397f=[];return db['WhatsappInteraction'][_0x2f24('0xa')]({'raw':!![],'attributes':['id',_0x2f24('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x2f24('0xc')](0x18,'hours')}}})[_0x2f24('0xd')](function(_0x3351b1){if(_0x3351b1&&_0x3351b1[_0x2f24('0xe')]){_0x49397f=_[_0x2f24('0xf')](_0x3351b1||[],'id');logger[_0x2f24('0x10')](_0x2f24('0x11'),_0x49397f[_0x2f24('0x12')]());return db[_0x2f24('0x13')][_0x2f24('0x14')]({'closeReason':_0x2f24('0x15'),'disposition':_0x2f24('0x16'),'closed':!![],'closedAt':moment()[_0x2f24('0x17')](_0x2f24('0x18'))},{'where':{'id':_0x49397f}});}})['then'](function(){if(_0x49397f&&_0x49397f['length']){logger[_0x2f24('0x10')](_0x2f24('0x19'),_0x49397f[_0x2f24('0x12')]());for(var _0x1f8aff=0x0;_0x1f8aff<_0x49397f[_0x2f24('0xe')];_0x1f8aff++){io['emit'](_0x2f24('0x1a'),{'id':_0x49397f[_0x1f8aff],'closed':!![]});}}})[_0x2f24('0x1b')](function(_0x4a6f92){logger[_0x2f24('0x1c')](_0x2f24('0x1d'),_0x4a6f92?util[_0x2f24('0x1e')](_0x4a6f92,{'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 67a7892..22dc66d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa750=['bulkCreate','log','hopper1','hopper2','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','@xcally.com','CmContact','destroy','then','finished\x20populating','contacts1','CmHopper'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa750,0xf2));var _0x0a75=function(_0x428524,_0x202629){_0x428524=_0x428524-0x0;var _0x3031cc=_0xa750[_0x428524];return _0x3031cc;};'use strict';var util=require('util');var db=require(_0x0a75('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0a75('0x1')+i,'lastName':_0x0a75('0x2')+i,'phone':0xf879fb460+i,'email':_0x0a75('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0a75('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0a75('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a75('0x5')](),'updatedAt':Date[_0x0a75('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x0a75('0x1')+i,'lastName':_0x0a75('0x2')+i,'phone':0xf879fb460+i,'email':_0x0a75('0x3')+i+_0x0a75('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0a75('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0a75('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0a75('0x5')]()});}db[_0x0a75('0x7')][_0x0a75('0x8')]({'where':{}})[_0x0a75('0x9')](function(){return db[_0x0a75('0x7')]['bulkCreate'](contacts);})[_0x0a75('0x9')](function(){console['log'](_0x0a75('0xa'),_0x0a75('0xb'));return db[_0x0a75('0xc')][_0x0a75('0x8')]({'where':{}});})[_0x0a75('0x9')](function(){return db[_0x0a75('0xc')][_0x0a75('0xd')](hopper);})['then'](function(){console[_0x0a75('0xe')]('finished\x20populating',_0x0a75('0xf'));return db[_0x0a75('0x7')]['bulkCreate'](contacts2);})[_0x0a75('0x9')](function(){console[_0x0a75('0xe')](_0x0a75('0xa'),'contacts2');return db[_0x0a75('0xc')][_0x0a75('0xd')](hopper2);})['then'](function(){console[_0x0a75('0xe')](_0x0a75('0xa'),_0x0a75('0x10'));})['catch'](function(_0x1cdfce){console[_0x0a75('0xe')](_0x1cdfce);}); \ No newline at end of file +var _0x9914=['catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x9914,0x78));var _0x4991=function(_0x3ceb6a,_0x57fdfc){_0x3ceb6a=_0x3ceb6a-0x0;var _0x3c30e5=_0x9914[_0x3ceb6a];return _0x3c30e5;};'use strict';var util=require(_0x4991('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4991('0x1')]({'id':i,'firstName':_0x4991('0x2')+i,'lastName':_0x4991('0x3')+i,'phone':0xf879fb460+i,'email':_0x4991('0x4')+i+_0x4991('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x4991('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4991('0x6')](),'updatedAt':Date[_0x4991('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x4991('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x4991('0x4')+i+_0x4991('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4991('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4991('0x6')]()});}db[_0x4991('0x7')][_0x4991('0x8')]({'where':{}})[_0x4991('0x9')](function(){return db[_0x4991('0x7')]['bulkCreate'](contacts);})[_0x4991('0x9')](function(){console[_0x4991('0xa')]('finished\x20populating','contacts1');return db['CmHopper'][_0x4991('0x8')]({'where':{}});})[_0x4991('0x9')](function(){return db[_0x4991('0xb')][_0x4991('0xc')](hopper);})[_0x4991('0x9')](function(){console['log'](_0x4991('0xd'),_0x4991('0xe'));return db[_0x4991('0x7')]['bulkCreate'](contacts2);})['then'](function(){console[_0x4991('0xa')](_0x4991('0xd'),_0x4991('0xf'));return db[_0x4991('0xb')]['bulkCreate'](hopper2);})[_0x4991('0x9')](function(){console['log']('finished\x20populating','hopper2');})[_0x4991('0x10')](function(_0x4944cf){console[_0x4991('0xa')](_0x4944cf);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index cece267..73fab68 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5ec=['catch','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','add\x20user'];(function(_0x407e26,_0x1cc7c8){var _0x3d4b68=function(_0x250516){while(--_0x250516){_0x407e26['push'](_0x407e26['shift']());}};_0x3d4b68(++_0x1cc7c8);}(_0xf5ec,0x1a3));var _0xcf5e=function(_0x54d21d,_0x5e53a6){_0x54d21d=_0x54d21d-0x0;var _0x4cea4b=_0xf5ec[_0x54d21d];return _0x4cea4b;};'use strict';var util=require(_0xcf5e('0x0'));var db=require(_0xcf5e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcf5e('0x2')]({'name':util['format'](_0xcf5e('0x3'),'agent',i),'fullname':util['format'](_0xcf5e('0x3'),_0xcf5e('0x4'),i),'email':util[_0xcf5e('0x5')](_0xcf5e('0x6'),_0xcf5e('0x4'),i),'role':_0xcf5e('0x4'),'password':_0xcf5e('0x7'),'internal':0xfa0+i,'type':_0xcf5e('0x8'),'transport':[_0xcf5e('0x9'),'ws',_0xcf5e('0xa')],'disallow':[_0xcf5e('0xb')],'allow':[_0xcf5e('0xc')],'defaultuser':util[_0xcf5e('0x5')](_0xcf5e('0x3'),'agent',i),'encryption':'yes','avpf':_0xcf5e('0xd'),'force_avp':_0xcf5e('0xd'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xcf5e('0xe'),'dtlsprivatekey':_0xcf5e('0xf'),'dtlssetup':_0xcf5e('0x10'),'callerid':util['format'](_0xcf5e('0x11'),util[_0xcf5e('0x5')](_0xcf5e('0x3'),'agent',i),0xfa0+i)});}db[_0xcf5e('0x12')]['bulkCreate'](users)[_0xcf5e('0x13')](function(){console['log'](_0xcf5e('0x14'));})[_0xcf5e('0x15')](function(_0x238fe0){console['log'](_0x238fe0);}); \ No newline at end of file +var _0xd4c5=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push'];(function(_0x11765b,_0x59fab7){var _0x5e651e=function(_0x48f17d){while(--_0x48f17d){_0x11765b['push'](_0x11765b['shift']());}};_0x5e651e(++_0x59fab7);}(_0xd4c5,0x7b));var _0x5d4c=function(_0x1c662c,_0xe699f3){_0x1c662c=_0x1c662c-0x0;var _0x107edf=_0xd4c5[_0x1c662c];return _0x107edf;};'use strict';var util=require(_0x5d4c('0x0'));var db=require(_0x5d4c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5d4c('0x2')]({'name':util[_0x5d4c('0x3')](_0x5d4c('0x4'),_0x5d4c('0x5'),i),'fullname':util['format'](_0x5d4c('0x4'),_0x5d4c('0x5'),i),'email':util[_0x5d4c('0x3')](_0x5d4c('0x6'),_0x5d4c('0x5'),i),'role':'agent','password':_0x5d4c('0x7'),'internal':0xfa0+i,'type':_0x5d4c('0x8'),'transport':[_0x5d4c('0x9'),'ws',_0x5d4c('0xa')],'disallow':[_0x5d4c('0xb')],'allow':[_0x5d4c('0xc')],'defaultuser':util[_0x5d4c('0x3')]('%s%s',_0x5d4c('0x5'),i),'encryption':_0x5d4c('0xd'),'avpf':'yes','force_avp':_0x5d4c('0xd'),'icesupport':_0x5d4c('0xd'),'dtlsenable':_0x5d4c('0xd'),'dtlsverify':'no','dtlscertfile':_0x5d4c('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x5d4c('0x3')](_0x5d4c('0xf'),util['format']('%s%s','agent',i),0xfa0+i)});}db['User'][_0x5d4c('0x10')](users)[_0x5d4c('0x11')](function(){console['log'](_0x5d4c('0x12'));})[_0x5d4c('0x13')](function(_0x282751){console[_0x5d4c('0x14')](_0x282751);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 16e16f1..91c00dd 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed5c=['leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','setMaxListeners','address','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','Campaign','format','length','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','ChatQueues','ChatQueue','FaxQueue','MailQueues','WhatsappQueues','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s'];(function(_0x384bee,_0x2aa995){var _0x31a9cd=function(_0x4bc49c){while(--_0x4bc49c){_0x384bee['push'](_0x384bee['shift']());}};_0x31a9cd(++_0x2aa995);}(_0xed5c,0x81));var _0xced5=function(_0x51777d,_0x1d2caf){_0x51777d=_0x51777d-0x0;var _0x39d87a=_0xed5c[_0x51777d];return _0x39d87a;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var BPromise=require(_0xced5('0x2'));var db=require(_0xced5('0x3'))['db'];var config=require(_0xced5('0x4'));var queryQueues={'attributes':['id',_0xced5('0x5')],'include':[{'as':_0xced5('0x6'),'model':db[_0xced5('0x7')],'attributes':['id',_0xced5('0x5'),_0xced5('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xced5('0x5')],'where':{'role':_0xced5('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xced5('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xced5('0x5'),_0xced5('0xb')],'where':{'type':_0xced5('0xc')}};function getAssociatedResources(_0x36f59d,_0x56d986,_0x50d620){return db[_0xced5('0xd')][_0xced5('0xe')]({'where':{'name':_0x36f59d,'userProfileId':_0x56d986},'raw':!![]})[_0xced5('0xf')](function(_0x10fd53){if(_0x10fd53){if(_0x10fd53['autoAssociation']){switch(_0x36f59d){case _0xced5('0x10'):case'ChatQueues':case _0xced5('0x11'):case _0xced5('0x12'):case'MailQueues':case _0xced5('0x13'):case'WhatsappQueues':return db[_0x50d620][_0xced5('0x14')](queryQueues);case _0xced5('0x15'):return db[_0x50d620][_0xced5('0x14')](queryTelephones);case _0xced5('0x16'):return db[_0x50d620][_0xced5('0x14')](queryTrunks);case _0xced5('0x17'):return db[_0x50d620][_0xced5('0x14')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xced5('0x18')],'where':{'sectionId':_0x10fd53['id']},'raw':!![]})[_0xced5('0xf')](function(_0x2f4e9a){if(_0x2f4e9a){var _0x5e5346={'where':{'id':_['map'](_0x2f4e9a,_0xced5('0x18'))},'raw':!![]};switch(_0x50d620){case _0xced5('0x7'):_0x5e5346[_0xced5('0x19')][_0xced5('0x8')]=_0xced5('0x9');break;case _0xced5('0x1a'):_0x5e5346['where'][_0xced5('0xb')]=_0xced5('0xc');break;}return db[_0x50d620]['findAll'](_0x5e5346);}else{return[];}});}}else{return[];}})[_0xced5('0xf')](function(_0x2fb40e){return _0x2fb40e;});}function joinOrLeaveQueues(_0x14e3ec,_0x521901,_0x127eb4,_0x353071){_0x14e3ec[_0x521901](util[_0xced5('0x1b')]('%s:queue:%s',_0x127eb4,_0x353071[_0xced5('0x5')]));if(_0x353071[_0xced5('0x6')]){for(var _0xf84ec=0x0;_0xf84ec<_0x353071[_0xced5('0x6')][_0xced5('0x1c')];_0xf84ec+=0x1){_0x14e3ec[_0x521901](util[_0xced5('0x1b')]('user:%s',_0x353071[_0xced5('0x6')][_0xf84ec][_0xced5('0x5')]));}}}function joinOrLeave(_0x1c0f6c,_0x5b11c5,_0x4495c6){var _0x18f299;if(_0x1c0f6c[_0xced5('0x1d')][_0xced5('0x1e')]['id']){db[_0xced5('0x7')][_0xced5('0x1f')]({'attributes':['id',_0xced5('0x5'),_0xced5('0x8'),_0xced5('0x20')],'where':{'id':_0x1c0f6c[_0xced5('0x1d')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xced5('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xced5('0x22')],'as':_0xced5('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xced5('0x24')],'as':_0xced5('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xced5('0x26')],'as':_0xced5('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xced5('0x28')],'as':_0xced5('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xced5('0x2a')],'as':_0xced5('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x20aa83){if(_0x20aa83){_0x18f299=_0x20aa83;_0x1c0f6c[_0x5b11c5](util[_0xced5('0x1b')]('user:%s',_0x20aa83['name']));var _0x499040=[];switch(_0x20aa83['role']){case _0xced5('0x2c'):_0x1c0f6c[_0x5b11c5](_0xced5('0x2d'));_0x1c0f6c[_0x5b11c5](_0xced5('0x2e'));if(queryQueues[_0xced5('0x2f')](_0xced5('0x30'))){delete queryQueues['include'];}_0x499040[_0xced5('0x31')](db['VoiceQueue'][_0xced5('0x14')](queryQueues));_0x499040[_0xced5('0x31')](db['ChatQueue']['findAll'](queryQueues));_0x499040[_0xced5('0x31')](db['FaxQueue'][_0xced5('0x14')](queryQueues));_0x499040[_0xced5('0x31')](db[_0xced5('0x32')][_0xced5('0x14')](queryQueues));_0x499040[_0xced5('0x31')](db[_0xced5('0x33')][_0xced5('0x14')](queryQueues));_0x499040['push'](db[_0xced5('0x34')][_0xced5('0x14')](queryQueues));_0x499040['push'](db[_0xced5('0x35')][_0xced5('0x14')](queryQueues));_0x499040['push'](db[_0xced5('0x7')][_0xced5('0x14')](queryTelephones));_0x499040['push'](db[_0xced5('0x36')]['findAll'](queryTrunks));_0x499040[_0xced5('0x31')](db['Campaign'][_0xced5('0x14')](queryCampaigns));_0x499040[_0xced5('0x31')](db['User']['findAll'](queryAgents));break;case _0xced5('0x37'):_0x1c0f6c[_0x5b11c5](_0xced5('0x2d'));_0x1c0f6c[_0x5b11c5]('voice:outbound');_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x10'),_0x20aa83['userProfileId'],_0xced5('0x38')));_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x39'),_0x20aa83['userProfileId'],_0xced5('0x3a')));_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x11'),_0x20aa83['userProfileId'],_0xced5('0x3b')));_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x12'),_0x20aa83['userProfileId'],_0xced5('0x32')));_0x499040['push'](getAssociatedResources(_0xced5('0x3c'),_0x20aa83[_0xced5('0x20')],_0xced5('0x33')));_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x13'),_0x20aa83[_0xced5('0x20')],_0xced5('0x34')));_0x499040['push'](getAssociatedResources(_0xced5('0x3d'),_0x20aa83[_0xced5('0x20')],_0xced5('0x35')));_0x499040['push'](getAssociatedResources(_0xced5('0x15'),_0x20aa83['userProfileId'],_0xced5('0x7')));_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x16'),_0x20aa83[_0xced5('0x20')],_0xced5('0x36')));_0x499040[_0xced5('0x31')](getAssociatedResources(_0xced5('0x17'),_0x20aa83['userProfileId'],_0xced5('0x1a')));_0x499040['push'](db[_0xced5('0x7')][_0xced5('0x14')](queryAgents));break;case'agent':_0x1c0f6c[_0x5b11c5](_0xced5('0x2d'));_0x1c0f6c[_0x5b11c5](_0xced5('0x2e'));_0x499040[_0xced5('0x31')](_0x20aa83[_0xced5('0x3e')]({'attributes':['id',_0xced5('0x5')]}));_0x499040['push'](_0x20aa83['getChatQueues']({'attributes':['id',_0xced5('0x5')]}));_0x499040['push'](_0x20aa83[_0xced5('0x3f')]({'attributes':['id',_0xced5('0x5')]}));_0x499040[_0xced5('0x31')](_0x20aa83[_0xced5('0x40')]({'attributes':['id',_0xced5('0x5')]}));_0x499040[_0xced5('0x31')](_0x20aa83[_0xced5('0x41')]({'attributes':['id',_0xced5('0x5')]}));_0x499040['push'](_0x20aa83['getOpenchannelQueues']({'attributes':['id',_0xced5('0x5')]}));_0x499040[_0xced5('0x31')](_0x20aa83[_0xced5('0x42')]({'attributes':['id',_0xced5('0x5')]}));break;}return BPromise[_0xced5('0x43')](_0x499040);}})[_0xced5('0xf')](function(_0x1539a2){if(_0x1539a2&&_0x1539a2[_0xced5('0x1c')]){for(var _0x1cab90=0x0;_0x1cab90<_0x1539a2[_0xced5('0x1c')];_0x1cab90+=0x1){for(var _0x41df31=0x0;_0x41df31<_0x1539a2[_0x1cab90][_0xced5('0x1c')];_0x41df31+=0x1){switch(_0x1cab90){case 0x0:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,'voice',_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x1:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,_0xced5('0x44'),_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x2:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,_0xced5('0x45'),_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x3:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,_0xced5('0x46'),_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x4:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,_0xced5('0x47'),_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x5:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,_0xced5('0x48'),_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x6:joinOrLeaveQueues(_0x1c0f6c,_0x5b11c5,_0xced5('0x49'),_0x1539a2[_0x1cab90][_0x41df31]);break;case 0x7:if(_0x18f299['role']!==_0xced5('0xa'))_0x1c0f6c[_0x5b11c5](util[_0xced5('0x1b')](_0xced5('0x4a'),_0x1539a2[_0x1cab90][_0x41df31][_0xced5('0x5')]));break;case 0x8:if(_0x18f299[_0xced5('0x8')]!==_0xced5('0xa'))_0x1c0f6c[_0x5b11c5](util[_0xced5('0x1b')](_0xced5('0x4b'),_0x1539a2[_0x1cab90][_0x41df31]['name']));break;case 0x9:if(_0x18f299[_0xced5('0x8')]!==_0xced5('0xa'))_0x1c0f6c[_0x5b11c5](util[_0xced5('0x1b')](_0xced5('0x4c'),_0x1539a2[_0x1cab90][_0x41df31][_0xced5('0xb')],_0x1539a2[_0x1cab90][_0x41df31][_0xced5('0x5')]));break;case 0xa:_0x1c0f6c[_0x5b11c5](util['format']('user:%s',_0x1539a2[_0x1cab90][_0x41df31][_0xced5('0x5')]));break;}}}}})['then'](function(){if(_0x5b11c5===_0xced5('0x4d')){var _0x555f44=_[_0xced5('0x4e')](_0x18f299['ChatInteractions'],'id');return _0x18f299[_0xced5('0x4f')](_0x555f44)[_0xced5('0xf')](function(){for(var _0x29a962=0x0;_0x29a962<_0x555f44[_0xced5('0x1c')];_0x29a962+=0x1){_0x4495c6[_0xced5('0x50')](_0xced5('0x51'),{'ChatInteractionId':Number(_0x555f44[_0x29a962]),'UserId':Number(_0x18f299['id'])});}});}})[_0xced5('0xf')](function(){if(_0x5b11c5===_0xced5('0x4d')){var _0x56af57=_[_0xced5('0x4e')](_0x18f299['MailInteractions'],'id');return _0x18f299[_0xced5('0x52')](_0x56af57)[_0xced5('0xf')](function(){for(var _0x4a47bb=0x0;_0x4a47bb<_0x56af57[_0xced5('0x1c')];_0x4a47bb+=0x1){_0x4495c6['emit'](_0xced5('0x53'),{'MailInteractionId':Number(_0x56af57[_0x4a47bb]),'UserId':Number(_0x18f299['id'])});}});}})[_0xced5('0xf')](function(){if(_0x5b11c5===_0xced5('0x4d')){var _0x320be5=_['map'](_0x18f299[_0xced5('0x25')],'id');return _0x18f299[_0xced5('0x54')](_0x320be5)[_0xced5('0xf')](function(){for(var _0x3f14ca=0x0;_0x3f14ca<_0x320be5[_0xced5('0x1c')];_0x3f14ca+=0x1){_0x4495c6['emit'](_0xced5('0x55'),{'FaxInteractionId':Number(_0x320be5[_0x3f14ca]),'UserId':Number(_0x18f299['id'])});}});}})[_0xced5('0xf')](function(){if(_0x5b11c5===_0xced5('0x4d')){var _0x25827d=_[_0xced5('0x4e')](_0x18f299[_0xced5('0x27')],'id');return _0x18f299[_0xced5('0x56')](_0x25827d)[_0xced5('0xf')](function(){for(var _0x30d172=0x0;_0x30d172<_0x25827d[_0xced5('0x1c')];_0x30d172+=0x1){_0x4495c6[_0xced5('0x50')](_0xced5('0x57'),{'SmsInteractionId':Number(_0x25827d[_0x30d172]),'UserId':Number(_0x18f299['id'])});}});}})[_0xced5('0xf')](function(){if(_0x5b11c5===_0xced5('0x4d')){var _0x1bf0bc=_[_0xced5('0x4e')](_0x18f299[_0xced5('0x29')],'id');return _0x18f299['removeOpenchannelInteractions'](_0x1bf0bc)[_0xced5('0xf')](function(){for(var _0x11f019=0x0;_0x11f019<_0x1bf0bc[_0xced5('0x1c')];_0x11f019+=0x1){_0x4495c6[_0xced5('0x50')](_0xced5('0x58'),{'OpenchannelInteractionId':Number(_0x1bf0bc[_0x11f019]),'UserId':Number(_0x18f299['id'])});}});}})[_0xced5('0xf')](function(){if(_0x5b11c5==='leave'){var _0x41af91=_['map'](_0x18f299[_0xced5('0x2b')],'id');return _0x18f299[_0xced5('0x59')](_0x41af91)[_0xced5('0xf')](function(){for(var _0x10a518=0x0;_0x10a518<_0x41af91[_0xced5('0x1c')];_0x10a518+=0x1){_0x4495c6[_0xced5('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x41af91[_0x10a518]),'UserId':Number(_0x18f299['id'])});}});}})[_0xced5('0x5a')](function(_0x1a8b69){_0x1c0f6c['log'](_0x1a8b69);});}}function onDisconnect(_0x1ea332,_0x4ebbeb){joinOrLeave(_0x1ea332,'leave',_0x4ebbeb);}function onConnect(_0x12b107){joinOrLeave(_0x12b107,_0xced5('0x5b'));}exports[_0xced5('0x5c')]=function(_0x2b754b){_0x2b754b['on']('connection',function(_0x2259d2){_0x2259d2[_0xced5('0x5d')](0x0);_0x2259d2[_0xced5('0x5e')]=_0x2259d2['request'][_0xced5('0x5f')][_0xced5('0x60')]+':'+_0x2259d2['request']['connection'][_0xced5('0x61')];_0x2259d2[_0xced5('0x62')]=new Date();_0x2259d2['log']=function(_0x5ad4fa){console[_0xced5('0x63')](_0xced5('0x64')+_0x2259d2[_0xced5('0x65')]['name']+'['+_0x2259d2['address']+']',_0x5ad4fa);};_0x2259d2['on']('disconnect',function(){onDisconnect(_0x2259d2,_0x2b754b);_0x2259d2[_0xced5('0x63')]('DISCONNECTED');});onConnect(_0x2259d2);_0x2259d2[_0xced5('0x63')](_0xced5('0x66'));});}; \ No newline at end of file +var _0x9e2e=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','User','name','role','agent','telephone','type','ivr','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','ChatQueue','FaxQueue','MailQueues','OpenchannelQueue','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions'];(function(_0x3ebbd2,_0x18293c){var _0x5cc1ba=function(_0x3ccace){while(--_0x3ccace){_0x3ebbd2['push'](_0x3ebbd2['shift']());}};_0x5cc1ba(++_0x18293c);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x45fee6,_0x301890){_0x45fee6=_0x45fee6-0x0;var _0x3e5629=_0x9e2e[_0x45fee6];return _0x3e5629;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var BPromise=require(_0xe9e2('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xe9e2('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xe9e2('0x4')],'attributes':['id',_0xe9e2('0x5'),_0xe9e2('0x6')],'raw':!![],'where':{'role':_0xe9e2('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe9e2('0x5')],'where':{'role':_0xe9e2('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe9e2('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe9e2('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe9e2('0x9')],'where':{'type':_0xe9e2('0xa')}};function getAssociatedResources(_0x58a008,_0x3a171b,_0x48882a){return db['UserProfileSection'][_0xe9e2('0xb')]({'where':{'name':_0x58a008,'userProfileId':_0x3a171b},'raw':!![]})[_0xe9e2('0xc')](function(_0x56264f){if(_0x56264f){if(_0x56264f['autoAssociation']){switch(_0x58a008){case _0xe9e2('0xd'):case _0xe9e2('0xe'):case _0xe9e2('0xf'):case _0xe9e2('0x10'):case'MailQueues':case'OpenchannelQueues':case _0xe9e2('0x11'):return db[_0x48882a][_0xe9e2('0x12')](queryQueues);case _0xe9e2('0x13'):return db[_0x48882a][_0xe9e2('0x12')](queryTelephones);case _0xe9e2('0x14'):return db[_0x48882a][_0xe9e2('0x12')](queryTrunks);case _0xe9e2('0x15'):return db[_0x48882a][_0xe9e2('0x12')](queryCampaigns);}}else{return db[_0xe9e2('0x16')][_0xe9e2('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x56264f['id']},'raw':!![]})['then'](function(_0x117e38){if(_0x117e38){var _0x590974={'where':{'id':_['map'](_0x117e38,_0xe9e2('0x17'))},'raw':!![]};switch(_0x48882a){case _0xe9e2('0x4'):_0x590974[_0xe9e2('0x18')][_0xe9e2('0x6')]=_0xe9e2('0x8');break;case _0xe9e2('0x19'):_0x590974['where'][_0xe9e2('0x9')]=_0xe9e2('0xa');break;}return db[_0x48882a][_0xe9e2('0x12')](_0x590974);}else{return[];}});}}else{return[];}})['then'](function(_0x36a67d){return _0x36a67d;});}function joinOrLeaveQueues(_0x2e7fd0,_0x20dfcd,_0x4e10cd,_0x2c09aa){_0x2e7fd0[_0x20dfcd](util[_0xe9e2('0x1a')](_0xe9e2('0x1b'),_0x4e10cd,_0x2c09aa['name']));if(_0x2c09aa[_0xe9e2('0x1c')]){for(var _0x36c8a3=0x0;_0x36c8a3<_0x2c09aa[_0xe9e2('0x1c')][_0xe9e2('0x1d')];_0x36c8a3+=0x1){_0x2e7fd0[_0x20dfcd](util['format'](_0xe9e2('0x1e'),_0x2c09aa[_0xe9e2('0x1c')][_0x36c8a3][_0xe9e2('0x5')]));}}}function joinOrLeave(_0x2f1901,_0x38fb40,_0x518328){var _0x26ce3d;if(_0x2f1901[_0xe9e2('0x1f')][_0xe9e2('0x20')]['id']){db[_0xe9e2('0x4')][_0xe9e2('0x21')]({'attributes':['id',_0xe9e2('0x5'),_0xe9e2('0x6'),_0xe9e2('0x22')],'where':{'id':_0x2f1901[_0xe9e2('0x1f')][_0xe9e2('0x20')]['id']},'include':[{'model':db[_0xe9e2('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe9e2('0x24')],'as':_0xe9e2('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe9e2('0x26')],'as':_0xe9e2('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xe9e2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xe9e2('0x29')],'as':_0xe9e2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xe9e2('0x2b')],'as':_0xe9e2('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x4cf43f){if(_0x4cf43f){_0x26ce3d=_0x4cf43f;_0x2f1901[_0x38fb40](util[_0xe9e2('0x1a')](_0xe9e2('0x1e'),_0x4cf43f[_0xe9e2('0x5')]));var _0x39e7c5=[];switch(_0x4cf43f[_0xe9e2('0x6')]){case _0xe9e2('0x2d'):_0x2f1901[_0x38fb40](_0xe9e2('0x2e'));_0x2f1901[_0x38fb40](_0xe9e2('0x2f'));if(queryQueues[_0xe9e2('0x30')](_0xe9e2('0x31'))){delete queryQueues[_0xe9e2('0x31')];}_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x33')][_0xe9e2('0x12')](queryQueues));_0x39e7c5['push'](db['ChatQueue'][_0xe9e2('0x12')](queryQueues));_0x39e7c5[_0xe9e2('0x32')](db['FaxQueue'][_0xe9e2('0x12')](queryQueues));_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x34')]['findAll'](queryQueues));_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x35')][_0xe9e2('0x12')](queryQueues));_0x39e7c5[_0xe9e2('0x32')](db['OpenchannelQueue'][_0xe9e2('0x12')](queryQueues));_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x36')]['findAll'](queryQueues));_0x39e7c5['push'](db[_0xe9e2('0x4')][_0xe9e2('0x12')](queryTelephones));_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x37')][_0xe9e2('0x12')](queryTrunks));_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x19')]['findAll'](queryCampaigns));_0x39e7c5['push'](db[_0xe9e2('0x4')]['findAll'](queryAgents));break;case _0xe9e2('0x38'):_0x2f1901[_0x38fb40](_0xe9e2('0x2e'));_0x2f1901[_0x38fb40]('voice:outbound');_0x39e7c5[_0xe9e2('0x32')](getAssociatedResources(_0xe9e2('0xd'),_0x4cf43f['userProfileId'],_0xe9e2('0x33')));_0x39e7c5[_0xe9e2('0x32')](getAssociatedResources('ChatQueues',_0x4cf43f['userProfileId'],_0xe9e2('0x39')));_0x39e7c5[_0xe9e2('0x32')](getAssociatedResources(_0xe9e2('0xf'),_0x4cf43f['userProfileId'],_0xe9e2('0x3a')));_0x39e7c5['push'](getAssociatedResources(_0xe9e2('0x10'),_0x4cf43f[_0xe9e2('0x22')],_0xe9e2('0x34')));_0x39e7c5[_0xe9e2('0x32')](getAssociatedResources(_0xe9e2('0x3b'),_0x4cf43f[_0xe9e2('0x22')],_0xe9e2('0x35')));_0x39e7c5[_0xe9e2('0x32')](getAssociatedResources('OpenchannelQueues',_0x4cf43f['userProfileId'],_0xe9e2('0x3c')));_0x39e7c5[_0xe9e2('0x32')](getAssociatedResources(_0xe9e2('0x11'),_0x4cf43f[_0xe9e2('0x22')],_0xe9e2('0x36')));_0x39e7c5['push'](getAssociatedResources(_0xe9e2('0x13'),_0x4cf43f['userProfileId'],_0xe9e2('0x4')));_0x39e7c5['push'](getAssociatedResources(_0xe9e2('0x14'),_0x4cf43f[_0xe9e2('0x22')],_0xe9e2('0x37')));_0x39e7c5['push'](getAssociatedResources(_0xe9e2('0x15'),_0x4cf43f[_0xe9e2('0x22')],_0xe9e2('0x19')));_0x39e7c5[_0xe9e2('0x32')](db[_0xe9e2('0x4')][_0xe9e2('0x12')](queryAgents));break;case'agent':_0x2f1901[_0x38fb40]('voice:inbound');_0x2f1901[_0x38fb40](_0xe9e2('0x2f'));_0x39e7c5[_0xe9e2('0x32')](_0x4cf43f[_0xe9e2('0x3d')]({'attributes':['id',_0xe9e2('0x5')]}));_0x39e7c5[_0xe9e2('0x32')](_0x4cf43f[_0xe9e2('0x3e')]({'attributes':['id','name']}));_0x39e7c5[_0xe9e2('0x32')](_0x4cf43f['getFaxQueues']({'attributes':['id','name']}));_0x39e7c5[_0xe9e2('0x32')](_0x4cf43f[_0xe9e2('0x3f')]({'attributes':['id','name']}));_0x39e7c5['push'](_0x4cf43f[_0xe9e2('0x40')]({'attributes':['id',_0xe9e2('0x5')]}));_0x39e7c5['push'](_0x4cf43f['getOpenchannelQueues']({'attributes':['id',_0xe9e2('0x5')]}));_0x39e7c5[_0xe9e2('0x32')](_0x4cf43f[_0xe9e2('0x41')]({'attributes':['id',_0xe9e2('0x5')]}));break;}return BPromise[_0xe9e2('0x42')](_0x39e7c5);}})['then'](function(_0xffdf05){if(_0xffdf05&&_0xffdf05[_0xe9e2('0x1d')]){for(var _0x131022=0x0;_0x131022<_0xffdf05[_0xe9e2('0x1d')];_0x131022+=0x1){for(var _0x54294a=0x0;_0x54294a<_0xffdf05[_0x131022][_0xe9e2('0x1d')];_0x54294a+=0x1){switch(_0x131022){case 0x0:joinOrLeaveQueues(_0x2f1901,_0x38fb40,_0xe9e2('0x43'),_0xffdf05[_0x131022][_0x54294a]);break;case 0x1:joinOrLeaveQueues(_0x2f1901,_0x38fb40,'chat',_0xffdf05[_0x131022][_0x54294a]);break;case 0x2:joinOrLeaveQueues(_0x2f1901,_0x38fb40,'fax',_0xffdf05[_0x131022][_0x54294a]);break;case 0x3:joinOrLeaveQueues(_0x2f1901,_0x38fb40,_0xe9e2('0x44'),_0xffdf05[_0x131022][_0x54294a]);break;case 0x4:joinOrLeaveQueues(_0x2f1901,_0x38fb40,_0xe9e2('0x45'),_0xffdf05[_0x131022][_0x54294a]);break;case 0x5:joinOrLeaveQueues(_0x2f1901,_0x38fb40,_0xe9e2('0x46'),_0xffdf05[_0x131022][_0x54294a]);break;case 0x6:joinOrLeaveQueues(_0x2f1901,_0x38fb40,_0xe9e2('0x47'),_0xffdf05[_0x131022][_0x54294a]);break;case 0x7:if(_0x26ce3d[_0xe9e2('0x6')]!=='agent')_0x2f1901[_0x38fb40](util[_0xe9e2('0x1a')](_0xe9e2('0x48'),_0xffdf05[_0x131022][_0x54294a][_0xe9e2('0x5')]));break;case 0x8:if(_0x26ce3d[_0xe9e2('0x6')]!==_0xe9e2('0x7'))_0x2f1901[_0x38fb40](util['format']('trunk:%s',_0xffdf05[_0x131022][_0x54294a][_0xe9e2('0x5')]));break;case 0x9:if(_0x26ce3d[_0xe9e2('0x6')]!==_0xe9e2('0x7'))_0x2f1901[_0x38fb40](util['format'](_0xe9e2('0x49'),_0xffdf05[_0x131022][_0x54294a][_0xe9e2('0x9')],_0xffdf05[_0x131022][_0x54294a][_0xe9e2('0x5')]));break;case 0xa:_0x2f1901[_0x38fb40](util['format'](_0xe9e2('0x1e'),_0xffdf05[_0x131022][_0x54294a][_0xe9e2('0x5')]));break;}}}}})[_0xe9e2('0xc')](function(){if(_0x38fb40===_0xe9e2('0x4a')){var _0x517eca=_[_0xe9e2('0x4b')](_0x26ce3d[_0xe9e2('0x4c')],'id');return _0x26ce3d[_0xe9e2('0x4d')](_0x517eca)[_0xe9e2('0xc')](function(){for(var _0x419ee0=0x0;_0x419ee0<_0x517eca[_0xe9e2('0x1d')];_0x419ee0+=0x1){_0x518328['emit'](_0xe9e2('0x4e'),{'ChatInteractionId':Number(_0x517eca[_0x419ee0]),'UserId':Number(_0x26ce3d['id'])});}});}})[_0xe9e2('0xc')](function(){if(_0x38fb40===_0xe9e2('0x4a')){var _0x695eaa=_[_0xe9e2('0x4b')](_0x26ce3d['MailInteractions'],'id');return _0x26ce3d[_0xe9e2('0x4f')](_0x695eaa)[_0xe9e2('0xc')](function(){for(var _0x1a0d41=0x0;_0x1a0d41<_0x695eaa[_0xe9e2('0x1d')];_0x1a0d41+=0x1){_0x518328[_0xe9e2('0x50')](_0xe9e2('0x51'),{'MailInteractionId':Number(_0x695eaa[_0x1a0d41]),'UserId':Number(_0x26ce3d['id'])});}});}})['then'](function(){if(_0x38fb40==='leave'){var _0x318147=_['map'](_0x26ce3d[_0xe9e2('0x27')],'id');return _0x26ce3d[_0xe9e2('0x52')](_0x318147)[_0xe9e2('0xc')](function(){for(var _0x3109b5=0x0;_0x3109b5<_0x318147[_0xe9e2('0x1d')];_0x3109b5+=0x1){_0x518328['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x318147[_0x3109b5]),'UserId':Number(_0x26ce3d['id'])});}});}})[_0xe9e2('0xc')](function(){if(_0x38fb40===_0xe9e2('0x4a')){var _0x53d09e=_[_0xe9e2('0x4b')](_0x26ce3d[_0xe9e2('0x28')],'id');return _0x26ce3d[_0xe9e2('0x53')](_0x53d09e)[_0xe9e2('0xc')](function(){for(var _0x4616cc=0x0;_0x4616cc<_0x53d09e[_0xe9e2('0x1d')];_0x4616cc+=0x1){_0x518328[_0xe9e2('0x50')](_0xe9e2('0x54'),{'SmsInteractionId':Number(_0x53d09e[_0x4616cc]),'UserId':Number(_0x26ce3d['id'])});}});}})[_0xe9e2('0xc')](function(){if(_0x38fb40===_0xe9e2('0x4a')){var _0x1091cc=_['map'](_0x26ce3d['OpenchannelInteractions'],'id');return _0x26ce3d[_0xe9e2('0x55')](_0x1091cc)[_0xe9e2('0xc')](function(){for(var _0x309d3d=0x0;_0x309d3d<_0x1091cc[_0xe9e2('0x1d')];_0x309d3d+=0x1){_0x518328[_0xe9e2('0x50')](_0xe9e2('0x56'),{'OpenchannelInteractionId':Number(_0x1091cc[_0x309d3d]),'UserId':Number(_0x26ce3d['id'])});}});}})[_0xe9e2('0xc')](function(){if(_0x38fb40==='leave'){var _0x1b8e80=_[_0xe9e2('0x4b')](_0x26ce3d[_0xe9e2('0x2c')],'id');return _0x26ce3d[_0xe9e2('0x57')](_0x1b8e80)[_0xe9e2('0xc')](function(){for(var _0x5db4bb=0x0;_0x5db4bb<_0x1b8e80[_0xe9e2('0x1d')];_0x5db4bb+=0x1){_0x518328[_0xe9e2('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1b8e80[_0x5db4bb]),'UserId':Number(_0x26ce3d['id'])});}});}})['catch'](function(_0x40af0a){_0x2f1901[_0xe9e2('0x58')](_0x40af0a);});}}function onDisconnect(_0x4f2098,_0x2cc106){joinOrLeave(_0x4f2098,_0xe9e2('0x4a'),_0x2cc106);}function onConnect(_0x55dc8a){joinOrLeave(_0x55dc8a,_0xe9e2('0x59'));}exports['default']=function(_0x1319cd){_0x1319cd['on'](_0xe9e2('0x5a'),function(_0x364b22){_0x364b22[_0xe9e2('0x5b')](0x0);_0x364b22[_0xe9e2('0x5c')]=_0x364b22[_0xe9e2('0x5d')][_0xe9e2('0x5a')][_0xe9e2('0x5e')]+':'+_0x364b22[_0xe9e2('0x5d')][_0xe9e2('0x5a')]['remotePort'];_0x364b22[_0xe9e2('0x5f')]=new Date();_0x364b22['log']=function(_0x2b32cb){console[_0xe9e2('0x58')](_0xe9e2('0x60')+_0x364b22[_0xe9e2('0x61')][_0xe9e2('0x5')]+'['+_0x364b22[_0xe9e2('0x5c')]+']',_0x2b32cb);};_0x364b22['on']('disconnect',function(){onDisconnect(_0x364b22,_0x1319cd);_0x364b22['log'](_0xe9e2('0x62'));});onConnect(_0x364b22);_0x364b22[_0xe9e2('0x58')](_0xe9e2('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 2dd8064..cee258a 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 _0x17fe=['client','http','ChatInteraction','afterCreate','newinteraction','Chat','closedinteraction','ChatMessage','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','afterUpdate','WhatsappMessage','Fax','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','Trigger,\x20%s','error','code','EventManager','catch','get','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','then','UserId','interface','format','SIP/%s','name','incomingmessage','AfterCreateMessage','motionChannel','opened','SELECT','contact','agent','changed','substatus','closed','QueryTypes','AfterUpdate','find','fullname','email','internal','length','hasOwnProperty','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers'];(function(_0x20bf8f,_0x823d88){var _0x1ae1a1=function(_0x898014){while(--_0x898014){_0x20bf8f['push'](_0x20bf8f['shift']());}};_0x1ae1a1(++_0x823d88);}(_0x17fe,0x164));var _0xe17f=function(_0x55ee5b,_0x517f52){_0x55ee5b=_0x55ee5b-0x0;var _0x286d19=_0x17fe[_0x55ee5b];return _0x286d19;};'use strict';var util=require(_0xe17f('0x0'));var db=require(_0xe17f('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xe17f('0x2'))(_0xe17f('0x3'));var client=jayson[_0xe17f('0x4')][_0xe17f('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xe17f('0x6'),'event':_0xe17f('0x7'),'condition':_0xe17f('0x8'),'callback':afterCreate},{'channel':_0xe17f('0x9'),'model':_0xe17f('0x6'),'event':'afterUpdate','condition':_0xe17f('0xa'),'callback':afterUpdate},{'channel':_0xe17f('0x9'),'model':_0xe17f('0xb'),'event':'afterCreate','condition':_0xe17f('0xc'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xe17f('0xd'),'event':'afterCreate','condition':_0xe17f('0x8'),'callback':afterCreate},{'channel':_0xe17f('0xe'),'model':_0xe17f('0xd'),'event':'afterUpdate','condition':_0xe17f('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0xe17f('0xf'),'event':_0xe17f('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe17f('0x10'),'model':_0xe17f('0x11'),'event':'afterCreate','condition':_0xe17f('0x8'),'callback':afterCreate},{'channel':_0xe17f('0x10'),'model':_0xe17f('0x11'),'event':_0xe17f('0x12'),'condition':_0xe17f('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xe17f('0x13'),'event':_0xe17f('0x7'),'condition':_0xe17f('0xc'),'callback':afterCreateMessage},{'channel':_0xe17f('0x14'),'model':'FaxInteraction','event':_0xe17f('0x7'),'condition':_0xe17f('0x8'),'callback':afterCreate},{'channel':_0xe17f('0x14'),'model':'FaxInteraction','event':_0xe17f('0x12'),'condition':_0xe17f('0xa'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0xe17f('0x7'),'condition':_0xe17f('0xc'),'callback':afterCreateMessage},{'channel':_0xe17f('0x15'),'model':'MailInteraction','event':_0xe17f('0x7'),'condition':_0xe17f('0x8'),'callback':afterCreate},{'channel':_0xe17f('0x15'),'model':_0xe17f('0x16'),'event':_0xe17f('0x12'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe17f('0x15'),'model':_0xe17f('0x17'),'event':_0xe17f('0x7'),'condition':_0xe17f('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xe17f('0x18'),'event':_0xe17f('0x7'),'condition':_0xe17f('0x8'),'callback':afterCreate},{'channel':_0xe17f('0x19'),'model':_0xe17f('0x18'),'event':_0xe17f('0x12'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe17f('0x19'),'model':_0xe17f('0x1a'),'event':'afterCreate','condition':_0xe17f('0xc'),'callback':afterCreateMessage}];function request(_0x3349f9){return client[_0xe17f('0x1b')]('EventManager',_0x3349f9)['then'](function(_0x374795){logger['info'](_0xe17f('0x1c'),'EventManager',_0x374795);if(_0x374795[_0xe17f('0x1d')]){if(_0x374795[_0xe17f('0x1d')][_0xe17f('0x1e')]===0x1f4){logger[_0xe17f('0x1d')](_0xe17f('0x1c'),_0xe17f('0x1f'),_0x374795[_0xe17f('0x1d')]);}}})[_0xe17f('0x20')](function(_0x2ef300){logger[_0xe17f('0x1d')](_0xe17f('0x1c'),'EventManager',_0x2ef300);});}function afterCreateMessage(_0x22b789){return function(_0x4d76fa){_0x4d76fa=_0x4d76fa[_0xe17f('0x21')]({'plain':!![]});_0x4d76fa[_0xe17f('0x22')]=_0x22b789;_0x4d76fa['motionChannel']=_0x22b789;_0x4d76fa[_0xe17f('0x23')]=_0x4d76fa[_0xe17f('0x24')];Promise[_0xe17f('0x25')]()['then'](function(){if(typeof _0x4d76fa[_0xe17f('0x26')]===_0xe17f('0x27'))return null;var _0x4a68d1=_0xe17f('0x28')+_0x4d76fa[_0xe17f('0x26')];return db[_0xe17f('0x29')][_0xe17f('0x2a')](_0x4a68d1,{'type':db[_0xe17f('0x2b')]['QueryTypes']['SELECT'],'raw':!![]});})[_0xe17f('0x2c')](function(_0x27dc25){if(_0x27dc25){_0x4d76fa['contact']=_0x27dc25[0x0];}if(typeof _0x4d76fa[_0xe17f('0x2d')]===_0xe17f('0x27'))return;return getAgent(_0x4d76fa['UserId']);})[_0xe17f('0x2c')](function(_0x364da4){if(_0x364da4){_0x4d76fa[_0xe17f('0x2e')]=util[_0xe17f('0x2f')](_0xe17f('0x30'),_0x364da4[_0xe17f('0x31')]);_0x4d76fa['agent']=_0x364da4;_0x4d76fa[_0xe17f('0x22')]=_0x22b789;return request({'event':_0xe17f('0x32'),'message':_0x4d76fa});}else{return request({'event':'outgoingmessage','message':_0x4d76fa});}})[_0xe17f('0x20')](function(_0x334a74){logger[_0xe17f('0x1d')](_0xe17f('0x1c'),_0xe17f('0x33'),_0x334a74);});};}function afterCreate(_0x370ccf,_0x4ccfd9){return function(_0x249109){_0x249109=_0x249109['get']({'plain':!![]});_0x249109[_0xe17f('0x22')]=_0x370ccf;_0x249109[_0xe17f('0x34')]=_0x370ccf;_0x249109['event']=_0xe17f('0x35');Promise['resolve']()[_0xe17f('0x2c')](function(){var _0x120d02=_0xe17f('0x28')+_0x249109['ContactId'];return db[_0xe17f('0x29')]['query'](_0x120d02,{'type':db['Sequelize']['QueryTypes'][_0xe17f('0x36')],'raw':!![]});})[_0xe17f('0x2c')](function(_0x2ca361){if(_0x2ca361){_0x249109[_0xe17f('0x37')]=_0x2ca361[0x0];}if(typeof _0x249109[_0xe17f('0x2d')]===_0xe17f('0x27'))return;return getAgent(_0x249109[_0xe17f('0x2d')]);})[_0xe17f('0x2c')](function(_0xd809c2){if(_0xd809c2){_0x249109[_0xe17f('0x2e')]=util['format'](_0xe17f('0x30'),_0xd809c2[_0xe17f('0x31')]);_0x249109[_0xe17f('0x38')]=_0xd809c2;}return request({'event':_0x4ccfd9,'message':_0x249109});})[_0xe17f('0x20')](function(_0x48f15){logger[_0xe17f('0x1d')](_0xe17f('0x1c'),'AfterCreate',_0x48f15);});};}function afterUpdate(_0x1076fd){return function(_0x592dde){var _0x4ffaba=_0x592dde[_0xe17f('0x39')]('closed')&&_0x592dde['closed'];var _0x389140=_0x592dde[_0xe17f('0x39')]('substatus');if(_0x4ffaba||_0x389140){var _0x3e1f2a=_0x4ffaba?'closedinteraction':_0xe17f('0x3a');var _0x2abe1=_0x592dde[_0xe17f('0x21')]({'plain':!![]});_0x2abe1['channel']=_0x1076fd;_0x2abe1['motionChannel']=_0x1076fd;_0x2abe1['event']=_0x4ffaba?_0xe17f('0x3b'):_0xe17f('0x3a');var _0x4fd67e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2abe1[_0xe17f('0x26')];return db[_0xe17f('0x29')][_0xe17f('0x2a')](_0x4fd67e,{'type':db[_0xe17f('0x2b')][_0xe17f('0x3c')][_0xe17f('0x36')],'raw':!![]})['then'](function(_0x2977ab){if(_0x2977ab){_0x2abe1[_0xe17f('0x37')]=_0x2977ab[0x0];}if(typeof _0x2abe1['UserId']===_0xe17f('0x27'))return;return getAgent(_0x2abe1[_0xe17f('0x2d')]);})[_0xe17f('0x2c')](function(_0x4bcb5e){if(_0x4bcb5e){_0x2abe1[_0xe17f('0x2e')]=util['format'](_0xe17f('0x30'),_0x4bcb5e['name']);_0x2abe1['agent']=_0x4bcb5e;}return request({'event':_0x3e1f2a,'message':_0x2abe1});})[_0xe17f('0x20')](function(_0x34c00a){logger[_0xe17f('0x1d')](_0xe17f('0x1c'),_0xe17f('0x3d'),_0x34c00a);});}};}function getAgent(_0x2f0e2e){return db['User'][_0xe17f('0x3e')]({'where':{'id':_0x2f0e2e},'attributes':['id',_0xe17f('0x31'),_0xe17f('0x3f'),_0xe17f('0x40'),_0xe17f('0x41')],'raw':!![]})['then'](function(_0x284623){return _0x284623;});}exports['default']=function(){for(var _0x4a2dac=0x0;_0x4a2dac=_0x5b188f[_0xea3d('0x13')]){throw Error(_0xea3d('0x14'));}_0x63db97(_0x6ff3bb);})[_0xea3d('0x15')](function(_0x1a1795){_0x42cfb9(_0x1a1795);});});}; \ No newline at end of file +var _0x5441=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','./license/util','voice','mail','chat','fax','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','getLicense','role','agent','User','count'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x5441,0x1e7));var _0x1544=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x5441[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x1544('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x1544('0x1'));var channels=[_0x1544('0x2'),_0x1544('0x3'),_0x1544('0x4'),_0x1544('0x5'),'sms','whatsapp','openchannel'];exports[_0x1544('0x6')]=function(){return channels;};exports[_0x1544('0x7')]=function(_0x330fd3){_0x330fd3=_0x330fd3[_0x1544('0x8')]();return _['includes'](channels,_0x330fd3);};exports[_0x1544('0x9')]=function(_0x5998b9,_0x815927,_0x18d895,_0x2ee3e4){var _0x1e6e4a={'loginAttempts':_0x815927,'blocked':_0x18d895};if(!_[_0x1544('0xa')](_0x2ee3e4)){_0x1e6e4a[_0x1544('0xb')]=_0x2ee3e4;}return _0x5998b9['updateAttributes'](_0x1e6e4a);};exports[_0x1544('0xc')]=function(_0x74a4e7){return new BPromise(function(_0x25a9da,_0x4733ad){var _0x59ab72=0x0;if(_0x74a4e7[_0x1544('0xd')]!==_0x1544('0xe')){_0x25a9da(_0x74a4e7);}db[_0x1544('0xf')][_0x1544('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x74a4e7['id']}}})[_0x1544('0x11')](function(_0x48a7db){_0x59ab72=_0x48a7db;return util[_0x1544('0xc')]();})['then'](function(_0x4df9f0){if(_0x4df9f0&&_0x4df9f0[_0x1544('0x12')]&&_0x59ab72>=_0x4df9f0[_0x1544('0x12')]){throw Error(_0x1544('0x13'));}_0x25a9da(_0x74a4e7);})[_0x1544('0x14')](function(_0x3cc1f7){_0x4733ad(_0x3cc1f7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ae69e17..33f0be3 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddb4=['404','render','json','send','exports'];(function(_0x2744d4,_0xc14f4c){var _0x2c045c=function(_0x5f5a01){while(--_0x5f5a01){_0x2744d4['push'](_0x2744d4['shift']());}};_0x2c045c(++_0xc14f4c);}(_0xddb4,0x162));var _0x4ddb=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0xddb4[_0x509273];return _0x38ef40;};'use strict';module[_0x4ddb('0x0')][0x194]=function pageNotFound(_0x221804,_0x3e212a){var _0x3a6aef=_0x4ddb('0x1');var _0x15a2cc=0x194;var _0x31487f={'status':_0x15a2cc};_0x3e212a['status'](_0x31487f['status']);_0x3e212a[_0x4ddb('0x2')](_0x3a6aef,{},function(_0x2150e2,_0x4a0113){if(_0x2150e2){return _0x3e212a['status'](_0x31487f['status'])[_0x4ddb('0x3')](_0x31487f);}_0x3e212a[_0x4ddb('0x4')](_0x4a0113);});}; \ No newline at end of file +var _0x3870=['json','send','exports','404','status','render'];(function(_0x393564,_0x26a572){var _0x3c38f1=function(_0x5b32ab){while(--_0x5b32ab){_0x393564['push'](_0x393564['shift']());}};_0x3c38f1(++_0x26a572);}(_0x3870,0x146));var _0x0387=function(_0x194260,_0x4ed8f1){_0x194260=_0x194260-0x0;var _0x4dcdb9=_0x3870[_0x194260];return _0x4dcdb9;};'use strict';module[_0x0387('0x0')][0x194]=function pageNotFound(_0x3c5d8e,_0x2a67ee){var _0x4ef6bd=_0x0387('0x1');var _0x58b02a=0x194;var _0x310701={'status':_0x58b02a};_0x2a67ee[_0x0387('0x2')](_0x310701['status']);_0x2a67ee[_0x0387('0x3')](_0x4ef6bd,{},function(_0x3a7166,_0x136ccc){if(_0x3a7166){return _0x2a67ee['status'](_0x310701[_0x0387('0x2')])[_0x0387('0x4')](_0x310701);}_0x2a67ee[_0x0387('0x5')](_0x136ccc);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 46d8940..7c71bdb 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['user_has_whatsapp_interactions','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueue','SmsQueues','WhatsappQueue','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessionReport','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','AgentReports','uniqueid','Contact','ContactId','Imap','Dispositions','MailAccountId','Answers','Interactions','List','ListId','TemplateId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','MailMessage','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','Dashboard','Items','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Automation','OneAny','AutomationId','ParentId','Intervals','MailApplications','SmsApplications','Schedule','AnalyticDefaultReport','DefaultReportId','CustomReportId','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Description','Field','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','Subject','SubjectId','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','VoiceQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','UserVoicePrefix','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','mysql','name','database','username','password','options','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../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','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','cascade','VoiceRecording','Recordings','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions'];(function(_0x5e9fd1,_0x2238b8){var _0x4a7df9=function(_0x3e89fa){while(--_0x3e89fa){_0x5e9fd1['push'](_0x5e9fd1['shift']());}};_0x4a7df9(++_0x2238b8);}(_0xb688,0xcf));var _0x8b68=function(_0x2db101,_0x530163){_0x2db101=_0x2db101-0x0;var _0x3abdcb=_0xb688[_0x2db101];return _0x3abdcb;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x8b68('0x0'));var _=require(_0x8b68('0x1'));var jstz=require(_0x8b68('0x2'));var timezone=jstz[_0x8b68('0x3')]();config[_0x8b68('0x0')]=_[_0x8b68('0x4')](config['sequelize'],{'database':_0x8b68('0x5'),'username':_0x8b68('0x6'),'password':_0x8b68('0x7'),'options':{'host':_0x8b68('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8b68('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8b68('0xa'),'collate':_0x8b68('0xb')}}});config[_0x8b68('0xc')]=_[_0x8b68('0x4')](config[_0x8b68('0xc')],{'database':_0x8b68('0x5'),'username':_0x8b68('0x6'),'password':_0x8b68('0x7'),'options':{'host':_0x8b68('0x8'),'port':0xcea,'dialect':_0x8b68('0xd'),'dialectOptions':{'charset':_0x8b68('0x9')},'logging':![],'timezone':timezone[_0x8b68('0xe')](),'define':{'charset':_0x8b68('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b68('0x0')][_0x8b68('0xf')],config[_0x8b68('0x0')][_0x8b68('0x10')],config[_0x8b68('0x0')][_0x8b68('0x11')],config[_0x8b68('0x0')][_0x8b68('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b68('0xc')]['database'],config[_0x8b68('0xc')]['username'],config['sequelizeHistory'][_0x8b68('0x11')],config[_0x8b68('0xc')][_0x8b68('0x12')])};db['User']=db['sequelize'][_0x8b68('0x13')]('../api/user/user.model');db[_0x8b68('0x14')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x15'));db['VoiceContext']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/voiceContext/voiceContext.model');db[_0x8b68('0x16')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x17'));db[_0x8b68('0x18')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x19'));db[_0x8b68('0x1a')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x1b'));db['VoiceRecording']=db['sequelize'][_0x8b68('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x8b68('0x1c')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x1d'));db[_0x8b68('0x1e')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x1f'));db[_0x8b68('0x20')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x21'));db[_0x8b68('0x22')]=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x8b68('0x23')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x8b68('0x24')]=db['sequelize']['import'](_0x8b68('0x25'));db['VoiceQueueReport']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x26'));db[_0x8b68('0x27')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x28'));db['VoiceTransferReport']=db[_0x8b68('0x0')]['import'](_0x8b68('0x29'));db[_0x8b68('0x2a')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x2b'));db[_0x8b68('0x2c')]=db['sequelize']['import'](_0x8b68('0x2d'));db[_0x8b68('0x2e')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x2f'));db[_0x8b68('0x30')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x31'));db[_0x8b68('0x32')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x33'));db[_0x8b68('0x34')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x35'));db[_0x8b68('0x36')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x37'));db[_0x8b68('0x38')]=db['sequelize']['import'](_0x8b68('0x39'));db[_0x8b68('0x3a')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x3b'));db[_0x8b68('0x3c')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x8b68('0x3d')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x3e'));db[_0x8b68('0x3f')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x40'));db['MailSubstatus']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x41'));db[_0x8b68('0x42')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x43'));db['MailMessage']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/mailMessage/mailMessage.model');db[_0x8b68('0x44')]=db[_0x8b68('0x0')]['import']('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x45'));db['Dashboard']=db[_0x8b68('0x0')]['import'](_0x8b68('0x46'));db[_0x8b68('0x47')]=db['sequelize'][_0x8b68('0x13')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x48'));db[_0x8b68('0x49')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x4a'));db['FaxInteraction']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x8b68('0x4b')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x4c'));db['FaxQueue']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x4d'));db[_0x8b68('0x4e')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x4f'));db[_0x8b68('0x50')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x51'));db[_0x8b68('0x52')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x53'));db[_0x8b68('0x54')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x55'));db['SmsMessage']=db[_0x8b68('0x0')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x56'));db[_0x8b68('0x57')]=db['sequelize']['import'](_0x8b68('0x58'));db[_0x8b68('0x59')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x5a'));db[_0x8b68('0x5b')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x5c'));db['OpenchannelMessage']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x8b68('0x5d')]=db[_0x8b68('0x0')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x5e'));db[_0x8b68('0x5f')]=db['sequelize']['import'](_0x8b68('0x60'));db[_0x8b68('0x61')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x62'));db[_0x8b68('0x63')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x64'));db['ChatMessage']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/chatMessage/chatMessage.model');db[_0x8b68('0x65')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x66'));db[_0x8b68('0x67')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x68'));db[_0x8b68('0x69')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x6a'));db[_0x8b68('0x6b')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x6c'));db[_0x8b68('0x6d')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x6e'));db[_0x8b68('0x6f')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x70'));db[_0x8b68('0x71')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x72'));db[_0x8b68('0x73')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x74'));db[_0x8b68('0x75')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8b68('0x76')]=db['sequelize']['import'](_0x8b68('0x77'));db['ReportAgentPreview']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x78'));db['CmCustomField']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x79'));db[_0x8b68('0x7a')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x7b'));db['Automation']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x7c'));db[_0x8b68('0x7d')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x7e'));db[_0x8b68('0x7f')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x80'));db[_0x8b68('0x81')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x82'));db[_0x8b68('0x83')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x84'));db['Pause']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x85'));db['Cdr']=db['sequelize']['import'](_0x8b68('0x86'));db[_0x8b68('0x87')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x88'));db['Schedule']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/schedule/schedule.model');db[_0x8b68('0x89')]=db['sequelize']['import']('../api/sound/sound.model');db[_0x8b68('0x8a')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x8b'));db[_0x8b68('0x8c')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x8d'));db[_0x8b68('0x8e')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x8f'));db[_0x8b68('0x90')]=db[_0x8b68('0x0')]['import']('../api/variable/variable.model');db[_0x8b68('0x91')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x92'));db[_0x8b68('0x93')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/integrationReport/integrationReport.model');db[_0x8b68('0x94')]=db['sequelize']['import'](_0x8b68('0x95'));db['AnalyticDefaultReport']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x8b68('0x96')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x97'));db[_0x8b68('0x98')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x99'));db[_0x8b68('0x9a')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x8b68('0x0')]['import'](_0x8b68('0x9b'));db[_0x8b68('0x9c')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x9d'));db[_0x8b68('0x9e')]=db[_0x8b68('0x0')]['import'](_0x8b68('0x9f'));db['SalesforceField']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xa0'));db['SugarcrmAccount']=db[_0x8b68('0x0')]['import'](_0x8b68('0xa1'));db['SugarcrmConfiguration']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xa2'));db['SugarcrmField']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xa3'));db[_0x8b68('0xa4')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xa5'));db[_0x8b68('0xa6')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xa7'));db[_0x8b68('0xa8')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xa9'));db['ZohoAccount']=db[_0x8b68('0x0')]['import'](_0x8b68('0xaa'));db[_0x8b68('0xab')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xac'));db[_0x8b68('0xad')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xae'));db[_0x8b68('0xaf')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xb0'));db['ZendeskConfiguration']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xb1'));db['ZendeskField']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xb2'));db[_0x8b68('0xb3')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xb4'));db[_0x8b68('0xb5')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xb6'));db['FreshdeskField']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xb7'));db[_0x8b68('0xb8')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x8b68('0xb9')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xba'));db['VtigerField']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xbb'));db[_0x8b68('0xbc')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xbd'));db[_0x8b68('0xbe')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xbf'));db[_0x8b68('0xc0')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xc1'));db[_0x8b68('0xc2')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xc3'));db[_0x8b68('0xc4')]=db['sequelize'][_0x8b68('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x8b68('0xc5')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xc6'));db[_0x8b68('0xc7')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xc8'));db['FreshsalesConfiguration']=db['sequelize']['import'](_0x8b68('0xc9'));db[_0x8b68('0xca')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xcb'));db[_0x8b68('0x91')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x92'));db[_0x8b68('0xcc')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xcd'));db[_0x8b68('0xce')]=db[_0x8b68('0x0')]['import']('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xcf'));db[_0x8b68('0xd0')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xd1'));db['JscriptyQuestionReport']=db[_0x8b68('0x0')]['import'](_0x8b68('0xd2'));db['JscriptySessionReport']=db[_0x8b68('0x0')]['import'](_0x8b68('0xd3'));db[_0x8b68('0xd4')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xd5'));db['SquareReport']=db[_0x8b68('0x0')]['import'](_0x8b68('0xd6'));db['SquareDetailsReport']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xd7'));db[_0x8b68('0xd8')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xd9'));db['Setting']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xda'));db[_0x8b68('0xdb')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xdc'));db[_0x8b68('0xdd')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xde'));db[_0x8b68('0xdf')]=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/squareRecording/squareRecording.model');db[_0x8b68('0xe0')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xe1'));db[_0x8b68('0xe2')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xe3'));db[_0x8b68('0xe4')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xe5'));db[_0x8b68('0xe6')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xe7'));db['Migration']=db[_0x8b68('0x0')]['import']('../api/migration/migration.model');db['Attachment']=db[_0x8b68('0x0')][_0x8b68('0x13')]('../api/attachment/attachment.model');db[_0x8b68('0xe8')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xe9'));db[_0x8b68('0xea')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xeb'));db[_0x8b68('0xec')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xed'));db[_0x8b68('0xee')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xef'));db['OpenchannelTransferReport']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xf0'));db[_0x8b68('0xf1')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xf2'));db[_0x8b68('0xf3')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xf4'));db['VoicePrefix']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xf5'));db['UserProfile']=db[_0x8b68('0x0')]['import'](_0x8b68('0xf6'));db[_0x8b68('0xf7')]=db[_0x8b68('0x0')]['import'](_0x8b68('0xf8'));db['UserProfileResource']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xf9'));db[_0x8b68('0xfa')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xfb'));db[_0x8b68('0xfc')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0xfd'));db[_0x8b68('0xfe')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0xff'));db[_0x8b68('0x100')]=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x101'));db['WhatsappMessage']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x102'));db['WhatsappQueueReport']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x103'));db[_0x8b68('0x104')]=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x105'));db['WhatsappQueue']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x106'));db['CloudProvider']=db['sequelize'][_0x8b68('0x13')](_0x8b68('0x107'));db[_0x8b68('0x108')]=db['sequelize']['import'](_0x8b68('0x109'));db[_0x8b68('0x10a')]=db[_0x8b68('0x0')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x8b68('0x0')][_0x8b68('0x13')](_0x8b68('0x10b'));db[_0x8b68('0x10c')][_0x8b68('0x10d')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x8b68('0x10e'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x8b68('0x10f')],{'as':_0x8b68('0x110'),'foreignKey':_0x8b68('0x111')});db['User'][_0x8b68('0x112')](db['UserVoiceQueueRt'],{'as':_0x8b68('0x113'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x16')],{'as':_0x8b68('0x114'),'onDelete':_0x8b68('0x10e'),'hooks':!![]});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x75')],{'as':_0x8b68('0x115'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x76')],{'as':_0x8b68('0x116'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db['ReportAgentPreview'],{'as':_0x8b68('0x117'),'foreignKey':'UserId'});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x5b')],{'as':_0x8b68('0x118'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x63')],{'as':_0x8b68('0x119'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db['SmsInteraction'],{'as':_0x8b68('0x11a'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x11b')],{'as':_0x8b68('0x11c'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x42')],{'as':_0x8b68('0x11d'),'foreignKey':'UserId'});db[_0x8b68('0x10c')][_0x8b68('0x112')](db[_0x8b68('0x100')],{'as':_0x8b68('0x11e'),'foreignKey':_0x8b68('0x111')});db['User'][_0x8b68('0x112')](db[_0x8b68('0xfa')],{'as':'UserNotifications','foreignKey':_0x8b68('0x11f')});db[_0x8b68('0x10c')]['belongsTo'](db['UserProfile'],{'as':_0x8b68('0x120'),'foreignKey':_0x8b68('0x121')});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x69')],{'as':_0x8b68('0x123'),'through':_0x8b68('0x124')});db[_0x8b68('0x10c')]['belongsToMany'](db[_0x8b68('0x6f')],{'as':_0x8b68('0x125'),'through':_0x8b68('0x126')});db[_0x8b68('0x10c')]['belongsToMany'](db[_0x8b68('0xf3')],{'as':'Lists','through':_0x8b68('0x127')});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0xe2')],{'through':_0x8b68('0x128')});db[_0x8b68('0x10c')]['belongsToMany'](db['MailInteraction'],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User'][_0x8b68('0x122')](db[_0x8b68('0x63')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x8b68('0x10c')][_0x8b68('0x122')](db['FaxInteraction'],{'as':_0x8b68('0x11c'),'through':_0x8b68('0x129')});db['User']['belongsToMany'](db[_0x8b68('0x54')],{'as':_0x8b68('0x11a'),'through':_0x8b68('0x12a')});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x5b')],{'as':_0x8b68('0x118'),'through':_0x8b68('0x12b')});db['User'][_0x8b68('0x122')](db[_0x8b68('0x100')],{'as':_0x8b68('0x11e'),'through':_0x8b68('0x12c')});db[_0x8b68('0x10c')]['belongsToMany'](db[_0x8b68('0x1a')],{'as':'VoiceQueues','through':_0x8b68('0x2c'),'required':![]});db['User'][_0x8b68('0x122')](db[_0x8b68('0x12d')],{'as':_0x8b68('0x12e'),'through':'UserVoicePrefix','required':![]});db[_0x8b68('0x10c')]['belongsToMany'](db[_0x8b68('0x3f')],{'as':_0x8b68('0x12f'),'through':_0x8b68('0x30'),'required':![]});db[_0x8b68('0x10c')]['belongsToMany'](db[_0x8b68('0x67')],{'as':_0x8b68('0x130'),'through':_0x8b68('0x2e'),'required':![],'hooks':!![]});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x131')],{'as':_0x8b68('0x132'),'through':_0x8b68('0x32'),'required':![]});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x133')],{'as':_0x8b68('0x134'),'through':_0x8b68('0x34'),'required':![]});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x5d')],{'as':'OpenchannelQueues','through':_0x8b68('0x36'),'required':![]});db['User'][_0x8b68('0x122')](db[_0x8b68('0x135')],{'as':_0x8b68('0x136'),'through':_0x8b68('0x38'),'required':![]});db[_0x8b68('0x10c')][_0x8b68('0x122')](db['CmList'],{'through':'cm_user_has_lists'});db['User'][_0x8b68('0x122')](db[_0x8b68('0x137')],{'as':_0x8b68('0x138'),'through':_0x8b68('0x139')});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x13a')],{'as':_0x8b68('0x13b'),'through':_0x8b68('0x13c')});db[_0x8b68('0x10c')]['belongsToMany'](db['MailAccount'],{'as':_0x8b68('0x13d'),'through':'user_has_mail_accounts'});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0x57')],{'as':_0x8b68('0x13e'),'through':_0x8b68('0x13f')});db[_0x8b68('0x10c')][_0x8b68('0x122')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x8b68('0x140')});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0xfc')],{'as':_0x8b68('0x141'),'through':'user_has_whatsapp_accounts'});db[_0x8b68('0x10c')][_0x8b68('0x122')](db[_0x8b68('0xdd')],{'as':_0x8b68('0x142'),'through':_0x8b68('0x143')});db['VoiceChanSpy'][_0x8b68('0x112')](db[_0x8b68('0x16')],{'as':_0x8b68('0x144'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x145')});db['VoiceContext'][_0x8b68('0x112')](db['VoiceExtension'],{'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x16')]['hasMany'](db[_0x8b68('0x16')],{'as':_0x8b68('0x146'),'onDelete':_0x8b68('0x10e')});db['VoiceMusicOnHold'][_0x8b68('0x122')](db[_0x8b68('0x89')],{'as':'Sounds','through':_0x8b68('0x147')});db['VoiceQueue'][_0x8b68('0x112')](db[_0x8b68('0x2a')],{'as':_0x8b68('0x148'),'foreignKey':_0x8b68('0x149')});db[_0x8b68('0x1a')][_0x8b68('0x112')](db[_0x8b68('0x71')],{'as':_0x8b68('0x14a'),'foreignKey':_0x8b68('0x149')});db[_0x8b68('0x1a')][_0x8b68('0x112')](db['CmHopperFinal'],{'as':_0x8b68('0x115'),'foreignKey':'VoiceQueueId'});db[_0x8b68('0x1a')][_0x8b68('0x112')](db[_0x8b68('0x76')],{'as':'HopperHistories','foreignKey':_0x8b68('0x149')});db['VoiceQueue'][_0x8b68('0x112')](db[_0x8b68('0x117')],{'as':'ReportAgentPreview','foreignKey':_0x8b68('0x149')});db['VoiceQueue'][_0x8b68('0x112')](db['CmHopperBlack'],{'as':_0x8b68('0x14b'),'foreignKey':_0x8b68('0x149')});db['VoiceQueue'][_0x8b68('0x112')](db[_0x8b68('0x14c')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x8b68('0x14d')](db[_0x8b68('0x27')],{'as':_0x8b68('0x27'),'foreignKey':_0x8b68('0x14e')});db['VoiceQueue'][_0x8b68('0x14d')](db[_0x8b68('0x27')],{'as':_0x8b68('0x14f'),'foreignKey':_0x8b68('0x150')});db[_0x8b68('0x1a')][_0x8b68('0x14d')](db[_0x8b68('0x83')],{'as':_0x8b68('0x83'),'foreignKey':_0x8b68('0x151')});db['VoiceQueue'][_0x8b68('0x14d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8b68('0x1a')][_0x8b68('0x122')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x152'),'through':_0x8b68('0x153')});db[_0x8b68('0x1a')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x2c')});db[_0x8b68('0x1a')][_0x8b68('0x122')](db[_0x8b68('0xe2')],{'as':_0x8b68('0x155'),'through':_0x8b68('0x108')});db[_0x8b68('0x1a')]['belongsToMany'](db[_0x8b68('0xf3')],{'as':_0x8b68('0x156'),'through':_0x8b68('0x157')});db[_0x8b68('0x10f')][_0x8b68('0x14d')](db['User'],{'as':_0x8b68('0x10c'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x1c')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x10c'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x1e')][_0x8b68('0x112')](db[_0x8b68('0x20')],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x8b68('0x20')][_0x8b68('0x14d')](db['VoiceMail'],{'foreignKey':_0x8b68('0x159'),'targetKey':_0x8b68('0x15a')});db[_0x8b68('0x22')][_0x8b68('0x112')](db[_0x8b68('0x15b')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x8b68('0x22')][_0x8b68('0x112')](db['VoiceAgentReport'],{'as':_0x8b68('0x15c'),'foreignKey':_0x8b68('0x15d'),'constraints':![]});db['VoiceCallReport'][_0x8b68('0x14d')](db['User'],{'as':_0x8b68('0x10c'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x22')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x3a')]['belongsTo'](db[_0x8b68('0x3d')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x8b68('0x3c')][_0x8b68('0x14d')](db[_0x8b68('0x3d')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x8b68('0x3d')]['hasOne'](db[_0x8b68('0x3a')],{'as':_0x8b68('0x160'),'onDelete':_0x8b68('0x10e')});db['MailAccount'][_0x8b68('0x10d')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x8b68('0x10e')});db['MailAccount'][_0x8b68('0x112')](db[_0x8b68('0x7f')],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x162'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x3d')][_0x8b68('0x112')](db[_0x8b68('0x7d')],{'as':_0x8b68('0x163'),'foreignKey':_0x8b68('0x162')});db[_0x8b68('0x3d')][_0x8b68('0x112')](db['MailMessage'],{'as':_0x8b68('0x158'),'foreignKey':_0x8b68('0x162')});db[_0x8b68('0x3d')][_0x8b68('0x112')](db[_0x8b68('0x42')],{'as':_0x8b68('0x164')});db['MailAccount'][_0x8b68('0x112')](db[_0x8b68('0x44')],{'as':_0x8b68('0x146')});db[_0x8b68('0x3d')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0x3d')][_0x8b68('0x14d')](db[_0x8b68('0x8c')],{'as':_0x8b68('0x8c'),'foreignKey':_0x8b68('0x167')});db['MailAccount']['belongsTo'](db[_0x8b68('0x168')],{'as':_0x8b68('0x169'),'foreignKey':_0x8b68('0x16a')});db[_0x8b68('0x3d')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x16b')});db[_0x8b68('0x3f')]['belongsToMany'](db['User'],{'as':_0x8b68('0x154'),'through':'UserMailQueue'});db[_0x8b68('0x3f')][_0x8b68('0x122')](db[_0x8b68('0xe2')],{'through':_0x8b68('0x16c'),'as':_0x8b68('0x155')});db[_0x8b68('0x42')][_0x8b68('0x112')](db['MailMessage'],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x16d')});db['MailInteraction'][_0x8b68('0x14d')](db[_0x8b68('0x3d')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x162')});db[_0x8b68('0x42')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db['MailInteraction'][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x16f'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x42')][_0x8b68('0x122')](db['Tag'],{'through':_0x8b68('0x170'),'as':_0x8b68('0x171')});db[_0x8b68('0x42')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':_0x8b68('0x170'),'as':_0x8b68('0x172')});db[_0x8b68('0x42')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'through':'user_has_mail_interactions','foreignKey':_0x8b68('0x16d')});db['MailMessage'][_0x8b68('0x112')](db[_0x8b68('0x174')],{'as':_0x8b68('0x175'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x176')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x10c')});db[_0x8b68('0x176')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x15e')});db[_0x8b68('0x176')][_0x8b68('0x14d')](db[_0x8b68('0x42')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x8b68('0x176')][_0x8b68('0x14d')](db[_0x8b68('0x3d')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x162')});db[_0x8b68('0x176')][_0x8b68('0x14d')](db['ChatWebsite'],{'as':_0x8b68('0x137'),'foreignKey':_0x8b68('0x177')});db[_0x8b68('0x176')][_0x8b68('0x14d')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x8b68('0x178')});db[_0x8b68('0x44')][_0x8b68('0x14d')](db['User'],{'onDelete':'restrict'});db['MailApplication'][_0x8b68('0x14d')](db[_0x8b68('0x3f')],{'onDelete':_0x8b68('0x179')});db['MailApplication']['belongsTo'](db['MailAccount'],{'onDelete':_0x8b68('0x179')});db['MailApplication'][_0x8b68('0x14d')](db[_0x8b68('0x83')],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x151')});db[_0x8b68('0x44')]['belongsTo'](db['Tag'],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x17a')});db['MailQueueReport'][_0x8b68('0x14d')](db['MailAccount'],{});db[_0x8b68('0x17b')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0x17b')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x17b')][_0x8b68('0x14d')](db[_0x8b68('0x42')],{});db[_0x8b68('0x17b')][_0x8b68('0x14d')](db['MailMessage'],{});db[_0x8b68('0x17b')]['belongsTo'](db[_0x8b68('0x10c')],{});db['MailQueueReport'][_0x8b68('0x14d')](db['MailQueue'],{});db[_0x8b68('0x17c')][_0x8b68('0x112')](db[_0x8b68('0x47')],{'as':_0x8b68('0x17d'),'onDelete':'cascade'});db[_0x8b68('0x13a')][_0x8b68('0x112')](db[_0x8b68('0x7f')],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x17e'),'onDelete':'cascade'});db['FaxAccount'][_0x8b68('0x112')](db[_0x8b68('0x7d')],{'as':_0x8b68('0x163'),'foreignKey':_0x8b68('0x17e')});db[_0x8b68('0x13a')][_0x8b68('0x112')](db[_0x8b68('0x11b')],{'as':_0x8b68('0x164')});db['FaxAccount'][_0x8b68('0x112')](db[_0x8b68('0x49')],{'as':'Applications'});db[_0x8b68('0x13a')][_0x8b68('0x112')](db[_0x8b68('0x16')],{'as':'Exntensions','onDelete':_0x8b68('0x10e')});db[_0x8b68('0x13a')][_0x8b68('0x112')](db[_0x8b68('0x4b')],{'as':_0x8b68('0x158')});db[_0x8b68('0x13a')][_0x8b68('0x14d')](db['Trunk'],{'as':_0x8b68('0x27')});db[_0x8b68('0x13a')][_0x8b68('0x14d')](db['CmList'],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0x13a')][_0x8b68('0x14d')](db[_0x8b68('0x168')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8b68('0x13a')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x13c')});db[_0x8b68('0x49')]['belongsTo'](db['User'],{'onDelete':_0x8b68('0x179')});db[_0x8b68('0x49')][_0x8b68('0x14d')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x8b68('0x49')][_0x8b68('0x14d')](db[_0x8b68('0x13a')],{'onDelete':_0x8b68('0x179')});db[_0x8b68('0x49')][_0x8b68('0x14d')](db['Tag'],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x17a')});db['FaxInteraction'][_0x8b68('0x112')](db[_0x8b68('0x4b')],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x17f')});db[_0x8b68('0x11b')][_0x8b68('0x14d')](db[_0x8b68('0x13a')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x17e')});db[_0x8b68('0x11b')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db['FaxInteraction'][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':'Owner','foreignKey':_0x8b68('0x111')});db[_0x8b68('0x11b')]['belongsToMany'](db[_0x8b68('0x8a')],{'through':_0x8b68('0x180'),'as':'Tags'});db[_0x8b68('0x11b')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':_0x8b68('0x180'),'as':_0x8b68('0x172')});db[_0x8b68('0x11b')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'through':_0x8b68('0x129'),'foreignKey':_0x8b68('0x17f')});db[_0x8b68('0x4b')]['belongsTo'](db['User'],{'onDelete':_0x8b68('0x10e'),'as':'User'});db[_0x8b68('0x4b')][_0x8b68('0x14d')](db[_0x8b68('0x11b')],{'as':_0x8b68('0x181'),'foreignKey':_0x8b68('0x17f')});db[_0x8b68('0x4b')]['belongsTo'](db[_0x8b68('0x6f')],{'onDelete':_0x8b68('0x10e'),'as':'Contact'});db[_0x8b68('0x4b')][_0x8b68('0x14d')](db[_0x8b68('0x174')],{'as':_0x8b68('0x174'),'foreignKey':_0x8b68('0x182')});db['FaxMessage'][_0x8b68('0x14d')](db[_0x8b68('0x13a')],{'as':'Account','foreignKey':_0x8b68('0x17e')});db[_0x8b68('0x131')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':'UserFaxQueue'});db[_0x8b68('0x131')][_0x8b68('0x122')](db[_0x8b68('0xe2')],{'through':_0x8b68('0x183'),'as':'Teams'});db[_0x8b68('0x4e')][_0x8b68('0x14d')](db[_0x8b68('0x13a')],{});db[_0x8b68('0x4e')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':'ListId'});db[_0x8b68('0x4e')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b68('0x4e')][_0x8b68('0x14d')](db[_0x8b68('0x11b')],{});db['FaxQueueReport'][_0x8b68('0x14d')](db['FaxMessage'],{});db[_0x8b68('0x4e')]['belongsTo'](db['User'],{});db[_0x8b68('0x4e')]['belongsTo'](db[_0x8b68('0x131')],{});db[_0x8b68('0x50')][_0x8b68('0x112')](db['Disposition'],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x184'),'onDelete':_0x8b68('0x10e')});db['SmsAccount'][_0x8b68('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x8b68('0x184')});db[_0x8b68('0x50')][_0x8b68('0x112')](db[_0x8b68('0x185')],{'as':_0x8b68('0x158'),'foreignKey':_0x8b68('0x184')});db[_0x8b68('0x50')][_0x8b68('0x112')](db[_0x8b68('0x54')],{'as':_0x8b68('0x164')});db[_0x8b68('0x50')]['hasMany'](db[_0x8b68('0x52')],{'as':_0x8b68('0x146')});db['SmsAccount'][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':'ListId'});db[_0x8b68('0x50')][_0x8b68('0x14d')](db[_0x8b68('0x168')],{'as':_0x8b68('0x169'),'foreignKey':_0x8b68('0x16a')});db['SmsAccount'][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x140')});db[_0x8b68('0x52')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'onDelete':_0x8b68('0x179')});db[_0x8b68('0x52')][_0x8b68('0x14d')](db['SmsQueue'],{'onDelete':_0x8b68('0x179')});db['SmsApplication'][_0x8b68('0x14d')](db[_0x8b68('0x50')],{'onDelete':_0x8b68('0x179')});db[_0x8b68('0x52')][_0x8b68('0x14d')](db[_0x8b68('0x83')],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x151')});db[_0x8b68('0x52')][_0x8b68('0x14d')](db[_0x8b68('0x8a')],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x17a')});db[_0x8b68('0x54')][_0x8b68('0x112')](db[_0x8b68('0x185')],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x186')});db[_0x8b68('0x54')][_0x8b68('0x14d')](db[_0x8b68('0x50')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x184')});db['SmsInteraction']['belongsTo'](db[_0x8b68('0x6f')],{'as':'Contact','foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x54')][_0x8b68('0x14d')](db['User'],{'as':_0x8b68('0x16f'),'foreignKey':'UserId'});db[_0x8b68('0x54')]['belongsToMany'](db[_0x8b68('0x8a')],{'through':'sms_interaction_has_tags','as':_0x8b68('0x171')});db[_0x8b68('0x54')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':'sms_interaction_has_tags','as':_0x8b68('0x172')});db[_0x8b68('0x54')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'through':_0x8b68('0x12a'),'foreignKey':_0x8b68('0x186')});db[_0x8b68('0x185')]['belongsTo'](db[_0x8b68('0x10c')],{'as':_0x8b68('0x10c')});db['SmsMessage'][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x15e')});db[_0x8b68('0x185')][_0x8b68('0x14d')](db['SmsInteraction'],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x181'),'foreignKey':_0x8b68('0x186')});db[_0x8b68('0x185')][_0x8b68('0x14d')](db[_0x8b68('0x50')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x184')});db[_0x8b68('0x133')][_0x8b68('0x122')](db['User'],{'as':_0x8b68('0x154'),'through':_0x8b68('0x34'),'foreignKey':_0x8b68('0x187')});db[_0x8b68('0x133')]['belongsToMany'](db[_0x8b68('0xe2')],{'through':_0x8b68('0x188'),'as':'Teams'});db[_0x8b68('0x57')][_0x8b68('0x112')](db[_0x8b68('0x7f')],{'as':_0x8b68('0x161'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8b68('0x10e')});db[_0x8b68('0x57')][_0x8b68('0x112')](db[_0x8b68('0x7d')],{'as':_0x8b68('0x163'),'foreignKey':_0x8b68('0x189')});db[_0x8b68('0x57')][_0x8b68('0x112')](db[_0x8b68('0x5b')],{'as':_0x8b68('0x164'),'foreignKey':_0x8b68('0x189')});db[_0x8b68('0x57')][_0x8b68('0x112')](db[_0x8b68('0x18a')],{'as':_0x8b68('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0x8b68('0x57')][_0x8b68('0x112')](db[_0x8b68('0x59')],{'as':_0x8b68('0x146'),'foreignKey':_0x8b68('0x189')});db[_0x8b68('0x57')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0x8b68('0x14d')](db[_0x8b68('0x168')],{'as':_0x8b68('0x169'),'foreignKey':_0x8b68('0x16a')});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':_0x8b68('0x154'),'through':_0x8b68('0x13f')});db[_0x8b68('0x59')][_0x8b68('0x14d')](db['User'],{'onDelete':_0x8b68('0x179')});db[_0x8b68('0x59')][_0x8b68('0x14d')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x8b68('0x59')]['belongsTo'](db[_0x8b68('0x57')],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x189')});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x8b68('0x151')});db['OpenchannelApplication'][_0x8b68('0x14d')](db[_0x8b68('0x8a')],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x17a')});db[_0x8b68('0x5b')][_0x8b68('0x112')](db[_0x8b68('0x18a')],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':'OpenchannelInteractionId'});db[_0x8b68('0x5b')][_0x8b68('0x14d')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x5b')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x16f'),'foreignKey':_0x8b68('0x111')});db['OpenchannelInteraction'][_0x8b68('0x122')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x8b68('0x171')});db[_0x8b68('0x5b')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':_0x8b68('0x18b'),'as':_0x8b68('0x172')});db[_0x8b68('0x5b')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'through':'user_has_openchannel_interactions','foreignKey':_0x8b68('0x18c')});db['OpenchannelMessage']['belongsTo'](db[_0x8b68('0x10c')],{'onDelete':_0x8b68('0x10e'),'as':'User'});db[_0x8b68('0x18a')]['belongsTo'](db[_0x8b68('0x6f')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x15e')});db[_0x8b68('0x18a')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x8b68('0x181'),'foreignKey':_0x8b68('0x18c')});db[_0x8b68('0x18a')][_0x8b68('0x14d')](db[_0x8b68('0x174')],{'as':_0x8b68('0x174'),'foreignKey':_0x8b68('0x182')});db[_0x8b68('0x18a')][_0x8b68('0x14d')](db[_0x8b68('0x57')],{'as':'Account','foreignKey':_0x8b68('0x189')});db[_0x8b68('0x5d')]['belongsToMany'](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x36'),'foreignKey':'OpenchannelQueueId'});db[_0x8b68('0x5d')][_0x8b68('0x122')](db[_0x8b68('0xe2')],{'through':_0x8b68('0x18d'),'as':'Teams'});db[_0x8b68('0x137')]['hasMany'](db[_0x8b68('0x7f')],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x177'),'onDelete':_0x8b68('0x10e')});db['ChatWebsite'][_0x8b68('0x112')](db[_0x8b68('0x7d')],{'as':_0x8b68('0x163'),'foreignKey':'ChatWebsiteId'});db[_0x8b68('0x137')][_0x8b68('0x112')](db['ChatProactiveAction'],{'as':_0x8b68('0x18e')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0x8b68('0x164')});db[_0x8b68('0x137')]['hasMany'](db[_0x8b68('0x61')],{'as':'Applications'});db[_0x8b68('0x137')][_0x8b68('0x112')](db[_0x8b68('0x18f')],{'as':_0x8b68('0x158')});db[_0x8b68('0x137')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':'List','foreignKey':'ListId'});db['ChatWebsite'][_0x8b68('0x14d')](db['Interval'],{'as':_0x8b68('0x83'),'foreignKey':_0x8b68('0x151')});db[_0x8b68('0x137')][_0x8b68('0x14d')](db[_0x8b68('0x3d')],{'as':_0x8b68('0x3d'),'foreignKey':_0x8b68('0x162')});db[_0x8b68('0x137')]['belongsTo'](db[_0x8b68('0x168')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite']['belongsToMany'](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x139')});db[_0x8b68('0x5f')][_0x8b68('0x14d')](db[_0x8b68('0x57')],{});db[_0x8b68('0x5f')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0x5f')]['belongsTo'](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x5f')]['belongsTo'](db[_0x8b68('0x5b')],{});db[_0x8b68('0x5f')]['belongsTo'](db[_0x8b68('0x18a')],{});db[_0x8b68('0x5f')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{});db[_0x8b68('0x5f')][_0x8b68('0x14d')](db[_0x8b68('0x5d')],{});db[_0x8b68('0x61')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':'Agent','foreignKey':_0x8b68('0x111'),'onDelete':'restrict'});db[_0x8b68('0x61')][_0x8b68('0x14d')](db[_0x8b68('0x67')],{'as':_0x8b68('0x190'),'foreignKey':_0x8b68('0x191'),'onDelete':'restrict'});db[_0x8b68('0x61')]['belongsTo'](db['ChatWebsite'],{'as':_0x8b68('0x192'),'foreignKey':_0x8b68('0x177'),'onDelete':_0x8b68('0x179')});db['ChatApplication'][_0x8b68('0x14d')](db['Tag'],{'onDelete':_0x8b68('0x179'),'foreignKey':'TagId'});db[_0x8b68('0x63')][_0x8b68('0x112')](db['ChatMessage'],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x193')});db[_0x8b68('0x63')][_0x8b68('0x14d')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x8b68('0x177')});db[_0x8b68('0x63')][_0x8b68('0x14d')](db['CmContact'],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x63')]['belongsTo'](db['User'],{'as':_0x8b68('0x16f'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x63')]['belongsToMany'](db[_0x8b68('0x8a')],{'through':'chat_interaction_has_tags','as':_0x8b68('0x171')});db['ChatInteraction'][_0x8b68('0x122')](db['Tag'],{'through':_0x8b68('0x194'),'as':_0x8b68('0x172')});db[_0x8b68('0x63')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':'Users','through':_0x8b68('0x195'),'foreignKey':'ChatInteractionId'});db[_0x8b68('0x18f')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'onDelete':_0x8b68('0x10e'),'as':'User'});db[_0x8b68('0x18f')][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db['ChatMessage'][_0x8b68('0x14d')](db[_0x8b68('0x63')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x181'),'foreignKey':'ChatInteractionId'});db[_0x8b68('0x18f')]['belongsTo'](db[_0x8b68('0x174')],{'as':'Attachment','foreignKey':_0x8b68('0x182')});db[_0x8b68('0x18f')]['belongsTo'](db['ChatWebsite'],{'as':_0x8b68('0x16e'),'foreignKey':'ChatWebsiteId'});db[_0x8b68('0x65')]['hasMany'](db[_0x8b68('0x174')],{'as':_0x8b68('0x175'),'foreignKey':_0x8b68('0x178'),'onDelete':_0x8b68('0x10e'),'hooks':!![]});db['ChatOfflineMessage'][_0x8b68('0x14d')](db[_0x8b68('0x6f')],{'onDelete':'cascade','as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db['ChatOfflineMessage'][_0x8b68('0x14d')](db[_0x8b68('0x137')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x177')});db[_0x8b68('0x67')][_0x8b68('0x122')](db['User'],{'as':_0x8b68('0x154'),'through':_0x8b68('0x2e'),'hooks':!![]});db[_0x8b68('0x67')][_0x8b68('0x122')](db[_0x8b68('0xe2')],{'through':_0x8b68('0x196'),'as':'Teams'});db[_0x8b68('0x69')]['hasMany'](db[_0x8b68('0x197')],{'as':_0x8b68('0x158'),'foreignKey':_0x8b68('0x198'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x69')]['belongsToMany'](db[_0x8b68('0x10c')],{'as':'Members','through':_0x8b68('0x124')});db[_0x8b68('0x6b')][_0x8b68('0x14d')](db[_0x8b68('0x137')],{'as':_0x8b68('0x192'),'foreignKey':_0x8b68('0x177')});db[_0x8b68('0x6d')]['hasMany'](db['CmContact'],{'as':_0x8b68('0x125'),'foreignKey':'CompanyId'});db[_0x8b68('0x6f')][_0x8b68('0x112')](db[_0x8b68('0x71')],{'as':_0x8b68('0x14a'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x6f')]['hasMany'](db[_0x8b68('0x75')],{'as':'HopperFinals','foreignKey':_0x8b68('0x15f')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x8b68('0x6f')]['hasMany'](db[_0x8b68('0x117')],{'as':'ReportAgentPreview','foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x6f')][_0x8b68('0x112')](db[_0x8b68('0x14c')],{'as':'JscriptySessions','foreignKey':_0x8b68('0x15f')});db['CmContact'][_0x8b68('0x112')](db[_0x8b68('0x5b')],{'as':'OpenchannelInteractions','foreignKey':_0x8b68('0x15f'),'onDelete':_0x8b68('0x179')});db[_0x8b68('0x6f')][_0x8b68('0x112')](db['ChatInteraction'],{'as':_0x8b68('0x119'),'foreignKey':'ContactId','onDelete':_0x8b68('0x179')});db['CmContact']['hasMany'](db[_0x8b68('0x54')],{'as':_0x8b68('0x11a'),'foreignKey':_0x8b68('0x15f'),'onDelete':_0x8b68('0x179')});db['CmContact'][_0x8b68('0x112')](db[_0x8b68('0x11b')],{'as':'FaxInteractions','foreignKey':_0x8b68('0x15f'),'onDelete':_0x8b68('0x179')});db[_0x8b68('0x6f')]['hasMany'](db[_0x8b68('0x42')],{'as':_0x8b68('0x11d'),'foreignKey':_0x8b68('0x15f'),'onDelete':'restrict'});db[_0x8b68('0x6f')]['belongsTo'](db[_0x8b68('0x6d')],{'as':'Company','foreignKey':_0x8b68('0x199')});db['CmContact'][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166'),'onDelete':_0x8b68('0x10e')});db['CmContact'][_0x8b68('0x122')](db['User'],{'as':_0x8b68('0x173'),'through':_0x8b68('0x126')});db['CmContact']['belongsToMany'](db[_0x8b68('0x8a')],{'as':_0x8b68('0x171'),'through':_0x8b68('0x19a')});db[_0x8b68('0x6f')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x8b68('0x71')][_0x8b68('0x14d')](db['CmContact'],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x71')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':'ListId','onDelete':_0x8b68('0x10e')});db['CmHopper']['belongsTo'](db[_0x8b68('0x10c')],{'as':'Agent','foreignKey':_0x8b68('0x111')});db['CmHopper'][_0x8b68('0x14d')](db['VoiceQueue'],{'as':_0x8b68('0x190'),'foreignKey':_0x8b68('0x149'),'onDelete':'cascade'});db[_0x8b68('0x71')][_0x8b68('0x14d')](db[_0x8b68('0xe6')],{'as':_0x8b68('0xe6'),'foreignKey':'CampaignId','onDelete':_0x8b68('0x10e')});db[_0x8b68('0x71')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x16f'),'foreignKey':_0x8b68('0x19b')});db[_0x8b68('0x73')]['belongsTo'](db[_0x8b68('0x6f')],{'as':_0x8b68('0x15e'),'foreignKey':'ContactId','onDelete':_0x8b68('0x10e')});db['CmHopperBlack'][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x73')]['belongsTo'](db[_0x8b68('0x1a')],{'as':_0x8b68('0x190'),'foreignKey':_0x8b68('0x149'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x73')][_0x8b68('0x14d')](db[_0x8b68('0xe6')],{'as':_0x8b68('0xe6'),'foreignKey':_0x8b68('0x19c'),'onDelete':'cascade'});db['Automation'][_0x8b68('0x112')](db[_0x8b68('0x81')],{'as':{'plural':_0x8b68('0x19d'),'singular':_0x8b68('0x19e')},'foreignKey':_0x8b68('0x19f'),'onDelete':_0x8b68('0x10e'),'hooks':!![]});db[_0x8b68('0x1a0')][_0x8b68('0x112')](db['Condition'],{'as':{'plural':'Any','singular':_0x8b68('0x1a1')},'foreignKey':'AutomationAnyId','onDelete':_0x8b68('0x10e'),'hooks':!![]});db[_0x8b68('0x1a0')][_0x8b68('0x112')](db['Action'],{'as':'Actions','foreignKey':_0x8b68('0x1a2'),'onDelete':_0x8b68('0x10e'),'hooks':!![]});db[_0x8b68('0x7f')]['hasMany'](db[_0x8b68('0x7f')],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x1a3'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x83')][_0x8b68('0x112')](db['Interval'],{'as':_0x8b68('0x1a4'),'foreignKey':_0x8b68('0x151'),'onDelete':_0x8b68('0x10e'),'hooks':!![],'required':![]});db['Interval'][_0x8b68('0x112')](db[_0x8b68('0x16')],{'as':'Extensions','foreignKey':_0x8b68('0x151'),'onDelete':_0x8b68('0x179')});db[_0x8b68('0x83')]['hasMany'](db[_0x8b68('0x44')],{'as':_0x8b68('0x1a5'),'foreignKey':_0x8b68('0x151')});db[_0x8b68('0x83')][_0x8b68('0x112')](db[_0x8b68('0x61')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x8b68('0x83')]['hasMany'](db[_0x8b68('0x49')],{'as':'FaxApplications','foreignKey':_0x8b68('0x151')});db['Interval']['hasMany'](db[_0x8b68('0x52')],{'as':_0x8b68('0x1a6'),'foreignKey':_0x8b68('0x151')});db[_0x8b68('0x1a7')][_0x8b68('0x14d')](db[_0x8b68('0x3d')],{});db['Schedule'][_0x8b68('0x14d')](db[_0x8b68('0x1a8')],{'foreignKey':_0x8b68('0x1a9')});db[_0x8b68('0x1a7')][_0x8b68('0x14d')](db[_0x8b68('0x94')],{'foreignKey':_0x8b68('0x1aa')});db[_0x8b68('0x89')][_0x8b68('0x122')](db[_0x8b68('0x18')],{'as':'Mohs','through':_0x8b68('0x147'),'onDelete':'restrict'});db[_0x8b68('0x8a')][_0x8b68('0x122')](db[_0x8b68('0x6f')],{'through':_0x8b68('0x19a')});db[_0x8b68('0x8a')][_0x8b68('0x122')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x8b68('0x8a')][_0x8b68('0x122')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0x8b68('0x122')](db[_0x8b68('0x54')],{'through':_0x8b68('0x1ab')});db[_0x8b68('0x8a')]['belongsToMany'](db[_0x8b68('0x11b')],{'through':_0x8b68('0x180')});db['Tag'][_0x8b68('0x122')](db['OpenchannelInteraction'],{'through':_0x8b68('0x18b')});db['Tag'][_0x8b68('0x122')](db[_0x8b68('0x100')],{'through':_0x8b68('0x1ac')});db[_0x8b68('0x8e')][_0x8b68('0x112')](db[_0x8b68('0x81')],{'as':{'plural':_0x8b68('0x1ad'),'singular':_0x8b68('0x1ae')},'foreignKey':_0x8b68('0x1af'),'onDelete':_0x8b68('0x10e'),'hooks':!![]});db[_0x8b68('0x8e')][_0x8b68('0x112')](db[_0x8b68('0x81')],{'as':{'plural':_0x8b68('0x1b0'),'singular':'AnyCondition'},'foreignKey':_0x8b68('0x1b1'),'onDelete':'cascade','hooks':!![]});db[_0x8b68('0x8e')]['hasMany'](db['Action'],{'as':_0x8b68('0x1b2'),'foreignKey':_0x8b68('0x1b3'),'onDelete':_0x8b68('0x10e'),'hooks':!![]});db['AnalyticCustomReport'][_0x8b68('0x112')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x8b68('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x8b68('0x1a8')][_0x8b68('0x112')](db['AnalyticFieldReport'],{'as':_0x8b68('0x1b4'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1a9')});db['AnalyticMetric'][_0x8b68('0x112')](db['AnalyticFieldReport'],{'as':_0x8b68('0x1b4'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1b5')});db[_0x8b68('0x9a')][_0x8b68('0x14d')](db['AnalyticMetric'],{'foreignKey':_0x8b68('0x1b5')});db['SalesforceAccount'][_0x8b68('0x112')](db[_0x8b68('0x9e')],{'as':_0x8b68('0x1b6'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1b7')});db['SalesforceConfiguration'][_0x8b68('0x112')](db[_0x8b68('0x1b8')],{'as':_0x8b68('0x1b9'),'onDelete':_0x8b68('0x10e'),'foreignKey':'SubjectId'});db[_0x8b68('0x9e')][_0x8b68('0x112')](db['SalesforceField'],{'as':_0x8b68('0x1ba'),'onDelete':'cascade','foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0x9e')][_0x8b68('0x112')](db[_0x8b68('0x1b8')],{'as':_0x8b68('0x1b4'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x9e')][_0x8b68('0x14d')](db['SalesforceAccount'],{'as':_0x8b68('0x16e'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8b68('0x1b8')][_0x8b68('0x112')](db[_0x8b68('0x1b8')],{'as':_0x8b68('0x1bd'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0x1b8')]['hasMany'](db[_0x8b68('0x1b8')],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x1b8')][_0x8b68('0x14d')](db[_0x8b68('0x90')],{'as':_0x8b68('0x90'),'foreignKey':'VariableId'});db[_0x8b68('0x1bf')][_0x8b68('0x112')](db[_0x8b68('0x1c0')],{'as':_0x8b68('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0x1c0')][_0x8b68('0x112')](db['SugarcrmField'],{'as':_0x8b68('0x1b9'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8b68('0x1c0')][_0x8b68('0x112')](db[_0x8b68('0x1c1')],{'as':_0x8b68('0x1ba'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bb')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bc')});db['SugarcrmConfiguration']['belongsTo'](db[_0x8b68('0x1bf')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0x1c1')][_0x8b68('0x112')](db[_0x8b68('0x1c1')],{'as':_0x8b68('0x1c2'),'foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0x1c1')][_0x8b68('0x112')](db[_0x8b68('0x1c1')],{'as':_0x8b68('0x1bd'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0x1c1')][_0x8b68('0x112')](db['SugarcrmField'],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x1c1')][_0x8b68('0x14d')](db[_0x8b68('0x90')],{'as':'Variable','foreignKey':_0x8b68('0x1c4')});db['DeskAccount'][_0x8b68('0x112')](db[_0x8b68('0xa6')],{'as':_0x8b68('0x1b6'),'onDelete':_0x8b68('0x10e'),'foreignKey':'AccountId'});db[_0x8b68('0xa6')][_0x8b68('0x112')](db[_0x8b68('0xa8')],{'as':_0x8b68('0x1b9'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8b68('0xa6')][_0x8b68('0x112')](db[_0x8b68('0xa8')],{'as':_0x8b68('0x1ba'),'onDelete':'cascade','foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xa6')][_0x8b68('0x112')](db[_0x8b68('0xa8')],{'as':_0x8b68('0x1b4'),'onDelete':_0x8b68('0x10e'),'foreignKey':'FieldId'});db[_0x8b68('0xa6')][_0x8b68('0x14d')](db['DeskAccount'],{'as':'Account','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xa6')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':_0x8b68('0x1c5')});db[_0x8b68('0xa8')][_0x8b68('0x112')](db[_0x8b68('0xa8')],{'as':_0x8b68('0x1c2'),'foreignKey':_0x8b68('0x1c3')});db['DeskField'][_0x8b68('0x112')](db[_0x8b68('0xa8')],{'as':_0x8b68('0x1bd'),'foreignKey':'DescriptionId'});db['DeskField'][_0x8b68('0x112')](db[_0x8b68('0xa8')],{'as':'Field','foreignKey':'FieldId'});db[_0x8b68('0xa8')][_0x8b68('0x14d')](db['Variable'],{'as':_0x8b68('0x90'),'foreignKey':_0x8b68('0x1c4')});db[_0x8b68('0x1c6')][_0x8b68('0x112')](db[_0x8b68('0xab')],{'as':_0x8b68('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xab')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0x8b68('0x10e'),'foreignKey':'SubjectId'});db['ZohoConfiguration']['hasMany'](db[_0x8b68('0xad')],{'as':_0x8b68('0x1ba'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xab')][_0x8b68('0x112')](db[_0x8b68('0xad')],{'as':_0x8b68('0x1b4'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bc')});db['ZohoConfiguration'][_0x8b68('0x14d')](db[_0x8b68('0x1c6')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xad')][_0x8b68('0x112')](db[_0x8b68('0xad')],{'as':_0x8b68('0x1c2'),'foreignKey':_0x8b68('0x1c3')});db['ZohoField']['hasMany'](db[_0x8b68('0xad')],{'as':_0x8b68('0x1bd'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xad')][_0x8b68('0x112')](db[_0x8b68('0xad')],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0xad')][_0x8b68('0x14d')](db[_0x8b68('0x90')],{'as':_0x8b68('0x90'),'foreignKey':'VariableId'});db[_0x8b68('0xaf')][_0x8b68('0x112')](db[_0x8b68('0x1c7')],{'as':_0x8b68('0x1b6'),'onDelete':_0x8b68('0x10e'),'foreignKey':'AccountId'});db[_0x8b68('0x1c7')][_0x8b68('0x112')](db[_0x8b68('0x1c8')],{'as':_0x8b68('0x1b9'),'foreignKey':'SubjectId'});db[_0x8b68('0x1c7')][_0x8b68('0x112')](db[_0x8b68('0x1c8')],{'as':'Descriptions','foreignKey':_0x8b68('0x1bb')});db['ZendeskConfiguration'][_0x8b68('0x112')](db[_0x8b68('0x1c8')],{'as':_0x8b68('0x1b4'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x1c7')]['belongsTo'](db[_0x8b68('0xaf')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x1b7')});db['ZendeskConfiguration']['belongsToMany'](db[_0x8b68('0x8a')],{'through':_0x8b68('0x1c9')});db['ZendeskField'][_0x8b68('0x112')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0x1c8')][_0x8b68('0x112')](db[_0x8b68('0x1c8')],{'as':_0x8b68('0x1bd'),'foreignKey':'DescriptionId'});db[_0x8b68('0x1c8')][_0x8b68('0x112')](db[_0x8b68('0x1c8')],{'as':'Field','foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x1c8')][_0x8b68('0x14d')](db[_0x8b68('0x90')],{'as':_0x8b68('0x90'),'foreignKey':_0x8b68('0x1c4')});db[_0x8b68('0xb3')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x8b68('0x1b6'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xb5')]['hasMany'](db[_0x8b68('0x1ca')],{'as':_0x8b68('0x1b9'),'onDelete':_0x8b68('0x10e'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x8b68('0x112')](db[_0x8b68('0x1ca')],{'as':'Descriptions','onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xb5')]['hasMany'](db[_0x8b68('0x1ca')],{'as':'Fields','onDelete':_0x8b68('0x10e'),'foreignKey':'FieldId'});db[_0x8b68('0xb5')][_0x8b68('0x14d')](db[_0x8b68('0xb3')],{'as':_0x8b68('0x16e'),'foreignKey':'AccountId'});db[_0x8b68('0xb5')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':_0x8b68('0x1cb')});db[_0x8b68('0x1ca')][_0x8b68('0x112')](db[_0x8b68('0x1ca')],{'as':'Subject','foreignKey':_0x8b68('0x1c3')});db['FreshdeskField'][_0x8b68('0x112')](db[_0x8b68('0x1ca')],{'as':_0x8b68('0x1bd'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0x1ca')][_0x8b68('0x112')](db[_0x8b68('0x1ca')],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x1ca')][_0x8b68('0x14d')](db['Variable'],{'as':_0x8b68('0x90'),'foreignKey':_0x8b68('0x1c4')});db['VtigerAccount'][_0x8b68('0x112')](db[_0x8b68('0xb9')],{'as':_0x8b68('0x1b6'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xb9')][_0x8b68('0x112')](db[_0x8b68('0x1cc')],{'as':_0x8b68('0x1b9'),'foreignKey':'SubjectId'});db[_0x8b68('0xb9')][_0x8b68('0x112')](db[_0x8b68('0x1cc')],{'as':'Descriptions','foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xb9')]['hasMany'](db['VtigerField'],{'as':_0x8b68('0x1b4'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0xb9')][_0x8b68('0x14d')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0x1cc')][_0x8b68('0x112')](db[_0x8b68('0x1cc')],{'as':_0x8b68('0x1c2'),'foreignKey':'SubjectId'});db[_0x8b68('0x1cc')]['hasMany'](db[_0x8b68('0x1cc')],{'as':_0x8b68('0x1bd'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0x1cc')][_0x8b68('0x112')](db[_0x8b68('0x1cc')],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0x1cc')]['belongsTo'](db[_0x8b68('0x90')],{'as':_0x8b68('0x90'),'foreignKey':'VariableId'});db['ServicenowAccount']['hasMany'](db[_0x8b68('0xbe')],{'as':'Configurations','onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1b7')});db['ServicenowConfiguration'][_0x8b68('0x112')](db[_0x8b68('0xc0')],{'as':_0x8b68('0x1b9'),'foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0xbe')]['hasMany'](db[_0x8b68('0xc0')],{'as':_0x8b68('0x1ba'),'foreignKey':_0x8b68('0x1bb')});db['ServicenowConfiguration']['hasMany'](db[_0x8b68('0xc0')],{'as':_0x8b68('0x1b4'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0xbe')][_0x8b68('0x14d')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xc0')]['hasMany'](db['ServicenowField'],{'as':_0x8b68('0x1c2'),'foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0xc0')]['hasMany'](db[_0x8b68('0xc0')],{'as':'Description','foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xc0')][_0x8b68('0x112')](db[_0x8b68('0xc0')],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0xc0')][_0x8b68('0x14d')](db['Variable'],{'as':_0x8b68('0x90'),'foreignKey':_0x8b68('0x1c4')});db[_0x8b68('0xc2')][_0x8b68('0x112')](db[_0x8b68('0xc4')],{'as':_0x8b68('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xc4')][_0x8b68('0x112')](db[_0x8b68('0xc5')],{'as':_0x8b68('0x1b9'),'onDelete':'cascade','foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0xc4')][_0x8b68('0x112')](db[_0x8b68('0xc5')],{'as':_0x8b68('0x1ba'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1bb')});db[_0x8b68('0xc4')]['hasMany'](db[_0x8b68('0xc5')],{'as':'Fields','onDelete':_0x8b68('0x10e'),'foreignKey':'FieldId'});db[_0x8b68('0xc4')]['belongsTo'](db[_0x8b68('0xc2')],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0xc5')]['hasMany'](db['Dynamics365Field'],{'as':_0x8b68('0x1c2'),'foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0xc5')]['hasMany'](db[_0x8b68('0xc5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8b68('0xc5')]['hasMany'](db[_0x8b68('0xc5')],{'as':_0x8b68('0x1be'),'foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0xc5')][_0x8b68('0x14d')](db[_0x8b68('0x90')],{'as':_0x8b68('0x90'),'foreignKey':_0x8b68('0x1c4')});db[_0x8b68('0xc7')]['hasMany'](db[_0x8b68('0x1cd')],{'as':_0x8b68('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b68('0x1b7')});db[_0x8b68('0x1cd')]['hasMany'](db[_0x8b68('0xca')],{'as':_0x8b68('0x1b9'),'foreignKey':_0x8b68('0x1c3')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x8b68('0x1ba'),'foreignKey':'DescriptionId'});db[_0x8b68('0x1cd')][_0x8b68('0x112')](db[_0x8b68('0xca')],{'as':_0x8b68('0x1b4'),'foreignKey':_0x8b68('0x1bc')});db['FreshsalesConfiguration'][_0x8b68('0x14d')](db[_0x8b68('0xc7')],{'as':'Account','foreignKey':'AccountId'});db[_0x8b68('0xca')][_0x8b68('0x112')](db['FreshsalesField'],{'as':_0x8b68('0x1c2'),'foreignKey':_0x8b68('0x1c3')});db[_0x8b68('0xca')][_0x8b68('0x112')](db[_0x8b68('0xca')],{'as':_0x8b68('0x1bd'),'foreignKey':'DescriptionId'});db[_0x8b68('0xca')][_0x8b68('0x112')](db[_0x8b68('0xca')],{'as':'Field','foreignKey':_0x8b68('0x1bc')});db[_0x8b68('0xca')][_0x8b68('0x14d')](db[_0x8b68('0x90')],{'as':_0x8b68('0x90'),'foreignKey':_0x8b68('0x1c4')});db[_0x8b68('0xce')][_0x8b68('0x14d')](db['ChatWebsite'],{});db[_0x8b68('0xce')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0xce')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b68('0xce')]['belongsTo'](db[_0x8b68('0x63')],{});db[_0x8b68('0xce')]['belongsTo'](db['ChatMessage'],{});db[_0x8b68('0xce')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{});db['ChatQueueReport'][_0x8b68('0x14d')](db[_0x8b68('0x67')],{});db[_0x8b68('0x197')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1ce')});db[_0x8b68('0x197')]['belongsTo'](db[_0x8b68('0x10c')],{'onDelete':'cascade','foreignKey':_0x8b68('0x1cf')});db[_0x8b68('0x14c')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x8b68('0x1d0'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0x14c')]['hasMany'](db[_0x8b68('0xd0')],{'foreignKey':_0x8b68('0x1d0'),'onDelete':_0x8b68('0x10e')});db['SmsQueueReport'][_0x8b68('0x14d')](db[_0x8b68('0x50')],{});db[_0x8b68('0xd4')][_0x8b68('0x14d')](db['CmList'],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0xd4')][_0x8b68('0x14d')](db['CmContact'],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db['SmsQueueReport'][_0x8b68('0x14d')](db[_0x8b68('0x54')],{});db[_0x8b68('0xd4')][_0x8b68('0x14d')](db[_0x8b68('0x185')],{});db[_0x8b68('0xd4')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{});db[_0x8b68('0xd4')][_0x8b68('0x14d')](db[_0x8b68('0x133')],{});db[_0x8b68('0xd8')][_0x8b68('0x112')](db[_0x8b68('0x14c')],{'foreignKey':_0x8b68('0x1d1')});db[_0x8b68('0xd8')][_0x8b68('0x112')](db[_0x8b68('0x1d2')],{'foreignKey':_0x8b68('0x1d1')});db[_0x8b68('0xd8')][_0x8b68('0x112')](db[_0x8b68('0xd0')],{'foreignKey':_0x8b68('0x1d1')});db[_0x8b68('0xdd')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'through':'user_has_square_projects'});db[_0x8b68('0xe2')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x128')});db[_0x8b68('0xe2')]['belongsToMany'](db['VoiceQueue'],{'through':_0x8b68('0x108'),'as':_0x8b68('0x1d3')});db['Team'][_0x8b68('0x122')](db[_0x8b68('0x3f')],{'through':_0x8b68('0x16c'),'as':_0x8b68('0x12f')});db[_0x8b68('0xe2')][_0x8b68('0x122')](db['ChatQueue'],{'through':_0x8b68('0x196'),'as':_0x8b68('0x130')});db[_0x8b68('0xe2')]['belongsToMany'](db['FaxQueue'],{'through':_0x8b68('0x183'),'as':_0x8b68('0x132')});db['Team'][_0x8b68('0x122')](db[_0x8b68('0x133')],{'through':_0x8b68('0x188'),'as':_0x8b68('0x134')});db[_0x8b68('0xe2')][_0x8b68('0x122')](db[_0x8b68('0x5d')],{'through':_0x8b68('0x18d'),'as':_0x8b68('0x1d4')});db[_0x8b68('0xe2')][_0x8b68('0x122')](db[_0x8b68('0x135')],{'through':_0x8b68('0x1d5'),'as':_0x8b68('0x136')});db[_0x8b68('0xe2')]['belongsToMany'](db['VoicePrefix'],{'through':_0x8b68('0x10a'),'as':_0x8b68('0x12e')});db['Campaign']['hasMany'](db[_0x8b68('0x71')],{'as':_0x8b68('0x14a'),'foreignKey':'CampaignId'});db[_0x8b68('0xe6')][_0x8b68('0x112')](db['CmHopperFinal'],{'as':_0x8b68('0x115'),'foreignKey':'CampaignId'});db['Campaign'][_0x8b68('0x112')](db[_0x8b68('0x76')],{'as':'HopperHistories','foreignKey':_0x8b68('0x19c')});db[_0x8b68('0xe6')][_0x8b68('0x112')](db[_0x8b68('0x73')],{'as':_0x8b68('0x14b'),'foreignKey':_0x8b68('0x19c')});db['Campaign']['belongsTo'](db[_0x8b68('0x27')],{'as':_0x8b68('0x27'),'foreignKey':_0x8b68('0x14e')});db[_0x8b68('0xe6')]['belongsTo'](db[_0x8b68('0x27')],{'as':'TrunkBackup','foreignKey':_0x8b68('0x150')});db['Campaign']['belongsTo'](db[_0x8b68('0x83')],{'as':_0x8b68('0x83'),'foreignKey':_0x8b68('0x151')});db[_0x8b68('0xe6')]['belongsTo'](db[_0x8b68('0xdd')],{'as':_0x8b68('0xdd'),'foreignKey':_0x8b68('0x1d6')});db[_0x8b68('0xe6')][_0x8b68('0x122')](db['CmList'],{'as':_0x8b68('0x152'),'through':_0x8b68('0x1d7')});db[_0x8b68('0xe6')][_0x8b68('0x122')](db[_0x8b68('0xf3')],{'as':_0x8b68('0x156'),'through':_0x8b68('0x1d8')});db[_0x8b68('0x174')][_0x8b68('0x14d')](db[_0x8b68('0x65')],{'as':_0x8b68('0x65'),'foreignKey':_0x8b68('0x178')});db[_0x8b68('0xea')][_0x8b68('0x14d')](db[_0x8b68('0x176')],{});db[_0x8b68('0xea')][_0x8b68('0x14d')](db[_0x8b68('0x42')],{});db[_0x8b68('0xea')][_0x8b68('0x14d')](db['MailAccount'],{'foreignKey':_0x8b68('0x1d9'),'as':_0x8b68('0x1da')});db[_0x8b68('0xea')][_0x8b68('0x14d')](db['User'],{'foreignKey':_0x8b68('0x1db'),'as':_0x8b68('0x1dc')});db[_0x8b68('0xea')]['belongsTo'](db[_0x8b68('0x10c')],{'foreignKey':_0x8b68('0x1dd'),'as':'ToAgent'});db['MailTransferReport'][_0x8b68('0x14d')](db[_0x8b68('0x3f')],{'foreignKey':_0x8b68('0x1de'),'as':_0x8b68('0x1df')});db[_0x8b68('0xea')][_0x8b68('0x14d')](db[_0x8b68('0x3d')],{'foreignKey':'ToMailAccountId','as':_0x8b68('0x1e0')});db[_0x8b68('0xec')][_0x8b68('0x14d')](db['ChatMessage'],{});db[_0x8b68('0xec')][_0x8b68('0x14d')](db['ChatInteraction'],{});db[_0x8b68('0xec')][_0x8b68('0x14d')](db[_0x8b68('0x137')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x8b68('0xec')][_0x8b68('0x14d')](db['User'],{'foreignKey':_0x8b68('0x1db'),'as':_0x8b68('0x1dc')});db[_0x8b68('0xec')][_0x8b68('0x14d')](db['User'],{'foreignKey':'ToUserId','as':_0x8b68('0x1e1')});db[_0x8b68('0xec')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x8b68('0x1e2'),'as':_0x8b68('0x1df')});db[_0x8b68('0xec')]['belongsTo'](db[_0x8b68('0x137')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x8b68('0xee')]['belongsTo'](db[_0x8b68('0x4b')],{});db['FaxTransferReport'][_0x8b68('0x14d')](db[_0x8b68('0x11b')],{});db[_0x8b68('0xee')][_0x8b68('0x14d')](db['FaxAccount'],{'foreignKey':_0x8b68('0x1e3'),'as':'FromAccount'});db[_0x8b68('0xee')]['belongsTo'](db[_0x8b68('0x10c')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8b68('0xee')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'foreignKey':_0x8b68('0x1dd'),'as':_0x8b68('0x1e1')});db[_0x8b68('0xee')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x8b68('0x1e4'),'as':'ToQueue'});db[_0x8b68('0xee')][_0x8b68('0x14d')](db['FaxAccount'],{'foreignKey':_0x8b68('0x1e5'),'as':'ToAccount'});db[_0x8b68('0x1e6')]['belongsTo'](db[_0x8b68('0x18a')],{});db[_0x8b68('0x1e6')][_0x8b68('0x14d')](db[_0x8b68('0x5b')],{});db[_0x8b68('0x1e6')]['belongsTo'](db[_0x8b68('0x57')],{'foreignKey':_0x8b68('0x1e7'),'as':_0x8b68('0x1da')});db[_0x8b68('0x1e6')]['belongsTo'](db[_0x8b68('0x10c')],{'foreignKey':_0x8b68('0x1db'),'as':_0x8b68('0x1dc')});db[_0x8b68('0x1e6')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'foreignKey':_0x8b68('0x1dd'),'as':'ToAgent'});db[_0x8b68('0x1e6')][_0x8b68('0x14d')](db[_0x8b68('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x8b68('0x1e6')][_0x8b68('0x14d')](db[_0x8b68('0x57')],{'foreignKey':_0x8b68('0x1e8'),'as':_0x8b68('0x1e0')});db['SmsTransferReport'][_0x8b68('0x14d')](db[_0x8b68('0x185')],{});db[_0x8b68('0xf1')][_0x8b68('0x14d')](db[_0x8b68('0x54')],{});db[_0x8b68('0xf1')][_0x8b68('0x14d')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x8b68('0x1da')});db['SmsTransferReport']['belongsTo'](db[_0x8b68('0x10c')],{'foreignKey':'FromUserId','as':_0x8b68('0x1dc')});db[_0x8b68('0xf1')]['belongsTo'](db[_0x8b68('0x10c')],{'foreignKey':_0x8b68('0x1dd'),'as':'ToAgent'});db[_0x8b68('0xf1')][_0x8b68('0x14d')](db['SmsQueue'],{'foreignKey':_0x8b68('0x1e9'),'as':'ToQueue'});db[_0x8b68('0xf1')][_0x8b68('0x14d')](db[_0x8b68('0x50')],{'foreignKey':_0x8b68('0x1ea'),'as':_0x8b68('0x1e0')});db[_0x8b68('0xf3')][_0x8b68('0x112')](db['Disposition'],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x166'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0xf3')][_0x8b68('0x112')](db[_0x8b68('0x1eb')],{'as':_0x8b68('0x1ec'),'foreignKey':_0x8b68('0x166')});db['CmList'][_0x8b68('0x112')](db['CmContact'],{'as':_0x8b68('0x125'),'onDelete':_0x8b68('0x10e'),'foreignKey':'ListId'});db[_0x8b68('0xf3')]['hasMany'](db[_0x8b68('0x75')],{'as':_0x8b68('0x115'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0xf3')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x8b68('0x166')});db[_0x8b68('0xf3')]['hasMany'](db[_0x8b68('0x117')],{'as':'ReportAgentPreview','foreignKey':_0x8b68('0x166')});db[_0x8b68('0xf3')][_0x8b68('0x122')](db[_0x8b68('0x1a')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db['User'],{'as':'Agents','through':_0x8b68('0x127')});db['VoicePrefix'][_0x8b68('0x112')](db[_0x8b68('0x16')],{'as':_0x8b68('0x114'),'onDelete':'cascade'});db[_0x8b68('0x12d')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x1ed')});db[_0x8b68('0x12d')]['belongsToMany'](db[_0x8b68('0xe2')],{'through':'TeamVoicePrefix','as':_0x8b68('0x155')});db['UserProfile']['hasMany'](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'foreignKey':_0x8b68('0x121')});db['UserProfile'][_0x8b68('0x112')](db[_0x8b68('0xf7')],{'as':_0x8b68('0x1ee'),'foreignKey':_0x8b68('0x121'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0xf7')][_0x8b68('0x112')](db['UserProfileResource'],{'as':_0x8b68('0x1ef'),'foreignKey':_0x8b68('0x1f0'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0xfc')]['hasMany'](db['Disposition'],{'as':_0x8b68('0x161'),'foreignKey':_0x8b68('0x1f1'),'onDelete':_0x8b68('0x10e')});db[_0x8b68('0xfc')][_0x8b68('0x112')](db['CannedAnswer'],{'as':_0x8b68('0x163'),'foreignKey':_0x8b68('0x1f1')});db['WhatsappAccount']['hasMany'](db[_0x8b68('0x1f2')],{'as':'Messages','foreignKey':_0x8b68('0x1f1')});db[_0x8b68('0xfc')]['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0x8b68('0x112')](db[_0x8b68('0xfe')],{'as':'Applications'});db[_0x8b68('0xfc')][_0x8b68('0x14d')](db['CmList'],{'as':_0x8b68('0x165'),'foreignKey':_0x8b68('0x166')});db[_0x8b68('0xfc')]['belongsTo'](db[_0x8b68('0x168')],{'as':_0x8b68('0x169'),'foreignKey':_0x8b68('0x16a')});db[_0x8b68('0xfc')]['belongsToMany'](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x1f3')});db[_0x8b68('0xfe')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'onDelete':_0x8b68('0x179')});db[_0x8b68('0xfe')][_0x8b68('0x14d')](db[_0x8b68('0x135')],{'onDelete':_0x8b68('0x179')});db['WhatsappApplication'][_0x8b68('0x14d')](db[_0x8b68('0xfc')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x8b68('0x14d')](db[_0x8b68('0x83')],{'onDelete':_0x8b68('0x179'),'foreignKey':'IntervalId'});db[_0x8b68('0xfe')]['belongsTo'](db['Tag'],{'onDelete':_0x8b68('0x179'),'foreignKey':_0x8b68('0x17a')});db[_0x8b68('0x100')][_0x8b68('0x112')](db[_0x8b68('0x1f2')],{'as':_0x8b68('0x158'),'onDelete':_0x8b68('0x10e'),'foreignKey':_0x8b68('0x1f4')});db[_0x8b68('0x100')]['belongsTo'](db[_0x8b68('0xfc')],{'as':_0x8b68('0x16e'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x8b68('0x14d')](db['CmContact'],{'as':'Contact','foreignKey':_0x8b68('0x15f')});db['WhatsappInteraction'][_0x8b68('0x14d')](db['User'],{'as':_0x8b68('0x16f'),'foreignKey':_0x8b68('0x111')});db[_0x8b68('0x100')][_0x8b68('0x122')](db['Tag'],{'through':_0x8b68('0x1ac'),'as':_0x8b68('0x171')});db[_0x8b68('0x100')][_0x8b68('0x122')](db[_0x8b68('0x8a')],{'through':'whatsapp_interaction_has_tags','as':_0x8b68('0x172')});db[_0x8b68('0x100')]['belongsToMany'](db[_0x8b68('0x10c')],{'as':_0x8b68('0x173'),'through':_0x8b68('0x12c'),'foreignKey':_0x8b68('0x1f4')});db[_0x8b68('0x1f2')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x10c')});db[_0x8b68('0x1f2')]['belongsTo'](db[_0x8b68('0x6f')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x15e')});db[_0x8b68('0x1f2')][_0x8b68('0x14d')](db[_0x8b68('0x100')],{'onDelete':_0x8b68('0x10e'),'as':_0x8b68('0x181'),'foreignKey':_0x8b68('0x1f4')});db[_0x8b68('0x1f2')][_0x8b68('0x14d')](db['WhatsappAccount'],{'as':_0x8b68('0x16e'),'foreignKey':_0x8b68('0x1f1')});db[_0x8b68('0x1f5')]['belongsTo'](db[_0x8b68('0xfc')],{});db[_0x8b68('0x1f5')][_0x8b68('0x14d')](db[_0x8b68('0xf3')],{'as':'List','foreignKey':'ListId'});db[_0x8b68('0x1f5')][_0x8b68('0x14d')](db['CmContact'],{'as':_0x8b68('0x15e'),'foreignKey':_0x8b68('0x15f')});db[_0x8b68('0x1f5')][_0x8b68('0x14d')](db[_0x8b68('0x100')],{});db[_0x8b68('0x1f5')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x8b68('0x14d')](db[_0x8b68('0x1f2')],{});db[_0x8b68('0x1f5')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{});db['WhatsappTransferReport'][_0x8b68('0x14d')](db['WhatsappMessage'],{});db[_0x8b68('0x104')][_0x8b68('0x14d')](db[_0x8b68('0x100')],{});db[_0x8b68('0x104')][_0x8b68('0x14d')](db[_0x8b68('0xfc')],{'foreignKey':_0x8b68('0x1f6'),'as':_0x8b68('0x1da')});db['WhatsappTransferReport'][_0x8b68('0x14d')](db[_0x8b68('0xfc')],{'foreignKey':_0x8b68('0x1f7'),'as':'ToAccount'});db[_0x8b68('0x104')][_0x8b68('0x14d')](db['WhatsappQueue'],{'foreignKey':_0x8b68('0x1f8'),'as':'ToQueue'});db[_0x8b68('0x104')]['belongsTo'](db[_0x8b68('0x10c')],{'foreignKey':'FromUserId','as':_0x8b68('0x1dc')});db[_0x8b68('0x104')][_0x8b68('0x14d')](db[_0x8b68('0x10c')],{'foreignKey':_0x8b68('0x1dd'),'as':_0x8b68('0x1e1')});db[_0x8b68('0x135')][_0x8b68('0x122')](db[_0x8b68('0x10c')],{'as':_0x8b68('0x154'),'through':_0x8b68('0x38'),'foreignKey':_0x8b68('0x1f9')});db[_0x8b68('0x135')][_0x8b68('0x122')](db['Team'],{'through':_0x8b68('0x1d5'),'as':'Teams'});module[_0x8b68('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4483=['../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.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','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','UserVoiceQueue','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Contact','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','Dashboard','Items','Disposition','FaxAccountId','Answers','Interactions','FaxApplication','mandatoryDispositionPause','TagId','FaxInteractionId','Tags','fax_interaction_has_tags','user_has_fax_interactions','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','Users','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatMessage','user_has_chat_websites','ChatApplication','Agent','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','CompanyId','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','Condition','All','OneAll','AutomationAllId','AutomationAnyId','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceConfiguration','Descriptions','DescriptionId','Description','Field','FieldId','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','SugarcrmAccount','int_desk_configuration_has_tags','Subject','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','campaigns_has_cm_lists','MailTransferReport','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromAccount','ToFaxQueueId','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','UserVoicePrefix','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication'];(function(_0x382d83,_0x28da8b){var _0x3019fc=function(_0x5910f7){while(--_0x5910f7){_0x382d83['push'](_0x382d83['shift']());}};_0x3019fc(++_0x28da8b);}(_0x4483,0x1a3));var _0x3448=function(_0x411b35,_0x5425b9){_0x411b35=_0x411b35-0x0;var _0x3da716=_0x4483[_0x411b35];return _0x3da716;};'use strict';var config=require(_0x3448('0x0'));var Sequelize=require(_0x3448('0x1'));var _=require(_0x3448('0x2'));var jstz=require('jstz');var timezone=jstz[_0x3448('0x3')]();config[_0x3448('0x1')]=_[_0x3448('0x4')](config[_0x3448('0x1')],{'database':_0x3448('0x5'),'username':'xcall','password':_0x3448('0x6'),'options':{'host':_0x3448('0x7'),'port':0xcea,'dialect':_0x3448('0x8'),'dialectOptions':{'charset':_0x3448('0x9')},'logging':![],'timezone':timezone[_0x3448('0xa')](),'define':{'charset':_0x3448('0xb'),'collate':_0x3448('0xc')}}});config[_0x3448('0xd')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x3448('0x5'),'username':_0x3448('0xe'),'password':_0x3448('0x6'),'options':{'host':_0x3448('0x7'),'port':0xcea,'dialect':_0x3448('0x8'),'dialectOptions':{'charset':_0x3448('0x9')},'logging':![],'timezone':timezone[_0x3448('0xa')](),'define':{'charset':_0x3448('0xb'),'collate':_0x3448('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3448('0x1')][_0x3448('0xf')],config['sequelize']['username'],config[_0x3448('0x1')][_0x3448('0x10')],config['sequelize'][_0x3448('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3448('0xd')][_0x3448('0xf')],config['sequelizeHistory'][_0x3448('0x12')],config[_0x3448('0xd')]['password'],config[_0x3448('0xd')][_0x3448('0x11')])};db[_0x3448('0x13')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x15'));db[_0x3448('0x16')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x17'));db[_0x3448('0x18')]=db[_0x3448('0x1')]['import'](_0x3448('0x19'));db['VoiceExtension']=db['sequelize']['import'](_0x3448('0x1a'));db[_0x3448('0x1b')]=db[_0x3448('0x1')]['import'](_0x3448('0x1c'));db[_0x3448('0x1d')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x1e'));db[_0x3448('0x1f')]=db['sequelize']['import']('../api/voiceRecording/voiceRecording.model');db[_0x3448('0x20')]=db[_0x3448('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x3448('0x21')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x22'));db[_0x3448('0x23')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x24'));db[_0x3448('0x25')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x3448('0x26')]=db[_0x3448('0x1')]['import'](_0x3448('0x27'));db[_0x3448('0x28')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x29'));db[_0x3448('0x2a')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x3448('0x2b')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/memberReport/memberReport.model');db[_0x3448('0x2c')]=db['sequelize']['import']('../api/trunk/trunk.model');db[_0x3448('0x2d')]=db[_0x3448('0x1')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x3448('0x2e')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x2f'));db['UserVoiceQueue']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x30'));db['UserChatQueue']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x31'));db[_0x3448('0x32')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x33'));db[_0x3448('0x34')]=db[_0x3448('0x1')]['import'](_0x3448('0x35'));db[_0x3448('0x36')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x37'));db[_0x3448('0x38')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x39'));db[_0x3448('0x3a')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x3448('0x1')]['import'](_0x3448('0x3b'));db[_0x3448('0x3c')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/mailAccount/mailAccount.model');db[_0x3448('0x3d')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x3e'));db[_0x3448('0x3f')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x40'));db[_0x3448('0x41')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x42'));db[_0x3448('0x43')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/mailMessage/mailMessage.model');db[_0x3448('0x44')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x45'));db[_0x3448('0x46')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x47'));db['Dashboard']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x48'));db['DashboardItem']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x49'));db[_0x3448('0x4a')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x4b'));db['FaxApplication']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x4c'));db[_0x3448('0x4d')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x3448('0x4e')]=db['sequelize']['import'](_0x3448('0x4f'));db[_0x3448('0x50')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x51'));db['FaxQueueReport']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0x3448('0x52')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x53'));db[_0x3448('0x54')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x55'));db[_0x3448('0x56')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x57'));db[_0x3448('0x58')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/smsQueue/smsQueue.model');db[_0x3448('0x59')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x5a'));db['OpenchannelApplication']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x5b'));db[_0x3448('0x5c')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x5d'));db['OpenchannelMessage']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x5e'));db[_0x3448('0x5f')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x60'));db['ChatApplication']=db['sequelize']['import'](_0x3448('0x61'));db[_0x3448('0x62')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x63'));db['ChatMessage']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/chatMessage/chatMessage.model');db[_0x3448('0x64')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x65'));db[_0x3448('0x66')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x67'));db[_0x3448('0x68')]=db['sequelize'][_0x3448('0x14')]('../api/chatGroup/chatGroup.model');db[_0x3448('0x69')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x6a'));db[_0x3448('0x6b')]=db[_0x3448('0x1')]['import'](_0x3448('0x6c'));db['CmContact']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x6d'));db[_0x3448('0x6e')]=db[_0x3448('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x3448('0x6f')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x3448('0x70')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x71'));db[_0x3448('0x72')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x73'));db[_0x3448('0x74')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x75'));db[_0x3448('0x76')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x77'));db[_0x3448('0x78')]=db[_0x3448('0x1')]['import'](_0x3448('0x79'));db['Automation']=db[_0x3448('0x1')]['import'](_0x3448('0x7a'));db[_0x3448('0x7b')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x7c'));db['Disposition']=db['sequelize'][_0x3448('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/condition/condition.model');db['Interval']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x7d'));db[_0x3448('0x7e')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x7f'));db[_0x3448('0x80')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x81'));db[_0x3448('0x82')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x3448('0x83')]=db[_0x3448('0x1')]['import'](_0x3448('0x84'));db[_0x3448('0x85')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x86'));db[_0x3448('0x87')]=db['sequelize']['import'](_0x3448('0x88'));db['Template']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x89'));db['Trigger']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x8a'));db['Variable']=db['sequelize'][_0x3448('0x14')](_0x3448('0x8b'));db[_0x3448('0x8c')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x8d'));db['IntegrationReport']=db[_0x3448('0x1')]['import'](_0x3448('0x8e'));db[_0x3448('0x8f')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x90'));db['AnalyticDefaultReport']=db['sequelize'][_0x3448('0x14')](_0x3448('0x91'));db[_0x3448('0x92')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x93'));db[_0x3448('0x94')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x95'));db[_0x3448('0x96')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x97'));db[_0x3448('0x98')]=db[_0x3448('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3448('0x99')]=db['sequelize'][_0x3448('0x14')](_0x3448('0x9a'));db['SalesforceConfiguration']=db[_0x3448('0x1')]['import'](_0x3448('0x9b'));db[_0x3448('0x9c')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x9d'));db['SugarcrmAccount']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x9e'));db['SugarcrmConfiguration']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x9f'));db['SugarcrmField']=db[_0x3448('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x3448('0xa0')]=db['sequelize'][_0x3448('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x3448('0xa1')]=db[_0x3448('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x3448('0xa2')]=db[_0x3448('0x1')]['import'](_0x3448('0xa3'));db[_0x3448('0xa4')]=db['sequelize'][_0x3448('0x14')](_0x3448('0xa5'));db[_0x3448('0xa6')]=db[_0x3448('0x1')]['import'](_0x3448('0xa7'));db['ZohoField']=db[_0x3448('0x1')]['import'](_0x3448('0xa8'));db[_0x3448('0xa9')]=db[_0x3448('0x1')]['import'](_0x3448('0xaa'));db[_0x3448('0xab')]=db['sequelize'][_0x3448('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x3448('0x1')]['import'](_0x3448('0xac'));db[_0x3448('0xad')]=db[_0x3448('0x1')]['import'](_0x3448('0xae'));db[_0x3448('0xaf')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xb0'));db[_0x3448('0xb1')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xb2'));db[_0x3448('0xb3')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xb4'));db['VtigerConfiguration']=db['sequelize']['import'](_0x3448('0xb5'));db['VtigerField']=db['sequelize'][_0x3448('0x14')](_0x3448('0xb6'));db[_0x3448('0xb7')]=db[_0x3448('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x3448('0xb8')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x3448('0xb9')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xba'));db['Dynamics365Account']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xbb'));db['Dynamics365Field']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xbc'));db[_0x3448('0xbd')]=db['sequelize'][_0x3448('0x14')](_0x3448('0xbe'));db['FreshsalesConfiguration']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xbf'));db[_0x3448('0x8c')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x8d'));db[_0x3448('0xc0')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/network/network.model');db[_0x3448('0xc1')]=db['sequelize'][_0x3448('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x3448('0xc2')]=db[_0x3448('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xc3'));db['JscriptyQuestionReport']=db[_0x3448('0x1')][_0x3448('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xc4'));db[_0x3448('0xc5')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xc6'));db[_0x3448('0xc7')]=db[_0x3448('0x1')]['import']('../api/squareReport/squareReport.model');db[_0x3448('0xc8')]=db['sequelize'][_0x3448('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x3448('0xc9')]=db[_0x3448('0x1')]['import'](_0x3448('0xca'));db[_0x3448('0xcb')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xcc'));db[_0x3448('0xcd')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xce'));db[_0x3448('0xcf')]=db[_0x3448('0x1')]['import'](_0x3448('0xd0'));db[_0x3448('0xd1')]=db[_0x3448('0x1')]['import'](_0x3448('0xd2'));db[_0x3448('0xd3')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xd4'));db[_0x3448('0xd5')]=db['sequelize']['import'](_0x3448('0xd6'));db[_0x3448('0xd7')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xd8'));db[_0x3448('0xd9')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xda'));db[_0x3448('0xdb')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xdc'));db[_0x3448('0xdd')]=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x3448('0xde')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xdf'));db['MailTransferReport']=db[_0x3448('0x1')]['import'](_0x3448('0xe0'));db['ChatTransferReport']=db[_0x3448('0x1')]['import'](_0x3448('0xe1'));db[_0x3448('0xe2')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xe3'));db[_0x3448('0xe4')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xe5'));db['SmsTransferReport']=db['sequelize'][_0x3448('0x14')](_0x3448('0xe6'));db[_0x3448('0xe7')]=db[_0x3448('0x1')]['import'](_0x3448('0xe8'));db[_0x3448('0xe9')]=db[_0x3448('0x1')]['import'](_0x3448('0xea'));db['UserProfile']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xeb'));db['UserProfileSection']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xec'));db[_0x3448('0xed')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xee'));db[_0x3448('0xef')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xf0'));db[_0x3448('0xf1')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xf2'));db['WhatsappInteraction']=db['sequelize'][_0x3448('0x14')](_0x3448('0xf3'));db[_0x3448('0xf4')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xf5'));db[_0x3448('0xf6')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xf7'));db[_0x3448('0xf8')]=db[_0x3448('0x1')]['import'](_0x3448('0xf9'));db[_0x3448('0xfa')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xfb'));db[_0x3448('0xfc')]=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xfd'));db[_0x3448('0xfe')]=db[_0x3448('0x1')][_0x3448('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0xff'));db['UserVoicePrefix']=db[_0x3448('0x1')][_0x3448('0x14')](_0x3448('0x100'));db['User']['hasOne'](db[_0x3448('0x21')],{'as':_0x3448('0x21'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x1f')],{'as':_0x3448('0x104'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x2e')],{'as':_0x3448('0x105'),'foreignKey':_0x3448('0x102')});db['User'][_0x3448('0x103')](db[_0x3448('0x106')],{'as':'Extensions','onDelete':_0x3448('0x101'),'hooks':!![]});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x70')],{'as':_0x3448('0x107'),'foreignKey':_0x3448('0x102')});db['User'][_0x3448('0x103')](db[_0x3448('0x72')],{'as':_0x3448('0x108'),'foreignKey':'UserId'});db['User'][_0x3448('0x103')](db[_0x3448('0x74')],{'as':_0x3448('0x74'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x5c')],{'as':_0x3448('0x109'),'foreignKey':_0x3448('0x102')});db['User'][_0x3448('0x103')](db[_0x3448('0x62')],{'as':_0x3448('0x10a'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')]['hasMany'](db[_0x3448('0x10b')],{'as':_0x3448('0x10c'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x4d')],{'as':_0x3448('0x10d'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x41')],{'as':_0x3448('0x10e'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0x10f')],{'as':_0x3448('0x110'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x13')][_0x3448('0x103')](db[_0x3448('0xef')],{'as':'UserNotifications','foreignKey':_0x3448('0x111')});db['User'][_0x3448('0x112')](db[_0x3448('0x113')],{'as':'UserProfile','foreignKey':_0x3448('0x114')});db['User'][_0x3448('0x115')](db[_0x3448('0x68')],{'as':'Groups','through':_0x3448('0x116')});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x117')],{'as':_0x3448('0x118'),'through':_0x3448('0x119')});db['User']['belongsToMany'](db[_0x3448('0xe7')],{'as':_0x3448('0x11a'),'through':_0x3448('0x11b')});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0xd5')],{'through':_0x3448('0x11c')});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x41')],{'as':_0x3448('0x10e'),'through':_0x3448('0x11d')});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x62')],{'as':_0x3448('0x10a'),'through':_0x3448('0x11e')});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x4d')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x10b')],{'as':'SmsInteractions','through':_0x3448('0x11f')});db['User'][_0x3448('0x115')](db[_0x3448('0x5c')],{'as':_0x3448('0x109'),'through':_0x3448('0x120')});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x10f')],{'as':_0x3448('0x110'),'through':'user_has_whatsapp_interactions'});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x1d')],{'as':'VoiceQueues','through':_0x3448('0x121'),'required':![]});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0xe9')],{'as':_0x3448('0x122'),'through':'UserVoicePrefix','required':![]});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x3d')],{'as':_0x3448('0x123'),'through':_0x3448('0x124'),'required':![]});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x66')],{'as':_0x3448('0x125'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x3448('0x13')][_0x3448('0x115')](db['FaxQueue'],{'as':_0x3448('0x126'),'through':'UserFaxQueue','required':![]});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x58')],{'as':_0x3448('0x127'),'through':_0x3448('0x34'),'required':![]});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x128')],{'as':_0x3448('0x129'),'through':_0x3448('0x36'),'required':![]});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0xfa')],{'as':_0x3448('0x12a'),'through':_0x3448('0x38'),'required':![]});db['User'][_0x3448('0x115')](db['CmList'],{'through':_0x3448('0x11b')});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0x12b')],{'as':_0x3448('0x12c'),'through':'user_has_chat_websites'});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x4a')],{'as':_0x3448('0x12d'),'through':_0x3448('0x12e')});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x3c')],{'as':_0x3448('0x12f'),'through':_0x3448('0x130')});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0x59')],{'as':_0x3448('0x131'),'through':_0x3448('0x132')});db['User'][_0x3448('0x115')](db['SmsAccount'],{'as':_0x3448('0x133'),'through':_0x3448('0x134')});db[_0x3448('0x13')][_0x3448('0x115')](db[_0x3448('0xf1')],{'as':_0x3448('0x135'),'through':_0x3448('0x136')});db[_0x3448('0x13')]['belongsToMany'](db[_0x3448('0xcf')],{'as':_0x3448('0x137'),'through':_0x3448('0x138')});db[_0x3448('0x16')]['hasMany'](db[_0x3448('0x106')],{'as':_0x3448('0x139'),'onDelete':'cascade','foreignKey':_0x3448('0x13a')});db['VoiceContext'][_0x3448('0x103')](db['VoiceExtension'],{'onDelete':_0x3448('0x101')});db[_0x3448('0x106')][_0x3448('0x103')](db[_0x3448('0x106')],{'as':_0x3448('0x13b'),'onDelete':_0x3448('0x101')});db[_0x3448('0x1b')][_0x3448('0x115')](db[_0x3448('0x85')],{'as':_0x3448('0x13c'),'through':_0x3448('0x13d')});db[_0x3448('0x1d')][_0x3448('0x103')](db['UserVoiceQueueRt'],{'as':_0x3448('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x3448('0x1d')][_0x3448('0x103')](db['CmHopper'],{'as':_0x3448('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x3448('0x1d')][_0x3448('0x103')](db[_0x3448('0x70')],{'as':_0x3448('0x107'),'foreignKey':_0x3448('0x140')});db[_0x3448('0x1d')][_0x3448('0x103')](db[_0x3448('0x72')],{'as':_0x3448('0x141'),'foreignKey':_0x3448('0x140')});db[_0x3448('0x1d')][_0x3448('0x103')](db[_0x3448('0x74')],{'as':_0x3448('0x74'),'foreignKey':_0x3448('0x140')});db['VoiceQueue']['hasMany'](db[_0x3448('0x6f')],{'as':'HopperBlacks','foreignKey':_0x3448('0x140')});db[_0x3448('0x1d')][_0x3448('0x103')](db[_0x3448('0x142')],{'as':_0x3448('0x143'),'foreignKey':_0x3448('0x140')});db[_0x3448('0x1d')][_0x3448('0x112')](db[_0x3448('0x2c')],{'as':_0x3448('0x2c'),'foreignKey':_0x3448('0x144')});db[_0x3448('0x1d')]['belongsTo'](db['Trunk'],{'as':_0x3448('0x145'),'foreignKey':_0x3448('0x146')});db[_0x3448('0x1d')][_0x3448('0x112')](db[_0x3448('0x147')],{'as':'Interval','foreignKey':_0x3448('0x148')});db[_0x3448('0x1d')][_0x3448('0x112')](db[_0x3448('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x3448('0x1d')]['belongsToMany'](db[_0x3448('0xe7')],{'as':'Lists','through':_0x3448('0x149')});db[_0x3448('0x1d')]['belongsToMany'](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x121')});db[_0x3448('0x1d')][_0x3448('0x115')](db[_0x3448('0xd5')],{'as':_0x3448('0x14b'),'through':_0x3448('0xfe')});db[_0x3448('0x1d')][_0x3448('0x115')](db[_0x3448('0xe7')],{'as':_0x3448('0x14c'),'through':'voice_queues_has_cm_blacklists'});db[_0x3448('0x1f')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':'User','foreignKey':'UserId'});db[_0x3448('0x20')][_0x3448('0x112')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x3448('0x21')][_0x3448('0x103')](db['VoiceMailMessage'],{'as':_0x3448('0x14d'),'onDelete':'cascade','foreignKey':_0x3448('0x14e'),'sourceKey':_0x3448('0x14f')});db['VoiceMailMessage'][_0x3448('0x112')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x3448('0x14f')});db[_0x3448('0x25')][_0x3448('0x103')](db[_0x3448('0x2a')],{'as':_0x3448('0x150'),'foreignKey':_0x3448('0x151'),'constraints':![]});db[_0x3448('0x25')][_0x3448('0x103')](db['VoiceAgentReport'],{'as':_0x3448('0x152'),'foreignKey':_0x3448('0x151'),'constraints':![]});db[_0x3448('0x25')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x13'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x25')][_0x3448('0x112')](db[_0x3448('0x117')],{'as':'Contact','foreignKey':_0x3448('0x153')});db[_0x3448('0x3a')][_0x3448('0x112')](db['MailAccount'],{'as':_0x3448('0x3c'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x3448('0x112')](db[_0x3448('0x3c')],{'as':_0x3448('0x3c'),'foreignKey':_0x3448('0x154')});db[_0x3448('0x3c')][_0x3448('0x155')](db[_0x3448('0x3a')],{'as':_0x3448('0x156'),'onDelete':_0x3448('0x101')});db[_0x3448('0x3c')][_0x3448('0x155')](db['MailServerOut'],{'as':_0x3448('0x157'),'onDelete':_0x3448('0x101')});db[_0x3448('0x3c')][_0x3448('0x103')](db['Disposition'],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x154'),'onDelete':'cascade'});db['MailAccount'][_0x3448('0x103')](db[_0x3448('0x7b')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x3448('0x3c')][_0x3448('0x103')](db[_0x3448('0x43')],{'as':_0x3448('0x14d'),'foreignKey':_0x3448('0x154')});db[_0x3448('0x3c')][_0x3448('0x103')](db[_0x3448('0x41')],{'as':'Interactions'});db[_0x3448('0x3c')][_0x3448('0x103')](db[_0x3448('0x44')],{'as':'Applications'});db['MailAccount'][_0x3448('0x112')](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db[_0x3448('0x3c')]['belongsTo'](db[_0x3448('0x15b')],{'as':_0x3448('0x15b'),'foreignKey':_0x3448('0x15c')});db[_0x3448('0x3c')][_0x3448('0x112')](db[_0x3448('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0x3448('0x15d')});db[_0x3448('0x3c')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x130')});db['MailQueue'][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':'UserMailQueue'});db[_0x3448('0x3d')][_0x3448('0x115')](db[_0x3448('0xd5')],{'through':'team_has_mail_queues','as':_0x3448('0x14b')});db[_0x3448('0x41')][_0x3448('0x103')](db[_0x3448('0x43')],{'as':'Messages','onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x15e')});db[_0x3448('0x41')]['belongsTo'](db[_0x3448('0x3c')],{'as':_0x3448('0x15f'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x3448('0x112')](db[_0x3448('0x117')],{'as':'Contact','foreignKey':_0x3448('0x153')});db['MailInteraction']['belongsTo'](db['User'],{'as':_0x3448('0x160'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x41')]['belongsToMany'](db[_0x3448('0x87')],{'through':_0x3448('0x161'),'as':'Tags'});db['MailInteraction'][_0x3448('0x115')](db['Tag'],{'through':_0x3448('0x161'),'as':_0x3448('0x162')});db[_0x3448('0x41')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':'Users','through':_0x3448('0x11d'),'foreignKey':_0x3448('0x15e')});db[_0x3448('0x43')][_0x3448('0x103')](db['Attachment'],{'as':'Attachments','onDelete':_0x3448('0x101')});db['MailMessage'][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x13')});db[_0x3448('0x43')][_0x3448('0x112')](db[_0x3448('0x117')],{'onDelete':'cascade','as':_0x3448('0x163')});db[_0x3448('0x43')][_0x3448('0x112')](db[_0x3448('0x41')],{'as':_0x3448('0x164'),'foreignKey':_0x3448('0x15e')});db[_0x3448('0x43')][_0x3448('0x112')](db[_0x3448('0x3c')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x154')});db[_0x3448('0x43')][_0x3448('0x112')](db['ChatWebsite'],{'as':_0x3448('0x12b'),'foreignKey':_0x3448('0x165')});db['MailMessage'][_0x3448('0x112')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x3448('0x166')});db[_0x3448('0x44')][_0x3448('0x112')](db[_0x3448('0x13')],{'onDelete':_0x3448('0x167')});db['MailApplication'][_0x3448('0x112')](db[_0x3448('0x3d')],{'onDelete':_0x3448('0x167')});db[_0x3448('0x44')][_0x3448('0x112')](db['MailAccount'],{'onDelete':_0x3448('0x167')});db[_0x3448('0x44')]['belongsTo'](db[_0x3448('0x147')],{'onDelete':_0x3448('0x167'),'foreignKey':'IntervalId'});db[_0x3448('0x44')][_0x3448('0x112')](db[_0x3448('0x87')],{'onDelete':_0x3448('0x167'),'foreignKey':'TagId'});db[_0x3448('0x46')][_0x3448('0x112')](db[_0x3448('0x3c')],{});db[_0x3448('0x46')]['belongsTo'](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db['MailQueueReport'][_0x3448('0x112')](db['CmContact'],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153')});db[_0x3448('0x46')][_0x3448('0x112')](db['MailInteraction'],{});db['MailQueueReport'][_0x3448('0x112')](db[_0x3448('0x43')],{});db[_0x3448('0x46')][_0x3448('0x112')](db[_0x3448('0x13')],{});db[_0x3448('0x46')][_0x3448('0x112')](db['MailQueue'],{});db[_0x3448('0x168')][_0x3448('0x103')](db['DashboardItem'],{'as':_0x3448('0x169'),'onDelete':_0x3448('0x101')});db[_0x3448('0x4a')][_0x3448('0x103')](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x16b'),'onDelete':_0x3448('0x101')});db[_0x3448('0x4a')]['hasMany'](db[_0x3448('0x7b')],{'as':_0x3448('0x16c'),'foreignKey':'FaxAccountId'});db[_0x3448('0x4a')]['hasMany'](db[_0x3448('0x4d')],{'as':_0x3448('0x16d')});db[_0x3448('0x4a')][_0x3448('0x103')](db[_0x3448('0x16e')],{'as':_0x3448('0x13b')});db['FaxAccount'][_0x3448('0x103')](db[_0x3448('0x106')],{'as':'Exntensions','onDelete':_0x3448('0x101')});db['FaxAccount'][_0x3448('0x103')](db['FaxMessage'],{'as':'Messages'});db[_0x3448('0x4a')][_0x3448('0x112')](db[_0x3448('0x2c')],{'as':'Trunk'});db['FaxAccount'][_0x3448('0x112')](db[_0x3448('0xe7')],{'as':'List','foreignKey':'ListId'});db[_0x3448('0x4a')]['belongsTo'](db['Pause'],{'as':_0x3448('0x16f'),'foreignKey':_0x3448('0x15d')});db['FaxAccount'][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':'user_has_fax_accounts'});db[_0x3448('0x16e')][_0x3448('0x112')](db['User'],{'onDelete':_0x3448('0x167')});db[_0x3448('0x16e')][_0x3448('0x112')](db[_0x3448('0x50')],{'onDelete':_0x3448('0x167')});db[_0x3448('0x16e')][_0x3448('0x112')](db[_0x3448('0x4a')],{'onDelete':_0x3448('0x167')});db[_0x3448('0x16e')][_0x3448('0x112')](db[_0x3448('0x87')],{'onDelete':_0x3448('0x167'),'foreignKey':_0x3448('0x170')});db[_0x3448('0x4d')][_0x3448('0x103')](db[_0x3448('0x4e')],{'as':_0x3448('0x14d'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x171')});db['FaxInteraction']['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x3448('0x4d')][_0x3448('0x112')](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153')});db['FaxInteraction'][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x160'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x4d')][_0x3448('0x115')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x3448('0x172')});db['FaxInteraction'][_0x3448('0x115')](db[_0x3448('0x87')],{'through':_0x3448('0x173'),'as':'ThroughTags'});db[_0x3448('0x4d')]['belongsToMany'](db[_0x3448('0x13')],{'as':'Users','through':_0x3448('0x174'),'foreignKey':_0x3448('0x171')});db[_0x3448('0x4e')][_0x3448('0x112')](db['User'],{'onDelete':'cascade','as':_0x3448('0x13')});db[_0x3448('0x4e')]['belongsTo'](db[_0x3448('0x4d')],{'as':_0x3448('0x164'),'foreignKey':_0x3448('0x171')});db[_0x3448('0x4e')]['belongsTo'](db[_0x3448('0x117')],{'onDelete':'cascade','as':_0x3448('0x163')});db['FaxMessage'][_0x3448('0x112')](db[_0x3448('0xdd')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x3448('0x4e')][_0x3448('0x112')](db[_0x3448('0x4a')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x16b')});db[_0x3448('0x50')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':'Agents','through':_0x3448('0x32')});db['FaxQueue'][_0x3448('0x115')](db[_0x3448('0xd5')],{'through':_0x3448('0x175'),'as':_0x3448('0x14b')});db['FaxQueueReport'][_0x3448('0x112')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x3448('0x15a')});db[_0x3448('0x176')][_0x3448('0x112')](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153')});db[_0x3448('0x176')]['belongsTo'](db['FaxInteraction'],{});db[_0x3448('0x176')][_0x3448('0x112')](db['FaxMessage'],{});db[_0x3448('0x176')][_0x3448('0x112')](db[_0x3448('0x13')],{});db[_0x3448('0x176')][_0x3448('0x112')](db[_0x3448('0x50')],{});db[_0x3448('0x52')]['hasMany'](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x177'),'onDelete':_0x3448('0x101')});db[_0x3448('0x52')][_0x3448('0x103')](db['CannedAnswer'],{'as':_0x3448('0x16c'),'foreignKey':_0x3448('0x177')});db[_0x3448('0x52')][_0x3448('0x103')](db[_0x3448('0x56')],{'as':_0x3448('0x14d'),'foreignKey':_0x3448('0x177')});db[_0x3448('0x52')]['hasMany'](db['SmsInteraction'],{'as':_0x3448('0x16d')});db[_0x3448('0x52')][_0x3448('0x103')](db['SmsApplication'],{'as':_0x3448('0x13b')});db[_0x3448('0x52')]['belongsTo'](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db['SmsAccount'][_0x3448('0x112')](db[_0x3448('0x7e')],{'as':_0x3448('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3448('0x52')]['belongsToMany'](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':'user_has_sms_accounts'});db[_0x3448('0x54')][_0x3448('0x112')](db[_0x3448('0x13')],{'onDelete':_0x3448('0x167')});db[_0x3448('0x54')][_0x3448('0x112')](db[_0x3448('0x58')],{'onDelete':_0x3448('0x167')});db[_0x3448('0x54')][_0x3448('0x112')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x3448('0x54')][_0x3448('0x112')](db[_0x3448('0x147')],{'onDelete':_0x3448('0x167'),'foreignKey':_0x3448('0x148')});db['SmsApplication'][_0x3448('0x112')](db[_0x3448('0x87')],{'onDelete':_0x3448('0x167'),'foreignKey':'TagId'});db[_0x3448('0x10b')][_0x3448('0x103')](db[_0x3448('0x56')],{'as':_0x3448('0x14d'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x3448('0x10b')][_0x3448('0x112')](db[_0x3448('0x52')],{'as':'Account','foreignKey':_0x3448('0x177')});db['SmsInteraction'][_0x3448('0x112')](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':'ContactId'});db[_0x3448('0x10b')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x160'),'foreignKey':'UserId'});db[_0x3448('0x10b')][_0x3448('0x115')](db[_0x3448('0x87')],{'through':'sms_interaction_has_tags','as':_0x3448('0x172')});db[_0x3448('0x10b')]['belongsToMany'](db[_0x3448('0x87')],{'through':_0x3448('0x178'),'as':_0x3448('0x162')});db[_0x3448('0x10b')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x179'),'through':_0x3448('0x11f'),'foreignKey':'SmsInteractionId'});db[_0x3448('0x56')][_0x3448('0x112')](db['User'],{'as':_0x3448('0x13')});db[_0x3448('0x56')][_0x3448('0x112')](db[_0x3448('0x117')],{'onDelete':_0x3448('0x101'),'as':_0x3448('0x163')});db[_0x3448('0x56')][_0x3448('0x112')](db[_0x3448('0x10b')],{'onDelete':'cascade','as':_0x3448('0x164'),'foreignKey':_0x3448('0x17a')});db['SmsMessage'][_0x3448('0x112')](db[_0x3448('0x52')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x177')});db[_0x3448('0x58')]['belongsToMany'](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x34'),'foreignKey':'SmsQueueId'});db[_0x3448('0x58')][_0x3448('0x115')](db[_0x3448('0xd5')],{'through':_0x3448('0x17b'),'as':_0x3448('0x14b')});db[_0x3448('0x59')][_0x3448('0x103')](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x17c'),'onDelete':_0x3448('0x101')});db[_0x3448('0x59')][_0x3448('0x103')](db[_0x3448('0x7b')],{'as':_0x3448('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x3448('0x59')]['hasMany'](db[_0x3448('0x5c')],{'as':_0x3448('0x16d'),'foreignKey':_0x3448('0x17c')});db[_0x3448('0x59')][_0x3448('0x103')](db[_0x3448('0x17d')],{'as':_0x3448('0x14d'),'foreignKey':_0x3448('0x17c')});db[_0x3448('0x59')]['hasMany'](db[_0x3448('0x17e')],{'as':_0x3448('0x13b'),'foreignKey':'OpenchannelAccountId'});db[_0x3448('0x59')][_0x3448('0x112')](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db['OpenchannelAccount'][_0x3448('0x112')](db['Pause'],{'as':_0x3448('0x16f'),'foreignKey':_0x3448('0x15d')});db[_0x3448('0x59')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x132')});db[_0x3448('0x17e')][_0x3448('0x112')](db['User'],{'onDelete':_0x3448('0x167')});db['OpenchannelApplication'][_0x3448('0x112')](db[_0x3448('0x128')],{'onDelete':_0x3448('0x167'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x3448('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0x3448('0x17e')]['belongsTo'](db['Interval'],{'onDelete':_0x3448('0x167'),'foreignKey':_0x3448('0x148')});db[_0x3448('0x17e')][_0x3448('0x112')](db[_0x3448('0x87')],{'onDelete':'restrict','foreignKey':_0x3448('0x170')});db[_0x3448('0x5c')][_0x3448('0x103')](db[_0x3448('0x17d')],{'as':'Messages','onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x17f')});db[_0x3448('0x5c')][_0x3448('0x112')](db['OpenchannelAccount'],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x17c')});db[_0x3448('0x5c')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x3448('0x5c')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x160'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x5c')][_0x3448('0x115')](db['Tag'],{'through':_0x3448('0x180'),'as':_0x3448('0x172')});db[_0x3448('0x5c')]['belongsToMany'](db[_0x3448('0x87')],{'through':'openchannel_interaction_has_tags','as':_0x3448('0x162')});db[_0x3448('0x5c')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':'Users','through':_0x3448('0x120'),'foreignKey':'OpenchannelInteractionId'});db[_0x3448('0x17d')]['belongsTo'](db[_0x3448('0x13')],{'onDelete':_0x3448('0x101'),'as':_0x3448('0x13')});db[_0x3448('0x17d')]['belongsTo'](db[_0x3448('0x117')],{'onDelete':'cascade','as':_0x3448('0x163')});db[_0x3448('0x17d')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x3448('0x164'),'foreignKey':_0x3448('0x17f')});db[_0x3448('0x17d')][_0x3448('0x112')](db[_0x3448('0xdd')],{'as':_0x3448('0xdd'),'foreignKey':_0x3448('0x181')});db[_0x3448('0x17d')][_0x3448('0x112')](db[_0x3448('0x59')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x17c')});db[_0x3448('0x128')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':'UserOpenchannelQueue','foreignKey':_0x3448('0x182')});db['OpenchannelQueue']['belongsToMany'](db[_0x3448('0xd5')],{'through':_0x3448('0x183'),'as':'Teams'});db[_0x3448('0x12b')][_0x3448('0x103')](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':'ChatWebsiteId','onDelete':_0x3448('0x101')});db['ChatWebsite'][_0x3448('0x103')](db[_0x3448('0x7b')],{'as':_0x3448('0x16c'),'foreignKey':_0x3448('0x165')});db[_0x3448('0x12b')]['hasMany'](db['ChatProactiveAction'],{'as':_0x3448('0x184')});db[_0x3448('0x12b')][_0x3448('0x103')](db[_0x3448('0x62')],{'as':'Interactions'});db[_0x3448('0x12b')]['hasMany'](db['ChatApplication'],{'as':_0x3448('0x13b')});db[_0x3448('0x12b')][_0x3448('0x103')](db[_0x3448('0x185')],{'as':_0x3448('0x14d')});db[_0x3448('0x12b')][_0x3448('0x112')](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':'ListId'});db['ChatWebsite'][_0x3448('0x112')](db['Interval'],{'as':_0x3448('0x147'),'foreignKey':_0x3448('0x148')});db[_0x3448('0x12b')][_0x3448('0x112')](db[_0x3448('0x3c')],{'as':_0x3448('0x3c'),'foreignKey':_0x3448('0x154')});db['ChatWebsite']['belongsTo'](db[_0x3448('0x7e')],{'as':_0x3448('0x16f'),'foreignKey':_0x3448('0x15d')});db[_0x3448('0x12b')][_0x3448('0x115')](db['User'],{'as':_0x3448('0x14a'),'through':_0x3448('0x186')});db[_0x3448('0x5f')][_0x3448('0x112')](db[_0x3448('0x59')],{});db[_0x3448('0x5f')][_0x3448('0x112')](db['CmList'],{'as':_0x3448('0x159'),'foreignKey':'ListId'});db[_0x3448('0x5f')]['belongsTo'](db[_0x3448('0x117')],{'as':'Contact','foreignKey':_0x3448('0x153')});db[_0x3448('0x5f')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x3448('0x5f')][_0x3448('0x112')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x3448('0x112')](db[_0x3448('0x13')],{});db[_0x3448('0x5f')][_0x3448('0x112')](db[_0x3448('0x128')],{});db[_0x3448('0x187')][_0x3448('0x112')](db['User'],{'as':_0x3448('0x188'),'foreignKey':_0x3448('0x102'),'onDelete':_0x3448('0x167')});db['ChatApplication'][_0x3448('0x112')](db[_0x3448('0x66')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x3448('0x187')][_0x3448('0x112')](db['ChatWebsite'],{'as':_0x3448('0x189'),'foreignKey':_0x3448('0x165'),'onDelete':_0x3448('0x167')});db[_0x3448('0x187')]['belongsTo'](db[_0x3448('0x87')],{'onDelete':_0x3448('0x167'),'foreignKey':'TagId'});db['ChatInteraction'][_0x3448('0x103')](db['ChatMessage'],{'as':_0x3448('0x14d'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x18a')});db[_0x3448('0x62')][_0x3448('0x112')](db[_0x3448('0x12b')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x165')});db['ChatInteraction']['belongsTo'](db[_0x3448('0x117')],{'as':'Contact','foreignKey':'ContactId'});db[_0x3448('0x62')]['belongsTo'](db[_0x3448('0x13')],{'as':'Owner','foreignKey':_0x3448('0x102')});db[_0x3448('0x62')]['belongsToMany'](db[_0x3448('0x87')],{'through':'chat_interaction_has_tags','as':'Tags'});db['ChatInteraction'][_0x3448('0x115')](db[_0x3448('0x87')],{'through':_0x3448('0x18b'),'as':_0x3448('0x162')});db['ChatInteraction'][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x179'),'through':_0x3448('0x11e'),'foreignKey':_0x3448('0x18a')});db[_0x3448('0x185')]['belongsTo'](db[_0x3448('0x13')],{'onDelete':_0x3448('0x101'),'as':_0x3448('0x13')});db['ChatMessage'][_0x3448('0x112')](db[_0x3448('0x117')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x3448('0x185')]['belongsTo'](db[_0x3448('0x62')],{'onDelete':_0x3448('0x101'),'as':_0x3448('0x164'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x3448('0x112')](db[_0x3448('0xdd')],{'as':_0x3448('0xdd'),'foreignKey':_0x3448('0x181')});db['ChatMessage'][_0x3448('0x112')](db[_0x3448('0x12b')],{'as':_0x3448('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x3448('0x64')][_0x3448('0x103')](db[_0x3448('0xdd')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x3448('0x101'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x3448('0x101'),'as':'Contact','foreignKey':'ContactId'});db[_0x3448('0x64')][_0x3448('0x112')](db[_0x3448('0x12b')],{'as':'Account','foreignKey':_0x3448('0x165')});db['ChatQueue'][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x18c'),'hooks':!![]});db[_0x3448('0x66')][_0x3448('0x115')](db[_0x3448('0xd5')],{'through':_0x3448('0x18d'),'as':_0x3448('0x14b')});db[_0x3448('0x68')][_0x3448('0x103')](db[_0x3448('0xc2')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x3448('0x68')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x13e'),'through':'chat_group_has_users'});db[_0x3448('0x69')]['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x3448('0x165')});db[_0x3448('0x6b')]['hasMany'](db[_0x3448('0x117')],{'as':_0x3448('0x118'),'foreignKey':_0x3448('0x18e')});db[_0x3448('0x117')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0x3448('0x103')](db['CmHopperFinal'],{'as':_0x3448('0x107'),'foreignKey':_0x3448('0x153')});db[_0x3448('0x117')]['hasMany'](db[_0x3448('0x72')],{'as':_0x3448('0x141'),'foreignKey':_0x3448('0x153')});db['CmContact'][_0x3448('0x103')](db[_0x3448('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x3448('0x153')});db[_0x3448('0x117')][_0x3448('0x103')](db[_0x3448('0x142')],{'as':_0x3448('0x143'),'foreignKey':_0x3448('0x153')});db[_0x3448('0x117')][_0x3448('0x103')](db[_0x3448('0x5c')],{'as':_0x3448('0x109'),'foreignKey':_0x3448('0x153'),'onDelete':_0x3448('0x167')});db[_0x3448('0x117')][_0x3448('0x103')](db[_0x3448('0x62')],{'as':_0x3448('0x10a'),'foreignKey':'ContactId','onDelete':_0x3448('0x167')});db['CmContact'][_0x3448('0x103')](db[_0x3448('0x10b')],{'as':_0x3448('0x10c'),'foreignKey':_0x3448('0x153'),'onDelete':_0x3448('0x167')});db[_0x3448('0x117')][_0x3448('0x103')](db[_0x3448('0x4d')],{'as':'FaxInteractions','foreignKey':_0x3448('0x153'),'onDelete':_0x3448('0x167')});db[_0x3448('0x117')]['hasMany'](db[_0x3448('0x41')],{'as':'MailInteractions','foreignKey':_0x3448('0x153'),'onDelete':'restrict'});db[_0x3448('0x117')]['belongsTo'](db[_0x3448('0x6b')],{'as':_0x3448('0x18f'),'foreignKey':'CompanyId'});db[_0x3448('0x117')][_0x3448('0x112')](db['CmList'],{'as':'List','foreignKey':_0x3448('0x15a'),'onDelete':_0x3448('0x101')});db[_0x3448('0x117')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x179'),'through':_0x3448('0x119')});db[_0x3448('0x117')][_0x3448('0x115')](db[_0x3448('0x87')],{'as':_0x3448('0x172'),'through':'cm_contact_has_tags'});db['CmContact'][_0x3448('0x115')](db['Tag'],{'through':_0x3448('0x190'),'as':_0x3448('0x162')});db['CmHopper'][_0x3448('0x112')](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153'),'onDelete':_0x3448('0x101')});db[_0x3448('0x6e')][_0x3448('0x112')](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a'),'onDelete':_0x3448('0x101')});db[_0x3448('0x6e')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x188'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x6e')][_0x3448('0x112')](db[_0x3448('0x1d')],{'as':_0x3448('0x191'),'foreignKey':_0x3448('0x140'),'onDelete':_0x3448('0x101')});db['CmHopper']['belongsTo'](db[_0x3448('0xd9')],{'as':_0x3448('0xd9'),'foreignKey':_0x3448('0x192'),'onDelete':_0x3448('0x101')});db[_0x3448('0x6e')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x160'),'foreignKey':_0x3448('0x193')});db[_0x3448('0x6f')][_0x3448('0x112')](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153'),'onDelete':_0x3448('0x101')});db[_0x3448('0x6f')]['belongsTo'](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a'),'onDelete':'cascade'});db[_0x3448('0x6f')]['belongsTo'](db[_0x3448('0x1d')],{'as':_0x3448('0x191'),'foreignKey':_0x3448('0x140'),'onDelete':_0x3448('0x101')});db['CmHopperBlack'][_0x3448('0x112')](db[_0x3448('0xd9')],{'as':_0x3448('0xd9'),'foreignKey':_0x3448('0x192'),'onDelete':_0x3448('0x101')});db[_0x3448('0x194')][_0x3448('0x103')](db[_0x3448('0x195')],{'as':{'plural':_0x3448('0x196'),'singular':_0x3448('0x197')},'foreignKey':_0x3448('0x198'),'onDelete':_0x3448('0x101'),'hooks':!![]});db[_0x3448('0x194')]['hasMany'](db[_0x3448('0x195')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x3448('0x199'),'onDelete':_0x3448('0x101'),'hooks':!![]});db['Automation'][_0x3448('0x103')](db[_0x3448('0x78')],{'as':_0x3448('0x19a'),'foreignKey':'AutomationId','onDelete':_0x3448('0x101'),'hooks':!![]});db[_0x3448('0x16a')]['hasMany'](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x19b'),'onDelete':'cascade'});db[_0x3448('0x147')][_0x3448('0x103')](db[_0x3448('0x147')],{'as':_0x3448('0x19c'),'foreignKey':_0x3448('0x148'),'onDelete':_0x3448('0x101'),'hooks':!![],'required':![]});db[_0x3448('0x147')][_0x3448('0x103')](db[_0x3448('0x106')],{'as':_0x3448('0x19d'),'foreignKey':_0x3448('0x148'),'onDelete':'restrict'});db[_0x3448('0x147')][_0x3448('0x103')](db[_0x3448('0x44')],{'as':_0x3448('0x19e'),'foreignKey':_0x3448('0x148')});db[_0x3448('0x147')][_0x3448('0x103')](db[_0x3448('0x187')],{'as':_0x3448('0x19f'),'foreignKey':_0x3448('0x148')});db[_0x3448('0x147')][_0x3448('0x103')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x3448('0x148')});db['Interval']['hasMany'](db['SmsApplication'],{'as':_0x3448('0x1a0'),'foreignKey':'IntervalId'});db['Schedule']['belongsTo'](db[_0x3448('0x3c')],{});db[_0x3448('0x83')][_0x3448('0x112')](db[_0x3448('0x1a1')],{'foreignKey':_0x3448('0x1a2')});db[_0x3448('0x83')][_0x3448('0x112')](db[_0x3448('0x8f')],{'foreignKey':_0x3448('0x1a3')});db[_0x3448('0x85')][_0x3448('0x115')](db[_0x3448('0x1b')],{'as':_0x3448('0x1a4'),'through':'moh_has_sounds','onDelete':_0x3448('0x167')});db[_0x3448('0x87')][_0x3448('0x115')](db['CmContact'],{'through':_0x3448('0x190')});db['Tag'][_0x3448('0x115')](db[_0x3448('0x62')],{'through':_0x3448('0x18b')});db['Tag'][_0x3448('0x115')](db['MailInteraction'],{'through':_0x3448('0x161')});db[_0x3448('0x87')][_0x3448('0x115')](db[_0x3448('0x10b')],{'through':_0x3448('0x178')});db[_0x3448('0x87')]['belongsToMany'](db['FaxInteraction'],{'through':_0x3448('0x173')});db[_0x3448('0x87')][_0x3448('0x115')](db[_0x3448('0x5c')],{'through':_0x3448('0x180')});db[_0x3448('0x87')][_0x3448('0x115')](db[_0x3448('0x10f')],{'through':_0x3448('0x1a5')});db[_0x3448('0x1a6')][_0x3448('0x103')](db[_0x3448('0x195')],{'as':{'plural':_0x3448('0x1a7'),'singular':_0x3448('0x1a8')},'foreignKey':_0x3448('0x1a9'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x3448('0x103')](db[_0x3448('0x195')],{'as':{'plural':_0x3448('0x1aa'),'singular':_0x3448('0x1ab')},'foreignKey':'TriggerAnyId','onDelete':_0x3448('0x101'),'hooks':!![]});db['Trigger'][_0x3448('0x103')](db[_0x3448('0x78')],{'as':'Actions','foreignKey':_0x3448('0x1ac'),'onDelete':_0x3448('0x101'),'hooks':!![]});db[_0x3448('0x8f')][_0x3448('0x103')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1a3'),'hooks':!![]});db[_0x3448('0x1a1')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x3448('0x1ad'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1a2')});db[_0x3448('0x94')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x3448('0x1ad'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x3448('0x96')][_0x3448('0x112')](db['AnalyticMetric'],{'foreignKey':_0x3448('0x1ae')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db['SalesforceConfiguration'][_0x3448('0x103')](db[_0x3448('0x9c')],{'as':_0x3448('0x1b1'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b2')});db[_0x3448('0x1b3')][_0x3448('0x103')](db[_0x3448('0x9c')],{'as':_0x3448('0x1b4'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b5')});db['SalesforceConfiguration'][_0x3448('0x103')](db[_0x3448('0x9c')],{'as':_0x3448('0x1ad'),'onDelete':'cascade','foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x3448('0x112')](db[_0x3448('0x99')],{'as':'Account','foreignKey':_0x3448('0x1b0')});db[_0x3448('0x9c')]['hasMany'](db[_0x3448('0x9c')],{'as':'Subject','foreignKey':_0x3448('0x1b2')});db[_0x3448('0x9c')][_0x3448('0x103')](db[_0x3448('0x9c')],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db['SalesforceField'][_0x3448('0x103')](db[_0x3448('0x9c')],{'as':_0x3448('0x1b7'),'foreignKey':_0x3448('0x1b8')});db['SalesforceField'][_0x3448('0x112')](db[_0x3448('0x1b9')],{'as':'Variable','foreignKey':_0x3448('0x1ba')});db['SugarcrmAccount'][_0x3448('0x103')](db[_0x3448('0x1bb')],{'as':_0x3448('0x1af'),'onDelete':'cascade','foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1bb')][_0x3448('0x103')](db[_0x3448('0x1bc')],{'as':'Subjects','onDelete':_0x3448('0x101'),'foreignKey':'SubjectId'});db[_0x3448('0x1bb')][_0x3448('0x103')](db['SugarcrmField'],{'as':_0x3448('0x1b4'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x3448('0x1bb')][_0x3448('0x103')](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x3448('0x1b8')});db[_0x3448('0x1bb')][_0x3448('0x112')](db[_0x3448('0x1bd')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db['SugarcrmField'][_0x3448('0x103')](db[_0x3448('0x1bc')],{'as':'Subject','foreignKey':_0x3448('0x1b2')});db['SugarcrmField'][_0x3448('0x103')](db[_0x3448('0x1bc')],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0x1bc')][_0x3448('0x103')](db[_0x3448('0x1bc')],{'as':_0x3448('0x1b7'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x3448('0x112')](db[_0x3448('0x1b9')],{'as':_0x3448('0x1b9'),'foreignKey':'VariableId'});db[_0x3448('0xa0')][_0x3448('0x103')](db[_0x3448('0xa1')],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0xa1')][_0x3448('0x103')](db[_0x3448('0xa2')],{'as':_0x3448('0x1b1'),'onDelete':'cascade','foreignKey':_0x3448('0x1b2')});db[_0x3448('0xa1')][_0x3448('0x103')](db['DeskField'],{'as':_0x3448('0x1b4'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0xa1')]['hasMany'](db['DeskField'],{'as':_0x3448('0x1ad'),'onDelete':_0x3448('0x101'),'foreignKey':'FieldId'});db[_0x3448('0xa1')][_0x3448('0x112')](db[_0x3448('0xa0')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db['DeskConfiguration'][_0x3448('0x115')](db[_0x3448('0x87')],{'through':_0x3448('0x1be')});db[_0x3448('0xa2')][_0x3448('0x103')](db[_0x3448('0xa2')],{'as':_0x3448('0x1bf'),'foreignKey':'SubjectId'});db['DeskField']['hasMany'](db[_0x3448('0xa2')],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0xa2')][_0x3448('0x103')](db[_0x3448('0xa2')],{'as':_0x3448('0x1b7'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0xa2')]['belongsTo'](db[_0x3448('0x1b9')],{'as':_0x3448('0x1b9'),'foreignKey':'VariableId'});db[_0x3448('0xa4')][_0x3448('0x103')](db[_0x3448('0xa6')],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0xa6')][_0x3448('0x103')](db['ZohoField'],{'as':_0x3448('0x1b1'),'onDelete':_0x3448('0x101'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x3448('0x103')](db[_0x3448('0x1c0')],{'as':_0x3448('0x1b4'),'onDelete':'cascade','foreignKey':_0x3448('0x1b5')});db[_0x3448('0xa6')]['hasMany'](db[_0x3448('0x1c0')],{'as':_0x3448('0x1ad'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0xa6')][_0x3448('0x112')](db[_0x3448('0xa4')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1c0')][_0x3448('0x103')](db[_0x3448('0x1c0')],{'as':_0x3448('0x1bf'),'foreignKey':'SubjectId'});db[_0x3448('0x1c0')][_0x3448('0x103')](db['ZohoField'],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0x1c0')][_0x3448('0x103')](db[_0x3448('0x1c0')],{'as':_0x3448('0x1b7'),'foreignKey':'FieldId'});db[_0x3448('0x1c0')][_0x3448('0x112')](db[_0x3448('0x1b9')],{'as':_0x3448('0x1b9'),'foreignKey':_0x3448('0x1ba')});db[_0x3448('0xa9')][_0x3448('0x103')](db['ZendeskConfiguration'],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0xab')]['hasMany'](db[_0x3448('0x1c1')],{'as':_0x3448('0x1b1'),'foreignKey':_0x3448('0x1b2')});db[_0x3448('0xab')][_0x3448('0x103')](db['ZendeskField'],{'as':_0x3448('0x1b4'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0xab')]['hasMany'](db[_0x3448('0x1c1')],{'as':_0x3448('0x1ad'),'foreignKey':'FieldId'});db[_0x3448('0xab')][_0x3448('0x112')](db['ZendeskAccount'],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db['ZendeskConfiguration'][_0x3448('0x115')](db[_0x3448('0x87')],{'through':_0x3448('0x1c2')});db[_0x3448('0x1c1')][_0x3448('0x103')](db[_0x3448('0x1c1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3448('0x1c1')][_0x3448('0x103')](db[_0x3448('0x1c1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3448('0x1c1')][_0x3448('0x103')](db[_0x3448('0x1c1')],{'as':_0x3448('0x1b7'),'foreignKey':_0x3448('0x1b8')});db['ZendeskField'][_0x3448('0x112')](db['Variable'],{'as':_0x3448('0x1b9'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x3448('0x103')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0xaf')]['hasMany'](db['FreshdeskField'],{'as':_0x3448('0x1b1'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b2')});db[_0x3448('0xaf')]['hasMany'](db['FreshdeskField'],{'as':_0x3448('0x1b4'),'onDelete':'cascade','foreignKey':_0x3448('0x1b5')});db[_0x3448('0xaf')][_0x3448('0x103')](db[_0x3448('0xb1')],{'as':_0x3448('0x1ad'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0xaf')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x3448('0x15f'),'foreignKey':'AccountId'});db[_0x3448('0xaf')][_0x3448('0x115')](db[_0x3448('0x87')],{'through':_0x3448('0x1c3')});db[_0x3448('0xb1')][_0x3448('0x103')](db['FreshdeskField'],{'as':_0x3448('0x1bf'),'foreignKey':'SubjectId'});db[_0x3448('0xb1')][_0x3448('0x103')](db[_0x3448('0xb1')],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0xb1')]['hasMany'](db[_0x3448('0xb1')],{'as':_0x3448('0x1b7'),'foreignKey':'FieldId'});db[_0x3448('0xb1')]['belongsTo'](db[_0x3448('0x1b9')],{'as':_0x3448('0x1b9'),'foreignKey':_0x3448('0x1ba')});db[_0x3448('0xb3')][_0x3448('0x103')](db['VtigerConfiguration'],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1c4')][_0x3448('0x103')](db[_0x3448('0x1c5')],{'as':_0x3448('0x1b1'),'foreignKey':_0x3448('0x1b2')});db['VtigerConfiguration'][_0x3448('0x103')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x3448('0x1b5')});db[_0x3448('0x1c4')][_0x3448('0x103')](db[_0x3448('0x1c5')],{'as':_0x3448('0x1ad'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0x1c4')][_0x3448('0x112')](db[_0x3448('0xb3')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1c5')][_0x3448('0x103')](db['VtigerField'],{'as':_0x3448('0x1bf'),'foreignKey':_0x3448('0x1b2')});db['VtigerField']['hasMany'](db[_0x3448('0x1c5')],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0x1c5')][_0x3448('0x103')](db[_0x3448('0x1c5')],{'as':'Field','foreignKey':_0x3448('0x1b8')});db[_0x3448('0x1c5')][_0x3448('0x112')](db[_0x3448('0x1b9')],{'as':'Variable','foreignKey':'VariableId'});db['ServicenowAccount'][_0x3448('0x103')](db[_0x3448('0xb8')],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0xb8')]['hasMany'](db['ServicenowField'],{'as':_0x3448('0x1b1'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x3448('0x103')](db[_0x3448('0xb9')],{'as':'Descriptions','foreignKey':_0x3448('0x1b5')});db['ServicenowConfiguration'][_0x3448('0x103')](db[_0x3448('0xb9')],{'as':_0x3448('0x1ad'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0xb8')][_0x3448('0x112')](db[_0x3448('0xb7')],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0xb9')]['hasMany'](db[_0x3448('0xb9')],{'as':_0x3448('0x1bf'),'foreignKey':_0x3448('0x1b2')});db['ServicenowField'][_0x3448('0x103')](db[_0x3448('0xb9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3448('0xb9')][_0x3448('0x103')](db[_0x3448('0xb9')],{'as':'Field','foreignKey':_0x3448('0x1b8')});db[_0x3448('0xb9')][_0x3448('0x112')](db['Variable'],{'as':_0x3448('0x1b9'),'foreignKey':_0x3448('0x1ba')});db[_0x3448('0x1c6')][_0x3448('0x103')](db[_0x3448('0x1c7')],{'as':_0x3448('0x1af'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1c7')]['hasMany'](db[_0x3448('0x1c8')],{'as':_0x3448('0x1b1'),'onDelete':'cascade','foreignKey':_0x3448('0x1b2')});db['Dynamics365Configuration'][_0x3448('0x103')](db[_0x3448('0x1c8')],{'as':_0x3448('0x1b4'),'onDelete':_0x3448('0x101'),'foreignKey':'DescriptionId'});db[_0x3448('0x1c7')][_0x3448('0x103')](db[_0x3448('0x1c8')],{'as':_0x3448('0x1ad'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0x1c7')][_0x3448('0x112')](db['Dynamics365Account'],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1b0')});db['Dynamics365Field'][_0x3448('0x103')](db[_0x3448('0x1c8')],{'as':_0x3448('0x1bf'),'foreignKey':'SubjectId'});db['Dynamics365Field']['hasMany'](db[_0x3448('0x1c8')],{'as':_0x3448('0x1b6'),'foreignKey':'DescriptionId'});db[_0x3448('0x1c8')][_0x3448('0x103')](db[_0x3448('0x1c8')],{'as':'Field','foreignKey':_0x3448('0x1b8')});db[_0x3448('0x1c8')][_0x3448('0x112')](db[_0x3448('0x1b9')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount'][_0x3448('0x103')](db[_0x3448('0x1c9')],{'as':'Configurations','onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1c9')]['hasMany'](db[_0x3448('0x1ca')],{'as':_0x3448('0x1b1'),'foreignKey':_0x3448('0x1b2')});db[_0x3448('0x1c9')][_0x3448('0x103')](db['FreshsalesField'],{'as':_0x3448('0x1b4'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x3448('0x103')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x3448('0x1b8')});db['FreshsalesConfiguration'][_0x3448('0x112')](db[_0x3448('0xbd')],{'as':'Account','foreignKey':_0x3448('0x1b0')});db[_0x3448('0x1ca')][_0x3448('0x103')](db['FreshsalesField'],{'as':_0x3448('0x1bf'),'foreignKey':'SubjectId'});db[_0x3448('0x1ca')][_0x3448('0x103')](db['FreshsalesField'],{'as':_0x3448('0x1b6'),'foreignKey':_0x3448('0x1b5')});db[_0x3448('0x1ca')][_0x3448('0x103')](db[_0x3448('0x1ca')],{'as':_0x3448('0x1b7'),'foreignKey':_0x3448('0x1b8')});db[_0x3448('0x1ca')][_0x3448('0x112')](db[_0x3448('0x1b9')],{'as':_0x3448('0x1b9'),'foreignKey':_0x3448('0x1ba')});db[_0x3448('0xc1')][_0x3448('0x112')](db[_0x3448('0x12b')],{});db['ChatQueueReport'][_0x3448('0x112')](db['CmList'],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db['ChatQueueReport']['belongsTo'](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':'ContactId'});db[_0x3448('0xc1')][_0x3448('0x112')](db[_0x3448('0x62')],{});db[_0x3448('0xc1')][_0x3448('0x112')](db[_0x3448('0x185')],{});db[_0x3448('0xc1')][_0x3448('0x112')](db['User'],{});db[_0x3448('0xc1')][_0x3448('0x112')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x3448('0x112')](db[_0x3448('0x13')],{'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1cb')});db[_0x3448('0xc2')][_0x3448('0x112')](db[_0x3448('0x13')],{'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x1cc')});db[_0x3448('0x142')][_0x3448('0x103')](db[_0x3448('0x1cd')],{'foreignKey':_0x3448('0x1ce'),'onDelete':_0x3448('0x101')});db[_0x3448('0x142')][_0x3448('0x103')](db[_0x3448('0x1cf')],{'foreignKey':_0x3448('0x1ce'),'onDelete':_0x3448('0x101')});db[_0x3448('0xc5')][_0x3448('0x112')](db[_0x3448('0x52')],{});db['SmsQueueReport']['belongsTo'](db[_0x3448('0xe7')],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db[_0x3448('0xc5')]['belongsTo'](db['CmContact'],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153')});db[_0x3448('0xc5')][_0x3448('0x112')](db[_0x3448('0x10b')],{});db['SmsQueueReport']['belongsTo'](db['SmsMessage'],{});db[_0x3448('0xc5')][_0x3448('0x112')](db[_0x3448('0x13')],{});db[_0x3448('0xc5')][_0x3448('0x112')](db[_0x3448('0x58')],{});db[_0x3448('0xc9')][_0x3448('0x103')](db[_0x3448('0x142')],{'foreignKey':'ProjectId'});db[_0x3448('0xc9')][_0x3448('0x103')](db[_0x3448('0x1cd')],{'foreignKey':_0x3448('0x1d0')});db['JscriptyProject']['hasMany'](db[_0x3448('0x1cf')],{'foreignKey':'ProjectId'});db[_0x3448('0xcf')]['belongsToMany'](db[_0x3448('0x13')],{'as':'Users','through':_0x3448('0x138')});db[_0x3448('0xd5')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x11c')});db['Team'][_0x3448('0x115')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x3448('0x1d1')});db[_0x3448('0xd5')][_0x3448('0x115')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x3448('0x123')});db['Team'][_0x3448('0x115')](db['ChatQueue'],{'through':_0x3448('0x18d'),'as':_0x3448('0x125')});db[_0x3448('0xd5')][_0x3448('0x115')](db[_0x3448('0x50')],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team']['belongsToMany'](db[_0x3448('0x58')],{'through':_0x3448('0x17b'),'as':_0x3448('0x127')});db[_0x3448('0xd5')][_0x3448('0x115')](db[_0x3448('0x128')],{'through':_0x3448('0x183'),'as':_0x3448('0x129')});db[_0x3448('0xd5')][_0x3448('0x115')](db[_0x3448('0xfa')],{'through':_0x3448('0x1d2'),'as':_0x3448('0x12a')});db['Team'][_0x3448('0x115')](db[_0x3448('0xe9')],{'through':_0x3448('0x1d3'),'as':_0x3448('0x122')});db['Campaign'][_0x3448('0x103')](db[_0x3448('0x6e')],{'as':_0x3448('0x13f'),'foreignKey':_0x3448('0x192')});db[_0x3448('0xd9')]['hasMany'](db['CmHopperFinal'],{'as':_0x3448('0x107'),'foreignKey':_0x3448('0x192')});db[_0x3448('0xd9')][_0x3448('0x103')](db[_0x3448('0x72')],{'as':_0x3448('0x141'),'foreignKey':_0x3448('0x192')});db[_0x3448('0xd9')]['hasMany'](db[_0x3448('0x6f')],{'as':_0x3448('0x1d4'),'foreignKey':_0x3448('0x192')});db[_0x3448('0xd9')]['belongsTo'](db[_0x3448('0x2c')],{'as':'Trunk','foreignKey':_0x3448('0x144')});db['Campaign'][_0x3448('0x112')](db[_0x3448('0x2c')],{'as':_0x3448('0x145'),'foreignKey':_0x3448('0x146')});db[_0x3448('0xd9')]['belongsTo'](db[_0x3448('0x147')],{'as':_0x3448('0x147'),'foreignKey':'IntervalId'});db['Campaign'][_0x3448('0x112')](db[_0x3448('0xcf')],{'as':_0x3448('0xcf'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0x3448('0x11a'),'through':_0x3448('0x1d5')});db['Campaign'][_0x3448('0x115')](db[_0x3448('0xe7')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db[_0x3448('0x64')],{'as':_0x3448('0x64'),'foreignKey':_0x3448('0x166')});db[_0x3448('0x1d6')][_0x3448('0x112')](db[_0x3448('0x43')],{});db[_0x3448('0x1d6')][_0x3448('0x112')](db['MailInteraction'],{});db[_0x3448('0x1d6')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x3448('0x1d6')][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':'FromUserId','as':_0x3448('0x1d7')});db['MailTransferReport'][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1d8'),'as':_0x3448('0x1d9')});db[_0x3448('0x1d6')][_0x3448('0x112')](db[_0x3448('0x3d')],{'foreignKey':_0x3448('0x1da'),'as':'ToQueue'});db[_0x3448('0x1d6')]['belongsTo'](db[_0x3448('0x3c')],{'foreignKey':_0x3448('0x1db'),'as':'ToAccount'});db[_0x3448('0x1dc')][_0x3448('0x112')](db[_0x3448('0x185')],{});db[_0x3448('0x1dc')][_0x3448('0x112')](db[_0x3448('0x62')],{});db[_0x3448('0x1dc')][_0x3448('0x112')](db[_0x3448('0x12b')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x3448('0x1dc')]['belongsTo'](db['User'],{'foreignKey':_0x3448('0x1dd'),'as':'FromAgent'});db[_0x3448('0x1dc')][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x3448('0x1dc')][_0x3448('0x112')](db[_0x3448('0x66')],{'foreignKey':_0x3448('0x1de'),'as':'ToQueue'});db[_0x3448('0x1dc')][_0x3448('0x112')](db['ChatWebsite'],{'foreignKey':_0x3448('0x1df'),'as':_0x3448('0x1e0')});db['FaxTransferReport'][_0x3448('0x112')](db[_0x3448('0x4e')],{});db[_0x3448('0xe2')][_0x3448('0x112')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x3448('0x112')](db['FaxAccount'],{'foreignKey':_0x3448('0x1e1'),'as':_0x3448('0x1e2')});db[_0x3448('0xe2')][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':'FromUserId','as':_0x3448('0x1d7')});db[_0x3448('0xe2')]['belongsTo'](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1d8'),'as':_0x3448('0x1d9')});db[_0x3448('0xe2')][_0x3448('0x112')](db[_0x3448('0x50')],{'foreignKey':_0x3448('0x1e3'),'as':_0x3448('0x1e4')});db[_0x3448('0xe2')][_0x3448('0x112')](db['FaxAccount'],{'foreignKey':_0x3448('0x1e5'),'as':'ToAccount'});db[_0x3448('0xe4')][_0x3448('0x112')](db[_0x3448('0x17d')],{});db[_0x3448('0xe4')][_0x3448('0x112')](db[_0x3448('0x5c')],{});db[_0x3448('0xe4')][_0x3448('0x112')](db['OpenchannelAccount'],{'foreignKey':_0x3448('0x1e6'),'as':_0x3448('0x1e2')});db[_0x3448('0xe4')]['belongsTo'](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1dd'),'as':_0x3448('0x1d7')});db[_0x3448('0xe4')][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':'ToUserId','as':_0x3448('0x1d9')});db[_0x3448('0xe4')][_0x3448('0x112')](db[_0x3448('0x128')],{'foreignKey':_0x3448('0x1e7'),'as':'ToQueue'});db[_0x3448('0xe4')][_0x3448('0x112')](db[_0x3448('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x3448('0x1e8')]['belongsTo'](db[_0x3448('0x56')],{});db[_0x3448('0x1e8')]['belongsTo'](db[_0x3448('0x10b')],{});db[_0x3448('0x1e8')][_0x3448('0x112')](db[_0x3448('0x52')],{'foreignKey':_0x3448('0x1e9'),'as':_0x3448('0x1e2')});db[_0x3448('0x1e8')][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1dd'),'as':_0x3448('0x1d7')});db[_0x3448('0x1e8')]['belongsTo'](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1d8'),'as':_0x3448('0x1d9')});db[_0x3448('0x1e8')][_0x3448('0x112')](db[_0x3448('0x58')],{'foreignKey':_0x3448('0x1ea'),'as':_0x3448('0x1e4')});db[_0x3448('0x1e8')][_0x3448('0x112')](db['SmsAccount'],{'foreignKey':_0x3448('0x1eb'),'as':'ToAccount'});db[_0x3448('0xe7')][_0x3448('0x103')](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x15a'),'onDelete':'cascade'});db['CmList'][_0x3448('0x103')](db[_0x3448('0x76')],{'as':'CustomFields','foreignKey':_0x3448('0x15a')});db['CmList'][_0x3448('0x103')](db[_0x3448('0x117')],{'as':_0x3448('0x118'),'onDelete':_0x3448('0x101'),'foreignKey':_0x3448('0x15a')});db[_0x3448('0xe7')][_0x3448('0x103')](db['CmHopperFinal'],{'as':_0x3448('0x107'),'foreignKey':_0x3448('0x15a')});db[_0x3448('0xe7')][_0x3448('0x103')](db[_0x3448('0x72')],{'as':_0x3448('0x108'),'foreignKey':_0x3448('0x15a')});db[_0x3448('0xe7')][_0x3448('0x103')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x3448('0x15a')});db[_0x3448('0xe7')][_0x3448('0x115')](db[_0x3448('0x1d')],{'as':'Queues','through':_0x3448('0x149')});db[_0x3448('0xe7')]['belongsToMany'](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x11b')});db[_0x3448('0xe9')][_0x3448('0x103')](db[_0x3448('0x106')],{'as':_0x3448('0x19d'),'onDelete':_0x3448('0x101')});db[_0x3448('0xe9')][_0x3448('0x115')](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x1ec')});db[_0x3448('0xe9')][_0x3448('0x115')](db[_0x3448('0xd5')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x3448('0x113')][_0x3448('0x103')](db[_0x3448('0x13')],{'as':_0x3448('0x179'),'foreignKey':_0x3448('0x114')});db['UserProfile'][_0x3448('0x103')](db[_0x3448('0x1ed')],{'as':_0x3448('0x1ee'),'foreignKey':_0x3448('0x114'),'onDelete':_0x3448('0x101')});db['UserProfileSection'][_0x3448('0x103')](db[_0x3448('0xed')],{'as':_0x3448('0x1ef'),'foreignKey':_0x3448('0x1f0'),'onDelete':'cascade'});db[_0x3448('0xf1')]['hasMany'](db[_0x3448('0x16a')],{'as':_0x3448('0x158'),'foreignKey':_0x3448('0x1f1'),'onDelete':_0x3448('0x101')});db['WhatsappAccount'][_0x3448('0x103')](db[_0x3448('0x7b')],{'as':'Answers','foreignKey':_0x3448('0x1f1')});db['WhatsappAccount'][_0x3448('0x103')](db[_0x3448('0xf4')],{'as':_0x3448('0x14d'),'foreignKey':_0x3448('0x1f1')});db['WhatsappAccount']['hasMany'](db[_0x3448('0x10f')],{'as':_0x3448('0x16d')});db[_0x3448('0xf1')][_0x3448('0x103')](db[_0x3448('0x1f2')],{'as':_0x3448('0x13b')});db[_0x3448('0xf1')]['belongsTo'](db[_0x3448('0xe7')],{'as':'List','foreignKey':_0x3448('0x15a')});db['WhatsappAccount'][_0x3448('0x112')](db[_0x3448('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0x3448('0x15d')});db[_0x3448('0xf1')]['belongsToMany'](db[_0x3448('0x13')],{'as':_0x3448('0x14a'),'through':_0x3448('0x136')});db[_0x3448('0x1f2')]['belongsTo'](db['User'],{'onDelete':_0x3448('0x167')});db['WhatsappApplication'][_0x3448('0x112')](db[_0x3448('0xfa')],{'onDelete':'restrict'});db[_0x3448('0x1f2')]['belongsTo'](db[_0x3448('0xf1')],{'onDelete':_0x3448('0x167')});db[_0x3448('0x1f2')][_0x3448('0x112')](db[_0x3448('0x147')],{'onDelete':_0x3448('0x167'),'foreignKey':_0x3448('0x148')});db[_0x3448('0x1f2')][_0x3448('0x112')](db[_0x3448('0x87')],{'onDelete':_0x3448('0x167'),'foreignKey':'TagId'});db[_0x3448('0x10f')][_0x3448('0x103')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x3448('0x101'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0x3448('0xf1')],{'as':_0x3448('0x15f'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x3448('0x112')](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':'ContactId'});db[_0x3448('0x10f')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x160'),'foreignKey':_0x3448('0x102')});db[_0x3448('0x10f')][_0x3448('0x115')](db[_0x3448('0x87')],{'through':_0x3448('0x1a5'),'as':_0x3448('0x172')});db[_0x3448('0x10f')][_0x3448('0x115')](db[_0x3448('0x87')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x3448('0x10f')]['belongsToMany'](db['User'],{'as':_0x3448('0x179'),'through':_0x3448('0x1f3'),'foreignKey':_0x3448('0x1f4')});db[_0x3448('0xf4')][_0x3448('0x112')](db[_0x3448('0x13')],{'as':_0x3448('0x13')});db[_0x3448('0xf4')][_0x3448('0x112')](db[_0x3448('0x117')],{'onDelete':_0x3448('0x101'),'as':'Contact'});db['WhatsappMessage'][_0x3448('0x112')](db[_0x3448('0x10f')],{'onDelete':_0x3448('0x101'),'as':_0x3448('0x164'),'foreignKey':'WhatsappInteractionId'});db[_0x3448('0xf4')][_0x3448('0x112')](db['WhatsappAccount'],{'as':_0x3448('0x15f'),'foreignKey':_0x3448('0x1f1')});db[_0x3448('0xf6')]['belongsTo'](db[_0x3448('0xf1')],{});db[_0x3448('0xf6')][_0x3448('0x112')](db['CmList'],{'as':_0x3448('0x159'),'foreignKey':_0x3448('0x15a')});db['WhatsappQueueReport']['belongsTo'](db[_0x3448('0x117')],{'as':_0x3448('0x163'),'foreignKey':_0x3448('0x153')});db['WhatsappQueueReport']['belongsTo'](db[_0x3448('0x10f')],{});db[_0x3448('0xf6')][_0x3448('0x112')](db[_0x3448('0xfa')],{});db[_0x3448('0xf6')][_0x3448('0x112')](db[_0x3448('0xf4')],{});db[_0x3448('0xf6')][_0x3448('0x112')](db[_0x3448('0x13')],{});db[_0x3448('0xf8')][_0x3448('0x112')](db[_0x3448('0xf4')],{});db['WhatsappTransferReport'][_0x3448('0x112')](db[_0x3448('0x10f')],{});db[_0x3448('0xf8')][_0x3448('0x112')](db['WhatsappAccount'],{'foreignKey':_0x3448('0x1f5'),'as':_0x3448('0x1e2')});db[_0x3448('0xf8')][_0x3448('0x112')](db[_0x3448('0xf1')],{'foreignKey':_0x3448('0x1f6'),'as':_0x3448('0x1e0')});db[_0x3448('0xf8')][_0x3448('0x112')](db[_0x3448('0xfa')],{'foreignKey':_0x3448('0x1f7'),'as':_0x3448('0x1e4')});db[_0x3448('0xf8')][_0x3448('0x112')](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1dd'),'as':_0x3448('0x1d7')});db[_0x3448('0xf8')]['belongsTo'](db[_0x3448('0x13')],{'foreignKey':_0x3448('0x1d8'),'as':_0x3448('0x1d9')});db['WhatsappQueue'][_0x3448('0x115')](db[_0x3448('0x13')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x3448('0xfa')][_0x3448('0x115')](db['Team'],{'through':_0x3448('0x1d2'),'as':_0x3448('0x14b')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c2235b5..16f33bf 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4244=['./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/realtime','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','password','newPassword','apiKey','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','includes','path','express','util','./config/environment','./config/logger','api','./safe-template','safeTemplate','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','name','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/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/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings'];(function(_0x3b3a61,_0x268cc3){var _0x4381f4=function(_0xd52674){while(--_0xd52674){_0x3b3a61['push'](_0x3b3a61['shift']());}};_0x4381f4(++_0x268cc3);}(_0x4244,0x68));var _0x4424=function(_0x3b72a3,_0x99baa8){_0x3b72a3=_0x3b72a3-0x0;var _0xc0fb0b=_0x4244[_0x3b72a3];return _0xc0fb0b;};'use strict';var _=require('lodash');var path=require(_0x4424('0x0'));var express=require(_0x4424('0x1'));var ewinston=require('express-winston');var util=require(_0x4424('0x2'));var errors=require('./errors');var config=require(_0x4424('0x3'));var logger=require(_0x4424('0x4'))(_0x4424('0x5'));var authLogger=require(_0x4424('0x4'))('auth');var safeTemplate=require(_0x4424('0x6'))[_0x4424('0x7')];exports['default']=function(_0x28e41f){_0x28e41f[_0x4424('0x8')](ewinston[_0x4424('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x42f3b0,_0x132fb3){var _0x211b75=_0x4424('0xa');if(!_['isEmpty'](_0x42f3b0[_0x4424('0xb')])){_0x211b75+='\x20body=%s';var _0x413668=_0x42f3b0[_0x4424('0xb')];maskSensitiveData(_0x413668);}return safeTemplate(util['format'](_0x211b75,_0x42f3b0[_0x4424('0xc')],_0x42f3b0[_0x4424('0xd')]['x-forwarded-for']?_0x42f3b0[_0x4424('0xd')][_0x4424('0xe')]:_0x42f3b0[_0x4424('0xf')][_0x4424('0x10')]||_0x42f3b0['ip'],_0x42f3b0['url'],_0x132fb3[_0x4424('0x11')],_0x132fb3[_0x4424('0x12')],_0x42f3b0[_0x4424('0x13')]?_0x42f3b0[_0x4424('0x13')]['id']:null,_0x42f3b0[_0x4424('0x13')]?_0x42f3b0['user']['name']:null,_0x42f3b0[_0x4424('0x13')]?_0x42f3b0[_0x4424('0x13')]['role']:null,_0x413668?util[_0x4424('0x14')](_0x413668,![],null):''));}}));_0x28e41f[_0x4424('0x8')](ewinston[_0x4424('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4e6a44,_0x1a5a31){var _0x350cbc=_0x4424('0x15');if(_0x4e6a44['body']&&_0x4e6a44[_0x4424('0xb')][_0x4424('0x16')]&&_0x4e6a44['body'][_0x4424('0x17')]){_0x350cbc=_0x4424('0x18');}return util[_0x4424('0x19')](_0x350cbc,_0x4e6a44[_0x4424('0xc')],_0x4e6a44[_0x4424('0xd')][_0x4424('0xe')]?_0x4e6a44[_0x4424('0xd')]['x-forwarded-for']:_0x4e6a44[_0x4424('0xf')][_0x4424('0x10')]||_0x4e6a44['ip'],_0x4e6a44[_0x4424('0x1a')],_0x1a5a31[_0x4424('0x11')],_0x1a5a31[_0x4424('0x12')],_0x4e6a44['user']?_0x4e6a44[_0x4424('0x13')]['id']:null,_0x4e6a44[_0x4424('0x13')]?_0x4e6a44[_0x4424('0x13')][_0x4424('0x1b')]:null,_0x4e6a44[_0x4424('0x13')]?_0x4e6a44[_0x4424('0x13')][_0x4424('0x1c')]:null,_0x4e6a44[_0x4424('0xb')]&&_0x4e6a44[_0x4424('0xb')][_0x4424('0x16')]?_0x4e6a44[_0x4424('0xb')][_0x4424('0x16')]:_0x4424('0x1d'),_0x4e6a44[_0x4424('0xb')]&&_0x4e6a44[_0x4424('0xb')][_0x4424('0x17')]?_0x4e6a44[_0x4424('0xb')][_0x4424('0x17')]:'',_0x4e6a44['body']&&_0x4e6a44[_0x4424('0xb')][_0x4424('0x1e')]?_0x4e6a44['body'][_0x4424('0x1e')]:'');},'ignoreRoute':function(_0x35ca9d){var _0x43fee0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x43fee0[_0x4424('0x1f')](_0x35ca9d[_0x4424('0x1a')]);}}));_0x28e41f[_0x4424('0x8')](_0x4424('0x20'),require(_0x4424('0x21')));_0x28e41f[_0x4424('0x8')](_0x4424('0x22'),require(_0x4424('0x23')));_0x28e41f['use'](_0x4424('0x24'),require(_0x4424('0x25')));_0x28e41f[_0x4424('0x8')](_0x4424('0x26'),require(_0x4424('0x27')));_0x28e41f[_0x4424('0x8')](_0x4424('0x28'),require(_0x4424('0x29')));_0x28e41f[_0x4424('0x8')](_0x4424('0x2a'),require(_0x4424('0x2b')));_0x28e41f[_0x4424('0x8')](_0x4424('0x2c'),require('./api/voiceRecording'));_0x28e41f[_0x4424('0x8')](_0x4424('0x2d'),require(_0x4424('0x2e')));_0x28e41f[_0x4424('0x8')]('/api/voice/mails',require(_0x4424('0x2f')));_0x28e41f[_0x4424('0x8')](_0x4424('0x30'),require('./api/voiceMailMessage'));_0x28e41f['use']('/api/voice/calls/reports',require(_0x4424('0x31')));_0x28e41f['use'](_0x4424('0x32'),require(_0x4424('0x33')));_0x28e41f[_0x4424('0x8')](_0x4424('0x34'),require(_0x4424('0x35')));_0x28e41f['use'](_0x4424('0x36'),require('./api/voiceQueueReport'));_0x28e41f[_0x4424('0x8')]('/api/members/reports',require(_0x4424('0x37')));_0x28e41f[_0x4424('0x8')](_0x4424('0x38'),require(_0x4424('0x39')));_0x28e41f[_0x4424('0x8')](_0x4424('0x3a'),require(_0x4424('0x3b')));_0x28e41f['use']('/api/mail/out_servers',require(_0x4424('0x3c')));_0x28e41f[_0x4424('0x8')](_0x4424('0x3d'),require(_0x4424('0x3e')));_0x28e41f[_0x4424('0x8')](_0x4424('0x3f'),require(_0x4424('0x40')));_0x28e41f[_0x4424('0x8')](_0x4424('0x41'),require('./api/mailSubstatus'));_0x28e41f[_0x4424('0x8')](_0x4424('0x42'),require(_0x4424('0x43')));_0x28e41f[_0x4424('0x8')]('/api/mail/messages',require(_0x4424('0x44')));_0x28e41f[_0x4424('0x8')](_0x4424('0x45'),require(_0x4424('0x46')));_0x28e41f[_0x4424('0x8')](_0x4424('0x47'),require(_0x4424('0x48')));_0x28e41f[_0x4424('0x8')](_0x4424('0x49'),require(_0x4424('0x4a')));_0x28e41f[_0x4424('0x8')](_0x4424('0x4b'),require(_0x4424('0x4c')));_0x28e41f[_0x4424('0x8')](_0x4424('0x4d'),require(_0x4424('0x4e')));_0x28e41f['use'](_0x4424('0x4f'),require(_0x4424('0x50')));_0x28e41f[_0x4424('0x8')](_0x4424('0x51'),require(_0x4424('0x52')));_0x28e41f['use']('/api/fax/messages',require(_0x4424('0x53')));_0x28e41f[_0x4424('0x8')](_0x4424('0x54'),require(_0x4424('0x55')));_0x28e41f[_0x4424('0x8')](_0x4424('0x56'),require(_0x4424('0x57')));_0x28e41f['use'](_0x4424('0x58'),require(_0x4424('0x59')));_0x28e41f[_0x4424('0x8')]('/api/sms/applications',require(_0x4424('0x5a')));_0x28e41f[_0x4424('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x28e41f[_0x4424('0x8')](_0x4424('0x5b'),require(_0x4424('0x5c')));_0x28e41f[_0x4424('0x8')](_0x4424('0x5d'),require(_0x4424('0x5e')));_0x28e41f[_0x4424('0x8')](_0x4424('0x5f'),require('./api/openchannelAccount'));_0x28e41f[_0x4424('0x8')](_0x4424('0x60'),require(_0x4424('0x61')));_0x28e41f['use'](_0x4424('0x62'),require(_0x4424('0x63')));_0x28e41f[_0x4424('0x8')](_0x4424('0x64'),require(_0x4424('0x65')));_0x28e41f[_0x4424('0x8')](_0x4424('0x66'),require(_0x4424('0x67')));_0x28e41f[_0x4424('0x8')](_0x4424('0x68'),require('./api/chatWebsite'));_0x28e41f[_0x4424('0x8')](_0x4424('0x69'),require(_0x4424('0x6a')));_0x28e41f['use'](_0x4424('0x6b'),require(_0x4424('0x6c')));_0x28e41f[_0x4424('0x8')](_0x4424('0x6d'),require(_0x4424('0x6e')));_0x28e41f[_0x4424('0x8')](_0x4424('0x6f'),require(_0x4424('0x70')));_0x28e41f[_0x4424('0x8')](_0x4424('0x71'),require('./api/chatOfflineMessage'));_0x28e41f[_0x4424('0x8')]('/api/chat/queues',require(_0x4424('0x72')));_0x28e41f[_0x4424('0x8')](_0x4424('0x73'),require('./api/chatGroup'));_0x28e41f[_0x4424('0x8')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x28e41f[_0x4424('0x8')](_0x4424('0x74'),require(_0x4424('0x75')));_0x28e41f['use'](_0x4424('0x76'),require(_0x4424('0x77')));_0x28e41f['use'](_0x4424('0x78'),require(_0x4424('0x79')));_0x28e41f[_0x4424('0x8')](_0x4424('0x7a'),require('./api/cmHopperBlack'));_0x28e41f[_0x4424('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x28e41f[_0x4424('0x8')]('/api/cm/hopper_history',require(_0x4424('0x7b')));_0x28e41f[_0x4424('0x8')](_0x4424('0x7c'),require(_0x4424('0x7d')));_0x28e41f['use'](_0x4424('0x7e'),require(_0x4424('0x7f')));_0x28e41f['use'](_0x4424('0x80'),require('./api/automation'));_0x28e41f[_0x4424('0x8')](_0x4424('0x81'),require(_0x4424('0x82')));_0x28e41f[_0x4424('0x8')](_0x4424('0x83'),require(_0x4424('0x84')));_0x28e41f[_0x4424('0x8')](_0x4424('0x85'),require(_0x4424('0x86')));_0x28e41f['use']('/api/intervals',require(_0x4424('0x87')));_0x28e41f[_0x4424('0x8')](_0x4424('0x88'),require(_0x4424('0x89')));_0x28e41f['use']('/api/cdr',require(_0x4424('0x8a')));_0x28e41f[_0x4424('0x8')](_0x4424('0x8b'),require(_0x4424('0x8c')));_0x28e41f[_0x4424('0x8')]('/api/schedules',require('./api/schedule'));_0x28e41f['use'](_0x4424('0x8d'),require('./api/sound'));_0x28e41f[_0x4424('0x8')](_0x4424('0x8e'),require(_0x4424('0x8f')));_0x28e41f['use'](_0x4424('0x90'),require(_0x4424('0x91')));_0x28e41f[_0x4424('0x8')]('/api/triggers',require(_0x4424('0x92')));_0x28e41f[_0x4424('0x8')]('/api/variables',require(_0x4424('0x93')));_0x28e41f[_0x4424('0x8')](_0x4424('0x94'),require(_0x4424('0x95')));_0x28e41f['use'](_0x4424('0x96'),require('./api/integrationReport'));_0x28e41f['use'](_0x4424('0x97'),require(_0x4424('0x98')));_0x28e41f[_0x4424('0x8')]('/api/analytics/default_reports',require(_0x4424('0x99')));_0x28e41f[_0x4424('0x8')]('/api/analytics/extracted_reports',require(_0x4424('0x9a')));_0x28e41f[_0x4424('0x8')]('/api/analytics/metrics',require(_0x4424('0x9b')));_0x28e41f[_0x4424('0x8')](_0x4424('0x9c'),require(_0x4424('0x9d')));_0x28e41f[_0x4424('0x8')](_0x4424('0x9e'),require(_0x4424('0x9f')));_0x28e41f[_0x4424('0x8')](_0x4424('0xa0'),require(_0x4424('0xa1')));_0x28e41f[_0x4424('0x8')]('/api/integrations/salesforce/configurations',require(_0x4424('0xa2')));_0x28e41f[_0x4424('0x8')](_0x4424('0xa3'),require('./api/intSalesforceField'));_0x28e41f['use']('/api/integrations/sugarcrm/accounts',require(_0x4424('0xa4')));_0x28e41f[_0x4424('0x8')](_0x4424('0xa5'),require('./api/intSugarcrmConfiguration'));_0x28e41f[_0x4424('0x8')]('/api/integrations/sugarcrm/fields',require(_0x4424('0xa6')));_0x28e41f['use'](_0x4424('0xa7'),require('./api/intDeskAccount'));_0x28e41f[_0x4424('0x8')](_0x4424('0xa8'),require(_0x4424('0xa9')));_0x28e41f[_0x4424('0x8')](_0x4424('0xaa'),require(_0x4424('0xab')));_0x28e41f['use'](_0x4424('0xac'),require(_0x4424('0xad')));_0x28e41f[_0x4424('0x8')](_0x4424('0xae'),require('./api/intZohoConfiguration'));_0x28e41f['use']('/api/integrations/zoho/fields',require(_0x4424('0xaf')));_0x28e41f['use'](_0x4424('0xb0'),require(_0x4424('0xb1')));_0x28e41f[_0x4424('0x8')](_0x4424('0xb2'),require(_0x4424('0xb3')));_0x28e41f[_0x4424('0x8')]('/api/integrations/zendesk/fields',require(_0x4424('0xb4')));_0x28e41f[_0x4424('0x8')](_0x4424('0xb5'),require('./api/intFreshdeskAccount'));_0x28e41f['use'](_0x4424('0xb6'),require(_0x4424('0xb7')));_0x28e41f[_0x4424('0x8')](_0x4424('0xb8'),require(_0x4424('0xb9')));_0x28e41f[_0x4424('0x8')](_0x4424('0xba'),require(_0x4424('0xbb')));_0x28e41f[_0x4424('0x8')]('/api/integrations/vtiger/configurations',require(_0x4424('0xbc')));_0x28e41f[_0x4424('0x8')](_0x4424('0xbd'),require(_0x4424('0xbe')));_0x28e41f[_0x4424('0x8')](_0x4424('0xbf'),require('./api/intServicenowAccount'));_0x28e41f['use'](_0x4424('0xc0'),require(_0x4424('0xc1')));_0x28e41f[_0x4424('0x8')]('/api/integrations/servicenow/fields',require(_0x4424('0xc2')));_0x28e41f['use'](_0x4424('0xc3'),require(_0x4424('0xc4')));_0x28e41f[_0x4424('0x8')]('/api/integrations/dynamics365/configurations',require(_0x4424('0xc5')));_0x28e41f['use'](_0x4424('0xc6'),require(_0x4424('0xc7')));_0x28e41f[_0x4424('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x28e41f[_0x4424('0x8')](_0x4424('0xc8'),require(_0x4424('0xc9')));_0x28e41f[_0x4424('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x28e41f[_0x4424('0x8')](_0x4424('0xca'),require(_0x4424('0xcb')));_0x28e41f[_0x4424('0x8')](_0x4424('0xcc'),require(_0x4424('0xcd')));_0x28e41f['use'](_0x4424('0xce'),require(_0x4424('0xcf')));_0x28e41f[_0x4424('0x8')]('/api/jscripty/answers/reports',require(_0x4424('0xd0')));_0x28e41f[_0x4424('0x8')](_0x4424('0xd1'),require(_0x4424('0xd2')));_0x28e41f[_0x4424('0x8')]('/api/jscripty/sessions/reports',require(_0x4424('0xd3')));_0x28e41f[_0x4424('0x8')](_0x4424('0xd4'),require(_0x4424('0xd5')));_0x28e41f[_0x4424('0x8')]('/api/square/reports',require(_0x4424('0xd6')));_0x28e41f[_0x4424('0x8')](_0x4424('0xd7'),require(_0x4424('0xd8')));_0x28e41f[_0x4424('0x8')](_0x4424('0xd9'),require(_0x4424('0xda')));_0x28e41f['use'](_0x4424('0xdb'),require(_0x4424('0xdc')));_0x28e41f['use'](_0x4424('0xdd'),require(_0x4424('0xde')));_0x28e41f['use'](_0x4424('0xdf'),require(_0x4424('0xe0')));_0x28e41f['use'](_0x4424('0xe1'),require('./api/squareRecording'));_0x28e41f['use']('/api/square/messages',require(_0x4424('0xe2')));_0x28e41f[_0x4424('0x8')](_0x4424('0xe3'),require(_0x4424('0xe4')));_0x28e41f[_0x4424('0x8')]('/api/license',require('./api/license'));_0x28e41f[_0x4424('0x8')](_0x4424('0xe5'),require(_0x4424('0xe6')));_0x28e41f[_0x4424('0x8')](_0x4424('0xe7'),require(_0x4424('0xe8')));_0x28e41f['use'](_0x4424('0xe9'),require(_0x4424('0xea')));_0x28e41f[_0x4424('0x8')](_0x4424('0xeb'),require(_0x4424('0xec')));_0x28e41f[_0x4424('0x8')](_0x4424('0xed'),require(_0x4424('0xee')));_0x28e41f[_0x4424('0x8')](_0x4424('0xef'),require(_0x4424('0xf0')));_0x28e41f['use'](_0x4424('0xf1'),require('./api/faxTransferReport'));_0x28e41f[_0x4424('0x8')](_0x4424('0xf2'),require(_0x4424('0xf3')));_0x28e41f[_0x4424('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x28e41f[_0x4424('0x8')](_0x4424('0xf4'),require(_0x4424('0xf5')));_0x28e41f[_0x4424('0x8')](_0x4424('0xf6'),require(_0x4424('0xf7')));_0x28e41f[_0x4424('0x8')]('/api/userProfiles',require(_0x4424('0xf8')));_0x28e41f[_0x4424('0x8')](_0x4424('0xf9'),require(_0x4424('0xfa')));_0x28e41f['use']('/api/userProfile/resources',require(_0x4424('0xfb')));_0x28e41f[_0x4424('0x8')]('/api/userNotifications',require(_0x4424('0xfc')));_0x28e41f[_0x4424('0x8')](_0x4424('0xfd'),require(_0x4424('0xfe')));_0x28e41f[_0x4424('0x8')](_0x4424('0xff'),require(_0x4424('0x100')));_0x28e41f[_0x4424('0x8')](_0x4424('0x101'),require(_0x4424('0x102')));_0x28e41f['use'](_0x4424('0x103'),require('./api/whatsappMessage'));_0x28e41f[_0x4424('0x8')]('/api/whatsapp/reports/queue',require(_0x4424('0x104')));_0x28e41f[_0x4424('0x8')](_0x4424('0x105'),require('./api/whatsappTransferReport'));_0x28e41f['use'](_0x4424('0x106'),require('./api/whatsappQueue'));_0x28e41f[_0x4424('0x8')]('/api/cloudProviders',require('./api/cloudProvider'));_0x28e41f['use'](_0x4424('0x107'),require('./api/realtime'));_0x28e41f[_0x4424('0x8')]('/api/auth/local',require('./api/authLocal'));_0x28e41f['use'](_0x4424('0x108'),require(_0x4424('0x109')));_0x28e41f['use'](_0x4424('0x10a'),require('./api/jira'));_0x28e41f[_0x4424('0x8')](_0x4424('0x10b'),require(_0x4424('0x10c')));_0x28e41f[_0x4424('0x8')](_0x4424('0x10d'),require(_0x4424('0x10e')));_0x28e41f[_0x4424('0x8')](_0x4424('0x10f'),require(_0x4424('0x110')));_0x28e41f[_0x4424('0x8')](_0x4424('0x111'),require(_0x4424('0x112')));_0x28e41f[_0x4424('0x8')](_0x4424('0x113'),require(_0x4424('0x114')));_0x28e41f['use'](_0x4424('0x115'),express[_0x4424('0x116')](path[_0x4424('0x117')](config['root'],_0x4424('0x115'))));_0x28e41f[_0x4424('0x8')]('/www',express[_0x4424('0x116')](path[_0x4424('0x117')](config[_0x4424('0x118')],'/www')));_0x28e41f['use'](_0x4424('0x119'),express[_0x4424('0x116')](path[_0x4424('0x117')](config[_0x4424('0x118')],_0x4424('0x119'))));_0x28e41f[_0x4424('0x8')](_0x4424('0x11a'),express[_0x4424('0x116')](path[_0x4424('0x117')](config[_0x4424('0x118')],_0x4424('0x11b'),'3.0.0')));_0x28e41f[_0x4424('0x8')](_0x4424('0x11c'),express[_0x4424('0x116')](path[_0x4424('0x117')](config[_0x4424('0x118')],_0x4424('0x11d'))));_0x28e41f[_0x4424('0x11e')](_0x4424('0x11f'))[_0x4424('0x120')](errors[0x194]);_0x28e41f[_0x4424('0x11e')]('/*')['get'](function(_0x47113e,_0x2c65c2){_0x2c65c2[_0x4424('0x121')](path[_0x4424('0x122')](_0x28e41f[_0x4424('0x120')](_0x4424('0x123'))+'/index.html'));});};var sensitiveFields=[_0x4424('0x124'),_0x4424('0x125'),_0x4424('0x126'),_0x4424('0x127'),'firstName',_0x4424('0x128'),_0x4424('0x129'),'phone',_0x4424('0x12a'),_0x4424('0x12b'),_0x4424('0x12c'),_0x4424('0x12d'),_0x4424('0x12e'),_0x4424('0x12f'),'code','accessKey','tenantId',_0x4424('0x130'),_0x4424('0x131'),'accessToken',_0x4424('0x132'),_0x4424('0x133'),_0x4424('0x134'),_0x4424('0x135'),'membername','calleridname',_0x4424('0x136'),_0x4424('0x137'),'vidaooApiKey',_0x4424('0x138'),_0x4424('0x139'),_0x4424('0x13a'),_0x4424('0x13b'),_0x4424('0x13c'),_0x4424('0x13'),_0x4424('0x13d'),_0x4424('0x13e'),_0x4424('0x13f'),_0x4424('0x140'),_0x4424('0x141'),_0x4424('0x142'),_0x4424('0x143')];function maskSensitiveData(_0x4e3ac1){var _0x209fdc=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x4e3ac1))return;for(var _0x11fcca in _0x4e3ac1){if(_['isArray'](_0x4e3ac1[_0x11fcca])){for(var _0x1dfe15=0x0;_0x1dfe15<_0x4e3ac1[_0x11fcca][_0x4424('0x144')];_0x1dfe15++){maskSensitiveData(_0x4e3ac1[_0x11fcca][_0x1dfe15]);}}else if(_[_0x4424('0x145')](_0x4e3ac1[_0x11fcca])){maskSensitiveData(_0x4e3ac1[_0x11fcca]);}else if(_[_0x4424('0x146')](_0x4e3ac1[_0x11fcca])){_0x4e3ac1[_0x11fcca]=_0x4e3ac1[_0x11fcca][_0x4424('0x147')](/{{{/g,_0x4424('0x148'))[_0x4424('0x147')](/}}}/g,'}@@')['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x4424('0x149')](sensitiveFields,_0x11fcca)){_0x4e3ac1[_0x11fcca]=_0x4e3ac1[_0x11fcca][_0x4424('0x147')](_0x209fdc,'*');}}}} \ No newline at end of file +var _0x9e29=['/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./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/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/team','/api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','username','password','newPassword','apiKey','firstName','lastName','street','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','privateKey','accesskeyid','key','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isString','replace','@@{','}@@','lodash','path','express','express-winston','util','./errors','api','./config/logger','auth','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','name','device','other','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication'];(function(_0xbaa779,_0x116e12){var _0x4356e7=function(_0x340cd1){while(--_0x340cd1){_0xbaa779['push'](_0xbaa779['shift']());}};_0x4356e7(++_0x116e12);}(_0x9e29,0xf4));var _0x99e2=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x9e29[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x99e2('0x0'));var path=require(_0x99e2('0x1'));var express=require(_0x99e2('0x2'));var ewinston=require(_0x99e2('0x3'));var util=require(_0x99e2('0x4'));var errors=require(_0x99e2('0x5'));var config=require('./config/environment');var logger=require('./config/logger')(_0x99e2('0x6'));var authLogger=require(_0x99e2('0x7'))(_0x99e2('0x8'));var safeTemplate=require(_0x99e2('0x9'))[_0x99e2('0xa')];exports[_0x99e2('0xb')]=function(_0x19021d){_0x19021d[_0x99e2('0xc')](ewinston[_0x99e2('0xd')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x44c8fc,_0x10b445){var _0x1851ed=_0x99e2('0xe');if(!_[_0x99e2('0xf')](_0x44c8fc[_0x99e2('0x10')])){_0x1851ed+=_0x99e2('0x11');var _0x49fc89=_0x44c8fc[_0x99e2('0x10')];maskSensitiveData(_0x49fc89);}return safeTemplate(util[_0x99e2('0x12')](_0x1851ed,_0x44c8fc[_0x99e2('0x13')],_0x44c8fc['headers']['x-forwarded-for']?_0x44c8fc[_0x99e2('0x14')][_0x99e2('0x15')]:_0x44c8fc[_0x99e2('0x16')][_0x99e2('0x17')]||_0x44c8fc['ip'],_0x44c8fc[_0x99e2('0x18')],_0x10b445['statusCode'],_0x10b445['responseTime'],_0x44c8fc[_0x99e2('0x19')]?_0x44c8fc[_0x99e2('0x19')]['id']:null,_0x44c8fc[_0x99e2('0x19')]?_0x44c8fc['user']['name']:null,_0x44c8fc[_0x99e2('0x19')]?_0x44c8fc['user']['role']:null,_0x49fc89?util[_0x99e2('0x1a')](_0x49fc89,![],null):''));}}));_0x19021d['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x72ad40,_0xbbdfc8){var _0x16b8ed=_0x99e2('0x1b');if(_0x72ad40['body']&&_0x72ad40[_0x99e2('0x10')]['device']&&_0x72ad40[_0x99e2('0x10')][_0x99e2('0x1c')]){_0x16b8ed=_0x99e2('0x1d');}return util[_0x99e2('0x12')](_0x16b8ed,_0x72ad40[_0x99e2('0x13')],_0x72ad40[_0x99e2('0x14')][_0x99e2('0x15')]?_0x72ad40[_0x99e2('0x14')][_0x99e2('0x15')]:_0x72ad40[_0x99e2('0x16')][_0x99e2('0x17')]||_0x72ad40['ip'],_0x72ad40[_0x99e2('0x18')],_0xbbdfc8[_0x99e2('0x1e')],_0xbbdfc8['responseTime'],_0x72ad40[_0x99e2('0x19')]?_0x72ad40[_0x99e2('0x19')]['id']:null,_0x72ad40[_0x99e2('0x19')]?_0x72ad40['user'][_0x99e2('0x1f')]:null,_0x72ad40[_0x99e2('0x19')]?_0x72ad40[_0x99e2('0x19')]['role']:null,_0x72ad40[_0x99e2('0x10')]&&_0x72ad40[_0x99e2('0x10')][_0x99e2('0x20')]?_0x72ad40[_0x99e2('0x10')][_0x99e2('0x20')]:_0x99e2('0x21'),_0x72ad40[_0x99e2('0x10')]&&_0x72ad40['body'][_0x99e2('0x1c')]?_0x72ad40[_0x99e2('0x10')]['agent_id']:'',_0x72ad40[_0x99e2('0x10')]&&_0x72ad40[_0x99e2('0x10')][_0x99e2('0x22')]?_0x72ad40['body']['agent_name']:'');},'ignoreRoute':function(_0x397c5b){var _0xd846f4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xd846f4[_0x99e2('0x23')](_0x397c5b[_0x99e2('0x18')]);}}));_0x19021d[_0x99e2('0xc')]('/api/users',require('./api/user'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x24'),require(_0x99e2('0x25')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x26'),require('./api/voiceContext'));_0x19021d[_0x99e2('0xc')]('/api/voice/extensions',require('./api/voiceExtension'));_0x19021d[_0x99e2('0xc')]('/api/voice/mohs',require(_0x99e2('0x27')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x28'),require('./api/voiceQueue'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x29'),require(_0x99e2('0x2a')));_0x19021d['use']('/api/screen/recordings',require(_0x99e2('0x2b')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x2c'),require('./api/voiceMail'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x2d'),require(_0x99e2('0x2e')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x2f'),require(_0x99e2('0x30')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x31'),require(_0x99e2('0x32')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x33'),require(_0x99e2('0x34')));_0x19021d['use'](_0x99e2('0x35'),require(_0x99e2('0x36')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x37'),require(_0x99e2('0x38')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x39'),require(_0x99e2('0x3a')));_0x19021d[_0x99e2('0xc')]('/api/voice/transfers/reports',require(_0x99e2('0x3b')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x3c'),require(_0x99e2('0x3d')));_0x19021d[_0x99e2('0xc')]('/api/mail/accounts',require(_0x99e2('0x3e')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x3f'),require('./api/mailQueue'));_0x19021d['use'](_0x99e2('0x40'),require(_0x99e2('0x41')));_0x19021d['use'](_0x99e2('0x42'),require('./api/mailInteraction'));_0x19021d['use']('/api/mail/messages',require(_0x99e2('0x43')));_0x19021d[_0x99e2('0xc')]('/api/mail/applications',require('./api/mailApplication'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x44'),require(_0x99e2('0x45')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x46'),require('./api/dashboard'));_0x19021d['use'](_0x99e2('0x47'),require(_0x99e2('0x48')));_0x19021d['use'](_0x99e2('0x49'),require(_0x99e2('0x4a')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x4b'),require(_0x99e2('0x4c')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x4d'),require(_0x99e2('0x4e')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x4f'),require(_0x99e2('0x50')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x51'),require(_0x99e2('0x52')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x53'),require('./api/faxQueueReport'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x54'),require('./api/smsAccount'));_0x19021d['use'](_0x99e2('0x55'),require('./api/smsApplication'));_0x19021d[_0x99e2('0xc')]('/api/sms/interactions',require(_0x99e2('0x56')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x57'),require('./api/smsMessage'));_0x19021d['use'](_0x99e2('0x58'),require(_0x99e2('0x59')));_0x19021d['use'](_0x99e2('0x5a'),require(_0x99e2('0x5b')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x5c'),require(_0x99e2('0x5d')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x5e'),require(_0x99e2('0x5f')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x60'),require('./api/openchannelMessage'));_0x19021d[_0x99e2('0xc')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x19021d['use'](_0x99e2('0x61'),require(_0x99e2('0x62')));_0x19021d[_0x99e2('0xc')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x63'),require(_0x99e2('0x64')));_0x19021d[_0x99e2('0xc')]('/api/chat/interactions',require(_0x99e2('0x65')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x66'),require(_0x99e2('0x67')));_0x19021d[_0x99e2('0xc')]('/api/chat/offline_messages',require(_0x99e2('0x68')));_0x19021d['use'](_0x99e2('0x69'),require('./api/chatQueue'));_0x19021d[_0x99e2('0xc')]('/api/chat/groups',require('./api/chatGroup'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x6a'),require(_0x99e2('0x6b')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x6c'),require('./api/cmCompany'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x6d'),require(_0x99e2('0x6e')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x6f'),require(_0x99e2('0x70')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x71'),require(_0x99e2('0x72')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x73'),require(_0x99e2('0x74')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x75'),require('./api/cmHopperHistory'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x76'),require(_0x99e2('0x77')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x78'),require(_0x99e2('0x79')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x7a'),require('./api/automation'));_0x19021d['use']('/api/canned_answers',require(_0x99e2('0x7b')));_0x19021d['use'](_0x99e2('0x7c'),require(_0x99e2('0x7d')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x7e'),require(_0x99e2('0x7f')));_0x19021d['use'](_0x99e2('0x80'),require(_0x99e2('0x81')));_0x19021d[_0x99e2('0xc')]('/api/pauses',require('./api/pause'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x82'),require(_0x99e2('0x83')));_0x19021d[_0x99e2('0xc')]('/api/voiceQueuesLog',require(_0x99e2('0x84')));_0x19021d['use']('/api/schedules',require(_0x99e2('0x85')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x86'),require(_0x99e2('0x87')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x88'),require(_0x99e2('0x89')));_0x19021d['use'](_0x99e2('0x8a'),require(_0x99e2('0x8b')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x8c'),require(_0x99e2('0x8d')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x8e'),require(_0x99e2('0x8f')));_0x19021d[_0x99e2('0xc')]('/api/integrations',require(_0x99e2('0x90')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x91'),require(_0x99e2('0x92')));_0x19021d[_0x99e2('0xc')]('/api/analytics/custom_reports',require(_0x99e2('0x93')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x94'),require(_0x99e2('0x95')));_0x19021d[_0x99e2('0xc')]('/api/analytics/extracted_reports',require(_0x99e2('0x96')));_0x19021d['use'](_0x99e2('0x97'),require(_0x99e2('0x98')));_0x19021d['use']('/api/analytics/field_reports',require(_0x99e2('0x99')));_0x19021d['use'](_0x99e2('0x9a'),require(_0x99e2('0x9b')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x9c'),require('./api/intSalesforceAccount'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x9d'),require(_0x99e2('0x9e')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x9f'),require(_0x99e2('0xa0')));_0x19021d['use'](_0x99e2('0xa1'),require('./api/intSugarcrmAccount'));_0x19021d[_0x99e2('0xc')]('/api/integrations/sugarcrm/configurations',require(_0x99e2('0xa2')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xa3'),require(_0x99e2('0xa4')));_0x19021d[_0x99e2('0xc')]('/api/integrations/desk/accounts',require(_0x99e2('0xa5')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xa6'),require(_0x99e2('0xa7')));_0x19021d['use'](_0x99e2('0xa8'),require('./api/intDeskField'));_0x19021d[_0x99e2('0xc')]('/api/integrations/zoho/accounts',require(_0x99e2('0xa9')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xaa'),require(_0x99e2('0xab')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xac'),require('./api/intZohoField'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xad'),require('./api/intZendeskAccount'));_0x19021d[_0x99e2('0xc')]('/api/integrations/zendesk/configurations',require(_0x99e2('0xae')));_0x19021d[_0x99e2('0xc')]('/api/integrations/zendesk/fields',require(_0x99e2('0xaf')));_0x19021d['use'](_0x99e2('0xb0'),require(_0x99e2('0xb1')));_0x19021d['use'](_0x99e2('0xb2'),require('./api/intFreshdeskConfiguration'));_0x19021d['use'](_0x99e2('0xb3'),require('./api/intFreshdeskField'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xb4'),require(_0x99e2('0xb5')));_0x19021d[_0x99e2('0xc')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x19021d['use'](_0x99e2('0xb6'),require(_0x99e2('0xb7')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xb8'),require(_0x99e2('0xb9')));_0x19021d['use'](_0x99e2('0xba'),require(_0x99e2('0xbb')));_0x19021d[_0x99e2('0xc')]('/api/integrations/servicenow/fields',require(_0x99e2('0xbc')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xbd'),require(_0x99e2('0xbe')));_0x19021d[_0x99e2('0xc')]('/api/integrations/dynamics365/configurations',require(_0x99e2('0xbf')));_0x19021d['use'](_0x99e2('0xc0'),require(_0x99e2('0xc1')));_0x19021d['use']('/api/integrations/freshsales/accounts',require(_0x99e2('0xc2')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xc3'),require(_0x99e2('0xc4')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xc5'),require('./api/intFreshsalesField'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xc6'),require('./api/network'));_0x19021d[_0x99e2('0xc')]('/api/chat/reports/queue',require(_0x99e2('0xc7')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xc8'),require(_0x99e2('0xc9')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xca'),require(_0x99e2('0xcb')));_0x19021d[_0x99e2('0xc')]('/api/jscripty/questions/reports',require(_0x99e2('0xcc')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xcd'),require(_0x99e2('0xce')));_0x19021d['use'](_0x99e2('0xcf'),require(_0x99e2('0xd0')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xd1'),require(_0x99e2('0xd2')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xd3'),require(_0x99e2('0xd4')));_0x19021d['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xd5'),require('./api/setting'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xd6'),require(_0x99e2('0xd7')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xd8'),require(_0x99e2('0xd9')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xda'),require(_0x99e2('0xdb')));_0x19021d[_0x99e2('0xc')]('/api/square/messages',require('./api/squareMessage'));_0x19021d[_0x99e2('0xc')]('/api/teams',require(_0x99e2('0xdc')));_0x19021d['use'](_0x99e2('0xdd'),require('./api/license'));_0x19021d[_0x99e2('0xc')]('/api/campaigns',require(_0x99e2('0xde')));_0x19021d['use']('/api/migrations',require(_0x99e2('0xdf')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xe0'),require(_0x99e2('0xe1')));_0x19021d['use']('/api/plugins',require(_0x99e2('0xe2')));_0x19021d['use'](_0x99e2('0xe3'),require(_0x99e2('0xe4')));_0x19021d['use']('/api/chat/reports/transfer',require(_0x99e2('0xe5')));_0x19021d[_0x99e2('0xc')]('/api/fax/reports/transfer',require(_0x99e2('0xe6')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xe7'),require('./api/openchannelTransferReport'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xe8'),require(_0x99e2('0xe9')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xea'),require(_0x99e2('0xeb')));_0x19021d['use'](_0x99e2('0xec'),require(_0x99e2('0xed')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xee'),require(_0x99e2('0xef')));_0x19021d[_0x99e2('0xc')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xf0'),require(_0x99e2('0xf1')));_0x19021d[_0x99e2('0xc')]('/api/userNotifications',require(_0x99e2('0xf2')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xf3'),require(_0x99e2('0xf4')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xf5'),require(_0x99e2('0xf6')));_0x19021d[_0x99e2('0xc')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x19021d[_0x99e2('0xc')](_0x99e2('0xf7'),require(_0x99e2('0xf8')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xf9'),require(_0x99e2('0xfa')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xfb'),require('./api/whatsappTransferReport'));_0x19021d['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x19021d[_0x99e2('0xc')]('/api/cloudProviders',require(_0x99e2('0xfc')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xfd'),require(_0x99e2('0xfe')));_0x19021d[_0x99e2('0xc')](_0x99e2('0xff'),require(_0x99e2('0x100')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x101'),require('./api/authGoogle'));_0x19021d[_0x99e2('0xc')](_0x99e2('0x102'),require(_0x99e2('0x103')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x104'),require(_0x99e2('0x105')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x106'),require('./api/version'));_0x19021d['use'](_0x99e2('0x107'),require(_0x99e2('0x108')));_0x19021d['use'](_0x99e2('0x109'),require(_0x99e2('0x10a')));_0x19021d['use'](_0x99e2('0x10b'),require(_0x99e2('0x10c')));_0x19021d['use'](_0x99e2('0x10d'),express[_0x99e2('0x10e')](path[_0x99e2('0x10f')](config[_0x99e2('0x110')],'/apidoc')));_0x19021d[_0x99e2('0xc')](_0x99e2('0x111'),express[_0x99e2('0x10e')](path[_0x99e2('0x10f')](config[_0x99e2('0x110')],_0x99e2('0x111'))));_0x19021d[_0x99e2('0xc')]('/demo',express['static'](path['join'](config[_0x99e2('0x110')],_0x99e2('0x112'))));_0x19021d[_0x99e2('0xc')]('/snippet',express[_0x99e2('0x10e')](path['join'](config[_0x99e2('0x110')],_0x99e2('0x113'),_0x99e2('0x114'))));_0x19021d['use'](_0x99e2('0x115'),express[_0x99e2('0x10e')](path[_0x99e2('0x10f')](config[_0x99e2('0x110')],_0x99e2('0x116'))));_0x19021d[_0x99e2('0x117')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x99e2('0x118')](errors[0x194]);_0x19021d[_0x99e2('0x117')]('/*')[_0x99e2('0x118')](function(_0x2c51ae,_0x4dba4f){_0x4dba4f[_0x99e2('0x119')](path[_0x99e2('0x11a')](_0x19021d[_0x99e2('0x118')](_0x99e2('0x11b'))+'/index.html'));});};var sensitiveFields=[_0x99e2('0x11c'),_0x99e2('0x11d'),_0x99e2('0x11e'),_0x99e2('0x11f'),_0x99e2('0x120'),_0x99e2('0x121'),_0x99e2('0x122'),'phone',_0x99e2('0x123'),_0x99e2('0x124'),_0x99e2('0x125'),'clientId',_0x99e2('0x126'),_0x99e2('0x127'),_0x99e2('0x128'),_0x99e2('0x129'),_0x99e2('0x12a'),_0x99e2('0x12b'),_0x99e2('0x12c'),_0x99e2('0x12d'),_0x99e2('0x12e'),_0x99e2('0x12f'),_0x99e2('0x130'),'consumerSecret','membername',_0x99e2('0x131'),_0x99e2('0x132'),_0x99e2('0x133'),'vidaooApiKey','clientEmail',_0x99e2('0x134'),_0x99e2('0x135'),'secretaccesskey',_0x99e2('0x136'),_0x99e2('0x19'),'pass','accountSid',_0x99e2('0x137'),_0x99e2('0x138'),_0x99e2('0x139'),_0x99e2('0x13a'),_0x99e2('0x13b')];function maskSensitiveData(_0x4046ab){var _0x281130=/(?!^)[\s\S](?!$)/g;if(!_[_0x99e2('0x13c')](_0x4046ab))return;for(var _0x5f479d in _0x4046ab){if(_['isArray'](_0x4046ab[_0x5f479d])){for(var _0x4194ca=0x0;_0x4194ca<_0x4046ab[_0x5f479d]['length'];_0x4194ca++){maskSensitiveData(_0x4046ab[_0x5f479d][_0x4194ca]);}}else if(_['isPlainObject'](_0x4046ab[_0x5f479d])){maskSensitiveData(_0x4046ab[_0x5f479d]);}else if(_[_0x99e2('0x13d')](_0x4046ab[_0x5f479d])){_0x4046ab[_0x5f479d]=_0x4046ab[_0x5f479d][_0x99e2('0x13e')](/{{{/g,_0x99e2('0x13f'))['replace'](/}}}/g,_0x99e2('0x140'))[_0x99e2('0x13e')](/{{/g,'@{')[_0x99e2('0x13e')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x5f479d)){_0x4046ab[_0x5f479d]=_0x4046ab[_0x5f479d][_0x99e2('0x13e')](_0x281130,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index aabac76..8a329ee 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9d1=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc'];(function(_0x3bbc42,_0x4c71ea){var _0x39c75d=function(_0x31f7f2){while(--_0x31f7f2){_0x3bbc42['push'](_0x3bbc42['shift']());}};_0x39c75d(++_0x4c71ea);}(_0xf9d1,0x10a));var _0x1f9d=function(_0x423867,_0x142eb3){_0x423867=_0x423867-0x0;var _0x20bedf=_0xf9d1[_0x423867];return _0x20bedf;};'use strict';var jayson=require(_0x1f9d('0x0'));var BPromise=require(_0x1f9d('0x1'));var _=require(_0x1f9d('0x2'));var config=require(_0x1f9d('0x3'));exports[_0x1f9d('0x4')]=function(){return new BPromise(function(_0x392134,_0x27f5a2){var _0x4b090f={};_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/user/user.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x6')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/voiceQueue/voiceQueue.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x7')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x8')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x9')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0xa')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0xb')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/trunk/trunk.rpc'));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0xc')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0xd')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0xe')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0xf')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x10')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x11')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/mailMessage/mailMessage.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x12')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x13')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x14')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x15')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x16')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x17')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/faxQueue/faxQueue.rpc'));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x18')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x19')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x1a')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x1b')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x1c')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x1d')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x1e')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x1f')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x20')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x21')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/chatInteraction/chatInteraction.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/chatMessage/chatMessage.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/chatQueue/chatQueue.rpc'));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x22')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/cmHopper/cmHopper.rpc'));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x23')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x24')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x25')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x26')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x27')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x28')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x29')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x2a')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/trigger/trigger.rpc'));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x2b')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x2c')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x2d')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x2e')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x2f')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x30')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x31')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x32')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x33')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x34')));_0x4b090f=_['merge'](_0x4b090f,require(_0x1f9d('0x35')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x36')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/squareReport/squareReport.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x37')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x38')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x39')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x3a')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x3b')));_0x4b090f=_['merge'](_0x4b090f,require('../api/squareMessage/squareMessage.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/campaign/campaign.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x3c')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/plugin/plugin.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x3d')));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4b090f=_['merge'](_0x4b090f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4b090f=_[_0x1f9d('0x5')](_0x4b090f,require(_0x1f9d('0x3e')));var _0x11a201=jayson[_0x1f9d('0x3f')](_0x4b090f)[_0x1f9d('0x40')]();var _0x5e1f4c=config['rpc']['port']||config[_0x1f9d('0x41')]+0x1;var _0x40edac=config[_0x1f9d('0x42')]['ip']||'localhost';_0x11a201['on'](_0x1f9d('0x43'),function(_0x2fee34){return _0x27f5a2(_0x2fee34);});_0x11a201[_0x1f9d('0x4')](_0x5e1f4c,_0x40edac,function(){console['log'](_0x1f9d('0x44'),_0x40edac,_0x5e1f4c);require(_0x1f9d('0x45'))[_0x1f9d('0x46')]();return _0x392134('RPC\x20listening\x20on\x20'+_0x40edac+':'+_0x5e1f4c);});});}; \ No newline at end of file +var _0x495b=['../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','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/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc'];(function(_0x36cb9e,_0x4cd164){var _0x353836=function(_0x5421bf){while(--_0x5421bf){_0x36cb9e['push'](_0x36cb9e['shift']());}};_0x353836(++_0x4cd164);}(_0x495b,0x103));var _0xb495=function(_0x1e2212,_0x469488){_0x1e2212=_0x1e2212-0x0;var _0x599645=_0x495b[_0x1e2212];return _0x599645;};'use strict';var jayson=require(_0xb495('0x0'));var BPromise=require('bluebird');var _=require(_0xb495('0x1'));var config=require(_0xb495('0x2'));exports[_0xb495('0x3')]=function(){return new BPromise(function(_0x193679,_0x194e8e){var _0xa93646={};_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x5')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x6')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x7')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x8')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x9')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0xa')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0xb')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0xc')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0xd')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0xe')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0xf')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x10')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/mailServerIn/mailServerIn.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x11')));_0xa93646=_['merge'](_0xa93646,require('../api/mailQueue/mailQueue.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/mailInteraction/mailInteraction.rpc'));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x12')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x13')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x14')));_0xa93646=_['merge'](_0xa93646,require('../api/faxAccount/faxAccount.rpc'));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x15')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/faxInteraction/faxInteraction.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x16')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x17')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x18')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x19')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x1a')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x1b')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x1c')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/openchannelApplication/openchannelApplication.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x1d')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x1e')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x1f')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x20')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x21')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x22')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/chatQueue/chatQueue.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/cmContact/cmContact.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x23')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x24')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x25')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x26')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x27')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x28')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x29')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x2a')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/trigger/trigger.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x2b')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x2c')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x2d')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x2e')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x2f')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x30')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x31')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/chatQueueReport/chatQueueReport.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x32')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x33')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x34')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x35')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x36')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x37')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x38')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x39')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x3a')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x3b')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x3c')));_0xa93646=_['merge'](_0xa93646,require(_0xb495('0x3d')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x3e')));_0xa93646=_[_0xb495('0x4')](_0xa93646,require(_0xb495('0x3f')));var _0x528f31=jayson[_0xb495('0x40')](_0xa93646)[_0xb495('0x41')]();var _0x28c462=config[_0xb495('0x42')][_0xb495('0x43')]||config[_0xb495('0x43')]+0x1;var _0x1306d6=config[_0xb495('0x42')]['ip']||_0xb495('0x44');_0x528f31['on'](_0xb495('0x45'),function(_0x290374){return _0x194e8e(_0x290374);});_0x528f31['listen'](_0x28c462,_0x1306d6,function(){console['log'](_0xb495('0x46'),_0x1306d6,_0x28c462);require(_0xb495('0x47'))[_0xb495('0x48')]();return _0x193679(_0xb495('0x49')+_0x1306d6+':'+_0x28c462);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index b515008..74c37ea 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x59d8fc,_0x356e10){var _0x280ac8=function(_0x234829){while(--_0x234829){_0x59d8fc['push'](_0x59d8fc['shift']());}};_0x280ac8(++_0x356e10);}(_0x8603,0x190));var _0x3860=function(_0x5825c4,_0x30a289){_0x5825c4=_0x5825c4-0x0;var _0x5c1b2d=_0x8603[_0x5825c4];return _0x5c1b2d;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x8f4c=['map','isPlainObject','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','replace','isArray'];(function(_0x3f83f5,_0xbe1eac){var _0x219c65=function(_0x58ef1e){while(--_0x58ef1e){_0x3f83f5['push'](_0x3f83f5['shift']());}};_0x219c65(++_0xbe1eac);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3428b3,_0x4396cc){_0x3428b3=_0x3428b3-0x0;var _0x4474ad=_0x8f4c[_0x3428b3];return _0x4474ad;};var _=require(_0xc8f4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x292fb6){return _0x292fb6==='{{'?_0xc8f4('0x1'):_0xc8f4('0x2');}function safeTemplate(_0x19893b){var _0x134d73=_0x19893b;if(typeof _0x19893b==='string'){_0x134d73=_0x19893b[_0xc8f4('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc8f4('0x4')](_0x19893b)){_0x134d73=_0x19893b[_0xc8f4('0x5')](function(_0x56c9b1){return safeTemplate(_0x56c9b1);});}else if(_[_0xc8f4('0x6')](_0x19893b)){_0x134d73=Object['keys'](_0x19893b)['reduce'](function(_0x520063,_0x373506){_0x520063[_0x373506]=safeTemplate(_0x19893b[_0x373506]);return _0x520063;},{});}return _0x134d73;}module['exports'][_0xc8f4('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index ceff4cc..701ef85 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 _0xa984=['VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','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','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','prototype','sendRequest','sync','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format'];(function(_0x31fb63,_0x3d54fa){var _0x569704=function(_0x3e01c2){while(--_0x3e01c2){_0x31fb63['push'](_0x31fb63['shift']());}};_0x569704(++_0x3d54fa);}(_0xa984,0x15a));var _0x4a98=function(_0x24bbd5,_0x34a7c4){_0x24bbd5=_0x24bbd5-0x0;var _0x8fb737=_0xa984[_0x24bbd5];return _0x8fb737;};'use strict';var util=require(_0x4a98('0x0'));var _=require(_0x4a98('0x1'));var EventEmitter=require(_0x4a98('0x2'))[_0x4a98('0x3')];var AGIReply=require(_0x4a98('0x4'));var AGIError=require(_0x4a98('0x5'));function AGIChannel(_0x6b476c){var _0x7bffe0=this,_0x456ac3=new AGIReply(),_0x36f0f5=![],_0x3921a={};EventEmitter[_0x4a98('0x6')](_0x7bffe0);_0x6b476c[_0x4a98('0x7')](_0x4a98('0x8'));_0x6b476c['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x456ac3['setEncoding'](_0x4a98('0x8'));_0x456ac3['on']('headers',function(_0x43bf6d){for(var _0x59e3a5 in _0x43bf6d){_0x7bffe0[_0x59e3a5]=_0x43bf6d[_0x59e3a5];}_0x7bffe0[_0x4a98('0x9')]('ready');});_0x456ac3['on'](_0x4a98('0xa'),function(_0x4e552f){if(_0x4e552f[_0x4a98('0xb')]()==_0x4a98('0xc')){_0x7bffe0[_0x4a98('0x9')]('hangup');return;}if(_0x4e552f[_0x4a98('0xd')](0x0,0xb)==_0x4a98('0xe')){_0x36f0f5=!![];}if(_0x36f0f5){_0x3921a['rx']+=_0x4e552f+'\x0a';if(_0x4e552f[_0x4a98('0xf')](_0x4a98('0x10'))!=-0x1){_0x36f0f5=![];}}else{_0x3921a['rx']=_0x4e552f;}if(_0x36f0f5){return;}if(typeof _0x3921a['cb']=='function'){var _0x8c96cd=_0x3921a['rx'][_0x4a98('0xd')](0x0,0x3),_0x332dbb=null,_0x445b77=null;_0x8c96cd=parseInt(_0x8c96cd);if(isNaN(_0x8c96cd)){_0x3921a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4a98('0x11')});return;}if(_0x8c96cd!=0xc8){_0x3921a['cb'](null,{'code':_0x8c96cd,'result':-0x1,'extra':'KO'});return;}_0x332dbb=_0x3921a['rx'][_0x4a98('0xd')](0x4)[_0x4a98('0x12')](_0x4a98('0x13'),'');if(_0x332dbb['indexOf']('\x20')!=-0x1){_0x332dbb=_0x332dbb['substr'](0x0,_0x332dbb[_0x4a98('0x14')]('\x20'));}if(_[_0x4a98('0x15')](_0x332dbb,'-1')){_0x332dbb=parseInt(_0x332dbb);}_0x445b77=_0x3921a['rx'][_0x4a98('0x16')]('\x20');if(_0x445b77[_0x4a98('0x17')]==0x3){_0x445b77=_0x445b77[0x2][_0x4a98('0xd')](0x1,_0x445b77[0x2]['length']-0x1);}else if(_0x445b77[_0x4a98('0x17')]>0x3){var _0x35e1cd=/\((.+)\)/;var _0x4d2e2b=_0x3921a['rx'][_0x4a98('0x18')](_0x35e1cd);if(_0x4d2e2b){_0x445b77=_0x4d2e2b[0x1];}else{_0x445b77=null;}}else{_0x445b77=null;}_0x3921a['cb'](null,{'code':_0x8c96cd,'result':_0x332dbb,'extra':_0x445b77});}});_0x6b476c['on'](_0x4a98('0x19'),function(_0x47c1c0){_0x7bffe0[_0x4a98('0x9')](_0x4a98('0x19'),new AGIError(_0x4a98('0x1a'),_0x47c1c0[_0x4a98('0x1b')]));});_0x6b476c['on'](_0x4a98('0x1c'),function(){_0x7bffe0[_0x4a98('0x9')](_0x4a98('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x6b476c['on'](_0x4a98('0x1d'),function(){_0x7bffe0[_0x4a98('0x9')](_0x4a98('0x1d'),new AGIError(_0x4a98('0x1e')));_0x6b476c[_0x4a98('0x1f')]();});_0x6b476c['pipe'](_0x456ac3);this[_0x4a98('0x20')]=function(_0x287fc7,_0x20f079){var _0x287fc7=_0x287fc7||'',_0x20f079=typeof _0x20f079==_0x4a98('0x21')?_0x20f079:new Function();_0x3921a={'tx':_0x287fc7,'rx':'','cb':_0x20f079};_0x6b476c[_0x4a98('0x22')](_0x287fc7+'\x0a');},this[_0x4a98('0x1c')]=function(){_0x6b476c[_0x4a98('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x4a98('0x23')][_0x4a98('0x24')]=function(_0x9bd543){return this[_0x4a98('0x20')][_0x4a98('0x25')](this,_0x9bd543);};AGIChannel[_0x4a98('0x23')]['answer']=function(){return this[_0x4a98('0x24')]('ANSWER');};AGIChannel[_0x4a98('0x23')][_0x4a98('0x26')]=function(_0x152283,_0x18be1b,_0x29cf71){_0x152283=_0x152283===undefined?_0x4a98('0x27'):_0x152283;_0x18be1b=_0x18be1b===undefined?'5':_0x18be1b;_0x29cf71=_0x29cf71===undefined?'1':_0x29cf71;return this[_0x4a98('0x24')](util['format'](_0x4a98('0x28'),_0x152283,_0x18be1b*0x3e8,_0x29cf71));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x29')]=function(_0x211bea){_0x211bea=_0x211bea||_0x4a98('0x2a');return this['sendRequest'](util[_0x4a98('0x2b')](_0x4a98('0x2c'),_0x211bea));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x2d')]=function(_0x27f031,_0x260b03){if(_[_0x4a98('0x2e')](_0x260b03)){return this[_0x4a98('0x24')](util['format'](_0x4a98('0x2f'),_0x27f031,_0x260b03[_0x4a98('0x30')](',')));}return this[_0x4a98('0x24')](util[_0x4a98('0x2b')]('EXEC\x20%s\x20%s',_0x27f031,_0x260b03));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x31')]=function(_0x283f62){return this[_0x4a98('0x24')](util['format']('SET\x20CONTEXT\x20%s',_0x283f62));};AGIChannel['prototype']['setExtension']=function(_0x58a85d){return this[_0x4a98('0x24')](util['format']('SET\x20EXTENSION\x20%s',_0x58a85d));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x32')]=function(_0x2aad2e){return this[_0x4a98('0x24')](util[_0x4a98('0x2b')](_0x4a98('0x33'),_0x2aad2e));};AGIChannel[_0x4a98('0x23')][_0x4a98('0xc')]=function(){return this['sendRequest'](_0x4a98('0x34'));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x35')]=function(_0x59531b,_0x26c284){var _0x1a4006=_[_0x4a98('0x36')](_0x26c284)||_[_0x4a98('0x37')](_0x26c284)?_0x26c284[_0x4a98('0x38')]():_0x26c284;return this['sendRequest'](util[_0x4a98('0x2b')](_0x4a98('0x39'),_0x59531b,_0x1a4006?_0x1a4006[_0x4a98('0x38')]()[_0x4a98('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x3a')]=function(_0x327f14,_0xc13306){return this[_0x4a98('0x24')](util[_0x4a98('0x2b')](_0x4a98('0x3b'),_0x327f14,_0xc13306));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x3c')]=function(_0x2659b8,_0x210a7a){return this[_0x4a98('0x24')](util[_0x4a98('0x2b')](_0x4a98('0x3d'),_0x2659b8,_0x210a7a));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x3e')]=function(_0x32a109,_0x1bcf94){return this[_0x4a98('0x24')](util[_0x4a98('0x2b')](_0x4a98('0x3f'),_0x32a109,_0x1bcf94));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x40')]=function(_0x1a4b49,_0x26a8d8,_0x249ebd){_0x26a8d8=_0x26a8d8||this[_0x4a98('0x41')];_0x249ebd=_0x249ebd||0x1;this[_0x4a98('0x31')](_0x1a4b49);this['setExtension'](_0x26a8d8);this['setPriority'](_0x249ebd);return this['noop'](util[_0x4a98('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x1a4b49,_0x26a8d8,_0x249ebd));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x42')]=function(_0xecdde9){return this[_0x4a98('0x24')](util['format'](_0x4a98('0x43'),_0xecdde9));};AGIChannel[_0x4a98('0x23')]['recordFile']=function(_0xbd5681,_0x1ac367,_0x303725,_0x4dfcc8,_0x39d49f,_0x4c9ba6){_0x1ac367=_0x1ac367||'wav';_0x303725=_0x303725||'';_0x4dfcc8=_0x4dfcc8===undefined?-0x1:_0x4dfcc8==='-1'?-0x1:_0x4dfcc8*0x3e8;_0x39d49f=_0x39d49f===undefined?'':'s='+_0x39d49f;_0x4c9ba6=_0x4c9ba6?_0x4a98('0x44'):'';return this[_0x4a98('0x24')](util[_0x4a98('0x2b')](_0x4a98('0x45'),_0xbd5681,_0x1ac367,_0x303725,_0x4dfcc8,_0x4c9ba6,_0x39d49f));};AGIChannel[_0x4a98('0x23')][_0x4a98('0x46')]=function(_0x40f502,_0x2fb808){_0x2fb808=_0x2fb808||'';return this['sendRequest'](util[_0x4a98('0x2b')](_0x4a98('0x47'),_0x40f502,_0x2fb808));};AGIChannel[_0x4a98('0x23')]['agi']=function(_0x5a3d47){return this[_0x4a98('0x2d')](_0x4a98('0x48'),_0x5a3d47);};AGIChannel[_0x4a98('0x23')][_0x4a98('0x49')]=function(_0x203da3){return this[_0x4a98('0x2d')](_0x4a98('0x4a'),_0x203da3);};AGIChannel['prototype'][_0x4a98('0x19')]=function(_0x7bfb68,_0x3d4c43){this[_0x4a98('0x29')](util[_0x4a98('0x2b')](_0x4a98('0x4b'),_0x7bfb68['id'],_0x7bfb68[_0x4a98('0x4c')],_0x3d4c43));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4a98('0x4d')]=AGIChannel; \ No newline at end of file +var _0xc75f=['sendRequest','sync','prototype','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','exec','label','util','events','EventEmitter','./error','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command'];(function(_0xb6ff6,_0x3d5adb){var _0x3341ac=function(_0x1b134a){while(--_0x1b134a){_0xb6ff6['push'](_0xb6ff6['shift']());}};_0x3341ac(++_0x3d5adb);}(_0xc75f,0xb8));var _0xfc75=function(_0x6b05e7,_0x6ee56e){_0x6b05e7=_0x6b05e7-0x0;var _0x35c01d=_0xc75f[_0x6b05e7];return _0x35c01d;};'use strict';var util=require(_0xfc75('0x0'));var _=require('lodash');var EventEmitter=require(_0xfc75('0x1'))[_0xfc75('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xfc75('0x3'));function AGIChannel(_0x5e2f4a){var _0x3563c9=this,_0x1e07af=new AGIReply(),_0x282ef8=![],_0x533f20={};EventEmitter['call'](_0x3563c9);_0x5e2f4a[_0xfc75('0x4')](_0xfc75('0x5'));_0x5e2f4a['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1e07af[_0xfc75('0x4')](_0xfc75('0x5'));_0x1e07af['on'](_0xfc75('0x6'),function(_0x47cc8a){for(var _0x54141d in _0x47cc8a){_0x3563c9[_0x54141d]=_0x47cc8a[_0x54141d];}_0x3563c9[_0xfc75('0x7')](_0xfc75('0x8'));});_0x1e07af['on'](_0xfc75('0x9'),function(_0x290588){if(_0x290588[_0xfc75('0xa')]()==_0xfc75('0xb')){_0x3563c9[_0xfc75('0x7')](_0xfc75('0xb'));return;}if(_0x290588['substring'](0x0,0xb)==_0xfc75('0xc')){_0x282ef8=!![];}if(_0x282ef8){_0x533f20['rx']+=_0x290588+'\x0a';if(_0x290588[_0xfc75('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x282ef8=![];}}else{_0x533f20['rx']=_0x290588;}if(_0x282ef8){return;}if(typeof _0x533f20['cb']==_0xfc75('0xe')){var _0x5bdd6d=_0x533f20['rx'][_0xfc75('0xf')](0x0,0x3),_0x5eb497=null,_0x41beed=null;_0x5bdd6d=parseInt(_0x5bdd6d);if(isNaN(_0x5bdd6d)){_0x533f20['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xfc75('0x10')});return;}if(_0x5bdd6d!=0xc8){_0x533f20['cb'](null,{'code':_0x5bdd6d,'result':-0x1,'extra':'KO'});return;}_0x5eb497=_0x533f20['rx'][_0xfc75('0xf')](0x4)[_0xfc75('0x11')](_0xfc75('0x12'),'');if(_0x5eb497[_0xfc75('0x13')]('\x20')!=-0x1){_0x5eb497=_0x5eb497[_0xfc75('0x14')](0x0,_0x5eb497[_0xfc75('0x13')]('\x20'));}if(_[_0xfc75('0x15')](_0x5eb497,'-1')){_0x5eb497=parseInt(_0x5eb497);}_0x41beed=_0x533f20['rx'][_0xfc75('0x16')]('\x20');if(_0x41beed[_0xfc75('0x17')]==0x3){_0x41beed=_0x41beed[0x2][_0xfc75('0xf')](0x1,_0x41beed[0x2][_0xfc75('0x17')]-0x1);}else if(_0x41beed[_0xfc75('0x17')]>0x3){var _0x4f4d47=/\((.+)\)/;var _0xffee0e=_0x533f20['rx'][_0xfc75('0x18')](_0x4f4d47);if(_0xffee0e){_0x41beed=_0xffee0e[0x1];}else{_0x41beed=null;}}else{_0x41beed=null;}_0x533f20['cb'](null,{'code':_0x5bdd6d,'result':_0x5eb497,'extra':_0x41beed});}});_0x5e2f4a['on'](_0xfc75('0x19'),function(_0x3e27bf){_0x3563c9['emit'](_0xfc75('0x19'),new AGIError(_0xfc75('0x1a'),_0x3e27bf[_0xfc75('0x1b')]));});_0x5e2f4a['on'](_0xfc75('0x1c'),function(){_0x3563c9[_0xfc75('0x7')]('close',new AGIError(_0xfc75('0x1d')));});_0x5e2f4a['on'](_0xfc75('0x1e'),function(){_0x3563c9[_0xfc75('0x7')]('timeout',new AGIError(_0xfc75('0x1f')));_0x5e2f4a[_0xfc75('0x20')]();});_0x5e2f4a[_0xfc75('0x21')](_0x1e07af);this[_0xfc75('0x22')]=function(_0x2ef7d2,_0x4b7eaf){var _0x2ef7d2=_0x2ef7d2||'',_0x4b7eaf=typeof _0x4b7eaf==_0xfc75('0xe')?_0x4b7eaf:new Function();_0x533f20={'tx':_0x2ef7d2,'rx':'','cb':_0x4b7eaf};_0x5e2f4a['write'](_0x2ef7d2+'\x0a');},this[_0xfc75('0x1c')]=function(){_0x5e2f4a[_0xfc75('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xfc75('0x23')]=function(_0x2c69b0){return this[_0xfc75('0x22')][_0xfc75('0x24')](this,_0x2c69b0);};AGIChannel[_0xfc75('0x25')][_0xfc75('0x26')]=function(){return this[_0xfc75('0x23')](_0xfc75('0x27'));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x28')]=function(_0x4128f7,_0x2f238c,_0x51e075){_0x4128f7=_0x4128f7===undefined?_0xfc75('0x29'):_0x4128f7;_0x2f238c=_0x2f238c===undefined?'5':_0x2f238c;_0x51e075=_0x51e075===undefined?'1':_0x51e075;return this['sendRequest'](util[_0xfc75('0x2a')](_0xfc75('0x2b'),_0x4128f7,_0x2f238c*0x3e8,_0x51e075));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x2c')]=function(_0x2ae0fe){_0x2ae0fe=_0x2ae0fe||_0xfc75('0x2d');return this[_0xfc75('0x23')](util['format'](_0xfc75('0x2e'),_0x2ae0fe));};AGIChannel[_0xfc75('0x25')]['exec']=function(_0xe3d8a7,_0x5ef725){if(_[_0xfc75('0x2f')](_0x5ef725)){return this[_0xfc75('0x23')](util[_0xfc75('0x2a')](_0xfc75('0x30'),_0xe3d8a7,_0x5ef725[_0xfc75('0x31')](',')));}return this[_0xfc75('0x23')](util[_0xfc75('0x2a')](_0xfc75('0x30'),_0xe3d8a7,_0x5ef725));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x32')]=function(_0x4bc645){return this[_0xfc75('0x23')](util[_0xfc75('0x2a')](_0xfc75('0x33'),_0x4bc645));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x34')]=function(_0x212a47){return this[_0xfc75('0x23')](util['format']('SET\x20EXTENSION\x20%s',_0x212a47));};AGIChannel['prototype'][_0xfc75('0x35')]=function(_0x34bfa4){return this[_0xfc75('0x23')](util[_0xfc75('0x2a')](_0xfc75('0x36'),_0x34bfa4));};AGIChannel[_0xfc75('0x25')]['hangup']=function(){return this[_0xfc75('0x23')](_0xfc75('0x37'));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x38')]=function(_0xb2078e,_0x1c41e1){var _0x24cc14=_[_0xfc75('0x39')](_0x1c41e1)||_[_0xfc75('0x3a')](_0x1c41e1)?_0x1c41e1[_0xfc75('0x3b')]():_0x1c41e1;return this[_0xfc75('0x23')](util[_0xfc75('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xb2078e,_0x24cc14?_0x24cc14[_0xfc75('0x3b')]()[_0xfc75('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x3c')]=function(_0x5e1e23,_0x5bc36c){return this[_0xfc75('0x23')](util[_0xfc75('0x2a')](_0xfc75('0x3d'),_0x5e1e23,_0x5bc36c));};AGIChannel[_0xfc75('0x25')]['sayDigits']=function(_0x2d2a9c,_0x53a951){return this[_0xfc75('0x23')](util[_0xfc75('0x2a')](_0xfc75('0x3e'),_0x2d2a9c,_0x53a951));};AGIChannel['prototype'][_0xfc75('0x3f')]=function(_0xcf0379,_0x5679b2){return this[_0xfc75('0x23')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcf0379,_0x5679b2));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x40')]=function(_0x58af60,_0x51ab5f,_0x5c8e05){_0x51ab5f=_0x51ab5f||this[_0xfc75('0x41')];_0x5c8e05=_0x5c8e05||0x1;this['setContext'](_0x58af60);this['setExtension'](_0x51ab5f);this[_0xfc75('0x35')](_0x5c8e05);return this['noop'](util[_0xfc75('0x2a')](_0xfc75('0x42'),_0x58af60,_0x51ab5f,_0x5c8e05));};AGIChannel['prototype'][_0xfc75('0x43')]=function(_0x5c31a1){return this[_0xfc75('0x23')](util[_0xfc75('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x5c31a1));};AGIChannel[_0xfc75('0x25')][_0xfc75('0x44')]=function(_0x594186,_0x33d878,_0x5e0d27,_0x4a80c6,_0x23f497,_0x50a1d0){_0x33d878=_0x33d878||_0xfc75('0x45');_0x5e0d27=_0x5e0d27||'';_0x4a80c6=_0x4a80c6===undefined?-0x1:_0x4a80c6==='-1'?-0x1:_0x4a80c6*0x3e8;_0x23f497=_0x23f497===undefined?'':'s='+_0x23f497;_0x50a1d0=_0x50a1d0?_0xfc75('0x46'):'';return this[_0xfc75('0x23')](util[_0xfc75('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x594186,_0x33d878,_0x5e0d27,_0x4a80c6,_0x50a1d0,_0x23f497));};AGIChannel[_0xfc75('0x25')]['streamFile']=function(_0x254c55,_0x1d91a4){_0x1d91a4=_0x1d91a4||'';return this[_0xfc75('0x23')](util[_0xfc75('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x254c55,_0x1d91a4));};AGIChannel[_0xfc75('0x25')]['agi']=function(_0xaa58a1){return this[_0xfc75('0x47')]('AGI',_0xaa58a1);};AGIChannel[_0xfc75('0x25')]['wait']=function(_0x49d5fd){return this[_0xfc75('0x47')]('WAIT',_0x49d5fd);};AGIChannel['prototype'][_0xfc75('0x19')]=function(_0x25faaf,_0x3d4e5d){this['noop'](util[_0xfc75('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x25faaf['id'],_0x25faaf[_0xfc75('0x48')],_0x3d4e5d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 157a4dd..f78618d 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 _0x3dea=['apply','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x49d5c7,_0x3f77aa){var _0x2f1f5e=function(_0x58d445){while(--_0x58d445){_0x49d5c7['push'](_0x49d5c7['shift']());}};_0x2f1f5e(++_0x3f77aa);}(_0x3dea,0xf2));var _0xa3de=function(_0x38ceee,_0x50a819){_0x38ceee=_0x38ceee-0x0;var _0xade7c1=_0x3dea[_0x38ceee];return _0xade7c1;};'use strict';var util=require(_0xa3de('0x0'));var error={'E_AGI_UNDEFINED':_0xa3de('0x1'),'E_AGI_ARGUMENT_PORT':_0xa3de('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xa3de('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xa3de('0x4'),'E_AGI_SOCKET_ERROR':_0xa3de('0x5'),'E_AGI_SOCKET_CLOSE':_0xa3de('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xa3de('0x7'),'E_AGI_COMMAND_EMPTY':_0xa3de('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa3de('0x9'),'E_AGI_IVR_ENTRY':_0xa3de('0xa')};function AGIError(_0x3e7152){var _0x3e7152=_0x3e7152||null,_0x3b2ef8=_0x3b2ef8||[],_0x2b39f2=0x1,_0x527f5f='';if(!error[_0x3e7152]){_0x3e7152=_0xa3de('0xb');}_0x3b2ef8[_0xa3de('0xc')](error[_0x3e7152]);while(arguments[_0x2b39f2]){_0x3b2ef8[_0xa3de('0xc')](arguments[_0x2b39f2]);_0x2b39f2++;}_0x527f5f=util['format'][_0xa3de('0xd')](util,_0x3b2ef8);this['message']=_0x527f5f;this['name']=_0x3e7152;}module[_0xa3de('0xe')]=AGIError; \ No newline at end of file +var _0xe6a3=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x411e75,_0x1d4448){var _0x49ddc7=function(_0x556311){while(--_0x556311){_0x411e75['push'](_0x411e75['shift']());}};_0x49ddc7(++_0x1d4448);}(_0xe6a3,0xc1));var _0x3e6a=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xe6a3[_0x2f57b2];return _0x5ace77;};'use strict';var util=require(_0x3e6a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x3e6a('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3e6a('0x2'),'E_AGI_SOCKET_ERROR':_0x3e6a('0x3'),'E_AGI_SOCKET_CLOSE':_0x3e6a('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x3e6a('0x5'),'E_AGI_COMMAND_EMPTY':_0x3e6a('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3e6a('0x7'),'E_AGI_IVR_ENTRY':_0x3e6a('0x8')};function AGIError(_0x323e22){var _0x323e22=_0x323e22||null,_0x24afd9=_0x24afd9||[],_0x42a195=0x1,_0x127db6='';if(!error[_0x323e22]){_0x323e22=_0x3e6a('0x9');}_0x24afd9[_0x3e6a('0xa')](error[_0x323e22]);while(arguments[_0x42a195]){_0x24afd9[_0x3e6a('0xa')](arguments[_0x42a195]);_0x42a195++;}_0x127db6=util[_0x3e6a('0xb')][_0x3e6a('0xc')](util,_0x24afd9);this['message']=_0x127db6;this[_0x3e6a('0xd')]=_0x323e22;}module[_0x3e6a('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a13a45a..013232d 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 _0x5013=['agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','stop\x20traverse','length','info','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x474ea2,_0x4f5450){var _0x43a75b=function(_0x39b7d6){while(--_0x39b7d6){_0x474ea2['push'](_0x474ea2['shift']());}};_0x43a75b(++_0x4f5450);}(_0x5013,0x13f));var _0x3501=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x5013[_0x387777];return _0x3f84c0;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x3501('0x0'));var verticesWithRetry=[_0x3501('0x1'),_0x3501('0x2'),_0x3501('0x3')];var Graph=function(){this['vertices']={};this[_0x3501('0x4')]={};this[_0x3501('0x5')]=0x0;};Graph[_0x3501('0x6')][_0x3501('0x7')]=function(_0x555ccf){this[_0x3501('0x8')][_0x555ccf['id']]=_0x555ccf;this[_0x3501('0x4')][_0x555ccf['id']]=[];};Graph[_0x3501('0x6')]['addEdge']=function(_0x22ed40,_0x2f7be9,_0xb7cd86){this[_0x3501('0x4')][_0x22ed40][_0x3501('0x9')]({'target':_0x2f7be9,'condition':_0xb7cd86});this['numberOfEdges']+=0x1;};Graph[_0x3501('0x6')][_0x3501('0xa')]=function(){return _[_0x3501('0xa')](this[_0x3501('0x8')]);};Graph['prototype'][_0x3501('0xb')]=function(){return this[_0x3501('0x5')];};Graph[_0x3501('0x6')][_0x3501('0xc')]=function(_0xd3c276){return this[_0x3501('0x8')][_0xd3c276];};Graph['prototype'][_0x3501('0xd')]=function(_0x27481b,_0x4622c2){if(!this[_0x3501('0x8')][_0x27481b]){return logger['info'](_0x3501('0xe'));}var _0x251ae7=_0x4622c2(this[_0x3501('0x8')][_0x27481b]);if(!_0x251ae7){return logger['info'](_0x3501('0xf'));}if(this[_0x3501('0x4')][_0x27481b][_0x3501('0x10')]===0x0){return logger[_0x3501('0x11')]('no\x20edge/s\x20available');}for(var _0x353584=0x0,_0x2c7d1e=[],_0x289563=![];_0x353584\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','toJson','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','extension','close','Project\x20%s\x20not\x20found','getLicense','voice','callysquare'];(function(_0x6d4a75,_0x316f84){var _0xbc9ec2=function(_0x170169){while(--_0x170169){_0x6d4a75['push'](_0x6d4a75['shift']());}};_0xbc9ec2(++_0x316f84);}(_0xfbf0,0xb7));var _0x0fbf=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xfbf0[_0x59c301];return _0x3866b9;};'use strict';var parser=require(_0x0fbf('0x0'));var _=require(_0x0fbf('0x1'));var syncho=require(_0x0fbf('0x2'));var util=require(_0x0fbf('0x3'));var moment=require(_0x0fbf('0x4'));var config=require(_0x0fbf('0x5'));var logger=require(_0x0fbf('0x6'))(_0x0fbf('0x7'));var utilLicense=require('../../config/license/util');var rpc=require(_0x0fbf('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x0fbf('0x9'));var Vertices=require(_0x0fbf('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0fbf('0x7')]=_[_0x0fbf('0xb')](config[_0x0fbf('0x7')],{'ip':_0x0fbf('0xc'),'port':0x11dd});function connectionHandler(_0x10f91a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x10f91a);agiHandler(_0x10f91a);}catch(_0x12686b){logger[_0x0fbf('0xd')](_0x12686b[_0x0fbf('0xe')]);}});});}function listeningHandler(){console['log'](_0x0fbf('0xf'),config[_0x0fbf('0x7')][_0x0fbf('0x10')]);logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config['agi'][_0x0fbf('0x10')]));}function errorHandler(_0x268cb2){if(_0x268cb2&&_0x268cb2[_0x0fbf('0x13')]&&_0x268cb2[_0x0fbf('0x14')]){logger[_0x0fbf('0xd')](util[_0x0fbf('0x12')](_0x0fbf('0x15'),_0x268cb2[_0x0fbf('0x13')],_0x268cb2['message']));}else{logger[_0x0fbf('0xd')](util['format'](_0x0fbf('0x16'),_0x268cb2[_0x0fbf('0xe')]));}}function closeHandler(){logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')](_0x0fbf('0x17'),this[_0x0fbf('0x18')],this[_0x0fbf('0x19')],this[_0x0fbf('0x1a')],this[_0x0fbf('0x1b')],this[_0x0fbf('0x1c')]));try{createSquareReport(this);}catch(_0x19ea07){logger[_0x0fbf('0xd')](_0x19ea07[_0x0fbf('0xe')]);}}function timeoutHandler(){logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')](_0x0fbf('0x1d'),this[_0x0fbf('0x18')],this[_0x0fbf('0x19')],this[_0x0fbf('0x1a')],this[_0x0fbf('0x1b')],this[_0x0fbf('0x1c')]));}function hangupHandler(){logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')](_0x0fbf('0x1e'),this['arg_1'],this['calleridname'],this[_0x0fbf('0x1a')],this[_0x0fbf('0x1b')],this[_0x0fbf('0x1c')]));this[_0x0fbf('0x1f')]=!![];}function getRoot(_0x105fff){return parser[_0x0fbf('0x20')](_0x105fff,{'object':!![]})['mxGraphModel'][_0x0fbf('0x21')];}function addVertex(_0x734fb3,_0x4dbf03,_0x3f9a44){_0x4dbf03[_0x0fbf('0x22')]=_0x3f9a44;if(_0x4dbf03[_0x0fbf('0x23')](_0x0fbf('0x24'))){_0x4dbf03['maxRetry']=parseInt(_0x4dbf03[_0x0fbf('0x24')],0xa);}_0x734fb3[_0x0fbf('0x25')](_[_0x0fbf('0x26')](_0x4dbf03,_0x0fbf('0x27')));}function initGraph(_0x463062,_0x3154e0){var _0x4a005d=new Graph();for(var _0x58c431 in _0x463062){if(_0x463062['hasOwnProperty'](_0x58c431)){if(_[_0x0fbf('0x28')](_0x463062[_0x58c431])){for(var _0x19fcb0=0x0;_0x19fcb0<_0x463062[_0x58c431][_0x0fbf('0x29')];_0x19fcb0+=0x1){addVertex(_0x4a005d,_0x463062[_0x58c431][_0x19fcb0],_0x58c431);}}else{addVertex(_0x4a005d,_0x463062[_0x58c431],_0x58c431);}}}for(var _0x1250fe=0x0;_0x1250fe<_0x3154e0['length'];_0x1250fe+=0x1){if(_0x3154e0[_0x1250fe][_0x0fbf('0x2a')]&&_0x3154e0[_0x1250fe][_0x0fbf('0x2b')]){_0x4a005d[_0x0fbf('0x2c')](_0x3154e0[_0x1250fe]['source'],_0x3154e0[_0x1250fe][_0x0fbf('0x2b')],_0x3154e0[_0x1250fe][_0x0fbf('0x2d')]);}}return _0x4a005d;}function getSquareProject(_0x22ffb9,_0x4730f5){rpc[_0x0fbf('0x2e')](_0x22ffb9)[_0x0fbf('0x2f')](function(_0x18e23b){_0x4730f5(null,_0x18e23b);})[_0x0fbf('0x30')](function(_0x901815){_0x4730f5(null,_0x901815);});}function createSquareReport(_0x502d77,_0xd42901){rpc[_0x0fbf('0x31')](_0x502d77)['then'](function(_0x2a35d1){if(_0xd42901){_0xd42901(null,_0x2a35d1);}})[_0x0fbf('0x30')](function(_0x1151b1){if(_0xd42901){_0xd42901(null,_0x1151b1);}});}function setChannelVariables(_0x4394a2){for(var _0x56745e in _0x4394a2){if(_0x4394a2[_0x0fbf('0x23')](_0x56745e)){if(_0x56745e[_0x0fbf('0x32')](_0x0fbf('0x33'))===0x0){_0x4394a2[_0x56745e[_0x0fbf('0x34')](0x4)]=_0x4394a2[_0x56745e];delete _0x4394a2[_0x56745e];}}}}function getLogFromObject(_0x558cb1){return util[_0x0fbf('0x35')](_0x558cb1,{'showHidden':![],'depth':null});}function agiHandler(_0x419750){var _0x56b811,_0x134c86,_0x9030bc,_0x107322,_0x2f754f;logger[_0x0fbf('0x36')](_0x0fbf('0x37'),JSON[_0x0fbf('0x38')](_0x419750,null,0x2));logger['info'](util['format'](_0x0fbf('0x39'),_0x419750[_0x0fbf('0x18')],_0x419750[_0x0fbf('0x19')],_0x419750[_0x0fbf('0x1a')],_0x419750[_0x0fbf('0x1b')],_0x419750[_0x0fbf('0x1c')]));_0x419750['on'](_0x0fbf('0xd'),errorHandler);_0x419750['on']('close',closeHandler);_0x419750['on']('timeout',timeoutHandler);_0x419750[_0x0fbf('0x1f')]=![];_0x419750['on'](_0x0fbf('0x3a'),hangupHandler);var _0x447bc8=getSquareProject[_0x0fbf('0x3b')](null,_0x419750['arg_1']);if(_0x447bc8){if(_0x447bc8[_0x0fbf('0x3c')]){_0x56b811=getRoot(_0x447bc8[_0x0fbf('0x3c')]);if(_0x56b811&&_0x56b811[_0x0fbf('0x3d')]){logger[_0x0fbf('0x36')](_0x0fbf('0x21'),JSON['stringify'](_0x56b811,null,0x2));_0x419750[_0x0fbf('0x3e')]=moment()[_0x0fbf('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x134c86=initGraph(_[_0x0fbf('0x26')](_0x56b811,_0x0fbf('0x27')),_0x56b811['mxCell']);_0x9030bc=new Vertices(_0x419750,rpc,mailRpc);logger[_0x0fbf('0x11')](util['format'](_0x0fbf('0x3f'),_0x419750[_0x0fbf('0x18')],_0x419750['calleridname'],_0x419750['callerid'],_0x419750[_0x0fbf('0x1b')],_0x419750[_0x0fbf('0x1c')]));_0x134c86[_0x0fbf('0x40')](_0x56b811[_0x0fbf('0x3d')]['id'],function(_0x3a86df){try{_0x3a86df=_0x9030bc[_0x0fbf('0x41')](_0x3a86df);logger[_0x0fbf('0x36')]('vertex',JSON[_0x0fbf('0x38')](_0x3a86df,null,0x2));if(_0x3a86df['agicommand']===_0x0fbf('0x42')){logger[_0x0fbf('0x11')](_0x0fbf('0x43'));_0x419750['context']=_0x3a86df[_0x0fbf('0x44')]||_0x419750['context'];_0x419750['extension']=_0x3a86df['extension'];_0x419750[_0x0fbf('0x45')]=_0x3a86df[_0x0fbf('0x45')]?_0x3a86df['priority']-0x1:0x1;return null;}else if(_0x3a86df&&_0x9030bc[_0x3a86df[_0x0fbf('0x22')]]){_0x2f754f=_0x9030bc[_0x3a86df[_0x0fbf('0x22')]](_0x3a86df);logger[_0x0fbf('0x11')](_0x0fbf('0x46'),JSON['stringify'](_0x2f754f,null,0x2));if(_0x2f754f&&_0x2f754f[_0x0fbf('0x47')]===AGI_CODE_SUCCESS&&_0x2f754f[_0x0fbf('0x48')]!==AGI_RESULT_ERROR&&!_0x419750[_0x0fbf('0x1f')]){logger['debug'](_0x0fbf('0x46'),getLogFromObject(_0x2f754f));return _[_0x0fbf('0x49')](_0x2f754f[_0x0fbf('0x48')])?null:_0x2f754f[_0x0fbf('0x48')][_0x0fbf('0x4a')]();}else{logger[_0x0fbf('0xd')]('response',getLogFromObject(_0x2f754f));return null;}}else{logger['error'](_0x0fbf('0x4b'));return null;}}catch(_0x337544){logger[_0x0fbf('0xd')](_0x337544[_0x0fbf('0xe')]);return null;}});if(_0x56b811[_0x0fbf('0x4c')]){logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')](_0x0fbf('0x4d'),_0x419750[_0x0fbf('0x18')],_0x419750[_0x0fbf('0x19')],_0x419750[_0x0fbf('0x1a')],_0x419750[_0x0fbf('0x1b')],_0x419750[_0x0fbf('0x1c')]));_0x134c86[_0x0fbf('0x40')](_0x56b811[_0x0fbf('0x4c')]['id'],function(_0x5a2d77){try{_0x5a2d77=_0x9030bc[_0x0fbf('0x41')](_0x5a2d77);logger[_0x0fbf('0x36')](_0x0fbf('0x4e'),JSON['stringify'](_0x5a2d77,null,0x2));if(_0x5a2d77&&_0x9030bc[_0x5a2d77['agicommand']]){_0x2f754f=_0x9030bc[_0x5a2d77[_0x0fbf('0x22')]](_0x5a2d77);if(_0x2f754f){logger[_0x0fbf('0x36')](_0x0fbf('0x46'),getLogFromObject(_0x2f754f));return _[_0x0fbf('0x49')](_0x2f754f['result'])?null:_0x2f754f['result'][_0x0fbf('0x4a')]();}else{logger[_0x0fbf('0xd')](_0x0fbf('0x46'),getLogFromObject(_0x2f754f));return null;}}else{logger['error'](_0x0fbf('0x4b'));return null;}}catch(_0xd88470){logger[_0x0fbf('0xd')](_0xd88470[_0x0fbf('0xe')]);return null;}});}logger['info'](util['format'](_0x0fbf('0x4f'),_0x419750[_0x0fbf('0x18')],_0x419750[_0x0fbf('0x19')],_0x419750['callerid'],_0x419750[_0x0fbf('0x1b')],_0x419750[_0x0fbf('0x1c')]));logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x419750[_0x0fbf('0x44')],_0x419750['extension'],parseInt(_0x419750[_0x0fbf('0x45')],0xa)+0x1));_0x419750[_0x0fbf('0x50')](_0x419750[_0x0fbf('0x44')],_0x419750[_0x0fbf('0x51')],parseInt(_0x419750[_0x0fbf('0x45')],0xa)+0x1);_0x419750['close']();}}else{logger[_0x0fbf('0xd')](util['format']('Project\x20%s\x20not\x20published',_0x419750[_0x0fbf('0x18')]));_0x419750['continueAt'](_0x419750[_0x0fbf('0x44')],_0x419750[_0x0fbf('0x51')],parseInt(_0x419750[_0x0fbf('0x45')],0xa)+0x1);_0x419750[_0x0fbf('0x52')]();}}else{logger[_0x0fbf('0xd')](util[_0x0fbf('0x12')](_0x0fbf('0x53'),_0x419750[_0x0fbf('0x18')]));_0x419750[_0x0fbf('0x50')](_0x419750[_0x0fbf('0x44')],_0x419750[_0x0fbf('0x51')],parseInt(_0x419750[_0x0fbf('0x45')],0xa)+0x1);_0x419750[_0x0fbf('0x52')]();}}function main(){var _0x56e4ee;return utilLicense[_0x0fbf('0x54')]()[_0x0fbf('0x2f')](function(_0x12db86){if(_0x12db86){if(_0x12db86[_0x0fbf('0x55')]){if(_0x12db86[_0x0fbf('0x56')]&&_0x12db86[_0x0fbf('0x56')]>0x0){logger[_0x0fbf('0x11')](util[_0x0fbf('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x12db86[_0x0fbf('0x56')]));_0x56e4ee=_0x12db86[_0x0fbf('0x56')];}else{logger[_0x0fbf('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x0fbf('0x11')](_0x0fbf('0x57'));_0x56e4ee=-0x1;}}})['catch'](function(_0x364f56){logger['error']('[LICENSE]',_0x364f56[_0x0fbf('0xe')]);})['finally'](function(){var _0x5d85d7=require(_0x0fbf('0x58'))(config[_0x0fbf('0x7')]['port'],config[_0x0fbf('0x7')]['ip'],_0x56e4ee);_0x5d85d7['on'](_0x0fbf('0xd'),errorHandler);_0x5d85d7['on'](_0x0fbf('0x59'),listeningHandler);_0x5d85d7['on']('connection',connectionHandler);_0x5d85d7['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x90dd=['sync','start','debug','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','syncho','moment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[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','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout'];(function(_0x29bd12,_0x2c16b1){var _0x302879=function(_0x8f54f3){while(--_0x8f54f3){_0x29bd12['push'](_0x29bd12['shift']());}};_0x302879(++_0x2c16b1);}(_0x90dd,0x133));var _0xd90d=function(_0x13207b,_0x19865d){_0x13207b=_0x13207b-0x0;var _0x15992e=_0x90dd[_0x13207b];return _0x15992e;};'use strict';var parser=require(_0xd90d('0x0'));var _=require(_0xd90d('0x1'));var syncho=require(_0xd90d('0x2'));var util=require('util');var moment=require(_0xd90d('0x3'));var config=require('../../config/environment');var logger=require(_0xd90d('0x4'))(_0xd90d('0x5'));var utilLicense=require(_0xd90d('0x6'));var rpc=require(_0xd90d('0x7'));var mailRpc=require(_0xd90d('0x8'));var Graph=require(_0xd90d('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd90d('0x5')]=_[_0xd90d('0xa')](config[_0xd90d('0x5')],{'ip':_0xd90d('0xb'),'port':0x11dd});function connectionHandler(_0x16ab23){process[_0xd90d('0xc')](function(){syncho(function(){try{setChannelVariables(_0x16ab23);agiHandler(_0x16ab23);}catch(_0x315999){logger[_0xd90d('0xd')](_0x315999['stack']);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xd90d('0x5')][_0xd90d('0xe')]);logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x11'),config[_0xd90d('0x5')]['ip'],config[_0xd90d('0x5')][_0xd90d('0xe')]));}function errorHandler(_0x1b258f){if(_0x1b258f&&_0x1b258f[_0xd90d('0x12')]&&_0x1b258f[_0xd90d('0x13')]){logger[_0xd90d('0xd')](util[_0xd90d('0x10')](_0xd90d('0x14'),_0x1b258f[_0xd90d('0x12')],_0x1b258f[_0xd90d('0x13')]));}else{logger[_0xd90d('0xd')](util[_0xd90d('0x10')](_0xd90d('0x15'),_0x1b258f[_0xd90d('0x16')]));}}function closeHandler(){logger['info'](util[_0xd90d('0x10')](_0xd90d('0x17'),this[_0xd90d('0x18')],this[_0xd90d('0x19')],this[_0xd90d('0x1a')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x5205d4){logger[_0xd90d('0xd')](_0x5205d4[_0xd90d('0x16')]);}}function timeoutHandler(){logger[_0xd90d('0xf')](util[_0xd90d('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd90d('0x18')],this[_0xd90d('0x19')],this['callerid'],this[_0xd90d('0x1b')],this[_0xd90d('0x1c')]));}function hangupHandler(){logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x1d'),this['arg_1'],this['calleridname'],this[_0xd90d('0x1a')],this[_0xd90d('0x1b')],this['uniqueid']));this[_0xd90d('0x1e')]=!![];}function getRoot(_0x2cb96a){return parser[_0xd90d('0x1f')](_0x2cb96a,{'object':!![]})[_0xd90d('0x20')][_0xd90d('0x21')];}function addVertex(_0x4b19d1,_0x404910,_0x2bbd7f){_0x404910[_0xd90d('0x22')]=_0x2bbd7f;if(_0x404910[_0xd90d('0x23')]('retry')){_0x404910[_0xd90d('0x24')]=parseInt(_0x404910[_0xd90d('0x25')],0xa);}_0x4b19d1['addVertex'](_[_0xd90d('0x26')](_0x404910,_0xd90d('0x27')));}function initGraph(_0x1fab79,_0x48e30a){var _0xdbabe3=new Graph();for(var _0x325139 in _0x1fab79){if(_0x1fab79[_0xd90d('0x23')](_0x325139)){if(_[_0xd90d('0x28')](_0x1fab79[_0x325139])){for(var _0x4c8ada=0x0;_0x4c8ada<_0x1fab79[_0x325139][_0xd90d('0x29')];_0x4c8ada+=0x1){addVertex(_0xdbabe3,_0x1fab79[_0x325139][_0x4c8ada],_0x325139);}}else{addVertex(_0xdbabe3,_0x1fab79[_0x325139],_0x325139);}}}for(var _0x3192d5=0x0;_0x3192d5<_0x48e30a['length'];_0x3192d5+=0x1){if(_0x48e30a[_0x3192d5][_0xd90d('0x2a')]&&_0x48e30a[_0x3192d5][_0xd90d('0x2b')]){_0xdbabe3[_0xd90d('0x2c')](_0x48e30a[_0x3192d5]['source'],_0x48e30a[_0x3192d5][_0xd90d('0x2b')],_0x48e30a[_0x3192d5]['value']);}}return _0xdbabe3;}function getSquareProject(_0x15f914,_0x7b52da){rpc[_0xd90d('0x2d')](_0x15f914)[_0xd90d('0x2e')](function(_0x24aef3){_0x7b52da(null,_0x24aef3);})['catch'](function(_0x55739b){_0x7b52da(null,_0x55739b);});}function createSquareReport(_0x11c63e,_0x31358a){rpc[_0xd90d('0x2f')](_0x11c63e)[_0xd90d('0x2e')](function(_0x14ab99){if(_0x31358a){_0x31358a(null,_0x14ab99);}})[_0xd90d('0x30')](function(_0x3d122f){if(_0x31358a){_0x31358a(null,_0x3d122f);}});}function setChannelVariables(_0x8d4cf0){for(var _0x294a92 in _0x8d4cf0){if(_0x8d4cf0[_0xd90d('0x23')](_0x294a92)){if(_0x294a92[_0xd90d('0x31')](_0xd90d('0x32'))===0x0){_0x8d4cf0[_0x294a92[_0xd90d('0x33')](0x4)]=_0x8d4cf0[_0x294a92];delete _0x8d4cf0[_0x294a92];}}}}function getLogFromObject(_0x51fa3d){return util[_0xd90d('0x34')](_0x51fa3d,{'showHidden':![],'depth':null});}function agiHandler(_0x53fe16){var _0xc811b1,_0xd3e5a3,_0xc097d4,_0x20736f,_0xbc1491;logger['debug']('variables',JSON[_0xd90d('0x35')](_0x53fe16,null,0x2));logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x36'),_0x53fe16['arg_1'],_0x53fe16[_0xd90d('0x19')],_0x53fe16[_0xd90d('0x1a')],_0x53fe16[_0xd90d('0x1b')],_0x53fe16[_0xd90d('0x1c')]));_0x53fe16['on']('error',errorHandler);_0x53fe16['on'](_0xd90d('0x37'),closeHandler);_0x53fe16['on'](_0xd90d('0x38'),timeoutHandler);_0x53fe16[_0xd90d('0x1e')]=![];_0x53fe16['on']('hangup',hangupHandler);var _0x29e88b=getSquareProject[_0xd90d('0x39')](null,_0x53fe16[_0xd90d('0x18')]);if(_0x29e88b){if(_0x29e88b['production']){_0xc811b1=getRoot(_0x29e88b['production']);if(_0xc811b1&&_0xc811b1[_0xd90d('0x3a')]){logger[_0xd90d('0x3b')]('root',JSON[_0xd90d('0x35')](_0xc811b1,null,0x2));_0x53fe16[_0xd90d('0x3c')]=moment()[_0xd90d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0xd3e5a3=initGraph(_['omit'](_0xc811b1,_0xd90d('0x27')),_0xc811b1[_0xd90d('0x27')]);_0xc097d4=new Vertices(_0x53fe16,rpc,mailRpc);logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x3d'),_0x53fe16[_0xd90d('0x18')],_0x53fe16['calleridname'],_0x53fe16[_0xd90d('0x1a')],_0x53fe16[_0xd90d('0x1b')],_0x53fe16['uniqueid']));_0xd3e5a3[_0xd90d('0x3e')](_0xc811b1['start']['id'],function(_0x4944d2){try{_0x4944d2=_0xc097d4[_0xd90d('0x3f')](_0x4944d2);logger[_0xd90d('0x3b')](_0xd90d('0x40'),JSON[_0xd90d('0x35')](_0x4944d2,null,0x2));if(_0x4944d2[_0xd90d('0x22')]===_0xd90d('0x41')){logger[_0xd90d('0xf')](_0xd90d('0x42'));_0x53fe16['context']=_0x4944d2[_0xd90d('0x43')]||_0x53fe16[_0xd90d('0x43')];_0x53fe16[_0xd90d('0x44')]=_0x4944d2[_0xd90d('0x44')];_0x53fe16[_0xd90d('0x45')]=_0x4944d2['priority']?_0x4944d2['priority']-0x1:0x1;return null;}else if(_0x4944d2&&_0xc097d4[_0x4944d2[_0xd90d('0x22')]]){_0xbc1491=_0xc097d4[_0x4944d2['agicommand']](_0x4944d2);logger[_0xd90d('0xf')](_0xd90d('0x46'),JSON['stringify'](_0xbc1491,null,0x2));if(_0xbc1491&&_0xbc1491[_0xd90d('0x47')]===AGI_CODE_SUCCESS&&_0xbc1491[_0xd90d('0x48')]!==AGI_RESULT_ERROR&&!_0x53fe16[_0xd90d('0x1e')]){logger[_0xd90d('0x3b')]('response',getLogFromObject(_0xbc1491));return _[_0xd90d('0x49')](_0xbc1491[_0xd90d('0x48')])?null:_0xbc1491[_0xd90d('0x48')][_0xd90d('0x4a')]();}else{logger[_0xd90d('0xd')](_0xd90d('0x46'),getLogFromObject(_0xbc1491));return null;}}else{logger['error'](_0xd90d('0x4b'));return null;}}catch(_0xa7abe){logger['error'](_0xa7abe[_0xd90d('0x16')]);return null;}});if(_0xc811b1['finally']){logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x4c'),_0x53fe16[_0xd90d('0x18')],_0x53fe16[_0xd90d('0x19')],_0x53fe16[_0xd90d('0x1a')],_0x53fe16[_0xd90d('0x1b')],_0x53fe16[_0xd90d('0x1c')]));_0xd3e5a3[_0xd90d('0x3e')](_0xc811b1[_0xd90d('0x4d')]['id'],function(_0x25a281){try{_0x25a281=_0xc097d4[_0xd90d('0x3f')](_0x25a281);logger[_0xd90d('0x3b')](_0xd90d('0x40'),JSON[_0xd90d('0x35')](_0x25a281,null,0x2));if(_0x25a281&&_0xc097d4[_0x25a281[_0xd90d('0x22')]]){_0xbc1491=_0xc097d4[_0x25a281['agicommand']](_0x25a281);if(_0xbc1491){logger[_0xd90d('0x3b')]('response',getLogFromObject(_0xbc1491));return _['isUndefined'](_0xbc1491['result'])?null:_0xbc1491[_0xd90d('0x48')][_0xd90d('0x4a')]();}else{logger[_0xd90d('0xd')](_0xd90d('0x46'),getLogFromObject(_0xbc1491));return null;}}else{logger['error'](_0xd90d('0x4b'));return null;}}catch(_0x1d6a16){logger[_0xd90d('0xd')](_0x1d6a16['stack']);return null;}});}logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x4e'),_0x53fe16[_0xd90d('0x18')],_0x53fe16['calleridname'],_0x53fe16[_0xd90d('0x1a')],_0x53fe16[_0xd90d('0x1b')],_0x53fe16[_0xd90d('0x1c')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x53fe16[_0xd90d('0x43')],_0x53fe16['extension'],parseInt(_0x53fe16[_0xd90d('0x45')],0xa)+0x1));_0x53fe16[_0xd90d('0x4f')](_0x53fe16[_0xd90d('0x43')],_0x53fe16['extension'],parseInt(_0x53fe16['priority'],0xa)+0x1);_0x53fe16['close']();}}else{logger[_0xd90d('0xd')](util[_0xd90d('0x10')](_0xd90d('0x50'),_0x53fe16[_0xd90d('0x18')]));_0x53fe16['continueAt'](_0x53fe16[_0xd90d('0x43')],_0x53fe16[_0xd90d('0x44')],parseInt(_0x53fe16[_0xd90d('0x45')],0xa)+0x1);_0x53fe16[_0xd90d('0x37')]();}}else{logger[_0xd90d('0xd')](util[_0xd90d('0x10')](_0xd90d('0x51'),_0x53fe16[_0xd90d('0x18')]));_0x53fe16['continueAt'](_0x53fe16[_0xd90d('0x43')],_0x53fe16[_0xd90d('0x44')],parseInt(_0x53fe16['priority'],0xa)+0x1);_0x53fe16['close']();}}function main(){var _0x2b3876;return utilLicense[_0xd90d('0x52')]()[_0xd90d('0x2e')](function(_0x2a3b69){if(_0x2a3b69){if(_0x2a3b69[_0xd90d('0x53')]){if(_0x2a3b69[_0xd90d('0x54')]&&_0x2a3b69[_0xd90d('0x54')]>0x0){logger[_0xd90d('0xf')](util[_0xd90d('0x10')](_0xd90d('0x55'),_0x2a3b69['callysquare']));_0x2b3876=_0x2a3b69[_0xd90d('0x54')];}else{logger[_0xd90d('0xf')](_0xd90d('0x56'));}}else{logger['info'](_0xd90d('0x57'));_0x2b3876=-0x1;}}})[_0xd90d('0x30')](function(_0x2590cc){logger[_0xd90d('0xd')](_0xd90d('0x58'),_0x2590cc[_0xd90d('0x16')]);})['finally'](function(){var _0x52635f=require('./server')(config[_0xd90d('0x5')][_0xd90d('0xe')],config[_0xd90d('0x5')]['ip'],_0x2b3876);_0x52635f['on']('error',errorHandler);_0x52635f['on'](_0xd90d('0x59'),listeningHandler);_0x52635f['on'](_0xd90d('0x5a'),connectionHandler);_0x52635f['on'](_0xd90d('0x37'),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 2f8759b..e9222fb 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 _0x96cc=['SendMail','jayson/promise','client','http','request','error','message','catch','sendMailMessage'];(function(_0x362eb,_0x2db069){var _0x4d4cb8=function(_0x22a470){while(--_0x22a470){_0x362eb['push'](_0x362eb['shift']());}};_0x4d4cb8(++_0x2db069);}(_0x96cc,0x133));var _0xc96c=function(_0x77cb50,_0x5af067){_0x77cb50=_0x77cb50-0x0;var _0x1124fb=_0x96cc[_0x77cb50];return _0x1124fb;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc96c('0x0'));var client=jayson[_0xc96c('0x1')][_0xc96c('0x2')]({'port':0x232b});function request(_0x18c0e7,_0x3081aa){return new BPromise(function(_0x21f639,_0x2c9ea1){return client[_0xc96c('0x3')](_0x18c0e7,_0x3081aa)['then'](function(_0x3109b4){if(_0x3109b4[_0xc96c('0x4')]){return _0x2c9ea1(_0x3109b4[_0xc96c('0x4')][_0xc96c('0x5')]);}else{return _0x21f639(_0x3109b4['result']);}})[_0xc96c('0x6')](function(_0x3bdcaf){return _0x2c9ea1(_0x3bdcaf);});});}exports[_0xc96c('0x7')]=function(_0x2306fb,_0x44def3){return request(_0xc96c('0x8'),{'account':_0x2306fb,'message':_0x44def3});}; \ No newline at end of file +var _0x97ba=['SendMail','bluebird','jayson/promise','client','http','request','message','catch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x97ba,0x169));var _0xa97b=function(_0x4b0cbd,_0x527d0b){_0x4b0cbd=_0x4b0cbd-0x0;var _0x4396d3=_0x97ba[_0x4b0cbd];return _0x4396d3;};'use strict';var BPromise=require(_0xa97b('0x0'));var jayson=require(_0xa97b('0x1'));var client=jayson[_0xa97b('0x2')][_0xa97b('0x3')]({'port':0x232b});function request(_0xf9074d,_0x26a9b4){return new BPromise(function(_0x435bb1,_0x12d418){return client[_0xa97b('0x4')](_0xf9074d,_0x26a9b4)['then'](function(_0x233508){if(_0x233508['error']){return _0x12d418(_0x233508['error'][_0xa97b('0x5')]);}else{return _0x435bb1(_0x233508['result']);}})[_0xa97b('0x6')](function(_0x24c164){return _0x12d418(_0x24c164);});});}exports['sendMailMessage']=function(_0x19de96,_0x507922){return request(_0xa97b('0x7'),{'account':_0x19de96,'message':_0x507922});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index f59f5dc..893716f 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 _0x0fec=['stream','Transform','_localBuffer','inherits','prototype','toString','_inBody','substring','length','trim','slice','emit','headers','indexOf','line','exports','util'];(function(_0x18e13d,_0x19b7fe){var _0x195bac=function(_0x19bace){while(--_0x19bace){_0x18e13d['push'](_0x18e13d['shift']());}};_0x195bac(++_0x19b7fe);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x4f1b13,_0x4773cc){_0x4f1b13=_0x4f1b13-0x0;var _0x28eded=_0x0fec[_0x4f1b13];return _0x28eded;};'use strict';var util=require(_0xc0fe('0x0'));var Transform=require(_0xc0fe('0x1'))[_0xc0fe('0x2')];function AGIReply(_0x557268){Transform['call'](this,_0x557268);this[_0xc0fe('0x3')]='';this['_inBody']=![];}util[_0xc0fe('0x4')](AGIReply,Transform);AGIReply[_0xc0fe('0x5')]['_transform']=function(_0x168055,_0x5abf3b,_0x3fce36){var _0x1073f0='\x0a',_0x4cc359=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x53e410=-0x1,_0x5b3f5a=-0x1,_0x326ab7='',_0x2cd914=0x0,_0x1e5dd3='',_0x4e8d11='';this['_localBuffer']+=_0x168055[_0xc0fe('0x6')]();_0x1e5dd3=this['_localBuffer'];if(!this[_0xc0fe('0x7')]){_0x2cd914=0x0;while(_0x4cc359[_0x2cd914]){while((_0x5b3f5a=_0x1e5dd3['indexOf'](_0x4cc359[_0x2cd914]))!=-0x1){_0x326ab7=_0x4cc359[_0x2cd914];_0x4e8d11=_0x1e5dd3[_0xc0fe('0x8')](0x0,_0x5b3f5a);_0x1e5dd3=_0x1e5dd3[_0xc0fe('0x8')](_0x5b3f5a+_0x326ab7[_0xc0fe('0x9')]);var _0x6931c2=_0x4e8d11['split'](_0x1073f0),_0x29cdc4=0x0,_0x31af60={},_0x559ad2='',_0x350a6d='',_0x2cd4bb=-0x1;while(_0x6931c2[_0x29cdc4]){_0x2cd4bb=_0x6931c2[_0x29cdc4]['indexOf'](':');if(_0x2cd4bb!=-0x1){_0x559ad2=_0x6931c2[_0x29cdc4]['slice'](0x0,_0x2cd4bb)[_0xc0fe('0xa')]();_0x350a6d=_0x6931c2[_0x29cdc4][_0xc0fe('0xb')](_0x2cd4bb+0x1)[_0xc0fe('0xa')]();if(_0x559ad2['length']>0x0){_0x31af60[_0x559ad2]=_0x350a6d;}}else{}_0x29cdc4++;}this[_0xc0fe('0xc')](_0xc0fe('0xd'),_0x31af60);this['_inBody']=!![];}_0x2cd914++;}this['_localBuffer']=_0x1e5dd3;}else{while((_0x53e410=_0x1e5dd3[_0xc0fe('0xe')](_0x1073f0))!=-0x1){_0x4e8d11=_0x1e5dd3[_0xc0fe('0x8')](0x0,_0x53e410);this[_0xc0fe('0xc')](_0xc0fe('0xf'),_0x4e8d11);_0x1e5dd3=_0x1e5dd3[_0xc0fe('0x8')](_0x53e410+_0x1073f0[_0xc0fe('0x9')]);}this[_0xc0fe('0x3')]=_0x1e5dd3;}_0x3fce36();};module[_0xc0fe('0x10')]=AGIReply; \ No newline at end of file +var _0x38f5=['emit','line','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim'];(function(_0x1d4760,_0x5a58e7){var _0x233074=function(_0x5846fb){while(--_0x5846fb){_0x1d4760['push'](_0x1d4760['shift']());}};_0x233074(++_0x5a58e7);}(_0x38f5,0x89));var _0x538f=function(_0x578dca,_0x1376f6){_0x578dca=_0x578dca-0x0;var _0x312fbe=_0x38f5[_0x578dca];return _0x312fbe;};'use strict';var util=require('util');var Transform=require(_0x538f('0x0'))[_0x538f('0x1')];function AGIReply(_0x580a6e){Transform[_0x538f('0x2')](this,_0x580a6e);this[_0x538f('0x3')]='';this[_0x538f('0x4')]=![];}util[_0x538f('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x175097,_0x2fa1bb,_0x232021){var _0x407489='\x0a',_0x387907=['\x0a\x0a',_0x538f('0x6')],_0x4f42d2=-0x1,_0x45e772=-0x1,_0x6e3292='',_0x5757a8=0x0,_0x4d324c='',_0x3801e4='';this['_localBuffer']+=_0x175097['toString']();_0x4d324c=this[_0x538f('0x3')];if(!this[_0x538f('0x4')]){_0x5757a8=0x0;while(_0x387907[_0x5757a8]){while((_0x45e772=_0x4d324c[_0x538f('0x7')](_0x387907[_0x5757a8]))!=-0x1){_0x6e3292=_0x387907[_0x5757a8];_0x3801e4=_0x4d324c[_0x538f('0x8')](0x0,_0x45e772);_0x4d324c=_0x4d324c['substring'](_0x45e772+_0x6e3292[_0x538f('0x9')]);var _0x3f3a95=_0x3801e4[_0x538f('0xa')](_0x407489),_0x2ec5b3=0x0,_0xf35c31={},_0x58ec83='',_0x1572c8='',_0x233360=-0x1;while(_0x3f3a95[_0x2ec5b3]){_0x233360=_0x3f3a95[_0x2ec5b3][_0x538f('0x7')](':');if(_0x233360!=-0x1){_0x58ec83=_0x3f3a95[_0x2ec5b3]['slice'](0x0,_0x233360)['trim']();_0x1572c8=_0x3f3a95[_0x2ec5b3][_0x538f('0xb')](_0x233360+0x1)[_0x538f('0xc')]();if(_0x58ec83[_0x538f('0x9')]>0x0){_0xf35c31[_0x58ec83]=_0x1572c8;}}else{}_0x2ec5b3++;}this[_0x538f('0xd')]('headers',_0xf35c31);this[_0x538f('0x4')]=!![];}_0x5757a8++;}this[_0x538f('0x3')]=_0x4d324c;}else{while((_0x4f42d2=_0x4d324c[_0x538f('0x7')](_0x407489))!=-0x1){_0x3801e4=_0x4d324c['substring'](0x0,_0x4f42d2);this[_0x538f('0xd')](_0x538f('0xe'),_0x3801e4);_0x4d324c=_0x4d324c[_0x538f('0x8')](_0x4f42d2+_0x407489[_0x538f('0x9')]);}this['_localBuffer']=_0x4d324c;}_0x232021();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 4a0c18f..c12e2eb 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 _0x566b=['LogoutUser','moment','lodash','util','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','name','ShowSquareOdbc','ShowUser','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x566b,0x10a));var _0xb566=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x566b[_0x413feb];return _0x40ee88;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb566('0x0'));var _=require(_0xb566('0x1'));var util=require(_0xb566('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x2329});function request(_0x21170c,_0x401ed7){return new BPromise(function(_0x3c5210,_0x22ea88){return client[_0xb566('0x3')](_0x21170c,_0x401ed7)['then'](function(_0x16c400){if(_0x16c400[_0xb566('0x4')]){return _0x22ea88(_0x16c400[_0xb566('0x4')][_0xb566('0x5')]);}else{return _0x3c5210(_0x16c400[_0xb566('0x6')]);}})[_0xb566('0x7')](function(_0x279001){return _0x22ea88(_0x279001);});});}exports[_0xb566('0x8')]=function(_0x10d1e9){return request(_0xb566('0x9'),{'options':{'raw':![],'where':{'name':_0x10d1e9},'attributes':[_0xb566('0xa')]}});};exports[_0xb566('0xb')]=function(_0x36aec9){return request(_0xb566('0xc'),{'options':{'raw':![],'where':{'id':_0x36aec9},'include':[{'model':_0xb566('0xd'),'as':_0xb566('0xe')}],'attributes':['id','name','email']}});};exports[_0xb566('0xf')]=function(_0x1ffacf){return request('ShowSquareProject',{'options':{'where':{'id':_0x1ffacf},'attributes':['name']}});};exports[_0xb566('0x10')]=function(_0x329387){return request(_0xb566('0x11'),{'options':{'where':{'id':_0x329387},'attributes':['name']}});};exports[_0xb566('0x12')]=function(_0x39bac6){return request(_0xb566('0x13'),{'options':{'where':{'id':_0x39bac6},'attributes':[_0xb566('0x14')]}});};exports['getSquareOdbcById']=function(_0x58d22d){return request(_0xb566('0x15'),{'options':{'where':{'id':_0x58d22d},'attributes':['dsn']}});};exports['getUserById']=function(_0x4d89c9){return request(_0xb566('0x16'),{'options':{'where':{'id':_0x4d89c9},'attributes':['name']}});};exports['getTrunkById']=function(_0x29501e){return request('ShowTrunk',{'options':{'where':{'id':_0x29501e},'attributes':[_0xb566('0x14')]}});};exports['getSoundById']=function(_0xb4a696){return request('ShowSound',{'options':{'where':{'id':_0xb4a696},'attributes':['save_name']}});};exports[_0xb566('0x17')]=function(_0x5f114d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5f114d},'include':[{'model':_0xb566('0x18'),'as':_0xb566('0x19')}]}});};exports[_0xb566('0x1a')]=function(_0x56ad0b){return request(_0xb566('0x1b'),{'options':{'where':{'id':_0x56ad0b},'attributes':['id',_0xb566('0x14')]}});};exports[_0xb566('0x1c')]=function(_0x462320){return request(_0xb566('0x1d'),{'body':_0x462320});};exports['createSquareDetailsReport']=function(_0x308ec2){return request(_0xb566('0x1e'),{'body':_0x308ec2});};exports[_0xb566('0x1f')]=function(_0x2bc58b){return request(_0xb566('0x20'),{'body':_['merge'](_0x2bc58b,{'project_name':_0x2bc58b[_0xb566('0x21')],'prev_project_name':_0x2bc58b[_0xb566('0x22')]||'','is_subproject':_0x2bc58b['arg_2']?!![]:![],'leaveAt':moment()[_0xb566('0x23')](_0xb566('0x24'))})});};exports[_0xb566('0x25')]=function(_0x59a369){return request('CreateSquareRecording',{'body':_0x59a369});};exports['createSquareMessage']=function(_0x1defe7){return request(_0xb566('0x26'),{'body':_0x1defe7});};exports[_0xb566('0x27')]=function(_0x30789a){return request(_0xb566('0x28'),{'options':{'raw':![],'where':{'phone':_0x30789a[_0xb566('0x29')],'ListId':_0x30789a[_0xb566('0x2a')]}}})[_0xb566('0x2b')](function(_0x2fc415){if(_0x2fc415){return _0x2fc415;}return request(_0xb566('0x2c'),{'body':_0x30789a});});};exports[_0xb566('0x2d')]=function(_0x1f5808){return request(_0xb566('0x2e'),{'options':{'where':{'id':_0x1f5808},'attributes':[_0xb566('0x14')]}});};exports[_0xb566('0x2f')]=function(_0x53a2df,_0x2b1074){return request('LoginUser',{'body':{'interface':_0x2b1074},'options':{'where':_0x53a2df}});};exports[_0xb566('0x30')]=function(_0x44bbed,_0x164626,_0x57ba00){return request(_0xb566('0x31'),{'body':{'type':_0x164626,'uniqueid':_0x57ba00},'options':{'where':_0x44bbed}});};exports[_0xb566('0x32')]=function(_0x303bd5){return request('UnpauseUser',{'body':{},'options':{'where':_0x303bd5}});};exports[_0xb566('0x33')]=function(_0x3c5e8c){return request(_0xb566('0x34'),{'body':{},'options':{'where':_0x3c5e8c}});}; \ No newline at end of file +var _0x4713=['ShowInterval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','http','request','then','error','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','getIntervalById'];(function(_0x2cc09b,_0x5c8579){var _0x36eb1c=function(_0x3a8b6a){while(--_0x3a8b6a){_0x2cc09b['push'](_0x2cc09b['shift']());}};_0x36eb1c(++_0x5c8579);}(_0x4713,0x1e3));var _0x3471=function(_0x2d4310,_0x2c4294){_0x2d4310=_0x2d4310-0x0;var _0x52099f=_0x4713[_0x2d4310];return _0x52099f;};'use strict';var BPromise=require(_0x3471('0x0'));var moment=require('moment');var _=require(_0x3471('0x1'));var util=require(_0x3471('0x2'));var jayson=require(_0x3471('0x3'));var client=jayson['client'][_0x3471('0x4')]({'port':0x2329});function request(_0x13dca3,_0x47753f){return new BPromise(function(_0x448867,_0x4ab4ad){return client[_0x3471('0x5')](_0x13dca3,_0x47753f)[_0x3471('0x6')](function(_0x5b13b4){if(_0x5b13b4[_0x3471('0x7')]){return _0x4ab4ad(_0x5b13b4[_0x3471('0x7')]['message']);}else{return _0x448867(_0x5b13b4['result']);}})[_0x3471('0x8')](function(_0x4f9d77){return _0x4ab4ad(_0x4f9d77);});});}exports[_0x3471('0x9')]=function(_0x5c3c8b){return request(_0x3471('0xa'),{'options':{'raw':![],'where':{'name':_0x5c3c8b},'attributes':[_0x3471('0xb')]}});};exports['getMailAccountById']=function(_0x321b96){return request(_0x3471('0xc'),{'options':{'raw':![],'where':{'id':_0x321b96},'include':[{'model':'MailServerOut','as':_0x3471('0xd')}],'attributes':['id',_0x3471('0xe'),_0x3471('0xf')]}});};exports[_0x3471('0x10')]=function(_0x2ed97b){return request(_0x3471('0xa'),{'options':{'where':{'id':_0x2ed97b},'attributes':[_0x3471('0xe')]}});};exports['getVoiceQueueById']=function(_0x5bfdb7){return request(_0x3471('0x11'),{'options':{'where':{'id':_0x5bfdb7},'attributes':[_0x3471('0xe')]}});};exports[_0x3471('0x12')]=function(_0x1c7caa){return request(_0x3471('0x13'),{'options':{'where':{'id':_0x1c7caa},'attributes':[_0x3471('0xe')]}});};exports[_0x3471('0x14')]=function(_0x314292){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x314292},'attributes':['dsn']}});};exports[_0x3471('0x15')]=function(_0x283b43){return request(_0x3471('0x16'),{'options':{'where':{'id':_0x283b43},'attributes':[_0x3471('0xe')]}});};exports[_0x3471('0x17')]=function(_0x77502a){return request('ShowTrunk',{'options':{'where':{'id':_0x77502a},'attributes':[_0x3471('0xe')]}});};exports[_0x3471('0x18')]=function(_0x506dad){return request(_0x3471('0x19'),{'options':{'where':{'id':_0x506dad},'attributes':['save_name']}});};exports[_0x3471('0x1a')]=function(_0xbeb34b){return request(_0x3471('0x1b'),{'options':{'raw':![],'where':{'id':_0xbeb34b},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x5ee14c){return request(_0x3471('0x1c'),{'options':{'where':{'id':_0x5ee14c},'attributes':['id','name']}});};exports[_0x3471('0x1d')]=function(_0x46b660){return request(_0x3471('0x1e'),{'body':_0x46b660});};exports[_0x3471('0x1f')]=function(_0x3011b1){return request(_0x3471('0x20'),{'body':_0x3011b1});};exports[_0x3471('0x21')]=function(_0x1e4f44){return request(_0x3471('0x22'),{'body':_[_0x3471('0x23')](_0x1e4f44,{'project_name':_0x1e4f44['arg_1'],'prev_project_name':_0x1e4f44[_0x3471('0x24')]||'','is_subproject':_0x1e4f44[_0x3471('0x24')]?!![]:![],'leaveAt':moment()[_0x3471('0x25')](_0x3471('0x26'))})});};exports['createSquareRecording']=function(_0x5b68cf){return request('CreateSquareRecording',{'body':_0x5b68cf});};exports[_0x3471('0x27')]=function(_0xf0f339){return request(_0x3471('0x28'),{'body':_0xf0f339});};exports['createCmContact']=function(_0x484e4f){return request(_0x3471('0x29'),{'options':{'raw':![],'where':{'phone':_0x484e4f['phone'],'ListId':_0x484e4f[_0x3471('0x2a')]}}})[_0x3471('0x6')](function(_0x1f020f){if(_0x1f020f){return _0x1f020f;}return request(_0x3471('0x2b'),{'body':_0x484e4f});});};exports[_0x3471('0x2c')]=function(_0x10acf5){return request(_0x3471('0x2d'),{'options':{'where':{'id':_0x10acf5},'attributes':[_0x3471('0xe')]}});};exports[_0x3471('0x2e')]=function(_0x21735f,_0x2b5080){return request(_0x3471('0x2f'),{'body':{'interface':_0x2b5080},'options':{'where':_0x21735f}});};exports['agentPause']=function(_0x1a8781,_0x4742ad,_0x1d14d8){return request(_0x3471('0x30'),{'body':{'type':_0x4742ad,'uniqueid':_0x1d14d8},'options':{'where':_0x1a8781}});};exports['agentUnpause']=function(_0x2bf021){return request('UnpauseUser',{'body':{},'options':{'where':_0x2bf021}});};exports[_0x3471('0x31')]=function(_0x3ea226){return request(_0x3471('0x32'),{'body':{},'options':{'where':_0x3ea226}});}; \ 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 618687d..54009d8 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 _0x2bd8=['./polly','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2bd8,0x130));var _0x82bd=function(_0x25fb3c,_0x637d46){_0x25fb3c=_0x25fb3c-0x0;var _0x20bdfa=_0x2bd8[_0x25fb3c];return _0x20bdfa;};var polly=require(_0x82bd('0x0'));var lex=require('./lex');module[_0x82bd('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1670=['./polly','./lex'];(function(_0x11eca1,_0x41afc4){var _0x250750=function(_0x17a0d2){while(--_0x17a0d2){_0x11eca1['push'](_0x11eca1['shift']());}};_0x250750(++_0x41afc4);}(_0x1670,0x9a));var _0x0167=function(_0x211307,_0x588bbd){_0x211307=_0x211307-0x0;var _0xc38a90=_0x1670[_0x211307];return _0xc38a90;};var polly=require(_0x0167('0x0'));var lex=require(_0x0167('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 6f4ae66..abcbc85 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9354=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9354,0x96));var _0x4935=function(_0x33feca,_0x2bd9ae){_0x33feca=_0x33feca-0x0;var _0x3c558f=_0x9354[_0x33feca];return _0x3c558f;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237){return lex(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237);}; \ 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 e34fd88..af1f847 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(_0x148095,_0x1f9a0c){var _0x1f104f=function(_0x5faa70){while(--_0x5faa70){_0x148095['push'](_0x148095['shift']());}};_0x1f104f(++_0x1f9a0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x291349,_0x1d0ad3){var _0x395ea6=function(_0x4626bd){while(--_0x4626bd){_0x291349['push'](_0x291349['shift']());}};_0x395ea6(++_0x1d0ad3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index fea6d94..9ddc619 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 _0x8508=['exports'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x8508,0x1ef));var _0x8850=function(_0x3ae0b8,_0x178af6){_0x3ae0b8=_0x3ae0b8-0x0;var _0x40dcc3=_0x8508[_0x3ae0b8];return _0x40dcc3;};'use strict';var polly=require('./lib/api');module[_0x8850('0x0')]=function(_0x5562e3,_0x571550,_0x3669fc,_0x39973f,_0x4c5253,_0x34ddb7,_0x11f857){return polly(_0x5562e3,_0x571550,_0x3669fc,_0x39973f,_0x4c5253,_0x34ddb7,_0x11f857);}; \ No newline at end of file +var _0xdc3a=['./lib/api','exports'];(function(_0x1c8852,_0xee593e){var _0x3fed0b=function(_0x18e995){while(--_0x18e995){_0x1c8852['push'](_0x1c8852['shift']());}};_0x3fed0b(++_0xee593e);}(_0xdc3a,0x15e));var _0xadc3=function(_0x37040d,_0x502dab){_0x37040d=_0x37040d-0x0;var _0x351080=_0xdc3a[_0x37040d];return _0x351080;};'use strict';var polly=require(_0xadc3('0x0'));module[_0xadc3('0x1')]=function(_0x13ec5e,_0x2235e3,_0x456cc1,_0x15fd90,_0x1dcbfc,_0x414a22,_0x2658f7){return polly(_0x13ec5e,_0x2235e3,_0x456cc1,_0x15fd90,_0x1dcbfc,_0x414a22,_0x2658f7);}; \ 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 8e439f8..e0917a7 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 _0x7afb=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','aws-sdk'];(function(_0xb3a49c,_0x34b468){var _0x4ff517=function(_0x562611){while(--_0x562611){_0xb3a49c['push'](_0xb3a49c['shift']());}};_0x4ff517(++_0x34b468);}(_0x7afb,0x1dd));var _0xb7af=function(_0x15474d,_0x3dc814){_0x15474d=_0x15474d-0x0;var _0x2d6f36=_0x7afb[_0x15474d];return _0x2d6f36;};'use strict';var fs=require('fs');var path=require(_0xb7af('0x0'));var BPromise=require(_0xb7af('0x1'));var rs=require('randomstring');var AWS=require(_0xb7af('0x2'));function pollyResult(_0x5b3964,_0x50b943,_0x402044){return new BPromise(function(_0x30a17f,_0xc30f1a){_0x5b3964['synthesizeSpeech'](_0x50b943,function(_0x4bae58,_0x50685e){if(_0x4bae58){_0xc30f1a(_0x4bae58);}else if(_0x50685e){if(_0x50685e[_0xb7af('0x3')]instanceof Buffer){fs[_0xb7af('0x4')](_0x402044,_0x50685e['AudioStream'],function(_0x1740b0){if(_0x1740b0){_0xc30f1a(_0x1740b0);}else{_0x30a17f();}});}else{_0xc30f1a(new Error(_0xb7af('0x5')));}}else{_0xc30f1a(new Error(_0xb7af('0x6')));}});});}module[_0xb7af('0x7')]=function(_0x4fb99c,_0x188801,_0x35a3a2,_0x12f6f9,_0x2b9a20,_0xb97fc7,_0xeb9ff2){var _0x3cf5b0=new AWS['Polly']({'accessKeyId':_0x4fb99c,'secretAccessKey':_0x188801,'region':_0x35a3a2});var _0x5da35a={'Text':_0x2b9a20,'TextType':_0xb97fc7||_0xb7af('0x8'),'OutputFormat':_0xb7af('0x9'),'VoiceId':_0x12f6f9};return pollyResult(_0x3cf5b0,_0x5da35a,_0xeb9ff2);}; \ No newline at end of file +var _0x64bf=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x64bf,0x154));var _0xf64b=function(_0x437530,_0x5e5a02){_0x437530=_0x437530-0x0;var _0x18b594=_0x64bf[_0x437530];return _0x18b594;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf64b('0x0'));var rs=require(_0xf64b('0x1'));var AWS=require(_0xf64b('0x2'));function pollyResult(_0x200b88,_0x5e83b7,_0x2dbe6d){return new BPromise(function(_0x558b20,_0x6c322c){_0x200b88[_0xf64b('0x3')](_0x5e83b7,function(_0xf6c469,_0x3a7581){if(_0xf6c469){_0x6c322c(_0xf6c469);}else if(_0x3a7581){if(_0x3a7581[_0xf64b('0x4')]instanceof Buffer){fs[_0xf64b('0x5')](_0x2dbe6d,_0x3a7581['AudioStream'],function(_0x4ae3b){if(_0x4ae3b){_0x6c322c(_0x4ae3b);}else{_0x558b20();}});}else{_0x6c322c(new Error(_0xf64b('0x6')));}}else{_0x6c322c(new Error(_0xf64b('0x7')));}});});}module['exports']=function(_0x592caf,_0x974799,_0x39f7f3,_0x53e8b7,_0x4d0c87,_0x16cc6f,_0x2b825b){var _0x1b5bdb=new AWS[(_0xf64b('0x8'))]({'accessKeyId':_0x592caf,'secretAccessKey':_0x974799,'region':_0x39f7f3});var _0x2cf7ae={'Text':_0x4d0c87,'TextType':_0x16cc6f||_0xf64b('0x9'),'OutputFormat':_0xf64b('0xa'),'VoiceId':_0x53e8b7};return pollyResult(_0x1b5bdb,_0x2cf7ae,_0x2b825b);}; \ 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 8379098..5852ee3 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 _0x6f6c=['./lib/api'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x6f6c,0x1e8));var _0xc6f6=function(_0x3f6051,_0x2720cd){_0x3f6051=_0x3f6051-0x0;var _0x587f8e=_0x6f6c[_0x3f6051];return _0x587f8e;};'use strict';var asr=require(_0xc6f6('0x0'));module['exports']=function(_0x2136f1,_0x398907,_0x10b493,_0x578234){return asr(_0x2136f1,_0x398907,_0x10b493);}; \ No newline at end of file +var _0x0c74=['./lib/api','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0c74,0x174));var _0x40c7=function(_0x4c2cf8,_0x1a7904){_0x4c2cf8=_0x4c2cf8-0x0;var _0x2dd086=_0x0c74[_0x4c2cf8];return _0x2dd086;};'use strict';var asr=require(_0x40c7('0x0'));module[_0x40c7('0x1')]=function(_0x5bb811,_0x59bb82,_0x281a58,_0x122c02){return asr(_0x5bb811,_0x59bb82,_0x281a58);}; \ 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 8fe8142..3a439d3 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 _0x83f1=['https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0x83f1,0x1cc));var _0x183f=function(_0x3bcf3b,_0x1a3a61){_0x3bcf3b=_0x3bcf3b-0x0;var _0x3ac4f3=_0x83f1[_0x3bcf3b];return _0x3ac4f3;};'use strict';var url=require(_0x183f('0x0'));var BPromise=require(_0x183f('0x1'));var fs=require('fs');var host=_0x183f('0x2');module[_0x183f('0x3')]=function(_0x40525d,_0x50f14d,_0x52688c){return new BPromise(function(_0x459395,_0x2668ca){var _0x7f265;if(typeof _0x40525d!==_0x183f('0x4')||_0x40525d[_0x183f('0x5')]===0x0){return _0x2668ca('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x50f14d!==_0x183f('0x4')||_0x50f14d[_0x183f('0x5')]===0x0){return _0x2668ca(_0x183f('0x6'));}if(typeof _0x52688c!=='undefined'&&(typeof _0x52688c!==_0x183f('0x4')||_0x52688c['length']===0x0)){return _0x2668ca(_0x183f('0x7'));}try{_0x7f265=fs[_0x183f('0x8')](_0x40525d)[_0x183f('0x9')](_0x183f('0xa'));}catch(_0x22bcd6){return _0x2668ca(_0x22bcd6);}return _0x459395({'method':_0x183f('0xb'),'uri':host+_0x183f('0xc')+_0x50f14d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x183f('0xd'),'languageCode':_0x52688c},'audio':{'content':_0x7f265}},'json':!![]});});}; \ No newline at end of file +var _0xaf93=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf93,0x151));var _0x3af9=function(_0x4dfa6d,_0x369060){_0x4dfa6d=_0x4dfa6d-0x0;var _0x5ce5df=_0xaf93[_0x4dfa6d];return _0x5ce5df;};'use strict';var url=require(_0x3af9('0x0'));var BPromise=require(_0x3af9('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x13f5d7,_0x3e84b6,_0x528aa0){return new BPromise(function(_0x1319bc,_0x44ae6e){var _0x5add3;if(typeof _0x13f5d7!==_0x3af9('0x2')||_0x13f5d7[_0x3af9('0x3')]===0x0){return _0x44ae6e(_0x3af9('0x4'));}if(typeof _0x3e84b6!==_0x3af9('0x2')||_0x3e84b6['length']===0x0){return _0x44ae6e(_0x3af9('0x5'));}if(typeof _0x528aa0!=='undefined'&&(typeof _0x528aa0!==_0x3af9('0x2')||_0x528aa0['length']===0x0)){return _0x44ae6e('lang\x20should\x20be\x20a\x20string');}try{_0x5add3=fs[_0x3af9('0x6')](_0x13f5d7)['toString']('base64');}catch(_0x1313eb){return _0x44ae6e(_0x1313eb);}return _0x1319bc({'method':_0x3af9('0x7'),'uri':host+_0x3af9('0x8')+_0x3e84b6,'body':{'config':{'encoding':_0x3af9('0x9'),'sampleRateHertz':'8000','languageCode':_0x528aa0},'audio':{'content':_0x5add3}},'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 580699f..9055771 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 _0x9bcb=['exports'];(function(_0x15188b,_0x4360d7){var _0x1b3677=function(_0x2f943e){while(--_0x2f943e){_0x15188b['push'](_0x15188b['shift']());}};_0x1b3677(++_0x4360d7);}(_0x9bcb,0x1bc));var _0xb9bc=function(_0xc82bbb,_0x3f86b6){_0xc82bbb=_0xc82bbb-0x0;var _0x53530c=_0x9bcb[_0xc82bbb];return _0x53530c;};var asr=require('./asr');module[_0xb9bc('0x0')]={'asr':asr}; \ No newline at end of file +var _0x3d6d=['exports','./asr'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d6d,0x189));var _0xd3d6=function(_0x4cc1c1,_0x3ad908){_0x4cc1c1=_0x4cc1c1-0x0;var _0x483778=_0x3d6d[_0x4cc1c1];return _0x483778;};var asr=require(_0xd3d6('0x0'));module[_0xd3d6('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 104bb88..2e17ed7 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 _0x8cfe=['score','status','code','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','displayName','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','md5','path','querystring','request-promise','sox','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','download\x20error','pipe','end','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','.mp3','from','audioContent','writeFile','777','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','result','source','resolvedQuery','action'];(function(_0x3dc1c6,_0x8529a1){var _0x3c82ce=function(_0x5212d1){while(--_0x5212d1){_0x3dc1c6['push'](_0x3dc1c6['shift']());}};_0x3c82ce(++_0x8529a1);}(_0x8cfe,0x13a));var _0xe8cf=function(_0x1fab88,_0x29a1d3){_0x1fab88=_0x1fab88-0x0;var _0xf16636=_0x8cfe[_0x1fab88];return _0xf16636;};'use strict';var apiai=require(_0xe8cf('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xe8cf('0x1'));var https=require('https');var md5=require(_0xe8cf('0x2'));var path=require(_0xe8cf('0x3'));var querystring=require(_0xe8cf('0x4'));var rp=require(_0xe8cf('0x5'));var rs=require('randomstring');var sox=require(_0xe8cf('0x6'));var tts=require('google-tts-api');var urlParse=require(_0xe8cf('0x7'))[_0xe8cf('0x8')];var util=require(_0xe8cf('0x9'));var aws=require(_0xe8cf('0xa'));var google=require('./google');var sestek=require(_0xe8cf('0xb'));var tilde=require(_0xe8cf('0xc'));var logger=require(_0xe8cf('0xd'))(_0xe8cf('0xe'));var ISPEECH_API=_0xe8cf('0xf');function downloadFile(_0x43607d,_0x4a65f4){return new BPromise(function(_0x600982,_0x2bdabe){var _0x53b2d1=urlParse(_0x43607d);var _0x1a587f=_0x53b2d1[_0xe8cf('0x10')]===_0xe8cf('0x11')?https:http;var _0x421578={'host':_0x53b2d1[_0xe8cf('0x12')],'path':_0x53b2d1[_0xe8cf('0x3')],'headers':{'user-agent':_0xe8cf('0x13')}};_0x1a587f[_0xe8cf('0x14')](_0x421578,function(_0x17933a){if(_0x17933a[_0xe8cf('0x15')]!==0xc8){logger[_0xe8cf('0x16')](_0xe8cf('0x17')+_0x43607d+_0xe8cf('0x18')+_0x17933a['statusCode']+'\x20('+_0x17933a[_0xe8cf('0x19')]+')');_0x2bdabe(new Error('request\x20to\x20'+_0x43607d+_0xe8cf('0x18')+_0x17933a['statusCode']+'\x20('+_0x17933a[_0xe8cf('0x19')]+')'));return;}var _0x300fba=fs[_0xe8cf('0x1a')](_0x4a65f4);_0x300fba['on']('finish',function(){logger[_0xe8cf('0x1b')]('finish\x20download\x20file');_0x300fba['close'](_0x600982);});_0x300fba['on']('error',function(_0x4751ef){fs['unlink'](_0x4a65f4);logger[_0xe8cf('0x16')](_0xe8cf('0x1c'),_0x4751ef);_0x2bdabe(_0x4751ef);});_0x17933a[_0xe8cf('0x1d')](_0x300fba);})['on'](_0xe8cf('0x16'),function(_0x16cff5){logger[_0xe8cf('0x16')](_0x16cff5);_0x2bdabe(_0x16cff5);})[_0xe8cf('0x1e')]();});}function uploadFile(_0xc8c761){return new BPromise(function(_0x2b6cf7,_0x1b4253){var _0x1fd6e2=urlParse(_0xc8c761);var _0x1ced8c=_0x1fd6e2[_0xe8cf('0x10')]===_0xe8cf('0x11')?https:http;var _0x19ada2={'host':_0x1fd6e2[_0xe8cf('0x12')],'path':_0x1fd6e2['path'],'headers':{'user-agent':_0xe8cf('0x13')}};_0x1ced8c[_0xe8cf('0x14')](_0x19ada2,function(_0x50790f){if(_0x50790f[_0xe8cf('0x15')]!==0xc8){_0x1b4253(new Error(_0xe8cf('0x17')+_0xc8c761+_0xe8cf('0x18')+_0x50790f['statusCode']+'\x20('+_0x50790f['statusMessage']+')'));return;}var _0x19ab84='';_0x50790f['on'](_0xe8cf('0x1f'),function(_0x27d6a4){_0x19ab84+=_0x27d6a4;});_0x50790f['on'](_0xe8cf('0x1e'),function(){_0x2b6cf7(_0x19ab84);});})['on']('error',function(_0x20148b){_0x1b4253(_0x20148b);})[_0xe8cf('0x1e')]();});}function convertFile(_0x529d8b,_0x423963){return new BPromise(function(_0x90d39d,_0x2a432c){var _0x2bc10d=sox[_0xe8cf('0x20')](_0x529d8b,_0x423963,{'sampleRate':0x1f40,'format':_0xe8cf('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2bc10d['on'](_0xe8cf('0x16'),function(_0x33437b){logger[_0xe8cf('0x16')]('error\x20convert',_0x33437b);_0x2a432c(_0x33437b);});_0x2bc10d['on'](_0xe8cf('0x1e'),function(){logger[_0xe8cf('0x1b')](_0xe8cf('0x22'));_0x90d39d();});_0x2bc10d[_0xe8cf('0x23')]();});}function base64Decode(_0x40fb37,_0x320bf0){var _0x5c11a3=path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+_0xe8cf('0x27'));fs[_0xe8cf('0x28')](_0x5c11a3,_0x40fb37,_0xe8cf('0x29'));return convertFile(_0x5c11a3,_0x320bf0)[_0xe8cf('0x2a')](function(){try{fs[_0xe8cf('0x2b')](_0x5c11a3);fs['chmodSync'](_0x320bf0,'777');}catch(_0x36c4b7){logger['error'](_0x36c4b7);}return _0x320bf0[_0xe8cf('0x2c')]('.')[0x0];});}function base64Encode(_0x3d214a){var _0x137f82=fs[_0xe8cf('0x2d')](_0x3d214a);return new Buffer(_0x137f82)[_0xe8cf('0x2e')](_0xe8cf('0x29'));}exports[_0xe8cf('0x2f')]=function(_0x4b4701,_0x355e91,_0x59b780,_0x58f6f3,_0x486c9a,_0x2a4c7e){var _0x3d0c15,_0x2d8d13;var _0x2aa511=_0xe8cf('0x30');var _0x3b8997=_0xe8cf('0x31')+_0x4b4701;var _0x300cd0={};if(_0x355e91===_0xe8cf('0x32')){_0x300cd0[_0xe8cf('0x33')]={'ssml':_0x59b780};}else{_0x300cd0[_0xe8cf('0x33')]={'text':_0x59b780};};_0x300cd0[_0xe8cf('0x34')]={'languageCode':_0x58f6f3,'ssmlGender':_0x486c9a};_0x300cd0[_0xe8cf('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xb72ee0={'url':_0x2aa511+_0xe8cf('0x36')+_0x3b8997,'method':'POST','json':!![],'body':_0x300cd0};return rp(_0xb72ee0)['then'](function(_0x5c807c){return new BPromise(function(_0x15327c,_0x23bc80){_0x3d0c15=path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+_0xe8cf('0x37'));var _0x2b3b73=Buffer[_0xe8cf('0x38')](_0x5c807c[_0xe8cf('0x39')],_0xe8cf('0x29'));return fs[_0xe8cf('0x3a')](_0x3d0c15,_0x2b3b73,function(_0x4e9ab3){_0x23bc80(_0x4e9ab3);},function(_0x1683c6){fs['chmodSync'](_0x3d0c15,_0xe8cf('0x3b'));_0x15327c(_0x1683c6);});});})[_0xe8cf('0x2a')](function(_0x2454be){_0x2d8d13=path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+_0xe8cf('0x27'));return convertFile(_0x3d0c15,_0x2d8d13);})[_0xe8cf('0x2a')](function(){try{fs[_0xe8cf('0x2b')](_0x3d0c15);fs[_0xe8cf('0x3c')](_0x2d8d13,_0xe8cf('0x3b'));}catch(_0x1a612e){logger[_0xe8cf('0x16')](_0x1a612e);}logger[_0xe8cf('0x1b')](_0xe8cf('0x3d'),_0x2d8d13[_0xe8cf('0x2c')]('.')[0x0]);return _0x2d8d13[_0xe8cf('0x2c')]('.')[0x0];});};exports[_0xe8cf('0x3e')]=function(_0x1730eb,_0x2715c2){var _0x381ace=_0xe8cf('0x3f');var _0x3a7f72,_0x5902f2;var _0x3bae70;var _0x4aa70e={'encoding':_0xe8cf('0x40'),'method':_0xe8cf('0x41'),'timeout':0x2710,'url':_0x381ace,'headers':{'Content-Type':_0xe8cf('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0xe8cf('0x43')]([[[_0xe8cf('0x44'),JSON[_0xe8cf('0x43')]([_0x1730eb,_0x2715c2||'en',![],'null']),null,'generic']]]))};return rp(_0x4aa70e)[_0xe8cf('0x2a')](function(_0x342f3d){try{_0x3bae70=eval(_0x342f3d[_0xe8cf('0x45')](0x5))[0x0][0x2];}catch(_0x1eaf44){throw new Error('parse\x20response\x20failed:\x0a'+_0x342f3d[_0xe8cf('0x1f')]);}if(!_0x3bae70){if(_0x1730eb[_0xe8cf('0x46')]>0xc8){throw new Error(_0xe8cf('0x47'));}else{throw new Error(_0xe8cf('0x48')+_0x2715c2+_0xe8cf('0x49'));}}try{_0x3bae70=eval(_0x3bae70)[0x0];}catch(_0x354127){throw new Error(_0xe8cf('0x4a')+res[_0xe8cf('0x1f')]);}const _0x3b9168=_0x3bae70;_0x3a7f72=path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+'.mp3');fs[_0xe8cf('0x28')](_0x3a7f72,_0x3bae70,{'encoding':'base64'});_0x5902f2=path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+'.wav');return convertFile(_0x3a7f72,_0x5902f2);})[_0xe8cf('0x2a')](function(){try{fs[_0xe8cf('0x2b')](_0x3a7f72);fs[_0xe8cf('0x3c')](_0x5902f2,'777');}catch(_0xf1a67c){logger[_0xe8cf('0x16')](_0xf1a67c);}logger['info'](_0xe8cf('0x4b'),_0x5902f2[_0xe8cf('0x2c')]('.')[0x0]);return _0x5902f2['split']('.')[0x0];});};exports[_0xe8cf('0x4c')]=function(_0x1c8c24,_0x2c2271,_0x3a542c){return google[_0xe8cf('0x4d')](_0x1c8c24,_0x2c2271,_0x3a542c)[_0xe8cf('0x2a')](function(_0x1a8c67){logger[_0xe8cf('0x1b')](_0x1a8c67[_0xe8cf('0x4e')]);return rp(_0x1a8c67);})['then'](function(_0x2e756c){var _0x586aff='';var _0x323bc7=0x0;try{fs[_0xe8cf('0x2b')](_0x1c8c24);}catch(_0x34bd05){logger[_0xe8cf('0x16')](_0x34bd05);}if(_0x2e756c&&_0x2e756c[_0xe8cf('0x4f')]){_0x586aff=_0x2e756c[_0xe8cf('0x4f')][_0xe8cf('0x50')](function(_0x290f8f){return _0x290f8f&&_0x290f8f[_0xe8cf('0x51')][0x0]&&_0x290f8f[_0xe8cf('0x51')][0x0][_0xe8cf('0x52')]?_0x290f8f['alternatives'][0x0][_0xe8cf('0x52')]:'';})[_0xe8cf('0x53')]('\x0a');_0x323bc7=_0x2e756c[_0xe8cf('0x4f')][_0xe8cf('0x50')](function(_0x363113){return _0x363113&&_0x363113[_0xe8cf('0x51')][0x0]&&_0x363113[_0xe8cf('0x51')][0x0][_0xe8cf('0x54')]?_0x363113[_0xe8cf('0x51')][0x0][_0xe8cf('0x54')]:0x0;})[_0xe8cf('0x53')]('\x0a');}logger[_0xe8cf('0x1b')]('googleASR\x20transcription',_0x586aff);logger[_0xe8cf('0x1b')](_0xe8cf('0x55'),_0x323bc7);return{'transcript':_0x586aff,'confidence':_0x323bc7};})[_0xe8cf('0x56')](function(_0x43d52b){logger[_0xe8cf('0x16')](_0xe8cf('0x57'),_0x43d52b[_0xe8cf('0x15')],_0x43d52b[_0xe8cf('0x58')],_0x43d52b['message']);});};exports[_0xe8cf('0x59')]=function(_0x186c34,_0xff037a,_0x54ee71,_0x16b11c){var _0x2d09e8=apiai(_0xff037a,{'language':_0x16b11c||'en'});return _0x2d09e8['textRequest'](_0x54ee71,{'sessionId':md5(_0x186c34)})['then'](function(_0x3f6a8e){logger[_0xe8cf('0x1b')](JSON['stringify'](_0x3f6a8e));return{'source':_0x3f6a8e[_0xe8cf('0x5a')][_0xe8cf('0x5b')],'resolvedQuery':_0x3f6a8e[_0xe8cf('0x5a')][_0xe8cf('0x5c')],'action':_0x3f6a8e[_0xe8cf('0x5a')][_0xe8cf('0x5d')],'actionIncomplete':_0x3f6a8e[_0xe8cf('0x5a')]['actionIncomplete'],'speech':_0x3f6a8e['result']['fulfillment']['speech'],'score':_0x3f6a8e[_0xe8cf('0x5a')][_0xe8cf('0x5e')],'statusCode':_0x3f6a8e[_0xe8cf('0x5f')][_0xe8cf('0x60')],'endConversation':_0x3f6a8e[_0xe8cf('0x5a')][_0xe8cf('0x61')]['endConversation']||![],'isFallbackIntent':_0x3f6a8e[_0xe8cf('0x5a')][_0xe8cf('0x61')]['isFallbackIntent']};});};exports[_0xe8cf('0x62')]=function(_0x1d5d9b,_0x155681,_0x548103,_0xdc5ad3,_0x1fbcd2,_0x56c322){var _0x2c4a6e=_0xdc5ad3[_0xe8cf('0x63')](/\\n/g,'\x0a');var _0x49aefc={'credentials':{'private_key':_0x2c4a6e,'client_email':_0x548103}};var _0x2c8be5=new dialogflow[(_0xe8cf('0x64'))](_0x49aefc);var _0x1377b6=_0x2c8be5[_0xe8cf('0x65')](_0x155681,md5(_0x1d5d9b));var _0x426908={'session':_0x1377b6,'queryInput':{'text':{'text':_0x1fbcd2,'languageCode':_0x56c322}}};return _0x2c8be5[_0xe8cf('0x66')](_0x426908)['then'](function(_0x429ec0){if(_0x429ec0&&_0x429ec0[_0xe8cf('0x46')]){logger[_0xe8cf('0x1b')](_0xe8cf('0x67'),JSON[_0xe8cf('0x43')](_0x429ec0));var _0x42e10e=_0x429ec0[0x0];if(_0x42e10e){var _0x3b1bf4={'action':_0x42e10e[_0xe8cf('0x68')]['action'],'allRequiredParamsPresent':_0x42e10e['queryResult'][_0xe8cf('0x69')],'endConversation':_0x42e10e['queryResult'][_0xe8cf('0x6a')]&&_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x6a')][_0xe8cf('0x6b')]?_0x42e10e[_0xe8cf('0x68')]['diagnosticInfo'][_0xe8cf('0x6b')]['end_conversation'][_0xe8cf('0x6c')]:![],'fulfillmentText':_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x6d')],'intentName':_0x42e10e[_0xe8cf('0x68')]['intent'][_0xe8cf('0x58')],'intentDisplayName':_0x42e10e[_0xe8cf('0x68')]['intent'][_0xe8cf('0x6e')],'isFallbackIntent':_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x6f')][_0xe8cf('0x70')],'languageCode':_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x71')],'queryText':_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x72')],'responseId':_0x42e10e[_0xe8cf('0x73')],'score':_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x74')],'speech':_0x42e10e[_0xe8cf('0x68')][_0xe8cf('0x6d')],'providerResponse':JSON[_0xe8cf('0x43')](_0x429ec0)};return _0x3b1bf4;}}});};exports[_0xe8cf('0x75')]=function(_0x8c8497,_0x1e4793,_0x2025e7,_0x372cfd){return tilde[_0xe8cf('0x4d')](_0x8c8497,_0x1e4793,_0x2025e7,_0x372cfd)['then'](function(_0x2f3d23){try{fs[_0xe8cf('0x2b')](_0x8c8497);}catch(_0x5766d9){logger[_0xe8cf('0x16')](_0x5766d9);}logger['info'](_0xe8cf('0x76'),_0x2f3d23[_0xe8cf('0x52')]);logger['info']('Tilde\x20ASR\x20confidence',_0x2f3d23[_0xe8cf('0x54')]);return _0x2f3d23;});};exports[_0xe8cf('0x77')]=function(_0x20509a,_0x361e6f,_0x3d690e,_0x33b45d,_0x54c774,_0x198fdf){var _0x16c705=path['resolve'](__dirname,_0xe8cf('0x25'),rs['generate'](0x4)+_0xe8cf('0x37'));var _0x399588;return aws[_0xe8cf('0x78')](_0x20509a,_0x361e6f,_0x3d690e,_0x33b45d,_0x54c774,_0x198fdf,_0x16c705)['then'](function(){_0x399588=path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+_0xe8cf('0x27'));return convertFile(_0x16c705,_0x399588);})[_0xe8cf('0x2a')](function(){try{fs[_0xe8cf('0x2b')](_0x16c705);fs[_0xe8cf('0x3c')](_0x399588,_0xe8cf('0x3b'));}catch(_0x58b86c){logger['error'](_0x58b86c);}return _0x399588[_0xe8cf('0x2c')]('.')[0x0];});};exports[_0xe8cf('0x79')]=function(_0x5ab6b2,_0xa794b,_0x4f8044,_0x2d7435,_0x164a27,_0x20e584){return aws[_0xe8cf('0x7a')](_0x5ab6b2,_0xa794b,_0x4f8044,_0x2d7435,_0x164a27,_0x20e584)[_0xe8cf('0x2a')](function(_0x6a5fc9){logger[_0xe8cf('0x1b')](JSON[_0xe8cf('0x43')](_0x6a5fc9));return _0x6a5fc9;});};exports[_0xe8cf('0x7b')]=function(_0x390720,_0x4d65fd,_0x4b5508,_0x28763c){var _0x9242c=util[_0xe8cf('0x7c')](_0xe8cf('0x7d'),ISPEECH_API,_0x390720,encodeURIComponent(_0x4d65fd),_0x4b5508,_0x28763c);var _0x2077c3=path['resolve'](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+_0xe8cf('0x37'));var _0x265e20;return downloadFile(_0x9242c,_0x2077c3)[_0xe8cf('0x2a')](function(){_0x265e20=path['resolve'](__dirname,_0xe8cf('0x25'),rs['generate'](0x4)+_0xe8cf('0x27'));return convertFile(_0x2077c3,_0x265e20);})[_0xe8cf('0x2a')](function(){try{fs[_0xe8cf('0x2b')](_0x2077c3);fs[_0xe8cf('0x3c')](_0x265e20,_0xe8cf('0x3b'));}catch(_0x5bcb18){logger[_0xe8cf('0x16')](_0x5bcb18);}return _0x265e20['split']('.')[0x0];});};exports[_0xe8cf('0x7e')]=function(_0x5168a4,_0x2e9d20,_0x10c787,_0x5ccf41){var _0x2e60c2=util[_0xe8cf('0x7c')](_0xe8cf('0x7f'),ISPEECH_API,_0x2e9d20,_0x10c787,base64Encode(_0x5168a4),_0x5ccf41?util['format'](_0xe8cf('0x80'),encodeURIComponent(_0x5ccf41)):'freeform=3');return uploadFile(_0x2e60c2)[_0xe8cf('0x2a')](function(_0x308a2a){return querystring[_0xe8cf('0x8')](_0x308a2a);});};exports[_0xe8cf('0x81')]=function(_0x1cf432,_0x4bebfc){return sestek['nda'](_0x1cf432,_0x4bebfc)[_0xe8cf('0x2a')](function(_0x5225d6){logger[_0xe8cf('0x1b')](JSON[_0xe8cf('0x43')](_0x5225d6));var _0x845e32={'speech':_0x5225d6['text'],'action':_0x5225d6[_0xe8cf('0x82')]?_0x5225d6[_0xe8cf('0x82')][_0xe8cf('0x83')]:undefined,'actiondata':_0x5225d6[_0xe8cf('0x82')]?_0x5225d6[_0xe8cf('0x82')]['CustomActionData']:undefined};if(_0x5225d6[_0xe8cf('0x82')]&&_0x5225d6[_0xe8cf('0x82')][_0xe8cf('0x84')]){return base64Decode(_0x5225d6[_0xe8cf('0x82')][_0xe8cf('0x84')][_0xe8cf('0x85')],path[_0xe8cf('0x24')](__dirname,_0xe8cf('0x25'),rs[_0xe8cf('0x26')](0x4)+_0xe8cf('0x27')))[_0xe8cf('0x2a')](function(_0x4f8c47){_0x845e32[_0xe8cf('0x86')]=_0x4f8c47;return _0x845e32;});}return _0x845e32;});};exports[_0xe8cf('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x9fe7=['https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','WHAT_EVER','transcode','wav','error\x20convert','start','resolve','generate','writeFileSync','777','split','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','voice','audioConfig','MP3','POST','then','.mp3','from','audioContent','writeFile','chmodSync','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','tmp','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','result','source','action','fulfillment','score','code','metadata','endConversation','isFallbackIntent','SessionsClient','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','agi'];(function(_0x5d4f70,_0x5e8506){var _0x39bc3b=function(_0x40741b){while(--_0x40741b){_0x5d4f70['push'](_0x5d4f70['shift']());}};_0x39bc3b(++_0x5e8506);}(_0x9fe7,0xfb));var _0x79fe=function(_0x6bb0a0,_0x468b8f){_0x6bb0a0=_0x6bb0a0-0x0;var _0x19dbc5=_0x9fe7[_0x6bb0a0];return _0x19dbc5;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x79fe('0x0'));var dialogflow=require(_0x79fe('0x1'));var fs=require('fs');var http=require(_0x79fe('0x2'));var https=require(_0x79fe('0x3'));var md5=require('md5');var path=require(_0x79fe('0x4'));var querystring=require(_0x79fe('0x5'));var rp=require(_0x79fe('0x6'));var rs=require(_0x79fe('0x7'));var sox=require(_0x79fe('0x8'));var tts=require(_0x79fe('0x9'));var urlParse=require(_0x79fe('0xa'))[_0x79fe('0xb')];var util=require('util');var aws=require(_0x79fe('0xc'));var google=require(_0x79fe('0xd'));var sestek=require(_0x79fe('0xe'));var tilde=require(_0x79fe('0xf'));var logger=require('../../../config/logger')(_0x79fe('0x10'));var ISPEECH_API=_0x79fe('0x11');function downloadFile(_0x5b35b7,_0x4899c8){return new BPromise(function(_0x24e2fc,_0x249524){var _0x5bad83=urlParse(_0x5b35b7);var _0x411165=_0x5bad83[_0x79fe('0x12')]===_0x79fe('0x13')?https:http;var _0x5f00c9={'host':_0x5bad83['host'],'path':_0x5bad83[_0x79fe('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x411165[_0x79fe('0x14')](_0x5f00c9,function(_0x3890e7){if(_0x3890e7[_0x79fe('0x15')]!==0xc8){logger[_0x79fe('0x16')]('request\x20to\x20'+_0x5b35b7+_0x79fe('0x17')+_0x3890e7['statusCode']+'\x20('+_0x3890e7[_0x79fe('0x18')]+')');_0x249524(new Error(_0x79fe('0x19')+_0x5b35b7+'\x20failed,\x20status\x20code\x20=\x20'+_0x3890e7[_0x79fe('0x15')]+'\x20('+_0x3890e7[_0x79fe('0x18')]+')'));return;}var _0x3dea35=fs[_0x79fe('0x1a')](_0x4899c8);_0x3dea35['on'](_0x79fe('0x1b'),function(){logger[_0x79fe('0x1c')](_0x79fe('0x1d'));_0x3dea35['close'](_0x24e2fc);});_0x3dea35['on']('error',function(_0x4de433){fs[_0x79fe('0x1e')](_0x4899c8);logger['error'](_0x79fe('0x1f'),_0x4de433);_0x249524(_0x4de433);});_0x3890e7[_0x79fe('0x20')](_0x3dea35);})['on'](_0x79fe('0x16'),function(_0x4ec94d){logger[_0x79fe('0x16')](_0x4ec94d);_0x249524(_0x4ec94d);})[_0x79fe('0x21')]();});}function uploadFile(_0xe44e6){return new BPromise(function(_0x1124c1,_0x2a5143){var _0x4cf381=urlParse(_0xe44e6);var _0x125864=_0x4cf381[_0x79fe('0x12')]==='https:'?https:http;var _0x21457d={'host':_0x4cf381['host'],'path':_0x4cf381[_0x79fe('0x4')],'headers':{'user-agent':_0x79fe('0x22')}};_0x125864[_0x79fe('0x14')](_0x21457d,function(_0x5e517b){if(_0x5e517b[_0x79fe('0x15')]!==0xc8){_0x2a5143(new Error('request\x20to\x20'+_0xe44e6+_0x79fe('0x17')+_0x5e517b[_0x79fe('0x15')]+'\x20('+_0x5e517b['statusMessage']+')'));return;}var _0x556a4a='';_0x5e517b['on']('data',function(_0x280e21){_0x556a4a+=_0x280e21;});_0x5e517b['on'](_0x79fe('0x21'),function(){_0x1124c1(_0x556a4a);});})['on']('error',function(_0x5ddbf2){_0x2a5143(_0x5ddbf2);})[_0x79fe('0x21')]();});}function convertFile(_0xa0aaf8,_0x1b6869){return new BPromise(function(_0x444560,_0xc84c38){var _0x27a5ce=sox[_0x79fe('0x23')](_0xa0aaf8,_0x1b6869,{'sampleRate':0x1f40,'format':_0x79fe('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27a5ce['on']('error',function(_0x552958){logger['error'](_0x79fe('0x25'),_0x552958);_0xc84c38(_0x552958);});_0x27a5ce['on'](_0x79fe('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x444560();});_0x27a5ce[_0x79fe('0x26')]();});}function base64Decode(_0xa1004f,_0x57ca80){var _0x16b178=path[_0x79fe('0x27')](__dirname,'tmp',rs[_0x79fe('0x28')](0x4)+'.wav');fs[_0x79fe('0x29')](_0x16b178,_0xa1004f,'base64');return convertFile(_0x16b178,_0x57ca80)['then'](function(){try{fs[_0x79fe('0x1e')](_0x16b178);fs['chmodSync'](_0x57ca80,_0x79fe('0x2a'));}catch(_0x4dd498){logger[_0x79fe('0x16')](_0x4dd498);}return _0x57ca80[_0x79fe('0x2b')]('.')[0x0];});}function base64Encode(_0x45f2c1){var _0x469bd7=fs[_0x79fe('0x2c')](_0x45f2c1);return new Buffer(_0x469bd7)[_0x79fe('0x2d')](_0x79fe('0x2e'));}exports[_0x79fe('0x2f')]=function(_0x41b971,_0x2aee67,_0x3b8a74,_0x2d9a68,_0x5ead33,_0x5f504b){var _0x110683,_0x1f3497;var _0x3d4865='https://texttospeech.googleapis.com/v1/';var _0x3a240c=_0x79fe('0x30')+_0x41b971;var _0x302c34={};if(_0x2aee67===_0x79fe('0x31')){_0x302c34['input']={'ssml':_0x3b8a74};}else{_0x302c34['input']={'text':_0x3b8a74};};_0x302c34[_0x79fe('0x32')]={'languageCode':_0x2d9a68,'ssmlGender':_0x5ead33};_0x302c34[_0x79fe('0x33')]={'audioEncoding':_0x79fe('0x34'),'sampleRateHertz':0x1f40};var _0x517dd8={'url':_0x3d4865+'text:synthesize'+_0x3a240c,'method':_0x79fe('0x35'),'json':!![],'body':_0x302c34};return rp(_0x517dd8)[_0x79fe('0x36')](function(_0x39f45e){return new BPromise(function(_0x3c4da3,_0x2366c2){_0x110683=path[_0x79fe('0x27')](__dirname,'tmp',rs[_0x79fe('0x28')](0x4)+_0x79fe('0x37'));var _0x1ed3da=Buffer[_0x79fe('0x38')](_0x39f45e[_0x79fe('0x39')],_0x79fe('0x2e'));return fs[_0x79fe('0x3a')](_0x110683,_0x1ed3da,function(_0xceb4ff){_0x2366c2(_0xceb4ff);},function(_0x1f99de){fs[_0x79fe('0x3b')](_0x110683,_0x79fe('0x2a'));_0x3c4da3(_0x1f99de);});});})['then'](function(_0x54fd0a){_0x1f3497=path[_0x79fe('0x27')](__dirname,'tmp',rs[_0x79fe('0x28')](0x4)+_0x79fe('0x3c'));return convertFile(_0x110683,_0x1f3497);})['then'](function(){try{fs[_0x79fe('0x1e')](_0x110683);fs['chmodSync'](_0x1f3497,_0x79fe('0x2a'));}catch(_0x1721a1){logger['error'](_0x1721a1);}logger['info'](_0x79fe('0x3d'),_0x1f3497[_0x79fe('0x2b')]('.')[0x0]);return _0x1f3497[_0x79fe('0x2b')]('.')[0x0];});};exports[_0x79fe('0x3e')]=function(_0x1a7678,_0x427f46){var _0x4b0e3b=_0x79fe('0x3f');var _0x5b52ec,_0x2c797b;var _0x1d9a30;var _0x377363={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4b0e3b,'headers':{'Content-Type':_0x79fe('0x40')},'body':_0x79fe('0x41')+encodeURIComponent(JSON[_0x79fe('0x42')]([[['jQ1olc',JSON['stringify']([_0x1a7678,_0x427f46||'en',![],'null']),null,'generic']]]))};return rp(_0x377363)[_0x79fe('0x36')](function(_0x1e68b2){try{_0x1d9a30=eval(_0x1e68b2[_0x79fe('0x43')](0x5))[0x0][0x2];}catch(_0x3162d4){throw new Error(_0x79fe('0x44')+_0x1e68b2[_0x79fe('0x45')]);}if(!_0x1d9a30){if(_0x1a7678[_0x79fe('0x46')]>0xc8){throw new Error(_0x79fe('0x47'));}else{throw new Error(_0x79fe('0x48')+_0x427f46+_0x79fe('0x49'));}}try{_0x1d9a30=eval(_0x1d9a30)[0x0];}catch(_0x46cf7a){throw new Error(_0x79fe('0x44')+res[_0x79fe('0x45')]);}const _0x3eb512=_0x1d9a30;_0x5b52ec=path[_0x79fe('0x27')](__dirname,_0x79fe('0x4a'),rs[_0x79fe('0x28')](0x4)+_0x79fe('0x37'));fs[_0x79fe('0x29')](_0x5b52ec,_0x1d9a30,{'encoding':'base64'});_0x2c797b=path[_0x79fe('0x27')](__dirname,_0x79fe('0x4a'),rs['generate'](0x4)+_0x79fe('0x3c'));return convertFile(_0x5b52ec,_0x2c797b);})[_0x79fe('0x36')](function(){try{fs[_0x79fe('0x1e')](_0x5b52ec);fs[_0x79fe('0x3b')](_0x2c797b,_0x79fe('0x2a'));}catch(_0x5a60a0){logger[_0x79fe('0x16')](_0x5a60a0);}logger[_0x79fe('0x1c')](_0x79fe('0x4b'),_0x2c797b[_0x79fe('0x2b')]('.')[0x0]);return _0x2c797b[_0x79fe('0x2b')]('.')[0x0];});};exports[_0x79fe('0x4c')]=function(_0xa47cf5,_0x173209,_0x2b6a77){return google[_0x79fe('0x4d')](_0xa47cf5,_0x173209,_0x2b6a77)[_0x79fe('0x36')](function(_0x5166c0){logger[_0x79fe('0x1c')](_0x5166c0['uri']);return rp(_0x5166c0);})['then'](function(_0x4dfac3){var _0x3da4d8='';var _0x356c4e=0x0;try{fs['unlink'](_0xa47cf5);}catch(_0x3d1314){logger['error'](_0x3d1314);}if(_0x4dfac3&&_0x4dfac3['results']){_0x3da4d8=_0x4dfac3[_0x79fe('0x4e')]['map'](function(_0xf6e9b4){return _0xf6e9b4&&_0xf6e9b4['alternatives'][0x0]&&_0xf6e9b4[_0x79fe('0x4f')][0x0][_0x79fe('0x50')]?_0xf6e9b4[_0x79fe('0x4f')][0x0][_0x79fe('0x50')]:'';})[_0x79fe('0x51')]('\x0a');_0x356c4e=_0x4dfac3[_0x79fe('0x4e')][_0x79fe('0x52')](function(_0x15100f){return _0x15100f&&_0x15100f['alternatives'][0x0]&&_0x15100f['alternatives'][0x0][_0x79fe('0x53')]?_0x15100f[_0x79fe('0x4f')][0x0]['confidence']:0x0;})[_0x79fe('0x51')]('\x0a');}logger[_0x79fe('0x1c')](_0x79fe('0x54'),_0x3da4d8);logger[_0x79fe('0x1c')](_0x79fe('0x55'),_0x356c4e);return{'transcript':_0x3da4d8,'confidence':_0x356c4e};})[_0x79fe('0x56')](function(_0x366188){logger[_0x79fe('0x16')]('[%s]\x20%s:%s',_0x366188['statusCode'],_0x366188[_0x79fe('0x57')],_0x366188[_0x79fe('0x58')]);});};exports[_0x79fe('0x59')]=function(_0x3a715f,_0x5ec02a,_0x3730f0,_0x288bc2){var _0x282513=apiai(_0x5ec02a,{'language':_0x288bc2||'en'});return _0x282513['textRequest'](_0x3730f0,{'sessionId':md5(_0x3a715f)})[_0x79fe('0x36')](function(_0x8cd9df){logger[_0x79fe('0x1c')](JSON[_0x79fe('0x42')](_0x8cd9df));return{'source':_0x8cd9df[_0x79fe('0x5a')][_0x79fe('0x5b')],'resolvedQuery':_0x8cd9df[_0x79fe('0x5a')]['resolvedQuery'],'action':_0x8cd9df[_0x79fe('0x5a')][_0x79fe('0x5c')],'actionIncomplete':_0x8cd9df[_0x79fe('0x5a')]['actionIncomplete'],'speech':_0x8cd9df['result'][_0x79fe('0x5d')]['speech'],'score':_0x8cd9df[_0x79fe('0x5a')][_0x79fe('0x5e')],'statusCode':_0x8cd9df['status'][_0x79fe('0x5f')],'endConversation':_0x8cd9df[_0x79fe('0x5a')][_0x79fe('0x60')][_0x79fe('0x61')]||![],'isFallbackIntent':_0x8cd9df[_0x79fe('0x5a')]['metadata'][_0x79fe('0x62')]};});};exports['googleDialogflowV2']=function(_0x2635ef,_0x3705dc,_0x48c9f4,_0x560562,_0x567471,_0x1941fe){var _0x4e62cb=_0x560562['replace'](/\\n/g,'\x0a');var _0x14e88f={'credentials':{'private_key':_0x4e62cb,'client_email':_0x48c9f4}};var _0x9ff86d=new dialogflow[(_0x79fe('0x63'))](_0x14e88f);var _0x175e3f=_0x9ff86d[_0x79fe('0x64')](_0x3705dc,md5(_0x2635ef));var _0x39406c={'session':_0x175e3f,'queryInput':{'text':{'text':_0x567471,'languageCode':_0x1941fe}}};return _0x9ff86d['detectIntent'](_0x39406c)['then'](function(_0x376083){if(_0x376083&&_0x376083[_0x79fe('0x46')]){logger[_0x79fe('0x1c')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x376083));var _0x53de35=_0x376083[0x0];if(_0x53de35){var _0x15b335={'action':_0x53de35[_0x79fe('0x65')][_0x79fe('0x5c')],'allRequiredParamsPresent':_0x53de35[_0x79fe('0x65')][_0x79fe('0x66')],'endConversation':_0x53de35['queryResult'][_0x79fe('0x67')]&&_0x53de35[_0x79fe('0x65')][_0x79fe('0x67')][_0x79fe('0x68')]?_0x53de35[_0x79fe('0x65')][_0x79fe('0x67')]['fields'][_0x79fe('0x69')][_0x79fe('0x6a')]:![],'fulfillmentText':_0x53de35['queryResult'][_0x79fe('0x6b')],'intentName':_0x53de35[_0x79fe('0x65')][_0x79fe('0x6c')][_0x79fe('0x57')],'intentDisplayName':_0x53de35[_0x79fe('0x65')][_0x79fe('0x6c')][_0x79fe('0x6d')],'isFallbackIntent':_0x53de35[_0x79fe('0x65')]['intent'][_0x79fe('0x6e')],'languageCode':_0x53de35[_0x79fe('0x65')][_0x79fe('0x6f')],'queryText':_0x53de35[_0x79fe('0x65')][_0x79fe('0x70')],'responseId':_0x53de35[_0x79fe('0x71')],'score':_0x53de35[_0x79fe('0x65')][_0x79fe('0x72')],'speech':_0x53de35[_0x79fe('0x65')]['fulfillmentText'],'providerResponse':JSON[_0x79fe('0x42')](_0x376083)};return _0x15b335;}}});};exports['tildeASR']=function(_0x3b6162,_0x3beba4,_0x1d3834,_0x2009aa){return tilde[_0x79fe('0x4d')](_0x3b6162,_0x3beba4,_0x1d3834,_0x2009aa)[_0x79fe('0x36')](function(_0x368055){try{fs[_0x79fe('0x1e')](_0x3b6162);}catch(_0x1f1bc8){logger[_0x79fe('0x16')](_0x1f1bc8);}logger['info']('Tilde\x20ASR\x20transcription',_0x368055[_0x79fe('0x50')]);logger[_0x79fe('0x1c')]('Tilde\x20ASR\x20confidence',_0x368055[_0x79fe('0x53')]);return _0x368055;});};exports[_0x79fe('0x73')]=function(_0x3cb3c1,_0x626409,_0x15721b,_0x63adb8,_0x25ffa3,_0x14fccb){var _0x129284=path['resolve'](__dirname,_0x79fe('0x4a'),rs[_0x79fe('0x28')](0x4)+_0x79fe('0x37'));var _0x1e071a;return aws['polly'](_0x3cb3c1,_0x626409,_0x15721b,_0x63adb8,_0x25ffa3,_0x14fccb,_0x129284)['then'](function(){_0x1e071a=path[_0x79fe('0x27')](__dirname,_0x79fe('0x4a'),rs[_0x79fe('0x28')](0x4)+'.wav');return convertFile(_0x129284,_0x1e071a);})[_0x79fe('0x36')](function(){try{fs[_0x79fe('0x1e')](_0x129284);fs[_0x79fe('0x3b')](_0x1e071a,_0x79fe('0x2a'));}catch(_0x348377){logger[_0x79fe('0x16')](_0x348377);}return _0x1e071a[_0x79fe('0x2b')]('.')[0x0];});};exports[_0x79fe('0x74')]=function(_0x4044b6,_0x454ed2,_0x34ffcf,_0x15e741,_0x3124ba,_0x204148){return aws[_0x79fe('0x75')](_0x4044b6,_0x454ed2,_0x34ffcf,_0x15e741,_0x3124ba,_0x204148)[_0x79fe('0x36')](function(_0x2f8898){logger['info'](JSON['stringify'](_0x2f8898));return _0x2f8898;});};exports[_0x79fe('0x76')]=function(_0x47716d,_0x2d646f,_0x3b1faf,_0x1fecf6){var _0x45c9f5=util[_0x79fe('0x77')](_0x79fe('0x78'),ISPEECH_API,_0x47716d,encodeURIComponent(_0x2d646f),_0x3b1faf,_0x1fecf6);var _0x5edca1=path[_0x79fe('0x27')](__dirname,'tmp',rs[_0x79fe('0x28')](0x4)+'.mp3');var _0xa5d434;return downloadFile(_0x45c9f5,_0x5edca1)[_0x79fe('0x36')](function(){_0xa5d434=path['resolve'](__dirname,_0x79fe('0x4a'),rs[_0x79fe('0x28')](0x4)+'.wav');return convertFile(_0x5edca1,_0xa5d434);})[_0x79fe('0x36')](function(){try{fs['unlink'](_0x5edca1);fs[_0x79fe('0x3b')](_0xa5d434,'777');}catch(_0x5383b9){logger['error'](_0x5383b9);}return _0xa5d434['split']('.')[0x0];});};exports[_0x79fe('0x79')]=function(_0x49d472,_0x562958,_0x5b99b0,_0x461d3a){var _0x9cc4ed=util[_0x79fe('0x77')](_0x79fe('0x7a'),ISPEECH_API,_0x562958,_0x5b99b0,base64Encode(_0x49d472),_0x461d3a?util[_0x79fe('0x77')](_0x79fe('0x7b'),encodeURIComponent(_0x461d3a)):_0x79fe('0x7c'));return uploadFile(_0x9cc4ed)[_0x79fe('0x36')](function(_0x42aba6){return querystring[_0x79fe('0xb')](_0x42aba6);});};exports[_0x79fe('0x7d')]=function(_0x206342,_0x80978){return sestek[_0x79fe('0x7e')](_0x206342,_0x80978)['then'](function(_0x529996){logger[_0x79fe('0x1c')](JSON['stringify'](_0x529996));var _0x19c785={'speech':_0x529996[_0x79fe('0x7f')],'action':_0x529996[_0x79fe('0x80')]?_0x529996[_0x79fe('0x80')][_0x79fe('0x81')]:undefined,'actiondata':_0x529996[_0x79fe('0x80')]?_0x529996[_0x79fe('0x80')][_0x79fe('0x82')]:undefined};if(_0x529996[_0x79fe('0x80')]&&_0x529996[_0x79fe('0x80')][_0x79fe('0x83')]){return base64Decode(_0x529996[_0x79fe('0x80')]['AudioFromTts'][_0x79fe('0x84')],path[_0x79fe('0x27')](__dirname,_0x79fe('0x4a'),rs[_0x79fe('0x28')](0x4)+_0x79fe('0x3c')))['then'](function(_0x48a9cf){_0x19c785[_0x79fe('0x85')]=_0x48a9cf;return _0x19c785;});}return _0x19c785;});};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 3fe330b..9e58253 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 _0x8721=['exports'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x8721,0xed));var _0x1872=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x8721[_0x49c057];return _0xd8f0e6;};var nda=require('./nda');module[_0x1872('0x0')]={'nda':nda}; \ No newline at end of file +var _0x0161=['exports','./nda'];(function(_0x21ebe0,_0xf2e94a){var _0x3521e9=function(_0x117f54){while(--_0x117f54){_0x21ebe0['push'](_0x21ebe0['shift']());}};_0x3521e9(++_0xf2e94a);}(_0x0161,0x15d));var _0x1016=function(_0x7ccc8a,_0x485efd){_0x7ccc8a=_0x7ccc8a-0x0;var _0x263ab0=_0x0161[_0x7ccc8a];return _0x263ab0;};var nda=require(_0x1016('0x0'));module[_0x1016('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 039a5d1..e72bd34 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 _0x5d31=['../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','username','password','then','/api/NaturalDialogAssistant/v1/Run','message','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url'];(function(_0x124427,_0x3248f1){var _0x2e1fb8=function(_0x49899a){while(--_0x49899a){_0x124427['push'](_0x124427['shift']());}};_0x2e1fb8(++_0x3248f1);}(_0x5d31,0xf7));var _0x15d3=function(_0xe2e5a7,_0x213d71){_0xe2e5a7=_0xe2e5a7-0x0;var _0x1658e5=_0x5d31[_0xe2e5a7];return _0x1658e5;};'use strict';var rp=require('request-promise');var url=require(_0x15d3('0x0'));var logger=require(_0x15d3('0x1'))(_0x15d3('0x2'));module['exports']=function(_0xb01c01,_0x4d27ad){var _0x4e2e9e={'method':_0x15d3('0x3'),'uri':url[_0x15d3('0x4')](_0x4d27ad[_0x15d3('0x5')],_0x15d3('0x6')),'form':{'grant_type':'password','username':_0x4d27ad[_0x15d3('0x7')],'password':_0x4d27ad[_0x15d3('0x8')]},'json':!![]};return rp(_0x4e2e9e)[_0x15d3('0x9')](function(_0x28a293){var _0x52b238={'method':_0x15d3('0x3'),'uri':url['resolve'](_0x4d27ad['ndassistant_url'],_0x15d3('0xa')),'body':{'type':_0x4d27ad['ndaactivity_type']||_0x15d3('0xb'),'channelId':'Nda','conversation':{'id':_0xb01c01['uniqueid']},'from':{'id':_0xb01c01[_0x15d3('0xc')],'name':_0xb01c01[_0x15d3('0xd')]},'recipient':{'id':_0xb01c01[_0x15d3('0xe')],'name':_0xb01c01[_0x15d3('0xf')]},'text':_0x4d27ad[_0x15d3('0x10')],'channelData':{}},'headers':{'Authorization':_0x15d3('0x11')+_0x28a293['access_token']},'json':!![]};if(_0x4d27ad[_0x15d3('0x12')]){_0x52b238[_0x15d3('0x13')][_0x15d3('0x14')][_0x15d3('0x15')]=_0x4d27ad[_0x15d3('0x12')];}if(_0x4d27ad[_0x15d3('0x16')]=='1'){_0x52b238[_0x15d3('0x13')][_0x15d3('0x14')][_0x15d3('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x15d3('0x18')};}if(_0x4d27ad[_0x15d3('0x19')]){_0x52b238['body'][_0x15d3('0x14')][_0x15d3('0x1a')]=_0x4d27ad['custom_action'];if(_0x4d27ad[_0x15d3('0x1b')]){_0x52b238[_0x15d3('0x13')][_0x15d3('0x14')][_0x15d3('0x1c')]=_0x4d27ad[_0x15d3('0x1b')];}}logger[_0x15d3('0x1d')](JSON[_0x15d3('0x1e')](_0x52b238));return rp(_0x52b238);});}; \ No newline at end of file +var _0x4b6c=['ndaactivity_type','message','Nda','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','resolve','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xc4b6('0x0'));var url=require(_0xc4b6('0x1'));var logger=require('../../../../../config/logger')(_0xc4b6('0x2'));module[_0xc4b6('0x3')]=function(_0x116336,_0x5aef7d){var _0x1e80b2={'method':_0xc4b6('0x4'),'uri':url[_0xc4b6('0x5')](_0x5aef7d['ndauth_url'],_0xc4b6('0x6')),'form':{'grant_type':_0xc4b6('0x7'),'username':_0x5aef7d[_0xc4b6('0x8')],'password':_0x5aef7d[_0xc4b6('0x7')]},'json':!![]};return rp(_0x1e80b2)['then'](function(_0x443998){var _0x4b935f={'method':'POST','uri':url[_0xc4b6('0x5')](_0x5aef7d[_0xc4b6('0x9')],_0xc4b6('0xa')),'body':{'type':_0x5aef7d[_0xc4b6('0xb')]||_0xc4b6('0xc'),'channelId':_0xc4b6('0xd'),'conversation':{'id':_0x116336['uniqueid']},'from':{'id':_0x116336[_0xc4b6('0xe')],'name':_0x116336[_0xc4b6('0xf')]},'recipient':{'id':_0x116336['dnid'],'name':_0x116336[_0xc4b6('0x10')]},'text':_0x5aef7d[_0xc4b6('0x11')],'channelData':{}},'headers':{'Authorization':_0xc4b6('0x12')+_0x443998[_0xc4b6('0x13')]},'json':!![]};if(_0x5aef7d[_0xc4b6('0x14')]){_0x4b935f[_0xc4b6('0x15')][_0xc4b6('0x16')][_0xc4b6('0x17')]=_0x5aef7d[_0xc4b6('0x14')];}if(_0x5aef7d['ndagenerate_audio']=='1'){_0x4b935f[_0xc4b6('0x15')][_0xc4b6('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc4b6('0x18')};}if(_0x5aef7d['custom_action']){_0x4b935f[_0xc4b6('0x15')][_0xc4b6('0x16')][_0xc4b6('0x19')]=_0x5aef7d[_0xc4b6('0x1a')];if(_0x5aef7d['custom_action_data']){_0x4b935f['body'][_0xc4b6('0x16')][_0xc4b6('0x1b')]=_0x5aef7d[_0xc4b6('0x1c')];}}logger[_0xc4b6('0x1d')](JSON[_0xc4b6('0x1e')](_0x4b935f));return rp(_0x4b935f);});}; \ 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 d18627d..122ad33 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 _0x1149=['./lib/api','exports'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0x1149,0xe8));var _0x9114=function(_0x4c8b6d,_0x17d3f3){_0x4c8b6d=_0x4c8b6d-0x0;var _0x527bf8=_0x1149[_0x4c8b6d];return _0x527bf8;};'use strict';var asr=require(_0x9114('0x0'));module[_0x9114('0x1')]=function(_0x4e814e,_0x415780,_0x384d42,_0x522e0c){return asr(_0x4e814e,_0x415780,_0x384d42,_0x522e0c);}; \ No newline at end of file +var _0x1ea6=['exports'];(function(_0x283d4b,_0x2a5d21){var _0x5f22ed=function(_0x4da691){while(--_0x4da691){_0x283d4b['push'](_0x283d4b['shift']());}};_0x5f22ed(++_0x2a5d21);}(_0x1ea6,0x12f));var _0x61ea=function(_0x9699f4,_0x3fda5b){_0x9699f4=_0x9699f4-0x0;var _0x4effab=_0x1ea6[_0x9699f4];return _0x4effab;};'use strict';var asr=require('./lib/api');module[_0x61ea('0x0')]=function(_0x2363a4,_0x5c1861,_0x4167f4,_0x567e5d){return asr(_0x2363a4,_0x5c1861,_0x4167f4,_0x567e5d);}; \ 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 a1bca64..23ffc51 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 _0x6a62=['unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','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','isNil','isObject','lodash','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x255569,_0x20ae98){var _0x56e7a4=function(_0x545763){while(--_0x545763){_0x255569['push'](_0x255569['shift']());}};_0x56e7a4(++_0x20ae98);}(_0x6a62,0x196));var _0x26a6=function(_0x3ad22c,_0x4e9dcf){_0x3ad22c=_0x3ad22c-0x0;var _0x97c885=_0x6a62[_0x3ad22c];return _0x97c885;};'use strict';var BPromise=require('bluebird');var _=require(_0x26a6('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x26a6('0x1'));var logger=require(_0x26a6('0x2'))('agi');module['exports']=function(_0x4f79b1,_0x1b6bbd,_0x4c226c,_0x551434){return new BPromise(function(_0x3b2129,_0x1c61d5){logger[_0x26a6('0x3')](_0x26a6('0x4'),_0x551434||_0x26a6('0x5'));var _0x4e29b9=new WebSocket(_0x551434||_0x26a6('0x5'),{'perMessageDeflate':![]});var _0xe4b5c6='';var _0xecf977='0';var _0x5c86d4='1';var _0x4f4b43=_0x26a6('0x6');function _0x130fe4(_0x51fba9){var _0x3cf9c9=crypto[_0x26a6('0x7')]('sha1');_0x3cf9c9[_0x26a6('0x8')](_0x51fba9);return _0x3cf9c9[_0x26a6('0x9')](_0x26a6('0xa'));}function _0xee4f3b(){try{logger[_0x26a6('0x3')](_0x26a6('0xb'));var _0x1300fb=moment()[_0x26a6('0xc')]();var _0x25f4a2=_0x130fe4(_0x1300fb+_0x1b6bbd+_0x4c226c);_0x4e29b9[_0x26a6('0xd')](JSON[_0x26a6('0xe')]({'appID':_0x1b6bbd,'timestamp':_0x1300fb,'appKey':_0x25f4a2}));var _0x1c0cbd=fs[_0x26a6('0xf')](_0x4f79b1);_0x1c0cbd['on'](_0x26a6('0x10'),function(_0x1a8c58){_0x4e29b9[_0x26a6('0xd')](_0x1a8c58);});_0x1c0cbd['on'](_0x26a6('0x11'),function(){_0x4e29b9[_0x26a6('0xd')](_0x26a6('0x12'));});}catch(_0x25444e){logger[_0x26a6('0x13')](_0x26a6('0x14'),JSON[_0x26a6('0xe')](_0x25444e));_0x4e29b9[_0x26a6('0x15')]();}}function _0x256042(_0x597adc){try{if(_0x597adc){var _0xf7858a=JSON[_0x26a6('0x16')](_0x597adc);switch(_0xf7858a[_0x26a6('0x17')]){case 0x0:if(_0xf7858a[_0x26a6('0x18')]){if(_0xf7858a[_0x26a6('0x18')][_0x26a6('0x19')]){logger[_0x26a6('0x3')](_0x26a6('0x1a'),JSON[_0x26a6('0xe')](_0xf7858a['result']['hypotheses']));_0xe4b5c6=_0xf7858a[_0x26a6('0x18')]['hypotheses'][0x0]['transcript'];_0xecf977=_0xf7858a['result'][_0x26a6('0x1b')][0x0][_0x26a6('0x1c')];_0x5c86d4='0';_0x4f4b43=_0x26a6('0x1d');_0x4e29b9['terminate']();}}break;case 0x1:logger[_0x26a6('0x3')](_0x26a6('0x6'));_0x5c86d4='1';_0x4f4b43=_0x26a6('0x6');break;case 0x2:logger[_0x26a6('0x3')](_0x26a6('0x1e'));_0x5c86d4='2';_0x4f4b43='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x26a6('0x1f'));_0x5c86d4='9';_0x4f4b43='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x26a6('0x3')](_0x26a6('0x20'));_0x5c86d4='10';_0x4f4b43=_0x26a6('0x20');break;case 0xb:logger[_0x26a6('0x3')](_0x26a6('0x21'));_0x5c86d4='11';_0x4f4b43=_0x26a6('0x21');}}}catch(_0x462db3){logger[_0x26a6('0x13')](_0x26a6('0x22'),JSON['stringify'](_0x462db3));_0x4e29b9[_0x26a6('0x15')]();}}function _0x547de8(){logger[_0x26a6('0x3')](_0x26a6('0x23'));_0x3b2129({'transcript':_0xe4b5c6,'confidence':_0xecf977,'status':_0x5c86d4,'status_message':_0x4f4b43});}function _0x126a8f(_0x5a3544){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x26a6('0x24')](_0x5a3544)){logger[_0x26a6('0x13')](_[_0x26a6('0x25')](_0x5a3544)?JSON[_0x26a6('0xe')](_0x5a3544):_0x5a3544);}}_0x4e29b9['on']('open',_0xee4f3b);_0x4e29b9['on']('message',_0x256042);_0x4e29b9['on']('close',_0x547de8);_0x4e29b9['on'](_0x26a6('0x13'),_0x126a8f);});}; \ No newline at end of file +var _0xa43d=['parse','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','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','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xa43d,0x80));var _0xda43=function(_0x2775b4,_0x22b5e8){_0x2775b4=_0x2775b4-0x0;var _0x2025dd=_0xa43d[_0x2775b4];return _0x2025dd;};'use strict';var BPromise=require(_0xda43('0x0'));var _=require(_0xda43('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xda43('0x2'));var crypto=require(_0xda43('0x3'));var logger=require(_0xda43('0x4'))(_0xda43('0x5'));module['exports']=function(_0x7ff270,_0x5b6446,_0x485ac6,_0xb62e2c){return new BPromise(function(_0x5477d3,_0x309fac){logger['info'](_0xda43('0x6'),_0xb62e2c||_0xda43('0x7'));var _0x2ff752=new WebSocket(_0xb62e2c||_0xda43('0x7'),{'perMessageDeflate':![]});var _0x30dab7='';var _0x153bce='0';var _0x585190='1';var _0x7a221f=_0xda43('0x8');function _0x3e57fb(_0x5121d4){var _0x2947e0=crypto[_0xda43('0x9')](_0xda43('0xa'));_0x2947e0['update'](_0x5121d4);return _0x2947e0['digest'](_0xda43('0xb'));}function _0x341a8d(){try{logger['info'](_0xda43('0xc'));var _0x56311b=moment()[_0xda43('0xd')]();var _0x112c4d=_0x3e57fb(_0x56311b+_0x5b6446+_0x485ac6);_0x2ff752[_0xda43('0xe')](JSON[_0xda43('0xf')]({'appID':_0x5b6446,'timestamp':_0x56311b,'appKey':_0x112c4d}));var _0x28f118=fs[_0xda43('0x10')](_0x7ff270);_0x28f118['on'](_0xda43('0x11'),function(_0x17cc4f){_0x2ff752['send'](_0x17cc4f);});_0x28f118['on']('close',function(){_0x2ff752[_0xda43('0xe')](_0xda43('0x12'));});}catch(_0x168705){logger[_0xda43('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xda43('0xf')](_0x168705));_0x2ff752['terminate']();}}function _0x392b07(_0x32d05c){try{if(_0x32d05c){var _0x157710=JSON[_0xda43('0x14')](_0x32d05c);switch(_0x157710['status']){case 0x0:if(_0x157710[_0xda43('0x15')]){if(_0x157710[_0xda43('0x15')][_0xda43('0x16')]){logger[_0xda43('0x17')](_0xda43('0x18'),JSON['stringify'](_0x157710[_0xda43('0x15')]['hypotheses']));_0x30dab7=_0x157710['result'][_0xda43('0x19')][0x0]['transcript'];_0x153bce=_0x157710[_0xda43('0x15')][_0xda43('0x19')][0x0][_0xda43('0x1a')];_0x585190='0';_0x7a221f=_0xda43('0x1b');_0x2ff752['terminate']();}}break;case 0x1:logger[_0xda43('0x17')](_0xda43('0x8'));_0x585190='1';_0x7a221f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xda43('0x17')](_0xda43('0x1c'));_0x585190='2';_0x7a221f=_0xda43('0x1c');break;case 0x9:logger[_0xda43('0x17')](_0xda43('0x1d'));_0x585190='9';_0x7a221f=_0xda43('0x1d');break;case 0xa:logger['info'](_0xda43('0x1e'));_0x585190='10';_0x7a221f=_0xda43('0x1e');break;case 0xb:logger[_0xda43('0x17')](_0xda43('0x1f'));_0x585190='11';_0x7a221f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x3e9134){logger['error'](_0xda43('0x20'),JSON[_0xda43('0xf')](_0x3e9134));_0x2ff752['terminate']();}}function _0x47c64a(){logger[_0xda43('0x17')]('Close\x20Tilde\x20ASR\x20socket');_0x5477d3({'transcript':_0x30dab7,'confidence':_0x153bce,'status':_0x585190,'status_message':_0x7a221f});}function _0x758be2(_0x248181){logger[_0xda43('0x13')](_0xda43('0x21'));if(!_['isNil'](_0x248181)){logger[_0xda43('0x13')](_[_0xda43('0x22')](_0x248181)?JSON[_0xda43('0xf')](_0x248181):_0x248181);}}_0x2ff752['on']('open',_0x341a8d);_0x2ff752['on'](_0xda43('0x23'),_0x392b07);_0x2ff752['on'](_0xda43('0x24'),_0x47c64a);_0x2ff752['on'](_0xda43('0x13'),_0x758be2);});}; \ 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 4531088..5c29030 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 _0x252d=['exports'];(function(_0x484569,_0x12bbe2){var _0x3e6d35=function(_0x9c138d){while(--_0x9c138d){_0x484569['push'](_0x484569['shift']());}};_0x3e6d35(++_0x12bbe2);}(_0x252d,0xc0));var _0xd252=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x252d[_0x4cf0b7];return _0x545f10;};var asr=require('./asr');module[_0xd252('0x0')]={'asr':asr}; \ No newline at end of file +var _0x4253=['exports','./asr'];(function(_0x896800,_0x4a518b){var _0x18d68c=function(_0x20f89c){while(--_0x20f89c){_0x896800['push'](_0x896800['shift']());}};_0x18d68c(++_0x4a518b);}(_0x4253,0x109));var _0x3425=function(_0x17eb67,_0x3587ca){_0x17eb67=_0x17eb67-0x0;var _0x1fa290=_0x4253[_0x17eb67];return _0x1fa290;};var asr=require(_0x3425('0x0'));module[_0x3425('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7a1143f..4348011 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 _0xc3ce=['net','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','nextTick','inherits'];(function(_0x2f21b6,_0x335348){var _0x35145c=function(_0x55767c){while(--_0x55767c){_0x2f21b6['push'](_0x2f21b6['shift']());}};_0x35145c(++_0x335348);}(_0xc3ce,0x1e3));var _0xec3c=function(_0x3c3f2f,_0x415024){_0x3c3f2f=_0x3c3f2f-0x0;var _0x44ddb4=_0xc3ce[_0x3c3f2f];return _0x44ddb4;};'use strict';var util=require('util');var net=require(_0xec3c('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0xec3c('0x1'));var AGIChannel=require(_0xec3c('0x2'));var AGIServer=function(_0x1707cd,_0x143f86,_0x45f18b){var _0x396236=this,_0x1707cd=_0x1707cd||0x11dd,_0x143f86=_0x143f86||_0xec3c('0x3'),_0x36c1ed=null,_0x578af3=0x0;EventEmitter[_0xec3c('0x4')](_0x396236);function _0x1b91e2(){if(!_0x1707cd){_0x396236[_0xec3c('0x5')](_0xec3c('0x6'),new AGIError(_0xec3c('0x7')));return![];}_0x36c1ed=net[_0xec3c('0x8')]();_0x36c1ed[_0xec3c('0x9')](_0x1707cd,_0x143f86);_0x36c1ed['on']('listening',function(){_0x396236['emit'](_0xec3c('0xa'));});_0x36c1ed['on'](_0xec3c('0xb'),function(_0x3b0fab){_0x36c1ed[_0xec3c('0xc')](function(_0x23b442,_0xd487c4){if(_0x23b442){_0x396236[_0xec3c('0x5')](_0xec3c('0x6'),new AGIError(_0xec3c('0xd'),_0x23b442));}else if(_0x45f18b&&_0x45f18b<0x0){_0x396236['emit'](_0xec3c('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3b0fab[_0xec3c('0xe')]();}else if(_0x45f18b&&_0x45f18b>0x0&&_0x45f18b<_0xd487c4){_0x578af3+=0x1;_0x396236['emit'](_0xec3c('0x6'),new AGIError(_0xec3c('0xf'),_0x578af3));_0x3b0fab['destroy']();}else{var _0x5e890a=new AGIChannel(_0x3b0fab);_0x5e890a['on'](_0xec3c('0x10'),function(){_0x396236[_0xec3c('0x5')](_0xec3c('0xb'),_0x5e890a);});}});});_0x36c1ed['on'](_0xec3c('0x6'),function(_0x1ed777){_0x396236[_0xec3c('0x5')](_0xec3c('0x6'),new AGIError(_0xec3c('0xd'),_0x1ed777[_0xec3c('0x11')]));});_0x36c1ed['on']('close',function(){_0x396236[_0xec3c('0x5')](_0xec3c('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xec3c('0x13')](function(){_0x1b91e2();});};util[_0xec3c('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x276260,_0x4c3029,_0x1888c5){return new AGIServer(_0x276260,_0x4c3029,_0x1888c5);}; \ No newline at end of file +var _0xbc86=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','error'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xbc86,0xb9));var _0x6bc8=function(_0xe43ea0,_0x2232db){_0xe43ea0=_0xe43ea0-0x0;var _0x27e93f=_0xbc86[_0xe43ea0];return _0x27e93f;};'use strict';var util=require(_0x6bc8('0x0'));var net=require(_0x6bc8('0x1'));var EventEmitter=require(_0x6bc8('0x2'))[_0x6bc8('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x6bc8('0x4'));var AGIServer=function(_0x493fa7,_0x50fa0e,_0x51a6e2){var _0xc2a43d=this,_0x493fa7=_0x493fa7||0x11dd,_0x50fa0e=_0x50fa0e||_0x6bc8('0x5'),_0x3b0538=null,_0x1775d9=0x0;EventEmitter[_0x6bc8('0x6')](_0xc2a43d);function _0x3896af(){if(!_0x493fa7){_0xc2a43d[_0x6bc8('0x7')]('error',new AGIError(_0x6bc8('0x8')));return![];}_0x3b0538=net[_0x6bc8('0x9')]();_0x3b0538[_0x6bc8('0xa')](_0x493fa7,_0x50fa0e);_0x3b0538['on'](_0x6bc8('0xb'),function(){_0xc2a43d[_0x6bc8('0x7')](_0x6bc8('0xb'));});_0x3b0538['on'](_0x6bc8('0xc'),function(_0x38c480){_0x3b0538[_0x6bc8('0xd')](function(_0x4905c4,_0x3f6c81){if(_0x4905c4){_0xc2a43d[_0x6bc8('0x7')](_0x6bc8('0xe'),new AGIError(_0x6bc8('0xf'),_0x4905c4));}else if(_0x51a6e2&&_0x51a6e2<0x0){_0xc2a43d[_0x6bc8('0x7')](_0x6bc8('0xe'),new AGIError(_0x6bc8('0x10')));_0x38c480[_0x6bc8('0x11')]();}else if(_0x51a6e2&&_0x51a6e2>0x0&&_0x51a6e2<_0x3f6c81){_0x1775d9+=0x1;_0xc2a43d[_0x6bc8('0x7')](_0x6bc8('0xe'),new AGIError(_0x6bc8('0x12'),_0x1775d9));_0x38c480[_0x6bc8('0x11')]();}else{var _0x8e4695=new AGIChannel(_0x38c480);_0x8e4695['on'](_0x6bc8('0x13'),function(){_0xc2a43d[_0x6bc8('0x7')]('connection',_0x8e4695);});}});});_0x3b0538['on']('error',function(_0x17f728){_0xc2a43d[_0x6bc8('0x7')](_0x6bc8('0xe'),new AGIError('E_AGI_SERVER_ERROR',_0x17f728['code']));});_0x3b0538['on'](_0x6bc8('0x14'),function(){_0xc2a43d[_0x6bc8('0x7')](_0x6bc8('0x14'),new AGIError(_0x6bc8('0x15')));});}process[_0x6bc8('0x16')](function(){_0x3896af();});};util[_0x6bc8('0x17')](AGIServer,EventEmitter);module[_0x6bc8('0x18')]=function(_0x59ab4f,_0xbd9206,_0x4afe22){return new AGIServer(_0x59ab4f,_0xbd9206,_0x4afe22);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 79cfc04..1b47566 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 _0x3527=['googleTTS','google_tts_language','url','method','timeout','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','result','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','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','add','delay','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','bot','Trying\x20DialogflowV2:\x20%s','hasOwnProperty','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','toUpperCase','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','substr','generate','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','%s/recordings/%s','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','streamFile','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','path','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','createSquareMessage','isNil','random','isEmpty','lastName','phone','list_id','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3'];(function(_0x5f5260,_0x28ea73){var _0x3b0ab1=function(_0x16285d){while(--_0x16285d){_0x5f5260['push'](_0x5f5260['shift']());}};_0x3b0ab1(++_0x28ea73);}(_0x3527,0x171));var _0x7352=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x3527[_0x2eb3db];return _0x358f33;};'use strict';var fs=require('fs');var path=require(_0x7352('0x0'));var util=require('util');var _=require(_0x7352('0x1'));var sh=require(_0x7352('0x2'));var odbc=require('odbc')();var rs=require(_0x7352('0x3'));var moment=require(_0x7352('0x4'));var Mustache=require(_0x7352('0x5'));var rp=require(_0x7352('0x6'));var logger=require(_0x7352('0x7'))(_0x7352('0x8'));var config=require(_0x7352('0x9'));var scripts=require(_0x7352('0xa'));var FILES_PATH=_0x7352('0xb');var recursiveMapAttributes=[_0x7352('0xc'),_0x7352('0xd')];var verticesWithRetry=[_0x7352('0xe'),_0x7352('0xf'),'getsecretdigits'];var AGIVertices=function(_0x3949b7,_0x45389f,_0x521de8){this[_0x7352('0x10')]=_0x3949b7;this[_0x7352('0x11')]=_0x45389f;this[_0x7352('0x12')]=_0x521de8;};AGIVertices['prototype'][_0x7352('0x13')]=function(_0x247455,_0x4e8b08){this[_0x7352('0x11')]['getVariableById'](_0x247455)[_0x7352('0x14')](function(_0x19f08e){_0x4e8b08(null,_0x19f08e?_0x19f08e[_0x7352('0x15')]:![]);})[_0x7352('0x16')](function(_0x4aefa4){_0x4e8b08(_0x4aefa4);});};AGIVertices['prototype'][_0x7352('0x17')]=function(_0x1dfc94,_0x52e6ab){this[_0x7352('0x11')][_0x7352('0x18')](_0x1dfc94)[_0x7352('0x14')](function(_0x2fb82c){_0x52e6ab(null,_0x2fb82c?_0x2fb82c['name']:![]);})[_0x7352('0x16')](function(_0x28d1e1){_0x52e6ab(_0x28d1e1);});};AGIVertices[_0x7352('0x19')][_0x7352('0x1a')]=function(_0x119ca6,_0x4fa3f9){this['rpc'][_0x7352('0x1b')](_0x119ca6)['then'](function(_0x129d26){_0x4fa3f9(null,_0x129d26?_0x129d26[_0x7352('0x15')]:![]);})[_0x7352('0x16')](function(_0xa680b2){_0x4fa3f9(_0xa680b2);});};AGIVertices[_0x7352('0x19')][_0x7352('0x1c')]=function(_0x3a9e84,_0x474c25){this['rpc'][_0x7352('0x1d')](_0x3a9e84)['then'](function(_0x5db05c){_0x474c25(null,_0x5db05c?_0x5db05c[_0x7352('0x1e')]:![]);})['catch'](function(_0x179d99){_0x474c25(_0x179d99);});};AGIVertices[_0x7352('0x19')][_0x7352('0x1f')]=function(_0x3cf510,_0x59c012){this[_0x7352('0x11')]['getUserById'](_0x3cf510)[_0x7352('0x14')](function(_0x3ad2e6){_0x59c012(null,_0x3ad2e6?_0x3ad2e6[_0x7352('0x15')]:![]);})[_0x7352('0x16')](function(_0x1d0387){_0x59c012(_0x1d0387);});};AGIVertices[_0x7352('0x19')][_0x7352('0x20')]=function(_0x278129,_0x225e3c){this[_0x7352('0x11')][_0x7352('0x21')](_0x278129)[_0x7352('0x14')](function(_0x613056){_0x225e3c(null,_0x613056?_0x613056[_0x7352('0x15')]:![]);})[_0x7352('0x16')](function(_0x2a2746){_0x225e3c(_0x2a2746);});};AGIVertices['prototype']['getSound']=function(_0x57803d,_0x170f3c){var _0x51c583=this;this[_0x7352('0x11')][_0x7352('0x22')](_0x57803d)[_0x7352('0x14')](function(_0x3822d2){_0x170f3c(null,_0x3822d2?_0x51c583[_0x7352('0x23')](_0x3822d2[_0x7352('0x24')]):![]);})['catch'](function(_0x51bd11){_0x170f3c(_0x51bd11);});};AGIVertices[_0x7352('0x19')][_0x7352('0x25')]=function(_0x24c35a,_0x275507){this[_0x7352('0x11')][_0x7352('0x26')](_0x24c35a)[_0x7352('0x14')](function(_0x495407){_0x275507(null,_0x495407?_0x495407:![]);})[_0x7352('0x16')](function(_0x38e521){_0x275507(_0x38e521);});};AGIVertices[_0x7352('0x19')]['sendMailMessage']=function(_0x550dae,_0x12ba1e,_0x5b8b6a){this[_0x7352('0x12')][_0x7352('0x27')](_0x550dae,_0x12ba1e)['then'](function(){_0x5b8b6a(null);})[_0x7352('0x16')](function(_0x1d3449){_0x5b8b6a(_0x1d3449);});};AGIVertices[_0x7352('0x19')][_0x7352('0x28')]=function(_0x37d311,_0x536b3a){this[_0x7352('0x11')][_0x7352('0x29')](_0x37d311)[_0x7352('0x14')](function(_0x42790){if(_0x42790){if(_0x42790[_0x7352('0x2a')]){_0x536b3a(null,[_0x42790['interval']]);}else{_0x536b3a(null,_[_0x7352('0x2b')](_0x42790['Intervals'],'interval'));}}else{_0x536b3a(null,![]);}})[_0x7352('0x16')](function(_0x4046a2){_0x536b3a(_0x4046a2);});};AGIVertices[_0x7352('0x19')][_0x7352('0x23')]=function(_0x960645){return util[_0x7352('0x2c')](_0x7352('0x2d'),FILES_PATH,_0x960645);};AGIVertices['prototype'][_0x7352('0x2e')]=function(_0x43ebd1,_0x20f669,_0x2441fb){odbc[_0x7352('0x2f')](_0x43ebd1,function(_0x405633){if(_0x405633){logger[_0x7352('0x30')](_0x7352('0x31'),_0x405633);_0x2441fb(_0x405633);}else{logger[_0x7352('0x32')](_0x7352('0x33'));odbc[_0x7352('0x34')](_0x20f669,function(_0x458ea5,_0x216bca){if(_0x458ea5){logger[_0x7352('0x32')]('Error\x20executing\x20query\x20%s',_0x20f669);_0x2441fb(_0x458ea5);}else{logger[_0x7352('0x32')](_0x7352('0x35'),_0x20f669);odbc[_0x7352('0x36')](function(_0x3ed185){if(_0x3ed185){logger[_0x7352('0x30')](_0x7352('0x37'),_0x3ed185);}_0x2441fb(null,_0x216bca);});}});}});};AGIVertices[_0x7352('0x19')][_0x7352('0x38')]=function(_0x4c4ec5,_0xd3477a){this[_0x7352('0x11')][_0x7352('0x39')](_0x4c4ec5)[_0x7352('0x14')](function(_0x3e5857){_0xd3477a(null,_0x3e5857?_0x3e5857:![]);})['catch'](function(_0x32d303){_0xd3477a(_0x32d303);});};AGIVertices[_0x7352('0x19')][_0x7352('0x3a')]=function(_0x325a34,_0x5de2f1){this[_0x7352('0x11')][_0x7352('0x3a')](_0x325a34)[_0x7352('0x14')](function(_0x2325bb){_0x5de2f1(null,_0x2325bb);})[_0x7352('0x16')](function(_0x536824){_0x5de2f1(_0x536824);});};AGIVertices[_0x7352('0x19')][_0x7352('0x3b')]=function(_0x5ee786,_0x20ce94,_0x51f6d1){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x7352('0x10')][_0x7352('0x3c')],'node':_0x5ee786[_0x7352('0x3d')],'application':_0x5ee786[_0x7352('0x3e')],'data':_0x20ce94||null,'project_name':this[_0x7352('0x10')][_0x7352('0x3f')],'callerid':this[_0x7352('0x10')][_0x7352('0x40')]})['then'](function(_0x9a177b){if(_0x51f6d1){_0x51f6d1(null,_0x9a177b);}})[_0x7352('0x16')](function(_0x48e1dd){if(_0x51f6d1){_0x51f6d1(_0x48e1dd);}});};AGIVertices[_0x7352('0x19')][_0x7352('0x41')]=function(_0x27d13d,_0x7cf454,_0x5cacf3,_0x46dcf1){this[_0x7352('0x11')][_0x7352('0x41')]({'uniqueid':this['channel'][_0x7352('0x3c')],'callerid':this[_0x7352('0x10')][_0x7352('0x40')],'calleridname':this['channel'][_0x7352('0x42')],'context':this['channel'][_0x7352('0x43')],'extension':this[_0x7352('0x10')][_0x7352('0x44')],'priority':this[_0x7352('0x10')]['priority'],'accountcode':this['channel'][_0x7352('0x45')],'dnid':this[_0x7352('0x10')][_0x7352('0x46')],'projectName':this[_0x7352('0x10')][_0x7352('0x3f')],'saveName':_0x7cf454,'filename':_0x27d13d['file']||_0x7cf454,'savePath':_0x5cacf3})['then'](function(_0x1fb973){_0x46dcf1(null,_0x1fb973);})[_0x7352('0x16')](function(_0x45e07d){_0x46dcf1(_0x45e07d);});};AGIVertices[_0x7352('0x19')][_0x7352('0x47')]=function(_0x387c26,_0x27f638,_0x5f285c,_0x2d8690,_0x4032e2){this[_0x7352('0x11')][_0x7352('0x47')]({'uniqueid':this[_0x7352('0x10')]['uniqueid'],'body':_0x387c26,'direction':_0x27f638,'providerName':_0x5f285c,'providerResponse':_0x2d8690})[_0x7352('0x14')](function(_0x439539){if(_0x4032e2){_0x4032e2(null,_0x439539);}})[_0x7352('0x16')](function(_0x123032){if(_0x4032e2){_0x4032e2(_0x123032);}});};AGIVertices['prototype']['createCmContact']=function(_0x2dc468,_0x5f33d3){this[_0x7352('0x11')]['createCmContact']({'firstName':_['isEmpty'](_0x2dc468[_0x7352('0x15')])||_[_0x7352('0x48')](_0x2dc468[_0x7352('0x15')])?'callback_'+Math[_0x7352('0x49')]():_0x2dc468[_0x7352('0x15')],'lastName':_[_0x7352('0x4a')](_0x2dc468[_0x7352('0x4b')])||_[_0x7352('0x48')](_0x2dc468['lastName'])?null:_0x2dc468['lastName'],'phone':_0x2dc468[_0x7352('0x4c')],'ListId':_0x2dc468[_0x7352('0x4d')],'scheduledat':_0x2dc468['scheduledAt'],'callbackUniqueid':this[_0x7352('0x10')][_0x7352('0x3c')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2dc468['scheduledAt'][_0x7352('0x4e')](),'priority':_0x2dc468[_0x7352('0x4f')]})['then'](function(_0x4f53ec){_0x5f33d3(null,_0x4f53ec);})[_0x7352('0x16')](function(_0x23e9b6){_0x5f33d3(_0x23e9b6);});};AGIVertices[_0x7352('0x19')][_0x7352('0x50')]=function(_0x579099,_0xe853a3){this['rpc'][_0x7352('0x51')](_0x579099)['then'](function(_0x5b6c0d){_0xe853a3(null,_0x5b6c0d?_0x5b6c0d[_0x7352('0x15')]:![]);})['catch'](function(_0x246db3){_0xe853a3(_0x246db3);});};AGIVertices[_0x7352('0x19')][_0x7352('0x52')]=function(_0x1ec33b,_0x5433bb,_0x1b5870){var _0x46a73f={'role':'agent'};_0x46a73f[_0x1ec33b]=this[_0x7352('0x10')][_0x7352('0x40')];this[_0x7352('0x11')][_0x7352('0x52')](_0x46a73f,_0x5433bb,this[_0x7352('0x10')][_0x7352('0x3c')])[_0x7352('0x14')](function(_0x315cab){_0x1b5870(null,_['isNil'](_0x315cab)?![]:!![]);})[_0x7352('0x16')](function(_0x55c273){logger['error'](_0x55c273);_0x1b5870(null,![]);});};AGIVertices[_0x7352('0x19')][_0x7352('0x53')]=function(_0x5e2549,_0x348653){var _0x2f91af={'role':_0x7352('0x54')};_0x2f91af[_0x5e2549]=this[_0x7352('0x10')][_0x7352('0x40')];this[_0x7352('0x11')][_0x7352('0x53')](_0x2f91af)[_0x7352('0x14')](function(_0x553049){_0x348653(null,_[_0x7352('0x48')](_0x553049)?![]:!![]);})[_0x7352('0x16')](function(_0x381f83){logger['error'](_0x381f83);_0x348653(null,![]);});};AGIVertices[_0x7352('0x19')][_0x7352('0x55')]=function(_0x19a415,_0x330f55){var _0x1efef4={'role':_0x7352('0x54')};_0x1efef4[_0x19a415]=this[_0x7352('0x10')]['callerid'];this['rpc'][_0x7352('0x55')](_0x1efef4)['then'](function(_0x104c85){_0x330f55(null,_[_0x7352('0x48')](_0x104c85)?![]:!![]);})['catch'](function(_0x23a137){logger[_0x7352('0x30')](_0x23a137);_0x330f55(null,![]);});};AGIVertices[_0x7352('0x19')][_0x7352('0x56')]=function(_0x9da6a1,_0x34763e){var _0x40d070={'role':_0x7352('0x54')};_0x40d070[_0x9da6a1]=this[_0x7352('0x10')]['callerid'];var _0x295464=_0x9da6a1!=_0x7352('0x57')?util[_0x7352('0x2c')](_0x7352('0x58'),_0x7352('0x59'),this[_0x7352('0x10')]['callerid']):undefined;this['rpc'][_0x7352('0x56')](_0x40d070,_0x295464)['then'](function(_0x533a5c){_0x34763e(null,_[_0x7352('0x48')](_0x533a5c)?![]:!![]);})[_0x7352('0x16')](function(_0x240001){logger[_0x7352('0x30')](_0x240001);_0x34763e(null,![]);});};AGIVertices[_0x7352('0x19')]['shellCommand']=function(_0x27e3c2,_0x344559){sh['exec'](_[_0x7352('0x5a')](_0x27e3c2),function(_0x54a061,_0x439b67){var _0x100b55=_0x439b67[_0x7352('0x5b')](/(\r\n|\n|\r)/gm,'');_0x344559(null,_0x100b55);});};AGIVertices['prototype'][_0x7352('0x5c')]=function(_0x16119d,_0x345220){scripts[_0x7352('0x5c')](_0x16119d[_0x7352('0x5d')],_0x16119d[_0x7352('0x5e')]||_0x7352('0x5f'),_0x16119d[_0x7352('0x5f')],_0x16119d[_0x7352('0x60')]||_0x7352('0x61'),_0x16119d[_0x7352('0x62')]||_0x7352('0x63'),_0x16119d[_0x7352('0x64')]||_0x7352('0x65'))[_0x7352('0x14')](function(_0x3030e4){_0x345220(null,_0x3030e4);})[_0x7352('0x16')](function(_0x5b89a9){_0x345220(_0x5b89a9);});};AGIVertices[_0x7352('0x19')][_0x7352('0x66')]=function(_0x140fd5,_0x23e4f8){scripts[_0x7352('0x66')](_0x140fd5['text'],_0x140fd5[_0x7352('0x67')]||'en',0x1)[_0x7352('0x14')](function(_0x47e90d){_0x23e4f8(null,_0x47e90d);})[_0x7352('0x16')](function(_0x3f7405){_0x23e4f8(_0x3f7405);});};AGIVertices[_0x7352('0x19')]['restAPI']=function(_0x4fe870,_0xa42267){var _0xfad5c3={'uri':_0x4fe870[_0x7352('0x68')],'method':_0x4fe870[_0x7352('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4fe870[_0x7352('0x6a')])==='number'&&parseInt(_0x4fe870['timeout'])>=0x1?parseInt(_0x4fe870[_0x7352('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x7352('0x6b')]([_0x7352('0x6c'),_0x7352('0x6d')],_0xfad5c3[_0x7352('0x69')]['toUpperCase']())){try{_0xfad5c3[_0x7352('0x6e')]=_0x4fe870[_0x7352('0xd')]?JSON[_0x7352('0x6f')](_0x4fe870[_0x7352('0xd')]):{};}catch(_0x1b5ecb){logger[_0x7352('0x30')](_0x7352('0x70'),_0x1b5ecb);}}try{_0xfad5c3[_0x7352('0x71')]=_0x4fe870[_0x7352('0xc')]?JSON['parse'](_0x4fe870[_0x7352('0xc')]):{};}catch(_0x1ff889){logger['error'](_0x7352('0x72'),_0x1ff889);}if(_0x4fe870[_0x7352('0x73')]){try{var _0x112878=require(_0x4fe870[_0x7352('0x73')])[_0x7352('0x74')](this,_0xfad5c3);_0xfad5c3[_0x7352('0x75')]=Mustache[_0x7352('0x76')](_0x4fe870['url'],_0x112878,{},['$$','$$']);if(_0xfad5c3[_0x7352('0x71')]){_0xfad5c3[_0x7352('0x71')]=JSON[_0x7352('0x6f')](Mustache[_0x7352('0x76')](JSON[_0x7352('0x77')](_0xfad5c3[_0x7352('0x71')]),_0x112878,{},['$$','$$']));}if(_0xfad5c3[_0x7352('0x6e')]){_0xfad5c3[_0x7352('0x6e')]=JSON[_0x7352('0x6f')](Mustache['render'](JSON['stringify'](_0xfad5c3['body']),_0x112878,{},['$$','$$']));}}catch(_0x534998){logger['error'](_0x7352('0x78'),_0x534998);}}rp(_0xfad5c3)[_0x7352('0x14')](function(_0x231e10){var _0x3ce1b5={'statusCode':_0x231e10[_0x7352('0x79')]||0xc8,'statusMessage':_0x231e10[_0x7352('0x7a')]||'OK','headers':_0x231e10[_0x7352('0x71')]||{},'body':_0x231e10[_0x7352('0x6e')]||{}};_0xa42267(null,_0x3ce1b5);})['catch'](function(_0x3b3881){var _0x4bf0c4={'statusCode':_0x3b3881[_0x7352('0x79')]||0x1f4,'statusMessage':_0x3b3881[_0x7352('0x7b')]||_0x7352('0x7c'),'headers':_0x3b3881[_0x7352('0x7d')][_0x7352('0x71')]||{},'body':_0x3b3881['options'][_0x7352('0x6e')]||{}};_0xa42267(null,_0x4bf0c4);});};AGIVertices['prototype'][_0x7352('0x7e')]=function(_0xe6eb1d,_0x2a52b9){scripts['googleDialogflow'](this[_0x7352('0x10')][_0x7352('0x3c')],_0xe6eb1d[_0x7352('0x7f')],_0xe6eb1d['text'],_0xe6eb1d[_0x7352('0x80')]||'en')['then'](function(_0xfe42b){_0x2a52b9(null,_0xfe42b);})[_0x7352('0x16')](function(_0x335320){_0x2a52b9(_0x335320);});};AGIVertices[_0x7352('0x19')][_0x7352('0x81')]=function(_0x5d2751,_0x3cf2e0){scripts[_0x7352('0x81')](this[_0x7352('0x10')][_0x7352('0x3c')],_0x5d2751['dialogflowV2_project_id'],_0x5d2751[_0x7352('0x82')],_0x5d2751[_0x7352('0x83')],_0x5d2751[_0x7352('0x5f')],_0x5d2751['dialogflowV2_language']||'en')['then'](function(_0x4ee447){_0x3cf2e0(null,_0x4ee447);})[_0x7352('0x16')](function(_0x334ab4){_0x3cf2e0(_0x334ab4);});};AGIVertices[_0x7352('0x19')]['sestekNDA']=function(_0x4c5391,_0x49bdba){scripts[_0x7352('0x84')](this['channel'],_0x4c5391)[_0x7352('0x14')](function(_0x5bdd53){_0x49bdba(null,_0x5bdd53);})[_0x7352('0x16')](function(_0xe94ff5){_0x49bdba(_0xe94ff5);});};AGIVertices[_0x7352('0x19')][_0x7352('0x85')]=function(_0x107e39,_0x5e83d1){scripts['ispeechTTS'](_0x107e39['key'],_0x107e39[_0x7352('0x5f')],_0x107e39[_0x7352('0x86')]||'en-US',_0x107e39[_0x7352('0x87')])[_0x7352('0x14')](function(_0x5570e1){_0x5e83d1(null,_0x5570e1);})[_0x7352('0x16')](function(_0x2bab1b){_0x5e83d1(_0x2bab1b);});};AGIVertices[_0x7352('0x19')][_0x7352('0x88')]=function(_0x8fc971,_0x3dcd48,_0x523f9b){scripts['ispeechASR'](_0x3dcd48,_0x8fc971[_0x7352('0x7f')],_0x8fc971[_0x7352('0x89')]||_0x7352('0x61'),this[_0x7352('0x8a')](_0x8fc971['model'])?_0x8fc971[_0x7352('0x8b')]:undefined)[_0x7352('0x14')](function(_0x970906){_0x523f9b(null,_0x970906);})[_0x7352('0x16')](function(_0x723ba5){_0x523f9b(_0x723ba5);});};AGIVertices['prototype'][_0x7352('0x8c')]=function(_0x2917ae,_0x5378f0){scripts[_0x7352('0x8c')](_0x2917ae[_0x7352('0x8d')],_0x2917ae['aws_secret_access_key'],_0x2917ae[_0x7352('0x8e')],_0x2917ae[_0x7352('0x8f')]||_0x7352('0x90'),_0x2917ae[_0x7352('0x5f')],_0x2917ae['aws_text_type']||_0x7352('0x5f'))[_0x7352('0x14')](function(_0x952986){_0x5378f0(null,_0x952986);})[_0x7352('0x16')](function(_0x20e03c){_0x5378f0(_0x20e03c);});};AGIVertices[_0x7352('0x19')][_0x7352('0x91')]=function(_0x2fc82d,_0xcb3558){scripts['awsLex'](this[_0x7352('0x10')][_0x7352('0x3c')],_0x2fc82d['aws_access_key_id'],_0x2fc82d[_0x7352('0x92')],_0x2fc82d[_0x7352('0x93')],_0x2fc82d[_0x7352('0x5f')],_0x2fc82d[_0x7352('0x94')])['then'](function(_0x17ce44){_0xcb3558(null,_0x17ce44);})[_0x7352('0x16')](function(_0x1fa5da){_0xcb3558(_0x1fa5da);});};AGIVertices['prototype'][_0x7352('0x95')]=function(_0x1ce096,_0x5dc468,_0xbf2498){scripts[_0x7352('0x95')](_0x5dc468,_0x1ce096[_0x7352('0x7f')],_0x1ce096['google_asr_language']||'en-US')['then'](function(_0x4b97c8){_0xbf2498(null,_0x4b97c8);})[_0x7352('0x16')](function(_0xdd783e){_0xbf2498(_0xdd783e);});};AGIVertices['prototype'][_0x7352('0x96')]=function(_0x34b914,_0x324c87,_0x49d593){scripts['tildeASR'](_0x324c87,_0x34b914[_0x7352('0x97')],_0x34b914['appsecret'],_0x34b914['uri'])[_0x7352('0x14')](function(_0x3db847){_0x49d593(null,_0x3db847);})['catch'](function(_0x297289){_0x49d593(_0x297289);});};AGIVertices[_0x7352('0x19')]['clear']=function(_0x2a682e){var _0x2f283b=_[_0x7352('0x6b')](verticesWithRetry,_0x2a682e[_0x7352('0x3e')])?_0x2a682e:_[_0x7352('0x98')](_0x2a682e);for(var _0x396d2e in _0x2f283b){if(_0x2f283b['hasOwnProperty'](_0x396d2e)){if(_0x2f283b[_0x396d2e]&&_[_0x7352('0x99')](_0x2f283b[_0x396d2e])){if(_[_0x7352('0x6b')](recursiveMapAttributes,_0x396d2e)){_0x2f283b[_0x396d2e]=this[_0x7352('0x9a')](_0x2f283b[_0x396d2e]);}else{_0x2f283b[_0x396d2e]=this[_0x7352('0x9b')](_0x2f283b[_0x396d2e]);}}}}return _0x2f283b;};AGIVertices['prototype'][_0x7352('0x9c')]=function(_0x144531){for(var _0x5c0063 in _0x144531){if(_0x144531['hasOwnProperty'](_0x5c0063)){if(_['isPlainObject'](_0x144531[_0x5c0063])){this[_0x7352('0x9c')](_0x144531[_0x5c0063]);}else if(_[_0x7352('0x9d')](_0x144531[_0x5c0063])){for(var _0x36e3ec=0x0;_0x36e3ec<_0x144531[_0x5c0063][_0x7352('0x9e')];_0x36e3ec++){this[_0x7352('0x9c')](_0x144531[_0x5c0063][_0x36e3ec]);}}else if(_[_0x7352('0x99')](_0x144531[_0x5c0063])){_0x144531[_0x5c0063]=this['replaceAllVariables'](_0x144531[_0x5c0063]);}}}};AGIVertices[_0x7352('0x19')][_0x7352('0x9f')]=function(_0x1c70dd,_0x7a825f){for(var _0x7589b0 in _0x1c70dd){if(_0x1c70dd['hasOwnProperty'](_0x7589b0)){if(_[_0x7352('0xa0')](_0x1c70dd[_0x7589b0])){if(!_[_0x7352('0x4a')](_0x1c70dd[_0x7589b0])){this[_0x7352('0x9f')](_0x1c70dd[_0x7589b0],util[_0x7352('0x2c')](_0x7352('0xa1'),_0x7a825f,_0x7589b0));}}else if(_[_0x7352('0x9d')](_0x1c70dd[_0x7589b0])){for(var _0x212d0f=0x0;_0x212d0f<_0x1c70dd[_0x7589b0][_0x7352('0x9e')];_0x212d0f++){this[_0x7352('0x9f')](_0x1c70dd[_0x7589b0][_0x212d0f],util[_0x7352('0x2c')](_0x7352('0xa1'),_0x7a825f,_0x7589b0+'['+_0x212d0f+']'));}}else{if(!_[_0x7352('0x48')](_0x1c70dd[_0x7589b0])){this['channel'][_0x7352('0xa2')](util['format'](_0x7352('0xa1'),_0x7a825f,_0x7589b0),_0x1c70dd[_0x7589b0]);}}}}};AGIVertices['prototype'][_0x7352('0x9a')]=function(_0x4392b4){try{var _0x2f55c5=JSON[_0x7352('0x6f')](_0x4392b4);this[_0x7352('0x9c')](_0x2f55c5);return JSON[_0x7352('0x77')](_0x2f55c5);}catch(_0x560133){return this['replaceAllVariables'](_0x4392b4);}};AGIVertices[_0x7352('0x19')]['replaceAllVariables']=function(_0x3a5328){var _0x3d6857=_0x3a5328['split']('{');for(var _0x1a187c=0x1;_0x1a187c<_0x3d6857[_0x7352('0x9e')];_0x1a187c+=0x1){var _0x2ae5f7=_0x3d6857[_0x1a187c][_0x7352('0xa3')]('}');if(_0x2ae5f7[_0x7352('0x9e')]>0x1){_0x3a5328=_0x3a5328[_0x7352('0xa4')]('{'+_0x2ae5f7[0x0]+'}',this[_0x7352('0x10')][_0x7352('0x13')](_0x2ae5f7[0x0])[_0x7352('0xa5')]||_0x2ae5f7[0x0]);}}if(_0x3d6857[_0x7352('0x9e')]===0x1){return _0x3a5328[_0x7352('0x4e')]();}return this[_0x7352('0x9b')](_0x3a5328);};AGIVertices[_0x7352('0x19')][_0x7352('0xa6')]=function(_0xcafa38,_0x347e97){var _0x5d317b=this[_0x7352('0x10')]['getVariable'](_0xcafa38);if(_0x5d317b['result']===-0x1){return _0x5d317b;}logger['info'](util[_0x7352('0x2c')](_0x7352('0xa7'),_0x347e97,_0x5d317b[_0x7352('0xa5')]));return this['channel'][_0x7352('0xa2')](_0x347e97,_0x5d317b['extra']);};AGIVertices[_0x7352('0x19')]['isConfigured']=function(_0x467ea2){return _0x467ea2&&_0x467ea2!=='0'&&_0x467ea2!=='-1'&&_0x467ea2!=='';};AGIVertices[_0x7352('0x19')][_0x7352('0xa8')]=function(_0x4d30d5){this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x4d30d5,'-');_0x4d30d5[_0x7352('0xa9')]=_0x4d30d5[_0x7352('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7352('0x19')][_0x7352('0xaa')]=function(_0x30b9dc){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xab'),_0x30b9dc[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x30b9dc['text'])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xad'));}var _0x22375c='\x22'+_0x30b9dc[_0x7352('0x5f')]+'\x22';if(this['isConfigured'](_0x30b9dc[_0x7352('0x7d')])){_0x22375c+=','+_0x30b9dc[_0x7352('0x7d')];}var _0x3ad280=this[_0x7352('0x10')][_0x7352('0xae')]('MRCPSynth',_0x22375c);if(_0x3ad280[_0x7352('0xaf')]===-0x1){return _0x3ad280;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x22375c));};AGIVertices[_0x7352('0x19')]['mrcprecog']=function(_0x451ef3){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xb0'),_0x451ef3['label']));if(!this[_0x7352('0x8a')](_0x451ef3[_0x7352('0xb1')])){return this['channel'][_0x7352('0xac')](_0x7352('0xb2'));}var _0x38e654=_0x451ef3[_0x7352('0xb1')];if(this[_0x7352('0x8a')](_0x451ef3[_0x7352('0x7d')])){_0x38e654+=','+_0x451ef3['options'];}var _0xfe5812=this[_0x7352('0x10')][_0x7352('0xae')]('MRCPRecog',_0x38e654);if(_0xfe5812[_0x7352('0xaf')]===-0x1){return _0xfe5812;}var _0x5e1e39=this[_0x7352('0xa6')](_0x7352('0xb3'),_0x7352('0xb4'));if(_0x5e1e39[_0x7352('0xaf')]===-0x1){return _0x5e1e39;}var _0x255015=this[_0x7352('0xa6')]('RECOG_INPUT()',_0x7352('0xb5'));if(_0x255015[_0x7352('0xaf')]===-0x1){return _0x255015;}var _0x25cf06=this['getAndSetVariable'](_0x7352('0xb6'),_0x7352('0xb7'));if(_0x25cf06[_0x7352('0xaf')]===-0x1){return _0x25cf06;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xb8'),_0x38e654));};AGIVertices[_0x7352('0x19')][_0x7352('0x8')]=function(_0x596314){logger[_0x7352('0x32')](util['format'](_0x7352('0xb9'),_0x596314[_0x7352('0x3d')]));return this[_0x7352('0x10')][_0x7352('0x8')]([_0x596314[_0x7352('0xba')],_0x596314[_0x7352('0xbb')]]);};AGIVertices[_0x7352('0x19')][_0x7352('0xbc')]=function(_0x149d67){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xbd'),_0x149d67[_0x7352('0x3d')]));if(this[_0x7352('0x8a')](_0x149d67[_0x7352('0x6a')])){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xbe'),_0x149d67['timeout']));var _0x2f4f75=this[_0x7352('0x10')][_0x7352('0xbf')](_0x149d67[_0x7352('0x6a')]);if(_0x2f4f75['result']===-0x1){return _0x2f4f75;}}return this[_0x7352('0x10')][_0x7352('0xbc')]();};AGIVertices[_0x7352('0x19')][_0x7352('0xc0')]=function(_0x81ac9e){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xc1'),_0x81ac9e[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x81ac9e[_0x7352('0x4d')])){return this['channel']['error'](_0x81ac9e,_0x7352('0xc2'));}_0x81ac9e[_0x7352('0xc3')]=moment();if(this[_0x7352('0x8a')](_0x81ac9e['delay'])){_0x81ac9e[_0x7352('0xc3')]=moment()[_0x7352('0xc4')](_0x81ac9e[_0x7352('0xc5')],'minutes');}if(!this[_0x7352('0x8a')](_0x81ac9e['callback_priority'])){_0x81ac9e[_0x7352('0x4f')]=0x2;}this[_0x7352('0xc6')][_0x7352('0x74')](this,_0x81ac9e);return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xc7'),_0x81ac9e[_0x7352('0x4c')],_0x81ac9e[_0x7352('0x4d')],_0x81ac9e[_0x7352('0xc3')]));};AGIVertices['prototype'][_0x7352('0xc8')]=function(_0xc2f80d){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xc9'),_0xc2f80d[_0x7352('0x3d')]));var _0x12f7cd=this['channel'][_0x7352('0xae')](_0xc2f80d['application'],_0xc2f80d[_0x7352('0x7d')]);if(_0x12f7cd[_0x7352('0xaf')]===-0x1){return _0x12f7cd;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xca'),_0xc2f80d[_0x7352('0xcb')],_0xc2f80d[_0x7352('0x7d')]));};AGIVertices['prototype'][_0x7352('0xcc')]=function(_0x3adfb1){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xcd'),_0x3adfb1[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x3adfb1[_0x7352('0x5f')])){return this['channel']['noop'](_0x7352('0xad'));}var _0x3d0de7='\x22'+_0x3adfb1['text']+'\x22';if(this['isConfigured'](_0x3adfb1[_0x7352('0x7d')])){_0x3d0de7+=','+_0x3adfb1[_0x7352('0x7d')];}var _0x2c0528=this[_0x7352('0x10')][_0x7352('0xae')](_0x7352('0xce'),_0x3d0de7);if(_0x2c0528[_0x7352('0xaf')]===-0x1){return _0x2c0528;}return this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0xcf'),_0x3d0de7));};AGIVertices[_0x7352('0x19')][_0x7352('0xd0')]=function(_0xd673d9){logger[_0x7352('0x32')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xd673d9[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0xd673d9[_0x7352('0x5f')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xad'));}var _0x5bb63d='\x22'+_0xd673d9[_0x7352('0x5f')]+'\x22';if(this[_0x7352('0x8a')](_0xd673d9['options'])){_0x5bb63d+=','+_0xd673d9[_0x7352('0x7d')];}var _0x5e6878=this[_0x7352('0x10')][_0x7352('0xae')]('MRCPSynth',_0x5bb63d);if(_0x5e6878['result']===-0x1){return _0x5e6878;}return this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0xcf'),_0x5bb63d));};AGIVertices['prototype'][_0x7352('0xd1')]=function(_0x302824){logger['info'](util[_0x7352('0x2c')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x302824[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x302824[_0x7352('0xb1')])){return this[_0x7352('0x10')]['noop'](_0x7352('0xb2'));}var _0x22588e=_0x302824['grammar'];if(this[_0x7352('0x8a')](_0x302824['options'])){_0x22588e+=','+_0x302824[_0x7352('0x7d')];}var _0x284d8c=this[_0x7352('0x10')][_0x7352('0xae')](_0x7352('0xd2'),_0x22588e);if(_0x284d8c[_0x7352('0xaf')]===-0x1){return _0x284d8c;}var _0x18e608=this[_0x7352('0xa6')](_0x7352('0xb3'),_0x7352('0xd3'));if(_0x18e608[_0x7352('0xaf')]===-0x1){return _0x18e608;}var _0x11031c=this['getAndSetVariable'](_0x7352('0xd4'),_0x7352('0xd5'));if(_0x11031c[_0x7352('0xaf')]===-0x1){return _0x11031c;}var _0x41ce79=this[_0x7352('0xa6')](_0x7352('0xb6'),'LUMENVOX_ASR_INSTANCE');if(_0x41ce79[_0x7352('0xaf')]===-0x1){return _0x41ce79;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xb8'),_0x22588e));};AGIVertices[_0x7352('0x19')][_0x7352('0xd6')]=function(_0x1d0651){logger[_0x7352('0x32')](util['format'](_0x7352('0xd7'),_0x1d0651[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x1d0651['grammar'])){return this['channel'][_0x7352('0xac')](_0x7352('0xb2'));}var _0x385a62=_0x1d0651['grammar'];if(this[_0x7352('0x8a')](_0x1d0651[_0x7352('0x7d')])){_0x385a62+=','+_0x1d0651[_0x7352('0x7d')];}var _0x388621=this['channel'][_0x7352('0xae')](_0x7352('0xd2'),_0x385a62);if(_0x388621[_0x7352('0xaf')]===-0x1){return _0x388621;}var _0x3e5b6=this['getAndSetVariable'](_0x7352('0xb3'),_0x7352('0xd8'));if(_0x3e5b6['result']===-0x1){return _0x3e5b6;}var _0x11bdba=this[_0x7352('0xa6')](_0x7352('0xd4'),_0x7352('0xd9'));if(_0x11bdba[_0x7352('0xaf')]===-0x1){return _0x11bdba;}var _0x434f11=this['getAndSetVariable'](_0x7352('0xb6'),_0x7352('0xda'));if(_0x434f11[_0x7352('0xaf')]===-0x1){return _0x434f11;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xb8'),_0x385a62));};AGIVertices[_0x7352('0x19')][_0x7352('0xdb')]=function(_0x4ea428){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xdc'),_0x4ea428['label']));if(!this[_0x7352('0x8a')](_0x4ea428[_0x7352('0xdd')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4ea428,_0x7352('0xde'));}var _0x395678=this[_0x7352('0x1c')]['sync'](this,_0x4ea428[_0x7352('0xdd')]);if(!_0x395678){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4ea428,_0x7352('0xdf'));}if(!this[_0x7352('0x8a')](_0x4ea428[_0x7352('0x34')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4ea428,_0x7352('0xe0'));}var _0x3a288d=_0x4ea428['query'][_0x7352('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xe1'),_0x3a288d));var _0x2b11ce=this[_0x7352('0x2e')]['sync'](this,_0x395678,_0x3a288d);this['createSquareDetailsReport'][_0x7352('0x74')](this,_0x4ea428,_0x3a288d);if(!this['isConfigured'](_0x4ea428[_0x7352('0xe2')])){return this[_0x7352('0x10')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x386fa6=this[_0x7352('0x13')][_0x7352('0x74')](this,_0x4ea428[_0x7352('0xe2')]);if(!_0x386fa6){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4ea428,'no\x20variable\x20found');}var _0x5d0759=this;_0x2b11ce[_0x7352('0xe3')](function(_0x31cfe2,_0x30b688){Object[_0x7352('0xe4')](_0x31cfe2)[_0x7352('0xe3')](function(_0x4887b0){_0x5d0759[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')]('%s[%s][%s]',_0x386fa6,_0x30b688,_0x4887b0),_0x31cfe2[_0x4887b0]);});});this[_0x7352('0x10')][_0x7352('0xa2')](util['format'](_0x7352('0xe5'),_0x386fa6),_0x2b11ce[_0x7352('0x9e')]);return this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xe6'),_0x386fa6));};AGIVertices[_0x7352('0x19')][_0x7352('0xe7')]=function(_0x4aec06){logger[_0x7352('0xe8')](util[_0x7352('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4aec06['label']));if(!this[_0x7352('0x8a')](_0x4aec06[_0x7352('0xe9')])){return this['channel']['error'](_0x4aec06,_0x7352('0xea'));}var _0x4c1031=this[_0x7352('0x1f')][_0x7352('0x74')](this,_0x4aec06[_0x7352('0xe9')]);if(!_0x4c1031){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4aec06,_0x7352('0xeb'));}var _0xf6b2ae=this[_0x7352('0x10')]['exec']('DIAL',[util[_0x7352('0x2c')](_0x7352('0xec'),_0x4c1031),_0x4aec06['timeout'],_0x4aec06[_0x7352('0xed')],_0x4aec06['url']]);if(_0xf6b2ae[_0x7352('0xaf')]===-0x1){return _0xf6b2ae;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x7352('0x19')][_0x7352('0xee')]=function(_0x138f8f){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xef'),_0x138f8f[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x138f8f[_0x7352('0x7f')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xf0'));}if(!this[_0x7352('0x8a')](_0x138f8f[_0x7352('0x5f')])){return this[_0x7352('0x10')]['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x7352('0x3b')](_0x138f8f);this[_0x7352('0x47')](_0x138f8f[_0x7352('0x5f')],'in','','');this['channel']['noop'](util[_0x7352('0x2c')]('Trying\x20Dialogflow:\x20%s',_0x138f8f[_0x7352('0x5f')]));var _0x36e8f6=this['googleDialogflow'][_0x7352('0x74')](this,_0x138f8f);if(_0x36e8f6){for(var _0xba71c3 in _0x36e8f6){if(_0x36e8f6['hasOwnProperty'](_0xba71c3)){this[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')]('DIALOGFLOW_%s',_0xba71c3['toUpperCase']()),_0x36e8f6[_0xba71c3]);}}this[_0x7352('0x47')](_0x36e8f6[_0x7352('0xf1')],_0x7352('0xf2'),_0x7352('0xee'),'');return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('Dialogflow\x20Result\x20%s',_0x36e8f6['speech']));}return this[_0x7352('0x10')]['error'](_0x138f8f,_0x7352('0xf3'));};AGIVertices['prototype']['dialogflowV2']=function(_0x2a293e){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0xf4'),_0x2a293e['label']));if(!this['isConfigured'](_0x2a293e[_0x7352('0xf5')])){return this[_0x7352('0x10')]['noop'](_0x7352('0xf6'));}if(!this[_0x7352('0x8a')](_0x2a293e['client_email'])){return this['channel'][_0x7352('0xac')](_0x7352('0xf7'));}if(!this[_0x7352('0x8a')](_0x2a293e[_0x7352('0x83')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xf8'));}if(!this[_0x7352('0x8a')](_0x2a293e['dialogflowV2_language'])){return this[_0x7352('0x10')][_0x7352('0xac')]('no\x20anguage\x20configured');}if(!this[_0x7352('0x8a')](_0x2a293e[_0x7352('0x5f')])){return this['channel'][_0x7352('0xac')]('no\x20text\x20configured');}this[_0x7352('0x10')][_0x7352('0xf9')]=!![];this[_0x7352('0x3b')](_0x2a293e);this['createSquareMessage'](_0x2a293e[_0x7352('0x5f')],'in','','');this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xfa'),_0x2a293e[_0x7352('0x5f')]));var _0x305efa=this[_0x7352('0x81')][_0x7352('0x74')](this,_0x2a293e);if(_0x305efa){for(var _0x49bc9d in _0x305efa){if(_0x305efa[_0x7352('0xfb')](_0x49bc9d)){if(_0x49bc9d!==_0x7352('0xfc')){this[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')](_0x7352('0xfd'),_0x49bc9d['toUpperCase']()),_0x305efa[_0x49bc9d]);}}}this[_0x7352('0x47')](_0x305efa[_0x7352('0xf1')],_0x7352('0xf2'),_0x7352('0xfe'),_0x305efa[_0x7352('0xfc')]);return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xff'),_0x305efa[_0x7352('0xf1')]));}return this[_0x7352('0x10')][_0x7352('0x30')](_0x2a293e,_0x7352('0x100'));};AGIVertices['prototype']['sesteknda']=function(_0xe7a9a3){logger[_0x7352('0x32')](util[_0x7352('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xe7a9a3[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0xe7a9a3[_0x7352('0x101')])){return this[_0x7352('0x10')]['noop'](_0x7352('0x102'));}if(!this['isConfigured'](_0xe7a9a3[_0x7352('0x103')])){return this['channel'][_0x7352('0xac')](_0x7352('0x104'));}if(!this['isConfigured'](_0xe7a9a3[_0x7352('0x105')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x106'));}if(!this[_0x7352('0x8a')](_0xe7a9a3['ndassistant_url'])){return this[_0x7352('0x10')][_0x7352('0xac')]('no\x20text\x20configured');}this[_0x7352('0x10')]['bot']=!![];this[_0x7352('0x3b')](_0xe7a9a3);this[_0x7352('0x47')](_0xe7a9a3[_0x7352('0x5f')],'in','','');this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x107'),_0xe7a9a3['text']));var _0x33c649=this[_0x7352('0x84')][_0x7352('0x74')](this,_0xe7a9a3);if(_0x33c649){for(var _0x3a825a in _0x33c649){if(_0x33c649[_0x7352('0xfb')](_0x3a825a)){this[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')]('SESTEK_NDA_%s',_0x3a825a[_0x7352('0x108')]()),_0x33c649[_0x3a825a]);}}this['createSquareMessage'](_0x33c649[_0x7352('0xf1')],_0x7352('0xf2'),_0x7352('0x109'),'');if(_0x33c649['audiofile']){this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x10a'),_0x33c649[_0x7352('0x10b')]));var _0x179749=this[_0x7352('0x10')]['streamFile'](_0x33c649[_0x7352('0x10b')]);try{fs['unlink'](_0x33c649[_0x7352('0x10b')]+'.wav');}catch(_0x67074f){logger[_0x7352('0x30')](_0x67074f);}return _0x179749;}else{return this['channel']['noop'](util['format']('SestekNDA\x20Result\x20%s',_0x33c649['speech']));}}return this[_0x7352('0x10')][_0x7352('0x30')](_0xe7a9a3,_0x7352('0x10c'));};AGIVertices[_0x7352('0x19')][_0x7352('0x10d')]=function(_0xc2f481){logger[_0x7352('0x32')](util['format'](_0x7352('0x10e'),_0xc2f481['label']));return this[_0x7352('0x10')]['noop'](_0x7352('0x10d'));};AGIVertices[_0x7352('0x19')][_0x7352('0x10f')]=function(_0x2f6171){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x110'),_0x2f6171[_0x7352('0x3d')]));var _0x5e05cb='';if(_0x2f6171[_0x7352('0x111')]){if(!this[_0x7352('0x8a')](_0x2f6171[_0x7352('0x111')])){return this['channel'][_0x7352('0x30')](_0x2f6171,_0x7352('0x112'));}else{var _0x12c26e=parseInt(_0x2f6171['trunk_id'],0xa);if(isNaN(_0x12c26e)){_0x5e05cb=_0x2f6171[_0x7352('0x111')];}else{_0x5e05cb=this['getTrunk']['sync'](this,_0x2f6171[_0x7352('0x111')]);if(!_0x5e05cb){return this['channel'][_0x7352('0x30')](_0x2f6171,_0x7352('0x113'));}}}}else if(_0x2f6171[_0x7352('0x114')]){_0x5e05cb=_0x2f6171[_0x7352('0x114')];}else{return this[_0x7352('0x10')][_0x7352('0x30')](_0x2f6171,'no\x20trunk\x20selected');}var _0x461ac0=this[_0x7352('0x10')][_0x7352('0xae')](_0x7352('0x115'),[util[_0x7352('0x2c')](_0x7352('0x116'),_0x5e05cb,_0x2f6171[_0x7352('0x4c')]),_0x2f6171[_0x7352('0x6a')],_0x2f6171['opts'],_0x2f6171[_0x7352('0x68')]]);if(_0x461ac0[_0x7352('0xaf')]===-0x1){return _0x461ac0;}return this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x117'),_0x7352('0x115')));};AGIVertices[_0x7352('0x19')][_0x7352('0x118')]=function(_0x357ba0){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x119'),_0x357ba0[_0x7352('0x3d')]));return this[_0x7352('0x10')][_0x7352('0xac')]('finally');};AGIVertices[_0x7352('0x19')][_0x7352('0xf')]=function(_0x43491d){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x11a'),_0x43491d[_0x7352('0x3d')]));if(_0x43491d[_0x7352('0xa9')]===0x0){return this[_0x7352('0xa8')](_0x43491d);}_0x43491d[_0x7352('0xa9')]-=0x1;if(!this[_0x7352('0x8a')](_0x43491d[_0x7352('0x11b')])){return this[_0x7352('0x10')]['error'](_0x43491d,_0x7352('0x11c'));}var _0x14810c=this[_0x7352('0x11d')][_0x7352('0x74')](this,_0x43491d[_0x7352('0x11b')]);if(!_0x14810c){return this[_0x7352('0x10')][_0x7352('0x30')](_0x43491d,_0x7352('0x11e'));}if(!this['isConfigured'](_0x43491d['variable_id'])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x7352('0x11f'));}var _0x3e1ad3=this[_0x7352('0x10')]['getData'](_0x14810c,_0x43491d['response'],_0x43491d[_0x7352('0x120')]);var _0x40d7b7=_0x3e1ad3[_0x7352('0xaf')]?_0x3e1ad3[_0x7352('0xaf')]['toString']():'';logger[_0x7352('0x32')]('test',JSON['stringify'](_0x3e1ad3));if(_0x3e1ad3[_0x7352('0xaf')]===-0x1){this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x43491d,_0x40d7b7);return _0x3e1ad3;}else if(_0x3e1ad3[_0x7352('0xa5')]===_0x7352('0x6a')){_0x3e1ad3[_0x7352('0xaf')]=_0x40d7b7[_0x7352('0x9e')]>=parseInt(_0x43491d['mindigit'])?'x':'i';}else{_0x3e1ad3[_0x7352('0xaf')]=_0x40d7b7[_0x7352('0x9e')]>=parseInt(_0x43491d[_0x7352('0x121')])&&_0x40d7b7['length']<=parseInt(_0x43491d['maxdigit'])?'x':'i';}var _0x1e13d4=this[_0x7352('0x13')]['sync'](this,_0x43491d[_0x7352('0xe2')]);if(!_0x1e13d4){return this['channel'][_0x7352('0x30')](_0x43491d,_0x7352('0x122'));}this['channel']['setVariable'](_0x1e13d4,_0x40d7b7);if(this[_0x7352('0x8a')](_0x43491d['hiddendigitsnum'])){var _0x2c93e4=parseInt(_0x43491d[_0x7352('0x123')],0xa);var _0x3305eb=rs['generate']({'charset':'*','length':_0x2c93e4});var _0x521b70=_0x40d7b7[_0x7352('0x9e')];if(_0x521b70>0x0){if(_0x521b70>_0x2c93e4){this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x43491d,_0x43491d[_0x7352('0x124')]==='first'?_0x3305eb+_0x40d7b7[_0x7352('0x125')](_0x2c93e4):_0x40d7b7[_0x7352('0x125')](0x0,_0x521b70-_0x2c93e4)+_0x3305eb);}else{this['createSquareDetailsReport'][_0x7352('0x74')](this,_0x43491d,rs[_0x7352('0x126')]({'charset':'*','length':_0x521b70}));}}else{this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x43491d,'');}}else{this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x43491d,_0x40d7b7);}return _0x3e1ad3;};AGIVertices[_0x7352('0x19')][_0x7352('0x127')]=function(_0x2a4db0){logger[_0x7352('0x32')](util[_0x7352('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2a4db0['label']));return this[_0x7352('0xf')](_0x2a4db0);};AGIVertices[_0x7352('0x19')][_0x7352('0x128')]=function(_0x50f630){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x129'),_0x50f630['label']));this['createSquareDetailsReport'][_0x7352('0x74')](this,_0x50f630,_0x50f630[_0x7352('0x12a')]);return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('GOAL\x20%s',_0x50f630[_0x7352('0x12a')]));};AGIVertices[_0x7352('0x19')][_0x7352('0x12b')]=function(_0x27a8d4){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x12c'),_0x27a8d4[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x27a8d4[_0x7352('0x8d')])||!this[_0x7352('0x8a')](_0x27a8d4[_0x7352('0x92')])){return this['channel'][_0x7352('0xac')](_0x7352('0x12d'));}if(!this['isConfigured'](_0x27a8d4['text'])){return this[_0x7352('0x10')][_0x7352('0xac')]('no\x20text\x20configured');}this['channel'][_0x7352('0xac')](util['format'](_0x7352('0x12e'),_0x27a8d4[_0x7352('0x5f')]));var _0x14bf30=this['awsPolly']['sync'](this,_0x27a8d4);if(_0x14bf30){this['channel']['noop'](util[_0x7352('0x2c')](_0x7352('0x12f'),_0x14bf30));var _0x18fea4=this[_0x7352('0x10')]['streamFile'](_0x14bf30);try{fs[_0x7352('0x130')](_0x14bf30+_0x7352('0x131'));}catch(_0x406b30){logger[_0x7352('0x30')](_0x406b30);}return _0x18fea4;}return this[_0x7352('0x10')][_0x7352('0x30')](_0x27a8d4,_0x7352('0x132'));};AGIVertices['prototype'][_0x7352('0x133')]=function(_0x3b2c92){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x134'),_0x3b2c92[_0x7352('0x3d')]));if(!this['isConfigured'](_0x3b2c92[_0x7352('0x8d')])||!this['isConfigured'](_0x3b2c92[_0x7352('0x92')])){return this[_0x7352('0x10')]['noop'](_0x7352('0x12d'));}if(!this[_0x7352('0x8a')](_0x3b2c92['aws_bot_name'])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x135'));}if(!this[_0x7352('0x8a')](_0x3b2c92[_0x7352('0x5f')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xad'));}this[_0x7352('0x10')][_0x7352('0xf9')]=!![];this['createSquareDetailsReport'](_0x3b2c92);this['createSquareMessage'](_0x3b2c92[_0x7352('0x5f')],'in','','');this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x136'),_0x3b2c92['text']));var _0x31ffda=this['awsLex'][_0x7352('0x74')](this,_0x3b2c92);if(_0x31ffda){for(var _0x3bf0dd in _0x31ffda){if(_0x31ffda[_0x7352('0xfb')](_0x3bf0dd)&&_[_0x7352('0x99')](_0x31ffda[_0x3bf0dd])){this[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')](_0x7352('0x137'),_0x3bf0dd[_0x7352('0x108')]()),_0x31ffda[_0x3bf0dd]);}}if(_['isNil'](_0x31ffda['message'])){return this['channel']['noop'](_0x7352('0x138'));}else{this[_0x7352('0x47')](_0x31ffda['message'],_0x7352('0xf2'),'amazonlex','');return this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')]('Amazon\x20Lex\x20Result\x20%s',_0x31ffda[_0x7352('0x7b')]));}}return this['channel'][_0x7352('0x30')](_0x3b2c92,_0x7352('0x139'));};AGIVertices[_0x7352('0x19')]['googleasr']=function(_0x1d75aa){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x13a'),_0x1d75aa['label'],_0x1d75aa[_0x7352('0x6a')]));if(!this['isConfigured'](_0x1d75aa['key'])){return this['channel'][_0x7352('0xac')]('no\x20key\x20configured');}var _0x36c913=_0x7352('0x13b');var _0x2cc033=util[_0x7352('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x7352('0x126')](0x4));var _0x40b963=util[_0x7352('0x2c')](_0x7352('0xa1'),_0x2cc033,_0x36c913);var _0x4af313=!![];if(_0x1d75aa['beep']===_0x7352('0x13c')){_0x4af313=![];}var _0x26a6d6=this['channel'][_0x7352('0x13d')](_0x2cc033,_0x36c913,_0x1d75aa['intKey'],_0x1d75aa[_0x7352('0x6a')],undefined,_0x4af313);if(_0x26a6d6[_0x7352('0xaf')]!==-0x1){this['channel'][_0x7352('0xac')](util['format']('google\x20%s\x20file\x20created',_0x40b963));var _0x52cdfa=this[_0x7352('0x95')][_0x7352('0x74')](this,_0x1d75aa,_0x40b963);if(_0x52cdfa){for(var _0x21de62 in _0x52cdfa){if(_0x52cdfa['hasOwnProperty'](_0x21de62)){this['channel'][_0x7352('0xa2')](util['format'](_0x7352('0x13e'),_0x21de62[_0x7352('0x108')]()),_0x52cdfa[_0x21de62]);}}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x13f'),JSON[_0x7352('0x77')](_0x52cdfa)));}}return _0x26a6d6;};AGIVertices[_0x7352('0x19')]['tildeasr']=function(_0x58fffd){logger['info'](util[_0x7352('0x2c')](_0x7352('0x140'),_0x58fffd[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x58fffd[_0x7352('0x97')])){return this[_0x7352('0x10')][_0x7352('0xac')]('no\x20appid\x20configured');}if(!this[_0x7352('0x8a')](_0x58fffd['appsecret'])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x141'));}var _0x1f9ce0=_0x7352('0x13b');var _0x289407=util[_0x7352('0x2c')](_0x7352('0x142'),FILES_PATH,rs[_0x7352('0x126')](0x4));var _0x290f0d=util[_0x7352('0x2c')](_0x7352('0xa1'),_0x289407,_0x1f9ce0);var _0x4596d6=!![];if(_0x58fffd[_0x7352('0x143')]===_0x7352('0x13c')){_0x4596d6=![];}var _0x9e807a=this[_0x7352('0x10')]['recordFile'](_0x289407,_0x1f9ce0,_0x58fffd[_0x7352('0x144')],_0x58fffd[_0x7352('0x6a')],undefined,_0x4596d6);if(_0x9e807a[_0x7352('0xaf')]!==-0x1){this['channel'][_0x7352('0xac')](util['format'](_0x7352('0x145'),_0x290f0d));var _0x330f2e=this[_0x7352('0x96')][_0x7352('0x74')](this,_0x58fffd,_0x290f0d);if(_0x330f2e){for(var _0x57280f in _0x330f2e){if(_0x330f2e[_0x7352('0xfb')](_0x57280f)){this['channel']['setVariable'](util[_0x7352('0x2c')](_0x7352('0x146'),_0x57280f[_0x7352('0x108')]()),_0x330f2e[_0x57280f]);}}return this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x147'),JSON['stringify'](_0x330f2e)));}}return _0x9e807a;};AGIVertices[_0x7352('0x19')][_0x7352('0x148')]=function(_0x27bb75){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x149'),_0x27bb75['label']));return this[_0x7352('0x10')][_0x7352('0x14a')](_0x27bb75[_0x7352('0x43')],_0x27bb75[_0x7352('0x44')],_0x27bb75[_0x7352('0x14b')]);};AGIVertices[_0x7352('0x19')][_0x7352('0x14c')]=function(_0x4c2235){logger[_0x7352('0x32')](util['format'](_0x7352('0x14d'),_0x4c2235[_0x7352('0x3d')]));if(!this['isConfigured'](_0x4c2235[_0x7352('0x14e')])){return this[_0x7352('0x10')]['error'](_0x4c2235,_0x7352('0x14f'));}try{var _0xff1724=eval(_0x4c2235['condition'])?_0x7352('0x150'):_0x7352('0x151');this[_0x7352('0x10')]['noop'](util[_0x7352('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4c2235[_0x7352('0x14e')],_0xff1724));return{'code':0xc8,'result':_0xff1724};}catch(_0x4c6a4f){return{'code':0xc8,'result':_0x7352('0x151')};}};AGIVertices[_0x7352('0x19')][_0x7352('0x152')]=function(_0xf06a2f){logger['info'](util[_0x7352('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xf06a2f['label']));if(!this[_0x7352('0x8a')](_0xf06a2f[_0x7352('0x153')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0xf06a2f,_0x7352('0x154'));}var _0x2c4c8b=this[_0x7352('0x28')][_0x7352('0x74')](this,_0xf06a2f[_0x7352('0x153')]);if(!_0x2c4c8b){return this[_0x7352('0x10')][_0x7352('0x30')](_0xf06a2f,_0x7352('0x155'));}for(var _0x3c5d3c=0x0;_0x3c5d3c<_0x2c4c8b[_0x7352('0x9e')];_0x3c5d3c+=0x1){var _0x2f6050=this[_0x7352('0x10')]['getVariable'](util[_0x7352('0x2c')]('IFTIME(%s?true:false)',_0x2c4c8b[_0x3c5d3c]));if(_0x2f6050[_0x7352('0xaf')]===-0x1){return _0x2f6050;}logger[_0x7352('0x32')](util['format'](_0x7352('0x156'),_0x2c4c8b[_0x3c5d3c],_0x2f6050[_0x7352('0xa5')]));if(_0x2f6050[_0x7352('0xa5')]==='true'){logger[_0x7352('0x32')](util['format'](_0x7352('0x156'),_0x2c4c8b[_0x3c5d3c],_0x7352('0x150')));this[_0x7352('0x10')]['noop'](util[_0x7352('0x2c')](_0x7352('0x156'),_0x2c4c8b[_0x3c5d3c],_0x7352('0x150')));return{'code':0xc8,'result':_0x7352('0x150')};}else{logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x156'),_0x2c4c8b[_0x3c5d3c],'false'));this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x156'),_0x2c4c8b[_0x3c5d3c],_0x7352('0x151')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x7352('0x19')][_0x7352('0x157')]=function(_0x3c2903){logger['info'](util['format'](_0x7352('0x158'),_0x3c2903[_0x7352('0x3d')]));return this['channel'][_0x7352('0x157')]();};AGIVertices[_0x7352('0x19')]['ispeechasr']=function(_0x37c529){logger['info'](util[_0x7352('0x2c')](_0x7352('0x159'),_0x37c529[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x37c529[_0x7352('0x7f')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xf0'));}var _0x36a0ab=_0x7352('0x13b');var _0xf22af2=util[_0x7352('0x2c')](_0x7352('0x142'),FILES_PATH,rs[_0x7352('0x126')](0x4));var _0x84bf2a=util[_0x7352('0x2c')](_0x7352('0xa1'),_0xf22af2,_0x36a0ab);var _0x33de24=!![];if(_0x37c529['beep']==='NOBEEP'){_0x33de24=![];}var _0xc7b02b=this[_0x7352('0x10')][_0x7352('0x13d')](_0xf22af2,_0x36a0ab,_0x37c529[_0x7352('0x144')],_0x37c529[_0x7352('0x6a')],undefined,_0x33de24);if(_0xc7b02b[_0x7352('0xaf')]!==-0x1){this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x15a'),_0x84bf2a));var _0x7e42ef=this[_0x7352('0x88')][_0x7352('0x74')](this,_0x37c529,_0x84bf2a);if(_0x7e42ef){for(var _0x36c9dd in _0x7e42ef){if(_0x7e42ef[_0x7352('0xfb')](_0x36c9dd)){this[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')]('ISPEECH_ASR_%s',_0x36c9dd[_0x7352('0x108')]()),_0x7e42ef[_0x36c9dd]);}}return this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0x15b'),JSON[_0x7352('0x77')](_0x7e42ef)));}}return _0xc7b02b;};AGIVertices['prototype'][_0x7352('0x15c')]=function(_0x122270){logger['info'](util[_0x7352('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x122270[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x122270[_0x7352('0x7f')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xf0'));}if(!this['isConfigured'](_0x122270[_0x7352('0x5f')])){return this[_0x7352('0x10')]['noop'](_0x7352('0xad'));}this[_0x7352('0x10')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x122270[_0x7352('0x5f')]));var _0x5ba7fc=this[_0x7352('0x85')]['sync'](this,_0x122270);if(_0x5ba7fc){this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x15a'),_0x5ba7fc));var _0x516cbd=this[_0x7352('0x10')]['streamFile'](_0x5ba7fc,_0x122270[_0x7352('0x144')]);try{fs[_0x7352('0x130')](_0x5ba7fc+_0x7352('0x131'));}catch(_0x3b291c){logger[_0x7352('0x30')](_0x3b291c);}return _0x516cbd;}return this[_0x7352('0x10')][_0x7352('0x30')](_0x122270,_0x7352('0x15d'));};AGIVertices[_0x7352('0x19')][_0x7352('0x15e')]=function(_0x1139e4){logger[_0x7352('0x32')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1139e4[_0x7352('0x3d')]));if(!this['isConfigured'](_0x1139e4[_0x7352('0x15f')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x1139e4,_0x7352('0x160'));}logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x161'),this[_0x7352('0x10')][_0x7352('0x40')],_0x1139e4[_0x7352('0x15f')]));var _0x2279af=this['agentLogin'][_0x7352('0x74')](this,_0x1139e4[_0x7352('0x15f')]);if(_0x2279af){logger[_0x7352('0x32')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7352('0x10')][_0x7352('0x40')],_0x1139e4[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7352('0x10')][_0x7352('0x40')],_0x1139e4[_0x7352('0x15f')]));return{'code':0xc8,'result':_0x7352('0x162')};}else{logger[_0x7352('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x1139e4[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7352('0x10')][_0x7352('0x40')],_0x1139e4['findBy']));return{'code':0xc8,'result':_0x7352('0x163')};}};AGIVertices[_0x7352('0x19')][_0x7352('0x164')]=function(_0x3be0b5){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x165'),_0x3be0b5[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x3be0b5[_0x7352('0x15f')])){return this[_0x7352('0x10')]['error'](_0x3be0b5,_0x7352('0x160'));}logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x161'),this['channel'][_0x7352('0x40')],_0x3be0b5[_0x7352('0x15f')]));var _0x48444c=this[_0x7352('0x55')]['sync'](this,_0x3be0b5[_0x7352('0x15f')]);if(_0x48444c){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x166'),this[_0x7352('0x10')]['callerid'],_0x3be0b5[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x166'),this[_0x7352('0x10')][_0x7352('0x40')],_0x3be0b5['findBy']));return{'code':0xc8,'result':_0x7352('0x162')};}else{logger['info'](util[_0x7352('0x2c')](_0x7352('0x167'),this[_0x7352('0x10')][_0x7352('0x40')],_0x3be0b5[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x7352('0x40')],_0x3be0b5[_0x7352('0x15f')]));return{'code':0xc8,'result':_0x7352('0x163')};}};AGIVertices['prototype'][_0x7352('0x168')]=function(_0x2daaaa){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x169'),_0x2daaaa[_0x7352('0x3d')]));if(!this['isConfigured'](_0x2daaaa[_0x7352('0x16a')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x2daaaa,_0x7352('0x16b'));}this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x16c'),_0x2daaaa[_0x7352('0x16a')]));var _0x55ee3b=eval(_0x2daaaa[_0x7352('0x16a')]);if(!this['isConfigured'](_0x2daaaa[_0x7352('0xe2')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x11f'));}var _0x1f6b38=this[_0x7352('0x13')][_0x7352('0x74')](this,_0x2daaaa[_0x7352('0xe2')]);if(!_0x1f6b38){return this[_0x7352('0x10')][_0x7352('0x30')](_0x2daaaa,_0x7352('0x122'));}if(_[_0x7352('0x9d')](_0x55ee3b)){var _0x7339dd=this;_0x55ee3b['forEach'](function(_0x33f8f2,_0xdda903){_0x7339dd[_0x7352('0x10')][_0x7352('0xa2')](util[_0x7352('0x2c')](_0x7352('0x16d'),_0x1f6b38,_0xdda903),_0x33f8f2);});return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')]('variable\x20%s[key]\x20set',_0x1f6b38));}else{return this[_0x7352('0x10')][_0x7352('0xa2')](_0x1f6b38,_0x55ee3b);}};AGIVertices[_0x7352('0x19')]['menu']=function(_0x5cfe39){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x16e'),_0x5cfe39['label']));if(_0x5cfe39['retry']===0x0){return this[_0x7352('0xa8')](_0x5cfe39);}_0x5cfe39[_0x7352('0xa9')]-=0x1;if(!this['isConfigured'](_0x5cfe39[_0x7352('0x11b')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x5cfe39,'no\x20file\x20audio\x20selected');}var _0x5eff54=this[_0x7352('0x11d')][_0x7352('0x74')](this,_0x5cfe39[_0x7352('0x11b')]);if(!_0x5eff54){return this[_0x7352('0x10')][_0x7352('0x30')](_0x5cfe39,'no\x20file\x20audio\x20found');}var _0x463051=this['channel']['getData'](_0x5eff54,_0x5cfe39['response'],_0x5cfe39[_0x7352('0x16f')]);var _0xa0f8dd=_0x463051[_0x7352('0xaf')];if(_0x463051[_0x7352('0xaf')]===-0x1){this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x5cfe39,'-1');return _0x463051;}else if(_0x463051['extra']===_0x7352('0x6a')){_0x463051[_0x7352('0xaf')]=_0x463051[_0x7352('0xaf')][_0x7352('0x9e')]>0x0?_0x463051[_0x7352('0xaf')]:'t';}else if(_['isEmpty'](_0x463051[_0x7352('0xaf')])){_0x463051[_0x7352('0xaf')]='#';_0xa0f8dd='#';}if(!this[_0x7352('0x8a')](_0x5cfe39['variable_id'])){this[_0x7352('0x10')][_0x7352('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1ca650=this[_0x7352('0x13')][_0x7352('0x74')](this,_0x5cfe39[_0x7352('0xe2')]);if(!_0x1ca650){return this['channel']['error'](_0x5cfe39,_0x7352('0x122'));}this[_0x7352('0x10')]['setVariable'](_0x1ca650,_0xa0f8dd);}this[_0x7352('0x3b')]['sync'](this,_0x5cfe39,_0xa0f8dd);return _0x463051;};AGIVertices[_0x7352('0x19')][_0x7352('0xac')]=function(_0x506c0d){logger[_0x7352('0x32')](util[_0x7352('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x506c0d['label']));return this['channel'][_0x7352('0xac')](_0x506c0d[_0x7352('0x170')]||_0x506c0d['label']);};AGIVertices[_0x7352('0x19')][_0x7352('0x171')]=function(_0x548f3a){logger[_0x7352('0x32')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x548f3a[_0x7352('0x3d')]));if(!this['isConfigured'](_0x548f3a[_0x7352('0x15f')])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x548f3a,'no\x20find\x20by\x20configured');}logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x161'),this[_0x7352('0x10')][_0x7352('0x40')],_0x548f3a[_0x7352('0x15f')]));var _0x4efbea=this['getPause'][_0x7352('0x74')](this,_0x548f3a[_0x7352('0x172')]);var _0x39a8ca=this[_0x7352('0x52')][_0x7352('0x74')](this,_0x548f3a[_0x7352('0x15f')],_0x4efbea);if(_0x39a8ca){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x166'),this['channel']['callerid'],_0x548f3a['findBy']));this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0x166'),this['channel'][_0x7352('0x40')],_0x548f3a['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x167'),this[_0x7352('0x10')][_0x7352('0x40')],_0x548f3a[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7352('0x40')],_0x548f3a[_0x7352('0x15f')]));return{'code':0xc8,'result':_0x7352('0x163')};}};AGIVertices[_0x7352('0x19')][_0x7352('0x173')]=function(_0x3012a9){logger[_0x7352('0x32')](util['format'](_0x7352('0x174'),_0x3012a9['label']));if(!this[_0x7352('0x8a')](_0x3012a9[_0x7352('0x11b')])){return this[_0x7352('0x10')]['error'](_0x3012a9,'no\x20file\x20audio\x20selected');}var _0x1071ed=this[_0x7352('0x11d')][_0x7352('0x74')](this,_0x3012a9[_0x7352('0x11b')]);if(!_0x1071ed){return this['channel']['error'](_0x3012a9,_0x7352('0x11e'));}var _0x2e8a5c=this[_0x7352('0x10')][_0x7352('0xae')](_0x7352('0x175'),[_0x1071ed,_0x3012a9[_0x7352('0xed')]]);if(_0x2e8a5c['result']===-0x1){return _0x2e8a5c;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xca'),_0x7352('0x175'),_0x1071ed));};AGIVertices['prototype']['queue']=function(_0xcd937f){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xcd937f[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0xcd937f[_0x7352('0x176')])){return this['channel'][_0x7352('0x30')](_0xcd937f,_0x7352('0x177'));}var _0x33ddae='';var _0x3216d1=parseInt(_0xcd937f[_0x7352('0x176')],0xa);if(isNaN(_0x3216d1)){_0x33ddae=_0xcd937f[_0x7352('0x176')];}else{_0x33ddae=this[_0x7352('0x17')]['sync'](this,_0xcd937f[_0x7352('0x176')]);if(!_0x33ddae){return this[_0x7352('0x10')][_0x7352('0x30')](_0xcd937f,'no\x20queue\x20found');}}var _0x27e485='';if(this['isConfigured'](_0xcd937f[_0x7352('0x11b')])){var _0x38d23e=this[_0x7352('0x11d')][_0x7352('0x74')](this,_0xcd937f[_0x7352('0x11b')]);if(_0x38d23e){_0x27e485=_0x38d23e;}}this['createSquareDetailsReport'][_0x7352('0x74')](this,_0xcd937f,_0x33ddae);if(_0xcd937f['opts'][_0x7352('0x178')]('x')<0x0){_0xcd937f[_0x7352('0xed')]+='x';}if(_0xcd937f['opts'][_0x7352('0x178')]('X')<0x0){_0xcd937f[_0x7352('0xed')]+='X';}this[_0x7352('0x10')][_0x7352('0xa2')](_0x7352('0x179'),_0x33ddae?_0x33ddae['toLowerCase']():'');var _0x33cb34=this['channel']['exec'](_0x7352('0x17a'),[_0x33ddae,_0xcd937f[_0x7352('0xed')],_0xcd937f[_0x7352('0x68')],_0x27e485,_0xcd937f['timeout'],_0xcd937f[_0x7352('0x8')],_0xcd937f[_0x7352('0x17b')],_0xcd937f['gosub'],'',_0xcd937f[_0x7352('0x17c')]]);if(_0x33cb34[_0x7352('0xaf')]===-0x1){return _0x33cb34;}return this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0xca'),_0x7352('0x17a'),_0x33ddae));};AGIVertices[_0x7352('0x19')]['record']=function(_0x45ac5c){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x17d'),_0x45ac5c['label']));var _0x4b4618=_0x45ac5c['recordingFormat']||_0x7352('0x13b');var _0x4406c1=util[_0x7352('0x2c')](_0x7352('0x17e'),this[_0x7352('0x10')][_0x7352('0x3c')],rs[_0x7352('0x126')](0x5));var _0x1dfb7c=util[_0x7352('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x4406c1,_0x4b4618);var _0x5c86af=util['format']('%s/recordings/%s',FILES_PATH,_0x4406c1);this['createSquareRecording'][_0x7352('0x74')](this,_0x45ac5c,_0x4406c1,_0x1dfb7c);this[_0x7352('0x10')][_0x7352('0xa2')](_0x7352('0x17f'),_0x4406c1);logger[_0x7352('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5c86af,_0x4b4618,_0x45ac5c[_0x7352('0x180')],_0x45ac5c[_0x7352('0x6a')]);return this[_0x7352('0x10')]['recordFile'](_0x5c86af,_0x4b4618,_0x45ac5c['escape_digits'],_0x45ac5c['timeout'],undefined,!![]);};AGIVertices[_0x7352('0x19')][_0x7352('0x181')]=function(_0x2d935e){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x182'),_0x2d935e[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x2d935e['url'])){return this['channel']['noop'](_0x7352('0x183'));}var _0xdf6de8=this[_0x7352('0x184')][_0x7352('0x74')](this,_0x2d935e);logger[_0x7352('0x32')](util['format'](_0x7352('0x185'),util[_0x7352('0x186')](_0xdf6de8,{'showHidden':![],'depth':null})));if(!this[_0x7352('0x8a')](_0x2d935e['variable_id'])){return this[_0x7352('0x10')]['noop'](_0x7352('0x187'));}var _0x3ad79f=this['getVariable']['sync'](this,_0x2d935e['variable_id']);if(!_0x3ad79f){return this[_0x7352('0x10')][_0x7352('0x30')](_0x2d935e,'no\x20variable\x20found');}this[_0x7352('0x10')]['setVariable'](util[_0x7352('0x2c')](_0x7352('0x188'),_0x3ad79f),_0xdf6de8[_0x7352('0x79')]?_0xdf6de8[_0x7352('0x79')]:_0x7352('0x189'));this[_0x7352('0x10')]['setVariable'](util[_0x7352('0x2c')]('%s_STATUS_MESSAGE',_0x3ad79f),_0xdf6de8[_0x7352('0x7a')]?_0xdf6de8[_0x7352('0x7a')]:'OK');if(_0xdf6de8[_0x7352('0x6e')]){try{this['saveRestApiResult'](_0xdf6de8[_0x7352('0x6e')],_0x3ad79f);}catch(_0x179a88){logger['error'](util[_0x7352('0x2c')](_0x7352('0x18a'),_0x3ad79f));}}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xe6'),_0x3ad79f));};AGIVertices[_0x7352('0x19')][_0x7352('0x18b')]=function(_0x535d5b){logger[_0x7352('0x32')](util['format'](_0x7352('0x18c'),_0x535d5b[_0x7352('0x3d')]));return this[_0x7352('0x10')][_0x7352('0x18d')](_0x535d5b[_0x7352('0x18e')][_0x7352('0x5b')](/\s+/g,''),_0x535d5b[_0x7352('0x180')]);};AGIVertices[_0x7352('0x19')][_0x7352('0x18f')]=function(_0x9522ea){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x190'),_0x9522ea[_0x7352('0x3d')]));return this[_0x7352('0x10')][_0x7352('0x191')](_0x9522ea[_0x7352('0x192')][_0x7352('0x5b')](/\s+/g,''),_0x9522ea['escape_digits']);};AGIVertices[_0x7352('0x19')][_0x7352('0x193')]=function(_0x105680){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x194'),_0x105680[_0x7352('0x3d')]));return this[_0x7352('0x10')][_0x7352('0x195')](_0x105680[_0x7352('0x5f')],_0x105680['escape_digits']);};AGIVertices[_0x7352('0x19')]['sendMail']=function(_0x181099){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x196'),_0x181099[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x181099['account_id'])){return this[_0x7352('0x10')][_0x7352('0xac')]('no\x20mail\x20account\x20configured');}var _0x4c84c7=this[_0x7352('0x25')]['sync'](this,_0x181099[_0x7352('0x197')]);if(!_0x4c84c7||!_0x4c84c7[_0x7352('0x198')]){return this['channel']['error'](_0x181099,_0x7352('0x199'));}var _0x53e773={'from':util[_0x7352('0x2c')]('\x22%s\x22\x20<%s>',_0x4c84c7['name'],_0x4c84c7[_0x7352('0x19a')]||_0x4c84c7[_0x7352('0x198')][_0x7352('0x19b')]),'to':_0x181099['to']||'','cc':_0x181099['cc']||'','bcc':_0x181099[_0x7352('0x19c')]||'','subject':_0x181099[_0x7352('0x19d')],'html':_0x181099[_0x7352('0x5f')],'text':_0x181099[_0x7352('0x5f')]};var _0xba26bc={'tls':{'rejectUnauthorized':![]}};if(_0x4c84c7[_0x7352('0x198')][_0x7352('0x19e')]){_0xba26bc[_0x7352('0x19e')]=_0x4c84c7[_0x7352('0x198')][_0x7352('0x19e')];}else{_0xba26bc[_0x7352('0x19f')]=_0x4c84c7[_0x7352('0x198')][_0x7352('0x19f')];_0xba26bc[_0x7352('0x1a0')]=_0x4c84c7[_0x7352('0x198')][_0x7352('0x1a0')];_0xba26bc[_0x7352('0x1a1')]=_0x4c84c7['Smtp'][_0x7352('0x1a1')];}if(_0x4c84c7[_0x7352('0x198')][_0x7352('0x1a2')]){_0xba26bc[_0x7352('0x1a3')]={'user':_0x4c84c7['Smtp'][_0x7352('0x19b')],'pass':_0x4c84c7['Smtp'][_0x7352('0x1a4')]};}if(this['isConfigured'](_0x181099[_0x7352('0x1a5')])){}logger[_0x7352('0xe8')](_0x7352('0x1a6'),JSON['stringify'](_0x53e773));this['createSquareDetailsReport']['sync'](this,_0x181099,_0x181099[_0x7352('0x197')]);this['channel'][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x1a7'),_0x4c84c7['name']));this[_0x7352('0x27')]['sync'](this,_0xba26bc,_0x53e773);return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x1a8'));};AGIVertices[_0x7352('0x19')][_0x7352('0x1a9')]=function(_0x4f2436){logger[_0x7352('0x32')](util[_0x7352('0x2c')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4f2436[_0x7352('0x3d')]));return this['channel'][_0x7352('0xac')](_0x7352('0x1aa'));};AGIVertices[_0x7352('0x19')]['sendSMS']=function(_0x5ea5fe){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x1ab'),_0x5ea5fe['label']));if(!this[_0x7352('0x8a')](_0x5ea5fe['sms_account_id'])){return this[_0x7352('0x10')][_0x7352('0xac')]('no\x20sms\x20account\x20configured');}var _0x4db86b=this[_0x7352('0x38')][_0x7352('0x74')](this,_0x5ea5fe[_0x7352('0x1ac')]);if(!_0x4db86b){return this[_0x7352('0x10')][_0x7352('0x30')](_0x5ea5fe,'no\x20sms\x20account\x20found');}var _0x45dae8={'body':_0x5ea5fe[_0x7352('0x1ad')],'phone':_0x5ea5fe['to']||'','SmsAccountId':_0x4db86b['id']};logger['debug'](_0x7352('0x1ae'),JSON[_0x7352('0x77')](_0x45dae8));this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x5ea5fe,_0x5ea5fe[_0x7352('0x1ac')]);this[_0x7352('0x10')]['noop'](util[_0x7352('0x2c')](_0x7352('0x1af'),_0x4db86b['name']));this[_0x7352('0x3a')]['sync'](this,_0x45dae8);return this['channel']['noop'](_0x7352('0x1b0'));};AGIVertices['prototype'][_0x7352('0x1b1')]=function(_0x4c3aa9){logger['info'](util['format'](_0x7352('0x1b2'),_0x4c3aa9[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x4c3aa9['variable_id'])){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4c3aa9,_0x7352('0x1b3'));}var _0x2c99bb=this['getVariable'][_0x7352('0x74')](this,_0x4c3aa9[_0x7352('0xe2')]);if(!_0x2c99bb){return this[_0x7352('0x10')][_0x7352('0x30')](_0x4c3aa9,_0x7352('0x122'));}return this['channel'][_0x7352('0xa2')](_0x2c99bb,_0x4c3aa9[_0x7352('0x1b4')]);};AGIVertices[_0x7352('0x19')][_0x7352('0x1b5')]=function(_0x25a0dd){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x1b6'),_0x25a0dd[_0x7352('0x3d')]));this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x1b7'));if(_0x25a0dd[_0x7352('0xbc')]===_0x7352('0x1b8')){this[_0x7352('0x10')][_0x7352('0xac')]('Answer');return this[_0x7352('0x10')][_0x7352('0xbc')]();}return this['channel'][_0x7352('0xac')](_0x7352('0x1b9'));};AGIVertices['prototype']['subproject']=function(_0x7425d3){logger[_0x7352('0x32')](util['format'](_0x7352('0x1ba'),_0x7425d3[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x7425d3['project_id'])){return this['channel'][_0x7352('0x30')](_0x7425d3,_0x7352('0x1bb'));}var _0x47c1cf=this[_0x7352('0x1a')]['sync'](this,_0x7425d3[_0x7352('0x1bc')]);if(!this[_0x7352('0x8a')](_0x47c1cf)){return this['channel'][_0x7352('0x30')](_0x7425d3,util[_0x7352('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x7425d3[_0x7352('0x1bc')]));}if(_0x47c1cf===this['channel'][_0x7352('0x3f')]){return this[_0x7352('0x10')][_0x7352('0x30')](_0x7425d3,_0x7352('0x1bd'));}this[_0x7352('0x3b')]['sync'](this,_0x7425d3,_0x47c1cf);var _0x361527=this[_0x7352('0x10')][_0x7352('0xae')](_0x7352('0x1be'),util['format'](_0x7352('0x1bf'),config[_0x7352('0x8')]['host']||_0x7352('0x1c0'),_0x47c1cf,this[_0x7352('0x10')][_0x7352('0x3f')]));if(_0x361527['result']===-0x1){return _0x361527;}return this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0xca'),_0x7352('0x1be'),_0x47c1cf));};AGIVertices[_0x7352('0x19')][_0x7352('0x1c1')]=function(_0x1e8fda){logger[_0x7352('0x32')](util[_0x7352('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1e8fda[_0x7352('0x3d')]));var _0x5d6643=this[_0x7352('0x1c2')][_0x7352('0x74')](this,_0x1e8fda[_0x7352('0xba')]);this[_0x7352('0x3b')][_0x7352('0x74')](this,_0x1e8fda,_0x1e8fda[_0x7352('0xba')]);if(this[_0x7352('0x8a')](_0x1e8fda[_0x7352('0xe2')])){var _0x2300fe=this[_0x7352('0x13')][_0x7352('0x74')](this,_0x1e8fda[_0x7352('0xe2')]);if(_0x2300fe){this[_0x7352('0x10')]['setVariable'](_0x2300fe,_0x5d6643);return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x1c3'),_0x1e8fda['command'],_0x2300fe));}}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x1c4'),_0x1e8fda[_0x7352('0xba')]));};AGIVertices[_0x7352('0x19')][_0x7352('0x1c5')]=function(_0x35fcfb){logger[_0x7352('0x32')](util[_0x7352('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x35fcfb[_0x7352('0x3d')]));_0x35fcfb[_0x7352('0x5f')]=_0x35fcfb['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7352('0x8a')](_0x35fcfb[_0x7352('0x5d')])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0x1c6'));}if(!this[_0x7352('0x8a')](_0x35fcfb[_0x7352('0x5f')])){return this[_0x7352('0x10')]['noop'](_0x7352('0xad'));}this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x1c7'),_0x35fcfb[_0x7352('0x5f')]));var _0x19b10a=this[_0x7352('0x5c')][_0x7352('0x74')](this,_0x35fcfb);if(_0x19b10a){this['channel'][_0x7352('0xac')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x19b10a));var _0x1da494=this['channel'][_0x7352('0x1c8')](_0x19b10a);try{fs[_0x7352('0x130')](_0x19b10a+_0x7352('0x131'));}catch(_0x2574ef){logger[_0x7352('0x30')](_0x2574ef);}return _0x1da494;}return this[_0x7352('0x10')][_0x7352('0x30')](_0x35fcfb,_0x7352('0x1c9'));};AGIVertices[_0x7352('0x19')][_0x7352('0x1ca')]=function(_0x2af0eb){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x1cb'),_0x2af0eb[_0x7352('0x3d')]));_0x2af0eb[_0x7352('0x5f')]=_0x2af0eb[_0x7352('0x5f')][_0x7352('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7352('0x8a')](_0x2af0eb['text'])){return this[_0x7352('0x10')][_0x7352('0xac')](_0x7352('0xad'));}this['channel']['noop'](util[_0x7352('0x2c')](_0x7352('0x1cc'),_0x2af0eb[_0x7352('0x5f')]));var _0x4b5b66=this[_0x7352('0x66')][_0x7352('0x74')](this,_0x2af0eb);if(_0x4b5b66){this[_0x7352('0x10')][_0x7352('0xac')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x4b5b66));var _0xb4b444=this[_0x7352('0x10')][_0x7352('0x1c8')](_0x4b5b66);try{fs['unlink'](_0x4b5b66+_0x7352('0x131'));}catch(_0x1d842d){logger['error'](_0x1d842d);}return _0xb4b444;}return this[_0x7352('0x10')][_0x7352('0x30')](_0x2af0eb,_0x7352('0x1cd'));};AGIVertices[_0x7352('0x19')][_0x7352('0x1ce')]=function(_0x142875){logger['info'](util[_0x7352('0x2c')](_0x7352('0x1cf'),_0x142875[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x142875[_0x7352('0x15f')])){return this['channel'][_0x7352('0x30')](_0x142875,'no\x20find\x20by\x20configured');}logger[_0x7352('0x32')](util[_0x7352('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7352('0x10')][_0x7352('0x40')],_0x142875[_0x7352('0x15f')]));var _0x4f4626=this['agentUnpause'][_0x7352('0x74')](this,_0x142875[_0x7352('0x15f')]);if(_0x4f4626){logger[_0x7352('0x32')](util[_0x7352('0x2c')](_0x7352('0x166'),this[_0x7352('0x10')][_0x7352('0x40')],_0x142875[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util['format'](_0x7352('0x166'),this['channel']['callerid'],_0x142875[_0x7352('0x15f')]));return{'code':0xc8,'result':_0x7352('0x162')};}else{logger[_0x7352('0x32')](util['format'](_0x7352('0x167'),this['channel'][_0x7352('0x40')],_0x142875[_0x7352('0x15f')]));this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0x167'),this['channel'][_0x7352('0x40')],_0x142875[_0x7352('0x15f')]));return{'code':0xc8,'result':_0x7352('0x163')};}};AGIVertices['prototype'][_0x7352('0x1d0')]=function(_0x5723ee){logger['info'](util[_0x7352('0x2c')](_0x7352('0x1d1'),_0x5723ee[_0x7352('0x3d')]));var _0x216e4b=this[_0x7352('0x10')][_0x7352('0xae')](_0x7352('0x1d2'),[_0x5723ee[_0x7352('0x1d3')],_0x5723ee['options']]);if(_0x216e4b[_0x7352('0xaf')]===-0x1){return _0x216e4b;}return this[_0x7352('0x10')][_0x7352('0xac')](util[_0x7352('0x2c')](_0x7352('0xca'),_0x7352('0x1d2'),_0x5723ee['mailbox']));};AGIVertices[_0x7352('0x19')][_0x7352('0x1d4')]=function(_0x52adb8){logger['info'](util[_0x7352('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x52adb8[_0x7352('0x3d')]));if(!this[_0x7352('0x8a')](_0x52adb8[_0x7352('0xe2')])){return this[_0x7352('0x10')]['error'](_0x52adb8,_0x7352('0x1b3'));}var _0x5962f2=this[_0x7352('0x13')]['sync'](this,_0x52adb8[_0x7352('0xe2')]);if(!_0x5962f2){return this['channel']['error'](_0x52adb8,'no\x20variable\x20found');}var _0x21613d=this['channel'][_0x7352('0x13')](_0x5962f2);return{'code':0xc8,'result':_0x21613d[_0x7352('0xa5')]?_0x21613d[_0x7352('0xa5')]:'-'};};String['prototype'][_0x7352('0xa4')]=function(_0x30cd48,_0x3da14a){return this[_0x7352('0xa3')](_0x30cd48)[_0x7352('0x1d5')](_0x3da14a);};module[_0x7352('0x1d6')]=AGIVertices; \ No newline at end of file +var _0xc0d7=['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)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','digit','no\x20variable\x20selected\x20for\x20the\x20result','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','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','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','prototype','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','toString','callback_priority','getPause','agent','agentPause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','getVariable','extra','result','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','bot','providerResponse','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition'];(function(_0x43d723,_0x1c7fa5){var _0x5af076=function(_0x4e6c04){while(--_0x4e6c04){_0x43d723['push'](_0x43d723['shift']());}};_0x5af076(++_0x1c7fa5);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x2cd3b4,_0x406152){_0x2cd3b4=_0x2cd3b4-0x0;var _0x402003=_0xc0d7[_0x2cd3b4];return _0x402003;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require('lodash');var sh=require(_0x7c0d('0x0'));var odbc=require(_0x7c0d('0x1'))();var rs=require(_0x7c0d('0x2'));var moment=require(_0x7c0d('0x3'));var Mustache=require(_0x7c0d('0x4'));var rp=require(_0x7c0d('0x5'));var logger=require(_0x7c0d('0x6'))(_0x7c0d('0x7'));var config=require(_0x7c0d('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x7c0d('0x9');var recursiveMapAttributes=[_0x7c0d('0xa'),_0x7c0d('0xb')];var verticesWithRetry=[_0x7c0d('0xc'),'getdigits',_0x7c0d('0xd')];var AGIVertices=function(_0x15d9ed,_0x230a6b,_0xfd38a0){this['channel']=_0x15d9ed;this[_0x7c0d('0xe')]=_0x230a6b;this[_0x7c0d('0xf')]=_0xfd38a0;};AGIVertices['prototype']['getVariable']=function(_0x190944,_0x27d25a){this['rpc'][_0x7c0d('0x10')](_0x190944)[_0x7c0d('0x11')](function(_0x31b829){_0x27d25a(null,_0x31b829?_0x31b829[_0x7c0d('0x12')]:![]);})[_0x7c0d('0x13')](function(_0x34dccf){_0x27d25a(_0x34dccf);});};AGIVertices['prototype'][_0x7c0d('0x14')]=function(_0x3d2a6b,_0x2ee593){this[_0x7c0d('0xe')][_0x7c0d('0x15')](_0x3d2a6b)[_0x7c0d('0x11')](function(_0x9c965b){_0x2ee593(null,_0x9c965b?_0x9c965b[_0x7c0d('0x12')]:![]);})['catch'](function(_0x340937){_0x2ee593(_0x340937);});};AGIVertices['prototype'][_0x7c0d('0x16')]=function(_0x571480,_0x2a8f3f){this[_0x7c0d('0xe')][_0x7c0d('0x17')](_0x571480)[_0x7c0d('0x11')](function(_0x2841e1){_0x2a8f3f(null,_0x2841e1?_0x2841e1[_0x7c0d('0x12')]:![]);})[_0x7c0d('0x13')](function(_0x1fb052){_0x2a8f3f(_0x1fb052);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x19')]=function(_0x111dbe,_0x2e3f30){this[_0x7c0d('0xe')][_0x7c0d('0x1a')](_0x111dbe)[_0x7c0d('0x11')](function(_0x12e19a){_0x2e3f30(null,_0x12e19a?_0x12e19a[_0x7c0d('0x1b')]:![]);})[_0x7c0d('0x13')](function(_0x1308c6){_0x2e3f30(_0x1308c6);});};AGIVertices['prototype']['getUser']=function(_0x5dae80,_0x54b14f){this['rpc'][_0x7c0d('0x1c')](_0x5dae80)[_0x7c0d('0x11')](function(_0x1c7b84){_0x54b14f(null,_0x1c7b84?_0x1c7b84[_0x7c0d('0x12')]:![]);})[_0x7c0d('0x13')](function(_0x2a92ce){_0x54b14f(_0x2a92ce);});};AGIVertices[_0x7c0d('0x18')]['getTrunk']=function(_0x42467f,_0xb7d5e4){this['rpc']['getTrunkById'](_0x42467f)[_0x7c0d('0x11')](function(_0x5a0d69){_0xb7d5e4(null,_0x5a0d69?_0x5a0d69[_0x7c0d('0x12')]:![]);})[_0x7c0d('0x13')](function(_0x43ba3b){_0xb7d5e4(_0x43ba3b);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x1d')]=function(_0x5ea868,_0x27fc36){var _0x197530=this;this[_0x7c0d('0xe')][_0x7c0d('0x1e')](_0x5ea868)[_0x7c0d('0x11')](function(_0x4aea76){_0x27fc36(null,_0x4aea76?_0x197530[_0x7c0d('0x1f')](_0x4aea76['save_name']):![]);})[_0x7c0d('0x13')](function(_0x1d2020){_0x27fc36(_0x1d2020);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x20')]=function(_0xb0e57e,_0x35284b){this['rpc'][_0x7c0d('0x21')](_0xb0e57e)['then'](function(_0x368e6f){_0x35284b(null,_0x368e6f?_0x368e6f:![]);})[_0x7c0d('0x13')](function(_0x51244b){_0x35284b(_0x51244b);});};AGIVertices['prototype'][_0x7c0d('0x22')]=function(_0x511009,_0x453b8f,_0x361105){this['mailRpc']['sendMailMessage'](_0x511009,_0x453b8f)['then'](function(){_0x361105(null);})['catch'](function(_0x181a8c){_0x361105(_0x181a8c);});};AGIVertices['prototype'][_0x7c0d('0x23')]=function(_0x2f9cbf,_0x55bc92){this[_0x7c0d('0xe')][_0x7c0d('0x24')](_0x2f9cbf)[_0x7c0d('0x11')](function(_0x196803){if(_0x196803){if(_0x196803['IntervalId']){_0x55bc92(null,[_0x196803[_0x7c0d('0x25')]]);}else{_0x55bc92(null,_[_0x7c0d('0x26')](_0x196803[_0x7c0d('0x27')],_0x7c0d('0x25')));}}else{_0x55bc92(null,![]);}})[_0x7c0d('0x13')](function(_0x6f2e1c){_0x55bc92(_0x6f2e1c);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x1f')]=function(_0x471ab1){return util[_0x7c0d('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x471ab1);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x29')]=function(_0x4880c9,_0x3ff97b,_0x142ad0){odbc[_0x7c0d('0x2a')](_0x4880c9,function(_0x1b723b){if(_0x1b723b){logger[_0x7c0d('0x2b')](_0x7c0d('0x2c'),_0x1b723b);_0x142ad0(_0x1b723b);}else{logger['info'](_0x7c0d('0x2d'));odbc[_0x7c0d('0x2e')](_0x3ff97b,function(_0x309f6b,_0xf06cef){if(_0x309f6b){logger[_0x7c0d('0x2f')]('Error\x20executing\x20query\x20%s',_0x3ff97b);_0x142ad0(_0x309f6b);}else{logger['info'](_0x7c0d('0x30'),_0x3ff97b);odbc[_0x7c0d('0x31')](function(_0x5c85b6){if(_0x5c85b6){logger[_0x7c0d('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5c85b6);}_0x142ad0(null,_0xf06cef);});}});}});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x32')]=function(_0x5a0d0c,_0x33ac68){this['rpc'][_0x7c0d('0x33')](_0x5a0d0c)[_0x7c0d('0x11')](function(_0x5f5ba2){_0x33ac68(null,_0x5f5ba2?_0x5f5ba2:![]);})['catch'](function(_0x5ca209){_0x33ac68(_0x5ca209);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x34')]=function(_0x1ff57c,_0x1a08e6){this['rpc']['createSmsMessage'](_0x1ff57c)[_0x7c0d('0x11')](function(_0x4bd8c3){_0x1a08e6(null,_0x4bd8c3);})['catch'](function(_0x420ecf){_0x1a08e6(_0x420ecf);});};AGIVertices['prototype'][_0x7c0d('0x35')]=function(_0x36aafb,_0x527e33,_0x28ef1a){this[_0x7c0d('0xe')][_0x7c0d('0x35')]({'uniqueid':this[_0x7c0d('0x36')][_0x7c0d('0x37')],'node':_0x36aafb['label'],'application':_0x36aafb[_0x7c0d('0x38')],'data':_0x527e33||null,'project_name':this[_0x7c0d('0x36')]['arg_1'],'callerid':this[_0x7c0d('0x36')][_0x7c0d('0x39')]})[_0x7c0d('0x11')](function(_0x23af20){if(_0x28ef1a){_0x28ef1a(null,_0x23af20);}})['catch'](function(_0x2f31df){if(_0x28ef1a){_0x28ef1a(_0x2f31df);}});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x3a')]=function(_0x6711ab,_0x2d881c,_0x5978b4,_0x4393d4){this['rpc'][_0x7c0d('0x3a')]({'uniqueid':this['channel'][_0x7c0d('0x37')],'callerid':this[_0x7c0d('0x36')][_0x7c0d('0x39')],'calleridname':this[_0x7c0d('0x36')][_0x7c0d('0x3b')],'context':this['channel'][_0x7c0d('0x3c')],'extension':this['channel'][_0x7c0d('0x3d')],'priority':this[_0x7c0d('0x36')][_0x7c0d('0x3e')],'accountcode':this['channel'][_0x7c0d('0x3f')],'dnid':this['channel']['dnid'],'projectName':this[_0x7c0d('0x36')][_0x7c0d('0x40')],'saveName':_0x2d881c,'filename':_0x6711ab[_0x7c0d('0x41')]||_0x2d881c,'savePath':_0x5978b4})['then'](function(_0x297223){_0x4393d4(null,_0x297223);})[_0x7c0d('0x13')](function(_0x37fc71){_0x4393d4(_0x37fc71);});};AGIVertices['prototype'][_0x7c0d('0x42')]=function(_0x1d95d9,_0x1d90e1,_0x2064d1,_0x2ae2fa,_0x5be7d5){this['rpc'][_0x7c0d('0x42')]({'uniqueid':this[_0x7c0d('0x36')]['uniqueid'],'body':_0x1d95d9,'direction':_0x1d90e1,'providerName':_0x2064d1,'providerResponse':_0x2ae2fa})['then'](function(_0x22ba30){if(_0x5be7d5){_0x5be7d5(null,_0x22ba30);}})[_0x7c0d('0x13')](function(_0x1e7f2e){if(_0x5be7d5){_0x5be7d5(_0x1e7f2e);}});};AGIVertices['prototype'][_0x7c0d('0x43')]=function(_0x1522e3,_0x12e84d){this[_0x7c0d('0xe')][_0x7c0d('0x43')]({'firstName':_[_0x7c0d('0x44')](_0x1522e3['name'])||_['isNil'](_0x1522e3[_0x7c0d('0x12')])?_0x7c0d('0x45')+Math[_0x7c0d('0x46')]():_0x1522e3['name'],'lastName':_[_0x7c0d('0x44')](_0x1522e3[_0x7c0d('0x47')])||_[_0x7c0d('0x48')](_0x1522e3[_0x7c0d('0x47')])?null:_0x1522e3['lastName'],'phone':_0x1522e3[_0x7c0d('0x49')],'ListId':_0x1522e3[_0x7c0d('0x4a')],'scheduledat':_0x1522e3[_0x7c0d('0x4b')],'callbackUniqueid':this[_0x7c0d('0x36')][_0x7c0d('0x37')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x1522e3[_0x7c0d('0x4b')][_0x7c0d('0x4c')](),'priority':_0x1522e3[_0x7c0d('0x4d')]})[_0x7c0d('0x11')](function(_0x215aed){_0x12e84d(null,_0x215aed);})['catch'](function(_0x1b8464){_0x12e84d(_0x1b8464);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x4e')]=function(_0x55efe6,_0x46ae19){this[_0x7c0d('0xe')]['getPauseById'](_0x55efe6)[_0x7c0d('0x11')](function(_0x446c20){_0x46ae19(null,_0x446c20?_0x446c20[_0x7c0d('0x12')]:![]);})[_0x7c0d('0x13')](function(_0x11ce01){_0x46ae19(_0x11ce01);});};AGIVertices['prototype']['agentPause']=function(_0x5bfc8d,_0xe7e80c,_0x51cb1c){var _0x432d5a={'role':_0x7c0d('0x4f')};_0x432d5a[_0x5bfc8d]=this[_0x7c0d('0x36')]['callerid'];this[_0x7c0d('0xe')][_0x7c0d('0x50')](_0x432d5a,_0xe7e80c,this[_0x7c0d('0x36')][_0x7c0d('0x37')])['then'](function(_0x83cb2){_0x51cb1c(null,_[_0x7c0d('0x48')](_0x83cb2)?![]:!![]);})[_0x7c0d('0x13')](function(_0x1756be){logger[_0x7c0d('0x2b')](_0x1756be);_0x51cb1c(null,![]);});};AGIVertices[_0x7c0d('0x18')]['agentUnpause']=function(_0x5ae654,_0x2630a5){var _0x18f2a3={'role':_0x7c0d('0x4f')};_0x18f2a3[_0x5ae654]=this['channel'][_0x7c0d('0x39')];this[_0x7c0d('0xe')]['agentUnpause'](_0x18f2a3)[_0x7c0d('0x11')](function(_0x3e3a2f){_0x2630a5(null,_[_0x7c0d('0x48')](_0x3e3a2f)?![]:!![]);})['catch'](function(_0x50a24b){logger[_0x7c0d('0x2b')](_0x50a24b);_0x2630a5(null,![]);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x51')]=function(_0x3bca19,_0x37a28f){var _0x3976bc={'role':_0x7c0d('0x4f')};_0x3976bc[_0x3bca19]=this[_0x7c0d('0x36')]['callerid'];this[_0x7c0d('0xe')][_0x7c0d('0x51')](_0x3976bc)['then'](function(_0x3e0f95){_0x37a28f(null,_['isNil'](_0x3e0f95)?![]:!![]);})[_0x7c0d('0x13')](function(_0x53a284){logger['error'](_0x53a284);_0x37a28f(null,![]);});};AGIVertices['prototype'][_0x7c0d('0x52')]=function(_0x231f0a,_0x34228d){var _0xa26bf={'role':_0x7c0d('0x4f')};_0xa26bf[_0x231f0a]=this['channel'][_0x7c0d('0x39')];var _0x5579a7=_0x231f0a!=_0x7c0d('0x53')?util[_0x7c0d('0x28')](_0x7c0d('0x54'),_0x7c0d('0x55'),this[_0x7c0d('0x36')][_0x7c0d('0x39')]):undefined;this['rpc']['agentLogin'](_0xa26bf,_0x5579a7)[_0x7c0d('0x11')](function(_0x57f81c){_0x34228d(null,_[_0x7c0d('0x48')](_0x57f81c)?![]:!![]);})[_0x7c0d('0x13')](function(_0x44af1c){logger[_0x7c0d('0x2b')](_0x44af1c);_0x34228d(null,![]);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x56')]=function(_0x4bd288,_0x1fe82d){sh['exec'](_[_0x7c0d('0x57')](_0x4bd288),function(_0x5e437d,_0x4a8c47){var _0x4ffa50=_0x4a8c47[_0x7c0d('0x58')](/(\r\n|\n|\r)/gm,'');_0x1fe82d(null,_0x4ffa50);});};AGIVertices['prototype'][_0x7c0d('0x59')]=function(_0x4430df,_0x300f4a){scripts[_0x7c0d('0x59')](_0x4430df[_0x7c0d('0x5a')],_0x4430df[_0x7c0d('0x5b')]||_0x7c0d('0x5c'),_0x4430df[_0x7c0d('0x5c')],_0x4430df['languageCode']||_0x7c0d('0x5d'),_0x4430df['ssmlGender']||_0x7c0d('0x5e'),_0x4430df[_0x7c0d('0x5f')]||_0x7c0d('0x60'))[_0x7c0d('0x11')](function(_0x50e798){_0x300f4a(null,_0x50e798);})[_0x7c0d('0x13')](function(_0x7da73){_0x300f4a(_0x7da73);});};AGIVertices['prototype'][_0x7c0d('0x61')]=function(_0x19afbf,_0xb405cf){scripts[_0x7c0d('0x61')](_0x19afbf[_0x7c0d('0x5c')],_0x19afbf[_0x7c0d('0x62')]||'en',0x1)['then'](function(_0x36ae79){_0xb405cf(null,_0x36ae79);})[_0x7c0d('0x13')](function(_0x3c2e91){_0xb405cf(_0x3c2e91);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x63')]=function(_0x474dd5,_0x198bb3){var _0x55c207={'uri':_0x474dd5[_0x7c0d('0x64')],'method':_0x474dd5['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x474dd5[_0x7c0d('0x65')])===_0x7c0d('0x66')&&parseInt(_0x474dd5[_0x7c0d('0x65')])>=0x1?parseInt(_0x474dd5[_0x7c0d('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x7c0d('0x67')]([_0x7c0d('0x68'),'PUT'],_0x55c207['method']['toUpperCase']())){try{_0x55c207[_0x7c0d('0x69')]=_0x474dd5['rawBody']?JSON['parse'](_0x474dd5[_0x7c0d('0xb')]):{};}catch(_0xc13ba0){logger[_0x7c0d('0x2b')](_0x7c0d('0x6a'),_0xc13ba0);}}try{_0x55c207[_0x7c0d('0x6b')]=_0x474dd5['rawHeaders']?JSON[_0x7c0d('0x6c')](_0x474dd5['rawHeaders']):{};}catch(_0x17b233){logger['error'](_0x7c0d('0x6d'),_0x17b233);}if(_0x474dd5['computedVariables']){try{var _0x284e1c=require(_0x474dd5[_0x7c0d('0x6e')])[_0x7c0d('0x6f')](this,_0x55c207);_0x55c207['uri']=Mustache[_0x7c0d('0x70')](_0x474dd5[_0x7c0d('0x64')],_0x284e1c,{},['$$','$$']);if(_0x55c207[_0x7c0d('0x6b')]){_0x55c207[_0x7c0d('0x6b')]=JSON[_0x7c0d('0x6c')](Mustache[_0x7c0d('0x70')](JSON[_0x7c0d('0x71')](_0x55c207['headers']),_0x284e1c,{},['$$','$$']));}if(_0x55c207['body']){_0x55c207['body']=JSON[_0x7c0d('0x6c')](Mustache[_0x7c0d('0x70')](JSON['stringify'](_0x55c207[_0x7c0d('0x69')]),_0x284e1c,{},['$$','$$']));}}catch(_0xea781e){logger[_0x7c0d('0x2b')](_0x7c0d('0x72'),_0xea781e);}}rp(_0x55c207)[_0x7c0d('0x11')](function(_0x5da6ca){var _0x5bc3ed={'statusCode':_0x5da6ca['statusCode']||0xc8,'statusMessage':_0x5da6ca[_0x7c0d('0x73')]||'OK','headers':_0x5da6ca['headers']||{},'body':_0x5da6ca[_0x7c0d('0x69')]||{}};_0x198bb3(null,_0x5bc3ed);})['catch'](function(_0x40df40){var _0x4db98f={'statusCode':_0x40df40['statusCode']||0x1f4,'statusMessage':_0x40df40[_0x7c0d('0x74')]||_0x7c0d('0x75'),'headers':_0x40df40[_0x7c0d('0x76')][_0x7c0d('0x6b')]||{},'body':_0x40df40[_0x7c0d('0x76')][_0x7c0d('0x69')]||{}};_0x198bb3(null,_0x4db98f);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x77')]=function(_0x12e853,_0x1a275e){scripts['googleDialogflow'](this['channel'][_0x7c0d('0x37')],_0x12e853[_0x7c0d('0x78')],_0x12e853['text'],_0x12e853[_0x7c0d('0x79')]||'en')['then'](function(_0x436f4e){_0x1a275e(null,_0x436f4e);})[_0x7c0d('0x13')](function(_0x376787){_0x1a275e(_0x376787);});};AGIVertices['prototype'][_0x7c0d('0x7a')]=function(_0x558445,_0x3065f){scripts[_0x7c0d('0x7a')](this['channel'][_0x7c0d('0x37')],_0x558445[_0x7c0d('0x7b')],_0x558445[_0x7c0d('0x7c')],_0x558445[_0x7c0d('0x7d')],_0x558445[_0x7c0d('0x5c')],_0x558445['dialogflowV2_language']||'en')[_0x7c0d('0x11')](function(_0x53ec45){_0x3065f(null,_0x53ec45);})[_0x7c0d('0x13')](function(_0x5d9741){_0x3065f(_0x5d9741);});};AGIVertices['prototype'][_0x7c0d('0x7e')]=function(_0x555277,_0x5ea23c){scripts[_0x7c0d('0x7e')](this[_0x7c0d('0x36')],_0x555277)['then'](function(_0x42c0e7){_0x5ea23c(null,_0x42c0e7);})[_0x7c0d('0x13')](function(_0x1f530a){_0x5ea23c(_0x1f530a);});};AGIVertices[_0x7c0d('0x18')]['ispeechTTS']=function(_0x1f89d7,_0x67f985){scripts[_0x7c0d('0x7f')](_0x1f89d7[_0x7c0d('0x78')],_0x1f89d7[_0x7c0d('0x5c')],_0x1f89d7[_0x7c0d('0x80')]||_0x7c0d('0x5d'),_0x1f89d7['speed'])[_0x7c0d('0x11')](function(_0x5eba52){_0x67f985(null,_0x5eba52);})[_0x7c0d('0x13')](function(_0x1732ca){_0x67f985(_0x1732ca);});};AGIVertices['prototype'][_0x7c0d('0x81')]=function(_0xe85af1,_0x26eec3,_0x21ec81){scripts[_0x7c0d('0x81')](_0x26eec3,_0xe85af1[_0x7c0d('0x78')],_0xe85af1['ispeech_asr_language']||_0x7c0d('0x5d'),this[_0x7c0d('0x82')](_0xe85af1[_0x7c0d('0x83')])?_0xe85af1[_0x7c0d('0x83')]:undefined)[_0x7c0d('0x11')](function(_0x5d605e){_0x21ec81(null,_0x5d605e);})[_0x7c0d('0x13')](function(_0x5d31f4){_0x21ec81(_0x5d31f4);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x84')]=function(_0x2b1380,_0x4a233a){scripts['awsPolly'](_0x2b1380[_0x7c0d('0x85')],_0x2b1380['aws_secret_access_key'],_0x2b1380['aws_polly_region'],_0x2b1380['aws_polly_voice']||_0x7c0d('0x86'),_0x2b1380[_0x7c0d('0x5c')],_0x2b1380[_0x7c0d('0x87')]||'text')[_0x7c0d('0x11')](function(_0x4f7a5e){_0x4a233a(null,_0x4f7a5e);})[_0x7c0d('0x13')](function(_0x20e260){_0x4a233a(_0x20e260);});};AGIVertices['prototype'][_0x7c0d('0x88')]=function(_0x2c52a1,_0x1ae2b8){scripts[_0x7c0d('0x88')](this[_0x7c0d('0x36')][_0x7c0d('0x37')],_0x2c52a1[_0x7c0d('0x85')],_0x2c52a1[_0x7c0d('0x89')],_0x2c52a1[_0x7c0d('0x8a')],_0x2c52a1[_0x7c0d('0x5c')],_0x2c52a1[_0x7c0d('0x8b')])['then'](function(_0x94efbe){_0x1ae2b8(null,_0x94efbe);})[_0x7c0d('0x13')](function(_0x35022d){_0x1ae2b8(_0x35022d);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x8c')]=function(_0x4817ec,_0xc9b325,_0x235a35){scripts[_0x7c0d('0x8c')](_0xc9b325,_0x4817ec[_0x7c0d('0x78')],_0x4817ec[_0x7c0d('0x8d')]||_0x7c0d('0x5d'))[_0x7c0d('0x11')](function(_0x38f53d){_0x235a35(null,_0x38f53d);})[_0x7c0d('0x13')](function(_0x2059fa){_0x235a35(_0x2059fa);});};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x8e')]=function(_0x1ac43d,_0xb8594f,_0x9c4450){scripts['tildeASR'](_0xb8594f,_0x1ac43d['appid'],_0x1ac43d[_0x7c0d('0x8f')],_0x1ac43d[_0x7c0d('0x90')])[_0x7c0d('0x11')](function(_0x445bac){_0x9c4450(null,_0x445bac);})[_0x7c0d('0x13')](function(_0x15f846){_0x9c4450(_0x15f846);});};AGIVertices[_0x7c0d('0x18')]['clear']=function(_0x58f65d){var _0x201a96=_['includes'](verticesWithRetry,_0x58f65d[_0x7c0d('0x38')])?_0x58f65d:_[_0x7c0d('0x91')](_0x58f65d);for(var _0x95a03e in _0x201a96){if(_0x201a96[_0x7c0d('0x92')](_0x95a03e)){if(_0x201a96[_0x95a03e]&&_['isString'](_0x201a96[_0x95a03e])){if(_[_0x7c0d('0x67')](recursiveMapAttributes,_0x95a03e)){_0x201a96[_0x95a03e]=this['replaceObjectAllVariables'](_0x201a96[_0x95a03e]);}else{_0x201a96[_0x95a03e]=this[_0x7c0d('0x93')](_0x201a96[_0x95a03e]);}}}}return _0x201a96;};AGIVertices['prototype'][_0x7c0d('0x94')]=function(_0x51515f){for(var _0x19d192 in _0x51515f){if(_0x51515f[_0x7c0d('0x92')](_0x19d192)){if(_['isPlainObject'](_0x51515f[_0x19d192])){this[_0x7c0d('0x94')](_0x51515f[_0x19d192]);}else if(_[_0x7c0d('0x95')](_0x51515f[_0x19d192])){for(var _0x5c0737=0x0;_0x5c0737<_0x51515f[_0x19d192][_0x7c0d('0x96')];_0x5c0737++){this['recursiveNodeIndex'](_0x51515f[_0x19d192][_0x5c0737]);}}else if(_[_0x7c0d('0x97')](_0x51515f[_0x19d192])){_0x51515f[_0x19d192]=this[_0x7c0d('0x93')](_0x51515f[_0x19d192]);}}}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x98')]=function(_0x3266c2,_0x984cac){for(var _0x158fed in _0x3266c2){if(_0x3266c2[_0x7c0d('0x92')](_0x158fed)){if(_['isPlainObject'](_0x3266c2[_0x158fed])){if(!_[_0x7c0d('0x44')](_0x3266c2[_0x158fed])){this[_0x7c0d('0x98')](_0x3266c2[_0x158fed],util[_0x7c0d('0x28')]('%s.%s',_0x984cac,_0x158fed));}}else if(_[_0x7c0d('0x95')](_0x3266c2[_0x158fed])){for(var _0x4b73ad=0x0;_0x4b73ad<_0x3266c2[_0x158fed][_0x7c0d('0x96')];_0x4b73ad++){this['saveRestApiResult'](_0x3266c2[_0x158fed][_0x4b73ad],util[_0x7c0d('0x28')](_0x7c0d('0x99'),_0x984cac,_0x158fed+'['+_0x4b73ad+']'));}}else{if(!_[_0x7c0d('0x48')](_0x3266c2[_0x158fed])){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util[_0x7c0d('0x28')](_0x7c0d('0x99'),_0x984cac,_0x158fed),_0x3266c2[_0x158fed]);}}}}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x9b')]=function(_0x43face){try{var _0x4162e7=JSON[_0x7c0d('0x6c')](_0x43face);this[_0x7c0d('0x94')](_0x4162e7);return JSON[_0x7c0d('0x71')](_0x4162e7);}catch(_0x53cdc3){return this[_0x7c0d('0x93')](_0x43face);}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x93')]=function(_0x44691e){var _0x58256e=_0x44691e[_0x7c0d('0x9c')]('{');for(var _0x4a03a8=0x1;_0x4a03a8<_0x58256e['length'];_0x4a03a8+=0x1){var _0x14079f=_0x58256e[_0x4a03a8]['split']('}');if(_0x14079f[_0x7c0d('0x96')]>0x1){_0x44691e=_0x44691e[_0x7c0d('0x9d')]('{'+_0x14079f[0x0]+'}',this[_0x7c0d('0x36')][_0x7c0d('0x9e')](_0x14079f[0x0])[_0x7c0d('0x9f')]||_0x14079f[0x0]);}}if(_0x58256e[_0x7c0d('0x96')]===0x1){return _0x44691e[_0x7c0d('0x4c')]();}return this['replaceAllVariables'](_0x44691e);};AGIVertices[_0x7c0d('0x18')]['getAndSetVariable']=function(_0x21e5d2,_0x3b114f){var _0x3144e1=this[_0x7c0d('0x36')][_0x7c0d('0x9e')](_0x21e5d2);if(_0x3144e1[_0x7c0d('0xa0')]===-0x1){return _0x3144e1;}logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3b114f,_0x3144e1['extra']));return this['channel'][_0x7c0d('0x9a')](_0x3b114f,_0x3144e1['extra']);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x82')]=function(_0x544b27){return _0x544b27&&_0x544b27!=='0'&&_0x544b27!=='-1'&&_0x544b27!=='';};AGIVertices[_0x7c0d('0x18')]['maxRetry']=function(_0x49d7ee){this[_0x7c0d('0x35')][_0x7c0d('0x6f')](this,_0x49d7ee,'-');_0x49d7ee[_0x7c0d('0xa1')]=_0x49d7ee[_0x7c0d('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xa3')]=function(_0x5355e8){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0xa4'),_0x5355e8[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x5355e8[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xa7'));}var _0x32f719='\x22'+_0x5355e8['text']+'\x22';if(this[_0x7c0d('0x82')](_0x5355e8[_0x7c0d('0x76')])){_0x32f719+=','+_0x5355e8[_0x7c0d('0x76')];}var _0x56c61b=this['channel'][_0x7c0d('0xa8')](_0x7c0d('0xa9'),_0x32f719);if(_0x56c61b[_0x7c0d('0xa0')]===-0x1){return _0x56c61b;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x32f719));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xaa')]=function(_0x45e382){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xab'),_0x45e382['label']));if(!this['isConfigured'](_0x45e382[_0x7c0d('0xac')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xad'));}var _0x286662=_0x45e382[_0x7c0d('0xac')];if(this[_0x7c0d('0x82')](_0x45e382['options'])){_0x286662+=','+_0x45e382[_0x7c0d('0x76')];}var _0x563d3b=this[_0x7c0d('0x36')][_0x7c0d('0xa8')](_0x7c0d('0xae'),_0x286662);if(_0x563d3b['result']===-0x1){return _0x563d3b;}var _0x4c0167=this['getAndSetVariable'](_0x7c0d('0xaf'),_0x7c0d('0xb0'));if(_0x4c0167[_0x7c0d('0xa0')]===-0x1){return _0x4c0167;}var _0x28676f=this[_0x7c0d('0xb1')](_0x7c0d('0xb2'),_0x7c0d('0xb3'));if(_0x28676f[_0x7c0d('0xa0')]===-0x1){return _0x28676f;}var _0x2d316f=this['getAndSetVariable'](_0x7c0d('0xb4'),_0x7c0d('0xb5'));if(_0x2d316f[_0x7c0d('0xa0')]===-0x1){return _0x2d316f;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xb6'),_0x286662));};AGIVertices['prototype'][_0x7c0d('0x7')]=function(_0x4676de){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0xb7'),_0x4676de[_0x7c0d('0xa5')]));return this[_0x7c0d('0x36')][_0x7c0d('0x7')]([_0x4676de[_0x7c0d('0xb8')],_0x4676de[_0x7c0d('0xb9')]]);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xba')]=function(_0x4bbfcb){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4bbfcb[_0x7c0d('0xa5')]));if(this[_0x7c0d('0x82')](_0x4bbfcb[_0x7c0d('0x65')])){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xbb'),_0x4bbfcb['timeout']));var _0x25ec5d=this[_0x7c0d('0x36')][_0x7c0d('0xbc')](_0x4bbfcb[_0x7c0d('0x65')]);if(_0x25ec5d[_0x7c0d('0xa0')]===-0x1){return _0x25ec5d;}}return this[_0x7c0d('0x36')][_0x7c0d('0xba')]();};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xbd')]=function(_0x45ad45){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0xbe'),_0x45ad45[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x45ad45[_0x7c0d('0x4a')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x45ad45,_0x7c0d('0xbf'));}_0x45ad45[_0x7c0d('0x4b')]=moment();if(this[_0x7c0d('0x82')](_0x45ad45['delay'])){_0x45ad45[_0x7c0d('0x4b')]=moment()['add'](_0x45ad45[_0x7c0d('0xc0')],_0x7c0d('0xc1'));}if(!this[_0x7c0d('0x82')](_0x45ad45[_0x7c0d('0x4d')])){_0x45ad45[_0x7c0d('0x4d')]=0x2;}this[_0x7c0d('0x43')][_0x7c0d('0x6f')](this,_0x45ad45);return this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x45ad45['phone'],_0x45ad45['list_id'],_0x45ad45['scheduledAt']));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xc2')]=function(_0x122871){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xc3'),_0x122871[_0x7c0d('0xa5')]));var _0x396cbb=this[_0x7c0d('0x36')][_0x7c0d('0xa8')](_0x122871[_0x7c0d('0xc4')],_0x122871[_0x7c0d('0x76')]);if(_0x396cbb['result']===-0x1){return _0x396cbb;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xc5'),_0x122871[_0x7c0d('0xc4')],_0x122871[_0x7c0d('0x76')]));};AGIVertices[_0x7c0d('0x18')]['lumenvoxtts']=function(_0xf2f91e){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xf2f91e[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0xf2f91e[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')]['noop']('no\x20text\x20configured');}var _0x47b3ee='\x22'+_0xf2f91e[_0x7c0d('0x5c')]+'\x22';if(this[_0x7c0d('0x82')](_0xf2f91e['options'])){_0x47b3ee+=','+_0xf2f91e['options'];}var _0x4ce059=this['channel'][_0x7c0d('0xa8')](_0x7c0d('0xa9'),_0x47b3ee);if(_0x4ce059['result']===-0x1){return _0x4ce059;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xc6'),_0x47b3ee));};AGIVertices['prototype'][_0x7c0d('0xc7')]=function(_0x2f2c94){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xc8'),_0x2f2c94[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x2f2c94[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0xa7'));}var _0x955a88='\x22'+_0x2f2c94['text']+'\x22';if(this[_0x7c0d('0x82')](_0x2f2c94[_0x7c0d('0x76')])){_0x955a88+=','+_0x2f2c94[_0x7c0d('0x76')];}var _0x3b7a03=this[_0x7c0d('0x36')][_0x7c0d('0xa8')]('MRCPSynth',_0x955a88);if(_0x3b7a03[_0x7c0d('0xa0')]===-0x1){return _0x3b7a03;}return this['channel'][_0x7c0d('0xa6')](util['format'](_0x7c0d('0xc6'),_0x955a88));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xc9')]=function(_0x5d1d66){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5d1d66['label']));if(!this[_0x7c0d('0x82')](_0x5d1d66[_0x7c0d('0xac')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xad'));}var _0x1a9abf=_0x5d1d66[_0x7c0d('0xac')];if(this[_0x7c0d('0x82')](_0x5d1d66['options'])){_0x1a9abf+=','+_0x5d1d66[_0x7c0d('0x76')];}var _0x1f7cff=this[_0x7c0d('0x36')][_0x7c0d('0xa8')](_0x7c0d('0xae'),_0x1a9abf);if(_0x1f7cff[_0x7c0d('0xa0')]===-0x1){return _0x1f7cff;}var _0x51a2cd=this[_0x7c0d('0xb1')](_0x7c0d('0xaf'),_0x7c0d('0xca'));if(_0x51a2cd['result']===-0x1){return _0x51a2cd;}var _0x8de5d5=this[_0x7c0d('0xb1')](_0x7c0d('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x8de5d5['result']===-0x1){return _0x8de5d5;}var _0x3b83cc=this[_0x7c0d('0xb1')](_0x7c0d('0xb4'),_0x7c0d('0xcb'));if(_0x3b83cc[_0x7c0d('0xa0')]===-0x1){return _0x3b83cc;}return this['channel'][_0x7c0d('0xa6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1a9abf));};AGIVertices['prototype']['sestekasr']=function(_0x45cdf6){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x45cdf6[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x45cdf6[_0x7c0d('0xac')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xad'));}var _0xb8ee48=_0x45cdf6['grammar'];if(this[_0x7c0d('0x82')](_0x45cdf6[_0x7c0d('0x76')])){_0xb8ee48+=','+_0x45cdf6[_0x7c0d('0x76')];}var _0x306831=this[_0x7c0d('0x36')][_0x7c0d('0xa8')](_0x7c0d('0xae'),_0xb8ee48);if(_0x306831[_0x7c0d('0xa0')]===-0x1){return _0x306831;}var _0x4d1886=this[_0x7c0d('0xb1')]('RECOG_CONFIDENCE()',_0x7c0d('0xcc'));if(_0x4d1886[_0x7c0d('0xa0')]===-0x1){return _0x4d1886;}var _0x6a8008=this[_0x7c0d('0xb1')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x6a8008[_0x7c0d('0xa0')]===-0x1){return _0x6a8008;}var _0x14f145=this[_0x7c0d('0xb1')](_0x7c0d('0xb4'),_0x7c0d('0xcd'));if(_0x14f145[_0x7c0d('0xa0')]===-0x1){return _0x14f145;}return this['channel'][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xb6'),_0xb8ee48));};AGIVertices[_0x7c0d('0x18')]['database']=function(_0x4c26eb){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xce'),_0x4c26eb['label']));if(!this[_0x7c0d('0x82')](_0x4c26eb[_0x7c0d('0xcf')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4c26eb,_0x7c0d('0xd0'));}var _0xe01b30=this[_0x7c0d('0x19')][_0x7c0d('0x6f')](this,_0x4c26eb[_0x7c0d('0xcf')]);if(!_0xe01b30){return this['channel'][_0x7c0d('0x2b')](_0x4c26eb,_0x7c0d('0xd1'));}if(!this['isConfigured'](_0x4c26eb[_0x7c0d('0x2e')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4c26eb,_0x7c0d('0xd2'));}var _0x5bc8cb=_0x4c26eb['query'][_0x7c0d('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('query:\x20%s',_0x5bc8cb));var _0x4ff913=this[_0x7c0d('0x29')][_0x7c0d('0x6f')](this,_0xe01b30,_0x5bc8cb);this['createSquareDetailsReport'][_0x7c0d('0x6f')](this,_0x4c26eb,_0x5bc8cb);if(!this['isConfigured'](_0x4c26eb[_0x7c0d('0xd3')])){return this['channel'][_0x7c0d('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x106cb3=this[_0x7c0d('0x9e')]['sync'](this,_0x4c26eb[_0x7c0d('0xd3')]);if(!_0x106cb3){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4c26eb,_0x7c0d('0xd4'));}var _0x3fcaf1=this;_0x4ff913[_0x7c0d('0xd5')](function(_0x15886c,_0x3c3c25){Object[_0x7c0d('0xd6')](_0x15886c)['forEach'](function(_0x51729e){_0x3fcaf1['channel'][_0x7c0d('0x9a')](util[_0x7c0d('0x28')]('%s[%s][%s]',_0x106cb3,_0x3c3c25,_0x51729e),_0x15886c[_0x51729e]);});});this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util[_0x7c0d('0x28')](_0x7c0d('0xd7'),_0x106cb3),_0x4ff913[_0x7c0d('0x96')]);return this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')]('variable\x20%s\x20set',_0x106cb3));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xd8')]=function(_0x3830ce){logger[_0x7c0d('0xd9')](util['format'](_0x7c0d('0xda'),_0x3830ce[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x3830ce[_0x7c0d('0xdb')])){return this[_0x7c0d('0x36')]['error'](_0x3830ce,_0x7c0d('0xdc'));}var _0x1c43d8=this[_0x7c0d('0xdd')]['sync'](this,_0x3830ce[_0x7c0d('0xdb')]);if(!_0x1c43d8){return this[_0x7c0d('0x36')]['error'](_0x3830ce,_0x7c0d('0xde'));}var _0x200f85=this[_0x7c0d('0x36')][_0x7c0d('0xa8')]('DIAL',[util[_0x7c0d('0x28')](_0x7c0d('0xdf'),_0x1c43d8),_0x3830ce[_0x7c0d('0x65')],_0x3830ce[_0x7c0d('0xe0')],_0x3830ce[_0x7c0d('0x64')]]);if(_0x200f85[_0x7c0d('0xa0')]===-0x1){return _0x200f85;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format'](_0x7c0d('0xe1'),_0x7c0d('0xe2')));};AGIVertices['prototype'][_0x7c0d('0xe3')]=function(_0x335b86){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xe4'),_0x335b86[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x335b86[_0x7c0d('0x78')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xe5'));}if(!this[_0x7c0d('0x82')](_0x335b86[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xa7'));}this[_0x7c0d('0x36')]['bot']=!![];this[_0x7c0d('0x35')](_0x335b86);this[_0x7c0d('0x42')](_0x335b86[_0x7c0d('0x5c')],'in','','');this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format'](_0x7c0d('0xe6'),_0x335b86['text']));var _0x29ee36=this[_0x7c0d('0x77')][_0x7c0d('0x6f')](this,_0x335b86);if(_0x29ee36){for(var _0x585e19 in _0x29ee36){if(_0x29ee36[_0x7c0d('0x92')](_0x585e19)){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util[_0x7c0d('0x28')](_0x7c0d('0xe7'),_0x585e19[_0x7c0d('0xe8')]()),_0x29ee36[_0x585e19]);}}this[_0x7c0d('0x42')](_0x29ee36[_0x7c0d('0xe9')],_0x7c0d('0xea'),_0x7c0d('0xe3'),'');return this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')]('Dialogflow\x20Result\x20%s',_0x29ee36[_0x7c0d('0xe9')]));}return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x335b86,_0x7c0d('0xeb'));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xec')]=function(_0x5926c1){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0xed'),_0x5926c1['label']));if(!this[_0x7c0d('0x82')](_0x5926c1['dialogflowV2_project_id'])){return this['channel']['noop'](_0x7c0d('0xee'));}if(!this[_0x7c0d('0x82')](_0x5926c1[_0x7c0d('0x7c')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xef'));}if(!this[_0x7c0d('0x82')](_0x5926c1[_0x7c0d('0x7d')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0xf0'));}if(!this['isConfigured'](_0x5926c1[_0x7c0d('0xf1')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('no\x20anguage\x20configured');}if(!this[_0x7c0d('0x82')](_0x5926c1[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0xa7'));}this['channel'][_0x7c0d('0xf2')]=!![];this[_0x7c0d('0x35')](_0x5926c1);this[_0x7c0d('0x42')](_0x5926c1[_0x7c0d('0x5c')],'in','','');this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x5926c1['text']));var _0x421520=this[_0x7c0d('0x7a')]['sync'](this,_0x5926c1);if(_0x421520){for(var _0x975773 in _0x421520){if(_0x421520[_0x7c0d('0x92')](_0x975773)){if(_0x975773!==_0x7c0d('0xf3')){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util['format'](_0x7c0d('0xe7'),_0x975773[_0x7c0d('0xe8')]()),_0x421520[_0x975773]);}}}this[_0x7c0d('0x42')](_0x421520[_0x7c0d('0xe9')],_0x7c0d('0xea'),_0x7c0d('0xec'),_0x421520[_0x7c0d('0xf3')]);return this['channel'][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('DialogflowV2\x20Result\x20%s',_0x421520[_0x7c0d('0xe9')]));}return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x5926c1,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xf4')]=function(_0x32a665){logger[_0x7c0d('0x2f')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x32a665['label']));if(!this[_0x7c0d('0x82')](_0x32a665[_0x7c0d('0xf5')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xf6'));}if(!this[_0x7c0d('0x82')](_0x32a665[_0x7c0d('0xf7')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xf8'));}if(!this[_0x7c0d('0x82')](_0x32a665['password'])){return this['channel'][_0x7c0d('0xa6')](_0x7c0d('0xf9'));}if(!this[_0x7c0d('0x82')](_0x32a665[_0x7c0d('0xfa')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('no\x20text\x20configured');}this[_0x7c0d('0x36')][_0x7c0d('0xf2')]=!![];this[_0x7c0d('0x35')](_0x32a665);this[_0x7c0d('0x42')](_0x32a665[_0x7c0d('0x5c')],'in','','');this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xfb'),_0x32a665[_0x7c0d('0x5c')]));var _0x5c2b96=this[_0x7c0d('0x7e')][_0x7c0d('0x6f')](this,_0x32a665);if(_0x5c2b96){for(var _0x3254ae in _0x5c2b96){if(_0x5c2b96[_0x7c0d('0x92')](_0x3254ae)){this[_0x7c0d('0x36')]['setVariable'](util['format'](_0x7c0d('0xfc'),_0x3254ae[_0x7c0d('0xe8')]()),_0x5c2b96[_0x3254ae]);}}this[_0x7c0d('0x42')](_0x5c2b96[_0x7c0d('0xe9')],_0x7c0d('0xea'),_0x7c0d('0xf4'),'');if(_0x5c2b96[_0x7c0d('0xfd')]){this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xfe'),_0x5c2b96[_0x7c0d('0xfd')]));var _0x43ffa9=this[_0x7c0d('0x36')][_0x7c0d('0xff')](_0x5c2b96['audiofile']);try{fs[_0x7c0d('0x100')](_0x5c2b96['audiofile']+_0x7c0d('0x101'));}catch(_0x3e198f){logger[_0x7c0d('0x2b')](_0x3e198f);}return _0x43ffa9;}else{return this['channel']['noop'](util[_0x7c0d('0x28')](_0x7c0d('0x102'),_0x5c2b96[_0x7c0d('0xe9')]));}}return this['channel'][_0x7c0d('0x2b')](_0x32a665,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x103')]=function(_0x5714f2){logger[_0x7c0d('0x2f')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x5714f2[_0x7c0d('0xa5')]));return this['channel'][_0x7c0d('0xa6')](_0x7c0d('0x103'));};AGIVertices['prototype'][_0x7c0d('0x104')]=function(_0x30dea4){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x105'),_0x30dea4[_0x7c0d('0xa5')]));var _0xba0e0c='';if(_0x30dea4[_0x7c0d('0x106')]){if(!this[_0x7c0d('0x82')](_0x30dea4[_0x7c0d('0x106')])){return this['channel'][_0x7c0d('0x2b')](_0x30dea4,_0x7c0d('0x107'));}else{var _0x349ea6=parseInt(_0x30dea4[_0x7c0d('0x106')],0xa);if(isNaN(_0x349ea6)){_0xba0e0c=_0x30dea4[_0x7c0d('0x106')];}else{_0xba0e0c=this['getTrunk'][_0x7c0d('0x6f')](this,_0x30dea4[_0x7c0d('0x106')]);if(!_0xba0e0c){return this['channel'][_0x7c0d('0x2b')](_0x30dea4,_0x7c0d('0x108'));}}}}else if(_0x30dea4['trunk_name']){_0xba0e0c=_0x30dea4[_0x7c0d('0x109')];}else{return this[_0x7c0d('0x36')]['error'](_0x30dea4,'no\x20trunk\x20selected');}var _0x55f958=this['channel'][_0x7c0d('0xa8')](_0x7c0d('0xe2'),[util['format']('SIP/%s/%s',_0xba0e0c,_0x30dea4[_0x7c0d('0x49')]),_0x30dea4[_0x7c0d('0x65')],_0x30dea4['opts'],_0x30dea4[_0x7c0d('0x64')]]);if(_0x55f958[_0x7c0d('0xa0')]===-0x1){return _0x55f958;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('Executed\x20command\x20%s',_0x7c0d('0xe2')));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x10a')]=function(_0x483a21){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x10b'),_0x483a21[_0x7c0d('0xa5')]));return this['channel'][_0x7c0d('0xa6')](_0x7c0d('0x10a'));};AGIVertices[_0x7c0d('0x18')]['getdigits']=function(_0x26f14c){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x10c'),_0x26f14c[_0x7c0d('0xa5')]));if(_0x26f14c[_0x7c0d('0xa1')]===0x0){return this['maxRetry'](_0x26f14c);}_0x26f14c[_0x7c0d('0xa1')]-=0x1;if(!this[_0x7c0d('0x82')](_0x26f14c[_0x7c0d('0x10d')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x26f14c,_0x7c0d('0x10e'));}var _0x503bde=this[_0x7c0d('0x1d')]['sync'](this,_0x26f14c[_0x7c0d('0x10d')]);if(!_0x503bde){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x26f14c,_0x7c0d('0x10f'));}if(!this[_0x7c0d('0x82')](_0x26f14c[_0x7c0d('0xd3')])){return this['channel'][_0x7c0d('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1d638d=this['channel'][_0x7c0d('0x110')](_0x503bde,_0x26f14c[_0x7c0d('0x111')],_0x26f14c[_0x7c0d('0x112')]);var _0x3ce4a4=_0x1d638d[_0x7c0d('0xa0')]?_0x1d638d[_0x7c0d('0xa0')]['toString']():'';logger[_0x7c0d('0x2f')](_0x7c0d('0x113'),JSON[_0x7c0d('0x71')](_0x1d638d));if(_0x1d638d[_0x7c0d('0xa0')]===-0x1){this[_0x7c0d('0x35')][_0x7c0d('0x6f')](this,_0x26f14c,_0x3ce4a4);return _0x1d638d;}else if(_0x1d638d[_0x7c0d('0x9f')]===_0x7c0d('0x65')){_0x1d638d[_0x7c0d('0xa0')]=_0x3ce4a4[_0x7c0d('0x96')]>=parseInt(_0x26f14c[_0x7c0d('0x114')])?'x':'i';}else{_0x1d638d[_0x7c0d('0xa0')]=_0x3ce4a4[_0x7c0d('0x96')]>=parseInt(_0x26f14c[_0x7c0d('0x114')])&&_0x3ce4a4['length']<=parseInt(_0x26f14c[_0x7c0d('0x112')])?'x':'i';}var _0x349bdd=this[_0x7c0d('0x9e')]['sync'](this,_0x26f14c['variable_id']);if(!_0x349bdd){return this[_0x7c0d('0x36')]['error'](_0x26f14c,_0x7c0d('0xd4'));}this[_0x7c0d('0x36')]['setVariable'](_0x349bdd,_0x3ce4a4);if(this[_0x7c0d('0x82')](_0x26f14c[_0x7c0d('0x115')])){var _0x1949e4=parseInt(_0x26f14c['hiddendigitsnum'],0xa);var _0xed94f3=rs[_0x7c0d('0x116')]({'charset':'*','length':_0x1949e4});var _0x54ec6c=_0x3ce4a4[_0x7c0d('0x96')];if(_0x54ec6c>0x0){if(_0x54ec6c>_0x1949e4){this[_0x7c0d('0x35')][_0x7c0d('0x6f')](this,_0x26f14c,_0x26f14c[_0x7c0d('0x117')]===_0x7c0d('0x118')?_0xed94f3+_0x3ce4a4[_0x7c0d('0x119')](_0x1949e4):_0x3ce4a4[_0x7c0d('0x119')](0x0,_0x54ec6c-_0x1949e4)+_0xed94f3);}else{this[_0x7c0d('0x35')]['sync'](this,_0x26f14c,rs[_0x7c0d('0x116')]({'charset':'*','length':_0x54ec6c}));}}else{this[_0x7c0d('0x35')]['sync'](this,_0x26f14c,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x26f14c,_0x3ce4a4);}return _0x1d638d;};AGIVertices['prototype']['getsecretdigits']=function(_0x469993){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x11a'),_0x469993[_0x7c0d('0xa5')]));return this[_0x7c0d('0x11b')](_0x469993);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x11c')]=function(_0x220047){logger[_0x7c0d('0x2f')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x220047[_0x7c0d('0xa5')]));this['createSquareDetailsReport']['sync'](this,_0x220047,_0x220047[_0x7c0d('0x11d')]);return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('GOAL\x20%s',_0x220047[_0x7c0d('0x11d')]));};AGIVertices[_0x7c0d('0x18')]['awspolly']=function(_0x22f4ce){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x11e'),_0x22f4ce['label']));if(!this[_0x7c0d('0x82')](_0x22f4ce['aws_access_key_id'])||!this[_0x7c0d('0x82')](_0x22f4ce[_0x7c0d('0x89')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0x11f'));}if(!this[_0x7c0d('0x82')](_0x22f4ce[_0x7c0d('0x5c')])){return this['channel'][_0x7c0d('0xa6')]('no\x20text\x20configured');}this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x120'),_0x22f4ce[_0x7c0d('0x5c')]));var _0x2bd78b=this[_0x7c0d('0x84')][_0x7c0d('0x6f')](this,_0x22f4ce);if(_0x2bd78b){this['channel'][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x2bd78b));var _0x4dcad4=this[_0x7c0d('0x36')][_0x7c0d('0xff')](_0x2bd78b);try{fs[_0x7c0d('0x100')](_0x2bd78b+'.wav');}catch(_0x4c7806){logger[_0x7c0d('0x2b')](_0x4c7806);}return _0x4dcad4;}return this[_0x7c0d('0x36')]['error'](_0x22f4ce,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x121')]=function(_0x523f58){logger[_0x7c0d('0x2f')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x523f58[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x523f58['aws_access_key_id'])||!this['isConfigured'](_0x523f58[_0x7c0d('0x89')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0x11f'));}if(!this['isConfigured'](_0x523f58[_0x7c0d('0x8b')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0x122'));}if(!this[_0x7c0d('0x82')](_0x523f58[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0xa7'));}this['channel'][_0x7c0d('0xf2')]=!![];this[_0x7c0d('0x35')](_0x523f58);this['createSquareMessage'](_0x523f58['text'],'in','','');this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x523f58['text']));var _0x469691=this[_0x7c0d('0x88')][_0x7c0d('0x6f')](this,_0x523f58);if(_0x469691){for(var _0x772137 in _0x469691){if(_0x469691[_0x7c0d('0x92')](_0x772137)&&_['isString'](_0x469691[_0x772137])){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util['format']('AWS_LEX_%s',_0x772137[_0x7c0d('0xe8')]()),_0x469691[_0x772137]);}}if(_[_0x7c0d('0x48')](_0x469691['message'])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x7c0d('0x42')](_0x469691[_0x7c0d('0x74')],'out',_0x7c0d('0x123'),'');return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format'](_0x7c0d('0x124'),_0x469691[_0x7c0d('0x74')]));}}return this['channel'][_0x7c0d('0x2b')](_0x523f58,_0x7c0d('0x125'));};AGIVertices['prototype']['googleasr']=function(_0x2c0b5c){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x126'),_0x2c0b5c[_0x7c0d('0xa5')],_0x2c0b5c['timeout']));if(!this[_0x7c0d('0x82')](_0x2c0b5c[_0x7c0d('0x78')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xe5'));}var _0x46b709='wav';var _0x13430f=util[_0x7c0d('0x28')](_0x7c0d('0x127'),FILES_PATH,rs[_0x7c0d('0x116')](0x4));var _0x23c0aa=util[_0x7c0d('0x28')](_0x7c0d('0x99'),_0x13430f,_0x46b709);var _0x3d8bc3=!![];if(_0x2c0b5c[_0x7c0d('0x128')]===_0x7c0d('0x129')){_0x3d8bc3=![];}var _0x373c82=this[_0x7c0d('0x36')]['recordFile'](_0x13430f,_0x46b709,_0x2c0b5c['intKey'],_0x2c0b5c[_0x7c0d('0x65')],undefined,_0x3d8bc3);if(_0x373c82[_0x7c0d('0xa0')]!==-0x1){this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format']('google\x20%s\x20file\x20created',_0x23c0aa));var _0x5a1484=this[_0x7c0d('0x8c')][_0x7c0d('0x6f')](this,_0x2c0b5c,_0x23c0aa);if(_0x5a1484){for(var _0x157b8a in _0x5a1484){if(_0x5a1484[_0x7c0d('0x92')](_0x157b8a)){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util[_0x7c0d('0x28')](_0x7c0d('0x12a'),_0x157b8a[_0x7c0d('0xe8')]()),_0x5a1484[_0x157b8a]);}}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format'](_0x7c0d('0x12b'),JSON[_0x7c0d('0x71')](_0x5a1484)));}}return _0x373c82;};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x12c')]=function(_0x569c6b){logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x12d'),_0x569c6b[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x569c6b['appid'])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0x12e'));}if(!this[_0x7c0d('0x82')](_0x569c6b[_0x7c0d('0x8f')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0x12f'));}var _0x54661a='wav';var _0x356de8=util[_0x7c0d('0x28')](_0x7c0d('0x127'),FILES_PATH,rs[_0x7c0d('0x116')](0x4));var _0x569cbe=util[_0x7c0d('0x28')](_0x7c0d('0x99'),_0x356de8,_0x54661a);var _0x1467f0=!![];if(_0x569c6b['beep']===_0x7c0d('0x129')){_0x1467f0=![];}var _0x3e0de8=this['channel'][_0x7c0d('0x130')](_0x356de8,_0x54661a,_0x569c6b[_0x7c0d('0x131')],_0x569c6b['timeout'],undefined,_0x1467f0);if(_0x3e0de8[_0x7c0d('0xa0')]!==-0x1){this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x132'),_0x569cbe));var _0xd9eb=this['tildeASR'][_0x7c0d('0x6f')](this,_0x569c6b,_0x569cbe);if(_0xd9eb){for(var _0x2b2b58 in _0xd9eb){if(_0xd9eb[_0x7c0d('0x92')](_0x2b2b58)){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util['format']('TILDE_ASR_%s',_0x2b2b58['toUpperCase']()),_0xd9eb[_0x2b2b58]);}}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x133'),JSON[_0x7c0d('0x71')](_0xd9eb)));}}return _0x3e0de8;};AGIVertices[_0x7c0d('0x18')]['gotoc']=function(_0x11995d){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x11995d[_0x7c0d('0xa5')]));return this['channel'][_0x7c0d('0x134')](_0x11995d[_0x7c0d('0x3c')],_0x11995d[_0x7c0d('0x3d')],_0x11995d[_0x7c0d('0x3e')]);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x135')]=function(_0xb45958){logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x136'),_0xb45958[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0xb45958['condition'])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0xb45958,'no\x20condition\x20configured');}try{var _0x68245=eval(_0xb45958[_0x7c0d('0x137')])?'true':_0x7c0d('0x138');this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x139'),_0xb45958[_0x7c0d('0x137')],_0x68245));return{'code':0xc8,'result':_0x68245};}catch(_0x426f2e){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x13a')]=function(_0x27c997){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x13b'),_0x27c997[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x27c997[_0x7c0d('0x13c')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x27c997,_0x7c0d('0x13d'));}var _0x19453c=this[_0x7c0d('0x23')][_0x7c0d('0x6f')](this,_0x27c997['interval_id']);if(!_0x19453c){return this['channel'][_0x7c0d('0x2b')](_0x27c997,_0x7c0d('0x13e'));}for(var _0x4123fe=0x0;_0x4123fe<_0x19453c[_0x7c0d('0x96')];_0x4123fe+=0x1){var _0x38eb95=this[_0x7c0d('0x36')][_0x7c0d('0x9e')](util['format'](_0x7c0d('0x13f'),_0x19453c[_0x4123fe]));if(_0x38eb95[_0x7c0d('0xa0')]===-0x1){return _0x38eb95;}logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('IFTIME\x20%s\x20%s',_0x19453c[_0x4123fe],_0x38eb95[_0x7c0d('0x9f')]));if(_0x38eb95[_0x7c0d('0x9f')]===_0x7c0d('0x140')){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x141'),_0x19453c[_0x4123fe],'true'));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util['format'](_0x7c0d('0x141'),_0x19453c[_0x4123fe],'true'));return{'code':0xc8,'result':_0x7c0d('0x140')};}else{logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x141'),_0x19453c[_0x4123fe],_0x7c0d('0x138')));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('IFTIME\x20%s\x20%s',_0x19453c[_0x4123fe],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x142')]=function(_0x1cb35c){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x143'),_0x1cb35c[_0x7c0d('0xa5')]));return this[_0x7c0d('0x36')][_0x7c0d('0x142')]();};AGIVertices[_0x7c0d('0x18')]['ispeechasr']=function(_0x2d102d){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x144'),_0x2d102d[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x2d102d[_0x7c0d('0x78')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('no\x20key\x20configured');}var _0x34b8e2=_0x7c0d('0x145');var _0x22eb12=util[_0x7c0d('0x28')](_0x7c0d('0x127'),FILES_PATH,rs[_0x7c0d('0x116')](0x4));var _0xbf8223=util[_0x7c0d('0x28')](_0x7c0d('0x99'),_0x22eb12,_0x34b8e2);var _0x3c04bc=!![];if(_0x2d102d[_0x7c0d('0x128')]==='NOBEEP'){_0x3c04bc=![];}var _0xe0fe1e=this[_0x7c0d('0x36')]['recordFile'](_0x22eb12,_0x34b8e2,_0x2d102d[_0x7c0d('0x131')],_0x2d102d[_0x7c0d('0x65')],undefined,_0x3c04bc);if(_0xe0fe1e[_0x7c0d('0xa0')]!==-0x1){this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x146'),_0xbf8223));var _0xfd14dc=this['ispeechASR']['sync'](this,_0x2d102d,_0xbf8223);if(_0xfd14dc){for(var _0xd2deee in _0xfd14dc){if(_0xfd14dc[_0x7c0d('0x92')](_0xd2deee)){this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util['format'](_0x7c0d('0x147'),_0xd2deee[_0x7c0d('0xe8')]()),_0xfd14dc[_0xd2deee]);}}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x148'),JSON['stringify'](_0xfd14dc)));}}return _0xe0fe1e;};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x149')]=function(_0x50d9b3){logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x14a'),_0x50d9b3['label']));if(!this[_0x7c0d('0x82')](_0x50d9b3[_0x7c0d('0x78')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xe5'));}if(!this['isConfigured'](_0x50d9b3[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0xa7'));}this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x50d9b3['text']));var _0x203a78=this[_0x7c0d('0x7f')]['sync'](this,_0x50d9b3);if(_0x203a78){this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')]('ispeech\x20%s\x20file\x20created',_0x203a78));var _0x28318e=this[_0x7c0d('0x36')]['streamFile'](_0x203a78,_0x50d9b3[_0x7c0d('0x131')]);try{fs[_0x7c0d('0x100')](_0x203a78+_0x7c0d('0x101'));}catch(_0x1d2e03){logger['error'](_0x1d2e03);}return _0x28318e;}return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x50d9b3,_0x7c0d('0x14b'));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x14c')]=function(_0x4cc2fd){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4cc2fd[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x4cc2fd[_0x7c0d('0x14d')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4cc2fd,'no\x20find\x20by\x20configured');}logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x14e'),this[_0x7c0d('0x36')]['callerid'],_0x4cc2fd[_0x7c0d('0x14d')]));var _0x49bad3=this[_0x7c0d('0x52')]['sync'](this,_0x4cc2fd['findBy']);if(_0x49bad3){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x14f'),this['channel'][_0x7c0d('0x39')],_0x4cc2fd[_0x7c0d('0x14d')]));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x14f'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x4cc2fd[_0x7c0d('0x14d')]));return{'code':0xc8,'result':_0x7c0d('0x150')};}else{logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x151'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x4cc2fd[_0x7c0d('0x14d')]));this['channel']['noop'](util[_0x7c0d('0x28')](_0x7c0d('0x151'),this['channel'][_0x7c0d('0x39')],_0x4cc2fd['findBy']));return{'code':0xc8,'result':_0x7c0d('0x152')};}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x153')]=function(_0x58555d){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x58555d[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x58555d['findBy'])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x58555d,_0x7c0d('0x154'));}logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x14e'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x58555d['findBy']));var _0x59243e=this['agentLogout'][_0x7c0d('0x6f')](this,_0x58555d['findBy']);if(_0x59243e){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x14f'),this['channel']['callerid'],_0x58555d[_0x7c0d('0x14d')]));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x14f'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x58555d[_0x7c0d('0x14d')]));return{'code':0xc8,'result':_0x7c0d('0x150')};}else{logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x151'),this['channel'][_0x7c0d('0x39')],_0x58555d[_0x7c0d('0x14d')]));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x151'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x58555d[_0x7c0d('0x14d')]));return{'code':0xc8,'result':_0x7c0d('0x152')};}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x155')]=function(_0x5e4dd9){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x156'),_0x5e4dd9[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x5e4dd9[_0x7c0d('0x157')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x5e4dd9,'no\x20operation\x20configured');}this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('math\x20%s',_0x5e4dd9[_0x7c0d('0x157')]));var _0x28e4ad=eval(_0x5e4dd9['operation']);if(!this['isConfigured'](_0x5e4dd9['variable_id'])){return this[_0x7c0d('0x36')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3f9c8f=this[_0x7c0d('0x9e')][_0x7c0d('0x6f')](this,_0x5e4dd9[_0x7c0d('0xd3')]);if(!_0x3f9c8f){return this['channel'][_0x7c0d('0x2b')](_0x5e4dd9,_0x7c0d('0xd4'));}if(_['isArray'](_0x28e4ad)){var _0x55237d=this;_0x28e4ad[_0x7c0d('0xd5')](function(_0x5b0257,_0x43c72b){_0x55237d[_0x7c0d('0x36')][_0x7c0d('0x9a')](util['format']('%s[%s]',_0x3f9c8f,_0x43c72b),_0x5b0257);});return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('variable\x20%s[key]\x20set',_0x3f9c8f));}else{return this[_0x7c0d('0x36')]['setVariable'](_0x3f9c8f,_0x28e4ad);}};AGIVertices['prototype'][_0x7c0d('0xc')]=function(_0x4bba52){logger['info'](util[_0x7c0d('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4bba52[_0x7c0d('0xa5')]));if(_0x4bba52['retry']===0x0){return this[_0x7c0d('0xa2')](_0x4bba52);}_0x4bba52['retry']-=0x1;if(!this[_0x7c0d('0x82')](_0x4bba52[_0x7c0d('0x10d')])){return this[_0x7c0d('0x36')]['error'](_0x4bba52,'no\x20file\x20audio\x20selected');}var _0x244076=this[_0x7c0d('0x1d')][_0x7c0d('0x6f')](this,_0x4bba52[_0x7c0d('0x10d')]);if(!_0x244076){return this['channel'][_0x7c0d('0x2b')](_0x4bba52,_0x7c0d('0x10f'));}var _0x379120=this['channel'][_0x7c0d('0x110')](_0x244076,_0x4bba52[_0x7c0d('0x111')],_0x4bba52[_0x7c0d('0x158')]);var _0x1122bb=_0x379120['result'];if(_0x379120['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4bba52,'-1');return _0x379120;}else if(_0x379120[_0x7c0d('0x9f')]===_0x7c0d('0x65')){_0x379120[_0x7c0d('0xa0')]=_0x379120[_0x7c0d('0xa0')]['length']>0x0?_0x379120[_0x7c0d('0xa0')]:'t';}else if(_[_0x7c0d('0x44')](_0x379120[_0x7c0d('0xa0')])){_0x379120[_0x7c0d('0xa0')]='#';_0x1122bb='#';}if(!this[_0x7c0d('0x82')](_0x4bba52[_0x7c0d('0xd3')])){this[_0x7c0d('0x36')]['noop'](_0x7c0d('0x159'));}else{var _0x56526d=this['getVariable'][_0x7c0d('0x6f')](this,_0x4bba52['variable_id']);if(!_0x56526d){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4bba52,_0x7c0d('0xd4'));}this[_0x7c0d('0x36')][_0x7c0d('0x9a')](_0x56526d,_0x1122bb);}this['createSquareDetailsReport'][_0x7c0d('0x6f')](this,_0x4bba52,_0x1122bb);return _0x379120;};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0xa6')]=function(_0x4d3e25){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x15a'),_0x4d3e25[_0x7c0d('0xa5')]));return this['channel']['noop'](_0x4d3e25[_0x7c0d('0x15b')]||_0x4d3e25['label']);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x15c')]=function(_0x4572f5){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x15d'),_0x4572f5['label']));if(!this[_0x7c0d('0x82')](_0x4572f5['findBy'])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4572f5,_0x7c0d('0x154'));}logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x14e'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x4572f5[_0x7c0d('0x14d')]));var _0x143141=this[_0x7c0d('0x4e')][_0x7c0d('0x6f')](this,_0x4572f5[_0x7c0d('0x15e')]);var _0x447ae0=this['agentPause']['sync'](this,_0x4572f5['findBy'],_0x143141);if(_0x447ae0){logger['info'](util['format'](_0x7c0d('0x14f'),this[_0x7c0d('0x36')]['callerid'],_0x4572f5[_0x7c0d('0x14d')]));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x4572f5[_0x7c0d('0x14d')]));return{'code':0xc8,'result':_0x7c0d('0x150')};}else{logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x151'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x4572f5['findBy']));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x14f'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x4572f5[_0x7c0d('0x14d')]));return{'code':0xc8,'result':_0x7c0d('0x152')};}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x15f')]=function(_0xce89b7){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x160'),_0xce89b7[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0xce89b7['file_id'])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0xce89b7,_0x7c0d('0x10e'));}var _0x4a8911=this[_0x7c0d('0x1d')][_0x7c0d('0x6f')](this,_0xce89b7[_0x7c0d('0x10d')]);if(!_0x4a8911){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0xce89b7,'no\x20file\x20audio\x20found');}var _0x586ce1=this['channel'][_0x7c0d('0xa8')](_0x7c0d('0x161'),[_0x4a8911,_0xce89b7['opts']]);if(_0x586ce1[_0x7c0d('0xa0')]===-0x1){return _0x586ce1;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xc5'),_0x7c0d('0x161'),_0x4a8911));};AGIVertices[_0x7c0d('0x18')]['queue']=function(_0x26b0e3){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x162'),_0x26b0e3['label']));if(!this[_0x7c0d('0x82')](_0x26b0e3[_0x7c0d('0x163')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x26b0e3,_0x7c0d('0x164'));}var _0x5a2d3c='';var _0x2ae99a=parseInt(_0x26b0e3[_0x7c0d('0x163')],0xa);if(isNaN(_0x2ae99a)){_0x5a2d3c=_0x26b0e3[_0x7c0d('0x163')];}else{_0x5a2d3c=this['getVoiceQueue'][_0x7c0d('0x6f')](this,_0x26b0e3[_0x7c0d('0x163')]);if(!_0x5a2d3c){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x26b0e3,'no\x20queue\x20found');}}var _0x435546='';if(this['isConfigured'](_0x26b0e3['file_id'])){var _0x2a288b=this[_0x7c0d('0x1d')][_0x7c0d('0x6f')](this,_0x26b0e3[_0x7c0d('0x10d')]);if(_0x2a288b){_0x435546=_0x2a288b;}}this[_0x7c0d('0x35')]['sync'](this,_0x26b0e3,_0x5a2d3c);if(_0x26b0e3[_0x7c0d('0xe0')][_0x7c0d('0x165')]('x')<0x0){_0x26b0e3[_0x7c0d('0xe0')]+='x';}if(_0x26b0e3[_0x7c0d('0xe0')][_0x7c0d('0x165')]('X')<0x0){_0x26b0e3[_0x7c0d('0xe0')]+='X';}this[_0x7c0d('0x36')][_0x7c0d('0x9a')]('XMCS-QUEUE',_0x5a2d3c?_0x5a2d3c['toLowerCase']():'');var _0xf9323d=this['channel']['exec']('QUEUE',[_0x5a2d3c,_0x26b0e3['opts'],_0x26b0e3[_0x7c0d('0x64')],_0x435546,_0x26b0e3[_0x7c0d('0x65')],_0x26b0e3['agi'],_0x26b0e3[_0x7c0d('0x166')],_0x26b0e3[_0x7c0d('0x167')],'',_0x26b0e3[_0x7c0d('0x168')]]);if(_0xf9323d['result']===-0x1){return _0xf9323d;}return this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x5a2d3c));};AGIVertices[_0x7c0d('0x18')]['record']=function(_0x1f7ac1){logger['info'](util['format'](_0x7c0d('0x169'),_0x1f7ac1[_0x7c0d('0xa5')]));var _0x4a753d=_0x1f7ac1[_0x7c0d('0x16a')]||_0x7c0d('0x145');var _0x1ddff6=util[_0x7c0d('0x28')]('%s_%s',this['channel'][_0x7c0d('0x37')],rs['generate'](0x5));var _0x2c616b=util['format'](_0x7c0d('0x16b'),FILES_PATH,_0x1ddff6,_0x4a753d);var _0xc2c9cb=util[_0x7c0d('0x28')](_0x7c0d('0x127'),FILES_PATH,_0x1ddff6);this[_0x7c0d('0x3a')][_0x7c0d('0x6f')](this,_0x1f7ac1,_0x1ddff6,_0x2c616b);this[_0x7c0d('0x36')][_0x7c0d('0x9a')](_0x7c0d('0x16c'),_0x1ddff6);logger[_0x7c0d('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xc2c9cb,_0x4a753d,_0x1f7ac1[_0x7c0d('0x16d')],_0x1f7ac1['timeout']);return this['channel'][_0x7c0d('0x130')](_0xc2c9cb,_0x4a753d,_0x1f7ac1[_0x7c0d('0x16d')],_0x1f7ac1['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x7c0d('0x16e')]=function(_0x1cae3d){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x16f'),_0x1cae3d['label']));if(!this['isConfigured'](_0x1cae3d[_0x7c0d('0x64')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('no\x20url\x20configured');}var _0x18b8e0=this[_0x7c0d('0x63')][_0x7c0d('0x6f')](this,_0x1cae3d);logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x170'),util['inspect'](_0x18b8e0,{'showHidden':![],'depth':null})));if(!this[_0x7c0d('0x82')](_0x1cae3d[_0x7c0d('0xd3')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x57d19d=this['getVariable'][_0x7c0d('0x6f')](this,_0x1cae3d['variable_id']);if(!_0x57d19d){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x1cae3d,'no\x20variable\x20found');}this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util[_0x7c0d('0x28')](_0x7c0d('0x171'),_0x57d19d),_0x18b8e0['statusCode']?_0x18b8e0[_0x7c0d('0x172')]:_0x7c0d('0x173'));this[_0x7c0d('0x36')][_0x7c0d('0x9a')](util[_0x7c0d('0x28')](_0x7c0d('0x174'),_0x57d19d),_0x18b8e0['statusMessage']?_0x18b8e0[_0x7c0d('0x73')]:'OK');if(_0x18b8e0[_0x7c0d('0x69')]){try{this[_0x7c0d('0x98')](_0x18b8e0[_0x7c0d('0x69')],_0x57d19d);}catch(_0x526c0f){logger[_0x7c0d('0x2b')](util['format'](_0x7c0d('0x175'),_0x57d19d));}}return this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')](_0x7c0d('0x176'),_0x57d19d));};AGIVertices[_0x7c0d('0x18')]['saydigits']=function(_0x213c03){logger['info'](util[_0x7c0d('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x213c03['label']));return this[_0x7c0d('0x36')][_0x7c0d('0x177')](_0x213c03[_0x7c0d('0x178')][_0x7c0d('0x58')](/\s+/g,''),_0x213c03[_0x7c0d('0x16d')]);};AGIVertices['prototype'][_0x7c0d('0x179')]=function(_0xe7b8ca){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xe7b8ca[_0x7c0d('0xa5')]));return this[_0x7c0d('0x36')][_0x7c0d('0x17a')](_0xe7b8ca[_0x7c0d('0x66')][_0x7c0d('0x58')](/\s+/g,''),_0xe7b8ca[_0x7c0d('0x16d')]);};AGIVertices[_0x7c0d('0x18')]['sayphonetic']=function(_0x57101b){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x17b'),_0x57101b[_0x7c0d('0xa5')]));return this['channel']['sayPhonetic'](_0x57101b[_0x7c0d('0x5c')],_0x57101b[_0x7c0d('0x16d')]);};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x17c')]=function(_0x4c969b){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x17d'),_0x4c969b[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x4c969b[_0x7c0d('0x17e')])){return this[_0x7c0d('0x36')]['noop'](_0x7c0d('0x17f'));}var _0x1ae5f2=this['getMailAccount']['sync'](this,_0x4c969b[_0x7c0d('0x17e')]);if(!_0x1ae5f2||!_0x1ae5f2[_0x7c0d('0x180')]){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x4c969b,'no\x20mail\x20account\x20found');}var _0x1151a3={'from':util[_0x7c0d('0x28')](_0x7c0d('0x181'),_0x1ae5f2[_0x7c0d('0x12')],_0x1ae5f2[_0x7c0d('0x182')]||_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x183')]),'to':_0x4c969b['to']||'','cc':_0x4c969b['cc']||'','bcc':_0x4c969b[_0x7c0d('0x184')]||'','subject':_0x4c969b['subject'],'html':_0x4c969b[_0x7c0d('0x5c')],'text':_0x4c969b[_0x7c0d('0x5c')]};var _0xc4d95c={'tls':{'rejectUnauthorized':![]}};if(_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x185')]){_0xc4d95c[_0x7c0d('0x185')]=_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x185')];}else{_0xc4d95c['host']=_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x186')];_0xc4d95c[_0x7c0d('0x187')]=_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x187')];_0xc4d95c['secure']=_0x1ae5f2[_0x7c0d('0x180')]['secure'];}if(_0x1ae5f2['Smtp'][_0x7c0d('0x188')]){_0xc4d95c[_0x7c0d('0x189')]={'user':_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x183')],'pass':_0x1ae5f2[_0x7c0d('0x180')][_0x7c0d('0x18a')]};}if(this[_0x7c0d('0x82')](_0x4c969b[_0x7c0d('0x18b')])){}logger[_0x7c0d('0xd9')](_0x7c0d('0x18c'),JSON[_0x7c0d('0x71')](_0x1151a3));this[_0x7c0d('0x35')][_0x7c0d('0x6f')](this,_0x4c969b,_0x4c969b['account_id']);this['channel'][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x18d'),_0x1ae5f2[_0x7c0d('0x12')]));this[_0x7c0d('0x22')]['sync'](this,_0xc4d95c,_0x1151a3);return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0x18e'));};AGIVertices['prototype']['sendFax']=function(_0x57cf3f){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x18f'),_0x57cf3f[_0x7c0d('0xa5')]));return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0x190'));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x191')]=function(_0x485d47){logger['info'](util[_0x7c0d('0x28')](_0x7c0d('0x192'),_0x485d47[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x485d47[_0x7c0d('0x193')])){return this['channel']['noop'](_0x7c0d('0x194'));}var _0x4a0441=this[_0x7c0d('0x32')][_0x7c0d('0x6f')](this,_0x485d47[_0x7c0d('0x193')]);if(!_0x4a0441){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x485d47,'no\x20sms\x20account\x20found');}var _0x17c475={'body':_0x485d47[_0x7c0d('0x195')],'phone':_0x485d47['to']||'','SmsAccountId':_0x4a0441['id']};logger[_0x7c0d('0xd9')](_0x7c0d('0x196'),JSON[_0x7c0d('0x71')](_0x17c475));this['createSquareDetailsReport'][_0x7c0d('0x6f')](this,_0x485d47,_0x485d47[_0x7c0d('0x193')]);this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')](_0x7c0d('0x197'),_0x4a0441['name']));this[_0x7c0d('0x34')][_0x7c0d('0x6f')](this,_0x17c475);return this['channel'][_0x7c0d('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x198')]=function(_0x25d5d7){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x199'),_0x25d5d7['label']));if(!this[_0x7c0d('0x82')](_0x25d5d7['variable_id'])){return this['channel'][_0x7c0d('0x2b')](_0x25d5d7,_0x7c0d('0x19a'));}var _0x56fa36=this['getVariable'][_0x7c0d('0x6f')](this,_0x25d5d7[_0x7c0d('0xd3')]);if(!_0x56fa36){return this[_0x7c0d('0x36')]['error'](_0x25d5d7,_0x7c0d('0xd4'));}return this[_0x7c0d('0x36')][_0x7c0d('0x9a')](_0x56fa36,_0x25d5d7[_0x7c0d('0x19b')]);};AGIVertices[_0x7c0d('0x18')]['start']=function(_0x4e6961){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4e6961[_0x7c0d('0xa5')]));this[_0x7c0d('0x36')]['noop']('START\x20CALLY\x20SQUARE');if(_0x4e6961[_0x7c0d('0xba')]===_0x7c0d('0x19c')){this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0x19d'));return this['channel'][_0x7c0d('0xba')]();}return this[_0x7c0d('0x36')]['noop']('Skipped\x20Answer');};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x19e')]=function(_0x1f74e4){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x19f'),_0x1f74e4[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x1f74e4[_0x7c0d('0x1a0')])){return this[_0x7c0d('0x36')]['error'](_0x1f74e4,'no\x20subproject\x20selected');}var _0x46b971=this[_0x7c0d('0x16')][_0x7c0d('0x6f')](this,_0x1f74e4[_0x7c0d('0x1a0')]);if(!this['isConfigured'](_0x46b971)){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x1f74e4,util[_0x7c0d('0x28')](_0x7c0d('0x1a1'),_0x1f74e4[_0x7c0d('0x1a0')]));}if(_0x46b971===this[_0x7c0d('0x36')][_0x7c0d('0x40')]){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x1f74e4,_0x7c0d('0x1a2'));}this[_0x7c0d('0x35')]['sync'](this,_0x1f74e4,_0x46b971);var _0x368162=this[_0x7c0d('0x36')][_0x7c0d('0xa8')](_0x7c0d('0x1a3'),util['format'](_0x7c0d('0x1a4'),config[_0x7c0d('0x7')]['host']||_0x7c0d('0x1a5'),_0x46b971,this[_0x7c0d('0x36')][_0x7c0d('0x40')]));if(_0x368162['result']===-0x1){return _0x368162;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x46b971));};AGIVertices[_0x7c0d('0x18')]['system']=function(_0x52d33c){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x52d33c[_0x7c0d('0xa5')]));var _0x1be23c=this[_0x7c0d('0x56')][_0x7c0d('0x6f')](this,_0x52d33c['command']);this['createSquareDetailsReport'][_0x7c0d('0x6f')](this,_0x52d33c,_0x52d33c['command']);if(this[_0x7c0d('0x82')](_0x52d33c[_0x7c0d('0xd3')])){var _0xed2089=this[_0x7c0d('0x9e')][_0x7c0d('0x6f')](this,_0x52d33c['variable_id']);if(_0xed2089){this[_0x7c0d('0x36')]['setVariable'](_0xed2089,_0x1be23c);return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x52d33c[_0x7c0d('0xb8')],_0xed2089));}}return this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')](_0x7c0d('0x1a6'),_0x52d33c[_0x7c0d('0xb8')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x4fb240){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x1a7'),_0x4fb240['label']));_0x4fb240[_0x7c0d('0x5c')]=_0x4fb240['text'][_0x7c0d('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7c0d('0x82')](_0x4fb240[_0x7c0d('0x5a')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')]('no\x20apiKey\x20configured');}if(!this[_0x7c0d('0x82')](_0x4fb240[_0x7c0d('0x5c')])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xa7'));}this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x1a8'),_0x4fb240[_0x7c0d('0x5c')]));var _0x5c0fe4=this['googleCloudTTS'][_0x7c0d('0x6f')](this,_0x4fb240);if(_0x5c0fe4){this['channel'][_0x7c0d('0xa6')](util[_0x7c0d('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5c0fe4));var _0x1184a5=this['channel'][_0x7c0d('0xff')](_0x5c0fe4);try{fs[_0x7c0d('0x100')](_0x5c0fe4+_0x7c0d('0x101'));}catch(_0x11c997){logger[_0x7c0d('0x2b')](_0x11c997);}return _0x1184a5;}return this['channel'][_0x7c0d('0x2b')](_0x4fb240,_0x7c0d('0x1a9'));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x1aa')]=function(_0x41321a){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x1ab'),_0x41321a[_0x7c0d('0xa5')]));_0x41321a['text']=_0x41321a['text'][_0x7c0d('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7c0d('0x82')](_0x41321a['text'])){return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](_0x7c0d('0xa7'));}this['channel'][_0x7c0d('0xa6')](util['format'](_0x7c0d('0x1ac'),_0x41321a['text']));var _0x3e5220=this['googleTTS'][_0x7c0d('0x6f')](this,_0x41321a);if(_0x3e5220){this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x1ad'),_0x3e5220));var _0x331bbe=this[_0x7c0d('0x36')]['streamFile'](_0x3e5220);try{fs[_0x7c0d('0x100')](_0x3e5220+_0x7c0d('0x101'));}catch(_0x49c1e5){logger[_0x7c0d('0x2b')](_0x49c1e5);}return _0x331bbe;}return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x41321a,_0x7c0d('0x1ae'));};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x1af')]=function(_0x359e8c){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x1b0'),_0x359e8c[_0x7c0d('0xa5')]));if(!this[_0x7c0d('0x82')](_0x359e8c[_0x7c0d('0x14d')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x359e8c,_0x7c0d('0x154'));}logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x14e'),this['channel'][_0x7c0d('0x39')],_0x359e8c[_0x7c0d('0x14d')]));var _0x243798=this[_0x7c0d('0x1b1')][_0x7c0d('0x6f')](this,_0x359e8c['findBy']);if(_0x243798){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7c0d('0x36')]['callerid'],_0x359e8c[_0x7c0d('0x14d')]));this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0x14f'),this[_0x7c0d('0x36')]['callerid'],_0x359e8c[_0x7c0d('0x14d')]));return{'code':0xc8,'result':_0x7c0d('0x150')};}else{logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x359e8c[_0x7c0d('0x14d')]));this[_0x7c0d('0x36')]['noop'](util[_0x7c0d('0x28')](_0x7c0d('0x151'),this[_0x7c0d('0x36')][_0x7c0d('0x39')],_0x359e8c['findBy']));return{'code':0xc8,'result':_0x7c0d('0x152')};}};AGIVertices[_0x7c0d('0x18')][_0x7c0d('0x1b2')]=function(_0x4ce3ae){logger[_0x7c0d('0x2f')](util[_0x7c0d('0x28')](_0x7c0d('0x1b3'),_0x4ce3ae[_0x7c0d('0xa5')]));var _0x2eec27=this[_0x7c0d('0x36')][_0x7c0d('0xa8')](_0x7c0d('0x1b4'),[_0x4ce3ae['mailbox'],_0x4ce3ae[_0x7c0d('0x76')]]);if(_0x2eec27['result']===-0x1){return _0x2eec27;}return this[_0x7c0d('0x36')][_0x7c0d('0xa6')](util[_0x7c0d('0x28')](_0x7c0d('0xc5'),'VOICEMAIL',_0x4ce3ae['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x32fd10){logger[_0x7c0d('0x2f')](util['format'](_0x7c0d('0x1b5'),_0x32fd10[_0x7c0d('0xa5')]));if(!this['isConfigured'](_0x32fd10[_0x7c0d('0xd3')])){return this[_0x7c0d('0x36')][_0x7c0d('0x2b')](_0x32fd10,_0x7c0d('0x19a'));}var _0x5b426d=this[_0x7c0d('0x9e')][_0x7c0d('0x6f')](this,_0x32fd10[_0x7c0d('0xd3')]);if(!_0x5b426d){return this[_0x7c0d('0x36')]['error'](_0x32fd10,_0x7c0d('0xd4'));}var _0x2699b0=this[_0x7c0d('0x36')][_0x7c0d('0x9e')](_0x5b426d);return{'code':0xc8,'result':_0x2699b0['extra']?_0x2699b0[_0x7c0d('0x9f')]:'-'};};String[_0x7c0d('0x18')]['replaceAll']=function(_0x17dcb2,_0x2c9f02){return this[_0x7c0d('0x9c')](_0x17dcb2)[_0x7c0d('0x1b6')](_0x2c9f02);};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 917f6db..b625649 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 _0x060e=['[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','destlinkedid','timers','acwTimeout','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s'];(function(_0x56ada3,_0x360fde){var _0x491e6f=function(_0x2e2c9d){while(--_0x2e2c9d){_0x56ada3['push'](_0x56ada3['shift']());}};_0x491e6f(++_0x360fde);}(_0x060e,0x1d1));var _0xe060=function(_0x18b20e,_0x46903c){_0x18b20e=_0x18b20e-0x0;var _0xadd3a9=_0x060e[_0x18b20e];return _0xadd3a9;};'use strict';var util=require('util');var _=require(_0xe060('0x0'));var moment=require(_0xe060('0x1'));var ami=require(_0xe060('0x2'));var logger=require(_0xe060('0x3'))(_0xe060('0x4'));var RpcUser=require(_0xe060('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x49969d){this[_0xe060('0x6')]=_0x49969d[_0xe060('0x6')];this[_0xe060('0x7')]=_0x49969d[_0xe060('0x7')];this['timers']=_0x49969d['timers'];this[_0xe060('0x8')]={};ami['on'](_0xe060('0x9'),this[_0xe060('0xa')]['bind'](this));ami['on'](_0xe060('0xb'),this[_0xe060('0xc')][_0xe060('0xd')](this));ami['on'](_0xe060('0xe'),this[_0xe060('0xf')][_0xe060('0xd')](this));ami['on'](_0xe060('0x10'),this[_0xe060('0x11')]['bind'](this));ami['on'](_0xe060('0x12'),this[_0xe060('0x13')][_0xe060('0xd')](this));ami['on'](_0xe060('0x14'),this['syncBlindTransfer'][_0xe060('0xd')](this));ami['on'](_0xe060('0x15'),this[_0xe060('0x16')]['bind'](this));}function getDiff(_0x3f9a44){var _0x1b0fcd=moment()[_0xe060('0x17')](0x0);var _0x2bdc96=moment(_0x3f9a44)[_0xe060('0x17')](0x0);return _0x1b0fcd[_0xe060('0x18')](_0x2bdc96,_0xe060('0x19'));}Acw['prototype'][_0xe060('0x1a')]=function(_0x3f069f){try{var _0x1c96c4=this;var _0x68a277=this['channels'][_0x3f069f][_0xe060('0x1b')];var _0x138347=this['channels'][_0x3f069f]['queue'];var _0x29efd9=this[_0xe060('0x6')][_0x138347];var _0x9b588b=![];var _0x28907c=_0xe060('0x1c');if(_0x29efd9['mandatoryDisposition']){if(_0x29efd9[_0xe060('0x1d')][_0xe060('0x1e')]){_0x9b588b=!![];_0x28907c=_0x29efd9[_0xe060('0x1d')][_0xe060('0x1e')];}}ami[_0xe060('0x1f')]({'action':'QueuePause','interface':_0x68a277,'paused':!![],'reason':_0x28907c})[_0xe060('0x20')](function(_0x2927b8){if(_0x1c96c4[_0xe060('0x7')][_0x68a277]){return RpcUser[_0xe060('0x21')](_0x1c96c4[_0xe060('0x7')][_0x68a277]['id'])[_0xe060('0x20')](function(_0x173a93){if(_0x173a93&&!_0x173a93[_0xe060('0x22')]){logger[_0xe060('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3f069f,_0x68a277,_0x138347);var _0x125009=_0x1c96c4[_0xe060('0x8')][_0x3f069f]['attended']&&_0x1c96c4['channels'][_0x3f069f][_0xe060('0x24')]?_0x1c96c4[_0xe060('0x8')][_0x3f069f][_0xe060('0x24')]:_0x3f069f;return RpcUser['savePause'](_0x1c96c4[_0xe060('0x7')][_0x68a277],_0x28907c,_0x125009)[_0xe060('0x20')](function(_0x4a8a83){if(!_0x9b588b){_0x1c96c4[_0xe060('0x25')][_0x68a277]={};logger[_0xe060('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3f069f,_0x1c96c4[_0xe060('0x6')][_0x138347][_0xe060('0x26')],_0x68a277,_0x138347);_0x1c96c4[_0xe060('0x25')][_0x68a277]['timer']=setTimeout(_0x1c96c4[_0xe060('0x27')][_0xe060('0xd')](_0x1c96c4,_0x68a277),_0x1c96c4['voiceQueues'][_0x138347][_0xe060('0x26')]*0x3e8);_0x1c96c4[_0xe060('0x25')][_0x68a277][_0xe060('0x28')]=moment()[_0xe060('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c96c4[_0xe060('0x25')][_0x68a277][_0xe060('0x2a')]=_0x3f069f;_0x1c96c4[_0xe060('0x25')][_0x68a277][_0xe060('0x2b')]=_0x138347;_0x1c96c4[_0xe060('0x25')][_0x68a277][_0xe060('0x2c')]=function(){var _0xd31150=getDiff(_0x1c96c4['timers'][_0x68a277]['lastPauseAt']);clearTimeout(_0x1c96c4[_0xe060('0x25')][_0x68a277][_0xe060('0x2d')]);_0x1c96c4[_0xe060('0x25')][_0x68a277][_0xe060('0x2d')]=![];RpcVoiceAgentReport[_0xe060('0x2e')]({'acwtime':_0xd31150},_0x1c96c4['timers'][_0x68a277]['uniqueid'],_0x68a277)[_0xe060('0x20')](function(_0x2b6b6a){logger[_0xe060('0x23')](_0xe060('0x2f'),_0x3f069f,_0xd31150,_0x2b6b6a);})[_0xe060('0x30')](function(_0xbfc93d){logger[_0xe060('0x31')](_0xe060('0x32'),_0x3f069f,_0xbfc93d);});delete _0x1c96c4[_0xe060('0x25')][_0x68a277];};}});}else{logger['info'](_0xe060('0x33'),_0x3f069f,_0x68a277,_0x138347);}});}})[_0xe060('0x30')](function(_0x32d8eb){logger['error'](_0xe060('0x34'),_0x3f069f,_0x1c96c4['voiceQueues'][_0x138347][_0xe060('0x26')],_0x68a277,_0x138347);})['finally'](function(){delete _0x1c96c4[_0xe060('0x8')][_0x3f069f];});}catch(_0x168c7c){logger[_0xe060('0x31')](_0xe060('0x35'),_0x168c7c[_0xe060('0x36')]);}};Acw[_0xe060('0x37')]['stopAcw']=function(_0xc0e40e){try{var _0x437941=this;if(_0x437941['timers'][_0xc0e40e]){_0x437941['timers'][_0xc0e40e][_0xe060('0x2d')]=![];var _0x5ec979=_0x437941[_0xe060('0x25')][_0xc0e40e][_0xe060('0x2a')];var _0xda33c2=_0x437941[_0xe060('0x25')][_0xc0e40e][_0xe060('0x2b')];var _0x1b3f74=_0x437941[_0xe060('0x6')][_0xda33c2][_0xe060('0x26')];logger[_0xe060('0x23')](_0xe060('0x38'),_0x5ec979,_0xc0e40e);RpcUser[_0xe060('0x39')](this['agents'][_0xc0e40e]);RpcVoiceAgentReport[_0xe060('0x2e')]({'acwtime':_0x1b3f74,'agentacw':!![]},_0x5ec979,_0xc0e40e)[_0xe060('0x20')](function(_0x20544e){logger[_0xe060('0x23')](_0xe060('0x2f'),_0x5ec979,_0x1b3f74,_0x20544e);})[_0xe060('0x30')](function(_0x33853f){logger[_0xe060('0x31')](_0xe060('0x32'),_0x5ec979,_0x33853f);});}else{logger[_0xe060('0x31')](_0xe060('0x3a'),_0xc0e40e);if(_0x437941[_0xe060('0x25')]){logger[_0xe060('0x23')](_0xe060('0x3b'),JSON['stringify'](_0x437941['timers']));}}}catch(_0x5443f1){logger[_0xe060('0x31')](_0xe060('0x3c'),_0x5443f1[_0xe060('0x36')]);}};Acw[_0xe060('0x37')][_0xe060('0xa')]=function(_0x2eb736){try{if(this[_0xe060('0x6')][_0x2eb736[_0xe060('0x2b')]]&&(this[_0xe060('0x6')][_0x2eb736['queue']]['acw']||this[_0xe060('0x6')][_0x2eb736['queue']][_0xe060('0x3d')])){if(this[_0xe060('0x7')][_0x2eb736[_0xe060('0x1b')]]){this[_0xe060('0x8')][_0x2eb736[_0xe060('0x2a')]]={'queue':_0x2eb736[_0xe060('0x2b')],'interface':_0x2eb736['interface'],'destlinkedid':_0x2eb736[_0xe060('0x24')]};}}}catch(_0x2d9ad6){logger[_0xe060('0x31')](_0xe060('0x3e'),_0x2d9ad6[_0xe060('0x36')]);}};Acw[_0xe060('0x37')][_0xe060('0x16')]=function(_0x3fcafc){try{if(this[_0xe060('0x6')][_0x3fcafc[_0xe060('0x2b')]]&&(this['voiceQueues'][_0x3fcafc[_0xe060('0x2b')]][_0xe060('0x4')]||this['voiceQueues'][_0x3fcafc[_0xe060('0x2b')]][_0xe060('0x3d')])){if(this['agents'][_0x3fcafc[_0xe060('0x1b')]]){this[_0xe060('0x8')][_0x3fcafc[_0xe060('0x2a')]]={'queue':_0x3fcafc[_0xe060('0x2b')],'interface':_0x3fcafc[_0xe060('0x1b')]};}}}catch(_0x1bca52){logger[_0xe060('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1bca52[_0xe060('0x36')]);}};Acw[_0xe060('0x37')][_0xe060('0xc')]=function(_0x21eb09){try{if(this[_0xe060('0x8')][_0x21eb09[_0xe060('0x2a')]]&&_[_0xe060('0x3f')](this[_0xe060('0x8')][_0x21eb09[_0xe060('0x2a')]][_0xe060('0x40')])){logger[_0xe060('0x23')](_0xe060('0x41'),_0x21eb09[_0xe060('0x2a')]);this[_0xe060('0x1a')](_0x21eb09[_0xe060('0x2a')]);}else if(this[_0xe060('0x8')][_0x21eb09[_0xe060('0x42')]]&&_[_0xe060('0x3f')](this[_0xe060('0x8')][_0x21eb09['linkedid']]['attended'])){logger[_0xe060('0x23')](_0xe060('0x43'),_0x21eb09[_0xe060('0x42')]);this['startAcw'](_0x21eb09[_0xe060('0x42')]);}}catch(_0xb0e2cb){logger[_0xe060('0x31')](_0xe060('0x44'),_0xb0e2cb[_0xe060('0x36')]);}};Acw[_0xe060('0x37')][_0xe060('0xf')]=function(_0x3a34ad){try{if(this[_0xe060('0x8')][_0x3a34ad['uniqueid']]&&this[_0xe060('0x8')][_0x3a34ad['uniqueid']][_0xe060('0x40')]){logger[_0xe060('0x23')](_0xe060('0x45'),_0x3a34ad[_0xe060('0x2a')]);this[_0xe060('0x1a')](_0x3a34ad[_0xe060('0x2a')]);}else if(this[_0xe060('0x8')][_0x3a34ad[_0xe060('0x42')]]&&this['channels'][_0x3a34ad[_0xe060('0x42')]][_0xe060('0x40')]){logger['info'](_0xe060('0x46'),_0x3a34ad[_0xe060('0x42')]);this[_0xe060('0x1a')](_0x3a34ad[_0xe060('0x42')]);}}catch(_0x1689de){logger[_0xe060('0x31')](_0xe060('0x47'),_0x1689de[_0xe060('0x36')]);}};Acw[_0xe060('0x37')]['syncAttendedTransfer']=function(_0x5b5ee9){try{if(!_[_0xe060('0x48')](this['channels'][_0x5b5ee9[_0xe060('0x49')]])){this[_0xe060('0x1a')](_0x5b5ee9[_0xe060('0x49')]);if(this[_0xe060('0x8')][_0x5b5ee9[_0xe060('0x4a')]]){this[_0xe060('0x8')][_0x5b5ee9[_0xe060('0x4a')]][_0xe060('0x40')]=!![];this['channels'][_0x5b5ee9[_0xe060('0x4b')]]=this[_0xe060('0x8')][_0x5b5ee9['secondtransfereruniqueid']];delete this[_0xe060('0x8')][_0x5b5ee9['secondtransfereruniqueid']];}}else if(!_[_0xe060('0x48')](this['channels'][_0x5b5ee9[_0xe060('0x4b')]])){this['startAcw'](_0x5b5ee9[_0xe060('0x4b')]);if(this[_0xe060('0x8')][_0x5b5ee9[_0xe060('0x4c')]]){this[_0xe060('0x8')][_0x5b5ee9[_0xe060('0x4c')]][_0xe060('0x40')]=!![];this[_0xe060('0x8')][_0x5b5ee9[_0xe060('0x49')]]=this['channels'][_0x5b5ee9['origtransfereruniqueid']];delete this['channels'][_0x5b5ee9['origtransfereruniqueid']];}}}catch(_0x1395dd){logger['error'](_0xe060('0x4d'),_0x1395dd[_0xe060('0x36')]);}};Acw[_0xe060('0x37')][_0xe060('0x4e')]=function(_0x8b69a7){try{if(this[_0xe060('0x8')][_0x8b69a7['transfereruniqueid']]){logger[_0xe060('0x23')](_0xe060('0x4f'),JSON[_0xe060('0x50')](_0x8b69a7['transfereruniqueid']));this[_0xe060('0x1a')](_0x8b69a7['transfereruniqueid']);}else if(this[_0xe060('0x8')][_0x8b69a7[_0xe060('0x51')]]){logger[_0xe060('0x23')](_0xe060('0x52'),JSON[_0xe060('0x50')](_0x8b69a7[_0xe060('0x51')]));this[_0xe060('0x1a')](_0x8b69a7[_0xe060('0x51')]);}}catch(_0x49b539){logger[_0xe060('0x31')](_0xe060('0x53'),_0x49b539[_0xe060('0x36')]);}};Acw[_0xe060('0x37')][_0xe060('0x11')]=function(_0x38cc05){try{if(this[_0xe060('0x6')][_0x38cc05[_0xe060('0x2b')]]&&this['voiceQueues'][_0x38cc05[_0xe060('0x2b')]][_0xe060('0x54')]===_0xe060('0x55')){if(this[_0xe060('0x7')][_0x38cc05['interface']]){logger[_0xe060('0x23')](_0xe060('0x56'),_0x38cc05['uniqueid'],_0x38cc05['interface'],_0x38cc05[_0xe060('0x2b')]);return RpcUser[_0xe060('0x57')](this[_0xe060('0x7')][_0x38cc05[_0xe060('0x1b')]],'Auto-Pause',_0x38cc05[_0xe060('0x2a')]);}}}catch(_0x199ce4){logger[_0xe060('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x199ce4[_0xe060('0x36')]);}};module[_0xe060('0x58')]=Acw; \ No newline at end of file +var _0x83c9=['transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','attended','savePause','acwTimeout','stopAcw','lastPauseAt','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','saveUnpause','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x83c9,0xa4));var _0x983c=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x83c9[_0x934425];return _0x31d596;};'use strict';var util=require(_0x983c('0x0'));var _=require('lodash');var moment=require(_0x983c('0x1'));var ami=require(_0x983c('0x2'));var logger=require(_0x983c('0x3'))(_0x983c('0x4'));var RpcUser=require(_0x983c('0x5'));var RpcVoiceAgentReport=require(_0x983c('0x6'));function Acw(_0x3d3afc){this[_0x983c('0x7')]=_0x3d3afc['voiceQueues'];this['agents']=_0x3d3afc[_0x983c('0x8')];this[_0x983c('0x9')]=_0x3d3afc[_0x983c('0x9')];this[_0x983c('0xa')]={};ami['on'](_0x983c('0xb'),this[_0x983c('0xc')]['bind'](this));ami['on'](_0x983c('0xd'),this[_0x983c('0xe')][_0x983c('0xf')](this));ami['on'](_0x983c('0x10'),this[_0x983c('0x11')][_0x983c('0xf')](this));ami['on'](_0x983c('0x12'),this[_0x983c('0x13')][_0x983c('0xf')](this));ami['on']('attendedtransfer',this[_0x983c('0x14')][_0x983c('0xf')](this));ami['on'](_0x983c('0x15'),this[_0x983c('0x16')]['bind'](this));ami['on'](_0x983c('0x17'),this['syncAgentConnectPreview'][_0x983c('0xf')](this));}function getDiff(_0xd17380){var _0xe4623=moment()[_0x983c('0x18')](0x0);var _0x479140=moment(_0xd17380)[_0x983c('0x18')](0x0);return _0xe4623['diff'](_0x479140,_0x983c('0x19'));}Acw[_0x983c('0x1a')][_0x983c('0x1b')]=function(_0x1e2736){try{var _0x2e4bc8=this;var _0x35aa3b=this[_0x983c('0xa')][_0x1e2736]['interface'];var _0x452ee8=this[_0x983c('0xa')][_0x1e2736][_0x983c('0x1c')];var _0x850d3a=this[_0x983c('0x7')][_0x452ee8];var _0x1a4d49=![];var _0x4e037a=_0x983c('0x1d');if(_0x850d3a[_0x983c('0x1e')]){if(_0x850d3a[_0x983c('0x1f')][_0x983c('0x20')]){_0x1a4d49=!![];_0x4e037a=_0x850d3a[_0x983c('0x1f')][_0x983c('0x20')];}}ami[_0x983c('0x21')]({'action':_0x983c('0x22'),'interface':_0x35aa3b,'paused':!![],'reason':_0x4e037a})[_0x983c('0x23')](function(_0x5a9c6c){if(_0x2e4bc8[_0x983c('0x8')][_0x35aa3b]){return RpcUser[_0x983c('0x24')](_0x2e4bc8[_0x983c('0x8')][_0x35aa3b]['id'])[_0x983c('0x23')](function(_0x3b39e8){if(_0x3b39e8&&!_0x3b39e8['voicePause']){logger[_0x983c('0x25')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x1e2736,_0x35aa3b,_0x452ee8);var _0x455aea=_0x2e4bc8[_0x983c('0xa')][_0x1e2736][_0x983c('0x26')]&&_0x2e4bc8['channels'][_0x1e2736]['destlinkedid']?_0x2e4bc8[_0x983c('0xa')][_0x1e2736]['destlinkedid']:_0x1e2736;return RpcUser[_0x983c('0x27')](_0x2e4bc8[_0x983c('0x8')][_0x35aa3b],_0x4e037a,_0x455aea)[_0x983c('0x23')](function(_0x365245){if(!_0x1a4d49){_0x2e4bc8[_0x983c('0x9')][_0x35aa3b]={};logger[_0x983c('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1e2736,_0x2e4bc8[_0x983c('0x7')][_0x452ee8][_0x983c('0x28')],_0x35aa3b,_0x452ee8);_0x2e4bc8['timers'][_0x35aa3b]['timer']=setTimeout(_0x2e4bc8[_0x983c('0x29')][_0x983c('0xf')](_0x2e4bc8,_0x35aa3b),_0x2e4bc8['voiceQueues'][_0x452ee8]['acwTimeout']*0x3e8);_0x2e4bc8['timers'][_0x35aa3b][_0x983c('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x2b')]=_0x1e2736;_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x1c')]=_0x452ee8;_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x2c')]=function(){var _0x12ef22=getDiff(_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x2a')]);clearTimeout(_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x2d')]);_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x2d')]=![];RpcVoiceAgentReport[_0x983c('0x2e')]({'acwtime':_0x12ef22},_0x2e4bc8[_0x983c('0x9')][_0x35aa3b][_0x983c('0x2b')],_0x35aa3b)[_0x983c('0x23')](function(_0x160538){logger[_0x983c('0x25')](_0x983c('0x2f'),_0x1e2736,_0x12ef22,_0x160538);})[_0x983c('0x30')](function(_0x1bfcd1){logger[_0x983c('0x31')](_0x983c('0x32'),_0x1e2736,_0x1bfcd1);});delete _0x2e4bc8[_0x983c('0x9')][_0x35aa3b];};}});}else{logger[_0x983c('0x25')](_0x983c('0x33'),_0x1e2736,_0x35aa3b,_0x452ee8);}});}})[_0x983c('0x30')](function(_0x11f314){logger[_0x983c('0x31')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1e2736,_0x2e4bc8[_0x983c('0x7')][_0x452ee8][_0x983c('0x28')],_0x35aa3b,_0x452ee8);})[_0x983c('0x34')](function(){delete _0x2e4bc8[_0x983c('0xa')][_0x1e2736];});}catch(_0x55a180){logger[_0x983c('0x31')](_0x983c('0x35'),_0x55a180['message']);}};Acw[_0x983c('0x1a')][_0x983c('0x29')]=function(_0x3ab44a){try{var _0x48d40d=this;if(_0x48d40d[_0x983c('0x9')][_0x3ab44a]){_0x48d40d[_0x983c('0x9')][_0x3ab44a][_0x983c('0x2d')]=![];var _0x44c970=_0x48d40d[_0x983c('0x9')][_0x3ab44a]['uniqueid'];var _0x5a531d=_0x48d40d[_0x983c('0x9')][_0x3ab44a][_0x983c('0x1c')];var _0x4a44f3=_0x48d40d[_0x983c('0x7')][_0x5a531d][_0x983c('0x28')];logger[_0x983c('0x25')]('[%s][TIMER][STOP][AGENT:%s]',_0x44c970,_0x3ab44a);RpcUser[_0x983c('0x36')](this[_0x983c('0x8')][_0x3ab44a]);RpcVoiceAgentReport[_0x983c('0x2e')]({'acwtime':_0x4a44f3,'agentacw':!![]},_0x44c970,_0x3ab44a)[_0x983c('0x23')](function(_0x5420c4){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x44c970,_0x4a44f3,_0x5420c4);})[_0x983c('0x30')](function(_0x2f3afc){logger[_0x983c('0x31')](_0x983c('0x32'),_0x44c970,_0x2f3afc);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3ab44a);if(_0x48d40d[_0x983c('0x9')]){logger['info']('[ACW][TIMERS]',JSON[_0x983c('0x37')](_0x48d40d['timers']));}}}catch(_0x2605e7){logger['error'](_0x983c('0x38'),_0x2605e7[_0x983c('0x39')]);}};Acw[_0x983c('0x1a')]['syncAgentConnect']=function(_0x46c445){try{if(this['voiceQueues'][_0x46c445['queue']]&&(this[_0x983c('0x7')][_0x46c445['queue']]['acw']||this['voiceQueues'][_0x46c445[_0x983c('0x1c')]][_0x983c('0x1e')])){if(this[_0x983c('0x8')][_0x46c445[_0x983c('0x3a')]]){this[_0x983c('0xa')][_0x46c445[_0x983c('0x2b')]]={'queue':_0x46c445[_0x983c('0x1c')],'interface':_0x46c445[_0x983c('0x3a')],'destlinkedid':_0x46c445['destlinkedid']};}}}catch(_0x5a4812){logger[_0x983c('0x31')](_0x983c('0x3b'),_0x5a4812[_0x983c('0x39')]);}};Acw['prototype'][_0x983c('0x3c')]=function(_0x3b9922){try{if(this[_0x983c('0x7')][_0x3b9922[_0x983c('0x1c')]]&&(this[_0x983c('0x7')][_0x3b9922[_0x983c('0x1c')]][_0x983c('0x4')]||this[_0x983c('0x7')][_0x3b9922['queue']][_0x983c('0x1e')])){if(this[_0x983c('0x8')][_0x3b9922[_0x983c('0x3a')]]){this[_0x983c('0xa')][_0x3b9922[_0x983c('0x2b')]]={'queue':_0x3b9922[_0x983c('0x1c')],'interface':_0x3b9922[_0x983c('0x3a')]};}}}catch(_0x20476a){logger['error'](_0x983c('0x3d'),_0x20476a['message']);}};Acw[_0x983c('0x1a')]['syncHangupRequest']=function(_0x2bf8fe){try{if(this[_0x983c('0xa')][_0x2bf8fe[_0x983c('0x2b')]]&&_[_0x983c('0x3e')](this[_0x983c('0xa')][_0x2bf8fe[_0x983c('0x2b')]][_0x983c('0x26')])){logger[_0x983c('0x25')](_0x983c('0x3f'),_0x2bf8fe['uniqueid']);this[_0x983c('0x1b')](_0x2bf8fe[_0x983c('0x2b')]);}else if(this[_0x983c('0xa')][_0x2bf8fe[_0x983c('0x40')]]&&_[_0x983c('0x3e')](this['channels'][_0x2bf8fe[_0x983c('0x40')]]['attended'])){logger[_0x983c('0x25')](_0x983c('0x41'),_0x2bf8fe[_0x983c('0x40')]);this['startAcw'](_0x2bf8fe[_0x983c('0x40')]);}}catch(_0x4f3f96){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x4f3f96[_0x983c('0x39')]);}};Acw[_0x983c('0x1a')]['syncHangup']=function(_0x2e89f5){try{if(this[_0x983c('0xa')][_0x2e89f5[_0x983c('0x2b')]]&&this[_0x983c('0xa')][_0x2e89f5[_0x983c('0x2b')]][_0x983c('0x26')]){logger['info'](_0x983c('0x42'),_0x2e89f5[_0x983c('0x2b')]);this[_0x983c('0x1b')](_0x2e89f5[_0x983c('0x2b')]);}else if(this[_0x983c('0xa')][_0x2e89f5[_0x983c('0x40')]]&&this[_0x983c('0xa')][_0x2e89f5[_0x983c('0x40')]][_0x983c('0x26')]){logger[_0x983c('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2e89f5['linkedid']);this['startAcw'](_0x2e89f5['linkedid']);}}catch(_0x11c468){logger[_0x983c('0x31')](_0x983c('0x43'),_0x11c468[_0x983c('0x39')]);}};Acw[_0x983c('0x1a')][_0x983c('0x14')]=function(_0x10d212){try{if(!_[_0x983c('0x44')](this[_0x983c('0xa')][_0x10d212[_0x983c('0x45')]])){this[_0x983c('0x1b')](_0x10d212[_0x983c('0x45')]);if(this['channels'][_0x10d212[_0x983c('0x46')]]){this[_0x983c('0xa')][_0x10d212[_0x983c('0x46')]]['attended']=!![];this[_0x983c('0xa')][_0x10d212[_0x983c('0x47')]]=this[_0x983c('0xa')][_0x10d212['secondtransfereruniqueid']];delete this[_0x983c('0xa')][_0x10d212['secondtransfereruniqueid']];}}else if(!_[_0x983c('0x44')](this['channels'][_0x10d212[_0x983c('0x47')]])){this[_0x983c('0x1b')](_0x10d212[_0x983c('0x47')]);if(this['channels'][_0x10d212[_0x983c('0x48')]]){this[_0x983c('0xa')][_0x10d212['origtransfereruniqueid']][_0x983c('0x26')]=!![];this['channels'][_0x10d212[_0x983c('0x45')]]=this[_0x983c('0xa')][_0x10d212['origtransfereruniqueid']];delete this[_0x983c('0xa')][_0x10d212[_0x983c('0x48')]];}}}catch(_0x21cf79){logger[_0x983c('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x21cf79[_0x983c('0x39')]);}};Acw[_0x983c('0x1a')]['syncBlindTransfer']=function(_0x44ad31){try{if(this['channels'][_0x44ad31[_0x983c('0x49')]]){logger[_0x983c('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x983c('0x37')](_0x44ad31[_0x983c('0x49')]));this[_0x983c('0x1b')](_0x44ad31[_0x983c('0x49')]);}else if(this['channels'][_0x44ad31['transfererlinkedid']]){logger[_0x983c('0x25')](_0x983c('0x4a'),JSON['stringify'](_0x44ad31[_0x983c('0x4b')]));this[_0x983c('0x1b')](_0x44ad31[_0x983c('0x4b')]);}}catch(_0x3ef7f4){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x3ef7f4[_0x983c('0x39')]);}};Acw[_0x983c('0x1a')]['syncAgentRingNoAnswer']=function(_0x546cd2){try{if(this[_0x983c('0x7')][_0x546cd2[_0x983c('0x1c')]]&&this[_0x983c('0x7')][_0x546cd2['queue']]['autopause']==='all'){if(this[_0x983c('0x8')][_0x546cd2[_0x983c('0x3a')]]){logger['info'](_0x983c('0x4c'),_0x546cd2[_0x983c('0x2b')],_0x546cd2['interface'],_0x546cd2[_0x983c('0x1c')]);return RpcUser[_0x983c('0x27')](this['agents'][_0x546cd2[_0x983c('0x3a')]],'Auto-Pause',_0x546cd2['uniqueid']);}}}catch(_0x27b510){logger[_0x983c('0x31')](_0x983c('0x4d'),_0x27b510[_0x983c('0x39')]);}};module[_0x983c('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9bd9ba0..c7d6f38 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x2714f3,_0x1b379e){_0x2714f3=_0x2714f3-0x0;var _0x573e99=_0x2032[_0x2714f3];return _0x573e99;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x16d0f7,_0x1e4ee1){var _0x1ea7a8=function(_0x19d0bb){while(--_0x19d0bb){_0x16d0f7['push'](_0x16d0f7['shift']());}};_0x1ea7a8(++_0x1e4ee1);}(_0x757a,0xde));var _0xa757=function(_0x43e326,_0x514b0d){_0x43e326=_0x43e326-0x0;var _0x4162db=_0x757a[_0x43e326];return _0x4162db;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0363612..43a6ce9 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xe706,0xa3));var _0x6e70=function(_0x1b00f1,_0x15ffa8){_0x1b00f1=_0x1b00f1-0x0;var _0x5c3dad=_0xe706[_0x1b00f1];return _0x5c3dad;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x58571c,_0x178880){var _0x4b9bb0=function(_0x31d239){while(--_0x31d239){_0x58571c['push'](_0x58571c['shift']());}};_0x4b9bb0(++_0x178880);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 991fe59..af128be 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bc0=['getQueue','util','moment','isNil','string','name','phone','Contact','firstName','lastName','number','queue','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','substring'];(function(_0x5397e0,_0x3b41f4){var _0x44dda4=function(_0x44f0bd){while(--_0x44f0bd){_0x5397e0['push'](_0x5397e0['shift']());}};_0x44dda4(++_0x3b41f4);}(_0x6bc0,0x169));var _0x06bc=function(_0x59bacc,_0x5e914a){_0x59bacc=_0x59bacc-0x0;var _0x5675ea=_0x6bc0[_0x59bacc];return _0x5675ea;};'use strict';var util=require(_0x06bc('0x0'));var _=require('lodash');var moment=require(_0x06bc('0x1'));function checkNameSurname(_0x5e81d9,_0x56b7ae,_0x20e77c){var _0x1b1b49='';if(!_[_0x06bc('0x2')](_0x56b7ae)&&_0x06bc('0x3')===typeof _0x56b7ae){_0x1b1b49+=_0x56b7ae;}if(!_['isNil'](_0x20e77c)&&'string'===typeof _0x20e77c){_0x1b1b49+='\x20'+_0x20e77c;}if(_0x1b1b49!==''){return _0x1b1b49;}return _0x5e81d9;}function Action(_0x49a9c0,_0x142896,_0x29cead){this['voiceQueue']=_0x49a9c0;this['uniqueid']=_0x29cead||undefined;this[_0x06bc('0x4')]=checkNameSurname(_0x142896['Contact'][_0x06bc('0x5')],_0x142896[_0x06bc('0x6')][_0x06bc('0x7')],_0x142896[_0x06bc('0x6')][_0x06bc('0x8')]);this[_0x06bc('0x9')]=_0x142896['Contact'][_0x06bc('0x5')];this[_0x06bc('0xa')]=_0x49a9c0[_0x06bc('0x4')];this['active']=_0x142896['active']||![];this['type']=_0x49a9c0['type'];this[_0x06bc('0xb')]=_0x49a9c0[_0x06bc('0xb')]||0x3;this[_0x06bc('0xc')]=_0x142896['scheduledat'];this['countbusyretry']=_0x142896['countbusyretry'];this[_0x06bc('0xd')]=_0x142896['countcongestionretry'];this[_0x06bc('0xe')]=_0x142896[_0x06bc('0xe')];this[_0x06bc('0xf')]=_0x142896['countnosuchnumberretry'];this[_0x06bc('0x10')]=_0x142896[_0x06bc('0x10')];this['countabandonedretry']=_0x142896['countabandonedretry'];this['countmachineretry']=_0x142896[_0x06bc('0x11')];this['countagentrejectretry']=_0x142896[_0x06bc('0x12')];this['ContactId']=_0x142896['ContactId'];this[_0x06bc('0x13')]=_0x142896[_0x06bc('0x13')];this[_0x06bc('0x14')]=_0x142896[_0x06bc('0x14')];this[_0x06bc('0x15')]=_0x142896[_0x06bc('0x15')];this[_0x06bc('0x16')]=_0x142896['CampaignId'];this[_0x06bc('0x17')]=_0x142896['id'];this[_0x06bc('0x18')]=_0x142896[_0x06bc('0x6')][_0x06bc('0x7')]||'';this['starttime']=moment()['format'](_0x06bc('0x19'));this['callback']=_0x142896[_0x06bc('0x1a')];this[_0x06bc('0x1b')]=_0x142896[_0x06bc('0x1b')];this['callbackat']=_0x142896['callbackat'];this[_0x06bc('0x1c')]=_0x142896[_0x06bc('0x1c')];this['originatecalleridnum']='';this[_0x06bc('0x1d')]='';}Action[_0x06bc('0x1e')][_0x06bc('0x1f')]=function(){return util['format'](_0x06bc('0x20'),this[_0x06bc('0x4')],this[_0x06bc('0x21')]['dialCutDigit']>0x0?this['number'][_0x06bc('0x22')](this[_0x06bc('0x21')]['dialCutDigit']):this[_0x06bc('0x9')]);};Action[_0x06bc('0x1e')][_0x06bc('0x23')]=function(){return this[_0x06bc('0xa')];};module['exports']=Action; \ No newline at end of file +var _0xa642=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','queue','active','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xa642,0xa0));var _0x2a64=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0xa642[_0x22b39b];return _0x280e1d;};'use strict';var util=require('util');var _=require(_0x2a64('0x0'));var moment=require(_0x2a64('0x1'));function checkNameSurname(_0x1e66bc,_0x561811,_0x47950c){var _0x66f4f0='';if(!_[_0x2a64('0x2')](_0x561811)&&'string'===typeof _0x561811){_0x66f4f0+=_0x561811;}if(!_['isNil'](_0x47950c)&&_0x2a64('0x3')===typeof _0x47950c){_0x66f4f0+='\x20'+_0x47950c;}if(_0x66f4f0!==''){return _0x66f4f0;}return _0x1e66bc;}function Action(_0x4b3ff8,_0xb0299c,_0x498a24){this[_0x2a64('0x4')]=_0x4b3ff8;this['uniqueid']=_0x498a24||undefined;this[_0x2a64('0x5')]=checkNameSurname(_0xb0299c[_0x2a64('0x6')][_0x2a64('0x7')],_0xb0299c[_0x2a64('0x6')][_0x2a64('0x8')],_0xb0299c['Contact'][_0x2a64('0x9')]);this['number']=_0xb0299c['Contact'][_0x2a64('0x7')];this[_0x2a64('0xa')]=_0x4b3ff8[_0x2a64('0x5')];this[_0x2a64('0xb')]=_0xb0299c['active']||![];this['type']=_0x4b3ff8['type'];this['dialQueueTimeout']=_0x4b3ff8[_0x2a64('0xc')]||0x3;this['scheduledat']=_0xb0299c['scheduledat'];this['countbusyretry']=_0xb0299c[_0x2a64('0xd')];this['countcongestionretry']=_0xb0299c[_0x2a64('0xe')];this[_0x2a64('0xf')]=_0xb0299c[_0x2a64('0xf')];this[_0x2a64('0x10')]=_0xb0299c[_0x2a64('0x10')];this['countdropretry']=_0xb0299c[_0x2a64('0x11')];this[_0x2a64('0x12')]=_0xb0299c[_0x2a64('0x12')];this[_0x2a64('0x13')]=_0xb0299c[_0x2a64('0x13')];this[_0x2a64('0x14')]=_0xb0299c[_0x2a64('0x14')];this[_0x2a64('0x15')]=_0xb0299c[_0x2a64('0x15')];this[_0x2a64('0x16')]=_0xb0299c[_0x2a64('0x16')];this[_0x2a64('0x17')]=_0xb0299c['UserId'];this[_0x2a64('0x18')]=_0xb0299c['VoiceQueueId'];this[_0x2a64('0x19')]=_0xb0299c[_0x2a64('0x19')];this[_0x2a64('0x1a')]=_0xb0299c['id'];this[_0x2a64('0x1b')]=_0xb0299c[_0x2a64('0x6')][_0x2a64('0x8')]||'';this[_0x2a64('0x1c')]=moment()[_0x2a64('0x1d')](_0x2a64('0x1e'));this[_0x2a64('0x1f')]=_0xb0299c['callback'];this[_0x2a64('0x20')]=_0xb0299c[_0x2a64('0x20')];this[_0x2a64('0x21')]=_0xb0299c['callbackat'];this[_0x2a64('0x22')]=_0xb0299c[_0x2a64('0x22')];this[_0x2a64('0x23')]='';this[_0x2a64('0x24')]='';}Action[_0x2a64('0x25')][_0x2a64('0x26')]=function(){return util[_0x2a64('0x1d')](_0x2a64('0x27'),this['name'],this[_0x2a64('0x4')]['dialCutDigit']>0x0?this[_0x2a64('0x28')][_0x2a64('0x29')](this[_0x2a64('0x4')][_0x2a64('0x2a')]):this[_0x2a64('0x28')]);};Action[_0x2a64('0x25')][_0x2a64('0x2b')]=function(){return this[_0x2a64('0xa')];};module[_0x2a64('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d645ab3..4469321 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38bf=['callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason'];(function(_0x906cb7,_0xfc0b49){var _0x4efdc5=function(_0x9725c){while(--_0x9725c){_0x906cb7['push'](_0x906cb7['shift']());}};_0x4efdc5(++_0xfc0b49);}(_0x38bf,0x1ee));var _0xf38b=function(_0x34923c,_0x5c066e){_0x34923c=_0x34923c-0x0;var _0x26db41=_0x38bf[_0x34923c];return _0x26db41;};'use strict';var util=require(_0xf38b('0x0'));var _=require(_0xf38b('0x1'));var moment=require(_0xf38b('0x2'));function getSeconds(_0x31875d,_0x1caa82){var _0x49a1b2=moment(_0x31875d)[_0xf38b('0x3')](0x0);var _0x37eee4=moment(_0x1caa82)[_0xf38b('0x3')](0x0);return _0x49a1b2[_0xf38b('0x4')](_0x37eee4,_0xf38b('0x5'));}function AgentComplete(_0xb2a4fb,_0x27df2d){this[_0xf38b('0x6')]=0x4;this[_0xf38b('0x7')]=_0xf38b('0x8');this[_0xf38b('0x9')]=_0xb2a4fb[_0xf38b('0x9')];this[_0xf38b('0xa')]=_0xb2a4fb[_0xf38b('0xa')];this['campaigntype']=_0xb2a4fb[_0xf38b('0xa')]===_0xf38b('0xb')?_0xf38b('0xc'):_0xb2a4fb[_0xf38b('0xa')];this[_0xf38b('0xd')]=_0xb2a4fb[_0xf38b('0xd')];this[_0xf38b('0xe')]=_0xb2a4fb[_0xf38b('0xe')];this[_0xf38b('0xf')]=_0xb2a4fb[_0xf38b('0xf')];this['countglobal']=_0xb2a4fb['countbusyretry']+_0xb2a4fb[_0xf38b('0xe')]+_0xb2a4fb[_0xf38b('0xf')]+_0xb2a4fb[_0xf38b('0x10')]+_0xb2a4fb[_0xf38b('0x11')]+_0xb2a4fb[_0xf38b('0x12')]+_0xb2a4fb[_0xf38b('0x13')]+_0xb2a4fb['countagentrejectretry'];this['countnosuchnumberretry']=_0xb2a4fb[_0xf38b('0x10')];this[_0xf38b('0x11')]=_0xb2a4fb[_0xf38b('0x11')];this[_0xf38b('0x12')]=_0xb2a4fb['countabandonedretry'];this[_0xf38b('0x13')]=_0xb2a4fb['countmachineretry'];this[_0xf38b('0x14')]=_0xb2a4fb['countagentrejectretry'];this[_0xf38b('0x15')]=_0x27df2d['uniqueid'];this['calleridname']=_0xb2a4fb[_0xf38b('0x16')];this[_0xf38b('0x17')]=_0xb2a4fb[_0xf38b('0x18')];this[_0xf38b('0x19')]=_0xb2a4fb[_0xf38b('0x19')];this['responsetime']=_0xb2a4fb[_0xf38b('0x1a')];this[_0xf38b('0x1b')]=_0xb2a4fb[_0xf38b('0x1b')];this[_0xf38b('0x1c')]=moment()['format'](_0xf38b('0x1d'));this['ringtime']=getSeconds(_0xb2a4fb[_0xf38b('0x1a')],_0xb2a4fb['starttime']);this[_0xf38b('0x1e')]=getSeconds(_0xb2a4fb['answertime'],_0xb2a4fb['responsetime']);this[_0xf38b('0x1f')]=getSeconds(this[_0xf38b('0x1c')],_0xb2a4fb[_0xf38b('0x1b')]);this['queue']=_0x27df2d[_0xf38b('0xc')];this[_0xf38b('0x20')]=_0x27df2d[_0xf38b('0x20')];this[_0xf38b('0x21')]=_0x27df2d[_0xf38b('0x21')];this['callback']=_0xb2a4fb[_0xf38b('0x22')];this['callbackuniqueid']=_0xb2a4fb[_0xf38b('0x23')];this[_0xf38b('0x24')]=_0xb2a4fb[_0xf38b('0x24')];this[_0xf38b('0x25')]=_0xb2a4fb[_0xf38b('0x25')];this[_0xf38b('0x26')]=_0xb2a4fb[_0xf38b('0x26')];this['ListId']=_0xb2a4fb['ListId'];this[_0xf38b('0x27')]=_0xb2a4fb[_0xf38b('0x27')];this[_0xf38b('0x28')]=_0xb2a4fb['VoiceQueueId'];this[_0xf38b('0x29')]=_0xb2a4fb[_0xf38b('0x29')];this[_0xf38b('0x2a')]=_0xb2a4fb[_0xf38b('0x2a')]||'';this[_0xf38b('0x2b')]=_0xb2a4fb[_0xf38b('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xcecb=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason'];(function(_0x1c1b8c,_0x4c253d){var _0x1ee4c4=function(_0xb9bff5){while(--_0xb9bff5){_0x1c1b8c['push'](_0x1c1b8c['shift']());}};_0x1ee4c4(++_0x4c253d);}(_0xcecb,0x1d6));var _0xbcec=function(_0x2f15c5,_0x339a97){_0x2f15c5=_0x2f15c5-0x0;var _0x1fcff1=_0xcecb[_0x2f15c5];return _0x1fcff1;};'use strict';var util=require('util');var _=require(_0xbcec('0x0'));var moment=require(_0xbcec('0x1'));function getSeconds(_0x444813,_0x300ba2){var _0x4a379f=moment(_0x444813)['milliseconds'](0x0);var _0x5c0b70=moment(_0x300ba2)[_0xbcec('0x2')](0x0);return _0x4a379f[_0xbcec('0x3')](_0x5c0b70,_0xbcec('0x4'));}function AgentComplete(_0x3da79f,_0x252381){this['state']=0x4;this[_0xbcec('0x5')]=_0xbcec('0x6');this[_0xbcec('0x7')]=_0x3da79f[_0xbcec('0x7')];this[_0xbcec('0x8')]=_0x3da79f[_0xbcec('0x8')];this['campaigntype']=_0x3da79f['type']===_0xbcec('0x9')?'queue':_0x3da79f[_0xbcec('0x8')];this['countbusyretry']=_0x3da79f[_0xbcec('0xa')];this[_0xbcec('0xb')]=_0x3da79f[_0xbcec('0xb')];this['countnoanswerretry']=_0x3da79f['countnoanswerretry'];this[_0xbcec('0xc')]=_0x3da79f[_0xbcec('0xa')]+_0x3da79f[_0xbcec('0xb')]+_0x3da79f[_0xbcec('0xd')]+_0x3da79f[_0xbcec('0xe')]+_0x3da79f[_0xbcec('0xf')]+_0x3da79f[_0xbcec('0x10')]+_0x3da79f[_0xbcec('0x11')]+_0x3da79f['countagentrejectretry'];this['countnosuchnumberretry']=_0x3da79f[_0xbcec('0xe')];this['countdropretry']=_0x3da79f[_0xbcec('0xf')];this[_0xbcec('0x10')]=_0x3da79f[_0xbcec('0x10')];this[_0xbcec('0x11')]=_0x3da79f[_0xbcec('0x11')];this['countagentrejectretry']=_0x3da79f[_0xbcec('0x12')];this[_0xbcec('0x13')]=_0x252381[_0xbcec('0x13')];this[_0xbcec('0x14')]=_0x3da79f[_0xbcec('0x15')];this[_0xbcec('0x16')]=_0x3da79f[_0xbcec('0x17')];this[_0xbcec('0x18')]=_0x3da79f[_0xbcec('0x18')];this[_0xbcec('0x19')]=_0x3da79f[_0xbcec('0x19')];this[_0xbcec('0x1a')]=_0x3da79f[_0xbcec('0x1a')];this[_0xbcec('0x1b')]=moment()[_0xbcec('0x1c')](_0xbcec('0x1d'));this[_0xbcec('0x1e')]=getSeconds(_0x3da79f[_0xbcec('0x19')],_0x3da79f[_0xbcec('0x18')]);this[_0xbcec('0x1f')]=getSeconds(_0x3da79f[_0xbcec('0x1a')],_0x3da79f[_0xbcec('0x19')]);this[_0xbcec('0x20')]=getSeconds(this[_0xbcec('0x1b')],_0x3da79f[_0xbcec('0x1a')]);this[_0xbcec('0x21')]=_0x252381['queue'];this[_0xbcec('0x22')]=_0x252381[_0xbcec('0x22')];this[_0xbcec('0x23')]=_0x252381[_0xbcec('0x23')];this['callback']=_0x3da79f['callback'];this[_0xbcec('0x24')]=_0x3da79f['callbackuniqueid'];this[_0xbcec('0x25')]=_0x3da79f[_0xbcec('0x25')];this[_0xbcec('0x26')]=_0x3da79f['recallme'];this[_0xbcec('0x27')]=_0x3da79f[_0xbcec('0x27')];this['ListId']=_0x3da79f[_0xbcec('0x28')];this[_0xbcec('0x29')]=_0x3da79f['UserId'];this[_0xbcec('0x2a')]=_0x3da79f[_0xbcec('0x2a')];this['CampaignId']=_0x3da79f[_0xbcec('0x2b')];this['originatecalleridnum']=_0x3da79f[_0xbcec('0x2c')]||'';this[_0xbcec('0x2d')]=_0x3da79f[_0xbcec('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 62b4ba2..6b88a85 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5292=['campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','scheduledat'];(function(_0x43b349,_0x534986){var _0x4f7cc9=function(_0x27e5a0){while(--_0x27e5a0){_0x43b349['push'](_0x43b349['shift']());}};_0x4f7cc9(++_0x534986);}(_0x5292,0xf7));var _0x2529=function(_0x455ac0,_0x1d5f16){_0x455ac0=_0x455ac0-0x0;var _0xfb9257=_0x5292[_0x455ac0];return _0xfb9257;};'use strict';var util=require(_0x2529('0x0'));var _=require(_0x2529('0x1'));var moment=require('moment');function getSeconds(_0x2ec817,_0x522ab4){var _0x1540a9=moment(_0x2ec817)[_0x2529('0x2')](0x0);var _0x29576c=moment(_0x522ab4)[_0x2529('0x2')](0x0);return _0x1540a9['diff'](_0x29576c,_0x2529('0x3'));}function Final(_0x482dba){this['uniqueid']=_0x482dba['uniqueid'];this[_0x2529('0x4')]=_0x482dba[_0x2529('0x4')];this['type']=_0x482dba['type'];this[_0x2529('0x5')]=_0x482dba[_0x2529('0x6')]==='outbound'?_0x2529('0x7'):_0x482dba[_0x2529('0x6')];this[_0x2529('0x8')]=_0x482dba[_0x2529('0x8')];this[_0x2529('0x9')]=_0x482dba[_0x2529('0x9')];this[_0x2529('0xa')]=_0x482dba[_0x2529('0xa')];this['countglobal']=_0x482dba[_0x2529('0x8')]+_0x482dba[_0x2529('0x9')]+_0x482dba['countnoanswerretry']+_0x482dba[_0x2529('0xb')]+_0x482dba[_0x2529('0xc')]+_0x482dba[_0x2529('0xd')]+_0x482dba[_0x2529('0xe')]+_0x482dba[_0x2529('0xf')];this[_0x2529('0xb')]=_0x482dba[_0x2529('0xb')];this['countdropretry']=_0x482dba[_0x2529('0xc')];this[_0x2529('0xd')]=_0x482dba[_0x2529('0xd')];this[_0x2529('0xe')]=_0x482dba[_0x2529('0xe')];this[_0x2529('0xf')]=_0x482dba[_0x2529('0xf')];this[_0x2529('0x7')]=_0x482dba['queue'];this[_0x2529('0x10')]=_0x482dba['calleridname'];this[_0x2529('0x11')]=_0x482dba[_0x2529('0x11')];this[_0x2529('0x12')]=_0x482dba['starttime'];this['responsetime']=_0x482dba[_0x2529('0x13')];this[_0x2529('0x14')]=_0x482dba[_0x2529('0x13')];this[_0x2529('0x15')]=_0x482dba[_0x2529('0x15')]||0x0;this['holdtime']=_0x482dba[_0x2529('0x16')]||0x0;this[_0x2529('0x17')]=_0x482dba[_0x2529('0x17')]||0x0;this[_0x2529('0x18')]=_0x482dba['callback'];this[_0x2529('0x19')]=_0x482dba[_0x2529('0x19')];this[_0x2529('0x1a')]=_0x482dba['callbackat'];this[_0x2529('0x1b')]=_0x482dba[_0x2529('0x1b')];this[_0x2529('0x1c')]=_0x482dba[_0x2529('0x1c')];this['ListId']=_0x482dba[_0x2529('0x1d')];this[_0x2529('0x1e')]=_0x482dba[_0x2529('0x1e')];this[_0x2529('0x1f')]=_0x482dba[_0x2529('0x1f')];this[_0x2529('0x20')]=_0x482dba['CampaignId'];this['originatecalleridnum']=_0x482dba[_0x2529('0x21')]||'';this[_0x2529('0x22')]=_0x482dba[_0x2529('0x22')]||'';}module[_0x2529('0x23')]=Final; \ No newline at end of file +var _0x2123=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x2123,0x190));var _0x3212=function(_0x3ece46,_0x586b81){_0x3ece46=_0x3ece46-0x0;var _0x395097=_0x2123[_0x3ece46];return _0x395097;};'use strict';var util=require(_0x3212('0x0'));var _=require(_0x3212('0x1'));var moment=require(_0x3212('0x2'));function getSeconds(_0x3424c2,_0x7158b8){var _0x2ff863=moment(_0x3424c2)[_0x3212('0x3')](0x0);var _0x2e951f=moment(_0x7158b8)[_0x3212('0x3')](0x0);return _0x2ff863[_0x3212('0x4')](_0x2e951f,_0x3212('0x5'));}function Final(_0x265328){this['uniqueid']=_0x265328[_0x3212('0x6')];this[_0x3212('0x7')]=_0x265328[_0x3212('0x7')];this['type']=_0x265328[_0x3212('0x8')];this['campaigntype']=_0x265328[_0x3212('0x8')]===_0x3212('0x9')?_0x3212('0xa'):_0x265328[_0x3212('0x8')];this['countbusyretry']=_0x265328['countbusyretry'];this[_0x3212('0xb')]=_0x265328[_0x3212('0xb')];this[_0x3212('0xc')]=_0x265328[_0x3212('0xc')];this[_0x3212('0xd')]=_0x265328[_0x3212('0xe')]+_0x265328[_0x3212('0xb')]+_0x265328[_0x3212('0xc')]+_0x265328[_0x3212('0xf')]+_0x265328[_0x3212('0x10')]+_0x265328[_0x3212('0x11')]+_0x265328[_0x3212('0x12')]+_0x265328[_0x3212('0x13')];this[_0x3212('0xf')]=_0x265328[_0x3212('0xf')];this[_0x3212('0x10')]=_0x265328[_0x3212('0x10')];this[_0x3212('0x11')]=_0x265328[_0x3212('0x11')];this[_0x3212('0x12')]=_0x265328[_0x3212('0x12')];this[_0x3212('0x13')]=_0x265328['countagentrejectretry'];this[_0x3212('0xa')]=_0x265328[_0x3212('0xa')];this[_0x3212('0x14')]=_0x265328[_0x3212('0x14')];this[_0x3212('0x15')]=_0x265328[_0x3212('0x15')];this[_0x3212('0x16')]=_0x265328['starttime'];this['responsetime']=_0x265328[_0x3212('0x17')];this['endtime']=_0x265328[_0x3212('0x17')];this[_0x3212('0x18')]=_0x265328[_0x3212('0x18')]||0x0;this[_0x3212('0x19')]=_0x265328[_0x3212('0x19')]||0x0;this['talktime']=_0x265328[_0x3212('0x1a')]||0x0;this[_0x3212('0x1b')]=_0x265328['callback'];this[_0x3212('0x1c')]=_0x265328[_0x3212('0x1c')];this[_0x3212('0x1d')]=_0x265328['callbackat'];this['recallme']=_0x265328[_0x3212('0x1e')];this[_0x3212('0x1f')]=_0x265328[_0x3212('0x1f')];this[_0x3212('0x20')]=_0x265328[_0x3212('0x20')];this[_0x3212('0x21')]=_0x265328['UserId'];this['VoiceQueueId']=_0x265328[_0x3212('0x22')];this['CampaignId']=_0x265328[_0x3212('0x23')];this[_0x3212('0x24')]=_0x265328[_0x3212('0x24')]||'';this['originatecalleridname']=_0x265328[_0x3212('0x25')]||'';}module[_0x3212('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9b94822..011ed7f 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8c1=['countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry'];(function(_0x47e59a,_0xf71029){var _0x839fc3=function(_0x52c0aa){while(--_0x52c0aa){_0x47e59a['push'](_0x47e59a['shift']());}};_0x839fc3(++_0xf71029);}(_0xd8c1,0x133));var _0x1d8c=function(_0x2cfd80,_0xb763da){_0x2cfd80=_0x2cfd80-0x0;var _0x5545bb=_0xd8c1[_0x2cfd80];return _0x5545bb;};'use strict';var util=require(_0x1d8c('0x0'));var _=require(_0x1d8c('0x1'));var moment=require(_0x1d8c('0x2'));function getSeconds(_0x8f1915,_0x9d64c){var _0x304bc2=moment(_0x8f1915)[_0x1d8c('0x3')](0x0);var _0x180617=moment(_0x9d64c)[_0x1d8c('0x3')](0x0);return _0x304bc2[_0x1d8c('0x4')](_0x180617,_0x1d8c('0x5'));}function Hangup(_0x4ead89,_0x3153de){this[_0x1d8c('0x6')]=0x4;this[_0x1d8c('0x7')]='Answer';this['scheduledat']=_0x4ead89['scheduledat'];this[_0x1d8c('0x8')]=_0x4ead89[_0x1d8c('0x8')];this[_0x1d8c('0x9')]=_0x4ead89['type']==='outbound'?'queue':_0x4ead89[_0x1d8c('0x8')];this[_0x1d8c('0xa')]=_0x4ead89[_0x1d8c('0xa')];this['countcongestionretry']=_0x4ead89['countcongestionretry'];this[_0x1d8c('0xb')]=_0x4ead89[_0x1d8c('0xb')];this[_0x1d8c('0xc')]=_0x4ead89['countbusyretry']+_0x4ead89[_0x1d8c('0xd')]+_0x4ead89[_0x1d8c('0xb')]+_0x4ead89['countnosuchnumberretry']+_0x4ead89[_0x1d8c('0xe')]+_0x4ead89[_0x1d8c('0xf')]+_0x4ead89['countmachineretry']+_0x4ead89['countagentrejectretry'];this[_0x1d8c('0x10')]=_0x4ead89[_0x1d8c('0x10')];this['countdropretry']=_0x4ead89[_0x1d8c('0xe')];this[_0x1d8c('0xf')]=_0x4ead89[_0x1d8c('0xf')];this[_0x1d8c('0x11')]=_0x4ead89[_0x1d8c('0x11')];this[_0x1d8c('0x12')]=_0x4ead89[_0x1d8c('0x12')];this[_0x1d8c('0x13')]=_0x3153de['uniqueid'];this[_0x1d8c('0x14')]=_0x4ead89[_0x1d8c('0x15')];this[_0x1d8c('0x16')]=_0x4ead89['number'];this[_0x1d8c('0x17')]=_0x4ead89[_0x1d8c('0x17')];this[_0x1d8c('0x18')]=_0x4ead89[_0x1d8c('0x18')];this[_0x1d8c('0x19')]=moment()[_0x1d8c('0x1a')](_0x1d8c('0x1b'));this[_0x1d8c('0x1c')]=getSeconds(_0x4ead89[_0x1d8c('0x18')],_0x4ead89[_0x1d8c('0x17')]);this[_0x1d8c('0x1d')]=0x0;this[_0x1d8c('0x1e')]=getSeconds(this['endtime'],_0x4ead89[_0x1d8c('0x18')]);this[_0x1d8c('0x1f')]=_0x4ead89[_0x1d8c('0x1f')];this[_0x1d8c('0x20')]=_0x1d8c('0x21');this[_0x1d8c('0x22')]=_0x3153de[_0x1d8c('0x23')];this[_0x1d8c('0x24')]=_0x4ead89[_0x1d8c('0x24')];this[_0x1d8c('0x25')]=_0x4ead89['callbackuniqueid'];this[_0x1d8c('0x26')]=_0x4ead89['callbackat'];this['recallme']=_0x4ead89[_0x1d8c('0x27')];this[_0x1d8c('0x28')]=_0x4ead89[_0x1d8c('0x28')];this[_0x1d8c('0x29')]=_0x4ead89['ListId'];this[_0x1d8c('0x2a')]=_0x4ead89[_0x1d8c('0x2a')];this[_0x1d8c('0x2b')]=_0x4ead89[_0x1d8c('0x2b')];this[_0x1d8c('0x2c')]=_0x4ead89['CampaignId'];}module[_0x1d8c('0x2d')]=Hangup; \ No newline at end of file +var _0xcd8c=['ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x277191,_0x25cf93){var _0x43b42c=function(_0x5cbac3){while(--_0x5cbac3){_0x277191['push'](_0x277191['shift']());}};_0x43b42c(++_0x25cf93);}(_0xcd8c,0x140));var _0xccd8=function(_0x4b2069,_0x46d675){_0x4b2069=_0x4b2069-0x0;var _0x2a2ae5=_0xcd8c[_0x4b2069];return _0x2a2ae5;};'use strict';var util=require(_0xccd8('0x0'));var _=require(_0xccd8('0x1'));var moment=require(_0xccd8('0x2'));function getSeconds(_0x5ecafc,_0x458934){var _0x13ec25=moment(_0x5ecafc)[_0xccd8('0x3')](0x0);var _0x3ac43f=moment(_0x458934)[_0xccd8('0x3')](0x0);return _0x13ec25[_0xccd8('0x4')](_0x3ac43f,_0xccd8('0x5'));}function Hangup(_0x9c8bf0,_0x3c7b20){this['state']=0x4;this[_0xccd8('0x6')]=_0xccd8('0x7');this[_0xccd8('0x8')]=_0x9c8bf0['scheduledat'];this[_0xccd8('0x9')]=_0x9c8bf0[_0xccd8('0x9')];this['campaigntype']=_0x9c8bf0['type']===_0xccd8('0xa')?_0xccd8('0xb'):_0x9c8bf0['type'];this['countbusyretry']=_0x9c8bf0['countbusyretry'];this[_0xccd8('0xc')]=_0x9c8bf0[_0xccd8('0xc')];this[_0xccd8('0xd')]=_0x9c8bf0[_0xccd8('0xd')];this[_0xccd8('0xe')]=_0x9c8bf0[_0xccd8('0xf')]+_0x9c8bf0['countcongestionretry']+_0x9c8bf0[_0xccd8('0xd')]+_0x9c8bf0[_0xccd8('0x10')]+_0x9c8bf0[_0xccd8('0x11')]+_0x9c8bf0[_0xccd8('0x12')]+_0x9c8bf0[_0xccd8('0x13')]+_0x9c8bf0[_0xccd8('0x14')];this['countnosuchnumberretry']=_0x9c8bf0[_0xccd8('0x10')];this['countdropretry']=_0x9c8bf0['countdropretry'];this[_0xccd8('0x12')]=_0x9c8bf0[_0xccd8('0x12')];this[_0xccd8('0x13')]=_0x9c8bf0['countmachineretry'];this['countagentrejectretry']=_0x9c8bf0[_0xccd8('0x14')];this[_0xccd8('0x15')]=_0x3c7b20[_0xccd8('0x15')];this[_0xccd8('0x16')]=_0x9c8bf0[_0xccd8('0x17')];this[_0xccd8('0x18')]=_0x9c8bf0[_0xccd8('0x19')];this[_0xccd8('0x1a')]=_0x9c8bf0[_0xccd8('0x1a')];this[_0xccd8('0x1b')]=_0x9c8bf0[_0xccd8('0x1b')];this[_0xccd8('0x1c')]=moment()[_0xccd8('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xccd8('0x1e')]=getSeconds(_0x9c8bf0[_0xccd8('0x1b')],_0x9c8bf0[_0xccd8('0x1a')]);this[_0xccd8('0x1f')]=0x0;this[_0xccd8('0x20')]=getSeconds(this['endtime'],_0x9c8bf0[_0xccd8('0x1b')]);this['queue']=_0x9c8bf0[_0xccd8('0xb')];this[_0xccd8('0x21')]=_0xccd8('0x22');this[_0xccd8('0x23')]=_0x3c7b20['cause-txt'];this[_0xccd8('0x24')]=_0x9c8bf0[_0xccd8('0x24')];this['callbackuniqueid']=_0x9c8bf0[_0xccd8('0x25')];this['callbackat']=_0x9c8bf0[_0xccd8('0x26')];this[_0xccd8('0x27')]=_0x9c8bf0[_0xccd8('0x27')];this[_0xccd8('0x28')]=_0x9c8bf0[_0xccd8('0x28')];this['ListId']=_0x9c8bf0[_0xccd8('0x29')];this['UserId']=_0x9c8bf0['UserId'];this[_0xccd8('0x2a')]=_0x9c8bf0[_0xccd8('0x2a')];this['CampaignId']=_0x9c8bf0[_0xccd8('0x2b')];}module[_0xccd8('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d3eb4d7..5c75df4 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x407d=['countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x407d,0xac));var _0xd407=function(_0x4d070a,_0x2e44ff){_0x4d070a=_0x4d070a-0x0;var _0x2ed7b0=_0x407d[_0x4d070a];return _0x2ed7b0;};'use strict';var util=require(_0xd407('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2185e1,_0x458762){var _0x1b66b9=moment(_0x2185e1)[_0xd407('0x1')](0x0);var _0x73ebb1=moment(_0x458762)[_0xd407('0x1')](0x0);return _0x1b66b9[_0xd407('0x2')](_0x73ebb1,_0xd407('0x3'));}function History(_0x485f33){this[_0xd407('0x4')]=_0x485f33[_0xd407('0x4')];this[_0xd407('0x5')]=_0x485f33[_0xd407('0x5')]||undefined;this[_0xd407('0x6')]=_0x485f33[_0xd407('0x6')];this[_0xd407('0x7')]=_0x485f33[_0xd407('0x6')]===_0xd407('0x8')?_0xd407('0x9'):_0x485f33['type'];this[_0xd407('0xa')]=_0x485f33['countbusyretry'];this[_0xd407('0xb')]=_0x485f33['countcongestionretry'];this[_0xd407('0xc')]=_0x485f33[_0xd407('0xc')];this[_0xd407('0xd')]=_0x485f33[_0xd407('0xa')]+_0x485f33['countcongestionretry']+_0x485f33['countnoanswerretry']+_0x485f33[_0xd407('0xe')]+_0x485f33[_0xd407('0xf')]+_0x485f33[_0xd407('0x10')]+_0x485f33[_0xd407('0x11')]+_0x485f33[_0xd407('0x12')];this[_0xd407('0xe')]=_0x485f33[_0xd407('0xe')];this[_0xd407('0xf')]=_0x485f33[_0xd407('0xf')];this['countabandonedretry']=_0x485f33[_0xd407('0x10')];this[_0xd407('0x11')]=_0x485f33['countmachineretry'];this['countagentrejectretry']=_0x485f33['countagentrejectretry'];this['queue']=_0x485f33['queue'];this['calleridname']=_0x485f33[_0xd407('0x13')];this[_0xd407('0x14')]=_0x485f33[_0xd407('0x15')];this[_0xd407('0x16')]=_0x485f33[_0xd407('0x16')];this['responsetime']=_0x485f33[_0xd407('0x17')];this[_0xd407('0x18')]=_0x485f33[_0xd407('0x17')];this[_0xd407('0x19')]=getSeconds(_0x485f33[_0xd407('0x17')],_0x485f33[_0xd407('0x16')]);this['holdtime']=0x0;this[_0xd407('0x1a')]=0x0;this['callback']=_0x485f33[_0xd407('0x1b')];this['callbackuniqueid']=_0x485f33[_0xd407('0x1c')];this['callbackat']=_0x485f33['callbackat'];this[_0xd407('0x1d')]=_0x485f33[_0xd407('0x1d')];this[_0xd407('0x1e')]=_0x485f33[_0xd407('0x1e')];this['ListId']=_0x485f33[_0xd407('0x1f')];this[_0xd407('0x20')]=_0x485f33[_0xd407('0x20')];this[_0xd407('0x21')]=_0x485f33[_0xd407('0x21')];this[_0xd407('0x22')]=_0x485f33[_0xd407('0x22')];this['originatecalleridnum']=_0x485f33[_0xd407('0x23')]||'';this[_0xd407('0x24')]=_0x485f33['originatecalleridname']||'';}module[_0xd407('0x25')]=History; \ No newline at end of file +var _0x788d=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue'];(function(_0x1f8e04,_0x51a094){var _0x547de7=function(_0x2ed304){while(--_0x2ed304){_0x1f8e04['push'](_0x1f8e04['shift']());}};_0x547de7(++_0x51a094);}(_0x788d,0x115));var _0xd788=function(_0x4d2b6e,_0x42a5cf){_0x4d2b6e=_0x4d2b6e-0x0;var _0x2022c6=_0x788d[_0x4d2b6e];return _0x2022c6;};'use strict';var util=require('util');var _=require(_0xd788('0x0'));var moment=require(_0xd788('0x1'));function getSeconds(_0x3d57b8,_0xbc86){var _0x334973=moment(_0x3d57b8)['milliseconds'](0x0);var _0x420a70=moment(_0xbc86)[_0xd788('0x2')](0x0);return _0x334973[_0xd788('0x3')](_0x420a70,_0xd788('0x4'));}function History(_0x3d0328){this[_0xd788('0x5')]=_0x3d0328[_0xd788('0x5')];this['scheduledat']=_0x3d0328[_0xd788('0x6')]||undefined;this['type']=_0x3d0328[_0xd788('0x7')];this[_0xd788('0x8')]=_0x3d0328['type']==='outbound'?_0xd788('0x9'):_0x3d0328[_0xd788('0x7')];this['countbusyretry']=_0x3d0328[_0xd788('0xa')];this[_0xd788('0xb')]=_0x3d0328['countcongestionretry'];this[_0xd788('0xc')]=_0x3d0328['countnoanswerretry'];this[_0xd788('0xd')]=_0x3d0328['countbusyretry']+_0x3d0328[_0xd788('0xb')]+_0x3d0328[_0xd788('0xc')]+_0x3d0328[_0xd788('0xe')]+_0x3d0328[_0xd788('0xf')]+_0x3d0328[_0xd788('0x10')]+_0x3d0328[_0xd788('0x11')]+_0x3d0328[_0xd788('0x12')];this['countnosuchnumberretry']=_0x3d0328[_0xd788('0xe')];this[_0xd788('0xf')]=_0x3d0328['countdropretry'];this[_0xd788('0x10')]=_0x3d0328[_0xd788('0x10')];this[_0xd788('0x11')]=_0x3d0328[_0xd788('0x11')];this[_0xd788('0x12')]=_0x3d0328[_0xd788('0x12')];this[_0xd788('0x9')]=_0x3d0328[_0xd788('0x9')];this[_0xd788('0x13')]=_0x3d0328[_0xd788('0x14')];this[_0xd788('0x15')]=_0x3d0328[_0xd788('0x16')];this[_0xd788('0x17')]=_0x3d0328['starttime'];this[_0xd788('0x18')]=_0x3d0328['responsetime'];this[_0xd788('0x19')]=_0x3d0328['responsetime'];this[_0xd788('0x1a')]=getSeconds(_0x3d0328[_0xd788('0x18')],_0x3d0328[_0xd788('0x17')]);this[_0xd788('0x1b')]=0x0;this[_0xd788('0x1c')]=0x0;this[_0xd788('0x1d')]=_0x3d0328[_0xd788('0x1d')];this['callbackuniqueid']=_0x3d0328[_0xd788('0x1e')];this['callbackat']=_0x3d0328[_0xd788('0x1f')];this[_0xd788('0x20')]=_0x3d0328[_0xd788('0x20')];this[_0xd788('0x21')]=_0x3d0328[_0xd788('0x21')];this[_0xd788('0x22')]=_0x3d0328[_0xd788('0x22')];this[_0xd788('0x23')]=_0x3d0328[_0xd788('0x23')];this[_0xd788('0x24')]=_0x3d0328['VoiceQueueId'];this[_0xd788('0x25')]=_0x3d0328[_0xd788('0x25')];this[_0xd788('0x26')]=_0x3d0328['originatecalleridnum']||'';this['originatecalleridname']=_0x3d0328[_0xd788('0x27')]||'';}module[_0xd788('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9ec9829..5a8d9c1 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 _0x1653=['IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','loopClearZombieChannels','clearZombieChannels','[actions]','undefined','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','isSuccess','SIP/%s','status','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','countabandonedretry','stateGlobal','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','Unknow','[syncHangupIvr][createHistory]','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Intervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','timezones','indexOf','true','command','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','NONE','\x22agi://%s/square,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalAvgHoldtime','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','md5','voice:queue:%s','voice_queue:save','ivr','format','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','NOT_ACTIVE'];(function(_0x5d9699,_0xaa1737){var _0x3963c2=function(_0xdee70d){while(--_0xdee70d){_0x5d9699['push'](_0x5d9699['shift']());}};_0x3963c2(++_0xaa1737);}(_0x1653,0x17c));var _0x3165=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x1653[_0x2cef86];return _0x46dfd6;};'use strict';var util=require(_0x3165('0x0'));var _=require(_0x3165('0x1'));var BPromise=require(_0x3165('0x2'));var uuid=require('uuid');var moment=require(_0x3165('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x3165('0x4'));var ut=require('../preview/util/util');var config=require(_0x3165('0x5'));var logger=require(_0x3165('0x6'))(_0x3165('0x7'));var loggerBooked=require(_0x3165('0x6'))(_0x3165('0x8'));var loggerPredictive=require(_0x3165('0x6'))(_0x3165('0x9'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x3165('0xa'));var ami=require(_0x3165('0xb'));config[_0x3165('0xc')]=_['defaults'](config[_0x3165('0xc')],{'host':_0x3165('0xd'),'port':0x18eb});var io=require(_0x3165('0xe'))(new Redis(config[_0x3165('0xc')]));var cmHopper=require(_0x3165('0xf'));var cmHopperHistory=require(_0x3165('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x3165('0x11'));var Action=require('./action');var History=require(_0x3165('0x12'));var Final=require('./final');var AgentComplete=require(_0x3165('0x13'));var QueueCallerAbandon=require(_0x3165('0x14'));var Hangup=require(_0x3165('0x15'));var ipAgi=process['env'][_0x3165('0x16')]||_0x3165('0x17');var strategy={'rrmemory':_0x3165('0x18'),'roundrobin':_0x3165('0x19')};var Sequence=function(){};Sequence[_0x3165('0x1a')]['enqueue']=function(_0x185d68){this['tail']=this[_0x3165('0x1b')]?this[_0x3165('0x1b')][_0x3165('0x1c')](_0x185d68):_0x185d68();};function Dialer(_0x312e7f,_0x32b6dd){this[_0x3165('0x1d')]=new Sequence();this[_0x3165('0x1e')]=_0x32b6dd;this[_0x3165('0x1f')]=_0x312e7f['voiceQueues'];this[_0x3165('0x20')]=_0x312e7f[_0x3165('0x20')];this[_0x3165('0x21')]=_0x312e7f['agents'];this['trunks']=_0x312e7f[_0x3165('0x22')];this[_0x3165('0x23')]=config[_0x3165('0x23')]||0x2;this[_0x3165('0x24')]={};this[_0x3165('0x25')]={};this[_0x3165('0x26')]={};this[_0x3165('0x27')]={};this[_0x3165('0x28')]={};this[_0x3165('0x29')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x3165('0x2a')]={};this[_0x3165('0x2b')]={};ami['on'](_0x3165('0x2c'),this[_0x3165('0x2d')][_0x3165('0x2e')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x3165('0x2f')][_0x3165('0x2e')](this));ami['on'](_0x3165('0x30'),this[_0x3165('0x31')][_0x3165('0x2e')](this));ami['on']('custom:queuesummary',this[_0x3165('0xa')]['bind'](this));ami['on'](_0x3165('0x32'),this[_0x3165('0x33')][_0x3165('0x2e')](this));ami['on']('newexten',this[_0x3165('0x34')]['bind'](this));ami['on'](_0x3165('0x35'),this[_0x3165('0x36')][_0x3165('0x2e')](this));ami['on']('queuemember',this[_0x3165('0x37')]['bind'](this));ami['on'](_0x3165('0x38'),this['syncQueueStatusComplete'][_0x3165('0x2e')](this));this[_0x3165('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x3ed05a){return _0x3ed05a!==null&&!_[_0x3165('0x3a')](_0x3ed05a);}function checkIsLoggedIn(_0x5e94e6,_0x3dc73b){return function(){if(_0x3dc73b<=0x0){_0x5e94e6[_0x3165('0x3b')]=_0x3165('0x3c');throw _0x5e94e6[_0x3165('0x3d')]+_0x3165('0x3e');}};}function isActive(_0x59fd14){return _0x59fd14;}function checkIsActive(_0x4293d4,_0x2dc450){return function(){if(!isActive(_0x2dc450)){_0x4293d4[_0x3165('0x3b')]='NOT_ACTIVE';throw _0x4293d4[_0x3165('0x3d')]+_0x3165('0x3f');}};}function checkInterval(_0x5e7892){return function(){if(!isNotNull(_0x5e7892[_0x3165('0x40')])){_0x5e7892[_0x3165('0x3b')]='INTERVAL_IS_NULL';throw _0x5e7892[_0x3165('0x3d')]+_0x3165('0x41');}if(!isNotNull(_0x5e7892['Interval']['Intervals'])){_0x5e7892[_0x3165('0x3b')]=_0x3165('0x42');throw _0x5e7892['name']+_0x3165('0x41');}if(!isNotNull(_[_0x3165('0x43')](_0x5e7892['Interval']['Intervals']))){_0x5e7892[_0x3165('0x3b')]=_0x3165('0x42');throw _0x5e7892[_0x3165('0x3d')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x7820be,_0x4a2139,_0x1e8f58){return{'action':_0x7820be,'response':_0x4a2139,'message':_0x1e8f58,'stack':_0x1e8f58};}function myreject(_0x54d772){return function(_0x17e49d){return _0x54d772(msgResponse(_0x3165('0x44'),_0x3165('0x45'),JSON[_0x3165('0x46')](_0x17e49d)));};}function getSeconds(_0x10029a,_0x2faa87){var _0x8c1d79=moment(_0x10029a)[_0x3165('0x47')](0x0);var _0x2fb9b9=moment(_0x2faa87)[_0x3165('0x47')](0x0);return _0x8c1d79[_0x3165('0x48')](_0x2fb9b9,_0x3165('0x49'));}function emit(_0x50696d,_0x264810,_0x52ecad){io['to'](_0x50696d)[_0x3165('0x4a')](_0x264810,_0x52ecad);}function emitVoiceQueueSummary(_0x76d6bf){if(_0x76d6bf[_0x3165('0x4b')]===_0x3165('0x4c')){var _0x4b365f={'id':_0x76d6bf['id'],'name':_0x76d6bf[_0x3165('0x3d')],'strategy':_0x76d6bf['strategy'],'answered':_0x76d6bf[_0x3165('0x4d')],'available':_0x76d6bf[_0x3165('0x4e')],'loggedIn':_0x76d6bf[_0x3165('0x4f')],'pTalking':_0x76d6bf['pTalking'],'sumBillable':_0x76d6bf[_0x3165('0x50')],'sumDuration':_0x76d6bf[_0x3165('0x51')],'sumHoldTime':_0x76d6bf[_0x3165('0x52')]||0x0,'talking':_0x76d6bf[_0x3165('0x53')],'total':_0x76d6bf[_0x3165('0x54')],'type':_0x76d6bf[_0x3165('0x4b')],'unmanaged':_0x76d6bf[_0x3165('0x55')],'abandoned':_0x76d6bf['abandoned'],'waiting':_0x76d6bf[_0x3165('0x56')],'loggedInDb':_0x76d6bf[_0x3165('0x57')],'dialActive':_0x76d6bf[_0x3165('0x58')],'dialMethod':_0x76d6bf[_0x3165('0x59')],'dialOriginateCallerIdName':_0x76d6bf[_0x3165('0x5a')],'dialOriginateCallerIdNumber':_0x76d6bf['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x76d6bf['dialOriginateTimeout'],'dialPrefix':_0x76d6bf['dialPrefix'],'outboundAnswerAgiCallsDay':_0x76d6bf['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x76d6bf[_0x3165('0x5b')],'outboundBlacklistCallsDay':_0x76d6bf[_0x3165('0x5c')],'outboundBusyCallsDay':_0x76d6bf[_0x3165('0x5d')],'outboundCongestionCallsDay':_0x76d6bf[_0x3165('0x5e')],'outboundDropCallsDayACS':_0x76d6bf[_0x3165('0x5f')],'outboundDropCallsDayCallersExit':_0x76d6bf[_0x3165('0x60')],'outboundDropCallsDayTimeout':_0x76d6bf[_0x3165('0x61')],'outboundNoAnswerCallsDay':_0x76d6bf[_0x3165('0x62')],'outboundNoSuchCallsDay':_0x76d6bf['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x76d6bf[_0x3165('0x63')],'outboundReCallsDay':_0x76d6bf['outboundReCallsDay'],'outboundRejectCallsDay':_0x76d6bf[_0x3165('0x64')],'outboundUnknownCallsDay':_0x76d6bf[_0x3165('0x65')],'predictiveIntervalAnsweredCalls':_0x76d6bf['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x76d6bf['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x76d6bf[_0x3165('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x76d6bf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x76d6bf['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x76d6bf[_0x3165('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x76d6bf['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x76d6bf[_0x3165('0x68')],'predictiveIntervalMultiplicativeFactor':_0x76d6bf[_0x3165('0x69')],'predictiveIntervalPauses':_0x76d6bf[_0x3165('0x6a')],'predictiveIntervalAvailable':_0x76d6bf[_0x3165('0x6b')],'predictiveIntervalTotalCalls':_0x76d6bf[_0x3165('0x6c')],'message':_0x76d6bf['message'],'originated':_0x76d6bf[_0x3165('0x6d')],'erlangCalls':_0x76d6bf[_0x3165('0x6e')],'erlangCallToSecond':_0x76d6bf[_0x3165('0x6f')],'erlangAbandonmentRate':_0x76d6bf[_0x3165('0x70')],'erlangBusyFactor':_0x76d6bf[_0x3165('0x71')],'startPredictive':_0x76d6bf[_0x3165('0x29')],'startProgressive':_0x76d6bf[_0x3165('0x72')]};if(_0x76d6bf['Trunk']){_0x4b365f[_0x3165('0x73')]={'id':_0x76d6bf['Trunk']['id'],'name':_0x76d6bf[_0x3165('0x73')][_0x3165('0x3d')],'active':_0x76d6bf[_0x3165('0x73')][_0x3165('0x74')],'callerid':_0x76d6bf[_0x3165('0x73')]['callerid']};}if(_0x76d6bf['Interval']){_0x4b365f['Interval']={'id':_0x76d6bf[_0x3165('0x40')]['id'],'name':_0x76d6bf['Interval'][_0x3165('0x3d')]};}var _0x46126c=md5(JSON[_0x3165('0x46')](_0x4b365f));if(_0x76d6bf[_0x3165('0x75')]!==_0x46126c){_0x76d6bf['md5']=_0x46126c;emit(util['format'](_0x3165('0x76'),_0x4b365f[_0x3165('0x3d')]),_0x3165('0x77'),_0x4b365f);}}}function emitCampaignSummary(_0x3e3425){if(_0x3e3425[_0x3165('0x4b')]===_0x3165('0x78')){emit(util[_0x3165('0x79')]('campaign:ivr:%s',_0x3e3425['name']),_0x3165('0x7a'),_0x3e3425);}}function checkGetDataPredictive(_0x29f0c2){if(isNotNull(_0x29f0c2)&&!_['isEmpty'](_0x29f0c2)){loggerPredictive[_0x3165('0x7b')](_0x3165('0x7c'));loggerPredictive[_0x3165('0x7b')](_0x3165('0x7d'),_0x29f0c2[_0x3165('0x6c')]);loggerPredictive['info'](_0x3165('0x7e'),_0x29f0c2['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x3165('0x7b')](_0x3165('0x7f'),_0x29f0c2[_0x3165('0x80')]);loggerPredictive[_0x3165('0x7b')](_0x3165('0x81'),_0x29f0c2[_0x3165('0x82')]);loggerPredictive[_0x3165('0x7b')](_0x3165('0x83'),_0x29f0c2['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3165('0x7b')](_0x3165('0x84'),_0x29f0c2[_0x3165('0x66')]);loggerPredictive[_0x3165('0x7b')](_0x3165('0x85'));if(_0x29f0c2[_0x3165('0x6c')]>0x0){if(!_[_0x3165('0x3a')](_0x29f0c2['predictiveIntervalAvgTalktime'])&&_0x29f0c2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x3165('0x86'));if(!_['isUndefined'](_0x29f0c2['predictiveIntervalAvgHoldtime'])&&_0x29f0c2['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x3165('0x7b')](_0x3165('0x87'));}else{loggerPredictive[_0x3165('0x7b')](_0x3165('0x88'));}}else{loggerPredictive[_0x3165('0x7b')](_0x3165('0x89'));}return![];}function mergeDataErlangB(_0x484f45){return function(_0x57c21c){loggerPredictive[_0x3165('0x7b')](_0x3165('0x8a'));loggerPredictive[_0x3165('0x7b')](_0x3165('0x8b'),_0x57c21c[_0x3165('0x6e')]);loggerPredictive[_0x3165('0x7b')](_0x3165('0x8c'),_0x57c21c[_0x3165('0x6f')]);loggerPredictive['info'](_0x3165('0x8d'),_0x57c21c[_0x3165('0x70')]);loggerPredictive[_0x3165('0x7b')](_0x3165('0x8e'),_0x57c21c[_0x3165('0x71')]);loggerPredictive['info'](_0x3165('0x8d'),_0x57c21c[_0x3165('0x70')]);loggerPredictive[_0x3165('0x7b')]('---------------------------');_[_0x3165('0x8f')](_0x484f45,_0x57c21c);};}function getDiff(_0x2615d1){var _0x46051b=moment()['milliseconds'](0x0);var _0x14237e=moment(_0x2615d1)[_0x3165('0x47')](0x0);return _0x46051b['diff'](_0x14237e,_0x3165('0x49'));}function ifInterval(_0x4ced1b,_0x2eabbc){if(_[_0x3165('0x3a')](_0x2eabbc)){return![];}return getDiff(_0x2eabbc)<_0x4ced1b*0x3c;}function freeVariablesPredictive(_0x3e3608){if(isNotNull(_0x3e3608)){if(!_[_0x3165('0x3a')](_0x3e3608[_0x3165('0x72')])){_0x3e3608[_0x3165('0x72')]=undefined;loggerPredictive[_0x3165('0x7b')](_0x3e3608['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x3165('0x3a')](_0x3e3608[_0x3165('0x29')])){_0x3e3608[_0x3165('0x29')]=undefined;loggerPredictive['info'](_0x3e3608[_0x3165('0x3d')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x3165('0x3a')](_0x3e3608['handlePredictive'])){clearInterval(_0x3e3608[_0x3165('0x90')]);_0x3e3608[_0x3165('0x90')]=undefined;loggerPredictive[_0x3165('0x7b')](_0x3e3608[_0x3165('0x3d')],_0x3165('0x91'));}}}function erlangb(_0x35df54,_0x265d2f){if(_0x265d2f===0x0){return 0x0;}var _0x3c9c05=0x1;for(var _0x1d93fa=0x1;_0x1d93fa<=_0x265d2f;_0x1d93fa+=0x1){_0x3c9c05=0x1+_0x3c9c05*_0x1d93fa/_0x35df54;}return 0x1/_0x3c9c05;}function isVoiceQueueOutbound(_0x6affd){return _0x6affd===_0x3165('0x4c');}function isNotPreview(_0x36d466){return _0x36d466!=='preview';}function isCampaignIvr(_0x10e746){return _0x10e746==='ivr';}function getCallerId(_0x26fb99,_0x513f43,_0x3409a4){if(!_['isUndefined'](_0x3409a4)&&typeof _0x3409a4===_0x3165('0x92')&&!_[_0x3165('0x43')](_0x3409a4)){if(!_[_0x3165('0x3a')](_0x513f43)&&typeof _0x513f43===_0x3165('0x92')&&!_['isEmpty'](_0x513f43)){return util[_0x3165('0x79')]('\x22%s\x22\x20<%s>',_0x513f43,_0x3409a4);}return util[_0x3165('0x79')]('\x22%s\x22\x20<%s>',_0x3409a4,_0x3409a4);}if(!_[_0x3165('0x3a')](_0x26fb99)&&typeof _0x26fb99===_0x3165('0x92')&&!_[_0x3165('0x43')](_0x26fb99)){return _0x26fb99;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2e6acb,_0x394410){return function(_0x27e0df){freeVariablesPredictive(_0x394410);emitVoiceQueueSummary(_0x394410);emitCampaignSummary(_0x394410);loggerSyncQueueSummary['error'](_0x2e6acb,util[_0x3165('0x93')](_0x27e0df,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x362aac,_0x5311d1){return function(_0x28b5ec){loggerPredictive['error'](_0x5311d1[_0x3165('0x3d')],_0x362aac);loggerPredictive[_0x3165('0x94')](_0x28b5ec[_0x3165('0x95')]);freeVariablesPredictive(_0x5311d1);};}function loggerCatch(_0x6e33ec){return function(_0xf87a22){logger[_0x3165('0x94')](_0x6e33ec,util[_0x3165('0x93')](_0xf87a22,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2d98ca){return _0x2d98ca&&!_['isUndefined'](_0x2d98ca)&&_0x2d98ca[_0x3165('0x96')]>0x0;}function decremetOriginate(_0x114d49){if(!_['isUndefined'](_0x114d49)&&_0x114d49!==null){if(typeof _0x114d49[_0x3165('0x6d')]!=='undefined'){if(_0x114d49[_0x3165('0x6d')]>0x0){_0x114d49[_0x3165('0x6d')]-=0x1;}else{logger['error'](_0x3165('0x97'));}}}else{logger[_0x3165('0x94')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x1fdc23,_0x567664,_0x2c9861){if(_0x567664>_0x2c9861){for(var _0x4ecbd5=0x0;_0x4ecbd5<_0x567664-_0x2c9861;_0x4ecbd5+=0x1){decremetOriginate(_0x1fdc23);}}}function loggerGetContactDialer(_0x3e3889,_0x343a8f,_0x4e45b3){return function(_0x474365){checkContactLowerLimitOriginate(_0x343a8f,_0x4e45b3,0x0);logger[_0x3165('0x94')](_0x3e3889,util[_0x3165('0x93')](_0x474365,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x583f8f){return function(_0x3cac5d){if(isNotNull(_0x3cac5d)&&isNotNull(_0x3cac5d[0x0])){if(_0x3cac5d[0x0]['contactsRescheduled']>0x0){_0x583f8f[_0x3165('0x3b')]=_0x3165('0x98');logger[_0x3165('0x7b')](_0x3165('0x99')+_0x583f8f[_0x3165('0x3d')],_0x3cac5d[0x0][_0x3165('0x9a')],_0x3165('0x9b'));}else{_0x583f8f['message']=_0x3165('0x9c');logger[_0x3165('0x7b')](_0x3165('0x9d')+_0x583f8f[_0x3165('0x3d')]);}}};}function notSendMessagesQueue(_0x2d3fe3){if(_0x2d3fe3[_0x3165('0x9e')]){freeVariablesPredictive(_0x2d3fe3);if(_0x2d3fe3[_0x3165('0x6d')]===0x0&&_0x2d3fe3[_0x3165('0x53')]===0x0&&_0x2d3fe3[_0x3165('0x56')]===0x0&&(_0x2d3fe3[_0x3165('0x9f')]||0x0)===0x0){_0x2d3fe3['sendMessageOneNotActive']=![];_0x2d3fe3[_0x3165('0x4e')]=0x0;_0x2d3fe3[_0x3165('0x3b')]=_0x3165('0xa0');loggerSyncQueueSummary[_0x3165('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2d3fe3[_0x3165('0x3d')],'is\x20not\x20active');}else{_0x2d3fe3[_0x3165('0x3b')]=_0x3165('0xa1');loggerSyncQueueSummary[_0x3165('0x94')](_0x3165('0xa2'),_0x2d3fe3['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x2d3fe3);}}function notSendMessagesCampaign(_0x521dad){if(_0x521dad[_0x3165('0x9e')]){if(_0x521dad[_0x3165('0x6d')]===0x0){_0x521dad['sendMessageOneNotActive']=![];_0x521dad['message']=_0x3165('0xa0');loggerSyncQueueSummary[_0x3165('0x94')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x521dad[_0x3165('0x3d')],_0x3165('0xa3'));}else{_0x521dad[_0x3165('0x3b')]=_0x3165('0xa1');loggerSyncQueueSummary[_0x3165('0x94')](_0x3165('0xa4'),_0x521dad[_0x3165('0x3d')],_0x3165('0xa5'));}emitCampaignSummary(_0x521dad);}}function createObjHistory(_0x3d87ea,_0x1f7861,_0x410bbd,_0x19f4ab,_0x2066f0){_0x3d87ea[_0x3165('0x3b')]=_0x410bbd;var _0x4a8547=new Action(_0x3d87ea,_0x1f7861);var _0x27184b=new History(_0x4a8547);_0x27184b[_0x3165('0xa6')]=_0x19f4ab;_0x27184b[_0x3165('0xa7')]=_0x2066f0;_0x27184b[_0x3165('0xa8')]=_0x4a8547['starttime'];return _0x27184b;}Dialer['prototype'][_0x3165('0xa9')]=function(){var _0x59a2e9=this;setInterval(function(){_0x59a2e9[_0x3165('0xaa')](_0x59a2e9['uniqueId'],'[uniqueid]');_0x59a2e9[_0x3165('0xaa')](_0x59a2e9[_0x3165('0x25')],_0x3165('0xab'));},0x32c8);};Dialer[_0x3165('0x1a')]['clearZombieChannels']=function(_0x3e3ef9,_0x48024a){var _0x2d9648=this;for(var _0x3f5ec4 in _0x3e3ef9){if(typeof _0x3e3ef9[_0x3f5ec4]!==_0x3165('0xac')){this[_0x3165('0x1d')][_0x3165('0xad')](function(){if(!_[_0x3165('0xae')](_0x3e3ef9[_0x3f5ec4])){return ami[_0x3165('0xaf')]({'action':'status','channel':_0x3e3ef9[_0x3f5ec4][_0x3165('0xb0')]})[_0x3165('0xb1')](function(_0x21cdd4){if(_0x21cdd4['message']===_0x3165('0xb2')){setTimeout(function(){if(_0x3e3ef9[_0x3f5ec4]&&_0x3e3ef9[_0x3f5ec4]['type']!==_0x3165('0x78')){_0x2d9648[_0x3165('0xb3')](_0x2d9648['voiceQueues'][_0x3e3ef9[_0x3f5ec4][_0x3165('0xb4')]]);logger['error']('[Dialer][checkChannel]',_0x48024a,_0x3f5ec4,_0x3e3ef9[_0x3f5ec4][_0x3165('0xb4')]);delete _0x3e3ef9[_0x3f5ec4];}if(_0x3e3ef9[_0x3f5ec4]&&_0x3e3ef9[_0x3f5ec4][_0x3165('0x4b')]===_0x3165('0x78')){_0x2d9648[_0x3165('0xb3')](_0x2d9648['campaigns'][_0x3e3ef9[_0x3f5ec4][_0x3165('0xb4')]]);logger[_0x3165('0x94')]('[Dialer][checkChannel][ivr]',_0x48024a,_0x3f5ec4,_0x3e3ef9[_0x3f5ec4][_0x3165('0xb4')]);delete _0x3e3ef9[_0x3f5ec4];}},0x2328);}});}});}}};Dialer[_0x3165('0x1a')][_0x3165('0xb5')]=function(_0x55e770){return BPromise['resolve']()['then'](cmHopper[_0x3165('0xb5')](_0x55e770))[_0x3165('0xb1')](loggerCatch(_0x3165('0xb6')));};Dialer['prototype'][_0x3165('0xb7')]=function(_0x4edaab){return BPromise['resolve']()[_0x3165('0xb8')](cmHopperBlack[_0x3165('0xb7')](_0x4edaab))['catch'](loggerCatch(_0x3165('0xb9')));};Dialer[_0x3165('0x1a')][_0x3165('0xba')]=function(_0x1a0fce){return BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](cmHopperBlack[_0x3165('0xba')](_0x1a0fce))[_0x3165('0xb1')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x3165('0x1a')]['averageHandleTime']=function(_0x103172){return BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](cmHopperHistory[_0x3165('0xbc')](_0x103172))[_0x3165('0xb1')](loggerCatch(_0x3165('0xbd')));};Dialer[_0x3165('0x1a')][_0x3165('0xbe')]=function(_0x440278){return BPromise[_0x3165('0xbb')]()['then'](cmHopper[_0x3165('0xbe')](_0x440278))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x3165('0x1a')]['unlockContact']=function(_0x18b02f,_0x2073c2,_0x129b6c){return BPromise[_0x3165('0xbb')]()['then'](cmHopper[_0x3165('0xbf')](_0x18b02f,_0x2073c2,_0x129b6c))['catch'](loggerCatch(_0x3165('0xc0')));};Dialer['prototype'][_0x3165('0xc1')]=function(_0x233daf,_0x5c7308,_0x1f31f5,_0x429442,_0x509c23){return BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](cmHopper[_0x3165('0xc1')](_0x233daf,_0x5c7308,_0x1f31f5,_0x429442))[_0x3165('0xb1')](function(_0x14ccf4){_0x509c23[_0x3165('0xc2')]-=_0x1f31f5;_0x509c23['temp']=_0x509c23['temp']>0x0?_0x509c23[_0x3165('0xc2')]:0x0;loggerCatch(_0x3165('0xc3'))(_0x14ccf4);});};Dialer[_0x3165('0x1a')][_0x3165('0xc4')]=function(_0x50447b,_0x17f88c,_0x1dfb76,_0x3e54f5){return BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](cmHopper['getContactDialerIvr'](_0x50447b,_0x17f88c,_0x1dfb76))[_0x3165('0xb1')](function(_0x57a228){_0x3e54f5[_0x3165('0xc2')]-=_0x17f88c;_0x3e54f5['temp']=_0x3e54f5[_0x3165('0xc2')]>0x0?_0x3e54f5[_0x3165('0xc2')]:0x0;loggerCatch(_0x3165('0xc5'))(_0x57a228);});};Dialer['prototype'][_0x3165('0xc6')]=function(_0x22435c){return BPromise['resolve']()[_0x3165('0xb8')](voiceQueueRt[_0x3165('0xc6')](_0x22435c))[_0x3165('0xb1')](loggerCatch(_0x3165('0xc7')));};Dialer['prototype'][_0x3165('0xc8')]=function(_0x4f2dc2){return BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](cmHopper[_0x3165('0xc8')](_0x4f2dc2))[_0x3165('0xb1')](loggerCatch(_0x3165('0xc9')));};Dialer['prototype']['createHistory']=function(_0x28b11f){return BPromise['resolve']()['then'](cmHopperHistory[_0x3165('0xca')](_0x28b11f))[_0x3165('0xb1')](loggerCatch(_0x3165('0xcb')));};Dialer[_0x3165('0x1a')][_0x3165('0xb3')]=function(_0x1b1d16){if(!_[_0x3165('0x3a')](_0x1b1d16)&&_0x1b1d16!==null){if(typeof _0x1b1d16[_0x3165('0x6d')]!==_0x3165('0xac')){if(_0x1b1d16['originated']>0x0){_0x1b1d16[_0x3165('0x6d')]-=0x1;}else{logger['error'](_0x3165('0xcc'));}}}else{logger[_0x3165('0x94')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3165('0x1a')]['loggerHandler']=function(_0x1e6e86,_0x1727d1){var _0x2ff9e5=this;return function(_0x30458b){_0x2ff9e5[_0x3165('0xb3')](_0x1727d1);logger['error'](_0x1e6e86,util[_0x3165('0x93')](_0x30458b,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x3165('0xcd')]=function(_0x4a7d75,_0x4e2170,_0x3e8a99){var _0x59f2fb={'state':0x19,'statedesc':_0x3165('0xce')};this['updateOriginated'](_0x4e2170);this[_0x3165('0xcf')](_[_0x3165('0x8f')](_0x59f2fb,_[_0x3165('0xd0')](_0x3e8a99,[_0x3165('0xd1'),_0x3165('0xd2'),_0x3165('0xd3'),_0x3165('0xd4'),_0x3165('0xd5')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x3165('0x94')](_0x4a7d75);};Dialer[_0x3165('0x1a')][_0x3165('0xd6')]=function(_0x5b130e){return _0x5b130e==='Success';};Dialer[_0x3165('0x1a')]['isTrunkReachable']=function(_0x41ad26){return!_['isUndefined'](_0x41ad26)&&_0x41ad26&&!_[_0x3165('0x3a')](_0x41ad26[_0x3165('0x3d')])&&!_[_0x3165('0x3a')](_0x41ad26['active'])&&_0x41ad26[_0x3165('0x74')]&&(this[_0x3165('0x22')][util[_0x3165('0x79')](_0x3165('0xd7'),_0x41ad26[_0x3165('0x3d')])]['status']==='reachable'||this['trunks'][util[_0x3165('0x79')](_0x3165('0xd7'),_0x41ad26[_0x3165('0x3d')])][_0x3165('0xd8')]===_0x3165('0xd9'));};Dialer['prototype'][_0x3165('0xcf')]=function(_0x180d62,_0x25bfb5,_0x1cce5c){this[_0x3165('0xca')](_0x180d62)[_0x3165('0xb1')](loggerCatch(_0x25bfb5));this[_0x3165('0xc8')](_0x180d62)[_0x3165('0xb1')](loggerCatch(_0x1cce5c));};Dialer[_0x3165('0x1a')][_0x3165('0x36')]=function(_0x17cc02){var _0x60cdbe=this['uniqueId'][_0x17cc02[_0x3165('0xda')]];var _0x2e566f;if(!_[_0x3165('0xae')](_0x17cc02)&&!_[_0x3165('0xae')](_0x17cc02[_0x3165('0xdb')])&&!_[_0x3165('0xae')](_0x17cc02[_0x3165('0xdb')][_0x3165('0xdc')])&&_0x17cc02[_0x3165('0xdd')]===_0x3165('0xde')&&_0x60cdbe){if(_0x60cdbe['type']!==_0x3165('0x78')&&this[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]][_0x3165('0xdf')]&&_0x17cc02[_0x3165('0xe0')]===_0x3165('0xe1')){delete this['uniqueId'][_0x17cc02[_0x3165('0xda')]];this[_0x3165('0xb3')](this[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]]);this[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]][_0x3165('0x5b')]+=0x1;this[_0x3165('0x1f')][_0x60cdbe['queue']][_0x3165('0xe2')]+=0x1;_0x2e566f=new Hangup(_0x60cdbe,_0x17cc02);_0x2e566f[_0x3165('0xa6')]=0x12;_0x2e566f['statedesc']='HangupInAMD';_0x2e566f[_0x3165('0xe3')]='AMD';ami['emit'](_0x3165('0xe4'),ut[_0x3165('0xe5')](_0x2e566f,_0x3165('0xe6')));this['saveInDb'](_0x2e566f,'[syncHangupInAMD][createHistory]',_0x3165('0xe7'));}if(_0x60cdbe[_0x3165('0x4b')]!==_0x3165('0x78')&&this[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]][_0x3165('0xdf')]&&_0x17cc02[_0x3165('0xe0')]===_0x3165('0xe8')){var _0x155833=this;return new BPromise(function(_0x2521e8,_0x1e225e){delete _0x155833[_0x3165('0x27')][_0x17cc02['uniqueid']];_0x155833[_0x3165('0xb3')](_0x155833[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]]);_0x155833[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]][_0x3165('0x5b')]+=0x1;_0x155833[_0x3165('0x1f')][_0x60cdbe[_0x3165('0xb4')]][_0x3165('0xe2')]+=0x1;var _0x37b7e5=_0x155833[_0x3165('0x1f')][_0x60cdbe['queue']];var _0x13cbec=new Hangup(_0x60cdbe,_0x17cc02);_0x13cbec[_0x3165('0xa6')]=0x13;_0x13cbec['statedesc']=_0x3165('0xe9');_0x13cbec[_0x3165('0xe3')]=_0x3165('0xea');_0x13cbec[_0x3165('0xeb')]+=0x1;_0x13cbec['countglobal']+=0x1;_0x13cbec[_0x3165('0xe6')]=!![];ami[_0x3165('0x4a')](_0x3165('0xe4'),ut[_0x3165('0xe5')](_0x13cbec,_0x3165('0xe6')));_0x155833[_0x3165('0xca')](_0x13cbec)[_0x3165('0xb1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x13cbec[_0x3165('0xec')]+_0x13cbec[_0x3165('0xed')]+_0x13cbec['countnoanswerretry']+_0x13cbec[_0x3165('0xee')]+_0x13cbec[_0x3165('0xef')]+_0x13cbec['countabandonedretry']+_0x13cbec[_0x3165('0xeb')]+_0x13cbec[_0x3165('0xf0')]>=_0x37b7e5[_0x3165('0xf1')]){_0x155833['stateGlobal'](_0x13cbec,_0x2521e8,_0x1e225e,_0x3165('0xf2'));}else{if(_0x13cbec[_0x3165('0xeb')]>=_0x37b7e5[_0x3165('0xf3')]){_0x155833[_0x3165('0xf4')](_0x13cbec,_0x2521e8,_0x1e225e,'reason\x2019\x20machine....');}else{_0x155833[_0x3165('0xbe')]({'active':![],'countmachineretry':_0x13cbec[_0x3165('0xeb')],'scheduledat':moment()[_0x3165('0xf5')](_0x37b7e5['dialMachineRetryFrequency'],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x13cbec[_0x3165('0xd1')],'ListId':_0x13cbec['ListId'],'VoiceQueueId':_0x13cbec[_0x3165('0xd4')]||undefined,'CampaignId':_0x13cbec[_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch('[rescheduleContact][Machine]'));_0x2521e8({'reschedule':0x1});}}});}if(_0x60cdbe[_0x3165('0x4b')]===_0x3165('0x78')&&this[_0x3165('0x20')][_0x60cdbe[_0x3165('0xb4')]]['dialAMDActive']&&_0x17cc02[_0x3165('0xe0')]==='HANGUP'){delete this[_0x3165('0x27')][_0x17cc02[_0x3165('0xda')]];this['updateOriginated'](this[_0x3165('0x20')][_0x60cdbe[_0x3165('0xb4')]]);_0x2e566f=new Hangup(_0x60cdbe,_0x17cc02);_0x2e566f[_0x3165('0xa6')]=0x12;_0x2e566f[_0x3165('0xa7')]=_0x3165('0xf8');_0x2e566f[_0x3165('0xe3')]='AMD';ami[_0x3165('0x4a')]('custom:amd',ut[_0x3165('0xe5')](_0x2e566f,'amd'));this[_0x3165('0xcf')](_0x2e566f,_0x3165('0xf9'),_0x3165('0xfa'));}if(_0x60cdbe[_0x3165('0x4b')]===_0x3165('0x78')&&this[_0x3165('0x20')][_0x60cdbe['queue']][_0x3165('0xdf')]&&_0x17cc02['value']===_0x3165('0xe8')){var _0x155833=this;return new BPromise(function(_0x245a01,_0x37afbd){delete _0x155833['uniqueId'][_0x17cc02['uniqueid']];_0x155833[_0x3165('0xb3')](_0x155833[_0x3165('0x20')][_0x60cdbe[_0x3165('0xb4')]]);_0x155833[_0x3165('0x20')][_0x60cdbe['queue']]['outboundAnswerCallsDay']+=0x1;_0x155833['campaigns'][_0x60cdbe[_0x3165('0xb4')]][_0x3165('0xe2')]+=0x1;var _0x37ded4=_0x155833['campaigns'][_0x60cdbe[_0x3165('0xb4')]];var _0x117e5b=new Hangup(_0x60cdbe,_0x17cc02);_0x117e5b[_0x3165('0xa6')]=0x13;_0x117e5b[_0x3165('0xa7')]=_0x3165('0xe9');_0x117e5b['membername']=_0x3165('0xea');_0x117e5b['countmachineretry']+=0x1;_0x117e5b['countglobal']+=0x1;_0x117e5b[_0x3165('0xe6')]=!![];ami[_0x3165('0x4a')](_0x3165('0xe4'),ut[_0x3165('0xe5')](_0x117e5b,_0x3165('0xe6')));_0x155833[_0x3165('0xca')](_0x117e5b)['catch'](loggerCatch(_0x3165('0xfb')));if(_0x117e5b['countbusyretry']+_0x117e5b['countcongestionretry']+_0x117e5b[_0x3165('0xfc')]+_0x117e5b[_0x3165('0xee')]+_0x117e5b[_0x3165('0xef')]+_0x117e5b[_0x3165('0xfd')]+_0x117e5b[_0x3165('0xeb')]+_0x117e5b[_0x3165('0xf0')]>=_0x37ded4[_0x3165('0xf1')]){_0x155833[_0x3165('0xfe')](_0x117e5b,_0x245a01,_0x37afbd,_0x3165('0xf2'));}else{if(_0x117e5b[_0x3165('0xeb')]>=_0x37ded4['dialMachineMaxRetry']){_0x155833[_0x3165('0xf4')](_0x117e5b,_0x245a01,_0x37afbd,'reason\x2019\x20machine....');}else{_0x155833[_0x3165('0xbe')]({'active':![],'countmachineretry':_0x117e5b['countmachineretry'],'scheduledat':moment()[_0x3165('0xf5')](_0x37ded4[_0x3165('0xff')],'minutes')[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x117e5b[_0x3165('0xd1')],'ListId':_0x117e5b['ListId'],'VoiceQueueId':_0x117e5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x117e5b[_0x3165('0xd5')]||undefined})['catch'](loggerCatch(_0x3165('0x100')));_0x245a01({'reschedule':0x1});}}});}}};Dialer[_0x3165('0x1a')][_0x3165('0x33')]=function(_0x3e6f05){var _0x35337f=this['uniqueId'][_0x3e6f05[_0x3165('0xda')]];var _0x2868cf=this;var _0xb789be;if(_0x35337f&&_0x35337f['type']==='ivr'){delete this[_0x3165('0x27')][_0x3e6f05['uniqueid']];this[_0x3165('0xb3')](this[_0x3165('0x20')][_0x35337f[_0x3165('0xb4')]]);this['campaigns'][_0x35337f['queue']][_0x3165('0x101')]+=0x1;_0xb789be=new Hangup(_0x35337f,_0x3e6f05);this[_0x3165('0xca')](_0xb789be)[_0x3165('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3165('0xc8')](_0xb789be)[_0x3165('0xb1')](loggerCatch(_0x3165('0x102')));}if(_0x35337f&&_0x35337f[_0x3165('0x4b')]!=='ivr'&&isNotNull(this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]]['dialQueueProject'])){delete this[_0x3165('0x27')][_0x3e6f05[_0x3165('0xda')]];this[_0x3165('0xb3')](this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]]);this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]][_0x3165('0x5b')]+=0x1;this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]][_0x3165('0xe2')]+=0x1;_0xb789be=new Hangup(_0x35337f,_0x3e6f05);_0xb789be[_0x3165('0xa6')]=0x10;_0xb789be[_0x3165('0xa7')]=_0x3165('0x103');_0xb789be[_0x3165('0xe3')]=_0x3165('0x104');this[_0x3165('0xca')](_0xb789be)[_0x3165('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0xb789be)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x35337f&&_0x35337f[_0x3165('0x4b')]!==_0x3165('0x78')&&!isNotNull(this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]][_0x3165('0x105')])){delete this[_0x3165('0x27')][_0x3e6f05['uniqueid']];this[_0x3165('0xb3')](this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]]);this[_0x3165('0x1f')][_0x35337f[_0x3165('0xb4')]][_0x3165('0x65')]+=0x1;_0xb789be=new Hangup(_0x35337f,_0x3e6f05);_0xb789be[_0x3165('0xa6')]=0xc;_0xb789be[_0x3165('0xa7')]=_0x3e6f05['cause-txt'];_0xb789be['membername']=_0x3165('0x106');this[_0x3165('0xca')](_0xb789be)[_0x3165('0xb1')](loggerCatch(_0x3165('0x107')));this[_0x3165('0xc8')](_0xb789be)[_0x3165('0xb1')](loggerCatch(_0x3165('0x102')));}};Dialer[_0x3165('0x1a')][_0x3165('0x31')]=function(_0x545945){var _0x48ff9b=this['uniqueId'][_0x545945[_0x3165('0xda')]];var _0x118ad7=this;if(this['voiceQueues'][_0x545945['queue']]){if(_0x48ff9b&&_0x48ff9b[_0x3165('0x4b')]!=='ivr'){delete this[_0x3165('0x27')][_0x545945[_0x3165('0xda')]];this[_0x3165('0x1f')][_0x545945[_0x3165('0xb4')]][_0x3165('0x5b')]+=0x1;var _0x41ecd3=new AgentComplete(_0x48ff9b,_0x545945);if(_0x545945[_0x3165('0x108')]==='agent'){_0x41ecd3[_0x3165('0x109')]=this[_0x3165('0x1f')][_0x545945[_0x3165('0xb4')]][_0x3165('0x10a')]&&this[_0x3165('0x1f')][_0x545945['queue']][_0x3165('0x10b')]?moment()[_0x3165('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x3165('0xca')](_0x41ecd3)[_0x3165('0xb1')](loggerCatch(_0x3165('0x10c')));this['moveContactManagedDialer'](_0x41ecd3)['catch'](loggerCatch(_0x3165('0x10d')));}}};Dialer[_0x3165('0x1a')][_0x3165('0x2d')]=function(_0x295f04){if(this['voiceQueues'][_0x295f04[_0x3165('0xb4')]]){if(this[_0x3165('0x27')][_0x295f04[_0x3165('0xda')]]&&this[_0x3165('0x27')][_0x295f04['uniqueid']][_0x3165('0x4b')]!==_0x3165('0x78')){this['updateOriginated'](this[_0x3165('0x1f')][_0x295f04[_0x3165('0xb4')]]);this[_0x3165('0x27')][_0x295f04[_0x3165('0xda')]][_0x3165('0x10e')]=moment()[_0x3165('0x79')](_0x3165('0xf7'));}}};Dialer[_0x3165('0x1a')][_0x3165('0x10f')]=function(_0x6cb5a4){this[_0x3165('0xca')](_0x6cb5a4)[_0x3165('0xb1')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x3165('0xc8')](_0x6cb5a4)[_0x3165('0xb1')](loggerCatch(_0x3165('0x110')));};Dialer[_0x3165('0x1a')][_0x3165('0x111')]=function(_0x207d2e){var _0x1e10a3=this[_0x3165('0x27')][_0x207d2e['uniqueid']];var _0x141d09=this;if(this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]]){if(_0x1e10a3&&_0x1e10a3[_0x3165('0x4b')]!==_0x3165('0x78')){delete this[_0x3165('0x27')][_0x207d2e[_0x3165('0xda')]];this[_0x3165('0xb3')](this[_0x3165('0x1f')][_0x207d2e['queue']]);_0x1e10a3[_0x3165('0x112')]=moment()[_0x3165('0x79')](_0x3165('0xf7'));var _0x51f3a8=new QueueCallerAbandon(_0x1e10a3,_0x207d2e);if(getSeconds(_0x1e10a3[_0x3165('0x112')],_0x1e10a3[_0x3165('0x113')])>=_0x1e10a3[_0x3165('0x114')]){this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]][_0x3165('0x80')]+=0x1;this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]][_0x3165('0x61')]+=0x1;this[_0x3165('0x1f')][_0x207d2e['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x51f3a8[_0x3165('0xa6')]=0xa;_0x51f3a8['statedesc']=_0x3165('0x115');_0x51f3a8['dropreason']=_0x3165('0x116');_0x51f3a8['agiafterat']=this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]]['dialQueueProject2']?moment()['format'](_0x3165('0xf7')):undefined;_0x51f3a8[_0x3165('0xef')]+=0x1;_0x51f3a8['countglobal']+=0x1;if(_0x51f3a8[_0x3165('0xef')]>=this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]]['dialDropMaxRetry']){this[_0x3165('0x10f')](_0x51f3a8);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x51f3a8[_0x3165('0xef')],'scheduledat':moment()[_0x3165('0xf5')](this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]][_0x3165('0x117')],_0x3165('0xf6'))['format'](_0x3165('0xf7')),'ContactId':_0x1e10a3[_0x3165('0xd1')],'ListId':_0x1e10a3[_0x3165('0xd2')],'VoiceQueueId':_0x1e10a3[_0x3165('0xd4')]||undefined,'CampaignId':_0x1e10a3['CampaignId']||undefined})['catch'](loggerCatch(_0x3165('0x118')));var _0x5eff6f=new History(_0x51f3a8);_0x5eff6f[_0x3165('0xa6')]=0xa;_0x5eff6f['statedesc']=_0x3165('0x115');_0x5eff6f[_0x3165('0x119')]=moment()[_0x3165('0x79')](_0x3165('0xf7'));_0x5eff6f[_0x3165('0xa8')]=_0x5eff6f['starttime'];_0x5eff6f[_0x3165('0x11a')]=_0x51f3a8[_0x3165('0x11a')];_0x5eff6f[_0x3165('0x11b')]=_0x51f3a8[_0x3165('0x11b')];this['createHistory'](_0x5eff6f)[_0x3165('0xb1')](loggerCatch(_0x3165('0x11c')));}}else{this[_0x3165('0x1f')][_0x207d2e[_0x3165('0xb4')]][_0x3165('0x82')]+=0x1;this['voiceQueues'][_0x207d2e[_0x3165('0xb4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x51f3a8[_0x3165('0xa6')]=0xb;_0x51f3a8[_0x3165('0xa7')]='Abandoned';_0x51f3a8[_0x3165('0x11d')]=_0x3165('0x11e');_0x51f3a8[_0x3165('0xfd')]+=0x1;_0x51f3a8[_0x3165('0x11f')]+=0x1;if(_0x51f3a8[_0x3165('0xfd')]>=this[_0x3165('0x1f')][_0x207d2e['queue']]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x51f3a8);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x51f3a8[_0x3165('0xfd')],'scheduledat':moment()[_0x3165('0xf5')](this[_0x3165('0x1f')][_0x207d2e['queue']][_0x3165('0x120')],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x1e10a3[_0x3165('0xd1')],'ListId':_0x1e10a3['ListId'],'VoiceQueueId':_0x1e10a3[_0x3165('0xd4')]||undefined,'CampaignId':_0x1e10a3[_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x121')));var _0x5eff6f=new History(_0x51f3a8);_0x5eff6f[_0x3165('0xa6')]=0xb;_0x5eff6f[_0x3165('0xa7')]=_0x3165('0x122');_0x5eff6f['starttime']=moment()[_0x3165('0x79')](_0x3165('0xf7'));_0x5eff6f[_0x3165('0xa8')]=_0x5eff6f['starttime'];_0x5eff6f[_0x3165('0x11a')]=_0x51f3a8['calleridname'];_0x5eff6f[_0x3165('0x11b')]=_0x51f3a8[_0x3165('0x11b')];this[_0x3165('0xca')](_0x5eff6f)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x3165('0x1a')][_0x3165('0x34')]=function(_0x144576){if(this[_0x3165('0x25')][_0x144576[_0x3165('0xda')]]){this['actions'][_0x144576[_0x3165('0xda')]]['channel']=_0x144576['channel'];}if(this['uniqueId'][_0x144576['uniqueid']]){this[_0x3165('0x27')][_0x144576['uniqueid']]['channel']=_0x144576[_0x3165('0xb0')];}};Dialer[_0x3165('0x1a')][_0x3165('0x37')]=function(_0x413f7e){if(strategy[this[_0x3165('0x1f')][this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]][_0x3165('0xb4')]][_0x3165('0x124')]]==='roundrobin'){if(this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]]&&_[_0x3165('0xae')](this['actions'][_0x413f7e[_0x3165('0x123')]][_0x3165('0x125')])&&_0x413f7e['status']==='1'&&_0x413f7e[_0x3165('0x126')]==='0'){if(this[_0x3165('0x21')][_0x413f7e[_0x3165('0x127')]]){if(!this[_0x3165('0x21')][_0x413f7e[_0x3165('0x127')]]['locked']){this['agents'][_0x413f7e[_0x3165('0x127')]][_0x3165('0x125')]=!![];this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]][_0x3165('0x125')]=!![];this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]]['stateinterface']=_0x413f7e['stateinterface'];}}}}else if((strategy[this[_0x3165('0x1f')][this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]]['queue']][_0x3165('0x124')]]||_0x3165('0x18'))===_0x3165('0x18')){if(this['actions'][_0x413f7e[_0x3165('0x123')]]){if(this[_0x3165('0x21')][_0x413f7e['stateinterface']]){this[_0x3165('0x25')][_0x413f7e['actionid']][_0x3165('0x127')]=_0x413f7e[_0x3165('0x127')];if(_[_0x3165('0xae')](this['queueBooked'][this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]]['queue']])){this['queueBooked'][this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]][_0x3165('0xb4')]]=[];}this['queueBooked'][this['actions'][_0x413f7e[_0x3165('0x123')]][_0x3165('0xb4')]][_0x3165('0x128')](_[_0x3165('0x8f')](_[_0x3165('0xd0')](this[_0x3165('0x25')][_0x413f7e[_0x3165('0x123')]],[_0x3165('0x129'),_0x3165('0x127')]),{'status':_0x413f7e['status'],'paused':_0x413f7e[_0x3165('0x126')]}));}}}};function unlockQueueStatus(_0x2a885c,_0x4f63af){setTimeout(function(){if(_['isUndefined'](_0x2a885c[_0x3165('0x12a')])){loggerBooked['error'](_0x3165('0x12b'),_0x4f63af);}_0x2a885c['queueStatusComplete']=!![];loggerBooked['info'](_0x3165('0x12c'),_0x4f63af,JSON[_0x3165('0x46')](_[_0x3165('0xd0')](_0x2a885c,[_0x3165('0x3d'),_0x3165('0x12a')])));},0x1f3);}Dialer[_0x3165('0x1a')][_0x3165('0x12d')]=function(_0x1274f1){var _0x1c84e5=this;var _0x97741a=_0x1c84e5['voiceQueues'][_0x1c84e5[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]];if(strategy[this['voiceQueues'][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]['queue']]['strategy']]==='roundrobin'){if(this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]&&this[_0x3165('0x25')][_0x1274f1['actionid']][_0x3165('0x127')]){this[_0x3165('0x1e')]['run'](this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]['idHopper'],this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0x127')])[_0x3165('0xb1')](function(_0x5f42f0){logger[_0x3165('0x94')](_0x3165('0x12e'),util['inspect'](_0x5f42f0,{'showHidden':![],'depth':null}));})[_0x3165('0x1c')](function(){_0x1c84e5[_0x3165('0xb3')](_0x1c84e5[_0x3165('0x1f')][_0x1c84e5['actions'][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]]);_0x1c84e5[_0x3165('0x21')][_0x1c84e5[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0x127')]]['locked']=![];delete _0x1c84e5[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]];unlockQueueStatus(_0x97741a);});}else{this[_0x3165('0xb3')](this[_0x3165('0x1f')][this['actions'][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]]);this[_0x3165('0xbe')]({'active':![],'ContactId':this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xd1')],'ListId':this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xd2')],'VoiceQueueId':this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x12f')));delete this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]];unlockQueueStatus(_0x97741a);}}else if((strategy[this[_0x3165('0x1f')][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]][_0x3165('0x124')]]||_0x3165('0x18'))==='rrmemory'){var _0x35da90;if(this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]&&!_[_0x3165('0x43')](this[_0x3165('0x2a')][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]])){if(this[_0x3165('0x2b')][_0x1c84e5[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]]){this[_0x3165('0x2b')][_0x1c84e5[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]]=this[_0x3165('0x2b')][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]['queue']]?this[_0x3165('0x2b')][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]]['queue']]:this[_0x3165('0x2a')][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]]?this[_0x3165('0x2a')][this[_0x3165('0x25')][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]][_0x3165('0x130')]||0x0:0x0;}this[_0x3165('0x2a')][this['actions'][_0x1274f1['actionid']][_0x3165('0xb4')]][_0x3165('0x130')]=this[_0x3165('0x2b')][this['actions'][_0x1274f1[_0x3165('0x123')]][_0x3165('0xb4')]];for(var _0x2a539e=0x0;_0x2a539e=0x0;})[_0x3165('0xb1')](myreject(_0x39cdae)));}}else{_0x4fa861[_0x3165('0x128')](ami[_0x3165('0xaf')]({'action':_0x3165('0x152'),'command':util['format']('iftime\x20%s,%s',_0x164a5f,!_['isUndefined'](config['timezones'][_0x1bbf8d])?_0x1bbf8d:'')})[_0x3165('0xb8')](function(_0xb3bd50){return _0xb3bd50[_0x3165('0x153')][_0x3165('0x150')](_0x3165('0x151'))>=0x0;})[_0x3165('0xb1')](myreject(_0x39cdae)));}BPromise[_0x3165('0x154')](_0x4fa861)[_0x3165('0xb8')](function(_0x8af013){var _0x4f6c3c=_[_0x3165('0x155')](_0x8af013);if(_0x4f6c3c){return _0x190b2e(_0x4f6c3c);}else{_0x3f6550[_0x3165('0x3b')]=_0x5f325a?'GLOBAL_INTERVAL_IS_OVERTIME':_0x3165('0x156');return _0x39cdae(msgResponse(_0x3165('0x157'),'Failure',_0x3165('0x158')+_0x5f325a+'\x20'+_0x1fbfb8+_0x3165('0x159')+util[_0x3165('0x93')](_0x164a5f,{'showHidden':![],'depth':null})+_0x3165('0x15a')+_0x1bbf8d));}})[_0x3165('0xb1')](function(_0x58fa6a){return _0x39cdae(msgResponse(_0x3165('0x145'),_0x3165('0x148'),JSON['stringify'](_0x58fa6a)));});});};Dialer['prototype'][_0x3165('0x15b')]=function(_0x1edb64){var _0x484011=this;return function(){switch(_0x1edb64[_0x3165('0x59')]){case'progressive':freeVariablesPredictive(_0x1edb64);_0x484011[_0x3165('0x15c')](_0x1edb64,0x1);break;case _0x3165('0x15d'):freeVariablesPredictive(_0x1edb64);_0x484011[_0x3165('0x15c')](_0x1edb64,_0x1edb64[_0x3165('0x15e')]);break;case'predictive':_0x484011['predictive'](_0x1edb64);break;case _0x3165('0x8'):freeVariablesPredictive(_0x1edb64);_0x484011[_0x3165('0x15c')](_0x1edb64,0x1);break;default:freeVariablesPredictive(_0x1edb64);logger[_0x3165('0x94')]('Queue',_0x1edb64[_0x3165('0x3d')],_0x3165('0x15f'));}};};Dialer[_0x3165('0x1a')]['launchHandleIvr']=function(_0x3a0c05){var _0x4090e5=this;return function(){_0x4090e5['handleIvr'](_0x3a0c05);};};Dialer['prototype'][_0x3165('0xa')]=function(_0x1ab2a8){var _0x18c529=this;if(isNotPreview(_0x1ab2a8['dialMethod'])){if(isVoiceQueueOutbound(_0x1ab2a8[_0x3165('0x4b')])&&isActive(_0x1ab2a8[_0x3165('0x58')])){_0x1ab2a8['sendMessageOneNotActive']=!![];BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](checkIsLoggedIn(_0x1ab2a8,_0x1ab2a8[_0x3165('0x4f')]))[_0x3165('0xb8')](checkIsActive(_0x1ab2a8,_0x1ab2a8['dialActive']))['then'](checkInterval(_0x1ab2a8))['then'](_0x18c529[_0x3165('0x13e')](_0x1ab2a8))['then'](_0x18c529[_0x3165('0x143')](_0x1ab2a8[_0x3165('0x160')],_0x1ab2a8[_0x3165('0x161')],_0x1ab2a8[_0x3165('0x3d')],_0x1ab2a8))[_0x3165('0xb8')](_0x18c529['checkIfTimeIntervals'](_0x1ab2a8[_0x3165('0x40')],_0x1ab2a8[_0x3165('0x161')],_0x1ab2a8[_0x3165('0x3d')],_0x1ab2a8))['then'](_0x18c529[_0x3165('0x15b')](_0x1ab2a8))[_0x3165('0xb1')](loggerCatchQueueSummary(_0x3165('0x162'),_0x1ab2a8));}else{notSendMessagesQueue(_0x1ab2a8);}}else{freeVariablesPredictive(_0x1ab2a8);}};Dialer[_0x3165('0x1a')][_0x3165('0x13d')]=function(){var _0x37eb51=this;var _0x5df0f7;for(var _0x13219d in this[_0x3165('0x20')]){if(typeof this[_0x3165('0x20')][_0x13219d]!==_0x3165('0xac')){_0x5df0f7=this[_0x3165('0x20')][_0x13219d];if(isCampaignIvr(_0x5df0f7[_0x3165('0x4b')])&&isActive(_0x5df0f7[_0x3165('0x74')])){_0x5df0f7[_0x3165('0x9e')]=!![];BPromise[_0x3165('0xbb')]()[_0x3165('0xb8')](checkIsActive(_0x5df0f7,_0x5df0f7[_0x3165('0x74')]))[_0x3165('0xb8')](checkInterval(_0x5df0f7))[_0x3165('0xb8')](_0x37eb51['checkIsTrunkReachable'](_0x5df0f7))[_0x3165('0xb8')](_0x37eb51[_0x3165('0x143')](_0x5df0f7['dialGlobalInterval'],_0x5df0f7[_0x3165('0x161')],_0x5df0f7[_0x3165('0x3d')],_0x5df0f7))[_0x3165('0xb8')](_0x37eb51[_0x3165('0x144')](_0x5df0f7[_0x3165('0x40')],_0x5df0f7[_0x3165('0x161')],_0x5df0f7['name'],_0x5df0f7))[_0x3165('0xb8')](_0x37eb51[_0x3165('0x163')](_0x5df0f7))[_0x3165('0xb1')](loggerCatchQueueSummary(_0x3165('0x164'),_0x5df0f7));}else{notSendMessagesCampaign(_0x5df0f7);}}}};function getCallerIdRandom(_0x2a1bcb,_0x5e1c17){var _0xe36cfb;var _0x1f5e5d;var _0x3a64d5;if(_0x5e1c17<=0x0){_0x5e1c17=0x1;}_0xe36cfb=new RegExp(_0x3165('0x165')+_0x5e1c17+'}$');_0x1f5e5d=Math['pow'](0xa,_0x5e1c17-0x1);_0x3a64d5=Math[_0x3165('0x166')](0xa,_0x5e1c17)-0x1;return util[_0x3165('0x79')]('%s',_['replace'](_0x2a1bcb,_0xe36cfb,_[_0x3165('0x167')](_0x1f5e5d,_0x3a64d5)));}function extractCalleridName(_0x92fb8f){var _0x2162a9=_0x92fb8f[_0x3165('0x168')](/"(.*?)"/);return _0x2162a9?_0x2162a9[0x1]:_0x92fb8f;}function extractCalleridNumber(_0x26ce8c){var _0x1005a0=_0x26ce8c[_0x3165('0x168')](/<(.*?)>/);return _0x1005a0?_0x1005a0[0x1]:_0x26ce8c;}Dialer[_0x3165('0x1a')][_0x3165('0x169')]=function(_0xf503ad,_0x137c72){var _0x345455=this;var _0x268e64=uuid['v4']();this[_0x3165('0x25')][_0x268e64]=new Action(_0xf503ad,_0x137c72,_0x268e64);return new BPromise(function(_0x2127c3,_0x59b052){if(_[_0x3165('0x3a')](_0xf503ad)&&typeof _0xf503ad!==_0x3165('0x16a')){return _0x59b052(msgResponse('originate','Failure',_0x3165('0x16b')));}if(_[_0x3165('0x3a')](_0x137c72[_0x3165('0x16c')][_0x3165('0x16d')])||_0x137c72[_0x3165('0x16c')][_0x3165('0x16d')]===null){return _0x59b052(msgResponse(_0x3165('0x16e'),_0x3165('0x148'),'contact\x20is\x20undefine'));}var _0x5029fb={'XMD-CALLERID':_0x345455[_0x3165('0x25')][_0x268e64][_0x3165('0x16f')](),'XMD-AGI':_0xf503ad[_0x3165('0x105')]?util[_0x3165('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0xf503ad['dialQueueProject']):_0x3165('0x170'),'XMD-AGIAFTER':_0xf503ad[_0x3165('0x10a')]?util[_0x3165('0x79')](_0x3165('0x171'),ipAgi,_0xf503ad[_0x3165('0x10a')]):_0x3165('0x170'),'XMD-QUEUE':_0xf503ad['type']===_0x3165('0x4c')?util[_0x3165('0x79')]('\x22%s,%s%s,,,%s\x22',_0xf503ad[_0x3165('0x3d')],_0xf503ad['dialQueueOptions']||'',_0xf503ad[_0x3165('0x10b')]?'c':'',_0xf503ad['dialQueueTimeout']||0x3):_0x3165('0x170'),'XMD-CONTACTID':_0x137c72[_0x3165('0xd1')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x345455[_0x3165('0x25')][_0x268e64][_0x3165('0x16f')](),'XMD-AMD':_0xf503ad['dialAMDActive']?_0x3165('0x172'):'NONE','XMD-DESTINATION':_0x3165('0xde')};if(_0xf503ad[_0x3165('0xdf')]){_0x5029fb[_0x3165('0x173')]=_0xf503ad['dialAMDInitialSilence']||0x9c4;_0x5029fb[_0x3165('0x174')]=_0xf503ad[_0x3165('0x175')]||0x5dc;_0x5029fb[_0x3165('0x176')]=_0xf503ad[_0x3165('0x177')]||0x320;_0x5029fb[_0x3165('0x178')]=_0xf503ad[_0x3165('0x179')]||0x1388;_0x5029fb['XMD-AMDMINWORDLENGTH']=_0xf503ad[_0x3165('0x17a')]||0x64;_0x5029fb[_0x3165('0x17b')]=_0xf503ad['dialAMDBetweenWordsSilence']||0x32;_0x5029fb[_0x3165('0x17c')]=_0xf503ad[_0x3165('0x17d')]||0x3;_0x5029fb['XMD-AMDSILENCETHRESHOLD']=_0xf503ad[_0x3165('0x17e')]||0x100;_0x5029fb[_0x3165('0x17f')]=_0xf503ad['dialAMDMaximumWordLength']||0x1388;}if(_0xf503ad[_0x3165('0x4b')]==='outbound'){_0x5029fb[_0x3165('0x180')]=_0x137c72[_0x3165('0xd4')];}else{_0x5029fb[_0x3165('0x181')]=_0x137c72[_0x3165('0xd5')];}for(var _0x1b99d3 in _0x137c72['Contact']){if(typeof _0x137c72['Contact'][_0x1b99d3]!==_0x3165('0xac')){if(isNotNull(_0x137c72['Contact'][_0x1b99d3])&&_0x1b99d3!=='id'&&_0x1b99d3!=='tags'&&_0x1b99d3!==_0x3165('0x182')&&_0x1b99d3!==_0x3165('0x183')){_0x5029fb[util['format'](_0x3165('0x184'),_0x3165('0x185'),_['toUpper'](_0x1b99d3))]=_0x137c72[_0x3165('0x16c')][_0x1b99d3];}}}var _0x58b8ff=_0x345455['isTrunkReachable'](_0xf503ad[_0x3165('0x73')])?getCallerId(_0xf503ad[_0x3165('0x73')][_0x3165('0x186')],_0xf503ad[_0x3165('0x5a')],_0xf503ad[_0x3165('0x187')]>0x0?getCallerIdRandom(_0xf503ad['dialOriginateCallerIdNumber'],_0xf503ad[_0x3165('0x187')]):_0xf503ad[_0x3165('0x188')]):getCallerId(_[_0x3165('0xae')](_0xf503ad[_0x3165('0x140')])?_0xf503ad['Trunk'][_0x3165('0x186')]:_0xf503ad[_0x3165('0x140')][_0x3165('0x186')],_0xf503ad[_0x3165('0x5a')],_0xf503ad[_0x3165('0x187')]>0x0?getCallerIdRandom(_0xf503ad[_0x3165('0x188')],_0xf503ad[_0x3165('0x187')]):_0xf503ad['dialOriginateCallerIdNumber']);if(_0x58b8ff){_0x5029fb[_0x3165('0x189')]=_0x345455[_0x3165('0x25')][_0x268e64][_0x3165('0x18a')]=extractCalleridName(_0x58b8ff);_0x5029fb['XMD-ORIGINATECALLERIDNUM']=_0x345455['actions'][_0x268e64]['originatecalleridnum']=extractCalleridNumber(_0x58b8ff);}return ami[_0x3165('0xaf')]({'actionid':_0x268e64,'action':'originate','channel':_0x345455[_0x3165('0x13f')](_0xf503ad[_0x3165('0x73')])?util['format'](_0x3165('0x18b'),_0xf503ad[_0x3165('0x73')][_0x3165('0x3d')],isNotNull(_0xf503ad[_0x3165('0x18c')])?_0xf503ad['dialPrefix'][_0x3165('0x18d')]()||'':'',_0xf503ad[_0x3165('0x18e')]>0x0?_0x137c72[_0x3165('0x16c')]['phone']['substring'](_0xf503ad['dialCutDigit']):_0x137c72[_0x3165('0x16c')][_0x3165('0x16d')]):util[_0x3165('0x79')](_0x3165('0x18b'),_[_0x3165('0xae')](_0xf503ad[_0x3165('0x140')])?_0xf503ad[_0x3165('0x73')][_0x3165('0x3d')]:_0xf503ad[_0x3165('0x140')][_0x3165('0x3d')],isNotNull(_0xf503ad['dialPrefix'])?_0xf503ad['dialPrefix'][_0x3165('0x18d')]()||'':'',_0xf503ad[_0x3165('0x18e')]>0x0?_0x137c72[_0x3165('0x16c')][_0x3165('0x16d')]['substring'](_0xf503ad['dialCutDigit']):_0x137c72[_0x3165('0x16c')][_0x3165('0x16d')]),'callerid':_0x58b8ff,'Exten':'xcally-motion-dialer','Context':_0x3165('0x18f'),'Priority':'1','variable':_0x5029fb,'timeout':(_0xf503ad[_0x3165('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x268e64})[_0x3165('0xb8')](function(_0x165e3f){return _0x2127c3(_0x165e3f);})[_0x3165('0xb1')](function(_0x3c2beb){_0xf503ad['outboundOriginateFailureCallsDay']+=0x1;var _0xf38393=new History(_0x345455['actions'][_0x268e64]);logger[_0x3165('0x94')](util['format'](_0x3165('0x191'),JSON[_0x3165('0x46')](_0x3c2beb)));_0xf38393[_0x3165('0xa6')]=0xe;_0xf38393[_0x3165('0xa7')]=_0x3165('0x192');_0xf38393[_0x3165('0x119')]=moment()['format'](_0x3165('0xf7'));_0xf38393[_0x3165('0xa8')]=_0xf38393[_0x3165('0x119')];_0x345455[_0x3165('0xca')](_0xf38393)[_0x3165('0xb1')](loggerCatch('[originate][error]'));_0x345455[_0x3165('0xc8')](_0xf38393)[_0x3165('0xb1')](loggerCatch(_0x3165('0x193')))[_0x3165('0x1c')](function(){delete _0x345455['actions'][_0x268e64];return _0x59b052(msgResponse(_0x3165('0x16e'),'Error',_0x3165('0x194')));});});});};Dialer[_0x3165('0x1a')][_0x3165('0x2f')]=function(_0x3b9903){var _0x3d490e=this[_0x3165('0x25')][_0x3b9903[_0x3165('0x123')]];if(_0x3d490e){delete this['actions'][_0x3b9903[_0x3165('0x123')]];_0x3d490e[_0x3165('0x113')]=moment()[_0x3165('0x79')](_0x3165('0xf7'));var _0x448bdb=_0x3d490e[_0x3165('0x4b')]==='ivr'?this['campaigns'][_0x3d490e['queue']]:this[_0x3165('0x1f')][_0x3d490e[_0x3165('0x195')]()];if(!this[_0x3165('0xd6')](_0x3b9903[_0x3165('0x196')])){this[_0x3165('0xb3')](_0x448bdb);return this[_0x3165('0x197')](_0x3d490e,_0x448bdb,_0x3b9903)[_0x3165('0xb1')](loggerCatch(_0x3165('0x198')));}this[_0x3165('0x27')][_0x3b9903['uniqueid']]=_0x3d490e;}};Dialer['prototype']['checkRetriveMax']=function(_0x452a23,_0x120296,_0x10f728){var _0x3f1a5b=new History(_0x120296);if(_0x3f1a5b[_0x3165('0xec')]+_0x3f1a5b[_0x3165('0xed')]+_0x3f1a5b[_0x3165('0xfc')]+_0x3f1a5b[_0x3165('0xee')]+_0x3f1a5b['countdropretry']+_0x3f1a5b[_0x3165('0xfd')]+_0x3f1a5b['countmachineretry']+_0x3f1a5b[_0x3165('0xf0')]>=_0x10f728[_0x3165('0xf1')]-0x1){return!![];}switch(_0x452a23){case 0x3:if(_0x3f1a5b[_0x3165('0xfc')]>=_0x10f728['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x3165('0xbe')]({'active':![],'countnoanswerretry':_0x3f1a5b['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x10f728[_0x3165('0x199')],'minutes')[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b['ContactId'],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x3f1a5b['CampaignId']||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x19a')));break;case 0x5:if(_0x3f1a5b[_0x3165('0xec')]>=_0x10f728[_0x3165('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3f1a5b[_0x3165('0xec')]+=0x1,'scheduledat':moment()[_0x3165('0xf5')](_0x10f728[_0x3165('0x19c')],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b[_0x3165('0xd1')],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b['VoiceQueueId']||undefined,'CampaignId':_0x3f1a5b[_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x19d')));break;case 0x8:if(_0x3f1a5b[_0x3165('0xed')]>=_0x10f728[_0x3165('0x19e')]-0x1){return!![];}this[_0x3165('0xbe')]({'active':![],'countcongestionretry':_0x3f1a5b[_0x3165('0xed')]+=0x1,'scheduledat':moment()[_0x3165('0xf5')](_0x10f728[_0x3165('0x19f')],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b[_0x3165('0xd1')],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x3f1a5b['CampaignId']||undefined})['catch'](loggerCatch(_0x3165('0x1a0')));break;case 0x0:if(_0x3f1a5b[_0x3165('0xee')]>=_0x10f728[_0x3165('0x1a1')]-0x1){return!![];}else{this[_0x3165('0xbe')]({'active':![],'countnosuchnumberretry':_0x3f1a5b[_0x3165('0xee')]+=0x1,'scheduledat':moment()[_0x3165('0xf5')](_0x10f728[_0x3165('0x1a2')],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b[_0x3165('0xd1')],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x3f1a5b[_0x3165('0xd5')]||undefined})['catch'](loggerCatch(_0x3165('0x1a3')));}break;case 0xa:if(_0x3f1a5b['countdropretry']>=_0x10f728[_0x3165('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x3f1a5b[_0x3165('0xef')]+=0x1,'scheduledat':moment()[_0x3165('0xf5')](_0x10f728[_0x3165('0x117')],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b['ContactId'],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x3f1a5b[_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x118')));break;case 0xb:if(_0x3f1a5b['countabandonedretry']>=_0x10f728[_0x3165('0x1a5')]-0x1){return!![];}this[_0x3165('0xbe')]({'active':![],'countabandonedretry':_0x3f1a5b['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x10f728['dialAbandonedRetryFrequency'],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b[_0x3165('0xd1')],'ListId':_0x3f1a5b['ListId'],'VoiceQueueId':_0x3f1a5b['VoiceQueueId']||undefined,'CampaignId':_0x3f1a5b['CampaignId']||undefined})['catch'](loggerCatch(_0x3165('0x121')));break;case 0x13:if(_0x3f1a5b[_0x3165('0xeb')]>=_0x10f728[_0x3165('0xf3')]-0x1){return!![];}this[_0x3165('0xbe')]({'active':![],'countmachineretry':_0x3f1a5b[_0x3165('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x10f728['dialMachineRetryFrequency'],_0x3165('0xf6'))['format'](_0x3165('0xf7')),'ContactId':_0x3f1a5b[_0x3165('0xd1')],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x3f1a5b[_0x3165('0xd5')]||undefined})['catch'](loggerCatch(_0x3165('0x100')));break;case 0x14:if(_0x3f1a5b[_0x3165('0xf0')]>=_0x10f728[_0x3165('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3f1a5b[_0x3165('0xf0')]+=0x1,'scheduledat':moment()[_0x3165('0xf5')](_0x10f728[_0x3165('0x1a7')],_0x3165('0xf6'))[_0x3165('0x79')](_0x3165('0xf7')),'ContactId':_0x3f1a5b[_0x3165('0xd1')],'ListId':_0x3f1a5b[_0x3165('0xd2')],'VoiceQueueId':_0x3f1a5b[_0x3165('0xd4')]||undefined,'CampaignId':_0x3f1a5b[_0x3165('0xd5')]||undefined})['catch'](loggerCatch(_0x3165('0x1a8')));break;default:return!![];}};Dialer[_0x3165('0x1a')][_0x3165('0x197')]=function(_0x37fab9,_0x5675e1,_0x1ceb65){var _0xa34202=this;var _0x3eed53=new History(_0x37fab9);return new BPromise(function(_0x3046c4,_0x27bbf8){if(_[_0x3165('0x3a')](_0x5675e1)&&typeof _0x5675e1!==_0x3165('0x16a')){return _0x27bbf8(msgResponse('[callProgressDetecting]',_0x3165('0x148'),_0x3165('0x1a9')));}if(_['isUndefined'](_0x1ceb65)&&typeof _0x1ceb65!==_0x3165('0x16a')){return _0x27bbf8(msgResponse(_0x3165('0x1aa'),_0x3165('0x148'),'evt\x20is\x20undefine'));}switch(_0x1ceb65[_0x3165('0x108')]){case'0':_0x5675e1[_0x3165('0x1ab')]+=0x1;_0x3eed53[_0x3165('0xa6')]=0x0;_0x3eed53[_0x3165('0xa7')]=_0x3165('0x1ac');_0x3eed53['countnosuchnumberretry']+=0x1;_0x3eed53[_0x3165('0x11f')]+=0x1;ami[_0x3165('0x4a')](_0x3165('0x1ad'),ut[_0x3165('0xe5')](_0x37fab9,_0x3165('0x1ae')));_0xa34202[_0x3165('0xca')](_0x3eed53)[_0x3165('0xb1')](loggerCatch(_0x3165('0xfb')));if(_0xa34202[_0x3165('0x1af')](0x0,_0x37fab9,_0x5675e1)){if(_0x3eed53[_0x3165('0xee')]>=_0x5675e1[_0x3165('0x1a1')]){_0xa34202[_0x3165('0xf4')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1b0'));}else{_0xa34202[_0x3165('0xfe')](_0x3eed53,_0x3046c4,_0x27bbf8,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5675e1[_0x3165('0x62')]+=0x1;_0x3eed53[_0x3165('0xa6')]=0x3;_0x3eed53[_0x3165('0xa7')]=_0x3165('0x1b1');_0x3eed53[_0x3165('0xfc')]+=0x1;_0x3eed53[_0x3165('0x11f')]+=0x1;ami[_0x3165('0x4a')](_0x3165('0x1b2'),ut[_0x3165('0xe5')](_0x37fab9,'noanswer'));_0xa34202[_0x3165('0xca')](_0x3eed53)[_0x3165('0xb1')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xa34202[_0x3165('0x1af')](0x3,_0x37fab9,_0x5675e1)){if(_0x3eed53['countnoanswerretry']>=_0x5675e1[_0x3165('0x1b3')]){_0xa34202[_0x3165('0xf4')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1b4'));}else{_0xa34202[_0x3165('0xfe')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1b4'));}}break;case'5':_0x5675e1[_0x3165('0x5d')]+=0x1;_0x3eed53[_0x3165('0xa6')]=0x5;_0x3eed53['statedesc']=_0x3165('0x1b5');_0x3eed53[_0x3165('0xec')]+=0x1;_0x3eed53[_0x3165('0x11f')]+=0x1;ami[_0x3165('0x4a')]('custom:agentbusy',ut[_0x3165('0xe5')](_0x37fab9,_0x3165('0x1b6')));_0xa34202[_0x3165('0xca')](_0x3eed53)[_0x3165('0xb1')](loggerCatch(_0x3165('0x1b7')));if(_0xa34202[_0x3165('0x1af')](0x5,_0x37fab9,_0x5675e1)){if(_0x3eed53[_0x3165('0xec')]>=_0x5675e1[_0x3165('0x19b')]){_0xa34202['createStateFinal'](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1b8'));}else{_0xa34202[_0x3165('0xfe')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1b8'));}}break;case'8':_0x5675e1[_0x3165('0x5e')]+=0x1;_0x3eed53[_0x3165('0xa6')]=0x8;_0x3eed53[_0x3165('0xa7')]=_0x3165('0x1b9');_0x3eed53[_0x3165('0xed')]+=0x1;_0x3eed53['countglobal']+=0x1;ami[_0x3165('0x4a')](_0x3165('0x1ba'),ut[_0x3165('0xe5')](_0x37fab9,_0x3165('0x1bb')));_0xa34202[_0x3165('0xca')](_0x3eed53)[_0x3165('0xb1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xa34202[_0x3165('0x1af')](0x8,_0x37fab9,_0x5675e1)){if(_0x3eed53['countcongestionretry']>=_0x5675e1[_0x3165('0x19e')]){_0xa34202['createStateFinal'](_0x3eed53,_0x3046c4,_0x27bbf8,'reason\x208\x20congestion');}else{_0xa34202[_0x3165('0xfe')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1bc'));}}break;case'11':_0x5675e1[_0x3165('0x1bd')]+=0x1;_0x3eed53[_0x3165('0xa6')]=0xb;_0x3eed53[_0x3165('0xa7')]='Abandoned';_0x3eed53[_0x3165('0xfd')]+=0x1;_0x3eed53[_0x3165('0x11f')]+=0x1;_0xa34202[_0x3165('0xca')](_0x3eed53)['catch'](loggerCatch(_0x3165('0x1be')));if(_0xa34202[_0x3165('0x1af')](0xb,_0x37fab9,_0x5675e1)){if(_0x3eed53[_0x3165('0xfd')]>=_0x5675e1['dialAbandonedMaxRetry']){_0xa34202[_0x3165('0xf4')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1bf'));}else{_0xa34202[_0x3165('0xfe')](_0x3eed53,_0x3046c4,_0x27bbf8,'reason\x2011\x20abandoned');}}break;case'20':_0x5675e1[_0x3165('0x64')]+=0x1;_0x3eed53['state']=0x14;_0x3eed53[_0x3165('0xa7')]=_0x3165('0x1c0');_0x3eed53['countagentrejectretry']+=0x1;_0x3eed53[_0x3165('0x11f')]+=0x1;ami[_0x3165('0x4a')](_0x3165('0x1c1'),ut['buildObj'](_0x37fab9,_0x3165('0x1c2')));_0xa34202[_0x3165('0xca')](_0x3eed53)[_0x3165('0xb1')](loggerCatch(_0x3165('0x1c3')));if(_0xa34202[_0x3165('0x1af')](0x14,_0x37fab9,_0x5675e1)){if(_0x3eed53[_0x3165('0xf0')]>=_0x5675e1['dialAgentRejectMaxRetry']){_0xa34202[_0x3165('0xf4')](_0x3eed53,_0x3046c4,_0x27bbf8,'reason\x2020\x20agentreject');}else{_0xa34202['stateGlobal'](_0x3eed53,_0x3046c4,_0x27bbf8,_0x3165('0x1c4'));}}break;default:_0x5675e1['outboundUnknownCallsDay']+=0x1;_0x3eed53[_0x3165('0xa6')]=0xc;_0x3eed53[_0x3165('0xa7')]=_0x1ceb65[_0x3165('0x108')];_0xa34202[_0x3165('0xca')](_0x3eed53)[_0x3165('0xb1')](loggerCatch(_0x3165('0x1c5')));if(_0xa34202[_0x3165('0x1af')](_0x1ceb65[_0x3165('0x108')],_0x37fab9,_0x5675e1)){if(_0x3eed53[_0x3165('0xec')]+_0x3eed53['countcongestionretry']+_0x3eed53[_0x3165('0xfc')]+_0x3eed53[_0x3165('0xee')]+_0x3eed53[_0x3165('0xef')]+_0x3eed53[_0x3165('0xfd')]+_0x3eed53[_0x3165('0xeb')]+_0x3eed53[_0x3165('0xf0')]>=_0x5675e1[_0x3165('0xf1')]){_0xa34202[_0x3165('0xfe')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x1ceb65[_0x3165('0x108')]);}else{_0xa34202[_0x3165('0xf4')](_0x3eed53,_0x3046c4,_0x27bbf8,_0x1ceb65['reason']);}}}});};Dialer['prototype'][_0x3165('0xfe')]=function(_0x24b5f2,_0x596ba7,_0x43aa25,_0x520858){var _0x3b97cd=new Final(_0x24b5f2);_0x3b97cd[_0x3165('0xa6')]=0xf;_0x3b97cd[_0x3165('0xa7')]=_0x3165('0x1c6');this['createStateFinal'](_0x3b97cd,_0x596ba7,_0x43aa25,_0x520858);};Dialer[_0x3165('0x1a')][_0x3165('0xf4')]=function(_0x1f7ce8,_0x4668ef,_0xb0a8da,_0x59a84b){this['moveContactManagedDialer'](_0x1f7ce8)['then'](function(){return _0x4668ef(msgResponse(_0x3165('0x1aa'),_0x3165('0x1c7'),_0x59a84b));})[_0x3165('0xb1')](function(){return _0xb0a8da(msgResponse(_0x3165('0x1c8'),'Failure',_0x3165('0x1c9')));});};Dialer[_0x3165('0x1a')][_0x3165('0x9')]=function(_0x47f382){var _0x1832c7=_0x47f382[_0x3165('0x1ca')]/0x64;var _0xb1ba4e=_0x47f382[_0x3165('0x61')]/(_0x47f382[_0x3165('0x61')]+_0x47f382[_0x3165('0x5b')]);var _0x2d0da9=Math[_0x3165('0x1cb')](_0x47f382[_0x3165('0x6b')]*(_0x47f382['predictiveIntervalMaxThreshold']/0x64));var _0x1eee97=Math['round'](_0x47f382[_0x3165('0x6b')]*(_0x47f382[_0x3165('0x1cc')]/0x64));var _0x3ee413=_0x47f382[_0x3165('0x4e')]+_0x47f382[_0x3165('0x53')];var _0x171bbf=Math[_0x3165('0x1cd')](_0x47f382[_0x3165('0x6e')]*_0x47f382[_0x3165('0x70')]*_0x47f382['predictiveIntervalHitRate']*_0x47f382[_0x3165('0x69')]);if(_[_0x3165('0x3a')](_0x47f382[_0x3165('0x72')])){if(!_[_0x3165('0x3a')](_0x47f382['startPredictive'])){_0x47f382[_0x3165('0x29')]=undefined;loggerPredictive[_0x3165('0x94')](_0x3165('0x1ce'),_0x3165('0x1cf'));}if(!_[_0x3165('0x3a')](_0x47f382[_0x3165('0x90')])){loggerPredictive[_0x3165('0x94')](_0x3165('0x1ce'),_0x3165('0x1d0'));clearInterval(_0x47f382[_0x3165('0x90')]);_0x47f382['handlePredictive']=undefined;}_0x47f382['startProgressive']=moment()[_0x3165('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3165('0x7b')](_0x47f382[_0x3165('0x3d')],'collection\x20data\x20in\x20progressive\x20at',_0x47f382[_0x3165('0x72')]);this[_0x3165('0x15c')](_0x47f382,0x1);}else if(ifInterval(_0x47f382[_0x3165('0x1d1')],_0x47f382[_0x3165('0x72')])){this[_0x3165('0x15c')](_0x47f382,0x1);loggerPredictiveCalls[_0x3165('0x7b')](_0x3165('0x1d2'),_0x47f382[_0x3165('0x72')],_0x47f382[_0x3165('0x3d')]);_0x47f382[_0x3165('0x6e')]=0x0;_0x47f382[_0x3165('0x1d3')]=0x0;}else if(_0x1832c7<_0xb1ba4e&&_0x47f382['dialPredictiveOptimization']===_0x3165('0x1d4')){freeVariablesPredictive(_0x47f382);loggerPredictive['info'](_0x3165('0x1d5'),_0x3165('0x1d6'),_0xb1ba4e,_0x3165('0x72'),_0x47f382[_0x3165('0x3d')]);}else if(_0x171bbf<_0x47f382[_0x3165('0x1d3')]&&_0x47f382[_0x3165('0x1d7')]===_0x3165('0x1d4')){freeVariablesPredictive(_0x47f382);loggerPredictive['info'](_0x3165('0x1d8'),_0x3165('0x1d9'),_0x171bbf,_0x3165('0x1da'),_0x47f382[_0x3165('0x1d3')],_0x3165('0x72'),_0x47f382['name']);}else if(!ifInterval(_0x47f382[_0x3165('0x1d1')],_0x47f382[_0x3165('0x72')])&&_[_0x3165('0x3a')](_0x47f382['startPredictive'])&&!_['isUndefined'](_0x47f382[_0x3165('0x72')])){_0x47f382[_0x3165('0x29')]=moment()[_0x3165('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3165('0x7b')](_0x47f382['name'],_0x3165('0x1db'),_0x47f382['startPredictive']);this[_0x3165('0x1dc')](_0x47f382[_0x3165('0x1d1')])[_0x3165('0xb8')](this[_0x3165('0x1dd')](_0x47f382))[_0x3165('0xb8')](mergeDataErlangB(_0x47f382))[_0x3165('0xb8')](this['startMethodPredictive'](_0x47f382))[_0x3165('0xb1')](loggerCatchPredictive(_0x3165('0x1de'),_0x47f382));}else if(!ifInterval(_0x47f382['dialPredictiveInterval'],_0x47f382[_0x3165('0x29')])){_0x47f382['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x47f382[_0x3165('0x29')]=moment()[_0x3165('0x79')](_0x3165('0xf7'));loggerPredictive['info'](_0x47f382[_0x3165('0x3d')],'recalculate\x20predictive\x20at',_0x47f382[_0x3165('0x29')]);clearInterval(_0x47f382[_0x3165('0x90')]);_0x47f382[_0x3165('0x90')]=undefined;this[_0x3165('0x1dc')](_0x47f382['dialPredictiveInterval'])['then'](this[_0x3165('0x1dd')](_0x47f382))[_0x3165('0xb8')](mergeDataErlangB(_0x47f382))[_0x3165('0xb8')](this[_0x3165('0x1df')](_0x47f382))[_0x3165('0xb1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x47f382));}else if(_0x47f382[_0x3165('0x6b')]&&_0x3ee413<_0x47f382[_0x3165('0x6b')]-_0x1eee97){freeVariablesPredictive(_0x47f382);loggerPredictive['info'](_0x47f382['name'],_0x3165('0x1e0'),_0x3ee413,')\x20are\x20less\x20than\x20threshold\x20(',_0x47f382[_0x3165('0x6b')],'-',_0x1eee97,'=',_0x47f382[_0x3165('0x6b')]-_0x1eee97,')');}else if(_0x47f382[_0x3165('0x6b')]&&_0x3ee413>_0x47f382[_0x3165('0x6b')]+_0x2d0da9){freeVariablesPredictive(_0x47f382);loggerPredictive[_0x3165('0x7b')](_0x47f382[_0x3165('0x3d')],_0x3165('0x1e0'),_0x3ee413,')\x20are\x20more\x20than\x20threshold\x20(',_0x47f382[_0x3165('0x6b')],'+',_0x2d0da9,'=',_0x47f382['predictiveIntervalAvailable']+_0x2d0da9,')');}};Dialer[_0x3165('0x1a')]['getDataPredictive']=function(_0xd1edf3){var _0x520373=this;return function(_0x16bb22){return new BPromise(function(_0x395cd4,_0x2f8268){_['merge'](_0xd1edf3,_0x16bb22[0x0]);if(checkGetDataPredictive(_0x16bb22[0x0])){var _0x3fff2a=_0xd1edf3[_0x3165('0x6b')]=_0xd1edf3[_0x3165('0x53')]+_0xd1edf3[_0x3165('0x4e')];var _0x4fd3e2=_0xd1edf3[_0x3165('0x1d1')]*0x3c;var _0x5c7ec9=_0x16bb22[0x0]['predictiveIntervalAvgTalktime']+_0x16bb22[0x0]['predictiveIntervalAvgHoldtime'];var _0xd18025=(_0x16bb22[0x0][_0x3165('0x1e1')]+_0x16bb22[0x0][_0x3165('0x80')]+_0x16bb22[0x0][_0x3165('0x82')])/_0x16bb22[0x0][_0x3165('0x6c')];_0xd1edf3[_0x3165('0x68')]=_0xd18025>0x0?_0xd18025:0x1;switch(_0xd1edf3[_0x3165('0x1d7')]){case'dropRate':var _0x503536=_0xd1edf3[_0x3165('0x1ca')]/0x64;return _0x520373[_0x3165('0x1e2')](_0x3fff2a,_0x4fd3e2,_0x5c7ec9,_0xd18025,_0x503536)[_0x3165('0xb8')](function(_0x40d866){return _0x395cd4(_0x40d866);});case'agentBusyFactor':var _0x3e192e=_0xd1edf3['dialPredictiveOptimizationPercentage']/0x64;return _0x520373[_0x3165('0x1e3')](_0x3fff2a,_0x4fd3e2,_0x5c7ec9,_0xd18025,_0x3e192e)[_0x3165('0xb8')](function(_0x4da66f){return _0x395cd4(_0x4da66f);});default:return _0x2f8268(msgResponse(_0x3165('0x1e4'),_0x3165('0x148'),'Unknown\x20Predictive'));}}else{return _0x2f8268(msgResponse('[getDataPredictive]',_0x3165('0x148'),_0x3165('0x1e5')));}});};};Dialer[_0x3165('0x1a')][_0x3165('0x1e6')]=function(_0x523fc5){var _0x89c9de=this;return function(_0x6a6da9){return new BPromise(function(_0x51580d,_0x27e2fe){_[_0x3165('0x8f')](_0x523fc5,_0x6a6da9[0x0]);if(checkGetDataPredictive(_0x6a6da9[0x0])){loggerPredictive['info'](JSON[_0x3165('0x46')](_0x6a6da9[0x0]));if(_0x523fc5[_0x3165('0x1d7')]==='dropRate'){return _0x89c9de[_0x3165('0xc6')](_0x523fc5['id'])[_0x3165('0xb8')](function(_0x27d645){var _0x30bf2c=_0x523fc5['loggedIn']-_0x27d645[0x0][_0x3165('0x1e7')];var _0xc5df9d=_0x523fc5[_0x3165('0x1d1')]*0x3c;var _0x4999cb=_0x6a6da9[0x0][_0x3165('0x66')]+_0x6a6da9[0x0][_0x3165('0x1e8')];var _0x3c57a8=(_0x6a6da9[0x0]['predictiveIntervalAnsweredCalls']+_0x6a6da9[0x0][_0x3165('0x80')]+_0x6a6da9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x6a6da9[0x0][_0x3165('0x6c')];var _0x3bfcde=_0x523fc5['dialPredictiveOptimizationPercentage']/0x64;_0x523fc5[_0x3165('0x6a')]=_0x27d645[0x0][_0x3165('0x1e7')]||0x0;_0x523fc5[_0x3165('0x68')]=_0x3c57a8>0x0?_0x3c57a8:0x1;return _0x89c9de[_0x3165('0x1e2')](_0x30bf2c,_0xc5df9d,_0x4999cb,_0x3c57a8,_0x3bfcde);})['then'](function(_0x3e2c13){return _0x51580d(_0x3e2c13);})['catch'](function(_0x5dc121){return _0x27e2fe(msgResponse('[CatchErlangB]',_0x3165('0x148'),JSON[_0x3165('0x46')](_0x5dc121)));});}if(_0x523fc5[_0x3165('0x1d7')]==='agentBusyFactor'){return _0x89c9de[_0x3165('0xc6')](_0x523fc5['id'])[_0x3165('0xb8')](function(_0x4d952b){var _0x3f2438=_0x523fc5['loggedIn']-_0x4d952b[0x0][_0x3165('0x1e7')];var _0x3bbc7d=_0x523fc5[_0x3165('0x1d1')]*0x3c;var _0x12c1c3=_0x6a6da9[0x0][_0x3165('0x66')]+_0x6a6da9[0x0][_0x3165('0x1e8')];var _0x22b17c=(_0x6a6da9[0x0]['predictiveIntervalAnsweredCalls']+_0x6a6da9[0x0][_0x3165('0x80')]+_0x6a6da9[0x0][_0x3165('0x82')])/_0x6a6da9[0x0][_0x3165('0x6c')];var _0x193239=_0x523fc5[_0x3165('0x1ca')]/0x64;_0x523fc5[_0x3165('0x6a')]=_0x4d952b[0x0][_0x3165('0x1e7')]||0x0;_0x523fc5['predictiveIntervalHitRate']=_0x22b17c>0x0?_0x22b17c:0x1;return _0x89c9de[_0x3165('0x1e3')](_0x3f2438,_0x3bbc7d,_0x12c1c3,_0x22b17c,_0x193239);})[_0x3165('0xb8')](function(_0x1ffcc2){return _0x51580d(_0x1ffcc2);})[_0x3165('0xb1')](function(_0x202bd7){return _0x27e2fe(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x202bd7)));});}}else{return _0x27e2fe(msgResponse(_0x3165('0x1e4'),_0x3165('0x148'),'check\x20failure'));}});};};Dialer[_0x3165('0x1a')][_0x3165('0x1df')]=function(_0x13069f){var _0x3a0044=this;return function(){var _0x470c98=0x0;var _0x4834fb=Math['floor'](_0x13069f[_0x3165('0x6f')]*0x3e8);if(_0x4834fb>0x0){_0x4834fb=_0x4834fb<0x64?0x64:_0x4834fb;loggerPredictive['info'](_0x13069f['name'],_0x3165('0x1e9'),_0x4834fb,_0x3165('0x47'));_0x13069f['handlePredictive']=setInterval(function(){_0x3a0044[_0x3165('0x90')](_0x13069f);loggerPredictiveCalls[_0x3165('0x7b')](_0x3165('0x1ea'),_0x470c98+=0x1);},_0x4834fb);}else{loggerPredictive[_0x3165('0x7b')](_0x13069f[_0x3165('0x3d')],_0x3165('0x1eb'));}};};Dialer[_0x3165('0x1a')][_0x3165('0x1ec')]=function(_0x5faf86,_0x32236d){var _0xc58401=this;return function(_0x27892e){if(_[_0x3165('0x43')](_0x27892e)){if(_['isNil'](_0x32236d['UserId'])||!_0x32236d['recallme']){if(_0x5faf86[_0x3165('0x59')]==='booked'){_0x5faf86[_0x3165('0x12a')]=_['isUndefined'](_0x5faf86[_0x3165('0x12a')])?!![]:_0x5faf86[_0x3165('0x12a')];var _0x360f93=uuid['v4']();_0xc58401[_0x3165('0x25')][_0x360f93]=new Action(_0x5faf86,_0x32236d,_0x360f93);loggerBooked[_0x3165('0x7b')](_0x3165('0x1ed'),_0x360f93,_0x3165('0x1ee'),JSON[_0x3165('0x46')](_0x5faf86[_0x3165('0x12a')]),_0x3165('0x1ef'),_0x5faf86[_0x3165('0x3d')]);if(_0x5faf86[_0x3165('0x12a')]){_0x5faf86[_0x3165('0x12a')]=![];_0xc58401[_0x3165('0x2a')][_0xc58401['actions'][_0x360f93]['queue']]=[];ami[_0x3165('0xaf')]({'actionid':_0x360f93,'action':'queuestatus','queue':_0x5faf86['name']})[_0x3165('0xb1')](function(){_0xc58401[_0x3165('0xb3')](_0x5faf86);_0xc58401[_0x3165('0xbe')]({'active':![],'ContactId':_0xc58401[_0x3165('0x25')][_0x360f93][_0x3165('0xd1')],'ListId':_0xc58401[_0x3165('0x25')][_0x360f93][_0x3165('0xd2')],'VoiceQueueId':_0xc58401[_0x3165('0x25')][_0x360f93][_0x3165('0xd4')]||undefined,'CampaignId':_0xc58401[_0x3165('0x25')][_0x360f93][_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x1f0')));delete _0xc58401[_0x3165('0x25')][_0x360f93];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x3165('0x46')](_0x5faf86[_0x3165('0x12a')]),'Queue:\x20',_0x5faf86['name']);_0xc58401[_0x3165('0xb3')](_0x5faf86);_0xc58401[_0x3165('0xbe')]({'active':![],'ContactId':_0xc58401[_0x3165('0x25')][_0x360f93]['ContactId'],'ListId':_0xc58401[_0x3165('0x25')][_0x360f93][_0x3165('0xd2')],'VoiceQueueId':_0xc58401[_0x3165('0x25')][_0x360f93][_0x3165('0xd4')]||undefined,'CampaignId':_0xc58401[_0x3165('0x25')][_0x360f93]['CampaignId']||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x1f0')));delete _0xc58401[_0x3165('0x25')][_0x360f93];}}else{return _0xc58401[_0x3165('0x169')](_0x5faf86,_0x32236d);}}else{if(getDiff(_0x32236d[_0x3165('0x1f1')])<_0x5faf86[_0x3165('0x1f2')]*0x3c){if(_0x32236d['Agent']&&!_0x32236d[_0x3165('0x1f3')]['voicePause']){_0xc58401[_0x3165('0x1e')]['run'](_0x32236d['id'])[_0x3165('0x1c')](function(){_0xc58401[_0x3165('0xb3')](_0x5faf86);});}else{_0xc58401[_0x3165('0xbf')]({'active':![]},_0x32236d['id'],0x1)[_0x3165('0x1c')](function(){_0xc58401[_0x3165('0xb3')](_0x5faf86);});}}else{_0x5faf86[_0x3165('0x1f4')]+=0x1;_0xc58401[_0x3165('0xb3')](_0x5faf86);if(_0x5faf86[_0x3165('0x1f5')]){_0xc58401[_0x3165('0xbe')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x32236d['ContactId'],'ListId':_0x32236d[_0x3165('0xd2')],'VoiceQueueId':_0x32236d[_0x3165('0xd4')]||undefined,'CampaignId':_0x32236d[_0x3165('0xd5')]||undefined})[_0x3165('0xb1')](loggerCatch(_0x3165('0x1f6')));_0xc58401['createHistory'](createObjHistory(_0x5faf86,_0x32236d,'RECALLINQUEUE',0x17,_0x3165('0x1f7')))[_0x3165('0xb1')](loggerCatch(_0x3165('0x1f8')));}else{_0xc58401[_0x3165('0xcf')](createObjHistory(_0x5faf86,_0x32236d,_0x3165('0x1f9'),0x16,_0x3165('0x1fa')),_0x3165('0x1fb'),'[Originate][HistoryRecallClose]');}}}}else{_0x5faf86['outboundBlacklistCallsDay']+=0x1;_0xc58401[_0x3165('0xcf')](createObjHistory(_0x5faf86,_0x32236d,_0x3165('0x1fc'),0xd,_0x3165('0x1fd')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x3165('0x1fe');}};};Dialer['prototype'][_0x3165('0x1ff')]=function(_0x456acd){var _0x5ade82=this;var _0x57897a=_0x456acd[_0x3165('0x200')]-_0x456acd[_0x3165('0x6d')]-_0x456acd[_0x3165('0xc2')];emitCampaignSummary(_0x456acd);if(_0x57897a>0x0){if(_0x57897a>this[_0x3165('0x23')]){_0x57897a=this['maxNumberOriginate'];}_0x456acd[_0x3165('0xc2')]+=_0x57897a;this[_0x3165('0xc4')](_0x456acd['id'],_0x57897a,_0x456acd[_0x3165('0x201')],_0x456acd)['then'](function(_0x3fdbb0){_0x456acd[_0x3165('0xc2')]-=_0x57897a;_0x456acd[_0x3165('0xc2')]=_0x456acd['temp']>0x0?_0x456acd[_0x3165('0xc2')]:0x0;if(!checkContactEmpty(_0x3fdbb0)){_0x456acd[_0x3165('0x3b')]=_0x3165('0x9c');logger['info'](_0x3165('0x202')+_0x456acd['name']);}else{_0x456acd[_0x3165('0x6d')]+=_0x3fdbb0[_0x3165('0x96')];_0x456acd['message']=_0x3165('0x203');for(var _0x3a9224=0x0;_0x3a9224<_0x3fdbb0[_0x3165('0x96')];_0x3a9224+=0x1){_0x456acd['ivrTotalCallsDays']+=0x1;if(_[_0x3165('0xae')](_0x3fdbb0[_0x3a9224])||_[_0x3165('0xae')](_0x3fdbb0[_0x3a9224]['Contact'])||_[_0x3165('0xae')](_0x3fdbb0[_0x3a9224][_0x3165('0x16c')]['phone'])){_0x5ade82[_0x3165('0xcd')](_0x3165('0x204'),_0x456acd,_0x3fdbb0[_0x3a9224]);}else{_0x5ade82[_0x3165('0xba')](_[_0x3165('0xd0')](_0x3fdbb0[_0x3a9224],[_0x3165('0xd5'),_0x3165('0x205')]))[_0x3165('0xb8')](_0x5ade82['checkContactBlack'](_0x456acd,_0x3fdbb0[_0x3a9224]))[_0x3165('0xb1')](_0x5ade82[_0x3165('0x206')](_0x3165('0x207'),_0x456acd));}}}})['catch'](loggerGetContactDialer(_0x3165('0x208'),_0x456acd,_0x57897a));}};Dialer[_0x3165('0x1a')]['handlePower']=function(_0x56c2a1,_0x427133){var _0x201347=this;var _0x52f5c4=[];var _0x417fa3=_0x427133>=0x1?_0x427133:0x1;if(_0x56c2a1[_0x3165('0x59')]===_0x3165('0x8')){_0x417fa3=0x1;}var _0xa71fc4=Math['floor'](_0x56c2a1['available']*_0x417fa3)-_0x56c2a1['originated']-_0x56c2a1[_0x3165('0xc2')];emitVoiceQueueSummary(_0x56c2a1);if(_0x56c2a1['dialLimitQueue']>0x0){var _0x7cc011=_0x56c2a1[_0x3165('0x209')]-_0x56c2a1[_0x3165('0x6d')]-_0x56c2a1[_0x3165('0x53')]-_0x56c2a1[_0x3165('0xc2')]-_0x56c2a1[_0x3165('0x9f')];if(_0xa71fc4>_0x7cc011){_0xa71fc4=_0x7cc011;}}if(_0xa71fc4>0x0){if(_0x56c2a1[_0x3165('0x59')]===_0x3165('0x8')){_0xa71fc4=0x1;}if(_0xa71fc4>this[_0x3165('0x23')]){_0xa71fc4=this[_0x3165('0x23')];}_0x56c2a1[_0x3165('0xc2')]+=_0xa71fc4;for(var _0x5dbc93 in this['agents']){if(typeof this[_0x3165('0x21')][_0x5dbc93]!==_0x3165('0xac')){if(this['agents'][_0x5dbc93]['state']===_0x3165('0x20a')&&this[_0x3165('0x21')][_0x5dbc93][_0x3165('0xd8')]===_0x3165('0x20b')){_0x52f5c4[_0x3165('0x128')](this[_0x3165('0x21')][_0x5dbc93]['id']);}}}this[_0x3165('0xc1')](_0x56c2a1['id'],_0x52f5c4,_0xa71fc4,_0x56c2a1[_0x3165('0x201')],_0x56c2a1)['then'](function(_0x41c84a){_0x56c2a1[_0x3165('0xc2')]-=_0xa71fc4;_0x56c2a1['temp']=_0x56c2a1['temp']>0x0?_0x56c2a1['temp']:0x0;if(!checkContactEmpty(_0x41c84a)){_0x201347[_0x3165('0xb5')](_0x56c2a1)[_0x3165('0xb8')](sendMessageReschedule(_0x56c2a1))[_0x3165('0xb1')](loggerCatch(_0x3165('0xb6')));}else{_0x56c2a1['originated']+=_0x41c84a[_0x3165('0x96')];_0x56c2a1[_0x3165('0x3b')]=_0x56c2a1[_0x3165('0x59')]===_0x3165('0x8')?'ACTIVE':_0x3165('0x203');for(var _0x39f3e9=0x0;_0x39f3e9<_0x41c84a['length'];_0x39f3e9+=0x1){if(_[_0x3165('0xae')](_0x41c84a[_0x39f3e9])||_[_0x3165('0xae')](_0x41c84a[_0x39f3e9][_0x3165('0x16c')])||_[_0x3165('0xae')](_0x41c84a[_0x39f3e9][_0x3165('0x16c')][_0x3165('0x16d')])){_0x201347['emptyContact']('[actionOriginate]\x20',_0x56c2a1,_0x41c84a[_0x39f3e9]);}else{_0x201347['checkIsBlackList'](_['pick'](_0x41c84a[_0x39f3e9],[_0x3165('0xd4'),_0x3165('0x205')]))[_0x3165('0xb8')](_0x201347['checkContactBlack'](_0x56c2a1,_0x41c84a[_0x39f3e9]))[_0x3165('0xb1')](_0x201347[_0x3165('0x206')](_0x3165('0x204'),_0x56c2a1));}}}})[_0x3165('0xb1')](loggerGetContactDialer(_0x3165('0x20c'),_0x56c2a1,_0xa71fc4));}};Dialer['prototype'][_0x3165('0x90')]=function(_0x5b4d3c){if(_0x5b4d3c[_0x3165('0x209')]>0x0){var _0x26d7a3=_0x5b4d3c[_0x3165('0x209')]-_0x5b4d3c['originated']-_0x5b4d3c['talking'];if(_0x26d7a3>0x0){this[_0x3165('0x20d')](_0x5b4d3c);}else{loggerPredictiveCalls[_0x3165('0x7b')]('[handlePredictive][limitChannel]');}}else{this[_0x3165('0x20d')](_0x5b4d3c);}};Dialer[_0x3165('0x1a')][_0x3165('0x20d')]=function(_0x5799b1){var _0x3e08cd=this;var _0x25c391=[];_0x5799b1[_0x3165('0x6d')]+=0x1;for(var _0x122716 in this['agents']){if(typeof this[_0x3165('0x21')][_0x122716]!==_0x3165('0xac')){if(this[_0x3165('0x21')][_0x122716][_0x3165('0xa6')]===_0x3165('0x20a')&&this['agents'][_0x122716][_0x3165('0xd8')]===_0x3165('0x20b')){_0x25c391[_0x3165('0x128')](this[_0x3165('0x21')][_0x122716]['id']);}}}this[_0x3165('0xc1')](_0x5799b1['id'],_0x25c391,0x1,_0x5799b1[_0x3165('0x201')],_0x5799b1)['then'](function(_0x4a8c21){if(!checkContactEmpty(_0x4a8c21)){checkContactLowerLimitOriginate(_0x5799b1,0x1,0x0);_0x3e08cd['countReScheduled'](_0x5799b1)['then'](sendMessageReschedule(_0x5799b1))[_0x3165('0xb1')](loggerCatch(_0x3165('0xb6')));}else{_0x5799b1[_0x3165('0x3b')]=_0x3165('0x203');if(_['isNil'](_0x4a8c21[0x0])||_[_0x3165('0xae')](_0x4a8c21[0x0]['Contact'])||_[_0x3165('0xae')](_0x4a8c21[0x0][_0x3165('0x16c')]['phone'])){_0x3e08cd[_0x3165('0xcd')](_0x3165('0x204'),_0x5799b1,_0x4a8c21[0x0]);}else{_0x3e08cd[_0x3165('0xb7')](_[_0x3165('0xd0')](_0x4a8c21[0x0],[_0x3165('0xd4'),_0x3165('0x205')]))[_0x3165('0xb8')](_0x3e08cd[_0x3165('0x1ec')](_0x5799b1,_0x4a8c21[0x0]))[_0x3165('0xb1')](_0x3e08cd[_0x3165('0x206')](_0x3165('0x20e'),_0x5799b1));}}})[_0x3165('0xb1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5799b1,0x1));emitVoiceQueueSummary(_0x5799b1);};Dialer[_0x3165('0x1a')]['abandonmentRate']=function(_0x3be305,_0x69aaca,_0x2c6806,_0x4bff6e,_0x655bd1,_0x2151f8){loggerPredictive[_0x3165('0x7b')](_0x3165('0x20f'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3be305);loggerPredictive[_0x3165('0x7b')](_0x3165('0x210'),_0x69aaca);loggerPredictive['info'](_0x3165('0x211'),_0x2c6806);loggerPredictive[_0x3165('0x7b')](_0x3165('0x212'),_0x4bff6e);loggerPredictive['info'](_0x3165('0x213'),_0x655bd1);loggerPredictive['info'](_0x3165('0x85'));return new BPromise(function(_0x3b10e1,_0x260d4f){if(_0x3be305<=0x0||isNaN(_0x3be305)){return _0x260d4f(msgResponse(_0x3165('0x214'),_0x3165('0x45'),'m\x20=\x20'+_0x3be305));}if(_0x2c6806<=0x0||isNaN(_0x2c6806)){return _0x260d4f(msgResponse(_0x3165('0x214'),_0x3165('0x45'),_0x3165('0x215')+_0x2c6806));}if(_0x4bff6e<=0x0||isNaN(_0x4bff6e)){return _0x260d4f(msgResponse(_0x3165('0x214'),'Error',_0x3165('0x216')+_0x4bff6e));}if(_0x69aaca<=0x0||isNaN(_0x69aaca)){return _0x260d4f(msgResponse(_0x3165('0x214'),_0x3165('0x45'),_0x3165('0x217')+_0x69aaca));}if(_0x655bd1<=0x0||isNaN(_0x655bd1)){return _0x260d4f(msgResponse(_0x3165('0x214'),_0x3165('0x45'),'Amax\x20=\x20'+_0x655bd1));}_0x2151f8=_0x2151f8||0x0;var _0x5ce0da=0x1/_0x2c6806;var _0x2dc51a=0x0;var _0x876b69=0x0;var _0x4efe41=0x0;var _0x22fd02=0x0;for(var _0x3c7c27=0x0;_0x4efe41<_0x655bd1;_0x3c7c27+=0x1){_0x876b69=_0x3c7c27/_0x69aaca;_0x2dc51a=(_0x4bff6e*_0x876b69+_0x2151f8)/_0x5ce0da;_0x4efe41=erlangb(_0x2dc51a,_0x3be305);_0x22fd02=_0x2dc51a/_0x3be305*(0x1-erlangb(_0x2dc51a,_0x3be305));}return _0x3b10e1({'erlangCalls':_0x3c7c27,'erlangCallToSecond':_0x69aaca/_0x3c7c27,'erlangAbandonmentRate':_0x4efe41,'erlangBusyFactor':_0x22fd02});});};Dialer[_0x3165('0x1a')]['busyFactor']=function(_0x21e467,_0x20f808,_0x3e3266,_0x5071b3,_0x3008ea,_0x2aed36){loggerPredictive[_0x3165('0x7b')](_0x3165('0x218'));loggerPredictive[_0x3165('0x7b')]('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',_0x21e467);loggerPredictive['info'](_0x3165('0x210'),_0x20f808);loggerPredictive[_0x3165('0x7b')](_0x3165('0x211'),_0x3e3266);loggerPredictive['info'](_0x3165('0x212'),_0x5071b3);loggerPredictive[_0x3165('0x7b')](_0x3165('0x219'),_0x3008ea);loggerPredictive['info'](_0x3165('0x85'));return new BPromise(function(_0x4487e3,_0x2aad81){if(_0x21e467<=0x0||isNaN(_0x21e467)){return _0x2aad81(msgResponse(_0x3165('0x21a'),_0x3165('0x45'),'m\x20=\x20'+_0x21e467));}if(_0x3e3266<=0x0||isNaN(_0x3e3266)){return _0x2aad81(msgResponse(_0x3165('0x21a'),_0x3165('0x45'),'Ts\x20=\x20'+_0x3e3266));}if(_0x5071b3<=0x0||isNaN(_0x5071b3)){return _0x2aad81(msgResponse(_0x3165('0x21a'),_0x3165('0x45'),_0x3165('0x216')+_0x5071b3));}if(_0x20f808<=0x0||isNaN(_0x20f808)){return _0x2aad81(msgResponse(_0x3165('0x21a'),_0x3165('0x45'),_0x3165('0x217')+_0x20f808));}if(_0x3008ea<=0x0||isNaN(_0x3008ea)){return _0x2aad81(msgResponse(_0x3165('0x21a'),_0x3165('0x45'),_0x3165('0x21b')+_0x3008ea));}_0x2aed36=_0x2aed36||0x0;var _0x13df6=0x1/_0x3e3266;var _0x2cea0e=0x0;var _0x42e800=0x0;var _0x1b0df2=0x0;var _0x54175c=0x0;for(var _0xdf0434=0x0;_0x54175c<_0x3008ea;_0xdf0434+=0x1){_0x42e800=_0xdf0434/_0x20f808;_0x2cea0e=(_0x5071b3*_0x42e800+_0x2aed36)/_0x13df6;_0x1b0df2=erlangb(_0x2cea0e,_0x21e467);_0x54175c=_0x2cea0e/_0x21e467*(0x1-erlangb(_0x2cea0e,_0x21e467));}return _0x4487e3({'erlangCalls':_0xdf0434,'erlangCallToSecond':_0x20f808/_0xdf0434,'erlangAbandonmentRate':_0x1b0df2,'erlangBusyFactor':_0x54175c});});};module[_0x3165('0x21c')]=Dialer; \ No newline at end of file +var _0xe6d0=['reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','getDataPredictiveOld','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','outboundQueuePauses','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','bluebird','moment','../../../config/logger','dialer','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','answered','available','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','prototype','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','variable','exten','xcally-motion-dialer','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','cause-txt','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','outboundDropCallsDayTimeout','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','actionid','strategy','roundrobin','locked','paused','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','Failure','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','dialActive','loggedIn','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','dialGlobalInterval','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0xe6d0,0x6a));var _0x0e6d=function(_0x5ac19e,_0x34493f){_0x5ac19e=_0x5ac19e-0x0;var _0x1d22c2=_0xe6d0[_0x5ac19e];return _0x1d22c2;};'use strict';var util=require(_0x0e6d('0x0'));var _=require('lodash');var BPromise=require(_0x0e6d('0x1'));var uuid=require('uuid');var moment=require(_0x0e6d('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x0e6d('0x3'))(_0x0e6d('0x4'));var loggerBooked=require(_0x0e6d('0x3'))('booked');var loggerPredictive=require(_0x0e6d('0x3'))(_0x0e6d('0x5'));var loggerPredictiveCalls=require(_0x0e6d('0x3'))(_0x0e6d('0x6'));var loggerSyncQueueSummary=require(_0x0e6d('0x3'))('syncQueueSummary');var ami=require(_0x0e6d('0x7'));config['redis']=_[_0x0e6d('0x8')](config[_0x0e6d('0x9')],{'host':_0x0e6d('0xa'),'port':0x18eb});var io=require(_0x0e6d('0xb'))(new Redis(config[_0x0e6d('0x9')]));var cmHopper=require(_0x0e6d('0xc'));var cmHopperHistory=require(_0x0e6d('0xd'));var cmHopperBlack=require(_0x0e6d('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x0e6d('0xf'));var History=require('./history');var Final=require(_0x0e6d('0x10'));var AgentComplete=require(_0x0e6d('0x11'));var QueueCallerAbandon=require(_0x0e6d('0x12'));var Hangup=require(_0x0e6d('0x13'));var ipAgi=process['env'][_0x0e6d('0x14')]||_0x0e6d('0x15');var strategy={'rrmemory':_0x0e6d('0x16'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x0e6d('0x17')]=function(_0x5d2c2e){this[_0x0e6d('0x18')]=this['tail']?this['tail'][_0x0e6d('0x19')](_0x5d2c2e):_0x5d2c2e();};function Dialer(_0x2c8faf,_0x55c428){this[_0x0e6d('0x1a')]=new Sequence();this['preview']=_0x55c428;this[_0x0e6d('0x1b')]=_0x2c8faf[_0x0e6d('0x1b')];this[_0x0e6d('0x1c')]=_0x2c8faf[_0x0e6d('0x1c')];this[_0x0e6d('0x1d')]=_0x2c8faf[_0x0e6d('0x1d')];this[_0x0e6d('0x1e')]=_0x2c8faf[_0x0e6d('0x1e')];this[_0x0e6d('0x1f')]=config[_0x0e6d('0x1f')]||0x2;this[_0x0e6d('0x20')]={};this[_0x0e6d('0x21')]={};this[_0x0e6d('0x22')]={};this[_0x0e6d('0x23')]={};this['optionPredictive']={};this[_0x0e6d('0x24')]={};this[_0x0e6d('0x25')]={};this[_0x0e6d('0x26')]={};this[_0x0e6d('0x27')]={};this['queueBookedRR']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x0e6d('0x28')](this));ami['on']('queuecallerabandon',this[_0x0e6d('0x29')][_0x0e6d('0x28')](this));ami['on'](_0x0e6d('0x2a'),this[_0x0e6d('0x2b')][_0x0e6d('0x28')](this));ami['on'](_0x0e6d('0x2c'),this['syncAgentComplete'][_0x0e6d('0x28')](this));ami['on'](_0x0e6d('0x2d'),this[_0x0e6d('0x2e')]['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x0e6d('0x2f'),this[_0x0e6d('0x30')][_0x0e6d('0x28')](this));ami['on'](_0x0e6d('0x31'),this[_0x0e6d('0x32')][_0x0e6d('0x28')](this));ami['on']('queuemember',this[_0x0e6d('0x33')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x0e6d('0x34')][_0x0e6d('0x28')](this));this['loopCampaigns']();this[_0x0e6d('0x35')]();}function isNotNull(_0x4b78c7){return _0x4b78c7!==null&&!_[_0x0e6d('0x36')](_0x4b78c7);}function checkIsLoggedIn(_0xa957c7,_0x4b6d1d){return function(){if(_0x4b6d1d<=0x0){_0xa957c7['message']=_0x0e6d('0x37');throw _0xa957c7[_0x0e6d('0x38')]+_0x0e6d('0x39');}};}function isActive(_0xd00f9f){return _0xd00f9f;}function checkIsActive(_0x77c393,_0x184047){return function(){if(!isActive(_0x184047)){_0x77c393[_0x0e6d('0x3a')]=_0x0e6d('0x3b');throw _0x77c393['name']+_0x0e6d('0x3c');}};}function checkInterval(_0x1c121c){return function(){if(!isNotNull(_0x1c121c['Interval'])){_0x1c121c[_0x0e6d('0x3a')]=_0x0e6d('0x3d');throw _0x1c121c[_0x0e6d('0x38')]+_0x0e6d('0x3e');}if(!isNotNull(_0x1c121c[_0x0e6d('0x3f')][_0x0e6d('0x40')])){_0x1c121c[_0x0e6d('0x3a')]=_0x0e6d('0x3d');throw _0x1c121c[_0x0e6d('0x38')]+_0x0e6d('0x3e');}if(!isNotNull(_[_0x0e6d('0x41')](_0x1c121c[_0x0e6d('0x3f')]['Intervals']))){_0x1c121c[_0x0e6d('0x3a')]=_0x0e6d('0x3d');throw _0x1c121c['name']+_0x0e6d('0x3e');}};}function msgResponse(_0x4e57e5,_0x1b4606,_0x46daaa){return{'action':_0x4e57e5,'response':_0x1b4606,'message':_0x46daaa,'stack':_0x46daaa};}function myreject(_0x25cc84){return function(_0x1aca2d){return _0x25cc84(msgResponse(_0x0e6d('0x42'),_0x0e6d('0x43'),JSON[_0x0e6d('0x44')](_0x1aca2d)));};}function getSeconds(_0x78d2a9,_0x3bfd8c){var _0x1ade05=moment(_0x78d2a9)['milliseconds'](0x0);var _0x5342de=moment(_0x3bfd8c)[_0x0e6d('0x45')](0x0);return _0x1ade05[_0x0e6d('0x46')](_0x5342de,_0x0e6d('0x47'));}function emit(_0x26f6f1,_0x1868c4,_0x418397){io['to'](_0x26f6f1)[_0x0e6d('0x48')](_0x1868c4,_0x418397);}function emitVoiceQueueSummary(_0x78ec2f){if(_0x78ec2f['type']===_0x0e6d('0x49')){var _0x158a73={'id':_0x78ec2f['id'],'name':_0x78ec2f['name'],'strategy':_0x78ec2f['strategy'],'answered':_0x78ec2f[_0x0e6d('0x4a')],'available':_0x78ec2f[_0x0e6d('0x4b')],'loggedIn':_0x78ec2f['loggedIn'],'pTalking':_0x78ec2f['pTalking'],'sumBillable':_0x78ec2f['sumBillable'],'sumDuration':_0x78ec2f[_0x0e6d('0x4c')],'sumHoldTime':_0x78ec2f[_0x0e6d('0x4d')]||0x0,'talking':_0x78ec2f[_0x0e6d('0x4e')],'total':_0x78ec2f[_0x0e6d('0x4f')],'type':_0x78ec2f[_0x0e6d('0x50')],'unmanaged':_0x78ec2f[_0x0e6d('0x51')],'abandoned':_0x78ec2f[_0x0e6d('0x52')],'waiting':_0x78ec2f['waiting'],'loggedInDb':_0x78ec2f['loggedInDb'],'dialActive':_0x78ec2f['dialActive'],'dialMethod':_0x78ec2f[_0x0e6d('0x53')],'dialOriginateCallerIdName':_0x78ec2f[_0x0e6d('0x54')],'dialOriginateCallerIdNumber':_0x78ec2f[_0x0e6d('0x55')],'dialOriginateTimeout':_0x78ec2f[_0x0e6d('0x56')],'dialPrefix':_0x78ec2f[_0x0e6d('0x57')],'outboundAnswerAgiCallsDay':_0x78ec2f[_0x0e6d('0x58')],'outboundAnswerCallsDay':_0x78ec2f[_0x0e6d('0x59')],'outboundBlacklistCallsDay':_0x78ec2f[_0x0e6d('0x5a')],'outboundBusyCallsDay':_0x78ec2f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x78ec2f[_0x0e6d('0x5b')],'outboundDropCallsDayACS':_0x78ec2f[_0x0e6d('0x5c')],'outboundDropCallsDayCallersExit':_0x78ec2f[_0x0e6d('0x5d')],'outboundDropCallsDayTimeout':_0x78ec2f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x78ec2f[_0x0e6d('0x5e')],'outboundNoSuchCallsDay':_0x78ec2f[_0x0e6d('0x5f')],'outboundOriginateFailureCallsDay':_0x78ec2f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x78ec2f[_0x0e6d('0x60')],'outboundRejectCallsDay':_0x78ec2f[_0x0e6d('0x61')],'outboundUnknownCallsDay':_0x78ec2f['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x78ec2f[_0x0e6d('0x62')],'predictiveIntervalAvgHoldtime':_0x78ec2f[_0x0e6d('0x63')],'predictiveIntervalAvgTalktime':_0x78ec2f[_0x0e6d('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x78ec2f[_0x0e6d('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x78ec2f[_0x0e6d('0x66')],'predictiveIntervalErlangCalls':_0x78ec2f[_0x0e6d('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x78ec2f[_0x0e6d('0x68')],'predictiveIntervalHitRate':_0x78ec2f[_0x0e6d('0x69')],'predictiveIntervalMultiplicativeFactor':_0x78ec2f[_0x0e6d('0x6a')],'predictiveIntervalPauses':_0x78ec2f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x78ec2f[_0x0e6d('0x6b')],'predictiveIntervalTotalCalls':_0x78ec2f['predictiveIntervalTotalCalls'],'message':_0x78ec2f[_0x0e6d('0x3a')],'originated':_0x78ec2f['originated'],'erlangCalls':_0x78ec2f['erlangCalls'],'erlangCallToSecond':_0x78ec2f[_0x0e6d('0x6c')],'erlangAbandonmentRate':_0x78ec2f[_0x0e6d('0x6d')],'erlangBusyFactor':_0x78ec2f[_0x0e6d('0x6e')],'startPredictive':_0x78ec2f[_0x0e6d('0x24')],'startProgressive':_0x78ec2f[_0x0e6d('0x25')]};if(_0x78ec2f['Trunk']){_0x158a73[_0x0e6d('0x6f')]={'id':_0x78ec2f[_0x0e6d('0x6f')]['id'],'name':_0x78ec2f[_0x0e6d('0x6f')]['name'],'active':_0x78ec2f[_0x0e6d('0x6f')][_0x0e6d('0x70')],'callerid':_0x78ec2f[_0x0e6d('0x6f')]['callerid']};}if(_0x78ec2f[_0x0e6d('0x3f')]){_0x158a73[_0x0e6d('0x3f')]={'id':_0x78ec2f['Interval']['id'],'name':_0x78ec2f[_0x0e6d('0x3f')][_0x0e6d('0x38')]};}var _0x2a8a6f=md5(JSON[_0x0e6d('0x44')](_0x158a73));if(_0x78ec2f[_0x0e6d('0x71')]!==_0x2a8a6f){_0x78ec2f[_0x0e6d('0x71')]=_0x2a8a6f;emit(util[_0x0e6d('0x72')](_0x0e6d('0x73'),_0x158a73[_0x0e6d('0x38')]),_0x0e6d('0x74'),_0x158a73);}}}function emitCampaignSummary(_0xa41c57){if(_0xa41c57[_0x0e6d('0x50')]===_0x0e6d('0x75')){emit(util[_0x0e6d('0x72')](_0x0e6d('0x76'),_0xa41c57[_0x0e6d('0x38')]),_0x0e6d('0x77'),_0xa41c57);}}function checkGetDataPredictive(_0x539637){if(isNotNull(_0x539637)&&!_[_0x0e6d('0x41')](_0x539637)){loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x79'));loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x7a'),_0x539637['predictiveIntervalTotalCalls']);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x7b'),_0x539637[_0x0e6d('0x62')]);loggerPredictive['info'](_0x0e6d('0x7c'),_0x539637[_0x0e6d('0x66')]);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x7d'),_0x539637[_0x0e6d('0x65')]);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x7e'),_0x539637[_0x0e6d('0x63')]);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x7f'),_0x539637[_0x0e6d('0x64')]);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x80'));if(_0x539637[_0x0e6d('0x81')]>0x0){if(!_[_0x0e6d('0x36')](_0x539637[_0x0e6d('0x64')])&&_0x539637[_0x0e6d('0x64')]>0x0){return!![];}loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x82'));if(!_[_0x0e6d('0x36')](_0x539637[_0x0e6d('0x63')])&&_0x539637[_0x0e6d('0x63')]>0x0){return!![];}loggerPredictive[_0x0e6d('0x78')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x168b0c){return function(_0x38f0e9){loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x83'));loggerPredictive[_0x0e6d('0x78')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38f0e9[_0x0e6d('0x84')]);loggerPredictive[_0x0e6d('0x78')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38f0e9[_0x0e6d('0x6c')]);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x85'),_0x38f0e9[_0x0e6d('0x6d')]);loggerPredictive[_0x0e6d('0x78')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38f0e9[_0x0e6d('0x6e')]);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x85'),_0x38f0e9[_0x0e6d('0x6d')]);loggerPredictive[_0x0e6d('0x78')]('---------------------------');_[_0x0e6d('0x86')](_0x168b0c,_0x38f0e9);};}function getDiff(_0x4eab8e){var _0xb13616=moment()[_0x0e6d('0x45')](0x0);var _0x392738=moment(_0x4eab8e)[_0x0e6d('0x45')](0x0);return _0xb13616[_0x0e6d('0x46')](_0x392738,'seconds');}function ifInterval(_0x34ed96,_0x476cf7){if(_['isUndefined'](_0x476cf7)){return![];}return getDiff(_0x476cf7)<_0x34ed96*0x3c;}function freeVariablesPredictive(_0x4d35f9){if(isNotNull(_0x4d35f9)){if(!_[_0x0e6d('0x36')](_0x4d35f9[_0x0e6d('0x25')])){_0x4d35f9[_0x0e6d('0x25')]=undefined;loggerPredictive[_0x0e6d('0x78')](_0x4d35f9[_0x0e6d('0x38')],_0x0e6d('0x87'));}if(!_['isUndefined'](_0x4d35f9[_0x0e6d('0x24')])){_0x4d35f9[_0x0e6d('0x24')]=undefined;loggerPredictive[_0x0e6d('0x78')](_0x4d35f9[_0x0e6d('0x38')],_0x0e6d('0x88'));}if(!_[_0x0e6d('0x36')](_0x4d35f9[_0x0e6d('0x89')])){clearInterval(_0x4d35f9[_0x0e6d('0x89')]);_0x4d35f9['handlePredictive']=undefined;loggerPredictive[_0x0e6d('0x78')](_0x4d35f9[_0x0e6d('0x38')],_0x0e6d('0x8a'));}}}function erlangb(_0x336009,_0x531641){if(_0x531641===0x0){return 0x0;}var _0x57e965=0x1;for(var _0x3760e9=0x1;_0x3760e9<=_0x531641;_0x3760e9+=0x1){_0x57e965=0x1+_0x57e965*_0x3760e9/_0x336009;}return 0x1/_0x57e965;}function isVoiceQueueOutbound(_0x5bbec8){return _0x5bbec8==='outbound';}function isNotPreview(_0x299ef8){return _0x299ef8!==_0x0e6d('0x8b');}function isCampaignIvr(_0x13b441){return _0x13b441===_0x0e6d('0x75');}function getCallerId(_0x5d46c4,_0xed32a1,_0x567e46){if(!_['isUndefined'](_0x567e46)&&typeof _0x567e46===_0x0e6d('0x8c')&&!_[_0x0e6d('0x41')](_0x567e46)){if(!_['isUndefined'](_0xed32a1)&&typeof _0xed32a1===_0x0e6d('0x8c')&&!_[_0x0e6d('0x41')](_0xed32a1)){return util[_0x0e6d('0x72')](_0x0e6d('0x8d'),_0xed32a1,_0x567e46);}return util[_0x0e6d('0x72')](_0x0e6d('0x8d'),_0x567e46,_0x567e46);}if(!_[_0x0e6d('0x36')](_0x5d46c4)&&typeof _0x5d46c4===_0x0e6d('0x8c')&&!_[_0x0e6d('0x41')](_0x5d46c4)){return _0x5d46c4;}return _0x0e6d('0x8e');}function loggerCatchQueueSummary(_0x1088b6,_0x1d5920){return function(_0x2bce26){freeVariablesPredictive(_0x1d5920);emitVoiceQueueSummary(_0x1d5920);emitCampaignSummary(_0x1d5920);loggerSyncQueueSummary['error'](_0x1088b6,util[_0x0e6d('0x8f')](_0x2bce26,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xa6ac99,_0x32b414){return function(_0x1ed862){loggerPredictive['error'](_0x32b414[_0x0e6d('0x38')],_0xa6ac99);loggerPredictive[_0x0e6d('0x90')](_0x1ed862[_0x0e6d('0x91')]);freeVariablesPredictive(_0x32b414);};}function loggerCatch(_0xe4daba){return function(_0x1e77d5){logger[_0x0e6d('0x90')](_0xe4daba,util[_0x0e6d('0x8f')](_0x1e77d5,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5bca1e){return _0x5bca1e&&!_[_0x0e6d('0x36')](_0x5bca1e)&&_0x5bca1e[_0x0e6d('0x92')]>0x0;}function decremetOriginate(_0x10f0d8){if(!_[_0x0e6d('0x36')](_0x10f0d8)&&_0x10f0d8!==null){if(typeof _0x10f0d8[_0x0e6d('0x93')]!==_0x0e6d('0x94')){if(_0x10f0d8[_0x0e6d('0x93')]>0x0){_0x10f0d8['originated']-=0x1;}else{logger['error'](_0x0e6d('0x95'));}}}else{logger['error'](_0x0e6d('0x96'));}}function checkContactLowerLimitOriginate(_0x19e08b,_0x3326a4,_0x48c3b4){if(_0x3326a4>_0x48c3b4){for(var _0xfd8971=0x0;_0xfd8971<_0x3326a4-_0x48c3b4;_0xfd8971+=0x1){decremetOriginate(_0x19e08b);}}}function loggerGetContactDialer(_0x30472a,_0x303063,_0x326afd){return function(_0x394264){checkContactLowerLimitOriginate(_0x303063,_0x326afd,0x0);logger['error'](_0x30472a,util[_0x0e6d('0x8f')](_0x394264,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5a3be2){return function(_0x584e80){if(isNotNull(_0x584e80)&&isNotNull(_0x584e80[0x0])){if(_0x584e80[0x0][_0x0e6d('0x97')]>0x0){_0x5a3be2[_0x0e6d('0x3a')]='RESCHEDULED_CONTACTS';logger[_0x0e6d('0x78')](_0x0e6d('0x98')+_0x5a3be2[_0x0e6d('0x38')],_0x584e80[0x0][_0x0e6d('0x97')],'contacts');}else{_0x5a3be2[_0x0e6d('0x3a')]=_0x0e6d('0x99');logger[_0x0e6d('0x78')](_0x0e6d('0x9a')+_0x5a3be2['name']);}}};}function notSendMessagesQueue(_0x3bb8d3){if(_0x3bb8d3[_0x0e6d('0x9b')]){freeVariablesPredictive(_0x3bb8d3);if(_0x3bb8d3[_0x0e6d('0x93')]===0x0&&_0x3bb8d3['talking']===0x0&&_0x3bb8d3['waiting']===0x0&&(_0x3bb8d3[_0x0e6d('0x9c')]||0x0)===0x0){_0x3bb8d3[_0x0e6d('0x9b')]=![];_0x3bb8d3[_0x0e6d('0x4b')]=0x0;_0x3bb8d3[_0x0e6d('0x3a')]=_0x0e6d('0x3b');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3bb8d3['name'],'is\x20not\x20active');}else{_0x3bb8d3[_0x0e6d('0x3a')]=_0x0e6d('0x9d');loggerSyncQueueSummary[_0x0e6d('0x90')](_0x0e6d('0x9e'),_0x3bb8d3[_0x0e6d('0x38')],_0x0e6d('0x9f'));}emitVoiceQueueSummary(_0x3bb8d3);}}function notSendMessagesCampaign(_0x3b599e){if(_0x3b599e[_0x0e6d('0x9b')]){if(_0x3b599e['originated']===0x0){_0x3b599e[_0x0e6d('0x9b')]=![];_0x3b599e[_0x0e6d('0x3a')]=_0x0e6d('0x3b');loggerSyncQueueSummary[_0x0e6d('0x90')](_0x0e6d('0xa0'),_0x3b599e['name'],_0x0e6d('0xa1'));}else{_0x3b599e[_0x0e6d('0x3a')]=_0x0e6d('0x9d');loggerSyncQueueSummary[_0x0e6d('0x90')](_0x0e6d('0xa0'),_0x3b599e[_0x0e6d('0x38')],_0x0e6d('0x9f'));}emitCampaignSummary(_0x3b599e);}}function createObjHistory(_0x588acd,_0x628158,_0x3609be,_0x3b9b59,_0x37744c){_0x588acd['message']=_0x3609be;var _0x528b7d=new Action(_0x588acd,_0x628158);var _0x1a28dd=new History(_0x528b7d);_0x1a28dd[_0x0e6d('0xa2')]=_0x3b9b59;_0x1a28dd[_0x0e6d('0xa3')]=_0x37744c;_0x1a28dd[_0x0e6d('0xa4')]=_0x528b7d['starttime'];return _0x1a28dd;}Dialer[_0x0e6d('0xa5')][_0x0e6d('0x35')]=function(){var _0x2a8c53=this;setInterval(function(){_0x2a8c53[_0x0e6d('0xa6')](_0x2a8c53[_0x0e6d('0x23')],_0x0e6d('0xa7'));_0x2a8c53[_0x0e6d('0xa6')](_0x2a8c53[_0x0e6d('0x21')],'[actions]');},0x32c8);};Dialer[_0x0e6d('0xa5')]['clearZombieChannels']=function(_0x3c9b12,_0x2daa10){var _0x1b2340=this;for(var _0xc6e3a1 in _0x3c9b12){if(typeof _0x3c9b12[_0xc6e3a1]!==_0x0e6d('0x94')){this[_0x0e6d('0x1a')][_0x0e6d('0x17')](function(){if(!_[_0x0e6d('0xa8')](_0x3c9b12[_0xc6e3a1])){return ami[_0x0e6d('0xa9')]({'action':_0x0e6d('0xaa'),'channel':_0x3c9b12[_0xc6e3a1][_0x0e6d('0xab')]})[_0x0e6d('0xac')](function(_0x38bd40){if(_0x38bd40[_0x0e6d('0x3a')]===_0x0e6d('0xad')){setTimeout(function(){if(_0x3c9b12[_0xc6e3a1]&&_0x3c9b12[_0xc6e3a1]['type']!==_0x0e6d('0x75')){_0x1b2340[_0x0e6d('0xae')](_0x1b2340[_0x0e6d('0x1b')][_0x3c9b12[_0xc6e3a1]['queue']]);logger[_0x0e6d('0x90')]('[Dialer][checkChannel]',_0x2daa10,_0xc6e3a1,_0x3c9b12[_0xc6e3a1][_0x0e6d('0xaf')]);delete _0x3c9b12[_0xc6e3a1];}if(_0x3c9b12[_0xc6e3a1]&&_0x3c9b12[_0xc6e3a1]['type']===_0x0e6d('0x75')){_0x1b2340[_0x0e6d('0xae')](_0x1b2340[_0x0e6d('0x1c')][_0x3c9b12[_0xc6e3a1][_0x0e6d('0xaf')]]);logger[_0x0e6d('0x90')](_0x0e6d('0xb0'),_0x2daa10,_0xc6e3a1,_0x3c9b12[_0xc6e3a1]['queue']);delete _0x3c9b12[_0xc6e3a1];}},0x2328);}});}});}}};Dialer[_0x0e6d('0xa5')]['countReScheduled']=function(_0x195659){return BPromise['resolve']()['then'](cmHopper[_0x0e6d('0xb1')](_0x195659))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xb2')]=function(_0x3e4fcc){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopperBlack[_0x0e6d('0xb2')](_0x3e4fcc))[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xb5')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x468b98){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopperBlack[_0x0e6d('0xb6')](_0x468b98))['catch'](loggerCatch(_0x0e6d('0xb7')));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xb8')]=function(_0x13df55){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopperHistory[_0x0e6d('0xb9')](_0x13df55))[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xba')));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xbb')]=function(_0x4b7c8f){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopper[_0x0e6d('0xbb')](_0x4b7c8f))[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xbc')));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xbd')]=function(_0x32f4df,_0x212d2e,_0x153c98){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopper[_0x0e6d('0xbd')](_0x32f4df,_0x212d2e,_0x153c98))[_0x0e6d('0xac')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0e6d('0xa5')]['getContactDialer']=function(_0x453ff5,_0x40a98c,_0x130198,_0x4097cb,_0x29ce0b){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopper[_0x0e6d('0xbe')](_0x453ff5,_0x40a98c,_0x130198,_0x4097cb))['catch'](function(_0x3d093f){_0x29ce0b[_0x0e6d('0xbf')]-=_0x130198;_0x29ce0b[_0x0e6d('0xbf')]=_0x29ce0b[_0x0e6d('0xbf')]>0x0?_0x29ce0b[_0x0e6d('0xbf')]:0x0;loggerCatch(_0x0e6d('0xc0'))(_0x3d093f);});};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xc1')]=function(_0x51e5cd,_0x5883d1,_0x173d41,_0x2639d0){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](cmHopper[_0x0e6d('0xc1')](_0x51e5cd,_0x5883d1,_0x173d41))[_0x0e6d('0xac')](function(_0x98030a){_0x2639d0[_0x0e6d('0xbf')]-=_0x5883d1;_0x2639d0['temp']=_0x2639d0[_0x0e6d('0xbf')]>0x0?_0x2639d0['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x98030a);});};Dialer['prototype'][_0x0e6d('0xc2')]=function(_0xfe22cc){return BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](voiceQueueRt['getVoiceQueueRtPauses'](_0xfe22cc))['catch'](loggerCatch(_0x0e6d('0xc3')));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xc4')]=function(_0xa19fb3){return BPromise['resolve']()[_0x0e6d('0xb4')](cmHopper[_0x0e6d('0xc4')](_0xa19fb3))[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xc5')));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xc6')]=function(_0x9c70cc){return BPromise['resolve']()[_0x0e6d('0xb4')](cmHopperHistory[_0x0e6d('0xc6')](_0x9c70cc))[_0x0e6d('0xac')](loggerCatch('[createHistory]\x20'));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xae')]=function(_0x20b262){if(!_['isUndefined'](_0x20b262)&&_0x20b262!==null){if(typeof _0x20b262[_0x0e6d('0x93')]!=='undefined'){if(_0x20b262['originated']>0x0){_0x20b262['originated']-=0x1;}else{logger['error'](_0x0e6d('0xc7'));}}}else{logger['error'](_0x0e6d('0xc8'));}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xc9')]=function(_0x3d4529,_0x548cd8){var _0x5f0c37=this;return function(_0x3942f4){_0x5f0c37[_0x0e6d('0xae')](_0x548cd8);logger[_0x0e6d('0x90')](_0x3d4529,util[_0x0e6d('0x8f')](_0x3942f4,{'showHidden':![],'depth':null}));};};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xca')]=function(_0x24a8c5,_0x38ccf7,_0x151fc5){var _0x2c8bd0={'state':0x19,'statedesc':_0x0e6d('0xcb')};this[_0x0e6d('0xae')](_0x38ccf7);this[_0x0e6d('0xcc')](_['merge'](_0x2c8bd0,_[_0x0e6d('0xcd')](_0x151fc5,[_0x0e6d('0xce'),_0x0e6d('0xcf'),_0x0e6d('0xd0'),_0x0e6d('0xd1'),'CampaignId'])),_0x0e6d('0xd2'),_0x0e6d('0xd3'));logger[_0x0e6d('0x90')](_0x24a8c5);};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xd4')]=function(_0x348230){return _0x348230===_0x0e6d('0xd5');};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xd6')]=function(_0x5d077b){return!_['isUndefined'](_0x5d077b)&&_0x5d077b&&!_[_0x0e6d('0x36')](_0x5d077b[_0x0e6d('0x38')])&&!_[_0x0e6d('0x36')](_0x5d077b[_0x0e6d('0x70')])&&_0x5d077b[_0x0e6d('0x70')]&&(this[_0x0e6d('0x1e')][util[_0x0e6d('0x72')](_0x0e6d('0xd7'),_0x5d077b[_0x0e6d('0x38')])][_0x0e6d('0xaa')]===_0x0e6d('0xd8')||this[_0x0e6d('0x1e')][util['format'](_0x0e6d('0xd7'),_0x5d077b[_0x0e6d('0x38')])][_0x0e6d('0xaa')]===_0x0e6d('0xd9'));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xcc')]=function(_0x4d4cfe,_0xff3d45,_0x544c15){this[_0x0e6d('0xc6')](_0x4d4cfe)[_0x0e6d('0xac')](loggerCatch(_0xff3d45));this['moveContactManagedDialer'](_0x4d4cfe)[_0x0e6d('0xac')](loggerCatch(_0x544c15));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x32')]=function(_0xa0c35d){var _0x2ee838=this[_0x0e6d('0x23')][_0xa0c35d['uniqueid']];var _0x53b198;if(!_[_0x0e6d('0xa8')](_0xa0c35d)&&!_[_0x0e6d('0xa8')](_0xa0c35d[_0x0e6d('0xda')])&&!_[_0x0e6d('0xa8')](_0xa0c35d[_0x0e6d('0xda')]['amdstatus'])&&_0xa0c35d[_0x0e6d('0xdb')]===_0x0e6d('0xdc')&&_0x2ee838){if(_0x2ee838[_0x0e6d('0x50')]!=='ivr'&&this[_0x0e6d('0x1b')][_0x2ee838[_0x0e6d('0xaf')]]['dialAMDActive']&&_0xa0c35d[_0x0e6d('0xdd')]===_0x0e6d('0xde')){delete this[_0x0e6d('0x23')][_0xa0c35d[_0x0e6d('0xdf')]];this[_0x0e6d('0xae')](this[_0x0e6d('0x1b')][_0x2ee838[_0x0e6d('0xaf')]]);this[_0x0e6d('0x1b')][_0x2ee838[_0x0e6d('0xaf')]][_0x0e6d('0x59')]+=0x1;this[_0x0e6d('0x1b')][_0x2ee838[_0x0e6d('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x53b198=new Hangup(_0x2ee838,_0xa0c35d);_0x53b198['state']=0x12;_0x53b198['statedesc']=_0x0e6d('0xe0');_0x53b198[_0x0e6d('0xe1')]=_0x0e6d('0xe2');ami['emit'](_0x0e6d('0xe3'),ut[_0x0e6d('0xe4')](_0x53b198,_0x0e6d('0xe5')));this['saveInDb'](_0x53b198,_0x0e6d('0xe6'),_0x0e6d('0xe7'));}if(_0x2ee838['type']!=='ivr'&&this['voiceQueues'][_0x2ee838[_0x0e6d('0xaf')]][_0x0e6d('0xe8')]&&_0xa0c35d[_0x0e6d('0xdd')]===_0x0e6d('0xe9')){var _0x45942b=this;return new BPromise(function(_0x44385b,_0x463b0e){delete _0x45942b['uniqueId'][_0xa0c35d[_0x0e6d('0xdf')]];_0x45942b[_0x0e6d('0xae')](_0x45942b[_0x0e6d('0x1b')][_0x2ee838['queue']]);_0x45942b[_0x0e6d('0x1b')][_0x2ee838['queue']][_0x0e6d('0x59')]+=0x1;_0x45942b['voiceQueues'][_0x2ee838[_0x0e6d('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x46c8ec=_0x45942b[_0x0e6d('0x1b')][_0x2ee838[_0x0e6d('0xaf')]];var _0x4d8061=new Hangup(_0x2ee838,_0xa0c35d);_0x4d8061[_0x0e6d('0xa2')]=0x13;_0x4d8061[_0x0e6d('0xa3')]=_0x0e6d('0xea');_0x4d8061[_0x0e6d('0xe1')]='AMD';_0x4d8061[_0x0e6d('0xeb')]+=0x1;_0x4d8061[_0x0e6d('0xec')]+=0x1;_0x4d8061['amd']=!![];ami[_0x0e6d('0x48')](_0x0e6d('0xe3'),ut[_0x0e6d('0xe4')](_0x4d8061,_0x0e6d('0xe5')));_0x45942b[_0x0e6d('0xc6')](_0x4d8061)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xed')));if(_0x4d8061[_0x0e6d('0xee')]+_0x4d8061['countcongestionretry']+_0x4d8061['countnoanswerretry']+_0x4d8061[_0x0e6d('0xef')]+_0x4d8061['countdropretry']+_0x4d8061['countabandonedretry']+_0x4d8061[_0x0e6d('0xeb')]+_0x4d8061[_0x0e6d('0xf0')]>=_0x46c8ec[_0x0e6d('0xf1')]){_0x45942b[_0x0e6d('0xf2')](_0x4d8061,_0x44385b,_0x463b0e,_0x0e6d('0xf3'));}else{if(_0x4d8061['countmachineretry']>=_0x46c8ec[_0x0e6d('0xf4')]){_0x45942b[_0x0e6d('0xf5')](_0x4d8061,_0x44385b,_0x463b0e,_0x0e6d('0xf6'));}else{_0x45942b[_0x0e6d('0xbb')]({'active':![],'countmachineretry':_0x4d8061[_0x0e6d('0xeb')],'scheduledat':moment()[_0x0e6d('0xf7')](_0x46c8ec[_0x0e6d('0xf8')],_0x0e6d('0xf9'))[_0x0e6d('0x72')](_0x0e6d('0xfa')),'ContactId':_0x4d8061[_0x0e6d('0xce')],'ListId':_0x4d8061[_0x0e6d('0xcf')],'VoiceQueueId':_0x4d8061['VoiceQueueId']||undefined,'CampaignId':_0x4d8061[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xfc')));_0x44385b({'reschedule':0x1});}}});}if(_0x2ee838[_0x0e6d('0x50')]===_0x0e6d('0x75')&&this[_0x0e6d('0x1c')][_0x2ee838[_0x0e6d('0xaf')]][_0x0e6d('0xe8')]&&_0xa0c35d['value']==='HANGUP'){delete this['uniqueId'][_0xa0c35d[_0x0e6d('0xdf')]];this[_0x0e6d('0xae')](this[_0x0e6d('0x1c')][_0x2ee838[_0x0e6d('0xaf')]]);_0x53b198=new Hangup(_0x2ee838,_0xa0c35d);_0x53b198[_0x0e6d('0xa2')]=0x12;_0x53b198[_0x0e6d('0xa3')]=_0x0e6d('0xe0');_0x53b198[_0x0e6d('0xe1')]=_0x0e6d('0xe2');ami['emit'](_0x0e6d('0xe3'),ut[_0x0e6d('0xe4')](_0x53b198,_0x0e6d('0xe5')));this['saveInDb'](_0x53b198,'[syncHangupInAMDIvr][createHistory]',_0x0e6d('0xfd'));}if(_0x2ee838[_0x0e6d('0x50')]===_0x0e6d('0x75')&&this['campaigns'][_0x2ee838[_0x0e6d('0xaf')]][_0x0e6d('0xe8')]&&_0xa0c35d[_0x0e6d('0xdd')]===_0x0e6d('0xe9')){var _0x45942b=this;return new BPromise(function(_0xb6814c,_0xacd3e0){delete _0x45942b['uniqueId'][_0xa0c35d['uniqueid']];_0x45942b[_0x0e6d('0xae')](_0x45942b[_0x0e6d('0x1c')][_0x2ee838[_0x0e6d('0xaf')]]);_0x45942b['campaigns'][_0x2ee838['queue']][_0x0e6d('0x59')]+=0x1;_0x45942b['campaigns'][_0x2ee838[_0x0e6d('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1bb65f=_0x45942b[_0x0e6d('0x1c')][_0x2ee838[_0x0e6d('0xaf')]];var _0x308960=new Hangup(_0x2ee838,_0xa0c35d);_0x308960[_0x0e6d('0xa2')]=0x13;_0x308960[_0x0e6d('0xa3')]=_0x0e6d('0xea');_0x308960[_0x0e6d('0xe1')]=_0x0e6d('0xe2');_0x308960[_0x0e6d('0xeb')]+=0x1;_0x308960[_0x0e6d('0xec')]+=0x1;_0x308960[_0x0e6d('0xe5')]=!![];ami[_0x0e6d('0x48')](_0x0e6d('0xe3'),ut[_0x0e6d('0xe4')](_0x308960,_0x0e6d('0xe5')));_0x45942b[_0x0e6d('0xc6')](_0x308960)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xed')));if(_0x308960['countbusyretry']+_0x308960[_0x0e6d('0xfe')]+_0x308960[_0x0e6d('0xff')]+_0x308960[_0x0e6d('0xef')]+_0x308960[_0x0e6d('0x100')]+_0x308960[_0x0e6d('0x101')]+_0x308960['countmachineretry']+_0x308960[_0x0e6d('0xf0')]>=_0x1bb65f['dialGlobalMaxRetry']){_0x45942b[_0x0e6d('0xf2')](_0x308960,_0xb6814c,_0xacd3e0,_0x0e6d('0xf3'));}else{if(_0x308960[_0x0e6d('0xeb')]>=_0x1bb65f['dialMachineMaxRetry']){_0x45942b['createStateFinal'](_0x308960,_0xb6814c,_0xacd3e0,_0x0e6d('0xf6'));}else{_0x45942b[_0x0e6d('0xbb')]({'active':![],'countmachineretry':_0x308960[_0x0e6d('0xeb')],'scheduledat':moment()[_0x0e6d('0xf7')](_0x1bb65f[_0x0e6d('0xf8')],'minutes')[_0x0e6d('0x72')](_0x0e6d('0xfa')),'ContactId':_0x308960[_0x0e6d('0xce')],'ListId':_0x308960[_0x0e6d('0xcf')],'VoiceQueueId':_0x308960[_0x0e6d('0xd1')]||undefined,'CampaignId':_0x308960[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0xb6814c({'reschedule':0x1});}}});}}};Dialer[_0x0e6d('0xa5')]['syncHangup']=function(_0x279916){var _0x41d8db=this[_0x0e6d('0x23')][_0x279916[_0x0e6d('0xdf')]];var _0x9de47b=this;var _0x4b8e35;if(_0x41d8db&&_0x41d8db[_0x0e6d('0x50')]===_0x0e6d('0x75')){delete this[_0x0e6d('0x23')][_0x279916[_0x0e6d('0xdf')]];this[_0x0e6d('0xae')](this[_0x0e6d('0x1c')][_0x41d8db['queue']]);this[_0x0e6d('0x1c')][_0x41d8db[_0x0e6d('0xaf')]][_0x0e6d('0x102')]+=0x1;_0x4b8e35=new Hangup(_0x41d8db,_0x279916);this[_0x0e6d('0xc6')](_0x4b8e35)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x103')));this[_0x0e6d('0xc4')](_0x4b8e35)[_0x0e6d('0xac')](loggerCatch('[syncHangupIvr]'));}if(_0x41d8db&&_0x41d8db[_0x0e6d('0x50')]!=='ivr'&&isNotNull(this[_0x0e6d('0x1b')][_0x41d8db[_0x0e6d('0xaf')]]['dialQueueProject'])){delete this[_0x0e6d('0x23')][_0x279916[_0x0e6d('0xdf')]];this[_0x0e6d('0xae')](this[_0x0e6d('0x1b')][_0x41d8db[_0x0e6d('0xaf')]]);this[_0x0e6d('0x1b')][_0x41d8db['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0e6d('0x1b')][_0x41d8db['queue']][_0x0e6d('0x58')]+=0x1;_0x4b8e35=new Hangup(_0x41d8db,_0x279916);_0x4b8e35['state']=0x10;_0x4b8e35[_0x0e6d('0xa3')]=_0x0e6d('0x104');_0x4b8e35[_0x0e6d('0xe1')]='AGI';this['createHistory'](_0x4b8e35)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x103')));this['moveContactManagedDialer'](_0x4b8e35)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x105')));}if(_0x41d8db&&_0x41d8db[_0x0e6d('0x50')]!==_0x0e6d('0x75')&&!isNotNull(this[_0x0e6d('0x1b')][_0x41d8db[_0x0e6d('0xaf')]]['dialQueueProject'])){delete this['uniqueId'][_0x279916[_0x0e6d('0xdf')]];this[_0x0e6d('0xae')](this[_0x0e6d('0x1b')][_0x41d8db[_0x0e6d('0xaf')]]);this['voiceQueues'][_0x41d8db[_0x0e6d('0xaf')]]['outboundUnknownCallsDay']+=0x1;_0x4b8e35=new Hangup(_0x41d8db,_0x279916);_0x4b8e35[_0x0e6d('0xa2')]=0xc;_0x4b8e35['statedesc']=_0x279916[_0x0e6d('0x106')];_0x4b8e35['membername']='Unknow';this[_0x0e6d('0xc6')](_0x4b8e35)[_0x0e6d('0xac')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0e6d('0xc4')](_0x4b8e35)[_0x0e6d('0xac')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x107')]=function(_0x1ec94a){var _0x2ca559=this[_0x0e6d('0x23')][_0x1ec94a[_0x0e6d('0xdf')]];var _0x14a310=this;if(this['voiceQueues'][_0x1ec94a[_0x0e6d('0xaf')]]){if(_0x2ca559&&_0x2ca559['type']!==_0x0e6d('0x75')){delete this[_0x0e6d('0x23')][_0x1ec94a[_0x0e6d('0xdf')]];this['voiceQueues'][_0x1ec94a[_0x0e6d('0xaf')]][_0x0e6d('0x59')]+=0x1;var _0x2db4c2=new AgentComplete(_0x2ca559,_0x1ec94a);if(_0x1ec94a[_0x0e6d('0x108')]===_0x0e6d('0x109')){_0x2db4c2[_0x0e6d('0x10a')]=this[_0x0e6d('0x1b')][_0x1ec94a[_0x0e6d('0xaf')]][_0x0e6d('0x10b')]&&this[_0x0e6d('0x1b')][_0x1ec94a[_0x0e6d('0xaf')]][_0x0e6d('0x10c')]?moment()['format'](_0x0e6d('0xfa')):undefined;}this[_0x0e6d('0xc6')](_0x2db4c2)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x10d')));this[_0x0e6d('0xc4')](_0x2db4c2)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x10e')));}}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x10f')]=function(_0x16f74f){if(this[_0x0e6d('0x1b')][_0x16f74f[_0x0e6d('0xaf')]]){if(this[_0x0e6d('0x23')][_0x16f74f[_0x0e6d('0xdf')]]&&this['uniqueId'][_0x16f74f['uniqueid']][_0x0e6d('0x50')]!==_0x0e6d('0x75')){this['updateOriginated'](this[_0x0e6d('0x1b')][_0x16f74f[_0x0e6d('0xaf')]]);this[_0x0e6d('0x23')][_0x16f74f[_0x0e6d('0xdf')]][_0x0e6d('0x110')]=moment()['format'](_0x0e6d('0xfa'));}}};Dialer['prototype'][_0x0e6d('0x111')]=function(_0x592edb){this[_0x0e6d('0xc6')](_0x592edb)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x10d')));this[_0x0e6d('0xc4')](_0x592edb)['catch'](loggerCatch(_0x0e6d('0x112')));};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x29')]=function(_0x660835){var _0x2ea223=this['uniqueId'][_0x660835['uniqueid']];var _0xa46aef=this;if(this[_0x0e6d('0x1b')][_0x660835['queue']]){if(_0x2ea223&&_0x2ea223[_0x0e6d('0x50')]!==_0x0e6d('0x75')){delete this[_0x0e6d('0x23')][_0x660835[_0x0e6d('0xdf')]];this[_0x0e6d('0xae')](this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]]);_0x2ea223['droptime']=moment()[_0x0e6d('0x72')](_0x0e6d('0xfa'));var _0x1bda0f=new QueueCallerAbandon(_0x2ea223,_0x660835);if(getSeconds(_0x2ea223[_0x0e6d('0x113')],_0x2ea223[_0x0e6d('0x114')])>=_0x2ea223['dialQueueTimeout']){this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x660835[_0x0e6d('0xaf')]][_0x0e6d('0x115')]+=0x1;this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1bda0f[_0x0e6d('0xa2')]=0xa;_0x1bda0f[_0x0e6d('0xa3')]='Drop';_0x1bda0f['dropreason']=_0x0e6d('0x116');_0x1bda0f[_0x0e6d('0x10a')]=this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]][_0x0e6d('0x10b')]?moment()[_0x0e6d('0x72')](_0x0e6d('0xfa')):undefined;_0x1bda0f[_0x0e6d('0x100')]+=0x1;_0x1bda0f[_0x0e6d('0xec')]+=0x1;if(_0x1bda0f['countdropretry']>=this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]][_0x0e6d('0x117')]){this[_0x0e6d('0x111')](_0x1bda0f);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1bda0f[_0x0e6d('0x100')],'scheduledat':moment()['add'](this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]]['dialDropRetryFrequency'],_0x0e6d('0xf9'))[_0x0e6d('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ea223[_0x0e6d('0xce')],'ListId':_0x2ea223['ListId'],'VoiceQueueId':_0x2ea223[_0x0e6d('0xd1')]||undefined,'CampaignId':_0x2ea223[_0x0e6d('0xfb')]||undefined})['catch'](loggerCatch(_0x0e6d('0x118')));var _0x2da29d=new History(_0x1bda0f);_0x2da29d[_0x0e6d('0xa2')]=0xa;_0x2da29d['statedesc']='Drop';_0x2da29d['starttime']=moment()['format'](_0x0e6d('0xfa'));_0x2da29d[_0x0e6d('0xa4')]=_0x2da29d[_0x0e6d('0x119')];_0x2da29d[_0x0e6d('0x11a')]=_0x1bda0f['calleridname'];_0x2da29d[_0x0e6d('0x11b')]=_0x1bda0f['calleridnum'];this['createHistory'](_0x2da29d)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x11c')));}}else{this['voiceQueues'][_0x660835['queue']][_0x0e6d('0x65')]+=0x1;this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]][_0x0e6d('0x5d')]+=0x1;_0x1bda0f[_0x0e6d('0xa2')]=0xb;_0x1bda0f[_0x0e6d('0xa3')]=_0x0e6d('0x11d');_0x1bda0f[_0x0e6d('0x11e')]='CALLEREXIT';_0x1bda0f[_0x0e6d('0x101')]+=0x1;_0x1bda0f[_0x0e6d('0xec')]+=0x1;if(_0x1bda0f[_0x0e6d('0x101')]>=this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]][_0x0e6d('0x11f')]){this[_0x0e6d('0x111')](_0x1bda0f);}else{this[_0x0e6d('0xbb')]({'active':![],'countabandonedretry':_0x1bda0f[_0x0e6d('0x101')],'scheduledat':moment()[_0x0e6d('0xf7')](this[_0x0e6d('0x1b')][_0x660835[_0x0e6d('0xaf')]]['dialAbandonedRetryFrequency'],_0x0e6d('0xf9'))[_0x0e6d('0x72')](_0x0e6d('0xfa')),'ContactId':_0x2ea223[_0x0e6d('0xce')],'ListId':_0x2ea223['ListId'],'VoiceQueueId':_0x2ea223[_0x0e6d('0xd1')]||undefined,'CampaignId':_0x2ea223[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2da29d=new History(_0x1bda0f);_0x2da29d[_0x0e6d('0xa2')]=0xb;_0x2da29d[_0x0e6d('0xa3')]=_0x0e6d('0x11d');_0x2da29d[_0x0e6d('0x119')]=moment()[_0x0e6d('0x72')](_0x0e6d('0xfa'));_0x2da29d[_0x0e6d('0xa4')]=_0x2da29d[_0x0e6d('0x119')];_0x2da29d[_0x0e6d('0x11a')]=_0x1bda0f[_0x0e6d('0x11a')];_0x2da29d[_0x0e6d('0x11b')]=_0x1bda0f['calleridnum'];this[_0x0e6d('0xc6')](_0x2da29d)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x120')));}}}}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x30')]=function(_0x52493c){if(this[_0x0e6d('0x21')][_0x52493c[_0x0e6d('0xdf')]]){this[_0x0e6d('0x21')][_0x52493c[_0x0e6d('0xdf')]]['channel']=_0x52493c[_0x0e6d('0xab')];}if(this[_0x0e6d('0x23')][_0x52493c[_0x0e6d('0xdf')]]){this[_0x0e6d('0x23')][_0x52493c[_0x0e6d('0xdf')]][_0x0e6d('0xab')]=_0x52493c[_0x0e6d('0xab')];}};Dialer[_0x0e6d('0xa5')]['syncQueueMember']=function(_0x75defd){if(strategy[this['voiceQueues'][this['actions'][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0xaf')]][_0x0e6d('0x122')]]===_0x0e6d('0x123')){if(this[_0x0e6d('0x21')][_0x75defd['actionid']]&&_[_0x0e6d('0xa8')](this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0x124')])&&_0x75defd['status']==='1'&&_0x75defd[_0x0e6d('0x125')]==='0'){if(this[_0x0e6d('0x1d')][_0x75defd[_0x0e6d('0x126')]]){if(!this[_0x0e6d('0x1d')][_0x75defd[_0x0e6d('0x126')]][_0x0e6d('0x124')]){this[_0x0e6d('0x1d')][_0x75defd[_0x0e6d('0x126')]]['locked']=!![];this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]]['locked']=!![];this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0x126')]=_0x75defd['stateinterface'];}}}}else if((strategy[this[_0x0e6d('0x1b')][this['actions'][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0xaf')]][_0x0e6d('0x122')]]||_0x0e6d('0x16'))===_0x0e6d('0x16')){if(this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]]){if(this[_0x0e6d('0x1d')][_0x75defd['stateinterface']]){this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0x126')]=_0x75defd[_0x0e6d('0x126')];if(_[_0x0e6d('0xa8')](this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x75defd['actionid']]['queue']])){this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0xaf')]]=[];}this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]][_0x0e6d('0xaf')]][_0x0e6d('0x127')](_[_0x0e6d('0x86')](_['pick'](this[_0x0e6d('0x21')][_0x75defd[_0x0e6d('0x121')]],['idHopper',_0x0e6d('0x126')]),{'status':_0x75defd[_0x0e6d('0xaa')],'paused':_0x75defd['paused']}));}}}};function unlockQueueStatus(_0x4bedb4,_0x46e661){setTimeout(function(){if(_[_0x0e6d('0x36')](_0x4bedb4[_0x0e6d('0x128')])){loggerBooked[_0x0e6d('0x90')](_0x0e6d('0x129'),_0x46e661);}_0x4bedb4[_0x0e6d('0x128')]=!![];loggerBooked[_0x0e6d('0x78')](_0x0e6d('0x12a'),_0x46e661,JSON[_0x0e6d('0x44')](_[_0x0e6d('0xcd')](_0x4bedb4,[_0x0e6d('0x38'),_0x0e6d('0x128')])));},0x1f3);}Dialer[_0x0e6d('0xa5')][_0x0e6d('0x34')]=function(_0x2ddfaf){var _0x2afbcf=this;var _0x502891=_0x2afbcf[_0x0e6d('0x1b')][_0x2afbcf['actions'][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]];if(strategy[this['voiceQueues'][this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]]['queue']]['strategy']]===_0x0e6d('0x123')){if(this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]]&&this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0x126')]){this['preview'][_0x0e6d('0x12b')](this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0x12c')],this['actions'][_0x2ddfaf['actionid']][_0x0e6d('0x126')])[_0x0e6d('0xac')](function(_0x2a435e){logger['error'](_0x0e6d('0x12d'),util[_0x0e6d('0x8f')](_0x2a435e,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2afbcf[_0x0e6d('0xae')](_0x2afbcf['voiceQueues'][_0x2afbcf[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]]['queue']]);_0x2afbcf[_0x0e6d('0x1d')][_0x2afbcf[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0x126')]][_0x0e6d('0x124')]=![];delete _0x2afbcf[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]];unlockQueueStatus(_0x502891);});}else{this[_0x0e6d('0xae')](this[_0x0e6d('0x1b')][this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]]['queue']]);this[_0x0e6d('0xbb')]({'active':![],'ContactId':this[_0x0e6d('0x21')][_0x2ddfaf['actionid']]['ContactId'],'ListId':this[_0x0e6d('0x21')][_0x2ddfaf['actionid']][_0x0e6d('0xcf')],'VoiceQueueId':this[_0x0e6d('0x21')][_0x2ddfaf['actionid']][_0x0e6d('0xd1')]||undefined,'CampaignId':this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x12e')));delete this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]];unlockQueueStatus(_0x502891);}}else if((strategy[this[_0x0e6d('0x1b')][this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]][_0x0e6d('0x122')]]||_0x0e6d('0x16'))===_0x0e6d('0x16')){var _0xa3907f;if(this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]]&&!_['isEmpty'](this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x2ddfaf['actionid']][_0x0e6d('0xaf')]])){if(this[_0x0e6d('0x12f')][_0x2afbcf[_0x0e6d('0x21')][_0x2ddfaf['actionid']][_0x0e6d('0xaf')]]){this[_0x0e6d('0x12f')][_0x2afbcf['actions'][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]]=this['queueBookedRR'][this['actions'][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]]?this['queueBookedRR'][this['actions'][_0x2ddfaf[_0x0e6d('0x121')]]['queue']]:this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]]?this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x2ddfaf['actionid']]['queue']][_0x0e6d('0x130')]||0x0:0x0;}this[_0x0e6d('0x27')][this[_0x0e6d('0x21')][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]][_0x0e6d('0x130')]=this[_0x0e6d('0x12f')][this['actions'][_0x2ddfaf[_0x0e6d('0x121')]][_0x0e6d('0xaf')]];for(var _0x50f177=0x0;_0x50f177=0x0;})[_0x0e6d('0xac')](myreject(_0x33484f)));}}else{_0x463e81[_0x0e6d('0x127')](ami[_0x0e6d('0xa9')]({'action':'command','command':util[_0x0e6d('0x72')](_0x0e6d('0x149'),_0x20bfeb,!_[_0x0e6d('0x36')](config[_0x0e6d('0x145')][_0x5c53eb])?_0x5c53eb:'')})[_0x0e6d('0xb4')](function(_0x33d223){return _0x33d223['content'][_0x0e6d('0x14c')](_0x0e6d('0x14d'))>=0x0;})[_0x0e6d('0xac')](myreject(_0x33484f)));}BPromise[_0x0e6d('0x14e')](_0x463e81)['then'](function(_0x5b9c30){var _0x1c87d9=_[_0x0e6d('0x14f')](_0x5b9c30);if(_0x1c87d9){return _0x52d864(_0x1c87d9);}else{_0x5d2777[_0x0e6d('0x3a')]=_0x111b17?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0e6d('0x150');return _0x33484f(msgResponse(_0x0e6d('0x151'),_0x0e6d('0x146'),_0x0e6d('0x152')+_0x111b17+'\x20'+_0x4a8f4a+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0e6d('0x8f')](_0x20bfeb,{'showHidden':![],'depth':null})+_0x0e6d('0x153')+_0x5c53eb));}})[_0x0e6d('0xac')](function(_0x592089){return _0x33484f(msgResponse(_0x0e6d('0x141'),_0x0e6d('0x146'),JSON[_0x0e6d('0x44')](_0x592089)));});});};Dialer['prototype'][_0x0e6d('0x154')]=function(_0x57ae6c){var _0x24ca48=this;return function(){switch(_0x57ae6c[_0x0e6d('0x53')]){case _0x0e6d('0x155'):freeVariablesPredictive(_0x57ae6c);_0x24ca48[_0x0e6d('0x156')](_0x57ae6c,0x1);break;case _0x0e6d('0x157'):freeVariablesPredictive(_0x57ae6c);_0x24ca48[_0x0e6d('0x156')](_0x57ae6c,_0x57ae6c[_0x0e6d('0x158')]);break;case _0x0e6d('0x5'):_0x24ca48[_0x0e6d('0x5')](_0x57ae6c);break;case _0x0e6d('0x159'):freeVariablesPredictive(_0x57ae6c);_0x24ca48[_0x0e6d('0x156')](_0x57ae6c,0x1);break;default:freeVariablesPredictive(_0x57ae6c);logger[_0x0e6d('0x90')](_0x0e6d('0x15a'),_0x57ae6c['name'],_0x0e6d('0x15b'));}};};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x15c')]=function(_0x5d69a9){var _0x1a093e=this;return function(){_0x1a093e['handleIvr'](_0x5d69a9);};};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x2e')]=function(_0x20279b){var _0x3f7b4f=this;if(isNotPreview(_0x20279b[_0x0e6d('0x53')])){if(isVoiceQueueOutbound(_0x20279b[_0x0e6d('0x50')])&&isActive(_0x20279b[_0x0e6d('0x15d')])){_0x20279b[_0x0e6d('0x9b')]=!![];BPromise[_0x0e6d('0xb3')]()[_0x0e6d('0xb4')](checkIsLoggedIn(_0x20279b,_0x20279b[_0x0e6d('0x15e')]))[_0x0e6d('0xb4')](checkIsActive(_0x20279b,_0x20279b[_0x0e6d('0x15d')]))[_0x0e6d('0xb4')](checkInterval(_0x20279b))[_0x0e6d('0xb4')](_0x3f7b4f['checkIsTrunkReachable'](_0x20279b))['then'](_0x3f7b4f[_0x0e6d('0x140')](_0x20279b['dialGlobalInterval'],_0x20279b[_0x0e6d('0x15f')],_0x20279b['name'],_0x20279b))['then'](_0x3f7b4f[_0x0e6d('0x160')](_0x20279b[_0x0e6d('0x3f')],_0x20279b['dialTimezone'],_0x20279b[_0x0e6d('0x38')],_0x20279b))[_0x0e6d('0xb4')](_0x3f7b4f[_0x0e6d('0x154')](_0x20279b))[_0x0e6d('0xac')](loggerCatchQueueSummary(_0x0e6d('0x161'),_0x20279b));}else{notSendMessagesQueue(_0x20279b);}}else{freeVariablesPredictive(_0x20279b);}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x13b')]=function(){var _0x1fae7e=this;var _0x1d2d29;for(var _0x185440 in this[_0x0e6d('0x1c')]){if(typeof this[_0x0e6d('0x1c')][_0x185440]!==_0x0e6d('0x94')){_0x1d2d29=this[_0x0e6d('0x1c')][_0x185440];if(isCampaignIvr(_0x1d2d29[_0x0e6d('0x50')])&&isActive(_0x1d2d29[_0x0e6d('0x70')])){_0x1d2d29['sendMessageOneNotActive']=!![];BPromise[_0x0e6d('0xb3')]()['then'](checkIsActive(_0x1d2d29,_0x1d2d29[_0x0e6d('0x70')]))['then'](checkInterval(_0x1d2d29))[_0x0e6d('0xb4')](_0x1fae7e[_0x0e6d('0x13c')](_0x1d2d29))[_0x0e6d('0xb4')](_0x1fae7e[_0x0e6d('0x140')](_0x1d2d29[_0x0e6d('0x162')],_0x1d2d29['dialTimezone'],_0x1d2d29[_0x0e6d('0x38')],_0x1d2d29))[_0x0e6d('0xb4')](_0x1fae7e[_0x0e6d('0x160')](_0x1d2d29['Interval'],_0x1d2d29[_0x0e6d('0x15f')],_0x1d2d29[_0x0e6d('0x38')],_0x1d2d29))[_0x0e6d('0xb4')](_0x1fae7e[_0x0e6d('0x15c')](_0x1d2d29))[_0x0e6d('0xac')](loggerCatchQueueSummary('[syncCampaigns]',_0x1d2d29));}else{notSendMessagesCampaign(_0x1d2d29);}}}};function getCallerIdRandom(_0x156418,_0x5948a){var _0x2fb527;var _0x35ad5e;var _0x47d165;if(_0x5948a<=0x0){_0x5948a=0x1;}_0x2fb527=new RegExp('\x5cw{0,'+_0x5948a+'}$');_0x35ad5e=Math[_0x0e6d('0x163')](0xa,_0x5948a-0x1);_0x47d165=Math[_0x0e6d('0x163')](0xa,_0x5948a)-0x1;return util['format']('%s',_[_0x0e6d('0x164')](_0x156418,_0x2fb527,_[_0x0e6d('0x165')](_0x35ad5e,_0x47d165)));}function extractCalleridName(_0x54ed8c){var _0x2a2aa5=_0x54ed8c[_0x0e6d('0x166')](/"(.*?)"/);return _0x2a2aa5?_0x2a2aa5[0x1]:_0x54ed8c;}function extractCalleridNumber(_0x5825d7){var _0x13133e=_0x5825d7[_0x0e6d('0x166')](/<(.*?)>/);return _0x13133e?_0x13133e[0x1]:_0x5825d7;}Dialer['prototype'][_0x0e6d('0x167')]=function(_0x247177,_0xceefba){var _0x390103=this;var _0x5cf92f=uuid['v4']();this[_0x0e6d('0x21')][_0x5cf92f]=new Action(_0x247177,_0xceefba,_0x5cf92f);return new BPromise(function(_0x2cac5a,_0x18abf4){if(_[_0x0e6d('0x36')](_0x247177)&&typeof _0x247177!=='object'){return _0x18abf4(msgResponse(_0x0e6d('0x168'),'Failure',_0x0e6d('0x169')));}if(_['isUndefined'](_0xceefba[_0x0e6d('0x16a')][_0x0e6d('0x16b')])||_0xceefba[_0x0e6d('0x16a')][_0x0e6d('0x16b')]===null){return _0x18abf4(msgResponse(_0x0e6d('0x168'),'Failure',_0x0e6d('0x16c')));}var _0x3cc65c={'XMD-CALLERID':_0x390103[_0x0e6d('0x21')][_0x5cf92f]['getCaller'](),'XMD-AGI':_0x247177[_0x0e6d('0x16d')]?util[_0x0e6d('0x72')]('\x22agi://%s/square,%s\x22',ipAgi,_0x247177['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x247177[_0x0e6d('0x10b')]?util['format'](_0x0e6d('0x16e'),ipAgi,_0x247177[_0x0e6d('0x10b')]):_0x0e6d('0x16f'),'XMD-QUEUE':_0x247177[_0x0e6d('0x50')]===_0x0e6d('0x49')?util[_0x0e6d('0x72')](_0x0e6d('0x170'),_0x247177['name'],_0x247177[_0x0e6d('0x171')]||'',_0x247177[_0x0e6d('0x10c')]?'c':'',_0x247177[_0x0e6d('0x172')]||0x3):_0x0e6d('0x16f'),'XMD-CONTACTID':_0xceefba[_0x0e6d('0xce')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x390103[_0x0e6d('0x21')][_0x5cf92f][_0x0e6d('0x173')](),'XMD-AMD':_0x247177[_0x0e6d('0xe8')]?_0x0e6d('0x174'):_0x0e6d('0x16f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x247177[_0x0e6d('0xe8')]){_0x3cc65c[_0x0e6d('0x175')]=_0x247177[_0x0e6d('0x176')]||0x9c4;_0x3cc65c[_0x0e6d('0x177')]=_0x247177[_0x0e6d('0x178')]||0x5dc;_0x3cc65c['XMD-AMDAFTERGREETINGSILENCE']=_0x247177[_0x0e6d('0x179')]||0x320;_0x3cc65c[_0x0e6d('0x17a')]=_0x247177[_0x0e6d('0x17b')]||0x1388;_0x3cc65c[_0x0e6d('0x17c')]=_0x247177[_0x0e6d('0x17d')]||0x64;_0x3cc65c[_0x0e6d('0x17e')]=_0x247177[_0x0e6d('0x17f')]||0x32;_0x3cc65c['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x247177[_0x0e6d('0x180')]||0x3;_0x3cc65c[_0x0e6d('0x181')]=_0x247177[_0x0e6d('0x182')]||0x100;_0x3cc65c[_0x0e6d('0x183')]=_0x247177['dialAMDMaximumWordLength']||0x1388;}if(_0x247177[_0x0e6d('0x50')]===_0x0e6d('0x49')){_0x3cc65c['XMD-VOICEQUEUEID']=_0xceefba['VoiceQueueId'];}else{_0x3cc65c[_0x0e6d('0x184')]=_0xceefba[_0x0e6d('0xfb')];}for(var _0x166425 in _0xceefba[_0x0e6d('0x16a')]){if(typeof _0xceefba[_0x0e6d('0x16a')][_0x166425]!==_0x0e6d('0x94')){if(isNotNull(_0xceefba[_0x0e6d('0x16a')][_0x166425])&&_0x166425!=='id'&&_0x166425!==_0x0e6d('0x185')&&_0x166425!==_0x0e6d('0x186')&&_0x166425!=='updatedAt'){_0x3cc65c[util[_0x0e6d('0x72')](_0x0e6d('0x187'),'XMD-',_[_0x0e6d('0x188')](_0x166425))]=_0xceefba['Contact'][_0x166425];}}}var _0x39758b=_0x390103[_0x0e6d('0xd6')](_0x247177[_0x0e6d('0x6f')])?getCallerId(_0x247177[_0x0e6d('0x6f')]['callerid'],_0x247177['dialOriginateCallerIdName'],_0x247177[_0x0e6d('0x189')]>0x0?getCallerIdRandom(_0x247177[_0x0e6d('0x55')],_0x247177[_0x0e6d('0x189')]):_0x247177[_0x0e6d('0x55')]):getCallerId(_['isNil'](_0x247177['TrunkBackup'])?_0x247177['Trunk']['callerid']:_0x247177['TrunkBackup'][_0x0e6d('0x18a')],_0x247177['dialOriginateCallerIdName'],_0x247177[_0x0e6d('0x189')]>0x0?getCallerIdRandom(_0x247177['dialOriginateCallerIdNumber'],_0x247177[_0x0e6d('0x189')]):_0x247177[_0x0e6d('0x55')]);if(_0x39758b){_0x3cc65c[_0x0e6d('0x18b')]=_0x390103[_0x0e6d('0x21')][_0x5cf92f][_0x0e6d('0x18c')]=extractCalleridName(_0x39758b);_0x3cc65c[_0x0e6d('0x18d')]=_0x390103[_0x0e6d('0x21')][_0x5cf92f][_0x0e6d('0x18e')]=extractCalleridNumber(_0x39758b);}return ami[_0x0e6d('0xa9')]({'actionid':_0x5cf92f,'action':_0x0e6d('0x168'),'channel':_0x390103[_0x0e6d('0xd6')](_0x247177[_0x0e6d('0x6f')])?util['format'](_0x0e6d('0x18f'),_0x247177[_0x0e6d('0x6f')][_0x0e6d('0x38')],isNotNull(_0x247177[_0x0e6d('0x57')])?_0x247177[_0x0e6d('0x57')][_0x0e6d('0x190')]()||'':'',_0x247177[_0x0e6d('0x191')]>0x0?_0xceefba[_0x0e6d('0x16a')]['phone'][_0x0e6d('0x192')](_0x247177[_0x0e6d('0x191')]):_0xceefba['Contact'][_0x0e6d('0x16b')]):util[_0x0e6d('0x72')](_0x0e6d('0x18f'),_[_0x0e6d('0xa8')](_0x247177[_0x0e6d('0x13d')])?_0x247177['Trunk']['name']:_0x247177['TrunkBackup'][_0x0e6d('0x38')],isNotNull(_0x247177[_0x0e6d('0x57')])?_0x247177[_0x0e6d('0x57')]['trim']()||'':'',_0x247177[_0x0e6d('0x191')]>0x0?_0xceefba[_0x0e6d('0x16a')][_0x0e6d('0x16b')]['substring'](_0x247177[_0x0e6d('0x191')]):_0xceefba['Contact'][_0x0e6d('0x16b')]),'callerid':_0x39758b,'Exten':'xcally-motion-dialer','Context':_0x0e6d('0x193'),'Priority':'1','variable':_0x3cc65c,'timeout':(_0x247177[_0x0e6d('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cf92f})[_0x0e6d('0xb4')](function(_0x54cc76){return _0x2cac5a(_0x54cc76);})['catch'](function(_0x2f7fd5){_0x247177[_0x0e6d('0x194')]+=0x1;var _0x53ae3d=new History(_0x390103[_0x0e6d('0x21')][_0x5cf92f]);logger[_0x0e6d('0x90')](util[_0x0e6d('0x72')](_0x0e6d('0x195'),JSON[_0x0e6d('0x44')](_0x2f7fd5)));_0x53ae3d[_0x0e6d('0xa2')]=0xe;_0x53ae3d[_0x0e6d('0xa3')]='OriginateError';_0x53ae3d[_0x0e6d('0x119')]=moment()[_0x0e6d('0x72')](_0x0e6d('0xfa'));_0x53ae3d[_0x0e6d('0xa4')]=_0x53ae3d[_0x0e6d('0x119')];_0x390103[_0x0e6d('0xc6')](_0x53ae3d)['catch'](loggerCatch(_0x0e6d('0x196')));_0x390103[_0x0e6d('0xc4')](_0x53ae3d)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x196')))[_0x0e6d('0x19')](function(){delete _0x390103[_0x0e6d('0x21')][_0x5cf92f];return _0x18abf4(msgResponse(_0x0e6d('0x168'),_0x0e6d('0x43'),_0x0e6d('0x197')));});});});};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x2b')]=function(_0x432343){var _0x35ef8b=this[_0x0e6d('0x21')][_0x432343[_0x0e6d('0x121')]];if(_0x35ef8b){delete this['actions'][_0x432343[_0x0e6d('0x121')]];_0x35ef8b[_0x0e6d('0x114')]=moment()[_0x0e6d('0x72')](_0x0e6d('0xfa'));var _0x5c43a6=_0x35ef8b[_0x0e6d('0x50')]===_0x0e6d('0x75')?this[_0x0e6d('0x1c')][_0x35ef8b[_0x0e6d('0xaf')]]:this[_0x0e6d('0x1b')][_0x35ef8b[_0x0e6d('0x198')]()];if(!this[_0x0e6d('0xd4')](_0x432343[_0x0e6d('0x199')])){this[_0x0e6d('0xae')](_0x5c43a6);return this[_0x0e6d('0x19a')](_0x35ef8b,_0x5c43a6,_0x432343)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x19b')));}this[_0x0e6d('0x23')][_0x432343[_0x0e6d('0xdf')]]=_0x35ef8b;}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x19c')]=function(_0x3f3353,_0x77007,_0x5534ee){var _0xb537b=new History(_0x77007);if(_0xb537b[_0x0e6d('0xee')]+_0xb537b[_0x0e6d('0xfe')]+_0xb537b['countnoanswerretry']+_0xb537b[_0x0e6d('0xef')]+_0xb537b[_0x0e6d('0x100')]+_0xb537b[_0x0e6d('0x101')]+_0xb537b[_0x0e6d('0xeb')]+_0xb537b[_0x0e6d('0xf0')]>=_0x5534ee[_0x0e6d('0xf1')]-0x1){return!![];}switch(_0x3f3353){case 0x3:if(_0xb537b[_0x0e6d('0xff')]>=_0x5534ee[_0x0e6d('0x19d')]-0x1){return!![];}this[_0x0e6d('0xbb')]({'active':![],'countnoanswerretry':_0xb537b[_0x0e6d('0xff')]+=0x1,'scheduledat':moment()['add'](_0x5534ee[_0x0e6d('0x19e')],'minutes')['format'](_0x0e6d('0xfa')),'ContactId':_0xb537b['ContactId'],'ListId':_0xb537b['ListId'],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x19f')));break;case 0x5:if(_0xb537b[_0x0e6d('0xee')]>=_0x5534ee[_0x0e6d('0x1a0')]-0x1){return!![];}this[_0x0e6d('0xbb')]({'active':![],'countbusyretry':_0xb537b[_0x0e6d('0xee')]+=0x1,'scheduledat':moment()[_0x0e6d('0xf7')](_0x5534ee[_0x0e6d('0x1a1')],_0x0e6d('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb537b[_0x0e6d('0xce')],'ListId':_0xb537b['ListId'],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b['CampaignId']||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x1a2')));break;case 0x8:if(_0xb537b[_0x0e6d('0xfe')]>=_0x5534ee[_0x0e6d('0x1a3')]-0x1){return!![];}this[_0x0e6d('0xbb')]({'active':![],'countcongestionretry':_0xb537b[_0x0e6d('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x5534ee[_0x0e6d('0x1a4')],_0x0e6d('0xf9'))[_0x0e6d('0x72')](_0x0e6d('0xfa')),'ContactId':_0xb537b[_0x0e6d('0xce')],'ListId':_0xb537b[_0x0e6d('0xcf')],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x1a5')));break;case 0x0:if(_0xb537b[_0x0e6d('0xef')]>=_0x5534ee[_0x0e6d('0x1a6')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xb537b[_0x0e6d('0xef')]+=0x1,'scheduledat':moment()[_0x0e6d('0xf7')](_0x5534ee[_0x0e6d('0x1a7')],_0x0e6d('0xf9'))['format'](_0x0e6d('0xfa')),'ContactId':_0xb537b[_0x0e6d('0xce')],'ListId':_0xb537b['ListId'],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b['CampaignId']||undefined})[_0x0e6d('0xac')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xb537b[_0x0e6d('0x100')]>=_0x5534ee['dialDropMaxRetry']-0x1){return!![];}this[_0x0e6d('0xbb')]({'active':![],'countdropretry':_0xb537b['countdropretry']+=0x1,'scheduledat':moment()[_0x0e6d('0xf7')](_0x5534ee[_0x0e6d('0x1a8')],_0x0e6d('0xf9'))[_0x0e6d('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb537b['ContactId'],'ListId':_0xb537b[_0x0e6d('0xcf')],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x118')));break;case 0xb:if(_0xb537b[_0x0e6d('0x101')]>=_0x5534ee[_0x0e6d('0x11f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0xb537b[_0x0e6d('0x101')]+=0x1,'scheduledat':moment()[_0x0e6d('0xf7')](_0x5534ee[_0x0e6d('0x1a9')],_0x0e6d('0xf9'))[_0x0e6d('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb537b[_0x0e6d('0xce')],'ListId':_0xb537b[_0x0e6d('0xcf')],'VoiceQueueId':_0xb537b['VoiceQueueId']||undefined,'CampaignId':_0xb537b[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xb537b['countmachineretry']>=_0x5534ee[_0x0e6d('0xf4')]-0x1){return!![];}this[_0x0e6d('0xbb')]({'active':![],'countmachineretry':_0xb537b['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x5534ee[_0x0e6d('0xf8')],_0x0e6d('0xf9'))['format'](_0x0e6d('0xfa')),'ContactId':_0xb537b[_0x0e6d('0xce')],'ListId':_0xb537b[_0x0e6d('0xcf')],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xfc')));break;case 0x14:if(_0xb537b[_0x0e6d('0xf0')]>=_0x5534ee['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x0e6d('0xbb')]({'active':![],'countagentrejectretry':_0xb537b[_0x0e6d('0xf0')]+=0x1,'scheduledat':moment()[_0x0e6d('0xf7')](_0x5534ee['dialAgentRejectRetryFrequency'],_0x0e6d('0xf9'))[_0x0e6d('0x72')](_0x0e6d('0xfa')),'ContactId':_0xb537b['ContactId'],'ListId':_0xb537b[_0x0e6d('0xcf')],'VoiceQueueId':_0xb537b[_0x0e6d('0xd1')]||undefined,'CampaignId':_0xb537b[_0x0e6d('0xfb')]||undefined})['catch'](loggerCatch(_0x0e6d('0x1aa')));break;default:return!![];}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x19a')]=function(_0xf6aa7e,_0x412abe,_0x40c1a9){var _0xe1efee=this;var _0x569e84=new History(_0xf6aa7e);return new BPromise(function(_0x45cb26,_0x80d20){if(_['isUndefined'](_0x412abe)&&typeof _0x412abe!==_0x0e6d('0x1ab')){return _0x80d20(msgResponse(_0x0e6d('0x1ac'),_0x0e6d('0x146'),'entity\x20is\x20undefine'));}if(_[_0x0e6d('0x36')](_0x40c1a9)&&typeof _0x40c1a9!=='object'){return _0x80d20(msgResponse(_0x0e6d('0x1ac'),_0x0e6d('0x146'),_0x0e6d('0x1ad')));}switch(_0x40c1a9[_0x0e6d('0x108')]){case'0':_0x412abe['outboundNoSuchCallsDay']+=0x1;_0x569e84[_0x0e6d('0xa2')]=0x0;_0x569e84['statedesc']=_0x0e6d('0x1ae');_0x569e84[_0x0e6d('0xef')]+=0x1;_0x569e84['countglobal']+=0x1;ami[_0x0e6d('0x48')](_0x0e6d('0x1af'),ut['buildObj'](_0xf6aa7e,_0x0e6d('0x1b0')));_0xe1efee[_0x0e6d('0xc6')](_0x569e84)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0xed')));if(_0xe1efee[_0x0e6d('0x19c')](0x0,_0xf6aa7e,_0x412abe)){if(_0x569e84[_0x0e6d('0xef')]>=_0x412abe[_0x0e6d('0x1a6')]){_0xe1efee[_0x0e6d('0xf5')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1b1'));}else{_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1b1'));}}break;case'3':_0x412abe[_0x0e6d('0x5e')]+=0x1;_0x569e84[_0x0e6d('0xa2')]=0x3;_0x569e84[_0x0e6d('0xa3')]=_0x0e6d('0x1b2');_0x569e84['countnoanswerretry']+=0x1;_0x569e84[_0x0e6d('0xec')]+=0x1;ami[_0x0e6d('0x48')](_0x0e6d('0x1b3'),ut['buildObj'](_0xf6aa7e,_0x0e6d('0x1b4')));_0xe1efee[_0x0e6d('0xc6')](_0x569e84)['catch'](loggerCatch(_0x0e6d('0x1b5')));if(_0xe1efee[_0x0e6d('0x19c')](0x3,_0xf6aa7e,_0x412abe)){if(_0x569e84[_0x0e6d('0xff')]>=_0x412abe[_0x0e6d('0x19d')]){_0xe1efee['createStateFinal'](_0x569e84,_0x45cb26,_0x80d20,'reason\x203\x20ringing\x20no\x20answer');}else{_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1b6'));}}break;case'5':_0x412abe[_0x0e6d('0x1b7')]+=0x1;_0x569e84[_0x0e6d('0xa2')]=0x5;_0x569e84[_0x0e6d('0xa3')]='Busy';_0x569e84[_0x0e6d('0xee')]+=0x1;_0x569e84[_0x0e6d('0xec')]+=0x1;ami['emit'](_0x0e6d('0x1b8'),ut[_0x0e6d('0xe4')](_0xf6aa7e,_0x0e6d('0x1b9')));_0xe1efee['createHistory'](_0x569e84)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x1ba')));if(_0xe1efee[_0x0e6d('0x19c')](0x5,_0xf6aa7e,_0x412abe)){if(_0x569e84['countbusyretry']>=_0x412abe[_0x0e6d('0x1a0')]){_0xe1efee[_0x0e6d('0xf5')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1bb'));}else{_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1bb'));}}break;case'8':_0x412abe[_0x0e6d('0x5b')]+=0x1;_0x569e84[_0x0e6d('0xa2')]=0x8;_0x569e84['statedesc']=_0x0e6d('0x1bc');_0x569e84['countcongestionretry']+=0x1;_0x569e84['countglobal']+=0x1;ami['emit'](_0x0e6d('0x1bd'),ut[_0x0e6d('0xe4')](_0xf6aa7e,_0x0e6d('0x1be')));_0xe1efee[_0x0e6d('0xc6')](_0x569e84)[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x1bf')));if(_0xe1efee['checkRetriveMax'](0x8,_0xf6aa7e,_0x412abe)){if(_0x569e84['countcongestionretry']>=_0x412abe['dialCongestionMaxRetry']){_0xe1efee['createStateFinal'](_0x569e84,_0x45cb26,_0x80d20,'reason\x208\x20congestion');}else{_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1c0'));}}break;case'11':_0x412abe[_0x0e6d('0x1c1')]+=0x1;_0x569e84[_0x0e6d('0xa2')]=0xb;_0x569e84['statedesc']=_0x0e6d('0x11d');_0x569e84[_0x0e6d('0x101')]+=0x1;_0x569e84['countglobal']+=0x1;_0xe1efee[_0x0e6d('0xc6')](_0x569e84)[_0x0e6d('0xac')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xe1efee['checkRetriveMax'](0xb,_0xf6aa7e,_0x412abe)){if(_0x569e84[_0x0e6d('0x101')]>=_0x412abe[_0x0e6d('0x11f')]){_0xe1efee[_0x0e6d('0xf5')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1c2'));}else{_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1c2'));}}break;case'20':_0x412abe[_0x0e6d('0x61')]+=0x1;_0x569e84[_0x0e6d('0xa2')]=0x14;_0x569e84[_0x0e6d('0xa3')]=_0x0e6d('0x1c3');_0x569e84[_0x0e6d('0xf0')]+=0x1;_0x569e84[_0x0e6d('0xec')]+=0x1;ami[_0x0e6d('0x48')](_0x0e6d('0x1c4'),ut['buildObj'](_0xf6aa7e,'agentreject'));_0xe1efee[_0x0e6d('0xc6')](_0x569e84)['catch'](loggerCatch(_0x0e6d('0x1c5')));if(_0xe1efee[_0x0e6d('0x19c')](0x14,_0xf6aa7e,_0x412abe)){if(_0x569e84[_0x0e6d('0xf0')]>=_0x412abe[_0x0e6d('0x1c6')]){_0xe1efee[_0x0e6d('0xf5')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1c7'));}else{_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x0e6d('0x1c7'));}}break;default:_0x412abe[_0x0e6d('0x1c8')]+=0x1;_0x569e84[_0x0e6d('0xa2')]=0xc;_0x569e84['statedesc']=_0x40c1a9['reason'];_0xe1efee[_0x0e6d('0xc6')](_0x569e84)[_0x0e6d('0xac')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0xe1efee[_0x0e6d('0x19c')](_0x40c1a9[_0x0e6d('0x108')],_0xf6aa7e,_0x412abe)){if(_0x569e84[_0x0e6d('0xee')]+_0x569e84[_0x0e6d('0xfe')]+_0x569e84['countnoanswerretry']+_0x569e84[_0x0e6d('0xef')]+_0x569e84[_0x0e6d('0x100')]+_0x569e84[_0x0e6d('0x101')]+_0x569e84[_0x0e6d('0xeb')]+_0x569e84[_0x0e6d('0xf0')]>=_0x412abe[_0x0e6d('0xf1')]){_0xe1efee[_0x0e6d('0xf2')](_0x569e84,_0x45cb26,_0x80d20,_0x40c1a9[_0x0e6d('0x108')]);}else{_0xe1efee[_0x0e6d('0xf5')](_0x569e84,_0x45cb26,_0x80d20,_0x40c1a9[_0x0e6d('0x108')]);}}}});};Dialer[_0x0e6d('0xa5')]['stateGlobal']=function(_0x40fcfa,_0x3b99d5,_0x559649,_0x2856db){var _0x17dcae=new Final(_0x40fcfa);_0x17dcae['state']=0xf;_0x17dcae['statedesc']=_0x0e6d('0x1c9');this[_0x0e6d('0xf5')](_0x17dcae,_0x3b99d5,_0x559649,_0x2856db);};Dialer[_0x0e6d('0xa5')][_0x0e6d('0xf5')]=function(_0x347e5d,_0x1a60b6,_0x1435ba,_0x784ced){this[_0x0e6d('0xc4')](_0x347e5d)['then'](function(){return _0x1a60b6(msgResponse(_0x0e6d('0x1ac'),_0x0e6d('0xd5'),_0x784ced));})['catch'](function(){return _0x1435ba(msgResponse('[moveContactManagedDialer][0]','Failure',_0x0e6d('0x1ca')));});};Dialer[_0x0e6d('0xa5')]['predictive']=function(_0x16e5d6){var _0x2e0455=_0x16e5d6[_0x0e6d('0x1cb')]/0x64;var _0x548ed3=_0x16e5d6[_0x0e6d('0x115')]/(_0x16e5d6[_0x0e6d('0x115')]+_0x16e5d6[_0x0e6d('0x59')]);var _0x368538=Math[_0x0e6d('0x1cc')](_0x16e5d6['predictiveIntervalAvailable']*(_0x16e5d6[_0x0e6d('0x1cd')]/0x64));var _0x441831=Math[_0x0e6d('0x1cc')](_0x16e5d6[_0x0e6d('0x6b')]*(_0x16e5d6['predictiveIntervalMinThreshold']/0x64));var _0x209446=_0x16e5d6[_0x0e6d('0x4b')]+_0x16e5d6[_0x0e6d('0x4e')];var _0x276a8d=Math['floor'](_0x16e5d6[_0x0e6d('0x84')]*_0x16e5d6[_0x0e6d('0x6d')]*_0x16e5d6['predictiveIntervalHitRate']*_0x16e5d6[_0x0e6d('0x6a')]);if(_[_0x0e6d('0x36')](_0x16e5d6[_0x0e6d('0x25')])){if(!_[_0x0e6d('0x36')](_0x16e5d6[_0x0e6d('0x24')])){_0x16e5d6[_0x0e6d('0x24')]=undefined;loggerPredictive[_0x0e6d('0x90')]('[startMethodPredictive][StartProgressive]',_0x0e6d('0x1ce'));}if(!_['isUndefined'](_0x16e5d6[_0x0e6d('0x89')])){loggerPredictive[_0x0e6d('0x90')](_0x0e6d('0x1cf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x16e5d6['handlePredictive']);_0x16e5d6[_0x0e6d('0x89')]=undefined;}_0x16e5d6[_0x0e6d('0x25')]=moment()[_0x0e6d('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0e6d('0x78')](_0x16e5d6[_0x0e6d('0x38')],'collection\x20data\x20in\x20progressive\x20at',_0x16e5d6[_0x0e6d('0x25')]);this[_0x0e6d('0x156')](_0x16e5d6,0x1);}else if(ifInterval(_0x16e5d6['dialPredictiveInterval'],_0x16e5d6['startProgressive'])){this['handlePower'](_0x16e5d6,0x1);loggerPredictiveCalls[_0x0e6d('0x78')](_0x0e6d('0x1d0'),_0x16e5d6[_0x0e6d('0x25')],_0x16e5d6[_0x0e6d('0x38')]);_0x16e5d6[_0x0e6d('0x84')]=0x0;_0x16e5d6[_0x0e6d('0x68')]=0x0;}else if(_0x2e0455<_0x548ed3&&_0x16e5d6[_0x0e6d('0x1d1')]===_0x0e6d('0x1d2')){freeVariablesPredictive(_0x16e5d6);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x1d3'),_0x0e6d('0x1d4'),_0x548ed3,_0x0e6d('0x25'),_0x16e5d6[_0x0e6d('0x38')]);}else if(_0x276a8d<_0x16e5d6[_0x0e6d('0x68')]&&_0x16e5d6[_0x0e6d('0x1d1')]===_0x0e6d('0x1d2')){freeVariablesPredictive(_0x16e5d6);loggerPredictive[_0x0e6d('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x0e6d('0x1d5'),_0x276a8d,'Drop\x20in\x20this\x20interval',_0x16e5d6[_0x0e6d('0x68')],_0x0e6d('0x25'),_0x16e5d6[_0x0e6d('0x38')]);}else if(!ifInterval(_0x16e5d6[_0x0e6d('0x1d6')],_0x16e5d6[_0x0e6d('0x25')])&&_[_0x0e6d('0x36')](_0x16e5d6[_0x0e6d('0x24')])&&!_[_0x0e6d('0x36')](_0x16e5d6['startProgressive'])){_0x16e5d6['startPredictive']=moment()[_0x0e6d('0x72')](_0x0e6d('0xfa'));loggerPredictive[_0x0e6d('0x78')](_0x16e5d6['name'],_0x0e6d('0x1d7'),_0x16e5d6[_0x0e6d('0x24')]);this[_0x0e6d('0xb8')](_0x16e5d6[_0x0e6d('0x1d6')])[_0x0e6d('0xb4')](this[_0x0e6d('0x1d8')](_0x16e5d6))[_0x0e6d('0xb4')](mergeDataErlangB(_0x16e5d6))[_0x0e6d('0xb4')](this[_0x0e6d('0x1d9')](_0x16e5d6))[_0x0e6d('0xac')](loggerCatchPredictive(_0x0e6d('0x1da'),_0x16e5d6));}else if(!ifInterval(_0x16e5d6[_0x0e6d('0x1d6')],_0x16e5d6['startPredictive'])){_0x16e5d6[_0x0e6d('0x68')]=0x0;_0x16e5d6[_0x0e6d('0x24')]=moment()[_0x0e6d('0x72')](_0x0e6d('0xfa'));loggerPredictive[_0x0e6d('0x78')](_0x16e5d6[_0x0e6d('0x38')],_0x0e6d('0x1db'),_0x16e5d6[_0x0e6d('0x24')]);clearInterval(_0x16e5d6[_0x0e6d('0x89')]);_0x16e5d6[_0x0e6d('0x89')]=undefined;this[_0x0e6d('0xb8')](_0x16e5d6[_0x0e6d('0x1d6')])[_0x0e6d('0xb4')](this[_0x0e6d('0x1d8')](_0x16e5d6))[_0x0e6d('0xb4')](mergeDataErlangB(_0x16e5d6))[_0x0e6d('0xb4')](this['startMethodPredictive'](_0x16e5d6))[_0x0e6d('0xac')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x16e5d6));}else if(_0x16e5d6[_0x0e6d('0x6b')]&&_0x209446<_0x16e5d6[_0x0e6d('0x6b')]-_0x441831){freeVariablesPredictive(_0x16e5d6);loggerPredictive['info'](_0x16e5d6['name'],_0x0e6d('0x1dc'),_0x209446,_0x0e6d('0x1dd'),_0x16e5d6[_0x0e6d('0x6b')],'-',_0x441831,'=',_0x16e5d6['predictiveIntervalAvailable']-_0x441831,')');}else if(_0x16e5d6['predictiveIntervalAvailable']&&_0x209446>_0x16e5d6[_0x0e6d('0x6b')]+_0x368538){freeVariablesPredictive(_0x16e5d6);loggerPredictive[_0x0e6d('0x78')](_0x16e5d6['name'],_0x0e6d('0x1dc'),_0x209446,_0x0e6d('0x1de'),_0x16e5d6[_0x0e6d('0x6b')],'+',_0x368538,'=',_0x16e5d6[_0x0e6d('0x6b')]+_0x368538,')');}};Dialer[_0x0e6d('0xa5')]['getDataPredictive']=function(_0x3b9156){var _0x433e16=this;return function(_0x22263c){return new BPromise(function(_0x1fc108,_0x35ff82){_[_0x0e6d('0x86')](_0x3b9156,_0x22263c[0x0]);if(checkGetDataPredictive(_0x22263c[0x0])){var _0x2b42a9=_0x3b9156['predictiveIntervalAvailable']=_0x3b9156[_0x0e6d('0x4e')]+_0x3b9156[_0x0e6d('0x4b')];var _0x7d18f2=_0x3b9156['dialPredictiveInterval']*0x3c;var _0x21f8a3=_0x22263c[0x0][_0x0e6d('0x64')]+_0x22263c[0x0][_0x0e6d('0x63')];var _0x264d2a=(_0x22263c[0x0]['predictiveIntervalAnsweredCalls']+_0x22263c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x22263c[0x0][_0x0e6d('0x65')])/_0x22263c[0x0][_0x0e6d('0x81')];_0x3b9156['predictiveIntervalHitRate']=_0x264d2a>0x0?_0x264d2a:0x1;switch(_0x3b9156[_0x0e6d('0x1d1')]){case'dropRate':var _0xc159e1=_0x3b9156[_0x0e6d('0x1cb')]/0x64;return _0x433e16[_0x0e6d('0x1df')](_0x2b42a9,_0x7d18f2,_0x21f8a3,_0x264d2a,_0xc159e1)['then'](function(_0x6a29f9){return _0x1fc108(_0x6a29f9);});case'agentBusyFactor':var _0xd466d9=_0x3b9156[_0x0e6d('0x1cb')]/0x64;return _0x433e16[_0x0e6d('0x1e0')](_0x2b42a9,_0x7d18f2,_0x21f8a3,_0x264d2a,_0xd466d9)[_0x0e6d('0xb4')](function(_0x14c254){return _0x1fc108(_0x14c254);});default:return _0x35ff82(msgResponse(_0x0e6d('0x1e1'),'Failure','Unknown\x20Predictive'));}}else{return _0x35ff82(msgResponse(_0x0e6d('0x1e1'),_0x0e6d('0x146'),'check\x20failure'));}});};};Dialer['prototype'][_0x0e6d('0x1e2')]=function(_0x302425){var _0x3639a3=this;return function(_0x2cf421){return new BPromise(function(_0xba26cb,_0x1e7a60){_[_0x0e6d('0x86')](_0x302425,_0x2cf421[0x0]);if(checkGetDataPredictive(_0x2cf421[0x0])){loggerPredictive[_0x0e6d('0x78')](JSON[_0x0e6d('0x44')](_0x2cf421[0x0]));if(_0x302425['dialPredictiveOptimization']===_0x0e6d('0x1d2')){return _0x3639a3[_0x0e6d('0xc2')](_0x302425['id'])[_0x0e6d('0xb4')](function(_0x4ab699){var _0x5de94c=_0x302425[_0x0e6d('0x15e')]-_0x4ab699[0x0]['outboundQueuePauses'];var _0x5a3443=_0x302425[_0x0e6d('0x1d6')]*0x3c;var _0x4e82da=_0x2cf421[0x0]['predictiveIntervalAvgTalktime']+_0x2cf421[0x0][_0x0e6d('0x63')];var _0x186e17=(_0x2cf421[0x0][_0x0e6d('0x62')]+_0x2cf421[0x0][_0x0e6d('0x66')]+_0x2cf421[0x0][_0x0e6d('0x65')])/_0x2cf421[0x0][_0x0e6d('0x81')];var _0x17c3f0=_0x302425[_0x0e6d('0x1cb')]/0x64;_0x302425[_0x0e6d('0x1e3')]=_0x4ab699[0x0]['outboundQueuePauses']||0x0;_0x302425['predictiveIntervalHitRate']=_0x186e17>0x0?_0x186e17:0x1;return _0x3639a3[_0x0e6d('0x1df')](_0x5de94c,_0x5a3443,_0x4e82da,_0x186e17,_0x17c3f0);})[_0x0e6d('0xb4')](function(_0x1b60ab){return _0xba26cb(_0x1b60ab);})[_0x0e6d('0xac')](function(_0x204b34){return _0x1e7a60(msgResponse(_0x0e6d('0x1e4'),'Failure',JSON['stringify'](_0x204b34)));});}if(_0x302425[_0x0e6d('0x1d1')]===_0x0e6d('0x1e5')){return _0x3639a3[_0x0e6d('0xc2')](_0x302425['id'])['then'](function(_0x1a01c3){var _0x3d3f1f=_0x302425[_0x0e6d('0x15e')]-_0x1a01c3[0x0]['outboundQueuePauses'];var _0x136462=_0x302425[_0x0e6d('0x1d6')]*0x3c;var _0x1d829d=_0x2cf421[0x0][_0x0e6d('0x64')]+_0x2cf421[0x0][_0x0e6d('0x63')];var _0x1c598a=(_0x2cf421[0x0][_0x0e6d('0x62')]+_0x2cf421[0x0][_0x0e6d('0x66')]+_0x2cf421[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2cf421[0x0][_0x0e6d('0x81')];var _0x4f2b24=_0x302425['dialPredictiveOptimizationPercentage']/0x64;_0x302425[_0x0e6d('0x1e3')]=_0x1a01c3[0x0][_0x0e6d('0x1e6')]||0x0;_0x302425['predictiveIntervalHitRate']=_0x1c598a>0x0?_0x1c598a:0x1;return _0x3639a3['busyFactor'](_0x3d3f1f,_0x136462,_0x1d829d,_0x1c598a,_0x4f2b24);})[_0x0e6d('0xb4')](function(_0x418b65){return _0xba26cb(_0x418b65);})[_0x0e6d('0xac')](function(_0x4dedb9){return _0x1e7a60(msgResponse(_0x0e6d('0x1e4'),_0x0e6d('0x146'),JSON[_0x0e6d('0x44')](_0x4dedb9)));});}}else{return _0x1e7a60(msgResponse(_0x0e6d('0x1e1'),'Failure','check\x20failure'));}});};};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x1d9')]=function(_0x59fbb9){var _0xb0a023=this;return function(){var _0x49619c=0x0;var _0x5d567e=Math[_0x0e6d('0x1e7')](_0x59fbb9[_0x0e6d('0x6c')]*0x3e8);if(_0x5d567e>0x0){_0x5d567e=_0x5d567e<0x64?0x64:_0x5d567e;loggerPredictive[_0x0e6d('0x78')](_0x59fbb9[_0x0e6d('0x38')],_0x0e6d('0x1e8'),_0x5d567e,_0x0e6d('0x45'));_0x59fbb9[_0x0e6d('0x89')]=setInterval(function(){_0xb0a023['handlePredictive'](_0x59fbb9);loggerPredictiveCalls[_0x0e6d('0x78')](_0x0e6d('0x1e9'),_0x49619c+=0x1);},_0x5d567e);}else{loggerPredictive[_0x0e6d('0x78')](_0x59fbb9[_0x0e6d('0x38')],_0x0e6d('0x1ea'));}};};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x1eb')]=function(_0x19a054,_0x5a398e){var _0x4f240c=this;return function(_0x2cff35){if(_['isEmpty'](_0x2cff35)){if(_[_0x0e6d('0xa8')](_0x5a398e[_0x0e6d('0xd0')])||!_0x5a398e[_0x0e6d('0x1ec')]){if(_0x19a054['dialMethod']==='booked'){_0x19a054[_0x0e6d('0x128')]=_[_0x0e6d('0x36')](_0x19a054[_0x0e6d('0x128')])?!![]:_0x19a054[_0x0e6d('0x128')];var _0x68c19f=uuid['v4']();_0x4f240c[_0x0e6d('0x21')][_0x68c19f]=new Action(_0x19a054,_0x5a398e,_0x68c19f);loggerBooked[_0x0e6d('0x78')](_0x0e6d('0x1ed'),_0x68c19f,_0x0e6d('0x1ee'),JSON['stringify'](_0x19a054['queueStatusComplete']),_0x0e6d('0x1ef'),_0x19a054[_0x0e6d('0x38')]);if(_0x19a054[_0x0e6d('0x128')]){_0x19a054[_0x0e6d('0x128')]=![];_0x4f240c[_0x0e6d('0x27')][_0x4f240c['actions'][_0x68c19f][_0x0e6d('0xaf')]]=[];ami[_0x0e6d('0xa9')]({'actionid':_0x68c19f,'action':_0x0e6d('0x1f0'),'queue':_0x19a054[_0x0e6d('0x38')]})[_0x0e6d('0xac')](function(){_0x4f240c[_0x0e6d('0xae')](_0x19a054);_0x4f240c['rescheduleContact']({'active':![],'ContactId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f][_0x0e6d('0xce')],'ListId':_0x4f240c['actions'][_0x68c19f][_0x0e6d('0xcf')],'VoiceQueueId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f][_0x0e6d('0xd1')]||undefined,'CampaignId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f][_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x1f1')));delete _0x4f240c[_0x0e6d('0x21')][_0x68c19f];});}else{loggerBooked['info'](_0x0e6d('0x1f2'),JSON[_0x0e6d('0x44')](_0x19a054[_0x0e6d('0x128')]),_0x0e6d('0x1ef'),_0x19a054[_0x0e6d('0x38')]);_0x4f240c['updateOriginated'](_0x19a054);_0x4f240c[_0x0e6d('0xbb')]({'active':![],'ContactId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f]['ContactId'],'ListId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f][_0x0e6d('0xcf')],'VoiceQueueId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f]['VoiceQueueId']||undefined,'CampaignId':_0x4f240c[_0x0e6d('0x21')][_0x68c19f][_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4f240c[_0x0e6d('0x21')][_0x68c19f];}}else{return _0x4f240c[_0x0e6d('0x167')](_0x19a054,_0x5a398e);}}else{if(getDiff(_0x5a398e[_0x0e6d('0x1f3')])<_0x19a054['dialRecallMeTimeout']*0x3c){if(_0x5a398e[_0x0e6d('0x1f4')]&&!_0x5a398e['Agent'][_0x0e6d('0x1f5')]){_0x4f240c[_0x0e6d('0x8b')][_0x0e6d('0x12b')](_0x5a398e['id'])[_0x0e6d('0x19')](function(){_0x4f240c['updateOriginated'](_0x19a054);});}else{_0x4f240c[_0x0e6d('0xbd')]({'active':![]},_0x5a398e['id'],0x1)[_0x0e6d('0x19')](function(){_0x4f240c['updateOriginated'](_0x19a054);});}}else{_0x19a054[_0x0e6d('0x60')]+=0x1;_0x4f240c['updateOriginated'](_0x19a054);if(_0x19a054[_0x0e6d('0x1f6')]){_0x4f240c[_0x0e6d('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a398e[_0x0e6d('0xce')],'ListId':_0x5a398e[_0x0e6d('0xcf')],'VoiceQueueId':_0x5a398e['VoiceQueueId']||undefined,'CampaignId':_0x5a398e[_0x0e6d('0xfb')]||undefined})[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x1f7')));_0x4f240c[_0x0e6d('0xc6')](createObjHistory(_0x19a054,_0x5a398e,_0x0e6d('0x1f8'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x0e6d('0x1f9')));}else{_0x4f240c[_0x0e6d('0xcc')](createObjHistory(_0x19a054,_0x5a398e,_0x0e6d('0x1fa'),0x16,_0x0e6d('0x1fb')),_0x0e6d('0x1fc'),_0x0e6d('0x1fd'));}}}}else{_0x19a054['outboundBlacklistCallsDay']+=0x1;_0x4f240c[_0x0e6d('0xcc')](createObjHistory(_0x19a054,_0x5a398e,'BLACKLIST',0xd,_0x0e6d('0x1fe')),_0x0e6d('0x1ff'),'[Originate][MoveBlacklist]');throw _0x0e6d('0x200');}};};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x201')]=function(_0x297a97){var _0x36940a=this;var _0x56f88d=_0x297a97[_0x0e6d('0x202')]-_0x297a97[_0x0e6d('0x93')]-_0x297a97[_0x0e6d('0xbf')];emitCampaignSummary(_0x297a97);if(_0x56f88d>0x0){if(_0x56f88d>this[_0x0e6d('0x1f')]){_0x56f88d=this[_0x0e6d('0x1f')];}_0x297a97[_0x0e6d('0xbf')]+=_0x56f88d;this[_0x0e6d('0xc1')](_0x297a97['id'],_0x56f88d,_0x297a97['dialOrderByScheduledAt'],_0x297a97)['then'](function(_0x5d3dbf){_0x297a97[_0x0e6d('0xbf')]-=_0x56f88d;_0x297a97[_0x0e6d('0xbf')]=_0x297a97[_0x0e6d('0xbf')]>0x0?_0x297a97['temp']:0x0;if(!checkContactEmpty(_0x5d3dbf)){_0x297a97[_0x0e6d('0x3a')]=_0x0e6d('0x99');logger[_0x0e6d('0x78')](_0x0e6d('0x203')+_0x297a97[_0x0e6d('0x38')]);}else{_0x297a97[_0x0e6d('0x93')]+=_0x5d3dbf[_0x0e6d('0x92')];_0x297a97[_0x0e6d('0x3a')]=_0x0e6d('0x204');for(var _0x1baffd=0x0;_0x1baffd<_0x5d3dbf[_0x0e6d('0x92')];_0x1baffd+=0x1){_0x297a97['ivrTotalCallsDays']+=0x1;if(_[_0x0e6d('0xa8')](_0x5d3dbf[_0x1baffd])||_[_0x0e6d('0xa8')](_0x5d3dbf[_0x1baffd][_0x0e6d('0x16a')])||_[_0x0e6d('0xa8')](_0x5d3dbf[_0x1baffd][_0x0e6d('0x16a')]['phone'])){_0x36940a['emptyContact'](_0x0e6d('0x205'),_0x297a97,_0x5d3dbf[_0x1baffd]);}else{_0x36940a[_0x0e6d('0xb6')](_[_0x0e6d('0xcd')](_0x5d3dbf[_0x1baffd],[_0x0e6d('0xfb'),_0x0e6d('0x206')]))['then'](_0x36940a[_0x0e6d('0x1eb')](_0x297a97,_0x5d3dbf[_0x1baffd]))[_0x0e6d('0xac')](_0x36940a['loggerHandler']('[actionOriginateIvr]\x20',_0x297a97));}}}})[_0x0e6d('0xac')](loggerGetContactDialer('[getContactCampaign2]',_0x297a97,_0x56f88d));}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x156')]=function(_0x9a5165,_0x26a453){var _0x101555=this;var _0x4db9e0=[];var _0x3d62e3=_0x26a453>=0x1?_0x26a453:0x1;if(_0x9a5165[_0x0e6d('0x53')]===_0x0e6d('0x159')){_0x3d62e3=0x1;}var _0x15f48a=Math['floor'](_0x9a5165[_0x0e6d('0x4b')]*_0x3d62e3)-_0x9a5165[_0x0e6d('0x93')]-_0x9a5165['temp'];emitVoiceQueueSummary(_0x9a5165);if(_0x9a5165[_0x0e6d('0x207')]>0x0){var _0x4d3299=_0x9a5165['dialLimitQueue']-_0x9a5165[_0x0e6d('0x93')]-_0x9a5165['talking']-_0x9a5165[_0x0e6d('0xbf')]-_0x9a5165[_0x0e6d('0x9c')];if(_0x15f48a>_0x4d3299){_0x15f48a=_0x4d3299;}}if(_0x15f48a>0x0){if(_0x9a5165[_0x0e6d('0x53')]===_0x0e6d('0x159')){_0x15f48a=0x1;}if(_0x15f48a>this['maxNumberOriginate']){_0x15f48a=this[_0x0e6d('0x1f')];}_0x9a5165[_0x0e6d('0xbf')]+=_0x15f48a;for(var _0x2efbb4 in this[_0x0e6d('0x1d')]){if(typeof this['agents'][_0x2efbb4]!==_0x0e6d('0x94')){if(this[_0x0e6d('0x1d')][_0x2efbb4][_0x0e6d('0xa2')]===_0x0e6d('0x208')&&this['agents'][_0x2efbb4][_0x0e6d('0xaa')]==='reachable'){_0x4db9e0[_0x0e6d('0x127')](this['agents'][_0x2efbb4]['id']);}}}this[_0x0e6d('0xbe')](_0x9a5165['id'],_0x4db9e0,_0x15f48a,_0x9a5165[_0x0e6d('0x209')],_0x9a5165)['then'](function(_0x469f8f){_0x9a5165[_0x0e6d('0xbf')]-=_0x15f48a;_0x9a5165[_0x0e6d('0xbf')]=_0x9a5165[_0x0e6d('0xbf')]>0x0?_0x9a5165['temp']:0x0;if(!checkContactEmpty(_0x469f8f)){_0x101555['countReScheduled'](_0x9a5165)[_0x0e6d('0xb4')](sendMessageReschedule(_0x9a5165))[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x20a')));}else{_0x9a5165[_0x0e6d('0x93')]+=_0x469f8f['length'];_0x9a5165[_0x0e6d('0x3a')]=_0x9a5165[_0x0e6d('0x53')]===_0x0e6d('0x159')?_0x0e6d('0x174'):'RUNNING';for(var _0x588fa5=0x0;_0x588fa5<_0x469f8f['length'];_0x588fa5+=0x1){if(_[_0x0e6d('0xa8')](_0x469f8f[_0x588fa5])||_[_0x0e6d('0xa8')](_0x469f8f[_0x588fa5][_0x0e6d('0x16a')])||_['isNil'](_0x469f8f[_0x588fa5][_0x0e6d('0x16a')]['phone'])){_0x101555[_0x0e6d('0xca')](_0x0e6d('0x205'),_0x9a5165,_0x469f8f[_0x588fa5]);}else{_0x101555[_0x0e6d('0xb2')](_[_0x0e6d('0xcd')](_0x469f8f[_0x588fa5],[_0x0e6d('0xd1'),_0x0e6d('0x206')]))[_0x0e6d('0xb4')](_0x101555[_0x0e6d('0x1eb')](_0x9a5165,_0x469f8f[_0x588fa5]))[_0x0e6d('0xac')](_0x101555[_0x0e6d('0xc9')](_0x0e6d('0x205'),_0x9a5165));}}}})[_0x0e6d('0xac')](loggerGetContactDialer(_0x0e6d('0x20b'),_0x9a5165,_0x15f48a));}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x89')]=function(_0x1af902){if(_0x1af902[_0x0e6d('0x207')]>0x0){var _0x29ce57=_0x1af902[_0x0e6d('0x207')]-_0x1af902['originated']-_0x1af902['talking'];if(_0x29ce57>0x0){this[_0x0e6d('0x20c')](_0x1af902);}else{loggerPredictiveCalls[_0x0e6d('0x78')](_0x0e6d('0x20d'));}}else{this[_0x0e6d('0x20c')](_0x1af902);}};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x20c')]=function(_0x5af00d){var _0x133756=this;var _0x42d013=[];_0x5af00d['originated']+=0x1;for(var _0x2b7219 in this['agents']){if(typeof this[_0x0e6d('0x1d')][_0x2b7219]!=='undefined'){if(this['agents'][_0x2b7219]['state']===_0x0e6d('0x208')&&this['agents'][_0x2b7219][_0x0e6d('0xaa')]===_0x0e6d('0xd8')){_0x42d013[_0x0e6d('0x127')](this[_0x0e6d('0x1d')][_0x2b7219]['id']);}}}this['getContactDialer'](_0x5af00d['id'],_0x42d013,0x1,_0x5af00d[_0x0e6d('0x209')],_0x5af00d)['then'](function(_0x19531a){if(!checkContactEmpty(_0x19531a)){checkContactLowerLimitOriginate(_0x5af00d,0x1,0x0);_0x133756['countReScheduled'](_0x5af00d)[_0x0e6d('0xb4')](sendMessageReschedule(_0x5af00d))[_0x0e6d('0xac')](loggerCatch(_0x0e6d('0x20a')));}else{_0x5af00d[_0x0e6d('0x3a')]=_0x0e6d('0x204');if(_['isNil'](_0x19531a[0x0])||_['isNil'](_0x19531a[0x0][_0x0e6d('0x16a')])||_[_0x0e6d('0xa8')](_0x19531a[0x0][_0x0e6d('0x16a')][_0x0e6d('0x16b')])){_0x133756[_0x0e6d('0xca')](_0x0e6d('0x205'),_0x5af00d,_0x19531a[0x0]);}else{_0x133756['checkIsBlackList'](_[_0x0e6d('0xcd')](_0x19531a[0x0],[_0x0e6d('0xd1'),_0x0e6d('0x206')]))['then'](_0x133756[_0x0e6d('0x1eb')](_0x5af00d,_0x19531a[0x0]))[_0x0e6d('0xac')](_0x133756[_0x0e6d('0xc9')](_0x0e6d('0x20e'),_0x5af00d));}}})[_0x0e6d('0xac')](loggerGetContactDialer(_0x0e6d('0x20f'),_0x5af00d,0x1));emitVoiceQueueSummary(_0x5af00d);};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x1df')]=function(_0x7d8e2d,_0x27b919,_0x416321,_0x21b5c1,_0x1e8a18,_0xdd548d){loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x210'));loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x211'),_0x7d8e2d);loggerPredictive['info'](_0x0e6d('0x212'),_0x27b919);loggerPredictive[_0x0e6d('0x78')]('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',_0x416321);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x213'),_0x21b5c1);loggerPredictive[_0x0e6d('0x78')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e8a18);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x80'));return new BPromise(function(_0x38a91d,_0x486fb7){if(_0x7d8e2d<=0x0||isNaN(_0x7d8e2d)){return _0x486fb7(msgResponse(_0x0e6d('0x214'),_0x0e6d('0x43'),_0x0e6d('0x215')+_0x7d8e2d));}if(_0x416321<=0x0||isNaN(_0x416321)){return _0x486fb7(msgResponse(_0x0e6d('0x214'),'Error','Ts\x20=\x20'+_0x416321));}if(_0x21b5c1<=0x0||isNaN(_0x21b5c1)){return _0x486fb7(msgResponse(_0x0e6d('0x214'),_0x0e6d('0x43'),_0x0e6d('0x216')+_0x21b5c1));}if(_0x27b919<=0x0||isNaN(_0x27b919)){return _0x486fb7(msgResponse(_0x0e6d('0x214'),_0x0e6d('0x43'),_0x0e6d('0x217')+_0x27b919));}if(_0x1e8a18<=0x0||isNaN(_0x1e8a18)){return _0x486fb7(msgResponse(_0x0e6d('0x214'),_0x0e6d('0x43'),_0x0e6d('0x218')+_0x1e8a18));}_0xdd548d=_0xdd548d||0x0;var _0x18d087=0x1/_0x416321;var _0x4438a1=0x0;var _0x28c311=0x0;var _0x474619=0x0;var _0x3b3098=0x0;for(var _0x31df01=0x0;_0x474619<_0x1e8a18;_0x31df01+=0x1){_0x28c311=_0x31df01/_0x27b919;_0x4438a1=(_0x21b5c1*_0x28c311+_0xdd548d)/_0x18d087;_0x474619=erlangb(_0x4438a1,_0x7d8e2d);_0x3b3098=_0x4438a1/_0x7d8e2d*(0x1-erlangb(_0x4438a1,_0x7d8e2d));}return _0x38a91d({'erlangCalls':_0x31df01,'erlangCallToSecond':_0x27b919/_0x31df01,'erlangAbandonmentRate':_0x474619,'erlangBusyFactor':_0x3b3098});});};Dialer[_0x0e6d('0xa5')][_0x0e6d('0x1e0')]=function(_0x58a9fa,_0x438803,_0xb3af02,_0x53850d,_0x13aeda,_0x9ffc3){loggerPredictive['info'](_0x0e6d('0x219'));loggerPredictive['info'](_0x0e6d('0x211'),_0x58a9fa);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x212'),_0x438803);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x21a'),_0xb3af02);loggerPredictive[_0x0e6d('0x78')](_0x0e6d('0x213'),_0x53850d);loggerPredictive['info'](_0x0e6d('0x21b'),_0x13aeda);loggerPredictive[_0x0e6d('0x78')]('---------------------------');return new BPromise(function(_0x44eaf3,_0x210625){if(_0x58a9fa<=0x0||isNaN(_0x58a9fa)){return _0x210625(msgResponse(_0x0e6d('0x21c'),'Error',_0x0e6d('0x215')+_0x58a9fa));}if(_0xb3af02<=0x0||isNaN(_0xb3af02)){return _0x210625(msgResponse('[busyFactor]',_0x0e6d('0x43'),_0x0e6d('0x21d')+_0xb3af02));}if(_0x53850d<=0x0||isNaN(_0x53850d)){return _0x210625(msgResponse(_0x0e6d('0x21c'),_0x0e6d('0x43'),'p\x20=\x20'+_0x53850d));}if(_0x438803<=0x0||isNaN(_0x438803)){return _0x210625(msgResponse(_0x0e6d('0x21c'),_0x0e6d('0x43'),_0x0e6d('0x217')+_0x438803));}if(_0x13aeda<=0x0||isNaN(_0x13aeda)){return _0x210625(msgResponse(_0x0e6d('0x21c'),'Error',_0x0e6d('0x21e')+_0x13aeda));}_0x9ffc3=_0x9ffc3||0x0;var _0x56b49d=0x1/_0xb3af02;var _0x2cf650=0x0;var _0x303d52=0x0;var _0x2e7cca=0x0;var _0x42f5c3=0x0;for(var _0x13cd3f=0x0;_0x42f5c3<_0x13aeda;_0x13cd3f+=0x1){_0x303d52=_0x13cd3f/_0x438803;_0x2cf650=(_0x53850d*_0x303d52+_0x9ffc3)/_0x56b49d;_0x2e7cca=erlangb(_0x2cf650,_0x58a9fa);_0x42f5c3=_0x2cf650/_0x58a9fa*(0x1-erlangb(_0x2cf650,_0x58a9fa));}return _0x44eaf3({'erlangCalls':_0x13cd3f,'erlangCallToSecond':_0x438803/_0x13cd3f,'erlangAbandonmentRate':_0x2e7cca,'erlangBusyFactor':_0x42f5c3});});};module[_0x0e6d('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 9051bfb..be6de32 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b84=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','reason','callback'];(function(_0x5d827b,_0x3cd851){var _0x30f20c=function(_0x1220af){while(--_0x1220af){_0x5d827b['push'](_0x5d827b['shift']());}};_0x30f20c(++_0x3cd851);}(_0x7b84,0x1ce));var _0x47b8=function(_0xfce126,_0x521b3e){_0xfce126=_0xfce126-0x0;var _0x4eddff=_0x7b84[_0xfce126];return _0x4eddff;};'use strict';var util=require(_0x47b8('0x0'));var _=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));function getSeconds(_0x5bc374,_0x39f1be){var _0x5891ae=moment(_0x5bc374)[_0x47b8('0x3')](0x0);var _0x3a26dc=moment(_0x39f1be)[_0x47b8('0x3')](0x0);return _0x5891ae['diff'](_0x3a26dc,_0x47b8('0x4'));}function QueueCallerAbandon(_0x685383,_0x353e52){this['scheduledat']=_0x685383[_0x47b8('0x5')];this['type']=_0x685383[_0x47b8('0x6')];this['campaigntype']=_0x685383['type']===_0x47b8('0x7')?_0x47b8('0x8'):_0x685383['type'];this[_0x47b8('0x9')]=_0x685383[_0x47b8('0x9')];this[_0x47b8('0xa')]=_0x685383[_0x47b8('0xa')];this[_0x47b8('0xb')]=_0x685383[_0x47b8('0xb')];this['countglobal']=_0x685383[_0x47b8('0x9')]+_0x685383[_0x47b8('0xa')]+_0x685383['countnoanswerretry']+_0x685383[_0x47b8('0xc')]+_0x685383[_0x47b8('0xd')]+_0x685383[_0x47b8('0xe')]+_0x685383[_0x47b8('0xf')]+_0x685383[_0x47b8('0x10')];this['countnosuchnumberretry']=_0x685383['countnosuchnumberretry'];this[_0x47b8('0xd')]=_0x685383[_0x47b8('0xd')];this[_0x47b8('0xe')]=_0x685383[_0x47b8('0xe')];this[_0x47b8('0xf')]=_0x685383[_0x47b8('0xf')];this[_0x47b8('0x10')]=_0x685383[_0x47b8('0x10')];this[_0x47b8('0x11')]=_0x353e52[_0x47b8('0x11')];this['calleridname']=_0x685383['name'];this[_0x47b8('0x12')]=_0x685383[_0x47b8('0x13')];this[_0x47b8('0x14')]=_0x685383[_0x47b8('0x14')];this[_0x47b8('0x15')]=_0x685383[_0x47b8('0x15')];this[_0x47b8('0x16')]=_0x685383[_0x47b8('0x16')];this[_0x47b8('0x17')]=this[_0x47b8('0x16')];this[_0x47b8('0x18')]=getSeconds(_0x685383[_0x47b8('0x15')],_0x685383[_0x47b8('0x14')]);this[_0x47b8('0x19')]=getSeconds(this[_0x47b8('0x16')],_0x685383[_0x47b8('0x15')]);this[_0x47b8('0x1a')]=0x0;this[_0x47b8('0x8')]=_0x353e52['queue'];this[_0x47b8('0x1b')]=_0x353e52['connectedlinename'];this[_0x47b8('0x1c')]=_0x353e52[_0x47b8('0x1c')];this[_0x47b8('0x1d')]=_0x685383['callback'];this[_0x47b8('0x1e')]=_0x685383[_0x47b8('0x1e')];this[_0x47b8('0x1f')]=_0x685383[_0x47b8('0x1f')];this[_0x47b8('0x20')]=_0x685383[_0x47b8('0x20')];this[_0x47b8('0x21')]=_0x685383[_0x47b8('0x21')];this[_0x47b8('0x22')]=_0x685383['ListId'];this['UserId']=_0x685383[_0x47b8('0x23')];this[_0x47b8('0x24')]=_0x685383[_0x47b8('0x24')];this['CampaignId']=_0x685383[_0x47b8('0x25')];this['originatecalleridnum']=_0x685383[_0x47b8('0x26')]||'';this['originatecalleridname']=_0x685383[_0x47b8('0x27')]||'';}module[_0x47b8('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xe5b8=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','seconds','scheduledat','type'];(function(_0x53df6c,_0x569c3f){var _0x36b191=function(_0x46e27b){while(--_0x46e27b){_0x53df6c['push'](_0x53df6c['shift']());}};_0x36b191(++_0x569c3f);}(_0xe5b8,0xe4));var _0x8e5b=function(_0x17d39f,_0x7ffc02){_0x17d39f=_0x17d39f-0x0;var _0x2da0ab=_0xe5b8[_0x17d39f];return _0x2da0ab;};'use strict';var util=require('util');var _=require(_0x8e5b('0x0'));var moment=require(_0x8e5b('0x1'));function getSeconds(_0x3f5458,_0x1ce189){var _0x5a3a66=moment(_0x3f5458)[_0x8e5b('0x2')](0x0);var _0x48f086=moment(_0x1ce189)[_0x8e5b('0x2')](0x0);return _0x5a3a66['diff'](_0x48f086,_0x8e5b('0x3'));}function QueueCallerAbandon(_0x27fe45,_0x57e52f){this[_0x8e5b('0x4')]=_0x27fe45[_0x8e5b('0x4')];this[_0x8e5b('0x5')]=_0x27fe45[_0x8e5b('0x5')];this['campaigntype']=_0x27fe45['type']==='outbound'?'queue':_0x27fe45[_0x8e5b('0x5')];this[_0x8e5b('0x6')]=_0x27fe45[_0x8e5b('0x6')];this['countcongestionretry']=_0x27fe45[_0x8e5b('0x7')];this[_0x8e5b('0x8')]=_0x27fe45['countnoanswerretry'];this[_0x8e5b('0x9')]=_0x27fe45['countbusyretry']+_0x27fe45[_0x8e5b('0x7')]+_0x27fe45[_0x8e5b('0x8')]+_0x27fe45[_0x8e5b('0xa')]+_0x27fe45[_0x8e5b('0xb')]+_0x27fe45[_0x8e5b('0xc')]+_0x27fe45[_0x8e5b('0xd')]+_0x27fe45['countagentrejectretry'];this[_0x8e5b('0xa')]=_0x27fe45[_0x8e5b('0xa')];this[_0x8e5b('0xb')]=_0x27fe45[_0x8e5b('0xb')];this[_0x8e5b('0xc')]=_0x27fe45[_0x8e5b('0xc')];this['countmachineretry']=_0x27fe45[_0x8e5b('0xd')];this[_0x8e5b('0xe')]=_0x27fe45['countagentrejectretry'];this[_0x8e5b('0xf')]=_0x57e52f[_0x8e5b('0xf')];this[_0x8e5b('0x10')]=_0x27fe45['name'];this[_0x8e5b('0x11')]=_0x27fe45[_0x8e5b('0x12')];this['starttime']=_0x27fe45[_0x8e5b('0x13')];this['responsetime']=_0x27fe45[_0x8e5b('0x14')];this[_0x8e5b('0x15')]=_0x27fe45[_0x8e5b('0x15')];this['endtime']=this[_0x8e5b('0x15')];this[_0x8e5b('0x16')]=getSeconds(_0x27fe45[_0x8e5b('0x14')],_0x27fe45['starttime']);this['holdtime']=getSeconds(this[_0x8e5b('0x15')],_0x27fe45[_0x8e5b('0x14')]);this[_0x8e5b('0x17')]=0x0;this[_0x8e5b('0x18')]=_0x57e52f[_0x8e5b('0x18')];this[_0x8e5b('0x19')]=_0x57e52f[_0x8e5b('0x1a')];this[_0x8e5b('0x1b')]=_0x57e52f[_0x8e5b('0x1b')];this[_0x8e5b('0x1c')]=_0x27fe45[_0x8e5b('0x1c')];this[_0x8e5b('0x1d')]=_0x27fe45[_0x8e5b('0x1d')];this[_0x8e5b('0x1e')]=_0x27fe45[_0x8e5b('0x1e')];this[_0x8e5b('0x1f')]=_0x27fe45['recallme'];this[_0x8e5b('0x20')]=_0x27fe45['ContactId'];this[_0x8e5b('0x21')]=_0x27fe45['ListId'];this[_0x8e5b('0x22')]=_0x27fe45[_0x8e5b('0x22')];this[_0x8e5b('0x23')]=_0x27fe45[_0x8e5b('0x23')];this['CampaignId']=_0x27fe45[_0x8e5b('0x24')];this[_0x8e5b('0x25')]=_0x27fe45[_0x8e5b('0x25')]||'';this['originatecalleridname']=_0x27fe45[_0x8e5b('0x26')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 372c0fd..11e75a1 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(_0x5e6bcf,_0x3100e9){var _0x52ea12=function(_0x3a9abb){while(--_0x3a9abb){_0x5e6bcf['push'](_0x5e6bcf['shift']());}};_0x52ea12(++_0x3100e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x2825ae,_0x47550e){var _0x4601fe=function(_0x5c2346){while(--_0x5c2346){_0x2825ae['push'](_0x2825ae['shift']());}};_0x4601fe(++_0x47550e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 8b1c437..de0264e 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 _0x3c81=['checkTrunk','isValid','Trunk\x20Reachable','format','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','hangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend'];(function(_0x1752dc,_0x564306){var _0x216466=function(_0x58cad9){while(--_0x58cad9){_0x1752dc['push'](_0x1752dc['shift']());}};_0x216466(++_0x564306);}(_0x3c81,0x102));var _0x13c8=function(_0x293711,_0x1edabf){_0x293711=_0x293711-0x0;var _0x114b12=_0x3c81[_0x293711];return _0x114b12;};'use strict';var util=require(_0x13c8('0x0'));var _=require(_0x13c8('0x1'));var BPromise=require('bluebird');var uuid=require(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x13c8('0x4'));var ami=require(_0x13c8('0x5'));var rpcDb=require(_0x13c8('0x6'));var Channel=require(_0x13c8('0x7'));var ut=require(_0x13c8('0x8'));var Action=require(_0x13c8('0x9'));var faxAccount=require(_0x13c8('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x13c8('0xb'));function Fax(_0x4905c3){this[_0x13c8('0xc')]={};this[_0x13c8('0xd')]=_0x4905c3[_0x13c8('0xd')];this[_0x13c8('0xe')]=_0x4905c3[_0x13c8('0xe')];this[_0x13c8('0xf')]={};ami['on'](_0x13c8('0x10'),this[_0x13c8('0x11')][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x13'),this[_0x13c8('0x14')][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x15'),this[_0x13c8('0x16')]['bind'](this));ami['on'](_0x13c8('0x17'),this[_0x13c8('0x18')][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x19'),this['syncFaxStatus'][_0x13c8('0x12')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x13c8('0x1a'),this['syncHangup'][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x1b'),this[_0x13c8('0x1c')][_0x13c8('0x12')](this));}Fax['prototype'][_0x13c8('0x11')]=function(_0x408abc){if(_0x408abc[_0x13c8('0x1d')]===_0x13c8('0x1e')){for(var _0xce1ad2 in this[_0x13c8('0xd')]){if(this[_0x13c8('0xd')][_0x13c8('0x1f')](_0xce1ad2)){if(_0x408abc[_0x13c8('0x20')]===this[_0x13c8('0xd')][_0xce1ad2][_0x13c8('0x21')]){this['channels'][_0x408abc[_0x13c8('0x22')]]={};this[_0x13c8('0xc')][_0x408abc[_0x13c8('0x22')]][_0x13c8('0x23')]=_0x408abc['channel'];this[_0x13c8('0xc')][_0x408abc[_0x13c8('0x22')]]['id']=this[_0x13c8('0xd')][_0xce1ad2]['id'];this[_0x13c8('0xc')][_0x408abc[_0x13c8('0x22')]][_0x13c8('0x24')]=this['faxAccounts'][_0xce1ad2][_0x13c8('0x24')];logger[_0x13c8('0x25')](_0x408abc[_0x13c8('0x22')],_0x13c8('0x26'));}}}}if(this['actions'][_0x408abc[_0x13c8('0x22')]]){this[_0x13c8('0xc')][_0x408abc['uniqueid']]={};this['channels'][_0x408abc[_0x13c8('0x22')]][_0x13c8('0x23')]=_0x408abc['channel'];logger['info'](_0x408abc[_0x13c8('0x22')],_0x13c8('0x26'));}};Fax['prototype']['syncVarSet']=function(_0x196983){if(this['channels'][_0x196983['uniqueid']]){for(var _0x1c7dc4 in _0x196983[_0x13c8('0x27')]){if(_0x196983[_0x13c8('0x27')]['hasOwnProperty'](_0x1c7dc4)){this['channels'][_0x196983[_0x13c8('0x22')]][_0x1c7dc4]=_0x196983[_0x13c8('0x28')];}}}};Fax[_0x13c8('0x29')][_0x13c8('0x16')]=function(_0x138017){if(this[_0x13c8('0xc')][_0x138017[_0x13c8('0x22')]]){this['channels'][_0x138017[_0x13c8('0x22')]][_0x13c8('0x2a')]=_0x138017['channelstate'];this['channels'][_0x138017[_0x13c8('0x22')]][_0x13c8('0x2b')]=_0x138017['channelstatedesc'];}};Fax[_0x13c8('0x29')][_0x13c8('0x18')]=function(_0x47e0f8){if(this[_0x13c8('0xc')][_0x47e0f8[_0x13c8('0x22')]]){for(var _0xc4ae3a in _0x47e0f8[_0x13c8('0x27')]){if(_0x47e0f8[_0x13c8('0x27')][_0x13c8('0x1f')](_0xc4ae3a)){this[_0x13c8('0xc')][_0x47e0f8[_0x13c8('0x22')]][_0xc4ae3a]=_0x47e0f8['value'];}}}};Fax['prototype'][_0x13c8('0x2c')]=function(_0x37eaec){if(this['channels'][_0x37eaec[_0x13c8('0x22')]]){this['channels'][_0x37eaec[_0x13c8('0x22')]]['operation']=_0x37eaec[_0x13c8('0x2d')];this[_0x13c8('0xc')][_0x37eaec[_0x13c8('0x22')]][_0x13c8('0x2e')]=_0x37eaec[_0x13c8('0x2e')];this[_0x13c8('0xc')][_0x37eaec[_0x13c8('0x22')]]['localstationid']=_0x37eaec[_0x13c8('0x21')];this[_0x13c8('0xc')][_0x37eaec['uniqueid']][_0x13c8('0x2f')]=_0x37eaec[_0x13c8('0x2f')];logger[_0x13c8('0x25')](_0x37eaec['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x13c8('0x30')]=function(_0x2c8218){var _0x21671a=this;if(this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]]){var _0x412428=this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]]['id'];this[_0x13c8('0xc')][_0x2c8218['uniqueid']]['remotestationid']=_0x2c8218[_0x13c8('0x31')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x32')]=_0x2c8218['pagestransferred'];this[_0x13c8('0xc')][_0x2c8218['uniqueid']][_0x13c8('0x21')]=_0x2c8218[_0x13c8('0x21')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x33')]=_0x2c8218[_0x13c8('0x33')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x34')]=_0x2c8218[_0x13c8('0x34')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x2f')]=_0x2c8218[_0x13c8('0x2f')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x35')]=_0x2c8218[_0x13c8('0x35')];if(this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x32')]>0x0){tiff2pdf(_0x2c8218[_0x13c8('0x2f')],_0x13c8('0x36'),function(_0x4030ca){logger[_0x13c8('0x25')](_0x2c8218['uniqueid'],_0x13c8('0x37'),_0x4030ca[_0x13c8('0x38')]);attachment[_0x13c8('0x39')]({'name':path[_0x13c8('0x3a')](_0x2c8218[_0x13c8('0x2f')])['name'],'basename':path['parse'](_0x2c8218[_0x13c8('0x2f')])[_0x13c8('0x24')]+_0x13c8('0x3b'),'type':'application/pdf'})['then'](function(_0x4d783c){faxAccount[_0x13c8('0x3c')](_0x412428,{'from':_0x2c8218['calleridnum'],'mapKey':_0x13c8('0x4'),'body':path['parse'](_0x2c8218[_0x13c8('0x2f')])[_0x13c8('0x24')]+_0x13c8('0x3b'),'AttachmentId':_0x4d783c['id']})[_0x13c8('0x3d')](function(_0x3fcc4d){logger[_0x13c8('0x3e')](_0x2c8218['uniqueid'],_0x13c8('0x3f'),JSON[_0x13c8('0x40')](_0x3fcc4d));});})['catch'](function(_0x2b4e45){logger[_0x13c8('0x3e')](_0x2c8218[_0x13c8('0x22')],_0x13c8('0x41'),JSON[_0x13c8('0x40')](_0x2b4e45));});});}logger['info'](_0x2c8218[_0x13c8('0x22')],_0x13c8('0x41'));}};Fax[_0x13c8('0x29')][_0x13c8('0x1c')]=function(_0x185d18){if(this['actions'][_0x185d18[_0x13c8('0x22')]]){_[_0x13c8('0x42')](this[_0x13c8('0xc')][_0x185d18[_0x13c8('0x22')]],_[_0x13c8('0x43')](_0x185d18,[_0x13c8('0x44'),_0x13c8('0x45')]));}};function updateStatus(_0xa1596b){if(_0xa1596b[_0x13c8('0x46')]){faxMessage[_0x13c8('0x47')](_0xa1596b[_0x13c8('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x13c8('0x48')](function(_0x3b90e4){ut[_0x13c8('0x49')](_0x13c8('0x4a'),_0x3b90e4);})[_0x13c8('0x3d')](function(_0x11aa65){ut['logger'](_0x13c8('0x4b'),_0x11aa65);});}else{ut[_0x13c8('0x49')](_0x13c8('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x3d4863,_0x14a738,_0x55d353){var _0x199782=this;var _0x302fad={};if(_0x14a738){_0x302fad={'read':_0x14a738};}else{_0x302fad={'failMessage':_0x55d353};}if(this['actions'][_0x3d4863][_0x13c8('0x46')]){faxMessage['update'](this[_0x13c8('0xf')][_0x3d4863][_0x13c8('0x46')],_0x302fad)[_0x13c8('0x48')](function(_0x49b2f2){ut[_0x13c8('0x49')](_0x13c8('0x4d'),_0x49b2f2);})['catch'](function(_0x1c47ef){ut['logger'](_0x13c8('0x4e'),_0x1c47ef);})[_0x13c8('0x4f')](function(){delete _0x199782[_0x13c8('0xc')][_0x3d4863];delete _0x199782[_0x13c8('0xf')][_0x3d4863];});}else{ut[_0x13c8('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0x13c8('0xc')][_0x3d4863];delete this['actions'][_0x3d4863];}};Fax['prototype']['syncHangup']=function(_0x53c8f5){var _0x539c84=this;if(this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]){if(this[_0x13c8('0xf')][_0x53c8f5[_0x13c8('0x22')]]){this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]['id']=this[_0x13c8('0xf')][_0x53c8f5['uniqueid']]['id'];this['channels'][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x24')]=this[_0x13c8('0xf')][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x24')];}logger[_0x13c8('0x25')](_0x53c8f5[_0x13c8('0x22')],this[_0x13c8('0xf')][_0x53c8f5['uniqueid']]?_0x13c8('0x50'):_0x13c8('0x51'),JSON['stringify'](this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]));if(this[_0x13c8('0xf')][_0x53c8f5[_0x13c8('0x22')]]){if(this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x52')]>0x0&&this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x19')]===_0x13c8('0x53')){this[_0x13c8('0x54')](_0x53c8f5[_0x13c8('0x22')],!![]);}else{this[_0x13c8('0x54')](_0x53c8f5[_0x13c8('0x22')],![],this[_0x13c8('0xc')][_0x53c8f5['uniqueid']][_0x13c8('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]['faxstatusstring']:_0x13c8('0x56'));}}}};Fax[_0x13c8('0x29')]['send']=function(_0x38fd82){var _0x19330c=this;return new BPromise(function(_0x44c16d,_0x4c04dc){_0x19330c[_0x13c8('0x57')](_0x38fd82,_0x19330c[_0x13c8('0xd')][_0x38fd82[_0x13c8('0x58')]])[_0x13c8('0x48')](function(_0x179d56){ut[_0x13c8('0x49')](_0x13c8('0x59'),_0x179d56);_0x44c16d(ut['message'](_0x13c8('0x5a')));})[_0x13c8('0x3d')](function(_0x223cfd){ut[_0x13c8('0x49')](_0x13c8('0x5b'),_0x223cfd);updateStatus(_0x38fd82);_0x4c04dc(ut[_0x13c8('0x38')]('Fax\x20failed'));});});};Fax[_0x13c8('0x29')][_0x13c8('0x5c')]=function(_0x165ed0){var _0x541f00=this;return new BPromise(function(_0x54241e,_0x916946){var _0x34a690=_0x541f00[_0x13c8('0x5d')](_0x541f00[_0x13c8('0xd')][_0x165ed0[_0x13c8('0x58')]]['Trunk'],_0x165ed0);if(_0x34a690[_0x13c8('0x5e')]){_0x54241e(ut[_0x13c8('0x38')](_0x13c8('0x5f')));}else{_0x916946(ut[_0x13c8('0x38')](_0x34a690['message']));}});};function originate(_0x16b409,_0x2d552d,_0x258447){return new BPromise(function(_0x308482,_0x179a86){if(_0x258447){var _0x251cbb=util[_0x13c8('0x60')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x13c8('0x3a')](_0x16b409[_0x13c8('0x61')])[_0x13c8('0x24')],_0x16b409['path']);gs[_0x13c8('0x62')](_0x251cbb)[_0x13c8('0x48')](function(){_0x16b409['path']=util['format'](_0x13c8('0x63'),path['parse'](_0x16b409[_0x13c8('0x61')])['dir'],path[_0x13c8('0x3a')](_0x16b409[_0x13c8('0x61')])[_0x13c8('0x24')]);_0x2d552d[_0x13c8('0x64')]=_0x16b409[_0x13c8('0x61')];ut['logger'](_0x13c8('0x65'),'');ami[_0x13c8('0x66')](ut['variablesAction'](_0x16b409,_0x2d552d))[_0x13c8('0x48')](function(_0x7dbff0){_0x308482(_0x7dbff0);})[_0x13c8('0x3d')](function(_0x34e21a){_0x179a86(_0x34e21a);});})[_0x13c8('0x3d')](function(_0x2a4315){_0x179a86(_0x2a4315);});}else{ami[_0x13c8('0x66')](ut[_0x13c8('0x67')](_0x16b409,_0x2d552d))[_0x13c8('0x48')](function(_0x155b93){_0x308482(_0x155b93);})['catch'](function(_0xe58f91){_0x179a86(_0xe58f91);});}});}Fax[_0x13c8('0x29')]['execOriginate']=function(_0x58d5b2,_0x363406){var _0x1e119c=this;return new BPromise(function(_0xa70841,_0x19ce22){var _0x13df22=uuid['v4']();var _0x1a92d6=ut['addVariables'](_0x58d5b2,_0x363406);_0x1e119c[_0x13c8('0xf')][_0x13df22]=new Action(_0x13df22,_0x363406,_0x58d5b2);var _0x368f45=_0x1e119c[_0x13c8('0xf')][_0x13df22];if(path[_0x13c8('0x3a')](_0x58d5b2[_0x13c8('0x61')])['ext']===_0x13c8('0x3b')){originate(_0x368f45,_0x1a92d6,!![])[_0x13c8('0x48')](function(_0x564cc9){_0xa70841(_0x564cc9);})[_0x13c8('0x3d')](function(_0xdea3e6){_0x19ce22(_0xdea3e6);});}else{originate(_0x368f45,_0x1a92d6,![])['then'](function(_0xd4b67a){_0xa70841(_0xd4b67a);})['catch'](function(_0x461169){_0x19ce22(_0x461169);});}});};Fax['prototype'][_0x13c8('0x68')]=function(_0x260139){return!_[_0x13c8('0x69')](_0x260139)&&!_['isNil'](_0x260139[_0x13c8('0x24')])&&!_['isNil'](_0x260139['active'])&&_0x260139[_0x13c8('0x6a')]&&!_[_0x13c8('0x69')](this[_0x13c8('0xe')][util[_0x13c8('0x60')]('SIP/%s',_0x260139['name'])])&&!_[_0x13c8('0x69')](this['trunks'][util['format'](_0x13c8('0x6b'),_0x260139[_0x13c8('0x24')])][_0x13c8('0x2e')])&&(this[_0x13c8('0xe')][util['format'](_0x13c8('0x6b'),_0x260139['name'])]['status']===_0x13c8('0x6c')||this[_0x13c8('0xe')][util[_0x13c8('0x60')](_0x13c8('0x6b'),_0x260139[_0x13c8('0x24')])]['status']===_0x13c8('0x6d'));};Fax['prototype'][_0x13c8('0x5d')]=function(_0x4f56ef,_0x5277a2){if(!this[_0x13c8('0x68')](_0x4f56ef)){ut['logger'](_0x13c8('0x6e'),_[_0x13c8('0x69')](_0x4f56ef)?'':_0x4f56ef['name']+_0x13c8('0x6f'));return{'isValid':![],'message':_0x13c8('0x70')};}if(_[_0x13c8('0x69')](_0x5277a2[_0x13c8('0x4')])){ut[_0x13c8('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x13c8('0x40')](_0x5277a2));return{'isValid':![],'message':_0x13c8('0x71')};}if(_[_0x13c8('0x69')](_0x5277a2[_0x13c8('0x61')])){ut[_0x13c8('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x5277a2));return{'isValid':![],'message':_0x13c8('0x72')};}return{'isValid':!![],'message':_0x13c8('0x73')};};module[_0x13c8('0x74')]=Fax; \ No newline at end of file +var _0x1339=['SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','exten','channel','uniqueid','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring'];(function(_0x5bc749,_0x3769a8){var _0x507c93=function(_0x192ab7){while(--_0x192ab7){_0x5bc749['push'](_0x5bc749['shift']());}};_0x507c93(++_0x3769a8);}(_0x1339,0x1ed));var _0x9133=function(_0x30dd38,_0x4301fe){_0x30dd38=_0x30dd38-0x0;var _0xc8717b=_0x1339[_0x30dd38];return _0xc8717b;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x9133('0x0'));var uuid=require(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var path=require(_0x9133('0x3'));var tiff2pdf=require(_0x9133('0x4'));var gs=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var ami=require('../ami');var rpcDb=require(_0x9133('0x8'));var Channel=require(_0x9133('0x9'));var ut=require(_0x9133('0xa'));var Action=require('./action');var faxAccount=require(_0x9133('0xb'));var attachment=require(_0x9133('0xc'));var faxMessage=require(_0x9133('0xd'));function Fax(_0x431a55){this[_0x9133('0xe')]={};this[_0x9133('0xf')]=_0x431a55[_0x9133('0xf')];this[_0x9133('0x10')]=_0x431a55[_0x9133('0x10')];this[_0x9133('0x11')]={};ami['on']('newchannel',this[_0x9133('0x12')][_0x9133('0x13')](this));ami['on'](_0x9133('0x14'),this[_0x9133('0x15')][_0x9133('0x13')](this));ami['on'](_0x9133('0x16'),this['syncNewState'][_0x9133('0x13')](this));ami['on'](_0x9133('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0x9133('0x18'),this['syncFaxStatus'][_0x9133('0x13')](this));ami['on'](_0x9133('0x19'),this[_0x9133('0x1a')][_0x9133('0x13')](this));ami['on'](_0x9133('0x1b'),this[_0x9133('0x1c')]['bind'](this));ami['on'](_0x9133('0x1d'),this[_0x9133('0x1e')]['bind'](this));}Fax[_0x9133('0x1f')][_0x9133('0x12')]=function(_0x3b39ec){if(_0x3b39ec[_0x9133('0x20')]==='from-voip-provider'){for(var _0x1f3484 in this['faxAccounts']){if(this[_0x9133('0xf')]['hasOwnProperty'](_0x1f3484)){if(_0x3b39ec[_0x9133('0x21')]===this[_0x9133('0xf')][_0x1f3484]['localstationid']){this[_0x9133('0xe')][_0x3b39ec['uniqueid']]={};this[_0x9133('0xe')][_0x3b39ec['uniqueid']]['channel']=_0x3b39ec[_0x9133('0x22')];this['channels'][_0x3b39ec[_0x9133('0x23')]]['id']=this['faxAccounts'][_0x1f3484]['id'];this['channels'][_0x3b39ec['uniqueid']][_0x9133('0x24')]=this[_0x9133('0xf')][_0x1f3484]['name'];logger[_0x9133('0x25')](_0x3b39ec[_0x9133('0x23')],_0x9133('0x26'));}}}}if(this[_0x9133('0x11')][_0x3b39ec['uniqueid']]){this[_0x9133('0xe')][_0x3b39ec['uniqueid']]={};this[_0x9133('0xe')][_0x3b39ec[_0x9133('0x23')]][_0x9133('0x22')]=_0x3b39ec[_0x9133('0x22')];logger[_0x9133('0x25')](_0x3b39ec[_0x9133('0x23')],_0x9133('0x26'));}};Fax[_0x9133('0x1f')][_0x9133('0x15')]=function(_0x46050b){if(this['channels'][_0x46050b['uniqueid']]){for(var _0x477bf1 in _0x46050b[_0x9133('0x27')]){if(_0x46050b[_0x9133('0x27')][_0x9133('0x28')](_0x477bf1)){this['channels'][_0x46050b['uniqueid']][_0x477bf1]=_0x46050b[_0x9133('0x29')];}}}};Fax[_0x9133('0x1f')][_0x9133('0x2a')]=function(_0x26d351){if(this[_0x9133('0xe')][_0x26d351[_0x9133('0x23')]]){this['channels'][_0x26d351['uniqueid']]['channelstate']=_0x26d351[_0x9133('0x2b')];this['channels'][_0x26d351[_0x9133('0x23')]][_0x9133('0x2c')]=_0x26d351['channelstatedesc'];}};Fax[_0x9133('0x1f')]['syncNewExten']=function(_0xf0aec4){if(this[_0x9133('0xe')][_0xf0aec4[_0x9133('0x23')]]){for(var _0x5f1de2 in _0xf0aec4[_0x9133('0x27')]){if(_0xf0aec4[_0x9133('0x27')][_0x9133('0x28')](_0x5f1de2)){this['channels'][_0xf0aec4[_0x9133('0x23')]][_0x5f1de2]=_0xf0aec4[_0x9133('0x29')];}}}};Fax[_0x9133('0x1f')]['syncFaxStatus']=function(_0x37667e){if(this[_0x9133('0xe')][_0x37667e[_0x9133('0x23')]]){this[_0x9133('0xe')][_0x37667e['uniqueid']][_0x9133('0x2d')]=_0x37667e[_0x9133('0x2d')];this['channels'][_0x37667e[_0x9133('0x23')]][_0x9133('0x2e')]=_0x37667e[_0x9133('0x2e')];this[_0x9133('0xe')][_0x37667e[_0x9133('0x23')]][_0x9133('0x2f')]=_0x37667e[_0x9133('0x2f')];this[_0x9133('0xe')][_0x37667e[_0x9133('0x23')]][_0x9133('0x30')]=_0x37667e[_0x9133('0x30')];logger['info'](_0x37667e[_0x9133('0x23')],_0x9133('0x31'));}};Fax['prototype'][_0x9133('0x1a')]=function(_0x3a2d1f){var _0x2bc3b3=this;if(this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]]){var _0x3d24f4=this['channels'][_0x3a2d1f['uniqueid']]['id'];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x32')]=_0x3a2d1f[_0x9133('0x32')];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x33')]=_0x3a2d1f[_0x9133('0x33')];this[_0x9133('0xe')][_0x3a2d1f['uniqueid']][_0x9133('0x2f')]=_0x3a2d1f[_0x9133('0x2f')];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x34')]=_0x3a2d1f['resolution'];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x35')]=_0x3a2d1f[_0x9133('0x35')];this['channels'][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x30')]=_0x3a2d1f[_0x9133('0x30')];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x36')]=_0x3a2d1f[_0x9133('0x36')];if(this['channels'][_0x3a2d1f[_0x9133('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x3a2d1f['filename'],_0x9133('0x37'),function(_0x1d564f){logger[_0x9133('0x25')](_0x3a2d1f[_0x9133('0x23')],_0x9133('0x38'),_0x1d564f[_0x9133('0x39')]);attachment[_0x9133('0x3a')]({'name':path[_0x9133('0x3b')](_0x3a2d1f[_0x9133('0x30')])['name'],'basename':path[_0x9133('0x3b')](_0x3a2d1f[_0x9133('0x30')])[_0x9133('0x24')]+'.pdf','type':'application/pdf'})[_0x9133('0x3c')](function(_0x2311aa){faxAccount['notify'](_0x3d24f4,{'from':_0x3a2d1f[_0x9133('0x36')],'mapKey':_0x9133('0x7'),'body':path[_0x9133('0x3b')](_0x3a2d1f[_0x9133('0x30')])[_0x9133('0x24')]+'.pdf','AttachmentId':_0x2311aa['id']})[_0x9133('0x3d')](function(_0x4423b4){logger[_0x9133('0x3e')](_0x3a2d1f['uniqueid'],_0x9133('0x3f'),JSON[_0x9133('0x40')](_0x4423b4));});})['catch'](function(_0x5d31a7){logger[_0x9133('0x3e')](_0x3a2d1f[_0x9133('0x23')],_0x9133('0x41'),JSON[_0x9133('0x40')](_0x5d31a7));});});}logger[_0x9133('0x25')](_0x3a2d1f[_0x9133('0x23')],_0x9133('0x41'));}};Fax[_0x9133('0x1f')][_0x9133('0x1e')]=function(_0xf07fbb){if(this[_0x9133('0x11')][_0xf07fbb[_0x9133('0x23')]]){_['merge'](this['channels'][_0xf07fbb[_0x9133('0x23')]],_['pick'](_0xf07fbb,[_0x9133('0x42'),_0x9133('0x43')]));}};function updateStatus(_0x6fbb11){if(_0x6fbb11[_0x9133('0x44')]){faxMessage['update'](_0x6fbb11[_0x9133('0x44')],{'failMessage':_0x9133('0x45')})[_0x9133('0x3c')](function(_0x5d8db4){ut[_0x9133('0x46')](_0x9133('0x47'),_0x5d8db4);})[_0x9133('0x3d')](function(_0x4ad8c5){ut[_0x9133('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x4ad8c5);});}else{ut[_0x9133('0x46')](_0x9133('0x48'));}}Fax[_0x9133('0x1f')][_0x9133('0x49')]=function(_0x4f58fe,_0x4a346c,_0x2f09f6){var _0x213e3d=this;var _0x20b1fe={};if(_0x4a346c){_0x20b1fe={'read':_0x4a346c};}else{_0x20b1fe={'failMessage':_0x2f09f6};}if(this[_0x9133('0x11')][_0x4f58fe][_0x9133('0x44')]){faxMessage['update'](this['actions'][_0x4f58fe][_0x9133('0x44')],_0x20b1fe)[_0x9133('0x3c')](function(_0x4abefd){ut[_0x9133('0x46')](_0x9133('0x4a'),_0x4abefd);})['catch'](function(_0x508303){ut['logger'](_0x9133('0x4b'),_0x508303);})['finally'](function(){delete _0x213e3d[_0x9133('0xe')][_0x4f58fe];delete _0x213e3d[_0x9133('0x11')][_0x4f58fe];});}else{ut[_0x9133('0x46')](_0x9133('0x4c'));delete this['channels'][_0x4f58fe];delete this[_0x9133('0x11')][_0x4f58fe];}};Fax['prototype'][_0x9133('0x1c')]=function(_0x3d7cf0){var _0x46d348=this;if(this[_0x9133('0xe')][_0x3d7cf0[_0x9133('0x23')]]){if(this[_0x9133('0x11')][_0x3d7cf0['uniqueid']]){this['channels'][_0x3d7cf0['uniqueid']]['id']=this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]]['id'];this[_0x9133('0xe')][_0x3d7cf0['uniqueid']][_0x9133('0x24')]=this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]][_0x9133('0x24')];}logger[_0x9133('0x25')](_0x3d7cf0[_0x9133('0x23')],this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]]?'\x20hangup\x20sendFile\x20':_0x9133('0x4d'),JSON['stringify'](this[_0x9133('0xe')][_0x3d7cf0['uniqueid']]));if(this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]]){if(this['channels'][_0x3d7cf0['uniqueid']][_0x9133('0x4e')]>0x0&&this[_0x9133('0xe')][_0x3d7cf0[_0x9133('0x23')]][_0x9133('0x18')]===_0x9133('0x4f')){this[_0x9133('0x49')](_0x3d7cf0[_0x9133('0x23')],!![]);}else{this[_0x9133('0x49')](_0x3d7cf0[_0x9133('0x23')],![],this[_0x9133('0xe')][_0x3d7cf0[_0x9133('0x23')]]['faxstatusstring']?_0x9133('0x50')+this['channels'][_0x3d7cf0[_0x9133('0x23')]][_0x9133('0x51')]:_0x9133('0x52'));}}}};Fax[_0x9133('0x1f')][_0x9133('0x53')]=function(_0x52d4c8){var _0x35bc72=this;return new BPromise(function(_0x1f0ca7,_0x19339e){_0x35bc72[_0x9133('0x54')](_0x52d4c8,_0x35bc72['faxAccounts'][_0x52d4c8[_0x9133('0x55')]])[_0x9133('0x3c')](function(_0xcfcae2){ut[_0x9133('0x46')]('[Fax][execOriginate][success]',_0xcfcae2);_0x1f0ca7(ut['message'](_0x9133('0x56')));})[_0x9133('0x3d')](function(_0x23e4d1){ut[_0x9133('0x46')](_0x9133('0x57'),_0x23e4d1);updateStatus(_0x52d4c8);_0x19339e(ut[_0x9133('0x39')]('Fax\x20failed'));});});};Fax[_0x9133('0x1f')][_0x9133('0x58')]=function(_0x2576c8){var _0x22611b=this;return new BPromise(function(_0x57e4e9,_0x47342a){var _0x54ddcd=_0x22611b[_0x9133('0x59')](_0x22611b[_0x9133('0xf')][_0x2576c8[_0x9133('0x55')]][_0x9133('0x5a')],_0x2576c8);if(_0x54ddcd[_0x9133('0x5b')]){_0x57e4e9(ut[_0x9133('0x39')](_0x9133('0x5c')));}else{_0x47342a(ut[_0x9133('0x39')](_0x54ddcd['message']));}});};function originate(_0x23bd83,_0x1fcd01,_0x10afd7){return new BPromise(function(_0x152283,_0x406861){if(_0x10afd7){var _0x4e0afe=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x9133('0x3b')](_0x23bd83[_0x9133('0x3')])[_0x9133('0x24')],_0x23bd83['path']);gs[_0x9133('0x5d')](_0x4e0afe)[_0x9133('0x3c')](function(){_0x23bd83[_0x9133('0x3')]=util[_0x9133('0x5e')](_0x9133('0x5f'),path[_0x9133('0x3b')](_0x23bd83[_0x9133('0x3')])[_0x9133('0x60')],path['parse'](_0x23bd83[_0x9133('0x3')])[_0x9133('0x24')]);_0x1fcd01['XMF-PATH']=_0x23bd83[_0x9133('0x3')];ut['logger'](_0x9133('0x61'),'');ami[_0x9133('0x62')](ut[_0x9133('0x63')](_0x23bd83,_0x1fcd01))[_0x9133('0x3c')](function(_0x353a37){_0x152283(_0x353a37);})['catch'](function(_0x2d6f8e){_0x406861(_0x2d6f8e);});})[_0x9133('0x3d')](function(_0x23b4ac){_0x406861(_0x23b4ac);});}else{ami[_0x9133('0x62')](ut['variablesAction'](_0x23bd83,_0x1fcd01))[_0x9133('0x3c')](function(_0x24c70d){_0x152283(_0x24c70d);})[_0x9133('0x3d')](function(_0x208dd3){_0x406861(_0x208dd3);});}});}Fax[_0x9133('0x1f')][_0x9133('0x54')]=function(_0x1fd7f5,_0x156d20){var _0x650c7d=this;return new BPromise(function(_0x31bda5,_0x37297a){var _0x4c3dc7=uuid['v4']();var _0x408456=ut[_0x9133('0x64')](_0x1fd7f5,_0x156d20);_0x650c7d[_0x9133('0x11')][_0x4c3dc7]=new Action(_0x4c3dc7,_0x156d20,_0x1fd7f5);var _0x12ae5f=_0x650c7d['actions'][_0x4c3dc7];if(path[_0x9133('0x3b')](_0x1fd7f5['path'])[_0x9133('0x65')]===_0x9133('0x66')){originate(_0x12ae5f,_0x408456,!![])[_0x9133('0x3c')](function(_0x530984){_0x31bda5(_0x530984);})[_0x9133('0x3d')](function(_0x163487){_0x37297a(_0x163487);});}else{originate(_0x12ae5f,_0x408456,![])[_0x9133('0x3c')](function(_0x52d940){_0x31bda5(_0x52d940);})[_0x9133('0x3d')](function(_0x3275b3){_0x37297a(_0x3275b3);});}});};Fax['prototype'][_0x9133('0x67')]=function(_0x12094c){return!_[_0x9133('0x68')](_0x12094c)&&!_['isNil'](_0x12094c[_0x9133('0x24')])&&!_['isNil'](_0x12094c[_0x9133('0x69')])&&_0x12094c[_0x9133('0x69')]&&!_[_0x9133('0x68')](this['trunks'][util[_0x9133('0x5e')]('SIP/%s',_0x12094c[_0x9133('0x24')])])&&!_[_0x9133('0x68')](this[_0x9133('0x10')][util[_0x9133('0x5e')](_0x9133('0x6a'),_0x12094c[_0x9133('0x24')])][_0x9133('0x2e')])&&(this[_0x9133('0x10')][util['format'](_0x9133('0x6a'),_0x12094c[_0x9133('0x24')])][_0x9133('0x2e')]===_0x9133('0x6b')||this[_0x9133('0x10')][util['format'](_0x9133('0x6a'),_0x12094c[_0x9133('0x24')])][_0x9133('0x2e')]===_0x9133('0x6c'));};Fax['prototype'][_0x9133('0x59')]=function(_0x580741,_0x29a1d9){if(!this[_0x9133('0x67')](_0x580741)){ut[_0x9133('0x46')](_0x9133('0x6d'),_['isNil'](_0x580741)?'':_0x580741[_0x9133('0x24')]+_0x9133('0x6e'));return{'isValid':![],'message':_0x9133('0x6f')};}if(_[_0x9133('0x68')](_0x29a1d9[_0x9133('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x29a1d9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x9133('0x68')](_0x29a1d9[_0x9133('0x3')])){ut[_0x9133('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x9133('0x40')](_0x29a1d9));return{'isValid':![],'message':_0x9133('0x70')};}return{'isValid':!![],'message':_0x9133('0x71')};};module[_0x9133('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 194784d..0c395de 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 _0x6f71=['notify','resolve','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x6f71,0x18f));var _0x16f7=function(_0x43b264,_0x4a9426){_0x43b264=_0x43b264-0x0;var _0x2d07c1=_0x6f71[_0x43b264];return _0x2d07c1;};'use strict';var util=require(_0x16f7('0x0'));var BPromise=require(_0x16f7('0x1'));var logger=require(_0x16f7('0x2'))(_0x16f7('0x3'));var _=require(_0x16f7('0x4'));var faxAccount=require(_0x16f7('0x5'));function loggerCatch(_0x48f7be){return function(_0x1daeac){logger['error'](_0x48f7be,util['inspect'](_0x1daeac,{'showHidden':![],'depth':null}));};}exports[_0x16f7('0x6')]=function(_0x2c90ab,_0x1efe7c){return BPromise[_0x16f7('0x7')]()['then'](faxAccount[_0x16f7('0x6')](_0x2c90ab,_0x1efe7c))['catch'](loggerCatch(_0x16f7('0x8')));}; \ No newline at end of file +var _0x7a7a=['notify','resolve','then','catch','[Notify]\x20','../../../config/logger','lodash','../rpc/faxAccount','inspect'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a7a,0x95));var _0xa7a7=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x7a7a[_0x363ef8];return _0x148822;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xa7a7('0x0'))('preview');var _=require(_0xa7a7('0x1'));var faxAccount=require(_0xa7a7('0x2'));function loggerCatch(_0x23552f){return function(_0x297cc6){logger['error'](_0x23552f,util[_0xa7a7('0x3')](_0x297cc6,{'showHidden':![],'depth':null}));};}exports[_0xa7a7('0x4')]=function(_0x30deef,_0x32a51c){return BPromise[_0xa7a7('0x5')]()[_0xa7a7('0x6')](faxAccount[_0xa7a7('0x4')](_0x30deef,_0x32a51c))[_0xa7a7('0x7')](loggerCatch(_0xa7a7('0x8')));}; \ 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 27030e2..15ea9f8 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 _0x2c3d=['\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x3bbeaf,_0x2f2b36){var _0x4930d4=function(_0x2de566){while(--_0x2de566){_0x3bbeaf['push'](_0x3bbeaf['shift']());}};_0x4930d4(++_0x2f2b36);}(_0x2c3d,0x17d));var _0xd2c3=function(_0x39c126,_0x52834a){_0x39c126=_0x39c126-0x0;var _0x2d2c93=_0x2c3d[_0x39c126];return _0x2d2c93;};'use strict';var util=require(_0xd2c3('0x0'));var logger=require(_0xd2c3('0x1'))(_0xd2c3('0x2'));var BPromise=require(_0xd2c3('0x3'));var exec=require(_0xd2c3('0x4'))[_0xd2c3('0x5')];exports[_0xd2c3('0x6')]=function(_0x3b7901){return new BPromise(function(_0x3f0afd,_0x46546f){exec(_0x3b7901,function(_0x14481a,_0x281f8d,_0x54677e){logger[_0xd2c3('0x7')](_0xd2c3('0x8'),_0x281f8d);if(_0x14481a){logger[_0xd2c3('0x7')](_0xd2c3('0x8'),_0xd2c3('0x9'),util['inspect'](_0x14481a,{'showHidden':![],'depth':null}),_0x281f8d,_0x54677e);_0x46546f(_0x14481a);}_0x3f0afd(_0x281f8d);});});}; \ No newline at end of file +var _0x9cec=['../../../../config/logger','fax','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9cec,0x11f));var _0xc9ce=function(_0x4db414,_0x5769ea){_0x4db414=_0x4db414-0x0;var _0x12cb55=_0x9cec[_0x4db414];return _0x12cb55;};'use strict';var util=require(_0xc9ce('0x0'));var logger=require(_0xc9ce('0x1'))(_0xc9ce('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xc9ce('0x3')];exports[_0xc9ce('0x4')]=function(_0x35f9f2){return new BPromise(function(_0x12d8a4,_0x1ed32c){exec(_0x35f9f2,function(_0x3cf587,_0x2bddf7,_0x45317a){logger[_0xc9ce('0x5')](_0xc9ce('0x6'),_0x2bddf7);if(_0x3cf587){logger[_0xc9ce('0x5')]('Exec\x20gs',_0xc9ce('0x7'),util[_0xc9ce('0x8')](_0x3cf587,{'showHidden':![],'depth':null}),_0x2bddf7,_0x45317a);_0x1ed32c(_0x3cf587);}_0x12d8a4(_0x2bddf7);});});}; \ 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 42aa097..7746392 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 _0x55d0=['\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','../../../../config/logger','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','format'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55d0,0x1ce));var _0x055d=function(_0xd4d369,_0x4f6ad2){_0xd4d369=_0xd4d369-0x0;var _0x293e5d=_0x55d0[_0xd4d369];return _0x293e5d;};'use strict';var util=require(_0x055d('0x0'));var _=require(_0x055d('0x1'));var moment=require('moment');var logger=require(_0x055d('0x2'))(_0x055d('0x3'));exports[_0x055d('0x4')]=function(_0x2551b5){return{'message':_0x2551b5};};exports[_0x055d('0x5')]=function(_0x3dcb7c,_0x3d9d11){logger[_0x055d('0x6')](_0x3dcb7c,util['inspect'](_0x3d9d11,{'showHidden':![],'depth':null}));};exports[_0x055d('0x7')]=function(_0x25e0c5,_0x5a9014){var _0x429055={'XMF-ECM':_0x5a9014[_0x055d('0x8')],'XMF-HEADERINFO':_0x5a9014[_0x055d('0x9')],'XMF-MINRATE':_0x5a9014[_0x055d('0xa')],'XMF-MAXRATE':_0x5a9014[_0x055d('0xb')],'XMF-MODEM':util[_0x055d('0xc')](_0x055d('0xd'),_0x5a9014[_0x055d('0xe')]),'XMF-GATEWAY':_0x5a9014['gateway'],'XMF-FAXDETECT':_0x5a9014[_0x055d('0xf')],'XMF-T38TIMEOUT':_0x5a9014[_0x055d('0x10')],'XMF-LOCALSTATIONID':_0x5a9014[_0x055d('0x11')],'XMF-PATH':_0x25e0c5[_0x055d('0x12')]};return _0x429055;};exports[_0x055d('0x13')]=function(_0xcced89,_0x401995){return{'actionid':_0xcced89['uniqueid'],'action':_0x055d('0x14'),'channel':_0xcced89[_0x055d('0x15')],'Exten':_0x055d('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0x055d('0xc')](_0x055d('0x17'),_0xcced89[_0x055d('0x9')]?_0xcced89['headerinfo']:'',_0xcced89[_0x055d('0x11')]),'variable':_0x401995,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xcced89[_0x055d('0x18')]};}; \ No newline at end of file +var _0x575f=['localstationid','util','moment','fax','message','inspect','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format'];(function(_0x3166f6,_0x4f0867){var _0xaf5375=function(_0x13bc8d){while(--_0x13bc8d){_0x3166f6['push'](_0x3166f6['shift']());}};_0xaf5375(++_0x4f0867);}(_0x575f,0xb9));var _0xf575=function(_0x14e0ea,_0x21074d){_0x14e0ea=_0x14e0ea-0x0;var _0xc9b3af=_0x575f[_0x14e0ea];return _0xc9b3af;};'use strict';var util=require(_0xf575('0x0'));var _=require('lodash');var moment=require(_0xf575('0x1'));var logger=require('../../../../config/logger')(_0xf575('0x2'));exports[_0xf575('0x3')]=function(_0x160451){return{'message':_0x160451};};exports['logger']=function(_0x4a0a92,_0x1e71f8){logger['info'](_0x4a0a92,util[_0xf575('0x4')](_0x1e71f8,{'showHidden':![],'depth':null}));};exports[_0xf575('0x5')]=function(_0x152d57,_0x1279d0){var _0xc70d09={'XMF-ECM':_0x1279d0[_0xf575('0x6')],'XMF-HEADERINFO':_0x1279d0[_0xf575('0x7')],'XMF-MINRATE':_0x1279d0['minrate'],'XMF-MAXRATE':_0x1279d0[_0xf575('0x8')],'XMF-MODEM':util['format'](_0xf575('0x9'),_0x1279d0[_0xf575('0xa')]),'XMF-GATEWAY':_0x1279d0[_0xf575('0xb')],'XMF-FAXDETECT':_0x1279d0[_0xf575('0xc')],'XMF-T38TIMEOUT':_0x1279d0[_0xf575('0xd')],'XMF-LOCALSTATIONID':_0x1279d0['localstationid'],'XMF-PATH':_0x152d57[_0xf575('0xe')]};return _0xc70d09;};exports[_0xf575('0xf')]=function(_0x186fe8,_0x33c833){return{'actionid':_0x186fe8[_0xf575('0x10')],'action':_0xf575('0x11'),'channel':_0x186fe8[_0xf575('0x12')],'Exten':_0xf575('0x13'),'Context':_0xf575('0x14'),'Priority':'1','callerid':util[_0xf575('0x15')]('\x22%s\x22\x20<%s>',_0x186fe8[_0xf575('0x7')]?_0x186fe8[_0xf575('0x7')]:'',_0x186fe8[_0xf575('0x16')]),'variable':_0x33c833,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x186fe8[_0xf575('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 912ee93..c871e46 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 _0x567a=['getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','getAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates'];(function(_0x35c561,_0x1ade37){var _0x3c3f89=function(_0x26c733){while(--_0x26c733){_0x35c561['push'](_0x35c561['shift']());}};_0x3c3f89(++_0x1ade37);}(_0x567a,0xf6));var _0xa567=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x567a[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xa567('0x0'));var util=require(_0xa567('0x1'));var moment=require(_0xa567('0x2'));var server=require(_0xa567('0x3'));var Realtime=require(_0xa567('0x4'));var Report=require('./report');var Acw=require(_0xa567('0x5'));var Trigger=require(_0xa567('0x6'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0xa567('0x7'));var user=require(_0xa567('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xa567('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xa567('0xa'));var template=require(_0xa567('0xb'));var cmHopperHistory=require(_0xa567('0xc'));var campaign=require(_0xa567('0xd'));var voiceExtension=require(_0xa567('0xe'));var faxAccount=require(_0xa567('0xf'));var zendesk=require(_0xa567('0x10'));var salesforce=require(_0xa567('0x11'));var sugarcrm=require(_0xa567('0x12'));var freshdesk=require(_0xa567('0x13'));var desk=require(_0xa567('0x14'));var zoho=require(_0xa567('0x15'));var vtiger=require(_0xa567('0x16'));var freshsales=require(_0xa567('0x17'));var servicenow=require(_0xa567('0x18'));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(_0xa567('0x19'))(_0xa567('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa567('0x1b')](_0xa567('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa567('0x1b')](_0xa567('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa567('0x1d')]()[_0xa567('0x1e')](user[_0xa567('0x1f')]())[_0xa567('0x1e')](realtime['initAgents']())[_0xa567('0x1e')](user['getTelephones']())['then'](realtime[_0xa567('0x20')]())[_0xa567('0x1e')](trunk[_0xa567('0x21')]())[_0xa567('0x1e')](realtime[_0xa567('0x22')]())[_0xa567('0x1e')](voiceQueue['getVoiceQueues']())[_0xa567('0x1e')](realtime[_0xa567('0x23')]())['then'](trigger['getTriggers']())[_0xa567('0x1e')](realtime[_0xa567('0x24')]())[_0xa567('0x1e')](template[_0xa567('0x25')]())['then'](realtime['initTemplates']())[_0xa567('0x1e')](zendesk[_0xa567('0x26')]())[_0xa567('0x1e')](realtime[_0xa567('0x27')]())[_0xa567('0x1e')](salesforce[_0xa567('0x28')]())['then'](realtime['initSalesforceAccounts']())[_0xa567('0x1e')](sugarcrm[_0xa567('0x29')]())[_0xa567('0x1e')](realtime[_0xa567('0x2a')]())['then'](freshdesk[_0xa567('0x2b')]())['then'](realtime[_0xa567('0x2c')]())[_0xa567('0x1e')](desk['getDeskAccounts']())[_0xa567('0x1e')](realtime[_0xa567('0x2d')]())[_0xa567('0x1e')](zoho[_0xa567('0x2e')]())['then'](realtime[_0xa567('0x2f')]())[_0xa567('0x1e')](vtiger[_0xa567('0x30')]())[_0xa567('0x1e')](realtime[_0xa567('0x31')]())[_0xa567('0x1e')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xa567('0x32')]())[_0xa567('0x1e')](servicenow[_0xa567('0x33')]())[_0xa567('0x1e')](realtime[_0xa567('0x34')]())[_0xa567('0x1e')](dynamics365[_0xa567('0x35')]())[_0xa567('0x1e')](realtime[_0xa567('0x36')]())[_0xa567('0x1e')](campaign[_0xa567('0x37')]())[_0xa567('0x1e')](realtime['initCampaigns']())[_0xa567('0x1e')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xa567('0x38')]())[_0xa567('0x1e')](faxAccount['getFaxAccounts']())[_0xa567('0x1e')](realtime[_0xa567('0x39')]())[_0xa567('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xa567('0x1e')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xa567('0x3a')]())[_0xa567('0x1e')](cmHopperHistory[_0xa567('0x3b')]())[_0xa567('0x1e')](realtime[_0xa567('0x3c')]())[_0xa567('0x1e')](cmHopperHistory[_0xa567('0x3d')]())[_0xa567('0x1e')](realtime[_0xa567('0x3e')]())[_0xa567('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xa567('0x1e')](realtime[_0xa567('0x3f')]())[_0xa567('0x40')](function(_0x225d0d){logger[_0xa567('0x41')](_0xa567('0x42'),util[_0xa567('0x43')](_0x225d0d,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa567('0x44')](realtime,preview,fax)[_0xa567('0x1e')](function(_0x484757){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xa567('0x45')]();setInterval(initRealtime,0x1388);})[_0xa567('0x40')](function(_0x1437de){logger[_0xa567('0x41')](_0xa567('0x46'),util['inspect'](_0x1437de,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x52f2=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','listen','sync','error','[index.js][main]','util','moment','./server','./realtime','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x52f2,0x185));var _0x252f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x52f2[_0x4b7b62];return _0x2280df;};'use strict';var BPromise=require('bluebird');var util=require(_0x252f('0x0'));var moment=require(_0x252f('0x1'));var server=require(_0x252f('0x2'));var Realtime=require(_0x252f('0x3'));var Report=require(_0x252f('0x4'));var Acw=require('./acw');var Trigger=require(_0x252f('0x5'));var Dialer=require(_0x252f('0x6'));var Preview=require('./preview');var Fax=require(_0x252f('0x7'));var user=require(_0x252f('0x8'));var voiceQueue=require(_0x252f('0x9'));var voiceQueueReport=require(_0x252f('0xa'));var voiceCallReport=require(_0x252f('0xb'));var trunk=require(_0x252f('0xc'));var trigger=require(_0x252f('0xd'));var template=require(_0x252f('0xe'));var cmHopperHistory=require(_0x252f('0xf'));var campaign=require(_0x252f('0x10'));var voiceExtension=require(_0x252f('0x11'));var faxAccount=require(_0x252f('0x12'));var zendesk=require(_0x252f('0x13'));var salesforce=require(_0x252f('0x14'));var sugarcrm=require(_0x252f('0x15'));var freshdesk=require(_0x252f('0x16'));var desk=require(_0x252f('0x17'));var zoho=require(_0x252f('0x18'));var vtiger=require(_0x252f('0x19'));var freshsales=require(_0x252f('0x1a'));var servicenow=require(_0x252f('0x1b'));var dynamics365=require(_0x252f('0x1c'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x252f('0x1d'))(_0x252f('0x1e'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x252f('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x252f('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x252f('0x20')]()[_0x252f('0x21')](user[_0x252f('0x22')]())[_0x252f('0x21')](realtime[_0x252f('0x23')]())[_0x252f('0x21')](user[_0x252f('0x24')]())[_0x252f('0x21')](realtime[_0x252f('0x25')]())['then'](trunk['getTrunks']())['then'](realtime[_0x252f('0x26')]())[_0x252f('0x21')](voiceQueue[_0x252f('0x27')]())[_0x252f('0x21')](realtime[_0x252f('0x28')]())[_0x252f('0x21')](trigger['getTriggers']())[_0x252f('0x21')](realtime[_0x252f('0x29')]())[_0x252f('0x21')](template[_0x252f('0x2a')]())[_0x252f('0x21')](realtime[_0x252f('0x2b')]())[_0x252f('0x21')](zendesk[_0x252f('0x2c')]())[_0x252f('0x21')](realtime[_0x252f('0x2d')]())['then'](salesforce[_0x252f('0x2e')]())[_0x252f('0x21')](realtime['initSalesforceAccounts']())[_0x252f('0x21')](sugarcrm[_0x252f('0x2f')]())[_0x252f('0x21')](realtime[_0x252f('0x30')]())[_0x252f('0x21')](freshdesk[_0x252f('0x31')]())[_0x252f('0x21')](realtime[_0x252f('0x32')]())[_0x252f('0x21')](desk[_0x252f('0x33')]())[_0x252f('0x21')](realtime[_0x252f('0x34')]())[_0x252f('0x21')](zoho['getZohoAccounts']())[_0x252f('0x21')](realtime[_0x252f('0x35')]())['then'](vtiger['getVtigerAccounts']())[_0x252f('0x21')](realtime[_0x252f('0x36')]())[_0x252f('0x21')](freshsales[_0x252f('0x37')]())[_0x252f('0x21')](realtime['initFreshsalesAccounts']())[_0x252f('0x21')](servicenow[_0x252f('0x38')]())['then'](realtime[_0x252f('0x39')]())['then'](dynamics365[_0x252f('0x3a')]())[_0x252f('0x21')](realtime[_0x252f('0x3b')]())[_0x252f('0x21')](campaign[_0x252f('0x3c')]())['then'](realtime[_0x252f('0x3d')]())[_0x252f('0x21')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x252f('0x3e')]())['then'](faxAccount[_0x252f('0x3f')]())[_0x252f('0x21')](realtime[_0x252f('0x40')]())[_0x252f('0x21')](function(){return realtime;});}function initParams(){return BPromise[_0x252f('0x20')]()[_0x252f('0x21')](voiceQueueReport['getVoiceQueueReports']())[_0x252f('0x21')](realtime[_0x252f('0x41')]())[_0x252f('0x21')](cmHopperHistory[_0x252f('0x42')]())[_0x252f('0x21')](realtime[_0x252f('0x43')]())[_0x252f('0x21')](cmHopperHistory[_0x252f('0x44')]())[_0x252f('0x21')](realtime[_0x252f('0x45')]())[_0x252f('0x21')](voiceCallReport[_0x252f('0x46')]())[_0x252f('0x21')](realtime['initVoiceCallReports']())[_0x252f('0x47')](function(_0x3af01d){logger['error']('[index.js][initParams]',util['inspect'](_0x3af01d,{'showHidden':![],'depth':null}));});}function main(){return server[_0x252f('0x48')](realtime,preview,fax)[_0x252f('0x21')](function(_0x77e428){return initRealtime();})[_0x252f('0x21')](function(){return initParams();})[_0x252f('0x21')](function(){report[_0x252f('0x49')]();setInterval(initRealtime,0x1388);})[_0x252f('0x47')](function(_0x978287){logger[_0x252f('0x4a')](_0x252f('0x4b'),util['inspect'](_0x978287,{'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 47a667b..16b2da2 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x2ce4b9,_0x51c086){var _0x32383b=function(_0x4f5bff){while(--_0x4f5bff){_0x2ce4b9['push'](_0x2ce4b9['shift']());}};_0x32383b(++_0x51c086);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xcb91[_0x2338fa];return _0x42df9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d11d3,_0x91dd5d){_0x5d11d3=_0x5d11d3-0x0;var _0x1f86f9=_0xedd9[_0x5d11d3];return _0x1f86f9;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 288150b..3dce526 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 _0x3e8f=['dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls'];(function(_0x10244a,_0x3e96f4){var _0x4daacd=function(_0x3ef358){while(--_0x3ef358){_0x10244a['push'](_0x10244a['shift']());}};_0x4daacd(++_0x3e96f4);}(_0x3e8f,0xf6));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x532315){this['id']=_0x532315['id']||0x0;this['name']=_0x532315['name']||'';this['type']=_0x532315[_0xf3e8('0x0')]||_0xf3e8('0x1');this['originated']=0x0;this[_0xf3e8('0x2')]=0x0;this[_0xf3e8('0x3')]=0x0;this[_0xf3e8('0x4')]=0x0;this[_0xf3e8('0x5')]='';this[_0xf3e8('0x6')]=!![];this['active']=_0x532315[_0xf3e8('0x7')];this['limitCalls']=_0x532315[_0xf3e8('0x8')];this[_0xf3e8('0x9')]=_0x532315[_0xf3e8('0x9')]||null;this[_0xf3e8('0xa')]=_0x532315['dialGlobalInterval']?_0x532315['dialGlobalInterval']:null;this[_0xf3e8('0xb')]=_0x532315[_0xf3e8('0xb')];this[_0xf3e8('0xc')]=_0x532315[_0xf3e8('0xc')];this[_0xf3e8('0xd')]=_0x532315['dialOriginateTimeout']||0x1e;this[_0xf3e8('0xe')]=_0x532315[_0xf3e8('0xe')];this[_0xf3e8('0xf')]=_0x532315['dialCongestionRetryFrequency'];this[_0xf3e8('0x10')]=_0x532315[_0xf3e8('0x10')];this[_0xf3e8('0x11')]=_0x532315[_0xf3e8('0x11')];this[_0xf3e8('0x12')]=_0x532315[_0xf3e8('0x12')];this[_0xf3e8('0x13')]=_0x532315[_0xf3e8('0x13')];this[_0xf3e8('0x14')]=_0x532315[_0xf3e8('0x14')];this[_0xf3e8('0x15')]=_0x532315[_0xf3e8('0x15')]||0x3;this[_0xf3e8('0x16')]=_0x532315[_0xf3e8('0x16')]||0x96;this['dialDropMaxRetry']=_0x532315['dialDropMaxRetry']||0x3;this[_0xf3e8('0x17')]=_0x532315[_0xf3e8('0x17')]||0x96;this[_0xf3e8('0x18')]=_0x532315[_0xf3e8('0x18')]||0x3;this[_0xf3e8('0x19')]=_0x532315[_0xf3e8('0x19')]||0x96;this['dialMachineMaxRetry']=_0x532315[_0xf3e8('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x532315[_0xf3e8('0x1b')]||0x96;this[_0xf3e8('0x1c')]=_0x532315['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x532315[_0xf3e8('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x532315['dialOrderByScheduledAt']||_0xf3e8('0x1e');this[_0xf3e8('0x1f')]=_0x532315[_0xf3e8('0x1f')]||undefined;this[_0xf3e8('0x20')]=_0x532315['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf3e8('0x21')]=_0x532315['dialCutDigit']||undefined;this['TrunkBackup']=_0x532315[_0xf3e8('0x22')]?_0x532315[_0xf3e8('0x22')]:undefined;this['Trunk']=_0x532315['Trunk']?_0x532315[_0xf3e8('0x23')]:undefined;this[_0xf3e8('0x24')]=_0x532315[_0xf3e8('0x24')]?_0x532315['Interval']:undefined;this[_0xf3e8('0x25')]=_0x532315[_0xf3e8('0x25')]?_0x532315[_0xf3e8('0x25')]:undefined;this[_0xf3e8('0x26')]=_0x532315[_0xf3e8('0x25')]?_0x532315[_0xf3e8('0x25')][_0xf3e8('0x27')]:undefined;this['dialAMDActive']=_0x532315[_0xf3e8('0x28')]||![];this[_0xf3e8('0x29')]=_0x532315[_0xf3e8('0x29')];this[_0xf3e8('0x2a')]=_0x532315[_0xf3e8('0x2a')];this[_0xf3e8('0x2b')]=_0x532315[_0xf3e8('0x2b')];this[_0xf3e8('0x2c')]=_0x532315[_0xf3e8('0x2c')];this[_0xf3e8('0x2d')]=_0x532315[_0xf3e8('0x2d')];this[_0xf3e8('0x2e')]=_0x532315[_0xf3e8('0x2e')];this[_0xf3e8('0x2f')]=_0x532315[_0xf3e8('0x2f')];this[_0xf3e8('0x30')]=_0x532315['dialAMDSilenceThreshold'];this[_0xf3e8('0x31')]=_0x532315[_0xf3e8('0x31')];}module[_0xf3e8('0x32')]=Campaign; \ No newline at end of file +var _0xf720=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf720,0x14a));var _0x0f72=function(_0xde703,_0x658556){_0xde703=_0xde703-0x0;var _0x261bad=_0xf720[_0xde703];return _0x261bad;};'use strict';function Campaign(_0x3c8123){this['id']=_0x3c8123['id']||0x0;this[_0x0f72('0x0')]=_0x3c8123[_0x0f72('0x0')]||'';this[_0x0f72('0x1')]=_0x3c8123[_0x0f72('0x1')]||'campaign';this['originated']=0x0;this[_0x0f72('0x2')]=0x0;this[_0x0f72('0x3')]=0x0;this[_0x0f72('0x4')]=0x0;this[_0x0f72('0x5')]='';this[_0x0f72('0x6')]=!![];this[_0x0f72('0x7')]=_0x3c8123['active'];this[_0x0f72('0x8')]=_0x3c8123[_0x0f72('0x8')];this[_0x0f72('0x9')]=_0x3c8123[_0x0f72('0x9')]||null;this[_0x0f72('0xa')]=_0x3c8123['dialGlobalInterval']?_0x3c8123[_0x0f72('0xa')]:null;this['dialOriginateCallerIdName']=_0x3c8123[_0x0f72('0xb')];this[_0x0f72('0xc')]=_0x3c8123[_0x0f72('0xc')];this[_0x0f72('0xd')]=_0x3c8123[_0x0f72('0xd')]||0x1e;this[_0x0f72('0xe')]=_0x3c8123[_0x0f72('0xe')];this[_0x0f72('0xf')]=_0x3c8123[_0x0f72('0xf')];this[_0x0f72('0x10')]=_0x3c8123['dialBusyMaxRetry'];this[_0x0f72('0x11')]=_0x3c8123[_0x0f72('0x11')];this[_0x0f72('0x12')]=_0x3c8123[_0x0f72('0x12')];this['dialNoAnswerRetryFrequency']=_0x3c8123[_0x0f72('0x13')];this[_0x0f72('0x14')]=_0x3c8123['dialGlobalMaxRetry'];this[_0x0f72('0x15')]=_0x3c8123[_0x0f72('0x15')]||0x3;this[_0x0f72('0x16')]=_0x3c8123[_0x0f72('0x16')]||0x96;this['dialDropMaxRetry']=_0x3c8123[_0x0f72('0x17')]||0x3;this['dialDropRetryFrequency']=_0x3c8123[_0x0f72('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x3c8123['dialAbandonedMaxRetry']||0x3;this[_0x0f72('0x19')]=_0x3c8123[_0x0f72('0x19')]||0x96;this[_0x0f72('0x1a')]=_0x3c8123[_0x0f72('0x1a')]||0x3;this[_0x0f72('0x1b')]=_0x3c8123['dialMachineRetryFrequency']||0x96;this[_0x0f72('0x1c')]=_0x3c8123[_0x0f72('0x1c')]||0x3;this[_0x0f72('0x1d')]=_0x3c8123[_0x0f72('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x3c8123[_0x0f72('0x1e')]||_0x0f72('0x1f');this[_0x0f72('0x20')]=_0x3c8123[_0x0f72('0x20')]||undefined;this[_0x0f72('0x21')]=_0x3c8123['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0f72('0x22')]=_0x3c8123[_0x0f72('0x22')]||undefined;this[_0x0f72('0x23')]=_0x3c8123[_0x0f72('0x23')]?_0x3c8123[_0x0f72('0x23')]:undefined;this[_0x0f72('0x24')]=_0x3c8123[_0x0f72('0x24')]?_0x3c8123[_0x0f72('0x24')]:undefined;this[_0x0f72('0x25')]=_0x3c8123[_0x0f72('0x25')]?_0x3c8123[_0x0f72('0x25')]:undefined;this['SquareProject']=_0x3c8123[_0x0f72('0x26')]?_0x3c8123[_0x0f72('0x26')]:undefined;this[_0x0f72('0x27')]=_0x3c8123[_0x0f72('0x26')]?_0x3c8123['SquareProject'][_0x0f72('0x0')]:undefined;this['dialAMDActive']=_0x3c8123[_0x0f72('0x28')]||![];this['dialAMDInitialSilence']=_0x3c8123[_0x0f72('0x29')];this[_0x0f72('0x2a')]=_0x3c8123['dialAMDGreeting'];this[_0x0f72('0x2b')]=_0x3c8123['dialAMDAfterGreetingSilence'];this[_0x0f72('0x2c')]=_0x3c8123[_0x0f72('0x2c')];this[_0x0f72('0x2d')]=_0x3c8123[_0x0f72('0x2d')];this[_0x0f72('0x2e')]=_0x3c8123[_0x0f72('0x2e')];this[_0x0f72('0x2f')]=_0x3c8123[_0x0f72('0x2f')];this[_0x0f72('0x30')]=_0x3c8123['dialAMDSilenceThreshold'];this[_0x0f72('0x31')]=_0x3c8123['dialAMDMaximumWordLength'];}module[_0x0f72('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f4a94b8..321633a 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 _0xc9de=['connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastdata','billableseconds','disposition','monitor','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc9de,0x140));var _0xec9d=function(_0xcd44b5,_0x1e67af){_0xcd44b5=_0xcd44b5-0x0;var _0x455a96=_0xc9de[_0xcd44b5];return _0x455a96;};'use strict';function Channel(){this[_0xec9d('0x0')]=null;this[_0xec9d('0x1')]='';this[_0xec9d('0x2')]='';this['calleridnum']=0x0;this[_0xec9d('0x3')]='';this[_0xec9d('0x4')]=undefined;this[_0xec9d('0x5')]=undefined;this[_0xec9d('0x6')]=0x0;this[_0xec9d('0x7')]='';this[_0xec9d('0x8')]=0x0;this[_0xec9d('0x9')]=0x0;this[_0xec9d('0xa')]=0x0;this['answered']=![];this[_0xec9d('0xb')]=null;this[_0xec9d('0xc')]=null;this[_0xec9d('0xd')]=![];this[_0xec9d('0xe')]=![];this['lastapplication']='';this[_0xec9d('0xf')]='';this['duration']=0x0;this[_0xec9d('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this[_0xec9d('0x11')]=null;this[_0xec9d('0x12')]=![];this['monitorFilename']=null;this[_0xec9d('0x13')]=null;this[_0xec9d('0x14')]=[];this[_0xec9d('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xec9d('0x16')]=undefined;this[_0xec9d('0x17')]=0x0;}module[_0xec9d('0x18')]=Channel; \ No newline at end of file +var _0xa521=['context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','holdtime','tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridname','connectedlinenum','accountcode'];(function(_0x4ef11c,_0x387510){var _0x1c3026=function(_0x582d43){while(--_0x582d43){_0x4ef11c['push'](_0x4ef11c['shift']());}};_0x1c3026(++_0x387510);}(_0xa521,0xeb));var _0x1a52=function(_0x2a1bb1,_0x3a3f9b){_0x2a1bb1=_0x2a1bb1-0x0;var _0x42b484=_0xa521[_0x2a1bb1];return _0x42b484;};'use strict';function Channel(){this[_0x1a52('0x0')]=null;this[_0x1a52('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x1a52('0x2')]='';this[_0x1a52('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x1a52('0x4')]=0x0;this[_0x1a52('0x5')]='';this[_0x1a52('0x6')]=0x0;this[_0x1a52('0x7')]=0x0;this[_0x1a52('0x8')]=0x0;this[_0x1a52('0x9')]=![];this[_0x1a52('0xa')]=null;this[_0x1a52('0xb')]=null;this[_0x1a52('0xc')]=![];this[_0x1a52('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x1a52('0xe')]=0x0;this['type']=null;this[_0x1a52('0xf')]=null;this[_0x1a52('0x10')]=null;this[_0x1a52('0x11')]=![];this[_0x1a52('0x12')]=null;this['queue']=null;this[_0x1a52('0x13')]=[];this['transfercalleridnum']=undefined;this[_0x1a52('0x14')]=undefined;this[_0x1a52('0x15')]=undefined;this[_0x1a52('0x16')]=0x0;}module[_0x1a52('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index cc24ea2..dab8db4 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 _0xc478=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x52fa77,_0x2b381b){var _0x477535=function(_0x5323b5){while(--_0x5323b5){_0x52fa77['push'](_0x52fa77['shift']());}};_0x477535(++_0x2b381b);}(_0xc478,0xe8));var _0x8c47=function(_0x1297cc,_0x4eb133){_0x1297cc=_0x1297cc-0x0;var _0x436906=_0xc478[_0x1297cc];return _0x436906;};'use strict';function DeskAccount(_0x727027){this['id']=_0x727027['id']||0x0;this[_0x8c47('0x0')]=_0x727027[_0x8c47('0x0')]||'';this[_0x8c47('0x1')]=_0x727027['username']||'';this[_0x8c47('0x2')]=_0x727027[_0x8c47('0x2')]||'';this[_0x8c47('0x3')]=_0x727027[_0x8c47('0x3')]||'';this[_0x8c47('0x4')]=_0x727027[_0x8c47('0x4')]||'';this[_0x8c47('0x5')]=_0x727027['consumerKey']||'';this[_0x8c47('0x6')]=_0x727027[_0x8c47('0x6')]||'';this[_0x8c47('0x7')]=_0x727027[_0x8c47('0x7')]||'';this[_0x8c47('0x8')]=_0x727027[_0x8c47('0x8')]||'';this[_0x8c47('0x9')]=_0x727027[_0x8c47('0x9')]||'';this[_0x8c47('0xa')]=_0x727027[_0x8c47('0xa')]||'';this[_0x8c47('0xb')]=_0x727027[_0x8c47('0xb')]||{};}module[_0x8c47('0xc')]=DeskAccount; \ No newline at end of file +var _0x2a6c=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports'];(function(_0x2452f9,_0x582c39){var _0x3d1559=function(_0x2b74ad){while(--_0x2b74ad){_0x2452f9['push'](_0x2452f9['shift']());}};_0x3d1559(++_0x582c39);}(_0x2a6c,0x174));var _0xc2a6=function(_0x499a42,_0x59c8e0){_0x499a42=_0x499a42-0x0;var _0x4d8715=_0x2a6c[_0x499a42];return _0x4d8715;};'use strict';function DeskAccount(_0x14d06e){this['id']=_0x14d06e['id']||0x0;this[_0xc2a6('0x0')]=_0x14d06e[_0xc2a6('0x0')]||'';this[_0xc2a6('0x1')]=_0x14d06e[_0xc2a6('0x1')]||'';this[_0xc2a6('0x2')]=_0x14d06e[_0xc2a6('0x2')]||'';this['authType']=_0x14d06e[_0xc2a6('0x3')]||'';this[_0xc2a6('0x4')]=_0x14d06e[_0xc2a6('0x4')]||'';this[_0xc2a6('0x5')]=_0x14d06e[_0xc2a6('0x5')]||'';this[_0xc2a6('0x6')]=_0x14d06e[_0xc2a6('0x6')]||'';this[_0xc2a6('0x7')]=_0x14d06e['token']||'';this[_0xc2a6('0x8')]=_0x14d06e[_0xc2a6('0x8')]||'';this['type']=_0x14d06e[_0xc2a6('0x9')]||'';this['serverUrl']=_0x14d06e['serverUrl']||'';this[_0xc2a6('0xa')]=_0x14d06e['Configurations']||{};}module[_0xc2a6('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4d3965d..85eecdf 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 _0xe605=['clientSecret','serverUrl','name','username','password','remoteUri','tenantId','clientId'];(function(_0xb46ba,_0x2e2cc1){var _0x3b76a8=function(_0x3d1199){while(--_0x3d1199){_0xb46ba['push'](_0xb46ba['shift']());}};_0x3b76a8(++_0x2e2cc1);}(_0xe605,0x92));var _0x5e60=function(_0x2a20f5,_0x288cdd){_0x2a20f5=_0x2a20f5-0x0;var _0x94881=_0xe605[_0x2a20f5];return _0x94881;};'use strict';function Dynamics365Account(_0x4cf32c){this['id']=_0x4cf32c['id']||0x0;this[_0x5e60('0x0')]=_0x4cf32c['name']||'';this[_0x5e60('0x1')]=_0x4cf32c[_0x5e60('0x1')]||'';this[_0x5e60('0x2')]=_0x4cf32c[_0x5e60('0x2')]||'';this[_0x5e60('0x3')]=_0x4cf32c[_0x5e60('0x3')]||'';this[_0x5e60('0x4')]=_0x4cf32c[_0x5e60('0x4')]||'';this[_0x5e60('0x5')]=_0x4cf32c[_0x5e60('0x5')]||'';this[_0x5e60('0x6')]=_0x4cf32c[_0x5e60('0x6')]||{};this['serverUrl']=_0x4cf32c[_0x5e60('0x7')]||'';this['Configurations']=_0x4cf32c['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x1be1=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x1be1,0x192));var _0x11be=function(_0x34b054,_0x2320d8){_0x34b054=_0x34b054-0x0;var _0x505fc1=_0x1be1[_0x34b054];return _0x505fc1;};'use strict';function Dynamics365Account(_0x35110c){this['id']=_0x35110c['id']||0x0;this['name']=_0x35110c[_0x11be('0x0')]||'';this[_0x11be('0x1')]=_0x35110c['username']||'';this[_0x11be('0x2')]=_0x35110c[_0x11be('0x2')]||'';this[_0x11be('0x3')]=_0x35110c[_0x11be('0x3')]||'';this['tenantId']=_0x35110c[_0x11be('0x4')]||'';this[_0x11be('0x5')]=_0x35110c[_0x11be('0x5')]||'';this['clientSecret']=_0x35110c[_0x11be('0x6')]||{};this['serverUrl']=_0x35110c[_0x11be('0x7')]||'';this[_0x11be('0x8')]=_0x35110c[_0x11be('0x8')]||{};}module[_0x11be('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2e27b99..a60886b 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 _0x7e17=['minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','headerinfo','localstationid'];(function(_0x25e483,_0x2eedd8){var _0x117af9=function(_0x1705ec){while(--_0x1705ec){_0x25e483['push'](_0x25e483['shift']());}};_0x117af9(++_0x2eedd8);}(_0x7e17,0xde));var _0x77e1=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x7e17[_0xe1269d];return _0x261ca1;};'use strict';function FaxAccount(_0x14d32a){this['id']=_0x14d32a['id']||0x0;this[_0x77e1('0x0')]=_0x14d32a[_0x77e1('0x0')]||'';this['description']=_0x14d32a['description'];this['ecm']=_0x14d32a['ecm'];this[_0x77e1('0x1')]=_0x14d32a[_0x77e1('0x1')];this[_0x77e1('0x2')]=_0x14d32a['localstationid'];this[_0x77e1('0x3')]=_0x14d32a['minrate']||0x960;this[_0x77e1('0x4')]=_0x14d32a[_0x77e1('0x4')]||0x3840;this[_0x77e1('0x5')]=_0x14d32a[_0x77e1('0x5')]||_0x77e1('0x6');this['gateway']=_0x14d32a[_0x77e1('0x7')]||'no';this['faxdetect']=_0x14d32a['faxdetect']||'no';this[_0x77e1('0x8')]=_0x14d32a[_0x77e1('0x8')]||0x1388;this[_0x77e1('0x9')]=_0x14d32a[_0x77e1('0x9')]||_0x77e1('0xa');this['Trunk']=_0x14d32a[_0x77e1('0xb')]?_0x14d32a[_0x77e1('0xb')]:undefined;this[_0x77e1('0xc')]=_0x14d32a[_0x77e1('0xc')];this[_0x77e1('0xd')]=_0x14d32a['key'];}module[_0x77e1('0xe')]=FaxAccount; \ No newline at end of file +var _0x9117=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk'];(function(_0x5eb262,_0x37ba1b){var _0x3c4f7b=function(_0x58d133){while(--_0x58d133){_0x5eb262['push'](_0x5eb262['shift']());}};_0x3c4f7b(++_0x37ba1b);}(_0x9117,0x1d3));var _0x7911=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0x9117[_0x47c902];return _0x1ad6a0;};'use strict';function FaxAccount(_0x26f32){this['id']=_0x26f32['id']||0x0;this[_0x7911('0x0')]=_0x26f32[_0x7911('0x0')]||'';this[_0x7911('0x1')]=_0x26f32[_0x7911('0x1')];this['ecm']=_0x26f32[_0x7911('0x2')];this['headerinfo']=_0x26f32[_0x7911('0x3')];this[_0x7911('0x4')]=_0x26f32[_0x7911('0x4')];this['minrate']=_0x26f32['minrate']||0x960;this[_0x7911('0x5')]=_0x26f32['maxrate']||0x3840;this[_0x7911('0x6')]=_0x26f32[_0x7911('0x6')]||_0x7911('0x7');this[_0x7911('0x8')]=_0x26f32[_0x7911('0x8')]||'no';this['faxdetect']=_0x26f32['faxdetect']||'no';this[_0x7911('0x9')]=_0x26f32[_0x7911('0x9')]||0x1388;this[_0x7911('0xa')]=_0x26f32[_0x7911('0xa')]||_0x7911('0xb');this[_0x7911('0xc')]=_0x26f32[_0x7911('0xc')]?_0x26f32[_0x7911('0xc')]:undefined;this[_0x7911('0xd')]=_0x26f32['ListId'];this[_0x7911('0xe')]=_0x26f32[_0x7911('0xe')];}module[_0x7911('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 8d44bbe..f52e8c6 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 _0xbee6=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x284d26,_0x34dee4){var _0x297845=function(_0x11079d){while(--_0x11079d){_0x284d26['push'](_0x284d26['shift']());}};_0x297845(++_0x34dee4);}(_0xbee6,0x1ee));var _0x6bee=function(_0x42dde9,_0xf23327){_0x42dde9=_0x42dde9-0x0;var _0x52f8db=_0xbee6[_0x42dde9];return _0x52f8db;};'use strict';function FreshdeskAccount(_0x228bcb){this['id']=_0x228bcb['id']||0x0;this[_0x6bee('0x0')]=_0x228bcb[_0x6bee('0x0')]||'';this[_0x6bee('0x1')]=_0x228bcb[_0x6bee('0x1')]||'';this[_0x6bee('0x2')]=_0x228bcb[_0x6bee('0x3')]||'';this[_0x6bee('0x4')]=_0x228bcb[_0x6bee('0x4')]||'';this[_0x6bee('0x5')]=_0x228bcb[_0x6bee('0x5')]||'';this['Configurations']=_0x228bcb[_0x6bee('0x6')]||{};}module[_0x6bee('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xdb9f=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x358d59,_0x597c83){var _0x5bba18=function(_0x365e22){while(--_0x365e22){_0x358d59['push'](_0x358d59['shift']());}};_0x5bba18(++_0x597c83);}(_0xdb9f,0x1d6));var _0xfdb9=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0xdb9f[_0xc753c8];return _0xd02f5c;};'use strict';function FreshdeskAccount(_0x3cca84){this['id']=_0x3cca84['id']||0x0;this[_0xfdb9('0x0')]=_0x3cca84[_0xfdb9('0x0')]||'';this[_0xfdb9('0x1')]=_0x3cca84[_0xfdb9('0x1')]||'';this['apiKey']=_0x3cca84[_0xfdb9('0x2')]||'';this[_0xfdb9('0x3')]=_0x3cca84['remoteUri']||'';this[_0xfdb9('0x4')]=_0x3cca84['serverUrl']||'';this['Configurations']=_0x3cca84[_0xfdb9('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 55f8ecb..1bff8c7 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 _0xf96b=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x23ded0,_0x42c309){var _0x5b8988=function(_0x2a3cf3){while(--_0x2a3cf3){_0x23ded0['push'](_0x23ded0['shift']());}};_0x5b8988(++_0x42c309);}(_0xf96b,0x109));var _0xbf96=function(_0xa30cec,_0x5ee29){_0xa30cec=_0xa30cec-0x0;var _0x737bad=_0xf96b[_0xa30cec];return _0x737bad;};'use strict';function FreshsalesAccount(_0x3ab560){this['id']=_0x3ab560['id']||0x0;this[_0xbf96('0x0')]=_0x3ab560[_0xbf96('0x0')]||'';this[_0xbf96('0x1')]=_0x3ab560[_0xbf96('0x1')]||'';this[_0xbf96('0x2')]=_0x3ab560[_0xbf96('0x3')]||'';this[_0xbf96('0x4')]=_0x3ab560[_0xbf96('0x4')]||'';this[_0xbf96('0x5')]=_0x3ab560[_0xbf96('0x5')]||'';this[_0xbf96('0x6')]=_0x3ab560[_0xbf96('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x950a=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x950a,0x111));var _0xa950=function(_0x418b0a,_0x119c26){_0x418b0a=_0x418b0a-0x0;var _0x5637cc=_0x950a[_0x418b0a];return _0x5637cc;};'use strict';function FreshsalesAccount(_0x95ee3e){this['id']=_0x95ee3e['id']||0x0;this[_0xa950('0x0')]=_0x95ee3e[_0xa950('0x0')]||'';this[_0xa950('0x1')]=_0x95ee3e['username']||'';this[_0xa950('0x2')]=_0x95ee3e[_0xa950('0x3')]||'';this[_0xa950('0x4')]=_0x95ee3e[_0xa950('0x4')]||'';this['serverUrl']=_0x95ee3e[_0xa950('0x5')]||'';this[_0xa950('0x6')]=_0x95ee3e['Configurations']||{};}module[_0xa950('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c54e446..3a7d9a2 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 _0x020c=['mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice'];(function(_0x1f8e5f,_0xdc8562){var _0x473391=function(_0x47e8d3){while(--_0x47e8d3){_0x1f8e5f['push'](_0x1f8e5f['shift']());}};_0x473391(++_0xdc8562);}(_0x020c,0x124));var _0xc020=function(_0x363880,_0x1d6f47){_0x363880=_0x363880-0x0;var _0x44ae23=_0x020c[_0x363880];return _0x44ae23;};'use strict';function QueueReport(){this[_0xc020('0x0')]=_0xc020('0x1');this[_0xc020('0x2')]='';this[_0xc020('0x3')]='';this[_0xc020('0x4')]='';this[_0xc020('0x5')]='';this[_0xc020('0x6')]=null;this[_0xc020('0x7')]=null;this[_0xc020('0x8')]=0x1;this[_0xc020('0x9')]=0x1;this[_0xc020('0xa')]=![];this[_0xc020('0xb')]=null;this[_0xc020('0xc')]=![];this[_0xc020('0xd')]=null;this[_0xc020('0xe')]=![];this[_0xc020('0xf')]=null;this['originalposition']=0x1;this[_0xc020('0x10')]='';this[_0xc020('0x11')]='';this[_0xc020('0x12')]='';this[_0xc020('0x13')]='';this['context']='';this[_0xc020('0x14')]='';this[_0xc020('0x15')]='';this[_0xc020('0x16')]=0x0;this[_0xc020('0x17')]=![];this[_0xc020('0x18')]='';this[_0xc020('0x19')]=_0xc020('0x1a');this[_0xc020('0x1b')]=0x0;this[_0xc020('0x1c')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x0dc0=['exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables'];(function(_0x808b82,_0x33c2cc){var _0x3ae36c=function(_0x1a8453){while(--_0x1a8453){_0x808b82['push'](_0x808b82['shift']());}};_0x3ae36c(++_0x33c2cc);}(_0x0dc0,0x1b4));var _0x00dc=function(_0x242c42,_0x3df02a){_0x242c42=_0x242c42-0x0;var _0x15680b=_0x0dc0[_0x242c42];return _0x15680b;};'use strict';function QueueReport(){this[_0x00dc('0x0')]=_0x00dc('0x1');this[_0x00dc('0x2')]='';this[_0x00dc('0x3')]='';this['calleridname']='';this[_0x00dc('0x4')]='';this[_0x00dc('0x5')]=null;this[_0x00dc('0x6')]=null;this[_0x00dc('0x7')]=0x1;this[_0x00dc('0x8')]=0x1;this[_0x00dc('0x9')]=![];this['queuecallerabandonAt']=null;this[_0x00dc('0xa')]=![];this[_0x00dc('0xb')]=null;this[_0x00dc('0xc')]=![];this[_0x00dc('0xd')]=null;this[_0x00dc('0xe')]=0x1;this[_0x00dc('0xf')]='';this[_0x00dc('0x10')]='';this[_0x00dc('0x11')]='';this[_0x00dc('0x12')]='';this[_0x00dc('0x13')]='';this[_0x00dc('0x14')]='';this['priority']='';this[_0x00dc('0x15')]=0x0;this[_0x00dc('0x16')]=![];this[_0x00dc('0x17')]='';this[_0x00dc('0x18')]=_0x00dc('0x19');this[_0x00dc('0x1a')]=0x0;this[_0x00dc('0x1b')]={};}module[_0x00dc('0x1c')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3736e4e..785a12a 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 _0x7ebf=['exports','name','username','remoteUri','password','clientId','securityToken','type','serverUrl','Configurations'];(function(_0x190545,_0x45442e){var _0x1761a6=function(_0xb1a4af){while(--_0xb1a4af){_0x190545['push'](_0x190545['shift']());}};_0x1761a6(++_0x45442e);}(_0x7ebf,0x119));var _0xf7eb=function(_0x1c30d6,_0xffa7d9){_0x1c30d6=_0x1c30d6-0x0;var _0x51c7c6=_0x7ebf[_0x1c30d6];return _0x51c7c6;};'use strict';function SalesforceAccount(_0x1eaa52){this['id']=_0x1eaa52['id']||0x0;this[_0xf7eb('0x0')]=_0x1eaa52[_0xf7eb('0x0')]||'';this[_0xf7eb('0x1')]=_0x1eaa52[_0xf7eb('0x1')]||'';this[_0xf7eb('0x2')]=_0x1eaa52['remoteUri']||'';this[_0xf7eb('0x3')]=_0x1eaa52[_0xf7eb('0x3')]||'';this['clientId']=_0x1eaa52[_0xf7eb('0x4')]||'';this['clientSecret']=_0x1eaa52['clientSecret']||'';this[_0xf7eb('0x5')]=_0x1eaa52[_0xf7eb('0x5')]||'';this[_0xf7eb('0x6')]=_0x1eaa52[_0xf7eb('0x6')]||'integrationTab';this[_0xf7eb('0x7')]=_0x1eaa52[_0xf7eb('0x7')]||'';this[_0xf7eb('0x8')]=_0x1eaa52[_0xf7eb('0x8')]||{};}module[_0xf7eb('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x94e7=['type','integrationTab','serverUrl','Configurations','name','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e7,0x7c));var _0x794e=function(_0x22d76c,_0x1feded){_0x22d76c=_0x22d76c-0x0;var _0x9cc8fb=_0x94e7[_0x22d76c];return _0x9cc8fb;};'use strict';function SalesforceAccount(_0x530318){this['id']=_0x530318['id']||0x0;this[_0x794e('0x0')]=_0x530318[_0x794e('0x0')]||'';this['username']=_0x530318['username']||'';this[_0x794e('0x1')]=_0x530318[_0x794e('0x1')]||'';this[_0x794e('0x2')]=_0x530318['password']||'';this[_0x794e('0x3')]=_0x530318[_0x794e('0x3')]||'';this[_0x794e('0x4')]=_0x530318[_0x794e('0x4')]||'';this[_0x794e('0x5')]=_0x530318[_0x794e('0x5')]||'';this['type']=_0x530318[_0x794e('0x6')]||_0x794e('0x7');this['serverUrl']=_0x530318[_0x794e('0x8')]||'';this['Configurations']=_0x530318[_0x794e('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 2311d41..bd7643c 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 _0x1905=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x508344,_0x1eb1db){var _0x3b54a3=function(_0x5ae943){while(--_0x5ae943){_0x508344['push'](_0x508344['shift']());}};_0x3b54a3(++_0x1eb1db);}(_0x1905,0x194));var _0x5190=function(_0x58003c,_0x223b46){_0x58003c=_0x58003c-0x0;var _0x506492=_0x1905[_0x58003c];return _0x506492;};'use strict';function ServicenowAccount(_0x64079b){this['id']=_0x64079b['id']||0x0;this[_0x5190('0x0')]=_0x64079b[_0x5190('0x0')]||'';this[_0x5190('0x1')]=_0x64079b[_0x5190('0x1')]||'';this[_0x5190('0x2')]=_0x64079b[_0x5190('0x2')]||'';this[_0x5190('0x3')]=_0x64079b[_0x5190('0x3')]||'';this[_0x5190('0x4')]=_0x64079b[_0x5190('0x4')]||'';this['Configurations']=_0x64079b[_0x5190('0x5')]||{};}module[_0x5190('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x09bb=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x8980,_0x3e943b){var _0x3491a6=function(_0x1acbf3){while(--_0x1acbf3){_0x8980['push'](_0x8980['shift']());}};_0x3491a6(++_0x3e943b);}(_0x09bb,0x1dc));var _0xb09b=function(_0x1d9510,_0x4adb88){_0x1d9510=_0x1d9510-0x0;var _0x4ecfda=_0x09bb[_0x1d9510];return _0x4ecfda;};'use strict';function ServicenowAccount(_0xebd236){this['id']=_0xebd236['id']||0x0;this[_0xb09b('0x0')]=_0xebd236[_0xb09b('0x0')]||'';this[_0xb09b('0x1')]=_0xebd236['username']||'';this[_0xb09b('0x2')]=_0xebd236['password']||'';this['remoteUri']=_0xebd236[_0xb09b('0x3')]||'';this['serverUrl']=_0xebd236[_0xb09b('0x4')]||'';this[_0xb09b('0x5')]=_0xebd236['Configurations']||{};}module[_0xb09b('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8dd4004..6aa6922 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 _0x3f2b=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4bb235,_0x55bfe3){var _0x279c50=function(_0x134a0a){while(--_0x134a0a){_0x4bb235['push'](_0x4bb235['shift']());}};_0x279c50(++_0x55bfe3);}(_0x3f2b,0x72));var _0xb3f2=function(_0x1d3106,_0x224f28){_0x1d3106=_0x1d3106-0x0;var _0x1ebae2=_0x3f2b[_0x1d3106];return _0x1ebae2;};'use strict';function SugarcrmAccount(_0xb851fc){this['id']=_0xb851fc['id']||0x0;this['name']=_0xb851fc[_0xb3f2('0x0')]||'';this[_0xb3f2('0x1')]=_0xb851fc[_0xb3f2('0x1')]||'';this['password']=_0xb851fc[_0xb3f2('0x2')]||'';this[_0xb3f2('0x3')]=_0xb851fc['remoteUri']||'';this['serverUrl']=_0xb851fc[_0xb3f2('0x4')]||'';this[_0xb3f2('0x5')]=_0xb851fc[_0xb3f2('0x5')]||{};}module[_0xb3f2('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1cae=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x57c47a,_0x23874d){var _0x59df7d=function(_0x59e44c){while(--_0x59e44c){_0x57c47a['push'](_0x57c47a['shift']());}};_0x59df7d(++_0x23874d);}(_0x1cae,0x10b));var _0xe1ca=function(_0x7776aa,_0xf05576){_0x7776aa=_0x7776aa-0x0;var _0x3d7bfd=_0x1cae[_0x7776aa];return _0x3d7bfd;};'use strict';function SugarcrmAccount(_0x252745){this['id']=_0x252745['id']||0x0;this[_0xe1ca('0x0')]=_0x252745['name']||'';this[_0xe1ca('0x1')]=_0x252745[_0xe1ca('0x1')]||'';this[_0xe1ca('0x2')]=_0x252745[_0xe1ca('0x2')]||'';this[_0xe1ca('0x3')]=_0x252745[_0xe1ca('0x3')]||'';this[_0xe1ca('0x4')]=_0x252745['serverUrl']||'';this[_0xe1ca('0x5')]=_0x252745['Configurations']||{};}module[_0xe1ca('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0f91064..f74f70b 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 _0x91bc=['address','name','accountcode','state','unknown','status'];(function(_0x1a74e3,_0x3e99d1){var _0x1c1e99=function(_0x570209){while(--_0x570209){_0x1a74e3['push'](_0x1a74e3['shift']());}};_0x1c1e99(++_0x3e99d1);}(_0x91bc,0x181));var _0xc91b=function(_0x2a3688,_0x3923aa){_0x2a3688=_0x2a3688-0x0;var _0x255227=_0x91bc[_0x2a3688];return _0x255227;};'use strict';function Telephone(_0x33cb97){this['id']=_0x33cb97['id']||0x0;this[_0xc91b('0x0')]=_0x33cb97['name']||'';this['accountcode']=_0x33cb97[_0xc91b('0x1')]||'';this[_0xc91b('0x2')]=_0xc91b('0x3');this['stateTime']=0x0;this[_0xc91b('0x4')]=_0xc91b('0x3');this[_0xc91b('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x042a=['name','accountcode','state','unknown','stateTime','status','address'];(function(_0x56d696,_0x530c64){var _0x127e8b=function(_0x5b85a1){while(--_0x5b85a1){_0x56d696['push'](_0x56d696['shift']());}};_0x127e8b(++_0x530c64);}(_0x042a,0x1ce));var _0xa042=function(_0x4b7b5d,_0x34408a){_0x4b7b5d=_0x4b7b5d-0x0;var _0x1c513a=_0x042a[_0x4b7b5d];return _0x1c513a;};'use strict';function Telephone(_0xd83a11){this['id']=_0xd83a11['id']||0x0;this[_0xa042('0x0')]=_0xd83a11[_0xa042('0x0')]||'';this[_0xa042('0x1')]=_0xd83a11['accountcode']||'';this[_0xa042('0x2')]=_0xa042('0x3');this[_0xa042('0x4')]=0x0;this[_0xa042('0x5')]='unknown';this[_0xa042('0x6')]='';}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 8f9ab16..91e5ee6 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x343d30,_0x225081){var _0xdbea72=function(_0xde6081){while(--_0xde6081){_0x343d30['push'](_0x343d30['shift']());}};_0xdbea72(++_0x225081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x51d27a,_0x413f6c){var _0x3bda27=function(_0x19af79){while(--_0x19af79){_0x51d27a['push'](_0x51d27a['shift']());}};_0x3bda27(++_0x413f6c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b6fd3,_0x4af8d4){_0x5b6fd3=_0x5b6fd3-0x0;var _0x75ef1e=_0xb10b[_0x5b6fd3];return _0x75ef1e;};'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 e2e6ed0..a4a1f6f 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x1ab324,_0x2a6135){var _0x3fb625=function(_0x1f5162){while(--_0x1f5162){_0x1ab324['push'](_0x1ab324['shift']());}};_0x3fb625(++_0x2a6135);}(_0xda3f,0xec));var _0xfda3=function(_0x4e9d3a,_0x1b34a2){_0x4e9d3a=_0x4e9d3a-0x0;var _0x219624=_0xda3f[_0x4e9d3a];return _0x219624;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x3d2386,_0x4d0519){var _0x4311b9=function(_0x5c1360){while(--_0x5c1360){_0x3d2386['push'](_0x3d2386['shift']());}};_0x4311b9(++_0x4d0519);}(_0x2032,0xd9));var _0x2203=function(_0x52cb37,_0x60d478){_0x52cb37=_0x52cb37-0x0;var _0x11a11f=_0x2032[_0x52cb37];return _0x11a11f;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('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 dc5c107..4d1f3f8 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 _0xe2c9=['registrationtime','defaultuser','exports','active','name','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport'];(function(_0x31638d,_0x1f9a29){var _0x1af5f6=function(_0x327277){while(--_0x327277){_0x31638d['push'](_0x31638d['shift']());}};_0x1af5f6(++_0x1f9a29);}(_0xe2c9,0xb9));var _0x9e2c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe2c9[_0x5b644e];return _0x49c6bf;};'use strict';function Trunk(_0x422398){this['id']=_0x422398['id']||0x0;this['active']=_0x422398[_0x9e2c('0x0')]||![];this[_0x9e2c('0x1')]=_0x422398[_0x9e2c('0x1')]||'';this['state']=_0x9e2c('0x2');this[_0x9e2c('0x3')]=0x0;this['status']=_0x9e2c('0x2');this[_0x9e2c('0x4')]=_0x422398[_0x9e2c('0x4')]&&_0x422398[_0x9e2c('0x4')][_0x9e2c('0x5')](':')?_0x422398[_0x9e2c('0x4')][_0x9e2c('0x6')](':')[0x0]:'';this[_0x9e2c('0x7')]='';this[_0x9e2c('0x8')]='';this[_0x9e2c('0x9')]='';this[_0x9e2c('0xa')]='';this['refresh']='';this['stateRegistry']=_0x9e2c('0x2');this[_0x9e2c('0xb')]='';this['address']='';this['defaultuser']=_0x422398[_0x9e2c('0xc')]||'';}module[_0x9e2c('0xd')]=Trunk; \ No newline at end of file +var _0x4511=['split','host','domainport','refresh','registrationtime','address','defaultuser','exports','name','unknown','stateTime','status','registry'];(function(_0x13fc0d,_0x39711c){var _0x448695=function(_0x46b14e){while(--_0x46b14e){_0x13fc0d['push'](_0x13fc0d['shift']());}};_0x448695(++_0x39711c);}(_0x4511,0x7d));var _0x1451=function(_0x2dd4f6,_0x4a1121){_0x2dd4f6=_0x2dd4f6-0x0;var _0x4dedc4=_0x4511[_0x2dd4f6];return _0x4dedc4;};'use strict';function Trunk(_0x209743){this['id']=_0x209743['id']||0x0;this['active']=_0x209743['active']||![];this[_0x1451('0x0')]=_0x209743[_0x1451('0x0')]||'';this['state']=_0x1451('0x1');this[_0x1451('0x2')]=0x0;this[_0x1451('0x3')]=_0x1451('0x1');this['registry']=_0x209743[_0x1451('0x4')]&&_0x209743[_0x1451('0x4')]['indexOf'](':')?_0x209743[_0x1451('0x4')][_0x1451('0x5')](':')[0x0]:'';this[_0x1451('0x6')]='';this['port']='';this['domain']='';this[_0x1451('0x7')]='';this[_0x1451('0x8')]='';this['stateRegistry']=_0x1451('0x1');this[_0x1451('0x9')]='';this[_0x1451('0xa')]='';this[_0x1451('0xb')]=_0x209743[_0x1451('0xb')]||'';}module[_0x1451('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ee13f57..76f0b0b 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 _0x30ce=['exten','recordingFormat','mandatoryDisposition'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x30ce,0x165));var _0xe30c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x30ce[_0x4a53d];return _0x27410e;};'use strict';function voiceExtension(_0x2bae8a){this['id']=_0x2bae8a['id']||0x0;this['exten']=_0x2bae8a[_0xe30c('0x0')]||'';this[_0xe30c('0x1')]=_0x2bae8a[_0xe30c('0x1')]||'none';this[_0xe30c('0x2')]=_0x2bae8a['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xb0a9=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xb0a9,0xbd));var _0x9b0a=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb0a9[_0xf50820];return _0x2a9b10;};'use strict';function voiceExtension(_0x36a013){this['id']=_0x36a013['id']||0x0;this[_0x9b0a('0x0')]=_0x36a013[_0x9b0a('0x0')]||'';this[_0x9b0a('0x1')]=_0x36a013['recordingFormat']||_0x9b0a('0x2');this[_0x9b0a('0x3')]=_0x36a013[_0x9b0a('0x3')]||![];}module[_0x9b0a('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 6e2f7b8..4a8e53d 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 _0xfcfa=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls'];(function(_0x37c46b,_0x211aee){var _0x1ae8f7=function(_0x2adc97){while(--_0x2adc97){_0x37c46b['push'](_0x37c46b['shift']());}};_0x1ae8f7(++_0x211aee);}(_0xfcfa,0xfa));var _0xafcf=function(_0x503ea8,_0x39fd83){_0x503ea8=_0x503ea8-0x0;var _0x1a18f8=_0xfcfa[_0x503ea8];return _0x1a18f8;};'use strict';var statusDesc=[_0xafcf('0x0'),_0xafcf('0x1'),_0xafcf('0x2'),_0xafcf('0x3'),_0xafcf('0x4'),_0xafcf('0x5'),_0xafcf('0x6'),_0xafcf('0x7'),_0xafcf('0x8')];var monitorFormat={'wav':_0xafcf('0x9'),'wav49':_0xafcf('0xa'),'gsm':'gsm'};var strategy={'rrmemory':_0xafcf('0xb'),'roundrobin':_0xafcf('0xc')};function VoiceQueue(_0x187792){this['id']=_0x187792['id']||0x0;this[_0xafcf('0xd')]=_0x187792[_0xafcf('0xd')]||'';this[_0xafcf('0xe')]=_0x187792[_0xafcf('0xe')]||'';this[_0xafcf('0xf')]=_0x187792['type']||'inbound';this[_0xafcf('0x10')]=0x0;this['talking']=0x0;this[_0xafcf('0x11')]=0x0;this[_0xafcf('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xafcf('0x13')]=0x0;this[_0xafcf('0x14')]=0x0;this[_0xafcf('0x15')]=0x0;this['loggedIn']=0x0;this[_0xafcf('0x16')]=0x0;this[_0xafcf('0x17')]=_0x187792['acw']||![];this[_0xafcf('0x18')]=_0x187792[_0xafcf('0x18')]||0xa;this['autopause']=_0x187792['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0xafcf('0x19')]='';this[_0xafcf('0x1a')]=0x0;this[_0xafcf('0x1b')]=0x0;this['dialTimezone']=_0x187792[_0xafcf('0x1c')]||null;this[_0xafcf('0x1d')]=_0x187792[_0xafcf('0x1d')]?_0x187792['dialGlobalInterval']:null;this[_0xafcf('0x1e')]=_0x187792[_0xafcf('0x1e')];this[_0xafcf('0x1f')]=_0x187792[_0xafcf('0x1f')]||'progressive';this['dialLimitChannel']=_0x187792['dialLimitChannel']||0x0;this[_0xafcf('0x20')]=_0x187792[_0xafcf('0x20')]||0x0;this[_0xafcf('0x21')]=_0x187792[_0xafcf('0x21')]||0x1;this[_0xafcf('0x22')]=_0x187792[_0xafcf('0x22')]||_0xafcf('0x23');this[_0xafcf('0x24')]=_0x187792[_0xafcf('0x24')]||0.03;this[_0xafcf('0x25')]=_0x187792[_0xafcf('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x187792[_0xafcf('0x26')]||_0xafcf('0x27');this[_0xafcf('0x28')]=_0x187792[_0xafcf('0x28')]||_0xafcf('0x27');this[_0xafcf('0x29')]=_0x187792[_0xafcf('0x29')]||0x1e;this[_0xafcf('0x2a')]=_0x187792['dialQueueOptions']||_0xafcf('0x2b');this['dialQueueTimeout']=_0x187792[_0xafcf('0x2c')]||0x3;this[_0xafcf('0x2d')]=_0x187792[_0xafcf('0x2d')]||undefined;this[_0xafcf('0x2e')]=_0x187792[_0xafcf('0x2e')]||0x3;this[_0xafcf('0x2f')]=_0x187792[_0xafcf('0x2f')]||0x96;this[_0xafcf('0x30')]=_0x187792['dialBusyMaxRetry']||0x3;this[_0xafcf('0x31')]=_0x187792[_0xafcf('0x31')]||0x96;this['dialNoAnswerMaxRetry']=_0x187792[_0xafcf('0x32')]||0x3;this[_0xafcf('0x33')]=_0x187792['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x187792['dialNoSuchNumberMaxRetry']||0x3;this[_0xafcf('0x34')]=_0x187792[_0xafcf('0x34')]||0x96;this[_0xafcf('0x35')]=_0x187792[_0xafcf('0x35')]||0x3;this[_0xafcf('0x36')]=_0x187792[_0xafcf('0x36')]||0x96;this['dialAbandonedMaxRetry']=_0x187792[_0xafcf('0x37')]||0x3;this[_0xafcf('0x38')]=_0x187792[_0xafcf('0x38')]||0x96;this[_0xafcf('0x39')]=_0x187792['dialMachineMaxRetry']||0x3;this[_0xafcf('0x3a')]=_0x187792[_0xafcf('0x3a')]||0x96;this[_0xafcf('0x3b')]=_0x187792[_0xafcf('0x3b')]||0x3;this[_0xafcf('0x3c')]=_0x187792['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x187792[_0xafcf('0x3d')]||0x4;this[_0xafcf('0x3e')]=_0x187792[_0xafcf('0x3e')]?_0x187792[_0xafcf('0x3e')]:undefined;this[_0xafcf('0x3f')]=_0x187792[_0xafcf('0x3f')]?_0x187792['TrunkBackup']:undefined;this[_0xafcf('0x40')]=_0x187792[_0xafcf('0x40')]||undefined;this[_0xafcf('0x41')]=_0x187792[_0xafcf('0x41')]?_0x187792[_0xafcf('0x41')]:undefined;this[_0xafcf('0x42')]=_0x187792['dialOrderByScheduledAt']||_0xafcf('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x187792[_0xafcf('0x44')]||undefined;this[_0xafcf('0x45')]=_0x187792['dialCutDigit']||undefined;this[_0xafcf('0x46')]=strategy[_0x187792[_0xafcf('0x46')]]||_0xafcf('0xb');this[_0xafcf('0x47')]=!![];this[_0xafcf('0x48')]=_0x187792['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x187792[_0xafcf('0x49')];this[_0xafcf('0x4a')]=_0x187792['dialAMDGreeting'];this[_0xafcf('0x4b')]=_0x187792[_0xafcf('0x4b')];this[_0xafcf('0x4c')]=_0x187792['dialAMDTotalAnalysisTime'];this[_0xafcf('0x4d')]=_0x187792[_0xafcf('0x4d')];this['dialAMDBetweenWordsSilence']=_0x187792[_0xafcf('0x4e')];this[_0xafcf('0x4f')]=_0x187792[_0xafcf('0x4f')];this['dialAMDSilenceThreshold']=_0x187792[_0xafcf('0x50')];this['dialAMDMaximumWordLength']=_0x187792[_0xafcf('0x51')];this[_0xafcf('0x52')]=0x0;this[_0xafcf('0x53')]=0x0;this['timeout']=_0x187792['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xafcf('0x54')]=0x0;this[_0xafcf('0x55')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xafcf('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xafcf('0x57')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xafcf('0x58')]=0x0;this[_0xafcf('0x59')]=0x0;this['outboundReCallsDay']=0x0;this[_0xafcf('0x5a')]=0x0;this[_0xafcf('0x5b')]=undefined;this['startPredictive']=undefined;this[_0xafcf('0x5c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xafcf('0x5d')]=0x0;this[_0xafcf('0x5e')]=0x0;this[_0xafcf('0x5f')]=0x0;this[_0xafcf('0x60')]=0x0;this[_0xafcf('0x61')]=0x0;this[_0xafcf('0x62')]=0x0;this[_0xafcf('0x63')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x187792['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xafcf('0x64')]=_0x187792[_0xafcf('0x65')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xafcf('0x66')]=0x0;this[_0xafcf('0x67')]=0x1;this[_0xafcf('0x68')]=0x0;this[_0xafcf('0x69')]=0x0;this[_0xafcf('0x6a')]=0x0;this[_0xafcf('0x6b')]=0x0;this['dialRecallMeTimeout']=_0x187792['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x187792[_0xafcf('0x6c')]||![];this['dialPreviewAutoRecallMe']=!!_0x187792[_0xafcf('0x6d')]||![];this[_0xafcf('0x6e')]=_0x187792[_0xafcf('0x6e')]||undefined;this[_0xafcf('0x6f')]=_0x187792['dialAgiAfterHangupClient']||![];this[_0xafcf('0x70')]=_0x187792['dialAgiAfterHangupAgent']||![];this[_0xafcf('0xe')]=monitorFormat[_0x187792[_0xafcf('0xe')]]?monitorFormat[_0x187792['monitor_format']]:undefined;this[_0xafcf('0x71')]=_0x187792[_0xafcf('0x71')]||![];this[_0xafcf('0x72')]=_0x187792[_0xafcf('0x72')]?_0x187792[_0xafcf('0x72')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x4e4f=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','ringinuse','wav49','gsm','rrmemory','name','type','talking','total','sumHoldTime','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x1e61fa,_0x546690){var _0x19d634=function(_0x1f3c7c){while(--_0x1f3c7c){_0x1e61fa['push'](_0x1e61fa['shift']());}};_0x19d634(++_0x546690);}(_0x4e4f,0x103));var _0xf4e4=function(_0xef650a,_0x3c8465){_0xef650a=_0xef650a-0x0;var _0x27a99a=_0x4e4f[_0xef650a];return _0x27a99a;};'use strict';var statusDesc=[_0xf4e4('0x0'),_0xf4e4('0x1'),'inuse','busy',_0xf4e4('0x2'),'unavailable','ringing',_0xf4e4('0x3'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xf4e4('0x4'),'gsm':_0xf4e4('0x5')};var strategy={'rrmemory':_0xf4e4('0x6'),'roundrobin':'roundrobin'};function VoiceQueue(_0x4e98c4){this['id']=_0x4e98c4['id']||0x0;this[_0xf4e4('0x7')]=_0x4e98c4[_0xf4e4('0x7')]||'';this['monitor_format']=_0x4e98c4['monitor_format']||'';this[_0xf4e4('0x8')]=_0x4e98c4[_0xf4e4('0x8')]||'inbound';this['waiting']=0x0;this[_0xf4e4('0x9')]=0x0;this[_0xf4e4('0xa')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xf4e4('0xb')]=0x0;this[_0xf4e4('0xc')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xf4e4('0xd')]=0x0;this[_0xf4e4('0xe')]=0x0;this[_0xf4e4('0xf')]=_0x4e98c4['acw']||![];this['acwTimeout']=_0x4e98c4[_0xf4e4('0x10')]||0xa;this[_0xf4e4('0x11')]=_0x4e98c4[_0xf4e4('0x11')]||'no';this[_0xf4e4('0x12')]=!![];this[_0xf4e4('0x13')]='';this[_0xf4e4('0x14')]=0x0;this[_0xf4e4('0x15')]=0x0;this['dialTimezone']=_0x4e98c4[_0xf4e4('0x16')]||null;this['dialGlobalInterval']=_0x4e98c4['dialGlobalInterval']?_0x4e98c4['dialGlobalInterval']:null;this[_0xf4e4('0x17')]=_0x4e98c4[_0xf4e4('0x17')];this['dialMethod']=_0x4e98c4['dialMethod']||_0xf4e4('0x18');this[_0xf4e4('0x19')]=_0x4e98c4[_0xf4e4('0x19')]||0x0;this[_0xf4e4('0x1a')]=_0x4e98c4[_0xf4e4('0x1a')]||0x0;this['dialPowerLevel']=_0x4e98c4['dialPowerLevel']||0x1;this[_0xf4e4('0x1b')]=_0x4e98c4[_0xf4e4('0x1b')]||_0xf4e4('0x1c');this[_0xf4e4('0x1d')]=_0x4e98c4['dialPredictiveOptimizationPercentage']||0.03;this[_0xf4e4('0x1e')]=_0x4e98c4[_0xf4e4('0x1e')]||0x258;this[_0xf4e4('0x1f')]=_0x4e98c4[_0xf4e4('0x1f')]||_0xf4e4('0x20');this['dialOriginateCallerIdNumber']=_0x4e98c4[_0xf4e4('0x21')]||_0xf4e4('0x20');this[_0xf4e4('0x22')]=_0x4e98c4[_0xf4e4('0x22')]||0x1e;this[_0xf4e4('0x23')]=_0x4e98c4[_0xf4e4('0x23')]||_0xf4e4('0x24');this['dialQueueTimeout']=_0x4e98c4[_0xf4e4('0x25')]||0x3;this[_0xf4e4('0x26')]=_0x4e98c4[_0xf4e4('0x26')]||undefined;this[_0xf4e4('0x27')]=_0x4e98c4[_0xf4e4('0x27')]||0x3;this[_0xf4e4('0x28')]=_0x4e98c4['dialCongestionRetryFrequency']||0x96;this[_0xf4e4('0x29')]=_0x4e98c4['dialBusyMaxRetry']||0x3;this[_0xf4e4('0x2a')]=_0x4e98c4[_0xf4e4('0x2a')]||0x96;this['dialNoAnswerMaxRetry']=_0x4e98c4[_0xf4e4('0x2b')]||0x3;this[_0xf4e4('0x2c')]=_0x4e98c4[_0xf4e4('0x2c')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4e98c4['dialNoSuchNumberMaxRetry']||0x3;this[_0xf4e4('0x2d')]=_0x4e98c4[_0xf4e4('0x2d')]||0x96;this['dialDropMaxRetry']=_0x4e98c4[_0xf4e4('0x2e')]||0x3;this[_0xf4e4('0x2f')]=_0x4e98c4['dialDropRetryFrequency']||0x96;this[_0xf4e4('0x30')]=_0x4e98c4[_0xf4e4('0x30')]||0x3;this[_0xf4e4('0x31')]=_0x4e98c4[_0xf4e4('0x31')]||0x96;this[_0xf4e4('0x32')]=_0x4e98c4[_0xf4e4('0x32')]||0x3;this[_0xf4e4('0x33')]=_0x4e98c4[_0xf4e4('0x33')]||0x96;this[_0xf4e4('0x34')]=_0x4e98c4[_0xf4e4('0x34')]||0x3;this[_0xf4e4('0x35')]=_0x4e98c4[_0xf4e4('0x35')]||0x96;this[_0xf4e4('0x36')]=_0x4e98c4[_0xf4e4('0x36')]||0x4;this[_0xf4e4('0x37')]=_0x4e98c4[_0xf4e4('0x37')]?_0x4e98c4['Trunk']:undefined;this['TrunkBackup']=_0x4e98c4['TrunkBackup']?_0x4e98c4[_0xf4e4('0x38')]:undefined;this[_0xf4e4('0x39')]=_0x4e98c4[_0xf4e4('0x39')]||undefined;this[_0xf4e4('0x3a')]=_0x4e98c4[_0xf4e4('0x3a')]?_0x4e98c4[_0xf4e4('0x3a')]:undefined;this[_0xf4e4('0x3b')]=_0x4e98c4[_0xf4e4('0x3b')]||_0xf4e4('0x3c');this[_0xf4e4('0x3d')]=_0x4e98c4[_0xf4e4('0x3d')]||undefined;this['dialCutDigit']=_0x4e98c4['dialCutDigit']||undefined;this[_0xf4e4('0x3e')]=strategy[_0x4e98c4['strategy']]||'rrmemory';this[_0xf4e4('0x3f')]=!![];this[_0xf4e4('0x40')]=_0x4e98c4[_0xf4e4('0x40')]||![];this['dialAMDInitialSilence']=_0x4e98c4['dialAMDInitialSilence'];this[_0xf4e4('0x41')]=_0x4e98c4[_0xf4e4('0x41')];this[_0xf4e4('0x42')]=_0x4e98c4[_0xf4e4('0x42')];this[_0xf4e4('0x43')]=_0x4e98c4[_0xf4e4('0x43')];this['dialAMDMinWordLength']=_0x4e98c4[_0xf4e4('0x44')];this[_0xf4e4('0x45')]=_0x4e98c4['dialAMDBetweenWordsSilence'];this[_0xf4e4('0x46')]=_0x4e98c4[_0xf4e4('0x46')];this[_0xf4e4('0x47')]=_0x4e98c4['dialAMDSilenceThreshold'];this[_0xf4e4('0x48')]=_0x4e98c4[_0xf4e4('0x48')];this['outboundRejectCallsDay']=0x0;this[_0xf4e4('0x49')]=0x0;this[_0xf4e4('0x4a')]=_0x4e98c4[_0xf4e4('0x4a')];this[_0xf4e4('0x4b')]=0x0;this[_0xf4e4('0x4c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xf4e4('0x4d')]=0x0;this[_0xf4e4('0x4e')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xf4e4('0x4f')]=0x0;this[_0xf4e4('0x50')]=0x0;this[_0xf4e4('0x51')]=0x0;this[_0xf4e4('0x52')]=0x0;this[_0xf4e4('0x53')]=0x0;this[_0xf4e4('0x54')]=0x0;this[_0xf4e4('0x55')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xf4e4('0x56')]=undefined;this['startPredictive']=undefined;this[_0xf4e4('0x57')]=undefined;this[_0xf4e4('0x58')]=1.05;this[_0xf4e4('0x59')]=0x0;this[_0xf4e4('0x5a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf4e4('0x5b')]=0x0;this[_0xf4e4('0x5c')]=0x0;this[_0xf4e4('0x5d')]=0x0;this[_0xf4e4('0x5e')]=_0x4e98c4[_0xf4e4('0x5f')]||0x14;this['predictiveIntervalMinThreshold']=_0x4e98c4['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xf4e4('0x60')]=0x1;this[_0xf4e4('0x61')]=0x0;this[_0xf4e4('0x62')]=0x0;this[_0xf4e4('0x63')]=0x0;this['erlangBusyFactor']=0x0;this[_0xf4e4('0x64')]=_0x4e98c4[_0xf4e4('0x64')]||0x1e;this[_0xf4e4('0x65')]=_0x4e98c4[_0xf4e4('0x65')]||![];this['dialPreviewAutoRecallMe']=!!_0x4e98c4[_0xf4e4('0x66')]||![];this['dialQueueProject2']=_0x4e98c4[_0xf4e4('0x67')]||undefined;this[_0xf4e4('0x68')]=_0x4e98c4[_0xf4e4('0x68')]||![];this[_0xf4e4('0x69')]=_0x4e98c4['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x4e98c4[_0xf4e4('0x6a')]]?monitorFormat[_0x4e98c4[_0xf4e4('0x6a')]]:undefined;this[_0xf4e4('0x6b')]=_0x4e98c4[_0xf4e4('0x6b')]||![];this[_0xf4e4('0x6c')]=_0x4e98c4['mandatoryDispositionPause']?_0x4e98c4['mandatoryDispositionPause']:undefined;}module[_0xf4e4('0x6d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d2af608..3fc6986 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 _0xcf15=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x5ecb95,_0x5be04b){var _0x3bcb75=function(_0x57ae1a){while(--_0x57ae1a){_0x5ecb95['push'](_0x5ecb95['shift']());}};_0x3bcb75(++_0x5be04b);}(_0xcf15,0xe4));var _0x5cf1=function(_0x2fb561,_0x579dbf){_0x2fb561=_0x2fb561-0x0;var _0x2b7be3=_0xcf15[_0x2fb561];return _0x2b7be3;};'use strict';function VtigerAccount(_0x2d60f2){this['id']=_0x2d60f2['id']||0x0;this[_0x5cf1('0x0')]=_0x2d60f2[_0x5cf1('0x0')]||'';this[_0x5cf1('0x1')]=_0x2d60f2[_0x5cf1('0x1')]||'';this['accessKey']=_0x2d60f2[_0x5cf1('0x2')]||'';this[_0x5cf1('0x3')]=_0x2d60f2[_0x5cf1('0x3')]||'';this['serverUrl']=_0x2d60f2[_0x5cf1('0x4')]||'';this[_0x5cf1('0x5')]=_0x2d60f2[_0x5cf1('0x5')]||{};}module[_0x5cf1('0x6')]=VtigerAccount; \ No newline at end of file +var _0xc405=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xc405,0x1f2));var _0x5c40=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0xc405[_0x44c768];return _0x55daf5;};'use strict';function VtigerAccount(_0x4b9f61){this['id']=_0x4b9f61['id']||0x0;this[_0x5c40('0x0')]=_0x4b9f61[_0x5c40('0x0')]||'';this[_0x5c40('0x1')]=_0x4b9f61[_0x5c40('0x1')]||'';this[_0x5c40('0x2')]=_0x4b9f61[_0x5c40('0x2')]||'';this[_0x5c40('0x3')]=_0x4b9f61[_0x5c40('0x3')]||'';this[_0x5c40('0x4')]=_0x4b9f61[_0x5c40('0x4')]||'';this[_0x5c40('0x5')]=_0x4b9f61[_0x5c40('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index b038630..424b838 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 _0x5f58=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x2d2006,_0x2d27b3){var _0x442661=function(_0x4838ea){while(--_0x4838ea){_0x2d2006['push'](_0x2d2006['shift']());}};_0x442661(++_0x2d27b3);}(_0x5f58,0x1f1));var _0x85f5=function(_0x1922d2,_0x224ada){_0x1922d2=_0x1922d2-0x0;var _0x268072=_0x5f58[_0x1922d2];return _0x268072;};'use strict';function ZendeskAccount(_0x5e7dae){this['id']=_0x5e7dae['id']||0x0;this[_0x85f5('0x0')]=_0x5e7dae[_0x85f5('0x0')]||'';this[_0x85f5('0x1')]=_0x5e7dae[_0x85f5('0x1')]||'';this[_0x85f5('0x2')]=_0x5e7dae[_0x85f5('0x2')]||'';this[_0x85f5('0x3')]=_0x5e7dae[_0x85f5('0x3')]||'';this[_0x85f5('0x4')]=_0x5e7dae[_0x85f5('0x4')]||'';this['authType']=_0x5e7dae[_0x85f5('0x5')]||'';this[_0x85f5('0x6')]=_0x5e7dae[_0x85f5('0x6')]||_0x85f5('0x7');this[_0x85f5('0x8')]=_0x5e7dae[_0x85f5('0x8')]||'';this[_0x85f5('0x9')]=_0x5e7dae['Configurations']||{};}module[_0x85f5('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x7c30=['Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7c30,0xeb));var _0x07c3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7c30[_0x3947c9];return _0x2e7871;};'use strict';function ZendeskAccount(_0x2c22cf){this['id']=_0x2c22cf['id']||0x0;this[_0x07c3('0x0')]=_0x2c22cf[_0x07c3('0x0')]||'';this[_0x07c3('0x1')]=_0x2c22cf['username']||'';this[_0x07c3('0x2')]=_0x2c22cf[_0x07c3('0x2')]||'';this[_0x07c3('0x3')]=_0x2c22cf[_0x07c3('0x3')]||'';this[_0x07c3('0x4')]=_0x2c22cf[_0x07c3('0x4')]||'';this['authType']=_0x2c22cf[_0x07c3('0x5')]||'';this[_0x07c3('0x6')]=_0x2c22cf[_0x07c3('0x6')]||_0x07c3('0x7');this['serverUrl']=_0x2c22cf['serverUrl']||'';this[_0x07c3('0x8')]=_0x2c22cf['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5949395..a47351b 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 _0xc60a=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','refreshToken'];(function(_0x461a32,_0xbcf717){var _0x54957f=function(_0x97c5e9){while(--_0x97c5e9){_0x461a32['push'](_0x461a32['shift']());}};_0x54957f(++_0xbcf717);}(_0xc60a,0x1e7));var _0xac60=function(_0x2fad19,_0x416481){_0x2fad19=_0x2fad19-0x0;var _0x4e81cd=_0xc60a[_0x2fad19];return _0x4e81cd;};'use strict';function ZohoAccount(_0x1366cc){this['id']=_0x1366cc['id']||0x0;this[_0xac60('0x0')]=_0x1366cc[_0xac60('0x0')]||'';this[_0xac60('0x1')]=_0x1366cc[_0xac60('0x1')]||'';this[_0xac60('0x2')]=_0x1366cc[_0xac60('0x2')]||'';this[_0xac60('0x3')]=_0x1366cc[_0xac60('0x3')]||'';this[_0xac60('0x4')]=_0x1366cc['clientId']||'';this[_0xac60('0x5')]=_0x1366cc['clientSecret']||'';this[_0xac60('0x6')]=_0x1366cc[_0xac60('0x6')]||'';this['code']=_0x1366cc['code']||'';this[_0xac60('0x7')]=_0x1366cc[_0xac60('0x7')]||'';this[_0xac60('0x8')]=_0x1366cc[_0xac60('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xfa09=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xfa09,0x170));var _0x9fa0=function(_0x2d923d,_0x10bc7b){_0x2d923d=_0x2d923d-0x0;var _0x31df14=_0xfa09[_0x2d923d];return _0x31df14;};'use strict';function ZohoAccount(_0x364456){this['id']=_0x364456['id']||0x0;this['name']=_0x364456[_0x9fa0('0x0')]||'';this[_0x9fa0('0x1')]=_0x364456[_0x9fa0('0x1')]||'';this['host']=_0x364456[_0x9fa0('0x2')]||'';this[_0x9fa0('0x3')]=_0x364456['zone']||'';this[_0x9fa0('0x4')]=_0x364456[_0x9fa0('0x4')]||'';this['clientSecret']=_0x364456[_0x9fa0('0x5')]||'';this['serverUrl']=_0x364456[_0x9fa0('0x6')]||'';this[_0x9fa0('0x7')]=_0x364456['code']||'';this['refreshToken']=_0x364456[_0x9fa0('0x8')]||'';this[_0x9fa0('0x9')]=_0x364456[_0x9fa0('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index e7bbbf9..4c950f8 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 _0x5253=['lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','format','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','SIP/%s','calleridname','Contact','phone'];(function(_0x3f4633,_0x32cb32){var _0x3299c7=function(_0x5a3260){while(--_0x5a3260){_0x3f4633['push'](_0x3f4633['shift']());}};_0x3299c7(++_0x32cb32);}(_0x5253,0x169));var _0x3525=function(_0x1b6b35,_0x593acc){_0x1b6b35=_0x1b6b35-0x0;var _0x1e1564=_0x5253[_0x1b6b35];return _0x1e1564;};'use strict';var util=require(_0x3525('0x0'));var _=require(_0x3525('0x1'));var moment=require(_0x3525('0x2'));function checkNameSurname(_0xde7850,_0x138428,_0x397464){var _0x2c4848='';if(!_['isNil'](_0x138428)&&_0x3525('0x3')===typeof _0x138428){_0x2c4848+=_0x138428;}if(!_[_0x3525('0x4')](_0x397464)&&_0x3525('0x3')===typeof _0x397464){_0x2c4848+='\x20'+_0x397464;}if(_0x2c4848!==''){return _0x2c4848;}return _0xde7850;}function Action(_0x444b9a,_0x2aeb56,_0x41a36a,_0x103ae3,_0x162691){this['uniqueid']=_0x41a36a||undefined;this[_0x3525('0x5')]=_0x444b9a['id'];this[_0x3525('0x6')]=_0x2aeb56['name'];this[_0x3525('0x7')]=_0x2aeb56['type'];this[_0x3525('0x8')]=_0x3525('0x6');this[_0x3525('0x9')]=![];this[_0x3525('0xa')]=_[_0x3525('0x4')](_0x444b9a[_0x3525('0xb')])?undefined:_0x444b9a['Agent'][_0x3525('0xc')];this['channelAgent']=this[_0x3525('0xa')]?util['format'](_0x3525('0xd'),this[_0x3525('0xa')]):_0x103ae3||undefined;this[_0x3525('0xe')]=checkNameSurname(_0x444b9a[_0x3525('0xf')][_0x3525('0x10')],_0x444b9a['Contact']['firstName'],_0x444b9a[_0x3525('0xf')][_0x3525('0x11')]);this[_0x3525('0x12')]=_0x444b9a[_0x3525('0x12')]||![];this[_0x3525('0x13')]=_0x444b9a[_0x3525('0xf')][_0x3525('0x10')];this[_0x3525('0x14')]=_0x444b9a[_0x3525('0x14')];this['countbusyretry']=_0x444b9a[_0x3525('0x15')]||0x0;this[_0x3525('0x16')]=_0x444b9a['countcongestionretry']||0x0;this['countnoanswerretry']=_0x444b9a[_0x3525('0x17')]||0x0;this[_0x3525('0x18')]=(_0x444b9a[_0x3525('0x15')]||0x0)+(_0x444b9a[_0x3525('0x16')]||0x0)+(_0x444b9a[_0x3525('0x17')]||0x0)+(_0x444b9a['countnosuchnumberretry']||0x0)+(_0x444b9a[_0x3525('0x19')]||0x0)+(_0x444b9a[_0x3525('0x1a')]||0x0)+(_0x444b9a['countmachineretry']||0x0)+(_0x444b9a[_0x3525('0x1b')]||0x0);this[_0x3525('0x1c')]=_0x444b9a[_0x3525('0x1c')]||0x0;this[_0x3525('0x19')]=_0x444b9a[_0x3525('0x19')]||0x0;this[_0x3525('0x1a')]=_0x444b9a[_0x3525('0x1a')]||0x0;this[_0x3525('0x1d')]=_0x444b9a[_0x3525('0x1d')]||0x0;this[_0x3525('0x1b')]=_0x444b9a[_0x3525('0x1b')]||0x0;this[_0x3525('0x1e')]=_0x444b9a[_0x3525('0x1e')];this[_0x3525('0x1f')]=_0x444b9a[_0x3525('0x1f')];this[_0x3525('0x20')]=_0x444b9a[_0x3525('0x20')];this['recallme']=_0x444b9a[_0x3525('0x21')];this['ContactId']=_0x444b9a[_0x3525('0x22')];this[_0x3525('0x23')]=_0x444b9a[_0x3525('0x23')];this[_0x3525('0x24')]=_[_0x3525('0x4')](_0x444b9a[_0x3525('0xb')])?_0x444b9a[_0x3525('0x24')]:_0x444b9a['Agent']['id'];this['VoiceQueueId']=_0x444b9a['VoiceQueueId'];this[_0x3525('0x25')]='';this[_0x3525('0x26')]='';}Action['prototype']['getCaller']=function(){return util[_0x3525('0x27')](_0x3525('0x28'),this[_0x3525('0xe')],this[_0x3525('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x0f55=['membername','Agent','channelAgent','format','calleridname','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer'];(function(_0x2f3f24,_0x55fd5e){var _0x36feae=function(_0x205b6b){while(--_0x205b6b){_0x2f3f24['push'](_0x2f3f24['shift']());}};_0x36feae(++_0x55fd5e);}(_0x0f55,0x74));var _0x50f5=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x0f55[_0x57fc2a];return _0xa839b;};'use strict';var util=require(_0x50f5('0x0'));var _=require(_0x50f5('0x1'));var moment=require('moment');function checkNameSurname(_0x3277a0,_0xfa36f9,_0x4953af){var _0x3b6e0a='';if(!_[_0x50f5('0x2')](_0xfa36f9)&&_0x50f5('0x3')===typeof _0xfa36f9){_0x3b6e0a+=_0xfa36f9;}if(!_[_0x50f5('0x2')](_0x4953af)&&'string'===typeof _0x4953af){_0x3b6e0a+='\x20'+_0x4953af;}if(_0x3b6e0a!==''){return _0x3b6e0a;}return _0x3277a0;}function Action(_0x3afee8,_0x2895bc,_0x45da0b,_0x28f26e,_0x1575cd){this[_0x50f5('0x4')]=_0x45da0b||undefined;this['idContact']=_0x3afee8['id'];this[_0x50f5('0x5')]=_0x2895bc[_0x50f5('0x6')];this[_0x50f5('0x7')]=_0x2895bc['type'];this[_0x50f5('0x8')]=_0x50f5('0x5');this[_0x50f5('0x9')]=![];this[_0x50f5('0xa')]=_[_0x50f5('0x2')](_0x3afee8[_0x50f5('0xb')])?undefined:_0x3afee8[_0x50f5('0xb')]['name'];this[_0x50f5('0xc')]=this['membername']?util[_0x50f5('0xd')]('SIP/%s',this[_0x50f5('0xa')]):_0x28f26e||undefined;this[_0x50f5('0xe')]=checkNameSurname(_0x3afee8['Contact'][_0x50f5('0xf')],_0x3afee8[_0x50f5('0x10')]['firstName'],_0x3afee8[_0x50f5('0x10')][_0x50f5('0x11')]);this[_0x50f5('0x12')]=_0x3afee8[_0x50f5('0x12')]||![];this[_0x50f5('0x13')]=_0x3afee8['Contact'][_0x50f5('0xf')];this[_0x50f5('0x14')]=_0x3afee8[_0x50f5('0x14')];this[_0x50f5('0x15')]=_0x3afee8[_0x50f5('0x15')]||0x0;this['countcongestionretry']=_0x3afee8[_0x50f5('0x16')]||0x0;this[_0x50f5('0x17')]=_0x3afee8[_0x50f5('0x17')]||0x0;this[_0x50f5('0x18')]=(_0x3afee8[_0x50f5('0x15')]||0x0)+(_0x3afee8[_0x50f5('0x16')]||0x0)+(_0x3afee8['countnoanswerretry']||0x0)+(_0x3afee8['countnosuchnumberretry']||0x0)+(_0x3afee8[_0x50f5('0x19')]||0x0)+(_0x3afee8['countabandonedretry']||0x0)+(_0x3afee8['countmachineretry']||0x0)+(_0x3afee8['countagentrejectretry']||0x0);this[_0x50f5('0x1a')]=_0x3afee8['countnosuchnumberretry']||0x0;this[_0x50f5('0x19')]=_0x3afee8['countdropretry']||0x0;this[_0x50f5('0x1b')]=_0x3afee8[_0x50f5('0x1b')]||0x0;this[_0x50f5('0x1c')]=_0x3afee8[_0x50f5('0x1c')]||0x0;this[_0x50f5('0x1d')]=_0x3afee8[_0x50f5('0x1d')]||0x0;this['callback']=_0x3afee8[_0x50f5('0x1e')];this[_0x50f5('0x1f')]=_0x3afee8['callbackuniqueid'];this[_0x50f5('0x20')]=_0x3afee8[_0x50f5('0x20')];this[_0x50f5('0x21')]=_0x3afee8['recallme'];this[_0x50f5('0x22')]=_0x3afee8[_0x50f5('0x22')];this[_0x50f5('0x23')]=_0x3afee8[_0x50f5('0x23')];this['UserId']=_[_0x50f5('0x2')](_0x3afee8[_0x50f5('0xb')])?_0x3afee8[_0x50f5('0x24')]:_0x3afee8[_0x50f5('0xb')]['id'];this['VoiceQueueId']=_0x3afee8['VoiceQueueId'];this[_0x50f5('0x25')]='';this[_0x50f5('0x26')]='';}Action['prototype'][_0x50f5('0x27')]=function(){return util[_0x50f5('0xd')](_0x50f5('0x28'),this[_0x50f5('0xe')],this[_0x50f5('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index fb0456f..6c0abb8 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 _0x723e=['variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','clockClearZombieChannels','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','isNil','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','talktime','[syncHangup][talking][decrement]','BUSY','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','Queue','agents','lookAgent','isEmpty','execCall','Queue:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','trim','substring','dialCutDigit','phone','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge'];(function(_0x16e09e,_0x319cc3){var _0x2d446e=function(_0x44ac7f){while(--_0x44ac7f){_0x16e09e['push'](_0x16e09e['shift']());}};_0x2d446e(++_0x319cc3);}(_0x723e,0x179));var _0xe723=function(_0x4f386e,_0x56ffdd){_0x4f386e=_0x4f386e-0x0;var _0x4694e2=_0x723e[_0x4f386e];return _0x4694e2;};'use strict';var util=require('util');var _=require(_0xe723('0x0'));var BPromise=require(_0xe723('0x1'));var uuid=require(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var md5=require(_0xe723('0x4'));var Redis=require(_0xe723('0x5'));var config=require(_0xe723('0x6'));var logger=require(_0xe723('0x7'))(_0xe723('0x8'));var loggerAction=require(_0xe723('0x7'))('actionPreview');var ami=require(_0xe723('0x9'));var rpcDb=require(_0xe723('0xa'));var Action=require(_0xe723('0xb'));var ut=require(_0xe723('0xc'));config[_0xe723('0xd')]=_[_0xe723('0xe')](config[_0xe723('0xd')],{'host':_0xe723('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe723('0xd')]));var Sequence=function(){};Sequence[_0xe723('0x10')][_0xe723('0x11')]=function(_0x5a43fb){this[_0xe723('0x12')]=this[_0xe723('0x12')]?this[_0xe723('0x12')]['finally'](_0x5a43fb):_0x5a43fb();};function Preview(_0x146098){this[_0xe723('0x13')]=new Sequence();this[_0xe723('0x14')]=_0x146098[_0xe723('0x15')];this[_0xe723('0x16')]=_0x146098['trunks'];this[_0xe723('0x17')]={};this['agents']=_0x146098['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xe723('0x18')][_0xe723('0x19')](this));ami['on'](_0xe723('0x1a'),this[_0xe723('0x1b')][_0xe723('0x19')](this));ami['on']('hanguprequest',this[_0xe723('0x1c')][_0xe723('0x19')](this));ami['on'](_0xe723('0x1d'),this[_0xe723('0x1e')][_0xe723('0x19')](this));ami['on'](_0xe723('0x1f'),this[_0xe723('0x20')][_0xe723('0x19')](this));ami['on'](_0xe723('0x21'),this[_0xe723('0x22')][_0xe723('0x19')](this));ami['on'](_0xe723('0x23'),this[_0xe723('0x24')][_0xe723('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xe723('0x19')](this));this[_0xe723('0x25')](this['campaignsPreview']);}function emit(_0x28caca,_0x2762e2,_0x5a8c73){io['to'](_0x28caca)[_0xe723('0x26')](_0x2762e2,_0x5a8c73);}function emitCampaignPreview(_0x52fe6e){if(_0x52fe6e[_0xe723('0x27')]===_0xe723('0x28')){var _0x3b82b2={'id':_0x52fe6e['id'],'name':_0x52fe6e[_0xe723('0x29')],'strategy':_0x52fe6e[_0xe723('0x2a')],'answered':_0x52fe6e[_0xe723('0x2b')],'available':_0x52fe6e[_0xe723('0x2c')],'loggedIn':_0x52fe6e[_0xe723('0x2d')],'pTalking':_0x52fe6e[_0xe723('0x2e')],'sumBillable':_0x52fe6e[_0xe723('0x2f')],'sumDuration':_0x52fe6e[_0xe723('0x30')],'sumHoldTime':_0x52fe6e[_0xe723('0x31')]||0x0,'talking':_0x52fe6e['talking'],'total':_0x52fe6e[_0xe723('0x32')],'type':_0x52fe6e['type'],'unmanaged':_0x52fe6e[_0xe723('0x33')],'abandoned':_0x52fe6e[_0xe723('0x34')],'waiting':_0x52fe6e[_0xe723('0x35')],'loggedInDb':_0x52fe6e[_0xe723('0x36')],'dialActive':_0x52fe6e[_0xe723('0x37')],'dialMethod':_0x52fe6e['dialMethod'],'dialOriginateCallerIdName':_0x52fe6e[_0xe723('0x38')],'dialOriginateCallerIdNumber':_0x52fe6e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x52fe6e['dialOriginateTimeout'],'dialPrefix':_0x52fe6e[_0xe723('0x39')],'outboundAnswerAgiCallsDay':_0x52fe6e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x52fe6e[_0xe723('0x3a')],'outboundBlacklistCallsDay':_0x52fe6e[_0xe723('0x3b')],'outboundBusyCallsDay':_0x52fe6e[_0xe723('0x3c')],'outboundCongestionCallsDay':_0x52fe6e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x52fe6e[_0xe723('0x3d')],'outboundDropCallsDayCallersExit':_0x52fe6e[_0xe723('0x3e')],'outboundDropCallsDayTimeout':_0x52fe6e['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x52fe6e[_0xe723('0x3f')],'outboundNoSuchCallsDay':_0x52fe6e['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x52fe6e['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x52fe6e[_0xe723('0x40')],'outboundRejectCallsDay':_0x52fe6e[_0xe723('0x41')],'outboundUnknownCallsDay':_0x52fe6e[_0xe723('0x42')],'outboundAbandonedCallsDay':_0x52fe6e[_0xe723('0x43')],'predictiveIntervalAnsweredCalls':_0x52fe6e['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x52fe6e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x52fe6e[_0xe723('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x52fe6e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x52fe6e[_0xe723('0x45')],'predictiveIntervalErlangCalls':_0x52fe6e[_0xe723('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x52fe6e[_0xe723('0x47')],'predictiveIntervalHitRate':_0x52fe6e[_0xe723('0x48')],'predictiveIntervalMultiplicativeFactor':_0x52fe6e[_0xe723('0x49')],'predictiveIntervalPauses':_0x52fe6e[_0xe723('0x4a')],'predictiveIntervalAvailable':_0x52fe6e[_0xe723('0x4b')],'predictiveIntervalTotalCalls':_0x52fe6e[_0xe723('0x4c')],'message':_0x52fe6e[_0xe723('0x4d')],'originated':_0x52fe6e[_0xe723('0x4e')],'erlangCalls':_0x52fe6e[_0xe723('0x4f')],'erlangCallToSecond':_0x52fe6e[_0xe723('0x50')],'erlangAbandonmentRate':_0x52fe6e[_0xe723('0x51')],'erlangBusyFactor':_0x52fe6e[_0xe723('0x52')],'startPredictive':_0x52fe6e['startPredictive'],'startProgressive':_0x52fe6e[_0xe723('0x53')]};if(_0x52fe6e['Trunk']){_0x3b82b2[_0xe723('0x54')]={'id':_0x52fe6e[_0xe723('0x54')]['id'],'name':_0x52fe6e['Trunk']['name'],'active':_0x52fe6e[_0xe723('0x54')][_0xe723('0x55')],'callerid':_0x52fe6e[_0xe723('0x54')][_0xe723('0x56')]};}if(_0x52fe6e[_0xe723('0x57')]){_0x3b82b2[_0xe723('0x57')]={'id':_0x52fe6e['Interval']['id'],'name':_0x52fe6e[_0xe723('0x57')][_0xe723('0x29')]};}var _0x1dc86f=md5(JSON[_0xe723('0x58')](_0x3b82b2));if(_0x52fe6e[_0xe723('0x4')]!==_0x1dc86f){_0x52fe6e[_0xe723('0x4')]=_0x1dc86f;emit(util[_0xe723('0x59')](_0xe723('0x5a'),_0x3b82b2[_0xe723('0x29')]),_0xe723('0x5b'),_0x3b82b2);}}}function emitVoiceQueueChannelRemove(_0x9918d9){logger[_0xe723('0x5c')](_0xe723('0x5d'),JSON[_0xe723('0x58')](_0x9918d9));emit(util[_0xe723('0x59')](_0xe723('0x5a'),_0x9918d9['name']),_0xe723('0x5e'),_0x9918d9);io[_0xe723('0x26')](_0xe723('0x5f'),_0x9918d9);}function notSendMessagesQueue(_0x3103de){if(_0x3103de['sendMessageOneNotActive']){if(_0x3103de['originated']===0x0&&_0x3103de[_0xe723('0x2e')]===0x0){_0x3103de[_0xe723('0x60')]=![];_0x3103de[_0xe723('0x2c')]=0x0;_0x3103de[_0xe723('0x61')]=0x0;_0x3103de['message']='NOT_ACTIVE';ut[_0xe723('0x62')](_0xe723('0x63'),_0x3103de[_0xe723('0x29')]+_0xe723('0x64'));}else{_0x3103de[_0xe723('0x4d')]=_0xe723('0x65');ut[_0xe723('0x62')](_0xe723('0x63'),_0x3103de[_0xe723('0x29')]+'\x20is\x20disactive');}emitCampaignPreview(_0x3103de);}}Preview['prototype'][_0xe723('0x25')]=function(){var _0x5bf636=this;setInterval(function(){_0x5bf636['syncCampaigns']();},0x7cf);};Preview[_0xe723('0x10')]['syncCampaigns']=function(){var _0x36272=this[_0xe723('0x14')];this[_0xe723('0x66')]+=0x1;for(var _0x2c2643 in _0x36272){if(_0x36272[_0xe723('0x67')](_0x2c2643)&&(_0x36272[_0x2c2643][_0xe723('0x68')]===_0xe723('0x8')||_0x36272[_0x2c2643]['dialMethod']==='booked')&&_0x36272[_0x2c2643][_0xe723('0x27')]==='outbound'){if(this[_0xe723('0x66')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xe723('0x69')]();}}if(_0x36272[_0xe723('0x67')](_0x2c2643)&&_0x36272[_0x2c2643][_0xe723('0x68')]===_0xe723('0x8')&&_0x36272[_0x2c2643][_0xe723('0x27')]===_0xe723('0x28')){if(_0x36272[_0x2c2643][_0xe723('0x37')]){this[_0xe723('0x6a')](_0x36272[_0x2c2643]);if(_0x36272[_0x2c2643][_0xe723('0x6b')])this['recallMe'](_0x36272[_0x2c2643]);}else{notSendMessagesQueue(_0x36272[_0x2c2643]);}}}};Preview['prototype'][_0xe723('0x6c')]=function(_0x23425b){var _0x7baf6f=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x7baf6f[_0xe723('0x17')][_0x23425b])){loggerAction[_0xe723('0x5c')](_0xe723('0x6d'),_0x23425b,'Queue',_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')],_0xe723('0x6f'),JSON[_0xe723('0x58')](_0x7baf6f[_0xe723('0x14')][_0x7baf6f['actions'][_0x23425b][_0xe723('0x6e')]]['originated']),_0xe723('0x70'),JSON['stringify'](_0x7baf6f['campaignsPreview'][_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')]][_0xe723('0x2e')]),JSON['stringify'](_0x7baf6f[_0xe723('0x17')][_0x23425b]['dialAnswer']),JSON[_0xe723('0x58')](_[_0xe723('0x71')](_0x7baf6f[_0xe723('0x17')][_0x23425b],[_0xe723('0x72'),_0xe723('0x73'),_0xe723('0x74'),_0xe723('0x75')])));return ami[_0xe723('0x76')]({'action':_0xe723('0x77'),'channel':_0x7baf6f['actions'][_0x23425b][_0xe723('0x78')]})[_0xe723('0x79')](function(_0x52def8){if(_0x52def8[_0xe723('0x4d')]===_0xe723('0x7a')){setTimeout(function(){if(_0x7baf6f['actions'][_0x23425b]){ut[_0xe723('0x7b')](_0x7baf6f['campaignsPreview'][_0x7baf6f['actions'][_0x23425b][_0xe723('0x6e')]],_0xe723('0x7c'));if(_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x7d')]===!![]){ut[_0xe723('0x7e')](_0x7baf6f['campaignsPreview'][_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')]],_0xe723('0x7c'));ut[_0xe723('0x7f')](_0xe723('0x80')+_0x23425b,_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')]);}ut[_0xe723('0x7f')](_0xe723('0x81')+_0x23425b,_0x7baf6f[_0xe723('0x17')][_0x23425b]['queue']);delete _0x7baf6f[_0xe723('0x17')][_0x23425b];}},0x2328);}});}});};Preview[_0xe723('0x10')][_0xe723('0x69')]=function(){var _0x4672be=this;loggerAction['info'](_0xe723('0x82'),_[_0xe723('0x83')](this['actions']));for(var _0x42e551 in this[_0xe723('0x17')]){if(_0x4672be[_0xe723('0x17')][_0xe723('0x67')](_0x42e551)){_0x4672be[_0xe723('0x6c')](_0x42e551);}}};Preview[_0xe723('0x10')]['recallMe']=function(_0x3a3dd7){var _0x508fda=this;rpcDb['getContactRecallMe'](_0x3a3dd7['id'],ut[_0xe723('0x84')](this['agents']))[_0xe723('0x85')](function(_0x2ef56d){if(!_[_0xe723('0x86')](_0x2ef56d)){for(var _0x45b93b=0x0;_0x45b93b<_0x2ef56d[_0xe723('0x87')];_0x45b93b+=0x1){if(ut['getDiff'](_0x2ef56d[_0x45b93b][_0xe723('0x88')])<_0x3a3dd7[_0xe723('0x89')]*0x3c){if(_0x2ef56d[_0x45b93b][_0xe723('0x8a')]&&!_0x2ef56d[_0x45b93b]['Agent']['voicePause']){_0x508fda[_0xe723('0x8b')](_0x2ef56d[_0x45b93b]['id'])[_0xe723('0x85')](ut[_0xe723('0x8c')]('[RecallMe]'))[_0xe723('0x79')](ut[_0xe723('0x8c')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x2ef56d[_0x45b93b]['id']);}}else{var _0x2556bf=new Action(_0x2ef56d[_0x45b93b],_0x3a3dd7);_0x2556bf[_0xe723('0x8d')]=moment()[_0xe723('0x59')](_0xe723('0x8e'));_0x3a3dd7[_0xe723('0x40')]+=0x1;ut[_0xe723('0x8f')](_0x2556bf,0x17,_0xe723('0x90'));if(_0x3a3dd7['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x2ef56d[_0x45b93b]));rpcDb[_0xe723('0x91')](_0x2556bf,_0xe723('0x92'));}else{ut['logCustomer'](_0x2556bf,0x16,_0xe723('0x93'));rpcDb[_0xe723('0x91')](_0x2556bf,_0xe723('0x94'));rpcDb['createCustomerFinal'](_0x2556bf,'[HistoryRecallClose]');}}}}})[_0xe723('0x79')](ut[_0xe723('0x8c')](_0xe723('0x95')));};Preview['prototype']['setMessage']=function(_0x2d0ab5){_0x2d0ab5['sendMessageOneNotActive']=!![];if(ut[_0xe723('0x96')](_0x2d0ab5[_0xe723('0x2d')])){_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x97');}else if(!ut[_0xe723('0x98')](_0x2d0ab5[_0xe723('0x37')])){_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x99');}else if(!this[_0xe723('0x9a')](_0x2d0ab5['Trunk'])){if(!this[_0xe723('0x9a')](_0x2d0ab5[_0xe723('0x9b')])){_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x9c');}else{_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x9d');}}else{_0x2d0ab5['message']=_0xe723('0x9d');}emitCampaignPreview(_0x2d0ab5);};Preview[_0xe723('0x10')]['callProgressDetectingCustomer']=function(_0x57ecba,_0xcd1343,_0x2d5721){var _0xf91e1a=this;var _0x4fa5b2=this['actions'][_0xcd1343];var _0x3a92ac=this['campaignsPreview'][_0x4fa5b2[_0xe723('0x6e')]];var _0xbb0ff5;if(_0x3a92ac){switch(_0x2d5721){case'1':_0x3a92ac[_0xe723('0x9e')]+=0x1;_0x4fa5b2[_0xe723('0x9f')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut['totalGlobal'](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x0,_0xe723('0xa1'));ami[_0xe723('0x26')](_0xe723('0xa2'),ut['buildObj'](_0x4fa5b2,_0xe723('0xa3')));rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,_0xe723('0xa9'));}else{if(_0x4fa5b2['countnosuchnumberretry']>=_0x3a92ac[_0xe723('0xaa')]){rpcDb['createCustomerFinal'](_0x4fa5b2,_0xe723('0xa9'));}else{rpcDb[_0xe723('0xab')](ut['scheduledAt'](_0x4fa5b2,_0xe723('0x9f'),_0x3a92ac[_0xe723('0xac')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];break;case _0xe723('0xb0'):var _0x3d8221=moment()[_0xe723('0x59')](_0xe723('0x8e'));_0x4fa5b2[_0xe723('0xb1')]=_0x3d8221;_0x4fa5b2[_0xe723('0xb2')]=_0x3d8221;_0x4fa5b2[_0xe723('0x7d')]=!![];_0x3a92ac[_0xe723('0x2e')]+=0x1;logger[_0xe723('0x5c')]('[syncHangup][talking][increment]',_0x4fa5b2[_0xe723('0xb3')],_0xe723('0xb4'),_0x3a92ac[_0xe723('0x29')],'pTalking:\x20',_0x3a92ac[_0xe723('0x2e')]);ami[_0xe723('0x26')](_0xe723('0xb5'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xb7'),this[_0xe723('0x14')][_0x4fa5b2[_0xe723('0x6e')]]));if(_0x3a92ac[_0xe723('0xb8')]){ami[_0xe723('0x26')](_0xe723('0xb9'),ut[_0xe723('0xba')](_0x4fa5b2));}break;case'16':ami[_0xe723('0x26')](_0xe723('0xbb'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xbc'),this[_0xe723('0x14')][_0x4fa5b2[_0xe723('0x6e')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x4fa5b2,_0xe723('0xbc')));_0x3a92ac[_0xe723('0x3a')]+=0x1;_0x3a92ac['total']+=0x1;_0x3a92ac['answered']+=0x1;ut[_0xe723('0x7e')](_0x3a92ac,_0xe723('0xbd'));_0x4fa5b2['countglobal']=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x4,'Answer');rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe723('0xa8')](_0x4fa5b2,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x4fa5b2);_0x3a92ac['sumDuration']+=_0x4fa5b2[_0xe723('0xbe')];_0x3a92ac[_0xe723('0x2f')]+=_0x4fa5b2[_0xe723('0xbe')];logger[_0xe723('0x5c')](_0xe723('0xbf'),_0x4fa5b2[_0xe723('0xb3')],_0xe723('0xb4'),_0x3a92ac['name'],_0xe723('0x70'),_0x3a92ac[_0xe723('0x2e')]);delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];break;case _0xe723('0xc0'):_0x3a92ac[_0xe723('0x3c')]+=0x1;_0x4fa5b2['countbusyretry']+=0x1;_0x4fa5b2['countglobal']=ut[_0xe723('0xa4')](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x5,'Busy');ami[_0xe723('0x26')](_0xe723('0xc1'),ut['buildObj'](_0x4fa5b2,_0xe723('0xc2')));rpcDb[_0xe723('0x91')](_0x4fa5b2,_0xe723('0xc3'));if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac['dialGlobalMaxRetry']){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,_0xe723('0xc4'));}else{if(_0x4fa5b2[_0xe723('0xc5')]>=_0x3a92ac[_0xe723('0xc6')]){rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xc3'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4fa5b2,'countbusyretry',_0x3a92ac[_0xe723('0xc7')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case _0xe723('0xc8'):_0x3a92ac[_0xe723('0x3f')]+=0x1;_0x4fa5b2['countnoanswerretry']+=0x1;_0x4fa5b2['countglobal']=ut['totalGlobal'](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x3,_0xe723('0xc9'));ami[_0xe723('0x26')](_0xe723('0xca'),ut['buildObj'](_0x4fa5b2,'noanswer'));rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac['dialGlobalMaxRetry']){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,'Global');rpcDb['createCustomerFinal'](_0xbb0ff5,_0xe723('0xcb'));}else{if(_0x4fa5b2[_0xe723('0xcc')]>=_0x3a92ac[_0xe723('0xcd')]){rpcDb[_0xe723('0xa8')](_0x4fa5b2,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe723('0xab')](ut[_0xe723('0xce')](_0x4fa5b2,_0xe723('0xcc'),_0x3a92ac[_0xe723('0xcf')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case _0xe723('0xd0'):_0x3a92ac[_0xe723('0xd1')]+=0x1;_0x4fa5b2[_0xe723('0xd2')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x8,_0xe723('0xd3'));ami[_0xe723('0x26')](_0xe723('0xd4'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xd5')));rpcDb[_0xe723('0x91')](_0x4fa5b2,_0xe723('0xd6'));if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut['cloneAction'](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb['createCustomerFinal'](_0xbb0ff5,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4fa5b2[_0xe723('0xd2')]>=_0x3a92ac[_0xe723('0xd7')]){rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xd6'));}else{rpcDb['rescheduleContact'](ut[_0xe723('0xce')](_0x4fa5b2,'countcongestionretry',_0x3a92ac[_0xe723('0xc7')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case'CANCEL':_0x3a92ac[_0xe723('0x41')]+=0x1;_0x4fa5b2[_0xe723('0xd8')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x14,_0xe723('0xd9'));ami['emit']('custom:agentreject',ut['buildObj'](_0x4fa5b2,'agentreject'));rpcDb['createCustomerHistory'](_0x4fa5b2,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0x14,_0xe723('0xd9'));rpcDb['createCustomerFinal'](_0xbb0ff5,_0xe723('0xda'));}else{if(_0x4fa5b2[_0xe723('0xd8')]>=_0x3a92ac[_0xe723('0xdb')]){rpcDb['createCustomerFinal'](_0x4fa5b2,_0xe723('0xda'));}else{rpcDb['rescheduleContact'](ut[_0xe723('0xce')](_0x4fa5b2,_0xe723('0xd8'),_0x3a92ac[_0xe723('0xdc')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case _0xe723('0xdd'):_0x3a92ac[_0xe723('0x43')]+=0x1;_0x4fa5b2[_0xe723('0xde')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0xb,_0xe723('0xdf'));rpcDb[_0xe723('0x91')](_0x4fa5b2,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb['createCustomerFinal'](_0xbb0ff5,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4fa5b2[_0xe723('0xe0')]>=_0x3a92ac[_0xe723('0xe1')]){rpcDb['createCustomerFinal'](_0x4fa5b2,_0xe723('0xe2'));}else{rpcDb[_0xe723('0xab')](ut['scheduledAt'](_0x4fa5b2,_0xe723('0xde'),_0x3a92ac[_0xe723('0xe3')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case'18':_0x3a92ac[_0xe723('0x42')]+=0x1;_0x4fa5b2[_0xe723('0xe4')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x12,_0x57ecba['cause-txt']||_0x57ecba['dialstatus']);ami[_0xe723('0x26')](_0xe723('0xe5'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xe6')));rpcDb['createCustomerHistory'](_0x4fa5b2,_0xe723('0xe7'));if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xe7'));}delete this[_0xe723('0x17')][_0x57ecba['linkedid']];break;case'19':_0x3a92ac[_0xe723('0x42')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x13,_0x57ecba[_0xe723('0xe8')]||_0x57ecba[_0xe723('0xe9')]);ami[_0xe723('0x26')](_0xe723('0xe5'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xe6')));rpcDb[_0xe723('0x91')](_0x4fa5b2,_0xe723('0xea'));if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xea'));}delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];break;default:if(_0x4fa5b2[_0xe723('0x7d')]){ut['decrementTalkink'](_0x3a92ac,_0xe723('0xeb'));ut[_0xe723('0x7f')](_0xe723('0xec')+_0x3a92ac[_0xe723('0x29')],_0x57ecba);}_0x3a92ac[_0xe723('0x42')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0xc,_0x57ecba[_0xe723('0xe8')]||_0x57ecba[_0xe723('0xe9')]);rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb['createCustomerFinal'](_0xbb0ff5,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x4fa5b2,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x57ecba[_0xe723('0xaf')]];}if(!(_0x4fa5b2[_0xe723('0x7d')]&&_0x2d5721==='16')){ut[_0xe723('0x7b')](_0x3a92ac,_0xe723('0xed'));logger[_0xe723('0x5c')](_0xe723('0xee'),_0x4fa5b2[_0xe723('0xb3')],_0xe723('0xb4'),_0x3a92ac[_0xe723('0x29')],'originated:\x20',_0x3a92ac[_0xe723('0x4e')]);}if(_0x2d5721!=='ANSWER'){delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];delete this[_0xe723('0x17')][_0x57ecba['destlinkedid']];}}};Preview['prototype'][_0xe723('0xef')]=function(_0x4dc764,_0x5adb50,_0x361430){if(_[_0xe723('0xf0')](_0x5adb50)&&_0xe723('0xf1')!==typeof _0x5adb50){return;}if(_[_0xe723('0xf0')](_0x361430)&&_0xe723('0xf1')!==typeof _0x361430){return;}switch(_0x361430[_0xe723('0xf2')]){case'0':ut[_0xe723('0xf3')](_0x4dc764,0x0,_0xe723('0xa1'));rpcDb[_0xe723('0xf4')](_0x4dc764,_0xe723('0xf5'));break;case'3':ut[_0xe723('0xf3')](_0x4dc764,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x4dc764,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe723('0xf3')](_0x4dc764,0x5,'Busy');rpcDb[_0xe723('0xf4')](_0x4dc764,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xe723('0xf3')](_0x4dc764,0x8,_0xe723('0xd3'));rpcDb['createAgentHistory'](_0x4dc764,_0xe723('0xf6'));break;case'22':ut[_0xe723('0xf3')](_0x4dc764,0x16,_0xe723('0xf7'));rpcDb[_0xe723('0xf4')](_0x4dc764,_0xe723('0xf8'));break;default:ut[_0xe723('0xf3')](_0x4dc764,0xc,_0x361430[_0xe723('0xf2')]);rpcDb[_0xe723('0xf4')](_0x4dc764,_0xe723('0xf6'));}ut['updateOriginated'](_0x5adb50,_0xe723('0xf9'));logger[_0xe723('0x5c')](_0xe723('0xfa'),_0x4dc764[_0xe723('0xb3')],_0xe723('0xb4'),_0x5adb50[_0xe723('0x29')],_0xe723('0x6f'),_0x5adb50['originated']);delete this['actions'][_0x4dc764['uniqueid']];};Preview[_0xe723('0x10')]['checkInBlack']=function(_0xff97df,_0xc9c36c,_0x3133ba,_0xe699bd,_0x1c1d6e){var _0x32b4e6=this;return new BPromise(function(_0x1feea4,_0x29e51e){if(_['isNil'](_0xc9c36c)||_[_0xe723('0x86')](_0xc9c36c[_0xe723('0xfb')])||_[_0xe723('0x86')](_0xc9c36c['Contact']['phone'])||_['isNil'](_0xc9c36c[_0xe723('0x74')])){_0x29e51e(ut['message'](_0xe723('0xfc'),_0xe699bd,_0x1c1d6e));return;}var _0x29a67e=uuid['v4']();var _0x3da908=_0x32b4e6[_0xe723('0x14')][_0xc9c36c[_0xe723('0xfd')][_0xe723('0x29')]];var _0x2426d6=_0x3133ba?_0x32b4e6[_0xe723('0xfe')][_0x3133ba]['id']:undefined;_0x32b4e6[_0xe723('0x17')][_0x29a67e]=new Action(_0xc9c36c,_0x3da908,_0x29a67e,_0x3133ba,_0x2426d6);var _0x4b555b=_0x32b4e6[_0xe723('0x17')][_0x29a67e];_0x4b555b['unlockAgent']=_0xe699bd;_0x4b555b[_0xe723('0xae')]=_0x1c1d6e;_0x4b555b[_0xe723('0xff')]=_0x3133ba;if(_[_0xe723('0x100')](_0xff97df)){_0x32b4e6[_0xe723('0x101')](_0x4b555b,_0x3da908,_0xc9c36c,_0x3133ba)['then'](function(_0xcbed9b){logger[_0xe723('0x5c')]('[Preview][execCall][success]',_0xe723('0x102')+_0x4b555b[_0xe723('0x6e')]+'\x20IdHopper:\x20'+_0x4b555b['idContact'],JSON[_0xe723('0x58')](_0xcbed9b));ami['emit'](_0xe723('0x103'),ut[_0xe723('0xb6')](_0x4b555b,'called',_0x32b4e6[_0xe723('0x14')][_0x4b555b['queue']]));_0x1feea4(ut[_0xe723('0x4d')](_0xe723('0x104')));})[_0xe723('0x79')](function(_0x139ce1){ut[_0xe723('0x62')](_0xe723('0x105'),_0x139ce1);_0x29e51e(ut[_0xe723('0x4d')](_0xe723('0x106'),_0xe699bd,_0x1c1d6e));});}else{_0x3da908[_0xe723('0x3b')]+=0x1;ut[_0xe723('0x107')](_0x4b555b);rpcDb[_0xe723('0x108')](_0x4b555b,_0xe723('0x109'));delete _0x32b4e6[_0xe723('0x17')][_0x29a67e];_0x29e51e(ut['message'](_0xe723('0x10a'),_0xe699bd,_0x1c1d6e));}});};Preview[_0xe723('0x10')][_0xe723('0x9a')]=function(_0x2a4dff){return!_[_0xe723('0x86')](_0x2a4dff)&&!_[_0xe723('0x86')](_0x2a4dff[_0xe723('0x29')])&&!_[_0xe723('0x86')](_0x2a4dff[_0xe723('0x55')])&&_0x2a4dff[_0xe723('0x55')]&&!_[_0xe723('0x86')](this['trunks'][util['format'](_0xe723('0x10b'),_0x2a4dff[_0xe723('0x29')])])&&!_[_0xe723('0x86')](this[_0xe723('0x16')][util[_0xe723('0x59')](_0xe723('0x10b'),_0x2a4dff[_0xe723('0x29')])][_0xe723('0x77')])&&(this[_0xe723('0x16')][util[_0xe723('0x59')]('SIP/%s',_0x2a4dff['name'])][_0xe723('0x77')]===_0xe723('0x10c')||this[_0xe723('0x16')][util[_0xe723('0x59')](_0xe723('0x10b'),_0x2a4dff[_0xe723('0x29')])][_0xe723('0x77')]===_0xe723('0x10d'));};Preview[_0xe723('0x10')]['run']=function(_0x1cbd4b,_0x1b9ec3){var _0x19333a=this;return new BPromise(function(_0x659307,_0x12557a){_0x19333a[_0xe723('0x10e')](_0x1cbd4b,_0x1b9ec3)[_0xe723('0x85')](function(_0x5a1c38){_0x659307(_[_0xe723('0x71')](_0x5a1c38,['message']));})[_0xe723('0x79')](function(_0x12a058){if(_0x12a058['unlock']){rpcDb[_0xe723('0x10f')](_0x1cbd4b);}if(_0x12a058[_0xe723('0x55')]){rpcDb[_0xe723('0x110')](_0x1cbd4b);}_0x12557a(_[_0xe723('0x71')](_0x12a058,[_0xe723('0x4d')]));});});};Preview[_0xe723('0x10')]['execRun']=function(_0x45502a,_0x1fe00c){var _0x429e7e=this;return new BPromise(function(_0x3c0af4,_0x79f811){var _0xea34f5,_0x35aa7b;rpcDb[_0xe723('0x111')](_0x45502a)[_0xe723('0x85')](function(_0x4a8061){if(!_[_0xe723('0x86')](_0x4a8061[0x0])){_0x35aa7b=_0x4a8061[0x0]['recallme']?![]:!![];_0xea34f5=_0x4a8061[0x0][_0xe723('0x112')]?!![]:![];_0xea34f5=_0x1fe00c?!![]:_0xea34f5;}var _0x164a46=_0x429e7e[_0xe723('0x113')](_0x4a8061);if(_0x164a46[_0xe723('0x114')]){rpcDb[_0xe723('0x115')](_[_0xe723('0x71')](_0x4a8061[0x0],[_0xe723('0x74'),_0xe723('0x116')]))['then'](function(_0x1c25b4){_0x429e7e[_0xe723('0x117')](_0x1c25b4,_0x4a8061[0x0],_0x1fe00c,_0x35aa7b,_0xea34f5)['then'](function(_0x16db31){_0x3c0af4(_0x16db31);})[_0xe723('0x79')](function(_0x74cee6){_0x79f811(_0x74cee6);});})[_0xe723('0x79')](function(_0x169fe1){ut[_0xe723('0x62')](_0xe723('0x118'),_0x169fe1);_0x79f811(ut[_0xe723('0x4d')]('Call\x20unsuccessful',_0x35aa7b,_0xea34f5));});}else{_0x79f811(ut[_0xe723('0x4d')](_0x164a46[_0xe723('0x4d')],_0x35aa7b,_0xea34f5));}})[_0xe723('0x79')](function(_0x399de7){ut[_0xe723('0x62')]('[Preview][getContactPreview]',_0x399de7);_0x79f811(ut['message'](_0xe723('0x119'),![],!![]));});});};Preview[_0xe723('0x10')][_0xe723('0x113')]=function(_0x70ee94){if(_['isNil'](_0x70ee94)||_[_0xe723('0x100')](_0x70ee94)||!_['isNil'](_0x70ee94[0x0][_0xe723('0x8a')])&&_['isNil'](_0x70ee94[0x0][_0xe723('0x8a')]['name'])){ut['logger'](_0xe723('0x11a'),_0x70ee94);return{'isValid':![],'message':_0xe723('0x11b')};}var _0x3a61a3=this[_0xe723('0x14')][_0x70ee94[0x0][_0xe723('0xfd')]['name']];_0x3a61a3[_0xe723('0x4d')]=_0xe723('0x9d');if(_[_0xe723('0x86')](_0x3a61a3)){ut[_0xe723('0x62')](_0xe723('0x11c'),_0x3a61a3);return{'isValid':![],'message':_0xe723('0x11d')};}if(!this[_0xe723('0x9a')](_0x3a61a3['Trunk'])){ut[_0xe723('0x62')](_0xe723('0x11e'),_0xe723('0x11f')+_0x3a61a3[_0xe723('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xe723('0x9a')](_0x3a61a3['TrunkBackup'])){ut[_0xe723('0x62')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x3a61a3[_0xe723('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe723('0x120')};}}if(!ut[_0xe723('0x98')](_0x3a61a3[_0xe723('0x37')])){ut[_0xe723('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x3a61a3['name']+_0xe723('0x121'));return{'isValid':![],'message':_0xe723('0x11f')+_0x3a61a3[_0xe723('0x29')]+_0xe723('0x121')};}return{'isValid':!![],'message':_0xe723('0x122')};};Preview[_0xe723('0x10')][_0xe723('0x101')]=function(_0xfe1af7,_0x2942fe,_0x393ae4,_0x4ac6b2){var _0x292aad=this;return new BPromise(function(_0x39acce,_0x4481bf){var _0x30608a=_0xfe1af7[_0xe723('0xb3')];var _0x13f41a=_0x292aad[_0xe723('0x9a')](_0x2942fe[_0xe723('0x54')])?util[_0xe723('0x59')]('SIP/%s/%s%s',_0x2942fe['Trunk'][_0xe723('0x29')],_[_0xe723('0x86')](_0x2942fe[_0xe723('0x39')])?'':_0x2942fe['dialPrefix'][_0xe723('0x123')]()||'',_0x2942fe['dialCutDigit']>0x0?_0x393ae4[_0xe723('0xfb')]['phone'][_0xe723('0x124')](_0x2942fe[_0xe723('0x125')]):_0x393ae4['Contact'][_0xe723('0x126')]):util[_0xe723('0x59')](_0xe723('0x127'),_['isNil'](_0x2942fe['TrunkBackup'])?_0x2942fe[_0xe723('0x54')]['name']:_0x2942fe[_0xe723('0x9b')][_0xe723('0x29')],_[_0xe723('0x86')](_0x2942fe[_0xe723('0x39')])?'':_0x2942fe['dialPrefix'][_0xe723('0x123')]()||'',_0x2942fe[_0xe723('0x125')]>0x0?_0x393ae4[_0xe723('0xfb')]['phone'][_0xe723('0x124')](_0x2942fe[_0xe723('0x125')]):_0x393ae4[_0xe723('0xfb')][_0xe723('0x126')]);var _0x120b9e=_0x292aad['isTrunkReachable'](_0x2942fe[_0xe723('0x54')])?ut[_0xe723('0x128')](_0x2942fe['Trunk']['callerid'],_0x2942fe[_0xe723('0x38')],_0x2942fe[_0xe723('0x129')]>0x0?ut[_0xe723('0x12a')](_0x2942fe[_0xe723('0x12b')],_0x2942fe[_0xe723('0x129')]):_0x2942fe[_0xe723('0x12b')]):ut[_0xe723('0x128')](_[_0xe723('0x86')](_0x2942fe[_0xe723('0x9b')])?_0x2942fe[_0xe723('0x54')][_0xe723('0x56')]:_0x2942fe[_0xe723('0x9b')][_0xe723('0x56')],_0x2942fe[_0xe723('0x38')],_0x2942fe[_0xe723('0x129')]>0x0?ut[_0xe723('0x12a')](_0x2942fe['dialOriginateCallerIdNumber'],_0x2942fe[_0xe723('0x129')]):_0x2942fe[_0xe723('0x12b')]);if(_0x120b9e){_0xfe1af7[_0xe723('0x12c')]=ut['extractCalleridName'](_0x120b9e);_0xfe1af7[_0xe723('0x12d')]=ut[_0xe723('0x12e')](_0x120b9e);}var _0x5efa86=ut[_0xe723('0x12f')](_0x2942fe,_0x393ae4,_0x13f41a,_0x120b9e,_0x30608a,_0xfe1af7);_[_0xe723('0x130')](_0xfe1af7,ut['toLowerVariables'](_0x5efa86));_0xfe1af7[_0xe723('0x8d')]=moment()[_0xe723('0x59')](_0xe723('0x8e'));ami['Action'](ut[_0xe723('0x131')](_0xfe1af7,_0x2942fe,_0x5efa86,_0xfe1af7[_0xe723('0xae')],_0x4ac6b2))[_0xe723('0x85')](function(_0x3fae3c){_0x2942fe[_0xe723('0x4e')]+=0x1;logger[_0xe723('0x5c')](_0xe723('0x132'),_0x30608a,_0xe723('0xb4'),_0x2942fe['name'],_0xe723('0x6f'),_0x2942fe[_0xe723('0x4e')]);_0x39acce(_0x3fae3c);})[_0xe723('0x79')](function(_0x2d64d3){ut[_0xe723('0xf3')](_0xfe1af7,0xe,_0xe723('0x133'));rpcDb[_0xe723('0xf4')](_0xfe1af7,_0xe723('0x134'));_0x4481bf(_0x2d64d3);});});};Preview[_0xe723('0x10')][_0xe723('0x20')]=function(_0x163ca2){if(this[_0xe723('0x17')][_0x163ca2[_0xe723('0xaf')]]){this['actions'][_0x163ca2[_0xe723('0xaf')]][_0xe723('0x78')]=_0x163ca2[_0xe723('0x78')];}};Preview[_0xe723('0x10')][_0xe723('0x18')]=function(_0x672f81){var _0x102e6c=this;var _0x5bd8ab=this['actions'][_0x672f81[_0xe723('0x135')]];if(_0x5bd8ab){if(_0x5bd8ab[_0xe723('0xff')]&&this['agents'][_0x5bd8ab[_0xe723('0xff')]]){ut[_0xe723('0x136')](_0x5bd8ab,this[_0xe723('0xfe')][_0x5bd8ab['lookAgent']]['name'],this[_0xe723('0xfe')][_0x5bd8ab[_0xe723('0xff')]]['id']);}var _0x11175c=_[_0xe723('0x137')](_0x5bd8ab);_0x11175c['responsetime']=moment()[_0xe723('0x59')](_0xe723('0x8e'));var _0x4a8106=_0x102e6c[_0xe723('0x14')][_0x5bd8ab[_0xe723('0x6e')]];if(ut[_0xe723('0x138')](_0x672f81[_0xe723('0x139')])){if(_0x5bd8ab['unlockAgent']){rpcDb[_0xe723('0x10f')](_0x5bd8ab[_0xe723('0x13a')]);}if(_0x5bd8ab[_0xe723('0xae')]){rpcDb[_0xe723('0x110')](_0x5bd8ab[_0xe723('0x13a')]);}ami[_0xe723('0x26')](_0xe723('0x13b'),ut[_0xe723('0xb6')](_0x5bd8ab,_0xe723('0x13c'),this[_0xe723('0x14')][_0x5bd8ab[_0xe723('0x6e')]]));this[_0xe723('0xef')](_0x11175c,_0x4a8106,_0x672f81);}else{_0x5bd8ab['starttime']=moment()[_0xe723('0x59')](_0xe723('0x8e'));ut[_0xe723('0xf3')](_0x11175c,0x4,_0xe723('0x13d'));rpcDb[_0xe723('0xf4')](_0x11175c,_0xe723('0x13e'));}}};Preview[_0xe723('0x10')][_0xe723('0x1b')]=function(_0x19b8f5){var _0x2602d9=this;var _0x593861=this[_0xe723('0x17')][_0x19b8f5['linkedid']];var _0x1b7203;if(_0x593861){_0x1b7203=this['campaignsPreview'][_0x593861[_0xe723('0x6e')]];logger['info'](_0xe723('0x13f'),_0x19b8f5[_0xe723('0xaf')],_0xe723('0xb4'),_0x1b7203[_0xe723('0x29')],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);}if(this[_0xe723('0x17')][_0x19b8f5[_0xe723('0xaf')]]&&_0x19b8f5[_0xe723('0xaf')]!==_0x19b8f5[_0xe723('0xb3')]){if(_0x19b8f5[_0xe723('0x140')]==='16'&&this['actions'][_0x19b8f5[_0xe723('0xaf')]][_0xe723('0x7d')]){this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')]);}else if(this['actions'][_0x19b8f5[_0xe723('0xaf')]][_0xe723('0x7d')]){logger['info'](_0xe723('0x142'),_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')],_0xe723('0xb4'),_0x1b7203['name'],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')]);}}else if(_0x593861&&_[_0xe723('0x86')](_0x593861[_0xe723('0x143')])&&_0x1b7203[_0xe723('0x144')]&&_0x19b8f5['linkedid']===_0x19b8f5[_0xe723('0xb3')]&&_[_0xe723('0x86')](_0x19b8f5[_0xe723('0xf2')])&&_0x19b8f5[_0xe723('0x140')]==='16'&&_0x19b8f5[_0xe723('0x145')]==='6'&&_[_0xe723('0xf0')](_0x593861['transfer'])){if(_0x593861[_0xe723('0xad')]){rpcDb[_0xe723('0x10f')](_0x593861[_0xe723('0x13a')]);}if(_0x593861[_0xe723('0xae')]){rpcDb[_0xe723('0x110')](_0x593861[_0xe723('0x13a')]);}_0x19b8f5[_0xe723('0xf2')]='22';this['callProgressDetectingAgent'](_0x593861,_0x1b7203,_0x19b8f5);}else if(_0x593861&&_0x593861['transfer']){if(_0x19b8f5[_0xe723('0x140')]==='16'&&this['actions'][_0x19b8f5[_0xe723('0xaf')]][_0xe723('0x7d')]){logger['info'](_0xe723('0x146'),_0x19b8f5['linkedid'],_0x19b8f5['cause'],_0xe723('0xb4'),_0x1b7203[_0xe723('0x29')],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5['cause']);}else if(this[_0xe723('0x17')][_0x19b8f5['linkedid']][_0xe723('0x7d')]){logger[_0xe723('0x5c')](_0xe723('0x142'),_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')],_0xe723('0xb4'),_0x1b7203[_0xe723('0x29')],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')]);}}};Preview['prototype']['syncDialEnd']=function(_0x2c427c){if(this[_0xe723('0x17')][_0x2c427c[_0xe723('0x147')]]&&_0x2c427c[_0xe723('0x147')]!==_0x2c427c[_0xe723('0x148')]){this[_0xe723('0x141')](_0x2c427c,_0x2c427c[_0xe723('0x147')],_0x2c427c['dialstatus']);}};Preview['prototype'][_0xe723('0x1c')]=function(_0x4750af){if(this[_0xe723('0x17')][_0x4750af[_0xe723('0xaf')]]&&_0x4750af[_0xe723('0xaf')]!==_0x4750af[_0xe723('0xb3')]&&!this[_0xe723('0x17')][_0x4750af['linkedid']]['dialAnswer']){if(_0x4750af[_0xe723('0x140')]==='1'){this[_0xe723('0x141')](_0x4750af,_0x4750af['linkedid'],_0x4750af[_0xe723('0x140')]);}}};Preview['prototype'][_0xe723('0x149')]=function(_0x2a8167,_0x10118f,_0x1ab9c0){if(this[_0xe723('0x17')][_0x2a8167]){if(_[_0xe723('0x86')](this[_0xe723('0x17')][_0x2a8167][_0xe723('0x14a')])){this[_0xe723('0x17')][_0x2a8167][_0xe723('0x14a')]={};}this['actions'][_0x2a8167][_0xe723('0x14a')][_0x10118f]=_0x1ab9c0;}};Preview['prototype'][_0xe723('0x22')]=function(_0x18abad){try{if(!_[_0xe723('0x86')](_0x18abad)){if(ut[_0xe723('0x14b')](_[_0xe723('0x14c')](_0x18abad['variable'])[0x0])){this[_0xe723('0x149')](_0x18abad[_0xe723('0xb3')],_['keys'](_0x18abad[_0xe723('0x14d')])[0x0],_0x18abad[_0xe723('0x14e')]);}}}catch(_0x42ce46){logger[_0xe723('0x14f')]('[syncVarSet][Preview]',util['inspect'](_0x42ce46,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x233408){if(_0x233408){if(this[_0xe723('0x17')][_0x233408[_0xe723('0x150')]]){this[_0xe723('0x17')][_0x233408[_0xe723('0x150')]][_0xe723('0x151')]=!![];}}};Preview[_0xe723('0x10')][_0xe723('0x152')]=function(_0x3c1d77){if(_0x3c1d77){if(this[_0xe723('0x17')][_0x3c1d77[_0xe723('0x153')]]){this[_0xe723('0x17')][_0x3c1d77[_0xe723('0x153')]][_0xe723('0x151')]=!![];}}};module[_0xe723('0x154')]=Preview; \ No newline at end of file +var _0x2123=['createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','Empty\x20Campaign','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','response','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','transfer','destuniqueid','addVariable','variables','syncVarSet','filterKey','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','defaults','localhost','socket.io-emitter','redis','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','dialMethod','booked','outbound','clearZombieChannels','hasOwnProperty','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','status','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','recallMe','getContactRecallMe','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','createCustomerFinal','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','ANSWER','format','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','Contact','phone','lookAgent','execCall','then','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist'];(function(_0x555356,_0xec8995){var _0x15a2a1=function(_0x2c53ad){while(--_0x2c53ad){_0x555356['push'](_0x555356['shift']());}};_0x15a2a1(++_0xec8995);}(_0x2123,0x190));var _0x3212=function(_0x4cc972,_0x656b21){_0x4cc972=_0x4cc972-0x0;var _0x8068f6=_0x2123[_0x4cc972];return _0x8068f6;};'use strict';var util=require(_0x3212('0x0'));var _=require(_0x3212('0x1'));var BPromise=require(_0x3212('0x2'));var uuid=require(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var md5=require(_0x3212('0x5'));var Redis=require(_0x3212('0x6'));var config=require(_0x3212('0x7'));var logger=require(_0x3212('0x8'))(_0x3212('0x9'));var loggerAction=require(_0x3212('0x8'))(_0x3212('0xa'));var ami=require('../ami');var rpcDb=require(_0x3212('0xb'));var Action=require(_0x3212('0xc'));var ut=require(_0x3212('0xd'));config['redis']=_[_0x3212('0xe')](config['redis'],{'host':_0x3212('0xf'),'port':0x18eb});var io=require(_0x3212('0x10'))(new Redis(config[_0x3212('0x11')]));var Sequence=function(){};Sequence[_0x3212('0x12')]['enqueue']=function(_0x4a46c2){this[_0x3212('0x13')]=this[_0x3212('0x13')]?this[_0x3212('0x13')][_0x3212('0x14')](_0x4a46c2):_0x4a46c2();};function Preview(_0x9c01c3){this[_0x3212('0x15')]=new Sequence();this[_0x3212('0x16')]=_0x9c01c3[_0x3212('0x17')];this[_0x3212('0x18')]=_0x9c01c3[_0x3212('0x18')];this[_0x3212('0x19')]={};this[_0x3212('0x1a')]=_0x9c01c3[_0x3212('0x1a')];this[_0x3212('0x1b')]=0x0;ami['on'](_0x3212('0x1c'),this[_0x3212('0x1d')][_0x3212('0x1e')](this));ami['on'](_0x3212('0x1f'),this[_0x3212('0x20')][_0x3212('0x1e')](this));ami['on'](_0x3212('0x21'),this[_0x3212('0x22')]['bind'](this));ami['on'](_0x3212('0x23'),this[_0x3212('0x24')][_0x3212('0x1e')](this));ami['on'](_0x3212('0x25'),this[_0x3212('0x26')][_0x3212('0x1e')](this));ami['on'](_0x3212('0x27'),this['syncVarSet']['bind'](this));ami['on'](_0x3212('0x28'),this['syncAttendedTransfer'][_0x3212('0x1e')](this));ami['on'](_0x3212('0x29'),this[_0x3212('0x2a')][_0x3212('0x1e')](this));this[_0x3212('0x2b')](this['campaignsPreview']);}function emit(_0x41e61e,_0x462094,_0x49c598){io['to'](_0x41e61e)[_0x3212('0x2c')](_0x462094,_0x49c598);}function emitCampaignPreview(_0x3fa445){if(_0x3fa445[_0x3212('0x2d')]==='outbound'){var _0x5d27d5={'id':_0x3fa445['id'],'name':_0x3fa445[_0x3212('0x2e')],'strategy':_0x3fa445[_0x3212('0x2f')],'answered':_0x3fa445[_0x3212('0x30')],'available':_0x3fa445[_0x3212('0x31')],'loggedIn':_0x3fa445[_0x3212('0x32')],'pTalking':_0x3fa445[_0x3212('0x33')],'sumBillable':_0x3fa445['sumBillable'],'sumDuration':_0x3fa445['sumDuration'],'sumHoldTime':_0x3fa445[_0x3212('0x34')]||0x0,'talking':_0x3fa445['talking'],'total':_0x3fa445[_0x3212('0x35')],'type':_0x3fa445[_0x3212('0x2d')],'unmanaged':_0x3fa445[_0x3212('0x36')],'abandoned':_0x3fa445['abandoned'],'waiting':_0x3fa445[_0x3212('0x37')],'loggedInDb':_0x3fa445[_0x3212('0x38')],'dialActive':_0x3fa445[_0x3212('0x39')],'dialMethod':_0x3fa445['dialMethod'],'dialOriginateCallerIdName':_0x3fa445[_0x3212('0x3a')],'dialOriginateCallerIdNumber':_0x3fa445[_0x3212('0x3b')],'dialOriginateTimeout':_0x3fa445[_0x3212('0x3c')],'dialPrefix':_0x3fa445[_0x3212('0x3d')],'outboundAnswerAgiCallsDay':_0x3fa445[_0x3212('0x3e')],'outboundAnswerCallsDay':_0x3fa445[_0x3212('0x3f')],'outboundBlacklistCallsDay':_0x3fa445[_0x3212('0x40')],'outboundBusyCallsDay':_0x3fa445[_0x3212('0x41')],'outboundCongestionCallsDay':_0x3fa445[_0x3212('0x42')],'outboundDropCallsDayACS':_0x3fa445[_0x3212('0x43')],'outboundDropCallsDayCallersExit':_0x3fa445[_0x3212('0x44')],'outboundDropCallsDayTimeout':_0x3fa445[_0x3212('0x45')],'outboundNoAnswerCallsDay':_0x3fa445['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3fa445[_0x3212('0x46')],'outboundOriginateFailureCallsDay':_0x3fa445[_0x3212('0x47')],'outboundReCallsDay':_0x3fa445[_0x3212('0x48')],'outboundRejectCallsDay':_0x3fa445[_0x3212('0x49')],'outboundUnknownCallsDay':_0x3fa445[_0x3212('0x4a')],'outboundAbandonedCallsDay':_0x3fa445[_0x3212('0x4b')],'predictiveIntervalAnsweredCalls':_0x3fa445[_0x3212('0x4c')],'predictiveIntervalAvgHoldtime':_0x3fa445['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3fa445[_0x3212('0x4d')],'predictiveIntervalDroppedCallsCallersExit':_0x3fa445['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3fa445[_0x3212('0x4e')],'predictiveIntervalErlangCalls':_0x3fa445['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3fa445[_0x3212('0x4f')],'predictiveIntervalHitRate':_0x3fa445['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3fa445['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3fa445[_0x3212('0x50')],'predictiveIntervalAvailable':_0x3fa445['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3fa445[_0x3212('0x51')],'message':_0x3fa445[_0x3212('0x52')],'originated':_0x3fa445[_0x3212('0x53')],'erlangCalls':_0x3fa445['erlangCalls'],'erlangCallToSecond':_0x3fa445[_0x3212('0x54')],'erlangAbandonmentRate':_0x3fa445[_0x3212('0x55')],'erlangBusyFactor':_0x3fa445[_0x3212('0x56')],'startPredictive':_0x3fa445['startPredictive'],'startProgressive':_0x3fa445[_0x3212('0x57')]};if(_0x3fa445[_0x3212('0x58')]){_0x5d27d5[_0x3212('0x58')]={'id':_0x3fa445[_0x3212('0x58')]['id'],'name':_0x3fa445[_0x3212('0x58')]['name'],'active':_0x3fa445[_0x3212('0x58')][_0x3212('0x59')],'callerid':_0x3fa445[_0x3212('0x58')]['callerid']};}if(_0x3fa445[_0x3212('0x5a')]){_0x5d27d5[_0x3212('0x5a')]={'id':_0x3fa445[_0x3212('0x5a')]['id'],'name':_0x3fa445[_0x3212('0x5a')]['name']};}var _0x421948=md5(JSON[_0x3212('0x5b')](_0x5d27d5));if(_0x3fa445[_0x3212('0x5')]!==_0x421948){_0x3fa445[_0x3212('0x5')]=_0x421948;emit(util['format']('voice:queue:%s',_0x5d27d5['name']),'voice_queue:save',_0x5d27d5);}}}function emitVoiceQueueChannelRemove(_0xb2908a){logger[_0x3212('0x5c')](_0x3212('0x5d'),JSON[_0x3212('0x5b')](_0xb2908a));emit(util['format'](_0x3212('0x5e'),_0xb2908a[_0x3212('0x2e')]),_0x3212('0x5f'),_0xb2908a);io[_0x3212('0x2c')]('voice_queue_presence:remove',_0xb2908a);}function notSendMessagesQueue(_0x4fad05){if(_0x4fad05[_0x3212('0x60')]){if(_0x4fad05[_0x3212('0x53')]===0x0&&_0x4fad05[_0x3212('0x33')]===0x0){_0x4fad05[_0x3212('0x60')]=![];_0x4fad05[_0x3212('0x31')]=0x0;_0x4fad05[_0x3212('0x61')]=0x0;_0x4fad05[_0x3212('0x52')]='NOT_ACTIVE';ut[_0x3212('0x62')](_0x3212('0x63'),_0x4fad05[_0x3212('0x2e')]+_0x3212('0x64'));}else{_0x4fad05['message']=_0x3212('0x65');ut[_0x3212('0x62')](_0x3212('0x63'),_0x4fad05[_0x3212('0x2e')]+'\x20is\x20disactive');}emitCampaignPreview(_0x4fad05);}}Preview[_0x3212('0x12')]['loopCampaigns']=function(){var _0x46ff57=this;setInterval(function(){_0x46ff57[_0x3212('0x66')]();},0x7cf);};Preview[_0x3212('0x12')][_0x3212('0x66')]=function(){var _0x9a24e3=this[_0x3212('0x16')];this[_0x3212('0x1b')]+=0x1;for(var _0xa2df06 in _0x9a24e3){if(_0x9a24e3['hasOwnProperty'](_0xa2df06)&&(_0x9a24e3[_0xa2df06][_0x3212('0x67')]===_0x3212('0x9')||_0x9a24e3[_0xa2df06][_0x3212('0x67')]===_0x3212('0x68'))&&_0x9a24e3[_0xa2df06][_0x3212('0x2d')]===_0x3212('0x69')){if(this[_0x3212('0x1b')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x3212('0x6a')]();}}if(_0x9a24e3[_0x3212('0x6b')](_0xa2df06)&&_0x9a24e3[_0xa2df06][_0x3212('0x67')]===_0x3212('0x9')&&_0x9a24e3[_0xa2df06]['type']==='outbound'){if(_0x9a24e3[_0xa2df06]['dialActive']){this['setMessage'](_0x9a24e3[_0xa2df06]);if(_0x9a24e3[_0xa2df06][_0x3212('0x6c')])this['recallMe'](_0x9a24e3[_0xa2df06]);}else{notSendMessagesQueue(_0x9a24e3[_0xa2df06]);}}}};Preview[_0x3212('0x12')][_0x3212('0x6d')]=function(_0xa6854f){var _0x29f95c=this;this['sequence'][_0x3212('0x6e')](function(){if(!_[_0x3212('0x6f')](_0x29f95c[_0x3212('0x19')][_0xa6854f])){loggerAction['info'](_0x3212('0x70'),_0xa6854f,_0x3212('0x71'),_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x72')],'originated:\x20',JSON[_0x3212('0x5b')](_0x29f95c[_0x3212('0x16')][_0x29f95c['actions'][_0xa6854f][_0x3212('0x72')]][_0x3212('0x53')]),_0x3212('0x73'),JSON['stringify'](_0x29f95c['campaignsPreview'][_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x72')]][_0x3212('0x33')]),JSON['stringify'](_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x74')]),JSON['stringify'](_[_0x3212('0x75')](_0x29f95c[_0x3212('0x19')][_0xa6854f],[_0x3212('0x76'),'UserId','VoiceQueueId',_0x3212('0x77')])));return ami[_0x3212('0x78')]({'action':_0x3212('0x79'),'channel':_0x29f95c[_0x3212('0x19')][_0xa6854f]['channel']})[_0x3212('0x7a')](function(_0x417d2a){if(_0x417d2a[_0x3212('0x52')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x29f95c[_0x3212('0x19')][_0xa6854f]){ut['updateOriginated'](_0x29f95c[_0x3212('0x16')][_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x72')]],_0x3212('0x7b'));if(_0x29f95c['actions'][_0xa6854f][_0x3212('0x74')]===!![]){ut[_0x3212('0x7c')](_0x29f95c['campaignsPreview'][_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x72')]],_0x3212('0x7b'));ut[_0x3212('0x7d')](_0x3212('0x7e')+_0xa6854f,_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x72')]);}ut['loggerError'](_0x3212('0x7f')+_0xa6854f,_0x29f95c[_0x3212('0x19')][_0xa6854f][_0x3212('0x72')]);delete _0x29f95c[_0x3212('0x19')][_0xa6854f];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x5abdf6=this;loggerAction['info'](_0x3212('0x80'),_['size'](this[_0x3212('0x19')]));for(var _0x1e5441 in this[_0x3212('0x19')]){if(_0x5abdf6[_0x3212('0x19')][_0x3212('0x6b')](_0x1e5441)){_0x5abdf6[_0x3212('0x6d')](_0x1e5441);}}};Preview[_0x3212('0x12')][_0x3212('0x81')]=function(_0xc1893){var _0x2b0de2=this;rpcDb[_0x3212('0x82')](_0xc1893['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x1f111a){if(!_[_0x3212('0x6f')](_0x1f111a)){for(var _0x6afe4f=0x0;_0x6afe4f<_0x1f111a[_0x3212('0x83')];_0x6afe4f+=0x1){if(ut[_0x3212('0x84')](_0x1f111a[_0x6afe4f][_0x3212('0x85')])<_0xc1893['dialRecallMeTimeout']*0x3c){if(_0x1f111a[_0x6afe4f]['Agent']&&!_0x1f111a[_0x6afe4f][_0x3212('0x86')][_0x3212('0x87')]){_0x2b0de2['run'](_0x1f111a[_0x6afe4f]['id'])['then'](ut[_0x3212('0x88')](_0x3212('0x89')))['catch'](ut[_0x3212('0x88')](_0x3212('0x89')));}else{rpcDb[_0x3212('0x8a')](_0x1f111a[_0x6afe4f]['id']);}}else{var _0x2cdc09=new Action(_0x1f111a[_0x6afe4f],_0xc1893);_0x2cdc09[_0x3212('0x8b')]=moment()['format'](_0x3212('0x8c'));_0xc1893[_0x3212('0x48')]+=0x1;ut[_0x3212('0x8d')](_0x2cdc09,0x17,_0x3212('0x8e'));if(_0xc1893['dialRecallInQueue']){rpcDb[_0x3212('0x8f')](ut[_0x3212('0x90')](_0x1f111a[_0x6afe4f]));rpcDb[_0x3212('0x91')](_0x2cdc09,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x3212('0x8d')](_0x2cdc09,0x16,_0x3212('0x92'));rpcDb[_0x3212('0x91')](_0x2cdc09,_0x3212('0x93'));rpcDb['createCustomerFinal'](_0x2cdc09,_0x3212('0x93'));}}}}})[_0x3212('0x7a')](ut[_0x3212('0x88')](_0x3212('0x94')));};Preview['prototype'][_0x3212('0x95')]=function(_0x3f35a9){_0x3f35a9[_0x3212('0x60')]=!![];if(ut[_0x3212('0x96')](_0x3f35a9['loggedIn'])){_0x3f35a9[_0x3212('0x52')]=_0x3212('0x97');}else if(!ut[_0x3212('0x98')](_0x3f35a9[_0x3212('0x39')])){_0x3f35a9[_0x3212('0x52')]=_0x3212('0x99');}else if(!this[_0x3212('0x9a')](_0x3f35a9[_0x3212('0x58')])){if(!this[_0x3212('0x9a')](_0x3f35a9['TrunkBackup'])){_0x3f35a9['message']=_0x3212('0x9b');}else{_0x3f35a9[_0x3212('0x52')]='ACTIVE';}}else{_0x3f35a9[_0x3212('0x52')]=_0x3212('0x9c');}emitCampaignPreview(_0x3f35a9);};Preview[_0x3212('0x12')][_0x3212('0x9d')]=function(_0x4b822f,_0x14d97a,_0x4440f4){var _0x4092c6=this;var _0x1298d5=this[_0x3212('0x19')][_0x14d97a];var _0x3f92c1=this['campaignsPreview'][_0x1298d5[_0x3212('0x72')]];var _0x16b840;if(_0x3f92c1){switch(_0x4440f4){case'1':_0x3f92c1['outboundNoSuchCallsDay']+=0x1;_0x1298d5['countnosuchnumberretry']+=0x1;_0x1298d5[_0x3212('0x9e')]=ut[_0x3212('0x9f')](_0x1298d5);ut[_0x3212('0x8d')](_0x1298d5,0x0,_0x3212('0xa0'));ami[_0x3212('0x2c')]('custom:agentnosuchnumber',ut[_0x3212('0xa1')](_0x1298d5,_0x3212('0xa2')));rpcDb['createCustomerHistory'](_0x1298d5,_0x3212('0xa3'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1['dialGlobalMaxRetry']){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,_0x3212('0xa5'));rpcDb[_0x3212('0xa6')](_0x16b840,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1298d5[_0x3212('0xa7')]>=_0x3f92c1['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x1298d5,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3212('0xa8')](ut['scheduledAt'](_0x1298d5,_0x3212('0xa7'),_0x3f92c1['dialNoSuchNumberRetryFrequency']),_0x1298d5[_0x3212('0xa9')],_0x1298d5[_0x3212('0xaa')]);}}delete this[_0x3212('0x19')][_0x4b822f[_0x3212('0xab')]];break;case _0x3212('0xac'):var _0x5aa666=moment()[_0x3212('0xad')](_0x3212('0x8c'));_0x1298d5[_0x3212('0xae')]=_0x5aa666;_0x1298d5[_0x3212('0xaf')]=_0x5aa666;_0x1298d5[_0x3212('0x74')]=!![];_0x3f92c1[_0x3212('0x33')]+=0x1;logger['info'](_0x3212('0xb0'),_0x1298d5[_0x3212('0xb1')],_0x3212('0xb2'),_0x3f92c1[_0x3212('0x2e')],_0x3212('0x73'),_0x3f92c1[_0x3212('0x33')]);ami[_0x3212('0x2c')](_0x3212('0xb3'),ut[_0x3212('0xa1')](_0x1298d5,_0x3212('0xb4'),this['campaignsPreview'][_0x1298d5['queue']]));if(_0x3f92c1[_0x3212('0xb5')]){ami[_0x3212('0x2c')]('custom:agentConnectPreview',ut[_0x3212('0xb6')](_0x1298d5));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x1298d5,'complete',this['campaignsPreview'][_0x1298d5['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x1298d5,_0x3212('0xb7')));_0x3f92c1['outboundAnswerCallsDay']+=0x1;_0x3f92c1[_0x3212('0x35')]+=0x1;_0x3f92c1[_0x3212('0x30')]+=0x1;ut[_0x3212('0x7c')](_0x3f92c1,_0x3212('0xb8'));_0x1298d5[_0x3212('0x9e')]=ut[_0x3212('0x9f')](_0x1298d5);ut[_0x3212('0x8d')](_0x1298d5,0x4,_0x3212('0xb9'));rpcDb[_0x3212('0x91')](_0x1298d5,_0x3212('0xba'));rpcDb[_0x3212('0xa6')](_0x1298d5,_0x3212('0xbb'));rpcDb[_0x3212('0xbc')](_0x1298d5);_0x3f92c1['sumDuration']+=_0x1298d5[_0x3212('0xbd')];_0x3f92c1['sumBillable']+=_0x1298d5[_0x3212('0xbd')];logger[_0x3212('0x5c')]('[syncHangup][talking][decrement]',_0x1298d5['uniqueid'],'\x20Queue',_0x3f92c1[_0x3212('0x2e')],'pTalking:\x20',_0x3f92c1['pTalking']);delete this[_0x3212('0x19')][_0x4b822f[_0x3212('0xab')]];break;case _0x3212('0xbe'):_0x3f92c1[_0x3212('0x41')]+=0x1;_0x1298d5[_0x3212('0xbf')]+=0x1;_0x1298d5[_0x3212('0x9e')]=ut['totalGlobal'](_0x1298d5);ut['logCustomer'](_0x1298d5,0x5,'Busy');ami['emit'](_0x3212('0xc0'),ut[_0x3212('0xa1')](_0x1298d5,'busy'));rpcDb['createCustomerHistory'](_0x1298d5,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1['dialGlobalMaxRetry']){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,_0x3212('0xa5'));rpcDb[_0x3212('0xa6')](_0x16b840,_0x3212('0xc1'));}else{if(_0x1298d5[_0x3212('0xbf')]>=_0x3f92c1[_0x3212('0xc2')]){rpcDb[_0x3212('0xa6')](_0x1298d5,_0x3212('0xc3'));}else{rpcDb['rescheduleContact'](ut[_0x3212('0xc4')](_0x1298d5,_0x3212('0xbf'),_0x3f92c1[_0x3212('0xc5')]),_0x1298d5[_0x3212('0xa9')],_0x1298d5[_0x3212('0xaa')]);}}break;case'NOANSWER':_0x3f92c1[_0x3212('0xc6')]+=0x1;_0x1298d5[_0x3212('0xc7')]+=0x1;_0x1298d5['countglobal']=ut[_0x3212('0x9f')](_0x1298d5);ut[_0x3212('0x8d')](_0x1298d5,0x3,_0x3212('0xc8'));ami[_0x3212('0x2c')](_0x3212('0xc9'),ut[_0x3212('0xa1')](_0x1298d5,_0x3212('0xca')));rpcDb['createCustomerHistory'](_0x1298d5,_0x3212('0xcb'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1[_0x3212('0xcc')]){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,_0x3212('0xa5'));rpcDb[_0x3212('0xa6')](_0x16b840,_0x3212('0xcd'));}else{if(_0x1298d5[_0x3212('0xc7')]>=_0x3f92c1[_0x3212('0xce')]){rpcDb[_0x3212('0xa6')](_0x1298d5,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x3212('0xa8')](ut[_0x3212('0xc4')](_0x1298d5,'countnoanswerretry',_0x3f92c1['dialNoAnswerRetryFrequency']),_0x1298d5['unlockAgent'],_0x1298d5[_0x3212('0xaa')]);}}break;case'CONGESTION':_0x3f92c1[_0x3212('0x42')]+=0x1;_0x1298d5['countcongestionretry']+=0x1;_0x1298d5['countglobal']=ut[_0x3212('0x9f')](_0x1298d5);ut['logCustomer'](_0x1298d5,0x8,_0x3212('0xcf'));ami[_0x3212('0x2c')](_0x3212('0xd0'),ut[_0x3212('0xa1')](_0x1298d5,'congestion'));rpcDb[_0x3212('0x91')](_0x1298d5,_0x3212('0xd1'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1['dialGlobalMaxRetry']){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,'Global');rpcDb[_0x3212('0xa6')](_0x16b840,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1298d5[_0x3212('0xd2')]>=_0x3f92c1[_0x3212('0xd3')]){rpcDb['createCustomerFinal'](_0x1298d5,_0x3212('0xd1'));}else{rpcDb[_0x3212('0xa8')](ut[_0x3212('0xc4')](_0x1298d5,_0x3212('0xd2'),_0x3f92c1[_0x3212('0xc5')]),_0x1298d5[_0x3212('0xa9')],_0x1298d5[_0x3212('0xaa')]);}}break;case _0x3212('0xd4'):_0x3f92c1['outboundRejectCallsDay']+=0x1;_0x1298d5[_0x3212('0xd5')]+=0x1;_0x1298d5[_0x3212('0x9e')]=ut['totalGlobal'](_0x1298d5);ut[_0x3212('0x8d')](_0x1298d5,0x14,_0x3212('0xd6'));ami[_0x3212('0x2c')](_0x3212('0xd7'),ut[_0x3212('0xa1')](_0x1298d5,'agentreject'));rpcDb[_0x3212('0x91')](_0x1298d5,_0x3212('0xd8'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1[_0x3212('0xcc')]){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x16b840,_0x3212('0xd9'));}else{if(_0x1298d5['countagentrejectretry']>=_0x3f92c1[_0x3212('0xda')]){rpcDb['createCustomerFinal'](_0x1298d5,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3212('0xa8')](ut['scheduledAt'](_0x1298d5,_0x3212('0xd5'),_0x3f92c1['dialAgentRejectRetryFrequency']),_0x1298d5[_0x3212('0xa9')],_0x1298d5[_0x3212('0xaa')]);}}break;case _0x3212('0xdb'):_0x3f92c1[_0x3212('0x4b')]+=0x1;_0x1298d5[_0x3212('0xdc')]+=0x1;_0x1298d5[_0x3212('0x9e')]=ut[_0x3212('0x9f')](_0x1298d5);ut[_0x3212('0x8d')](_0x1298d5,0xb,_0x3212('0xdd'));rpcDb['createCustomerHistory'](_0x1298d5,_0x3212('0xde'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1[_0x3212('0xcc')]){_0x16b840=ut['cloneAction'](_0x1298d5,0xf,_0x3212('0xa5'));rpcDb[_0x3212('0xa6')](_0x16b840,_0x3212('0xde'));}else{if(_0x1298d5[_0x3212('0xdf')]>=_0x3f92c1[_0x3212('0xe0')]){rpcDb[_0x3212('0xa6')](_0x1298d5,_0x3212('0xde'));}else{rpcDb[_0x3212('0xa8')](ut['scheduledAt'](_0x1298d5,_0x3212('0xdc'),_0x3f92c1[_0x3212('0xe1')]),_0x1298d5[_0x3212('0xa9')],_0x1298d5[_0x3212('0xaa')]);}}break;case'18':_0x3f92c1[_0x3212('0x4a')]+=0x1;_0x1298d5[_0x3212('0xe2')]+=0x1;_0x1298d5[_0x3212('0x9e')]=ut[_0x3212('0x9f')](_0x1298d5);ut[_0x3212('0x8d')](_0x1298d5,0x12,_0x4b822f[_0x3212('0xe3')]||_0x4b822f[_0x3212('0xe4')]);ami[_0x3212('0x2c')](_0x3212('0xe5'),ut['buildObj'](_0x1298d5,_0x3212('0xe6')));rpcDb[_0x3212('0x91')](_0x1298d5,_0x3212('0xe7'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1[_0x3212('0xcc')]){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,_0x3212('0xa5'));rpcDb[_0x3212('0xa6')](_0x16b840,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x3212('0xa6')](_0x1298d5,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x3212('0x19')][_0x4b822f[_0x3212('0xab')]];break;case'19':_0x3f92c1[_0x3212('0x4a')]+=0x1;_0x1298d5['countglobal']=ut['totalGlobal'](_0x1298d5);ut['logCustomer'](_0x1298d5,0x13,_0x4b822f[_0x3212('0xe3')]||_0x4b822f[_0x3212('0xe4')]);ami['emit'](_0x3212('0xe5'),ut[_0x3212('0xa1')](_0x1298d5,_0x3212('0xe6')));rpcDb[_0x3212('0x91')](_0x1298d5,_0x3212('0xe8'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1[_0x3212('0xcc')]){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,'Global');rpcDb[_0x3212('0xa6')](_0x16b840,_0x3212('0xe8'));}else{rpcDb[_0x3212('0xa6')](_0x1298d5,_0x3212('0xe8'));}delete this[_0x3212('0x19')][_0x4b822f['linkedid']];break;default:if(_0x1298d5[_0x3212('0x74')]){ut[_0x3212('0x7c')](_0x3f92c1,_0x3212('0xe9'));ut[_0x3212('0x7d')](_0x3212('0xea')+_0x3f92c1['name'],_0x4b822f);}_0x3f92c1[_0x3212('0x4a')]+=0x1;_0x1298d5['countglobal']=ut['totalGlobal'](_0x1298d5);ut['logCustomer'](_0x1298d5,0xc,_0x4b822f['cause-txt']||_0x4b822f[_0x3212('0xe4')]);rpcDb[_0x3212('0x91')](_0x1298d5,_0x3212('0xeb'));if(ut[_0x3212('0x9f')](_0x1298d5)>=_0x3f92c1[_0x3212('0xcc')]){_0x16b840=ut[_0x3212('0xa4')](_0x1298d5,0xf,_0x3212('0xa5'));rpcDb[_0x3212('0xa6')](_0x16b840,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x1298d5,_0x3212('0xec'));}delete this[_0x3212('0x19')][_0x4b822f['linkedid']];}if(!(_0x1298d5[_0x3212('0x74')]&&_0x4440f4==='16')){ut[_0x3212('0xed')](_0x3f92c1,'[callProgressDetectingCustomer]');logger[_0x3212('0x5c')]('[originated][decrement][callProgressDetectingCustomer]',_0x1298d5['uniqueid'],_0x3212('0xb2'),_0x3f92c1[_0x3212('0x2e')],_0x3212('0xee'),_0x3f92c1[_0x3212('0x53')]);}if(_0x4440f4!==_0x3212('0xac')){delete this[_0x3212('0x19')][_0x4b822f['linkedid']];delete this[_0x3212('0x19')][_0x4b822f[_0x3212('0xef')]];}}};Preview['prototype'][_0x3212('0xf0')]=function(_0x1af512,_0x3ba44e,_0x4abd52){if(_[_0x3212('0xf1')](_0x3ba44e)&&'object'!==typeof _0x3ba44e){return;}if(_[_0x3212('0xf1')](_0x4abd52)&&'object'!==typeof _0x4abd52){return;}switch(_0x4abd52['reason']){case'0':ut['logAgent'](_0x1af512,0x0,_0x3212('0xa0'));rpcDb[_0x3212('0xf2')](_0x1af512,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3212('0xf3')](_0x1af512,0x3,_0x3212('0xc8'));rpcDb[_0x3212('0xf2')](_0x1af512,_0x3212('0xf4'));break;case'5':ut[_0x3212('0xf3')](_0x1af512,0x5,_0x3212('0xf5'));rpcDb[_0x3212('0xf2')](_0x1af512,_0x3212('0xf6'));break;case'8':ut[_0x3212('0xf3')](_0x1af512,0x8,'Congestion');rpcDb[_0x3212('0xf2')](_0x1af512,_0x3212('0xf7'));break;case'22':ut[_0x3212('0xf3')](_0x1af512,0x16,_0x3212('0xf8'));rpcDb[_0x3212('0xf2')](_0x1af512,_0x3212('0xf9'));break;default:ut[_0x3212('0xf3')](_0x1af512,0xc,_0x4abd52[_0x3212('0xfa')]);rpcDb[_0x3212('0xf2')](_0x1af512,_0x3212('0xf7'));}ut[_0x3212('0xed')](_0x3ba44e,_0x3212('0xfb'));logger[_0x3212('0x5c')]('[originated][decrement][callProgressDetectingAgent]',_0x1af512['uniqueid'],_0x3212('0xb2'),_0x3ba44e[_0x3212('0x2e')],'originated:\x20',_0x3ba44e[_0x3212('0x53')]);delete this['actions'][_0x1af512[_0x3212('0xb1')]];};Preview[_0x3212('0x12')]['checkInBlack']=function(_0x29436c,_0x38050a,_0x268fde,_0x397ecc,_0x2fb485){var _0x50db20=this;return new BPromise(function(_0x3aaf30,_0x31d450){if(_[_0x3212('0x6f')](_0x38050a)||_[_0x3212('0x6f')](_0x38050a['Contact'])||_[_0x3212('0x6f')](_0x38050a[_0x3212('0xfc')][_0x3212('0xfd')])||_[_0x3212('0x6f')](_0x38050a['VoiceQueueId'])){_0x31d450(ut[_0x3212('0x52')]('Contact\x20is\x20undefined',_0x397ecc,_0x2fb485));return;}var _0x13fb21=uuid['v4']();var _0x226b31=_0x50db20[_0x3212('0x16')][_0x38050a['Queue'][_0x3212('0x2e')]];var _0x492baa=_0x268fde?_0x50db20['agents'][_0x268fde]['id']:undefined;_0x50db20['actions'][_0x13fb21]=new Action(_0x38050a,_0x226b31,_0x13fb21,_0x268fde,_0x492baa);var _0x2c895a=_0x50db20[_0x3212('0x19')][_0x13fb21];_0x2c895a[_0x3212('0xa9')]=_0x397ecc;_0x2c895a[_0x3212('0xaa')]=_0x2fb485;_0x2c895a[_0x3212('0xfe')]=_0x268fde;if(_['isEmpty'](_0x29436c)){_0x50db20[_0x3212('0xff')](_0x2c895a,_0x226b31,_0x38050a,_0x268fde)[_0x3212('0x100')](function(_0xea0e49){logger['info'](_0x3212('0x101'),_0x3212('0x102')+_0x2c895a[_0x3212('0x72')]+'\x20IdHopper:\x20'+_0x2c895a[_0x3212('0x103')],JSON[_0x3212('0x5b')](_0xea0e49));ami[_0x3212('0x2c')](_0x3212('0x104'),ut['buildObj'](_0x2c895a,_0x3212('0x105'),_0x50db20[_0x3212('0x16')][_0x2c895a[_0x3212('0x72')]]));_0x3aaf30(ut[_0x3212('0x52')](_0x3212('0x106')));})[_0x3212('0x7a')](function(_0x2c58f5){ut[_0x3212('0x62')](_0x3212('0x107'),_0x2c58f5);_0x31d450(ut[_0x3212('0x52')](_0x3212('0x108'),_0x397ecc,_0x2fb485));});}else{_0x226b31['outboundBlacklistCallsDay']+=0x1;ut[_0x3212('0x109')](_0x2c895a);rpcDb[_0x3212('0x10a')](_0x2c895a,_0x3212('0x10b'));delete _0x50db20['actions'][_0x13fb21];_0x31d450(ut[_0x3212('0x52')]('Contact\x20in\x20black\x20List',_0x397ecc,_0x2fb485));}});};Preview[_0x3212('0x12')][_0x3212('0x9a')]=function(_0x43235f){return!_[_0x3212('0x6f')](_0x43235f)&&!_['isNil'](_0x43235f['name'])&&!_[_0x3212('0x6f')](_0x43235f['active'])&&_0x43235f['active']&&!_[_0x3212('0x6f')](this[_0x3212('0x18')][util[_0x3212('0xad')]('SIP/%s',_0x43235f[_0x3212('0x2e')])])&&!_[_0x3212('0x6f')](this[_0x3212('0x18')][util['format'](_0x3212('0x10c'),_0x43235f[_0x3212('0x2e')])]['status'])&&(this[_0x3212('0x18')][util[_0x3212('0xad')](_0x3212('0x10c'),_0x43235f[_0x3212('0x2e')])][_0x3212('0x79')]===_0x3212('0x10d')||this[_0x3212('0x18')][util[_0x3212('0xad')]('SIP/%s',_0x43235f[_0x3212('0x2e')])][_0x3212('0x79')]===_0x3212('0x10e'));};Preview['prototype']['run']=function(_0x502bba,_0xbcb7bc){var _0x282257=this;return new BPromise(function(_0x288cbc,_0x5594f0){_0x282257[_0x3212('0x10f')](_0x502bba,_0xbcb7bc)[_0x3212('0x100')](function(_0x27d87b){_0x288cbc(_[_0x3212('0x75')](_0x27d87b,[_0x3212('0x52')]));})[_0x3212('0x7a')](function(_0x389405){if(_0x389405[_0x3212('0x110')]){rpcDb[_0x3212('0x111')](_0x502bba);}if(_0x389405[_0x3212('0x59')]){rpcDb[_0x3212('0x8a')](_0x502bba);}_0x5594f0(_[_0x3212('0x75')](_0x389405,[_0x3212('0x52')]));});});};Preview[_0x3212('0x12')][_0x3212('0x10f')]=function(_0x59dc1a,_0x5410ee){var _0x7c6c98=this;return new BPromise(function(_0x276440,_0x50ed8d){var _0x151c1b,_0x49808d;rpcDb[_0x3212('0x112')](_0x59dc1a)['then'](function(_0x2416bb){if(!_[_0x3212('0x6f')](_0x2416bb[0x0])){_0x49808d=_0x2416bb[0x0][_0x3212('0x113')]?![]:!![];_0x151c1b=_0x2416bb[0x0][_0x3212('0x113')]?!![]:![];_0x151c1b=_0x5410ee?!![]:_0x151c1b;}var _0x2486fd=_0x7c6c98[_0x3212('0x114')](_0x2416bb);if(_0x2486fd[_0x3212('0x115')]){rpcDb[_0x3212('0x116')](_['pick'](_0x2416bb[0x0],[_0x3212('0x117'),_0x3212('0x118')]))['then'](function(_0x43ef03){_0x7c6c98['checkInBlack'](_0x43ef03,_0x2416bb[0x0],_0x5410ee,_0x49808d,_0x151c1b)[_0x3212('0x100')](function(_0x4873f5){_0x276440(_0x4873f5);})[_0x3212('0x7a')](function(_0x99efa3){_0x50ed8d(_0x99efa3);});})[_0x3212('0x7a')](function(_0x270212){ut[_0x3212('0x62')](_0x3212('0x119'),_0x270212);_0x50ed8d(ut['message'](_0x3212('0x11a'),_0x49808d,_0x151c1b));});}else{_0x50ed8d(ut[_0x3212('0x52')](_0x2486fd[_0x3212('0x52')],_0x49808d,_0x151c1b));}})['catch'](function(_0x3bd5a1){ut[_0x3212('0x62')](_0x3212('0x11b'),_0x3bd5a1);_0x50ed8d(ut[_0x3212('0x52')](_0x3212('0x11a'),![],!![]));});});};Preview[_0x3212('0x12')][_0x3212('0x114')]=function(_0x3c3b97){if(_[_0x3212('0x6f')](_0x3c3b97)||_[_0x3212('0x11c')](_0x3c3b97)||!_[_0x3212('0x6f')](_0x3c3b97[0x0][_0x3212('0x86')])&&_[_0x3212('0x6f')](_0x3c3b97[0x0]['Agent']['name'])){ut[_0x3212('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x3c3b97);return{'isValid':![],'message':_0x3212('0x11d')};}var _0x48b8c8=this[_0x3212('0x16')][_0x3c3b97[0x0][_0x3212('0x71')][_0x3212('0x2e')]];_0x48b8c8[_0x3212('0x52')]=_0x3212('0x9c');if(_['isNil'](_0x48b8c8)){ut[_0x3212('0x62')]('[Preview][validateContact][Empty\x20Campaign]',_0x48b8c8);return{'isValid':![],'message':_0x3212('0x11e')};}if(!this[_0x3212('0x9a')](_0x48b8c8[_0x3212('0x58')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x48b8c8[_0x3212('0x2e')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x48b8c8[_0x3212('0x11f')])){ut[_0x3212('0x62')](_0x3212('0x120'),_0x48b8c8[_0x3212('0x2e')]+_0x3212('0x121'));return{'isValid':![],'message':_0x3212('0x122')};}}if(!ut[_0x3212('0x98')](_0x48b8c8[_0x3212('0x39')])){ut[_0x3212('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x48b8c8[_0x3212('0x2e')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x3212('0x123')+_0x48b8c8[_0x3212('0x2e')]+_0x3212('0x124')};}return{'isValid':!![],'message':_0x3212('0x125')};};Preview[_0x3212('0x12')][_0x3212('0xff')]=function(_0x27c7da,_0x520ec1,_0xe0a4c0,_0x8f1710){var _0x150aa9=this;return new BPromise(function(_0xd3ca91,_0xafe5e3){var _0x5bdd02=_0x27c7da[_0x3212('0xb1')];var _0x556786=_0x150aa9['isTrunkReachable'](_0x520ec1['Trunk'])?util[_0x3212('0xad')]('SIP/%s/%s%s',_0x520ec1['Trunk'][_0x3212('0x2e')],_['isNil'](_0x520ec1[_0x3212('0x3d')])?'':_0x520ec1[_0x3212('0x3d')]['trim']()||'',_0x520ec1[_0x3212('0x126')]>0x0?_0xe0a4c0[_0x3212('0xfc')][_0x3212('0xfd')][_0x3212('0x127')](_0x520ec1[_0x3212('0x126')]):_0xe0a4c0[_0x3212('0xfc')]['phone']):util['format']('SIP/%s/%s%s',_[_0x3212('0x6f')](_0x520ec1[_0x3212('0x11f')])?_0x520ec1[_0x3212('0x58')][_0x3212('0x2e')]:_0x520ec1[_0x3212('0x11f')]['name'],_[_0x3212('0x6f')](_0x520ec1[_0x3212('0x3d')])?'':_0x520ec1[_0x3212('0x3d')][_0x3212('0x128')]()||'',_0x520ec1[_0x3212('0x126')]>0x0?_0xe0a4c0[_0x3212('0xfc')]['phone'][_0x3212('0x127')](_0x520ec1[_0x3212('0x126')]):_0xe0a4c0['Contact'][_0x3212('0xfd')]);var _0x514911=_0x150aa9[_0x3212('0x9a')](_0x520ec1[_0x3212('0x58')])?ut[_0x3212('0x129')](_0x520ec1[_0x3212('0x58')]['callerid'],_0x520ec1['dialOriginateCallerIdName'],_0x520ec1[_0x3212('0x12a')]>0x0?ut[_0x3212('0x12b')](_0x520ec1[_0x3212('0x3b')],_0x520ec1[_0x3212('0x12a')]):_0x520ec1[_0x3212('0x3b')]):ut[_0x3212('0x129')](_[_0x3212('0x6f')](_0x520ec1[_0x3212('0x11f')])?_0x520ec1[_0x3212('0x58')][_0x3212('0x12c')]:_0x520ec1[_0x3212('0x11f')][_0x3212('0x12c')],_0x520ec1['dialOriginateCallerIdName'],_0x520ec1[_0x3212('0x12a')]>0x0?ut[_0x3212('0x12b')](_0x520ec1[_0x3212('0x3b')],_0x520ec1['dialRandomLastDigitCallerIdNumber']):_0x520ec1[_0x3212('0x3b')]);if(_0x514911){_0x27c7da[_0x3212('0x12d')]=ut[_0x3212('0x12e')](_0x514911);_0x27c7da[_0x3212('0x12f')]=ut[_0x3212('0x130')](_0x514911);}var _0x466c00=ut[_0x3212('0x131')](_0x520ec1,_0xe0a4c0,_0x556786,_0x514911,_0x5bdd02,_0x27c7da);_[_0x3212('0x132')](_0x27c7da,ut[_0x3212('0x133')](_0x466c00));_0x27c7da[_0x3212('0x8b')]=moment()[_0x3212('0xad')](_0x3212('0x8c'));ami[_0x3212('0x78')](ut[_0x3212('0x134')](_0x27c7da,_0x520ec1,_0x466c00,_0x27c7da['activeContact'],_0x8f1710))[_0x3212('0x100')](function(_0x128e75){_0x520ec1[_0x3212('0x53')]+=0x1;logger[_0x3212('0x5c')]('[originated][increment]',_0x5bdd02,'\x20Queue',_0x520ec1[_0x3212('0x2e')],_0x3212('0xee'),_0x520ec1[_0x3212('0x53')]);_0xd3ca91(_0x128e75);})[_0x3212('0x7a')](function(_0x29cd7b){ut[_0x3212('0xf3')](_0x27c7da,0xe,_0x3212('0x135'));rpcDb['createAgentHistory'](_0x27c7da,_0x3212('0x136'));_0xafe5e3(_0x29cd7b);});});};Preview[_0x3212('0x12')][_0x3212('0x26')]=function(_0x448010){if(this[_0x3212('0x19')][_0x448010[_0x3212('0xab')]]){this['actions'][_0x448010[_0x3212('0xab')]][_0x3212('0x137')]=_0x448010[_0x3212('0x137')];}};Preview[_0x3212('0x12')][_0x3212('0x1d')]=function(_0x35fad9){var _0x166fb9=this;var _0x2a6c94=this[_0x3212('0x19')][_0x35fad9[_0x3212('0x138')]];if(_0x2a6c94){if(_0x2a6c94[_0x3212('0xfe')]&&this[_0x3212('0x1a')][_0x2a6c94[_0x3212('0xfe')]]){ut[_0x3212('0x139')](_0x2a6c94,this['agents'][_0x2a6c94[_0x3212('0xfe')]][_0x3212('0x2e')],this[_0x3212('0x1a')][_0x2a6c94[_0x3212('0xfe')]]['id']);}var _0x3338c3=_[_0x3212('0x13a')](_0x2a6c94);_0x3338c3['responsetime']=moment()[_0x3212('0xad')](_0x3212('0x8c'));var _0x47f30e=_0x166fb9[_0x3212('0x16')][_0x2a6c94[_0x3212('0x72')]];if(ut['isFailure'](_0x35fad9[_0x3212('0x13b')])){if(_0x2a6c94[_0x3212('0xa9')]){rpcDb[_0x3212('0x111')](_0x2a6c94['idContact']);}if(_0x2a6c94[_0x3212('0xaa')]){rpcDb[_0x3212('0x8a')](_0x2a6c94[_0x3212('0x103')]);}ami[_0x3212('0x2c')]('custom:agentringnoanswer',ut[_0x3212('0xa1')](_0x2a6c94,'rejected',this[_0x3212('0x16')][_0x2a6c94[_0x3212('0x72')]]));this[_0x3212('0xf0')](_0x3338c3,_0x47f30e,_0x35fad9);}else{_0x2a6c94[_0x3212('0x8b')]=moment()[_0x3212('0xad')](_0x3212('0x8c'));ut['logAgent'](_0x3338c3,0x4,_0x3212('0xb9'));rpcDb[_0x3212('0xf2')](_0x3338c3,_0x3212('0x13c'));}}};Preview['prototype'][_0x3212('0x20')]=function(_0x254000){var _0x209168=this;var _0x4ec097=this[_0x3212('0x19')][_0x254000['linkedid']];var _0x2ab36a;if(_0x4ec097){_0x2ab36a=this[_0x3212('0x16')][_0x4ec097[_0x3212('0x72')]];logger[_0x3212('0x5c')]('[syncHangup][talking]',_0x254000[_0x3212('0xab')],'\x20Queue',_0x2ab36a[_0x3212('0x2e')],'pTalking:\x20',_0x2ab36a[_0x3212('0x33')]);}if(this[_0x3212('0x19')][_0x254000[_0x3212('0xab')]]&&_0x254000['linkedid']!==_0x254000['uniqueid']){if(_0x254000[_0x3212('0x13d')]==='16'&&this[_0x3212('0x19')][_0x254000[_0x3212('0xab')]][_0x3212('0x74')]){this['callProgressDetectingCustomer'](_0x254000,_0x254000[_0x3212('0xab')],_0x254000[_0x3212('0x13d')]);}else if(this[_0x3212('0x19')][_0x254000[_0x3212('0xab')]][_0x3212('0x74')]){logger[_0x3212('0x5c')](_0x3212('0x13e'),_0x254000[_0x3212('0xab')],_0x254000['cause'],_0x3212('0xb2'),_0x2ab36a[_0x3212('0x2e')],'pTalking:\x20',_0x2ab36a[_0x3212('0x33')]);this[_0x3212('0x9d')](_0x254000,_0x254000[_0x3212('0xab')],_0x254000[_0x3212('0x13d')]);}}else if(_0x4ec097&&_[_0x3212('0x6f')](_0x4ec097[_0x3212('0x13f')])&&_0x2ab36a['dialQueueProject']&&_0x254000[_0x3212('0xab')]===_0x254000['uniqueid']&&_[_0x3212('0x6f')](_0x254000[_0x3212('0xfa')])&&_0x254000[_0x3212('0x13d')]==='16'&&_0x254000['channelstate']==='6'&&_[_0x3212('0xf1')](_0x4ec097[_0x3212('0x140')])){if(_0x4ec097[_0x3212('0xa9')]){rpcDb[_0x3212('0x111')](_0x4ec097[_0x3212('0x103')]);}if(_0x4ec097[_0x3212('0xaa')]){rpcDb[_0x3212('0x8a')](_0x4ec097[_0x3212('0x103')]);}_0x254000[_0x3212('0xfa')]='22';this['callProgressDetectingAgent'](_0x4ec097,_0x2ab36a,_0x254000);}else if(_0x4ec097&&_0x4ec097[_0x3212('0x140')]){if(_0x254000[_0x3212('0x13d')]==='16'&&this[_0x3212('0x19')][_0x254000[_0x3212('0xab')]][_0x3212('0x74')]){logger['info']('[syncHangup][talking][transfer]',_0x254000[_0x3212('0xab')],_0x254000['cause'],_0x3212('0xb2'),_0x2ab36a['name'],_0x3212('0x73'),_0x2ab36a[_0x3212('0x33')]);this[_0x3212('0x9d')](_0x254000,_0x254000['linkedid'],_0x254000[_0x3212('0x13d')]);}else if(this[_0x3212('0x19')][_0x254000['linkedid']]['dialAnswer']){logger[_0x3212('0x5c')](_0x3212('0x13e'),_0x254000[_0x3212('0xab')],_0x254000['cause'],_0x3212('0xb2'),_0x2ab36a['name'],_0x3212('0x73'),_0x2ab36a['pTalking']);this['callProgressDetectingCustomer'](_0x254000,_0x254000[_0x3212('0xab')],_0x254000[_0x3212('0x13d')]);}}};Preview[_0x3212('0x12')][_0x3212('0x24')]=function(_0x3cff96){if(this[_0x3212('0x19')][_0x3cff96['destlinkedid']]&&_0x3cff96[_0x3212('0xef')]!==_0x3cff96[_0x3212('0x141')]){this['callProgressDetectingCustomer'](_0x3cff96,_0x3cff96[_0x3212('0xef')],_0x3cff96[_0x3212('0xe4')]);}};Preview[_0x3212('0x12')][_0x3212('0x22')]=function(_0x43da67){if(this[_0x3212('0x19')][_0x43da67[_0x3212('0xab')]]&&_0x43da67[_0x3212('0xab')]!==_0x43da67['uniqueid']&&!this[_0x3212('0x19')][_0x43da67['linkedid']]['dialAnswer']){if(_0x43da67[_0x3212('0x13d')]==='1'){this[_0x3212('0x9d')](_0x43da67,_0x43da67['linkedid'],_0x43da67['cause']);}}};Preview[_0x3212('0x12')][_0x3212('0x142')]=function(_0x5bff17,_0x2fbc49,_0x52078d){if(this[_0x3212('0x19')][_0x5bff17]){if(_[_0x3212('0x6f')](this['actions'][_0x5bff17][_0x3212('0x143')])){this[_0x3212('0x19')][_0x5bff17]['variables']={};}this['actions'][_0x5bff17][_0x3212('0x143')][_0x2fbc49]=_0x52078d;}};Preview[_0x3212('0x12')][_0x3212('0x144')]=function(_0x25da84){try{if(!_[_0x3212('0x6f')](_0x25da84)){if(ut[_0x3212('0x145')](_['keys'](_0x25da84['variable'])[0x0])){this[_0x3212('0x142')](_0x25da84['uniqueid'],_['keys'](_0x25da84['variable'])[0x0],_0x25da84['value']);}}}catch(_0x323c64){logger[_0x3212('0x146')](_0x3212('0x147'),util[_0x3212('0x148')](_0x323c64,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x3212('0x149')]=function(_0x23d191){if(_0x23d191){if(this[_0x3212('0x19')][_0x23d191[_0x3212('0x14a')]]){this[_0x3212('0x19')][_0x23d191[_0x3212('0x14a')]][_0x3212('0x140')]=!![];}}};Preview[_0x3212('0x12')][_0x3212('0x2a')]=function(_0x48c624){if(_0x48c624){if(this['actions'][_0x48c624[_0x3212('0x14b')]]){this[_0x3212('0x19')][_0x48c624[_0x3212('0x14b')]][_0x3212('0x140')]=!![];}}};module[_0x3212('0x14c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index aed0273..499f2d7 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 _0xad42=['createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','membername','context','from-sip','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory'];(function(_0x35bf0,_0x584098){var _0x31476f=function(_0x161b2b){while(--_0x161b2b){_0x35bf0['push'](_0x35bf0['shift']());}};_0x31476f(++_0x584098);}(_0xad42,0x132));var _0x2ad4=function(_0x3c3c6a,_0x4e13cd){_0x3c3c6a=_0x3c3c6a-0x0;var _0x434095=_0xad42[_0x3c3c6a];return _0x434095;};'use strict';var util=require(_0x2ad4('0x0'));var BPromise=require(_0x2ad4('0x1'));var logger=require(_0x2ad4('0x2'))(_0x2ad4('0x3'));var _=require(_0x2ad4('0x4'));var cmHopper=require(_0x2ad4('0x5'));var cmHopperFinal=require(_0x2ad4('0x6'));var cmHopperHistory=require(_0x2ad4('0x7'));var cmHopperBlack=require(_0x2ad4('0x8'));var voiceQueueRt=require(_0x2ad4('0x9'));var agentReportPreview=require(_0x2ad4('0xa'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xd03d71){return function(_0x955da8){logger[_0x2ad4('0xb')](_0xd03d71,util[_0x2ad4('0xc')](_0x955da8,{'showHidden':![],'depth':null}));};}function create(_0x56f3fb){return BPromise[_0x2ad4('0xd')]()['then'](cmHopperHistory[_0x2ad4('0xe')](_0x56f3fb))[_0x2ad4('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x89ad32){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x89ad32))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x10')));}function moveContact(_0xfc825c){return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](cmHopper[_0x2ad4('0x12')](_0xfc825c,!![]))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x13')));}exports['checkIsBlackList']=function(_0x3b65f5){return BPromise['resolve']()[_0x2ad4('0x11')](cmHopperBlack[_0x2ad4('0x14')](_0x3b65f5))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x2ad4('0x15')]=function(_0xd835ae){return BPromise['resolve']()[_0x2ad4('0x11')](cmHopper['getContactPreview'](_0xd835ae))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x16')));};exports['createHistory']=function(_0x1d758c,_0x148a11){create(_0x1d758c)[_0x2ad4('0xf')](loggerCatch(_0x148a11));moveContact(_0x1d758c)[_0x2ad4('0xf')](loggerCatch(_0x148a11));};exports[_0x2ad4('0x17')]=function(_0x4d9160,_0x2a1164){createAgent(_0x4d9160)[_0x2ad4('0xf')](loggerCatch(_0x2a1164));};exports[_0x2ad4('0x18')]=function(_0x4f3f11,_0xb59a35){create(_0x4f3f11)[_0x2ad4('0xf')](loggerCatch(_0xb59a35));};exports[_0x2ad4('0x19')]=function(_0xcad283,_0x1bfb37){moveContact(_0xcad283)[_0x2ad4('0xf')](loggerCatch(_0x1bfb37));};exports[_0x2ad4('0x1a')]=function(_0x2bd5e4,_0x3cd979,_0x5a2b31){if(_0x3cd979){_0x2bd5e4['UserId']=null;}if(_0x5a2b31){_0x2bd5e4[_0x2ad4('0x1b')]=![];}return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](cmHopper['rescheduleContact'](_0x2bd5e4))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x1c')));};exports['countReScheduled']=function(_0x43a2d4){return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](cmHopper['countReScheduled'](_0x43a2d4))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x2ad4('0x1d')]=function(_0x49d646){return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](cmHopper['unlockContact']({'UserId':null},_0x49d646,0x1))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x1e')));};exports['disableContact']=function(_0x44cb76){return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](cmHopper[_0x2ad4('0x1d')]({'active':![]},_0x44cb76,0x1))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x1f')));};exports[_0x2ad4('0x20')]=function(_0x479854){var _0x181fa7={};_0x181fa7[_0x2ad4('0x21')]=_0x479854[_0x2ad4('0x21')];_0x181fa7[_0x2ad4('0x22')]=_0x479854[_0x2ad4('0x22')];_0x181fa7[_0x2ad4('0x23')]=_0x479854[_0x2ad4('0x23')];_0x181fa7[_0x2ad4('0x24')]=_0x479854[_0x2ad4('0x24')];_0x181fa7[_0x2ad4('0x25')]=_0x479854[_0x2ad4('0x25')];_0x181fa7[_0x2ad4('0x26')]=_0x479854['answertime'];_0x181fa7[_0x2ad4('0x27')]=_0x479854['answertime'];_0x181fa7['queuecallercomplete']=0x1;_0x181fa7[_0x2ad4('0x28')]=_0x479854['endtime'];_0x181fa7[_0x2ad4('0x29')]=_0x479854[_0x2ad4('0x2a')];_0x181fa7[_0x2ad4('0x2b')]=_0x2ad4('0x2c');_0x181fa7['exten']='xcally-motion-preview';_0x181fa7[_0x2ad4('0x2d')]=0x0;_0x181fa7[_0x2ad4('0x2e')]=0x1;_0x181fa7[_0x2ad4('0x2f')]=_0x479854[_0x2ad4('0x2a')];_0x181fa7[_0x2ad4('0x30')]=_0x2ad4('0x31');return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](voiceQueueReport[_0x2ad4('0x32')](_0x181fa7))[_0x2ad4('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x2ad4('0x33')]=function(_0x369520,_0x4fc49f){return BPromise[_0x2ad4('0xd')]()[_0x2ad4('0x11')](cmHopper[_0x2ad4('0x33')](_0x369520,_0x4fc49f))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x34')));};exports[_0x2ad4('0x35')]=function(_0x5158dd){return BPromise['resolve']()[_0x2ad4('0x11')](cmHopper[_0x2ad4('0x1a')](_0x5158dd,!![],!![]))[_0x2ad4('0xf')](loggerCatch(_0x2ad4('0x36')));}; \ No newline at end of file +var _0x3235=['resolve','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect'];(function(_0x3a7657,_0x53b871){var _0x5b46b9=function(_0x1039d9){while(--_0x1039d9){_0x3a7657['push'](_0x3a7657['shift']());}};_0x5b46b9(++_0x53b871);}(_0x3235,0x92));var _0x5323=function(_0x20154c,_0x3de32a){_0x20154c=_0x20154c-0x0;var _0x5cf4df=_0x3235[_0x20154c];return _0x5cf4df;};'use strict';var util=require(_0x5323('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x5323('0x1'));var _=require(_0x5323('0x2'));var cmHopper=require(_0x5323('0x3'));var cmHopperFinal=require(_0x5323('0x4'));var cmHopperHistory=require(_0x5323('0x5'));var cmHopperBlack=require(_0x5323('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x5323('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x419a10){return function(_0x3ff3a3){logger[_0x5323('0x8')](_0x419a10,util[_0x5323('0x9')](_0x3ff3a3,{'showHidden':![],'depth':null}));};}function create(_0x3e6735){return BPromise[_0x5323('0xa')]()['then'](cmHopperHistory['createHistory'](_0x3e6735))[_0x5323('0xb')](loggerCatch(_0x5323('0xc')));}function createAgent(_0x1ff46d){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](agentReportPreview['createHistory'](_0x1ff46d))[_0x5323('0xb')](loggerCatch(_0x5323('0xc')));}function moveContact(_0x1cb299){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopper[_0x5323('0xe')](_0x1cb299,!![]))[_0x5323('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x5323('0xf')]=function(_0x37c944){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopperBlack[_0x5323('0xf')](_0x37c944))[_0x5323('0xb')](loggerCatch(_0x5323('0x10')));};exports[_0x5323('0x11')]=function(_0x35a06c){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopper[_0x5323('0x11')](_0x35a06c))[_0x5323('0xb')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x564761,_0x276016){create(_0x564761)[_0x5323('0xb')](loggerCatch(_0x276016));moveContact(_0x564761)[_0x5323('0xb')](loggerCatch(_0x276016));};exports[_0x5323('0x12')]=function(_0x537431,_0x45aa7c){createAgent(_0x537431)[_0x5323('0xb')](loggerCatch(_0x45aa7c));};exports[_0x5323('0x13')]=function(_0x19b216,_0x54766a){create(_0x19b216)[_0x5323('0xb')](loggerCatch(_0x54766a));};exports[_0x5323('0x14')]=function(_0xebe352,_0x140b4e){moveContact(_0xebe352)[_0x5323('0xb')](loggerCatch(_0x140b4e));};exports[_0x5323('0x15')]=function(_0x444572,_0x50f1e5,_0x58d9e7){if(_0x50f1e5){_0x444572[_0x5323('0x16')]=null;}if(_0x58d9e7){_0x444572[_0x5323('0x17')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x5323('0x15')](_0x444572))[_0x5323('0xb')](loggerCatch(_0x5323('0x18')));};exports['countReScheduled']=function(_0x33e046){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopper[_0x5323('0x19')](_0x33e046))['catch'](loggerCatch(_0x5323('0x1a')));};exports['unlockContact']=function(_0x2abe9a){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopper[_0x5323('0x1b')]({'UserId':null},_0x2abe9a,0x1))['catch'](loggerCatch(_0x5323('0x1c')));};exports['disableContact']=function(_0x3ccfa1){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopper['unlockContact']({'active':![]},_0x3ccfa1,0x1))[_0x5323('0xb')](loggerCatch(_0x5323('0x1d')));};exports[_0x5323('0x1e')]=function(_0x5198c7){var _0x5d6ae2={};_0x5d6ae2['type']=_0x5198c7[_0x5323('0x1f')];_0x5d6ae2[_0x5323('0x20')]=_0x5198c7['uniqueid'];_0x5d6ae2[_0x5323('0x21')]=_0x5198c7[_0x5323('0x21')];_0x5d6ae2['calleridname']=_0x5198c7['calleridname'];_0x5d6ae2[_0x5323('0x22')]=_0x5198c7[_0x5323('0x22')];_0x5d6ae2[_0x5323('0x23')]=_0x5198c7[_0x5323('0x24')];_0x5d6ae2[_0x5323('0x25')]=_0x5198c7['answertime'];_0x5d6ae2[_0x5323('0x26')]=0x1;_0x5d6ae2[_0x5323('0x27')]=_0x5198c7['endtime'];_0x5d6ae2[_0x5323('0x28')]=_0x5198c7['membername'];_0x5d6ae2['context']='from-sip';_0x5d6ae2['exten']='xcally-motion-preview';_0x5d6ae2[_0x5323('0x29')]=0x0;_0x5d6ae2['assigned']=0x1;_0x5d6ae2[_0x5323('0x2a')]=_0x5198c7[_0x5323('0x2b')];_0x5d6ae2[_0x5323('0x2c')]=_0x5323('0x2d');return BPromise[_0x5323('0xa')]()['then'](voiceQueueReport[_0x5323('0x2e')](_0x5d6ae2))['catch'](loggerCatch(_0x5323('0x2f')));};exports[_0x5323('0x30')]=function(_0x4a11b8,_0x353db1){return BPromise[_0x5323('0xa')]()['then'](cmHopper[_0x5323('0x30')](_0x4a11b8,_0x353db1))[_0x5323('0xb')](loggerCatch(_0x5323('0x31')));};exports[_0x5323('0x32')]=function(_0x2ca1fc){return BPromise[_0x5323('0xa')]()[_0x5323('0xd')](cmHopper[_0x5323('0x15')](_0x2ca1fc,!![],!![]))['catch'](loggerCatch(_0x5323('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index c80223d..7bc79e3 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 _0x922e=['dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','starttime','talktime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','uniqueid','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countnoanswerretry','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22'];(function(_0x961b28,_0x1fdbaa){var _0x477083=function(_0x36bbee){while(--_0x36bbee){_0x961b28['push'](_0x961b28['shift']());}};_0x477083(++_0x1fdbaa);}(_0x922e,0x105));var _0xe922=function(_0x3ee369,_0x311aff){_0x3ee369=_0x3ee369-0x0;var _0xd65c5e=_0x922e[_0x3ee369];return _0xd65c5e;};'use strict';var util=require(_0xe922('0x0'));var _=require(_0xe922('0x1'));var moment=require(_0xe922('0x2'));var logger=require(_0xe922('0x3'))(_0xe922('0x4'));var ipAgi=process['env'][_0xe922('0x5')]||'127.0.0.1';function getSeconds(_0x15de2f,_0x5a2d5b){var _0x5879fb=moment(_0x15de2f)[_0xe922('0x6')](0x0);var _0x2c9666=moment(_0x5a2d5b)[_0xe922('0x6')](0x0);return _0x5879fb['diff'](_0x2c9666,_0xe922('0x7'));}exports[_0xe922('0x8')]=function(_0x444f77){return function(_0x269391){logger[_0xe922('0x9')](_0x444f77,util[_0xe922('0xa')](_0x269391,{'showHidden':![],'depth':null}));};};exports[_0xe922('0xb')]=function(_0x39d0a5,_0x5e130a){logger[_0xe922('0xc')](_0x39d0a5,util[_0xe922('0xa')](_0x5e130a,{'showHidden':![],'depth':null}));};exports[_0xe922('0xd')]=function(_0x4c651f,_0x53f33b){logger[_0xe922('0x9')](_0x4c651f,util['inspect'](_0x53f33b,{'showHidden':![],'depth':null}));};exports[_0xe922('0xe')]=function(_0xabd08b){return function(_0x1d22b9){logger[_0xe922('0xc')](_0xabd08b,util[_0xe922('0xa')](_0x1d22b9,{'showHidden':![],'depth':null}));};};exports[_0xe922('0xf')]=function(_0x7a96cd,_0x52848f,_0x53af5e){return{'message':_0x7a96cd,'unlock':_0x52848f,'active':_0x53af5e};};exports[_0xe922('0x10')]=function(_0x45314c,_0x26f921,_0x177d19){if(!_[_0xe922('0x11')](_0x177d19)&&'string'===typeof _0x177d19&&!_['isEmpty'](_0x177d19)){if(!_[_0xe922('0x11')](_0x26f921)&&_0xe922('0x12')===typeof _0x26f921&&!_[_0xe922('0x13')](_0x26f921)){return util[_0xe922('0x14')]('\x22%s\x22\x20<%s>',_0x26f921,_0x177d19);}return util[_0xe922('0x14')]('\x22%s\x22\x20<%s>',_0x177d19,_0x177d19);}if(!_[_0xe922('0x11')](_0x45314c)&&_0xe922('0x12')===typeof _0x45314c&&!_[_0xe922('0x13')](_0x45314c)){return _0x45314c;}return _0xe922('0x15');};exports[_0xe922('0x16')]=function(_0x338099){if(_[_0xe922('0x17')](_0x338099)){return![];}return _0x338099;};exports[_0xe922('0x18')]=function(_0x4368ab,_0x205537,_0x4af49d,_0x2b5494,_0x514a77,_0x261e13){var _0x447cdb={'XMD-QUEUE':_0x205537[_0xe922('0x19')]?_0x205537[_0xe922('0x19')][_0xe922('0x1a')]:'','XMD-CALLERID':_0x2b5494,'XMD-CALLERID-PREVIEW':_0x261e13?util[_0xe922('0x14')](_0xe922('0x1b'),_0x261e13[_0xe922('0x1c')],_0x261e13[_0xe922('0x1d')]):_0x2b5494,'XMD-DIALID':_0x514a77,'XMD-CONTACTID':_0x205537['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2b5494,'XMD-VOICEQUEUEID':_0x205537[_0xe922('0x1e')],'XMD-DIALCHANNEL':_0x4af49d,'XMD-DIALTIMEOUT':_0x4368ab[_0xe922('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xe922('0x14')](_0xe922('0x20'),_0x4368ab[_0xe922('0x21')]?'g':'',_[_0xe922('0x13')](_0x4368ab[_0xe922('0x22')])?'':_0xe922('0x23')),'XMD-DIALURL':_0x4368ab[_0xe922('0x24')]||'','XMD-AGI':_0x4368ab['dialQueueProject']?util[_0xe922('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4368ab[_0xe922('0x25')]):_0xe922('0x26'),'XMD-AGIAFTER':_0x4368ab[_0xe922('0x21')]?util[_0xe922('0x14')](_0xe922('0x27'),ipAgi,_0x4368ab[_0xe922('0x21')]):_0xe922('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x261e13?_0x261e13[_0xe922('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x261e13?_0x261e13[_0xe922('0x29')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xe922('0x2a')};if(!_['isEmpty'](_0x4368ab[_0xe922('0x22')])){_0x447cdb[util[_0xe922('0x14')]('%s',_0xe922('0x2b'))]=_0x4368ab[_0xe922('0x22')];_0x447cdb[util[_0xe922('0x14')]('%s',_0xe922('0x2c'))]=_0x514a77;}if(_0x205537&&_0x205537[_0xe922('0x2d')]){for(var _0x50c74b in _0x205537['Contact']){if(_0x205537[_0xe922('0x2d')][_0xe922('0x2e')](_0x50c74b)){if(!_[_0xe922('0x17')](_0x205537[_0xe922('0x2d')][_0x50c74b])&&_0x50c74b!=='id'&&_0x50c74b!==_0xe922('0x2f')&&_0x50c74b!==_0xe922('0x30')&&_0x50c74b!=='updatedAt'){_0x447cdb[util['format'](_0xe922('0x31'),'XMD-',_[_0xe922('0x32')](_0x50c74b))]=_0x205537[_0xe922('0x2d')][_0x50c74b];}}}}return _0x447cdb;};exports['toLowerVariables']=function(_0x48ef0a){var _0x154522={};for(var _0x1d86db in _0x48ef0a){if(_0x48ef0a['hasOwnProperty'](_0x1d86db)){_0x154522[util['format']('%s',_[_0xe922('0x33')](_0x1d86db))]=_0x48ef0a[_0x1d86db];}}return{'variables':_0x154522};};exports[_0xe922('0x34')]=function(_0x45d15b,_0x287d6f){if(!_['isNil'](_0x45d15b)){if(_0x45d15b[_0xe922('0x2e')](_0xe922('0x35'))){if(_0x45d15b[_0xe922('0x35')]>0x0){_0x45d15b[_0xe922('0x35')]-=0x1;}else{logger[_0xe922('0x9')](_0xe922('0x36'),_0x287d6f);}}}else{logger['error'](_0xe922('0x37'),_0x287d6f);}};exports['logBlacklist']=function(_0x374daa){var _0x1ea423=moment()['format'](_0xe922('0x38'));_0x374daa[_0xe922('0x39')]=0xd;_0x374daa[_0xe922('0x3a')]=_0xe922('0x3b');_0x374daa['starttime']=_0x1ea423;_0x374daa[_0xe922('0x3c')]=_0x1ea423;_0x374daa['endtime']=_0x1ea423;};exports[_0xe922('0x3d')]=function(_0x205d09,_0xc9c086,_0x317388){var _0x55bc39=moment()[_0xe922('0x14')](_0xe922('0x38'));_0x205d09[_0xe922('0x39')]=_0xc9c086;_0x205d09['statedesc']=_0x317388;_0x205d09[_0xe922('0x3c')]=_0x55bc39;_0x205d09[_0xe922('0x3e')]=getSeconds(_0x205d09[_0xe922('0x3c')],_0x205d09['starttime']);};exports[_0xe922('0x3f')]=function(_0x35527c,_0xa44f5d,_0x13534c){_0x35527c[_0xe922('0x40')]=_0xa44f5d;_0x35527c[_0xe922('0x41')]=_0x13534c;};exports[_0xe922('0x42')]=function(_0xc1efb1,_0x135301,_0x5dad05){var _0x2c2a45=moment()[_0xe922('0x14')](_0xe922('0x38'));_0xc1efb1[_0xe922('0x39')]=_0x135301;_0xc1efb1[_0xe922('0x3a')]=_0x5dad05;_0xc1efb1[_0xe922('0x3c')]=_0xc1efb1[_0xe922('0x3c')]?_0xc1efb1['responsetime']:_0x2c2a45;_0xc1efb1[_0xe922('0x43')]=_0xc1efb1['endtime']?_0xc1efb1[_0xe922('0x43')]:_0x2c2a45;_0xc1efb1[_0xe922('0x3e')]=getSeconds(_0xc1efb1['responsetime']||0x0,_0xc1efb1[_0xe922('0x44')]||0x0);_0xc1efb1[_0xe922('0x45')]=_0xc1efb1['answertime']?getSeconds(_0xc1efb1['endtime'],_0xc1efb1['answertime']):0x0;};exports['isFailure']=function(_0x256576){return _0x256576===_0xe922('0x46');};exports[_0xe922('0x47')]=function(_0x362f2c,_0x41441e,_0x1783c7,_0x1b10d2,_0x52359f){var _0x5a43ce=_0x1b10d2?_0xe922('0x48'):_0x362f2c[_0xe922('0x1c')];_0x5a43ce=_0x52359f?_0xe922('0x49'):_0x5a43ce;return{'actionid':_0x362f2c['uniqueid'],'action':_0xe922('0x4a'),'channel':_0x362f2c[_0xe922('0x4b')],'callerid':util[_0xe922('0x14')](_0xe922('0x1b'),_0x5a43ce,_0x362f2c[_0xe922('0x1d')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x1783c7,'timeout':(_0x41441e[_0xe922('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x362f2c['uniqueid']};};exports['totalGlobal']=function(_0x508f77){return _0x508f77[_0xe922('0x4d')]+_0x508f77[_0xe922('0x4e')]+_0x508f77['countnoanswerretry']+_0x508f77[_0xe922('0x4f')]+_0x508f77[_0xe922('0x50')];};exports[_0xe922('0x51')]=function(_0x1dc1b5){var _0x455c86=_[_0xe922('0x52')](_0x1dc1b5);_0x455c86[_0xe922('0x39')]=0xf;_0x455c86[_0xe922('0x3a')]=_0xe922('0x53');return _0x455c86;};exports[_0xe922('0x54')]=function(_0x210c28,_0x2a0572,_0x5d7abd){var _0x58a44a={};_0x58a44a[_0x2a0572]=_0x210c28[_0x2a0572];_0x58a44a[_0xe922('0x55')]=![];_0x58a44a[_0xe922('0x56')]=moment()['add'](_0x5d7abd,'minutes')[_0xe922('0x14')](_0xe922('0x38'));_0x58a44a[_0xe922('0x57')]=_0x210c28[_0xe922('0x57')];_0x58a44a[_0xe922('0x58')]=_0x210c28['ListId'];_0x58a44a[_0xe922('0x1e')]=_0x210c28['VoiceQueueId']||undefined;return _0x58a44a;};exports[_0xe922('0x59')]=function(_0xac5c8,_0x2ba45b){if(!_['isNil'](_0xac5c8)){if(_0xac5c8[_0xe922('0x5a')]>0x0){_0xac5c8[_0xe922('0x5a')]-=0x1;}else{logger[_0xe922('0x9')](_0x2ba45b,_0xe922('0x5b'));}}else{logger['error'](_0x2ba45b,_0xe922('0x5c'));}};exports[_0xe922('0x5d')]=function(_0x3d5d3c){if(_0x3d5d3c<=0x0){return!![];}return![];};exports[_0xe922('0x5e')]=function(_0x5769f0,_0x39108c,_0x27531b){_0x5769f0[_0xe922('0x5f')]=_0x39108c;_0x5769f0[_0xe922('0x1a')]=_0x5769f0[_0xe922('0x60')];_0x5769f0[_0xe922('0x61')]=_0x5769f0[_0xe922('0x4b')];_0x5769f0['motionChannel']=_0xe922('0x62');if(_0x27531b){_0x5769f0[_0xe922('0x63')]=_0x27531b[_0xe922('0x63')];}return _0x5769f0;};exports[_0xe922('0x64')]=function(_0x2e61bc){var _0x1193ef={};_0x1193ef[_0xe922('0x60')]=_0x2e61bc[_0xe922('0x60')];_0x1193ef[_0xe922('0x61')]=_0x2e61bc[_0xe922('0x4b')];_0x1193ef[_0xe922('0x65')]=_0x2e61bc[_0xe922('0x65')];return _0x1193ef;};exports['agentReadyId']=function(_0x39f336){var _0x5703e1=[];for(var _0x336274 in _0x39f336){if(_0x39f336['hasOwnProperty'](_0x336274)){if(!_[_0xe922('0x17')](_0x39f336[_0x336274])&&_0x39f336[_0x336274][_0xe922('0x39')]===_0xe922('0x66')&&_0x39f336[_0x336274][_0xe922('0x67')]===_0xe922('0x68')){_0x5703e1[_0xe922('0x69')](_0x39f336[_0x336274]['id']);}}}return _0x5703e1;};exports[_0xe922('0x6a')]=function(_0x10e85d){var _0x256312=moment()[_0xe922('0x6')](0x0);var _0x6404f9=moment(_0x10e85d)['milliseconds'](0x0);return _0x256312[_0xe922('0x6b')](_0x6404f9,_0xe922('0x7'));};exports[_0xe922('0x6c')]=function(_0x4b8fab){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b8fab['ContactId'],'ListId':_0x4b8fab[_0xe922('0x58')],'VoiceQueueId':_0x4b8fab['VoiceQueueId']||undefined,'CampaignId':_0x4b8fab[_0xe922('0x6d')]||undefined};};exports['filterKey']=function(_0x42db98){if(_0x42db98===_0xe922('0x65')||_0x42db98===_0xe922('0x6e')||_0x42db98===_0xe922('0x60')||_0x42db98===_0xe922('0x6f')||_0x42db98===_0xe922('0x70')||_0x42db98===_0xe922('0x71')||_0x42db98===_0xe922('0x40')||_0x42db98===_0xe922('0x4b')||_0x42db98==='calleridname'||_0x42db98==='active'||_0x42db98===_0xe922('0x1d')||_0x42db98===_0xe922('0x56')||_0x42db98===_0xe922('0x4d')||_0x42db98===_0xe922('0x4e')||_0x42db98===_0xe922('0x72')||_0x42db98==='countglobal'||_0x42db98===_0xe922('0x73')||_0x42db98==='callbackuniqueid'||_0x42db98===_0xe922('0x74')||_0x42db98===_0xe922('0x75')||_0x42db98===_0xe922('0x57')||_0x42db98===_0xe922('0x58')||_0x42db98===_0xe922('0x41')||_0x42db98===_0xe922('0x1e')||_0x42db98===_0xe922('0x76')||_0x42db98===_0xe922('0x77')||_0x42db98===_0xe922('0x78')||_0x42db98===_0xe922('0x79')||_0x42db98===_0xe922('0x7a')||_0x42db98===_0xe922('0x7b')||_0x42db98===_0xe922('0x7c')||_0x42db98==='xmd-dialoptions'||_0x42db98==='xmd-dialid'||_0x42db98===_0xe922('0x7d')||_0x42db98===_0xe922('0x7e')||_0x42db98===_0xe922('0x7f')||_0x42db98===_0xe922('0x80')||_0x42db98===_0xe922('0x81')||_0x42db98===_0xe922('0x82')||_0x42db98===_0xe922('0x83')||_0x42db98===_0xe922('0x84')||_0x42db98==='rtpaudioqosjitter'||_0x42db98===_0xe922('0x85')||_0x42db98==='rtpaudioqosloss'||_0x42db98==='rtpaudioqoslossbridged'||_0x42db98===_0xe922('0x86')||_0x42db98===_0xe922('0x87')||_0x42db98===_0xe922('0x83')||_0x42db98===_0xe922('0x84')||_0x42db98===_0xe922('0x88')||_0x42db98===_0xe922('0x85')||_0x42db98===_0xe922('0x89')||_0x42db98===_0xe922('0x8a')||_0x42db98==='rtpaudioqosrtt'||_0x42db98==='rtpaudioqosrttbridged'||_0x42db98===_0xe922('0x8b')||_0x42db98===_0xe922('0x8c')||_0x42db98===_0xe922('0x39')||_0x42db98===_0xe922('0x3a')){return![];}return!![];};exports[_0xe922('0x8d')]=function(_0x17af2,_0x25b58a){var _0x830df2,_0x547258,_0x385f3f;if(_0x25b58a<=0x0){_0x25b58a=0x1;}_0x830df2=new RegExp(_0xe922('0x8e')+_0x25b58a+'}$');_0x547258=Math[_0xe922('0x8f')](0xa,_0x25b58a-0x1);_0x385f3f=Math['pow'](0xa,_0x25b58a)-0x1;return util[_0xe922('0x14')]('%s',_[_0xe922('0x90')](_0x17af2,_0x830df2,_[_0xe922('0x91')](_0x547258,_0x385f3f)));};exports['extractCalleridName']=function(_0x3c13c2){var _0x57f700=_0x3c13c2[_0xe922('0x92')](/"(.*?)"/);return _0x57f700?_0x57f700[0x1]:_0x3c13c2;};exports['extractCalleridNumber']=function(_0x5276b7){var _0x53cc45=_0x5276b7[_0xe922('0x92')](/<(.*?)>/);return _0x53cc45?_0x53cc45[0x1]:_0x5276b7;}; \ No newline at end of file +var _0xb205=['from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','agentReadyId','not_inuse','status','reachable','push','createBody','filterKey','idContact','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','info','loggerError','error','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','endtime','statedesc','ringtime','responsetime','starttime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','uniqueid','originate','channelAgent'];(function(_0x5f423c,_0x1b1736){var _0x5382cd=function(_0x3dce7b){while(--_0x3dce7b){_0x5f423c['push'](_0x5f423c['shift']());}};_0x5382cd(++_0x1b1736);}(_0xb205,0x162));var _0x5b20=function(_0x11ae86,_0x27d537){_0x11ae86=_0x11ae86-0x0;var _0x2834a0=_0xb205[_0x11ae86];return _0x2834a0;};'use strict';var util=require(_0x5b20('0x0'));var _=require(_0x5b20('0x1'));var moment=require(_0x5b20('0x2'));var logger=require(_0x5b20('0x3'))('preview');var ipAgi=process['env'][_0x5b20('0x4')]||_0x5b20('0x5');function getSeconds(_0x1dfdd3,_0x48b322){var _0x191677=moment(_0x1dfdd3)[_0x5b20('0x6')](0x0);var _0xf23c4c=moment(_0x48b322)[_0x5b20('0x6')](0x0);return _0x191677['diff'](_0xf23c4c,_0x5b20('0x7'));}exports[_0x5b20('0x8')]=function(_0x4c72ca){return function(_0x1d3782){logger['error'](_0x4c72ca,util[_0x5b20('0x9')](_0x1d3782,{'showHidden':![],'depth':null}));};};exports[_0x5b20('0xa')]=function(_0x29e448,_0x31b128){logger[_0x5b20('0xb')](_0x29e448,util[_0x5b20('0x9')](_0x31b128,{'showHidden':![],'depth':null}));};exports[_0x5b20('0xc')]=function(_0x5f18d5,_0x5cde9e){logger[_0x5b20('0xd')](_0x5f18d5,util[_0x5b20('0x9')](_0x5cde9e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x21dbcb){return function(_0x246f40){logger[_0x5b20('0xb')](_0x21dbcb,util[_0x5b20('0x9')](_0x246f40,{'showHidden':![],'depth':null}));};};exports[_0x5b20('0xe')]=function(_0x4e43bb,_0x2076d8,_0x5f0a8f){return{'message':_0x4e43bb,'unlock':_0x2076d8,'active':_0x5f0a8f};};exports['getCallerId']=function(_0x2d2501,_0x525f85,_0x3f6600){if(!_[_0x5b20('0xf')](_0x3f6600)&&_0x5b20('0x10')===typeof _0x3f6600&&!_[_0x5b20('0x11')](_0x3f6600)){if(!_['isUndefined'](_0x525f85)&&_0x5b20('0x10')===typeof _0x525f85&&!_['isEmpty'](_0x525f85)){return util[_0x5b20('0x12')]('\x22%s\x22\x20<%s>',_0x525f85,_0x3f6600);}return util[_0x5b20('0x12')](_0x5b20('0x13'),_0x3f6600,_0x3f6600);}if(!_['isUndefined'](_0x2d2501)&&_0x5b20('0x10')===typeof _0x2d2501&&!_[_0x5b20('0x11')](_0x2d2501)){return _0x2d2501;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x2ba926){if(_['isNil'](_0x2ba926)){return![];}return _0x2ba926;};exports[_0x5b20('0x14')]=function(_0x5cf719,_0x305f25,_0x425191,_0x262e9f,_0x4d5be2,_0x45f758){var _0x7b8574={'XMD-QUEUE':_0x305f25['Queue']?_0x305f25[_0x5b20('0x15')][_0x5b20('0x16')]:'','XMD-CALLERID':_0x262e9f,'XMD-CALLERID-PREVIEW':_0x45f758?util['format']('\x22%s\x22\x20<%s>',_0x45f758[_0x5b20('0x17')],_0x45f758[_0x5b20('0x18')]):_0x262e9f,'XMD-DIALID':_0x4d5be2,'XMD-CONTACTID':_0x305f25[_0x5b20('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x262e9f,'XMD-VOICEQUEUEID':_0x305f25['VoiceQueueId'],'XMD-DIALCHANNEL':_0x425191,'XMD-DIALTIMEOUT':_0x5cf719[_0x5b20('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x5b20('0x1b'),_0x5cf719['dialQueueProject2']?'g':'',_[_0x5b20('0x11')](_0x5cf719[_0x5b20('0x1c')])?'':_0x5b20('0x1d')),'XMD-DIALURL':_0x5cf719[_0x5b20('0x1e')]||'','XMD-AGI':_0x5cf719[_0x5b20('0x1f')]?util['format'](_0x5b20('0x20'),ipAgi,_0x5cf719[_0x5b20('0x1f')]):_0x5b20('0x21'),'XMD-AGIAFTER':_0x5cf719[_0x5b20('0x22')]?util[_0x5b20('0x12')](_0x5b20('0x20'),ipAgi,_0x5cf719['dialQueueProject2']):_0x5b20('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x45f758?_0x45f758[_0x5b20('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x45f758?_0x45f758['originatecalleridname']:'','XMD-DESTINATION':_0x5b20('0x24'),'SIPADDHEADER':_0x5b20('0x25')};if(!_[_0x5b20('0x11')](_0x5cf719[_0x5b20('0x1c')])){_0x7b8574[util[_0x5b20('0x12')]('%s',_0x5b20('0x26'))]=_0x5cf719[_0x5b20('0x1c')];_0x7b8574[util[_0x5b20('0x12')]('%s',_0x5b20('0x27'))]=_0x4d5be2;}if(_0x305f25&&_0x305f25[_0x5b20('0x28')]){for(var _0x55daca in _0x305f25['Contact']){if(_0x305f25[_0x5b20('0x28')][_0x5b20('0x29')](_0x55daca)){if(!_[_0x5b20('0x2a')](_0x305f25[_0x5b20('0x28')][_0x55daca])&&_0x55daca!=='id'&&_0x55daca!==_0x5b20('0x2b')&&_0x55daca!==_0x5b20('0x2c')&&_0x55daca!==_0x5b20('0x2d')){_0x7b8574[util[_0x5b20('0x12')](_0x5b20('0x2e'),_0x5b20('0x2f'),_[_0x5b20('0x30')](_0x55daca))]=_0x305f25[_0x5b20('0x28')][_0x55daca];}}}}return _0x7b8574;};exports[_0x5b20('0x31')]=function(_0x23870b){var _0x17f067={};for(var _0x1b2ada in _0x23870b){if(_0x23870b[_0x5b20('0x29')](_0x1b2ada)){_0x17f067[util[_0x5b20('0x12')]('%s',_[_0x5b20('0x32')](_0x1b2ada))]=_0x23870b[_0x1b2ada];}}return{'variables':_0x17f067};};exports[_0x5b20('0x33')]=function(_0x1d3228,_0x5e48e0){if(!_['isNil'](_0x1d3228)){if(_0x1d3228['hasOwnProperty'](_0x5b20('0x34'))){if(_0x1d3228['originated']>0x0){_0x1d3228[_0x5b20('0x34')]-=0x1;}else{logger[_0x5b20('0xd')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5e48e0);}}}else{logger[_0x5b20('0xd')](_0x5b20('0x35'),_0x5e48e0);}};exports[_0x5b20('0x36')]=function(_0x3f3e56){var _0x1ae998=moment()[_0x5b20('0x12')](_0x5b20('0x37'));_0x3f3e56[_0x5b20('0x38')]=0xd;_0x3f3e56['statedesc']='Blacklist';_0x3f3e56['starttime']=_0x1ae998;_0x3f3e56['responsetime']=_0x1ae998;_0x3f3e56[_0x5b20('0x39')]=_0x1ae998;};exports['logAgent']=function(_0x51903c,_0x32fbcf,_0xa0e535){var _0x528dbb=moment()[_0x5b20('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x51903c[_0x5b20('0x38')]=_0x32fbcf;_0x51903c[_0x5b20('0x3a')]=_0xa0e535;_0x51903c['responsetime']=_0x528dbb;_0x51903c[_0x5b20('0x3b')]=getSeconds(_0x51903c[_0x5b20('0x3c')],_0x51903c[_0x5b20('0x3d')]);};exports['logLookAgent']=function(_0x3221e1,_0x424811,_0x2bb82f){_0x3221e1[_0x5b20('0x3e')]=_0x424811;_0x3221e1[_0x5b20('0x3f')]=_0x2bb82f;};exports[_0x5b20('0x40')]=function(_0x48ba1f,_0x11ef9e,_0x191fb9){var _0x303da1=moment()[_0x5b20('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x48ba1f['state']=_0x11ef9e;_0x48ba1f['statedesc']=_0x191fb9;_0x48ba1f[_0x5b20('0x3c')]=_0x48ba1f[_0x5b20('0x3c')]?_0x48ba1f[_0x5b20('0x3c')]:_0x303da1;_0x48ba1f[_0x5b20('0x39')]=_0x48ba1f[_0x5b20('0x39')]?_0x48ba1f[_0x5b20('0x39')]:_0x303da1;_0x48ba1f[_0x5b20('0x3b')]=getSeconds(_0x48ba1f[_0x5b20('0x3c')]||0x0,_0x48ba1f[_0x5b20('0x3d')]||0x0);_0x48ba1f[_0x5b20('0x41')]=_0x48ba1f[_0x5b20('0x42')]?getSeconds(_0x48ba1f[_0x5b20('0x39')],_0x48ba1f[_0x5b20('0x42')]):0x0;};exports[_0x5b20('0x43')]=function(_0xb9d926){return _0xb9d926===_0x5b20('0x44');};exports['variablesAction']=function(_0x5cce51,_0x4c5d0e,_0x10b1dc,_0x10bf9f,_0x385f11){var _0x12920a=_0x10bf9f?'RECALL':_0x5cce51[_0x5b20('0x17')];_0x12920a=_0x385f11?'BOOKED':_0x12920a;return{'actionid':_0x5cce51[_0x5b20('0x45')],'action':_0x5b20('0x46'),'channel':_0x5cce51[_0x5b20('0x47')],'callerid':util[_0x5b20('0x12')](_0x5b20('0x13'),_0x12920a,_0x5cce51['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x5b20('0x48'),'Priority':'1','variable':_0x10b1dc,'timeout':(_0x4c5d0e[_0x5b20('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cce51[_0x5b20('0x45')]};};exports[_0x5b20('0x4a')]=function(_0x36a380){return _0x36a380[_0x5b20('0x4b')]+_0x36a380[_0x5b20('0x4c')]+_0x36a380[_0x5b20('0x4d')]+_0x36a380[_0x5b20('0x4e')]+_0x36a380[_0x5b20('0x4f')];};exports[_0x5b20('0x50')]=function(_0x446ec0){var _0x4b26b3=_[_0x5b20('0x51')](_0x446ec0);_0x4b26b3['state']=0xf;_0x4b26b3[_0x5b20('0x3a')]=_0x5b20('0x52');return _0x4b26b3;};exports['scheduledAt']=function(_0x4845d9,_0x6c7072,_0x2b20bc){var _0x11c5be={};_0x11c5be[_0x6c7072]=_0x4845d9[_0x6c7072];_0x11c5be[_0x5b20('0x53')]=![];_0x11c5be['scheduledat']=moment()[_0x5b20('0x54')](_0x2b20bc,_0x5b20('0x55'))[_0x5b20('0x12')](_0x5b20('0x37'));_0x11c5be['ContactId']=_0x4845d9[_0x5b20('0x19')];_0x11c5be[_0x5b20('0x56')]=_0x4845d9[_0x5b20('0x56')];_0x11c5be[_0x5b20('0x57')]=_0x4845d9['VoiceQueueId']||undefined;return _0x11c5be;};exports[_0x5b20('0x58')]=function(_0x1f6510,_0x529d3f){if(!_['isNil'](_0x1f6510)){if(_0x1f6510[_0x5b20('0x59')]>0x0){_0x1f6510[_0x5b20('0x59')]-=0x1;}else{logger['error'](_0x529d3f,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x5b20('0xd')](_0x529d3f,_0x5b20('0x5a'));}};exports[_0x5b20('0x5b')]=function(_0x2fa471){if(_0x2fa471<=0x0){return!![];}return![];};exports['buildObj']=function(_0x507a33,_0x539867,_0x84fea1){_0x507a33[_0x5b20('0x5c')]=_0x539867;_0x507a33['name']=_0x507a33['queue'];_0x507a33[_0x5b20('0x5d')]=_0x507a33['channelAgent'];_0x507a33[_0x5b20('0x5e')]=_0x5b20('0x5f');if(_0x84fea1){_0x507a33[_0x5b20('0x60')]=_0x84fea1[_0x5b20('0x60')];}return _0x507a33;};exports[_0x5b20('0x61')]=function(_0x222d67){var _0x55a966={};_0x55a966[_0x5b20('0x62')]=_0x222d67['queue'];_0x55a966[_0x5b20('0x5d')]=_0x222d67[_0x5b20('0x47')];_0x55a966[_0x5b20('0x45')]=_0x222d67['uniqueid'];return _0x55a966;};exports[_0x5b20('0x63')]=function(_0xd32bba){var _0x168d51=[];for(var _0x17c2d7 in _0xd32bba){if(_0xd32bba[_0x5b20('0x29')](_0x17c2d7)){if(!_['isNil'](_0xd32bba[_0x17c2d7])&&_0xd32bba[_0x17c2d7][_0x5b20('0x38')]===_0x5b20('0x64')&&_0xd32bba[_0x17c2d7][_0x5b20('0x65')]===_0x5b20('0x66')){_0x168d51[_0x5b20('0x67')](_0xd32bba[_0x17c2d7]['id']);}}}return _0x168d51;};exports['getDiff']=function(_0x5519c2){var _0x33ad33=moment()[_0x5b20('0x6')](0x0);var _0x49a462=moment(_0x5519c2)[_0x5b20('0x6')](0x0);return _0x33ad33['diff'](_0x49a462,'seconds');};exports[_0x5b20('0x68')]=function(_0x1bc6c3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bc6c3['ContactId'],'ListId':_0x1bc6c3['ListId'],'VoiceQueueId':_0x1bc6c3[_0x5b20('0x57')]||undefined,'CampaignId':_0x1bc6c3['CampaignId']||undefined};};exports[_0x5b20('0x69')]=function(_0x2e64c9){if(_0x2e64c9===_0x5b20('0x45')||_0x2e64c9===_0x5b20('0x6a')||_0x2e64c9===_0x5b20('0x62')||_0x2e64c9==='type'||_0x2e64c9===_0x5b20('0x6b')||_0x2e64c9===_0x5b20('0x6c')||_0x2e64c9===_0x5b20('0x3e')||_0x2e64c9===_0x5b20('0x47')||_0x2e64c9===_0x5b20('0x17')||_0x2e64c9===_0x5b20('0x53')||_0x2e64c9===_0x5b20('0x18')||_0x2e64c9===_0x5b20('0x6d')||_0x2e64c9===_0x5b20('0x4b')||_0x2e64c9===_0x5b20('0x4c')||_0x2e64c9==='countnoanswerretry'||_0x2e64c9===_0x5b20('0x6e')||_0x2e64c9===_0x5b20('0x6f')||_0x2e64c9===_0x5b20('0x70')||_0x2e64c9===_0x5b20('0x71')||_0x2e64c9==='recallme'||_0x2e64c9===_0x5b20('0x19')||_0x2e64c9===_0x5b20('0x56')||_0x2e64c9==='UserId'||_0x2e64c9===_0x5b20('0x57')||_0x2e64c9===_0x5b20('0x72')||_0x2e64c9==='xmd-voicequeueid'||_0x2e64c9===_0x5b20('0x73')||_0x2e64c9===_0x5b20('0x74')||_0x2e64c9===_0x5b20('0x75')||_0x2e64c9===_0x5b20('0x76')||_0x2e64c9===_0x5b20('0x77')||_0x2e64c9==='xmd-dialoptions'||_0x2e64c9===_0x5b20('0x78')||_0x2e64c9===_0x5b20('0x79')||_0x2e64c9==='xmd-contactid'||_0x2e64c9===_0x5b20('0x7a')||_0x2e64c9===_0x5b20('0x7b')||_0x2e64c9===_0x5b20('0x7c')||_0x2e64c9===_0x5b20('0x7d')||_0x2e64c9===_0x5b20('0x7e')||_0x2e64c9==='rtpaudioqosbridged'||_0x2e64c9===_0x5b20('0x7f')||_0x2e64c9===_0x5b20('0x80')||_0x2e64c9===_0x5b20('0x81')||_0x2e64c9===_0x5b20('0x82')||_0x2e64c9===_0x5b20('0x83')||_0x2e64c9===_0x5b20('0x84')||_0x2e64c9===_0x5b20('0x7e')||_0x2e64c9==='rtpaudioqosbridged'||_0x2e64c9===_0x5b20('0x7f')||_0x2e64c9===_0x5b20('0x80')||_0x2e64c9===_0x5b20('0x81')||_0x2e64c9===_0x5b20('0x82')||_0x2e64c9===_0x5b20('0x83')||_0x2e64c9==='rtpaudioqosrttbridged'||_0x2e64c9===_0x5b20('0x85')||_0x2e64c9===_0x5b20('0x86')||_0x2e64c9===_0x5b20('0x38')||_0x2e64c9===_0x5b20('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x355308,_0x42fde8){var _0x4bc2b0,_0x356b46,_0x4f5df0;if(_0x42fde8<=0x0){_0x42fde8=0x1;}_0x4bc2b0=new RegExp(_0x5b20('0x87')+_0x42fde8+'}$');_0x356b46=Math['pow'](0xa,_0x42fde8-0x1);_0x4f5df0=Math[_0x5b20('0x88')](0xa,_0x42fde8)-0x1;return util[_0x5b20('0x12')]('%s',_[_0x5b20('0x89')](_0x355308,_0x4bc2b0,_[_0x5b20('0x8a')](_0x356b46,_0x4f5df0)));};exports[_0x5b20('0x8b')]=function(_0x3b087d){var _0x273c77=_0x3b087d['match'](/"(.*?)"/);return _0x273c77?_0x273c77[0x1]:_0x3b087d;};exports[_0x5b20('0x8c')]=function(_0x48c54d){var _0x52963a=_0x48c54d[_0x5b20('0x8d')](/<(.*?)>/);return _0x52963a?_0x52963a[0x1]:_0x48c54d;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fbdea83..403e91f 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 _0x60df=['string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x60df,0x117));var _0xf60d=function(_0x2e3698,_0x4893ec){_0x2e3698=_0x2e3698-0x0;var _0x3f6d7f=_0x60df[_0x2e3698];return _0x3f6d7f;};'use strict';exports[_0xf60d('0x0')]={'queue':{'type':_0xf60d('0x1'),'required':!![]},'interface':{'type':_0xf60d('0x1'),'required':!![]},'membername':{'type':_0xf60d('0x1'),'required':!![]},'penalty':{'type':_0xf60d('0x2'),'required':![]},'paused':{'type':_0xf60d('0x3'),'required':![]}};exports[_0xf60d('0x4')]={'queue':{'type':_0xf60d('0x1'),'required':!![]},'interface':{'type':_0xf60d('0x1'),'required':!![]}};exports[_0xf60d('0x5')]={'interface':{'type':_0xf60d('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xf60d('0x1'),'required':![]}};exports[_0xf60d('0x6')]={'module':{'type':_0xf60d('0x1'),'required':![]}};exports[_0xf60d('0x7')]={'uniqueid':{'type':_0xf60d('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xf60d('0x1'),'required':!![]},'filename':{'type':_0xf60d('0x1')},'format':{'type':_0xf60d('0x1')},'mixmonitorid':{'type':_0xf60d('0x1')}};exports[_0xf60d('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf60d('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf60d('0x1'),'required':!![]},'context':{'type':_0xf60d('0x1')}}; \ No newline at end of file +var _0xb80e=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x182bb4,_0x5267fe){var _0x19a51e=function(_0x131a57){while(--_0x131a57){_0x182bb4['push'](_0x182bb4['shift']());}};_0x19a51e(++_0x5267fe);}(_0xb80e,0x80));var _0xeb80=function(_0x5a2549,_0x367014){_0x5a2549=_0x5a2549-0x0;var _0x10cf94=_0xb80e[_0x5a2549];return _0x10cf94;};'use strict';exports[_0xeb80('0x0')]={'queue':{'type':_0xeb80('0x1'),'required':!![]},'interface':{'type':_0xeb80('0x1'),'required':!![]},'membername':{'type':_0xeb80('0x1'),'required':!![]},'penalty':{'type':_0xeb80('0x2'),'required':![]},'paused':{'type':_0xeb80('0x3'),'required':![]}};exports[_0xeb80('0x4')]={'queue':{'type':_0xeb80('0x1'),'required':!![]},'interface':{'type':_0xeb80('0x1'),'required':!![]}};exports[_0xeb80('0x5')]={'interface':{'type':_0xeb80('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xeb80('0x1'),'required':![]}};exports[_0xeb80('0x6')]={'module':{'type':_0xeb80('0x1'),'required':![]}};exports[_0xeb80('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xeb80('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xeb80('0x1')}};exports[_0xeb80('0x8')]={'uniqueid':{'type':_0xeb80('0x1'),'required':!![]}};exports[_0xeb80('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xeb80('0x1'),'required':!![]},'context':{'type':_0xeb80('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0f8c0c0..cf4eb79 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 _0xfda2=['isUndefined','initTelephones','initTrunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','sumDuration','initVoiceCallReports','duration','ANSWERED','billableseconds','SquareProject','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','bluebird','util','moment','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','queueChannels','outboundChannels','settings','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','answered','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length'];(function(_0x21b62b,_0x4aafd0){var _0x4edd02=function(_0x17dbf0){while(--_0x17dbf0){_0x21b62b['push'](_0x21b62b['shift']());}};_0x4edd02(++_0x4aafd0);}(_0xfda2,0xfe));var _0x2fda=function(_0x192ee6,_0x12156e){_0x192ee6=_0x192ee6-0x0;var _0x44085d=_0xfda2[_0x192ee6];return _0x44085d;};'use strict';var BPromise=require(_0x2fda('0x0'));var util=require(_0x2fda('0x1'));var _=require('lodash');var moment=require(_0x2fda('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x2fda('0x3'));var Trunk=require(_0x2fda('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x2fda('0x5'));var Template=require(_0x2fda('0x6'));var Campaign=require(_0x2fda('0x7'));var VoiceExtension=require(_0x2fda('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x2fda('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x2fda('0xa'));var ZohoAccount=require(_0x2fda('0xb'));var DeskAccount=require(_0x2fda('0xc'));var VtigerAccount=require(_0x2fda('0xd'));var ServicenowAccount=require(_0x2fda('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x2fda('0xf')]={};this[_0x2fda('0x10')]={};this[_0x2fda('0x11')]={};this[_0x2fda('0x12')]={};this['triggers']={};this[_0x2fda('0x13')]={};this[_0x2fda('0x14')]={};this[_0x2fda('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x2fda('0x16')]={};this[_0x2fda('0x17')]={};this['timers']={};this[_0x2fda('0x18')]={};this[_0x2fda('0x19')]={};this['salesforceAccounts']={};this[_0x2fda('0x1a')]={};this['freshdeskAccounts']={};this[_0x2fda('0x1b')]={};this[_0x2fda('0x1c')]={};this[_0x2fda('0x1d')]={};this['servicenowAccounts']={};this[_0x2fda('0x1e')]={};this[_0x2fda('0x1f')]={};this[_0x2fda('0x20')]={};};function freeIsNotKey(_0x59d14e,_0x6ed89d,_0x3849d8){var _0x1654cc=_[_0x2fda('0x21')](_0x59d14e,function(_0x2bc337,_0x5d77ea){return _0x2bc337[_0x3849d8];});for(var _0x1d2e14 in _0x6ed89d){if(_0x6ed89d[_0x2fda('0x22')](_0x1d2e14)){if(!_0x1654cc[_0x1d2e14]){delete _0x6ed89d[_0x1d2e14];}}}}function freeIsNotKeySip(_0xdae9d4,_0x51a758){var _0xc761c3=_[_0x2fda('0x21')](_0xdae9d4,function(_0x4d71f5,_0x194825){return util[_0x2fda('0x23')](_0x2fda('0x24'),_0x4d71f5[_0x2fda('0x25')]);});for(var _0x2a10f8 in _0x51a758){if(_0x51a758[_0x2fda('0x22')](_0x2a10f8)){if(!_0xc761c3[_0x2a10f8]){delete _0x51a758[_0x2a10f8];}}}}function freeIsNotKeyAgent(_0x37d390,_0x7ed407){var _0x26effb=_[_0x2fda('0x21')](_0x37d390,function(_0x4c09d1,_0x412b26){var _0x148ec4=_[_0x2fda('0x26')](_0x4c09d1[_0x2fda('0x27')])?util[_0x2fda('0x23')](_0x2fda('0x24'),_0x4c09d1[_0x2fda('0x25')]):_0x4c09d1[_0x2fda('0x27')];return _0x148ec4;});for(var _0x3a39e2 in _0x7ed407){if(_0x7ed407[_0x2fda('0x22')](_0x3a39e2)){if(!_0x26effb[_0x3a39e2]){delete _0x7ed407[_0x3a39e2];}}}}function clearVoiceCallReports(_0x486276){_0x486276[_0x2fda('0x28')]=0x0;_0x486276['answered']=0x0;_0x486276[_0x2fda('0x29')]=0x0;_0x486276['sumDuration']=0x0;_0x486276['sumBillable']=0x0;}function clearCampaigns(_0x1a3956){if(!_['isEmpty'](_0x1a3956)){for(var _0x126aa9 in _0x1a3956){if(_0x1a3956['hasOwnProperty'](_0x126aa9)){_0x1a3956[_0x126aa9][_0x2fda('0x2a')]=0x0;_0x1a3956[_0x126aa9][_0x2fda('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x295bb2){if(!_[_0x2fda('0x2c')](_0x295bb2)){for(var _0x517d4c in _0x295bb2){if(_0x295bb2['hasOwnProperty'](_0x517d4c)){_0x295bb2[_0x517d4c][_0x2fda('0x28')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x2d')]=0x0;_0x295bb2[_0x517d4c]['unmanaged']=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x2e')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x29')]=0x0;_0x295bb2[_0x517d4c]['sumDuration']=0x0;_0x295bb2[_0x517d4c]['sumBillable']=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x2f')]=0x0;_0x295bb2[_0x517d4c]['outboundNoAnswerCallsDay']=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x30')]=0x0;_0x295bb2[_0x517d4c]['outboundCongestionCallsDay']=0x0;_0x295bb2[_0x517d4c]['outboundNoSuchCallsDay']=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x31')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x32')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x33')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x34')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x35')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x36')]=0x0;_0x295bb2[_0x517d4c]['outboundReCallsDay']=0x0;_0x295bb2[_0x517d4c]['outboundAnswerAgiCallsDay']=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x37')]=0x0;_0x295bb2[_0x517d4c][_0x2fda('0x38')]=!![];}}}}Realtime[_0x2fda('0x39')][_0x2fda('0x3a')]=function(_0x2e2ab1,_0x2db35d){for(var _0x113c91 in _0x2db35d){if(_0x2e2ab1[_0x2fda('0x22')](_0x113c91)){_0x2e2ab1[_0x113c91]=_0x2db35d[_0x113c91];}}};Realtime[_0x2fda('0x39')][_0x2fda('0x3b')]=function(){var _0x492141=this;return function(_0x3b665f){if(_0x3b665f){freeIsNotKeyAgent(_0x3b665f,_0x492141[_0x2fda('0xf')]);for(var _0x4db355=0x0,_0x12c05f={},_0x8f2961={};_0x4db355<_0x3b665f[_0x2fda('0x3c')];_0x4db355+=0x1){_0x12c05f=_0x3b665f[_0x4db355];var _0x31c89f=_[_0x2fda('0x26')](_0x12c05f[_0x2fda('0x27')])?util[_0x2fda('0x23')](_0x2fda('0x24'),_0x12c05f[_0x2fda('0x25')]):_0x12c05f[_0x2fda('0x27')];if(_[_0x2fda('0x3d')](_0x492141[_0x2fda('0xf')][_0x31c89f])){_0x492141[_0x2fda('0xf')][_0x31c89f]=new Agent(_0x12c05f);}else{_0x492141[_0x2fda('0x3a')](_0x492141[_0x2fda('0xf')][_0x31c89f],_0x12c05f);}}}return _0x492141[_0x2fda('0xf')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x3e')]=function(){var _0x5495b5=this;return function(_0x5b8717){if(_0x5b8717){freeIsNotKeySip(_0x5b8717,_0x5495b5[_0x2fda('0x10')]);for(var _0x41dd67=0x0,_0xff92b7={},_0x49a503={};_0x41dd67<_0x5b8717['length'];_0x41dd67+=0x1){_0xff92b7=_0x5b8717[_0x41dd67];if(_[_0x2fda('0x3d')](_0x5495b5['telephones'][util[_0x2fda('0x23')]('SIP/%s',_0xff92b7['name'])])){_0x5495b5[_0x2fda('0x10')][util[_0x2fda('0x23')](_0x2fda('0x24'),_0xff92b7[_0x2fda('0x25')])]=new Telephone(_0xff92b7);}else{_0x5495b5[_0x2fda('0x3a')](_0x5495b5[_0x2fda('0x10')][util[_0x2fda('0x23')](_0x2fda('0x24'),_0xff92b7[_0x2fda('0x25')])],_0xff92b7);}}}return _0x5495b5[_0x2fda('0x10')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x3f')]=function(){var _0x335aa0=this;return function(_0x26ff95){if(_0x26ff95){freeIsNotKeySip(_0x26ff95,_0x335aa0[_0x2fda('0x11')]);for(var _0x3b895e=0x0,_0x95e503={},_0x1f88af={};_0x3b895e<_0x26ff95[_0x2fda('0x3c')];_0x3b895e+=0x1){_0x95e503=_0x26ff95[_0x3b895e];if(_[_0x2fda('0x3d')](_0x335aa0[_0x2fda('0x11')][util[_0x2fda('0x23')](_0x2fda('0x24'),_0x95e503[_0x2fda('0x25')])])){_0x335aa0[_0x2fda('0x11')][util[_0x2fda('0x23')](_0x2fda('0x24'),_0x95e503[_0x2fda('0x25')])]=new Trunk(_0x95e503);}else{_0x335aa0['mergeFromDatabase'](_0x335aa0[_0x2fda('0x11')][util[_0x2fda('0x23')](_0x2fda('0x24'),_0x95e503[_0x2fda('0x25')])],_0x95e503);}}}return _0x335aa0['trunks'];};};Realtime[_0x2fda('0x39')]['initVoiceQueues']=function(){var _0x314a8f=this;return function(_0x1203f4){if(_0x1203f4){freeIsNotKey(_0x1203f4,_0x314a8f[_0x2fda('0x12')],'name');for(var _0x2a4e7a=0x0,_0x37db48={},_0x41632b={};_0x2a4e7a<_0x1203f4[_0x2fda('0x3c')];_0x2a4e7a+=0x1){_0x37db48=_0x1203f4[_0x2a4e7a];if(_[_0x2fda('0x3d')](_0x314a8f[_0x2fda('0x12')][_0x37db48['name']])){_0x314a8f[_0x2fda('0x12')][_0x37db48[_0x2fda('0x25')]]=new VoiceQueue(_0x37db48);}else{_0x314a8f['mergeFromDatabase'](_0x314a8f[_0x2fda('0x12')][_0x37db48[_0x2fda('0x25')]],_0x37db48);}}}return _0x314a8f['voiceQueues'];};};Realtime[_0x2fda('0x39')][_0x2fda('0x40')]=function(){var _0x2c1b4e=this;return function(_0x2588b4){if(_0x2588b4){freeIsNotKey(_0x2588b4,_0x2c1b4e[_0x2fda('0x41')],'id');for(var _0x5b03bc=0x0,_0x5f2056={},_0x3ffc57={};_0x5b03bc<_0x2588b4[_0x2fda('0x3c')];_0x5b03bc+=0x1){_0x5f2056=_0x2588b4[_0x5b03bc];if(_[_0x2fda('0x3d')](_0x2c1b4e[_0x2fda('0x41')][_0x5f2056['id']])){_0x2c1b4e[_0x2fda('0x41')][_0x5f2056['id']]=new Trigger(_0x5f2056);}else{_0x2c1b4e['mergeFromDatabase'](_0x2c1b4e[_0x2fda('0x41')][_0x5f2056['id']],_0x5f2056);}}}return _0x2c1b4e[_0x2fda('0x41')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x42')]=function(){var _0x53271c=this;return function(_0x439e27){if(_0x439e27){freeIsNotKey(_0x439e27,_0x53271c['templates'],'id');for(var _0xfed6c1=0x0,_0x182988={},_0x18e3d2={};_0xfed6c1<_0x439e27['length'];_0xfed6c1+=0x1){_0x182988=_0x439e27[_0xfed6c1];if(_[_0x2fda('0x3d')](_0x53271c['templates'][_0x182988['id']])){_0x53271c[_0x2fda('0x14')][_0x182988['id']]=new Template(_0x182988);}else{_0x53271c[_0x2fda('0x3a')](_0x53271c['templates'][_0x182988['id']],_0x182988);}}}return _0x53271c['templates'];};};Realtime[_0x2fda('0x39')][_0x2fda('0x43')]=function(){var _0xed8ea3=this;return function(_0x42bf64){if(_0x42bf64){freeIsNotKey(_0x42bf64,_0xed8ea3[_0x2fda('0x19')],'id');for(var _0x44f4b6=0x0,_0x27a56f={},_0x238217={};_0x44f4b6<_0x42bf64[_0x2fda('0x3c')];_0x44f4b6+=0x1){_0x27a56f=_0x42bf64[_0x44f4b6];if(_[_0x2fda('0x3d')](_0xed8ea3[_0x2fda('0x19')][_0x27a56f['id']])){_0xed8ea3[_0x2fda('0x19')][_0x27a56f['id']]=new ZendeskAccount(_0x27a56f);}else{_0xed8ea3['mergeFromDatabase'](_0xed8ea3['zendeskAccounts'][_0x27a56f['id']],_0x27a56f);}}}return _0xed8ea3[_0x2fda('0x19')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x44')]=function(){var _0x5c6a28=this;return function(_0x534707){if(_0x534707){freeIsNotKey(_0x534707,_0x5c6a28[_0x2fda('0x45')],'id');for(var _0x3f52f8=0x0,_0x2d1f2a={},_0x3ff3a9={};_0x3f52f8<_0x534707[_0x2fda('0x3c')];_0x3f52f8+=0x1){_0x2d1f2a=_0x534707[_0x3f52f8];if(_[_0x2fda('0x3d')](_0x5c6a28[_0x2fda('0x45')][_0x2d1f2a['id']])){_0x5c6a28[_0x2fda('0x45')][_0x2d1f2a['id']]=new SalesforceAccount(_0x2d1f2a);}else{_0x5c6a28['mergeFromDatabase'](_0x5c6a28[_0x2fda('0x45')][_0x2d1f2a['id']],_0x2d1f2a);}}}return _0x5c6a28[_0x2fda('0x45')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x46')]=function(){var _0x33146e=this;return function(_0x2822d0){if(_0x2822d0){freeIsNotKey(_0x2822d0,_0x33146e[_0x2fda('0x47')],'id');for(var _0x2bc7aa=0x0,_0x212bbb={},_0x983530={};_0x2bc7aa<_0x2822d0['length'];_0x2bc7aa+=0x1){_0x212bbb=_0x2822d0[_0x2bc7aa];if(_[_0x2fda('0x3d')](_0x33146e[_0x2fda('0x47')][_0x212bbb['id']])){_0x33146e[_0x2fda('0x47')][_0x212bbb['id']]=new FreshdeskAccount(_0x212bbb);}else{_0x33146e[_0x2fda('0x3a')](_0x33146e['freshdeskAccounts'][_0x212bbb['id']],_0x212bbb);}}}return _0x33146e[_0x2fda('0x47')];};};Realtime['prototype'][_0x2fda('0x48')]=function(){var _0x4fd538=this;return function(_0x210ff0){if(_0x210ff0){freeIsNotKey(_0x210ff0,_0x4fd538['zohoAccounts'],'id');for(var _0x7dc34e=0x0,_0x4d6e04={},_0x3dfb79={};_0x7dc34e<_0x210ff0['length'];_0x7dc34e+=0x1){_0x4d6e04=_0x210ff0[_0x7dc34e];if(_[_0x2fda('0x3d')](_0x4fd538[_0x2fda('0x1b')][_0x4d6e04['id']])){_0x4fd538[_0x2fda('0x1b')][_0x4d6e04['id']]=new ZohoAccount(_0x4d6e04);}else{_0x4fd538[_0x2fda('0x3a')](_0x4fd538[_0x2fda('0x1b')][_0x4d6e04['id']],_0x4d6e04);}}}return _0x4fd538[_0x2fda('0x1b')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x49')]=function(){var _0x2332d4=this;return function(_0xbcfbb){if(_0xbcfbb){freeIsNotKey(_0xbcfbb,_0x2332d4[_0x2fda('0x1c')],'id');for(var _0x526db7=0x0,_0x59e49c={},_0x31f095={};_0x526db7<_0xbcfbb[_0x2fda('0x3c')];_0x526db7+=0x1){_0x59e49c=_0xbcfbb[_0x526db7];if(_['isUndefined'](_0x2332d4[_0x2fda('0x1c')][_0x59e49c['id']])){_0x2332d4['deskAccounts'][_0x59e49c['id']]=new DeskAccount(_0x59e49c);}else{_0x2332d4[_0x2fda('0x3a')](_0x2332d4['deskAccounts'][_0x59e49c['id']],_0x59e49c);}}}return _0x2332d4[_0x2fda('0x1c')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x4a')]=function(){var _0x1fb7be=this;return function(_0x1f8835){if(_0x1f8835){freeIsNotKey(_0x1f8835,_0x1fb7be[_0x2fda('0x1a')],'id');for(var _0x37c190=0x0,_0x30c47b={},_0x53b4f0={};_0x37c190<_0x1f8835[_0x2fda('0x3c')];_0x37c190+=0x1){_0x30c47b=_0x1f8835[_0x37c190];if(_[_0x2fda('0x3d')](_0x1fb7be[_0x2fda('0x1a')][_0x30c47b['id']])){_0x1fb7be['sugarcrmAccounts'][_0x30c47b['id']]=new SugarcrmAccount(_0x30c47b);}else{_0x1fb7be[_0x2fda('0x3a')](_0x1fb7be[_0x2fda('0x1a')][_0x30c47b['id']],_0x30c47b);}}}return _0x1fb7be['sugarcrmAccounts'];};};Realtime['prototype'][_0x2fda('0x4b')]=function(){var _0x471dda=this;return function(_0x21c4e0){if(_0x21c4e0){freeIsNotKey(_0x21c4e0,_0x471dda[_0x2fda('0x1d')],'id');for(var _0x75763f=0x0,_0x41a09b={},_0x5ee8a8={};_0x75763f<_0x21c4e0['length'];_0x75763f+=0x1){_0x41a09b=_0x21c4e0[_0x75763f];if(_[_0x2fda('0x3d')](_0x471dda[_0x2fda('0x1d')][_0x41a09b['id']])){_0x471dda[_0x2fda('0x1d')][_0x41a09b['id']]=new VtigerAccount(_0x41a09b);}else{_0x471dda['mergeFromDatabase'](_0x471dda[_0x2fda('0x1d')][_0x41a09b['id']],_0x41a09b);}}}return _0x471dda[_0x2fda('0x1d')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x4c')]=function(){var _0x3dee89=this;return function(_0x1cbe61){if(_0x1cbe61){freeIsNotKey(_0x1cbe61,_0x3dee89[_0x2fda('0x4d')],'id');for(var _0xaf4b6f=0x0,_0x16b7bd={},_0x31ab61={};_0xaf4b6f<_0x1cbe61['length'];_0xaf4b6f+=0x1){_0x16b7bd=_0x1cbe61[_0xaf4b6f];if(_[_0x2fda('0x3d')](_0x3dee89[_0x2fda('0x4d')][_0x16b7bd['id']])){_0x3dee89[_0x2fda('0x4d')][_0x16b7bd['id']]=new ServicenowAccount(_0x16b7bd);}else{_0x3dee89[_0x2fda('0x3a')](_0x3dee89[_0x2fda('0x4d')][_0x16b7bd['id']],_0x16b7bd);}}}return _0x3dee89['servicenowAccounts'];};};Realtime[_0x2fda('0x39')][_0x2fda('0x4e')]=function(){var _0x26a33f=this;return function(_0x2b8423){if(_0x2b8423){freeIsNotKey(_0x2b8423,_0x26a33f['dynamics365Accounts'],'id');for(var _0x365fbb=0x0,_0x273588={},_0x2c8afb={};_0x365fbb<_0x2b8423[_0x2fda('0x3c')];_0x365fbb+=0x1){_0x273588=_0x2b8423[_0x365fbb];if(_[_0x2fda('0x3d')](_0x26a33f[_0x2fda('0x1e')][_0x273588['id']])){_0x26a33f[_0x2fda('0x1e')][_0x273588['id']]=new Dynamics365Account(_0x273588);}else{_0x26a33f[_0x2fda('0x3a')](_0x26a33f[_0x2fda('0x1e')][_0x273588['id']],_0x273588);}}}return _0x26a33f[_0x2fda('0x1e')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x4f')]=function(){var _0x5b2a41=this;return function(_0x4ccdff){if(_0x4ccdff){freeIsNotKey(_0x4ccdff,_0x5b2a41[_0x2fda('0x1f')],'id');for(var _0x3fd1d6=0x0,_0x423de5={},_0xe084c={};_0x3fd1d6<_0x4ccdff[_0x2fda('0x3c')];_0x3fd1d6+=0x1){_0x423de5=_0x4ccdff[_0x3fd1d6];if(_[_0x2fda('0x3d')](_0x5b2a41['freshsalesAccounts'][_0x423de5['id']])){_0x5b2a41[_0x2fda('0x1f')][_0x423de5['id']]=new FreshsalesAccount(_0x423de5);}else{_0x5b2a41[_0x2fda('0x3a')](_0x5b2a41[_0x2fda('0x1f')][_0x423de5['id']],_0x423de5);}}}return _0x5b2a41[_0x2fda('0x1f')];};};Realtime['prototype'][_0x2fda('0x50')]=function(){var _0x36c7b2=this;return function(_0x51dab3){for(var _0x255974=0x0;_0x255974<_0x51dab3[_0x2fda('0x3c')];_0x255974+=0x1){_['merge'](_0x36c7b2[_0x2fda('0x12')][_0x51dab3[_0x255974]['name']],_0x51dab3[_0x255974]);}return _0x36c7b2[_0x2fda('0x12')];};};Realtime['prototype'][_0x2fda('0x51')]=function(){var _0x5156ca=this;return function(_0x547620){clearVoiceQueues(_0x5156ca[_0x2fda('0x12')]);if(_0x547620){_0x547620=_[_0x2fda('0x52')](_0x547620,_0x2fda('0x53'));for(var _0x436d4a in _0x547620){if(_0x547620[_0x2fda('0x22')](_0x436d4a)){var _0x4db695={};for(var _0x54d0aa=0x0;_0x54d0aa<_0x547620[_0x436d4a]['length'];_0x54d0aa+=0x1){var _0x1a0945=_0x547620[_0x436d4a][_0x54d0aa]['queue'];if(_0x5156ca[_0x2fda('0x12')][_0x1a0945]){if(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x54')]){_0x5156ca[_0x2fda('0x12')][_0x1a0945]['unmanaged']+=0x1;}if(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x55')]){_0x5156ca[_0x2fda('0x12')][_0x1a0945][_0x2fda('0x2e')]+=0x1;}_0x5156ca[_0x2fda('0x12')][_0x1a0945][_0x2fda('0x29')]+=moment(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x56')])[_0x2fda('0x57')](moment(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x58')]),_0x2fda('0x59'))||0x0;if(_0x54d0aa===_0x547620[_0x436d4a][_0x2fda('0x3c')]-0x1){_0x5156ca[_0x2fda('0x12')][_0x1a0945]['sumDuration']+=moment(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x5a')]||_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x5b')]||_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x5c')])[_0x2fda('0x57')](moment(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x58')]),_0x2fda('0x59'))||0x0;_0x5156ca['voiceQueues'][_0x1a0945][_0x2fda('0x28')]+=0x1;if(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x5d')]){_0x5156ca[_0x2fda('0x12')][_0x1a0945][_0x2fda('0x2d')]+=0x1;_0x5156ca[_0x2fda('0x12')][_0x1a0945][_0x2fda('0x5e')]+=moment(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x5a')])[_0x2fda('0x57')](moment(_0x547620[_0x436d4a][_0x54d0aa][_0x2fda('0x56')]),_0x2fda('0x59'))||0x0;}}else{_0x5156ca[_0x2fda('0x12')][_0x1a0945][_0x2fda('0x5f')]+=_0x5156ca[_0x2fda('0x12')][_0x1a0945][_0x2fda('0x29')]||0x0;}}}}}}return _0x5156ca['voiceQueues'];};};Realtime[_0x2fda('0x39')][_0x2fda('0x60')]=function(){var _0x517a2f=this;return function(_0xb473aa){clearVoiceCallReports(_0x517a2f[_0x2fda('0x15')]);if(_0xb473aa){for(var _0x375b4d=0x0;_0x375b4d<_0xb473aa[_0x2fda('0x3c')];_0x375b4d+=0x1){_0x517a2f[_0x2fda('0x15')][_0x2fda('0x28')]+=0x1;_0x517a2f[_0x2fda('0x15')][_0x2fda('0x5f')]+=_0xb473aa[_0x375b4d][_0x2fda('0x61')];if(_0xb473aa[_0x375b4d]['disposition']===_0x2fda('0x62')){_0x517a2f['outbound'][_0x2fda('0x2d')]+=0x1;_0x517a2f[_0x2fda('0x15')][_0x2fda('0x29')]+=_0xb473aa[_0x375b4d][_0x2fda('0x61')]-_0xb473aa[_0x375b4d][_0x2fda('0x63')]||0x0;_0x517a2f[_0x2fda('0x15')][_0x2fda('0x5e')]+=_0xb473aa[_0x375b4d][_0x2fda('0x63')];}}}return _0x517a2f[_0x2fda('0x15')];};};Realtime['prototype']['initCampaigns']=function(){var _0x5e7082=this;return function(_0x1b5a80){if(_0x1b5a80){freeIsNotKey(_0x1b5a80,_0x5e7082[_0x2fda('0x13')],_0x2fda('0x25'));for(var _0x5f11b4=0x0,_0x23f851={};_0x5f11b4<_0x1b5a80[_0x2fda('0x3c')];_0x5f11b4+=0x1){_0x23f851=_0x1b5a80[_0x5f11b4];if(_['isUndefined'](_0x5e7082[_0x2fda('0x13')][_0x23f851[_0x2fda('0x25')]])){_0x5e7082[_0x2fda('0x13')][_0x23f851['name']]=new Campaign(_0x23f851);}else{_0x5e7082[_0x2fda('0x3a')](_0x5e7082[_0x2fda('0x13')][_0x23f851['name']],_0x23f851);_0x5e7082[_0x2fda('0x13')][_0x23f851[_0x2fda('0x25')]]['dialQueueProject']=_0x23f851[_0x2fda('0x64')]?_0x23f851[_0x2fda('0x64')][_0x2fda('0x25')]:undefined;}}}return _0x5e7082['campaigns'];};};Realtime[_0x2fda('0x39')]['initVoiceExtensions']=function(){var _0x1b1f8a=this;return function(_0x1f5a41){if(_0x1f5a41){freeIsNotKey(_0x1f5a41,_0x1b1f8a['voiceExtensions'],'id');for(var _0x10be3b=0x0,_0x50830d={};_0x10be3b<_0x1f5a41[_0x2fda('0x3c')];_0x10be3b+=0x1){_0x50830d=_0x1f5a41[_0x10be3b];if(_[_0x2fda('0x3d')](_0x1b1f8a[_0x2fda('0x65')][_0x50830d['id']])){_0x1b1f8a['voiceExtensions'][_0x50830d['id']]=new VoiceExtension(_0x50830d);}else{_0x1b1f8a[_0x2fda('0x3a')](_0x1b1f8a[_0x2fda('0x65')][_0x50830d['id']],_0x50830d);}}}return _0x1b1f8a[_0x2fda('0x65')];};};Realtime[_0x2fda('0x39')][_0x2fda('0x66')]=function(){var _0x29ed89=this;return function(_0x239485){clearCampaigns(_0x29ed89[_0x2fda('0x13')]);for(var _0x2a2ebe=0x0;_0x2a2ebe<_0x239485[_0x2fda('0x3c')];_0x2a2ebe+=0x1){_[_0x2fda('0x67')](_0x29ed89[_0x2fda('0x13')][_0x239485[_0x2a2ebe][_0x2fda('0x25')]],_0x239485[_0x2a2ebe]);}return _0x29ed89['campaigns'];};};Realtime[_0x2fda('0x39')][_0x2fda('0x68')]=function(){var _0x1aba90=this;return function(_0x439269){if(_0x439269){freeIsNotKey(_0x439269,_0x1aba90[_0x2fda('0x20')],'id');for(var _0x3f43c5=0x0,_0x5c6605={},_0x41ae76={};_0x3f43c5<_0x439269[_0x2fda('0x3c')];_0x3f43c5+=0x1){_0x5c6605=_0x439269[_0x3f43c5];if(_[_0x2fda('0x3d')](_0x1aba90[_0x2fda('0x20')][_0x5c6605['id']])){_0x1aba90[_0x2fda('0x20')][_0x5c6605['id']]=new FaxAccount(_0x5c6605);}else{_0x1aba90[_0x2fda('0x3a')](_0x1aba90[_0x2fda('0x20')][_0x5c6605['id']],_0x5c6605);}}}return _0x1aba90['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x862c=['../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','format','SIP/%s','interface','answered','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','abandoned','sumHoldTime','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','queueStatusComplete','prototype','initAgents','length','isNil','isUndefined','mergeFromDatabase','initTelephones','initTrunks','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x862c,0xcb));var _0xc862=function(_0x245a3e,_0x6266c0){_0x245a3e=_0x245a3e-0x0;var _0x941391=_0x862c[_0x245a3e];return _0x941391;};'use strict';var BPromise=require(_0xc862('0x0'));var util=require(_0xc862('0x1'));var _=require('lodash');var moment=require(_0xc862('0x2'));var Agent=require(_0xc862('0x3'));var Telephone=require(_0xc862('0x4'));var Trunk=require(_0xc862('0x5'));var VoiceQueue=require(_0xc862('0x6'));var Trigger=require('../model/trigger');var Template=require(_0xc862('0x7'));var Campaign=require(_0xc862('0x8'));var VoiceExtension=require(_0xc862('0x9'));var ZendeskAccount=require(_0xc862('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xc862('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xc862('0xc'));var DeskAccount=require(_0xc862('0xd'));var VtigerAccount=require(_0xc862('0xe'));var ServicenowAccount=require(_0xc862('0xf'));var Dynamics365Account=require(_0xc862('0x10'));var FreshsalesAccount=require(_0xc862('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xc862('0x12')]={};this[_0xc862('0x13')]={};this[_0xc862('0x14')]={};this[_0xc862('0x15')]={};this[_0xc862('0x16')]={};this[_0xc862('0x17')]={};this[_0xc862('0x18')]={};this[_0xc862('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc862('0x1a')]={};this[_0xc862('0x1b')]={};this[_0xc862('0x1c')]={};this['outboundChannels']={};this[_0xc862('0x1d')]={};this[_0xc862('0x1e')]={};this[_0xc862('0x1f')]={};this[_0xc862('0x20')]={};this[_0xc862('0x21')]={};this[_0xc862('0x22')]={};this['zohoAccounts']={};this[_0xc862('0x23')]={};this[_0xc862('0x24')]={};this[_0xc862('0x25')]={};this[_0xc862('0x26')]={};this[_0xc862('0x27')]={};this[_0xc862('0x28')]={};};function freeIsNotKey(_0x53d295,_0x2d9e74,_0x51dedd){var _0x267339=_['mapKeys'](_0x53d295,function(_0x1668a4,_0x1a6457){return _0x1668a4[_0x51dedd];});for(var _0x5d0465 in _0x2d9e74){if(_0x2d9e74['hasOwnProperty'](_0x5d0465)){if(!_0x267339[_0x5d0465]){delete _0x2d9e74[_0x5d0465];}}}}function freeIsNotKeySip(_0x1d3db3,_0x548713){var _0x23d626=_[_0xc862('0x29')](_0x1d3db3,function(_0x442aae,_0x46f639){return util['format']('SIP/%s',_0x442aae[_0xc862('0x2a')]);});for(var _0x2ac28a in _0x548713){if(_0x548713[_0xc862('0x2b')](_0x2ac28a)){if(!_0x23d626[_0x2ac28a]){delete _0x548713[_0x2ac28a];}}}}function freeIsNotKeyAgent(_0x229f62,_0x13471b){var _0x4f0aab=_[_0xc862('0x29')](_0x229f62,function(_0x32b63f,_0x2559e3){var _0x187fc3=_['isNil'](_0x32b63f['interface'])?util[_0xc862('0x2c')](_0xc862('0x2d'),_0x32b63f['name']):_0x32b63f[_0xc862('0x2e')];return _0x187fc3;});for(var _0x2176d6 in _0x13471b){if(_0x13471b['hasOwnProperty'](_0x2176d6)){if(!_0x4f0aab[_0x2176d6]){delete _0x13471b[_0x2176d6];}}}}function clearVoiceCallReports(_0x5d3458){_0x5d3458['total']=0x0;_0x5d3458[_0xc862('0x2f')]=0x0;_0x5d3458['sumHoldTime']=0x0;_0x5d3458['sumDuration']=0x0;_0x5d3458['sumBillable']=0x0;}function clearCampaigns(_0x250b0f){if(!_[_0xc862('0x30')](_0x250b0f)){for(var _0x5270b2 in _0x250b0f){if(_0x250b0f[_0xc862('0x2b')](_0x5270b2)){_0x250b0f[_0x5270b2][_0xc862('0x31')]=0x0;_0x250b0f[_0x5270b2][_0xc862('0x32')]=0x0;}}}}function clearVoiceQueues(_0x3577d8){if(!_[_0xc862('0x30')](_0x3577d8)){for(var _0x2d30d in _0x3577d8){if(_0x3577d8[_0xc862('0x2b')](_0x2d30d)){_0x3577d8[_0x2d30d][_0xc862('0x33')]=0x0;_0x3577d8[_0x2d30d]['answered']=0x0;_0x3577d8[_0x2d30d]['unmanaged']=0x0;_0x3577d8[_0x2d30d][_0xc862('0x34')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x35')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x36')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x37')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x38')]=0x0;_0x3577d8[_0x2d30d]['outboundNoAnswerCallsDay']=0x0;_0x3577d8[_0x2d30d]['outboundBusyCallsDay']=0x0;_0x3577d8[_0x2d30d][_0xc862('0x39')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x3a')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x3b')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x3c')]=0x0;_0x3577d8[_0x2d30d][_0xc862('0x3d')]=0x0;_0x3577d8[_0x2d30d]['outboundBlacklistCallsDay']=0x0;_0x3577d8[_0x2d30d][_0xc862('0x3e')]=0x0;_0x3577d8[_0x2d30d]['outboundRejectCallsDay']=0x0;_0x3577d8[_0x2d30d]['outboundReCallsDay']=0x0;_0x3577d8[_0x2d30d][_0xc862('0x38')]=0x0;_0x3577d8[_0x2d30d]['outboundAnswerCallsDay']=0x0;_0x3577d8[_0x2d30d][_0xc862('0x3f')]=!![];}}}}Realtime[_0xc862('0x40')]['mergeFromDatabase']=function(_0x471684,_0x156cc6){for(var _0x922489 in _0x156cc6){if(_0x471684[_0xc862('0x2b')](_0x922489)){_0x471684[_0x922489]=_0x156cc6[_0x922489];}}};Realtime[_0xc862('0x40')][_0xc862('0x41')]=function(){var _0x4b47bc=this;return function(_0x2c25f6){if(_0x2c25f6){freeIsNotKeyAgent(_0x2c25f6,_0x4b47bc[_0xc862('0x12')]);for(var _0x494b8f=0x0,_0x421635={},_0x5df807={};_0x494b8f<_0x2c25f6[_0xc862('0x42')];_0x494b8f+=0x1){_0x421635=_0x2c25f6[_0x494b8f];var _0x445fc3=_[_0xc862('0x43')](_0x421635[_0xc862('0x2e')])?util[_0xc862('0x2c')](_0xc862('0x2d'),_0x421635['name']):_0x421635[_0xc862('0x2e')];if(_[_0xc862('0x44')](_0x4b47bc[_0xc862('0x12')][_0x445fc3])){_0x4b47bc[_0xc862('0x12')][_0x445fc3]=new Agent(_0x421635);}else{_0x4b47bc[_0xc862('0x45')](_0x4b47bc[_0xc862('0x12')][_0x445fc3],_0x421635);}}}return _0x4b47bc['agents'];};};Realtime['prototype'][_0xc862('0x46')]=function(){var _0x2e1cb1=this;return function(_0x33b9f4){if(_0x33b9f4){freeIsNotKeySip(_0x33b9f4,_0x2e1cb1[_0xc862('0x13')]);for(var _0x1e3630=0x0,_0x254f92={},_0x4315be={};_0x1e3630<_0x33b9f4[_0xc862('0x42')];_0x1e3630+=0x1){_0x254f92=_0x33b9f4[_0x1e3630];if(_[_0xc862('0x44')](_0x2e1cb1[_0xc862('0x13')][util[_0xc862('0x2c')](_0xc862('0x2d'),_0x254f92[_0xc862('0x2a')])])){_0x2e1cb1[_0xc862('0x13')][util[_0xc862('0x2c')](_0xc862('0x2d'),_0x254f92[_0xc862('0x2a')])]=new Telephone(_0x254f92);}else{_0x2e1cb1['mergeFromDatabase'](_0x2e1cb1[_0xc862('0x13')][util['format'](_0xc862('0x2d'),_0x254f92['name'])],_0x254f92);}}}return _0x2e1cb1[_0xc862('0x13')];};};Realtime[_0xc862('0x40')][_0xc862('0x47')]=function(){var _0x342698=this;return function(_0x1a46fd){if(_0x1a46fd){freeIsNotKeySip(_0x1a46fd,_0x342698[_0xc862('0x14')]);for(var _0x50a643=0x0,_0x526110={},_0x417113={};_0x50a643<_0x1a46fd['length'];_0x50a643+=0x1){_0x526110=_0x1a46fd[_0x50a643];if(_[_0xc862('0x44')](_0x342698[_0xc862('0x14')][util[_0xc862('0x2c')](_0xc862('0x2d'),_0x526110[_0xc862('0x2a')])])){_0x342698['trunks'][util[_0xc862('0x2c')](_0xc862('0x2d'),_0x526110[_0xc862('0x2a')])]=new Trunk(_0x526110);}else{_0x342698[_0xc862('0x45')](_0x342698['trunks'][util[_0xc862('0x2c')]('SIP/%s',_0x526110[_0xc862('0x2a')])],_0x526110);}}}return _0x342698[_0xc862('0x14')];};};Realtime[_0xc862('0x40')]['initVoiceQueues']=function(){var _0x457ba6=this;return function(_0x5bbb56){if(_0x5bbb56){freeIsNotKey(_0x5bbb56,_0x457ba6[_0xc862('0x15')],_0xc862('0x2a'));for(var _0x4a187a=0x0,_0x383c3a={},_0x4a608c={};_0x4a187a<_0x5bbb56[_0xc862('0x42')];_0x4a187a+=0x1){_0x383c3a=_0x5bbb56[_0x4a187a];if(_[_0xc862('0x44')](_0x457ba6['voiceQueues'][_0x383c3a[_0xc862('0x2a')]])){_0x457ba6[_0xc862('0x15')][_0x383c3a[_0xc862('0x2a')]]=new VoiceQueue(_0x383c3a);}else{_0x457ba6[_0xc862('0x45')](_0x457ba6[_0xc862('0x15')][_0x383c3a['name']],_0x383c3a);}}}return _0x457ba6['voiceQueues'];};};Realtime['prototype'][_0xc862('0x48')]=function(){var _0x9d2f51=this;return function(_0x19e45d){if(_0x19e45d){freeIsNotKey(_0x19e45d,_0x9d2f51[_0xc862('0x16')],'id');for(var _0x333452=0x0,_0x2d2bc3={},_0x2ec6b3={};_0x333452<_0x19e45d['length'];_0x333452+=0x1){_0x2d2bc3=_0x19e45d[_0x333452];if(_[_0xc862('0x44')](_0x9d2f51['triggers'][_0x2d2bc3['id']])){_0x9d2f51['triggers'][_0x2d2bc3['id']]=new Trigger(_0x2d2bc3);}else{_0x9d2f51[_0xc862('0x45')](_0x9d2f51[_0xc862('0x16')][_0x2d2bc3['id']],_0x2d2bc3);}}}return _0x9d2f51[_0xc862('0x16')];};};Realtime[_0xc862('0x40')][_0xc862('0x49')]=function(){var _0x343d6c=this;return function(_0x5ad9c0){if(_0x5ad9c0){freeIsNotKey(_0x5ad9c0,_0x343d6c[_0xc862('0x18')],'id');for(var _0x5311cb=0x0,_0x13e90b={},_0x477166={};_0x5311cb<_0x5ad9c0[_0xc862('0x42')];_0x5311cb+=0x1){_0x13e90b=_0x5ad9c0[_0x5311cb];if(_[_0xc862('0x44')](_0x343d6c['templates'][_0x13e90b['id']])){_0x343d6c[_0xc862('0x18')][_0x13e90b['id']]=new Template(_0x13e90b);}else{_0x343d6c[_0xc862('0x45')](_0x343d6c[_0xc862('0x18')][_0x13e90b['id']],_0x13e90b);}}}return _0x343d6c[_0xc862('0x18')];};};Realtime[_0xc862('0x40')]['initZendeskAccounts']=function(){var _0x4d575e=this;return function(_0x26c3dc){if(_0x26c3dc){freeIsNotKey(_0x26c3dc,_0x4d575e['zendeskAccounts'],'id');for(var _0x1f2905=0x0,_0x786e60={},_0x155677={};_0x1f2905<_0x26c3dc['length'];_0x1f2905+=0x1){_0x786e60=_0x26c3dc[_0x1f2905];if(_[_0xc862('0x44')](_0x4d575e[_0xc862('0x1f')][_0x786e60['id']])){_0x4d575e[_0xc862('0x1f')][_0x786e60['id']]=new ZendeskAccount(_0x786e60);}else{_0x4d575e[_0xc862('0x45')](_0x4d575e[_0xc862('0x1f')][_0x786e60['id']],_0x786e60);}}}return _0x4d575e[_0xc862('0x1f')];};};Realtime[_0xc862('0x40')][_0xc862('0x4a')]=function(){var _0x2d5e47=this;return function(_0x59d6fc){if(_0x59d6fc){freeIsNotKey(_0x59d6fc,_0x2d5e47[_0xc862('0x20')],'id');for(var _0xe97830=0x0,_0x1b1a76={},_0x20ae1f={};_0xe97830<_0x59d6fc[_0xc862('0x42')];_0xe97830+=0x1){_0x1b1a76=_0x59d6fc[_0xe97830];if(_[_0xc862('0x44')](_0x2d5e47['salesforceAccounts'][_0x1b1a76['id']])){_0x2d5e47[_0xc862('0x20')][_0x1b1a76['id']]=new SalesforceAccount(_0x1b1a76);}else{_0x2d5e47[_0xc862('0x45')](_0x2d5e47[_0xc862('0x20')][_0x1b1a76['id']],_0x1b1a76);}}}return _0x2d5e47['salesforceAccounts'];};};Realtime['prototype'][_0xc862('0x4b')]=function(){var _0xe8ffdf=this;return function(_0x1eb408){if(_0x1eb408){freeIsNotKey(_0x1eb408,_0xe8ffdf[_0xc862('0x22')],'id');for(var _0x3f48c1=0x0,_0x23de65={},_0x2550ba={};_0x3f48c1<_0x1eb408['length'];_0x3f48c1+=0x1){_0x23de65=_0x1eb408[_0x3f48c1];if(_[_0xc862('0x44')](_0xe8ffdf[_0xc862('0x22')][_0x23de65['id']])){_0xe8ffdf[_0xc862('0x22')][_0x23de65['id']]=new FreshdeskAccount(_0x23de65);}else{_0xe8ffdf[_0xc862('0x45')](_0xe8ffdf[_0xc862('0x22')][_0x23de65['id']],_0x23de65);}}}return _0xe8ffdf[_0xc862('0x22')];};};Realtime[_0xc862('0x40')][_0xc862('0x4c')]=function(){var _0x56c54c=this;return function(_0x2ec730){if(_0x2ec730){freeIsNotKey(_0x2ec730,_0x56c54c[_0xc862('0x4d')],'id');for(var _0x26516f=0x0,_0x2b559e={},_0x3a4bdf={};_0x26516f<_0x2ec730[_0xc862('0x42')];_0x26516f+=0x1){_0x2b559e=_0x2ec730[_0x26516f];if(_[_0xc862('0x44')](_0x56c54c[_0xc862('0x4d')][_0x2b559e['id']])){_0x56c54c[_0xc862('0x4d')][_0x2b559e['id']]=new ZohoAccount(_0x2b559e);}else{_0x56c54c[_0xc862('0x45')](_0x56c54c[_0xc862('0x4d')][_0x2b559e['id']],_0x2b559e);}}}return _0x56c54c['zohoAccounts'];};};Realtime[_0xc862('0x40')][_0xc862('0x4e')]=function(){var _0x2d2c6f=this;return function(_0x8f45ea){if(_0x8f45ea){freeIsNotKey(_0x8f45ea,_0x2d2c6f[_0xc862('0x23')],'id');for(var _0x4d47a4=0x0,_0x6f82c2={},_0x266130={};_0x4d47a4<_0x8f45ea[_0xc862('0x42')];_0x4d47a4+=0x1){_0x6f82c2=_0x8f45ea[_0x4d47a4];if(_[_0xc862('0x44')](_0x2d2c6f['deskAccounts'][_0x6f82c2['id']])){_0x2d2c6f[_0xc862('0x23')][_0x6f82c2['id']]=new DeskAccount(_0x6f82c2);}else{_0x2d2c6f['mergeFromDatabase'](_0x2d2c6f['deskAccounts'][_0x6f82c2['id']],_0x6f82c2);}}}return _0x2d2c6f[_0xc862('0x23')];};};Realtime['prototype'][_0xc862('0x4f')]=function(){var _0x3c361c=this;return function(_0x52ef45){if(_0x52ef45){freeIsNotKey(_0x52ef45,_0x3c361c[_0xc862('0x21')],'id');for(var _0x2429f8=0x0,_0x15f184={},_0x397da3={};_0x2429f8<_0x52ef45[_0xc862('0x42')];_0x2429f8+=0x1){_0x15f184=_0x52ef45[_0x2429f8];if(_[_0xc862('0x44')](_0x3c361c[_0xc862('0x21')][_0x15f184['id']])){_0x3c361c['sugarcrmAccounts'][_0x15f184['id']]=new SugarcrmAccount(_0x15f184);}else{_0x3c361c[_0xc862('0x45')](_0x3c361c['sugarcrmAccounts'][_0x15f184['id']],_0x15f184);}}}return _0x3c361c[_0xc862('0x21')];};};Realtime[_0xc862('0x40')]['initVtigerAccounts']=function(){var _0x300ebb=this;return function(_0x47e40d){if(_0x47e40d){freeIsNotKey(_0x47e40d,_0x300ebb[_0xc862('0x24')],'id');for(var _0x151ddd=0x0,_0x195fbd={},_0x5acec1={};_0x151ddd<_0x47e40d[_0xc862('0x42')];_0x151ddd+=0x1){_0x195fbd=_0x47e40d[_0x151ddd];if(_[_0xc862('0x44')](_0x300ebb[_0xc862('0x24')][_0x195fbd['id']])){_0x300ebb[_0xc862('0x24')][_0x195fbd['id']]=new VtigerAccount(_0x195fbd);}else{_0x300ebb[_0xc862('0x45')](_0x300ebb['vtigerAccounts'][_0x195fbd['id']],_0x195fbd);}}}return _0x300ebb[_0xc862('0x24')];};};Realtime[_0xc862('0x40')][_0xc862('0x50')]=function(){var _0x47460d=this;return function(_0x41698d){if(_0x41698d){freeIsNotKey(_0x41698d,_0x47460d[_0xc862('0x25')],'id');for(var _0x10cc4b=0x0,_0x57be2b={},_0x3418d7={};_0x10cc4b<_0x41698d[_0xc862('0x42')];_0x10cc4b+=0x1){_0x57be2b=_0x41698d[_0x10cc4b];if(_[_0xc862('0x44')](_0x47460d[_0xc862('0x25')][_0x57be2b['id']])){_0x47460d[_0xc862('0x25')][_0x57be2b['id']]=new ServicenowAccount(_0x57be2b);}else{_0x47460d[_0xc862('0x45')](_0x47460d['servicenowAccounts'][_0x57be2b['id']],_0x57be2b);}}}return _0x47460d[_0xc862('0x25')];};};Realtime[_0xc862('0x40')][_0xc862('0x51')]=function(){var _0x4cac34=this;return function(_0xf647d){if(_0xf647d){freeIsNotKey(_0xf647d,_0x4cac34['dynamics365Accounts'],'id');for(var _0x1f9a4a=0x0,_0x3b4059={},_0x133a58={};_0x1f9a4a<_0xf647d[_0xc862('0x42')];_0x1f9a4a+=0x1){_0x3b4059=_0xf647d[_0x1f9a4a];if(_[_0xc862('0x44')](_0x4cac34[_0xc862('0x26')][_0x3b4059['id']])){_0x4cac34[_0xc862('0x26')][_0x3b4059['id']]=new Dynamics365Account(_0x3b4059);}else{_0x4cac34[_0xc862('0x45')](_0x4cac34['dynamics365Accounts'][_0x3b4059['id']],_0x3b4059);}}}return _0x4cac34[_0xc862('0x26')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x4fbff3=this;return function(_0x364fd3){if(_0x364fd3){freeIsNotKey(_0x364fd3,_0x4fbff3[_0xc862('0x27')],'id');for(var _0x48505a=0x0,_0x383885={},_0x236d1b={};_0x48505a<_0x364fd3[_0xc862('0x42')];_0x48505a+=0x1){_0x383885=_0x364fd3[_0x48505a];if(_['isUndefined'](_0x4fbff3[_0xc862('0x27')][_0x383885['id']])){_0x4fbff3[_0xc862('0x27')][_0x383885['id']]=new FreshsalesAccount(_0x383885);}else{_0x4fbff3[_0xc862('0x45')](_0x4fbff3[_0xc862('0x27')][_0x383885['id']],_0x383885);}}}return _0x4fbff3[_0xc862('0x27')];};};Realtime[_0xc862('0x40')]['initVoiceQueueHopperHistory']=function(){var _0xe42e42=this;return function(_0x4ccacf){for(var _0x198dc3=0x0;_0x198dc3<_0x4ccacf[_0xc862('0x42')];_0x198dc3+=0x1){_[_0xc862('0x52')](_0xe42e42[_0xc862('0x15')][_0x4ccacf[_0x198dc3][_0xc862('0x2a')]],_0x4ccacf[_0x198dc3]);}return _0xe42e42[_0xc862('0x15')];};};Realtime['prototype'][_0xc862('0x53')]=function(){var _0x4242a0=this;return function(_0x253948){clearVoiceQueues(_0x4242a0[_0xc862('0x15')]);if(_0x253948){_0x253948=_['groupBy'](_0x253948,_0xc862('0x54'));for(var _0x356d2b in _0x253948){if(_0x253948[_0xc862('0x2b')](_0x356d2b)){var _0x3eca04={};for(var _0x3abaf3=0x0;_0x3abaf3<_0x253948[_0x356d2b][_0xc862('0x42')];_0x3abaf3+=0x1){var _0x3a5b8f=_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x55')];if(_0x4242a0[_0xc862('0x15')][_0x3a5b8f]){if(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x56')]){_0x4242a0['voiceQueues'][_0x3a5b8f]['unmanaged']+=0x1;}if(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x57')]){_0x4242a0[_0xc862('0x15')][_0x3a5b8f][_0xc862('0x34')]+=0x1;}_0x4242a0['voiceQueues'][_0x3a5b8f][_0xc862('0x35')]+=moment(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x58')])[_0xc862('0x59')](moment(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x5a')]),_0xc862('0x5b'))||0x0;if(_0x3abaf3===_0x253948[_0x356d2b][_0xc862('0x42')]-0x1){_0x4242a0['voiceQueues'][_0x3a5b8f]['sumDuration']+=moment(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x5c')]||_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x5d')]||_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x5e')])['diff'](moment(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x5a')]),_0xc862('0x5b'))||0x0;_0x4242a0['voiceQueues'][_0x3a5b8f]['total']+=0x1;if(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x5f')]){_0x4242a0[_0xc862('0x15')][_0x3a5b8f][_0xc862('0x2f')]+=0x1;_0x4242a0[_0xc862('0x15')][_0x3a5b8f][_0xc862('0x37')]+=moment(_0x253948[_0x356d2b][_0x3abaf3]['queuecallercompleteAt'])[_0xc862('0x59')](moment(_0x253948[_0x356d2b][_0x3abaf3][_0xc862('0x58')]),'seconds')||0x0;}}else{_0x4242a0['voiceQueues'][_0x3a5b8f][_0xc862('0x36')]+=_0x4242a0[_0xc862('0x15')][_0x3a5b8f][_0xc862('0x35')]||0x0;}}}}}}return _0x4242a0[_0xc862('0x15')];};};Realtime[_0xc862('0x40')][_0xc862('0x60')]=function(){var _0x9bac71=this;return function(_0x16bf32){clearVoiceCallReports(_0x9bac71[_0xc862('0x19')]);if(_0x16bf32){for(var _0x53311c=0x0;_0x53311c<_0x16bf32[_0xc862('0x42')];_0x53311c+=0x1){_0x9bac71[_0xc862('0x19')][_0xc862('0x33')]+=0x1;_0x9bac71[_0xc862('0x19')][_0xc862('0x36')]+=_0x16bf32[_0x53311c][_0xc862('0x61')];if(_0x16bf32[_0x53311c][_0xc862('0x62')]===_0xc862('0x63')){_0x9bac71[_0xc862('0x19')][_0xc862('0x2f')]+=0x1;_0x9bac71[_0xc862('0x19')]['sumHoldTime']+=_0x16bf32[_0x53311c][_0xc862('0x61')]-_0x16bf32[_0x53311c][_0xc862('0x64')]||0x0;_0x9bac71['outbound'][_0xc862('0x37')]+=_0x16bf32[_0x53311c]['billableseconds'];}}}return _0x9bac71[_0xc862('0x19')];};};Realtime[_0xc862('0x40')][_0xc862('0x65')]=function(){var _0x77fe75=this;return function(_0x4fc225){if(_0x4fc225){freeIsNotKey(_0x4fc225,_0x77fe75[_0xc862('0x17')],_0xc862('0x2a'));for(var _0x5a1508=0x0,_0x569780={};_0x5a1508<_0x4fc225['length'];_0x5a1508+=0x1){_0x569780=_0x4fc225[_0x5a1508];if(_[_0xc862('0x44')](_0x77fe75[_0xc862('0x17')][_0x569780[_0xc862('0x2a')]])){_0x77fe75['campaigns'][_0x569780[_0xc862('0x2a')]]=new Campaign(_0x569780);}else{_0x77fe75['mergeFromDatabase'](_0x77fe75[_0xc862('0x17')][_0x569780[_0xc862('0x2a')]],_0x569780);_0x77fe75['campaigns'][_0x569780[_0xc862('0x2a')]][_0xc862('0x66')]=_0x569780[_0xc862('0x67')]?_0x569780[_0xc862('0x67')][_0xc862('0x2a')]:undefined;}}}return _0x77fe75[_0xc862('0x17')];};};Realtime[_0xc862('0x40')][_0xc862('0x68')]=function(){var _0x46075a=this;return function(_0x3bf2eb){if(_0x3bf2eb){freeIsNotKey(_0x3bf2eb,_0x46075a[_0xc862('0x1a')],'id');for(var _0x3e4293=0x0,_0x2588fa={};_0x3e4293<_0x3bf2eb[_0xc862('0x42')];_0x3e4293+=0x1){_0x2588fa=_0x3bf2eb[_0x3e4293];if(_['isUndefined'](_0x46075a['voiceExtensions'][_0x2588fa['id']])){_0x46075a[_0xc862('0x1a')][_0x2588fa['id']]=new VoiceExtension(_0x2588fa);}else{_0x46075a[_0xc862('0x45')](_0x46075a[_0xc862('0x1a')][_0x2588fa['id']],_0x2588fa);}}}return _0x46075a[_0xc862('0x1a')];};};Realtime[_0xc862('0x40')][_0xc862('0x69')]=function(){var _0x55568e=this;return function(_0x201b55){clearCampaigns(_0x55568e[_0xc862('0x17')]);for(var _0x1ba7a5=0x0;_0x1ba7a5<_0x201b55['length'];_0x1ba7a5+=0x1){_[_0xc862('0x52')](_0x55568e['campaigns'][_0x201b55[_0x1ba7a5][_0xc862('0x2a')]],_0x201b55[_0x1ba7a5]);}return _0x55568e['campaigns'];};};Realtime[_0xc862('0x40')][_0xc862('0x6a')]=function(){var _0x1d700e=this;return function(_0x3ecf7a){if(_0x3ecf7a){freeIsNotKey(_0x3ecf7a,_0x1d700e[_0xc862('0x28')],'id');for(var _0x124e96=0x0,_0x43f2a5={},_0x371541={};_0x124e96<_0x3ecf7a[_0xc862('0x42')];_0x124e96+=0x1){_0x43f2a5=_0x3ecf7a[_0x124e96];if(_[_0xc862('0x44')](_0x1d700e[_0xc862('0x28')][_0x43f2a5['id']])){_0x1d700e[_0xc862('0x28')][_0x43f2a5['id']]=new FaxAccount(_0x43f2a5);}else{_0x1d700e[_0xc862('0x45')](_0x1d700e[_0xc862('0x28')][_0x43f2a5['id']],_0x43f2a5);}}}return _0x1d700e[_0xc862('0x28')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8a7ffb0..9a5d510 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 _0x55d4=['length','findAgent','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','getCallType','split','outbound','internal','destination','type','dialer','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','channel','membername','create','monitor','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','attendedTransfer','exports','lodash','moment','util','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','realtime','agents','telephones','prototype','sync','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','find','accountcode','name','interface','format','SIP/%s'];(function(_0x37ca5f,_0x7b93d4){var _0x4b0676=function(_0x5e9dbe){while(--_0x5e9dbe){_0x37ca5f['push'](_0x37ca5f['shift']());}};_0x4b0676(++_0x7b93d4);}(_0x55d4,0x13d));var _0x455d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x55d4[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x455d('0x0'));var moment=require(_0x455d('0x1'));var util=require(_0x455d('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x455d('0x3'));var RpcVoiceDialReport=require(_0x455d('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x455d('0x5'));var RpcVoiceTransferReport=require(_0x455d('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x5b1711){this[_0x455d('0x7')]=_0x5b1711;this[_0x455d('0x8')]=_0x5b1711[_0x455d('0x8')];this[_0x455d('0x9')]=_0x5b1711[_0x455d('0x9')];}Report[_0x455d('0xa')][_0x455d('0xb')]=function(_0x185622){var _0x39f449=new VoiceQueueReport(this[_0x455d('0x7')]);var _0x2cc2b5=new VoiceAgentReport(this[_0x455d('0x7')]);var _0x20716e=new VoiceDialReport(this[_0x455d('0x7')]);var _0x491a0d=new VoiceCallReport(this[_0x455d('0x7')]);var _0x2480b4=new UserReport(this[_0x455d('0x7')]);if(config['xdr']&&config['xdr'][_0x455d('0xc')]){ami['on'](_0x455d('0xd'),this[_0x455d('0xe')][_0x455d('0xf')](this));ami['on'](_0x455d('0x10'),this[_0x455d('0x11')][_0x455d('0xf')](this));ami['on'](_0x455d('0x12'),this[_0x455d('0x13')][_0x455d('0xf')](this));ami['on'](_0x455d('0x14'),this[_0x455d('0x15')][_0x455d('0xf')](this));ami['on'](_0x455d('0x16'),this[_0x455d('0x17')][_0x455d('0xf')](this));ami['on'](_0x455d('0x18'),this['attendedTransfer']['bind'](this));}};Report[_0x455d('0xa')]['findAgent']=function(_0x68de11){var _0x4d0041;_0x4d0041=_[_0x455d('0x19')](this['agents'],function(_0x413ef1){return _0x413ef1[_0x455d('0x1a')]==_0x68de11||_0x413ef1['name']==_0x68de11;});if(_['isNil'](_0x4d0041)){var _0x3d57e1=_[_0x455d('0x19')](this[_0x455d('0x9')],function(_0x4439f3){return _0x4439f3[_0x455d('0x1a')]==_0x68de11||_0x4439f3[_0x455d('0x1b')]==_0x68de11;});if(_0x3d57e1){_0x4d0041=_[_0x455d('0x19')](this[_0x455d('0x8')],function(_0x4ff1f9){return _0x4ff1f9[_0x455d('0x1c')]==util[_0x455d('0x1d')](_0x455d('0x1e'),_0x3d57e1[_0x455d('0x1b')]);});}}return _0x4d0041;};Report[_0x455d('0xa')][_0x455d('0xe')]=function(_0x253bbf){for(var _0x51faa5=0x0;_0x51faa5<_0x253bbf[_0x455d('0x1f')];_0x51faa5+=0x1){var _0x4bf0b1=this[_0x455d('0x20')](_0x253bbf[_0x51faa5][_0x455d('0x21')]);if(_0x4bf0b1){_0x253bbf[_0x51faa5][_0x455d('0x1a')]=_0x4bf0b1[_0x455d('0x1a')];_0x253bbf[_0x51faa5][_0x455d('0x22')]=!![];_0x253bbf[_0x51faa5][_0x455d('0x23')]=_0x4bf0b1[_0x455d('0x1b')];_0x253bbf[_0x51faa5][_0x455d('0x1c')]=_[_0x455d('0x24')](_0x4bf0b1[_0x455d('0x1c')])?util['format'](_0x455d('0x1e'),_0x4bf0b1[_0x455d('0x1b')]):_0x4bf0b1[_0x455d('0x1c')];if(_0x253bbf[_0x51faa5][_0x455d('0x25')]){_0x253bbf[_0x51faa5][_0x455d('0x26')]=moment()[_0x455d('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x253bbf[_0x51faa5][_0x455d('0x27')]){_0x253bbf[_0x51faa5][_0x455d('0x28')]=moment()[_0x455d('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x455d('0xe')](_0x253bbf[_0x51faa5]);}RpcVoiceQueueReport['create'](_0x253bbf[_0x51faa5]);}};function extractCalleridNumber(_0x651c38){var _0xf91ad5=_0x651c38[_0x455d('0x29')](/<(.*?)>/);return _0xf91ad5?_0xf91ad5[0x1]:_0x651c38;}Report[_0x455d('0xa')][_0x455d('0x2a')]=function(_0x1d3b4c){for(var _0x4207c3=0x0;_0x4207c3','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors','filename','createdAt','calleridname','connectedlinename','isArray','forEach','startsWith','Local','substring','indexOf','lastIndexOf','voiceDialReport','lodash','moment','util','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','isNil','name','interface','format','SIP/%s','voiceQueueReport','length','findAgent'];(function(_0x207e31,_0x4e5677){var _0x30237f=function(_0x3c8439){while(--_0x3c8439){_0x207e31['push'](_0x207e31['shift']());}};_0x30237f(++_0x4e5677);}(_0xd02f,0x89));var _0xfd02=function(_0x139154,_0x1548cf){_0x139154=_0x139154-0x0;var _0x5c2447=_0xd02f[_0x139154];return _0x5c2447;};'use strict';var _=require(_0xfd02('0x0'));var moment=require(_0xfd02('0x1'));var util=require(_0xfd02('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xfd02('0x3'));var RpcVoiceDialReport=require(_0xfd02('0x4'));var RpcMemberReport=require(_0xfd02('0x5'));var RpcVoiceQueueReport=require(_0xfd02('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xfd02('0x7'));var VoiceQueueReport=require(_0xfd02('0x8'));var VoiceCallReport=require(_0xfd02('0x9'));var VoiceAgentReport=require(_0xfd02('0xa'));var VoiceDialReport=require(_0xfd02('0xb'));var UserReport=require(_0xfd02('0xc'));function Report(_0x2d54e5){this[_0xfd02('0xd')]=_0x2d54e5;this[_0xfd02('0xe')]=_0x2d54e5[_0xfd02('0xe')];this[_0xfd02('0xf')]=_0x2d54e5[_0xfd02('0xf')];}Report[_0xfd02('0x10')]['sync']=function(_0x16ce0d){var _0x372951=new VoiceQueueReport(this[_0xfd02('0xd')]);var _0x2bb506=new VoiceAgentReport(this[_0xfd02('0xd')]);var _0x190b05=new VoiceDialReport(this['realtime']);var _0x4cfdbd=new VoiceCallReport(this['realtime']);var _0xb6f8f5=new UserReport(this[_0xfd02('0xd')]);if(config[_0xfd02('0x11')]&&config[_0xfd02('0x11')][_0xfd02('0x12')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xfd02('0x13')](this));ami['on']('custom:voiceCallReport',this[_0xfd02('0x14')]['bind'](this));ami['on'](_0xfd02('0x15'),this[_0xfd02('0x16')][_0xfd02('0x13')](this));ami['on'](_0xfd02('0x17'),this['voiceDialReport'][_0xfd02('0x13')](this));ami['on']('blindtransfer',this[_0xfd02('0x18')]['bind'](this));ami['on'](_0xfd02('0x19'),this[_0xfd02('0x1a')][_0xfd02('0x13')](this));}};Report[_0xfd02('0x10')]['findAgent']=function(_0x5408d7){var _0x178147;_0x178147=_[_0xfd02('0x1b')](this['agents'],function(_0x38395e){return _0x38395e[_0xfd02('0x1c')]==_0x5408d7||_0x38395e['name']==_0x5408d7;});if(_[_0xfd02('0x1d')](_0x178147)){var _0x4e29b5=_[_0xfd02('0x1b')](this[_0xfd02('0xf')],function(_0x600d8d){return _0x600d8d['accountcode']==_0x5408d7||_0x600d8d[_0xfd02('0x1e')]==_0x5408d7;});if(_0x4e29b5){_0x178147=_[_0xfd02('0x1b')](this[_0xfd02('0xe')],function(_0x516498){return _0x516498[_0xfd02('0x1f')]==util[_0xfd02('0x20')](_0xfd02('0x21'),_0x4e29b5['name']);});}}return _0x178147;};Report[_0xfd02('0x10')][_0xfd02('0x22')]=function(_0x569614){for(var _0x404357=0x0;_0x404357<_0x569614[_0xfd02('0x23')];_0x404357+=0x1){var _0x3b4557=this[_0xfd02('0x24')](_0x569614[_0x404357][_0xfd02('0x25')]);if(_0x3b4557){_0x569614[_0x404357]['accountcode']=_0x3b4557[_0xfd02('0x1c')];_0x569614[_0x404357][_0xfd02('0x26')]=!![];_0x569614[_0x404357][_0xfd02('0x27')]=_0x3b4557[_0xfd02('0x1e')];_0x569614[_0x404357][_0xfd02('0x1f')]=_['isNil'](_0x3b4557[_0xfd02('0x1f')])?util[_0xfd02('0x20')](_0xfd02('0x21'),_0x3b4557['name']):_0x3b4557[_0xfd02('0x1f')];if(_0x569614[_0x404357]['queuecallercomplete']){_0x569614[_0x404357][_0xfd02('0x28')]=moment()[_0xfd02('0x20')](_0xfd02('0x29'));}if(_0x569614[_0x404357][_0xfd02('0x2a')]){_0x569614[_0x404357][_0xfd02('0x2b')]=moment()[_0xfd02('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xfd02('0x22')](_0x569614[_0x404357]);}RpcVoiceQueueReport[_0xfd02('0x2c')](_0x569614[_0x404357]);}};function extractCalleridNumber(_0x19a898){var _0x53689c=_0x19a898[_0xfd02('0x2d')](/<(.*?)>/);return _0x53689c?_0x53689c[0x1]:_0x19a898;}Report[_0xfd02('0x10')][_0xfd02('0x2e')]=function(_0x712c78){for(var _0x4a8e22=0x0;_0x4a8e220x0?_0x2f6ddb:0x0;this[_0xfef1('0x13')][_0x3ae3b5['queue']][_0xfef1('0x34')]=this['voiceQueues'][_0x3ae3b5[_0xfef1('0x69')]][_0xfef1('0x34')]>_[_0xfef1('0x6e')](_0x3ae3b5[_0xfef1('0x70')])?_[_0xfef1('0x6e')](_0x3ae3b5[_0xfef1('0x70')]):this[_0xfef1('0x13')][_0x3ae3b5['queue']]['talking'];this[_0xfef1('0x51')](this[_0xfef1('0x13')][_0x3ae3b5[_0xfef1('0x69')]],_0xfef1('0x17'));}logger[_0xfef1('0x48')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xfef1('0x45')](this[_0xfef1('0x13')][_0x3ae3b5[_0xfef1('0x69')]],{'showHidden':![],'depth':null}));ami[_0xfef1('0x47')](_0xfef1('0x71'),this['voiceQueues'][_0x3ae3b5[_0xfef1('0x69')]]);}}}catch(_0x111207){logger[_0xfef1('0x42')]('[voiceQueueReport][queuesummary]',util[_0xfef1('0x45')](_0x111207,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x474bfd){logger[_0xfef1('0x48')](_0xfef1('0x72'),util[_0xfef1('0x45')](_0x474bfd,{'showHidden':![],'depth':null}));this[_0xfef1('0x14')]=!![];};VoiceQueueReport[_0xfef1('0xa')][_0xfef1('0x1c')]=function(_0x4bf4cf){try{if(this[_0xfef1('0x64')](_0x4bf4cf)){logger['debug'](_0xfef1('0x73'),_0x4bf4cf[_0xfef1('0x74')],util['inspect'](_0x4bf4cf,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xfef1('0xf')][_0x4bf4cf[_0xfef1('0x74')]]))this[_0xfef1('0xf')][_0x4bf4cf[_0xfef1('0x74')]]=[];if(_[_0xfef1('0x65')](this[_0xfef1('0x11')][_0x4bf4cf[_0xfef1('0x74')]]))this[_0xfef1('0x11')][_0x4bf4cf[_0xfef1('0x74')]]={};var _0x1bcabd=new QueueReport();_0x1bcabd['name']=_0x4bf4cf[_0xfef1('0x69')];_0x1bcabd[_0xfef1('0x52')]=this[_0xfef1('0x13')][_0x1bcabd[_0xfef1('0x4c')]]&&this[_0xfef1('0x13')][_0x1bcabd['name']][_0xfef1('0x52')]?this['voiceQueues'][_0x1bcabd[_0xfef1('0x4c')]][_0xfef1('0x52')]||_0xfef1('0x53'):'inbound';_0x1bcabd[_0xfef1('0x69')]=_0x4bf4cf['queue'];_0x1bcabd[_0xfef1('0x75')]=moment()[_0xfef1('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bcabd[_0xfef1('0x76')]=_0x4bf4cf[_0xfef1('0x76')];_0x1bcabd['count']=_0x4bf4cf[_0xfef1('0x77')];_0x1bcabd[_0xfef1('0x74')]=_0x4bf4cf[_0xfef1('0x74')];_0x1bcabd[_0xfef1('0x78')]=this[_0xfef1('0x11')][_0x4bf4cf[_0xfef1('0x74')]][_0xfef1('0x78')];logger['info'](_0xfef1('0x79'),_0x1bcabd['name'],_0x1bcabd[_0xfef1('0x52')]);_[_0xfef1('0x7a')](_0x1bcabd,_[_0xfef1('0x7b')](_0x4bf4cf,_['keys'](_0x1bcabd)));this[_0xfef1('0xf')][_0x4bf4cf[_0xfef1('0x74')]][_0xfef1('0x7c')](_0x1bcabd);this[_0xfef1('0x11')][_0x4bf4cf['uniqueid']]=_0x1bcabd;this[_0xfef1('0x7d')](_0x1bcabd,'queuecallerjoin');}}catch(_0x551e77){logger['error'](_0xfef1('0x73'),_0x4bf4cf[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x551e77,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfef1('0xa')][_0xfef1('0x1e')]=function(_0x3752c8){try{if(this[_0xfef1('0x64')](_0x3752c8)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x3752c8[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x3752c8,{'showHidden':![],'depth':null}));if(this[_0xfef1('0xf')][_0x3752c8[_0xfef1('0x74')]]){var _0x28310f=_[_0xfef1('0x7e')](this['queueReports'][_0x3752c8['uniqueid']]);_0x28310f['queuecallercomplete']=![];_0x28310f[_0xfef1('0x7f')]=null;_0x28310f[_0xfef1('0x80')]=_0x3752c8[_0xfef1('0x80')];_0x28310f['originalposition']=_0x3752c8['originalposition'];_0x28310f[_0xfef1('0x1d')]=!![];_0x28310f[_0xfef1('0x81')]=moment()[_0xfef1('0x4a')](_0xfef1('0x82'));_0x28310f[_0xfef1('0x83')]='ABANDONED';_0x28310f[_0xfef1('0x84')]=null;logger[_0xfef1('0x6b')](_0xfef1('0x85'),_0x28310f[_0xfef1('0x4c')],_0x28310f['type']);this[_0xfef1('0x11')][_0x3752c8[_0xfef1('0x74')]]=_0x28310f;this[_0xfef1('0x46')](_0x28310f,_0xfef1('0x1d'));}}}catch(_0x2486c2){logger[_0xfef1('0x42')](_0xfef1('0x86'),_0x3752c8['uniqueid'],util[_0xfef1('0x45')](_0x2486c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfef1('0xa')]['syncQueueCallerLeave']=function(_0x11c061){try{if(this[_0xfef1('0x64')](_0x11c061)){logger[_0xfef1('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x11c061['uniqueid'],util[_0xfef1('0x45')](_0x11c061,{'showHidden':![],'depth':null}));if(this[_0xfef1('0xf')][_0x11c061[_0xfef1('0x74')]]){var _0x26b12f=_[_0xfef1('0x7e')](this[_0xfef1('0xf')][_0x11c061['uniqueid']]);_0x26b12f[_0xfef1('0x87')]=moment()[_0xfef1('0x4a')](_0xfef1('0x82'));_0x26b12f[_0xfef1('0x88')]=_0x11c061[_0xfef1('0x88')];_0x26b12f[_0xfef1('0x89')]=_0x11c061[_0xfef1('0x89')];logger[_0xfef1('0x6b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x26b12f[_0xfef1('0x4c')],_0x26b12f[_0xfef1('0x52')],_0x11c061[_0xfef1('0x88')],_0x11c061[_0xfef1('0x89')]);this['channels'][_0x11c061[_0xfef1('0x74')]]=_0x26b12f;this[_0xfef1('0x7d')](_0x26b12f,'queuecallerleave');}}}catch(_0x1cc84d){logger['error'](_0xfef1('0x8a'),_0x11c061[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x1cc84d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfef1('0xa')][_0xfef1('0x8b')]=function(_0x314094){try{if(this[_0xfef1('0x64')](_0x314094)){logger[_0xfef1('0x48')](_0xfef1('0x8c'),_0x314094[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x314094,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x314094[_0xfef1('0x74')]]){var _0x1d8e65=_['last'](this[_0xfef1('0xf')][_0x314094['uniqueid']]);_0x1d8e65['queuecallercomplete']=!![];_0x1d8e65['queuecallerexitreason']=_0xfef1('0x8d');logger[_0xfef1('0x6b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x1d8e65[_0xfef1('0x4c')],_0x1d8e65[_0xfef1('0x52')]);}}}catch(_0x5191ae){logger[_0xfef1('0x42')](_0xfef1('0x8c'),_0x314094[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x5191ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfef1('0xa')][_0xfef1('0x8e')]=function(_0x5c51b8){try{if(this[_0xfef1('0x64')](_0x5c51b8)){logger[_0xfef1('0x48')](_0xfef1('0x8f'),_0x5c51b8['uniqueid'],util[_0xfef1('0x45')](_0x5c51b8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5c51b8[_0xfef1('0x74')]]){var _0x20ab36=_[_0xfef1('0x7e')](this[_0xfef1('0xf')][_0x5c51b8[_0xfef1('0x74')]]);_0x20ab36[_0xfef1('0x1d')]=![];_0x20ab36[_0xfef1('0x81')]=null;_0x20ab36[_0xfef1('0x90')]=!![];_0x20ab36[_0xfef1('0x84')]=_0x5c51b8['membername'];_0x20ab36[_0xfef1('0x80')]=_0x5c51b8[_0xfef1('0x80')];_0x20ab36[_0xfef1('0x91')]=!![];_0x20ab36['queuecallerexit']=![];_0x20ab36[_0xfef1('0x92')]=null;if(!_0x20ab36[_0xfef1('0x93')]){if(_0x5c51b8[_0xfef1('0x94')]==_0xfef1('0x93')){_0x20ab36[_0xfef1('0x83')]=_0xfef1('0x95');logger[_0xfef1('0x6b')](_0xfef1('0x96'),_0x20ab36[_0xfef1('0x4c')],_0x20ab36[_0xfef1('0x52')]);}else{if(_[_0xfef1('0x97')](_0x5c51b8[_0xfef1('0x3e')][_0xfef1('0x98')](),_0xfef1('0x99'))){if(this[_0xfef1('0xf')][_0x5c51b8[_0xfef1('0x9a')]]){var _0x3116d3=_[_0xfef1('0x7e')](this[_0xfef1('0xf')][_0x5c51b8[_0xfef1('0x9a')]]);_0x3116d3[_0xfef1('0x91')]=![];_0x3116d3['queuecallerexit']=!![];_0x3116d3[_0xfef1('0x92')]=moment(_0x20ab36['queuecallerjoinAt'])[_0xfef1('0x9b')](_0x5c51b8[_0xfef1('0x80')],_0xfef1('0x9c'))[_0xfef1('0x4a')](_0xfef1('0x82'));_0x3116d3[_0xfef1('0x83')]='FORWARDTRANSFER';_0x3116d3[_0xfef1('0x93')]=!![];_0x3116d3['transfertype']=_0xfef1('0x9d');_0x3116d3['transferexten']=_0x5c51b8['destexten'];_0x3116d3[_0xfef1('0x9e')]=_0x5c51b8[_0xfef1('0x74')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x3116d3[_0xfef1('0x4c')],_0x3116d3[_0xfef1('0x52')]);var _0x340796=this['queueReports'][_0x5c51b8[_0xfef1('0x9a')]];this[_0xfef1('0xf')][_0x5c51b8['linkedid']]=this[_0xfef1('0xf')][_0x5c51b8['uniqueid']];this[_0xfef1('0xf')][_0x5c51b8[_0xfef1('0x74')]]=_0x340796;}}else{_0x20ab36[_0xfef1('0x83')]=_0xfef1('0x9f')+_0x5c51b8[_0xfef1('0x94')][_0xfef1('0xa0')]();logger[_0xfef1('0x6b')](_0xfef1('0xa1'),_0x20ab36['name'],_0x20ab36['type'],_0x20ab36[_0xfef1('0x83')]);}}}this[_0xfef1('0x11')][_0x5c51b8['uniqueid']]=_0x20ab36;this[_0xfef1('0x46')](_0x20ab36,_0xfef1('0x21'));}}}catch(_0x31ed12){logger[_0xfef1('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x5c51b8[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x31ed12,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfef1('0x24')]=function(_0x113c91){try{if(this[_0xfef1('0x64')](_0x113c91)){logger[_0xfef1('0x48')]('[%s][voiceQueueReport][varset]',_0x113c91[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x113c91,{'showHidden':![],'depth':null}));this[_0xfef1('0xa2')](_0x113c91[_0xfef1('0x74')],_[_0xfef1('0xa3')](_0x113c91[_0xfef1('0xa4')])[0x0],_0x113c91[_0xfef1('0xa5')]);if(this[_0xfef1('0xf')][_0x113c91[_0xfef1('0x74')]]){var _0x4207ee=_[_0xfef1('0x7e')](this[_0xfef1('0xf')][_0x113c91[_0xfef1('0x74')]]);if(_0x4207ee){if(this[_0xfef1('0x64')](_0x113c91[_0xfef1('0xa4')])&&this[_0xfef1('0x64')](_0x113c91[_0xfef1('0xa4')]['queuestatus'])){switch(_0x113c91[_0xfef1('0xa5')]){case _0xfef1('0xa6'):_0x4207ee[_0xfef1('0xa7')]=![];_0x4207ee[_0xfef1('0x92')]=null;break;case _0xfef1('0xa8'):_0x4207ee[_0xfef1('0xa9')]='timeout';_0x4207ee[_0xfef1('0xa7')]=!![];_0x4207ee[_0xfef1('0x92')]=moment()[_0xfef1('0x4a')](_0xfef1('0x82'));_0x4207ee[_0xfef1('0x87')]=moment()[_0xfef1('0x4a')](_0xfef1('0x82'));logger[_0xfef1('0x48')](_0xfef1('0xaa'),_0x113c91[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x4207ee,{'showHidden':![],'depth':null}));ami[_0xfef1('0x47')](_0xfef1('0xab'),_0x4207ee);break;default:_0x4207ee[_0xfef1('0xa7')]=!![];_0x4207ee['queuecallerexitAt']=moment()[_0xfef1('0x4a')](_0xfef1('0x82'));_0x4207ee['queuecallerleaveAt']=moment()[_0xfef1('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4207ee[_0xfef1('0x1d')]=![];_0x4207ee[_0xfef1('0x81')]=null;_0x4207ee[_0xfef1('0x83')]=_0x113c91[_0xfef1('0xa5')];this[_0xfef1('0x11')][_0x113c91[_0xfef1('0x74')]]=_0x4207ee;this[_0xfef1('0x46')](_0x4207ee,'varset');}else if(this[_0xfef1('0x64')](_0x113c91[_0xfef1('0xa4')])&&this['isNotNull'](_0x113c91['variable'][_0xfef1('0xac')])){if(!_0x4207ee[_0xfef1('0x1d')]){_0x4207ee[_0xfef1('0xa7')]=!![];_0x4207ee['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4207ee[_0xfef1('0x83')]='EXITWITHKEY';_0x4207ee[_0xfef1('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x113c91[_0xfef1('0x74')]]=_0x4207ee;}}logger['info'](_0xfef1('0xad'),_0x113c91[_0xfef1('0x74')],_0x4207ee[_0xfef1('0x4c')],_0x4207ee[_0xfef1('0x52')],_[_0xfef1('0xa3')](_0x113c91[_0xfef1('0xa4')])[0x0],_0x113c91[_0xfef1('0xa5')]);_0x4207ee[_0xfef1('0x16')]=this[_0xfef1('0x16')][_0x113c91[_0xfef1('0x74')]];}}}}catch(_0x1da8d6){logger[_0xfef1('0x42')](_0xfef1('0xae'),_0x113c91[_0xfef1('0x74')],util[_0xfef1('0x45')](_0x1da8d6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfef1('0xa2')]=function(_0x2d4bdd,_0x585346,_0x6b767){var _0x1ce70d=[_0xfef1('0xaf'),'rtpaudioqosbridged',_0xfef1('0xb0'),_0xfef1('0xb1'),_0xfef1('0xb2'),_0xfef1('0xb3'),'rtpaudioqosrtt',_0xfef1('0xb4'),_0xfef1('0xb5'),_0xfef1('0xb6'),'bridgepeer','bridgepvtcallid',_0xfef1('0xb7'),_0xfef1('0xb8'),_0xfef1('0xb9'),'memberlastcall',_0xfef1('0xba'),_0xfef1('0xbb'),_0xfef1('0xbc')];if(!_[_0xfef1('0x3b')](_0x585346)&&!_[_0xfef1('0xbd')](_0x1ce70d,_0x585346)){if(_[_0xfef1('0x65')](this['variables'][_0x2d4bdd])){this['variables'][_0x2d4bdd]={};}this[_0xfef1('0x16')][_0x2d4bdd][_0x585346]=_0x6b767;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x305750){try{if(this['isNotNull'](_0x305750)){logger[_0xfef1('0x48')](_0xfef1('0xbe'),_0x305750['uniqueid'],util[_0xfef1('0x45')](_0x305750,{'showHidden':![],'depth':null}));if(this[_0xfef1('0xf')][_0x305750[_0xfef1('0x74')]]){for(var _0x4bbb10=0x0,_0x167f3c={};_0x4bbb100x0?_0xfe1840:0x0;this['voiceQueues'][_0x473c1b[_0x473b('0x6a')]]['talking']=this[_0x473b('0x13')][_0x473c1b['queue']]['talking']>_['toNumber'](_0x473c1b[_0x473b('0x70')])?_[_0x473b('0x6e')](_0x473c1b['loggedin']):this[_0x473b('0x13')][_0x473c1b[_0x473b('0x6a')]]['talking'];this[_0x473b('0x52')](this[_0x473b('0x13')][_0x473c1b[_0x473b('0x6a')]],'queuesummary');}logger['debug'](_0x473b('0x71'),util[_0x473b('0x3f')](this['voiceQueues'][_0x473c1b[_0x473b('0x6a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this['voiceQueues'][_0x473c1b['queue']]);}}}catch(_0x129237){logger['error'](_0x473b('0x69'),util[_0x473b('0x3f')](_0x129237,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x4a7f97){logger[_0x473b('0x4f')](_0x473b('0x72'),util[_0x473b('0x3f')](_0x4a7f97,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x473b('0xa')][_0x473b('0x1d')]=function(_0x2f1162){try{if(this[_0x473b('0x66')](_0x2f1162)){logger[_0x473b('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2f1162[_0x473b('0x4a')],util['inspect'](_0x2f1162,{'showHidden':![],'depth':null}));if(_[_0x473b('0x67')](this[_0x473b('0xf')][_0x2f1162[_0x473b('0x4a')]]))this[_0x473b('0xf')][_0x2f1162[_0x473b('0x4a')]]=[];if(_[_0x473b('0x67')](this[_0x473b('0x11')][_0x2f1162['uniqueid']]))this[_0x473b('0x11')][_0x2f1162[_0x473b('0x4a')]]={};var _0x52fcf0=new QueueReport();_0x52fcf0[_0x473b('0x4c')]=_0x2f1162[_0x473b('0x6a')];_0x52fcf0[_0x473b('0x5c')]=this[_0x473b('0x13')][_0x52fcf0[_0x473b('0x4c')]]&&this[_0x473b('0x13')][_0x52fcf0['name']]['type']?this['voiceQueues'][_0x52fcf0[_0x473b('0x4c')]][_0x473b('0x5c')]||'inbound':'inbound';_0x52fcf0[_0x473b('0x6a')]=_0x2f1162['queue'];_0x52fcf0[_0x473b('0x73')]=moment()[_0x473b('0x4b')](_0x473b('0x74'));_0x52fcf0[_0x473b('0x75')]=_0x2f1162[_0x473b('0x75')];_0x52fcf0['count']=_0x2f1162['count'];_0x52fcf0[_0x473b('0x4a')]=_0x2f1162[_0x473b('0x4a')];_0x52fcf0['routealias']=this[_0x473b('0x11')][_0x2f1162['uniqueid']]['routealias'];logger[_0x473b('0x76')](_0x473b('0x77'),_0x52fcf0[_0x473b('0x4c')],_0x52fcf0[_0x473b('0x5c')]);_['merge'](_0x52fcf0,_[_0x473b('0x78')](_0x2f1162,_['keys'](_0x52fcf0)));this[_0x473b('0xf')][_0x2f1162[_0x473b('0x4a')]]['push'](_0x52fcf0);this[_0x473b('0x11')][_0x2f1162[_0x473b('0x4a')]]=_0x52fcf0;this['emitVoiceQueueChannelSave'](_0x52fcf0,'queuecallerjoin');}}catch(_0x479621){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x2f1162[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x479621,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x473b('0xa')][_0x473b('0x1e')]=function(_0x41fc20){try{if(this['isNotNull'](_0x41fc20)){logger[_0x473b('0x4f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x41fc20['uniqueid'],util['inspect'](_0x41fc20,{'showHidden':![],'depth':null}));if(this[_0x473b('0xf')][_0x41fc20[_0x473b('0x4a')]]){var _0x1e51ff=_[_0x473b('0x79')](this[_0x473b('0xf')][_0x41fc20[_0x473b('0x4a')]]);_0x1e51ff[_0x473b('0x7a')]=![];_0x1e51ff[_0x473b('0x7b')]=null;_0x1e51ff[_0x473b('0x7c')]=_0x41fc20['holdtime'];_0x1e51ff[_0x473b('0x7d')]=_0x41fc20['originalposition'];_0x1e51ff['queuecallerabandon']=!![];_0x1e51ff[_0x473b('0x7e')]=moment()[_0x473b('0x4b')](_0x473b('0x74'));_0x1e51ff[_0x473b('0x7f')]=_0x473b('0x80');_0x1e51ff[_0x473b('0x81')]=null;logger[_0x473b('0x76')](_0x473b('0x82'),_0x1e51ff[_0x473b('0x4c')],_0x1e51ff[_0x473b('0x5c')]);this['channels'][_0x41fc20['uniqueid']]=_0x1e51ff;this[_0x473b('0x44')](_0x1e51ff,'queuecallerabandon');}}}catch(_0x303449){logger[_0x473b('0x40')](_0x473b('0x83'),_0x41fc20[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x303449,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x473b('0xa')][_0x473b('0x84')]=function(_0x390bfa){try{if(this[_0x473b('0x66')](_0x390bfa)){logger[_0x473b('0x4f')](_0x473b('0x85'),_0x390bfa[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x390bfa,{'showHidden':![],'depth':null}));if(this[_0x473b('0xf')][_0x390bfa[_0x473b('0x4a')]]){var _0x59d300=_[_0x473b('0x79')](this[_0x473b('0xf')][_0x390bfa['uniqueid']]);_0x59d300[_0x473b('0x86')]=moment()[_0x473b('0x4b')](_0x473b('0x74'));_0x59d300[_0x473b('0x87')]=_0x390bfa[_0x473b('0x87')];_0x59d300[_0x473b('0x88')]=_0x390bfa[_0x473b('0x88')];logger[_0x473b('0x76')](_0x473b('0x89'),_0x59d300[_0x473b('0x4c')],_0x59d300[_0x473b('0x5c')],_0x390bfa['connectedlinenum'],_0x390bfa[_0x473b('0x88')]);this[_0x473b('0x11')][_0x390bfa[_0x473b('0x4a')]]=_0x59d300;this[_0x473b('0x47')](_0x59d300,_0x473b('0x1f'));}}}catch(_0x44321c){logger[_0x473b('0x40')](_0x473b('0x85'),_0x390bfa['uniqueid'],util[_0x473b('0x3f')](_0x44321c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x473b('0xa')][_0x473b('0x21')]=function(_0x4fd479){try{if(this[_0x473b('0x66')](_0x4fd479)){logger[_0x473b('0x4f')](_0x473b('0x8a'),_0x4fd479[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x4fd479,{'showHidden':![],'depth':null}));if(this[_0x473b('0xf')][_0x4fd479[_0x473b('0x4a')]]){var _0x233625=_[_0x473b('0x79')](this[_0x473b('0xf')][_0x4fd479[_0x473b('0x4a')]]);_0x233625['queuecallercomplete']=!![];_0x233625[_0x473b('0x7f')]='COMPLETEDBYAGENT';logger[_0x473b('0x76')](_0x473b('0x8b'),_0x233625[_0x473b('0x4c')],_0x233625['type']);}}}catch(_0x5453fb){logger['error'](_0x473b('0x8a'),_0x4fd479['uniqueid'],util[_0x473b('0x3f')](_0x5453fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x473b('0xa')][_0x473b('0x8c')]=function(_0x240c6c){try{if(this[_0x473b('0x66')](_0x240c6c)){logger['debug'](_0x473b('0x8d'),_0x240c6c[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x240c6c,{'showHidden':![],'depth':null}));if(this[_0x473b('0xf')][_0x240c6c[_0x473b('0x4a')]]){var _0x2a03fa=_[_0x473b('0x79')](this['queueReports'][_0x240c6c[_0x473b('0x4a')]]);_0x2a03fa[_0x473b('0x8e')]=![];_0x2a03fa[_0x473b('0x7e')]=null;_0x2a03fa[_0x473b('0x8f')]=!![];_0x2a03fa[_0x473b('0x81')]=_0x240c6c[_0x473b('0x90')];_0x2a03fa['holdtime']=_0x240c6c[_0x473b('0x7c')];_0x2a03fa[_0x473b('0x7a')]=!![];_0x2a03fa[_0x473b('0x91')]=![];_0x2a03fa[_0x473b('0x92')]=null;if(!_0x2a03fa[_0x473b('0x93')]){if(_0x240c6c[_0x473b('0x94')]=='transfer'){_0x2a03fa['queuecallerexitreason']=_0x473b('0x95');logger[_0x473b('0x76')](_0x473b('0x96'),_0x2a03fa[_0x473b('0x4c')],_0x2a03fa[_0x473b('0x5c')]);}else{if(_[_0x473b('0x97')](_0x240c6c[_0x473b('0x39')][_0x473b('0x98')](),_0x473b('0x99'))){if(this[_0x473b('0xf')][_0x240c6c[_0x473b('0x9a')]]){var _0x41d217=_[_0x473b('0x79')](this[_0x473b('0xf')][_0x240c6c[_0x473b('0x9a')]]);_0x41d217[_0x473b('0x7a')]=![];_0x41d217['queuecallerexit']=!![];_0x41d217['queuecallerexitAt']=moment(_0x2a03fa[_0x473b('0x73')])['add'](_0x240c6c['holdtime'],'seconds')[_0x473b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x41d217[_0x473b('0x7f')]=_0x473b('0x9b');_0x41d217[_0x473b('0x93')]=!![];_0x41d217['transfertype']=_0x473b('0x9c');_0x41d217[_0x473b('0x9d')]=_0x240c6c[_0x473b('0x9e')];_0x41d217[_0x473b('0x9f')]=_0x240c6c[_0x473b('0x4a')];logger[_0x473b('0x76')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x41d217[_0x473b('0x4c')],_0x41d217[_0x473b('0x5c')]);var _0x83dc6=this[_0x473b('0xf')][_0x240c6c['linkedid']];this[_0x473b('0xf')][_0x240c6c['linkedid']]=this[_0x473b('0xf')][_0x240c6c[_0x473b('0x4a')]];this[_0x473b('0xf')][_0x240c6c[_0x473b('0x4a')]]=_0x83dc6;}}else{_0x2a03fa[_0x473b('0x7f')]=_0x473b('0xa0')+_0x240c6c['reason'][_0x473b('0xa1')]();logger[_0x473b('0x76')](_0x473b('0xa2'),_0x2a03fa[_0x473b('0x4c')],_0x2a03fa[_0x473b('0x5c')],_0x2a03fa[_0x473b('0x7f')]);}}}this[_0x473b('0x11')][_0x240c6c[_0x473b('0x4a')]]=_0x2a03fa;this[_0x473b('0x44')](_0x2a03fa,_0x473b('0x20'));}}}catch(_0x4e8a24){logger['error'](_0x473b('0x8d'),_0x240c6c[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x4e8a24,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x473b('0xa')]['syncVarSet']=function(_0x596924){try{if(this[_0x473b('0x66')](_0x596924)){logger[_0x473b('0x4f')]('[%s][voiceQueueReport][varset]',_0x596924[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x596924,{'showHidden':![],'depth':null}));this[_0x473b('0xa3')](_0x596924[_0x473b('0x4a')],_['keys'](_0x596924[_0x473b('0xa4')])[0x0],_0x596924[_0x473b('0xa5')]);if(this[_0x473b('0xf')][_0x596924[_0x473b('0x4a')]]){var _0x197461=_[_0x473b('0x79')](this['queueReports'][_0x596924[_0x473b('0x4a')]]);if(_0x197461){if(this['isNotNull'](_0x596924[_0x473b('0xa4')])&&this['isNotNull'](_0x596924[_0x473b('0xa4')][_0x473b('0xa6')])){switch(_0x596924['value']){case _0x473b('0xa7'):_0x197461[_0x473b('0x91')]=![];_0x197461[_0x473b('0x92')]=null;break;case'TIMEOUT':_0x197461[_0x473b('0xa8')]='timeout';_0x197461['queuecallerexit']=!![];_0x197461[_0x473b('0x92')]=moment()['format'](_0x473b('0x74'));_0x197461[_0x473b('0x86')]=moment()['format'](_0x473b('0x74'));logger[_0x473b('0x4f')](_0x473b('0xa9'),_0x596924[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x197461,{'showHidden':![],'depth':null}));ami[_0x473b('0x46')]('custom:timeout',_0x197461);break;default:_0x197461['queuecallerexit']=!![];_0x197461[_0x473b('0x92')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x197461[_0x473b('0x86')]=moment()['format'](_0x473b('0x74'));}_0x197461[_0x473b('0x8e')]=![];_0x197461['queuecallerabandonAt']=null;_0x197461[_0x473b('0x7f')]=_0x596924[_0x473b('0xa5')];this[_0x473b('0x11')][_0x596924[_0x473b('0x4a')]]=_0x197461;this[_0x473b('0x44')](_0x197461,_0x473b('0x22'));}else if(this['isNotNull'](_0x596924[_0x473b('0xa4')])&&this['isNotNull'](_0x596924[_0x473b('0xa4')][_0x473b('0xaa')])){if(!_0x197461[_0x473b('0x8e')]){_0x197461[_0x473b('0x91')]=!![];_0x197461[_0x473b('0x92')]=moment()[_0x473b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x197461['queuecallerexitreason']=_0x473b('0xab');_0x197461[_0x473b('0x86')]=moment()[_0x473b('0x4b')](_0x473b('0x74'));this[_0x473b('0x11')][_0x596924[_0x473b('0x4a')]]=_0x197461;}}logger[_0x473b('0x76')](_0x473b('0xac'),_0x596924[_0x473b('0x4a')],_0x197461['name'],_0x197461['type'],_[_0x473b('0xad')](_0x596924[_0x473b('0xa4')])[0x0],_0x596924[_0x473b('0xa5')]);_0x197461['variables']=this['variables'][_0x596924['uniqueid']];}}}}catch(_0x54666d){logger['error'](_0x473b('0xae'),_0x596924['uniqueid'],util[_0x473b('0x3f')](_0x54666d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x473b('0xa3')]=function(_0x2d693f,_0xf7c6a6,_0x41e71d){var _0x4c8c26=[_0x473b('0xaf'),_0x473b('0xb0'),_0x473b('0xb1'),_0x473b('0xb2'),_0x473b('0xb3'),_0x473b('0xb4'),_0x473b('0xb5'),'rtpaudioqosrttbridged','sipcallid',_0x473b('0xb6'),'bridgepeer',_0x473b('0xb7'),_0x473b('0xb8'),'memberdynamic','memberinterface',_0x473b('0xb9'),_0x473b('0x90'),'memberpenalty',_0x473b('0xba')];if(!_[_0x473b('0x36')](_0xf7c6a6)&&!_['includes'](_0x4c8c26,_0xf7c6a6)){if(_['isUndefined'](this[_0x473b('0x16')][_0x2d693f])){this['variables'][_0x2d693f]={};}this['variables'][_0x2d693f][_0xf7c6a6]=_0x41e71d;}};VoiceQueueReport[_0x473b('0xa')][_0x473b('0x24')]=function(_0x20a45){try{if(this[_0x473b('0x66')](_0x20a45)){logger[_0x473b('0x4f')](_0x473b('0xbb'),_0x20a45[_0x473b('0x4a')],util[_0x473b('0x3f')](_0x20a45,{'showHidden':![],'depth':null}));if(this[_0x473b('0xf')][_0x20a45['uniqueid']]){for(var _0x5af853=0x0,_0x339f9f={};_0x5af853=0x0?moment(_0x4f3df['endtime'])['diff'](_0x4f3df[_0xc106('0x17')],'seconds'):null,'data1':_0xc106('0x19'),'data2':_0x4f3df[_0xc106('0x12')],'data3':_0x4f3df[_0xc106('0x1a')],'data4':_0x4f3df[_0xc106('0x1b')]||null,'role':_0xc106('0x1c'),'internal':_0x4f3df[_0xc106('0x12')]?_[_0xc106('0x11')](_0x4f3df[_0xc106('0x12')]):undefined,'uniqueid':_0x4f3df[_0xc106('0x1d')]},'log':_0xc106('0x5')});}; \ No newline at end of file +var _0x0a6d=['voice','interface','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','agent','toNumber','moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport'];(function(_0x497df6,_0x4d0d21){var _0x59a708=function(_0x593ec9){while(--_0x593ec9){_0x497df6['push'](_0x497df6['shift']());}};_0x59a708(++_0x4d0d21);}(_0x0a6d,0x1f0));var _0xd0a6=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x0a6d[_0x1e4360];return _0x31e6b4;};'use strict';var moment=require(_0xd0a6('0x0'));var _=require('lodash');var util=require(_0xd0a6('0x1'));var client=require(_0xd0a6('0x2'));exports[_0xd0a6('0x3')]=function(_0x3e32d8){var _0x4bf823=_0x3e32d8[_0xd0a6('0x4')]||_0x3e32d8[_0xd0a6('0x5')];return client[_0xd0a6('0x6')](_0xd0a6('0x7'),{'body':{'channel':_0xd0a6('0x8'),'membername':_0x3e32d8['lastAssignedTo'],'interface':_['isNil'](_0x3e32d8[_0xd0a6('0x9')])?util['format']('SIP/%s',_0x3e32d8[_0xd0a6('0xa')]):_0x3e32d8[_0xd0a6('0x9')],'type':_0xd0a6('0xb'),'enterAt':_0x3e32d8[_0xd0a6('0xc')],'exitAt':_0x4bf823,'duration':moment(_0x4bf823)[_0xd0a6('0xd')](_0x3e32d8[_0xd0a6('0xc')],_0xd0a6('0xe')),'data1':_0xd0a6('0xf'),'data2':_0x3e32d8[_0xd0a6('0x10')],'data3':_0x3e32d8[_0xd0a6('0x11')],'data4':null,'data5':_0x3e32d8['queue'],'role':'agent','internal':_0x3e32d8['accountcode']?_['toNumber'](_0x3e32d8[_0xd0a6('0x12')]):undefined,'uniqueid':_0x3e32d8[_0xd0a6('0x13')]},'log':'CreateMemberReport'});};exports[_0xd0a6('0x14')]=function(_0xdf08e){return client[_0xd0a6('0x6')](_0xd0a6('0x7'),{'body':{'channel':_0xd0a6('0x8'),'membername':_0xdf08e[_0xd0a6('0x15')],'interface':_0xdf08e[_0xd0a6('0x9')],'type':'TALKING','enterAt':_0xdf08e[_0xd0a6('0x16')],'exitAt':_0xdf08e[_0xd0a6('0x17')],'duration':moment(_0xdf08e[_0xd0a6('0x17')])[_0xd0a6('0xd')](_0xdf08e['starttime'],_0xd0a6('0xe'))>=0x0?moment(_0xdf08e[_0xd0a6('0x17')])['diff'](_0xdf08e[_0xd0a6('0x16')],_0xd0a6('0xe')):null,'data1':_0xd0a6('0x18'),'data2':_0xdf08e[_0xd0a6('0x12')],'data3':_0xdf08e[_0xd0a6('0x11')],'data4':_0xdf08e[_0xd0a6('0x19')]||null,'role':_0xd0a6('0x1a'),'internal':_0xdf08e[_0xd0a6('0x12')]?_[_0xd0a6('0x1b')](_0xdf08e[_0xd0a6('0x12')]):undefined,'uniqueid':_0xdf08e['uniqueid']},'log':_0xd0a6('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 288aa36..b86b2fa 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 _0xc577=['stopRecordingOnTransfer','GetSettings','../client','ShowSetting'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc577,0x172));var _0x7c57=function(_0x5ca7b8,_0x1d8f03){_0x5ca7b8=_0x5ca7b8-0x0;var _0x58e84e=_0xc577[_0x5ca7b8];return _0x58e84e;};'use strict';var client=require(_0x7c57('0x0'));exports['getSettings']=function(){return client['Request'](_0x7c57('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7c57('0x2')]},'log':_0x7c57('0x3')});}; \ No newline at end of file +var _0x7d71=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7d71,0x192));var _0x17d7=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x7d71[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require(_0x17d7('0x0'));exports[_0x17d7('0x1')]=function(){return client[_0x17d7('0x2')](_0x17d7('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x17d7('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 83c0406..1ca9def 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 _0xe4de=['html','../client','getTemplates','GetTemplate','name'];(function(_0x2269f9,_0x1567a1){var _0x1ff782=function(_0x2a251f){while(--_0x2a251f){_0x2269f9['push'](_0x2269f9['shift']());}};_0x1ff782(++_0x1567a1);}(_0xe4de,0x16e));var _0xee4d=function(_0x254d58,_0x523d76){_0x254d58=_0x254d58-0x0;var _0x504e87=_0xe4de[_0x254d58];return _0x504e87;};'use strict';var client=require(_0xee4d('0x0'));exports[_0xee4d('0x1')]=function(_0x2bfbac){return function(_0x153803){return client['Request'](_0xee4d('0x2'),{'options':{'raw':!![],'attributes':['id',_0xee4d('0x3'),_0xee4d('0x4')]},'log':_0xee4d('0x2')});};}; \ No newline at end of file +var _0x06a0=['html','../client','GetTemplate','name'];(function(_0x56caae,_0x5687f7){var _0x498cd2=function(_0x3abab){while(--_0x3abab){_0x56caae['push'](_0x56caae['shift']());}};_0x498cd2(++_0x5687f7);}(_0x06a0,0x1e1));var _0x006a=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x06a0[_0x602ca8];return _0x26e8ab;};'use strict';var client=require(_0x006a('0x0'));exports['getTemplates']=function(_0x28f9a0){return function(_0x4cb795){return client['Request'](_0x006a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x006a('0x2'),_0x006a('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 11fd960..635b8a9 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 _0xa9c3=['data5','data6','data7','../client','GetTrigger','name','channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','action','data1','data3','data4'];(function(_0x168576,_0x2773c5){var _0x98b580=function(_0x28ea69){while(--_0x28ea69){_0x168576['push'](_0x168576['shift']());}};_0x98b580(++_0x2773c5);}(_0xa9c3,0x157));var _0x3a9c=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xa9c3[_0x39e283];return _0x7de89f;};'use strict';var client=require(_0x3a9c('0x0'));exports['getTriggers']=function(_0x37717d){return function(_0x190f81){return client['Request'](_0x3a9c('0x1'),{'options':{'raw':![],'attributes':['id',_0x3a9c('0x2'),_0x3a9c('0x3'),_0x3a9c('0x4')],'include':[{'model':_0x3a9c('0x5'),'as':_0x3a9c('0x6'),'attributes':['id',_0x3a9c('0x7'),'operator',_0x3a9c('0x8')]},{'model':_0x3a9c('0x5'),'as':_0x3a9c('0x9'),'attributes':['id','field',_0x3a9c('0xa'),_0x3a9c('0x8')]},{'model':_0x3a9c('0xb'),'as':_0x3a9c('0xc'),'attributes':['id',_0x3a9c('0xd'),_0x3a9c('0xe'),'data2',_0x3a9c('0xf'),_0x3a9c('0x10'),_0x3a9c('0x11'),_0x3a9c('0x12'),_0x3a9c('0x13')]}]},'log':_0x3a9c('0x1')});};}; \ No newline at end of file +var _0x263d=['data6','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator','value','action','data1','data2','data3','data4','data5'];(function(_0x13cef3,_0x4c96b7){var _0x4b79d8=function(_0x40f3e3){while(--_0x40f3e3){_0x13cef3['push'](_0x13cef3['shift']());}};_0x4b79d8(++_0x4c96b7);}(_0x263d,0xb6));var _0xd263=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x263d[_0x2bbc07];return _0x6879e4;};'use strict';var client=require(_0xd263('0x0'));exports[_0xd263('0x1')]=function(_0x4c04d3){return function(_0x328e6d){return client[_0xd263('0x2')](_0xd263('0x3'),{'options':{'raw':![],'attributes':['id',_0xd263('0x4'),'channel','status'],'include':[{'model':_0xd263('0x5'),'as':_0xd263('0x6'),'attributes':['id',_0xd263('0x7'),_0xd263('0x8'),_0xd263('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0xd263('0x7'),_0xd263('0x8'),'value']},{'model':'Action','as':'Actions','attributes':['id',_0xd263('0xa'),_0xd263('0xb'),_0xd263('0xc'),_0xd263('0xd'),_0xd263('0xe'),_0xd263('0xf'),_0xd263('0x10'),_0xd263('0x11')]}]},'log':_0xd263('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index da33412..374041a 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 _0x4119=['Request','GetTrunk','registry','defaultuser','../client','getTrunks'];(function(_0x2ef1ea,_0x4c4874){var _0x950c06=function(_0x103f58){while(--_0x103f58){_0x2ef1ea['push'](_0x2ef1ea['shift']());}};_0x950c06(++_0x4c4874);}(_0x4119,0xfa));var _0x9411=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x4119[_0x4e1d03];return _0x362d4b;};'use strict';var client=require(_0x9411('0x0'));exports[_0x9411('0x1')]=function(_0x6cbb18){return function(_0x242e9b){return client[_0x9411('0x2')](_0x9411('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x9411('0x4'),_0x9411('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xf6da=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xf6da,0x65));var _0xaf6d=function(_0x2f5ac2,_0x189d01){_0x2f5ac2=_0x2f5ac2-0x0;var _0x27bda1=_0xf6da[_0x2f5ac2];return _0x27bda1;};'use strict';var client=require(_0xaf6d('0x0'));exports[_0xaf6d('0x1')]=function(_0x2627a6){return function(_0x504dd6){return client[_0xaf6d('0x2')](_0xaf6d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x5'),_0xaf6d('0x6')]},'log':_0xaf6d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d8759f4..a12afc5 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x500157,_0x5d8120){var _0x3c6982=function(_0x40e5fc){while(--_0x40e5fc){_0x500157['push'](_0x500157['shift']());}};_0x3c6982(++_0x5d8120);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d3f5e77..4bdd7af 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 _0xf4e3=['../client','create','Request','update','UpdateVoiceAgentReport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf4e3,0xaf));var _0x3f4e=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0xf4e3[_0x3f3bad];return _0x4f0801;};'use strict';var client=require(_0x3f4e('0x0'));exports[_0x3f4e('0x1')]=function(_0xebd50d){return client[_0x3f4e('0x2')]('CreateVoiceAgentReport',{'body':_0xebd50d,'log':'CreateVoiceAgentReport'});};exports[_0x3f4e('0x3')]=function(_0x97dc1f,_0x8e9e1e,_0x2fc150){return client[_0x3f4e('0x2')]('UpdateVoiceAgentReport',{'body':_0x97dc1f,'options':{'where':{'uniqueid':_0x8e9e1e,'interface':_0x2fc150,'agentcomplete':!![]}},'log':_0x3f4e('0x4')});}; \ No newline at end of file +var _0xef9b=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0xe0c77,_0x23e75f){var _0x2bd5e5=function(_0x54d9d2){while(--_0x54d9d2){_0xe0c77['push'](_0xe0c77['shift']());}};_0x2bd5e5(++_0x23e75f);}(_0xef9b,0x18a));var _0xbef9=function(_0x397fb2,_0x44bda0){_0x397fb2=_0x397fb2-0x0;var _0x855cfc=_0xef9b[_0x397fb2];return _0x855cfc;};'use strict';var client=require(_0xbef9('0x0'));exports[_0xbef9('0x1')]=function(_0x3de8f7){return client[_0xbef9('0x2')](_0xbef9('0x3'),{'body':_0x3de8f7,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x24de0d,_0x2a1811,_0x2e275d){return client[_0xbef9('0x2')](_0xbef9('0x4'),{'body':_0x24de0d,'options':{'where':{'uniqueid':_0x2a1811,'interface':_0x2e275d,'agentcomplete':!![]}},'log':_0xbef9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 5ffec09..0558f49 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 _0x6c03=['CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request'];(function(_0x579028,_0x3b654f){var _0x3c070c=function(_0x1ec3a0){while(--_0x1ec3a0){_0x579028['push'](_0x579028['shift']());}};_0x3c070c(++_0x3b654f);}(_0x6c03,0x1ca));var _0x36c0=function(_0x1344c9,_0x1fffa1){_0x1344c9=_0x1344c9-0x0;var _0x7a5c45=_0x6c03[_0x1344c9];return _0x7a5c45;};'use strict';var moment=require('moment');var util=require(_0x36c0('0x0'));var _=require(_0x36c0('0x1'));var client=require(_0x36c0('0x2'));exports['create']=function(_0x10c8ab){return client[_0x36c0('0x3')](_0x36c0('0x4'),{'body':_[_0x36c0('0x5')](_0x10c8ab,{'source':_0x10c8ab['calleridnum'],'destinationcontext':_0x10c8ab[_0x36c0('0x6')],'callerid':_0x10c8ab[_0x36c0('0x7')],'amaflags':_0x36c0('0x8')}),'log':_0x36c0('0x4')});};exports[_0x36c0('0x9')]=function(){return function(){return client[_0x36c0('0x3')](_0x36c0('0xa'),{'options':{'where':{'type':[_0x36c0('0xb')],'createdAt':{'$between':[moment()[_0x36c0('0xc')](_0x36c0('0xd'))[_0x36c0('0xe')](_0x36c0('0xf')),moment()[_0x36c0('0x10')](_0x36c0('0xd'))[_0x36c0('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x36c0('0x11'),_0x36c0('0x12'),_0x36c0('0x13')]},'log':_0x36c0('0x14')});};}; \ No newline at end of file +var _0xdb67=['merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x47a884,_0x5f2e4e){var _0x296907=function(_0x5d3690){while(--_0x5d3690){_0x47a884['push'](_0x47a884['shift']());}};_0x296907(++_0x5f2e4e);}(_0xdb67,0xd7));var _0x7db6=function(_0x165122,_0x52f8b1){_0x165122=_0x165122-0x0;var _0x4695bd=_0xdb67[_0x165122];return _0x4695bd;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x7db6('0x0'));var client=require(_0x7db6('0x1'));exports[_0x7db6('0x2')]=function(_0x2bdda5){return client[_0x7db6('0x3')](_0x7db6('0x4'),{'body':_[_0x7db6('0x5')](_0x2bdda5,{'source':_0x2bdda5['calleridnum'],'destinationcontext':_0x2bdda5[_0x7db6('0x6')],'callerid':_0x2bdda5[_0x7db6('0x7')],'amaflags':_0x7db6('0x8')}),'log':_0x7db6('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x7db6('0x9'),{'options':{'where':{'type':[_0x7db6('0xa')],'createdAt':{'$between':[moment()['startOf']('day')[_0x7db6('0xb')](_0x7db6('0xc')),moment()[_0x7db6('0xd')](_0x7db6('0xe'))[_0x7db6('0xb')](_0x7db6('0xc'))]}},'attributes':[_0x7db6('0xf'),_0x7db6('0x10'),_0x7db6('0x11'),_0x7db6('0x12')]},'log':_0x7db6('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index df15a9a..545da8b 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 _0x692b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x11c426,_0x1c4524){var _0x569cf0=function(_0xcbfc93){while(--_0xcbfc93){_0x11c426['push'](_0x11c426['shift']());}};_0x569cf0(++_0x1c4524);}(_0x692b,0x140));var _0xb692=function(_0xd02525,_0xfe860d){_0xd02525=_0xd02525-0x0;var _0xb1b8b6=_0x692b[_0xd02525];return _0xb1b8b6;};'use strict';var client=require(_0xb692('0x0'));exports[_0xb692('0x1')]=function(_0x58747c){return client[_0xb692('0x2')](_0xb692('0x3'),{'body':_0x58747c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x7190=['CreateVoiceDialReport','../client'];(function(_0x303d97,_0x5aa0c3){var _0x588e02=function(_0x16d76a){while(--_0x16d76a){_0x303d97['push'](_0x303d97['shift']());}};_0x588e02(++_0x5aa0c3);}(_0x7190,0x131));var _0x0719=function(_0x5bd641,_0x8d76a2){_0x5bd641=_0x5bd641-0x0;var _0x48a95d=_0x7190[_0x5bd641];return _0x48a95d;};'use strict';var client=require(_0x0719('0x0'));exports['create']=function(_0x5c1917){return client['Request'](_0x0719('0x1'),{'body':_0x5c1917,'log':_0x0719('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6d8a8be..17e7f5c 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 _0xcd60=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x4d24f5,_0x2b0651){var _0x517ae3=function(_0x3a0ba9){while(--_0x3a0ba9){_0x4d24f5['push'](_0x4d24f5['shift']());}};_0x517ae3(++_0x2b0651);}(_0xcd60,0xf0));var _0x0cd6=function(_0x104d03,_0x42f3f4){_0x104d03=_0x104d03-0x0;var _0x4ae03e=_0xcd60[_0x104d03];return _0x4ae03e;};'use strict';var client=require(_0x0cd6('0x0'));exports[_0x0cd6('0x1')]=function(){return function(){return client[_0x0cd6('0x2')](_0x0cd6('0x3'),{'options':{'raw':!![],'attributes':['id',_0x0cd6('0x4'),_0x0cd6('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x0cd6('0x1')});};}; \ No newline at end of file +var _0x0427=['GetVoiceExtension','recordingFormat','getVoiceExtensions','Request'];(function(_0x3137e7,_0x40d656){var _0x5a5f59=function(_0x12230f){while(--_0x12230f){_0x3137e7['push'](_0x3137e7['shift']());}};_0x5a5f59(++_0x40d656);}(_0x0427,0x137));var _0x7042=function(_0x3bb10e,_0x596324){_0x3bb10e=_0x3bb10e-0x0;var _0x46bf54=_0x0427[_0x3bb10e];return _0x46bf54;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x7042('0x0')](_0x7042('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x7042('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x7042('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b2fa745..b35cf2f 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 _0xc9c3=['dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialPowerLevel'];(function(_0x72033a,_0x9c346){var _0x335981=function(_0x51ec8d){while(--_0x51ec8d){_0x72033a['push'](_0x72033a['shift']());}};_0x335981(++_0x9c346);}(_0xc9c3,0x96));var _0x3c9c=function(_0x3fc8ea,_0x32338f){_0x3fc8ea=_0x3fc8ea-0x0;var _0x5231d4=_0xc9c3[_0x3fc8ea];return _0x5231d4;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x3c9c('0x0')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3c9c('0x1'),_0x3c9c('0x2'),_0x3c9c('0x3'),_0x3c9c('0x4'),_0x3c9c('0x5'),_0x3c9c('0x6'),_0x3c9c('0x7'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x3c9c('0x8'),_0x3c9c('0x9'),_0x3c9c('0xa'),_0x3c9c('0xb'),_0x3c9c('0xc'),_0x3c9c('0xd'),_0x3c9c('0xe'),_0x3c9c('0xf'),_0x3c9c('0x10'),_0x3c9c('0x11'),'dialCongestionMaxRetry',_0x3c9c('0x12'),_0x3c9c('0x13'),'dialBusyRetryFrequency',_0x3c9c('0x14'),'dialNoAnswerRetryFrequency',_0x3c9c('0x15'),_0x3c9c('0x16'),_0x3c9c('0x17'),_0x3c9c('0x18'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0x3c9c('0x19'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x3c9c('0x1a'),'dialAMDMaximumNumberOfWords',_0x3c9c('0x1b'),_0x3c9c('0x1c'),_0x3c9c('0x1d'),_0x3c9c('0x1e'),'dialRecallInQueue',_0x3c9c('0x1f'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2',_0x3c9c('0x5'),_0x3c9c('0x20'),_0x3c9c('0x21'),_0x3c9c('0x22'),_0x3c9c('0x23'),_0x3c9c('0x24'),_0x3c9c('0x25'),'dialDropRetryFrequency',_0x3c9c('0x26'),'dialAbandonedRetryFrequency',_0x3c9c('0x27'),'dialMachineRetryFrequency',_0x3c9c('0x28'),_0x3c9c('0x29'),'mandatoryDisposition',_0x3c9c('0x2a'),_0x3c9c('0x2b'),_0x3c9c('0x2c')],'include':[{'model':'Trunk','as':_0x3c9c('0x2d'),'attributes':['id',_0x3c9c('0x1'),_0x3c9c('0x2e'),_0x3c9c('0x2f')]},{'model':_0x3c9c('0x30'),'as':_0x3c9c('0x31'),'attributes':['id',_0x3c9c('0x1')]},{'model':_0x3c9c('0x2d'),'as':'TrunkBackup','attributes':['id',_0x3c9c('0x1'),'callerid',_0x3c9c('0x2f')]},{'model':_0x3c9c('0x32'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x3c9c('0x32'),'as':_0x3c9c('0x33'),'attributes':['id',_0x3c9c('0x1'),_0x3c9c('0x34')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xa498=['getVoiceQueues','Request','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client'];(function(_0x7a09f1,_0x2dde5a){var _0x267ef6=function(_0x3a6e19){while(--_0x3a6e19){_0x7a09f1['push'](_0x7a09f1['shift']());}};_0x267ef6(++_0x2dde5a);}(_0xa498,0x179));var _0x8a49=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xa498[_0x548d7d];return _0xb1c878;};'use strict';var client=require(_0x8a49('0x0'));exports[_0x8a49('0x1')]=function(){return function(){return client[_0x8a49('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8a49('0x3'),_0x8a49('0x4'),'acwTimeout',_0x8a49('0x5'),_0x8a49('0x6'),_0x8a49('0x7'),_0x8a49('0x8'),_0x8a49('0x9'),_0x8a49('0xa'),'dialLimitQueue',_0x8a49('0xb'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x8a49('0xc'),_0x8a49('0xd'),_0x8a49('0xe'),_0x8a49('0xf'),_0x8a49('0x10'),_0x8a49('0x11'),'dialQueueProject',_0x8a49('0x12'),_0x8a49('0x13'),_0x8a49('0x14'),_0x8a49('0x15'),_0x8a49('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0x8a49('0x17'),'dialPrefix',_0x8a49('0x18'),'dialAMDActive','dialAMDInitialSilence',_0x8a49('0x19'),_0x8a49('0x1a'),'dialAMDTotalAnalysisTime',_0x8a49('0x1b'),_0x8a49('0x1c'),'dialAMDMaximumNumberOfWords',_0x8a49('0x1d'),_0x8a49('0x1e'),'timeout',_0x8a49('0x1f'),'dialRecallInQueue',_0x8a49('0x20'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2',_0x8a49('0x6'),_0x8a49('0x21'),'dialRandomLastDigitCallerIdNumber',_0x8a49('0x22'),_0x8a49('0x23'),_0x8a49('0x24'),_0x8a49('0x25'),_0x8a49('0x26'),_0x8a49('0x27'),'dialAbandonedRetryFrequency',_0x8a49('0x28'),'dialMachineRetryFrequency',_0x8a49('0x29'),_0x8a49('0x2a'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x8a49('0x2b'),_0x8a49('0x2c')],'include':[{'model':_0x8a49('0x2d'),'as':_0x8a49('0x2d'),'attributes':['id',_0x8a49('0x3'),'callerid',_0x8a49('0x2e')]},{'model':_0x8a49('0x2f'),'as':_0x8a49('0x30'),'attributes':['id',_0x8a49('0x3')]},{'model':_0x8a49('0x2d'),'as':_0x8a49('0x31'),'attributes':['id',_0x8a49('0x3'),_0x8a49('0x32'),_0x8a49('0x2e')]},{'model':_0x8a49('0x33'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x8a49('0x33'),'as':_0x8a49('0x34'),'attributes':['id','name',_0x8a49('0x35')]}]}]},'log':_0x8a49('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 39b063e..29061d2 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(_0x208ef8,_0x17d761){var _0x153635=function(_0x3fba35){while(--_0x3fba35){_0x208ef8['push'](_0x208ef8['shift']());}};_0x153635(++_0x17d761);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x5049ea,_0x4452a4){var _0x45ba00=function(_0x5a02d5){while(--_0x5a02d5){_0x5049ea['push'](_0x5049ea['shift']());}};_0x45ba00(++_0x4452a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 dd51c53..38bbf47 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 _0x7453=['../client','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x2a747c,_0x23e7a0){var _0x298e92=function(_0x5daa5c){while(--_0x5daa5c){_0x2a747c['push'](_0x2a747c['shift']());}};_0x298e92(++_0x23e7a0);}(_0x7453,0xe7));var _0x3745=function(_0x327d23,_0x58cdfa){_0x327d23=_0x327d23-0x0;var _0x5f57fd=_0x7453[_0x327d23];return _0x5f57fd;};'use strict';var client=require(_0x3745('0x0'));exports['getVoiceQueueRtPauses']=function(_0x219817){return function(){return client['Request'](_0x3745('0x1'),{'options':{'where':{'VoiceQueueId':_0x219817,'paused':!![]},'raw':!![]},'log':_0x3745('0x2')});};}; \ No newline at end of file +var _0x52d1=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x478481,_0x27d2a2){var _0x32bcf3=function(_0x106eba){while(--_0x106eba){_0x478481['push'](_0x478481['shift']());}};_0x32bcf3(++_0x27d2a2);}(_0x52d1,0x143));var _0x152d=function(_0x569e57,_0x2dca5f){_0x569e57=_0x569e57-0x0;var _0x3c9dd0=_0x52d1[_0x569e57];return _0x3c9dd0;};'use strict';var client=require(_0x152d('0x0'));exports['getVoiceQueueRtPauses']=function(_0xff36e1){return function(){return client['Request'](_0x152d('0x1'),{'options':{'where':{'VoiceQueueId':_0xff36e1,'paused':!![]},'raw':!![]},'log':_0x152d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7c12b9a..4d4f805 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3fd2c8,_0x1d359){var _0x39e288=function(_0x8c9078){while(--_0x8c9078){_0x3fd2c8['push'](_0x3fd2c8['shift']());}};_0x39e288(++_0x1d359);}(_0x7a54,0x106));var _0x47a5=function(_0xa4c17e,_0x3bfba4){_0xa4c17e=_0xa4c17e-0x0;var _0x16c4d8=_0x7a54[_0xa4c17e];return _0x16c4d8;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x566f17,_0x214c26){var _0x159aac=function(_0x1c2e6f){while(--_0x1c2e6f){_0x566f17['push'](_0x566f17['shift']());}};_0x159aac(++_0x214c26);}(_0x7a54,0x106));var _0x47a5=function(_0xb0333,_0x581c57){_0xb0333=_0xb0333-0x0;var _0x329ae2=_0x7a54[_0xb0333];return _0x329ae2;};'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 efca37d..e08333d 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 _0x6f60=['blindTransfer','Request','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f60,0xcb));var _0x06f6=function(_0x2f7a26,_0x1a2da0){_0x2f7a26=_0x2f7a26-0x0;var _0x2e1d68=_0x6f60[_0x2f7a26];return _0x2e1d68;};'use strict';var client=require(_0x06f6('0x0'));exports[_0x06f6('0x1')]={};exports[_0x06f6('0x2')]=function(_0x4e342b){return client[_0x06f6('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x4e342b[_0x06f6('0x4')],'transfererchannel':_0x4e342b[_0x06f6('0x5')],'transferercalleridnum':_0x4e342b['transferercalleridnum'],'transferercalleridname':_0x4e342b[_0x06f6('0x6')],'transfererconnectedlinenum':_0x4e342b[_0x06f6('0x7')],'transfererconnectedlinename':_0x4e342b[_0x06f6('0x8')],'transfereraccountcode':_0x4e342b['transfereraccountcode'],'transferercontext':_0x4e342b[_0x06f6('0x9')],'transfererexten':_0x4e342b[_0x06f6('0xa')],'transfererlinkedid':_0x4e342b[_0x06f6('0xb')],'transfereechannel':_0x4e342b['transfereechannel'],'transfereecalleridnum':_0x4e342b['transfereecalleridnum'],'transfereecalleridname':_0x4e342b['transfereecalleridname'],'transfereeconnectedlinenum':_0x4e342b[_0x06f6('0xc')],'transfereeconnectedlinename':_0x4e342b[_0x06f6('0xd')],'transfereeaccountcode':_0x4e342b[_0x06f6('0xe')],'transfereecontext':_0x4e342b[_0x06f6('0xf')],'transfereeexten':_0x4e342b[_0x06f6('0x10')],'transfereelinkedid':_0x4e342b[_0x06f6('0x11')],'isexternal':_0x4e342b[_0x06f6('0x12')],'context':_0x4e342b[_0x06f6('0x13')],'extension':_0x4e342b[_0x06f6('0x14')],'type':_0x06f6('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x06f6('0x16')]=function(_0x2f715a){return client[_0x06f6('0x3')](_0x06f6('0x17'),{'body':{'result':_0x2f715a[_0x06f6('0x4')],'transfererchannel':_0x2f715a[_0x06f6('0x18')],'transferercalleridnum':_0x2f715a[_0x06f6('0x19')],'transferercalleridname':_0x2f715a['origtransferercalleridname'],'transfererconnectedlinenum':_0x2f715a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2f715a[_0x06f6('0x1a')],'transfereraccountcode':_0x2f715a[_0x06f6('0x1b')],'transferercontext':_0x2f715a[_0x06f6('0x1c')],'transfererexten':_0x2f715a[_0x06f6('0x1d')],'transfererlinkedid':_0x2f715a[_0x06f6('0x1e')],'transfereechannel':_0x2f715a[_0x06f6('0x1f')],'transfereecalleridnum':_0x2f715a['transfertargetcalleridnum'],'transfereecalleridname':_0x2f715a[_0x06f6('0x20')],'transfereeconnectedlinenum':_0x2f715a[_0x06f6('0x21')],'transfereeconnectedlinename':_0x2f715a[_0x06f6('0x22')],'transfereeaccountcode':_0x2f715a[_0x06f6('0x23')],'transfereecontext':_0x2f715a[_0x06f6('0x24')],'transfereeexten':_0x2f715a[_0x06f6('0x25')],'transfereelinkedid':_0x2f715a['transfertargetlinkedid'],'isexternal':_0x2f715a[_0x06f6('0x12')],'context':_0x2f715a[_0x06f6('0x26')],'extension':_0x2f715a[_0x06f6('0x27')],'type':_0x06f6('0x28')},'log':_0x06f6('0x17')});}; \ No newline at end of file +var _0x7036=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x372365,_0x48928a){var _0x35a929=function(_0x25d382){while(--_0x25d382){_0x372365['push'](_0x372365['shift']());}};_0x35a929(++_0x48928a);}(_0x7036,0x85));var _0x6703=function(_0x5c6189,_0x5875f4){_0x5c6189=_0x5c6189-0x0;var _0xad0917=_0x7036[_0x5c6189];return _0xad0917;};'use strict';var client=require(_0x6703('0x0'));exports[_0x6703('0x1')]={};exports[_0x6703('0x2')]=function(_0x19f762){return client[_0x6703('0x3')](_0x6703('0x4'),{'body':{'result':_0x19f762[_0x6703('0x5')],'transfererchannel':_0x19f762[_0x6703('0x6')],'transferercalleridnum':_0x19f762[_0x6703('0x7')],'transferercalleridname':_0x19f762[_0x6703('0x8')],'transfererconnectedlinenum':_0x19f762[_0x6703('0x9')],'transfererconnectedlinename':_0x19f762['transfererconnectedlinename'],'transfereraccountcode':_0x19f762[_0x6703('0xa')],'transferercontext':_0x19f762[_0x6703('0xb')],'transfererexten':_0x19f762[_0x6703('0xc')],'transfererlinkedid':_0x19f762['transfererlinkedid'],'transfereechannel':_0x19f762[_0x6703('0xd')],'transfereecalleridnum':_0x19f762['transfereecalleridnum'],'transfereecalleridname':_0x19f762['transfereecalleridname'],'transfereeconnectedlinenum':_0x19f762[_0x6703('0xe')],'transfereeconnectedlinename':_0x19f762[_0x6703('0xf')],'transfereeaccountcode':_0x19f762['transfereeaccountcode'],'transfereecontext':_0x19f762[_0x6703('0x10')],'transfereeexten':_0x19f762[_0x6703('0x11')],'transfereelinkedid':_0x19f762['transfereelinkedid'],'isexternal':_0x19f762[_0x6703('0x12')],'context':_0x19f762[_0x6703('0x13')],'extension':_0x19f762[_0x6703('0x14')],'type':_0x6703('0x15')},'log':_0x6703('0x4')});};exports[_0x6703('0x16')]=function(_0x4cbabe){return client[_0x6703('0x3')](_0x6703('0x4'),{'body':{'result':_0x4cbabe['result'],'transfererchannel':_0x4cbabe['origtransfererchannel'],'transferercalleridnum':_0x4cbabe[_0x6703('0x17')],'transferercalleridname':_0x4cbabe[_0x6703('0x18')],'transfererconnectedlinenum':_0x4cbabe[_0x6703('0x19')],'transfererconnectedlinename':_0x4cbabe['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4cbabe[_0x6703('0x1a')],'transferercontext':_0x4cbabe[_0x6703('0x1b')],'transfererexten':_0x4cbabe[_0x6703('0x1c')],'transfererlinkedid':_0x4cbabe[_0x6703('0x1d')],'transfereechannel':_0x4cbabe['transfertargetchannel'],'transfereecalleridnum':_0x4cbabe[_0x6703('0x1e')],'transfereecalleridname':_0x4cbabe[_0x6703('0x1f')],'transfereeconnectedlinenum':_0x4cbabe[_0x6703('0x20')],'transfereeconnectedlinename':_0x4cbabe[_0x6703('0x21')],'transfereeaccountcode':_0x4cbabe[_0x6703('0x22')],'transfereecontext':_0x4cbabe['transfertargetcontext'],'transfereeexten':_0x4cbabe[_0x6703('0x23')],'transfereelinkedid':_0x4cbabe[_0x6703('0x24')],'isexternal':_0x4cbabe[_0x6703('0x12')],'context':_0x4cbabe[_0x6703('0x25')],'extension':_0x4cbabe[_0x6703('0x26')],'type':_0x6703('0x27')},'log':_0x6703('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7115cd7..7dcd5cc 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 _0x4ccb=['../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','asterisk','username','join','pick','keys','module','action','Action','then','catch','error','message','isConnected','ami\x20disconnected','command','Command','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','length','find','omit','undefined','values','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','MixMonitor','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','StopMixMonitor','destinationchannel','status','stop','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','bluebird','moment'];(function(_0x6deca6,_0x3bee96){var _0x252f03=function(_0x383252){while(--_0x383252){_0x6deca6['push'](_0x6deca6['shift']());}};_0x252f03(++_0x3bee96);}(_0x4ccb,0x196));var _0xb4cc=function(_0x10742b,_0x1b9660){_0x10742b=_0x10742b-0x0;var _0x50f940=_0x4ccb[_0x10742b];return _0x50f940;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var jayson=require(_0xb4cc('0x2'));var schema=require('validate');var BPromise=require(_0xb4cc('0x3'));var moment=require(_0xb4cc('0x4'));var config=require('../../../config/environment');var properties=require(_0xb4cc('0x5'));var ami=require(_0xb4cc('0x6'));exports[_0xb4cc('0x7')]=function(_0x4cad3f,_0x1ae040,_0x2181b2){return new BPromise(function(_0x1e19dd,_0x5c0bdd){var _0x370b12={'QueuePause':function(_0x6ba3bf){return new Promise(function(_0x2129ef,_0x5327a4){var _0x7e4460=util[_0xb4cc('0x8')](_0xb4cc('0x9'),_0xb4cc('0xa'),_0x6ba3bf[_0xb4cc('0xb')]);if(_0x4cad3f['timers']&&_0x4cad3f[_0xb4cc('0xc')][_0x7e4460]&&_0x4cad3f[_0xb4cc('0xc')][_0x7e4460]['timer']){_0x4cad3f[_0xb4cc('0xc')][_0x7e4460]['updateAcw']();}if(_0x4cad3f[_0xb4cc('0xd')][_0x7e4460]){_0x4cad3f[_0xb4cc('0xd')][_0x7e4460][_0xb4cc('0xe')]({'statePause':_0x6ba3bf['pause']?!![]:![]});}_0x2129ef({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x205a03){var _0x502f96=this;return new Promise(function(_0x5cf92a,_0x1b10ae){if(ami['isConnected']()==![]){return _0x1b10ae(_0x502f96['error'](0x1f4,[config[_0xb4cc('0xf')]['ip'],config[_0xb4cc('0xf')][_0xb4cc('0x10')],'ami\x20disconnected'][_0xb4cc('0x11')]('\x20')));}_0x205a03=_[_0xb4cc('0x12')](_0x205a03,_[_0xb4cc('0x13')](properties[_0xb4cc('0x14')]));_0x205a03[_0xb4cc('0x15')]='Reload';return ami[_0xb4cc('0x16')](_0x205a03)[_0xb4cc('0x17')](function(_0x27617c){_0x5cf92a({'code':0xc8,'message':_0x27617c['message']});})[_0xb4cc('0x18')](function(_0x14d8b6){_0x1b10ae(_0x502f96[_0xb4cc('0x19')](0x1f5,_0x14d8b6[_0xb4cc('0x1a')]));});});},'Command':function(_0xa99916){var _0x5cfc7d=this;return new Promise(function(_0x242272,_0x20b08f){if(ami[_0xb4cc('0x1b')]()==![]){return _0x20b08f(_0x5cfc7d[_0xb4cc('0x19')](0x1f4,[config[_0xb4cc('0xf')]['ip'],config['asterisk'][_0xb4cc('0x10')],_0xb4cc('0x1c')][_0xb4cc('0x11')]('\x20')));}_0xa99916=_[_0xb4cc('0x12')](_0xa99916,_0xb4cc('0x1d'));_0xa99916['action']=_0xb4cc('0x1e');return ami[_0xb4cc('0x16')](_0xa99916)[_0xb4cc('0x17')](function(_0xaf11df){_0x242272({'code':0xc8,'message':_0xaf11df['content']});})['catch'](function(_0x3dd7ef){_0x20b08f(_0x5cfc7d[_0xb4cc('0x19')](0x1f5,_0x3dd7ef['message']));});});},'VoiceQueues':function(_0x5b4a17){return new Promise(function(_0x1f1809,_0xeb25e1){var _0x2ee2d3=[];for(var _0x154002 in _0x4cad3f['voiceQueues']){if(_0x4cad3f['voiceQueues'][_0xb4cc('0x1f')](_0x154002)){var _0x4f47ed=_0x4cad3f[_0xb4cc('0x20')][_0x154002];var _0x195aa8={'id':_0x4f47ed['id'],'name':_0x4f47ed[_0xb4cc('0xb')],'strategy':_0x4f47ed[_0xb4cc('0x21')],'answered':_0x4f47ed[_0xb4cc('0x22')],'available':_0x4f47ed[_0xb4cc('0x23')],'loggedIn':_0x4f47ed[_0xb4cc('0x24')],'pTalking':_0x4f47ed[_0xb4cc('0x25')],'sumBillable':_0x4f47ed[_0xb4cc('0x26')],'sumDuration':_0x4f47ed['sumDuration'],'sumHoldTime':_0x4f47ed[_0xb4cc('0x27')]||0x0,'talking':_0x4f47ed[_0xb4cc('0x28')],'total':_0x4f47ed[_0xb4cc('0x29')],'type':_0x4f47ed[_0xb4cc('0x2a')],'unmanaged':_0x4f47ed[_0xb4cc('0x2b')],'abandoned':_0x4f47ed['abandoned'],'waiting':_0x4f47ed[_0xb4cc('0x2c')],'loggedInDb':_0x4f47ed[_0xb4cc('0x2d')]};if(_0x4f47ed[_0xb4cc('0x2a')]===_0xb4cc('0x2e')){_0x195aa8['dialActive']=_0x4f47ed[_0xb4cc('0x2f')];_0x195aa8[_0xb4cc('0x30')]=_0x4f47ed['dialMethod'];_0x195aa8[_0xb4cc('0x31')]=_0x4f47ed[_0xb4cc('0x31')];_0x195aa8['dialOriginateCallerIdNumber']=_0x4f47ed[_0xb4cc('0x32')];_0x195aa8[_0xb4cc('0x33')]=_0x4f47ed[_0xb4cc('0x33')];_0x195aa8[_0xb4cc('0x34')]=_0x4f47ed[_0xb4cc('0x34')];_0x195aa8[_0xb4cc('0x35')]=_0x4f47ed[_0xb4cc('0x35')];_0x195aa8[_0xb4cc('0x36')]=_0x4f47ed[_0xb4cc('0x36')];_0x195aa8['outboundAnswerCallsDay']=_0x4f47ed['outboundAnswerCallsDay'];_0x195aa8[_0xb4cc('0x37')]=_0x4f47ed[_0xb4cc('0x37')];_0x195aa8[_0xb4cc('0x38')]=_0x4f47ed[_0xb4cc('0x38')];_0x195aa8[_0xb4cc('0x39')]=_0x4f47ed['outboundCongestionCallsDay'];_0x195aa8[_0xb4cc('0x3a')]=_0x4f47ed[_0xb4cc('0x3a')];_0x195aa8[_0xb4cc('0x3b')]=_0x4f47ed['outboundDropCallsDayCallersExit'];_0x195aa8[_0xb4cc('0x3c')]=_0x4f47ed[_0xb4cc('0x3c')];_0x195aa8[_0xb4cc('0x3d')]=_0x4f47ed['outboundNoAnswerCallsDay'];_0x195aa8[_0xb4cc('0x3e')]=_0x4f47ed['outboundNoSuchCallsDay'];_0x195aa8[_0xb4cc('0x3f')]=_0x4f47ed[_0xb4cc('0x3f')];_0x195aa8[_0xb4cc('0x40')]=_0x4f47ed[_0xb4cc('0x40')];_0x195aa8['outboundRejectCallsDay']=_0x4f47ed[_0xb4cc('0x41')];_0x195aa8['outboundUnknownCallsDay']=_0x4f47ed[_0xb4cc('0x42')];_0x195aa8[_0xb4cc('0x43')]=_0x4f47ed[_0xb4cc('0x43')];_0x195aa8[_0xb4cc('0x44')]=_0x4f47ed[_0xb4cc('0x44')];_0x195aa8[_0xb4cc('0x45')]=_0x4f47ed[_0xb4cc('0x45')];_0x195aa8['predictiveIntervalDroppedCallsCallersExit']=_0x4f47ed[_0xb4cc('0x46')];_0x195aa8[_0xb4cc('0x47')]=_0x4f47ed[_0xb4cc('0x47')];_0x195aa8['predictiveIntervalErlangCalls']=_0x4f47ed['predictiveIntervalErlangCalls'];_0x195aa8[_0xb4cc('0x48')]=_0x4f47ed[_0xb4cc('0x48')];_0x195aa8[_0xb4cc('0x49')]=_0x4f47ed[_0xb4cc('0x49')];_0x195aa8[_0xb4cc('0x4a')]=_0x4f47ed['predictiveIntervalMultiplicativeFactor'];_0x195aa8[_0xb4cc('0x4b')]=_0x4f47ed['predictiveIntervalPauses'];_0x195aa8['predictiveIntervalAvailable']=_0x4f47ed[_0xb4cc('0x4c')];_0x195aa8[_0xb4cc('0x4d')]=_0x4f47ed[_0xb4cc('0x4d')];_0x195aa8[_0xb4cc('0x1a')]=_0x4f47ed[_0xb4cc('0x1a')];_0x195aa8['originated']=_0x4f47ed[_0xb4cc('0x4e')];_0x195aa8['erlangCalls']=_0x4f47ed[_0xb4cc('0x4f')];_0x195aa8[_0xb4cc('0x50')]=_0x4f47ed[_0xb4cc('0x50')];_0x195aa8[_0xb4cc('0x51')]=_0x4f47ed[_0xb4cc('0x51')];_0x195aa8[_0xb4cc('0x52')]=_0x4f47ed[_0xb4cc('0x52')];_0x195aa8[_0xb4cc('0x53')]=_0x4f47ed[_0xb4cc('0x53')];_0x195aa8[_0xb4cc('0x54')]=_0x4f47ed[_0xb4cc('0x54')];}if(_0x4f47ed['Trunk']){_0x195aa8[_0xb4cc('0x55')]={'id':_0x4f47ed[_0xb4cc('0x55')]['id'],'name':_0x4f47ed[_0xb4cc('0x55')][_0xb4cc('0xb')],'active':_0x4f47ed['Trunk']['active'],'callerid':_0x4f47ed[_0xb4cc('0x55')][_0xb4cc('0x56')]};}if(_0x4f47ed['Interval']){_0x195aa8[_0xb4cc('0x57')]={'id':_0x4f47ed[_0xb4cc('0x57')]['id'],'name':_0x4f47ed[_0xb4cc('0x57')][_0xb4cc('0xb')]};}_0x2ee2d3['push'](_0x195aa8);}}_0x1f1809({'count':_0x2ee2d3[_0xb4cc('0x58')],'rows':_0x2ee2d3});});},'UpdateVoiceQueue':function(_0x94476f){return new Promise(function(_0x1404bf,_0x511072){var _0x41a604=_[_0xb4cc('0x59')](_0x4cad3f[_0xb4cc('0x20')],{'id':parseInt(_0x94476f['id'])});var _0x1490b6=_[_0xb4cc('0x5a')](_0x94476f,['id']);if(_0x41a604){for(var _0x439aa6 in _0x1490b6){if(typeof _0x1490b6[_0x439aa6]!==_0xb4cc('0x5b')&&typeof _0x41a604[_0x439aa6]!==_0xb4cc('0x5b')){_0x41a604[_0x439aa6]=_0x1490b6[_0x439aa6];}}_0x1404bf(_0x41a604);}else{_0x511072();}});},'VoiceChannels':function(_0x3a2283){return new Promise(function(_0x497dee,_0x1933f6){var _0x5dffc3=_[_0xb4cc('0x5c')](_0x4cad3f[_0xb4cc('0x5d')]);_0x497dee({'count':_0x5dffc3[_0xb4cc('0x58')],'rows':_0x5dffc3});});},'VoiceChannelMixMonitor':function(_0x521740){var _0x896740=this;return new Promise(function(_0x150b86,_0x3353c0){if(ami[_0xb4cc('0x1b')]()==![]){return _0x3353c0(_0x896740[_0xb4cc('0x19')](0x1f4,[config[_0xb4cc('0xf')]['ip'],config[_0xb4cc('0xf')][_0xb4cc('0x10')],'ami\x20disconnected'][_0xb4cc('0x11')]('\x20')));}var _0x1e8e36=schema(properties[_0xb4cc('0x5e')])[_0xb4cc('0x5f')](_0x521740);if(_0x1e8e36[_0xb4cc('0x58')]>0x0){return _0x3353c0(_0x896740[_0xb4cc('0x19')](0x1f4,_[_0xb4cc('0x60')](_0x1e8e36,'message')[_0xb4cc('0x11')](',\x20')));}var _0x3a339b=_['find'](_0x4cad3f[_0xb4cc('0x5d')],{'uniqueid':_0x521740[_0xb4cc('0x61')]});if(_0x3a339b&&_0x3a339b[_0xb4cc('0x62')]){var _0x25933c=util['format'](_0xb4cc('0x63'),_0x521740['filename']||_0x521740[_0xb4cc('0x61')],_0x521740['format']||'wav');return ami[_0xb4cc('0x16')]({'action':_0xb4cc('0x64'),'channel':_0x3a339b[_0xb4cc('0x62')],'file':_0x25933c,'options':'ai(mixmonitorid)'})[_0xb4cc('0x17')](function(_0x1c65aa){var _0x33af93=_[_0xb4cc('0x59')](_0x3a339b[_0xb4cc('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x25933c[_0xb4cc('0x66')]()});if(_[_0xb4cc('0x67')](_0x33af93)){_0x3a339b['monitors'][_0xb4cc('0x68')]({'filename':_0xb4cc('0x69')+_0x25933c[_0xb4cc('0x66')](),'createdAt':moment()['format'](_0xb4cc('0x6a')),'mixmonitorid':_0x1c65aa[_0xb4cc('0x6b')],'status':'rec'});}else{_0x33af93['mixmonitorid']=_0x1c65aa[_0xb4cc('0x6b')];_0x33af93['status']=_0xb4cc('0x6c');}_0x150b86({'code':0xc8,'message':[_0x521740[_0xb4cc('0x61')],'MixMonitor\x20Success',_0x1c65aa[_0xb4cc('0x6b')]][_0xb4cc('0x11')]('\x20'),'mixmonitorid':_0x1c65aa[_0xb4cc('0x6b')]});})[_0xb4cc('0x18')](function(_0xb69112){_0x3353c0(_0x896740['error'](0x1f5,[_0x521740[_0xb4cc('0x61')],_0xb69112['message'][_0xb4cc('0x66')]()][_0xb4cc('0x11')]('\x20')));});}else{return _0x3353c0(_0x896740[_0xb4cc('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x11e230){var _0x101025=this;return new Promise(function(_0x3b4f28,_0x5d26f2){if(ami[_0xb4cc('0x1b')]()==![]){return _0x5d26f2(_0x101025[_0xb4cc('0x19')](0x1f4,[config[_0xb4cc('0xf')]['ip'],config['asterisk'][_0xb4cc('0x10')],_0xb4cc('0x1c')][_0xb4cc('0x11')]('\x20')));}var _0xd65693=schema(properties[_0xb4cc('0x5e')])['validate'](_0x11e230);if(_0xd65693[_0xb4cc('0x58')]>0x0){return _0x5d26f2(_0x101025[_0xb4cc('0x19')](0x1f4,_[_0xb4cc('0x60')](_0xd65693,_0xb4cc('0x1a'))[_0xb4cc('0x11')](',\x20')));}var _0x1e7798=_[_0xb4cc('0x59')](_0x4cad3f[_0xb4cc('0x5d')],{'uniqueid':_0x11e230[_0xb4cc('0x61')]});if(_0x1e7798){return BPromise['resolve']()[_0xb4cc('0x17')](function(){if(_0x1e7798['channel']){return ami[_0xb4cc('0x16')]({'action':_0xb4cc('0x6d'),'channel':_0x1e7798['channel'],'mixmonitorid':_0x11e230[_0xb4cc('0x6b')]})['catch'](function(_0x314c8b){});}})[_0xb4cc('0x17')](function(){if(_0x1e7798['destinationchannel']){return ami[_0xb4cc('0x16')]({'action':_0xb4cc('0x6d'),'channel':_0x1e7798[_0xb4cc('0x6e')],'mixmonitorid':_0x11e230[_0xb4cc('0x6b')]})[_0xb4cc('0x18')](function(_0x507807){});}})[_0xb4cc('0x17')](function(_0x5aa425){var _0x1790b8=_[_0xb4cc('0x59')](_0x1e7798[_0xb4cc('0x65')],{'mixmonitorid':_0x11e230[_0xb4cc('0x6b')]});if(_0x1790b8){_0x1790b8[_0xb4cc('0x6f')]=_0xb4cc('0x70');}})[_0xb4cc('0x17')](function(){var _0x2021b6=util[_0xb4cc('0x8')](_0xb4cc('0x63'),_0x11e230['filename']||_0x11e230['uniqueid'],_0x11e230[_0xb4cc('0x8')]||_0xb4cc('0x71'));var _0x3e36c1=_['find'](_0x1e7798[_0xb4cc('0x65')],{'filename':_0xb4cc('0x69')+_0x2021b6[_0xb4cc('0x66')]()});if(_0x3e36c1){_0x3e36c1[_0xb4cc('0x6f')]=_0xb4cc('0x70');}})[_0xb4cc('0x17')](function(){_0x3b4f28({'code':0xc8,'message':[_0x11e230[_0xb4cc('0x61')],_0xb4cc('0x72')][_0xb4cc('0x11')]('\x20')});})['catch'](function(_0xd789eb){_0x5d26f2(_0x101025['error'](0x1f5,[_0x11e230[_0xb4cc('0x61')],_0xd789eb[_0xb4cc('0x1a')]['toLowerCase']()][_0xb4cc('0x11')]('\x20')));});}else{return _0x5d26f2(_0x101025[_0xb4cc('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x46ca1d){return new Promise(function(_0x196409,_0x4a525b){var _0x73f135=_[_0xb4cc('0x5c')](_0x4cad3f[_0xb4cc('0x73')]);_0x196409({'count':_0x73f135[_0xb4cc('0x58')],'rows':_0x73f135});});},'VoiceQueuesChannel':function(_0xc7874){var _0x36339f=this;return new Promise(function(_0x3597c8,_0x116462){var _0x14cb9b=schema(properties[_0xb4cc('0x74')])[_0xb4cc('0x5f')](_0xc7874);if(_0x14cb9b[_0xb4cc('0x58')]>0x0){return _0x116462(_0x36339f[_0xb4cc('0x19')](0x1f4,_[_0xb4cc('0x60')](_0x14cb9b,_0xb4cc('0x1a'))['join'](',\x20')));}var _0xde6521=_[_0xb4cc('0x59')](_0x4cad3f[_0xb4cc('0x73')],{'uniqueid':_0xc7874[_0xb4cc('0x61')]});if(_0xde6521){_0x3597c8(_0xde6521);}else{return _0x116462(_0x36339f[_0xb4cc('0x19')](0x1f5,_0xb4cc('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x5355d9){var _0x3b2362=this;return new Promise(function(_0x9279b7,_0x51c960){if(ami[_0xb4cc('0x1b')]()==![]){return _0x51c960(_0x3b2362[_0xb4cc('0x19')](0x1f4,[config[_0xb4cc('0xf')]['ip'],config[_0xb4cc('0xf')][_0xb4cc('0x10')],_0xb4cc('0x1c')][_0xb4cc('0x11')]('\x20')));}var _0x1fceb9=schema(properties['voicequeuechannelhangup'])[_0xb4cc('0x5f')](_0x5355d9);if(_0x1fceb9[_0xb4cc('0x58')]>0x0){return _0x51c960(_0x3b2362[_0xb4cc('0x19')](0x1f4,_[_0xb4cc('0x60')](_0x1fceb9,_0xb4cc('0x1a'))['join'](',\x20')));}var _0x3e9131=_[_0xb4cc('0x59')](_0x4cad3f[_0xb4cc('0x73')],{'uniqueid':_0x5355d9[_0xb4cc('0x61')]});if(_0x3e9131&&_0x3e9131[_0xb4cc('0x62')]){return ami[_0xb4cc('0x16')]({'action':_0xb4cc('0x76'),'channel':_0x3e9131[_0xb4cc('0x62')]})['then'](function(_0x55cf17){_0x9279b7({'code':0xc8,'message':[_0x5355d9[_0xb4cc('0x61')],_0x55cf17['message'][_0xb4cc('0x66')]()][_0xb4cc('0x11')]('\x20')});})['catch'](function(_0x2d1f59){_0x51c960(_0x3b2362['error'](0x1f5,[_0x5355d9[_0xb4cc('0x61')],_0x2d1f59['message'][_0xb4cc('0x66')]()]['join']('\x20')));});}else{return _0x51c960(_0x3b2362[_0xb4cc('0x19')](0x1f5,_0xb4cc('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x1ce985){var _0x87ff1e=this;return new Promise(function(_0x5ce13e,_0xc3b8b1){if(ami[_0xb4cc('0x1b')]()==![]){return _0xc3b8b1(_0x87ff1e['error'](0x1f4,[config[_0xb4cc('0xf')]['ip'],config[_0xb4cc('0xf')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x5c6323=schema(properties[_0xb4cc('0x77')])[_0xb4cc('0x5f')](_0x1ce985);if(_0x5c6323['length']>0x0){return _0xc3b8b1(_0x87ff1e[_0xb4cc('0x19')](0x1f4,_[_0xb4cc('0x60')](_0x5c6323,_0xb4cc('0x1a'))[_0xb4cc('0x11')](',\x20')));}var _0x4d03d9=_[_0xb4cc('0x59')](_0x4cad3f[_0xb4cc('0x73')],{'uniqueid':_0x1ce985['uniqueid']});if(_0x4d03d9&&_0x4d03d9[_0xb4cc('0x62')]){return ami[_0xb4cc('0x16')]({'action':_0xb4cc('0x78'),'channel':_0x4d03d9['channel'],'exten':_0x1ce985[_0xb4cc('0x79')],'context':_0x1ce985[_0xb4cc('0x7a')]||_0x4d03d9[_0xb4cc('0x7a')],'priority':0x1})[_0xb4cc('0x17')](function(_0x513f88){_0x5ce13e({'code':0xc8,'message':[_0x1ce985[_0xb4cc('0x61')],_0x513f88['message'][_0xb4cc('0x66')]()][_0xb4cc('0x11')]('\x20')});})[_0xb4cc('0x18')](function(_0x1800fa){_0xc3b8b1(_0x87ff1e[_0xb4cc('0x19')](0x1f5,[_0x1ce985[_0xb4cc('0x61')],_0x1800fa[_0xb4cc('0x1a')]['toLowerCase']()][_0xb4cc('0x11')]('\x20')));});}else{return _0xc3b8b1(_0x87ff1e['error'](0x1f5,_0xb4cc('0x75')));}});},'Agents':function(_0x292411){return new Promise(function(_0x402743,_0x41d110){var _0x43470f=_[_0xb4cc('0x5c')](_0x4cad3f[_0xb4cc('0xd')]);_0x402743({'count':_0x43470f[_0xb4cc('0x58')],'rows':_0x43470f});});},'Telephones':function(_0x3be46f){return new Promise(function(_0x3013c3,_0x4f2bc6){var _0x2a0ba1=_[_0xb4cc('0x5c')](_0x4cad3f['telephones']);_0x3013c3({'count':_0x2a0ba1['length'],'rows':_0x2a0ba1});});},'Trunks':function(_0x26765f){return new Promise(function(_0x21aa8a,_0x3f9e35){var _0x363e75=_[_0xb4cc('0x5c')](_0x4cad3f[_0xb4cc('0x7b')]);_0x21aa8a({'count':_0x363e75[_0xb4cc('0x58')],'rows':_0x363e75});});},'OutboundChannels':function(_0x394d40){return new Promise(function(_0x20d302,_0x22d4b1){var _0xe225d9=_[_0xb4cc('0x5c')](_0x4cad3f['outboundChannels']);_0x20d302({'count':_0xe225d9['length'],'rows':_0xe225d9});});},'Outbound':function(_0x156313){return new Promise(function(_0x31eda6,_0x4d988d){_0x31eda6(_0x4cad3f[_0xb4cc('0x2e')]);});},'Campaigns':function(_0x59c15c){return new Promise(function(_0xd6f8df,_0x193efb){var _0x1a211e=_[_0xb4cc('0x5c')](_0x4cad3f[_0xb4cc('0x7c')]);_0xd6f8df({'count':_0x1a211e[_0xb4cc('0x58')],'rows':_0x1a211e});});},'VoiceQueuesPreview':function(_0x1419ca){var _0x1ab2f3=this;return new Promise(function(_0x209254,_0x281118){_0x1ae040[_0xb4cc('0x7d')](_0x1419ca['id'])['then'](function(_0x2245e5){_0x209254({'code':0xc8,'message':_0x2245e5[_0xb4cc('0x1a')]});})[_0xb4cc('0x18')](function(_0x10803b){_0x281118(_0x1ab2f3[_0xb4cc('0x19')](0x1f4,_0x10803b[_0xb4cc('0x1a')]));});});},'EventManager':function(_0x36863e){var _0x120cab=this;return new Promise(function(_0xb15e9,_0x1027d4){if(!_0x36863e[_0xb4cc('0x7e')]){return _0x1027d4(_0x120cab['error'](0x1f4,_0xb4cc('0x7f')));}ami[_0xb4cc('0x80')](_0xb4cc('0x81')+_0x36863e[_0xb4cc('0x7e')],_0x36863e[_0xb4cc('0x1a')]);_0xb15e9({'code':0xc8,'message':_0x36863e});});},'FaxAccounts':function(_0xd6fa7e){return new Promise(function(_0x598ac6,_0x236bc3){var _0x54feea=_['values'](_0x4cad3f[_0xb4cc('0x82')]);_0x598ac6({'count':_0x54feea['length'],'rows':_0x54feea});});},'SendFax':function(_0x501b64){var _0x486a1d=this;return new Promise(function(_0x4c6343,_0x127150){_0x2181b2[_0xb4cc('0x83')](_0x501b64)[_0xb4cc('0x17')](function(_0x5421f0){_0x4c6343({'code':0xc8,'message':_0x5421f0[_0xb4cc('0x1a')]});})['catch'](function(_0x4d6c67){_0x127150(_0x486a1d[_0xb4cc('0x19')](0x1f4,_0x4d6c67['message']));});});},'CheckAfterSend':function(_0x32d5a3){var _0x4651ac=this;return new Promise(function(_0x4b312c,_0x280c44){_0x2181b2[_0xb4cc('0x84')](_0x32d5a3)[_0xb4cc('0x17')](function(_0x37d4d9){_0x4b312c({'code':0xc8,'message':_0x37d4d9[_0xb4cc('0x1a')]});})[_0xb4cc('0x18')](function(_0x456f68){_0x280c44(_0x4651ac[_0xb4cc('0x19')](0x1f4,_0x456f68[_0xb4cc('0x1a')]));});});}};var _0x4cab82=jayson[_0xb4cc('0x85')](_0x370b12)[_0xb4cc('0x86')]();_0x4cab82['on'](_0xb4cc('0x19'),function(_0x2092b3){return _0x5c0bdd(_0x2092b3);});_0x4cab82['listen'](0x232a,'127.0.0.1',function(){console[_0xb4cc('0x87')](_0xb4cc('0x88'),0x232a);return _0x1e19dd('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xd046=['queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','server','http','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../ami','%s/%s','name','timer','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','content','voiceQueues','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','voicechannel','channels','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xd046,0x129));var _0x6d04=function(_0x20a51b,_0x40ea22){_0x20a51b=_0x20a51b-0x0;var _0x1c616d=_0xd046[_0x20a51b];return _0x1c616d;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var jayson=require(_0x6d04('0x1'));var schema=require(_0x6d04('0x2'));var BPromise=require('bluebird');var moment=require(_0x6d04('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x6d04('0x4'));exports['listen']=function(_0x174d65,_0x4a1d47,_0x4bacb1){return new BPromise(function(_0xf3b4e7,_0x1968c4){var _0x4f83bc={'QueuePause':function(_0x569c7b){return new Promise(function(_0x2e2c01,_0x42aa22){var _0x52fc0c=util['format'](_0x6d04('0x5'),'SIP',_0x569c7b[_0x6d04('0x6')]);if(_0x174d65['timers']&&_0x174d65['timers'][_0x52fc0c]&&_0x174d65['timers'][_0x52fc0c][_0x6d04('0x7')]){_0x174d65[_0x6d04('0x8')][_0x52fc0c][_0x6d04('0x9')]();}if(_0x174d65[_0x6d04('0xa')][_0x52fc0c]){_0x174d65['agents'][_0x52fc0c][_0x6d04('0xb')]({'statePause':_0x569c7b[_0x6d04('0xc')]?!![]:![]});}_0x2e2c01({'code':0xc8,'message':_0x6d04('0xd')});});},'Reload':function(_0x16526b){var _0x22888e=this;return new Promise(function(_0x3e1da1,_0x2cadb8){if(ami[_0x6d04('0xe')]()==![]){return _0x2cadb8(_0x22888e[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config[_0x6d04('0x10')][_0x6d04('0x11')],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}_0x16526b=_[_0x6d04('0x14')](_0x16526b,_[_0x6d04('0x15')](properties[_0x6d04('0x16')]));_0x16526b[_0x6d04('0x17')]=_0x6d04('0x18');return ami[_0x6d04('0x19')](_0x16526b)[_0x6d04('0x1a')](function(_0x41dc21){_0x3e1da1({'code':0xc8,'message':_0x41dc21[_0x6d04('0x1b')]});})[_0x6d04('0x1c')](function(_0x4e93b5){_0x2cadb8(_0x22888e[_0x6d04('0xf')](0x1f5,_0x4e93b5[_0x6d04('0x1b')]));});});},'Command':function(_0x158383){var _0x7edbfc=this;return new Promise(function(_0x1d3dac,_0x2c6bb4){if(ami[_0x6d04('0xe')]()==![]){return _0x2c6bb4(_0x7edbfc[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config[_0x6d04('0x10')][_0x6d04('0x11')],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}_0x158383=_['pick'](_0x158383,_0x6d04('0x1d'));_0x158383[_0x6d04('0x17')]='Command';return ami['Action'](_0x158383)[_0x6d04('0x1a')](function(_0x326276){_0x1d3dac({'code':0xc8,'message':_0x326276[_0x6d04('0x1e')]});})[_0x6d04('0x1c')](function(_0x36113c){_0x2c6bb4(_0x7edbfc[_0x6d04('0xf')](0x1f5,_0x36113c[_0x6d04('0x1b')]));});});},'VoiceQueues':function(_0xb2bd60){return new Promise(function(_0x16a5b8,_0x38e90f){var _0x2c4d5b=[];for(var _0x23d78a in _0x174d65[_0x6d04('0x1f')]){if(_0x174d65[_0x6d04('0x1f')]['hasOwnProperty'](_0x23d78a)){var _0x1dc29b=_0x174d65[_0x6d04('0x1f')][_0x23d78a];var _0x6104a2={'id':_0x1dc29b['id'],'name':_0x1dc29b[_0x6d04('0x6')],'strategy':_0x1dc29b[_0x6d04('0x20')],'answered':_0x1dc29b[_0x6d04('0x21')],'available':_0x1dc29b['available'],'loggedIn':_0x1dc29b[_0x6d04('0x22')],'pTalking':_0x1dc29b[_0x6d04('0x23')],'sumBillable':_0x1dc29b[_0x6d04('0x24')],'sumDuration':_0x1dc29b[_0x6d04('0x25')],'sumHoldTime':_0x1dc29b[_0x6d04('0x26')]||0x0,'talking':_0x1dc29b['talking'],'total':_0x1dc29b['total'],'type':_0x1dc29b['type'],'unmanaged':_0x1dc29b['unmanaged'],'abandoned':_0x1dc29b[_0x6d04('0x27')],'waiting':_0x1dc29b['waiting'],'loggedInDb':_0x1dc29b[_0x6d04('0x28')]};if(_0x1dc29b['type']===_0x6d04('0x29')){_0x6104a2[_0x6d04('0x2a')]=_0x1dc29b[_0x6d04('0x2a')];_0x6104a2[_0x6d04('0x2b')]=_0x1dc29b[_0x6d04('0x2b')];_0x6104a2[_0x6d04('0x2c')]=_0x1dc29b[_0x6d04('0x2c')];_0x6104a2[_0x6d04('0x2d')]=_0x1dc29b[_0x6d04('0x2d')];_0x6104a2[_0x6d04('0x2e')]=_0x1dc29b['dialOriginateTimeout'];_0x6104a2['dialPrefix']=_0x1dc29b[_0x6d04('0x2f')];_0x6104a2[_0x6d04('0x30')]=_0x1dc29b[_0x6d04('0x30')];_0x6104a2[_0x6d04('0x31')]=_0x1dc29b['outboundAnswerAgiCallsDay'];_0x6104a2[_0x6d04('0x32')]=_0x1dc29b[_0x6d04('0x32')];_0x6104a2[_0x6d04('0x33')]=_0x1dc29b[_0x6d04('0x33')];_0x6104a2['outboundBusyCallsDay']=_0x1dc29b[_0x6d04('0x34')];_0x6104a2[_0x6d04('0x35')]=_0x1dc29b[_0x6d04('0x35')];_0x6104a2[_0x6d04('0x36')]=_0x1dc29b[_0x6d04('0x36')];_0x6104a2[_0x6d04('0x37')]=_0x1dc29b[_0x6d04('0x37')];_0x6104a2[_0x6d04('0x38')]=_0x1dc29b[_0x6d04('0x38')];_0x6104a2[_0x6d04('0x39')]=_0x1dc29b[_0x6d04('0x39')];_0x6104a2[_0x6d04('0x3a')]=_0x1dc29b[_0x6d04('0x3a')];_0x6104a2[_0x6d04('0x3b')]=_0x1dc29b[_0x6d04('0x3b')];_0x6104a2['outboundReCallsDay']=_0x1dc29b[_0x6d04('0x3c')];_0x6104a2['outboundRejectCallsDay']=_0x1dc29b[_0x6d04('0x3d')];_0x6104a2[_0x6d04('0x3e')]=_0x1dc29b['outboundUnknownCallsDay'];_0x6104a2[_0x6d04('0x3f')]=_0x1dc29b[_0x6d04('0x3f')];_0x6104a2[_0x6d04('0x40')]=_0x1dc29b[_0x6d04('0x40')];_0x6104a2[_0x6d04('0x41')]=_0x1dc29b[_0x6d04('0x41')];_0x6104a2[_0x6d04('0x42')]=_0x1dc29b[_0x6d04('0x42')];_0x6104a2['predictiveIntervalDroppedCallsTimeout']=_0x1dc29b[_0x6d04('0x43')];_0x6104a2[_0x6d04('0x44')]=_0x1dc29b[_0x6d04('0x44')];_0x6104a2[_0x6d04('0x45')]=_0x1dc29b[_0x6d04('0x45')];_0x6104a2['predictiveIntervalHitRate']=_0x1dc29b[_0x6d04('0x46')];_0x6104a2['predictiveIntervalMultiplicativeFactor']=_0x1dc29b['predictiveIntervalMultiplicativeFactor'];_0x6104a2['predictiveIntervalPauses']=_0x1dc29b['predictiveIntervalPauses'];_0x6104a2['predictiveIntervalAvailable']=_0x1dc29b[_0x6d04('0x47')];_0x6104a2['predictiveIntervalTotalCalls']=_0x1dc29b[_0x6d04('0x48')];_0x6104a2[_0x6d04('0x1b')]=_0x1dc29b[_0x6d04('0x1b')];_0x6104a2[_0x6d04('0x49')]=_0x1dc29b['originated'];_0x6104a2[_0x6d04('0x4a')]=_0x1dc29b[_0x6d04('0x4a')];_0x6104a2['erlangCallToSecond']=_0x1dc29b[_0x6d04('0x4b')];_0x6104a2[_0x6d04('0x4c')]=_0x1dc29b[_0x6d04('0x4c')];_0x6104a2[_0x6d04('0x4d')]=_0x1dc29b[_0x6d04('0x4d')];_0x6104a2[_0x6d04('0x4e')]=_0x1dc29b[_0x6d04('0x4e')];_0x6104a2['startProgressive']=_0x1dc29b[_0x6d04('0x4f')];}if(_0x1dc29b['Trunk']){_0x6104a2['Trunk']={'id':_0x1dc29b[_0x6d04('0x50')]['id'],'name':_0x1dc29b['Trunk'][_0x6d04('0x6')],'active':_0x1dc29b[_0x6d04('0x50')]['active'],'callerid':_0x1dc29b[_0x6d04('0x50')][_0x6d04('0x51')]};}if(_0x1dc29b[_0x6d04('0x52')]){_0x6104a2['Interval']={'id':_0x1dc29b['Interval']['id'],'name':_0x1dc29b[_0x6d04('0x52')][_0x6d04('0x6')]};}_0x2c4d5b[_0x6d04('0x53')](_0x6104a2);}}_0x16a5b8({'count':_0x2c4d5b[_0x6d04('0x54')],'rows':_0x2c4d5b});});},'UpdateVoiceQueue':function(_0x36db7a){return new Promise(function(_0x550455,_0x204933){var _0x3f053c=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x1f')],{'id':parseInt(_0x36db7a['id'])});var _0x413c3f=_[_0x6d04('0x56')](_0x36db7a,['id']);if(_0x3f053c){for(var _0x491de4 in _0x413c3f){if(typeof _0x413c3f[_0x491de4]!==_0x6d04('0x57')&&typeof _0x3f053c[_0x491de4]!==_0x6d04('0x57')){_0x3f053c[_0x491de4]=_0x413c3f[_0x491de4];}}_0x550455(_0x3f053c);}else{_0x204933();}});},'VoiceChannels':function(_0xace1a6){return new Promise(function(_0x4b5ed6,_0x52f411){var _0x146e51=_[_0x6d04('0x58')](_0x174d65['channels']);_0x4b5ed6({'count':_0x146e51['length'],'rows':_0x146e51});});},'VoiceChannelMixMonitor':function(_0x55e80a){var _0x4f4524=this;return new Promise(function(_0x56c653,_0x4b0349){if(ami[_0x6d04('0xe')]()==![]){return _0x4b0349(_0x4f4524[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config[_0x6d04('0x10')]['username'],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}var _0x48f04c=schema(properties[_0x6d04('0x59')])['validate'](_0x55e80a);if(_0x48f04c[_0x6d04('0x54')]>0x0){return _0x4b0349(_0x4f4524['error'](0x1f4,_['map'](_0x48f04c,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0xe4a07a=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x5a')],{'uniqueid':_0x55e80a[_0x6d04('0x5b')]});if(_0xe4a07a&&_0xe4a07a[_0x6d04('0x5c')]){var _0x16fe48=util[_0x6d04('0x5d')](_0x6d04('0x5e'),_0x55e80a[_0x6d04('0x5f')]||_0x55e80a[_0x6d04('0x5b')],_0x55e80a[_0x6d04('0x5d')]||_0x6d04('0x60'));return ami[_0x6d04('0x19')]({'action':_0x6d04('0x61'),'channel':_0xe4a07a['channel'],'file':_0x16fe48,'options':_0x6d04('0x62')})[_0x6d04('0x1a')](function(_0x1785e3){var _0x124401=_[_0x6d04('0x55')](_0xe4a07a[_0x6d04('0x63')],{'filename':_0x6d04('0x64')+_0x16fe48[_0x6d04('0x65')]()});if(_['isNil'](_0x124401)){_0xe4a07a[_0x6d04('0x63')][_0x6d04('0x53')]({'filename':'/var/spool/asterisk/monitor/'+_0x16fe48[_0x6d04('0x65')](),'createdAt':moment()[_0x6d04('0x5d')](_0x6d04('0x66')),'mixmonitorid':_0x1785e3[_0x6d04('0x67')],'status':_0x6d04('0x68')});}else{_0x124401[_0x6d04('0x67')]=_0x1785e3['mixmonitorid'];_0x124401['status']=_0x6d04('0x68');}_0x56c653({'code':0xc8,'message':[_0x55e80a['uniqueid'],_0x6d04('0x69'),_0x1785e3[_0x6d04('0x67')]][_0x6d04('0x13')]('\x20'),'mixmonitorid':_0x1785e3[_0x6d04('0x67')]});})['catch'](function(_0x24744c){_0x4b0349(_0x4f4524[_0x6d04('0xf')](0x1f5,[_0x55e80a[_0x6d04('0x5b')],_0x24744c[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')));});}else{return _0x4b0349(_0x4f4524[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x5d729f){var _0x8a9a2c=this;return new Promise(function(_0x3f9214,_0x1af6b8){if(ami['isConnected']()==![]){return _0x1af6b8(_0x8a9a2c[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6d04('0x13')]('\x20')));}var _0x2da73e=schema(properties[_0x6d04('0x59')])[_0x6d04('0x2')](_0x5d729f);if(_0x2da73e[_0x6d04('0x54')]>0x0){return _0x1af6b8(_0x8a9a2c[_0x6d04('0xf')](0x1f4,_[_0x6d04('0x6b')](_0x2da73e,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0xb2edae=_['find'](_0x174d65['channels'],{'uniqueid':_0x5d729f['uniqueid']});if(_0xb2edae){return BPromise[_0x6d04('0x6c')]()[_0x6d04('0x1a')](function(){if(_0xb2edae[_0x6d04('0x5c')]){return ami[_0x6d04('0x19')]({'action':_0x6d04('0x6d'),'channel':_0xb2edae['channel'],'mixmonitorid':_0x5d729f[_0x6d04('0x67')]})['catch'](function(_0x10e0b9){});}})[_0x6d04('0x1a')](function(){if(_0xb2edae[_0x6d04('0x6e')]){return ami[_0x6d04('0x19')]({'action':_0x6d04('0x6d'),'channel':_0xb2edae[_0x6d04('0x6e')],'mixmonitorid':_0x5d729f[_0x6d04('0x67')]})[_0x6d04('0x1c')](function(_0x5504dc){});}})[_0x6d04('0x1a')](function(_0x37f223){var _0x2079a2=_[_0x6d04('0x55')](_0xb2edae[_0x6d04('0x63')],{'mixmonitorid':_0x5d729f[_0x6d04('0x67')]});if(_0x2079a2){_0x2079a2[_0x6d04('0x6f')]=_0x6d04('0x70');}})['then'](function(){var _0x45b641=util[_0x6d04('0x5d')](_0x6d04('0x5e'),_0x5d729f[_0x6d04('0x5f')]||_0x5d729f['uniqueid'],_0x5d729f[_0x6d04('0x5d')]||'wav');var _0x494ae0=_[_0x6d04('0x55')](_0xb2edae[_0x6d04('0x63')],{'filename':_0x6d04('0x64')+_0x45b641[_0x6d04('0x65')]()});if(_0x494ae0){_0x494ae0['status']=_0x6d04('0x70');}})[_0x6d04('0x1a')](function(){_0x3f9214({'code':0xc8,'message':[_0x5d729f[_0x6d04('0x5b')],_0x6d04('0x71')][_0x6d04('0x13')]('\x20')});})[_0x6d04('0x1c')](function(_0x24df5f){_0x1af6b8(_0x8a9a2c[_0x6d04('0xf')](0x1f5,[_0x5d729f[_0x6d04('0x5b')],_0x24df5f[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')));});}else{return _0x1af6b8(_0x8a9a2c['error'](0x1f5,_0x6d04('0x6a')));}});},'VoiceQueuesChannels':function(_0x4115c6){return new Promise(function(_0x2e4e80,_0x208860){var _0x2f0ea6=_['values'](_0x174d65[_0x6d04('0x72')]);_0x2e4e80({'count':_0x2f0ea6['length'],'rows':_0x2f0ea6});});},'VoiceQueuesChannel':function(_0x4886d5){var _0x29f3c8=this;return new Promise(function(_0x436df8,_0x3547b7){var _0x2864f2=schema(properties[_0x6d04('0x73')])['validate'](_0x4886d5);if(_0x2864f2[_0x6d04('0x54')]>0x0){return _0x3547b7(_0x29f3c8[_0x6d04('0xf')](0x1f4,_['map'](_0x2864f2,'message')[_0x6d04('0x13')](',\x20')));}var _0x45ff0e=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x72')],{'uniqueid':_0x4886d5[_0x6d04('0x5b')]});if(_0x45ff0e){_0x436df8(_0x45ff0e);}else{return _0x3547b7(_0x29f3c8[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0xd63098){var _0x1b58e8=this;return new Promise(function(_0x1d3c7e,_0x13ecc2){if(ami[_0x6d04('0xe')]()==![]){return _0x13ecc2(_0x1b58e8['error'](0x1f4,[config['asterisk']['ip'],config[_0x6d04('0x10')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x4fdf69=schema(properties[_0x6d04('0x74')])[_0x6d04('0x2')](_0xd63098);if(_0x4fdf69[_0x6d04('0x54')]>0x0){return _0x13ecc2(_0x1b58e8[_0x6d04('0xf')](0x1f4,_[_0x6d04('0x6b')](_0x4fdf69,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0x55ac73=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x72')],{'uniqueid':_0xd63098[_0x6d04('0x5b')]});if(_0x55ac73&&_0x55ac73[_0x6d04('0x5c')]){return ami[_0x6d04('0x19')]({'action':'Hangup','channel':_0x55ac73[_0x6d04('0x5c')]})['then'](function(_0x35f0fc){_0x1d3c7e({'code':0xc8,'message':[_0xd63098[_0x6d04('0x5b')],_0x35f0fc[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')});})[_0x6d04('0x1c')](function(_0x299eb2){_0x13ecc2(_0x1b58e8[_0x6d04('0xf')](0x1f5,[_0xd63098['uniqueid'],_0x299eb2[_0x6d04('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x13ecc2(_0x1b58e8[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x4cb247){var _0x54d9ce=this;return new Promise(function(_0x5ce833,_0x28c6bc){if(ami[_0x6d04('0xe')]()==![]){return _0x28c6bc(_0x54d9ce[_0x6d04('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x6d04('0x11')],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}var _0xb09641=schema(properties[_0x6d04('0x75')])['validate'](_0x4cb247);if(_0xb09641['length']>0x0){return _0x28c6bc(_0x54d9ce['error'](0x1f4,_['map'](_0xb09641,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0x2e34f1=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x72')],{'uniqueid':_0x4cb247['uniqueid']});if(_0x2e34f1&&_0x2e34f1[_0x6d04('0x5c')]){return ami['Action']({'action':_0x6d04('0x76'),'channel':_0x2e34f1[_0x6d04('0x5c')],'exten':_0x4cb247[_0x6d04('0x77')],'context':_0x4cb247[_0x6d04('0x78')]||_0x2e34f1[_0x6d04('0x78')],'priority':0x1})[_0x6d04('0x1a')](function(_0x5e6637){_0x5ce833({'code':0xc8,'message':[_0x4cb247[_0x6d04('0x5b')],_0x5e6637[_0x6d04('0x1b')]['toLowerCase']()][_0x6d04('0x13')]('\x20')});})[_0x6d04('0x1c')](function(_0x9a88eb){_0x28c6bc(_0x54d9ce[_0x6d04('0xf')](0x1f5,[_0x4cb247[_0x6d04('0x5b')],_0x9a88eb[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')));});}else{return _0x28c6bc(_0x54d9ce[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'Agents':function(_0x5b46dd){return new Promise(function(_0x3fe3d4,_0x5e05e9){var _0x426f6d=_['values'](_0x174d65[_0x6d04('0xa')]);_0x3fe3d4({'count':_0x426f6d[_0x6d04('0x54')],'rows':_0x426f6d});});},'Telephones':function(_0x2242f7){return new Promise(function(_0x33b0f5,_0x40336e){var _0x5622b1=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x79')]);_0x33b0f5({'count':_0x5622b1['length'],'rows':_0x5622b1});});},'Trunks':function(_0x43af5f){return new Promise(function(_0x34bfcb,_0x5818ed){var _0x2a6c30=_['values'](_0x174d65[_0x6d04('0x7a')]);_0x34bfcb({'count':_0x2a6c30['length'],'rows':_0x2a6c30});});},'OutboundChannels':function(_0x3ff09e){return new Promise(function(_0x23ba11,_0x469443){var _0x29dfba=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x7b')]);_0x23ba11({'count':_0x29dfba[_0x6d04('0x54')],'rows':_0x29dfba});});},'Outbound':function(_0x2c4219){return new Promise(function(_0x7c68eb,_0x2be999){_0x7c68eb(_0x174d65[_0x6d04('0x29')]);});},'Campaigns':function(_0x3cc46f){return new Promise(function(_0x56c938,_0x3e2eea){var _0x1e68c6=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x7c')]);_0x56c938({'count':_0x1e68c6['length'],'rows':_0x1e68c6});});},'VoiceQueuesPreview':function(_0x3df7ef){var _0x43ba0b=this;return new Promise(function(_0x46da38,_0x415421){_0x4a1d47[_0x6d04('0x7d')](_0x3df7ef['id'])[_0x6d04('0x1a')](function(_0x281f79){_0x46da38({'code':0xc8,'message':_0x281f79[_0x6d04('0x1b')]});})['catch'](function(_0x250eef){_0x415421(_0x43ba0b['error'](0x1f4,_0x250eef[_0x6d04('0x1b')]));});});},'EventManager':function(_0x57e551){var _0x1b8402=this;return new Promise(function(_0x124708,_0x17ca4d){if(!_0x57e551[_0x6d04('0x7e')]){return _0x17ca4d(_0x1b8402[_0x6d04('0xf')](0x1f4,_0x6d04('0x7f')));}ami['emit'](_0x6d04('0x80')+_0x57e551[_0x6d04('0x7e')],_0x57e551['message']);_0x124708({'code':0xc8,'message':_0x57e551});});},'FaxAccounts':function(_0x36768e){return new Promise(function(_0x1d3b13,_0x7e911b){var _0x4b7a37=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x81')]);_0x1d3b13({'count':_0x4b7a37[_0x6d04('0x54')],'rows':_0x4b7a37});});},'SendFax':function(_0x220c69){var _0x407f98=this;return new Promise(function(_0x7f5790,_0xe07034){_0x4bacb1[_0x6d04('0x82')](_0x220c69)[_0x6d04('0x1a')](function(_0x345ffe){_0x7f5790({'code':0xc8,'message':_0x345ffe[_0x6d04('0x1b')]});})[_0x6d04('0x1c')](function(_0x93c05c){_0xe07034(_0x407f98[_0x6d04('0xf')](0x1f4,_0x93c05c['message']));});});},'CheckAfterSend':function(_0x2b4e49){var _0x425707=this;return new Promise(function(_0x12a364,_0x202e83){_0x4bacb1['checkAfterSend'](_0x2b4e49)[_0x6d04('0x1a')](function(_0x1e8db9){_0x12a364({'code':0xc8,'message':_0x1e8db9[_0x6d04('0x1b')]});})['catch'](function(_0x24e546){_0x202e83(_0x425707[_0x6d04('0xf')](0x1f4,_0x24e546[_0x6d04('0x1b')]));});});}};var _0x299037=jayson[_0x6d04('0x83')](_0x4f83bc)[_0x6d04('0x84')]();_0x299037['on']('error',function(_0x921efd){return _0x1968c4(_0x921efd);});_0x299037[_0x6d04('0x85')](0x232a,'127.0.0.1',function(){console[_0x6d04('0x86')](_0x6d04('0x87'),0x232a);return _0xf3b4e7(_0x6d04('0x88')+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 0f4d7ae..78923a4 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 _0x6aa7=['xmd-contactid','data3','split','$or','routeId','destcalleridnum','calleridnum','phone','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','trigger:%s','action','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','isNil','data5'];(function(_0x4f165d,_0x271b22){var _0x4092bf=function(_0x46ae89){while(--_0x46ae89){_0x4f165d['push'](_0x4f165d['shift']());}};_0x4092bf(++_0x271b22);}(_0x6aa7,0x178));var _0x76aa=function(_0xf4a0e2,_0x2797f4){_0xf4a0e2=_0xf4a0e2-0x0;var _0x4e2eea=_0x6aa7[_0xf4a0e2];return _0x4e2eea;};'use strict';var _=require(_0x76aa('0x0'));var BPromise=require('bluebird');var Redis=require(_0x76aa('0x1'));var util=require(_0x76aa('0x2'));var config=require(_0x76aa('0x3'));var logger=require(_0x76aa('0x4'))('trigger');var cmContactRpc=require(_0x76aa('0x5'));config[_0x76aa('0x6')]=_[_0x76aa('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x76aa('0x8'))(new Redis(config['redis']));function emit(_0x32dee5,_0x36d12b,_0xa9b695,_0x56d6bc,_0x3dae33){logger[_0x76aa('0x9')](_0x76aa('0xa'),_0x32dee5,_0x36d12b['id'],_0xa9b695,_0x56d6bc,JSON['stringify'](_0x3dae33));io['to'](_0xa9b695)[_0x76aa('0xb')](_0x56d6bc,_0x3dae33);}exports[_0x76aa('0xc')]=function(_0x41643a,_0x16cb50,_0x37f1ab,_0x128435){var _0x2c5075,_0x8dc35c;var _0xd6327={};var _0x17a417=Number(_0x37f1ab['data1']);var _0x112c39=_0x37f1ab['data2']?Boolean(Number(_0x37f1ab[_0x76aa('0xd')])):![];var _0x12dde0;var _0x3f8f6b=![];if(!_[_0x76aa('0xe')](_0x37f1ab[_0x76aa('0xf')])){if(_0x37f1ab['data5']=='1')_0x3f8f6b=!![];}if(!_0x3f8f6b){if(_0x128435['xmd-contactid']){_0xd6327['id']=_0x128435[_0x76aa('0x10')];}}if(!_0xd6327['id']){_0xd6327['ListId']=_0x17a417;_0x12dde0=_0x37f1ab[_0x76aa('0x11')]&&_0x37f1ab[_0x76aa('0x11')]!=='0'?_0x37f1ab['data3'][_0x76aa('0x12')](','):['phone'];_0xd6327[_0x76aa('0x13')]=_['map'](_0x12dde0,function(_0x1515e9){var _0x413cf6={};_0x413cf6[_0x1515e9]=_0x128435[_0x76aa('0x14')]?_0x128435[_0x76aa('0x15')]:_0x128435[_0x76aa('0x16')];return _0x413cf6;});}var _0x3ead3f=['id','firstName','lastName',_0x76aa('0x17'),_0x76aa('0x18'),_0x76aa('0x19'),_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d')];var _0x2eaf48=_[_0x76aa('0x1e')](_0x3ead3f,_0x12dde0);BPromise['resolve']()[_0x76aa('0x1f')](cmContactRpc[_0x76aa('0x20')]({'attributes':_0x2eaf48,'where':_0xd6327}))[_0x76aa('0x1f')](function(_0x5b3f55){_0x8dc35c=_0x5b3f55;if(!_[_0x76aa('0x21')](_0x8dc35c)){if(_0x8dc35c[_0x76aa('0x22')]===0x1){_0x2c5075=_0x8dc35c[0x0];logger[_0x76aa('0x9')](_0x76aa('0x23'),_0x128435[_0x76aa('0x24')],_0x16cb50['id'],_0x2c5075['id']);}else{logger[_0x76aa('0x9')](_0x76aa('0x25'),_0x128435[_0x76aa('0x24')],_0x16cb50['id'],_[_0x76aa('0x26')](_0x8dc35c,'id')[_0x76aa('0x27')](','));}return;}else{logger[_0x76aa('0x9')](_0x76aa('0x28'),_0x128435[_0x76aa('0x24')],_0x16cb50['id']);var _0x4ef9b0={'ListId':_0x17a417};var _0xb5e8a9=_0x37f1ab[_0x76aa('0x29')]&&_0x37f1ab[_0x76aa('0x29')]!=='0'?_0x37f1ab[_0x76aa('0x29')]:_0x76aa('0x17');if(_0x112c39){logger[_0x76aa('0x9')](_0x76aa('0x2a'),_0x128435[_0x76aa('0x24')],_0x16cb50['id']);_0x4ef9b0[_0xb5e8a9]=_[_0x76aa('0xe')](_0x128435[_0x76aa('0x14')])?_0x128435['calleridnum']:_0x128435[_0x76aa('0x15')];if(_['isNil'](_0x128435[_0x76aa('0x14')])){_0x4ef9b0[_0x76aa('0x2b')]=_0x128435[_0x76aa('0x2c')]&&_0x128435[_0x76aa('0x2c')]!==_0x76aa('0x2d')?_0x128435[_0x76aa('0x2c')]:_0x76aa('0x2e');}else{_0x4ef9b0[_0x76aa('0x2b')]=_0x128435[_0x76aa('0x2f')]&&_0x128435[_0x76aa('0x2f')]!==''?_0x128435[_0x76aa('0x2f')]:_0x76aa('0x2e');}return BPromise[_0x76aa('0x30')]()[_0x76aa('0x1f')](cmContactRpc[_0x76aa('0x31')](_0x4ef9b0))[_0x76aa('0x1f')](function(_0x35a705){_0x2c5075=_0x35a705;_0x8dc35c['push'](_0x35a705);if(_0x2c5075){logger[_0x76aa('0x9')](_0x76aa('0x32'),_0x128435['uniqueid'],_0x16cb50['id'],_0x2c5075['id']);}return;});}else{logger[_0x76aa('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x128435[_0x76aa('0x24')],_0x16cb50['id']);_0x4ef9b0[_0xb5e8a9]=_['isNil'](_0x128435[_0x76aa('0x14')])?_0x128435['calleridnum']:_0x128435['destcalleridnum'];if(_[_0x76aa('0xe')](_0x128435[_0x76aa('0x14')])){_0x4ef9b0[_0x76aa('0x2b')]=_0x128435[_0x76aa('0x2c')]&&_0x128435['calleridname']!==''?_0x128435[_0x76aa('0x2c')]:_0x76aa('0x2e');}else{_0x4ef9b0[_0x76aa('0x2b')]=_0x128435[_0x76aa('0x2f')]&&_0x128435[_0x76aa('0x2f')]!==''?_0x128435[_0x76aa('0x2f')]:'Unknown';}_0x2c5075=_0x4ef9b0;_0x8dc35c['push'](_0x4ef9b0);return;}}})[_0x76aa('0x1f')](function(){if(_0x41643a){emit(_0x128435[_0x76aa('0x24')],_0x16cb50,util[_0x76aa('0x33')](_0x76aa('0x34'),_0x41643a['name']),util[_0x76aa('0x33')](_0x76aa('0x35'),_0x37f1ab[_0x76aa('0x36')]['toLowerCase']()),{'evt':_[_0x76aa('0x37')](_0x128435,{'autoCreate':_0x112c39}),'contact':_0x2c5075===undefined?{}:_0x2c5075,'contacts':_0x8dc35c[_0x76aa('0x22')]===0x0?undefined:_0x8dc35c});}});}; \ No newline at end of file +var _0xedd9=['data3','phone','$or','map','routeId','destcalleridnum','lastName','scheduledAt','union','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data1','data2','data5','xmd-contactid','ListId'];(function(_0x2d52ba,_0x2fda78){var _0x88ddf3=function(_0xbc18d){while(--_0xbc18d){_0x2d52ba['push'](_0x2d52ba['shift']());}};_0x88ddf3(++_0x2fda78);}(_0xedd9,0xfc));var _0x9edd=function(_0x52a213,_0x18a1b4){_0x52a213=_0x52a213-0x0;var _0x4f8bb8=_0xedd9[_0x52a213];return _0x4f8bb8;};'use strict';var _=require('lodash');var BPromise=require(_0x9edd('0x0'));var Redis=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var logger=require(_0x9edd('0x4'))(_0x9edd('0x5'));var cmContactRpc=require(_0x9edd('0x6'));config[_0x9edd('0x7')]=_['defaults'](config[_0x9edd('0x7')],{'host':_0x9edd('0x8'),'port':0x18eb});var io=require(_0x9edd('0x9'))(new Redis(config[_0x9edd('0x7')]));function emit(_0x5319f7,_0xf0b2d8,_0x571af9,_0x172522,_0x190185){logger[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,_0xf0b2d8['id'],_0x571af9,_0x172522,JSON['stringify'](_0x190185));io['to'](_0x571af9)[_0x9edd('0xc')](_0x172522,_0x190185);}exports['exec']=function(_0x2076fc,_0x138767,_0x523026,_0xbf9da6){var _0x13dc4f,_0x5b6c00;var _0x30c0d7={};var _0x1b73d1=Number(_0x523026[_0x9edd('0xd')]);var _0xfd544a=_0x523026[_0x9edd('0xe')]?Boolean(Number(_0x523026[_0x9edd('0xe')])):![];var _0xfca576;var _0xef5498=![];if(!_['isNil'](_0x523026[_0x9edd('0xf')])){if(_0x523026[_0x9edd('0xf')]=='1')_0xef5498=!![];}if(!_0xef5498){if(_0xbf9da6[_0x9edd('0x10')]){_0x30c0d7['id']=_0xbf9da6[_0x9edd('0x10')];}}if(!_0x30c0d7['id']){_0x30c0d7[_0x9edd('0x11')]=_0x1b73d1;_0xfca576=_0x523026[_0x9edd('0x12')]&&_0x523026[_0x9edd('0x12')]!=='0'?_0x523026[_0x9edd('0x12')]['split'](','):[_0x9edd('0x13')];_0x30c0d7[_0x9edd('0x14')]=_[_0x9edd('0x15')](_0xfca576,function(_0x5acf65){var _0x1b54c0={};_0x1b54c0[_0x5acf65]=_0xbf9da6[_0x9edd('0x16')]?_0xbf9da6[_0x9edd('0x17')]:_0xbf9da6['calleridnum'];return _0x1b54c0;});}var _0x43dc70=['id','firstName',_0x9edd('0x18'),_0x9edd('0x13'),'mobile','fax',_0x9edd('0x11'),'createdAt',_0x9edd('0x19'),'updatedAt'];var _0x535f37=_[_0x9edd('0x1a')](_0x43dc70,_0xfca576);BPromise[_0x9edd('0x1b')]()['then'](cmContactRpc['getContacts']({'attributes':_0x535f37,'where':_0x30c0d7}))[_0x9edd('0x1c')](function(_0x186186){_0x5b6c00=_0x186186;if(!_[_0x9edd('0x1d')](_0x5b6c00)){if(_0x5b6c00['length']===0x1){_0x13dc4f=_0x5b6c00[0x0];logger[_0x9edd('0xa')](_0x9edd('0x1e'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id'],_0x13dc4f['id']);}else{logger[_0x9edd('0xa')](_0x9edd('0x20'),_0xbf9da6['uniqueid'],_0x138767['id'],_[_0x9edd('0x15')](_0x5b6c00,'id')[_0x9edd('0x21')](','));}return;}else{logger[_0x9edd('0xa')](_0x9edd('0x22'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id']);var _0x4d507f={'ListId':_0x1b73d1};var _0x4b3d1b=_0x523026[_0x9edd('0x23')]&&_0x523026[_0x9edd('0x23')]!=='0'?_0x523026[_0x9edd('0x23')]:_0x9edd('0x13');if(_0xfd544a){logger[_0x9edd('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xbf9da6['uniqueid'],_0x138767['id']);_0x4d507f[_0x4b3d1b]=_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])?_0xbf9da6[_0x9edd('0x25')]:_0xbf9da6['destcalleridnum'];if(_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])){_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x27')]&&_0xbf9da6['calleridname']!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x27')]:_0x9edd('0x29');}else{_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x2a')]&&_0xbf9da6[_0x9edd('0x2a')]!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x2a')]:_0x9edd('0x29');}return BPromise[_0x9edd('0x1b')]()[_0x9edd('0x1c')](cmContactRpc[_0x9edd('0x2b')](_0x4d507f))[_0x9edd('0x1c')](function(_0xa55906){_0x13dc4f=_0xa55906;_0x5b6c00[_0x9edd('0x2c')](_0xa55906);if(_0x13dc4f){logger['info'](_0x9edd('0x2d'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id'],_0x13dc4f['id']);}return;});}else{logger[_0x9edd('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xbf9da6[_0x9edd('0x1f')],_0x138767['id']);_0x4d507f[_0x4b3d1b]=_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])?_0xbf9da6[_0x9edd('0x25')]:_0xbf9da6[_0x9edd('0x17')];if(_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])){_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x27')]&&_0xbf9da6[_0x9edd('0x27')]!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x27')]:_0x9edd('0x29');}else{_0x4d507f[_0x9edd('0x26')]=_0xbf9da6['destcalleridname']&&_0xbf9da6[_0x9edd('0x2a')]!==''?_0xbf9da6[_0x9edd('0x2a')]:_0x9edd('0x29');}_0x13dc4f=_0x4d507f;_0x5b6c00[_0x9edd('0x2c')](_0x4d507f);return;}}})[_0x9edd('0x1c')](function(){if(_0x2076fc){emit(_0xbf9da6[_0x9edd('0x1f')],_0x138767,util['format'](_0x9edd('0x2e'),_0x2076fc[_0x9edd('0x2f')]),util[_0x9edd('0x30')](_0x9edd('0x31'),_0x523026[_0x9edd('0x32')][_0x9edd('0x33')]()),{'evt':_[_0x9edd('0x34')](_0xbf9da6,{'autoCreate':_0xfd544a}),'contact':_0x13dc4f===undefined?{}:_0x13dc4f,'contacts':_0x5b6c00[_0x9edd('0x35')]===0x0?undefined:_0x5b6c00});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index bfc5bd2..8df1b7a 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 _0xc681=['script','parse','query','search','replace','checkTrigger','channel','AllConditions','every','AnyConditions','some','checkConditions','account','ChatWebsiteId','value','upperFirst','AccountId','operator','message','event','agent','membername','lastevent','mailSubstatus','undefined','substatus','util','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','motionChannel','checkTriggers','interface','hasOwnProperty','status','merge','variables','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','html','render','uri','buildUri','data2','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','toLowerCase','jscripty','trigger:%s','exec','queue','routeId','urlforward'];(function(_0x38297b,_0x5f02f9){var _0x1423bb=function(_0x44e008){while(--_0x44e008){_0x38297b['push'](_0x38297b['shift']());}};_0x1423bb(++_0x5f02f9);}(_0xc681,0x197));var _0x1c68=function(_0x214c1a,_0x7a551e){_0x214c1a=_0x214c1a-0x0;var _0x4bc755=_0xc681[_0x214c1a];return _0x4bc755;};'use strict';var util=require(_0x1c68('0x0'));var _=require('lodash');var url=require(_0x1c68('0x1'));var Mustache=require(_0x1c68('0x2'));var Redis=require(_0x1c68('0x3'));var urlforward=require('./urlforward');var integration=require(_0x1c68('0x4'));var cmContact=require(_0x1c68('0x5'));var script=require(_0x1c68('0x6'));var config=require(_0x1c68('0x7'));var logger=require(_0x1c68('0x8'))(_0x1c68('0x9'));var ami=require(_0x1c68('0xa'));config[_0x1c68('0xb')]=_[_0x1c68('0xc')](config[_0x1c68('0xb')],{'host':_0x1c68('0xd'),'port':0x18eb});var io=require(_0x1c68('0xe'))(new Redis(config[_0x1c68('0xb')]));var operators={'equals':function(_0x5ad103,_0x1bbbb4){return _0x5ad103==_0x1bbbb4;},'not_equals':function(_0x424292,_0x254b00){return _0x424292!=_0x254b00;}};var barAndWebActions=[_0x1c68('0xf'),'url',_0x1c68('0x10')];function Trigger(_0x1f81f6){this[_0x1c68('0x11')]=_0x1f81f6[_0x1c68('0x11')];this[_0x1c68('0x12')]=_0x1f81f6['agents'];this['voiceQueues']=_0x1f81f6[_0x1c68('0x13')];this[_0x1c68('0x14')]=_0x1f81f6[_0x1c68('0x14')];this[_0x1c68('0x15')]=_0x1f81f6['voiceExtensions'];this[_0x1c68('0x16')]=_0x1f81f6['zendeskAccounts'];this[_0x1c68('0x17')]=_0x1f81f6['freshdeskAccounts'];this['salesforceAccounts']=_0x1f81f6[_0x1c68('0x18')];this[_0x1c68('0x19')]=_0x1f81f6[_0x1c68('0x19')];this[_0x1c68('0x1a')]=_0x1f81f6[_0x1c68('0x1a')];this[_0x1c68('0x1b')]=_0x1f81f6[_0x1c68('0x1b')];this[_0x1c68('0x1c')]=_0x1f81f6[_0x1c68('0x1c')];this['servicenowAccounts']=_0x1f81f6[_0x1c68('0x1d')];this[_0x1c68('0x1e')]=_0x1f81f6[_0x1c68('0x1e')];this[_0x1c68('0x1f')]=_0x1f81f6[_0x1c68('0x1f')];this[_0x1c68('0x20')]={'zendesk':this[_0x1c68('0x16')],'salesforce':this[_0x1c68('0x18')],'freshdesk':this[_0x1c68('0x17')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x1c68('0x1b')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x1c68('0x1e')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x1c68('0x1d')]};ami['on'](_0x1c68('0x21'),this['syncCustomEvent'][_0x1c68('0x22')](this));ami['on']('custom:agentconnect',this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x24'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on']('custom:agentcomplete',this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x25'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x26'),this[_0x1c68('0x23')]['bind'](this));ami['on'](_0x1c68('0x27'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x28'),this[_0x1c68('0x23')]['bind'](this));ami['on'](_0x1c68('0x29'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x2a'),this['syncCustomEvent'][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x2b'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x2c'),this[_0x1c68('0x2d')]['bind'](this));ami['on'](_0x1c68('0x2e'),this[_0x1c68('0x2d')][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x2f'),this[_0x1c68('0x2d')][_0x1c68('0x22')](this));ami['on']('custom:newinteraction',this[_0x1c68('0x23')]['bind'](this));ami['on'](_0x1c68('0x30'),this[_0x1c68('0x23')]['bind'](this));ami['on'](_0x1c68('0x31'),this[_0x1c68('0x23')]['bind'](this));ami['on'](_0x1c68('0x32'),this['syncCustomEvent'][_0x1c68('0x22')](this));ami['on'](_0x1c68('0x33'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x1c68('0x34'),this[_0x1c68('0x23')][_0x1c68('0x22')](this));}Trigger[_0x1c68('0x35')]['emit']=function(_0x526f92,_0x18e79b,_0x29fd8a){logger[_0x1c68('0x36')](_0x526f92,_0x18e79b,JSON[_0x1c68('0x37')](_0x29fd8a));io['to'](_0x526f92)[_0x1c68('0x38')](_0x18e79b,_0x29fd8a);};Trigger['prototype'][_0x1c68('0x23')]=function(_0x50d8a3){var _0x1e1b2e=_[_0x1c68('0x39')](_0x50d8a3);if(typeof _0x1e1b2e[_0x1c68('0x3a')]==='undefined'){_0x1e1b2e['motionChannel']='voice';}this[_0x1c68('0x3b')](_0x1e1b2e);};Trigger[_0x1c68('0x35')][_0x1c68('0x2d')]=function(_0x42cb6a){if(this[_0x1c68('0x12')][_0x42cb6a[_0x1c68('0x3c')]]){this[_0x1c68('0x23')](_0x42cb6a);}};Trigger[_0x1c68('0x35')]['checkTriggers']=function(_0x4ffb10){var _0x52bbc5;for(var _0x1ec5cb in this['triggers']){if(this[_0x1c68('0x11')][_0x1c68('0x3d')](_0x1ec5cb)){if(this[_0x1c68('0x11')][_0x1ec5cb][_0x1c68('0x3e')]){_0x52bbc5=this['checkTrigger'](this[_0x1c68('0x11')][_0x1ec5cb],_0x4ffb10);if(_0x52bbc5){_[_0x1c68('0x3f')](_0x4ffb10,_0x4ffb10[_0x1c68('0x40')]);for(var _0x39b432=0x0,_0x1a6e72,_0x927ba,_0x2d838a;_0x39b4320x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x8a9468,_0x3fa139){var _0x4a6408=function(_0x20eec3){while(--_0x20eec3){_0x8a9468['push'](_0x8a9468['shift']());}};_0x4a6408(++_0x3fa139);}(_0x814b,0x1a2));var _0xb814=function(_0x5f0f7a,_0x244c53){_0x5f0f7a=_0x5f0f7a-0x0;var _0x8742e7=_0x814b[_0x5f0f7a];return _0x8742e7;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e957618..13f3413 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 _0xd345=[']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','info',']\x20Agent\x20found\x20',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','userId','systemuserid','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','type','customField','idField','toLowerCase','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none'];(function(_0x36e14d,_0x19e3c6){var _0x564005=function(_0x15c240){while(--_0x15c240){_0x36e14d['push'](_0x36e14d['shift']());}};_0x564005(++_0x19e3c6);}(_0xd345,0xd9));var _0x5d34=function(_0x56e6a0,_0x3a5065){_0x56e6a0=_0x56e6a0-0x0;var _0x33b8be=_0xd345[_0x56e6a0];return _0x33b8be;};'use strict';var _=require(_0x5d34('0x0'));var BPromise=require(_0x5d34('0x1'));var rp=require(_0x5d34('0x2'));var util=require(_0x5d34('0x3'));var intUtil=require(_0x5d34('0x4'));var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x5d34('0x5'));var config=require(_0x5d34('0x6'));config['redis']=_[_0x5d34('0x7')](config[_0x5d34('0x8')],{'host':_0x5d34('0x9'),'port':0x18eb});var io=require(_0x5d34('0xa'))(new Redis(config[_0x5d34('0x8')]));function getAuthToken(_0x46e144,_0x55a85f,_0x28647d){var _0x3116c0={'method':_0x5d34('0xb'),'uri':_0x55a85f,'form':{'client_id':_0x46e144[_0x5d34('0xc')],'resource':_0x46e144[_0x5d34('0xd')],'username':_0x46e144[_0x5d34('0xe')],'password':_0x46e144[_0x5d34('0xf')],'grant_type':'password','client_secret':_0x46e144[_0x5d34('0x10')]},'json':!![]};return rp(_0x3116c0)[_0x5d34('0x11')](function(_0x5bd643){return _0x5bd643[_0x5d34('0x12')];})[_0x5d34('0x13')](function(_0x2f3c90){logger[_0x5d34('0x14')]('['+[_0x28647d[_0x5d34('0x15')]()]+_0x5d34('0x16'));return _0x2f3c90[_0x5d34('0x17')];});}function getUser(_0x100db6,_0x8b53,_0x5590a2,_0x5c1cb7,_0x540555,_0x5729f1){return new BPromise(function(_0x27c20c,_0x164ea4){return getAuthToken(_0x8b53,_0x5c1cb7,_0x5729f1)['then'](function(_0x3b33e2){var _0x54f616={'method':_0x5d34('0x18'),'uri':_0x540555+_0x5d34('0x19'),'headers':{'Authorization':_0x5d34('0x1a')+_0x3b33e2,'OData-Version':_0x5d34('0x1b')},'json':!![]};return rp(_0x54f616);})[_0x5d34('0x11')](function(_0x56d2da){var _0x9ebbf1=_0x56d2da[_0x5d34('0x1c')];var _0x405e6d=![];var _0x419329=null;if(!_[_0x5d34('0x1d')](_0x5590a2)){if(intUtil[_0x5d34('0x1e')](_0x5590a2[_0x5d34('0x1f')])){_0x100db6[_0x5d34('0x20')]=_0x5590a2[_0x5d34('0x1f')];for(_0x419329=0x0;_0x419329<_0x9ebbf1['length'];_0x419329++){if(_0x9ebbf1[_0x419329]['internalemailaddress']===_0x5590a2['email']&&!_0x9ebbf1[_0x419329]['isdisabled']){_0x405e6d=!![];logger[_0x5d34('0x21')]('['+[_0x5729f1['toUpperCase']()]+_0x5d34('0x22')+_0x9ebbf1[_0x419329]['systemuserid']+'!');_0x100db6['userId']=_0x9ebbf1[_0x419329]['systemuserid'];}}}}if(!_0x405e6d){logger['info']('['+[_0x5729f1[_0x5d34('0x15')]()]+_0x5d34('0x23'));_0x100db6[_0x5d34('0x20')]=_0x8b53[_0x5d34('0xe')];for(_0x419329=0x0;_0x419329<_0x9ebbf1[_0x5d34('0x24')];_0x419329++){if(_0x9ebbf1[_0x419329][_0x5d34('0x25')]===_0x8b53['username']){_0x100db6[_0x5d34('0x26')]=_0x9ebbf1[_0x419329][_0x5d34('0x27')];}}}_0x27c20c(_0x100db6);})[_0x5d34('0x13')](function(_0x379416){_0x164ea4(_0x379416['message']);});});}function createEndUser(_0x551eec,_0x5457d9,_0x29da77,_0x5123a4,_0x40c788,_0x3131ec){return new BPromise(function(_0x166c8e,_0x18a575){return getAuthToken(_0x5457d9,_0x29da77,_0x3131ec)[_0x5d34('0x11')](function(_0x17752e){var _0x558244=_0x3131ec['toLowerCase']()==='outbound'?_0x40c788['destcalleridnum']:_0x40c788[_0x5d34('0x28')];var _0x31f516={'method':_0x5d34('0xb'),'uri':_0x5123a4+_0x5d34('0x29'),'body':{'telephone1':_0x558244,'fullname':_0x558244,'firstname':_0x558244,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5d34('0x2a')+_0x551eec[_0x5d34('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x17752e,'OData-Version':_0x5d34('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x31f516);})[_0x5d34('0x11')](function(_0x59f88c){var _0x49fba9=_0x59f88c[_0x5d34('0x2b')][_0x5d34('0x2c')];var _0x693ee0=_0x49fba9[_0x5d34('0x2d')](_0x49fba9[_0x5d34('0x2e')]('(')+0x1,_0x49fba9['lastIndexOf'](')'));_0x551eec[_0x5d34('0x2f')]=_0x693ee0;_0x166c8e(_0x551eec);})[_0x5d34('0x13')](function(_0x2f505a){_0x18a575(_0x2f505a[_0x5d34('0x17')]);});});}function getEndUser(_0x1bec50,_0x35f6d6,_0x5ae9bb,_0x51bb13,_0x148d5f,_0x1aa4ba){return new BPromise(function(_0x33d16c,_0xf0ac79){var _0x192c57=_0x1aa4ba['toLowerCase']()===_0x5d34('0x30')?_0x148d5f[_0x5d34('0x31')]:_0x148d5f[_0x5d34('0x28')];return getAuthToken(_0x35f6d6,_0x5ae9bb,_0x1aa4ba)['then'](function(_0xae1d3d){var _0xfee5aa={'method':'GET','uri':_0x51bb13+_0x5d34('0x32')+_0x192c57[_0x5d34('0x33')]('+','%2b')+'\x27','headers':{'Authorization':_0x5d34('0x1a')+_0xae1d3d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xfee5aa);})[_0x5d34('0x11')](function(_0x433bf9){var _0x38f5b7=null;if(_0x433bf9){var _0x22b229=_0x433bf9[_0x5d34('0x1c')];var _0xa8fac3=![];for(_0x38f5b7=0x0;_0x38f5b7<_0x22b229[_0x5d34('0x24')];_0x38f5b7++){if(_0x22b229[_0x38f5b7]['telephone1']===_0x192c57){_0xa8fac3=!![];_0x1bec50[_0x5d34('0x2f')]=_0x22b229[_0x38f5b7][_0x5d34('0x34')];}}if(_0xa8fac3){_0x33d16c(_0x1bec50);}else{return createEndUser(_0x1bec50,_0x35f6d6,_0x5ae9bb,_0x51bb13,_0x148d5f,_0x1aa4ba)[_0x5d34('0x11')](function(_0x12ef2c){logger['info']('['+[_0x1aa4ba[_0x5d34('0x15')]()]+_0x5d34('0x35'),_0x12ef2c['enduserId']);_0x33d16c(_0x12ef2c);});}}else{return createEndUser(_0x1bec50,_0x35f6d6,_0x5ae9bb,_0x51bb13,_0x148d5f,_0x1aa4ba)[_0x5d34('0x11')](function(_0x5668bf){logger['info']('['+[_0x1aa4ba[_0x5d34('0x15')]()]+_0x5d34('0x36'),_0x5668bf['enduserId']);_0x33d16c(_0x5668bf);});}});});}function getCustomFields(_0x546839,_0xb380ce,_0x16bd1a){var _0x4d49ea={};if(_0x546839['length']>0x0){_[_0x5d34('0x37')](_0x546839,function(_0x54e3ce){if(_[_0x5d34('0x38')]([_0x5d34('0x39'),'picklist'],_0x54e3ce[_0x5d34('0x3a')])&&_0x54e3ce['nameField']&&!_0x54e3ce[_0x5d34('0x3b')]){var _0x24059b=_0x54e3ce[_0x5d34('0x3c')][_0x5d34('0x3d')]();var _0x4918ea=_0x24059b[_0x5d34('0x2d')](0x0,_0x24059b[_0x5d34('0x3e')]('_'));var _0x25faf4=_0x24059b[_0x5d34('0x2d')](_0x24059b[_0x5d34('0x3e')]('_')+0x1);if(_0x4918ea===_0x16bd1a){_0x4d49ea[_0x25faf4]=_0x54e3ce[_0x5d34('0x3f')];}}});}return _0x4d49ea;}function getTicket(_0x3f0b26,_0x10c97d,_0x29e4d6,_0xdcd55,_0x92de1b,_0x52febf,_0x1cbe8f){return new BPromise(function(_0x1968d9,_0x5309f8){var _0x1b55cc;return getAuthToken(_0x10c97d,_0x29e4d6,_0x1cbe8f)[_0x5d34('0x11')](function(_0xb5184d){if(_0x52febf['ticketType']===_0x5d34('0x40')){_0x1b55cc={'method':_0x5d34('0xb'),'uri':_0xdcd55+_0x5d34('0x41'),'body':Object[_0x5d34('0x42')]({},{'title':intUtil[_0x5d34('0x43')](_0x52febf[_0x5d34('0x44')],_0x92de1b,'\x20'),'description':intUtil[_0x5d34('0x43')](_0x52febf[_0x5d34('0x45')],_0x92de1b,'\x0a'),'customerid_contact@odata.bind':_0x5d34('0x46')+_0x3f0b26[_0x5d34('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x3f0b26[_0x5d34('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x52febf[_0x5d34('0x47')],_0x92de1b,_0x52febf[_0x5d34('0x48')])),'headers':{'Authorization':_0x5d34('0x1a')+_0xb5184d,'OData-Version':_0x5d34('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x52febf['ticketType']===_0x5d34('0x49')){_0x1b55cc={'method':_0x5d34('0xb'),'uri':_0xdcd55+_0x5d34('0x4a'),'body':Object['assign']({},{'subject':intUtil[_0x5d34('0x43')](_0x52febf[_0x5d34('0x44')],_0x92de1b,'\x20'),'phonenumber':String(_0x92de1b[_0x5d34('0x28')]),'description':intUtil[_0x5d34('0x43')](_0x52febf[_0x5d34('0x45')],_0x92de1b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5d34('0x46')+_0x3f0b26[_0x5d34('0x2f')]+')','ownerid@odata.bind':_0x5d34('0x2a')+_0x3f0b26['userId']+')','directioncode':_0x3f0b26[_0x5d34('0x4b')]===_0x5d34('0x4c')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3f0b26[_0x5d34('0x26')]+')','participationtypemask':_0x3f0b26[_0x5d34('0x4b')]===_0x5d34('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x5d34('0x46')+_0x3f0b26[_0x5d34('0x2f')]+')','participationtypemask':_0x3f0b26[_0x5d34('0x4b')]==='queue'?0x1:0x2}]},getCustomFields(_0x52febf[_0x5d34('0x47')],_0x92de1b,_0x52febf[_0x5d34('0x48')])),'headers':{'Authorization':'Bearer\x20'+_0xb5184d,'OData-Version':_0x5d34('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b55cc);})['then'](function(_0x22c7f1){var _0x245e1d=_0x22c7f1[_0x5d34('0x2b')]['odata-entityid'];var _0x2b75b6=_0x245e1d[_0x5d34('0x2d')](_0x245e1d['lastIndexOf']('(')+0x1,_0x245e1d[_0x5d34('0x2e')](')'));_0x3f0b26[_0x5d34('0x4d')]=_0x2b75b6;_0x1968d9(_0x3f0b26);})[_0x5d34('0x13')](function(_0x54679e){_0x5309f8(_0x54679e['message']);});});}function emit(_0x471c96,_0x3b4d56,_0x2f2213,_0x2dc493){var _0x29362e={'uri':util[_0x5d34('0x4e')](_0x5d34('0x4f'),_0x471c96,_0x2f2213,_0x2dc493)};io['to'](util[_0x5d34('0x4e')](_0x5d34('0x50'),_0x3b4d56))[_0x5d34('0x51')]('trigger:browser:url',_0x29362e);}exports['cs']=function(_0x5357cf,_0x2d160f,_0x53e258,_0x219d99,_0xc39326,_0x2c3bff,_0x1024b0,_0x51d490){var _0x354598={};_0x2c3bff[_0x5d34('0xd')]=intUtil[_0x5d34('0x52')](_0x2c3bff[_0x5d34('0xd')]);_0x2c3bff[_0x5d34('0x53')]=intUtil[_0x5d34('0x52')](_0x2c3bff[_0x5d34('0x53')]);_0x354598[_0x5d34('0x4b')]=_0x51d490===_0x5d34('0x4c')||_0x51d490===_0x5d34('0x54')?_0x5d34('0x4c'):_0x5d34('0x30');var _0x2d8896=util['format']('%s/api/data/v9.0/',_0x2c3bff[_0x5d34('0xd')]);var _0x28fce6=util['format'](_0x5d34('0x55'),_0x2c3bff[_0x5d34('0x56')]);var _0x42f25b=util[_0x5d34('0x4e')](_0x5d34('0x57'),_0x2c3bff['serverUrl'],_0x2d160f[_0x5d34('0x58')],md5(_0x2d160f[_0x5d34('0x58')]));if(_0xc39326&&_0xc39326[_0x5d34('0x59')]){logger[_0x5d34('0x21')](_0x5d34('0x5a'),_0x5d34('0x5b'));_0x2d160f[_0x5d34('0x5c')]=_0x42f25b;}else if(_0x1024b0&&_0x1024b0[_0x5d34('0x5d')]&&_0x1024b0['recordingFormat']!==_0x5d34('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2d160f[_0x5d34('0x5c')]=_0x42f25b;}else{_0x2d160f[_0x5d34('0x5c')]='';}return getUser(_0x354598,_0x2c3bff,_0x219d99,_0x28fce6,_0x2d8896,_0x51d490)['then'](function(_0xe334ad){logger[_0x5d34('0x21')]('['+_0x51d490[_0x5d34('0x15')]()+_0x5d34('0x5f'),_0xe334ad[_0x5d34('0x26')]);logger[_0x5d34('0x21')]('['+_0x51d490[_0x5d34('0x15')]()+_0x5d34('0x60'),_0xe334ad[_0x5d34('0x20')]);return getEndUser(_0xe334ad,_0x2c3bff,_0x28fce6,_0x2d8896,_0x2d160f,_0x51d490);})[_0x5d34('0x11')](function(_0x5006cc){logger[_0x5d34('0x21')]('['+_0x51d490['toUpperCase']()+_0x5d34('0x61'),_0x5006cc[_0x5d34('0x2f')]);logger[_0x5d34('0x21')]('['+_0x51d490[_0x5d34('0x15')]()+_0x5d34('0x62'),_0x2d160f['calleridnum']);return getTicket(_0x5006cc,_0x2c3bff,_0x28fce6,_0x2d8896,_0x2d160f,_0x53e258,_0x51d490);})[_0x5d34('0x11')](function(_0xf71a59){logger[_0x5d34('0x21')](util[_0x5d34('0x4e')]('['+_0x51d490[_0x5d34('0x15')]()+_0x5d34('0x63'),_0x53e258[_0x5d34('0x48')],_0xf71a59[_0x5d34('0x4d')]));logger['info'](util[_0x5d34('0x4e')]('['+_0x51d490[_0x5d34('0x15')]()+_0x5d34('0x64'),_0x51d490));if(_0x51d490!==_0x5d34('0x54')){logger[_0x5d34('0x21')]('['+_0x51d490[_0x5d34('0x15')]()+']',_0x5d34('0x65'));emit(_0x2c3bff['remoteUri'],_0x219d99['name'],_0x53e258[_0x5d34('0x48')],_0xf71a59[_0x5d34('0x4d')]);}})[_0x5d34('0x13')](function(_0x1df697){logger[_0x5d34('0x14')]('['+_0x51d490['toUpperCase']()+_0x5d34('0x66'),util[_0x5d34('0x67')](_0x1df697,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5b39=['incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','queue','ticketId','catch','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','stripTrailingSlash','serverUrl','callDirection','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','../../../../config/logger','redis','defaults','localhost','POST','clientId','remoteUri','username','password','then','access_token','error','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','userId','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','message','calleridnum','GET','replace','%2b','value','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','picklist','type','nameField','idField','indexOf','content','ticketType'];(function(_0x533cbf,_0x1d85ca){var _0x2dc3ae=function(_0x597972){while(--_0x597972){_0x533cbf['push'](_0x533cbf['shift']());}};_0x2dc3ae(++_0x1d85ca);}(_0x5b39,0xea));var _0x95b3=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x5b39[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x95b3('0x0'));var BPromise=require(_0x95b3('0x1'));var rp=require(_0x95b3('0x2'));var util=require(_0x95b3('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x95b3('0x4'));var logger=require(_0x95b3('0x5'))('dynamics365');var config=require('../../../../config/environment');config[_0x95b3('0x6')]=_[_0x95b3('0x7')](config[_0x95b3('0x6')],{'host':_0x95b3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x95b3('0x6')]));function getAuthToken(_0x552ecc,_0x38e6ec,_0x4dcd9f){var _0x44dc60={'method':_0x95b3('0x9'),'uri':_0x38e6ec,'form':{'client_id':_0x552ecc[_0x95b3('0xa')],'resource':_0x552ecc[_0x95b3('0xb')],'username':_0x552ecc[_0x95b3('0xc')],'password':_0x552ecc[_0x95b3('0xd')],'grant_type':'password','client_secret':_0x552ecc['clientSecret']},'json':!![]};return rp(_0x44dc60)[_0x95b3('0xe')](function(_0x5580ea){return _0x5580ea[_0x95b3('0xf')];})['catch'](function(_0xb57f4){logger[_0x95b3('0x10')]('['+[_0x4dcd9f['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0xb57f4['message'];});}function getUser(_0x2a67b1,_0x747181,_0x48582b,_0x4b5724,_0x418b0e,_0x306ad0){return new BPromise(function(_0x1a1fbc,_0x253d51){return getAuthToken(_0x747181,_0x4b5724,_0x306ad0)['then'](function(_0x519143){var _0x35c00e={'method':'GET','uri':_0x418b0e+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x95b3('0x11')+_0x519143,'OData-Version':_0x95b3('0x12')},'json':!![]};return rp(_0x35c00e);})[_0x95b3('0xe')](function(_0x3aa866){var _0x41dd51=_0x3aa866['value'];var _0x371596=![];var _0x401942=null;if(!_[_0x95b3('0x13')](_0x48582b)){if(intUtil[_0x95b3('0x14')](_0x48582b[_0x95b3('0x15')])){_0x2a67b1['userEmail']=_0x48582b[_0x95b3('0x15')];for(_0x401942=0x0;_0x401942<_0x41dd51[_0x95b3('0x16')];_0x401942++){if(_0x41dd51[_0x401942][_0x95b3('0x17')]===_0x48582b[_0x95b3('0x15')]&&!_0x41dd51[_0x401942][_0x95b3('0x18')]){_0x371596=!![];logger[_0x95b3('0x19')]('['+[_0x306ad0[_0x95b3('0x1a')]()]+']\x20Agent\x20found\x20'+_0x41dd51[_0x401942][_0x95b3('0x1b')]+'!');_0x2a67b1['userId']=_0x41dd51[_0x401942]['systemuserid'];}}}}if(!_0x371596){logger[_0x95b3('0x19')]('['+[_0x306ad0[_0x95b3('0x1a')]()]+_0x95b3('0x1c'));_0x2a67b1[_0x95b3('0x1d')]=_0x747181[_0x95b3('0xc')];for(_0x401942=0x0;_0x401942<_0x41dd51['length'];_0x401942++){if(_0x41dd51[_0x401942][_0x95b3('0x17')]===_0x747181['username']){_0x2a67b1[_0x95b3('0x1e')]=_0x41dd51[_0x401942][_0x95b3('0x1b')];}}}_0x1a1fbc(_0x2a67b1);})['catch'](function(_0x328a74){_0x253d51(_0x328a74['message']);});});}function createEndUser(_0x12d860,_0x5c7c3f,_0x37090f,_0x15e235,_0x99bf06,_0x124f98){return new BPromise(function(_0x16cc79,_0x4330f4){return getAuthToken(_0x5c7c3f,_0x37090f,_0x124f98)[_0x95b3('0xe')](function(_0x4326e3){var _0x114ceb=_0x124f98[_0x95b3('0x1f')]()===_0x95b3('0x20')?_0x99bf06[_0x95b3('0x21')]:_0x99bf06['calleridnum'];var _0x207360={'method':'POST','uri':_0x15e235+_0x95b3('0x22'),'body':{'telephone1':_0x114ceb,'fullname':_0x114ceb,'firstname':_0x114ceb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x95b3('0x23')+_0x12d860[_0x95b3('0x1e')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4326e3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x207360);})[_0x95b3('0xe')](function(_0x579849){var _0x431f1a=_0x579849[_0x95b3('0x24')][_0x95b3('0x25')];var _0x141b25=_0x431f1a[_0x95b3('0x26')](_0x431f1a[_0x95b3('0x27')]('(')+0x1,_0x431f1a[_0x95b3('0x27')](')'));_0x12d860[_0x95b3('0x28')]=_0x141b25;_0x16cc79(_0x12d860);})['catch'](function(_0x108a65){_0x4330f4(_0x108a65[_0x95b3('0x29')]);});});}function getEndUser(_0x45d09b,_0x3e67c5,_0x1035af,_0x15f7ef,_0x4d2ca4,_0x185272){return new BPromise(function(_0x1269ff,_0x3dcbb6){var _0x2e321f=_0x185272[_0x95b3('0x1f')]()===_0x95b3('0x20')?_0x4d2ca4[_0x95b3('0x21')]:_0x4d2ca4[_0x95b3('0x2a')];return getAuthToken(_0x3e67c5,_0x1035af,_0x185272)[_0x95b3('0xe')](function(_0x4b5e75){var _0x408a84={'method':_0x95b3('0x2b'),'uri':_0x15f7ef+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x2e321f[_0x95b3('0x2c')]('+',_0x95b3('0x2d'))+'\x27','headers':{'Authorization':_0x95b3('0x11')+_0x4b5e75,'If-None-Match':null,'OData-Version':_0x95b3('0x12')},'json':!![]};return rp(_0x408a84);})[_0x95b3('0xe')](function(_0x186f33){var _0x4b6594=null;if(_0x186f33){var _0x2a472f=_0x186f33[_0x95b3('0x2e')];var _0x37a174=![];for(_0x4b6594=0x0;_0x4b6594<_0x2a472f[_0x95b3('0x16')];_0x4b6594++){if(_0x2a472f[_0x4b6594][_0x95b3('0x2f')]===_0x2e321f){_0x37a174=!![];_0x45d09b[_0x95b3('0x28')]=_0x2a472f[_0x4b6594][_0x95b3('0x30')];}}if(_0x37a174){_0x1269ff(_0x45d09b);}else{return createEndUser(_0x45d09b,_0x3e67c5,_0x1035af,_0x15f7ef,_0x4d2ca4,_0x185272)[_0x95b3('0xe')](function(_0x204a3a){logger[_0x95b3('0x19')]('['+[_0x185272[_0x95b3('0x1a')]()]+_0x95b3('0x31'),_0x204a3a[_0x95b3('0x28')]);_0x1269ff(_0x204a3a);});}}else{return createEndUser(_0x45d09b,_0x3e67c5,_0x1035af,_0x15f7ef,_0x4d2ca4,_0x185272)['then'](function(_0x362867){logger[_0x95b3('0x19')]('['+[_0x185272[_0x95b3('0x1a')]()]+_0x95b3('0x32'),_0x362867[_0x95b3('0x28')]);_0x1269ff(_0x362867);});}});});}function getCustomFields(_0x8b3f03,_0x1a3cd4,_0x19a4a3){var _0x45bc49={};if(_0x8b3f03['length']>0x0){_[_0x95b3('0x33')](_0x8b3f03,function(_0x3981f8){if(_['includes']([_0x95b3('0x34'),_0x95b3('0x35')],_0x3981f8[_0x95b3('0x36')])&&_0x3981f8[_0x95b3('0x37')]&&!_0x3981f8['customField']){var _0x46820b=_0x3981f8[_0x95b3('0x38')][_0x95b3('0x1f')]();var _0x2b18a2=_0x46820b[_0x95b3('0x26')](0x0,_0x46820b[_0x95b3('0x39')]('_'));var _0x21bdad=_0x46820b[_0x95b3('0x26')](_0x46820b[_0x95b3('0x39')]('_')+0x1);if(_0x2b18a2===_0x19a4a3){_0x45bc49[_0x21bdad]=_0x3981f8[_0x95b3('0x3a')];}}});}return _0x45bc49;}function getTicket(_0x25f852,_0x55a4c8,_0x133dc1,_0x1ea0c8,_0x494ec0,_0x1e623d,_0x1387bb){return new BPromise(function(_0x1e7462,_0x221cbb){var _0x531992;return getAuthToken(_0x55a4c8,_0x133dc1,_0x1387bb)['then'](function(_0x24aa2c){if(_0x1e623d[_0x95b3('0x3b')]===_0x95b3('0x3c')){_0x531992={'method':_0x95b3('0x9'),'uri':_0x1ea0c8+_0x95b3('0x3d'),'body':Object[_0x95b3('0x3e')]({},{'title':intUtil[_0x95b3('0x3f')](_0x1e623d[_0x95b3('0x40')],_0x494ec0,'\x20'),'description':intUtil[_0x95b3('0x3f')](_0x1e623d[_0x95b3('0x41')],_0x494ec0,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x25f852[_0x95b3('0x28')]+')','ownerid@odata.bind':_0x95b3('0x23')+_0x25f852[_0x95b3('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x1e623d[_0x95b3('0x42')],_0x494ec0,_0x1e623d[_0x95b3('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x24aa2c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1e623d[_0x95b3('0x3b')]===_0x95b3('0x43')){_0x531992={'method':_0x95b3('0x9'),'uri':_0x1ea0c8+_0x95b3('0x44'),'body':Object[_0x95b3('0x3e')]({},{'subject':intUtil['getString'](_0x1e623d[_0x95b3('0x40')],_0x494ec0,'\x20'),'phonenumber':String(_0x494ec0[_0x95b3('0x2a')]),'description':intUtil['getString'](_0x1e623d[_0x95b3('0x41')],_0x494ec0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x95b3('0x45')+_0x25f852[_0x95b3('0x28')]+')','ownerid@odata.bind':_0x95b3('0x23')+_0x25f852[_0x95b3('0x1e')]+')','directioncode':_0x25f852['callDirection']===_0x95b3('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x95b3('0x23')+_0x25f852[_0x95b3('0x1e')]+')','participationtypemask':_0x25f852['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x95b3('0x45')+_0x25f852[_0x95b3('0x28')]+')','participationtypemask':_0x25f852['callDirection']===_0x95b3('0x46')?0x1:0x2}]},getCustomFields(_0x1e623d[_0x95b3('0x42')],_0x494ec0,_0x1e623d[_0x95b3('0x3b')])),'headers':{'Authorization':_0x95b3('0x11')+_0x24aa2c,'OData-Version':_0x95b3('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x531992);})[_0x95b3('0xe')](function(_0x395675){var _0x1993c2=_0x395675[_0x95b3('0x24')][_0x95b3('0x25')];var _0x5e620a=_0x1993c2[_0x95b3('0x26')](_0x1993c2['lastIndexOf']('(')+0x1,_0x1993c2[_0x95b3('0x27')](')'));_0x25f852[_0x95b3('0x47')]=_0x5e620a;_0x1e7462(_0x25f852);})[_0x95b3('0x48')](function(_0x367b72){_0x221cbb(_0x367b72[_0x95b3('0x29')]);});});}function emit(_0x32f7df,_0x342700,_0x5f59c7,_0x33c9d5){var _0x5c40c8={'uri':util[_0x95b3('0x49')](_0x95b3('0x4a'),_0x32f7df,_0x5f59c7,_0x33c9d5)};io['to'](util[_0x95b3('0x49')]('user:%s',_0x342700))['emit']('trigger:browser:url',_0x5c40c8);}exports['cs']=function(_0x13ba5c,_0x3e40e5,_0x1bd613,_0x59ae5c,_0x4b06ee,_0x8b938f,_0x402ff3,_0x258da0){var _0x5c91e2={};_0x8b938f[_0x95b3('0xb')]=intUtil[_0x95b3('0x4b')](_0x8b938f[_0x95b3('0xb')]);_0x8b938f[_0x95b3('0x4c')]=intUtil[_0x95b3('0x4b')](_0x8b938f[_0x95b3('0x4c')]);_0x5c91e2[_0x95b3('0x4d')]=_0x258da0===_0x95b3('0x46')||_0x258da0===_0x95b3('0x4e')?'queue':_0x95b3('0x20');var _0x1efbad=util[_0x95b3('0x49')](_0x95b3('0x4f'),_0x8b938f['remoteUri']);var _0x1b367d=util['format'](_0x95b3('0x50'),_0x8b938f[_0x95b3('0x51')]);var _0x3a615e=util[_0x95b3('0x49')](_0x95b3('0x52'),_0x8b938f['serverUrl'],_0x3e40e5[_0x95b3('0x53')],md5(_0x3e40e5['uniqueid']));if(_0x4b06ee&&_0x4b06ee[_0x95b3('0x54')]){logger[_0x95b3('0x19')]('[QUEUE]',_0x95b3('0x55'));_0x3e40e5[_0x95b3('0x56')]=_0x3a615e;}else if(_0x402ff3&&_0x402ff3[_0x95b3('0x57')]&&_0x402ff3[_0x95b3('0x57')]!==_0x95b3('0x58')){logger[_0x95b3('0x19')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3e40e5[_0x95b3('0x56')]=_0x3a615e;}else{_0x3e40e5['recordingURL']='';}return getUser(_0x5c91e2,_0x8b938f,_0x59ae5c,_0x1b367d,_0x1efbad,_0x258da0)[_0x95b3('0xe')](function(_0x985b81){logger[_0x95b3('0x19')]('['+_0x258da0[_0x95b3('0x1a')]()+_0x95b3('0x59'),_0x985b81[_0x95b3('0x1e')]);logger[_0x95b3('0x19')]('['+_0x258da0[_0x95b3('0x1a')]()+_0x95b3('0x5a'),_0x985b81['userEmail']);return getEndUser(_0x985b81,_0x8b938f,_0x1b367d,_0x1efbad,_0x3e40e5,_0x258da0);})[_0x95b3('0xe')](function(_0x1cbc01){logger[_0x95b3('0x19')]('['+_0x258da0[_0x95b3('0x1a')]()+_0x95b3('0x5b'),_0x1cbc01[_0x95b3('0x28')]);logger[_0x95b3('0x19')]('['+_0x258da0[_0x95b3('0x1a')]()+_0x95b3('0x5c'),_0x3e40e5[_0x95b3('0x2a')]);return getTicket(_0x1cbc01,_0x8b938f,_0x1b367d,_0x1efbad,_0x3e40e5,_0x1bd613,_0x258da0);})['then'](function(_0x402c04){logger['info'](util[_0x95b3('0x49')]('['+_0x258da0['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1bd613[_0x95b3('0x3b')],_0x402c04[_0x95b3('0x47')]));logger[_0x95b3('0x19')](util[_0x95b3('0x49')]('['+_0x258da0[_0x95b3('0x1a')]()+_0x95b3('0x5d'),_0x258da0));if(_0x258da0!=='unmanaged'){logger[_0x95b3('0x19')]('['+_0x258da0[_0x95b3('0x1a')]()+']',_0x95b3('0x5e'));emit(_0x8b938f['remoteUri'],_0x59ae5c[_0x95b3('0x5f')],_0x1bd613[_0x95b3('0x3b')],_0x402c04[_0x95b3('0x47')]);}})['catch'](function(_0xc4718){logger[_0x95b3('0x10')]('['+_0x258da0[_0x95b3('0x1a')]()+_0x95b3('0x60'),util[_0x95b3('0x61')](_0xc4718,{'showHidden':!![],'depth':null}));});}; \ 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 2e4bdfe..632925a 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 _0x475e=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','catch','[OUTBOUND]','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','custom_fields','mapValues','value','remoteUri','POST','info','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','then','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','includes','nameField','customField','toLowerCase','picklist','type','idField','push','variableName','Variable','name','queue'];(function(_0x33d918,_0x52d31f){var _0x18f03a=function(_0x5a8031){while(--_0x5a8031){_0x33d918['push'](_0x33d918['shift']());}};_0x18f03a(++_0x52d31f);}(_0x475e,0x11f));var _0xe475=function(_0x71a66d,_0x4ca941){_0x71a66d=_0x71a66d-0x0;var _0x16f07f=_0x475e[_0x71a66d];return _0x16f07f;};'use strict';var _=require(_0xe475('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xe475('0x1'));var Redis=require(_0xe475('0x2'));var intUtil=require(_0xe475('0x3'));var config=require(_0xe475('0x4'));var logger=require(_0xe475('0x5'))(_0xe475('0x6'));config[_0xe475('0x7')]=_[_0xe475('0x8')](config[_0xe475('0x7')],{'host':_0xe475('0x9'),'port':0x18eb});var io=require(_0xe475('0xa'))(new Redis(config[_0xe475('0x7')]));var headers={'Content-Type':_0xe475('0xb'),'Accept':_0xe475('0xb')};function emit(_0x25c8f4,_0x4b45a5,_0x4abaa3){io['to'](_0x25c8f4)[_0xe475('0xc')](_0x4b45a5,_0x4abaa3);}function getTicket(_0x45dafa,_0x4d7b50,_0x12ab43,_0x1e483c,_0x278e4e){logger['info'](_0xe475('0xd'));var _0x2c7d79=_['merge']({'responder_id':_0x4d7b50['id'],'requester_id':_0x12ab43['id'],'name':util[_0xe475('0xe')](_0xe475('0xf'),_0x278e4e[_0xe475('0x10')]),'phone':_0x278e4e[_0xe475('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe475('0x12')](_0x1e483c['Subjects'],_0x278e4e,'\x20'),'description':intUtil['getString'](_0x1e483c[_0xe475('0x13')],_0x278e4e,_0xe475('0x14')),'tags':getTags(_0x1e483c[_0xe475('0x15')],'name')},getCustomFields(_0x1e483c['Fields'],_0x278e4e));_0x2c7d79[_0xe475('0x16')]=_[_0xe475('0x17')](_['keyBy'](_0x2c7d79[_0xe475('0x16')],'id'),_0xe475('0x18'));return request({'uri':util['format']('%s/api/v2/tickets',_0x45dafa[_0xe475('0x19')]),'method':_0xe475('0x1a'),'body':_0x2c7d79})['then'](function(_0x25a9f9){logger[_0xe475('0x1b')]('Ticket\x20created!');return _0x25a9f9;});}function getUser(_0xe2d7ae,_0x55193e){if(intUtil[_0xe475('0x1c')](_0x55193e)){return request({'uri':util[_0xe475('0xe')](_0xe475('0x1d'),_0xe2d7ae[_0xe475('0x19')]),'qs':{'email':_0x55193e}})['then'](function(_0x2bccb8){if(_0x2bccb8[_0xe475('0x1e')]){logger['info'](_0xe475('0x1f'));return _[_0xe475('0x20')](_0x2bccb8,function(_0x28e972){return _0x28e972['contact']['email']===_0x55193e;});}else{logger[_0xe475('0x1b')](_0xe475('0x21'));return request({'uri':util[_0xe475('0xe')](_0xe475('0x22'),_0xe2d7ae[_0xe475('0x19')])})['then'](function(_0x5b38f9){logger['info']('Admin\x20account\x20selected.');return _0x5b38f9;});}});}else{logger['info'](_0xe475('0x23'));return request({'uri':util['format'](_0xe475('0x22'),_0xe2d7ae[_0xe475('0x19')])})[_0xe475('0x24')](function(_0x19dd10){logger[_0xe475('0x1b')](_0xe475('0x25'));return _0x19dd10;});}}function getEndUser(_0x46bde0,_0x403a66,_0x2271b3){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2271b3);return request({'uri':util[_0xe475('0xe')](_0xe475('0x26'),_0x46bde0['remoteUri']),'qs':{'phone':_0x2271b3}})[_0xe475('0x24')](function(_0x1f7279){if(_0x1f7279['length']){logger[_0xe475('0x1b')](_0xe475('0x27'));return _[_0xe475('0x20')](_0x1f7279,{'phone':_0x2271b3});}else{logger[_0xe475('0x1b')](_0xe475('0x28'));return request({'uri':util[_0xe475('0xe')](_0xe475('0x26'),_0x46bde0[_0xe475('0x19')]),'method':_0xe475('0x1a'),'body':{'name':_0x403a66,'phone':_0x2271b3}})['then'](function(_0x57505f){logger['info']('Enduser\x20created.');return _0x57505f;});}});}function getAuth(_0x7c623a){return util[_0xe475('0xe')](_0xe475('0x29'),new Buffer(_0x7c623a[_0xe475('0x2a')]+':X')[_0xe475('0x2b')](_0xe475('0x2c')));}function request(_0x58a52d){logger[_0xe475('0x2d')](_0xe475('0x2e'),JSON[_0xe475('0x2f')](_0x58a52d));return rp(_[_0xe475('0x8')](_0x58a52d,{'method':_0xe475('0x30'),'headers':headers,'json':!![]}));}function getTags(_0xffa94e,_0x5a2a83){var _0x13e78a=[];if(_0xffa94e&&_0xffa94e[_0xe475('0x1e')]>0x0){_0x13e78a=_['map'](_0xffa94e,_0x5a2a83);}return _0x13e78a;}function getCustomFields(_0x521fde,_0x2ccbfb){var _0x2f5aa5=[];var _0x560621={'custom_fields':[]};if(_0x521fde[_0xe475('0x1e')]>0x0){_['forEach'](_0x521fde,function(_0x38a1d0){if(_[_0xe475('0x31')](['string','picklist'],_0x38a1d0['type'])&&_0x38a1d0[_0xe475('0x32')]&&!_0x38a1d0[_0xe475('0x33')]){_0x560621[_0x38a1d0[_0xe475('0x32')][_0xe475('0x34')]()]=_0x38a1d0['content'][_0xe475('0x2b')]();}else if(_[_0xe475('0x31')](['string',_0xe475('0x35')],_0x38a1d0[_0xe475('0x36')])&&_0x38a1d0[_0xe475('0x37')]&&_0x38a1d0[_0xe475('0x33')]){_0x560621[_0xe475('0x16')][_0xe475('0x38')]({'id':_0x38a1d0['idField'],'value':_0x38a1d0['content'][_0xe475('0x2b')]()});}else if(_0x38a1d0[_0xe475('0x36')]==='variable'&&_0x38a1d0[_0xe475('0x39')]&&_0x38a1d0[_0xe475('0x37')]&&_0x38a1d0['customField']){_0x2ccbfb[_0x38a1d0[_0xe475('0x39')]]&&_0x560621['custom_fields'][_0xe475('0x38')]({'id':_0x38a1d0[_0xe475('0x37')],'value':_0x2ccbfb[_0x38a1d0['variableName']][_0xe475('0x2b')]()});}else if(_0x38a1d0[_0xe475('0x36')]==='customVariable'&&_0x38a1d0[_0xe475('0x3a')]&&_0x38a1d0[_0xe475('0x3a')][_0xe475('0x3b')]&&_0x38a1d0[_0xe475('0x37')]&&_0x38a1d0[_0xe475('0x33')]){_0x2ccbfb[_0x38a1d0['Variable'][_0xe475('0x3b')]['toLowerCase']()]&&_0x560621[_0xe475('0x16')][_0xe475('0x38')]({'id':_0x38a1d0[_0xe475('0x37')],'value':_0x2ccbfb[_0x38a1d0[_0xe475('0x3a')][_0xe475('0x3b')]['toLowerCase']()][_0xe475('0x2b')]()});}});}return _0x560621;}exports[_0xe475('0x3c')]=function(_0x53d9ed,_0x13a19b,_0x373f01,_0x1097b3,_0x5bb2de,_0x1281d4){var _0x2ea011,_0x117f37;_0x1281d4[_0xe475('0x19')]=intUtil[_0xe475('0x3d')](_0x1281d4[_0xe475('0x19')]);_0x1281d4[_0xe475('0x3e')]=intUtil['stripTrailingSlash'](_0x1281d4[_0xe475('0x3e')]);if(_0x5bb2de&&_0x5bb2de[_0xe475('0x3f')]){logger[_0xe475('0x1b')](_0xe475('0x40'),'Recording\x20is\x20enabled!');_0x13a19b[_0xe475('0x41')]=util['format'](_0xe475('0x42'),_0x1281d4[_0xe475('0x3e')],_0x13a19b[_0xe475('0x43')],md5(_0x13a19b[_0xe475('0x43')]));}else{_0x13a19b['recordingURL']='';}headers[_0xe475('0x44')]=getAuth(_0x1281d4);return getUser(_0x1281d4,_0x1097b3[_0xe475('0x45')])['then'](function(_0x45e4e0){_0x2ea011=_0x45e4e0;logger[_0xe475('0x1b')](_0xe475('0x46'),_0x2ea011['id']);return getEndUser(_0x1281d4,_0x13a19b['calleridname'],_0x13a19b[_0xe475('0x11')]);})['then'](function(_0x7f75fc){_0x117f37=_0x7f75fc;logger[_0xe475('0x1b')](_0xe475('0x47'),_0x117f37['id']);return getTicket(_0x1281d4,_0x2ea011,_0x117f37,_0x373f01,_0x13a19b);})[_0xe475('0x24')](function(_0x2c03b9){if(_0x2c03b9&&_0x2c03b9['id']){logger[_0xe475('0x1b')](_0xe475('0x48'));logger[_0xe475('0x1b')](_0xe475('0x49'),_0x2c03b9['id']);logger[_0xe475('0x1b')](_0xe475('0x40'),_0xe475('0x4a'));emit(util[_0xe475('0xe')](_0xe475('0x4b'),_0x1097b3[_0xe475('0x3b')]),_0xe475('0x4c'),{'uri':util[_0xe475('0xe')](_0xe475('0x4d'),_0x1281d4['remoteUri'],_0x2c03b9['id'])});}})['catch'](function(_0x3a0b22){logger[_0xe475('0x4e')]('[QUEUE]',JSON[_0xe475('0x2f')](_0x3a0b22));});};exports[_0xe475('0x4f')]=function(_0x4a3940,_0x169da,_0x3b07da,_0x7e67b0,_0x1ba495,_0x269c23,_0x343fd1){var _0x1ab9b0,_0x33d6b2;_0x269c23[_0xe475('0x19')]=intUtil[_0xe475('0x3d')](_0x269c23['remoteUri']);_0x269c23[_0xe475('0x3e')]=intUtil[_0xe475('0x3d')](_0x269c23[_0xe475('0x3e')]);if(_0x343fd1&&_0x343fd1[_0xe475('0x50')]&&_0x343fd1['recordingFormat']!=='none'){logger[_0xe475('0x1b')]('[OUTBOUND]',_0xe475('0x51'));_0x169da[_0xe475('0x41')]=util[_0xe475('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x269c23[_0xe475('0x3e')],_0x169da[_0xe475('0x43')],md5(_0x169da[_0xe475('0x43')]));}headers[_0xe475('0x44')]=getAuth(_0x269c23);return getUser(_0x269c23,_0x7e67b0[_0xe475('0x45')])['then'](function(_0x3fe7f4){_0x1ab9b0=_0x3fe7f4;logger[_0xe475('0x1b')](_0xe475('0x46'),_0x1ab9b0['id']);return getEndUser(_0x269c23,_0x169da[_0xe475('0x52')],_0x169da['destcalleridnum']);})[_0xe475('0x24')](function(_0x42b93d){_0x33d6b2=_0x42b93d;logger[_0xe475('0x1b')](_0xe475('0x47'),_0x33d6b2['id']);return getTicket(_0x269c23,_0x1ab9b0,_0x33d6b2,_0x3b07da,_0x169da);})['then'](function(_0x16f5eb){if(_0x16f5eb&&_0x16f5eb['id']){logger[_0xe475('0x1b')](_0xe475('0x48'));logger[_0xe475('0x1b')](_0xe475('0x49'),_0x16f5eb['id']);logger[_0xe475('0x1b')]('[OUTBOUND]',_0xe475('0x4a'));emit(util['format'](_0xe475('0x4b'),_0x7e67b0[_0xe475('0x3b')]),_0xe475('0x4c'),{'uri':util[_0xe475('0xe')](_0xe475('0x4d'),_0x269c23[_0xe475('0x19')],_0x16f5eb['id'])});}})[_0xe475('0x53')](function(_0x5811df){logger[_0xe475('0x4e')](_0xe475('0x54'),JSON[_0xe475('0x2f')](_0x5811df));});};exports['unmanaged']=function(_0x1f8b18,_0xaaa864,_0x2f2007,_0x2fc696,_0x543337,_0x59f673){var _0x11cf1a,_0x385cc3;_0x59f673[_0xe475('0x19')]=intUtil[_0xe475('0x3d')](_0x59f673[_0xe475('0x19')]);_0x59f673['serverUrl']=intUtil[_0xe475('0x3d')](_0x59f673[_0xe475('0x3e')]);if(_0x543337&&_0x543337[_0xe475('0x3f')]){logger['info']('['+_0xaaa864[_0xe475('0x55')][_0xe475('0x56')]()+']',_0xe475('0x51'));_0xaaa864['recordingURL']=util[_0xe475('0xe')](_0xe475('0x42'),_0x59f673[_0xe475('0x3e')],_0xaaa864[_0xe475('0x43')],md5(_0xaaa864['uniqueid']));}else{_0xaaa864[_0xe475('0x41')]='';}headers[_0xe475('0x44')]=getAuth(_0x59f673);return getUser(_0x59f673,'')[_0xe475('0x24')](function(_0xf82ad8){_0x11cf1a=_0xf82ad8;logger[_0xe475('0x1b')](_0xe475('0x46'),_0x11cf1a['id']);return getEndUser(_0x59f673,_0xaaa864[_0xe475('0x10')],_0xaaa864[_0xe475('0x11')]);})[_0xe475('0x24')](function(_0x4f7439){_0x385cc3=_0x4f7439;logger[_0xe475('0x1b')](_0xe475('0x47'),_0x385cc3['id']);return getTicket(_0x59f673,_0x11cf1a,_0x385cc3,_0x2f2007,_0xaaa864);})[_0xe475('0x24')](function(_0x2e383d){if(_0x2e383d){logger['info'](_0xe475('0x48'));logger[_0xe475('0x1b')](_0xe475('0x49'),_0x2e383d['id']);}})['catch'](function(_0x881213){logger[_0xe475('0x4e')]('['+_0xaaa864[_0xe475('0x55')][_0xe475('0x56')]()+']',JSON[_0xe475('0x2f')](_0x881213));});}; \ No newline at end of file +var _0xda8b=['string','picklist','type','nameField','customField','idField','push','content','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','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','outbound','recordingFormat','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','calleridnum','request-promise','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','then','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','length','map','forEach','includes'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xda8b,0xd5));var _0xbda8=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xda8b[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var rp=require(_0xbda8('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xbda8('0x1'));var intUtil=require('./util');var config=require(_0xbda8('0x2'));var logger=require(_0xbda8('0x3'))(_0xbda8('0x4'));config['redis']=_[_0xbda8('0x5')](config[_0xbda8('0x6')],{'host':_0xbda8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbda8('0x6')]));var headers={'Content-Type':_0xbda8('0x8'),'Accept':_0xbda8('0x8')};function emit(_0x1c6f88,_0x4cc401,_0x5a0a56){io['to'](_0x1c6f88)['emit'](_0x4cc401,_0x5a0a56);}function getTicket(_0x28deec,_0x524d66,_0x234407,_0x146f2,_0x14b31c){logger[_0xbda8('0x9')](_0xbda8('0xa'));var _0xd74a43=_[_0xbda8('0xb')]({'responder_id':_0x524d66['id'],'requester_id':_0x234407['id'],'name':util[_0xbda8('0xc')]('Caller\x20-\x20%s',_0x14b31c['calleridname']),'phone':_0x14b31c['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbda8('0xd')](_0x146f2[_0xbda8('0xe')],_0x14b31c,'\x20'),'description':intUtil[_0xbda8('0xd')](_0x146f2[_0xbda8('0xf')],_0x14b31c,_0xbda8('0x10')),'tags':getTags(_0x146f2['Tags'],_0xbda8('0x11'))},getCustomFields(_0x146f2[_0xbda8('0x12')],_0x14b31c));_0xd74a43[_0xbda8('0x13')]=_[_0xbda8('0x14')](_['keyBy'](_0xd74a43[_0xbda8('0x13')],'id'),'value');return request({'uri':util[_0xbda8('0xc')](_0xbda8('0x15'),_0x28deec[_0xbda8('0x16')]),'method':'POST','body':_0xd74a43})['then'](function(_0x312e36){logger[_0xbda8('0x9')](_0xbda8('0x17'));return _0x312e36;});}function getUser(_0x511500,_0x2db62f){if(intUtil[_0xbda8('0x18')](_0x2db62f)){return request({'uri':util[_0xbda8('0xc')]('%s/api/v2/agents',_0x511500['remoteUri']),'qs':{'email':_0x2db62f}})[_0xbda8('0x19')](function(_0x4ad7f0){if(_0x4ad7f0['length']){logger[_0xbda8('0x9')](_0xbda8('0x1a'));return _[_0xbda8('0x1b')](_0x4ad7f0,function(_0x2de4ec){return _0x2de4ec['contact'][_0xbda8('0x1c')]===_0x2db62f;});}else{logger['info'](_0xbda8('0x1d'));return request({'uri':util[_0xbda8('0xc')](_0xbda8('0x1e'),_0x511500[_0xbda8('0x16')])})[_0xbda8('0x19')](function(_0x2e0e8f){logger[_0xbda8('0x9')](_0xbda8('0x1f'));return _0x2e0e8f;});}});}else{logger['info'](_0xbda8('0x20'));return request({'uri':util[_0xbda8('0xc')](_0xbda8('0x1e'),_0x511500[_0xbda8('0x16')])})[_0xbda8('0x19')](function(_0x4fa6ab){logger['info'](_0xbda8('0x1f'));return _0x4fa6ab;});}}function getEndUser(_0x2d6593,_0x50c9ef,_0x3a2b48){logger[_0xbda8('0x9')]('Searching\x20enduser\x20with\x20phone',_0x3a2b48);return request({'uri':util[_0xbda8('0xc')]('%s/api/v2/contacts',_0x2d6593[_0xbda8('0x16')]),'qs':{'phone':_0x3a2b48}})[_0xbda8('0x19')](function(_0x3ff637){if(_0x3ff637['length']){logger[_0xbda8('0x9')](_0xbda8('0x21'));return _['find'](_0x3ff637,{'phone':_0x3a2b48});}else{logger[_0xbda8('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbda8('0xc')](_0xbda8('0x22'),_0x2d6593[_0xbda8('0x16')]),'method':_0xbda8('0x23'),'body':{'name':_0x50c9ef,'phone':_0x3a2b48}})[_0xbda8('0x19')](function(_0x3e6000){logger[_0xbda8('0x9')](_0xbda8('0x24'));return _0x3e6000;});}});}function getAuth(_0x9e7a75){return util[_0xbda8('0xc')](_0xbda8('0x25'),new Buffer(_0x9e7a75[_0xbda8('0x26')]+':X')[_0xbda8('0x27')]('base64'));}function request(_0x3fe8fb){logger[_0xbda8('0x28')](_0xbda8('0x29'),JSON[_0xbda8('0x2a')](_0x3fe8fb));return rp(_['defaults'](_0x3fe8fb,{'method':_0xbda8('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0x2ff5e9,_0x52a484){var _0x466fca=[];if(_0x2ff5e9&&_0x2ff5e9[_0xbda8('0x2c')]>0x0){_0x466fca=_[_0xbda8('0x2d')](_0x2ff5e9,_0x52a484);}return _0x466fca;}function getCustomFields(_0xbb8578,_0x1284e5){var _0x4e5c63=[];var _0x3f0a4b={'custom_fields':[]};if(_0xbb8578[_0xbda8('0x2c')]>0x0){_[_0xbda8('0x2e')](_0xbb8578,function(_0x1c2326){if(_[_0xbda8('0x2f')]([_0xbda8('0x30'),_0xbda8('0x31')],_0x1c2326[_0xbda8('0x32')])&&_0x1c2326[_0xbda8('0x33')]&&!_0x1c2326[_0xbda8('0x34')]){_0x3f0a4b[_0x1c2326[_0xbda8('0x33')]['toLowerCase']()]=_0x1c2326['content'][_0xbda8('0x27')]();}else if(_[_0xbda8('0x2f')]([_0xbda8('0x30'),_0xbda8('0x31')],_0x1c2326['type'])&&_0x1c2326[_0xbda8('0x35')]&&_0x1c2326[_0xbda8('0x34')]){_0x3f0a4b[_0xbda8('0x13')][_0xbda8('0x36')]({'id':_0x1c2326[_0xbda8('0x35')],'value':_0x1c2326[_0xbda8('0x37')]['toString']()});}else if(_0x1c2326[_0xbda8('0x32')]===_0xbda8('0x38')&&_0x1c2326[_0xbda8('0x39')]&&_0x1c2326[_0xbda8('0x35')]&&_0x1c2326[_0xbda8('0x34')]){_0x1284e5[_0x1c2326[_0xbda8('0x39')]]&&_0x3f0a4b[_0xbda8('0x13')]['push']({'id':_0x1c2326['idField'],'value':_0x1284e5[_0x1c2326[_0xbda8('0x39')]][_0xbda8('0x27')]()});}else if(_0x1c2326[_0xbda8('0x32')]==='customVariable'&&_0x1c2326[_0xbda8('0x3a')]&&_0x1c2326[_0xbda8('0x3a')]['name']&&_0x1c2326[_0xbda8('0x35')]&&_0x1c2326[_0xbda8('0x34')]){_0x1284e5[_0x1c2326[_0xbda8('0x3a')]['name'][_0xbda8('0x3b')]()]&&_0x3f0a4b[_0xbda8('0x13')][_0xbda8('0x36')]({'id':_0x1c2326[_0xbda8('0x35')],'value':_0x1284e5[_0x1c2326[_0xbda8('0x3a')][_0xbda8('0x11')][_0xbda8('0x3b')]()][_0xbda8('0x27')]()});}});}return _0x3f0a4b;}exports[_0xbda8('0x3c')]=function(_0x383f0f,_0x412e56,_0x4120d3,_0x18fe08,_0x29e0ef,_0x1dc75c){var _0x4e498b,_0x29e905;_0x1dc75c[_0xbda8('0x16')]=intUtil['stripTrailingSlash'](_0x1dc75c[_0xbda8('0x16')]);_0x1dc75c['serverUrl']=intUtil[_0xbda8('0x3d')](_0x1dc75c[_0xbda8('0x3e')]);if(_0x29e0ef&&_0x29e0ef[_0xbda8('0x3f')]){logger[_0xbda8('0x9')](_0xbda8('0x40'),_0xbda8('0x41'));_0x412e56[_0xbda8('0x42')]=util[_0xbda8('0xc')](_0xbda8('0x43'),_0x1dc75c[_0xbda8('0x3e')],_0x412e56[_0xbda8('0x44')],md5(_0x412e56['uniqueid']));}else{_0x412e56[_0xbda8('0x42')]='';}headers[_0xbda8('0x45')]=getAuth(_0x1dc75c);return getUser(_0x1dc75c,_0x18fe08['email'])['then'](function(_0x1bc956){_0x4e498b=_0x1bc956;logger[_0xbda8('0x9')](_0xbda8('0x46'),_0x4e498b['id']);return getEndUser(_0x1dc75c,_0x412e56[_0xbda8('0x47')],_0x412e56['calleridnum']);})[_0xbda8('0x19')](function(_0x36df0f){_0x29e905=_0x36df0f;logger[_0xbda8('0x9')](_0xbda8('0x48'),_0x29e905['id']);return getTicket(_0x1dc75c,_0x4e498b,_0x29e905,_0x4120d3,_0x412e56);})[_0xbda8('0x19')](function(_0x5a7492){if(_0x5a7492&&_0x5a7492['id']){logger[_0xbda8('0x9')]('Ticket\x20created!');logger[_0xbda8('0x9')](_0xbda8('0x49'),_0x5a7492['id']);logger['info'](_0xbda8('0x40'),_0xbda8('0x4a'));emit(util[_0xbda8('0xc')](_0xbda8('0x4b'),_0x18fe08[_0xbda8('0x11')]),_0xbda8('0x4c'),{'uri':util[_0xbda8('0xc')](_0xbda8('0x4d'),_0x1dc75c['remoteUri'],_0x5a7492['id'])});}})[_0xbda8('0x4e')](function(_0x18a9e0){logger['error']('[QUEUE]',JSON[_0xbda8('0x2a')](_0x18a9e0));});};exports[_0xbda8('0x4f')]=function(_0x22f223,_0x370404,_0x3f6f86,_0x557c49,_0x60700d,_0x3f7736,_0x5b0adb){var _0x29976e,_0x2bfc4c;_0x3f7736[_0xbda8('0x16')]=intUtil['stripTrailingSlash'](_0x3f7736[_0xbda8('0x16')]);_0x3f7736[_0xbda8('0x3e')]=intUtil[_0xbda8('0x3d')](_0x3f7736[_0xbda8('0x3e')]);if(_0x5b0adb&&_0x5b0adb[_0xbda8('0x50')]&&_0x5b0adb['recordingFormat']!=='none'){logger['info'](_0xbda8('0x51'),_0xbda8('0x41'));_0x370404['recordingURL']=util[_0xbda8('0xc')](_0xbda8('0x43'),_0x3f7736['serverUrl'],_0x370404[_0xbda8('0x44')],md5(_0x370404[_0xbda8('0x44')]));}headers['Authorization']=getAuth(_0x3f7736);return getUser(_0x3f7736,_0x557c49[_0xbda8('0x1c')])['then'](function(_0x3db6){_0x29976e=_0x3db6;logger[_0xbda8('0x9')](_0xbda8('0x46'),_0x29976e['id']);return getEndUser(_0x3f7736,_0x370404['destcalleridname'],_0x370404['destcalleridnum']);})[_0xbda8('0x19')](function(_0x2eb4f8){_0x2bfc4c=_0x2eb4f8;logger['info'](_0xbda8('0x48'),_0x2bfc4c['id']);return getTicket(_0x3f7736,_0x29976e,_0x2bfc4c,_0x3f6f86,_0x370404);})['then'](function(_0x31b529){if(_0x31b529&&_0x31b529['id']){logger[_0xbda8('0x9')](_0xbda8('0x17'));logger[_0xbda8('0x9')](_0xbda8('0x49'),_0x31b529['id']);logger[_0xbda8('0x9')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbda8('0xc')](_0xbda8('0x4b'),_0x557c49['name']),_0xbda8('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3f7736[_0xbda8('0x16')],_0x31b529['id'])});}})['catch'](function(_0x4b5ce6){logger[_0xbda8('0x52')]('[OUTBOUND]',JSON[_0xbda8('0x2a')](_0x4b5ce6));});};exports[_0xbda8('0x53')]=function(_0x23446b,_0x4ca008,_0x761d58,_0x29ebcb,_0x3e6a04,_0x1a6a9b){var _0x1d034e,_0x59aaca;_0x1a6a9b[_0xbda8('0x16')]=intUtil[_0xbda8('0x3d')](_0x1a6a9b['remoteUri']);_0x1a6a9b[_0xbda8('0x3e')]=intUtil[_0xbda8('0x3d')](_0x1a6a9b[_0xbda8('0x3e')]);if(_0x3e6a04&&_0x3e6a04[_0xbda8('0x3f')]){logger['info']('['+_0x4ca008[_0xbda8('0x54')][_0xbda8('0x55')]()+']',_0xbda8('0x41'));_0x4ca008['recordingURL']=util['format'](_0xbda8('0x43'),_0x1a6a9b[_0xbda8('0x3e')],_0x4ca008['uniqueid'],md5(_0x4ca008['uniqueid']));}else{_0x4ca008[_0xbda8('0x42')]='';}headers[_0xbda8('0x45')]=getAuth(_0x1a6a9b);return getUser(_0x1a6a9b,'')[_0xbda8('0x19')](function(_0x1ba32d){_0x1d034e=_0x1ba32d;logger['info'](_0xbda8('0x46'),_0x1d034e['id']);return getEndUser(_0x1a6a9b,_0x4ca008[_0xbda8('0x47')],_0x4ca008[_0xbda8('0x56')]);})[_0xbda8('0x19')](function(_0x170aa4){_0x59aaca=_0x170aa4;logger['info'](_0xbda8('0x48'),_0x59aaca['id']);return getTicket(_0x1a6a9b,_0x1d034e,_0x59aaca,_0x761d58,_0x4ca008);})['then'](function(_0x324796){if(_0x324796){logger[_0xbda8('0x9')](_0xbda8('0x17'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x324796['id']);}})['catch'](function(_0x14bf19){logger[_0xbda8('0x52')]('['+_0x4ca008[_0xbda8('0x54')]['toUpperCase']()+']',JSON['stringify'](_0x14bf19));});}; \ 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 73ee489..02db2aa 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 _0x08b3=['apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url'];(function(_0x4615dd,_0x17b6ba){var _0x2bf071=function(_0x390d8d){while(--_0x390d8d){_0x4615dd['push'](_0x4615dd['shift']());}};_0x2bf071(++_0x17b6ba);}(_0x08b3,0xb7));var _0x308b=function(_0x14c064,_0x46ea73){_0x14c064=_0x14c064-0x0;var _0x2cfcab=_0x08b3[_0x14c064];return _0x2cfcab;};'use strict';var _=require(_0x308b('0x0'));var rp=require(_0x308b('0x1'));var md5=require(_0x308b('0x2'));var util=require(_0x308b('0x3'));var moment=require(_0x308b('0x4'));var Promise=require('bluebird');var Redis=require(_0x308b('0x5'));var intUtil=require('./util');var config=require(_0x308b('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x308b('0x7')]=_[_0x308b('0x8')](config[_0x308b('0x7')],{'host':_0x308b('0x9'),'port':0x18eb});var io=require(_0x308b('0xa'))(new Redis(config[_0x308b('0x7')]));function getAdminId(_0x45e687,_0x3bfe11,_0x2c3787,_0x299d95){return new Promise(function(_0x242f87,_0x56e7b1){var _0x36699a=![];var _0x4729f2={'method':_0x308b('0xb'),'uri':_0x299d95+_0x308b('0xc'),'json':!![]};_0x4729f2[_0x308b('0xd')]=_0x2c3787;logger['info'](_0x308b('0xe'));return rp(_0x4729f2)[_0x308b('0xf')](function(_0x44572e){if(_0x44572e){var _0x361e9a=_0x44572e[_0x308b('0x10')];var _0x4aab93=null;for(_0x4aab93=0x0;_0x4aab93<_0x361e9a[_0x308b('0x11')];_0x4aab93++){if(_0x361e9a[_0x4aab93]['email']===_0x45e687[_0x308b('0x12')]){_0x45e687['adminId']=_0x361e9a[_0x4aab93]['id'];_0x36699a=!![];}}if(_0x36699a){logger[_0x308b('0x13')](_0x308b('0x14'),_0x45e687[_0x308b('0x15')]);_0x242f87(_0x45e687);}else{_0x56e7b1({'statusCode':0x194,'message':_0x308b('0x16')});}}else{_0x56e7b1({'statusCode':0x194,'message':_0x308b('0x16')});}})[_0x308b('0x17')](function(_0x25d4dd){logger[_0x308b('0x18')]('['+[_0x3bfe11['toUpperCase']()]+']',_0x25d4dd[_0x308b('0x19')]);_0x56e7b1(_0x25d4dd);});});}function getUser(_0x5eb255,_0x2b24ae,_0xe032a){return function(_0x59008){return new Promise(function(_0x4b1a6e,_0x54108d){var _0x165b02={'method':_0x308b('0xb'),'uri':_0xe032a+_0x308b('0xc'),'json':!![]};_0x165b02[_0x308b('0xd')]=_0x2b24ae;logger[_0x308b('0x13')](_0x308b('0x1a'));return rp(_0x165b02)[_0x308b('0xf')](function(_0x4e9e08){if(_0x4e9e08){var _0x2e11c8=_0x4e9e08[_0x308b('0x10')];var _0x57eccb=![];var _0x2c9102=null;if(_0x59008[_0x308b('0x1b')]!==null){logger[_0x308b('0x13')](_0x308b('0x1c'),_0x59008[_0x308b('0x1b')]);_0x59008[_0x308b('0x1d')]=_0x59008[_0x308b('0x1b')];for(_0x2c9102=0x0;_0x2c9102<_0x2e11c8['length'];_0x2c9102++){if(_0x2e11c8[_0x2c9102][_0x308b('0x1e')]===_0x59008[_0x308b('0x1b')]){_0x57eccb=!![];_0x59008['userId']=_0x2e11c8[_0x2c9102]['id'];logger['info'](_0x308b('0x1f'),_0x59008['userId']);}}}if(!_0x57eccb){logger[_0x308b('0x13')]('Admin\x20selected');_0x59008[_0x308b('0x1d')]=_0x59008[_0x308b('0x12')];_0x59008[_0x308b('0x20')]=_0x59008['adminId'];_0x57eccb=!![];}if(_0x57eccb){_0x4b1a6e(_0x59008);}else{_0x54108d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x54108d({'statusCode':0x194,'message':_0x308b('0x16')});}})['catch'](function(_0xa3ee67){logger[_0x308b('0x18')]('['+[_0x5eb255[_0x308b('0x21')]()]+']',_0xa3ee67['message']);_0x54108d(_0xa3ee67);});});};}function searchContact(_0x41af98,_0x22ae5e,_0x4a5ffa,_0x2719c2){return new Promise(function(_0x1150dd,_0x2a39e0){var _0x2edf98={'method':'GET','headers':_0x22ae5e,'uri':_0x41af98+_0x308b('0x22')+_0x2719c2+_0x308b('0x23')+_0x4a5ffa+_0x308b('0x24'),'json':!![]};rp(_0x2edf98)[_0x308b('0xf')](function(_0xf18601){var _0x1f5605=_['find'](_0xf18601[_0x308b('0x25')][_0x308b('0x25')],[_0x4a5ffa,_0x2719c2]);_0x1150dd(_0x1f5605);})[_0x308b('0x17')](function(_0x5d90bb){_0x2a39e0(_0x5d90bb);});});}function getEndUser(_0x196ac1,_0x5ebed7,_0x313952){return function(_0xac8c9c){return new Promise(function(_0xc1c35e,_0x19a1b5){logger[_0x308b('0x13')](util[_0x308b('0x26')](_0x308b('0x27'),_0xac8c9c[_0x308b('0x28')]));searchContact(_0x313952,_0x5ebed7,_0x308b('0x29'),_0xac8c9c[_0x308b('0x28')])[_0x308b('0xf')](function(_0xb541a4){if(_0xb541a4){_0xac8c9c[_0x308b('0x2a')]=_0xb541a4['id'];logger[_0x308b('0x13')](_0x308b('0x2b'),_0xac8c9c[_0x308b('0x2a')]);return _0xc1c35e(_0xac8c9c);}searchContact(_0x313952,_0x5ebed7,_0x308b('0x2c'),_0xac8c9c['contactNumber'])[_0x308b('0xf')](function(_0x1e4b45){if(_0x1e4b45){_0xac8c9c[_0x308b('0x2a')]=_0x1e4b45['id'];logger[_0x308b('0x13')]('Contact\x20found\x20work_number:',_0xac8c9c[_0x308b('0x2a')]);return _0xc1c35e(_0xac8c9c);}createEndUser(_0xac8c9c,_0x196ac1,_0x5ebed7,_0x313952)[_0x308b('0xf')](function(_0x489394){logger[_0x308b('0x13')](_0x308b('0x2d'),_0x489394[_0x308b('0x2a')]);return _0xc1c35e(_0x489394);});});})[_0x308b('0x17')](function(_0x2f76f3){_0x19a1b5(_0x2f76f3);});});};}function createEndUser(_0x873f38,_0xebfbee,_0x13419c,_0x5d08a7){return new Promise(function(_0x458d5b,_0x5a1971){var _0x299aa7=moment();var _0x2bd941={'method':_0x308b('0x2e'),'uri':_0x5d08a7+_0x308b('0x2f'),'body':{'contact':{'last_name':_0x873f38[_0x308b('0x28')],'work_number':_0x873f38[_0x308b('0x28')],'mobile_number':_0x873f38[_0x308b('0x28')],'owner_id':_0x873f38[_0x308b('0x20')],'created_at':_0x299aa7['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2bd941[_0x308b('0xd')]=_0x13419c;logger[_0x308b('0x13')](_0x308b('0x30'));return rp(_0x2bd941)[_0x308b('0xf')](function(_0x1036e1){_0x873f38[_0x308b('0x2a')]=_0x1036e1[_0x308b('0x31')]['id'];_0x458d5b(_0x873f38);})[_0x308b('0x17')](function(_0x3110fc){logger[_0x308b('0x18')]('['+[_0xebfbee[_0x308b('0x21')]()]+']',_0x3110fc[_0x308b('0x19')]);_0x5a1971(_0x3110fc[_0x308b('0x19')]);});});}function getTicket(_0x49508d,_0x2226ec,_0xaf4044,_0x2a7192,_0x3caa5b){return function(_0x13cc54){logger[_0x308b('0x13')](_0x308b('0x32'));return new Promise(function(_0x17ef9c,_0x64c925){var _0xb981c1=moment();var _0x4254dc={'method':_0x308b('0x2e'),'uri':_0xaf4044+'/api/tasks','body':{'title':intUtil[_0x308b('0x33')](_0x2a7192['Subjects'],_0x3caa5b,'\x20'),'description':intUtil[_0x308b('0x33')](_0x2a7192['Descriptions'],_0x3caa5b,'\x0a'),'owner_id':_0x13cc54['userId'],'creater_id':_0x13cc54[_0x308b('0x15')],'targetable_id':_0x13cc54[_0x308b('0x2a')],'targetable_type':_0x308b('0x34'),'created_at':_0xb981c1[_0x308b('0x26')](_0x308b('0x35')),'due_date':_0xb981c1['add'](0x1e,'m')[_0x308b('0x26')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4254dc[_0x308b('0xd')]=_0x2226ec;return rp(_0x4254dc)[_0x308b('0xf')](function(_0x5a89af){_0x13cc54[_0x308b('0x36')]=_0x5a89af[_0x308b('0x37')]['id'];logger[_0x308b('0x13')](_0x308b('0x38'),_0x13cc54[_0x308b('0x36')]);_0x17ef9c(_0x13cc54);})[_0x308b('0x17')](function(_0x62bfd){logger['error']('['+[_0x49508d[_0x308b('0x21')]()]+']',_0x62bfd['message']);_0x64c925(_0x62bfd['message']);});});};}function emit(_0x4efdeb,_0x5a2944,_0x257e28){var _0x41770f={'uri':_0x4efdeb+'/contacts/'+_0x257e28};io['to'](util['format'](_0x308b('0x39'),_0x5a2944))[_0x308b('0x3a')](_0x308b('0x3b'),_0x41770f);}exports['cs']=function(_0x5ca58e,_0x500be3,_0x5e4a9a,_0xab5275,_0x3916b5,_0xdb33a6,_0x129e13,_0x2ff45a){var _0x285e25={};var _0x5be54d={'Authorization':'Token\x20token='+_0xdb33a6[_0x308b('0x3c')]};_0xdb33a6[_0x308b('0x3d')]=intUtil[_0x308b('0x3e')](_0xdb33a6['remoteUri']);_0xdb33a6[_0x308b('0x3f')]=intUtil[_0x308b('0x3e')](_0xdb33a6[_0x308b('0x3f')]);var _0x78cd8a=_0xdb33a6['remoteUri'];_0x285e25[_0x308b('0x12')]=_0xdb33a6['username'];_0x285e25[_0x308b('0x28')]=_0x2ff45a[_0x308b('0x40')]()===_0x308b('0x41')?_0x500be3[_0x308b('0x42')]:_0x500be3[_0x308b('0x43')];_0x285e25['callDirection']=_0x2ff45a===_0x308b('0x44')||_0x2ff45a===_0x308b('0x45')?_0x308b('0x44'):_0x308b('0x41');if(_0xab5275){_0x285e25[_0x308b('0x1b')]=_0xab5275[_0x308b('0x1e')];}var _0x1ed30a=util['format'](_0x308b('0x46'),_0xdb33a6['serverUrl'],_0x500be3[_0x308b('0x47')],md5(_0x500be3[_0x308b('0x47')]));if(_0x3916b5&&_0x3916b5[_0x308b('0x48')]){logger[_0x308b('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0x500be3[_0x308b('0x49')]=_0x1ed30a;}else if(_0x129e13&&_0x129e13[_0x308b('0x4a')]&&_0x129e13[_0x308b('0x4a')]!==_0x308b('0x4b')){logger[_0x308b('0x13')](_0x308b('0x4c'),_0x308b('0x4d'));_0x500be3[_0x308b('0x49')]=_0x1ed30a;}else{_0x500be3[_0x308b('0x49')]='';}return getAdminId(_0x285e25,_0x2ff45a,_0x5be54d,_0x78cd8a)['then'](getUser(_0x2ff45a,_0x5be54d,_0x78cd8a))[_0x308b('0xf')](getEndUser(_0x2ff45a,_0x5be54d,_0x78cd8a))['then'](getTicket(_0x2ff45a,_0x5be54d,_0x78cd8a,_0x5e4a9a,_0x500be3))[_0x308b('0xf')](function(_0xc74101){logger['info'](util[_0x308b('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0xc74101['ticketId']));if(_0x2ff45a!==_0x308b('0x45')){logger['info']('['+[_0x2ff45a[_0x308b('0x21')]()]+']',_0x308b('0x4e'));emit(_0x78cd8a,_0xab5275[_0x308b('0x4f')],_0xc74101[_0x308b('0x2a')]);}})['catch'](function(_0x53f5b2){logger[_0x308b('0x18')]('['+[_0x2ff45a['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x308b('0x50')](_0x53f5b2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xff44=['contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','destcalleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','GET','/api/selector/owners','headers','then','users','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','find'];(function(_0x546863,_0x4dd089){var _0x4ff680=function(_0x46046c){while(--_0x46046c){_0x546863['push'](_0x546863['shift']());}};_0x4ff680(++_0x4dd089);}(_0xff44,0x1c7));var _0x4ff4=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0xff44[_0x3050ca];return _0x1eed1d;};'use strict';var _=require(_0x4ff4('0x0'));var rp=require(_0x4ff4('0x1'));var md5=require(_0x4ff4('0x2'));var util=require(_0x4ff4('0x3'));var moment=require(_0x4ff4('0x4'));var Promise=require(_0x4ff4('0x5'));var Redis=require('ioredis');var intUtil=require(_0x4ff4('0x6'));var config=require(_0x4ff4('0x7'));var logger=require(_0x4ff4('0x8'))('freshsales');config[_0x4ff4('0x9')]=_['defaults'](config[_0x4ff4('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4ff4('0xa'))(new Redis(config[_0x4ff4('0x9')]));function getAdminId(_0x167618,_0x20aa86,_0x2daa2e,_0x34ec50){return new Promise(function(_0x3905ec,_0x3b070c){var _0x3575f8=![];var _0x158a78={'method':_0x4ff4('0xb'),'uri':_0x34ec50+_0x4ff4('0xc'),'json':!![]};_0x158a78[_0x4ff4('0xd')]=_0x2daa2e;logger['info']('Getting\x20admin\x20information');return rp(_0x158a78)[_0x4ff4('0xe')](function(_0x59d0ee){if(_0x59d0ee){var _0x590341=_0x59d0ee[_0x4ff4('0xf')];var _0xa64482=null;for(_0xa64482=0x0;_0xa64482<_0x590341['length'];_0xa64482++){if(_0x590341[_0xa64482][_0x4ff4('0x10')]===_0x167618[_0x4ff4('0x11')]){_0x167618[_0x4ff4('0x12')]=_0x590341[_0xa64482]['id'];_0x3575f8=!![];}}if(_0x3575f8){logger[_0x4ff4('0x13')](_0x4ff4('0x14'),_0x167618[_0x4ff4('0x12')]);_0x3905ec(_0x167618);}else{_0x3b070c({'statusCode':0x194,'message':_0x4ff4('0x15')});}}else{_0x3b070c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4ff4('0x16')](function(_0x1676f3){logger['error']('['+[_0x20aa86[_0x4ff4('0x17')]()]+']',_0x1676f3[_0x4ff4('0x18')]);_0x3b070c(_0x1676f3);});});}function getUser(_0xfa135b,_0x210ca4,_0x58d701){return function(_0xc1618f){return new Promise(function(_0x2d2952,_0x165c44){var _0x520d51={'method':_0x4ff4('0xb'),'uri':_0x58d701+_0x4ff4('0xc'),'json':!![]};_0x520d51[_0x4ff4('0xd')]=_0x210ca4;logger[_0x4ff4('0x13')](_0x4ff4('0x19'));return rp(_0x520d51)[_0x4ff4('0xe')](function(_0x9cb409){if(_0x9cb409){var _0x544b34=_0x9cb409[_0x4ff4('0xf')];var _0x496512=![];var _0x5a49e6=null;if(_0xc1618f[_0x4ff4('0x1a')]!==null){logger[_0x4ff4('0x13')](_0x4ff4('0x1b'),_0xc1618f[_0x4ff4('0x1a')]);_0xc1618f[_0x4ff4('0x1c')]=_0xc1618f[_0x4ff4('0x1a')];for(_0x5a49e6=0x0;_0x5a49e6<_0x544b34[_0x4ff4('0x1d')];_0x5a49e6++){if(_0x544b34[_0x5a49e6]['email']===_0xc1618f[_0x4ff4('0x1a')]){_0x496512=!![];_0xc1618f[_0x4ff4('0x1e')]=_0x544b34[_0x5a49e6]['id'];logger[_0x4ff4('0x13')](_0x4ff4('0x1f'),_0xc1618f['userId']);}}}if(!_0x496512){logger[_0x4ff4('0x13')](_0x4ff4('0x20'));_0xc1618f[_0x4ff4('0x1c')]=_0xc1618f[_0x4ff4('0x11')];_0xc1618f[_0x4ff4('0x1e')]=_0xc1618f[_0x4ff4('0x12')];_0x496512=!![];}if(_0x496512){_0x2d2952(_0xc1618f);}else{_0x165c44({'statusCode':0x194,'message':_0x4ff4('0x15')});}}else{_0x165c44({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4ff4('0x16')](function(_0x2c80e8){logger[_0x4ff4('0x21')]('['+[_0xfa135b[_0x4ff4('0x17')]()]+']',_0x2c80e8[_0x4ff4('0x18')]);_0x165c44(_0x2c80e8);});});};}function searchContact(_0x473896,_0xb4d4e4,_0x359118,_0x50d36f){return new Promise(function(_0x13d340,_0x1abbac){var _0x3f6cce={'method':_0x4ff4('0xb'),'headers':_0xb4d4e4,'uri':_0x473896+_0x4ff4('0x22')+_0x50d36f+_0x4ff4('0x23')+_0x359118+'&entities=contact','json':!![]};rp(_0x3f6cce)[_0x4ff4('0xe')](function(_0x594ca1){var _0x54d9f7=_[_0x4ff4('0x24')](_0x594ca1[_0x4ff4('0x25')]['contacts'],[_0x359118,_0x50d36f]);_0x13d340(_0x54d9f7);})[_0x4ff4('0x16')](function(_0x3dc644){_0x1abbac(_0x3dc644);});});}function getEndUser(_0x47e565,_0x43cc1c,_0x1ccb48){return function(_0x2c52fb){return new Promise(function(_0xe133ee,_0x372324){logger[_0x4ff4('0x13')](util['format'](_0x4ff4('0x26'),_0x2c52fb[_0x4ff4('0x27')]));searchContact(_0x1ccb48,_0x43cc1c,_0x4ff4('0x28'),_0x2c52fb[_0x4ff4('0x27')])[_0x4ff4('0xe')](function(_0x4589d7){if(_0x4589d7){_0x2c52fb['endUserId']=_0x4589d7['id'];logger['info'](_0x4ff4('0x29'),_0x2c52fb[_0x4ff4('0x2a')]);return _0xe133ee(_0x2c52fb);}searchContact(_0x1ccb48,_0x43cc1c,'work_number',_0x2c52fb[_0x4ff4('0x27')])[_0x4ff4('0xe')](function(_0xb077b3){if(_0xb077b3){_0x2c52fb[_0x4ff4('0x2a')]=_0xb077b3['id'];logger['info'](_0x4ff4('0x2b'),_0x2c52fb[_0x4ff4('0x2a')]);return _0xe133ee(_0x2c52fb);}createEndUser(_0x2c52fb,_0x47e565,_0x43cc1c,_0x1ccb48)['then'](function(_0x4dcd63){logger[_0x4ff4('0x13')](_0x4ff4('0x2c'),_0x4dcd63['endUserId']);return _0xe133ee(_0x4dcd63);});});})['catch'](function(_0xcbbc2a){_0x372324(_0xcbbc2a);});});};}function createEndUser(_0x15917a,_0x1f0011,_0x3ce8f9,_0x535ab1){return new Promise(function(_0x58c707,_0x50ea4b){var _0x323142=moment();var _0x437e5e={'method':'POST','uri':_0x535ab1+_0x4ff4('0x2d'),'body':{'contact':{'last_name':_0x15917a[_0x4ff4('0x27')],'work_number':_0x15917a['contactNumber'],'mobile_number':_0x15917a[_0x4ff4('0x27')],'owner_id':_0x15917a['userId'],'created_at':_0x323142[_0x4ff4('0x2e')](_0x4ff4('0x2f'))}},'json':!![]};_0x437e5e['headers']=_0x3ce8f9;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x437e5e)['then'](function(_0x537ac7){_0x15917a[_0x4ff4('0x2a')]=_0x537ac7[_0x4ff4('0x30')]['id'];_0x58c707(_0x15917a);})[_0x4ff4('0x16')](function(_0x1eef65){logger[_0x4ff4('0x21')]('['+[_0x1f0011[_0x4ff4('0x17')]()]+']',_0x1eef65[_0x4ff4('0x18')]);_0x50ea4b(_0x1eef65['message']);});});}function getTicket(_0x2f119e,_0x1a00d6,_0x423c4a,_0x20e273,_0x1e5902){return function(_0x5b37f1){logger['info'](_0x4ff4('0x31'));return new Promise(function(_0x2806cf,_0x1ae13b){var _0xbd0a0f=moment();var _0x202927={'method':_0x4ff4('0x32'),'uri':_0x423c4a+_0x4ff4('0x33'),'body':{'title':intUtil['getString'](_0x20e273['Subjects'],_0x1e5902,'\x20'),'description':intUtil[_0x4ff4('0x34')](_0x20e273[_0x4ff4('0x35')],_0x1e5902,'\x0a'),'owner_id':_0x5b37f1[_0x4ff4('0x1e')],'creater_id':_0x5b37f1[_0x4ff4('0x12')],'targetable_id':_0x5b37f1[_0x4ff4('0x2a')],'targetable_type':'Contact','created_at':_0xbd0a0f[_0x4ff4('0x2e')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xbd0a0f[_0x4ff4('0x36')](0x1e,'m')[_0x4ff4('0x2e')](_0x4ff4('0x2f'))},'json':!![]};_0x202927[_0x4ff4('0xd')]=_0x1a00d6;return rp(_0x202927)[_0x4ff4('0xe')](function(_0xe3ef24){_0x5b37f1[_0x4ff4('0x37')]=_0xe3ef24['task']['id'];logger[_0x4ff4('0x13')](_0x4ff4('0x38'),_0x5b37f1['ticketId']);_0x2806cf(_0x5b37f1);})[_0x4ff4('0x16')](function(_0x96c41){logger[_0x4ff4('0x21')]('['+[_0x2f119e[_0x4ff4('0x17')]()]+']',_0x96c41[_0x4ff4('0x18')]);_0x1ae13b(_0x96c41['message']);});});};}function emit(_0x4b436e,_0x4dfba9,_0x1feafb){var _0x441fae={'uri':_0x4b436e+_0x4ff4('0x39')+_0x1feafb};io['to'](util[_0x4ff4('0x2e')](_0x4ff4('0x3a'),_0x4dfba9))[_0x4ff4('0x3b')](_0x4ff4('0x3c'),_0x441fae);}exports['cs']=function(_0xe2137b,_0x302782,_0x1bedad,_0x4d8167,_0x362b76,_0x3c511f,_0x251764,_0x405548){var _0x28ed55={};var _0x204adb={'Authorization':'Token\x20token='+_0x3c511f[_0x4ff4('0x3d')]};_0x3c511f['remoteUri']=intUtil[_0x4ff4('0x3e')](_0x3c511f[_0x4ff4('0x3f')]);_0x3c511f['serverUrl']=intUtil[_0x4ff4('0x3e')](_0x3c511f[_0x4ff4('0x40')]);var _0x4d5e0f=_0x3c511f[_0x4ff4('0x3f')];_0x28ed55[_0x4ff4('0x11')]=_0x3c511f['username'];_0x28ed55[_0x4ff4('0x27')]=_0x405548[_0x4ff4('0x41')]()==='outbound'?_0x302782[_0x4ff4('0x42')]:_0x302782['calleridnum'];_0x28ed55[_0x4ff4('0x43')]=_0x405548===_0x4ff4('0x44')||_0x405548==='unmanaged'?'queue':_0x4ff4('0x45');if(_0x4d8167){_0x28ed55[_0x4ff4('0x1a')]=_0x4d8167[_0x4ff4('0x10')];}var _0x2dceb0=util['format'](_0x4ff4('0x46'),_0x3c511f[_0x4ff4('0x40')],_0x302782[_0x4ff4('0x47')],md5(_0x302782['uniqueid']));if(_0x362b76&&_0x362b76[_0x4ff4('0x48')]){logger[_0x4ff4('0x13')](_0x4ff4('0x49'),_0x4ff4('0x4a'));_0x302782[_0x4ff4('0x4b')]=_0x2dceb0;}else if(_0x251764&&_0x251764[_0x4ff4('0x4c')]&&_0x251764['recordingFormat']!=='none'){logger[_0x4ff4('0x13')](_0x4ff4('0x4d'),_0x4ff4('0x4a'));_0x302782[_0x4ff4('0x4b')]=_0x2dceb0;}else{_0x302782[_0x4ff4('0x4b')]='';}return getAdminId(_0x28ed55,_0x405548,_0x204adb,_0x4d5e0f)[_0x4ff4('0xe')](getUser(_0x405548,_0x204adb,_0x4d5e0f))[_0x4ff4('0xe')](getEndUser(_0x405548,_0x204adb,_0x4d5e0f))['then'](getTicket(_0x405548,_0x204adb,_0x4d5e0f,_0x1bedad,_0x302782))[_0x4ff4('0xe')](function(_0x1f3d54){logger[_0x4ff4('0x13')](util[_0x4ff4('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1f3d54[_0x4ff4('0x37')]));if(_0x405548!==_0x4ff4('0x4e')){logger[_0x4ff4('0x13')]('['+[_0x405548[_0x4ff4('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4d5e0f,_0x4d8167[_0x4ff4('0x4f')],_0x1f3d54[_0x4ff4('0x2a')]);}})[_0x4ff4('0x16')](function(_0x580877){logger['error']('['+[_0x405548[_0x4ff4('0x17')]()]+_0x4ff4('0x50'),util[_0x4ff4('0x51')](_0x580877,{'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 a496382..63b6557 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 _0x8085=['[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','freshdesk','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x3e5562,_0x228caf){var _0x3b4243=function(_0x9443b7){while(--_0x9443b7){_0x3e5562['push'](_0x3e5562['shift']());}};_0x3b4243(++_0x228caf);}(_0x8085,0x174));var _0x5808=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x8085[_0x41c381];return _0x427981;};'use strict';var _=require(_0x5808('0x0'));var util=require(_0x5808('0x1'));var zendesk=require(_0x5808('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x5808('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x5808('0x4'));var desk=require('./desk');var vtiger=require(_0x5808('0x5'));var servicenow=require(_0x5808('0x6'));var dynamics365=require(_0x5808('0x7'));var freshsales=require(_0x5808('0x8'));var integrations=[_0x5808('0x9'),_0x5808('0xa'),_0x5808('0xb'),'freshdesk','zoho',_0x5808('0xc'),_0x5808('0xd'),_0x5808('0xe'),_0x5808('0xf'),_0x5808('0x10')];exports[_0x5808('0x11')]=function(_0x2f4b8e,_0x508322,_0x4a590c,_0xc7dd15,_0x4660f2,_0x5c8892){if(_0x4a590c){if(_[_0x5808('0x12')](integrations,_0x2f4b8e['data1']['toLowerCase']())){try{var _0x53cf51=null;var _0x2264f8='';var _0x497911=_0x4a590c[_0x2f4b8e[_0x5808('0x13')][_0x5808('0x14')]()];if(_0x497911){var _0x3dd685=_0x497911[_0x2f4b8e[_0x5808('0x15')]];if(_0x3dd685){var _0x1b4ca2=_[_0x5808('0x16')](_0x3dd685[_0x5808('0x17')],{'id':parseInt(_0x2f4b8e[_0x5808('0x18')],0xa)});if(_0x1b4ca2){if(_0xc7dd15){if(_0x4660f2&&_0x508322[_0x5808('0x19')]){_0x2264f8=_0x5808('0x19');}else if(_0x508322[_0x5808('0x1a')]){_0x2264f8=_0x5808('0x1b');}else{console[_0x5808('0x1c')](_0x5808('0x1d'),_0x508322);}}else{_0x2264f8='unmanaged';}switch(_0x2f4b8e[_0x5808('0x13')]['toLowerCase']()){case _0x5808('0x9'):zendesk[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case _0x5808('0xa'):salesforce[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case'sugarcrm':sugarcrm[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case _0x5808('0x1e'):freshdesk[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case'zoho':zoho[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case _0x5808('0xc'):desk[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case _0x5808('0xd'):vtiger[_0x2264f8](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892);break;case _0x5808('0xf'):freshsales['cs'](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892,_0x2264f8);break;case'servicenow':servicenow['cs'](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892,_0x2264f8);break;case _0x5808('0xe'):dynamics365['cs'](_0x2f4b8e,_0x508322,_0x1b4ca2,_0xc7dd15,_0x4660f2,_0x3dd685,_0x5c8892,_0x2264f8);break;default:console[_0x5808('0x1c')](_0x5808('0x1f'));}}else{_0x53cf51=require(_0x5808('0x20'))(_0x2f4b8e['data1'][_0x5808('0x14')]());_0x53cf51[_0x5808('0x21')]('[EXEC]',util['format'](_0x5808('0x22'),_0x2f4b8e[_0x5808('0x13')][_0x5808('0x14')](),_0x2f4b8e['data3']));}}else{_0x53cf51=require('../../../../config/logger')(_0x2f4b8e[_0x5808('0x13')][_0x5808('0x14')]());_0x53cf51[_0x5808('0x21')](_0x5808('0x23'),util['format'](_0x5808('0x24'),_0x2f4b8e[_0x5808('0x13')][_0x5808('0x14')](),_0x2f4b8e['data2']));}}else{}}catch(_0x29fef1){console[_0x5808('0x21')](_0x29fef1);}}}}; \ No newline at end of file +var _0xc385=['desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','zendesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho'];(function(_0x78029b,_0x19ce64){var _0x2c1b66=function(_0x3d1543){while(--_0x3d1543){_0x78029b['push'](_0x78029b['shift']());}};_0x2c1b66(++_0x19ce64);}(_0xc385,0x65));var _0x5c38=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc385[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x5c38('0x0'));var util=require(_0x5c38('0x1'));var zendesk=require(_0x5c38('0x2'));var salesforce=require(_0x5c38('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x5c38('0x4'));var desk=require(_0x5c38('0x5'));var vtiger=require(_0x5c38('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x5c38('0x7'));var freshsales=require(_0x5c38('0x8'));var integrations=['zendesk',_0x5c38('0x9'),_0x5c38('0xa'),_0x5c38('0xb'),_0x5c38('0xc'),_0x5c38('0xd'),_0x5c38('0xe'),_0x5c38('0xf'),_0x5c38('0x10'),_0x5c38('0x11')];exports[_0x5c38('0x12')]=function(_0x4c36b8,_0x27b2cd,_0x33486b,_0xec3cb1,_0x1f2605,_0x5d3b2d){if(_0x33486b){if(_[_0x5c38('0x13')](integrations,_0x4c36b8[_0x5c38('0x14')][_0x5c38('0x15')]())){try{var _0x3a3e6b=null;var _0xc7aeaf='';var _0x2ca81b=_0x33486b[_0x4c36b8[_0x5c38('0x14')][_0x5c38('0x15')]()];if(_0x2ca81b){var _0x389403=_0x2ca81b[_0x4c36b8[_0x5c38('0x16')]];if(_0x389403){var _0x113003=_[_0x5c38('0x17')](_0x389403[_0x5c38('0x18')],{'id':parseInt(_0x4c36b8['data3'],0xa)});if(_0x113003){if(_0xec3cb1){if(_0x1f2605&&_0x27b2cd[_0x5c38('0x19')]){_0xc7aeaf=_0x5c38('0x19');}else if(_0x27b2cd[_0x5c38('0x1a')]){_0xc7aeaf=_0x5c38('0x1b');}else{console[_0x5c38('0x1c')]('EVENT\x20UNKNOWN',_0x27b2cd);}}else{_0xc7aeaf='unmanaged';}switch(_0x4c36b8[_0x5c38('0x14')][_0x5c38('0x15')]()){case _0x5c38('0x1d'):zendesk[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case _0x5c38('0x9'):salesforce[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case _0x5c38('0xa'):sugarcrm[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case'freshdesk':freshdesk[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case _0x5c38('0xc'):zoho[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case'desk':desk[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case _0x5c38('0xe'):vtiger[_0xc7aeaf](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d);break;case _0x5c38('0x10'):freshsales['cs'](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d,_0xc7aeaf);break;case _0x5c38('0x11'):servicenow['cs'](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d,_0xc7aeaf);break;case'dynamics365':dynamics365['cs'](_0x4c36b8,_0x27b2cd,_0x113003,_0xec3cb1,_0x1f2605,_0x389403,_0x5d3b2d,_0xc7aeaf);break;default:console[_0x5c38('0x1c')](_0x5c38('0x1e'));}}else{_0x3a3e6b=require(_0x5c38('0x1f'))(_0x4c36b8[_0x5c38('0x14')][_0x5c38('0x15')]());_0x3a3e6b[_0x5c38('0x20')]('[EXEC]',util[_0x5c38('0x21')](_0x5c38('0x22'),_0x4c36b8['data1'][_0x5c38('0x15')](),_0x4c36b8[_0x5c38('0x23')]));}}else{_0x3a3e6b=require(_0x5c38('0x1f'))(_0x4c36b8[_0x5c38('0x14')]['toLowerCase']());_0x3a3e6b[_0x5c38('0x20')](_0x5c38('0x24'),util['format'](_0x5c38('0x25'),_0x4c36b8['data1'][_0x5c38('0x15')](),_0x4c36b8[_0x5c38('0x16')]));}}else{}}catch(_0x5a6bdb){console[_0x5c38('0x20')](_0x5a6bdb);}}}}; \ 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 60765c1..b253140 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 _0x7bf4=['Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','ContactId','AccountId','leadId','sobject','create','isNil','validateEmail','User','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','find','$or','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchLead','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','No\x20Company','upperFirst','forEach','string','picklist','idField','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','emit'];(function(_0x294aef,_0x378f98){var _0x4d235d=function(_0x105d6c){while(--_0x105d6c){_0x294aef['push'](_0x294aef['shift']());}};_0x4d235d(++_0x378f98);}(_0x7bf4,0x75));var _0x47bf=function(_0x51e4f1,_0x27aa7e){_0x51e4f1=_0x51e4f1-0x0;var _0x1935c8=_0x7bf4[_0x51e4f1];return _0x1935c8;};'use strict';var _=require(_0x47bf('0x0'));var rp=require(_0x47bf('0x1'));var moment=require(_0x47bf('0x2'));var BPromise=require('bluebird');var md5=require(_0x47bf('0x3'));var jsforce=require(_0x47bf('0x4'));var util=require('util');var Redis=require(_0x47bf('0x5'));var intUtil=require(_0x47bf('0x6'));var config=require(_0x47bf('0x7'));var logger=require('../../../../config/logger')(_0x47bf('0x8'));config[_0x47bf('0x9')]=_[_0x47bf('0xa')](config[_0x47bf('0x9')],{'host':_0x47bf('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47bf('0x9')]));function emit(_0x11dbff,_0x511041,_0x1a89e3){io['to'](_0x11dbff)[_0x47bf('0xc')](_0x511041,_0x1a89e3);}function getTicket(_0x1feda6,_0x2c4e11,_0x4c3bb3,_0x4289e6,_0x2ad7db,_0x195f43,_0x3aaeea,_0x4106a8){var _0x34985d=Object['assign']({},{'OwnerId':_0x2c4e11['id'],'Subject':intUtil['getString'](_0x4289e6[_0x47bf('0xd')],_0x2ad7db,'\x20'),'Description':intUtil[_0x47bf('0xe')](_0x4289e6[_0x47bf('0xf')],_0x2ad7db,'\x0a')},getCustomFields(_0x195f43,_0x2ad7db));if(_0x4c3bb3){if(_0x4289e6[_0x47bf('0x10')]===_0x47bf('0x11')){_0x34985d[_0x47bf('0x12')]=moment[_0x47bf('0x13')]();_0x34985d[_0x47bf('0x14')]=![];_0x34985d[_0x47bf('0x15')]=![];if(_0x4c3bb3[_0x47bf('0x16')]==='contact'||_0x4c3bb3[_0x47bf('0x16')]===_0x47bf('0x17')){_0x34985d[_0x47bf('0x18')]=_0x4c3bb3['id'];}else if(_0x4c3bb3[_0x47bf('0x16')]===_0x47bf('0x19')){_0x34985d[_0x47bf('0x1a')]=_0x4c3bb3['id'];}}else if(_0x4289e6['ticketType']==='Case'){if(_0x4c3bb3['endUserType']===_0x47bf('0x1b')){_0x34985d[_0x47bf('0x1c')]=_0x4c3bb3['id'];}else if(_0x4c3bb3[_0x47bf('0x16')]===_0x47bf('0x19')){_0x34985d[_0x47bf('0x1d')]=_0x4c3bb3['id'];}else if(_0x4c3bb3[_0x47bf('0x16')]===_0x47bf('0x17')&&_0x4289e6[_0x47bf('0x1e')]){_0x34985d[_0x4289e6[_0x47bf('0x1e')]]=_0x4c3bb3['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3aaeea[_0x47bf('0x1f')](_0x4289e6[_0x47bf('0x10')])[_0x47bf('0x20')](_0x34985d);}function getUser(_0x3b42a5,_0x3a15b4,_0x3f3a37){if(!_[_0x47bf('0x21')](_0x3a15b4)&&intUtil[_0x47bf('0x22')](_0x3a15b4)){var _0x2cc369={'Email':_0x3a15b4};var _0x2e0df2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3f3a37[_0x47bf('0x1f')](_0x47bf('0x23'))['find'](_0x2cc369,_0x2e0df2)[_0x47bf('0x24')]()[_0x47bf('0x25')](function(_0x25af55){if(_0x25af55[_0x47bf('0x26')]){var _0x1e2a42=_['find'](_0x25af55,function(_0x4219ae){return _0x4219ae[_0x47bf('0x27')]===_0x3a15b4;});if(_0x1e2a42){logger[_0x47bf('0x28')](_0x47bf('0x29'),_0x3a15b4);return BPromise['resolve']({'id':_0x1e2a42['Id'],'name':_0x1e2a42[_0x47bf('0x2a')]});}}else{logger['info'](_0x47bf('0x2b'),_0x3a15b4);return _0x3f3a37[_0x47bf('0x2c')]()[_0x47bf('0x25')](function(_0x1e9233){return BPromise[_0x47bf('0x2d')]({'id':_0x1e9233[_0x47bf('0x2e')],'name':_0x1e9233[_0x47bf('0x2f')]});});}});}else{logger['info'](_0x47bf('0x2b'),_0x3a15b4);return _0x3f3a37[_0x47bf('0x2c')]()[_0x47bf('0x25')](function(_0x5c9fdc){return BPromise['resolve']({'id':_0x5c9fdc[_0x47bf('0x2e')],'name':_0x5c9fdc[_0x47bf('0x2f')]});});}}function getEndUser(_0x26fef3,_0x1b819f,_0x1990eb,_0x376321,_0x3e6ab4){var _0x1c0eb5={'$or':{'Phone':_0x376321}};var _0x3340f5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x47bf('0x25')](function(){logger[_0x47bf('0x28')](_0x47bf('0x30'),_0x376321,_0x1b819f[_0x47bf('0x31')]);switch(_0x1b819f[_0x47bf('0x31')]){case _0x47bf('0x32'):var _0x18f24a=_[_0x47bf('0x33')](_0x1c0eb5);if(_0x1b819f['additionalSearchContact']){var _0x4dd157={};_0x4dd157[_0x1b819f[_0x47bf('0x34')]]=_0x376321;_[_0x47bf('0x35')](_0x18f24a['$or'],_0x4dd157);}return _0x3e6ab4['sobject'](_0x47bf('0x36'))[_0x47bf('0x37')](_0x18f24a,_0x3340f5)[_0x47bf('0x24')]()['then'](function(_0x33332d){if(_0x33332d&&_0x33332d[_0x47bf('0x26')]){return _0x33332d;}else{var _0xfef05e=_[_0x47bf('0x33')](_0x1c0eb5);if(_0x1b819f['additionalSearchLead']){var _0x4248c6={};_0x4248c6[_0x1b819f['additionalSearchLead']]=_0x376321;_['merge'](_0xfef05e[_0x47bf('0x38')],_0x4248c6);}return _0x3e6ab4['sobject'](_0x47bf('0x39'))[_0x47bf('0x37')](_0xfef05e,_0x3340f5);}});case _0x47bf('0x3a'):var _0x1ebaa9=_[_0x47bf('0x33')](_0x1c0eb5);if(_0x1b819f[_0x47bf('0x3b')]){var _0x4dd157={};_0x4dd157[_0x1b819f[_0x47bf('0x3b')]]=_0x376321;_[_0x47bf('0x35')](_0x1ebaa9[_0x47bf('0x38')],_0x4dd157);}return _0x3e6ab4[_0x47bf('0x1f')](_0x47bf('0x3c'))[_0x47bf('0x37')](_0x1ebaa9,_0x3340f5)[_0x47bf('0x24')]()['then'](function(_0xbb51b){if(_0xbb51b&&_0xbb51b[_0x47bf('0x26')]){return _0xbb51b;}else{var _0x5adab8=_['cloneDeep'](_0x1c0eb5);if(_0x1b819f[_0x47bf('0x34')]){var _0x3c8d4b={};_0x3c8d4b[_0x1b819f[_0x47bf('0x34')]]=_0x376321;_[_0x47bf('0x35')](_0x5adab8['$or'],_0x3c8d4b);}return _0x3e6ab4[_0x47bf('0x1f')]('Contact')[_0x47bf('0x37')](_0x5adab8,_0x3340f5)[_0x47bf('0x25')](function(_0x2ae0c9){if(_0x2ae0c9&&_0x2ae0c9[_0x47bf('0x26')]){return _0x2ae0c9;}else{var _0x164a88=_[_0x47bf('0x33')](_0x1c0eb5);if(_0x1b819f['additionalSearchLead']){var _0xd884e2={};_0xd884e2[_0x1b819f[_0x47bf('0x3d')]]=_0x376321;_[_0x47bf('0x35')](_0x164a88[_0x47bf('0x38')],_0xd884e2);}return _0x3e6ab4[_0x47bf('0x1f')](_0x47bf('0x39'))['find'](_0x164a88,_0x3340f5);}});}});case _0x47bf('0x1b'):var _0x18f24a=_['cloneDeep'](_0x1c0eb5);if(_0x1b819f[_0x47bf('0x34')]){var _0x4dd157={};_0x4dd157[_0x1b819f[_0x47bf('0x34')]]=_0x376321;_[_0x47bf('0x35')](_0x18f24a[_0x47bf('0x38')],_0x4dd157);}return _0x3e6ab4[_0x47bf('0x1f')]('Contact')[_0x47bf('0x37')](_0x18f24a,_0x3340f5)[_0x47bf('0x24')]();case _0x47bf('0x17'):var _0x309042=_['cloneDeep'](_0x1c0eb5);if(_0x1b819f[_0x47bf('0x3d')]){var _0x4dd157={};_0x4dd157[_0x1b819f['additionalSearchLead']]=_0x376321;_['merge'](_0x309042[_0x47bf('0x38')],_0x4dd157);}return _0x3e6ab4[_0x47bf('0x1f')]('Lead')[_0x47bf('0x37')](_0x309042,_0x3340f5);case _0x47bf('0x19'):var _0x1ebaa9=_['cloneDeep'](_0x1c0eb5);if(_0x1b819f[_0x47bf('0x3b')]){var _0x4dd157={};_0x4dd157[_0x1b819f[_0x47bf('0x3b')]]=_0x376321;_[_0x47bf('0x35')](_0x1ebaa9['$or'],_0x4dd157);}return _0x3e6ab4[_0x47bf('0x1f')](_0x47bf('0x3c'))[_0x47bf('0x37')](_0x1ebaa9,_0x3340f5);default:return null;}})[_0x47bf('0x25')](function(_0x64dd4c){if(_0x64dd4c&&_0x64dd4c[_0x47bf('0x26')]){var _0x482899=_['first'](_0x64dd4c);if(_0x482899){return BPromise['resolve']({'id':_0x482899['Id'],'name':_0x482899[_0x47bf('0x2a')],'phone':_0x482899[_0x47bf('0x3e')],'endUserType':_0x482899[_0x47bf('0x3f')][_0x47bf('0x40')][_0x47bf('0x41')]()});}}})[_0x47bf('0x25')](function(_0x340820){if(_0x340820){logger[_0x47bf('0x28')](_0x47bf('0x42'),_0x340820['endUserType'],_0x376321);return BPromise[_0x47bf('0x2d')](_0x340820);}else{logger[_0x47bf('0x28')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x376321);var _0xc7b257={'Phone':_0x376321};if(_0x1b819f['moduleCreate']){if(_0x1b819f[_0x47bf('0x43')]==='contact'){logger[_0x47bf('0x28')](_0x47bf('0x44'),_0x376321,_0x1b819f[_0x47bf('0x43')]);_0xc7b257['LastName']=_0x1990eb!==_0x47bf('0x45')?_0x1990eb:util[_0x47bf('0x46')](_0x47bf('0x47'),_0x376321);}else if(_0x1b819f[_0x47bf('0x43')]==='lead'){logger[_0x47bf('0x28')](_0x47bf('0x44'),_0x376321,_0x1b819f[_0x47bf('0x43')]);_0xc7b257[_0x47bf('0x48')]=_0x1990eb!==_0x47bf('0x45')?_0x1990eb:util['format'](_0x47bf('0x47'),_0x376321);_0xc7b257['Company']=_0x47bf('0x49');}else if(_0x1b819f[_0x47bf('0x43')]==='account'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x376321,_0x1b819f[_0x47bf('0x43')]);_0xc7b257[_0x47bf('0x2a')]=_0x1990eb!==_0x47bf('0x45')?_0x1990eb:util[_0x47bf('0x46')](_0x47bf('0x47'),_0x376321);}else{return null;}}return _0x3e6ab4[_0x47bf('0x1f')](_[_0x47bf('0x4a')](_0x1b819f[_0x47bf('0x43')]))['create'](_0xc7b257)[_0x47bf('0x25')](function(_0x112380){return BPromise[_0x47bf('0x2d')]({'id':_0x112380['id'],'endUserType':_0x1b819f['moduleCreate']});});}});}function getCustomFields(_0x43bd6f,_0x266b48){var _0x38c919={};if(_0x43bd6f[_0x47bf('0x26')]>0x0){_[_0x47bf('0x4b')](_0x43bd6f,function(_0x518d9f){if(_['includes']([_0x47bf('0x4c'),_0x47bf('0x4d')],_0x518d9f[_0x47bf('0x40')])&&_0x518d9f[_0x47bf('0x4e')]){_0x38c919[_0x518d9f[_0x47bf('0x4e')]]=_0x518d9f['content'][_0x47bf('0x4f')]();}else if(_0x518d9f[_0x47bf('0x40')]==='variable'&&_0x518d9f[_0x47bf('0x50')]&&_0x518d9f[_0x47bf('0x4e')]){_0x266b48[_0x518d9f['variableName']]&&(_0x38c919[_0x518d9f[_0x47bf('0x4e')]]=_0x266b48[_0x518d9f[_0x47bf('0x50')]][_0x47bf('0x4f')]());}else if(_0x518d9f[_0x47bf('0x40')]===_0x47bf('0x51')&&_0x518d9f[_0x47bf('0x52')]&&_0x518d9f[_0x47bf('0x52')][_0x47bf('0x53')]&&_0x518d9f['idField']){_0x266b48[_0x518d9f[_0x47bf('0x52')]['name']['toLowerCase']()]&&(_0x38c919[_0x518d9f['idField']]=_0x266b48[_0x518d9f[_0x47bf('0x52')][_0x47bf('0x53')][_0x47bf('0x41')]()][_0x47bf('0x4f')]());}});}return _0x38c919;}function getConnection(_0xe93933){var _0x109df4=_0xe93933[_0x47bf('0x54')][_0x47bf('0x55')](_0xe93933[_0x47bf('0x56')]);var _0x4c6394=new jsforce[(_0x47bf('0x57'))]({'oauth2':{'loginUrl':_0xe93933[_0x47bf('0x58')]||_0x47bf('0x59'),'clientId':_0xe93933[_0x47bf('0x5a')],'clientSecret':_0xe93933['clientSecret']}});return _0x4c6394['login'](_0xe93933[_0x47bf('0x5b')],_0x109df4)[_0x47bf('0x25')](function(){logger[_0x47bf('0x28')](_0x47bf('0x5c'));return _0x4c6394;});}exports[_0x47bf('0x5d')]=function(_0x3f4c2e,_0x50f493,_0xb92726,_0xa2f9b7,_0x5afda6,_0x2a2e09){var _0x2e84de,_0x59965e,_0x1fb686,_0x153a21;_0x2a2e09[_0x47bf('0x5e')]=intUtil[_0x47bf('0x5f')](_0x2a2e09[_0x47bf('0x5e')]);_0x2a2e09[_0x47bf('0x58')]=intUtil['stripTrailingSlash'](_0x2a2e09[_0x47bf('0x58')]);if(_0x5afda6&&_0x5afda6[_0x47bf('0x60')]){logger[_0x47bf('0x28')]('[QUEUE]',_0x47bf('0x61'));_0x50f493[_0x47bf('0x62')]=util[_0x47bf('0x46')](_0x47bf('0x63'),_0x2a2e09['serverUrl'],_0x50f493[_0x47bf('0x64')],md5(_0x50f493[_0x47bf('0x64')]));}else{_0x50f493[_0x47bf('0x62')]='';}return getConnection(_0x2a2e09)['then'](function(_0x4a41f0){_0x153a21=_0x4a41f0;return getUser(_0x2a2e09,_0xa2f9b7[_0x47bf('0x65')],_0x153a21);})['then'](function(_0x316665){_0x2e84de=_0x316665;return getEndUser(_0x2a2e09,_0xb92726,_0x50f493['calleridname'],_0x50f493[_0x47bf('0x66')],_0x153a21);})[_0x47bf('0x25')](function(_0xd21731){_0x59965e=_0xd21731;return getTicket(_0x2a2e09,_0x2e84de,_0x59965e,_0xb92726,_0x50f493,_0xb92726[_0x47bf('0x67')],_0x153a21,_0x47bf('0x5d'));})[_0x47bf('0x25')](function(_0x50989c){_0x1fb686=_0x50989c;logger[_0x47bf('0x28')](_0x47bf('0x68'),_0x1fb686['id']);logger[_0x47bf('0x28')](_0x47bf('0x69'),_0x1fb686['id'],_0xa2f9b7[_0x47bf('0x53')],_0x2a2e09[_0x47bf('0x40')]);switch(_0x2a2e09['type']){case'integrationTab':emit(util[_0x47bf('0x46')]('user:%s',_0xa2f9b7[_0x47bf('0x53')]),_0x47bf('0x6a'),{'recordId':_0x1fb686['id']});break;case'newTab':emit(util['format'](_0x47bf('0x6b'),_0xa2f9b7[_0x47bf('0x53')]),_0x47bf('0x6c'),{'uri':util[_0x47bf('0x46')](_0x47bf('0x6d'),_0x153a21[_0x47bf('0x6e')],_0x1fb686['id'])});break;default:logger[_0x47bf('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x453338){logger[_0x47bf('0x6f')](_0x47bf('0x70'),_0x453338);});};exports[_0x47bf('0x71')]=function(_0x3ad050,_0xdb4380,_0x318946,_0x19e55b,_0x275065,_0x385e85,_0x1705e8){var _0xedb7b8,_0x1a3d1f,_0x125035,_0x1b0bf6;_0x385e85[_0x47bf('0x5e')]=intUtil['stripTrailingSlash'](_0x385e85[_0x47bf('0x5e')]);_0x385e85[_0x47bf('0x58')]=intUtil[_0x47bf('0x5f')](_0x385e85['remoteUri']);if(_0x1705e8&&_0x1705e8[_0x47bf('0x72')]&&_0x1705e8[_0x47bf('0x72')]!==_0x47bf('0x73')){logger[_0x47bf('0x28')](_0x47bf('0x74'),_0x47bf('0x61'));_0xdb4380[_0x47bf('0x62')]=util[_0x47bf('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x385e85[_0x47bf('0x5e')],_0xdb4380[_0x47bf('0x64')],md5(_0xdb4380[_0x47bf('0x64')]));}return getConnection(_0x385e85)['then'](function(_0x447a4e){_0x1b0bf6=_0x447a4e;return getUser(_0x385e85,_0x19e55b[_0x47bf('0x65')],_0x1b0bf6);})['then'](function(_0x268843){_0xedb7b8=_0x268843;return getEndUser(_0x385e85,_0x318946,_0xdb4380[_0x47bf('0x75')],_0xdb4380[_0x47bf('0x76')],_0x1b0bf6);})[_0x47bf('0x25')](function(_0xa4ee57){_0x1a3d1f=_0xa4ee57;return getTicket(_0x385e85,_0xedb7b8,_0x1a3d1f,_0x318946,_0xdb4380,_0x318946[_0x47bf('0x67')],_0x1b0bf6,_0x47bf('0x71'));})[_0x47bf('0x25')](function(_0x5d9587){_0x125035=_0x5d9587;logger['info'](_0x47bf('0x77'),_0x125035['id']);logger[_0x47bf('0x28')](_0x47bf('0x78'),_0x125035['id'],_0x19e55b[_0x47bf('0x53')],_0x385e85[_0x47bf('0x40')]);switch(_0x385e85[_0x47bf('0x40')]){case'integrationTab':emit(util['format'](_0x47bf('0x6b'),_0x19e55b[_0x47bf('0x53')]),_0x47bf('0x6a'),{'recordId':_0x125035['id']});break;case _0x47bf('0x79'):emit(util[_0x47bf('0x46')]('user:%s',_0x19e55b[_0x47bf('0x53')]),_0x47bf('0x6c'),{'uri':util[_0x47bf('0x46')](_0x47bf('0x6d'),_0x1b0bf6[_0x47bf('0x6e')],_0x125035['id'])});break;default:logger[_0x47bf('0x6f')](_0x47bf('0x74'),_0x47bf('0x7a'));}})[_0x47bf('0x7b')](function(_0x4b5108){logger[_0x47bf('0x6f')]('[OUTBOUND]',_0x4b5108);});};exports[_0x47bf('0x7c')]=function(_0x3d5b55,_0xadafa7,_0x31719e,_0x5ab7bb,_0x153e38,_0x3ae595){var _0x3369fa,_0x345d42,_0x544ced,_0x407715;_0x3ae595[_0x47bf('0x5e')]=intUtil['stripTrailingSlash'](_0x3ae595['serverUrl']);_0x3ae595[_0x47bf('0x58')]=intUtil[_0x47bf('0x5f')](_0x3ae595[_0x47bf('0x58')]);if(_0x153e38&&_0x153e38['monitor_format']){logger['info']('['+_0xadafa7[_0x47bf('0x7d')][_0x47bf('0x7e')]()+']','Recording\x20is\x20enabled!');_0xadafa7[_0x47bf('0x62')]=util[_0x47bf('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ae595[_0x47bf('0x5e')],_0xadafa7[_0x47bf('0x64')],md5(_0xadafa7[_0x47bf('0x64')]));}else{_0xadafa7[_0x47bf('0x62')]='';}return getConnection(_0x3ae595)[_0x47bf('0x25')](function(_0x28cbba){_0x407715=_0x28cbba;if(!_['isNil'](_0x5ab7bb)){return getUser(_0x3ae595,_0x5ab7bb[_0x47bf('0x53')],_0x407715);}else{return getUser(_0x3ae595,null,_0x407715);}})[_0x47bf('0x25')](function(_0x5cb2d1){_0x3369fa=_0x5cb2d1;return getEndUser(_0x3ae595,_0x31719e,_0xadafa7[_0x47bf('0x7f')],_0xadafa7['calleridnum'],_0x407715);})['then'](function(_0x2db062){_0x345d42=_0x2db062;return getTicket(_0x3ae595,_0x3369fa,_0x345d42,_0x31719e,_0xadafa7,_0x31719e['Fields'],_0x407715);})[_0x47bf('0x25')](function(_0x3c28d0){_0x544ced=_0x3c28d0;logger['info']('['+_0xadafa7[_0x47bf('0x7d')][_0x47bf('0x7e')]()+_0x47bf('0x80'),_0x544ced['id']);logger[_0x47bf('0x28')]('['+_0xadafa7['lastevent']['toUpperCase']()+_0x47bf('0x81'),_0x3ae595['type']);})[_0x47bf('0x7b')](function(_0x1a92f1){logger[_0x47bf('0x6f')]('['+_0xadafa7[_0x47bf('0x7d')][_0x47bf('0x7e')]()+']',_0x1a92f1);});}; \ No newline at end of file +var _0xd4fb=['catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','./util','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','info','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','forEach','includes','idField','toString','variableName','customVariable','Variable','name','toLowerCase','password','remoteUri','https://login.salesforce.com','clientSecret','username','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e'];(function(_0xb0a1ba,_0x58a818){var _0x9a6793=function(_0x2d75ca){while(--_0x2d75ca){_0xb0a1ba['push'](_0xb0a1ba['shift']());}};_0x9a6793(++_0x58a818);}(_0xd4fb,0x187));var _0xbd4f=function(_0x35737d,_0x4d30ce){_0x35737d=_0x35737d-0x0;var _0x4b34b1=_0xd4fb[_0x35737d];return _0x4b34b1;};'use strict';var _=require(_0xbd4f('0x0'));var rp=require(_0xbd4f('0x1'));var moment=require(_0xbd4f('0x2'));var BPromise=require(_0xbd4f('0x3'));var md5=require(_0xbd4f('0x4'));var jsforce=require(_0xbd4f('0x5'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbd4f('0x6'));var config=require(_0xbd4f('0x7'));var logger=require('../../../../config/logger')(_0xbd4f('0x8'));config[_0xbd4f('0x9')]=_['defaults'](config[_0xbd4f('0x9')],{'host':_0xbd4f('0xa'),'port':0x18eb});var io=require(_0xbd4f('0xb'))(new Redis(config[_0xbd4f('0x9')]));function emit(_0x32374d,_0x22bf00,_0x1e2727){io['to'](_0x32374d)['emit'](_0x22bf00,_0x1e2727);}function getTicket(_0x253445,_0xc08511,_0x561c17,_0x396cac,_0x59c72e,_0x294023,_0x154038,_0x41e024){var _0x583b1b=Object[_0xbd4f('0xc')]({},{'OwnerId':_0xc08511['id'],'Subject':intUtil[_0xbd4f('0xd')](_0x396cac[_0xbd4f('0xe')],_0x59c72e,'\x20'),'Description':intUtil[_0xbd4f('0xd')](_0x396cac[_0xbd4f('0xf')],_0x59c72e,'\x0a')},getCustomFields(_0x294023,_0x59c72e));if(_0x561c17){if(_0x396cac[_0xbd4f('0x10')]===_0xbd4f('0x11')){_0x583b1b[_0xbd4f('0x12')]=moment[_0xbd4f('0x13')]();_0x583b1b[_0xbd4f('0x14')]=![];_0x583b1b[_0xbd4f('0x15')]=![];if(_0x561c17['endUserType']===_0xbd4f('0x16')||_0x561c17[_0xbd4f('0x17')]===_0xbd4f('0x18')){_0x583b1b[_0xbd4f('0x19')]=_0x561c17['id'];}else if(_0x561c17[_0xbd4f('0x17')]===_0xbd4f('0x1a')){_0x583b1b[_0xbd4f('0x1b')]=_0x561c17['id'];}}else if(_0x396cac[_0xbd4f('0x10')]===_0xbd4f('0x1c')){if(_0x561c17[_0xbd4f('0x17')]===_0xbd4f('0x16')){_0x583b1b['ContactId']=_0x561c17['id'];}else if(_0x561c17[_0xbd4f('0x17')]===_0xbd4f('0x1a')){_0x583b1b[_0xbd4f('0x1d')]=_0x561c17['id'];}else if(_0x561c17[_0xbd4f('0x17')]===_0xbd4f('0x18')&&_0x396cac[_0xbd4f('0x1e')]){_0x583b1b[_0x396cac[_0xbd4f('0x1e')]]=_0x561c17['id'];}else{logger['info'](_0xbd4f('0x1f'));}}}return _0x154038[_0xbd4f('0x20')](_0x396cac['ticketType'])[_0xbd4f('0x21')](_0x583b1b);}function getUser(_0x1947b3,_0x2fc847,_0x2a946b){if(!_[_0xbd4f('0x22')](_0x2fc847)&&intUtil[_0xbd4f('0x23')](_0x2fc847)){var _0x212117={'Email':_0x2fc847};var _0x57035b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2a946b[_0xbd4f('0x20')](_0xbd4f('0x24'))['find'](_0x212117,_0x57035b)['execute']()[_0xbd4f('0x25')](function(_0x4c49e){if(_0x4c49e[_0xbd4f('0x26')]){var _0x1409b3=_[_0xbd4f('0x27')](_0x4c49e,function(_0x14de9c){return _0x14de9c[_0xbd4f('0x28')]===_0x2fc847;});if(_0x1409b3){logger['info']('Agent\x20%s\x20found.',_0x2fc847);return BPromise[_0xbd4f('0x29')]({'id':_0x1409b3['Id'],'name':_0x1409b3[_0xbd4f('0x2a')]});}}else{logger['info'](_0xbd4f('0x2b'),_0x2fc847);return _0x2a946b[_0xbd4f('0x2c')]()[_0xbd4f('0x25')](function(_0x3a2f71){return BPromise[_0xbd4f('0x29')]({'id':_0x3a2f71['user_id'],'name':_0x3a2f71[_0xbd4f('0x2d')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2fc847);return _0x2a946b[_0xbd4f('0x2c')]()[_0xbd4f('0x25')](function(_0x532655){return BPromise[_0xbd4f('0x29')]({'id':_0x532655['user_id'],'name':_0x532655[_0xbd4f('0x2d')]});});}}function getEndUser(_0x2c0280,_0x1679da,_0x4430b3,_0x3ace88,_0x4803e1){var _0x53a2be={'$or':{'Phone':_0x3ace88}};var _0x4683b6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbd4f('0x29')]()[_0xbd4f('0x25')](function(){logger[_0xbd4f('0x2e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3ace88,_0x1679da[_0xbd4f('0x2f')]);switch(_0x1679da[_0xbd4f('0x2f')]){case _0xbd4f('0x30'):var _0x1f26ae=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da[_0xbd4f('0x32')]){var _0x4760cd={};_0x4760cd[_0x1679da[_0xbd4f('0x32')]]=_0x3ace88;_[_0xbd4f('0x33')](_0x1f26ae[_0xbd4f('0x34')],_0x4760cd);}return _0x4803e1[_0xbd4f('0x20')](_0xbd4f('0x35'))['find'](_0x1f26ae,_0x4683b6)[_0xbd4f('0x36')]()[_0xbd4f('0x25')](function(_0x3f8dd6){if(_0x3f8dd6&&_0x3f8dd6[_0xbd4f('0x26')]){return _0x3f8dd6;}else{var _0x5ee8d0=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da['additionalSearchLead']){var _0x3a6e7d={};_0x3a6e7d[_0x1679da[_0xbd4f('0x37')]]=_0x3ace88;_['merge'](_0x5ee8d0[_0xbd4f('0x34')],_0x3a6e7d);}return _0x4803e1['sobject'](_0xbd4f('0x38'))['find'](_0x5ee8d0,_0x4683b6);}});case _0xbd4f('0x39'):var _0x1ff604=_['cloneDeep'](_0x53a2be);if(_0x1679da[_0xbd4f('0x3a')]){var _0x4760cd={};_0x4760cd[_0x1679da[_0xbd4f('0x3a')]]=_0x3ace88;_[_0xbd4f('0x33')](_0x1ff604[_0xbd4f('0x34')],_0x4760cd);}return _0x4803e1[_0xbd4f('0x20')](_0xbd4f('0x3b'))[_0xbd4f('0x27')](_0x1ff604,_0x4683b6)[_0xbd4f('0x36')]()[_0xbd4f('0x25')](function(_0x491a3c){if(_0x491a3c&&_0x491a3c[_0xbd4f('0x26')]){return _0x491a3c;}else{var _0xbf21ab=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da[_0xbd4f('0x32')]){var _0x308ed6={};_0x308ed6[_0x1679da[_0xbd4f('0x32')]]=_0x3ace88;_[_0xbd4f('0x33')](_0xbf21ab['$or'],_0x308ed6);}return _0x4803e1[_0xbd4f('0x20')](_0xbd4f('0x35'))['find'](_0xbf21ab,_0x4683b6)[_0xbd4f('0x25')](function(_0x3b8e12){if(_0x3b8e12&&_0x3b8e12[_0xbd4f('0x26')]){return _0x3b8e12;}else{var _0x283921=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da['additionalSearchLead']){var _0x3f5b65={};_0x3f5b65[_0x1679da['additionalSearchLead']]=_0x3ace88;_[_0xbd4f('0x33')](_0x283921[_0xbd4f('0x34')],_0x3f5b65);}return _0x4803e1[_0xbd4f('0x20')](_0xbd4f('0x38'))[_0xbd4f('0x27')](_0x283921,_0x4683b6);}});}});case _0xbd4f('0x16'):var _0x1f26ae=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da['additionalSearchContact']){var _0x4760cd={};_0x4760cd[_0x1679da[_0xbd4f('0x32')]]=_0x3ace88;_[_0xbd4f('0x33')](_0x1f26ae[_0xbd4f('0x34')],_0x4760cd);}return _0x4803e1[_0xbd4f('0x20')](_0xbd4f('0x35'))[_0xbd4f('0x27')](_0x1f26ae,_0x4683b6)[_0xbd4f('0x36')]();case _0xbd4f('0x18'):var _0x5eeabc=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da['additionalSearchLead']){var _0x4760cd={};_0x4760cd[_0x1679da[_0xbd4f('0x37')]]=_0x3ace88;_[_0xbd4f('0x33')](_0x5eeabc[_0xbd4f('0x34')],_0x4760cd);}return _0x4803e1['sobject'](_0xbd4f('0x38'))[_0xbd4f('0x27')](_0x5eeabc,_0x4683b6);case _0xbd4f('0x1a'):var _0x1ff604=_[_0xbd4f('0x31')](_0x53a2be);if(_0x1679da[_0xbd4f('0x3a')]){var _0x4760cd={};_0x4760cd[_0x1679da[_0xbd4f('0x3a')]]=_0x3ace88;_[_0xbd4f('0x33')](_0x1ff604[_0xbd4f('0x34')],_0x4760cd);}return _0x4803e1['sobject']('Account')[_0xbd4f('0x27')](_0x1ff604,_0x4683b6);default:return null;}})[_0xbd4f('0x25')](function(_0x1fa108){if(_0x1fa108&&_0x1fa108[_0xbd4f('0x26')]){var _0x5ab0f0=_[_0xbd4f('0x3c')](_0x1fa108);if(_0x5ab0f0){return BPromise[_0xbd4f('0x29')]({'id':_0x5ab0f0['Id'],'name':_0x5ab0f0['Name'],'phone':_0x5ab0f0[_0xbd4f('0x3d')],'endUserType':_0x5ab0f0[_0xbd4f('0x3e')][_0xbd4f('0x3f')]['toLowerCase']()});}}})[_0xbd4f('0x25')](function(_0x51d303){if(_0x51d303){logger['info'](_0xbd4f('0x40'),_0x51d303[_0xbd4f('0x17')],_0x3ace88);return BPromise[_0xbd4f('0x29')](_0x51d303);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x3ace88);var _0x44b0d1={'Phone':_0x3ace88};if(_0x1679da[_0xbd4f('0x41')]){if(_0x1679da[_0xbd4f('0x41')]===_0xbd4f('0x16')){logger[_0xbd4f('0x2e')](_0xbd4f('0x42'),_0x3ace88,_0x1679da[_0xbd4f('0x41')]);_0x44b0d1[_0xbd4f('0x43')]=_0x4430b3!==_0xbd4f('0x44')?_0x4430b3:util['format'](_0xbd4f('0x45'),_0x3ace88);}else if(_0x1679da[_0xbd4f('0x41')]===_0xbd4f('0x18')){logger[_0xbd4f('0x2e')](_0xbd4f('0x42'),_0x3ace88,_0x1679da[_0xbd4f('0x41')]);_0x44b0d1['LastName']=_0x4430b3!==_0xbd4f('0x44')?_0x4430b3:util[_0xbd4f('0x46')]('Caller\x20-\x20%s',_0x3ace88);_0x44b0d1[_0xbd4f('0x47')]=_0xbd4f('0x48');}else if(_0x1679da['moduleCreate']==='account'){logger[_0xbd4f('0x2e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3ace88,_0x1679da[_0xbd4f('0x41')]);_0x44b0d1[_0xbd4f('0x2a')]=_0x4430b3!==_0xbd4f('0x44')?_0x4430b3:util[_0xbd4f('0x46')](_0xbd4f('0x45'),_0x3ace88);}else{return null;}}return _0x4803e1[_0xbd4f('0x20')](_['upperFirst'](_0x1679da[_0xbd4f('0x41')]))[_0xbd4f('0x21')](_0x44b0d1)[_0xbd4f('0x25')](function(_0x885132){return BPromise[_0xbd4f('0x29')]({'id':_0x885132['id'],'endUserType':_0x1679da['moduleCreate']});});}});}function getCustomFields(_0x14b6cb,_0x18f0c9){var _0x3b6958={};if(_0x14b6cb['length']>0x0){_[_0xbd4f('0x49')](_0x14b6cb,function(_0xd380cf){if(_[_0xbd4f('0x4a')](['string','picklist'],_0xd380cf[_0xbd4f('0x3f')])&&_0xd380cf[_0xbd4f('0x4b')]){_0x3b6958[_0xd380cf[_0xbd4f('0x4b')]]=_0xd380cf['content'][_0xbd4f('0x4c')]();}else if(_0xd380cf[_0xbd4f('0x3f')]==='variable'&&_0xd380cf['variableName']&&_0xd380cf[_0xbd4f('0x4b')]){_0x18f0c9[_0xd380cf[_0xbd4f('0x4d')]]&&(_0x3b6958[_0xd380cf[_0xbd4f('0x4b')]]=_0x18f0c9[_0xd380cf['variableName']][_0xbd4f('0x4c')]());}else if(_0xd380cf[_0xbd4f('0x3f')]===_0xbd4f('0x4e')&&_0xd380cf[_0xbd4f('0x4f')]&&_0xd380cf[_0xbd4f('0x4f')][_0xbd4f('0x50')]&&_0xd380cf[_0xbd4f('0x4b')]){_0x18f0c9[_0xd380cf[_0xbd4f('0x4f')]['name'][_0xbd4f('0x51')]()]&&(_0x3b6958[_0xd380cf[_0xbd4f('0x4b')]]=_0x18f0c9[_0xd380cf[_0xbd4f('0x4f')]['name'][_0xbd4f('0x51')]()][_0xbd4f('0x4c')]());}});}return _0x3b6958;}function getConnection(_0x431f69){var _0x3176fb=_0x431f69[_0xbd4f('0x52')]['concat'](_0x431f69['securityToken']);var _0x5bb73f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x431f69[_0xbd4f('0x53')]||_0xbd4f('0x54'),'clientId':_0x431f69['clientId'],'clientSecret':_0x431f69[_0xbd4f('0x55')]}});return _0x5bb73f['login'](_0x431f69[_0xbd4f('0x56')],_0x3176fb)[_0xbd4f('0x25')](function(){logger['info']('Connection\x20established.');return _0x5bb73f;});}exports[_0xbd4f('0x57')]=function(_0x330f16,_0x47e458,_0x26b97d,_0x4e6ec8,_0x27aa24,_0x4654f2){var _0x4f3bd6,_0x60d9eb,_0x81483f,_0x55a9e6;_0x4654f2['serverUrl']=intUtil[_0xbd4f('0x58')](_0x4654f2[_0xbd4f('0x59')]);_0x4654f2[_0xbd4f('0x53')]=intUtil[_0xbd4f('0x58')](_0x4654f2[_0xbd4f('0x53')]);if(_0x27aa24&&_0x27aa24['monitor_format']){logger[_0xbd4f('0x2e')](_0xbd4f('0x5a'),_0xbd4f('0x5b'));_0x47e458['recordingURL']=util[_0xbd4f('0x46')](_0xbd4f('0x5c'),_0x4654f2[_0xbd4f('0x59')],_0x47e458['uniqueid'],md5(_0x47e458[_0xbd4f('0x5d')]));}else{_0x47e458[_0xbd4f('0x5e')]='';}return getConnection(_0x4654f2)[_0xbd4f('0x25')](function(_0x5c3818){_0x55a9e6=_0x5c3818;return getUser(_0x4654f2,_0x4e6ec8[_0xbd4f('0x5f')],_0x55a9e6);})['then'](function(_0x44851e){_0x4f3bd6=_0x44851e;return getEndUser(_0x4654f2,_0x26b97d,_0x47e458['calleridname'],_0x47e458[_0xbd4f('0x60')],_0x55a9e6);})[_0xbd4f('0x25')](function(_0xb174c1){_0x60d9eb=_0xb174c1;return getTicket(_0x4654f2,_0x4f3bd6,_0x60d9eb,_0x26b97d,_0x47e458,_0x26b97d['Fields'],_0x55a9e6,_0xbd4f('0x57'));})[_0xbd4f('0x25')](function(_0x5e16a6){_0x81483f=_0x5e16a6;logger[_0xbd4f('0x2e')](_0xbd4f('0x61'),_0x81483f['id']);logger[_0xbd4f('0x2e')](_0xbd4f('0x62'),_0x81483f['id'],_0x4e6ec8[_0xbd4f('0x50')],_0x4654f2[_0xbd4f('0x3f')]);switch(_0x4654f2[_0xbd4f('0x3f')]){case _0xbd4f('0x63'):emit(util[_0xbd4f('0x46')](_0xbd4f('0x64'),_0x4e6ec8[_0xbd4f('0x50')]),_0xbd4f('0x65'),{'recordId':_0x81483f['id']});break;case _0xbd4f('0x66'):emit(util[_0xbd4f('0x46')]('user:%s',_0x4e6ec8['name']),_0xbd4f('0x67'),{'uri':util['format'](_0xbd4f('0x68'),_0x55a9e6['instanceUrl'],_0x81483f['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xbd4f('0x69')](function(_0x5d9a31){logger[_0xbd4f('0x6a')](_0xbd4f('0x5a'),_0x5d9a31);});};exports[_0xbd4f('0x6b')]=function(_0x59cf99,_0x220686,_0x1b5f74,_0x5563e9,_0x15b711,_0x57bd41,_0x57dfb3){var _0x1920a0,_0x2e53fd,_0x5764e2,_0x134dc4;_0x57bd41[_0xbd4f('0x59')]=intUtil[_0xbd4f('0x58')](_0x57bd41[_0xbd4f('0x59')]);_0x57bd41[_0xbd4f('0x53')]=intUtil[_0xbd4f('0x58')](_0x57bd41[_0xbd4f('0x53')]);if(_0x57dfb3&&_0x57dfb3[_0xbd4f('0x6c')]&&_0x57dfb3[_0xbd4f('0x6c')]!==_0xbd4f('0x6d')){logger['info'](_0xbd4f('0x6e'),_0xbd4f('0x5b'));_0x220686[_0xbd4f('0x5e')]=util[_0xbd4f('0x46')](_0xbd4f('0x5c'),_0x57bd41['serverUrl'],_0x220686[_0xbd4f('0x5d')],md5(_0x220686[_0xbd4f('0x5d')]));}return getConnection(_0x57bd41)['then'](function(_0x49967e){_0x134dc4=_0x49967e;return getUser(_0x57bd41,_0x5563e9[_0xbd4f('0x5f')],_0x134dc4);})['then'](function(_0x5882b8){_0x1920a0=_0x5882b8;return getEndUser(_0x57bd41,_0x1b5f74,_0x220686[_0xbd4f('0x6f')],_0x220686[_0xbd4f('0x70')],_0x134dc4);})[_0xbd4f('0x25')](function(_0x42b747){_0x2e53fd=_0x42b747;return getTicket(_0x57bd41,_0x1920a0,_0x2e53fd,_0x1b5f74,_0x220686,_0x1b5f74[_0xbd4f('0x71')],_0x134dc4,'outbound');})[_0xbd4f('0x25')](function(_0x5287de){_0x5764e2=_0x5287de;logger[_0xbd4f('0x2e')](_0xbd4f('0x72'),_0x5764e2['id']);logger[_0xbd4f('0x2e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5764e2['id'],_0x5563e9[_0xbd4f('0x50')],_0x57bd41[_0xbd4f('0x3f')]);switch(_0x57bd41['type']){case _0xbd4f('0x63'):emit(util['format'](_0xbd4f('0x64'),_0x5563e9[_0xbd4f('0x50')]),_0xbd4f('0x65'),{'recordId':_0x5764e2['id']});break;case _0xbd4f('0x66'):emit(util[_0xbd4f('0x46')]('user:%s',_0x5563e9['name']),_0xbd4f('0x67'),{'uri':util[_0xbd4f('0x46')]('%s/%s/e',_0x134dc4[_0xbd4f('0x73')],_0x5764e2['id'])});break;default:logger['error'](_0xbd4f('0x6e'),_0xbd4f('0x74'));}})[_0xbd4f('0x69')](function(_0x18d04e){logger[_0xbd4f('0x6a')](_0xbd4f('0x6e'),_0x18d04e);});};exports[_0xbd4f('0x75')]=function(_0x83bc63,_0xeb87b3,_0x3dd609,_0x3480c7,_0x4a7556,_0x1a9423){var _0x1087fb,_0xc8541e,_0x81717c,_0x213f94;_0x1a9423['serverUrl']=intUtil[_0xbd4f('0x58')](_0x1a9423[_0xbd4f('0x59')]);_0x1a9423[_0xbd4f('0x53')]=intUtil['stripTrailingSlash'](_0x1a9423[_0xbd4f('0x53')]);if(_0x4a7556&&_0x4a7556[_0xbd4f('0x76')]){logger['info']('['+_0xeb87b3[_0xbd4f('0x77')][_0xbd4f('0x78')]()+']',_0xbd4f('0x5b'));_0xeb87b3['recordingURL']=util[_0xbd4f('0x46')](_0xbd4f('0x5c'),_0x1a9423[_0xbd4f('0x59')],_0xeb87b3[_0xbd4f('0x5d')],md5(_0xeb87b3[_0xbd4f('0x5d')]));}else{_0xeb87b3[_0xbd4f('0x5e')]='';}return getConnection(_0x1a9423)[_0xbd4f('0x25')](function(_0x2e64a7){_0x213f94=_0x2e64a7;if(!_[_0xbd4f('0x22')](_0x3480c7)){return getUser(_0x1a9423,_0x3480c7[_0xbd4f('0x50')],_0x213f94);}else{return getUser(_0x1a9423,null,_0x213f94);}})[_0xbd4f('0x25')](function(_0x4a1423){_0x1087fb=_0x4a1423;return getEndUser(_0x1a9423,_0x3dd609,_0xeb87b3[_0xbd4f('0x79')],_0xeb87b3[_0xbd4f('0x60')],_0x213f94);})[_0xbd4f('0x25')](function(_0x2bcce2){_0xc8541e=_0x2bcce2;return getTicket(_0x1a9423,_0x1087fb,_0xc8541e,_0x3dd609,_0xeb87b3,_0x3dd609[_0xbd4f('0x71')],_0x213f94);})[_0xbd4f('0x25')](function(_0x531ca4){_0x81717c=_0x531ca4;logger[_0xbd4f('0x2e')]('['+_0xeb87b3['lastevent'][_0xbd4f('0x78')]()+_0xbd4f('0x7a'),_0x81717c['id']);logger[_0xbd4f('0x2e')]('['+_0xeb87b3[_0xbd4f('0x77')][_0xbd4f('0x78')]()+_0xbd4f('0x7b'),_0x1a9423[_0xbd4f('0x3f')]);})[_0xbd4f('0x69')](function(_0x15aff5){logger[_0xbd4f('0x6a')]('['+_0xeb87b3['lastevent'][_0xbd4f('0x78')]()+']',_0x15aff5);});}; \ 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 287da90..6195a21 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 _0xea02=['result','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','message',']\x20using\x20admin\x20profile','POST','endUserNumber','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','endUserId','forEach','includes','string','type','nameField','customField','toLowerCase','toString','idField','content','variable','variableName','Variable','name','outbound','assign','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','ticketNumber','push','all','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','format','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xea02,0x12d));var _0x2ea0=function(_0x4a4ba9,_0x206a61){_0x4a4ba9=_0x4a4ba9-0x0;var _0x54ab7d=_0xea02[_0x4a4ba9];return _0x54ab7d;};'use strict';var _=require(_0x2ea0('0x0'));var Promise=require(_0x2ea0('0x1'));var rp=require(_0x2ea0('0x2'));var util=require(_0x2ea0('0x3'));var md5=require('md5');var Redis=require(_0x2ea0('0x4'));var intUtil=require(_0x2ea0('0x5'));var config=require('../../../../config/environment');var logger=require(_0x2ea0('0x6'))(_0x2ea0('0x7'));config[_0x2ea0('0x8')]=_[_0x2ea0('0x9')](config[_0x2ea0('0x8')],{'host':_0x2ea0('0xa'),'port':0x18eb});var io=require(_0x2ea0('0xb'))(new Redis(config[_0x2ea0('0x8')]));function getAdminUser(_0x39b3d0,_0x471646,_0x34fdf6,_0x25da92,_0x10e487,_0x39690b){return new Promise(function(_0x4488d9,_0x184b44){var _0x4ec8be={'method':_0x2ea0('0xc'),'uri':_0x25da92+_0x2ea0('0xd')+'&'+_0x10e487+'&'+_0x39690b,'auth':_0x471646,'json':!![]};return rp(_0x4ec8be)['then'](function(_0x865210){if(_0x865210[_0x2ea0('0xe')]['length']>0x0){_0x34fdf6[_0x2ea0('0xf')]=_0x865210[_0x2ea0('0xe')][0x0]['sys_id'];}logger[_0x2ea0('0x10')]('['+[_0x39b3d0['toUpperCase']()]+_0x2ea0('0x11'),_0x34fdf6);_0x4488d9(_0x34fdf6);})[_0x2ea0('0x12')](function(_0x10b737){logger[_0x2ea0('0x13')]('['+[_0x39b3d0['toUpperCase']()]+']',_0x10b737['message']);_0x184b44(_0x10b737['message']);});});}function getUser(_0x1ac4ee,_0x302693,_0x2c0fac,_0x287aff,_0x429bc2){return function(_0x2c64dc){logger['info']('['+[_0x1ac4ee[_0x2ea0('0x14')]()]+_0x2ea0('0x15'),_0x2c64dc);return new Promise(function(_0x5d725a,_0xb52259){if(intUtil[_0x2ea0('0x16')](_0x2c64dc[_0x2ea0('0x17')])){var _0x30ec39={'method':_0x2ea0('0xc'),'uri':_0x2c0fac+_0x2ea0('0x18')+_0x2c64dc[_0x2ea0('0x17')]+'&'+_0x287aff+'&'+_0x429bc2,'auth':_0x302693,'json':!![]};logger[_0x2ea0('0x10')]('['+[_0x1ac4ee[_0x2ea0('0x14')]()]+_0x2ea0('0x19'),_0x30ec39);return rp(_0x30ec39)[_0x2ea0('0x1a')](function(_0x2260ab){logger['info']('['+[_0x1ac4ee[_0x2ea0('0x14')]()]+_0x2ea0('0x1b'),_0x2260ab);if(_0x2260ab[_0x2ea0('0xe')]['length']>0x0&&String(_0x2260ab['result'][0x0][_0x2ea0('0x1c')])===_0x2ea0('0x1d')){_0x2c64dc[_0x2ea0('0x1e')]=_0x2260ab[_0x2ea0('0xe')][0x0][_0x2ea0('0x1f')];}else{_0x2c64dc[_0x2ea0('0x1e')]=_0x2c64dc[_0x2ea0('0xf')];_0x2c64dc[_0x2ea0('0x17')]=_0x2c64dc[_0x2ea0('0x20')];}logger[_0x2ea0('0x10')]('['+[_0x1ac4ee[_0x2ea0('0x14')]()]+_0x2ea0('0x21'),_0x2c64dc);_0x5d725a(_0x2c64dc);})[_0x2ea0('0x12')](function(_0x5ecf00){logger[_0x2ea0('0x13')]('['+[_0x1ac4ee[_0x2ea0('0x14')]()]+']',_0x5ecf00[_0x2ea0('0x22')]);_0xb52259(_0x5ecf00[_0x2ea0('0x22')]);});}else{logger[_0x2ea0('0x10')]('['+[_0x1ac4ee[_0x2ea0('0x14')]()]+_0x2ea0('0x23'));_0x2c64dc[_0x2ea0('0x1e')]=_0x2c64dc[_0x2ea0('0xf')];_0x2c64dc[_0x2ea0('0x17')]=_0x2c64dc['adminEmail'];_0x5d725a(_0x2c64dc);}});};}function createEndUser(_0x2a4224,_0x443e0b,_0x1e3495,_0x4065f4,_0x25b577){logger[_0x2ea0('0x10')]('['+[_0x2a4224[_0x2ea0('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x1e3495);return new Promise(function(_0x3de691,_0x18f17e){var _0x146147={'method':_0x2ea0('0x24'),'uri':_0x4065f4+'sys_user?'+_0x25b577,'body':{'user_name':_0x1e3495[_0x2ea0('0x25')],'roles':'user','first_name':_0x1e3495[_0x2ea0('0x25')],'active':_0x2ea0('0x1d'),'date_format':_0x2ea0('0x26'),'phone':_0x1e3495[_0x2ea0('0x25')]},'auth':_0x443e0b,'json':!![]};return rp(_0x146147)['then'](function(_0x258e98){logger[_0x2ea0('0x10')]('['+[_0x2a4224['toUpperCase']()]+'],\x20EndUser\x20schema',_0x258e98[_0x2ea0('0xe')]);_0x1e3495['endUserId']=_0x258e98[_0x2ea0('0xe')][_0x2ea0('0x1f')];_0x3de691(_0x1e3495);})[_0x2ea0('0x12')](function(_0x25cf2c){logger[_0x2ea0('0x13')]('['+[_0x2a4224['toUpperCase']()]+']',_0x25cf2c[_0x2ea0('0x22')]);_0x18f17e(_0x25cf2c[_0x2ea0('0x22')]);});});}function getEndUser(_0x2a627b,_0x6c7e97,_0x20e540,_0x143384,_0x2e1f34){return function(_0x2e2e3a){logger['info']('['+[_0x2a627b[_0x2ea0('0x14')]()]+_0x2ea0('0x27'),_0x2e2e3a);return new Promise(function(_0x32dfdf,_0x580c1a){var _0x518425={'method':_0x2ea0('0xc'),'uri':_0x20e540+_0x2ea0('0x28')+_0x2e2e3a[_0x2ea0('0x25')]+'&'+_0x143384+'&'+_0x2e1f34,'auth':_0x6c7e97,'json':!![]};return rp(_0x518425)['then'](function(_0x6fe9bc){if(_0x6fe9bc[_0x2ea0('0xe')][_0x2ea0('0x29')]>0x0){_0x2e2e3a[_0x2ea0('0x2a')]=_0x6fe9bc[_0x2ea0('0xe')][0x0][_0x2ea0('0x1f')];logger[_0x2ea0('0x10')]('['+[_0x2a627b[_0x2ea0('0x14')]()]+'],\x20getEndUser\x20crm',_0x2e2e3a);_0x32dfdf(_0x2e2e3a);}else{return createEndUser(_0x2a627b,_0x6c7e97,_0x2e2e3a,_0x20e540,_0x143384)[_0x2ea0('0x1a')](function(_0x572bbc){logger['info']('['+[_0x2a627b[_0x2ea0('0x14')]()]+'],\x20createEndUser\x20crm',_0x572bbc);_0x32dfdf(_0x572bbc);});}})[_0x2ea0('0x12')](function(_0x5dc3dc){logger[_0x2ea0('0x13')]('['+[_0x2a627b[_0x2ea0('0x14')]()]+']',_0x5dc3dc[_0x2ea0('0x22')]);_0x580c1a(_0x5dc3dc[_0x2ea0('0x22')]);});});};}function getCustomFields(_0x279125,_0x175c47){var _0x425b48={};if(_0x279125[_0x2ea0('0x29')]>0x0){_[_0x2ea0('0x2b')](_0x279125,function(_0x5f372d){if(_[_0x2ea0('0x2c')]([_0x2ea0('0x2d'),'picklist'],_0x5f372d[_0x2ea0('0x2e')])&&_0x5f372d[_0x2ea0('0x2f')]&&!_0x5f372d[_0x2ea0('0x30')]){_0x425b48[_0x5f372d[_0x2ea0('0x2f')][_0x2ea0('0x31')]()]=_0x5f372d['content'][_0x2ea0('0x32')]();}else if(_[_0x2ea0('0x2c')]([_0x2ea0('0x2d'),'picklist'],_0x5f372d[_0x2ea0('0x2e')])&&_0x5f372d[_0x2ea0('0x33')]&&_0x5f372d[_0x2ea0('0x30')]){_0x425b48[_0x5f372d[_0x2ea0('0x33')][_0x2ea0('0x31')]()]=_0x5f372d[_0x2ea0('0x34')][_0x2ea0('0x32')]();}else if(_0x5f372d[_0x2ea0('0x2e')]===_0x2ea0('0x35')&&_0x5f372d[_0x2ea0('0x36')]&&_0x5f372d[_0x2ea0('0x33')]&&_0x5f372d[_0x2ea0('0x30')]){_0x425b48[_0x5f372d[_0x2ea0('0x33')][_0x2ea0('0x31')]()]=_0x175c47[_0x5f372d[_0x2ea0('0x36')]]['toString']();}else if(_0x5f372d[_0x2ea0('0x2e')]==='customVariable'&&_0x5f372d[_0x2ea0('0x37')]&&_0x5f372d[_0x2ea0('0x37')]['name']&&_0x5f372d[_0x2ea0('0x33')]&&_0x5f372d[_0x2ea0('0x30')]){_0x425b48[_0x5f372d['idField'][_0x2ea0('0x31')]()]=_0x175c47[_0x5f372d[_0x2ea0('0x37')][_0x2ea0('0x38')][_0x2ea0('0x31')]()][_0x2ea0('0x32')]();}});}return _0x425b48;}function getTicket(_0x2fdcd9,_0x2bc11c,_0x434282,_0x1c9b02,_0x107eb6,_0x174f04){return function(_0x5e3e59){logger[_0x2ea0('0x10')]('['+[_0x2fdcd9[_0x2ea0('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x5e3e59);return new Promise(function(_0xfdf39f,_0x5b0ca7){var _0x4fa0d5=_0x2fdcd9[_0x2ea0('0x31')]()===_0x2ea0('0x39')?_0x5e3e59['userId']:_0x5e3e59[_0x2ea0('0x2a')];var _0xab3872={'method':_0x2ea0('0x24'),'uri':_0x434282+'incident'+'?'+_0x174f04,'body':Object[_0x2ea0('0x3a')]({},{'active':_0x2ea0('0x1d'),'caller_id':_0x4fa0d5,'assigned_to':_0x5e3e59[_0x2ea0('0x1e')],'short_description':intUtil[_0x2ea0('0x3b')](_0x1c9b02['Subjects'],_0x107eb6,'\x20'),'description':intUtil[_0x2ea0('0x3b')](_0x1c9b02['Descriptions'],_0x107eb6,'\x0a')},getCustomFields(_0x1c9b02[_0x2ea0('0x3c')],_0x107eb6)),'auth':_0x2bc11c,'json':!![]};return rp(_0xab3872)[_0x2ea0('0x1a')](function(_0x1f6bcf){logger[_0x2ea0('0x10')]('['+[_0x2fdcd9[_0x2ea0('0x14')]()]+_0x2ea0('0x3d'),_0x1f6bcf['result']);_0x5e3e59['ticketId']=_0x1f6bcf[_0x2ea0('0xe')]['sys_id'];_0x5e3e59['ticketNumber']=_0x1f6bcf[_0x2ea0('0xe')][_0x2ea0('0x3e')];logger['info']('['+[_0x2fdcd9[_0x2ea0('0x14')]()]+_0x2ea0('0x3f'),_0x5e3e59);_0xfdf39f(_0x5e3e59);})[_0x2ea0('0x12')](function(_0x2e530c){logger[_0x2ea0('0x13')]('['+[_0x2fdcd9['toUpperCase']()]+']',_0x2e530c[_0x2ea0('0x22')]);_0x5b0ca7(_0x2e530c[_0x2ea0('0x22')]);});});};}function createRemoteTag(_0x1d1de7,_0x293192,_0x434159,_0x4b8ff9){return new Promise(function(_0x358b88,_0x5e8bd6){var _0x974451={'method':'POST','uri':_0x434159+_0x2ea0('0x40')+'?'+_0x4b8ff9,'body':{'short_description':_0x1d1de7,'global':!![],'active':!![],'name':_0x1d1de7},'auth':_0x293192,'json':!![]};return rp(_0x974451)[_0x2ea0('0x1a')](function(_0x320492){var _0x3e7d89=_0x320492[_0x2ea0('0xe')]['sys_id'];_0x358b88(_0x3e7d89);});});}function getRemoteTag(_0x76114d,_0x1b9c0f,_0x9734f0,_0x53ddd5,_0x4b5396){return new Promise(function(_0x3d59b3,_0x566255){var _0x172b08={'method':'GET','uri':_0x9734f0+_0x2ea0('0x40')+_0x2ea0('0x41')+_0x76114d+'&'+_0x53ddd5,'auth':_0x1b9c0f,'json':!![]};return rp(_0x172b08)[_0x2ea0('0x1a')](function(_0x7f673f){if(_0x7f673f[_0x2ea0('0xe')][_0x2ea0('0x29')]>0x0){var _0x10986c=_0x7f673f[_0x2ea0('0xe')][0x0][_0x2ea0('0x1f')];_0x3d59b3(_0x10986c);}else{return createRemoteTag(_0x76114d,_0x1b9c0f,_0x9734f0,_0x53ddd5)[_0x2ea0('0x1a')](function(_0x38f2c8){_0x3d59b3(_0x38f2c8);});}});});}function assignTagToIncident(_0x1209cc,_0xdf5476,_0xab1e9a,_0x34d59e,_0x559f92){return new Promise(function(_0x3e5098,_0x513c87){var _0x2ed373={'method':'POST','uri':_0xab1e9a+'label_entry'+'?'+_0x559f92,'body':{'label':_0x1209cc,'table':_0x2ea0('0x42'),'id_type':'Incident','table_key':_0x34d59e['ticketId'],'title':'Incident\x20-\x20'+_0x34d59e[_0x2ea0('0x43')],'id_display':_0x34d59e[_0x2ea0('0x43')]},'auth':_0xdf5476,'json':!![]};return rp(_0x2ed373)[_0x2ea0('0x1a')](function(_0x406a9a){_0x3e5098();})[_0x2ea0('0x12')](function(){_0x3e5098();});});}function manageTags(_0x3630e6,_0x15f7c2,_0x479e10,_0x36a08d,_0x3898af,_0x2604db,_0x104bda){return new Promise(function(_0x13adcd,_0x4589de){var _0x1a16df=[];_0x15f7c2[_0x2ea0('0x2b')](function(_0xc6a3cf){_0x1a16df['push'](getRemoteTag(_0xc6a3cf,_0x479e10,_0x36a08d,_0x2604db,_0x104bda));});return Promise['all'](_0x1a16df)[_0x2ea0('0x1a')](function(_0x12395a){if(_0x12395a['length']){logger[_0x2ea0('0x10')]('['+[_0x3630e6[_0x2ea0('0x14')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x12395a);var _0x3e7ed4=[];_0x12395a[_0x2ea0('0x2b')](function(_0x4ac136){_0x3e7ed4[_0x2ea0('0x44')](assignTagToIncident(_0x4ac136,_0x479e10,_0x36a08d,_0x3898af,_0x2604db));});return Promise[_0x2ea0('0x45')](_0x3e7ed4)[_0x2ea0('0x1a')](function(){_0x13adcd();})[_0x2ea0('0x12')](function(){_0x13adcd();});}else{_0x13adcd();}});});}function getTags(_0x3dff14,_0x1c78a4,_0x147844,_0x518db2,_0x2a59d3,_0x4d82e5){return function(_0x2357f2){return new Promise(function(_0x40036b,_0x145f04){var _0x7a84da=[];var _0x34df4c=_0x518db2[_0x2ea0('0x46')];if(_0x34df4c&&_0x34df4c[_0x2ea0('0x29')]>0x0){_0x7a84da=_['map'](_0x34df4c,_0x2ea0('0x38'));}if(_0x7a84da[_0x2ea0('0x29')]>0x0){return manageTags(_0x3dff14,_0x7a84da,_0x1c78a4,_0x147844,_0x2357f2,_0x2a59d3,_0x4d82e5)[_0x2ea0('0x1a')](function(){_0x40036b(_0x2357f2);});}else{_0x40036b(_0x2357f2);}});};}function emit(_0x1d03e2,_0x4288e0,_0x34016c){var _0x48e98f=_0x2ea0('0x47')+_0x2ea0('0x48')+_0x2ea0('0x49')+_0x2ea0('0x4a');var _0x4c6afb={'uri':_0x1d03e2+_0x2ea0('0x4b')+_0x34016c+_0x48e98f};io['to'](util[_0x2ea0('0x4c')]('user:%s',_0x4288e0))[_0x2ea0('0x4d')](_0x2ea0('0x4e'),_0x4c6afb);}exports['cs']=function(_0x270064,_0x39a89c,_0x1514a0,_0x534af6,_0xaf4c0c,_0x12882e,_0x264a00,_0x2deceb){var _0x156597={};var _0x2d6163={'user':_0x12882e[_0x2ea0('0x4f')],'pass':_0x12882e[_0x2ea0('0x50')]};var _0x3236c1='sysparm_limit=1';var _0x8fb629=_0x2ea0('0x51');_0x12882e[_0x2ea0('0x52')]=intUtil[_0x2ea0('0x53')](_0x12882e[_0x2ea0('0x52')]);_0x12882e[_0x2ea0('0x54')]=intUtil[_0x2ea0('0x53')](_0x12882e[_0x2ea0('0x54')]);var _0x4a533b=util[_0x2ea0('0x4c')](_0x2ea0('0x55'),_0x12882e[_0x2ea0('0x52')]);_0x156597[_0x2ea0('0x17')]=!_[_0x2ea0('0x56')](_0x534af6)?_0x534af6['email']:null;_0x156597[_0x2ea0('0x20')]=_0x12882e[_0x2ea0('0x57')];_0x156597[_0x2ea0('0x25')]=_0x2deceb['toLowerCase']()===_0x2ea0('0x39')?_0x39a89c[_0x2ea0('0x58')]:_0x39a89c[_0x2ea0('0x59')];_0x156597[_0x2ea0('0x5a')]=_0x2deceb===_0x2ea0('0x5b')||_0x2deceb===_0x2ea0('0x5c')?_0x2ea0('0x5b'):_0x2ea0('0x39');var _0x31eaee=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12882e[_0x2ea0('0x54')],_0x39a89c[_0x2ea0('0x5d')],md5(_0x39a89c[_0x2ea0('0x5d')]));if(_0xaf4c0c&&_0xaf4c0c['monitor_format']){logger['info'](_0x2ea0('0x5e'),_0x2ea0('0x5f'));_0x39a89c['recordingURL']=_0x31eaee;}else if(_0x264a00&&_0x264a00[_0x2ea0('0x60')]&&_0x264a00['recordingFormat']!==_0x2ea0('0x61')){logger[_0x2ea0('0x10')](_0x2ea0('0x62'),'Recording\x20is\x20enabled!');_0x39a89c[_0x2ea0('0x63')]=_0x31eaee;}else{_0x39a89c[_0x2ea0('0x63')]='';}return getAdminUser(_0x2deceb,_0x2d6163,_0x156597,_0x4a533b,_0x8fb629,_0x3236c1)[_0x2ea0('0x1a')](getUser(_0x2deceb,_0x2d6163,_0x4a533b,_0x8fb629,_0x3236c1))[_0x2ea0('0x1a')](getEndUser(_0x2deceb,_0x2d6163,_0x4a533b,_0x8fb629,_0x3236c1))[_0x2ea0('0x1a')](getTicket(_0x2deceb,_0x2d6163,_0x4a533b,_0x1514a0,_0x39a89c,_0x8fb629))[_0x2ea0('0x1a')](function(_0x5342bc){logger[_0x2ea0('0x10')](util[_0x2ea0('0x4c')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5342bc[_0x2ea0('0x64')]));logger[_0x2ea0('0x10')](util[_0x2ea0('0x4c')](_0x2ea0('0x65'),_0x2deceb));if(_0x2deceb!==_0x2ea0('0x5c')){logger[_0x2ea0('0x10')]('['+[_0x2deceb[_0x2ea0('0x14')]()]+']',_0x2ea0('0x66'));emit(_0x12882e[_0x2ea0('0x52')],_0x534af6[_0x2ea0('0x38')],_0x5342bc['ticketId']);}})[_0x2ea0('0x12')](function(_0x477b6d){logger[_0x2ea0('0x13')]('['+[_0x2deceb['toUpperCase']()]+_0x2ea0('0x67'),util[_0x2ea0('0x68')](_0x477b6d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd900=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','inspect','lodash','bluebird','request-promise','util','ioredis','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','userId','userEmail','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','true','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','customField','toLowerCase','content','toString','type','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign'];(function(_0x35ba71,_0xa2fbbd){var _0x5f04f4=function(_0x30a04f){while(--_0x30a04f){_0x35ba71['push'](_0x35ba71['shift']());}};_0x5f04f4(++_0xa2fbbd);}(_0xd900,0x172));var _0x0d90=function(_0x3f823a,_0x29330a){_0x3f823a=_0x3f823a-0x0;var _0x440e40=_0xd900[_0x3f823a];return _0x440e40;};'use strict';var _=require(_0x0d90('0x0'));var Promise=require(_0x0d90('0x1'));var rp=require(_0x0d90('0x2'));var util=require(_0x0d90('0x3'));var md5=require('md5');var Redis=require(_0x0d90('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x0d90('0x5'))(_0x0d90('0x6'));config[_0x0d90('0x7')]=_['defaults'](config[_0x0d90('0x7')],{'host':_0x0d90('0x8'),'port':0x18eb});var io=require(_0x0d90('0x9'))(new Redis(config[_0x0d90('0x7')]));function getAdminUser(_0x1b5640,_0xcaa475,_0x539472,_0x3bb245,_0xa0aa23,_0x92b897){return new Promise(function(_0x4c246c,_0x56736e){var _0x394f44={'method':_0x0d90('0xa'),'uri':_0x3bb245+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xa0aa23+'&'+_0x92b897,'auth':_0xcaa475,'json':!![]};return rp(_0x394f44)['then'](function(_0x561f63){if(_0x561f63[_0x0d90('0xb')][_0x0d90('0xc')]>0x0){_0x539472[_0x0d90('0xd')]=_0x561f63[_0x0d90('0xb')][0x0][_0x0d90('0xe')];}logger[_0x0d90('0xf')]('['+[_0x1b5640[_0x0d90('0x10')]()]+_0x0d90('0x11'),_0x539472);_0x4c246c(_0x539472);})[_0x0d90('0x12')](function(_0x5ee25b){logger[_0x0d90('0x13')]('['+[_0x1b5640[_0x0d90('0x10')]()]+']',_0x5ee25b[_0x0d90('0x14')]);_0x56736e(_0x5ee25b[_0x0d90('0x14')]);});});}function getUser(_0x425935,_0x3a71f5,_0x254f1e,_0x3f4ed5,_0x33fc5f){return function(_0x57dccb){logger['info']('['+[_0x425935[_0x0d90('0x10')]()]+_0x0d90('0x15'),_0x57dccb);return new Promise(function(_0x30acd2,_0x393748){if(intUtil[_0x0d90('0x16')](_0x57dccb['userEmail'])){var _0x2e114d={'method':_0x0d90('0xa'),'uri':_0x254f1e+_0x0d90('0x17')+_0x57dccb['userEmail']+'&'+_0x3f4ed5+'&'+_0x33fc5f,'auth':_0x3a71f5,'json':!![]};logger[_0x0d90('0xf')]('['+[_0x425935['toUpperCase']()]+_0x0d90('0x18'),_0x2e114d);return rp(_0x2e114d)[_0x0d90('0x19')](function(_0x357abd){logger[_0x0d90('0xf')]('['+[_0x425935[_0x0d90('0x10')]()]+'],\x20getUser\x20entity',_0x357abd);if(_0x357abd['result']['length']>0x0&&String(_0x357abd[_0x0d90('0xb')][0x0]['active'])==='true'){_0x57dccb[_0x0d90('0x1a')]=_0x357abd[_0x0d90('0xb')][0x0][_0x0d90('0xe')];}else{_0x57dccb[_0x0d90('0x1a')]=_0x57dccb['adminId'];_0x57dccb[_0x0d90('0x1b')]=_0x57dccb[_0x0d90('0x1c')];}logger[_0x0d90('0xf')]('['+[_0x425935['toUpperCase']()]+_0x0d90('0x1d'),_0x57dccb);_0x30acd2(_0x57dccb);})['catch'](function(_0x40aca1){logger[_0x0d90('0x13')]('['+[_0x425935[_0x0d90('0x10')]()]+']',_0x40aca1['message']);_0x393748(_0x40aca1[_0x0d90('0x14')]);});}else{logger[_0x0d90('0xf')]('['+[_0x425935[_0x0d90('0x10')]()]+_0x0d90('0x1e'));_0x57dccb['userId']=_0x57dccb[_0x0d90('0xd')];_0x57dccb[_0x0d90('0x1b')]=_0x57dccb[_0x0d90('0x1c')];_0x30acd2(_0x57dccb);}});};}function createEndUser(_0x2d83cb,_0x28429e,_0x2230e3,_0x389693,_0x5216a2){logger['info']('['+[_0x2d83cb[_0x0d90('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x2230e3);return new Promise(function(_0x239301,_0x27be54){var _0x1eb9e9={'method':_0x0d90('0x1f'),'uri':_0x389693+_0x0d90('0x20')+_0x5216a2,'body':{'user_name':_0x2230e3[_0x0d90('0x21')],'roles':_0x0d90('0x22'),'first_name':_0x2230e3[_0x0d90('0x21')],'active':_0x0d90('0x23'),'date_format':_0x0d90('0x24'),'phone':_0x2230e3[_0x0d90('0x21')]},'auth':_0x28429e,'json':!![]};return rp(_0x1eb9e9)[_0x0d90('0x19')](function(_0x5f175c){logger['info']('['+[_0x2d83cb[_0x0d90('0x10')]()]+'],\x20EndUser\x20schema',_0x5f175c[_0x0d90('0xb')]);_0x2230e3[_0x0d90('0x25')]=_0x5f175c[_0x0d90('0xb')]['sys_id'];_0x239301(_0x2230e3);})[_0x0d90('0x12')](function(_0x43227e){logger[_0x0d90('0x13')]('['+[_0x2d83cb[_0x0d90('0x10')]()]+']',_0x43227e[_0x0d90('0x14')]);_0x27be54(_0x43227e[_0x0d90('0x14')]);});});}function getEndUser(_0x230d3f,_0x2eb5fd,_0x22c4bb,_0x150388,_0x4b55f3){return function(_0x18ec2d){logger[_0x0d90('0xf')]('['+[_0x230d3f[_0x0d90('0x10')]()]+_0x0d90('0x26'),_0x18ec2d);return new Promise(function(_0x26f57d,_0x32e9f6){var _0x5c83ce={'method':'GET','uri':_0x22c4bb+_0x0d90('0x27')+_0x18ec2d[_0x0d90('0x21')]+'&'+_0x150388+'&'+_0x4b55f3,'auth':_0x2eb5fd,'json':!![]};return rp(_0x5c83ce)[_0x0d90('0x19')](function(_0x5637f2){if(_0x5637f2[_0x0d90('0xb')]['length']>0x0){_0x18ec2d[_0x0d90('0x25')]=_0x5637f2[_0x0d90('0xb')][0x0][_0x0d90('0xe')];logger['info']('['+[_0x230d3f[_0x0d90('0x10')]()]+_0x0d90('0x28'),_0x18ec2d);_0x26f57d(_0x18ec2d);}else{return createEndUser(_0x230d3f,_0x2eb5fd,_0x18ec2d,_0x22c4bb,_0x150388)[_0x0d90('0x19')](function(_0x1a2423){logger[_0x0d90('0xf')]('['+[_0x230d3f[_0x0d90('0x10')]()]+_0x0d90('0x29'),_0x1a2423);_0x26f57d(_0x1a2423);});}})[_0x0d90('0x12')](function(_0x561887){logger[_0x0d90('0x13')]('['+[_0x230d3f[_0x0d90('0x10')]()]+']',_0x561887[_0x0d90('0x14')]);_0x32e9f6(_0x561887[_0x0d90('0x14')]);});});};}function getCustomFields(_0x4f07c5,_0x36163b){var _0x4e7625={};if(_0x4f07c5[_0x0d90('0xc')]>0x0){_['forEach'](_0x4f07c5,function(_0x2cdf69){if(_[_0x0d90('0x2a')]([_0x0d90('0x2b'),_0x0d90('0x2c')],_0x2cdf69['type'])&&_0x2cdf69['nameField']&&!_0x2cdf69[_0x0d90('0x2d')]){_0x4e7625[_0x2cdf69['nameField'][_0x0d90('0x2e')]()]=_0x2cdf69[_0x0d90('0x2f')][_0x0d90('0x30')]();}else if(_[_0x0d90('0x2a')](['string','picklist'],_0x2cdf69[_0x0d90('0x31')])&&_0x2cdf69[_0x0d90('0x32')]&&_0x2cdf69[_0x0d90('0x2d')]){_0x4e7625[_0x2cdf69[_0x0d90('0x32')][_0x0d90('0x2e')]()]=_0x2cdf69[_0x0d90('0x2f')][_0x0d90('0x30')]();}else if(_0x2cdf69['type']==='variable'&&_0x2cdf69[_0x0d90('0x33')]&&_0x2cdf69[_0x0d90('0x32')]&&_0x2cdf69['customField']){_0x4e7625[_0x2cdf69[_0x0d90('0x32')]['toLowerCase']()]=_0x36163b[_0x2cdf69[_0x0d90('0x33')]]['toString']();}else if(_0x2cdf69[_0x0d90('0x31')]===_0x0d90('0x34')&&_0x2cdf69[_0x0d90('0x35')]&&_0x2cdf69[_0x0d90('0x35')][_0x0d90('0x36')]&&_0x2cdf69['idField']&&_0x2cdf69[_0x0d90('0x2d')]){_0x4e7625[_0x2cdf69[_0x0d90('0x32')][_0x0d90('0x2e')]()]=_0x36163b[_0x2cdf69[_0x0d90('0x35')]['name'][_0x0d90('0x2e')]()][_0x0d90('0x30')]();}});}return _0x4e7625;}function getTicket(_0x17be13,_0xb5632a,_0x49266f,_0x50cf5d,_0x428a9a,_0x5a30a5){return function(_0x1f2ae7){logger[_0x0d90('0xf')]('['+[_0x17be13[_0x0d90('0x10')]()]+_0x0d90('0x37'),_0x1f2ae7);return new Promise(function(_0x208027,_0x4038a1){var _0x42d59a=_0x17be13[_0x0d90('0x2e')]()==='outbound'?_0x1f2ae7[_0x0d90('0x1a')]:_0x1f2ae7['endUserId'];var _0xf03376={'method':'POST','uri':_0x49266f+_0x0d90('0x38')+'?'+_0x5a30a5,'body':Object[_0x0d90('0x39')]({},{'active':_0x0d90('0x23'),'caller_id':_0x42d59a,'assigned_to':_0x1f2ae7[_0x0d90('0x1a')],'short_description':intUtil[_0x0d90('0x3a')](_0x50cf5d['Subjects'],_0x428a9a,'\x20'),'description':intUtil[_0x0d90('0x3a')](_0x50cf5d[_0x0d90('0x3b')],_0x428a9a,'\x0a')},getCustomFields(_0x50cf5d[_0x0d90('0x3c')],_0x428a9a)),'auth':_0xb5632a,'json':!![]};return rp(_0xf03376)[_0x0d90('0x19')](function(_0x3769ea){logger[_0x0d90('0xf')]('['+[_0x17be13[_0x0d90('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3769ea[_0x0d90('0xb')]);_0x1f2ae7[_0x0d90('0x3d')]=_0x3769ea['result'][_0x0d90('0xe')];_0x1f2ae7[_0x0d90('0x3e')]=_0x3769ea['result'][_0x0d90('0x3f')];logger['info']('['+[_0x17be13[_0x0d90('0x10')]()]+_0x0d90('0x40'),_0x1f2ae7);_0x208027(_0x1f2ae7);})['catch'](function(_0x202359){logger[_0x0d90('0x13')]('['+[_0x17be13['toUpperCase']()]+']',_0x202359[_0x0d90('0x14')]);_0x4038a1(_0x202359['message']);});});};}function createRemoteTag(_0x15de29,_0xb6b875,_0x3f7dd8,_0x3eb596){return new Promise(function(_0x3fdcf6,_0x419ba2){var _0x2b6e67={'method':_0x0d90('0x1f'),'uri':_0x3f7dd8+_0x0d90('0x41')+'?'+_0x3eb596,'body':{'short_description':_0x15de29,'global':!![],'active':!![],'name':_0x15de29},'auth':_0xb6b875,'json':!![]};return rp(_0x2b6e67)[_0x0d90('0x19')](function(_0x31c71f){var _0xc3d130=_0x31c71f[_0x0d90('0xb')]['sys_id'];_0x3fdcf6(_0xc3d130);});});}function getRemoteTag(_0x1a27f6,_0x1dcb7d,_0xf0f08,_0xa6b0b9,_0x3588a9){return new Promise(function(_0x3cb711,_0x5da1d8){var _0xb9f88f={'method':'GET','uri':_0xf0f08+_0x0d90('0x41')+_0x0d90('0x42')+_0x1a27f6+'&'+_0xa6b0b9,'auth':_0x1dcb7d,'json':!![]};return rp(_0xb9f88f)[_0x0d90('0x19')](function(_0x1f5132){if(_0x1f5132[_0x0d90('0xb')][_0x0d90('0xc')]>0x0){var _0x58eab7=_0x1f5132[_0x0d90('0xb')][0x0][_0x0d90('0xe')];_0x3cb711(_0x58eab7);}else{return createRemoteTag(_0x1a27f6,_0x1dcb7d,_0xf0f08,_0xa6b0b9)[_0x0d90('0x19')](function(_0x3b58c3){_0x3cb711(_0x3b58c3);});}});});}function assignTagToIncident(_0x2c8d9c,_0x4d2064,_0x37c017,_0xdb1fcb,_0x24dd6f){return new Promise(function(_0x13f8f2,_0x55ab28){var _0x39ed42={'method':_0x0d90('0x1f'),'uri':_0x37c017+_0x0d90('0x43')+'?'+_0x24dd6f,'body':{'label':_0x2c8d9c,'table':'incident','id_type':_0x0d90('0x44'),'table_key':_0xdb1fcb[_0x0d90('0x3d')],'title':_0x0d90('0x45')+_0xdb1fcb[_0x0d90('0x3e')],'id_display':_0xdb1fcb['ticketNumber']},'auth':_0x4d2064,'json':!![]};return rp(_0x39ed42)['then'](function(_0x3b8eee){_0x13f8f2();})['catch'](function(){_0x13f8f2();});});}function manageTags(_0x41e3c6,_0x273193,_0x5b247d,_0x46e2e8,_0x4cd0d7,_0x202c01,_0x2217f3){return new Promise(function(_0x51d882,_0x205ef2){var _0x1289a5=[];_0x273193[_0x0d90('0x46')](function(_0x592bd0){_0x1289a5[_0x0d90('0x47')](getRemoteTag(_0x592bd0,_0x5b247d,_0x46e2e8,_0x202c01,_0x2217f3));});return Promise[_0x0d90('0x48')](_0x1289a5)['then'](function(_0x5dd579){if(_0x5dd579[_0x0d90('0xc')]){logger[_0x0d90('0xf')]('['+[_0x41e3c6[_0x0d90('0x10')]()]+_0x0d90('0x49'),_0x5dd579);var _0x13b28d=[];_0x5dd579['forEach'](function(_0x1029a4){_0x13b28d[_0x0d90('0x47')](assignTagToIncident(_0x1029a4,_0x5b247d,_0x46e2e8,_0x4cd0d7,_0x202c01));});return Promise[_0x0d90('0x48')](_0x13b28d)['then'](function(){_0x51d882();})['catch'](function(){_0x51d882();});}else{_0x51d882();}});});}function getTags(_0x1114ad,_0x4d57ec,_0x3f486b,_0x276572,_0x1ee2e3,_0x51f3e1){return function(_0x5e3d87){return new Promise(function(_0x1becde,_0x41e4dd){var _0x39595a=[];var _0x5c0b82=_0x276572['Tags'];if(_0x5c0b82&&_0x5c0b82[_0x0d90('0xc')]>0x0){_0x39595a=_[_0x0d90('0x4a')](_0x5c0b82,'name');}if(_0x39595a['length']>0x0){return manageTags(_0x1114ad,_0x39595a,_0x4d57ec,_0x3f486b,_0x5e3d87,_0x1ee2e3,_0x51f3e1)[_0x0d90('0x19')](function(){_0x1becde(_0x5e3d87);});}else{_0x1becde(_0x5e3d87);}});};}function emit(_0x3b99e2,_0x441f10,_0x2179b8){var _0x598ae2=_0x0d90('0x4b')+_0x0d90('0x4c')+_0x0d90('0x4d')+_0x0d90('0x4e');var _0x1ebaec={'uri':_0x3b99e2+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2179b8+_0x598ae2};io['to'](util[_0x0d90('0x4f')](_0x0d90('0x50'),_0x441f10))[_0x0d90('0x51')](_0x0d90('0x52'),_0x1ebaec);}exports['cs']=function(_0x2e8556,_0xea5a09,_0x3258c8,_0x545e69,_0x5f3943,_0xfac9ac,_0x4f8fec,_0x3314e0){var _0x2abfb5={};var _0x5ba2b0={'user':_0xfac9ac[_0x0d90('0x53')],'pass':_0xfac9ac[_0x0d90('0x54')]};var _0xb449bb='sysparm_limit=1';var _0x39c8d6=_0x0d90('0x55');_0xfac9ac['remoteUri']=intUtil['stripTrailingSlash'](_0xfac9ac[_0x0d90('0x56')]);_0xfac9ac[_0x0d90('0x57')]=intUtil[_0x0d90('0x58')](_0xfac9ac[_0x0d90('0x57')]);var _0x46f1be=util[_0x0d90('0x4f')]('%s/api/now/table/',_0xfac9ac[_0x0d90('0x56')]);_0x2abfb5['userEmail']=!_[_0x0d90('0x59')](_0x545e69)?_0x545e69[_0x0d90('0x5a')]:null;_0x2abfb5[_0x0d90('0x1c')]=_0xfac9ac[_0x0d90('0x5a')];_0x2abfb5[_0x0d90('0x21')]=_0x3314e0[_0x0d90('0x2e')]()===_0x0d90('0x5b')?_0xea5a09[_0x0d90('0x5c')]:_0xea5a09[_0x0d90('0x5d')];_0x2abfb5[_0x0d90('0x5e')]=_0x3314e0===_0x0d90('0x5f')||_0x3314e0===_0x0d90('0x60')?'queue':'outbound';var _0x1b31b7=util[_0x0d90('0x4f')](_0x0d90('0x61'),_0xfac9ac['serverUrl'],_0xea5a09['uniqueid'],md5(_0xea5a09[_0x0d90('0x62')]));if(_0x5f3943&&_0x5f3943[_0x0d90('0x63')]){logger[_0x0d90('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0xea5a09[_0x0d90('0x64')]=_0x1b31b7;}else if(_0x4f8fec&&_0x4f8fec[_0x0d90('0x65')]&&_0x4f8fec[_0x0d90('0x65')]!==_0x0d90('0x66')){logger['info'](_0x0d90('0x67'),_0x0d90('0x68'));_0xea5a09['recordingURL']=_0x1b31b7;}else{_0xea5a09[_0x0d90('0x64')]='';}return getAdminUser(_0x3314e0,_0x5ba2b0,_0x2abfb5,_0x46f1be,_0x39c8d6,_0xb449bb)['then'](getUser(_0x3314e0,_0x5ba2b0,_0x46f1be,_0x39c8d6,_0xb449bb))[_0x0d90('0x19')](getEndUser(_0x3314e0,_0x5ba2b0,_0x46f1be,_0x39c8d6,_0xb449bb))['then'](getTicket(_0x3314e0,_0x5ba2b0,_0x46f1be,_0x3258c8,_0xea5a09,_0x39c8d6))['then'](function(_0x31d5b8){logger[_0x0d90('0xf')](util[_0x0d90('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x31d5b8['ticketId']));logger['info'](util[_0x0d90('0x4f')](_0x0d90('0x69'),_0x3314e0));if(_0x3314e0!==_0x0d90('0x60')){logger['info']('['+[_0x3314e0['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xfac9ac['remoteUri'],_0x545e69['name'],_0x31d5b8[_0x0d90('0x3d')]);}})['catch'](function(_0x3a2cce){logger['error']('['+[_0x3314e0[_0x0d90('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x0d90('0x6a')](_0x3a2cce,{'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 f65dfe4..fde6f46 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 _0x56bd=['trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','charAt','lastevent','users','toUpperCase','lodash','request-promise','bluebird','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','variableName','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','toString','content','custom_fields','push','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x302e77,_0x10b50a){var _0x5283f3=function(_0x34ecc3){while(--_0x34ecc3){_0x302e77['push'](_0x302e77['shift']());}};_0x5283f3(++_0x10b50a);}(_0x56bd,0x182));var _0xd56b=function(_0x2e0c0c,_0x27ba3b){_0x2e0c0c=_0x2e0c0c-0x0;var _0x370f08=_0x56bd[_0x2e0c0c];return _0x370f08;};'use strict';var _=require(_0xd56b('0x0'));var rp=require(_0xd56b('0x1'));var BPromise=require(_0xd56b('0x2'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd56b('0x3'));var config=require(_0xd56b('0x4'));var logger=require(_0xd56b('0x5'))(_0xd56b('0x6'));config[_0xd56b('0x7')]=_[_0xd56b('0x8')](config[_0xd56b('0x7')],{'host':_0xd56b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd56b('0x7')]));var def={'method':_0xd56b('0xa'),'json':!![]};function emit(_0x36b589,_0xe99846,_0x4e824b){io['to'](_0x36b589)[_0xd56b('0xb')](_0xe99846,_0x4e824b);}function getTicket(_0x4419a0,_0x151fff,_0x189d76,_0xf5c880,_0x2272dc,_0x49be3f,_0x12d18f,_0x1e0a51){logger['info'](_0xd56b('0xc'));var _0x1b0145=new Date();var _0x583ad3=[{'name':_0xd56b('0xd'),'value':intUtil[_0xd56b('0xe')](_0xf5c880['Subjects'],_0x2272dc,'\x20')},{'name':_0xd56b('0xf'),'value':_0x151fff['id']},{'name':_0xd56b('0x10'),'value':_0x151fff['id']},{'name':'description','value':intUtil['getString'](_0xf5c880[_0xd56b('0x11')],_0x2272dc,'\x0a')},{'name':_0xd56b('0x12'),'value':_0x1b0145[_0xd56b('0x13')]()[_0xd56b('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0xd56b('0x15'),'value':'0'},{'name':_0xd56b('0x16'),'value':'15'},{'name':'parent_id','value':_0x189d76['id']},{'name':_0xd56b('0x17'),'value':_0xd56b('0x18')},{'name':_0xd56b('0x19'),'value':_0x189d76['name']},{'name':_0xd56b('0x1a'),'value':_0x1e0a51}];if(_0x49be3f['length']){_['forEach'](_0x49be3f,function(_0x194ce8){if(_0x2272dc[_0x194ce8[_0xd56b('0x1b')]]){_0x583ad3['push']({'name':_0x194ce8[_0xd56b('0x1c')],'value':_0x2272dc[_0x194ce8[_0xd56b('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xd56b('0x1d'),'response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'session':_0x12d18f['id'],'module_name':_0xd56b('0x1f'),'name_value_list':_0x583ad3})}});}function getAuth(_0x3876a1){return util[_0xd56b('0x20')](_0xd56b('0x21'),new Buffer(_0x3876a1[_0xd56b('0x22')]+':X')['toString'](_0xd56b('0x23')));}function getServerInfo(_0x5ac373){return request({'form':{'method':_0xd56b('0x24'),'input_type':'JSON','response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'session':_0x5ac373['id']})}});}function getUser(_0x1f0bab,_0x6d2f00,_0x25f447){if(!_[_0xd56b('0x25')](_0x6d2f00)){logger['info'](_0xd56b('0x26'),_0x6d2f00);return request({'form':{'method':_0xd56b('0x27'),'input_type':_0xd56b('0x1d'),'response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'session':_0x25f447['id'],'module_name':_0xd56b('0x28'),'query':util[_0xd56b('0x20')](_0xd56b('0x29'),_0x6d2f00),'order_by':'','offset':'0','select_fields':['id',_0xd56b('0xd'),_0xd56b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd56b('0x2b')](function(_0x3f8c24){if(_0x3f8c24[_0xd56b('0x2c')][_0xd56b('0x2d')]){var _0x17b8fb=_[_0xd56b('0x2e')](_0x3f8c24[_0xd56b('0x2c')],function(_0x55746c){return _0x55746c[_0xd56b('0x2f')][_0xd56b('0x2a')][_0xd56b('0x30')]===_0x6d2f00;});if(_0x17b8fb){logger[_0xd56b('0x31')](_0xd56b('0x32'));return BPromise[_0xd56b('0x33')]({'id':_0x17b8fb['name_value_list']['id'][_0xd56b('0x30')],'name':_0x17b8fb['name_value_list']['name'][_0xd56b('0x30')]});}}logger[_0xd56b('0x31')](_0xd56b('0x34'));return BPromise[_0xd56b('0x33')]({'id':_0x25f447[_0xd56b('0x2f')][_0xd56b('0x35')][_0xd56b('0x30')],'name':_0x25f447[_0xd56b('0x2f')][_0xd56b('0x2a')][_0xd56b('0x30')]});});}else{logger[_0xd56b('0x31')](_0xd56b('0x36'));return BPromise[_0xd56b('0x33')]({'id':_0x25f447[_0xd56b('0x2f')][_0xd56b('0x35')][_0xd56b('0x30')],'name':_0x25f447['name_value_list']['user_name'][_0xd56b('0x30')]});}}function getEndUser(_0x20afd4,_0x111336,_0x121098,_0x498da9){logger['info'](_0xd56b('0x37'),_0x121098);return request({'form':{'method':'get_entry_list','input_type':_0xd56b('0x1d'),'response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'session':_0x498da9['id'],'module_name':_0xd56b('0x18'),'query':util[_0xd56b('0x20')](_0xd56b('0x38'),_0x121098),'order_by':'','offset':'0','select_fields':['id',_0xd56b('0xd'),_0xd56b('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3cdacd){if(_0x3cdacd[_0xd56b('0x2c')][_0xd56b('0x2d')]){var _0x1b8e83=_[_0xd56b('0x2e')](_0x3cdacd[_0xd56b('0x2c')],function(_0xf6e137){return _0xf6e137[_0xd56b('0x2f')][_0xd56b('0x39')][_0xd56b('0x30')]===_0x121098;});if(_0x1b8e83){logger[_0xd56b('0x31')](_0xd56b('0x3a'));return BPromise['resolve']({'id':_0x1b8e83[_0xd56b('0x2f')]['id'][_0xd56b('0x30')],'name':_0x1b8e83[_0xd56b('0x2f')][_0xd56b('0xd')][_0xd56b('0x30')],'phone':_0x1b8e83[_0xd56b('0x2f')]['phone_home'][_0xd56b('0x30')]});}}else{logger[_0xd56b('0x31')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xd56b('0x3b'),'input_type':'JSON','response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'session':_0x498da9['id'],'module_name':_0xd56b('0x18'),'name_value_list':[{'name':'first_name','value':_0x111336!==''?_0x111336:util[_0xd56b('0x20')](_0xd56b('0x3c'),_0x121098)},{'name':_0xd56b('0x39'),'value':_0x121098}]})}})[_0xd56b('0x2b')](function(_0x115e05){logger['info'](_0xd56b('0x3d'));return BPromise[_0xd56b('0x33')]({'id':_0x115e05['id'],'name':_0x115e05['entry_list'][_0xd56b('0x3e')][_0xd56b('0x30')],'phone':_0x115e05[_0xd56b('0x2c')][_0xd56b('0x39')]['value']});});}});}function request(_0x513c2d){logger[_0xd56b('0x3f')](_0xd56b('0x40'),JSON[_0xd56b('0x1e')](_0x513c2d));return rp(_[_0xd56b('0x41')](def,_0x513c2d));}function getTags(_0x5e841b,_0x19c150){var _0x5b8229=[];if(_0x5e841b&&_0x5e841b[_0xd56b('0x2d')]>0x0){_0x5b8229=_[_0xd56b('0x42')](_0x5e841b,_0x19c150);}return _0x5b8229;}function getCustomFields(_0x128f58,_0x3100a4){var _0x4690e4=[];var _0x3b3f22={'custom_fields':[]};if(_0x128f58['length']>0x0){_['forEach'](_0x128f58,function(_0x34c772){if(_0x34c772[_0xd56b('0x43')]===_0xd56b('0x44')&&_0x34c772[_0xd56b('0x45')]&&!_0x34c772[_0xd56b('0x46')]){_0x3b3f22[_0x34c772[_0xd56b('0x45')][_0xd56b('0x47')]()]=_0x34c772['content'][_0xd56b('0x48')]();}else if(_0x34c772[_0xd56b('0x43')]==='string'&&_0x34c772[_0xd56b('0x1c')]&&_0x34c772[_0xd56b('0x46')]){_0x3b3f22['custom_fields']['push']({'id':_0x34c772[_0xd56b('0x1c')],'value':_0x34c772[_0xd56b('0x49')]['toString']()});}else if(_0x34c772[_0xd56b('0x43')]==='variable'&&_0x34c772[_0xd56b('0x1b')]&&_0x34c772[_0xd56b('0x1c')]&&_0x34c772['customField']){_0x3100a4[_0x34c772['variableName']]&&_0x3b3f22[_0xd56b('0x4a')][_0xd56b('0x4b')]({'id':_0x34c772['idField'],'value':_0x3100a4[_0x34c772[_0xd56b('0x1b')]][_0xd56b('0x48')]()});}else if(_0x34c772['type']==='customVariable'&&_0x34c772['Variable']&&_0x34c772[_0xd56b('0x4c')]['name']&&_0x34c772[_0xd56b('0x1c')]&&_0x34c772[_0xd56b('0x46')]){_0x3100a4[_0x34c772[_0xd56b('0x4c')][_0xd56b('0xd')][_0xd56b('0x47')]()]&&_0x3b3f22[_0xd56b('0x4a')]['push']({'id':_0x34c772[_0xd56b('0x1c')],'value':_0x3100a4[_0x34c772[_0xd56b('0x4c')][_0xd56b('0xd')][_0xd56b('0x47')]()][_0xd56b('0x48')]()});}});}return _0x3b3f22;}function getConnection(_0x2b33fd){return request({'method':_0xd56b('0xa'),'form':{'method':_0xd56b('0x4d'),'input_type':_0xd56b('0x1d'),'response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'user_auth':{'user_name':_0x2b33fd[_0xd56b('0x4e')],'password':_0x2b33fd[_0xd56b('0x4f')],'encryption':_0xd56b('0x50')},'application':_0xd56b('0x51')})}})['then'](function(_0x230fc4){var _0x14b2a0=_0x230fc4;if(_0x14b2a0['id']){def[_0xd56b('0x52')]=_0x14b2a0['id'];return BPromise['resolve'](_0x14b2a0);}else{throw new Error(util[_0xd56b('0x20')](_0xd56b('0x53'),_0x2b33fd['id']));}});}function setRelationship(_0x1009e9,_0x4eecbe,_0xab18bc,_0xfb1ff2){return request({'form':{'method':_0xd56b('0x54'),'input_type':_0xd56b('0x1d'),'response_type':_0xd56b('0x1d'),'rest_data':JSON[_0xd56b('0x1e')]({'session':_0x1009e9['id'],'module_name':_0xd56b('0x1f'),'module_id':_0xab18bc['id'],'link_field_name':_0xfb1ff2,'related_ids':[_0x4eecbe['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd56b('0x55')]=function(_0x36639b,_0x6b8941,_0x23e630,_0x4c16c6,_0x2ccf2b,_0x12e583){var _0x5c9076,_0x4c3106,_0x239449,_0x24345e;_0x12e583[_0xd56b('0x56')]=intUtil[_0xd56b('0x57')](_0x12e583[_0xd56b('0x56')]);_0x12e583[_0xd56b('0x58')]=intUtil['stripTrailingSlash'](_0x12e583['serverUrl']);def[_0xd56b('0x59')]=util[_0xd56b('0x20')](_0xd56b('0x5a'),_0x12e583[_0xd56b('0x56')]);if(_0x2ccf2b&&_0x2ccf2b[_0xd56b('0x5b')]){logger['info']('[QUEUE]',_0xd56b('0x5c'));_0x6b8941[_0xd56b('0x5d')]=util['format'](_0xd56b('0x5e'),_0x12e583[_0xd56b('0x58')],_0x6b8941[_0xd56b('0x5f')],md5(_0x6b8941[_0xd56b('0x5f')]));}else{_0x6b8941['recordingURL']='';}return getConnection(_0x12e583)[_0xd56b('0x2b')](function(_0x15dbe9){_0x24345e=_0x15dbe9;return getUser(_0x12e583,_0x4c16c6[_0xd56b('0xd')],_0x24345e);})[_0xd56b('0x2b')](function(_0x38ea40){_0x5c9076=_0x38ea40;logger[_0xd56b('0x31')](_0xd56b('0x60'),_0x5c9076['id']);return getEndUser(_0x12e583,_0x6b8941[_0xd56b('0x61')],_0x6b8941[_0xd56b('0x62')],_0x24345e);})[_0xd56b('0x2b')](function(_0x2cca4f){_0x4c3106=_0x2cca4f;logger[_0xd56b('0x31')](_0xd56b('0x63'),_0x4c3106['id']);return getTicket(_0x12e583,_0x5c9076,_0x4c3106,_0x23e630,_0x6b8941,_0x23e630[_0xd56b('0x64')],_0x24345e,_0xd56b('0x65'));})[_0xd56b('0x2b')](function(_0x12a932){_0x239449=_0x12a932;logger[_0xd56b('0x31')](_0xd56b('0x66'));logger[_0xd56b('0x31')](_0xd56b('0x67'),_0x239449['id']);return setRelationship(_0x24345e,_0x5c9076,_0x239449,'users');})['then'](function(){return setRelationship(_0x24345e,_0x4c3106,_0x239449,_0xd56b('0x68'));})[_0xd56b('0x2b')](function(){return getServerInfo(_0x24345e);})['then'](function(_0x14eb05){var _0x3b4418=parseInt(_0x14eb05[_0xd56b('0x69')]['charAt'](0x0));var _0x32ae54=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x12e583[_0xd56b('0x56')],_0x239449['id']);if(_0x3b4418>0x6){_0x32ae54=util[_0xd56b('0x20')](_0xd56b('0x6a'),_0x12e583[_0xd56b('0x56')],_0x239449['id']);}logger[_0xd56b('0x31')](_0xd56b('0x6b'),_0xd56b('0x6c'));emit(util[_0xd56b('0x20')](_0xd56b('0x6d'),_0x4c16c6['name']),_0xd56b('0x6e'),{'uri':_0x32ae54});})[_0xd56b('0x6f')](function(_0x2fdceb){logger[_0xd56b('0x70')](_0xd56b('0x6b'),JSON['stringify'](_0x2fdceb));});};exports[_0xd56b('0x71')]=function(_0x288165,_0x3ba3d5,_0x5502da,_0x34a0b0,_0x48d3a6,_0x3c193e,_0x5380ae){var _0x582e9e,_0x234024,_0x2a68c9,_0x1de9b3;_0x3c193e['remoteUri']=intUtil[_0xd56b('0x57')](_0x3c193e[_0xd56b('0x56')]);_0x3c193e[_0xd56b('0x58')]=intUtil[_0xd56b('0x57')](_0x3c193e['serverUrl']);def['uri']=util[_0xd56b('0x20')](_0xd56b('0x5a'),_0x3c193e['remoteUri']);if(_0x5380ae&&_0x5380ae[_0xd56b('0x72')]&&_0x5380ae[_0xd56b('0x72')]!==_0xd56b('0x73')){logger[_0xd56b('0x31')](_0xd56b('0x74'),_0xd56b('0x5c'));_0x3ba3d5[_0xd56b('0x5d')]=util[_0xd56b('0x20')](_0xd56b('0x5e'),_0x3c193e['serverUrl'],_0x3ba3d5[_0xd56b('0x5f')],md5(_0x3ba3d5[_0xd56b('0x5f')]));}return getConnection(_0x3c193e)[_0xd56b('0x2b')](function(_0x593e3d){_0x1de9b3=_0x593e3d;return getUser(_0x3c193e,_0x34a0b0['name'],_0x1de9b3);})[_0xd56b('0x2b')](function(_0x35e771){_0x582e9e=_0x35e771;logger[_0xd56b('0x31')](_0xd56b('0x60'),_0x582e9e['id']);return getEndUser(_0x3c193e,_0x3ba3d5[_0xd56b('0x75')],_0x3ba3d5[_0xd56b('0x76')],_0x1de9b3);})[_0xd56b('0x2b')](function(_0x1d4b2f){_0x234024=_0x1d4b2f;logger[_0xd56b('0x31')](_0xd56b('0x63'),_0x234024['id']);return getTicket(_0x3c193e,_0x582e9e,_0x234024,_0x5502da,_0x3ba3d5,_0x5502da[_0xd56b('0x64')],_0x1de9b3,_0xd56b('0x77'));})[_0xd56b('0x2b')](function(_0x120e67){_0x2a68c9=_0x120e67;logger['info'](_0xd56b('0x66'));logger[_0xd56b('0x31')](_0xd56b('0x67'),_0x2a68c9['id']);return setRelationship(_0x1de9b3,_0x582e9e,_0x2a68c9,'users');})[_0xd56b('0x2b')](function(){return setRelationship(_0x1de9b3,_0x234024,_0x2a68c9,_0xd56b('0x68'));})[_0xd56b('0x2b')](function(){return getServerInfo(_0x1de9b3);})['then'](function(_0x5f388c){var _0x323e17=parseInt(_0x5f388c['version'][_0xd56b('0x78')](0x0));var _0x1067ec=util[_0xd56b('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3c193e['remoteUri'],_0x2a68c9['id']);if(_0x323e17>0x6){_0x1067ec=util['format'](_0xd56b('0x6a'),_0x3c193e[_0xd56b('0x56')],_0x2a68c9['id']);}logger[_0xd56b('0x31')](_0xd56b('0x74'),_0xd56b('0x6c'));emit(util[_0xd56b('0x20')](_0xd56b('0x6d'),_0x34a0b0[_0xd56b('0xd')]),_0xd56b('0x6e'),{'uri':_0x1067ec});})[_0xd56b('0x6f')](function(_0x593fb1){logger[_0xd56b('0x70')](_0xd56b('0x74'),JSON[_0xd56b('0x1e')](_0x593fb1));});};exports['unmanaged']=function(_0x56b679,_0x743637,_0xb0ffad,_0x2e9d7a,_0x193624,_0xb72388){var _0x333599,_0x11231d,_0x5981e9,_0x555930;_0xb72388['remoteUri']=intUtil[_0xd56b('0x57')](_0xb72388[_0xd56b('0x56')]);_0xb72388[_0xd56b('0x58')]=intUtil[_0xd56b('0x57')](_0xb72388[_0xd56b('0x58')]);def['uri']=util[_0xd56b('0x20')]('%s/service/v4_1/rest.php',_0xb72388[_0xd56b('0x56')]);if(_0x193624&&_0x193624[_0xd56b('0x5b')]){logger[_0xd56b('0x31')]('['+_0x743637[_0xd56b('0x79')]['toUpperCase']()+']',_0xd56b('0x5c'));_0x743637[_0xd56b('0x5d')]=util[_0xd56b('0x20')](_0xd56b('0x5e'),_0xb72388[_0xd56b('0x58')],_0x743637['uniqueid'],md5(_0x743637[_0xd56b('0x5f')]));}else{_0x743637['recordingURL']='';}return getConnection(_0xb72388)[_0xd56b('0x2b')](function(_0x1d4484){_0x555930=_0x1d4484;if(!_[_0xd56b('0x25')](_0x2e9d7a)){return getUser(_0xb72388,_0x2e9d7a[_0xd56b('0xd')],_0x555930);}else{return getUser(_0xb72388,null,_0x555930);}})['then'](function(_0x39a33e){_0x333599=_0x39a33e;logger[_0xd56b('0x31')]('The\x20User\x20ID\x20is:',_0x333599['id']);return getEndUser(_0xb72388,_0x743637[_0xd56b('0x61')],_0x743637[_0xd56b('0x62')],_0x555930);})[_0xd56b('0x2b')](function(_0x45b0ad){_0x11231d=_0x45b0ad;logger['info']('The\x20Enduser\x20ID\x20is:',_0x11231d['id']);return getTicket(_0xb72388,_0x333599,_0x11231d,_0xb0ffad,_0x743637,_0xb0ffad['Fields'],_0x555930,_0xd56b('0x65'));})['then'](function(_0x52cacb){_0x5981e9=_0x52cacb;logger[_0xd56b('0x31')](_0xd56b('0x66'));logger['info'](_0xd56b('0x67'),_0x5981e9['id']);return setRelationship(_0x555930,_0x333599,_0x5981e9,_0xd56b('0x7a'));})[_0xd56b('0x2b')](function(){return setRelationship(_0x555930,_0x11231d,_0x5981e9,_0xd56b('0x68'));})['then'](function(){return getServerInfo(_0x555930);})[_0xd56b('0x6f')](function(_0x54fdb9){logger[_0xd56b('0x70')]('['+_0x743637[_0xd56b('0x79')][_0xd56b('0x7b')]()+']',JSON[_0xd56b('0x1e')](_0x54fdb9));});}; \ No newline at end of file +var _0x9eb6=['uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','users','unmanaged','toUpperCase','Recording\x20is\x20enabled!','calleridnum','error','lastevent','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','info','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','custom_fields','content','toString','variable','customVariable','Variable','toLowerCase','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x3e292c,_0x2bd3cc){var _0x2de040=function(_0x581118){while(--_0x581118){_0x3e292c['push'](_0x3e292c['shift']());}};_0x2de040(++_0x2bd3cc);}(_0x9eb6,0x111));var _0x69eb=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x9eb6[_0x100682];return _0xcb6e87;};'use strict';var _=require(_0x69eb('0x0'));var rp=require(_0x69eb('0x1'));var BPromise=require('bluebird');var md5=require(_0x69eb('0x2'));var util=require('util');var Redis=require(_0x69eb('0x3'));var intUtil=require(_0x69eb('0x4'));var config=require(_0x69eb('0x5'));var logger=require(_0x69eb('0x6'))(_0x69eb('0x7'));config[_0x69eb('0x8')]=_[_0x69eb('0x9')](config[_0x69eb('0x8')],{'host':_0x69eb('0xa'),'port':0x18eb});var io=require(_0x69eb('0xb'))(new Redis(config[_0x69eb('0x8')]));var def={'method':_0x69eb('0xc'),'json':!![]};function emit(_0x23b639,_0x2ed1c8,_0x5ed6d4){io['to'](_0x23b639)[_0x69eb('0xd')](_0x2ed1c8,_0x5ed6d4);}function getTicket(_0x5a48bb,_0x52e148,_0x1a3feb,_0x51ce7c,_0x4c2411,_0x204daa,_0x1f0830,_0x40ce8e){logger['info'](_0x69eb('0xe'));var _0x46259d=new Date();var _0x56bbb3=[{'name':_0x69eb('0xf'),'value':intUtil['getString'](_0x51ce7c[_0x69eb('0x10')],_0x4c2411,'\x20')},{'name':_0x69eb('0x11'),'value':_0x52e148['id']},{'name':_0x69eb('0x12'),'value':_0x52e148['id']},{'name':_0x69eb('0x13'),'value':intUtil[_0x69eb('0x14')](_0x51ce7c['Descriptions'],_0x4c2411,'\x0a')},{'name':_0x69eb('0x15'),'value':_0x46259d[_0x69eb('0x16')]()[_0x69eb('0x17')](0x0,0x13)[_0x69eb('0x18')]('T','\x20')},{'name':_0x69eb('0x19'),'value':'0'},{'name':_0x69eb('0x1a'),'value':'15'},{'name':_0x69eb('0x1b'),'value':_0x1a3feb['id']},{'name':_0x69eb('0x1c'),'value':_0x69eb('0x1d')},{'name':_0x69eb('0x1e'),'value':_0x1a3feb[_0x69eb('0xf')]},{'name':'direction','value':_0x40ce8e}];if(_0x204daa[_0x69eb('0x1f')]){_['forEach'](_0x204daa,function(_0x2b6fa3){if(_0x4c2411[_0x2b6fa3[_0x69eb('0x20')]]){_0x56bbb3[_0x69eb('0x21')]({'name':_0x2b6fa3[_0x69eb('0x22')],'value':_0x4c2411[_0x2b6fa3[_0x69eb('0x20')]]});}});}return request({'form':{'method':_0x69eb('0x23'),'input_type':_0x69eb('0x24'),'response_type':'JSON','rest_data':JSON[_0x69eb('0x25')]({'session':_0x1f0830['id'],'module_name':_0x69eb('0x26'),'name_value_list':_0x56bbb3})}});}function getAuth(_0x17a3cb){return util[_0x69eb('0x27')](_0x69eb('0x28'),new Buffer(_0x17a3cb[_0x69eb('0x29')]+':X')['toString'](_0x69eb('0x2a')));}function getServerInfo(_0x7deaa5){return request({'form':{'method':_0x69eb('0x2b'),'input_type':'JSON','response_type':_0x69eb('0x24'),'rest_data':JSON[_0x69eb('0x25')]({'session':_0x7deaa5['id']})}});}function getUser(_0x27fa6c,_0x148f53,_0x2aa456){if(!_[_0x69eb('0x2c')](_0x148f53)){logger['info'](_0x69eb('0x2d'),_0x148f53);return request({'form':{'method':_0x69eb('0x2e'),'input_type':_0x69eb('0x24'),'response_type':_0x69eb('0x24'),'rest_data':JSON[_0x69eb('0x25')]({'session':_0x2aa456['id'],'module_name':'Employees','query':util['format'](_0x69eb('0x2f'),_0x148f53),'order_by':'','offset':'0','select_fields':['id','name',_0x69eb('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x69eb('0x31')](function(_0x522687){if(_0x522687[_0x69eb('0x32')][_0x69eb('0x1f')]){var _0x5702a4=_[_0x69eb('0x33')](_0x522687[_0x69eb('0x32')],function(_0x201c77){return _0x201c77[_0x69eb('0x34')][_0x69eb('0x30')][_0x69eb('0x35')]===_0x148f53;});if(_0x5702a4){logger[_0x69eb('0x36')]('Agent\x20found!');return BPromise['resolve']({'id':_0x5702a4[_0x69eb('0x34')]['id']['value'],'name':_0x5702a4['name_value_list'][_0x69eb('0xf')][_0x69eb('0x35')]});}}logger[_0x69eb('0x36')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x69eb('0x37')]({'id':_0x2aa456[_0x69eb('0x34')][_0x69eb('0x38')][_0x69eb('0x35')],'name':_0x2aa456[_0x69eb('0x34')][_0x69eb('0x30')]['value']});});}else{logger[_0x69eb('0x36')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x69eb('0x37')]({'id':_0x2aa456[_0x69eb('0x34')][_0x69eb('0x38')][_0x69eb('0x35')],'name':_0x2aa456['name_value_list']['user_name'][_0x69eb('0x35')]});}}function getEndUser(_0x9c3040,_0x3442ff,_0x7eb221,_0x57ba68){logger['info'](_0x69eb('0x39'),_0x7eb221);return request({'form':{'method':_0x69eb('0x2e'),'input_type':_0x69eb('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x57ba68['id'],'module_name':_0x69eb('0x1d'),'query':util[_0x69eb('0x27')](_0x69eb('0x3a'),_0x7eb221),'order_by':'','offset':'0','select_fields':['id',_0x69eb('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x69eb('0x31')](function(_0x1b1aa8){if(_0x1b1aa8[_0x69eb('0x32')]['length']){var _0x4479d1=_[_0x69eb('0x33')](_0x1b1aa8[_0x69eb('0x32')],function(_0x55b4a3){return _0x55b4a3[_0x69eb('0x34')][_0x69eb('0x3b')][_0x69eb('0x35')]===_0x7eb221;});if(_0x4479d1){logger[_0x69eb('0x36')](_0x69eb('0x3c'));return BPromise[_0x69eb('0x37')]({'id':_0x4479d1[_0x69eb('0x34')]['id']['value'],'name':_0x4479d1[_0x69eb('0x34')][_0x69eb('0xf')][_0x69eb('0x35')],'phone':_0x4479d1[_0x69eb('0x34')]['phone_home'][_0x69eb('0x35')]});}}else{logger[_0x69eb('0x36')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x69eb('0x23'),'input_type':'JSON','response_type':_0x69eb('0x24'),'rest_data':JSON['stringify']({'session':_0x57ba68['id'],'module_name':_0x69eb('0x1d'),'name_value_list':[{'name':_0x69eb('0x3d'),'value':_0x3442ff!==_0x69eb('0x3e')?_0x3442ff:util[_0x69eb('0x27')]('Caller\x20-\x20%s',_0x7eb221)},{'name':_0x69eb('0x3b'),'value':_0x7eb221}]})}})['then'](function(_0x5acaa5){logger[_0x69eb('0x36')](_0x69eb('0x3f'));return BPromise[_0x69eb('0x37')]({'id':_0x5acaa5['id'],'name':_0x5acaa5[_0x69eb('0x32')][_0x69eb('0x3d')][_0x69eb('0x35')],'phone':_0x5acaa5[_0x69eb('0x32')]['phone_home'][_0x69eb('0x35')]});});}});}function request(_0x2e73bb){logger[_0x69eb('0x40')](_0x69eb('0x41'),JSON['stringify'](_0x2e73bb));return rp(_['merge'](def,_0x2e73bb));}function getTags(_0x58e2b9,_0x560c6f){var _0x2dda2c=[];if(_0x58e2b9&&_0x58e2b9[_0x69eb('0x1f')]>0x0){_0x2dda2c=_[_0x69eb('0x42')](_0x58e2b9,_0x560c6f);}return _0x2dda2c;}function getCustomFields(_0x3f807e,_0x4a17c7){var _0x122953=[];var _0x4859e1={'custom_fields':[]};if(_0x3f807e[_0x69eb('0x1f')]>0x0){_['forEach'](_0x3f807e,function(_0x141c2b){if(_0x141c2b[_0x69eb('0x43')]===_0x69eb('0x44')&&_0x141c2b[_0x69eb('0x45')]&&!_0x141c2b[_0x69eb('0x46')]){_0x4859e1[_0x141c2b['nameField']['toLowerCase']()]=_0x141c2b['content']['toString']();}else if(_0x141c2b[_0x69eb('0x43')]==='string'&&_0x141c2b[_0x69eb('0x22')]&&_0x141c2b[_0x69eb('0x46')]){_0x4859e1[_0x69eb('0x47')]['push']({'id':_0x141c2b[_0x69eb('0x22')],'value':_0x141c2b[_0x69eb('0x48')][_0x69eb('0x49')]()});}else if(_0x141c2b['type']===_0x69eb('0x4a')&&_0x141c2b[_0x69eb('0x20')]&&_0x141c2b[_0x69eb('0x22')]&&_0x141c2b[_0x69eb('0x46')]){_0x4a17c7[_0x141c2b['variableName']]&&_0x4859e1[_0x69eb('0x47')][_0x69eb('0x21')]({'id':_0x141c2b[_0x69eb('0x22')],'value':_0x4a17c7[_0x141c2b[_0x69eb('0x20')]]['toString']()});}else if(_0x141c2b['type']===_0x69eb('0x4b')&&_0x141c2b[_0x69eb('0x4c')]&&_0x141c2b[_0x69eb('0x4c')][_0x69eb('0xf')]&&_0x141c2b[_0x69eb('0x22')]&&_0x141c2b[_0x69eb('0x46')]){_0x4a17c7[_0x141c2b[_0x69eb('0x4c')][_0x69eb('0xf')][_0x69eb('0x4d')]()]&&_0x4859e1['custom_fields']['push']({'id':_0x141c2b['idField'],'value':_0x4a17c7[_0x141c2b[_0x69eb('0x4c')][_0x69eb('0xf')][_0x69eb('0x4d')]()]['toString']()});}});}return _0x4859e1;}function getConnection(_0x2f2303){return request({'method':_0x69eb('0xc'),'form':{'method':'login','input_type':_0x69eb('0x24'),'response_type':_0x69eb('0x24'),'rest_data':JSON[_0x69eb('0x25')]({'user_auth':{'user_name':_0x2f2303[_0x69eb('0x4e')],'password':_0x2f2303[_0x69eb('0x4f')],'encryption':'PLAIN'},'application':_0x69eb('0x50')})}})[_0x69eb('0x31')](function(_0x2c22c1){var _0x3d5719=_0x2c22c1;if(_0x3d5719['id']){def['sessionID']=_0x3d5719['id'];return BPromise[_0x69eb('0x37')](_0x3d5719);}else{throw new Error(util[_0x69eb('0x27')](_0x69eb('0x51'),_0x2f2303['id']));}});}function setRelationship(_0x3d3465,_0xb0e109,_0x1dedb7,_0x187627){return request({'form':{'method':'set_relationship','input_type':_0x69eb('0x24'),'response_type':'JSON','rest_data':JSON[_0x69eb('0x25')]({'session':_0x3d3465['id'],'module_name':_0x69eb('0x26'),'module_id':_0x1dedb7['id'],'link_field_name':_0x187627,'related_ids':[_0xb0e109['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x69eb('0x52')]=function(_0x2d043e,_0x1c1513,_0x372b36,_0x67f9c0,_0x3f96f8,_0x1bf617){var _0x58217d,_0x39e255,_0x4342f7,_0x59333b;_0x1bf617[_0x69eb('0x53')]=intUtil[_0x69eb('0x54')](_0x1bf617[_0x69eb('0x53')]);_0x1bf617[_0x69eb('0x55')]=intUtil[_0x69eb('0x54')](_0x1bf617['serverUrl']);def[_0x69eb('0x56')]=util[_0x69eb('0x27')]('%s/service/v4_1/rest.php',_0x1bf617[_0x69eb('0x53')]);if(_0x3f96f8&&_0x3f96f8[_0x69eb('0x57')]){logger['info'](_0x69eb('0x58'),'Recording\x20is\x20enabled!');_0x1c1513['recordingURL']=util['format'](_0x69eb('0x59'),_0x1bf617['serverUrl'],_0x1c1513[_0x69eb('0x5a')],md5(_0x1c1513[_0x69eb('0x5a')]));}else{_0x1c1513[_0x69eb('0x5b')]='';}return getConnection(_0x1bf617)['then'](function(_0x597c5d){_0x59333b=_0x597c5d;return getUser(_0x1bf617,_0x67f9c0[_0x69eb('0xf')],_0x59333b);})[_0x69eb('0x31')](function(_0x3f333c){_0x58217d=_0x3f333c;logger[_0x69eb('0x36')]('The\x20User\x20ID\x20is:',_0x58217d['id']);return getEndUser(_0x1bf617,_0x1c1513[_0x69eb('0x5c')],_0x1c1513['calleridnum'],_0x59333b);})['then'](function(_0x198827){_0x39e255=_0x198827;logger['info'](_0x69eb('0x5d'),_0x39e255['id']);return getTicket(_0x1bf617,_0x58217d,_0x39e255,_0x372b36,_0x1c1513,_0x372b36['Fields'],_0x59333b,_0x69eb('0x5e'));})[_0x69eb('0x31')](function(_0xf6d9d3){_0x4342f7=_0xf6d9d3;logger[_0x69eb('0x36')]('Ticket\x20created!');logger['info'](_0x69eb('0x5f'),_0x4342f7['id']);return setRelationship(_0x59333b,_0x58217d,_0x4342f7,'users');})['then'](function(){return setRelationship(_0x59333b,_0x39e255,_0x4342f7,_0x69eb('0x60'));})[_0x69eb('0x31')](function(){return getServerInfo(_0x59333b);})[_0x69eb('0x31')](function(_0x4d8e67){var _0x92cad4=parseInt(_0x4d8e67[_0x69eb('0x61')][_0x69eb('0x62')](0x0));var _0x371423=util[_0x69eb('0x27')](_0x69eb('0x63'),_0x1bf617[_0x69eb('0x53')],_0x4342f7['id']);if(_0x92cad4>0x6){_0x371423=util[_0x69eb('0x27')](_0x69eb('0x64'),_0x1bf617[_0x69eb('0x53')],_0x4342f7['id']);}logger['info'](_0x69eb('0x58'),_0x69eb('0x65'));emit(util[_0x69eb('0x27')]('user:%s',_0x67f9c0[_0x69eb('0xf')]),_0x69eb('0x66'),{'uri':_0x371423});})[_0x69eb('0x67')](function(_0x3a9384){logger['error']('[QUEUE]',JSON['stringify'](_0x3a9384));});};exports[_0x69eb('0x68')]=function(_0xed1154,_0x53f56b,_0x3adacd,_0x398a7b,_0x5216fe,_0x329476,_0xd4558){var _0x1b2992,_0x31dd6f,_0x3be7b8,_0x5ed0ed;_0x329476[_0x69eb('0x53')]=intUtil['stripTrailingSlash'](_0x329476['remoteUri']);_0x329476[_0x69eb('0x55')]=intUtil['stripTrailingSlash'](_0x329476[_0x69eb('0x55')]);def['uri']=util[_0x69eb('0x27')](_0x69eb('0x69'),_0x329476[_0x69eb('0x53')]);if(_0xd4558&&_0xd4558[_0x69eb('0x6a')]&&_0xd4558[_0x69eb('0x6a')]!=='none'){logger[_0x69eb('0x36')](_0x69eb('0x6b'),'Recording\x20is\x20enabled!');_0x53f56b[_0x69eb('0x5b')]=util[_0x69eb('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x329476[_0x69eb('0x55')],_0x53f56b['uniqueid'],md5(_0x53f56b[_0x69eb('0x5a')]));}return getConnection(_0x329476)[_0x69eb('0x31')](function(_0x3c4176){_0x5ed0ed=_0x3c4176;return getUser(_0x329476,_0x398a7b[_0x69eb('0xf')],_0x5ed0ed);})[_0x69eb('0x31')](function(_0x33aeea){_0x1b2992=_0x33aeea;logger[_0x69eb('0x36')](_0x69eb('0x6c'),_0x1b2992['id']);return getEndUser(_0x329476,_0x53f56b[_0x69eb('0x6d')],_0x53f56b[_0x69eb('0x6e')],_0x5ed0ed);})[_0x69eb('0x31')](function(_0x27baf4){_0x31dd6f=_0x27baf4;logger[_0x69eb('0x36')](_0x69eb('0x5d'),_0x31dd6f['id']);return getTicket(_0x329476,_0x1b2992,_0x31dd6f,_0x3adacd,_0x53f56b,_0x3adacd[_0x69eb('0x6f')],_0x5ed0ed,_0x69eb('0x70'));})['then'](function(_0x26aced){_0x3be7b8=_0x26aced;logger[_0x69eb('0x36')](_0x69eb('0x71'));logger[_0x69eb('0x36')](_0x69eb('0x5f'),_0x3be7b8['id']);return setRelationship(_0x5ed0ed,_0x1b2992,_0x3be7b8,_0x69eb('0x72'));})[_0x69eb('0x31')](function(){return setRelationship(_0x5ed0ed,_0x31dd6f,_0x3be7b8,_0x69eb('0x60'));})[_0x69eb('0x31')](function(){return getServerInfo(_0x5ed0ed);})[_0x69eb('0x31')](function(_0xf4340c){var _0x4a2102=parseInt(_0xf4340c[_0x69eb('0x61')][_0x69eb('0x62')](0x0));var _0x419c67=util[_0x69eb('0x27')](_0x69eb('0x63'),_0x329476[_0x69eb('0x53')],_0x3be7b8['id']);if(_0x4a2102>0x6){_0x419c67=util['format'](_0x69eb('0x64'),_0x329476[_0x69eb('0x53')],_0x3be7b8['id']);}logger['info']('[OUTBOUND]',_0x69eb('0x65'));emit(util[_0x69eb('0x27')]('user:%s',_0x398a7b[_0x69eb('0xf')]),_0x69eb('0x66'),{'uri':_0x419c67});})[_0x69eb('0x67')](function(_0x5d0b53){logger['error'](_0x69eb('0x6b'),JSON[_0x69eb('0x25')](_0x5d0b53));});};exports[_0x69eb('0x73')]=function(_0x37b3aa,_0x132fae,_0x5c4bc3,_0x4017ee,_0x32770f,_0x772655){var _0x1c2c00,_0x4fde99,_0x1b6f70,_0x4d7022;_0x772655[_0x69eb('0x53')]=intUtil[_0x69eb('0x54')](_0x772655['remoteUri']);_0x772655[_0x69eb('0x55')]=intUtil[_0x69eb('0x54')](_0x772655['serverUrl']);def['uri']=util[_0x69eb('0x27')](_0x69eb('0x69'),_0x772655[_0x69eb('0x53')]);if(_0x32770f&&_0x32770f[_0x69eb('0x57')]){logger[_0x69eb('0x36')]('['+_0x132fae['lastevent'][_0x69eb('0x74')]()+']',_0x69eb('0x75'));_0x132fae[_0x69eb('0x5b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x772655[_0x69eb('0x55')],_0x132fae[_0x69eb('0x5a')],md5(_0x132fae[_0x69eb('0x5a')]));}else{_0x132fae[_0x69eb('0x5b')]='';}return getConnection(_0x772655)[_0x69eb('0x31')](function(_0x33ae13){_0x4d7022=_0x33ae13;if(!_['isNil'](_0x4017ee)){return getUser(_0x772655,_0x4017ee[_0x69eb('0xf')],_0x4d7022);}else{return getUser(_0x772655,null,_0x4d7022);}})[_0x69eb('0x31')](function(_0x24cea1){_0x1c2c00=_0x24cea1;logger[_0x69eb('0x36')](_0x69eb('0x6c'),_0x1c2c00['id']);return getEndUser(_0x772655,_0x132fae[_0x69eb('0x5c')],_0x132fae[_0x69eb('0x76')],_0x4d7022);})['then'](function(_0x12435e){_0x4fde99=_0x12435e;logger[_0x69eb('0x36')]('The\x20Enduser\x20ID\x20is:',_0x4fde99['id']);return getTicket(_0x772655,_0x1c2c00,_0x4fde99,_0x5c4bc3,_0x132fae,_0x5c4bc3['Fields'],_0x4d7022,'Inbound');})[_0x69eb('0x31')](function(_0x4ce840){_0x1b6f70=_0x4ce840;logger[_0x69eb('0x36')](_0x69eb('0x71'));logger['info'](_0x69eb('0x5f'),_0x1b6f70['id']);return setRelationship(_0x4d7022,_0x1c2c00,_0x1b6f70,_0x69eb('0x72'));})['then'](function(){return setRelationship(_0x4d7022,_0x4fde99,_0x1b6f70,_0x69eb('0x60'));})['then'](function(){return getServerInfo(_0x4d7022);})[_0x69eb('0x67')](function(_0x8f0a81){logger[_0x69eb('0x77')]('['+_0x132fae[_0x69eb('0x78')][_0x69eb('0x74')]()+']',JSON[_0x69eb('0x25')](_0x8f0a81));});}; \ 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 6f31a00..96917f8 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 _0xf045=['lodash','util','getString','length','type','string','push','content','variable','customVariable','Variable','toLowerCase','name','keyValue','format','key','keyType','variableName','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xf045,0xc8));var _0x5f04=function(_0x74a716,_0x4e01bb){_0x74a716=_0x74a716-0x0;var _0x53d740=_0xf045[_0x74a716];return _0x53d740;};'use strict';var _=require(_0x5f04('0x0'));var util=require(_0x5f04('0x1'));exports[_0x5f04('0x2')]=function(_0x29fa95,_0x3f9d76,_0x37fee4){var _0x4c3d7d=[];if(_0x29fa95[_0x5f04('0x3')]>0x0){var _0x118d32=_['sortBy'](_0x29fa95,['id']);for(var _0x53d7d6=0x0;_0x53d7d6<_0x118d32[_0x5f04('0x3')];_0x53d7d6++){var _0x229e85=_0x118d32[_0x53d7d6];if(_0x229e85[_0x5f04('0x4')]===_0x5f04('0x5')){_0x4c3d7d[_0x5f04('0x6')](_0x229e85[_0x5f04('0x7')]);}else if(_0x229e85[_0x5f04('0x4')]===_0x5f04('0x8')&&_0x229e85['variableName']){_0x3f9d76[_0x229e85['variableName']]&&_0x4c3d7d[_0x5f04('0x6')](_0x3f9d76[_0x229e85['variableName']]['toString']());}else if(_0x229e85[_0x5f04('0x4')]===_0x5f04('0x9')&&_0x229e85[_0x5f04('0xa')]&&_0x229e85[_0x5f04('0xa')]['name']){_0x3f9d76[_0x229e85[_0x5f04('0xa')]['name'][_0x5f04('0xb')]()]&&_0x4c3d7d[_0x5f04('0x6')](_0x3f9d76[_0x229e85['Variable'][_0x5f04('0xc')][_0x5f04('0xb')]()]['toString']());}else if(_0x229e85[_0x5f04('0x4')]===_0x5f04('0xd')){if(_0x229e85['keyType']===_0x5f04('0x5')&&_0x229e85['key']){_0x4c3d7d[_0x5f04('0x6')](util[_0x5f04('0xe')]('%s:\x20%s',_0x229e85[_0x5f04('0xf')],_0x229e85['keyContent']));}else if(_0x229e85[_0x5f04('0x10')]===_0x5f04('0x8')&&_0x229e85[_0x5f04('0x11')]&&_0x229e85[_0x5f04('0xf')]){_0x3f9d76[_0x229e85[_0x5f04('0x11')]]&&_0x4c3d7d[_0x5f04('0x6')](util[_0x5f04('0xe')](_0x5f04('0x12'),_0x229e85[_0x5f04('0xf')],_0x3f9d76[_0x229e85[_0x5f04('0x11')]]));}else if(_0x229e85['keyType']===_0x5f04('0x9')&&_0x229e85[_0x5f04('0xa')]&&_0x229e85['Variable'][_0x5f04('0xc')]&&_0x229e85[_0x5f04('0xf')]){_0x3f9d76[_0x229e85['Variable'][_0x5f04('0xc')][_0x5f04('0xb')]()]&&_0x4c3d7d[_0x5f04('0x6')](util[_0x5f04('0xe')]('%s:\x20%s',_0x229e85[_0x5f04('0xf')],_0x3f9d76[_0x229e85[_0x5f04('0xa')]['name']['toLowerCase']()]));}}}}return _0x4c3d7d[_0x5f04('0x13')](_0x37fee4);};exports[_0x5f04('0x14')]=function(_0x1635a0){var _0x1aeced=_0x1635a0[_0x5f04('0x15')](-0x1);if(_0x1aeced==='/'){_0x1635a0=_0x1635a0[_0x5f04('0x16')](0x0,_0x1635a0[_0x5f04('0x17')](_0x1aeced));}return _0x1635a0;};exports[_0x5f04('0x18')]=function(_0x5532bf){if(!_['isNil'](_0x5532bf)&&_0x5532bf!==''){var _0x498385=/^(([^<>()\[\]\\.,;:\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 _0x498385['test'](String(_0x5532bf)[_0x5f04('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x7b14=['test','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x7b14,0x191));var _0x47b1=function(_0x169527,_0x10b72e){_0x169527=_0x169527-0x0;var _0x57a4a5=_0x7b14[_0x169527];return _0x57a4a5;};'use strict';var _=require(_0x47b1('0x0'));var util=require('util');exports[_0x47b1('0x1')]=function(_0x50d9e4,_0x48bed5,_0x52faef){var _0x19bd49=[];if(_0x50d9e4[_0x47b1('0x2')]>0x0){var _0x3712c6=_[_0x47b1('0x3')](_0x50d9e4,['id']);for(var _0x4b5bb5=0x0;_0x4b5bb5<_0x3712c6[_0x47b1('0x2')];_0x4b5bb5++){var _0x19e5d5=_0x3712c6[_0x4b5bb5];if(_0x19e5d5[_0x47b1('0x4')]===_0x47b1('0x5')){_0x19bd49[_0x47b1('0x6')](_0x19e5d5[_0x47b1('0x7')]);}else if(_0x19e5d5['type']===_0x47b1('0x8')&&_0x19e5d5['variableName']){_0x48bed5[_0x19e5d5['variableName']]&&_0x19bd49[_0x47b1('0x6')](_0x48bed5[_0x19e5d5[_0x47b1('0x9')]][_0x47b1('0xa')]());}else if(_0x19e5d5[_0x47b1('0x4')]===_0x47b1('0xb')&&_0x19e5d5['Variable']&&_0x19e5d5[_0x47b1('0xc')]['name']){_0x48bed5[_0x19e5d5[_0x47b1('0xc')][_0x47b1('0xd')]['toLowerCase']()]&&_0x19bd49[_0x47b1('0x6')](_0x48bed5[_0x19e5d5[_0x47b1('0xc')][_0x47b1('0xd')][_0x47b1('0xe')]()]['toString']());}else if(_0x19e5d5[_0x47b1('0x4')]===_0x47b1('0xf')){if(_0x19e5d5[_0x47b1('0x10')]==='string'&&_0x19e5d5[_0x47b1('0x11')]){_0x19bd49[_0x47b1('0x6')](util[_0x47b1('0x12')](_0x47b1('0x13'),_0x19e5d5[_0x47b1('0x11')],_0x19e5d5[_0x47b1('0x14')]));}else if(_0x19e5d5[_0x47b1('0x10')]===_0x47b1('0x8')&&_0x19e5d5[_0x47b1('0x9')]&&_0x19e5d5['key']){_0x48bed5[_0x19e5d5[_0x47b1('0x9')]]&&_0x19bd49[_0x47b1('0x6')](util[_0x47b1('0x12')](_0x47b1('0x13'),_0x19e5d5[_0x47b1('0x11')],_0x48bed5[_0x19e5d5['variableName']]));}else if(_0x19e5d5[_0x47b1('0x10')]===_0x47b1('0xb')&&_0x19e5d5[_0x47b1('0xc')]&&_0x19e5d5[_0x47b1('0xc')][_0x47b1('0xd')]&&_0x19e5d5[_0x47b1('0x11')]){_0x48bed5[_0x19e5d5[_0x47b1('0xc')][_0x47b1('0xd')]['toLowerCase']()]&&_0x19bd49['push'](util[_0x47b1('0x12')](_0x47b1('0x13'),_0x19e5d5[_0x47b1('0x11')],_0x48bed5[_0x19e5d5[_0x47b1('0xc')][_0x47b1('0xd')][_0x47b1('0xe')]()]));}}}}return _0x19bd49['join'](_0x52faef);};exports[_0x47b1('0x15')]=function(_0x4d64b8){var _0x294e8a=_0x4d64b8[_0x47b1('0x16')](-0x1);if(_0x294e8a==='/'){_0x4d64b8=_0x4d64b8[_0x47b1('0x17')](0x0,_0x4d64b8['lastIndexOf'](_0x294e8a));}return _0x4d64b8;};exports['validateEmail']=function(_0x599cba){if(!_['isNil'](_0x599cba)&&_0x599cba!==''){var _0x32ac8d=/^(([^<>()\[\]\\.,;:\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 _0x32ac8d[_0x47b1('0x18')](String(_0x599cba)[_0x47b1('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 f12e732..508046d 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x940b3d,_0x433dda){var _0x546162=function(_0x56b0fd){while(--_0x56b0fd){_0x940b3d['push'](_0x940b3d['shift']());}};_0x546162(++_0x433dda);}(_0xe706,0xa3));var _0x6e70=function(_0x22ea66,_0x30123a){_0x22ea66=_0x22ea66-0x0;var _0x529757=_0xe706[_0x22ea66];return _0x529757;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x1f9f0c,_0x595da1){var _0x23c6f4=function(_0x144e80){while(--_0x144e80){_0x1f9f0c['push'](_0x1f9f0c['shift']());}};_0x23c6f4(++_0x595da1);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 549ae09..7f02b43 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 _0x4e7d=['end-user','first','%s/users.json','password','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','push','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','filter'];(function(_0x36fe96,_0x182206){var _0x38ad91=function(_0x40f040){while(--_0x40f040){_0x36fe96['push'](_0x36fe96['shift']());}};_0x38ad91(++_0x182206);}(_0x4e7d,0x121));var _0xd4e7=function(_0x42090f,_0x4d18fe){_0x42090f=_0x42090f-0x0;var _0x4e2701=_0x4e7d[_0x42090f];return _0x4e2701;};'use strict';var _=require(_0xd4e7('0x0'));var rp=require(_0xd4e7('0x1'));var md5=require('md5');var util=require(_0xd4e7('0x2'));var Redis=require(_0xd4e7('0x3'));var intUtil=require(_0xd4e7('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd4e7('0x5'))(_0xd4e7('0x6'));config[_0xd4e7('0x7')]=_['defaults'](config[_0xd4e7('0x7')],{'host':_0xd4e7('0x8'),'port':0x18eb});var io=require(_0xd4e7('0x9'))(new Redis(config[_0xd4e7('0x7')]));function emit(_0x51910d,_0x40782f,_0x481449){io['to'](_0x51910d)[_0xd4e7('0xa')](_0x40782f,_0x481449);}var headers={'Content-Type':_0xd4e7('0xb'),'Accept':_0xd4e7('0xb')};function getTicket(_0x543593,_0x56f161,_0xdc0713,_0x2fcbe7,_0x429003){logger[_0xd4e7('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd4e7('0xd')](_0xd4e7('0xe'),_0x543593[_0xd4e7('0xf')]),'method':_0xd4e7('0x10'),'body':{'ticket':_[_0xd4e7('0x11')]({'requester_id':_0xdc0713['id'],'submitter_id':_0x56f161?_0x56f161['id']:undefined,'assignee_id':_0x56f161?_0x56f161['id']:undefined,'tags':getTags(_0x2fcbe7[_0xd4e7('0x12')],_0xd4e7('0x13')),'subject':intUtil[_0xd4e7('0x14')](_0x2fcbe7[_0xd4e7('0x15')],_0x429003,'\x20'),'description':intUtil[_0xd4e7('0x14')](_0x2fcbe7[_0xd4e7('0x16')],_0x429003,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd4e7('0x14')](_0x2fcbe7[_0xd4e7('0x16')],_0x429003,'\x0a')}},getCustomFields(_0x2fcbe7[_0xd4e7('0x17')],_0x429003))}})['then'](function(_0x1667d7){logger[_0xd4e7('0xc')]('Ticket\x20created!');return _0x1667d7[_0xd4e7('0x18')];});}function getUser(_0x1153f6,_0x547c24){if(intUtil[_0xd4e7('0x19')](_0x547c24)){logger[_0xd4e7('0xc')](_0xd4e7('0x1a'),_0x547c24);return request({'uri':util[_0xd4e7('0xd')](_0xd4e7('0x1b'),_0x1153f6[_0xd4e7('0xf')]),'qs':{'query':util[_0xd4e7('0xd')](_0xd4e7('0x1c'),_0x547c24)}})[_0xd4e7('0x1d')](function(_0x143c61){if(_0x143c61[_0xd4e7('0x1e')]){logger[_0xd4e7('0xc')](_0xd4e7('0x1f'));return _[_0xd4e7('0x20')](_0x143c61[_0xd4e7('0x21')],{'email':_0x547c24,'role':'agent'});}else{logger['info'](_0xd4e7('0x22'));return request({'uri':util['format'](_0xd4e7('0x23'),_0x1153f6['remoteUri'])})['then'](function(_0x3efe74){logger[_0xd4e7('0xc')]('Admin\x20account\x20selected.');return _0x3efe74[_0xd4e7('0x24')];});}});}else{logger[_0xd4e7('0xc')](_0xd4e7('0x22'));return request({'uri':util[_0xd4e7('0xd')]('%s/users/me.json',_0x1153f6['remoteUri'])})[_0xd4e7('0x1d')](function(_0x195c79){logger[_0xd4e7('0xc')](_0xd4e7('0x25'));return _0x195c79[_0xd4e7('0x24')];});}}function getEndUser(_0x243bbb,_0x67beb3,_0x119725){logger[_0xd4e7('0xc')]('Searching\x20enduser\x20with\x20phone',_0x119725);return request({'uri':util[_0xd4e7('0xd')](_0xd4e7('0x1b'),_0x243bbb['remoteUri']),'qs':{'query':util[_0xd4e7('0xd')](_0xd4e7('0x26'),_0x119725)}})[_0xd4e7('0x1d')](function(_0x408778){var _0x4b1806;if(_0x408778[_0xd4e7('0x21')][_0xd4e7('0x27')]){_0x408778[_0xd4e7('0x21')]=_[_0xd4e7('0x28')](_0x408778[_0xd4e7('0x21')],{'suspended':![],'role':_0xd4e7('0x29')});if(_0x408778[_0xd4e7('0x21')][_0xd4e7('0x27')]){_0x4b1806=_[_0xd4e7('0x2a')](_0x408778[_0xd4e7('0x21')]);}}if(_0x4b1806){logger[_0xd4e7('0xc')]('Enduser\x20found!');return _0x4b1806;}else{logger[_0xd4e7('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd4e7('0xd')](_0xd4e7('0x2b'),_0x243bbb[_0xd4e7('0xf')]),'method':'POST','body':{'user':{'role':_0xd4e7('0x29'),'name':util[_0xd4e7('0xd')]('Caller\x20-\x20%s',_0x67beb3||_0x119725),'phone':_0x119725}}})[_0xd4e7('0x1d')](function(_0x4f40f3){logger[_0xd4e7('0xc')]('Enduser\x20created.');return _0x4f40f3[_0xd4e7('0x24')];});}});}function getAuth(_0x24d976){var _0x2f1593;if(_0x24d976['authType']===_0xd4e7('0x2c')){_0x2f1593=util[_0xd4e7('0xd')]('%s:%s',_0x24d976[_0xd4e7('0x2d')],_0x24d976[_0xd4e7('0x2c')]);}else if(_0x24d976[_0xd4e7('0x2e')]===_0xd4e7('0x2f')){_0x2f1593=util[_0xd4e7('0xd')](_0xd4e7('0x30'),_0x24d976[_0xd4e7('0x2d')],_0x24d976[_0xd4e7('0x2f')]);}return util['format'](_0xd4e7('0x31'),new Buffer(_0x2f1593)[_0xd4e7('0x32')](_0xd4e7('0x33')));}function request(_0x2606ab){logger['debug']('[HTTP]',JSON[_0xd4e7('0x34')](_0x2606ab));return rp(_['defaults'](_0x2606ab,{'method':_0xd4e7('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x36301c,_0x5df8f1){var _0x39b169=[];if(_0x36301c&&_0x36301c[_0xd4e7('0x27')]>0x0){_0x39b169=_[_0xd4e7('0x36')](_0x36301c,_0x5df8f1);}return _0x39b169;}function getCustomFields(_0x5e679b,_0x3362b0){var _0x3cb168=[];var _0x3418e8={'custom_fields':[]};if(_0x5e679b[_0xd4e7('0x27')]>0x0){_[_0xd4e7('0x37')](_0x5e679b,function(_0x568158){if(_[_0xd4e7('0x38')](['string',_0xd4e7('0x39')],_0x568158[_0xd4e7('0x3a')])&&_0x568158[_0xd4e7('0x3b')]&&!_0x568158[_0xd4e7('0x3c')]){_0x3418e8[_0x568158[_0xd4e7('0x3b')][_0xd4e7('0x3d')]()]=_0x568158[_0xd4e7('0x3e')]['toString']();}else if(_['includes']([_0xd4e7('0x3f'),'picklist'],_0x568158['type'])&&_0x568158[_0xd4e7('0x40')]&&_0x568158['customField']){_0x3418e8[_0xd4e7('0x41')]['push']({'id':_0x568158[_0xd4e7('0x40')],'value':_0x568158[_0xd4e7('0x3e')][_0xd4e7('0x32')]()});}else if(_0x568158[_0xd4e7('0x3a')]===_0xd4e7('0x42')&&_0x568158['variableName']&&_0x568158[_0xd4e7('0x40')]&&_0x568158[_0xd4e7('0x3c')]){_0x3362b0[_0x568158[_0xd4e7('0x43')]]&&_0x3418e8[_0xd4e7('0x41')]['push']({'id':_0x568158[_0xd4e7('0x40')],'value':_0x3362b0[_0x568158[_0xd4e7('0x43')]][_0xd4e7('0x32')]()});}else if(_0x568158[_0xd4e7('0x3a')]===_0xd4e7('0x44')&&_0x568158['Variable']&&_0x568158[_0xd4e7('0x45')][_0xd4e7('0x13')]&&_0x568158[_0xd4e7('0x40')]&&_0x568158[_0xd4e7('0x3c')]){_0x3362b0[_0x568158[_0xd4e7('0x45')]['name'][_0xd4e7('0x3d')]()]&&_0x3418e8['custom_fields'][_0xd4e7('0x46')]({'id':_0x568158[_0xd4e7('0x40')],'value':_0x3362b0[_0x568158[_0xd4e7('0x45')][_0xd4e7('0x13')][_0xd4e7('0x3d')]()][_0xd4e7('0x32')]()});}});}return _0x3418e8;}exports[_0xd4e7('0x47')]=function(_0xa18665,_0x586e13,_0x7563bc,_0x59c57b,_0x5b29c4,_0x3327b0){var _0x5b1f8f,_0x27b0fd;_0x3327b0[_0xd4e7('0xf')]=intUtil['stripTrailingSlash'](_0x3327b0['remoteUri']);_0x3327b0[_0xd4e7('0x48')]=intUtil['stripTrailingSlash'](_0x3327b0['serverUrl']);if(_0x5b29c4&&_0x5b29c4[_0xd4e7('0x49')]){logger[_0xd4e7('0xc')](_0xd4e7('0x4a'),_0xd4e7('0x4b'));_0x586e13['recordingURL']=util['format'](_0xd4e7('0x4c'),_0x3327b0['serverUrl'],_0x586e13[_0xd4e7('0x4d')],md5(_0x586e13[_0xd4e7('0x4d')]));}else{_0x586e13[_0xd4e7('0x4e')]='';}headers[_0xd4e7('0x4f')]=getAuth(_0x3327b0);return getUser(_0x3327b0,_0x59c57b[_0xd4e7('0x50')])[_0xd4e7('0x1d')](function(_0x51f314){_0x5b1f8f=_0x51f314;logger[_0xd4e7('0xc')]('The\x20User\x20ID\x20is:',_0x5b1f8f['id']);return getEndUser(_0x3327b0,_0x586e13['calleridname'],_0x586e13[_0xd4e7('0x51')]);})[_0xd4e7('0x1d')](function(_0x1766e8){_0x27b0fd=_0x1766e8;logger[_0xd4e7('0xc')](_0xd4e7('0x52'),_0x27b0fd['id']);return getTicket(_0x3327b0,_0x5b1f8f,_0x27b0fd,_0x7563bc,_0x586e13);})['then'](function(_0x5660e0){if(_0x5660e0){logger[_0xd4e7('0xc')](_0xd4e7('0x53'),_0x5660e0['id']);switch(_0x3327b0[_0xd4e7('0x3a')]){case'integrationTab':logger[_0xd4e7('0xc')](_0xd4e7('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd4e7('0xd')](_0xd4e7('0x54'),_0x3327b0[_0xd4e7('0xf')],_0x5b1f8f['id'],_0x5660e0['id']),'method':_0xd4e7('0x10')});case _0xd4e7('0x55'):logger[_0xd4e7('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4e7('0xd')](_0xd4e7('0x56'),_0x59c57b[_0xd4e7('0x13')]),_0xd4e7('0x57'),{'uri':util[_0xd4e7('0xd')]('%s/agent/tickets/%s',_0x3327b0[_0xd4e7('0xf')][_0xd4e7('0x58')](_0xd4e7('0x59'),''),_0x5660e0['id'])});break;default:logger[_0xd4e7('0x5a')](_0xd4e7('0x4a'),_0xd4e7('0x5b'));}}})[_0xd4e7('0x5c')](function(_0x2e33b5){logger[_0xd4e7('0x5a')](_0xd4e7('0x5d'),util[_0xd4e7('0x5e')](_0x2e33b5,{'showHidden':!![],'depth':null}));});};exports[_0xd4e7('0x5f')]=function(_0x20163b,_0x2c8ed7,_0x4b110f,_0x59a04f,_0x4a84ad,_0x15f390,_0x2f6b4e){var _0x46d0d5,_0x557213;_0x15f390[_0xd4e7('0xf')]=intUtil[_0xd4e7('0x60')](_0x15f390[_0xd4e7('0xf')]);_0x15f390['serverUrl']=intUtil[_0xd4e7('0x60')](_0x15f390['serverUrl']);if(_0x2f6b4e&&_0x2f6b4e[_0xd4e7('0x61')]&&_0x2f6b4e['recordingFormat']!==_0xd4e7('0x62')){logger['info'](_0xd4e7('0x63'),_0xd4e7('0x4b'));_0x2c8ed7['recordingURL']=util[_0xd4e7('0xd')](_0xd4e7('0x4c'),_0x15f390['serverUrl'],_0x2c8ed7['uniqueid'],md5(_0x2c8ed7[_0xd4e7('0x4d')]));}headers['Authorization']=getAuth(_0x15f390);return getUser(_0x15f390,_0x59a04f[_0xd4e7('0x50')])[_0xd4e7('0x1d')](function(_0x34184c){_0x46d0d5=_0x34184c;logger[_0xd4e7('0xc')](_0xd4e7('0x64'),_0x46d0d5['id']);return getEndUser(_0x15f390,_0x2c8ed7['destcalleridname'],_0x2c8ed7[_0xd4e7('0x65')]);})[_0xd4e7('0x1d')](function(_0x2b61ae){_0x557213=_0x2b61ae;logger[_0xd4e7('0xc')]('The\x20Enduser\x20ID\x20is:',_0x557213['id']);return getTicket(_0x15f390,_0x46d0d5,_0x557213,_0x4b110f,_0x2c8ed7);})[_0xd4e7('0x1d')](function(_0x308537){if(_0x308537){logger['info'](_0xd4e7('0x53'),_0x308537['id']);switch(_0x15f390[_0xd4e7('0x3a')]){case'integrationTab':logger[_0xd4e7('0xc')](_0xd4e7('0x63'),_0xd4e7('0x66'));return request({'uri':util[_0xd4e7('0xd')](_0xd4e7('0x54'),_0x15f390['remoteUri'],_0x46d0d5['id'],_0x308537['id']),'method':'POST'});case _0xd4e7('0x55'):logger[_0xd4e7('0xc')]('[OUTBOUND]',_0xd4e7('0x67'));emit(util[_0xd4e7('0xd')](_0xd4e7('0x56'),_0x59a04f[_0xd4e7('0x13')]),_0xd4e7('0x57'),{'uri':util[_0xd4e7('0xd')](_0xd4e7('0x68'),_0x15f390['remoteUri'][_0xd4e7('0x58')]('/api/v2',''),_0x308537['id'])});break;default:logger['error'](_0xd4e7('0x63'),_0xd4e7('0x5b'));}}})['catch'](function(_0x157d96){logger['error'](_0xd4e7('0x69'),util[_0xd4e7('0x5e')](_0x157d96,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x399d32,_0x35dd59,_0x2b0ba9,_0x196441,_0x15de1a,_0x247491){var _0x12706b,_0x186dcb;_0x247491[_0xd4e7('0xf')]=intUtil['stripTrailingSlash'](_0x247491[_0xd4e7('0xf')]);_0x247491[_0xd4e7('0x48')]=intUtil['stripTrailingSlash'](_0x247491['serverUrl']);if(_0x15de1a&&_0x15de1a[_0xd4e7('0x49')]){logger['info']('['+_0x35dd59['lastevent'][_0xd4e7('0x6a')]()+']',_0xd4e7('0x4b'));_0x35dd59[_0xd4e7('0x4e')]=util[_0xd4e7('0xd')](_0xd4e7('0x4c'),_0x247491[_0xd4e7('0x48')],_0x35dd59['uniqueid'],md5(_0x35dd59[_0xd4e7('0x4d')]));}else{_0x35dd59['recordingURL']='';}headers[_0xd4e7('0x4f')]=getAuth(_0x247491);return getUser(_0x247491)[_0xd4e7('0x1d')](function(_0x4a718f){_0x12706b=_0x4a718f;logger[_0xd4e7('0xc')](_0xd4e7('0x64'),_0x12706b['id']);return getEndUser(_0x247491,_0x35dd59[_0xd4e7('0x6b')],_0x35dd59[_0xd4e7('0x51')]);})[_0xd4e7('0x1d')](function(_0x5b7843){_0x186dcb=_0x5b7843;logger[_0xd4e7('0xc')]('The\x20Enduser\x20ID\x20is:',_0x186dcb['id']);return getTicket(_0x247491,_0x12706b,_0x186dcb,_0x2b0ba9,_0x35dd59);})['then'](function(_0x58a4f8){if(_0x58a4f8){logger['info'](_0xd4e7('0x53'),_0x58a4f8['id']);}})[_0xd4e7('0x5c')](function(_0x4cde1a){logger['error']('['+_0x35dd59[_0xd4e7('0x6c')][_0xd4e7('0x6a')]()+']'+_0xd4e7('0x6d'),util[_0xd4e7('0x5e')](_0x4cde1a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xce7f=['POST','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','Authorization','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','authType','%s/token:%s','username','token','Basic\x20%s','toString','base64','debug','stringify','GET','string','picklist','nameField','content','idField','customField','custom_fields','push','type','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xce7f,0x8e));var _0xfce7=function(_0x2ccb91,_0xa2c1b4){_0x2ccb91=_0x2ccb91-0x0;var _0x4136ca=_0xce7f[_0x2ccb91];return _0x4136ca;};'use strict';var _=require(_0xfce7('0x0'));var rp=require(_0xfce7('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xfce7('0x2'));var intUtil=require(_0xfce7('0x3'));var config=require(_0xfce7('0x4'));var logger=require(_0xfce7('0x5'))(_0xfce7('0x6'));config['redis']=_[_0xfce7('0x7')](config[_0xfce7('0x8')],{'host':_0xfce7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x52e73a,_0xf23e50,_0x3a9a62){io['to'](_0x52e73a)[_0xfce7('0xa')](_0xf23e50,_0x3a9a62);}var headers={'Content-Type':_0xfce7('0xb'),'Accept':'application/json'};function getTicket(_0x6a8516,_0x13df05,_0x20fa4a,_0x4e1b7d,_0x42c85f){logger['info'](_0xfce7('0xc'));return request({'uri':util[_0xfce7('0xd')](_0xfce7('0xe'),_0x6a8516[_0xfce7('0xf')]),'method':'POST','body':{'ticket':_[_0xfce7('0x10')]({'requester_id':_0x20fa4a['id'],'submitter_id':_0x13df05?_0x13df05['id']:undefined,'assignee_id':_0x13df05?_0x13df05['id']:undefined,'tags':getTags(_0x4e1b7d[_0xfce7('0x11')],_0xfce7('0x12')),'subject':intUtil[_0xfce7('0x13')](_0x4e1b7d[_0xfce7('0x14')],_0x42c85f,'\x20'),'description':intUtil['getString'](_0x4e1b7d[_0xfce7('0x15')],_0x42c85f,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfce7('0x13')](_0x4e1b7d[_0xfce7('0x15')],_0x42c85f,'\x0a')}},getCustomFields(_0x4e1b7d[_0xfce7('0x16')],_0x42c85f))}})[_0xfce7('0x17')](function(_0x491ae6){logger[_0xfce7('0x18')](_0xfce7('0x19'));return _0x491ae6[_0xfce7('0x1a')];});}function getUser(_0x4c1811,_0x24ec07){if(intUtil[_0xfce7('0x1b')](_0x24ec07)){logger[_0xfce7('0x18')]('Getting\x20agent\x20with\x20email',_0x24ec07);return request({'uri':util[_0xfce7('0xd')](_0xfce7('0x1c'),_0x4c1811['remoteUri']),'qs':{'query':util[_0xfce7('0xd')](_0xfce7('0x1d'),_0x24ec07)}})[_0xfce7('0x17')](function(_0x8dde07){if(_0x8dde07[_0xfce7('0x1e')]){logger['info']('Agent\x20found!');return _[_0xfce7('0x1f')](_0x8dde07[_0xfce7('0x20')],{'email':_0x24ec07,'role':_0xfce7('0x21')});}else{logger[_0xfce7('0x18')](_0xfce7('0x22'));return request({'uri':util[_0xfce7('0xd')](_0xfce7('0x23'),_0x4c1811[_0xfce7('0xf')])})[_0xfce7('0x17')](function(_0x22f8cd){logger[_0xfce7('0x18')]('Admin\x20account\x20selected.');return _0x22f8cd[_0xfce7('0x24')];});}});}else{logger[_0xfce7('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfce7('0xd')]('%s/users/me.json',_0x4c1811[_0xfce7('0xf')])})[_0xfce7('0x17')](function(_0x27613b){logger['info'](_0xfce7('0x25'));return _0x27613b[_0xfce7('0x24')];});}}function getEndUser(_0x37a5fa,_0x1e2b7d,_0x2e4da2){logger[_0xfce7('0x18')](_0xfce7('0x26'),_0x2e4da2);return request({'uri':util[_0xfce7('0xd')](_0xfce7('0x1c'),_0x37a5fa['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2e4da2)}})[_0xfce7('0x17')](function(_0x51341a){var _0xc48b52;if(_0x51341a[_0xfce7('0x20')][_0xfce7('0x27')]){_0x51341a[_0xfce7('0x20')]=_[_0xfce7('0x28')](_0x51341a[_0xfce7('0x20')],{'suspended':![],'role':'end-user'});if(_0x51341a['results'][_0xfce7('0x27')]){_0xc48b52=_['first'](_0x51341a['results']);}}if(_0xc48b52){logger[_0xfce7('0x18')](_0xfce7('0x29'));return _0xc48b52;}else{logger['info'](_0xfce7('0x2a'));return request({'uri':util[_0xfce7('0xd')]('%s/users.json',_0x37a5fa[_0xfce7('0xf')]),'method':'POST','body':{'user':{'role':_0xfce7('0x2b'),'name':util[_0xfce7('0xd')](_0xfce7('0x2c'),_0x1e2b7d||_0x2e4da2),'phone':_0x2e4da2}}})['then'](function(_0x70eecf){logger['info'](_0xfce7('0x2d'));return _0x70eecf[_0xfce7('0x24')];});}});}function getAuth(_0x405072){var _0xc9b171;if(_0x405072['authType']==='password'){_0xc9b171=util['format']('%s:%s',_0x405072['username'],_0x405072[_0xfce7('0x2e')]);}else if(_0x405072[_0xfce7('0x2f')]==='token'){_0xc9b171=util[_0xfce7('0xd')](_0xfce7('0x30'),_0x405072[_0xfce7('0x31')],_0x405072[_0xfce7('0x32')]);}return util[_0xfce7('0xd')](_0xfce7('0x33'),new Buffer(_0xc9b171)[_0xfce7('0x34')](_0xfce7('0x35')));}function request(_0x162a53){logger[_0xfce7('0x36')]('[HTTP]',JSON[_0xfce7('0x37')](_0x162a53));return rp(_['defaults'](_0x162a53,{'method':_0xfce7('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x187761,_0x2de4cb){var _0x4ab21c=[];if(_0x187761&&_0x187761['length']>0x0){_0x4ab21c=_['map'](_0x187761,_0x2de4cb);}return _0x4ab21c;}function getCustomFields(_0xfcd2c7,_0x3b4136){var _0x2167e4=[];var _0x2fdf8f={'custom_fields':[]};if(_0xfcd2c7[_0xfce7('0x27')]>0x0){_['forEach'](_0xfcd2c7,function(_0x592a5e){if(_['includes']([_0xfce7('0x39'),_0xfce7('0x3a')],_0x592a5e['type'])&&_0x592a5e['nameField']&&!_0x592a5e['customField']){_0x2fdf8f[_0x592a5e[_0xfce7('0x3b')]['toLowerCase']()]=_0x592a5e[_0xfce7('0x3c')][_0xfce7('0x34')]();}else if(_['includes']([_0xfce7('0x39'),_0xfce7('0x3a')],_0x592a5e['type'])&&_0x592a5e[_0xfce7('0x3d')]&&_0x592a5e[_0xfce7('0x3e')]){_0x2fdf8f[_0xfce7('0x3f')][_0xfce7('0x40')]({'id':_0x592a5e[_0xfce7('0x3d')],'value':_0x592a5e[_0xfce7('0x3c')][_0xfce7('0x34')]()});}else if(_0x592a5e[_0xfce7('0x41')]===_0xfce7('0x42')&&_0x592a5e[_0xfce7('0x43')]&&_0x592a5e[_0xfce7('0x3d')]&&_0x592a5e[_0xfce7('0x3e')]){_0x3b4136[_0x592a5e[_0xfce7('0x43')]]&&_0x2fdf8f['custom_fields'][_0xfce7('0x40')]({'id':_0x592a5e['idField'],'value':_0x3b4136[_0x592a5e['variableName']][_0xfce7('0x34')]()});}else if(_0x592a5e[_0xfce7('0x41')]===_0xfce7('0x44')&&_0x592a5e['Variable']&&_0x592a5e['Variable']['name']&&_0x592a5e[_0xfce7('0x3d')]&&_0x592a5e['customField']){_0x3b4136[_0x592a5e[_0xfce7('0x45')][_0xfce7('0x12')][_0xfce7('0x46')]()]&&_0x2fdf8f['custom_fields'][_0xfce7('0x40')]({'id':_0x592a5e[_0xfce7('0x3d')],'value':_0x3b4136[_0x592a5e[_0xfce7('0x45')][_0xfce7('0x12')]['toLowerCase']()][_0xfce7('0x34')]()});}});}return _0x2fdf8f;}exports[_0xfce7('0x47')]=function(_0xfed87b,_0x938e19,_0x16de03,_0x36e22e,_0x3ce256,_0x5dd678){var _0x31dc9a,_0x404ce7;_0x5dd678[_0xfce7('0xf')]=intUtil[_0xfce7('0x48')](_0x5dd678[_0xfce7('0xf')]);_0x5dd678[_0xfce7('0x49')]=intUtil[_0xfce7('0x48')](_0x5dd678[_0xfce7('0x49')]);if(_0x3ce256&&_0x3ce256['monitor_format']){logger['info'](_0xfce7('0x4a'),_0xfce7('0x4b'));_0x938e19[_0xfce7('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5dd678['serverUrl'],_0x938e19[_0xfce7('0x4d')],md5(_0x938e19['uniqueid']));}else{_0x938e19[_0xfce7('0x4c')]='';}headers['Authorization']=getAuth(_0x5dd678);return getUser(_0x5dd678,_0x36e22e[_0xfce7('0x4e')])[_0xfce7('0x17')](function(_0x1f80da){_0x31dc9a=_0x1f80da;logger[_0xfce7('0x18')](_0xfce7('0x4f'),_0x31dc9a['id']);return getEndUser(_0x5dd678,_0x938e19[_0xfce7('0x50')],_0x938e19['calleridnum']);})['then'](function(_0x40af21){_0x404ce7=_0x40af21;logger['info'](_0xfce7('0x51'),_0x404ce7['id']);return getTicket(_0x5dd678,_0x31dc9a,_0x404ce7,_0x16de03,_0x938e19);})[_0xfce7('0x17')](function(_0x33555e){if(_0x33555e){logger[_0xfce7('0x18')](_0xfce7('0x52'),_0x33555e['id']);switch(_0x5dd678['type']){case'integrationTab':logger[_0xfce7('0x18')](_0xfce7('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfce7('0xd')](_0xfce7('0x53'),_0x5dd678[_0xfce7('0xf')],_0x31dc9a['id'],_0x33555e['id']),'method':_0xfce7('0x54')});case _0xfce7('0x55'):logger[_0xfce7('0x18')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xfce7('0x56'),_0x36e22e[_0xfce7('0x12')]),_0xfce7('0x57'),{'uri':util[_0xfce7('0xd')](_0xfce7('0x58'),_0x5dd678[_0xfce7('0xf')][_0xfce7('0x59')](_0xfce7('0x5a'),''),_0x33555e['id'])});break;default:logger[_0xfce7('0x5b')](_0xfce7('0x4a'),_0xfce7('0x5c'));}}})[_0xfce7('0x5d')](function(_0x521cd9){logger['error'](_0xfce7('0x5e'),util[_0xfce7('0x5f')](_0x521cd9,{'showHidden':!![],'depth':null}));});};exports[_0xfce7('0x60')]=function(_0x512438,_0x7ecaeb,_0x10dd02,_0x11e0ca,_0x13c9a7,_0x1787c1,_0x5bcfe2){var _0x36b2d5,_0x4ad7c6;_0x1787c1[_0xfce7('0xf')]=intUtil[_0xfce7('0x48')](_0x1787c1[_0xfce7('0xf')]);_0x1787c1['serverUrl']=intUtil[_0xfce7('0x48')](_0x1787c1[_0xfce7('0x49')]);if(_0x5bcfe2&&_0x5bcfe2[_0xfce7('0x61')]&&_0x5bcfe2['recordingFormat']!==_0xfce7('0x62')){logger['info'](_0xfce7('0x63'),_0xfce7('0x4b'));_0x7ecaeb[_0xfce7('0x4c')]=util[_0xfce7('0xd')](_0xfce7('0x64'),_0x1787c1[_0xfce7('0x49')],_0x7ecaeb[_0xfce7('0x4d')],md5(_0x7ecaeb[_0xfce7('0x4d')]));}headers['Authorization']=getAuth(_0x1787c1);return getUser(_0x1787c1,_0x11e0ca['email'])[_0xfce7('0x17')](function(_0x24e41a){_0x36b2d5=_0x24e41a;logger[_0xfce7('0x18')]('The\x20User\x20ID\x20is:',_0x36b2d5['id']);return getEndUser(_0x1787c1,_0x7ecaeb[_0xfce7('0x65')],_0x7ecaeb[_0xfce7('0x66')]);})['then'](function(_0xf76298){_0x4ad7c6=_0xf76298;logger[_0xfce7('0x18')](_0xfce7('0x51'),_0x4ad7c6['id']);return getTicket(_0x1787c1,_0x36b2d5,_0x4ad7c6,_0x10dd02,_0x7ecaeb);})[_0xfce7('0x17')](function(_0x609f79){if(_0x609f79){logger[_0xfce7('0x18')](_0xfce7('0x52'),_0x609f79['id']);switch(_0x1787c1[_0xfce7('0x41')]){case _0xfce7('0x67'):logger[_0xfce7('0x18')](_0xfce7('0x63'),_0xfce7('0x68'));return request({'uri':util[_0xfce7('0xd')](_0xfce7('0x53'),_0x1787c1[_0xfce7('0xf')],_0x36b2d5['id'],_0x609f79['id']),'method':_0xfce7('0x54')});case _0xfce7('0x55'):logger[_0xfce7('0x18')](_0xfce7('0x63'),_0xfce7('0x69'));emit(util['format']('user:%s',_0x11e0ca[_0xfce7('0x12')]),_0xfce7('0x57'),{'uri':util[_0xfce7('0xd')](_0xfce7('0x58'),_0x1787c1['remoteUri'][_0xfce7('0x59')](_0xfce7('0x5a'),''),_0x609f79['id'])});break;default:logger['error']('[OUTBOUND]',_0xfce7('0x5c'));}}})[_0xfce7('0x5d')](function(_0x502427){logger[_0xfce7('0x5b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfce7('0x5f')](_0x502427,{'showHidden':!![],'depth':null}));});};exports[_0xfce7('0x6a')]=function(_0x5c1281,_0x45cfae,_0x477f96,_0xbc7711,_0x3eec80,_0x53120f){var _0x5d5540,_0x1aacd4;_0x53120f[_0xfce7('0xf')]=intUtil[_0xfce7('0x48')](_0x53120f[_0xfce7('0xf')]);_0x53120f[_0xfce7('0x49')]=intUtil[_0xfce7('0x48')](_0x53120f[_0xfce7('0x49')]);if(_0x3eec80&&_0x3eec80[_0xfce7('0x6b')]){logger[_0xfce7('0x18')]('['+_0x45cfae[_0xfce7('0x6c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x45cfae[_0xfce7('0x4c')]=util['format'](_0xfce7('0x64'),_0x53120f['serverUrl'],_0x45cfae['uniqueid'],md5(_0x45cfae[_0xfce7('0x4d')]));}else{_0x45cfae['recordingURL']='';}headers[_0xfce7('0x6d')]=getAuth(_0x53120f);return getUser(_0x53120f)[_0xfce7('0x17')](function(_0x8d2c89){_0x5d5540=_0x8d2c89;logger['info'](_0xfce7('0x4f'),_0x5d5540['id']);return getEndUser(_0x53120f,_0x45cfae[_0xfce7('0x50')],_0x45cfae[_0xfce7('0x6e')]);})[_0xfce7('0x17')](function(_0x32996c){_0x1aacd4=_0x32996c;logger[_0xfce7('0x18')](_0xfce7('0x51'),_0x1aacd4['id']);return getTicket(_0x53120f,_0x5d5540,_0x1aacd4,_0x477f96,_0x45cfae);})[_0xfce7('0x17')](function(_0x4a461c){if(_0x4a461c){logger[_0xfce7('0x18')](_0xfce7('0x52'),_0x4a461c['id']);}})[_0xfce7('0x5d')](function(_0x52c91a){logger[_0xfce7('0x5b')]('['+_0x45cfae[_0xfce7('0x6c')][_0xfce7('0x6f')]()+']'+_0xfce7('0x70'),util['inspect'](_0x52c91a,{'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 21f2daa..9d1e3fd 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 _0x44d5=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Administrator','user','profile','Using\x20the\x20admin\x20account!','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','/crm/v2/','startCase','role','first_name','last_name','details','moduleCreate','Error:\x20','CREATE\x20ERROR','GET','contact_lead','uri','Contacts','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','code','Call\x20created!','err','log','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','Outbound','user:%s','toUpperCase','zoho.eu','lodash','request-promise','util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','stringify','includes','string','picklist','content','toString','type','idField','variableName','customVariable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu'];(function(_0x8ffa00,_0x48d500){var _0x409728=function(_0x469cd5){while(--_0x469cd5){_0x8ffa00['push'](_0x8ffa00['shift']());}};_0x409728(++_0x48d500);}(_0x44d5,0x1a5));var _0x544d=function(_0x59e5cb,_0x2b209a){_0x59e5cb=_0x59e5cb-0x0;var _0x4e69c1=_0x44d5[_0x59e5cb];return _0x4e69c1;};'use strict';var _=require(_0x544d('0x0'));var rp=require(_0x544d('0x1'));var md5=require('md5');var util=require(_0x544d('0x2'));var intUtil=require('./util');var moment=require(_0x544d('0x3'));var Redis=require('ioredis');var BPromise=require(_0x544d('0x4'));var config=require(_0x544d('0x5'));var logger=require(_0x544d('0x6'))('zoho');config[_0x544d('0x7')]=_['defaults'](config[_0x544d('0x7')],{'host':_0x544d('0x8'),'port':0x18eb});var io=require(_0x544d('0x9'))(new Redis(config[_0x544d('0x7')]));function emit(_0x27ae97,_0x2e970d,_0x1f39d7){io['to'](_0x27ae97)[_0x544d('0xa')](_0x2e970d,_0x1f39d7);}function request(_0x365f28){logger[_0x544d('0xb')]('[HTTP]',JSON[_0x544d('0xc')](_0x365f28));return rp(_0x365f28);}function getCustomFields(_0x47e222,_0x26b787){var _0x3bfe2c={};if(_0x47e222['length']>0x0){_['forEach'](_0x47e222,function(_0x47ca16){if(_[_0x544d('0xd')]([_0x544d('0xe'),_0x544d('0xf')],_0x47ca16['type'])&&_0x47ca16['idField']){_0x3bfe2c[_0x47ca16['idField']]=_0x47ca16[_0x544d('0x10')][_0x544d('0x11')]();}else if(_0x47ca16[_0x544d('0x12')]==='variable'&&_0x47ca16['variableName']&&_0x47ca16['idField']&&_0x26b787[_0x47ca16['variableName']]){_0x3bfe2c[_0x47ca16[_0x544d('0x13')]]=_0x26b787[_0x47ca16[_0x544d('0x14')]][_0x544d('0x11')]();}else if(_0x47ca16[_0x544d('0x12')]===_0x544d('0x15')&&_0x47ca16['Variable']&&_0x47ca16['Variable']['name']&&_0x47ca16[_0x544d('0x13')]&&_0x26b787[_0x47ca16['Variable'][_0x544d('0x16')][_0x544d('0x17')]()]){_0x3bfe2c[_0x47ca16[_0x544d('0x13')]]=_0x26b787[_0x47ca16['Variable'][_0x544d('0x16')][_0x544d('0x17')]()][_0x544d('0x11')]();}});}return _0x3bfe2c;}function getName(_0x13cb63){if(_0x13cb63[_0x544d('0x18')]('\x20')>0x0){var _0x17214b=_0x13cb63['split'](/ (.+)/);if(_0x17214b[0x1]){return _0x17214b;}}return[_0x13cb63,_0x13cb63];}var accountsTokens={};function getAccessToken(_0x42992a){return new Promise(function(_0x3f5940,_0x264623){if(!_['isNil'](accountsTokens[_0x42992a['id']])&&!_[_0x544d('0x19')](accountsTokens[_0x42992a['id']][_0x544d('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x42992a['id']][_0x544d('0x1b')])){_0x3f5940(accountsTokens[_0x42992a['id']][_0x544d('0x1a')]);}}var _0x588106;switch(_0x42992a[_0x544d('0x1c')]){case'US':_0x588106=_0x544d('0x1d');break;case'AU':_0x588106=_0x544d('0x1e');break;case'EU':_0x588106=_0x544d('0x1f');break;case'IN':_0x588106=_0x544d('0x20');break;case'CN':_0x588106=_0x544d('0x21');break;default:_0x588106='https://accounts.zoho.eu';break;}var _0x2dce66={'method':_0x544d('0x22'),'uri':_0x588106+_0x544d('0x23'),'qs':{'refresh_token':_0x42992a[_0x544d('0x24')],'client_id':_0x42992a[_0x544d('0x25')],'client_secret':_0x42992a[_0x544d('0x26')],'grant_type':_0x544d('0x27')},'json':!![]};return rp(_0x2dce66)[_0x544d('0x28')](function(_0x47509b){accountsTokens[_0x42992a['id']]={'access_token':_0x47509b[_0x544d('0x1a')],'expires_in':moment()[_0x544d('0x29')](_0x47509b[_0x544d('0x1b')],_0x544d('0x2a'))};_0x3f5940(_0x47509b[_0x544d('0x1a')]);})[_0x544d('0x2b')](function(_0x3ce6c2){logger[_0x544d('0x2c')](_0x544d('0x2d'),_0x3ce6c2[_0x544d('0x2e')]);_0x264623(_0x3ce6c2);});});}function getUser(_0x5cf0b0,_0x27bcc2,_0xd6299c,_0x337efd){logger[_0x544d('0x2f')]('Search\x20user');return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x27bcc2),'qs':{'type':_0x544d('0x30')},'headers':{'Authorization':_0x544d('0x31')+_0x5cf0b0},'json':!![]})[_0x544d('0x28')](function(_0x26d86e){if(_0x26d86e[_0x544d('0x32')]){var _0x385ff3=-0x1;if(_['isArrayLikeObject'](_0x26d86e['users'])){if(!_[_0x544d('0x19')](_0x337efd)){_0x385ff3=_[_0x544d('0x33')](_0x26d86e[_0x544d('0x32')],function(_0xdad9d6){return _0xdad9d6[_0x544d('0x34')]===_0x337efd;});}if(_0x385ff3>=0x0){logger[_0x544d('0x2f')](_0x544d('0x35'));}else{logger[_0x544d('0x2f')]('Using\x20the\x20admin\x20account!');_0x385ff3=_['findIndex'](_0x26d86e['users'],function(_0x2ef43b){return _0x2ef43b['profile']['name']===_0x544d('0x36');});}return _0x26d86e[_0x544d('0x32')][_0x385ff3];}else{if(_0x26d86e[_0x544d('0x37')][_0x544d('0x38')][_0x544d('0x16')]===_0x544d('0x36')){logger[_0x544d('0x2f')](_0x544d('0x39'));user=_0x26d86e['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x544d('0xc')](_0x26d86e));throw new Error(_0x544d('0x3a')+JSON[_0x544d('0xc')](_0x26d86e));}}}else{logger[_0x544d('0x2c')](_0x544d('0x3b'),JSON[_0x544d('0xc')](_0x26d86e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x544d('0xc')](_0x26d86e));}})[_0x544d('0x2b')](function(_0xab6b58){console['error'](_0xab6b58);});}function getZohoUser(_0x40fe4a,_0x375dd7){return new BPromise(function(_0x505980,_0x45e673){request(_0x40fe4a)[_0x544d('0x28')](function(_0x19f4b7){var _0x1d48de=null;if(_0x19f4b7){_0x1d48de=_0x19f4b7[_0x544d('0x3c')][0x0];_0x1d48de[_0x544d('0x3d')]=_0x375dd7;}_0x505980(_0x1d48de);})['catch'](function(_0xa7a2fe){_0x45e673(_0xa7a2fe);});});}function createEndUser(_0x111fe7,_0x553af7,_0x20349b,_0x36ad5f,_0x28c099,_0x110af9){var _0x20349b=getName(_0x20349b);return request({'method':_0x544d('0x22'),'uri':'https://www.zohoapis.'+_0x553af7+_0x544d('0x3e')+_[_0x544d('0x3f')](_0x110af9['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x20349b[0x1],'First_Name':_0x20349b[0x0],'Phone':_0x36ad5f,'Owner':{'name':!_['isNil'](_0x28c099[_0x544d('0x40')][_0x544d('0x16')])?_0x28c099[_0x544d('0x40')][_0x544d('0x16')]:!_[_0x544d('0x19')](_0x28c099[_0x544d('0x41')])?_0x28c099[_0x544d('0x41')]+'\x20'+_0x28c099[_0x544d('0x42')]:_0x28c099['last_name'],'id':_0x28c099['id']}}]},'headers':{'Authorization':_0x544d('0x31')+_0x111fe7},'json':!![]})[_0x544d('0x28')](function(_0x511d68){if(_0x511d68&&_0x511d68[_0x544d('0x3c')][0x0]['code']==='SUCCESS'){var _0x2ff182=_0x511d68[_0x544d('0x3c')][0x0][_0x544d('0x43')];_0x2ff182['enduserType']=_[_0x544d('0x3f')](_0x110af9[_0x544d('0x44')])+'s';return _0x2ff182;}logger[_0x544d('0x2c')](_0x544d('0x3b'),JSON[_0x544d('0xc')](data));throw new Error(_0x544d('0x45')+JSON['stringify'](data));})[_0x544d('0x2b')](function(_0x170fb9){console['log'](_0x544d('0x46'),_0x170fb9);});}function getEndUser(_0x3f2cac,_0x59c2f7,_0x9e24fc,_0x36f08a,_0x50130a,_0x31a59d,_0x530be9){var _0x447f62={'method':_0x544d('0x47'),'uri':'','headers':{'Authorization':_0x544d('0x31')+_0x3f2cac},'json':!![]};switch(_0x530be9['moduleSearch']){case _0x544d('0x48'):_0x447f62[_0x544d('0x49')]='https://www.zohoapis.'+_0x59c2f7+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x50130a+'))';return getZohoUser(_0x447f62,_0x544d('0x4a'))[_0x544d('0x28')](function(_0x3035b2){if(_0x3035b2)return _0x3035b2;_0x447f62['uri']=_0x544d('0x4b')+_0x59c2f7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x50130a+'))';return getZohoUser(_0x447f62,'Leads')['then'](function(_0x1a5b76){if(_0x1a5b76)return _0x1a5b76;if(_0x530be9[_0x544d('0x44')]!='nothing'){return createEndUser(_0x3f2cac,_0x59c2f7,_0x36f08a,_0x50130a,_0x31a59d,_0x530be9);}else{return{};}});});break;case'contact':_0x447f62[_0x544d('0x49')]=_0x544d('0x4b')+_0x59c2f7+_0x544d('0x4c')+_0x50130a+'))';return getZohoUser(_0x447f62,'Contacts')[_0x544d('0x28')](function(_0x5a6c31){if(_0x5a6c31)return _0x5a6c31;if(_0x530be9['moduleCreate']!=_0x544d('0x4d')){return createEndUser(_0x3f2cac,_0x59c2f7,_0x36f08a,_0x50130a,_0x31a59d,_0x530be9);}else{return{};}});break;case'lead':_0x447f62[_0x544d('0x49')]='https://www.zohoapis.'+_0x59c2f7+_0x544d('0x4e')+_0x50130a+'))';return getZohoUser(_0x447f62,'Leads')[_0x544d('0x28')](function(_0x8ecffb){if(_0x8ecffb)return _0x8ecffb;if(_0x530be9[_0x544d('0x44')]!=_0x544d('0x4d')){return createEndUser(_0x3f2cac,_0x59c2f7,_0x36f08a,_0x50130a,_0x31a59d,_0x530be9);}else{return{};}});break;}}function getCall(_0x4d7d01,_0x1086a0,_0x495967,_0x395958,_0x5dadda,_0x5ea14a,_0x16c86a,_0x1c3e71){logger['info'](_0x544d('0x4f'));var _0x580919={};_0x580919['Owner']={'name':!_[_0x544d('0x19')](_0x395958[_0x544d('0x40')][_0x544d('0x16')])&&!_[_0x544d('0x19')](_0x395958[_0x544d('0x38')]['name'])&&_0x395958[_0x544d('0x38')][_0x544d('0x16')]===_0x544d('0x50')?_0x395958[_0x544d('0x40')][_0x544d('0x16')]:!_[_0x544d('0x19')](_0x395958[_0x544d('0x41')])?_0x395958['first_name']+'\x20'+_0x395958[_0x544d('0x42')]:_0x395958[_0x544d('0x42')],'id':_0x395958['id']};_0x580919[_0x544d('0x51')]=intUtil[_0x544d('0x52')](_0x5ea14a[_0x544d('0x53')],_0x16c86a,'\x20');_0x580919[_0x544d('0x54')]=intUtil[_0x544d('0x52')](_0x5ea14a[_0x544d('0x55')],_0x16c86a,'\x0a');if(_0x5dadda['enduserType']===_0x544d('0x4a')){_0x580919[_0x544d('0x56')]={'name':!_[_0x544d('0x19')](_0x5dadda[_0x544d('0x57')])?_0x5dadda['Full_Name']:!_[_0x544d('0x19')](_0x5dadda[_0x544d('0x58')])?_0x5dadda[_0x544d('0x58')]+'\x20'+_0x5dadda[_0x544d('0x59')]:_0x5dadda[_0x544d('0x59')],'id':_0x5dadda['id']};}if(_0x5dadda[_0x544d('0x3d')]===_0x544d('0x5a')){_0x580919[_0x544d('0x5b')]={'name':!_[_0x544d('0x19')](_0x5dadda[_0x544d('0x57')])?_0x5dadda[_0x544d('0x57')]:!_['isNil'](_0x5dadda['First_Name'])?_0x5dadda[_0x544d('0x58')]+'\x20'+_0x5dadda[_0x544d('0x59')]:_0x5dadda[_0x544d('0x59')],'id':_0x5dadda['id']};_0x580919[_0x544d('0x5c')]=_[_0x544d('0x3f')](_0x5dadda[_0x544d('0x3d')]);}if(_0x16c86a[_0x544d('0x5d')]){_0x580919[_0x544d('0x5e')]=moment[_0x544d('0x5f')](parseInt(_0x16c86a[_0x544d('0x5d')])*0x3e8)[_0x544d('0x60')]('mm:ss');}else if(_0x16c86a[_0x544d('0x61')]&&_0x16c86a[_0x544d('0x62')]){_0x580919[_0x544d('0x5e')]=moment['utc'](moment(_0x16c86a[_0x544d('0x62')],_0x544d('0x63'))[_0x544d('0x64')](moment(_0x16c86a[_0x544d('0x65')],_0x544d('0x63'))))[_0x544d('0x60')](_0x544d('0x66'));}switch(_0x16c86a[_0x544d('0x67')]){case _0x544d('0x68'):_0x580919[_0x544d('0x69')]=_0x544d('0x6a');break;case _0x544d('0x6b'):case _0x544d('0x6c'):_0x580919['Call_Result']=_0x544d('0x6d');break;case _0x544d('0x6e'):_0x580919[_0x544d('0x69')]=_0x544d('0x6f');break;case _0x544d('0x70'):_0x580919[_0x544d('0x69')]=_0x544d('0x71');break;case'timeout':_0x580919[_0x544d('0x69')]=_0x544d('0x72');default:}_0x580919['Call_Start_Time']=(_0x1c3e71===_0x544d('0x73')?moment(_0x16c86a[_0x544d('0x65')])['format'](_0x544d('0x63')):moment(_0x16c86a[_0x544d('0x74')])['format'](_0x544d('0x63')))||moment()[_0x544d('0x60')](_0x544d('0x63'));_0x580919[_0x544d('0x75')]=_0x1c3e71||_0x544d('0x76');_0x580919=_[_0x544d('0x77')](_0x580919,getCustomFields(_0x5ea14a[_0x544d('0x78')],_0x16c86a));return request({'method':_0x544d('0x22'),'uri':'https://www.zohoapis.'+_0x1086a0+'/crm/v2/Calls','headers':{'Authorization':_0x544d('0x31')+_0x4d7d01},'body':{'data':[_0x580919]},'json':!![]})[_0x544d('0x28')](function(_0x3c4420){if(_0x3c4420&&_0x3c4420['data'][0x0][_0x544d('0x79')]==='SUCCESS'){logger[_0x544d('0x2f')](_0x544d('0x7a'));return{'id':_0x3c4420[_0x544d('0x3c')][0x0]['details']['id']};}})[_0x544d('0x2b')](function(_0x820c7){logger['info'](_0x544d('0x7b'),_0x820c7[_0x544d('0x2e')]);console[_0x544d('0x7c')](_0x544d('0x7b'),_0x820c7);});}exports['queue']=function(_0x35d741,_0x2242ee,_0x313a9e,_0x42b71a,_0x7bf781,_0x348047){var _0x5b567a,_0x111090,_0x1e45b2;_0x348047[_0x544d('0x7d')]=intUtil[_0x544d('0x7e')](_0x348047['host']);_0x348047['serverUrl']=intUtil[_0x544d('0x7e')](_0x348047[_0x544d('0x7f')]);if(_0x7bf781&&_0x7bf781[_0x544d('0x80')]){logger[_0x544d('0x2f')](_0x544d('0x81'),'Recording\x20is\x20enabled!');_0x2242ee[_0x544d('0x82')]=_0x348047[_0x544d('0x7f')]+_0x544d('0x83')+_0x2242ee[_0x544d('0x84')]+_0x544d('0x85')+md5(_0x2242ee['uniqueid']);}else{_0x2242ee[_0x544d('0x82')]='';}var _0x57b545=_0x348047['host']==='zoho.eu'?'eu':_0x544d('0x86');return getAccessToken(_0x348047)['then'](function(_0x2ffc8f){_0x1e45b2=_0x2ffc8f;return getUser(_0x1e45b2,_0x57b545,_0x348047,_0x42b71a[_0x544d('0x34')]);})[_0x544d('0x28')](function(_0x13e46e){_0x5b567a=_0x13e46e;logger[_0x544d('0x2f')]('The\x20User\x20ID\x20is:',_0x5b567a['id']);return getEndUser(_0x1e45b2,_0x57b545,_0x348047,_0x2242ee[_0x544d('0x87')],_0x2242ee[_0x544d('0x88')],_0x5b567a,_0x313a9e);})[_0x544d('0x28')](function(_0x372920){_0x111090=_0x372920;return getCall(_0x1e45b2,_0x57b545,_0x348047,_0x5b567a,_0x111090,_0x313a9e,_0x2242ee,'Inbound');})[_0x544d('0x28')](function(_0x10a9a2){if(_0x10a9a2){logger[_0x544d('0x2f')](_0x544d('0x89'),_0x10a9a2['id']);logger[_0x544d('0x2f')]('[QUEUE]',_0x544d('0x8a'));emit(util[_0x544d('0x60')]('user:%s',_0x42b71a[_0x544d('0x16')]),_0x544d('0x8b'),{'uri':'https://crm.'+_0x348047['host']+_0x544d('0x8c')+_0x10a9a2['id']});}})[_0x544d('0x2b')](function(_0x4d7ac9){logger[_0x544d('0x2c')](_0x544d('0x81'),JSON[_0x544d('0xc')](_0x4d7ac9));});};exports[_0x544d('0x73')]=function(_0x24c5a6,_0x5634dc,_0x461483,_0x1b5801,_0x353ddf,_0x195dee,_0x43d5e0){var _0x1fc3ee,_0x212bc1,_0x195f83;_0x195dee['host']=intUtil[_0x544d('0x7e')](_0x195dee[_0x544d('0x7d')]);_0x195dee[_0x544d('0x7f')]=intUtil['stripTrailingSlash'](_0x195dee[_0x544d('0x7f')]);if(_0x43d5e0&&_0x43d5e0[_0x544d('0x8d')]&&_0x43d5e0[_0x544d('0x8d')]!==_0x544d('0x8e')){logger[_0x544d('0x2f')](_0x544d('0x8f'),_0x544d('0x90'));_0x5634dc[_0x544d('0x82')]=_0x195dee[_0x544d('0x7f')]+'/api/voice/recordings/'+_0x5634dc['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5634dc['uniqueid']);}var _0x7afc46=_0x195dee[_0x544d('0x7d')]==='zoho.eu'?'eu':_0x544d('0x86');return getAccessToken(_0x195dee)[_0x544d('0x28')](function(_0x25d279){_0x195f83=_0x25d279;return getUser(_0x195f83,_0x7afc46,_0x195dee,_0x1b5801['email']);})[_0x544d('0x28')](function(_0x5dda4e){_0x1fc3ee=_0x5dda4e;logger[_0x544d('0x2f')](_0x544d('0x91'),_0x1fc3ee['id']);return getEndUser(_0x195f83,_0x7afc46,_0x195dee,_0x5634dc[_0x544d('0x92')],_0x5634dc['destcalleridnum'],_0x1fc3ee,_0x461483);})[_0x544d('0x28')](function(_0x5194f5){_0x212bc1=_0x5194f5;return getCall(_0x195f83,_0x7afc46,_0x195dee,_0x1fc3ee,_0x212bc1,_0x461483,_0x5634dc,_0x544d('0x93'));})[_0x544d('0x28')](function(_0x43e951){if(_0x43e951){logger[_0x544d('0x2f')]('The\x20Call\x20ID\x20is:',_0x43e951['id']);logger['info'](_0x544d('0x8f'),_0x544d('0x8a'));emit(util[_0x544d('0x60')](_0x544d('0x94'),_0x1b5801[_0x544d('0x16')]),_0x544d('0x8b'),{'uri':'https://crm.'+_0x195dee[_0x544d('0x7d')]+_0x544d('0x8c')+_0x43e951['id']});}})[_0x544d('0x2b')](function(_0x1a8687){logger[_0x544d('0x2c')](_0x544d('0x8f'),JSON[_0x544d('0xc')](_0x1a8687));});};exports['unmanaged']=function(_0x3b2a83,_0x12636d,_0x21c5e6,_0xd157e1,_0x2aa8b2,_0x10ab67){var _0xe884bc,_0x34f506,_0x3ee780;_0x10ab67[_0x544d('0x7d')]=intUtil[_0x544d('0x7e')](_0x10ab67[_0x544d('0x7d')]);_0x10ab67[_0x544d('0x7f')]=intUtil['stripTrailingSlash'](_0x10ab67['serverUrl']);if(_0x2aa8b2&&_0x2aa8b2[_0x544d('0x80')]){logger['info']('['+_0x12636d[_0x544d('0x67')][_0x544d('0x95')]()+']','Recording\x20is\x20enabled!');_0x12636d[_0x544d('0x82')]=_0x10ab67[_0x544d('0x7f')]+_0x544d('0x83')+_0x12636d[_0x544d('0x84')]+_0x544d('0x85')+md5(_0x12636d['uniqueid']);}else{_0x12636d[_0x544d('0x82')]='';}var _0x1fefa1=_0x10ab67[_0x544d('0x7d')]===_0x544d('0x96')?'eu':_0x544d('0x86');return getAccessToken(_0x10ab67)['then'](function(_0x65c4f8){_0x3ee780=_0x65c4f8;return getUser(_0x3ee780,_0x1fefa1,_0x10ab67);})['then'](function(_0x5134a0){_0xe884bc=_0x5134a0;logger['info'](_0x544d('0x91'),_0xe884bc['id']);return getEndUser(_0x3ee780,_0x1fefa1,_0x10ab67,_0x12636d[_0x544d('0x87')],_0x12636d[_0x544d('0x88')],_0xe884bc,_0x21c5e6);})[_0x544d('0x28')](function(_0x1a3281){_0x34f506=_0x1a3281;return getCall(_0x3ee780,_0x1fefa1,_0x10ab67,_0xe884bc,_0x34f506,_0x21c5e6,_0x12636d,'Inbound');})[_0x544d('0x28')](function(_0x23ef17){if(_0x23ef17){logger['info']('The\x20Call\x20ID\x20is:',_0x23ef17['id']);}})['catch'](function(_0x4089b7){logger[_0x544d('0x2c')]('['+_0x12636d[_0x544d('0x67')][_0x544d('0x95')]()+']',JSON[_0x544d('0xc')](_0x4089b7));});}; \ No newline at end of file +var _0xeb93=['first_name','last_name','Zoho-oauthtoken\x20','code','details','log','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','profile','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','YYYY-MM-DDTHH:mm:ss','agentcalledAt','merge','Fields','Call\x20created!','err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','calleridnum','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user','The\x20failing\x20result\x20is','stringify','catch','data','enduserType','POST','/crm/v2/','startCase','moduleCreate','role'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xeb93,0x195));var _0x3eb9=function(_0x2ad19a,_0xb1e06a){_0x2ad19a=_0x2ad19a-0x0;var _0x4e4e65=_0xeb93[_0x2ad19a];return _0x4e4e65;};'use strict';var _=require('lodash');var rp=require(_0x3eb9('0x0'));var md5=require(_0x3eb9('0x1'));var util=require('util');var intUtil=require(_0x3eb9('0x2'));var moment=require(_0x3eb9('0x3'));var Redis=require(_0x3eb9('0x4'));var BPromise=require(_0x3eb9('0x5'));var config=require(_0x3eb9('0x6'));var logger=require(_0x3eb9('0x7'))(_0x3eb9('0x8'));config['redis']=_['defaults'](config[_0x3eb9('0x9')],{'host':_0x3eb9('0xa'),'port':0x18eb});var io=require(_0x3eb9('0xb'))(new Redis(config[_0x3eb9('0x9')]));function emit(_0x40e5b6,_0x51c19f,_0x3ea9e9){io['to'](_0x40e5b6)[_0x3eb9('0xc')](_0x51c19f,_0x3ea9e9);}function request(_0x1767d4){logger[_0x3eb9('0xd')](_0x3eb9('0xe'),JSON['stringify'](_0x1767d4));return rp(_0x1767d4);}function getCustomFields(_0x51276c,_0x72623){var _0x50c60b={};if(_0x51276c[_0x3eb9('0xf')]>0x0){_[_0x3eb9('0x10')](_0x51276c,function(_0x1e558f){if(_[_0x3eb9('0x11')]([_0x3eb9('0x12'),_0x3eb9('0x13')],_0x1e558f[_0x3eb9('0x14')])&&_0x1e558f[_0x3eb9('0x15')]){_0x50c60b[_0x1e558f[_0x3eb9('0x15')]]=_0x1e558f[_0x3eb9('0x16')][_0x3eb9('0x17')]();}else if(_0x1e558f[_0x3eb9('0x14')]===_0x3eb9('0x18')&&_0x1e558f[_0x3eb9('0x19')]&&_0x1e558f['idField']&&_0x72623[_0x1e558f[_0x3eb9('0x19')]]){_0x50c60b[_0x1e558f[_0x3eb9('0x15')]]=_0x72623[_0x1e558f['variableName']][_0x3eb9('0x17')]();}else if(_0x1e558f['type']===_0x3eb9('0x1a')&&_0x1e558f[_0x3eb9('0x1b')]&&_0x1e558f[_0x3eb9('0x1b')][_0x3eb9('0x1c')]&&_0x1e558f['idField']&&_0x72623[_0x1e558f[_0x3eb9('0x1b')][_0x3eb9('0x1c')][_0x3eb9('0x1d')]()]){_0x50c60b[_0x1e558f[_0x3eb9('0x15')]]=_0x72623[_0x1e558f['Variable'][_0x3eb9('0x1c')][_0x3eb9('0x1d')]()][_0x3eb9('0x17')]();}});}return _0x50c60b;}function getName(_0x42417f){if(_0x42417f[_0x3eb9('0x1e')]('\x20')>0x0){var _0x3e8410=_0x42417f[_0x3eb9('0x1f')](/ (.+)/);if(_0x3e8410[0x1]){return _0x3e8410;}}return[_0x42417f,_0x42417f];}var accountsTokens={};function getAccessToken(_0x2f939c){return new Promise(function(_0x544ea5,_0x5a072c){if(!_[_0x3eb9('0x20')](accountsTokens[_0x2f939c['id']])&&!_[_0x3eb9('0x20')](accountsTokens[_0x2f939c['id']][_0x3eb9('0x21')])){if(moment()[_0x3eb9('0x22')](accountsTokens[_0x2f939c['id']]['expires_in'])){_0x544ea5(accountsTokens[_0x2f939c['id']]['access_token']);}}var _0x4a9604;switch(_0x2f939c[_0x3eb9('0x23')]){case'US':_0x4a9604='https://accounts.zoho.com';break;case'AU':_0x4a9604=_0x3eb9('0x24');break;case'EU':_0x4a9604=_0x3eb9('0x25');break;case'IN':_0x4a9604='https://accounts.zoho.in';break;case'CN':_0x4a9604=_0x3eb9('0x26');break;default:_0x4a9604=_0x3eb9('0x25');break;}var _0x5c9864={'method':'POST','uri':_0x4a9604+_0x3eb9('0x27'),'qs':{'refresh_token':_0x2f939c['refreshToken'],'client_id':_0x2f939c[_0x3eb9('0x28')],'client_secret':_0x2f939c[_0x3eb9('0x29')],'grant_type':_0x3eb9('0x2a')},'json':!![]};return rp(_0x5c9864)[_0x3eb9('0x2b')](function(_0x3dfb87){accountsTokens[_0x2f939c['id']]={'access_token':_0x3dfb87[_0x3eb9('0x21')],'expires_in':moment()[_0x3eb9('0x2c')](_0x3dfb87[_0x3eb9('0x2d')],_0x3eb9('0x2e'))};_0x544ea5(_0x3dfb87[_0x3eb9('0x21')]);})['catch'](function(_0x5d138f){logger[_0x3eb9('0x2f')](_0x3eb9('0x30'),_0x5d138f['stack']);_0x5a072c(_0x5d138f);});});}function getUser(_0x99a2c9,_0x4db489,_0x32e786,_0x4d5d69){logger[_0x3eb9('0x31')]('Search\x20user');return request({'method':_0x3eb9('0x32'),'uri':util[_0x3eb9('0x33')](_0x3eb9('0x34'),_0x4db489),'qs':{'type':_0x3eb9('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x99a2c9},'json':!![]})[_0x3eb9('0x2b')](function(_0x462baf){if(_0x462baf['users']){var _0x6e16cd=-0x1;if(_[_0x3eb9('0x36')](_0x462baf[_0x3eb9('0x37')])){if(!_[_0x3eb9('0x20')](_0x4d5d69)){_0x6e16cd=_['findIndex'](_0x462baf[_0x3eb9('0x37')],function(_0x2d2123){return _0x2d2123[_0x3eb9('0x38')]===_0x4d5d69;});}if(_0x6e16cd>=0x0){logger[_0x3eb9('0x31')](_0x3eb9('0x39'));}else{logger[_0x3eb9('0x31')](_0x3eb9('0x3a'));_0x6e16cd=_[_0x3eb9('0x3b')](_0x462baf['users'],function(_0x299dff){return _0x299dff['profile'][_0x3eb9('0x1c')]===_0x3eb9('0x3c');});}return _0x462baf[_0x3eb9('0x37')][_0x6e16cd];}else{if(_0x462baf[_0x3eb9('0x3d')]['profile']['name']===_0x3eb9('0x3c')){logger[_0x3eb9('0x31')]('Using\x20the\x20admin\x20account!');user=_0x462baf[_0x3eb9('0x3d')];return user;}else{logger['error'](_0x3eb9('0x3e'),JSON[_0x3eb9('0x3f')](_0x462baf));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3eb9('0x3f')](_0x462baf));}}}else{logger[_0x3eb9('0x2f')](_0x3eb9('0x3e'),JSON[_0x3eb9('0x3f')](_0x462baf));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3eb9('0x3f')](_0x462baf));}})[_0x3eb9('0x40')](function(_0x422850){console[_0x3eb9('0x2f')](_0x422850);});}function getZohoUser(_0x4ae42b,_0x1949ed){return new BPromise(function(_0x157459,_0x488d8c){request(_0x4ae42b)[_0x3eb9('0x2b')](function(_0x232aa4){var _0x4daa9d=null;if(_0x232aa4){_0x4daa9d=_0x232aa4[_0x3eb9('0x41')][0x0];_0x4daa9d[_0x3eb9('0x42')]=_0x1949ed;}_0x157459(_0x4daa9d);})[_0x3eb9('0x40')](function(_0x4a64bc){_0x488d8c(_0x4a64bc);});});}function createEndUser(_0xb86aa,_0x4e7777,_0x3831ef,_0x29907a,_0x336ffe,_0x4d3268){var _0x3831ef=getName(_0x3831ef);return request({'method':_0x3eb9('0x43'),'uri':'https://www.zohoapis.'+_0x4e7777+_0x3eb9('0x44')+_[_0x3eb9('0x45')](_0x4d3268[_0x3eb9('0x46')])+'s','body':{'data':[{'Last_Name':_0x3831ef[0x1],'First_Name':_0x3831ef[0x0],'Phone':_0x29907a,'Owner':{'name':!_[_0x3eb9('0x20')](_0x336ffe['role'][_0x3eb9('0x1c')])?_0x336ffe[_0x3eb9('0x47')][_0x3eb9('0x1c')]:!_[_0x3eb9('0x20')](_0x336ffe[_0x3eb9('0x48')])?_0x336ffe[_0x3eb9('0x48')]+'\x20'+_0x336ffe[_0x3eb9('0x49')]:_0x336ffe[_0x3eb9('0x49')],'id':_0x336ffe['id']}}]},'headers':{'Authorization':_0x3eb9('0x4a')+_0xb86aa},'json':!![]})[_0x3eb9('0x2b')](function(_0x210e51){if(_0x210e51&&_0x210e51[_0x3eb9('0x41')][0x0][_0x3eb9('0x4b')]==='SUCCESS'){var _0x55881a=_0x210e51[_0x3eb9('0x41')][0x0][_0x3eb9('0x4c')];_0x55881a[_0x3eb9('0x42')]=_[_0x3eb9('0x45')](_0x4d3268[_0x3eb9('0x46')])+'s';return _0x55881a;}logger[_0x3eb9('0x2f')](_0x3eb9('0x3e'),JSON[_0x3eb9('0x3f')](data));throw new Error('Error:\x20'+JSON[_0x3eb9('0x3f')](data));})[_0x3eb9('0x40')](function(_0x33791d){console[_0x3eb9('0x4d')]('CREATE\x20ERROR',_0x33791d);});}function getEndUser(_0x3cea5d,_0x135924,_0x1f5a13,_0x95ccab,_0xaf3bc1,_0x42b692,_0x3b64fd){var _0x46fa24={'method':'GET','uri':'','headers':{'Authorization':_0x3eb9('0x4a')+_0x3cea5d},'json':!![]};switch(_0x3b64fd[_0x3eb9('0x4e')]){case _0x3eb9('0x4f'):_0x46fa24[_0x3eb9('0x50')]=_0x3eb9('0x51')+_0x135924+_0x3eb9('0x52')+_0xaf3bc1+'))';return getZohoUser(_0x46fa24,_0x3eb9('0x53'))['then'](function(_0x5403eb){if(_0x5403eb)return _0x5403eb;_0x46fa24[_0x3eb9('0x50')]='https://www.zohoapis.'+_0x135924+_0x3eb9('0x54')+_0xaf3bc1+'))';return getZohoUser(_0x46fa24,_0x3eb9('0x55'))['then'](function(_0x26143f){if(_0x26143f)return _0x26143f;if(_0x3b64fd[_0x3eb9('0x46')]!=_0x3eb9('0x56')){return createEndUser(_0x3cea5d,_0x135924,_0x95ccab,_0xaf3bc1,_0x42b692,_0x3b64fd);}else{return{};}});});break;case _0x3eb9('0x57'):_0x46fa24[_0x3eb9('0x50')]=_0x3eb9('0x51')+_0x135924+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xaf3bc1+'))';return getZohoUser(_0x46fa24,_0x3eb9('0x53'))[_0x3eb9('0x2b')](function(_0x2f4fa0){if(_0x2f4fa0)return _0x2f4fa0;if(_0x3b64fd[_0x3eb9('0x46')]!=_0x3eb9('0x56')){return createEndUser(_0x3cea5d,_0x135924,_0x95ccab,_0xaf3bc1,_0x42b692,_0x3b64fd);}else{return{};}});break;case _0x3eb9('0x58'):_0x46fa24[_0x3eb9('0x50')]='https://www.zohoapis.'+_0x135924+_0x3eb9('0x54')+_0xaf3bc1+'))';return getZohoUser(_0x46fa24,'Leads')[_0x3eb9('0x2b')](function(_0x1b4062){if(_0x1b4062)return _0x1b4062;if(_0x3b64fd['moduleCreate']!=_0x3eb9('0x56')){return createEndUser(_0x3cea5d,_0x135924,_0x95ccab,_0xaf3bc1,_0x42b692,_0x3b64fd);}else{return{};}});break;}}function getCall(_0x251358,_0x2b0379,_0x3d4814,_0x5a3bb9,_0x405317,_0x3b4045,_0x5eff35,_0x3f989f){logger[_0x3eb9('0x31')](_0x3eb9('0x59'));var _0x53be91={};_0x53be91['Owner']={'name':!_[_0x3eb9('0x20')](_0x5a3bb9[_0x3eb9('0x47')]['name'])&&!_[_0x3eb9('0x20')](_0x5a3bb9[_0x3eb9('0x5a')]['name'])&&_0x5a3bb9[_0x3eb9('0x5a')][_0x3eb9('0x1c')]===_0x3eb9('0x5b')?_0x5a3bb9[_0x3eb9('0x47')][_0x3eb9('0x1c')]:!_[_0x3eb9('0x20')](_0x5a3bb9['first_name'])?_0x5a3bb9[_0x3eb9('0x48')]+'\x20'+_0x5a3bb9[_0x3eb9('0x49')]:_0x5a3bb9[_0x3eb9('0x49')],'id':_0x5a3bb9['id']};_0x53be91[_0x3eb9('0x5c')]=intUtil[_0x3eb9('0x5d')](_0x3b4045['Subjects'],_0x5eff35,'\x20');_0x53be91[_0x3eb9('0x5e')]=intUtil['getString'](_0x3b4045[_0x3eb9('0x5f')],_0x5eff35,'\x0a');if(_0x405317[_0x3eb9('0x42')]===_0x3eb9('0x53')){_0x53be91[_0x3eb9('0x60')]={'name':!_[_0x3eb9('0x20')](_0x405317[_0x3eb9('0x61')])?_0x405317[_0x3eb9('0x61')]:!_[_0x3eb9('0x20')](_0x405317[_0x3eb9('0x62')])?_0x405317[_0x3eb9('0x62')]+'\x20'+_0x405317[_0x3eb9('0x63')]:_0x405317[_0x3eb9('0x63')],'id':_0x405317['id']};}if(_0x405317[_0x3eb9('0x42')]===_0x3eb9('0x55')){_0x53be91['What_Id']={'name':!_[_0x3eb9('0x20')](_0x405317['Full_Name'])?_0x405317[_0x3eb9('0x61')]:!_[_0x3eb9('0x20')](_0x405317['First_Name'])?_0x405317[_0x3eb9('0x62')]+'\x20'+_0x405317[_0x3eb9('0x63')]:_0x405317[_0x3eb9('0x63')],'id':_0x405317['id']};_0x53be91[_0x3eb9('0x64')]=_[_0x3eb9('0x45')](_0x405317['enduserType']);}if(_0x5eff35['talktime']){_0x53be91[_0x3eb9('0x65')]=moment[_0x3eb9('0x66')](parseInt(_0x5eff35[_0x3eb9('0x67')])*0x3e8)['format'](_0x3eb9('0x68'));}else if(_0x5eff35['answertime']&&_0x5eff35[_0x3eb9('0x69')]){_0x53be91[_0x3eb9('0x65')]=moment[_0x3eb9('0x66')](moment(_0x5eff35[_0x3eb9('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x3eb9('0x6a')](moment(_0x5eff35[_0x3eb9('0x6b')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x5eff35[_0x3eb9('0x6c')]){case'called':_0x53be91[_0x3eb9('0x6d')]=_0x3eb9('0x6e');break;case _0x3eb9('0x6f'):case _0x3eb9('0x70'):_0x53be91[_0x3eb9('0x6d')]=_0x3eb9('0x71');break;case _0x3eb9('0x72'):_0x53be91['Call_Result']=_0x3eb9('0x73');break;case _0x3eb9('0x74'):_0x53be91[_0x3eb9('0x6d')]=_0x3eb9('0x75');break;case _0x3eb9('0x76'):_0x53be91[_0x3eb9('0x6d')]=_0x3eb9('0x77');default:}_0x53be91[_0x3eb9('0x78')]=(_0x3f989f==='outbound'?moment(_0x5eff35['starttime'])[_0x3eb9('0x33')](_0x3eb9('0x79')):moment(_0x5eff35[_0x3eb9('0x7a')])[_0x3eb9('0x33')](_0x3eb9('0x79')))||moment()[_0x3eb9('0x33')](_0x3eb9('0x79'));_0x53be91['Call_Type']=_0x3f989f||'Inbound';_0x53be91=_[_0x3eb9('0x7b')](_0x53be91,getCustomFields(_0x3b4045[_0x3eb9('0x7c')],_0x5eff35));return request({'method':_0x3eb9('0x43'),'uri':_0x3eb9('0x51')+_0x2b0379+'/crm/v2/Calls','headers':{'Authorization':_0x3eb9('0x4a')+_0x251358},'body':{'data':[_0x53be91]},'json':!![]})[_0x3eb9('0x2b')](function(_0x1641a9){if(_0x1641a9&&_0x1641a9[_0x3eb9('0x41')][0x0]['code']==='SUCCESS'){logger[_0x3eb9('0x31')](_0x3eb9('0x7d'));return{'id':_0x1641a9[_0x3eb9('0x41')][0x0][_0x3eb9('0x4c')]['id']};}})['catch'](function(_0x5b9af8){logger[_0x3eb9('0x31')](_0x3eb9('0x7e'),_0x5b9af8[_0x3eb9('0x7f')]);console[_0x3eb9('0x4d')]('err',_0x5b9af8);});}exports[_0x3eb9('0x80')]=function(_0x5a6284,_0x4feef6,_0x4ac305,_0xa6e37e,_0x2e133d,_0x1f419a){var _0x5ab600,_0x578aff,_0x4f2b5e;_0x1f419a[_0x3eb9('0x81')]=intUtil['stripTrailingSlash'](_0x1f419a[_0x3eb9('0x81')]);_0x1f419a[_0x3eb9('0x82')]=intUtil[_0x3eb9('0x83')](_0x1f419a[_0x3eb9('0x82')]);if(_0x2e133d&&_0x2e133d[_0x3eb9('0x84')]){logger[_0x3eb9('0x31')](_0x3eb9('0x85'),_0x3eb9('0x86'));_0x4feef6[_0x3eb9('0x87')]=_0x1f419a[_0x3eb9('0x82')]+_0x3eb9('0x88')+_0x4feef6[_0x3eb9('0x89')]+_0x3eb9('0x8a')+md5(_0x4feef6[_0x3eb9('0x89')]);}else{_0x4feef6[_0x3eb9('0x87')]='';}var _0x290d7f=_0x1f419a[_0x3eb9('0x81')]===_0x3eb9('0x8b')?'eu':_0x3eb9('0x8c');return getAccessToken(_0x1f419a)[_0x3eb9('0x2b')](function(_0x28917e){_0x4f2b5e=_0x28917e;return getUser(_0x4f2b5e,_0x290d7f,_0x1f419a,_0xa6e37e[_0x3eb9('0x38')]);})[_0x3eb9('0x2b')](function(_0x13fa37){_0x5ab600=_0x13fa37;logger[_0x3eb9('0x31')](_0x3eb9('0x8d'),_0x5ab600['id']);return getEndUser(_0x4f2b5e,_0x290d7f,_0x1f419a,_0x4feef6[_0x3eb9('0x8e')],_0x4feef6['calleridnum'],_0x5ab600,_0x4ac305);})[_0x3eb9('0x2b')](function(_0x198ec8){_0x578aff=_0x198ec8;return getCall(_0x4f2b5e,_0x290d7f,_0x1f419a,_0x5ab600,_0x578aff,_0x4ac305,_0x4feef6,_0x3eb9('0x8f'));})[_0x3eb9('0x2b')](function(_0x8a2a4c){if(_0x8a2a4c){logger['info'](_0x3eb9('0x90'),_0x8a2a4c['id']);logger[_0x3eb9('0x31')](_0x3eb9('0x85'),_0x3eb9('0x91'));emit(util[_0x3eb9('0x33')](_0x3eb9('0x92'),_0xa6e37e[_0x3eb9('0x1c')]),'trigger:browser:url',{'uri':_0x3eb9('0x93')+_0x1f419a['host']+_0x3eb9('0x94')+_0x8a2a4c['id']});}})[_0x3eb9('0x40')](function(_0x2dc79a){logger['error'](_0x3eb9('0x85'),JSON[_0x3eb9('0x3f')](_0x2dc79a));});};exports[_0x3eb9('0x95')]=function(_0x37f40a,_0x2e1f86,_0x105eb2,_0x46bc03,_0x12fd3b,_0xf15210,_0x11221f){var _0x1903ee,_0x2cc4df,_0x476c0f;_0xf15210['host']=intUtil[_0x3eb9('0x83')](_0xf15210[_0x3eb9('0x81')]);_0xf15210['serverUrl']=intUtil['stripTrailingSlash'](_0xf15210[_0x3eb9('0x82')]);if(_0x11221f&&_0x11221f[_0x3eb9('0x96')]&&_0x11221f[_0x3eb9('0x96')]!==_0x3eb9('0x97')){logger[_0x3eb9('0x31')](_0x3eb9('0x98'),_0x3eb9('0x86'));_0x2e1f86[_0x3eb9('0x87')]=_0xf15210[_0x3eb9('0x82')]+'/api/voice/recordings/'+_0x2e1f86[_0x3eb9('0x89')]+_0x3eb9('0x8a')+md5(_0x2e1f86[_0x3eb9('0x89')]);}var _0x2e109e=_0xf15210[_0x3eb9('0x81')]==='zoho.eu'?'eu':_0x3eb9('0x8c');return getAccessToken(_0xf15210)['then'](function(_0x432bac){_0x476c0f=_0x432bac;return getUser(_0x476c0f,_0x2e109e,_0xf15210,_0x46bc03[_0x3eb9('0x38')]);})[_0x3eb9('0x2b')](function(_0x128a02){_0x1903ee=_0x128a02;logger[_0x3eb9('0x31')](_0x3eb9('0x8d'),_0x1903ee['id']);return getEndUser(_0x476c0f,_0x2e109e,_0xf15210,_0x2e1f86['destcalleridname'],_0x2e1f86[_0x3eb9('0x99')],_0x1903ee,_0x105eb2);})[_0x3eb9('0x2b')](function(_0x3cd033){_0x2cc4df=_0x3cd033;return getCall(_0x476c0f,_0x2e109e,_0xf15210,_0x1903ee,_0x2cc4df,_0x105eb2,_0x2e1f86,_0x3eb9('0x9a'));})[_0x3eb9('0x2b')](function(_0x2014fa){if(_0x2014fa){logger[_0x3eb9('0x31')](_0x3eb9('0x90'),_0x2014fa['id']);logger[_0x3eb9('0x31')](_0x3eb9('0x98'),_0x3eb9('0x91'));emit(util[_0x3eb9('0x33')](_0x3eb9('0x92'),_0x46bc03['name']),_0x3eb9('0x9b'),{'uri':_0x3eb9('0x93')+_0xf15210[_0x3eb9('0x81')]+_0x3eb9('0x94')+_0x2014fa['id']});}})[_0x3eb9('0x40')](function(_0xbaf644){logger[_0x3eb9('0x2f')](_0x3eb9('0x98'),JSON[_0x3eb9('0x3f')](_0xbaf644));});};exports[_0x3eb9('0x9c')]=function(_0x56f066,_0x18207,_0x49dec9,_0x42cf14,_0xa3dd13,_0x57150a){var _0xb58c5f,_0x1c99cd,_0x5be380;_0x57150a[_0x3eb9('0x81')]=intUtil[_0x3eb9('0x83')](_0x57150a[_0x3eb9('0x81')]);_0x57150a['serverUrl']=intUtil[_0x3eb9('0x83')](_0x57150a[_0x3eb9('0x82')]);if(_0xa3dd13&&_0xa3dd13['monitor_format']){logger[_0x3eb9('0x31')]('['+_0x18207[_0x3eb9('0x6c')][_0x3eb9('0x9d')]()+']',_0x3eb9('0x86'));_0x18207['recordingURL']=_0x57150a[_0x3eb9('0x82')]+_0x3eb9('0x88')+_0x18207[_0x3eb9('0x89')]+_0x3eb9('0x8a')+md5(_0x18207[_0x3eb9('0x89')]);}else{_0x18207[_0x3eb9('0x87')]='';}var _0x10039a=_0x57150a[_0x3eb9('0x81')]===_0x3eb9('0x8b')?'eu':'com';return getAccessToken(_0x57150a)[_0x3eb9('0x2b')](function(_0x485f15){_0x5be380=_0x485f15;return getUser(_0x5be380,_0x10039a,_0x57150a);})[_0x3eb9('0x2b')](function(_0x1cdc17){_0xb58c5f=_0x1cdc17;logger[_0x3eb9('0x31')](_0x3eb9('0x8d'),_0xb58c5f['id']);return getEndUser(_0x5be380,_0x10039a,_0x57150a,_0x18207[_0x3eb9('0x8e')],_0x18207[_0x3eb9('0x9e')],_0xb58c5f,_0x49dec9);})['then'](function(_0x188692){_0x1c99cd=_0x188692;return getCall(_0x5be380,_0x10039a,_0x57150a,_0xb58c5f,_0x1c99cd,_0x49dec9,_0x18207,_0x3eb9('0x8f'));})[_0x3eb9('0x2b')](function(_0x5c36c0){if(_0x5c36c0){logger[_0x3eb9('0x31')](_0x3eb9('0x90'),_0x5c36c0['id']);}})[_0x3eb9('0x40')](function(_0x43d717){logger['error']('['+_0x18207[_0x3eb9('0x6c')][_0x3eb9('0x9d')]()+']',JSON[_0x3eb9('0x3f')](_0x43d717));});}; \ 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 e320f47..c7d01ed 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 _0x066f=['data2','Script','data3','render','error','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','shelljs','mustache','trigger','exec'];(function(_0x52d842,_0x4134f2){var _0xcfb104=function(_0x30638c){while(--_0x30638c){_0x52d842['push'](_0x52d842['shift']());}};_0xcfb104(++_0x4134f2);}(_0x066f,0x1ad));var _0xf066=function(_0x552ce3,_0x273aea){_0x552ce3=_0x552ce3-0x0;var _0x1cb111=_0x066f[_0x552ce3];return _0x1cb111;};'use strict';var util=require(_0xf066('0x0'));var sh=require(_0xf066('0x1'));var Mustache=require(_0xf066('0x2'));var logger=require('../../../../config/logger')(_0xf066('0x3'));exports[_0xf066('0x4')]=function(_0x659cc2,_0x17bb6c){var _0x25fff0=_0x659cc2['data2']?_0x659cc2[_0xf066('0x5')]:_0xf066('0x6');var _0xa245d4=_0x659cc2[_0xf066('0x7')]?Mustache[_0xf066('0x8')](_0x659cc2[_0xf066('0x7')],_0x17bb6c):_0x17bb6c;sh[_0xf066('0x4')](_0xa245d4,function(_0x4dc86e,_0x245a66,_0x3cc0de){if(_0x4dc86e!==0x0){logger[_0xf066('0x9')](util[_0xf066('0xa')](_0xf066('0xb'),_0x25fff0,_0xa245d4,_0x4dc86e,_0x3cc0de));}else{logger[_0xf066('0xc')](util[_0xf066('0xa')](_0xf066('0xd'),_0x25fff0,_0xa245d4,_0x245a66));}});}; \ No newline at end of file +var _0xe61b=['info','util','shelljs','mustache','../../../../config/logger','exec','data2','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0xe61b,0xb1));var _0xbe61=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xe61b[_0x38c632];return _0x12737e;};'use strict';var util=require(_0xbe61('0x0'));var sh=require(_0xbe61('0x1'));var Mustache=require(_0xbe61('0x2'));var logger=require(_0xbe61('0x3'))('trigger');exports[_0xbe61('0x4')]=function(_0x37512b,_0x4d864a){var _0x4fec53=_0x37512b[_0xbe61('0x5')]?_0x37512b[_0xbe61('0x5')]:'Script';var _0x394b22=_0x37512b[_0xbe61('0x6')]?Mustache['render'](_0x37512b['data3'],_0x4d864a):_0x4d864a;sh[_0xbe61('0x4')](_0x394b22,function(_0x4aaff1,_0x4567a1,_0x1f4832){if(_0x4aaff1!==0x0){logger[_0xbe61('0x7')](util[_0xbe61('0x8')](_0xbe61('0x9'),_0x4fec53,_0x394b22,_0x4aaff1,_0x1f4832));}else{logger[_0xbe61('0xa')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4fec53,_0x394b22,_0x4567a1));}});}; \ 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 27566bb..26cf5cb 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 _0x0a75=['data6','parse','error','stack','GET','DELETE','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','object','statusCode','catch','format','name','message','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x0a75,0x135));var _0x50a7=function(_0x475626,_0xa6ff22){_0x475626=_0x475626-0x0;var _0x2c5a08=_0x0a75[_0x475626];return _0x2c5a08;};'use strict';var rp=require('request-promise');var util=require(_0x50a7('0x0'));var _=require('lodash');var Mustache=require(_0x50a7('0x1'));var logger=require(_0x50a7('0x2'))(_0x50a7('0x3'));exports[_0x50a7('0x4')]=function(_0x293904,_0x5c4495){var _0x4f91e9,_0x53af53;var _0x9babc5={'method':_0x293904[_0x50a7('0x5')][_0x50a7('0x6')](),'uri':Mustache[_0x50a7('0x7')](_0x293904[_0x50a7('0x8')],_0x5c4495),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x293904[_0x50a7('0x9')])==='number'&&parseInt(_0x293904[_0x50a7('0x9')])>=0x1&&parseInt(_0x293904['data5'])<=0xa?parseInt(_0x293904[_0x50a7('0x9')])*0x3e8:0x5*0x3e8};try{_0x9babc5[_0x50a7('0xa')]=_0x293904[_0x50a7('0xb')]?JSON[_0x50a7('0xc')](Mustache[_0x50a7('0x7')](_0x293904[_0x50a7('0xb')],_0x5c4495)):{};}catch(_0xcfd9a0){logger[_0x50a7('0xd')](_0xcfd9a0[_0x50a7('0xe')]);}switch(_0x293904[_0x50a7('0x5')]['toUpperCase']()){case _0x50a7('0xf'):case _0x50a7('0x10'):_0x4f91e9=null;_0x9babc5['qs']=_0x5c4495;break;case _0x50a7('0x11'):case'PUT':if(_0x293904['data7']){try{_0x4f91e9=JSON[_0x50a7('0xc')](Mustache[_0x50a7('0x7')](_0x293904[_0x50a7('0x12')],_0x5c4495));_0x9babc5['body']=_0x4f91e9;}catch(_0x4607bc){logger[_0x50a7('0xd')](_0x4607bc['stack']);logger['error'](_0x50a7('0x13'));}}else{_0x4f91e9=_0x5c4495;_0x9babc5[_0x50a7('0x14')]=_0x4f91e9;}break;}logger[_0x50a7('0x15')](util['format'](_0x50a7('0x16'),_0x293904['data1'],_0x293904['data2'],JSON[_0x50a7('0x17')](_0x9babc5)));rp(_0x9babc5)[_0x50a7('0x18')](function(_0x4ca731){_0x4f91e9=!_[_0x50a7('0x19')](_0x4f91e9)?',\x20request\x20body:\x20'+_0x4f91e9:'';_0x53af53=typeof _0x4ca731[_0x50a7('0x14')]===_0x50a7('0x1a')?JSON[_0x50a7('0x17')](_0x4ca731['body']):_0x4ca731[_0x50a7('0x14')];logger[_0x50a7('0x15')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x293904[_0x50a7('0x5')],_0x293904[_0x50a7('0x8')],_0x4ca731[_0x50a7('0x1b')],_0x53af53));})[_0x50a7('0x1c')](function(_0x4cf9b2){logger[_0x50a7('0xd')](util[_0x50a7('0x1d')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x293904[_0x50a7('0x5')],_0x293904[_0x50a7('0x8')],_0x4cf9b2[_0x50a7('0x1b')],_0x4cf9b2[_0x50a7('0x1e')],_0x4cf9b2[_0x50a7('0x1f')]));});}; \ No newline at end of file +var _0x19a3=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','util','lodash','../../../../config/logger','trigger','data1','toUpperCase','data5','data6','parse','error','GET','DELETE','POST','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object'];(function(_0x4bfa44,_0xaac012){var _0x1ade14=function(_0x56a068){while(--_0x56a068){_0x4bfa44['push'](_0x4bfa44['shift']());}};_0x1ade14(++_0xaac012);}(_0x19a3,0xb8));var _0x319a=function(_0xc7bb6e,_0x2900c3){_0xc7bb6e=_0xc7bb6e-0x0;var _0x2a6291=_0x19a3[_0xc7bb6e];return _0x2a6291;};'use strict';var rp=require('request-promise');var util=require(_0x319a('0x0'));var _=require(_0x319a('0x1'));var Mustache=require('mustache');var logger=require(_0x319a('0x2'))(_0x319a('0x3'));exports['exec']=function(_0x11902f,_0x7a07e2){var _0x2f3ade,_0xacb7be;var _0x3205eb={'method':_0x11902f[_0x319a('0x4')][_0x319a('0x5')](),'uri':Mustache['render'](_0x11902f['data2'],_0x7a07e2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x11902f['data5'])==='number'&&parseInt(_0x11902f[_0x319a('0x6')])>=0x1&&parseInt(_0x11902f[_0x319a('0x6')])<=0xa?parseInt(_0x11902f[_0x319a('0x6')])*0x3e8:0x5*0x3e8};try{_0x3205eb['headers']=_0x11902f[_0x319a('0x7')]?JSON[_0x319a('0x8')](Mustache['render'](_0x11902f[_0x319a('0x7')],_0x7a07e2)):{};}catch(_0x38fa48){logger[_0x319a('0x9')](_0x38fa48['stack']);}switch(_0x11902f[_0x319a('0x4')][_0x319a('0x5')]()){case _0x319a('0xa'):case _0x319a('0xb'):_0x2f3ade=null;_0x3205eb['qs']=_0x7a07e2;break;case _0x319a('0xc'):case'PUT':if(_0x11902f['data7']){try{_0x2f3ade=JSON[_0x319a('0x8')](Mustache['render'](_0x11902f[_0x319a('0xd')],_0x7a07e2));_0x3205eb[_0x319a('0xe')]=_0x2f3ade;}catch(_0x3aceb3){logger[_0x319a('0x9')](_0x3aceb3[_0x319a('0xf')]);logger[_0x319a('0x9')](_0x319a('0x10'));}}else{_0x2f3ade=_0x7a07e2;_0x3205eb[_0x319a('0xe')]=_0x2f3ade;}break;}logger[_0x319a('0x11')](util[_0x319a('0x12')](_0x319a('0x13'),_0x11902f['data1'],_0x11902f[_0x319a('0x14')],JSON[_0x319a('0x15')](_0x3205eb)));rp(_0x3205eb)[_0x319a('0x16')](function(_0x121174){_0x2f3ade=!_[_0x319a('0x17')](_0x2f3ade)?_0x319a('0x18')+_0x2f3ade:'';_0xacb7be=typeof _0x121174[_0x319a('0xe')]===_0x319a('0x19')?JSON[_0x319a('0x15')](_0x121174[_0x319a('0xe')]):_0x121174[_0x319a('0xe')];logger[_0x319a('0x11')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x11902f[_0x319a('0x4')],_0x11902f[_0x319a('0x14')],_0x121174['statusCode'],_0xacb7be));})[_0x319a('0x1a')](function(_0x55024e){logger[_0x319a('0x9')](util[_0x319a('0x12')](_0x319a('0x1b'),_0x11902f[_0x319a('0x4')],_0x11902f[_0x319a('0x14')],_0x55024e[_0x319a('0x1c')],_0x55024e['name'],_0x55024e[_0x319a('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8a93d8b..550ba19 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 _0x1940=['message','result','exports','jayson/promise','bluebird','routing','client','http','Request','debug','rpc','error'];(function(_0x18c3d1,_0x3dc337){var _0x43d9ce=function(_0x7bc739){while(--_0x7bc739){_0x18c3d1['push'](_0x18c3d1['shift']());}};_0x43d9ce(++_0x3dc337);}(_0x1940,0x93));var _0x0194=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x1940[_0x5e3a45];return _0x13419f;};'use strict';var jayson=require(_0x0194('0x0'));var BPromise=require(_0x0194('0x1'));var logger=require('../../config/logger')(_0x0194('0x2'));var client=jayson[_0x0194('0x3')][_0x0194('0x4')]({'port':0x2329});client[_0x0194('0x5')]=function(_0x185852,_0x5c1eeb){return new BPromise(function(_0x118ad9,_0x24e9c4){return client['request'](_0x185852,_0x5c1eeb)['then'](function(_0x4a925f){logger[_0x0194('0x6')](_0x0194('0x7'),'routing',_0x185852,_0x5c1eeb,_0x4a925f);if(_0x4a925f[_0x0194('0x8')]){logger['error'](_0x0194('0x7'),_0x0194('0x2'),_0x185852,_0x4a925f[_0x0194('0x8')][_0x0194('0x9')],_0x5c1eeb);return _0x24e9c4(_0x4a925f[_0x0194('0x8')][_0x0194('0x9')]);}else{return _0x118ad9(_0x4a925f[_0x0194('0xa')]);}})['catch'](function(_0x2f58af){logger['error'](_0x0194('0x7'),_0x0194('0x2'),_0x185852,_0x2f58af,_0x5c1eeb);return _0x24e9c4(_0x2f58af);});});};module[_0x0194('0xb')]=client; \ No newline at end of file +var _0x0bcc=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x0bcc,0x1c8));var _0xc0bc=function(_0x3be058,_0x42267c){_0x3be058=_0x3be058-0x0;var _0x7afbd8=_0x0bcc[_0x3be058];return _0x7afbd8;};'use strict';var jayson=require(_0xc0bc('0x0'));var BPromise=require(_0xc0bc('0x1'));var logger=require(_0xc0bc('0x2'))(_0xc0bc('0x3'));var client=jayson[_0xc0bc('0x4')][_0xc0bc('0x5')]({'port':0x2329});client['Request']=function(_0x457c66,_0x4597bc){return new BPromise(function(_0x43c761,_0x17bfff){return client[_0xc0bc('0x6')](_0x457c66,_0x4597bc)[_0xc0bc('0x7')](function(_0x452335){logger[_0xc0bc('0x8')](_0xc0bc('0x9'),_0xc0bc('0x3'),_0x457c66,_0x4597bc,_0x452335);if(_0x452335[_0xc0bc('0xa')]){logger[_0xc0bc('0xa')](_0xc0bc('0x9'),_0xc0bc('0x3'),_0x457c66,_0x452335[_0xc0bc('0xa')][_0xc0bc('0xb')],_0x4597bc);return _0x17bfff(_0x452335[_0xc0bc('0xa')][_0xc0bc('0xb')]);}else{return _0x43c761(_0x452335[_0xc0bc('0xc')]);}})[_0xc0bc('0xd')](function(_0x57011a){logger[_0xc0bc('0xa')](_0xc0bc('0x9'),'routing',_0x457c66,_0x57011a,_0x4597bc);return _0x17bfff(_0x57011a);});});};module[_0xc0bc('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 58f2449..948d2e8 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 _0x7bb9=['./rpc/mailAccount','resolve','initMailAccounts','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email'];(function(_0x96605f,_0x3d796b){var _0x2559ea=function(_0x461b34){while(--_0x461b34){_0x96605f['push'](_0x96605f['shift']());}};_0x2559ea(++_0x3d796b);}(_0x7bb9,0x1eb));var _0x97bb=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x7bb9[_0xaa0309];return _0x5de7ce;};'use strict';var BPromise=require(_0x97bb('0x0'));var server=require(_0x97bb('0x1'));var Realtime=require(_0x97bb('0x2'));var EmailChannel=require(_0x97bb('0x3'));var mailAccount=require(_0x97bb('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x97bb('0x5')]()['then'](mailAccount['getMailAccounts']())['then'](realtime[_0x97bb('0x6')]())[_0x97bb('0x7')](function(){email[_0x97bb('0x8')](realtime[_0x97bb('0x9')]);return realtime;});}function main(){return server[_0x97bb('0xa')](realtime,email)[_0x97bb('0x7')](function(){return initRealtime();})[_0x97bb('0x7')](function(){return setting[_0x97bb('0xb')]();})['then'](function(_0x27f216){return setInterval(initRealtime,_0x27f216[_0x97bb('0xc')]*0x3e8);})[_0x97bb('0xd')](function(_0x210d0f){console[_0x97bb('0xe')](_0x210d0f);});}main(); \ No newline at end of file +var _0x310c=['then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','log','./server','./realtime','./lib/email'];(function(_0x1db3d2,_0x2ae108){var _0x3d7b8a=function(_0x49cc64){while(--_0x49cc64){_0x1db3d2['push'](_0x1db3d2['shift']());}};_0x3d7b8a(++_0x2ae108);}(_0x310c,0x194));var _0xc310=function(_0x3e36d5,_0x3c0359){_0x3e36d5=_0x3e36d5-0x0;var _0x3ebbff=_0x310c[_0x3e36d5];return _0x3ebbff;};'use strict';var BPromise=require('bluebird');var server=require(_0xc310('0x0'));var Realtime=require(_0xc310('0x1'));var EmailChannel=require(_0xc310('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xc310('0x3')](mailAccount[_0xc310('0x4')]())[_0xc310('0x3')](realtime[_0xc310('0x5')]())['then'](function(){email[_0xc310('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xc310('0x7')](realtime,email)[_0xc310('0x3')](function(){return initRealtime();})[_0xc310('0x3')](function(){return setting[_0xc310('0x8')]();})['then'](function(_0x283374){return setInterval(initRealtime,_0x283374[_0xc310('0x9')]*0x3e8);})['catch'](function(_0x5d70e0){console[_0xc310('0xa')](_0x5d70e0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1cd1ed5..529ccc2 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 _0x3ea3=['lastSync','verifySmtp','Smtp','verify','then','catch','exports','lodash','bluebird','ioredis','../../../config/logger','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','status','Imap','total','md5','mailAccount:update','prototype','hasOwnProperty','active','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','isNil','messageStatus','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing'];(function(_0x456bb2,_0x23dafe){var _0x34c8e0=function(_0x4a8e5b){while(--_0x4a8e5b){_0x456bb2['push'](_0x456bb2['shift']());}};_0x34c8e0(++_0x23dafe);}(_0x3ea3,0x197));var _0x33ea=function(_0x3f38b9,_0x41d695){_0x3f38b9=_0x3f38b9-0x0;var _0x11128d=_0x3ea3[_0x3f38b9];return _0x11128d;};'use strict';var _=require(_0x33ea('0x0'));var moment=require('moment');var BPromise=require(_0x33ea('0x1'));var md5=require('md5');var Redis=require(_0x33ea('0x2'));var config=require('../../../config/environment');var logger=require(_0x33ea('0x3'))('email');config[_0x33ea('0x4')]=_[_0x33ea('0x5')](config[_0x33ea('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x33ea('0x6'))(new Redis(config[_0x33ea('0x4')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x33ea('0x7'));var mailAccount=require(_0x33ea('0x8'));var md5Accounts={};function EmailChannel(_0x5d49bc){logger[_0x33ea('0x9')](_0x33ea('0xa'));this[_0x33ea('0xb')]=_0x5d49bc[_0x33ea('0xb')];this[_0x33ea('0xc')]={};this[_0x33ea('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x33ea('0xe')]=function(_0x568bf6){var _0x5be911=this[_0x33ea('0xb')][_0x568bf6];var _0x599f53={'id':_0x5be911['id'],'name':_0x5be911[_0x33ea('0xf')],'key':_0x5be911['key'],'active':_0x5be911['active'],'Imap':{'status':_0x5be911['Imap'][_0x33ea('0x10')],'messageStatus':_0x5be911[_0x33ea('0x11')]['messageStatus'],'total':_0x5be911[_0x33ea('0x11')][_0x33ea('0x12')]}};if(_['isNil'](md5Accounts[_0x568bf6])){md5Accounts[_0x568bf6]={};}var _0x3a3fb7=md5(JSON['stringify'](_0x599f53));if(md5Accounts[_0x568bf6][_0x33ea('0x13')]!==_0x3a3fb7){md5Accounts[_0x568bf6]['md5']=_0x3a3fb7;io['emit'](_0x33ea('0x14'),_0x599f53);}};EmailChannel[_0x33ea('0x15')]['refresh']=function(_0x17b4a2){for(var _0xe4e55c in _0x17b4a2){if(_0x17b4a2[_0x33ea('0x16')](_0xe4e55c)){if(_0x17b4a2[_0xe4e55c][_0x33ea('0x11')]&&_0x17b4a2[_0xe4e55c][_0x33ea('0x17')]){var _0x505120=_0x17b4a2[_0xe4e55c][_0x33ea('0x11')];if(!this['imapAccounts'][_0x33ea('0x16')](_0x505120['id'])){this[_0x33ea('0xc')][_0x505120['id']]=new EmailImap(_0x505120,_0x17b4a2[_0xe4e55c][_0x33ea('0x18')]);this[_0x33ea('0xc')][_0x505120['id']]['on'](_0x33ea('0x19'),this[_0x33ea('0x1a')][_0x33ea('0x1b')](this,_0xe4e55c));this[_0x33ea('0xc')][_0x505120['id']]['on']('email',this['handleImapEmail'][_0x33ea('0x1b')](this,_0xe4e55c));this[_0x33ea('0xc')][_0x505120['id']]['on'](_0x33ea('0x1c'),this[_0x33ea('0x1d')][_0x33ea('0x1b')](this,_0xe4e55c));this[_0x33ea('0xc')][_0x505120['id']]['on'](_0x33ea('0x1e'),this[_0x33ea('0x1f')][_0x33ea('0x1b')](this,_0xe4e55c));}}else{if(_[_0x33ea('0x20')](this['mailAccounts'][_0xe4e55c][_0x33ea('0x11')])){this[_0x33ea('0xb')][_0xe4e55c][_0x33ea('0x11')]={};}this['mailAccounts'][_0xe4e55c][_0x33ea('0x11')][_0x33ea('0x10')]='disabled';this['mailAccounts'][_0xe4e55c][_0x33ea('0x11')][_0x33ea('0x21')]='';this['emit'](_0xe4e55c);}}}};EmailChannel[_0x33ea('0x15')][_0x33ea('0x1a')]=function(_0x2f27f5,_0x20308e){if(this[_0x33ea('0xb')][_0x2f27f5]){this[_0x33ea('0xb')][_0x2f27f5][_0x33ea('0x11')]['status']=_0x33ea('0x22');this[_0x33ea('0xb')][_0x2f27f5][_0x33ea('0x11')][_0x33ea('0x21')]=_0x20308e[_0x33ea('0xf')];if(_0x20308e['messages']){this[_0x33ea('0xb')][_0x2f27f5][_0x33ea('0x11')][_0x33ea('0x12')]=_0x20308e[_0x33ea('0x23')][_0x33ea('0x12')];}return this[_0x33ea('0xe')](_0x2f27f5);}};EmailChannel[_0x33ea('0x15')][_0x33ea('0x24')]=function(_0x3172bd,_0x42a562){logger[_0x33ea('0x9')](_0x33ea('0x25'),_0x42a562[_0x33ea('0x26')],_0x42a562[_0x33ea('0x27')],_0x42a562[_0x33ea('0x28')],_0x3172bd);if(this[_0x33ea('0xb')][_0x3172bd]){return mailAccount[_0x33ea('0x29')](_0x3172bd,_0x42a562)['then'](function(_0x5c1360){if(_0x5c1360){logger[_0x33ea('0x9')](_0x33ea('0x2a'));}})['catch'](function(_0x5de585){logger[_0x33ea('0x1e')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5de585));});}};EmailChannel[_0x33ea('0x15')][_0x33ea('0x1d')]=function(_0x3cba25){if(this['mailAccounts'][_0x3cba25]&&this[_0x33ea('0xb')][_0x3cba25]['Imap']){if(this[_0x33ea('0xc')][this[_0x33ea('0xb')][_0x3cba25][_0x33ea('0x11')]['id']]){delete this[_0x33ea('0xc')][this[_0x33ea('0xb')][_0x3cba25]['Imap']['id']];}this['mailAccounts'][_0x3cba25]['Imap'][_0x33ea('0x2b')]=moment();this['emit'](_0x3cba25);}};EmailChannel[_0x33ea('0x15')]['handleImapError']=function(_0x7f774b,_0x27ca96){if(this['mailAccounts'][_0x7f774b]){this[_0x33ea('0xb')][_0x7f774b][_0x33ea('0x11')][_0x33ea('0x10')]=_0x33ea('0x1e');this['mailAccounts'][_0x7f774b]['Imap'][_0x33ea('0x21')]=_0x27ca96;return this['emit'](_0x7f774b);}};EmailChannel[_0x33ea('0x15')]['sendMail']=function(_0x4b035d,_0x5da621){return this[_0x33ea('0xd')]['send'](_0x4b035d,_0x5da621);};EmailChannel[_0x33ea('0x15')][_0x33ea('0x2c')]=function(_0x47e4b4){var _0x5e76af=this;if(this[_0x33ea('0xb')][_0x47e4b4['id']]){if(_[_0x33ea('0x20')](this[_0x33ea('0xb')][_0x47e4b4['id']][_0x33ea('0x2d')])){this[_0x33ea('0xb')][_0x47e4b4['id']][_0x33ea('0x2d')]={};}this[_0x33ea('0xb')][_0x47e4b4['id']][_0x33ea('0x2d')]['lastSync']=moment();return new BPromise(function(_0x135535,_0x180f1f){return _0x5e76af[_0x33ea('0xd')][_0x33ea('0x2e')](_0x47e4b4)[_0x33ea('0x2f')](function(_0x132709){_0x5e76af[_0x33ea('0xb')][_0x47e4b4['id']][_0x33ea('0x2d')][_0x33ea('0x10')]='verified';_0x5e76af[_0x33ea('0xb')][_0x47e4b4['id']][_0x33ea('0x2d')][_0x33ea('0x21')]='';_0x5e76af[_0x33ea('0xe')](_0x47e4b4['id']);_0x135535(_0x132709);})[_0x33ea('0x30')](function(_0x47e7a1){_0x5e76af[_0x33ea('0xb')][_0x47e4b4['id']][_0x33ea('0x2d')][_0x33ea('0x10')]=_0x33ea('0x1e');_0x5e76af[_0x33ea('0xb')][_0x47e4b4['id']]['Smtp'][_0x33ea('0x21')]=_0x47e7a1;_0x5e76af['emit'](_0x47e4b4['id']);_0x180f1f(_0x47e7a1);});});}return this[_0x33ea('0xd')][_0x33ea('0x2e')](_0x47e4b4);};module[_0x33ea('0x31')]=EmailChannel; \ No newline at end of file +var _0x0a6b=['ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','total','isNil','mailAccount:update','hasOwnProperty','box','handleImapBox','handleImapEmail','end','handleImapEnd','error','handleImapError','bind','status','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','Smtp','lastSync','verify','verified','exports','lodash','moment','md5'];(function(_0x17f822,_0x3349f0){var _0x8b5d16=function(_0x1e0c26){while(--_0x1e0c26){_0x17f822['push'](_0x17f822['shift']());}};_0x8b5d16(++_0x3349f0);}(_0x0a6b,0xfc));var _0xb0a6=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x0a6b[_0x5ee3d3];return _0x4b272f;};'use strict';var _=require(_0xb0a6('0x0'));var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var md5=require(_0xb0a6('0x2'));var Redis=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var logger=require(_0xb0a6('0x5'))(_0xb0a6('0x6'));config['redis']=_[_0xb0a6('0x7')](config[_0xb0a6('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb0a6('0x8')]));var EmailImap=require(_0xb0a6('0x9'));var EmailSmtp=require(_0xb0a6('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x203aeb){logger[_0xb0a6('0xb')](_0xb0a6('0xc'));this[_0xb0a6('0xd')]=_0x203aeb[_0xb0a6('0xd')];this[_0xb0a6('0xe')]={};this[_0xb0a6('0xf')]=new EmailSmtp();}EmailChannel[_0xb0a6('0x10')][_0xb0a6('0x11')]=function(_0x58ac86){var _0x2560db=this[_0xb0a6('0xd')][_0x58ac86];var _0x21310e={'id':_0x2560db['id'],'name':_0x2560db[_0xb0a6('0x12')],'key':_0x2560db['key'],'active':_0x2560db[_0xb0a6('0x13')],'Imap':{'status':_0x2560db[_0xb0a6('0x14')]['status'],'messageStatus':_0x2560db[_0xb0a6('0x14')]['messageStatus'],'total':_0x2560db['Imap'][_0xb0a6('0x15')]}};if(_[_0xb0a6('0x16')](md5Accounts[_0x58ac86])){md5Accounts[_0x58ac86]={};}var _0x5984a7=md5(JSON['stringify'](_0x21310e));if(md5Accounts[_0x58ac86]['md5']!==_0x5984a7){md5Accounts[_0x58ac86][_0xb0a6('0x2')]=_0x5984a7;io[_0xb0a6('0x11')](_0xb0a6('0x17'),_0x21310e);}};EmailChannel[_0xb0a6('0x10')]['refresh']=function(_0x10397e){for(var _0x59b965 in _0x10397e){if(_0x10397e[_0xb0a6('0x18')](_0x59b965)){if(_0x10397e[_0x59b965]['Imap']&&_0x10397e[_0x59b965][_0xb0a6('0x13')]){var _0x49c8a5=_0x10397e[_0x59b965][_0xb0a6('0x14')];if(!this[_0xb0a6('0xe')][_0xb0a6('0x18')](_0x49c8a5['id'])){this[_0xb0a6('0xe')][_0x49c8a5['id']]=new EmailImap(_0x49c8a5,_0x10397e[_0x59b965][_0xb0a6('0x6')]);this['imapAccounts'][_0x49c8a5['id']]['on'](_0xb0a6('0x19'),this[_0xb0a6('0x1a')]['bind'](this,_0x59b965));this[_0xb0a6('0xe')][_0x49c8a5['id']]['on'](_0xb0a6('0x6'),this[_0xb0a6('0x1b')]['bind'](this,_0x59b965));this[_0xb0a6('0xe')][_0x49c8a5['id']]['on'](_0xb0a6('0x1c'),this[_0xb0a6('0x1d')]['bind'](this,_0x59b965));this[_0xb0a6('0xe')][_0x49c8a5['id']]['on'](_0xb0a6('0x1e'),this[_0xb0a6('0x1f')][_0xb0a6('0x20')](this,_0x59b965));}}else{if(_[_0xb0a6('0x16')](this[_0xb0a6('0xd')][_0x59b965][_0xb0a6('0x14')])){this[_0xb0a6('0xd')][_0x59b965][_0xb0a6('0x14')]={};}this[_0xb0a6('0xd')][_0x59b965][_0xb0a6('0x14')][_0xb0a6('0x21')]='disabled';this['mailAccounts'][_0x59b965][_0xb0a6('0x14')][_0xb0a6('0x22')]='';this[_0xb0a6('0x11')](_0x59b965);}}}};EmailChannel['prototype'][_0xb0a6('0x1a')]=function(_0x4a6e0c,_0x167012){if(this['mailAccounts'][_0x4a6e0c]){this[_0xb0a6('0xd')][_0x4a6e0c][_0xb0a6('0x14')][_0xb0a6('0x21')]='connected';this[_0xb0a6('0xd')][_0x4a6e0c][_0xb0a6('0x14')][_0xb0a6('0x22')]=_0x167012[_0xb0a6('0x12')];if(_0x167012[_0xb0a6('0x23')]){this[_0xb0a6('0xd')][_0x4a6e0c][_0xb0a6('0x14')][_0xb0a6('0x15')]=_0x167012[_0xb0a6('0x23')][_0xb0a6('0x15')];}return this[_0xb0a6('0x11')](_0x4a6e0c);}};EmailChannel[_0xb0a6('0x10')][_0xb0a6('0x1b')]=function(_0x558a36,_0x164fc8){logger[_0xb0a6('0xb')](_0xb0a6('0x24'),_0x164fc8[_0xb0a6('0x25')],_0x164fc8['lastName'],_0x164fc8[_0xb0a6('0x26')],_0x558a36);if(this[_0xb0a6('0xd')][_0x558a36]){return mailAccount[_0xb0a6('0x27')](_0x558a36,_0x164fc8)[_0xb0a6('0x28')](function(_0x54abaa){if(_0x54abaa){logger[_0xb0a6('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0xb0a6('0x29')](function(_0x4eaa51){logger[_0xb0a6('0x1e')](_0xb0a6('0x2a'),JSON[_0xb0a6('0x2b')](_0x4eaa51));});}};EmailChannel[_0xb0a6('0x10')][_0xb0a6('0x1d')]=function(_0x34965e){if(this[_0xb0a6('0xd')][_0x34965e]&&this[_0xb0a6('0xd')][_0x34965e][_0xb0a6('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x34965e][_0xb0a6('0x14')]['id']]){delete this[_0xb0a6('0xe')][this[_0xb0a6('0xd')][_0x34965e]['Imap']['id']];}this[_0xb0a6('0xd')][_0x34965e][_0xb0a6('0x14')]['lastSync']=moment();this[_0xb0a6('0x11')](_0x34965e);}};EmailChannel[_0xb0a6('0x10')][_0xb0a6('0x1f')]=function(_0x955f94,_0x155b93){if(this['mailAccounts'][_0x955f94]){this[_0xb0a6('0xd')][_0x955f94][_0xb0a6('0x14')][_0xb0a6('0x21')]=_0xb0a6('0x1e');this['mailAccounts'][_0x955f94][_0xb0a6('0x14')][_0xb0a6('0x22')]=_0x155b93;return this[_0xb0a6('0x11')](_0x955f94);}};EmailChannel[_0xb0a6('0x10')][_0xb0a6('0x2c')]=function(_0x40bb8c,_0x21ed69){return this[_0xb0a6('0xf')][_0xb0a6('0x2d')](_0x40bb8c,_0x21ed69);};EmailChannel['prototype']['verifySmtp']=function(_0x546e1e){var _0x9086d8=this;if(this[_0xb0a6('0xd')][_0x546e1e['id']]){if(_[_0xb0a6('0x16')](this['mailAccounts'][_0x546e1e['id']][_0xb0a6('0x2e')])){this[_0xb0a6('0xd')][_0x546e1e['id']][_0xb0a6('0x2e')]={};}this[_0xb0a6('0xd')][_0x546e1e['id']]['Smtp'][_0xb0a6('0x2f')]=moment();return new BPromise(function(_0x38af3a,_0x4465c2){return _0x9086d8[_0xb0a6('0xf')][_0xb0a6('0x30')](_0x546e1e)[_0xb0a6('0x28')](function(_0xb27c9){_0x9086d8[_0xb0a6('0xd')][_0x546e1e['id']]['Smtp'][_0xb0a6('0x21')]=_0xb0a6('0x31');_0x9086d8[_0xb0a6('0xd')][_0x546e1e['id']][_0xb0a6('0x2e')]['messageStatus']='';_0x9086d8[_0xb0a6('0x11')](_0x546e1e['id']);_0x38af3a(_0xb27c9);})[_0xb0a6('0x29')](function(_0x5dde33){_0x9086d8['mailAccounts'][_0x546e1e['id']]['Smtp'][_0xb0a6('0x21')]=_0xb0a6('0x1e');_0x9086d8[_0xb0a6('0xd')][_0x546e1e['id']][_0xb0a6('0x2e')]['messageStatus']=_0x5dde33;_0x9086d8[_0xb0a6('0x11')](_0x546e1e['id']);_0x4465c2(_0x5dde33);});});}return this['smtp'][_0xb0a6('0x30')](_0x546e1e);};module[_0xb0a6('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 45fc0e8..8844b38 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 _0xff7a=['end','error','handleError','connect','inherits','prototype','connTimeout','isNil','user','password','host','port','tls','autotls','required','getHost','service','openBox','mailbox','box','search','handleReadUnseen','length','message','handleFetchError','closeBox','handleCloseBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','imap','lodash','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind'];(function(_0x233fce,_0x185d34){var _0x1499c1=function(_0x16ec05){while(--_0x16ec05){_0x233fce['push'](_0x233fce['shift']());}};_0x1499c1(++_0x185d34);}(_0xff7a,0xa0));var _0xaff7=function(_0x347b17,_0x204a8c){_0x347b17=_0x347b17-0x0;var _0x2919bf=_0xff7a[_0x347b17];return _0x2919bf;};'use strict';var fs=require('fs');var path=require(_0xaff7('0x0'));var util=require('util');var Imap=require(_0xaff7('0x1'));var _=require(_0xaff7('0x2'));var rs=require('randomstring');var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0xaff7('0x3'))[_0xaff7('0x4')];var EventEmitter=require(_0xaff7('0x5'))[_0xaff7('0x6')];var utils=require(_0xaff7('0x7'));var logger=require(_0xaff7('0x8'))(_0xaff7('0x9'));function EmailImap(_0x32fd01,_0xf5c750){this['mailbox']=_0xaff7('0xa');this[_0xaff7('0xb')]=this[_0xaff7('0xc')](_0x32fd01,_0xf5c750);this['imap']=new Imap(this[_0xaff7('0xb')]);this[_0xaff7('0x1')][_0xaff7('0xd')](_0xaff7('0xe'),this[_0xaff7('0xf')][_0xaff7('0x10')](this));this['imap'][_0xaff7('0xd')](_0xaff7('0x11'),this['handleEnd']['bind'](this));this[_0xaff7('0x1')]['on'](_0xaff7('0x12'),this[_0xaff7('0x13')][_0xaff7('0x10')](this));this[_0xaff7('0x1')][_0xaff7('0x14')]();}util[_0xaff7('0x15')](EmailImap,EventEmitter);EmailImap[_0xaff7('0x16')][_0xaff7('0xc')]=function(_0x28b07c,_0x274dd9){var _0x234e89={'connTimeout':_0x28b07c[_0xaff7('0x17')]?_0x28b07c[_0xaff7('0x17')]*0x3e8:0x2710,'authTimeout':_0x28b07c['authTimeout']?_0x28b07c['authTimeout']*0x3e8:0x1388};if(_[_0xaff7('0x18')](_0x28b07c['service'])){if(_0x28b07c['authentication']){_0x234e89[_0xaff7('0x19')]=_0x28b07c[_0xaff7('0x19')];_0x234e89[_0xaff7('0x1a')]=_0x28b07c[_0xaff7('0x1a')];}_0x234e89[_0xaff7('0x1b')]=_0x28b07c[_0xaff7('0x1b')];_0x234e89[_0xaff7('0x1c')]=_0x28b07c[_0xaff7('0x1c')]||0x3e1;if(_0x28b07c[_0xaff7('0x1d')]){_0x234e89[_0xaff7('0x1d')]=!![];}else{_0x234e89[_0xaff7('0x1d')]=![];_0x234e89[_0xaff7('0x1e')]=_0xaff7('0x1f');}}else{_0x234e89[_0xaff7('0x19')]=_0x28b07c[_0xaff7('0x19')];_0x234e89['password']=_0x28b07c[_0xaff7('0x1a')];_0x234e89[_0xaff7('0x1b')]=utils[_0xaff7('0x20')](_0x28b07c[_0xaff7('0x21')]);_0x234e89[_0xaff7('0x1c')]=0x3e1;_0x234e89['tls']=!![];}_0x234e89[_0xaff7('0x9')]=_0x274dd9||_0x28b07c['user']||'anonymous@xcally.com';return _0x234e89;};EmailImap[_0xaff7('0x16')][_0xaff7('0xf')]=function(){this[_0xaff7('0x1')][_0xaff7('0x22')](this[_0xaff7('0x23')],![],this['handleOpenBox'][_0xaff7('0x10')](this));};EmailImap['prototype']['handleOpenBox']=function(_0xcee604,_0xeb39d9){if(_0xcee604){this[_0xaff7('0x13')](_0xcee604,!![]);}else{this['emit'](_0xaff7('0x24'),_0xeb39d9);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x7a0455){if(_0x7a0455){this['handleError'](_0x7a0455,!![]);}else{this[_0xaff7('0x1')][_0xaff7('0x11')]();}};EmailImap[_0xaff7('0x16')]['readUnseen']=function(){this[_0xaff7('0x1')][_0xaff7('0x25')](['UNSEEN'],this[_0xaff7('0x26')][_0xaff7('0x10')](this));};EmailImap[_0xaff7('0x16')][_0xaff7('0x26')]=function(_0x59aec4,_0x2cc6ec){if(_0x59aec4){this['handleError'](_0x59aec4,!![]);}else{if(_0x2cc6ec[_0xaff7('0x27')]){try{var _0xd81e33=this[_0xaff7('0x1')]['fetch'](_0x2cc6ec,{'bodies':'','markSeen':!![]});_0xd81e33['on'](_0xaff7('0x28'),this['handleFetchMessage'][_0xaff7('0x10')](this));_0xd81e33[_0xaff7('0xd')](_0xaff7('0x12'),this[_0xaff7('0x29')][_0xaff7('0x10')](this));_0xd81e33[_0xaff7('0xd')](_0xaff7('0x11'),this['handleFetchEnd'][_0xaff7('0x10')](this));}catch(_0x2a639f){logger['error'](_0x2a639f);}}else{this[_0xaff7('0x1')][_0xaff7('0x2a')](!![],this[_0xaff7('0x2b')]['bind'](this));}}};EmailImap['prototype'][_0xaff7('0x2c')]=function(_0x4db521,_0x1ff09a){_0x4db521['on'](_0xaff7('0x2d'),this[_0xaff7('0x2e')][_0xaff7('0x10')](this));_0x4db521[_0xaff7('0xd')](_0xaff7('0x2f'),this[_0xaff7('0x30')]['bind'](this));_0x4db521[_0xaff7('0xd')](_0xaff7('0x11'),this['handleMessageEnd'][_0xaff7('0x10')](this));};EmailImap[_0xaff7('0x16')][_0xaff7('0x2e')]=function(_0x36060f,_0x1b0d27){simpleParser(_0x36060f,{'Iconv':Iconv},this['handleSimpleParser'][_0xaff7('0x10')](this));};EmailImap[_0xaff7('0x16')][_0xaff7('0x30')]=function(_0x2848bc){};EmailImap[_0xaff7('0x16')][_0xaff7('0x31')]=function(){};EmailImap['prototype'][_0xaff7('0x32')]=function(_0x2df4df,_0x2868d8){if(_0x2df4df){logger[_0xaff7('0x12')](_0x2df4df);}else{var _0x27b4a7=this;utils['parser'](this['account'],_0x2868d8,function(_0x266128){_0x27b4a7[_0xaff7('0x33')](_0xaff7('0x9'),_0x266128);});}};EmailImap[_0xaff7('0x16')][_0xaff7('0x34')]=function(){this[_0xaff7('0x1')][_0xaff7('0x2a')](!![],this[_0xaff7('0x2b')][_0xaff7('0x10')](this));};EmailImap[_0xaff7('0x16')][_0xaff7('0x29')]=function(_0x1cfc24){this[_0xaff7('0x13')](_0x1cfc24);this[_0xaff7('0x1')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xaff7('0x16')][_0xaff7('0x35')]=function(){this[_0xaff7('0x33')]('end');};EmailImap[_0xaff7('0x16')]['handleError']=function(_0x406c85,_0x574834){logger[_0xaff7('0x12')](_0xaff7('0x13'),this[_0xaff7('0xb')][_0xaff7('0x9')],JSON[_0xaff7('0x36')](_0x406c85));var _0xcd8933='';if(_0x406c85){if(_0x406c85[_0xaff7('0x37')]){_0xcd8933=_0x406c85['textCode'];}else{for(var _0x528ef6 in _0x406c85){if(_0x406c85[_0xaff7('0x38')](_0x528ef6)){_0xcd8933+=_[_0xaff7('0x39')](_0x528ef6)+':\x20'+_0x406c85[_0x528ef6]+'\x0a';}}}}if(_0x574834){this[_0xaff7('0x1')][_0xaff7('0x11')]();}else{this['emit'](_0xaff7('0x12'),_0xcd8933);this[_0xaff7('0x33')](_0xaff7('0x11'));}};module[_0xaff7('0x3a')]=EmailImap; \ No newline at end of file +var _0xf335=['connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','password','host','port','autotls','required','user','service','tls','handleReady','mailbox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','handleFetchEnd','stringify','textCode','upperFirst','exports','lodash','randomstring','simpleParser','iconv','Iconv','events','../../../config/logger','email','INBOX','account','getAccount','imap','ready','bind','once','end','handleEnd','error','handleError'];(function(_0x3a6194,_0x4574e2){var _0x298116=function(_0x27297c){while(--_0x27297c){_0x3a6194['push'](_0x3a6194['shift']());}};_0x298116(++_0x4574e2);}(_0xf335,0x1c5));var _0x5f33=function(_0x57b4f1,_0x580672){_0x57b4f1=_0x57b4f1-0x0;var _0x1db0f4=_0xf335[_0x57b4f1];return _0x1db0f4;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require('imap');var _=require(_0x5f33('0x0'));var rs=require(_0x5f33('0x1'));var simpleParser=require('mailparser')[_0x5f33('0x2')];var Iconv=require(_0x5f33('0x3'))[_0x5f33('0x4')];var EventEmitter=require(_0x5f33('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x5f33('0x6'))(_0x5f33('0x7'));function EmailImap(_0x325db2,_0x245050){this['mailbox']=_0x5f33('0x8');this[_0x5f33('0x9')]=this[_0x5f33('0xa')](_0x325db2,_0x245050);this[_0x5f33('0xb')]=new Imap(this['account']);this['imap']['once'](_0x5f33('0xc'),this['handleReady'][_0x5f33('0xd')](this));this[_0x5f33('0xb')][_0x5f33('0xe')](_0x5f33('0xf'),this[_0x5f33('0x10')]['bind'](this));this[_0x5f33('0xb')]['on'](_0x5f33('0x11'),this[_0x5f33('0x12')]['bind'](this));this['imap'][_0x5f33('0x13')]();}util[_0x5f33('0x14')](EmailImap,EventEmitter);EmailImap[_0x5f33('0x15')][_0x5f33('0xa')]=function(_0x275f65,_0x262524){var _0x33b5f3={'connTimeout':_0x275f65[_0x5f33('0x16')]?_0x275f65[_0x5f33('0x16')]*0x3e8:0x2710,'authTimeout':_0x275f65[_0x5f33('0x17')]?_0x275f65['authTimeout']*0x3e8:0x1388};if(_[_0x5f33('0x18')](_0x275f65['service'])){if(_0x275f65[_0x5f33('0x19')]){_0x33b5f3['user']=_0x275f65['user'];_0x33b5f3[_0x5f33('0x1a')]=_0x275f65[_0x5f33('0x1a')];}_0x33b5f3[_0x5f33('0x1b')]=_0x275f65[_0x5f33('0x1b')];_0x33b5f3[_0x5f33('0x1c')]=_0x275f65[_0x5f33('0x1c')]||0x3e1;if(_0x275f65['tls']){_0x33b5f3['tls']=!![];}else{_0x33b5f3['tls']=![];_0x33b5f3[_0x5f33('0x1d')]=_0x5f33('0x1e');}}else{_0x33b5f3[_0x5f33('0x1f')]=_0x275f65[_0x5f33('0x1f')];_0x33b5f3[_0x5f33('0x1a')]=_0x275f65[_0x5f33('0x1a')];_0x33b5f3[_0x5f33('0x1b')]=utils['getHost'](_0x275f65[_0x5f33('0x20')]);_0x33b5f3[_0x5f33('0x1c')]=0x3e1;_0x33b5f3[_0x5f33('0x21')]=!![];}_0x33b5f3[_0x5f33('0x7')]=_0x262524||_0x275f65[_0x5f33('0x1f')]||'anonymous@xcally.com';return _0x33b5f3;};EmailImap['prototype'][_0x5f33('0x22')]=function(){this['imap']['openBox'](this[_0x5f33('0x23')],![],this[_0x5f33('0x24')][_0x5f33('0xd')](this));};EmailImap[_0x5f33('0x15')][_0x5f33('0x24')]=function(_0x37e905,_0x221f5a){if(_0x37e905){this[_0x5f33('0x12')](_0x37e905,!![]);}else{this[_0x5f33('0x25')]('box',_0x221f5a);this[_0x5f33('0x26')]();}};EmailImap[_0x5f33('0x15')][_0x5f33('0x27')]=function(_0x30e952){if(_0x30e952){this['handleError'](_0x30e952,!![]);}else{this['imap']['end']();}};EmailImap[_0x5f33('0x15')][_0x5f33('0x26')]=function(){this[_0x5f33('0xb')]['search']([_0x5f33('0x28')],this['handleReadUnseen'][_0x5f33('0xd')](this));};EmailImap[_0x5f33('0x15')][_0x5f33('0x29')]=function(_0xad7e8e,_0x1d4dcc){if(_0xad7e8e){this[_0x5f33('0x12')](_0xad7e8e,!![]);}else{if(_0x1d4dcc[_0x5f33('0x2a')]){try{var _0x11f8b3=this[_0x5f33('0xb')][_0x5f33('0x2b')](_0x1d4dcc,{'bodies':'','markSeen':!![]});_0x11f8b3['on'](_0x5f33('0x2c'),this['handleFetchMessage'][_0x5f33('0xd')](this));_0x11f8b3['once']('error',this[_0x5f33('0x2d')][_0x5f33('0xd')](this));_0x11f8b3['once'](_0x5f33('0xf'),this['handleFetchEnd'][_0x5f33('0xd')](this));}catch(_0x3d835e){logger[_0x5f33('0x11')](_0x3d835e);}}else{this[_0x5f33('0xb')][_0x5f33('0x2e')](!![],this['handleCloseBox'][_0x5f33('0xd')](this));}}};EmailImap[_0x5f33('0x15')][_0x5f33('0x2f')]=function(_0xae257e,_0x4d6e7b){_0xae257e['on']('body',this[_0x5f33('0x30')][_0x5f33('0xd')](this));_0xae257e[_0x5f33('0xe')](_0x5f33('0x31'),this['handleMessageAttributes'][_0x5f33('0xd')](this));_0xae257e[_0x5f33('0xe')](_0x5f33('0xf'),this[_0x5f33('0x32')]['bind'](this));};EmailImap[_0x5f33('0x15')]['handleMessageBody']=function(_0x382418,_0x512f11){simpleParser(_0x382418,{'Iconv':Iconv},this[_0x5f33('0x33')][_0x5f33('0xd')](this));};EmailImap['prototype'][_0x5f33('0x34')]=function(_0x4f36cc){};EmailImap[_0x5f33('0x15')][_0x5f33('0x32')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x256ca1,_0x4e9365){if(_0x256ca1){logger[_0x5f33('0x11')](_0x256ca1);}else{var _0x4dd396=this;utils[_0x5f33('0x35')](this[_0x5f33('0x9')],_0x4e9365,function(_0x190737){_0x4dd396[_0x5f33('0x25')](_0x5f33('0x7'),_0x190737);});}};EmailImap[_0x5f33('0x15')][_0x5f33('0x36')]=function(){this[_0x5f33('0xb')][_0x5f33('0x2e')](!![],this[_0x5f33('0x27')][_0x5f33('0xd')](this));};EmailImap[_0x5f33('0x15')]['handleFetchError']=function(_0xd2f035){this[_0x5f33('0x12')](_0xd2f035);this['imap']['closeBox'](!![],this[_0x5f33('0x27')][_0x5f33('0xd')](this));};EmailImap[_0x5f33('0x15')][_0x5f33('0x10')]=function(){this['emit']('end');};EmailImap['prototype'][_0x5f33('0x12')]=function(_0x1241f5,_0x43cf2a){logger[_0x5f33('0x11')](_0x5f33('0x12'),this[_0x5f33('0x9')][_0x5f33('0x7')],JSON[_0x5f33('0x37')](_0x1241f5));var _0x225da7='';if(_0x1241f5){if(_0x1241f5[_0x5f33('0x38')]){_0x225da7=_0x1241f5[_0x5f33('0x38')];}else{for(var _0x43b7f1 in _0x1241f5){if(_0x1241f5['hasOwnProperty'](_0x43b7f1)){_0x225da7+=_[_0x5f33('0x39')](_0x43b7f1)+':\x20'+_0x1241f5[_0x43b7f1]+'\x0a';}}}}if(_0x43cf2a){this[_0x5f33('0xb')][_0x5f33('0xf')]();}else{this[_0x5f33('0x25')](_0x5f33('0x11'),_0x225da7);this[_0x5f33('0x25')]('end');}};module[_0x5f33('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index bdc4671..0ea7e6a 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 _0xfa43=['use','compile','sendMail','toString','verify','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0xfa43,0xde));var _0x3fa4=function(_0x586461,_0x4fd2f6){_0x586461=_0x586461-0x0;var _0x5b0353=_0xfa43[_0x586461];return _0x5b0353;};'use strict';var nodemailer=require(_0x3fa4('0x0'));var BPromise=require(_0x3fa4('0x1'));var inlineBase64=require(_0x3fa4('0x2'));function EmailSmtp(){}EmailSmtp[_0x3fa4('0x3')][_0x3fa4('0x4')]=function(_0x375ca4,_0x4edaf9){return new BPromise(function(_0x6982bf,_0xd05c7){var _0x59d070=nodemailer[_0x3fa4('0x5')](_0x375ca4);_0x59d070[_0x3fa4('0x6')](_0x3fa4('0x7'),inlineBase64());_0x59d070[_0x3fa4('0x8')](_0x4edaf9,function(_0x3732a3,_0x4b4211){if(_0x3732a3){_0xd05c7(_0x3732a3[_0x3fa4('0x9')]());}else{_0x6982bf(_0x4b4211);}});});};EmailSmtp[_0x3fa4('0x3')]['verify']=function(_0x5be7b9){return new BPromise(function(_0x4dd221,_0x4cd357){var _0x260350=nodemailer[_0x3fa4('0x5')](_0x5be7b9);_0x260350[_0x3fa4('0xa')](function(_0x5d9dbe,_0x1468ee){if(_0x5d9dbe){_0x4cd357(_0x5d9dbe['toString']());}else{if(_0x1468ee){_0x4dd221(_0x1468ee);}else{_0x4cd357(_0x3fa4('0xb'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x0a04=['verify','Not\x20verifired','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','toString'];(function(_0x3a23c1,_0x495d49){var _0x286863=function(_0x3accee){while(--_0x3accee){_0x3a23c1['push'](_0x3a23c1['shift']());}};_0x286863(++_0x495d49);}(_0x0a04,0x1b2));var _0x40a0=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0a04[_0x27af45];return _0x18df21;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x40a0('0x0'));var inlineBase64=require(_0x40a0('0x1'));function EmailSmtp(){}EmailSmtp[_0x40a0('0x2')][_0x40a0('0x3')]=function(_0x44895e,_0x4df932){return new BPromise(function(_0x4dbf1d,_0x2fb052){var _0x38e357=nodemailer[_0x40a0('0x4')](_0x44895e);_0x38e357['use'](_0x40a0('0x5'),inlineBase64());_0x38e357['sendMail'](_0x4df932,function(_0x5aa468,_0x219122){if(_0x5aa468){_0x2fb052(_0x5aa468[_0x40a0('0x6')]());}else{_0x4dbf1d(_0x219122);}});});};EmailSmtp[_0x40a0('0x2')][_0x40a0('0x7')]=function(_0x5df87b){return new BPromise(function(_0x800672,_0x140e1e){var _0x139bf2=nodemailer[_0x40a0('0x4')](_0x5df87b);_0x139bf2[_0x40a0('0x7')](function(_0x5f378e,_0x599114){if(_0x5f378e){_0x140e1e(_0x5f378e[_0x40a0('0x6')]());}else{if(_0x599114){_0x800672(_0x599114);}else{_0x140e1e(_0x40a0('0x8'));}}});});};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 8b43a27..c95255d 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 _0x5a43=['

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','head','value','address','anonymous','generate','name','split','slice','join','Anonymous','length','pop','isEmpty','@xcally.com','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x3d777f[_0x35a4('0xe')](0x0,-0x1)[_0x35a4('0xf')]('\x20'):_0xbd156f[_0x35a4('0xc')];}return _0x35a4('0x10');}function getLastName(_0x5c62b5){var _0x10d1de=_[_0x35a4('0x7')](_0x5c62b5['value']);if(_0x10d1de&&_0x10d1de[_0x35a4('0xc')]){var _0x5dd749=_0x10d1de[_0x35a4('0xc')][_0x35a4('0xd')](/\s+/);return _0x5dd749[_0x35a4('0x11')]>0x1?_0x5dd749[_0x35a4('0x12')]():'';}return'';}function getMails(_0x2609a7,_0x17601e){var _0x4111b7='';for(var _0x26a97e=0x0;_0x26a97e<_0x17601e[_0x35a4('0x8')]['length'];_0x26a97e+=0x1){if(_0x17601e[_0x35a4('0x8')][_0x26a97e][_0x35a4('0x9')]!==_0x2609a7){if(!_[_0x35a4('0x13')](_0x4111b7)){_0x4111b7+=',';}_0x4111b7+=_0x17601e[_0x35a4('0x8')][_0x26a97e][_0x35a4('0xc')]||_0x17601e[_0x35a4('0x8')][_0x26a97e][_0x35a4('0x9')]||'';_0x4111b7+='\x20<';_0x4111b7+=_0x17601e[_0x35a4('0x8')][_0x26a97e]['address']?_0x17601e[_0x35a4('0x8')][_0x26a97e]['address']:'anonymous'+random[_0x35a4('0xb')](0x6)+_0x35a4('0x14');_0x4111b7+='>';}}return _0x4111b7;}function parseEmail(_0x17c362,_0x4a39ed,_0x24f6fe){if(_0x4a39ed[_0x35a4('0x15')]){var _0x44121d=/)<[^<]*)*<\/script>/gi;while(_0x44121d['test'](_0x4a39ed[_0x35a4('0x15')])){_0x4a39ed[_0x35a4('0x15')]=_0x4a39ed['html'][_0x35a4('0x16')](_0x44121d,'');}if(_0x4a39ed[_0x35a4('0x15')][_0x35a4('0x17')](_0x35a4('0x18'))){var _0x4d9983=[];_0x4a39ed['attachments'][_0x35a4('0x19')](_0x540ef8=>{_0x4d9983[_0x35a4('0x1a')](_0x540ef8[_0x35a4('0x1b')]);});var _0x1d0cfc=/]+>/g;var _0x3d80e4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x446cd1=_0x4a39ed[_0x35a4('0x15')]['replace'](_0x3d80e4,'_SRC');var _0x56456e=_0x446cd1[_0x35a4('0x16')](_0x1d0cfc,_0x35a4('0x1c'));for(let _0x4caf12=0x0;_0x4caf12<_0x4d9983['length'];_0x4caf12++){var _0x7d2c5=_0x56456e[_0x35a4('0x16')](_0x35a4('0x1c'),_0x35a4('0x1d')+_0x4d9983[_0x4caf12]+'\x20]');_0x56456e=_0x7d2c5;}_0x4a39ed['html']=_0x56456e;}_0x24f6fe['body']=_0x4a39ed['html'];}else{_0x24f6fe[_0x35a4('0x1e')]=_0x4a39ed[_0x35a4('0x1f')];}if(_0x24f6fe[_0x35a4('0x1e')]){_0x24f6fe[_0x35a4('0x1e')]=_0x24f6fe[_0x35a4('0x1e')][_0x35a4('0x16')](/0x0){var _0x25a4f2=[_0x35a4('0x31'),_0x35a4('0x32'),'Precedence:\x20auto_reply'];for(var _0x253047=0x0;_0x253047<_0x4a39ed['headerLines'][_0x35a4('0x11')];_0x253047++){var _0x188305=_[_0x35a4('0x33')](_0x25a4f2,_0x4a39ed[_0x35a4('0x30')][_0x253047][_0x35a4('0x34')]);if(_0x188305>=0x0){_0x24f6fe[_0x35a4('0x35')]=!![];}}}return _0x24f6fe;}exports[_0x35a4('0x36')]=function(_0x5f6b75,_0x3e2f33,_0x40baf1){var _0x520763={'from':getAddress(_0x3e2f33[_0x35a4('0x37')]),'firstName':getFirstName(_0x3e2f33[_0x35a4('0x37')]),'lastName':getLastName(_0x3e2f33[_0x35a4('0x37')]),'mapKey':_0x35a4('0x23'),'message':{'from':getMails(_0x5f6b75[_0x35a4('0x23')],_0x3e2f33[_0x35a4('0x37')]),'to':_0x5f6b75[_0x35a4('0x23')],'cc':'','subject':_0x3e2f33['subject']||'','messageId':_0x3e2f33[_0x35a4('0x38')],'inReplyTo':_0x3e2f33[_0x35a4('0x39')],'sentAt':moment(_0x3e2f33[_0x35a4('0x3a')])['format'](_0x35a4('0x3b')),'attach':![],'attachments':[]}};if(!_0x3e2f33[_0x35a4('0x15')]&&!_0x3e2f33[_0x35a4('0x1f')]){var _0xc40659=_[_0x35a4('0x3c')](_0x3e2f33[_0x35a4('0x25')],{'contentType':_0x35a4('0x3d')});if(_0xc40659['length']){logger[_0x35a4('0x3e')](util['format'](_0x35a4('0x3f'),_0x3e2f33[_0x35a4('0x38')]));tnef[_0x35a4('0x40')](_[_0x35a4('0x41')](_0xc40659)['content'],function(_0x2c891a,_0x1e8a81){if(_0x1e8a81){_0x3e2f33[_0x35a4('0x15')]=_0x1e8a81[_0x35a4('0x42')]||_0x35a4('0x43');if(_0x1e8a81[_0x35a4('0x44')]){for(var _0x187a0c=0x0;_0x187a0c<_0x1e8a81[_0x35a4('0x44')][_0x35a4('0x11')];_0x187a0c++){var _0x535575=_0x1e8a81[_0x35a4('0x44')][_0x187a0c];_0x520763[_0x35a4('0x21')]['attachments'][_0x35a4('0x1a')]({'filename':_0x535575[_0x35a4('0x45')],'content':Buffer[_0x35a4('0x37')](_0x535575[_0x35a4('0x46')])});}}}_0x40baf1(parseEmail(_0x5f6b75,_0x3e2f33,_0x520763));});}else{_0x3e2f33['html']=_0x35a4('0x43');_0x40baf1(parseEmail(_0x5f6b75,_0x3e2f33,_0x520763));}}else{_0x40baf1(parseEmail(_0x5f6b75,_0x3e2f33,_0x520763));}};exports[_0x35a4('0x47')]=function(_0x9f692d){switch(_0x9f692d){case'gmail':return _0x35a4('0x48');case'yahoo':return _0x35a4('0x49');case _0x35a4('0x4a'):return'imap-mail.outlook.com';case _0x35a4('0x4b'):return'outlook.office365.com';}return _0x35a4('0x4c');}; \ No newline at end of file +var _0x032e=['

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','outlook.office365.com','127.0.0.1','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','length','join','Anonymous','split','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x58bbf1['slice'](0x0,-0x1)[_0xe032('0x10')]('\x20'):_0x1c06f0[_0xe032('0xd')];}return _0xe032('0x11');}function getLastName(_0x3164ab){var _0x34fd0b=_[_0xe032('0x7')](_0x3164ab[_0xe032('0x8')]);if(_0x34fd0b&&_0x34fd0b[_0xe032('0xd')]){var _0x1bf9e3=_0x34fd0b[_0xe032('0xd')][_0xe032('0x12')](/\s+/);return _0x1bf9e3[_0xe032('0xf')]>0x1?_0x1bf9e3[_0xe032('0x13')]():'';}return'';}function getMails(_0x40a175,_0x2dc16f){var _0x2e868b='';for(var _0x49c0c6=0x0;_0x49c0c6<_0x2dc16f['value'][_0xe032('0xf')];_0x49c0c6+=0x1){if(_0x2dc16f['value'][_0x49c0c6][_0xe032('0x9')]!==_0x40a175){if(!_[_0xe032('0x14')](_0x2e868b)){_0x2e868b+=',';}_0x2e868b+=_0x2dc16f[_0xe032('0x8')][_0x49c0c6][_0xe032('0xd')]||_0x2dc16f[_0xe032('0x8')][_0x49c0c6][_0xe032('0x9')]||'';_0x2e868b+='\x20<';_0x2e868b+=_0x2dc16f[_0xe032('0x8')][_0x49c0c6][_0xe032('0x9')]?_0x2dc16f[_0xe032('0x8')][_0x49c0c6][_0xe032('0x9')]:_0xe032('0xa')+random[_0xe032('0xb')](0x6)+_0xe032('0xc');_0x2e868b+='>';}}return _0x2e868b;}function parseEmail(_0x3930a3,_0x1a159d,_0x2171b6){if(_0x1a159d[_0xe032('0x15')]){var _0x448e8a=/)<[^<]*)*<\/script>/gi;while(_0x448e8a[_0xe032('0x16')](_0x1a159d['html'])){_0x1a159d[_0xe032('0x15')]=_0x1a159d['html'][_0xe032('0x17')](_0x448e8a,'');}if(_0x1a159d[_0xe032('0x15')][_0xe032('0x18')](_0xe032('0x19'))){var _0x51d0e5=[];_0x1a159d[_0xe032('0x1a')][_0xe032('0x1b')](_0x25aa53=>{_0x51d0e5['push'](_0x25aa53['filename']);});var _0x2cf48c=/]+>/g;var _0x441fe9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xdbc726=_0x1a159d[_0xe032('0x15')][_0xe032('0x17')](_0x441fe9,'_SRC');var _0x3542c7=_0xdbc726[_0xe032('0x17')](_0x2cf48c,_0xe032('0x1c'));for(let _0x5dad93=0x0;_0x5dad93<_0x51d0e5[_0xe032('0xf')];_0x5dad93++){var _0x5b917d=_0x3542c7[_0xe032('0x17')](_0xe032('0x1c'),_0xe032('0x1d')+_0x51d0e5[_0x5dad93]+_0xe032('0x1e'));_0x3542c7=_0x5b917d;}_0x1a159d['html']=_0x3542c7;}_0x2171b6[_0xe032('0x1f')]=_0x1a159d['html'];}else{_0x2171b6['body']=_0x1a159d['textAsHtml'];}if(_0x2171b6['body']){_0x2171b6['body']=_0x2171b6[_0xe032('0x1f')][_0xe032('0x17')](/0x0){var _0x315dc3=['Auto-Submitted:\x20auto-replied',_0xe032('0x30'),'Precedence:\x20auto_reply'];for(var _0x5a484b=0x0;_0x5a484b<_0x1a159d['headerLines'][_0xe032('0xf')];_0x5a484b++){var _0x1079f6=_[_0xe032('0x31')](_0x315dc3,_0x1a159d[_0xe032('0x2f')][_0x5a484b][_0xe032('0x32')]);if(_0x1079f6>=0x0){_0x2171b6[_0xe032('0x33')]=!![];}}}return _0x2171b6;}exports[_0xe032('0x34')]=function(_0x10523b,_0x177c47,_0x1361d9){var _0x3903af={'from':getAddress(_0x177c47[_0xe032('0x35')]),'firstName':getFirstName(_0x177c47[_0xe032('0x35')]),'lastName':getLastName(_0x177c47[_0xe032('0x35')]),'mapKey':_0xe032('0x5'),'message':{'from':getMails(_0x10523b[_0xe032('0x5')],_0x177c47['from']),'to':_0x10523b['email'],'cc':'','subject':_0x177c47[_0xe032('0x36')]||'','messageId':_0x177c47[_0xe032('0x37')],'inReplyTo':_0x177c47[_0xe032('0x38')],'sentAt':moment(_0x177c47[_0xe032('0x39')])[_0xe032('0x29')](_0xe032('0x3a')),'attach':![],'attachments':[]}};if(!_0x177c47['html']&&!_0x177c47[_0xe032('0x3b')]){var _0x3e33e5=_[_0xe032('0x3c')](_0x177c47[_0xe032('0x1a')],{'contentType':_0xe032('0x3d')});if(_0x3e33e5[_0xe032('0xf')]){logger[_0xe032('0x3e')](util[_0xe032('0x29')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x177c47['messageId']));tnef['parseBuffer'](_[_0xe032('0x3f')](_0x3e33e5)['content'],function(_0x1f3ad4,_0x43972a){if(_0x43972a){_0x177c47[_0xe032('0x15')]=_0x43972a[_0xe032('0x40')]||_0xe032('0x41');if(_0x43972a[_0xe032('0x42')]){for(var _0x5cecec=0x0;_0x5cecec<_0x43972a[_0xe032('0x42')][_0xe032('0xf')];_0x5cecec++){var _0x2a7f87=_0x43972a[_0xe032('0x42')][_0x5cecec];_0x3903af[_0xe032('0x21')]['attachments']['push']({'filename':_0x2a7f87[_0xe032('0x43')],'content':Buffer[_0xe032('0x35')](_0x2a7f87[_0xe032('0x44')])});}}}_0x1361d9(parseEmail(_0x10523b,_0x177c47,_0x3903af));});}else{_0x177c47[_0xe032('0x15')]=_0xe032('0x41');_0x1361d9(parseEmail(_0x10523b,_0x177c47,_0x3903af));}}else{_0x1361d9(parseEmail(_0x10523b,_0x177c47,_0x3903af));}};exports[_0xe032('0x45')]=function(_0x2c812b){switch(_0x2c812b){case _0xe032('0x46'):return _0xe032('0x47');case'yahoo':return _0xe032('0x48');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xe032('0x49');}return _0xe032('0x4a');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d10ed98..ecc0ff6 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 _0x9dd5=['lodash','name','key','SERV','active','Imap','Smtp'];(function(_0x3c2666,_0x15fd23){var _0x10c814=function(_0x4660c0){while(--_0x4660c0){_0x3c2666['push'](_0x3c2666['shift']());}};_0x10c814(++_0x15fd23);}(_0x9dd5,0x1a4));var _0x59dd=function(_0x342e0f,_0x251d5d){_0x342e0f=_0x342e0f-0x0;var _0x5995b2=_0x9dd5[_0x342e0f];return _0x5995b2;};'use strict';var _=require(_0x59dd('0x0'));function MailAccount(_0x4856ca){this['id']=_0x4856ca['id']||0x0;this[_0x59dd('0x1')]=_0x4856ca[_0x59dd('0x1')]||'Service';this[_0x59dd('0x2')]=_0x4856ca[_0x59dd('0x2')]||_0x59dd('0x3');this[_0x59dd('0x4')]=_0x4856ca['active']||![];this[_0x59dd('0x5')]=_0x4856ca[_0x59dd('0x5')]||[];this[_0x59dd('0x6')]=_0x4856ca['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x60b1=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x370a97,_0x3eedc2){var _0x2f1ddb=function(_0x27be35){while(--_0x27be35){_0x370a97['push'](_0x370a97['shift']());}};_0x2f1ddb(++_0x3eedc2);}(_0x60b1,0x79));var _0x160b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x60b1[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x160b('0x0'));function MailAccount(_0x423c6e){this['id']=_0x423c6e['id']||0x0;this[_0x160b('0x1')]=_0x423c6e[_0x160b('0x1')]||_0x160b('0x2');this['key']=_0x423c6e[_0x160b('0x3')]||_0x160b('0x4');this[_0x160b('0x5')]=_0x423c6e[_0x160b('0x5')]||![];this[_0x160b('0x6')]=_0x423c6e[_0x160b('0x6')]||[];this[_0x160b('0x7')]=_0x423c6e['Smtp']||[];}module[_0x160b('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 531f9a2..6c4f16b 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 _0x18ba=['initMailAccounts','length','merge','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x18ba,0x108));var _0xa18b=function(_0x55ef5d,_0x5a5786){_0x55ef5d=_0x55ef5d-0x0;var _0x20ed8f=_0x18ba[_0x55ef5d];return _0x20ed8f;};'use strict';var _=require('lodash');var MailAccount=require(_0xa18b('0x0'));var Realtime=function(){this[_0xa18b('0x1')]={};};function freeIsNotKey(_0x257cb7,_0x4943b5,_0x454ee5){var _0x2741e9=_[_0xa18b('0x2')](_0x257cb7,function(_0x165a1c,_0x4d7539){return _0x165a1c[_0x454ee5];});for(var _0x4ef899 in _0x4943b5){if(_0x4943b5[_0xa18b('0x3')](_0x4ef899)){if(!_0x2741e9[_0x4ef899]){delete _0x4943b5[_0x4ef899];}}}}Realtime[_0xa18b('0x4')][_0xa18b('0x5')]=function(_0x25285e,_0x2e935f){for(var _0x328a8c in _0x2e935f){if(_0x25285e[_0xa18b('0x3')](_0x328a8c)){_0x25285e[_0x328a8c]=_0x2e935f[_0x328a8c];}}};Realtime[_0xa18b('0x4')][_0xa18b('0x6')]=function(){var _0x365ef3=this;return function(_0x40d873){if(_0x40d873){freeIsNotKey(_0x40d873,_0x365ef3[_0xa18b('0x1')],'id');for(var _0x4ac089=0x0,_0x3028d0={},_0x25afcb={};_0x4ac089<_0x40d873[_0xa18b('0x7')];_0x4ac089+=0x1){_0x3028d0=_0x40d873[_0x4ac089];if(_['isUndefined'](_0x365ef3[_0xa18b('0x1')][_0x3028d0['id']])){_0x365ef3['mailAccounts'][_0x3028d0['id']]=new MailAccount(_0x3028d0);}else{_[_0xa18b('0x8')](_0x365ef3[_0xa18b('0x1')][_0x3028d0['id']],_0x3028d0);}}}return _0x365ef3[_0xa18b('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x1889=['merge','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1889,0x6f));var _0x9188=function(_0x3d062f,_0x886f87){_0x3d062f=_0x3d062f-0x0;var _0xab1f8c=_0x1889[_0x3d062f];return _0xab1f8c;};'use strict';var _=require(_0x9188('0x0'));var MailAccount=require(_0x9188('0x1'));var Realtime=function(){this[_0x9188('0x2')]={};};function freeIsNotKey(_0x44e4bd,_0x29cc3a,_0x2807c8){var _0x10cd73=_[_0x9188('0x3')](_0x44e4bd,function(_0x23f138,_0x1aaa66){return _0x23f138[_0x2807c8];});for(var _0x3d3a6d in _0x29cc3a){if(_0x29cc3a['hasOwnProperty'](_0x3d3a6d)){if(!_0x10cd73[_0x3d3a6d]){delete _0x29cc3a[_0x3d3a6d];}}}}Realtime[_0x9188('0x4')][_0x9188('0x5')]=function(_0x19cb28,_0x1045b3){for(var _0x45b501 in _0x1045b3){if(_0x19cb28[_0x9188('0x6')](_0x45b501)){_0x19cb28[_0x45b501]=_0x1045b3[_0x45b501];}}};Realtime[_0x9188('0x4')][_0x9188('0x7')]=function(){var _0x3da52e=this;return function(_0x56a9c9){if(_0x56a9c9){freeIsNotKey(_0x56a9c9,_0x3da52e[_0x9188('0x2')],'id');for(var _0x2c2fcd=0x0,_0x2bb654={},_0x5b27c6={};_0x2c2fcd<_0x56a9c9[_0x9188('0x8')];_0x2c2fcd+=0x1){_0x2bb654=_0x56a9c9[_0x2c2fcd];if(_[_0x9188('0x9')](_0x3da52e[_0x9188('0x2')][_0x2bb654['id']])){_0x3da52e[_0x9188('0x2')][_0x2bb654['id']]=new MailAccount(_0x2bb654);}else{_[_0x9188('0xa')](_0x3da52e[_0x9188('0x2')][_0x2bb654['id']],_0x2bb654);}}}return _0x3da52e[_0x9188('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 d1f432b..6f6fb91 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 _0xae75=['notify','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xae75,0xce));var _0x5ae7=function(_0x16483d,_0x21b6b7){_0x16483d=_0x16483d-0x0;var _0xf89ced=_0xae75[_0x16483d];return _0xf89ced;};'use strict';var client=require(_0x5ae7('0x0'));exports[_0x5ae7('0x1')]=function(){return function(){return client['Request'](_0x5ae7('0x2'),{'options':{'attributes':['id',_0x5ae7('0x3'),_0x5ae7('0x4'),_0x5ae7('0x5'),_0x5ae7('0x6'),_0x5ae7('0x7'),_0x5ae7('0x8'),_0x5ae7('0x9')],'raw':![],'include':[{'model':_0x5ae7('0xa'),'as':_0x5ae7('0xb')},{'model':_0x5ae7('0xc'),'as':_0x5ae7('0xd')}]},'log':_0x5ae7('0xe')});};};exports[_0x5ae7('0xf')]=function(_0x20cf0b,_0x2f013b){return client['Request'](_0x5ae7('0x10'),{'account':{'id':_0x20cf0b},'body':_0x2f013b,'log':_0x5ae7('0x10')});}; \ No newline at end of file +var _0x65da=['notify','NotifyMailAccount','../client','Request','GetMailAccount','name','email','active','key','ListId','TemplateId','MailServerOut','Smtp','getMailAccount'];(function(_0x5caefe,_0x3ab24c){var _0x51b84a=function(_0x143b22){while(--_0x143b22){_0x5caefe['push'](_0x5caefe['shift']());}};_0x51b84a(++_0x3ab24c);}(_0x65da,0x152));var _0xa65d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x65da[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xa65d('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xa65d('0x1')](_0xa65d('0x2'),{'options':{'attributes':['id',_0xa65d('0x3'),'service',_0xa65d('0x4'),_0xa65d('0x5'),_0xa65d('0x6'),_0xa65d('0x7'),_0xa65d('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':_0xa65d('0x9'),'as':_0xa65d('0xa')}]},'log':_0xa65d('0xb')});};};exports[_0xa65d('0xc')]=function(_0x1631de,_0x13ed40){return client[_0xa65d('0x1')]('NotifyMailAccount',{'account':{'id':_0x1631de},'body':_0x13ed40,'log':_0xa65d('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7eedef5..8252297 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 _0xe1e6=['Request','ShowSetting','GetSettings','getSettings'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe1e6,0x16b));var _0x6e1e=function(_0x294ec2,_0x55b941){_0x294ec2=_0x294ec2-0x0;var _0x556a6a=_0xe1e6[_0x294ec2];return _0x556a6a;};'use strict';var client=require('../client');exports[_0x6e1e('0x0')]=function(){return client[_0x6e1e('0x1')](_0x6e1e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x6e1e('0x3')});}; \ No newline at end of file +var _0xa225=['ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x259936,_0x239e8f){var _0x5d5ee8=function(_0x4f3ce9){while(--_0x4f3ce9){_0x259936['push'](_0x259936['shift']());}};_0x5d5ee8(++_0x239e8f);}(_0xa225,0xff));var _0x5a22=function(_0x295157,_0x4c5a00){_0x295157=_0x295157-0x0;var _0xf7a089=_0xa225[_0x295157];return _0xf7a089;};'use strict';var client=require(_0x5a22('0x0'));exports['getSettings']=function(){return client['Request'](_0x5a22('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5a22('0x2')]},'log':_0x5a22('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 72ceb92..1aaa7f0 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 ef1f6fc..ac04de2 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 _0xa4e8=['../../config/environment','timeout','listen','port','socket.io','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xa4e8,0x9c));var _0x8a4e=function(_0xb20c48,_0x175a17){_0xb20c48=_0xb20c48-0x0;var _0x39383a=_0xa4e8[_0xb20c48];return _0x39383a;};'use strict';var _=require(_0x8a4e('0x0'));var http=require(_0x8a4e('0x1'));var express=require(_0x8a4e('0x2'));var sticky=require(_0x8a4e('0x3'));var Redis=require(_0x8a4e('0x4'));var config=require(_0x8a4e('0x5'));var app=express();var server=http['createServer'](app);server[_0x8a4e('0x6')]=0xdbba0;if(sticky[_0x8a4e('0x7')](server,config[_0x8a4e('0x8')])){var socketio=require(_0x8a4e('0x9'))(server,{'transports':['websocket','polling']});config['redis']=_[_0x8a4e('0xa')](config[_0x8a4e('0xb')],{'host':_0x8a4e('0xc'),'port':0x18eb});socketio[_0x8a4e('0xd')](require(_0x8a4e('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x8a4e('0xb')])}));require(_0x8a4e('0xf'))['default']();require('../../config/socketio')[_0x8a4e('0x10')](socketio);require('../../config/express')['default'](app);require(_0x8a4e('0x11'))[_0x8a4e('0x10')](app);}else{server[_0x8a4e('0x12')](_0x8a4e('0x13'),function(){console[_0x8a4e('0x14')](_0x8a4e('0x15'),config[_0x8a4e('0x8')]);});}exports=module[_0x8a4e('0x16')]=app; \ No newline at end of file +var _0x568b=['default','../../config/express','../../routes','once','listening','log','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','redis','defaults','localhost','adapter','../../config/triggers','../../config/socketio'];(function(_0x578439,_0x69195e){var _0x34d692=function(_0x1d92a2){while(--_0x1d92a2){_0x578439['push'](_0x578439['shift']());}};_0x34d692(++_0x69195e);}(_0x568b,0x149));var _0xb568=function(_0x2c01f7,_0x249b79){_0x2c01f7=_0x2c01f7-0x0;var _0x4b142a=_0x568b[_0x2c01f7];return _0x4b142a;};'use strict';var _=require(_0xb568('0x0'));var http=require(_0xb568('0x1'));var express=require('express');var sticky=require(_0xb568('0x2'));var Redis=require(_0xb568('0x3'));var config=require(_0xb568('0x4'));var app=express();var server=http[_0xb568('0x5')](app);server[_0xb568('0x6')]=0xdbba0;if(sticky[_0xb568('0x7')](server,config[_0xb568('0x8')])){var socketio=require(_0xb568('0x9'))(server,{'transports':['websocket','polling']});config[_0xb568('0xa')]=_[_0xb568('0xb')](config[_0xb568('0xa')],{'host':_0xb568('0xc'),'port':0x18eb});socketio[_0xb568('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xb568('0xa')]),'subClient':new Redis(config[_0xb568('0xa')])}));require(_0xb568('0xe'))['default']();require(_0xb568('0xf'))[_0xb568('0x10')](socketio);require(_0xb568('0x11'))['default'](app);require(_0xb568('0x12'))[_0xb568('0x10')](app);}else{server[_0xb568('0x13')](_0xb568('0x14'),function(){console[_0xb568('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xb568('0x8')]);});}exports=module[_0xb568('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index bc0a594..7b0eeb1 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 _0x1831=['jayson/promise','../../config/logger','routing','http','Request','request','debug','rpc','error','message','exports'];(function(_0x5ce4e3,_0x42cb9a){var _0x42248f=function(_0x22ab0f){while(--_0x22ab0f){_0x5ce4e3['push'](_0x5ce4e3['shift']());}};_0x42248f(++_0x42cb9a);}(_0x1831,0x84));var _0x1183=function(_0x2a8f38,_0x5ed3ca){_0x2a8f38=_0x2a8f38-0x0;var _0x3504a4=_0x1831[_0x2a8f38];return _0x3504a4;};'use strict';var jayson=require(_0x1183('0x0'));var BPromise=require('bluebird');var logger=require(_0x1183('0x1'))(_0x1183('0x2'));var client=jayson['client'][_0x1183('0x3')]({'port':0x2329});client[_0x1183('0x4')]=function(_0x58c3bc,_0x13c770){return new BPromise(function(_0x4b8167,_0x59731f){return client[_0x1183('0x5')](_0x58c3bc,_0x13c770)['then'](function(_0x27b468){logger[_0x1183('0x6')](_0x1183('0x7'),_0x1183('0x2'),_0x58c3bc,_0x13c770,_0x27b468);if(_0x27b468['error']){logger[_0x1183('0x8')]('rpc',_0x1183('0x2'),_0x58c3bc,_0x27b468[_0x1183('0x8')]['message'],_0x13c770);return _0x59731f(_0x27b468[_0x1183('0x8')][_0x1183('0x9')]);}else{return _0x4b8167(_0x27b468['result']);}})['catch'](function(_0x29d346){logger['error'](_0x1183('0x7'),_0x1183('0x2'),_0x58c3bc,_0x29d346,_0x13c770);return _0x59731f(_0x29d346);});});};module[_0x1183('0xa')]=client; \ No newline at end of file +var _0x9b75=['Request','rpc','error','message','result','bluebird','routing','client','http'];(function(_0x567168,_0x49d7f9){var _0x399cf3=function(_0x1094fc){while(--_0x1094fc){_0x567168['push'](_0x567168['shift']());}};_0x399cf3(++_0x49d7f9);}(_0x9b75,0x191));var _0x59b7=function(_0x14df3d,_0x14d827){_0x14df3d=_0x14df3d-0x0;var _0x56cc87=_0x9b75[_0x14df3d];return _0x56cc87;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x59b7('0x0'));var logger=require('../../config/logger')(_0x59b7('0x1'));var client=jayson[_0x59b7('0x2')][_0x59b7('0x3')]({'port':0x2329});client[_0x59b7('0x4')]=function(_0x3a199e,_0x14cfdf){return new BPromise(function(_0x3c886f,_0x1f2ade){return client['request'](_0x3a199e,_0x14cfdf)['then'](function(_0x2b7b2f){logger['debug'](_0x59b7('0x5'),_0x59b7('0x1'),_0x3a199e,_0x14cfdf,_0x2b7b2f);if(_0x2b7b2f[_0x59b7('0x6')]){logger[_0x59b7('0x6')](_0x59b7('0x5'),_0x59b7('0x1'),_0x3a199e,_0x2b7b2f[_0x59b7('0x6')][_0x59b7('0x7')],_0x14cfdf);return _0x1f2ade(_0x2b7b2f[_0x59b7('0x6')][_0x59b7('0x7')]);}else{return _0x3c886f(_0x2b7b2f[_0x59b7('0x8')]);}})['catch'](function(_0x4bc1c7){logger['error']('rpc',_0x59b7('0x1'),_0x3a199e,_0x4bc1c7,_0x14cfdf);return _0x1f2ade(_0x4bc1c7);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c58bba3..68c9d3f 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 _0x3cd8=['initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x3cd8,0x17f));var _0x83cd=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0x3cd8[_0x449b81];return _0xb9b60c;};'use strict';var BPromise=require('bluebird');var server=require(_0x83cd('0x0'));var Realtime=require(_0x83cd('0x1'));var user=require('./rpc/user');var interval=require(_0x83cd('0x2'));var openchannelQueue=require(_0x83cd('0x3'));var chatQueue=require(_0x83cd('0x4'));var smsQueue=require(_0x83cd('0x5'));var mailQueue=require(_0x83cd('0x6'));var faxQueue=require(_0x83cd('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x83cd('0x8')](user[_0x83cd('0x9')]())[_0x83cd('0x8')](realtime[_0x83cd('0xa')]())['then'](interval['getIntervals']())[_0x83cd('0x8')](realtime[_0x83cd('0xb')]())['then'](openchannelQueue[_0x83cd('0xc')]())[_0x83cd('0x8')](realtime[_0x83cd('0xd')]())['then'](chatQueue[_0x83cd('0xe')]())[_0x83cd('0x8')](realtime['initChatQueues']())['then'](smsQueue[_0x83cd('0xf')]())[_0x83cd('0x8')](realtime[_0x83cd('0x10')]())[_0x83cd('0x8')](mailQueue['getMailQueues']())[_0x83cd('0x8')](realtime[_0x83cd('0x11')]())[_0x83cd('0x8')](faxQueue[_0x83cd('0x12')]())[_0x83cd('0x8')](realtime[_0x83cd('0x13')]())[_0x83cd('0x8')](whatsappQueue[_0x83cd('0x14')]())[_0x83cd('0x8')](realtime[_0x83cd('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0x83cd('0x16')](realtime)[_0x83cd('0x8')](function(_0x2b8ce9){return initRealtime();})[_0x83cd('0x8')](function(_0x2c33c9){return setInterval(initRealtime,0x1388);})[_0x83cd('0x17')](function(_0x48602e){console[_0x83cd('0x18')](_0x48602e);});}main(); \ No newline at end of file +var _0xbfc0=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird'];(function(_0x13d368,_0x21263a){var _0x14b06f=function(_0x38ce7c){while(--_0x38ce7c){_0x13d368['push'](_0x13d368['shift']());}};_0x14b06f(++_0x21263a);}(_0xbfc0,0xad));var _0x0bfc=function(_0x34ed48,_0x2cc995){_0x34ed48=_0x34ed48-0x0;var _0x37da5c=_0xbfc0[_0x34ed48];return _0x37da5c;};'use strict';var BPromise=require(_0x0bfc('0x0'));var server=require('./server');var Realtime=require(_0x0bfc('0x1'));var user=require(_0x0bfc('0x2'));var interval=require(_0x0bfc('0x3'));var openchannelQueue=require(_0x0bfc('0x4'));var chatQueue=require(_0x0bfc('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x0bfc('0x6'));var faxQueue=require(_0x0bfc('0x7'));var whatsappQueue=require(_0x0bfc('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0bfc('0x9')]()[_0x0bfc('0xa')](user[_0x0bfc('0xb')]())[_0x0bfc('0xa')](realtime[_0x0bfc('0xc')]())[_0x0bfc('0xa')](interval[_0x0bfc('0xd')]())['then'](realtime[_0x0bfc('0xe')]())[_0x0bfc('0xa')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x0bfc('0xf')]())['then'](chatQueue[_0x0bfc('0x10')]())[_0x0bfc('0xa')](realtime[_0x0bfc('0x11')]())[_0x0bfc('0xa')](smsQueue[_0x0bfc('0x12')]())['then'](realtime[_0x0bfc('0x13')]())[_0x0bfc('0xa')](mailQueue[_0x0bfc('0x14')]())[_0x0bfc('0xa')](realtime[_0x0bfc('0x15')]())[_0x0bfc('0xa')](faxQueue[_0x0bfc('0x16')]())[_0x0bfc('0xa')](realtime[_0x0bfc('0x17')]())[_0x0bfc('0xa')](whatsappQueue[_0x0bfc('0x18')]())['then'](realtime[_0x0bfc('0x19')]())[_0x0bfc('0xa')](function(){return realtime;});}function main(){return server[_0x0bfc('0x1a')](realtime)['then'](function(_0x35ce21){return initRealtime();})['then'](function(_0x2d633a){return setInterval(initRealtime,0x1388);})[_0x0bfc('0x1b')](function(_0x2d5268){console[_0x0bfc('0x1c')](_0x2d5268);});}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 75c9eb7..b00464a 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 _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(_0x406212,_0x1a399b){var _0x52034a=function(_0x15a143){while(--_0x15a143){_0x406212['push'](_0x406212['shift']());}};_0x52034a(++_0x1a399b);}(_0xe14b,0x93));var _0xbe14=function(_0x543c09,_0x2a1922){_0x543c09=_0x543c09-0x0;var _0x1ff237=_0xe14b[_0x543c09];return _0x1ff237;};'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 +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(_0x4f7618,_0x243df2){var _0x20ba5f=function(_0x1bfe65){while(--_0x1bfe65){_0x4f7618['push'](_0x4f7618['shift']());}};_0x20ba5f(++_0x243df2);}(_0x326f,0xd1));var _0xf326=function(_0x4194aa,_0x32b281){_0x4194aa=_0x4194aa-0x0;var _0x39b1c8=_0x326f[_0x4194aa];return _0x39b1c8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 5fa9062..d7746f6 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 _0x2f84=['result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error'];(function(_0x15b647,_0x17a273){var _0x32cd1c=function(_0x526b3d){while(--_0x526b3d){_0x15b647['push'](_0x15b647['shift']());}};_0x32cd1c(++_0x17a273);}(_0x2f84,0xa4));var _0x42f8=function(_0x3e9d0a,_0x485b25){_0x3e9d0a=_0x3e9d0a-0x0;var _0x7390da=_0x2f84[_0x3e9d0a];return _0x7390da;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x42f8('0x0'));var client=jayson[_0x42f8('0x1')][_0x42f8('0x2')]({'port':0x232b});function request(_0xfe2b15,_0x5ecb42){return new BPromise(function(_0x298111,_0x2552a1){return client[_0x42f8('0x3')](_0xfe2b15,_0x5ecb42)[_0x42f8('0x4')](function(_0x5e1cc3){if(_0x5e1cc3['error']){return _0x2552a1(_0x5e1cc3[_0x42f8('0x5')]['message']);}else{return _0x298111(_0x5e1cc3[_0x42f8('0x6')]);}})[_0x42f8('0x7')](function(_0x5e2406){return _0x2552a1(_0x5e2406);});});}exports[_0x42f8('0x8')]=function(_0x30ee0d,_0xd3fad7){return request(_0x42f8('0x9'),{'account':_0x30ee0d,'message':_0xd3fad7});}; \ No newline at end of file +var _0x842e=['message','result','catch','bluebird','http','request','error'];(function(_0x20b993,_0xd9b135){var _0x2b23a4=function(_0x19359d){while(--_0x19359d){_0x20b993['push'](_0x20b993['shift']());}};_0x2b23a4(++_0xd9b135);}(_0x842e,0x15a));var _0xe842=function(_0x319fa0,_0x31377a){_0x319fa0=_0x319fa0-0x0;var _0x464fee=_0x842e[_0x319fa0];return _0x464fee;};'use strict';var BPromise=require(_0xe842('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe842('0x1')]({'port':0x232b});function request(_0x1dcde0,_0x4a322f){return new BPromise(function(_0x137e6f,_0x4f06c1){return client[_0xe842('0x2')](_0x1dcde0,_0x4a322f)['then'](function(_0x42ebab){if(_0x42ebab[_0xe842('0x3')]){return _0x4f06c1(_0x42ebab[_0xe842('0x3')][_0xe842('0x4')]);}else{return _0x137e6f(_0x42ebab[_0xe842('0x5')]);}})[_0xe842('0x6')](function(_0x56ed26){return _0x4f06c1(_0x56ed26);});});}exports['sendMailMessage']=function(_0x8344cf,_0x13b882){return request('SendMail',{'account':_0x8344cf,'message':_0x13b882});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index e3c621c..fe5cdc4 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 _0x18ba=['faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','mail','chat','fax','sms','length','Status','StatusTime','toNumber','format','online','chatStatus','faxStatus','whatsappStatus','stringify','md5','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x18ba,0x1a3));var _0xa18b=function(_0x1a66a5,_0x113afc){_0x1a66a5=_0x1a66a5-0x0;var _0x2e3523=_0x18ba[_0x1a66a5];return _0x2e3523;};'use strict';var _=require(_0xa18b('0x0'));var moment=require(_0xa18b('0x1'));var md5=require('md5');var Redis=require(_0xa18b('0x2'));var config=require(_0xa18b('0x3'));config[_0xa18b('0x4')]=_[_0xa18b('0x5')](config[_0xa18b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa18b('0x6'))(new Redis(config[_0xa18b('0x4')]));function Agent(_0x3475f1){this['id']=_0x3475f1['id']||0x0;this[_0xa18b('0x7')]=_0x3475f1[_0xa18b('0x7')]||'';this['online']=_0x3475f1['online']||!![];this['voicePause']=_0x3475f1[_0xa18b('0x8')]||![];this[_0xa18b('0x9')]=_0x3475f1[_0xa18b('0x9')]||![];this['mailPause']=_0x3475f1[_0xa18b('0xa')]||![];this[_0xa18b('0xb')]=_0x3475f1[_0xa18b('0xb')]||![];this[_0xa18b('0xc')]=_0x3475f1[_0xa18b('0xc')]||![];this[_0xa18b('0xd')]=_0x3475f1[_0xa18b('0xd')]||![];this['chatStatus']=_0xa18b('0xe');this[_0xa18b('0xf')]=0x0;this[_0xa18b('0x10')]=_0x3475f1[_0xa18b('0x10')]||0x0;this[_0xa18b('0x11')]=0x0;this[_0xa18b('0x12')]=_0xa18b('0xe');this[_0xa18b('0x13')]=0x0;this[_0xa18b('0x14')]=_0x3475f1[_0xa18b('0x14')]||0x0;this[_0xa18b('0x15')]=0x0;this['faxStatus']=_0xa18b('0xe');this[_0xa18b('0x16')]=0x0;this[_0xa18b('0x17')]=_0x3475f1[_0xa18b('0x17')]||0x0;this[_0xa18b('0x18')]=0x0;this[_0xa18b('0x19')]=_0xa18b('0xe');this[_0xa18b('0x1a')]=0x0;this['smsCapacity']=_0x3475f1[_0xa18b('0x1b')]||0x0;this[_0xa18b('0x1c')]=0x0;this['whatsappStatus']=_0xa18b('0xe');this[_0xa18b('0x1d')]=0x0;this[_0xa18b('0x1e')]=_0x3475f1[_0xa18b('0x1e')]||0x0;this[_0xa18b('0x1f')]=0x0;this[_0xa18b('0x20')]=_0xa18b('0xe');this[_0xa18b('0x21')]=0x0;this[_0xa18b('0x22')]=_0x3475f1['openchannelCapacity']||0x0;this[_0xa18b('0x23')]=0x0;this[_0xa18b('0x24')]=![];this[_0xa18b('0x25')]=undefined;this['md5']='';this[_0xa18b('0x26')]();}Agent[_0xa18b('0x27')][_0xa18b('0x28')]=function(_0x29b6fb){if(this[_0x29b6fb+'CurrentCapacity']>0x0){if(this[_0x29b6fb+_0xa18b('0x29')]>0x0&&this[_0x29b6fb+_0xa18b('0x2a')]>=this[_0x29b6fb+'Capacity']){return _0xa18b('0x2b');}else{return'working';}}else{return _0xa18b('0x2c');}};Agent['prototype'][_0xa18b('0x26')]=function(){var _0x2f4c2a=[_0xa18b('0x2d'),_0xa18b('0x2e'),'openchannel',_0xa18b('0x2f'),_0xa18b('0x30'),'whatsapp'];for(var _0x1bfedb=0x0;_0x1bfedb<_0x2f4c2a[_0xa18b('0x31')];_0x1bfedb+=0x1){var _0x9e0550=this[_0xa18b('0x28')](_0x2f4c2a[_0x1bfedb]);if(this[_0x2f4c2a[_0x1bfedb]+_0xa18b('0x32')]!==_0x9e0550){this[_0x2f4c2a[_0x1bfedb]+_0xa18b('0x33')]=_[_0xa18b('0x34')](moment()[_0xa18b('0x35')]('x'));}this[_0x2f4c2a[_0x1bfedb]+_0xa18b('0x32')]=_0x9e0550;}var _0x54f2c2={'id':this['id'],'name':this['name'],'online':this[_0xa18b('0x36')],'voicePause':this[_0xa18b('0x8')],'chatPause':this[_0xa18b('0x9')],'mailPause':this[_0xa18b('0xa')],'smsPause':this[_0xa18b('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xa18b('0x37')],'chatStatusTime':this[_0xa18b('0xf')],'chatCapacity':this[_0xa18b('0x10')],'chatCurrentCapacity':this[_0xa18b('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xa18b('0x13')],'mailCapacity':this[_0xa18b('0x14')],'mailCurrentCapacity':this[_0xa18b('0x15')],'faxStatus':this[_0xa18b('0x38')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xa18b('0x17')],'faxCurrentCapacity':this[_0xa18b('0x18')],'smsStatus':this[_0xa18b('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xa18b('0x1b')],'smsCurrentCapacity':this[_0xa18b('0x1c')],'whatsappStatus':this[_0xa18b('0x39')],'whatsappStatusTime':this[_0xa18b('0x1d')],'whatsappCapacity':this[_0xa18b('0x1e')],'whatsappCurrentCapacity':this[_0xa18b('0x1f')],'openchannelStatus':this[_0xa18b('0x20')],'openchannelStatusTime':this[_0xa18b('0x21')],'openchannelCapacity':this[_0xa18b('0x22')],'openchannelCurrentCapacity':this[_0xa18b('0x23')],'busy':this['busy'],'busyQueue':this[_0xa18b('0x25')]};var _0x390734=md5(JSON[_0xa18b('0x3a')](_0x54f2c2));if(this[_0xa18b('0x3b')]!==_0x390734){this[_0xa18b('0x3b')]=_0x390734;io[_0xa18b('0x3c')](_0xa18b('0x3d'),_0x54f2c2);}};module[_0xa18b('0x3e')]=Agent; \ No newline at end of file +var _0x5c38=['localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','updateRealtime','mail','chat','sms','whatsapp','length','Status','StatusTime','format','mailStatusTime','mailCurrentCapacity','smsStatusTime','whatsappCurrentCapacity','busyQueue','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','defaults','redis'];(function(_0x41283d,_0x404980){var _0x153bd8=function(_0xef10ef){while(--_0xef10ef){_0x41283d['push'](_0x41283d['shift']());}};_0x153bd8(++_0x404980);}(_0x5c38,0x189));var _0x85c3=function(_0xdf6fa9,_0x32f770){_0xdf6fa9=_0xdf6fa9-0x0;var _0x244c64=_0x5c38[_0xdf6fa9];return _0x244c64;};'use strict';var _=require('lodash');var moment=require(_0x85c3('0x0'));var md5=require(_0x85c3('0x1'));var Redis=require(_0x85c3('0x2'));var config=require(_0x85c3('0x3'));config['redis']=_[_0x85c3('0x4')](config[_0x85c3('0x5')],{'host':_0x85c3('0x6'),'port':0x18eb});var io=require(_0x85c3('0x7'))(new Redis(config[_0x85c3('0x5')]));function Agent(_0x4031d3){this['id']=_0x4031d3['id']||0x0;this[_0x85c3('0x8')]=_0x4031d3['name']||'';this[_0x85c3('0x9')]=_0x4031d3[_0x85c3('0x9')]||!![];this[_0x85c3('0xa')]=_0x4031d3['voicePause']||![];this[_0x85c3('0xb')]=_0x4031d3['chatPause']||![];this[_0x85c3('0xc')]=_0x4031d3[_0x85c3('0xc')]||![];this['faxPause']=_0x4031d3[_0x85c3('0xd')]||![];this[_0x85c3('0xe')]=_0x4031d3[_0x85c3('0xe')]||![];this[_0x85c3('0xf')]=_0x4031d3['openchannelPause']||![];this[_0x85c3('0x10')]=_0x85c3('0x11');this[_0x85c3('0x12')]=0x0;this[_0x85c3('0x13')]=_0x4031d3[_0x85c3('0x13')]||0x0;this[_0x85c3('0x14')]=0x0;this[_0x85c3('0x15')]=_0x85c3('0x11');this['mailStatusTime']=0x0;this['mailCapacity']=_0x4031d3['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x85c3('0x11');this[_0x85c3('0x16')]=0x0;this[_0x85c3('0x17')]=_0x4031d3[_0x85c3('0x17')]||0x0;this[_0x85c3('0x18')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x85c3('0x19')]=_0x4031d3[_0x85c3('0x19')]||0x0;this[_0x85c3('0x1a')]=0x0;this['whatsappStatus']='unknown';this[_0x85c3('0x1b')]=0x0;this[_0x85c3('0x1c')]=_0x4031d3[_0x85c3('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x85c3('0x1d')]=_0x85c3('0x11');this[_0x85c3('0x1e')]=0x0;this[_0x85c3('0x1f')]=_0x4031d3['openchannelCapacity']||0x0;this[_0x85c3('0x20')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x85c3('0x1')]='';this['updateRealtime']();}Agent[_0x85c3('0x21')][_0x85c3('0x22')]=function(_0x11d322){if(this[_0x11d322+'CurrentCapacity']>0x0){if(this[_0x11d322+_0x85c3('0x23')]>0x0&&this[_0x11d322+_0x85c3('0x24')]>=this[_0x11d322+'Capacity']){return _0x85c3('0x25');}else{return'working';}}else{return _0x85c3('0x26');}};Agent[_0x85c3('0x21')][_0x85c3('0x27')]=function(){var _0x5bbb7d=[_0x85c3('0x28'),_0x85c3('0x29'),'openchannel','fax',_0x85c3('0x2a'),_0x85c3('0x2b')];for(var _0x44f469=0x0;_0x44f469<_0x5bbb7d[_0x85c3('0x2c')];_0x44f469+=0x1){var _0x5bfe3c=this['getChannelStatus'](_0x5bbb7d[_0x44f469]);if(this[_0x5bbb7d[_0x44f469]+_0x85c3('0x2d')]!==_0x5bfe3c){this[_0x5bbb7d[_0x44f469]+_0x85c3('0x2e')]=_['toNumber'](moment()[_0x85c3('0x2f')]('x'));}this[_0x5bbb7d[_0x44f469]+_0x85c3('0x2d')]=_0x5bfe3c;}var _0x3d1a62={'id':this['id'],'name':this[_0x85c3('0x8')],'online':this[_0x85c3('0x9')],'voicePause':this[_0x85c3('0xa')],'chatPause':this[_0x85c3('0xb')],'mailPause':this[_0x85c3('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x85c3('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x85c3('0x10')],'chatStatusTime':this[_0x85c3('0x12')],'chatCapacity':this[_0x85c3('0x13')],'chatCurrentCapacity':this[_0x85c3('0x14')],'mailStatus':this[_0x85c3('0x15')],'mailStatusTime':this[_0x85c3('0x30')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x85c3('0x31')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x85c3('0x16')],'faxCapacity':this[_0x85c3('0x17')],'faxCurrentCapacity':this[_0x85c3('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x85c3('0x32')],'smsCapacity':this[_0x85c3('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x85c3('0x1b')],'whatsappCapacity':this[_0x85c3('0x1c')],'whatsappCurrentCapacity':this[_0x85c3('0x33')],'openchannelStatus':this[_0x85c3('0x1d')],'openchannelStatusTime':this[_0x85c3('0x1e')],'openchannelCapacity':this[_0x85c3('0x1f')],'openchannelCurrentCapacity':this[_0x85c3('0x20')],'busy':this['busy'],'busyQueue':this[_0x85c3('0x34')]};var _0x54e6e3=md5(JSON[_0x85c3('0x35')](_0x3d1a62));if(this['md5']!==_0x54e6e3){this[_0x85c3('0x1')]=_0x54e6e3;io[_0x85c3('0x36')](_0x85c3('0x37'),_0x3d1a62);}};module[_0x85c3('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 52de7a7..0c77d57 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 _0x1e87=['prototype','map','_rr','updateRealtime','paused','length','online','loggedIn','chatPause','available','stringify','format','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x4ae298,_0x2fcfd1){var _0x123d25=function(_0x1de7e8){while(--_0x1de7e8){_0x4ae298['push'](_0x4ae298['shift']());}};_0x123d25(++_0x2fcfd1);}(_0x1e87,0xed));var _0x71e8=function(_0xad80cb,_0x22e6d1){_0xad80cb=_0xad80cb-0x0;var _0x125f97=_0x1e87[_0xad80cb];return _0x125f97;};'use strict';var _=require(_0x71e8('0x0'));var md5=require('md5');var util=require(_0x71e8('0x1'));var Redis=require(_0x71e8('0x2'));var config=require(_0x71e8('0x3'));config['redis']=_['defaults'](config[_0x71e8('0x4')],{'host':_0x71e8('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x71e8('0x4')]));function ChatQueue(_0x4aae74){this['id']=_0x4aae74['id']||0x0;this[_0x71e8('0x6')]=_0x4aae74[_0x71e8('0x6')]||'';this[_0x71e8('0x7')]=_0x4aae74[_0x71e8('0x7')]||0xa;this[_0x71e8('0x8')]=_0x4aae74[_0x71e8('0x8')]||_0x71e8('0x9');this[_0x71e8('0xa')]=_0x4aae74['Agents'];this[_0x71e8('0xb')]={};this[_0x71e8('0xc')]=0x0;this[_0x71e8('0xd')]='';this[_0x71e8('0xe')]();this['updateRealtime']();}ChatQueue[_0x71e8('0xf')][_0x71e8('0xe')]=function(){var _0x502bf8=this[_0x71e8('0xb')]['_rr'];this[_0x71e8('0xb')]=_[_0x71e8('0x10')](this[_0x71e8('0xa')],'id');this[_0x71e8('0xb')][_0x71e8('0x11')]=_0x502bf8;};ChatQueue['prototype'][_0x71e8('0x12')]=function(){this['loggedIn']=0x0;this[_0x71e8('0x13')]=0x0;for(var _0x17e378=0x0;_0x17e378=0x0?this['available']:0x0;var _0x518972={'id':this['id'],'available':this[_0x71e8('0x18')],'loggedIn':this[_0x71e8('0x16')],'name':this[_0x71e8('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x478e56=md5(JSON[_0x71e8('0x19')](_0x518972));if(this['md5']!==_0x478e56){this[_0x71e8('0xd')]=_0x478e56;io['to'](util[_0x71e8('0x1a')]('chat:queue:%s',_0x518972[_0x71e8('0x6')]))['emit'](_0x71e8('0x1b'),_0x518972);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8277=['waiting','updateRealtime','prototype','updateRouting','map','loggedIn','paused','online','chatPause','available','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x9d0642,_0x55c12d){var _0x33ff84=function(_0x158492){while(--_0x158492){_0x9d0642['push'](_0x9d0642['shift']());}};_0x33ff84(++_0x55c12d);}(_0x8277,0xf8));var _0x7827=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x8277[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0x7827('0x0'));var md5=require(_0x7827('0x1'));var util=require(_0x7827('0x2'));var Redis=require(_0x7827('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x7827('0x4')](config[_0x7827('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7827('0x6'))(new Redis(config[_0x7827('0x5')]));function ChatQueue(_0x260e34){this['id']=_0x260e34['id']||0x0;this[_0x7827('0x7')]=_0x260e34['name']||'';this[_0x7827('0x8')]=_0x260e34[_0x7827('0x8')]||0xa;this[_0x7827('0x9')]=_0x260e34['strategy']||'beepall';this[_0x7827('0xa')]=_0x260e34[_0x7827('0xa')];this[_0x7827('0xb')]={};this[_0x7827('0xc')]=0x0;this[_0x7827('0x1')]='';this['updateRouting']();this[_0x7827('0xd')]();}ChatQueue[_0x7827('0xe')][_0x7827('0xf')]=function(){var _0x12c7af=this[_0x7827('0xb')]['_rr'];this[_0x7827('0xb')]=_[_0x7827('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x12c7af;};ChatQueue[_0x7827('0xe')]['updateRealtime']=function(){this[_0x7827('0x11')]=0x0;this[_0x7827('0x12')]=0x0;for(var _0xc3bcaf=0x0;_0xc3bcaf=0x0?this[_0x7827('0x15')]:0x0;var _0x586085={'id':this['id'],'available':this[_0x7827('0x15')],'loggedIn':this[_0x7827('0x11')],'name':this['name'],'paused':this[_0x7827('0x12')],'waiting':this[_0x7827('0xc')]};var _0xda15ac=md5(JSON['stringify'](_0x586085));if(this[_0x7827('0x1')]!==_0xda15ac){this[_0x7827('0x1')]=_0xda15ac;io['to'](util[_0x7827('0x16')](_0x7827('0x17'),_0x586085[_0x7827('0x7')]))[_0x7827('0x18')]('chat_queue:save',_0x586085);}};module[_0x7827('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e0ee4cd..190d815 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 _0x55a6=['updateRealtime','loggedIn','paused','length','online','available','md5','emit','exports','lodash','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr'];(function(_0x54636b,_0x28434a){var _0x3d70f6=function(_0x3ffa44){while(--_0x3ffa44){_0x54636b['push'](_0x54636b['shift']());}};_0x3d70f6(++_0x28434a);}(_0x55a6,0x1e4));var _0x655a=function(_0x3af223,_0x4dc898){_0x3af223=_0x3af223-0x0;var _0x4ba964=_0x55a6[_0x3af223];return _0x4ba964;};'use strict';var _=require(_0x655a('0x0'));var md5=require('md5');var util=require(_0x655a('0x1'));var Redis=require(_0x655a('0x2'));var config=require('../../../config/environment');config[_0x655a('0x3')]=_[_0x655a('0x4')](config[_0x655a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x655a('0x5'))(new Redis(config['redis']));function FaxQueue(_0x390795){this['id']=_0x390795['id']||0x0;this[_0x655a('0x6')]=_0x390795['name']||'';this[_0x655a('0x7')]=_0x390795[_0x655a('0x7')]||0xa;this[_0x655a('0x8')]=_0x390795[_0x655a('0x8')]||'beepall';this[_0x655a('0x9')]=_0x390795[_0x655a('0x9')];this[_0x655a('0xa')]={};this[_0x655a('0xb')]=0x0;this['md5']='';this[_0x655a('0xc')]();this['updateRealtime']();}FaxQueue[_0x655a('0xd')][_0x655a('0xc')]=function(){var _0x4cd4f7=this[_0x655a('0xa')]['_rr'];this[_0x655a('0xa')]=_[_0x655a('0xe')](this['Agents'],'id');this[_0x655a('0xa')][_0x655a('0xf')]=_0x4cd4f7;};FaxQueue['prototype'][_0x655a('0x10')]=function(){this[_0x655a('0x11')]=0x0;this[_0x655a('0x12')]=0x0;for(var _0x788e4c=0x0;_0x788e4c=0x0?this[_0x655a('0x15')]:0x0;var _0x6bbeb8={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x655a('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x4326c4=md5(JSON['stringify'](_0x6bbeb8));if(this[_0x655a('0x16')]!==_0x4326c4){this[_0x655a('0x16')]=_0x4326c4;io['to'](util['format']('fax:queue:%s',_0x6bbeb8[_0x655a('0x6')]))[_0x655a('0x17')]('fax_queue:save',_0x6bbeb8);}};module[_0x655a('0x18')]=FaxQueue; \ No newline at end of file +var _0x4eec=['online','faxPause','available','paused','stringify','format','fax:queue:%s','emit','fax_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length'];(function(_0x4c9c5b,_0x210cbb){var _0x4088ab=function(_0x3f1d0a){while(--_0x3f1d0a){_0x4c9c5b['push'](_0x4c9c5b['shift']());}};_0x4088ab(++_0x210cbb);}(_0x4eec,0x1bc));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0xc4ee('0x0'));var util=require('util');var Redis=require(_0xc4ee('0x1'));var config=require(_0xc4ee('0x2'));config[_0xc4ee('0x3')]=_[_0xc4ee('0x4')](config[_0xc4ee('0x3')],{'host':_0xc4ee('0x5'),'port':0x18eb});var io=require(_0xc4ee('0x6'))(new Redis(config['redis']));function FaxQueue(_0x1837c7){this['id']=_0x1837c7['id']||0x0;this[_0xc4ee('0x7')]=_0x1837c7[_0xc4ee('0x7')]||'';this[_0xc4ee('0x8')]=_0x1837c7['timeout']||0xa;this['strategy']=_0x1837c7['strategy']||_0xc4ee('0x9');this[_0xc4ee('0xa')]=_0x1837c7[_0xc4ee('0xa')];this[_0xc4ee('0xb')]={};this[_0xc4ee('0xc')]=0x0;this[_0xc4ee('0x0')]='';this[_0xc4ee('0xd')]();this[_0xc4ee('0xe')]();}FaxQueue[_0xc4ee('0xf')]['updateRouting']=function(){var _0x973632=this[_0xc4ee('0xb')][_0xc4ee('0x10')];this[_0xc4ee('0xb')]=_[_0xc4ee('0x11')](this[_0xc4ee('0xa')],'id');this[_0xc4ee('0xb')][_0xc4ee('0x10')]=_0x973632;};FaxQueue[_0xc4ee('0xf')]['updateRealtime']=function(){this[_0xc4ee('0x12')]=0x0;this['paused']=0x0;for(var _0x5bcefb=0x0;_0x5bcefb=0x0?this[_0xc4ee('0x16')]:0x0;var _0x192948={'id':this['id'],'available':this[_0xc4ee('0x16')],'loggedIn':this[_0xc4ee('0x12')],'name':this[_0xc4ee('0x7')],'paused':this[_0xc4ee('0x17')],'waiting':this[_0xc4ee('0xc')]};var _0x32affb=md5(JSON[_0xc4ee('0x18')](_0x192948));if(this['md5']!==_0x32affb){this['md5']=_0x32affb;io['to'](util[_0xc4ee('0x19')](_0xc4ee('0x1a'),_0x192948[_0xc4ee('0x7')]))[_0xc4ee('0x1b')](_0xc4ee('0x1c'),_0x192948);}};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 7e2bb65..8abd1ab 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 _0xf116=['name','Intervals','exports'];(function(_0x46bf45,_0x201aaf){var _0x10cdc3=function(_0x1affe2){while(--_0x1affe2){_0x46bf45['push'](_0x46bf45['shift']());}};_0x10cdc3(++_0x201aaf);}(_0xf116,0x162));var _0x6f11=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0xf116[_0xffd1b5];return _0x3176d6;};'use strict';function Interval(_0x1a50c1){this['id']=_0x1a50c1['id']||0x0;this['name']=_0x1a50c1[_0x6f11('0x0')]||'';this['Intervals']=_0x1a50c1[_0x6f11('0x1')]||{};}module[_0x6f11('0x2')]=Interval; \ No newline at end of file +var _0xec3d=['name','Intervals'];(function(_0x1f0d67,_0x465368){var _0x2b0213=function(_0x498234){while(--_0x498234){_0x1f0d67['push'](_0x1f0d67['shift']());}};_0x2b0213(++_0x465368);}(_0xec3d,0x92));var _0xdec3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec3d[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x59b411){this['id']=_0x59b411['id']||0x0;this['name']=_0x59b411[_0xdec3('0x0')]||'';this[_0xdec3('0x1')]=_0x59b411[_0xdec3('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 bbc6eb6..1db5e45 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 _0xe388=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','online','loggedIn','mailPause','paused','available','stringify','format','mail:queue:%s','mail_queue:save','lodash'];(function(_0x170bba,_0x2be92f){var _0xa7c249=function(_0x2b6505){while(--_0x2b6505){_0x170bba['push'](_0x170bba['shift']());}};_0xa7c249(++_0x2be92f);}(_0xe388,0x133));var _0x8e38=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xe388[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x8e38('0x0'));var md5=require(_0x8e38('0x1'));var util=require('util');var Redis=require(_0x8e38('0x2'));var config=require(_0x8e38('0x3'));config[_0x8e38('0x4')]=_[_0x8e38('0x5')](config['redis'],{'host':_0x8e38('0x6'),'port':0x18eb});var io=require(_0x8e38('0x7'))(new Redis(config[_0x8e38('0x4')]));function MailQueue(_0x5d8751){this['id']=_0x5d8751['id']||0x0;this[_0x8e38('0x8')]=_0x5d8751[_0x8e38('0x8')]||'';this['timeout']=_0x5d8751[_0x8e38('0x9')]||0xa;this['strategy']=_0x5d8751[_0x8e38('0xa')]||_0x8e38('0xb');this['Agents']=_0x5d8751[_0x8e38('0xc')];this[_0x8e38('0xd')]={};this[_0x8e38('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x8e38('0xf')]();}MailQueue[_0x8e38('0x10')][_0x8e38('0x11')]=function(){var _0x262ef8=this[_0x8e38('0xd')]['_rr'];this['mapAgentsId']=_['map'](this[_0x8e38('0xc')],'id');this[_0x8e38('0xd')][_0x8e38('0x12')]=_0x262ef8;};MailQueue[_0x8e38('0x10')][_0x8e38('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4f992b=0x0;_0x4f992b=0x0?this[_0x8e38('0x17')]:0x0;var _0x49ac5e={'id':this['id'],'available':this[_0x8e38('0x17')],'loggedIn':this[_0x8e38('0x14')],'name':this[_0x8e38('0x8')],'paused':this[_0x8e38('0x16')],'waiting':this[_0x8e38('0xe')]};var _0x424c78=md5(JSON[_0x8e38('0x18')](_0x49ac5e));if(this[_0x8e38('0x1')]!==_0x424c78){this[_0x8e38('0x1')]=_0x424c78;io['to'](util[_0x8e38('0x19')](_0x8e38('0x1a'),_0x49ac5e[_0x8e38('0x8')]))['emit'](_0x8e38('0x1b'),_0x49ac5e);}};module['exports']=MailQueue; \ No newline at end of file +var _0xe0e3=['length','online','mailPause','available','format','mail:queue:%s','emit','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused'];(function(_0x4a70f3,_0x3c3391){var _0x54c3be=function(_0x2cc4a1){while(--_0x2cc4a1){_0x4a70f3['push'](_0x4a70f3['shift']());}};_0x54c3be(++_0x3c3391);}(_0xe0e3,0x93));var _0x3e0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0e('0x0'));var md5=require(_0x3e0e('0x1'));var util=require(_0x3e0e('0x2'));var Redis=require('ioredis');var config=require(_0x3e0e('0x3'));config[_0x3e0e('0x4')]=_[_0x3e0e('0x5')](config[_0x3e0e('0x4')],{'host':_0x3e0e('0x6'),'port':0x18eb});var io=require(_0x3e0e('0x7'))(new Redis(config[_0x3e0e('0x4')]));function MailQueue(_0x5310a5){this['id']=_0x5310a5['id']||0x0;this['name']=_0x5310a5[_0x3e0e('0x8')]||'';this[_0x3e0e('0x9')]=_0x5310a5['timeout']||0xa;this[_0x3e0e('0xa')]=_0x5310a5[_0x3e0e('0xa')]||'beepall';this[_0x3e0e('0xb')]=_0x5310a5[_0x3e0e('0xb')];this[_0x3e0e('0xc')]={};this[_0x3e0e('0xd')]=0x0;this[_0x3e0e('0x1')]='';this['updateRouting']();this[_0x3e0e('0xe')]();}MailQueue[_0x3e0e('0xf')][_0x3e0e('0x10')]=function(){var _0x36db78=this[_0x3e0e('0xc')][_0x3e0e('0x11')];this[_0x3e0e('0xc')]=_[_0x3e0e('0x12')](this[_0x3e0e('0xb')],'id');this[_0x3e0e('0xc')]['_rr']=_0x36db78;};MailQueue[_0x3e0e('0xf')][_0x3e0e('0xe')]=function(){this[_0x3e0e('0x13')]=0x0;this[_0x3e0e('0x14')]=0x0;for(var _0x43d987=0x0;_0x43d987=0x0?this[_0x3e0e('0x18')]:0x0;var _0x4014fe={'id':this['id'],'available':this[_0x3e0e('0x18')],'loggedIn':this[_0x3e0e('0x13')],'name':this[_0x3e0e('0x8')],'paused':this[_0x3e0e('0x14')],'waiting':this[_0x3e0e('0xd')]};var _0x50e4f8=md5(JSON['stringify'](_0x4014fe));if(this[_0x3e0e('0x1')]!==_0x50e4f8){this['md5']=_0x50e4f8;io['to'](util[_0x3e0e('0x19')](_0x3e0e('0x1a'),_0x4014fe['name']))[_0x3e0e('0x1b')]('mail_queue:save',_0x4014fe);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 361ecee..5c4f675 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x326f,0xd1));var _0xf326=function(_0x4f358f,_0x1fc019){_0x4f358f=_0x4f358f-0x0;var _0x24f08d=_0x326f[_0x4f358f];return _0x24f08d;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};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 6486cf4..1740774 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 _0x6ff1=['stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','name'];(function(_0x569a4f,_0x48972d){var _0x10c92b=function(_0x20134b){while(--_0x20134b){_0x569a4f['push'](_0x569a4f['shift']());}};_0x10c92b(++_0x48972d);}(_0x6ff1,0x10a));var _0x16ff=function(_0x5771e7,_0x10b946){_0x5771e7=_0x5771e7-0x0;var _0x102485=_0x6ff1[_0x5771e7];return _0x102485;};'use strict';var _=require(_0x16ff('0x0'));var md5=require(_0x16ff('0x1'));var util=require(_0x16ff('0x2'));var Redis=require(_0x16ff('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x16ff('0x4')](config['redis'],{'host':_0x16ff('0x5'),'port':0x18eb});var io=require(_0x16ff('0x6'))(new Redis(config[_0x16ff('0x7')]));function SmsQueue(_0x2c2f31){this['id']=_0x2c2f31['id']||0x0;this['name']=_0x2c2f31['name']||'';this['timeout']=_0x2c2f31['timeout']||0xa;this[_0x16ff('0x8')]=_0x2c2f31[_0x16ff('0x8')]||_0x16ff('0x9');this[_0x16ff('0xa')]=_0x2c2f31[_0x16ff('0xa')];this[_0x16ff('0xb')]={};this[_0x16ff('0xc')]=0x0;this[_0x16ff('0x1')]='';this[_0x16ff('0xd')]();this[_0x16ff('0xe')]();}SmsQueue[_0x16ff('0xf')][_0x16ff('0xd')]=function(){var _0xfed960=this[_0x16ff('0xb')][_0x16ff('0x10')];this[_0x16ff('0xb')]=_[_0x16ff('0x11')](this[_0x16ff('0xa')],'id');this[_0x16ff('0xb')][_0x16ff('0x10')]=_0xfed960;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x16ff('0x12')]=0x0;this[_0x16ff('0x13')]=0x0;for(var _0x358da3=0x0;_0x358da3=0x0?this[_0x16ff('0x16')]:0x0;var _0x52e3d5={'id':this['id'],'available':this[_0x16ff('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x16ff('0x17')],'paused':this['paused'],'waiting':this[_0x16ff('0xc')]};var _0x31e3e0=md5(JSON[_0x16ff('0x18')](_0x52e3d5));if(this[_0x16ff('0x1')]!==_0x31e3e0){this[_0x16ff('0x1')]=_0x31e3e0;io['to'](util['format'](_0x16ff('0x19'),_0x52e3d5['name']))[_0x16ff('0x1a')](_0x16ff('0x1b'),_0x52e3d5);}};module[_0x16ff('0x1c')]=SmsQueue; \ No newline at end of file +var _0x524a=['defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','online','smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0x524a,0xf5));var _0xa524=function(_0x4db11d,_0x28b577){_0x4db11d=_0x4db11d-0x0;var _0x514c28=_0x524a[_0x4db11d];return _0x514c28;};'use strict';var _=require(_0xa524('0x0'));var md5=require(_0xa524('0x1'));var util=require(_0xa524('0x2'));var Redis=require(_0xa524('0x3'));var config=require('../../../config/environment');config[_0xa524('0x4')]=_[_0xa524('0x5')](config[_0xa524('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa524('0x4')]));function SmsQueue(_0x1975f3){this['id']=_0x1975f3['id']||0x0;this[_0xa524('0x6')]=_0x1975f3['name']||'';this[_0xa524('0x7')]=_0x1975f3['timeout']||0xa;this[_0xa524('0x8')]=_0x1975f3[_0xa524('0x8')]||'beepall';this[_0xa524('0x9')]=_0x1975f3[_0xa524('0x9')];this[_0xa524('0xa')]={};this[_0xa524('0xb')]=0x0;this[_0xa524('0x1')]='';this['updateRouting']();this[_0xa524('0xc')]();}SmsQueue[_0xa524('0xd')]['updateRouting']=function(){var _0x565fab=this[_0xa524('0xa')][_0xa524('0xe')];this[_0xa524('0xa')]=_['map'](this['Agents'],'id');this[_0xa524('0xa')]['_rr']=_0x565fab;};SmsQueue[_0xa524('0xd')]['updateRealtime']=function(){this[_0xa524('0xf')]=0x0;this['paused']=0x0;for(var _0x75bfe8=0x0;_0x75bfe8=0x0?this[_0xa524('0x13')]:0x0;var _0x375277={'id':this['id'],'available':this[_0xa524('0x13')],'loggedIn':this[_0xa524('0xf')],'name':this[_0xa524('0x6')],'paused':this['paused'],'waiting':this[_0xa524('0xb')]};var _0x20f8e1=md5(JSON[_0xa524('0x14')](_0x375277));if(this[_0xa524('0x1')]!==_0x20f8e1){this['md5']=_0x20f8e1;io['to'](util['format'](_0xa524('0x15'),_0x375277[_0xa524('0x6')]))[_0xa524('0x16')](_0xa524('0x17'),_0x375277);}};module[_0xa524('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b69b34d..53615e7 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 _0x689e=['loggedIn','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','paused','length','online','whatsappPause','available'];(function(_0x30945b,_0x225f4b){var _0x796d92=function(_0x537b3f){while(--_0x537b3f){_0x30945b['push'](_0x30945b['shift']());}};_0x796d92(++_0x225f4b);}(_0x689e,0x172));var _0xe689=function(_0x60fa35,_0x12abc6){_0x60fa35=_0x60fa35-0x0;var _0x2d9933=_0x689e[_0x60fa35];return _0x2d9933;};'use strict';var _=require('lodash');var md5=require(_0xe689('0x0'));var util=require(_0xe689('0x1'));var Redis=require(_0xe689('0x2'));var config=require(_0xe689('0x3'));config[_0xe689('0x4')]=_['defaults'](config[_0xe689('0x4')],{'host':_0xe689('0x5'),'port':0x18eb});var io=require(_0xe689('0x6'))(new Redis(config[_0xe689('0x4')]));function WhatsappQueue(_0x57b460){this['id']=_0x57b460['id']||0x0;this[_0xe689('0x7')]=_0x57b460[_0xe689('0x7')]||'';this[_0xe689('0x8')]=_0x57b460[_0xe689('0x8')]||0xa;this[_0xe689('0x9')]=_0x57b460[_0xe689('0x9')]||'beepall';this[_0xe689('0xa')]=_0x57b460['Agents'];this[_0xe689('0xb')]={};this[_0xe689('0xc')]=0x0;this[_0xe689('0x0')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0xe689('0xd')]=function(){var _0x100032=this[_0xe689('0xb')][_0xe689('0xe')];this[_0xe689('0xb')]=_[_0xe689('0xf')](this[_0xe689('0xa')],'id');this['mapAgentsId'][_0xe689('0xe')]=_0x100032;};WhatsappQueue[_0xe689('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xe689('0x11')]=0x0;for(var _0x15d641=0x0;_0x15d641=0x0?this['available']:0x0;var _0xf8b13e={'id':this['id'],'available':this[_0xe689('0x15')],'loggedIn':this[_0xe689('0x16')],'name':this[_0xe689('0x7')],'paused':this[_0xe689('0x11')],'waiting':this[_0xe689('0xc')]};var _0x43d0de=md5(JSON[_0xe689('0x17')](_0xf8b13e));if(this[_0xe689('0x0')]!==_0x43d0de){this[_0xe689('0x0')]=_0x43d0de;io['to'](util['format'](_0xe689('0x18'),_0xf8b13e['name']))[_0xe689('0x19')](_0xe689('0x1a'),_0xf8b13e);}};module[_0xe689('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x2260=['md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','whatsappPause','loggedIn','available','stringify','format','emit','whatsapp_queue:save','exports','lodash'];(function(_0x19bf5f,_0x594d6d){var _0x59c809=function(_0x50f584){while(--_0x50f584){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x59c809(++_0x594d6d);}(_0x2260,0x117));var _0x0226=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x2260[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x0226('0x0'));var md5=require(_0x0226('0x1'));var util=require(_0x0226('0x2'));var Redis=require('ioredis');var config=require(_0x0226('0x3'));config[_0x0226('0x4')]=_[_0x0226('0x5')](config['redis'],{'host':_0x0226('0x6'),'port':0x18eb});var io=require(_0x0226('0x7'))(new Redis(config[_0x0226('0x4')]));function WhatsappQueue(_0x5a03d2){this['id']=_0x5a03d2['id']||0x0;this['name']=_0x5a03d2[_0x0226('0x8')]||'';this['timeout']=_0x5a03d2[_0x0226('0x9')]||0xa;this[_0x0226('0xa')]=_0x5a03d2[_0x0226('0xa')]||'beepall';this['Agents']=_0x5a03d2[_0x0226('0xb')];this[_0x0226('0xc')]={};this[_0x0226('0xd')]=0x0;this[_0x0226('0x1')]='';this[_0x0226('0xe')]();this[_0x0226('0xf')]();}WhatsappQueue[_0x0226('0x10')][_0x0226('0xe')]=function(){var _0xfeb8b7=this[_0x0226('0xc')]['_rr'];this[_0x0226('0xc')]=_['map'](this['Agents'],'id');this[_0x0226('0xc')][_0x0226('0x11')]=_0xfeb8b7;};WhatsappQueue[_0x0226('0x10')][_0x0226('0xf')]=function(){this['loggedIn']=0x0;this[_0x0226('0x12')]=0x0;for(var _0x15e1ba=0x0;_0x15e1ba=0x0?this[_0x0226('0x16')]:0x0;var _0x31fac8={'id':this['id'],'available':this[_0x0226('0x16')],'loggedIn':this[_0x0226('0x15')],'name':this[_0x0226('0x8')],'paused':this['paused'],'waiting':this[_0x0226('0xd')]};var _0x596a98=md5(JSON[_0x0226('0x17')](_0x31fac8));if(this['md5']!==_0x596a98){this['md5']=_0x596a98;io['to'](util[_0x0226('0x18')]('whatsapp:queue:%s',_0x31fac8[_0x0226('0x8')]))[_0x0226('0x19')](_0x0226('0x1a'),_0x31fac8);}};module[_0x0226('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 32a0510..8f56edf 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(_0x556e93,_0x10ccc9){var _0x295993=function(_0x3811ea){while(--_0x3811ea){_0x556e93['push'](_0x556e93['shift']());}};_0x295993(++_0x10ccc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xb10b[_0x25a42a];return _0x1129b1;};'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(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 9d42a29..7899096 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 _0x4b83=['UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x16189f,_0x43c4c3){var _0x2387aa=function(_0x57affb){while(--_0x57affb){_0x16189f['push'](_0x16189f['shift']());}};_0x2387aa(++_0x43c4c3);}(_0x4b83,0xe1));var _0x34b8=function(_0x50c517,_0x2a1842){_0x50c517=_0x50c517-0x0;var _0x45fbc5=_0x4b83[_0x50c517];return _0x45fbc5;};'use strict';var client=require(_0x34b8('0x0'));exports[_0x34b8('0x1')]=function(_0x554cd6,_0x5e5f5a){return client[_0x34b8('0x2')](_0x34b8('0x3'),{'body':_0x5e5f5a,'options':{'where':{'id':_0x554cd6}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x312641,_0x5e42d9){return client[_0x34b8('0x2')](_0x34b8('0x4'),{'body':_0x5e42d9,'options':{'where':{'id':_0x312641}},'log':_0x34b8('0x5')});}; \ No newline at end of file +var _0xabd4=['addTags','AddTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xabd4,0x7f));var _0x4abd=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xabd4[_0x21549c];return _0x426cbd;};'use strict';var client=require('../client');exports['update']=function(_0x56eb25,_0x49aec7){return client[_0x4abd('0x0')](_0x4abd('0x1'),{'body':_0x49aec7,'options':{'where':{'id':_0x56eb25}},'log':_0x4abd('0x2')});};exports[_0x4abd('0x3')]=function(_0x661141,_0x4dc5c5){return client[_0x4abd('0x0')](_0x4abd('0x4'),{'body':_0x4dc5c5,'options':{'where':{'id':_0x661141}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a3468fd..7ad09a8 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 _0xb20f=['CreateChatMessage','create','Request'];(function(_0x14e872,_0x24ba3e){var _0x5a9184=function(_0x46c25f){while(--_0x46c25f){_0x14e872['push'](_0x14e872['shift']());}};_0x5a9184(++_0x24ba3e);}(_0xb20f,0x1ae));var _0xfb20=function(_0x2a2801,_0x5de631){_0x2a2801=_0x2a2801-0x0;var _0x105a63=_0xb20f[_0x2a2801];return _0x105a63;};'use strict';var client=require('../client');exports[_0xfb20('0x0')]=function(_0xb12940){return client[_0xfb20('0x1')](_0xfb20('0x2'),{'body':_0xb12940,'log':'createChatMessage'});}; \ No newline at end of file +var _0xb3f1=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x2b1920,_0x983ad1){var _0x209650=function(_0x8ff7a6){while(--_0x8ff7a6){_0x2b1920['push'](_0x2b1920['shift']());}};_0x209650(++_0x983ad1);}(_0xb3f1,0x145));var _0x1b3f=function(_0x14da21,_0x13dbd8){_0x14da21=_0x14da21-0x0;var _0x2a11e6=_0xb3f1[_0x14da21];return _0x2a11e6;};'use strict';var client=require(_0x1b3f('0x0'));exports[_0x1b3f('0x1')]=function(_0x5227ee){return client[_0x1b3f('0x2')](_0x1b3f('0x3'),{'body':_0x5227ee,'log':_0x1b3f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6a6fbb5..149a365 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 _0x7b83=['getChatQueues','Request','timeout','strategy','User','name','online','chatPause','../client'];(function(_0x153863,_0x41363d){var _0x3bfc32=function(_0x146041){while(--_0x146041){_0x153863['push'](_0x153863['shift']());}};_0x3bfc32(++_0x41363d);}(_0x7b83,0xa1));var _0x37b8=function(_0x1d8015,_0x199629){_0x1d8015=_0x1d8015-0x0;var _0x1a7d3f=_0x7b83[_0x1d8015];return _0x1a7d3f;};'use strict';var client=require(_0x37b8('0x0'));exports[_0x37b8('0x1')]=function(){return function(){return client[_0x37b8('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x37b8('0x3'),_0x37b8('0x4')],'include':[{'model':_0x37b8('0x5'),'as':'Agents','attributes':['id',_0x37b8('0x6'),_0x37b8('0x7'),_0x37b8('0x8')]}]},'log':_0x37b8('0x1')});};}; \ No newline at end of file +var _0xf569=['online','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf569,0xd0));var _0x9f56=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf569[_0x51020b];return _0x371e47;};'use strict';var client=require('../client');exports[_0x9f56('0x0')]=function(){return function(){return client[_0x9f56('0x1')](_0x9f56('0x2'),{'options':{'raw':![],'attributes':['id',_0x9f56('0x3'),_0x9f56('0x4'),_0x9f56('0x5')],'include':[{'model':_0x9f56('0x6'),'as':_0x9f56('0x7'),'attributes':['id','name',_0x9f56('0x8'),'chatPause']}]},'log':_0x9f56('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 64099c8..e359907 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 _0x5a01=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','../client'];(function(_0x1db36f,_0x2ecd35){var _0x1d0fa9=function(_0x78f4fa){while(--_0x78f4fa){_0x1db36f['push'](_0x1db36f['shift']());}};_0x1d0fa9(++_0x2ecd35);}(_0x5a01,0x1af));var _0x15a0=function(_0x794207,_0x54a989){_0x794207=_0x794207-0x0;var _0x4ee1c9=_0x5a01[_0x794207];return _0x4ee1c9;};'use strict';var client=require(_0x15a0('0x0'));exports[_0x15a0('0x1')]=function(_0x12a4b6){return client['Request']('CreateChatQueueReport',{'body':_0x12a4b6,'log':_0x15a0('0x2')});};exports[_0x15a0('0x3')]=function(_0x4c7c75,_0x1c83a1){return client[_0x15a0('0x4')](_0x15a0('0x5'),{'body':_0x1c83a1,'options':{'where':{'uniqueid':_0x4c7c75},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x2029=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0xe4b70c,_0x185abf){var _0x55df33=function(_0x4c5e5a){while(--_0x4c5e5a){_0xe4b70c['push'](_0xe4b70c['shift']());}};_0x55df33(++_0x185abf);}(_0x2029,0x171));var _0x9202=function(_0x4f1e52,_0xfb188c){_0x4f1e52=_0x4f1e52-0x0;var _0x50889c=_0x2029[_0x4f1e52];return _0x50889c;};'use strict';var client=require(_0x9202('0x0'));exports[_0x9202('0x1')]=function(_0x4d4110){return client[_0x9202('0x2')](_0x9202('0x3'),{'body':_0x4d4110,'log':_0x9202('0x3')});};exports[_0x9202('0x4')]=function(_0x39fa99,_0x81709f){return client[_0x9202('0x2')](_0x9202('0x5'),{'body':_0x81709f,'options':{'where':{'uniqueid':_0x39fa99},'order':[['id',_0x9202('0x6')]],'limit':0x1},'log':_0x9202('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2c37bb7..760e912 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x3f4fc8,_0xd48416){var _0xf00ef2=function(_0x1f6c55){while(--_0x1f6c55){_0x3f4fc8['push'](_0x3f4fc8['shift']());}};_0xf00ef2(++_0xd48416);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x27e658,_0x49b8d5){var _0x15925d=function(_0x1291fb){while(--_0x1291fb){_0x27e658['push'](_0x27e658['shift']());}};_0x15925d(++_0x49b8d5);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3afb6ae..52cdfee 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 _0x76ff=['CreateFaxMessage','../client','create','Request'];(function(_0x5d20a4,_0x21f222){var _0x3c426c=function(_0x30e55d){while(--_0x30e55d){_0x5d20a4['push'](_0x5d20a4['shift']());}};_0x3c426c(++_0x21f222);}(_0x76ff,0xdd));var _0xf76f=function(_0x299650,_0x2ff681){_0x299650=_0x299650-0x0;var _0x1666f9=_0x76ff[_0x299650];return _0x1666f9;};'use strict';var client=require(_0xf76f('0x0'));exports[_0xf76f('0x1')]=function(_0x272439){return client[_0xf76f('0x2')](_0xf76f('0x3'),{'body':_0x272439,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x6d01=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x268b04,_0x225bb8){var _0x2ef1a5=function(_0x3541e2){while(--_0x3541e2){_0x268b04['push'](_0x268b04['shift']());}};_0x2ef1a5(++_0x225bb8);}(_0x6d01,0x92));var _0x16d0=function(_0xc3a55,_0x4ceb55){_0xc3a55=_0xc3a55-0x0;var _0x1b516b=_0x6d01[_0xc3a55];return _0x1b516b;};'use strict';var client=require(_0x16d0('0x0'));exports[_0x16d0('0x1')]=function(_0x41eb61){return client[_0x16d0('0x2')](_0x16d0('0x3'),{'body':_0x41eb61,'log':_0x16d0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b7c428b..a186611 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 _0x7fb4=['getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','name','faxPause'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x7fb4,0xf0));var _0x47fb=function(_0x1cb523,_0x445b53){_0x1cb523=_0x1cb523-0x0;var _0x781dbc=_0x7fb4[_0x1cb523];return _0x781dbc;};'use strict';var client=require('../client');exports[_0x47fb('0x0')]=function(){return function(){return client[_0x47fb('0x1')](_0x47fb('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x47fb('0x3'),_0x47fb('0x4')],'include':[{'model':_0x47fb('0x5'),'as':'Agents','attributes':['id',_0x47fb('0x6'),'online',_0x47fb('0x7')]}]},'log':_0x47fb('0x0')});};}; \ No newline at end of file +var _0x3e9e=['name','strategy','Agents','getFaxQueues','../client','Request','GetFaxQueue'];(function(_0x5402ee,_0x23d559){var _0x4d7246=function(_0x2f6095){while(--_0x2f6095){_0x5402ee['push'](_0x5402ee['shift']());}};_0x4d7246(++_0x23d559);}(_0x3e9e,0x1d2));var _0xe3e9=function(_0xd01ea5,_0x58d717){_0xd01ea5=_0xd01ea5-0x0;var _0x1ffc27=_0x3e9e[_0xd01ea5];return _0x1ffc27;};'use strict';var client=require(_0xe3e9('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xe3e9('0x1')](_0xe3e9('0x2'),{'options':{'raw':![],'attributes':['id',_0xe3e9('0x3'),'timeout',_0xe3e9('0x4')],'include':[{'model':'User','as':_0xe3e9('0x5'),'attributes':['id',_0xe3e9('0x3'),'online','faxPause']}]},'log':_0xe3e9('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 5dd2076..a12294a 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 _0xedde=['Request','CreateFaxQueueReport','update','DESC','create'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xedde,0x1d0));var _0xeedd=function(_0x3f950c,_0x1b8980){_0x3f950c=_0x3f950c-0x0;var _0x7630a6=_0xedde[_0x3f950c];return _0x7630a6;};'use strict';var client=require('../client');exports[_0xeedd('0x0')]=function(_0x17059f){return client[_0xeedd('0x1')](_0xeedd('0x2'),{'body':_0x17059f,'log':'CreateFaxQueueReport'});};exports[_0xeedd('0x3')]=function(_0x44524c,_0x4c1a3d){return client[_0xeedd('0x1')]('UpdateFaxQueueReport',{'body':_0x4c1a3d,'options':{'where':{'uniqueid':_0x44524c},'order':[['id',_0xeedd('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xe6a1=['update','DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x6237a0,_0x2b681b){var _0x37c8da=function(_0x47eba1){while(--_0x47eba1){_0x6237a0['push'](_0x6237a0['shift']());}};_0x37c8da(++_0x2b681b);}(_0xe6a1,0xd5));var _0x1e6a=function(_0xe293cb,_0x2a30c9){_0xe293cb=_0xe293cb-0x0;var _0x2b1514=_0xe6a1[_0xe293cb];return _0x2b1514;};'use strict';var client=require(_0x1e6a('0x0'));exports[_0x1e6a('0x1')]=function(_0x1a866f){return client[_0x1e6a('0x2')](_0x1e6a('0x3'),{'body':_0x1a866f,'log':'CreateFaxQueueReport'});};exports[_0x1e6a('0x4')]=function(_0x1323b1,_0x492d83){return client[_0x1e6a('0x2')]('UpdateFaxQueueReport',{'body':_0x492d83,'options':{'where':{'uniqueid':_0x1323b1},'order':[['id',_0x1e6a('0x5')]],'limit':0x1},'log':_0x1e6a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8c819c4..575a167 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 _0xc8ef=['Interval','interval','getIntervals','Request','GetInterval','name'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xc8ef,0x1a6));var _0xfc8e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc8ef[_0x37bd26];return _0xe83dc4;};'use strict';var client=require('../client');exports[_0xfc8e('0x0')]=function(){return function(){return client[_0xfc8e('0x1')](_0xfc8e('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfc8e('0x3')],'include':[{'model':_0xfc8e('0x4'),'as':'Intervals','attributes':['id',_0xfc8e('0x3'),_0xfc8e('0x5')]}]},'log':_0xfc8e('0x0')});};}; \ No newline at end of file +var _0xc91c=['getIntervals','Request','name','Interval','Intervals','interval','../client'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc91c,0x16b));var _0xcc91=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xc91c[_0xffa198];return _0x1e4b50;};'use strict';var client=require(_0xcc91('0x0'));exports[_0xcc91('0x1')]=function(){return function(){return client[_0xcc91('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcc91('0x3')],'include':[{'model':_0xcc91('0x4'),'as':_0xcc91('0x5'),'attributes':['id','name',_0xcc91('0x6')]}]},'log':_0xcc91('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index adff162..d095322 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 _0x1399=['UpdateMailInteraction','updateMailInteraction','addTags','Request','../client','update'];(function(_0x2007ab,_0x55077e){var _0x25aea7=function(_0x3c6348){while(--_0x3c6348){_0x2007ab['push'](_0x2007ab['shift']());}};_0x25aea7(++_0x55077e);}(_0x1399,0x16c));var _0x9139=function(_0x48e6c9,_0x46c2fd){_0x48e6c9=_0x48e6c9-0x0;var _0xf3f800=_0x1399[_0x48e6c9];return _0xf3f800;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(_0x5740a9,_0x474911){return client['Request'](_0x9139('0x2'),{'body':_0x474911,'options':{'where':{'id':_0x5740a9}},'log':_0x9139('0x3')});};exports[_0x9139('0x4')]=function(_0x28f155,_0x251798){return client[_0x9139('0x5')]('AddTagsToMailInteraction',{'body':_0x251798,'options':{'where':{'id':_0x28f155}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x2e99c4,_0x5dae10){var _0x300d2c=function(_0x22a041){while(--_0x22a041){_0x2e99c4['push'](_0x2e99c4['shift']());}};_0x300d2c(++_0x5dae10);}(_0x5c3c,0x132));var _0xc5c3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x5c3c[_0x24259d];return _0x5a701;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 445ea5b..9bf96b9 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 _0x4ac1=['Request'];(function(_0x18624e,_0x172c43){var _0x41ef95=function(_0x587da8){while(--_0x587da8){_0x18624e['push'](_0x18624e['shift']());}};_0x41ef95(++_0x172c43);}(_0x4ac1,0xa4));var _0x14ac=function(_0x59d42c,_0x8ee71){_0x59d42c=_0x59d42c-0x0;var _0x574d2d=_0x4ac1[_0x59d42c];return _0x574d2d;};'use strict';var client=require('../client');exports['create']=function(_0x19c1d1){return client[_0x14ac('0x0')]('CreateMailMessage',{'body':_0x19c1d1,'log':'createMailMessage'});}; \ No newline at end of file +var _0xdd3a=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x50b021,_0x3f1419){var _0x27d2c6=function(_0xdf75f3){while(--_0xdf75f3){_0x50b021['push'](_0x50b021['shift']());}};_0x27d2c6(++_0x3f1419);}(_0xdd3a,0x1f1));var _0xadd3=function(_0x3c243a,_0x2cdd16){_0x3c243a=_0x3c243a-0x0;var _0x13c714=_0xdd3a[_0x3c243a];return _0x13c714;};'use strict';var client=require('../client');exports[_0xadd3('0x0')]=function(_0x288064){return client[_0xadd3('0x1')](_0xadd3('0x2'),{'body':_0x288064,'log':_0xadd3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4e1092a..2932557 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 _0x4196=['GetMailQueue','name','timeout','User','Agents','online','../client','getMailQueues'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4196,0xb6));var _0x6419=function(_0x1892de,_0x121259){_0x1892de=_0x1892de-0x0;var _0x1b4ca3=_0x4196[_0x1892de];return _0x1b4ca3;};'use strict';var client=require(_0x6419('0x0'));exports[_0x6419('0x1')]=function(){return function(){return client['Request'](_0x6419('0x2'),{'options':{'raw':![],'attributes':['id',_0x6419('0x3'),_0x6419('0x4'),'strategy'],'include':[{'model':_0x6419('0x5'),'as':_0x6419('0x6'),'attributes':['id',_0x6419('0x3'),_0x6419('0x7'),'mailPause']}]},'log':_0x6419('0x1')});};}; \ No newline at end of file +var _0xdfb2=['../client','Request','name','timeout','strategy','Agents','mailPause','getMailQueues'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdfb2,0xe8));var _0x2dfb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xdfb2[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x2dfb('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2dfb('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x2dfb('0x2'),_0x2dfb('0x3'),_0x2dfb('0x4')],'include':[{'model':'User','as':_0x2dfb('0x5'),'attributes':['id','name','online',_0x2dfb('0x6')]}]},'log':_0x2dfb('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e5eef0e..9294902 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 _0x19f1=['../client','create','CreateMailQueueReport','Request','UpdateMailQueueReport','DESC'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x19f1,0x84));var _0x119f=function(_0x27ff4e,_0x556c8b){_0x27ff4e=_0x27ff4e-0x0;var _0x1daffe=_0x19f1[_0x27ff4e];return _0x1daffe;};'use strict';var client=require(_0x119f('0x0'));exports[_0x119f('0x1')]=function(_0x1e24f5){return client['Request'](_0x119f('0x2'),{'body':_0x1e24f5,'log':_0x119f('0x2')});};exports['update']=function(_0x584719,_0x81eaf7){return client[_0x119f('0x3')](_0x119f('0x4'),{'body':_0x81eaf7,'options':{'where':{'uniqueid':_0x584719},'order':[['id',_0x119f('0x5')]],'limit':0x1},'log':_0x119f('0x4')});}; \ No newline at end of file +var _0x9efb=['CreateMailQueueReport','update','UpdateMailQueueReport','create','Request'];(function(_0x5e8833,_0x4ff687){var _0x2efd83=function(_0x453829){while(--_0x453829){_0x5e8833['push'](_0x5e8833['shift']());}};_0x2efd83(++_0x4ff687);}(_0x9efb,0x1e3));var _0xb9ef=function(_0x1247fe,_0x5c611f){_0x1247fe=_0x1247fe-0x0;var _0x1104a2=_0x9efb[_0x1247fe];return _0x1104a2;};'use strict';var client=require('../client');exports[_0xb9ef('0x0')]=function(_0x19c81d){return client[_0xb9ef('0x1')]('CreateMailQueueReport',{'body':_0x19c81d,'log':_0xb9ef('0x2')});};exports[_0xb9ef('0x3')]=function(_0x32ae6f,_0x225627){return client[_0xb9ef('0x1')](_0xb9ef('0x4'),{'body':_0x225627,'options':{'where':{'uniqueid':_0x32ae6f},'order':[['id','DESC']],'limit':0x1},'log':_0xb9ef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ce0337c..0b54e8f 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 _0xd0dd=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x265edc,_0x6e28ff){var _0x3709e7=function(_0x45ed07){while(--_0x45ed07){_0x265edc['push'](_0x265edc['shift']());}};_0x3709e7(++_0x6e28ff);}(_0xd0dd,0x1a7));var _0xdd0d=function(_0xbb494c,_0x405a80){_0xbb494c=_0xbb494c-0x0;var _0x16d333=_0xd0dd[_0xbb494c];return _0x16d333;};'use strict';var client=require(_0xdd0d('0x0'));exports[_0xdd0d('0x1')]=function(_0x5a9507,_0x2a3857){return client[_0xdd0d('0x2')](_0xdd0d('0x3'),{'body':_0x2a3857,'options':{'where':{'id':_0x5a9507}},'log':_0xdd0d('0x4')});};exports[_0xdd0d('0x5')]=function(_0x3cab2a,_0x34405e){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x34405e,'options':{'where':{'id':_0x3cab2a}},'log':_0xdd0d('0x6')});}; \ No newline at end of file +var _0xd4dd=['Request','addTagsToChatInteraction','../client'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd4dd,0x137));var _0xdd4d=function(_0x2dc610,_0x4f2a70){_0x2dc610=_0x2dc610-0x0;var _0x72f5f9=_0xd4dd[_0x2dc610];return _0x72f5f9;};'use strict';var client=require(_0xdd4d('0x0'));exports['update']=function(_0x263c3c,_0xf253b1){return client['Request']('UpdateOpenchannelInteraction',{'body':_0xf253b1,'options':{'where':{'id':_0x263c3c}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x4e7aa6,_0x59b546){return client[_0xdd4d('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x59b546,'options':{'where':{'id':_0x4e7aa6}},'log':_0xdd4d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index de6fdf7..1e5f797 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 _0xee52=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0xf3b3aa,_0x2043d0){var _0x3957cb=function(_0x5732b8){while(--_0x5732b8){_0xf3b3aa['push'](_0xf3b3aa['shift']());}};_0x3957cb(++_0x2043d0);}(_0xee52,0x16e));var _0x2ee5=function(_0x1a8955,_0x3c2aa8){_0x1a8955=_0x1a8955-0x0;var _0x1980bf=_0xee52[_0x1a8955];return _0x1980bf;};'use strict';var client=require(_0x2ee5('0x0'));exports[_0x2ee5('0x1')]=function(_0x3e0d68){return client[_0x2ee5('0x2')](_0x2ee5('0x3'),{'body':_0x3e0d68,'log':_0x2ee5('0x4')});}; \ No newline at end of file +var _0x70ea=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x70ea,0xb1));var _0xa70e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x70ea[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xa70e('0x0'));exports['create']=function(_0x270013){return client[_0xa70e('0x1')](_0xa70e('0x2'),{'body':_0x270013,'log':_0xa70e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e8a89da..b21b6a0 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 _0xe57a=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents'];(function(_0x40b551,_0x129c88){var _0x452ea9=function(_0x3b6523){while(--_0x3b6523){_0x40b551['push'](_0x40b551['shift']());}};_0x452ea9(++_0x129c88);}(_0xe57a,0x19c));var _0xae57=function(_0x561197,_0x2d7d64){_0x561197=_0x561197-0x0;var _0x191270=_0xe57a[_0x561197];return _0x191270;};'use strict';var client=require(_0xae57('0x0'));exports[_0xae57('0x1')]=function(){return function(){return client[_0xae57('0x2')](_0xae57('0x3'),{'options':{'raw':![],'attributes':['id',_0xae57('0x4'),_0xae57('0x5'),'strategy'],'include':[{'model':_0xae57('0x6'),'as':_0xae57('0x7'),'attributes':['id',_0xae57('0x4'),_0xae57('0x8'),_0xae57('0x9')]}]},'log':_0xae57('0x1')});};}; \ No newline at end of file +var _0x0aae=['User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0x0aae,0x1dd));var _0xe0aa=function(_0x393e08,_0x17d975){_0x393e08=_0x393e08-0x0;var _0x3ae793=_0x0aae[_0x393e08];return _0x3ae793;};'use strict';var client=require(_0xe0aa('0x0'));exports[_0xe0aa('0x1')]=function(){return function(){return client[_0xe0aa('0x2')](_0xe0aa('0x3'),{'options':{'raw':![],'attributes':['id',_0xe0aa('0x4'),_0xe0aa('0x5'),_0xe0aa('0x6')],'include':[{'model':_0xe0aa('0x7'),'as':_0xe0aa('0x8'),'attributes':['id',_0xe0aa('0x4'),_0xe0aa('0x9'),_0xe0aa('0xa')]}]},'log':_0xe0aa('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8f669a4..fa3397a 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 _0x5b2a=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x52d561,_0x5e15a9){var _0xfab148=function(_0x33a819){while(--_0x33a819){_0x52d561['push'](_0x52d561['shift']());}};_0xfab148(++_0x5e15a9);}(_0x5b2a,0x1bd));var _0xa5b2=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x5b2a[_0x4ec520];return _0xed49d7;};'use strict';var client=require(_0xa5b2('0x0'));exports[_0xa5b2('0x1')]=function(_0x1b8609){return client[_0xa5b2('0x2')](_0xa5b2('0x3'),{'body':_0x1b8609,'log':_0xa5b2('0x3')});};exports[_0xa5b2('0x4')]=function(_0x13fda1,_0x213886){return client[_0xa5b2('0x2')](_0xa5b2('0x5'),{'body':_0x213886,'options':{'where':{'uniqueid':_0x13fda1},'order':[['id',_0xa5b2('0x6')]],'limit':0x1},'log':_0xa5b2('0x5')});}; \ No newline at end of file +var _0xb1d9=['CreateOpenchannelQueueReport','update','DESC','../client','create','Request'];(function(_0x303401,_0xb09078){var _0x3a753d=function(_0x50ac59){while(--_0x50ac59){_0x303401['push'](_0x303401['shift']());}};_0x3a753d(++_0xb09078);}(_0xb1d9,0x147));var _0x9b1d=function(_0x3b9113,_0x5b5516){_0x3b9113=_0x3b9113-0x0;var _0x38d86f=_0xb1d9[_0x3b9113];return _0x38d86f;};'use strict';var client=require(_0x9b1d('0x0'));exports[_0x9b1d('0x1')]=function(_0x3411e7){return client[_0x9b1d('0x2')](_0x9b1d('0x3'),{'body':_0x3411e7,'log':_0x9b1d('0x3')});};exports[_0x9b1d('0x4')]=function(_0x34a962,_0x231500){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x231500,'options':{'where':{'uniqueid':_0x34a962},'order':[['id',_0x9b1d('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 994f8b8..5677c03 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 _0x1de4=['addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x1de4,0x94));var _0x41de=function(_0x64f4ae,_0x43bd40){_0x64f4ae=_0x64f4ae-0x0;var _0x4be1ce=_0x1de4[_0x64f4ae];return _0x4be1ce;};'use strict';var client=require(_0x41de('0x0'));exports[_0x41de('0x1')]=function(_0x1dd566,_0x100ced){return client['Request'](_0x41de('0x2'),{'body':_0x100ced,'options':{'where':{'id':_0x1dd566}},'log':_0x41de('0x3')});};exports[_0x41de('0x4')]=function(_0x5dd1cb,_0x378cbe){return client[_0x41de('0x5')]('AddTagsToSmsInteraction',{'body':_0x378cbe,'options':{'where':{'id':_0x5dd1cb}},'log':_0x41de('0x6')});}; \ No newline at end of file +var _0x9589=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x9bd932,_0x4b38a3){var _0x190e10=function(_0x566b18){while(--_0x566b18){_0x9bd932['push'](_0x9bd932['shift']());}};_0x190e10(++_0x4b38a3);}(_0x9589,0xbc));var _0x9958=function(_0x545f22,_0x5b313f){_0x545f22=_0x545f22-0x0;var _0xa8c4e=_0x9589[_0x545f22];return _0xa8c4e;};'use strict';var client=require(_0x9958('0x0'));exports[_0x9958('0x1')]=function(_0x220175,_0x454fcd){return client[_0x9958('0x2')]('UpdateSmsInteraction',{'body':_0x454fcd,'options':{'where':{'id':_0x220175}},'log':_0x9958('0x3')});};exports[_0x9958('0x4')]=function(_0xe7c0e,_0x4845d4){return client[_0x9958('0x2')](_0x9958('0x5'),{'body':_0x4845d4,'options':{'where':{'id':_0xe7c0e}},'log':_0x9958('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 359b6be..d73143d 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 _0xe4e9=['Request','createSmsMessage','create'];(function(_0x377b4d,_0x276e76){var _0x2b6d38=function(_0x3091b3){while(--_0x3091b3){_0x377b4d['push'](_0x377b4d['shift']());}};_0x2b6d38(++_0x276e76);}(_0xe4e9,0x146));var _0x9e4e=function(_0x5f4d87,_0x490576){_0x5f4d87=_0x5f4d87-0x0;var _0x1e2c8b=_0xe4e9[_0x5f4d87];return _0x1e2c8b;};'use strict';var client=require('../client');exports[_0x9e4e('0x0')]=function(_0x3caedb){return client[_0x9e4e('0x1')]('CreateSmsMessage',{'body':_0x3caedb,'log':_0x9e4e('0x2')});}; \ No newline at end of file +'use strict';var client=require('../client');exports['create']=function(_0x5bfd9c){return client['Request']('CreateSmsMessage',{'body':_0x5bfd9c,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5525a91..984f54e 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x3de84c,_0x5dad32){var _0x2f6e85=function(_0x86c05e){while(--_0x86c05e){_0x3de84c['push'](_0x3de84c['shift']());}};_0x2f6e85(++_0x5dad32);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e77c45e..7aba668 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x136df3,_0x242cf8){var _0x2ad0ea=function(_0x5ed962){while(--_0x5ed962){_0x136df3['push'](_0x136df3['shift']());}};_0x2ad0ea(++_0x242cf8);}(_0x70e0,0x17b));var _0x070e=function(_0x199355,_0x1c45a5){_0x199355=_0x199355-0x0;var _0x148b2f=_0x70e0[_0x199355];return _0x148b2f;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0xff3938,_0x33e8d3){var _0x13cdfb=function(_0x51f9be){while(--_0x51f9be){_0xff3938['push'](_0xff3938['shift']());}};_0x13cdfb(++_0x33e8d3);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6be7ec5..cfdea36 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(_0x2297d0,_0x23434b){var _0x42abb7=function(_0x49047a){while(--_0x49047a){_0x2297d0['push'](_0x2297d0['shift']());}};_0x42abb7(++_0x23434b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x10d154,_0x450448){var _0x5b9fd0=function(_0x521cb8){while(--_0x521cb8){_0x10d154['push'](_0x10d154['shift']());}};_0x5b9fd0(++_0x450448);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 8fe4030..74699ae 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 _0x50e5=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x492da8,_0x54157c){var _0x249d3b=function(_0x1a7d70){while(--_0x1a7d70){_0x492da8['push'](_0x492da8['shift']());}};_0x249d3b(++_0x54157c);}(_0x50e5,0xb7));var _0x550e=function(_0x48a0c8,_0x4620fd){_0x48a0c8=_0x48a0c8-0x0;var _0x10e3d5=_0x50e5[_0x48a0c8];return _0x10e3d5;};'use strict';var client=require(_0x550e('0x0'));exports[_0x550e('0x1')]=function(_0x524e28,_0x736dcd){return client[_0x550e('0x2')](_0x550e('0x3'),{'body':_0x736dcd,'options':{'where':{'id':_0x524e28}},'log':_0x550e('0x4')});};exports[_0x550e('0x5')]=function(_0x3f3a13,_0x78e6c5){return client[_0x550e('0x2')](_0x550e('0x6'),{'body':_0x78e6c5,'options':{'where':{'id':_0x3f3a13}},'log':_0x550e('0x7')});}; \ No newline at end of file +var _0x598a=['update','Request','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x5bccb7,_0x412a2a){var _0x3d6ada=function(_0x361743){while(--_0x361743){_0x5bccb7['push'](_0x5bccb7['shift']());}};_0x3d6ada(++_0x412a2a);}(_0x598a,0xfb));var _0xa598=function(_0x44b9d3,_0x509aaa){_0x44b9d3=_0x44b9d3-0x0;var _0x2ce9b2=_0x598a[_0x44b9d3];return _0x2ce9b2;};'use strict';var client=require(_0xa598('0x0'));exports[_0xa598('0x1')]=function(_0x5c6955,_0x3d9230){return client[_0xa598('0x2')]('UpdateWhatsappInteraction',{'body':_0x3d9230,'options':{'where':{'id':_0x5c6955}},'log':_0xa598('0x3')});};exports['addTags']=function(_0x4958fc,_0x4a1f8d){return client[_0xa598('0x2')](_0xa598('0x4'),{'body':_0x4a1f8d,'options':{'where':{'id':_0x4958fc}},'log':_0xa598('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2cd0abb..025f4ff 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 _0x86e7=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x224912,_0x3e7580){var _0x23502d=function(_0x5279b5){while(--_0x5279b5){_0x224912['push'](_0x224912['shift']());}};_0x23502d(++_0x3e7580);}(_0x86e7,0x199));var _0x786e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x86e7[_0x53ccf2];return _0x5a2964;};'use strict';var client=require('../client');exports[_0x786e('0x0')]=function(_0xace59f){return client[_0x786e('0x1')](_0x786e('0x2'),{'body':_0xace59f,'log':_0x786e('0x3')});}; \ No newline at end of file +var _0x202d=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x3a87d1,_0x584e71){var _0x3aa6d8=function(_0x1e1417){while(--_0x1e1417){_0x3a87d1['push'](_0x3a87d1['shift']());}};_0x3aa6d8(++_0x584e71);}(_0x202d,0x1a8));var _0xd202=function(_0x29a337,_0x4defb4){_0x29a337=_0x29a337-0x0;var _0x22f12e=_0x202d[_0x29a337];return _0x22f12e;};'use strict';var client=require(_0xd202('0x0'));exports['create']=function(_0x439566){return client[_0xd202('0x1')](_0xd202('0x2'),{'body':_0x439566,'log':_0xd202('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 83c14c7..3087f7e 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 _0x3fd6=['getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','whatsappPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fd6,0xa8));var _0x63fd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3fd6[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports[_0x63fd('0x0')]=function(){return function(){return client[_0x63fd('0x1')](_0x63fd('0x2'),{'options':{'raw':![],'attributes':['id',_0x63fd('0x3'),'timeout',_0x63fd('0x4')],'include':[{'model':_0x63fd('0x5'),'as':'Agents','attributes':['id',_0x63fd('0x3'),'online',_0x63fd('0x6')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xc4dd=['timeout','User','Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc4dd,0x13d));var _0xdc4d=function(_0x35e49e,_0x2a5b24){_0x35e49e=_0x35e49e-0x0;var _0x2200b9=_0xc4dd[_0x35e49e];return _0x2200b9;};'use strict';var client=require('../client');exports[_0xdc4d('0x0')]=function(){return function(){return client['Request'](_0xdc4d('0x1'),{'options':{'raw':![],'attributes':['id',_0xdc4d('0x2'),_0xdc4d('0x3'),'strategy'],'include':[{'model':_0xdc4d('0x4'),'as':_0xdc4d('0x5'),'attributes':['id','name',_0xdc4d('0x6'),_0xdc4d('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 457fead..68952ce 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 _0x50cd=['../client','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0xa0d6e8,_0x41e320){var _0x4ba300=function(_0x5ad796){while(--_0x5ad796){_0xa0d6e8['push'](_0xa0d6e8['shift']());}};_0x4ba300(++_0x41e320);}(_0x50cd,0xa5));var _0xd50c=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0x50cd[_0x3d8d0a];return _0x5b9df5;};'use strict';var client=require(_0xd50c('0x0'));exports['create']=function(_0x4c7dfa){return client[_0xd50c('0x1')](_0xd50c('0x2'),{'body':_0x4c7dfa,'log':_0xd50c('0x2')});};exports['update']=function(_0x17785a,_0x4a1968){return client[_0xd50c('0x1')](_0xd50c('0x3'),{'body':_0x4a1968,'options':{'where':{'uniqueid':_0x17785a},'order':[['id',_0xd50c('0x4')]],'limit':0x1},'log':_0xd50c('0x3')});}; \ No newline at end of file +var _0x5cdd=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','Request'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x5cdd,0x155));var _0xd5cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cdd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x132f60){return client[_0xd5cd('0x0')](_0xd5cd('0x1'),{'body':_0x132f60,'log':_0xd5cd('0x1')});};exports['update']=function(_0x309a32,_0x1b6b09){return client[_0xd5cd('0x0')](_0xd5cd('0x2'),{'body':_0x1b6b09,'options':{'where':{'uniqueid':_0x309a32},'order':[['id','DESC']],'limit':0x1},'log':_0xd5cd('0x2')});}; \ 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 d3d9216..196c8fa 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 _0x51ac=['info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','stop','find','agents','atimeout','format','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','log','stack','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x10ec84,_0x42bd9b){var _0x1d7e51=function(_0x177907){while(--_0x177907){_0x10ec84['push'](_0x10ec84['shift']());}};_0x1d7e51(++_0x42bd9b);}(_0x51ac,0x16c));var _0xc51a=function(_0x5d4b3c,_0x18503d){_0x5d4b3c=_0x5d4b3c-0x0;var _0x18313a=_0x51ac[_0x5d4b3c];return _0x18313a;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xc51a('0x0'));var seqqueue=require(_0xc51a('0x1'));var logger=require(_0xc51a('0x2'))('routing');var strategy=require(_0xc51a('0x3'));var queue=schema({'name':{'type':_0xc51a('0x4'),'required':!![],'message':_0xc51a('0x5')},'timeout':{'type':_0xc51a('0x6'),'message':_0xc51a('0x7')}});function writeLog(_0x3a459d,_0x32d931,_0x558856){return logger[_0xc51a('0x8')](util['format'](_0xc51a('0x9'),_0x3a459d,_0x32d931[_0xc51a('0xa')],_0x558856));}function handleFindAgent(_0x2536de){return function(_0x597342){return _0x597342[_0xc51a('0xa')][_0xc51a('0xb')]()===_0x2536de['toLowerCase']();};}exports[_0xc51a('0xc')]=function(_0x5621af,_0x57ae79,_0x227279,_0x12caf1){return function(_0x2492cb){try{var _0x371b6e={'name':_0x57ae79[0x0],'timeout':_0x57ae79[0x1]};var _0x1f4cc5=queue['validate'](_0x371b6e,{'typecast':!![]});if(_0x1f4cc5[_0xc51a('0xd')]){logger[_0xc51a('0xe')](_0xc51a('0xf'),_0x5621af,_[_0xc51a('0x10')](_0x1f4cc5,'message')['join'](',\x20'));_0x2492cb[_0xc51a('0x11')]();}else{var _0x48b874=_[_0xc51a('0x12')](_0x227279[_0xc51a('0x13')],handleFindAgent(_0x371b6e['name']));if(_0x48b874){var _0xaa7c72=(_0x371b6e['timeout']||0xa)*0x3e8;var _0x2bfcfc,_0x28716e;var _0x5e3391=seqqueue['createQueue'](_0xaa7c72);_0x5e3391['id']=_0x5621af;_0x5e3391[_0xc51a('0x14')]=_0xaa7c72;_0x5e3391['channel']=_0x12caf1['channel'];writeLog(_0x5621af,_0x48b874,util[_0xc51a('0x15')](_0xc51a('0x16'),_0xaa7c72));_0x227279[_0xc51a('0x17')][_0x5621af]['on'](_0xc51a('0x18'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5621af);clearTimeout(_0x28716e);_0x28716e=undefined;_0x5e3391[_0xc51a('0x19')]();if(_0x227279[_0xc51a('0x17')][_0x5621af]){delete _0x227279['rules'][_0x5621af];}_0x2492cb[_0xc51a('0x11')]();});_0x227279[_0xc51a('0x17')][_0x5621af]['on'](_0xc51a('0x1a'),function(){if(_0x227279[_0xc51a('0x17')][_0x5621af]){delete _0x227279[_0xc51a('0x17')][_0x5621af];}});_0x28716e=setTimeout(function(){logger[_0xc51a('0x8')](_0xc51a('0x1b'),_0x5621af);clearTimeout(_0x28716e);_0x5e3391[_0xc51a('0x19')]();_0x2492cb['next']();},_0xaa7c72);strategy[_0xc51a('0x1c')](_0x5e3391,_0x48b874,_0x227279,_0x12caf1);}else{logger[_0xc51a('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5621af,_0x371b6e[_0xc51a('0xa')]);_0x2492cb[_0xc51a('0x11')]();}}}catch(_0x12639c){console[_0xc51a('0x1d')](_0x12639c);logger[_0xc51a('0xe')]('[%s][QUEUE]\x20%s',_0x5621af,_0x12639c[_0xc51a('0x1e')]);_0x2492cb[_0xc51a('0x11')]();}};}; \ No newline at end of file +var _0xe2a3=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xe2a3,0xd1));var _0x3e2a=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xe2a3[_0x16337a];return _0x422365;};'use strict';var schema=require(_0x3e2a('0x0'));var _=require(_0x3e2a('0x1'));var util=require(_0x3e2a('0x2'));var seqqueue=require(_0x3e2a('0x3'));var logger=require(_0x3e2a('0x4'))('routing');var strategy=require(_0x3e2a('0x5'));var queue=schema({'name':{'type':_0x3e2a('0x6'),'required':!![],'message':_0x3e2a('0x7')},'timeout':{'type':_0x3e2a('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xa9a42e,_0x18b343,_0x490d3f){return logger[_0x3e2a('0x9')](util[_0x3e2a('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0xa9a42e,_0x18b343[_0x3e2a('0xb')],_0x490d3f));}function handleFindAgent(_0x5da800){return function(_0x25d904){return _0x25d904['name'][_0x3e2a('0xc')]()===_0x5da800[_0x3e2a('0xc')]();};}exports[_0x3e2a('0xd')]=function(_0x2b7eb9,_0x2a3fc6,_0x314d17,_0x1f7159){return function(_0x64bd4c){try{var _0x155c70={'name':_0x2a3fc6[0x0],'timeout':_0x2a3fc6[0x1]};var _0x400ddc=queue[_0x3e2a('0x0')](_0x155c70,{'typecast':!![]});if(_0x400ddc['length']){logger[_0x3e2a('0xe')](_0x3e2a('0xf'),_0x2b7eb9,_[_0x3e2a('0x10')](_0x400ddc,_0x3e2a('0x11'))[_0x3e2a('0x12')](',\x20'));_0x64bd4c[_0x3e2a('0x13')]();}else{var _0x397f9f=_['find'](_0x314d17[_0x3e2a('0x14')],handleFindAgent(_0x155c70[_0x3e2a('0xb')]));if(_0x397f9f){var _0x1126b7=(_0x155c70[_0x3e2a('0x15')]||0xa)*0x3e8;var _0x3c256c,_0x26770e;var _0x4b1455=seqqueue[_0x3e2a('0x16')](_0x1126b7);_0x4b1455['id']=_0x2b7eb9;_0x4b1455[_0x3e2a('0x17')]=_0x1126b7;_0x4b1455[_0x3e2a('0x18')]=_0x1f7159[_0x3e2a('0x18')];writeLog(_0x2b7eb9,_0x397f9f,util[_0x3e2a('0xa')]('START:%s',_0x1126b7));_0x314d17['rules'][_0x2b7eb9]['on'](_0x3e2a('0x19'),function(){logger[_0x3e2a('0x9')](_0x3e2a('0x1a'),_0x2b7eb9);clearTimeout(_0x26770e);_0x26770e=undefined;_0x4b1455['close']();if(_0x314d17['rules'][_0x2b7eb9]){delete _0x314d17[_0x3e2a('0x1b')][_0x2b7eb9];}_0x64bd4c[_0x3e2a('0x13')]();});_0x314d17[_0x3e2a('0x1b')][_0x2b7eb9]['on']('complete',function(){if(_0x314d17[_0x3e2a('0x1b')][_0x2b7eb9]){delete _0x314d17[_0x3e2a('0x1b')][_0x2b7eb9];}});_0x26770e=setTimeout(function(){logger['info'](_0x3e2a('0x1c'),_0x2b7eb9);clearTimeout(_0x26770e);_0x4b1455[_0x3e2a('0x1d')]();_0x64bd4c[_0x3e2a('0x1e')]();},_0x1126b7);strategy[_0x3e2a('0x1f')](_0x4b1455,_0x397f9f,_0x314d17,_0x1f7159);}else{logger[_0x3e2a('0xe')](_0x3e2a('0x20'),_0x2b7eb9,_0x155c70['name']);_0x64bd4c[_0x3e2a('0x13')]();}}}catch(_0x38c2bb){console[_0x3e2a('0x21')](_0x38c2bb);logger[_0x3e2a('0xe')](_0x3e2a('0x22'),_0x2b7eb9,_0x38c2bb[_0x3e2a('0x23')]);_0x64bd4c[_0x3e2a('0x13')]();}};}; \ 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 a1febb4..a4bfd31 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 _0xfca5=['sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','message','amazonlex','providerResponse','Message','dialogState','catch','moment','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x27fcb3,_0x542d2e){var _0x2ebc4e=function(_0x112748){while(--_0x112748){_0x27fcb3['push'](_0x27fcb3['shift']());}};_0x2ebc4e(++_0x542d2e);}(_0xfca5,0xe2));var _0x5fca=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0xfca5[_0x290fa6];return _0x47f1f3;};'use strict';var _=require('lodash');var moment=require(_0x5fca('0x0'));var AWS=require(_0x5fca('0x1'));var utils=require('./utils');var logger=require(_0x5fca('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5fca('0x3')),'mailMessage':require(_0x5fca('0x4')),'smsMessage':require(_0x5fca('0x5')),'faxMessage':require(_0x5fca('0x6')),'whatsappMessage':require(_0x5fca('0x7'))};exports[_0x5fca('0x8')]=function(_0x5897fe,_0x2c03dd){return function(_0x808f5d){try{if(!_[_0x5fca('0x9')](this['interaction'][_0x5fca('0xa')])){logger[_0x5fca('0xb')](_0x5fca('0xc'),_0x5897fe,_0x5fca('0xd'));return _0x808f5d[_0x5fca('0xe')]();}var _0x915f18={'ContactId':this[_0x5fca('0xf')]['id'],'sentAt':moment()['format'](_0x5fca('0x10')),'direction':_0x5fca('0x11')};if(this[_0x5fca('0x12')]===_0x5fca('0x13')||this[_0x5fca('0x12')]===_0x5fca('0x14')){_0x915f18[_0x5fca('0x15')]=this['interaction']['phone'];}var _0x279065=this[_0x5fca('0x12')];if(_0x279065===_0x5fca('0x16')){_0x915f18[_0x5fca('0x17')]=this[_0x5fca('0x18')]['id'];}else{_0x915f18[_[_0x5fca('0x19')](_0x279065)+_0x5fca('0x1a')]=this['account']['id'];}_0x915f18[_[_0x5fca('0x19')](_0x279065)+_0x5fca('0x1b')]=this[_0x5fca('0x1c')]['id'];if(this[_0x5fca('0x1c')][_0x5fca('0x1d')]){var _0x3cf6cf=_0x2c03dd[0x4];if(!_[_0x5fca('0x1e')](_0x3cf6cf)){_0x915f18[_0x5fca('0x1f')]=utils[_0x5fca('0x20')](_0x3cf6cf,this);return rpc[_0x279065+'Message'][_0x5fca('0x21')](_0x915f18)[_0x5fca('0x22')](function(_0x1eb48b){logger['info'](_0x5fca('0xc'),_0x5897fe,_0x915f18[_0x5fca('0x1f')]);})['catch'](function(_0x54fec4){logger[_0x5fca('0x23')](_0x5fca('0xc'),_0x5897fe,JSON[_0x5fca('0x24')](_0x54fec4));})[_0x5fca('0x25')](function(){logger[_0x5fca('0xb')](_0x5fca('0x26'),_0x5897fe);_0x808f5d[_0x5fca('0x27')]();});}else{logger[_0x5fca('0xb')](_0x5fca('0x28'),_0x5897fe);_0x808f5d[_0x5fca('0x27')]();}}else{var _0xd1174e=this;var _0x555878=new AWS[(_0x5fca('0x29'))]({'accessKeyId':_0x2c03dd[0x0],'secretAccessKey':_0x2c03dd[0x1],'region':_0x2c03dd[0x2]});var _0x4ff777={'botAlias':'$LATEST','botName':_0x2c03dd[0x3],'inputText':this['message'][_0x5fca('0x1f')],'userId':this[_0x5fca('0x12')]+':'+this[_0x5fca('0x1c')]['id'][_0x5fca('0x2a')]()};_0x555878['postText'](_0x4ff777,function(_0x409c4c,_0x34ce8c){if(_0x409c4c){logger[_0x5fca('0x23')](_0x5fca('0xc'),_0x5897fe,_0x409c4c[_0x5fca('0x2b')]);_0x808f5d[_0x5fca('0xe')]();}else if(_0x34ce8c&&_0x34ce8c[_0x5fca('0x2b')]){_0xd1174e[_0x5fca('0x1f')][_0x5fca('0x2c')]=_0x34ce8c;_0x915f18['body']=_0x34ce8c[_0x5fca('0x2b')];_0x915f18['providerName']=_0x5fca('0x2c');_0x915f18[_0x5fca('0x2d')]=JSON[_0x5fca('0x24')](_0x34ce8c);return rpc[_0x279065+_0x5fca('0x2e')][_0x5fca('0x21')](_0x915f18)[_0x5fca('0x22')](function(_0x1f7c06){logger[_0x5fca('0xb')](_0x5fca('0xc'),_0x5897fe,_0x915f18[_0x5fca('0x1f')]);if(_0x34ce8c[_0x5fca('0x2f')]=='Failed'){_0x808f5d[_0x5fca('0xe')]();}else{_0x808f5d[_0x5fca('0x27')]();}})[_0x5fca('0x30')](function(_0x5d26dd){logger[_0x5fca('0x23')](_0x5fca('0xc'),_0x5897fe,JSON['stringify'](_0x5d26dd));_0x808f5d[_0x5fca('0xe')]();});}else{_0x808f5d[_0x5fca('0xe')]();}});}}catch(_0x1e80c0){logger[_0x5fca('0x23')]('[%s][AMAZONLEX]\x20%s',_0x5897fe,JSON[_0x5fca('0x24')](_0x1e80c0));_0x808f5d[_0x5fca('0x27')]();}};}; \ No newline at end of file +var _0x8cc3=['Failed','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','amazonlex','providerName','providerResponse','dialogState'];(function(_0x33d31e,_0x1f682f){var _0x5bb8ce=function(_0x1584bc){while(--_0x1584bc){_0x33d31e['push'](_0x33d31e['shift']());}};_0x5bb8ce(++_0x1f682f);}(_0x8cc3,0x1e1));var _0x38cc=function(_0x44f4ac,_0x53ae78){_0x44f4ac=_0x44f4ac-0x0;var _0x4f69c4=_0x8cc3[_0x44f4ac];return _0x4f69c4;};'use strict';var _=require(_0x38cc('0x0'));var moment=require(_0x38cc('0x1'));var AWS=require('aws-sdk');var utils=require(_0x38cc('0x2'));var logger=require(_0x38cc('0x3'))('routing');var rpc={'chatMessage':require(_0x38cc('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x38cc('0x5')),'smsMessage':require(_0x38cc('0x6')),'faxMessage':require(_0x38cc('0x7')),'whatsappMessage':require(_0x38cc('0x8'))};exports[_0x38cc('0x9')]=function(_0x44ee8e,_0x44a7e3){return function(_0x156db4){try{if(!_['isNil'](this[_0x38cc('0xa')][_0x38cc('0xb')])){logger[_0x38cc('0xc')](_0x38cc('0xd'),_0x44ee8e,_0x38cc('0xe'));return _0x156db4[_0x38cc('0xf')]();}var _0x4b5df1={'ContactId':this[_0x38cc('0x10')]['id'],'sentAt':moment()['format'](_0x38cc('0x11')),'direction':_0x38cc('0x12')};if(this[_0x38cc('0x13')]===_0x38cc('0x14')||this[_0x38cc('0x13')]===_0x38cc('0x15')){_0x4b5df1['phone']=this[_0x38cc('0xa')][_0x38cc('0x16')];}var _0x2d0d15=this['channel'];if(_0x2d0d15===_0x38cc('0x17')){_0x4b5df1[_0x38cc('0x18')]=this[_0x38cc('0x19')]['id'];}else{_0x4b5df1[_['upperFirst'](_0x2d0d15)+'AccountId']=this[_0x38cc('0x19')]['id'];}_0x4b5df1[_[_0x38cc('0x1a')](_0x2d0d15)+_0x38cc('0x1b')]=this['interaction']['id'];if(this['interaction'][_0x38cc('0x1c')]){var _0x57650a=_0x44a7e3[0x4];if(!_[_0x38cc('0x1d')](_0x57650a)){_0x4b5df1['body']=utils[_0x38cc('0x1e')](_0x57650a,this);return rpc[_0x2d0d15+_0x38cc('0x1f')][_0x38cc('0x20')](_0x4b5df1)[_0x38cc('0x21')](function(_0x3a2543){logger[_0x38cc('0xc')](_0x38cc('0xd'),_0x44ee8e,_0x4b5df1[_0x38cc('0x22')]);})[_0x38cc('0x23')](function(_0x4e4062){logger[_0x38cc('0x24')](_0x38cc('0xd'),_0x44ee8e,JSON[_0x38cc('0x25')](_0x4e4062));})[_0x38cc('0x26')](function(){logger[_0x38cc('0xc')](_0x38cc('0x27'),_0x44ee8e);_0x156db4[_0x38cc('0x28')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x44ee8e);_0x156db4[_0x38cc('0x28')]();}}else{var _0x4ccfd1=this;var _0x13ba59=new AWS[(_0x38cc('0x29'))]({'accessKeyId':_0x44a7e3[0x0],'secretAccessKey':_0x44a7e3[0x1],'region':_0x44a7e3[0x2]});var _0x24b520={'botAlias':'$LATEST','botName':_0x44a7e3[0x3],'inputText':this[_0x38cc('0x2a')]['body'],'userId':this[_0x38cc('0x13')]+':'+this[_0x38cc('0xa')]['id']['toString']()};_0x13ba59['postText'](_0x24b520,function(_0x5da838,_0x21c192){if(_0x5da838){logger[_0x38cc('0x24')]('[%s][AMAZONLEX]\x20%s',_0x44ee8e,_0x5da838[_0x38cc('0x2a')]);_0x156db4[_0x38cc('0xf')]();}else if(_0x21c192&&_0x21c192[_0x38cc('0x2a')]){_0x4ccfd1[_0x38cc('0x22')][_0x38cc('0x2b')]=_0x21c192;_0x4b5df1['body']=_0x21c192['message'];_0x4b5df1[_0x38cc('0x2c')]=_0x38cc('0x2b');_0x4b5df1[_0x38cc('0x2d')]=JSON[_0x38cc('0x25')](_0x21c192);return rpc[_0x2d0d15+_0x38cc('0x1f')][_0x38cc('0x20')](_0x4b5df1)[_0x38cc('0x21')](function(_0x2d3bcb){logger['info'](_0x38cc('0xd'),_0x44ee8e,_0x4b5df1[_0x38cc('0x22')]);if(_0x21c192[_0x38cc('0x2e')]==_0x38cc('0x2f')){_0x156db4['next']();}else{_0x156db4[_0x38cc('0x28')]();}})[_0x38cc('0x23')](function(_0x4382f4){logger['error'](_0x38cc('0xd'),_0x44ee8e,JSON['stringify'](_0x4382f4));_0x156db4[_0x38cc('0xf')]();});}else{_0x156db4[_0x38cc('0xf')]();}});}}catch(_0x195b1a){logger[_0x38cc('0x24')](_0x38cc('0xd'),_0x44ee8e,JSON[_0x38cc('0x25')](_0x195b1a));_0x156db4[_0x38cc('0x28')]();}};}; \ 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 396daaf..e800099 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 _0x2de4=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','created','interaction','info','autoreplyExecuted','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','replace','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction'];(function(_0x4523eb,_0x4a5c5c){var _0x15aa78=function(_0x1ed14a){while(--_0x1ed14a){_0x4523eb['push'](_0x4523eb['shift']());}};_0x15aa78(++_0x4a5c5c);}(_0x2de4,0x1a6));var _0x42de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2de4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x42de('0x0'));var moment=require('moment');var utils=require(_0x42de('0x1'));var logger=require(_0x42de('0x2'))(_0x42de('0x3'));var rpc={'chatMessage':require(_0x42de('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x42de('0x5')),'smsMessage':require(_0x42de('0x6')),'faxMessage':require(_0x42de('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x42de('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x42de('0x9')),'smsInteraction':require(_0x42de('0xa')),'faxInteraction':require(_0x42de('0xb')),'whatsappInteraction':require(_0x42de('0xc'))};var mailRpc=require(_0x42de('0xd'));exports[_0x42de('0xe')]=function(_0x3deb24,_0x4d4220,_0x23607e,_0x420d7c){return function(_0x148f19){try{var _0x52060a=this[_0x42de('0xf')];if(_0x52060a===_0x42de('0x10')&&_0x420d7c[_0x42de('0x11')][_0x42de('0x12')]){logger['info'](_0x42de('0x13'),_0x3deb24,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x148f19[_0x42de('0x14')]();}if(_0x4d4220[0x0]==='1'&&(_[_0x42de('0x15')](this['interaction'][_0x42de('0x16')])||!this[_0x42de('0x17')][_0x42de('0x16')])){logger[_0x42de('0x18')]('[%s][AUTOREPLY]\x20%s',_0x3deb24,'Autoreply\x20already\x20sent');return _0x148f19[_0x42de('0x14')]();}if(_0x4d4220[0x0]==='2'&&this[_0x42de('0x17')][_0x42de('0x19')]){logger[_0x42de('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3deb24,'One\x20Time\x20already\x20sent');return _0x148f19['next']();}var _0x47793d={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x42de('0x1a')),'direction':_0x42de('0x1b')};if(this['channel']===_0x42de('0x10')){_0x47793d['body']=utils['getMustacheRender'](_0x4d4220[0x2],this);}else{_0x47793d['body']=utils['getMustacheRender'](_0x4d4220[0x1],this);}if(this[_0x42de('0x1c')]){_0x47793d['to']=this[_0x42de('0x1c')][_0x42de('0x1d')]||'';if(this['channel']===_0x42de('0x10')&&_0x4d4220[0x1]==='1'){_0x47793d['cc']=this[_0x42de('0x1c')]['cc']||'';}_0x47793d['from']=this[_0x42de('0x1c')]['to']||'';_0x47793d['phone']=this[_0x42de('0x1c')][_0x42de('0x1e')]||'';_0x47793d['read']=!![];if(this[_0x42de('0x1c')]['subject']){_0x47793d[_0x42de('0x1f')]='';_0x47793d[_0x42de('0x1f')]+=_[_0x42de('0x20')](this[_0x42de('0x1c')][_0x42de('0x1f')],'Re:')?'':_0x42de('0x21');_0x47793d['subject']+=this[_0x42de('0x1c')][_0x42de('0x1f')];}}if(this['channel']===_0x42de('0x22')){_0x47793d[_0x42de('0x23')]=this['account']['id'];}else{_0x47793d[_[_0x42de('0x24')](this[_0x42de('0xf')])+_0x42de('0x25')]=this[_0x42de('0x26')]['id'];}_0x47793d[_[_0x42de('0x24')](this[_0x42de('0xf')])+_0x42de('0x27')]=this['interaction']['id'];var _0x422621=this['interaction'];if(rpc[this['channel']+_0x42de('0x28')]){if(this[_0x42de('0xf')]===_0x42de('0x10')){var _0x4564b2={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x42de('0x29')][_0x42de('0x2a')]){_0x4564b2[_0x42de('0x2a')]=this[_0x42de('0x26')][_0x42de('0x29')][_0x42de('0x2a')];}else{_0x4564b2[_0x42de('0x2b')]=this[_0x42de('0x26')][_0x42de('0x29')][_0x42de('0x2b')];_0x4564b2[_0x42de('0x2c')]=this[_0x42de('0x26')]['Smtp'][_0x42de('0x2c')];_0x4564b2[_0x42de('0x2d')]=this['account'][_0x42de('0x29')][_0x42de('0x2d')];}if(this[_0x42de('0x26')][_0x42de('0x29')][_0x42de('0x2e')]){_0x4564b2[_0x42de('0x2f')]={'user':this[_0x42de('0x26')]['Smtp'][_0x42de('0x30')],'pass':this[_0x42de('0x26')][_0x42de('0x29')][_0x42de('0x31')]};}_0x47793d[_0x42de('0x32')]=this[_0x42de('0x1c')]['messageId'];_0x47793d['html']=''+_[_0x42de('0x33')](_0x47793d[_0x42de('0x11')],_0x42de('0x34'),'','replace','','headers','auto-replied','All','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','next','create','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1ca2,0x90));var _0x21ca=function(_0x15eb63,_0xd3f629){_0x15eb63=_0x15eb63-0x0;var _0x19fc81=_0x1ca2[_0x15eb63];return _0x19fc81;};'use strict';var _=require('lodash');var moment=require(_0x21ca('0x0'));var utils=require(_0x21ca('0x1'));var logger=require(_0x21ca('0x2'))(_0x21ca('0x3'));var rpc={'chatMessage':require(_0x21ca('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x21ca('0x5')),'smsMessage':require(_0x21ca('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x21ca('0x7')),'chatInteraction':require(_0x21ca('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x21ca('0x9')),'smsInteraction':require(_0x21ca('0xa')),'faxInteraction':require(_0x21ca('0xb')),'whatsappInteraction':require(_0x21ca('0xc'))};var mailRpc=require(_0x21ca('0xd'));exports[_0x21ca('0xe')]=function(_0x9d5df8,_0x36b006,_0x162736,_0x1efdba){return function(_0x25ca0f){try{var _0x1bdb05=this['channel'];if(_0x1bdb05==='mail'&&_0x1efdba[_0x21ca('0xf')][_0x21ca('0x10')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x9d5df8,_0x21ca('0x11'));return _0x25ca0f['next']();}if(_0x36b006[0x0]==='1'&&(_[_0x21ca('0x12')](this[_0x21ca('0x13')][_0x21ca('0x14')])||!this[_0x21ca('0x13')][_0x21ca('0x14')])){logger[_0x21ca('0x15')](_0x21ca('0x16'),_0x9d5df8,_0x21ca('0x17'));return _0x25ca0f['next']();}if(_0x36b006[0x0]==='2'&&this[_0x21ca('0x13')][_0x21ca('0x18')]){logger['info'](_0x21ca('0x19'),_0x9d5df8,_0x21ca('0x1a'));return _0x25ca0f['next']();}var _0x4fc4aa={'ContactId':this[_0x21ca('0x1b')]['id'],'sentAt':moment()['format'](_0x21ca('0x1c')),'direction':_0x21ca('0x1d')};if(this[_0x21ca('0x1e')]===_0x21ca('0x1f')){_0x4fc4aa[_0x21ca('0xf')]=utils[_0x21ca('0x20')](_0x36b006[0x2],this);}else{_0x4fc4aa['body']=utils[_0x21ca('0x20')](_0x36b006[0x1],this);}if(this[_0x21ca('0x21')]){_0x4fc4aa['to']=this['message'][_0x21ca('0x22')]||'';if(this[_0x21ca('0x1e')]==='mail'&&_0x36b006[0x1]==='1'){_0x4fc4aa['cc']=this[_0x21ca('0x21')]['cc']||'';}_0x4fc4aa[_0x21ca('0x22')]=this[_0x21ca('0x21')]['to']||'';_0x4fc4aa[_0x21ca('0x23')]=this[_0x21ca('0x21')][_0x21ca('0x23')]||'';_0x4fc4aa['read']=!![];if(this[_0x21ca('0x21')]['subject']){_0x4fc4aa[_0x21ca('0x24')]='';_0x4fc4aa[_0x21ca('0x24')]+=_[_0x21ca('0x25')](this[_0x21ca('0x21')][_0x21ca('0x24')],_0x21ca('0x26'))?'':_0x21ca('0x27');_0x4fc4aa[_0x21ca('0x24')]+=this[_0x21ca('0x21')][_0x21ca('0x24')];}}if(this['channel']===_0x21ca('0x28')){_0x4fc4aa[_0x21ca('0x29')]=this['account']['id'];}else{_0x4fc4aa[_['upperFirst'](this[_0x21ca('0x1e')])+_0x21ca('0x2a')]=this[_0x21ca('0x2b')]['id'];}_0x4fc4aa[_[_0x21ca('0x2c')](this['channel'])+_0x21ca('0x2d')]=this[_0x21ca('0x13')]['id'];var _0x45e31d=this[_0x21ca('0x13')];if(rpc[this['channel']+_0x21ca('0x2e')]){if(this[_0x21ca('0x1e')]===_0x21ca('0x1f')){var _0x2eb5f9={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x21ca('0x2f')][_0x21ca('0x30')]){_0x2eb5f9['service']=this[_0x21ca('0x2b')][_0x21ca('0x2f')]['service'];}else{_0x2eb5f9[_0x21ca('0x31')]=this[_0x21ca('0x2b')][_0x21ca('0x2f')][_0x21ca('0x31')];_0x2eb5f9[_0x21ca('0x32')]=this[_0x21ca('0x2b')][_0x21ca('0x2f')][_0x21ca('0x32')];_0x2eb5f9[_0x21ca('0x33')]=this[_0x21ca('0x2b')][_0x21ca('0x2f')][_0x21ca('0x33')];}if(this['account'][_0x21ca('0x2f')][_0x21ca('0x34')]){_0x2eb5f9[_0x21ca('0x35')]={'user':this[_0x21ca('0x2b')][_0x21ca('0x2f')][_0x21ca('0x36')],'pass':this[_0x21ca('0x2b')]['Smtp'][_0x21ca('0x37')]};}_0x4fc4aa[_0x21ca('0x38')]=this[_0x21ca('0x21')][_0x21ca('0x39')];_0x4fc4aa[_0x21ca('0x3a')]=_0x21ca('0x3b')+_[_0x21ca('0x3c')](_0x4fc4aa['body'],_0x21ca('0x3d'),_0x21ca('0x3e'))+_0x21ca('0x3f');_0x4fc4aa[_0x21ca('0x40')]={'Auto-Submitted':_0x21ca('0x41'),'X-Auto-Response-Suppress':_0x21ca('0x42'),'Precedence':'auto_reply'};return mailRpc[_0x21ca('0x43')](_0x2eb5f9,_0x4fc4aa)[_0x21ca('0x44')](function(_0x17c60d){logger[_0x21ca('0x15')](_0x21ca('0x45'),_0x9d5df8);_0x4fc4aa[_0x21ca('0x39')]=_0x17c60d[_0x21ca('0x21')]['messageId'];return rpc[_0x1bdb05+'Message']['create'](_0x4fc4aa);})[_0x21ca('0x44')](function(_0x44523d){logger[_0x21ca('0x15')](_0x21ca('0x16'),_0x9d5df8,JSON[_0x21ca('0x46')](_0x44523d));})[_0x21ca('0x47')](function(_0x351d87){logger['error'](_0x21ca('0x48'),_0x9d5df8,JSON[_0x21ca('0x46')](_0x351d87));})[_0x21ca('0x49')](function(){Promise[_0x21ca('0x4a')]()[_0x21ca('0x44')](function(){if(_0x36b006[0x0]!=='2'||_0x45e31d[_0x21ca('0x18')])return;return rpc[_0x1bdb05+_0x21ca('0x4b')][_0x21ca('0x4c')](_0x45e31d['id'],{'autoreplyExecuted':!![]})[_0x21ca('0x44')](function(_0x4e1e58){logger[_0x21ca('0x15')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x9d5df8,JSON[_0x21ca('0x46')](_0x4e1e58));})[_0x21ca('0x47')](function(_0x3a3ebb){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x9d5df8,JSON[_0x21ca('0x46')](_0x3a3ebb));});})[_0x21ca('0x44')](function(){_0x25ca0f[_0x21ca('0x4d')]();});});}else{return rpc[this[_0x21ca('0x1e')]+'Message'][_0x21ca('0x4e')](_0x4fc4aa)[_0x21ca('0x44')](function(_0x1e16ec){logger['info'](_0x21ca('0x16'),_0x9d5df8,_0x4fc4aa['body']);})[_0x21ca('0x47')](function(_0x139f75){logger['error'](_0x21ca('0x16'),_0x9d5df8,JSON[_0x21ca('0x46')](_0x139f75));})['finally'](function(){Promise['resolve']()[_0x21ca('0x44')](function(){if(_0x36b006[0x0]!=='2'||_0x45e31d[_0x21ca('0x18')])return;return rpc[_0x1bdb05+_0x21ca('0x4b')][_0x21ca('0x4c')](_0x45e31d['id'],{'autoreplyExecuted':!![]})[_0x21ca('0x44')](function(_0x5cc914){logger['info'](_0x21ca('0x19'),_0x9d5df8,JSON['stringify'](_0x5cc914));})[_0x21ca('0x47')](function(_0x23674e){logger[_0x21ca('0x4f')](_0x21ca('0x50'),_0x9d5df8,JSON[_0x21ca('0x46')](_0x23674e));});})[_0x21ca('0x44')](function(){_0x25ca0f[_0x21ca('0x4d')]();});});}}}catch(_0x5b632e){logger['error'](_0x21ca('0x16'),_0x9d5df8,JSON[_0x21ca('0x46')](_0x5b632e));_0x25ca0f[_0x21ca('0x51')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 771ca19..741e63d 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x207d=['catch','error','[%s][CLOSE]\x20%s','stringify','stop','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x207d,0xaf));var _0xd207=function(_0x457919,_0x2beda9){_0x457919=_0x457919-0x0;var _0x175071=_0x207d[_0x457919];return _0x175071;};'use strict';var moment=require('moment');var logger=require(_0xd207('0x0'))(_0xd207('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xd207('0x2')),'mailInteraction':require(_0xd207('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xd207('0x4')]=function(_0x451ab1,_0x1d5be5,_0x3a28c2,_0x2358bc){return function(_0x113134){try{logger[_0xd207('0x5')](_0xd207('0x6'),_0x451ab1,_0x1d5be5[0x0]);var _0x18c5a6={'closed':0x1,'closedAt':moment()['format'](_0xd207('0x7')),'closeReason':'system','disposition':_0x1d5be5[0x0]};if(rpc[_0x2358bc[_0xd207('0x8')]+_0xd207('0x9')]){rpc[_0x2358bc[_0xd207('0x8')]+_0xd207('0x9')][_0xd207('0xa')](_0x2358bc[_0xd207('0xb')]['id'],_0x18c5a6)['then'](function(_0x1d2df6){logger[_0xd207('0x5')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x451ab1,_0x2358bc[_0xd207('0xb')]['id']);})[_0xd207('0xc')](function(_0x3cc6ec){logger[_0xd207('0xd')](_0xd207('0xe'),_0x451ab1,JSON[_0xd207('0xf')](_0x3cc6ec));})['finally'](function(){_0x113134[_0xd207('0x10')]();});}}catch(_0x3fc9f6){logger[_0xd207('0xd')](_0xd207('0xe'),_0x451ab1,JSON[_0xd207('0xf')](_0x3fc9f6));_0x113134[_0xd207('0x10')]();}};}; \ No newline at end of file +var _0xc61d=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x18a726,_0x408f55){var _0x9f85cb=function(_0x446d3c){while(--_0x446d3c){_0x18a726['push'](_0x18a726['shift']());}};_0x9f85cb(++_0x408f55);}(_0xc61d,0xa7));var _0xdc61=function(_0x2a8e59,_0x3f9b8b){_0x2a8e59=_0x2a8e59-0x0;var _0x279df4=_0xc61d[_0x2a8e59];return _0x279df4;};'use strict';var moment=require(_0xdc61('0x0'));var logger=require(_0xdc61('0x1'))(_0xdc61('0x2'));var rpc={'chatInteraction':require(_0xdc61('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xdc61('0x4')),'whatsappInteraction':require(_0xdc61('0x5'))};exports['consequence']=function(_0x38582b,_0x57a909,_0x281bf6,_0x955603){return function(_0x5b7f21){try{logger[_0xdc61('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x38582b,_0x57a909[0x0]);var _0x344835={'closed':0x1,'closedAt':moment()[_0xdc61('0x7')](_0xdc61('0x8')),'closeReason':_0xdc61('0x9'),'disposition':_0x57a909[0x0]};if(rpc[_0x955603[_0xdc61('0xa')]+_0xdc61('0xb')]){rpc[_0x955603['channel']+_0xdc61('0xb')][_0xdc61('0xc')](_0x955603['interaction']['id'],_0x344835)[_0xdc61('0xd')](function(_0x5b2164){logger['info'](_0xdc61('0xe'),_0x38582b,_0x955603['interaction']['id']);})['catch'](function(_0x17cf5c){logger[_0xdc61('0xf')](_0xdc61('0x10'),_0x38582b,JSON[_0xdc61('0x11')](_0x17cf5c));})[_0xdc61('0x12')](function(){_0x5b7f21['stop']();});}}catch(_0x550f89){logger[_0xdc61('0xf')](_0xdc61('0x10'),_0x38582b,JSON[_0xdc61('0x11')](_0x550f89));_0x5b7f21['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index eb6264d..46ad199 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee4a=['create','then','info','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','metadata','endConversation','lodash','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','created','isEmpty','Message'];(function(_0xe7218,_0x2a4b65){var _0x33e2a0=function(_0x575ae2){while(--_0x575ae2){_0xe7218['push'](_0xe7218['shift']());}};_0x33e2a0(++_0x2a4b65);}(_0xee4a,0x9e));var _0xaee4=function(_0x47f803,_0x2348f7){_0x47f803=_0x47f803-0x0;var _0x4e916a=_0xee4a[_0x47f803];return _0x4e916a;};'use strict';var _=require(_0xaee4('0x0'));var moment=require('moment');var apiai=require(_0xaee4('0x1'));var md5=require(_0xaee4('0x2'));var utils=require(_0xaee4('0x3'));var logger=require('../../../../config/logger')(_0xaee4('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaee4('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xaee4('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaee4('0x7'))};exports['consequence']=function(_0x24372a,_0x478331){return function(_0x37ed64){try{if(!_['isNil'](this[_0xaee4('0x8')][_0xaee4('0x9')])){logger['info'](_0xaee4('0xa'),_0x24372a,_0xaee4('0xb'));return _0x37ed64[_0xaee4('0xc')]();}var _0x3c75a7={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xaee4('0xd')};if(this[_0xaee4('0xe')]===_0xaee4('0xf')||this[_0xaee4('0xe')]===_0xaee4('0x10')){_0x3c75a7[_0xaee4('0x11')]=this[_0xaee4('0x8')][_0xaee4('0x11')];}var _0x516223=this['channel'];if(_0x516223===_0xaee4('0x12')){_0x3c75a7['ChatWebsiteId']=this['account']['id'];}else{_0x3c75a7[_[_0xaee4('0x13')](_0x516223)+_0xaee4('0x14')]=this[_0xaee4('0x15')]['id'];}_0x3c75a7[_[_0xaee4('0x13')](_0x516223)+_0xaee4('0x16')]=this[_0xaee4('0x8')]['id'];if(this[_0xaee4('0x8')][_0xaee4('0x17')]){var _0x561001=_0x478331[0x2];if(!_[_0xaee4('0x18')](_0x561001)){_0x3c75a7['body']=utils['getMustacheRender'](_0x561001,this);return rpc[_0x516223+_0xaee4('0x19')][_0xaee4('0x1a')](_0x3c75a7)[_0xaee4('0x1b')](function(_0x45bdf2){logger[_0xaee4('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x24372a,_0x3c75a7[_0xaee4('0x1d')]);})[_0xaee4('0x1e')](function(_0x52becf){logger[_0xaee4('0x1f')](_0xaee4('0xa'),_0x24372a,JSON['stringify'](_0x52becf));})[_0xaee4('0x20')](function(){logger['info'](_0xaee4('0x21'),_0x24372a);_0x37ed64[_0xaee4('0x22')]();});}else{logger[_0xaee4('0x1c')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x24372a);_0x37ed64['stop']();}}else{var _0x14091f=this;var _0x5ddf54=apiai(_0x478331[0x0],{'language':_0x478331[0x1]||'en'});return _0x5ddf54[_0xaee4('0x23')](this[_0xaee4('0x24')]['body'],{'sessionId':md5(this[_0xaee4('0x8')]['id'])})[_0xaee4('0x1b')](function(_0x1fc4fa){_0x14091f[_0xaee4('0x1d')][_0xaee4('0x25')]=_0x1fc4fa;_0x3c75a7[_0xaee4('0x1d')]=_0x1fc4fa[_0xaee4('0x26')][_0xaee4('0x27')][_0xaee4('0x28')];_0x3c75a7[_0xaee4('0x29')]=_0xaee4('0x25');_0x3c75a7[_0xaee4('0x2a')]=JSON[_0xaee4('0x2b')](_0x1fc4fa);return rpc[_0x516223+_0xaee4('0x19')][_0xaee4('0x1a')](_0x3c75a7)['then'](function(_0x24805f){logger[_0xaee4('0x1c')](_0xaee4('0xa'),_0x24372a,_0x3c75a7['body']);if(_0x1fc4fa[_0xaee4('0x26')][_0xaee4('0x2c')][_0xaee4('0x2d')]){_0x37ed64[_0xaee4('0xc')]();}else{_0x37ed64[_0xaee4('0x22')]();}})[_0xaee4('0x1e')](function(_0x5c2819){logger['error'](_0xaee4('0xa'),_0x24372a,JSON[_0xaee4('0x2b')](_0x5c2819));_0x37ed64[_0xaee4('0xc')]();});})[_0xaee4('0x1e')](function(_0x2278a9){logger['error'](_0xaee4('0xa'),_0x24372a,_0x2278a9[_0xaee4('0x24')]);_0x37ed64[_0xaee4('0xc')]();});}}catch(_0x1e271f){logger[_0xaee4('0x1f')](_0xaee4('0xa'),_0x24372a,JSON[_0xaee4('0x2b')](_0x1e271f));_0x37ed64['stop']();}};}; \ No newline at end of file +var _0x975b=['apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','fulfillment','speech','dialogflow','providerResponse','stringify','metadata','endConversation','next','lodash','moment'];(function(_0x6639ba,_0x2de47e){var _0x213725=function(_0x424ec5){while(--_0x424ec5){_0x6639ba['push'](_0x6639ba['shift']());}};_0x213725(++_0x2de47e);}(_0x975b,0x1c9));var _0xb975=function(_0x5aa5f6,_0x3cdde5){_0x5aa5f6=_0x5aa5f6-0x0;var _0x50c79b=_0x975b[_0x5aa5f6];return _0x50c79b;};'use strict';var _=require(_0xb975('0x0'));var moment=require(_0xb975('0x1'));var apiai=require(_0xb975('0x2'));var md5=require(_0xb975('0x3'));var utils=require(_0xb975('0x4'));var logger=require(_0xb975('0x5'))(_0xb975('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb975('0x7')),'mailMessage':require(_0xb975('0x8')),'smsMessage':require(_0xb975('0x9')),'faxMessage':require(_0xb975('0xa')),'whatsappMessage':require(_0xb975('0xb'))};exports[_0xb975('0xc')]=function(_0x3d84f1,_0x5786ec){return function(_0x4178ee){try{if(!_[_0xb975('0xd')](this[_0xb975('0xe')]['UserId'])){logger[_0xb975('0xf')](_0xb975('0x10'),_0x3d84f1,_0xb975('0x11'));return _0x4178ee['next']();}var _0x5619f5={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb975('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb975('0x13')};if(this['channel']===_0xb975('0x14')||this[_0xb975('0x15')]===_0xb975('0x16')){_0x5619f5[_0xb975('0x17')]=this[_0xb975('0xe')]['phone'];}var _0x189e0f=this[_0xb975('0x15')];if(_0x189e0f===_0xb975('0x18')){_0x5619f5[_0xb975('0x19')]=this['account']['id'];}else{_0x5619f5[_[_0xb975('0x1a')](_0x189e0f)+_0xb975('0x1b')]=this[_0xb975('0x1c')]['id'];}_0x5619f5[_['upperFirst'](_0x189e0f)+_0xb975('0x1d')]=this[_0xb975('0xe')]['id'];if(this[_0xb975('0xe')]['created']){var _0x15c8b2=_0x5786ec[0x2];if(!_['isEmpty'](_0x15c8b2)){_0x5619f5[_0xb975('0x1e')]=utils[_0xb975('0x1f')](_0x15c8b2,this);return rpc[_0x189e0f+_0xb975('0x20')][_0xb975('0x21')](_0x5619f5)[_0xb975('0x22')](function(_0x327728){logger[_0xb975('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3d84f1,_0x5619f5['body']);})[_0xb975('0x23')](function(_0x2da9fd){logger[_0xb975('0x24')](_0xb975('0x10'),_0x3d84f1,JSON['stringify'](_0x2da9fd));})[_0xb975('0x25')](function(){logger['info'](_0xb975('0x26'),_0x3d84f1);_0x4178ee[_0xb975('0x27')]();});}else{logger[_0xb975('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3d84f1);_0x4178ee[_0xb975('0x27')]();}}else{var _0x493c0b=this;var _0x5d1312=apiai(_0x5786ec[0x0],{'language':_0x5786ec[0x1]||'en'});return _0x5d1312[_0xb975('0x28')](this[_0xb975('0x29')][_0xb975('0x1e')],{'sessionId':md5(this[_0xb975('0xe')]['id'])})[_0xb975('0x22')](function(_0x5620fc){_0x493c0b[_0xb975('0x1e')]['dialogflow']=_0x5620fc;_0x5619f5[_0xb975('0x1e')]=_0x5620fc[_0xb975('0x2a')][_0xb975('0x2b')][_0xb975('0x2c')];_0x5619f5['providerName']=_0xb975('0x2d');_0x5619f5[_0xb975('0x2e')]=JSON[_0xb975('0x2f')](_0x5620fc);return rpc[_0x189e0f+_0xb975('0x20')]['create'](_0x5619f5)[_0xb975('0x22')](function(_0x388f4d){logger[_0xb975('0xf')](_0xb975('0x10'),_0x3d84f1,_0x5619f5[_0xb975('0x1e')]);if(_0x5620fc[_0xb975('0x2a')][_0xb975('0x30')][_0xb975('0x31')]){_0x4178ee[_0xb975('0x32')]();}else{_0x4178ee['stop']();}})[_0xb975('0x23')](function(_0x2b3ec2){logger[_0xb975('0x24')](_0xb975('0x10'),_0x3d84f1,JSON[_0xb975('0x2f')](_0x2b3ec2));_0x4178ee[_0xb975('0x32')]();});})[_0xb975('0x23')](function(_0xa8ee8c){logger[_0xb975('0x24')](_0xb975('0x10'),_0x3d84f1,_0xa8ee8c[_0xb975('0x29')]);_0x4178ee['next']();});}}catch(_0x167ac1){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x3d84f1,JSON[_0xb975('0x2f')](_0x167ac1));_0x4178ee['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 11cec8c..0037c6e 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd45=['action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','lodash','dialogflow','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','create','info','catch','error','stringify','isNil','interaction','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','upperFirst','account','InteractionId','getMustacheRender','Message','then','[%s][DIALOGFLOWV2]\x20%s','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd45,0x156));var _0x5fd4=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xfd45[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x5fd4('0x0'));var dialogflow=require(_0x5fd4('0x1'));var md5=require('md5');var moment=require(_0x5fd4('0x2'));var Promise=require(_0x5fd4('0x3'));var logger=require(_0x5fd4('0x4'))(_0x5fd4('0x5'));var utils=require(_0x5fd4('0x6'));var rpc={'chatMessage':require(_0x5fd4('0x7')),'openchannelMessage':require(_0x5fd4('0x8')),'mailMessage':require(_0x5fd4('0x9')),'smsMessage':require(_0x5fd4('0xa')),'faxMessage':require(_0x5fd4('0xb')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x14ab16,_0x592307,_0x99e1b9,_0x5260ae){return new Promise(function(_0x130925,_0x302324){var _0x5c832a=_['clone'](_0x99e1b9);_0x5c832a[_0x5fd4('0xc')]=_0x5260ae;return rpc[_0x592307+'Message'][_0x5fd4('0xd')](_0x5c832a)['then'](function(){logger[_0x5fd4('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x14ab16,_0x5c832a[_0x5fd4('0xc')]);_0x130925();})[_0x5fd4('0xf')](function(_0x3ea716){logger[_0x5fd4('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x14ab16,JSON[_0x5fd4('0x11')](_0x3ea716));_0x302324(_0x3ea716);});});}exports['consequence']=function(_0x54ebaf,_0x32f585){return function(_0x37e172){try{if(!_[_0x5fd4('0x12')](this[_0x5fd4('0x13')]['UserId'])){logger[_0x5fd4('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x54ebaf,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x37e172[_0x5fd4('0x14')]();}var _0x1b6470={'ContactId':this[_0x5fd4('0x15')]['id'],'sentAt':moment()['format'](_0x5fd4('0x16')),'direction':_0x5fd4('0x17')};if(this['channel']===_0x5fd4('0x18')||this[_0x5fd4('0x19')]===_0x5fd4('0x1a')){_0x1b6470[_0x5fd4('0x1b')]=this[_0x5fd4('0x13')]['phone'];}var _0x5521d2=this[_0x5fd4('0x19')];if(_0x5521d2==='chat'){_0x1b6470[_0x5fd4('0x1c')]=this['account']['id'];}else{_0x1b6470[_[_0x5fd4('0x1d')](_0x5521d2)+'AccountId']=this[_0x5fd4('0x1e')]['id'];}_0x1b6470[_[_0x5fd4('0x1d')](_0x5521d2)+_0x5fd4('0x1f')]=this[_0x5fd4('0x13')]['id'];if(this[_0x5fd4('0x13')]['created']){var _0x40b684=_0x32f585[0x4];if(!_['isEmpty'](_0x40b684)){_0x1b6470[_0x5fd4('0xc')]=utils[_0x5fd4('0x20')](_0x40b684,this);return rpc[_0x5521d2+_0x5fd4('0x21')][_0x5fd4('0xd')](_0x1b6470)[_0x5fd4('0x22')](function(_0x48e017){logger[_0x5fd4('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x54ebaf,_0x1b6470['body']);})['catch'](function(_0xf3b1a6){logger[_0x5fd4('0x10')](_0x5fd4('0x23'),_0x54ebaf,JSON[_0x5fd4('0x11')](_0xf3b1a6));})['finally'](function(){logger[_0x5fd4('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x54ebaf);_0x37e172['stop']();});}else{logger[_0x5fd4('0xe')](_0x5fd4('0x24'),_0x54ebaf);_0x37e172[_0x5fd4('0x25')]();}}else{var _0x15c5c2=this;var _0x455801=_0x32f585[0x2][_0x5fd4('0x26')](/\\n/g,'\x0a');var _0x5aaa6f={'credentials':{'private_key':_0x455801,'client_email':_0x32f585[0x1]}};var _0x13f852=new dialogflow[(_0x5fd4('0x27'))](_0x5aaa6f);var _0x5c961f=_0x13f852[_0x5fd4('0x28')](_0x32f585[0x0],md5(_0x15c5c2[_0x5fd4('0x13')]['id']));var _0x4fdd3e={'session':_0x5c961f,'queryInput':{'text':{'text':_0x15c5c2[_0x5fd4('0x29')][_0x5fd4('0xc')],'languageCode':_0x32f585[0x3]||'en'}}};return _0x13f852['detectIntent'](_0x4fdd3e)[_0x5fd4('0x22')](function(_0x50215c){if(_0x50215c&&_0x50215c[_0x5fd4('0x2a')]){_0x15c5c2[_0x5fd4('0xc')]['dialogflowV2']=_0x50215c;var _0x3831c2=_0x50215c[0x0];var _0x27b8ba=_0x3831c2[_0x5fd4('0x2b')]['diagnosticInfo']&&_0x3831c2['queryResult'][_0x5fd4('0x2c')]['fields']?_0x3831c2['queryResult'][_0x5fd4('0x2c')][_0x5fd4('0x2d')][_0x5fd4('0x2e')][_0x5fd4('0x2f')]:![];_0x15c5c2['body']['DIALOGFLOWV2_ACTION']=_0x3831c2[_0x5fd4('0x2b')][_0x5fd4('0x30')];_0x15c5c2['body'][_0x5fd4('0x31')]=_0x3831c2['queryResult'][_0x5fd4('0x32')];_0x15c5c2[_0x5fd4('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x3831c2[_0x5fd4('0x2b')][_0x5fd4('0x2c')]&&_0x3831c2[_0x5fd4('0x2b')][_0x5fd4('0x2c')][_0x5fd4('0x2d')]?_0x3831c2[_0x5fd4('0x2b')]['diagnosticInfo'][_0x5fd4('0x2d')][_0x5fd4('0x2e')][_0x5fd4('0x2f')]:![];_0x15c5c2[_0x5fd4('0xc')][_0x5fd4('0x33')]=_0x3831c2[_0x5fd4('0x2b')][_0x5fd4('0x34')]['name'];_0x15c5c2[_0x5fd4('0xc')][_0x5fd4('0x35')]=_0x3831c2[_0x5fd4('0x2b')][_0x5fd4('0x34')][_0x5fd4('0x36')];_0x15c5c2[_0x5fd4('0xc')][_0x5fd4('0x37')]=_0x3831c2['queryResult'][_0x5fd4('0x34')][_0x5fd4('0x38')];_0x15c5c2[_0x5fd4('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3831c2[_0x5fd4('0x2b')][_0x5fd4('0x39')];_0x15c5c2[_0x5fd4('0xc')][_0x5fd4('0x3a')]=_0x3831c2['queryResult']['queryText'];_0x15c5c2[_0x5fd4('0xc')][_0x5fd4('0x3b')]=_0x3831c2['queryResult'][_0x5fd4('0x3c')];_0x1b6470[_0x5fd4('0x3d')]=_0x5fd4('0x3e');_0x1b6470['providerResponse']=JSON['stringify'](_0x50215c);var _0xf118e1=[];for(var _0x1c53e8=0x0;_0x1c53e8<_0x50215c['length'];_0x1c53e8++){var _0x5aa343=_0x50215c[_0x1c53e8];if(_0x5aa343&&_0x5aa343[_0x5fd4('0x2b')]&&_0x5aa343[_0x5fd4('0x2b')][_0x5fd4('0x3f')]){_0xf118e1[_0x5fd4('0x40')](createMessage(_0x54ebaf,_0x5521d2,_0x1b6470,_0x5aa343[_0x5fd4('0x2b')][_0x5fd4('0x3f')]));}}return Promise['all'](_0xf118e1)[_0x5fd4('0x22')](function(){if(_0x27b8ba){_0x37e172['next']();}else{_0x37e172['stop']();}})['catch'](function(_0x410769){logger[_0x5fd4('0x10')](_0x5fd4('0x23'),_0x54ebaf,JSON[_0x5fd4('0x11')](_0x410769));_0x37e172[_0x5fd4('0x14')]();});}})['catch'](function(_0x48cb3d){logger[_0x5fd4('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x54ebaf,_0x48cb3d[_0x5fd4('0x29')]);_0x37e172['next']();});}}catch(_0x5b77a0){logger[_0x5fd4('0x10')](_0x5fd4('0x23'),_0x54ebaf,JSON['stringify'](_0x5b77a0));_0x37e172[_0x5fd4('0x25')]();}};}; \ No newline at end of file +var _0x1c81=['body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','interaction','created','isEmpty','getMustacheRender','Message','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','name','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','length','push','all','stringify','message','lodash','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone'];(function(_0x2f0901,_0x280451){var _0x3ee80f=function(_0x1bc681){while(--_0x1bc681){_0x2f0901['push'](_0x2f0901['shift']());}};_0x3ee80f(++_0x280451);}(_0x1c81,0xcd));var _0x11c8=function(_0xf32e3a,_0x1cc977){_0xf32e3a=_0xf32e3a-0x0;var _0x1fac45=_0x1c81[_0xf32e3a];return _0x1fac45;};'use strict';var _=require(_0x11c8('0x0'));var dialogflow=require(_0x11c8('0x1'));var md5=require('md5');var moment=require(_0x11c8('0x2'));var Promise=require('bluebird');var logger=require(_0x11c8('0x3'))(_0x11c8('0x4'));var utils=require(_0x11c8('0x5'));var rpc={'chatMessage':require(_0x11c8('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x11c8('0x7')),'faxMessage':require(_0x11c8('0x8')),'whatsappMessage':require(_0x11c8('0x9'))};function createMessage(_0x4ee496,_0x17a942,_0x5dbf73,_0x4ce072){return new Promise(function(_0x33afd2,_0x33fa3d){var _0x17467b=_[_0x11c8('0xa')](_0x5dbf73);_0x17467b[_0x11c8('0xb')]=_0x4ce072;return rpc[_0x17a942+'Message'][_0x11c8('0xc')](_0x17467b)[_0x11c8('0xd')](function(){logger['info'](_0x11c8('0xe'),_0x4ee496,_0x17467b[_0x11c8('0xb')]);_0x33afd2();})[_0x11c8('0xf')](function(_0x337966){logger[_0x11c8('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x4ee496,JSON['stringify'](_0x337966));_0x33fa3d(_0x337966);});});}exports[_0x11c8('0x11')]=function(_0x528fbc,_0x236c13){return function(_0x580bc4){try{if(!_[_0x11c8('0x12')](this['interaction'][_0x11c8('0x13')])){logger[_0x11c8('0x14')](_0x11c8('0xe'),_0x528fbc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x580bc4[_0x11c8('0x15')]();}var _0x55e6b1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x11c8('0x16')](_0x11c8('0x17')),'direction':_0x11c8('0x18')};if(this[_0x11c8('0x19')]===_0x11c8('0x1a')||this[_0x11c8('0x19')]===_0x11c8('0x1b')){_0x55e6b1[_0x11c8('0x1c')]=this['interaction'][_0x11c8('0x1c')];}var _0x31e003=this[_0x11c8('0x19')];if(_0x31e003==='chat'){_0x55e6b1[_0x11c8('0x1d')]=this[_0x11c8('0x1e')]['id'];}else{_0x55e6b1[_[_0x11c8('0x1f')](_0x31e003)+'AccountId']=this[_0x11c8('0x1e')]['id'];}_0x55e6b1[_[_0x11c8('0x1f')](_0x31e003)+_0x11c8('0x20')]=this[_0x11c8('0x21')]['id'];if(this[_0x11c8('0x21')][_0x11c8('0x22')]){var _0x542f2f=_0x236c13[0x4];if(!_[_0x11c8('0x23')](_0x542f2f)){_0x55e6b1[_0x11c8('0xb')]=utils[_0x11c8('0x24')](_0x542f2f,this);return rpc[_0x31e003+_0x11c8('0x25')][_0x11c8('0xc')](_0x55e6b1)[_0x11c8('0xd')](function(_0x644246){logger[_0x11c8('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x528fbc,_0x55e6b1[_0x11c8('0xb')]);})[_0x11c8('0xf')](function(_0x51c4fe){logger['error'](_0x11c8('0xe'),_0x528fbc,JSON['stringify'](_0x51c4fe));})[_0x11c8('0x26')](function(){logger[_0x11c8('0x14')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x528fbc);_0x580bc4[_0x11c8('0x27')]();});}else{logger[_0x11c8('0x14')](_0x11c8('0x28'),_0x528fbc);_0x580bc4[_0x11c8('0x27')]();}}else{var _0x1f1485=this;var _0x5d51d3=_0x236c13[0x2]['replace'](/\\n/g,'\x0a');var _0x19ed1a={'credentials':{'private_key':_0x5d51d3,'client_email':_0x236c13[0x1]}};var _0x277b6e=new dialogflow[(_0x11c8('0x29'))](_0x19ed1a);var _0x456807=_0x277b6e['sessionPath'](_0x236c13[0x0],md5(_0x1f1485['interaction']['id']));var _0x3905bb={'session':_0x456807,'queryInput':{'text':{'text':_0x1f1485['message'][_0x11c8('0xb')],'languageCode':_0x236c13[0x3]||'en'}}};return _0x277b6e[_0x11c8('0x2a')](_0x3905bb)[_0x11c8('0xd')](function(_0x578d72){if(_0x578d72&&_0x578d72['length']){_0x1f1485[_0x11c8('0xb')][_0x11c8('0x2b')]=_0x578d72;var _0x276bf2=_0x578d72[0x0];var _0x5b9634=_0x276bf2[_0x11c8('0x2c')]['diagnosticInfo']&&_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x2d')]['fields']?_0x276bf2['queryResult'][_0x11c8('0x2d')][_0x11c8('0x2e')][_0x11c8('0x2f')]['boolValue']:![];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x30')]=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x31')];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x32')]=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x33')];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x34')]=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x2d')]&&_0x276bf2[_0x11c8('0x2c')]['diagnosticInfo'][_0x11c8('0x2e')]?_0x276bf2['queryResult'][_0x11c8('0x2d')][_0x11c8('0x2e')][_0x11c8('0x2f')][_0x11c8('0x35')]:![];_0x1f1485['body'][_0x11c8('0x36')]=_0x276bf2[_0x11c8('0x2c')]['intent'][_0x11c8('0x37')];_0x1f1485['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x38')][_0x11c8('0x39')];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x3a')]=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x38')][_0x11c8('0x3b')];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x3c')]=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x3d')];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x3e')]=_0x276bf2[_0x11c8('0x2c')][_0x11c8('0x3f')];_0x1f1485[_0x11c8('0xb')][_0x11c8('0x40')]=_0x276bf2[_0x11c8('0x2c')]['intentDetectionConfidence'];_0x55e6b1[_0x11c8('0x41')]=_0x11c8('0x2b');_0x55e6b1[_0x11c8('0x42')]=JSON['stringify'](_0x578d72);var _0x550e35=[];for(var _0x4e21dc=0x0;_0x4e21dc<_0x578d72[_0x11c8('0x43')];_0x4e21dc++){var _0x424cb0=_0x578d72[_0x4e21dc];if(_0x424cb0&&_0x424cb0[_0x11c8('0x2c')]&&_0x424cb0[_0x11c8('0x2c')]['fulfillmentText']){_0x550e35[_0x11c8('0x44')](createMessage(_0x528fbc,_0x31e003,_0x55e6b1,_0x424cb0[_0x11c8('0x2c')]['fulfillmentText']));}}return Promise[_0x11c8('0x45')](_0x550e35)['then'](function(){if(_0x5b9634){_0x580bc4[_0x11c8('0x15')]();}else{_0x580bc4['stop']();}})[_0x11c8('0xf')](function(_0x25091b){logger['error'](_0x11c8('0xe'),_0x528fbc,JSON[_0x11c8('0x46')](_0x25091b));_0x580bc4[_0x11c8('0x15')]();});}})[_0x11c8('0xf')](function(_0x361c99){logger['error'](_0x11c8('0xe'),_0x528fbc,_0x361c99[_0x11c8('0x47')]);_0x580bc4[_0x11c8('0x15')]();});}}catch(_0x20a565){logger[_0x11c8('0x10')](_0x11c8('0xe'),_0x528fbc,JSON['stringify'](_0x20a565));_0x580bc4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index dea1db1..a964280 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bfd=['join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','stop','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','map'];(function(_0x2c15d2,_0x298276){var _0x11cf72=function(_0x987034){while(--_0x987034){_0x2c15d2['push'](_0x2c15d2['shift']());}};_0x11cf72(++_0x298276);}(_0x7bfd,0x126));var _0xd7bf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7bfd[_0x4a9fb1];return _0x348672;};'use strict';var schema=require(_0xd7bf('0x0'));var _=require('lodash');var htmlToText=require(_0xd7bf('0x1'));var utils=require(_0xd7bf('0x2'));var logger=require(_0xd7bf('0x3'))(_0xd7bf('0x4'));var gotoif=schema({'condition':{'type':_0xd7bf('0x5'),'required':!![],'message':_0xd7bf('0x6')},'priorityTrue':{'type':_0xd7bf('0x7'),'message':_0xd7bf('0x8')},'priorityFalse':{'type':_0xd7bf('0x7'),'message':_0xd7bf('0x9')}});exports[_0xd7bf('0xa')]=function(_0x4584bb,_0x489216){return function(_0x32579d){try{var _0x182e29={'condition':htmlToText['fromString'](utils[_0xd7bf('0xb')](_0x489216[0x0],this),{'wordwrap':![]})[_0xd7bf('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x489216[0x1],'priorityFalse':_0x489216[0x2]};var _0x5bd992=gotoif[_0xd7bf('0x0')](_0x182e29,{'typecast':!![]});if(_0x5bd992[_0xd7bf('0xd')]){logger[_0xd7bf('0xe')]('[%s][GOTOIF]\x20%s',_0x4584bb,_[_0xd7bf('0xf')](_0x5bd992,'message')[_0xd7bf('0x10')](',\x20'));_0x32579d['stop']();}else{try{var _0x29f0f0=eval('('+_0x182e29['condition']+')');var _0x56e832=_0x29f0f0?_0x182e29[_0xd7bf('0x11')]:_0x182e29[_0xd7bf('0x12')];logger[_0xd7bf('0x13')](_0xd7bf('0x14'),_0x4584bb,_0x182e29[_0xd7bf('0x15')],_0x29f0f0,_0x56e832||_0xd7bf('0x16'));if(_0x56e832){var _0x142cda=_[_0xd7bf('0x17')](_0x32579d[_0xd7bf('0x18')](),{'p':_0x56e832});if(_0x142cda>=0x0){logger['info'](_0xd7bf('0x19'),_0x4584bb,_0x56e832||_0xd7bf('0x16'),_0x142cda);_0x32579d[_0xd7bf('0x16')](_0x142cda);}else{logger[_0xd7bf('0x13')](_0xd7bf('0x1a'),_0x4584bb,_0x56e832||_0xd7bf('0x16'));_0x32579d['stop']();}}else{_0x32579d['next']();}}catch(_0x1777a7){logger['error'](_0xd7bf('0x1b'),_0x4584bb,_0x1777a7[_0xd7bf('0x1c')]);_0x32579d['stop']();}}}catch(_0x50c588){logger[_0xd7bf('0xe')]('[%s][GOTOIF]\x20%s',_0x4584bb,JSON[_0xd7bf('0x1d')](_0x50c588));_0x32579d[_0xd7bf('0x1e')]();}};}; \ No newline at end of file +var _0xdf8e=['lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20%s','stringify','validate'];(function(_0x5e9c4c,_0x2dbd76){var _0x214475=function(_0x4b236f){while(--_0x4b236f){_0x5e9c4c['push'](_0x5e9c4c['shift']());}};_0x214475(++_0x2dbd76);}(_0xdf8e,0x6f));var _0xedf8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdf8e[_0x432682];return _0x463d05;};'use strict';var schema=require(_0xedf8('0x0'));var _=require(_0xedf8('0x1'));var htmlToText=require(_0xedf8('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xedf8('0x3'));var gotoif=schema({'condition':{'type':_0xedf8('0x4'),'required':!![],'message':_0xedf8('0x5')},'priorityTrue':{'type':_0xedf8('0x6'),'message':_0xedf8('0x7')},'priorityFalse':{'type':_0xedf8('0x6'),'message':_0xedf8('0x8')}});exports['consequence']=function(_0x4f7562,_0x269002){return function(_0x579b6a){try{var _0x350bb5={'condition':htmlToText[_0xedf8('0x9')](utils['getMustacheRender'](_0x269002[0x0],this),{'wordwrap':![]})[_0xedf8('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x269002[0x1],'priorityFalse':_0x269002[0x2]};var _0xed0e26=gotoif['validate'](_0x350bb5,{'typecast':!![]});if(_0xed0e26[_0xedf8('0xb')]){logger['error']('[%s][GOTOIF]\x20%s',_0x4f7562,_['map'](_0xed0e26,_0xedf8('0xc'))[_0xedf8('0xd')](',\x20'));_0x579b6a[_0xedf8('0xe')]();}else{try{var _0x315c39=eval('('+_0x350bb5[_0xedf8('0xf')]+')');var _0x144fca=_0x315c39?_0x350bb5[_0xedf8('0x10')]:_0x350bb5[_0xedf8('0x11')];logger[_0xedf8('0x12')](_0xedf8('0x13'),_0x4f7562,_0x350bb5['condition'],_0x315c39,_0x144fca||'next');if(_0x144fca){var _0x3c2536=_[_0xedf8('0x14')](_0x579b6a[_0xedf8('0x15')](),{'p':_0x144fca});if(_0x3c2536>=0x0){logger[_0xedf8('0x12')](_0xedf8('0x16'),_0x4f7562,_0x144fca||_0xedf8('0x17'),_0x3c2536);_0x579b6a[_0xedf8('0x17')](_0x3c2536);}else{logger[_0xedf8('0x12')](_0xedf8('0x18'),_0x4f7562,_0x144fca||_0xedf8('0x17'));_0x579b6a[_0xedf8('0xe')]();}}else{_0x579b6a['next']();}}catch(_0x2d059c){logger[_0xedf8('0x19')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4f7562,_0x2d059c[_0xedf8('0xc')]);_0x579b6a[_0xedf8('0xe')]();}}}catch(_0x4d22af){logger['error'](_0xedf8('0x1a'),_0x4f7562,JSON[_0xedf8('0x1b')](_0x4d22af));_0x579b6a[_0xedf8('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 0ed77d1..e436b0a 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 _0xf044=['findIndex','next','stop','error','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','number','consequence','length','map','join','info','priority'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf044,0x86));var _0x4f04=function(_0x3d315d,_0xb34693){_0x3d315d=_0x3d315d-0x0;var _0x3eb172=_0xf044[_0x3d315d];return _0x3eb172;};'use strict';var schema=require(_0x4f04('0x0'));var _=require('lodash');var logger=require(_0x4f04('0x1'))(_0x4f04('0x2'));var gotop=schema({'priority':{'type':_0x4f04('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x4f04('0x4')]=function(_0x5ef17f,_0x5b3af3){return function(_0x5e1ded){try{var _0x4044d0={'priority':_0x5b3af3[0x0]};var _0x4770f3=gotop['validate'](_0x4044d0,{'typecast':!![]});if(_0x4770f3[_0x4f04('0x5')]){logger['error']('[%s][GOTOP]\x20%s',_0x5ef17f,_[_0x4f04('0x6')](_0x4770f3,'message')[_0x4f04('0x7')](',\x20'));_0x5e1ded['stop']();}else{logger[_0x4f04('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x5ef17f,_0x4044d0[_0x4f04('0x9')]);if(_0x4044d0[_0x4f04('0x9')]){var _0x209964=_[_0x4f04('0xa')](_0x5e1ded['rules'](),{'p':_0x4044d0['priority']});if(_0x209964>=0x0){logger[_0x4f04('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5ef17f,_0x4044d0[_0x4f04('0x9')]||_0x4f04('0xb'),_0x209964);_0x5e1ded[_0x4f04('0xb')](_0x209964);}else{logger[_0x4f04('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5ef17f,_0x4044d0[_0x4f04('0x9')]||_0x4f04('0xb'));_0x5e1ded[_0x4f04('0xc')]();}}else{_0x5e1ded[_0x4f04('0xb')]();}}}catch(_0x3204d1){logger[_0x4f04('0xd')](_0x4f04('0xe'),_0x5ef17f,JSON[_0x4f04('0xf')](_0x3204d1));_0x5e1ded[_0x4f04('0xc')]();}};}; \ No newline at end of file +var _0x1905=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','priority','findIndex'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1905,0x194));var _0x5190=function(_0x3f5ca0,_0x4a5cd8){_0x3f5ca0=_0x3f5ca0-0x0;var _0x1bebd2=_0x1905[_0x3f5ca0];return _0x1bebd2;};'use strict';var schema=require('validate');var _=require(_0x5190('0x0'));var logger=require(_0x5190('0x1'))(_0x5190('0x2'));var gotop=schema({'priority':{'type':_0x5190('0x3'),'required':!![],'message':_0x5190('0x4')}});exports[_0x5190('0x5')]=function(_0x5ab4fb,_0x2951a8){return function(_0x624910){try{var _0x1a55b1={'priority':_0x2951a8[0x0]};var _0x49220a=gotop[_0x5190('0x6')](_0x1a55b1,{'typecast':!![]});if(_0x49220a[_0x5190('0x7')]){logger[_0x5190('0x8')](_0x5190('0x9'),_0x5ab4fb,_[_0x5190('0xa')](_0x49220a,_0x5190('0xb'))['join'](',\x20'));_0x624910[_0x5190('0xc')]();}else{logger[_0x5190('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x5ab4fb,_0x1a55b1[_0x5190('0xe')]);if(_0x1a55b1[_0x5190('0xe')]){var _0x376dc6=_[_0x5190('0xf')](_0x624910[_0x5190('0x10')](),{'p':_0x1a55b1['priority']});if(_0x376dc6>=0x0){logger[_0x5190('0xd')](_0x5190('0x11'),_0x5ab4fb,_0x1a55b1[_0x5190('0xe')]||'next',_0x376dc6);_0x624910[_0x5190('0x12')](_0x376dc6);}else{logger[_0x5190('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5ab4fb,_0x1a55b1['priority']||'next');_0x624910[_0x5190('0xc')]();}}else{_0x624910['next']();}}}catch(_0x4f57e8){logger['error'](_0x5190('0x9'),_0x5ab4fb,JSON[_0x5190('0x13')](_0x4f57e8));_0x624910[_0x5190('0xc')]();}};}; \ 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 782f09a..c8d545a 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 _0xe6f1=['../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','../../../../config/logger'];(function(_0x3a9683,_0x5ace71){var _0x43b53f=function(_0x12d108){while(--_0x12d108){_0x3a9683['push'](_0x3a9683['shift']());}};_0x43b53f(++_0x5ace71);}(_0xe6f1,0x19c));var _0x1e6f=function(_0x408a5e,_0x715fad){_0x408a5e=_0x408a5e-0x0;var _0x38ff17=_0xe6f1[_0x408a5e];return _0x38ff17;};'use strict';var _=require(_0x1e6f('0x0'));var utils=require('./utils');var logger=require(_0x1e6f('0x1'))('routing');var rpc={'chatMessage':require(_0x1e6f('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1e6f('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1e6f('0x4')),'whatsappMessage':require(_0x1e6f('0x5'))};exports[_0x1e6f('0x6')]=function(_0x1d0119,_0x289772){return function(_0x4cecf5){try{var _0x507404={'body':utils['getMustacheRender'](_0x289772[0x0],this),'ContactId':this['contact']['id']};if(this[_0x1e6f('0x7')]===_0x1e6f('0x8')){_0x507404['ChatWebsiteId']=this[_0x1e6f('0x9')]['id'];}else{_0x507404[_[_0x1e6f('0xa')](this[_0x1e6f('0x7')])+_0x1e6f('0xb')]=this['account']['id'];}_0x507404[_[_0x1e6f('0xa')](this['channel'])+_0x1e6f('0xc')]=this[_0x1e6f('0xd')]['id'];if(rpc[this[_0x1e6f('0x7')]+_0x1e6f('0xe')]){return rpc[this['channel']+_0x1e6f('0xe')]['create'](_0x507404)[_0x1e6f('0xf')](function(_0x15ae75){logger[_0x1e6f('0x10')](_0x1e6f('0x11'),_0x1d0119,_0x507404[_0x1e6f('0x12')]);_0x4cecf5['next']();})[_0x1e6f('0x13')](function(_0x3c574c){logger[_0x1e6f('0x14')](_0x1e6f('0x11'),_0x1d0119,JSON[_0x1e6f('0x15')](_0x3c574c));_0x4cecf5[_0x1e6f('0x16')]();});}}catch(_0x1deb79){logger[_0x1e6f('0x14')](_0x1e6f('0x11'),_0x1d0119,JSON[_0x1e6f('0x15')](_0x1deb79));_0x4cecf5['stop']();}};}; \ No newline at end of file +var _0x6a5f=['stringify','stop','error','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','catch'];(function(_0x14bdb2,_0x49e0e9){var _0x485fa2=function(_0x3bedad){while(--_0x3bedad){_0x14bdb2['push'](_0x14bdb2['shift']());}};_0x485fa2(++_0x49e0e9);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x6a5f[_0x5cb97e];return _0x1714b4;};'use strict';var _=require(_0xf6a5('0x0'));var utils=require(_0xf6a5('0x1'));var logger=require('../../../../config/logger')(_0xf6a5('0x2'));var rpc={'chatMessage':require(_0xf6a5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf6a5('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf6a5('0x5'))};exports['consequence']=function(_0x5e7da8,_0x295c72){return function(_0x556571){try{var _0x3560d0={'body':utils[_0xf6a5('0x6')](_0x295c72[0x0],this),'ContactId':this[_0xf6a5('0x7')]['id']};if(this[_0xf6a5('0x8')]===_0xf6a5('0x9')){_0x3560d0[_0xf6a5('0xa')]=this[_0xf6a5('0xb')]['id'];}else{_0x3560d0[_[_0xf6a5('0xc')](this[_0xf6a5('0x8')])+'AccountId']=this[_0xf6a5('0xb')]['id'];}_0x3560d0[_[_0xf6a5('0xc')](this[_0xf6a5('0x8')])+_0xf6a5('0xd')]=this[_0xf6a5('0xe')]['id'];if(rpc[this[_0xf6a5('0x8')]+_0xf6a5('0xf')]){return rpc[this['channel']+_0xf6a5('0xf')][_0xf6a5('0x10')](_0x3560d0)[_0xf6a5('0x11')](function(_0x1e59fe){logger['info'](_0xf6a5('0x12'),_0x5e7da8,_0x3560d0['body']);_0x556571['next']();})[_0xf6a5('0x13')](function(_0xcd58e3){logger['error'](_0xf6a5('0x12'),_0x5e7da8,JSON[_0xf6a5('0x14')](_0xcd58e3));_0x556571[_0xf6a5('0x15')]();});}}catch(_0x18a053){logger[_0xf6a5('0x16')](_0xf6a5('0x12'),_0x5e7da8,JSON[_0xf6a5('0x14')](_0x18a053));_0x556571['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 2c75a0b..d104558 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 _0x6f7a=['[%s][NOOP]\x20%s','getMustacheRender','error','stop','./utils','../../../../config/logger','consequence','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f7a,0x1c4));var _0xa6f7=function(_0x20f8e5,_0x17a4d9){_0x20f8e5=_0x20f8e5-0x0;var _0x336c2c=_0x6f7a[_0x20f8e5];return _0x336c2c;};'use strict';var utils=require(_0xa6f7('0x0'));var logger=require(_0xa6f7('0x1'))('routing');exports[_0xa6f7('0x2')]=function(_0x3bfee9,_0x2d77da){return function(_0x372b15){try{logger[_0xa6f7('0x3')](_0xa6f7('0x4'),_0x3bfee9,utils[_0xa6f7('0x5')](_0x2d77da[0x0],this));_0x372b15['next']();}catch(_0x3803c2){logger[_0xa6f7('0x6')](_0xa6f7('0x4'),_0x3bfee9,JSON['stringify'](_0x3803c2));_0x372b15[_0xa6f7('0x7')]();}};}; \ No newline at end of file +var _0x43cb=['./utils','consequence','info','[%s][NOOP]\x20%s','error','stringify','stop'];(function(_0x3616aa,_0x1b6cfb){var _0x27d6e0=function(_0x416617){while(--_0x416617){_0x3616aa['push'](_0x3616aa['shift']());}};_0x27d6e0(++_0x1b6cfb);}(_0x43cb,0xee));var _0xb43c=function(_0x5d3290,_0x4fad62){_0x5d3290=_0x5d3290-0x0;var _0x451575=_0x43cb[_0x5d3290];return _0x451575;};'use strict';var utils=require(_0xb43c('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0xb43c('0x1')]=function(_0x5c6638,_0x726d65){return function(_0x4fc840){try{logger[_0xb43c('0x2')](_0xb43c('0x3'),_0x5c6638,utils['getMustacheRender'](_0x726d65[0x0],this));_0x4fc840['next']();}catch(_0x11c4c8){logger[_0xb43c('0x4')](_0xb43c('0x3'),_0x5c6638,JSON[_0xb43c('0x5')](_0x11c4c8));_0x4fc840[_0xb43c('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 5fa18da..4ab0ebe 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 _0x5c27=['emit','clone','queue_id','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','waiting','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','error','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','find','Queues','timeout','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','log','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','from','joinAt'];(function(_0x151ed4,_0x23cfb8){var _0x1c6f7e=function(_0x5466be){while(--_0x5466be){_0x151ed4['push'](_0x151ed4['shift']());}};_0x1c6f7e(++_0x23cfb8);}(_0x5c27,0x91));var _0x75c2=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0x5c27[_0x4e0eb6];return _0x46e432;};'use strict';var schema=require(_0x75c2('0x0'));var _=require('lodash');var util=require(_0x75c2('0x1'));var seqqueue=require(_0x75c2('0x2'));var moment=require(_0x75c2('0x3'));var Redis=require(_0x75c2('0x4'));var config=require(_0x75c2('0x5'));var logger=require(_0x75c2('0x6'))(_0x75c2('0x7'));var strategy=require('./strategy');config[_0x75c2('0x8')]=_[_0x75c2('0x9')](config[_0x75c2('0x8')],{'host':_0x75c2('0xa'),'port':0x18eb});var io=require(_0x75c2('0xb'))(new Redis(config[_0x75c2('0x8')]));var attributes=['id','queue_id',_0x75c2('0xc'),'queue',_0x75c2('0xd'),_0x75c2('0xe')];function emit(_0x4e2d24,_0x3a4d59,_0x4b5fbc){io['to'](_0x4e2d24)[_0x75c2('0xf')](_0x3a4d59,_0x4b5fbc);}function emitChannelQueueInteraction(_0x28d465,_0x415e18,_0x8e2796,_0x2057f5,_0x4d9305,_0x210a89,_0x3aa803,_0x32b2b6){var _0x17c7e6=_[_0x75c2('0x10')](_0x8e2796);_0x17c7e6[_0x75c2('0x11')]=_0x32b2b6;_0x17c7e6['queue']=_0x415e18;_0x17c7e6[_0x75c2('0xc')]=_0x2057f5;_0x17c7e6['id']=_0x4d9305;if(_0x210a89){_0x3aa803[util[_0x75c2('0x12')](_0x75c2('0x13'),_0x28d465)][_0x4d9305]=_[_0x75c2('0x14')](_0x17c7e6,attributes);}else{delete _0x3aa803[util[_0x75c2('0x12')](_0x75c2('0x13'),_0x28d465)][_0x4d9305];}emit(util[_0x75c2('0x12')](_0x75c2('0x15'),_0x28d465,_0x415e18),util[_0x75c2('0x12')](_0x75c2('0x16'),_0x28d465,_0x210a89?_0x75c2('0x17'):_0x75c2('0x18')),_['pick'](_0x17c7e6,attributes));}var rpc={'openchannelQueueReport':require(_0x75c2('0x19')),'mailQueueReport':require(_0x75c2('0x1a')),'chatQueueReport':require(_0x75c2('0x1b')),'smsQueueReport':require(_0x75c2('0x1c')),'faxQueueReport':require(_0x75c2('0x1d')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x75c2('0x1e')},'timeout':{'type':_0x75c2('0x1f'),'message':_0x75c2('0x20')}});function startRouting(_0xc99312,_0x64e8d0,_0x37e6a0,_0x3fe28b){if(_0xc99312&&_0x64e8d0&&_0x37e6a0){_0x64e8d0['waiting']+=0x1;var _0x1cfc84={'uniqueid':_0xc99312,'from':_0x37e6a0[_0x75c2('0x21')]?_0x37e6a0[_0x75c2('0x21')][_0x75c2('0xd')]:'','joinAt':moment()[_0x75c2('0x12')](_0x75c2('0x22')),'ContactId':_0x37e6a0['contact']?_0x37e6a0[_0x75c2('0x23')]['id']:null,'ListId':_0x37e6a0['list']?_0x37e6a0[_0x75c2('0x24')]['id']:null};_0x1cfc84[_[_0x75c2('0x25')](_0x37e6a0[_0x75c2('0x26')])+_0x75c2('0x27')]=_0x64e8d0['id']||null;_0x1cfc84[_[_0x75c2('0x25')](_0x37e6a0[_0x75c2('0x26')])+_0x75c2('0x28')]=_0x37e6a0[_0x75c2('0x29')]?_0x37e6a0['interaction']['id']:null;_0x1cfc84[_[_0x75c2('0x25')](_0x37e6a0['channel'])+_0x75c2('0x2a')]=_0x37e6a0[_0x75c2('0x2b')]?_0x37e6a0['message']['id']:null;_0x1cfc84[_['upperFirst'](_0x37e6a0[_0x75c2('0x26')])+(_0x37e6a0[_0x75c2('0x26')]!==_0x75c2('0x2c')?_0x75c2('0x2d'):'WebsiteId')]=_0x37e6a0[_0x75c2('0xc')]?_0x37e6a0[_0x75c2('0xc')]['id']:null;logger[_0x75c2('0x2e')](util[_0x75c2('0x12')](_0x75c2('0x2f'),_0xc99312,_0x64e8d0[_0x75c2('0x30')]));emitChannelQueueInteraction(_0x37e6a0[_0x75c2('0x26')],_0x64e8d0[_0x75c2('0x30')],_0x1cfc84,_0x37e6a0[_0x75c2('0xc')][_0x75c2('0x30')],_0x37e6a0['message']['id'],!![],_0x3fe28b,_0x64e8d0['id']);if(rpc[_0x37e6a0['channel']+_0x75c2('0x31')]){return rpc[_0x37e6a0[_0x75c2('0x26')]+_0x75c2('0x31')]['create'](_0x1cfc84)[_0x75c2('0x32')](function(_0x464806){logger['error'](_0x75c2('0x33'));});}}}function stopRouting(_0x37f844,_0x52f50a,_0x2088cc,_0x5e20ea){if(_0x37f844&&_0x52f50a){_0x52f50a[_0x75c2('0x34')]-=0x1;var _0x444152={'leaveAt':moment()[_0x75c2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x75c2('0x12')](_0x75c2('0x22')),'reason':'accepted'};logger[_0x75c2('0x2e')](util[_0x75c2('0x12')](_0x75c2('0x35'),_0x37f844,_0x52f50a[_0x75c2('0x30')]));emitChannelQueueInteraction(_0x2088cc['channel'],_0x52f50a[_0x75c2('0x30')],_0x2088cc[_0x75c2('0x21')],_0x2088cc[_0x75c2('0xc')][_0x75c2('0x30')],_0x2088cc[_0x75c2('0x2b')]['id'],![],_0x5e20ea,_0x52f50a['id']);if(rpc[_0x2088cc['channel']+_0x75c2('0x31')]){return rpc[_0x2088cc[_0x75c2('0x26')]+_0x75c2('0x31')][_0x75c2('0x36')](_0x37f844,_0x444152)[_0x75c2('0x32')](function(_0x41ce46){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0xda064d,_0x1d0ab8,_0x531d20,_0x442e0f){if(_0xda064d&&_0x1d0ab8){_0x1d0ab8['waiting']-=0x1;var _0x1bc5d9={'leaveAt':moment()[_0x75c2('0x12')](_0x75c2('0x22')),'exitAt':moment()[_0x75c2('0x12')](_0x75c2('0x22')),'reason':'timeout'};logger[_0x75c2('0x2e')](util[_0x75c2('0x12')](_0x75c2('0x37'),_0xda064d,_0x1d0ab8[_0x75c2('0x30')]));emitChannelQueueInteraction(_0x531d20[_0x75c2('0x26')],_0x1d0ab8['name'],_0x531d20['body'],_0x531d20['account']['name'],_0x531d20[_0x75c2('0x2b')]['id'],![],_0x442e0f);if(rpc[_0x531d20['channel']+'QueueReport']){return rpc[_0x531d20[_0x75c2('0x26')]+'QueueReport'][_0x75c2('0x36')](_0xda064d,_0x1bc5d9)['catch'](function(_0x5285c3){logger[_0x75c2('0x38')](_0x75c2('0x39'));});}}}function handleFindQueue(_0x54ffc9){return function(_0x59aa3d){return _0x59aa3d['name'][_0x75c2('0x3a')]()===_0x54ffc9[_0x75c2('0x3a')]();};}exports[_0x75c2('0x3b')]=function(_0x1c4f81,_0x508af9,_0x1fd599,_0x4466b9){return function(_0x491dda){try{var _0x483c76={'name':_0x508af9[0x0],'timeout':_0x508af9[0x1]};var _0x40d21e=queue[_0x75c2('0x0')](_0x483c76,{'typecast':!![]});if(_0x40d21e[_0x75c2('0x3c')]){logger[_0x75c2('0x38')](_0x75c2('0x3d'),_0x1c4f81,_['map'](_0x40d21e,_0x75c2('0x2b'))[_0x75c2('0x3e')](',\x20'));_0x491dda['stop']();}else{var _0xf1f79b=_[_0x75c2('0x3f')](_0x1fd599[_0x4466b9['channel']+_0x75c2('0x40')],handleFindQueue(_0x483c76['name']));if(_0xf1f79b){startRouting(_0x1c4f81,_0xf1f79b,_0x4466b9,_0x1fd599);var _0x5effc5=(_0xf1f79b[_0x75c2('0x41')]||0xa)*0x3e8;var _0x531f50=(_0x483c76['timeout']||0x14)*0x3e8;var _0x33d440,_0x248f46;if(_0x5effc5>_0x531f50){_0x531f50=_0x5effc5;}var _0x316374=seqqueue[_0x75c2('0x42')](_0x5effc5);_0x316374['id']=_0x1c4f81;_0x316374[_0x75c2('0x43')]=_0x5effc5;_0x316374[_0x75c2('0x44')]=_0x531f50;_0x316374[_0x75c2('0x26')]=_0x4466b9['channel'];_0x1fd599['rules'][_0x1c4f81]['on'](_0x75c2('0x45'),function(){logger['info'](_0x75c2('0x46'),_0x1c4f81);stopRouting(_0x1c4f81,_0xf1f79b,_0x4466b9,_0x1fd599);clearTimeout(_0x33d440);_0x33d440=undefined;_0x316374['close'](!![]);if(_0x1fd599['rules'][_0x1c4f81]){delete _0x1fd599[_0x75c2('0x47')][_0x1c4f81];}_0x491dda[_0x75c2('0x48')]();});_0x1fd599[_0x75c2('0x47')][_0x1c4f81]['on'](_0x75c2('0x49'),function(){if(_0x1fd599[_0x75c2('0x47')][_0x1c4f81]){delete _0x1fd599[_0x75c2('0x47')][_0x1c4f81];}});_0x33d440=setTimeout(function(){logger[_0x75c2('0x2e')](_0x75c2('0x4a'),_0x1c4f81);endRouting(_0x1c4f81,_0xf1f79b,_0x4466b9,_0x1fd599);clearTimeout(_0x33d440);_0x316374[_0x75c2('0x4b')](!![]);_0x491dda[_0x75c2('0x4c')]();},_0x531f50);switch(_0xf1f79b[_0x75c2('0x4d')]){case _0x75c2('0x4e'):strategy[_0x75c2('0x4e')](_0x316374,_0xf1f79b,_0x1fd599,_0x4466b9);break;default:strategy['beepall'](_0x316374,_0xf1f79b,_0x1fd599,_0x4466b9);}}else{logger[_0x75c2('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1c4f81,_0x483c76[_0x75c2('0x30')]);_0x491dda[_0x75c2('0x48')]();}}}catch(_0x2068a5){console[_0x75c2('0x4f')](_0x2068a5);logger[_0x75c2('0x38')](_0x75c2('0x3d'),_0x1c4f81,_0x2068a5['stack']);_0x491dda['stop']();}};}; \ No newline at end of file +var _0x0a16=['body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','accepted','info','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','find','Queues','timeout','createQueue','atimeout','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stop','log','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','redis','localhost','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x251cde,_0x6b188d){var _0x341a27=function(_0x965f96){while(--_0x965f96){_0x251cde['push'](_0x251cde['shift']());}};_0x341a27(++_0x6b188d);}(_0x0a16,0x160));var _0x60a1=function(_0x522c19,_0x123db4){_0x522c19=_0x522c19-0x0;var _0xbb0181=_0x0a16[_0x522c19];return _0xbb0181;};'use strict';var schema=require(_0x60a1('0x0'));var _=require(_0x60a1('0x1'));var util=require(_0x60a1('0x2'));var seqqueue=require(_0x60a1('0x3'));var moment=require(_0x60a1('0x4'));var Redis=require('ioredis');var config=require(_0x60a1('0x5'));var logger=require(_0x60a1('0x6'))(_0x60a1('0x7'));var strategy=require('./strategy');config[_0x60a1('0x8')]=_['defaults'](config['redis'],{'host':_0x60a1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x60a1('0xa'),_0x60a1('0xb'),_0x60a1('0xc'),_0x60a1('0xd'),_0x60a1('0xe')];function emit(_0x5b5d94,_0x16c198,_0x930b92){io['to'](_0x5b5d94)[_0x60a1('0xf')](_0x16c198,_0x930b92);}function emitChannelQueueInteraction(_0x2f2ab9,_0x4d43d0,_0x231a99,_0x1980d0,_0x2cb51e,_0x37aa27,_0x2fa5da,_0x18e409){var _0xdc54a6=_[_0x60a1('0x10')](_0x231a99);_0xdc54a6[_0x60a1('0xa')]=_0x18e409;_0xdc54a6[_0x60a1('0xc')]=_0x4d43d0;_0xdc54a6[_0x60a1('0xb')]=_0x1980d0;_0xdc54a6['id']=_0x2cb51e;if(_0x37aa27){_0x2fa5da[util['format'](_0x60a1('0x11'),_0x2f2ab9)][_0x2cb51e]=_[_0x60a1('0x12')](_0xdc54a6,attributes);}else{delete _0x2fa5da[util[_0x60a1('0x13')]('%sQueuesWaitingInteractions',_0x2f2ab9)][_0x2cb51e];}emit(util[_0x60a1('0x13')]('%s:queue:%s',_0x2f2ab9,_0x4d43d0),util[_0x60a1('0x13')](_0x60a1('0x14'),_0x2f2ab9,_0x37aa27?_0x60a1('0x15'):_0x60a1('0x16')),_[_0x60a1('0x12')](_0xdc54a6,attributes));}var rpc={'openchannelQueueReport':require(_0x60a1('0x17')),'mailQueueReport':require(_0x60a1('0x18')),'chatQueueReport':require(_0x60a1('0x19')),'smsQueueReport':require(_0x60a1('0x1a')),'faxQueueReport':require(_0x60a1('0x1b')),'whatsappQueueReport':require(_0x60a1('0x1c'))};var queue=schema({'name':{'type':_0x60a1('0x1d'),'required':!![],'message':_0x60a1('0x1e')},'timeout':{'type':_0x60a1('0x1f'),'message':_0x60a1('0x20')}});function startRouting(_0x596668,_0x5776ce,_0x598ddb,_0x42f1dc){if(_0x596668&&_0x5776ce&&_0x598ddb){_0x5776ce['waiting']+=0x1;var _0x11ed81={'uniqueid':_0x596668,'from':_0x598ddb[_0x60a1('0x21')]?_0x598ddb['body'][_0x60a1('0xd')]:'','joinAt':moment()[_0x60a1('0x13')](_0x60a1('0x22')),'ContactId':_0x598ddb[_0x60a1('0x23')]?_0x598ddb['contact']['id']:null,'ListId':_0x598ddb[_0x60a1('0x24')]?_0x598ddb['list']['id']:null};_0x11ed81[_['upperFirst'](_0x598ddb[_0x60a1('0x25')])+_0x60a1('0x26')]=_0x5776ce['id']||null;_0x11ed81[_[_0x60a1('0x27')](_0x598ddb[_0x60a1('0x25')])+_0x60a1('0x28')]=_0x598ddb[_0x60a1('0x29')]?_0x598ddb['interaction']['id']:null;_0x11ed81[_[_0x60a1('0x27')](_0x598ddb[_0x60a1('0x25')])+'MessageId']=_0x598ddb[_0x60a1('0x2a')]?_0x598ddb['message']['id']:null;_0x11ed81[_['upperFirst'](_0x598ddb[_0x60a1('0x25')])+(_0x598ddb['channel']!=='chat'?_0x60a1('0x2b'):_0x60a1('0x2c'))]=_0x598ddb[_0x60a1('0xb')]?_0x598ddb[_0x60a1('0xb')]['id']:null;logger['info'](util[_0x60a1('0x13')](_0x60a1('0x2d'),_0x596668,_0x5776ce['name']));emitChannelQueueInteraction(_0x598ddb[_0x60a1('0x25')],_0x5776ce[_0x60a1('0x2e')],_0x11ed81,_0x598ddb[_0x60a1('0xb')]['name'],_0x598ddb['message']['id'],!![],_0x42f1dc,_0x5776ce['id']);if(rpc[_0x598ddb['channel']+_0x60a1('0x2f')]){return rpc[_0x598ddb[_0x60a1('0x25')]+'QueueReport'][_0x60a1('0x30')](_0x11ed81)['catch'](function(_0x29086b){logger[_0x60a1('0x31')](_0x60a1('0x32'));});}}}function stopRouting(_0x817374,_0x3e6953,_0x585d43,_0x1ae78a){if(_0x817374&&_0x3e6953){_0x3e6953[_0x60a1('0x33')]-=0x1;var _0x4a1098={'leaveAt':moment()[_0x60a1('0x13')](_0x60a1('0x22')),'acceptAt':moment()[_0x60a1('0x13')](_0x60a1('0x22')),'reason':_0x60a1('0x34')};logger[_0x60a1('0x35')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x817374,_0x3e6953['name']));emitChannelQueueInteraction(_0x585d43[_0x60a1('0x25')],_0x3e6953[_0x60a1('0x2e')],_0x585d43[_0x60a1('0x21')],_0x585d43[_0x60a1('0xb')][_0x60a1('0x2e')],_0x585d43[_0x60a1('0x2a')]['id'],![],_0x1ae78a,_0x3e6953['id']);if(rpc[_0x585d43[_0x60a1('0x25')]+_0x60a1('0x2f')]){return rpc[_0x585d43[_0x60a1('0x25')]+_0x60a1('0x2f')][_0x60a1('0x36')](_0x817374,_0x4a1098)['catch'](function(_0x1e678b){logger[_0x60a1('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x557547,_0x35b535,_0x1db5df,_0x3f9d7c){if(_0x557547&&_0x35b535){_0x35b535[_0x60a1('0x33')]-=0x1;var _0x4f4fdf={'leaveAt':moment()[_0x60a1('0x13')](_0x60a1('0x22')),'exitAt':moment()['format'](_0x60a1('0x22')),'reason':'timeout'};logger[_0x60a1('0x35')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x557547,_0x35b535['name']));emitChannelQueueInteraction(_0x1db5df[_0x60a1('0x25')],_0x35b535[_0x60a1('0x2e')],_0x1db5df[_0x60a1('0x21')],_0x1db5df[_0x60a1('0xb')][_0x60a1('0x2e')],_0x1db5df[_0x60a1('0x2a')]['id'],![],_0x3f9d7c);if(rpc[_0x1db5df['channel']+_0x60a1('0x2f')]){return rpc[_0x1db5df['channel']+'QueueReport'][_0x60a1('0x36')](_0x557547,_0x4f4fdf)['catch'](function(_0x49c698){logger[_0x60a1('0x31')](_0x60a1('0x37'));});}}}function handleFindQueue(_0x547051){return function(_0xf9e8b1){return _0xf9e8b1[_0x60a1('0x2e')][_0x60a1('0x38')]()===_0x547051[_0x60a1('0x38')]();};}exports['consequence']=function(_0x14d216,_0x53689e,_0x39a864,_0x19fd28){return function(_0x441cc4){try{var _0x51ced0={'name':_0x53689e[0x0],'timeout':_0x53689e[0x1]};var _0x8b205e=queue[_0x60a1('0x0')](_0x51ced0,{'typecast':!![]});if(_0x8b205e[_0x60a1('0x39')]){logger[_0x60a1('0x31')](_0x60a1('0x3a'),_0x14d216,_['map'](_0x8b205e,_0x60a1('0x2a'))[_0x60a1('0x3b')](',\x20'));_0x441cc4['stop']();}else{var _0x443dae=_[_0x60a1('0x3c')](_0x39a864[_0x19fd28[_0x60a1('0x25')]+_0x60a1('0x3d')],handleFindQueue(_0x51ced0[_0x60a1('0x2e')]));if(_0x443dae){startRouting(_0x14d216,_0x443dae,_0x19fd28,_0x39a864);var _0x395fce=(_0x443dae[_0x60a1('0x3e')]||0xa)*0x3e8;var _0x243bee=(_0x51ced0[_0x60a1('0x3e')]||0x14)*0x3e8;var _0x1a07db,_0x7475ad;if(_0x395fce>_0x243bee){_0x243bee=_0x395fce;}var _0x58145d=seqqueue[_0x60a1('0x3f')](_0x395fce);_0x58145d['id']=_0x14d216;_0x58145d[_0x60a1('0x40')]=_0x395fce;_0x58145d['qtimeout']=_0x243bee;_0x58145d[_0x60a1('0x25')]=_0x19fd28['channel'];_0x39a864[_0x60a1('0x41')][_0x14d216]['on'](_0x60a1('0x42'),function(){logger[_0x60a1('0x35')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x14d216);stopRouting(_0x14d216,_0x443dae,_0x19fd28,_0x39a864);clearTimeout(_0x1a07db);_0x1a07db=undefined;_0x58145d['close'](!![]);if(_0x39a864[_0x60a1('0x41')][_0x14d216]){delete _0x39a864[_0x60a1('0x41')][_0x14d216];}_0x441cc4['stop']();});_0x39a864[_0x60a1('0x41')][_0x14d216]['on'](_0x60a1('0x43'),function(){if(_0x39a864[_0x60a1('0x41')][_0x14d216]){delete _0x39a864['rules'][_0x14d216];}});_0x1a07db=setTimeout(function(){logger[_0x60a1('0x35')](_0x60a1('0x44'),_0x14d216);endRouting(_0x14d216,_0x443dae,_0x19fd28,_0x39a864);clearTimeout(_0x1a07db);_0x58145d[_0x60a1('0x45')](!![]);_0x441cc4[_0x60a1('0x46')]();},_0x243bee);switch(_0x443dae[_0x60a1('0x47')]){case _0x60a1('0x48'):strategy[_0x60a1('0x48')](_0x58145d,_0x443dae,_0x39a864,_0x19fd28);break;default:strategy[_0x60a1('0x49')](_0x58145d,_0x443dae,_0x39a864,_0x19fd28);}}else{logger[_0x60a1('0x31')](_0x60a1('0x4a'),_0x14d216,_0x51ced0[_0x60a1('0x2e')]);_0x441cc4[_0x60a1('0x4b')]();}}}catch(_0x39209c){console[_0x60a1('0x4c')](_0x39209c);logger[_0x60a1('0x31')](_0x60a1('0x3a'),_0x14d216,_0x39209c['stack']);_0x441cc4['stop']();}};}; \ 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 2f08a13..ebb941f 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 _0x1958=['busyQueue','TIMEOUT','exports','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','bind','handleTimeout','timeout','handleDrained','prototype','push','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x37bc7a,_0x3f7014){var _0x240abb=function(_0x2df6be){while(--_0x2df6be){_0x37bc7a['push'](_0x37bc7a['shift']());}};_0x240abb(++_0x3f7014);}(_0x1958,0x183));var _0x8195=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x1958[_0x568f96];return _0x5a053a;};'use strict';var _=require('lodash');var uuid=require(_0x8195('0x0'));var util=require(_0x8195('0x1'));var logger=require(_0x8195('0x2'))('routing');var Agent=function(_0xdb33a6,_0x11baac,_0x13984b,_0x336671){this[_0x8195('0x3')]=uuid['v4']();this[_0x8195('0x4')]=_0xdb33a6;this[_0x8195('0x5')]=_0x11baac;this[_0x8195('0x6')]=_0x13984b;this[_0x8195('0x7')]=_0x336671;this['squeue']['push'](this['handleRun'][_0x8195('0x8')](this),this[_0x8195('0x9')]['bind'](this));this[_0x8195('0x4')]['on'](_0x8195('0xa'),this['handleTimeout'][_0x8195('0x8')](this));this[_0x8195('0x4')]['on']('drained',this[_0x8195('0xb')]['bind'](this));};Agent[_0x8195('0xc')][_0x8195('0xd')]=function(){this[_0x8195('0x4')][_0x8195('0xd')](this[_0x8195('0xe')][_0x8195('0x8')](this),this['handleTimeout'][_0x8195('0x8')](this));};Agent[_0x8195('0xc')][_0x8195('0xb')]=function(){this[_0x8195('0x9')](!![]);};Agent['prototype'][_0x8195('0xe')]=function(_0x266024){logger[_0x8195('0xf')](_0x8195('0x10'),this[_0x8195('0x4')]['id'],this[_0x8195('0x5')]['id']);if(_[_0x8195('0x11')](this[_0x8195('0x6')][_0x8195('0x12')][this['agent']['id']])){logger[_0x8195('0xf')](_0x8195('0x13'),this[_0x8195('0x4')]['id'],this[_0x8195('0x5')]['id']);setTimeout(this[_0x8195('0xd')][_0x8195('0x8')](this),0x3e8);}else{if(this[_0x8195('0x7')]['forcedOwnership']||util[_0x8195('0x14')](this[_0x8195('0x4')]['id'],this[_0x8195('0x6')]['agents'][this[_0x8195('0x5')]['id']],this[_0x8195('0x4')][_0x8195('0x15')],![])){this['realtime']['agents'][this[_0x8195('0x5')]['id']][_0x8195('0x16')]=!![];this[_0x8195('0x6')]['agents'][this[_0x8195('0x5')]['id']]['busyQueue']=undefined;util[_0x8195('0x17')](this['notificationId'],this[_0x8195('0x4')]['id'],this[_0x8195('0x6')][_0x8195('0x12')][this[_0x8195('0x5')]['id']],null,this[_0x8195('0x7')]);util[_0x8195('0x18')](this['squeue']['id'],this['realtime'][_0x8195('0x12')][this[_0x8195('0x5')]['id']],_0x8195('0x19')+(this[_0x8195('0x7')][_0x8195('0x1a')]?':FORCED':''));}else{logger[_0x8195('0xf')](_0x8195('0x1b'),this[_0x8195('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x8195('0xd')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x8195('0x9')]=function(_0x56d0ec){if(_[_0x8195('0x11')](this['realtime'][_0x8195('0x12')][this[_0x8195('0x5')]['id']])){return logger[_0x8195('0xf')](_0x8195('0x13'),this['squeue']['id'],this[_0x8195('0x5')]['id']);}else{logger[_0x8195('0xf')](_0x8195('0x1c'),this[_0x8195('0x4')]['id'],this['agent']['id']);util['hideNotification'](this[_0x8195('0x3')],this['squeue']['id'],this[_0x8195('0x6')][_0x8195('0x12')][this[_0x8195('0x5')]['id']],null,this[_0x8195('0x7')]);this['realtime'][_0x8195('0x12')][this[_0x8195('0x5')]['id']]['busy']=![];this[_0x8195('0x6')]['agents'][this[_0x8195('0x5')]['id']][_0x8195('0x1d')]=undefined;util[_0x8195('0x18')](this['squeue']['id'],this['realtime'][_0x8195('0x12')][this[_0x8195('0x5')]['id']],_0x56d0ec?'STOP':_0x8195('0x1e'));}if(!_0x56d0ec){setTimeout(this[_0x8195('0xd')][_0x8195('0x8')](this),0x3e8);}};function agent(_0xccc648,_0x9a5873,_0x3af686,_0x59deb1){return new Agent(_0xccc648,_0x9a5873,_0x3af686,_0x59deb1);}module[_0x8195('0x1f')]=agent; \ No newline at end of file +var _0x877c=['channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','routing','busy','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0xc15223,_0x7bdd85){var _0x2be260=function(_0x257fc1){while(--_0x257fc1){_0xc15223['push'](_0xc15223['shift']());}};_0x2be260(++_0x7bdd85);}(_0x877c,0x9e));var _0xc877=function(_0x584f6a,_0x3dd35e){_0x584f6a=_0x584f6a-0x0;var _0x5b01cf=_0x877c[_0x584f6a];return _0x5b01cf;};'use strict';var _=require(_0xc877('0x0'));var uuid=require(_0xc877('0x1'));var util=require(_0xc877('0x2'));var logger=require(_0xc877('0x3'))('routing');var Agent=function(_0x4152d6,_0x164bf9,_0x167890,_0x15a128){this[_0xc877('0x4')]=uuid['v4']();this[_0xc877('0x5')]=_0x4152d6;this[_0xc877('0x6')]=_0x164bf9;this[_0xc877('0x7')]=_0x167890;this['routing']=_0x15a128;this[_0xc877('0x5')][_0xc877('0x8')](this[_0xc877('0x9')][_0xc877('0xa')](this),this[_0xc877('0xb')][_0xc877('0xa')](this));this[_0xc877('0x5')]['on'](_0xc877('0xc'),this['handleTimeout'][_0xc877('0xa')](this));this[_0xc877('0x5')]['on'](_0xc877('0xd'),this['handleDrained'][_0xc877('0xa')](this));};Agent[_0xc877('0xe')][_0xc877('0x8')]=function(){this[_0xc877('0x5')][_0xc877('0x8')](this['handleRun'][_0xc877('0xa')](this),this[_0xc877('0xb')][_0xc877('0xa')](this));};Agent[_0xc877('0xe')][_0xc877('0xf')]=function(){this['handleTimeout'](!![]);};Agent[_0xc877('0xe')][_0xc877('0x9')]=function(_0x28e46b){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xc877('0x6')]['id']);if(_[_0xc877('0x10')](this['realtime'][_0xc877('0x11')][this[_0xc877('0x6')]['id']])){logger[_0xc877('0x12')](_0xc877('0x13'),this[_0xc877('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xc877('0x8')][_0xc877('0xa')](this),0x3e8);}else{if(this['routing'][_0xc877('0x14')]||util[_0xc877('0x15')](this[_0xc877('0x5')]['id'],this['realtime'][_0xc877('0x11')][this[_0xc877('0x6')]['id']],this['squeue'][_0xc877('0x16')],![])){this[_0xc877('0x7')]['agents'][this[_0xc877('0x6')]['id']]['busy']=!![];this[_0xc877('0x7')][_0xc877('0x11')][this[_0xc877('0x6')]['id']]['busyQueue']=undefined;util[_0xc877('0x17')](this[_0xc877('0x4')],this[_0xc877('0x5')]['id'],this[_0xc877('0x7')][_0xc877('0x11')][this[_0xc877('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0xc877('0x5')]['id'],this[_0xc877('0x7')][_0xc877('0x11')][this[_0xc877('0x6')]['id']],_0xc877('0x18')+(this['routing']['forcedOwnership']?_0xc877('0x19'):''));}else{logger[_0xc877('0x12')](_0xc877('0x1a'),this[_0xc877('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0xc877('0xa')](this),0x3e8);}}};Agent['prototype'][_0xc877('0xb')]=function(_0x29e7c4){if(_[_0xc877('0x10')](this[_0xc877('0x7')][_0xc877('0x11')][this['agent']['id']])){return logger[_0xc877('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc877('0x5')]['id'],this[_0xc877('0x6')]['id']);}else{logger[_0xc877('0x12')](_0xc877('0x1b'),this[_0xc877('0x5')]['id'],this[_0xc877('0x6')]['id']);util[_0xc877('0x1c')](this[_0xc877('0x4')],this['squeue']['id'],this[_0xc877('0x7')][_0xc877('0x11')][this[_0xc877('0x6')]['id']],null,this[_0xc877('0x1d')]);this['realtime'][_0xc877('0x11')][this['agent']['id']][_0xc877('0x1e')]=![];this[_0xc877('0x7')][_0xc877('0x11')][this[_0xc877('0x6')]['id']][_0xc877('0x1f')]=undefined;util[_0xc877('0x20')](this[_0xc877('0x5')]['id'],this[_0xc877('0x7')]['agents'][this['agent']['id']],_0x29e7c4?_0xc877('0x21'):_0xc877('0x22'));}if(!_0x29e7c4){setTimeout(this[_0xc877('0x8')][_0xc877('0xa')](this),0x3e8);}};function agent(_0xbfadf3,_0x3a22b3,_0x2ff4eb,_0xd1f646){return new Agent(_0xbfadf3,_0x3a22b3,_0x2ff4eb,_0xd1f646);}module[_0xc877('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 d97820f..18cf369 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 _0x16cc=['bind','handleTimeout','timeout','handleDrained','prototype','push','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','name','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busyQueue','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x16cc,0x120));var _0xc16c=function(_0x1ad97a,_0xbe6558){_0x1ad97a=_0x1ad97a-0x0;var _0x8ecd17=_0x16cc[_0x1ad97a];return _0x8ecd17;};'use strict';var _=require('lodash');var uuid=require(_0xc16c('0x0'));var util=require(_0xc16c('0x1'));var logger=require(_0xc16c('0x2'))(_0xc16c('0x3'));var Beepall=function(_0x203166,_0xef5c6,_0x21434b,_0x5b0f8b){this[_0xc16c('0x4')]=uuid['v4']();this[_0xc16c('0x5')]=_0x203166;this[_0xc16c('0x6')]=_0xef5c6;this[_0xc16c('0x7')]=_0x21434b;this['routing']=_0x5b0f8b;this[_0xc16c('0x5')]['push'](this[_0xc16c('0x8')][_0xc16c('0x9')](this),this[_0xc16c('0xa')][_0xc16c('0x9')](this));this['squeue']['on'](_0xc16c('0xb'),this[_0xc16c('0xa')][_0xc16c('0x9')](this));this[_0xc16c('0x5')]['on']('drained',this[_0xc16c('0xc')][_0xc16c('0x9')](this));};Beepall[_0xc16c('0xd')]['push']=function(){this['squeue'][_0xc16c('0xe')](this[_0xc16c('0x8')][_0xc16c('0x9')](this),this['handleTimeout']['bind'](this));};Beepall['prototype'][_0xc16c('0xc')]=function(_0x3f406e){this[_0xc16c('0xa')](!![]);};Beepall[_0xc16c('0xd')][_0xc16c('0x8')]=function(_0x24028d){var _0x47ea69=!![];if(!_[_0xc16c('0xf')](this[_0xc16c('0x6')])&&!_[_0xc16c('0xf')](this[_0xc16c('0x6')][_0xc16c('0x10')])&&this[_0xc16c('0x6')][_0xc16c('0x10')][_0xc16c('0x11')]>0x0){for(var _0x5535ee=0x0,_0x509e6b;_0x5535ee0x0){for(var _0x321ad0=0x0,_0x5d745b;_0x321ad00x0&&_0x1b7760[_0x5b6502+_0x22d7('0x27')]>=_0x1b7760[_0x5b6502+_0x22d7('0x28')]){writeLog(_0x141220,_0x1b7760,_0x5b6502['toUpperCase']()+_0x22d7('0x29'));return![];}}return!![];};exports[_0x22d7('0x2a')]=function(_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd){return sendNotification(!![],_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd);};exports[_0x22d7('0x2b')]=function(_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334){return sendNotification(![],_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x4fb4=['isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','remove','info'];(function(_0x2f49df,_0x518919){var _0x1ec090=function(_0x19e46f){while(--_0x19e46f){_0x2f49df['push'](_0x2f49df['shift']());}};_0x1ec090(++_0x518919);}(_0x4fb4,0x190));var _0x44fb=function(_0x2b7043,_0x43930f){_0x2b7043=_0x2b7043-0x0;var _0x201b08=_0x4fb4[_0x2b7043];return _0x201b08;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var utils=require(_0x44fb('0x1'));var Mustache=require(_0x44fb('0x2'));var Redis=require(_0x44fb('0x3'));var config=require(_0x44fb('0x4'));var logger=require(_0x44fb('0x5'))('routing');config[_0x44fb('0x6')]=_[_0x44fb('0x7')](config[_0x44fb('0x6')],{'host':_0x44fb('0x8'),'port':0x18eb});var io=require(_0x44fb('0x9'))(new Redis(config[_0x44fb('0x6')]));function emit(_0x464af5,_0x2a4d75,_0x59aa6d){io['to'](_0x464af5)[_0x44fb('0xa')](_0x2a4d75,_0x59aa6d);}function sendNotification(_0xd4ead0,_0x5405a8,_0x42fcc2,_0x3d9002,_0x2a1cb7,_0x34444f){io['to'](util[_0x44fb('0xb')](_0x44fb('0xc'),_0x3d9002[_0x44fb('0xd')]))[_0x44fb('0xa')](_0x44fb('0xe'),_0x3d9002);var _0x2ae684=_0x34444f||{};var _0x4b202d=_0x42fcc2[_0x44fb('0xf')]('.');var _0x1e8a60={'uniqueid':_0x5405a8,'channel':_0x4b202d[0x0],'id':_0x4b202d[0x1],'title':_0x4b202d[0x0]+_0x44fb('0x10'),'interactionId':_0x4b202d[0x2],'queue':_0x2a1cb7?_0x2a1cb7[_0x44fb('0xd')]:null,'sound':_0x2ae684[_0x44fb('0x11')]['notificationSound'],'shake':_0x2ae684[_0x44fb('0x11')][_0x44fb('0x12')]};try{if(!_0x2ae684[_0x44fb('0x13')]){_0x2ae684[_0x44fb('0x13')]={};}if(_0x2a1cb7){_0x2ae684[_0x44fb('0x13')]['queue']=_0x2a1cb7;}else if(_0x2ae684[_0x44fb('0x13')][_0x44fb('0x14')]){delete _0x2ae684[_0x44fb('0x13')][_0x44fb('0x14')];}_0x1e8a60[_0x44fb('0x15')]=utils[_0x44fb('0x16')](_0x2ae684[_0x44fb('0x11')]['notificationTemplate'],_0x2ae684);}catch(_0x2c622f){_0x1e8a60[_0x44fb('0x15')]=_0x44fb('0x17');logger[_0x44fb('0x18')](util[_0x44fb('0xb')](_0x44fb('0x19'),_0x5405a8,_0x2c622f[_0x44fb('0x1a')]));}io['to'](util[_0x44fb('0xb')](_0x44fb('0xc'),_0x3d9002[_0x44fb('0xd')]))['emit'](util['format']('notification:%s',_0xd4ead0?_0x44fb('0x1b'):_0x44fb('0x1c')),_0x1e8a60);}function writeLog(_0x2dd412,_0x544647,_0x52507a){return logger[_0x44fb('0x1d')](util[_0x44fb('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2dd412,_0x544647['name'],_0x52507a));}exports[_0x44fb('0x1e')]=function(_0x5cf7ec,_0x441d79,_0x4fc66d,_0x954b1d){if(_0x441d79[_0x44fb('0x1f')]){writeLog(_0x5cf7ec,_0x441d79,_0x44fb('0x20'));return![];}if(!_0x441d79['online']){writeLog(_0x5cf7ec,_0x441d79,'OFFLINE');return![];}if(_0x441d79[_0x4fc66d+_0x44fb('0x21')]){writeLog(_0x5cf7ec,_0x441d79,_0x44fb('0x22'));return![];}if(_0x954b1d&&_0x441d79[_0x44fb('0x23')](_0x4fc66d+_0x44fb('0x24'))&&_0x441d79['hasOwnProperty'](_0x4fc66d+_0x44fb('0x25'))){if(_0x441d79[_0x4fc66d+_0x44fb('0x24')]>0x0&&_0x441d79[_0x4fc66d+'CurrentCapacity']>=_0x441d79[_0x4fc66d+'Capacity']){writeLog(_0x5cf7ec,_0x441d79,_0x4fc66d[_0x44fb('0x26')]()+_0x44fb('0x27'));return![];}}return!![];};exports[_0x44fb('0x28')]=function(_0x1f5d4c,_0xb7e5e8,_0x15e748,_0x2ce72d,_0x35652e){return sendNotification(!![],_0x1f5d4c,_0xb7e5e8,_0x15e748,_0x2ce72d,_0x35652e);};exports[_0x44fb('0x29')]=function(_0x4f079d,_0x48eb7d,_0x587984,_0x51b40e,_0x4a957f){return sendNotification(![],_0x4f079d,_0x48eb7d,_0x587984,_0x51b40e,_0x4a957f);};exports[_0x44fb('0x2a')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index bbf78e2..6f3f40c 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 _0x2188=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','./utils','../../../../config/logger','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','trim'];(function(_0x3f6073,_0xb9d981){var _0x14b830=function(_0x4b7a99){while(--_0x4b7a99){_0x3f6073['push'](_0x3f6073['shift']());}};_0x14b830(++_0xb9d981);}(_0x2188,0x1d6));var _0x8218=function(_0x44b0ee,_0x20cec9){_0x44b0ee=_0x44b0ee-0x0;var _0x4b2fb4=_0x2188[_0x44b0ee];return _0x4b2fb4;};'use strict';var schema=require(_0x8218('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x8218('0x1'));var logger=require(_0x8218('0x2'))('routing');var system=schema({'command':{'type':_0x8218('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8218('0x4')]=function(_0x40b9d6,_0x555372){return function(_0x5339ce){try{var _0x447465={'command':_0x555372[0x0]};var _0x218346=system[_0x8218('0x0')](_0x447465,{'typecast':!![]});if(_0x218346[_0x8218('0x5')]){logger[_0x8218('0x6')](_0x8218('0x7'),_0x40b9d6,_[_0x8218('0x8')](_0x218346,_0x8218('0x9'))['join'](',\x20'));logger[_0x8218('0xa')](_0x8218('0xb'),_0x40b9d6);_0x5339ce[_0x8218('0xc')]();}else{var _0x509b31=this;var _0x5957ac=utils['getMustacheRender'](_0x555372[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x40b9d6,_0x5957ac);sh['exec'](_[_0x8218('0xd')](_0x5957ac),function(_0x532399,_0x5f2e5f){logger['info'](_0x8218('0xe'),_0x40b9d6,_0x532399);if(_0x532399==0x0){var _0x330d21=_0x5f2e5f[_0x8218('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x8218('0x10')](_0x555372[0x1])||_[_0x8218('0x11')](_0x555372[0x1])){logger[_0x8218('0xa')](_0x8218('0x12'),_0x40b9d6);_0x509b31[_0x8218('0x13')][_0x555372[0x1]]=_0x330d21;}else{logger[_0x8218('0xa')](_0x8218('0x14'),_0x40b9d6,_0x555372[0x1],_0x330d21);_0x509b31[_0x8218('0x13')][_0x555372[0x1]]=_0x330d21;}}_0x5339ce['next']();});}}catch(_0x1f1cf0){logger[_0x8218('0x6')]('[%s][SYSTEM]\x20%s',_0x40b9d6,_['isObject'](_0x1f1cf0)?JSON[_0x8218('0x15')](_0x1f1cf0):_0x1f1cf0);logger[_0x8218('0xa')](_0x8218('0xb'),_0x40b9d6);_0x5339ce[_0x8218('0xc')]();}};}; \ No newline at end of file +var _0x637f=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','lodash','../../../../config/logger','routing','string','length','error','[%s][SYSTEM]\x20%s','map','message'];(function(_0x3f48e0,_0x453a44){var _0x2333e1=function(_0x4b540a){while(--_0x4b540a){_0x3f48e0['push'](_0x3f48e0['shift']());}};_0x2333e1(++_0x453a44);}(_0x637f,0x1af));var _0xf637=function(_0x2d9a23,_0x481dc4){_0x2d9a23=_0x2d9a23-0x0;var _0x5198ee=_0x637f[_0x2d9a23];return _0x5198ee;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xf637('0x0'));var utils=require('./utils');var logger=require(_0xf637('0x1'))(_0xf637('0x2'));var system=schema({'command':{'type':_0xf637('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x50fdcd,_0x5ec392){return function(_0xb3c964){try{var _0x16c62c={'command':_0x5ec392[0x0]};var _0x5dfd64=system['validate'](_0x16c62c,{'typecast':!![]});if(_0x5dfd64[_0xf637('0x4')]){logger[_0xf637('0x5')](_0xf637('0x6'),_0x50fdcd,_[_0xf637('0x7')](_0x5dfd64,_0xf637('0x8'))['join'](',\x20'));logger[_0xf637('0x9')](_0xf637('0xa'),_0x50fdcd);_0xb3c964[_0xf637('0xb')]();}else{var _0x3f61d2=this;var _0x5b6ce8=utils['getMustacheRender'](_0x5ec392[0x0],this);logger[_0xf637('0x9')](_0xf637('0xc'),_0x50fdcd,_0x5b6ce8);sh[_0xf637('0xd')](_['trim'](_0x5b6ce8),function(_0x25c413,_0x447637){logger[_0xf637('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x50fdcd,_0x25c413);if(_0x25c413==0x0){var _0x9d5dc0=_0x447637[_0xf637('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xf637('0xf')](_0x5ec392[0x1])||_['isEmpty'](_0x5ec392[0x1])){logger[_0xf637('0x9')](_0xf637('0x10'),_0x50fdcd);_0x3f61d2[_0xf637('0x11')][_0x5ec392[0x1]]=_0x9d5dc0;}else{logger[_0xf637('0x9')](_0xf637('0x12'),_0x50fdcd,_0x5ec392[0x1],_0x9d5dc0);_0x3f61d2[_0xf637('0x11')][_0x5ec392[0x1]]=_0x9d5dc0;}}_0xb3c964['next']();});}}catch(_0x3ecc86){logger[_0xf637('0x5')]('[%s][SYSTEM]\x20%s',_0x50fdcd,_['isObject'](_0x3ecc86)?JSON[_0xf637('0x13')](_0x3ecc86):_0x3ecc86);logger[_0xf637('0x9')](_0xf637('0xa'),_0x50fdcd);_0xb3c964[_0xf637('0xb')]();}};}; \ 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 9648626..4c152f4 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 _0xc5fb=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','next','channel','Interaction','interaction','then','info','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xc5fb,0x7f));var _0xbc5f=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xc5fb[_0x3042c5];return _0x7cd140;};'use strict';var schema=require(_0xbc5f('0x0'));var _=require(_0xbc5f('0x1'));var rpc={'chatInteraction':require(_0xbc5f('0x2')),'openchannelInteraction':require(_0xbc5f('0x3')),'smsInteraction':require(_0xbc5f('0x4')),'mailInteraction':require(_0xbc5f('0x5')),'faxInteraction':require(_0xbc5f('0x6')),'whatsappInteraction':require(_0xbc5f('0x7'))};var logger=require(_0xbc5f('0x8'))(_0xbc5f('0x9'));var tag=schema({'tag':{'type':_0xbc5f('0xa'),'required':!![],'message':_0xbc5f('0xb')}});exports['consequence']=function(_0x587cd3,_0xb19aa2,_0x43608d,_0xad90b3){return function(_0x4993eb){try{var _0x294ffb={'tag':_0xb19aa2[0x0]};var _0x16be59=tag[_0xbc5f('0x0')](_0x294ffb,{'typecast':!![]});if(_0x16be59[_0xbc5f('0xc')]){logger[_0xbc5f('0xd')]('[%s][TAG]\x20%s',_0x587cd3,_[_0xbc5f('0xe')](_0x16be59,_0xbc5f('0xf'))[_0xbc5f('0x10')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x587cd3);_0x4993eb[_0xbc5f('0x11')]();}else{var _0x1c7ab9={'ids':[_0xb19aa2[0x0]]};if(rpc[_0xad90b3[_0xbc5f('0x12')]+_0xbc5f('0x13')]){rpc[_0xad90b3[_0xbc5f('0x12')]+'Interaction']['addTags'](_0xad90b3[_0xbc5f('0x14')]['id'],_0x1c7ab9)[_0xbc5f('0x15')](function(_0x3faa5e){logger[_0xbc5f('0x16')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x587cd3,_0xb19aa2[0x1],_0xad90b3['channel'],_0xad90b3[_0xbc5f('0x14')]['id']);})[_0xbc5f('0x17')](function(_0x18070e){logger[_0xbc5f('0xd')]('[%s][TAG]\x20%s',_0x587cd3,JSON['stringify'](_0x18070e));logger[_0xbc5f('0x16')](_0xbc5f('0x18'),_0x587cd3);})[_0xbc5f('0x19')](function(){_0x4993eb[_0xbc5f('0x11')]();});}}}catch(_0x4891bc){logger[_0xbc5f('0xd')]('[%s][TAG]\x20%s',_0x587cd3,_['isObject'](_0x4891bc)?JSON[_0xbc5f('0x1a')](_0x4891bc):_0x4891bc);logger[_0xbc5f('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x587cd3);_0x4993eb[_0xbc5f('0x11')]();}};}; \ No newline at end of file +var _0x8d45=['Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x28c0b2,_0x2b1e70){var _0x2e25b4=function(_0x3ac87b){while(--_0x3ac87b){_0x28c0b2['push'](_0x28c0b2['shift']());}};_0x2e25b4(++_0x2b1e70);}(_0x8d45,0x12b));var _0x58d4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8d45[_0x1facfa];return _0x9ec701;};'use strict';var schema=require(_0x58d4('0x0'));var _=require(_0x58d4('0x1'));var rpc={'chatInteraction':require(_0x58d4('0x2')),'openchannelInteraction':require(_0x58d4('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x58d4('0x4')),'whatsappInteraction':require(_0x58d4('0x5'))};var logger=require(_0x58d4('0x6'))(_0x58d4('0x7'));var tag=schema({'tag':{'type':_0x58d4('0x8'),'required':!![],'message':_0x58d4('0x9')}});exports[_0x58d4('0xa')]=function(_0x3ef4dc,_0x436f98,_0x109767,_0x127893){return function(_0x195344){try{var _0x3e4b99={'tag':_0x436f98[0x0]};var _0x8d03a7=tag[_0x58d4('0x0')](_0x3e4b99,{'typecast':!![]});if(_0x8d03a7[_0x58d4('0xb')]){logger[_0x58d4('0xc')](_0x58d4('0xd'),_0x3ef4dc,_['map'](_0x8d03a7,_0x58d4('0xe'))[_0x58d4('0xf')](',\x20'));logger[_0x58d4('0x10')](_0x58d4('0x11'),_0x3ef4dc);_0x195344[_0x58d4('0x12')]();}else{var _0x4531e6={'ids':[_0x436f98[0x0]]};if(rpc[_0x127893[_0x58d4('0x13')]+_0x58d4('0x14')]){rpc[_0x127893[_0x58d4('0x13')]+_0x58d4('0x14')][_0x58d4('0x15')](_0x127893[_0x58d4('0x16')]['id'],_0x4531e6)[_0x58d4('0x17')](function(_0x526268){logger[_0x58d4('0x10')](_0x58d4('0x18'),_0x3ef4dc,_0x436f98[0x1],_0x127893[_0x58d4('0x13')],_0x127893[_0x58d4('0x16')]['id']);})[_0x58d4('0x19')](function(_0x2b8831){logger[_0x58d4('0xc')](_0x58d4('0xd'),_0x3ef4dc,JSON['stringify'](_0x2b8831));logger[_0x58d4('0x10')](_0x58d4('0x11'),_0x3ef4dc);})[_0x58d4('0x1a')](function(){_0x195344[_0x58d4('0x12')]();});}}}catch(_0x3d6c86){logger[_0x58d4('0xc')](_0x58d4('0xd'),_0x3ef4dc,_[_0x58d4('0x1b')](_0x3d6c86)?JSON[_0x58d4('0x1c')](_0x3d6c86):_0x3d6c86);logger[_0x58d4('0x10')](_0x58d4('0x11'),_0x3ef4dc);_0x195344[_0x58d4('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 7522050..0f8a08d 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 _0x0b1c=['&serviceId=','&sessionId=','&data=','stop','error','[%s][TVOX]\x20%s','lodash','consequence','replace','\x20-\x20','push','urlOnRing','?params=','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId='];(function(_0x43d670,_0x27b90a){var _0x43417f=function(_0x39f960){while(--_0x39f960){_0x43d670['push'](_0x43d670['shift']());}};_0x43417f(++_0x27b90a);}(_0x0b1c,0xbc));var _0xc0b1=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x0b1c[_0x5c3c0b];return _0x52ecd2;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require(_0xc0b1('0x0'));var arr=[];exports[_0xc0b1('0x1')]=function(_0x44b518,_0xf48c58){return function(_0x502ad8){var _0x191528=_0xf48c58[0xa];var _0x3b1608=_0xf48c58[0xb];var _0x330c54=_0xf48c58[0xc];var _0x22437d=_0xf48c58[0xd];var _0x41950d=_0xf48c58[0xe];var _0x4eb325=_0xf48c58[0xf][_0xc0b1('0x2')](/\n/g,_0xc0b1('0x3'));var _0x43b4f3=_0xf48c58[0x10][_0xc0b1('0x2')](/\n/g,'\x20');if(!arr['includes'](_0x3b1608)){arr[_0xc0b1('0x4')](_0x3b1608);var _0x44a27c=_0xf48c58[0x3];var _0x379622=_0xf48c58[0x4];var _0x4681ec=_0xf48c58[0x1];var _0x1c80ef=_0xf48c58[0x0];var _0x311666={};_0x311666['urlOnAnswer']=_0xf48c58[0x8]+'?params='+_0x330c54+'|'+_0x191528+'|'+_0x22437d+'|'+_0x3b1608+'|'+_0x41950d;_0x311666[_0xc0b1('0x5')]=_0xf48c58[0x7]+_0xc0b1('0x6')+_0x330c54+'|'+_0x191528+'|'+_0x22437d+'|'+_0x3b1608+'|'+_0x41950d+'|'+_0x4eb325+'|'+_0x43b4f3;_0x311666[_0xc0b1('0x7')]=_0xf48c58[0x9];var _0x5ff4aa={};_0x5ff4aa[_0xc0b1('0x8')]=_0xc0b1('0x9');_0x5ff4aa[_0xc0b1('0xa')]=_0xc0b1('0xb');var _0x1c3fa7=[];_0x1c3fa7[_0xc0b1('0x4')](_0xf48c58[0x2]);_0x1c3fa7[_0xc0b1('0x4')](_0xf48c58[0x5]);_0x1c3fa7['push'](_0xf48c58[0x6]);_0x5ff4aa[_0xc0b1('0xc')]=_0x1c3fa7;_0x5ff4aa['id']=0x1;var _0x2965d3=JSON[_0xc0b1('0xd')](_0x5ff4aa);var _0x1a41c8={'encoding':_0xc0b1('0xe'),'method':_0xc0b1('0xf'),'timeout':0x2710,'url':_0x44a27c,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2965d3};return rp(_0x1a41c8)['then'](function(_0x46eb5a){const _0x577054=JSON[_0xc0b1('0x10')](_0x46eb5a);if(!_0x577054['result'][_0xc0b1('0x11')]){throw new Error(_0xc0b1('0x12'));}var _0x2f2572=_0x3b1608;var _0x5a04da=_0xc0b1('0x13')+_0x4681ec+_0xc0b1('0x14')+_0x1c80ef+_0xc0b1('0x15')+_0x2f2572+_0xc0b1('0x16')+JSON[_0xc0b1('0xd')](_0x311666);var _0x7c8bcf=_0x379622+'?'+_0x5a04da;return rp(_0x7c8bcf);})['then'](function(_0x3f6559){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x44b518,_0x3f6559);_0x502ad8[_0xc0b1('0x17')]();})['catch'](function(_0x1bef7f){logger[_0xc0b1('0x18')](_0xc0b1('0x19'),_0x44b518,_['isObject'](_0x1bef7f)?JSON[_0xc0b1('0xd')](_0x1bef7f):_0x1bef7f);_0x502ad8[_0xc0b1('0x17')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x44b518);_0x502ad8['next']();}};}; \ No newline at end of file +var _0xc551=['&data=','then','stop','catch','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','login','params','stringify','utf8','POST','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId='];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc551,0x187));var _0x1c55=function(_0x2daa3b,_0x592884){_0x2daa3b=_0x2daa3b-0x0;var _0x1b74f4=_0xc551[_0x2daa3b];return _0x1b74f4;};'use strict';var rp=require(_0x1c55('0x0'));var logger=require(_0x1c55('0x1'))(_0x1c55('0x2'));var _=require('lodash');var arr=[];exports[_0x1c55('0x3')]=function(_0x43e6df,_0x2e015e){return function(_0x30a2f7){var _0x2c49a0=_0x2e015e[0xa];var _0x50ee03=_0x2e015e[0xb];var _0x4cca66=_0x2e015e[0xc];var _0x2af6f0=_0x2e015e[0xd];var _0x233f68=_0x2e015e[0xe];var _0x3ec827=_0x2e015e[0xf][_0x1c55('0x4')](/\n/g,_0x1c55('0x5'));var _0x2ab75f=_0x2e015e[0x10][_0x1c55('0x4')](/\n/g,'\x20');if(!arr[_0x1c55('0x6')](_0x50ee03)){arr[_0x1c55('0x7')](_0x50ee03);var _0x58d503=_0x2e015e[0x3];var _0x165b7c=_0x2e015e[0x4];var _0x368c75=_0x2e015e[0x1];var _0x2c8168=_0x2e015e[0x0];var _0x1124f2={};_0x1124f2[_0x1c55('0x8')]=_0x2e015e[0x8]+_0x1c55('0x9')+_0x4cca66+'|'+_0x2c49a0+'|'+_0x2af6f0+'|'+_0x50ee03+'|'+_0x233f68;_0x1124f2[_0x1c55('0xa')]=_0x2e015e[0x7]+'?params='+_0x4cca66+'|'+_0x2c49a0+'|'+_0x2af6f0+'|'+_0x50ee03+'|'+_0x233f68+'|'+_0x3ec827+'|'+_0x2ab75f;_0x1124f2[_0x1c55('0xb')]=_0x2e015e[0x9];var _0x4ab7e6={};_0x4ab7e6[_0x1c55('0xc')]='2.0';_0x4ab7e6['method']=_0x1c55('0xd');var _0x4cc139=[];_0x4cc139[_0x1c55('0x7')](_0x2e015e[0x2]);_0x4cc139[_0x1c55('0x7')](_0x2e015e[0x5]);_0x4cc139[_0x1c55('0x7')](_0x2e015e[0x6]);_0x4ab7e6[_0x1c55('0xe')]=_0x4cc139;_0x4ab7e6['id']=0x1;var _0x57185f=JSON[_0x1c55('0xf')](_0x4ab7e6);var _0x2f4d65={'encoding':_0x1c55('0x10'),'method':_0x1c55('0x11'),'timeout':0x2710,'url':_0x58d503,'headers':{'Content-Type':'application/json-rpc'},'body':_0x57185f};return rp(_0x2f4d65)['then'](function(_0x3be565){const _0x412f74=JSON[_0x1c55('0x12')](_0x3be565);if(!_0x412f74[_0x1c55('0x13')][_0x1c55('0x14')]){throw new Error(_0x1c55('0x15'));}var _0x54e33f=_0x50ee03;var _0x3e232c=_0x1c55('0x16')+_0x368c75+_0x1c55('0x17')+_0x2c8168+_0x1c55('0x18')+_0x54e33f+_0x1c55('0x19')+JSON[_0x1c55('0xf')](_0x1124f2);var _0x128e26=_0x165b7c+'?'+_0x3e232c;return rp(_0x128e26);})[_0x1c55('0x1a')](function(_0x24f384){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x43e6df,_0x24f384);_0x30a2f7[_0x1c55('0x1b')]();})[_0x1c55('0x1c')](function(_0x3a746f){logger['error'](_0x1c55('0x1d'),_0x43e6df,_['isObject'](_0x3a746f)?JSON[_0x1c55('0xf')](_0x3a746f):_0x3a746f);_0x30a2f7[_0x1c55('0x1b')]();});}else{logger['info'](_0x1c55('0x1e'),_0x43e6df);_0x30a2f7[_0x1c55('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 a5615c6..f318360 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(_0x1af586,_0x502fc0){var _0x2350c=function(_0x38dccb){while(--_0x38dccb){_0x1af586['push'](_0x1af586['shift']());}};_0x2350c(++_0x502fc0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4c261f,_0x304f58){var _0x56cf09=function(_0x2f3443){while(--_0x2f3443){_0x4c261f['push'](_0x4c261f['shift']());}};_0x56cf09(++_0x304f58);}(_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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 29fd387..201edf9 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 _0xd8b0=['join','.js','autoreply','appdata','split','mail','push','dialogflow','dialogflowv2','amazonlex','slice','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','app','consequence','priority','info','Push\x20new\x20rule','on\x20interval','execute','stringify','matchPath','emit','error','stack','agent','agents','busy','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x0d8b('0x2'));var utils=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0d8b('0x7')),'smsQueueReport':require(_0x0d8b('0x8')),'faxQueueReport':require(_0x0d8b('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x0d8b('0xa'));function getId(_0x284169,_0x58e4e2,_0x129310){return util[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x284169,_0x58e4e2||0x0,_0x129310||0x0);}function getIntervals(_0x1f4800,_0x28ff7f){var _0x1cac62=[];if(!_[_0x0d8b('0xd')](_0x28ff7f[_0x0d8b('0xe')])&&!_['isNil'](_0x1f4800[_0x28ff7f[_0x0d8b('0xe')]])&&!_['isNil'](_0x1f4800[_0x28ff7f[_0x0d8b('0xe')]][_0x0d8b('0xf')])){_0x1cac62=_[_0x0d8b('0x10')](_0x1f4800[_0x28ff7f[_0x0d8b('0xe')]][_0x0d8b('0xf')],_0x0d8b('0x11'));}else if(!_[_0x0d8b('0xd')](_0x28ff7f[_0x0d8b('0x11')])){_0x1cac62=[_0x28ff7f[_0x0d8b('0x11')]];}return _0x1cac62;}exports[_0x0d8b('0x12')]=function(_0x5ad086){_0x5ad086[_0x0d8b('0x13')]={};return new BPromise(function(_0x1567ce,_0x2d4e1c){var _0x4f6f21={'Start':function(_0x23eb7b){var _0xa86349=this;return new Promise(function(_0x17f7df,_0xe2e167){if(_0x23eb7b){try{var _0x2cb03c=[];var _0x5cd485=getId(_0x23eb7b[_0x0d8b('0x14')],_0x23eb7b[_0x0d8b('0x15')]?_0x23eb7b[_0x0d8b('0x15')]['id']:0x0,_0x23eb7b[_0x0d8b('0x16')]?_0x23eb7b[_0x0d8b('0x16')]['id']:0x0);if(_0x23eb7b[_0x0d8b('0x17')]&&_[_0x0d8b('0x18')](_0x23eb7b[_0x0d8b('0x17')])&&_0x23eb7b['applications'][_0x0d8b('0x19')]){for(var _0x23d58f=0x0;_0x23d58f<_0x23eb7b[_0x0d8b('0x17')][_0x0d8b('0x19')];_0x23d58f+=0x1){var _0x24e8ed=_0x23eb7b[_0x0d8b('0x17')][_0x23d58f];if(fs[_0x0d8b('0x1a')](path[_0x0d8b('0x1b')](__dirname,'applications',_0x24e8ed['app']+_0x0d8b('0x1c')))){var _0x54a9a7=[];switch(_0x24e8ed['app']['toLowerCase']()){case _0x0d8b('0x1d'):var _0x2b924f=_0x24e8ed[_0x0d8b('0x1e')][_0x0d8b('0x1f')](',');if(_0x23eb7b[_0x0d8b('0x14')]===_0x0d8b('0x20')){_0x54a9a7[_0x0d8b('0x21')](_0x2b924f[0x0]);_0x54a9a7[_0x0d8b('0x21')](_0x2b924f[0x1]);_0x54a9a7[_0x0d8b('0x21')](_0x2b924f['slice'](0x2,_0x2b924f[_0x0d8b('0x19')])[_0x0d8b('0x1b')](','));}else{_0x54a9a7['push'](_0x2b924f[0x0]);_0x54a9a7[_0x0d8b('0x21')](_0x2b924f['slice'](0x1,_0x2b924f[_0x0d8b('0x19')])[_0x0d8b('0x1b')](','));}break;case _0x0d8b('0x22'):var _0x4fe6f9=_0x24e8ed['appdata'][_0x0d8b('0x1f')](',');_0x54a9a7[_0x0d8b('0x21')](_0x4fe6f9[0x0]);_0x54a9a7['push'](_0x4fe6f9[0x1]);_0x54a9a7[_0x0d8b('0x21')](_0x4fe6f9['slice'](0x2,_0x4fe6f9[_0x0d8b('0x19')])['join'](','));break;case _0x0d8b('0x23'):var _0x48f24f=_0x24e8ed[_0x0d8b('0x1e')]['split'](',');_0x54a9a7[_0x0d8b('0x21')](_0x48f24f[0x0]);_0x54a9a7['push'](_0x48f24f[0x1]);_0x54a9a7[_0x0d8b('0x21')](_0x48f24f[0x2]);_0x54a9a7[_0x0d8b('0x21')](_0x48f24f[0x3]);_0x54a9a7[_0x0d8b('0x21')](_0x48f24f['slice'](0x4,_0x48f24f['length'])['join'](','));break;case _0x0d8b('0x24'):var _0x5515d2=_0x24e8ed[_0x0d8b('0x1e')]['split'](',');_0x54a9a7['push'](_0x5515d2[0x0]);_0x54a9a7[_0x0d8b('0x21')](_0x5515d2[0x1]);_0x54a9a7[_0x0d8b('0x21')](_0x5515d2[0x2]);_0x54a9a7[_0x0d8b('0x21')](_0x5515d2[0x3]);_0x54a9a7[_0x0d8b('0x21')](_0x5515d2[_0x0d8b('0x25')](0x4,_0x5515d2[_0x0d8b('0x19')])[_0x0d8b('0x1b')](','));break;case _0x0d8b('0x15'):_0x54a9a7['push'](_0x24e8ed[_0x0d8b('0x1e')]);break;case _0x0d8b('0x26'):_0x54a9a7['push'](_0x24e8ed[_0x0d8b('0x27')]);_0x54a9a7[_0x0d8b('0x21')](_0x24e8ed[_0x0d8b('0x1e')]);break;case'tvox':var _0x113318=utils[_0x0d8b('0x28')](_0x23eb7b[_0x0d8b('0x29')][_0x0d8b('0x2a')],_0x23eb7b);var _0x933e01=_0x24e8ed['appdata'][_0x0d8b('0x1f')](',');_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x0]);_0x54a9a7['push'](_0x933e01[0x1]);_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x2]);_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x3]);_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x4]);_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x5]);_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x6]);_0x54a9a7['push'](_0x933e01[0x7]);_0x54a9a7['push'](_0x933e01[0x8]);_0x54a9a7[_0x0d8b('0x21')](_0x933e01[0x9]);_0x54a9a7['push'](_0x933e01[0xa]);_0x54a9a7['push'](_0x23eb7b[_0x0d8b('0x16')]['id']);_0x54a9a7[_0x0d8b('0x21')](_0x23eb7b[_0x0d8b('0x15')]['id']);_0x54a9a7[_0x0d8b('0x21')](_0x24e8ed[_0x0d8b('0x2b')]);_0x54a9a7[_0x0d8b('0x21')](_0x23eb7b['interaction'][_0x0d8b('0x2c')]);_0x54a9a7[_0x0d8b('0x21')](_0x23eb7b[_0x0d8b('0x2d')][_0x0d8b('0x2d')]);_0x54a9a7[_0x0d8b('0x21')](_0x113318);break;default:_0x54a9a7=_[_0x0d8b('0xd')](_0x24e8ed[_0x0d8b('0x1e')])?[]:_0x24e8ed['appdata'][_0x0d8b('0x1f')](',');}var _0x34acb5={'id':util[_0x0d8b('0xb')](_0x0d8b('0x2e'),_0x5cd485,_0x24e8ed['id'],_0x24e8ed['app']),'condition':require(_0x0d8b('0x2f'))['condition'](_0x5cd485,getIntervals(_0x5ad086[_0x0d8b('0x30')],_0x24e8ed),_0x5ad086),'consequence':require(_0x0d8b('0x31')+_0x24e8ed[_0x0d8b('0x32')])[_0x0d8b('0x33')](_0x5cd485,_0x54a9a7,_0x5ad086,_0x23eb7b),'p':_0x24e8ed[_0x0d8b('0x34')]||0x0};logger[_0x0d8b('0x35')](_0x0d8b('0x36'),_0x34acb5['id'],_0x0d8b('0x37'),getIntervals(_0x5ad086[_0x0d8b('0x30')],_0x24e8ed)[_0x0d8b('0x1b')]('\x20|\x20'));_0x2cb03c['push'](_0x34acb5);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x0d8b('0x17'),_0x24e8ed[_0x0d8b('0x32')]+_0x0d8b('0x1c')));}}_0x5ad086['rules'][_0x5cd485]=new RuleEngine(_0x2cb03c);_0x5ad086['rules'][_0x5cd485][_0x0d8b('0x38')](_0x23eb7b,function(_0x192de1){logger[_0x0d8b('0x35')]('Applications\x20executed',JSON[_0x0d8b('0x39')](_0x192de1[_0x0d8b('0x3a')]));if(_0x5ad086['rules'][_0x5cd485]){_0x5ad086['rules'][_0x5cd485][_0x0d8b('0x3b')]('complete');}});return _0x17f7df({'code':0xc8,'message':_0x23eb7b});}else{logger[_0x0d8b('0x35')]('No\x20applications\x20to\x20execute');return _0x17f7df({'code':0xc8,'message':_0x23eb7b});}}catch(_0x53f643){logger[_0x0d8b('0x3c')](_0x53f643[_0x0d8b('0x3d')]);return _0xe2e167(_0xa86349['error'](0x1f4,_0x53f643));}}return _0xe2e167('routing\x20is\x20empty');});},'AcceptMessage':function(_0x59b8e9){var _0x579a67=this;return new Promise(function(_0x374d40,_0x1e0498){if(_0x59b8e9[_0x0d8b('0x3e')]&&_0x59b8e9['agent']['id']){if(_0x5ad086[_0x0d8b('0x3f')][_0x59b8e9[_0x0d8b('0x3e')]['id']]){_0x5ad086[_0x0d8b('0x3f')][_0x59b8e9[_0x0d8b('0x3e')]['id']][_0x0d8b('0x40')]=![];_0x5ad086[_0x0d8b('0x3f')][_0x59b8e9[_0x0d8b('0x3e')]['id']][_0x0d8b('0x41')]=undefined;}}if(_0x59b8e9[_0x0d8b('0x15')]&&_0x59b8e9[_0x0d8b('0x15')]['id']){try{var _0x44d54b=getId(_0x59b8e9[_0x0d8b('0x14')],_0x59b8e9[_0x0d8b('0x15')]?_0x59b8e9[_0x0d8b('0x15')]['id']:0x0,_0x59b8e9[_0x0d8b('0x16')]?_0x59b8e9[_0x0d8b('0x16')]['id']:0x0);if(_0x5ad086[_0x0d8b('0x13')][_0x44d54b]){_0x5ad086[_0x0d8b('0x13')][_0x44d54b][_0x0d8b('0x3b')]('end');if(rpc[_0x59b8e9[_0x0d8b('0x14')]+'QueueReport']){rpc[_0x59b8e9['channel']+_0x0d8b('0x42')][_0x0d8b('0x43')](_0x44d54b,{'UserId':_0x59b8e9[_0x0d8b('0x15')][_0x0d8b('0x44')]})['catch'](function(_0x131579){logger[_0x0d8b('0x3c')](_0x0d8b('0x45'));});}}return _0x374d40({'code':0xc8,'message':_0x59b8e9});}catch(_0x241587){logger[_0x0d8b('0x3c')](_0x241587['stack']);return _0x1e0498(_0x579a67['error'](0x1f4,_0x241587));}}logger['error']('message\x20is\x20empty');return _0x1e0498(_0x579a67[_0x0d8b('0x3c')](0x1f4,_0x0d8b('0x46')));});},'RejectMessage':function(_0x5e3bb4){var _0x4950a8=this;return new Promise(function(_0x44c5c1,_0x3d3cb6){if(_0x5e3bb4['agent']&&_0x5e3bb4['agent']['id']){try{if(_0x5ad086[_0x0d8b('0x3f')][_0x5e3bb4[_0x0d8b('0x3e')]['id']]){_0x5ad086[_0x0d8b('0x3f')][_0x5e3bb4[_0x0d8b('0x3e')]['id']][_0x0d8b('0x40')]=![];_0x5ad086['agents'][_0x5e3bb4[_0x0d8b('0x3e')]['id']][_0x0d8b('0x41')]=undefined;}return _0x44c5c1({'code':0xc8,'message':_0x5e3bb4});}catch(_0x5481fc){logger['error'](_0x5481fc[_0x0d8b('0x3d')]);return _0x3d3cb6(_0x4950a8[_0x0d8b('0x3c')](0x1f4,_0x5481fc));}}logger['error']('message\x20is\x20empty');return _0x3d3cb6(_0x4950a8[_0x0d8b('0x3c')](0x1f4,_0x0d8b('0x46')));});},'AbandonInteraction':function(_0x377027){var _0xb58818=this;return new Promise(function(_0x4a2989,_0x356b3d){if(_0x377027['channel']&&_0x377027['interaction']&&_0x377027[_0x0d8b('0x16')]['id']){try{var _0x44043b=getId(_0x377027['channel'],_0x377027['message']?_0x377027[_0x0d8b('0x15')]['id']:0x0,_0x377027[_0x0d8b('0x16')]?_0x377027[_0x0d8b('0x16')]['id']:0x0);if(_0x5ad086[_0x0d8b('0x13')][_0x44043b]){_0x5ad086[_0x0d8b('0x13')][_0x44043b][_0x0d8b('0x3b')](_0x0d8b('0x47'));}return _0x4a2989({'code':0xc8,'message':_0x377027});}catch(_0x3bead7){logger['error'](_0x3bead7[_0x0d8b('0x3d')]);return _0x356b3d(_0xb58818[_0x0d8b('0x3c')](0x1f4,_0x3bead7));}}logger[_0x0d8b('0x3c')](_0x0d8b('0x46'));return _0x356b3d(_0xb58818[_0x0d8b('0x3c')](0x1f4,_0x0d8b('0x46')));});},'AgentCapacity':function(_0x70c8c4){var _0x1c78b6=this;return new Promise(function(_0x375684,_0x4bfdf1){if(_0x5ad086[_0x0d8b('0x3f')][_0x0d8b('0x48')](_0x70c8c4['id'])){for(var _0x180b7b in _0x70c8c4[_0x0d8b('0x49')]){if(_0x70c8c4[_0x0d8b('0x49')]['hasOwnProperty'](_0x180b7b)){if(_0x5ad086[_0x0d8b('0x3f')][_0x70c8c4['id']][_0x0d8b('0x48')](_0x180b7b+_0x0d8b('0x4a'))){_0x5ad086[_0x0d8b('0x3f')][_0x70c8c4['id']][_0x180b7b+_0x0d8b('0x4a')]=parseInt(_0x70c8c4['capacity'][_0x180b7b],0xa);}}}_0x5ad086['agents'][_0x70c8c4['id']][_0x0d8b('0x4b')]();return _0x375684({'code':0xc8,'message':_0x5ad086[_0x0d8b('0x3f')][_0x70c8c4['id']]});}else{return _0x4bfdf1(_0x1c78b6[_0x0d8b('0x3c')](0x1f4,_0x0d8b('0x4c')));}});},'Agents':function(_0x5a70bd){return new Promise(function(_0x199122,_0x12aef7){var _0x8c0bbe=_['values'](_0x5ad086[_0x0d8b('0x3f')]);_0x199122({'count':_0x8c0bbe['length'],'rows':_0x8c0bbe});});},'ChatQueues':function(_0x2fce07){return new Promise(function(_0x3ed63e,_0x1efce6){var _0x26ccf0=[];for(var _0x2b6eb6 in _0x5ad086[_0x0d8b('0x4d')]){if(_0x5ad086['chatQueues'][_0x0d8b('0x48')](_0x2b6eb6)){var _0x4c074d=_0x5ad086[_0x0d8b('0x4d')][_0x2b6eb6];var _0x4577c8={'id':_0x4c074d['id'],'available':_0x4c074d[_0x0d8b('0x4e')],'loggedIn':_0x4c074d[_0x0d8b('0x4f')],'name':_0x4c074d['name'],'paused':_0x4c074d[_0x0d8b('0x50')],'waiting':_0x4c074d[_0x0d8b('0x51')]};_0x26ccf0[_0x0d8b('0x21')](_0x4577c8);}}_0x3ed63e({'count':_0x26ccf0[_0x0d8b('0x19')],'rows':_0x26ccf0});});},'MailQueues':function(_0x2ccdae){return new Promise(function(_0x273aef,_0x223fd8){var _0x2eb406=[];for(var _0x2ce282 in _0x5ad086[_0x0d8b('0x52')]){if(_0x5ad086['mailQueues']['hasOwnProperty'](_0x2ce282)){var _0x6388ae=_0x5ad086[_0x0d8b('0x52')][_0x2ce282];var _0x53e399={'id':_0x6388ae['id'],'available':_0x6388ae[_0x0d8b('0x4e')],'loggedIn':_0x6388ae['loggedIn'],'name':_0x6388ae['name'],'paused':_0x6388ae[_0x0d8b('0x50')],'waiting':_0x6388ae[_0x0d8b('0x51')]};_0x2eb406['push'](_0x53e399);}}_0x273aef({'count':_0x2eb406['length'],'rows':_0x2eb406});});},'OpenchannelQueues':function(_0x1900e3){return new Promise(function(_0x1c007b,_0x70e4b2){var _0x435090=[];for(var _0x2ab72b in _0x5ad086[_0x0d8b('0x53')]){if(_0x5ad086[_0x0d8b('0x53')]['hasOwnProperty'](_0x2ab72b)){var _0x1ca60c=_0x5ad086['openchannelQueues'][_0x2ab72b];var _0x1a203e={'id':_0x1ca60c['id'],'available':_0x1ca60c[_0x0d8b('0x4e')],'loggedIn':_0x1ca60c[_0x0d8b('0x4f')],'name':_0x1ca60c[_0x0d8b('0x54')],'paused':_0x1ca60c['paused'],'waiting':_0x1ca60c[_0x0d8b('0x51')]};_0x435090['push'](_0x1a203e);}}_0x1c007b({'count':_0x435090[_0x0d8b('0x19')],'rows':_0x435090});});},'SmsQueues':function(_0x2c6c5f){return new Promise(function(_0x1c5fe2,_0x2ebea3){var _0xc5c35f=[];for(var _0x2b44e5 in _0x5ad086[_0x0d8b('0x55')]){if(_0x5ad086[_0x0d8b('0x55')][_0x0d8b('0x48')](_0x2b44e5)){var _0x44aa74=_0x5ad086['smsQueues'][_0x2b44e5];var _0x1436b3={'id':_0x44aa74['id'],'available':_0x44aa74['available'],'loggedIn':_0x44aa74[_0x0d8b('0x4f')],'name':_0x44aa74[_0x0d8b('0x54')],'paused':_0x44aa74['paused'],'waiting':_0x44aa74[_0x0d8b('0x51')]};_0xc5c35f['push'](_0x1436b3);}}_0x1c5fe2({'count':_0xc5c35f[_0x0d8b('0x19')],'rows':_0xc5c35f});});},'FaxQueues':function(_0x445a00){return new Promise(function(_0x24f75,_0x259ac9){var _0x2242cd=[];for(var _0x299f98 in _0x5ad086[_0x0d8b('0x56')]){if(_0x5ad086[_0x0d8b('0x56')]['hasOwnProperty'](_0x299f98)){var _0x10eca6=_0x5ad086[_0x0d8b('0x56')][_0x299f98];var _0x5b2916={'id':_0x10eca6['id'],'available':_0x10eca6[_0x0d8b('0x4e')],'loggedIn':_0x10eca6[_0x0d8b('0x4f')],'name':_0x10eca6[_0x0d8b('0x54')],'paused':_0x10eca6[_0x0d8b('0x50')],'waiting':_0x10eca6[_0x0d8b('0x51')]};_0x2242cd[_0x0d8b('0x21')](_0x5b2916);}}_0x24f75({'count':_0x2242cd[_0x0d8b('0x19')],'rows':_0x2242cd});});},'WhatsappQueues':function(_0x1bf696){return new Promise(function(_0x466082,_0x5007c0){var _0xe35028=[];for(var _0x16df83 in _0x5ad086['whatsappQueues']){if(_0x5ad086[_0x0d8b('0x57')][_0x0d8b('0x48')](_0x16df83)){var _0x3acffa=_0x5ad086['whatsappQueues'][_0x16df83];var _0x5db3b4={'id':_0x3acffa['id'],'available':_0x3acffa[_0x0d8b('0x4e')],'loggedIn':_0x3acffa[_0x0d8b('0x4f')],'name':_0x3acffa[_0x0d8b('0x54')],'paused':_0x3acffa['paused'],'waiting':_0x3acffa['waiting']};_0xe35028[_0x0d8b('0x21')](_0x5db3b4);}}_0x466082({'count':_0xe35028[_0x0d8b('0x19')],'rows':_0xe35028});});},'ChatQueuesWaitingInteractions':function(_0x305b87){return new Promise(function(_0x2d0b4f,_0x2a2b58){var _0x3f7895=_[_0x0d8b('0x58')](_0x5ad086[_0x0d8b('0x59')]);_0x2d0b4f({'count':_0x3f7895[_0x0d8b('0x19')],'rows':_0x3f7895});});},'MailQueuesWaitingInteractions':function(_0x3a5aea){return new Promise(function(_0x195901,_0x291336){var _0x3b060e=_['values'](_0x5ad086[_0x0d8b('0x5a')]);_0x195901({'count':_0x3b060e[_0x0d8b('0x19')],'rows':_0x3b060e});});},'OpenchannelQueuesWaitingInteractions':function(_0x48c965){return new Promise(function(_0x51c41b,_0x1a1029){var _0x1dad9f=_[_0x0d8b('0x58')](_0x5ad086[_0x0d8b('0x5b')]);_0x51c41b({'count':_0x1dad9f[_0x0d8b('0x19')],'rows':_0x1dad9f});});},'SmsQueuesWaitingInteractions':function(_0x354208){return new Promise(function(_0x5dec44,_0x502715){var _0x581d8e=_[_0x0d8b('0x58')](_0x5ad086[_0x0d8b('0x5c')]);_0x5dec44({'count':_0x581d8e[_0x0d8b('0x19')],'rows':_0x581d8e});});},'FaxQueuesWaitingInteractions':function(_0x28f9b7){return new Promise(function(_0x3f1eee,_0x21d620){var _0x5ef461=_[_0x0d8b('0x58')](_0x5ad086[_0x0d8b('0x5d')]);_0x3f1eee({'count':_0x5ef461['length'],'rows':_0x5ef461});});},'WhatsappQueuesWaitingInteractions':function(_0x30a69d){return new Promise(function(_0x57e3c2,_0x10ce36){var _0x2db959=_[_0x0d8b('0x58')](_0x5ad086[_0x0d8b('0x5e')]);_0x57e3c2({'count':_0x2db959[_0x0d8b('0x19')],'rows':_0x2db959});});}};var _0x8fae7f=jayson[_0x0d8b('0x5f')](_0x4f6f21)[_0x0d8b('0x60')]();_0x8fae7f['on'](_0x0d8b('0x3c'),function(_0x20b36c){logger[_0x0d8b('0x3c')](JSON[_0x0d8b('0x39')](_0x20b36c));return _0x2d4e1c(_0x20b36c);});_0x8fae7f['listen'](0x232c,'127.0.0.1',function(){console[_0x0d8b('0x61')](_0x0d8b('0x62'),0x232c);return _0x1567ce(_0x0d8b('0x63')+0x232c);});});}; \ No newline at end of file +var _0xc36d=['values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','app','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found'];(function(_0x1ccee3,_0x462810){var _0xd975d8=function(_0xb1f306){while(--_0xb1f306){_0x1ccee3['push'](_0x1ccee3['shift']());}};_0xd975d8(++_0x462810);}(_0xc36d,0x7d));var _0xdc36=function(_0x5df59f,_0xf11a72){_0x5df59f=_0x5df59f-0x0;var _0x190e3b=_0xc36d[_0x5df59f];return _0x190e3b;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var path=require(_0xdc36('0x2'));var fs=require('fs');var jayson=require(_0xdc36('0x3'));var BPromise=require(_0xdc36('0x4'));var uuid=require(_0xdc36('0x5'));var utils=require('./applications/utils');var config=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xdc36('0x8')),'mailQueueReport':require(_0xdc36('0x9')),'chatQueueReport':require(_0xdc36('0xa')),'smsQueueReport':require(_0xdc36('0xb')),'faxQueueReport':require(_0xdc36('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xdc36('0xd'));function getId(_0x456897,_0x2a0087,_0xdca7f7){return util['format'](_0xdc36('0xe'),_0x456897,_0x2a0087||0x0,_0xdca7f7||0x0);}function getIntervals(_0x23956b,_0x573f8e){var _0x1d0035=[];if(!_[_0xdc36('0xf')](_0x573f8e[_0xdc36('0x10')])&&!_['isNil'](_0x23956b[_0x573f8e[_0xdc36('0x10')]])&&!_[_0xdc36('0xf')](_0x23956b[_0x573f8e['IntervalId']]['Intervals'])){_0x1d0035=_[_0xdc36('0x11')](_0x23956b[_0x573f8e[_0xdc36('0x10')]][_0xdc36('0x12')],_0xdc36('0x13'));}else if(!_['isNil'](_0x573f8e[_0xdc36('0x13')])){_0x1d0035=[_0x573f8e[_0xdc36('0x13')]];}return _0x1d0035;}exports[_0xdc36('0x14')]=function(_0xae6ad3){_0xae6ad3[_0xdc36('0x15')]={};return new BPromise(function(_0x25b900,_0x37ce9c){var _0x809cf0={'Start':function(_0x57ebde){var _0x155cce=this;return new Promise(function(_0x526ac8,_0x4baf2e){if(_0x57ebde){try{var _0x59c88f=[];var _0x64f61e=getId(_0x57ebde[_0xdc36('0x16')],_0x57ebde['message']?_0x57ebde[_0xdc36('0x17')]['id']:0x0,_0x57ebde[_0xdc36('0x18')]?_0x57ebde[_0xdc36('0x18')]['id']:0x0);if(_0x57ebde[_0xdc36('0x19')]&&_[_0xdc36('0x1a')](_0x57ebde[_0xdc36('0x19')])&&_0x57ebde['applications'][_0xdc36('0x1b')]){for(var _0x12d4bf=0x0;_0x12d4bf<_0x57ebde['applications'][_0xdc36('0x1b')];_0x12d4bf+=0x1){var _0x197924=_0x57ebde[_0xdc36('0x19')][_0x12d4bf];if(fs['existsSync'](path[_0xdc36('0x1c')](__dirname,_0xdc36('0x19'),_0x197924['app']+_0xdc36('0x1d')))){var _0x480277=[];switch(_0x197924['app'][_0xdc36('0x1e')]()){case _0xdc36('0x1f'):var _0x42c0d7=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');if(_0x57ebde[_0xdc36('0x16')]===_0xdc36('0x22')){_0x480277[_0xdc36('0x23')](_0x42c0d7[0x0]);_0x480277['push'](_0x42c0d7[0x1]);_0x480277[_0xdc36('0x23')](_0x42c0d7['slice'](0x2,_0x42c0d7[_0xdc36('0x1b')])[_0xdc36('0x1c')](','));}else{_0x480277[_0xdc36('0x23')](_0x42c0d7[0x0]);_0x480277['push'](_0x42c0d7[_0xdc36('0x24')](0x1,_0x42c0d7[_0xdc36('0x1b')])[_0xdc36('0x1c')](','));}break;case'dialogflow':var _0x28a005=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');_0x480277['push'](_0x28a005[0x0]);_0x480277[_0xdc36('0x23')](_0x28a005[0x1]);_0x480277[_0xdc36('0x23')](_0x28a005['slice'](0x2,_0x28a005[_0xdc36('0x1b')])[_0xdc36('0x1c')](','));break;case'dialogflowv2':var _0x21151b=_0x197924['appdata']['split'](',');_0x480277['push'](_0x21151b[0x0]);_0x480277[_0xdc36('0x23')](_0x21151b[0x1]);_0x480277[_0xdc36('0x23')](_0x21151b[0x2]);_0x480277['push'](_0x21151b[0x3]);_0x480277[_0xdc36('0x23')](_0x21151b[_0xdc36('0x24')](0x4,_0x21151b[_0xdc36('0x1b')])['join'](','));break;case _0xdc36('0x25'):var _0xcfff77=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');_0x480277[_0xdc36('0x23')](_0xcfff77[0x0]);_0x480277[_0xdc36('0x23')](_0xcfff77[0x1]);_0x480277[_0xdc36('0x23')](_0xcfff77[0x2]);_0x480277['push'](_0xcfff77[0x3]);_0x480277[_0xdc36('0x23')](_0xcfff77[_0xdc36('0x24')](0x4,_0xcfff77['length'])['join'](','));break;case _0xdc36('0x17'):_0x480277[_0xdc36('0x23')](_0x197924[_0xdc36('0x20')]);break;case'tag':_0x480277['push'](_0x197924[_0xdc36('0x26')]);_0x480277[_0xdc36('0x23')](_0x197924[_0xdc36('0x20')]);break;case _0xdc36('0x27'):var _0x302d69=utils[_0xdc36('0x28')](_0x57ebde[_0xdc36('0x29')][_0xdc36('0x2a')],_0x57ebde);var _0x734ad6=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');_0x480277['push'](_0x734ad6[0x0]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x1]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x2]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x3]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x4]);_0x480277['push'](_0x734ad6[0x5]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x6]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x7]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x8]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x9]);_0x480277['push'](_0x734ad6[0xa]);_0x480277[_0xdc36('0x23')](_0x57ebde['interaction']['id']);_0x480277['push'](_0x57ebde[_0xdc36('0x17')]['id']);_0x480277[_0xdc36('0x23')](_0x197924[_0xdc36('0x2b')]);_0x480277['push'](_0x57ebde[_0xdc36('0x18')]['ContactId']);_0x480277[_0xdc36('0x23')](_0x57ebde[_0xdc36('0x2c')][_0xdc36('0x2c')]);_0x480277['push'](_0x302d69);break;default:_0x480277=_[_0xdc36('0xf')](_0x197924[_0xdc36('0x20')])?[]:_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');}var _0x50cf7b={'id':util[_0xdc36('0x2d')](_0xdc36('0x2e'),_0x64f61e,_0x197924['id'],_0x197924[_0xdc36('0x2f')]),'condition':require('./interval')['condition'](_0x64f61e,getIntervals(_0xae6ad3[_0xdc36('0x30')],_0x197924),_0xae6ad3),'consequence':require(_0xdc36('0x31')+_0x197924['app'])['consequence'](_0x64f61e,_0x480277,_0xae6ad3,_0x57ebde),'p':_0x197924[_0xdc36('0x32')]||0x0};logger[_0xdc36('0x33')](_0xdc36('0x34'),_0x50cf7b['id'],_0xdc36('0x35'),getIntervals(_0xae6ad3[_0xdc36('0x30')],_0x197924)[_0xdc36('0x1c')](_0xdc36('0x36')));_0x59c88f[_0xdc36('0x23')](_0x50cf7b);}else{logger[_0xdc36('0x37')](_0xdc36('0x38'),path[_0xdc36('0x1c')](__dirname,_0xdc36('0x19'),_0x197924[_0xdc36('0x2f')]+_0xdc36('0x1d')));}}_0xae6ad3[_0xdc36('0x15')][_0x64f61e]=new RuleEngine(_0x59c88f);_0xae6ad3[_0xdc36('0x15')][_0x64f61e][_0xdc36('0x39')](_0x57ebde,function(_0x16dcb7){logger[_0xdc36('0x33')](_0xdc36('0x3a'),JSON[_0xdc36('0x3b')](_0x16dcb7[_0xdc36('0x3c')]));if(_0xae6ad3[_0xdc36('0x15')][_0x64f61e]){_0xae6ad3[_0xdc36('0x15')][_0x64f61e][_0xdc36('0x3d')](_0xdc36('0x3e'));}});return _0x526ac8({'code':0xc8,'message':_0x57ebde});}else{logger['info'](_0xdc36('0x3f'));return _0x526ac8({'code':0xc8,'message':_0x57ebde});}}catch(_0x46983e){logger['error'](_0x46983e['stack']);return _0x4baf2e(_0x155cce[_0xdc36('0x37')](0x1f4,_0x46983e));}}return _0x4baf2e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x177d9f){var _0x51a276=this;return new Promise(function(_0x19c7fe,_0x286de7){if(_0x177d9f[_0xdc36('0x40')]&&_0x177d9f[_0xdc36('0x40')]['id']){if(_0xae6ad3[_0xdc36('0x41')][_0x177d9f[_0xdc36('0x40')]['id']]){_0xae6ad3[_0xdc36('0x41')][_0x177d9f[_0xdc36('0x40')]['id']][_0xdc36('0x42')]=![];_0xae6ad3[_0xdc36('0x41')][_0x177d9f[_0xdc36('0x40')]['id']][_0xdc36('0x43')]=undefined;}}if(_0x177d9f[_0xdc36('0x17')]&&_0x177d9f[_0xdc36('0x17')]['id']){try{var _0x2de4d3=getId(_0x177d9f[_0xdc36('0x16')],_0x177d9f[_0xdc36('0x17')]?_0x177d9f[_0xdc36('0x17')]['id']:0x0,_0x177d9f['interaction']?_0x177d9f['interaction']['id']:0x0);if(_0xae6ad3[_0xdc36('0x15')][_0x2de4d3]){_0xae6ad3[_0xdc36('0x15')][_0x2de4d3][_0xdc36('0x3d')](_0xdc36('0x44'));if(rpc[_0x177d9f[_0xdc36('0x16')]+_0xdc36('0x45')]){rpc[_0x177d9f['channel']+_0xdc36('0x45')][_0xdc36('0x46')](_0x2de4d3,{'UserId':_0x177d9f[_0xdc36('0x17')]['UserId']})[_0xdc36('0x47')](function(_0x53ed42){logger[_0xdc36('0x37')](_0xdc36('0x48'));});}}return _0x19c7fe({'code':0xc8,'message':_0x177d9f});}catch(_0x3bfc00){logger[_0xdc36('0x37')](_0x3bfc00['stack']);return _0x286de7(_0x51a276[_0xdc36('0x37')](0x1f4,_0x3bfc00));}}logger[_0xdc36('0x37')](_0xdc36('0x49'));return _0x286de7(_0x51a276[_0xdc36('0x37')](0x1f4,_0xdc36('0x49')));});},'RejectMessage':function(_0x2b7319){var _0x26775a=this;return new Promise(function(_0x225ffb,_0x4abeaf){if(_0x2b7319[_0xdc36('0x40')]&&_0x2b7319[_0xdc36('0x40')]['id']){try{if(_0xae6ad3[_0xdc36('0x41')][_0x2b7319[_0xdc36('0x40')]['id']]){_0xae6ad3[_0xdc36('0x41')][_0x2b7319[_0xdc36('0x40')]['id']][_0xdc36('0x42')]=![];_0xae6ad3[_0xdc36('0x41')][_0x2b7319['agent']['id']]['busyQueue']=undefined;}return _0x225ffb({'code':0xc8,'message':_0x2b7319});}catch(_0x1f49e1){logger[_0xdc36('0x37')](_0x1f49e1['stack']);return _0x4abeaf(_0x26775a[_0xdc36('0x37')](0x1f4,_0x1f49e1));}}logger[_0xdc36('0x37')]('message\x20is\x20empty');return _0x4abeaf(_0x26775a['error'](0x1f4,_0xdc36('0x49')));});},'AbandonInteraction':function(_0x5cf2ee){var _0x4277b4=this;return new Promise(function(_0x5eb1e5,_0x27431c){if(_0x5cf2ee['channel']&&_0x5cf2ee['interaction']&&_0x5cf2ee[_0xdc36('0x18')]['id']){try{var _0x5d139f=getId(_0x5cf2ee[_0xdc36('0x16')],_0x5cf2ee[_0xdc36('0x17')]?_0x5cf2ee[_0xdc36('0x17')]['id']:0x0,_0x5cf2ee[_0xdc36('0x18')]?_0x5cf2ee[_0xdc36('0x18')]['id']:0x0);if(_0xae6ad3['rules'][_0x5d139f]){_0xae6ad3[_0xdc36('0x15')][_0x5d139f][_0xdc36('0x3d')](_0xdc36('0x44'));}return _0x5eb1e5({'code':0xc8,'message':_0x5cf2ee});}catch(_0x4e62c2){logger['error'](_0x4e62c2[_0xdc36('0x4a')]);return _0x27431c(_0x4277b4['error'](0x1f4,_0x4e62c2));}}logger[_0xdc36('0x37')](_0xdc36('0x49'));return _0x27431c(_0x4277b4[_0xdc36('0x37')](0x1f4,_0xdc36('0x49')));});},'AgentCapacity':function(_0x5dc59f){var _0x50e415=this;return new Promise(function(_0x116f5f,_0x1d4707){if(_0xae6ad3[_0xdc36('0x41')][_0xdc36('0x4b')](_0x5dc59f['id'])){for(var _0x22393e in _0x5dc59f[_0xdc36('0x4c')]){if(_0x5dc59f[_0xdc36('0x4c')][_0xdc36('0x4b')](_0x22393e)){if(_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']][_0xdc36('0x4b')](_0x22393e+'CurrentCapacity')){_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']][_0x22393e+'CurrentCapacity']=parseInt(_0x5dc59f[_0xdc36('0x4c')][_0x22393e],0xa);}}}_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']][_0xdc36('0x4d')]();return _0x116f5f({'code':0xc8,'message':_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']]});}else{return _0x1d4707(_0x50e415[_0xdc36('0x37')](0x1f4,_0xdc36('0x4e')));}});},'Agents':function(_0x312de6){return new Promise(function(_0x1dc0c9,_0x355530){var _0x186a71=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x41')]);_0x1dc0c9({'count':_0x186a71[_0xdc36('0x1b')],'rows':_0x186a71});});},'ChatQueues':function(_0x309aec){return new Promise(function(_0xde073b,_0x2986ce){var _0x43e23e=[];for(var _0x1994c6 in _0xae6ad3[_0xdc36('0x50')]){if(_0xae6ad3[_0xdc36('0x50')]['hasOwnProperty'](_0x1994c6)){var _0x327c04=_0xae6ad3[_0xdc36('0x50')][_0x1994c6];var _0x437a86={'id':_0x327c04['id'],'available':_0x327c04[_0xdc36('0x51')],'loggedIn':_0x327c04[_0xdc36('0x52')],'name':_0x327c04[_0xdc36('0x53')],'paused':_0x327c04['paused'],'waiting':_0x327c04[_0xdc36('0x54')]};_0x43e23e[_0xdc36('0x23')](_0x437a86);}}_0xde073b({'count':_0x43e23e['length'],'rows':_0x43e23e});});},'MailQueues':function(_0x548a99){return new Promise(function(_0x267d62,_0x271004){var _0x9e867d=[];for(var _0x4869e1 in _0xae6ad3['mailQueues']){if(_0xae6ad3[_0xdc36('0x55')][_0xdc36('0x4b')](_0x4869e1)){var _0x50a8ea=_0xae6ad3['mailQueues'][_0x4869e1];var _0x3bbf88={'id':_0x50a8ea['id'],'available':_0x50a8ea[_0xdc36('0x51')],'loggedIn':_0x50a8ea[_0xdc36('0x52')],'name':_0x50a8ea[_0xdc36('0x53')],'paused':_0x50a8ea[_0xdc36('0x56')],'waiting':_0x50a8ea[_0xdc36('0x54')]};_0x9e867d[_0xdc36('0x23')](_0x3bbf88);}}_0x267d62({'count':_0x9e867d[_0xdc36('0x1b')],'rows':_0x9e867d});});},'OpenchannelQueues':function(_0x4ecc0c){return new Promise(function(_0x2b5e55,_0x5ef6db){var _0x4b353d=[];for(var _0x5a3c01 in _0xae6ad3[_0xdc36('0x57')]){if(_0xae6ad3[_0xdc36('0x57')][_0xdc36('0x4b')](_0x5a3c01)){var _0x1983cd=_0xae6ad3['openchannelQueues'][_0x5a3c01];var _0x1592d0={'id':_0x1983cd['id'],'available':_0x1983cd[_0xdc36('0x51')],'loggedIn':_0x1983cd[_0xdc36('0x52')],'name':_0x1983cd[_0xdc36('0x53')],'paused':_0x1983cd[_0xdc36('0x56')],'waiting':_0x1983cd['waiting']};_0x4b353d['push'](_0x1592d0);}}_0x2b5e55({'count':_0x4b353d['length'],'rows':_0x4b353d});});},'SmsQueues':function(_0x51148b){return new Promise(function(_0x277d13,_0x398272){var _0x3e23e8=[];for(var _0xdc692d in _0xae6ad3[_0xdc36('0x58')]){if(_0xae6ad3[_0xdc36('0x58')][_0xdc36('0x4b')](_0xdc692d)){var _0x31b748=_0xae6ad3[_0xdc36('0x58')][_0xdc692d];var _0x556614={'id':_0x31b748['id'],'available':_0x31b748[_0xdc36('0x51')],'loggedIn':_0x31b748[_0xdc36('0x52')],'name':_0x31b748['name'],'paused':_0x31b748['paused'],'waiting':_0x31b748[_0xdc36('0x54')]};_0x3e23e8['push'](_0x556614);}}_0x277d13({'count':_0x3e23e8[_0xdc36('0x1b')],'rows':_0x3e23e8});});},'FaxQueues':function(_0x583ff0){return new Promise(function(_0x1f855e,_0x3667a2){var _0x26dd8e=[];for(var _0x56931b in _0xae6ad3['faxQueues']){if(_0xae6ad3['faxQueues'][_0xdc36('0x4b')](_0x56931b)){var _0xd8f671=_0xae6ad3[_0xdc36('0x59')][_0x56931b];var _0x3a699d={'id':_0xd8f671['id'],'available':_0xd8f671[_0xdc36('0x51')],'loggedIn':_0xd8f671['loggedIn'],'name':_0xd8f671[_0xdc36('0x53')],'paused':_0xd8f671[_0xdc36('0x56')],'waiting':_0xd8f671[_0xdc36('0x54')]};_0x26dd8e['push'](_0x3a699d);}}_0x1f855e({'count':_0x26dd8e['length'],'rows':_0x26dd8e});});},'WhatsappQueues':function(_0x179dd9){return new Promise(function(_0x705e1e,_0x40bc5b){var _0x3103e5=[];for(var _0x767d7e in _0xae6ad3[_0xdc36('0x5a')]){if(_0xae6ad3[_0xdc36('0x5a')][_0xdc36('0x4b')](_0x767d7e)){var _0x428ea1=_0xae6ad3[_0xdc36('0x5a')][_0x767d7e];var _0x53a7c3={'id':_0x428ea1['id'],'available':_0x428ea1['available'],'loggedIn':_0x428ea1['loggedIn'],'name':_0x428ea1['name'],'paused':_0x428ea1[_0xdc36('0x56')],'waiting':_0x428ea1[_0xdc36('0x54')]};_0x3103e5[_0xdc36('0x23')](_0x53a7c3);}}_0x705e1e({'count':_0x3103e5['length'],'rows':_0x3103e5});});},'ChatQueuesWaitingInteractions':function(_0x99f4d1){return new Promise(function(_0xd674b9,_0x26b38e){var _0x192316=_['values'](_0xae6ad3[_0xdc36('0x5b')]);_0xd674b9({'count':_0x192316[_0xdc36('0x1b')],'rows':_0x192316});});},'MailQueuesWaitingInteractions':function(_0x111f62){return new Promise(function(_0x209cb6,_0x81fdbf){var _0xae33f3=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x5c')]);_0x209cb6({'count':_0xae33f3[_0xdc36('0x1b')],'rows':_0xae33f3});});},'OpenchannelQueuesWaitingInteractions':function(_0x1a4619){return new Promise(function(_0x1097e0,_0x43dd88){var _0x4b244a=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x5d')]);_0x1097e0({'count':_0x4b244a[_0xdc36('0x1b')],'rows':_0x4b244a});});},'SmsQueuesWaitingInteractions':function(_0x344d55){return new Promise(function(_0xfa1cc5,_0x58cd17){var _0x391c7c=_[_0xdc36('0x4f')](_0xae6ad3['smsQueuesWaitingInteractions']);_0xfa1cc5({'count':_0x391c7c[_0xdc36('0x1b')],'rows':_0x391c7c});});},'FaxQueuesWaitingInteractions':function(_0xe3058e){return new Promise(function(_0x31ba3f,_0x4f99d1){var _0x30b797=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x5e')]);_0x31ba3f({'count':_0x30b797[_0xdc36('0x1b')],'rows':_0x30b797});});},'WhatsappQueuesWaitingInteractions':function(_0x137130){return new Promise(function(_0x2592ba,_0x365f42){var _0x202cac=_['values'](_0xae6ad3[_0xdc36('0x5f')]);_0x2592ba({'count':_0x202cac['length'],'rows':_0x202cac});});}};var _0x30d5a1=jayson[_0xdc36('0x60')](_0x809cf0)[_0xdc36('0x61')]();_0x30d5a1['on'](_0xdc36('0x37'),function(_0x25ea7d){logger[_0xdc36('0x37')](JSON[_0xdc36('0x3b')](_0x25ea7d));return _0x37ce9c(_0x25ea7d);});_0x30d5a1['listen'](0x232c,_0xdc36('0x62'),function(){console[_0xdc36('0x63')](_0xdc36('0x64'),0x232c);return _0x25b900(_0xdc36('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f8420f4..a782d0a 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 _0xfd2c=['all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd2c,0xae));var _0xcfd2=function(_0x1ea08b,_0x40d335){_0x1ea08b=_0x1ea08b-0x0;var _0x25fb8f=_0xfd2c[_0x1ea08b];return _0x25fb8f;};'use strict';var util=require(_0xcfd2('0x0'));var BPromise=require(_0xcfd2('0x1'));var jayson=require(_0xcfd2('0x2'));var _=require(_0xcfd2('0x3'));var logger=require(_0xcfd2('0x4'))(_0xcfd2('0x5'));var client=jayson[_0xcfd2('0x6')][_0xcfd2('0x7')]({'port':0x232a});function request(_0x3df518,_0x1434b2){return new BPromise(function(_0x4f256d,_0x4d7ac6){return client[_0xcfd2('0x8')](_0x3df518,_0x1434b2)[_0xcfd2('0x9')](function(_0x20e2e7){if(_0x20e2e7[_0xcfd2('0xa')]){return _0x4d7ac6(_0x20e2e7[_0xcfd2('0xa')][_0xcfd2('0xb')]);}else{return _0x4f256d(_0x20e2e7[_0xcfd2('0xc')]);}})[_0xcfd2('0xd')](function(_0x298f61){return _0x4d7ac6(_0x298f61);});});}exports[_0xcfd2('0xe')]=function(_0x1efad4,_0x1abe48,_0x2ba4ec){return function(_0x520b9d){if(_0x2ba4ec['rules']&&!_0x2ba4ec[_0xcfd2('0xf')][_0x1efad4]){logger[_0xcfd2('0x10')](_0xcfd2('0x11'),_0x1efad4);return _0x520b9d['stop']();}var _0x516d6b=[];for(var _0x398433=0x0;_0x398433<_0x1abe48[_0xcfd2('0x12')];_0x398433+=0x1){_0x516d6b[_0xcfd2('0x13')](request('Command',{'command':util[_0xcfd2('0x14')](_0xcfd2('0x15'),_0x1abe48[_0x398433])})[_0xcfd2('0x9')](function(_0x562349){return _0x562349&&_0x562349[_0xcfd2('0xb')]&&_0x562349[_0xcfd2('0xb')][_0xcfd2('0x16')]('true')>=0x0?!![]:![];})['catch'](function(_0x3017ca){logger[_0xcfd2('0xa')](_0xcfd2('0x17'),_0x1efad4,_0x1abe48[_0x398433]);}));}BPromise[_0xcfd2('0x18')](_0x516d6b)[_0xcfd2('0x9')](function(_0x543509){var _0x59c9d4=_[_0xcfd2('0x19')](_0x543509);logger[_0xcfd2('0x10')](_0xcfd2('0x1a'),_0x1efad4,_0x1abe48[_0xcfd2('0x1b')](_0xcfd2('0x1c')),_0x59c9d4);_0x520b9d[_0xcfd2('0x1d')](_0x59c9d4);})['catch'](function(_0x4590b7){console[_0xcfd2('0x1e')](_0x4590b7);logger[_0xcfd2('0xa')](_0xcfd2('0x1a'),_0x1efad4,_0x1abe48[_0xcfd2('0x1b')](_0xcfd2('0x1c')),_0x4590b7[_0xcfd2('0x1f')]);_0x520b9d[_0xcfd2('0x20')]();});};}; \ No newline at end of file +var _0xb890=['format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','message','result','catch','condition','info','stop','length','push','Command'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb890,0x142));var _0x0b89=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb890[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0b89('0x0'));var BPromise=require(_0x0b89('0x1'));var jayson=require(_0x0b89('0x2'));var _=require(_0x0b89('0x3'));var logger=require(_0x0b89('0x4'))(_0x0b89('0x5'));var client=jayson[_0x0b89('0x6')][_0x0b89('0x7')]({'port':0x232a});function request(_0x2caadb,_0x59e89f){return new BPromise(function(_0x5118d5,_0xa064c4){return client[_0x0b89('0x8')](_0x2caadb,_0x59e89f)['then'](function(_0x6d100e){if(_0x6d100e['error']){return _0xa064c4(_0x6d100e[_0x0b89('0x9')][_0x0b89('0xa')]);}else{return _0x5118d5(_0x6d100e[_0x0b89('0xb')]);}})[_0x0b89('0xc')](function(_0x500a5a){return _0xa064c4(_0x500a5a);});});}exports[_0x0b89('0xd')]=function(_0x5d75ea,_0x2f390c,_0x27ba19){return function(_0x1c36d5){if(_0x27ba19['rules']&&!_0x27ba19['rules'][_0x5d75ea]){logger[_0x0b89('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5d75ea);return _0x1c36d5[_0x0b89('0xf')]();}var _0x182002=[];for(var _0x473b0d=0x0;_0x473b0d<_0x2f390c[_0x0b89('0x10')];_0x473b0d+=0x1){_0x182002[_0x0b89('0x11')](request(_0x0b89('0x12'),{'command':util[_0x0b89('0x13')](_0x0b89('0x14'),_0x2f390c[_0x473b0d])})['then'](function(_0xe8703){return _0xe8703&&_0xe8703[_0x0b89('0xa')]&&_0xe8703['message']['indexOf'](_0x0b89('0x15'))>=0x0?!![]:![];})['catch'](function(_0x3e3053){logger[_0x0b89('0x9')](_0x0b89('0x16'),_0x5d75ea,_0x2f390c[_0x473b0d]);}));}BPromise[_0x0b89('0x17')](_0x182002)[_0x0b89('0x18')](function(_0x151c12){var _0x346f80=_[_0x0b89('0x19')](_0x151c12);logger['info'](_0x0b89('0x1a'),_0x5d75ea,_0x2f390c[_0x0b89('0x1b')](_0x0b89('0x1c')),_0x346f80);_0x1c36d5[_0x0b89('0x1d')](_0x346f80);})['catch'](function(_0x59f94a){console[_0x0b89('0x1e')](_0x59f94a);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x5d75ea,_0x2f390c[_0x0b89('0x1b')](_0x0b89('0x1c')),_0x59f94a['stack']);_0x1c36d5['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 79779cb..9e00e85 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 _0x6e6c=['agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','agentcalledAt','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','format','agentringnoanswer','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0xbb9af5,_0x51c1f6){var _0x3e8b66=function(_0x539973){while(--_0x539973){_0xbb9af5['push'](_0xbb9af5['shift']());}};_0x3e8b66(++_0x51c1f6);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x370b21,_0x1b63fe){utils['info'](util['format'](_0xc6e6('0x2'),_0x370b21['uniqueid'],_0x370b21[_0xc6e6('0x3')],_0x370b21['queue'],_0x370b21[_0xc6e6('0x4')],_0x370b21[_0xc6e6('0x5')],_0x370b21['calleridnum'],_0x370b21[_0xc6e6('0x6')],_0x370b21[_0xc6e6('0x7')]));if(_0x370b21['queue']){utils[_0xc6e6('0x8')](_0x370b21[_0xc6e6('0x9')])['then'](function(_0x324f05){if(_0x324f05){_0x370b21['type']=_0x324f05[_0xc6e6('0xa')];_0x370b21[_0xc6e6('0xb')]=_0x370b21[_0xc6e6('0xc')]?_0x324f05[_0xc6e6('0xd')]:![];_0x370b21[_0xc6e6('0xe')]=_0x370b21[_0xc6e6('0xb')]?_0x324f05[_0xc6e6('0xf')]:0x0;}utils[_0xc6e6('0x10')](_0xc6e6('0x11'),_0x370b21);});}else{utils['request'](_0xc6e6('0x11'),_0x370b21);}if(_0x1b63fe){delete transfers[_0x370b21['uniqueid']];}else{delete agents[_0x370b21[_0xc6e6('0x12')]];}}exports[_0xc6e6('0x13')]=function(_0x33aea0){try{utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x33aea0);agents[_0x33aea0[_0xc6e6('0x12')]]=_0x33aea0;agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x17')]=utils['now']();agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x7')]='called';agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x6')]=null;agents[_0x33aea0[_0xc6e6('0x12')]]['connectedlinename']=null;utils['info'](util['format'](_0xc6e6('0x18'),_0x33aea0['uniqueid'],agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x33aea0[_0xc6e6('0x12')]));}catch(_0x41afe6){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x41afe6);}};exports[_0xc6e6('0x1b')]=function(_0x3d734d){try{if(!_['isNil'](agents[_0x3d734d[_0xc6e6('0x12')]])){utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x1c'),_0x3d734d[_0xc6e6('0x16')]),_0x3d734d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x1e'),_0x3d734d[_0xc6e6('0x16')],agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x3d734d[_0xc6e6('0x12')]));agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1b')]=!![];agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1f')]=utils[_0xc6e6('0x20')]();agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x7')]='timeout';agents[_0x3d734d[_0xc6e6('0x12')]]['reason']=_0xc6e6('0x21');agents[_0x3d734d['destuniqueid']][_0xc6e6('0x22')]=_0x3d734d[_0xc6e6('0x23')]?parseInt(_0x3d734d[_0xc6e6('0x23')])/0x3e8:0x0;agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x24')]=0x0;unanswered['push'](_0x3d734d[_0xc6e6('0x12')]);}}catch(_0x1501bd){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][agentringnoanswer]',_0x3d734d[_0xc6e6('0x16')]),_0x1501bd);}};exports['queuecallerabandon']=function(_0x29411c){try{_[_0xc6e6('0x25')](agents,function(_0x12c616,_0xc578b3){if(_0x12c616[_0xc6e6('0x16')]==_0x29411c[_0xc6e6('0x16')]&&!_[_0xc6e6('0x26')](unanswered,_0x12c616[_0xc6e6('0x12')])){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c[_0xc6e6('0x16')]),_0x29411c);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x28'),_0x29411c[_0xc6e6('0x16')],_0x12c616[_0xc6e6('0x4')],_0x12c616['destuniqueid']));_0x12c616[_0xc6e6('0x1b')]=!![];_0x12c616[_0xc6e6('0x1f')]=utils['now']();_0x12c616['lastevent']=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x2a')]=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x22')]=_0x29411c[_0xc6e6('0x22')];_0x12c616[_0xc6e6('0x24')]=0x0;writeDB(_0x12c616);}});}catch(_0x59a8f0){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c['uniqueid']),_0x59a8f0);}};exports['agentconnect']=function(_0xa5138d){try{if(agents[_0xa5138d[_0xc6e6('0x12')]]){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')]('[%s][agents][agentconnect]',_0xa5138d['uniqueid']),_0xa5138d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x2b'),_0xa5138d['uniqueid'],agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0xa5138d[_0xc6e6('0x12')]));agents[_0xa5138d[_0xc6e6('0x12')]]['agentconnectAt']=utils['now']();agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x6')]=_0xa5138d[_0xc6e6('0x6')];agents[_0xa5138d[_0xc6e6('0x12')]]['connectedlinename']=_0xa5138d['connectedlinename'];agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x22')]=_0xa5138d[_0xc6e6('0x23')];agents[_0xa5138d[_0xc6e6('0x12')]]['lastevent']=_0xc6e6('0x2c');_[_0xc6e6('0x25')](agents,function(_0x5ddab4,_0x500b7e){if(_0x5ddab4[_0xc6e6('0x12')]!=_0xa5138d['destuniqueid']&&_0x5ddab4[_0xc6e6('0x16')]==_0xa5138d[_0xc6e6('0x16')]){_0x5ddab4['talktime']=0x0;_0x5ddab4[_0xc6e6('0x22')]=_0xa5138d['ringtime'];_0x5ddab4[_0xc6e6('0x1b')]=!![];_0x5ddab4['agentringnoanswerAt']=utils[_0xc6e6('0x20')]();_0x5ddab4[_0xc6e6('0x7')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2a')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2e')]=_0xa5138d[_0xc6e6('0x12')];_0x5ddab4[_0xc6e6('0x2f')]=_0xa5138d[_0xc6e6('0x4')];writeDB(_0x5ddab4);}});}}catch(_0x5722db){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x30'),_0xa5138d[_0xc6e6('0x16')]),_0x5722db);}};exports['agentcomplete']=function(_0xc5f4fb){try{if(!_[_0xc6e6('0x31')](agents[_0xc5f4fb[_0xc6e6('0x12')]])){utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xc5f4fb);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x33'),_0xc5f4fb['uniqueid'],agents[_0xc5f4fb[_0xc6e6('0x12')]]['membername'],_0xc5f4fb[_0xc6e6('0x12')]));agents[_0xc5f4fb['destuniqueid']][_0xc6e6('0xc')]=!![];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](agents[_0xc5f4fb[_0xc6e6('0x12')]]['agentcompleteAt'],agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x36')]);agents[_0xc5f4fb[_0xc6e6('0x12')]]['reason']=_0xc5f4fb[_0xc6e6('0x2a')];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x7')]=_0xc6e6('0x37');writeDB(agents[_0xc5f4fb[_0xc6e6('0x12')]]);}}catch(_0xefd557){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xefd557);}};exports[_0xc6e6('0x38')]=function(_0x470167){try{if(!_[_0xc6e6('0x31')](agents[_0x470167[_0xc6e6('0x39')]])){utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x470167);utils[_0xc6e6('0x1d')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x470167['uniqueid'],agents[_0x470167['transfereruniqueid']]['membername'],agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')]));agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3a')]=!![];agents[_0x470167[_0xc6e6('0x39')]]['transfertype']='blind';agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3b')]=_0x470167[_0xc6e6('0x3c')];agents[_0x470167[_0xc6e6('0x39')]]['transferuniqueid']=agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')];}}catch(_0x286dc1){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x286dc1);}};exports[_0xc6e6('0x3d')]=function(_0x288912){try{utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x288912);if(_0x288912[_0xc6e6('0x3f')]==_0x288912[_0xc6e6('0x40')]){if(!_['isNil'](agents[_0x288912[_0xc6e6('0x41')]])){utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x42'),_0x288912[_0xc6e6('0x3f')],agents[_0x288912['secondtransfereruniqueid']]['membername']));agents[_0x288912['secondtransfereruniqueid']][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x3b')]=_0x288912['origtransfererexten'];agents[_0x288912[_0xc6e6('0x41')]]['transferuniqueid']=_0x288912[_0xc6e6('0x3f')];}if(_0x288912[_0xc6e6('0x45')]&&agents[_0x288912[_0xc6e6('0x45')]]){agents[_0x288912['transfereeuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912['transfereeuniqueid']]=_[_0xc6e6('0x47')](agents[_0x288912['transfereeuniqueid']]);transfers[_0x288912['transfereeuniqueid']][_0xc6e6('0x48')]=agents[_0x288912['secondtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x17')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]]['agentconnectAt']=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912[_0xc6e6('0x45')]]['agententerreason']=0x2;}}else if(_0x288912[_0xc6e6('0x41')]==_0x288912[_0xc6e6('0x4a')]){if(!_[_0xc6e6('0x31')](agents[_0x288912['origtransfereruniqueid']])){utils['info'](util[_0xc6e6('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x288912['origtransfereruniqueid'],agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x4')]));agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3b')]=_0x288912[_0xc6e6('0x4b')];agents[_0x288912[_0xc6e6('0x3f')]]['transferuniqueid']=_0x288912['secondtransfereruniqueid'];}if(_0x288912[_0xc6e6('0x4c')]&&agents[_0x288912['transfertargetuniqueid']]){agents[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912[_0xc6e6('0x4c')]]=_[_0xc6e6('0x47')](agents[_0x288912['transfertargetuniqueid']]);transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x48')]=agents[_0x288912['origtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x17')]=utils['now']();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x36')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x2;}}}catch(_0x3b1549){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x3b1549);}};exports['hangup']=function(_0x27e74b){try{utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][hangup]',_0x27e74b['uniqueid']),_0x27e74b);if(agents[_0x27e74b[_0xc6e6('0x16')]]&&agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')]===_0xc6e6('0x21')){if(_0x27e74b[_0xc6e6('0x4d')]==='21'){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]='rejected';agents[_0x27e74b[_0xc6e6('0x16')]]['lastevent']='rejected';}utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]]['membername'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);var _0x292107=unanswered[_0xc6e6('0x4f')](_0x27e74b['uniqueid']);if(_0x292107>-0x1){unanswered[_0xc6e6('0x50')](_0x292107,0x1);}}if(transfers[_0x27e74b[_0xc6e6('0x16')]]){transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];transfers[_0x27e74b[_0xc6e6('0x16')]]['agentcompleteAt']=utils[_0xc6e6('0x20')]();transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](transfers[_0x27e74b['uniqueid']]['agentcompleteAt'],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x36')]);transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]=_0xc6e6('0x51');transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27e74b[_0xc6e6('0x16')],transfers[_0x27e74b['uniqueid']][_0xc6e6('0x4')],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')],transfers[_0x27e74b['uniqueid']]['lastevent']));writeDB(transfers[_0x27e74b[_0xc6e6('0x16')]],!![]);}if(agents[_0x27e74b['uniqueid']]&&agents[_0x27e74b[_0xc6e6('0x16')]]['agentconnectAt']){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];agents[_0x27e74b['uniqueid']][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0x27e74b[_0xc6e6('0x16')]]['talktime']=utils[_0xc6e6('0x35')](agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x34')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x36')]);agents[_0x27e74b[_0xc6e6('0x16')]]['reason']=agents[_0x27e74b['uniqueid']]['transfer']?_0xc6e6('0x3a'):_0xc6e6('0x51');agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x4')],agents[_0x27e74b[_0xc6e6('0x16')]]['reason'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);}}catch(_0x1826d){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x52'),_0x27e74b[_0xc6e6('0x16')]),_0x1826d);}}; \ No newline at end of file +var _0xd4f4=['holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','transferexten','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','isNil','ATTENDED','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','error','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','membername','agentringnoanswer','agentringnoanswerAt','reason','timeout'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x18ad4e,_0x7f99c0){_0x18ad4e=_0x18ad4e-0x0;var _0x37691e=_0xd4f4[_0x18ad4e];return _0x37691e;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var utils=require(_0x4d4f('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3c9311,_0x2fc384){utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x5'),_0x3c9311[_0x4d4f('0x6')],_0x3c9311[_0x4d4f('0x7')],_0x3c9311[_0x4d4f('0x8')],_0x3c9311['membername'],_0x3c9311['interface'],_0x3c9311['calleridnum'],_0x3c9311[_0x4d4f('0x9')],_0x3c9311[_0x4d4f('0xa')]));if(_0x3c9311[_0x4d4f('0x8')]){utils[_0x4d4f('0xb')](_0x3c9311[_0x4d4f('0x8')])[_0x4d4f('0xc')](function(_0x1bd887){if(_0x1bd887){_0x3c9311[_0x4d4f('0xd')]=_0x1bd887[_0x4d4f('0xd')];_0x3c9311[_0x4d4f('0xe')]=_0x3c9311[_0x4d4f('0xf')]?_0x1bd887[_0x4d4f('0x10')]:![];_0x3c9311[_0x4d4f('0x11')]=_0x3c9311[_0x4d4f('0xe')]?_0x1bd887[_0x4d4f('0x12')]:0x0;}utils[_0x4d4f('0x13')](_0x4d4f('0x14'),_0x3c9311);});}else{utils[_0x4d4f('0x13')]('CreateVoiceAgentReport',_0x3c9311);}if(_0x2fc384){delete transfers[_0x3c9311['uniqueid']];}else{delete agents[_0x3c9311['destuniqueid']];}}exports[_0x4d4f('0x15')]=function(_0xe9b7a6){try{utils['debug'](util[_0x4d4f('0x4')](_0x4d4f('0x16'),_0xe9b7a6[_0x4d4f('0x6')]),_0xe9b7a6);agents[_0xe9b7a6['destuniqueid']]=_0xe9b7a6;agents[_0xe9b7a6[_0x4d4f('0x17')]][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();agents[_0xe9b7a6['destuniqueid']][_0x4d4f('0xa')]='called';agents[_0xe9b7a6[_0x4d4f('0x17')]][_0x4d4f('0x9')]=null;agents[_0xe9b7a6[_0x4d4f('0x17')]]['connectedlinename']=null;utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xe9b7a6['uniqueid'],agents[_0xe9b7a6['destuniqueid']]['membername'],_0xe9b7a6['destuniqueid']));}catch(_0x34429e){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x16'),_0xe9b7a6['uniqueid']),_0x34429e);}};exports['agentringnoanswer']=function(_0x1e1ae2){try{if(!_['isNil'](agents[_0x1e1ae2[_0x4d4f('0x17')]])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x1c'),_0x1e1ae2[_0x4d4f('0x6')]),_0x1e1ae2);utils['info'](util['format'](_0x4d4f('0x1d'),_0x1e1ae2['uniqueid'],agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x1e')],_0x1e1ae2[_0x4d4f('0x17')]));agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x1f')]=!![];agents[_0x1e1ae2['destuniqueid']][_0x4d4f('0x20')]=utils[_0x4d4f('0x19')]();agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0xa')]='timeout';agents[_0x1e1ae2['destuniqueid']][_0x4d4f('0x21')]=_0x4d4f('0x22');agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x23')]=_0x1e1ae2['ringtime']?parseInt(_0x1e1ae2[_0x4d4f('0x24')])/0x3e8:0x0;agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x25')]=0x0;unanswered[_0x4d4f('0x26')](_0x1e1ae2['destuniqueid']);}}catch(_0x338ba2){utils['error'](util[_0x4d4f('0x4')](_0x4d4f('0x1c'),_0x1e1ae2['uniqueid']),_0x338ba2);}};exports[_0x4d4f('0x27')]=function(_0x123383){try{_[_0x4d4f('0x28')](agents,function(_0x3d7f14,_0x19a502){if(_0x3d7f14[_0x4d4f('0x6')]==_0x123383['uniqueid']&&!_[_0x4d4f('0x29')](unanswered,_0x3d7f14[_0x4d4f('0x17')])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x2a'),_0x123383['uniqueid']),_0x123383);utils[_0x4d4f('0x3')](util['format'](_0x4d4f('0x2b'),_0x123383['uniqueid'],_0x3d7f14['membername'],_0x3d7f14['destuniqueid']));_0x3d7f14[_0x4d4f('0x1f')]=!![];_0x3d7f14['agentringnoanswerAt']=utils[_0x4d4f('0x19')]();_0x3d7f14[_0x4d4f('0xa')]=_0x4d4f('0x2c');_0x3d7f14['reason']=_0x4d4f('0x2c');_0x3d7f14[_0x4d4f('0x23')]=_0x123383[_0x4d4f('0x23')];_0x3d7f14['talktime']=0x0;writeDB(_0x3d7f14);}});}catch(_0x6a30c4){utils['error'](util[_0x4d4f('0x4')](_0x4d4f('0x2a'),_0x123383[_0x4d4f('0x6')]),_0x6a30c4);}};exports[_0x4d4f('0x2d')]=function(_0x2448f3){try{if(agents[_0x2448f3[_0x4d4f('0x17')]]){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')]('[%s][agents][agentconnect]',_0x2448f3['uniqueid']),_0x2448f3);utils[_0x4d4f('0x3')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2448f3[_0x4d4f('0x6')],agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x1e')],_0x2448f3[_0x4d4f('0x17')]));agents[_0x2448f3[_0x4d4f('0x17')]]['agentconnectAt']=utils[_0x4d4f('0x19')]();agents[_0x2448f3[_0x4d4f('0x17')]]['connectedlinenum']=_0x2448f3[_0x4d4f('0x9')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x2e')]=_0x2448f3[_0x4d4f('0x2e')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x23')]=_0x2448f3[_0x4d4f('0x24')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0xa')]='connect';_['forIn'](agents,function(_0x1cb919,_0x324a3c){if(_0x1cb919[_0x4d4f('0x17')]!=_0x2448f3[_0x4d4f('0x17')]&&_0x1cb919['uniqueid']==_0x2448f3['uniqueid']){_0x1cb919[_0x4d4f('0x25')]=0x0;_0x1cb919[_0x4d4f('0x23')]=_0x2448f3['ringtime'];_0x1cb919['agentringnoanswer']=!![];_0x1cb919[_0x4d4f('0x20')]=utils[_0x4d4f('0x19')]();_0x1cb919['lastevent']=_0x4d4f('0x2f');_0x1cb919[_0x4d4f('0x21')]=_0x4d4f('0x2f');_0x1cb919[_0x4d4f('0x30')]=_0x2448f3[_0x4d4f('0x17')];_0x1cb919['answeredelsewheremembername']=_0x2448f3[_0x4d4f('0x1e')];writeDB(_0x1cb919);}});}}catch(_0x4c7c24){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')]('[%s][agents][agentconnect]',_0x2448f3[_0x4d4f('0x6')]),_0x4c7c24);}};exports[_0x4d4f('0xf')]=function(_0x1f7169){try{if(!_['isNil'](agents[_0x1f7169[_0x4d4f('0x17')]])){utils['debug'](util[_0x4d4f('0x4')]('[%s][agents][agentcomplete]',_0x1f7169[_0x4d4f('0x6')]),_0x1f7169);utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x31'),_0x1f7169[_0x4d4f('0x6')],agents[_0x1f7169['destuniqueid']]['membername'],_0x1f7169[_0x4d4f('0x17')]));agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0xf')]=!![];agents[_0x1f7169[_0x4d4f('0x17')]]['agentcompleteAt']=utils['now']();agents[_0x1f7169['destuniqueid']][_0x4d4f('0x25')]=utils[_0x4d4f('0x32')](agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x33')],agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x34')]);agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x21')]=_0x1f7169[_0x4d4f('0x21')];agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0xa')]=_0x4d4f('0x35');writeDB(agents[_0x1f7169['destuniqueid']]);}}catch(_0xb0937d){utils[_0x4d4f('0x1a')](util['format'](_0x4d4f('0x36'),_0x1f7169['uniqueid']),_0xb0937d);}};exports[_0x4d4f('0x37')]=function(_0x401466){try{if(!_['isNil'](agents[_0x401466[_0x4d4f('0x38')]])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x39'),_0x401466[_0x4d4f('0x6')]),_0x401466);utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x3a'),_0x401466[_0x4d4f('0x6')],agents[_0x401466[_0x4d4f('0x38')]][_0x4d4f('0x1e')],agents[_0x401466[_0x4d4f('0x38')]]['uniqueid']));agents[_0x401466[_0x4d4f('0x38')]]['transfer']=!![];agents[_0x401466['transfereruniqueid']]['transfertype']=_0x4d4f('0x3b');agents[_0x401466[_0x4d4f('0x38')]]['transferexten']=_0x401466['extension'];agents[_0x401466[_0x4d4f('0x38')]][_0x4d4f('0x3c')]=agents[_0x401466['transfereruniqueid']][_0x4d4f('0x6')];}}catch(_0x528573){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x39'),_0x401466[_0x4d4f('0x6')]),_0x528573);}};exports['attendedtransfer']=function(_0x224b83){try{utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x3d'),_0x224b83[_0x4d4f('0x3e')]),_0x224b83);if(_0x224b83['origtransfereruniqueid']==_0x224b83[_0x4d4f('0x3f')]){if(!_['isNil'](agents[_0x224b83[_0x4d4f('0x40')]])){utils['info'](util[_0x4d4f('0x4')](_0x4d4f('0x41'),_0x224b83['origtransfereruniqueid'],agents[_0x224b83[_0x4d4f('0x40')]][_0x4d4f('0x1e')]));agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x42')]=!![];agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x43')]='ATTENDED';agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x44')]=_0x224b83[_0x4d4f('0x45')];agents[_0x224b83[_0x4d4f('0x40')]][_0x4d4f('0x3c')]=_0x224b83[_0x4d4f('0x3e')];}if(_0x224b83['transfereeuniqueid']&&agents[_0x224b83['transfereeuniqueid']]){agents[_0x224b83[_0x4d4f('0x46')]]['agententerreason']=0x1;transfers[_0x224b83[_0x4d4f('0x46')]]=_[_0x4d4f('0x47')](agents[_0x224b83[_0x4d4f('0x46')]]);transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x48')]=agents[_0x224b83[_0x4d4f('0x40')]]['calleridnum'];transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x49')]=agents[_0x224b83[_0x4d4f('0x40')]]['calleridname'];transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();transfers[_0x224b83['transfereeuniqueid']][_0x4d4f('0x34')]=utils['now']();transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x23')]=0x0;transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x4a')]=0x2;}}else if(_0x224b83[_0x4d4f('0x40')]==_0x224b83[_0x4d4f('0x4b')]){if(!_[_0x4d4f('0x4c')](agents[_0x224b83[_0x4d4f('0x3e')]])){utils[_0x4d4f('0x3')](util['format'](_0x4d4f('0x41'),_0x224b83[_0x4d4f('0x3e')],agents[_0x224b83['origtransfereruniqueid']][_0x4d4f('0x1e')]));agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x42')]=!![];agents[_0x224b83[_0x4d4f('0x3e')]]['transfertype']=_0x4d4f('0x4d');agents[_0x224b83[_0x4d4f('0x3e')]]['transferexten']=_0x224b83['secondtransfererexten'];agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x3c')]=_0x224b83['secondtransfereruniqueid'];}if(_0x224b83['transfertargetuniqueid']&&agents[_0x224b83['transfertargetuniqueid']]){agents[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x4a')]=0x1;transfers[_0x224b83['transfertargetuniqueid']]=_[_0x4d4f('0x47')](agents[_0x224b83[_0x4d4f('0x4e')]]);transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x48')]=agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x48')];transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x49')]=agents[_0x224b83['origtransfereruniqueid']][_0x4d4f('0x49')];transfers[_0x224b83['transfertargetuniqueid']][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();transfers[_0x224b83[_0x4d4f('0x4e')]]['agentconnectAt']=utils[_0x4d4f('0x19')]();transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x23')]=0x0;transfers[_0x224b83[_0x4d4f('0x4e')]]['agententerreason']=0x2;}}}catch(_0x4184fa){utils['error'](util[_0x4d4f('0x4')]('[%s][agents][attendedtransfer]',_0x224b83['origtransfereruniqueid']),_0x4184fa);}};exports[_0x4d4f('0x4f')]=function(_0x2d99e4){try{utils['debug'](util[_0x4d4f('0x4')]('[%s][agents][hangup]',_0x2d99e4[_0x4d4f('0x6')]),_0x2d99e4);if(agents[_0x2d99e4[_0x4d4f('0x6')]]&&agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')]==='timeout'){if(_0x2d99e4[_0x4d4f('0x50')]==='21'){agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')]='rejected';agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]=_0x4d4f('0x51');}utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x52'),_0x2d99e4['uniqueid'],agents[_0x2d99e4['uniqueid']][_0x4d4f('0x1e')],agents[_0x2d99e4[_0x4d4f('0x6')]]['reason'],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]));writeDB(agents[_0x2d99e4[_0x4d4f('0x6')]]);var _0x133fc5=unanswered[_0x4d4f('0x53')](_0x2d99e4[_0x4d4f('0x6')]);if(_0x133fc5>-0x1){unanswered[_0x4d4f('0x54')](_0x133fc5,0x1);}}if(transfers[_0x2d99e4[_0x4d4f('0x6')]]){transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xf')]=!![];transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')]=utils[_0x4d4f('0x19')]();transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x25')]=utils['diffTime'](transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x34')]);transfers[_0x2d99e4['uniqueid']]['reason']=_0x4d4f('0x55');transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]=_0x4d4f('0x35');utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x52'),_0x2d99e4[_0x4d4f('0x6')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x1e')],transfers[_0x2d99e4['uniqueid']][_0x4d4f('0x21')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]));writeDB(transfers[_0x2d99e4[_0x4d4f('0x6')]],!![]);}if(agents[_0x2d99e4['uniqueid']]&&agents[_0x2d99e4['uniqueid']]['agentconnectAt']){agents[_0x2d99e4[_0x4d4f('0x6')]]['agentcomplete']=!![];agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')]=utils[_0x4d4f('0x19')]();agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x25')]=utils[_0x4d4f('0x32')](agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')],agents[_0x2d99e4['uniqueid']]['agentconnectAt']);agents[_0x2d99e4[_0x4d4f('0x6')]]['reason']=agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x42')]?_0x4d4f('0x42'):'agent';agents[_0x2d99e4['uniqueid']]['lastevent']=_0x4d4f('0x35');utils['info'](util[_0x4d4f('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2d99e4[_0x4d4f('0x6')],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x1e')],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')],agents[_0x2d99e4[_0x4d4f('0x6')]]['lastevent']));writeDB(agents[_0x2d99e4[_0x4d4f('0x6')]]);}}catch(_0x3beacf){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x56'),_0x2d99e4['uniqueid']),_0x3beacf);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7021830..1408738 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 _0x4e47=['error','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','application','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','channel','DOCUMENTATION','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','origtransfererchannel','userfield','_attended'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e47,0x17f));var _0x74e4=function(_0xcf3754,_0x304d29){_0xcf3754=_0xcf3754-0x0;var _0x21ffb4=_0x4e47[_0xcf3754];return _0x21ffb4;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x74e4('0x0'));var transfers=require(_0x74e4('0x1'));var dispositions=[_0x74e4('0x2'),_0x74e4('0x3'),_0x74e4('0x3'),_0x74e4('0x2'),_0x74e4('0x2'),_0x74e4('0x2'),'ANSWERED',_0x74e4('0x4'),_0x74e4('0x3'),'FAILED',_0x74e4('0x3')];var channels={};function writeDB(_0x6166e1){var _0x2f6f88;if(transfers[_0x74e4('0x5')][_0x6166e1[_0x74e4('0x6')]]){_0x2f6f88=_0x6166e1['uniqueid'];_0x6166e1[_0x74e4('0x6')]=transfers[_0x74e4('0x5')][_0x6166e1[_0x74e4('0x6')]][_0x74e4('0x7')];}utils[_0x74e4('0x8')](util['format'](_0x74e4('0x9'),_0x6166e1[_0x74e4('0x6')],_0x6166e1['channel'],_0x6166e1[_0x74e4('0xa')],_0x6166e1['membername'],_0x6166e1[_0x74e4('0xb')],_0x6166e1[_0x74e4('0xc')],_0x6166e1[_0x74e4('0xd')],_0x6166e1[_0x74e4('0xe')]));if(_0x6166e1[_0x74e4('0xf')]){utils[_0x74e4('0x10')](_0x6166e1[_0x74e4('0xf')])[_0x74e4('0x11')](function(_0x1dda27){if(_0x1dda27){_0x6166e1[_0x74e4('0x12')]=_0x1dda27['id'];}utils[_0x74e4('0x13')]('CreateVoiceCallReport',_0x6166e1);});}else{utils['request']('CreateVoiceCallReport',_0x6166e1);}if(channels[_0x6166e1['uniqueid']]){delete channels[_0x6166e1[_0x74e4('0x6')]];}else if(_0x2f6f88&&channels[_0x2f6f88]){if(!transfers[_0x74e4('0x5')][_0x2f6f88][_0x74e4('0x14')])delete transfers['blinds'][_0x2f6f88];delete channels[_0x2f6f88];}}exports[_0x74e4('0x15')]=function(_0x46998b){try{utils[_0x74e4('0x16')](util[_0x74e4('0x17')](_0x74e4('0x18'),_0x46998b[_0x74e4('0x6')]),_0x46998b);if(_0x46998b[_0x74e4('0x6')]==_0x46998b[_0x74e4('0x19')]&&_0x46998b['channel']!=_0x74e4('0x1a')){utils[_0x74e4('0x8')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x46998b['uniqueid'],_0x46998b[_0x74e4('0x1b')],_0x46998b[_0x74e4('0x1c')]));channels[_0x46998b[_0x74e4('0x6')]]={'uniqueid':_0x46998b[_0x74e4('0x6')],'accountcode':_0x46998b[_0x74e4('0xf')],'source':_0x46998b[_0x74e4('0xc')],'destination':_0x46998b[_0x74e4('0x1c')],'destinationcontext':_0x46998b[_0x74e4('0x1b')],'channel':_0x46998b[_0x74e4('0x1d')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x74e4('0x2'),'amaflags':_0x74e4('0x1e')};}}catch(_0x12a936){utils['error'](util[_0x74e4('0x17')]('[%s][calls][newchannel]',_0x46998b[_0x74e4('0x6')]),_0x12a936);}};exports['newstate']=function(_0x143549){try{utils[_0x74e4('0x16')](util[_0x74e4('0x17')]('[%s][calls][newstate]',_0x143549[_0x74e4('0x6')]),_0x143549);if(!_['isNil'](channels[_0x143549[_0x74e4('0x6')]])&&_0x143549[_0x74e4('0x1f')]==0x6){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x20'),_0x143549['uniqueid'],_0x143549[_0x74e4('0x1b')],_0x143549[_0x74e4('0x1d')]));if(_[_0x74e4('0x21')](channels[_0x143549[_0x74e4('0x6')]]['systemanswertime'])){channels[_0x143549[_0x74e4('0x6')]][_0x74e4('0x22')]=utils[_0x74e4('0x23')]();}}else if(!_[_0x74e4('0x21')](channels[_0x143549[_0x74e4('0x19')]])&&_0x143549['channelstate']==0x6&&_0x143549[_0x74e4('0x1b')]!=_0x74e4('0x24')){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x25'),_0x143549[_0x74e4('0x6')],_0x143549[_0x74e4('0x19')],_0x143549['context'],_0x143549['channel']));channels[_0x143549[_0x74e4('0x19')]]['accountcode']=_0x143549['accountcode'];channels[_0x143549[_0x74e4('0x19')]][_0x74e4('0x26')]=_0x143549[_0x74e4('0x1d')];if(_['isNil'](channels[_0x143549[_0x74e4('0x19')]][_0x74e4('0x27')])){channels[_0x143549['linkedid']][_0x74e4('0x27')]=utils[_0x74e4('0x23')]();}channels[_0x143549[_0x74e4('0x19')]][_0x74e4('0x28')]=dispositions[_['toNumber'](_0x143549[_0x74e4('0x1f')])]||_0x74e4('0x29');}}catch(_0xdd7d0a){utils['error'](util['format'](_0x74e4('0x2a'),_0x143549[_0x74e4('0x6')]),_0xdd7d0a);}};exports[_0x74e4('0x2b')]=function(_0x3c4697){try{if(!_[_0x74e4('0x21')](channels[_0x3c4697[_0x74e4('0x6')]])){utils[_0x74e4('0x16')](util[_0x74e4('0x17')](_0x74e4('0x2c'),_0x3c4697[_0x74e4('0x6')]),_0x3c4697);if(_[_0x74e4('0x21')](channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x2d')])){channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x2d')]=_0x3c4697[_0x74e4('0x2e')]+'\x20<'+_0x3c4697[_0x74e4('0xc')]+'>';}utils[_0x74e4('0x8')](util[_0x74e4('0x17')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3c4697[_0x74e4('0x6')],channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x2d')],_0x3c4697[_0x74e4('0x2f')]));channels[_0x3c4697['uniqueid']][_0x74e4('0x30')]=utils[_0x74e4('0x23')]();channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x31')]=utils[_0x74e4('0x32')](channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x30')],channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x33')]);channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x34')]=channels[_0x3c4697['uniqueid']]['answertime']?utils[_0x74e4('0x32')](channels[_0x3c4697[_0x74e4('0x6')]]['endtime'],channels[_0x3c4697[_0x74e4('0x6')]][_0x74e4('0x27')]):0x0;writeDB(channels[_0x3c4697[_0x74e4('0x6')]]);}}catch(_0x3d08a7){utils['error'](util[_0x74e4('0x17')](_0x74e4('0x2c'),_0x3c4697[_0x74e4('0x6')]),_0x3d08a7);}};exports['attendedtransfer']=function(_0xd94d4f){try{if(!_['isNil'](channels[_0xd94d4f[_0x74e4('0x35')]])){utils[_0x74e4('0x16')](util[_0x74e4('0x17')](_0x74e4('0x36'),_0xd94d4f['origtransfereruniqueid']),_0xd94d4f);if(channels[_0xd94d4f[_0x74e4('0x35')]]['channel']==_0xd94d4f['transfereechannel']){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x37'),_0xd94d4f[_0x74e4('0x38')],_0xd94d4f[_0x74e4('0x35')],_0xd94d4f[_0x74e4('0x39')]));channels[_0xd94d4f[_0x74e4('0x35')]][_0x74e4('0x26')]=_0xd94d4f[_0x74e4('0x39')];channels[_0xd94d4f['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0xd94d4f[_0x74e4('0x35')]]['channel']=_0xd94d4f['transfertargetchannel']){utils[_0x74e4('0x8')](util['format'](_0x74e4('0x37'),_0xd94d4f[_0x74e4('0x38')],_0xd94d4f[_0x74e4('0x35')],_0xd94d4f[_0x74e4('0x3a')]));channels[_0xd94d4f[_0x74e4('0x35')]][_0x74e4('0x26')]=_0xd94d4f[_0x74e4('0x3a')];channels[_0xd94d4f['localtwolinkedid']][_0x74e4('0x3b')]=_0x74e4('0x3c');}}}catch(_0x204aeb){utils[_0x74e4('0x3d')](util['format'](_0x74e4('0x36'),_0xd94d4f[_0x74e4('0x38')]),_0x204aeb);}};exports[_0x74e4('0x3e')]=function(_0x1d1abc){try{if(!_['isNil'](channels[_0x1d1abc['uniqueid']])){utils['debug'](util[_0x74e4('0x17')](_0x74e4('0x3f'),_0x1d1abc[_0x74e4('0x6')]),_0x1d1abc);channels[_0x1d1abc[_0x74e4('0x6')]][_0x74e4('0x40')]=utils[_0x74e4('0x23')]();utils[_0x74e4('0x8')](util['format'](_0x74e4('0x41'),_0x1d1abc['uniqueid'],channels[_0x1d1abc[_0x74e4('0x6')]][_0x74e4('0x40')]));}}catch(_0x28a364){utils['error'](util[_0x74e4('0x17')](_0x74e4('0x3f'),_0x1d1abc['uniqueid']),_0x28a364);}};exports[_0x74e4('0x42')]=function(_0x1e108e){try{if(!_[_0x74e4('0x21')](channels[_0x1e108e[_0x74e4('0x6')]])){utils[_0x74e4('0x16')](util['format'](_0x74e4('0x43'),_0x1e108e[_0x74e4('0x6')]),_0x1e108e);if(!_[_0x74e4('0x21')](channels[_0x1e108e[_0x74e4('0x6')]]['musiconholdstartAt'])){channels[_0x1e108e[_0x74e4('0x6')]][_0x74e4('0x44')]+=utils[_0x74e4('0x32')](utils[_0x74e4('0x23')](),channels[_0x1e108e[_0x74e4('0x6')]][_0x74e4('0x40')]);utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x45'),_0x1e108e['uniqueid'],channels[_0x1e108e['uniqueid']][_0x74e4('0x44')]));delete channels[_0x1e108e[_0x74e4('0x6')]][_0x74e4('0x40')];}}}catch(_0x46d679){utils[_0x74e4('0x3d')](util[_0x74e4('0x17')](_0x74e4('0x43'),_0x1e108e[_0x74e4('0x6')]),_0x46d679);}};exports[_0x74e4('0x46')]=function(_0x12ccae){try{if(!_[_0x74e4('0x21')](channels[_0x12ccae[_0x74e4('0x6')]])){utils[_0x74e4('0x16')](util[_0x74e4('0x17')](_0x74e4('0x47'),_0x12ccae[_0x74e4('0x6')]),_0x12ccae);if(!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x49')])){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x4a'),_0x12ccae['uniqueid'],_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae[_0x74e4('0x6')]]['source']=_0x12ccae['value'];}if(!_['isNil'](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x4c')])){utils[_0x74e4('0x8')](util['format'](_0x74e4('0x4d'),_0x12ccae[_0x74e4('0x6')],_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae[_0x74e4('0x6')]][_0x74e4('0x4e')]=_0x12ccae[_0x74e4('0x4b')];channels[_0x12ccae[_0x74e4('0x6')]][_0x74e4('0x2d')]='\x22'+_0x12ccae[_0x74e4('0x4b')]+_0x74e4('0x4f')+_0x12ccae['value']+'>';}if(!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x50')])||!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x51')])){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x52'),_0x12ccae['uniqueid'],!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x50')])?_0x74e4('0x50'):_0x74e4('0x51'),_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae['uniqueid']][_0x74e4('0x2d')]=_0x12ccae['value'];}if(!_['isNil'](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x53')])||!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x54')])){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x52'),_0x12ccae[_0x74e4('0x6')],!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x53')])?_0x74e4('0x53'):_0x74e4('0x54'),_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae[_0x74e4('0x6')]]['lastapplication']=_0x74e4('0x55');channels[_0x12ccae[_0x74e4('0x6')]][_0x74e4('0x56')]=_0x12ccae['value'];channels[_0x12ccae[_0x74e4('0x6')]][_0x74e4('0xa')]=!![];}if(!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x57')])){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x58'),_0x12ccae[_0x74e4('0x6')],_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae[_0x74e4('0x6')]][_0x74e4('0x59')]=_0x12ccae[_0x74e4('0x4b')];}if(!_['isNil'](_0x12ccae['variable']['xmd-cdrtype'])){utils[_0x74e4('0x8')](util[_0x74e4('0x17')](_0x74e4('0x5a'),_0x12ccae['uniqueid'],_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae['uniqueid']][_0x74e4('0x5b')]=_0x12ccae[_0x74e4('0x4b')];}if(!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x5c')])){utils[_0x74e4('0x8')](util['format'](_0x74e4('0x5d'),_0x12ccae[_0x74e4('0x6')],_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae['uniqueid']][_0x74e4('0x5e')]=_0x12ccae['value'];}if(!_[_0x74e4('0x21')](_0x12ccae[_0x74e4('0x48')][_0x74e4('0x5f')])){utils[_0x74e4('0x8')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x12ccae[_0x74e4('0x6')],_0x12ccae[_0x74e4('0x4b')]));channels[_0x12ccae[_0x74e4('0x6')]][_0x74e4('0x5f')]=_0x12ccae[_0x74e4('0x4b')];}}}catch(_0x4ef97a){utils['error'](util[_0x74e4('0x17')](_0x74e4('0x47'),_0x12ccae['uniqueid']),_0x4ef97a);}};exports[_0x74e4('0x60')]=function(_0x283cdf){try{if(!_['isNil'](channels[_0x283cdf[_0x74e4('0x6')]])){utils[_0x74e4('0x16')](util['format'](_0x74e4('0x61'),_0x283cdf[_0x74e4('0x6')]),_0x283cdf);utils[_0x74e4('0x8')](util[_0x74e4('0x17')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x283cdf[_0x74e4('0x6')],_0x283cdf['application'],_0x283cdf[_0x74e4('0x62')]));if(_0x283cdf['application'][_0x74e4('0x63')]()==_0x74e4('0x64')&&_[_0x74e4('0x65')](_0x283cdf[_0x74e4('0x62')][_0x74e4('0x63')](),_0x74e4('0x66'))){var _0x30e630=_0x283cdf[_0x74e4('0x62')][_0x74e4('0x67')]('=');var _0x2fb8bb=_0x30e630[0x0][_0x74e4('0x68')](_0x30e630[0x0][_0x74e4('0x69')]('(')+0x1,_0x30e630[0x0]['lastIndexOf'](')'));var _0x57ff55=_0x30e630[0x1];channels[_0x283cdf[_0x74e4('0x6')]][_0x2fb8bb]=_0x57ff55;}if(!_[_0x74e4('0x6a')]([_0x74e4('0x2b'),_0x74e4('0x6b'),_0x74e4('0x6c'),'set',_0x74e4('0x6d')],_0x283cdf[_0x74e4('0x6e')]['toLowerCase']())){channels[_0x283cdf['uniqueid']]['lastapplication']=_0x283cdf['application'];channels[_0x283cdf['uniqueid']][_0x74e4('0x56')]=_0x283cdf[_0x74e4('0x62')];}}}catch(_0x1e2d49){utils[_0x74e4('0x3d')](util[_0x74e4('0x17')](_0x74e4('0x61'),_0x283cdf[_0x74e4('0x6')]),_0x1e2d49);}}; \ No newline at end of file +var _0x6691=['now','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','noop','execif','lastapplication','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','blinds','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten'];(function(_0x53d927,_0x4c04c7){var _0x465055=function(_0x3b6576){while(--_0x3b6576){_0x53d927['push'](_0x53d927['shift']());}};_0x465055(++_0x4c04c7);}(_0x6691,0x12d));var _0x1669=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6691[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var utils=require(_0x1669('0x2'));var transfers=require(_0x1669('0x3'));var dispositions=[_0x1669('0x4'),_0x1669('0x5'),_0x1669('0x5'),_0x1669('0x4'),_0x1669('0x4'),_0x1669('0x4'),'ANSWERED',_0x1669('0x6'),_0x1669('0x5'),_0x1669('0x5'),_0x1669('0x5')];var channels={};function writeDB(_0x55393c){var _0x5d23fd;if(transfers['blinds'][_0x55393c[_0x1669('0x7')]]){_0x5d23fd=_0x55393c['uniqueid'];_0x55393c['uniqueid']=transfers['blinds'][_0x55393c[_0x1669('0x7')]]['transfereeuniqueid'];}utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0xa'),_0x55393c[_0x1669('0x7')],_0x55393c[_0x1669('0xb')],_0x55393c[_0x1669('0xc')],_0x55393c[_0x1669('0xd')],_0x55393c[_0x1669('0xe')],_0x55393c[_0x1669('0xf')],_0x55393c[_0x1669('0x10')],_0x55393c[_0x1669('0x11')]));if(_0x55393c[_0x1669('0x12')]){utils[_0x1669('0x13')](_0x55393c[_0x1669('0x12')])[_0x1669('0x14')](function(_0x355ac3){if(_0x355ac3){_0x55393c[_0x1669('0x15')]=_0x355ac3['id'];}utils[_0x1669('0x16')](_0x1669('0x17'),_0x55393c);});}else{utils[_0x1669('0x16')](_0x1669('0x17'),_0x55393c);}if(channels[_0x55393c[_0x1669('0x7')]]){delete channels[_0x55393c[_0x1669('0x7')]];}else if(_0x5d23fd&&channels[_0x5d23fd]){if(!transfers['blinds'][_0x5d23fd][_0x1669('0x18')])delete transfers[_0x1669('0x19')][_0x5d23fd];delete channels[_0x5d23fd];}}exports[_0x1669('0x1a')]=function(_0x395e32){try{utils[_0x1669('0x1b')](util['format']('[%s][calls][newchannel]',_0x395e32[_0x1669('0x7')]),_0x395e32);if(_0x395e32[_0x1669('0x7')]==_0x395e32[_0x1669('0x1c')]&&_0x395e32[_0x1669('0xb')]!=_0x1669('0x1d')){utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x395e32[_0x1669('0x7')],_0x395e32[_0x1669('0x1e')],_0x395e32['exten']));channels[_0x395e32[_0x1669('0x7')]]={'uniqueid':_0x395e32[_0x1669('0x7')],'accountcode':_0x395e32['accountcode'],'source':_0x395e32[_0x1669('0xf')],'destination':_0x395e32[_0x1669('0x1f')],'destinationcontext':_0x395e32[_0x1669('0x1e')],'channel':_0x395e32[_0x1669('0xb')],'starttime':utils[_0x1669('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x1669('0x21')};}}catch(_0x457973){utils[_0x1669('0x22')](util['format'](_0x1669('0x23'),_0x395e32['uniqueid']),_0x457973);}};exports['newstate']=function(_0x238ce2){try{utils['debug'](util[_0x1669('0x9')](_0x1669('0x24'),_0x238ce2[_0x1669('0x7')]),_0x238ce2);if(!_[_0x1669('0x25')](channels[_0x238ce2[_0x1669('0x7')]])&&_0x238ce2[_0x1669('0x26')]==0x6){utils[_0x1669('0x8')](util['format'](_0x1669('0x27'),_0x238ce2['uniqueid'],_0x238ce2[_0x1669('0x1e')],_0x238ce2[_0x1669('0xb')]));if(_['isNil'](channels[_0x238ce2[_0x1669('0x7')]]['systemanswertime'])){channels[_0x238ce2[_0x1669('0x7')]][_0x1669('0x28')]=utils[_0x1669('0x20')]();}}else if(!_[_0x1669('0x25')](channels[_0x238ce2['linkedid']])&&_0x238ce2['channelstate']==0x6&&_0x238ce2['context']!=_0x1669('0x29')){utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0x2a'),_0x238ce2[_0x1669('0x7')],_0x238ce2['linkedid'],_0x238ce2[_0x1669('0x1e')],_0x238ce2[_0x1669('0xb')]));channels[_0x238ce2[_0x1669('0x1c')]][_0x1669('0x12')]=_0x238ce2[_0x1669('0x12')];channels[_0x238ce2[_0x1669('0x1c')]][_0x1669('0x2b')]=_0x238ce2[_0x1669('0xb')];if(_['isNil'](channels[_0x238ce2[_0x1669('0x1c')]]['answertime'])){channels[_0x238ce2[_0x1669('0x1c')]]['answertime']=utils['now']();}channels[_0x238ce2[_0x1669('0x1c')]][_0x1669('0x2c')]=dispositions[_[_0x1669('0x2d')](_0x238ce2[_0x1669('0x26')])]||_0x1669('0x2e');}}catch(_0x257ef0){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x24'),_0x238ce2['uniqueid']),_0x257ef0);}};exports[_0x1669('0x2f')]=function(_0x40fc23){try{if(!_[_0x1669('0x25')](channels[_0x40fc23[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util[_0x1669('0x9')](_0x1669('0x30'),_0x40fc23['uniqueid']),_0x40fc23);if(_[_0x1669('0x25')](channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x31')])){channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x31')]=_0x40fc23[_0x1669('0x32')]+'\x20<'+_0x40fc23['calleridnum']+'>';}utils['info'](util['format'](_0x1669('0x33'),_0x40fc23[_0x1669('0x7')],channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x31')],_0x40fc23[_0x1669('0x34')]));channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x35')]=utils['now']();channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x36')]=utils['diffTime'](channels[_0x40fc23['uniqueid']][_0x1669('0x35')],channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x37')]);channels[_0x40fc23[_0x1669('0x7')]][_0x1669('0x38')]=channels[_0x40fc23['uniqueid']][_0x1669('0x39')]?utils['diffTime'](channels[_0x40fc23['uniqueid']][_0x1669('0x35')],channels[_0x40fc23['uniqueid']][_0x1669('0x39')]):0x0;writeDB(channels[_0x40fc23[_0x1669('0x7')]]);}}catch(_0x374552){utils[_0x1669('0x22')](util['format'](_0x1669('0x30'),_0x40fc23[_0x1669('0x7')]),_0x374552);}};exports[_0x1669('0x3a')]=function(_0x528c48){try{if(!_[_0x1669('0x25')](channels[_0x528c48[_0x1669('0x3b')]])){utils[_0x1669('0x1b')](util[_0x1669('0x9')](_0x1669('0x3c'),_0x528c48[_0x1669('0x3d')]),_0x528c48);if(channels[_0x528c48[_0x1669('0x3b')]]['channel']==_0x528c48[_0x1669('0x3e')]){utils['info'](util[_0x1669('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x528c48[_0x1669('0x3d')],_0x528c48[_0x1669('0x3b')],_0x528c48[_0x1669('0x3f')]));channels[_0x528c48[_0x1669('0x3b')]][_0x1669('0x2b')]=_0x528c48[_0x1669('0x3f')];channels[_0x528c48['localtwolinkedid']][_0x1669('0x40')]=_0x1669('0x41');}else if(channels[_0x528c48[_0x1669('0x3b')]]['channel']=_0x528c48['transfertargetchannel']){utils['info'](util['format'](_0x1669('0x42'),_0x528c48[_0x1669('0x3d')],_0x528c48[_0x1669('0x3b')],_0x528c48['origtransfererchannel']));channels[_0x528c48['localtwolinkedid']][_0x1669('0x2b')]=_0x528c48['origtransfererchannel'];channels[_0x528c48[_0x1669('0x3b')]][_0x1669('0x40')]=_0x1669('0x41');}}}catch(_0x371542){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x3c'),_0x528c48['origtransfereruniqueid']),_0x371542);}};exports[_0x1669('0x43')]=function(_0x5733e8){try{if(!_[_0x1669('0x25')](channels[_0x5733e8['uniqueid']])){utils['debug'](util[_0x1669('0x9')](_0x1669('0x44'),_0x5733e8[_0x1669('0x7')]),_0x5733e8);channels[_0x5733e8[_0x1669('0x7')]][_0x1669('0x45')]=utils[_0x1669('0x20')]();utils['info'](util[_0x1669('0x9')](_0x1669('0x46'),_0x5733e8['uniqueid'],channels[_0x5733e8[_0x1669('0x7')]][_0x1669('0x45')]));}}catch(_0x4b9e08){utils['error'](util[_0x1669('0x9')](_0x1669('0x44'),_0x5733e8[_0x1669('0x7')]),_0x4b9e08);}};exports[_0x1669('0x47')]=function(_0x590ea1){try{if(!_[_0x1669('0x25')](channels[_0x590ea1[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util['format'](_0x1669('0x48'),_0x590ea1['uniqueid']),_0x590ea1);if(!_['isNil'](channels[_0x590ea1[_0x1669('0x7')]]['musiconholdstartAt'])){channels[_0x590ea1['uniqueid']][_0x1669('0x49')]+=utils['diffTime'](utils[_0x1669('0x20')](),channels[_0x590ea1[_0x1669('0x7')]][_0x1669('0x45')]);utils[_0x1669('0x8')](util['format'](_0x1669('0x4a'),_0x590ea1['uniqueid'],channels[_0x590ea1['uniqueid']]['mohtime']));delete channels[_0x590ea1[_0x1669('0x7')]][_0x1669('0x45')];}}}catch(_0x25385f){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x48'),_0x590ea1[_0x1669('0x7')]),_0x25385f);}};exports[_0x1669('0x4b')]=function(_0x43636c){try{if(!_[_0x1669('0x25')](channels[_0x43636c[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util['format'](_0x1669('0x4c'),_0x43636c['uniqueid']),_0x43636c);if(!_['isNil'](_0x43636c[_0x1669('0x4d')]['xmd-originatecalleridnum'])){utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0x4e'),_0x43636c[_0x1669('0x7')],_0x43636c['value']));channels[_0x43636c['uniqueid']]['source']=_0x43636c[_0x1669('0x4f')];}if(!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')]['xmd-phone'])){utils['info'](util[_0x1669('0x9')](_0x1669('0x50'),_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c['uniqueid']][_0x1669('0x51')]=_0x43636c[_0x1669('0x4f')];channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x31')]='\x22'+_0x43636c[_0x1669('0x4f')]+'\x22\x20<'+_0x43636c['value']+'>';}if(!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x52')])||!_[_0x1669('0x25')](_0x43636c['variable']['xmd-callerid'])){utils['info'](util['format'](_0x1669('0x53'),_0x43636c[_0x1669('0x7')],!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')]['xmd-callerid-preview'])?_0x1669('0x52'):_0x1669('0x54'),_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x31')]=_0x43636c['value'];}if(!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x55')])||!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x56')])){utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x43636c['uniqueid'],!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')][_0x1669('0x55')])?_0x1669('0x55'):_0x1669('0x56'),_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]]['lastapplication']=_0x1669('0x57');channels[_0x43636c[_0x1669('0x7')]]['lastdata']=_0x43636c[_0x1669('0x4f')];channels[_0x43636c[_0x1669('0x7')]]['queue']=!![];}if(!_['isNil'](_0x43636c[_0x1669('0x4d')][_0x1669('0x58')])){utils[_0x1669('0x8')](util[_0x1669('0x9')](_0x1669('0x59'),_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x5a')]=_0x43636c[_0x1669('0x4f')];}if(!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')][_0x1669('0x5b')])){utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c['uniqueid']][_0x1669('0x5c')]=_0x43636c[_0x1669('0x4f')];}if(!_['isNil'](_0x43636c['variable'][_0x1669('0x5d')])){utils[_0x1669('0x8')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c[_0x1669('0x7')]][_0x1669('0x5e')]=_0x43636c[_0x1669('0x4f')];}if(!_[_0x1669('0x25')](_0x43636c[_0x1669('0x4d')]['sipcallid'])){utils['info'](util[_0x1669('0x9')](_0x1669('0x5f'),_0x43636c[_0x1669('0x7')],_0x43636c[_0x1669('0x4f')]));channels[_0x43636c['uniqueid']][_0x1669('0x60')]=_0x43636c[_0x1669('0x4f')];}}}catch(_0x31bea0){utils[_0x1669('0x22')](util['format'](_0x1669('0x4c'),_0x43636c['uniqueid']),_0x31bea0);}};exports[_0x1669('0x61')]=function(_0x48ba40){try{if(!_['isNil'](channels[_0x48ba40[_0x1669('0x7')]])){utils[_0x1669('0x1b')](util[_0x1669('0x9')](_0x1669('0x62'),_0x48ba40[_0x1669('0x7')]),_0x48ba40);utils[_0x1669('0x8')](util[_0x1669('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x48ba40[_0x1669('0x7')],_0x48ba40[_0x1669('0x63')],_0x48ba40[_0x1669('0x64')]));if(_0x48ba40[_0x1669('0x63')][_0x1669('0x65')]()==_0x1669('0x66')&&_[_0x1669('0x67')](_0x48ba40[_0x1669('0x64')][_0x1669('0x65')](),_0x1669('0x68'))){var _0xaff011=_0x48ba40[_0x1669('0x64')][_0x1669('0x69')]('=');var _0x13ab44=_0xaff011[0x0]['substring'](_0xaff011[0x0][_0x1669('0x6a')]('(')+0x1,_0xaff011[0x0][_0x1669('0x6a')](')'));var _0x332ee7=_0xaff011[0x1];channels[_0x48ba40[_0x1669('0x7')]][_0x13ab44]=_0x332ee7;}if(!_['includes']([_0x1669('0x2f'),_0x1669('0x6b'),_0x1669('0x6c'),_0x1669('0x66'),'gotoif'],_0x48ba40[_0x1669('0x63')][_0x1669('0x65')]())){channels[_0x48ba40[_0x1669('0x7')]][_0x1669('0x6d')]=_0x48ba40[_0x1669('0x63')];channels[_0x48ba40[_0x1669('0x7')]][_0x1669('0x6e')]=_0x48ba40[_0x1669('0x64')];}}}catch(_0x44209d){utils[_0x1669('0x22')](util[_0x1669('0x9')](_0x1669('0x62'),_0x48ba40[_0x1669('0x7')]),_0x44209d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 645f9f1..2aacbfb 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 _0x0f37=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','connect','[core]\x20connected','shutdown','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f37,0x191));var _0x70f3=function(_0x14eafa,_0x1f47c7){_0x14eafa=_0x14eafa-0x0;var _0x20cbd3=_0x0f37[_0x14eafa];return _0x20cbd3;};'use strict';var utils=require('./utils');exports[_0x70f3('0x0')]=function(){utils['info'](_0x70f3('0x1'));};exports[_0x70f3('0x2')]=function(){utils[_0x70f3('0x3')](_0x70f3('0x4'));};exports[_0x70f3('0x5')]=function(){utils[_0x70f3('0x3')](_0x70f3('0x6'));};exports[_0x70f3('0x7')]=function(_0x1fa627){utils[_0x70f3('0x7')]('[core]\x20error',_0x1fa627);};exports[_0x70f3('0x8')]=function(){utils[_0x70f3('0x3')]('[core]\x20close');};exports['managerevent']=function(_0x12adc2){}; \ No newline at end of file +var _0xbf25=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close'];(function(_0x2c2e9c,_0x140732){var _0x213e73=function(_0x49a74f){while(--_0x49a74f){_0x2c2e9c['push'](_0x2c2e9c['shift']());}};_0x213e73(++_0x140732);}(_0xbf25,0x15e));var _0x5bf2=function(_0x2615d5,_0x220722){_0x2615d5=_0x2615d5-0x0;var _0x281e5b=_0xbf25[_0x2615d5];return _0x281e5b;};'use strict';var utils=require(_0x5bf2('0x0'));exports['connect']=function(){utils[_0x5bf2('0x1')](_0x5bf2('0x2'));};exports[_0x5bf2('0x3')]=function(){utils[_0x5bf2('0x1')](_0x5bf2('0x4'));};exports[_0x5bf2('0x5')]=function(){utils['info'](_0x5bf2('0x6'));};exports['error']=function(_0x2f7a18){utils[_0x5bf2('0x7')]('[core]\x20error',_0x2f7a18);};exports[_0x5bf2('0x8')]=function(){utils[_0x5bf2('0x1')](_0x5bf2('0x9'));};exports['managerevent']=function(_0x45af34){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index caebc85..54ae94b 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 _0x77c8=['connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','connectedlinenum','request','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','debug','[%s][dials][dialend]','dialstatus','answertime','lastevent'];(function(_0x1b64b9,_0x5a745e){var _0x229b0d=function(_0x511d0d){while(--_0x511d0d){_0x1b64b9['push'](_0x1b64b9['shift']());}};_0x229b0d(++_0x5a745e);}(_0x77c8,0xd1));var _0x877c=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x77c8[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x877c('0x0'));var util=require(_0x877c('0x1'));var utils=require(_0x877c('0x2'));var dials={};function writeDB(_0x4c8554){utils[_0x877c('0x3')](util['format'](_0x877c('0x4'),_0x4c8554[_0x877c('0x5')],_0x4c8554['channel'],_0x4c8554[_0x877c('0x6')],_0x4c8554['calleridnum'],_0x4c8554[_0x877c('0x7')],_0x4c8554['dialstatus']));utils[_0x877c('0x8')]('CreateVoiceDialReport',_0x4c8554);delete dials[_0x4c8554[_0x877c('0x5')]];}exports['newexten']=function(_0x10a7d5){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x10a7d5['uniqueid']),_0x10a7d5);utils[_0x877c('0x3')](util[_0x877c('0x9')](_0x877c('0xa'),_0x10a7d5[_0x877c('0x5')],_0x10a7d5[_0x877c('0xb')],_0x10a7d5[_0x877c('0xc')]));if(_0x10a7d5[_0x877c('0xb')][_0x877c('0xd')]()==_0x877c('0xe')&&_[_0x877c('0xf')](_0x10a7d5[_0x877c('0xc')][_0x877c('0xd')](),_0x877c('0x10'))){var _0x28574f=_0x10a7d5[_0x877c('0xc')]['split']('=');dials[_0x10a7d5[_0x877c('0x5')]]={'routeId':_0x28574f[0x1]};}}catch(_0x2bee0b){utils['error'](util[_0x877c('0x9')](_0x877c('0x11'),_0x10a7d5[_0x877c('0x5')]),_0x2bee0b);}};exports[_0x877c('0x12')]=function(_0x4cfb1d){try{utils['debug'](util[_0x877c('0x9')](_0x877c('0x13'),_0x4cfb1d[_0x877c('0x5')]),_0x4cfb1d);if(!_[_0x877c('0x14')](_0x4cfb1d['variable']['outboundrouteid'])){utils[_0x877c('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x4cfb1d[_0x877c('0x5')],_0x4cfb1d[_0x877c('0x15')]));dials[_0x4cfb1d[_0x877c('0x5')]]={'routeId':_0x4cfb1d[_0x877c('0x15')]};}}catch(_0x18d540){utils[_0x877c('0x16')](util[_0x877c('0x9')](_0x877c('0x13'),_0x4cfb1d[_0x877c('0x5')]),_0x18d540);}};exports[_0x877c('0x17')]=function(_0x2c9784){try{if(!_[_0x877c('0x14')](dials[_0x2c9784[_0x877c('0x5')]])){utils['debug'](util[_0x877c('0x9')](_0x877c('0x18'),_0x2c9784['uniqueid']),_0x2c9784);dials[_0x2c9784['uniqueid']]=_[_0x877c('0x19')](dials[_0x2c9784['uniqueid']],_0x2c9784);dials[_0x2c9784[_0x877c('0x5')]][_0x877c('0x1a')]=utils[_0x877c('0x1b')]();dials[_0x2c9784[_0x877c('0x5')]]['lastevent']=_0x877c('0x1c');utils['info'](util['format'](_0x877c('0x1d'),_0x2c9784[_0x877c('0x5')],dials[_0x2c9784['uniqueid']][_0x877c('0x1a')]));}}catch(_0x4c47d3){utils[_0x877c('0x16')](util[_0x877c('0x9')](_0x877c('0x18'),_0x2c9784[_0x877c('0x5')]),_0x4c47d3);}};exports[_0x877c('0x1e')]=function(_0x13a94f){try{if(!_['isNil'](dials[_0x13a94f[_0x877c('0x5')]])){utils[_0x877c('0x1f')](util[_0x877c('0x9')](_0x877c('0x20'),_0x13a94f[_0x877c('0x5')]),_0x13a94f);dials[_0x13a94f['uniqueid']][_0x877c('0x21')]=_0x13a94f[_0x877c('0x21')];if(_0x13a94f['dialstatus']=='ANSWER'){dials[_0x13a94f[_0x877c('0x5')]]=_[_0x877c('0x19')](dials[_0x13a94f[_0x877c('0x5')]],_0x13a94f);dials[_0x13a94f['uniqueid']][_0x877c('0x22')]=utils[_0x877c('0x1b')]();dials[_0x13a94f[_0x877c('0x5')]][_0x877c('0x23')]=_0x877c('0x24');utils[_0x877c('0x3')](util[_0x877c('0x9')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x13a94f[_0x877c('0x5')],_0x13a94f[_0x877c('0x21')],dials[_0x13a94f[_0x877c('0x5')]][_0x877c('0x22')]));}else{utils[_0x877c('0x3')](util[_0x877c('0x9')](_0x877c('0x25'),_0x13a94f['uniqueid'],_0x13a94f[_0x877c('0x21')]));}}}catch(_0x54d37a){utils[_0x877c('0x16')](util[_0x877c('0x9')]('[%s][dials][dialend]',_0x13a94f[_0x877c('0x5')]),_0x54d37a);}};exports[_0x877c('0x26')]=function(_0x3241bc){try{if(!_[_0x877c('0x14')](dials[_0x3241bc[_0x877c('0x5')]])){utils[_0x877c('0x1f')](util[_0x877c('0x9')]('[%s][dials][hangup]',_0x3241bc[_0x877c('0x5')]),_0x3241bc);utils['info'](util[_0x877c('0x9')](_0x877c('0x27'),_0x3241bc[_0x877c('0x5')],_0x3241bc[_0x877c('0x28')],_0x3241bc[_0x877c('0x29')],_0x3241bc[_0x877c('0x2a')]));dials[_0x3241bc[_0x877c('0x5')]]=_[_0x877c('0x19')](dials[_0x3241bc[_0x877c('0x5')]],{'endtime':utils[_0x877c('0x1b')](),'lastevent':_0x877c('0x2b')});dials[_0x3241bc['uniqueid']][_0x877c('0x2c')]=utils[_0x877c('0x2d')](dials[_0x3241bc['uniqueid']][_0x877c('0x2e')],dials[_0x3241bc[_0x877c('0x5')]][_0x877c('0x1a')]);dials[_0x3241bc[_0x877c('0x5')]]['holdtime']=utils[_0x877c('0x2d')](dials[_0x3241bc['uniqueid']][_0x877c('0x22')]||dials[_0x3241bc[_0x877c('0x5')]][_0x877c('0x2e')],dials[_0x3241bc[_0x877c('0x5')]][_0x877c('0x1a')]);dials[_0x3241bc[_0x877c('0x5')]][_0x877c('0x2f')]=dials[_0x3241bc[_0x877c('0x5')]][_0x877c('0x22')]?utils[_0x877c('0x2d')](dials[_0x3241bc[_0x877c('0x5')]][_0x877c('0x2e')],dials[_0x3241bc['uniqueid']]['answertime']):0x0;writeDB(dials[_0x3241bc[_0x877c('0x5')]]);}}catch(_0x286c5e){utils[_0x877c('0x16')](util[_0x877c('0x9')](_0x877c('0x30'),_0x3241bc[_0x877c('0x5')]),_0x286c5e);}}; \ No newline at end of file +var _0xda06=['isNil','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin'];(function(_0x24f67a,_0x52e463){var _0x4252d4=function(_0x369a14){while(--_0x369a14){_0x24f67a['push'](_0x24f67a['shift']());}};_0x4252d4(++_0x52e463);}(_0xda06,0x7d));var _0x6da0=function(_0x42ec18,_0xb9213b){_0x42ec18=_0x42ec18-0x0;var _0x434827=_0xda06[_0x42ec18];return _0x434827;};'use strict';var _=require(_0x6da0('0x0'));var util=require('util');var utils=require(_0x6da0('0x1'));var dials={};function writeDB(_0x3182f9){utils[_0x6da0('0x2')](util[_0x6da0('0x3')](_0x6da0('0x4'),_0x3182f9['uniqueid'],_0x3182f9['channel'],_0x3182f9[_0x6da0('0x5')],_0x3182f9[_0x6da0('0x6')],_0x3182f9[_0x6da0('0x7')],_0x3182f9[_0x6da0('0x8')]));utils[_0x6da0('0x9')](_0x6da0('0xa'),_0x3182f9);delete dials[_0x3182f9[_0x6da0('0xb')]];}exports[_0x6da0('0xc')]=function(_0x348c50){try{utils[_0x6da0('0xd')](util[_0x6da0('0x3')](_0x6da0('0xe'),_0x348c50['uniqueid']),_0x348c50);utils[_0x6da0('0x2')](util['format'](_0x6da0('0xf'),_0x348c50['uniqueid'],_0x348c50[_0x6da0('0x10')],_0x348c50[_0x6da0('0x11')]));if(_0x348c50[_0x6da0('0x10')][_0x6da0('0x12')]()=='set'&&_[_0x6da0('0x13')](_0x348c50['appdata']['toLowerCase'](),_0x6da0('0x14'))){var _0x2210c9=_0x348c50[_0x6da0('0x11')][_0x6da0('0x15')]('=');dials[_0x348c50[_0x6da0('0xb')]]={'routeId':_0x2210c9[0x1]};}}catch(_0x20c504){utils[_0x6da0('0x16')](util[_0x6da0('0x3')](_0x6da0('0xe'),_0x348c50['uniqueid']),_0x20c504);}};exports[_0x6da0('0x17')]=function(_0x50641b){try{utils[_0x6da0('0xd')](util['format'](_0x6da0('0x18'),_0x50641b['uniqueid']),_0x50641b);if(!_['isNil'](_0x50641b['variable']['outboundrouteid'])){utils['info'](util['format'](_0x6da0('0x19'),_0x50641b[_0x6da0('0xb')],_0x50641b[_0x6da0('0x1a')]));dials[_0x50641b['uniqueid']]={'routeId':_0x50641b[_0x6da0('0x1a')]};}}catch(_0xc97b5b){utils[_0x6da0('0x16')](util[_0x6da0('0x3')]('[%s][dials][varset]',_0x50641b[_0x6da0('0xb')]),_0xc97b5b);}};exports[_0x6da0('0x1b')]=function(_0xe26e94){try{if(!_[_0x6da0('0x1c')](dials[_0xe26e94[_0x6da0('0xb')]])){utils[_0x6da0('0xd')](util[_0x6da0('0x3')](_0x6da0('0x1d'),_0xe26e94[_0x6da0('0xb')]),_0xe26e94);dials[_0xe26e94['uniqueid']]=_[_0x6da0('0x1e')](dials[_0xe26e94['uniqueid']],_0xe26e94);dials[_0xe26e94[_0x6da0('0xb')]][_0x6da0('0x1f')]=utils[_0x6da0('0x20')]();dials[_0xe26e94[_0x6da0('0xb')]]['lastevent']=_0x6da0('0x21');utils[_0x6da0('0x2')](util[_0x6da0('0x3')](_0x6da0('0x22'),_0xe26e94[_0x6da0('0xb')],dials[_0xe26e94['uniqueid']][_0x6da0('0x1f')]));}}catch(_0x270d59){utils[_0x6da0('0x16')](util[_0x6da0('0x3')]('[%s][dials][dialbegin]',_0xe26e94[_0x6da0('0xb')]),_0x270d59);}};exports[_0x6da0('0x23')]=function(_0x1b9d33){try{if(!_['isNil'](dials[_0x1b9d33[_0x6da0('0xb')]])){utils[_0x6da0('0xd')](util[_0x6da0('0x3')](_0x6da0('0x24'),_0x1b9d33[_0x6da0('0xb')]),_0x1b9d33);dials[_0x1b9d33[_0x6da0('0xb')]]['dialstatus']=_0x1b9d33[_0x6da0('0x8')];if(_0x1b9d33[_0x6da0('0x8')]==_0x6da0('0x25')){dials[_0x1b9d33[_0x6da0('0xb')]]=_[_0x6da0('0x1e')](dials[_0x1b9d33[_0x6da0('0xb')]],_0x1b9d33);dials[_0x1b9d33[_0x6da0('0xb')]][_0x6da0('0x26')]=utils[_0x6da0('0x20')]();dials[_0x1b9d33[_0x6da0('0xb')]][_0x6da0('0x27')]=_0x6da0('0x28');utils[_0x6da0('0x2')](util[_0x6da0('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1b9d33[_0x6da0('0xb')],_0x1b9d33['dialstatus'],dials[_0x1b9d33[_0x6da0('0xb')]]['answertime']));}else{utils['info'](util[_0x6da0('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x1b9d33[_0x6da0('0xb')],_0x1b9d33[_0x6da0('0x8')]));}}}catch(_0xf294d6){utils[_0x6da0('0x16')](util[_0x6da0('0x3')](_0x6da0('0x24'),_0x1b9d33['uniqueid']),_0xf294d6);}};exports[_0x6da0('0x29')]=function(_0x488b73){try{if(!_['isNil'](dials[_0x488b73[_0x6da0('0xb')]])){utils[_0x6da0('0xd')](util[_0x6da0('0x3')](_0x6da0('0x2a'),_0x488b73[_0x6da0('0xb')]),_0x488b73);utils['info'](util[_0x6da0('0x3')](_0x6da0('0x2b'),_0x488b73[_0x6da0('0xb')],_0x488b73[_0x6da0('0x6')],_0x488b73[_0x6da0('0x2c')],_0x488b73[_0x6da0('0x2d')]));dials[_0x488b73['uniqueid']]=_[_0x6da0('0x1e')](dials[_0x488b73[_0x6da0('0xb')]],{'endtime':utils[_0x6da0('0x20')](),'lastevent':_0x6da0('0x2e')});dials[_0x488b73[_0x6da0('0xb')]][_0x6da0('0x2f')]=utils[_0x6da0('0x30')](dials[_0x488b73['uniqueid']][_0x6da0('0x31')],dials[_0x488b73[_0x6da0('0xb')]][_0x6da0('0x1f')]);dials[_0x488b73['uniqueid']][_0x6da0('0x32')]=utils['diffTime'](dials[_0x488b73[_0x6da0('0xb')]]['answertime']||dials[_0x488b73[_0x6da0('0xb')]][_0x6da0('0x31')],dials[_0x488b73[_0x6da0('0xb')]][_0x6da0('0x1f')]);dials[_0x488b73[_0x6da0('0xb')]]['billableseconds']=dials[_0x488b73['uniqueid']][_0x6da0('0x26')]?utils[_0x6da0('0x30')](dials[_0x488b73[_0x6da0('0xb')]][_0x6da0('0x31')],dials[_0x488b73[_0x6da0('0xb')]][_0x6da0('0x26')]):0x0;writeDB(dials[_0x488b73['uniqueid']]);}}catch(_0x3219d4){utils['error'](util[_0x6da0('0x3')](_0x6da0('0x2a'),_0x488b73['uniqueid']),_0x3219d4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c493ad5..b4c1bc3 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 _0xab46=['xdr','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','asterisk','username','password','keepConnected'];(function(_0x3e88f4,_0x21a34e){var _0x41740a=function(_0xc2c7d){while(--_0xc2c7d){_0x3e88f4['push'](_0x3e88f4['shift']());}};_0x41740a(++_0x21a34e);}(_0xab46,0xfe));var _0x6ab4=function(_0x362d6a,_0x253e0d){_0x362d6a=_0x362d6a-0x0;var _0x2af49e=_0xab46[_0x362d6a];return _0x2af49e;};var AsteriskManager=require('asterisk-manager');var config=require(_0x6ab4('0x0'));var utils=require('./utils');var util=require(_0x6ab4('0x1'));var ami=new AsteriskManager(config[_0x6ab4('0x2')]['port'],config[_0x6ab4('0x2')]['ip'],config['asterisk'][_0x6ab4('0x3')],config[_0x6ab4('0x2')][_0x6ab4('0x4')],!![]);ami[_0x6ab4('0x5')]();if(config['xdr']&&config[_0x6ab4('0x6')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x6ab4('0x7'));var calls=require(_0x6ab4('0x8'));var queues=require(_0x6ab4('0x9'));var recordings=require(_0x6ab4('0xa'));var members=require(_0x6ab4('0xb'));var dials=require(_0x6ab4('0xc'));var transfers=require(_0x6ab4('0xd'));var core=require('./core.controller');ami['on'](_0x6ab4('0xe'),core[_0x6ab4('0xe')]);ami['on']('shutdown',core[_0x6ab4('0xf')]);ami['on'](_0x6ab4('0x10'),core[_0x6ab4('0x10')]);ami['on']('error',core[_0x6ab4('0x11')]);ami['on'](_0x6ab4('0x12'),core['close']);ami['on']('managerevent',core[_0x6ab4('0x13')]);ami['on'](_0x6ab4('0x14'),function(_0x4cbb09){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x17'),_0x4cbb09['device']),_0x4cbb09);members[_0x6ab4('0x14')](_0x4cbb09);}catch(_0x1c2e6c){utils[_0x6ab4('0x11')](util['format'](_0x6ab4('0x17'),_0x4cbb09[_0x6ab4('0x18')]),_0x1c2e6c);}});ami['on']('agentcalled',function(_0x4c3cb4){try{utils[_0x6ab4('0x15')](util['format'](_0x6ab4('0x19'),_0x4c3cb4[_0x6ab4('0x1a')]),_0x4c3cb4);agents[_0x6ab4('0x1b')](_0x4c3cb4);}catch(_0x5a834d){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')]('[%s][index][agentcalled]',_0x4c3cb4[_0x6ab4('0x1a')]),_0x5a834d);}});ami['on'](_0x6ab4('0x1c'),function(_0x59969e){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x1d'),_0x59969e[_0x6ab4('0x1a')]),_0x59969e);agents[_0x6ab4('0x1c')](_0x59969e);}catch(_0x5f401c){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x1d'),_0x59969e[_0x6ab4('0x1a')]),_0x5f401c);}});ami['on'](_0x6ab4('0x1e'),function(_0x11a2c7){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')]('[%s][index][agentconnect]',_0x11a2c7[_0x6ab4('0x1a')]),_0x11a2c7);agents['agentconnect'](_0x11a2c7);queues[_0x6ab4('0x1e')](_0x11a2c7);}catch(_0x10d03f){utils['error'](util['format'](_0x6ab4('0x1f'),_0x11a2c7[_0x6ab4('0x1a')]),_0x10d03f);}});ami['on'](_0x6ab4('0x20'),function(_0x59c15b){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x21'),_0x59c15b[_0x6ab4('0x1a')]),_0x59c15b);agents[_0x6ab4('0x20')](_0x59c15b);queues[_0x6ab4('0x20')](_0x59c15b);members[_0x6ab4('0x20')](_0x59c15b);}catch(_0x5835a0){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x21'),_0x59c15b[_0x6ab4('0x1a')]),_0x5835a0);}});ami['on'](_0x6ab4('0x22'),function(_0x242e6e){try{utils[_0x6ab4('0x15')](util['format']('[%s][index][queuecallerabandon]',_0x242e6e[_0x6ab4('0x1a')]),_0x242e6e);agents['queuecallerabandon'](_0x242e6e);queues[_0x6ab4('0x22')](_0x242e6e);}catch(_0x24e6f7){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x23'),_0x242e6e[_0x6ab4('0x1a')]),_0x24e6f7);}});ami['on'](_0x6ab4('0x24'),function(_0x7adb67){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x25'),_0x7adb67[_0x6ab4('0x1a')]),_0x7adb67);queues[_0x6ab4('0x24')](_0x7adb67);recordings['queuecallerjoin'](_0x7adb67);}catch(_0x4ad7d0){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x25'),_0x7adb67[_0x6ab4('0x1a')]),_0x4ad7d0);}});ami['on'](_0x6ab4('0x26'),function(_0x3ad373){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')]('[%s][index][queuecallerleave]',_0x3ad373[_0x6ab4('0x1a')]),_0x3ad373);queues['queuecallerleave'](_0x3ad373);}catch(_0x41cab9){utils[_0x6ab4('0x11')](util['format'](_0x6ab4('0x27'),_0x3ad373[_0x6ab4('0x1a')]),_0x41cab9);}});ami['on'](_0x6ab4('0x28'),function(_0x3abd36){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x29'),_0x3abd36[_0x6ab4('0x1a')]),_0x3abd36);queues['musiconholdstart'](_0x3abd36);calls[_0x6ab4('0x28')](_0x3abd36);}catch(_0x4e8b6b){utils['error'](util[_0x6ab4('0x16')](_0x6ab4('0x29'),_0x3abd36[_0x6ab4('0x1a')]),_0x4e8b6b);}});ami['on'](_0x6ab4('0x2a'),function(_0x366b2f){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x2b'),_0x366b2f[_0x6ab4('0x1a')]),_0x366b2f);queues[_0x6ab4('0x2a')](_0x366b2f);calls['musiconholdstop'](_0x366b2f);}catch(_0x2aefcc){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')]('[%s][index][musiconholdstop]',_0x366b2f[_0x6ab4('0x1a')]),_0x2aefcc);}});ami['on']('newstate',function(_0x238a23){try{utils['debug'](util['format']('[%s][index][newstate]',_0x238a23[_0x6ab4('0x1a')]),_0x238a23);calls['newstate'](_0x238a23);recordings['newstate'](_0x238a23);}catch(_0x32d449){utils['error'](util[_0x6ab4('0x16')](_0x6ab4('0x2c'),_0x238a23[_0x6ab4('0x1a')]),_0x32d449);}});ami['on'](_0x6ab4('0x2d'),function(_0x350c3e){try{utils['debug'](util[_0x6ab4('0x16')](_0x6ab4('0x2e'),_0x350c3e[_0x6ab4('0x1a')]),_0x350c3e);calls['hangup'](_0x350c3e);recordings['hangup'](_0x350c3e);dials[_0x6ab4('0x2d')](_0x350c3e);agents['hangup'](_0x350c3e);queues[_0x6ab4('0x2d')](_0x350c3e);}catch(_0x3f2723){utils['error'](util[_0x6ab4('0x16')](_0x6ab4('0x2e'),_0x350c3e['uniqueid']),_0x3f2723);}});ami['on'](_0x6ab4('0x2f'),function(_0x1b8897){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')]('[%s][index][cdr]',_0x1b8897['uniqueid']),_0x1b8897);members['cdr'](_0x1b8897);}catch(_0x4893f9){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x30'),_0x1b8897[_0x6ab4('0x1a')]),_0x4893f9);}});ami['on'](_0x6ab4('0x31'),function(_0x37d068){try{utils['debug'](util[_0x6ab4('0x16')](_0x6ab4('0x32'),_0x37d068[_0x6ab4('0x1a')]),_0x37d068);queues[_0x6ab4('0x31')](_0x37d068);agents[_0x6ab4('0x31')](_0x37d068);transfers['blindtransfer'](_0x37d068);recordings[_0x6ab4('0x31')](_0x37d068);}catch(_0x4a0759){utils[_0x6ab4('0x11')](util['format']('[%s][index][blindtransfer]',_0x37d068[_0x6ab4('0x1a')]),_0x4a0759);}});ami['on'](_0x6ab4('0x33'),function(_0x598f3f){try{utils['debug'](util[_0x6ab4('0x16')](_0x6ab4('0x34'),_0x598f3f[_0x6ab4('0x35')]),_0x598f3f);queues[_0x6ab4('0x33')](_0x598f3f);transfers[_0x6ab4('0x33')](_0x598f3f);agents[_0x6ab4('0x33')](_0x598f3f);calls[_0x6ab4('0x33')](_0x598f3f);}catch(_0x4467c9){utils['error'](util['format']('[%s][index][attendedtransfer]',_0x598f3f['origtransfereruniqueid']),_0x4467c9);}});ami['on'](_0x6ab4('0x36'),function(_0x2b7627){try{utils[_0x6ab4('0x15')](util['format'](_0x6ab4('0x37'),_0x2b7627['uniqueid']),_0x2b7627);queues[_0x6ab4('0x36')](_0x2b7627);recordings[_0x6ab4('0x36')](_0x2b7627);calls[_0x6ab4('0x36')](_0x2b7627);dials['varset'](_0x2b7627);}catch(_0x4a06bb){utils['error'](util[_0x6ab4('0x16')](_0x6ab4('0x37'),_0x2b7627[_0x6ab4('0x1a')]),_0x4a06bb);}});ami['on']('newexten',function(_0x2cfc53){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x38'),_0x2cfc53[_0x6ab4('0x1a')]),_0x2cfc53);calls['newexten'](_0x2cfc53);recordings['newexten'](_0x2cfc53);dials[_0x6ab4('0x39')](_0x2cfc53);}catch(_0x61b2ce){utils['error'](util[_0x6ab4('0x16')](_0x6ab4('0x38'),_0x2cfc53[_0x6ab4('0x1a')]),_0x61b2ce);}});ami['on'](_0x6ab4('0x3a'),function(_0x226d88){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')](_0x6ab4('0x3b'),_0x226d88[_0x6ab4('0x1a')]),_0x226d88);calls[_0x6ab4('0x3a')](_0x226d88);recordings[_0x6ab4('0x3a')](_0x226d88);}catch(_0x5ad742){utils['error'](util[_0x6ab4('0x16')]('[%s][index][newchannel]',_0x226d88[_0x6ab4('0x1a')]),_0x5ad742);}});ami['on'](_0x6ab4('0x3c'),function(_0x33b152){try{utils['debug'](util[_0x6ab4('0x16')](_0x6ab4('0x3d'),_0x33b152[_0x6ab4('0x1a')]),_0x33b152);dials[_0x6ab4('0x3c')](_0x33b152);}catch(_0x534c32){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x3e'),_0x33b152['uniqueid']),_0x534c32);}});ami['on'](_0x6ab4('0x3f'),function(_0x1e8951){try{utils[_0x6ab4('0x15')](util[_0x6ab4('0x16')]('[%s][index][dialend]',_0x1e8951['uniqueid']),_0x1e8951);dials['dialend'](_0x1e8951);}catch(_0x252b91){utils[_0x6ab4('0x11')](util[_0x6ab4('0x16')](_0x6ab4('0x40'),_0x1e8951[_0x6ab4('0x1a')]),_0x252b91);}});} \ No newline at end of file +var _0xbbd9=['./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%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]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller'];(function(_0x52b562,_0x383da1){var _0x35328a=function(_0xb5193d){while(--_0xb5193d){_0x52b562['push'](_0x52b562['shift']());}};_0x35328a(++_0x383da1);}(_0xbbd9,0x7e));var _0x9bbd=function(_0x15da5f,_0x3fce0e){_0x15da5f=_0x15da5f-0x0;var _0x1992f1=_0xbbd9[_0x15da5f];return _0x1992f1;};var AsteriskManager=require(_0x9bbd('0x0'));var config=require(_0x9bbd('0x1'));var utils=require('./utils');var util=require(_0x9bbd('0x2'));var ami=new AsteriskManager(config[_0x9bbd('0x3')][_0x9bbd('0x4')],config['asterisk']['ip'],config[_0x9bbd('0x3')][_0x9bbd('0x5')],config[_0x9bbd('0x3')][_0x9bbd('0x6')],!![]);ami[_0x9bbd('0x7')]();if(config[_0x9bbd('0x8')]&&config[_0x9bbd('0x8')][_0x9bbd('0x9')]){utils[_0x9bbd('0xa')](_0x9bbd('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0x9bbd('0xc'));var queues=require(_0x9bbd('0xd'));var recordings=require('./recordings.controller');var members=require(_0x9bbd('0xe'));var dials=require(_0x9bbd('0xf'));var transfers=require(_0x9bbd('0x10'));var core=require(_0x9bbd('0x11'));ami['on'](_0x9bbd('0x12'),core[_0x9bbd('0x12')]);ami['on'](_0x9bbd('0x13'),core['shutdown']);ami['on'](_0x9bbd('0x14'),core[_0x9bbd('0x14')]);ami['on'](_0x9bbd('0x15'),core[_0x9bbd('0x15')]);ami['on'](_0x9bbd('0x16'),core[_0x9bbd('0x16')]);ami['on'](_0x9bbd('0x17'),core[_0x9bbd('0x17')]);ami['on'](_0x9bbd('0x18'),function(_0x558ecd){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x1b'),_0x558ecd[_0x9bbd('0x1c')]),_0x558ecd);members[_0x9bbd('0x18')](_0x558ecd);}catch(_0xd56898){utils['error'](util[_0x9bbd('0x1a')]('[%s][index][devicestatechange]',_0x558ecd['device']),_0xd56898);}});ami['on'](_0x9bbd('0x1d'),function(_0x19ed5a){try{utils['debug'](util[_0x9bbd('0x1a')](_0x9bbd('0x1e'),_0x19ed5a[_0x9bbd('0x1f')]),_0x19ed5a);agents[_0x9bbd('0x1d')](_0x19ed5a);}catch(_0x220046){utils[_0x9bbd('0x15')](util[_0x9bbd('0x1a')](_0x9bbd('0x1e'),_0x19ed5a[_0x9bbd('0x1f')]),_0x220046);}});ami['on'](_0x9bbd('0x20'),function(_0x5f0344){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x21'),_0x5f0344[_0x9bbd('0x1f')]),_0x5f0344);agents['agentringnoanswer'](_0x5f0344);}catch(_0x469203){utils[_0x9bbd('0x15')](util['format'](_0x9bbd('0x21'),_0x5f0344['uniqueid']),_0x469203);}});ami['on'](_0x9bbd('0x22'),function(_0x336377){try{utils['debug'](util[_0x9bbd('0x1a')](_0x9bbd('0x23'),_0x336377[_0x9bbd('0x1f')]),_0x336377);agents['agentconnect'](_0x336377);queues[_0x9bbd('0x22')](_0x336377);}catch(_0x4adc1a){utils['error'](util[_0x9bbd('0x1a')](_0x9bbd('0x23'),_0x336377[_0x9bbd('0x1f')]),_0x4adc1a);}});ami['on'](_0x9bbd('0x24'),function(_0x374388){try{utils['debug'](util[_0x9bbd('0x1a')](_0x9bbd('0x25'),_0x374388[_0x9bbd('0x1f')]),_0x374388);agents['agentcomplete'](_0x374388);queues[_0x9bbd('0x24')](_0x374388);members[_0x9bbd('0x24')](_0x374388);}catch(_0x4ab365){utils['error'](util['format'](_0x9bbd('0x25'),_0x374388[_0x9bbd('0x1f')]),_0x4ab365);}});ami['on'](_0x9bbd('0x26'),function(_0x1f0b25){try{utils[_0x9bbd('0x19')](util['format'](_0x9bbd('0x27'),_0x1f0b25['uniqueid']),_0x1f0b25);agents[_0x9bbd('0x26')](_0x1f0b25);queues[_0x9bbd('0x26')](_0x1f0b25);}catch(_0x1839df){utils['error'](util['format'](_0x9bbd('0x27'),_0x1f0b25['uniqueid']),_0x1839df);}});ami['on'](_0x9bbd('0x28'),function(_0x48b993){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x29'),_0x48b993[_0x9bbd('0x1f')]),_0x48b993);queues['queuecallerjoin'](_0x48b993);recordings[_0x9bbd('0x28')](_0x48b993);}catch(_0x408aaf){utils['error'](util['format'](_0x9bbd('0x29'),_0x48b993[_0x9bbd('0x1f')]),_0x408aaf);}});ami['on'](_0x9bbd('0x2a'),function(_0x20b995){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x2b'),_0x20b995[_0x9bbd('0x1f')]),_0x20b995);queues[_0x9bbd('0x2a')](_0x20b995);}catch(_0x3aea1f){utils[_0x9bbd('0x15')](util['format']('[%s][index][queuecallerleave]',_0x20b995['uniqueid']),_0x3aea1f);}});ami['on'](_0x9bbd('0x2c'),function(_0x5db0bc){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x2d'),_0x5db0bc[_0x9bbd('0x1f')]),_0x5db0bc);queues['musiconholdstart'](_0x5db0bc);calls['musiconholdstart'](_0x5db0bc);}catch(_0x3d4ba6){utils[_0x9bbd('0x15')](util[_0x9bbd('0x1a')]('[%s][index][musiconholdstart]',_0x5db0bc['uniqueid']),_0x3d4ba6);}});ami['on'](_0x9bbd('0x2e'),function(_0x2edba2){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')]('[%s][index][musiconholdstop]',_0x2edba2[_0x9bbd('0x1f')]),_0x2edba2);queues[_0x9bbd('0x2e')](_0x2edba2);calls[_0x9bbd('0x2e')](_0x2edba2);}catch(_0x299caa){utils[_0x9bbd('0x15')](util['format'](_0x9bbd('0x2f'),_0x2edba2[_0x9bbd('0x1f')]),_0x299caa);}});ami['on'](_0x9bbd('0x30'),function(_0x299525){try{utils['debug'](util['format'](_0x9bbd('0x31'),_0x299525[_0x9bbd('0x1f')]),_0x299525);calls[_0x9bbd('0x30')](_0x299525);recordings[_0x9bbd('0x30')](_0x299525);}catch(_0x232c2c){utils[_0x9bbd('0x15')](util['format'](_0x9bbd('0x31'),_0x299525[_0x9bbd('0x1f')]),_0x232c2c);}});ami['on'](_0x9bbd('0x32'),function(_0x5efd0e){try{utils['debug'](util['format'](_0x9bbd('0x33'),_0x5efd0e[_0x9bbd('0x1f')]),_0x5efd0e);calls[_0x9bbd('0x32')](_0x5efd0e);recordings['hangup'](_0x5efd0e);dials['hangup'](_0x5efd0e);agents['hangup'](_0x5efd0e);queues[_0x9bbd('0x32')](_0x5efd0e);}catch(_0x4d6db8){utils[_0x9bbd('0x15')](util['format'](_0x9bbd('0x33'),_0x5efd0e[_0x9bbd('0x1f')]),_0x4d6db8);}});ami['on'](_0x9bbd('0x34'),function(_0x123975){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x35'),_0x123975[_0x9bbd('0x1f')]),_0x123975);members[_0x9bbd('0x34')](_0x123975);}catch(_0x103546){utils['error'](util[_0x9bbd('0x1a')]('[%s][index][cdr]',_0x123975[_0x9bbd('0x1f')]),_0x103546);}});ami['on'](_0x9bbd('0x36'),function(_0x6aa821){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x37'),_0x6aa821[_0x9bbd('0x1f')]),_0x6aa821);queues[_0x9bbd('0x36')](_0x6aa821);agents['blindtransfer'](_0x6aa821);transfers[_0x9bbd('0x36')](_0x6aa821);recordings[_0x9bbd('0x36')](_0x6aa821);}catch(_0x451f5b){utils[_0x9bbd('0x15')](util['format'](_0x9bbd('0x37'),_0x6aa821[_0x9bbd('0x1f')]),_0x451f5b);}});ami['on']('attendedtransfer',function(_0x530640){try{utils['debug'](util[_0x9bbd('0x1a')](_0x9bbd('0x38'),_0x530640[_0x9bbd('0x39')]),_0x530640);queues[_0x9bbd('0x3a')](_0x530640);transfers[_0x9bbd('0x3a')](_0x530640);agents[_0x9bbd('0x3a')](_0x530640);calls[_0x9bbd('0x3a')](_0x530640);}catch(_0x517725){utils[_0x9bbd('0x15')](util['format']('[%s][index][attendedtransfer]',_0x530640[_0x9bbd('0x39')]),_0x517725);}});ami['on'](_0x9bbd('0x3b'),function(_0x11d1e1){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x3c'),_0x11d1e1[_0x9bbd('0x1f')]),_0x11d1e1);queues[_0x9bbd('0x3b')](_0x11d1e1);recordings['varset'](_0x11d1e1);calls['varset'](_0x11d1e1);dials['varset'](_0x11d1e1);}catch(_0xd2f7f1){utils['error'](util[_0x9bbd('0x1a')](_0x9bbd('0x3c'),_0x11d1e1[_0x9bbd('0x1f')]),_0xd2f7f1);}});ami['on'](_0x9bbd('0x3d'),function(_0x41731c){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')]('[%s][index][newexten]',_0x41731c[_0x9bbd('0x1f')]),_0x41731c);calls['newexten'](_0x41731c);recordings['newexten'](_0x41731c);dials[_0x9bbd('0x3d')](_0x41731c);}catch(_0x4e1cb7){utils[_0x9bbd('0x15')](util[_0x9bbd('0x1a')](_0x9bbd('0x3e'),_0x41731c[_0x9bbd('0x1f')]),_0x4e1cb7);}});ami['on'](_0x9bbd('0x3f'),function(_0x4d1955){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')]('[%s][index][newchannel]',_0x4d1955[_0x9bbd('0x1f')]),_0x4d1955);calls['newchannel'](_0x4d1955);recordings['newchannel'](_0x4d1955);}catch(_0x3801cc){utils[_0x9bbd('0x15')](util[_0x9bbd('0x1a')](_0x9bbd('0x40'),_0x4d1955[_0x9bbd('0x1f')]),_0x3801cc);}});ami['on'](_0x9bbd('0x41'),function(_0x32394e){try{utils[_0x9bbd('0x19')](util[_0x9bbd('0x1a')](_0x9bbd('0x42'),_0x32394e[_0x9bbd('0x1f')]),_0x32394e);dials[_0x9bbd('0x41')](_0x32394e);}catch(_0x37a40b){utils[_0x9bbd('0x15')](util[_0x9bbd('0x1a')](_0x9bbd('0x43'),_0x32394e[_0x9bbd('0x1f')]),_0x37a40b);}});ami['on'](_0x9bbd('0x44'),function(_0x25071f){try{utils[_0x9bbd('0x19')](util['format'](_0x9bbd('0x45'),_0x25071f[_0x9bbd('0x1f')]),_0x25071f);dials[_0x9bbd('0x44')](_0x25071f);}catch(_0x13a400){utils[_0x9bbd('0x15')](util[_0x9bbd('0x1a')](_0x9bbd('0x45'),_0x25071f[_0x9bbd('0x1f')]),_0x13a400);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c48e7d9..7562cc1 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 _0xadff=['interface','channel','data2','membername','type','then','internal','request','split','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','error','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s'];(function(_0x34267b,_0x16d992){var _0x5e32b9=function(_0x38954a){while(--_0x38954a){_0x34267b['push'](_0x34267b['shift']());}};_0x5e32b9(++_0x16d992);}(_0xadff,0xf8));var _0xfadf=function(_0x30a87a,_0x3f9c41){_0x30a87a=_0x30a87a-0x0;var _0x51cb58=_0xadff[_0x30a87a];return _0x51cb58;};'use strict';var _=require('lodash');var util=require(_0xfadf('0x0'));var utils=require(_0xfadf('0x1'));var members={};var exclude=[_0xfadf('0x2'),_0xfadf('0x3')];function writeDB(_0x2df5fe){utils[_0xfadf('0x4')](util[_0xfadf('0x5')](_0xfadf('0x6'),_0x2df5fe['uniqueid'],_0x2df5fe[_0xfadf('0x7')],_0x2df5fe[_0xfadf('0x8')],_0x2df5fe[_0xfadf('0x9')],_0x2df5fe[_0xfadf('0xa')],_0x2df5fe[_0xfadf('0xb')]));if(_0x2df5fe['interface']){utils['getUserByInterface'](_0x2df5fe[_0xfadf('0x7')])[_0xfadf('0xc')](function(_0x61d393){if(_0x61d393){_0x2df5fe['membername']=_0x61d393['name'];_0x2df5fe[_0xfadf('0xd')]=_0x61d393[_0xfadf('0xd')];utils[_0xfadf('0xe')]('CreateMemberReport',_0x2df5fe);}else{utils['getUserByName'](_0x2df5fe['interface'][_0xfadf('0xf')]('/')[0x1])[_0xfadf('0xc')](function(_0x18d365){if(_0x18d365){_0x2df5fe['membername']=_0x18d365['name'];_0x2df5fe['internal']=_0x18d365[_0xfadf('0xd')];utils['request']('CreateMemberReport',_0x2df5fe);}});}})['catch'](function(_0x454474){utils['error'](util[_0xfadf('0x5')](_0xfadf('0x10'),_0x2df5fe[_0xfadf('0x11')]),_0x454474);});}delete members[_0x2df5fe[_0xfadf('0x7')]];}function startsWith(_0x5c6711,_0xf2c1e2){return _[_0xfadf('0x12')](_0x5c6711,function(_0x596a5e){return _[_0xfadf('0x13')](_0xf2c1e2,_0x596a5e);});}exports[_0xfadf('0x14')]=function(_0x172454){try{utils['debug'](util[_0xfadf('0x5')](_0xfadf('0x15'),members[_0x172454[_0xfadf('0x16')]]?members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x11')]:_0x172454[_0xfadf('0x16')]),_0x172454);utils[_0xfadf('0x4')](util[_0xfadf('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x172454['device']]?members[_0x172454['device']][_0xfadf('0x11')]:_0x172454['device'],_0x172454[_0xfadf('0x17')],_0x172454['device']));switch(_0x172454[_0xfadf('0x17')]){case _0xfadf('0x18'):case _0xfadf('0x19'):if(!startsWith(exclude,_0x172454[_0xfadf('0x16')])){members[_0x172454[_0xfadf('0x16')]]={'channel':_0xfadf('0x1a'),'interface':_0x172454[_0xfadf('0x16')],'type':_0xfadf('0x1b'),'enterAt':utils[_0xfadf('0x1c')](),'role':_0xfadf('0x1d')};}break;case _0xfadf('0x1e'):if(!_[_0xfadf('0x1f')](members[_0x172454[_0xfadf('0x16')]])){members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x20')]=utils[_0xfadf('0x1c')]();members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x21')]=utils[_0xfadf('0x22')](members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x20')],members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x23')]);if(members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x11')]){writeDB(members[_0x172454['device']]);}}break;default:break;}}catch(_0x5d8c42){utils['error'](util[_0xfadf('0x5')]('[%s][members][devicestatechange]',members[_0x172454[_0xfadf('0x16')]]?members[_0x172454[_0xfadf('0x16')]][_0xfadf('0x11')]:_0x172454[_0xfadf('0x16')]),_0x5d8c42);}};exports[_0xfadf('0x24')]=function(_0x34e471){try{if(!_[_0xfadf('0x1f')](members[_0x34e471[_0xfadf('0x7')]])){utils[_0xfadf('0x25')](util[_0xfadf('0x5')](_0xfadf('0x26'),_0x34e471[_0xfadf('0x11')]),_0x34e471);utils[_0xfadf('0x4')](util[_0xfadf('0x5')](_0xfadf('0x27'),_0x34e471[_0xfadf('0x11')],_0x34e471['interface'],_0x34e471['queue']));members[_0x34e471[_0xfadf('0x7')]]=_[_0xfadf('0x28')](members[_0x34e471['interface']],{'data4':_0x34e471[_0xfadf('0x29')],'uniqueid':_0x34e471[_0xfadf('0x11')]});}}catch(_0x5103e9){utils[_0xfadf('0x2a')](util[_0xfadf('0x5')]('[%s][members][agentcomplete]',_0x34e471[_0xfadf('0x11')]),_0x5103e9);}};exports[_0xfadf('0x2b')]=function(_0x172bb5){try{utils['debug'](util[_0xfadf('0x5')](_0xfadf('0x2c'),_0x172bb5[_0xfadf('0x11')]),_0x172bb5);if(_0x172bb5['channel']){var _0x53ff67=_0x172bb5[_0xfadf('0x8')][_0xfadf('0xf')]('-')[0x0];if(!_['isNil'](members[_0x53ff67])){members[_0x53ff67]=_[_0xfadf('0x28')](members[_0x53ff67],{'data1':members[_0x53ff67][_0xfadf('0x2d')]||_0x172bb5[_0xfadf('0xb')],'data2':members[_0x53ff67]['data2']||_0x172bb5[_0xfadf('0x2e')],'data3':members[_0x53ff67][_0xfadf('0x2f')]||_0x172bb5[_0xfadf('0x30')],'uniqueid':members[_0x53ff67][_0xfadf('0x11')]||_0x172bb5[_0xfadf('0x11')]});utils[_0xfadf('0x4')](util[_0xfadf('0x5')](_0xfadf('0x31'),_0x172bb5['uniqueid'],members[_0x53ff67][_0xfadf('0x2d')],members[_0x53ff67]['data2'],members[_0x53ff67][_0xfadf('0x2f')]));if(members[_0x53ff67]['exitAt']){writeDB(members[_0x53ff67]);}}}if(_0x172bb5[_0xfadf('0x32')]){var _0x2e9aa3=_0x172bb5[_0xfadf('0x32')][_0xfadf('0xf')]('-')[0x0];if(!_[_0xfadf('0x1f')](members[_0x2e9aa3])){members[_0x2e9aa3]=_[_0xfadf('0x28')](members[_0x2e9aa3],{'data1':members[_0x2e9aa3][_0xfadf('0x2d')]||_0x172bb5[_0xfadf('0xb')],'data2':members[_0x2e9aa3][_0xfadf('0x9')]||_0x172bb5['source'],'data3':members[_0x2e9aa3][_0xfadf('0x2f')]||_0x172bb5[_0xfadf('0x30')],'uniqueid':members[_0x2e9aa3][_0xfadf('0x11')]||_0x172bb5['uniqueid']});utils[_0xfadf('0x4')](util['format'](_0xfadf('0x31'),_0x172bb5['uniqueid'],members[_0x2e9aa3]['data1'],members[_0x2e9aa3]['data2'],members[_0x2e9aa3]['data3']));if(members[_0x2e9aa3][_0xfadf('0x20')]){writeDB(members[_0x2e9aa3]);}}}}catch(_0x2e9522){utils['error'](util[_0xfadf('0x5')](_0xfadf('0x2c'),_0x172bb5['uniqueid']),_0x2e9522);}}; \ No newline at end of file +var _0x81f5=['assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue'];(function(_0x2014cd,_0x3631fe){var _0x2163ed=function(_0x27f565){while(--_0x27f565){_0x2014cd['push'](_0x2014cd['shift']());}};_0x2163ed(++_0x3631fe);}(_0x81f5,0x77));var _0x581f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x81f5[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x581f('0x0'));var util=require(_0x581f('0x1'));var utils=require(_0x581f('0x2'));var members={};var exclude=[_0x581f('0x3'),_0x581f('0x4')];function writeDB(_0xccf7b4){utils['info'](util[_0x581f('0x5')](_0x581f('0x6'),_0xccf7b4[_0x581f('0x7')],_0xccf7b4[_0x581f('0x8')],_0xccf7b4[_0x581f('0x9')],_0xccf7b4[_0x581f('0xa')],_0xccf7b4[_0x581f('0xb')],_0xccf7b4[_0x581f('0xc')]));if(_0xccf7b4[_0x581f('0x8')]){utils['getUserByInterface'](_0xccf7b4[_0x581f('0x8')])[_0x581f('0xd')](function(_0x577bcb){if(_0x577bcb){_0xccf7b4[_0x581f('0xb')]=_0x577bcb[_0x581f('0xe')];_0xccf7b4[_0x581f('0xf')]=_0x577bcb['internal'];utils[_0x581f('0x10')](_0x581f('0x11'),_0xccf7b4);}else{utils[_0x581f('0x12')](_0xccf7b4['interface']['split']('/')[0x1])[_0x581f('0xd')](function(_0x2e95d8){if(_0x2e95d8){_0xccf7b4[_0x581f('0xb')]=_0x2e95d8['name'];_0xccf7b4['internal']=_0x2e95d8[_0x581f('0xf')];utils[_0x581f('0x10')](_0x581f('0x11'),_0xccf7b4);}});}})[_0x581f('0x13')](function(_0x214dcd){utils[_0x581f('0x14')](util['format']('[%s][members][writeDB]',_0xccf7b4[_0x581f('0x7')]),_0x214dcd);});}delete members[_0xccf7b4[_0x581f('0x8')]];}function startsWith(_0x781853,_0x3ce459){return _[_0x581f('0x15')](_0x781853,function(_0x7a867e){return _[_0x581f('0x16')](_0x3ce459,_0x7a867e);});}exports[_0x581f('0x17')]=function(_0x1e810b){try{utils[_0x581f('0x18')](util[_0x581f('0x5')](_0x581f('0x19'),members[_0x1e810b[_0x581f('0x1a')]]?members[_0x1e810b[_0x581f('0x1a')]][_0x581f('0x7')]:_0x1e810b['device']),_0x1e810b);utils[_0x581f('0x1b')](util[_0x581f('0x5')](_0x581f('0x1c'),members[_0x1e810b[_0x581f('0x1a')]]?members[_0x1e810b[_0x581f('0x1a')]]['uniqueid']:_0x1e810b[_0x581f('0x1a')],_0x1e810b[_0x581f('0x1d')],_0x1e810b[_0x581f('0x1a')]));switch(_0x1e810b[_0x581f('0x1d')]){case _0x581f('0x1e'):case'BUSY':if(!startsWith(exclude,_0x1e810b[_0x581f('0x1a')])){members[_0x1e810b[_0x581f('0x1a')]]={'channel':_0x581f('0x1f'),'interface':_0x1e810b[_0x581f('0x1a')],'type':_0x581f('0x20'),'enterAt':utils['now'](),'role':_0x581f('0x21')};}break;case _0x581f('0x22'):if(!_[_0x581f('0x23')](members[_0x1e810b[_0x581f('0x1a')]])){members[_0x1e810b[_0x581f('0x1a')]][_0x581f('0x24')]=utils[_0x581f('0x25')]();members[_0x1e810b['device']]['duration']=utils[_0x581f('0x26')](members[_0x1e810b[_0x581f('0x1a')]][_0x581f('0x24')],members[_0x1e810b[_0x581f('0x1a')]][_0x581f('0x27')]);if(members[_0x1e810b[_0x581f('0x1a')]]['uniqueid']){writeDB(members[_0x1e810b[_0x581f('0x1a')]]);}}break;default:break;}}catch(_0x4cbcb1){utils[_0x581f('0x14')](util['format'](_0x581f('0x19'),members[_0x1e810b[_0x581f('0x1a')]]?members[_0x1e810b[_0x581f('0x1a')]][_0x581f('0x7')]:_0x1e810b['device']),_0x4cbcb1);}};exports[_0x581f('0x28')]=function(_0x2dec70){try{if(!_[_0x581f('0x23')](members[_0x2dec70[_0x581f('0x8')]])){utils[_0x581f('0x18')](util[_0x581f('0x5')]('[%s][members][agentcomplete]',_0x2dec70[_0x581f('0x7')]),_0x2dec70);utils[_0x581f('0x1b')](util[_0x581f('0x5')](_0x581f('0x29'),_0x2dec70[_0x581f('0x7')],_0x2dec70['interface'],_0x2dec70[_0x581f('0x2a')]));members[_0x2dec70[_0x581f('0x8')]]=_[_0x581f('0x2b')](members[_0x2dec70['interface']],{'data4':_0x2dec70[_0x581f('0x2a')],'uniqueid':_0x2dec70[_0x581f('0x7')]});}}catch(_0x57a1c7){utils[_0x581f('0x14')](util[_0x581f('0x5')](_0x581f('0x2c'),_0x2dec70[_0x581f('0x7')]),_0x57a1c7);}};exports[_0x581f('0x2d')]=function(_0x1d929f){try{utils[_0x581f('0x18')](util['format'](_0x581f('0x2e'),_0x1d929f[_0x581f('0x7')]),_0x1d929f);if(_0x1d929f['channel']){var _0x1aab65=_0x1d929f['channel'][_0x581f('0x2f')]('-')[0x0];if(!_[_0x581f('0x23')](members[_0x1aab65])){members[_0x1aab65]=_['assign'](members[_0x1aab65],{'data1':members[_0x1aab65][_0x581f('0x30')]||_0x1d929f[_0x581f('0xc')],'data2':members[_0x1aab65][_0x581f('0xa')]||_0x1d929f[_0x581f('0x31')],'data3':members[_0x1aab65][_0x581f('0x32')]||_0x1d929f[_0x581f('0x33')],'uniqueid':members[_0x1aab65]['uniqueid']||_0x1d929f[_0x581f('0x7')]});utils[_0x581f('0x1b')](util[_0x581f('0x5')](_0x581f('0x34'),_0x1d929f['uniqueid'],members[_0x1aab65][_0x581f('0x30')],members[_0x1aab65][_0x581f('0xa')],members[_0x1aab65][_0x581f('0x32')]));if(members[_0x1aab65][_0x581f('0x24')]){writeDB(members[_0x1aab65]);}}}if(_0x1d929f[_0x581f('0x35')]){var _0x2e5392=_0x1d929f['destinationchannel'][_0x581f('0x2f')]('-')[0x0];if(!_[_0x581f('0x23')](members[_0x2e5392])){members[_0x2e5392]=_['assign'](members[_0x2e5392],{'data1':members[_0x2e5392]['data1']||_0x1d929f[_0x581f('0xc')],'data2':members[_0x2e5392][_0x581f('0xa')]||_0x1d929f[_0x581f('0x31')],'data3':members[_0x2e5392][_0x581f('0x32')]||_0x1d929f[_0x581f('0x33')],'uniqueid':members[_0x2e5392]['uniqueid']||_0x1d929f[_0x581f('0x7')]});utils[_0x581f('0x1b')](util[_0x581f('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d929f[_0x581f('0x7')],members[_0x2e5392][_0x581f('0x30')],members[_0x2e5392][_0x581f('0xa')],members[_0x2e5392][_0x581f('0x32')]));if(members[_0x2e5392]['exitAt']){writeDB(members[_0x2e5392]);}}}}catch(_0x3460b2){utils[_0x581f('0x14')](util['format'](_0x581f('0x2e'),_0x1d929f[_0x581f('0x7')]),_0x3460b2);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 9d7804d..7bfe83b 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 _0x74d6=['error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','queuecallerabandon','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now'];(function(_0x19308d,_0x5cd832){var _0x395a37=function(_0x48b494){while(--_0x48b494){_0x19308d['push'](_0x19308d['shift']());}};_0x395a37(++_0x5cd832);}(_0x74d6,0xba));var _0x674d=function(_0xdffb85,_0x4a49a1){_0xdffb85=_0xdffb85-0x0;var _0x15f522=_0x74d6[_0xdffb85];return _0x15f522;};'use strict';var _=require(_0x674d('0x0'));var util=require(_0x674d('0x1'));var utils=require(_0x674d('0x2'));var queues={};function writeDB(_0x117dd3){utils['info'](util[_0x674d('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x117dd3[_0x674d('0x4')],_0x117dd3[_0x674d('0x5')],_0x117dd3[_0x674d('0x6')],_0x117dd3[_0x674d('0x7')],_0x117dd3[_0x674d('0x8')],_0x117dd3[_0x674d('0x9')],_0x117dd3['queuecallerexitreason']));if(_0x117dd3['queue']){utils[_0x674d('0xa')](_0x117dd3[_0x674d('0x6')])[_0x674d('0xb')](function(_0x1a782d){if(_0x1a782d){_0x117dd3['type']=_0x1a782d[_0x674d('0xc')];}utils[_0x674d('0xd')](_0x674d('0xe'),_0x117dd3);});}else{utils[_0x674d('0xd')](_0x674d('0xe'),_0x117dd3);}if(_0x117dd3[_0x674d('0xf')]){delete queues[_0x117dd3[_0x674d('0xf')]];}else{delete queues[_0x117dd3[_0x674d('0x4')]];}}exports[_0x674d('0x10')]=function(_0x37fa95){try{utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x12'),_0x37fa95[_0x674d('0x4')]),_0x37fa95);utils[_0x674d('0x13')](util['format'](_0x674d('0x14'),_0x37fa95[_0x674d('0x4')],_0x37fa95['queue'],_0x37fa95[_0x674d('0x15')]));queues[_0x37fa95[_0x674d('0x4')]]=_[_0x674d('0x16')](_0x37fa95,{'originalposition':_0x37fa95['position'],'queuecallerjoinAt':utils[_0x674d('0x17')](),'mohtime':0x0});}catch(_0x1c7b18){utils[_0x674d('0x18')](util[_0x674d('0x3')](_0x674d('0x12'),_0x37fa95[_0x674d('0x4')]),_0x1c7b18);}};exports[_0x674d('0x19')]=function(_0x6cfaab){try{if(!_['isNil'](queues[_0x6cfaab['uniqueid']])){utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x1a'),_0x6cfaab['uniqueid']),_0x6cfaab);if(queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0x1b')]){if(!queues[_0x6cfaab[_0x674d('0x4')]]['queuecallerabandon']&&!queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0x1c')]){queues[_0x6cfaab[_0x674d('0x4')]]['queuecallercomplete']=!![];queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0x1d')]=utils[_0x674d('0x17')]();queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0x1e')]='COMPLETEDBYAGENT';}utils[_0x674d('0x13')](util[_0x674d('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x6cfaab[_0x674d('0x4')],queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0x1f')],queues[_0x6cfaab[_0x674d('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x6cfaab[_0x674d('0x4')]]);}else if(queues[_0x6cfaab['uniqueid']]['transfereduniqueid']){utils[_0x674d('0x13')](util[_0x674d('0x3')](_0x674d('0x20'),_0x6cfaab[_0x674d('0x4')],queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0x1f')],queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0xf')]));queues[queues[_0x6cfaab[_0x674d('0x4')]][_0x674d('0xf')]]=queues[_0x6cfaab['uniqueid']];queues[queues[_0x6cfaab[_0x674d('0x4')]]['transfereduniqueid']][_0x674d('0x21')]=0x2;delete queues[_0x6cfaab['uniqueid']];}}}catch(_0x5f39b9){utils[_0x674d('0x18')](util[_0x674d('0x3')](_0x674d('0x1a'),_0x6cfaab[_0x674d('0x4')]),_0x5f39b9);}};exports[_0x674d('0x22')]=function(_0x53e365){try{utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x23'),_0x53e365[_0x674d('0x4')]),_0x53e365);if(!_[_0x674d('0x24')](_0x53e365['variable'][_0x674d('0x25')])&&_0x53e365['value']['toUpperCase']()!==_0x674d('0x26')){if(!_['isNil'](queues[_0x53e365['uniqueid']])){queues[_0x53e365['uniqueid']]['queuecallerabandon']=![];queues[_0x53e365['uniqueid']][_0x674d('0x27')]=null;queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x1c')]=!![];queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x28')]=utils[_0x674d('0x17')]();queues[_0x53e365['uniqueid']]['queuecallerexitreason']=_0x53e365['value']['toUpperCase']();utils[_0x674d('0x13')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x53e365['uniqueid'],queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x1f')],_0x53e365[_0x674d('0x29')],queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x1e')]));writeDB(queues[_0x53e365[_0x674d('0x4')]]);}}else if(!_[_0x674d('0x24')](_0x53e365['variable']['queueposition'])){if(!_[_0x674d('0x24')](queues[_0x53e365[_0x674d('0x4')]])&&!queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x2a')]){queues[_0x53e365[_0x674d('0x4')]]['queuecallerabandon']=![];queues[_0x53e365['uniqueid']]['queuecallerabandonAt']=null;queues[_0x53e365[_0x674d('0x4')]]['queuecallerexit']=!![];queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x28')]=utils[_0x674d('0x17')]();queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x1e')]='EXITWITHKEY';utils[_0x674d('0x13')](util[_0x674d('0x3')](_0x674d('0x2b'),_0x53e365[_0x674d('0x4')],queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x1f')],_0x53e365['value'],queues[_0x53e365[_0x674d('0x4')]][_0x674d('0x1e')]));}}}catch(_0x934002){utils['error'](util[_0x674d('0x3')]('[%s][queues][varset]',_0x53e365[_0x674d('0x4')]),_0x934002);}};exports[_0x674d('0x2a')]=function(_0x1d7c92){try{if(!_[_0x674d('0x24')](queues[_0x1d7c92[_0x674d('0x4')]])){utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x2c'),_0x1d7c92[_0x674d('0x4')]),_0x1d7c92);queues[_0x1d7c92['uniqueid']][_0x674d('0x1c')]=![];queues[_0x1d7c92[_0x674d('0x4')]]['queuecallerexitAt']=null;queues[_0x1d7c92[_0x674d('0x4')]][_0x674d('0x2a')]=!![];queues[_0x1d7c92[_0x674d('0x4')]]['queuecallerabandonAt']=utils[_0x674d('0x17')]();queues[_0x1d7c92['uniqueid']][_0x674d('0x1e')]=_0x674d('0x2d');utils['info'](util['format'](_0x674d('0x2e'),_0x1d7c92['uniqueid'],queues[_0x1d7c92[_0x674d('0x4')]][_0x674d('0x1f')],queues[_0x1d7c92[_0x674d('0x4')]]['queuecallerexitreason']));}}catch(_0x1a08b2){utils[_0x674d('0x18')](util['format'](_0x674d('0x2c'),_0x1d7c92['uniqueid']),_0x1a08b2);}};exports['queuecallerleave']=function(_0x417956){try{if(!_['isNil'](queues[_0x417956[_0x674d('0x4')]])){utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x2f'),_0x417956['uniqueid']),_0x417956);utils[_0x674d('0x13')](util['format'](_0x674d('0x30'),_0x417956[_0x674d('0x4')],queues[_0x417956['uniqueid']][_0x674d('0x1f')],_0x417956[_0x674d('0x31')],_0x417956['connectedlinename']));queues[_0x417956['uniqueid']][_0x674d('0x32')]=!![];queues[_0x417956[_0x674d('0x4')]]['queuecallerleaveAt']=utils[_0x674d('0x17')]();queues[_0x417956[_0x674d('0x4')]][_0x674d('0x33')]=utils['diffTime'](queues[_0x417956[_0x674d('0x4')]][_0x674d('0x1b')],queues[_0x417956['uniqueid']][_0x674d('0x34')]);queues[_0x417956[_0x674d('0x4')]][_0x674d('0x15')]=_0x417956[_0x674d('0x15')];queues[_0x417956[_0x674d('0x4')]]['count']=_0x417956[_0x674d('0x35')];queues[_0x417956[_0x674d('0x4')]]['connectedlinenum']=_0x417956[_0x674d('0x31')];queues[_0x417956[_0x674d('0x4')]][_0x674d('0x36')]=_0x417956[_0x674d('0x36')];}}catch(_0x10cf7a){utils['error'](util[_0x674d('0x3')](_0x674d('0x2f'),_0x417956[_0x674d('0x4')]),_0x10cf7a);}};exports['agentconnect']=function(_0x45f616){try{if(!_[_0x674d('0x24')](queues[_0x45f616[_0x674d('0x4')]])){utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x37'),_0x45f616[_0x674d('0x4')]),_0x45f616);utils[_0x674d('0x13')](util[_0x674d('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x45f616[_0x674d('0x4')],queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x1f')],_0x45f616[_0x674d('0x38')],_0x45f616[_0x674d('0x39')]));queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x2a')]=![];queues[_0x45f616['uniqueid']][_0x674d('0x2a')]=![];queues[_0x45f616['uniqueid']][_0x674d('0x27')]=null;queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x1c')]=![];queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x1e')]=null;queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x28')]=null;queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x3a')]=!![];queues[_0x45f616[_0x674d('0x4')]][_0x674d('0x9')]=_0x45f616['destaccountcode'];queues[_0x45f616[_0x674d('0x4')]]['lastAssignedTo']=_0x45f616[_0x674d('0x38')];}}catch(_0x2b9e45){utils['error'](util[_0x674d('0x3')]('[%s][queues][agentconnect]',_0x45f616['uniqueid']),_0x2b9e45);}};exports[_0x674d('0x3b')]=function(_0x5ec55b){try{if(!_[_0x674d('0x24')](queues[_0x5ec55b['uniqueid']])){if(queues[_0x5ec55b['uniqueid']][_0x674d('0x1b')]){utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x3c'),_0x5ec55b[_0x674d('0x4')]),_0x5ec55b);queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x2a')]=![];queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x2a')]=![];queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x27')]=null;queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x1c')]=![];queues[_0x5ec55b['uniqueid']][_0x674d('0x28')]=null;queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x3a')]=!![];queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x7')]=_0x5ec55b[_0x674d('0x38')];queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x3d')]=!![];queues[_0x5ec55b['uniqueid']][_0x674d('0x1d')]=utils[_0x674d('0x17')]();if(_0x5ec55b[_0x674d('0x3e')]=='transfer'){if(!queues[_0x5ec55b[_0x674d('0x4')]]['transfer']){queues[_0x5ec55b[_0x674d('0x4')]]['queuecallerexitreason']=_0x674d('0x3f');}}else{queues[_0x5ec55b[_0x674d('0x4')]]['queuecallerexitreason']=_0x674d('0x40')+_0x5ec55b['reason']['toUpperCase']();}utils['info'](util[_0x674d('0x3')](_0x674d('0x41'),_0x5ec55b[_0x674d('0x4')],queues[_0x5ec55b['uniqueid']][_0x674d('0x1f')],_0x5ec55b['membername'],queues[_0x5ec55b[_0x674d('0x4')]][_0x674d('0x1e')]));writeDB(queues[_0x5ec55b[_0x674d('0x4')]]);}}}catch(_0x29f977){utils[_0x674d('0x18')](util['format'](_0x674d('0x3c'),_0x5ec55b['uniqueid']),_0x29f977);}};exports[_0x674d('0x42')]=function(_0x3132bb){try{if(!_['isNil'](queues[_0x3132bb['transfereeuniqueid']])){utils[_0x674d('0x11')](util[_0x674d('0x3')]('[%s][queues][blindtransfer]',_0x3132bb[_0x674d('0x4')]),_0x3132bb);queues[_0x3132bb['transfereeuniqueid']][_0x674d('0x43')]=!![];queues[_0x3132bb[_0x674d('0x44')]][_0x674d('0x45')]=_0x674d('0x46');queues[_0x3132bb[_0x674d('0x44')]][_0x674d('0x47')]=_0x3132bb[_0x674d('0x48')];queues[_0x3132bb[_0x674d('0x44')]][_0x674d('0x49')]=_0x3132bb[_0x674d('0x44')];queues[_0x3132bb[_0x674d('0x44')]]['queuecallerexitreason']=_0x674d('0x4a');utils[_0x674d('0x13')](util[_0x674d('0x3')](_0x674d('0x4b'),_0x3132bb[_0x674d('0x4')],queues[_0x3132bb[_0x674d('0x44')]][_0x674d('0x1f')],_0x3132bb[_0x674d('0x44')],_0x3132bb[_0x674d('0x48')]));}}catch(_0x394791){utils[_0x674d('0x18')](util[_0x674d('0x3')](_0x674d('0x4c'),_0x3132bb[_0x674d('0x4')]),_0x394791);}};exports[_0x674d('0x4d')]=function(_0x5e21f4){try{utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x4e'),_0x5e21f4[_0x674d('0x4f')]),_0x5e21f4);if(_0x5e21f4[_0x674d('0x4f')]==_0x5e21f4[_0x674d('0x50')]){if(!_[_0x674d('0x24')](queues[_0x5e21f4[_0x674d('0x51')]])){utils[_0x674d('0x13')](util[_0x674d('0x3')](_0x674d('0x52'),_0x5e21f4['origtransfereruniqueid'],queues[_0x5e21f4[_0x674d('0x51')]][_0x674d('0x1f')],_0x5e21f4[_0x674d('0x53')]));queues[_0x5e21f4[_0x674d('0x51')]][_0x674d('0x43')]=!![];queues[_0x5e21f4[_0x674d('0x51')]][_0x674d('0x45')]=_0x674d('0x54');queues[_0x5e21f4['secondtransfererlinkedid']][_0x674d('0x47')]=_0x5e21f4['origtransfererexten'];queues[_0x5e21f4['secondtransfererlinkedid']][_0x674d('0x49')]=_0x5e21f4[_0x674d('0x4f')];queues[_0x5e21f4[_0x674d('0x51')]][_0x674d('0x1e')]=_0x674d('0x55');}if(!_[_0x674d('0x24')](queues[_0x5e21f4[_0x674d('0x50')]])){if(_0x5e21f4['transfereelinkedid']&&queues[_0x5e21f4['transfereelinkedid']]){queues[_0x5e21f4[_0x674d('0x56')]][_0x674d('0x21')]=0x1;queues[_0x5e21f4['transfereeuniqueid']]=_[_0x674d('0x57')](queues[_0x5e21f4[_0x674d('0x56')]]);queues[_0x5e21f4[_0x674d('0x44')]][_0x674d('0xf')]=_0x5e21f4[_0x674d('0x58')];queues[_0x5e21f4[_0x674d('0x44')]][_0x674d('0x21')]=0x2;queues[_0x5e21f4[_0x674d('0x44')]]['calleridnum']=queues[_0x5e21f4['secondtransfererlinkedid']][_0x674d('0x8')];queues[_0x5e21f4[_0x674d('0x44')]]['calleridname']=queues[_0x5e21f4['secondtransfererlinkedid']][_0x674d('0x59')];queues[_0x5e21f4[_0x674d('0x44')]]['queuecallerjoinAt']=utils[_0x674d('0x17')]();queues[_0x5e21f4['transfereeuniqueid']][_0x674d('0x1b')]=utils[_0x674d('0x17')]();queues[_0x5e21f4[_0x674d('0x44')]][_0x674d('0x33')]=0x0;queues[_0x5e21f4['transfereeuniqueid']]['mohtime']=0x0;utils[_0x674d('0x13')](util['format'](_0x674d('0x5a'),_0x5e21f4[_0x674d('0x4f')],queues[_0x5e21f4[_0x674d('0x44')]]['name'],queues[_0x5e21f4[_0x674d('0x44')]][_0x674d('0x8')],queues[_0x5e21f4['transfereeuniqueid']][_0x674d('0x59')]));}else{utils['info'](util[_0x674d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5e21f4[_0x674d('0x4f')],queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x1f')],_0x5e21f4[_0x674d('0x51')]));queues[_0x5e21f4[_0x674d('0x50')]]['transfereduniqueid']=_0x5e21f4[_0x674d('0x51')];}}}else if(_0x5e21f4['secondtransfereruniqueid']==_0x5e21f4[_0x674d('0x51')]){if(!_[_0x674d('0x24')](queues[_0x5e21f4[_0x674d('0x50')]])){utils['info'](util[_0x674d('0x3')](_0x674d('0x5b'),_0x5e21f4[_0x674d('0x4f')],queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x1f')],_0x5e21f4[_0x674d('0x5c')],_0x5e21f4[_0x674d('0x5d')]));queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x43')]=!![];queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x45')]=_0x674d('0x54');queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x47')]=_0x5e21f4['secondtransfererexten'];queues[_0x5e21f4[_0x674d('0x50')]]['transferuniqueid']=_0x5e21f4[_0x674d('0x5c')];queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x1e')]=_0x674d('0x55');}if(!_[_0x674d('0x24')](queues[_0x5e21f4[_0x674d('0x51')]])){if(_0x5e21f4[_0x674d('0x5e')]&&queues[_0x5e21f4[_0x674d('0x5e')]]){queues[_0x5e21f4[_0x674d('0x5e')]][_0x674d('0x21')]=0x1;queues[_0x5e21f4[_0x674d('0x58')]]=_['clone'](queues[_0x5e21f4['transfertargetlinkedid']]);queues[_0x5e21f4['transfertargetuniqueid']][_0x674d('0xf')]=_0x5e21f4[_0x674d('0x58')];queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0x21')]=0x2;queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0x8')]=queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x8')];queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0x59')]=queues[_0x5e21f4[_0x674d('0x50')]][_0x674d('0x59')];queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0x34')]=utils[_0x674d('0x17')]();queues[_0x5e21f4['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x674d('0x17')]();queues[_0x5e21f4['transfertargetuniqueid']][_0x674d('0x33')]=0x0;queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0x5f')]=0x0;utils['info'](util[_0x674d('0x3')](_0x674d('0x60'),_0x5e21f4[_0x674d('0x4f')],queues[_0x5e21f4[_0x674d('0x58')]]['name'],queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0xf')],queues[_0x5e21f4[_0x674d('0x58')]][_0x674d('0x8')],queues[_0x5e21f4['transfertargetuniqueid']][_0x674d('0x59')]));}else{utils['info'](util[_0x674d('0x3')](_0x674d('0x61'),_0x5e21f4[_0x674d('0x4f')],queues[_0x5e21f4[_0x674d('0x51')]][_0x674d('0x1f')],_0x5e21f4['origtransfererlinkedid']));queues[_0x5e21f4['secondtransfererlinkedid']][_0x674d('0xf')]=_0x5e21f4[_0x674d('0x50')];}}}}catch(_0xf535fb){utils[_0x674d('0x18')](util['format'](_0x674d('0x4e'),_0x5e21f4['origtransfereruniqueid']),_0xf535fb);}};exports[_0x674d('0x62')]=function(_0x31aad4){try{if(!_['isNil'](queues[_0x31aad4['uniqueid']])){utils[_0x674d('0x11')](util[_0x674d('0x3')]('[%s][queues][musiconholdstart]',_0x31aad4[_0x674d('0x4')]),_0x31aad4);queues[_0x31aad4['uniqueid']][_0x674d('0x63')]=utils[_0x674d('0x17')]();utils[_0x674d('0x13')](util[_0x674d('0x3')](_0x674d('0x64'),_0x31aad4[_0x674d('0x4')],queues[_0x31aad4[_0x674d('0x4')]][_0x674d('0x1f')],queues[_0x31aad4[_0x674d('0x4')]][_0x674d('0x63')]));}}catch(_0x2b8a7b){utils[_0x674d('0x18')](util[_0x674d('0x3')](_0x674d('0x65'),_0x31aad4[_0x674d('0x4')]),_0x2b8a7b);}};exports[_0x674d('0x66')]=function(_0x196e7d){try{if(!_[_0x674d('0x24')](queues[_0x196e7d['uniqueid']])){if(!_['isNil'](queues[_0x196e7d['uniqueid']]['musiconholdstartAt'])){utils[_0x674d('0x11')](util[_0x674d('0x3')](_0x674d('0x67'),_0x196e7d[_0x674d('0x4')]),_0x196e7d);queues[_0x196e7d[_0x674d('0x4')]]['mohtime']+=utils[_0x674d('0x68')](utils[_0x674d('0x17')](),queues[_0x196e7d[_0x674d('0x4')]]['musiconholdstartAt']);utils[_0x674d('0x13')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x196e7d['uniqueid'],queues[_0x196e7d['uniqueid']][_0x674d('0x1f')],queues[_0x196e7d[_0x674d('0x4')]]['mohtime']));delete queues[_0x196e7d[_0x674d('0x4')]][_0x674d('0x63')];}}}catch(_0x5f397f){utils['error'](util[_0x674d('0x3')]('[%s][queues][musiconholdstop]',_0x196e7d[_0x674d('0x4')]),_0x5f397f);}}; \ No newline at end of file +var _0xc2ab=['util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','origtransfererexten','secondtransfererlinkedid','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash'];(function(_0x145114,_0x3c98d7){var _0x5f341d=function(_0x5b1fa0){while(--_0x5b1fa0){_0x145114['push'](_0x145114['shift']());}};_0x5f341d(++_0x3c98d7);}(_0xc2ab,0xc9));var _0xbc2a=function(_0x66dd2a,_0x3a7420){_0x66dd2a=_0x66dd2a-0x0;var _0x3924ec=_0xc2ab[_0x66dd2a];return _0x3924ec;};'use strict';var _=require(_0xbc2a('0x0'));var util=require(_0xbc2a('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4b4529){utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x4'),_0x4b4529[_0xbc2a('0x5')],_0x4b4529[_0xbc2a('0x6')],_0x4b4529[_0xbc2a('0x7')],_0x4b4529['lastAssignedTo'],_0x4b4529['calleridnum'],_0x4b4529[_0xbc2a('0x8')],_0x4b4529[_0xbc2a('0x9')]));if(_0x4b4529[_0xbc2a('0x7')]){utils[_0xbc2a('0xa')](_0x4b4529[_0xbc2a('0x7')])[_0xbc2a('0xb')](function(_0xbf48d7){if(_0xbf48d7){_0x4b4529[_0xbc2a('0xc')]=_0xbf48d7[_0xbc2a('0xc')];}utils['request'](_0xbc2a('0xd'),_0x4b4529);});}else{utils[_0xbc2a('0xe')](_0xbc2a('0xd'),_0x4b4529);}if(_0x4b4529['transfereduniqueid']){delete queues[_0x4b4529[_0xbc2a('0xf')]];}else{delete queues[_0x4b4529[_0xbc2a('0x5')]];}}exports[_0xbc2a('0x10')]=function(_0x276361){try{utils[_0xbc2a('0x11')](util['format'](_0xbc2a('0x12'),_0x276361[_0xbc2a('0x5')]),_0x276361);utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x13'),_0x276361[_0xbc2a('0x5')],_0x276361['queue'],_0x276361[_0xbc2a('0x14')]));queues[_0x276361[_0xbc2a('0x5')]]=_[_0xbc2a('0x15')](_0x276361,{'originalposition':_0x276361['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x362496){utils[_0xbc2a('0x16')](util['format'](_0xbc2a('0x12'),_0x276361[_0xbc2a('0x5')]),_0x362496);}};exports['hangup']=function(_0x156a04){try{if(!_[_0xbc2a('0x17')](queues[_0x156a04[_0xbc2a('0x5')]])){utils['debug'](util[_0xbc2a('0x3')]('[%s][queues][hangup]',_0x156a04[_0xbc2a('0x5')]),_0x156a04);if(queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0x18')]){if(!queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0x19')]&&!queues[_0x156a04['uniqueid']][_0xbc2a('0x1a')]){queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0x1b')]=!![];queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0x1c')]=utils[_0xbc2a('0x1d')]();queues[_0x156a04['uniqueid']][_0xbc2a('0x9')]='COMPLETEDBYAGENT';}utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x156a04[_0xbc2a('0x5')],queues[_0x156a04[_0xbc2a('0x5')]]['name'],queues[_0x156a04[_0xbc2a('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x156a04[_0xbc2a('0x5')]]);}else if(queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0xf')]){utils[_0xbc2a('0x2')](util['format'](_0xbc2a('0x1e'),_0x156a04[_0xbc2a('0x5')],queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0x1f')],queues[_0x156a04[_0xbc2a('0x5')]]['transfereduniqueid']));queues[queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0xf')]]=queues[_0x156a04[_0xbc2a('0x5')]];queues[queues[_0x156a04[_0xbc2a('0x5')]][_0xbc2a('0xf')]][_0xbc2a('0x20')]=0x2;delete queues[_0x156a04[_0xbc2a('0x5')]];}}}catch(_0x5d4ccc){utils[_0xbc2a('0x16')](util[_0xbc2a('0x3')]('[%s][queues][hangup]',_0x156a04[_0xbc2a('0x5')]),_0x5d4ccc);}};exports['varset']=function(_0x251055){try{utils[_0xbc2a('0x11')](util[_0xbc2a('0x3')](_0xbc2a('0x21'),_0x251055[_0xbc2a('0x5')]),_0x251055);if(!_[_0xbc2a('0x17')](_0x251055[_0xbc2a('0x22')][_0xbc2a('0x23')])&&_0x251055[_0xbc2a('0x24')]['toUpperCase']()!==_0xbc2a('0x25')){if(!_[_0xbc2a('0x17')](queues[_0x251055[_0xbc2a('0x5')]])){queues[_0x251055[_0xbc2a('0x5')]]['queuecallerabandon']=![];queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x26')]=null;queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x1a')]=!![];queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x27')]=utils[_0xbc2a('0x1d')]();queues[_0x251055['uniqueid']][_0xbc2a('0x9')]=_0x251055[_0xbc2a('0x24')]['toUpperCase']();utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x28'),_0x251055[_0xbc2a('0x5')],queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x1f')],_0x251055[_0xbc2a('0x24')],queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x9')]));writeDB(queues[_0x251055[_0xbc2a('0x5')]]);}}else if(!_[_0xbc2a('0x17')](_0x251055[_0xbc2a('0x22')][_0xbc2a('0x29')])){if(!_['isNil'](queues[_0x251055['uniqueid']])&&!queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x19')]){queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x19')]=![];queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x26')]=null;queues[_0x251055['uniqueid']]['queuecallerexit']=!![];queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x27')]=utils[_0xbc2a('0x1d')]();queues[_0x251055['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x2a'),_0x251055['uniqueid'],queues[_0x251055[_0xbc2a('0x5')]][_0xbc2a('0x1f')],_0x251055[_0xbc2a('0x24')],queues[_0x251055['uniqueid']][_0xbc2a('0x9')]));}}}catch(_0x243d34){utils[_0xbc2a('0x16')](util['format']('[%s][queues][varset]',_0x251055[_0xbc2a('0x5')]),_0x243d34);}};exports['queuecallerabandon']=function(_0xbac13c){try{if(!_[_0xbc2a('0x17')](queues[_0xbac13c['uniqueid']])){utils[_0xbc2a('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0xbac13c[_0xbc2a('0x5')]),_0xbac13c);queues[_0xbac13c[_0xbc2a('0x5')]][_0xbc2a('0x1a')]=![];queues[_0xbac13c[_0xbc2a('0x5')]][_0xbc2a('0x27')]=null;queues[_0xbac13c[_0xbc2a('0x5')]]['queuecallerabandon']=!![];queues[_0xbac13c[_0xbc2a('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0xbac13c[_0xbc2a('0x5')]][_0xbc2a('0x9')]=_0xbc2a('0x2b');utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x2c'),_0xbac13c[_0xbc2a('0x5')],queues[_0xbac13c[_0xbc2a('0x5')]][_0xbc2a('0x1f')],queues[_0xbac13c[_0xbc2a('0x5')]]['queuecallerexitreason']));}}catch(_0x3238fa){utils[_0xbc2a('0x16')](util[_0xbc2a('0x3')]('[%s][queues][queuecallerabandon]',_0xbac13c[_0xbc2a('0x5')]),_0x3238fa);}};exports['queuecallerleave']=function(_0x249e5d){try{if(!_['isNil'](queues[_0x249e5d[_0xbc2a('0x5')]])){utils['debug'](util[_0xbc2a('0x3')](_0xbc2a('0x2d'),_0x249e5d[_0xbc2a('0x5')]),_0x249e5d);utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x2e'),_0x249e5d[_0xbc2a('0x5')],queues[_0x249e5d[_0xbc2a('0x5')]][_0xbc2a('0x1f')],_0x249e5d['connectedlinenum'],_0x249e5d[_0xbc2a('0x2f')]));queues[_0x249e5d['uniqueid']][_0xbc2a('0x30')]=!![];queues[_0x249e5d['uniqueid']][_0xbc2a('0x18')]=utils[_0xbc2a('0x1d')]();queues[_0x249e5d['uniqueid']][_0xbc2a('0x31')]=utils['diffTime'](queues[_0x249e5d[_0xbc2a('0x5')]][_0xbc2a('0x18')],queues[_0x249e5d[_0xbc2a('0x5')]]['queuecallerjoinAt']);queues[_0x249e5d['uniqueid']][_0xbc2a('0x14')]=_0x249e5d['position'];queues[_0x249e5d[_0xbc2a('0x5')]]['count']=_0x249e5d['count'];queues[_0x249e5d[_0xbc2a('0x5')]][_0xbc2a('0x32')]=_0x249e5d[_0xbc2a('0x32')];queues[_0x249e5d['uniqueid']][_0xbc2a('0x2f')]=_0x249e5d[_0xbc2a('0x2f')];}}catch(_0x44a717){utils[_0xbc2a('0x16')](util['format'](_0xbc2a('0x2d'),_0x249e5d[_0xbc2a('0x5')]),_0x44a717);}};exports[_0xbc2a('0x33')]=function(_0x114620){try{if(!_[_0xbc2a('0x17')](queues[_0x114620[_0xbc2a('0x5')]])){utils[_0xbc2a('0x11')](util[_0xbc2a('0x3')](_0xbc2a('0x34'),_0x114620[_0xbc2a('0x5')]),_0x114620);utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x35'),_0x114620[_0xbc2a('0x5')],queues[_0x114620['uniqueid']][_0xbc2a('0x1f')],_0x114620[_0xbc2a('0x36')],_0x114620[_0xbc2a('0x37')]));queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x19')]=![];queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x19')]=![];queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x26')]=null;queues[_0x114620[_0xbc2a('0x5')]]['queuecallerexit']=![];queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x9')]=null;queues[_0x114620['uniqueid']]['queuecallerexitAt']=null;queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x38')]=!![];queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x8')]=_0x114620[_0xbc2a('0x37')];queues[_0x114620[_0xbc2a('0x5')]][_0xbc2a('0x39')]=_0x114620[_0xbc2a('0x36')];}}catch(_0x1e937c){utils[_0xbc2a('0x16')](util[_0xbc2a('0x3')](_0xbc2a('0x34'),_0x114620[_0xbc2a('0x5')]),_0x1e937c);}};exports[_0xbc2a('0x3a')]=function(_0x1e1d21){try{if(!_[_0xbc2a('0x17')](queues[_0x1e1d21[_0xbc2a('0x5')]])){if(queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x18')]){utils['debug'](util['format'](_0xbc2a('0x3b'),_0x1e1d21[_0xbc2a('0x5')]),_0x1e1d21);queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x19')]=![];queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x19')]=![];queues[_0x1e1d21[_0xbc2a('0x5')]]['queuecallerabandonAt']=null;queues[_0x1e1d21[_0xbc2a('0x5')]]['queuecallerexit']=![];queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x27')]=null;queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x38')]=!![];queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x39')]=_0x1e1d21['membername'];queues[_0x1e1d21[_0xbc2a('0x5')]]['queuecallercomplete']=!![];queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x1c')]=utils[_0xbc2a('0x1d')]();if(_0x1e1d21['reason']=='transfer'){if(!queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x3c')]){queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x9')]='TRANSFER';}}else{queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x9')]='COMPLETEDBY'+_0x1e1d21[_0xbc2a('0x3d')]['toUpperCase']();}utils['info'](util[_0xbc2a('0x3')](_0xbc2a('0x3e'),_0x1e1d21[_0xbc2a('0x5')],queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x1f')],_0x1e1d21[_0xbc2a('0x36')],queues[_0x1e1d21[_0xbc2a('0x5')]][_0xbc2a('0x9')]));writeDB(queues[_0x1e1d21[_0xbc2a('0x5')]]);}}}catch(_0x479dae){utils['error'](util[_0xbc2a('0x3')](_0xbc2a('0x3b'),_0x1e1d21[_0xbc2a('0x5')]),_0x479dae);}};exports[_0xbc2a('0x3f')]=function(_0x2a165c){try{if(!_[_0xbc2a('0x17')](queues[_0x2a165c[_0xbc2a('0x40')]])){utils[_0xbc2a('0x11')](util[_0xbc2a('0x3')](_0xbc2a('0x41'),_0x2a165c[_0xbc2a('0x5')]),_0x2a165c);queues[_0x2a165c['transfereeuniqueid']]['transfer']=!![];queues[_0x2a165c[_0xbc2a('0x40')]][_0xbc2a('0x42')]=_0xbc2a('0x43');queues[_0x2a165c[_0xbc2a('0x40')]]['transferexten']=_0x2a165c['extension'];queues[_0x2a165c['transfereeuniqueid']][_0xbc2a('0x44')]=_0x2a165c[_0xbc2a('0x40')];queues[_0x2a165c[_0xbc2a('0x40')]][_0xbc2a('0x9')]=_0xbc2a('0x45');utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2a165c['uniqueid'],queues[_0x2a165c[_0xbc2a('0x40')]][_0xbc2a('0x1f')],_0x2a165c[_0xbc2a('0x40')],_0x2a165c[_0xbc2a('0x46')]));}}catch(_0x388fee){utils[_0xbc2a('0x16')](util['format'](_0xbc2a('0x41'),_0x2a165c['uniqueid']),_0x388fee);}};exports[_0xbc2a('0x47')]=function(_0x3cae1a){try{utils[_0xbc2a('0x11')](util[_0xbc2a('0x3')](_0xbc2a('0x48'),_0x3cae1a[_0xbc2a('0x49')]),_0x3cae1a);if(_0x3cae1a['origtransfereruniqueid']==_0x3cae1a[_0xbc2a('0x4a')]){if(!_['isNil'](queues[_0x3cae1a['secondtransfererlinkedid']])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3cae1a[_0xbc2a('0x49')],queues[_0x3cae1a['secondtransfererlinkedid']][_0xbc2a('0x1f')],_0x3cae1a[_0xbc2a('0x4b')]));queues[_0x3cae1a[_0xbc2a('0x4c')]][_0xbc2a('0x3c')]=!![];queues[_0x3cae1a[_0xbc2a('0x4c')]][_0xbc2a('0x42')]=_0xbc2a('0x4d');queues[_0x3cae1a[_0xbc2a('0x4c')]][_0xbc2a('0x4e')]=_0x3cae1a[_0xbc2a('0x4b')];queues[_0x3cae1a[_0xbc2a('0x4c')]]['transferuniqueid']=_0x3cae1a[_0xbc2a('0x49')];queues[_0x3cae1a['secondtransfererlinkedid']]['queuecallerexitreason']=_0xbc2a('0x4f');}if(!_[_0xbc2a('0x17')](queues[_0x3cae1a[_0xbc2a('0x4a')]])){if(_0x3cae1a[_0xbc2a('0x50')]&&queues[_0x3cae1a[_0xbc2a('0x50')]]){queues[_0x3cae1a['transfereelinkedid']][_0xbc2a('0x20')]=0x1;queues[_0x3cae1a[_0xbc2a('0x40')]]=_[_0xbc2a('0x51')](queues[_0x3cae1a['transfereelinkedid']]);queues[_0x3cae1a[_0xbc2a('0x40')]][_0xbc2a('0xf')]=_0x3cae1a[_0xbc2a('0x52')];queues[_0x3cae1a[_0xbc2a('0x40')]]['queuecallerenterreason']=0x2;queues[_0x3cae1a[_0xbc2a('0x40')]][_0xbc2a('0x53')]=queues[_0x3cae1a['secondtransfererlinkedid']][_0xbc2a('0x53')];queues[_0x3cae1a[_0xbc2a('0x40')]][_0xbc2a('0x54')]=queues[_0x3cae1a[_0xbc2a('0x4c')]][_0xbc2a('0x54')];queues[_0x3cae1a[_0xbc2a('0x40')]][_0xbc2a('0x55')]=utils[_0xbc2a('0x1d')]();queues[_0x3cae1a['transfereeuniqueid']][_0xbc2a('0x18')]=utils[_0xbc2a('0x1d')]();queues[_0x3cae1a[_0xbc2a('0x40')]][_0xbc2a('0x31')]=0x0;queues[_0x3cae1a['transfereeuniqueid']][_0xbc2a('0x56')]=0x0;utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3cae1a['origtransfereruniqueid'],queues[_0x3cae1a[_0xbc2a('0x40')]]['name'],queues[_0x3cae1a[_0xbc2a('0x40')]][_0xbc2a('0x53')],queues[_0x3cae1a['transfereeuniqueid']][_0xbc2a('0x54')]));}else{utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x57'),_0x3cae1a['origtransfereruniqueid'],queues[_0x3cae1a[_0xbc2a('0x4a')]][_0xbc2a('0x1f')],_0x3cae1a['secondtransfererlinkedid']));queues[_0x3cae1a[_0xbc2a('0x4a')]][_0xbc2a('0xf')]=_0x3cae1a['secondtransfererlinkedid'];}}}else if(_0x3cae1a[_0xbc2a('0x58')]==_0x3cae1a[_0xbc2a('0x4c')]){if(!_[_0xbc2a('0x17')](queues[_0x3cae1a[_0xbc2a('0x4a')]])){utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x59'),_0x3cae1a[_0xbc2a('0x49')],queues[_0x3cae1a['origtransfererlinkedid']][_0xbc2a('0x1f')],_0x3cae1a[_0xbc2a('0x58')],_0x3cae1a['secondtransfererexten']));queues[_0x3cae1a[_0xbc2a('0x4a')]][_0xbc2a('0x3c')]=!![];queues[_0x3cae1a[_0xbc2a('0x4a')]][_0xbc2a('0x42')]=_0xbc2a('0x4d');queues[_0x3cae1a['origtransfererlinkedid']]['transferexten']=_0x3cae1a[_0xbc2a('0x5a')];queues[_0x3cae1a[_0xbc2a('0x4a')]][_0xbc2a('0x44')]=_0x3cae1a[_0xbc2a('0x58')];queues[_0x3cae1a['origtransfererlinkedid']][_0xbc2a('0x9')]=_0xbc2a('0x4f');}if(!_[_0xbc2a('0x17')](queues[_0x3cae1a[_0xbc2a('0x4c')]])){if(_0x3cae1a[_0xbc2a('0x5b')]&&queues[_0x3cae1a[_0xbc2a('0x5b')]]){queues[_0x3cae1a['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x3cae1a[_0xbc2a('0x52')]]=_[_0xbc2a('0x51')](queues[_0x3cae1a['transfertargetlinkedid']]);queues[_0x3cae1a['transfertargetuniqueid']][_0xbc2a('0xf')]=_0x3cae1a['transfertargetuniqueid'];queues[_0x3cae1a['transfertargetuniqueid']][_0xbc2a('0x20')]=0x2;queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0x53')]=queues[_0x3cae1a['origtransfererlinkedid']][_0xbc2a('0x53')];queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0x54')]=queues[_0x3cae1a[_0xbc2a('0x4a')]][_0xbc2a('0x54')];queues[_0x3cae1a[_0xbc2a('0x52')]]['queuecallerjoinAt']=utils[_0xbc2a('0x1d')]();queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0x18')]=utils['now']();queues[_0x3cae1a['transfertargetuniqueid']][_0xbc2a('0x31')]=0x0;queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0x56')]=0x0;utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x5c'),_0x3cae1a[_0xbc2a('0x49')],queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0x1f')],queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0xf')],queues[_0x3cae1a[_0xbc2a('0x52')]][_0xbc2a('0x53')],queues[_0x3cae1a[_0xbc2a('0x52')]]['calleridname']));}else{utils[_0xbc2a('0x2')](util[_0xbc2a('0x3')](_0xbc2a('0x57'),_0x3cae1a['origtransfereruniqueid'],queues[_0x3cae1a[_0xbc2a('0x4c')]][_0xbc2a('0x1f')],_0x3cae1a[_0xbc2a('0x4a')]));queues[_0x3cae1a[_0xbc2a('0x4c')]][_0xbc2a('0xf')]=_0x3cae1a[_0xbc2a('0x4a')];}}}}catch(_0x573fb3){utils[_0xbc2a('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x3cae1a[_0xbc2a('0x49')]),_0x573fb3);}};exports[_0xbc2a('0x5d')]=function(_0x5d6b67){try{if(!_[_0xbc2a('0x17')](queues[_0x5d6b67[_0xbc2a('0x5')]])){utils[_0xbc2a('0x11')](util['format'](_0xbc2a('0x5e'),_0x5d6b67['uniqueid']),_0x5d6b67);queues[_0x5d6b67[_0xbc2a('0x5')]][_0xbc2a('0x5f')]=utils[_0xbc2a('0x1d')]();utils[_0xbc2a('0x2')](util['format'](_0xbc2a('0x60'),_0x5d6b67[_0xbc2a('0x5')],queues[_0x5d6b67['uniqueid']][_0xbc2a('0x1f')],queues[_0x5d6b67['uniqueid']][_0xbc2a('0x5f')]));}}catch(_0x472a39){utils[_0xbc2a('0x16')](util[_0xbc2a('0x3')](_0xbc2a('0x5e'),_0x5d6b67['uniqueid']),_0x472a39);}};exports[_0xbc2a('0x61')]=function(_0x2625de){try{if(!_[_0xbc2a('0x17')](queues[_0x2625de[_0xbc2a('0x5')]])){if(!_['isNil'](queues[_0x2625de[_0xbc2a('0x5')]][_0xbc2a('0x5f')])){utils[_0xbc2a('0x11')](util['format'](_0xbc2a('0x62'),_0x2625de['uniqueid']),_0x2625de);queues[_0x2625de[_0xbc2a('0x5')]][_0xbc2a('0x56')]+=utils[_0xbc2a('0x63')](utils[_0xbc2a('0x1d')](),queues[_0x2625de[_0xbc2a('0x5')]][_0xbc2a('0x5f')]);utils['info'](util['format'](_0xbc2a('0x64'),_0x2625de['uniqueid'],queues[_0x2625de[_0xbc2a('0x5')]][_0xbc2a('0x1f')],queues[_0x2625de[_0xbc2a('0x5')]][_0xbc2a('0x56')]));delete queues[_0x2625de[_0xbc2a('0x5')]][_0xbc2a('0x5f')];}}}catch(_0x5b4538){utils['error'](util[_0xbc2a('0x3')](_0xbc2a('0x62'),_0x2625de[_0xbc2a('0x5')]),_0x5b4538);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2a82912..bd8fd36 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 _0xa13a=['./transfers.controller','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinename','outbound','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','util','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa13a,0x15c));var _0xaa13=function(_0xbfe5d5,_0x3bfe9b){_0xbfe5d5=_0xbfe5d5-0x0;var _0x26a8d1=_0xa13a[_0xbfe5d5];return _0x26a8d1;};'use strict';var _=require('lodash');var util=require(_0xaa13('0x0'));var utils=require(_0xaa13('0x1'));var transfers=require(_0xaa13('0x2'));var recordings={};function writeDB(_0x10a8fe){var _0x422441;utils['info'](util['format']('[%s][recordings][writeDB]',_0x10a8fe[_0xaa13('0x3')]));if(transfers[_0xaa13('0x4')][_0x10a8fe[_0xaa13('0x3')]]){_0x422441=_0x10a8fe[_0xaa13('0x3')];_0x10a8fe['uniqueid']=transfers[_0xaa13('0x4')][_0x10a8fe[_0xaa13('0x3')]][_0xaa13('0x5')];}if(_0x10a8fe['accountcode']){utils[_0xaa13('0x6')](_0x10a8fe[_0xaa13('0x7')])[_0xaa13('0x8')](function(_0xf66d2d){if(_0xf66d2d){_0x10a8fe['membername']=_0xf66d2d[_0xaa13('0x9')];_0x10a8fe[_0xaa13('0xa')]=_0xf66d2d['id'];}utils[_0xaa13('0xb')](_0xaa13('0xc'),_0x10a8fe);});}else{utils[_0xaa13('0xb')](_0xaa13('0xc'),_0x10a8fe);}if(_0x422441)delete transfers[_0xaa13('0x4')][_0x422441];}exports['newchannel']=function(_0xdac6b9){try{utils[_0xaa13('0xd')](util[_0xaa13('0xe')](_0xaa13('0xf'),_0xdac6b9['uniqueid']),_0xdac6b9);if(_0xdac6b9[_0xaa13('0x3')]==_0xdac6b9[_0xaa13('0x10')]){utils[_0xaa13('0x11')](util[_0xaa13('0xe')](_0xaa13('0x12'),_0xdac6b9[_0xaa13('0x3')],_0xdac6b9['context'],_0xdac6b9['exten']));recordings[_0xdac6b9[_0xaa13('0x3')]]={'uniqueid':_0xdac6b9[_0xaa13('0x3')],'accountcode':_0xdac6b9[_0xaa13('0x7')],'exten':_0xdac6b9[_0xaa13('0x13')],'context':_0xdac6b9[_0xaa13('0x14')],'channel':_0xdac6b9['channel'],'monitors':[]};}}catch(_0x23736){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0xf'),_0xdac6b9[_0xaa13('0x3')]),_0x23736);}};exports[_0xaa13('0x16')]=function(_0x101de1){try{utils[_0xaa13('0xd')](util[_0xaa13('0xe')]('[%s][recordings][newstate]',_0x101de1[_0xaa13('0x3')]),_0x101de1);if(!_[_0xaa13('0x17')](recordings[_0x101de1[_0xaa13('0x3')]])&&_0x101de1[_0xaa13('0x18')]==0x6){utils['info'](util[_0xaa13('0xe')](_0xaa13('0x19'),_0x101de1[_0xaa13('0x3')],_0x101de1[_0xaa13('0x14')],_0x101de1[_0xaa13('0x1a')]));}else if(!_[_0xaa13('0x17')](recordings[_0x101de1[_0xaa13('0x10')]])&&_0x101de1[_0xaa13('0x18')]==0x6&&_0x101de1[_0xaa13('0x14')]!=_0xaa13('0x1b')){utils[_0xaa13('0x11')](util[_0xaa13('0xe')](_0xaa13('0x1c'),_0x101de1['uniqueid'],_0x101de1['linkedid'],_0x101de1[_0xaa13('0x14')],_0x101de1[_0xaa13('0x1a')]));recordings[_0x101de1[_0xaa13('0x10')]]['accountcode']=_0x101de1[_0xaa13('0x7')];}}catch(_0x23ff39){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0x1d'),_0x101de1['uniqueid']),_0x23ff39);}};exports[_0xaa13('0x1e')]=function(_0x48f6a5){try{if(!_[_0xaa13('0x17')](_0x48f6a5[_0xaa13('0x1f')])&&!_['isNil'](_0x48f6a5[_0xaa13('0x1f')][_0xaa13('0x20')])){utils['debug'](util[_0xaa13('0xe')](_0xaa13('0x21'),_0x48f6a5[_0xaa13('0x3')]),_0x48f6a5);utils[_0xaa13('0x11')](util[_0xaa13('0xe')](_0xaa13('0x22'),_0x48f6a5['uniqueid'],_0x48f6a5[_0xaa13('0x1f')],_0x48f6a5['value']));if(_[_0xaa13('0x23')](_0x48f6a5[_0xaa13('0x24')],_0xaa13('0x25'))){_0x48f6a5[_0xaa13('0x24')]=_0x48f6a5['value'][_0xaa13('0x26')](_0xaa13('0x25'),_0xaa13('0x27'));}if(recordings[_0x48f6a5[_0xaa13('0x10')]]){var _0x695274=_['find'](recordings[_0x48f6a5[_0xaa13('0x10')]][_0xaa13('0x28')],{'value':_0x48f6a5[_0xaa13('0x24')]});if(_['isNil'](_0x695274)){recordings[_0x48f6a5[_0xaa13('0x10')]][_0xaa13('0x28')][_0xaa13('0x29')]({'value':_0x48f6a5[_0xaa13('0x24')]});}}}}catch(_0x1876bb){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0x21'),_0x48f6a5[_0xaa13('0x3')]),_0x1876bb);}};exports[_0xaa13('0x2a')]=function(_0x38ea1b){try{if(!_[_0xaa13('0x17')](recordings[_0x38ea1b[_0xaa13('0x3')]])){utils[_0xaa13('0xd')](util[_0xaa13('0xe')](_0xaa13('0x2b'),_0x38ea1b[_0xaa13('0x3')]),_0x38ea1b);utils[_0xaa13('0x11')](util[_0xaa13('0xe')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x38ea1b['uniqueid'],_0x38ea1b[_0xaa13('0x2c')],_0x38ea1b[_0xaa13('0x2d')],_0x38ea1b[_0xaa13('0x2e')]));recordings[_0x38ea1b[_0xaa13('0x3')]][_0xaa13('0x2c')]=_0x38ea1b[_0xaa13('0x2c')];recordings[_0x38ea1b['uniqueid']]['calleridname']=_0x38ea1b[_0xaa13('0x2d')];recordings[_0x38ea1b[_0xaa13('0x3')]]['connectedlinenum']=_0x38ea1b['connectedlinenum'];recordings[_0x38ea1b[_0xaa13('0x3')]][_0xaa13('0x2f')]=_0x38ea1b[_0xaa13('0x2f')];if(recordings[_0x38ea1b[_0xaa13('0x3')]]['type']==_0xaa13('0x30')&&recordings[_0x38ea1b[_0xaa13('0x3')]][_0xaa13('0x7')]){recordings[_0x38ea1b[_0xaa13('0x3')]]['connectedlinenum']=recordings[_0x38ea1b[_0xaa13('0x3')]][_0xaa13('0x7')];recordings[_0x38ea1b[_0xaa13('0x3')]]['connectedlinename']='';}recordings[_0x38ea1b[_0xaa13('0x3')]][_0xaa13('0x28')]['forEach'](function(_0x982c56){var _0x3d1a29=_['clone'](recordings[_0x38ea1b[_0xaa13('0x3')]]);_0x3d1a29[_0xaa13('0x24')]=_0x982c56['value'];writeDB(_0x3d1a29);});delete recordings[_0x38ea1b[_0xaa13('0x3')]];}}catch(_0x14fef1){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0x2b'),_0x38ea1b[_0xaa13('0x3')]),_0x14fef1);}};exports['newexten']=function(_0x1bac90){try{if(!_['isNil'](recordings[_0x1bac90[_0xaa13('0x3')]])){utils[_0xaa13('0xd')](util[_0xaa13('0xe')](_0xaa13('0x31'),_0x1bac90[_0xaa13('0x3')]),_0x1bac90);utils[_0xaa13('0x11')](util[_0xaa13('0xe')](_0xaa13('0x32'),_0x1bac90[_0xaa13('0x3')],_0x1bac90[_0xaa13('0x33')],_0x1bac90[_0xaa13('0x34')]));if(_0x1bac90[_0xaa13('0x33')][_0xaa13('0x35')]()=='set'&&_[_0xaa13('0x36')](_0x1bac90[_0xaa13('0x34')][_0xaa13('0x35')](),_0xaa13('0x37'))){var _0x219a13=_0x1bac90[_0xaa13('0x34')][_0xaa13('0x38')]('=');var _0x1de8a6=_0x219a13[0x0][_0xaa13('0x39')](_0x219a13[0x0]['lastIndexOf']('(')+0x1,_0x219a13[0x0][_0xaa13('0x3a')](')'));var _0x432bf0=_0x219a13[0x1];recordings[_0x1bac90[_0xaa13('0x3')]][_0x1de8a6]=_0x432bf0;}}}catch(_0x399adc){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0x31'),_0x1bac90[_0xaa13('0x3')]),_0x399adc);}};exports['queuecallerjoin']=function(_0x13aaf0){try{if(!_[_0xaa13('0x17')](recordings[_0x13aaf0['uniqueid']])){utils[_0xaa13('0xd')](util[_0xaa13('0xe')](_0xaa13('0x3b'),_0x13aaf0['uniqueid']),_0x13aaf0);utils[_0xaa13('0x11')](util[_0xaa13('0xe')](_0xaa13('0x3c'),_0x13aaf0[_0xaa13('0x3')],_0x13aaf0[_0xaa13('0x3d')]));recordings[_0x13aaf0[_0xaa13('0x3')]][_0xaa13('0x3d')]=_0x13aaf0[_0xaa13('0x3d')];}}catch(_0x2294a8){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0x3b'),_0x13aaf0[_0xaa13('0x3')]),_0x2294a8);}};exports[_0xaa13('0x3e')]=function(_0x14101e){try{utils[_0xaa13('0xd')](util[_0xaa13('0xe')](_0xaa13('0x3f'),_0x14101e[_0xaa13('0x3')]),_0x14101e);utils[_0xaa13('0x11')](util[_0xaa13('0xe')](_0xaa13('0x40'),_0x14101e[_0xaa13('0x3')],_0x14101e[_0xaa13('0x41')],_0x14101e[_0xaa13('0x42')],_0x14101e[_0xaa13('0x43')],_0x14101e['transfereecalleridname']));if(recordings[_0x14101e['transfereruniqueid']]&&transfers[_0xaa13('0x4')][_0x14101e['transfereruniqueid']]){transfers[_0xaa13('0x4')][_0x14101e[_0xaa13('0x44')]][_0xaa13('0x45')]=!![];}}catch(_0x404968){utils[_0xaa13('0x15')](util[_0xaa13('0xe')](_0xaa13('0x3f'),_0x14101e[_0xaa13('0x3')]),_0x404968);}}; \ No newline at end of file +var _0xd6c2=['connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','toLowerCase','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum'];(function(_0x27c2b3,_0x2e034e){var _0x37ad8c=function(_0x53814c){while(--_0x53814c){_0x27c2b3['push'](_0x27c2b3['shift']());}};_0x37ad8c(++_0x2e034e);}(_0xd6c2,0x187));var _0x2d6c=function(_0x4967f3,_0x598133){_0x4967f3=_0x4967f3-0x0;var _0x15832f=_0xd6c2[_0x4967f3];return _0x15832f;};'use strict';var _=require(_0x2d6c('0x0'));var util=require(_0x2d6c('0x1'));var utils=require(_0x2d6c('0x2'));var transfers=require(_0x2d6c('0x3'));var recordings={};function writeDB(_0x151128){var _0x9a6ecd;utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')](_0x2d6c('0x6'),_0x151128['uniqueid']));if(transfers[_0x2d6c('0x7')][_0x151128[_0x2d6c('0x8')]]){_0x9a6ecd=_0x151128['uniqueid'];_0x151128[_0x2d6c('0x8')]=transfers[_0x2d6c('0x7')][_0x151128[_0x2d6c('0x8')]][_0x2d6c('0x9')];}if(_0x151128[_0x2d6c('0xa')]){utils[_0x2d6c('0xb')](_0x151128['accountcode'])[_0x2d6c('0xc')](function(_0x5eea62){if(_0x5eea62){_0x151128['membername']=_0x5eea62[_0x2d6c('0xd')];_0x151128['UserId']=_0x5eea62['id'];}utils[_0x2d6c('0xe')](_0x2d6c('0xf'),_0x151128);});}else{utils[_0x2d6c('0xe')](_0x2d6c('0xf'),_0x151128);}if(_0x9a6ecd)delete transfers['blinds'][_0x9a6ecd];}exports[_0x2d6c('0x10')]=function(_0x2bad3d){try{utils[_0x2d6c('0x11')](util[_0x2d6c('0x5')](_0x2d6c('0x12'),_0x2bad3d[_0x2d6c('0x8')]),_0x2bad3d);if(_0x2bad3d[_0x2d6c('0x8')]==_0x2bad3d[_0x2d6c('0x13')]){utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2bad3d[_0x2d6c('0x8')],_0x2bad3d[_0x2d6c('0x14')],_0x2bad3d['exten']));recordings[_0x2bad3d[_0x2d6c('0x8')]]={'uniqueid':_0x2bad3d[_0x2d6c('0x8')],'accountcode':_0x2bad3d[_0x2d6c('0xa')],'exten':_0x2bad3d[_0x2d6c('0x15')],'context':_0x2bad3d['context'],'channel':_0x2bad3d[_0x2d6c('0x16')],'monitors':[]};}}catch(_0x1ba1b2){utils[_0x2d6c('0x17')](util[_0x2d6c('0x5')](_0x2d6c('0x12'),_0x2bad3d[_0x2d6c('0x8')]),_0x1ba1b2);}};exports[_0x2d6c('0x18')]=function(_0x5ee563){try{utils[_0x2d6c('0x11')](util[_0x2d6c('0x5')](_0x2d6c('0x19'),_0x5ee563[_0x2d6c('0x8')]),_0x5ee563);if(!_[_0x2d6c('0x1a')](recordings[_0x5ee563['uniqueid']])&&_0x5ee563[_0x2d6c('0x1b')]==0x6){utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')](_0x2d6c('0x1c'),_0x5ee563[_0x2d6c('0x8')],_0x5ee563[_0x2d6c('0x14')],_0x5ee563[_0x2d6c('0x16')]));}else if(!_[_0x2d6c('0x1a')](recordings[_0x5ee563['linkedid']])&&_0x5ee563[_0x2d6c('0x1b')]==0x6&&_0x5ee563[_0x2d6c('0x14')]!=_0x2d6c('0x1d')){utils[_0x2d6c('0x4')](util['format'](_0x2d6c('0x1e'),_0x5ee563['uniqueid'],_0x5ee563['linkedid'],_0x5ee563['context'],_0x5ee563[_0x2d6c('0x16')]));recordings[_0x5ee563['linkedid']]['accountcode']=_0x5ee563[_0x2d6c('0xa')];}}catch(_0x5c9140){utils[_0x2d6c('0x17')](util['format'](_0x2d6c('0x19'),_0x5ee563['uniqueid']),_0x5c9140);}};exports[_0x2d6c('0x1f')]=function(_0x27cf22){try{if(!_[_0x2d6c('0x1a')](_0x27cf22['variable'])&&!_['isNil'](_0x27cf22[_0x2d6c('0x20')][_0x2d6c('0x21')])){utils['debug'](util[_0x2d6c('0x5')](_0x2d6c('0x22'),_0x27cf22[_0x2d6c('0x8')]),_0x27cf22);utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x27cf22[_0x2d6c('0x8')],_0x27cf22[_0x2d6c('0x20')],_0x27cf22[_0x2d6c('0x23')]));if(_[_0x2d6c('0x24')](_0x27cf22[_0x2d6c('0x23')],_0x2d6c('0x25'))){_0x27cf22['value']=_0x27cf22[_0x2d6c('0x23')][_0x2d6c('0x26')](_0x2d6c('0x25'),'.WAV');}if(recordings[_0x27cf22[_0x2d6c('0x13')]]){var _0x215841=_[_0x2d6c('0x27')](recordings[_0x27cf22[_0x2d6c('0x13')]][_0x2d6c('0x28')],{'value':_0x27cf22['value']});if(_[_0x2d6c('0x1a')](_0x215841)){recordings[_0x27cf22[_0x2d6c('0x13')]][_0x2d6c('0x28')][_0x2d6c('0x29')]({'value':_0x27cf22[_0x2d6c('0x23')]});}}}}catch(_0xa332b3){utils['error'](util[_0x2d6c('0x5')](_0x2d6c('0x22'),_0x27cf22[_0x2d6c('0x8')]),_0xa332b3);}};exports[_0x2d6c('0x2a')]=function(_0x36dca9){try{if(!_[_0x2d6c('0x1a')](recordings[_0x36dca9[_0x2d6c('0x8')]])){utils['debug'](util[_0x2d6c('0x5')](_0x2d6c('0x2b'),_0x36dca9[_0x2d6c('0x8')]),_0x36dca9);utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x36dca9['uniqueid'],_0x36dca9[_0x2d6c('0x2c')],_0x36dca9['calleridname'],_0x36dca9['cause-txt']));recordings[_0x36dca9[_0x2d6c('0x8')]][_0x2d6c('0x2c')]=_0x36dca9[_0x2d6c('0x2c')];recordings[_0x36dca9[_0x2d6c('0x8')]][_0x2d6c('0x2d')]=_0x36dca9[_0x2d6c('0x2d')];recordings[_0x36dca9[_0x2d6c('0x8')]][_0x2d6c('0x2e')]=_0x36dca9[_0x2d6c('0x2e')];recordings[_0x36dca9[_0x2d6c('0x8')]]['connectedlinename']=_0x36dca9[_0x2d6c('0x2f')];if(recordings[_0x36dca9['uniqueid']][_0x2d6c('0x30')]==_0x2d6c('0x31')&&recordings[_0x36dca9[_0x2d6c('0x8')]][_0x2d6c('0xa')]){recordings[_0x36dca9[_0x2d6c('0x8')]]['connectedlinenum']=recordings[_0x36dca9[_0x2d6c('0x8')]][_0x2d6c('0xa')];recordings[_0x36dca9[_0x2d6c('0x8')]][_0x2d6c('0x2f')]='';}recordings[_0x36dca9[_0x2d6c('0x8')]]['monitors'][_0x2d6c('0x32')](function(_0x5adc16){var _0x2c6f8a=_[_0x2d6c('0x33')](recordings[_0x36dca9[_0x2d6c('0x8')]]);_0x2c6f8a[_0x2d6c('0x23')]=_0x5adc16[_0x2d6c('0x23')];writeDB(_0x2c6f8a);});delete recordings[_0x36dca9['uniqueid']];}}catch(_0x3fe2c){utils[_0x2d6c('0x17')](util['format'](_0x2d6c('0x2b'),_0x36dca9['uniqueid']),_0x3fe2c);}};exports[_0x2d6c('0x34')]=function(_0x1083e7){try{if(!_[_0x2d6c('0x1a')](recordings[_0x1083e7['uniqueid']])){utils[_0x2d6c('0x11')](util['format'](_0x2d6c('0x35'),_0x1083e7[_0x2d6c('0x8')]),_0x1083e7);utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1083e7[_0x2d6c('0x8')],_0x1083e7[_0x2d6c('0x36')],_0x1083e7[_0x2d6c('0x37')]));if(_0x1083e7[_0x2d6c('0x36')]['toLowerCase']()==_0x2d6c('0x38')&&_[_0x2d6c('0x39')](_0x1083e7[_0x2d6c('0x37')][_0x2d6c('0x3a')](),'cdr')){var _0x1d075d=_0x1083e7[_0x2d6c('0x37')]['split']('=');var _0x340879=_0x1d075d[0x0][_0x2d6c('0x3b')](_0x1d075d[0x0]['lastIndexOf']('(')+0x1,_0x1d075d[0x0][_0x2d6c('0x3c')](')'));var _0x248dbc=_0x1d075d[0x1];recordings[_0x1083e7[_0x2d6c('0x8')]][_0x340879]=_0x248dbc;}}}catch(_0xc9ceed){utils[_0x2d6c('0x17')](util['format'](_0x2d6c('0x35'),_0x1083e7[_0x2d6c('0x8')]),_0xc9ceed);}};exports[_0x2d6c('0x3d')]=function(_0x5a797a){try{if(!_[_0x2d6c('0x1a')](recordings[_0x5a797a['uniqueid']])){utils[_0x2d6c('0x11')](util[_0x2d6c('0x5')](_0x2d6c('0x3e'),_0x5a797a[_0x2d6c('0x8')]),_0x5a797a);utils[_0x2d6c('0x4')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5a797a[_0x2d6c('0x8')],_0x5a797a[_0x2d6c('0x3f')]));recordings[_0x5a797a[_0x2d6c('0x8')]][_0x2d6c('0x3f')]=_0x5a797a['queue'];}}catch(_0x474ed9){utils[_0x2d6c('0x17')](util['format']('[%s][recordings][queuecallerjoin]',_0x5a797a['uniqueid']),_0x474ed9);}};exports[_0x2d6c('0x40')]=function(_0x39fb18){try{utils[_0x2d6c('0x11')](util[_0x2d6c('0x5')](_0x2d6c('0x41'),_0x39fb18[_0x2d6c('0x8')]),_0x39fb18);utils[_0x2d6c('0x4')](util[_0x2d6c('0x5')](_0x2d6c('0x42'),_0x39fb18[_0x2d6c('0x8')],_0x39fb18[_0x2d6c('0x43')],_0x39fb18[_0x2d6c('0x44')],_0x39fb18[_0x2d6c('0x45')],_0x39fb18[_0x2d6c('0x46')]));if(recordings[_0x39fb18[_0x2d6c('0x47')]]&&transfers['blinds'][_0x39fb18['transfereruniqueid']]){transfers['blinds'][_0x39fb18[_0x2d6c('0x47')]][_0x2d6c('0x48')]=!![];}}catch(_0xecc56b){utils[_0x2d6c('0x17')](util['format'](_0x2d6c('0x41'),_0x39fb18['uniqueid']),_0xecc56b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3c21b53..9dfcbef 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 _0x2330=['secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','blinds','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0x1e2671,_0x4cf90a){var _0x492489=function(_0x1440b6){while(--_0x1440b6){_0x1e2671['push'](_0x1e2671['shift']());}};_0x492489(++_0x4cf90a);}(_0x2330,0xab));var _0x0233=function(_0x28ac0e,_0x1b2592){_0x28ac0e=_0x28ac0e-0x0;var _0x10a35e=_0x2330[_0x28ac0e];return _0x10a35e;};'use strict';var _=require(_0x0233('0x0'));var util=require(_0x0233('0x1'));var utils=require(_0x0233('0x2'));function writeDB(_0x234626){utils[_0x0233('0x3')](util['format'](_0x0233('0x4'),_0x234626[_0x0233('0x5')]===_0x0233('0x6')?_0x234626[_0x0233('0x7')]:_0x234626[_0x0233('0x8')],_0x234626[_0x0233('0x5')]));utils['request']('CreateVoiceTransferReport',_0x234626);}exports[_0x0233('0x9')]={};exports['blindtransfer']=function(_0x56b196){try{utils[_0x0233('0xa')](util['format'](_0x0233('0xb'),_0x56b196['uniqueid']),_0x56b196);utils[_0x0233('0x3')](util[_0x0233('0xc')](_0x0233('0xd'),_0x56b196['uniqueid'],_0x56b196[_0x0233('0xe')],_0x56b196[_0x0233('0xf')],_0x56b196[_0x0233('0x10')],_0x56b196[_0x0233('0x11')]));_0x56b196[_0x0233('0x5')]='blind';exports[_0x0233('0x9')][_0x56b196[_0x0233('0x12')]]=_0x56b196;writeDB(_0x56b196);}catch(_0x144c25){utils[_0x0233('0x13')](util[_0x0233('0xc')](_0x0233('0xb'),_0x56b196[_0x0233('0x8')]),_0x144c25);}};exports[_0x0233('0x14')]=function(_0x140353){try{utils[_0x0233('0xa')](util[_0x0233('0xc')](_0x0233('0x15'),_0x140353[_0x0233('0x7')]),_0x140353);utils[_0x0233('0x3')](util[_0x0233('0xc')](_0x0233('0x16'),_0x140353[_0x0233('0x7')],_0x140353['origtransferercalleridnum'],_0x140353[_0x0233('0x17')],_0x140353[_0x0233('0x18')],_0x140353[_0x0233('0x19')]));_0x140353=_[_0x0233('0x1a')](_0x140353,{'transfererchannel':_0x140353[_0x0233('0x1b')],'transferercalleridnum':_0x140353[_0x0233('0x1c')],'transferercalleridname':_0x140353['origtransferercalleridname'],'transfererconnectedlinenum':_0x140353['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x140353[_0x0233('0x1d')],'transfereraccountcode':_0x140353['origtransfereraccountcode'],'transferercontext':_0x140353[_0x0233('0x1e')],'transfererexten':_0x140353[_0x0233('0x1f')],'transfererlinkedid':_0x140353['origtransfererlinkedid'],'context':_0x140353[_0x0233('0x20')],'extension':_0x140353[_0x0233('0x21')],'type':_0x0233('0x6')});if(_['isNil'](_0x140353[_0x0233('0x22')])){_0x140353=_[_0x0233('0x1a')](_0x140353,{'transfereechannel':_0x140353[_0x0233('0x23')],'transfereecalleridnum':_0x140353['transfertargetcalleridnum'],'transfereecalleridname':_0x140353[_0x0233('0x19')],'transfereeconnectedlinenum':_0x140353[_0x0233('0x24')],'transfereeconnectedlinename':_0x140353['transfertargetconnectedlinename'],'transfereeaccountcode':_0x140353[_0x0233('0x25')],'transfereecontext':_0x140353[_0x0233('0x26')],'transfereeexten':_0x140353[_0x0233('0x27')],'transfereelinkedid':_0x140353['transfertargetlinkedid']});}writeDB(_0x140353);}catch(_0x123f2b){utils['error'](util['format'](_0x0233('0x15'),_0x140353[_0x0233('0x7')]),_0x123f2b);}}; \ No newline at end of file +var _0x92cc=['attended','uniqueid','type','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','error','attendedtransfer','debug','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x221f55,_0xada650){var _0x55138d=function(_0x1c66dd){while(--_0x1c66dd){_0x221f55['push'](_0x221f55['shift']());}};_0x55138d(++_0xada650);}(_0x92cc,0x12b));var _0xc92c=function(_0x343d10,_0x1e3b00){_0x343d10=_0x343d10-0x0;var _0x370e80=_0x92cc[_0x343d10];return _0x370e80;};'use strict';var _=require('lodash');var util=require(_0xc92c('0x0'));var utils=require(_0xc92c('0x1'));function writeDB(_0x26d0ae){utils[_0xc92c('0x2')](util[_0xc92c('0x3')](_0xc92c('0x4'),_0x26d0ae['type']===_0xc92c('0x5')?_0x26d0ae['origtransfereruniqueid']:_0x26d0ae[_0xc92c('0x6')],_0x26d0ae[_0xc92c('0x7')]));utils['request'](_0xc92c('0x8'),_0x26d0ae);}exports['blinds']={};exports['blindtransfer']=function(_0x29b534){try{utils['debug'](util[_0xc92c('0x3')](_0xc92c('0x9'),_0x29b534[_0xc92c('0x6')]),_0x29b534);utils[_0xc92c('0x2')](util[_0xc92c('0x3')](_0xc92c('0xa'),_0x29b534[_0xc92c('0x6')],_0x29b534[_0xc92c('0xb')],_0x29b534['transferercalleridname'],_0x29b534[_0xc92c('0xc')],_0x29b534[_0xc92c('0xd')]));_0x29b534[_0xc92c('0x7')]='blind';exports[_0xc92c('0xe')][_0x29b534[_0xc92c('0xf')]]=_0x29b534;writeDB(_0x29b534);}catch(_0x2471b1){utils[_0xc92c('0x10')](util['format'](_0xc92c('0x9'),_0x29b534['uniqueid']),_0x2471b1);}};exports[_0xc92c('0x11')]=function(_0x502fab){try{utils[_0xc92c('0x12')](util[_0xc92c('0x3')]('[%s][transfers][attendedtransfer]',_0x502fab[_0xc92c('0x13')]),_0x502fab);utils[_0xc92c('0x2')](util[_0xc92c('0x3')](_0xc92c('0x14'),_0x502fab['origtransfereruniqueid'],_0x502fab[_0xc92c('0x15')],_0x502fab['origtransferercalleridname'],_0x502fab[_0xc92c('0x16')],_0x502fab['transfertargetcalleridname']));_0x502fab=_[_0xc92c('0x17')](_0x502fab,{'transfererchannel':_0x502fab['origtransfererchannel'],'transferercalleridnum':_0x502fab[_0xc92c('0x15')],'transferercalleridname':_0x502fab[_0xc92c('0x18')],'transfererconnectedlinenum':_0x502fab[_0xc92c('0x19')],'transfererconnectedlinename':_0x502fab[_0xc92c('0x1a')],'transfereraccountcode':_0x502fab['origtransfereraccountcode'],'transferercontext':_0x502fab['secondtransferercontext'],'transfererexten':_0x502fab['secondtransfererexten'],'transfererlinkedid':_0x502fab[_0xc92c('0x1b')],'context':_0x502fab[_0xc92c('0x1c')],'extension':_0x502fab[_0xc92c('0x1d')],'type':_0xc92c('0x5')});if(_['isNil'](_0x502fab[_0xc92c('0x1e')])){_0x502fab=_[_0xc92c('0x17')](_0x502fab,{'transfereechannel':_0x502fab[_0xc92c('0x1f')],'transfereecalleridnum':_0x502fab[_0xc92c('0x16')],'transfereecalleridname':_0x502fab[_0xc92c('0x20')],'transfereeconnectedlinenum':_0x502fab[_0xc92c('0x21')],'transfereeconnectedlinename':_0x502fab['transfertargetconnectedlinename'],'transfereeaccountcode':_0x502fab[_0xc92c('0x22')],'transfereecontext':_0x502fab[_0xc92c('0x23')],'transfereeexten':_0x502fab[_0xc92c('0x24')],'transfereelinkedid':_0x502fab[_0xc92c('0x25')]});}writeDB(_0x502fab);}catch(_0x339f4b){utils['error'](util[_0xc92c('0x3')]('[%s][transfers][attendedtransfer]',_0x502fab[_0xc92c('0x13')]),_0x339f4b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8a4df75..d8e3e34 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 _0x441d=['request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','xdr','info','inspect','debug','error'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x441d,0x17e));var _0xd441=function(_0x5cc40d,_0x2928c4){_0x5cc40d=_0x5cc40d-0x0;var _0x12de9f=_0x441d[_0x5cc40d];return _0x12de9f;};'use strict';var BPromise=require(_0xd441('0x0'));var jayson=require(_0xd441('0x1'));var moment=require('moment');var util=require(_0xd441('0x2'));var client=jayson[_0xd441('0x3')][_0xd441('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xd441('0x5'));exports['info']=function(_0x41e1de,_0x4dd85b){logger[_0xd441('0x6')](_0x41e1de,_0x4dd85b?util[_0xd441('0x7')](_0x4dd85b,{'showHidden':![],'depth':null}):'');};exports[_0xd441('0x8')]=function(_0x5dbc78,_0x4d3d71){logger['debug'](_0x5dbc78,_0x4d3d71?util[_0xd441('0x7')](_0x4d3d71,{'showHidden':![],'depth':null}):'');};exports[_0xd441('0x9')]=function(_0x121a10,_0x2877ef){logger['error'](_0x121a10,_0x2877ef?util[_0xd441('0x7')](_0x2877ef,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x46bb32,_0x558cd3){return client[_0xd441('0xa')](_0x46bb32,{'body':_0x558cd3})[_0xd441('0xb')](function(_0x1ce8e3){logger['debug'](_0xd441('0xc'),_0x46bb32,_0x1ce8e3?util[_0xd441('0x7')](_0x1ce8e3,{'showHidden':![],'depth':null}):'');})[_0xd441('0xd')](function(_0x1ba449){logger[_0xd441('0x9')]('[utils][request]\x20name:%s',_0x46bb32,_0x1ba449?util[_0xd441('0x7')](_0x1ba449,{'showHidden':![],'depth':null}):'');});};function getUser(_0x246419){return client[_0xd441('0xa')](_0xd441('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xd441('0xf'),_0xd441('0x10')],'where':_0x246419,'limit':0x1}})[_0xd441('0xb')](function(_0xb9c74b){logger[_0xd441('0x8')](_0xd441('0x11'),JSON[_0xd441('0x12')](_0x246419),_0xb9c74b?util[_0xd441('0x7')](_0xb9c74b,{'showHidden':![],'depth':null}):'');return _0xb9c74b['result'][_0xd441('0x13')]?_0xb9c74b[_0xd441('0x14')][0x0]:null;});}exports[_0xd441('0x15')]=function(_0x40678c){return new BPromise(function(_0x301ee1,_0x352573){if(_0x40678c){return getUser({'internal':_0x40678c})[_0xd441('0xb')](function(_0x2734b4){logger['info'](_0xd441('0x16'),_0x40678c,_0x2734b4?'found':_0xd441('0x17'));return _0x301ee1(_0x2734b4);})[_0xd441('0xd')](function(_0x3f0871){logger[_0xd441('0x9')](_0xd441('0x18'),_0x3f0871?util[_0xd441('0x7')](_0x3f0871,{'showHidden':![],'depth':null}):'');return _0x301ee1(null);});}return _0x301ee1(null);});};exports[_0xd441('0x19')]=function(_0x416d2d){return new BPromise(function(_0x962017,_0x26284f){if(_0x416d2d){return getUser({'interface':_0x416d2d})['then'](function(_0x12eaa3){logger[_0xd441('0x6')](_0xd441('0x1a'),_0x416d2d,_0x12eaa3?_0xd441('0x1b'):_0xd441('0x17'));return _0x962017(_0x12eaa3);})[_0xd441('0xd')](function(_0x5e203d){logger['error']('[utils][getUserByInterface]',_0x5e203d?util['inspect'](_0x5e203d,{'showHidden':![],'depth':null}):'');return _0x962017(null);});}return _0x962017(null);});};exports[_0xd441('0x1c')]=function(_0x2878f3){return new BPromise(function(_0x59748d,_0xd46dc){if(_0x2878f3){return getUser({'name':_0x2878f3})[_0xd441('0xb')](function(_0x1a0b01){logger['info'](_0xd441('0x1d'),_0x2878f3,_0x1a0b01?_0xd441('0x1b'):'notfound');return _0x59748d(_0x1a0b01);})['catch'](function(_0x3ebafa){logger['error'](_0xd441('0x1e'),_0x3ebafa?util[_0xd441('0x7')](_0x3ebafa,{'showHidden':![],'depth':null}):'');return _0x59748d(null);});}return _0x59748d(null);});};exports[_0xd441('0x1f')]=function(_0x1bd6aa){return new BPromise(function(_0x26ec29,_0x5a05b9){if(_0x1bd6aa){return client[_0xd441('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd441('0xf'),_0xd441('0x20'),_0xd441('0x21'),'acwTimeout'],'where':{'name':_0x1bd6aa},'limit':0x1}})[_0xd441('0xb')](function(_0x35d5ce){logger[_0xd441('0x8')](_0xd441('0x22'),_0x1bd6aa,_0x35d5ce?util[_0xd441('0x7')](_0x35d5ce,{'showHidden':![],'depth':null}):'');logger[_0xd441('0x6')](_0xd441('0x23'),_0x1bd6aa,_0x35d5ce?_0xd441('0x1b'):_0xd441('0x17'));return _0x26ec29(_0x35d5ce[_0xd441('0x14')][_0xd441('0x13')]?_0x35d5ce['result'][0x0]:null);})['catch'](function(_0xd61fdb){logger[_0xd441('0x9')](_0xd441('0x24'),_0xd61fdb?util[_0xd441('0x7')](_0xd61fdb,{'showHidden':![],'depth':null}):'');return _0x26ec29(null);});}return _0x26ec29(null);});};exports[_0xd441('0x25')]=function(_0x34b46b,_0x45ea84){return moment(_0x34b46b)[_0xd441('0x26')](_0x45ea84,_0xd441('0x27'))[_0xd441('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xd441('0x29')]=function(_0x501363,_0x165b95){return moment(_0x501363)[_0xd441('0x2a')](_0x165b95,_0xd441('0x27'))[_0xd441('0x28')](_0xd441('0x2b'));};exports['diffTime']=function(_0x4b66b1,_0xf938ca){return moment(_0x4b66b1)[_0xd441('0x2c')](moment(_0xf938ca),_0xd441('0x27'));};exports[_0xd441('0x2d')]=function(_0x2ac1e2,_0x101760){return parseInt(_0x2ac1e2,0xa)+parseInt(_0x101760,0xa);};exports[_0xd441('0x2e')]=function(){return moment()[_0xd441('0x28')](_0xd441('0x2b'));};exports[_0xd441('0x2f')]=function(_0xe77b39,_0x264410){if(_0x264410){return moment(_0xe77b39)[_0xd441('0x2f')](_0x264410);}return!![];};exports[_0xd441('0x30')]=function(_0x5bf210,_0x4cfe13){if(_0x4cfe13){return moment(_0x5bf210)['isBefore'](_0x4cfe13);}else if(_0x5bf210){return!![];}return![];}; \ No newline at end of file +var _0xcb2c=['http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','util','client'];(function(_0x4a7fb4,_0x76c713){var _0x195369=function(_0x2ff75f){while(--_0x2ff75f){_0x4a7fb4['push'](_0x4a7fb4['shift']());}};_0x195369(++_0x76c713);}(_0xcb2c,0x1c9));var _0xccb2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcb2c[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xccb2('0x0'));var moment=require('moment');var util=require(_0xccb2('0x1'));var client=jayson[_0xccb2('0x2')][_0xccb2('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0xccb2('0x4'));exports[_0xccb2('0x5')]=function(_0x2c413e,_0x4d1f2a){logger[_0xccb2('0x5')](_0x2c413e,_0x4d1f2a?util[_0xccb2('0x6')](_0x4d1f2a,{'showHidden':![],'depth':null}):'');};exports[_0xccb2('0x7')]=function(_0x1c5876,_0x42c186){logger[_0xccb2('0x7')](_0x1c5876,_0x42c186?util[_0xccb2('0x6')](_0x42c186,{'showHidden':![],'depth':null}):'');};exports[_0xccb2('0x8')]=function(_0x30ecb0,_0x24e6f1){logger[_0xccb2('0x8')](_0x30ecb0,_0x24e6f1?util[_0xccb2('0x6')](_0x24e6f1,{'showHidden':![],'depth':null}):'');};exports[_0xccb2('0x9')]=function(_0x52d97d,_0x13d90b){return client[_0xccb2('0x9')](_0x52d97d,{'body':_0x13d90b})[_0xccb2('0xa')](function(_0x5f487f){logger[_0xccb2('0x7')](_0xccb2('0xb'),_0x52d97d,_0x5f487f?util[_0xccb2('0x6')](_0x5f487f,{'showHidden':![],'depth':null}):'');})[_0xccb2('0xc')](function(_0x1213a2){logger[_0xccb2('0x8')]('[utils][request]\x20name:%s',_0x52d97d,_0x1213a2?util[_0xccb2('0x6')](_0x1213a2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x455ee4){return client[_0xccb2('0x9')](_0xccb2('0xd'),{'options':{'raw':!![],'attributes':['id','internal','name',_0xccb2('0xe')],'where':_0x455ee4,'limit':0x1}})['then'](function(_0xc8f648){logger[_0xccb2('0x7')](_0xccb2('0xf'),JSON['stringify'](_0x455ee4),_0xc8f648?util[_0xccb2('0x6')](_0xc8f648,{'showHidden':![],'depth':null}):'');return _0xc8f648['result']['length']?_0xc8f648[_0xccb2('0x10')][0x0]:null;});}exports[_0xccb2('0x11')]=function(_0x549871){return new BPromise(function(_0x3255d9,_0x86c0ed){if(_0x549871){return getUser({'internal':_0x549871})[_0xccb2('0xa')](function(_0x2353cb){logger[_0xccb2('0x5')](_0xccb2('0x12'),_0x549871,_0x2353cb?_0xccb2('0x13'):'notfound');return _0x3255d9(_0x2353cb);})['catch'](function(_0x120d61){logger[_0xccb2('0x8')](_0xccb2('0x14'),_0x120d61?util[_0xccb2('0x6')](_0x120d61,{'showHidden':![],'depth':null}):'');return _0x3255d9(null);});}return _0x3255d9(null);});};exports['getUserByInterface']=function(_0x405685){return new BPromise(function(_0x35d5a7,_0x551939){if(_0x405685){return getUser({'interface':_0x405685})[_0xccb2('0xa')](function(_0x1763f5){logger[_0xccb2('0x5')](_0xccb2('0x15'),_0x405685,_0x1763f5?_0xccb2('0x13'):_0xccb2('0x16'));return _0x35d5a7(_0x1763f5);})[_0xccb2('0xc')](function(_0x1896fc){logger[_0xccb2('0x8')](_0xccb2('0x17'),_0x1896fc?util['inspect'](_0x1896fc,{'showHidden':![],'depth':null}):'');return _0x35d5a7(null);});}return _0x35d5a7(null);});};exports[_0xccb2('0x18')]=function(_0x4df216){return new BPromise(function(_0x402f3e,_0x237979){if(_0x4df216){return getUser({'name':_0x4df216})['then'](function(_0x355a9a){logger[_0xccb2('0x5')](_0xccb2('0x19'),_0x4df216,_0x355a9a?_0xccb2('0x13'):'notfound');return _0x402f3e(_0x355a9a);})['catch'](function(_0x4d58a5){logger[_0xccb2('0x8')](_0xccb2('0x1a'),_0x4d58a5?util[_0xccb2('0x6')](_0x4d58a5,{'showHidden':![],'depth':null}):'');return _0x402f3e(null);});}return _0x402f3e(null);});};exports['getVoiceQueueByName']=function(_0x1e48b8){return new BPromise(function(_0x133fde,_0x1541d8){if(_0x1e48b8){return client['request'](_0xccb2('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xccb2('0x1c'),_0xccb2('0x1d'),'acw','acwTimeout'],'where':{'name':_0x1e48b8},'limit':0x1}})[_0xccb2('0xa')](function(_0xc0ac03){logger['debug'](_0xccb2('0x1e'),_0x1e48b8,_0xc0ac03?util[_0xccb2('0x6')](_0xc0ac03,{'showHidden':![],'depth':null}):'');logger[_0xccb2('0x5')](_0xccb2('0x1f'),_0x1e48b8,_0xc0ac03?'found':_0xccb2('0x16'));return _0x133fde(_0xc0ac03['result'][_0xccb2('0x20')]?_0xc0ac03[_0xccb2('0x10')][0x0]:null);})[_0xccb2('0xc')](function(_0x1213df){logger[_0xccb2('0x8')](_0xccb2('0x21'),_0x1213df?util['inspect'](_0x1213df,{'showHidden':![],'depth':null}):'');return _0x133fde(null);});}return _0x133fde(null);});};exports['addTime']=function(_0x4c241d,_0x3387d0){return moment(_0x4c241d)[_0xccb2('0x22')](_0x3387d0,_0xccb2('0x23'))[_0xccb2('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xccb2('0x25')]=function(_0x3bc644,_0x4b33eb){return moment(_0x3bc644)[_0xccb2('0x26')](_0x4b33eb,_0xccb2('0x23'))[_0xccb2('0x24')](_0xccb2('0x27'));};exports[_0xccb2('0x28')]=function(_0x479f0f,_0xf7bc09){return moment(_0x479f0f)[_0xccb2('0x29')](moment(_0xf7bc09),_0xccb2('0x23'));};exports[_0xccb2('0x2a')]=function(_0x3f4e1a,_0xad3a53){return parseInt(_0x3f4e1a,0xa)+parseInt(_0xad3a53,0xa);};exports[_0xccb2('0x2b')]=function(){return moment()[_0xccb2('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xccb2('0x2c')]=function(_0x13f751,_0x577ee8){if(_0x577ee8){return moment(_0x13f751)['isAfter'](_0x577ee8);}return!![];};exports[_0xccb2('0x2d')]=function(_0x4ab3f3,_0x201557){if(_0x201557){return moment(_0x4ab3f3)['isBefore'](_0x201557);}else if(_0x4ab3f3){return!![];}return![];}; \ No newline at end of file